From b333a5d509b7cbe78cee0d9a389309f93ab02483 Mon Sep 17 00:00:00 2001 From: gwl Date: Thu, 27 Feb 2014 16:05:00 +0800 Subject: [PATCH] wifi: remove patch drivers/net/wireless --- drivers/net/wireless/Kconfig | 289 - drivers/net/wireless/Makefile | 59 - drivers/net/wireless/adm8211.c | 1996 -- drivers/net/wireless/adm8211.h | 602 - drivers/net/wireless/airo.c | 8222 ----- drivers/net/wireless/airo.h | 9 - drivers/net/wireless/airo_cs.c | 222 - drivers/net/wireless/ar6003/Kconfig | 9 - drivers/net/wireless/ar6003/Makefile | 77 - drivers/net/wireless/ar6003/clean.sh | 5 - drivers/net/wireless/ar6003/host/Makefile | 174 - .../ar6003/host/bmi/include/bmi_internal.h | 40 - .../net/wireless/ar6003/host/bmi/src/bmi.c | 774 - .../net/wireless/ar6003/host/bmi/src/makefile | 26 - drivers/net/wireless/ar6003/host/dfs/dfs.c | 228 - drivers/net/wireless/ar6003/host/dfs/dfs_ar.c | 262 - .../wireless/ar6003/host/dfs/dfs_bindetects.c | 340 - .../net/wireless/ar6003/host/dfs/dfs_debug.c | 71 - .../wireless/ar6003/host/dfs/dfs_fcc_bin5.c | 189 - .../ar6003/host/dfs/dfs_host_project.c | 45 - .../net/wireless/ar6003/host/dfs/dfs_init.c | 375 - .../net/wireless/ar6003/host/dfs/dfs_misc.c | 120 - .../ar6003/host/dfs/dfs_process_phyerr.c | 99 - .../ar6003/host/dfs/dfs_process_radarevent.c | 316 - .../wireless/ar6003/host/dfs/dfs_staggered.c | 202 - .../wireless/ar6003/host/dfs/dfs_target_api.h | 31 - drivers/net/wireless/ar6003/host/dfs/makefile | 26 - .../host/hif/common/hif_bmi_reg_access.c | 379 - .../host/hif/common/hif_diag_reg_access.c | 266 - .../ar6003/host/hif/common/hif_sdio_common.h | 102 - .../wireless/ar6003/host/hif/common/makefile | 12 - .../wireless/ar6003/host/hif/sdio/Makefile | 90 - .../sdio/linux_sdio/include/hif_internal.h | 137 - .../ar6003/host/hif/sdio/linux_sdio/src/hif.c | 1504 - .../hif/sdio/linux_sdio/src/hif_scatter.c | 393 - .../wireless/ar6003/host/htc2/AR6000/ar6k.c | 1463 - .../wireless/ar6003/host/htc2/AR6000/ar6k.h | 399 - .../ar6003/host/htc2/AR6000/ar6k_events.c | 767 - .../ar6003/host/htc2/AR6000/ar6k_gmbox.c | 757 - .../host/htc2/AR6000/ar6k_gmbox_hciuart.c | 1289 - .../wireless/ar6003/host/htc2/AR6000/makefile | 26 - drivers/net/wireless/ar6003/host/htc2/htc.c | 578 - .../net/wireless/ar6003/host/htc2/htc_debug.h | 38 - .../wireless/ar6003/host/htc2/htc_internal.h | 217 - .../net/wireless/ar6003/host/htc2/htc_recv.c | 1572 - .../net/wireless/ar6003/host/htc2/htc_send.c | 1024 - .../wireless/ar6003/host/htc2/htc_services.c | 449 - .../wireless/ar6003/host/include/a_config.h | 57 - .../wireless/ar6003/host/include/a_debug.h | 219 - .../net/wireless/ar6003/host/include/a_drv.h | 50 - .../wireless/ar6003/host/include/a_drv_api.h | 333 - .../wireless/ar6003/host/include/a_osapi.h | 58 - .../wireless/ar6003/host/include/a_types.h | 54 - .../ar6003/host/include/aggr_recv_api.h | 156 - .../wireless/ar6003/host/include/ar3kconfig.h | 65 - .../wireless/ar6003/host/include/ar6000_api.h | 54 - .../ar6003/host/include/ar6000_diag.h | 48 - .../ar6003/host/include/ar6kap_common.h | 46 - .../ar6003/host/include/athbtfilter.h | 135 - .../wireless/ar6003/host/include/athendpack.h | 52 - .../ar6003/host/include/athstartpack.h | 69 - .../net/wireless/ar6003/host/include/bmi.h | 140 - .../wireless/ar6003/host/include/common_drv.h | 107 - .../wireless/ar6003/host/include/dbglog_api.h | 58 - .../wireless/ar6003/host/include/dfs_host.h | 387 - .../ar6003/host/include/dfs_host_project.h | 57 - .../wireless/ar6003/host/include/dl_list.h | 153 - .../wireless/ar6003/host/include/dset_api.h | 65 - .../wireless/ar6003/host/include/gpio_api.h | 59 - .../ar6003/host/include/hci_transport_api.h | 259 - .../net/wireless/ar6003/host/include/hif.h | 517 - .../ar6003/host/include/host_reg_table.h | 226 - .../ar6003/host/include/host_version.h | 52 - .../wireless/ar6003/host/include/htc_api.h | 575 - .../wireless/ar6003/host/include/htc_packet.h | 227 - .../wireless/ar6003/host/include/p2p_api.h | 116 - .../wireless/ar6003/host/include/project.h | 36 - .../ar6003/host/include/target_reg_table.h | 349 - .../wireless/ar6003/host/include/utils_api.h | 103 - .../wireless/ar6003/host/include/wlan_api.h | 137 - .../wireless/ar6003/host/include/wmi_api.h | 565 - .../net/wireless/ar6003/host/lib/wac/Makefile | 46 - .../net/wireless/ar6003/host/lib/wac/wac.c | 1446 - .../ar6003/host/lib/wac/wac_lib_api.h | 92 - .../wireless/ar6003/host/localmake.linux.inc | 40 - .../host/miscdrv/ar3k/30000/PS_ASIC.pst | 59 - .../host/miscdrv/ar3k/30000/RamPatch.txt | 2 - .../host/miscdrv/ar3k/30000coex/PS_ASIC.pst | 68 - .../ar3k/30000coex/PS_ASIC_aclHighPri.pst | 68 - .../ar3k/30000coex/PS_ASIC_aclLowPri.pst | 68 - .../host/miscdrv/ar3k/30000coex/RamPatch.txt | 2 - .../host/miscdrv/ar3k/30101/PS_ASIC.pst | 65 - .../host/miscdrv/ar3k/30101/RamPatch.txt | 2 - .../ar6003/host/miscdrv/ar3k/30101/Readme.txt | 22 - .../host/miscdrv/ar3k/30101coex/PS_ASIC.pst | 93 - .../ar3k/30101coex/PS_ASIC_aclHighPri.pst | 93 - .../ar3k/30101coex/PS_ASIC_aclLowPri.pst | 93 - .../host/miscdrv/ar3k/30101coex/RamPatch.txt | 2 - .../wireless/ar6003/host/miscdrv/ar3kconfig.c | 569 - .../ar6003/host/miscdrv/ar3kps/ar3kpsconfig.c | 694 - .../ar6003/host/miscdrv/ar3kps/ar3kpsconfig.h | 79 - .../ar6003/host/miscdrv/ar3kps/ar3kpsparser.c | 989 - .../ar6003/host/miscdrv/ar3kps/ar3kpsparser.h | 127 - .../wireless/ar6003/host/miscdrv/common_drv.c | 882 - .../ar6003/host/miscdrv/credit_dist.c | 417 - .../net/wireless/ar6003/host/miscdrv/makefile | 26 - .../wireless/ar6003/host/miscdrv/miscdrv.h | 38 - .../wireless/ar6003/host/os/linux/Makefile | 338 - .../ar6003/host/os/linux/ar6000_android.c | 965 - .../ar6003/host/os/linux/ar6000_drv.c | 8934 ----- .../wireless/ar6003/host/os/linux/ar6000_pm.c | 1115 - .../ar6003/host/os/linux/ar6000_raw_if.c | 465 - .../ar6003/host/os/linux/ar6k_mem_debug.c | 246 - .../wireless/ar6003/host/os/linux/ar6k_pal.c | 471 - .../wireless/ar6003/host/os/linux/cfg80211.c | 1638 - .../wireless/ar6003/host/os/linux/eeprom.c | 569 - .../host/os/linux/export_hci_transport.c | 122 - .../ar6003/host/os/linux/hci_bridge.c | 1174 - .../ar6003/host/os/linux/include/ar6000_drv.h | 919 - .../ar6003/host/os/linux/include/ar6k_pal.h | 47 - .../host/os/linux/include/ar6xapi_linux.h | 244 - .../host/os/linux/include/athdrv_linux.h | 1470 - .../host/os/linux/include/athtypes_linux.h | 53 - .../ar6003/host/os/linux/include/cfg80211.h | 50 - .../host/os/linux/include/config_linux.h | 70 - .../host/os/linux/include/debug_linux.h | 50 - .../os/linux/include/export_hci_transport.h | 76 - .../host/os/linux/include/ieee80211_ioctl.h | 181 - .../host/os/linux/include/osapi_linux.h | 432 - .../host/os/linux/include/wlan_config.h | 146 - .../host/os/linux/include/wmi_filter_linux.h | 346 - .../net/wireless/ar6003/host/os/linux/ioctl.c | 5611 --- .../wireless/ar6003/host/os/linux/netbuf.c | 272 - .../ar6003/host/os/linux/wireless_ext.c | 2945 -- drivers/net/wireless/ar6003/host/p2p/makefile | 26 - .../wireless/ar6003/host/p2p/p2p_internal.h | 93 - .../net/wireless/ar6003/host/p2p/p2p_main.c | 2676 -- .../wireless/ar6003/host/regtable/AR6002def.c | 65 - .../wireless/ar6003/host/regtable/AR6003def.c | 52 - .../ar6003/host/regtable/MCKINLEYdef.c | 50 - .../wireless/ar6003/host/regtable/hostdef.h | 37 - .../wireless/ar6003/host/regtable/makefile | 26 - .../wireless/ar6003/host/regtable/regtable.c | 73 - .../wireless/ar6003/host/regtable/targetdef.h | 37 - .../ar6003/host/reorder/aggr_rx_internal.h | 125 - .../net/wireless/ar6003/host/reorder/makefile | 26 - .../wireless/ar6003/host/reorder/rcv_aggr.c | 749 - .../ar6003/host/wlan/include/ieee80211.h | 401 - .../ar6003/host/wlan/include/ieee80211_node.h | 84 - .../wireless/ar6003/host/wlan/src/makefile | 26 - .../wireless/ar6003/host/wlan/src/wlan_node.c | 644 - .../ar6003/host/wlan/src/wlan_recv_beacon.c | 206 - .../ar6003/host/wlan/src/wlan_utils.c | 62 - drivers/net/wireless/ar6003/host/wmi/makefile | 26 - drivers/net/wireless/ar6003/host/wmi/wmi.c | 9173 ----- .../net/wireless/ar6003/host/wmi/wmi_host.h | 95 - .../ar6003/include/AR6002/AR6002_regdump.h | 60 - .../ar6003/include/AR6002/AR6K_version.h | 52 - .../wireless/ar6003/include/AR6002/addrs.h | 123 - .../ar6003/include/AR6002/hw/LegacyRegsEnv.vr | 58 - .../include/AR6002/hw/LegacyRegsEnvConfig.vr | 42 - .../ar6003/include/AR6002/hw/LegacyRegsTop.vr | 39 - .../include/AR6002/hw/LegacyRegsTopConfig.vr | 46 - .../ar6003/include/AR6002/hw/Makefile.child | 10 - .../ar6003/include/AR6002/hw/Makefile.reg | 28 - .../wireless/ar6003/include/AR6002/hw/addac.h | 86 - .../ar6003/include/AR6002/hw/addac.vrh | 123 - .../include/AR6002/hw/analog_intf_reg.h | 64 - .../include/AR6002/hw/analog_intf_reg.vrh | 82 - .../ar6003/include/AR6002/hw/analog_reg.h | 1932 -- .../ar6003/include/AR6002/hw/analog_reg.vrh | 3084 -- .../ar6003/include/AR6002/hw/apb_map.h | 13 - .../ar6003/include/AR6002/hw/apb_map.vrh | 21 - .../ar6003/include/AR6002/hw/bias_reg.h | 293 - .../ar6003/include/AR6002/hw/bias_reg.vrh | 450 - .../ar6003/include/AR6002/hw/gpio_reg.h | 977 - .../ar6003/include/AR6002/hw/gpio_reg.vrh | 1471 - .../ar6003/include/AR6002/hw/mac_pcu.h | 980 - .../ar6003/include/AR6002/hw/mac_pcu.vrh | 979 - .../ar6003/include/AR6002/hw/mbox_host_reg.h | 386 - .../include/AR6002/hw/mbox_host_reg.vrh | 563 - .../ar6003/include/AR6002/hw/mbox_reg.h | 481 - .../ar6003/include/AR6002/hw/mbox_reg.vrh | 746 - .../ar6003/include/AR6002/hw/rf2G_reg.h | 160 - .../ar6003/include/AR6002/hw/rf2G_reg.vrh | 240 - .../ar6003/include/AR6002/hw/rf5G_reg.h | 195 - .../ar6003/include/AR6002/hw/rf5G_reg.vrh | 296 - .../ar6003/include/AR6002/hw/rtc_reg.h | 1163 - .../ar6003/include/AR6002/hw/rtc_reg.vrh | 1758 - .../ar6003/include/AR6002/hw/rxtxbb_reg.h | 278 - .../ar6003/include/AR6002/hw/rxtxbb_reg.vrh | 433 - .../ar6003/include/AR6002/hw/si_reg.h | 186 - .../ar6003/include/AR6002/hw/si_reg.vrh | 278 - .../ar6003/include/AR6002/hw/synth_reg.h | 599 - .../ar6003/include/AR6002/hw/synth_reg.vrh | 939 - .../ar6003/include/AR6002/hw/top_reg.h | 235 - .../ar6003/include/AR6002/hw/top_reg.vrh | 388 - .../ar6003/include/AR6002/hw/txpc_reg.h | 170 - .../ar6003/include/AR6002/hw/txpc_reg.vrh | 257 - .../ar6003/include/AR6002/hw/uart_reg.h | 327 - .../ar6003/include/AR6002/hw/uart_reg.vrh | 488 - .../ar6003/include/AR6002/hw/vmc_reg.h | 76 - .../ar6003/include/AR6002/hw/vmc_reg.vrh | 100 - .../include/AR6002/hw2.0/hw/LegacyRegsEnv.vr | 58 - .../AR6002/hw2.0/hw/LegacyRegsEnvConfig.vr | 42 - .../include/AR6002/hw2.0/hw/LegacyRegsTop.vr | 39 - .../AR6002/hw2.0/hw/LegacyRegsTopConfig.vr | 46 - .../include/AR6002/hw2.0/hw/Makefile.child | 10 - .../include/AR6002/hw2.0/hw/Makefile.reg | 28 - .../ar6003/include/AR6002/hw2.0/hw/addac.h | 86 - .../ar6003/include/AR6002/hw2.0/hw/addac.vrh | 123 - .../include/AR6002/hw2.0/hw/analog_intf_reg.h | 64 - .../AR6002/hw2.0/hw/analog_intf_reg.vrh | 82 - .../include/AR6002/hw2.0/hw/analog_reg.h | 1932 -- .../include/AR6002/hw2.0/hw/analog_reg.vrh | 3084 -- .../ar6003/include/AR6002/hw2.0/hw/apb_map.h | 13 - .../include/AR6002/hw2.0/hw/apb_map.vrh | 21 - .../ar6003/include/AR6002/hw2.0/hw/bias_reg.h | 293 - .../include/AR6002/hw2.0/hw/bias_reg.vrh | 450 - .../ar6003/include/AR6002/hw2.0/hw/gpio_reg.h | 977 - .../include/AR6002/hw2.0/hw/gpio_reg.vrh | 1471 - .../ar6003/include/AR6002/hw2.0/hw/mac_pcu.h | 980 - .../include/AR6002/hw2.0/hw/mac_pcu.vrh | 979 - .../include/AR6002/hw2.0/hw/mbox_host_reg.h | 386 - .../include/AR6002/hw2.0/hw/mbox_host_reg.vrh | 563 - .../ar6003/include/AR6002/hw2.0/hw/mbox_reg.h | 481 - .../include/AR6002/hw2.0/hw/mbox_reg.vrh | 746 - .../ar6003/include/AR6002/hw2.0/hw/rf2G_reg.h | 160 - .../include/AR6002/hw2.0/hw/rf2G_reg.vrh | 240 - .../ar6003/include/AR6002/hw2.0/hw/rf5G_reg.h | 195 - .../include/AR6002/hw2.0/hw/rf5G_reg.vrh | 296 - .../ar6003/include/AR6002/hw2.0/hw/rtc_reg.h | 1163 - .../include/AR6002/hw2.0/hw/rtc_reg.vrh | 1758 - .../include/AR6002/hw2.0/hw/rxtxbb_reg.h | 278 - .../include/AR6002/hw2.0/hw/rxtxbb_reg.vrh | 433 - .../ar6003/include/AR6002/hw2.0/hw/si_reg.h | 186 - .../ar6003/include/AR6002/hw2.0/hw/si_reg.vrh | 278 - .../include/AR6002/hw2.0/hw/synth_reg.h | 599 - .../include/AR6002/hw2.0/hw/synth_reg.vrh | 939 - .../ar6003/include/AR6002/hw2.0/hw/top_reg.h | 235 - .../include/AR6002/hw2.0/hw/top_reg.vrh | 388 - .../ar6003/include/AR6002/hw2.0/hw/txpc_reg.h | 170 - .../include/AR6002/hw2.0/hw/txpc_reg.vrh | 257 - .../ar6003/include/AR6002/hw2.0/hw/uart_reg.h | 327 - .../include/AR6002/hw2.0/hw/uart_reg.vrh | 488 - .../ar6003/include/AR6002/hw2.0/hw/vmc_reg.h | 76 - .../include/AR6002/hw2.0/hw/vmc_reg.vrh | 100 - .../AR6002/hw4.0/hw/analog_intf_ares_reg.h | 3291 -- .../hw4.0/hw/analog_intf_athr_wlan_reg.h | 3674 -- .../include/AR6002/hw4.0/hw/analog_intf_reg.h | 37 - .../AR6002/hw4.0/hw/apb_athr_wlan_map.h | 40 - .../ar6003/include/AR6002/hw4.0/hw/apb_map.h | 48 - .../include/AR6002/hw4.0/hw/bb_lc_reg.h | 7076 ---- .../include/AR6002/hw4.0/hw/efuse_reg.h | 108 - .../AR6002/hw4.0/hw/gpio_athr_wlan_reg.h | 1253 - .../ar6003/include/AR6002/hw4.0/hw/gpio_reg.h | 1094 - .../include/AR6002/hw4.0/hw/mac_dma_reg.h | 601 - .../include/AR6002/hw4.0/hw/mac_pcu_reg.h | 3065 -- .../include/AR6002/hw4.0/hw/mbox_host_reg.h | 37 - .../ar6003/include/AR6002/hw4.0/hw/mbox_reg.h | 560 - .../AR6002/hw4.0/hw/mbox_wlan_host_reg.h | 522 - .../include/AR6002/hw4.0/hw/mbox_wlan_reg.h | 638 - .../ar6003/include/AR6002/hw4.0/hw/rdma_reg.h | 564 - .../ar6003/include/AR6002/hw4.0/hw/rtc_reg.h | 975 - .../include/AR6002/hw4.0/hw/rtc_wlan_reg.h | 2065 -- .../ar6003/include/AR6002/hw4.0/hw/si_reg.h | 209 - .../ar6003/include/AR6002/hw4.0/hw/uart_reg.h | 260 - .../include/AR6002/hw4.0/hw/umbox_reg.h | 37 - .../include/AR6002/hw4.0/hw/umbox_wlan_reg.h | 322 - .../ar6003/include/AR6002/hw4.0/hw/vmc_reg.h | 167 - .../include/AR6002/hw4.0/hw/vmc_wlan_reg.h | 195 - .../hw6.0/hw/analog_intf_athr_wlan_reg.h | 3729 -- .../include/AR6002/hw6.0/hw/analog_intf_reg.h | 37 - .../AR6002/hw6.0/hw/apb_athr_wlan_map.h | 72 - .../ar6003/include/AR6002/hw6.0/hw/apb_map.h | 47 - .../AR6002/hw6.0/hw/athrI2cSlaveApbCsr.h | 474 - .../ar6003/include/AR6002/hw6.0/hw/bb_reg.h | 8970 ----- .../hw6.0/hw/bridge_chain_gmac_0_rx_reg.h | 122 - .../hw6.0/hw/bridge_chain_gmac_0_tx_reg.h | 118 - .../AR6002/hw6.0/hw/bridge_chain_rx_reg.h | 122 - .../AR6002/hw6.0/hw/bridge_chain_tx_reg.h | 118 - .../include/AR6002/hw6.0/hw/bridge_intr_reg.h | 363 - .../hw6.0/hw/bridge_intr_reg_gmac_1_1.h | 83 - .../include/AR6002/hw6.0/hw/bt_coex_reg.h | 618 - .../AR6002/hw6.0/hw/chk_sum_seg_acc_reg.h | 407 - .../include/AR6002/hw6.0/hw/efuse_reg.h | 44 - .../include/AR6002/hw6.0/hw/efuse_wlan_reg.h | 153 - .../ar6003/include/AR6002/hw6.0/hw/fpga_reg.h | 137 - .../AR6002/hw6.0/hw/gpio_athr_wlan_reg.h | 2638 -- .../ar6003/include/AR6002/hw6.0/hw/gpio_reg.h | 2411 -- .../include/AR6002/hw6.0/hw/mac_dma_reg.h | 347 - .../include/AR6002/hw6.0/hw/mac_pcu_reg.h | 40 - .../include/AR6002/hw6.0/hw/map_rf_reg.h | 199 - .../include/AR6002/hw6.0/hw/mbox_host_reg.h | 37 - .../include/AR6002/hw6.0/hw/mbox_i2s_reg.h | 299 - .../ar6003/include/AR6002/hw6.0/hw/mbox_reg.h | 580 - .../AR6002/hw6.0/hw/mbox_wlan_host_reg.h | 522 - .../include/AR6002/hw6.0/hw/mbox_wlan_reg.h | 692 - .../ar6003/include/AR6002/hw6.0/hw/mdio_reg.h | 67 - .../ar6003/include/AR6002/hw6.0/hw/mii_reg.h | 83 - .../ar6003/include/AR6002/hw6.0/hw/mmac_reg.h | 375 - .../ar6003/include/AR6002/hw6.0/hw/odin_reg.h | 397 - .../ar6003/include/AR6002/hw6.0/hw/rdma_reg.h | 948 - .../ar6003/include/AR6002/hw6.0/hw/rtc_reg.h | 1189 - .../include/AR6002/hw6.0/hw/rtc_soc_reg.h | 1856 - .../include/AR6002/hw6.0/hw/rtc_sync_reg.h | 221 - .../include/AR6002/hw6.0/hw/rtc_wlan_reg.h | 677 - .../ar6003/include/AR6002/hw6.0/hw/si_reg.h | 308 - .../include/AR6002/hw6.0/hw/stereo_reg.h | 204 - .../ar6003/include/AR6002/hw6.0/hw/uart_reg.h | 260 - .../include/AR6002/hw6.0/hw/umbox_reg.h | 37 - .../include/AR6002/hw6.0/hw/umbox_wlan_reg.h | 322 - .../include/AR6002/hw6.0/hw/usb_cast_reg.h | 1387 - .../include/AR6002/hw6.0/hw/wlan_coex_reg.h | 839 - .../include/AR6002/hw6.0/hw/wmac_dcu_reg.h | 772 - .../include/AR6002/hw6.0/hw/wmac_dma_reg.h | 1000 - .../include/AR6002/hw6.0/hw/wmac_pcu_reg.h | 4492 --- .../include/AR6002/hw6.0/hw/wmac_qcu_reg.h | 251 - drivers/net/wireless/ar6003/include/a_hci.h | 668 - drivers/net/wireless/ar6003/include/athdefs.h | 84 - drivers/net/wireless/ar6003/include/bmi_msg.h | 334 - .../net/wireless/ar6003/include/btcoexGpio.h | 86 - drivers/net/wireless/ar6003/include/cnxmgmt.h | 36 - drivers/net/wireless/ar6003/include/dbglog.h | 134 - .../net/wireless/ar6003/include/dbglog_id.h | 593 - .../net/wireless/ar6003/include/dfs_common.h | 84 - .../net/wireless/ar6003/include/discovery.h | 77 - .../wireless/ar6003/include/dset_internal.h | 63 - drivers/net/wireless/ar6003/include/dsetid.h | 134 - .../net/wireless/ar6003/include/epping_test.h | 120 - drivers/net/wireless/ar6003/include/gmboxif.h | 83 - drivers/net/wireless/ar6003/include/gpio.h | 51 - .../ar6003/include/host_proxy_iface.h | 45 - drivers/net/wireless/ar6003/include/htc.h | 238 - .../wireless/ar6003/include/htc_services.h | 52 - .../net/wireless/ar6003/include/ini_dset.h | 83 - .../wireless/ar6003/include/iot_flashotp.h | 55 - drivers/net/wireless/ar6003/include/p2p.h | 429 - drivers/net/wireless/ar6003/include/pkt_log.h | 45 - drivers/net/wireless/ar6003/include/queue.h | 564 - drivers/net/wireless/ar6003/include/regdump.h | 59 - drivers/net/wireless/ar6003/include/roaming.h | 41 - .../net/wireless/ar6003/include/targaddrs.h | 398 - drivers/net/wireless/ar6003/include/testcmd.h | 247 - drivers/net/wireless/ar6003/include/tlpm.h | 38 - .../net/wireless/ar6003/include/wac_defs.h | 56 - .../net/wireless/ar6003/include/wlan_defs.h | 85 - .../net/wireless/ar6003/include/wlan_dset.h | 33 - drivers/net/wireless/ar6003/include/wmi.h | 3834 --- .../net/wireless/ar6003/include/wmi_thin.h | 371 - drivers/net/wireless/ar6003/include/wmix.h | 280 - drivers/net/wireless/at76c50x-usb.c | 2502 -- drivers/net/wireless/at76c50x-usb.h | 464 - drivers/net/wireless/ath/Kconfig | 35 - drivers/net/wireless/ath/Makefile | 16 - drivers/net/wireless/ath/ar5523/Kconfig | 8 - drivers/net/wireless/ath/ar5523/Makefile | 1 - drivers/net/wireless/ath/ar5523/ar5523.c | 1798 - drivers/net/wireless/ath/ar5523/ar5523.h | 152 - drivers/net/wireless/ath/ar5523/ar5523_hw.h | 431 - drivers/net/wireless/ath/ath.h | 293 - drivers/net/wireless/ath/ath5k/Kconfig | 75 - drivers/net/wireless/ath/ath5k/Makefile | 22 - drivers/net/wireless/ath/ath5k/ahb.c | 239 - drivers/net/wireless/ath/ath5k/ani.c | 754 - drivers/net/wireless/ath/ath5k/ani.h | 119 - drivers/net/wireless/ath/ath5k/ath5k.h | 1714 - drivers/net/wireless/ath/ath5k/attach.c | 360 - drivers/net/wireless/ath/ath5k/base.c | 3082 -- drivers/net/wireless/ath/ath5k/base.h | 119 - drivers/net/wireless/ath/ath5k/caps.c | 154 - drivers/net/wireless/ath/ath5k/debug.c | 1029 - drivers/net/wireless/ath/ath5k/debug.h | 165 - drivers/net/wireless/ath/ath5k/desc.c | 786 - drivers/net/wireless/ath/ath5k/desc.h | 367 - drivers/net/wireless/ath/ath5k/dma.c | 919 - drivers/net/wireless/ath/ath5k/eeprom.c | 1796 - drivers/net/wireless/ath/ath5k/eeprom.h | 495 - drivers/net/wireless/ath/ath5k/gpio.c | 213 - drivers/net/wireless/ath/ath5k/initvals.c | 1605 - drivers/net/wireless/ath/ath5k/led.c | 202 - drivers/net/wireless/ath/ath5k/mac80211-ops.c | 829 - drivers/net/wireless/ath/ath5k/pci.c | 343 - drivers/net/wireless/ath/ath5k/pcu.c | 1007 - drivers/net/wireless/ath/ath5k/phy.c | 3965 --- drivers/net/wireless/ath/ath5k/qcu.c | 714 - drivers/net/wireless/ath/ath5k/reg.h | 2604 -- drivers/net/wireless/ath/ath5k/reset.c | 1404 - drivers/net/wireless/ath/ath5k/rfbuffer.h | 853 - drivers/net/wireless/ath/ath5k/rfgain.h | 534 - drivers/net/wireless/ath/ath5k/rfkill.c | 116 - drivers/net/wireless/ath/ath5k/sysfs.c | 122 - drivers/net/wireless/ath/ath5k/trace.h | 106 - drivers/net/wireless/ath/ath6kl/Kconfig | 49 - drivers/net/wireless/ath/ath6kl/Makefile | 49 - drivers/net/wireless/ath/ath6kl/bmi.c | 548 - drivers/net/wireless/ath/ath6kl/bmi.h | 270 - drivers/net/wireless/ath/ath6kl/cfg80211.c | 3852 --- drivers/net/wireless/ath/ath6kl/cfg80211.h | 65 - drivers/net/wireless/ath/ath6kl/common.h | 86 - drivers/net/wireless/ath/ath6kl/core.c | 346 - drivers/net/wireless/ath/ath6kl/core.h | 964 - drivers/net/wireless/ath/ath6kl/debug.c | 1885 - drivers/net/wireless/ath/ath6kl/debug.h | 145 - drivers/net/wireless/ath/ath6kl/hif-ops.h | 187 - drivers/net/wireless/ath/ath6kl/hif.c | 705 - drivers/net/wireless/ath/ath6kl/hif.h | 282 - drivers/net/wireless/ath/ath6kl/htc-ops.h | 113 - drivers/net/wireless/ath/ath6kl/htc.h | 677 - drivers/net/wireless/ath/ath6kl/htc_mbox.c | 2946 -- drivers/net/wireless/ath/ath6kl/htc_pipe.c | 1719 - drivers/net/wireless/ath/ath6kl/init.c | 1864 - drivers/net/wireless/ath/ath6kl/main.c | 1306 - drivers/net/wireless/ath/ath6kl/recovery.c | 160 - drivers/net/wireless/ath/ath6kl/sdio.c | 1463 - drivers/net/wireless/ath/ath6kl/target.h | 356 - drivers/net/wireless/ath/ath6kl/testmode.c | 101 - drivers/net/wireless/ath/ath6kl/testmode.h | 37 - drivers/net/wireless/ath/ath6kl/trace.c | 23 - drivers/net/wireless/ath/ath6kl/trace.h | 332 - drivers/net/wireless/ath/ath6kl/txrx.c | 1872 - drivers/net/wireless/ath/ath6kl/usb.c | 1248 - drivers/net/wireless/ath/ath6kl/wmi.c | 4134 --- drivers/net/wireless/ath/ath6kl/wmi.h | 2732 -- drivers/net/wireless/ath/ath9k/Kconfig | 127 - drivers/net/wireless/ath/ath9k/Makefile | 64 - drivers/net/wireless/ath/ath9k/ahb.c | 193 - drivers/net/wireless/ath/ath9k/ani.c | 532 - drivers/net/wireless/ath/ath9k/ani.h | 145 - drivers/net/wireless/ath/ath9k/antenna.c | 797 - .../net/wireless/ath/ath9k/ar5008_initvals.h | 674 - drivers/net/wireless/ath/ath9k/ar5008_phy.c | 1358 - .../net/wireless/ath/ath9k/ar9001_initvals.h | 1089 - drivers/net/wireless/ath/ath9k/ar9002_calib.c | 992 - drivers/net/wireless/ath/ath9k/ar9002_hw.c | 474 - .../net/wireless/ath/ath9k/ar9002_initvals.h | 3194 -- drivers/net/wireless/ath/ath9k/ar9002_mac.c | 403 - drivers/net/wireless/ath/ath9k/ar9002_phy.c | 638 - drivers/net/wireless/ath/ath9k/ar9002_phy.h | 615 - .../wireless/ath/ath9k/ar9003_2p2_initvals.h | 1741 - drivers/net/wireless/ath/ath9k/ar9003_calib.c | 1187 - .../net/wireless/ath/ath9k/ar9003_eeprom.c | 5348 --- .../net/wireless/ath/ath9k/ar9003_eeprom.h | 345 - drivers/net/wireless/ath/ath9k/ar9003_hw.c | 715 - drivers/net/wireless/ath/ath9k/ar9003_mac.c | 589 - drivers/net/wireless/ath/ath9k/ar9003_mac.h | 123 - drivers/net/wireless/ath/ath9k/ar9003_mci.c | 1485 - drivers/net/wireless/ath/ath9k/ar9003_mci.h | 335 - drivers/net/wireless/ath/ath9k/ar9003_paprd.c | 1010 - drivers/net/wireless/ath/ath9k/ar9003_phy.c | 1685 - drivers/net/wireless/ath/ath9k/ar9003_phy.h | 1322 - drivers/net/wireless/ath/ath9k/ar9003_rtt.c | 208 - drivers/net/wireless/ath/ath9k/ar9003_rtt.h | 29 - .../wireless/ath/ath9k/ar9330_1p1_initvals.h | 1100 - .../wireless/ath/ath9k/ar9330_1p2_initvals.h | 242 - .../net/wireless/ath/ath9k/ar9340_initvals.h | 1450 - .../wireless/ath/ath9k/ar9462_2p0_initvals.h | 1452 - .../net/wireless/ath/ath9k/ar9485_initvals.h | 1211 - .../wireless/ath/ath9k/ar955x_1p0_initvals.h | 1284 - .../wireless/ath/ath9k/ar9565_1p0_initvals.h | 1233 - .../wireless/ath/ath9k/ar9580_1p0_initvals.h | 997 - drivers/net/wireless/ath/ath9k/ath9k.h | 945 - drivers/net/wireless/ath/ath9k/beacon.c | 781 - drivers/net/wireless/ath/ath9k/btcoex.c | 416 - drivers/net/wireless/ath/ath9k/btcoex.h | 124 - drivers/net/wireless/ath/ath9k/calib.c | 448 - drivers/net/wireless/ath/ath9k/calib.h | 122 - drivers/net/wireless/ath/ath9k/common.c | 197 - drivers/net/wireless/ath/ath9k/common.h | 56 - drivers/net/wireless/ath/ath9k/debug.c | 2114 -- drivers/net/wireless/ath/ath9k/debug.h | 380 - drivers/net/wireless/ath/ath9k/dfs.c | 193 - drivers/net/wireless/ath/ath9k/dfs.h | 45 - drivers/net/wireless/ath/ath9k/dfs_debug.c | 140 - drivers/net/wireless/ath/ath9k/dfs_debug.h | 84 - .../wireless/ath/ath9k/dfs_pattern_detector.c | 311 - .../wireless/ath/ath9k/dfs_pattern_detector.h | 106 - .../net/wireless/ath/ath9k/dfs_pri_detector.c | 425 - .../net/wireless/ath/ath9k/dfs_pri_detector.h | 75 - drivers/net/wireless/ath/ath9k/eeprom.c | 586 - drivers/net/wireless/ath/ath9k/eeprom.h | 717 - drivers/net/wireless/ath/ath9k/eeprom_4k.c | 1106 - drivers/net/wireless/ath/ath9k/eeprom_9287.c | 1044 - drivers/net/wireless/ath/ath9k/eeprom_def.c | 1389 - drivers/net/wireless/ath/ath9k/gpio.c | 567 - drivers/net/wireless/ath/ath9k/hif_usb.c | 1387 - drivers/net/wireless/ath/ath9k/hif_usb.h | 116 - drivers/net/wireless/ath/ath9k/htc.h | 609 - .../net/wireless/ath/ath9k/htc_drv_beacon.c | 659 - .../net/wireless/ath/ath9k/htc_drv_debug.c | 951 - drivers/net/wireless/ath/ath9k/htc_drv_gpio.c | 321 - drivers/net/wireless/ath/ath9k/htc_drv_init.c | 1008 - drivers/net/wireless/ath/ath9k/htc_drv_main.c | 1798 - drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 1230 - drivers/net/wireless/ath/ath9k/htc_hst.c | 479 - drivers/net/wireless/ath/ath9k/htc_hst.h | 218 - drivers/net/wireless/ath/ath9k/hw-ops.h | 215 - drivers/net/wireless/ath/ath9k/hw.c | 3262 -- drivers/net/wireless/ath/ath9k/hw.h | 1175 - drivers/net/wireless/ath/ath9k/init.c | 1011 - drivers/net/wireless/ath/ath9k/link.c | 571 - drivers/net/wireless/ath/ath9k/mac.c | 939 - drivers/net/wireless/ath/ath9k/mac.h | 747 - drivers/net/wireless/ath/ath9k/main.c | 2395 -- drivers/net/wireless/ath/ath9k/mci.c | 768 - drivers/net/wireless/ath/ath9k/mci.h | 178 - drivers/net/wireless/ath/ath9k/pci.c | 342 - drivers/net/wireless/ath/ath9k/phy.h | 51 - drivers/net/wireless/ath/ath9k/rc.c | 1488 - drivers/net/wireless/ath/ath9k/rc.h | 248 - drivers/net/wireless/ath/ath9k/recv.c | 1401 - drivers/net/wireless/ath/ath9k/reg.h | 2377 -- drivers/net/wireless/ath/ath9k/wmi.c | 349 - drivers/net/wireless/ath/ath9k/wmi.h | 191 - drivers/net/wireless/ath/ath9k/wow.c | 532 - drivers/net/wireless/ath/ath9k/xmit.c | 2426 -- drivers/net/wireless/ath/carl9170/Kconfig | 56 - drivers/net/wireless/ath/carl9170/Makefile | 4 - drivers/net/wireless/ath/carl9170/carl9170.h | 666 - drivers/net/wireless/ath/carl9170/cmd.c | 222 - drivers/net/wireless/ath/carl9170/cmd.h | 174 - drivers/net/wireless/ath/carl9170/debug.c | 897 - drivers/net/wireless/ath/carl9170/debug.h | 134 - drivers/net/wireless/ath/carl9170/eeprom.h | 216 - drivers/net/wireless/ath/carl9170/fw.c | 447 - drivers/net/wireless/ath/carl9170/fwcmd.h | 326 - drivers/net/wireless/ath/carl9170/fwdesc.h | 277 - drivers/net/wireless/ath/carl9170/hw.h | 817 - drivers/net/wireless/ath/carl9170/led.c | 190 - drivers/net/wireless/ath/carl9170/mac.c | 538 - drivers/net/wireless/ath/carl9170/main.c | 2130 -- drivers/net/wireless/ath/carl9170/phy.c | 1730 - drivers/net/wireless/ath/carl9170/phy.h | 564 - drivers/net/wireless/ath/carl9170/rx.c | 1016 - drivers/net/wireless/ath/carl9170/tx.c | 1686 - drivers/net/wireless/ath/carl9170/usb.c | 1172 - drivers/net/wireless/ath/carl9170/version.h | 7 - drivers/net/wireless/ath/carl9170/wlan.h | 435 - drivers/net/wireless/ath/debug.c | 47 - drivers/net/wireless/ath/hw.c | 190 - drivers/net/wireless/ath/key.c | 609 - drivers/net/wireless/ath/main.c | 81 - drivers/net/wireless/ath/reg.h | 65 - drivers/net/wireless/ath/regd.c | 661 - drivers/net/wireless/ath/regd.h | 263 - drivers/net/wireless/ath/regd_common.h | 478 - drivers/net/wireless/ath/wil6210/Kconfig | 29 - drivers/net/wireless/ath/wil6210/Makefile | 15 - drivers/net/wireless/ath/wil6210/cfg80211.c | 561 - drivers/net/wireless/ath/wil6210/debugfs.c | 639 - drivers/net/wireless/ath/wil6210/interrupt.c | 509 - drivers/net/wireless/ath/wil6210/main.c | 404 - drivers/net/wireless/ath/wil6210/netdev.c | 129 - drivers/net/wireless/ath/wil6210/pcie_bus.c | 220 - drivers/net/wireless/ath/wil6210/txrx.c | 832 - drivers/net/wireless/ath/wil6210/txrx.h | 397 - drivers/net/wireless/ath/wil6210/wil6210.h | 366 - drivers/net/wireless/ath/wil6210/wmi.c | 1088 - drivers/net/wireless/ath/wil6210/wmi.h | 1281 - drivers/net/wireless/atmel.c | 4561 --- drivers/net/wireless/atmel.h | 43 - drivers/net/wireless/atmel_cs.c | 287 - drivers/net/wireless/atmel_pci.c | 77 - drivers/net/wireless/b43/Kconfig | 177 - drivers/net/wireless/b43/Makefile | 30 - drivers/net/wireless/b43/b43.h | 1082 - drivers/net/wireless/b43/bus.c | 255 - drivers/net/wireless/b43/bus.h | 70 - drivers/net/wireless/b43/debugfs.c | 826 - drivers/net/wireless/b43/debugfs.h | 111 - drivers/net/wireless/b43/dma.c | 1834 - drivers/net/wireless/b43/dma.h | 305 - drivers/net/wireless/b43/leds.c | 359 - drivers/net/wireless/b43/leds.h | 94 - drivers/net/wireless/b43/lo.c | 1016 - drivers/net/wireless/b43/lo.h | 87 - drivers/net/wireless/b43/main.c | 5629 --- drivers/net/wireless/b43/main.h | 144 - drivers/net/wireless/b43/pcmcia.c | 145 - drivers/net/wireless/b43/pcmcia.h | 20 - drivers/net/wireless/b43/phy_a.c | 595 - drivers/net/wireless/b43/phy_a.h | 130 - drivers/net/wireless/b43/phy_common.c | 543 - drivers/net/wireless/b43/phy_common.h | 457 - drivers/net/wireless/b43/phy_g.c | 3055 -- drivers/net/wireless/b43/phy_g.h | 208 - drivers/net/wireless/b43/phy_ht.c | 1140 - drivers/net/wireless/b43/phy_ht.h | 136 - drivers/net/wireless/b43/phy_lcn.c | 902 - drivers/net/wireless/b43/phy_lcn.h | 31 - drivers/net/wireless/b43/phy_lp.c | 2730 -- drivers/net/wireless/b43/phy_lp.h | 912 - drivers/net/wireless/b43/phy_n.c | 5565 --- drivers/net/wireless/b43/phy_n.h | 989 - drivers/net/wireless/b43/pio.c | 834 - drivers/net/wireless/b43/pio.h | 165 - drivers/net/wireless/b43/radio_2055.c | 1335 - drivers/net/wireless/b43/radio_2055.h | 259 - drivers/net/wireless/b43/radio_2056.c | 9116 ----- drivers/net/wireless/b43/radio_2056.h | 1100 - drivers/net/wireless/b43/radio_2057.c | 141 - drivers/net/wireless/b43/radio_2057.h | 430 - drivers/net/wireless/b43/radio_2059.c | 155 - drivers/net/wireless/b43/radio_2059.h | 46 - drivers/net/wireless/b43/rfkill.c | 70 - drivers/net/wireless/b43/rfkill.h | 11 - drivers/net/wireless/b43/sdio.c | 207 - drivers/net/wireless/b43/sdio.h | 45 - drivers/net/wireless/b43/sysfs.c | 155 - drivers/net/wireless/b43/sysfs.h | 9 - drivers/net/wireless/b43/tables.c | 466 - drivers/net/wireless/b43/tables.h | 34 - drivers/net/wireless/b43/tables_lpphy.c | 2456 -- drivers/net/wireless/b43/tables_lpphy.h | 44 - drivers/net/wireless/b43/tables_nphy.c | 3322 -- drivers/net/wireless/b43/tables_nphy.h | 217 - drivers/net/wireless/b43/tables_phy_ht.c | 836 - drivers/net/wireless/b43/tables_phy_ht.h | 26 - drivers/net/wireless/b43/tables_phy_lcn.c | 724 - drivers/net/wireless/b43/tables_phy_lcn.h | 24 - drivers/net/wireless/b43/wa.c | 634 - drivers/net/wireless/b43/wa.h | 7 - drivers/net/wireless/b43/xmit.c | 942 - drivers/net/wireless/b43/xmit.h | 412 - drivers/net/wireless/b43legacy/Kconfig | 104 - drivers/net/wireless/b43legacy/Makefile | 19 - drivers/net/wireless/b43legacy/b43legacy.h | 858 - drivers/net/wireless/b43legacy/debugfs.c | 500 - drivers/net/wireless/b43legacy/debugfs.h | 89 - drivers/net/wireless/b43legacy/dma.c | 1459 - drivers/net/wireless/b43legacy/dma.h | 231 - drivers/net/wireless/b43legacy/ilt.c | 336 - drivers/net/wireless/b43legacy/ilt.h | 34 - drivers/net/wireless/b43legacy/leds.c | 243 - drivers/net/wireless/b43legacy/leds.h | 63 - drivers/net/wireless/b43legacy/main.c | 4064 --- drivers/net/wireless/b43legacy/main.h | 127 - drivers/net/wireless/b43legacy/phy.c | 2258 -- drivers/net/wireless/b43legacy/phy.h | 209 - drivers/net/wireless/b43legacy/pio.c | 695 - drivers/net/wireless/b43legacy/pio.h | 158 - drivers/net/wireless/b43legacy/radio.c | 2162 -- drivers/net/wireless/b43legacy/radio.h | 98 - drivers/net/wireless/b43legacy/rfkill.c | 91 - drivers/net/wireless/b43legacy/rfkill.h | 11 - drivers/net/wireless/b43legacy/sysfs.c | 238 - drivers/net/wireless/b43legacy/sysfs.h | 9 - drivers/net/wireless/b43legacy/xmit.c | 664 - drivers/net/wireless/b43legacy/xmit.h | 261 - drivers/net/wireless/bcm4319/Makefile | 24 - drivers/net/wireless/bcm4319/aiutils.c | 686 - drivers/net/wireless/bcm4319/bcmpcispi.c | 630 - drivers/net/wireless/bcm4319/bcmsdh.c | 652 - drivers/net/wireless/bcm4319/bcmsdh_linux.c | 733 - drivers/net/wireless/bcm4319/bcmsdh_sdmmc.c | 1304 - .../net/wireless/bcm4319/bcmsdh_sdmmc_linux.c | 273 - drivers/net/wireless/bcm4319/bcmsdspi.c | 1596 - drivers/net/wireless/bcm4319/bcmsdspi_linux.c | 252 - drivers/net/wireless/bcm4319/bcmsdstd.c | 3127 -- drivers/net/wireless/bcm4319/bcmsdstd_linux.c | 251 - drivers/net/wireless/bcm4319/bcmspibrcm.c | 1726 - drivers/net/wireless/bcm4319/bcmutils.c | 1838 - drivers/net/wireless/bcm4319/bcmwifi.c | 199 - drivers/net/wireless/bcm4319/dhd.h | 438 - drivers/net/wireless/bcm4319/dhd_bus.h | 93 - drivers/net/wireless/bcm4319/dhd_cdc.c | 525 - drivers/net/wireless/bcm4319/dhd_common.c | 2331 -- .../net/wireless/bcm4319/dhd_custom_gpio.c | 179 - drivers/net/wireless/bcm4319/dhd_dbg.h | 100 - drivers/net/wireless/bcm4319/dhd_linux.c | 3343 -- .../net/wireless/bcm4319/dhd_linux_sched.c | 38 - drivers/net/wireless/bcm4319/dhd_proto.h | 102 - drivers/net/wireless/bcm4319/dhd_sdio.c | 5883 ---- drivers/net/wireless/bcm4319/dngl_stats.h | 43 - drivers/net/wireless/bcm4319/hndpmu.c | 131 - drivers/net/wireless/bcm4319/include/Makefile | 21 - drivers/net/wireless/bcm4319/include/aidmp.h | 368 - drivers/net/wireless/bcm4319/include/bcmcdc.h | 100 - .../net/wireless/bcm4319/include/bcmdefs.h | 114 - .../net/wireless/bcm4319/include/bcmdevs.h | 124 - .../net/wireless/bcm4319/include/bcmendian.h | 205 - .../net/wireless/bcm4319/include/bcmpcispi.h | 205 - .../net/wireless/bcm4319/include/bcmperf.h | 36 - .../net/wireless/bcm4319/include/bcmsdbus.h | 117 - drivers/net/wireless/bcm4319/include/bcmsdh.h | 208 - .../wireless/bcm4319/include/bcmsdh_sdmmc.h | 122 - .../net/wireless/bcm4319/include/bcmsdpcm.h | 263 - .../net/wireless/bcm4319/include/bcmsdspi.h | 131 - .../net/wireless/bcm4319/include/bcmsdstd.h | 223 - drivers/net/wireless/bcm4319/include/bcmspi.h | 36 - .../net/wireless/bcm4319/include/bcmspibrcm.h | 134 - .../net/wireless/bcm4319/include/bcmutils.h | 637 - .../net/wireless/bcm4319/include/bcmwifi.h | 154 - .../net/wireless/bcm4319/include/dhdioctl.h | 123 - .../net/wireless/bcm4319/include/epivers.h | 48 - drivers/net/wireless/bcm4319/include/hndpmu.h | 34 - .../wireless/bcm4319/include/hndrte_armtrap.h | 88 - .../wireless/bcm4319/include/hndrte_cons.h | 63 - drivers/net/wireless/bcm4319/include/hndsoc.h | 195 - .../net/wireless/bcm4319/include/linux_osl.h | 322 - .../net/wireless/bcm4319/include/linuxver.h | 447 - .../net/wireless/bcm4319/include/miniopt.h | 77 - .../net/wireless/bcm4319/include/msgtrace.h | 72 - drivers/net/wireless/bcm4319/include/osl.h | 55 - .../bcm4319/include/packed_section_end.h | 54 - .../bcm4319/include/packed_section_start.h | 61 - drivers/net/wireless/bcm4319/include/pcicfg.h | 52 - .../wireless/bcm4319/include/proto/802.11.h | 1433 - .../wireless/bcm4319/include/proto/802.11e.h | 131 - .../wireless/bcm4319/include/proto/802.1d.h | 49 - .../wireless/bcm4319/include/proto/bcmeth.h | 83 - .../wireless/bcm4319/include/proto/bcmevent.h | 212 - .../wireless/bcm4319/include/proto/bcmip.h | 157 - .../wireless/bcm4319/include/proto/eapol.h | 172 - .../wireless/bcm4319/include/proto/ethernet.h | 148 - .../wireless/bcm4319/include/proto/sdspi.h | 71 - .../net/wireless/bcm4319/include/proto/vlan.h | 63 - .../net/wireless/bcm4319/include/proto/wpa.h | 159 - .../net/wireless/bcm4319/include/sbchipc.h | 1026 - .../net/wireless/bcm4319/include/sbconfig.h | 276 - .../net/wireless/bcm4319/include/sbhnddma.h | 294 - .../net/wireless/bcm4319/include/sbpcmcia.h | 109 - drivers/net/wireless/bcm4319/include/sbsdio.h | 166 - .../net/wireless/bcm4319/include/sbsdpcmdev.h | 288 - .../net/wireless/bcm4319/include/sbsocram.h | 150 - drivers/net/wireless/bcm4319/include/sdio.h | 566 - drivers/net/wireless/bcm4319/include/sdioh.h | 299 - .../net/wireless/bcm4319/include/sdiovar.h | 58 - .../net/wireless/bcm4319/include/siutils.h | 235 - drivers/net/wireless/bcm4319/include/spid.h | 153 - drivers/net/wireless/bcm4319/include/trxhdr.h | 46 - .../net/wireless/bcm4319/include/typedefs.h | 303 - .../wireless/bcm4319/include/wifi_version.h | 9 - .../net/wireless/bcm4319/include/wlioctl.h | 1664 - drivers/net/wireless/bcm4319/linux_osl.c | 623 - drivers/net/wireless/bcm4319/miniopt.c | 163 - drivers/net/wireless/bcm4319/sbutils.c | 1004 - drivers/net/wireless/bcm4319/siutils.c | 1527 - drivers/net/wireless/bcm4319/siutils_priv.h | 213 - drivers/net/wireless/bcm4319/wl_cfg80211.c | 4491 --- drivers/net/wireless/bcm4319/wl_cfg80211.h | 372 - drivers/net/wireless/bcm4319/wl_iw.c | 8391 ----- drivers/net/wireless/bcm4319/wl_iw.h | 284 - drivers/net/wireless/bcm4329/bcmspibrcm.c | 1726 - .../net/wireless/bcm4329/include/bcmspibrcm.h | 134 - drivers/net/wireless/bcm4329/include/spid.h | 153 - .../wireless/bcm4329/include/wifi_version.h | 9 - drivers/net/wireless/bcm4329/wl_cfg80211.c | 4491 --- drivers/net/wireless/bcm4329/wl_cfg80211.h | 372 - drivers/net/wireless/brcm80211/Kconfig | 65 - drivers/net/wireless/brcm80211/Makefile | 23 - .../net/wireless/brcm80211/brcmfmac/Makefile | 45 - .../net/wireless/brcm80211/brcmfmac/bcmsdh.c | 600 - .../brcm80211/brcmfmac/bcmsdh_sdmmc.c | 635 - .../net/wireless/brcm80211/brcmfmac/btcoex.c | 497 - .../net/wireless/brcm80211/brcmfmac/btcoex.h | 29 - drivers/net/wireless/brcm80211/brcmfmac/dhd.h | 631 - .../net/wireless/brcm80211/brcmfmac/dhd_bus.h | 164 - .../net/wireless/brcm80211/brcmfmac/dhd_cdc.c | 389 - .../wireless/brcm80211/brcmfmac/dhd_common.c | 390 - .../net/wireless/brcm80211/brcmfmac/dhd_dbg.c | 205 - .../net/wireless/brcm80211/brcmfmac/dhd_dbg.h | 194 - .../wireless/brcm80211/brcmfmac/dhd_linux.c | 1074 - .../wireless/brcm80211/brcmfmac/dhd_proto.h | 42 - .../wireless/brcm80211/brcmfmac/dhd_sdio.c | 4043 --- .../net/wireless/brcm80211/brcmfmac/fweh.c | 452 - .../net/wireless/brcm80211/brcmfmac/fweh.h | 219 - .../net/wireless/brcm80211/brcmfmac/fwil.c | 348 - .../net/wireless/brcm80211/brcmfmac/fwil.h | 39 - .../wireless/brcm80211/brcmfmac/fwil_types.h | 72 - .../wireless/brcm80211/brcmfmac/fwsignal.c | 2067 -- .../wireless/brcm80211/brcmfmac/fwsignal.h | 33 - drivers/net/wireless/brcm80211/brcmfmac/p2p.c | 2449 -- drivers/net/wireless/brcm80211/brcmfmac/p2p.h | 183 - .../wireless/brcm80211/brcmfmac/sdio_chip.c | 955 - .../wireless/brcm80211/brcmfmac/sdio_chip.h | 231 - .../wireless/brcm80211/brcmfmac/sdio_host.h | 294 - .../wireless/brcm80211/brcmfmac/tracepoint.c | 22 - .../wireless/brcm80211/brcmfmac/tracepoint.h | 101 - drivers/net/wireless/brcm80211/brcmfmac/usb.c | 1540 - drivers/net/wireless/brcm80211/brcmfmac/usb.h | 53 - .../net/wireless/brcm80211/brcmfmac/usb_rdl.h | 75 - .../wireless/brcm80211/brcmfmac/wl_cfg80211.c | 5417 --- .../wireless/brcm80211/brcmfmac/wl_cfg80211.h | 511 - .../net/wireless/brcm80211/brcmsmac/Makefile | 48 - .../net/wireless/brcm80211/brcmsmac/aiutils.c | 731 - .../net/wireless/brcm80211/brcmsmac/aiutils.h | 232 - .../net/wireless/brcm80211/brcmsmac/ampdu.c | 1144 - .../net/wireless/brcm80211/brcmsmac/ampdu.h | 53 - .../net/wireless/brcm80211/brcmsmac/antsel.c | 309 - .../net/wireless/brcm80211/brcmsmac/antsel.h | 29 - .../brcm80211/brcmsmac/brcms_trace_events.c | 23 - .../brcm80211/brcmsmac/brcms_trace_events.h | 255 - .../net/wireless/brcm80211/brcmsmac/channel.c | 782 - .../net/wireless/brcm80211/brcmsmac/channel.h | 51 - drivers/net/wireless/brcm80211/brcmsmac/d11.h | 1902 - .../net/wireless/brcm80211/brcmsmac/debug.c | 156 - .../net/wireless/brcm80211/brcmsmac/debug.h | 76 - drivers/net/wireless/brcm80211/brcmsmac/dma.c | 1564 - drivers/net/wireless/brcm80211/brcmsmac/dma.h | 125 - drivers/net/wireless/brcm80211/brcmsmac/led.c | 126 - drivers/net/wireless/brcm80211/brcmsmac/led.h | 36 - .../wireless/brcm80211/brcmsmac/mac80211_if.c | 1707 - .../wireless/brcm80211/brcmsmac/mac80211_if.h | 113 - .../net/wireless/brcm80211/brcmsmac/main.c | 8182 ----- .../net/wireless/brcm80211/brcmsmac/main.h | 681 - .../wireless/brcm80211/brcmsmac/phy/phy_cmn.c | 2957 -- .../wireless/brcm80211/brcmsmac/phy/phy_hal.h | 299 - .../wireless/brcm80211/brcmsmac/phy/phy_int.h | 1161 - .../wireless/brcm80211/brcmsmac/phy/phy_lcn.c | 5148 --- .../wireless/brcm80211/brcmsmac/phy/phy_lcn.h | 121 - .../wireless/brcm80211/brcmsmac/phy/phy_n.c | 28729 ---------------- .../brcm80211/brcmsmac/phy/phy_qmath.c | 308 - .../brcm80211/brcmsmac/phy/phy_qmath.h | 42 - .../brcm80211/brcmsmac/phy/phy_radio.h | 1533 - .../brcm80211/brcmsmac/phy/phyreg_n.h | 167 - .../brcm80211/brcmsmac/phy/phytbl_lcn.c | 3250 -- .../brcm80211/brcmsmac/phy/phytbl_lcn.h | 54 - .../brcm80211/brcmsmac/phy/phytbl_n.c | 10630 ------ .../brcm80211/brcmsmac/phy/phytbl_n.h | 50 - .../wireless/brcm80211/brcmsmac/phy_shim.c | 216 - .../wireless/brcm80211/brcmsmac/phy_shim.h | 179 - drivers/net/wireless/brcm80211/brcmsmac/pmu.c | 165 - drivers/net/wireless/brcm80211/brcmsmac/pmu.h | 26 - drivers/net/wireless/brcm80211/brcmsmac/pub.h | 348 - .../net/wireless/brcm80211/brcmsmac/rate.c | 514 - .../net/wireless/brcm80211/brcmsmac/rate.h | 249 - drivers/net/wireless/brcm80211/brcmsmac/scb.h | 81 - drivers/net/wireless/brcm80211/brcmsmac/stf.c | 440 - drivers/net/wireless/brcm80211/brcmsmac/stf.h | 42 - .../net/wireless/brcm80211/brcmsmac/types.h | 303 - .../brcm80211/brcmsmac/ucode_loader.c | 109 - .../brcm80211/brcmsmac/ucode_loader.h | 58 - .../net/wireless/brcm80211/brcmutil/Makefile | 23 - drivers/net/wireless/brcm80211/brcmutil/d11.c | 162 - .../net/wireless/brcm80211/brcmutil/utils.c | 295 - .../wireless/brcm80211/include/brcm_hw_ids.h | 45 - .../wireless/brcm80211/include/brcmu_d11.h | 145 - .../wireless/brcm80211/include/brcmu_utils.h | 223 - .../wireless/brcm80211/include/brcmu_wifi.h | 256 - .../wireless/brcm80211/include/chipcommon.h | 296 - drivers/net/wireless/brcm80211/include/defs.h | 108 - drivers/net/wireless/brcm80211/include/soc.h | 36 - drivers/net/wireless/esp8089/Kconfig | 22 - drivers/net/wireless/hostap/Kconfig | 98 - drivers/net/wireless/hostap/Makefile | 7 - drivers/net/wireless/hostap/hostap.h | 95 - drivers/net/wireless/hostap/hostap_80211.h | 96 - drivers/net/wireless/hostap/hostap_80211_rx.c | 1117 - drivers/net/wireless/hostap/hostap_80211_tx.c | 553 - drivers/net/wireless/hostap/hostap_ap.c | 3339 -- drivers/net/wireless/hostap/hostap_ap.h | 263 - drivers/net/wireless/hostap/hostap_common.h | 419 - drivers/net/wireless/hostap/hostap_config.h | 48 - drivers/net/wireless/hostap/hostap_cs.c | 712 - drivers/net/wireless/hostap/hostap_download.c | 812 - drivers/net/wireless/hostap/hostap_hw.c | 3424 -- drivers/net/wireless/hostap/hostap_info.c | 507 - drivers/net/wireless/hostap/hostap_ioctl.c | 4054 --- drivers/net/wireless/hostap/hostap_main.c | 1143 - drivers/net/wireless/hostap/hostap_pci.c | 460 - drivers/net/wireless/hostap/hostap_plx.c | 619 - drivers/net/wireless/hostap/hostap_proc.c | 504 - drivers/net/wireless/hostap/hostap_wlan.h | 1046 - drivers/net/wireless/ipw2x00/Kconfig | 197 - drivers/net/wireless/ipw2x00/Makefile | 14 - drivers/net/wireless/ipw2x00/ipw.h | 23 - drivers/net/wireless/ipw2x00/ipw2100.c | 8656 ----- drivers/net/wireless/ipw2x00/ipw2100.h | 1156 - drivers/net/wireless/ipw2x00/ipw2200.c | 12158 ------- drivers/net/wireless/ipw2x00/ipw2200.h | 2002 -- drivers/net/wireless/ipw2x00/libipw.h | 1024 - drivers/net/wireless/ipw2x00/libipw_geo.c | 193 - drivers/net/wireless/ipw2x00/libipw_module.c | 335 - drivers/net/wireless/ipw2x00/libipw_rx.c | 1797 - drivers/net/wireless/ipw2x00/libipw_tx.c | 536 - drivers/net/wireless/ipw2x00/libipw_wx.c | 744 - drivers/net/wireless/iwlegacy/3945-debug.c | 511 - drivers/net/wireless/iwlegacy/3945-mac.c | 3966 --- drivers/net/wireless/iwlegacy/3945-rs.c | 980 - drivers/net/wireless/iwlegacy/3945.c | 2724 -- drivers/net/wireless/iwlegacy/3945.h | 597 - drivers/net/wireless/iwlegacy/4965-calib.c | 934 - drivers/net/wireless/iwlegacy/4965-debug.c | 752 - drivers/net/wireless/iwlegacy/4965-mac.c | 6864 ---- drivers/net/wireless/iwlegacy/4965-rs.c | 2836 -- drivers/net/wireless/iwlegacy/4965.c | 1951 -- drivers/net/wireless/iwlegacy/4965.h | 1284 - drivers/net/wireless/iwlegacy/Kconfig | 100 - drivers/net/wireless/iwlegacy/Makefile | 17 - drivers/net/wireless/iwlegacy/commands.h | 3377 -- drivers/net/wireless/iwlegacy/common.c | 5518 --- drivers/net/wireless/iwlegacy/common.h | 3035 -- drivers/net/wireless/iwlegacy/csr.h | 419 - drivers/net/wireless/iwlegacy/debug.c | 1430 - drivers/net/wireless/iwlegacy/iwl-spectrum.h | 92 - drivers/net/wireless/iwlegacy/prph.h | 522 - drivers/net/wireless/iwlwifi/Kconfig | 156 - drivers/net/wireless/iwlwifi/Makefile | 21 - drivers/net/wireless/iwlwifi/dvm/Makefile | 13 - drivers/net/wireless/iwlwifi/dvm/agn.h | 532 - drivers/net/wireless/iwlwifi/dvm/calib.c | 1114 - drivers/net/wireless/iwlwifi/dvm/calib.h | 74 - drivers/net/wireless/iwlwifi/dvm/commands.h | 4015 --- drivers/net/wireless/iwlwifi/dvm/debugfs.c | 2461 -- drivers/net/wireless/iwlwifi/dvm/dev.h | 917 - drivers/net/wireless/iwlwifi/dvm/devices.c | 599 - drivers/net/wireless/iwlwifi/dvm/led.c | 224 - drivers/net/wireless/iwlwifi/dvm/led.h | 43 - drivers/net/wireless/iwlwifi/dvm/lib.c | 1311 - drivers/net/wireless/iwlwifi/dvm/mac80211.c | 1788 - drivers/net/wireless/iwlwifi/dvm/main.c | 2170 -- drivers/net/wireless/iwlwifi/dvm/power.c | 387 - drivers/net/wireless/iwlwifi/dvm/power.h | 47 - drivers/net/wireless/iwlwifi/dvm/rs.c | 3369 -- drivers/net/wireless/iwlwifi/dvm/rs.h | 433 - drivers/net/wireless/iwlwifi/dvm/rx.c | 1151 - drivers/net/wireless/iwlwifi/dvm/rxon.c | 1575 - drivers/net/wireless/iwlwifi/dvm/scan.c | 1188 - drivers/net/wireless/iwlwifi/dvm/sta.c | 1477 - drivers/net/wireless/iwlwifi/dvm/testmode.c | 471 - drivers/net/wireless/iwlwifi/dvm/tt.c | 691 - drivers/net/wireless/iwlwifi/dvm/tt.h | 128 - drivers/net/wireless/iwlwifi/dvm/tx.c | 1445 - drivers/net/wireless/iwlwifi/dvm/ucode.c | 463 - drivers/net/wireless/iwlwifi/iwl-1000.c | 140 - drivers/net/wireless/iwlwifi/iwl-2000.c | 242 - drivers/net/wireless/iwlwifi/iwl-5000.c | 179 - drivers/net/wireless/iwlwifi/iwl-6000.c | 408 - drivers/net/wireless/iwlwifi/iwl-7000.c | 182 - drivers/net/wireless/iwlwifi/iwl-agn-hw.h | 119 - drivers/net/wireless/iwlwifi/iwl-config.h | 330 - drivers/net/wireless/iwlwifi/iwl-csr.h | 475 - drivers/net/wireless/iwlwifi/iwl-debug.c | 138 - drivers/net/wireless/iwlwifi/iwl-debug.h | 187 - drivers/net/wireless/iwlwifi/iwl-devtrace.c | 50 - drivers/net/wireless/iwlwifi/iwl-devtrace.h | 514 - drivers/net/wireless/iwlwifi/iwl-drv.c | 1276 - drivers/net/wireless/iwlwifi/iwl-drv.h | 141 - .../net/wireless/iwlwifi/iwl-eeprom-parse.c | 932 - .../net/wireless/iwlwifi/iwl-eeprom-parse.h | 138 - .../net/wireless/iwlwifi/iwl-eeprom-read.c | 464 - .../net/wireless/iwlwifi/iwl-eeprom-read.h | 70 - drivers/net/wireless/iwlwifi/iwl-fh.h | 540 - drivers/net/wireless/iwlwifi/iwl-fw-file.h | 156 - drivers/net/wireless/iwlwifi/iwl-fw.h | 218 - drivers/net/wireless/iwlwifi/iwl-io.c | 168 - drivers/net/wireless/iwlwifi/iwl-io.h | 80 - drivers/net/wireless/iwlwifi/iwl-modparams.h | 124 - drivers/net/wireless/iwlwifi/iwl-notif-wait.c | 191 - drivers/net/wireless/iwlwifi/iwl-notif-wait.h | 138 - drivers/net/wireless/iwlwifi/iwl-nvm-parse.c | 393 - drivers/net/wireless/iwlwifi/iwl-nvm-parse.h | 80 - drivers/net/wireless/iwlwifi/iwl-op-mode.h | 231 - drivers/net/wireless/iwlwifi/iwl-phy-db.c | 499 - drivers/net/wireless/iwlwifi/iwl-phy-db.h | 82 - drivers/net/wireless/iwlwifi/iwl-prph.h | 263 - drivers/net/wireless/iwlwifi/iwl-test.c | 852 - drivers/net/wireless/iwlwifi/iwl-test.h | 161 - drivers/net/wireless/iwlwifi/iwl-testmode.h | 309 - drivers/net/wireless/iwlwifi/iwl-trans.h | 815 - drivers/net/wireless/iwlwifi/mvm/Makefile | 10 - drivers/net/wireless/iwlwifi/mvm/binding.c | 197 - drivers/net/wireless/iwlwifi/mvm/bt-coex.c | 589 - drivers/net/wireless/iwlwifi/mvm/d3.c | 1266 - drivers/net/wireless/iwlwifi/mvm/debugfs.c | 619 - .../net/wireless/iwlwifi/mvm/fw-api-bt-coex.h | 319 - drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h | 333 - drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h | 375 - .../net/wireless/iwlwifi/mvm/fw-api-power.h | 120 - drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h | 312 - .../net/wireless/iwlwifi/mvm/fw-api-scan.h | 560 - drivers/net/wireless/iwlwifi/mvm/fw-api-sta.h | 380 - drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h | 586 - drivers/net/wireless/iwlwifi/mvm/fw-api.h | 978 - drivers/net/wireless/iwlwifi/mvm/fw.c | 528 - drivers/net/wireless/iwlwifi/mvm/led.c | 134 - drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | 1050 - drivers/net/wireless/iwlwifi/mvm/mac80211.c | 1429 - drivers/net/wireless/iwlwifi/mvm/mvm.h | 538 - drivers/net/wireless/iwlwifi/mvm/nvm.c | 238 - drivers/net/wireless/iwlwifi/mvm/ops.c | 677 - drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c | 286 - drivers/net/wireless/iwlwifi/mvm/power.c | 180 - drivers/net/wireless/iwlwifi/mvm/quota.c | 198 - drivers/net/wireless/iwlwifi/mvm/rs.c | 3083 -- drivers/net/wireless/iwlwifi/mvm/rs.h | 393 - drivers/net/wireless/iwlwifi/mvm/rx.c | 365 - drivers/net/wireless/iwlwifi/mvm/scan.c | 441 - drivers/net/wireless/iwlwifi/mvm/sta.c | 1333 - drivers/net/wireless/iwlwifi/mvm/sta.h | 376 - drivers/net/wireless/iwlwifi/mvm/time-event.c | 527 - drivers/net/wireless/iwlwifi/mvm/time-event.h | 215 - drivers/net/wireless/iwlwifi/mvm/tx.c | 939 - drivers/net/wireless/iwlwifi/mvm/utils.c | 473 - drivers/net/wireless/iwlwifi/pcie/drv.c | 467 - drivers/net/wireless/iwlwifi/pcie/internal.h | 479 - drivers/net/wireless/iwlwifi/pcie/rx.c | 1306 - drivers/net/wireless/iwlwifi/pcie/trans.c | 1591 - drivers/net/wireless/iwlwifi/pcie/tx.c | 1745 - drivers/net/wireless/libertas/Kconfig | 45 - drivers/net/wireless/libertas/LICENSE | 16 - drivers/net/wireless/libertas/Makefile | 21 - drivers/net/wireless/libertas/README | 240 - drivers/net/wireless/libertas/cfg.c | 2223 -- drivers/net/wireless/libertas/cfg.h | 20 - drivers/net/wireless/libertas/cmd.c | 1724 - drivers/net/wireless/libertas/cmd.h | 140 - drivers/net/wireless/libertas/cmdresp.c | 350 - drivers/net/wireless/libertas/debugfs.c | 990 - drivers/net/wireless/libertas/debugfs.h | 10 - drivers/net/wireless/libertas/decl.h | 82 - drivers/net/wireless/libertas/defs.h | 393 - drivers/net/wireless/libertas/dev.h | 211 - drivers/net/wireless/libertas/ethtool.c | 120 - drivers/net/wireless/libertas/firmware.c | 222 - drivers/net/wireless/libertas/host.h | 978 - drivers/net/wireless/libertas/if_cs.c | 1009 - drivers/net/wireless/libertas/if_sdio.c | 1457 - drivers/net/wireless/libertas/if_sdio.h | 52 - drivers/net/wireless/libertas/if_spi.c | 1324 - drivers/net/wireless/libertas/if_spi.h | 206 - drivers/net/wireless/libertas/if_usb.c | 1021 - drivers/net/wireless/libertas/if_usb.h | 106 - drivers/net/wireless/libertas/main.c | 1225 - drivers/net/wireless/libertas/mesh.c | 1188 - drivers/net/wireless/libertas/mesh.h | 77 - drivers/net/wireless/libertas/radiotap.h | 44 - drivers/net/wireless/libertas/rx.c | 284 - drivers/net/wireless/libertas/tx.c | 207 - drivers/net/wireless/libertas/types.h | 268 - drivers/net/wireless/libertas_tf/Makefile | 6 - drivers/net/wireless/libertas_tf/cmd.c | 807 - drivers/net/wireless/libertas_tf/deb_defs.h | 104 - drivers/net/wireless/libertas_tf/if_usb.c | 930 - drivers/net/wireless/libertas_tf/if_usb.h | 98 - .../net/wireless/libertas_tf/libertas_tf.h | 519 - drivers/net/wireless/libertas_tf/main.c | 769 - drivers/net/wireless/mac80211_hwsim.c | 2582 -- drivers/net/wireless/mac80211_hwsim.h | 133 - drivers/net/wireless/mt5931/Kconfig | 19 - drivers/net/wireless/mt5931/Makefile | 150 - drivers/net/wireless/mt5931/Makefile.module | 152 - drivers/net/wireless/mt5931/common/dump.c | 539 - drivers/net/wireless/mt5931/common/wlan_bow.c | 3898 --- drivers/net/wireless/mt5931/common/wlan_lib.c | 5536 --- drivers/net/wireless/mt5931/common/wlan_oid.c | 10979 ------ drivers/net/wireless/mt5931/common/wlan_p2p.c | 1811 - .../mt5931/firmware_5931/WIFI_RAM_CODE | Bin 139776 -> 0 bytes .../wireless/mt5931/include/CFG_Wifi_File.h | 251 - drivers/net/wireless/mt5931/include/config.h | 1525 - drivers/net/wireless/mt5931/include/debug.h | 517 - drivers/net/wireless/mt5931/include/link.h | 414 - .../net/wireless/mt5931/include/mgmt/aa_fsm.h | 251 - .../wireless/mt5931/include/mgmt/ais_fsm.h | 680 - .../net/wireless/mt5931/include/mgmt/assoc.h | 147 - .../net/wireless/mt5931/include/mgmt/auth.h | 175 - .../wireless/mt5931/include/mgmt/bow_fsm.h | 190 - .../net/wireless/mt5931/include/mgmt/bss.h | 353 - .../net/wireless/mt5931/include/mgmt/cnm.h | 323 - .../wireless/mt5931/include/mgmt/cnm_mem.h | 1159 - .../wireless/mt5931/include/mgmt/cnm_scan.h | 206 - .../wireless/mt5931/include/mgmt/cnm_timer.h | 274 - .../wireless/mt5931/include/mgmt/hem_mbox.h | 441 - .../net/wireless/mt5931/include/mgmt/mib.h | 157 - .../wireless/mt5931/include/mgmt/p2p_assoc.h | 64 - .../wireless/mt5931/include/mgmt/p2p_bss.h | 65 - .../wireless/mt5931/include/mgmt/p2p_fsm.h | 2740 -- .../wireless/mt5931/include/mgmt/p2p_func.h | 324 - .../net/wireless/mt5931/include/mgmt/p2p_ie.h | 23 - .../wireless/mt5931/include/mgmt/p2p_rlm.h | 109 - .../mt5931/include/mgmt/p2p_rlm_obss.h | 93 - .../wireless/mt5931/include/mgmt/p2p_scan.h | 127 - .../wireless/mt5931/include/mgmt/p2p_state.h | 89 - .../wireless/mt5931/include/mgmt/privacy.h | 288 - .../net/wireless/mt5931/include/mgmt/rate.h | 111 - .../net/wireless/mt5931/include/mgmt/rlm.h | 451 - .../wireless/mt5931/include/mgmt/rlm_domain.h | 358 - .../wireless/mt5931/include/mgmt/rlm_obss.h | 164 - .../mt5931/include/mgmt/rlm_protection.h | 126 - .../mt5931/include/mgmt/roaming_fsm.h | 209 - .../net/wireless/mt5931/include/mgmt/rsn.h | 380 - .../net/wireless/mt5931/include/mgmt/scan.h | 847 - .../wireless/mt5931/include/mgmt/sec_fsm.h | 284 - .../net/wireless/mt5931/include/mgmt/swcr.h | 180 - .../net/wireless/mt5931/include/mgmt/wapi.h | 120 - .../mt5931/include/mgmt/wlan_typedef.h | 84 - .../net/wireless/mt5931/include/mgmt/wnm.h | 100 - .../net/wireless/mt5931/include/nic/adapter.h | 1404 - drivers/net/wireless/mt5931/include/nic/bow.h | 323 - .../net/wireless/mt5931/include/nic/cmd_buf.h | 176 - drivers/net/wireless/mt5931/include/nic/hal.h | 609 - .../net/wireless/mt5931/include/nic/hif_rx.h | 227 - .../net/wireless/mt5931/include/nic/hif_tx.h | 225 - drivers/net/wireless/mt5931/include/nic/mac.h | 2183 -- .../wireless/mt5931/include/nic/mt5931_reg.h | 336 - .../wireless/mt5931/include/nic/mt6620_reg.h | 286 - drivers/net/wireless/mt5931/include/nic/nic.h | 724 - .../net/wireless/mt5931/include/nic/nic_rx.h | 529 - .../net/wireless/mt5931/include/nic/nic_tx.h | 646 - drivers/net/wireless/mt5931/include/nic/p2p.h | 195 - .../wireless/mt5931/include/nic/p2p_cmd_buf.h | 93 - .../net/wireless/mt5931/include/nic/p2p_mac.h | 223 - .../net/wireless/mt5931/include/nic/p2p_nic.h | 74 - .../mt5931/include/nic/p2p_nic_cmd_event.h | 73 - .../net/wireless/mt5931/include/nic/que_mgt.h | 1150 - .../wireless/mt5931/include/nic/wlan_def.h | 1012 - .../wireless/mt5931/include/nic_cmd_event.h | 1888 - .../mt5931/include/nic_init_cmd_event.h | 180 - .../net/wireless/mt5931/include/p2p_precomp.h | 225 - .../net/wireless/mt5931/include/p2p_typedef.h | 278 - drivers/net/wireless/mt5931/include/precomp.h | 380 - drivers/net/wireless/mt5931/include/pwr_mgt.h | 147 - drivers/net/wireless/mt5931/include/queue.h | 189 - drivers/net/wireless/mt5931/include/rftest.h | 317 - drivers/net/wireless/mt5931/include/typedef.h | 236 - .../net/wireless/mt5931/include/wlan_bow.h | 547 - .../net/wireless/mt5931/include/wlan_lib.h | 1042 - .../net/wireless/mt5931/include/wlan_oid.h | 2073 -- .../net/wireless/mt5931/include/wlan_p2p.h | 424 - drivers/net/wireless/mt5931/mgmt/aaa_fsm.c | 1490 - drivers/net/wireless/mt5931/mgmt/ais_fsm.c | 4599 --- drivers/net/wireless/mt5931/mgmt/assoc.c | 2044 -- drivers/net/wireless/mt5931/mgmt/auth.c | 1350 - drivers/net/wireless/mt5931/mgmt/bss.c | 2776 -- drivers/net/wireless/mt5931/mgmt/cnm.c | 775 - drivers/net/wireless/mt5931/mgmt/cnm_mem.c | 1292 - drivers/net/wireless/mt5931/mgmt/cnm_timer.c | 531 - drivers/net/wireless/mt5931/mgmt/hem_mbox.c | 827 - drivers/net/wireless/mt5931/mgmt/mib.c | 102 - drivers/net/wireless/mt5931/mgmt/p2p_assoc.c | 99 - drivers/net/wireless/mt5931/mgmt/p2p_bss.c | 66 - drivers/net/wireless/mt5931/mgmt/p2p_fsm.c | 3379 -- drivers/net/wireless/mt5931/mgmt/p2p_func.c | 3378 -- drivers/net/wireless/mt5931/mgmt/p2p_ie.c | 72 - drivers/net/wireless/mt5931/mgmt/p2p_rlm.c | 1014 - .../net/wireless/mt5931/mgmt/p2p_rlm_obss.c | 374 - drivers/net/wireless/mt5931/mgmt/p2p_scan.c | 831 - drivers/net/wireless/mt5931/mgmt/p2p_state.c | 575 - drivers/net/wireless/mt5931/mgmt/privacy.c | 1024 - drivers/net/wireless/mt5931/mgmt/rate.c | 547 - drivers/net/wireless/mt5931/mgmt/rlm.c | 1723 - drivers/net/wireless/mt5931/mgmt/rlm_domain.c | 681 - drivers/net/wireless/mt5931/mgmt/rlm_obss.c | 461 - .../net/wireless/mt5931/mgmt/rlm_protection.c | 108 - .../net/wireless/mt5931/mgmt/roaming_fsm.c | 583 - drivers/net/wireless/mt5931/mgmt/rsn.c | 2617 -- drivers/net/wireless/mt5931/mgmt/saa_fsm.c | 2022 -- drivers/net/wireless/mt5931/mgmt/scan.c | 3025 -- drivers/net/wireless/mt5931/mgmt/scan_fsm.c | 1113 - drivers/net/wireless/mt5931/mgmt/sec_fsm.c | 1255 - drivers/net/wireless/mt5931/mgmt/swcr.c | 1268 - drivers/net/wireless/mt5931/mgmt/wapi.c | 514 - drivers/net/wireless/mt5931/mgmt/wnm.c | 349 - drivers/net/wireless/mt5931/nic/cmd_buf.c | 218 - drivers/net/wireless/mt5931/nic/nic.c | 4421 --- .../net/wireless/mt5931/nic/nic_cmd_event.c | 1651 - drivers/net/wireless/mt5931/nic/nic_pwr_mgt.c | 801 - drivers/net/wireless/mt5931/nic/nic_rx.c | 3529 -- drivers/net/wireless/mt5931/nic/nic_tx.c | 1981 -- drivers/net/wireless/mt5931/nic/p2p_nic.c | 203 - drivers/net/wireless/mt5931/nic/que_mgt.c | 4802 --- drivers/net/wireless/mt5931/os/linux/gl_bow.c | 1369 - .../wireless/mt5931/os/linux/gl_cfg80211.c | 1661 - .../net/wireless/mt5931/os/linux/gl_init.c | 3399 -- drivers/net/wireless/mt5931/os/linux/gl_kal.c | 3916 --- drivers/net/wireless/mt5931/os/linux/gl_p2p.c | 5498 --- .../mt5931/os/linux/gl_p2p_cfg80211.c | 2226 -- .../wireless/mt5931/os/linux/gl_p2p_init.c | 518 - .../net/wireless/mt5931/os/linux/gl_p2p_kal.c | 1629 - .../net/wireless/mt5931/os/linux/gl_proc.c | 811 - drivers/net/wireless/mt5931/os/linux/gl_rst.c | 473 - .../net/wireless/mt5931/os/linux/gl_wext.c | 4527 --- .../wireless/mt5931/os/linux/gl_wext_priv.c | 2238 -- .../wireless/mt5931/os/linux/hif/sdio/arm.c | 33 - .../mt5931/os/linux/hif/sdio/include/hif.h | 225 - .../os/linux/hif/sdio/include/hif_sdio.h | 286 - .../os/linux/hif/sdio/include/mtk_porting.h | 52 - .../wireless/mt5931/os/linux/hif/sdio/sdio.c | 1353 - .../wireless/mt5931/os/linux/hif/sdio/x86.c | 33 - .../mt5931/os/linux/include/gl_cfg80211.h | 319 - .../wireless/mt5931/os/linux/include/gl_kal.h | 2250 -- .../wireless/mt5931/os/linux/include/gl_os.h | 1139 - .../mt5931/os/linux/include/gl_p2p_ioctl.h | 1088 - .../mt5931/os/linux/include/gl_p2p_kal.h | 395 - .../mt5931/os/linux/include/gl_p2p_os.h | 194 - .../wireless/mt5931/os/linux/include/gl_rst.h | 131 - .../wireless/mt5931/os/linux/include/gl_sec.h | 24 - .../mt5931/os/linux/include/gl_typedef.h | 279 - .../mt5931/os/linux/include/gl_wext.h | 376 - .../mt5931/os/linux/include/gl_wext_priv.h | 396 - .../net/wireless/mt5931/os/linux/platform.c | 620 - drivers/net/wireless/mt5931/os/version.h | 200 - drivers/net/wireless/mt5931/os/wifi_version.h | 13 - drivers/net/wireless/mv8686/11d.c | 698 - drivers/net/wireless/mv8686/11d.h | 104 - drivers/net/wireless/mv8686/ChangeLog.txt | 716 - drivers/net/wireless/mv8686/Makefile | 10 - drivers/net/wireless/mv8686/Makefile.kernel | 10 - drivers/net/wireless/mv8686/Makefile.module | 37 - drivers/net/wireless/mv8686/Makefile.mv8686 | 8 - drivers/net/wireless/mv8686/ReleaseNotes.txt | 8 - drivers/net/wireless/mv8686/assoc.c | 1976 -- drivers/net/wireless/mv8686/assoc.h | 31 - drivers/net/wireless/mv8686/cmd.c | 2158 -- drivers/net/wireless/mv8686/cmd.h | 89 - drivers/net/wireless/mv8686/cmdresp.c | 718 - drivers/net/wireless/mv8686/debugfs.c | 969 - drivers/net/wireless/mv8686/debugfs.h | 10 - drivers/net/wireless/mv8686/decl.h | 80 - drivers/net/wireless/mv8686/defs.h | 442 - drivers/net/wireless/mv8686/dev.h | 430 - drivers/net/wireless/mv8686/host.h | 303 - drivers/net/wireless/mv8686/hostcmd.h | 775 - drivers/net/wireless/mv8686/if_sdio.c | 1392 - drivers/net/wireless/mv8686/if_sdio.h | 64 - drivers/net/wireless/mv8686/iwpriv.h | 18 - drivers/net/wireless/mv8686/lib80211.h | 129 - drivers/net/wireless/mv8686/main.c | 2056 -- drivers/net/wireless/mv8686/mkclean.sh | 10 - drivers/net/wireless/mv8686/mkpkg.sh | 17 - drivers/net/wireless/mv8686/mv8686_cis.c | 188 - drivers/net/wireless/mv8686/radiotap.h | 46 - drivers/net/wireless/mv8686/rx.c | 470 - drivers/net/wireless/mv8686/scan.c | 1458 - drivers/net/wireless/mv8686/scan.h | 33 - drivers/net/wireless/mv8686/tx.c | 179 - drivers/net/wireless/mv8686/types.h | 284 - drivers/net/wireless/mv8686/wext.c | 2263 -- drivers/net/wireless/mv8686/wext.h | 10 - drivers/net/wireless/mv8686/wifi_power.h | 1 - drivers/net/wireless/mv8686/wifi_version.h | 1 - drivers/net/wireless/mwifiex/11ac.c | 302 - drivers/net/wireless/mwifiex/11ac.h | 43 - drivers/net/wireless/mwifiex/11n.c | 703 - drivers/net/wireless/mwifiex/11n.h | 168 - drivers/net/wireless/mwifiex/11n_aggr.c | 304 - drivers/net/wireless/mwifiex/11n_aggr.h | 33 - drivers/net/wireless/mwifiex/11n_rxreorder.c | 667 - drivers/net/wireless/mwifiex/11n_rxreorder.h | 82 - drivers/net/wireless/mwifiex/Kconfig | 42 - drivers/net/wireless/mwifiex/Makefile | 53 - drivers/net/wireless/mwifiex/README | 203 - drivers/net/wireless/mwifiex/cfg80211.c | 2529 -- drivers/net/wireless/mwifiex/cfg80211.h | 29 - drivers/net/wireless/mwifiex/cfp.c | 504 - drivers/net/wireless/mwifiex/cmdevt.c | 1546 - drivers/net/wireless/mwifiex/debugfs.c | 757 - drivers/net/wireless/mwifiex/decl.h | 154 - drivers/net/wireless/mwifiex/ethtool.c | 70 - drivers/net/wireless/mwifiex/fw.h | 1645 - drivers/net/wireless/mwifiex/ie.c | 443 - drivers/net/wireless/mwifiex/init.c | 809 - drivers/net/wireless/mwifiex/ioctl.h | 400 - drivers/net/wireless/mwifiex/join.c | 1463 - drivers/net/wireless/mwifiex/main.c | 918 - drivers/net/wireless/mwifiex/main.h | 1128 - drivers/net/wireless/mwifiex/pcie.c | 2434 -- drivers/net/wireless/mwifiex/pcie.h | 320 - drivers/net/wireless/mwifiex/scan.c | 2071 -- drivers/net/wireless/mwifiex/sdio.c | 1836 - drivers/net/wireless/mwifiex/sdio.h | 328 - drivers/net/wireless/mwifiex/sta_cmd.c | 1507 - drivers/net/wireless/mwifiex/sta_cmdresp.c | 990 - drivers/net/wireless/mwifiex/sta_event.c | 437 - drivers/net/wireless/mwifiex/sta_ioctl.c | 1376 - drivers/net/wireless/mwifiex/sta_rx.c | 209 - drivers/net/wireless/mwifiex/sta_tx.c | 218 - drivers/net/wireless/mwifiex/txrx.c | 201 - drivers/net/wireless/mwifiex/uap_cmd.c | 720 - drivers/net/wireless/mwifiex/uap_event.c | 297 - drivers/net/wireless/mwifiex/uap_txrx.c | 356 - drivers/net/wireless/mwifiex/usb.c | 1033 - drivers/net/wireless/mwifiex/usb.h | 99 - drivers/net/wireless/mwifiex/util.c | 253 - drivers/net/wireless/mwifiex/util.h | 37 - drivers/net/wireless/mwifiex/wmm.c | 1265 - drivers/net/wireless/mwifiex/wmm.h | 115 - drivers/net/wireless/mwl8k.c | 6161 ---- drivers/net/wireless/orinoco/Kconfig | 141 - drivers/net/wireless/orinoco/Makefile | 17 - drivers/net/wireless/orinoco/airport.c | 267 - drivers/net/wireless/orinoco/cfg.c | 290 - drivers/net/wireless/orinoco/cfg.h | 15 - drivers/net/wireless/orinoco/fw.c | 387 - drivers/net/wireless/orinoco/fw.h | 21 - drivers/net/wireless/orinoco/hermes.c | 778 - drivers/net/wireless/orinoco/hermes.h | 520 - drivers/net/wireless/orinoco/hermes_dld.c | 477 - drivers/net/wireless/orinoco/hermes_dld.h | 52 - drivers/net/wireless/orinoco/hermes_rid.h | 165 - drivers/net/wireless/orinoco/hw.c | 1356 - drivers/net/wireless/orinoco/hw.h | 59 - drivers/net/wireless/orinoco/main.c | 2431 -- drivers/net/wireless/orinoco/main.h | 50 - drivers/net/wireless/orinoco/mic.c | 79 - drivers/net/wireless/orinoco/mic.h | 22 - drivers/net/wireless/orinoco/orinoco.h | 256 - drivers/net/wireless/orinoco/orinoco_cs.c | 341 - drivers/net/wireless/orinoco/orinoco_nortel.c | 322 - drivers/net/wireless/orinoco/orinoco_pci.c | 265 - drivers/net/wireless/orinoco/orinoco_pci.h | 68 - drivers/net/wireless/orinoco/orinoco_plx.c | 370 - drivers/net/wireless/orinoco/orinoco_tmd.c | 248 - drivers/net/wireless/orinoco/orinoco_usb.c | 1768 - drivers/net/wireless/orinoco/scan.c | 248 - drivers/net/wireless/orinoco/scan.h | 21 - drivers/net/wireless/orinoco/spectrum_cs.c | 321 - drivers/net/wireless/orinoco/wext.c | 1413 - drivers/net/wireless/orinoco/wext.h | 13 - drivers/net/wireless/p54/Kconfig | 71 - drivers/net/wireless/p54/Makefile | 7 - drivers/net/wireless/p54/eeprom.c | 983 - drivers/net/wireless/p54/eeprom.h | 245 - drivers/net/wireless/p54/fwio.c | 763 - drivers/net/wireless/p54/led.c | 162 - drivers/net/wireless/p54/lmac.h | 562 - drivers/net/wireless/p54/main.c | 867 - drivers/net/wireless/p54/net2280.h | 452 - drivers/net/wireless/p54/p54.h | 281 - drivers/net/wireless/p54/p54pci.c | 702 - drivers/net/wireless/p54/p54pci.h | 112 - drivers/net/wireless/p54/p54spi.c | 742 - drivers/net/wireless/p54/p54spi.h | 125 - drivers/net/wireless/p54/p54spi_eeprom.h | 679 - drivers/net/wireless/p54/p54usb.c | 1145 - drivers/net/wireless/p54/p54usb.h | 151 - drivers/net/wireless/p54/txrx.c | 941 - drivers/net/wireless/prism54/Makefile | 8 - drivers/net/wireless/prism54/isl_38xx.c | 256 - drivers/net/wireless/prism54/isl_38xx.h | 171 - drivers/net/wireless/prism54/isl_ioctl.c | 2910 -- drivers/net/wireless/prism54/isl_ioctl.h | 48 - drivers/net/wireless/prism54/isl_oid.h | 505 - drivers/net/wireless/prism54/islpci_dev.c | 965 - drivers/net/wireless/prism54/islpci_dev.h | 217 - drivers/net/wireless/prism54/islpci_eth.c | 507 - drivers/net/wireless/prism54/islpci_eth.h | 72 - drivers/net/wireless/prism54/islpci_hotplug.c | 342 - drivers/net/wireless/prism54/islpci_mgt.c | 503 - drivers/net/wireless/prism54/islpci_mgt.h | 139 - drivers/net/wireless/prism54/oid_mgt.c | 903 - drivers/net/wireless/prism54/oid_mgt.h | 59 - drivers/net/wireless/prism54/prismcompat.h | 43 - drivers/net/wireless/ray_cs.c | 2851 -- drivers/net/wireless/ray_cs.h | 72 - drivers/net/wireless/rayctl.h | 732 - drivers/net/wireless/rda5990/Makefile | 5 - .../net/wireless/rda5990/drv_fm_rda/Makefile | 49 - .../rda5990/drv_fm_rda/RDA5990_FM_drv.c | 2142 -- .../rda5990/drv_fm_rda/RDA5990_FM_drv_gpio.c | 1784 - .../rda5990/rda_5990_power_ctrl/Makefile | 3 - .../rda_5990_power_ctrl/rda_5990_power_ctrl.c | 1897 - .../rda_5990_power_ctrl_by_gpio.c | 1462 - .../wireless/rda5990/rda_gpio_i2c/Makefile | 39 - .../rda5990/rda_gpio_i2c/rda_gpio_i2c.c | 460 - .../net/wireless/rda5990/rda_wlan/Makefile | 20 - .../wireless/rda5990/rda_wlan/Makefile_gwl | 23 - .../rda5990/rda_wlan/rda5890_debugfs.c | 593 - .../rda5990/rda_wlan/rda5890_debugfs.h | 13 - .../wireless/rda5990/rda_wlan/rda5890_defs.h | 71 - .../wireless/rda5990/rda_wlan/rda5890_dev.c | 633 - .../wireless/rda5990/rda_wlan/rda5890_dev.h | 272 - .../rda5990/rda_wlan/rda5890_if_sdio.c | 795 - .../rda5990/rda_wlan/rda5890_if_sdio.h | 49 - .../wireless/rda5990/rda_wlan/rda5890_ioctl.h | 17 - .../wireless/rda5990/rda_wlan/rda5890_nvram.c | 108 - .../wireless/rda5990/rda_wlan/rda5890_scan.c | 369 - .../rda5990/rda_wlan/rda5890_sdio_patch.c | 1406 - .../wireless/rda5990/rda_wlan/rda5890_txrx.c | 139 - .../wireless/rda5990/rda_wlan/rda5890_txrx.h | 13 - .../wireless/rda5990/rda_wlan/rda5890_wext.c | 2562 -- .../wireless/rda5990/rda_wlan/rda5890_wext.h | 37 - .../wireless/rda5990/rda_wlan/rda5890_wid.c | 1957 -- .../wireless/rda5990/rda_wlan/rda5890_wid.h | 288 - drivers/net/wireless/rkusbwifi/Makefile | 16 - drivers/net/wireless/rkusbwifi/mt7601/Kconfig | 10 - drivers/net/wireless/rkusbwifi/rt5370/Kconfig | 8 - .../net/wireless/rkusbwifi/rtl8188eu/Kconfig | 8 - .../net/wireless/rkusbwifi/rtl8192cu/Kconfig | 9 - .../net/wireless/rkusbwifi/rtl8723au/Kconfig | 9 - drivers/net/wireless/rkusbwifi/wifi_power.c | 108 - drivers/net/wireless/rkusbwifi/wifi_power.h | 87 - .../net/wireless/rkusbwifi/wifi_power_ops.c | 117 - .../net/wireless/rkusbwifi/wifi_power_usb.c | 133 - drivers/net/wireless/rkwifi/Kconfig | 23 - drivers/net/wireless/rkwifi/Makefile | 9 - .../wireless/rkwifi/firmware/nvram_4330.txt | 40 - .../wireless/rkwifi/firmware/nvram_RK901.txt | 52 - .../wireless/rkwifi/firmware/nvram_RK903.cal | 102 - drivers/net/wireless/rkwifi/rk_wifi_config.c | 99 - drivers/net/wireless/rndis_wlan.c | 3765 -- drivers/net/wireless/rt2x00/Kconfig | 242 - drivers/net/wireless/rt2x00/Makefile | 23 - drivers/net/wireless/rt2x00/rt2400pci.c | 1847 - drivers/net/wireless/rt2x00/rt2400pci.h | 963 - drivers/net/wireless/rt2x00/rt2500pci.c | 2135 -- drivers/net/wireless/rt2x00/rt2500pci.h | 1237 - drivers/net/wireless/rt2x00/rt2500usb.c | 1996 -- drivers/net/wireless/rt2x00/rt2500usb.h | 857 - drivers/net/wireless/rt2x00/rt2800.h | 2787 -- drivers/net/wireless/rt2x00/rt2800lib.c | 6429 ---- drivers/net/wireless/rt2x00/rt2800lib.h | 229 - drivers/net/wireless/rt2x00/rt2800pci.c | 1361 - drivers/net/wireless/rt2x00/rt2800pci.h | 141 - drivers/net/wireless/rt2x00/rt2800usb.c | 1385 - drivers/net/wireless/rt2x00/rt2800usb.h | 112 - drivers/net/wireless/rt2x00/rt2x00.h | 1393 - drivers/net/wireless/rt2x00/rt2x00config.c | 287 - drivers/net/wireless/rt2x00/rt2x00crypto.c | 258 - drivers/net/wireless/rt2x00/rt2x00debug.c | 802 - drivers/net/wireless/rt2x00/rt2x00debug.h | 71 - drivers/net/wireless/rt2x00/rt2x00dev.c | 1517 - drivers/net/wireless/rt2x00/rt2x00dump.h | 129 - drivers/net/wireless/rt2x00/rt2x00firmware.c | 131 - drivers/net/wireless/rt2x00/rt2x00leds.c | 246 - drivers/net/wireless/rt2x00/rt2x00leds.h | 46 - drivers/net/wireless/rt2x00/rt2x00lib.h | 470 - drivers/net/wireless/rt2x00/rt2x00link.c | 520 - drivers/net/wireless/rt2x00/rt2x00mac.c | 858 - drivers/net/wireless/rt2x00/rt2x00mmio.c | 216 - drivers/net/wireless/rt2x00/rt2x00mmio.h | 119 - drivers/net/wireless/rt2x00/rt2x00pci.c | 226 - drivers/net/wireless/rt2x00/rt2x00pci.h | 51 - drivers/net/wireless/rt2x00/rt2x00queue.c | 1364 - drivers/net/wireless/rt2x00/rt2x00queue.h | 704 - drivers/net/wireless/rt2x00/rt2x00reg.h | 279 - drivers/net/wireless/rt2x00/rt2x00soc.c | 162 - drivers/net/wireless/rt2x00/rt2x00soc.h | 42 - drivers/net/wireless/rt2x00/rt2x00usb.c | 888 - drivers/net/wireless/rt2x00/rt2x00usb.h | 442 - drivers/net/wireless/rt2x00/rt61pci.c | 3106 -- drivers/net/wireless/rt2x00/rt61pci.h | 1502 - drivers/net/wireless/rt2x00/rt73usb.c | 2543 -- drivers/net/wireless/rt2x00/rt73usb.h | 1081 - drivers/net/wireless/rtl818x/Kconfig | 88 - drivers/net/wireless/rtl818x/Makefile | 2 - drivers/net/wireless/rtl818x/rtl8180/Makefile | 5 - drivers/net/wireless/rtl818x/rtl8180/dev.c | 1180 - .../net/wireless/rtl818x/rtl8180/grf5101.c | 191 - .../net/wireless/rtl818x/rtl8180/grf5101.h | 28 - .../net/wireless/rtl818x/rtl8180/max2820.c | 169 - .../net/wireless/rtl818x/rtl8180/max2820.h | 28 - .../net/wireless/rtl818x/rtl8180/rtl8180.h | 130 - .../net/wireless/rtl818x/rtl8180/rtl8225.c | 792 - .../net/wireless/rtl818x/rtl8180/rtl8225.h | 23 - drivers/net/wireless/rtl818x/rtl8180/sa2400.c | 229 - drivers/net/wireless/rtl818x/rtl8180/sa2400.h | 36 - drivers/net/wireless/rtl818x/rtl8187/Makefile | 5 - drivers/net/wireless/rtl818x/rtl8187/dev.c | 1671 - drivers/net/wireless/rtl818x/rtl8187/leds.c | 245 - drivers/net/wireless/rtl818x/rtl8187/leds.h | 59 - drivers/net/wireless/rtl818x/rtl8187/rfkill.c | 64 - drivers/net/wireless/rtl818x/rtl8187/rfkill.h | 8 - .../net/wireless/rtl818x/rtl8187/rtl8187.h | 282 - .../net/wireless/rtl818x/rtl8187/rtl8225.c | 962 - .../net/wireless/rtl818x/rtl8187/rtl8225.h | 44 - drivers/net/wireless/rtl818x/rtl818x.h | 244 - drivers/net/wireless/rtl8723as/Kconfig | 8 - drivers/net/wireless/rtlwifi/Kconfig | 80 - drivers/net/wireless/rtlwifi/Makefile | 31 - drivers/net/wireless/rtlwifi/base.c | 1869 - drivers/net/wireless/rtlwifi/base.h | 157 - drivers/net/wireless/rtlwifi/cam.c | 348 - drivers/net/wireless/rtlwifi/cam.h | 56 - drivers/net/wireless/rtlwifi/core.c | 1332 - drivers/net/wireless/rtlwifi/core.h | 45 - drivers/net/wireless/rtlwifi/debug.c | 53 - drivers/net/wireless/rtlwifi/debug.h | 244 - drivers/net/wireless/rtlwifi/efuse.c | 1237 - drivers/net/wireless/rtlwifi/efuse.h | 123 - drivers/net/wireless/rtlwifi/pci.c | 2122 -- drivers/net/wireless/rtlwifi/pci.h | 280 - drivers/net/wireless/rtlwifi/ps.c | 936 - drivers/net/wireless/rtlwifi/ps.h | 54 - drivers/net/wireless/rtlwifi/rc.c | 282 - drivers/net/wireless/rtlwifi/rc.h | 47 - drivers/net/wireless/rtlwifi/regd.c | 430 - drivers/net/wireless/rtlwifi/regd.h | 61 - .../net/wireless/rtlwifi/rtl8188ee/Makefile | 16 - drivers/net/wireless/rtlwifi/rtl8188ee/def.h | 324 - drivers/net/wireless/rtlwifi/rtl8188ee/dm.c | 1794 - drivers/net/wireless/rtlwifi/rtl8188ee/dm.h | 326 - drivers/net/wireless/rtlwifi/rtl8188ee/fw.c | 830 - drivers/net/wireless/rtlwifi/rtl8188ee/fw.h | 301 - drivers/net/wireless/rtlwifi/rtl8188ee/hw.c | 2531 -- drivers/net/wireless/rtlwifi/rtl8188ee/hw.h | 68 - drivers/net/wireless/rtlwifi/rtl8188ee/led.c | 157 - drivers/net/wireless/rtlwifi/rtl8188ee/led.h | 38 - drivers/net/wireless/rtlwifi/rtl8188ee/phy.c | 2202 -- drivers/net/wireless/rtlwifi/rtl8188ee/phy.h | 236 - .../net/wireless/rtlwifi/rtl8188ee/pwrseq.c | 109 - .../net/wireless/rtlwifi/rtl8188ee/pwrseq.h | 327 - .../wireless/rtlwifi/rtl8188ee/pwrseqcmd.c | 140 - .../wireless/rtlwifi/rtl8188ee/pwrseqcmd.h | 97 - drivers/net/wireless/rtlwifi/rtl8188ee/reg.h | 2258 -- drivers/net/wireless/rtlwifi/rtl8188ee/rf.c | 467 - drivers/net/wireless/rtlwifi/rtl8188ee/rf.h | 46 - drivers/net/wireless/rtlwifi/rtl8188ee/sw.c | 400 - drivers/net/wireless/rtlwifi/rtl8188ee/sw.h | 36 - .../net/wireless/rtlwifi/rtl8188ee/table.c | 643 - .../net/wireless/rtlwifi/rtl8188ee/table.h | 47 - drivers/net/wireless/rtlwifi/rtl8188ee/trx.c | 817 - drivers/net/wireless/rtlwifi/rtl8188ee/trx.h | 795 - .../net/wireless/rtlwifi/rtl8192c/Makefile | 9 - .../net/wireless/rtlwifi/rtl8192c/dm_common.c | 1701 - .../net/wireless/rtlwifi/rtl8192c/dm_common.h | 171 - .../net/wireless/rtlwifi/rtl8192c/fw_common.c | 907 - .../net/wireless/rtlwifi/rtl8192c/fw_common.h | 103 - drivers/net/wireless/rtlwifi/rtl8192c/main.c | 40 - .../wireless/rtlwifi/rtl8192c/phy_common.c | 1953 -- .../wireless/rtlwifi/rtl8192c/phy_common.h | 258 - .../net/wireless/rtlwifi/rtl8192ce/Makefile | 13 - drivers/net/wireless/rtlwifi/rtl8192ce/def.h | 253 - drivers/net/wireless/rtlwifi/rtl8192ce/dm.c | 109 - drivers/net/wireless/rtlwifi/rtl8192ce/dm.h | 163 - drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | 2428 -- drivers/net/wireless/rtlwifi/rtl8192ce/hw.h | 82 - drivers/net/wireless/rtlwifi/rtl8192ce/led.c | 151 - drivers/net/wireless/rtlwifi/rtl8192ce/led.h | 38 - drivers/net/wireless/rtlwifi/rtl8192ce/phy.c | 622 - drivers/net/wireless/rtlwifi/rtl8192ce/phy.h | 262 - drivers/net/wireless/rtlwifi/rtl8192ce/reg.h | 2092 -- drivers/net/wireless/rtlwifi/rtl8192ce/rf.c | 509 - drivers/net/wireless/rtlwifi/rtl8192ce/rf.h | 44 - drivers/net/wireless/rtlwifi/rtl8192ce/sw.c | 387 - drivers/net/wireless/rtlwifi/rtl8192ce/sw.h | 41 - .../net/wireless/rtlwifi/rtl8192ce/table.c | 1224 - .../net/wireless/rtlwifi/rtl8192ce/table.h | 58 - drivers/net/wireless/rtlwifi/rtl8192ce/trx.c | 754 - drivers/net/wireless/rtlwifi/rtl8192ce/trx.h | 729 - .../net/wireless/rtlwifi/rtl8192cu/Makefile | 14 - drivers/net/wireless/rtlwifi/rtl8192cu/def.h | 58 - drivers/net/wireless/rtlwifi/rtl8192cu/dm.c | 107 - drivers/net/wireless/rtlwifi/rtl8192cu/dm.h | 32 - drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | 2357 -- drivers/net/wireless/rtlwifi/rtl8192cu/hw.h | 113 - drivers/net/wireless/rtlwifi/rtl8192cu/led.c | 141 - drivers/net/wireless/rtlwifi/rtl8192cu/led.h | 37 - drivers/net/wireless/rtlwifi/rtl8192cu/mac.c | 1127 - drivers/net/wireless/rtlwifi/rtl8192cu/mac.h | 174 - drivers/net/wireless/rtlwifi/rtl8192cu/phy.c | 593 - drivers/net/wireless/rtlwifi/rtl8192cu/phy.h | 50 - drivers/net/wireless/rtlwifi/rtl8192cu/reg.h | 30 - drivers/net/wireless/rtlwifi/rtl8192cu/rf.c | 486 - drivers/net/wireless/rtlwifi/rtl8192cu/rf.h | 51 - drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 392 - drivers/net/wireless/rtlwifi/rtl8192cu/sw.h | 56 - .../net/wireless/rtlwifi/rtl8192cu/table.c | 1888 - .../net/wireless/rtlwifi/rtl8192cu/table.h | 71 - drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | 689 - drivers/net/wireless/rtlwifi/rtl8192cu/trx.h | 435 - .../net/wireless/rtlwifi/rtl8192de/Makefile | 14 - drivers/net/wireless/rtlwifi/rtl8192de/def.h | 271 - drivers/net/wireless/rtlwifi/rtl8192de/dm.c | 1338 - drivers/net/wireless/rtlwifi/rtl8192de/dm.h | 161 - drivers/net/wireless/rtlwifi/rtl8192de/fw.c | 780 - drivers/net/wireless/rtlwifi/rtl8192de/fw.h | 155 - drivers/net/wireless/rtlwifi/rtl8192de/hw.c | 2323 -- drivers/net/wireless/rtlwifi/rtl8192de/hw.h | 66 - drivers/net/wireless/rtlwifi/rtl8192de/led.c | 159 - drivers/net/wireless/rtlwifi/rtl8192de/led.h | 38 - drivers/net/wireless/rtlwifi/rtl8192de/phy.c | 3695 -- drivers/net/wireless/rtlwifi/rtl8192de/phy.h | 178 - drivers/net/wireless/rtlwifi/rtl8192de/reg.h | 1312 - drivers/net/wireless/rtlwifi/rtl8192de/rf.c | 623 - drivers/net/wireless/rtlwifi/rtl8192de/rf.h | 44 - drivers/net/wireless/rtlwifi/rtl8192de/sw.c | 417 - drivers/net/wireless/rtlwifi/rtl8192de/sw.h | 37 - .../net/wireless/rtlwifi/rtl8192de/table.c | 1690 - .../net/wireless/rtlwifi/rtl8192de/table.h | 57 - drivers/net/wireless/rtlwifi/rtl8192de/trx.c | 872 - drivers/net/wireless/rtlwifi/rtl8192de/trx.h | 747 - .../net/wireless/rtlwifi/rtl8192se/Makefile | 15 - drivers/net/wireless/rtlwifi/rtl8192se/def.h | 554 - drivers/net/wireless/rtlwifi/rtl8192se/dm.c | 742 - drivers/net/wireless/rtlwifi/rtl8192se/dm.h | 120 - drivers/net/wireless/rtlwifi/rtl8192se/fw.c | 656 - drivers/net/wireless/rtlwifi/rtl8192se/fw.h | 376 - drivers/net/wireless/rtlwifi/rtl8192se/hw.c | 2552 -- drivers/net/wireless/rtlwifi/rtl8192se/hw.h | 80 - drivers/net/wireless/rtlwifi/rtl8192se/led.c | 151 - drivers/net/wireless/rtlwifi/rtl8192se/led.h | 37 - drivers/net/wireless/rtlwifi/rtl8192se/phy.c | 1727 - drivers/net/wireless/rtlwifi/rtl8192se/phy.h | 102 - drivers/net/wireless/rtlwifi/rtl8192se/reg.h | 1185 - drivers/net/wireless/rtlwifi/rtl8192se/rf.c | 535 - drivers/net/wireless/rtlwifi/rtl8192se/rf.h | 43 - drivers/net/wireless/rtlwifi/rtl8192se/sw.c | 443 - drivers/net/wireless/rtlwifi/rtl8192se/sw.h | 36 - .../net/wireless/rtlwifi/rtl8192se/table.c | 634 - .../net/wireless/rtlwifi/rtl8192se/table.h | 49 - drivers/net/wireless/rtlwifi/rtl8192se/trx.c | 654 - drivers/net/wireless/rtlwifi/rtl8192se/trx.h | 46 - .../net/wireless/rtlwifi/rtl8723ae/Makefile | 22 - drivers/net/wireless/rtlwifi/rtl8723ae/btc.h | 41 - drivers/net/wireless/rtlwifi/rtl8723ae/def.h | 163 - drivers/net/wireless/rtlwifi/rtl8723ae/dm.c | 994 - drivers/net/wireless/rtlwifi/rtl8723ae/dm.h | 155 - drivers/net/wireless/rtlwifi/rtl8723ae/fw.c | 838 - drivers/net/wireless/rtlwifi/rtl8723ae/fw.h | 104 - .../rtlwifi/rtl8723ae/hal_bt_coexist.c | 542 - .../rtlwifi/rtl8723ae/hal_bt_coexist.h | 160 - .../net/wireless/rtlwifi/rtl8723ae/hal_btc.c | 1784 - .../net/wireless/rtlwifi/rtl8723ae/hal_btc.h | 151 - drivers/net/wireless/rtlwifi/rtl8723ae/hw.c | 2399 -- drivers/net/wireless/rtlwifi/rtl8723ae/hw.h | 73 - drivers/net/wireless/rtlwifi/rtl8723ae/led.c | 157 - drivers/net/wireless/rtlwifi/rtl8723ae/led.h | 39 - drivers/net/wireless/rtlwifi/rtl8723ae/phy.c | 2028 -- drivers/net/wireless/rtlwifi/rtl8723ae/phy.h | 224 - .../net/wireless/rtlwifi/rtl8723ae/pwrseq.c | 109 - .../net/wireless/rtlwifi/rtl8723ae/pwrseq.h | 322 - .../wireless/rtlwifi/rtl8723ae/pwrseqcmd.c | 129 - .../wireless/rtlwifi/rtl8723ae/pwrseqcmd.h | 98 - drivers/net/wireless/rtlwifi/rtl8723ae/reg.h | 2097 -- drivers/net/wireless/rtlwifi/rtl8723ae/rf.c | 505 - drivers/net/wireless/rtlwifi/rtl8723ae/rf.h | 43 - drivers/net/wireless/rtlwifi/rtl8723ae/sw.c | 380 - drivers/net/wireless/rtlwifi/rtl8723ae/sw.h | 37 - .../net/wireless/rtlwifi/rtl8723ae/table.c | 738 - .../net/wireless/rtlwifi/rtl8723ae/table.h | 50 - drivers/net/wireless/rtlwifi/rtl8723ae/trx.c | 681 - drivers/net/wireless/rtlwifi/rtl8723ae/trx.h | 725 - drivers/net/wireless/rtlwifi/stats.c | 268 - drivers/net/wireless/rtlwifi/stats.h | 46 - drivers/net/wireless/rtlwifi/usb.c | 1167 - drivers/net/wireless/rtlwifi/usb.h | 169 - drivers/net/wireless/rtlwifi/wifi.h | 2475 -- drivers/net/wireless/ti/Kconfig | 24 - drivers/net/wireless/ti/Makefile | 7 - .../net/wireless/ti/wilink_platform_data.c | 49 - drivers/net/wireless/ti/wl1251/Kconfig | 33 - drivers/net/wireless/ti/wl1251/Makefile | 10 - drivers/net/wireless/ti/wl1251/acx.c | 1097 - drivers/net/wireless/ti/wl1251/acx.h | 1483 - drivers/net/wireless/ti/wl1251/boot.c | 554 - drivers/net/wireless/ti/wl1251/boot.h | 39 - drivers/net/wireless/ti/wl1251/cmd.c | 487 - drivers/net/wireless/ti/wl1251/cmd.h | 415 - drivers/net/wireless/ti/wl1251/debugfs.c | 539 - drivers/net/wireless/ti/wl1251/debugfs.h | 31 - drivers/net/wireless/ti/wl1251/event.c | 191 - drivers/net/wireless/ti/wl1251/event.h | 120 - drivers/net/wireless/ti/wl1251/init.c | 423 - drivers/net/wireless/ti/wl1251/init.h | 86 - drivers/net/wireless/ti/wl1251/io.c | 194 - drivers/net/wireless/ti/wl1251/io.h | 83 - drivers/net/wireless/ti/wl1251/main.c | 1480 - drivers/net/wireless/ti/wl1251/ps.c | 184 - drivers/net/wireless/ti/wl1251/ps.h | 35 - drivers/net/wireless/ti/wl1251/reg.h | 655 - drivers/net/wireless/ti/wl1251/rx.c | 235 - drivers/net/wireless/ti/wl1251/rx.h | 122 - drivers/net/wireless/ti/wl1251/sdio.c | 376 - drivers/net/wireless/ti/wl1251/spi.c | 358 - drivers/net/wireless/ti/wl1251/spi.h | 59 - drivers/net/wireless/ti/wl1251/tx.c | 560 - drivers/net/wireless/ti/wl1251/tx.h | 231 - drivers/net/wireless/ti/wl1251/wl1251.h | 445 - drivers/net/wireless/ti/wl1251/wl12xx_80211.h | 155 - drivers/net/wireless/ti/wl12xx/Kconfig | 9 - drivers/net/wireless/ti/wl12xx/Makefile | 3 - drivers/net/wireless/ti/wl12xx/acx.c | 53 - drivers/net/wireless/ti/wl12xx/acx.h | 273 - drivers/net/wireless/ti/wl12xx/cmd.c | 323 - drivers/net/wireless/ti/wl12xx/cmd.h | 132 - drivers/net/wireless/ti/wl12xx/conf.h | 50 - drivers/net/wireless/ti/wl12xx/debugfs.c | 243 - drivers/net/wireless/ti/wl12xx/debugfs.h | 28 - drivers/net/wireless/ti/wl12xx/event.c | 116 - drivers/net/wireless/ti/wl12xx/event.h | 111 - drivers/net/wireless/ti/wl12xx/main.c | 1850 - drivers/net/wireless/ti/wl12xx/reg.h | 556 - drivers/net/wireless/ti/wl12xx/scan.c | 501 - drivers/net/wireless/ti/wl12xx/scan.h | 140 - drivers/net/wireless/ti/wl12xx/wl12xx.h | 82 - drivers/net/wireless/ti/wl18xx/Kconfig | 7 - drivers/net/wireless/ti/wl18xx/Makefile | 3 - drivers/net/wireless/ti/wl18xx/acx.c | 196 - drivers/net/wireless/ti/wl18xx/acx.h | 340 - drivers/net/wireless/ti/wl18xx/cmd.c | 80 - drivers/net/wireless/ti/wl18xx/cmd.h | 52 - drivers/net/wireless/ti/wl18xx/conf.h | 121 - drivers/net/wireless/ti/wl18xx/debugfs.c | 403 - drivers/net/wireless/ti/wl18xx/debugfs.h | 28 - drivers/net/wireless/ti/wl18xx/event.c | 111 - drivers/net/wireless/ti/wl18xx/event.h | 77 - drivers/net/wireless/ti/wl18xx/io.c | 75 - drivers/net/wireless/ti/wl18xx/io.h | 28 - drivers/net/wireless/ti/wl18xx/main.c | 1800 - drivers/net/wireless/ti/wl18xx/reg.h | 220 - drivers/net/wireless/ti/wl18xx/scan.c | 326 - drivers/net/wireless/ti/wl18xx/scan.h | 127 - drivers/net/wireless/ti/wl18xx/tx.c | 171 - drivers/net/wireless/ti/wl18xx/tx.h | 46 - drivers/net/wireless/ti/wl18xx/wl18xx.h | 140 - drivers/net/wireless/ti/wlcore/Kconfig | 35 - drivers/net/wireless/ti/wlcore/Makefile | 12 - drivers/net/wireless/ti/wlcore/acx.c | 1848 - drivers/net/wireless/ti/wlcore/acx.h | 1134 - drivers/net/wireless/ti/wlcore/boot.c | 533 - drivers/net/wireless/ti/wlcore/boot.h | 55 - drivers/net/wireless/ti/wlcore/cmd.c | 2025 -- drivers/net/wireless/ti/wlcore/cmd.h | 698 - drivers/net/wireless/ti/wlcore/conf.h | 1384 - drivers/net/wireless/ti/wlcore/debug.h | 112 - drivers/net/wireless/ti/wlcore/debugfs.c | 1330 - drivers/net/wireless/ti/wlcore/debugfs.h | 120 - drivers/net/wireless/ti/wlcore/event.c | 303 - drivers/net/wireless/ti/wlcore/event.h | 87 - drivers/net/wireless/ti/wlcore/hw_ops.h | 245 - drivers/net/wireless/ti/wlcore/ini.h | 232 - drivers/net/wireless/ti/wlcore/init.c | 750 - drivers/net/wireless/ti/wlcore/init.h | 39 - drivers/net/wireless/ti/wlcore/io.c | 200 - drivers/net/wireless/ti/wlcore/io.h | 234 - drivers/net/wireless/ti/wlcore/main.c | 6209 ---- drivers/net/wireless/ti/wlcore/ps.c | 328 - drivers/net/wireless/ti/wlcore/ps.h | 41 - drivers/net/wireless/ti/wlcore/rx.c | 339 - drivers/net/wireless/ti/wlcore/rx.h | 152 - drivers/net/wireless/ti/wlcore/scan.c | 469 - drivers/net/wireless/ti/wlcore/scan.h | 172 - drivers/net/wireless/ti/wlcore/sdio.c | 419 - drivers/net/wireless/ti/wlcore/spi.c | 453 - drivers/net/wireless/ti/wlcore/testmode.c | 386 - drivers/net/wireless/ti/wlcore/testmode.h | 31 - drivers/net/wireless/ti/wlcore/tx.c | 1305 - drivers/net/wireless/ti/wlcore/tx.h | 283 - drivers/net/wireless/ti/wlcore/wl12xx_80211.h | 137 - drivers/net/wireless/ti/wlcore/wlcore.h | 616 - drivers/net/wireless/ti/wlcore/wlcore_i.h | 544 - drivers/net/wireless/wifi_launcher/Makefile | 11 - drivers/net/wireless/wifi_launcher/wlan.c | 64 - .../net/wireless/wifi_launcher/wlan_param.h | 13 - .../wifi_power/vendor/wp_aigo_e1000.c | 76 - .../wireless/wifi_power/vendor/wp_aigo_e700.c | 76 - .../wifi_power/vendor/wp_aigo_nx7007.c | 75 - .../wifi_power/vendor/wp_anjieda_inch10.c | 77 - .../wifi_power/vendor/wp_foxcom_tp2.c | 77 - .../wifi_power/vendor/wp_jinghua_m80.c | 76 - .../wifi_power/vendor/wp_malata_mp0100.c | 78 - .../wireless/wifi_power/vendor/wp_meitu_770.c | 85 - .../wifi_power/vendor/wp_rk2808_child.c | 76 - .../wifi_power/vendor/wp_rk2818sdk_usb.c | 192 - .../wifi_power/vendor/wp_rk28_meizhu_m70.c | 77 - .../wifi_power/vendor/wp_rk29_yifang_a10.c | 188 - .../wifi_power/vendor/wp_tchip_tr802d.c | 77 - .../wifi_power/vendor/wp_tchip_tr806d.c | 77 - .../wifi_power/vendor/wp_yifang_a7_2818.c | 76 - .../wifi_power/vendor/wp_yuxing_mid7001.c | 76 - .../wifi_power/vendor/wp_yuxing_mid704.c | 76 - .../wifi_power/vendor/wp_yuxing_umpc1001.c | 76 - drivers/net/wireless/wifi_power/wifi_config.c | 62 - drivers/net/wireless/wifi_power/wifi_power.c | 92 - drivers/net/wireless/wifi_power/wifi_power.h | 85 - .../net/wireless/wifi_power/wifi_power_ops.c | 230 - .../net/wireless/wifi_power/wifi_power_save.c | 469 - .../net/wireless/wifi_power/wifi_power_usb.c | 118 - .../net/wireless/wifi_power/wifi_version.h | 43 - .../net/wireless/wifi_sys/rkwifi_sys_iface.c | 439 - drivers/net/wireless/wl3501.h | 615 - drivers/net/wireless/wl3501_cs.c | 2022 -- drivers/net/wireless/zd1201.c | 1912 - drivers/net/wireless/zd1201.h | 147 - drivers/net/wireless/zd1211rw/Kconfig | 19 - drivers/net/wireless/zd1211rw/Makefile | 9 - drivers/net/wireless/zd1211rw/zd_chip.c | 1561 - drivers/net/wireless/zd1211rw/zd_chip.h | 984 - drivers/net/wireless/zd1211rw/zd_def.h | 70 - drivers/net/wireless/zd1211rw/zd_mac.c | 1552 - drivers/net/wireless/zd1211rw/zd_mac.h | 328 - drivers/net/wireless/zd1211rw/zd_rf.c | 182 - drivers/net/wireless/zd1211rw/zd_rf.h | 111 - drivers/net/wireless/zd1211rw/zd_rf_al2230.c | 444 - drivers/net/wireless/zd1211rw/zd_rf_al7230b.c | 495 - drivers/net/wireless/zd1211rw/zd_rf_rf2959.c | 282 - drivers/net/wireless/zd1211rw/zd_rf_uw2453.c | 540 - drivers/net/wireless/zd1211rw/zd_usb.c | 2061 -- drivers/net/wireless/zd1211rw/zd_usb.h | 293 - 1781 files changed, 1242340 deletions(-) delete mode 100644 drivers/net/wireless/Kconfig delete mode 100644 drivers/net/wireless/Makefile delete mode 100644 drivers/net/wireless/adm8211.c delete mode 100644 drivers/net/wireless/adm8211.h delete mode 100644 drivers/net/wireless/airo.c delete mode 100644 drivers/net/wireless/airo.h delete mode 100644 drivers/net/wireless/airo_cs.c delete mode 100644 drivers/net/wireless/ar6003/Kconfig delete mode 100644 drivers/net/wireless/ar6003/Makefile delete mode 100644 drivers/net/wireless/ar6003/clean.sh delete mode 100644 drivers/net/wireless/ar6003/host/Makefile delete mode 100644 drivers/net/wireless/ar6003/host/bmi/include/bmi_internal.h delete mode 100644 drivers/net/wireless/ar6003/host/bmi/src/bmi.c delete mode 100644 drivers/net/wireless/ar6003/host/bmi/src/makefile delete mode 100644 drivers/net/wireless/ar6003/host/dfs/dfs.c delete mode 100644 drivers/net/wireless/ar6003/host/dfs/dfs_ar.c delete mode 100644 drivers/net/wireless/ar6003/host/dfs/dfs_bindetects.c delete mode 100644 drivers/net/wireless/ar6003/host/dfs/dfs_debug.c delete mode 100644 drivers/net/wireless/ar6003/host/dfs/dfs_fcc_bin5.c delete mode 100644 drivers/net/wireless/ar6003/host/dfs/dfs_host_project.c delete mode 100644 drivers/net/wireless/ar6003/host/dfs/dfs_init.c delete mode 100644 drivers/net/wireless/ar6003/host/dfs/dfs_misc.c delete mode 100644 drivers/net/wireless/ar6003/host/dfs/dfs_process_phyerr.c delete mode 100644 drivers/net/wireless/ar6003/host/dfs/dfs_process_radarevent.c delete mode 100644 drivers/net/wireless/ar6003/host/dfs/dfs_staggered.c delete mode 100644 drivers/net/wireless/ar6003/host/dfs/dfs_target_api.h delete mode 100644 drivers/net/wireless/ar6003/host/dfs/makefile delete mode 100644 drivers/net/wireless/ar6003/host/hif/common/hif_bmi_reg_access.c delete mode 100644 drivers/net/wireless/ar6003/host/hif/common/hif_diag_reg_access.c delete mode 100644 drivers/net/wireless/ar6003/host/hif/common/hif_sdio_common.h delete mode 100644 drivers/net/wireless/ar6003/host/hif/common/makefile delete mode 100644 drivers/net/wireless/ar6003/host/hif/sdio/Makefile delete mode 100644 drivers/net/wireless/ar6003/host/hif/sdio/linux_sdio/include/hif_internal.h delete mode 100644 drivers/net/wireless/ar6003/host/hif/sdio/linux_sdio/src/hif.c delete mode 100644 drivers/net/wireless/ar6003/host/hif/sdio/linux_sdio/src/hif_scatter.c delete mode 100644 drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k.c delete mode 100644 drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k.h delete mode 100644 drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k_events.c delete mode 100644 drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k_gmbox.c delete mode 100644 drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k_gmbox_hciuart.c delete mode 100644 drivers/net/wireless/ar6003/host/htc2/AR6000/makefile delete mode 100644 drivers/net/wireless/ar6003/host/htc2/htc.c delete mode 100644 drivers/net/wireless/ar6003/host/htc2/htc_debug.h delete mode 100644 drivers/net/wireless/ar6003/host/htc2/htc_internal.h delete mode 100644 drivers/net/wireless/ar6003/host/htc2/htc_recv.c delete mode 100644 drivers/net/wireless/ar6003/host/htc2/htc_send.c delete mode 100644 drivers/net/wireless/ar6003/host/htc2/htc_services.c delete mode 100644 drivers/net/wireless/ar6003/host/include/a_config.h delete mode 100644 drivers/net/wireless/ar6003/host/include/a_debug.h delete mode 100644 drivers/net/wireless/ar6003/host/include/a_drv.h delete mode 100644 drivers/net/wireless/ar6003/host/include/a_drv_api.h delete mode 100644 drivers/net/wireless/ar6003/host/include/a_osapi.h delete mode 100644 drivers/net/wireless/ar6003/host/include/a_types.h delete mode 100644 drivers/net/wireless/ar6003/host/include/aggr_recv_api.h delete mode 100644 drivers/net/wireless/ar6003/host/include/ar3kconfig.h delete mode 100644 drivers/net/wireless/ar6003/host/include/ar6000_api.h delete mode 100644 drivers/net/wireless/ar6003/host/include/ar6000_diag.h delete mode 100644 drivers/net/wireless/ar6003/host/include/ar6kap_common.h delete mode 100644 drivers/net/wireless/ar6003/host/include/athbtfilter.h delete mode 100644 drivers/net/wireless/ar6003/host/include/athendpack.h delete mode 100644 drivers/net/wireless/ar6003/host/include/athstartpack.h delete mode 100644 drivers/net/wireless/ar6003/host/include/bmi.h delete mode 100644 drivers/net/wireless/ar6003/host/include/common_drv.h delete mode 100644 drivers/net/wireless/ar6003/host/include/dbglog_api.h delete mode 100644 drivers/net/wireless/ar6003/host/include/dfs_host.h delete mode 100644 drivers/net/wireless/ar6003/host/include/dfs_host_project.h delete mode 100644 drivers/net/wireless/ar6003/host/include/dl_list.h delete mode 100644 drivers/net/wireless/ar6003/host/include/dset_api.h delete mode 100644 drivers/net/wireless/ar6003/host/include/gpio_api.h delete mode 100644 drivers/net/wireless/ar6003/host/include/hci_transport_api.h delete mode 100644 drivers/net/wireless/ar6003/host/include/hif.h delete mode 100644 drivers/net/wireless/ar6003/host/include/host_reg_table.h delete mode 100644 drivers/net/wireless/ar6003/host/include/host_version.h delete mode 100644 drivers/net/wireless/ar6003/host/include/htc_api.h delete mode 100644 drivers/net/wireless/ar6003/host/include/htc_packet.h delete mode 100644 drivers/net/wireless/ar6003/host/include/p2p_api.h delete mode 100644 drivers/net/wireless/ar6003/host/include/project.h delete mode 100644 drivers/net/wireless/ar6003/host/include/target_reg_table.h delete mode 100644 drivers/net/wireless/ar6003/host/include/utils_api.h delete mode 100644 drivers/net/wireless/ar6003/host/include/wlan_api.h delete mode 100644 drivers/net/wireless/ar6003/host/include/wmi_api.h delete mode 100644 drivers/net/wireless/ar6003/host/lib/wac/Makefile delete mode 100644 drivers/net/wireless/ar6003/host/lib/wac/wac.c delete mode 100644 drivers/net/wireless/ar6003/host/lib/wac/wac_lib_api.h delete mode 100644 drivers/net/wireless/ar6003/host/localmake.linux.inc delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000/PS_ASIC.pst delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000/RamPatch.txt delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/PS_ASIC.pst delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/PS_ASIC_aclHighPri.pst delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/PS_ASIC_aclLowPri.pst delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/RamPatch.txt delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101/PS_ASIC.pst delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101/RamPatch.txt delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101/Readme.txt delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/PS_ASIC.pst delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/PS_ASIC_aclHighPri.pst delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/PS_ASIC_aclLowPri.pst delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/RamPatch.txt delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3kconfig.c delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3kps/ar3kpsconfig.c delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3kps/ar3kpsconfig.h delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3kps/ar3kpsparser.c delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/ar3kps/ar3kpsparser.h delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/common_drv.c delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/credit_dist.c delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/makefile delete mode 100644 drivers/net/wireless/ar6003/host/miscdrv/miscdrv.h delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/Makefile delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/ar6000_android.c delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/ar6000_drv.c delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/ar6000_pm.c delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/ar6000_raw_if.c delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/ar6k_mem_debug.c delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/ar6k_pal.c delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/cfg80211.c delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/eeprom.c delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/export_hci_transport.c delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/hci_bridge.c delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/include/ar6000_drv.h delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/include/ar6k_pal.h delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/include/ar6xapi_linux.h delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/include/athdrv_linux.h delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/include/athtypes_linux.h delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/include/cfg80211.h delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/include/config_linux.h delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/include/debug_linux.h delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/include/export_hci_transport.h delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/include/ieee80211_ioctl.h delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/include/osapi_linux.h delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/include/wlan_config.h delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/include/wmi_filter_linux.h delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/ioctl.c delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/netbuf.c delete mode 100644 drivers/net/wireless/ar6003/host/os/linux/wireless_ext.c delete mode 100644 drivers/net/wireless/ar6003/host/p2p/makefile delete mode 100644 drivers/net/wireless/ar6003/host/p2p/p2p_internal.h delete mode 100644 drivers/net/wireless/ar6003/host/p2p/p2p_main.c delete mode 100644 drivers/net/wireless/ar6003/host/regtable/AR6002def.c delete mode 100644 drivers/net/wireless/ar6003/host/regtable/AR6003def.c delete mode 100644 drivers/net/wireless/ar6003/host/regtable/MCKINLEYdef.c delete mode 100644 drivers/net/wireless/ar6003/host/regtable/hostdef.h delete mode 100644 drivers/net/wireless/ar6003/host/regtable/makefile delete mode 100644 drivers/net/wireless/ar6003/host/regtable/regtable.c delete mode 100644 drivers/net/wireless/ar6003/host/regtable/targetdef.h delete mode 100644 drivers/net/wireless/ar6003/host/reorder/aggr_rx_internal.h delete mode 100644 drivers/net/wireless/ar6003/host/reorder/makefile delete mode 100644 drivers/net/wireless/ar6003/host/reorder/rcv_aggr.c delete mode 100644 drivers/net/wireless/ar6003/host/wlan/include/ieee80211.h delete mode 100644 drivers/net/wireless/ar6003/host/wlan/include/ieee80211_node.h delete mode 100644 drivers/net/wireless/ar6003/host/wlan/src/makefile delete mode 100644 drivers/net/wireless/ar6003/host/wlan/src/wlan_node.c delete mode 100644 drivers/net/wireless/ar6003/host/wlan/src/wlan_recv_beacon.c delete mode 100644 drivers/net/wireless/ar6003/host/wlan/src/wlan_utils.c delete mode 100644 drivers/net/wireless/ar6003/host/wmi/makefile delete mode 100644 drivers/net/wireless/ar6003/host/wmi/wmi.c delete mode 100644 drivers/net/wireless/ar6003/host/wmi/wmi_host.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/AR6002_regdump.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/AR6K_version.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/addrs.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsEnv.vr delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsEnvConfig.vr delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsTop.vr delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsTopConfig.vr delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/Makefile.child delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/Makefile.reg delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/addac.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/addac.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/analog_intf_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/analog_intf_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/analog_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/analog_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/apb_map.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/apb_map.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/bias_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/bias_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/gpio_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/gpio_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/mac_pcu.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/mac_pcu.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/mbox_host_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/mbox_host_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/mbox_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/mbox_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/rf2G_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/rf2G_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/rf5G_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/rf5G_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/rtc_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/rtc_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/rxtxbb_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/rxtxbb_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/si_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/si_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/synth_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/synth_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/top_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/top_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/txpc_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/txpc_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/uart_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/uart_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/vmc_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw/vmc_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsEnv.vr delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsEnvConfig.vr delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsTop.vr delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsTopConfig.vr delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/Makefile.child delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/Makefile.reg delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/addac.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/addac.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_intf_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_intf_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/apb_map.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/apb_map.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/bias_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/bias_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/gpio_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/gpio_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mac_pcu.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mac_pcu.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_host_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_host_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf2G_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf2G_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf5G_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf5G_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rtc_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rtc_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rxtxbb_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rxtxbb_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/si_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/si_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/synth_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/synth_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/top_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/top_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/txpc_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/txpc_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/uart_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/uart_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/vmc_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/vmc_reg.vrh delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/analog_intf_ares_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/analog_intf_athr_wlan_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/analog_intf_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/apb_athr_wlan_map.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/apb_map.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/bb_lc_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/efuse_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/gpio_athr_wlan_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/gpio_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mac_dma_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mac_pcu_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_host_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_wlan_host_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_wlan_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/rdma_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/rtc_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/rtc_wlan_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/si_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/uart_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/umbox_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/umbox_wlan_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/vmc_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/vmc_wlan_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/analog_intf_athr_wlan_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/analog_intf_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/apb_athr_wlan_map.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/apb_map.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/athrI2cSlaveApbCsr.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bb_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_gmac_0_rx_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_gmac_0_tx_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_rx_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_tx_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_intr_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_intr_reg_gmac_1_1.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bt_coex_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/chk_sum_seg_acc_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/efuse_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/efuse_wlan_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/fpga_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/gpio_athr_wlan_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/gpio_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mac_dma_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mac_pcu_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/map_rf_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_host_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_i2s_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_wlan_host_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_wlan_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mdio_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mii_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mmac_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/odin_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rdma_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_soc_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_sync_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_wlan_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/si_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/stereo_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/uart_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/umbox_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/umbox_wlan_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/usb_cast_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wlan_coex_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_dcu_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_dma_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_pcu_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_qcu_reg.h delete mode 100644 drivers/net/wireless/ar6003/include/a_hci.h delete mode 100644 drivers/net/wireless/ar6003/include/athdefs.h delete mode 100644 drivers/net/wireless/ar6003/include/bmi_msg.h delete mode 100644 drivers/net/wireless/ar6003/include/btcoexGpio.h delete mode 100644 drivers/net/wireless/ar6003/include/cnxmgmt.h delete mode 100644 drivers/net/wireless/ar6003/include/dbglog.h delete mode 100644 drivers/net/wireless/ar6003/include/dbglog_id.h delete mode 100644 drivers/net/wireless/ar6003/include/dfs_common.h delete mode 100644 drivers/net/wireless/ar6003/include/discovery.h delete mode 100644 drivers/net/wireless/ar6003/include/dset_internal.h delete mode 100644 drivers/net/wireless/ar6003/include/dsetid.h delete mode 100644 drivers/net/wireless/ar6003/include/epping_test.h delete mode 100644 drivers/net/wireless/ar6003/include/gmboxif.h delete mode 100644 drivers/net/wireless/ar6003/include/gpio.h delete mode 100644 drivers/net/wireless/ar6003/include/host_proxy_iface.h delete mode 100644 drivers/net/wireless/ar6003/include/htc.h delete mode 100644 drivers/net/wireless/ar6003/include/htc_services.h delete mode 100644 drivers/net/wireless/ar6003/include/ini_dset.h delete mode 100644 drivers/net/wireless/ar6003/include/iot_flashotp.h delete mode 100644 drivers/net/wireless/ar6003/include/p2p.h delete mode 100644 drivers/net/wireless/ar6003/include/pkt_log.h delete mode 100644 drivers/net/wireless/ar6003/include/queue.h delete mode 100644 drivers/net/wireless/ar6003/include/regdump.h delete mode 100644 drivers/net/wireless/ar6003/include/roaming.h delete mode 100644 drivers/net/wireless/ar6003/include/targaddrs.h delete mode 100644 drivers/net/wireless/ar6003/include/testcmd.h delete mode 100644 drivers/net/wireless/ar6003/include/tlpm.h delete mode 100644 drivers/net/wireless/ar6003/include/wac_defs.h delete mode 100644 drivers/net/wireless/ar6003/include/wlan_defs.h delete mode 100644 drivers/net/wireless/ar6003/include/wlan_dset.h delete mode 100644 drivers/net/wireless/ar6003/include/wmi.h delete mode 100644 drivers/net/wireless/ar6003/include/wmi_thin.h delete mode 100644 drivers/net/wireless/ar6003/include/wmix.h delete mode 100644 drivers/net/wireless/at76c50x-usb.c delete mode 100644 drivers/net/wireless/at76c50x-usb.h delete mode 100644 drivers/net/wireless/ath/Kconfig delete mode 100644 drivers/net/wireless/ath/Makefile delete mode 100644 drivers/net/wireless/ath/ar5523/Kconfig delete mode 100644 drivers/net/wireless/ath/ar5523/Makefile delete mode 100644 drivers/net/wireless/ath/ar5523/ar5523.c delete mode 100644 drivers/net/wireless/ath/ar5523/ar5523.h delete mode 100644 drivers/net/wireless/ath/ar5523/ar5523_hw.h delete mode 100644 drivers/net/wireless/ath/ath.h delete mode 100644 drivers/net/wireless/ath/ath5k/Kconfig delete mode 100644 drivers/net/wireless/ath/ath5k/Makefile delete mode 100644 drivers/net/wireless/ath/ath5k/ahb.c delete mode 100644 drivers/net/wireless/ath/ath5k/ani.c delete mode 100644 drivers/net/wireless/ath/ath5k/ani.h delete mode 100644 drivers/net/wireless/ath/ath5k/ath5k.h delete mode 100644 drivers/net/wireless/ath/ath5k/attach.c delete mode 100644 drivers/net/wireless/ath/ath5k/base.c delete mode 100644 drivers/net/wireless/ath/ath5k/base.h delete mode 100644 drivers/net/wireless/ath/ath5k/caps.c delete mode 100644 drivers/net/wireless/ath/ath5k/debug.c delete mode 100644 drivers/net/wireless/ath/ath5k/debug.h delete mode 100644 drivers/net/wireless/ath/ath5k/desc.c delete mode 100644 drivers/net/wireless/ath/ath5k/desc.h delete mode 100644 drivers/net/wireless/ath/ath5k/dma.c delete mode 100644 drivers/net/wireless/ath/ath5k/eeprom.c delete mode 100644 drivers/net/wireless/ath/ath5k/eeprom.h delete mode 100644 drivers/net/wireless/ath/ath5k/gpio.c delete mode 100644 drivers/net/wireless/ath/ath5k/initvals.c delete mode 100644 drivers/net/wireless/ath/ath5k/led.c delete mode 100644 drivers/net/wireless/ath/ath5k/mac80211-ops.c delete mode 100644 drivers/net/wireless/ath/ath5k/pci.c delete mode 100644 drivers/net/wireless/ath/ath5k/pcu.c delete mode 100644 drivers/net/wireless/ath/ath5k/phy.c delete mode 100644 drivers/net/wireless/ath/ath5k/qcu.c delete mode 100644 drivers/net/wireless/ath/ath5k/reg.h delete mode 100644 drivers/net/wireless/ath/ath5k/reset.c delete mode 100644 drivers/net/wireless/ath/ath5k/rfbuffer.h delete mode 100644 drivers/net/wireless/ath/ath5k/rfgain.h delete mode 100644 drivers/net/wireless/ath/ath5k/rfkill.c delete mode 100644 drivers/net/wireless/ath/ath5k/sysfs.c delete mode 100644 drivers/net/wireless/ath/ath5k/trace.h delete mode 100644 drivers/net/wireless/ath/ath6kl/Kconfig delete mode 100644 drivers/net/wireless/ath/ath6kl/Makefile delete mode 100644 drivers/net/wireless/ath/ath6kl/bmi.c delete mode 100644 drivers/net/wireless/ath/ath6kl/bmi.h delete mode 100644 drivers/net/wireless/ath/ath6kl/cfg80211.c delete mode 100644 drivers/net/wireless/ath/ath6kl/cfg80211.h delete mode 100644 drivers/net/wireless/ath/ath6kl/common.h delete mode 100644 drivers/net/wireless/ath/ath6kl/core.c delete mode 100644 drivers/net/wireless/ath/ath6kl/core.h delete mode 100644 drivers/net/wireless/ath/ath6kl/debug.c delete mode 100644 drivers/net/wireless/ath/ath6kl/debug.h delete mode 100644 drivers/net/wireless/ath/ath6kl/hif-ops.h delete mode 100644 drivers/net/wireless/ath/ath6kl/hif.c delete mode 100644 drivers/net/wireless/ath/ath6kl/hif.h delete mode 100644 drivers/net/wireless/ath/ath6kl/htc-ops.h delete mode 100644 drivers/net/wireless/ath/ath6kl/htc.h delete mode 100644 drivers/net/wireless/ath/ath6kl/htc_mbox.c delete mode 100644 drivers/net/wireless/ath/ath6kl/htc_pipe.c delete mode 100644 drivers/net/wireless/ath/ath6kl/init.c delete mode 100644 drivers/net/wireless/ath/ath6kl/main.c delete mode 100644 drivers/net/wireless/ath/ath6kl/recovery.c delete mode 100644 drivers/net/wireless/ath/ath6kl/sdio.c delete mode 100644 drivers/net/wireless/ath/ath6kl/target.h delete mode 100644 drivers/net/wireless/ath/ath6kl/testmode.c delete mode 100644 drivers/net/wireless/ath/ath6kl/testmode.h delete mode 100644 drivers/net/wireless/ath/ath6kl/trace.c delete mode 100644 drivers/net/wireless/ath/ath6kl/trace.h delete mode 100644 drivers/net/wireless/ath/ath6kl/txrx.c delete mode 100644 drivers/net/wireless/ath/ath6kl/usb.c delete mode 100644 drivers/net/wireless/ath/ath6kl/wmi.c delete mode 100644 drivers/net/wireless/ath/ath6kl/wmi.h delete mode 100644 drivers/net/wireless/ath/ath9k/Kconfig delete mode 100644 drivers/net/wireless/ath/ath9k/Makefile delete mode 100644 drivers/net/wireless/ath/ath9k/ahb.c delete mode 100644 drivers/net/wireless/ath/ath9k/ani.c delete mode 100644 drivers/net/wireless/ath/ath9k/ani.h delete mode 100644 drivers/net/wireless/ath/ath9k/antenna.c delete mode 100644 drivers/net/wireless/ath/ath9k/ar5008_initvals.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar5008_phy.c delete mode 100644 drivers/net/wireless/ath/ath9k/ar9001_initvals.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9002_calib.c delete mode 100644 drivers/net/wireless/ath/ath9k/ar9002_hw.c delete mode 100644 drivers/net/wireless/ath/ath9k/ar9002_initvals.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9002_mac.c delete mode 100644 drivers/net/wireless/ath/ath9k/ar9002_phy.c delete mode 100644 drivers/net/wireless/ath/ath9k/ar9002_phy.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9003_calib.c delete mode 100644 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c delete mode 100644 drivers/net/wireless/ath/ath9k/ar9003_eeprom.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9003_hw.c delete mode 100644 drivers/net/wireless/ath/ath9k/ar9003_mac.c delete mode 100644 drivers/net/wireless/ath/ath9k/ar9003_mac.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9003_mci.c delete mode 100644 drivers/net/wireless/ath/ath9k/ar9003_mci.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9003_paprd.c delete mode 100644 drivers/net/wireless/ath/ath9k/ar9003_phy.c delete mode 100644 drivers/net/wireless/ath/ath9k/ar9003_phy.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9003_rtt.c delete mode 100644 drivers/net/wireless/ath/ath9k/ar9003_rtt.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9340_initvals.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9485_initvals.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar955x_1p0_initvals.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9565_1p0_initvals.h delete mode 100644 drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h delete mode 100644 drivers/net/wireless/ath/ath9k/ath9k.h delete mode 100644 drivers/net/wireless/ath/ath9k/beacon.c delete mode 100644 drivers/net/wireless/ath/ath9k/btcoex.c delete mode 100644 drivers/net/wireless/ath/ath9k/btcoex.h delete mode 100644 drivers/net/wireless/ath/ath9k/calib.c delete mode 100644 drivers/net/wireless/ath/ath9k/calib.h delete mode 100644 drivers/net/wireless/ath/ath9k/common.c delete mode 100644 drivers/net/wireless/ath/ath9k/common.h delete mode 100644 drivers/net/wireless/ath/ath9k/debug.c delete mode 100644 drivers/net/wireless/ath/ath9k/debug.h delete mode 100644 drivers/net/wireless/ath/ath9k/dfs.c delete mode 100644 drivers/net/wireless/ath/ath9k/dfs.h delete mode 100644 drivers/net/wireless/ath/ath9k/dfs_debug.c delete mode 100644 drivers/net/wireless/ath/ath9k/dfs_debug.h delete mode 100644 drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c delete mode 100644 drivers/net/wireless/ath/ath9k/dfs_pattern_detector.h delete mode 100644 drivers/net/wireless/ath/ath9k/dfs_pri_detector.c delete mode 100644 drivers/net/wireless/ath/ath9k/dfs_pri_detector.h delete mode 100644 drivers/net/wireless/ath/ath9k/eeprom.c delete mode 100644 drivers/net/wireless/ath/ath9k/eeprom.h delete mode 100644 drivers/net/wireless/ath/ath9k/eeprom_4k.c delete mode 100644 drivers/net/wireless/ath/ath9k/eeprom_9287.c delete mode 100644 drivers/net/wireless/ath/ath9k/eeprom_def.c delete mode 100644 drivers/net/wireless/ath/ath9k/gpio.c delete mode 100644 drivers/net/wireless/ath/ath9k/hif_usb.c delete mode 100644 drivers/net/wireless/ath/ath9k/hif_usb.h delete mode 100644 drivers/net/wireless/ath/ath9k/htc.h delete mode 100644 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c delete mode 100644 drivers/net/wireless/ath/ath9k/htc_drv_debug.c delete mode 100644 drivers/net/wireless/ath/ath9k/htc_drv_gpio.c delete mode 100644 drivers/net/wireless/ath/ath9k/htc_drv_init.c delete mode 100644 drivers/net/wireless/ath/ath9k/htc_drv_main.c delete mode 100644 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c delete mode 100644 drivers/net/wireless/ath/ath9k/htc_hst.c delete mode 100644 drivers/net/wireless/ath/ath9k/htc_hst.h delete mode 100644 drivers/net/wireless/ath/ath9k/hw-ops.h delete mode 100644 drivers/net/wireless/ath/ath9k/hw.c delete mode 100644 drivers/net/wireless/ath/ath9k/hw.h delete mode 100644 drivers/net/wireless/ath/ath9k/init.c delete mode 100644 drivers/net/wireless/ath/ath9k/link.c delete mode 100644 drivers/net/wireless/ath/ath9k/mac.c delete mode 100644 drivers/net/wireless/ath/ath9k/mac.h delete mode 100644 drivers/net/wireless/ath/ath9k/main.c delete mode 100644 drivers/net/wireless/ath/ath9k/mci.c delete mode 100644 drivers/net/wireless/ath/ath9k/mci.h delete mode 100644 drivers/net/wireless/ath/ath9k/pci.c delete mode 100644 drivers/net/wireless/ath/ath9k/phy.h delete mode 100644 drivers/net/wireless/ath/ath9k/rc.c delete mode 100644 drivers/net/wireless/ath/ath9k/rc.h delete mode 100644 drivers/net/wireless/ath/ath9k/recv.c delete mode 100644 drivers/net/wireless/ath/ath9k/reg.h delete mode 100644 drivers/net/wireless/ath/ath9k/wmi.c delete mode 100644 drivers/net/wireless/ath/ath9k/wmi.h delete mode 100644 drivers/net/wireless/ath/ath9k/wow.c delete mode 100644 drivers/net/wireless/ath/ath9k/xmit.c delete mode 100644 drivers/net/wireless/ath/carl9170/Kconfig delete mode 100644 drivers/net/wireless/ath/carl9170/Makefile delete mode 100644 drivers/net/wireless/ath/carl9170/carl9170.h delete mode 100644 drivers/net/wireless/ath/carl9170/cmd.c delete mode 100644 drivers/net/wireless/ath/carl9170/cmd.h delete mode 100644 drivers/net/wireless/ath/carl9170/debug.c delete mode 100644 drivers/net/wireless/ath/carl9170/debug.h delete mode 100644 drivers/net/wireless/ath/carl9170/eeprom.h delete mode 100644 drivers/net/wireless/ath/carl9170/fw.c delete mode 100644 drivers/net/wireless/ath/carl9170/fwcmd.h delete mode 100644 drivers/net/wireless/ath/carl9170/fwdesc.h delete mode 100644 drivers/net/wireless/ath/carl9170/hw.h delete mode 100644 drivers/net/wireless/ath/carl9170/led.c delete mode 100644 drivers/net/wireless/ath/carl9170/mac.c delete mode 100644 drivers/net/wireless/ath/carl9170/main.c delete mode 100644 drivers/net/wireless/ath/carl9170/phy.c delete mode 100644 drivers/net/wireless/ath/carl9170/phy.h delete mode 100644 drivers/net/wireless/ath/carl9170/rx.c delete mode 100644 drivers/net/wireless/ath/carl9170/tx.c delete mode 100644 drivers/net/wireless/ath/carl9170/usb.c delete mode 100644 drivers/net/wireless/ath/carl9170/version.h delete mode 100644 drivers/net/wireless/ath/carl9170/wlan.h delete mode 100644 drivers/net/wireless/ath/debug.c delete mode 100644 drivers/net/wireless/ath/hw.c delete mode 100644 drivers/net/wireless/ath/key.c delete mode 100644 drivers/net/wireless/ath/main.c delete mode 100644 drivers/net/wireless/ath/reg.h delete mode 100644 drivers/net/wireless/ath/regd.c delete mode 100644 drivers/net/wireless/ath/regd.h delete mode 100644 drivers/net/wireless/ath/regd_common.h delete mode 100644 drivers/net/wireless/ath/wil6210/Kconfig delete mode 100644 drivers/net/wireless/ath/wil6210/Makefile delete mode 100644 drivers/net/wireless/ath/wil6210/cfg80211.c delete mode 100644 drivers/net/wireless/ath/wil6210/debugfs.c delete mode 100644 drivers/net/wireless/ath/wil6210/interrupt.c delete mode 100644 drivers/net/wireless/ath/wil6210/main.c delete mode 100644 drivers/net/wireless/ath/wil6210/netdev.c delete mode 100644 drivers/net/wireless/ath/wil6210/pcie_bus.c delete mode 100644 drivers/net/wireless/ath/wil6210/txrx.c delete mode 100644 drivers/net/wireless/ath/wil6210/txrx.h delete mode 100644 drivers/net/wireless/ath/wil6210/wil6210.h delete mode 100644 drivers/net/wireless/ath/wil6210/wmi.c delete mode 100644 drivers/net/wireless/ath/wil6210/wmi.h delete mode 100644 drivers/net/wireless/atmel.c delete mode 100644 drivers/net/wireless/atmel.h delete mode 100644 drivers/net/wireless/atmel_cs.c delete mode 100644 drivers/net/wireless/atmel_pci.c delete mode 100644 drivers/net/wireless/b43/Kconfig delete mode 100644 drivers/net/wireless/b43/Makefile delete mode 100644 drivers/net/wireless/b43/b43.h delete mode 100644 drivers/net/wireless/b43/bus.c delete mode 100644 drivers/net/wireless/b43/bus.h delete mode 100644 drivers/net/wireless/b43/debugfs.c delete mode 100644 drivers/net/wireless/b43/debugfs.h delete mode 100644 drivers/net/wireless/b43/dma.c delete mode 100644 drivers/net/wireless/b43/dma.h delete mode 100644 drivers/net/wireless/b43/leds.c delete mode 100644 drivers/net/wireless/b43/leds.h delete mode 100644 drivers/net/wireless/b43/lo.c delete mode 100644 drivers/net/wireless/b43/lo.h delete mode 100644 drivers/net/wireless/b43/main.c delete mode 100644 drivers/net/wireless/b43/main.h delete mode 100644 drivers/net/wireless/b43/pcmcia.c delete mode 100644 drivers/net/wireless/b43/pcmcia.h delete mode 100644 drivers/net/wireless/b43/phy_a.c delete mode 100644 drivers/net/wireless/b43/phy_a.h delete mode 100644 drivers/net/wireless/b43/phy_common.c delete mode 100644 drivers/net/wireless/b43/phy_common.h delete mode 100644 drivers/net/wireless/b43/phy_g.c delete mode 100644 drivers/net/wireless/b43/phy_g.h delete mode 100644 drivers/net/wireless/b43/phy_ht.c delete mode 100644 drivers/net/wireless/b43/phy_ht.h delete mode 100644 drivers/net/wireless/b43/phy_lcn.c delete mode 100644 drivers/net/wireless/b43/phy_lcn.h delete mode 100644 drivers/net/wireless/b43/phy_lp.c delete mode 100644 drivers/net/wireless/b43/phy_lp.h delete mode 100644 drivers/net/wireless/b43/phy_n.c delete mode 100644 drivers/net/wireless/b43/phy_n.h delete mode 100644 drivers/net/wireless/b43/pio.c delete mode 100644 drivers/net/wireless/b43/pio.h delete mode 100644 drivers/net/wireless/b43/radio_2055.c delete mode 100644 drivers/net/wireless/b43/radio_2055.h delete mode 100644 drivers/net/wireless/b43/radio_2056.c delete mode 100644 drivers/net/wireless/b43/radio_2056.h delete mode 100644 drivers/net/wireless/b43/radio_2057.c delete mode 100644 drivers/net/wireless/b43/radio_2057.h delete mode 100644 drivers/net/wireless/b43/radio_2059.c delete mode 100644 drivers/net/wireless/b43/radio_2059.h delete mode 100644 drivers/net/wireless/b43/rfkill.c delete mode 100644 drivers/net/wireless/b43/rfkill.h delete mode 100644 drivers/net/wireless/b43/sdio.c delete mode 100644 drivers/net/wireless/b43/sdio.h delete mode 100644 drivers/net/wireless/b43/sysfs.c delete mode 100644 drivers/net/wireless/b43/sysfs.h delete mode 100644 drivers/net/wireless/b43/tables.c delete mode 100644 drivers/net/wireless/b43/tables.h delete mode 100644 drivers/net/wireless/b43/tables_lpphy.c delete mode 100644 drivers/net/wireless/b43/tables_lpphy.h delete mode 100644 drivers/net/wireless/b43/tables_nphy.c delete mode 100644 drivers/net/wireless/b43/tables_nphy.h delete mode 100644 drivers/net/wireless/b43/tables_phy_ht.c delete mode 100644 drivers/net/wireless/b43/tables_phy_ht.h delete mode 100644 drivers/net/wireless/b43/tables_phy_lcn.c delete mode 100644 drivers/net/wireless/b43/tables_phy_lcn.h delete mode 100644 drivers/net/wireless/b43/wa.c delete mode 100644 drivers/net/wireless/b43/wa.h delete mode 100644 drivers/net/wireless/b43/xmit.c delete mode 100644 drivers/net/wireless/b43/xmit.h delete mode 100644 drivers/net/wireless/b43legacy/Kconfig delete mode 100644 drivers/net/wireless/b43legacy/Makefile delete mode 100644 drivers/net/wireless/b43legacy/b43legacy.h delete mode 100644 drivers/net/wireless/b43legacy/debugfs.c delete mode 100644 drivers/net/wireless/b43legacy/debugfs.h delete mode 100644 drivers/net/wireless/b43legacy/dma.c delete mode 100644 drivers/net/wireless/b43legacy/dma.h delete mode 100644 drivers/net/wireless/b43legacy/ilt.c delete mode 100644 drivers/net/wireless/b43legacy/ilt.h delete mode 100644 drivers/net/wireless/b43legacy/leds.c delete mode 100644 drivers/net/wireless/b43legacy/leds.h delete mode 100644 drivers/net/wireless/b43legacy/main.c delete mode 100644 drivers/net/wireless/b43legacy/main.h delete mode 100644 drivers/net/wireless/b43legacy/phy.c delete mode 100644 drivers/net/wireless/b43legacy/phy.h delete mode 100644 drivers/net/wireless/b43legacy/pio.c delete mode 100644 drivers/net/wireless/b43legacy/pio.h delete mode 100644 drivers/net/wireless/b43legacy/radio.c delete mode 100644 drivers/net/wireless/b43legacy/radio.h delete mode 100644 drivers/net/wireless/b43legacy/rfkill.c delete mode 100644 drivers/net/wireless/b43legacy/rfkill.h delete mode 100644 drivers/net/wireless/b43legacy/sysfs.c delete mode 100644 drivers/net/wireless/b43legacy/sysfs.h delete mode 100644 drivers/net/wireless/b43legacy/xmit.c delete mode 100644 drivers/net/wireless/b43legacy/xmit.h delete mode 100644 drivers/net/wireless/bcm4319/Makefile delete mode 100644 drivers/net/wireless/bcm4319/aiutils.c delete mode 100644 drivers/net/wireless/bcm4319/bcmpcispi.c delete mode 100644 drivers/net/wireless/bcm4319/bcmsdh.c delete mode 100644 drivers/net/wireless/bcm4319/bcmsdh_linux.c delete mode 100644 drivers/net/wireless/bcm4319/bcmsdh_sdmmc.c delete mode 100644 drivers/net/wireless/bcm4319/bcmsdh_sdmmc_linux.c delete mode 100644 drivers/net/wireless/bcm4319/bcmsdspi.c delete mode 100644 drivers/net/wireless/bcm4319/bcmsdspi_linux.c delete mode 100644 drivers/net/wireless/bcm4319/bcmsdstd.c delete mode 100644 drivers/net/wireless/bcm4319/bcmsdstd_linux.c delete mode 100644 drivers/net/wireless/bcm4319/bcmspibrcm.c delete mode 100644 drivers/net/wireless/bcm4319/bcmutils.c delete mode 100644 drivers/net/wireless/bcm4319/bcmwifi.c delete mode 100644 drivers/net/wireless/bcm4319/dhd.h delete mode 100644 drivers/net/wireless/bcm4319/dhd_bus.h delete mode 100644 drivers/net/wireless/bcm4319/dhd_cdc.c delete mode 100644 drivers/net/wireless/bcm4319/dhd_common.c delete mode 100644 drivers/net/wireless/bcm4319/dhd_custom_gpio.c delete mode 100644 drivers/net/wireless/bcm4319/dhd_dbg.h delete mode 100644 drivers/net/wireless/bcm4319/dhd_linux.c delete mode 100644 drivers/net/wireless/bcm4319/dhd_linux_sched.c delete mode 100644 drivers/net/wireless/bcm4319/dhd_proto.h delete mode 100644 drivers/net/wireless/bcm4319/dhd_sdio.c delete mode 100644 drivers/net/wireless/bcm4319/dngl_stats.h delete mode 100644 drivers/net/wireless/bcm4319/hndpmu.c delete mode 100644 drivers/net/wireless/bcm4319/include/Makefile delete mode 100644 drivers/net/wireless/bcm4319/include/aidmp.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmcdc.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmdefs.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmdevs.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmendian.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmpcispi.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmperf.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmsdbus.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmsdh.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmsdh_sdmmc.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmsdpcm.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmsdspi.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmsdstd.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmspi.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmspibrcm.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmutils.h delete mode 100644 drivers/net/wireless/bcm4319/include/bcmwifi.h delete mode 100644 drivers/net/wireless/bcm4319/include/dhdioctl.h delete mode 100644 drivers/net/wireless/bcm4319/include/epivers.h delete mode 100644 drivers/net/wireless/bcm4319/include/hndpmu.h delete mode 100644 drivers/net/wireless/bcm4319/include/hndrte_armtrap.h delete mode 100644 drivers/net/wireless/bcm4319/include/hndrte_cons.h delete mode 100644 drivers/net/wireless/bcm4319/include/hndsoc.h delete mode 100644 drivers/net/wireless/bcm4319/include/linux_osl.h delete mode 100644 drivers/net/wireless/bcm4319/include/linuxver.h delete mode 100644 drivers/net/wireless/bcm4319/include/miniopt.h delete mode 100644 drivers/net/wireless/bcm4319/include/msgtrace.h delete mode 100644 drivers/net/wireless/bcm4319/include/osl.h delete mode 100644 drivers/net/wireless/bcm4319/include/packed_section_end.h delete mode 100644 drivers/net/wireless/bcm4319/include/packed_section_start.h delete mode 100644 drivers/net/wireless/bcm4319/include/pcicfg.h delete mode 100644 drivers/net/wireless/bcm4319/include/proto/802.11.h delete mode 100644 drivers/net/wireless/bcm4319/include/proto/802.11e.h delete mode 100644 drivers/net/wireless/bcm4319/include/proto/802.1d.h delete mode 100644 drivers/net/wireless/bcm4319/include/proto/bcmeth.h delete mode 100644 drivers/net/wireless/bcm4319/include/proto/bcmevent.h delete mode 100644 drivers/net/wireless/bcm4319/include/proto/bcmip.h delete mode 100644 drivers/net/wireless/bcm4319/include/proto/eapol.h delete mode 100644 drivers/net/wireless/bcm4319/include/proto/ethernet.h delete mode 100644 drivers/net/wireless/bcm4319/include/proto/sdspi.h delete mode 100644 drivers/net/wireless/bcm4319/include/proto/vlan.h delete mode 100644 drivers/net/wireless/bcm4319/include/proto/wpa.h delete mode 100644 drivers/net/wireless/bcm4319/include/sbchipc.h delete mode 100644 drivers/net/wireless/bcm4319/include/sbconfig.h delete mode 100644 drivers/net/wireless/bcm4319/include/sbhnddma.h delete mode 100644 drivers/net/wireless/bcm4319/include/sbpcmcia.h delete mode 100644 drivers/net/wireless/bcm4319/include/sbsdio.h delete mode 100644 drivers/net/wireless/bcm4319/include/sbsdpcmdev.h delete mode 100644 drivers/net/wireless/bcm4319/include/sbsocram.h delete mode 100644 drivers/net/wireless/bcm4319/include/sdio.h delete mode 100644 drivers/net/wireless/bcm4319/include/sdioh.h delete mode 100644 drivers/net/wireless/bcm4319/include/sdiovar.h delete mode 100644 drivers/net/wireless/bcm4319/include/siutils.h delete mode 100644 drivers/net/wireless/bcm4319/include/spid.h delete mode 100644 drivers/net/wireless/bcm4319/include/trxhdr.h delete mode 100644 drivers/net/wireless/bcm4319/include/typedefs.h delete mode 100644 drivers/net/wireless/bcm4319/include/wifi_version.h delete mode 100644 drivers/net/wireless/bcm4319/include/wlioctl.h delete mode 100644 drivers/net/wireless/bcm4319/linux_osl.c delete mode 100644 drivers/net/wireless/bcm4319/miniopt.c delete mode 100644 drivers/net/wireless/bcm4319/sbutils.c delete mode 100644 drivers/net/wireless/bcm4319/siutils.c delete mode 100644 drivers/net/wireless/bcm4319/siutils_priv.h delete mode 100644 drivers/net/wireless/bcm4319/wl_cfg80211.c delete mode 100644 drivers/net/wireless/bcm4319/wl_cfg80211.h delete mode 100644 drivers/net/wireless/bcm4319/wl_iw.c delete mode 100644 drivers/net/wireless/bcm4319/wl_iw.h delete mode 100644 drivers/net/wireless/bcm4329/bcmspibrcm.c delete mode 100644 drivers/net/wireless/bcm4329/include/bcmspibrcm.h delete mode 100644 drivers/net/wireless/bcm4329/include/spid.h delete mode 100644 drivers/net/wireless/bcm4329/include/wifi_version.h delete mode 100644 drivers/net/wireless/bcm4329/wl_cfg80211.c delete mode 100644 drivers/net/wireless/bcm4329/wl_cfg80211.h delete mode 100644 drivers/net/wireless/brcm80211/Kconfig delete mode 100644 drivers/net/wireless/brcm80211/Makefile delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/Makefile delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/btcoex.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/btcoex.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/dhd.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/dhd_proto.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/fweh.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/fweh.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/fwil.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/fwil.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/p2p.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/p2p.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/tracepoint.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/tracepoint.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/usb.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/usb.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/usb_rdl.h delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/Makefile delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/aiutils.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/aiutils.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/ampdu.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/ampdu.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/antsel.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/antsel.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_events.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_events.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/channel.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/channel.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/d11.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/debug.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/debug.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/dma.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/dma.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/led.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/led.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/main.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/main.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy/phy_hal.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy/phy_qmath.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy/phy_qmath.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy/phy_radio.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy/phyreg_n.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_n.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_n.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy_shim.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/phy_shim.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/pmu.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/pmu.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/pub.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/rate.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/rate.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/scb.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/stf.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/stf.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/types.h delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/ucode_loader.c delete mode 100644 drivers/net/wireless/brcm80211/brcmsmac/ucode_loader.h delete mode 100644 drivers/net/wireless/brcm80211/brcmutil/Makefile delete mode 100644 drivers/net/wireless/brcm80211/brcmutil/d11.c delete mode 100644 drivers/net/wireless/brcm80211/brcmutil/utils.c delete mode 100644 drivers/net/wireless/brcm80211/include/brcm_hw_ids.h delete mode 100644 drivers/net/wireless/brcm80211/include/brcmu_d11.h delete mode 100644 drivers/net/wireless/brcm80211/include/brcmu_utils.h delete mode 100644 drivers/net/wireless/brcm80211/include/brcmu_wifi.h delete mode 100644 drivers/net/wireless/brcm80211/include/chipcommon.h delete mode 100644 drivers/net/wireless/brcm80211/include/defs.h delete mode 100644 drivers/net/wireless/brcm80211/include/soc.h delete mode 100755 drivers/net/wireless/esp8089/Kconfig delete mode 100644 drivers/net/wireless/hostap/Kconfig delete mode 100644 drivers/net/wireless/hostap/Makefile delete mode 100644 drivers/net/wireless/hostap/hostap.h delete mode 100644 drivers/net/wireless/hostap/hostap_80211.h delete mode 100644 drivers/net/wireless/hostap/hostap_80211_rx.c delete mode 100644 drivers/net/wireless/hostap/hostap_80211_tx.c delete mode 100644 drivers/net/wireless/hostap/hostap_ap.c delete mode 100644 drivers/net/wireless/hostap/hostap_ap.h delete mode 100644 drivers/net/wireless/hostap/hostap_common.h delete mode 100644 drivers/net/wireless/hostap/hostap_config.h delete mode 100644 drivers/net/wireless/hostap/hostap_cs.c delete mode 100644 drivers/net/wireless/hostap/hostap_download.c delete mode 100644 drivers/net/wireless/hostap/hostap_hw.c delete mode 100644 drivers/net/wireless/hostap/hostap_info.c delete mode 100644 drivers/net/wireless/hostap/hostap_ioctl.c delete mode 100644 drivers/net/wireless/hostap/hostap_main.c delete mode 100644 drivers/net/wireless/hostap/hostap_pci.c delete mode 100644 drivers/net/wireless/hostap/hostap_plx.c delete mode 100644 drivers/net/wireless/hostap/hostap_proc.c delete mode 100644 drivers/net/wireless/hostap/hostap_wlan.h delete mode 100644 drivers/net/wireless/ipw2x00/Kconfig delete mode 100644 drivers/net/wireless/ipw2x00/Makefile delete mode 100644 drivers/net/wireless/ipw2x00/ipw.h delete mode 100644 drivers/net/wireless/ipw2x00/ipw2100.c delete mode 100644 drivers/net/wireless/ipw2x00/ipw2100.h delete mode 100644 drivers/net/wireless/ipw2x00/ipw2200.c delete mode 100644 drivers/net/wireless/ipw2x00/ipw2200.h delete mode 100644 drivers/net/wireless/ipw2x00/libipw.h delete mode 100644 drivers/net/wireless/ipw2x00/libipw_geo.c delete mode 100644 drivers/net/wireless/ipw2x00/libipw_module.c delete mode 100644 drivers/net/wireless/ipw2x00/libipw_rx.c delete mode 100644 drivers/net/wireless/ipw2x00/libipw_tx.c delete mode 100644 drivers/net/wireless/ipw2x00/libipw_wx.c delete mode 100644 drivers/net/wireless/iwlegacy/3945-debug.c delete mode 100644 drivers/net/wireless/iwlegacy/3945-mac.c delete mode 100644 drivers/net/wireless/iwlegacy/3945-rs.c delete mode 100644 drivers/net/wireless/iwlegacy/3945.c delete mode 100644 drivers/net/wireless/iwlegacy/3945.h delete mode 100644 drivers/net/wireless/iwlegacy/4965-calib.c delete mode 100644 drivers/net/wireless/iwlegacy/4965-debug.c delete mode 100644 drivers/net/wireless/iwlegacy/4965-mac.c delete mode 100644 drivers/net/wireless/iwlegacy/4965-rs.c delete mode 100644 drivers/net/wireless/iwlegacy/4965.c delete mode 100644 drivers/net/wireless/iwlegacy/4965.h delete mode 100644 drivers/net/wireless/iwlegacy/Kconfig delete mode 100644 drivers/net/wireless/iwlegacy/Makefile delete mode 100644 drivers/net/wireless/iwlegacy/commands.h delete mode 100644 drivers/net/wireless/iwlegacy/common.c delete mode 100644 drivers/net/wireless/iwlegacy/common.h delete mode 100644 drivers/net/wireless/iwlegacy/csr.h delete mode 100644 drivers/net/wireless/iwlegacy/debug.c delete mode 100644 drivers/net/wireless/iwlegacy/iwl-spectrum.h delete mode 100644 drivers/net/wireless/iwlegacy/prph.h delete mode 100644 drivers/net/wireless/iwlwifi/Kconfig delete mode 100644 drivers/net/wireless/iwlwifi/Makefile delete mode 100644 drivers/net/wireless/iwlwifi/dvm/Makefile delete mode 100644 drivers/net/wireless/iwlwifi/dvm/agn.h delete mode 100644 drivers/net/wireless/iwlwifi/dvm/calib.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/calib.h delete mode 100644 drivers/net/wireless/iwlwifi/dvm/commands.h delete mode 100644 drivers/net/wireless/iwlwifi/dvm/debugfs.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/dev.h delete mode 100644 drivers/net/wireless/iwlwifi/dvm/devices.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/led.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/led.h delete mode 100644 drivers/net/wireless/iwlwifi/dvm/lib.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/mac80211.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/main.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/power.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/power.h delete mode 100644 drivers/net/wireless/iwlwifi/dvm/rs.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/rs.h delete mode 100644 drivers/net/wireless/iwlwifi/dvm/rx.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/rxon.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/scan.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/sta.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/testmode.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/tt.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/tt.h delete mode 100644 drivers/net/wireless/iwlwifi/dvm/tx.c delete mode 100644 drivers/net/wireless/iwlwifi/dvm/ucode.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-1000.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-2000.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-5000.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-6000.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-7000.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-agn-hw.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-config.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-csr.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-debug.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-debug.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-devtrace.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-devtrace.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-drv.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-drv.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-eeprom-read.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-eeprom-read.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-fh.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-fw-file.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-fw.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-io.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-io.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-modparams.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-notif-wait.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-notif-wait.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-nvm-parse.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-nvm-parse.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-op-mode.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-phy-db.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-phy-db.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-prph.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-test.c delete mode 100644 drivers/net/wireless/iwlwifi/iwl-test.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-testmode.h delete mode 100644 drivers/net/wireless/iwlwifi/iwl-trans.h delete mode 100644 drivers/net/wireless/iwlwifi/mvm/Makefile delete mode 100644 drivers/net/wireless/iwlwifi/mvm/binding.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/bt-coex.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/d3.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/debugfs.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/fw-api-bt-coex.h delete mode 100644 drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h delete mode 100644 drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h delete mode 100644 drivers/net/wireless/iwlwifi/mvm/fw-api-power.h delete mode 100644 drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h delete mode 100644 drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h delete mode 100644 drivers/net/wireless/iwlwifi/mvm/fw-api-sta.h delete mode 100644 drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h delete mode 100644 drivers/net/wireless/iwlwifi/mvm/fw-api.h delete mode 100644 drivers/net/wireless/iwlwifi/mvm/fw.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/led.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/mac80211.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/mvm.h delete mode 100644 drivers/net/wireless/iwlwifi/mvm/nvm.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/ops.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/power.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/quota.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/rs.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/rs.h delete mode 100644 drivers/net/wireless/iwlwifi/mvm/rx.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/scan.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/sta.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/sta.h delete mode 100644 drivers/net/wireless/iwlwifi/mvm/time-event.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/time-event.h delete mode 100644 drivers/net/wireless/iwlwifi/mvm/tx.c delete mode 100644 drivers/net/wireless/iwlwifi/mvm/utils.c delete mode 100644 drivers/net/wireless/iwlwifi/pcie/drv.c delete mode 100644 drivers/net/wireless/iwlwifi/pcie/internal.h delete mode 100644 drivers/net/wireless/iwlwifi/pcie/rx.c delete mode 100644 drivers/net/wireless/iwlwifi/pcie/trans.c delete mode 100644 drivers/net/wireless/iwlwifi/pcie/tx.c delete mode 100644 drivers/net/wireless/libertas/Kconfig delete mode 100644 drivers/net/wireless/libertas/LICENSE delete mode 100644 drivers/net/wireless/libertas/Makefile delete mode 100644 drivers/net/wireless/libertas/README delete mode 100644 drivers/net/wireless/libertas/cfg.c delete mode 100644 drivers/net/wireless/libertas/cfg.h delete mode 100644 drivers/net/wireless/libertas/cmd.c delete mode 100644 drivers/net/wireless/libertas/cmd.h delete mode 100644 drivers/net/wireless/libertas/cmdresp.c delete mode 100644 drivers/net/wireless/libertas/debugfs.c delete mode 100644 drivers/net/wireless/libertas/debugfs.h delete mode 100644 drivers/net/wireless/libertas/decl.h delete mode 100644 drivers/net/wireless/libertas/defs.h delete mode 100644 drivers/net/wireless/libertas/dev.h delete mode 100644 drivers/net/wireless/libertas/ethtool.c delete mode 100644 drivers/net/wireless/libertas/firmware.c delete mode 100644 drivers/net/wireless/libertas/host.h delete mode 100644 drivers/net/wireless/libertas/if_cs.c delete mode 100644 drivers/net/wireless/libertas/if_sdio.c delete mode 100644 drivers/net/wireless/libertas/if_sdio.h delete mode 100644 drivers/net/wireless/libertas/if_spi.c delete mode 100644 drivers/net/wireless/libertas/if_spi.h delete mode 100644 drivers/net/wireless/libertas/if_usb.c delete mode 100644 drivers/net/wireless/libertas/if_usb.h delete mode 100644 drivers/net/wireless/libertas/main.c delete mode 100644 drivers/net/wireless/libertas/mesh.c delete mode 100644 drivers/net/wireless/libertas/mesh.h delete mode 100644 drivers/net/wireless/libertas/radiotap.h delete mode 100644 drivers/net/wireless/libertas/rx.c delete mode 100644 drivers/net/wireless/libertas/tx.c delete mode 100644 drivers/net/wireless/libertas/types.h delete mode 100644 drivers/net/wireless/libertas_tf/Makefile delete mode 100644 drivers/net/wireless/libertas_tf/cmd.c delete mode 100644 drivers/net/wireless/libertas_tf/deb_defs.h delete mode 100644 drivers/net/wireless/libertas_tf/if_usb.c delete mode 100644 drivers/net/wireless/libertas_tf/if_usb.h delete mode 100644 drivers/net/wireless/libertas_tf/libertas_tf.h delete mode 100644 drivers/net/wireless/libertas_tf/main.c delete mode 100644 drivers/net/wireless/mac80211_hwsim.c delete mode 100644 drivers/net/wireless/mac80211_hwsim.h delete mode 100755 drivers/net/wireless/mt5931/Kconfig delete mode 100755 drivers/net/wireless/mt5931/Makefile delete mode 100755 drivers/net/wireless/mt5931/Makefile.module delete mode 100755 drivers/net/wireless/mt5931/common/dump.c delete mode 100755 drivers/net/wireless/mt5931/common/wlan_bow.c delete mode 100755 drivers/net/wireless/mt5931/common/wlan_lib.c delete mode 100755 drivers/net/wireless/mt5931/common/wlan_oid.c delete mode 100755 drivers/net/wireless/mt5931/common/wlan_p2p.c delete mode 100755 drivers/net/wireless/mt5931/firmware_5931/WIFI_RAM_CODE delete mode 100755 drivers/net/wireless/mt5931/include/CFG_Wifi_File.h delete mode 100755 drivers/net/wireless/mt5931/include/config.h delete mode 100755 drivers/net/wireless/mt5931/include/debug.h delete mode 100755 drivers/net/wireless/mt5931/include/link.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/aa_fsm.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/ais_fsm.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/assoc.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/auth.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/bow_fsm.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/bss.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/cnm.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/cnm_mem.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/cnm_scan.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/cnm_timer.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/hem_mbox.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/mib.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/p2p_assoc.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/p2p_bss.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/p2p_fsm.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/p2p_func.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/p2p_ie.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/p2p_rlm.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/p2p_rlm_obss.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/p2p_scan.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/p2p_state.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/privacy.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/rate.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/rlm.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/rlm_domain.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/rlm_obss.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/rlm_protection.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/roaming_fsm.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/rsn.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/scan.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/sec_fsm.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/swcr.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/wapi.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/wlan_typedef.h delete mode 100755 drivers/net/wireless/mt5931/include/mgmt/wnm.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/adapter.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/bow.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/cmd_buf.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/hal.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/hif_rx.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/hif_tx.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/mac.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/mt5931_reg.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/mt6620_reg.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/nic.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/nic_rx.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/nic_tx.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/p2p.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/p2p_cmd_buf.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/p2p_mac.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/p2p_nic.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/p2p_nic_cmd_event.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/que_mgt.h delete mode 100755 drivers/net/wireless/mt5931/include/nic/wlan_def.h delete mode 100755 drivers/net/wireless/mt5931/include/nic_cmd_event.h delete mode 100755 drivers/net/wireless/mt5931/include/nic_init_cmd_event.h delete mode 100755 drivers/net/wireless/mt5931/include/p2p_precomp.h delete mode 100755 drivers/net/wireless/mt5931/include/p2p_typedef.h delete mode 100755 drivers/net/wireless/mt5931/include/precomp.h delete mode 100755 drivers/net/wireless/mt5931/include/pwr_mgt.h delete mode 100755 drivers/net/wireless/mt5931/include/queue.h delete mode 100755 drivers/net/wireless/mt5931/include/rftest.h delete mode 100755 drivers/net/wireless/mt5931/include/typedef.h delete mode 100755 drivers/net/wireless/mt5931/include/wlan_bow.h delete mode 100755 drivers/net/wireless/mt5931/include/wlan_lib.h delete mode 100755 drivers/net/wireless/mt5931/include/wlan_oid.h delete mode 100755 drivers/net/wireless/mt5931/include/wlan_p2p.h delete mode 100755 drivers/net/wireless/mt5931/mgmt/aaa_fsm.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/ais_fsm.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/assoc.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/auth.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/bss.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/cnm.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/cnm_mem.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/cnm_timer.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/hem_mbox.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/mib.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/p2p_assoc.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/p2p_bss.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/p2p_fsm.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/p2p_func.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/p2p_ie.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/p2p_rlm.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/p2p_rlm_obss.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/p2p_scan.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/p2p_state.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/privacy.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/rate.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/rlm.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/rlm_domain.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/rlm_obss.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/rlm_protection.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/roaming_fsm.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/rsn.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/saa_fsm.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/scan.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/scan_fsm.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/sec_fsm.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/swcr.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/wapi.c delete mode 100755 drivers/net/wireless/mt5931/mgmt/wnm.c delete mode 100755 drivers/net/wireless/mt5931/nic/cmd_buf.c delete mode 100755 drivers/net/wireless/mt5931/nic/nic.c delete mode 100755 drivers/net/wireless/mt5931/nic/nic_cmd_event.c delete mode 100755 drivers/net/wireless/mt5931/nic/nic_pwr_mgt.c delete mode 100755 drivers/net/wireless/mt5931/nic/nic_rx.c delete mode 100755 drivers/net/wireless/mt5931/nic/nic_tx.c delete mode 100755 drivers/net/wireless/mt5931/nic/p2p_nic.c delete mode 100755 drivers/net/wireless/mt5931/nic/que_mgt.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/gl_bow.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/gl_cfg80211.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/gl_init.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/gl_kal.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/gl_p2p.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/gl_p2p_cfg80211.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/gl_p2p_init.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/gl_p2p_kal.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/gl_proc.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/gl_rst.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/gl_wext.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/gl_wext_priv.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/hif/sdio/arm.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/hif/sdio/include/hif.h delete mode 100755 drivers/net/wireless/mt5931/os/linux/hif/sdio/include/hif_sdio.h delete mode 100755 drivers/net/wireless/mt5931/os/linux/hif/sdio/include/mtk_porting.h delete mode 100755 drivers/net/wireless/mt5931/os/linux/hif/sdio/sdio.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/hif/sdio/x86.c delete mode 100755 drivers/net/wireless/mt5931/os/linux/include/gl_cfg80211.h delete mode 100755 drivers/net/wireless/mt5931/os/linux/include/gl_kal.h delete mode 100755 drivers/net/wireless/mt5931/os/linux/include/gl_os.h delete mode 100755 drivers/net/wireless/mt5931/os/linux/include/gl_p2p_ioctl.h delete mode 100755 drivers/net/wireless/mt5931/os/linux/include/gl_p2p_kal.h delete mode 100755 drivers/net/wireless/mt5931/os/linux/include/gl_p2p_os.h delete mode 100755 drivers/net/wireless/mt5931/os/linux/include/gl_rst.h delete mode 100755 drivers/net/wireless/mt5931/os/linux/include/gl_sec.h delete mode 100755 drivers/net/wireless/mt5931/os/linux/include/gl_typedef.h delete mode 100755 drivers/net/wireless/mt5931/os/linux/include/gl_wext.h delete mode 100755 drivers/net/wireless/mt5931/os/linux/include/gl_wext_priv.h delete mode 100755 drivers/net/wireless/mt5931/os/linux/platform.c delete mode 100755 drivers/net/wireless/mt5931/os/version.h delete mode 100755 drivers/net/wireless/mt5931/os/wifi_version.h delete mode 100755 drivers/net/wireless/mv8686/11d.c delete mode 100755 drivers/net/wireless/mv8686/11d.h delete mode 100755 drivers/net/wireless/mv8686/ChangeLog.txt delete mode 100755 drivers/net/wireless/mv8686/Makefile delete mode 100755 drivers/net/wireless/mv8686/Makefile.kernel delete mode 100755 drivers/net/wireless/mv8686/Makefile.module delete mode 100755 drivers/net/wireless/mv8686/Makefile.mv8686 delete mode 100755 drivers/net/wireless/mv8686/ReleaseNotes.txt delete mode 100755 drivers/net/wireless/mv8686/assoc.c delete mode 100755 drivers/net/wireless/mv8686/assoc.h delete mode 100755 drivers/net/wireless/mv8686/cmd.c delete mode 100755 drivers/net/wireless/mv8686/cmd.h delete mode 100755 drivers/net/wireless/mv8686/cmdresp.c delete mode 100755 drivers/net/wireless/mv8686/debugfs.c delete mode 100755 drivers/net/wireless/mv8686/debugfs.h delete mode 100755 drivers/net/wireless/mv8686/decl.h delete mode 100755 drivers/net/wireless/mv8686/defs.h delete mode 100755 drivers/net/wireless/mv8686/dev.h delete mode 100755 drivers/net/wireless/mv8686/host.h delete mode 100755 drivers/net/wireless/mv8686/hostcmd.h delete mode 100755 drivers/net/wireless/mv8686/if_sdio.c delete mode 100755 drivers/net/wireless/mv8686/if_sdio.h delete mode 100755 drivers/net/wireless/mv8686/iwpriv.h delete mode 100755 drivers/net/wireless/mv8686/lib80211.h delete mode 100755 drivers/net/wireless/mv8686/main.c delete mode 100755 drivers/net/wireless/mv8686/mkclean.sh delete mode 100755 drivers/net/wireless/mv8686/mkpkg.sh delete mode 100755 drivers/net/wireless/mv8686/mv8686_cis.c delete mode 100755 drivers/net/wireless/mv8686/radiotap.h delete mode 100755 drivers/net/wireless/mv8686/rx.c delete mode 100755 drivers/net/wireless/mv8686/scan.c delete mode 100755 drivers/net/wireless/mv8686/scan.h delete mode 100755 drivers/net/wireless/mv8686/tx.c delete mode 100755 drivers/net/wireless/mv8686/types.h delete mode 100755 drivers/net/wireless/mv8686/wext.c delete mode 100755 drivers/net/wireless/mv8686/wext.h delete mode 120000 drivers/net/wireless/mv8686/wifi_power.h delete mode 120000 drivers/net/wireless/mv8686/wifi_version.h delete mode 100644 drivers/net/wireless/mwifiex/11ac.c delete mode 100644 drivers/net/wireless/mwifiex/11ac.h delete mode 100644 drivers/net/wireless/mwifiex/11n.c delete mode 100644 drivers/net/wireless/mwifiex/11n.h delete mode 100644 drivers/net/wireless/mwifiex/11n_aggr.c delete mode 100644 drivers/net/wireless/mwifiex/11n_aggr.h delete mode 100644 drivers/net/wireless/mwifiex/11n_rxreorder.c delete mode 100644 drivers/net/wireless/mwifiex/11n_rxreorder.h delete mode 100644 drivers/net/wireless/mwifiex/Kconfig delete mode 100644 drivers/net/wireless/mwifiex/Makefile delete mode 100644 drivers/net/wireless/mwifiex/README delete mode 100644 drivers/net/wireless/mwifiex/cfg80211.c delete mode 100644 drivers/net/wireless/mwifiex/cfg80211.h delete mode 100644 drivers/net/wireless/mwifiex/cfp.c delete mode 100644 drivers/net/wireless/mwifiex/cmdevt.c delete mode 100644 drivers/net/wireless/mwifiex/debugfs.c delete mode 100644 drivers/net/wireless/mwifiex/decl.h delete mode 100644 drivers/net/wireless/mwifiex/ethtool.c delete mode 100644 drivers/net/wireless/mwifiex/fw.h delete mode 100644 drivers/net/wireless/mwifiex/ie.c delete mode 100644 drivers/net/wireless/mwifiex/init.c delete mode 100644 drivers/net/wireless/mwifiex/ioctl.h delete mode 100644 drivers/net/wireless/mwifiex/join.c delete mode 100644 drivers/net/wireless/mwifiex/main.c delete mode 100644 drivers/net/wireless/mwifiex/main.h delete mode 100644 drivers/net/wireless/mwifiex/pcie.c delete mode 100644 drivers/net/wireless/mwifiex/pcie.h delete mode 100644 drivers/net/wireless/mwifiex/scan.c delete mode 100644 drivers/net/wireless/mwifiex/sdio.c delete mode 100644 drivers/net/wireless/mwifiex/sdio.h delete mode 100644 drivers/net/wireless/mwifiex/sta_cmd.c delete mode 100644 drivers/net/wireless/mwifiex/sta_cmdresp.c delete mode 100644 drivers/net/wireless/mwifiex/sta_event.c delete mode 100644 drivers/net/wireless/mwifiex/sta_ioctl.c delete mode 100644 drivers/net/wireless/mwifiex/sta_rx.c delete mode 100644 drivers/net/wireless/mwifiex/sta_tx.c delete mode 100644 drivers/net/wireless/mwifiex/txrx.c delete mode 100644 drivers/net/wireless/mwifiex/uap_cmd.c delete mode 100644 drivers/net/wireless/mwifiex/uap_event.c delete mode 100644 drivers/net/wireless/mwifiex/uap_txrx.c delete mode 100644 drivers/net/wireless/mwifiex/usb.c delete mode 100644 drivers/net/wireless/mwifiex/usb.h delete mode 100644 drivers/net/wireless/mwifiex/util.c delete mode 100644 drivers/net/wireless/mwifiex/util.h delete mode 100644 drivers/net/wireless/mwifiex/wmm.c delete mode 100644 drivers/net/wireless/mwifiex/wmm.h delete mode 100644 drivers/net/wireless/mwl8k.c delete mode 100644 drivers/net/wireless/orinoco/Kconfig delete mode 100644 drivers/net/wireless/orinoco/Makefile delete mode 100644 drivers/net/wireless/orinoco/airport.c delete mode 100644 drivers/net/wireless/orinoco/cfg.c delete mode 100644 drivers/net/wireless/orinoco/cfg.h delete mode 100644 drivers/net/wireless/orinoco/fw.c delete mode 100644 drivers/net/wireless/orinoco/fw.h delete mode 100644 drivers/net/wireless/orinoco/hermes.c delete mode 100644 drivers/net/wireless/orinoco/hermes.h delete mode 100644 drivers/net/wireless/orinoco/hermes_dld.c delete mode 100644 drivers/net/wireless/orinoco/hermes_dld.h delete mode 100644 drivers/net/wireless/orinoco/hermes_rid.h delete mode 100644 drivers/net/wireless/orinoco/hw.c delete mode 100644 drivers/net/wireless/orinoco/hw.h delete mode 100644 drivers/net/wireless/orinoco/main.c delete mode 100644 drivers/net/wireless/orinoco/main.h delete mode 100644 drivers/net/wireless/orinoco/mic.c delete mode 100644 drivers/net/wireless/orinoco/mic.h delete mode 100644 drivers/net/wireless/orinoco/orinoco.h delete mode 100644 drivers/net/wireless/orinoco/orinoco_cs.c delete mode 100644 drivers/net/wireless/orinoco/orinoco_nortel.c delete mode 100644 drivers/net/wireless/orinoco/orinoco_pci.c delete mode 100644 drivers/net/wireless/orinoco/orinoco_pci.h delete mode 100644 drivers/net/wireless/orinoco/orinoco_plx.c delete mode 100644 drivers/net/wireless/orinoco/orinoco_tmd.c delete mode 100644 drivers/net/wireless/orinoco/orinoco_usb.c delete mode 100644 drivers/net/wireless/orinoco/scan.c delete mode 100644 drivers/net/wireless/orinoco/scan.h delete mode 100644 drivers/net/wireless/orinoco/spectrum_cs.c delete mode 100644 drivers/net/wireless/orinoco/wext.c delete mode 100644 drivers/net/wireless/orinoco/wext.h delete mode 100644 drivers/net/wireless/p54/Kconfig delete mode 100644 drivers/net/wireless/p54/Makefile delete mode 100644 drivers/net/wireless/p54/eeprom.c delete mode 100644 drivers/net/wireless/p54/eeprom.h delete mode 100644 drivers/net/wireless/p54/fwio.c delete mode 100644 drivers/net/wireless/p54/led.c delete mode 100644 drivers/net/wireless/p54/lmac.h delete mode 100644 drivers/net/wireless/p54/main.c delete mode 100644 drivers/net/wireless/p54/net2280.h delete mode 100644 drivers/net/wireless/p54/p54.h delete mode 100644 drivers/net/wireless/p54/p54pci.c delete mode 100644 drivers/net/wireless/p54/p54pci.h delete mode 100644 drivers/net/wireless/p54/p54spi.c delete mode 100644 drivers/net/wireless/p54/p54spi.h delete mode 100644 drivers/net/wireless/p54/p54spi_eeprom.h delete mode 100644 drivers/net/wireless/p54/p54usb.c delete mode 100644 drivers/net/wireless/p54/p54usb.h delete mode 100644 drivers/net/wireless/p54/txrx.c delete mode 100644 drivers/net/wireless/prism54/Makefile delete mode 100644 drivers/net/wireless/prism54/isl_38xx.c delete mode 100644 drivers/net/wireless/prism54/isl_38xx.h delete mode 100644 drivers/net/wireless/prism54/isl_ioctl.c delete mode 100644 drivers/net/wireless/prism54/isl_ioctl.h delete mode 100644 drivers/net/wireless/prism54/isl_oid.h delete mode 100644 drivers/net/wireless/prism54/islpci_dev.c delete mode 100644 drivers/net/wireless/prism54/islpci_dev.h delete mode 100644 drivers/net/wireless/prism54/islpci_eth.c delete mode 100644 drivers/net/wireless/prism54/islpci_eth.h delete mode 100644 drivers/net/wireless/prism54/islpci_hotplug.c delete mode 100644 drivers/net/wireless/prism54/islpci_mgt.c delete mode 100644 drivers/net/wireless/prism54/islpci_mgt.h delete mode 100644 drivers/net/wireless/prism54/oid_mgt.c delete mode 100644 drivers/net/wireless/prism54/oid_mgt.h delete mode 100644 drivers/net/wireless/prism54/prismcompat.h delete mode 100644 drivers/net/wireless/ray_cs.c delete mode 100644 drivers/net/wireless/ray_cs.h delete mode 100644 drivers/net/wireless/rayctl.h delete mode 100755 drivers/net/wireless/rda5990/Makefile delete mode 100755 drivers/net/wireless/rda5990/drv_fm_rda/Makefile delete mode 100755 drivers/net/wireless/rda5990/drv_fm_rda/RDA5990_FM_drv.c delete mode 100755 drivers/net/wireless/rda5990/drv_fm_rda/RDA5990_FM_drv_gpio.c delete mode 100755 drivers/net/wireless/rda5990/rda_5990_power_ctrl/Makefile delete mode 100755 drivers/net/wireless/rda5990/rda_5990_power_ctrl/rda_5990_power_ctrl.c delete mode 100755 drivers/net/wireless/rda5990/rda_5990_power_ctrl/rda_5990_power_ctrl_by_gpio.c delete mode 100755 drivers/net/wireless/rda5990/rda_gpio_i2c/Makefile delete mode 100755 drivers/net/wireless/rda5990/rda_gpio_i2c/rda_gpio_i2c.c delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/Makefile delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/Makefile_gwl delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_debugfs.c delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_debugfs.h delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_defs.h delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_dev.c delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_dev.h delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_if_sdio.c delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_if_sdio.h delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_ioctl.h delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_nvram.c delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_scan.c delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_sdio_patch.c delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_txrx.c delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_txrx.h delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_wext.c delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_wext.h delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_wid.c delete mode 100755 drivers/net/wireless/rda5990/rda_wlan/rda5890_wid.h delete mode 100755 drivers/net/wireless/rkusbwifi/Makefile delete mode 100755 drivers/net/wireless/rkusbwifi/mt7601/Kconfig delete mode 100755 drivers/net/wireless/rkusbwifi/rt5370/Kconfig delete mode 100755 drivers/net/wireless/rkusbwifi/rtl8188eu/Kconfig delete mode 100755 drivers/net/wireless/rkusbwifi/rtl8192cu/Kconfig delete mode 100755 drivers/net/wireless/rkusbwifi/rtl8723au/Kconfig delete mode 100755 drivers/net/wireless/rkusbwifi/wifi_power.c delete mode 100644 drivers/net/wireless/rkusbwifi/wifi_power.h delete mode 100644 drivers/net/wireless/rkusbwifi/wifi_power_ops.c delete mode 100644 drivers/net/wireless/rkusbwifi/wifi_power_usb.c delete mode 100644 drivers/net/wireless/rkwifi/Kconfig delete mode 100644 drivers/net/wireless/rkwifi/Makefile delete mode 100644 drivers/net/wireless/rkwifi/firmware/nvram_4330.txt delete mode 100644 drivers/net/wireless/rkwifi/firmware/nvram_RK901.txt delete mode 100644 drivers/net/wireless/rkwifi/firmware/nvram_RK903.cal delete mode 100644 drivers/net/wireless/rkwifi/rk_wifi_config.c delete mode 100644 drivers/net/wireless/rndis_wlan.c delete mode 100644 drivers/net/wireless/rt2x00/Kconfig delete mode 100644 drivers/net/wireless/rt2x00/Makefile delete mode 100644 drivers/net/wireless/rt2x00/rt2400pci.c delete mode 100644 drivers/net/wireless/rt2x00/rt2400pci.h delete mode 100644 drivers/net/wireless/rt2x00/rt2500pci.c delete mode 100644 drivers/net/wireless/rt2x00/rt2500pci.h delete mode 100644 drivers/net/wireless/rt2x00/rt2500usb.c delete mode 100644 drivers/net/wireless/rt2x00/rt2500usb.h delete mode 100644 drivers/net/wireless/rt2x00/rt2800.h delete mode 100644 drivers/net/wireless/rt2x00/rt2800lib.c delete mode 100644 drivers/net/wireless/rt2x00/rt2800lib.h delete mode 100644 drivers/net/wireless/rt2x00/rt2800pci.c delete mode 100644 drivers/net/wireless/rt2x00/rt2800pci.h delete mode 100644 drivers/net/wireless/rt2x00/rt2800usb.c delete mode 100644 drivers/net/wireless/rt2x00/rt2800usb.h delete mode 100644 drivers/net/wireless/rt2x00/rt2x00.h delete mode 100644 drivers/net/wireless/rt2x00/rt2x00config.c delete mode 100644 drivers/net/wireless/rt2x00/rt2x00crypto.c delete mode 100644 drivers/net/wireless/rt2x00/rt2x00debug.c delete mode 100644 drivers/net/wireless/rt2x00/rt2x00debug.h delete mode 100644 drivers/net/wireless/rt2x00/rt2x00dev.c delete mode 100644 drivers/net/wireless/rt2x00/rt2x00dump.h delete mode 100644 drivers/net/wireless/rt2x00/rt2x00firmware.c delete mode 100644 drivers/net/wireless/rt2x00/rt2x00leds.c delete mode 100644 drivers/net/wireless/rt2x00/rt2x00leds.h delete mode 100644 drivers/net/wireless/rt2x00/rt2x00lib.h delete mode 100644 drivers/net/wireless/rt2x00/rt2x00link.c delete mode 100644 drivers/net/wireless/rt2x00/rt2x00mac.c delete mode 100644 drivers/net/wireless/rt2x00/rt2x00mmio.c delete mode 100644 drivers/net/wireless/rt2x00/rt2x00mmio.h delete mode 100644 drivers/net/wireless/rt2x00/rt2x00pci.c delete mode 100644 drivers/net/wireless/rt2x00/rt2x00pci.h delete mode 100644 drivers/net/wireless/rt2x00/rt2x00queue.c delete mode 100644 drivers/net/wireless/rt2x00/rt2x00queue.h delete mode 100644 drivers/net/wireless/rt2x00/rt2x00reg.h delete mode 100644 drivers/net/wireless/rt2x00/rt2x00soc.c delete mode 100644 drivers/net/wireless/rt2x00/rt2x00soc.h delete mode 100644 drivers/net/wireless/rt2x00/rt2x00usb.c delete mode 100644 drivers/net/wireless/rt2x00/rt2x00usb.h delete mode 100644 drivers/net/wireless/rt2x00/rt61pci.c delete mode 100644 drivers/net/wireless/rt2x00/rt61pci.h delete mode 100644 drivers/net/wireless/rt2x00/rt73usb.c delete mode 100644 drivers/net/wireless/rt2x00/rt73usb.h delete mode 100644 drivers/net/wireless/rtl818x/Kconfig delete mode 100644 drivers/net/wireless/rtl818x/Makefile delete mode 100644 drivers/net/wireless/rtl818x/rtl8180/Makefile delete mode 100644 drivers/net/wireless/rtl818x/rtl8180/dev.c delete mode 100644 drivers/net/wireless/rtl818x/rtl8180/grf5101.c delete mode 100644 drivers/net/wireless/rtl818x/rtl8180/grf5101.h delete mode 100644 drivers/net/wireless/rtl818x/rtl8180/max2820.c delete mode 100644 drivers/net/wireless/rtl818x/rtl8180/max2820.h delete mode 100644 drivers/net/wireless/rtl818x/rtl8180/rtl8180.h delete mode 100644 drivers/net/wireless/rtl818x/rtl8180/rtl8225.c delete mode 100644 drivers/net/wireless/rtl818x/rtl8180/rtl8225.h delete mode 100644 drivers/net/wireless/rtl818x/rtl8180/sa2400.c delete mode 100644 drivers/net/wireless/rtl818x/rtl8180/sa2400.h delete mode 100644 drivers/net/wireless/rtl818x/rtl8187/Makefile delete mode 100644 drivers/net/wireless/rtl818x/rtl8187/dev.c delete mode 100644 drivers/net/wireless/rtl818x/rtl8187/leds.c delete mode 100644 drivers/net/wireless/rtl818x/rtl8187/leds.h delete mode 100644 drivers/net/wireless/rtl818x/rtl8187/rfkill.c delete mode 100644 drivers/net/wireless/rtl818x/rtl8187/rfkill.h delete mode 100644 drivers/net/wireless/rtl818x/rtl8187/rtl8187.h delete mode 100644 drivers/net/wireless/rtl818x/rtl8187/rtl8225.c delete mode 100644 drivers/net/wireless/rtl818x/rtl8187/rtl8225.h delete mode 100644 drivers/net/wireless/rtl818x/rtl818x.h delete mode 100755 drivers/net/wireless/rtl8723as/Kconfig delete mode 100644 drivers/net/wireless/rtlwifi/Kconfig delete mode 100644 drivers/net/wireless/rtlwifi/Makefile delete mode 100644 drivers/net/wireless/rtlwifi/base.c delete mode 100644 drivers/net/wireless/rtlwifi/base.h delete mode 100644 drivers/net/wireless/rtlwifi/cam.c delete mode 100644 drivers/net/wireless/rtlwifi/cam.h delete mode 100644 drivers/net/wireless/rtlwifi/core.c delete mode 100644 drivers/net/wireless/rtlwifi/core.h delete mode 100644 drivers/net/wireless/rtlwifi/debug.c delete mode 100644 drivers/net/wireless/rtlwifi/debug.h delete mode 100644 drivers/net/wireless/rtlwifi/efuse.c delete mode 100644 drivers/net/wireless/rtlwifi/efuse.h delete mode 100644 drivers/net/wireless/rtlwifi/pci.c delete mode 100644 drivers/net/wireless/rtlwifi/pci.h delete mode 100644 drivers/net/wireless/rtlwifi/ps.c delete mode 100644 drivers/net/wireless/rtlwifi/ps.h delete mode 100644 drivers/net/wireless/rtlwifi/rc.c delete mode 100644 drivers/net/wireless/rtlwifi/rc.h delete mode 100644 drivers/net/wireless/rtlwifi/regd.c delete mode 100644 drivers/net/wireless/rtlwifi/regd.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/Makefile delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/def.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/dm.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/dm.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/fw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/fw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/hw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/hw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/led.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/led.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/phy.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/phy.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/pwrseq.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/pwrseq.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/reg.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/rf.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/rf.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/sw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/sw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/table.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/table.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/trx.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/trx.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192c/Makefile delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192c/main.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/Makefile delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/def.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/dm.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/dm.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/hw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/hw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/led.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/led.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/phy.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/phy.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/reg.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/rf.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/rf.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/sw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/sw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/table.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/table.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/trx.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192ce/trx.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/Makefile delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/def.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/dm.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/dm.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/hw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/hw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/led.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/led.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/mac.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/mac.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/phy.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/phy.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/reg.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/rf.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/rf.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/sw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/table.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/table.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/trx.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192cu/trx.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/Makefile delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/def.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/dm.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/dm.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/fw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/fw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/hw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/hw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/led.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/led.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/phy.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/phy.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/reg.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/rf.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/rf.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/sw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/sw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/table.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/table.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/trx.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192de/trx.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/Makefile delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/def.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/dm.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/dm.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/fw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/fw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/hw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/hw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/led.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/led.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/phy.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/phy.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/reg.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/rf.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/rf.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/sw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/sw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/table.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/table.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/trx.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8192se/trx.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/Makefile delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/btc.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/def.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/dm.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/dm.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/fw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/fw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/hal_bt_coexist.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/hal_bt_coexist.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/hal_btc.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/hal_btc.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/hw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/hw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/led.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/led.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/phy.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/phy.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/pwrseq.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/pwrseq.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/pwrseqcmd.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/pwrseqcmd.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/reg.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/rf.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/rf.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/sw.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/sw.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/table.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/table.h delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/trx.c delete mode 100644 drivers/net/wireless/rtlwifi/rtl8723ae/trx.h delete mode 100644 drivers/net/wireless/rtlwifi/stats.c delete mode 100644 drivers/net/wireless/rtlwifi/stats.h delete mode 100644 drivers/net/wireless/rtlwifi/usb.c delete mode 100644 drivers/net/wireless/rtlwifi/usb.h delete mode 100644 drivers/net/wireless/rtlwifi/wifi.h delete mode 100644 drivers/net/wireless/ti/Kconfig delete mode 100644 drivers/net/wireless/ti/Makefile delete mode 100644 drivers/net/wireless/ti/wilink_platform_data.c delete mode 100644 drivers/net/wireless/ti/wl1251/Kconfig delete mode 100644 drivers/net/wireless/ti/wl1251/Makefile delete mode 100644 drivers/net/wireless/ti/wl1251/acx.c delete mode 100644 drivers/net/wireless/ti/wl1251/acx.h delete mode 100644 drivers/net/wireless/ti/wl1251/boot.c delete mode 100644 drivers/net/wireless/ti/wl1251/boot.h delete mode 100644 drivers/net/wireless/ti/wl1251/cmd.c delete mode 100644 drivers/net/wireless/ti/wl1251/cmd.h delete mode 100644 drivers/net/wireless/ti/wl1251/debugfs.c delete mode 100644 drivers/net/wireless/ti/wl1251/debugfs.h delete mode 100644 drivers/net/wireless/ti/wl1251/event.c delete mode 100644 drivers/net/wireless/ti/wl1251/event.h delete mode 100644 drivers/net/wireless/ti/wl1251/init.c delete mode 100644 drivers/net/wireless/ti/wl1251/init.h delete mode 100644 drivers/net/wireless/ti/wl1251/io.c delete mode 100644 drivers/net/wireless/ti/wl1251/io.h delete mode 100644 drivers/net/wireless/ti/wl1251/main.c delete mode 100644 drivers/net/wireless/ti/wl1251/ps.c delete mode 100644 drivers/net/wireless/ti/wl1251/ps.h delete mode 100644 drivers/net/wireless/ti/wl1251/reg.h delete mode 100644 drivers/net/wireless/ti/wl1251/rx.c delete mode 100644 drivers/net/wireless/ti/wl1251/rx.h delete mode 100644 drivers/net/wireless/ti/wl1251/sdio.c delete mode 100644 drivers/net/wireless/ti/wl1251/spi.c delete mode 100644 drivers/net/wireless/ti/wl1251/spi.h delete mode 100644 drivers/net/wireless/ti/wl1251/tx.c delete mode 100644 drivers/net/wireless/ti/wl1251/tx.h delete mode 100644 drivers/net/wireless/ti/wl1251/wl1251.h delete mode 100644 drivers/net/wireless/ti/wl1251/wl12xx_80211.h delete mode 100644 drivers/net/wireless/ti/wl12xx/Kconfig delete mode 100644 drivers/net/wireless/ti/wl12xx/Makefile delete mode 100644 drivers/net/wireless/ti/wl12xx/acx.c delete mode 100644 drivers/net/wireless/ti/wl12xx/acx.h delete mode 100644 drivers/net/wireless/ti/wl12xx/cmd.c delete mode 100644 drivers/net/wireless/ti/wl12xx/cmd.h delete mode 100644 drivers/net/wireless/ti/wl12xx/conf.h delete mode 100644 drivers/net/wireless/ti/wl12xx/debugfs.c delete mode 100644 drivers/net/wireless/ti/wl12xx/debugfs.h delete mode 100644 drivers/net/wireless/ti/wl12xx/event.c delete mode 100644 drivers/net/wireless/ti/wl12xx/event.h delete mode 100644 drivers/net/wireless/ti/wl12xx/main.c delete mode 100644 drivers/net/wireless/ti/wl12xx/reg.h delete mode 100644 drivers/net/wireless/ti/wl12xx/scan.c delete mode 100644 drivers/net/wireless/ti/wl12xx/scan.h delete mode 100644 drivers/net/wireless/ti/wl12xx/wl12xx.h delete mode 100644 drivers/net/wireless/ti/wl18xx/Kconfig delete mode 100644 drivers/net/wireless/ti/wl18xx/Makefile delete mode 100644 drivers/net/wireless/ti/wl18xx/acx.c delete mode 100644 drivers/net/wireless/ti/wl18xx/acx.h delete mode 100644 drivers/net/wireless/ti/wl18xx/cmd.c delete mode 100644 drivers/net/wireless/ti/wl18xx/cmd.h delete mode 100644 drivers/net/wireless/ti/wl18xx/conf.h delete mode 100644 drivers/net/wireless/ti/wl18xx/debugfs.c delete mode 100644 drivers/net/wireless/ti/wl18xx/debugfs.h delete mode 100644 drivers/net/wireless/ti/wl18xx/event.c delete mode 100644 drivers/net/wireless/ti/wl18xx/event.h delete mode 100644 drivers/net/wireless/ti/wl18xx/io.c delete mode 100644 drivers/net/wireless/ti/wl18xx/io.h delete mode 100644 drivers/net/wireless/ti/wl18xx/main.c delete mode 100644 drivers/net/wireless/ti/wl18xx/reg.h delete mode 100644 drivers/net/wireless/ti/wl18xx/scan.c delete mode 100644 drivers/net/wireless/ti/wl18xx/scan.h delete mode 100644 drivers/net/wireless/ti/wl18xx/tx.c delete mode 100644 drivers/net/wireless/ti/wl18xx/tx.h delete mode 100644 drivers/net/wireless/ti/wl18xx/wl18xx.h delete mode 100644 drivers/net/wireless/ti/wlcore/Kconfig delete mode 100644 drivers/net/wireless/ti/wlcore/Makefile delete mode 100644 drivers/net/wireless/ti/wlcore/acx.c delete mode 100644 drivers/net/wireless/ti/wlcore/acx.h delete mode 100644 drivers/net/wireless/ti/wlcore/boot.c delete mode 100644 drivers/net/wireless/ti/wlcore/boot.h delete mode 100644 drivers/net/wireless/ti/wlcore/cmd.c delete mode 100644 drivers/net/wireless/ti/wlcore/cmd.h delete mode 100644 drivers/net/wireless/ti/wlcore/conf.h delete mode 100644 drivers/net/wireless/ti/wlcore/debug.h delete mode 100644 drivers/net/wireless/ti/wlcore/debugfs.c delete mode 100644 drivers/net/wireless/ti/wlcore/debugfs.h delete mode 100644 drivers/net/wireless/ti/wlcore/event.c delete mode 100644 drivers/net/wireless/ti/wlcore/event.h delete mode 100644 drivers/net/wireless/ti/wlcore/hw_ops.h delete mode 100644 drivers/net/wireless/ti/wlcore/ini.h delete mode 100644 drivers/net/wireless/ti/wlcore/init.c delete mode 100644 drivers/net/wireless/ti/wlcore/init.h delete mode 100644 drivers/net/wireless/ti/wlcore/io.c delete mode 100644 drivers/net/wireless/ti/wlcore/io.h delete mode 100644 drivers/net/wireless/ti/wlcore/main.c delete mode 100644 drivers/net/wireless/ti/wlcore/ps.c delete mode 100644 drivers/net/wireless/ti/wlcore/ps.h delete mode 100644 drivers/net/wireless/ti/wlcore/rx.c delete mode 100644 drivers/net/wireless/ti/wlcore/rx.h delete mode 100644 drivers/net/wireless/ti/wlcore/scan.c delete mode 100644 drivers/net/wireless/ti/wlcore/scan.h delete mode 100644 drivers/net/wireless/ti/wlcore/sdio.c delete mode 100644 drivers/net/wireless/ti/wlcore/spi.c delete mode 100644 drivers/net/wireless/ti/wlcore/testmode.c delete mode 100644 drivers/net/wireless/ti/wlcore/testmode.h delete mode 100644 drivers/net/wireless/ti/wlcore/tx.c delete mode 100644 drivers/net/wireless/ti/wlcore/tx.h delete mode 100644 drivers/net/wireless/ti/wlcore/wl12xx_80211.h delete mode 100644 drivers/net/wireless/ti/wlcore/wlcore.h delete mode 100644 drivers/net/wireless/ti/wlcore/wlcore_i.h delete mode 100644 drivers/net/wireless/wifi_launcher/Makefile delete mode 100644 drivers/net/wireless/wifi_launcher/wlan.c delete mode 100755 drivers/net/wireless/wifi_launcher/wlan_param.h delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_aigo_e1000.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_aigo_e700.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_aigo_nx7007.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_anjieda_inch10.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_foxcom_tp2.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_jinghua_m80.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_malata_mp0100.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_meitu_770.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_rk2808_child.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_rk2818sdk_usb.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_rk28_meizhu_m70.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_rk29_yifang_a10.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_tchip_tr802d.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_tchip_tr806d.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_yifang_a7_2818.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_yuxing_mid7001.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_yuxing_mid704.c delete mode 100755 drivers/net/wireless/wifi_power/vendor/wp_yuxing_umpc1001.c delete mode 100644 drivers/net/wireless/wifi_power/wifi_config.c delete mode 100755 drivers/net/wireless/wifi_power/wifi_power.c delete mode 100755 drivers/net/wireless/wifi_power/wifi_power.h delete mode 100755 drivers/net/wireless/wifi_power/wifi_power_ops.c delete mode 100755 drivers/net/wireless/wifi_power/wifi_power_save.c delete mode 100755 drivers/net/wireless/wifi_power/wifi_power_usb.c delete mode 100644 drivers/net/wireless/wifi_power/wifi_version.h delete mode 100755 drivers/net/wireless/wifi_sys/rkwifi_sys_iface.c delete mode 100644 drivers/net/wireless/wl3501.h delete mode 100644 drivers/net/wireless/wl3501_cs.c delete mode 100644 drivers/net/wireless/zd1201.c delete mode 100644 drivers/net/wireless/zd1201.h delete mode 100644 drivers/net/wireless/zd1211rw/Kconfig delete mode 100644 drivers/net/wireless/zd1211rw/Makefile delete mode 100644 drivers/net/wireless/zd1211rw/zd_chip.c delete mode 100644 drivers/net/wireless/zd1211rw/zd_chip.h delete mode 100644 drivers/net/wireless/zd1211rw/zd_def.h delete mode 100644 drivers/net/wireless/zd1211rw/zd_mac.c delete mode 100644 drivers/net/wireless/zd1211rw/zd_mac.h delete mode 100644 drivers/net/wireless/zd1211rw/zd_rf.c delete mode 100644 drivers/net/wireless/zd1211rw/zd_rf.h delete mode 100644 drivers/net/wireless/zd1211rw/zd_rf_al2230.c delete mode 100644 drivers/net/wireless/zd1211rw/zd_rf_al7230b.c delete mode 100644 drivers/net/wireless/zd1211rw/zd_rf_rf2959.c delete mode 100644 drivers/net/wireless/zd1211rw/zd_rf_uw2453.c delete mode 100644 drivers/net/wireless/zd1211rw/zd_usb.c delete mode 100644 drivers/net/wireless/zd1211rw/zd_usb.h diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig deleted file mode 100644 index 5b0a49cf1dea..000000000000 --- a/drivers/net/wireless/Kconfig +++ /dev/null @@ -1,289 +0,0 @@ -# -# Wireless LAN device configuration -# - -menuconfig WLAN - bool "Wireless LAN" - depends on !S390 - depends on NET - select WIRELESS - default y - ---help--- - This section contains all the pre 802.11 and 802.11 wireless - device drivers. For a complete list of drivers and documentation - on them refer to the wireless wiki: - - http://wireless.kernel.org/en/users/Drivers - -if WLAN - -config PCMCIA_RAYCS - tristate "Aviator/Raytheon 2.4GHz wireless support" - depends on PCMCIA - select WIRELESS_EXT - select WEXT_SPY - select WEXT_PRIV - ---help--- - Say Y here if you intend to attach an Aviator/Raytheon PCMCIA - (PC-card) wireless Ethernet networking card to your computer. - Please read the file for - details. - - To compile this driver as a module, choose M here: the module will be - called ray_cs. If unsure, say N. - -config LIBERTAS_THINFIRM - tristate "Marvell 8xxx Libertas WLAN driver support with thin firmware" - depends on MAC80211 - select FW_LOADER - ---help--- - A library for Marvell Libertas 8xxx devices using thinfirm. - -config LIBERTAS_THINFIRM_DEBUG - bool "Enable full debugging output in the Libertas thin firmware module." - depends on LIBERTAS_THINFIRM - ---help--- - Debugging support. - -config LIBERTAS_THINFIRM_USB - tristate "Marvell Libertas 8388 USB 802.11b/g cards with thin firmware" - depends on LIBERTAS_THINFIRM && USB - ---help--- - A driver for Marvell Libertas 8388 USB devices using thinfirm. - -config AIRO - tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards" - depends on ISA_DMA_API && (PCI || BROKEN) - select WIRELESS_EXT - select CRYPTO - select WEXT_SPY - select WEXT_PRIV - ---help--- - This is the standard Linux driver to support Cisco/Aironet ISA and - PCI 802.11 wireless cards. - It supports the new 802.11b cards from Cisco (Cisco 34X, Cisco 35X - - with or without encryption) as well as card before the Cisco - acquisition (Aironet 4500, Aironet 4800, Aironet 4800B). - - This driver support both the standard Linux Wireless Extensions - and Cisco proprietary API, so both the Linux Wireless Tools and the - Cisco Linux utilities can be used to configure the card. - - The driver can be compiled as a module and will be named "airo". - -config ATMEL - tristate "Atmel at76c50x chipset 802.11b support" - depends on (PCI || PCMCIA) - select WIRELESS_EXT - select WEXT_PRIV - select FW_LOADER - select CRC32 - ---help--- - A driver 802.11b wireless cards based on the Atmel fast-vnet - chips. This driver supports standard Linux wireless extensions. - - Many cards based on this chipset do not have flash memory - and need their firmware loaded at start-up. If yours is - one of these, you will need to provide a firmware image - to be loaded into the card by the driver. The Atmel - firmware package can be downloaded from - - -config PCI_ATMEL - tristate "Atmel at76c506 PCI cards" - depends on ATMEL && PCI - ---help--- - Enable support for PCI and mini-PCI cards containing the - Atmel at76c506 chip. - -config PCMCIA_ATMEL - tristate "Atmel at76c502/at76c504 PCMCIA cards" - depends on ATMEL && PCMCIA - select WIRELESS_EXT - select FW_LOADER - select CRC32 - ---help--- - Enable support for PCMCIA cards containing the - Atmel at76c502 and at76c504 chips. - -config AT76C50X_USB - tristate "Atmel at76c503/at76c505/at76c505a USB cards" - depends on MAC80211 && USB - select FW_LOADER - ---help--- - Enable support for USB Wireless devices using Atmel at76c503, - at76c505 or at76c505a chips. - -config AIRO_CS - tristate "Cisco/Aironet 34X/35X/4500/4800 PCMCIA cards" - depends on PCMCIA && (BROKEN || !M32R) - select WIRELESS_EXT - select WEXT_SPY - select WEXT_PRIV - select CRYPTO - select CRYPTO_AES - ---help--- - This is the standard Linux driver to support Cisco/Aironet PCMCIA - 802.11 wireless cards. This driver is the same as the Aironet - driver part of the Linux Pcmcia package. - It supports the new 802.11b cards from Cisco (Cisco 34X, Cisco 35X - - with or without encryption) as well as card before the Cisco - acquisition (Aironet 4500, Aironet 4800, Aironet 4800B). It also - supports OEM of Cisco such as the DELL TrueMobile 4800 and Xircom - 802.11b cards. - - This driver support both the standard Linux Wireless Extensions - and Cisco proprietary API, so both the Linux Wireless Tools and the - Cisco Linux utilities can be used to configure the card. - -config PCMCIA_WL3501 - tristate "Planet WL3501 PCMCIA cards" - depends on PCMCIA - select WIRELESS_EXT - select WEXT_SPY - help - A driver for WL3501 PCMCIA 802.11 wireless cards made by Planet. - It has basic support for Linux wireless extensions and initial - micro support for ethtool. - -config PRISM54 - tristate 'Intersil Prism GT/Duette/Indigo PCI/Cardbus (DEPRECATED)' - depends on PCI - select WIRELESS_EXT - select WEXT_SPY - select WEXT_PRIV - select FW_LOADER - ---help--- - This enables support for FullMAC PCI/Cardbus prism54 devices. This - driver is now deprecated in favor for the SoftMAC driver, p54pci. - p54pci supports FullMAC PCI/Cardbus devices as well. - - For more information refer to the p54 wiki: - - http://wireless.kernel.org/en/users/Drivers/p54 - - Note: You need a motherboard with DMA support to use any of these cards - - When built as module you get the module prism54 - -config USB_ZD1201 - tristate "USB ZD1201 based Wireless device support" - depends on USB - select WIRELESS_EXT - select WEXT_PRIV - select FW_LOADER - ---help--- - Say Y if you want to use wireless LAN adapters based on the ZyDAS - ZD1201 chip. - - This driver makes the adapter appear as a normal Ethernet interface, - typically on wlan0. - - The zd1201 device requires external firmware to be loaded. - This can be found at http://linux-lc100020.sourceforge.net/ - - To compile this driver as a module, choose M here: the - module will be called zd1201. - -config USB_NET_RNDIS_WLAN - tristate "Wireless RNDIS USB support" - depends on USB - depends on CFG80211 - select USB_USBNET - select USB_NET_CDCETHER - select USB_NET_RNDIS_HOST - ---help--- - This is a driver for wireless RNDIS devices. - These are USB based adapters found in devices such as: - - Buffalo WLI-U2-KG125S - U.S. Robotics USR5421 - Belkin F5D7051 - Linksys WUSB54GSv2 - Linksys WUSB54GSC - Asus WL169gE - Eminent EM4045 - BT Voyager 1055 - Linksys WUSB54GSv1 - U.S. Robotics USR5420 - BUFFALO WLI-USB-G54 - - All of these devices are based on Broadcom 4320 chip which is the - only wireless RNDIS chip known to date. - - If you choose to build a module, it'll be called rndis_wlan. - -source "drivers/net/wireless/rtl818x/Kconfig" - -config ADM8211 - tristate "ADMtek ADM8211 support" - depends on MAC80211 && PCI - select CRC32 - select EEPROM_93CX6 - ---help--- - This driver is for ADM8211A, ADM8211B, and ADM8211C based cards. - These are PCI/mini-PCI/Cardbus 802.11b chips found in cards such as: - - Xterasys Cardbus XN-2411b - Blitz NetWave Point PC - TrendNet 221pc - Belkin F5D6001 - SMC 2635W - Linksys WPC11 v1 - Fiberline FL-WL-200X - 3com Office Connect (3CRSHPW796) - Corega WLPCIB-11 - SMC 2602W V2 EU - D-Link DWL-520 Revision C - - However, some of these cards have been replaced with other chips - like the RTL8180L (Xterasys Cardbus XN-2411b, Belkin F5D6001) or - the Ralink RT2400 (SMC2635W) without a model number change. - - Thanks to Infineon-ADMtek for their support of this driver. - -config MAC80211_HWSIM - tristate "Simulated radio testing tool for mac80211" - depends on MAC80211 - ---help--- - This driver is a developer testing tool that can be used to test - IEEE 802.11 networking stack (mac80211) functionality. This is not - needed for normal wireless LAN usage and is only for testing. See - Documentation/networking/mac80211_hwsim for more information on how - to use this tool. - - To compile this driver as a module, choose M here: the module will be - called mac80211_hwsim. If unsure, say N. - -config MWL8K - tristate "Marvell 88W8xxx PCI/PCIe Wireless support" - depends on MAC80211 && PCI - ---help--- - This driver supports Marvell TOPDOG 802.11 wireless cards. - - To compile this driver as a module, choose M here: the module - will be called mwl8k. If unsure, say N. - -config WIFI_CONTROL_FUNC - bool "Enable WiFi control function abstraction" - help - Enables Power/Reset/Carddetect function abstraction - -source "drivers/net/wireless/ath/Kconfig" -source "drivers/net/wireless/b43/Kconfig" -source "drivers/net/wireless/b43legacy/Kconfig" -source "drivers/net/wireless/brcm80211/Kconfig" -source "drivers/net/wireless/hostap/Kconfig" -source "drivers/net/wireless/ipw2x00/Kconfig" -source "drivers/net/wireless/iwlwifi/Kconfig" -source "drivers/net/wireless/iwlegacy/Kconfig" -source "drivers/net/wireless/libertas/Kconfig" -source "drivers/net/wireless/orinoco/Kconfig" -source "drivers/net/wireless/p54/Kconfig" -source "drivers/net/wireless/rt2x00/Kconfig" -source "drivers/net/wireless/rtlwifi/Kconfig" -source "drivers/net/wireless/ti/Kconfig" -source "drivers/net/wireless/zd1211rw/Kconfig" -source "drivers/net/wireless/mwifiex/Kconfig" - -endif # WLAN diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile deleted file mode 100644 index 67156efe14c4..000000000000 --- a/drivers/net/wireless/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# -# Makefile for the Linux Wireless network device drivers. -# - -obj-$(CONFIG_IPW2100) += ipw2x00/ -obj-$(CONFIG_IPW2200) += ipw2x00/ - -obj-$(CONFIG_HERMES) += orinoco/ - -obj-$(CONFIG_AIRO) += airo.o -obj-$(CONFIG_AIRO_CS) += airo_cs.o airo.o - -obj-$(CONFIG_ATMEL) += atmel.o -obj-$(CONFIG_PCI_ATMEL) += atmel_pci.o -obj-$(CONFIG_PCMCIA_ATMEL) += atmel_cs.o - -obj-$(CONFIG_AT76C50X_USB) += at76c50x-usb.o - -obj-$(CONFIG_PRISM54) += prism54/ - -obj-$(CONFIG_HOSTAP) += hostap/ -obj-$(CONFIG_B43) += b43/ -obj-$(CONFIG_B43LEGACY) += b43legacy/ -obj-$(CONFIG_ZD1211RW) += zd1211rw/ -obj-$(CONFIG_RTL8180) += rtl818x/ -obj-$(CONFIG_RTL8187) += rtl818x/ -obj-$(CONFIG_RTLWIFI) += rtlwifi/ - -# 16-bit wireless PCMCIA client drivers -obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o -obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o - -obj-$(CONFIG_USB_NET_RNDIS_WLAN) += rndis_wlan.o - -obj-$(CONFIG_USB_ZD1201) += zd1201.o -obj-$(CONFIG_LIBERTAS) += libertas/ - -obj-$(CONFIG_LIBERTAS_THINFIRM) += libertas_tf/ - -obj-$(CONFIG_ADM8211) += adm8211.o - -obj-$(CONFIG_MWL8K) += mwl8k.o - -obj-$(CONFIG_IWLWIFI) += iwlwifi/ -obj-$(CONFIG_IWLEGACY) += iwlegacy/ -obj-$(CONFIG_RT2X00) += rt2x00/ - -obj-$(CONFIG_P54_COMMON) += p54/ - -obj-$(CONFIG_ATH_CARDS) += ath/ - -obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o - -obj-$(CONFIG_WL_TI) += ti/ - -obj-$(CONFIG_MWIFIEX) += mwifiex/ - -obj-$(CONFIG_BRCMFMAC) += brcm80211/ -obj-$(CONFIG_BRCMSMAC) += brcm80211/ diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c deleted file mode 100644 index f9a24e599dee..000000000000 --- a/drivers/net/wireless/adm8211.c +++ /dev/null @@ -1,1996 +0,0 @@ - -/* - * Linux device driver for ADMtek ADM8211 (IEEE 802.11b MAC/BBP) - * - * Copyright (c) 2003, Jouni Malinen - * Copyright (c) 2004-2007, Michael Wu - * Some parts copyright (c) 2003 by David Young - * and used with permission. - * - * Much thanks to Infineon-ADMtek for their support of this driver. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "adm8211.h" - -MODULE_AUTHOR("Michael Wu "); -MODULE_AUTHOR("Jouni Malinen "); -MODULE_DESCRIPTION("Driver for IEEE 802.11b wireless cards based on ADMtek ADM8211"); -MODULE_SUPPORTED_DEVICE("ADM8211"); -MODULE_LICENSE("GPL"); - -static unsigned int tx_ring_size __read_mostly = 16; -static unsigned int rx_ring_size __read_mostly = 16; - -module_param(tx_ring_size, uint, 0); -module_param(rx_ring_size, uint, 0); - -static DEFINE_PCI_DEVICE_TABLE(adm8211_pci_id_table) = { - /* ADMtek ADM8211 */ - { PCI_DEVICE(0x10B7, 0x6000) }, /* 3Com 3CRSHPW796 */ - { PCI_DEVICE(0x1200, 0x8201) }, /* ? */ - { PCI_DEVICE(0x1317, 0x8201) }, /* ADM8211A */ - { PCI_DEVICE(0x1317, 0x8211) }, /* ADM8211B/C */ - { 0 } -}; - -static struct ieee80211_rate adm8211_rates[] = { - { .bitrate = 10, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 20, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 55, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 110, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 220, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, /* XX ?? */ -}; - -static const struct ieee80211_channel adm8211_channels[] = { - { .center_freq = 2412}, - { .center_freq = 2417}, - { .center_freq = 2422}, - { .center_freq = 2427}, - { .center_freq = 2432}, - { .center_freq = 2437}, - { .center_freq = 2442}, - { .center_freq = 2447}, - { .center_freq = 2452}, - { .center_freq = 2457}, - { .center_freq = 2462}, - { .center_freq = 2467}, - { .center_freq = 2472}, - { .center_freq = 2484}, -}; - - -static void adm8211_eeprom_register_read(struct eeprom_93cx6 *eeprom) -{ - struct adm8211_priv *priv = eeprom->data; - u32 reg = ADM8211_CSR_READ(SPR); - - eeprom->reg_data_in = reg & ADM8211_SPR_SDI; - eeprom->reg_data_out = reg & ADM8211_SPR_SDO; - eeprom->reg_data_clock = reg & ADM8211_SPR_SCLK; - eeprom->reg_chip_select = reg & ADM8211_SPR_SCS; -} - -static void adm8211_eeprom_register_write(struct eeprom_93cx6 *eeprom) -{ - struct adm8211_priv *priv = eeprom->data; - u32 reg = 0x4000 | ADM8211_SPR_SRS; - - if (eeprom->reg_data_in) - reg |= ADM8211_SPR_SDI; - if (eeprom->reg_data_out) - reg |= ADM8211_SPR_SDO; - if (eeprom->reg_data_clock) - reg |= ADM8211_SPR_SCLK; - if (eeprom->reg_chip_select) - reg |= ADM8211_SPR_SCS; - - ADM8211_CSR_WRITE(SPR, reg); - ADM8211_CSR_READ(SPR); /* eeprom_delay */ -} - -static int adm8211_read_eeprom(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - unsigned int words, i; - struct ieee80211_chan_range chan_range; - u16 cr49; - struct eeprom_93cx6 eeprom = { - .data = priv, - .register_read = adm8211_eeprom_register_read, - .register_write = adm8211_eeprom_register_write - }; - - if (ADM8211_CSR_READ(CSR_TEST0) & ADM8211_CSR_TEST0_EPTYP) { - /* 256 * 16-bit = 512 bytes */ - eeprom.width = PCI_EEPROM_WIDTH_93C66; - words = 256; - } else { - /* 64 * 16-bit = 128 bytes */ - eeprom.width = PCI_EEPROM_WIDTH_93C46; - words = 64; - } - - priv->eeprom_len = words * 2; - priv->eeprom = kmalloc(priv->eeprom_len, GFP_KERNEL); - if (!priv->eeprom) - return -ENOMEM; - - eeprom_93cx6_multiread(&eeprom, 0, (__le16 *)priv->eeprom, words); - - cr49 = le16_to_cpu(priv->eeprom->cr49); - priv->rf_type = (cr49 >> 3) & 0x7; - switch (priv->rf_type) { - case ADM8211_TYPE_INTERSIL: - case ADM8211_TYPE_RFMD: - case ADM8211_TYPE_MARVEL: - case ADM8211_TYPE_AIROHA: - case ADM8211_TYPE_ADMTEK: - break; - - default: - if (priv->pdev->revision < ADM8211_REV_CA) - priv->rf_type = ADM8211_TYPE_RFMD; - else - priv->rf_type = ADM8211_TYPE_AIROHA; - - printk(KERN_WARNING "%s (adm8211): Unknown RFtype %d\n", - pci_name(priv->pdev), (cr49 >> 3) & 0x7); - } - - priv->bbp_type = cr49 & 0x7; - switch (priv->bbp_type) { - case ADM8211_TYPE_INTERSIL: - case ADM8211_TYPE_RFMD: - case ADM8211_TYPE_MARVEL: - case ADM8211_TYPE_AIROHA: - case ADM8211_TYPE_ADMTEK: - break; - default: - if (priv->pdev->revision < ADM8211_REV_CA) - priv->bbp_type = ADM8211_TYPE_RFMD; - else - priv->bbp_type = ADM8211_TYPE_ADMTEK; - - printk(KERN_WARNING "%s (adm8211): Unknown BBPtype: %d\n", - pci_name(priv->pdev), cr49 >> 3); - } - - if (priv->eeprom->country_code >= ARRAY_SIZE(cranges)) { - printk(KERN_WARNING "%s (adm8211): Invalid country code (%d)\n", - pci_name(priv->pdev), priv->eeprom->country_code); - - chan_range = cranges[2]; - } else - chan_range = cranges[priv->eeprom->country_code]; - - printk(KERN_DEBUG "%s (adm8211): Channel range: %d - %d\n", - pci_name(priv->pdev), (int)chan_range.min, (int)chan_range.max); - - BUILD_BUG_ON(sizeof(priv->channels) != sizeof(adm8211_channels)); - - memcpy(priv->channels, adm8211_channels, sizeof(priv->channels)); - priv->band.channels = priv->channels; - priv->band.n_channels = ARRAY_SIZE(adm8211_channels); - priv->band.bitrates = adm8211_rates; - priv->band.n_bitrates = ARRAY_SIZE(adm8211_rates); - - for (i = 1; i <= ARRAY_SIZE(adm8211_channels); i++) - if (i < chan_range.min || i > chan_range.max) - priv->channels[i - 1].flags |= IEEE80211_CHAN_DISABLED; - - switch (priv->eeprom->specific_bbptype) { - case ADM8211_BBP_RFMD3000: - case ADM8211_BBP_RFMD3002: - case ADM8211_BBP_ADM8011: - priv->specific_bbptype = priv->eeprom->specific_bbptype; - break; - - default: - if (priv->pdev->revision < ADM8211_REV_CA) - priv->specific_bbptype = ADM8211_BBP_RFMD3000; - else - priv->specific_bbptype = ADM8211_BBP_ADM8011; - - printk(KERN_WARNING "%s (adm8211): Unknown specific BBP: %d\n", - pci_name(priv->pdev), priv->eeprom->specific_bbptype); - } - - switch (priv->eeprom->specific_rftype) { - case ADM8211_RFMD2948: - case ADM8211_RFMD2958: - case ADM8211_RFMD2958_RF3000_CONTROL_POWER: - case ADM8211_MAX2820: - case ADM8211_AL2210L: - priv->transceiver_type = priv->eeprom->specific_rftype; - break; - - default: - if (priv->pdev->revision == ADM8211_REV_BA) - priv->transceiver_type = ADM8211_RFMD2958_RF3000_CONTROL_POWER; - else if (priv->pdev->revision == ADM8211_REV_CA) - priv->transceiver_type = ADM8211_AL2210L; - else if (priv->pdev->revision == ADM8211_REV_AB) - priv->transceiver_type = ADM8211_RFMD2948; - - printk(KERN_WARNING "%s (adm8211): Unknown transceiver: %d\n", - pci_name(priv->pdev), priv->eeprom->specific_rftype); - - break; - } - - printk(KERN_DEBUG "%s (adm8211): RFtype=%d BBPtype=%d Specific BBP=%d " - "Transceiver=%d\n", pci_name(priv->pdev), priv->rf_type, - priv->bbp_type, priv->specific_bbptype, priv->transceiver_type); - - return 0; -} - -static inline void adm8211_write_sram(struct ieee80211_hw *dev, - u32 addr, u32 data) -{ - struct adm8211_priv *priv = dev->priv; - - ADM8211_CSR_WRITE(WEPCTL, addr | ADM8211_WEPCTL_TABLE_WR | - (priv->pdev->revision < ADM8211_REV_BA ? - 0 : ADM8211_WEPCTL_SEL_WEPTABLE )); - ADM8211_CSR_READ(WEPCTL); - msleep(1); - - ADM8211_CSR_WRITE(WESK, data); - ADM8211_CSR_READ(WESK); - msleep(1); -} - -static void adm8211_write_sram_bytes(struct ieee80211_hw *dev, - unsigned int addr, u8 *buf, - unsigned int len) -{ - struct adm8211_priv *priv = dev->priv; - u32 reg = ADM8211_CSR_READ(WEPCTL); - unsigned int i; - - if (priv->pdev->revision < ADM8211_REV_BA) { - for (i = 0; i < len; i += 2) { - u16 val = buf[i] | (buf[i + 1] << 8); - adm8211_write_sram(dev, addr + i / 2, val); - } - } else { - for (i = 0; i < len; i += 4) { - u32 val = (buf[i + 0] << 0 ) | (buf[i + 1] << 8 ) | - (buf[i + 2] << 16) | (buf[i + 3] << 24); - adm8211_write_sram(dev, addr + i / 4, val); - } - } - - ADM8211_CSR_WRITE(WEPCTL, reg); -} - -static void adm8211_clear_sram(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - u32 reg = ADM8211_CSR_READ(WEPCTL); - unsigned int addr; - - for (addr = 0; addr < ADM8211_SRAM_SIZE; addr++) - adm8211_write_sram(dev, addr, 0); - - ADM8211_CSR_WRITE(WEPCTL, reg); -} - -static int adm8211_get_stats(struct ieee80211_hw *dev, - struct ieee80211_low_level_stats *stats) -{ - struct adm8211_priv *priv = dev->priv; - - memcpy(stats, &priv->stats, sizeof(*stats)); - - return 0; -} - -static void adm8211_interrupt_tci(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - unsigned int dirty_tx; - - spin_lock(&priv->lock); - - for (dirty_tx = priv->dirty_tx; priv->cur_tx - dirty_tx; dirty_tx++) { - unsigned int entry = dirty_tx % priv->tx_ring_size; - u32 status = le32_to_cpu(priv->tx_ring[entry].status); - struct ieee80211_tx_info *txi; - struct adm8211_tx_ring_info *info; - struct sk_buff *skb; - - if (status & TDES0_CONTROL_OWN || - !(status & TDES0_CONTROL_DONE)) - break; - - info = &priv->tx_buffers[entry]; - skb = info->skb; - txi = IEEE80211_SKB_CB(skb); - - /* TODO: check TDES0_STATUS_TUF and TDES0_STATUS_TRO */ - - pci_unmap_single(priv->pdev, info->mapping, - info->skb->len, PCI_DMA_TODEVICE); - - ieee80211_tx_info_clear_status(txi); - - skb_pull(skb, sizeof(struct adm8211_tx_hdr)); - memcpy(skb_push(skb, info->hdrlen), skb->cb, info->hdrlen); - if (!(txi->flags & IEEE80211_TX_CTL_NO_ACK) && - !(status & TDES0_STATUS_ES)) - txi->flags |= IEEE80211_TX_STAT_ACK; - - ieee80211_tx_status_irqsafe(dev, skb); - - info->skb = NULL; - } - - if (priv->cur_tx - dirty_tx < priv->tx_ring_size - 2) - ieee80211_wake_queue(dev, 0); - - priv->dirty_tx = dirty_tx; - spin_unlock(&priv->lock); -} - - -static void adm8211_interrupt_rci(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - unsigned int entry = priv->cur_rx % priv->rx_ring_size; - u32 status; - unsigned int pktlen; - struct sk_buff *skb, *newskb; - unsigned int limit = priv->rx_ring_size; - u8 rssi, rate; - - while (!(priv->rx_ring[entry].status & cpu_to_le32(RDES0_STATUS_OWN))) { - if (!limit--) - break; - - status = le32_to_cpu(priv->rx_ring[entry].status); - rate = (status & RDES0_STATUS_RXDR) >> 12; - rssi = le32_to_cpu(priv->rx_ring[entry].length) & - RDES1_STATUS_RSSI; - - pktlen = status & RDES0_STATUS_FL; - if (pktlen > RX_PKT_SIZE) { - if (net_ratelimit()) - wiphy_debug(dev->wiphy, "frame too long (%d)\n", - pktlen); - pktlen = RX_PKT_SIZE; - } - - if (!priv->soft_rx_crc && status & RDES0_STATUS_ES) { - skb = NULL; /* old buffer will be reused */ - /* TODO: update RX error stats */ - /* TODO: check RDES0_STATUS_CRC*E */ - } else if (pktlen < RX_COPY_BREAK) { - skb = dev_alloc_skb(pktlen); - if (skb) { - pci_dma_sync_single_for_cpu( - priv->pdev, - priv->rx_buffers[entry].mapping, - pktlen, PCI_DMA_FROMDEVICE); - memcpy(skb_put(skb, pktlen), - skb_tail_pointer(priv->rx_buffers[entry].skb), - pktlen); - pci_dma_sync_single_for_device( - priv->pdev, - priv->rx_buffers[entry].mapping, - RX_PKT_SIZE, PCI_DMA_FROMDEVICE); - } - } else { - newskb = dev_alloc_skb(RX_PKT_SIZE); - if (newskb) { - skb = priv->rx_buffers[entry].skb; - skb_put(skb, pktlen); - pci_unmap_single( - priv->pdev, - priv->rx_buffers[entry].mapping, - RX_PKT_SIZE, PCI_DMA_FROMDEVICE); - priv->rx_buffers[entry].skb = newskb; - priv->rx_buffers[entry].mapping = - pci_map_single(priv->pdev, - skb_tail_pointer(newskb), - RX_PKT_SIZE, - PCI_DMA_FROMDEVICE); - } else { - skb = NULL; - /* TODO: update rx dropped stats */ - } - - priv->rx_ring[entry].buffer1 = - cpu_to_le32(priv->rx_buffers[entry].mapping); - } - - priv->rx_ring[entry].status = cpu_to_le32(RDES0_STATUS_OWN | - RDES0_STATUS_SQL); - priv->rx_ring[entry].length = - cpu_to_le32(RX_PKT_SIZE | - (entry == priv->rx_ring_size - 1 ? - RDES1_CONTROL_RER : 0)); - - if (skb) { - struct ieee80211_rx_status rx_status = {0}; - - if (priv->pdev->revision < ADM8211_REV_CA) - rx_status.signal = rssi; - else - rx_status.signal = 100 - rssi; - - rx_status.rate_idx = rate; - - rx_status.freq = adm8211_channels[priv->channel - 1].center_freq; - rx_status.band = IEEE80211_BAND_2GHZ; - - memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); - ieee80211_rx_irqsafe(dev, skb); - } - - entry = (++priv->cur_rx) % priv->rx_ring_size; - } - - /* TODO: check LPC and update stats? */ -} - - -static irqreturn_t adm8211_interrupt(int irq, void *dev_id) -{ -#define ADM8211_INT(x) \ -do { \ - if (unlikely(stsr & ADM8211_STSR_ ## x)) \ - wiphy_debug(dev->wiphy, "%s\n", #x); \ -} while (0) - - struct ieee80211_hw *dev = dev_id; - struct adm8211_priv *priv = dev->priv; - u32 stsr = ADM8211_CSR_READ(STSR); - ADM8211_CSR_WRITE(STSR, stsr); - if (stsr == 0xffffffff) - return IRQ_HANDLED; - - if (!(stsr & (ADM8211_STSR_NISS | ADM8211_STSR_AISS))) - return IRQ_HANDLED; - - if (stsr & ADM8211_STSR_RCI) - adm8211_interrupt_rci(dev); - if (stsr & ADM8211_STSR_TCI) - adm8211_interrupt_tci(dev); - - ADM8211_INT(PCF); - ADM8211_INT(BCNTC); - ADM8211_INT(GPINT); - ADM8211_INT(ATIMTC); - ADM8211_INT(TSFTF); - ADM8211_INT(TSCZ); - ADM8211_INT(SQL); - ADM8211_INT(WEPTD); - ADM8211_INT(ATIME); - ADM8211_INT(TEIS); - ADM8211_INT(FBE); - ADM8211_INT(REIS); - ADM8211_INT(GPTT); - ADM8211_INT(RPS); - ADM8211_INT(RDU); - ADM8211_INT(TUF); - ADM8211_INT(TPS); - - return IRQ_HANDLED; - -#undef ADM8211_INT -} - -#define WRITE_SYN(name,v_mask,v_shift,a_mask,a_shift,bits,prewrite,postwrite)\ -static void adm8211_rf_write_syn_ ## name (struct ieee80211_hw *dev, \ - u16 addr, u32 value) { \ - struct adm8211_priv *priv = dev->priv; \ - unsigned int i; \ - u32 reg, bitbuf; \ - \ - value &= v_mask; \ - addr &= a_mask; \ - bitbuf = (value << v_shift) | (addr << a_shift); \ - \ - ADM8211_CSR_WRITE(SYNRF, ADM8211_SYNRF_IF_SELECT_1); \ - ADM8211_CSR_READ(SYNRF); \ - ADM8211_CSR_WRITE(SYNRF, ADM8211_SYNRF_IF_SELECT_0); \ - ADM8211_CSR_READ(SYNRF); \ - \ - if (prewrite) { \ - ADM8211_CSR_WRITE(SYNRF, ADM8211_SYNRF_WRITE_SYNDATA_0); \ - ADM8211_CSR_READ(SYNRF); \ - } \ - \ - for (i = 0; i <= bits; i++) { \ - if (bitbuf & (1 << (bits - i))) \ - reg = ADM8211_SYNRF_WRITE_SYNDATA_1; \ - else \ - reg = ADM8211_SYNRF_WRITE_SYNDATA_0; \ - \ - ADM8211_CSR_WRITE(SYNRF, reg); \ - ADM8211_CSR_READ(SYNRF); \ - \ - ADM8211_CSR_WRITE(SYNRF, reg | ADM8211_SYNRF_WRITE_CLOCK_1); \ - ADM8211_CSR_READ(SYNRF); \ - ADM8211_CSR_WRITE(SYNRF, reg | ADM8211_SYNRF_WRITE_CLOCK_0); \ - ADM8211_CSR_READ(SYNRF); \ - } \ - \ - if (postwrite == 1) { \ - ADM8211_CSR_WRITE(SYNRF, reg | ADM8211_SYNRF_IF_SELECT_0); \ - ADM8211_CSR_READ(SYNRF); \ - } \ - if (postwrite == 2) { \ - ADM8211_CSR_WRITE(SYNRF, reg | ADM8211_SYNRF_IF_SELECT_1); \ - ADM8211_CSR_READ(SYNRF); \ - } \ - \ - ADM8211_CSR_WRITE(SYNRF, 0); \ - ADM8211_CSR_READ(SYNRF); \ -} - -WRITE_SYN(max2820, 0x00FFF, 0, 0x0F, 12, 15, 1, 1) -WRITE_SYN(al2210l, 0xFFFFF, 4, 0x0F, 0, 23, 1, 1) -WRITE_SYN(rfmd2958, 0x3FFFF, 0, 0x1F, 18, 23, 0, 1) -WRITE_SYN(rfmd2948, 0x0FFFF, 4, 0x0F, 0, 21, 0, 2) - -#undef WRITE_SYN - -static int adm8211_write_bbp(struct ieee80211_hw *dev, u8 addr, u8 data) -{ - struct adm8211_priv *priv = dev->priv; - unsigned int timeout; - u32 reg; - - timeout = 10; - while (timeout > 0) { - reg = ADM8211_CSR_READ(BBPCTL); - if (!(reg & (ADM8211_BBPCTL_WR | ADM8211_BBPCTL_RD))) - break; - timeout--; - msleep(2); - } - - if (timeout == 0) { - wiphy_debug(dev->wiphy, - "adm8211_write_bbp(%d,%d) failed prewrite (reg=0x%08x)\n", - addr, data, reg); - return -ETIMEDOUT; - } - - switch (priv->bbp_type) { - case ADM8211_TYPE_INTERSIL: - reg = ADM8211_BBPCTL_MMISEL; /* three wire interface */ - break; - case ADM8211_TYPE_RFMD: - reg = (0x20 << 24) | ADM8211_BBPCTL_TXCE | ADM8211_BBPCTL_CCAP | - (0x01 << 18); - break; - case ADM8211_TYPE_ADMTEK: - reg = (0x20 << 24) | ADM8211_BBPCTL_TXCE | ADM8211_BBPCTL_CCAP | - (0x05 << 18); - break; - } - reg |= ADM8211_BBPCTL_WR | (addr << 8) | data; - - ADM8211_CSR_WRITE(BBPCTL, reg); - - timeout = 10; - while (timeout > 0) { - reg = ADM8211_CSR_READ(BBPCTL); - if (!(reg & ADM8211_BBPCTL_WR)) - break; - timeout--; - msleep(2); - } - - if (timeout == 0) { - ADM8211_CSR_WRITE(BBPCTL, ADM8211_CSR_READ(BBPCTL) & - ~ADM8211_BBPCTL_WR); - wiphy_debug(dev->wiphy, - "adm8211_write_bbp(%d,%d) failed postwrite (reg=0x%08x)\n", - addr, data, reg); - return -ETIMEDOUT; - } - - return 0; -} - -static int adm8211_rf_set_channel(struct ieee80211_hw *dev, unsigned int chan) -{ - static const u32 adm8211_rfmd2958_reg5[] = - {0x22BD, 0x22D2, 0x22E8, 0x22FE, 0x2314, 0x232A, 0x2340, - 0x2355, 0x236B, 0x2381, 0x2397, 0x23AD, 0x23C2, 0x23F7}; - static const u32 adm8211_rfmd2958_reg6[] = - {0x05D17, 0x3A2E8, 0x2E8BA, 0x22E8B, 0x1745D, 0x0BA2E, 0x00000, - 0x345D1, 0x28BA2, 0x1D174, 0x11745, 0x05D17, 0x3A2E8, 0x11745}; - - struct adm8211_priv *priv = dev->priv; - u8 ant_power = priv->ant_power > 0x3F ? - priv->eeprom->antenna_power[chan - 1] : priv->ant_power; - u8 tx_power = priv->tx_power > 0x3F ? - priv->eeprom->tx_power[chan - 1] : priv->tx_power; - u8 lpf_cutoff = priv->lpf_cutoff == 0xFF ? - priv->eeprom->lpf_cutoff[chan - 1] : priv->lpf_cutoff; - u8 lnags_thresh = priv->lnags_threshold == 0xFF ? - priv->eeprom->lnags_threshold[chan - 1] : priv->lnags_threshold; - u32 reg; - - ADM8211_IDLE(); - - /* Program synthesizer to new channel */ - switch (priv->transceiver_type) { - case ADM8211_RFMD2958: - case ADM8211_RFMD2958_RF3000_CONTROL_POWER: - adm8211_rf_write_syn_rfmd2958(dev, 0x00, 0x04007); - adm8211_rf_write_syn_rfmd2958(dev, 0x02, 0x00033); - - adm8211_rf_write_syn_rfmd2958(dev, 0x05, - adm8211_rfmd2958_reg5[chan - 1]); - adm8211_rf_write_syn_rfmd2958(dev, 0x06, - adm8211_rfmd2958_reg6[chan - 1]); - break; - - case ADM8211_RFMD2948: - adm8211_rf_write_syn_rfmd2948(dev, SI4126_MAIN_CONF, - SI4126_MAIN_XINDIV2); - adm8211_rf_write_syn_rfmd2948(dev, SI4126_POWERDOWN, - SI4126_POWERDOWN_PDIB | - SI4126_POWERDOWN_PDRB); - adm8211_rf_write_syn_rfmd2948(dev, SI4126_PHASE_DET_GAIN, 0); - adm8211_rf_write_syn_rfmd2948(dev, SI4126_RF2_N_DIV, - (chan == 14 ? - 2110 : (2033 + (chan * 5)))); - adm8211_rf_write_syn_rfmd2948(dev, SI4126_IF_N_DIV, 1496); - adm8211_rf_write_syn_rfmd2948(dev, SI4126_RF2_R_DIV, 44); - adm8211_rf_write_syn_rfmd2948(dev, SI4126_IF_R_DIV, 44); - break; - - case ADM8211_MAX2820: - adm8211_rf_write_syn_max2820(dev, 0x3, - (chan == 14 ? 0x054 : (0x7 + (chan * 5)))); - break; - - case ADM8211_AL2210L: - adm8211_rf_write_syn_al2210l(dev, 0x0, - (chan == 14 ? 0x229B4 : (0x22967 + (chan * 5)))); - break; - - default: - wiphy_debug(dev->wiphy, "unsupported transceiver type %d\n", - priv->transceiver_type); - break; - } - - /* write BBP regs */ - if (priv->bbp_type == ADM8211_TYPE_RFMD) { - - /* SMC 2635W specific? adm8211b doesn't use the 2948 though.. */ - /* TODO: remove if SMC 2635W doesn't need this */ - if (priv->transceiver_type == ADM8211_RFMD2948) { - reg = ADM8211_CSR_READ(GPIO); - reg &= 0xfffc0000; - reg |= ADM8211_CSR_GPIO_EN0; - if (chan != 14) - reg |= ADM8211_CSR_GPIO_O0; - ADM8211_CSR_WRITE(GPIO, reg); - } - - if (priv->transceiver_type == ADM8211_RFMD2958) { - /* set PCNT2 */ - adm8211_rf_write_syn_rfmd2958(dev, 0x0B, 0x07100); - /* set PCNT1 P_DESIRED/MID_BIAS */ - reg = le16_to_cpu(priv->eeprom->cr49); - reg >>= 13; - reg <<= 15; - reg |= ant_power << 9; - adm8211_rf_write_syn_rfmd2958(dev, 0x0A, reg); - /* set TXRX TX_GAIN */ - adm8211_rf_write_syn_rfmd2958(dev, 0x09, 0x00050 | - (priv->pdev->revision < ADM8211_REV_CA ? tx_power : 0)); - } else { - reg = ADM8211_CSR_READ(PLCPHD); - reg &= 0xff00ffff; - reg |= tx_power << 18; - ADM8211_CSR_WRITE(PLCPHD, reg); - } - - ADM8211_CSR_WRITE(SYNRF, ADM8211_SYNRF_SELRF | - ADM8211_SYNRF_PE1 | ADM8211_SYNRF_PHYRST); - ADM8211_CSR_READ(SYNRF); - msleep(30); - - /* RF3000 BBP */ - if (priv->transceiver_type != ADM8211_RFMD2958) - adm8211_write_bbp(dev, RF3000_TX_VAR_GAIN__TX_LEN_EXT, - tx_power<<2); - adm8211_write_bbp(dev, RF3000_LOW_GAIN_CALIB, lpf_cutoff); - adm8211_write_bbp(dev, RF3000_HIGH_GAIN_CALIB, lnags_thresh); - adm8211_write_bbp(dev, 0x1c, priv->pdev->revision == ADM8211_REV_BA ? - priv->eeprom->cr28 : 0); - adm8211_write_bbp(dev, 0x1d, priv->eeprom->cr29); - - ADM8211_CSR_WRITE(SYNRF, 0); - - /* Nothing to do for ADMtek BBP */ - } else if (priv->bbp_type != ADM8211_TYPE_ADMTEK) - wiphy_debug(dev->wiphy, "unsupported BBP type %d\n", - priv->bbp_type); - - ADM8211_RESTORE(); - - /* update current channel for adhoc (and maybe AP mode) */ - reg = ADM8211_CSR_READ(CAP0); - reg &= ~0xF; - reg |= chan; - ADM8211_CSR_WRITE(CAP0, reg); - - return 0; -} - -static void adm8211_update_mode(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - - ADM8211_IDLE(); - - priv->soft_rx_crc = 0; - switch (priv->mode) { - case NL80211_IFTYPE_STATION: - priv->nar &= ~(ADM8211_NAR_PR | ADM8211_NAR_EA); - priv->nar |= ADM8211_NAR_ST | ADM8211_NAR_SR; - break; - case NL80211_IFTYPE_ADHOC: - priv->nar &= ~ADM8211_NAR_PR; - priv->nar |= ADM8211_NAR_EA | ADM8211_NAR_ST | ADM8211_NAR_SR; - - /* don't trust the error bits on rev 0x20 and up in adhoc */ - if (priv->pdev->revision >= ADM8211_REV_BA) - priv->soft_rx_crc = 1; - break; - case NL80211_IFTYPE_MONITOR: - priv->nar &= ~(ADM8211_NAR_EA | ADM8211_NAR_ST); - priv->nar |= ADM8211_NAR_PR | ADM8211_NAR_SR; - break; - } - - ADM8211_RESTORE(); -} - -static void adm8211_hw_init_syn(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - - switch (priv->transceiver_type) { - case ADM8211_RFMD2958: - case ADM8211_RFMD2958_RF3000_CONTROL_POWER: - /* comments taken from ADMtek vendor driver */ - - /* Reset RF2958 after power on */ - adm8211_rf_write_syn_rfmd2958(dev, 0x1F, 0x00000); - /* Initialize RF VCO Core Bias to maximum */ - adm8211_rf_write_syn_rfmd2958(dev, 0x0C, 0x3001F); - /* Initialize IF PLL */ - adm8211_rf_write_syn_rfmd2958(dev, 0x01, 0x29C03); - /* Initialize IF PLL Coarse Tuning */ - adm8211_rf_write_syn_rfmd2958(dev, 0x03, 0x1FF6F); - /* Initialize RF PLL */ - adm8211_rf_write_syn_rfmd2958(dev, 0x04, 0x29403); - /* Initialize RF PLL Coarse Tuning */ - adm8211_rf_write_syn_rfmd2958(dev, 0x07, 0x1456F); - /* Initialize TX gain and filter BW (R9) */ - adm8211_rf_write_syn_rfmd2958(dev, 0x09, - (priv->transceiver_type == ADM8211_RFMD2958 ? - 0x10050 : 0x00050)); - /* Initialize CAL register */ - adm8211_rf_write_syn_rfmd2958(dev, 0x08, 0x3FFF8); - break; - - case ADM8211_MAX2820: - adm8211_rf_write_syn_max2820(dev, 0x1, 0x01E); - adm8211_rf_write_syn_max2820(dev, 0x2, 0x001); - adm8211_rf_write_syn_max2820(dev, 0x3, 0x054); - adm8211_rf_write_syn_max2820(dev, 0x4, 0x310); - adm8211_rf_write_syn_max2820(dev, 0x5, 0x000); - break; - - case ADM8211_AL2210L: - adm8211_rf_write_syn_al2210l(dev, 0x0, 0x0196C); - adm8211_rf_write_syn_al2210l(dev, 0x1, 0x007CB); - adm8211_rf_write_syn_al2210l(dev, 0x2, 0x3582F); - adm8211_rf_write_syn_al2210l(dev, 0x3, 0x010A9); - adm8211_rf_write_syn_al2210l(dev, 0x4, 0x77280); - adm8211_rf_write_syn_al2210l(dev, 0x5, 0x45641); - adm8211_rf_write_syn_al2210l(dev, 0x6, 0xEA130); - adm8211_rf_write_syn_al2210l(dev, 0x7, 0x80000); - adm8211_rf_write_syn_al2210l(dev, 0x8, 0x7850F); - adm8211_rf_write_syn_al2210l(dev, 0x9, 0xF900C); - adm8211_rf_write_syn_al2210l(dev, 0xA, 0x00000); - adm8211_rf_write_syn_al2210l(dev, 0xB, 0x00000); - break; - - case ADM8211_RFMD2948: - default: - break; - } -} - -static int adm8211_hw_init_bbp(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - u32 reg; - - /* write addresses */ - if (priv->bbp_type == ADM8211_TYPE_INTERSIL) { - ADM8211_CSR_WRITE(MMIWA, 0x100E0C0A); - ADM8211_CSR_WRITE(MMIRD0, 0x00007C7E); - ADM8211_CSR_WRITE(MMIRD1, 0x00100000); - } else if (priv->bbp_type == ADM8211_TYPE_RFMD || - priv->bbp_type == ADM8211_TYPE_ADMTEK) { - /* check specific BBP type */ - switch (priv->specific_bbptype) { - case ADM8211_BBP_RFMD3000: - case ADM8211_BBP_RFMD3002: - ADM8211_CSR_WRITE(MMIWA, 0x00009101); - ADM8211_CSR_WRITE(MMIRD0, 0x00000301); - break; - - case ADM8211_BBP_ADM8011: - ADM8211_CSR_WRITE(MMIWA, 0x00008903); - ADM8211_CSR_WRITE(MMIRD0, 0x00001716); - - reg = ADM8211_CSR_READ(BBPCTL); - reg &= ~ADM8211_BBPCTL_TYPE; - reg |= 0x5 << 18; - ADM8211_CSR_WRITE(BBPCTL, reg); - break; - } - - switch (priv->pdev->revision) { - case ADM8211_REV_CA: - if (priv->transceiver_type == ADM8211_RFMD2958 || - priv->transceiver_type == ADM8211_RFMD2958_RF3000_CONTROL_POWER || - priv->transceiver_type == ADM8211_RFMD2948) - ADM8211_CSR_WRITE(SYNCTL, 0x1 << 22); - else if (priv->transceiver_type == ADM8211_MAX2820 || - priv->transceiver_type == ADM8211_AL2210L) - ADM8211_CSR_WRITE(SYNCTL, 0x3 << 22); - break; - - case ADM8211_REV_BA: - reg = ADM8211_CSR_READ(MMIRD1); - reg &= 0x0000FFFF; - reg |= 0x7e100000; - ADM8211_CSR_WRITE(MMIRD1, reg); - break; - - case ADM8211_REV_AB: - case ADM8211_REV_AF: - default: - ADM8211_CSR_WRITE(MMIRD1, 0x7e100000); - break; - } - - /* For RFMD */ - ADM8211_CSR_WRITE(MACTEST, 0x800); - } - - adm8211_hw_init_syn(dev); - - /* Set RF Power control IF pin to PE1+PHYRST# */ - ADM8211_CSR_WRITE(SYNRF, ADM8211_SYNRF_SELRF | - ADM8211_SYNRF_PE1 | ADM8211_SYNRF_PHYRST); - ADM8211_CSR_READ(SYNRF); - msleep(20); - - /* write BBP regs */ - if (priv->bbp_type == ADM8211_TYPE_RFMD) { - /* RF3000 BBP */ - /* another set: - * 11: c8 - * 14: 14 - * 15: 50 (chan 1..13; chan 14: d0) - * 1c: 00 - * 1d: 84 - */ - adm8211_write_bbp(dev, RF3000_CCA_CTRL, 0x80); - /* antenna selection: diversity */ - adm8211_write_bbp(dev, RF3000_DIVERSITY__RSSI, 0x80); - adm8211_write_bbp(dev, RF3000_TX_VAR_GAIN__TX_LEN_EXT, 0x74); - adm8211_write_bbp(dev, RF3000_LOW_GAIN_CALIB, 0x38); - adm8211_write_bbp(dev, RF3000_HIGH_GAIN_CALIB, 0x40); - - if (priv->eeprom->major_version < 2) { - adm8211_write_bbp(dev, 0x1c, 0x00); - adm8211_write_bbp(dev, 0x1d, 0x80); - } else { - if (priv->pdev->revision == ADM8211_REV_BA) - adm8211_write_bbp(dev, 0x1c, priv->eeprom->cr28); - else - adm8211_write_bbp(dev, 0x1c, 0x00); - - adm8211_write_bbp(dev, 0x1d, priv->eeprom->cr29); - } - } else if (priv->bbp_type == ADM8211_TYPE_ADMTEK) { - /* reset baseband */ - adm8211_write_bbp(dev, 0x00, 0xFF); - /* antenna selection: diversity */ - adm8211_write_bbp(dev, 0x07, 0x0A); - - /* TODO: find documentation for this */ - switch (priv->transceiver_type) { - case ADM8211_RFMD2958: - case ADM8211_RFMD2958_RF3000_CONTROL_POWER: - adm8211_write_bbp(dev, 0x00, 0x00); - adm8211_write_bbp(dev, 0x01, 0x00); - adm8211_write_bbp(dev, 0x02, 0x00); - adm8211_write_bbp(dev, 0x03, 0x00); - adm8211_write_bbp(dev, 0x06, 0x0f); - adm8211_write_bbp(dev, 0x09, 0x00); - adm8211_write_bbp(dev, 0x0a, 0x00); - adm8211_write_bbp(dev, 0x0b, 0x00); - adm8211_write_bbp(dev, 0x0c, 0x00); - adm8211_write_bbp(dev, 0x0f, 0xAA); - adm8211_write_bbp(dev, 0x10, 0x8c); - adm8211_write_bbp(dev, 0x11, 0x43); - adm8211_write_bbp(dev, 0x18, 0x40); - adm8211_write_bbp(dev, 0x20, 0x23); - adm8211_write_bbp(dev, 0x21, 0x02); - adm8211_write_bbp(dev, 0x22, 0x28); - adm8211_write_bbp(dev, 0x23, 0x30); - adm8211_write_bbp(dev, 0x24, 0x2d); - adm8211_write_bbp(dev, 0x28, 0x35); - adm8211_write_bbp(dev, 0x2a, 0x8c); - adm8211_write_bbp(dev, 0x2b, 0x81); - adm8211_write_bbp(dev, 0x2c, 0x44); - adm8211_write_bbp(dev, 0x2d, 0x0A); - adm8211_write_bbp(dev, 0x29, 0x40); - adm8211_write_bbp(dev, 0x60, 0x08); - adm8211_write_bbp(dev, 0x64, 0x01); - break; - - case ADM8211_MAX2820: - adm8211_write_bbp(dev, 0x00, 0x00); - adm8211_write_bbp(dev, 0x01, 0x00); - adm8211_write_bbp(dev, 0x02, 0x00); - adm8211_write_bbp(dev, 0x03, 0x00); - adm8211_write_bbp(dev, 0x06, 0x0f); - adm8211_write_bbp(dev, 0x09, 0x05); - adm8211_write_bbp(dev, 0x0a, 0x02); - adm8211_write_bbp(dev, 0x0b, 0x00); - adm8211_write_bbp(dev, 0x0c, 0x0f); - adm8211_write_bbp(dev, 0x0f, 0x55); - adm8211_write_bbp(dev, 0x10, 0x8d); - adm8211_write_bbp(dev, 0x11, 0x43); - adm8211_write_bbp(dev, 0x18, 0x4a); - adm8211_write_bbp(dev, 0x20, 0x20); - adm8211_write_bbp(dev, 0x21, 0x02); - adm8211_write_bbp(dev, 0x22, 0x23); - adm8211_write_bbp(dev, 0x23, 0x30); - adm8211_write_bbp(dev, 0x24, 0x2d); - adm8211_write_bbp(dev, 0x2a, 0x8c); - adm8211_write_bbp(dev, 0x2b, 0x81); - adm8211_write_bbp(dev, 0x2c, 0x44); - adm8211_write_bbp(dev, 0x29, 0x4a); - adm8211_write_bbp(dev, 0x60, 0x2b); - adm8211_write_bbp(dev, 0x64, 0x01); - break; - - case ADM8211_AL2210L: - adm8211_write_bbp(dev, 0x00, 0x00); - adm8211_write_bbp(dev, 0x01, 0x00); - adm8211_write_bbp(dev, 0x02, 0x00); - adm8211_write_bbp(dev, 0x03, 0x00); - adm8211_write_bbp(dev, 0x06, 0x0f); - adm8211_write_bbp(dev, 0x07, 0x05); - adm8211_write_bbp(dev, 0x08, 0x03); - adm8211_write_bbp(dev, 0x09, 0x00); - adm8211_write_bbp(dev, 0x0a, 0x00); - adm8211_write_bbp(dev, 0x0b, 0x00); - adm8211_write_bbp(dev, 0x0c, 0x10); - adm8211_write_bbp(dev, 0x0f, 0x55); - adm8211_write_bbp(dev, 0x10, 0x8d); - adm8211_write_bbp(dev, 0x11, 0x43); - adm8211_write_bbp(dev, 0x18, 0x4a); - adm8211_write_bbp(dev, 0x20, 0x20); - adm8211_write_bbp(dev, 0x21, 0x02); - adm8211_write_bbp(dev, 0x22, 0x23); - adm8211_write_bbp(dev, 0x23, 0x30); - adm8211_write_bbp(dev, 0x24, 0x2d); - adm8211_write_bbp(dev, 0x2a, 0xaa); - adm8211_write_bbp(dev, 0x2b, 0x81); - adm8211_write_bbp(dev, 0x2c, 0x44); - adm8211_write_bbp(dev, 0x29, 0xfa); - adm8211_write_bbp(dev, 0x60, 0x2d); - adm8211_write_bbp(dev, 0x64, 0x01); - break; - - case ADM8211_RFMD2948: - break; - - default: - wiphy_debug(dev->wiphy, "unsupported transceiver %d\n", - priv->transceiver_type); - break; - } - } else - wiphy_debug(dev->wiphy, "unsupported BBP %d\n", priv->bbp_type); - - ADM8211_CSR_WRITE(SYNRF, 0); - - /* Set RF CAL control source to MAC control */ - reg = ADM8211_CSR_READ(SYNCTL); - reg |= ADM8211_SYNCTL_SELCAL; - ADM8211_CSR_WRITE(SYNCTL, reg); - - return 0; -} - -/* configures hw beacons/probe responses */ -static int adm8211_set_rate(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - u32 reg; - int i = 0; - u8 rate_buf[12] = {0}; - - /* write supported rates */ - if (priv->pdev->revision != ADM8211_REV_BA) { - rate_buf[0] = ARRAY_SIZE(adm8211_rates); - for (i = 0; i < ARRAY_SIZE(adm8211_rates); i++) - rate_buf[i + 1] = (adm8211_rates[i].bitrate / 5) | 0x80; - } else { - /* workaround for rev BA specific bug */ - rate_buf[0] = 0x04; - rate_buf[1] = 0x82; - rate_buf[2] = 0x04; - rate_buf[3] = 0x0b; - rate_buf[4] = 0x16; - } - - adm8211_write_sram_bytes(dev, ADM8211_SRAM_SUPP_RATE, rate_buf, - ARRAY_SIZE(adm8211_rates) + 1); - - reg = ADM8211_CSR_READ(PLCPHD) & 0x00FFFFFF; /* keep bits 0-23 */ - reg |= 1 << 15; /* short preamble */ - reg |= 110 << 24; - ADM8211_CSR_WRITE(PLCPHD, reg); - - /* MTMLT = 512 TU (max TX MSDU lifetime) - * BCNTSIG = plcp_signal (beacon, probe resp, and atim TX rate) - * SRTYLIM = 224 (short retry limit, TX header value is default) */ - ADM8211_CSR_WRITE(TXLMT, (512 << 16) | (110 << 8) | (224 << 0)); - - return 0; -} - -static void adm8211_hw_init(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - u32 reg; - u8 cline; - - reg = ADM8211_CSR_READ(PAR); - reg |= ADM8211_PAR_MRLE | ADM8211_PAR_MRME; - reg &= ~(ADM8211_PAR_BAR | ADM8211_PAR_CAL); - - if (!pci_set_mwi(priv->pdev)) { - reg |= 0x1 << 24; - pci_read_config_byte(priv->pdev, PCI_CACHE_LINE_SIZE, &cline); - - switch (cline) { - case 0x8: reg |= (0x1 << 14); - break; - case 0x16: reg |= (0x2 << 14); - break; - case 0x32: reg |= (0x3 << 14); - break; - default: reg |= (0x0 << 14); - break; - } - } - - ADM8211_CSR_WRITE(PAR, reg); - - reg = ADM8211_CSR_READ(CSR_TEST1); - reg &= ~(0xF << 28); - reg |= (1 << 28) | (1 << 31); - ADM8211_CSR_WRITE(CSR_TEST1, reg); - - /* lose link after 4 lost beacons */ - reg = (0x04 << 21) | ADM8211_WCSR_TSFTWE | ADM8211_WCSR_LSOE; - ADM8211_CSR_WRITE(WCSR, reg); - - /* Disable APM, enable receive FIFO threshold, and set drain receive - * threshold to store-and-forward */ - reg = ADM8211_CSR_READ(CMDR); - reg &= ~(ADM8211_CMDR_APM | ADM8211_CMDR_DRT); - reg |= ADM8211_CMDR_RTE | ADM8211_CMDR_DRT_SF; - ADM8211_CSR_WRITE(CMDR, reg); - - adm8211_set_rate(dev); - - /* 4-bit values: - * PWR1UP = 8 * 2 ms - * PWR0PAPE = 8 us or 5 us - * PWR1PAPE = 1 us or 3 us - * PWR0TRSW = 5 us - * PWR1TRSW = 12 us - * PWR0PE2 = 13 us - * PWR1PE2 = 1 us - * PWR0TXPE = 8 or 6 */ - if (priv->pdev->revision < ADM8211_REV_CA) - ADM8211_CSR_WRITE(TOFS2, 0x8815cd18); - else - ADM8211_CSR_WRITE(TOFS2, 0x8535cd16); - - /* Enable store and forward for transmit */ - priv->nar = ADM8211_NAR_SF | ADM8211_NAR_PB; - ADM8211_CSR_WRITE(NAR, priv->nar); - - /* Reset RF */ - ADM8211_CSR_WRITE(SYNRF, ADM8211_SYNRF_RADIO); - ADM8211_CSR_READ(SYNRF); - msleep(10); - ADM8211_CSR_WRITE(SYNRF, 0); - ADM8211_CSR_READ(SYNRF); - msleep(5); - - /* Set CFP Max Duration to 0x10 TU */ - reg = ADM8211_CSR_READ(CFPP); - reg &= ~(0xffff << 8); - reg |= 0x0010 << 8; - ADM8211_CSR_WRITE(CFPP, reg); - - /* USCNT = 0x16 (number of system clocks, 22 MHz, in 1us - * TUCNT = 0x3ff - Tu counter 1024 us */ - ADM8211_CSR_WRITE(TOFS0, (0x16 << 24) | 0x3ff); - - /* SLOT=20 us, SIFS=110 cycles of 22 MHz (5 us), - * DIFS=50 us, EIFS=100 us */ - if (priv->pdev->revision < ADM8211_REV_CA) - ADM8211_CSR_WRITE(IFST, (20 << 23) | (110 << 15) | - (50 << 9) | 100); - else - ADM8211_CSR_WRITE(IFST, (20 << 23) | (24 << 15) | - (50 << 9) | 100); - - /* PCNT = 1 (MAC idle time awake/sleep, unit S) - * RMRD = 2346 * 8 + 1 us (max RX duration) */ - ADM8211_CSR_WRITE(RMD, (1 << 16) | 18769); - - /* MART=65535 us, MIRT=256 us, TSFTOFST=0 us */ - ADM8211_CSR_WRITE(RSPT, 0xffffff00); - - /* Initialize BBP (and SYN) */ - adm8211_hw_init_bbp(dev); - - /* make sure interrupts are off */ - ADM8211_CSR_WRITE(IER, 0); - - /* ACK interrupts */ - ADM8211_CSR_WRITE(STSR, ADM8211_CSR_READ(STSR)); - - /* Setup WEP (turns it off for now) */ - reg = ADM8211_CSR_READ(MACTEST); - reg &= ~(7 << 20); - ADM8211_CSR_WRITE(MACTEST, reg); - - reg = ADM8211_CSR_READ(WEPCTL); - reg &= ~ADM8211_WEPCTL_WEPENABLE; - reg |= ADM8211_WEPCTL_WEPRXBYP; - ADM8211_CSR_WRITE(WEPCTL, reg); - - /* Clear the missed-packet counter. */ - ADM8211_CSR_READ(LPC); -} - -static int adm8211_hw_reset(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - u32 reg, tmp; - int timeout = 100; - - /* Power-on issue */ - /* TODO: check if this is necessary */ - ADM8211_CSR_WRITE(FRCTL, 0); - - /* Reset the chip */ - tmp = ADM8211_CSR_READ(PAR); - ADM8211_CSR_WRITE(PAR, ADM8211_PAR_SWR); - - while ((ADM8211_CSR_READ(PAR) & ADM8211_PAR_SWR) && timeout--) - msleep(50); - - if (timeout <= 0) - return -ETIMEDOUT; - - ADM8211_CSR_WRITE(PAR, tmp); - - if (priv->pdev->revision == ADM8211_REV_BA && - (priv->transceiver_type == ADM8211_RFMD2958_RF3000_CONTROL_POWER || - priv->transceiver_type == ADM8211_RFMD2958)) { - reg = ADM8211_CSR_READ(CSR_TEST1); - reg |= (1 << 4) | (1 << 5); - ADM8211_CSR_WRITE(CSR_TEST1, reg); - } else if (priv->pdev->revision == ADM8211_REV_CA) { - reg = ADM8211_CSR_READ(CSR_TEST1); - reg &= ~((1 << 4) | (1 << 5)); - ADM8211_CSR_WRITE(CSR_TEST1, reg); - } - - ADM8211_CSR_WRITE(FRCTL, 0); - - reg = ADM8211_CSR_READ(CSR_TEST0); - reg |= ADM8211_CSR_TEST0_EPRLD; /* EEPROM Recall */ - ADM8211_CSR_WRITE(CSR_TEST0, reg); - - adm8211_clear_sram(dev); - - return 0; -} - -static u64 adm8211_get_tsft(struct ieee80211_hw *dev, - struct ieee80211_vif *vif) -{ - struct adm8211_priv *priv = dev->priv; - u32 tsftl; - u64 tsft; - - tsftl = ADM8211_CSR_READ(TSFTL); - tsft = ADM8211_CSR_READ(TSFTH); - tsft <<= 32; - tsft |= tsftl; - - return tsft; -} - -static void adm8211_set_interval(struct ieee80211_hw *dev, - unsigned short bi, unsigned short li) -{ - struct adm8211_priv *priv = dev->priv; - u32 reg; - - /* BP (beacon interval) = data->beacon_interval - * LI (listen interval) = data->listen_interval (in beacon intervals) */ - reg = (bi << 16) | li; - ADM8211_CSR_WRITE(BPLI, reg); -} - -static void adm8211_set_bssid(struct ieee80211_hw *dev, const u8 *bssid) -{ - struct adm8211_priv *priv = dev->priv; - u32 reg; - - ADM8211_CSR_WRITE(BSSID0, le32_to_cpu(*(__le32 *)bssid)); - reg = ADM8211_CSR_READ(ABDA1); - reg &= 0x0000ffff; - reg |= (bssid[4] << 16) | (bssid[5] << 24); - ADM8211_CSR_WRITE(ABDA1, reg); -} - -static int adm8211_config(struct ieee80211_hw *dev, u32 changed) -{ - struct adm8211_priv *priv = dev->priv; - struct ieee80211_conf *conf = &dev->conf; - int channel = - ieee80211_frequency_to_channel(conf->chandef.chan->center_freq); - - if (channel != priv->channel) { - priv->channel = channel; - adm8211_rf_set_channel(dev, priv->channel); - } - - return 0; -} - -static void adm8211_bss_info_changed(struct ieee80211_hw *dev, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *conf, - u32 changes) -{ - struct adm8211_priv *priv = dev->priv; - - if (!(changes & BSS_CHANGED_BSSID)) - return; - - if (memcmp(conf->bssid, priv->bssid, ETH_ALEN)) { - adm8211_set_bssid(dev, conf->bssid); - memcpy(priv->bssid, conf->bssid, ETH_ALEN); - } -} - -static u64 adm8211_prepare_multicast(struct ieee80211_hw *hw, - struct netdev_hw_addr_list *mc_list) -{ - unsigned int bit_nr; - u32 mc_filter[2]; - struct netdev_hw_addr *ha; - - mc_filter[1] = mc_filter[0] = 0; - - netdev_hw_addr_list_for_each(ha, mc_list) { - bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26; - - bit_nr &= 0x3F; - mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31); - } - - return mc_filter[0] | ((u64)(mc_filter[1]) << 32); -} - -static void adm8211_configure_filter(struct ieee80211_hw *dev, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast) -{ - static const u8 bcast[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - struct adm8211_priv *priv = dev->priv; - unsigned int new_flags; - u32 mc_filter[2]; - - mc_filter[0] = multicast; - mc_filter[1] = multicast >> 32; - - new_flags = 0; - - if (*total_flags & FIF_PROMISC_IN_BSS) { - new_flags |= FIF_PROMISC_IN_BSS; - priv->nar |= ADM8211_NAR_PR; - priv->nar &= ~ADM8211_NAR_MM; - mc_filter[1] = mc_filter[0] = ~0; - } else if (*total_flags & FIF_ALLMULTI || multicast == ~(0ULL)) { - new_flags |= FIF_ALLMULTI; - priv->nar &= ~ADM8211_NAR_PR; - priv->nar |= ADM8211_NAR_MM; - mc_filter[1] = mc_filter[0] = ~0; - } else { - priv->nar &= ~(ADM8211_NAR_MM | ADM8211_NAR_PR); - } - - ADM8211_IDLE_RX(); - - ADM8211_CSR_WRITE(MAR0, mc_filter[0]); - ADM8211_CSR_WRITE(MAR1, mc_filter[1]); - ADM8211_CSR_READ(NAR); - - if (priv->nar & ADM8211_NAR_PR) - dev->flags |= IEEE80211_HW_RX_INCLUDES_FCS; - else - dev->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS; - - if (*total_flags & FIF_BCN_PRBRESP_PROMISC) - adm8211_set_bssid(dev, bcast); - else - adm8211_set_bssid(dev, priv->bssid); - - ADM8211_RESTORE(); - - *total_flags = new_flags; -} - -static int adm8211_add_interface(struct ieee80211_hw *dev, - struct ieee80211_vif *vif) -{ - struct adm8211_priv *priv = dev->priv; - if (priv->mode != NL80211_IFTYPE_MONITOR) - return -EOPNOTSUPP; - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - priv->mode = vif->type; - break; - default: - return -EOPNOTSUPP; - } - - ADM8211_IDLE(); - - ADM8211_CSR_WRITE(PAR0, le32_to_cpu(*(__le32 *)vif->addr)); - ADM8211_CSR_WRITE(PAR1, le16_to_cpu(*(__le16 *)(vif->addr + 4))); - - adm8211_update_mode(dev); - - ADM8211_RESTORE(); - - return 0; -} - -static void adm8211_remove_interface(struct ieee80211_hw *dev, - struct ieee80211_vif *vif) -{ - struct adm8211_priv *priv = dev->priv; - priv->mode = NL80211_IFTYPE_MONITOR; -} - -static int adm8211_init_rings(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - struct adm8211_desc *desc = NULL; - struct adm8211_rx_ring_info *rx_info; - struct adm8211_tx_ring_info *tx_info; - unsigned int i; - - for (i = 0; i < priv->rx_ring_size; i++) { - desc = &priv->rx_ring[i]; - desc->status = 0; - desc->length = cpu_to_le32(RX_PKT_SIZE); - priv->rx_buffers[i].skb = NULL; - } - /* Mark the end of RX ring; hw returns to base address after this - * descriptor */ - desc->length |= cpu_to_le32(RDES1_CONTROL_RER); - - for (i = 0; i < priv->rx_ring_size; i++) { - desc = &priv->rx_ring[i]; - rx_info = &priv->rx_buffers[i]; - - rx_info->skb = dev_alloc_skb(RX_PKT_SIZE); - if (rx_info->skb == NULL) - break; - rx_info->mapping = pci_map_single(priv->pdev, - skb_tail_pointer(rx_info->skb), - RX_PKT_SIZE, - PCI_DMA_FROMDEVICE); - desc->buffer1 = cpu_to_le32(rx_info->mapping); - desc->status = cpu_to_le32(RDES0_STATUS_OWN | RDES0_STATUS_SQL); - } - - /* Setup TX ring. TX buffers descriptors will be filled in as needed */ - for (i = 0; i < priv->tx_ring_size; i++) { - desc = &priv->tx_ring[i]; - tx_info = &priv->tx_buffers[i]; - - tx_info->skb = NULL; - tx_info->mapping = 0; - desc->status = 0; - } - desc->length = cpu_to_le32(TDES1_CONTROL_TER); - - priv->cur_rx = priv->cur_tx = priv->dirty_tx = 0; - ADM8211_CSR_WRITE(RDB, priv->rx_ring_dma); - ADM8211_CSR_WRITE(TDBD, priv->tx_ring_dma); - - return 0; -} - -static void adm8211_free_rings(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - unsigned int i; - - for (i = 0; i < priv->rx_ring_size; i++) { - if (!priv->rx_buffers[i].skb) - continue; - - pci_unmap_single( - priv->pdev, - priv->rx_buffers[i].mapping, - RX_PKT_SIZE, PCI_DMA_FROMDEVICE); - - dev_kfree_skb(priv->rx_buffers[i].skb); - } - - for (i = 0; i < priv->tx_ring_size; i++) { - if (!priv->tx_buffers[i].skb) - continue; - - pci_unmap_single(priv->pdev, - priv->tx_buffers[i].mapping, - priv->tx_buffers[i].skb->len, - PCI_DMA_TODEVICE); - - dev_kfree_skb(priv->tx_buffers[i].skb); - } -} - -static int adm8211_start(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - int retval; - - /* Power up MAC and RF chips */ - retval = adm8211_hw_reset(dev); - if (retval) { - wiphy_err(dev->wiphy, "hardware reset failed\n"); - goto fail; - } - - retval = adm8211_init_rings(dev); - if (retval) { - wiphy_err(dev->wiphy, "failed to initialize rings\n"); - goto fail; - } - - /* Init hardware */ - adm8211_hw_init(dev); - adm8211_rf_set_channel(dev, priv->channel); - - retval = request_irq(priv->pdev->irq, adm8211_interrupt, - IRQF_SHARED, "adm8211", dev); - if (retval) { - wiphy_err(dev->wiphy, "failed to register IRQ handler\n"); - goto fail; - } - - ADM8211_CSR_WRITE(IER, ADM8211_IER_NIE | ADM8211_IER_AIE | - ADM8211_IER_RCIE | ADM8211_IER_TCIE | - ADM8211_IER_TDUIE | ADM8211_IER_GPTIE); - priv->mode = NL80211_IFTYPE_MONITOR; - adm8211_update_mode(dev); - ADM8211_CSR_WRITE(RDR, 0); - - adm8211_set_interval(dev, 100, 10); - return 0; - -fail: - return retval; -} - -static void adm8211_stop(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - - priv->mode = NL80211_IFTYPE_UNSPECIFIED; - priv->nar = 0; - ADM8211_CSR_WRITE(NAR, 0); - ADM8211_CSR_WRITE(IER, 0); - ADM8211_CSR_READ(NAR); - - free_irq(priv->pdev->irq, dev); - - adm8211_free_rings(dev); -} - -static void adm8211_calc_durations(int *dur, int *plcp, size_t payload_len, int len, - int plcp_signal, int short_preamble) -{ - /* Alternative calculation from NetBSD: */ - -/* IEEE 802.11b durations for DSSS PHY in microseconds */ -#define IEEE80211_DUR_DS_LONG_PREAMBLE 144 -#define IEEE80211_DUR_DS_SHORT_PREAMBLE 72 -#define IEEE80211_DUR_DS_FAST_PLCPHDR 24 -#define IEEE80211_DUR_DS_SLOW_PLCPHDR 48 -#define IEEE80211_DUR_DS_SLOW_ACK 112 -#define IEEE80211_DUR_DS_FAST_ACK 56 -#define IEEE80211_DUR_DS_SLOW_CTS 112 -#define IEEE80211_DUR_DS_FAST_CTS 56 -#define IEEE80211_DUR_DS_SLOT 20 -#define IEEE80211_DUR_DS_SIFS 10 - - int remainder; - - *dur = (80 * (24 + payload_len) + plcp_signal - 1) - / plcp_signal; - - if (plcp_signal <= PLCP_SIGNAL_2M) - /* 1-2Mbps WLAN: send ACK/CTS at 1Mbps */ - *dur += 3 * (IEEE80211_DUR_DS_SIFS + - IEEE80211_DUR_DS_SHORT_PREAMBLE + - IEEE80211_DUR_DS_FAST_PLCPHDR) + - IEEE80211_DUR_DS_SLOW_CTS + IEEE80211_DUR_DS_SLOW_ACK; - else - /* 5-11Mbps WLAN: send ACK/CTS at 2Mbps */ - *dur += 3 * (IEEE80211_DUR_DS_SIFS + - IEEE80211_DUR_DS_SHORT_PREAMBLE + - IEEE80211_DUR_DS_FAST_PLCPHDR) + - IEEE80211_DUR_DS_FAST_CTS + IEEE80211_DUR_DS_FAST_ACK; - - /* lengthen duration if long preamble */ - if (!short_preamble) - *dur += 3 * (IEEE80211_DUR_DS_LONG_PREAMBLE - - IEEE80211_DUR_DS_SHORT_PREAMBLE) + - 3 * (IEEE80211_DUR_DS_SLOW_PLCPHDR - - IEEE80211_DUR_DS_FAST_PLCPHDR); - - - *plcp = (80 * len) / plcp_signal; - remainder = (80 * len) % plcp_signal; - if (plcp_signal == PLCP_SIGNAL_11M && - remainder <= 30 && remainder > 0) - *plcp = (*plcp | 0x8000) + 1; - else if (remainder) - (*plcp)++; -} - -/* Transmit skb w/adm8211_tx_hdr (802.11 header created by hardware) */ -static void adm8211_tx_raw(struct ieee80211_hw *dev, struct sk_buff *skb, - u16 plcp_signal, - size_t hdrlen) -{ - struct adm8211_priv *priv = dev->priv; - unsigned long flags; - dma_addr_t mapping; - unsigned int entry; - u32 flag; - - mapping = pci_map_single(priv->pdev, skb->data, skb->len, - PCI_DMA_TODEVICE); - - spin_lock_irqsave(&priv->lock, flags); - - if (priv->cur_tx - priv->dirty_tx == priv->tx_ring_size / 2) - flag = TDES1_CONTROL_IC | TDES1_CONTROL_LS | TDES1_CONTROL_FS; - else - flag = TDES1_CONTROL_LS | TDES1_CONTROL_FS; - - if (priv->cur_tx - priv->dirty_tx == priv->tx_ring_size - 2) - ieee80211_stop_queue(dev, 0); - - entry = priv->cur_tx % priv->tx_ring_size; - - priv->tx_buffers[entry].skb = skb; - priv->tx_buffers[entry].mapping = mapping; - priv->tx_buffers[entry].hdrlen = hdrlen; - priv->tx_ring[entry].buffer1 = cpu_to_le32(mapping); - - if (entry == priv->tx_ring_size - 1) - flag |= TDES1_CONTROL_TER; - priv->tx_ring[entry].length = cpu_to_le32(flag | skb->len); - - /* Set TX rate (SIGNAL field in PLCP PPDU format) */ - flag = TDES0_CONTROL_OWN | (plcp_signal << 20) | 8 /* ? */; - priv->tx_ring[entry].status = cpu_to_le32(flag); - - priv->cur_tx++; - - spin_unlock_irqrestore(&priv->lock, flags); - - /* Trigger transmit poll */ - ADM8211_CSR_WRITE(TDR, 0); -} - -/* Put adm8211_tx_hdr on skb and transmit */ -static void adm8211_tx(struct ieee80211_hw *dev, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct adm8211_tx_hdr *txhdr; - size_t payload_len, hdrlen; - int plcp, dur, len, plcp_signal, short_preamble; - struct ieee80211_hdr *hdr; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_rate *txrate = ieee80211_get_tx_rate(dev, info); - u8 rc_flags; - - rc_flags = info->control.rates[0].flags; - short_preamble = !!(rc_flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE); - plcp_signal = txrate->bitrate; - - hdr = (struct ieee80211_hdr *)skb->data; - hdrlen = ieee80211_hdrlen(hdr->frame_control); - memcpy(skb->cb, skb->data, hdrlen); - hdr = (struct ieee80211_hdr *)skb->cb; - skb_pull(skb, hdrlen); - payload_len = skb->len; - - txhdr = (struct adm8211_tx_hdr *) skb_push(skb, sizeof(*txhdr)); - memset(txhdr, 0, sizeof(*txhdr)); - memcpy(txhdr->da, ieee80211_get_DA(hdr), ETH_ALEN); - txhdr->signal = plcp_signal; - txhdr->frame_body_size = cpu_to_le16(payload_len); - txhdr->frame_control = hdr->frame_control; - - len = hdrlen + payload_len + FCS_LEN; - - txhdr->frag = cpu_to_le16(0x0FFF); - adm8211_calc_durations(&dur, &plcp, payload_len, - len, plcp_signal, short_preamble); - txhdr->plcp_frag_head_len = cpu_to_le16(plcp); - txhdr->plcp_frag_tail_len = cpu_to_le16(plcp); - txhdr->dur_frag_head = cpu_to_le16(dur); - txhdr->dur_frag_tail = cpu_to_le16(dur); - - txhdr->header_control = cpu_to_le16(ADM8211_TXHDRCTL_ENABLE_EXTEND_HEADER); - - if (short_preamble) - txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_SHORT_PREAMBLE); - - if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) - txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_ENABLE_RTS); - - txhdr->retry_limit = info->control.rates[0].count; - - adm8211_tx_raw(dev, skb, plcp_signal, hdrlen); -} - -static int adm8211_alloc_rings(struct ieee80211_hw *dev) -{ - struct adm8211_priv *priv = dev->priv; - unsigned int ring_size; - - priv->rx_buffers = kmalloc(sizeof(*priv->rx_buffers) * priv->rx_ring_size + - sizeof(*priv->tx_buffers) * priv->tx_ring_size, GFP_KERNEL); - if (!priv->rx_buffers) - return -ENOMEM; - - priv->tx_buffers = (void *)priv->rx_buffers + - sizeof(*priv->rx_buffers) * priv->rx_ring_size; - - /* Allocate TX/RX descriptors */ - ring_size = sizeof(struct adm8211_desc) * priv->rx_ring_size + - sizeof(struct adm8211_desc) * priv->tx_ring_size; - priv->rx_ring = pci_alloc_consistent(priv->pdev, ring_size, - &priv->rx_ring_dma); - - if (!priv->rx_ring) { - kfree(priv->rx_buffers); - priv->rx_buffers = NULL; - priv->tx_buffers = NULL; - return -ENOMEM; - } - - priv->tx_ring = priv->rx_ring + priv->rx_ring_size; - priv->tx_ring_dma = priv->rx_ring_dma + - sizeof(struct adm8211_desc) * priv->rx_ring_size; - - return 0; -} - -static const struct ieee80211_ops adm8211_ops = { - .tx = adm8211_tx, - .start = adm8211_start, - .stop = adm8211_stop, - .add_interface = adm8211_add_interface, - .remove_interface = adm8211_remove_interface, - .config = adm8211_config, - .bss_info_changed = adm8211_bss_info_changed, - .prepare_multicast = adm8211_prepare_multicast, - .configure_filter = adm8211_configure_filter, - .get_stats = adm8211_get_stats, - .get_tsf = adm8211_get_tsft -}; - -static int adm8211_probe(struct pci_dev *pdev, - const struct pci_device_id *id) -{ - struct ieee80211_hw *dev; - struct adm8211_priv *priv; - unsigned long mem_addr, mem_len; - unsigned int io_addr, io_len; - int err; - u32 reg; - u8 perm_addr[ETH_ALEN]; - - err = pci_enable_device(pdev); - if (err) { - printk(KERN_ERR "%s (adm8211): Cannot enable new PCI device\n", - pci_name(pdev)); - return err; - } - - io_addr = pci_resource_start(pdev, 0); - io_len = pci_resource_len(pdev, 0); - mem_addr = pci_resource_start(pdev, 1); - mem_len = pci_resource_len(pdev, 1); - if (io_len < 256 || mem_len < 1024) { - printk(KERN_ERR "%s (adm8211): Too short PCI resources\n", - pci_name(pdev)); - goto err_disable_pdev; - } - - - /* check signature */ - pci_read_config_dword(pdev, 0x80 /* CR32 */, ®); - if (reg != ADM8211_SIG1 && reg != ADM8211_SIG2) { - printk(KERN_ERR "%s (adm8211): Invalid signature (0x%x)\n", - pci_name(pdev), reg); - goto err_disable_pdev; - } - - err = pci_request_regions(pdev, "adm8211"); - if (err) { - printk(KERN_ERR "%s (adm8211): Cannot obtain PCI resources\n", - pci_name(pdev)); - return err; /* someone else grabbed it? don't disable it */ - } - - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) || - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { - printk(KERN_ERR "%s (adm8211): No suitable DMA available\n", - pci_name(pdev)); - goto err_free_reg; - } - - pci_set_master(pdev); - - dev = ieee80211_alloc_hw(sizeof(*priv), &adm8211_ops); - if (!dev) { - printk(KERN_ERR "%s (adm8211): ieee80211 alloc failed\n", - pci_name(pdev)); - err = -ENOMEM; - goto err_free_reg; - } - priv = dev->priv; - priv->pdev = pdev; - - spin_lock_init(&priv->lock); - - SET_IEEE80211_DEV(dev, &pdev->dev); - - pci_set_drvdata(pdev, dev); - - priv->map = pci_iomap(pdev, 1, mem_len); - if (!priv->map) - priv->map = pci_iomap(pdev, 0, io_len); - - if (!priv->map) { - printk(KERN_ERR "%s (adm8211): Cannot map device memory\n", - pci_name(pdev)); - goto err_free_dev; - } - - priv->rx_ring_size = rx_ring_size; - priv->tx_ring_size = tx_ring_size; - - if (adm8211_alloc_rings(dev)) { - printk(KERN_ERR "%s (adm8211): Cannot allocate TX/RX ring\n", - pci_name(pdev)); - goto err_iounmap; - } - - *(__le32 *)perm_addr = cpu_to_le32(ADM8211_CSR_READ(PAR0)); - *(__le16 *)&perm_addr[4] = - cpu_to_le16(ADM8211_CSR_READ(PAR1) & 0xFFFF); - - if (!is_valid_ether_addr(perm_addr)) { - printk(KERN_WARNING "%s (adm8211): Invalid hwaddr in EEPROM!\n", - pci_name(pdev)); - eth_random_addr(perm_addr); - } - SET_IEEE80211_PERM_ADDR(dev, perm_addr); - - dev->extra_tx_headroom = sizeof(struct adm8211_tx_hdr); - /* dev->flags = IEEE80211_HW_RX_INCLUDES_FCS in promisc mode */ - dev->flags = IEEE80211_HW_SIGNAL_UNSPEC; - dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); - - dev->channel_change_time = 1000; - dev->max_signal = 100; /* FIXME: find better value */ - - dev->queues = 1; /* ADM8211C supports more, maybe ADM8211B too */ - - priv->retry_limit = 3; - priv->ant_power = 0x40; - priv->tx_power = 0x40; - priv->lpf_cutoff = 0xFF; - priv->lnags_threshold = 0xFF; - priv->mode = NL80211_IFTYPE_UNSPECIFIED; - - /* Power-on issue. EEPROM won't read correctly without */ - if (pdev->revision >= ADM8211_REV_BA) { - ADM8211_CSR_WRITE(FRCTL, 0); - ADM8211_CSR_READ(FRCTL); - ADM8211_CSR_WRITE(FRCTL, 1); - ADM8211_CSR_READ(FRCTL); - msleep(100); - } - - err = adm8211_read_eeprom(dev); - if (err) { - printk(KERN_ERR "%s (adm8211): Can't alloc eeprom buffer\n", - pci_name(pdev)); - goto err_free_desc; - } - - priv->channel = 1; - - dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band; - - err = ieee80211_register_hw(dev); - if (err) { - printk(KERN_ERR "%s (adm8211): Cannot register device\n", - pci_name(pdev)); - goto err_free_eeprom; - } - - wiphy_info(dev->wiphy, "hwaddr %pM, Rev 0x%02x\n", - dev->wiphy->perm_addr, pdev->revision); - - return 0; - - err_free_eeprom: - kfree(priv->eeprom); - - err_free_desc: - pci_free_consistent(pdev, - sizeof(struct adm8211_desc) * priv->rx_ring_size + - sizeof(struct adm8211_desc) * priv->tx_ring_size, - priv->rx_ring, priv->rx_ring_dma); - kfree(priv->rx_buffers); - - err_iounmap: - pci_iounmap(pdev, priv->map); - - err_free_dev: - pci_set_drvdata(pdev, NULL); - ieee80211_free_hw(dev); - - err_free_reg: - pci_release_regions(pdev); - - err_disable_pdev: - pci_disable_device(pdev); - return err; -} - - -static void adm8211_remove(struct pci_dev *pdev) -{ - struct ieee80211_hw *dev = pci_get_drvdata(pdev); - struct adm8211_priv *priv; - - if (!dev) - return; - - ieee80211_unregister_hw(dev); - - priv = dev->priv; - - pci_free_consistent(pdev, - sizeof(struct adm8211_desc) * priv->rx_ring_size + - sizeof(struct adm8211_desc) * priv->tx_ring_size, - priv->rx_ring, priv->rx_ring_dma); - - kfree(priv->rx_buffers); - kfree(priv->eeprom); - pci_iounmap(pdev, priv->map); - pci_release_regions(pdev); - pci_disable_device(pdev); - ieee80211_free_hw(dev); -} - - -#ifdef CONFIG_PM -static int adm8211_suspend(struct pci_dev *pdev, pm_message_t state) -{ - pci_save_state(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); - return 0; -} - -static int adm8211_resume(struct pci_dev *pdev) -{ - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); - return 0; -} -#endif /* CONFIG_PM */ - - -MODULE_DEVICE_TABLE(pci, adm8211_pci_id_table); - -/* TODO: implement enable_wake */ -static struct pci_driver adm8211_driver = { - .name = "adm8211", - .id_table = adm8211_pci_id_table, - .probe = adm8211_probe, - .remove = adm8211_remove, -#ifdef CONFIG_PM - .suspend = adm8211_suspend, - .resume = adm8211_resume, -#endif /* CONFIG_PM */ -}; - -module_pci_driver(adm8211_driver); diff --git a/drivers/net/wireless/adm8211.h b/drivers/net/wireless/adm8211.h deleted file mode 100644 index bbc10b1cde87..000000000000 --- a/drivers/net/wireless/adm8211.h +++ /dev/null @@ -1,602 +0,0 @@ -#ifndef ADM8211_H -#define ADM8211_H - -/* ADM8211 Registers */ - -/* CR32 (SIG) signature */ -#define ADM8211_SIG1 0x82011317 /* ADM8211A */ -#define ADM8211_SIG2 0x82111317 /* ADM8211B/ADM8211C */ - -#define ADM8211_CSR_READ(r) ioread32(&priv->map->r) -#define ADM8211_CSR_WRITE(r, val) iowrite32((val), &priv->map->r) - -/* CSR (Host Control and Status Registers) */ -struct adm8211_csr { - __le32 PAR; /* 0x00 CSR0 */ - __le32 FRCTL; /* 0x04 CSR0A */ - __le32 TDR; /* 0x08 CSR1 */ - __le32 WTDP; /* 0x0C CSR1A */ - __le32 RDR; /* 0x10 CSR2 */ - __le32 WRDP; /* 0x14 CSR2A */ - __le32 RDB; /* 0x18 CSR3 */ - __le32 TDBH; /* 0x1C CSR3A */ - __le32 TDBD; /* 0x20 CSR4 */ - __le32 TDBP; /* 0x24 CSR4A */ - __le32 STSR; /* 0x28 CSR5 */ - __le32 TDBB; /* 0x2C CSR5A */ - __le32 NAR; /* 0x30 CSR6 */ - __le32 CSR6A; /* reserved */ - __le32 IER; /* 0x38 CSR7 */ - __le32 TKIPSCEP; /* 0x3C CSR7A */ - __le32 LPC; /* 0x40 CSR8 */ - __le32 CSR_TEST1; /* 0x44 CSR8A */ - __le32 SPR; /* 0x48 CSR9 */ - __le32 CSR_TEST0; /* 0x4C CSR9A */ - __le32 WCSR; /* 0x50 CSR10 */ - __le32 WPDR; /* 0x54 CSR10A */ - __le32 GPTMR; /* 0x58 CSR11 */ - __le32 GPIO; /* 0x5C CSR11A */ - __le32 BBPCTL; /* 0x60 CSR12 */ - __le32 SYNCTL; /* 0x64 CSR12A */ - __le32 PLCPHD; /* 0x68 CSR13 */ - __le32 MMIWA; /* 0x6C CSR13A */ - __le32 MMIRD0; /* 0x70 CSR14 */ - __le32 MMIRD1; /* 0x74 CSR14A */ - __le32 TXBR; /* 0x78 CSR15 */ - __le32 SYNDATA; /* 0x7C CSR15A */ - __le32 ALCS; /* 0x80 CSR16 */ - __le32 TOFS2; /* 0x84 CSR17 */ - __le32 CMDR; /* 0x88 CSR18 */ - __le32 PCIC; /* 0x8C CSR19 */ - __le32 PMCSR; /* 0x90 CSR20 */ - __le32 PAR0; /* 0x94 CSR21 */ - __le32 PAR1; /* 0x98 CSR22 */ - __le32 MAR0; /* 0x9C CSR23 */ - __le32 MAR1; /* 0xA0 CSR24 */ - __le32 ATIMDA0; /* 0xA4 CSR25 */ - __le32 ABDA1; /* 0xA8 CSR26 */ - __le32 BSSID0; /* 0xAC CSR27 */ - __le32 TXLMT; /* 0xB0 CSR28 */ - __le32 MIBCNT; /* 0xB4 CSR29 */ - __le32 BCNT; /* 0xB8 CSR30 */ - __le32 TSFTH; /* 0xBC CSR31 */ - __le32 TSC; /* 0xC0 CSR32 */ - __le32 SYNRF; /* 0xC4 CSR33 */ - __le32 BPLI; /* 0xC8 CSR34 */ - __le32 CAP0; /* 0xCC CSR35 */ - __le32 CAP1; /* 0xD0 CSR36 */ - __le32 RMD; /* 0xD4 CSR37 */ - __le32 CFPP; /* 0xD8 CSR38 */ - __le32 TOFS0; /* 0xDC CSR39 */ - __le32 TOFS1; /* 0xE0 CSR40 */ - __le32 IFST; /* 0xE4 CSR41 */ - __le32 RSPT; /* 0xE8 CSR42 */ - __le32 TSFTL; /* 0xEC CSR43 */ - __le32 WEPCTL; /* 0xF0 CSR44 */ - __le32 WESK; /* 0xF4 CSR45 */ - __le32 WEPCNT; /* 0xF8 CSR46 */ - __le32 MACTEST; /* 0xFC CSR47 */ - __le32 FER; /* 0x100 */ - __le32 FEMR; /* 0x104 */ - __le32 FPSR; /* 0x108 */ - __le32 FFER; /* 0x10C */ -} __packed; - -/* CSR0 - PAR (PCI Address Register) */ -#define ADM8211_PAR_MWIE (1 << 24) -#define ADM8211_PAR_MRLE (1 << 23) -#define ADM8211_PAR_MRME (1 << 21) -#define ADM8211_PAR_RAP ((1 << 18) | (1 << 17)) -#define ADM8211_PAR_CAL ((1 << 15) | (1 << 14)) -#define ADM8211_PAR_PBL 0x00003f00 -#define ADM8211_PAR_BLE (1 << 7) -#define ADM8211_PAR_DSL 0x0000007c -#define ADM8211_PAR_BAR (1 << 1) -#define ADM8211_PAR_SWR (1 << 0) - -/* CSR1 - FRCTL (Frame Control Register) */ -#define ADM8211_FRCTL_PWRMGT (1 << 31) -#define ADM8211_FRCTL_MAXPSP (1 << 27) -#define ADM8211_FRCTL_DRVPRSP (1 << 26) -#define ADM8211_FRCTL_DRVBCON (1 << 25) -#define ADM8211_FRCTL_AID 0x0000ffff -#define ADM8211_FRCTL_AID_ON 0x0000c000 - -/* CSR5 - STSR (Status Register) */ -#define ADM8211_STSR_PCF (1 << 31) -#define ADM8211_STSR_BCNTC (1 << 30) -#define ADM8211_STSR_GPINT (1 << 29) -#define ADM8211_STSR_LinkOff (1 << 28) -#define ADM8211_STSR_ATIMTC (1 << 27) -#define ADM8211_STSR_TSFTF (1 << 26) -#define ADM8211_STSR_TSCZ (1 << 25) -#define ADM8211_STSR_LinkOn (1 << 24) -#define ADM8211_STSR_SQL (1 << 23) -#define ADM8211_STSR_WEPTD (1 << 22) -#define ADM8211_STSR_ATIME (1 << 21) -#define ADM8211_STSR_TBTT (1 << 20) -#define ADM8211_STSR_NISS (1 << 16) -#define ADM8211_STSR_AISS (1 << 15) -#define ADM8211_STSR_TEIS (1 << 14) -#define ADM8211_STSR_FBE (1 << 13) -#define ADM8211_STSR_REIS (1 << 12) -#define ADM8211_STSR_GPTT (1 << 11) -#define ADM8211_STSR_RPS (1 << 8) -#define ADM8211_STSR_RDU (1 << 7) -#define ADM8211_STSR_RCI (1 << 6) -#define ADM8211_STSR_TUF (1 << 5) -#define ADM8211_STSR_TRT (1 << 4) -#define ADM8211_STSR_TLT (1 << 3) -#define ADM8211_STSR_TDU (1 << 2) -#define ADM8211_STSR_TPS (1 << 1) -#define ADM8211_STSR_TCI (1 << 0) - -/* CSR6 - NAR (Network Access Register) */ -#define ADM8211_NAR_TXCF (1 << 31) -#define ADM8211_NAR_HF (1 << 30) -#define ADM8211_NAR_UTR (1 << 29) -#define ADM8211_NAR_SQ (1 << 28) -#define ADM8211_NAR_CFP (1 << 27) -#define ADM8211_NAR_SF (1 << 21) -#define ADM8211_NAR_TR ((1 << 15) | (1 << 14)) -#define ADM8211_NAR_ST (1 << 13) -#define ADM8211_NAR_OM ((1 << 11) | (1 << 10)) -#define ADM8211_NAR_MM (1 << 7) -#define ADM8211_NAR_PR (1 << 6) -#define ADM8211_NAR_EA (1 << 5) -#define ADM8211_NAR_PB (1 << 3) -#define ADM8211_NAR_STPDMA (1 << 2) -#define ADM8211_NAR_SR (1 << 1) -#define ADM8211_NAR_CTX (1 << 0) - -#define ADM8211_IDLE() \ -do { \ - if (priv->nar & (ADM8211_NAR_SR | ADM8211_NAR_ST)) { \ - ADM8211_CSR_WRITE(NAR, priv->nar & \ - ~(ADM8211_NAR_SR | ADM8211_NAR_ST));\ - ADM8211_CSR_READ(NAR); \ - msleep(20); \ - } \ -} while (0) - -#define ADM8211_IDLE_RX() \ -do { \ - if (priv->nar & ADM8211_NAR_SR) { \ - ADM8211_CSR_WRITE(NAR, priv->nar & ~ADM8211_NAR_SR); \ - ADM8211_CSR_READ(NAR); \ - mdelay(20); \ - } \ -} while (0) - -#define ADM8211_RESTORE() \ -do { \ - if (priv->nar & (ADM8211_NAR_SR | ADM8211_NAR_ST)) \ - ADM8211_CSR_WRITE(NAR, priv->nar); \ -} while (0) - -/* CSR7 - IER (Interrupt Enable Register) */ -#define ADM8211_IER_PCFIE (1 << 31) -#define ADM8211_IER_BCNTCIE (1 << 30) -#define ADM8211_IER_GPIE (1 << 29) -#define ADM8211_IER_LinkOffIE (1 << 28) -#define ADM8211_IER_ATIMTCIE (1 << 27) -#define ADM8211_IER_TSFTFIE (1 << 26) -#define ADM8211_IER_TSCZE (1 << 25) -#define ADM8211_IER_LinkOnIE (1 << 24) -#define ADM8211_IER_SQLIE (1 << 23) -#define ADM8211_IER_WEPIE (1 << 22) -#define ADM8211_IER_ATIMEIE (1 << 21) -#define ADM8211_IER_TBTTIE (1 << 20) -#define ADM8211_IER_NIE (1 << 16) -#define ADM8211_IER_AIE (1 << 15) -#define ADM8211_IER_TEIE (1 << 14) -#define ADM8211_IER_FBEIE (1 << 13) -#define ADM8211_IER_REIE (1 << 12) -#define ADM8211_IER_GPTIE (1 << 11) -#define ADM8211_IER_RSIE (1 << 8) -#define ADM8211_IER_RUIE (1 << 7) -#define ADM8211_IER_RCIE (1 << 6) -#define ADM8211_IER_TUIE (1 << 5) -#define ADM8211_IER_TRTIE (1 << 4) -#define ADM8211_IER_TLTTIE (1 << 3) -#define ADM8211_IER_TDUIE (1 << 2) -#define ADM8211_IER_TPSIE (1 << 1) -#define ADM8211_IER_TCIE (1 << 0) - -/* CSR9 - SPR (Serial Port Register) */ -#define ADM8211_SPR_SRS (1 << 11) -#define ADM8211_SPR_SDO (1 << 3) -#define ADM8211_SPR_SDI (1 << 2) -#define ADM8211_SPR_SCLK (1 << 1) -#define ADM8211_SPR_SCS (1 << 0) - -/* CSR9A - CSR_TEST0 */ -#define ADM8211_CSR_TEST0_EPNE (1 << 18) -#define ADM8211_CSR_TEST0_EPSNM (1 << 17) -#define ADM8211_CSR_TEST0_EPTYP (1 << 16) -#define ADM8211_CSR_TEST0_EPRLD (1 << 15) - -/* CSR10 - WCSR (Wake-up Control/Status Register) */ -#define ADM8211_WCSR_CRCT (1 << 30) -#define ADM8211_WCSR_TSFTWE (1 << 20) -#define ADM8211_WCSR_TIMWE (1 << 19) -#define ADM8211_WCSR_ATIMWE (1 << 18) -#define ADM8211_WCSR_KEYWE (1 << 17) -#define ADM8211_WCSR_MPRE (1 << 9) -#define ADM8211_WCSR_LSOE (1 << 8) -#define ADM8211_WCSR_KEYUP (1 << 6) -#define ADM8211_WCSR_TSFTW (1 << 5) -#define ADM8211_WCSR_TIMW (1 << 4) -#define ADM8211_WCSR_ATIMW (1 << 3) -#define ADM8211_WCSR_MPR (1 << 1) -#define ADM8211_WCSR_LSO (1 << 0) - -/* CSR11A - GPIO */ -#define ADM8211_CSR_GPIO_EN5 (1 << 17) -#define ADM8211_CSR_GPIO_EN4 (1 << 16) -#define ADM8211_CSR_GPIO_EN3 (1 << 15) -#define ADM8211_CSR_GPIO_EN2 (1 << 14) -#define ADM8211_CSR_GPIO_EN1 (1 << 13) -#define ADM8211_CSR_GPIO_EN0 (1 << 12) -#define ADM8211_CSR_GPIO_O5 (1 << 11) -#define ADM8211_CSR_GPIO_O4 (1 << 10) -#define ADM8211_CSR_GPIO_O3 (1 << 9) -#define ADM8211_CSR_GPIO_O2 (1 << 8) -#define ADM8211_CSR_GPIO_O1 (1 << 7) -#define ADM8211_CSR_GPIO_O0 (1 << 6) -#define ADM8211_CSR_GPIO_IN 0x0000003f - -/* CSR12 - BBPCTL (BBP Control port) */ -#define ADM8211_BBPCTL_MMISEL (1 << 31) -#define ADM8211_BBPCTL_SPICADD (0x7F << 24) -#define ADM8211_BBPCTL_RF3000 (0x20 << 24) -#define ADM8211_BBPCTL_TXCE (1 << 23) -#define ADM8211_BBPCTL_RXCE (1 << 22) -#define ADM8211_BBPCTL_CCAP (1 << 21) -#define ADM8211_BBPCTL_TYPE 0x001c0000 -#define ADM8211_BBPCTL_WR (1 << 17) -#define ADM8211_BBPCTL_RD (1 << 16) -#define ADM8211_BBPCTL_ADDR 0x0000ff00 -#define ADM8211_BBPCTL_DATA 0x000000ff - -/* CSR12A - SYNCTL (Synthesizer Control port) */ -#define ADM8211_SYNCTL_WR (1 << 31) -#define ADM8211_SYNCTL_RD (1 << 30) -#define ADM8211_SYNCTL_CS0 (1 << 29) -#define ADM8211_SYNCTL_CS1 (1 << 28) -#define ADM8211_SYNCTL_CAL (1 << 27) -#define ADM8211_SYNCTL_SELCAL (1 << 26) -#define ADM8211_SYNCTL_RFtype ((1 << 24) | (1 << 23) | (1 << 22)) -#define ADM8211_SYNCTL_RFMD (1 << 22) -#define ADM8211_SYNCTL_GENERAL (0x7 << 22) -/* SYNCTL 21:0 Data (Si4126: 18-bit data, 4-bit address) */ - -/* CSR18 - CMDR (Command Register) */ -#define ADM8211_CMDR_PM (1 << 19) -#define ADM8211_CMDR_APM (1 << 18) -#define ADM8211_CMDR_RTE (1 << 4) -#define ADM8211_CMDR_DRT ((1 << 3) | (1 << 2)) -#define ADM8211_CMDR_DRT_8DW (0x0 << 2) -#define ADM8211_CMDR_DRT_16DW (0x1 << 2) -#define ADM8211_CMDR_DRT_SF (0x2 << 2) - -/* CSR33 - SYNRF (SYNRF direct control) */ -#define ADM8211_SYNRF_SELSYN (1 << 31) -#define ADM8211_SYNRF_SELRF (1 << 30) -#define ADM8211_SYNRF_LERF (1 << 29) -#define ADM8211_SYNRF_LEIF (1 << 28) -#define ADM8211_SYNRF_SYNCLK (1 << 27) -#define ADM8211_SYNRF_SYNDATA (1 << 26) -#define ADM8211_SYNRF_PE1 (1 << 25) -#define ADM8211_SYNRF_PE2 (1 << 24) -#define ADM8211_SYNRF_PA_PE (1 << 23) -#define ADM8211_SYNRF_TR_SW (1 << 22) -#define ADM8211_SYNRF_TR_SWN (1 << 21) -#define ADM8211_SYNRF_RADIO (1 << 20) -#define ADM8211_SYNRF_CAL_EN (1 << 19) -#define ADM8211_SYNRF_PHYRST (1 << 18) - -#define ADM8211_SYNRF_IF_SELECT_0 (1 << 31) -#define ADM8211_SYNRF_IF_SELECT_1 ((1 << 31) | (1 << 28)) -#define ADM8211_SYNRF_WRITE_SYNDATA_0 (1 << 31) -#define ADM8211_SYNRF_WRITE_SYNDATA_1 ((1 << 31) | (1 << 26)) -#define ADM8211_SYNRF_WRITE_CLOCK_0 (1 << 31) -#define ADM8211_SYNRF_WRITE_CLOCK_1 ((1 << 31) | (1 << 27)) - -/* CSR44 - WEPCTL (WEP Control) */ -#define ADM8211_WEPCTL_WEPENABLE (1 << 31) -#define ADM8211_WEPCTL_WPAENABLE (1 << 30) -#define ADM8211_WEPCTL_CURRENT_TABLE (1 << 29) -#define ADM8211_WEPCTL_TABLE_WR (1 << 28) -#define ADM8211_WEPCTL_TABLE_RD (1 << 27) -#define ADM8211_WEPCTL_WEPRXBYP (1 << 25) -#define ADM8211_WEPCTL_SEL_WEPTABLE (1 << 23) -#define ADM8211_WEPCTL_ADDR (0x000001ff) - -/* CSR45 - WESK (Data Entry for Share/Individual Key) */ -#define ADM8211_WESK_DATA (0x0000ffff) - -/* FER (Function Event Register) */ -#define ADM8211_FER_INTR_EV_ENT (1 << 15) - - -/* Si4126 RF Synthesizer - Control Registers */ -#define SI4126_MAIN_CONF 0 -#define SI4126_PHASE_DET_GAIN 1 -#define SI4126_POWERDOWN 2 -#define SI4126_RF1_N_DIV 3 /* only Si4136 */ -#define SI4126_RF2_N_DIV 4 -#define SI4126_IF_N_DIV 5 -#define SI4126_RF1_R_DIV 6 /* only Si4136 */ -#define SI4126_RF2_R_DIV 7 -#define SI4126_IF_R_DIV 8 - -/* Main Configuration */ -#define SI4126_MAIN_XINDIV2 (1 << 6) -#define SI4126_MAIN_IFDIV ((1 << 11) | (1 << 10)) -/* Powerdown */ -#define SI4126_POWERDOWN_PDIB (1 << 1) -#define SI4126_POWERDOWN_PDRB (1 << 0) - - -/* RF3000 BBP - Control Port Registers */ -/* 0x00 - reserved */ -#define RF3000_MODEM_CTRL__RX_STATUS 0x01 -#define RF3000_CCA_CTRL 0x02 -#define RF3000_DIVERSITY__RSSI 0x03 -#define RF3000_RX_SIGNAL_FIELD 0x04 -#define RF3000_RX_LEN_MSB 0x05 -#define RF3000_RX_LEN_LSB 0x06 -#define RF3000_RX_SERVICE_FIELD 0x07 -#define RF3000_TX_VAR_GAIN__TX_LEN_EXT 0x11 -#define RF3000_TX_LEN_MSB 0x12 -#define RF3000_TX_LEN_LSB 0x13 -#define RF3000_LOW_GAIN_CALIB 0x14 -#define RF3000_HIGH_GAIN_CALIB 0x15 - -/* ADM8211 revisions */ -#define ADM8211_REV_AB 0x11 -#define ADM8211_REV_AF 0x15 -#define ADM8211_REV_BA 0x20 -#define ADM8211_REV_CA 0x30 - -struct adm8211_desc { - __le32 status; - __le32 length; - __le32 buffer1; - __le32 buffer2; -}; - -#define RDES0_STATUS_OWN (1 << 31) -#define RDES0_STATUS_ES (1 << 30) -#define RDES0_STATUS_SQL (1 << 29) -#define RDES0_STATUS_DE (1 << 28) -#define RDES0_STATUS_FS (1 << 27) -#define RDES0_STATUS_LS (1 << 26) -#define RDES0_STATUS_PCF (1 << 25) -#define RDES0_STATUS_SFDE (1 << 24) -#define RDES0_STATUS_SIGE (1 << 23) -#define RDES0_STATUS_CRC16E (1 << 22) -#define RDES0_STATUS_RXTOE (1 << 21) -#define RDES0_STATUS_CRC32E (1 << 20) -#define RDES0_STATUS_ICVE (1 << 19) -#define RDES0_STATUS_DA1 (1 << 17) -#define RDES0_STATUS_DA0 (1 << 16) -#define RDES0_STATUS_RXDR ((1 << 15) | (1 << 14) | (1 << 13) | (1 << 12)) -#define RDES0_STATUS_FL (0x00000fff) - -#define RDES1_CONTROL_RER (1 << 25) -#define RDES1_CONTROL_RCH (1 << 24) -#define RDES1_CONTROL_RBS2 (0x00fff000) -#define RDES1_CONTROL_RBS1 (0x00000fff) - -#define RDES1_STATUS_RSSI (0x0000007f) - - -#define TDES0_CONTROL_OWN (1 << 31) -#define TDES0_CONTROL_DONE (1 << 30) -#define TDES0_CONTROL_TXDR (0x0ff00000) - -#define TDES0_STATUS_OWN (1 << 31) -#define TDES0_STATUS_DONE (1 << 30) -#define TDES0_STATUS_ES (1 << 29) -#define TDES0_STATUS_TLT (1 << 28) -#define TDES0_STATUS_TRT (1 << 27) -#define TDES0_STATUS_TUF (1 << 26) -#define TDES0_STATUS_TRO (1 << 25) -#define TDES0_STATUS_SOFBR (1 << 24) -#define TDES0_STATUS_ACR (0x00000fff) - -#define TDES1_CONTROL_IC (1 << 31) -#define TDES1_CONTROL_LS (1 << 30) -#define TDES1_CONTROL_FS (1 << 29) -#define TDES1_CONTROL_TER (1 << 25) -#define TDES1_CONTROL_TCH (1 << 24) -#define TDES1_CONTROL_RBS2 (0x00fff000) -#define TDES1_CONTROL_RBS1 (0x00000fff) - -/* SRAM offsets */ -#define ADM8211_SRAM(x) (priv->pdev->revision < ADM8211_REV_BA ? \ - ADM8211_SRAM_A_ ## x : ADM8211_SRAM_B_ ## x) - -#define ADM8211_SRAM_INDIV_KEY 0x0000 -#define ADM8211_SRAM_A_SHARE_KEY 0x0160 -#define ADM8211_SRAM_B_SHARE_KEY 0x00c0 - -#define ADM8211_SRAM_A_SSID 0x0180 -#define ADM8211_SRAM_B_SSID 0x00d4 -#define ADM8211_SRAM_SSID ADM8211_SRAM(SSID) - -#define ADM8211_SRAM_A_SUPP_RATE 0x0191 -#define ADM8211_SRAM_B_SUPP_RATE 0x00dd -#define ADM8211_SRAM_SUPP_RATE ADM8211_SRAM(SUPP_RATE) - -#define ADM8211_SRAM_A_SIZE 0x0200 -#define ADM8211_SRAM_B_SIZE 0x01c0 -#define ADM8211_SRAM_SIZE ADM8211_SRAM(SIZE) - -struct adm8211_rx_ring_info { - struct sk_buff *skb; - dma_addr_t mapping; -}; - -struct adm8211_tx_ring_info { - struct sk_buff *skb; - dma_addr_t mapping; - size_t hdrlen; -}; - -#define PLCP_SIGNAL_1M 0x0a -#define PLCP_SIGNAL_2M 0x14 -#define PLCP_SIGNAL_5M5 0x37 -#define PLCP_SIGNAL_11M 0x6e - -struct adm8211_tx_hdr { - u8 da[6]; - u8 signal; /* PLCP signal / TX rate in 100 Kbps */ - u8 service; - __le16 frame_body_size; - __le16 frame_control; - __le16 plcp_frag_tail_len; - __le16 plcp_frag_head_len; - __le16 dur_frag_tail; - __le16 dur_frag_head; - u8 addr4[6]; - -#define ADM8211_TXHDRCTL_SHORT_PREAMBLE (1 << 0) -#define ADM8211_TXHDRCTL_MORE_FRAG (1 << 1) -#define ADM8211_TXHDRCTL_MORE_DATA (1 << 2) -#define ADM8211_TXHDRCTL_FRAG_NO (1 << 3) /* ? */ -#define ADM8211_TXHDRCTL_ENABLE_RTS (1 << 4) -#define ADM8211_TXHDRCTL_ENABLE_WEP_ENGINE (1 << 5) -#define ADM8211_TXHDRCTL_ENABLE_EXTEND_HEADER (1 << 15) /* ? */ - __le16 header_control; - __le16 frag; - u8 reserved_0; - u8 retry_limit; - - u32 wep2key0; - u32 wep2key1; - u32 wep2key2; - u32 wep2key3; - - u8 keyid; - u8 entry_control; // huh?? - u16 reserved_1; - u32 reserved_2; -} __packed; - - -#define RX_COPY_BREAK 128 -#define RX_PKT_SIZE 2500 - -struct adm8211_eeprom { - __le16 signature; /* 0x00 */ - u8 major_version; /* 0x02 */ - u8 minor_version; /* 0x03 */ - u8 reserved_1[4]; /* 0x04 */ - u8 hwaddr[6]; /* 0x08 */ - u8 reserved_2[8]; /* 0x1E */ - __le16 cr49; /* 0x16 */ - u8 cr03; /* 0x18 */ - u8 cr28; /* 0x19 */ - u8 cr29; /* 0x1A */ - u8 country_code; /* 0x1B */ - -/* specific bbp types */ -#define ADM8211_BBP_RFMD3000 0x00 -#define ADM8211_BBP_RFMD3002 0x01 -#define ADM8211_BBP_ADM8011 0x04 - u8 specific_bbptype; /* 0x1C */ - u8 specific_rftype; /* 0x1D */ - u8 reserved_3[2]; /* 0x1E */ - __le16 device_id; /* 0x20 */ - __le16 vendor_id; /* 0x22 */ - __le16 subsystem_id; /* 0x24 */ - __le16 subsystem_vendor_id; /* 0x26 */ - u8 maxlat; /* 0x28 */ - u8 mingnt; /* 0x29 */ - __le16 cis_pointer_low; /* 0x2A */ - __le16 cis_pointer_high; /* 0x2C */ - __le16 csr18; /* 0x2E */ - u8 reserved_4[16]; /* 0x30 */ - u8 d1_pwrdara; /* 0x40 */ - u8 d0_pwrdara; /* 0x41 */ - u8 d3_pwrdara; /* 0x42 */ - u8 d2_pwrdara; /* 0x43 */ - u8 antenna_power[14]; /* 0x44 */ - __le16 cis_wordcnt; /* 0x52 */ - u8 tx_power[14]; /* 0x54 */ - u8 lpf_cutoff[14]; /* 0x62 */ - u8 lnags_threshold[14]; /* 0x70 */ - __le16 checksum; /* 0x7E */ - u8 cis_data[0]; /* 0x80, 384 bytes */ -} __packed; - -struct adm8211_priv { - struct pci_dev *pdev; - spinlock_t lock; - struct adm8211_csr __iomem *map; - struct adm8211_desc *rx_ring; - struct adm8211_desc *tx_ring; - dma_addr_t rx_ring_dma; - dma_addr_t tx_ring_dma; - struct adm8211_rx_ring_info *rx_buffers; - struct adm8211_tx_ring_info *tx_buffers; - unsigned int rx_ring_size, tx_ring_size; - unsigned int cur_tx, dirty_tx, cur_rx; - - struct ieee80211_low_level_stats stats; - struct ieee80211_supported_band band; - struct ieee80211_channel channels[14]; - int mode; - - int channel; - u8 bssid[ETH_ALEN]; - - u8 soft_rx_crc; - u8 retry_limit; - - u8 ant_power; - u8 tx_power; - u8 lpf_cutoff; - u8 lnags_threshold; - struct adm8211_eeprom *eeprom; - size_t eeprom_len; - - u32 nar; - -#define ADM8211_TYPE_INTERSIL 0x00 -#define ADM8211_TYPE_RFMD 0x01 -#define ADM8211_TYPE_MARVEL 0x02 -#define ADM8211_TYPE_AIROHA 0x03 -#define ADM8211_TYPE_ADMTEK 0x05 - unsigned int rf_type:3; - unsigned int bbp_type:3; - - u8 specific_bbptype; - enum { - ADM8211_RFMD2948 = 0x0, - ADM8211_RFMD2958 = 0x1, - ADM8211_RFMD2958_RF3000_CONTROL_POWER = 0x2, - ADM8211_MAX2820 = 0x8, - ADM8211_AL2210L = 0xC, /* Airoha */ - } transceiver_type; -}; - -struct ieee80211_chan_range { - u8 min; - u8 max; -}; - -static const struct ieee80211_chan_range cranges[] = { - {1, 11}, /* FCC */ - {1, 11}, /* IC */ - {1, 13}, /* ETSI */ - {10, 11}, /* SPAIN */ - {10, 13}, /* FRANCE */ - {14, 14}, /* MMK */ - {1, 14}, /* MMK2 */ -}; - -#endif /* ADM8211_H */ diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c deleted file mode 100644 index 6125adb520a3..000000000000 --- a/drivers/net/wireless/airo.c +++ /dev/null @@ -1,8222 +0,0 @@ -/*====================================================================== - - Aironet driver for 4500 and 4800 series cards - - This code is released under both the GPL version 2 and BSD licenses. - Either license may be used. The respective licenses are found at - the end of this file. - - This code was developed by Benjamin Reed - including portions of which come from the Aironet PC4500 - Developer's Reference Manual and used with permission. Copyright - (C) 1999 Benjamin Reed. All Rights Reserved. Permission to use - code in the Developer's manual was granted for this driver by - Aironet. Major code contributions were received from Javier Achirica - and Jean Tourrilhes . - Code was also integrated from the Cisco Aironet driver for Linux. - Support for MPI350 cards was added by Fabrice Bellet - . - -======================================================================*/ - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "airo.h" - -#define DRV_NAME "airo" - -#ifdef CONFIG_PCI -static DEFINE_PCI_DEVICE_TABLE(card_ids) = { - { 0x14b9, 1, PCI_ANY_ID, PCI_ANY_ID, }, - { 0x14b9, 0x4500, PCI_ANY_ID, PCI_ANY_ID }, - { 0x14b9, 0x4800, PCI_ANY_ID, PCI_ANY_ID, }, - { 0x14b9, 0x0340, PCI_ANY_ID, PCI_ANY_ID, }, - { 0x14b9, 0x0350, PCI_ANY_ID, PCI_ANY_ID, }, - { 0x14b9, 0x5000, PCI_ANY_ID, PCI_ANY_ID, }, - { 0x14b9, 0xa504, PCI_ANY_ID, PCI_ANY_ID, }, - { 0, } -}; -MODULE_DEVICE_TABLE(pci, card_ids); - -static int airo_pci_probe(struct pci_dev *, const struct pci_device_id *); -static void airo_pci_remove(struct pci_dev *); -static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state); -static int airo_pci_resume(struct pci_dev *pdev); - -static struct pci_driver airo_driver = { - .name = DRV_NAME, - .id_table = card_ids, - .probe = airo_pci_probe, - .remove = airo_pci_remove, - .suspend = airo_pci_suspend, - .resume = airo_pci_resume, -}; -#endif /* CONFIG_PCI */ - -/* Include Wireless Extension definition and check version - Jean II */ -#include -#define WIRELESS_SPY /* enable iwspy support */ - -#define CISCO_EXT /* enable Cisco extensions */ -#ifdef CISCO_EXT -#include -#endif - -/* Hack to do some power saving */ -#define POWER_ON_DOWN - -/* As you can see this list is HUGH! - I really don't know what a lot of these counts are about, but they - are all here for completeness. If the IGNLABEL macro is put in - infront of the label, that statistic will not be included in the list - of statistics in the /proc filesystem */ - -#define IGNLABEL(comment) NULL -static const char *statsLabels[] = { - "RxOverrun", - IGNLABEL("RxPlcpCrcErr"), - IGNLABEL("RxPlcpFormatErr"), - IGNLABEL("RxPlcpLengthErr"), - "RxMacCrcErr", - "RxMacCrcOk", - "RxWepErr", - "RxWepOk", - "RetryLong", - "RetryShort", - "MaxRetries", - "NoAck", - "NoCts", - "RxAck", - "RxCts", - "TxAck", - "TxRts", - "TxCts", - "TxMc", - "TxBc", - "TxUcFrags", - "TxUcPackets", - "TxBeacon", - "RxBeacon", - "TxSinColl", - "TxMulColl", - "DefersNo", - "DefersProt", - "DefersEngy", - "DupFram", - "RxFragDisc", - "TxAged", - "RxAged", - "LostSync-MaxRetry", - "LostSync-MissedBeacons", - "LostSync-ArlExceeded", - "LostSync-Deauth", - "LostSync-Disassoced", - "LostSync-TsfTiming", - "HostTxMc", - "HostTxBc", - "HostTxUc", - "HostTxFail", - "HostRxMc", - "HostRxBc", - "HostRxUc", - "HostRxDiscard", - IGNLABEL("HmacTxMc"), - IGNLABEL("HmacTxBc"), - IGNLABEL("HmacTxUc"), - IGNLABEL("HmacTxFail"), - IGNLABEL("HmacRxMc"), - IGNLABEL("HmacRxBc"), - IGNLABEL("HmacRxUc"), - IGNLABEL("HmacRxDiscard"), - IGNLABEL("HmacRxAccepted"), - "SsidMismatch", - "ApMismatch", - "RatesMismatch", - "AuthReject", - "AuthTimeout", - "AssocReject", - "AssocTimeout", - IGNLABEL("ReasonOutsideTable"), - IGNLABEL("ReasonStatus1"), - IGNLABEL("ReasonStatus2"), - IGNLABEL("ReasonStatus3"), - IGNLABEL("ReasonStatus4"), - IGNLABEL("ReasonStatus5"), - IGNLABEL("ReasonStatus6"), - IGNLABEL("ReasonStatus7"), - IGNLABEL("ReasonStatus8"), - IGNLABEL("ReasonStatus9"), - IGNLABEL("ReasonStatus10"), - IGNLABEL("ReasonStatus11"), - IGNLABEL("ReasonStatus12"), - IGNLABEL("ReasonStatus13"), - IGNLABEL("ReasonStatus14"), - IGNLABEL("ReasonStatus15"), - IGNLABEL("ReasonStatus16"), - IGNLABEL("ReasonStatus17"), - IGNLABEL("ReasonStatus18"), - IGNLABEL("ReasonStatus19"), - "RxMan", - "TxMan", - "RxRefresh", - "TxRefresh", - "RxPoll", - "TxPoll", - "HostRetries", - "LostSync-HostReq", - "HostTxBytes", - "HostRxBytes", - "ElapsedUsec", - "ElapsedSec", - "LostSyncBetterAP", - "PrivacyMismatch", - "Jammed", - "DiscRxNotWepped", - "PhyEleMismatch", - (char*)-1 }; -#ifndef RUN_AT -#define RUN_AT(x) (jiffies+(x)) -#endif - - -/* These variables are for insmod, since it seems that the rates - can only be set in setup_card. Rates should be a comma separated - (no spaces) list of rates (up to 8). */ - -static int rates[8]; -static char *ssids[3]; - -static int io[4]; -static int irq[4]; - -static -int maxencrypt /* = 0 */; /* The highest rate that the card can encrypt at. - 0 means no limit. For old cards this was 4 */ - -static int auto_wep /* = 0 */; /* If set, it tries to figure out the wep mode */ -static int aux_bap /* = 0 */; /* Checks to see if the aux ports are needed to read - the bap, needed on some older cards and buses. */ -static int adhoc; - -static int probe = 1; - -static kuid_t proc_kuid; -static int proc_uid /* = 0 */; - -static kgid_t proc_kgid; -static int proc_gid /* = 0 */; - -static int airo_perm = 0555; - -static int proc_perm = 0644; - -MODULE_AUTHOR("Benjamin Reed"); -MODULE_DESCRIPTION("Support for Cisco/Aironet 802.11 wireless ethernet cards. " - "Direct support for ISA/PCI/MPI cards and support for PCMCIA when used with airo_cs."); -MODULE_LICENSE("Dual BSD/GPL"); -MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340/350"); -module_param_array(io, int, NULL, 0); -module_param_array(irq, int, NULL, 0); -module_param_array(rates, int, NULL, 0); -module_param_array(ssids, charp, NULL, 0); -module_param(auto_wep, int, 0); -MODULE_PARM_DESC(auto_wep, - "If non-zero, the driver will keep looping through the authentication options until an association is made. " - "The value of auto_wep is number of the wep keys to check. " - "A value of 2 will try using the key at index 0 and index 1."); -module_param(aux_bap, int, 0); -MODULE_PARM_DESC(aux_bap, - "If non-zero, the driver will switch into a mode that seems to work better for older cards with some older buses. " - "Before switching it checks that the switch is needed."); -module_param(maxencrypt, int, 0); -MODULE_PARM_DESC(maxencrypt, - "The maximum speed that the card can do encryption. " - "Units are in 512kbs. " - "Zero (default) means there is no limit. " - "Older cards used to be limited to 2mbs (4)."); -module_param(adhoc, int, 0); -MODULE_PARM_DESC(adhoc, "If non-zero, the card will start in adhoc mode."); -module_param(probe, int, 0); -MODULE_PARM_DESC(probe, "If zero, the driver won't start the card."); - -module_param(proc_uid, int, 0); -MODULE_PARM_DESC(proc_uid, "The uid that the /proc files will belong to."); -module_param(proc_gid, int, 0); -MODULE_PARM_DESC(proc_gid, "The gid that the /proc files will belong to."); -module_param(airo_perm, int, 0); -MODULE_PARM_DESC(airo_perm, "The permission bits of /proc/[driver/]aironet."); -module_param(proc_perm, int, 0); -MODULE_PARM_DESC(proc_perm, "The permission bits of the files in /proc"); - -/* This is a kind of sloppy hack to get this information to OUT4500 and - IN4500. I would be extremely interested in the situation where this - doesn't work though!!! */ -static int do8bitIO /* = 0 */; - -/* Return codes */ -#define SUCCESS 0 -#define ERROR -1 -#define NO_PACKET -2 - -/* Commands */ -#define NOP2 0x0000 -#define MAC_ENABLE 0x0001 -#define MAC_DISABLE 0x0002 -#define CMD_LOSE_SYNC 0x0003 /* Not sure what this does... */ -#define CMD_SOFTRESET 0x0004 -#define HOSTSLEEP 0x0005 -#define CMD_MAGIC_PKT 0x0006 -#define CMD_SETWAKEMASK 0x0007 -#define CMD_READCFG 0x0008 -#define CMD_SETMODE 0x0009 -#define CMD_ALLOCATETX 0x000a -#define CMD_TRANSMIT 0x000b -#define CMD_DEALLOCATETX 0x000c -#define NOP 0x0010 -#define CMD_WORKAROUND 0x0011 -#define CMD_ALLOCATEAUX 0x0020 -#define CMD_ACCESS 0x0021 -#define CMD_PCIBAP 0x0022 -#define CMD_PCIAUX 0x0023 -#define CMD_ALLOCBUF 0x0028 -#define CMD_GETTLV 0x0029 -#define CMD_PUTTLV 0x002a -#define CMD_DELTLV 0x002b -#define CMD_FINDNEXTTLV 0x002c -#define CMD_PSPNODES 0x0030 -#define CMD_SETCW 0x0031 -#define CMD_SETPCF 0x0032 -#define CMD_SETPHYREG 0x003e -#define CMD_TXTEST 0x003f -#define MAC_ENABLETX 0x0101 -#define CMD_LISTBSS 0x0103 -#define CMD_SAVECFG 0x0108 -#define CMD_ENABLEAUX 0x0111 -#define CMD_WRITERID 0x0121 -#define CMD_USEPSPNODES 0x0130 -#define MAC_ENABLERX 0x0201 - -/* Command errors */ -#define ERROR_QUALIF 0x00 -#define ERROR_ILLCMD 0x01 -#define ERROR_ILLFMT 0x02 -#define ERROR_INVFID 0x03 -#define ERROR_INVRID 0x04 -#define ERROR_LARGE 0x05 -#define ERROR_NDISABL 0x06 -#define ERROR_ALLOCBSY 0x07 -#define ERROR_NORD 0x0B -#define ERROR_NOWR 0x0C -#define ERROR_INVFIDTX 0x0D -#define ERROR_TESTACT 0x0E -#define ERROR_TAGNFND 0x12 -#define ERROR_DECODE 0x20 -#define ERROR_DESCUNAV 0x21 -#define ERROR_BADLEN 0x22 -#define ERROR_MODE 0x80 -#define ERROR_HOP 0x81 -#define ERROR_BINTER 0x82 -#define ERROR_RXMODE 0x83 -#define ERROR_MACADDR 0x84 -#define ERROR_RATES 0x85 -#define ERROR_ORDER 0x86 -#define ERROR_SCAN 0x87 -#define ERROR_AUTH 0x88 -#define ERROR_PSMODE 0x89 -#define ERROR_RTYPE 0x8A -#define ERROR_DIVER 0x8B -#define ERROR_SSID 0x8C -#define ERROR_APLIST 0x8D -#define ERROR_AUTOWAKE 0x8E -#define ERROR_LEAP 0x8F - -/* Registers */ -#define COMMAND 0x00 -#define PARAM0 0x02 -#define PARAM1 0x04 -#define PARAM2 0x06 -#define STATUS 0x08 -#define RESP0 0x0a -#define RESP1 0x0c -#define RESP2 0x0e -#define LINKSTAT 0x10 -#define SELECT0 0x18 -#define OFFSET0 0x1c -#define RXFID 0x20 -#define TXALLOCFID 0x22 -#define TXCOMPLFID 0x24 -#define DATA0 0x36 -#define EVSTAT 0x30 -#define EVINTEN 0x32 -#define EVACK 0x34 -#define SWS0 0x28 -#define SWS1 0x2a -#define SWS2 0x2c -#define SWS3 0x2e -#define AUXPAGE 0x3A -#define AUXOFF 0x3C -#define AUXDATA 0x3E - -#define FID_TX 1 -#define FID_RX 2 -/* Offset into aux memory for descriptors */ -#define AUX_OFFSET 0x800 -/* Size of allocated packets */ -#define PKTSIZE 1840 -#define RIDSIZE 2048 -/* Size of the transmit queue */ -#define MAXTXQ 64 - -/* BAP selectors */ -#define BAP0 0 /* Used for receiving packets */ -#define BAP1 2 /* Used for xmiting packets and working with RIDS */ - -/* Flags */ -#define COMMAND_BUSY 0x8000 - -#define BAP_BUSY 0x8000 -#define BAP_ERR 0x4000 -#define BAP_DONE 0x2000 - -#define PROMISC 0xffff -#define NOPROMISC 0x0000 - -#define EV_CMD 0x10 -#define EV_CLEARCOMMANDBUSY 0x4000 -#define EV_RX 0x01 -#define EV_TX 0x02 -#define EV_TXEXC 0x04 -#define EV_ALLOC 0x08 -#define EV_LINK 0x80 -#define EV_AWAKE 0x100 -#define EV_TXCPY 0x400 -#define EV_UNKNOWN 0x800 -#define EV_MIC 0x1000 /* Message Integrity Check Interrupt */ -#define EV_AWAKEN 0x2000 -#define STATUS_INTS (EV_AWAKE|EV_LINK|EV_TXEXC|EV_TX|EV_TXCPY|EV_RX|EV_MIC) - -#ifdef CHECK_UNKNOWN_INTS -#define IGNORE_INTS ( EV_CMD | EV_UNKNOWN) -#else -#define IGNORE_INTS (~STATUS_INTS) -#endif - -/* RID TYPES */ -#define RID_RW 0x20 - -/* The RIDs */ -#define RID_CAPABILITIES 0xFF00 -#define RID_APINFO 0xFF01 -#define RID_RADIOINFO 0xFF02 -#define RID_UNKNOWN3 0xFF03 -#define RID_RSSI 0xFF04 -#define RID_CONFIG 0xFF10 -#define RID_SSID 0xFF11 -#define RID_APLIST 0xFF12 -#define RID_DRVNAME 0xFF13 -#define RID_ETHERENCAP 0xFF14 -#define RID_WEP_TEMP 0xFF15 -#define RID_WEP_PERM 0xFF16 -#define RID_MODULATION 0xFF17 -#define RID_OPTIONS 0xFF18 -#define RID_ACTUALCONFIG 0xFF20 /*readonly*/ -#define RID_FACTORYCONFIG 0xFF21 -#define RID_UNKNOWN22 0xFF22 -#define RID_LEAPUSERNAME 0xFF23 -#define RID_LEAPPASSWORD 0xFF24 -#define RID_STATUS 0xFF50 -#define RID_BEACON_HST 0xFF51 -#define RID_BUSY_HST 0xFF52 -#define RID_RETRIES_HST 0xFF53 -#define RID_UNKNOWN54 0xFF54 -#define RID_UNKNOWN55 0xFF55 -#define RID_UNKNOWN56 0xFF56 -#define RID_MIC 0xFF57 -#define RID_STATS16 0xFF60 -#define RID_STATS16DELTA 0xFF61 -#define RID_STATS16DELTACLEAR 0xFF62 -#define RID_STATS 0xFF68 -#define RID_STATSDELTA 0xFF69 -#define RID_STATSDELTACLEAR 0xFF6A -#define RID_ECHOTEST_RID 0xFF70 -#define RID_ECHOTEST_RESULTS 0xFF71 -#define RID_BSSLISTFIRST 0xFF72 -#define RID_BSSLISTNEXT 0xFF73 -#define RID_WPA_BSSLISTFIRST 0xFF74 -#define RID_WPA_BSSLISTNEXT 0xFF75 - -typedef struct { - u16 cmd; - u16 parm0; - u16 parm1; - u16 parm2; -} Cmd; - -typedef struct { - u16 status; - u16 rsp0; - u16 rsp1; - u16 rsp2; -} Resp; - -/* - * Rids and endian-ness: The Rids will always be in cpu endian, since - * this all the patches from the big-endian guys end up doing that. - * so all rid access should use the read/writeXXXRid routines. - */ - -/* This structure came from an email sent to me from an engineer at - aironet for inclusion into this driver */ -typedef struct WepKeyRid WepKeyRid; -struct WepKeyRid { - __le16 len; - __le16 kindex; - u8 mac[ETH_ALEN]; - __le16 klen; - u8 key[16]; -} __packed; - -/* These structures are from the Aironet's PC4500 Developers Manual */ -typedef struct Ssid Ssid; -struct Ssid { - __le16 len; - u8 ssid[32]; -} __packed; - -typedef struct SsidRid SsidRid; -struct SsidRid { - __le16 len; - Ssid ssids[3]; -} __packed; - -typedef struct ModulationRid ModulationRid; -struct ModulationRid { - __le16 len; - __le16 modulation; -#define MOD_DEFAULT cpu_to_le16(0) -#define MOD_CCK cpu_to_le16(1) -#define MOD_MOK cpu_to_le16(2) -} __packed; - -typedef struct ConfigRid ConfigRid; -struct ConfigRid { - __le16 len; /* sizeof(ConfigRid) */ - __le16 opmode; /* operating mode */ -#define MODE_STA_IBSS cpu_to_le16(0) -#define MODE_STA_ESS cpu_to_le16(1) -#define MODE_AP cpu_to_le16(2) -#define MODE_AP_RPTR cpu_to_le16(3) -#define MODE_CFG_MASK cpu_to_le16(0xff) -#define MODE_ETHERNET_HOST cpu_to_le16(0<<8) /* rx payloads converted */ -#define MODE_LLC_HOST cpu_to_le16(1<<8) /* rx payloads left as is */ -#define MODE_AIRONET_EXTEND cpu_to_le16(1<<9) /* enable Aironet extenstions */ -#define MODE_AP_INTERFACE cpu_to_le16(1<<10) /* enable ap interface extensions */ -#define MODE_ANTENNA_ALIGN cpu_to_le16(1<<11) /* enable antenna alignment */ -#define MODE_ETHER_LLC cpu_to_le16(1<<12) /* enable ethernet LLC */ -#define MODE_LEAF_NODE cpu_to_le16(1<<13) /* enable leaf node bridge */ -#define MODE_CF_POLLABLE cpu_to_le16(1<<14) /* enable CF pollable */ -#define MODE_MIC cpu_to_le16(1<<15) /* enable MIC */ - __le16 rmode; /* receive mode */ -#define RXMODE_BC_MC_ADDR cpu_to_le16(0) -#define RXMODE_BC_ADDR cpu_to_le16(1) /* ignore multicasts */ -#define RXMODE_ADDR cpu_to_le16(2) /* ignore multicast and broadcast */ -#define RXMODE_RFMON cpu_to_le16(3) /* wireless monitor mode */ -#define RXMODE_RFMON_ANYBSS cpu_to_le16(4) -#define RXMODE_LANMON cpu_to_le16(5) /* lan style monitor -- data packets only */ -#define RXMODE_MASK cpu_to_le16(255) -#define RXMODE_DISABLE_802_3_HEADER cpu_to_le16(1<<8) /* disables 802.3 header on rx */ -#define RXMODE_FULL_MASK (RXMODE_MASK | RXMODE_DISABLE_802_3_HEADER) -#define RXMODE_NORMALIZED_RSSI cpu_to_le16(1<<9) /* return normalized RSSI */ - __le16 fragThresh; - __le16 rtsThres; - u8 macAddr[ETH_ALEN]; - u8 rates[8]; - __le16 shortRetryLimit; - __le16 longRetryLimit; - __le16 txLifetime; /* in kusec */ - __le16 rxLifetime; /* in kusec */ - __le16 stationary; - __le16 ordering; - __le16 u16deviceType; /* for overriding device type */ - __le16 cfpRate; - __le16 cfpDuration; - __le16 _reserved1[3]; - /*---------- Scanning/Associating ----------*/ - __le16 scanMode; -#define SCANMODE_ACTIVE cpu_to_le16(0) -#define SCANMODE_PASSIVE cpu_to_le16(1) -#define SCANMODE_AIROSCAN cpu_to_le16(2) - __le16 probeDelay; /* in kusec */ - __le16 probeEnergyTimeout; /* in kusec */ - __le16 probeResponseTimeout; - __le16 beaconListenTimeout; - __le16 joinNetTimeout; - __le16 authTimeout; - __le16 authType; -#define AUTH_OPEN cpu_to_le16(0x1) -#define AUTH_ENCRYPT cpu_to_le16(0x101) -#define AUTH_SHAREDKEY cpu_to_le16(0x102) -#define AUTH_ALLOW_UNENCRYPTED cpu_to_le16(0x200) - __le16 associationTimeout; - __le16 specifiedApTimeout; - __le16 offlineScanInterval; - __le16 offlineScanDuration; - __le16 linkLossDelay; - __le16 maxBeaconLostTime; - __le16 refreshInterval; -#define DISABLE_REFRESH cpu_to_le16(0xFFFF) - __le16 _reserved1a[1]; - /*---------- Power save operation ----------*/ - __le16 powerSaveMode; -#define POWERSAVE_CAM cpu_to_le16(0) -#define POWERSAVE_PSP cpu_to_le16(1) -#define POWERSAVE_PSPCAM cpu_to_le16(2) - __le16 sleepForDtims; - __le16 listenInterval; - __le16 fastListenInterval; - __le16 listenDecay; - __le16 fastListenDelay; - __le16 _reserved2[2]; - /*---------- Ap/Ibss config items ----------*/ - __le16 beaconPeriod; - __le16 atimDuration; - __le16 hopPeriod; - __le16 channelSet; - __le16 channel; - __le16 dtimPeriod; - __le16 bridgeDistance; - __le16 radioID; - /*---------- Radio configuration ----------*/ - __le16 radioType; -#define RADIOTYPE_DEFAULT cpu_to_le16(0) -#define RADIOTYPE_802_11 cpu_to_le16(1) -#define RADIOTYPE_LEGACY cpu_to_le16(2) - u8 rxDiversity; - u8 txDiversity; - __le16 txPower; -#define TXPOWER_DEFAULT 0 - __le16 rssiThreshold; -#define RSSI_DEFAULT 0 - __le16 modulation; -#define PREAMBLE_AUTO cpu_to_le16(0) -#define PREAMBLE_LONG cpu_to_le16(1) -#define PREAMBLE_SHORT cpu_to_le16(2) - __le16 preamble; - __le16 homeProduct; - __le16 radioSpecific; - /*---------- Aironet Extensions ----------*/ - u8 nodeName[16]; - __le16 arlThreshold; - __le16 arlDecay; - __le16 arlDelay; - __le16 _reserved4[1]; - /*---------- Aironet Extensions ----------*/ - u8 magicAction; -#define MAGIC_ACTION_STSCHG 1 -#define MAGIC_ACTION_RESUME 2 -#define MAGIC_IGNORE_MCAST (1<<8) -#define MAGIC_IGNORE_BCAST (1<<9) -#define MAGIC_SWITCH_TO_PSP (0<<10) -#define MAGIC_STAY_IN_CAM (1<<10) - u8 magicControl; - __le16 autoWake; -} __packed; - -typedef struct StatusRid StatusRid; -struct StatusRid { - __le16 len; - u8 mac[ETH_ALEN]; - __le16 mode; - __le16 errorCode; - __le16 sigQuality; - __le16 SSIDlen; - char SSID[32]; - char apName[16]; - u8 bssid[4][ETH_ALEN]; - __le16 beaconPeriod; - __le16 dimPeriod; - __le16 atimDuration; - __le16 hopPeriod; - __le16 channelSet; - __le16 channel; - __le16 hopsToBackbone; - __le16 apTotalLoad; - __le16 generatedLoad; - __le16 accumulatedArl; - __le16 signalQuality; - __le16 currentXmitRate; - __le16 apDevExtensions; - __le16 normalizedSignalStrength; - __le16 shortPreamble; - u8 apIP[4]; - u8 noisePercent; /* Noise percent in last second */ - u8 noisedBm; /* Noise dBm in last second */ - u8 noiseAvePercent; /* Noise percent in last minute */ - u8 noiseAvedBm; /* Noise dBm in last minute */ - u8 noiseMaxPercent; /* Highest noise percent in last minute */ - u8 noiseMaxdBm; /* Highest noise dbm in last minute */ - __le16 load; - u8 carrier[4]; - __le16 assocStatus; -#define STAT_NOPACKETS 0 -#define STAT_NOCARRIERSET 10 -#define STAT_GOTCARRIERSET 11 -#define STAT_WRONGSSID 20 -#define STAT_BADCHANNEL 25 -#define STAT_BADBITRATES 30 -#define STAT_BADPRIVACY 35 -#define STAT_APFOUND 40 -#define STAT_APREJECTED 50 -#define STAT_AUTHENTICATING 60 -#define STAT_DEAUTHENTICATED 61 -#define STAT_AUTHTIMEOUT 62 -#define STAT_ASSOCIATING 70 -#define STAT_DEASSOCIATED 71 -#define STAT_ASSOCTIMEOUT 72 -#define STAT_NOTAIROAP 73 -#define STAT_ASSOCIATED 80 -#define STAT_LEAPING 90 -#define STAT_LEAPFAILED 91 -#define STAT_LEAPTIMEDOUT 92 -#define STAT_LEAPCOMPLETE 93 -} __packed; - -typedef struct StatsRid StatsRid; -struct StatsRid { - __le16 len; - __le16 spacer; - __le32 vals[100]; -} __packed; - -typedef struct APListRid APListRid; -struct APListRid { - __le16 len; - u8 ap[4][ETH_ALEN]; -} __packed; - -typedef struct CapabilityRid CapabilityRid; -struct CapabilityRid { - __le16 len; - char oui[3]; - char zero; - __le16 prodNum; - char manName[32]; - char prodName[16]; - char prodVer[8]; - char factoryAddr[ETH_ALEN]; - char aironetAddr[ETH_ALEN]; - __le16 radioType; - __le16 country; - char callid[ETH_ALEN]; - char supportedRates[8]; - char rxDiversity; - char txDiversity; - __le16 txPowerLevels[8]; - __le16 hardVer; - __le16 hardCap; - __le16 tempRange; - __le16 softVer; - __le16 softSubVer; - __le16 interfaceVer; - __le16 softCap; - __le16 bootBlockVer; - __le16 requiredHard; - __le16 extSoftCap; -} __packed; - -/* Only present on firmware >= 5.30.17 */ -typedef struct BSSListRidExtra BSSListRidExtra; -struct BSSListRidExtra { - __le16 unknown[4]; - u8 fixed[12]; /* WLAN management frame */ - u8 iep[624]; -} __packed; - -typedef struct BSSListRid BSSListRid; -struct BSSListRid { - __le16 len; - __le16 index; /* First is 0 and 0xffff means end of list */ -#define RADIO_FH 1 /* Frequency hopping radio type */ -#define RADIO_DS 2 /* Direct sequence radio type */ -#define RADIO_TMA 4 /* Proprietary radio used in old cards (2500) */ - __le16 radioType; - u8 bssid[ETH_ALEN]; /* Mac address of the BSS */ - u8 zero; - u8 ssidLen; - u8 ssid[32]; - __le16 dBm; -#define CAP_ESS cpu_to_le16(1<<0) -#define CAP_IBSS cpu_to_le16(1<<1) -#define CAP_PRIVACY cpu_to_le16(1<<4) -#define CAP_SHORTHDR cpu_to_le16(1<<5) - __le16 cap; - __le16 beaconInterval; - u8 rates[8]; /* Same as rates for config rid */ - struct { /* For frequency hopping only */ - __le16 dwell; - u8 hopSet; - u8 hopPattern; - u8 hopIndex; - u8 fill; - } fh; - __le16 dsChannel; - __le16 atimWindow; - - /* Only present on firmware >= 5.30.17 */ - BSSListRidExtra extra; -} __packed; - -typedef struct { - BSSListRid bss; - struct list_head list; -} BSSListElement; - -typedef struct tdsRssiEntry tdsRssiEntry; -struct tdsRssiEntry { - u8 rssipct; - u8 rssidBm; -} __packed; - -typedef struct tdsRssiRid tdsRssiRid; -struct tdsRssiRid { - u16 len; - tdsRssiEntry x[256]; -} __packed; - -typedef struct MICRid MICRid; -struct MICRid { - __le16 len; - __le16 state; - __le16 multicastValid; - u8 multicast[16]; - __le16 unicastValid; - u8 unicast[16]; -} __packed; - -typedef struct MICBuffer MICBuffer; -struct MICBuffer { - __be16 typelen; - - union { - u8 snap[8]; - struct { - u8 dsap; - u8 ssap; - u8 control; - u8 orgcode[3]; - u8 fieldtype[2]; - } llc; - } u; - __be32 mic; - __be32 seq; -} __packed; - -typedef struct { - u8 da[ETH_ALEN]; - u8 sa[ETH_ALEN]; -} etherHead; - -#define TXCTL_TXOK (1<<1) /* report if tx is ok */ -#define TXCTL_TXEX (1<<2) /* report if tx fails */ -#define TXCTL_802_3 (0<<3) /* 802.3 packet */ -#define TXCTL_802_11 (1<<3) /* 802.11 mac packet */ -#define TXCTL_ETHERNET (0<<4) /* payload has ethertype */ -#define TXCTL_LLC (1<<4) /* payload is llc */ -#define TXCTL_RELEASE (0<<5) /* release after completion */ -#define TXCTL_NORELEASE (1<<5) /* on completion returns to host */ - -#define BUSY_FID 0x10000 - -#ifdef CISCO_EXT -#define AIROMAGIC 0xa55a -/* Warning : SIOCDEVPRIVATE may disapear during 2.5.X - Jean II */ -#ifdef SIOCIWFIRSTPRIV -#ifdef SIOCDEVPRIVATE -#define AIROOLDIOCTL SIOCDEVPRIVATE -#define AIROOLDIDIFC AIROOLDIOCTL + 1 -#endif /* SIOCDEVPRIVATE */ -#else /* SIOCIWFIRSTPRIV */ -#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE -#endif /* SIOCIWFIRSTPRIV */ -/* This may be wrong. When using the new SIOCIWFIRSTPRIV range, we probably - * should use only "GET" ioctls (last bit set to 1). "SET" ioctls are root - * only and don't return the modified struct ifreq to the application which - * is usually a problem. - Jean II */ -#define AIROIOCTL SIOCIWFIRSTPRIV -#define AIROIDIFC AIROIOCTL + 1 - -/* Ioctl constants to be used in airo_ioctl.command */ - -#define AIROGCAP 0 // Capability rid -#define AIROGCFG 1 // USED A LOT -#define AIROGSLIST 2 // System ID list -#define AIROGVLIST 3 // List of specified AP's -#define AIROGDRVNAM 4 // NOTUSED -#define AIROGEHTENC 5 // NOTUSED -#define AIROGWEPKTMP 6 -#define AIROGWEPKNV 7 -#define AIROGSTAT 8 -#define AIROGSTATSC32 9 -#define AIROGSTATSD32 10 -#define AIROGMICRID 11 -#define AIROGMICSTATS 12 -#define AIROGFLAGS 13 -#define AIROGID 14 -#define AIRORRID 15 -#define AIRORSWVERSION 17 - -/* Leave gap of 40 commands after AIROGSTATSD32 for future */ - -#define AIROPCAP AIROGSTATSD32 + 40 -#define AIROPVLIST AIROPCAP + 1 -#define AIROPSLIST AIROPVLIST + 1 -#define AIROPCFG AIROPSLIST + 1 -#define AIROPSIDS AIROPCFG + 1 -#define AIROPAPLIST AIROPSIDS + 1 -#define AIROPMACON AIROPAPLIST + 1 /* Enable mac */ -#define AIROPMACOFF AIROPMACON + 1 /* Disable mac */ -#define AIROPSTCLR AIROPMACOFF + 1 -#define AIROPWEPKEY AIROPSTCLR + 1 -#define AIROPWEPKEYNV AIROPWEPKEY + 1 -#define AIROPLEAPPWD AIROPWEPKEYNV + 1 -#define AIROPLEAPUSR AIROPLEAPPWD + 1 - -/* Flash codes */ - -#define AIROFLSHRST AIROPWEPKEYNV + 40 -#define AIROFLSHGCHR AIROFLSHRST + 1 -#define AIROFLSHSTFL AIROFLSHGCHR + 1 -#define AIROFLSHPCHR AIROFLSHSTFL + 1 -#define AIROFLPUTBUF AIROFLSHPCHR + 1 -#define AIRORESTART AIROFLPUTBUF + 1 - -#define FLASHSIZE 32768 -#define AUXMEMSIZE (256 * 1024) - -typedef struct aironet_ioctl { - unsigned short command; // What to do - unsigned short len; // Len of data - unsigned short ridnum; // rid number - unsigned char __user *data; // d-data -} aironet_ioctl; - -static const char swversion[] = "2.1"; -#endif /* CISCO_EXT */ - -#define NUM_MODULES 2 -#define MIC_MSGLEN_MAX 2400 -#define EMMH32_MSGLEN_MAX MIC_MSGLEN_MAX -#define AIRO_DEF_MTU 2312 - -typedef struct { - u32 size; // size - u8 enabled; // MIC enabled or not - u32 rxSuccess; // successful packets received - u32 rxIncorrectMIC; // pkts dropped due to incorrect MIC comparison - u32 rxNotMICed; // pkts dropped due to not being MIC'd - u32 rxMICPlummed; // pkts dropped due to not having a MIC plummed - u32 rxWrongSequence; // pkts dropped due to sequence number violation - u32 reserve[32]; -} mic_statistics; - -typedef struct { - u32 coeff[((EMMH32_MSGLEN_MAX)+3)>>2]; - u64 accum; // accumulated mic, reduced to u32 in final() - int position; // current position (byte offset) in message - union { - u8 d8[4]; - __be32 d32; - } part; // saves partial message word across update() calls -} emmh32_context; - -typedef struct { - emmh32_context seed; // Context - the seed - u32 rx; // Received sequence number - u32 tx; // Tx sequence number - u32 window; // Start of window - u8 valid; // Flag to say if context is valid or not - u8 key[16]; -} miccntx; - -typedef struct { - miccntx mCtx; // Multicast context - miccntx uCtx; // Unicast context -} mic_module; - -typedef struct { - unsigned int rid: 16; - unsigned int len: 15; - unsigned int valid: 1; - dma_addr_t host_addr; -} Rid; - -typedef struct { - unsigned int offset: 15; - unsigned int eoc: 1; - unsigned int len: 15; - unsigned int valid: 1; - dma_addr_t host_addr; -} TxFid; - -struct rx_hdr { - __le16 status, len; - u8 rssi[2]; - u8 rate; - u8 freq; - __le16 tmp[4]; -} __packed; - -typedef struct { - unsigned int ctl: 15; - unsigned int rdy: 1; - unsigned int len: 15; - unsigned int valid: 1; - dma_addr_t host_addr; -} RxFid; - -/* - * Host receive descriptor - */ -typedef struct { - unsigned char __iomem *card_ram_off; /* offset into card memory of the - desc */ - RxFid rx_desc; /* card receive descriptor */ - char *virtual_host_addr; /* virtual address of host receive - buffer */ - int pending; -} HostRxDesc; - -/* - * Host transmit descriptor - */ -typedef struct { - unsigned char __iomem *card_ram_off; /* offset into card memory of the - desc */ - TxFid tx_desc; /* card transmit descriptor */ - char *virtual_host_addr; /* virtual address of host receive - buffer */ - int pending; -} HostTxDesc; - -/* - * Host RID descriptor - */ -typedef struct { - unsigned char __iomem *card_ram_off; /* offset into card memory of the - descriptor */ - Rid rid_desc; /* card RID descriptor */ - char *virtual_host_addr; /* virtual address of host receive - buffer */ -} HostRidDesc; - -typedef struct { - u16 sw0; - u16 sw1; - u16 status; - u16 len; -#define HOST_SET (1 << 0) -#define HOST_INT_TX (1 << 1) /* Interrupt on successful TX */ -#define HOST_INT_TXERR (1 << 2) /* Interrupt on unseccessful TX */ -#define HOST_LCC_PAYLOAD (1 << 4) /* LLC payload, 0 = Ethertype */ -#define HOST_DONT_RLSE (1 << 5) /* Don't release buffer when done */ -#define HOST_DONT_RETRY (1 << 6) /* Don't retry trasmit */ -#define HOST_CLR_AID (1 << 7) /* clear AID failure */ -#define HOST_RTS (1 << 9) /* Force RTS use */ -#define HOST_SHORT (1 << 10) /* Do short preamble */ - u16 ctl; - u16 aid; - u16 retries; - u16 fill; -} TxCtlHdr; - -typedef struct { - u16 ctl; - u16 duration; - char addr1[6]; - char addr2[6]; - char addr3[6]; - u16 seq; - char addr4[6]; -} WifiHdr; - - -typedef struct { - TxCtlHdr ctlhdr; - u16 fill1; - u16 fill2; - WifiHdr wifihdr; - u16 gaplen; - u16 status; -} WifiCtlHdr; - -static WifiCtlHdr wifictlhdr8023 = { - .ctlhdr = { - .ctl = HOST_DONT_RLSE, - } -}; - -// A few details needed for WEP (Wireless Equivalent Privacy) -#define MAX_KEY_SIZE 13 // 128 (?) bits -#define MIN_KEY_SIZE 5 // 40 bits RC4 - WEP -typedef struct wep_key_t { - u16 len; - u8 key[16]; /* 40-bit and 104-bit keys */ -} wep_key_t; - -/* List of Wireless Handlers (new API) */ -static const struct iw_handler_def airo_handler_def; - -static const char version[] = "airo.c 0.6 (Ben Reed & Javier Achirica)"; - -struct airo_info; - -static int get_dec_u16( char *buffer, int *start, int limit ); -static void OUT4500( struct airo_info *, u16 register, u16 value ); -static unsigned short IN4500( struct airo_info *, u16 register ); -static u16 setup_card(struct airo_info*, u8 *mac, int lock); -static int enable_MAC(struct airo_info *ai, int lock); -static void disable_MAC(struct airo_info *ai, int lock); -static void enable_interrupts(struct airo_info*); -static void disable_interrupts(struct airo_info*); -static u16 issuecommand(struct airo_info*, Cmd *pCmd, Resp *pRsp); -static int bap_setup(struct airo_info*, u16 rid, u16 offset, int whichbap); -static int aux_bap_read(struct airo_info*, __le16 *pu16Dst, int bytelen, - int whichbap); -static int fast_bap_read(struct airo_info*, __le16 *pu16Dst, int bytelen, - int whichbap); -static int bap_write(struct airo_info*, const __le16 *pu16Src, int bytelen, - int whichbap); -static int PC4500_accessrid(struct airo_info*, u16 rid, u16 accmd); -static int PC4500_readrid(struct airo_info*, u16 rid, void *pBuf, int len, int lock); -static int PC4500_writerid(struct airo_info*, u16 rid, const void - *pBuf, int len, int lock); -static int do_writerid( struct airo_info*, u16 rid, const void *rid_data, - int len, int dummy ); -static u16 transmit_allocate(struct airo_info*, int lenPayload, int raw); -static int transmit_802_3_packet(struct airo_info*, int len, char *pPacket); -static int transmit_802_11_packet(struct airo_info*, int len, char *pPacket); - -static int mpi_send_packet (struct net_device *dev); -static void mpi_unmap_card(struct pci_dev *pci); -static void mpi_receive_802_3(struct airo_info *ai); -static void mpi_receive_802_11(struct airo_info *ai); -static int waitbusy (struct airo_info *ai); - -static irqreturn_t airo_interrupt( int irq, void* dev_id); -static int airo_thread(void *data); -static void timer_func( struct net_device *dev ); -static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -static struct iw_statistics *airo_get_wireless_stats (struct net_device *dev); -static void airo_read_wireless_stats (struct airo_info *local); -#ifdef CISCO_EXT -static int readrids(struct net_device *dev, aironet_ioctl *comp); -static int writerids(struct net_device *dev, aironet_ioctl *comp); -static int flashcard(struct net_device *dev, aironet_ioctl *comp); -#endif /* CISCO_EXT */ -static void micinit(struct airo_info *ai); -static int micsetup(struct airo_info *ai); -static int encapsulate(struct airo_info *ai, etherHead *pPacket, MICBuffer *buffer, int len); -static int decapsulate(struct airo_info *ai, MICBuffer *mic, etherHead *pPacket, u16 payLen); - -static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi); -static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm); - -static void airo_networks_free(struct airo_info *ai); - -struct airo_info { - struct net_device *dev; - struct list_head dev_list; - /* Note, we can have MAX_FIDS outstanding. FIDs are 16-bits, so we - use the high bit to mark whether it is in use. */ -#define MAX_FIDS 6 -#define MPI_MAX_FIDS 1 - u32 fids[MAX_FIDS]; - ConfigRid config; - char keyindex; // Used with auto wep - char defindex; // Used with auto wep - struct proc_dir_entry *proc_entry; - spinlock_t aux_lock; -#define FLAG_RADIO_OFF 0 /* User disabling of MAC */ -#define FLAG_RADIO_DOWN 1 /* ifup/ifdown disabling of MAC */ -#define FLAG_RADIO_MASK 0x03 -#define FLAG_ENABLED 2 -#define FLAG_ADHOC 3 /* Needed by MIC */ -#define FLAG_MIC_CAPABLE 4 -#define FLAG_UPDATE_MULTI 5 -#define FLAG_UPDATE_UNI 6 -#define FLAG_802_11 7 -#define FLAG_PROMISC 8 /* IFF_PROMISC 0x100 - include/linux/if.h */ -#define FLAG_PENDING_XMIT 9 -#define FLAG_PENDING_XMIT11 10 -#define FLAG_MPI 11 -#define FLAG_REGISTERED 12 -#define FLAG_COMMIT 13 -#define FLAG_RESET 14 -#define FLAG_FLASHING 15 -#define FLAG_WPA_CAPABLE 16 - unsigned long flags; -#define JOB_DIE 0 -#define JOB_XMIT 1 -#define JOB_XMIT11 2 -#define JOB_STATS 3 -#define JOB_PROMISC 4 -#define JOB_MIC 5 -#define JOB_EVENT 6 -#define JOB_AUTOWEP 7 -#define JOB_WSTATS 8 -#define JOB_SCAN_RESULTS 9 - unsigned long jobs; - int (*bap_read)(struct airo_info*, __le16 *pu16Dst, int bytelen, - int whichbap); - unsigned short *flash; - tdsRssiEntry *rssi; - struct task_struct *list_bss_task; - struct task_struct *airo_thread_task; - struct semaphore sem; - wait_queue_head_t thr_wait; - unsigned long expires; - struct { - struct sk_buff *skb; - int fid; - } xmit, xmit11; - struct net_device *wifidev; - struct iw_statistics wstats; // wireless stats - unsigned long scan_timeout; /* Time scan should be read */ - struct iw_spy_data spy_data; - struct iw_public_data wireless_data; - /* MIC stuff */ - struct crypto_cipher *tfm; - mic_module mod[2]; - mic_statistics micstats; - HostRxDesc rxfids[MPI_MAX_FIDS]; // rx/tx/config MPI350 descriptors - HostTxDesc txfids[MPI_MAX_FIDS]; - HostRidDesc config_desc; - unsigned long ridbus; // phys addr of config_desc - struct sk_buff_head txq;// tx queue used by mpi350 code - struct pci_dev *pci; - unsigned char __iomem *pcimem; - unsigned char __iomem *pciaux; - unsigned char *shared; - dma_addr_t shared_dma; - pm_message_t power; - SsidRid *SSID; - APListRid *APList; -#define PCI_SHARED_LEN 2*MPI_MAX_FIDS*PKTSIZE+RIDSIZE - char proc_name[IFNAMSIZ]; - - int wep_capable; - int max_wep_idx; - - /* WPA-related stuff */ - unsigned int bssListFirst; - unsigned int bssListNext; - unsigned int bssListRidLen; - - struct list_head network_list; - struct list_head network_free_list; - BSSListElement *networks; -}; - -static inline int bap_read(struct airo_info *ai, __le16 *pu16Dst, int bytelen, - int whichbap) -{ - return ai->bap_read(ai, pu16Dst, bytelen, whichbap); -} - -static int setup_proc_entry( struct net_device *dev, - struct airo_info *apriv ); -static int takedown_proc_entry( struct net_device *dev, - struct airo_info *apriv ); - -static int cmdreset(struct airo_info *ai); -static int setflashmode (struct airo_info *ai); -static int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime); -static int flashputbuf(struct airo_info *ai); -static int flashrestart(struct airo_info *ai,struct net_device *dev); - -#define airo_print(type, name, fmt, args...) \ - printk(type DRV_NAME "(%s): " fmt "\n", name, ##args) - -#define airo_print_info(name, fmt, args...) \ - airo_print(KERN_INFO, name, fmt, ##args) - -#define airo_print_dbg(name, fmt, args...) \ - airo_print(KERN_DEBUG, name, fmt, ##args) - -#define airo_print_warn(name, fmt, args...) \ - airo_print(KERN_WARNING, name, fmt, ##args) - -#define airo_print_err(name, fmt, args...) \ - airo_print(KERN_ERR, name, fmt, ##args) - -#define AIRO_FLASH(dev) (((struct airo_info *)dev->ml_priv)->flash) - -/*********************************************************************** - * MIC ROUTINES * - *********************************************************************** - */ - -static int RxSeqValid (struct airo_info *ai,miccntx *context,int mcast,u32 micSeq); -static void MoveWindow(miccntx *context, u32 micSeq); -static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, - struct crypto_cipher *tfm); -static void emmh32_init(emmh32_context *context); -static void emmh32_update(emmh32_context *context, u8 *pOctets, int len); -static void emmh32_final(emmh32_context *context, u8 digest[4]); -static int flashpchar(struct airo_info *ai,int byte,int dwelltime); - -static void age_mic_context(miccntx *cur, miccntx *old, u8 *key, int key_len, - struct crypto_cipher *tfm) -{ - /* If the current MIC context is valid and its key is the same as - * the MIC register, there's nothing to do. - */ - if (cur->valid && (memcmp(cur->key, key, key_len) == 0)) - return; - - /* Age current mic Context */ - memcpy(old, cur, sizeof(*cur)); - - /* Initialize new context */ - memcpy(cur->key, key, key_len); - cur->window = 33; /* Window always points to the middle */ - cur->rx = 0; /* Rx Sequence numbers */ - cur->tx = 0; /* Tx sequence numbers */ - cur->valid = 1; /* Key is now valid */ - - /* Give key to mic seed */ - emmh32_setseed(&cur->seed, key, key_len, tfm); -} - -/* micinit - Initialize mic seed */ - -static void micinit(struct airo_info *ai) -{ - MICRid mic_rid; - - clear_bit(JOB_MIC, &ai->jobs); - PC4500_readrid(ai, RID_MIC, &mic_rid, sizeof(mic_rid), 0); - up(&ai->sem); - - ai->micstats.enabled = (le16_to_cpu(mic_rid.state) & 0x00FF) ? 1 : 0; - if (!ai->micstats.enabled) { - /* So next time we have a valid key and mic is enabled, we will - * update the sequence number if the key is the same as before. - */ - ai->mod[0].uCtx.valid = 0; - ai->mod[0].mCtx.valid = 0; - return; - } - - if (mic_rid.multicastValid) { - age_mic_context(&ai->mod[0].mCtx, &ai->mod[1].mCtx, - mic_rid.multicast, sizeof(mic_rid.multicast), - ai->tfm); - } - - if (mic_rid.unicastValid) { - age_mic_context(&ai->mod[0].uCtx, &ai->mod[1].uCtx, - mic_rid.unicast, sizeof(mic_rid.unicast), - ai->tfm); - } -} - -/* micsetup - Get ready for business */ - -static int micsetup(struct airo_info *ai) { - int i; - - if (ai->tfm == NULL) - ai->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); - - if (IS_ERR(ai->tfm)) { - airo_print_err(ai->dev->name, "failed to load transform for AES"); - ai->tfm = NULL; - return ERROR; - } - - for (i=0; i < NUM_MODULES; i++) { - memset(&ai->mod[i].mCtx,0,sizeof(miccntx)); - memset(&ai->mod[i].uCtx,0,sizeof(miccntx)); - } - return SUCCESS; -} - -static const u8 micsnap[] = {0xAA,0xAA,0x03,0x00,0x40,0x96,0x00,0x02}; - -/*=========================================================================== - * Description: Mic a packet - * - * Inputs: etherHead * pointer to an 802.3 frame - * - * Returns: BOOLEAN if successful, otherwise false. - * PacketTxLen will be updated with the mic'd packets size. - * - * Caveats: It is assumed that the frame buffer will already - * be big enough to hold the largets mic message possible. - * (No memory allocation is done here). - * - * Author: sbraneky (10/15/01) - * Merciless hacks by rwilcher (1/14/02) - */ - -static int encapsulate(struct airo_info *ai ,etherHead *frame, MICBuffer *mic, int payLen) -{ - miccntx *context; - - // Determine correct context - // If not adhoc, always use unicast key - - if (test_bit(FLAG_ADHOC, &ai->flags) && (frame->da[0] & 0x1)) - context = &ai->mod[0].mCtx; - else - context = &ai->mod[0].uCtx; - - if (!context->valid) - return ERROR; - - mic->typelen = htons(payLen + 16); //Length of Mic'd packet - - memcpy(&mic->u.snap, micsnap, sizeof(micsnap)); // Add Snap - - // Add Tx sequence - mic->seq = htonl(context->tx); - context->tx += 2; - - emmh32_init(&context->seed); // Mic the packet - emmh32_update(&context->seed,frame->da,ETH_ALEN * 2); // DA,SA - emmh32_update(&context->seed,(u8*)&mic->typelen,10); // Type/Length and Snap - emmh32_update(&context->seed,(u8*)&mic->seq,sizeof(mic->seq)); //SEQ - emmh32_update(&context->seed,(u8*)(frame + 1),payLen); //payload - emmh32_final(&context->seed, (u8*)&mic->mic); - - /* New Type/length ?????????? */ - mic->typelen = 0; //Let NIC know it could be an oversized packet - return SUCCESS; -} - -typedef enum { - NONE, - NOMIC, - NOMICPLUMMED, - SEQUENCE, - INCORRECTMIC, -} mic_error; - -/*=========================================================================== - * Description: Decapsulates a MIC'd packet and returns the 802.3 packet - * (removes the MIC stuff) if packet is a valid packet. - * - * Inputs: etherHead pointer to the 802.3 packet - * - * Returns: BOOLEAN - TRUE if packet should be dropped otherwise FALSE - * - * Author: sbraneky (10/15/01) - * Merciless hacks by rwilcher (1/14/02) - *--------------------------------------------------------------------------- - */ - -static int decapsulate(struct airo_info *ai, MICBuffer *mic, etherHead *eth, u16 payLen) -{ - int i; - u32 micSEQ; - miccntx *context; - u8 digest[4]; - mic_error micError = NONE; - - // Check if the packet is a Mic'd packet - - if (!ai->micstats.enabled) { - //No Mic set or Mic OFF but we received a MIC'd packet. - if (memcmp ((u8*)eth + 14, micsnap, sizeof(micsnap)) == 0) { - ai->micstats.rxMICPlummed++; - return ERROR; - } - return SUCCESS; - } - - if (ntohs(mic->typelen) == 0x888E) - return SUCCESS; - - if (memcmp (mic->u.snap, micsnap, sizeof(micsnap)) != 0) { - // Mic enabled but packet isn't Mic'd - ai->micstats.rxMICPlummed++; - return ERROR; - } - - micSEQ = ntohl(mic->seq); //store SEQ as CPU order - - //At this point we a have a mic'd packet and mic is enabled - //Now do the mic error checking. - - //Receive seq must be odd - if ( (micSEQ & 1) == 0 ) { - ai->micstats.rxWrongSequence++; - return ERROR; - } - - for (i = 0; i < NUM_MODULES; i++) { - int mcast = eth->da[0] & 1; - //Determine proper context - context = mcast ? &ai->mod[i].mCtx : &ai->mod[i].uCtx; - - //Make sure context is valid - if (!context->valid) { - if (i == 0) - micError = NOMICPLUMMED; - continue; - } - //DeMic it - - if (!mic->typelen) - mic->typelen = htons(payLen + sizeof(MICBuffer) - 2); - - emmh32_init(&context->seed); - emmh32_update(&context->seed, eth->da, ETH_ALEN*2); - emmh32_update(&context->seed, (u8 *)&mic->typelen, sizeof(mic->typelen)+sizeof(mic->u.snap)); - emmh32_update(&context->seed, (u8 *)&mic->seq,sizeof(mic->seq)); - emmh32_update(&context->seed, (u8 *)(eth + 1),payLen); - //Calculate MIC - emmh32_final(&context->seed, digest); - - if (memcmp(digest, &mic->mic, 4)) { //Make sure the mics match - //Invalid Mic - if (i == 0) - micError = INCORRECTMIC; - continue; - } - - //Check Sequence number if mics pass - if (RxSeqValid(ai, context, mcast, micSEQ) == SUCCESS) { - ai->micstats.rxSuccess++; - return SUCCESS; - } - if (i == 0) - micError = SEQUENCE; - } - - // Update statistics - switch (micError) { - case NOMICPLUMMED: ai->micstats.rxMICPlummed++; break; - case SEQUENCE: ai->micstats.rxWrongSequence++; break; - case INCORRECTMIC: ai->micstats.rxIncorrectMIC++; break; - case NONE: break; - case NOMIC: break; - } - return ERROR; -} - -/*=========================================================================== - * Description: Checks the Rx Seq number to make sure it is valid - * and hasn't already been received - * - * Inputs: miccntx - mic context to check seq against - * micSeq - the Mic seq number - * - * Returns: TRUE if valid otherwise FALSE. - * - * Author: sbraneky (10/15/01) - * Merciless hacks by rwilcher (1/14/02) - *--------------------------------------------------------------------------- - */ - -static int RxSeqValid (struct airo_info *ai,miccntx *context,int mcast,u32 micSeq) -{ - u32 seq,index; - - //Allow for the ap being rebooted - if it is then use the next - //sequence number of the current sequence number - might go backwards - - if (mcast) { - if (test_bit(FLAG_UPDATE_MULTI, &ai->flags)) { - clear_bit (FLAG_UPDATE_MULTI, &ai->flags); - context->window = (micSeq > 33) ? micSeq : 33; - context->rx = 0; // Reset rx - } - } else if (test_bit(FLAG_UPDATE_UNI, &ai->flags)) { - clear_bit (FLAG_UPDATE_UNI, &ai->flags); - context->window = (micSeq > 33) ? micSeq : 33; // Move window - context->rx = 0; // Reset rx - } - - //Make sequence number relative to START of window - seq = micSeq - (context->window - 33); - - //Too old of a SEQ number to check. - if ((s32)seq < 0) - return ERROR; - - if ( seq > 64 ) { - //Window is infinite forward - MoveWindow(context,micSeq); - return SUCCESS; - } - - // We are in the window. Now check the context rx bit to see if it was already sent - seq >>= 1; //divide by 2 because we only have odd numbers - index = 1 << seq; //Get an index number - - if (!(context->rx & index)) { - //micSEQ falls inside the window. - //Add seqence number to the list of received numbers. - context->rx |= index; - - MoveWindow(context,micSeq); - - return SUCCESS; - } - return ERROR; -} - -static void MoveWindow(miccntx *context, u32 micSeq) -{ - u32 shift; - - //Move window if seq greater than the middle of the window - if (micSeq > context->window) { - shift = (micSeq - context->window) >> 1; - - //Shift out old - if (shift < 32) - context->rx >>= shift; - else - context->rx = 0; - - context->window = micSeq; //Move window - } -} - -/*==============================================*/ -/*========== EMMH ROUTINES ====================*/ -/*==============================================*/ - -/* mic accumulate */ -#define MIC_ACCUM(val) \ - context->accum += (u64)(val) * context->coeff[coeff_position++]; - -static unsigned char aes_counter[16]; - -/* expand the key to fill the MMH coefficient array */ -static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen, - struct crypto_cipher *tfm) -{ - /* take the keying material, expand if necessary, truncate at 16-bytes */ - /* run through AES counter mode to generate context->coeff[] */ - - int i,j; - u32 counter; - u8 *cipher, plain[16]; - - crypto_cipher_setkey(tfm, pkey, 16); - counter = 0; - for (i = 0; i < ARRAY_SIZE(context->coeff); ) { - aes_counter[15] = (u8)(counter >> 0); - aes_counter[14] = (u8)(counter >> 8); - aes_counter[13] = (u8)(counter >> 16); - aes_counter[12] = (u8)(counter >> 24); - counter++; - memcpy (plain, aes_counter, 16); - crypto_cipher_encrypt_one(tfm, plain, plain); - cipher = plain; - for (j = 0; (j < 16) && (i < ARRAY_SIZE(context->coeff)); ) { - context->coeff[i++] = ntohl(*(__be32 *)&cipher[j]); - j += 4; - } - } -} - -/* prepare for calculation of a new mic */ -static void emmh32_init(emmh32_context *context) -{ - /* prepare for new mic calculation */ - context->accum = 0; - context->position = 0; -} - -/* add some bytes to the mic calculation */ -static void emmh32_update(emmh32_context *context, u8 *pOctets, int len) -{ - int coeff_position, byte_position; - - if (len == 0) return; - - coeff_position = context->position >> 2; - - /* deal with partial 32-bit word left over from last update */ - byte_position = context->position & 3; - if (byte_position) { - /* have a partial word in part to deal with */ - do { - if (len == 0) return; - context->part.d8[byte_position++] = *pOctets++; - context->position++; - len--; - } while (byte_position < 4); - MIC_ACCUM(ntohl(context->part.d32)); - } - - /* deal with full 32-bit words */ - while (len >= 4) { - MIC_ACCUM(ntohl(*(__be32 *)pOctets)); - context->position += 4; - pOctets += 4; - len -= 4; - } - - /* deal with partial 32-bit word that will be left over from this update */ - byte_position = 0; - while (len > 0) { - context->part.d8[byte_position++] = *pOctets++; - context->position++; - len--; - } -} - -/* mask used to zero empty bytes for final partial word */ -static u32 mask32[4] = { 0x00000000L, 0xFF000000L, 0xFFFF0000L, 0xFFFFFF00L }; - -/* calculate the mic */ -static void emmh32_final(emmh32_context *context, u8 digest[4]) -{ - int coeff_position, byte_position; - u32 val; - - u64 sum, utmp; - s64 stmp; - - coeff_position = context->position >> 2; - - /* deal with partial 32-bit word left over from last update */ - byte_position = context->position & 3; - if (byte_position) { - /* have a partial word in part to deal with */ - val = ntohl(context->part.d32); - MIC_ACCUM(val & mask32[byte_position]); /* zero empty bytes */ - } - - /* reduce the accumulated u64 to a 32-bit MIC */ - sum = context->accum; - stmp = (sum & 0xffffffffLL) - ((sum >> 32) * 15); - utmp = (stmp & 0xffffffffLL) - ((stmp >> 32) * 15); - sum = utmp & 0xffffffffLL; - if (utmp > 0x10000000fLL) - sum -= 15; - - val = (u32)sum; - digest[0] = (val>>24) & 0xFF; - digest[1] = (val>>16) & 0xFF; - digest[2] = (val>>8) & 0xFF; - digest[3] = val & 0xFF; -} - -static int readBSSListRid(struct airo_info *ai, int first, - BSSListRid *list) -{ - Cmd cmd; - Resp rsp; - - if (first == 1) { - if (ai->flags & FLAG_RADIO_MASK) return -ENETDOWN; - memset(&cmd, 0, sizeof(cmd)); - cmd.cmd=CMD_LISTBSS; - if (down_interruptible(&ai->sem)) - return -ERESTARTSYS; - ai->list_bss_task = current; - issuecommand(ai, &cmd, &rsp); - up(&ai->sem); - /* Let the command take effect */ - schedule_timeout_uninterruptible(3 * HZ); - ai->list_bss_task = NULL; - } - return PC4500_readrid(ai, first ? ai->bssListFirst : ai->bssListNext, - list, ai->bssListRidLen, 1); -} - -static int readWepKeyRid(struct airo_info *ai, WepKeyRid *wkr, int temp, int lock) -{ - return PC4500_readrid(ai, temp ? RID_WEP_TEMP : RID_WEP_PERM, - wkr, sizeof(*wkr), lock); -} - -static int writeWepKeyRid(struct airo_info *ai, WepKeyRid *wkr, int perm, int lock) -{ - int rc; - rc = PC4500_writerid(ai, RID_WEP_TEMP, wkr, sizeof(*wkr), lock); - if (rc!=SUCCESS) - airo_print_err(ai->dev->name, "WEP_TEMP set %x", rc); - if (perm) { - rc = PC4500_writerid(ai, RID_WEP_PERM, wkr, sizeof(*wkr), lock); - if (rc!=SUCCESS) - airo_print_err(ai->dev->name, "WEP_PERM set %x", rc); - } - return rc; -} - -static int readSsidRid(struct airo_info*ai, SsidRid *ssidr) -{ - return PC4500_readrid(ai, RID_SSID, ssidr, sizeof(*ssidr), 1); -} - -static int writeSsidRid(struct airo_info*ai, SsidRid *pssidr, int lock) -{ - return PC4500_writerid(ai, RID_SSID, pssidr, sizeof(*pssidr), lock); -} - -static int readConfigRid(struct airo_info *ai, int lock) -{ - int rc; - ConfigRid cfg; - - if (ai->config.len) - return SUCCESS; - - rc = PC4500_readrid(ai, RID_ACTUALCONFIG, &cfg, sizeof(cfg), lock); - if (rc != SUCCESS) - return rc; - - ai->config = cfg; - return SUCCESS; -} - -static inline void checkThrottle(struct airo_info *ai) -{ - int i; -/* Old hardware had a limit on encryption speed */ - if (ai->config.authType != AUTH_OPEN && maxencrypt) { - for(i=0; i<8; i++) { - if (ai->config.rates[i] > maxencrypt) { - ai->config.rates[i] = 0; - } - } - } -} - -static int writeConfigRid(struct airo_info *ai, int lock) -{ - ConfigRid cfgr; - - if (!test_bit (FLAG_COMMIT, &ai->flags)) - return SUCCESS; - - clear_bit (FLAG_COMMIT, &ai->flags); - clear_bit (FLAG_RESET, &ai->flags); - checkThrottle(ai); - cfgr = ai->config; - - if ((cfgr.opmode & MODE_CFG_MASK) == MODE_STA_IBSS) - set_bit(FLAG_ADHOC, &ai->flags); - else - clear_bit(FLAG_ADHOC, &ai->flags); - - return PC4500_writerid( ai, RID_CONFIG, &cfgr, sizeof(cfgr), lock); -} - -static int readStatusRid(struct airo_info *ai, StatusRid *statr, int lock) -{ - return PC4500_readrid(ai, RID_STATUS, statr, sizeof(*statr), lock); -} - -static int readAPListRid(struct airo_info *ai, APListRid *aplr) -{ - return PC4500_readrid(ai, RID_APLIST, aplr, sizeof(*aplr), 1); -} - -static int writeAPListRid(struct airo_info *ai, APListRid *aplr, int lock) -{ - return PC4500_writerid(ai, RID_APLIST, aplr, sizeof(*aplr), lock); -} - -static int readCapabilityRid(struct airo_info *ai, CapabilityRid *capr, int lock) -{ - return PC4500_readrid(ai, RID_CAPABILITIES, capr, sizeof(*capr), lock); -} - -static int readStatsRid(struct airo_info*ai, StatsRid *sr, int rid, int lock) -{ - return PC4500_readrid(ai, rid, sr, sizeof(*sr), lock); -} - -static void try_auto_wep(struct airo_info *ai) -{ - if (auto_wep && !test_bit(FLAG_RADIO_DOWN, &ai->flags)) { - ai->expires = RUN_AT(3*HZ); - wake_up_interruptible(&ai->thr_wait); - } -} - -static int airo_open(struct net_device *dev) { - struct airo_info *ai = dev->ml_priv; - int rc = 0; - - if (test_bit(FLAG_FLASHING, &ai->flags)) - return -EIO; - - /* Make sure the card is configured. - * Wireless Extensions may postpone config changes until the card - * is open (to pipeline changes and speed-up card setup). If - * those changes are not yet committed, do it now - Jean II */ - if (test_bit(FLAG_COMMIT, &ai->flags)) { - disable_MAC(ai, 1); - writeConfigRid(ai, 1); - } - - if (ai->wifidev != dev) { - clear_bit(JOB_DIE, &ai->jobs); - ai->airo_thread_task = kthread_run(airo_thread, dev, dev->name); - if (IS_ERR(ai->airo_thread_task)) - return (int)PTR_ERR(ai->airo_thread_task); - - rc = request_irq(dev->irq, airo_interrupt, IRQF_SHARED, - dev->name, dev); - if (rc) { - airo_print_err(dev->name, - "register interrupt %d failed, rc %d", - dev->irq, rc); - set_bit(JOB_DIE, &ai->jobs); - kthread_stop(ai->airo_thread_task); - return rc; - } - - /* Power on the MAC controller (which may have been disabled) */ - clear_bit(FLAG_RADIO_DOWN, &ai->flags); - enable_interrupts(ai); - - try_auto_wep(ai); - } - enable_MAC(ai, 1); - - netif_start_queue(dev); - return 0; -} - -static netdev_tx_t mpi_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - int npacks, pending; - unsigned long flags; - struct airo_info *ai = dev->ml_priv; - - if (!skb) { - airo_print_err(dev->name, "%s: skb == NULL!",__func__); - return NETDEV_TX_OK; - } - npacks = skb_queue_len (&ai->txq); - - if (npacks >= MAXTXQ - 1) { - netif_stop_queue (dev); - if (npacks > MAXTXQ) { - dev->stats.tx_fifo_errors++; - return NETDEV_TX_BUSY; - } - skb_queue_tail (&ai->txq, skb); - return NETDEV_TX_OK; - } - - spin_lock_irqsave(&ai->aux_lock, flags); - skb_queue_tail (&ai->txq, skb); - pending = test_bit(FLAG_PENDING_XMIT, &ai->flags); - spin_unlock_irqrestore(&ai->aux_lock,flags); - netif_wake_queue (dev); - - if (pending == 0) { - set_bit(FLAG_PENDING_XMIT, &ai->flags); - mpi_send_packet (dev); - } - return NETDEV_TX_OK; -} - -/* - * @mpi_send_packet - * - * Attempt to transmit a packet. Can be called from interrupt - * or transmit . return number of packets we tried to send - */ - -static int mpi_send_packet (struct net_device *dev) -{ - struct sk_buff *skb; - unsigned char *buffer; - s16 len; - __le16 *payloadLen; - struct airo_info *ai = dev->ml_priv; - u8 *sendbuf; - - /* get a packet to send */ - - if ((skb = skb_dequeue(&ai->txq)) == NULL) { - airo_print_err(dev->name, - "%s: Dequeue'd zero in send_packet()", - __func__); - return 0; - } - - /* check min length*/ - len = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; - buffer = skb->data; - - ai->txfids[0].tx_desc.offset = 0; - ai->txfids[0].tx_desc.valid = 1; - ai->txfids[0].tx_desc.eoc = 1; - ai->txfids[0].tx_desc.len =len+sizeof(WifiHdr); - -/* - * Magic, the cards firmware needs a length count (2 bytes) in the host buffer - * right after TXFID_HDR.The TXFID_HDR contains the status short so payloadlen - * is immediately after it. ------------------------------------------------ - * |TXFIDHDR+STATUS|PAYLOADLEN|802.3HDR|PACKETDATA| - * ------------------------------------------------ - */ - - memcpy(ai->txfids[0].virtual_host_addr, - (char *)&wifictlhdr8023, sizeof(wifictlhdr8023)); - - payloadLen = (__le16 *)(ai->txfids[0].virtual_host_addr + - sizeof(wifictlhdr8023)); - sendbuf = ai->txfids[0].virtual_host_addr + - sizeof(wifictlhdr8023) + 2 ; - - /* - * Firmware automatically puts 802 header on so - * we don't need to account for it in the length - */ - if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && - (ntohs(((__be16 *)buffer)[6]) != 0x888E)) { - MICBuffer pMic; - - if (encapsulate(ai, (etherHead *)buffer, &pMic, len - sizeof(etherHead)) != SUCCESS) - return ERROR; - - *payloadLen = cpu_to_le16(len-sizeof(etherHead)+sizeof(pMic)); - ai->txfids[0].tx_desc.len += sizeof(pMic); - /* copy data into airo dma buffer */ - memcpy (sendbuf, buffer, sizeof(etherHead)); - buffer += sizeof(etherHead); - sendbuf += sizeof(etherHead); - memcpy (sendbuf, &pMic, sizeof(pMic)); - sendbuf += sizeof(pMic); - memcpy (sendbuf, buffer, len - sizeof(etherHead)); - } else { - *payloadLen = cpu_to_le16(len - sizeof(etherHead)); - - dev->trans_start = jiffies; - - /* copy data into airo dma buffer */ - memcpy(sendbuf, buffer, len); - } - - memcpy_toio(ai->txfids[0].card_ram_off, - &ai->txfids[0].tx_desc, sizeof(TxFid)); - - OUT4500(ai, EVACK, 8); - - dev_kfree_skb_any(skb); - return 1; -} - -static void get_tx_error(struct airo_info *ai, s32 fid) -{ - __le16 status; - - if (fid < 0) - status = ((WifiCtlHdr *)ai->txfids[0].virtual_host_addr)->ctlhdr.status; - else { - if (bap_setup(ai, ai->fids[fid] & 0xffff, 4, BAP0) != SUCCESS) - return; - bap_read(ai, &status, 2, BAP0); - } - if (le16_to_cpu(status) & 2) /* Too many retries */ - ai->dev->stats.tx_aborted_errors++; - if (le16_to_cpu(status) & 4) /* Transmit lifetime exceeded */ - ai->dev->stats.tx_heartbeat_errors++; - if (le16_to_cpu(status) & 8) /* Aid fail */ - { } - if (le16_to_cpu(status) & 0x10) /* MAC disabled */ - ai->dev->stats.tx_carrier_errors++; - if (le16_to_cpu(status) & 0x20) /* Association lost */ - { } - /* We produce a TXDROP event only for retry or lifetime - * exceeded, because that's the only status that really mean - * that this particular node went away. - * Other errors means that *we* screwed up. - Jean II */ - if ((le16_to_cpu(status) & 2) || - (le16_to_cpu(status) & 4)) { - union iwreq_data wrqu; - char junk[0x18]; - - /* Faster to skip over useless data than to do - * another bap_setup(). We are at offset 0x6 and - * need to go to 0x18 and read 6 bytes - Jean II */ - bap_read(ai, (__le16 *) junk, 0x18, BAP0); - - /* Copy 802.11 dest address. - * We use the 802.11 header because the frame may - * not be 802.3 or may be mangled... - * In Ad-Hoc mode, it will be the node address. - * In managed mode, it will be most likely the AP addr - * User space will figure out how to convert it to - * whatever it needs (IP address or else). - * - Jean II */ - memcpy(wrqu.addr.sa_data, junk + 0x12, ETH_ALEN); - wrqu.addr.sa_family = ARPHRD_ETHER; - - /* Send event to user space */ - wireless_send_event(ai->dev, IWEVTXDROP, &wrqu, NULL); - } -} - -static void airo_end_xmit(struct net_device *dev) { - u16 status; - int i; - struct airo_info *priv = dev->ml_priv; - struct sk_buff *skb = priv->xmit.skb; - int fid = priv->xmit.fid; - u32 *fids = priv->fids; - - clear_bit(JOB_XMIT, &priv->jobs); - clear_bit(FLAG_PENDING_XMIT, &priv->flags); - status = transmit_802_3_packet (priv, fids[fid], skb->data); - up(&priv->sem); - - i = 0; - if ( status == SUCCESS ) { - dev->trans_start = jiffies; - for (; i < MAX_FIDS / 2 && (priv->fids[i] & 0xffff0000); i++); - } else { - priv->fids[fid] &= 0xffff; - dev->stats.tx_window_errors++; - } - if (i < MAX_FIDS / 2) - netif_wake_queue(dev); - dev_kfree_skb(skb); -} - -static netdev_tx_t airo_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - s16 len; - int i, j; - struct airo_info *priv = dev->ml_priv; - u32 *fids = priv->fids; - - if ( skb == NULL ) { - airo_print_err(dev->name, "%s: skb == NULL!", __func__); - return NETDEV_TX_OK; - } - - /* Find a vacant FID */ - for( i = 0; i < MAX_FIDS / 2 && (fids[i] & 0xffff0000); i++ ); - for( j = i + 1; j < MAX_FIDS / 2 && (fids[j] & 0xffff0000); j++ ); - - if ( j >= MAX_FIDS / 2 ) { - netif_stop_queue(dev); - - if (i == MAX_FIDS / 2) { - dev->stats.tx_fifo_errors++; - return NETDEV_TX_BUSY; - } - } - /* check min length*/ - len = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; - /* Mark fid as used & save length for later */ - fids[i] |= (len << 16); - priv->xmit.skb = skb; - priv->xmit.fid = i; - if (down_trylock(&priv->sem) != 0) { - set_bit(FLAG_PENDING_XMIT, &priv->flags); - netif_stop_queue(dev); - set_bit(JOB_XMIT, &priv->jobs); - wake_up_interruptible(&priv->thr_wait); - } else - airo_end_xmit(dev); - return NETDEV_TX_OK; -} - -static void airo_end_xmit11(struct net_device *dev) { - u16 status; - int i; - struct airo_info *priv = dev->ml_priv; - struct sk_buff *skb = priv->xmit11.skb; - int fid = priv->xmit11.fid; - u32 *fids = priv->fids; - - clear_bit(JOB_XMIT11, &priv->jobs); - clear_bit(FLAG_PENDING_XMIT11, &priv->flags); - status = transmit_802_11_packet (priv, fids[fid], skb->data); - up(&priv->sem); - - i = MAX_FIDS / 2; - if ( status == SUCCESS ) { - dev->trans_start = jiffies; - for (; i < MAX_FIDS && (priv->fids[i] & 0xffff0000); i++); - } else { - priv->fids[fid] &= 0xffff; - dev->stats.tx_window_errors++; - } - if (i < MAX_FIDS) - netif_wake_queue(dev); - dev_kfree_skb(skb); -} - -static netdev_tx_t airo_start_xmit11(struct sk_buff *skb, - struct net_device *dev) -{ - s16 len; - int i, j; - struct airo_info *priv = dev->ml_priv; - u32 *fids = priv->fids; - - if (test_bit(FLAG_MPI, &priv->flags)) { - /* Not implemented yet for MPI350 */ - netif_stop_queue(dev); - dev_kfree_skb_any(skb); - return NETDEV_TX_OK; - } - - if ( skb == NULL ) { - airo_print_err(dev->name, "%s: skb == NULL!", __func__); - return NETDEV_TX_OK; - } - - /* Find a vacant FID */ - for( i = MAX_FIDS / 2; i < MAX_FIDS && (fids[i] & 0xffff0000); i++ ); - for( j = i + 1; j < MAX_FIDS && (fids[j] & 0xffff0000); j++ ); - - if ( j >= MAX_FIDS ) { - netif_stop_queue(dev); - - if (i == MAX_FIDS) { - dev->stats.tx_fifo_errors++; - return NETDEV_TX_BUSY; - } - } - /* check min length*/ - len = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; - /* Mark fid as used & save length for later */ - fids[i] |= (len << 16); - priv->xmit11.skb = skb; - priv->xmit11.fid = i; - if (down_trylock(&priv->sem) != 0) { - set_bit(FLAG_PENDING_XMIT11, &priv->flags); - netif_stop_queue(dev); - set_bit(JOB_XMIT11, &priv->jobs); - wake_up_interruptible(&priv->thr_wait); - } else - airo_end_xmit11(dev); - return NETDEV_TX_OK; -} - -static void airo_read_stats(struct net_device *dev) -{ - struct airo_info *ai = dev->ml_priv; - StatsRid stats_rid; - __le32 *vals = stats_rid.vals; - - clear_bit(JOB_STATS, &ai->jobs); - if (ai->power.event) { - up(&ai->sem); - return; - } - readStatsRid(ai, &stats_rid, RID_STATS, 0); - up(&ai->sem); - - dev->stats.rx_packets = le32_to_cpu(vals[43]) + le32_to_cpu(vals[44]) + - le32_to_cpu(vals[45]); - dev->stats.tx_packets = le32_to_cpu(vals[39]) + le32_to_cpu(vals[40]) + - le32_to_cpu(vals[41]); - dev->stats.rx_bytes = le32_to_cpu(vals[92]); - dev->stats.tx_bytes = le32_to_cpu(vals[91]); - dev->stats.rx_errors = le32_to_cpu(vals[0]) + le32_to_cpu(vals[2]) + - le32_to_cpu(vals[3]) + le32_to_cpu(vals[4]); - dev->stats.tx_errors = le32_to_cpu(vals[42]) + - dev->stats.tx_fifo_errors; - dev->stats.multicast = le32_to_cpu(vals[43]); - dev->stats.collisions = le32_to_cpu(vals[89]); - - /* detailed rx_errors: */ - dev->stats.rx_length_errors = le32_to_cpu(vals[3]); - dev->stats.rx_crc_errors = le32_to_cpu(vals[4]); - dev->stats.rx_frame_errors = le32_to_cpu(vals[2]); - dev->stats.rx_fifo_errors = le32_to_cpu(vals[0]); -} - -static struct net_device_stats *airo_get_stats(struct net_device *dev) -{ - struct airo_info *local = dev->ml_priv; - - if (!test_bit(JOB_STATS, &local->jobs)) { - /* Get stats out of the card if available */ - if (down_trylock(&local->sem) != 0) { - set_bit(JOB_STATS, &local->jobs); - wake_up_interruptible(&local->thr_wait); - } else - airo_read_stats(dev); - } - - return &dev->stats; -} - -static void airo_set_promisc(struct airo_info *ai) { - Cmd cmd; - Resp rsp; - - memset(&cmd, 0, sizeof(cmd)); - cmd.cmd=CMD_SETMODE; - clear_bit(JOB_PROMISC, &ai->jobs); - cmd.parm0=(ai->flags&IFF_PROMISC) ? PROMISC : NOPROMISC; - issuecommand(ai, &cmd, &rsp); - up(&ai->sem); -} - -static void airo_set_multicast_list(struct net_device *dev) { - struct airo_info *ai = dev->ml_priv; - - if ((dev->flags ^ ai->flags) & IFF_PROMISC) { - change_bit(FLAG_PROMISC, &ai->flags); - if (down_trylock(&ai->sem) != 0) { - set_bit(JOB_PROMISC, &ai->jobs); - wake_up_interruptible(&ai->thr_wait); - } else - airo_set_promisc(ai); - } - - if ((dev->flags&IFF_ALLMULTI) || !netdev_mc_empty(dev)) { - /* Turn on multicast. (Should be already setup...) */ - } -} - -static int airo_set_mac_address(struct net_device *dev, void *p) -{ - struct airo_info *ai = dev->ml_priv; - struct sockaddr *addr = p; - - readConfigRid(ai, 1); - memcpy (ai->config.macAddr, addr->sa_data, dev->addr_len); - set_bit (FLAG_COMMIT, &ai->flags); - disable_MAC(ai, 1); - writeConfigRid (ai, 1); - enable_MAC(ai, 1); - memcpy (ai->dev->dev_addr, addr->sa_data, dev->addr_len); - if (ai->wifidev) - memcpy (ai->wifidev->dev_addr, addr->sa_data, dev->addr_len); - return 0; -} - -static int airo_change_mtu(struct net_device *dev, int new_mtu) -{ - if ((new_mtu < 68) || (new_mtu > 2400)) - return -EINVAL; - dev->mtu = new_mtu; - return 0; -} - -static LIST_HEAD(airo_devices); - -static void add_airo_dev(struct airo_info *ai) -{ - /* Upper layers already keep track of PCI devices, - * so we only need to remember our non-PCI cards. */ - if (!ai->pci) - list_add_tail(&ai->dev_list, &airo_devices); -} - -static void del_airo_dev(struct airo_info *ai) -{ - if (!ai->pci) - list_del(&ai->dev_list); -} - -static int airo_close(struct net_device *dev) { - struct airo_info *ai = dev->ml_priv; - - netif_stop_queue(dev); - - if (ai->wifidev != dev) { -#ifdef POWER_ON_DOWN - /* Shut power to the card. The idea is that the user can save - * power when he doesn't need the card with "ifconfig down". - * That's the method that is most friendly towards the network - * stack (i.e. the network stack won't try to broadcast - * anything on the interface and routes are gone. Jean II */ - set_bit(FLAG_RADIO_DOWN, &ai->flags); - disable_MAC(ai, 1); -#endif - disable_interrupts( ai ); - - free_irq(dev->irq, dev); - - set_bit(JOB_DIE, &ai->jobs); - kthread_stop(ai->airo_thread_task); - } - return 0; -} - -void stop_airo_card( struct net_device *dev, int freeres ) -{ - struct airo_info *ai = dev->ml_priv; - - set_bit(FLAG_RADIO_DOWN, &ai->flags); - disable_MAC(ai, 1); - disable_interrupts(ai); - takedown_proc_entry( dev, ai ); - if (test_bit(FLAG_REGISTERED, &ai->flags)) { - unregister_netdev( dev ); - if (ai->wifidev) { - unregister_netdev(ai->wifidev); - free_netdev(ai->wifidev); - ai->wifidev = NULL; - } - clear_bit(FLAG_REGISTERED, &ai->flags); - } - /* - * Clean out tx queue - */ - if (test_bit(FLAG_MPI, &ai->flags) && !skb_queue_empty(&ai->txq)) { - struct sk_buff *skb = NULL; - for (;(skb = skb_dequeue(&ai->txq));) - dev_kfree_skb(skb); - } - - airo_networks_free (ai); - - kfree(ai->flash); - kfree(ai->rssi); - kfree(ai->APList); - kfree(ai->SSID); - if (freeres) { - /* PCMCIA frees this stuff, so only for PCI and ISA */ - release_region( dev->base_addr, 64 ); - if (test_bit(FLAG_MPI, &ai->flags)) { - if (ai->pci) - mpi_unmap_card(ai->pci); - if (ai->pcimem) - iounmap(ai->pcimem); - if (ai->pciaux) - iounmap(ai->pciaux); - pci_free_consistent(ai->pci, PCI_SHARED_LEN, - ai->shared, ai->shared_dma); - } - } - crypto_free_cipher(ai->tfm); - del_airo_dev(ai); - free_netdev( dev ); -} - -EXPORT_SYMBOL(stop_airo_card); - -static int wll_header_parse(const struct sk_buff *skb, unsigned char *haddr) -{ - memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); - return ETH_ALEN; -} - -static void mpi_unmap_card(struct pci_dev *pci) -{ - unsigned long mem_start = pci_resource_start(pci, 1); - unsigned long mem_len = pci_resource_len(pci, 1); - unsigned long aux_start = pci_resource_start(pci, 2); - unsigned long aux_len = AUXMEMSIZE; - - release_mem_region(aux_start, aux_len); - release_mem_region(mem_start, mem_len); -} - -/************************************************************* - * This routine assumes that descriptors have been setup . - * Run at insmod time or after reset when the decriptors - * have been initialized . Returns 0 if all is well nz - * otherwise . Does not allocate memory but sets up card - * using previously allocated descriptors. - */ -static int mpi_init_descriptors (struct airo_info *ai) -{ - Cmd cmd; - Resp rsp; - int i; - int rc = SUCCESS; - - /* Alloc card RX descriptors */ - netif_stop_queue(ai->dev); - - memset(&rsp,0,sizeof(rsp)); - memset(&cmd,0,sizeof(cmd)); - - cmd.cmd = CMD_ALLOCATEAUX; - cmd.parm0 = FID_RX; - cmd.parm1 = (ai->rxfids[0].card_ram_off - ai->pciaux); - cmd.parm2 = MPI_MAX_FIDS; - rc=issuecommand(ai, &cmd, &rsp); - if (rc != SUCCESS) { - airo_print_err(ai->dev->name, "Couldn't allocate RX FID"); - return rc; - } - - for (i=0; irxfids[i].card_ram_off, - &ai->rxfids[i].rx_desc, sizeof(RxFid)); - } - - /* Alloc card TX descriptors */ - - memset(&rsp,0,sizeof(rsp)); - memset(&cmd,0,sizeof(cmd)); - - cmd.cmd = CMD_ALLOCATEAUX; - cmd.parm0 = FID_TX; - cmd.parm1 = (ai->txfids[0].card_ram_off - ai->pciaux); - cmd.parm2 = MPI_MAX_FIDS; - - for (i=0; itxfids[i].tx_desc.valid = 1; - memcpy_toio(ai->txfids[i].card_ram_off, - &ai->txfids[i].tx_desc, sizeof(TxFid)); - } - ai->txfids[i-1].tx_desc.eoc = 1; /* Last descriptor has EOC set */ - - rc=issuecommand(ai, &cmd, &rsp); - if (rc != SUCCESS) { - airo_print_err(ai->dev->name, "Couldn't allocate TX FID"); - return rc; - } - - /* Alloc card Rid descriptor */ - memset(&rsp,0,sizeof(rsp)); - memset(&cmd,0,sizeof(cmd)); - - cmd.cmd = CMD_ALLOCATEAUX; - cmd.parm0 = RID_RW; - cmd.parm1 = (ai->config_desc.card_ram_off - ai->pciaux); - cmd.parm2 = 1; /* Magic number... */ - rc=issuecommand(ai, &cmd, &rsp); - if (rc != SUCCESS) { - airo_print_err(ai->dev->name, "Couldn't allocate RID"); - return rc; - } - - memcpy_toio(ai->config_desc.card_ram_off, - &ai->config_desc.rid_desc, sizeof(Rid)); - - return rc; -} - -/* - * We are setting up three things here: - * 1) Map AUX memory for descriptors: Rid, TxFid, or RxFid. - * 2) Map PCI memory for issuing commands. - * 3) Allocate memory (shared) to send and receive ethernet frames. - */ -static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci) -{ - unsigned long mem_start, mem_len, aux_start, aux_len; - int rc = -1; - int i; - dma_addr_t busaddroff; - unsigned char *vpackoff; - unsigned char __iomem *pciaddroff; - - mem_start = pci_resource_start(pci, 1); - mem_len = pci_resource_len(pci, 1); - aux_start = pci_resource_start(pci, 2); - aux_len = AUXMEMSIZE; - - if (!request_mem_region(mem_start, mem_len, DRV_NAME)) { - airo_print_err("", "Couldn't get region %x[%x]", - (int)mem_start, (int)mem_len); - goto out; - } - if (!request_mem_region(aux_start, aux_len, DRV_NAME)) { - airo_print_err("", "Couldn't get region %x[%x]", - (int)aux_start, (int)aux_len); - goto free_region1; - } - - ai->pcimem = ioremap(mem_start, mem_len); - if (!ai->pcimem) { - airo_print_err("", "Couldn't map region %x[%x]", - (int)mem_start, (int)mem_len); - goto free_region2; - } - ai->pciaux = ioremap(aux_start, aux_len); - if (!ai->pciaux) { - airo_print_err("", "Couldn't map region %x[%x]", - (int)aux_start, (int)aux_len); - goto free_memmap; - } - - /* Reserve PKTSIZE for each fid and 2K for the Rids */ - ai->shared = pci_alloc_consistent(pci, PCI_SHARED_LEN, &ai->shared_dma); - if (!ai->shared) { - airo_print_err("", "Couldn't alloc_consistent %d", - PCI_SHARED_LEN); - goto free_auxmap; - } - - /* - * Setup descriptor RX, TX, CONFIG - */ - busaddroff = ai->shared_dma; - pciaddroff = ai->pciaux + AUX_OFFSET; - vpackoff = ai->shared; - - /* RX descriptor setup */ - for(i = 0; i < MPI_MAX_FIDS; i++) { - ai->rxfids[i].pending = 0; - ai->rxfids[i].card_ram_off = pciaddroff; - ai->rxfids[i].virtual_host_addr = vpackoff; - ai->rxfids[i].rx_desc.host_addr = busaddroff; - ai->rxfids[i].rx_desc.valid = 1; - ai->rxfids[i].rx_desc.len = PKTSIZE; - ai->rxfids[i].rx_desc.rdy = 0; - - pciaddroff += sizeof(RxFid); - busaddroff += PKTSIZE; - vpackoff += PKTSIZE; - } - - /* TX descriptor setup */ - for(i = 0; i < MPI_MAX_FIDS; i++) { - ai->txfids[i].card_ram_off = pciaddroff; - ai->txfids[i].virtual_host_addr = vpackoff; - ai->txfids[i].tx_desc.valid = 1; - ai->txfids[i].tx_desc.host_addr = busaddroff; - memcpy(ai->txfids[i].virtual_host_addr, - &wifictlhdr8023, sizeof(wifictlhdr8023)); - - pciaddroff += sizeof(TxFid); - busaddroff += PKTSIZE; - vpackoff += PKTSIZE; - } - ai->txfids[i-1].tx_desc.eoc = 1; /* Last descriptor has EOC set */ - - /* Rid descriptor setup */ - ai->config_desc.card_ram_off = pciaddroff; - ai->config_desc.virtual_host_addr = vpackoff; - ai->config_desc.rid_desc.host_addr = busaddroff; - ai->ridbus = busaddroff; - ai->config_desc.rid_desc.rid = 0; - ai->config_desc.rid_desc.len = RIDSIZE; - ai->config_desc.rid_desc.valid = 1; - pciaddroff += sizeof(Rid); - busaddroff += RIDSIZE; - vpackoff += RIDSIZE; - - /* Tell card about descriptors */ - if (mpi_init_descriptors (ai) != SUCCESS) - goto free_shared; - - return 0; - free_shared: - pci_free_consistent(pci, PCI_SHARED_LEN, ai->shared, ai->shared_dma); - free_auxmap: - iounmap(ai->pciaux); - free_memmap: - iounmap(ai->pcimem); - free_region2: - release_mem_region(aux_start, aux_len); - free_region1: - release_mem_region(mem_start, mem_len); - out: - return rc; -} - -static const struct header_ops airo_header_ops = { - .parse = wll_header_parse, -}; - -static const struct net_device_ops airo11_netdev_ops = { - .ndo_open = airo_open, - .ndo_stop = airo_close, - .ndo_start_xmit = airo_start_xmit11, - .ndo_get_stats = airo_get_stats, - .ndo_set_mac_address = airo_set_mac_address, - .ndo_do_ioctl = airo_ioctl, - .ndo_change_mtu = airo_change_mtu, -}; - -static void wifi_setup(struct net_device *dev) -{ - dev->netdev_ops = &airo11_netdev_ops; - dev->header_ops = &airo_header_ops; - dev->wireless_handlers = &airo_handler_def; - - dev->type = ARPHRD_IEEE80211; - dev->hard_header_len = ETH_HLEN; - dev->mtu = AIRO_DEF_MTU; - dev->addr_len = ETH_ALEN; - dev->tx_queue_len = 100; - - memset(dev->broadcast,0xFF, ETH_ALEN); - - dev->flags = IFF_BROADCAST|IFF_MULTICAST; -} - -static struct net_device *init_wifidev(struct airo_info *ai, - struct net_device *ethdev) -{ - int err; - struct net_device *dev = alloc_netdev(0, "wifi%d", wifi_setup); - if (!dev) - return NULL; - dev->ml_priv = ethdev->ml_priv; - dev->irq = ethdev->irq; - dev->base_addr = ethdev->base_addr; - dev->wireless_data = ethdev->wireless_data; - SET_NETDEV_DEV(dev, ethdev->dev.parent); - memcpy(dev->dev_addr, ethdev->dev_addr, dev->addr_len); - err = register_netdev(dev); - if (err<0) { - free_netdev(dev); - return NULL; - } - return dev; -} - -static int reset_card( struct net_device *dev , int lock) { - struct airo_info *ai = dev->ml_priv; - - if (lock && down_interruptible(&ai->sem)) - return -1; - waitbusy (ai); - OUT4500(ai,COMMAND,CMD_SOFTRESET); - msleep(200); - waitbusy (ai); - msleep(200); - if (lock) - up(&ai->sem); - return 0; -} - -#define AIRO_MAX_NETWORK_COUNT 64 -static int airo_networks_allocate(struct airo_info *ai) -{ - if (ai->networks) - return 0; - - ai->networks = kcalloc(AIRO_MAX_NETWORK_COUNT, sizeof(BSSListElement), - GFP_KERNEL); - if (!ai->networks) { - airo_print_warn("", "Out of memory allocating beacons"); - return -ENOMEM; - } - - return 0; -} - -static void airo_networks_free(struct airo_info *ai) -{ - kfree(ai->networks); - ai->networks = NULL; -} - -static void airo_networks_initialize(struct airo_info *ai) -{ - int i; - - INIT_LIST_HEAD(&ai->network_free_list); - INIT_LIST_HEAD(&ai->network_list); - for (i = 0; i < AIRO_MAX_NETWORK_COUNT; i++) - list_add_tail(&ai->networks[i].list, - &ai->network_free_list); -} - -static const struct net_device_ops airo_netdev_ops = { - .ndo_open = airo_open, - .ndo_stop = airo_close, - .ndo_start_xmit = airo_start_xmit, - .ndo_get_stats = airo_get_stats, - .ndo_set_rx_mode = airo_set_multicast_list, - .ndo_set_mac_address = airo_set_mac_address, - .ndo_do_ioctl = airo_ioctl, - .ndo_change_mtu = airo_change_mtu, - .ndo_validate_addr = eth_validate_addr, -}; - -static const struct net_device_ops mpi_netdev_ops = { - .ndo_open = airo_open, - .ndo_stop = airo_close, - .ndo_start_xmit = mpi_start_xmit, - .ndo_get_stats = airo_get_stats, - .ndo_set_rx_mode = airo_set_multicast_list, - .ndo_set_mac_address = airo_set_mac_address, - .ndo_do_ioctl = airo_ioctl, - .ndo_change_mtu = airo_change_mtu, - .ndo_validate_addr = eth_validate_addr, -}; - - -static struct net_device *_init_airo_card( unsigned short irq, int port, - int is_pcmcia, struct pci_dev *pci, - struct device *dmdev ) -{ - struct net_device *dev; - struct airo_info *ai; - int i, rc; - CapabilityRid cap_rid; - - /* Create the network device object. */ - dev = alloc_netdev(sizeof(*ai), "", ether_setup); - if (!dev) { - airo_print_err("", "Couldn't alloc_etherdev"); - return NULL; - } - - ai = dev->ml_priv = netdev_priv(dev); - ai->wifidev = NULL; - ai->flags = 1 << FLAG_RADIO_DOWN; - ai->jobs = 0; - ai->dev = dev; - if (pci && (pci->device == 0x5000 || pci->device == 0xa504)) { - airo_print_dbg("", "Found an MPI350 card"); - set_bit(FLAG_MPI, &ai->flags); - } - spin_lock_init(&ai->aux_lock); - sema_init(&ai->sem, 1); - ai->config.len = 0; - ai->pci = pci; - init_waitqueue_head (&ai->thr_wait); - ai->tfm = NULL; - add_airo_dev(ai); - - if (airo_networks_allocate (ai)) - goto err_out_free; - airo_networks_initialize (ai); - - skb_queue_head_init (&ai->txq); - - /* The Airo-specific entries in the device structure. */ - if (test_bit(FLAG_MPI,&ai->flags)) - dev->netdev_ops = &mpi_netdev_ops; - else - dev->netdev_ops = &airo_netdev_ops; - dev->wireless_handlers = &airo_handler_def; - ai->wireless_data.spy_data = &ai->spy_data; - dev->wireless_data = &ai->wireless_data; - dev->irq = irq; - dev->base_addr = port; - dev->priv_flags &= ~IFF_TX_SKB_SHARING; - - SET_NETDEV_DEV(dev, dmdev); - - reset_card (dev, 1); - msleep(400); - - if (!is_pcmcia) { - if (!request_region(dev->base_addr, 64, DRV_NAME)) { - rc = -EBUSY; - airo_print_err(dev->name, "Couldn't request region"); - goto err_out_nets; - } - } - - if (test_bit(FLAG_MPI,&ai->flags)) { - if (mpi_map_card(ai, pci)) { - airo_print_err("", "Could not map memory"); - goto err_out_res; - } - } - - if (probe) { - if (setup_card(ai, dev->dev_addr, 1) != SUCCESS) { - airo_print_err(dev->name, "MAC could not be enabled" ); - rc = -EIO; - goto err_out_map; - } - } else if (!test_bit(FLAG_MPI,&ai->flags)) { - ai->bap_read = fast_bap_read; - set_bit(FLAG_FLASHING, &ai->flags); - } - - strcpy(dev->name, "eth%d"); - rc = register_netdev(dev); - if (rc) { - airo_print_err(dev->name, "Couldn't register_netdev"); - goto err_out_map; - } - ai->wifidev = init_wifidev(ai, dev); - if (!ai->wifidev) - goto err_out_reg; - - rc = readCapabilityRid(ai, &cap_rid, 1); - if (rc != SUCCESS) { - rc = -EIO; - goto err_out_wifi; - } - /* WEP capability discovery */ - ai->wep_capable = (cap_rid.softCap & cpu_to_le16(0x02)) ? 1 : 0; - ai->max_wep_idx = (cap_rid.softCap & cpu_to_le16(0x80)) ? 3 : 0; - - airo_print_info(dev->name, "Firmware version %x.%x.%02d", - ((le16_to_cpu(cap_rid.softVer) >> 8) & 0xF), - (le16_to_cpu(cap_rid.softVer) & 0xFF), - le16_to_cpu(cap_rid.softSubVer)); - - /* Test for WPA support */ - /* Only firmware versions 5.30.17 or better can do WPA */ - if (le16_to_cpu(cap_rid.softVer) > 0x530 - || (le16_to_cpu(cap_rid.softVer) == 0x530 - && le16_to_cpu(cap_rid.softSubVer) >= 17)) { - airo_print_info(ai->dev->name, "WPA supported."); - - set_bit(FLAG_WPA_CAPABLE, &ai->flags); - ai->bssListFirst = RID_WPA_BSSLISTFIRST; - ai->bssListNext = RID_WPA_BSSLISTNEXT; - ai->bssListRidLen = sizeof(BSSListRid); - } else { - airo_print_info(ai->dev->name, "WPA unsupported with firmware " - "versions older than 5.30.17."); - - ai->bssListFirst = RID_BSSLISTFIRST; - ai->bssListNext = RID_BSSLISTNEXT; - ai->bssListRidLen = sizeof(BSSListRid) - sizeof(BSSListRidExtra); - } - - set_bit(FLAG_REGISTERED,&ai->flags); - airo_print_info(dev->name, "MAC enabled %pM", dev->dev_addr); - - /* Allocate the transmit buffers */ - if (probe && !test_bit(FLAG_MPI,&ai->flags)) - for( i = 0; i < MAX_FIDS; i++ ) - ai->fids[i] = transmit_allocate(ai,AIRO_DEF_MTU,i>=MAX_FIDS/2); - - if (setup_proc_entry(dev, dev->ml_priv) < 0) - goto err_out_wifi; - - return dev; - -err_out_wifi: - unregister_netdev(ai->wifidev); - free_netdev(ai->wifidev); -err_out_reg: - unregister_netdev(dev); -err_out_map: - if (test_bit(FLAG_MPI,&ai->flags) && pci) { - pci_free_consistent(pci, PCI_SHARED_LEN, ai->shared, ai->shared_dma); - iounmap(ai->pciaux); - iounmap(ai->pcimem); - mpi_unmap_card(ai->pci); - } -err_out_res: - if (!is_pcmcia) - release_region( dev->base_addr, 64 ); -err_out_nets: - airo_networks_free(ai); -err_out_free: - del_airo_dev(ai); - free_netdev(dev); - return NULL; -} - -struct net_device *init_airo_card( unsigned short irq, int port, int is_pcmcia, - struct device *dmdev) -{ - return _init_airo_card ( irq, port, is_pcmcia, NULL, dmdev); -} - -EXPORT_SYMBOL(init_airo_card); - -static int waitbusy (struct airo_info *ai) { - int delay = 0; - while ((IN4500(ai, COMMAND) & COMMAND_BUSY) && (delay < 10000)) { - udelay (10); - if ((++delay % 20) == 0) - OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY); - } - return delay < 10000; -} - -int reset_airo_card( struct net_device *dev ) -{ - int i; - struct airo_info *ai = dev->ml_priv; - - if (reset_card (dev, 1)) - return -1; - - if ( setup_card(ai, dev->dev_addr, 1 ) != SUCCESS ) { - airo_print_err(dev->name, "MAC could not be enabled"); - return -1; - } - airo_print_info(dev->name, "MAC enabled %pM", dev->dev_addr); - /* Allocate the transmit buffers if needed */ - if (!test_bit(FLAG_MPI,&ai->flags)) - for( i = 0; i < MAX_FIDS; i++ ) - ai->fids[i] = transmit_allocate (ai,AIRO_DEF_MTU,i>=MAX_FIDS/2); - - enable_interrupts( ai ); - netif_wake_queue(dev); - return 0; -} - -EXPORT_SYMBOL(reset_airo_card); - -static void airo_send_event(struct net_device *dev) { - struct airo_info *ai = dev->ml_priv; - union iwreq_data wrqu; - StatusRid status_rid; - - clear_bit(JOB_EVENT, &ai->jobs); - PC4500_readrid(ai, RID_STATUS, &status_rid, sizeof(status_rid), 0); - up(&ai->sem); - wrqu.data.length = 0; - wrqu.data.flags = 0; - memcpy(wrqu.ap_addr.sa_data, status_rid.bssid[0], ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - - /* Send event to user space */ - wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); -} - -static void airo_process_scan_results (struct airo_info *ai) { - union iwreq_data wrqu; - BSSListRid bss; - int rc; - BSSListElement * loop_net; - BSSListElement * tmp_net; - - /* Blow away current list of scan results */ - list_for_each_entry_safe (loop_net, tmp_net, &ai->network_list, list) { - list_move_tail (&loop_net->list, &ai->network_free_list); - /* Don't blow away ->list, just BSS data */ - memset (loop_net, 0, sizeof (loop_net->bss)); - } - - /* Try to read the first entry of the scan result */ - rc = PC4500_readrid(ai, ai->bssListFirst, &bss, ai->bssListRidLen, 0); - if((rc) || (bss.index == cpu_to_le16(0xffff))) { - /* No scan results */ - goto out; - } - - /* Read and parse all entries */ - tmp_net = NULL; - while((!rc) && (bss.index != cpu_to_le16(0xffff))) { - /* Grab a network off the free list */ - if (!list_empty(&ai->network_free_list)) { - tmp_net = list_entry(ai->network_free_list.next, - BSSListElement, list); - list_del(ai->network_free_list.next); - } - - if (tmp_net != NULL) { - memcpy(tmp_net, &bss, sizeof(tmp_net->bss)); - list_add_tail(&tmp_net->list, &ai->network_list); - tmp_net = NULL; - } - - /* Read next entry */ - rc = PC4500_readrid(ai, ai->bssListNext, - &bss, ai->bssListRidLen, 0); - } - -out: - ai->scan_timeout = 0; - clear_bit(JOB_SCAN_RESULTS, &ai->jobs); - up(&ai->sem); - - /* Send an empty event to user space. - * We don't send the received data on - * the event because it would require - * us to do complex transcoding, and - * we want to minimise the work done in - * the irq handler. Use a request to - * extract the data - Jean II */ - wrqu.data.length = 0; - wrqu.data.flags = 0; - wireless_send_event(ai->dev, SIOCGIWSCAN, &wrqu, NULL); -} - -static int airo_thread(void *data) { - struct net_device *dev = data; - struct airo_info *ai = dev->ml_priv; - int locked; - - set_freezable(); - while(1) { - /* make swsusp happy with our thread */ - try_to_freeze(); - - if (test_bit(JOB_DIE, &ai->jobs)) - break; - - if (ai->jobs) { - locked = down_interruptible(&ai->sem); - } else { - wait_queue_t wait; - - init_waitqueue_entry(&wait, current); - add_wait_queue(&ai->thr_wait, &wait); - for (;;) { - set_current_state(TASK_INTERRUPTIBLE); - if (ai->jobs) - break; - if (ai->expires || ai->scan_timeout) { - if (ai->scan_timeout && - time_after_eq(jiffies,ai->scan_timeout)){ - set_bit(JOB_SCAN_RESULTS, &ai->jobs); - break; - } else if (ai->expires && - time_after_eq(jiffies,ai->expires)){ - set_bit(JOB_AUTOWEP, &ai->jobs); - break; - } - if (!kthread_should_stop() && - !freezing(current)) { - unsigned long wake_at; - if (!ai->expires || !ai->scan_timeout) { - wake_at = max(ai->expires, - ai->scan_timeout); - } else { - wake_at = min(ai->expires, - ai->scan_timeout); - } - schedule_timeout(wake_at - jiffies); - continue; - } - } else if (!kthread_should_stop() && - !freezing(current)) { - schedule(); - continue; - } - break; - } - current->state = TASK_RUNNING; - remove_wait_queue(&ai->thr_wait, &wait); - locked = 1; - } - - if (locked) - continue; - - if (test_bit(JOB_DIE, &ai->jobs)) { - up(&ai->sem); - break; - } - - if (ai->power.event || test_bit(FLAG_FLASHING, &ai->flags)) { - up(&ai->sem); - continue; - } - - if (test_bit(JOB_XMIT, &ai->jobs)) - airo_end_xmit(dev); - else if (test_bit(JOB_XMIT11, &ai->jobs)) - airo_end_xmit11(dev); - else if (test_bit(JOB_STATS, &ai->jobs)) - airo_read_stats(dev); - else if (test_bit(JOB_WSTATS, &ai->jobs)) - airo_read_wireless_stats(ai); - else if (test_bit(JOB_PROMISC, &ai->jobs)) - airo_set_promisc(ai); - else if (test_bit(JOB_MIC, &ai->jobs)) - micinit(ai); - else if (test_bit(JOB_EVENT, &ai->jobs)) - airo_send_event(dev); - else if (test_bit(JOB_AUTOWEP, &ai->jobs)) - timer_func(dev); - else if (test_bit(JOB_SCAN_RESULTS, &ai->jobs)) - airo_process_scan_results(ai); - else /* Shouldn't get here, but we make sure to unlock */ - up(&ai->sem); - } - - return 0; -} - -static int header_len(__le16 ctl) -{ - u16 fc = le16_to_cpu(ctl); - switch (fc & 0xc) { - case 4: - if ((fc & 0xe0) == 0xc0) - return 10; /* one-address control packet */ - return 16; /* two-address control packet */ - case 8: - if ((fc & 0x300) == 0x300) - return 30; /* WDS packet */ - } - return 24; -} - -static void airo_handle_cisco_mic(struct airo_info *ai) -{ - if (test_bit(FLAG_MIC_CAPABLE, &ai->flags)) { - set_bit(JOB_MIC, &ai->jobs); - wake_up_interruptible(&ai->thr_wait); - } -} - -/* Airo Status codes */ -#define STAT_NOBEACON 0x8000 /* Loss of sync - missed beacons */ -#define STAT_MAXRETRIES 0x8001 /* Loss of sync - max retries */ -#define STAT_MAXARL 0x8002 /* Loss of sync - average retry level exceeded*/ -#define STAT_FORCELOSS 0x8003 /* Loss of sync - host request */ -#define STAT_TSFSYNC 0x8004 /* Loss of sync - TSF synchronization */ -#define STAT_DEAUTH 0x8100 /* low byte is 802.11 reason code */ -#define STAT_DISASSOC 0x8200 /* low byte is 802.11 reason code */ -#define STAT_ASSOC_FAIL 0x8400 /* low byte is 802.11 reason code */ -#define STAT_AUTH_FAIL 0x0300 /* low byte is 802.11 reason code */ -#define STAT_ASSOC 0x0400 /* Associated */ -#define STAT_REASSOC 0x0600 /* Reassociated? Only on firmware >= 5.30.17 */ - -static void airo_print_status(const char *devname, u16 status) -{ - u8 reason = status & 0xFF; - - switch (status & 0xFF00) { - case STAT_NOBEACON: - switch (status) { - case STAT_NOBEACON: - airo_print_dbg(devname, "link lost (missed beacons)"); - break; - case STAT_MAXRETRIES: - case STAT_MAXARL: - airo_print_dbg(devname, "link lost (max retries)"); - break; - case STAT_FORCELOSS: - airo_print_dbg(devname, "link lost (local choice)"); - break; - case STAT_TSFSYNC: - airo_print_dbg(devname, "link lost (TSF sync lost)"); - break; - default: - airo_print_dbg(devname, "unknow status %x\n", status); - break; - } - break; - case STAT_DEAUTH: - airo_print_dbg(devname, "deauthenticated (reason: %d)", reason); - break; - case STAT_DISASSOC: - airo_print_dbg(devname, "disassociated (reason: %d)", reason); - break; - case STAT_ASSOC_FAIL: - airo_print_dbg(devname, "association failed (reason: %d)", - reason); - break; - case STAT_AUTH_FAIL: - airo_print_dbg(devname, "authentication failed (reason: %d)", - reason); - break; - case STAT_ASSOC: - case STAT_REASSOC: - break; - default: - airo_print_dbg(devname, "unknow status %x\n", status); - break; - } -} - -static void airo_handle_link(struct airo_info *ai) -{ - union iwreq_data wrqu; - int scan_forceloss = 0; - u16 status; - - /* Get new status and acknowledge the link change */ - status = le16_to_cpu(IN4500(ai, LINKSTAT)); - OUT4500(ai, EVACK, EV_LINK); - - if ((status == STAT_FORCELOSS) && (ai->scan_timeout > 0)) - scan_forceloss = 1; - - airo_print_status(ai->dev->name, status); - - if ((status == STAT_ASSOC) || (status == STAT_REASSOC)) { - if (auto_wep) - ai->expires = 0; - if (ai->list_bss_task) - wake_up_process(ai->list_bss_task); - set_bit(FLAG_UPDATE_UNI, &ai->flags); - set_bit(FLAG_UPDATE_MULTI, &ai->flags); - - if (down_trylock(&ai->sem) != 0) { - set_bit(JOB_EVENT, &ai->jobs); - wake_up_interruptible(&ai->thr_wait); - } else - airo_send_event(ai->dev); - } else if (!scan_forceloss) { - if (auto_wep && !ai->expires) { - ai->expires = RUN_AT(3*HZ); - wake_up_interruptible(&ai->thr_wait); - } - - /* Send event to user space */ - memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - wireless_send_event(ai->dev, SIOCGIWAP, &wrqu, NULL); - } -} - -static void airo_handle_rx(struct airo_info *ai) -{ - struct sk_buff *skb = NULL; - __le16 fc, v, *buffer, tmpbuf[4]; - u16 len, hdrlen = 0, gap, fid; - struct rx_hdr hdr; - int success = 0; - - if (test_bit(FLAG_MPI, &ai->flags)) { - if (test_bit(FLAG_802_11, &ai->flags)) - mpi_receive_802_11(ai); - else - mpi_receive_802_3(ai); - OUT4500(ai, EVACK, EV_RX); - return; - } - - fid = IN4500(ai, RXFID); - - /* Get the packet length */ - if (test_bit(FLAG_802_11, &ai->flags)) { - bap_setup (ai, fid, 4, BAP0); - bap_read (ai, (__le16*)&hdr, sizeof(hdr), BAP0); - /* Bad CRC. Ignore packet */ - if (le16_to_cpu(hdr.status) & 2) - hdr.len = 0; - if (ai->wifidev == NULL) - hdr.len = 0; - } else { - bap_setup(ai, fid, 0x36, BAP0); - bap_read(ai, &hdr.len, 2, BAP0); - } - len = le16_to_cpu(hdr.len); - - if (len > AIRO_DEF_MTU) { - airo_print_err(ai->dev->name, "Bad size %d", len); - goto done; - } - if (len == 0) - goto done; - - if (test_bit(FLAG_802_11, &ai->flags)) { - bap_read(ai, &fc, sizeof (fc), BAP0); - hdrlen = header_len(fc); - } else - hdrlen = ETH_ALEN * 2; - - skb = dev_alloc_skb(len + hdrlen + 2 + 2); - if (!skb) { - ai->dev->stats.rx_dropped++; - goto done; - } - - skb_reserve(skb, 2); /* This way the IP header is aligned */ - buffer = (__le16 *) skb_put(skb, len + hdrlen); - if (test_bit(FLAG_802_11, &ai->flags)) { - buffer[0] = fc; - bap_read(ai, buffer + 1, hdrlen - 2, BAP0); - if (hdrlen == 24) - bap_read(ai, tmpbuf, 6, BAP0); - - bap_read(ai, &v, sizeof(v), BAP0); - gap = le16_to_cpu(v); - if (gap) { - if (gap <= 8) { - bap_read(ai, tmpbuf, gap, BAP0); - } else { - airo_print_err(ai->dev->name, "gaplen too " - "big. Problems will follow..."); - } - } - bap_read(ai, buffer + hdrlen/2, len, BAP0); - } else { - MICBuffer micbuf; - - bap_read(ai, buffer, ETH_ALEN * 2, BAP0); - if (ai->micstats.enabled) { - bap_read(ai, (__le16 *) &micbuf, sizeof (micbuf), BAP0); - if (ntohs(micbuf.typelen) > 0x05DC) - bap_setup(ai, fid, 0x44, BAP0); - else { - if (len <= sizeof (micbuf)) { - dev_kfree_skb_irq(skb); - goto done; - } - - len -= sizeof(micbuf); - skb_trim(skb, len + hdrlen); - } - } - - bap_read(ai, buffer + ETH_ALEN, len, BAP0); - if (decapsulate(ai, &micbuf, (etherHead*) buffer, len)) - dev_kfree_skb_irq (skb); - else - success = 1; - } - -#ifdef WIRELESS_SPY - if (success && (ai->spy_data.spy_number > 0)) { - char *sa; - struct iw_quality wstats; - - /* Prepare spy data : addr + qual */ - if (!test_bit(FLAG_802_11, &ai->flags)) { - sa = (char *) buffer + 6; - bap_setup(ai, fid, 8, BAP0); - bap_read(ai, (__le16 *) hdr.rssi, 2, BAP0); - } else - sa = (char *) buffer + 10; - wstats.qual = hdr.rssi[0]; - if (ai->rssi) - wstats.level = 0x100 - ai->rssi[hdr.rssi[1]].rssidBm; - else - wstats.level = (hdr.rssi[1] + 321) / 2; - wstats.noise = ai->wstats.qual.noise; - wstats.updated = IW_QUAL_LEVEL_UPDATED - | IW_QUAL_QUAL_UPDATED - | IW_QUAL_DBM; - /* Update spy records */ - wireless_spy_update(ai->dev, sa, &wstats); - } -#endif /* WIRELESS_SPY */ - -done: - OUT4500(ai, EVACK, EV_RX); - - if (success) { - if (test_bit(FLAG_802_11, &ai->flags)) { - skb_reset_mac_header(skb); - skb->pkt_type = PACKET_OTHERHOST; - skb->dev = ai->wifidev; - skb->protocol = htons(ETH_P_802_2); - } else - skb->protocol = eth_type_trans(skb, ai->dev); - skb->ip_summed = CHECKSUM_NONE; - - netif_rx(skb); - } -} - -static void airo_handle_tx(struct airo_info *ai, u16 status) -{ - int i, len = 0, index = -1; - u16 fid; - - if (test_bit(FLAG_MPI, &ai->flags)) { - unsigned long flags; - - if (status & EV_TXEXC) - get_tx_error(ai, -1); - - spin_lock_irqsave(&ai->aux_lock, flags); - if (!skb_queue_empty(&ai->txq)) { - spin_unlock_irqrestore(&ai->aux_lock,flags); - mpi_send_packet(ai->dev); - } else { - clear_bit(FLAG_PENDING_XMIT, &ai->flags); - spin_unlock_irqrestore(&ai->aux_lock,flags); - netif_wake_queue(ai->dev); - } - OUT4500(ai, EVACK, status & (EV_TX | EV_TXCPY | EV_TXEXC)); - return; - } - - fid = IN4500(ai, TXCOMPLFID); - - for(i = 0; i < MAX_FIDS; i++) { - if ((ai->fids[i] & 0xffff) == fid) { - len = ai->fids[i] >> 16; - index = i; - } - } - - if (index != -1) { - if (status & EV_TXEXC) - get_tx_error(ai, index); - - OUT4500(ai, EVACK, status & (EV_TX | EV_TXEXC)); - - /* Set up to be used again */ - ai->fids[index] &= 0xffff; - if (index < MAX_FIDS / 2) { - if (!test_bit(FLAG_PENDING_XMIT, &ai->flags)) - netif_wake_queue(ai->dev); - } else { - if (!test_bit(FLAG_PENDING_XMIT11, &ai->flags)) - netif_wake_queue(ai->wifidev); - } - } else { - OUT4500(ai, EVACK, status & (EV_TX | EV_TXCPY | EV_TXEXC)); - airo_print_err(ai->dev->name, "Unallocated FID was used to xmit"); - } -} - -static irqreturn_t airo_interrupt(int irq, void *dev_id) -{ - struct net_device *dev = dev_id; - u16 status, savedInterrupts = 0; - struct airo_info *ai = dev->ml_priv; - int handled = 0; - - if (!netif_device_present(dev)) - return IRQ_NONE; - - for (;;) { - status = IN4500(ai, EVSTAT); - if (!(status & STATUS_INTS) || (status == 0xffff)) - break; - - handled = 1; - - if (status & EV_AWAKE) { - OUT4500(ai, EVACK, EV_AWAKE); - OUT4500(ai, EVACK, EV_AWAKE); - } - - if (!savedInterrupts) { - savedInterrupts = IN4500(ai, EVINTEN); - OUT4500(ai, EVINTEN, 0); - } - - if (status & EV_MIC) { - OUT4500(ai, EVACK, EV_MIC); - airo_handle_cisco_mic(ai); - } - - if (status & EV_LINK) { - /* Link status changed */ - airo_handle_link(ai); - } - - /* Check to see if there is something to receive */ - if (status & EV_RX) - airo_handle_rx(ai); - - /* Check to see if a packet has been transmitted */ - if (status & (EV_TX | EV_TXCPY | EV_TXEXC)) - airo_handle_tx(ai, status); - - if ( status & ~STATUS_INTS & ~IGNORE_INTS ) { - airo_print_warn(ai->dev->name, "Got weird status %x", - status & ~STATUS_INTS & ~IGNORE_INTS ); - } - } - - if (savedInterrupts) - OUT4500(ai, EVINTEN, savedInterrupts); - - return IRQ_RETVAL(handled); -} - -/* - * Routines to talk to the card - */ - -/* - * This was originally written for the 4500, hence the name - * NOTE: If use with 8bit mode and SMP bad things will happen! - * Why would some one do 8 bit IO in an SMP machine?!? - */ -static void OUT4500( struct airo_info *ai, u16 reg, u16 val ) { - if (test_bit(FLAG_MPI,&ai->flags)) - reg <<= 1; - if ( !do8bitIO ) - outw( val, ai->dev->base_addr + reg ); - else { - outb( val & 0xff, ai->dev->base_addr + reg ); - outb( val >> 8, ai->dev->base_addr + reg + 1 ); - } -} - -static u16 IN4500( struct airo_info *ai, u16 reg ) { - unsigned short rc; - - if (test_bit(FLAG_MPI,&ai->flags)) - reg <<= 1; - if ( !do8bitIO ) - rc = inw( ai->dev->base_addr + reg ); - else { - rc = inb( ai->dev->base_addr + reg ); - rc += ((int)inb( ai->dev->base_addr + reg + 1 )) << 8; - } - return rc; -} - -static int enable_MAC(struct airo_info *ai, int lock) -{ - int rc; - Cmd cmd; - Resp rsp; - - /* FLAG_RADIO_OFF : Radio disabled via /proc or Wireless Extensions - * FLAG_RADIO_DOWN : Radio disabled via "ifconfig ethX down" - * Note : we could try to use !netif_running(dev) in enable_MAC() - * instead of this flag, but I don't trust it *within* the - * open/close functions, and testing both flags together is - * "cheaper" - Jean II */ - if (ai->flags & FLAG_RADIO_MASK) return SUCCESS; - - if (lock && down_interruptible(&ai->sem)) - return -ERESTARTSYS; - - if (!test_bit(FLAG_ENABLED, &ai->flags)) { - memset(&cmd, 0, sizeof(cmd)); - cmd.cmd = MAC_ENABLE; - rc = issuecommand(ai, &cmd, &rsp); - if (rc == SUCCESS) - set_bit(FLAG_ENABLED, &ai->flags); - } else - rc = SUCCESS; - - if (lock) - up(&ai->sem); - - if (rc) - airo_print_err(ai->dev->name, "Cannot enable MAC"); - else if ((rsp.status & 0xFF00) != 0) { - airo_print_err(ai->dev->name, "Bad MAC enable reason=%x, " - "rid=%x, offset=%d", rsp.rsp0, rsp.rsp1, rsp.rsp2); - rc = ERROR; - } - return rc; -} - -static void disable_MAC( struct airo_info *ai, int lock ) { - Cmd cmd; - Resp rsp; - - if (lock && down_interruptible(&ai->sem)) - return; - - if (test_bit(FLAG_ENABLED, &ai->flags)) { - memset(&cmd, 0, sizeof(cmd)); - cmd.cmd = MAC_DISABLE; // disable in case already enabled - issuecommand(ai, &cmd, &rsp); - clear_bit(FLAG_ENABLED, &ai->flags); - } - if (lock) - up(&ai->sem); -} - -static void enable_interrupts( struct airo_info *ai ) { - /* Enable the interrupts */ - OUT4500( ai, EVINTEN, STATUS_INTS ); -} - -static void disable_interrupts( struct airo_info *ai ) { - OUT4500( ai, EVINTEN, 0 ); -} - -static void mpi_receive_802_3(struct airo_info *ai) -{ - RxFid rxd; - int len = 0; - struct sk_buff *skb; - char *buffer; - int off = 0; - MICBuffer micbuf; - - memcpy_fromio(&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd)); - /* Make sure we got something */ - if (rxd.rdy && rxd.valid == 0) { - len = rxd.len + 12; - if (len < 12 || len > 2048) - goto badrx; - - skb = dev_alloc_skb(len); - if (!skb) { - ai->dev->stats.rx_dropped++; - goto badrx; - } - buffer = skb_put(skb,len); - memcpy(buffer, ai->rxfids[0].virtual_host_addr, ETH_ALEN * 2); - if (ai->micstats.enabled) { - memcpy(&micbuf, - ai->rxfids[0].virtual_host_addr + ETH_ALEN * 2, - sizeof(micbuf)); - if (ntohs(micbuf.typelen) <= 0x05DC) { - if (len <= sizeof(micbuf) + ETH_ALEN * 2) - goto badmic; - - off = sizeof(micbuf); - skb_trim (skb, len - off); - } - } - memcpy(buffer + ETH_ALEN * 2, - ai->rxfids[0].virtual_host_addr + ETH_ALEN * 2 + off, - len - ETH_ALEN * 2 - off); - if (decapsulate (ai, &micbuf, (etherHead*)buffer, len - off - ETH_ALEN * 2)) { -badmic: - dev_kfree_skb_irq (skb); - goto badrx; - } -#ifdef WIRELESS_SPY - if (ai->spy_data.spy_number > 0) { - char *sa; - struct iw_quality wstats; - /* Prepare spy data : addr + qual */ - sa = buffer + ETH_ALEN; - wstats.qual = 0; /* XXX Where do I get that info from ??? */ - wstats.level = 0; - wstats.updated = 0; - /* Update spy records */ - wireless_spy_update(ai->dev, sa, &wstats); - } -#endif /* WIRELESS_SPY */ - - skb->ip_summed = CHECKSUM_NONE; - skb->protocol = eth_type_trans(skb, ai->dev); - netif_rx(skb); - } -badrx: - if (rxd.valid == 0) { - rxd.valid = 1; - rxd.rdy = 0; - rxd.len = PKTSIZE; - memcpy_toio(ai->rxfids[0].card_ram_off, &rxd, sizeof(rxd)); - } -} - -static void mpi_receive_802_11(struct airo_info *ai) -{ - RxFid rxd; - struct sk_buff *skb = NULL; - u16 len, hdrlen = 0; - __le16 fc; - struct rx_hdr hdr; - u16 gap; - u16 *buffer; - char *ptr = ai->rxfids[0].virtual_host_addr + 4; - - memcpy_fromio(&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd)); - memcpy ((char *)&hdr, ptr, sizeof(hdr)); - ptr += sizeof(hdr); - /* Bad CRC. Ignore packet */ - if (le16_to_cpu(hdr.status) & 2) - hdr.len = 0; - if (ai->wifidev == NULL) - hdr.len = 0; - len = le16_to_cpu(hdr.len); - if (len > AIRO_DEF_MTU) { - airo_print_err(ai->dev->name, "Bad size %d", len); - goto badrx; - } - if (len == 0) - goto badrx; - - fc = get_unaligned((__le16 *)ptr); - hdrlen = header_len(fc); - - skb = dev_alloc_skb( len + hdrlen + 2 ); - if ( !skb ) { - ai->dev->stats.rx_dropped++; - goto badrx; - } - buffer = (u16*)skb_put (skb, len + hdrlen); - memcpy ((char *)buffer, ptr, hdrlen); - ptr += hdrlen; - if (hdrlen == 24) - ptr += 6; - gap = get_unaligned_le16(ptr); - ptr += sizeof(__le16); - if (gap) { - if (gap <= 8) - ptr += gap; - else - airo_print_err(ai->dev->name, - "gaplen too big. Problems will follow..."); - } - memcpy ((char *)buffer + hdrlen, ptr, len); - ptr += len; -#ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ - if (ai->spy_data.spy_number > 0) { - char *sa; - struct iw_quality wstats; - /* Prepare spy data : addr + qual */ - sa = (char*)buffer + 10; - wstats.qual = hdr.rssi[0]; - if (ai->rssi) - wstats.level = 0x100 - ai->rssi[hdr.rssi[1]].rssidBm; - else - wstats.level = (hdr.rssi[1] + 321) / 2; - wstats.noise = ai->wstats.qual.noise; - wstats.updated = IW_QUAL_QUAL_UPDATED - | IW_QUAL_LEVEL_UPDATED - | IW_QUAL_DBM; - /* Update spy records */ - wireless_spy_update(ai->dev, sa, &wstats); - } -#endif /* IW_WIRELESS_SPY */ - skb_reset_mac_header(skb); - skb->pkt_type = PACKET_OTHERHOST; - skb->dev = ai->wifidev; - skb->protocol = htons(ETH_P_802_2); - skb->ip_summed = CHECKSUM_NONE; - netif_rx( skb ); - -badrx: - if (rxd.valid == 0) { - rxd.valid = 1; - rxd.rdy = 0; - rxd.len = PKTSIZE; - memcpy_toio(ai->rxfids[0].card_ram_off, &rxd, sizeof(rxd)); - } -} - -static u16 setup_card(struct airo_info *ai, u8 *mac, int lock) -{ - Cmd cmd; - Resp rsp; - int status; - SsidRid mySsid; - __le16 lastindex; - WepKeyRid wkr; - int rc; - - memset( &mySsid, 0, sizeof( mySsid ) ); - kfree (ai->flash); - ai->flash = NULL; - - /* The NOP is the first step in getting the card going */ - cmd.cmd = NOP; - cmd.parm0 = cmd.parm1 = cmd.parm2 = 0; - if (lock && down_interruptible(&ai->sem)) - return ERROR; - if ( issuecommand( ai, &cmd, &rsp ) != SUCCESS ) { - if (lock) - up(&ai->sem); - return ERROR; - } - disable_MAC( ai, 0); - - // Let's figure out if we need to use the AUX port - if (!test_bit(FLAG_MPI,&ai->flags)) { - cmd.cmd = CMD_ENABLEAUX; - if (issuecommand(ai, &cmd, &rsp) != SUCCESS) { - if (lock) - up(&ai->sem); - airo_print_err(ai->dev->name, "Error checking for AUX port"); - return ERROR; - } - if (!aux_bap || rsp.status & 0xff00) { - ai->bap_read = fast_bap_read; - airo_print_dbg(ai->dev->name, "Doing fast bap_reads"); - } else { - ai->bap_read = aux_bap_read; - airo_print_dbg(ai->dev->name, "Doing AUX bap_reads"); - } - } - if (lock) - up(&ai->sem); - if (ai->config.len == 0) { - int i; - tdsRssiRid rssi_rid; - CapabilityRid cap_rid; - - kfree(ai->APList); - ai->APList = NULL; - kfree(ai->SSID); - ai->SSID = NULL; - // general configuration (read/modify/write) - status = readConfigRid(ai, lock); - if ( status != SUCCESS ) return ERROR; - - status = readCapabilityRid(ai, &cap_rid, lock); - if ( status != SUCCESS ) return ERROR; - - status = PC4500_readrid(ai,RID_RSSI,&rssi_rid,sizeof(rssi_rid),lock); - if ( status == SUCCESS ) { - if (ai->rssi || (ai->rssi = kmalloc(512, GFP_KERNEL)) != NULL) - memcpy(ai->rssi, (u8*)&rssi_rid + 2, 512); /* Skip RID length member */ - } - else { - kfree(ai->rssi); - ai->rssi = NULL; - if (cap_rid.softCap & cpu_to_le16(8)) - ai->config.rmode |= RXMODE_NORMALIZED_RSSI; - else - airo_print_warn(ai->dev->name, "unknown received signal " - "level scale"); - } - ai->config.opmode = adhoc ? MODE_STA_IBSS : MODE_STA_ESS; - ai->config.authType = AUTH_OPEN; - ai->config.modulation = MOD_CCK; - - if (le16_to_cpu(cap_rid.len) >= sizeof(cap_rid) && - (cap_rid.extSoftCap & cpu_to_le16(1)) && - micsetup(ai) == SUCCESS) { - ai->config.opmode |= MODE_MIC; - set_bit(FLAG_MIC_CAPABLE, &ai->flags); - } - - /* Save off the MAC */ - for( i = 0; i < ETH_ALEN; i++ ) { - mac[i] = ai->config.macAddr[i]; - } - - /* Check to see if there are any insmod configured - rates to add */ - if ( rates[0] ) { - memset(ai->config.rates,0,sizeof(ai->config.rates)); - for( i = 0; i < 8 && rates[i]; i++ ) { - ai->config.rates[i] = rates[i]; - } - } - set_bit (FLAG_COMMIT, &ai->flags); - } - - /* Setup the SSIDs if present */ - if ( ssids[0] ) { - int i; - for( i = 0; i < 3 && ssids[i]; i++ ) { - size_t len = strlen(ssids[i]); - if (len > 32) - len = 32; - mySsid.ssids[i].len = cpu_to_le16(len); - memcpy(mySsid.ssids[i].ssid, ssids[i], len); - } - mySsid.len = cpu_to_le16(sizeof(mySsid)); - } - - status = writeConfigRid(ai, lock); - if ( status != SUCCESS ) return ERROR; - - /* Set up the SSID list */ - if ( ssids[0] ) { - status = writeSsidRid(ai, &mySsid, lock); - if ( status != SUCCESS ) return ERROR; - } - - status = enable_MAC(ai, lock); - if (status != SUCCESS) - return ERROR; - - /* Grab the initial wep key, we gotta save it for auto_wep */ - rc = readWepKeyRid(ai, &wkr, 1, lock); - if (rc == SUCCESS) do { - lastindex = wkr.kindex; - if (wkr.kindex == cpu_to_le16(0xffff)) { - ai->defindex = wkr.mac[0]; - } - rc = readWepKeyRid(ai, &wkr, 0, lock); - } while(lastindex != wkr.kindex); - - try_auto_wep(ai); - - return SUCCESS; -} - -static u16 issuecommand(struct airo_info *ai, Cmd *pCmd, Resp *pRsp) { - // Im really paranoid about letting it run forever! - int max_tries = 600000; - - if (IN4500(ai, EVSTAT) & EV_CMD) - OUT4500(ai, EVACK, EV_CMD); - - OUT4500(ai, PARAM0, pCmd->parm0); - OUT4500(ai, PARAM1, pCmd->parm1); - OUT4500(ai, PARAM2, pCmd->parm2); - OUT4500(ai, COMMAND, pCmd->cmd); - - while (max_tries-- && (IN4500(ai, EVSTAT) & EV_CMD) == 0) { - if ((IN4500(ai, COMMAND)) == pCmd->cmd) - // PC4500 didn't notice command, try again - OUT4500(ai, COMMAND, pCmd->cmd); - if (!in_atomic() && (max_tries & 255) == 0) - schedule(); - } - - if ( max_tries == -1 ) { - airo_print_err(ai->dev->name, - "Max tries exceeded when issuing command"); - if (IN4500(ai, COMMAND) & COMMAND_BUSY) - OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY); - return ERROR; - } - - // command completed - pRsp->status = IN4500(ai, STATUS); - pRsp->rsp0 = IN4500(ai, RESP0); - pRsp->rsp1 = IN4500(ai, RESP1); - pRsp->rsp2 = IN4500(ai, RESP2); - if ((pRsp->status & 0xff00)!=0 && pCmd->cmd != CMD_SOFTRESET) - airo_print_err(ai->dev->name, - "cmd:%x status:%x rsp0:%x rsp1:%x rsp2:%x", - pCmd->cmd, pRsp->status, pRsp->rsp0, pRsp->rsp1, - pRsp->rsp2); - - // clear stuck command busy if necessary - if (IN4500(ai, COMMAND) & COMMAND_BUSY) { - OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY); - } - // acknowledge processing the status/response - OUT4500(ai, EVACK, EV_CMD); - - return SUCCESS; -} - -/* Sets up the bap to start exchange data. whichbap should - * be one of the BAP0 or BAP1 defines. Locks should be held before - * calling! */ -static int bap_setup(struct airo_info *ai, u16 rid, u16 offset, int whichbap ) -{ - int timeout = 50; - int max_tries = 3; - - OUT4500(ai, SELECT0+whichbap, rid); - OUT4500(ai, OFFSET0+whichbap, offset); - while (1) { - int status = IN4500(ai, OFFSET0+whichbap); - if (status & BAP_BUSY) { - /* This isn't really a timeout, but its kinda - close */ - if (timeout--) { - continue; - } - } else if ( status & BAP_ERR ) { - /* invalid rid or offset */ - airo_print_err(ai->dev->name, "BAP error %x %d", - status, whichbap ); - return ERROR; - } else if (status & BAP_DONE) { // success - return SUCCESS; - } - if ( !(max_tries--) ) { - airo_print_err(ai->dev->name, - "BAP setup error too many retries\n"); - return ERROR; - } - // -- PC4500 missed it, try again - OUT4500(ai, SELECT0+whichbap, rid); - OUT4500(ai, OFFSET0+whichbap, offset); - timeout = 50; - } -} - -/* should only be called by aux_bap_read. This aux function and the - following use concepts not documented in the developers guide. I - got them from a patch given to my by Aironet */ -static u16 aux_setup(struct airo_info *ai, u16 page, - u16 offset, u16 *len) -{ - u16 next; - - OUT4500(ai, AUXPAGE, page); - OUT4500(ai, AUXOFF, 0); - next = IN4500(ai, AUXDATA); - *len = IN4500(ai, AUXDATA)&0xff; - if (offset != 4) OUT4500(ai, AUXOFF, offset); - return next; -} - -/* requires call to bap_setup() first */ -static int aux_bap_read(struct airo_info *ai, __le16 *pu16Dst, - int bytelen, int whichbap) -{ - u16 len; - u16 page; - u16 offset; - u16 next; - int words; - int i; - unsigned long flags; - - spin_lock_irqsave(&ai->aux_lock, flags); - page = IN4500(ai, SWS0+whichbap); - offset = IN4500(ai, SWS2+whichbap); - next = aux_setup(ai, page, offset, &len); - words = (bytelen+1)>>1; - - for (i=0; i>1) < (words-i) ? (len>>1) : (words-i); - if ( !do8bitIO ) - insw( ai->dev->base_addr+DATA0+whichbap, - pu16Dst+i,count ); - else - insb( ai->dev->base_addr+DATA0+whichbap, - pu16Dst+i, count << 1 ); - i += count; - if (iaux_lock, flags); - return SUCCESS; -} - - -/* requires call to bap_setup() first */ -static int fast_bap_read(struct airo_info *ai, __le16 *pu16Dst, - int bytelen, int whichbap) -{ - bytelen = (bytelen + 1) & (~1); // round up to even value - if ( !do8bitIO ) - insw( ai->dev->base_addr+DATA0+whichbap, pu16Dst, bytelen>>1 ); - else - insb( ai->dev->base_addr+DATA0+whichbap, pu16Dst, bytelen ); - return SUCCESS; -} - -/* requires call to bap_setup() first */ -static int bap_write(struct airo_info *ai, const __le16 *pu16Src, - int bytelen, int whichbap) -{ - bytelen = (bytelen + 1) & (~1); // round up to even value - if ( !do8bitIO ) - outsw( ai->dev->base_addr+DATA0+whichbap, - pu16Src, bytelen>>1 ); - else - outsb( ai->dev->base_addr+DATA0+whichbap, pu16Src, bytelen ); - return SUCCESS; -} - -static int PC4500_accessrid(struct airo_info *ai, u16 rid, u16 accmd) -{ - Cmd cmd; /* for issuing commands */ - Resp rsp; /* response from commands */ - u16 status; - - memset(&cmd, 0, sizeof(cmd)); - cmd.cmd = accmd; - cmd.parm0 = rid; - status = issuecommand(ai, &cmd, &rsp); - if (status != 0) return status; - if ( (rsp.status & 0x7F00) != 0) { - return (accmd << 8) + (rsp.rsp0 & 0xFF); - } - return 0; -} - -/* Note, that we are using BAP1 which is also used by transmit, so - * we must get a lock. */ -static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len, int lock) -{ - u16 status; - int rc = SUCCESS; - - if (lock) { - if (down_interruptible(&ai->sem)) - return ERROR; - } - if (test_bit(FLAG_MPI,&ai->flags)) { - Cmd cmd; - Resp rsp; - - memset(&cmd, 0, sizeof(cmd)); - memset(&rsp, 0, sizeof(rsp)); - ai->config_desc.rid_desc.valid = 1; - ai->config_desc.rid_desc.len = RIDSIZE; - ai->config_desc.rid_desc.rid = 0; - ai->config_desc.rid_desc.host_addr = ai->ridbus; - - cmd.cmd = CMD_ACCESS; - cmd.parm0 = rid; - - memcpy_toio(ai->config_desc.card_ram_off, - &ai->config_desc.rid_desc, sizeof(Rid)); - - rc = issuecommand(ai, &cmd, &rsp); - - if (rsp.status & 0x7f00) - rc = rsp.rsp0; - if (!rc) - memcpy(pBuf, ai->config_desc.virtual_host_addr, len); - goto done; - } else { - if ((status = PC4500_accessrid(ai, rid, CMD_ACCESS))!=SUCCESS) { - rc = status; - goto done; - } - if (bap_setup(ai, rid, 0, BAP1) != SUCCESS) { - rc = ERROR; - goto done; - } - // read the rid length field - bap_read(ai, pBuf, 2, BAP1); - // length for remaining part of rid - len = min(len, (int)le16_to_cpu(*(__le16*)pBuf)) - 2; - - if ( len <= 2 ) { - airo_print_err(ai->dev->name, - "Rid %x has a length of %d which is too short", - (int)rid, (int)len ); - rc = ERROR; - goto done; - } - // read remainder of the rid - rc = bap_read(ai, ((__le16*)pBuf)+1, len, BAP1); - } -done: - if (lock) - up(&ai->sem); - return rc; -} - -/* Note, that we are using BAP1 which is also used by transmit, so - * make sure this isn't called when a transmit is happening */ -static int PC4500_writerid(struct airo_info *ai, u16 rid, - const void *pBuf, int len, int lock) -{ - u16 status; - int rc = SUCCESS; - - *(__le16*)pBuf = cpu_to_le16((u16)len); - - if (lock) { - if (down_interruptible(&ai->sem)) - return ERROR; - } - if (test_bit(FLAG_MPI,&ai->flags)) { - Cmd cmd; - Resp rsp; - - if (test_bit(FLAG_ENABLED, &ai->flags) && (RID_WEP_TEMP != rid)) - airo_print_err(ai->dev->name, - "%s: MAC should be disabled (rid=%04x)", - __func__, rid); - memset(&cmd, 0, sizeof(cmd)); - memset(&rsp, 0, sizeof(rsp)); - - ai->config_desc.rid_desc.valid = 1; - ai->config_desc.rid_desc.len = *((u16 *)pBuf); - ai->config_desc.rid_desc.rid = 0; - - cmd.cmd = CMD_WRITERID; - cmd.parm0 = rid; - - memcpy_toio(ai->config_desc.card_ram_off, - &ai->config_desc.rid_desc, sizeof(Rid)); - - if (len < 4 || len > 2047) { - airo_print_err(ai->dev->name, "%s: len=%d", __func__, len); - rc = -1; - } else { - memcpy(ai->config_desc.virtual_host_addr, - pBuf, len); - - rc = issuecommand(ai, &cmd, &rsp); - if ((rc & 0xff00) != 0) { - airo_print_err(ai->dev->name, "%s: Write rid Error %d", - __func__, rc); - airo_print_err(ai->dev->name, "%s: Cmd=%04x", - __func__, cmd.cmd); - } - - if ((rsp.status & 0x7f00)) - rc = rsp.rsp0; - } - } else { - // --- first access so that we can write the rid data - if ( (status = PC4500_accessrid(ai, rid, CMD_ACCESS)) != 0) { - rc = status; - goto done; - } - // --- now write the rid data - if (bap_setup(ai, rid, 0, BAP1) != SUCCESS) { - rc = ERROR; - goto done; - } - bap_write(ai, pBuf, len, BAP1); - // ---now commit the rid data - rc = PC4500_accessrid(ai, rid, 0x100|CMD_ACCESS); - } -done: - if (lock) - up(&ai->sem); - return rc; -} - -/* Allocates a FID to be used for transmitting packets. We only use - one for now. */ -static u16 transmit_allocate(struct airo_info *ai, int lenPayload, int raw) -{ - unsigned int loop = 3000; - Cmd cmd; - Resp rsp; - u16 txFid; - __le16 txControl; - - cmd.cmd = CMD_ALLOCATETX; - cmd.parm0 = lenPayload; - if (down_interruptible(&ai->sem)) - return ERROR; - if (issuecommand(ai, &cmd, &rsp) != SUCCESS) { - txFid = ERROR; - goto done; - } - if ( (rsp.status & 0xFF00) != 0) { - txFid = ERROR; - goto done; - } - /* wait for the allocate event/indication - * It makes me kind of nervous that this can just sit here and spin, - * but in practice it only loops like four times. */ - while (((IN4500(ai, EVSTAT) & EV_ALLOC) == 0) && --loop); - if (!loop) { - txFid = ERROR; - goto done; - } - - // get the allocated fid and acknowledge - txFid = IN4500(ai, TXALLOCFID); - OUT4500(ai, EVACK, EV_ALLOC); - - /* The CARD is pretty cool since it converts the ethernet packet - * into 802.11. Also note that we don't release the FID since we - * will be using the same one over and over again. */ - /* We only have to setup the control once since we are not - * releasing the fid. */ - if (raw) - txControl = cpu_to_le16(TXCTL_TXOK | TXCTL_TXEX | TXCTL_802_11 - | TXCTL_ETHERNET | TXCTL_NORELEASE); - else - txControl = cpu_to_le16(TXCTL_TXOK | TXCTL_TXEX | TXCTL_802_3 - | TXCTL_ETHERNET | TXCTL_NORELEASE); - if (bap_setup(ai, txFid, 0x0008, BAP1) != SUCCESS) - txFid = ERROR; - else - bap_write(ai, &txControl, sizeof(txControl), BAP1); - -done: - up(&ai->sem); - - return txFid; -} - -/* In general BAP1 is dedicated to transmiting packets. However, - since we need a BAP when accessing RIDs, we also use BAP1 for that. - Make sure the BAP1 spinlock is held when this is called. */ -static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket) -{ - __le16 payloadLen; - Cmd cmd; - Resp rsp; - int miclen = 0; - u16 txFid = len; - MICBuffer pMic; - - len >>= 16; - - if (len <= ETH_ALEN * 2) { - airo_print_warn(ai->dev->name, "Short packet %d", len); - return ERROR; - } - len -= ETH_ALEN * 2; - - if (test_bit(FLAG_MIC_CAPABLE, &ai->flags) && ai->micstats.enabled && - (ntohs(((__be16 *)pPacket)[6]) != 0x888E)) { - if (encapsulate(ai,(etherHead *)pPacket,&pMic,len) != SUCCESS) - return ERROR; - miclen = sizeof(pMic); - } - // packet is destination[6], source[6], payload[len-12] - // write the payload length and dst/src/payload - if (bap_setup(ai, txFid, 0x0036, BAP1) != SUCCESS) return ERROR; - /* The hardware addresses aren't counted as part of the payload, so - * we have to subtract the 12 bytes for the addresses off */ - payloadLen = cpu_to_le16(len + miclen); - bap_write(ai, &payloadLen, sizeof(payloadLen),BAP1); - bap_write(ai, (__le16*)pPacket, sizeof(etherHead), BAP1); - if (miclen) - bap_write(ai, (__le16*)&pMic, miclen, BAP1); - bap_write(ai, (__le16*)(pPacket + sizeof(etherHead)), len, BAP1); - // issue the transmit command - memset( &cmd, 0, sizeof( cmd ) ); - cmd.cmd = CMD_TRANSMIT; - cmd.parm0 = txFid; - if (issuecommand(ai, &cmd, &rsp) != SUCCESS) return ERROR; - if ( (rsp.status & 0xFF00) != 0) return ERROR; - return SUCCESS; -} - -static int transmit_802_11_packet(struct airo_info *ai, int len, char *pPacket) -{ - __le16 fc, payloadLen; - Cmd cmd; - Resp rsp; - int hdrlen; - static u8 tail[(30-10) + 2 + 6] = {[30-10] = 6}; - /* padding of header to full size + le16 gaplen (6) + gaplen bytes */ - u16 txFid = len; - len >>= 16; - - fc = *(__le16*)pPacket; - hdrlen = header_len(fc); - - if (len < hdrlen) { - airo_print_warn(ai->dev->name, "Short packet %d", len); - return ERROR; - } - - /* packet is 802.11 header + payload - * write the payload length and dst/src/payload */ - if (bap_setup(ai, txFid, 6, BAP1) != SUCCESS) return ERROR; - /* The 802.11 header aren't counted as part of the payload, so - * we have to subtract the header bytes off */ - payloadLen = cpu_to_le16(len-hdrlen); - bap_write(ai, &payloadLen, sizeof(payloadLen),BAP1); - if (bap_setup(ai, txFid, 0x0014, BAP1) != SUCCESS) return ERROR; - bap_write(ai, (__le16 *)pPacket, hdrlen, BAP1); - bap_write(ai, (__le16 *)(tail + (hdrlen - 10)), 38 - hdrlen, BAP1); - - bap_write(ai, (__le16 *)(pPacket + hdrlen), len - hdrlen, BAP1); - // issue the transmit command - memset( &cmd, 0, sizeof( cmd ) ); - cmd.cmd = CMD_TRANSMIT; - cmd.parm0 = txFid; - if (issuecommand(ai, &cmd, &rsp) != SUCCESS) return ERROR; - if ( (rsp.status & 0xFF00) != 0) return ERROR; - return SUCCESS; -} - -/* - * This is the proc_fs routines. It is a bit messier than I would - * like! Feel free to clean it up! - */ - -static ssize_t proc_read( struct file *file, - char __user *buffer, - size_t len, - loff_t *offset); - -static ssize_t proc_write( struct file *file, - const char __user *buffer, - size_t len, - loff_t *offset ); -static int proc_close( struct inode *inode, struct file *file ); - -static int proc_stats_open( struct inode *inode, struct file *file ); -static int proc_statsdelta_open( struct inode *inode, struct file *file ); -static int proc_status_open( struct inode *inode, struct file *file ); -static int proc_SSID_open( struct inode *inode, struct file *file ); -static int proc_APList_open( struct inode *inode, struct file *file ); -static int proc_BSSList_open( struct inode *inode, struct file *file ); -static int proc_config_open( struct inode *inode, struct file *file ); -static int proc_wepkey_open( struct inode *inode, struct file *file ); - -static const struct file_operations proc_statsdelta_ops = { - .owner = THIS_MODULE, - .read = proc_read, - .open = proc_statsdelta_open, - .release = proc_close, - .llseek = default_llseek, -}; - -static const struct file_operations proc_stats_ops = { - .owner = THIS_MODULE, - .read = proc_read, - .open = proc_stats_open, - .release = proc_close, - .llseek = default_llseek, -}; - -static const struct file_operations proc_status_ops = { - .owner = THIS_MODULE, - .read = proc_read, - .open = proc_status_open, - .release = proc_close, - .llseek = default_llseek, -}; - -static const struct file_operations proc_SSID_ops = { - .owner = THIS_MODULE, - .read = proc_read, - .write = proc_write, - .open = proc_SSID_open, - .release = proc_close, - .llseek = default_llseek, -}; - -static const struct file_operations proc_BSSList_ops = { - .owner = THIS_MODULE, - .read = proc_read, - .write = proc_write, - .open = proc_BSSList_open, - .release = proc_close, - .llseek = default_llseek, -}; - -static const struct file_operations proc_APList_ops = { - .owner = THIS_MODULE, - .read = proc_read, - .write = proc_write, - .open = proc_APList_open, - .release = proc_close, - .llseek = default_llseek, -}; - -static const struct file_operations proc_config_ops = { - .owner = THIS_MODULE, - .read = proc_read, - .write = proc_write, - .open = proc_config_open, - .release = proc_close, - .llseek = default_llseek, -}; - -static const struct file_operations proc_wepkey_ops = { - .owner = THIS_MODULE, - .read = proc_read, - .write = proc_write, - .open = proc_wepkey_open, - .release = proc_close, - .llseek = default_llseek, -}; - -static struct proc_dir_entry *airo_entry; - -struct proc_data { - int release_buffer; - int readlen; - char *rbuffer; - int writelen; - int maxwritelen; - char *wbuffer; - void (*on_close) (struct inode *, struct file *); -}; - -static int setup_proc_entry( struct net_device *dev, - struct airo_info *apriv ) { - struct proc_dir_entry *entry; - - /* First setup the device directory */ - strcpy(apriv->proc_name,dev->name); - apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm, - airo_entry); - if (!apriv->proc_entry) - return -ENOMEM; - proc_set_user(apriv->proc_entry, proc_kuid, proc_kgid); - - /* Setup the StatsDelta */ - entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm, - apriv->proc_entry, &proc_statsdelta_ops, dev); - if (!entry) - goto fail; - proc_set_user(entry, proc_kuid, proc_kgid); - - /* Setup the Stats */ - entry = proc_create_data("Stats", S_IRUGO & proc_perm, - apriv->proc_entry, &proc_stats_ops, dev); - if (!entry) - goto fail; - proc_set_user(entry, proc_kuid, proc_kgid); - - /* Setup the Status */ - entry = proc_create_data("Status", S_IRUGO & proc_perm, - apriv->proc_entry, &proc_status_ops, dev); - if (!entry) - goto fail; - proc_set_user(entry, proc_kuid, proc_kgid); - - /* Setup the Config */ - entry = proc_create_data("Config", proc_perm, - apriv->proc_entry, &proc_config_ops, dev); - if (!entry) - goto fail; - proc_set_user(entry, proc_kuid, proc_kgid); - - /* Setup the SSID */ - entry = proc_create_data("SSID", proc_perm, - apriv->proc_entry, &proc_SSID_ops, dev); - if (!entry) - goto fail; - proc_set_user(entry, proc_kuid, proc_kgid); - - /* Setup the APList */ - entry = proc_create_data("APList", proc_perm, - apriv->proc_entry, &proc_APList_ops, dev); - if (!entry) - goto fail; - proc_set_user(entry, proc_kuid, proc_kgid); - - /* Setup the BSSList */ - entry = proc_create_data("BSSList", proc_perm, - apriv->proc_entry, &proc_BSSList_ops, dev); - if (!entry) - goto fail; - proc_set_user(entry, proc_kuid, proc_kgid); - - /* Setup the WepKey */ - entry = proc_create_data("WepKey", proc_perm, - apriv->proc_entry, &proc_wepkey_ops, dev); - if (!entry) - goto fail; - proc_set_user(entry, proc_kuid, proc_kgid); - return 0; - -fail: - remove_proc_subtree(apriv->proc_name, airo_entry); - return -ENOMEM; -} - -static int takedown_proc_entry( struct net_device *dev, - struct airo_info *apriv ) -{ - remove_proc_subtree(apriv->proc_name, airo_entry); - return 0; -} - -/* - * What we want from the proc_fs is to be able to efficiently read - * and write the configuration. To do this, we want to read the - * configuration when the file is opened and write it when the file is - * closed. So basically we allocate a read buffer at open and fill it - * with data, and allocate a write buffer and read it at close. - */ - -/* - * The read routine is generic, it relies on the preallocated rbuffer - * to supply the data. - */ -static ssize_t proc_read( struct file *file, - char __user *buffer, - size_t len, - loff_t *offset ) -{ - struct proc_data *priv = file->private_data; - - if (!priv->rbuffer) - return -EINVAL; - - return simple_read_from_buffer(buffer, len, offset, priv->rbuffer, - priv->readlen); -} - -/* - * The write routine is generic, it fills in a preallocated rbuffer - * to supply the data. - */ -static ssize_t proc_write( struct file *file, - const char __user *buffer, - size_t len, - loff_t *offset ) -{ - ssize_t ret; - struct proc_data *priv = file->private_data; - - if (!priv->wbuffer) - return -EINVAL; - - ret = simple_write_to_buffer(priv->wbuffer, priv->maxwritelen, offset, - buffer, len); - if (ret > 0) - priv->writelen = max_t(int, priv->writelen, *offset); - - return ret; -} - -static int proc_status_open(struct inode *inode, struct file *file) -{ - struct proc_data *data; - struct net_device *dev = PDE_DATA(inode); - struct airo_info *apriv = dev->ml_priv; - CapabilityRid cap_rid; - StatusRid status_rid; - u16 mode; - int i; - - if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) - return -ENOMEM; - data = file->private_data; - if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { - kfree (file->private_data); - return -ENOMEM; - } - - readStatusRid(apriv, &status_rid, 1); - readCapabilityRid(apriv, &cap_rid, 1); - - mode = le16_to_cpu(status_rid.mode); - - i = sprintf(data->rbuffer, "Status: %s%s%s%s%s%s%s%s%s\n", - mode & 1 ? "CFG ": "", - mode & 2 ? "ACT ": "", - mode & 0x10 ? "SYN ": "", - mode & 0x20 ? "LNK ": "", - mode & 0x40 ? "LEAP ": "", - mode & 0x80 ? "PRIV ": "", - mode & 0x100 ? "KEY ": "", - mode & 0x200 ? "WEP ": "", - mode & 0x8000 ? "ERR ": ""); - sprintf( data->rbuffer+i, "Mode: %x\n" - "Signal Strength: %d\n" - "Signal Quality: %d\n" - "SSID: %-.*s\n" - "AP: %-.16s\n" - "Freq: %d\n" - "BitRate: %dmbs\n" - "Driver Version: %s\n" - "Device: %s\nManufacturer: %s\nFirmware Version: %s\n" - "Radio type: %x\nCountry: %x\nHardware Version: %x\n" - "Software Version: %x\nSoftware Subversion: %x\n" - "Boot block version: %x\n", - le16_to_cpu(status_rid.mode), - le16_to_cpu(status_rid.normalizedSignalStrength), - le16_to_cpu(status_rid.signalQuality), - le16_to_cpu(status_rid.SSIDlen), - status_rid.SSID, - status_rid.apName, - le16_to_cpu(status_rid.channel), - le16_to_cpu(status_rid.currentXmitRate) / 2, - version, - cap_rid.prodName, - cap_rid.manName, - cap_rid.prodVer, - le16_to_cpu(cap_rid.radioType), - le16_to_cpu(cap_rid.country), - le16_to_cpu(cap_rid.hardVer), - le16_to_cpu(cap_rid.softVer), - le16_to_cpu(cap_rid.softSubVer), - le16_to_cpu(cap_rid.bootBlockVer)); - data->readlen = strlen( data->rbuffer ); - return 0; -} - -static int proc_stats_rid_open(struct inode*, struct file*, u16); -static int proc_statsdelta_open( struct inode *inode, - struct file *file ) { - if (file->f_mode&FMODE_WRITE) { - return proc_stats_rid_open(inode, file, RID_STATSDELTACLEAR); - } - return proc_stats_rid_open(inode, file, RID_STATSDELTA); -} - -static int proc_stats_open( struct inode *inode, struct file *file ) { - return proc_stats_rid_open(inode, file, RID_STATS); -} - -static int proc_stats_rid_open( struct inode *inode, - struct file *file, - u16 rid ) -{ - struct proc_data *data; - struct net_device *dev = PDE_DATA(inode); - struct airo_info *apriv = dev->ml_priv; - StatsRid stats; - int i, j; - __le32 *vals = stats.vals; - int len; - - if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) - return -ENOMEM; - data = file->private_data; - if ((data->rbuffer = kmalloc( 4096, GFP_KERNEL )) == NULL) { - kfree (file->private_data); - return -ENOMEM; - } - - readStatsRid(apriv, &stats, rid, 1); - len = le16_to_cpu(stats.len); - - j = 0; - for(i=0; statsLabels[i]!=(char *)-1 && i*44096) { - airo_print_warn(apriv->dev->name, - "Potentially disastrous buffer overflow averted!"); - break; - } - j+=sprintf(data->rbuffer+j, "%s: %u\n", statsLabels[i], - le32_to_cpu(vals[i])); - } - if (i*4 >= len) { - airo_print_warn(apriv->dev->name, "Got a short rid"); - } - data->readlen = j; - return 0; -} - -static int get_dec_u16( char *buffer, int *start, int limit ) { - u16 value; - int valid = 0; - for (value = 0; *start < limit && buffer[*start] >= '0' && - buffer[*start] <= '9'; (*start)++) { - valid = 1; - value *= 10; - value += buffer[*start] - '0'; - } - if ( !valid ) return -1; - return value; -} - -static int airo_config_commit(struct net_device *dev, - struct iw_request_info *info, void *zwrq, - char *extra); - -static inline int sniffing_mode(struct airo_info *ai) -{ - return (le16_to_cpu(ai->config.rmode) & le16_to_cpu(RXMODE_MASK)) >= - le16_to_cpu(RXMODE_RFMON); -} - -static void proc_config_on_close(struct inode *inode, struct file *file) -{ - struct proc_data *data = file->private_data; - struct net_device *dev = PDE_DATA(inode); - struct airo_info *ai = dev->ml_priv; - char *line; - - if ( !data->writelen ) return; - - readConfigRid(ai, 1); - set_bit (FLAG_COMMIT, &ai->flags); - - line = data->wbuffer; - while( line[0] ) { -/*** Mode processing */ - if ( !strncmp( line, "Mode: ", 6 ) ) { - line += 6; - if (sniffing_mode(ai)) - set_bit (FLAG_RESET, &ai->flags); - ai->config.rmode &= ~RXMODE_FULL_MASK; - clear_bit (FLAG_802_11, &ai->flags); - ai->config.opmode &= ~MODE_CFG_MASK; - ai->config.scanMode = SCANMODE_ACTIVE; - if ( line[0] == 'a' ) { - ai->config.opmode |= MODE_STA_IBSS; - } else { - ai->config.opmode |= MODE_STA_ESS; - if ( line[0] == 'r' ) { - ai->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER; - ai->config.scanMode = SCANMODE_PASSIVE; - set_bit (FLAG_802_11, &ai->flags); - } else if ( line[0] == 'y' ) { - ai->config.rmode |= RXMODE_RFMON_ANYBSS | RXMODE_DISABLE_802_3_HEADER; - ai->config.scanMode = SCANMODE_PASSIVE; - set_bit (FLAG_802_11, &ai->flags); - } else if ( line[0] == 'l' ) - ai->config.rmode |= RXMODE_LANMON; - } - set_bit (FLAG_COMMIT, &ai->flags); - } - -/*** Radio status */ - else if (!strncmp(line,"Radio: ", 7)) { - line += 7; - if (!strncmp(line,"off",3)) { - set_bit (FLAG_RADIO_OFF, &ai->flags); - } else { - clear_bit (FLAG_RADIO_OFF, &ai->flags); - } - } -/*** NodeName processing */ - else if ( !strncmp( line, "NodeName: ", 10 ) ) { - int j; - - line += 10; - memset( ai->config.nodeName, 0, 16 ); -/* Do the name, assume a space between the mode and node name */ - for( j = 0; j < 16 && line[j] != '\n'; j++ ) { - ai->config.nodeName[j] = line[j]; - } - set_bit (FLAG_COMMIT, &ai->flags); - } - -/*** PowerMode processing */ - else if ( !strncmp( line, "PowerMode: ", 11 ) ) { - line += 11; - if ( !strncmp( line, "PSPCAM", 6 ) ) { - ai->config.powerSaveMode = POWERSAVE_PSPCAM; - set_bit (FLAG_COMMIT, &ai->flags); - } else if ( !strncmp( line, "PSP", 3 ) ) { - ai->config.powerSaveMode = POWERSAVE_PSP; - set_bit (FLAG_COMMIT, &ai->flags); - } else { - ai->config.powerSaveMode = POWERSAVE_CAM; - set_bit (FLAG_COMMIT, &ai->flags); - } - } else if ( !strncmp( line, "DataRates: ", 11 ) ) { - int v, i = 0, k = 0; /* i is index into line, - k is index to rates */ - - line += 11; - while((v = get_dec_u16(line, &i, 3))!=-1) { - ai->config.rates[k++] = (u8)v; - line += i + 1; - i = 0; - } - set_bit (FLAG_COMMIT, &ai->flags); - } else if ( !strncmp( line, "Channel: ", 9 ) ) { - int v, i = 0; - line += 9; - v = get_dec_u16(line, &i, i+3); - if ( v != -1 ) { - ai->config.channelSet = cpu_to_le16(v); - set_bit (FLAG_COMMIT, &ai->flags); - } - } else if ( !strncmp( line, "XmitPower: ", 11 ) ) { - int v, i = 0; - line += 11; - v = get_dec_u16(line, &i, i+3); - if ( v != -1 ) { - ai->config.txPower = cpu_to_le16(v); - set_bit (FLAG_COMMIT, &ai->flags); - } - } else if ( !strncmp( line, "WEP: ", 5 ) ) { - line += 5; - switch( line[0] ) { - case 's': - ai->config.authType = AUTH_SHAREDKEY; - break; - case 'e': - ai->config.authType = AUTH_ENCRYPT; - break; - default: - ai->config.authType = AUTH_OPEN; - break; - } - set_bit (FLAG_COMMIT, &ai->flags); - } else if ( !strncmp( line, "LongRetryLimit: ", 16 ) ) { - int v, i = 0; - - line += 16; - v = get_dec_u16(line, &i, 3); - v = (v<0) ? 0 : ((v>255) ? 255 : v); - ai->config.longRetryLimit = cpu_to_le16(v); - set_bit (FLAG_COMMIT, &ai->flags); - } else if ( !strncmp( line, "ShortRetryLimit: ", 17 ) ) { - int v, i = 0; - - line += 17; - v = get_dec_u16(line, &i, 3); - v = (v<0) ? 0 : ((v>255) ? 255 : v); - ai->config.shortRetryLimit = cpu_to_le16(v); - set_bit (FLAG_COMMIT, &ai->flags); - } else if ( !strncmp( line, "RTSThreshold: ", 14 ) ) { - int v, i = 0; - - line += 14; - v = get_dec_u16(line, &i, 4); - v = (v<0) ? 0 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v); - ai->config.rtsThres = cpu_to_le16(v); - set_bit (FLAG_COMMIT, &ai->flags); - } else if ( !strncmp( line, "TXMSDULifetime: ", 16 ) ) { - int v, i = 0; - - line += 16; - v = get_dec_u16(line, &i, 5); - v = (v<0) ? 0 : v; - ai->config.txLifetime = cpu_to_le16(v); - set_bit (FLAG_COMMIT, &ai->flags); - } else if ( !strncmp( line, "RXMSDULifetime: ", 16 ) ) { - int v, i = 0; - - line += 16; - v = get_dec_u16(line, &i, 5); - v = (v<0) ? 0 : v; - ai->config.rxLifetime = cpu_to_le16(v); - set_bit (FLAG_COMMIT, &ai->flags); - } else if ( !strncmp( line, "TXDiversity: ", 13 ) ) { - ai->config.txDiversity = - (line[13]=='l') ? 1 : - ((line[13]=='r')? 2: 3); - set_bit (FLAG_COMMIT, &ai->flags); - } else if ( !strncmp( line, "RXDiversity: ", 13 ) ) { - ai->config.rxDiversity = - (line[13]=='l') ? 1 : - ((line[13]=='r')? 2: 3); - set_bit (FLAG_COMMIT, &ai->flags); - } else if ( !strncmp( line, "FragThreshold: ", 15 ) ) { - int v, i = 0; - - line += 15; - v = get_dec_u16(line, &i, 4); - v = (v<256) ? 256 : ((v>AIRO_DEF_MTU) ? AIRO_DEF_MTU : v); - v = v & 0xfffe; /* Make sure its even */ - ai->config.fragThresh = cpu_to_le16(v); - set_bit (FLAG_COMMIT, &ai->flags); - } else if (!strncmp(line, "Modulation: ", 12)) { - line += 12; - switch(*line) { - case 'd': ai->config.modulation=MOD_DEFAULT; set_bit(FLAG_COMMIT, &ai->flags); break; - case 'c': ai->config.modulation=MOD_CCK; set_bit(FLAG_COMMIT, &ai->flags); break; - case 'm': ai->config.modulation=MOD_MOK; set_bit(FLAG_COMMIT, &ai->flags); break; - default: airo_print_warn(ai->dev->name, "Unknown modulation"); - } - } else if (!strncmp(line, "Preamble: ", 10)) { - line += 10; - switch(*line) { - case 'a': ai->config.preamble=PREAMBLE_AUTO; set_bit(FLAG_COMMIT, &ai->flags); break; - case 'l': ai->config.preamble=PREAMBLE_LONG; set_bit(FLAG_COMMIT, &ai->flags); break; - case 's': ai->config.preamble=PREAMBLE_SHORT; set_bit(FLAG_COMMIT, &ai->flags); break; - default: airo_print_warn(ai->dev->name, "Unknown preamble"); - } - } else { - airo_print_warn(ai->dev->name, "Couldn't figure out %s", line); - } - while( line[0] && line[0] != '\n' ) line++; - if ( line[0] ) line++; - } - airo_config_commit(dev, NULL, NULL, NULL); -} - -static const char *get_rmode(__le16 mode) -{ - switch(mode & RXMODE_MASK) { - case RXMODE_RFMON: return "rfmon"; - case RXMODE_RFMON_ANYBSS: return "yna (any) bss rfmon"; - case RXMODE_LANMON: return "lanmon"; - } - return "ESS"; -} - -static int proc_config_open(struct inode *inode, struct file *file) -{ - struct proc_data *data; - struct net_device *dev = PDE_DATA(inode); - struct airo_info *ai = dev->ml_priv; - int i; - __le16 mode; - - if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) - return -ENOMEM; - data = file->private_data; - if ((data->rbuffer = kmalloc( 2048, GFP_KERNEL )) == NULL) { - kfree (file->private_data); - return -ENOMEM; - } - if ((data->wbuffer = kzalloc( 2048, GFP_KERNEL )) == NULL) { - kfree (data->rbuffer); - kfree (file->private_data); - return -ENOMEM; - } - data->maxwritelen = 2048; - data->on_close = proc_config_on_close; - - readConfigRid(ai, 1); - - mode = ai->config.opmode & MODE_CFG_MASK; - i = sprintf( data->rbuffer, - "Mode: %s\n" - "Radio: %s\n" - "NodeName: %-16s\n" - "PowerMode: %s\n" - "DataRates: %d %d %d %d %d %d %d %d\n" - "Channel: %d\n" - "XmitPower: %d\n", - mode == MODE_STA_IBSS ? "adhoc" : - mode == MODE_STA_ESS ? get_rmode(ai->config.rmode): - mode == MODE_AP ? "AP" : - mode == MODE_AP_RPTR ? "AP RPTR" : "Error", - test_bit(FLAG_RADIO_OFF, &ai->flags) ? "off" : "on", - ai->config.nodeName, - ai->config.powerSaveMode == POWERSAVE_CAM ? "CAM" : - ai->config.powerSaveMode == POWERSAVE_PSP ? "PSP" : - ai->config.powerSaveMode == POWERSAVE_PSPCAM ? "PSPCAM" : - "Error", - (int)ai->config.rates[0], - (int)ai->config.rates[1], - (int)ai->config.rates[2], - (int)ai->config.rates[3], - (int)ai->config.rates[4], - (int)ai->config.rates[5], - (int)ai->config.rates[6], - (int)ai->config.rates[7], - le16_to_cpu(ai->config.channelSet), - le16_to_cpu(ai->config.txPower) - ); - sprintf( data->rbuffer + i, - "LongRetryLimit: %d\n" - "ShortRetryLimit: %d\n" - "RTSThreshold: %d\n" - "TXMSDULifetime: %d\n" - "RXMSDULifetime: %d\n" - "TXDiversity: %s\n" - "RXDiversity: %s\n" - "FragThreshold: %d\n" - "WEP: %s\n" - "Modulation: %s\n" - "Preamble: %s\n", - le16_to_cpu(ai->config.longRetryLimit), - le16_to_cpu(ai->config.shortRetryLimit), - le16_to_cpu(ai->config.rtsThres), - le16_to_cpu(ai->config.txLifetime), - le16_to_cpu(ai->config.rxLifetime), - ai->config.txDiversity == 1 ? "left" : - ai->config.txDiversity == 2 ? "right" : "both", - ai->config.rxDiversity == 1 ? "left" : - ai->config.rxDiversity == 2 ? "right" : "both", - le16_to_cpu(ai->config.fragThresh), - ai->config.authType == AUTH_ENCRYPT ? "encrypt" : - ai->config.authType == AUTH_SHAREDKEY ? "shared" : "open", - ai->config.modulation == MOD_DEFAULT ? "default" : - ai->config.modulation == MOD_CCK ? "cck" : - ai->config.modulation == MOD_MOK ? "mok" : "error", - ai->config.preamble == PREAMBLE_AUTO ? "auto" : - ai->config.preamble == PREAMBLE_LONG ? "long" : - ai->config.preamble == PREAMBLE_SHORT ? "short" : "error" - ); - data->readlen = strlen( data->rbuffer ); - return 0; -} - -static void proc_SSID_on_close(struct inode *inode, struct file *file) -{ - struct proc_data *data = file->private_data; - struct net_device *dev = PDE_DATA(inode); - struct airo_info *ai = dev->ml_priv; - SsidRid SSID_rid; - int i; - char *p = data->wbuffer; - char *end = p + data->writelen; - - if (!data->writelen) - return; - - *end = '\n'; /* sentinel; we have space for it */ - - memset(&SSID_rid, 0, sizeof(SSID_rid)); - - for (i = 0; i < 3 && p < end; i++) { - int j = 0; - /* copy up to 32 characters from this line */ - while (*p != '\n' && j < 32) - SSID_rid.ssids[i].ssid[j++] = *p++; - if (j == 0) - break; - SSID_rid.ssids[i].len = cpu_to_le16(j); - /* skip to the beginning of the next line */ - while (*p++ != '\n') - ; - } - if (i) - SSID_rid.len = cpu_to_le16(sizeof(SSID_rid)); - disable_MAC(ai, 1); - writeSsidRid(ai, &SSID_rid, 1); - enable_MAC(ai, 1); -} - -static void proc_APList_on_close( struct inode *inode, struct file *file ) { - struct proc_data *data = file->private_data; - struct net_device *dev = PDE_DATA(inode); - struct airo_info *ai = dev->ml_priv; - APListRid APList_rid; - int i; - - if ( !data->writelen ) return; - - memset( &APList_rid, 0, sizeof(APList_rid) ); - APList_rid.len = cpu_to_le16(sizeof(APList_rid)); - - for( i = 0; i < 4 && data->writelen >= (i+1)*6*3; i++ ) { - int j; - for( j = 0; j < 6*3 && data->wbuffer[j+i*6*3]; j++ ) { - switch(j%3) { - case 0: - APList_rid.ap[i][j/3]= - hex_to_bin(data->wbuffer[j+i*6*3])<<4; - break; - case 1: - APList_rid.ap[i][j/3]|= - hex_to_bin(data->wbuffer[j+i*6*3]); - break; - } - } - } - disable_MAC(ai, 1); - writeAPListRid(ai, &APList_rid, 1); - enable_MAC(ai, 1); -} - -/* This function wraps PC4500_writerid with a MAC disable */ -static int do_writerid( struct airo_info *ai, u16 rid, const void *rid_data, - int len, int dummy ) { - int rc; - - disable_MAC(ai, 1); - rc = PC4500_writerid(ai, rid, rid_data, len, 1); - enable_MAC(ai, 1); - return rc; -} - -/* Returns the WEP key at the specified index, or -1 if that key does - * not exist. The buffer is assumed to be at least 16 bytes in length. - */ -static int get_wep_key(struct airo_info *ai, u16 index, char *buf, u16 buflen) -{ - WepKeyRid wkr; - int rc; - __le16 lastindex; - - rc = readWepKeyRid(ai, &wkr, 1, 1); - if (rc != SUCCESS) - return -1; - do { - lastindex = wkr.kindex; - if (le16_to_cpu(wkr.kindex) == index) { - int klen = min_t(int, buflen, le16_to_cpu(wkr.klen)); - memcpy(buf, wkr.key, klen); - return klen; - } - rc = readWepKeyRid(ai, &wkr, 0, 1); - if (rc != SUCCESS) - return -1; - } while (lastindex != wkr.kindex); - return -1; -} - -static int get_wep_tx_idx(struct airo_info *ai) -{ - WepKeyRid wkr; - int rc; - __le16 lastindex; - - rc = readWepKeyRid(ai, &wkr, 1, 1); - if (rc != SUCCESS) - return -1; - do { - lastindex = wkr.kindex; - if (wkr.kindex == cpu_to_le16(0xffff)) - return wkr.mac[0]; - rc = readWepKeyRid(ai, &wkr, 0, 1); - if (rc != SUCCESS) - return -1; - } while (lastindex != wkr.kindex); - return -1; -} - -static int set_wep_key(struct airo_info *ai, u16 index, const char *key, - u16 keylen, int perm, int lock) -{ - static const unsigned char macaddr[ETH_ALEN] = { 0x01, 0, 0, 0, 0, 0 }; - WepKeyRid wkr; - int rc; - - if (WARN_ON(keylen == 0)) - return -1; - - memset(&wkr, 0, sizeof(wkr)); - wkr.len = cpu_to_le16(sizeof(wkr)); - wkr.kindex = cpu_to_le16(index); - wkr.klen = cpu_to_le16(keylen); - memcpy(wkr.key, key, keylen); - memcpy(wkr.mac, macaddr, ETH_ALEN); - - if (perm) disable_MAC(ai, lock); - rc = writeWepKeyRid(ai, &wkr, perm, lock); - if (perm) enable_MAC(ai, lock); - return rc; -} - -static int set_wep_tx_idx(struct airo_info *ai, u16 index, int perm, int lock) -{ - WepKeyRid wkr; - int rc; - - memset(&wkr, 0, sizeof(wkr)); - wkr.len = cpu_to_le16(sizeof(wkr)); - wkr.kindex = cpu_to_le16(0xffff); - wkr.mac[0] = (char)index; - - if (perm) { - ai->defindex = (char)index; - disable_MAC(ai, lock); - } - - rc = writeWepKeyRid(ai, &wkr, perm, lock); - - if (perm) - enable_MAC(ai, lock); - return rc; -} - -static void proc_wepkey_on_close( struct inode *inode, struct file *file ) { - struct proc_data *data; - struct net_device *dev = PDE_DATA(inode); - struct airo_info *ai = dev->ml_priv; - int i, rc; - char key[16]; - u16 index = 0; - int j = 0; - - memset(key, 0, sizeof(key)); - - data = file->private_data; - if ( !data->writelen ) return; - - if (data->wbuffer[0] >= '0' && data->wbuffer[0] <= '3' && - (data->wbuffer[1] == ' ' || data->wbuffer[1] == '\n')) { - index = data->wbuffer[0] - '0'; - if (data->wbuffer[1] == '\n') { - rc = set_wep_tx_idx(ai, index, 1, 1); - if (rc < 0) { - airo_print_err(ai->dev->name, "failed to set " - "WEP transmit index to %d: %d.", - index, rc); - } - return; - } - j = 2; - } else { - airo_print_err(ai->dev->name, "WepKey passed invalid key index"); - return; - } - - for( i = 0; i < 16*3 && data->wbuffer[i+j]; i++ ) { - switch(i%3) { - case 0: - key[i/3] = hex_to_bin(data->wbuffer[i+j])<<4; - break; - case 1: - key[i/3] |= hex_to_bin(data->wbuffer[i+j]); - break; - } - } - - rc = set_wep_key(ai, index, key, i/3, 1, 1); - if (rc < 0) { - airo_print_err(ai->dev->name, "failed to set WEP key at index " - "%d: %d.", index, rc); - } -} - -static int proc_wepkey_open( struct inode *inode, struct file *file ) -{ - struct proc_data *data; - struct net_device *dev = PDE_DATA(inode); - struct airo_info *ai = dev->ml_priv; - char *ptr; - WepKeyRid wkr; - __le16 lastindex; - int j=0; - int rc; - - if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) - return -ENOMEM; - memset(&wkr, 0, sizeof(wkr)); - data = file->private_data; - if ((data->rbuffer = kzalloc( 180, GFP_KERNEL )) == NULL) { - kfree (file->private_data); - return -ENOMEM; - } - data->writelen = 0; - data->maxwritelen = 80; - if ((data->wbuffer = kzalloc( 80, GFP_KERNEL )) == NULL) { - kfree (data->rbuffer); - kfree (file->private_data); - return -ENOMEM; - } - data->on_close = proc_wepkey_on_close; - - ptr = data->rbuffer; - strcpy(ptr, "No wep keys\n"); - rc = readWepKeyRid(ai, &wkr, 1, 1); - if (rc == SUCCESS) do { - lastindex = wkr.kindex; - if (wkr.kindex == cpu_to_le16(0xffff)) { - j += sprintf(ptr+j, "Tx key = %d\n", - (int)wkr.mac[0]); - } else { - j += sprintf(ptr+j, "Key %d set with length = %d\n", - le16_to_cpu(wkr.kindex), - le16_to_cpu(wkr.klen)); - } - readWepKeyRid(ai, &wkr, 0, 1); - } while((lastindex != wkr.kindex) && (j < 180-30)); - - data->readlen = strlen( data->rbuffer ); - return 0; -} - -static int proc_SSID_open(struct inode *inode, struct file *file) -{ - struct proc_data *data; - struct net_device *dev = PDE_DATA(inode); - struct airo_info *ai = dev->ml_priv; - int i; - char *ptr; - SsidRid SSID_rid; - - if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) - return -ENOMEM; - data = file->private_data; - if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { - kfree (file->private_data); - return -ENOMEM; - } - data->writelen = 0; - data->maxwritelen = 33*3; - /* allocate maxwritelen + 1; we'll want a sentinel */ - if ((data->wbuffer = kzalloc(33*3 + 1, GFP_KERNEL)) == NULL) { - kfree (data->rbuffer); - kfree (file->private_data); - return -ENOMEM; - } - data->on_close = proc_SSID_on_close; - - readSsidRid(ai, &SSID_rid); - ptr = data->rbuffer; - for (i = 0; i < 3; i++) { - int j; - size_t len = le16_to_cpu(SSID_rid.ssids[i].len); - if (!len) - break; - if (len > 32) - len = 32; - for (j = 0; j < len && SSID_rid.ssids[i].ssid[j]; j++) - *ptr++ = SSID_rid.ssids[i].ssid[j]; - *ptr++ = '\n'; - } - *ptr = '\0'; - data->readlen = strlen( data->rbuffer ); - return 0; -} - -static int proc_APList_open( struct inode *inode, struct file *file ) { - struct proc_data *data; - struct net_device *dev = PDE_DATA(inode); - struct airo_info *ai = dev->ml_priv; - int i; - char *ptr; - APListRid APList_rid; - - if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) - return -ENOMEM; - data = file->private_data; - if ((data->rbuffer = kmalloc( 104, GFP_KERNEL )) == NULL) { - kfree (file->private_data); - return -ENOMEM; - } - data->writelen = 0; - data->maxwritelen = 4*6*3; - if ((data->wbuffer = kzalloc( data->maxwritelen, GFP_KERNEL )) == NULL) { - kfree (data->rbuffer); - kfree (file->private_data); - return -ENOMEM; - } - data->on_close = proc_APList_on_close; - - readAPListRid(ai, &APList_rid); - ptr = data->rbuffer; - for( i = 0; i < 4; i++ ) { -// We end when we find a zero MAC - if ( !*(int*)APList_rid.ap[i] && - !*(int*)&APList_rid.ap[i][2]) break; - ptr += sprintf(ptr, "%pM\n", APList_rid.ap[i]); - } - if (i==0) ptr += sprintf(ptr, "Not using specific APs\n"); - - *ptr = '\0'; - data->readlen = strlen( data->rbuffer ); - return 0; -} - -static int proc_BSSList_open( struct inode *inode, struct file *file ) { - struct proc_data *data; - struct net_device *dev = PDE_DATA(inode); - struct airo_info *ai = dev->ml_priv; - char *ptr; - BSSListRid BSSList_rid; - int rc; - /* If doLoseSync is not 1, we won't do a Lose Sync */ - int doLoseSync = -1; - - if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL) - return -ENOMEM; - data = file->private_data; - if ((data->rbuffer = kmalloc( 1024, GFP_KERNEL )) == NULL) { - kfree (file->private_data); - return -ENOMEM; - } - data->writelen = 0; - data->maxwritelen = 0; - data->wbuffer = NULL; - data->on_close = NULL; - - if (file->f_mode & FMODE_WRITE) { - if (!(file->f_mode & FMODE_READ)) { - Cmd cmd; - Resp rsp; - - if (ai->flags & FLAG_RADIO_MASK) return -ENETDOWN; - memset(&cmd, 0, sizeof(cmd)); - cmd.cmd=CMD_LISTBSS; - if (down_interruptible(&ai->sem)) - return -ERESTARTSYS; - issuecommand(ai, &cmd, &rsp); - up(&ai->sem); - data->readlen = 0; - return 0; - } - doLoseSync = 1; - } - ptr = data->rbuffer; - /* There is a race condition here if there are concurrent opens. - Since it is a rare condition, we'll just live with it, otherwise - we have to add a spin lock... */ - rc = readBSSListRid(ai, doLoseSync, &BSSList_rid); - while(rc == 0 && BSSList_rid.index != cpu_to_le16(0xffff)) { - ptr += sprintf(ptr, "%pM %*s rssi = %d", - BSSList_rid.bssid, - (int)BSSList_rid.ssidLen, - BSSList_rid.ssid, - le16_to_cpu(BSSList_rid.dBm)); - ptr += sprintf(ptr, " channel = %d %s %s %s %s\n", - le16_to_cpu(BSSList_rid.dsChannel), - BSSList_rid.cap & CAP_ESS ? "ESS" : "", - BSSList_rid.cap & CAP_IBSS ? "adhoc" : "", - BSSList_rid.cap & CAP_PRIVACY ? "wep" : "", - BSSList_rid.cap & CAP_SHORTHDR ? "shorthdr" : ""); - rc = readBSSListRid(ai, 0, &BSSList_rid); - } - *ptr = '\0'; - data->readlen = strlen( data->rbuffer ); - return 0; -} - -static int proc_close( struct inode *inode, struct file *file ) -{ - struct proc_data *data = file->private_data; - - if (data->on_close != NULL) - data->on_close(inode, file); - kfree(data->rbuffer); - kfree(data->wbuffer); - kfree(data); - return 0; -} - -/* Since the card doesn't automatically switch to the right WEP mode, - we will make it do it. If the card isn't associated, every secs we - will switch WEP modes to see if that will help. If the card is - associated we will check every minute to see if anything has - changed. */ -static void timer_func( struct net_device *dev ) { - struct airo_info *apriv = dev->ml_priv; - -/* We don't have a link so try changing the authtype */ - readConfigRid(apriv, 0); - disable_MAC(apriv, 0); - switch(apriv->config.authType) { - case AUTH_ENCRYPT: -/* So drop to OPEN */ - apriv->config.authType = AUTH_OPEN; - break; - case AUTH_SHAREDKEY: - if (apriv->keyindex < auto_wep) { - set_wep_tx_idx(apriv, apriv->keyindex, 0, 0); - apriv->config.authType = AUTH_SHAREDKEY; - apriv->keyindex++; - } else { - /* Drop to ENCRYPT */ - apriv->keyindex = 0; - set_wep_tx_idx(apriv, apriv->defindex, 0, 0); - apriv->config.authType = AUTH_ENCRYPT; - } - break; - default: /* We'll escalate to SHAREDKEY */ - apriv->config.authType = AUTH_SHAREDKEY; - } - set_bit (FLAG_COMMIT, &apriv->flags); - writeConfigRid(apriv, 0); - enable_MAC(apriv, 0); - up(&apriv->sem); - -/* Schedule check to see if the change worked */ - clear_bit(JOB_AUTOWEP, &apriv->jobs); - apriv->expires = RUN_AT(HZ*3); -} - -#ifdef CONFIG_PCI -static int airo_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *pent) -{ - struct net_device *dev; - - if (pci_enable_device(pdev)) - return -ENODEV; - pci_set_master(pdev); - - if (pdev->device == 0x5000 || pdev->device == 0xa504) - dev = _init_airo_card(pdev->irq, pdev->resource[0].start, 0, pdev, &pdev->dev); - else - dev = _init_airo_card(pdev->irq, pdev->resource[2].start, 0, pdev, &pdev->dev); - if (!dev) { - pci_disable_device(pdev); - return -ENODEV; - } - - pci_set_drvdata(pdev, dev); - return 0; -} - -static void airo_pci_remove(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - - airo_print_info(dev->name, "Unregistering..."); - stop_airo_card(dev, 1); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); -} - -static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct airo_info *ai = dev->ml_priv; - Cmd cmd; - Resp rsp; - - if (!ai->APList) - ai->APList = kmalloc(sizeof(APListRid), GFP_KERNEL); - if (!ai->APList) - return -ENOMEM; - if (!ai->SSID) - ai->SSID = kmalloc(sizeof(SsidRid), GFP_KERNEL); - if (!ai->SSID) - return -ENOMEM; - readAPListRid(ai, ai->APList); - readSsidRid(ai, ai->SSID); - memset(&cmd, 0, sizeof(cmd)); - /* the lock will be released at the end of the resume callback */ - if (down_interruptible(&ai->sem)) - return -EAGAIN; - disable_MAC(ai, 0); - netif_device_detach(dev); - ai->power = state; - cmd.cmd = HOSTSLEEP; - issuecommand(ai, &cmd, &rsp); - - pci_enable_wake(pdev, pci_choose_state(pdev, state), 1); - pci_save_state(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); - return 0; -} - -static int airo_pci_resume(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - struct airo_info *ai = dev->ml_priv; - pci_power_t prev_state = pdev->current_state; - - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); - pci_enable_wake(pdev, PCI_D0, 0); - - if (prev_state != PCI_D1) { - reset_card(dev, 0); - mpi_init_descriptors(ai); - setup_card(ai, dev->dev_addr, 0); - clear_bit(FLAG_RADIO_OFF, &ai->flags); - clear_bit(FLAG_PENDING_XMIT, &ai->flags); - } else { - OUT4500(ai, EVACK, EV_AWAKEN); - OUT4500(ai, EVACK, EV_AWAKEN); - msleep(100); - } - - set_bit(FLAG_COMMIT, &ai->flags); - disable_MAC(ai, 0); - msleep(200); - if (ai->SSID) { - writeSsidRid(ai, ai->SSID, 0); - kfree(ai->SSID); - ai->SSID = NULL; - } - if (ai->APList) { - writeAPListRid(ai, ai->APList, 0); - kfree(ai->APList); - ai->APList = NULL; - } - writeConfigRid(ai, 0); - enable_MAC(ai, 0); - ai->power = PMSG_ON; - netif_device_attach(dev); - netif_wake_queue(dev); - enable_interrupts(ai); - up(&ai->sem); - return 0; -} -#endif - -static int __init airo_init_module( void ) -{ - int i; - - proc_kuid = make_kuid(&init_user_ns, proc_uid); - proc_kgid = make_kgid(&init_user_ns, proc_gid); - if (!uid_valid(proc_kuid) || !gid_valid(proc_kgid)) - return -EINVAL; - - airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL); - - if (airo_entry) - proc_set_user(airo_entry, proc_kuid, proc_kgid); - - for (i = 0; i < 4 && io[i] && irq[i]; i++) { - airo_print_info("", "Trying to configure ISA adapter at irq=%d " - "io=0x%x", irq[i], io[i] ); - if (init_airo_card( irq[i], io[i], 0, NULL )) - /* do nothing */ ; - } - -#ifdef CONFIG_PCI - airo_print_info("", "Probing for PCI adapters"); - i = pci_register_driver(&airo_driver); - airo_print_info("", "Finished probing for PCI adapters"); - - if (i) { - remove_proc_entry("driver/aironet", NULL); - return i; - } -#endif - - /* Always exit with success, as we are a library module - * as well as a driver module - */ - return 0; -} - -static void __exit airo_cleanup_module( void ) -{ - struct airo_info *ai; - while(!list_empty(&airo_devices)) { - ai = list_entry(airo_devices.next, struct airo_info, dev_list); - airo_print_info(ai->dev->name, "Unregistering..."); - stop_airo_card(ai->dev, 1); - } -#ifdef CONFIG_PCI - pci_unregister_driver(&airo_driver); -#endif - remove_proc_entry("driver/aironet", NULL); -} - -/* - * Initial Wireless Extension code for Aironet driver by : - * Jean Tourrilhes - HPL - 17 November 00 - * Conversion to new driver API by : - * Jean Tourrilhes - HPL - 26 March 02 - * Javier also did a good amount of work here, adding some new extensions - * and fixing my code. Let's just say that without him this code just - * would not work at all... - Jean II - */ - -static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi) -{ - if (!rssi_rid) - return 0; - - return (0x100 - rssi_rid[rssi].rssidBm); -} - -static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm) -{ - int i; - - if (!rssi_rid) - return 0; - - for (i = 0; i < 256; i++) - if (rssi_rid[i].rssidBm == dbm) - return rssi_rid[i].rssipct; - - return 0; -} - - -static int airo_get_quality (StatusRid *status_rid, CapabilityRid *cap_rid) -{ - int quality = 0; - u16 sq; - - if ((status_rid->mode & cpu_to_le16(0x3f)) != cpu_to_le16(0x3f)) - return 0; - - if (!(cap_rid->hardCap & cpu_to_le16(8))) - return 0; - - sq = le16_to_cpu(status_rid->signalQuality); - if (memcmp(cap_rid->prodName, "350", 3)) - if (sq > 0x20) - quality = 0; - else - quality = 0x20 - sq; - else - if (sq > 0xb0) - quality = 0; - else if (sq < 0x10) - quality = 0xa0; - else - quality = 0xb0 - sq; - return quality; -} - -#define airo_get_max_quality(cap_rid) (memcmp((cap_rid)->prodName, "350", 3) ? 0x20 : 0xa0) -#define airo_get_avg_quality(cap_rid) (memcmp((cap_rid)->prodName, "350", 3) ? 0x10 : 0x50); - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get protocol name - */ -static int airo_get_name(struct net_device *dev, - struct iw_request_info *info, - char *cwrq, - char *extra) -{ - strcpy(cwrq, "IEEE 802.11-DS"); - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set frequency - */ -static int airo_set_freq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *fwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - int rc = -EINPROGRESS; /* Call commit handler */ - - /* If setting by frequency, convert to a channel */ - if(fwrq->e == 1) { - int f = fwrq->m / 100000; - - /* Hack to fall through... */ - fwrq->e = 0; - fwrq->m = ieee80211_freq_to_dsss_chan(f); - } - /* Setting by channel number */ - if((fwrq->m > 1000) || (fwrq->e > 0)) - rc = -EOPNOTSUPP; - else { - int channel = fwrq->m; - /* We should do a better check than that, - * based on the card capability !!! */ - if((channel < 1) || (channel > 14)) { - airo_print_dbg(dev->name, "New channel value of %d is invalid!", - fwrq->m); - rc = -EINVAL; - } else { - readConfigRid(local, 1); - /* Yes ! We can set it !!! */ - local->config.channelSet = cpu_to_le16(channel); - set_bit (FLAG_COMMIT, &local->flags); - } - } - return rc; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get frequency - */ -static int airo_get_freq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *fwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - StatusRid status_rid; /* Card status info */ - int ch; - - readConfigRid(local, 1); - if ((local->config.opmode & MODE_CFG_MASK) == MODE_STA_ESS) - status_rid.channel = local->config.channelSet; - else - readStatusRid(local, &status_rid, 1); - - ch = le16_to_cpu(status_rid.channel); - if((ch > 0) && (ch < 15)) { - fwrq->m = ieee80211_dsss_chan_to_freq(ch) * 100000; - fwrq->e = 1; - } else { - fwrq->m = ch; - fwrq->e = 0; - } - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set ESSID - */ -static int airo_set_essid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - SsidRid SSID_rid; /* SSIDs */ - - /* Reload the list of current SSID */ - readSsidRid(local, &SSID_rid); - - /* Check if we asked for `any' */ - if (dwrq->flags == 0) { - /* Just send an empty SSID list */ - memset(&SSID_rid, 0, sizeof(SSID_rid)); - } else { - unsigned index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - - /* Check the size of the string */ - if (dwrq->length > IW_ESSID_MAX_SIZE) - return -E2BIG ; - - /* Check if index is valid */ - if (index >= ARRAY_SIZE(SSID_rid.ssids)) - return -EINVAL; - - /* Set the SSID */ - memset(SSID_rid.ssids[index].ssid, 0, - sizeof(SSID_rid.ssids[index].ssid)); - memcpy(SSID_rid.ssids[index].ssid, extra, dwrq->length); - SSID_rid.ssids[index].len = cpu_to_le16(dwrq->length); - } - SSID_rid.len = cpu_to_le16(sizeof(SSID_rid)); - /* Write it to the card */ - disable_MAC(local, 1); - writeSsidRid(local, &SSID_rid, 1); - enable_MAC(local, 1); - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get ESSID - */ -static int airo_get_essid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - StatusRid status_rid; /* Card status info */ - - readStatusRid(local, &status_rid, 1); - - /* Note : if dwrq->flags != 0, we should - * get the relevant SSID from the SSID list... */ - - /* Get the current SSID */ - memcpy(extra, status_rid.SSID, le16_to_cpu(status_rid.SSIDlen)); - /* If none, we may want to get the one that was set */ - - /* Push it out ! */ - dwrq->length = le16_to_cpu(status_rid.SSIDlen); - dwrq->flags = 1; /* active */ - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set AP address - */ -static int airo_set_wap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *awrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - Cmd cmd; - Resp rsp; - APListRid APList_rid; - - if (awrq->sa_family != ARPHRD_ETHER) - return -EINVAL; - else if (is_broadcast_ether_addr(awrq->sa_data) || - is_zero_ether_addr(awrq->sa_data)) { - memset(&cmd, 0, sizeof(cmd)); - cmd.cmd=CMD_LOSE_SYNC; - if (down_interruptible(&local->sem)) - return -ERESTARTSYS; - issuecommand(local, &cmd, &rsp); - up(&local->sem); - } else { - memset(&APList_rid, 0, sizeof(APList_rid)); - APList_rid.len = cpu_to_le16(sizeof(APList_rid)); - memcpy(APList_rid.ap[0], awrq->sa_data, ETH_ALEN); - disable_MAC(local, 1); - writeAPListRid(local, &APList_rid, 1); - enable_MAC(local, 1); - } - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get AP address - */ -static int airo_get_wap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *awrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - StatusRid status_rid; /* Card status info */ - - readStatusRid(local, &status_rid, 1); - - /* Tentative. This seems to work, wow, I'm lucky !!! */ - memcpy(awrq->sa_data, status_rid.bssid[0], ETH_ALEN); - awrq->sa_family = ARPHRD_ETHER; - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set Nickname - */ -static int airo_set_nick(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - - /* Check the size of the string */ - if(dwrq->length > 16) { - return -E2BIG; - } - readConfigRid(local, 1); - memset(local->config.nodeName, 0, sizeof(local->config.nodeName)); - memcpy(local->config.nodeName, extra, dwrq->length); - set_bit (FLAG_COMMIT, &local->flags); - - return -EINPROGRESS; /* Call commit handler */ -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get Nickname - */ -static int airo_get_nick(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - - readConfigRid(local, 1); - strncpy(extra, local->config.nodeName, 16); - extra[16] = '\0'; - dwrq->length = strlen(extra); - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set Bit-Rate - */ -static int airo_set_rate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - CapabilityRid cap_rid; /* Card capability info */ - u8 brate = 0; - int i; - - /* First : get a valid bit rate value */ - readCapabilityRid(local, &cap_rid, 1); - - /* Which type of value ? */ - if((vwrq->value < 8) && (vwrq->value >= 0)) { - /* Setting by rate index */ - /* Find value in the magic rate table */ - brate = cap_rid.supportedRates[vwrq->value]; - } else { - /* Setting by frequency value */ - u8 normvalue = (u8) (vwrq->value/500000); - - /* Check if rate is valid */ - for(i = 0 ; i < 8 ; i++) { - if(normvalue == cap_rid.supportedRates[i]) { - brate = normvalue; - break; - } - } - } - /* -1 designed the max rate (mostly auto mode) */ - if(vwrq->value == -1) { - /* Get the highest available rate */ - for(i = 0 ; i < 8 ; i++) { - if(cap_rid.supportedRates[i] == 0) - break; - } - if(i != 0) - brate = cap_rid.supportedRates[i - 1]; - } - /* Check that it is valid */ - if(brate == 0) { - return -EINVAL; - } - - readConfigRid(local, 1); - /* Now, check if we want a fixed or auto value */ - if(vwrq->fixed == 0) { - /* Fill all the rates up to this max rate */ - memset(local->config.rates, 0, 8); - for(i = 0 ; i < 8 ; i++) { - local->config.rates[i] = cap_rid.supportedRates[i]; - if(local->config.rates[i] == brate) - break; - } - } else { - /* Fixed mode */ - /* One rate, fixed */ - memset(local->config.rates, 0, 8); - local->config.rates[0] = brate; - } - set_bit (FLAG_COMMIT, &local->flags); - - return -EINPROGRESS; /* Call commit handler */ -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get Bit-Rate - */ -static int airo_get_rate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - StatusRid status_rid; /* Card status info */ - - readStatusRid(local, &status_rid, 1); - - vwrq->value = le16_to_cpu(status_rid.currentXmitRate) * 500000; - /* If more than one rate, set auto */ - readConfigRid(local, 1); - vwrq->fixed = (local->config.rates[1] == 0); - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set RTS threshold - */ -static int airo_set_rts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - int rthr = vwrq->value; - - if(vwrq->disabled) - rthr = AIRO_DEF_MTU; - if((rthr < 0) || (rthr > AIRO_DEF_MTU)) { - return -EINVAL; - } - readConfigRid(local, 1); - local->config.rtsThres = cpu_to_le16(rthr); - set_bit (FLAG_COMMIT, &local->flags); - - return -EINPROGRESS; /* Call commit handler */ -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get RTS threshold - */ -static int airo_get_rts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - - readConfigRid(local, 1); - vwrq->value = le16_to_cpu(local->config.rtsThres); - vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU); - vwrq->fixed = 1; - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set Fragmentation threshold - */ -static int airo_set_frag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - int fthr = vwrq->value; - - if(vwrq->disabled) - fthr = AIRO_DEF_MTU; - if((fthr < 256) || (fthr > AIRO_DEF_MTU)) { - return -EINVAL; - } - fthr &= ~0x1; /* Get an even value - is it really needed ??? */ - readConfigRid(local, 1); - local->config.fragThresh = cpu_to_le16(fthr); - set_bit (FLAG_COMMIT, &local->flags); - - return -EINPROGRESS; /* Call commit handler */ -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get Fragmentation threshold - */ -static int airo_get_frag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - - readConfigRid(local, 1); - vwrq->value = le16_to_cpu(local->config.fragThresh); - vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU); - vwrq->fixed = 1; - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set Mode of Operation - */ -static int airo_set_mode(struct net_device *dev, - struct iw_request_info *info, - __u32 *uwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - int reset = 0; - - readConfigRid(local, 1); - if (sniffing_mode(local)) - reset = 1; - - switch(*uwrq) { - case IW_MODE_ADHOC: - local->config.opmode &= ~MODE_CFG_MASK; - local->config.opmode |= MODE_STA_IBSS; - local->config.rmode &= ~RXMODE_FULL_MASK; - local->config.scanMode = SCANMODE_ACTIVE; - clear_bit (FLAG_802_11, &local->flags); - break; - case IW_MODE_INFRA: - local->config.opmode &= ~MODE_CFG_MASK; - local->config.opmode |= MODE_STA_ESS; - local->config.rmode &= ~RXMODE_FULL_MASK; - local->config.scanMode = SCANMODE_ACTIVE; - clear_bit (FLAG_802_11, &local->flags); - break; - case IW_MODE_MASTER: - local->config.opmode &= ~MODE_CFG_MASK; - local->config.opmode |= MODE_AP; - local->config.rmode &= ~RXMODE_FULL_MASK; - local->config.scanMode = SCANMODE_ACTIVE; - clear_bit (FLAG_802_11, &local->flags); - break; - case IW_MODE_REPEAT: - local->config.opmode &= ~MODE_CFG_MASK; - local->config.opmode |= MODE_AP_RPTR; - local->config.rmode &= ~RXMODE_FULL_MASK; - local->config.scanMode = SCANMODE_ACTIVE; - clear_bit (FLAG_802_11, &local->flags); - break; - case IW_MODE_MONITOR: - local->config.opmode &= ~MODE_CFG_MASK; - local->config.opmode |= MODE_STA_ESS; - local->config.rmode &= ~RXMODE_FULL_MASK; - local->config.rmode |= RXMODE_RFMON | RXMODE_DISABLE_802_3_HEADER; - local->config.scanMode = SCANMODE_PASSIVE; - set_bit (FLAG_802_11, &local->flags); - break; - default: - return -EINVAL; - } - if (reset) - set_bit (FLAG_RESET, &local->flags); - set_bit (FLAG_COMMIT, &local->flags); - - return -EINPROGRESS; /* Call commit handler */ -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get Mode of Operation - */ -static int airo_get_mode(struct net_device *dev, - struct iw_request_info *info, - __u32 *uwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - - readConfigRid(local, 1); - /* If not managed, assume it's ad-hoc */ - switch (local->config.opmode & MODE_CFG_MASK) { - case MODE_STA_ESS: - *uwrq = IW_MODE_INFRA; - break; - case MODE_AP: - *uwrq = IW_MODE_MASTER; - break; - case MODE_AP_RPTR: - *uwrq = IW_MODE_REPEAT; - break; - default: - *uwrq = IW_MODE_ADHOC; - } - - return 0; -} - -static inline int valid_index(struct airo_info *ai, int index) -{ - return (index >= 0) && (index <= ai->max_wep_idx); -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set Encryption Key - */ -static int airo_set_encode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - int perm = (dwrq->flags & IW_ENCODE_TEMP ? 0 : 1); - __le16 currentAuthType = local->config.authType; - int rc = 0; - - if (!local->wep_capable) - return -EOPNOTSUPP; - - readConfigRid(local, 1); - - /* Basic checking: do we have a key to set ? - * Note : with the new API, it's impossible to get a NULL pointer. - * Therefore, we need to check a key size == 0 instead. - * New version of iwconfig properly set the IW_ENCODE_NOKEY flag - * when no key is present (only change flags), but older versions - * don't do it. - Jean II */ - if (dwrq->length > 0) { - wep_key_t key; - int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - int current_index; - - /* Check the size of the key */ - if (dwrq->length > MAX_KEY_SIZE) { - return -EINVAL; - } - - current_index = get_wep_tx_idx(local); - if (current_index < 0) - current_index = 0; - - /* Check the index (none -> use current) */ - if (!valid_index(local, index)) - index = current_index; - - /* Set the length */ - if (dwrq->length > MIN_KEY_SIZE) - key.len = MAX_KEY_SIZE; - else - key.len = MIN_KEY_SIZE; - /* Check if the key is not marked as invalid */ - if(!(dwrq->flags & IW_ENCODE_NOKEY)) { - /* Cleanup */ - memset(key.key, 0, MAX_KEY_SIZE); - /* Copy the key in the driver */ - memcpy(key.key, extra, dwrq->length); - /* Send the key to the card */ - rc = set_wep_key(local, index, key.key, key.len, perm, 1); - if (rc < 0) { - airo_print_err(local->dev->name, "failed to set" - " WEP key at index %d: %d.", - index, rc); - return rc; - } - } - /* WE specify that if a valid key is set, encryption - * should be enabled (user may turn it off later) - * This is also how "iwconfig ethX key on" works */ - if((index == current_index) && (key.len > 0) && - (local->config.authType == AUTH_OPEN)) { - local->config.authType = AUTH_ENCRYPT; - } - } else { - /* Do we want to just set the transmit key index ? */ - int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - if (valid_index(local, index)) { - rc = set_wep_tx_idx(local, index, perm, 1); - if (rc < 0) { - airo_print_err(local->dev->name, "failed to set" - " WEP transmit index to %d: %d.", - index, rc); - return rc; - } - } else { - /* Don't complain if only change the mode */ - if (!(dwrq->flags & IW_ENCODE_MODE)) - return -EINVAL; - } - } - /* Read the flags */ - if(dwrq->flags & IW_ENCODE_DISABLED) - local->config.authType = AUTH_OPEN; // disable encryption - if(dwrq->flags & IW_ENCODE_RESTRICTED) - local->config.authType = AUTH_SHAREDKEY; // Only Both - if(dwrq->flags & IW_ENCODE_OPEN) - local->config.authType = AUTH_ENCRYPT; // Only Wep - /* Commit the changes to flags if needed */ - if (local->config.authType != currentAuthType) - set_bit (FLAG_COMMIT, &local->flags); - return -EINPROGRESS; /* Call commit handler */ -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get Encryption Key - */ -static int airo_get_encode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - int wep_key_len; - u8 buf[16]; - - if (!local->wep_capable) - return -EOPNOTSUPP; - - readConfigRid(local, 1); - - /* Check encryption mode */ - switch(local->config.authType) { - case AUTH_ENCRYPT: - dwrq->flags = IW_ENCODE_OPEN; - break; - case AUTH_SHAREDKEY: - dwrq->flags = IW_ENCODE_RESTRICTED; - break; - default: - case AUTH_OPEN: - dwrq->flags = IW_ENCODE_DISABLED; - break; - } - /* We can't return the key, so set the proper flag and return zero */ - dwrq->flags |= IW_ENCODE_NOKEY; - memset(extra, 0, 16); - - /* Which key do we want ? -1 -> tx index */ - if (!valid_index(local, index)) { - index = get_wep_tx_idx(local); - if (index < 0) - index = 0; - } - dwrq->flags |= index + 1; - - /* Copy the key to the user buffer */ - wep_key_len = get_wep_key(local, index, &buf[0], sizeof(buf)); - if (wep_key_len < 0) { - dwrq->length = 0; - } else { - dwrq->length = wep_key_len; - memcpy(extra, buf, dwrq->length); - } - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set extended Encryption parameters - */ -static int airo_set_encodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - struct iw_point *encoding = &wrqu->encoding; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int perm = ( encoding->flags & IW_ENCODE_TEMP ? 0 : 1 ); - __le16 currentAuthType = local->config.authType; - int idx, key_len, alg = ext->alg, set_key = 1, rc; - wep_key_t key; - - if (!local->wep_capable) - return -EOPNOTSUPP; - - readConfigRid(local, 1); - - /* Determine and validate the key index */ - idx = encoding->flags & IW_ENCODE_INDEX; - if (idx) { - if (!valid_index(local, idx - 1)) - return -EINVAL; - idx--; - } else { - idx = get_wep_tx_idx(local); - if (idx < 0) - idx = 0; - } - - if (encoding->flags & IW_ENCODE_DISABLED) - alg = IW_ENCODE_ALG_NONE; - - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - /* Only set transmit key index here, actual - * key is set below if needed. - */ - rc = set_wep_tx_idx(local, idx, perm, 1); - if (rc < 0) { - airo_print_err(local->dev->name, "failed to set " - "WEP transmit index to %d: %d.", - idx, rc); - return rc; - } - set_key = ext->key_len > 0 ? 1 : 0; - } - - if (set_key) { - /* Set the requested key first */ - memset(key.key, 0, MAX_KEY_SIZE); - switch (alg) { - case IW_ENCODE_ALG_NONE: - key.len = 0; - break; - case IW_ENCODE_ALG_WEP: - if (ext->key_len > MIN_KEY_SIZE) { - key.len = MAX_KEY_SIZE; - } else if (ext->key_len > 0) { - key.len = MIN_KEY_SIZE; - } else { - return -EINVAL; - } - key_len = min (ext->key_len, key.len); - memcpy(key.key, ext->key, key_len); - break; - default: - return -EINVAL; - } - if (key.len == 0) { - rc = set_wep_tx_idx(local, idx, perm, 1); - if (rc < 0) { - airo_print_err(local->dev->name, - "failed to set WEP transmit index to %d: %d.", - idx, rc); - return rc; - } - } else { - rc = set_wep_key(local, idx, key.key, key.len, perm, 1); - if (rc < 0) { - airo_print_err(local->dev->name, - "failed to set WEP key at index %d: %d.", - idx, rc); - return rc; - } - } - } - - /* Read the flags */ - if(encoding->flags & IW_ENCODE_DISABLED) - local->config.authType = AUTH_OPEN; // disable encryption - if(encoding->flags & IW_ENCODE_RESTRICTED) - local->config.authType = AUTH_SHAREDKEY; // Only Both - if(encoding->flags & IW_ENCODE_OPEN) - local->config.authType = AUTH_ENCRYPT; // Only Wep - /* Commit the changes to flags if needed */ - if (local->config.authType != currentAuthType) - set_bit (FLAG_COMMIT, &local->flags); - - return -EINPROGRESS; -} - - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get extended Encryption parameters - */ -static int airo_get_encodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - struct iw_point *encoding = &wrqu->encoding; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int idx, max_key_len, wep_key_len; - u8 buf[16]; - - if (!local->wep_capable) - return -EOPNOTSUPP; - - readConfigRid(local, 1); - - max_key_len = encoding->length - sizeof(*ext); - if (max_key_len < 0) - return -EINVAL; - - idx = encoding->flags & IW_ENCODE_INDEX; - if (idx) { - if (!valid_index(local, idx - 1)) - return -EINVAL; - idx--; - } else { - idx = get_wep_tx_idx(local); - if (idx < 0) - idx = 0; - } - - encoding->flags = idx + 1; - memset(ext, 0, sizeof(*ext)); - - /* Check encryption mode */ - switch(local->config.authType) { - case AUTH_ENCRYPT: - encoding->flags = IW_ENCODE_ALG_WEP | IW_ENCODE_ENABLED; - break; - case AUTH_SHAREDKEY: - encoding->flags = IW_ENCODE_ALG_WEP | IW_ENCODE_ENABLED; - break; - default: - case AUTH_OPEN: - encoding->flags = IW_ENCODE_ALG_NONE | IW_ENCODE_DISABLED; - break; - } - /* We can't return the key, so set the proper flag and return zero */ - encoding->flags |= IW_ENCODE_NOKEY; - memset(extra, 0, 16); - - /* Copy the key to the user buffer */ - wep_key_len = get_wep_key(local, idx, &buf[0], sizeof(buf)); - if (wep_key_len < 0) { - ext->key_len = 0; - } else { - ext->key_len = wep_key_len; - memcpy(extra, buf, ext->key_len); - } - - return 0; -} - - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set extended authentication parameters - */ -static int airo_set_auth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct airo_info *local = dev->ml_priv; - struct iw_param *param = &wrqu->param; - __le16 currentAuthType = local->config.authType; - - switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_KEY_MGMT: - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - case IW_AUTH_PRIVACY_INVOKED: - /* - * airo does not use these parameters - */ - break; - - case IW_AUTH_DROP_UNENCRYPTED: - if (param->value) { - /* Only change auth type if unencrypted */ - if (currentAuthType == AUTH_OPEN) - local->config.authType = AUTH_ENCRYPT; - } else { - local->config.authType = AUTH_OPEN; - } - - /* Commit the changes to flags if needed */ - if (local->config.authType != currentAuthType) - set_bit (FLAG_COMMIT, &local->flags); - break; - - case IW_AUTH_80211_AUTH_ALG: { - /* FIXME: What about AUTH_OPEN? This API seems to - * disallow setting our auth to AUTH_OPEN. - */ - if (param->value & IW_AUTH_ALG_SHARED_KEY) { - local->config.authType = AUTH_SHAREDKEY; - } else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) { - local->config.authType = AUTH_ENCRYPT; - } else - return -EINVAL; - - /* Commit the changes to flags if needed */ - if (local->config.authType != currentAuthType) - set_bit (FLAG_COMMIT, &local->flags); - break; - } - - case IW_AUTH_WPA_ENABLED: - /* Silently accept disable of WPA */ - if (param->value > 0) - return -EOPNOTSUPP; - break; - - default: - return -EOPNOTSUPP; - } - return -EINPROGRESS; -} - - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get extended authentication parameters - */ -static int airo_get_auth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct airo_info *local = dev->ml_priv; - struct iw_param *param = &wrqu->param; - __le16 currentAuthType = local->config.authType; - - switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_DROP_UNENCRYPTED: - switch (currentAuthType) { - case AUTH_SHAREDKEY: - case AUTH_ENCRYPT: - param->value = 1; - break; - default: - param->value = 0; - break; - } - break; - - case IW_AUTH_80211_AUTH_ALG: - switch (currentAuthType) { - case AUTH_SHAREDKEY: - param->value = IW_AUTH_ALG_SHARED_KEY; - break; - case AUTH_ENCRYPT: - default: - param->value = IW_AUTH_ALG_OPEN_SYSTEM; - break; - } - break; - - case IW_AUTH_WPA_ENABLED: - param->value = 0; - break; - - default: - return -EOPNOTSUPP; - } - return 0; -} - - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set Tx-Power - */ -static int airo_set_txpow(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - CapabilityRid cap_rid; /* Card capability info */ - int i; - int rc = -EINVAL; - __le16 v = cpu_to_le16(vwrq->value); - - readCapabilityRid(local, &cap_rid, 1); - - if (vwrq->disabled) { - set_bit (FLAG_RADIO_OFF, &local->flags); - set_bit (FLAG_COMMIT, &local->flags); - return -EINPROGRESS; /* Call commit handler */ - } - if (vwrq->flags != IW_TXPOW_MWATT) { - return -EINVAL; - } - clear_bit (FLAG_RADIO_OFF, &local->flags); - for (i = 0; i < 8 && cap_rid.txPowerLevels[i]; i++) - if (v == cap_rid.txPowerLevels[i]) { - readConfigRid(local, 1); - local->config.txPower = v; - set_bit (FLAG_COMMIT, &local->flags); - rc = -EINPROGRESS; /* Call commit handler */ - break; - } - return rc; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get Tx-Power - */ -static int airo_get_txpow(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - - readConfigRid(local, 1); - vwrq->value = le16_to_cpu(local->config.txPower); - vwrq->fixed = 1; /* No power control */ - vwrq->disabled = test_bit(FLAG_RADIO_OFF, &local->flags); - vwrq->flags = IW_TXPOW_MWATT; - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set Retry limits - */ -static int airo_set_retry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - int rc = -EINVAL; - - if(vwrq->disabled) { - return -EINVAL; - } - readConfigRid(local, 1); - if(vwrq->flags & IW_RETRY_LIMIT) { - __le16 v = cpu_to_le16(vwrq->value); - if(vwrq->flags & IW_RETRY_LONG) - local->config.longRetryLimit = v; - else if (vwrq->flags & IW_RETRY_SHORT) - local->config.shortRetryLimit = v; - else { - /* No modifier : set both */ - local->config.longRetryLimit = v; - local->config.shortRetryLimit = v; - } - set_bit (FLAG_COMMIT, &local->flags); - rc = -EINPROGRESS; /* Call commit handler */ - } - if(vwrq->flags & IW_RETRY_LIFETIME) { - local->config.txLifetime = cpu_to_le16(vwrq->value / 1024); - set_bit (FLAG_COMMIT, &local->flags); - rc = -EINPROGRESS; /* Call commit handler */ - } - return rc; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get Retry limits - */ -static int airo_get_retry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - - vwrq->disabled = 0; /* Can't be disabled */ - - readConfigRid(local, 1); - /* Note : by default, display the min retry number */ - if((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { - vwrq->flags = IW_RETRY_LIFETIME; - vwrq->value = le16_to_cpu(local->config.txLifetime) * 1024; - } else if((vwrq->flags & IW_RETRY_LONG)) { - vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; - vwrq->value = le16_to_cpu(local->config.longRetryLimit); - } else { - vwrq->flags = IW_RETRY_LIMIT; - vwrq->value = le16_to_cpu(local->config.shortRetryLimit); - if(local->config.shortRetryLimit != local->config.longRetryLimit) - vwrq->flags |= IW_RETRY_SHORT; - } - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get range info - */ -static int airo_get_range(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - struct iw_range *range = (struct iw_range *) extra; - CapabilityRid cap_rid; /* Card capability info */ - int i; - int k; - - readCapabilityRid(local, &cap_rid, 1); - - dwrq->length = sizeof(struct iw_range); - memset(range, 0, sizeof(*range)); - range->min_nwid = 0x0000; - range->max_nwid = 0x0000; - range->num_channels = 14; - /* Should be based on cap_rid.country to give only - * what the current card support */ - k = 0; - for(i = 0; i < 14; i++) { - range->freq[k].i = i + 1; /* List index */ - range->freq[k].m = ieee80211_dsss_chan_to_freq(i + 1) * 100000; - range->freq[k++].e = 1; /* Values in MHz -> * 10^5 * 10 */ - } - range->num_frequency = k; - - range->sensitivity = 65535; - - /* Hum... Should put the right values there */ - if (local->rssi) - range->max_qual.qual = 100; /* % */ - else - range->max_qual.qual = airo_get_max_quality(&cap_rid); - range->max_qual.level = 0x100 - 120; /* -120 dBm */ - range->max_qual.noise = 0x100 - 120; /* -120 dBm */ - - /* Experimental measurements - boundary 11/5.5 Mb/s */ - /* Note : with or without the (local->rssi), results - * are somewhat different. - Jean II */ - if (local->rssi) { - range->avg_qual.qual = 50; /* % */ - range->avg_qual.level = 0x100 - 70; /* -70 dBm */ - } else { - range->avg_qual.qual = airo_get_avg_quality(&cap_rid); - range->avg_qual.level = 0x100 - 80; /* -80 dBm */ - } - range->avg_qual.noise = 0x100 - 85; /* -85 dBm */ - - for(i = 0 ; i < 8 ; i++) { - range->bitrate[i] = cap_rid.supportedRates[i] * 500000; - if(range->bitrate[i] == 0) - break; - } - range->num_bitrates = i; - - /* Set an indication of the max TCP throughput - * in bit/s that we can expect using this interface. - * May be use for QoS stuff... Jean II */ - if(i > 2) - range->throughput = 5000 * 1000; - else - range->throughput = 1500 * 1000; - - range->min_rts = 0; - range->max_rts = AIRO_DEF_MTU; - range->min_frag = 256; - range->max_frag = AIRO_DEF_MTU; - - if(cap_rid.softCap & cpu_to_le16(2)) { - // WEP: RC4 40 bits - range->encoding_size[0] = 5; - // RC4 ~128 bits - if (cap_rid.softCap & cpu_to_le16(0x100)) { - range->encoding_size[1] = 13; - range->num_encoding_sizes = 2; - } else - range->num_encoding_sizes = 1; - range->max_encoding_tokens = - cap_rid.softCap & cpu_to_le16(0x80) ? 4 : 1; - } else { - range->num_encoding_sizes = 0; - range->max_encoding_tokens = 0; - } - range->min_pmp = 0; - range->max_pmp = 5000000; /* 5 secs */ - range->min_pmt = 0; - range->max_pmt = 65535 * 1024; /* ??? */ - range->pmp_flags = IW_POWER_PERIOD; - range->pmt_flags = IW_POWER_TIMEOUT; - range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R; - - /* Transmit Power - values are in mW */ - for(i = 0 ; i < 8 ; i++) { - range->txpower[i] = le16_to_cpu(cap_rid.txPowerLevels[i]); - if(range->txpower[i] == 0) - break; - } - range->num_txpower = i; - range->txpower_capa = IW_TXPOW_MWATT; - range->we_version_source = 19; - range->we_version_compiled = WIRELESS_EXT; - range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME; - range->retry_flags = IW_RETRY_LIMIT; - range->r_time_flags = IW_RETRY_LIFETIME; - range->min_retry = 1; - range->max_retry = 65535; - range->min_r_time = 1024; - range->max_r_time = 65535 * 1024; - - /* Event capability (kernel + driver) */ - range->event_capa[0] = (IW_EVENT_CAPA_K_0 | - IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) | - IW_EVENT_CAPA_MASK(SIOCGIWAP) | - IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); - range->event_capa[1] = IW_EVENT_CAPA_K_1; - range->event_capa[4] = IW_EVENT_CAPA_MASK(IWEVTXDROP); - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set Power Management - */ -static int airo_set_power(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - - readConfigRid(local, 1); - if (vwrq->disabled) { - if (sniffing_mode(local)) - return -EINVAL; - local->config.powerSaveMode = POWERSAVE_CAM; - local->config.rmode &= ~RXMODE_MASK; - local->config.rmode |= RXMODE_BC_MC_ADDR; - set_bit (FLAG_COMMIT, &local->flags); - return -EINPROGRESS; /* Call commit handler */ - } - if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { - local->config.fastListenDelay = cpu_to_le16((vwrq->value + 500) / 1024); - local->config.powerSaveMode = POWERSAVE_PSPCAM; - set_bit (FLAG_COMMIT, &local->flags); - } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { - local->config.fastListenInterval = - local->config.listenInterval = - cpu_to_le16((vwrq->value + 500) / 1024); - local->config.powerSaveMode = POWERSAVE_PSPCAM; - set_bit (FLAG_COMMIT, &local->flags); - } - switch (vwrq->flags & IW_POWER_MODE) { - case IW_POWER_UNICAST_R: - if (sniffing_mode(local)) - return -EINVAL; - local->config.rmode &= ~RXMODE_MASK; - local->config.rmode |= RXMODE_ADDR; - set_bit (FLAG_COMMIT, &local->flags); - break; - case IW_POWER_ALL_R: - if (sniffing_mode(local)) - return -EINVAL; - local->config.rmode &= ~RXMODE_MASK; - local->config.rmode |= RXMODE_BC_MC_ADDR; - set_bit (FLAG_COMMIT, &local->flags); - case IW_POWER_ON: - /* This is broken, fixme ;-) */ - break; - default: - return -EINVAL; - } - // Note : we may want to factor local->need_commit here - // Note2 : may also want to factor RXMODE_RFMON test - return -EINPROGRESS; /* Call commit handler */ -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get Power Management - */ -static int airo_get_power(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - __le16 mode; - - readConfigRid(local, 1); - mode = local->config.powerSaveMode; - if ((vwrq->disabled = (mode == POWERSAVE_CAM))) - return 0; - if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { - vwrq->value = le16_to_cpu(local->config.fastListenDelay) * 1024; - vwrq->flags = IW_POWER_TIMEOUT; - } else { - vwrq->value = le16_to_cpu(local->config.fastListenInterval) * 1024; - vwrq->flags = IW_POWER_PERIOD; - } - if ((local->config.rmode & RXMODE_MASK) == RXMODE_ADDR) - vwrq->flags |= IW_POWER_UNICAST_R; - else - vwrq->flags |= IW_POWER_ALL_R; - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set Sensitivity - */ -static int airo_set_sens(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - - readConfigRid(local, 1); - local->config.rssiThreshold = - cpu_to_le16(vwrq->disabled ? RSSI_DEFAULT : vwrq->value); - set_bit (FLAG_COMMIT, &local->flags); - - return -EINPROGRESS; /* Call commit handler */ -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get Sensitivity - */ -static int airo_get_sens(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - - readConfigRid(local, 1); - vwrq->value = le16_to_cpu(local->config.rssiThreshold); - vwrq->disabled = (vwrq->value == 0); - vwrq->fixed = 1; - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get AP List - * Note : this is deprecated in favor of IWSCAN - */ -static int airo_get_aplist(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct airo_info *local = dev->ml_priv; - struct sockaddr *address = (struct sockaddr *) extra; - struct iw_quality *qual; - BSSListRid BSSList; - int i; - int loseSync = capable(CAP_NET_ADMIN) ? 1: -1; - - qual = kmalloc(IW_MAX_AP * sizeof(*qual), GFP_KERNEL); - if (!qual) - return -ENOMEM; - - for (i = 0; i < IW_MAX_AP; i++) { - u16 dBm; - if (readBSSListRid(local, loseSync, &BSSList)) - break; - loseSync = 0; - memcpy(address[i].sa_data, BSSList.bssid, ETH_ALEN); - address[i].sa_family = ARPHRD_ETHER; - dBm = le16_to_cpu(BSSList.dBm); - if (local->rssi) { - qual[i].level = 0x100 - dBm; - qual[i].qual = airo_dbm_to_pct(local->rssi, dBm); - qual[i].updated = IW_QUAL_QUAL_UPDATED - | IW_QUAL_LEVEL_UPDATED - | IW_QUAL_DBM; - } else { - qual[i].level = (dBm + 321) / 2; - qual[i].qual = 0; - qual[i].updated = IW_QUAL_QUAL_INVALID - | IW_QUAL_LEVEL_UPDATED - | IW_QUAL_DBM; - } - qual[i].noise = local->wstats.qual.noise; - if (BSSList.index == cpu_to_le16(0xffff)) - break; - } - if (!i) { - StatusRid status_rid; /* Card status info */ - readStatusRid(local, &status_rid, 1); - for (i = 0; - i < min(IW_MAX_AP, 4) && - (status_rid.bssid[i][0] - & status_rid.bssid[i][1] - & status_rid.bssid[i][2] - & status_rid.bssid[i][3] - & status_rid.bssid[i][4] - & status_rid.bssid[i][5])!=0xff && - (status_rid.bssid[i][0] - | status_rid.bssid[i][1] - | status_rid.bssid[i][2] - | status_rid.bssid[i][3] - | status_rid.bssid[i][4] - | status_rid.bssid[i][5]); - i++) { - memcpy(address[i].sa_data, - status_rid.bssid[i], ETH_ALEN); - address[i].sa_family = ARPHRD_ETHER; - } - } else { - dwrq->flags = 1; /* Should be define'd */ - memcpy(extra + sizeof(struct sockaddr) * i, qual, - sizeof(struct iw_quality) * i); - } - dwrq->length = i; - - kfree(qual); - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : Initiate Scan - */ -static int airo_set_scan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct airo_info *ai = dev->ml_priv; - Cmd cmd; - Resp rsp; - int wake = 0; - - /* Note : you may have realised that, as this is a SET operation, - * this is privileged and therefore a normal user can't - * perform scanning. - * This is not an error, while the device perform scanning, - * traffic doesn't flow, so it's a perfect DoS... - * Jean II */ - if (ai->flags & FLAG_RADIO_MASK) return -ENETDOWN; - - if (down_interruptible(&ai->sem)) - return -ERESTARTSYS; - - /* If there's already a scan in progress, don't - * trigger another one. */ - if (ai->scan_timeout > 0) - goto out; - - /* Initiate a scan command */ - ai->scan_timeout = RUN_AT(3*HZ); - memset(&cmd, 0, sizeof(cmd)); - cmd.cmd=CMD_LISTBSS; - issuecommand(ai, &cmd, &rsp); - wake = 1; - -out: - up(&ai->sem); - if (wake) - wake_up_interruptible(&ai->thr_wait); - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Translate scan data returned from the card to a card independent - * format that the Wireless Tools will understand - Jean II - */ -static inline char *airo_translate_scan(struct net_device *dev, - struct iw_request_info *info, - char *current_ev, - char *end_buf, - BSSListRid *bss) -{ - struct airo_info *ai = dev->ml_priv; - struct iw_event iwe; /* Temporary buffer */ - __le16 capabilities; - char * current_val; /* For rates */ - int i; - char * buf; - u16 dBm; - - /* First entry *MUST* be the AP MAC address */ - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN); - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_ADDR_LEN); - - /* Other entries will be displayed in the order we give them */ - - /* Add the ESSID */ - iwe.u.data.length = bss->ssidLen; - if(iwe.u.data.length > 32) - iwe.u.data.length = 32; - iwe.cmd = SIOCGIWESSID; - iwe.u.data.flags = 1; - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, bss->ssid); - - /* Add mode */ - iwe.cmd = SIOCGIWMODE; - capabilities = bss->cap; - if(capabilities & (CAP_ESS | CAP_IBSS)) { - if(capabilities & CAP_ESS) - iwe.u.mode = IW_MODE_MASTER; - else - iwe.u.mode = IW_MODE_ADHOC; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_UINT_LEN); - } - - /* Add frequency */ - iwe.cmd = SIOCGIWFREQ; - iwe.u.freq.m = le16_to_cpu(bss->dsChannel); - iwe.u.freq.m = ieee80211_dsss_chan_to_freq(iwe.u.freq.m) * 100000; - iwe.u.freq.e = 1; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_FREQ_LEN); - - dBm = le16_to_cpu(bss->dBm); - - /* Add quality statistics */ - iwe.cmd = IWEVQUAL; - if (ai->rssi) { - iwe.u.qual.level = 0x100 - dBm; - iwe.u.qual.qual = airo_dbm_to_pct(ai->rssi, dBm); - iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED - | IW_QUAL_LEVEL_UPDATED - | IW_QUAL_DBM; - } else { - iwe.u.qual.level = (dBm + 321) / 2; - iwe.u.qual.qual = 0; - iwe.u.qual.updated = IW_QUAL_QUAL_INVALID - | IW_QUAL_LEVEL_UPDATED - | IW_QUAL_DBM; - } - iwe.u.qual.noise = ai->wstats.qual.noise; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_QUAL_LEN); - - /* Add encryption capability */ - iwe.cmd = SIOCGIWENCODE; - if(capabilities & CAP_PRIVACY) - iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - else - iwe.u.data.flags = IW_ENCODE_DISABLED; - iwe.u.data.length = 0; - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, bss->ssid); - - /* Rate : stuffing multiple values in a single event require a bit - * more of magic - Jean II */ - current_val = current_ev + iwe_stream_lcp_len(info); - - iwe.cmd = SIOCGIWRATE; - /* Those two flags are ignored... */ - iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; - /* Max 8 values */ - for(i = 0 ; i < 8 ; i++) { - /* NULL terminated */ - if(bss->rates[i] == 0) - break; - /* Bit rate given in 500 kb/s units (+ 0x80) */ - iwe.u.bitrate.value = ((bss->rates[i] & 0x7f) * 500000); - /* Add new value to event */ - current_val = iwe_stream_add_value(info, current_ev, - current_val, end_buf, - &iwe, IW_EV_PARAM_LEN); - } - /* Check if we added any event */ - if ((current_val - current_ev) > iwe_stream_lcp_len(info)) - current_ev = current_val; - - /* Beacon interval */ - buf = kmalloc(30, GFP_KERNEL); - if (buf) { - iwe.cmd = IWEVCUSTOM; - sprintf(buf, "bcn_int=%d", bss->beaconInterval); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, buf); - kfree(buf); - } - - /* Put WPA/RSN Information Elements into the event stream */ - if (test_bit(FLAG_WPA_CAPABLE, &ai->flags)) { - unsigned int num_null_ies = 0; - u16 length = sizeof (bss->extra.iep); - u8 *ie = (void *)&bss->extra.iep; - - while ((length >= 2) && (num_null_ies < 2)) { - if (2 + ie[1] > length) { - /* Invalid element, don't continue parsing IE */ - break; - } - - switch (ie[0]) { - case WLAN_EID_SSID: - /* Two zero-length SSID elements - * mean we're done parsing elements */ - if (!ie[1]) - num_null_ies++; - break; - - case WLAN_EID_VENDOR_SPECIFIC: - if (ie[1] >= 4 && - ie[2] == 0x00 && - ie[3] == 0x50 && - ie[4] == 0xf2 && - ie[5] == 0x01) { - iwe.cmd = IWEVGENIE; - /* 64 is an arbitrary cut-off */ - iwe.u.data.length = min(ie[1] + 2, - 64); - current_ev = iwe_stream_add_point( - info, current_ev, - end_buf, &iwe, ie); - } - break; - - case WLAN_EID_RSN: - iwe.cmd = IWEVGENIE; - /* 64 is an arbitrary cut-off */ - iwe.u.data.length = min(ie[1] + 2, 64); - current_ev = iwe_stream_add_point( - info, current_ev, end_buf, - &iwe, ie); - break; - - default: - break; - } - - length -= 2 + ie[1]; - ie += 2 + ie[1]; - } - } - return current_ev; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : Read Scan Results - */ -static int airo_get_scan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct airo_info *ai = dev->ml_priv; - BSSListElement *net; - int err = 0; - char *current_ev = extra; - - /* If a scan is in-progress, return -EAGAIN */ - if (ai->scan_timeout > 0) - return -EAGAIN; - - if (down_interruptible(&ai->sem)) - return -EAGAIN; - - list_for_each_entry (net, &ai->network_list, list) { - /* Translate to WE format this entry */ - current_ev = airo_translate_scan(dev, info, current_ev, - extra + dwrq->length, - &net->bss); - - /* Check if there is space for one more entry */ - if((extra + dwrq->length - current_ev) <= IW_EV_ADDR_LEN) { - /* Ask user space to try again with a bigger buffer */ - err = -E2BIG; - goto out; - } - } - - /* Length of data */ - dwrq->length = (current_ev - extra); - dwrq->flags = 0; /* todo */ - -out: - up(&ai->sem); - return err; -} - -/*------------------------------------------------------------------*/ -/* - * Commit handler : called after a bunch of SET operations - */ -static int airo_config_commit(struct net_device *dev, - struct iw_request_info *info, /* NULL */ - void *zwrq, /* NULL */ - char *extra) /* NULL */ -{ - struct airo_info *local = dev->ml_priv; - - if (!test_bit (FLAG_COMMIT, &local->flags)) - return 0; - - /* Some of the "SET" function may have modified some of the - * parameters. It's now time to commit them in the card */ - disable_MAC(local, 1); - if (test_bit (FLAG_RESET, &local->flags)) { - APListRid APList_rid; - SsidRid SSID_rid; - - readAPListRid(local, &APList_rid); - readSsidRid(local, &SSID_rid); - if (test_bit(FLAG_MPI,&local->flags)) - setup_card(local, dev->dev_addr, 1 ); - else - reset_airo_card(dev); - disable_MAC(local, 1); - writeSsidRid(local, &SSID_rid, 1); - writeAPListRid(local, &APList_rid, 1); - } - if (down_interruptible(&local->sem)) - return -ERESTARTSYS; - writeConfigRid(local, 0); - enable_MAC(local, 0); - if (test_bit (FLAG_RESET, &local->flags)) - airo_set_promisc(local); - else - up(&local->sem); - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Structures to export the Wireless Handlers - */ - -static const struct iw_priv_args airo_private_args[] = { -/*{ cmd, set_args, get_args, name } */ - { AIROIOCTL, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | sizeof (aironet_ioctl), - IW_PRIV_TYPE_BYTE | 2047, "airoioctl" }, - { AIROIDIFC, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | sizeof (aironet_ioctl), - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "airoidifc" }, -}; - -static const iw_handler airo_handler[] = -{ - (iw_handler) airo_config_commit, /* SIOCSIWCOMMIT */ - (iw_handler) airo_get_name, /* SIOCGIWNAME */ - (iw_handler) NULL, /* SIOCSIWNWID */ - (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) airo_set_freq, /* SIOCSIWFREQ */ - (iw_handler) airo_get_freq, /* SIOCGIWFREQ */ - (iw_handler) airo_set_mode, /* SIOCSIWMODE */ - (iw_handler) airo_get_mode, /* SIOCGIWMODE */ - (iw_handler) airo_set_sens, /* SIOCSIWSENS */ - (iw_handler) airo_get_sens, /* SIOCGIWSENS */ - (iw_handler) NULL, /* SIOCSIWRANGE */ - (iw_handler) airo_get_range, /* SIOCGIWRANGE */ - (iw_handler) NULL, /* SIOCSIWPRIV */ - (iw_handler) NULL, /* SIOCGIWPRIV */ - (iw_handler) NULL, /* SIOCSIWSTATS */ - (iw_handler) NULL, /* SIOCGIWSTATS */ - iw_handler_set_spy, /* SIOCSIWSPY */ - iw_handler_get_spy, /* SIOCGIWSPY */ - iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ - iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ - (iw_handler) airo_set_wap, /* SIOCSIWAP */ - (iw_handler) airo_get_wap, /* SIOCGIWAP */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) airo_get_aplist, /* SIOCGIWAPLIST */ - (iw_handler) airo_set_scan, /* SIOCSIWSCAN */ - (iw_handler) airo_get_scan, /* SIOCGIWSCAN */ - (iw_handler) airo_set_essid, /* SIOCSIWESSID */ - (iw_handler) airo_get_essid, /* SIOCGIWESSID */ - (iw_handler) airo_set_nick, /* SIOCSIWNICKN */ - (iw_handler) airo_get_nick, /* SIOCGIWNICKN */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) airo_set_rate, /* SIOCSIWRATE */ - (iw_handler) airo_get_rate, /* SIOCGIWRATE */ - (iw_handler) airo_set_rts, /* SIOCSIWRTS */ - (iw_handler) airo_get_rts, /* SIOCGIWRTS */ - (iw_handler) airo_set_frag, /* SIOCSIWFRAG */ - (iw_handler) airo_get_frag, /* SIOCGIWFRAG */ - (iw_handler) airo_set_txpow, /* SIOCSIWTXPOW */ - (iw_handler) airo_get_txpow, /* SIOCGIWTXPOW */ - (iw_handler) airo_set_retry, /* SIOCSIWRETRY */ - (iw_handler) airo_get_retry, /* SIOCGIWRETRY */ - (iw_handler) airo_set_encode, /* SIOCSIWENCODE */ - (iw_handler) airo_get_encode, /* SIOCGIWENCODE */ - (iw_handler) airo_set_power, /* SIOCSIWPOWER */ - (iw_handler) airo_get_power, /* SIOCGIWPOWER */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* SIOCSIWGENIE */ - (iw_handler) NULL, /* SIOCGIWGENIE */ - (iw_handler) airo_set_auth, /* SIOCSIWAUTH */ - (iw_handler) airo_get_auth, /* SIOCGIWAUTH */ - (iw_handler) airo_set_encodeext, /* SIOCSIWENCODEEXT */ - (iw_handler) airo_get_encodeext, /* SIOCGIWENCODEEXT */ - (iw_handler) NULL, /* SIOCSIWPMKSA */ -}; - -/* Note : don't describe AIROIDIFC and AIROOLDIDIFC in here. - * We want to force the use of the ioctl code, because those can't be - * won't work the iw_handler code (because they simultaneously read - * and write data and iw_handler can't do that). - * Note that it's perfectly legal to read/write on a single ioctl command, - * you just can't use iwpriv and need to force it via the ioctl handler. - * Jean II */ -static const iw_handler airo_private_handler[] = -{ - NULL, /* SIOCIWFIRSTPRIV */ -}; - -static const struct iw_handler_def airo_handler_def = -{ - .num_standard = ARRAY_SIZE(airo_handler), - .num_private = ARRAY_SIZE(airo_private_handler), - .num_private_args = ARRAY_SIZE(airo_private_args), - .standard = airo_handler, - .private = airo_private_handler, - .private_args = airo_private_args, - .get_wireless_stats = airo_get_wireless_stats, -}; - -/* - * This defines the configuration part of the Wireless Extensions - * Note : irq and spinlock protection will occur in the subroutines - * - * TODO : - * o Check input value more carefully and fill correct values in range - * o Test and shakeout the bugs (if any) - * - * Jean II - * - * Javier Achirica did a great job of merging code from the unnamed CISCO - * developer that added support for flashing the card. - */ -static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - int rc = 0; - struct airo_info *ai = dev->ml_priv; - - if (ai->power.event) - return 0; - - switch (cmd) { -#ifdef CISCO_EXT - case AIROIDIFC: -#ifdef AIROOLDIDIFC - case AIROOLDIDIFC: -#endif - { - int val = AIROMAGIC; - aironet_ioctl com; - if (copy_from_user(&com,rq->ifr_data,sizeof(com))) - rc = -EFAULT; - else if (copy_to_user(com.data,(char *)&val,sizeof(val))) - rc = -EFAULT; - } - break; - - case AIROIOCTL: -#ifdef AIROOLDIOCTL - case AIROOLDIOCTL: -#endif - /* Get the command struct and hand it off for evaluation by - * the proper subfunction - */ - { - aironet_ioctl com; - if (copy_from_user(&com,rq->ifr_data,sizeof(com))) { - rc = -EFAULT; - break; - } - - /* Separate R/W functions bracket legality here - */ - if ( com.command == AIRORSWVERSION ) { - if (copy_to_user(com.data, swversion, sizeof(swversion))) - rc = -EFAULT; - else - rc = 0; - } - else if ( com.command <= AIRORRID) - rc = readrids(dev,&com); - else if ( com.command >= AIROPCAP && com.command <= (AIROPLEAPUSR+2) ) - rc = writerids(dev,&com); - else if ( com.command >= AIROFLSHRST && com.command <= AIRORESTART ) - rc = flashcard(dev,&com); - else - rc = -EINVAL; /* Bad command in ioctl */ - } - break; -#endif /* CISCO_EXT */ - - // All other calls are currently unsupported - default: - rc = -EOPNOTSUPP; - } - return rc; -} - -/* - * Get the Wireless stats out of the driver - * Note : irq and spinlock protection will occur in the subroutines - * - * TODO : - * o Check if work in Ad-Hoc mode (otherwise, use SPY, as in wvlan_cs) - * - * Jean - */ -static void airo_read_wireless_stats(struct airo_info *local) -{ - StatusRid status_rid; - StatsRid stats_rid; - CapabilityRid cap_rid; - __le32 *vals = stats_rid.vals; - - /* Get stats out of the card */ - clear_bit(JOB_WSTATS, &local->jobs); - if (local->power.event) { - up(&local->sem); - return; - } - readCapabilityRid(local, &cap_rid, 0); - readStatusRid(local, &status_rid, 0); - readStatsRid(local, &stats_rid, RID_STATS, 0); - up(&local->sem); - - /* The status */ - local->wstats.status = le16_to_cpu(status_rid.mode); - - /* Signal quality and co */ - if (local->rssi) { - local->wstats.qual.level = - airo_rssi_to_dbm(local->rssi, - le16_to_cpu(status_rid.sigQuality)); - /* normalizedSignalStrength appears to be a percentage */ - local->wstats.qual.qual = - le16_to_cpu(status_rid.normalizedSignalStrength); - } else { - local->wstats.qual.level = - (le16_to_cpu(status_rid.normalizedSignalStrength) + 321) / 2; - local->wstats.qual.qual = airo_get_quality(&status_rid, &cap_rid); - } - if (le16_to_cpu(status_rid.len) >= 124) { - local->wstats.qual.noise = 0x100 - status_rid.noisedBm; - local->wstats.qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; - } else { - local->wstats.qual.noise = 0; - local->wstats.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_INVALID | IW_QUAL_DBM; - } - - /* Packets discarded in the wireless adapter due to wireless - * specific problems */ - local->wstats.discard.nwid = le32_to_cpu(vals[56]) + - le32_to_cpu(vals[57]) + - le32_to_cpu(vals[58]); /* SSID Mismatch */ - local->wstats.discard.code = le32_to_cpu(vals[6]);/* RxWepErr */ - local->wstats.discard.fragment = le32_to_cpu(vals[30]); - local->wstats.discard.retries = le32_to_cpu(vals[10]); - local->wstats.discard.misc = le32_to_cpu(vals[1]) + - le32_to_cpu(vals[32]); - local->wstats.miss.beacon = le32_to_cpu(vals[34]); -} - -static struct iw_statistics *airo_get_wireless_stats(struct net_device *dev) -{ - struct airo_info *local = dev->ml_priv; - - if (!test_bit(JOB_WSTATS, &local->jobs)) { - /* Get stats out of the card if available */ - if (down_trylock(&local->sem) != 0) { - set_bit(JOB_WSTATS, &local->jobs); - wake_up_interruptible(&local->thr_wait); - } else - airo_read_wireless_stats(local); - } - - return &local->wstats; -} - -#ifdef CISCO_EXT -/* - * This just translates from driver IOCTL codes to the command codes to - * feed to the radio's host interface. Things can be added/deleted - * as needed. This represents the READ side of control I/O to - * the card - */ -static int readrids(struct net_device *dev, aironet_ioctl *comp) { - unsigned short ridcode; - unsigned char *iobuf; - int len; - struct airo_info *ai = dev->ml_priv; - - if (test_bit(FLAG_FLASHING, &ai->flags)) - return -EIO; - - switch(comp->command) - { - case AIROGCAP: ridcode = RID_CAPABILITIES; break; - case AIROGCFG: ridcode = RID_CONFIG; - if (test_bit(FLAG_COMMIT, &ai->flags)) { - disable_MAC (ai, 1); - writeConfigRid (ai, 1); - enable_MAC(ai, 1); - } - break; - case AIROGSLIST: ridcode = RID_SSID; break; - case AIROGVLIST: ridcode = RID_APLIST; break; - case AIROGDRVNAM: ridcode = RID_DRVNAME; break; - case AIROGEHTENC: ridcode = RID_ETHERENCAP; break; - case AIROGWEPKTMP: ridcode = RID_WEP_TEMP; - /* Only super-user can read WEP keys */ - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - break; - case AIROGWEPKNV: ridcode = RID_WEP_PERM; - /* Only super-user can read WEP keys */ - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - break; - case AIROGSTAT: ridcode = RID_STATUS; break; - case AIROGSTATSD32: ridcode = RID_STATSDELTA; break; - case AIROGSTATSC32: ridcode = RID_STATS; break; - case AIROGMICSTATS: - if (copy_to_user(comp->data, &ai->micstats, - min((int)comp->len,(int)sizeof(ai->micstats)))) - return -EFAULT; - return 0; - case AIRORRID: ridcode = comp->ridnum; break; - default: - return -EINVAL; - break; - } - - if ((iobuf = kmalloc(RIDSIZE, GFP_KERNEL)) == NULL) - return -ENOMEM; - - PC4500_readrid(ai,ridcode,iobuf,RIDSIZE, 1); - /* get the count of bytes in the rid docs say 1st 2 bytes is it. - * then return it to the user - * 9/22/2000 Honor user given length - */ - len = comp->len; - - if (copy_to_user(comp->data, iobuf, min(len, (int)RIDSIZE))) { - kfree (iobuf); - return -EFAULT; - } - kfree (iobuf); - return 0; -} - -/* - * Danger Will Robinson write the rids here - */ - -static int writerids(struct net_device *dev, aironet_ioctl *comp) { - struct airo_info *ai = dev->ml_priv; - int ridcode; - int enabled; - static int (* writer)(struct airo_info *, u16 rid, const void *, int, int); - unsigned char *iobuf; - - /* Only super-user can write RIDs */ - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (test_bit(FLAG_FLASHING, &ai->flags)) - return -EIO; - - ridcode = 0; - writer = do_writerid; - - switch(comp->command) - { - case AIROPSIDS: ridcode = RID_SSID; break; - case AIROPCAP: ridcode = RID_CAPABILITIES; break; - case AIROPAPLIST: ridcode = RID_APLIST; break; - case AIROPCFG: ai->config.len = 0; - clear_bit(FLAG_COMMIT, &ai->flags); - ridcode = RID_CONFIG; break; - case AIROPWEPKEYNV: ridcode = RID_WEP_PERM; break; - case AIROPLEAPUSR: ridcode = RID_LEAPUSERNAME; break; - case AIROPLEAPPWD: ridcode = RID_LEAPPASSWORD; break; - case AIROPWEPKEY: ridcode = RID_WEP_TEMP; writer = PC4500_writerid; - break; - case AIROPLEAPUSR+1: ridcode = 0xFF2A; break; - case AIROPLEAPUSR+2: ridcode = 0xFF2B; break; - - /* this is not really a rid but a command given to the card - * same with MAC off - */ - case AIROPMACON: - if (enable_MAC(ai, 1) != 0) - return -EIO; - return 0; - - /* - * Evidently this code in the airo driver does not get a symbol - * as disable_MAC. it's probably so short the compiler does not gen one. - */ - case AIROPMACOFF: - disable_MAC(ai, 1); - return 0; - - /* This command merely clears the counts does not actually store any data - * only reads rid. But as it changes the cards state, I put it in the - * writerid routines. - */ - case AIROPSTCLR: - if ((iobuf = kmalloc(RIDSIZE, GFP_KERNEL)) == NULL) - return -ENOMEM; - - PC4500_readrid(ai,RID_STATSDELTACLEAR,iobuf,RIDSIZE, 1); - - enabled = ai->micstats.enabled; - memset(&ai->micstats,0,sizeof(ai->micstats)); - ai->micstats.enabled = enabled; - - if (copy_to_user(comp->data, iobuf, - min((int)comp->len, (int)RIDSIZE))) { - kfree (iobuf); - return -EFAULT; - } - kfree (iobuf); - return 0; - - default: - return -EOPNOTSUPP; /* Blarg! */ - } - if(comp->len > RIDSIZE) - return -EINVAL; - - if ((iobuf = kmalloc(RIDSIZE, GFP_KERNEL)) == NULL) - return -ENOMEM; - - if (copy_from_user(iobuf,comp->data,comp->len)) { - kfree (iobuf); - return -EFAULT; - } - - if (comp->command == AIROPCFG) { - ConfigRid *cfg = (ConfigRid *)iobuf; - - if (test_bit(FLAG_MIC_CAPABLE, &ai->flags)) - cfg->opmode |= MODE_MIC; - - if ((cfg->opmode & MODE_CFG_MASK) == MODE_STA_IBSS) - set_bit (FLAG_ADHOC, &ai->flags); - else - clear_bit (FLAG_ADHOC, &ai->flags); - } - - if((*writer)(ai, ridcode, iobuf,comp->len,1)) { - kfree (iobuf); - return -EIO; - } - kfree (iobuf); - return 0; -} - -/***************************************************************************** - * Ancillary flash / mod functions much black magic lurkes here * - ***************************************************************************** - */ - -/* - * Flash command switch table - */ - -static int flashcard(struct net_device *dev, aironet_ioctl *comp) { - int z; - - /* Only super-user can modify flash */ - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - switch(comp->command) - { - case AIROFLSHRST: - return cmdreset((struct airo_info *)dev->ml_priv); - - case AIROFLSHSTFL: - if (!AIRO_FLASH(dev) && - (AIRO_FLASH(dev) = kmalloc(FLASHSIZE, GFP_KERNEL)) == NULL) - return -ENOMEM; - return setflashmode((struct airo_info *)dev->ml_priv); - - case AIROFLSHGCHR: /* Get char from aux */ - if(comp->len != sizeof(int)) - return -EINVAL; - if (copy_from_user(&z,comp->data,comp->len)) - return -EFAULT; - return flashgchar((struct airo_info *)dev->ml_priv, z, 8000); - - case AIROFLSHPCHR: /* Send char to card. */ - if(comp->len != sizeof(int)) - return -EINVAL; - if (copy_from_user(&z,comp->data,comp->len)) - return -EFAULT; - return flashpchar((struct airo_info *)dev->ml_priv, z, 8000); - - case AIROFLPUTBUF: /* Send 32k to card */ - if (!AIRO_FLASH(dev)) - return -ENOMEM; - if(comp->len > FLASHSIZE) - return -EINVAL; - if (copy_from_user(AIRO_FLASH(dev), comp->data, comp->len)) - return -EFAULT; - - flashputbuf((struct airo_info *)dev->ml_priv); - return 0; - - case AIRORESTART: - if (flashrestart((struct airo_info *)dev->ml_priv, dev)) - return -EIO; - return 0; - } - return -EINVAL; -} - -#define FLASH_COMMAND 0x7e7e - -/* - * STEP 1) - * Disable MAC and do soft reset on - * card. - */ - -static int cmdreset(struct airo_info *ai) { - disable_MAC(ai, 1); - - if(!waitbusy (ai)){ - airo_print_info(ai->dev->name, "Waitbusy hang before RESET"); - return -EBUSY; - } - - OUT4500(ai,COMMAND,CMD_SOFTRESET); - - ssleep(1); /* WAS 600 12/7/00 */ - - if(!waitbusy (ai)){ - airo_print_info(ai->dev->name, "Waitbusy hang AFTER RESET"); - return -EBUSY; - } - return 0; -} - -/* STEP 2) - * Put the card in legendary flash - * mode - */ - -static int setflashmode (struct airo_info *ai) { - set_bit (FLAG_FLASHING, &ai->flags); - - OUT4500(ai, SWS0, FLASH_COMMAND); - OUT4500(ai, SWS1, FLASH_COMMAND); - if (probe) { - OUT4500(ai, SWS0, FLASH_COMMAND); - OUT4500(ai, COMMAND,0x10); - } else { - OUT4500(ai, SWS2, FLASH_COMMAND); - OUT4500(ai, SWS3, FLASH_COMMAND); - OUT4500(ai, COMMAND,0); - } - msleep(500); /* 500ms delay */ - - if(!waitbusy(ai)) { - clear_bit (FLAG_FLASHING, &ai->flags); - airo_print_info(ai->dev->name, "Waitbusy hang after setflash mode"); - return -EIO; - } - return 0; -} - -/* Put character to SWS0 wait for dwelltime - * x 50us for echo . - */ - -static int flashpchar(struct airo_info *ai,int byte,int dwelltime) { - int echo; - int waittime; - - byte |= 0x8000; - - if(dwelltime == 0 ) - dwelltime = 200; - - waittime=dwelltime; - - /* Wait for busy bit d15 to go false indicating buffer empty */ - while ((IN4500 (ai, SWS0) & 0x8000) && waittime > 0) { - udelay (50); - waittime -= 50; - } - - /* timeout for busy clear wait */ - if(waittime <= 0 ){ - airo_print_info(ai->dev->name, "flash putchar busywait timeout!"); - return -EBUSY; - } - - /* Port is clear now write byte and wait for it to echo back */ - do { - OUT4500(ai,SWS0,byte); - udelay(50); - dwelltime -= 50; - echo = IN4500(ai,SWS1); - } while (dwelltime >= 0 && echo != byte); - - OUT4500(ai,SWS1,0); - - return (echo == byte) ? 0 : -EIO; -} - -/* - * Get a character from the card matching matchbyte - * Step 3) - */ -static int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime){ - int rchar; - unsigned char rbyte=0; - - do { - rchar = IN4500(ai,SWS1); - - if(dwelltime && !(0x8000 & rchar)){ - dwelltime -= 10; - mdelay(10); - continue; - } - rbyte = 0xff & rchar; - - if( (rbyte == matchbyte) && (0x8000 & rchar) ){ - OUT4500(ai,SWS1,0); - return 0; - } - if( rbyte == 0x81 || rbyte == 0x82 || rbyte == 0x83 || rbyte == 0x1a || 0xffff == rchar) - break; - OUT4500(ai,SWS1,0); - - }while(dwelltime > 0); - return -EIO; -} - -/* - * Transfer 32k of firmware data from user buffer to our buffer and - * send to the card - */ - -static int flashputbuf(struct airo_info *ai){ - int nwords; - - /* Write stuff */ - if (test_bit(FLAG_MPI,&ai->flags)) - memcpy_toio(ai->pciaux + 0x8000, ai->flash, FLASHSIZE); - else { - OUT4500(ai,AUXPAGE,0x100); - OUT4500(ai,AUXOFF,0); - - for(nwords=0;nwords != FLASHSIZE / 2;nwords++){ - OUT4500(ai,AUXDATA,ai->flash[nwords] & 0xffff); - } - } - OUT4500(ai,SWS0,0x8000); - - return 0; -} - -/* - * - */ -static int flashrestart(struct airo_info *ai,struct net_device *dev){ - int i,status; - - ssleep(1); /* Added 12/7/00 */ - clear_bit (FLAG_FLASHING, &ai->flags); - if (test_bit(FLAG_MPI, &ai->flags)) { - status = mpi_init_descriptors(ai); - if (status != SUCCESS) - return status; - } - status = setup_card(ai, dev->dev_addr, 1); - - if (!test_bit(FLAG_MPI,&ai->flags)) - for( i = 0; i < MAX_FIDS; i++ ) { - ai->fids[i] = transmit_allocate - ( ai, AIRO_DEF_MTU, i >= MAX_FIDS / 2 ); - } - - ssleep(1); /* Added 12/7/00 */ - return status; -} -#endif /* CISCO_EXT */ - -/* - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - In addition: - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ - -module_init(airo_init_module); -module_exit(airo_cleanup_module); diff --git a/drivers/net/wireless/airo.h b/drivers/net/wireless/airo.h deleted file mode 100644 index e480adf86be6..000000000000 --- a/drivers/net/wireless/airo.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _AIRO_H_ -#define _AIRO_H_ - -struct net_device *init_airo_card(unsigned short irq, int port, int is_pcmcia, - struct device *dmdev); -int reset_airo_card(struct net_device *dev); -void stop_airo_card(struct net_device *dev, int freeres); - -#endif /* _AIRO_H_ */ diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c deleted file mode 100644 index 14128fd265ac..000000000000 --- a/drivers/net/wireless/airo_cs.c +++ /dev/null @@ -1,222 +0,0 @@ -/*====================================================================== - - Aironet driver for 4500 and 4800 series cards - - This code is released under both the GPL version 2 and BSD licenses. - Either license may be used. The respective licenses are found at - the end of this file. - - This code was developed by Benjamin Reed - including portions of which come from the Aironet PC4500 - Developer's Reference Manual and used with permission. Copyright - (C) 1999 Benjamin Reed. All Rights Reserved. Permission to use - code in the Developer's manual was granted for this driver by - Aironet. - - In addition this module was derived from dummy_cs. - The initial developer of dummy_cs is David A. Hinds - . Portions created by David A. Hinds - are Copyright (C) 1999 David A. Hinds. All Rights Reserved. - -======================================================================*/ - -#ifdef __IN_PCMCIA_PACKAGE__ -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "airo.h" - - -/*====================================================================*/ - -MODULE_AUTHOR("Benjamin Reed"); -MODULE_DESCRIPTION("Support for Cisco/Aironet 802.11 wireless ethernet " - "cards. This is the module that links the PCMCIA card " - "with the airo module."); -MODULE_LICENSE("Dual BSD/GPL"); -MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards"); - -/*====================================================================*/ - -static int airo_config(struct pcmcia_device *link); -static void airo_release(struct pcmcia_device *link); - -static void airo_detach(struct pcmcia_device *p_dev); - -typedef struct local_info_t { - struct net_device *eth_dev; -} local_info_t; - -static int airo_probe(struct pcmcia_device *p_dev) -{ - local_info_t *local; - - dev_dbg(&p_dev->dev, "airo_attach()\n"); - - /* Allocate space for private device-specific data */ - local = kzalloc(sizeof(local_info_t), GFP_KERNEL); - if (!local) - return -ENOMEM; - - p_dev->priv = local; - - return airo_config(p_dev); -} /* airo_attach */ - -static void airo_detach(struct pcmcia_device *link) -{ - dev_dbg(&link->dev, "airo_detach\n"); - - airo_release(link); - - if (((local_info_t *)link->priv)->eth_dev) { - stop_airo_card(((local_info_t *)link->priv)->eth_dev, 0); - } - ((local_info_t *)link->priv)->eth_dev = NULL; - - kfree(link->priv); -} /* airo_detach */ - -static int airo_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) -{ - if (p_dev->config_index == 0) - return -EINVAL; - - return pcmcia_request_io(p_dev); -} - - -static int airo_config(struct pcmcia_device *link) -{ - local_info_t *dev; - int ret; - - dev = link->priv; - - dev_dbg(&link->dev, "airo_config\n"); - - link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | - CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; - - ret = pcmcia_loop_config(link, airo_cs_config_check, NULL); - if (ret) - goto failed; - - if (!link->irq) - goto failed; - - ret = pcmcia_enable_device(link); - if (ret) - goto failed; - ((local_info_t *)link->priv)->eth_dev = - init_airo_card(link->irq, - link->resource[0]->start, 1, &link->dev); - if (!((local_info_t *)link->priv)->eth_dev) - goto failed; - - return 0; - - failed: - airo_release(link); - return -ENODEV; -} /* airo_config */ - -static void airo_release(struct pcmcia_device *link) -{ - dev_dbg(&link->dev, "airo_release\n"); - pcmcia_disable_device(link); -} - -static int airo_suspend(struct pcmcia_device *link) -{ - local_info_t *local = link->priv; - - netif_device_detach(local->eth_dev); - - return 0; -} - -static int airo_resume(struct pcmcia_device *link) -{ - local_info_t *local = link->priv; - - if (link->open) { - reset_airo_card(local->eth_dev); - netif_device_attach(local->eth_dev); - } - - return 0; -} - -static const struct pcmcia_device_id airo_ids[] = { - PCMCIA_DEVICE_MANF_CARD(0x015f, 0x000a), - PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0005), - PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0007), - PCMCIA_DEVICE_MANF_CARD(0x0105, 0x0007), - PCMCIA_DEVICE_NULL, -}; -MODULE_DEVICE_TABLE(pcmcia, airo_ids); - -static struct pcmcia_driver airo_driver = { - .owner = THIS_MODULE, - .name = "airo_cs", - .probe = airo_probe, - .remove = airo_detach, - .id_table = airo_ids, - .suspend = airo_suspend, - .resume = airo_resume, -}; -module_pcmcia_driver(airo_driver); - -/* - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - In addition: - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ diff --git a/drivers/net/wireless/ar6003/Kconfig b/drivers/net/wireless/ar6003/Kconfig deleted file mode 100644 index 09841df4af7f..000000000000 --- a/drivers/net/wireless/ar6003/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ - config AR6003 - depends on WLAN_80211 && MMC - select WIRELESS_EXT - select IEEE80211 - select FW_LOADER - bool "Atheros AR6003/AR6302 SDIO" - ---help--- - Atheros ROC AR6003/AR6302. - diff --git a/drivers/net/wireless/ar6003/Makefile b/drivers/net/wireless/ar6003/Makefile deleted file mode 100644 index 380ec1259a06..000000000000 --- a/drivers/net/wireless/ar6003/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -AR6003_SRC_PATH := drivers/net/wireless/ar6003 - -EXTRA_CFLAGS += -I${AR6003_SRC_PATH}/host/include -EXTRA_CFLAGS += -I${AR6003_SRC_PATH}/include -EXTRA_CFLAGS += -I${AR6003_SRC_PATH}/host/wlan/include -EXTRA_CFLAGS += -I${AR6003_SRC_PATH}/host/os/linux/include -EXTRA_CFLAGS += -I${AR6003_SRC_PATH}/host/os/ -EXTRA_CFLAGS += -I${AR6003_SRC_PATH}/host/bmi/include -EXTRA_CFLAGS += -I${AR6003_SRC_PATH}/include/AR6002 -EXTRA_CFLAGS += -I${AR6003_SRC_PATH}/host/hif/sdio/linux_sdio/include -EXTRA_CFLAGS += -Idrivers/net/wireless - -EXTRA_CFLAGS += -DLINUX -D__KERNEL__ -DTCMD -DSEND_EVENT_TO_APP -DUSER_KEYS -DNO_SYNC_FLUSH -DHTC_EP_STAT_PROFILING -DWLAN_HEADERS -DATH_AR6K_11N_SUPPORT -DATH_SUPPORT_DFS -DANDROID_ENV -D__linux__ -DINIT_MODE_DRV_ENABLED -DBMIENABLE_SET -DAR600x_SD31_XXX -DATH6KL_SKIP_ABI_VERSION_CHECK -DATH6KL_CONFIG_HIF_VIRTUAL_SCATTER -DCONFIG_HOST_TCMD_SUPPORT -DCONFIG_AP_VIRTUAL_ADAPTER_SUPPORT -DSOFTMAC_FILE_USED -DDEBUG -DATH_DEBUG_MODULE -DAR6002_HEADERS_DEF -DAR6003_HEADERS_DEF -DMCKINLEY_HEADERS_DEF -DKERNEL_2_6 - -ifeq ($(CONFIG_BT),y) -EXTRA_CFLAGS += -DATH_AR6K_ENABLE_GMBOX -EXTRA_CFLAGS += -DHCI_TRANSPORT_SDIO -EXTRA_CFLAGS += -DSETUPHCI_ENABLED -EXTRA_CFLAGS += -DSETUPBTDEV_ENABLED -endif - -EXTRA_CFLAGS += -DRK29 -EXTRA_CFLAGS += -DTCHIP - -olca3-objs := host/hif/sdio/linux_sdio/src/hif.o \ - host/hif/sdio/linux_sdio/src/hif_scatter.o \ - host/hif/common/hif_bmi_reg_access.o \ - host/hif/common/hif_diag_reg_access.o \ - host/wmi/wmi.o \ - host/reorder/rcv_aggr.o \ - host/htc2/AR6000/ar6k.o \ - host/htc2/AR6000/ar6k_events.o \ - host/htc2/htc_services.o \ - host/htc2/htc.o \ - host/htc2/htc_send.o \ - host/htc2/htc_recv.o \ - host/wlan/src/wlan_recv_beacon.o \ - host/wlan/src/wlan_utils.o \ - host/wlan/src/wlan_node.o \ - host/bmi/src/bmi.o \ - host/miscdrv/credit_dist.o \ - host/miscdrv/common_drv.o \ - host/os/linux/hci_bridge.o \ - host/os/linux/netbuf.o \ - host/os/linux/ar6000_android.o \ - host/os/linux/ioctl.o \ - host/os/linux/wireless_ext.o \ - host/os/linux/ar6000_pm.o \ - host/os/linux/ar6000_raw_if.o \ - host/os/linux/ar6000_drv.o \ - host/os/linux/ar6k_pal.o \ - host/regtable/regtable.o \ - host/regtable/AR6002def.o \ - host/regtable/MCKINLEYdef.o \ - host/regtable/AR6003def.o \ - host/dfs/dfs_debug.o \ - host/dfs/dfs_process_phyerr.o \ - host/dfs/dfs.o \ - host/dfs/dfs_misc.o \ - host/dfs/dfs_bindetects.o \ - host/dfs/dfs_init.o \ - host/dfs/dfs_host_project.o \ - host/dfs/dfs_staggered.o \ - host/dfs/dfs_ar.o \ - host/dfs/dfs_process_radarevent.o \ - host/dfs/dfs_fcc_bin5.o - -ifeq ($(CONFIG_BT),y) -olca3-objs += host/htc2/AR6000/ar6k_gmbox.o \ - host/htc2/AR6000/ar6k_gmbox_hciuart.o \ - host/miscdrv/ar3kconfig.o \ - host/miscdrv/ar3kps/ar3kpsconfig.o \ - host/miscdrv/ar3kps/ar3kpsparser.o -endif - -obj-$(CONFIG_AR6003) += olca3.o - diff --git a/drivers/net/wireless/ar6003/clean.sh b/drivers/net/wireless/ar6003/clean.sh deleted file mode 100644 index be346d1ea5f9..000000000000 --- a/drivers/net/wireless/ar6003/clean.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -find . \( -not -path "*.output*" -a -name '*.[oas]' -o -name core -o -name '.*.flags' -o -name '.ko' -o -name '.*.cmd' -o -name 'Module.symvers' -o -name 'modules.order' \) -type f -print \ - | grep -v lxdialog/ | xargs rm -f -find . \( -name '.tmp_versions' \) -type d -print | grep -v lxdialog/ | xargs rm -rf - diff --git a/drivers/net/wireless/ar6003/host/Makefile b/drivers/net/wireless/ar6003/host/Makefile deleted file mode 100644 index ee62e661ab19..000000000000 --- a/drivers/net/wireless/ar6003/host/Makefile +++ /dev/null @@ -1,174 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2005-2010 Atheros Corporation. All rights reserved. -# -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -#------------------------------------------------------------------------------ -#============================================================================== -# Author(s): ="Atheros" -#============================================================================== -# AR6K Host driver makefile -# -# Minimal build invocation: -# -# make (all | clean | clobber) -# -# Extended Make invocation: -# -# make ATH_BUILD_TYPE= ATH_SDIO_STACK_BASE= (all | clean | clobber) -# -# Notes: -# 1. This makefile must be invoked from the host/ directory -# 2. The must match an entry in localmake.linux.inc. -# 3. The localmake.linux.inc can be overridden using an include file outside the build tree. -# This file (name and path) can be set via the ATH_MAKE_INCLUDE_OVERRIDE variable. -# ** If ATH_MAKE_INCLUDE_OVERRIDE is used, you can define all build variables in that file -# instead of using command line arguments **. This feature is provided for developers -# that may want to customize the build using a single include file. -# -# For example : -# -# " make ATH_MAKE_INCLUDE_OVERRIDE=$HOME/mymake.inc " -# -# could be used, as long as "mymake.inc" defines all the required variables (see below) -# -# Required Variables: -# -# ATH_OS_SUB_TYPE - on linux, this must be "linux_2_4" for 2.4 kernels or left blank for 2.6 kernels. -# ATH_LINUXPATH - linux kernel source path -# ATH_CROSS_COMPILE_TYPE - optional cross compiler path , leave blank for local gcc compilation -# ATH_ARCH_CPU_TYPE - CPU architecture type, leave blank for local gcc compilation -# ATH_SDIO_STACK_BASE - SDIO Stack installation path to compile the SDIO HIF layer against an externally supplied -# SDIO stack source. -# -# Override variables: -# -# ATH_MAKE_INCLUDE_OVERRIDE - full path to include file which overrides the default (localmake.linux.inc) -# this file can contain other overrides specific to a developers -# workspace environment. -# ATH_BUILD_OUTPUT_OVERRIDE - output path override for compiled executable and -# database image -# - -# Include local variables -ifdef ATH_MAKE_INCLUDE_OVERRIDE -_LOCALMAKE_INCLUDE = $(ATH_MAKE_INCLUDE_OVERRIDE) -else -_LOCALMAKE_INCLUDE = localmake.linux.inc -endif - --include $(_LOCALMAKE_INCLUDE) - -export ATH_SRC_BASE -export ATH_BUILD_TYPE -export ATH_OS_SUB_TYPE -export ATH_LINUXPATH -export ATH_CROSS_COMPILE_TYPE -export ATH_ARCH_CPU_TYPE -export ATH_SDIO_STACK_BASE -export ATH_BUS_TYPE -export ATH_BUS_SUBTYPE -export ATH_HC_DRIVERS -export ATH_HTC_RAW_INT_ENV -export ATH_ANDROID_ENV -export ATH_SOFTMAC_FILE_USED -export ATH_CFG80211_ENV -export ATH_DEBUG_DRIVER -export ATH_AR6K_HCI_PAL -export ATH_AR6K_DEBUG_ALLOC -#export ATH_BUILD_P2P - -ATH_SRC_BASE :=$(shell pwd) -MAKE :=make -CC :=$(ATH_CROSS_COMPILE_TYPE)gcc -LD :=$(ATH_CROSS_COMPILE_TYPE)ld -STRIP :=$(ATH_CROSS_COMPILE_TYPE)strip -ATH_HIF_TYPE :=`echo $(ATH_BUS_TYPE) | tr [:upper:] [:lower:]` - -export STRIP - -#export compiler variables for 3rd party applications (like the WPA supplicant) -export CC -export LD -export STRIP - -# Set cross compile type (if any) -ifdef ATH_CROSS_COMPILE_TYPE -_CROSS_COMPILE_LINE := ARCH=$(ATH_ARCH_CPU_TYPE) CROSS_COMPILE=$(ATH_CROSS_COMPILE_TYPE) -endif - -# Figure out module extension -ifneq ($(ATH_OS_SUB_TYPE),linux_2_4) -KMOD_EXTENSION :=ko -endif -ifeq ($(ATH_OS_SUB_TYPE),linux_2_4) -KMOD_EXTENSION :=o -endif - -# Set up object output areas -ifdef ATH_BUILD_OUTPUT_OVERRIDE -_COMPILED_OBJECTS_PATH :=$(ATH_BUILD_OUTPUT_OVERRIDE) -COMPILED_BIN_OBJECTS_PATH :=$(ATH_BUILD_OUTPUT_OVERRIDE) -COMPILED_IMAGE_OBJECTS_PATH :=$(ATH_BUILD_OUTPUT_OVERRIDE) -_MAKE_IMAGE_OUTPUT_DIR := -_MAKE_BIN_OUTPUT_DIR := -_CLEAN_IMAGE_OUTPUT_DIR := -_CLEAN_BIN_OUTPUT_DIR := -else -_COMPILED_OBJECTS_PATH := $(ATH_SRC_BASE)/.output/$(ATH_BUILD_TYPE)-$(ATH_BUS_TYPE) -COMPILED_BIN_OBJECTS_PATH := $(ATH_SRC_BASE)/.output/bin -COMPILED_IMAGE_OBJECTS_PATH :=$(_COMPILED_OBJECTS_PATH)/$(COMPILED_OBJECTS_PREFIX)image -_MAKE_IMAGE_OUTPUT_DIR := mkdir --parents $(COMPILED_IMAGE_OBJECTS_PATH) -_MAKE_BIN_OUTPUT_DIR := mkdir --parents $(COMPILED_BIN_OBJECTS_PATH) -_CLEAN_IMAGE_OUTPUT_DIR := rm -R -f $(COMPILED_IMAGE_OBJECTS_PATH) -_CLEAN_BIN_OUTPUT_DIR := rm -R -f $(COMPILED_BIN_OBJECTS_PATH) -endif - -# Export the required variables to other Makefiles in the system -export COMPILED_IMAGE_OBJECTS_PATH -export COMPILED_BIN_OBJECTS_PATH - -all: modules - -modules: -ifndef ATH_BUILD_TYPE - @echo "Please edit the $(_LOCALMAKE_INCLUDE) file" - exit 1 -endif - $(_MAKE_IMAGE_OUTPUT_DIR) - $(_MAKE_BIN_OUTPUT_DIR) - $(MAKE) $(_CROSS_COMPILE_LINE) -C $(ATH_LINUXPATH) ATH_HIF_TYPE=$(ATH_HIF_TYPE) SUBDIRS=$(ATH_SRC_BASE)/os/linux modules - $(MAKE) -C hif/$(ATH_HIF_TYPE) -# $(MAKE) -C tools/wmiconfig/ -# $(MAKE) -C tools/recEvent/ - cp -f $(ATH_SRC_BASE)/os/linux/ar6000.$(KMOD_EXTENSION) $(COMPILED_IMAGE_OBJECTS_PATH) - $(STRIP) -g -S -d $(COMPILED_IMAGE_OBJECTS_PATH)/ar6000.$(KMOD_EXTENSION) -# cp -f tools/wmiconfig/wmiconfig $(COMPILED_IMAGE_OBJECTS_PATH) -# cp -f tools/recEvent/recEvent $(COMPILED_IMAGE_OBJECTS_PATH) -# cp -f tools/recEvent/restore.sh $(COMPILED_IMAGE_OBJECTS_PATH) - -clean: - rm -f os/linux/ar6000.mod.c os/linux/*.o os/linux/*.ko wmi/*.o htc/AR6000/src/*.o htc/*.o \ - bmi/src/*.o wlan/src/*.o driver/* tools/wmiconfig/wmiconfig \ - tools/recEvent/recEvent - -# The kernel module build process leaves some intermediate files, this will clean up all these files - find $(ATH_SRC_BASE) \( -not -path "*.output*" -a -name '*.[oas]' -o -name core -o -name '.*.flags' -o -name '.ko' -o -name '.*.cmd' \) -type f -print \ - | grep -v lxdialog/ | xargs rm -f - $(MAKE) -C hif/$(ATH_HIF_TYPE) clean - -clobber:clean - rm -rf .output diff --git a/drivers/net/wireless/ar6003/host/bmi/include/bmi_internal.h b/drivers/net/wireless/ar6003/host/bmi/include/bmi_internal.h deleted file mode 100644 index bb155909e65b..000000000000 --- a/drivers/net/wireless/ar6003/host/bmi/include/bmi_internal.h +++ /dev/null @@ -1,40 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2008 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef BMI_INTERNAL_H -#define BMI_INTERNAL_H - -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" -#include "a_osapi.h" -#define ATH_MODULE_NAME bmi -#include "a_debug.h" -#include "bmi_msg.h" - -#define ATH_DEBUG_BMI ATH_DEBUG_MAKE_MODULE_MASK(0) - -/* ------ Global Variable Declarations ------- */ -A_BOOL bmiDone; - -#endif diff --git a/drivers/net/wireless/ar6003/host/bmi/src/bmi.c b/drivers/net/wireless/ar6003/host/bmi/src/bmi.c deleted file mode 100644 index 59a8b92a9a44..000000000000 --- a/drivers/net/wireless/ar6003/host/bmi/src/bmi.c +++ /dev/null @@ -1,774 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// -// Author(s): ="Atheros" -//============================================================================== - - -#include "hif.h" -#include "bmi.h" -#include "bmi_internal.h" - -#ifdef DEBUG -static ATH_DEBUG_MASK_DESCRIPTION bmi_debug_desc[] = { - { ATH_DEBUG_BMI , "BMI Tracing"}, -}; - -ATH_DEBUG_INSTANTIATE_MODULE_VAR(bmi, - "bmi", - "Boot Manager Interface", - ATH_DEBUG_MASK_DEFAULTS, - ATH_DEBUG_DESCRIPTION_COUNT(bmi_debug_desc), - bmi_debug_desc); - -#endif - -/* -Although we had envisioned BMI to run on top of HTC, this is not how the -final implementation ended up. On the Target side, BMI is a part of the BSP -and does not use the HTC protocol nor even DMA -- it is intentionally kept -very simple. -*/ - -static A_UCHAR *pBMICmdBuf; -#define MAX_BMI_CMDBUF_SZ (BMI_DATASZ_MAX + \ - sizeof(A_UINT32) /* cmd */ + \ - sizeof(A_UINT32) /* addr */ + \ - sizeof(A_UINT32))/* length */ -#define BMI_COMMAND_FITS(sz) ((sz) <= MAX_BMI_CMDBUF_SZ) -#define BMI_EXCHANGE_TIMEOUT_MS 1000 - -/* APIs visible to the driver */ -void -BMIInit(void) -{ - bmiDone = FALSE; - - - /* - * On some platforms, it's not possible to DMA to a static variable - * in a device driver (e.g. Linux loadable driver module). - * So we need to A_MALLOC space for "command credits" and for commands. - * - * Note: implicitly relies on A_MALLOC to provide a buffer that is - * suitable for DMA (or PIO). This buffer will be passed down the - * bus stack. - */ - - if (!pBMICmdBuf) { - pBMICmdBuf = (A_UCHAR *)A_MALLOC_NOWAIT(MAX_BMI_CMDBUF_SZ); - A_ASSERT(pBMICmdBuf); - } - - A_REGISTER_MODULE_DEBUG_INFO(bmi); -} - -void -BMICleanup(void) -{ -#if 0 - if (pBMICmdCredits) { - A_FREE(pBMICmdCredits); - pBMICmdCredits = NULL; - } -#endif - - if (pBMICmdBuf) { - A_FREE(pBMICmdBuf); - pBMICmdBuf = NULL; - } -} - -A_STATUS -BMIDone(HIF_DEVICE *device) -{ - A_STATUS status; - A_UINT32 cid; - - if (bmiDone) { - AR_DEBUG_PRINTF (ATH_DEBUG_BMI, ("BMIDone skipped\n")); - return A_OK; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Done: Enter (device: 0x%p)\n", device)); - bmiDone = TRUE; - cid = BMI_DONE; - A_MEMCPY(pBMICmdBuf,&cid,sizeof(cid)); - - status = HIFExchangeBMIMsg(device, pBMICmdBuf, sizeof(cid), NULL, NULL, 0); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n")); - return A_ERROR; - } - - if (pBMICmdBuf) { - A_FREE(pBMICmdBuf); - pBMICmdBuf = NULL; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Done: Exit\n")); - - return A_OK; -} - -#ifndef HIF_MESSAGE_BASED -extern A_STATUS HIFRegBasedGetTargetInfo(HIF_DEVICE *device, struct bmi_target_info *targ_info); -#endif - -A_STATUS -BMIGetTargetInfo(HIF_DEVICE *device, struct bmi_target_info *targ_info) -{ - if (bmiDone) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI Get Target Info Command disallowed\n")); - return A_ERROR; - } - -#ifndef HIF_MESSAGE_BASED - /* getting the target ID requires special handling because of the variable length - * message */ - return HIFRegBasedGetTargetInfo(device,targ_info); -#else - /* TODO */ - return A_ERROR; -#endif -} - -A_STATUS -BMIReadMemory(HIF_DEVICE *device, - A_UINT32 address, - A_UCHAR *buffer, - A_UINT32 length) -{ - A_UINT32 cid; - A_STATUS status; - A_UINT32 offset; - A_UINT32 remaining, rxlen; - - A_ASSERT(BMI_COMMAND_FITS(BMI_DATASZ_MAX + sizeof(cid) + sizeof(address) + sizeof(length))); - memset (pBMICmdBuf, 0, BMI_DATASZ_MAX + sizeof(cid) + sizeof(address) + sizeof(length)); - - if (bmiDone) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Command disallowed\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, - ("BMI Read Memory: Enter (device: 0x%p, address: 0x%x, length: %d)\n", - device, address, length)); - - cid = BMI_READ_MEMORY; - - remaining = length; - - while (remaining) - { - rxlen = (remaining < BMI_DATASZ_MAX) ? remaining : BMI_DATASZ_MAX; - offset = 0; - A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - A_MEMCPY(&(pBMICmdBuf[offset]), &address, sizeof(address)); - offset += sizeof(address); - A_MEMCPY(&(pBMICmdBuf[offset]), &rxlen, sizeof(rxlen)); - offset += sizeof(length); - - status = HIFExchangeBMIMsg(device, - pBMICmdBuf, - offset, - pBMICmdBuf, /* note we reuse the same buffer to receive on */ - &rxlen, - BMI_EXCHANGE_TIMEOUT_MS); - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read from the device\n")); - return A_ERROR; - } - A_MEMCPY(&buffer[length - remaining], pBMICmdBuf, rxlen); - remaining -= rxlen; address += rxlen; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Read Memory: Exit\n")); - return A_OK; -} - -A_STATUS -BMIWriteMemory(HIF_DEVICE *device, - A_UINT32 address, - A_UCHAR *buffer, - A_UINT32 length) -{ - A_UINT32 cid; - A_STATUS status; - A_UINT32 offset; - A_UINT32 remaining, txlen; - const A_UINT32 header = sizeof(cid) + sizeof(address) + sizeof(length); - A_UCHAR alignedBuffer[BMI_DATASZ_MAX]; - A_UCHAR *src; - - A_ASSERT(BMI_COMMAND_FITS(BMI_DATASZ_MAX + header)); - memset (pBMICmdBuf, 0, BMI_DATASZ_MAX + header); - - if (bmiDone) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Command disallowed\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, - ("BMI Write Memory: Enter (device: 0x%p, address: 0x%x, length: %d)\n", - device, address, length)); - - cid = BMI_WRITE_MEMORY; - - remaining = length; - while (remaining) - { - src = &buffer[length - remaining]; - if (remaining < (BMI_DATASZ_MAX - header)) { - if (remaining & 3) { - /* align it with 4 bytes */ - remaining = remaining + (4 - (remaining & 3)); - memcpy(alignedBuffer, src, remaining); - src = alignedBuffer; - } - txlen = remaining; - } else { - txlen = (BMI_DATASZ_MAX - header); - } - offset = 0; - A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - A_MEMCPY(&(pBMICmdBuf[offset]), &address, sizeof(address)); - offset += sizeof(address); - A_MEMCPY(&(pBMICmdBuf[offset]), &txlen, sizeof(txlen)); - offset += sizeof(txlen); - A_MEMCPY(&(pBMICmdBuf[offset]), src, txlen); - offset += txlen; - status = HIFExchangeBMIMsg(device, pBMICmdBuf, offset, NULL, NULL, BMI_EXCHANGE_TIMEOUT_MS); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n")); - return A_ERROR; - } - remaining -= txlen; address += txlen; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Write Memory: Exit\n")); - - return A_OK; -} - -A_STATUS -BMIExecute(HIF_DEVICE *device, - A_UINT32 address, - A_UINT32 *param) -{ - A_UINT32 cid; - A_STATUS status; - A_UINT32 offset; - A_UINT32 paramLen; - - A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address) + sizeof(param))); - memset (pBMICmdBuf, 0, sizeof(cid) + sizeof(address) + sizeof(param)); - - if (bmiDone) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Command disallowed\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, - ("BMI Execute: Enter (device: 0x%p, address: 0x%x, param: %d)\n", - device, address, *param)); - - cid = BMI_EXECUTE; - - offset = 0; - A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - A_MEMCPY(&(pBMICmdBuf[offset]), &address, sizeof(address)); - offset += sizeof(address); - A_MEMCPY(&(pBMICmdBuf[offset]), param, sizeof(*param)); - offset += sizeof(*param); - paramLen = sizeof(*param); - status = HIFExchangeBMIMsg(device, pBMICmdBuf, offset, pBMICmdBuf, ¶mLen, 0); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read from the device\n")); - return A_ERROR; - } - - A_MEMCPY(param, pBMICmdBuf, sizeof(*param)); - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Execute: Exit (param: %d)\n", *param)); - return A_OK; -} - -A_STATUS -BMISetAppStart(HIF_DEVICE *device, - A_UINT32 address) -{ - A_UINT32 cid; - A_STATUS status; - A_UINT32 offset; - - A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address))); - memset (pBMICmdBuf, 0, sizeof(cid) + sizeof(address)); - - if (bmiDone) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Command disallowed\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, - ("BMI Set App Start: Enter (device: 0x%p, address: 0x%x)\n", - device, address)); - - cid = BMI_SET_APP_START; - - offset = 0; - A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - A_MEMCPY(&(pBMICmdBuf[offset]), &address, sizeof(address)); - offset += sizeof(address); - - status = HIFExchangeBMIMsg(device, pBMICmdBuf, offset, NULL, NULL, 0); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Set App Start: Exit\n")); - return A_OK; -} - -A_STATUS -BMIReadSOCRegister(HIF_DEVICE *device, - A_UINT32 address, - A_UINT32 *param) -{ - A_UINT32 cid; - A_STATUS status; - A_UINT32 offset,paramLen; - - A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address))); - memset (pBMICmdBuf, 0, sizeof(cid) + sizeof(address)); - - if (bmiDone) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Command disallowed\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, - ("BMI Read SOC Register: Enter (device: 0x%p, address: 0x%x)\n", - device, address)); - - cid = BMI_READ_SOC_REGISTER; - - offset = 0; - A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - A_MEMCPY(&(pBMICmdBuf[offset]), &address, sizeof(address)); - offset += sizeof(address); - paramLen = sizeof(*param); - status = HIFExchangeBMIMsg(device, pBMICmdBuf, offset, pBMICmdBuf, ¶mLen, BMI_EXCHANGE_TIMEOUT_MS); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read from the device\n")); - return A_ERROR; - } - A_MEMCPY(param, pBMICmdBuf, sizeof(*param)); - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Read SOC Register: Exit (value: %d)\n", *param)); - return A_OK; -} - -A_STATUS -BMIWriteSOCRegister(HIF_DEVICE *device, - A_UINT32 address, - A_UINT32 param) -{ - A_UINT32 cid; - A_STATUS status; - A_UINT32 offset; - - A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address) + sizeof(param))); - memset (pBMICmdBuf, 0, sizeof(cid) + sizeof(address) + sizeof(param)); - - if (bmiDone) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Command disallowed\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, - ("BMI Write SOC Register: Enter (device: 0x%p, address: 0x%x, param: %d)\n", - device, address, param)); - - cid = BMI_WRITE_SOC_REGISTER; - - offset = 0; - A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - A_MEMCPY(&(pBMICmdBuf[offset]), &address, sizeof(address)); - offset += sizeof(address); - A_MEMCPY(&(pBMICmdBuf[offset]), ¶m, sizeof(param)); - offset += sizeof(param); - status = HIFExchangeBMIMsg(device, pBMICmdBuf, offset, NULL, NULL, 0); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Read SOC Register: Exit\n")); - return A_OK; -} - -A_STATUS -BMIrompatchInstall(HIF_DEVICE *device, - A_UINT32 ROM_addr, - A_UINT32 RAM_addr, - A_UINT32 nbytes, - A_UINT32 do_activate, - A_UINT32 *rompatch_id) -{ - A_UINT32 cid; - A_STATUS status; - A_UINT32 offset,responseLen; - - A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + sizeof(ROM_addr) + sizeof(RAM_addr) + - sizeof(nbytes) + sizeof(do_activate))); - memset(pBMICmdBuf, 0, sizeof(cid) + sizeof(ROM_addr) + sizeof(RAM_addr) + - sizeof(nbytes) + sizeof(do_activate)); - - if (bmiDone) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Command disallowed\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, - ("BMI rompatch Install: Enter (device: 0x%p, ROMaddr: 0x%x, RAMaddr: 0x%x length: %d activate: %d)\n", - device, ROM_addr, RAM_addr, nbytes, do_activate)); - - cid = BMI_ROMPATCH_INSTALL; - - offset = 0; - A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - A_MEMCPY(&(pBMICmdBuf[offset]), &ROM_addr, sizeof(ROM_addr)); - offset += sizeof(ROM_addr); - A_MEMCPY(&(pBMICmdBuf[offset]), &RAM_addr, sizeof(RAM_addr)); - offset += sizeof(RAM_addr); - A_MEMCPY(&(pBMICmdBuf[offset]), &nbytes, sizeof(nbytes)); - offset += sizeof(nbytes); - A_MEMCPY(&(pBMICmdBuf[offset]), &do_activate, sizeof(do_activate)); - offset += sizeof(do_activate); - responseLen = sizeof(*rompatch_id); - status = HIFExchangeBMIMsg(device, pBMICmdBuf, offset, pBMICmdBuf, &responseLen, BMI_EXCHANGE_TIMEOUT_MS); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to install ROM patch\n")); - return A_ERROR; - } - - A_MEMCPY(rompatch_id, pBMICmdBuf, sizeof(*rompatch_id)); - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI rompatch Install: (rompatch_id=%d)\n", *rompatch_id)); - return A_OK; -} - -A_STATUS -BMIrompatchUninstall(HIF_DEVICE *device, - A_UINT32 rompatch_id) -{ - A_UINT32 cid; - A_STATUS status; - A_UINT32 offset; - - A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + sizeof(rompatch_id))); - memset (pBMICmdBuf, 0, sizeof(cid) + sizeof(rompatch_id)); - - if (bmiDone) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Command disallowed\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, - ("BMI rompatch Uninstall: Enter (device: 0x%p, rompatch_id: %d)\n", - device, rompatch_id)); - - cid = BMI_ROMPATCH_UNINSTALL; - - offset = 0; - A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - A_MEMCPY(&(pBMICmdBuf[offset]), &rompatch_id, sizeof(rompatch_id)); - offset += sizeof(rompatch_id); - status = HIFExchangeBMIMsg(device, pBMICmdBuf, offset, NULL, NULL, 0); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI rompatch UNinstall: (rompatch_id=0x%x)\n", rompatch_id)); - return A_OK; -} - -static A_STATUS -_BMIrompatchChangeActivation(HIF_DEVICE *device, - A_UINT32 rompatch_count, - A_UINT32 *rompatch_list, - A_UINT32 do_activate) -{ - A_UINT32 cid; - A_STATUS status; - A_UINT32 offset; - A_UINT32 length; - - A_ASSERT(BMI_COMMAND_FITS(BMI_DATASZ_MAX + sizeof(cid) + sizeof(rompatch_count))); - memset(pBMICmdBuf, 0, BMI_DATASZ_MAX + sizeof(cid) + sizeof(rompatch_count)); - - if (bmiDone) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Command disallowed\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, - ("BMI Change rompatch Activation: Enter (device: 0x%p, count: %d)\n", - device, rompatch_count)); - - cid = do_activate ? BMI_ROMPATCH_ACTIVATE : BMI_ROMPATCH_DEACTIVATE; - - offset = 0; - A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - A_MEMCPY(&(pBMICmdBuf[offset]), &rompatch_count, sizeof(rompatch_count)); - offset += sizeof(rompatch_count); - length = rompatch_count * sizeof(*rompatch_list); - A_MEMCPY(&(pBMICmdBuf[offset]), rompatch_list, length); - offset += length; - status = HIFExchangeBMIMsg(device, pBMICmdBuf, offset, NULL, NULL, 0); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Change rompatch Activation: Exit\n")); - - return A_OK; -} - -A_STATUS -BMIrompatchActivate(HIF_DEVICE *device, - A_UINT32 rompatch_count, - A_UINT32 *rompatch_list) -{ - return _BMIrompatchChangeActivation(device, rompatch_count, rompatch_list, 1); -} - -A_STATUS -BMIrompatchDeactivate(HIF_DEVICE *device, - A_UINT32 rompatch_count, - A_UINT32 *rompatch_list) -{ - return _BMIrompatchChangeActivation(device, rompatch_count, rompatch_list, 0); -} - -A_STATUS -BMILZData(HIF_DEVICE *device, - A_UCHAR *buffer, - A_UINT32 length) -{ - A_UINT32 cid; - A_STATUS status; - A_UINT32 offset; - A_UINT32 remaining, txlen; - const A_UINT32 header = sizeof(cid) + sizeof(length); - - A_ASSERT(BMI_COMMAND_FITS(BMI_DATASZ_MAX+header)); - memset (pBMICmdBuf, 0, BMI_DATASZ_MAX+header); - - if (bmiDone) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Command disallowed\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, - ("BMI Send LZ Data: Enter (device: 0x%p, length: %d)\n", - device, length)); - - cid = BMI_LZ_DATA; - - remaining = length; - while (remaining) - { - txlen = (remaining < (BMI_DATASZ_MAX - header)) ? - remaining : (BMI_DATASZ_MAX - header); - offset = 0; - A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - A_MEMCPY(&(pBMICmdBuf[offset]), &txlen, sizeof(txlen)); - offset += sizeof(txlen); - A_MEMCPY(&(pBMICmdBuf[offset]), &buffer[length - remaining], txlen); - offset += txlen; - status = HIFExchangeBMIMsg(device, pBMICmdBuf, offset, NULL, NULL, 0); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n")); - return A_ERROR; - } - remaining -= txlen; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI LZ Data: Exit\n")); - - return A_OK; -} - -A_STATUS -BMILZStreamStart(HIF_DEVICE *device, - A_UINT32 address) -{ - A_UINT32 cid; - A_STATUS status; - A_UINT32 offset; - - A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address))); - memset (pBMICmdBuf, 0, sizeof(cid) + sizeof(address)); - - if (bmiDone) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Command disallowed\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, - ("BMI LZ Stream Start: Enter (device: 0x%p, address: 0x%x)\n", - device, address)); - - cid = BMI_LZ_STREAM_START; - offset = 0; - A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - A_MEMCPY(&(pBMICmdBuf[offset]), &address, sizeof(address)); - offset += sizeof(address); - status = HIFExchangeBMIMsg(device, pBMICmdBuf, offset, NULL, NULL, 0); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to Start LZ Stream to the device\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI LZ Stream Start: Exit\n")); - - return A_OK; -} - -A_STATUS -BMIFastDownload(HIF_DEVICE *device, A_UINT32 address, A_UCHAR *buffer, A_UINT32 length) -{ - A_STATUS status = A_ERROR; - A_UINT32 lastWord = 0; - A_UINT32 lastWordOffset = length & ~0x3; - A_UINT32 unalignedBytes = length & 0x3; - - status = BMILZStreamStart (device, address); - if (A_FAILED(status)) { - return A_ERROR; - } - - if (unalignedBytes) { - /* copy the last word into a zero padded buffer */ - A_MEMCPY(&lastWord, &buffer[lastWordOffset], unalignedBytes); - } - - status = BMILZData(device, buffer, lastWordOffset); - - if (A_FAILED(status)) { - return A_ERROR; - } - - if (unalignedBytes) { - status = BMILZData(device, (A_UINT8 *)&lastWord, 4); - } - - if (A_SUCCESS(status)) { - // - // Close compressed stream and open a new (fake) one. This serves mainly to flush Target caches. - // - status = BMILZStreamStart (device, 0x00); - if (A_FAILED(status)) { - return A_ERROR; - } - } - return status; -} - -A_STATUS -BMInvramProcess(HIF_DEVICE *device, A_UCHAR *seg_name, A_UINT32 *retval) -{ - A_UINT32 cid; - A_STATUS status; - A_UINT32 offset; - A_UINT32 retvalLen; - - A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + BMI_NVRAM_SEG_NAME_SZ)); - - if (bmiDone) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Command disallowed\n")); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, - ("BMI NVRAM Process: Enter (device: 0x%p, name: %s)\n", - device, seg_name)); - - cid = BMI_NVRAM_PROCESS; - offset = 0; - A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - A_MEMCPY(&(pBMICmdBuf[offset]), seg_name, BMI_NVRAM_SEG_NAME_SZ); - offset += BMI_NVRAM_SEG_NAME_SZ; - retvalLen = sizeof(*retval); - status = HIFExchangeBMIMsg(device, pBMICmdBuf, offset, pBMICmdBuf, &retvalLen, 0); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to access the device\n")); - return A_ERROR; - } - - A_MEMCPY(retval, pBMICmdBuf, sizeof(*retval)); - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI NVRAM Process: Exit\n")); - - return A_OK; -} - -#ifdef HIF_MESSAGE_BASED - -/* TODO.. stubs.. for message-based HIFs, the RAW access APIs need to be changed - */ - -A_STATUS -BMIRawWrite(HIF_DEVICE *device, A_UCHAR *buffer, A_UINT32 length) -{ - /* TODO */ - return A_ERROR; -} - -A_STATUS -BMIRawRead(HIF_DEVICE *device, A_UCHAR *buffer, A_UINT32 length, A_BOOL want_timeout) -{ - /* TODO */ - return A_ERROR; -} - -#endif - - diff --git a/drivers/net/wireless/ar6003/host/bmi/src/makefile b/drivers/net/wireless/ar6003/host/bmi/src/makefile deleted file mode 100644 index 1ba034c4900e..000000000000 --- a/drivers/net/wireless/ar6003/host/bmi/src/makefile +++ /dev/null @@ -1,26 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2005-2007 Atheros Corporation. All rights reserved. -# -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -#------------------------------------------------------------------------------ -#============================================================================== -# Author(s): ="Atheros" -#============================================================================== -!INCLUDE $(_MAKEENVROOT)\makefile.def - - - diff --git a/drivers/net/wireless/ar6003/host/dfs/dfs.c b/drivers/net/wireless/ar6003/host/dfs/dfs.c deleted file mode 100644 index 0b87ab42d7c8..000000000000 --- a/drivers/net/wireless/ar6003/host/dfs/dfs.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2002-2006, Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef ATH_SUPPORT_DFS -#include "dfs_host.h" -#include "dfs_common.h" - -struct ath_dfs_host *dfs_attach_host(DEV_HDL dev, OS_HDL os, ATH_DFS_CAPINFO *cap_info) -{ - int i,n; - struct ath_dfs_host *dfs; - - dfs = (struct ath_dfs_host *)DFS_MALLOC(os, sizeof(struct ath_dfs_host)); - - if (dfs == NULL) { - A_PRINTF("%s: ath_dfs allocation failed\n", __func__); - return dfs; - } - - OS_MEMZERO(dfs, sizeof (struct ath_dfs_host)); - - dfs->dev_hdl = dev; - dfs->os_hdl = os; - - dfs->dfs_debug_level=ATH_DEBUG_DFS; - - ATH_DFSQ_LOCK_INIT(dfs); - STAILQ_INIT(&dfs->dfs_radarq); - ATH_ARQ_LOCK_INIT(dfs); - STAILQ_INIT(&dfs->dfs_arq); - STAILQ_INIT(&(dfs->dfs_eventq)); - ATH_DFSEVENTQ_LOCK_INIT(dfs); - - OS_INIT_TIMER(&dfs->dfs_radar_task_timer, dfs_radar_task, dfs); - - dfs->events = (struct dfs_event *)DFS_MALLOC(os, - sizeof(struct dfs_event)*DFS_MAX_EVENTS); - - if (dfs->events == NULL) { - OS_FREE(dfs); - dfs = NULL; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS, - "%s: events allocation failed\n", __func__); - return dfs; - } - for (i=0; i< DFS_MAX_EVENTS; i++) { - STAILQ_INSERT_TAIL(&(dfs->dfs_eventq), &dfs->events[i], re_list); - } - - dfs->pulses = (struct dfs_pulseline *)DFS_MALLOC(os, sizeof(struct dfs_pulseline)); - - if (dfs->pulses == NULL) { - OS_FREE(dfs->events); - dfs->events = NULL; - OS_FREE(dfs); - dfs = NULL; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS, - "%s: pulse buffer allocation failed\n", __func__); - return dfs; - } - - dfs->pulses->pl_lastelem = DFS_MAX_PULSE_BUFFER_MASK; - -#ifdef ATH_ENABLE_AR - if(cap_info->enable_ar){ - dfs_reset_ar(dfs); - dfs_reset_arq(dfs); - dfs->dfs_proc_phyerr |= DFS_AR_EN; - } -#endif /* ATH_ENABLE_AR */ - - if(cap_info->enable_radar) { - /* Allocate memory for radar filters */ - for (n=0; ndfs_radarf[n] = (struct dfs_filtertype *)DFS_MALLOC(os, sizeof(struct dfs_filtertype)); - if (dfs->dfs_radarf[n] == NULL) { - DFS_DPRINTK(dfs,ATH_DEBUG_DFS, - "%s: cannot allocate memory for radar filter types\n", - __func__); - goto bad1; - } - } - /* Allocate memory for radar table */ - dfs->dfs_radartable = (int8_t **)DFS_MALLOC(os, 256*sizeof(int8_t *)); - if (dfs->dfs_radartable == NULL) { - DFS_DPRINTK(dfs, ATH_DEBUG_DFS, "%s: cannot allocate memory for radar table\n", - __func__); - goto bad1; - } - for (n=0; n<256; n++) { - dfs->dfs_radartable[n] = DFS_MALLOC(os, DFS_MAX_RADAR_OVERLAP*sizeof(int8_t)); - if (dfs->dfs_radartable[n] == NULL) { - DFS_DPRINTK(dfs, ATH_DEBUG_DFS, - "%s: cannot allocate memory for radar table entry\n", - __func__); - goto bad2; - } - } - - /* Init the Bin5 chirping related data */ - dfs->dfs_rinfo.dfs_bin5_chirp_ts = cap_info->ext_chan_busy_ts; - dfs->dfs_rinfo.dfs_last_bin5_dur = MAX_BIN5_DUR; - - dfs->dfs_b5radars = NULL; - } - - return dfs; - -bad2: - OS_FREE(dfs->dfs_radartable); - dfs->dfs_radartable = NULL; -bad1: - for (n=0; ndfs_radarf[n] != NULL) { - OS_FREE(dfs->dfs_radarf[n]); - dfs->dfs_radarf[n] = NULL; - } - } - if (dfs->pulses) { - OS_FREE(dfs->pulses); - dfs->pulses = NULL; - } - if (dfs->events) { - OS_FREE(dfs->events); - dfs->events = NULL; - } - - return dfs; - -} - -void -dfs_detach_host(struct ath_dfs_host *dfs) -{ - int n, empty; - - if (dfs == NULL) { - A_PRINTF("%s: sc_dfs is NULL\n", __func__); - return; - } - - OS_CANCEL_TIMER(&dfs->dfs_radar_task_timer); - - /* Return radar events to free q*/ - dfs_reset_radarq(dfs); - dfs_reset_alldelaylines(dfs); - - /* Free up pulse log*/ - if (dfs->pulses != NULL) { - OS_FREE(dfs->pulses); - dfs->pulses = NULL; - } - - for (n=0; ndfs_radarf[n] != NULL) { - OS_FREE(dfs->dfs_radarf[n]); - dfs->dfs_radarf[n] = NULL; - } - } - - - if (dfs->dfs_radartable != NULL) { - for (n=0; n<256; n++) { - if (dfs->dfs_radartable[n] != NULL) { - OS_FREE(dfs->dfs_radartable[n]); - dfs->dfs_radartable[n] = NULL; - } - } - OS_FREE(dfs->dfs_radartable); - dfs->dfs_radartable = NULL; - } - - if (dfs->dfs_b5radars != NULL) { - OS_FREE(dfs->dfs_b5radars); - dfs->dfs_b5radars=NULL; - } - - dfs_reset_ar(dfs); - - ATH_ARQ_LOCK(dfs); - empty = STAILQ_EMPTY(&(dfs->dfs_arq)); - ATH_ARQ_UNLOCK(dfs); - if (!empty) { - dfs_reset_arq(dfs); - } - if (dfs->events != NULL) { - OS_FREE(dfs->events); - dfs->events = NULL; - } - OS_FREE(dfs); - dfs = NULL; -} - - -void dfs_bangradar_enable(struct ath_dfs_host *dfs, u_int8_t enable) -{ - dfs->dfs_bangradar = enable; -} - -void dfs_set_dur_multiplier(struct ath_dfs_host *dfs, u_int32_t dur_multiplier) -{ - dfs->dur_multiplier = dur_multiplier; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS3, - "%s: duration multiplier is %d\n", __func__, dfs->dur_multiplier); -} - -void dfs_set_debug_level_host(struct ath_dfs_host *dfs, u_int32_t level) -{ - dfs->dfs_debug_level = level; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS3, - "%s: debug level is %d\n", __func__, dfs->dfs_debug_level); - -} - -#endif /* ATH_UPPORT_DFS */ diff --git a/drivers/net/wireless/ar6003/host/dfs/dfs_ar.c b/drivers/net/wireless/ar6003/host/dfs/dfs_ar.c deleted file mode 100644 index 143606519326..000000000000 --- a/drivers/net/wireless/ar6003/host/dfs/dfs_ar.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (c) 2002-2010, Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef ATH_SUPPORT_DFS -#include "dfs_host.h" - -#define UPDATE_TOP_THREE_PEAKS(_histo, _peakPtrList, _currWidth) { \ - if ((_histo)[(_peakPtrList)[0]] < (_histo)[(_currWidth)]) { \ - (_peakPtrList)[2] = (_currWidth != (_peakPtrList)[1]) ? \ - (_peakPtrList)[1] : (_peakPtrList)[2]; \ - (_peakPtrList)[1] = (_peakPtrList)[0]; \ - (_peakPtrList)[0] = (_currWidth); \ - } else if ((_currWidth != (_peakPtrList)[0]) \ - && ((_histo)[(_peakPtrList)[1]] < (_histo)[(_currWidth)])) { \ - (_peakPtrList)[2] = (_peakPtrList)[1]; \ - (_peakPtrList)[1] = (_currWidth); \ - } else if ((_currWidth != (_peakPtrList)[1]) \ - && (_currWidth != (_peakPtrList)[0]) \ - && ((_histo)[(_peakPtrList)[2]] < (_histo)[(_currWidth)])) { \ - (_peakPtrList)[2] = (_currWidth); \ - } \ -} - - - -u_int32_t dfs_process_ar_event(struct ath_dfs_host *dfs) -{ - struct dfs_ar_state *ar; - struct dfs_event *re=NULL; - u_int32_t sumpeak=0,numpeaks,rssi,width,origregionsum=0, i; - u_int16_t thistimestamp; - int empty; - u_int32_t result = 0; - - if (dfs == NULL) { - A_PRINTF("%s: sc_dfs is NULL\n", __func__); - return result; - } - ar = (struct dfs_ar_state *) &(dfs->dfs_ar_state); - ATH_ARQ_LOCK(dfs); - empty = STAILQ_EMPTY(&(dfs->dfs_arq)); - ATH_ARQ_UNLOCK(dfs); - while (!empty) { - ATH_ARQ_LOCK(dfs); - re = STAILQ_FIRST(&(dfs->dfs_arq)); - if (re != NULL) - STAILQ_REMOVE_HEAD(&(dfs->dfs_arq), re_list); - ATH_ARQ_UNLOCK(dfs); - if (re == NULL) - return result; - - thistimestamp = re->re_ts; - rssi = re->re_rssi; - width = re->re_dur; - - /* Return the dfs event to the free event list */ - OS_MEMZERO(re, sizeof(struct dfs_event)); - ATH_DFSEVENTQ_LOCK(dfs); - STAILQ_INSERT_TAIL(&(dfs->dfs_eventq), re, re_list); - ATH_DFSEVENTQ_UNLOCK(dfs); - - /* determine if current radar is an extension of previous radar */ - if (ar->ar_prevwidth == 255) { - /* tag on previous width for consideraion of low data rate ACKs */ - ar->ar_prevwidth += width; - width = (width == 255) ? 255 : ar->ar_prevwidth; - } else if ((width == 255) && - (ar->ar_prevwidth == 510 || - ar->ar_prevwidth == 765 || - ar->ar_prevwidth == 1020)) { - /* Aggregate up to 5 consecuate max radar widths - * to consider 11Mbps long preamble 1500-byte pkts - */ - ar->ar_prevwidth += width; - } else if (ar->ar_prevwidth == 1275 && width != 255) { - /* Found 5th consecute maxed out radar, reset history */ - width += ar->ar_prevwidth; - ar->ar_prevwidth = 0; - } else if (ar->ar_prevwidth > 255) { - /* Ignore if there are less than 5 consecutive maxed out radars */ - ar->ar_prevwidth = width; - width = 255; - } else { - ar->ar_prevwidth = width; - } - /* For ignoring noises with radar duration in ranges of 3-30: AP4x */ - if ((width >= 257 && width <= 278) || /* Region 7 - 5.5Mbps (long pre) ACK = 270 = 216 us */ - (width >= 295 && width <= 325) || /* Region 8 - 2Mbps (long pre) ACKC = 320 = 256us */ - (width >= 1280 && width <= 1300)) { - u_int16_t wraparoundadj=0; - u_int16_t base = (width >= 1280) ? 1275 : 255; - if (thistimestamp < ar->ar_prevtimestamp) { - wraparoundadj = 32768; - } - if ((thistimestamp + wraparoundadj - ar->ar_prevtimestamp) != - (width - base)) { - width = 1; - } - } - if (width <= 10) { - ATH_ARQ_LOCK(dfs); - empty = STAILQ_EMPTY(&(dfs->dfs_arq)); - ATH_ARQ_UNLOCK(dfs); - continue; - } - /* - * Overloading the width=2 in: Store a count of radars w/max duration - * and high RSSI (not noise) - */ - if ((width == 255) && (rssi > DFS_AR_RSSI_THRESH_STRONG_PKTS)) - width = 2; - /* - * Overloading the width=3 bin: - * Double and store a count of rdars of durtaion that matches 11Mbps (long preamble) - * TCP ACKs or 1500-byte data packets - */ - if ((width >= 1280 && width <= 1300) || - (width >= 318 && width <= 325)) { - width = 3; - ar->ar_phyerrcount[3] += 2; - ar->ar_acksum += 2; - } - /* build histogram of radar duration */ - if (width > 0 && width <= 510) - ar->ar_phyerrcount[width]++; - else { - /* invalid radar width, throw it away */ - ATH_ARQ_LOCK(dfs); - empty = STAILQ_EMPTY(&(dfs->dfs_arq)); - ATH_ARQ_UNLOCK(dfs); - continue; - } - /* Received radar of interest (i.e., signature match), proceed to check if - * there is enough neighboring traffic to drop out of Turbo - */ - if ((width >= 33 && width <= 38) || /* Region 0: 24Mbps ACK = 35 = 28us */ - (width >= 39 && width <= 44) || /* Region 1: 12Mbps ACK = 40 = 32us */ - (width >= 53 && width <= 58) || /* Region 2: 6Mbps ACK = 55 = 44us */ - (width >= 126 && width <= 140) || /* Region 3: 11Mbps ACK = 135 = 108us */ - (width >= 141 && width <= 160) || /* Region 4: 5.5Mbps ACK = 150 = 120us */ - (width >= 189 && width <= 210) || /* Region 5: 2Mbps ACK = 200 = 160us */ - (width >= 360 && width <= 380) || /* Region 6 1Mbps ACK = 400 = 320us */ - (width >= 257 && width <= 270) || /* Region 7 5.5Mbps (Long Pre) ACK = 270 = 216us */ - (width >= 295 && width <= 302) || /* Region 8 2Mbps (Long Pre) ACK = 320 = 256us */ - /* Ignoring Region 9 due to overlap with 255 which is same as board noise */ - /* Region 9 11Mbps (Long Pre) ACK = 255 = 204us */ - (width == 3)) { - ar->ar_acksum++; - /* double the count for strong radars that match one of the ACK signatures */ - if (rssi > DFS_AR_RSSI_DOUBLE_THRESHOLD) { - ar->ar_phyerrcount[width]++; - ar->ar_acksum++; - } - UPDATE_TOP_THREE_PEAKS(ar->ar_phyerrcount, - ar->ar_peaklist, width); - /* sum the counts of these peaks */ - numpeaks = DFS_AR_MAX_NUM_PEAKS; - origregionsum = ar->ar_acksum; - for (i=0; i<= DFS_AR_MAX_NUM_PEAKS; i++) { - if (ar->ar_peaklist[i] > 0) { - if ((i==0) && - (ar->ar_peaklist[i] == 3) && - (ar->ar_phyerrcount[3] < - ar->ar_phyerrcount[2]) && - (ar->ar_phyerrcount[3] > 6)) { - /* - * If the top peak is one that - * maches the 11Mbps long - * preamble TCP Ack/1500-byte - * data, include the count for - * radars that hav emax - * duration and high rssi - * (width = 2) to boost the - * sum for the PAR test that - * follows */ - sumpeak += (ar->ar_phyerrcount[2] - + ar->ar_phyerrcount[3]); - ar->ar_acksum += (ar->ar_phyerrcount[2] - + ar->ar_phyerrcount[3]); - } else { - sumpeak += ar->ar_phyerrcount[ar->ar_peaklist[i]]; - } - } else - numpeaks--; - } - /* - * If sum of patterns matches exceeds packet threshold, - * perform comparison between peak-to-avg ratio against parThreshold - */ - if ((ar->ar_acksum > ar->ar_packetthreshold) && - ((sumpeak * DFS_AR_REGION_WIDTH) > (ar->ar_parthreshold * numpeaks * - ar->ar_acksum))) { - /* neighboring traffic detected, get out of Turbo */ - result = TRAFFIC_DETECTED; - OS_MEMZERO(ar->ar_peaklist, sizeof(ar->ar_peaklist)); - ar->ar_acksum = 0; - OS_MEMZERO(ar->ar_phyerrcount, sizeof(ar->ar_phyerrcount)); - } else { - /* - * reset sum of matches to discount the count of - * strong radars with max duration - */ - ar->ar_acksum = origregionsum; - } - } - ar->ar_prevtimestamp = thistimestamp; - ATH_ARQ_LOCK(dfs); - empty = STAILQ_EMPTY(&(dfs->dfs_arq)); - ATH_ARQ_UNLOCK(dfs); - } - return result; -} - -void dfs_reset_ar(struct ath_dfs_host *dfs) -{ - - if (dfs == NULL) { - A_PRINTF("%s: sc_dfs is NULL\n", __func__); - return; - } - OS_MEMZERO(&dfs->dfs_ar_state, sizeof(dfs->dfs_ar_state)); - dfs->dfs_ar_state.ar_packetthreshold = DFS_AR_PKT_COUNT_THRESH; - dfs->dfs_ar_state.ar_parthreshold = DFS_AR_ACK_DETECT_PAR_THRESH; - dfs->dfs_ar_state.ar_radarrssi = DFS_AR_RADAR_RSSI_THR; - -} - -void dfs_reset_arq(struct ath_dfs_host *dfs) -{ - struct dfs_event *event; - - if (dfs == NULL) { - A_PRINTF("%s: sc_dfs is NULL\n", __func__); - return; - } - ATH_ARQ_LOCK(dfs); - ATH_DFSEVENTQ_LOCK(dfs); - while (!STAILQ_EMPTY(&(dfs->dfs_arq))) { - event = STAILQ_FIRST(&(dfs->dfs_arq)); - STAILQ_REMOVE_HEAD(&(dfs->dfs_arq), re_list); - OS_MEMZERO(event, sizeof(struct dfs_event)); - STAILQ_INSERT_TAIL(&(dfs->dfs_eventq), event, re_list); - } - ATH_DFSEVENTQ_UNLOCK(dfs); - ATH_ARQ_UNLOCK(dfs); -} - - -#endif /* ATH_SUPPORT_DFS */ diff --git a/drivers/net/wireless/ar6003/host/dfs/dfs_bindetects.c b/drivers/net/wireless/ar6003/host/dfs/dfs_bindetects.c deleted file mode 100644 index d2582f9c3efd..000000000000 --- a/drivers/net/wireless/ar6003/host/dfs/dfs_bindetects.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright (c) 2002-2010, Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef ATH_SUPPORT_DFS -#include "dfs_host.h" - -int dfs_bin_fixedpattern_check(struct ath_dfs_host *dfs, struct dfs_filter *rf, u_int32_t dur, int ext_chan_flag, u_int32_t ext_chan_busy) -{ - struct dfs_pulseline *pl = dfs->pulses; - int i, n, refpri, primargin, numpulses=0; - u_int64_t start_ts, end_ts, event_ts, prev_event_ts, next_event_ts, window_start, window_end; - u_int32_t index, next_index, deltadur; - - /* For fixed pattern types, rf->rf_patterntype=1*/ - primargin = dfs_get_pri_margin(ext_chan_flag, (rf->rf_patterntype==1),dfs->dfs_rinfo.rn_lastfull_ts, ext_chan_busy); - - refpri = (rf->rf_minpri + rf->rf_maxpri)/2; - index = pl->pl_lastelem; - end_ts = pl->pl_elems[index].p_time; - start_ts = end_ts - (refpri*rf->rf_numpulses); - - DFS_DPRINTK(dfs, ATH_DEBUG_DFS3, "lastelem ts=%llu start_ts=%llu, end_ts=%llu\n", (unsigned long long)pl->pl_elems[index].p_time, (unsigned long long)start_ts, (unsigned long long)end_ts); - /* find the index of first element in our window of interest */ - for(i=0;ipl_numelems;i++) { - index = (index-1) & DFS_MAX_PULSE_BUFFER_MASK; - if(pl->pl_elems[index].p_time >= start_ts ) - continue; - else { - index = (index) & DFS_MAX_PULSE_BUFFER_MASK; - break; - } - } - for (n=0;n<=rf->rf_numpulses; n++) { - window_start = (start_ts + (refpri*n))-(primargin+n); - window_end = window_start + 2*(primargin+n); - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, - "window_start %u window_end %u \n", - (u_int32_t)window_start, (u_int32_t)window_end); - for(i=0;ipl_numelems;i++) { - prev_event_ts = pl->pl_elems[index].p_time; - index = (index+1) & DFS_MAX_PULSE_BUFFER_MASK; - event_ts = pl->pl_elems[index].p_time; - next_index = (index+1) & DFS_MAX_PULSE_BUFFER_MASK; - next_event_ts = pl->pl_elems[next_index].p_time; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, - "ts %u \n", (u_int32_t)event_ts); - if( (event_ts <= window_end) && (event_ts >= window_start)){ - deltadur = DFS_DIFF(pl->pl_elems[index].p_dur, dur); - if( (pl->pl_elems[index].p_dur == 1) || - ((dur != 1) && (deltadur <= 2))) { - numpulses++; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, - "numpulses %u \n", numpulses); - break; - } - } - else if( event_ts > window_end) { - index = (index-1) & DFS_MAX_PULSE_BUFFER_MASK; - break; - } - else if( event_ts == prev_event_ts) { - if( ((next_event_ts - event_ts) > refpri) || - ((next_event_ts - event_ts) == 0)) { - deltadur = DFS_DIFF(pl->pl_elems[index].p_dur, dur); - if( (pl->pl_elems[index].p_dur == 1) || - ((pl->pl_elems[index].p_dur != 1) && (deltadur <= 2))) { - numpulses++; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, - "zero PRI: numpulses %u \n", numpulses); - break; - } - } - } - } - } - if (numpulses >= dfs_get_filter_threshold(rf, ext_chan_flag, dfs->dfs_rinfo.rn_lastfull_ts, ext_chan_busy)) { - DFS_DPRINTK(dfs, ATH_DEBUG_DFS1, "%s FOUND filterID=%u numpulses=%d unadj thresh=%d\n", __func__, rf->rf_pulseid, numpulses, rf->rf_threshold); - return 1; - } - else - return 0; -} - -void -dfs_add_pulse(struct ath_dfs_host *dfs, struct dfs_filter *rf, struct dfs_event *re, - u_int32_t deltaT) -{ - u_int32_t index,n, window, pri; - struct dfs_delayline *dl; - - dl = &rf->rf_dl; - /* Circular buffer of size 2^n */ - index = (dl->dl_lastelem + 1) & DFS_MAX_DL_MASK; - //if ((dl->dl_numelems+1) == DFS_MAX_DL_SIZE) - if ((dl->dl_numelems) == DFS_MAX_DL_SIZE) - dl->dl_firstelem = (dl->dl_firstelem + 1) & DFS_MAX_DL_MASK; - else - dl->dl_numelems++; - dl->dl_lastelem = index; - dl->dl_elems[index].de_time = deltaT; - window = deltaT; - dl->dl_elems[index].de_dur = re->re_dur; - dl->dl_elems[index].de_rssi = re->re_rssi; - - for (n=0;ndl_numelems-1; n++) { - index = (index-1) & DFS_MAX_DL_MASK; - pri = dl->dl_elems[index].de_time; - window += pri; - if (window > rf->rf_filterlen) { - dl->dl_firstelem = (index+1) & DFS_MAX_DL_MASK; - dl->dl_numelems = n+1; - } - } - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, - "dl firstElem = %d lastElem = %d\n",dl->dl_firstelem, - dl->dl_lastelem); -} - - -int dfs_bin_check(struct ath_dfs_host *dfs, struct dfs_filter *rf, - u_int32_t deltaT, u_int32_t width, int ext_chan_flag, u_int32_t ext_chan_busy) -{ - u_int32_t refpri, refdur, searchpri, deltapri, averagerefpri; - u_int32_t n, i, primargin, durmargin, highscore, highscoreindex; - int score[DFS_MAX_DL_SIZE], delayindex, dindex, found=0; - struct dfs_delayline *dl; - u_int32_t scoreindex, lowpriindex= 0, lowpri = 0xffff; - int numpulses=0; - - dl = &rf->rf_dl; - if( dl->dl_numelems < (rf->rf_threshold-1)) { - return 0; - } - if( deltaT > rf->rf_filterlen) - return 0; - - primargin = dfs_get_pri_margin(ext_chan_flag, (rf->rf_patterntype==1), - dfs->dfs_rinfo.rn_lastfull_ts, ext_chan_busy); - - - if(rf->rf_maxdur < 10) { - durmargin = 4; - } - else { - durmargin = 6; - } - - if( rf->rf_patterntype == 1 ){ - found = dfs_bin_fixedpattern_check(dfs, rf, width, ext_chan_flag, ext_chan_busy); - if(found) { - dl->dl_numelems = 0; - } - return found; - } - - OS_MEMZERO(score, sizeof(int)*DFS_MAX_DL_SIZE); - /* find out the lowest pri */ - for (n=0;ndl_numelems; n++) { - delayindex = (dl->dl_firstelem + n) & DFS_MAX_DL_MASK; - refpri = dl->dl_elems[delayindex].de_time; - if( refpri == 0) - continue; - else if(refpri < lowpri) { - lowpri = dl->dl_elems[delayindex].de_time; - lowpriindex = n; - } - } - /* find out the each delay element's pri score */ - for (n=0;ndl_numelems; n++) { - delayindex = (dl->dl_firstelem + n) & DFS_MAX_DL_MASK; - refpri = dl->dl_elems[delayindex].de_time; - if( refpri == 0) - continue; - for (i=0;idl_numelems; i++) { - dindex = (dl->dl_firstelem + i) & DFS_MAX_DL_MASK; - searchpri = dl->dl_elems[dindex].de_time; - deltapri = DFS_DIFF(searchpri, refpri); - if( deltapri < primargin) - score[n]++; - } - if( score[n] > rf->rf_threshold) { - /* we got the most possible candidate, - * no need to continue further */ - break; - } - } - /* find out the high scorer */ - highscore = 0; - highscoreindex = 0; - for (n=0;ndl_numelems; n++) { - if( score[n] > highscore) { - highscore = score[n]; - highscoreindex = n; - } - else if( score[n] == highscore ) { - /*more than one pri has highscore take the least pri */ - delayindex = (dl->dl_firstelem + highscoreindex) & DFS_MAX_DL_MASK; - dindex = (dl->dl_firstelem + n) & DFS_MAX_DL_MASK; - if( dl->dl_elems[dindex].de_time <= - dl->dl_elems[delayindex].de_time ) { - highscoreindex = n; - } - } - } - /* find the average pri of pulses around the pri of highscore or - * the pulses around the lowest pri */ - if( highscore < 3) { - scoreindex = lowpriindex; - } - else { - scoreindex = highscoreindex; - } - /* We got the possible pri, save its parameters as reference */ - delayindex = (dl->dl_firstelem + scoreindex) & DFS_MAX_DL_MASK; - refdur = dl->dl_elems[delayindex].de_dur; - refpri = dl->dl_elems[delayindex].de_time; - averagerefpri = 0; - - numpulses = dfs_bin_pri_check(dfs, rf, dl, score[scoreindex], refpri, refdur, ext_chan_flag, ext_chan_busy); - if (numpulses >= dfs_get_filter_threshold(rf, ext_chan_flag, dfs->dfs_rinfo.rn_lastfull_ts, ext_chan_busy)) { - found = 1; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS1, "ext_flag=%d MATCH filter=%u numpulses=%u thresh=%u refpri=%d primargin=%d\n", ext_chan_flag, rf->rf_pulseid, numpulses,rf->rf_threshold, refpri, primargin); - dfs_print_delayline(dfs, &rf->rf_dl); - dfs_print_filter(dfs, rf); - } - return found; -} - -int dfs_bin_pri_check(struct ath_dfs_host *dfs, struct dfs_filter *rf, - struct dfs_delayline *dl, u_int32_t score, - u_int32_t refpri, u_int32_t refdur, int ext_chan_flag, u_int32_t ext_chan_busy) -{ - u_int32_t searchpri, searchdur, searchrssi, deltapri, deltadur, averagerefpri=0; - int primultiples[6]; - int delayindex, dindex; - u_int32_t i, j, primargin, durmargin, highscore=score, highscoreindex=0; - int numpulses=1; //first pulse in the burst is most likely being filtered out based on maxfilterlen - - //Use the adjusted PRI margin to reduce false alarms - /* For non fixed pattern types, rf->rf_patterntype=0*/ - primargin = dfs_get_pri_margin(ext_chan_flag, (rf->rf_patterntype==1), - dfs->dfs_rinfo.rn_lastfull_ts, ext_chan_busy); - - - if(rf->rf_maxdur < 10) { - durmargin = 4; - } - else { - durmargin = 6; - } - if( score > 1) { - for (i=0;idl_numelems; i++) { - dindex = (dl->dl_firstelem + i) & DFS_MAX_DL_MASK; - searchpri = dl->dl_elems[dindex].de_time; - deltapri = DFS_DIFF(searchpri, refpri); - if( deltapri < primargin) - averagerefpri += searchpri; - } - refpri = (averagerefpri/score); //average - } - /* Note: Following primultiple calculation should be done once per filter - * during initialization stage (dfs_attach) and stored in its array - * atleast for fixed frequency types like FCC Bin1 to save some CPU cycles. - * multiplication, devide operators in the following code are left as it is - * for readability hoping the complier will use left/right shifts wherever possible - */ - if( refpri > rf->rf_maxpri) { - primultiples[0] = (refpri - refdur)/2; - primultiples[1] = refpri; - primultiples[2] = refpri + primultiples[0]; - primultiples[3] = (refpri - refdur)*2; - primultiples[4] = primultiples[3] + primultiples[0]; - primultiples[5] = primultiples[3] + refpri; - } - else { - primultiples[0] = refpri; - primultiples[1] = refpri + primultiples[0]; - primultiples[2] = refpri + primultiples[1]; - primultiples[3] = refpri + primultiples[2]; - primultiples[4] = refpri + primultiples[3]; - primultiples[5] = refpri + primultiples[4]; - } - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, - "pri0 = %d pri1 = %d pri2 = %d pri3 = %d pri4 = %d pri5 = %d\n", - primultiples[0], primultiples[1], primultiples[2], - primultiples[3], primultiples[4], primultiples[5]); - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, - "refpri = %d high score = %d index = %d numpulses = %d\n", - refpri, highscore, highscoreindex, numpulses); - /* Count the other delay elements that have pri and dur with in the - * acceptable range from the reference one */ - for (i=0; idl_numelems; i++) { - delayindex = (dl->dl_firstelem + i) & DFS_MAX_DL_MASK; - searchpri = dl->dl_elems[delayindex].de_time; - if( searchpri == 0) { - /* This events PRI is zero, take it as a - * valid pulse but decrement next event's PRI by refpri - */ - dindex = (delayindex+1)& DFS_MAX_DL_MASK; - dl->dl_elems[dindex].de_time -= refpri; - searchpri = refpri; - } - searchdur = dl->dl_elems[delayindex].de_dur; - searchrssi = dl->dl_elems[delayindex].de_rssi; - deltadur = DFS_DIFF(searchdur, refdur); - for(j=0; j<6; j++) { - deltapri = DFS_DIFF(searchpri, primultiples[j]); - /* May need to revisit this as this increases the primargin by 5*/ - /* if( deltapri < (primargin+j)) { */ - if( deltapri < (primargin)) { - if( deltadur < durmargin) { - if( (refdur < 8) || ((refdur >=8)&& - (searchrssi < 250))) { - - numpulses++; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, - "rf->minpri=%d rf->maxpri=%d searchpri = %d index = %d numpulses = %d deltapri=%d j=%d\n", - rf->rf_minpri, rf->rf_maxpri, searchpri, i, numpulses, deltapri, j); - } - } - break; - } - } - } - return numpulses; -} -#endif /* ATH_SUPPORT_DFS */ diff --git a/drivers/net/wireless/ar6003/host/dfs/dfs_debug.c b/drivers/net/wireless/ar6003/host/dfs/dfs_debug.c deleted file mode 100644 index 40eb11a53505..000000000000 --- a/drivers/net/wireless/ar6003/host/dfs/dfs_debug.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2002-2010, Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef ATH_SUPPORT_DFS -#include "dfs_host.h" - -void -dfs_print_delayline(struct ath_dfs_host *dfs, struct dfs_delayline *dl) -{ - int i=0,index; - struct dfs_delayelem *de; - - index = dl->dl_lastelem; - for (i=0; idl_numelems; i++) { - de = &dl->dl_elems[index]; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, - "Elem %d: ts = %u (0x%x) dur=%u\n",i, - de->de_time, de->de_time, de->de_dur); - index = (index - 1)& DFS_MAX_DL_MASK; - } -} - - -void -dfs_print_filter(struct ath_dfs_host *dfs, struct dfs_filter *rf) -{ - DFS_DPRINTK(dfs, ATH_DEBUG_DFS1, "filterID[%d] rf_numpulses=%u; rf->rf_minpri=%u; rf->rf_maxpri=%u; rf->rf_threshold=%u; rf->rf_filterlen=%u; rf->rf_mindur=%u; rf->rf_maxdur=%u\n", rf->rf_pulseid, rf->rf_numpulses, rf->rf_minpri, rf->rf_maxpri, rf->rf_threshold, rf->rf_filterlen, rf->rf_mindur, rf->rf_maxdur); -} - - -void -dfs_print_filters(struct ath_dfs_host *dfs) -{ - struct dfs_filtertype *ft = NULL; - struct dfs_filter *rf; - int i,j; - - if (dfs == NULL) { - A_PRINTF("%s: sc_dfs is NULL\n", __func__); - return; - } - for (i=0; idfs_radarf[i] != NULL) { - ft = dfs->dfs_radarf[i]; - if((ft->ft_numfilters > DFS_MAX_NUM_RADAR_FILTERS) || (!ft->ft_numfilters)) - continue; - printk("===========ft->ft_numfilters=%u===========\n", ft->ft_numfilters); - for (j=0; jft_numfilters; j++) { - rf = &(ft->ft_filters[j]); - printk("filter[%d] filterID = %d rf_numpulses=%u; rf->rf_minpri=%u; rf->rf_maxpri=%u; rf->rf_threshold=%u; rf->rf_filterlen=%u; rf->rf_mindur=%u; rf->rf_maxdur=%u\n",j, rf->rf_pulseid, - rf->rf_numpulses, rf->rf_minpri, rf->rf_maxpri, rf->rf_threshold, rf->rf_filterlen, rf->rf_mindur, rf->rf_maxdur); - } - } - } -} - - -#endif /* ATH_SUPPORT_DFS */ diff --git a/drivers/net/wireless/ar6003/host/dfs/dfs_fcc_bin5.c b/drivers/net/wireless/ar6003/host/dfs/dfs_fcc_bin5.c deleted file mode 100644 index 07d42367a6fc..000000000000 --- a/drivers/net/wireless/ar6003/host/dfs/dfs_fcc_bin5.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2002-2010, Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef ATH_SUPPORT_DFS -#include "dfs_host.h" - - -int dfs_bin5_addpulse(struct ath_dfs_host *dfs, struct dfs_bin5radars *br, - struct dfs_event *re, u_int64_t thists) -{ - u_int32_t index,stop; - u_int64_t tsDelta; - - /* Check if this pulse is a valid pulse in terms of repetition, - * if not, return without adding it to the queue. - * PRI : Pulse Repitetion Interval - * BRI : Burst Repitetion Interval */ - if( br->br_numelems != 0){ - index = br->br_lastelem; - tsDelta = thists - br->br_elems[index].be_ts; - if( (tsDelta < DFS_BIN5_PRI_LOWER_LIMIT) || - ( (tsDelta > DFS_BIN5_PRI_HIGHER_LIMIT) && - (tsDelta < DFS_BIN5_BRI_LOWER_LIMIT))) { - return 0; - } - } - /* Circular buffer of size 2^n */ - index = (br->br_lastelem +1) & DFS_MAX_B5_MASK; - br->br_lastelem = index; - if (br->br_numelems == DFS_MAX_B5_SIZE) - br->br_firstelem = (br->br_firstelem+1)&DFS_MAX_B5_MASK; - else - br->br_numelems++; - br->br_elems[index].be_ts = thists; - br->br_elems[index].be_rssi = re->re_rssi; - br->br_elems[index].be_dur = re->re_dur; - stop = 0; - index = br->br_firstelem; - while ((!stop) && (br->br_numelems-1) > 0) { - if ((thists - br->br_elems[index].be_ts) > - ((u_int64_t) br->br_pulse.b5_timewindow)) { - br->br_numelems--; - br->br_firstelem = (br->br_firstelem +1) & DFS_MAX_B5_MASK; - index = br->br_firstelem; - } else - stop = 1; - } - return 1; -} - -/* - * If the dfs structure is NULL (which should be illegal if everyting is working - * properly, then signify that a bin5 radar was found - */ - -int dfs_bin5_check(struct ath_dfs_host *dfs) -{ - struct dfs_bin5radars *br; - int index[DFS_MAX_B5_SIZE]; - u_int32_t n, i, this, prev, rssi_diff, width_diff, bursts= 0; - u_int32_t total_diff=0, average_diff, total_width=0, average_width, numevents=0; - u_int64_t pri; - - if (dfs == NULL) { - A_PRINTF("%s: sc_dfs is NULL\n", __func__); - return 1; - } - for (n=0;ndfs_rinfo.rn_numbin5radars; n++) { - br = &(dfs->dfs_b5radars[n]); - DFS_DPRINTK(dfs, ATH_DEBUG_DFS1, - "Num elems = %d\n", br->br_numelems); - prev = br->br_firstelem; - for(i=0;ibr_numelems;i++){ - this = ((br->br_firstelem +i) & DFS_MAX_B5_MASK); - /* Rule 1: 1000 <= PRI <= 2000 + some margin */ - if( br->br_elems[this].be_ts >= br->br_elems[prev].be_ts ) { - pri = br->br_elems[this].be_ts - br->br_elems[prev].be_ts; - } - else {//roll over case - //pri = (0xffffffffffffffff - br->br_elems[prev].be_ts) + br->br_elems[this].be_ts; - pri = br->br_elems[this].be_ts; - } - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2," pri=%llu this.ts=%llu prev.ts=%llu\n", pri, br->br_elems[this].be_ts, br->br_elems[prev].be_ts); - if(( (pri >= DFS_BIN5_PRI_LOWER_LIMIT) && (pri <= DFS_BIN5_PRI_HIGHER_LIMIT))) { //pri: pulse repitition interval in us - /* Rule 2: pulse width of the pulses in the burst should be same (+/- margin) */ - if( br->br_elems[this].be_dur >= br->br_elems[prev].be_dur) { - width_diff = br->br_elems[this].be_dur - br->br_elems[prev].be_dur; - } - else { - width_diff = br->br_elems[prev].be_dur - br->br_elems[this].be_dur; - } - if( width_diff <= DFS_BIN5_WIDTH_MARGIN ) { - /* Rule 3: RSSI of the pulses in the burst should be same (+/- margin) */ - if( br->br_elems[this].be_rssi >= br->br_elems[prev].be_rssi) { - rssi_diff = br->br_elems[this].be_rssi - br->br_elems[prev].be_rssi; - } - else { - rssi_diff = br->br_elems[prev].be_rssi - br->br_elems[this].be_rssi; - } - if( rssi_diff <= DFS_BIN5_RSSI_MARGIN ) { - bursts++; - /* Save the indexes of this pair for later width variance check */ - if( numevents >= 2 ) { - /* make sure the event is not duplicated, - * possible in a 3 pulse burst */ - if( index[numevents-1] != prev) { - index[numevents++] = prev; - } - } - else { - index[numevents++] = prev; } - index[numevents++] = this; - } else { - DFS_DPRINTK(dfs,ATH_DEBUG_DFS2,"%s %d Bin5 rssi_diff=%d\n", __func__, __LINE__, rssi_diff); - } - } else { - DFS_DPRINTK(dfs,ATH_DEBUG_DFS2,"%s %d Bin5 width_diff=%d\n", __func__, __LINE__, width_diff); - } - } else { - DFS_DPRINTK(dfs,ATH_DEBUG_DFS2,"%s %d Bin5 PRI check fail pri=%llu\n", __func__, __LINE__,pri); - } - prev = this; - } - - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, "bursts=%u numevents=%u\n", bursts, numevents); - if ( bursts >= br->br_pulse.b5_threshold) { - if( (br->br_elems[br->br_lastelem].be_ts - br->br_elems[br->br_firstelem].be_ts) < 3000000 ) { - return 0; - } - else { - for (i=0; ibr_elems[index[i]].be_dur; - } - average_width = total_width/numevents; - for (i=0; ibr_elems[index[i]].be_dur, average_width); - } - average_diff = total_diff/numevents; - if( average_diff > DFS_BIN5_WIDTH_MARGIN ) { - return 1; - } else { - - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, "bursts=%u numevents=%u total_width=%d average_width=%d total_diff=%d average_diff=%d\n", bursts, numevents, total_width, average_width, total_diff, average_diff); - - } - - } - } - } - - return 0; -} - - -u_int8_t dfs_retain_bin5_burst_pattern(struct ath_dfs_host *dfs, u_int32_t diff_ts, u_int8_t old_dur) -{ - - // Pulses may get split into 2 during chirping, this print is only to show that it happened, we do not handle this condition if we cannot detect the chirping - // SPLIT pulses will have a time stamp difference of < 50 - if (diff_ts < 50) { - DFS_DPRINTK(dfs,ATH_DEBUG_DFS1,"%s SPLIT pulse diffTs=%u dur=%d (old_dur=%d)\n", __func__, diff_ts, dfs->dfs_rinfo.dfs_last_bin5_dur, old_dur); - } - // Check if this is the 2nd or 3rd pulse in the same burst, PRI will be between 1000 and 2000 us - if(((diff_ts >= DFS_BIN5_PRI_LOWER_LIMIT) && (diff_ts <= DFS_BIN5_PRI_HIGHER_LIMIT))) { - - //This pulse belongs to the same burst as the pulse before, so return the same random duration for it - DFS_DPRINTK(dfs,ATH_DEBUG_DFS1,"%s this pulse belongs to the same burst as before, give it same dur=%d (old_dur=%d)\n", __func__, dfs->dfs_rinfo.dfs_last_bin5_dur, old_dur); - - return (dfs->dfs_rinfo.dfs_last_bin5_dur); - } - // This pulse does not belong to this burst, return unchanged duration - return old_dur; -} - - -#endif /* ATH_SUPPORT_DFS */ diff --git a/drivers/net/wireless/ar6003/host/dfs/dfs_host_project.c b/drivers/net/wireless/ar6003/host/dfs/dfs_host_project.c deleted file mode 100644 index 40dd5d31d337..000000000000 --- a/drivers/net/wireless/ar6003/host/dfs/dfs_host_project.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2002-2010, Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef ATH_SUPPORT_DFS -#include "dfs_host.h" -#include "dfs_target_api.h" - -void dfs_radar_task (unsigned long arg) -{ - struct ath_dfs_host *dfs = (struct ath_dfs_host *)arg; - A_INT16 chan_index; - A_UINT8 bangradar; - - //printk("\n%s\n",__func__); - - if(dfs_process_radarevent_host(dfs, &chan_index, &bangradar)){ - if(!bangradar){ - DFS_DPRINTK(dfs, ATH_DEBUG_DFS, "%s: Radar detected on channel idx %d\n", - __func__, chan_index); - } - - /* TODO: The radar detected event is sent from host in timer - * context which could potentially cause issues with sleepable - * WMI. Change this to process context later. */ - DFS_RADAR_DETECTED(dfs->dev_hdl, chan_index, bangradar); - } - -} - -#endif /* ATH_SUPPORT_DFS */ - - diff --git a/drivers/net/wireless/ar6003/host/dfs/dfs_init.c b/drivers/net/wireless/ar6003/host/dfs/dfs_init.c deleted file mode 100644 index bddae9fbfbd8..000000000000 --- a/drivers/net/wireless/ar6003/host/dfs/dfs_init.c +++ /dev/null @@ -1,375 +0,0 @@ -/* - * Copyright (c) 2002-2010, Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef ATH_SUPPORT_DFS -#include "dfs_host.h" -#include "dfs_target_api.h" - - -struct dfs_pulse ar6000_etsi_radars[] = { - /* TYPE 1 */ - {15, 2, 750, 750, 0, 24, 7, 0, 2, 21, 0, -10, 0}, - /* TYPE 2 */ - {10, 5, 200, 200, 0, 24, 5, 1, 9, 21, 0, 3, 1}, - {10, 5, 300, 300, 0, 24, 8, 1, 9, 21, 0, 3, 2}, - {10, 5, 500, 500, 0, 24, 8, 1, 9, 21, 1, 3, 3}, - {10, 5, 800, 800, 0, 24, 8, 1, 9, 21, 1, 3, 4}, - {10, 5, 1001, 1001, 0, 30, 8, 1, 9, 21, 0, 3, 5}, - /* TYPE 3 */ - {15, 16, 200, 200, 0, 24, 6, 10, 19, 22, 0, 3, 6}, - {15, 16, 300, 300, 0, 24, 6, 10, 19, 22, 0, 3, 7}, - {15, 16, 503, 503, 0, 24, 7, 10, 19, 22, 0, 3, 8}, - {15, 16, 809, 809, 0, 24, 7, 10, 19, 22, 0, 3, 9}, - {15, 16, 1014, 1014, 0, 30, 7, 10, 19, 22, 0, 3, 10}, - /* TYPE 4 */ - {15, 5, 1200, 1200, 0, 24, 7, 1, 9, 21, 0, 3, 11}, - {15, 5, 1500, 1500, 0, 30, 7, 1, 9, 21, 0, 3, 12}, - {15, 5, 1600, 1600, 0, 24, 7, 1, 9, 21, 0, 3, 13}, - {15, 16, 1200, 1200, 0, 30, 7, 10, 19, 22, 0, 3, 14}, - {15, 16, 1500, 1500, 0, 24, 7, 10, 19, 22, 0, 3, 15}, - {15, 16, 1600, 1600, 0, 24, 7, 10, 19, 22, 0, 3, 16}, - /* TYPE 5 */ - {25, 5, 2305, 2305, 0, 24, 12, 1, 9, 21, 0, 3, 17}, - {25, 5, 3009, 3009, 0, 24, 12, 1, 9, 21, 0, 3, 18}, - {25, 5, 3500, 3500, 0, 24, 12, 1, 9, 21, 0, 3, 19}, - {25, 5, 4000, 4000, 0, 24, 12, 1, 9, 21, 0, 3, 20}, - {25, 16, 2300, 2300, 0, 24, 12, 10, 20, 22, 0, 3, 21}, - {25, 16, 3000, 3000, 0, 24, 12, 10, 20, 22, 0, 3, 22}, - {25, 16, 3500, 3500, 0, 24, 12, 10, 20, 22, 0, 3, 23}, - {25, 16, 3850, 3850, 0, 24, 12, 10, 20, 22, 0, 3, 24}, - /* TYPE 6 */ - {20, 25, 2000, 2000, 0, 24, 10, 20, 26, 22, 0, 3, 25}, - {20, 25, 3000, 3000, 0, 24, 10, 20, 26, 22, 0, 3, 26}, - {20, 25, 4000, 4000, 0, 24, 10, 20, 26, 22, 0, 3, 27}, - {20, 37, 2000, 2000, 0, 24, 10, 30, 36, 22, 0, 3, 28}, - {20, 37, 3000, 3000, 0, 24, 10, 30, 36, 22, 0, 3, 29}, - {20, 37, 4000, 4000, 0, 24, 10, 30, 36, 22, 0, 3, 30}, - - /* TYPE staggered pulse */ - {20, 2, 300, 400, 2, 30, 10, 0, 2, 22, 0, 3, 31}, //0.8-2us, 2-3 bursts,300-400 PRF, 10 pulses each - {30, 2, 400, 1200, 2, 30, 15, 0, 2, 22, 0, 3, 32}, //0.8-2us, 2-3 bursts, 400-1200 PRF, 15 pulses each - - /* constant PRF based */ - {10, 5, 200, 1000, 0, 24, 6, 0, 8, 21, 0, -10, 33}, /*0.8-5us , 200-1000 PRF, 10 pulses */ - {15, 15, 200, 1600, 0, 24, 7, 0, 18, 21, 0, -10, 34}, /*0.8-15us , 200-1600 PRF, 15 pulses */ - {25, 15, 2300, 4000, 0, 24, 12, 0, 18, 21, 0, -10, 35}, /* 0.8-15 us, 2300-4000 PRF, 25 pulses*/ - {20, 30, 2000, 4000, 0, 24, 10, 19, 33, 21, 0, -10, 36}, /* 20-30us, 2000-4000 PRF, 20 pulses*/ - -}; - -/* The following are for FCC Bin 1-4 pulses */ -struct dfs_pulse ar6000_fcc_radars[] = { - /* following two filters are specific to Japan/MKK4 */ - {18, 1, 720, 720, 1, 6, 6, 0, 1, 18, 0, 3, 17}, // 1389 +/- 6 us - {18, 4, 250, 250, 1, 10, 5, 1, 6, 18, 0, 3, 18}, // 4000 +/- 6 us - {18, 5, 260, 260, 1, 10, 6, 1, 6, 18, 0, 3, 19}, // 3846 +/- 7 us - /* following filters are common to both FCC and JAPAN */ - {18, 1, 325, 1930, 0, 6, 7, 0, 1, 18, 0, 3, 0}, // 1428 +/- 7 us - {9, 1, 3003, 3003, 1, 7, 5, 0, 1, 18, 0, 0, 1}, // 333 +/- 7 us - - {23, 5, 6250, 6250, 0, 15, 11, 0, 7, 22, 0, 3, 2}, // 160 +/- 15 us - {23, 5, 5263, 5263, 0, 18, 11, 0, 7, 22, 0, 3, 3}, // 190 +/- 15 us - {23, 5, 4545, 4545, 0, 18, 11, 0, 7, 22, 0, 3, 4}, // 220 +/- 15 us - - {18, 10, 4444, 4444, 0, 35, 6, 7, 13, 22, 0, 3, 5}, // 225 +/- 30 us - {18, 10, 3636, 3636, 0, 25, 6, 7, 13, 22, 0, 3, 6}, // 275 +/- 25 us - {18, 10, 3076, 3076, 0, 25, 8, 7, 13, 22, 0, 3, 7}, // 325 +/- 25 us - {18, 10, 2666, 2666, 0, 25, 8, 7, 13, 22, 0, 3, 8}, // 375 +/- 25 us - {18, 10, 2352, 2352, 0, 25, 8, 7, 13, 22, 0, 3, 9}, // 425 +/- 25 us - {18, 10, 2105, 2105, 0, 30, 8, 7, 13, 22, 0, 3, 10}, // 475 +/- 30 us - - {14, 15, 4444, 4444, 0, 35, 5, 13, 21, 22, 0, 3, 11}, // 225 +/- 30 us - {14, 15, 3636, 3636, 0, 25, 5, 13, 24, 22, 0, 3, 12}, // 275 +/- 25 us - {14, 15, 3076, 3076, 0, 25, 7, 13, 23, 22, 0, 3, 13}, // 325 +/- 25 us - {14, 15, 2666, 2666, 0, 25, 7, 13, 23, 22, 0, 3, 14}, // 375 +/- 25 us - {14, 15, 2352, 2352, 0, 25, 7, 13, 21, 22, 0, 3, 15}, // 425 +/- 25 us - {12, 15, 2105, 2105, 0, 30, 7, 13, 21, 22, 0, 3, 16}, // 475 +/- 30 us -}; - -struct dfs_bin5pulse ar6000_bin5pulses[] = { - {4, 28, 105, 12, 22, 5}, -}; - -/* - * Clear all delay lines for all filter types - */ -void dfs_reset_alldelaylines(struct ath_dfs_host *dfs) -{ - struct dfs_filtertype *ft = NULL; - struct dfs_filter *rf; - struct dfs_delayline *dl; - struct dfs_pulseline *pl; - int i,j; - - if (dfs == NULL) { - A_PRINTF("%s: sc_dfs is NULL\n", __func__); - return; - } - - pl = dfs->pulses; - /* reset the pulse log */ - pl->pl_firstelem = pl->pl_numelems = 0; - pl->pl_lastelem = DFS_MAX_PULSE_BUFFER_MASK; - - for (i=0; idfs_radarf[i] != NULL) { - ft = dfs->dfs_radarf[i]; - for (j=0; jft_numfilters; j++) { - rf = &(ft->ft_filters[j]); - dl = &(rf->rf_dl); - if(dl != NULL) { - OS_MEMZERO(dl, sizeof(struct dfs_delayline)); - dl->dl_lastelem = (0xFFFFFFFF) & DFS_MAX_DL_MASK; - } - } - } - } - for (i=0; idfs_rinfo.rn_numbin5radars; i++) { - OS_MEMZERO(&(dfs->dfs_b5radars[i].br_elems[0]), sizeof(struct dfs_bin5elem)*DFS_MAX_B5_SIZE); - dfs->dfs_b5radars[i].br_firstelem = 0; - dfs->dfs_b5radars[i].br_numelems = 0; - dfs->dfs_b5radars[i].br_lastelem = (0xFFFFFFFF)&DFS_MAX_B5_MASK; - } -} -/* - * Clear only a single delay line - */ - -void dfs_reset_delayline(struct dfs_delayline *dl) -{ - OS_MEMZERO(&(dl->dl_elems[0]), sizeof(dl->dl_elems)); - dl->dl_lastelem = (0xFFFFFFFF)&DFS_MAX_DL_MASK; -} - -void dfs_reset_filter_delaylines(struct dfs_filtertype *dft) -{ - int i; - struct dfs_filter *df; - for (i=0; i< DFS_MAX_NUM_RADAR_FILTERS; i++) { - df = &dft->ft_filters[i]; - dfs_reset_delayline(&(df->rf_dl)); - } -} - -void -dfs_reset_radarq(struct ath_dfs_host *dfs) -{ - struct dfs_event *event; - if (dfs == NULL) { - A_PRINTF("%s: sc_dfs is NULL\n", __func__); - return; - } - ATH_DFSQ_LOCK(dfs); - ATH_DFSEVENTQ_LOCK(dfs); - while (!STAILQ_EMPTY(&(dfs->dfs_radarq))) { - event = STAILQ_FIRST(&(dfs->dfs_radarq)); - STAILQ_REMOVE_HEAD(&(dfs->dfs_radarq), re_list); - OS_MEMZERO(event, sizeof(struct dfs_event)); - STAILQ_INSERT_TAIL(&(dfs->dfs_eventq), event, re_list); - } - ATH_DFSEVENTQ_UNLOCK(dfs); - ATH_DFSQ_UNLOCK(dfs); -} - -struct dfs_pulse *dfs_get_radars(u_int32_t dfsdomain, u_int32_t *numradars, struct dfs_bin5pulse **bin5pulses, u_int32_t *numb5radars) -{ -#define N(a) (sizeof(a)/sizeof(a[0])) - struct dfs_pulse *dfs_radars = NULL; - switch (dfsdomain) { - case DFS_FCC_DOMAIN: - dfs_radars = &ar6000_fcc_radars[3]; - *numradars= N(ar6000_fcc_radars)-3; - *bin5pulses = &ar6000_bin5pulses[0]; - *numb5radars = N(ar6000_bin5pulses); - break; - case DFS_ETSI_DOMAIN: - dfs_radars = &ar6000_etsi_radars[0]; - *numradars = N(ar6000_etsi_radars); - *bin5pulses = &ar6000_bin5pulses[0]; - *numb5radars = N(ar6000_bin5pulses); - break; - case DFS_MKK4_DOMAIN: - dfs_radars = &ar6000_fcc_radars[0]; - *numradars = N(ar6000_fcc_radars); - *bin5pulses = &ar6000_bin5pulses[0]; - *numb5radars = N(ar6000_bin5pulses); - break; - default: - return NULL; - } - - return dfs_radars; - -#undef N - -} - -int dfs_init_radar_filters_host( struct ath_dfs_host *dfs, struct ath_dfs_info *dfs_info) -{ - u_int32_t T, Tmax; - int numpulses,p,n, i; - struct dfs_filtertype *ft = NULL; - struct dfs_filter *rf=NULL; - struct dfs_pulse *dfs_radars; - struct dfs_bin5pulse *b5pulses; - int32_t min_rssithresh=DFS_MAX_RSSI_VALUE; - u_int32_t max_pulsedur=0; - u_int32_t numb5radars; - u_int32_t numradars; - - dfs_radars = dfs_get_radars(dfs_info->dfs_domain, &numradars, &b5pulses, &numb5radars); - /* If DFS not enabled return immediately.*/ - if (!dfs_radars) { - return 0; - } - - dfs->dfs_rinfo.rn_numradars = 0; - - /* Clear filter type table */ - for (n=0; n<256; n++) { - for (i=0;idfs_radartable[n])[i] = -1; - } - - /* Now, initialize the radar filters */ - for (p=0; p < numradars; p++) { - ft = NULL; - for (n=0; ndfs_rinfo.rn_numradars; n++) { - if ((dfs_radars[p].rp_pulsedur == dfs->dfs_radarf[n]->ft_filterdur) && - (dfs_radars[p].rp_numpulses == dfs->dfs_radarf[n]->ft_numpulses) && - (dfs_radars[p].rp_mindur == dfs->dfs_radarf[n]->ft_mindur) && - (dfs_radars[p].rp_maxdur == dfs->dfs_radarf[n]->ft_maxdur)) { - ft = dfs->dfs_radarf[n]; - break; - } - } - if (ft == NULL) { - /* No filter of the appropriate dur was found */ - if ((dfs->dfs_rinfo.rn_numradars+1) >DFS_MAX_RADAR_TYPES) { - DFS_DPRINTK(dfs, ATH_DEBUG_DFS, "%s: Too many filter types\n", - __func__); - goto bad4; - } - - ft = dfs->dfs_radarf[dfs->dfs_rinfo.rn_numradars]; - ft->ft_numfilters = 0; - ft->ft_numpulses = dfs_radars[p].rp_numpulses; - ft->ft_patterntype = dfs_radars[p].rp_patterntype; - ft->ft_mindur = dfs_radars[p].rp_mindur; - ft->ft_maxdur = dfs_radars[p].rp_maxdur; - ft->ft_filterdur = dfs_radars[p].rp_pulsedur; - ft->ft_rssithresh = dfs_radars[p].rp_rssithresh; - ft->ft_rssimargin = dfs_radars[p].rp_rssimargin; - ft->ft_minpri = 1000000; - - if (ft->ft_rssithresh < min_rssithresh) - min_rssithresh = ft->ft_rssithresh; - if (ft->ft_maxdur > max_pulsedur) - max_pulsedur = ft->ft_maxdur; - for (i=ft->ft_mindur; i<=ft->ft_maxdur; i++) { - u_int32_t stop=0,tableindex=0; - while ((tableindex < DFS_MAX_RADAR_OVERLAP) && (!stop)) { - if ((dfs->dfs_radartable[i])[tableindex] == -1) - stop = 1; - else - tableindex++; - } - if (stop) { - (dfs->dfs_radartable[i])[tableindex] = - (int8_t) (dfs->dfs_rinfo.rn_numradars); - } else { - DFS_DPRINTK(dfs, ATH_DEBUG_DFS, - "%s: Too many overlapping radar filters\n", - __func__); - goto bad4; - } - } - dfs->dfs_rinfo.rn_numradars++; - } - rf = &(ft->ft_filters[ft->ft_numfilters++]); - dfs_reset_delayline(&rf->rf_dl); - numpulses = dfs_radars[p].rp_numpulses; - - rf->rf_numpulses = numpulses; - rf->rf_patterntype = dfs_radars[p].rp_patterntype; - rf->rf_pulseid = dfs_radars[p].rp_pulseid; - rf->rf_mindur = dfs_radars[p].rp_mindur; - rf->rf_maxdur = dfs_radars[p].rp_maxdur; - rf->rf_numpulses = dfs_radars[p].rp_numpulses; - - T = (100000000/dfs_radars[p].rp_max_pulsefreq) - - 100*(dfs_radars[p].rp_meanoffset); - rf->rf_minpri = - dfs_round((int32_t)T - (100*(dfs_radars[p].rp_pulsevar))); - Tmax = (100000000/dfs_radars[p].rp_pulsefreq) - - 100*(dfs_radars[p].rp_meanoffset); - rf->rf_maxpri = - dfs_round((int32_t)Tmax + (100*(dfs_radars[p].rp_pulsevar))); - - if( rf->rf_minpri < ft->ft_minpri ) - ft->ft_minpri = rf->rf_minpri; - - rf->rf_threshold = dfs_radars[p].rp_threshold; - rf->rf_filterlen = rf->rf_maxpri * rf->rf_numpulses; - - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, "minprf = %d maxprf = %d pulsevar = %d thresh=%d\n", - dfs_radars[p].rp_pulsefreq, dfs_radars[p].rp_max_pulsefreq, dfs_radars[p].rp_pulsevar, rf->rf_threshold); - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, - "minpri = %d maxpri = %d filterlen = %d filterID = %d\n", - rf->rf_minpri, rf->rf_maxpri, rf->rf_filterlen, rf->rf_pulseid); - } - -#ifdef DFS_DEBUG - dfs_print_filters(dfs); -#endif - - dfs->dfs_rinfo.rn_numbin5radars = numb5radars; - if ( dfs->dfs_b5radars == NULL ) { - dfs->dfs_b5radars = (struct dfs_bin5radars *)DFS_MALLOC(dfs->os_hdl, numb5radars * sizeof(struct dfs_bin5radars)); - if (dfs->dfs_b5radars == NULL) { - DFS_DPRINTK(dfs, ATH_DEBUG_DFS, - "%s: cannot allocate memory for bin5 radars\n", - __func__); - goto bad4; - } - } - for (n=0; ndfs_b5radars[n].br_pulse = b5pulses[n]; - dfs->dfs_b5radars[n].br_pulse.b5_timewindow *= 1000000; - if (dfs->dfs_b5radars[n].br_pulse.b5_rssithresh < min_rssithresh) - min_rssithresh = dfs->dfs_b5radars[n].br_pulse.b5_rssithresh; - if (dfs->dfs_b5radars[n].br_pulse.b5_maxdur > max_pulsedur ) - max_pulsedur = dfs->dfs_b5radars[n].br_pulse.b5_maxdur; - } - dfs_reset_alldelaylines(dfs); - dfs_reset_radarq(dfs); - - DFS_SET_MINRSSITHRESH(dfs->dev_hdl, min_rssithresh); - DFS_SET_MAXPULSEDUR(dfs->dev_hdl, dfs_round((int32_t)((max_pulsedur*100/80)*100))); - - - return 0; - -bad4: - for (n=0; nft_numfilters; n++) { - rf = &(ft->ft_filters[n]); - } - return 1; -} - - - -#endif /* ATH_SUPPORT_DFS */ diff --git a/drivers/net/wireless/ar6003/host/dfs/dfs_misc.c b/drivers/net/wireless/ar6003/host/dfs/dfs_misc.c deleted file mode 100644 index f0036c55dd7f..000000000000 --- a/drivers/net/wireless/ar6003/host/dfs/dfs_misc.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2002-2010, Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef ATH_SUPPORT_DFS -#include "dfs_host.h" - -int adjust_pri_per_chan_busy(int ext_chan_busy, int pri_margin) -{ - int adjust_pri=0; - - if(ext_chan_busy > DFS_EXT_CHAN_LOADING_THRESH) { - - adjust_pri = (ext_chan_busy - DFS_EXT_CHAN_LOADING_THRESH) * (pri_margin); - adjust_pri /= 100; - - } - return adjust_pri; -} - -int adjust_thresh_per_chan_busy(int ext_chan_busy, int thresh) -{ - int adjust_thresh=0; - - if(ext_chan_busy > DFS_EXT_CHAN_LOADING_THRESH) { - - adjust_thresh = (ext_chan_busy - DFS_EXT_CHAN_LOADING_THRESH) * thresh; - adjust_thresh /= 100; - - } - return adjust_thresh; -} -/* For the extension channel, if legacy traffic is present, we see a lot of false alarms, -so make the PRI margin narrower depending on the busy % for the extension channel.*/ - -int dfs_get_pri_margin(int is_extchan_detect, int is_fixed_pattern, u_int64_t lastfull_ts, u_int32_t ext_chan_busy) -{ - - int adjust_pri=0; - int pri_margin; - // struct ath_dfs_target *dfs = sc->sc_dfs_tgt; - - if (is_fixed_pattern) - pri_margin = DFS_DEFAULT_FIXEDPATTERN_PRI_MARGIN; - else - pri_margin = DFS_DEFAULT_PRI_MARGIN; - - - /*XXX: Does cached value make sense here? */ -#if 0 - if(ext_chan_busy) { - dfs->dfs_rinfo.ext_chan_busy_ts = ath_hal_gettsf64(sc->sc_ah); - dfs->dfs_rinfo.dfs_ext_chan_busy = ext_chan_busy; - } else { - // Check to see if the cached value of ext_chan_busy can be used - if (dfs->dfs_rinfo.dfs_ext_chan_busy) { - if (lastfull_ts < dfs->dfs_rinfo.ext_chan_busy_ts) { - ext_chan_busy = dfs->dfs_rinfo.dfs_ext_chan_busy; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2," PRI Use cached copy of ext_chan_busy extchanbusy=%d \n", ext_chan_busy); - } - } - } -#endif - adjust_pri = adjust_pri_per_chan_busy(ext_chan_busy, pri_margin); - - pri_margin -= adjust_pri; - return pri_margin; -} - -/* For the extension channel, if legacy traffic is present, we see a lot of false alarms, -so make the thresholds higher depending on the busy % for the extension channel.*/ - -int dfs_get_filter_threshold(struct dfs_filter *rf, int is_extchan_detect, u_int64_t lastfull_ts, u_int32_t ext_chan_busy) -{ - int thresh, adjust_thresh=0; - // struct ath_dfs_target *dfs = sc->sc_dfs_tgt; - - thresh = rf->rf_threshold; - - /*XXX: Does cached value make sense here? */ -#if 0 - if(ext_chan_busy) { - dfs->dfs_rinfo.ext_chan_busy_ts = ath_hal_gettsf64(sc->sc_ah); - dfs->dfs_rinfo.dfs_ext_chan_busy = ext_chan_busy; - } else { - // Check to see if the cached value of ext_chan_busy can be used - if (dfs->dfs_rinfo.dfs_ext_chan_busy) { - if (lastfull_ts < dfs->dfs_rinfo.ext_chan_busy_ts) { - ext_chan_busy = dfs->dfs_rinfo.dfs_ext_chan_busy; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2," THRESH Use cached copy of ext_chan_busy extchanbusy=%d lastfull_ts=%llu ext_chan_busy_ts=%llu\n", ext_chan_busy ,lastfull_ts, dfs->dfs_rinfo.ext_chan_busy_ts); - } - } - } -#endif - adjust_thresh = adjust_thresh_per_chan_busy(ext_chan_busy, thresh); - - //DFS_DPRINTK(dfs, ATH_DEBUG_DFS2," filterID=%d extchanbusy=%d adjust_thresh=%d\n", rf->rf_pulseid, ext_chan_busy, adjust_thresh); - - thresh += adjust_thresh; - return thresh; -} - - - - - - -#endif /* ATH_SUPPORT_DFS */ diff --git a/drivers/net/wireless/ar6003/host/dfs/dfs_process_phyerr.c b/drivers/net/wireless/ar6003/host/dfs/dfs_process_phyerr.c deleted file mode 100644 index 1968731391be..000000000000 --- a/drivers/net/wireless/ar6003/host/dfs/dfs_process_phyerr.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2002-2010, Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef ATH_SUPPORT_DFS -#include "dfs_host.h" -void -dfs_queue_phyerr(struct ath_dfs_host *dfs, struct dfs_event_info *ev_info); - - -void -dfs_process_phyerr_host(struct ath_dfs_host *dfs, WMI_DFS_PHYERR_EVENT *ev) -{ - int i; - for(i=0; inum_events; i++) - dfs_queue_phyerr(dfs, &ev->ev_info[i]); -} - -void -dfs_queue_phyerr(struct ath_dfs_host *dfs, struct dfs_event_info *ev_info) -{ - struct dfs_event *event; - int empty; - - ATH_DFSEVENTQ_LOCK(dfs); - empty = STAILQ_EMPTY(&(dfs->dfs_eventq)); - ATH_DFSEVENTQ_UNLOCK(dfs); - if (empty) { - return; - } - - /* XXX: Lot of common code. Optimize */ - - if((ev_info->flags & EVENT_TYPE_MASK) == AR_EVENT){ - ATH_DFSEVENTQ_LOCK(dfs); - event = STAILQ_FIRST(&(dfs->dfs_eventq)); - if (event == NULL) { - ATH_DFSEVENTQ_UNLOCK(dfs); - DFS_DPRINTK(dfs, ATH_DEBUG_DFS, "%s: no more events space left\n", - __func__); - return; - } - STAILQ_REMOVE_HEAD(&(dfs->dfs_eventq), re_list); - ATH_DFSEVENTQ_UNLOCK(dfs); - event->re_rssi = ev_info->rssi; - event->re_dur = ev_info->dur; - event->re_full_ts = ev_info->full_ts; - event->re_ts = ev_info->ts; - event->re_chanindex = ev_info->chanindex; - event->re_chanindextype = ev_info->flags & CH_TYPE_MASK; - ATH_ARQ_LOCK(dfs); - STAILQ_INSERT_TAIL(&(dfs->dfs_arq), event, re_list); - ATH_ARQ_UNLOCK(dfs); - } - else { /* DFS event */ - ATH_DFSEVENTQ_LOCK(dfs); - event = STAILQ_FIRST(&(dfs->dfs_eventq)); - if (event == NULL) { - ATH_DFSEVENTQ_UNLOCK(dfs); - DFS_DPRINTK(dfs, ATH_DEBUG_DFS, "%s: no more events space left\n", - __func__); - return; - } - STAILQ_REMOVE_HEAD(&(dfs->dfs_eventq), re_list); - ATH_DFSEVENTQ_UNLOCK(dfs); - event->re_rssi = ev_info->rssi; - event->re_dur = ev_info->dur; - event->re_full_ts = ev_info->full_ts; - event->re_ts = ev_info->ts; - event->re_chanindex = ev_info->chanindex; - event->re_chanindextype = ev_info->flags & CH_TYPE_MASK; - event->re_ext_chan_busy = ev_info->ext_chan_busy; - - ATH_DFSQ_LOCK(dfs); - STAILQ_INSERT_TAIL(&(dfs->dfs_radarq), event, re_list); - ATH_DFSQ_UNLOCK(dfs); - } - - /* TODO: The radar detected event is sent from host in timer - * context which could potentially cause issues with sleepable - * WMI. Change this to process context later. */ - - A_TIMEOUT_MS(&dfs->dfs_radar_task_timer, 0, 0); - -} - -#endif /* ATH_SUPPORT_DFS */ diff --git a/drivers/net/wireless/ar6003/host/dfs/dfs_process_radarevent.c b/drivers/net/wireless/ar6003/host/dfs/dfs_process_radarevent.c deleted file mode 100644 index 9ebe19bb33a1..000000000000 --- a/drivers/net/wireless/ar6003/host/dfs/dfs_process_radarevent.c +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Copyright (c) 2002-2010, Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef ATH_SUPPORT_DFS -#include "dfs_host.h" - -static char debug_dup[33]; -static int debug_dup_cnt; - -u_int32_t dfs_round(int32_t val) -{ - u_int32_t ival,rem; - - if (val < 0) - return 0; - ival = val/100; - rem = val-(ival*100); - if (rem <50) - return ival; - else - return(ival+1); -} - - -static inline u_int8_t -dfs_process_pulse_dur(struct ath_dfs_host *dfs, u_int8_t re_dur) -{ - if (re_dur == 0) { - return 1; - } else { - /* Convert 0.8us durations to TSF ticks (usecs) */ - return (u_int8_t)dfs_round((int32_t)((dfs->dur_multiplier)*re_dur)); - } -} - -int -dfs_process_radarevent_host(struct ath_dfs_host *dfs, int16_t *chan_index, u_int8_t *bangradar) -{ - struct dfs_event re,*event; - struct dfs_filtertype *ft; - struct dfs_filter *rf; - int found, retval=0,p, empty; - int events_processed=0; - u_int32_t tabledepth, index; - u_int64_t deltafull_ts = 0,this_ts, deltaT; - struct dfs_pulseline *pl; - static u_int32_t test_ts = 0; - static u_int32_t diff_ts = 0; - - int ext_chan_event_flag=0; - - if (dfs == NULL) { - A_PRINTF("%s: sc_sfs is NULL\n", __func__); - return 0; - } - pl = dfs->pulses; - /* TEST : Simulate radar bang, make sure we add the channel to NOL (bug 29968) */ - if (dfs->dfs_bangradar) { - /* bangradar will always simulate radar found on the primary channel */ - *bangradar = 1; - dfs->dfs_bangradar = 0; /* reset */ - DFS_DPRINTK(dfs, ATH_DEBUG_DFS, "%s: bangradar\n", __func__); - retval = 1; - } - else - *bangradar = 0; - - ATH_DFSQ_LOCK(dfs); - empty = STAILQ_EMPTY(&(dfs->dfs_radarq)); - ATH_DFSQ_UNLOCK(dfs); - - while ((!empty) && (!retval) && (events_processed < MAX_EVENTS)) { - ATH_DFSQ_LOCK(dfs); - event = STAILQ_FIRST(&(dfs->dfs_radarq)); - if (event != NULL) - STAILQ_REMOVE_HEAD(&(dfs->dfs_radarq), re_list); - ATH_DFSQ_UNLOCK(dfs); - - if (event == NULL) { - empty = 1; - break; - } - events_processed++; - re = *event; - - OS_MEMZERO(event, sizeof(struct dfs_event)); - ATH_DFSEVENTQ_LOCK(dfs); - STAILQ_INSERT_TAIL(&(dfs->dfs_eventq), event, re_list); - ATH_DFSEVENTQ_UNLOCK(dfs); - - found = 0; - if (re.re_chanindex < DFS_NUM_RADAR_STATES) - *chan_index = re.re_chanindex; - else { - ATH_DFSQ_LOCK(dfs); - empty = STAILQ_EMPTY(&(dfs->dfs_radarq)); - ATH_DFSQ_UNLOCK(dfs); - continue; - } - - if (dfs->dfs_rinfo.rn_lastfull_ts == 0) { - /* - * Either not started, or 64-bit rollover exactly to zero - * Just prepend zeros to the 15-bit ts - */ - dfs->dfs_rinfo.rn_ts_prefix = 0; - this_ts = (u_int64_t) re.re_ts; - } else { - /* WAR 23031- patch duplicate ts on very short pulses */ - /* This pacth has two problems in linux environment. - * 1)The time stamp created and hence PRI depends entirely on the latency. - * If the latency is high, it possibly can split two consecutive - * pulses in the same burst so far away (the same amount of latency) - * that make them look like they are from differenct bursts. It is - * observed to happen too often. It sure makes the detection fail. - * 2)Even if the latency is not that bad, it simply shifts the duplicate - * timestamps to a new duplicate timestamp based on how they are processed. - * This is not worse but not good either. - * - * Take this pulse as a good one and create a probable PRI later - */ - if (re.re_dur == 0 && re.re_ts == dfs->dfs_rinfo.rn_last_unique_ts) { - debug_dup[debug_dup_cnt++] = '1'; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS1, "\n %s deltaT is 0 \n", __func__); - } else { - dfs->dfs_rinfo.rn_last_unique_ts = re.re_ts; - debug_dup[debug_dup_cnt++] = '0'; - } - if (debug_dup_cnt >= 32){ - debug_dup_cnt = 0; - } - - - if (re.re_ts <= dfs->dfs_rinfo.rn_last_ts) { - dfs->dfs_rinfo.rn_ts_prefix += - (((u_int64_t) 1) << DFS_TSSHIFT); - /* Now, see if it's been more than 1 wrap */ - deltafull_ts = re.re_full_ts - dfs->dfs_rinfo.rn_lastfull_ts; - if (deltafull_ts > - ((u_int64_t)((DFS_TSMASK - dfs->dfs_rinfo.rn_last_ts) + 1 + re.re_ts))) - deltafull_ts -= (DFS_TSMASK - dfs->dfs_rinfo.rn_last_ts) + 1 + re.re_ts; - deltafull_ts = deltafull_ts >> DFS_TSSHIFT; - if (deltafull_ts > 1) { - dfs->dfs_rinfo.rn_ts_prefix += - ((deltafull_ts - 1) << DFS_TSSHIFT); - } - } else { - deltafull_ts = re.re_full_ts - dfs->dfs_rinfo.rn_lastfull_ts; - if (deltafull_ts > (u_int64_t) DFS_TSMASK) { - deltafull_ts = deltafull_ts >> DFS_TSSHIFT; - dfs->dfs_rinfo.rn_ts_prefix += - ((deltafull_ts - 1) << DFS_TSSHIFT); - } - } - this_ts = dfs->dfs_rinfo.rn_ts_prefix | ((u_int64_t) re.re_ts); - } - dfs->dfs_rinfo.rn_lastfull_ts = re.re_full_ts; - dfs->dfs_rinfo.rn_last_ts = re.re_ts; - - re.re_dur = dfs_process_pulse_dur(dfs, re.re_dur); - if (re.re_dur != 1) { - this_ts -= re.re_dur; - } - - /* Save the pulse parameters in the pulse buffer(pulse line) */ - index = (pl->pl_lastelem + 1) & DFS_MAX_PULSE_BUFFER_MASK; - if (pl->pl_numelems == DFS_MAX_PULSE_BUFFER_SIZE) - pl->pl_firstelem = (pl->pl_firstelem+1) & DFS_MAX_PULSE_BUFFER_MASK; - else - pl->pl_numelems++; - pl->pl_lastelem = index; - pl->pl_elems[index].p_time = this_ts; - pl->pl_elems[index].p_dur = re.re_dur; - pl->pl_elems[index].p_rssi = re.re_rssi; - diff_ts = (u_int32_t)this_ts - test_ts; - test_ts = (u_int32_t)this_ts; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS1,"ts%u %u %u diff %u pl->pl_lastelem.p_time=%llu\n",(u_int32_t)this_ts, re.re_dur, re.re_rssi, diff_ts, (unsigned long long)pl->pl_elems[index].p_time); - - found = 0; - for (p=0; (pdfs_rinfo.rn_numbin5radars)&&(!found); p++) { - struct dfs_bin5radars *br; - u_int32_t b5_rssithresh; - br = &(dfs->dfs_b5radars[p]); - b5_rssithresh = br->br_pulse.b5_rssithresh; - - /* Adjust the filter threshold for rssi in non TURBO mode*/ - //XXX: If turbo mode, ar events would be used? - //if( ! (sc->sc_curchan.channelFlags & CHANNEL_TURBO) ) { - b5_rssithresh += br->br_pulse.b5_rssimargin; - //} - - if ((re.re_dur >= br->br_pulse.b5_mindur) && - (re.re_dur <= br->br_pulse.b5_maxdur) && - (re.re_rssi >= b5_rssithresh)) { - - // This is a valid Bin5 pulse, check if it belongs to a burst - re.re_dur = dfs_retain_bin5_burst_pattern(dfs, diff_ts, re.re_dur); - // Remember our computed duration for the next pulse in the burst (if needed) - dfs->dfs_rinfo.dfs_bin5_chirp_ts = this_ts; - dfs->dfs_rinfo.dfs_last_bin5_dur = re.re_dur; - - - if( dfs_bin5_addpulse(dfs, br, &re, this_ts) ) { - found |= dfs_bin5_check(dfs); - } - } else - DFS_DPRINTK(dfs, ATH_DEBUG_DFS3, "%s too low to be Bin5 pulse (%d)\n", __func__, re.re_dur); - } - if (found) { - DFS_DPRINTK(dfs, ATH_DEBUG_DFS, "%s: Found bin5 radar\n", __func__); - retval |= found; - goto dfsfound; - } - tabledepth = 0; - rf = NULL; - - while ((tabledepth < DFS_MAX_RADAR_OVERLAP) && - ((dfs->dfs_radartable[re.re_dur])[tabledepth] != -1) && - (!retval)) { - ft = dfs->dfs_radarf[((dfs->dfs_radartable[re.re_dur])[tabledepth])]; - - if (re.re_rssi < ft->ft_rssithresh && re.re_dur > 4) { - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2,"%s : Rejecting on rssi rssi=%u thresh=%u\n", __func__, re.re_rssi, ft->ft_rssithresh); - tabledepth++; - ATH_DFSQ_LOCK(dfs); - empty = STAILQ_EMPTY(&(dfs->dfs_radarq)); - ATH_DFSQ_UNLOCK(dfs); - continue; - } - deltaT = this_ts - ft->ft_last_ts; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2,"deltaT = %lld (ts: 0x%llx) (last ts: 0x%llx)\n",(unsigned long long)deltaT, (unsigned long long)this_ts, (unsigned long long)ft->ft_last_ts); - if ((deltaT < ft->ft_minpri) && (deltaT !=0)){ - /* This check is for the whole filter type. Individual filters - will check this again. This is first line of filtering.*/ - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, "%s: Rejecting on pri pri=%lld minpri=%u\n", __func__, (unsigned long long)deltaT, ft->ft_minpri); - tabledepth++; - continue; - } - for (p=0, found = 0; (pft_numfilters) && (!found); p++) { - rf = &(ft->ft_filters[p]); - if ((re.re_dur >= rf->rf_mindur) && (re.re_dur <= rf->rf_maxdur)) { - /* The above check is probably not necessary */ - deltaT = this_ts - rf->rf_dl.dl_last_ts; - if (deltaT < 0) - deltaT = (int64_t) ((DFS_TSF_WRAP - rf->rf_dl.dl_last_ts) + this_ts +1); - if ((deltaT < rf->rf_minpri) && (deltaT != 0)) { - /* Second line of PRI filtering. */ - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, - "filterID %d : Rejecting on individual filter min PRI deltaT=%lld rf->rf_minpri=%u\n", - rf->rf_pulseid, (unsigned long long)deltaT, rf->rf_minpri); - continue; - } - - if ((rf->rf_patterntype==2) && (deltaT > rf->rf_maxpri) ) { - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, - "filterID %d : Staggered - Rejecting on individual filter max PRI deltaT=%lld rf->rf_maxpri=%u\n", - rf->rf_pulseid, (unsigned long long)deltaT, rf->rf_maxpri); - /* But update the last time stamp */ - rf->rf_dl.dl_last_ts = this_ts; - continue; - } - - if ((rf->rf_patterntype!= 2) && (deltaT > rf->rf_maxpri) && (deltaT < (2*rf->rf_minpri))) { - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, - "filterID %d : Rejecting on individual filter max PRI deltaT=%lld rf->rf_minpri=%u\n", - rf->rf_pulseid, (unsigned long long)deltaT, rf->rf_minpri); - /* But update the last time stamp */ - rf->rf_dl.dl_last_ts = this_ts; - continue; - } - dfs_add_pulse(dfs, rf, &re, deltaT); - /* If this is an extension channel event, flag it for false alarm reduction */ - if (re.re_chanindextype == EXT_CH) - ext_chan_event_flag = 1; - - if (rf->rf_patterntype == 2) - found = dfs_staggered_check(dfs, rf, (u_int32_t) deltaT, re.re_dur, re.re_ext_chan_busy); - else - found = dfs_bin_check(dfs, rf, (u_int32_t) deltaT, re.re_dur, ext_chan_event_flag, re.re_ext_chan_busy); - - dfs_print_delayline(dfs, &rf->rf_dl); - rf->rf_dl.dl_last_ts = this_ts; - } - } - ft->ft_last_ts = this_ts; - retval |= found; - if (found) { - DFS_DPRINTK(dfs, ATH_DEBUG_DFS, - "Found on channel minDur = %d, filterId = %d\n",ft->ft_mindur, - rf != NULL ? rf->rf_pulseid : -1); - } - tabledepth++; - } - ATH_DFSQ_LOCK(dfs); - empty = STAILQ_EMPTY(&(dfs->dfs_radarq)); - ATH_DFSQ_UNLOCK(dfs); - } -dfsfound: - - return retval; -} - -#endif /* ATH_SUPPORT_DFS */ diff --git a/drivers/net/wireless/ar6003/host/dfs/dfs_staggered.c b/drivers/net/wireless/ar6003/host/dfs/dfs_staggered.c deleted file mode 100644 index 44091c363876..000000000000 --- a/drivers/net/wireless/ar6003/host/dfs/dfs_staggered.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2002-2010, Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef ATH_SUPPORT_DFS -#include "dfs_host.h" - -int is_pri_multiple(u_int32_t sample_pri, u_int32_t refpri) -{ -#define MAX_ALLOWED_MISSED 3 - int i; - - if (sample_pri < refpri || (!refpri)) - return 0; - - for (i=1; i<= MAX_ALLOWED_MISSED; i++) { - if((sample_pri%(i*refpri) <= 5)) { - //printk("sample_pri=%d is a multiple of refpri=%d\n", sample_pri, refpri); - return 1; - } - } - return 0; -#undef MAX_ALLOWED_MISSED -} - -int is_unique_pri(u_int32_t highestpri , u_int32_t midpri, - u_int32_t lowestpri , u_int32_t refpri ) -{ -#define DFS_STAGGERED_PRI_MARGIN_MIN 20 -#define DFS_STAGGERED_PRI_MARGIN_MAX 400 - if ((DFS_DIFF(lowestpri, refpri) >= DFS_STAGGERED_PRI_MARGIN_MIN) && - (DFS_DIFF(midpri, refpri) >= DFS_STAGGERED_PRI_MARGIN_MIN) && - (DFS_DIFF(highestpri, refpri) >= DFS_STAGGERED_PRI_MARGIN_MIN)) { - return 1; - } else { - if ((is_pri_multiple(refpri, highestpri)) || (is_pri_multiple(refpri, lowestpri)) || - (is_pri_multiple(refpri, midpri))) - return 0; - } - return 0; -#undef DFS_STAGGERED_PRI_MARGIN_MIN -#undef DFS_STAGGERED_PRI_MARGIN_MAX -} - - -int dfs_staggered_check(struct ath_dfs_host *dfs, struct dfs_filter *rf, - u_int32_t deltaT, u_int32_t width, u_int32_t ext_chan_busy) -{ - - u_int32_t refpri, refdur, searchpri=0, deltapri;//, averagerefpri; - u_int32_t n, i, primargin, durmargin; - int score[DFS_MAX_DL_SIZE], delayindex, dindex, found=0; - struct dfs_delayline *dl; - u_int32_t scoreindex, lowpriindex= 0, lowpri = 0xffff; - int numpulses=0, higherthan, lowerthan, numscores; - u_int32_t lowestscore=0, lowestscoreindex=0, lowestpri=0; - u_int32_t midscore=0, midscoreindex=0, midpri=0; - u_int32_t highestscore=0, highestscoreindex=0, highestpri=0; - - dl = &rf->rf_dl; - if( dl->dl_numelems < (rf->rf_threshold-1)) { - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, "numelems %d < threshold for filter %d\n", dl->dl_numelems, rf->rf_pulseid); - return 0; - } - if( deltaT > rf->rf_filterlen) { - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, "numelems %d < threshold for filter %d\n", dl->dl_numelems, rf->rf_pulseid); - return 0; - } - primargin = 10; - if(rf->rf_maxdur < 10) { - durmargin = 4; - } - else { - durmargin = 6; - } - - OS_MEMZERO(score, sizeof(int)*DFS_MAX_DL_SIZE); - /* find out the lowest pri */ - for (n=0;ndl_numelems; n++) { - delayindex = (dl->dl_firstelem + n) & DFS_MAX_DL_MASK; - refpri = dl->dl_elems[delayindex].de_time; - if( refpri == 0) - continue; - else if(refpri < lowpri) { - lowpri = dl->dl_elems[delayindex].de_time; - lowpriindex = n; - } - } - /* find out the each delay element's pri score */ - for (n=0;ndl_numelems; n++) { - delayindex = (dl->dl_firstelem + n) & DFS_MAX_DL_MASK; - refpri = dl->dl_elems[delayindex].de_time; - if( refpri == 0) - continue; - for (i=0;idl_numelems; i++) { - dindex = (dl->dl_firstelem + i) & DFS_MAX_DL_MASK; - searchpri = dl->dl_elems[dindex].de_time; - deltapri = DFS_DIFF(searchpri, refpri); - if( deltapri < primargin) - score[n]++; - } - if( score[n] > rf->rf_threshold) { - /* we got the most possible candidate, - * no need to continue further */ - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, "THRESH score[%d]=%d pri=%d\n", n, score[n], searchpri); - break; - } - } - for (n=0;ndl_numelems; n++) { - delayindex = (dl->dl_firstelem + n) & DFS_MAX_DL_MASK; - refdur = dl->dl_elems[delayindex].de_time; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, "score[%d]=%d pri=%d\n", n, score[n], refdur); - } - - /* find out the 2 or 3 highest scorers */ - scoreindex = 0; - highestscore=0; - highestscoreindex=0; - highestpri=0; numscores=0; lowestscore=0; - - for (n=0;ndl_numelems; n++) { - higherthan=0; - lowerthan=0; - delayindex = (dl->dl_firstelem + n) & DFS_MAX_DL_MASK; - refpri = dl->dl_elems[delayindex].de_time; - - if ((score[n] >= highestscore) && - (is_unique_pri(highestpri, midpri, lowestpri, refpri))) { - lowestscore = midscore; - lowestpri = midpri; - lowestscoreindex = midscoreindex; - midscore = highestscore; - midpri = highestpri; - midscoreindex = highestscoreindex; - highestscore = score[n]; - highestpri = refpri; - highestscoreindex = n; - } else { - if ((score[n] >= midscore) && - (is_unique_pri(highestpri, midpri, lowestpri, refpri))) { - lowestscore = midscore; - lowestpri = midpri; - lowestscoreindex = midscoreindex; - midscore = score[n]; - midpri = refpri; - midscoreindex = n; - } else if ((score[n] >= lowestscore) && - (is_unique_pri(highestpri, midpri, lowestpri, refpri))) { - lowestscore = score[n]; - lowestpri = refpri; - lowestscoreindex = n; - } - } - - } - - DFS_DPRINTK(dfs, ATH_DEBUG_DFS1, "FINAL highestscore=%d highestscoreindex=%d highestpri=%d\n", highestscore, highestscoreindex, highestpri); - DFS_DPRINTK(dfs, ATH_DEBUG_DFS1, "FINAL lowestscore=%d lowestscoreindex=%d lowpri=%d\n", lowestscore, lowestscoreindex, lowestpri); - DFS_DPRINTK(dfs, ATH_DEBUG_DFS1, "FINAL midscore=%d midscoreindex=%d midpri=%d\n", midscore, midscoreindex, midpri); - - delayindex = (dl->dl_firstelem + highestscoreindex) & DFS_MAX_DL_MASK; - refdur = dl->dl_elems[delayindex].de_dur; - refpri = dl->dl_elems[delayindex].de_time; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS1, "highscoreindex=%d refdur=%d refpri=%d\n", highestscoreindex, refdur, refpri); - - numpulses += dfs_bin_pri_check(dfs, rf, dl, highestscore, refpri, refdur, 0, ext_chan_busy); - - ; delayindex = (dl->dl_firstelem + midscoreindex) & DFS_MAX_DL_MASK; - refdur = dl->dl_elems[delayindex].de_dur; - refpri = dl->dl_elems[delayindex].de_time; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS1, "midscoreindex=%d refdur=%d refpri=%d\n", midscoreindex, refdur, refpri); - - numpulses += dfs_bin_pri_check(dfs, rf, dl, midscore, refpri, refdur, 0, ext_chan_busy); - ; - delayindex = (dl->dl_firstelem + lowestscoreindex) & DFS_MAX_DL_MASK; - refdur = dl->dl_elems[delayindex].de_dur; - refpri = dl->dl_elems[delayindex].de_time; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS1, "lowestscoreindex=%d refdur=%d refpri=%d\n", lowestscoreindex, refdur, refpri); - - numpulses += dfs_bin_pri_check(dfs, rf, dl, lowestscore, refpri, refdur, 0, ext_chan_busy); - DFS_DPRINTK(dfs, ATH_DEBUG_DFS2, "numpulses=%d\n",numpulses); - - if (numpulses >= rf->rf_threshold) { - found = 1; - DFS_DPRINTK(dfs, ATH_DEBUG_DFS, "MATCH filter=%u numpulses=%u thresh=%u\n", rf->rf_pulseid, numpulses,rf->rf_threshold); - } - return found; -} - -#endif /* ATH_SUPPORT_DFS */ diff --git a/drivers/net/wireless/ar6003/host/dfs/dfs_target_api.h b/drivers/net/wireless/ar6003/host/dfs/dfs_target_api.h deleted file mode 100644 index 1cc2bdc6b5fe..000000000000 --- a/drivers/net/wireless/ar6003/host/dfs/dfs_target_api.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2005-2006 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -#ifndef _DFS_TARGET_API_H_ -#define _DFS_TARGET_API_H_ - -#ifdef ATH_SUPPORT_DFS - -#include "ar6000_api.h" - -#define DFS_SET_MINRSSITHRESH(dev_hdl, value) ar6000_dfs_set_minrssithresh_cmd((dev_hdl),(value)) -#define DFS_SET_MAXPULSEDUR(dev_hdl, value) ar6000_dfs_set_maxpulsedur_cmd((dev_hdl),(value)) -#define DFS_RADAR_DETECTED(dev_hdl, ch_idx, bangradar) ar6000_dfs_radar_detected_cmd((dev_hdl),(ch_idx),(bangradar)) - -#endif /* ATH_SUPPORT_DFS */ - -#endif /* _DFS_TARGET_API_ */ diff --git a/drivers/net/wireless/ar6003/host/dfs/makefile b/drivers/net/wireless/ar6003/host/dfs/makefile deleted file mode 100644 index 1ba034c4900e..000000000000 --- a/drivers/net/wireless/ar6003/host/dfs/makefile +++ /dev/null @@ -1,26 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2005-2007 Atheros Corporation. All rights reserved. -# -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -#------------------------------------------------------------------------------ -#============================================================================== -# Author(s): ="Atheros" -#============================================================================== -!INCLUDE $(_MAKEENVROOT)\makefile.def - - - diff --git a/drivers/net/wireless/ar6003/host/hif/common/hif_bmi_reg_access.c b/drivers/net/wireless/ar6003/host/hif/common/hif_bmi_reg_access.c deleted file mode 100644 index 87af33cf811c..000000000000 --- a/drivers/net/wireless/ar6003/host/hif/common/hif_bmi_reg_access.c +++ /dev/null @@ -1,379 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// common BMI access handling for register-based HIFs -// This module implements BMI message exchanges on behalf of the BMI module for -// HIFs that are based on a register access model -// -// Author(s): ="Atheros" -//============================================================================== - -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" -#include "a_osapi.h" -#define ATH_MODULE_NAME bmi -#include "a_debug.h" -#define ATH_DEBUG_BMI ATH_DEBUG_MAKE_MODULE_MASK(0) -#include "hif.h" -#include "bmi.h" -#include "htc_api.h" -#include "target_reg_table.h" -#include "host_reg_table.h" - -#define BMI_COMMUNICATION_TIMEOUT 100000 - -static A_BOOL pendingEventsFuncCheck = FALSE; -static A_UINT32 commandCredits = 0; -static A_UINT32 *pBMICmdCredits = &commandCredits; - -/* BMI Access routines */ -static A_STATUS -bmiBufferSend(HIF_DEVICE *device, - A_UCHAR *buffer, - A_UINT32 length) -{ - A_STATUS status; - A_UINT32 timeout; - A_UINT32 address; - A_UINT32 mboxAddress[HTC_MAILBOX_NUM_MAX]; - - HIFConfigureDevice(device, HIF_DEVICE_GET_MBOX_ADDR, - &mboxAddress[0], sizeof(mboxAddress)); - - *pBMICmdCredits = 0; - timeout = BMI_COMMUNICATION_TIMEOUT; - - while(timeout-- && !(*pBMICmdCredits)) { - /* Read the counter register to get the command credits */ - address = COUNT_DEC_ADDRESS + (HTC_MAILBOX_NUM_MAX + ENDPOINT1) * 4; - /* hit the credit counter with a 4-byte access, the first byte read will hit the counter and cause - * a decrement, while the remaining 3 bytes has no effect. The rationale behind this is to - * make all HIF accesses 4-byte aligned */ - status = HIFReadWrite(device, address, (A_UINT8 *)pBMICmdCredits, 4, - HIF_RD_SYNC_BYTE_INC, NULL); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to decrement the command credit count register\n")); - return A_ERROR; - } - /* the counter is only 8=bits, ignore anything in the upper 3 bytes */ - (*pBMICmdCredits) &= 0xFF; - } - - if (*pBMICmdCredits) { - address = mboxAddress[ENDPOINT1]; - status = HIFReadWrite(device, address, buffer, length, - HIF_WR_SYNC_BYTE_INC, NULL); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to send the BMI data to the device\n")); - return A_ERROR; - } - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI Communication timeout - bmiBufferSend\n")); - return A_ERROR; - } - - return status; -} - -static A_STATUS -bmiBufferReceive(HIF_DEVICE *device, - A_UCHAR *buffer, - A_UINT32 length, - A_BOOL want_timeout) -{ - A_STATUS status; - A_UINT32 address; - A_UINT32 mboxAddress[HTC_MAILBOX_NUM_MAX]; - HIF_PENDING_EVENTS_INFO hifPendingEvents; - static HIF_PENDING_EVENTS_FUNC getPendingEventsFunc = NULL; - - if (!pendingEventsFuncCheck) { - /* see if the HIF layer implements an alternative function to get pending events - * do this only once! */ - HIFConfigureDevice(device, - HIF_DEVICE_GET_PENDING_EVENTS_FUNC, - &getPendingEventsFunc, - sizeof(HIF_PENDING_EVENTS_FUNC)); - pendingEventsFuncCheck = TRUE; - } - - HIFConfigureDevice(device, HIF_DEVICE_GET_MBOX_ADDR, - &mboxAddress[0], sizeof(mboxAddress)); - - /* - * During normal bootup, small reads may be required. - * Rather than issue an HIF Read and then wait as the Target - * adds successive bytes to the FIFO, we wait here until - * we know that response data is available. - * - * This allows us to cleanly timeout on an unexpected - * Target failure rather than risk problems at the HIF level. In - * particular, this avoids SDIO timeouts and possibly garbage - * data on some host controllers. And on an interconnect - * such as Compact Flash (as well as some SDIO masters) which - * does not provide any indication on data timeout, it avoids - * a potential hang or garbage response. - * - * Synchronization is more difficult for reads larger than the - * size of the MBOX FIFO (128B), because the Target is unable - * to push the 129th byte of data until AFTER the Host posts an - * HIF Read and removes some FIFO data. So for large reads the - * Host proceeds to post an HIF Read BEFORE all the data is - * actually available to read. Fortunately, large BMI reads do - * not occur in practice -- they're supported for debug/development. - * - * So Host/Target BMI synchronization is divided into these cases: - * CASE 1: length < 4 - * Should not happen - * - * CASE 2: 4 <= length <= 128 - * Wait for first 4 bytes to be in FIFO - * If CONSERVATIVE_BMI_READ is enabled, also wait for - * a BMI command credit, which indicates that the ENTIRE - * response is available in the the FIFO - * - * CASE 3: length > 128 - * Wait for the first 4 bytes to be in FIFO - * - * For most uses, a small timeout should be sufficient and we will - * usually see a response quickly; but there may be some unusual - * (debug) cases of BMI_EXECUTE where we want an larger timeout. - * For now, we use an unbounded busy loop while waiting for - * BMI_EXECUTE. - * - * If BMI_EXECUTE ever needs to support longer-latency execution, - * especially in production, this code needs to be enhanced to sleep - * and yield. Also note that BMI_COMMUNICATION_TIMEOUT is currently - * a function of Host processor speed. - */ - if (length >= 4) { /* NB: Currently, always true */ - /* - * NB: word_available is declared static for esoteric reasons - * having to do with protection on some OSes. - */ - static A_UINT32 word_available; - A_UINT32 timeout; - - word_available = 0; - timeout = BMI_COMMUNICATION_TIMEOUT; - while((!want_timeout || timeout--) && !word_available) { - - if (getPendingEventsFunc != NULL) { - status = getPendingEventsFunc(device, - &hifPendingEvents, - NULL); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMI: Failed to get pending events \n")); - break; - } - - if (hifPendingEvents.AvailableRecvBytes >= sizeof(A_UINT32)) { - word_available = 1; - } - continue; - } - - status = HIFReadWrite(device, RX_LOOKAHEAD_VALID_ADDRESS, (A_UINT8 *)&word_available, - sizeof(word_available), HIF_RD_SYNC_BYTE_INC, NULL); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read RX_LOOKAHEAD_VALID register\n")); - return A_ERROR; - } - /* We did a 4-byte read to the same register; all we really want is one bit */ - word_available &= (1 << ENDPOINT1); - } - - if (!word_available) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI Communication timeout - bmiBufferReceive FIFO empty\n")); - return A_ERROR; - } - } - -#define CONSERVATIVE_BMI_READ 0 -#if CONSERVATIVE_BMI_READ - /* - * This is an extra-conservative CREDIT check. It guarantees - * that ALL data is available in the FIFO before we start to - * read from the interconnect. - * - * This credit check is useless when firmware chooses to - * allow multiple outstanding BMI Command Credits, since the next - * credit will already be present. To restrict the Target to one - * BMI Command Credit, see HI_OPTION_BMI_CRED_LIMIT. - * - * And for large reads (when HI_OPTION_BMI_CRED_LIMIT is set) - * we cannot wait for the next credit because the Target's FIFO - * will not hold the entire response. So we need the Host to - * start to empty the FIFO sooner. (And again, large reads are - * not used in practice; they are for debug/development only.) - * - * For a more conservative Host implementation (which would be - * safer for a Compact Flash interconnect): - * Set CONSERVATIVE_BMI_READ (above) to 1 - * Set HI_OPTION_BMI_CRED_LIMIT and - * reduce BMI_DATASZ_MAX to 32 or 64 - */ - if ((length > 4) && (length < 128)) { /* check against MBOX FIFO size */ - A_UINT32 timeout; - - *pBMICmdCredits = 0; - timeout = BMI_COMMUNICATION_TIMEOUT; - while((!want_timeout || timeout--) && !(*pBMICmdCredits) { - /* Read the counter register to get the command credits */ - address = COUNT_ADDRESS + (HTC_MAILBOX_NUM_MAX + ENDPOINT1) * 1; - /* read the counter using a 4-byte read. Since the counter is NOT auto-decrementing, - * we can read this counter multiple times using a non-incrementing address mode. - * The rationale here is to make all HIF accesses a multiple of 4 bytes */ - status = HIFReadWrite(device, address, (A_UINT8 *)pBMICmdCredits, sizeof(*pBMICmdCredits), - HIF_RD_SYNC_BYTE_FIX, NULL); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read the command credit count register\n")); - return A_ERROR; - } - /* we did a 4-byte read to the same count register so mask off upper bytes */ - (*pBMICmdCredits) &= 0xFF; - } - - if (!(*pBMICmdCredits)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI Communication timeout- bmiBufferReceive no credit\n")); - return A_ERROR; - } - } -#endif - - address = mboxAddress[ENDPOINT1]; - status = HIFReadWrite(device, address, buffer, length, HIF_RD_SYNC_BYTE_INC, NULL); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read the BMI data from the device\n")); - return A_ERROR; - } - - return A_OK; -} - - -A_STATUS HIFRegBasedGetTargetInfo(HIF_DEVICE *device, struct bmi_target_info *targ_info) -{ - A_STATUS status; - A_UINT32 cid; - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Get Target Info: Enter (device: 0x%p)\n", device)); - cid = BMI_GET_TARGET_INFO; - - status = bmiBufferSend(device, (A_UCHAR *)&cid, sizeof(cid)); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n")); - return A_ERROR; - } - - status = bmiBufferReceive(device, (A_UCHAR *)&targ_info->target_ver, - sizeof(targ_info->target_ver), TRUE); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read Target Version from the device\n")); - return A_ERROR; - } - - if (targ_info->target_ver == TARGET_VERSION_SENTINAL) { - /* Determine how many bytes are in the Target's targ_info */ - status = bmiBufferReceive(device, (A_UCHAR *)&targ_info->target_info_byte_count, - sizeof(targ_info->target_info_byte_count), TRUE); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read Target Info Byte Count from the device\n")); - return A_ERROR; - } - - /* - * The Target's targ_info doesn't match the Host's targ_info. - * We need to do some backwards compatibility work to make this OK. - */ - A_ASSERT(targ_info->target_info_byte_count == sizeof(*targ_info)); - - /* Read the remainder of the targ_info */ - status = bmiBufferReceive(device, - ((A_UCHAR *)targ_info)+sizeof(targ_info->target_info_byte_count), - sizeof(*targ_info)-sizeof(targ_info->target_info_byte_count), TRUE); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read Target Info (%d bytes) from the device\n", - targ_info->target_info_byte_count)); - return A_ERROR; - } - } else { - /* - * Target must be an AR6001 whose firmware does not - * support BMI_GET_TARGET_INFO. Construct the data - * that it would have sent. - */ - targ_info->target_info_byte_count=sizeof(*targ_info); - targ_info->target_type=TARGET_TYPE_AR6001; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Get Target Info: Exit (ver: 0x%x type: 0x%x)\n", - targ_info->target_ver, targ_info->target_type)); - - return A_OK; -} - -A_STATUS HIFExchangeBMIMsg(HIF_DEVICE *device, - A_UINT8 *pSendMessage, - A_UINT32 Length, - A_UINT8 *pResponseMessage, - A_UINT32 *pResponseLength, - A_UINT32 TimeoutMS) -{ - A_STATUS status = A_OK; - - do { - - status = bmiBufferSend(device, pSendMessage, Length); - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI : Unable to Send Message to device \n")); - break; - } - - if (pResponseMessage != NULL) { - status = bmiBufferReceive(device, pResponseMessage, *pResponseLength, TimeoutMS ? TRUE : FALSE); - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI : Unable to read response from device \n")); - break; - } - } - - } while (FALSE); - - return status; -} - -/* TODO .. the following APIs are a relic of the old register based interface */ - -A_STATUS -BMIRawWrite(HIF_DEVICE *device, A_UCHAR *buffer, A_UINT32 length) -{ - return bmiBufferSend(device, buffer, length); -} - -A_STATUS -BMIRawRead(HIF_DEVICE *device, A_UCHAR *buffer, A_UINT32 length, A_BOOL want_timeout) -{ - return bmiBufferReceive(device, buffer, length, want_timeout); -} - - - diff --git a/drivers/net/wireless/ar6003/host/hif/common/hif_diag_reg_access.c b/drivers/net/wireless/ar6003/host/hif/common/hif_diag_reg_access.c deleted file mode 100644 index 559de163f766..000000000000 --- a/drivers/net/wireless/ar6003/host/hif/common/hif_diag_reg_access.c +++ /dev/null @@ -1,266 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// common Diagnostic access handling for register-based HIFs -// This module implements diagnostic accesses on behalf of the diagnostic window module for -// HIFs that are based on a register access model -// -// -// Author(s): ="Atheros" -//============================================================================== - - -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" -#include "a_osapi.h" -#define ATH_MODULE_NAME misc -#include "a_debug.h" - -#include "targaddrs.h" -#include "hif.h" -#include "host_reg_table.h" - -#define CPU_DBG_SEL_ADDRESS 0x00000483 -#define CPU_DBG_ADDRESS 0x00000484 - -#ifdef USE_4BYTE_REGISTER_ACCESS -/* set the window address register (using 4-byte register access ). - * This mitigates host interconnect issues with non-4byte aligned bus requests, some - * interconnects use bus adapters that impose strict limitations. - * Since diag window access is not intended for performance critical operations, the 4byte mode should - * be satisfactory even though it generates 4X the bus activity. */ -static A_STATUS ar6000_SetAddressWindowRegister(HIF_DEVICE *hifDevice, A_UINT32 RegisterAddr, A_UINT32 Address) -{ - A_STATUS status; - static A_UINT8 addrValue[4]; - A_INT32 i; - static A_UINT32 address; - - address = Address; - - - /* write bytes 1,2,3 of the register to set the upper address bytes, the LSB is written - * last to initiate the access cycle */ - - for (i = 1; i <= 3; i++) { - /* fill the buffer with the address byte value we want to hit 4 times*/ - addrValue[0] = ((A_UINT8 *)&Address)[i]; - addrValue[1] = addrValue[0]; - addrValue[2] = addrValue[0]; - addrValue[3] = addrValue[0]; - - /* hit each byte of the register address with a 4-byte write operation to the same address, - * this is a harmless operation */ - status = HIFReadWrite(hifDevice, - RegisterAddr+i, - addrValue, - 4, - HIF_WR_SYNC_BYTE_FIX, - NULL); - if (status != A_OK) { - break; - } - } - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot write initial bytes of 0x%x to window reg: 0x%X \n", - Address, RegisterAddr)); - return status; - } - - /* write the address register again, this time write the whole 4-byte value. - * The effect here is that the LSB write causes the cycle to start, the extra - * 3 byte write to bytes 1,2,3 has no effect since we are writing the same values again */ - status = HIFReadWrite(hifDevice, - RegisterAddr, - (A_UCHAR *)(&address), - 4, - HIF_WR_SYNC_BYTE_INC, - NULL); - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot write 0x%x to window reg: 0x%X \n", - Address, RegisterAddr)); - return status; - } - - return A_OK; -} -#else - -/* set the window address register */ -A_STATUS ar6000_SetAddressWindowRegister(HIF_DEVICE *hifDevice, A_UINT32 RegisterAddr, A_UINT32 Address) -{ - A_STATUS status; - - /* write bytes 1,2,3 of the register to set the upper address bytes, the LSB is written - * last to initiate the access cycle */ - status = HIFReadWrite(hifDevice, - RegisterAddr+1, /* write upper 3 bytes */ - ((A_UCHAR *)(&Address))+1, - sizeof(A_UINT32)-1, - HIF_WR_SYNC_BYTE_INC, - NULL); - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot write initial bytes of 0x%x to window reg: 0x%X \n", - RegisterAddr, Address)); - return status; - } - - /* write the LSB of the register, this initiates the operation */ - status = HIFReadWrite(hifDevice, - RegisterAddr, - (A_UCHAR *)(&Address), - sizeof(A_UINT8), - HIF_WR_SYNC_BYTE_INC, - NULL); - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot write 0x%x to window reg: 0x%X \n", - RegisterAddr, Address)); - return status; - } - - return A_OK; -} -#endif //USE_4BYTE_REGISTER_ACCESS - -/* - * Read from the AR6000 through its diagnostic window. - * No cooperation from the Target is required for this. - */ -A_STATUS -HIFDiagReadAccess(HIF_DEVICE *hifDevice, A_UINT32 address, A_UINT32 *data) -{ - A_STATUS status; - static A_UINT32 readvalue; - - /* set window register to start read cycle */ - status = ar6000_SetAddressWindowRegister(hifDevice, - WINDOW_READ_ADDR_ADDRESS, - address); - - if (status != A_OK) { - return status; - } - - /* read the data */ - status = HIFReadWrite(hifDevice, - WINDOW_DATA_ADDRESS, - (A_UCHAR *)&readvalue, - sizeof(A_UINT32), - HIF_RD_SYNC_BYTE_INC, - NULL); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot read from WINDOW_DATA_ADDRESS\n")); - return status; - } - - *data = readvalue; - - return status; -} - - -/* - * Write to the AR6000 through its diagnostic window. - * No cooperation from the Target is required for this. - */ -A_STATUS HIFDiagWriteAccess(HIF_DEVICE *hifDevice, A_UINT32 address, A_UINT32 data) -{ - A_STATUS status; - static A_UINT32 writeValue; - - writeValue = data; - - /* set write data */ - status = HIFReadWrite(hifDevice, - WINDOW_DATA_ADDRESS, - (A_UCHAR *)&writeValue, - sizeof(A_UINT32), - HIF_WR_SYNC_BYTE_INC, - NULL); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot write 0x%x to WINDOW_DATA_ADDRESS\n", data)); - return status; - } - - /* set window register, which starts the write cycle */ - return ar6000_SetAddressWindowRegister(hifDevice, - WINDOW_WRITE_ADDR_ADDRESS, - address); -} - - -/* TODO .. the following APIs are only available on register-based HIFs where the CPU_DBG_SEL_ADDRESS - * register is available */ - -A_STATUS -ar6k_ReadTargetRegister(HIF_DEVICE *hifDevice, int regsel, A_UINT32 *regval) -{ - A_STATUS status; - A_UCHAR vals[4]; - A_UCHAR register_selection[4]; - - register_selection[0] = register_selection[1] = register_selection[2] = register_selection[3] = (regsel & 0xff); - status = HIFReadWrite(hifDevice, - CPU_DBG_SEL_ADDRESS, - register_selection, - 4, - HIF_WR_SYNC_BYTE_FIX, - NULL); - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot write CPU_DBG_SEL (%d)\n", regsel)); - return status; - } - - status = HIFReadWrite(hifDevice, - CPU_DBG_ADDRESS, - (A_UCHAR *)vals, - sizeof(vals), - HIF_RD_SYNC_BYTE_INC, - NULL); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot read from CPU_DBG_ADDRESS\n")); - return status; - } - - *regval = vals[0]<<0 | vals[1]<<8 | vals[2]<<16 | vals[3]<<24; - - return status; -} - -void -ar6k_FetchTargetRegs(HIF_DEVICE *hifDevice, A_UINT32 *targregs) -{ - int i; - A_UINT32 val; - - for (i=0; iMboxProp[0].ExtendedAddress = HIF_MBOX0_EXTENDED_BASE_ADDR; - //pInfo->MboxProp[0].ExtendedSize = HIF_MBOX0_EXTENDED_WIDTH_AR6002; - - pInfo->MboxProp[0].ExtendedAddress = HIF_MBOX0_EXTENDED_BASE_ADDR_AR6003_V1; - pInfo->MboxProp[0].ExtendedSize = HIF_MBOX0_EXTENDED_WIDTH_AR6003_V1; - - break; - case MANUFACTURER_ID_AR6003_BASE : - /* MBOX 0 has an extended range */ - pInfo->MboxProp[0].ExtendedAddress = HIF_MBOX0_EXTENDED_BASE_ADDR_AR6003_V1; - pInfo->MboxProp[0].ExtendedSize = HIF_MBOX0_EXTENDED_WIDTH_AR6003_V1; - pInfo->GMboxAddress = HIF_GMBOX_BASE_ADDR; - pInfo->GMboxSize = HIF_GMBOX_WIDTH; - break; - case MANUFACTURER_ID_MCKINLEY_BASE : - pInfo->MboxProp[0].ExtendedAddress = HIF_MBOX0_EXTENDED_BASE_ADDR_AR6003_V1; /* TBDXXX */ - pInfo->MboxProp[0].ExtendedSize = HIF_MBOX0_EXTENDED_WIDTH_AR6003_V1; - break; - default: - A_ASSERT(FALSE); - break; - } -} - -/* special CCCR (func 0) registers */ - -#define CCCR_SDIO_IRQ_MODE_REG 0xF0 /* interrupt mode register */ -#define SDIO_IRQ_MODE_ASYNC_4BIT_IRQ (1 << 0) /* mode to enable special 4-bit interrupt assertion without clock*/ - -#endif /*HIF_SDIO_COMMON_H_*/ diff --git a/drivers/net/wireless/ar6003/host/hif/common/makefile b/drivers/net/wireless/ar6003/host/hif/common/makefile deleted file mode 100644 index 4cab10f2397a..000000000000 --- a/drivers/net/wireless/ar6003/host/hif/common/makefile +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2005-2007 Atheros Corporation. All rights reserved. -# -# -# -#------------------------------------------------------------------------------ -#============================================================================== -# Author(s): ="Atheros" -#============================================================================== -!INCLUDE $(_MAKEENVROOT)\makefile.def - diff --git a/drivers/net/wireless/ar6003/host/hif/sdio/Makefile b/drivers/net/wireless/ar6003/host/hif/sdio/Makefile deleted file mode 100644 index 17c3d8c594da..000000000000 --- a/drivers/net/wireless/ar6003/host/hif/sdio/Makefile +++ /dev/null @@ -1,90 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2005-2008 Atheros Corporation. All rights reserved. -# -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -#------------------------------------------------------------------------------ -#============================================================================== -# Author(s): ="Atheros" -#============================================================================== - -# -#SDIO HIF makefile for atheros SDIO stack -# - -# Check for SDIO stack -ifdef ATH_SDIO_STACK_BASE -# Someone already set it on entry, the stack resides outside this tree, we will try to build it -_SDIO_STACK = YES -else -# Check for SDIO stack within this tree -_SDIO_STACK = $(shell if [ -f $(ATH_SRC_BASE)/sdiostack/src/Makefile ]; then echo "YES"; else echo "NO"; fi) - -ifeq ($(_SDIO_STACK), YES) - # SDIO stack is part of the kit and will need to be compiled -ATH_SDIO_STACK_BASE := $(ATH_SRC_BASE)/sdiostack -endif -endif - - -ifeq ($(ATH_BUS_SUBTYPE),linux_sdio) -_HIF_SUB_TYPE = linux_sdio -_SDIO_STACK = NO -else -_HIF_SUB_TYPE = linux_athsdio -endif - - -ifeq ($(_SDIO_STACK), YES) - # Pass and translate build variables to the SDIO stack makefile -_SDIO_STACK_MAKE_PARAMS := CT_BUILD_TYPE=$(ATH_BUILD_TYPE) \ - CT_OS_TYPE=linux \ - CT_OS_SUB_TYPE=$(ATH_OS_SUB_TYPE) \ - CT_LINUXPATH=$(ATH_LINUXPATH) \ - CT_BUILD_TYPE=$(ATH_BUILD_TYPE) \ - CT_CROSS_COMPILE_TYPE=$(ATH_CROSS_COMPILE_TYPE) \ - CT_ARCH_CPU_TYPE=$(ATH_ARCH_CPU_TYPE) \ - CT_HC_DRIVERS=$(ATH_HC_DRIVERS) \ - CT_MAKE_INCLUDE_OVERRIDE=$(_LOCALMAKE_INCLUDE) \ - CT_BUILD_OUTPUT_OVERRIDE=$(COMPILED_IMAGE_OBJECTS_PATH) \ - BUS_BUILD=1 -endif -EXTRA_CFLAGS += -I$(ATH_SRC_BASE)/hif/sdio/$(_HIF_SUB_TYPE)/include -EXTRA_CFLAGS += -DSDIO -EXTRA_CFLAGS += -I$(ATH_SDIO_STACK_BASE)/src/include - -ifeq ($(ATH_OS_SUB_TYPE),linux_2_4) -obj-y += ../../hif/sdio/linux_athsdio/src/hif.o -obj-y += ../../hif/sdio/linux_athsdio/src/hif_scatter.o -endif - -ifneq ($(ATH_OS_SUB_TYPE),linux_2_4) -ar6000-objs := ../../hif/sdio/$(_HIF_SUB_TYPE)/src/hif.o \ - ../../hif/sdio/$(_HIF_SUB_TYPE)/src/hif_scatter.o - - -endif - -all: -ifeq ($(_SDIO_STACK),YES) - $(MAKE) $(_SDIO_STACK_MAKE_PARAMS) -C $(ATH_SDIO_STACK_BASE)/src default - -cp -f $(ATH_SDIO_STACK_BASE)/src/Module.symvers $(COMPILED_IMAGE_OBJECTS_PATH) -endif - -clean: -ifeq ($(_SDIO_STACK),YES) - $(MAKE) $(_SDIO_STACK_MAKE_PARAMS) -C $(ATH_SDIO_STACK_BASE)/src clean -endif diff --git a/drivers/net/wireless/ar6003/host/hif/sdio/linux_sdio/include/hif_internal.h b/drivers/net/wireless/ar6003/host/hif/sdio/linux_sdio/include/hif_internal.h deleted file mode 100644 index df6ab6aeb56c..000000000000 --- a/drivers/net/wireless/ar6003/host/hif/sdio/linux_sdio/include/hif_internal.h +++ /dev/null @@ -1,137 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// internal header file for hif layer -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _HIF_INTERNAL_H_ -#define _HIF_INTERNAL_H_ - -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" -#include "a_osapi.h" -#include "hif.h" -#include "../../../common/hif_sdio_common.h" -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) -#include -//#define HIF_LINUX_MMC_SCATTER_SUPPORT -#endif - -#define BUS_REQUEST_MAX_NUM 64 - -#define SDIO_CLOCK_FREQUENCY_DEFAULT 25000000 -#define SDWLAN_ENABLE_DISABLE_TIMEOUT 20 -#define FLAGS_CARD_ENAB 0x02 -#define FLAGS_CARD_IRQ_UNMSK 0x04 - -#define HIF_MBOX_BLOCK_SIZE HIF_DEFAULT_IO_BLOCK_SIZE -#define HIF_MBOX0_BLOCK_SIZE 1 -#define HIF_MBOX1_BLOCK_SIZE HIF_MBOX_BLOCK_SIZE -#define HIF_MBOX2_BLOCK_SIZE HIF_MBOX_BLOCK_SIZE -#define HIF_MBOX3_BLOCK_SIZE HIF_MBOX_BLOCK_SIZE - -struct _HIF_SCATTER_REQ_PRIV; - -typedef struct bus_request { - struct bus_request *next; /* link list of available requests */ - struct bus_request *inusenext; /* link list of in use requests */ - struct semaphore sem_req; - A_UINT32 address; /* request data */ - A_UCHAR *buffer; - A_UINT32 length; - A_UINT32 request; - void *context; - A_STATUS status; - struct _HIF_SCATTER_REQ_PRIV *pScatterReq; /* this request is a scatter request */ -} BUS_REQUEST; - -struct hif_device { - struct sdio_func *func; - spinlock_t asynclock; - struct task_struct* async_task; /* task to handle async commands */ - struct semaphore sem_async; /* wake up for async task */ - int async_shutdown; /* stop the async task */ - struct completion async_completion; /* thread completion */ - BUS_REQUEST *asyncreq; /* request for async tasklet */ - BUS_REQUEST *taskreq; /* async tasklet data */ - spinlock_t lock; - BUS_REQUEST *s_busRequestFreeQueue; /* free list */ - BUS_REQUEST busRequest[BUS_REQUEST_MAX_NUM]; /* available bus requests */ - void *claimedContext; - HTC_CALLBACKS htcCallbacks; - A_UINT8 *dma_buffer; - DL_LIST ScatterReqHead; /* scatter request list head */ - A_BOOL scatter_enabled; /* scatter enabled flag */ - A_BOOL is_suspend; - A_BOOL is_disabled; - atomic_t irqHandling; - HIF_DEVICE_POWER_CHANGE_TYPE powerConfig; - const struct sdio_device_id *id; - struct mmc_host *host; -}; - -#define HIF_DMA_BUFFER_SIZE (32 * 1024) -#define CMD53_FIXED_ADDRESS 1 -#define CMD53_INCR_ADDRESS 2 - -BUS_REQUEST *hifAllocateBusRequest(HIF_DEVICE *device); -void hifFreeBusRequest(HIF_DEVICE *device, BUS_REQUEST *busrequest); -void AddToAsyncList(HIF_DEVICE *device, BUS_REQUEST *busrequest); - -#ifdef HIF_LINUX_MMC_SCATTER_SUPPORT - -#define MAX_SCATTER_REQUESTS 4 -#define MAX_SCATTER_ENTRIES_PER_REQ 16 -#define MAX_SCATTER_REQ_TRANSFER_SIZE 32*1024 - -typedef struct _HIF_SCATTER_REQ_PRIV { - HIF_SCATTER_REQ *pHifScatterReq; /* HIF scatter request with allocated entries */ - HIF_DEVICE *device; /* this device */ - BUS_REQUEST *busrequest; /* request associated with request */ - /* scatter list for linux */ - struct scatterlist sgentries[MAX_SCATTER_ENTRIES_PER_REQ]; -} HIF_SCATTER_REQ_PRIV; - -#define ATH_DEBUG_SCATTER ATH_DEBUG_MAKE_MODULE_MASK(0) - -A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_INFO *pInfo); -void CleanupHIFScatterResources(HIF_DEVICE *device); -A_STATUS DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest); - -#else // HIF_LINUX_MMC_SCATTER_SUPPORT - -static inline A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_INFO *pInfo) -{ - return A_ENOTSUP; -} - -static inline A_STATUS DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest) -{ - return A_ENOTSUP; -} - -#define CleanupHIFScatterResources(d) { } - -#endif // HIF_LINUX_MMC_SCATTER_SUPPORT - -#endif // _HIF_INTERNAL_H_ - diff --git a/drivers/net/wireless/ar6003/host/hif/sdio/linux_sdio/src/hif.c b/drivers/net/wireless/ar6003/host/hif/sdio/linux_sdio/src/hif.c deleted file mode 100644 index dfca63fd4f9e..000000000000 --- a/drivers/net/wireless/ar6003/host/hif/sdio/linux_sdio/src/hif.c +++ /dev/null @@ -1,1504 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// HIF layer reference implementation for Linux Native MMC stack -// -// Author(s): ="Atheros" -//============================================================================== -#include -#include -#include -#include -#include -#include -#include -#include -#include "common_drv.h" -#include "host_reg_table.h" - -/* by default setup a bounce buffer for the data packets, if the underlying host controller driver - does not use DMA you may be able to skip this step and save the memory allocation and transfer time */ -#define HIF_USE_DMA_BOUNCE_BUFFER 1 -#include "hif_internal.h" -#define ATH_MODULE_NAME hif -#include "a_debug.h" - -#if HIF_USE_DMA_BOUNCE_BUFFER -/* macro to check if DMA buffer is WORD-aligned and DMA-able. Most host controllers assume the - * buffer is DMA'able and will bug-check otherwise (i.e. buffers on the stack). - * virt_addr_valid check fails on stack memory. - */ -#define BUFFER_NEEDS_BOUNCE(buffer) (((unsigned long)(buffer) & 0x3) || !virt_addr_valid((buffer))) -#else -#define BUFFER_NEEDS_BOUNCE(buffer) (FALSE) -#endif - -#define MAX_HIF_DEVICES 2 - -/* ATHENV */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) && defined(CONFIG_PM) -#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev) -#define to_sdio_driver(d) container_of(d, struct sdio_driver, drv) -static int hifDeviceSuspend(struct device *dev); -static int hifDeviceResume(struct device *dev); -#endif /* CONFIG_PM */ -static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id *id); -static void hifDeviceRemoved(struct sdio_func *func); -static HIF_DEVICE *addHifDevice(struct sdio_func *func); -static HIF_DEVICE *getHifDevice(struct sdio_func *func); -static void delHifDevice(HIF_DEVICE * device); -static int Func0_CMD52WriteByte(struct mmc_card *card, unsigned int address, unsigned char byte); -static int Func0_CMD52ReadByte(struct mmc_card *card, unsigned int address, unsigned char *byte); -void hif_register_tbl_attach(A_UINT32 hif_type); - -int reset_sdio_on_unload = 0; -module_param(reset_sdio_on_unload, int, 0644); - -extern A_UINT32 nohifscattersupport; - - -/* ------ Static Variables ------ */ -static const struct sdio_device_id ar6k_id_table[] = { -#ifdef AR6003_HEADERS_DEF - { SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x0)) }, - { SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x1)) }, -#endif - { /* null */ }, -}; -MODULE_DEVICE_TABLE(sdio, ar6k_id_table); - -static struct sdio_driver ar6k_driver = { - .name = "ar6k_wlan", - .id_table = ar6k_id_table, - .probe = hifDeviceInserted, - .remove = hifDeviceRemoved, -}; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) && defined(CONFIG_PM) -/* New suspend/resume based on linux-2.6.32 - * Need to patch linux-2.6.32 with mmc2.6.32_suspend.patch - * Need to patch with msmsdcc2.6.29_suspend.patch for msm_sdcc host - */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) -static struct dev_pm_ops ar6k_device_pm_ops = { -#else -static struct pm_ops ar6k_device_pm_ops = { -#endif - .suspend = hifDeviceSuspend, - .resume = hifDeviceResume, -}; -#endif /* CONFIG_PM */ - -/* make sure we only unregister when registered. */ -static int registered = 0; - -OSDRV_CALLBACKS osdrvCallbacks; -extern A_UINT32 onebitmode; -extern A_UINT32 busspeedlow; -extern A_UINT32 debughif; - -static HIF_DEVICE *hif_devices[MAX_HIF_DEVICES]; - -static void ResetAllCards(void); -static A_STATUS hifDisableFunc(HIF_DEVICE *device, struct sdio_func *func); -static A_STATUS hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func); - -#ifdef DEBUG - -ATH_DEBUG_INSTANTIATE_MODULE_VAR(hif, - "hif", - "(Linux MMC) Host Interconnect Framework", - ATH_DEBUG_MASK_DEFAULTS, - 0, - NULL); - -#endif - - -/* ------ Functions ------ */ -A_STATUS HIFInit(OSDRV_CALLBACKS *callbacks) -{ - int status; - AR_DEBUG_ASSERT(callbacks != NULL); - - A_REGISTER_MODULE_DEBUG_INFO(hif); - - /* store the callback handlers */ - osdrvCallbacks = *callbacks; - - /* Register with bus driver core */ - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: HIFInit registering\n")); - registered = 1; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) && defined(CONFIG_PM) - if (callbacks->deviceSuspendHandler && callbacks->deviceResumeHandler) { - ar6k_driver.drv.pm = &ar6k_device_pm_ops; - } -#endif /* CONFIG_PM */ - status = sdio_register_driver(&ar6k_driver); - AR_DEBUG_ASSERT(status==0); - - if (status != 0) { - return A_ERROR; - } - - return A_OK; - -} - -static A_STATUS -__HIFReadWrite(HIF_DEVICE *device, - A_UINT32 address, - A_UCHAR *buffer, - A_UINT32 length, - A_UINT32 request, - void *context) -{ - A_UINT8 opcode; - A_STATUS status = A_OK; - int ret; - A_UINT8 *tbuffer; - A_BOOL bounced = FALSE; - - AR_DEBUG_ASSERT(device != NULL); - AR_DEBUG_ASSERT(device->func != NULL); - - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Device: 0x%p, buffer:0x%p (addr:0x%X)\n", - device, buffer, address)); - - do { - if (request & HIF_EXTENDED_IO) { - //AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Command type: CMD53\n")); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, - ("AR6000: Invalid command type: 0x%08x\n", request)); - status = A_EINVAL; - break; - } - - if (request & HIF_BLOCK_BASIS) { - /* round to whole block length size */ - length = (length / HIF_MBOX_BLOCK_SIZE) * HIF_MBOX_BLOCK_SIZE; - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, - ("AR6000: Block mode (BlockLen: %d)\n", - length)); - } else if (request & HIF_BYTE_BASIS) { - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, - ("AR6000: Byte mode (BlockLen: %d)\n", - length)); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, - ("AR6000: Invalid data mode: 0x%08x\n", request)); - status = A_EINVAL; - break; - } - -#if 0 - /* useful for checking register accesses */ - if (length & 0x3) { - A_PRINTF(KERN_ALERT"AR6000: HIF (%s) is not a multiple of 4 bytes, addr:0x%X, len:%d\n", - request & HIF_WRITE ? "write":"read", address, length); - } -#endif - - if (request & HIF_WRITE) { - if ((address >= HIF_MBOX_START_ADDR(0)) && - (address <= HIF_MBOX_END_ADDR(3))) - { - - AR_DEBUG_ASSERT(length <= HIF_MBOX_WIDTH); - - /* - * Mailbox write. Adjust the address so that the last byte - * falls on the EOM address. - */ - address += (HIF_MBOX_WIDTH - length); - } - } - - if (request & HIF_FIXED_ADDRESS) { - opcode = CMD53_FIXED_ADDRESS; - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Address mode: Fixed 0x%X\n", address)); - } else if (request & HIF_INCREMENTAL_ADDRESS) { - opcode = CMD53_INCR_ADDRESS; - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Address mode: Incremental 0x%X\n", address)); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, - ("AR6000: Invalid address mode: 0x%08x\n", request)); - status = A_EINVAL; - break; - } - - if (request & HIF_WRITE) { -#if HIF_USE_DMA_BOUNCE_BUFFER - if (BUFFER_NEEDS_BOUNCE(buffer)) { - AR_DEBUG_ASSERT(device->dma_buffer != NULL); - tbuffer = device->dma_buffer; - /* copy the write data to the dma buffer */ - AR_DEBUG_ASSERT(length <= HIF_DMA_BUFFER_SIZE); - memcpy(tbuffer, buffer, length); - bounced = TRUE; - } else { - tbuffer = buffer; - } -#else - tbuffer = buffer; -#endif - if (opcode == CMD53_FIXED_ADDRESS) { - ret = sdio_writesb(device->func, address, tbuffer, length); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: writesb ret=%d address: 0x%X, len: %d, 0x%X\n", - ret, address, length, *(int *)tbuffer)); - } else { - ret = sdio_memcpy_toio(device->func, address, tbuffer, length); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: writeio ret=%d address: 0x%X, len: %d, 0x%X\n", - ret, address, length, *(int *)tbuffer)); - } - } else if (request & HIF_READ) { -#if HIF_USE_DMA_BOUNCE_BUFFER - if (BUFFER_NEEDS_BOUNCE(buffer)) { - AR_DEBUG_ASSERT(device->dma_buffer != NULL); - AR_DEBUG_ASSERT(length <= HIF_DMA_BUFFER_SIZE); - tbuffer = device->dma_buffer; - bounced = TRUE; - } else { - tbuffer = buffer; - } -#else - tbuffer = buffer; -#endif - if (opcode == CMD53_FIXED_ADDRESS) { - ret = sdio_readsb(device->func, tbuffer, address, length); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: readsb ret=%d address: 0x%X, len: %d, 0x%X\n", - ret, address, length, *(int *)tbuffer)); - } else { - ret = sdio_memcpy_fromio(device->func, tbuffer, address, length); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: readio ret=%d address: 0x%X, len: %d, 0x%X\n", - ret, address, length, *(int *)tbuffer)); - } -#if HIF_USE_DMA_BOUNCE_BUFFER - if (bounced) { - /* copy the read data from the dma buffer */ - memcpy(buffer, tbuffer, length); - } -#endif - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, - ("AR6000: Invalid direction: 0x%08x\n", request)); - status = A_EINVAL; - break; - } - - if (ret) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, - ("AR6000: SDIO bus operation failed! MMC stack returned : %d \n", ret)); - status = A_ERROR; - } - } while (FALSE); - - return status; -} - -void AddToAsyncList(HIF_DEVICE *device, BUS_REQUEST *busrequest) -{ - unsigned long flags; - BUS_REQUEST *async; - BUS_REQUEST *active; - - spin_lock_irqsave(&device->asynclock, flags); - active = device->asyncreq; - if (active == NULL) { - device->asyncreq = busrequest; - device->asyncreq->inusenext = NULL; - } else { - for (async = device->asyncreq; - async != NULL; - async = async->inusenext) { - active = async; - } - active->inusenext = busrequest; - busrequest->inusenext = NULL; - } - spin_unlock_irqrestore(&device->asynclock, flags); -} - - -/* queue a read/write request */ -A_STATUS -HIFReadWrite(HIF_DEVICE *device, - A_UINT32 address, - A_UCHAR *buffer, - A_UINT32 length, - A_UINT32 request, - void *context) -{ - A_STATUS status = A_OK; - BUS_REQUEST *busrequest; - - - AR_DEBUG_ASSERT(device != NULL); - AR_DEBUG_ASSERT(device->func != NULL); - - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Device: %p addr:0x%X\n", device,address)); - - do { - if ((request & HIF_ASYNCHRONOUS) || (request & HIF_SYNCHRONOUS)){ - /* serialize all requests through the async thread */ - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Execution mode: %s\n", - (request & HIF_ASYNCHRONOUS)?"Async":"Synch")); - busrequest = hifAllocateBusRequest(device); - if (busrequest == NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, - ("AR6000: no async bus requests available (%s, addr:0x%X, len:%d) \n", - request & HIF_READ ? "READ":"WRITE", address, length)); - return A_ERROR; - } - busrequest->address = address; - busrequest->buffer = buffer; - busrequest->length = length; - busrequest->request = request; - busrequest->context = context; - - AddToAsyncList(device, busrequest); - - if (request & HIF_SYNCHRONOUS) { - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: queued sync req: 0x%lX\n", (unsigned long)busrequest)); - - /* wait for completion */ - up(&device->sem_async); - if (down_interruptible(&busrequest->sem_req) != 0) { - /* interrupted, exit */ - return A_ERROR; - } else { - A_STATUS status = busrequest->status; - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: sync return freeing 0x%lX: 0x%X\n", - (unsigned long)busrequest, busrequest->status)); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: freeing req: 0x%X\n", (unsigned int)request)); - hifFreeBusRequest(device, busrequest); - return status; - } - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: queued async req: 0x%lX\n", (unsigned long)busrequest)); - up(&device->sem_async); - return A_PENDING; - } - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, - ("AR6000: Invalid execution mode: 0x%08x\n", (unsigned int)request)); - status = A_EINVAL; - break; - } - } while(0); - - return status; -} -/* thread to serialize all requests, both sync and async */ -static int async_task(void *param) - { - HIF_DEVICE *device; - BUS_REQUEST *request; - A_STATUS status; - unsigned long flags; - - device = (HIF_DEVICE *)param; - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: async task\n")); - set_current_state(TASK_INTERRUPTIBLE); - while(!device->async_shutdown) { - /* wait for work */ - if (down_interruptible(&device->sem_async) != 0) { - /* interrupted, exit */ - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: async task interrupted\n")); - break; - } - if (device->async_shutdown) { - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: async task stopping\n")); - break; - } - /* we want to hold the host over multiple cmds if possible, but holding the host blocks card interrupts */ - sdio_claim_host(device->func); - spin_lock_irqsave(&device->asynclock, flags); - /* pull the request to work on */ - while (device->asyncreq != NULL) { - request = device->asyncreq; - if (request->inusenext != NULL) { - device->asyncreq = request->inusenext; - } else { - device->asyncreq = NULL; - } - spin_unlock_irqrestore(&device->asynclock, flags); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: async_task processing req: 0x%lX\n", (unsigned long)request)); - - if (request->pScatterReq != NULL) { - A_ASSERT(device->scatter_enabled); - /* this is a queued scatter request, pass the request to scatter routine which - * executes it synchronously, note, no need to free the request since scatter requests - * are maintained on a separate list */ - status = DoHifReadWriteScatter(device,request); - } else { - /* call HIFReadWrite in sync mode to do the work */ - status = __HIFReadWrite(device, request->address, request->buffer, - request->length, request->request & ~HIF_SYNCHRONOUS, NULL); - if (request->request & HIF_ASYNCHRONOUS) { - void *context = request->context; - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: async_task freeing req: 0x%lX\n", (unsigned long)request)); - hifFreeBusRequest(device, request); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: async_task completion routine req: 0x%lX\n", (unsigned long)request)); - device->htcCallbacks.rwCompletionHandler(context, status); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: async_task upping req: 0x%lX\n", (unsigned long)request)); - request->status = status; - up(&request->sem_req); - } - } - spin_lock_irqsave(&device->asynclock, flags); - } - spin_unlock_irqrestore(&device->asynclock, flags); - sdio_release_host(device->func); - } - - complete_and_exit(&device->async_completion, 0); - return 0; -} - -static A_INT32 IssueSDCommand(HIF_DEVICE *device, A_UINT32 opcode, A_UINT32 arg, A_UINT32 flags, A_UINT32 *resp) -{ - struct mmc_command cmd; - A_INT32 err; - struct mmc_host *host; - struct sdio_func *func; - - func = device->func; - host = func->card->host; - - memset(&cmd, 0, sizeof(struct mmc_command)); - cmd.opcode = opcode; - cmd.arg = arg; - cmd.flags = flags; - err = mmc_wait_for_cmd(host, &cmd, 3); - - if ((!err) && (resp)) { - *resp = cmd.resp[0]; - } - - return err; -} -A_STATUS ReinitSDIO(HIF_DEVICE *device) -{ - A_INT32 err = 0; - struct mmc_host *host; - struct mmc_card *card; - struct sdio_func *func; - A_UINT8 cmd52_resp; - A_UINT32 clock; - - func = device->func; - card = func->card; - host = card->host; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +ReinitSDIO \n")); - sdio_claim_host(func); - - do { - /* 2.6.32 kernel does part of the SDIO initalization upon resume */ - A_BOOL lt_2_6_32 = (LINUX_VERSION_CODEocr_avail) - 1; - /* emulate the mmc_power_up(...) */ - host->ios.vdd = bit; - host->ios.chip_select = MMC_CS_DONTCARE; - host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; - host->ios.power_mode = MMC_POWER_UP; - host->ios.bus_width = MMC_BUS_WIDTH_1; - host->ios.timing = MMC_TIMING_LEGACY; - host->ops->set_ios(host, &host->ios); - /* - * This delay should be sufficient to allow the power supply - * to reach the minimum voltage. - */ - msleep(2); - - host->ios.clock = host->f_min; - host->ios.power_mode = MMC_POWER_ON; - host->ops->set_ios(host, &host->ios); - - /* - * This delay must be at least 74 clock sizes, or 1 ms, or the - * time required to reach a stable voltage. - */ - msleep(2); - - /* Issue CMD0. Goto idle state */ - host->ios.chip_select = MMC_CS_HIGH; - host->ops->set_ios(host, &host->ios); - msleep(1); - err = IssueSDCommand(device, MMC_GO_IDLE_STATE, 0, (MMC_RSP_NONE | MMC_CMD_BC), NULL); - host->ios.chip_select = MMC_CS_DONTCARE; - host->ops->set_ios(host, &host->ios); - msleep(1); - host->use_spi_crc = 0; - - if (err) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD0 failed : %d \n",err)); - break; - } - - if (!host->ocr) { - /* Issue CMD5, arg = 0 */ - err = IssueSDCommand(device, SD_IO_SEND_OP_COND, 0, (MMC_RSP_R4 | MMC_CMD_BCR), &resp); - if (err) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD5 failed : %d \n",err)); - break; - } - host->ocr = resp; - } - - /* Issue CMD5, arg = ocr. Wait till card is ready */ - for (i=0;i<100;i++) { - err = IssueSDCommand(device, SD_IO_SEND_OP_COND, host->ocr, (MMC_RSP_R4 | MMC_CMD_BCR), &resp); - if (err) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD5 failed : %d \n",err)); - break; - } - if (resp & MMC_CARD_BUSY) { - break; - } - msleep(10); - } - - if ((i == 100) || (err)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: card in not ready : %d %d \n",i,err)); - break; - } - - /* Issue CMD3, get RCA */ - err = IssueSDCommand(device, SD_SEND_RELATIVE_ADDR, 0, MMC_RSP_R6 | MMC_CMD_BCR, &resp); - if (err) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD3 failed : %d \n",err)); - break; - } - rca = resp >> 16; - host->ios.bus_mode = MMC_BUSMODE_PUSHPULL; - host->ops->set_ios(host, &host->ios); - - /* Issue CMD7, select card */ - err = IssueSDCommand(device, MMC_SELECT_CARD, (rca << 16), MMC_RSP_R1 | MMC_CMD_AC, NULL); - if (err) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD7 failed : %d \n",err)); - break; - } - } - - /* Enable high speed */ - if (card->host->caps & MMC_CAP_SD_HIGHSPEED) { - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("ReinitSDIO: Set high speed mode\n")); - err = Func0_CMD52ReadByte(card, SDIO_CCCR_SPEED, &cmd52_resp); - if (err) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD52 read to CCCR speed register failed : %d \n",err)); - card->state &= ~MMC_STATE_HIGHSPEED; - /* no need to break */ - } else { - err = Func0_CMD52WriteByte(card, SDIO_CCCR_SPEED, (cmd52_resp | SDIO_SPEED_EHS)); - if (err) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD52 write to CCCR speed register failed : %d \n",err)); - break; - } - mmc_card_set_highspeed(card); - host->ios.timing = MMC_TIMING_SD_HS; - host->ops->set_ios(host, &host->ios); - } - } - - /* Set clock */ - if (mmc_card_highspeed(card)) { - clock = 50000000; - } else { - clock = card->cis.max_dtr; - } - - if (clock > host->f_max) { - clock = host->f_max; - } - host->ios.clock = clock; - host->ops->set_ios(host, &host->ios); - - - if (card->host->caps & MMC_CAP_4_BIT_DATA) { - /* CMD52: Set bus width & disable card detect resistor */ - err = Func0_CMD52WriteByte(card, SDIO_CCCR_IF, SDIO_BUS_CD_DISABLE | SDIO_BUS_WIDTH_4BIT); - if (err) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD52 to set bus mode failed : %d \n",err)); - break; - } - host->ios.bus_width = MMC_BUS_WIDTH_4; - host->ops->set_ios(host, &host->ios); - } - } while (0); - - sdio_release_host(func); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -ReinitSDIO \n")); - - return (err) ? A_ERROR : A_OK; -} - -#if defined(CONFIG_PM) -/* - * Setup IRQ mode for deep sleep and WoW - * Switch back to 1 bits mode when we suspend for WoW in order to - * detect SDIO irq without clock. - * Re-enable async 4-bit irq mode for some host controllers after resume - */ -static int SdioEnable4bits(HIF_DEVICE *device, int enable) -{ - int ret = 0; - struct sdio_func *func = device->func; - struct mmc_card *card = func->card; - struct mmc_host *host = card->host; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) - unsigned char ctrl = 0; - unsigned int width; -#ifdef SDIO_BUS_WIDTH_8BIT - unsigned char wide_mask = (SDIO_BUS_WIDTH_4BIT|SDIO_BUS_WIDTH_8BIT); -#else - unsigned char wide_mask = (SDIO_BUS_WIDTH_4BIT); -#endif -#endif - - if (!(host->caps & (MMC_CAP_4_BIT_DATA))) - return 0; - - if (card->cccr.low_speed && !card->cccr.wide_bus) - return 0; - - sdio_claim_host(func); - do { - /* 2.6.34 will setup 1bits automatically. No need to setup */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) - ret = Func0_CMD52ReadByte(card, SDIO_CCCR_IF, &ctrl); - if (ret) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Fail to read CCCR_IF : %d \n", __func__, ret)); - break; - } - if (enable) { - width = MMC_BUS_WIDTH_4; - ctrl &= ~(SDIO_BUS_WIDTH_1BIT|wide_mask); - ctrl |= SDIO_BUS_WIDTH_4BIT; - } else { - width = MMC_BUS_WIDTH_1; - ctrl &= ~(wide_mask); - } - - ret = Func0_CMD52WriteByte(card, SDIO_CCCR_IF, ctrl); - if (ret) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Fail to write CCCR_IF : %d \n", __func__, ret)); - break; - } - host->ios.bus_width = width; - host->ops->set_ios(host, &host->ios); -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) */ - - if ((device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK) >= MANUFACTURER_ID_AR6003_BASE) { - /* Re-enable 4-bit ASYNC interrupt on AR6003x after system resume for some host controller */ - ret = Func0_CMD52WriteByte(func->card, CCCR_SDIO_IRQ_MODE_REG, enable ? SDIO_IRQ_MODE_ASYNC_4BIT_IRQ : 0); - if (ret) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("AR6000: failed to setup 4-bit ASYNC IRQ mode into %d err %d \n", enable, ret)); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("AR6000: Setup 4-bit ASYNC IRQ mode into %d successfully\n", enable)); - } - } - } while (0); - sdio_release_host(func); - return ret; -} -#endif -A_STATUS -PowerStateChangeNotify(HIF_DEVICE *device, HIF_DEVICE_POWER_CHANGE_TYPE config) -{ - A_STATUS status = A_OK; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) && defined(CONFIG_PM) - struct sdio_func *func = device->func; - int old_reset_val; - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +PowerStateChangeNotify %d\n", config)); - switch (config) { - case HIF_DEVICE_POWER_DOWN: - /* Disable 4bits in order to let SDIO bus detect DAT1 as interrupt source */ - SdioEnable4bits(device, 0); - break; - case HIF_DEVICE_POWER_CUT: - old_reset_val = reset_sdio_on_unload; - reset_sdio_on_unload = 1; - status = hifDisableFunc(device, func); - reset_sdio_on_unload = old_reset_val; - if (!device->is_suspend) { - device->powerConfig = config; - mmc_detect_change(device->host, HZ/3); - } - break; - case HIF_DEVICE_POWER_UP: - if (device->powerConfig == HIF_DEVICE_POWER_CUT) { - if (device->is_suspend) { - status = ReinitSDIO(device); - if (status == A_OK) { - status = hifEnableFunc(device, func); - } - } else { - /* device->func is bad pointer at this time */ - mmc_detect_change(device->host, 0); - return A_PENDING; /* Don't change powerConfig status */ - } - } else if (device->powerConfig == HIF_DEVICE_POWER_DOWN) { - int ret = SdioEnable4bits(device, 1); - status = (ret==0) ? A_OK : A_ERROR; - } - break; - } - device->powerConfig = config; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -PowerStateChangeNotify\n")); -#endif - return status; -} - -A_STATUS -HIFConfigureDevice(HIF_DEVICE *device, HIF_DEVICE_CONFIG_OPCODE opcode, - void *config, A_UINT32 configLen) -{ - A_UINT32 count; - A_STATUS status = A_OK; - - switch(opcode) { - case HIF_DEVICE_GET_MBOX_BLOCK_SIZE: - ((A_UINT32 *)config)[0] = HIF_MBOX0_BLOCK_SIZE; - ((A_UINT32 *)config)[1] = HIF_MBOX1_BLOCK_SIZE; - ((A_UINT32 *)config)[2] = HIF_MBOX2_BLOCK_SIZE; - ((A_UINT32 *)config)[3] = HIF_MBOX3_BLOCK_SIZE; - break; - - case HIF_DEVICE_GET_MBOX_ADDR: - for (count = 0; count < 4; count ++) { - ((A_UINT32 *)config)[count] = HIF_MBOX_START_ADDR(count); - } - - if (configLen >= sizeof(HIF_DEVICE_MBOX_INFO)) { - SetExtendedMboxWindowInfo((A_UINT16)device->func->device, - (HIF_DEVICE_MBOX_INFO *)config); - } - - break; - case HIF_DEVICE_GET_PENDING_EVENTS_FUNC: - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("AR6000: configuration opcode %d is not used for Linux SDIO stack", opcode)); - status = A_ERROR; - break; - case HIF_DEVICE_GET_IRQ_PROC_MODE: - *((HIF_DEVICE_IRQ_PROCESSING_MODE *)config) = HIF_DEVICE_IRQ_SYNC_ONLY; - break; - case HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC: - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("AR6000: configuration opcode %d is not used for Linux SDIO stack", opcode)); - status = A_ERROR; - break; - case HIF_CONFIGURE_QUERY_SCATTER_REQUEST_SUPPORT: - if (!device->scatter_enabled) { - return A_ENOTSUP; - } - status = SetupHIFScatterSupport(device, (HIF_DEVICE_SCATTER_SUPPORT_INFO *)config); - if (A_FAILED(status)) { - device->scatter_enabled = FALSE; - } - break; - case HIF_DEVICE_GET_OS_DEVICE: - /* pass back a pointer to the SDIO function's "dev" struct */ - if (device->func) { - ((HIF_DEVICE_OS_DEVICE_INFO *)config)->pOSDevice = &device->func->dev; - } else { - ((HIF_DEVICE_OS_DEVICE_INFO *)config)->pOSDevice = NULL; - status = A_DEVICE_NOT_FOUND; - } - break; - case HIF_DEVICE_POWER_STATE_CHANGE: - status = PowerStateChangeNotify(device, *(HIF_DEVICE_POWER_CHANGE_TYPE *)config); - break; - case HIF_DEVICE_GET_IRQ_YIELD_PARAMS: - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, - ("AR6000: configuration opcode %d is only used for RTOS systems, not Linux systems", opcode)); - status = A_ERROR; - break; - default: - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, - ("AR6000: Unsupported configuration opcode: %d\n", opcode)); - status = A_ERROR; - } - - return status; -} - -void -HIFShutDownDevice(HIF_DEVICE *device) -{ - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +HIFShutDownDevice\n")); - if (device != NULL) { - AR_DEBUG_ASSERT(device->powerConfig==HIF_DEVICE_POWER_CUT || device->func != NULL); - } else { - int i; - /* since we are unloading the driver anyways, reset all cards in case the SDIO card - * is externally powered and we are unloading the SDIO stack. This avoids the problem when - * the SDIO stack is reloaded and attempts are made to re-enumerate a card that is already - * enumerated */ - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: HIFShutDownDevice, resetting\n")); - ResetAllCards(); - - /* Unregister with bus driver core */ - if (registered) { - registered = 0; - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, - ("AR6000: Unregistering with the bus driver\n")); - sdio_unregister_driver(&ar6k_driver); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, - ("AR6000: Unregistered\n")); - } - - for (i=0; ifunc == NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, - ("AR6000: Remove pending hif_device %p\n", hif_devices[i])); - delHifDevice(hif_devices[i]); - hif_devices[i] = NULL; - } - } - } - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -HIFShutDownDevice\n")); -} - -static void -hifIRQHandler(struct sdio_func *func) -{ - A_STATUS status; - HIF_DEVICE *device; - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifIRQHandler\n")); - - device = getHifDevice(func); - atomic_set(&device->irqHandling, 1); - /* release the host during ints so we can pick it back up when we process cmds */ - sdio_release_host(device->func); - status = device->htcCallbacks.dsrHandler(device->htcCallbacks.context); - sdio_claim_host(device->func); - atomic_set(&device->irqHandling, 0); - AR_DEBUG_ASSERT(status == A_OK || status == A_ECANCELED); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifIRQHandler\n")); -} - -/* handle HTC startup via thread*/ -static int startup_task(void *param) -{ - HIF_DEVICE *device; - - device = (HIF_DEVICE *)param; - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: call HTC from startup_task\n")); - /* start up inform DRV layer */ - if ((osdrvCallbacks.deviceInsertedHandler(osdrvCallbacks.context,device)) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Device rejected\n")); - } - return 0; -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) && defined(CONFIG_PM) -static int enable_task(void *param) -{ - HIF_DEVICE *device; - device = (HIF_DEVICE *)param; - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: call from resume_task\n")); - - /* start up inform DRV layer */ - if (device && - device->claimedContext && - osdrvCallbacks.devicePowerChangeHandler && - osdrvCallbacks.devicePowerChangeHandler(device->claimedContext, HIF_DEVICE_POWER_UP) != A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Device rejected\n")); - } - - return 0; -} -#endif - -static void hifAssignTargetHeaders(A_UINT16 SDIO_ID) -{ - switch (SDIO_ID) { - case MANUFACTURER_ID_AR6003_BASE: - hif_register_tbl_attach(HIF_TYPE_AR6003); - break; - - case MANUFACTURER_ID_MCKINLEY_BASE: - hif_register_tbl_attach(HIF_TYPE_MCKINLEY); - break; - default: - hif_register_tbl_attach(HIF_TYPE_AR6003); - break; - } -} - -static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id *id) -{ - int i; - int ret; - HIF_DEVICE * device = NULL; - int count; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, - ("AR6000: hifDeviceInserted, Function: 0x%X, Vendor ID: 0x%X, Device ID: 0x%X, block size: 0x%X/0x%X\n", - func->num, func->vendor, func->device, func->max_blksize, func->cur_blksize)); - - for (i=0; ipowerConfig == HIF_DEVICE_POWER_CUT && - hifdevice->host == func->card->host) { - hifdevice->func = func; - hifdevice->powerConfig = HIF_DEVICE_POWER_UP; - sdio_set_drvdata(func, hifdevice); - device = getHifDevice(func); - ret = 0; - break; - } - } - - if (device==NULL) { - addHifDevice(func); - device = getHifDevice(func); - hifAssignTargetHeaders(id->device); - - for (i=0; iid = id; - device->host = func->card->host; - device->is_disabled = TRUE; - - spin_lock_init(&device->lock); - - spin_lock_init(&device->asynclock); - - DL_LIST_INIT(&device->ScatterReqHead); - - if (!nohifscattersupport) { - /* try to allow scatter operation on all instances, - * unless globally overridden */ - device->scatter_enabled = TRUE; - } - - /* Initialize the bus requests to be used later */ - A_MEMZERO(device->busRequest, sizeof(device->busRequest)); - for (count = 0; count < BUS_REQUEST_MAX_NUM; count ++) { - sema_init(&device->busRequest[count].sem_req, 0); - hifFreeBusRequest(device, &device->busRequest[count]); - } - sema_init(&device->sem_async, 0); - } - - ret = hifEnableFunc(device, func); - return (ret == A_OK || ret == A_PENDING) ? 0 : -1; -} - - -void -HIFAckInterrupt(HIF_DEVICE *device) -{ - AR_DEBUG_ASSERT(device != NULL); - - /* Acknowledge our function IRQ */ -} - -void -HIFUnMaskInterrupt(HIF_DEVICE *device) -{ - int ret;; - - AR_DEBUG_ASSERT(device != NULL); - AR_DEBUG_ASSERT(device->func != NULL); - - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: HIFUnMaskInterrupt\n")); - - /* Register the IRQ Handler */ - sdio_claim_host(device->func); - ret = sdio_claim_irq(device->func, hifIRQHandler); - sdio_release_host(device->func); - AR_DEBUG_ASSERT(ret == 0); -} - -void HIFMaskInterrupt(HIF_DEVICE *device) -{ - int ret; - AR_DEBUG_ASSERT(device != NULL); - AR_DEBUG_ASSERT(device->func != NULL); - - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: HIFMaskInterrupt\n")); - - /* Mask our function IRQ */ - sdio_claim_host(device->func); - while (atomic_read(&device->irqHandling)) { - sdio_release_host(device->func); - schedule_timeout_interruptible(HZ/10); - sdio_claim_host(device->func); - } - ret = sdio_release_irq(device->func); - sdio_release_host(device->func); - if (ret) { - if (ret == -ETIMEDOUT) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, - ("AR6000: Timeout to mask interrupt. Card removed?\n")); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, - ("AR6000: Unable to mask interrupt %d\n", ret)); - AR_DEBUG_ASSERT(ret == 0); - } - } -} - -BUS_REQUEST *hifAllocateBusRequest(HIF_DEVICE *device) -{ - BUS_REQUEST *busrequest; - unsigned long flag; - - /* Acquire lock */ - spin_lock_irqsave(&device->lock, flag); - - /* Remove first in list */ - if((busrequest = device->s_busRequestFreeQueue) != NULL) - { - device->s_busRequestFreeQueue = busrequest->next; - } - /* Release lock */ - spin_unlock_irqrestore(&device->lock, flag); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: hifAllocateBusRequest: 0x%p\n", busrequest)); - return busrequest; -} - -void -hifFreeBusRequest(HIF_DEVICE *device, BUS_REQUEST *busrequest) -{ - unsigned long flag; - - AR_DEBUG_ASSERT(busrequest != NULL); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: hifFreeBusRequest: 0x%p\n", busrequest)); - /* Acquire lock */ - spin_lock_irqsave(&device->lock, flag); - - - /* Insert first in list */ - busrequest->next = device->s_busRequestFreeQueue; - busrequest->inusenext = NULL; - device->s_busRequestFreeQueue = busrequest; - - /* Release lock */ - spin_unlock_irqrestore(&device->lock, flag); -} - -static A_STATUS hifDisableFunc(HIF_DEVICE *device, struct sdio_func *func) -{ - int ret; - A_STATUS status = A_OK; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDisableFunc\n")); - device = getHifDevice(func); - if (!IS_ERR(device->async_task)) { - init_completion(&device->async_completion); - device->async_shutdown = 1; - up(&device->sem_async); - wait_for_completion(&device->async_completion); - device->async_task = NULL; - sema_init(&device->sem_async, 0); - } - /* Disable the card */ - sdio_claim_host(device->func); - ret = sdio_disable_func(device->func); - if (ret) { - status = A_ERROR; - } - - if (reset_sdio_on_unload && status == A_OK) { - /* reset the SDIO interface. This is useful in automated testing where the card - * does not need to be removed at the end of the test. It is expected that the user will - * also unload/reload the host controller driver to force the bus driver to re-enumerate the slot */ - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("AR6000: reseting SDIO card back to uninitialized state \n")); - - /* NOTE : sdio_f0_writeb() cannot be used here, that API only allows access - * to undefined registers in the range of: 0xF0-0xFF */ - - ret = Func0_CMD52WriteByte(device->func->card, SDIO_CCCR_ABORT, (1 << 3)); - if (ret) { - status = A_ERROR; - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("AR6000: reset failed : %d \n",ret)); - } - } - - sdio_release_host(device->func); - - if (status == A_OK) { - device->is_disabled = TRUE; - } - CleanupHIFScatterResources(device); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDisableFunc\n")); - - return status; -} - -static A_STATUS hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func) -{ - struct task_struct* pTask; - const char *taskName = NULL; - int (*taskFunc)(void *) = NULL; - int ret = A_OK; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifEnableFunc\n")); - device = getHifDevice(func); - - if (device->is_disabled) { - /* enable the SDIO function */ - sdio_claim_host(func); - - if ((device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK) >= MANUFACTURER_ID_AR6003_BASE) { - /* enable 4-bit ASYNC interrupt on AR6003 or later devices */ - ret = Func0_CMD52WriteByte(func->card, CCCR_SDIO_IRQ_MODE_REG, SDIO_IRQ_MODE_ASYNC_4BIT_IRQ); - if (ret) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("AR6000: failed to enable 4-bit ASYNC IRQ mode %d \n",ret)); - sdio_release_host(func); - return A_ERROR; - } - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: 4-bit ASYNC IRQ mode enabled\n")); - } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - /* give us some time to enable, in ms */ - func->enable_timeout = 100; -#endif - ret = sdio_enable_func(func); - if (ret) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("AR6000: %s(), Unable to enable AR6K: 0x%X\n", - __FUNCTION__, ret)); - sdio_release_host(func); - return A_ERROR; - } - ret = sdio_set_block_size(func, HIF_MBOX_BLOCK_SIZE); - sdio_release_host(func); - if (ret) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("AR6000: %s(), Unable to set block size 0x%x AR6K: 0x%X\n", - __FUNCTION__, HIF_MBOX_BLOCK_SIZE, ret)); - return A_ERROR; - } - device->is_disabled = FALSE; - /* create async I/O thread */ - if (!device->async_task) { - device->async_shutdown = 0; - device->async_task = kthread_create(async_task, - (void *)device, - "AR6K Async"); - if (IS_ERR(device->async_task)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("AR6000: %s(), to create async task\n", __FUNCTION__)); - return A_ERROR; - } - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: start async task\n")); - wake_up_process(device->async_task ); - } - } - - if (!device->claimedContext) { - taskFunc = startup_task; - taskName = "AR6K startup"; - ret = A_OK; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) && defined(CONFIG_PM) - } else { - taskFunc = enable_task; - taskName = "AR6K enable"; - ret = A_PENDING; -#endif /* CONFIG_PM */ - } - /* create resume thread */ - pTask = kthread_create(taskFunc, (void *)device, taskName); - if (IS_ERR(pTask)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("AR6000: %s(), to create enabel task\n", __FUNCTION__)); - return A_ERROR; - } - wake_up_process(pTask); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifEnableFunc\n")); - - /* task will call the enable func, indicate pending */ - return ret; -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) && defined(CONFIG_PM) -static int hifDeviceSuspend(struct device *dev) -{ - struct sdio_func *func=dev_to_sdio_func(dev); - A_STATUS status = A_OK; - HIF_DEVICE *device = getHifDevice(func); - -#if defined(MMC_PM_KEEP_POWER) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - struct mmc_host *host = NULL; - if (device && device->func) { - host = device->func->card->host; - } -#endif - - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceSuspend\n")); - if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) { - device->is_suspend = TRUE; /* set true first for PowerStateChangeNotify(..) */ - status = osdrvCallbacks.deviceSuspendHandler(device->claimedContext); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceSuspend\n")); - - switch (status) { - case A_OK: -#if defined(MMC_PM_KEEP_POWER) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - if (host) { - host->pm_flags &= ~(MMC_PM_KEEP_POWER|MMC_PM_WAKE_SDIO_IRQ); - } -#endif - return 0; - case A_EBUSY: -#if defined(MMC_PM_KEEP_POWER) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - if (host) { - /* Some controller need to WAKE_SDIO_IRQ in order to wake up by DAT1 */ - host->pm_flags |= (MMC_PM_KEEP_POWER|MMC_PM_WAKE_SDIO_IRQ); - //host->pm_flags &= host->pm_caps; - } - return 0; -#else - return -EBUSY; /* Hack for kernel to support deep sleep and wow */ -#endif - default: - device->is_suspend = FALSE; - return -1; - } -} - -static int hifDeviceResume(struct device *dev) -{ - struct sdio_func *func=dev_to_sdio_func(dev); - A_STATUS status = A_OK; - HIF_DEVICE *device; - - device = getHifDevice(func); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceResume\n")); - if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) { - status = osdrvCallbacks.deviceResumeHandler(device->claimedContext); - device->is_suspend = FALSE; - } - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceResume\n")); - - return A_SUCCESS(status) ? 0 : status; -} -#endif /* CONFIG_PM */ - -static void hifDeviceRemoved(struct sdio_func *func) -{ - A_STATUS status = A_OK; - HIF_DEVICE *device; - AR_DEBUG_ASSERT(func != NULL); - - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceRemoved\n")); - device = getHifDevice(func); - - if (device->powerConfig == HIF_DEVICE_POWER_CUT) { - device->func = NULL; /* func will be free by mmc stack */ - return; /* Just return for cut-off mode */ - } else { - int i; - for (i=0; iclaimedContext != NULL) { - status = osdrvCallbacks.deviceRemovedHandler(device->claimedContext, device); - } - - if (device->is_disabled) { - device->is_disabled = FALSE; - } else { - status = hifDisableFunc(device, func); - } - - delHifDevice(device); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, - ("AR6000: Unable to disable sdio func. Card removed?\n")); - } - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceRemoved\n")); -} - -/* - * This should be moved to AR6K HTC layer. - */ -A_STATUS hifWaitForPendingRecv(HIF_DEVICE *device) -{ - A_INT32 cnt = 10; - A_UINT8 host_int_status; - A_STATUS status = A_OK; - - do { - while (atomic_read(&device->irqHandling)) { - /* wait until irq handler finished all the jobs */ - schedule_timeout(HZ/10); - } - /* check if there is any pending irq due to force done */ - host_int_status = 0; - status = HIFReadWrite(device, HOST_INT_STATUS_ADDRESS, - (A_UINT8 *)&host_int_status, sizeof(host_int_status), - HIF_RD_SYNC_BYTE_INC, NULL); - host_int_status = A_SUCCESS(status) ? (host_int_status & (1 << 0)) : 0; - if (host_int_status) { - schedule(); /* schedule for next dsrHandler */ - } - } while (host_int_status && --cnt > 0); - - if (host_int_status && cnt == 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, - ("AR6000: %s(), Unable clear up pending IRQ before the system suspended\n", __FUNCTION__)); - } - - return A_OK; -} - - -static HIF_DEVICE * -addHifDevice(struct sdio_func *func) -{ - HIF_DEVICE *hifdevice; - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: addHifDevice\n")); - AR_DEBUG_ASSERT(func != NULL); - hifdevice = (HIF_DEVICE *)A_MALLOC(sizeof(HIF_DEVICE)); - AR_DEBUG_ASSERT(hifdevice != NULL); - A_MEMZERO(hifdevice, sizeof(*hifdevice)); -#if HIF_USE_DMA_BOUNCE_BUFFER - hifdevice->dma_buffer = A_MALLOC(HIF_DMA_BUFFER_SIZE); - AR_DEBUG_ASSERT(hifdevice->dma_buffer != NULL); -#endif - hifdevice->func = func; - hifdevice->powerConfig = HIF_DEVICE_POWER_UP; - sdio_set_drvdata(func, hifdevice); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: addHifDevice; 0x%p\n", hifdevice)); - return hifdevice; -} - -static HIF_DEVICE * -getHifDevice(struct sdio_func *func) -{ - AR_DEBUG_ASSERT(func != NULL); - return (HIF_DEVICE *)sdio_get_drvdata(func); -} - -static void -delHifDevice(HIF_DEVICE * device) -{ - AR_DEBUG_ASSERT(device!= NULL); - AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: delHifDevice; 0x%p\n", device)); - if (device->dma_buffer != NULL) { - A_FREE(device->dma_buffer); - } - A_FREE(device); -} - -static void ResetAllCards(void) -{ -} - -void HIFClaimDevice(HIF_DEVICE *device, void *context) -{ - device->claimedContext = context; -} - -void HIFReleaseDevice(HIF_DEVICE *device) -{ - device->claimedContext = NULL; -} - -A_STATUS HIFAttachHTC(HIF_DEVICE *device, HTC_CALLBACKS *callbacks) -{ - if (device->htcCallbacks.context != NULL) { - /* already in use! */ - return A_ERROR; - } - device->htcCallbacks = *callbacks; - return A_OK; -} - -void HIFDetachHTC(HIF_DEVICE *device) -{ - A_MEMZERO(&device->htcCallbacks,sizeof(device->htcCallbacks)); -} - -#define SDIO_SET_CMD52_ARG(arg,rw,func,raw,address,writedata) \ - (arg) = (((rw) & 1) << 31) | \ - (((func) & 0x7) << 28) | \ - (((raw) & 1) << 27) | \ - (1 << 26) | \ - (((address) & 0x1FFFF) << 9) | \ - (1 << 8) | \ - ((writedata) & 0xFF) - -#define SDIO_SET_CMD52_READ_ARG(arg,func,address) \ - SDIO_SET_CMD52_ARG(arg,0,(func),0,address,0x00) -#define SDIO_SET_CMD52_WRITE_ARG(arg,func,address,value) \ - SDIO_SET_CMD52_ARG(arg,1,(func),0,address,value) - -static int Func0_CMD52WriteByte(struct mmc_card *card, unsigned int address, unsigned char byte) -{ - struct mmc_command ioCmd; - unsigned long arg; - - memset(&ioCmd,0,sizeof(ioCmd)); - SDIO_SET_CMD52_WRITE_ARG(arg,0,address,byte); - ioCmd.opcode = SD_IO_RW_DIRECT; - ioCmd.arg = arg; - ioCmd.flags = MMC_RSP_R5 | MMC_CMD_AC; - - return mmc_wait_for_cmd(card->host, &ioCmd, 0); -} - -static int Func0_CMD52ReadByte(struct mmc_card *card, unsigned int address, unsigned char *byte) -{ - struct mmc_command ioCmd; - unsigned long arg; - A_INT32 err; - - memset(&ioCmd,0,sizeof(ioCmd)); - SDIO_SET_CMD52_READ_ARG(arg,0,address); - ioCmd.opcode = SD_IO_RW_DIRECT; - ioCmd.arg = arg; - ioCmd.flags = MMC_RSP_R5 | MMC_CMD_AC; - - err = mmc_wait_for_cmd(card->host, &ioCmd, 0); - - if ((!err) && (byte)) { - *byte = ioCmd.resp[0] & 0xFF; - } - - return err; -} diff --git a/drivers/net/wireless/ar6003/host/hif/sdio/linux_sdio/src/hif_scatter.c b/drivers/net/wireless/ar6003/host/hif/sdio/linux_sdio/src/hif_scatter.c deleted file mode 100644 index 8e755231a35b..000000000000 --- a/drivers/net/wireless/ar6003/host/hif/sdio/linux_sdio/src/hif_scatter.c +++ /dev/null @@ -1,393 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2009-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// HIF scatter implementation -// -// Author(s): ="Atheros" -//============================================================================== - -#include -#include -#include -#include -#include -#include -#include "hif_internal.h" -#define ATH_MODULE_NAME hif -#include "a_debug.h" - -#ifdef HIF_LINUX_MMC_SCATTER_SUPPORT - -#define _CMD53_ARG_READ 0 -#define _CMD53_ARG_WRITE 1 -#define _CMD53_ARG_BLOCK_BASIS 1 -#define _CMD53_ARG_FIXED_ADDRESS 0 -#define _CMD53_ARG_INCR_ADDRESS 1 - -#define SDIO_SET_CMD53_ARG(arg,rw,func,mode,opcode,address,bytes_blocks) \ - (arg) = (((rw) & 1) << 31) | \ - (((func) & 0x7) << 28) | \ - (((mode) & 1) << 27) | \ - (((opcode) & 1) << 26) | \ - (((address) & 0x1FFFF) << 9) | \ - ((bytes_blocks) & 0x1FF) - -static void FreeScatterReq(HIF_DEVICE *device, HIF_SCATTER_REQ *pReq) -{ - unsigned long flag; - - spin_lock_irqsave(&device->lock, flag); - - DL_ListInsertTail(&device->ScatterReqHead, &pReq->ListLink); - - spin_unlock_irqrestore(&device->lock, flag); - -} - -static HIF_SCATTER_REQ *AllocScatterReq(HIF_DEVICE *device) -{ - DL_LIST *pItem; - unsigned long flag; - - spin_lock_irqsave(&device->lock, flag); - - pItem = DL_ListRemoveItemFromHead(&device->ScatterReqHead); - - spin_unlock_irqrestore(&device->lock, flag); - - if (pItem != NULL) { - return A_CONTAINING_STRUCT(pItem, HIF_SCATTER_REQ, ListLink); - } - - return NULL; -} - - /* called by async task to perform the operation synchronously using direct MMC APIs */ -A_STATUS DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest) -{ - int i; - A_UINT8 rw; - A_UINT8 opcode; - struct mmc_request mmcreq; - struct mmc_command cmd; - struct mmc_data data; - HIF_SCATTER_REQ_PRIV *pReqPriv; - HIF_SCATTER_REQ *pReq; - A_STATUS status = A_OK; - struct scatterlist *pSg; - - pReqPriv = busrequest->pScatterReq; - - A_ASSERT(pReqPriv != NULL); - - pReq = pReqPriv->pHifScatterReq; - - memset(&mmcreq, 0, sizeof(struct mmc_request)); - memset(&cmd, 0, sizeof(struct mmc_command)); - memset(&data, 0, sizeof(struct mmc_data)); - - data.blksz = HIF_MBOX_BLOCK_SIZE; - data.blocks = pReq->TotalLength / HIF_MBOX_BLOCK_SIZE; - - AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER, ("HIF-SCATTER: (%s) Address: 0x%X, (BlockLen: %d, BlockCount: %d) , (tot:%d,sg:%d)\n", - (pReq->Request & HIF_WRITE) ? "WRITE":"READ", pReq->Address, data.blksz, data.blocks, - pReq->TotalLength,pReq->ValidScatterEntries)); - - if (pReq->Request & HIF_WRITE) { - rw = _CMD53_ARG_WRITE; - data.flags = MMC_DATA_WRITE; - } else { - rw = _CMD53_ARG_READ; - data.flags = MMC_DATA_READ; - } - - if (pReq->Request & HIF_FIXED_ADDRESS) { - opcode = _CMD53_ARG_FIXED_ADDRESS; - } else { - opcode = _CMD53_ARG_INCR_ADDRESS; - } - - /* fill SG entries */ - pSg = pReqPriv->sgentries; - sg_init_table(pSg, pReq->ValidScatterEntries); - - /* assemble SG list */ - for (i = 0 ; i < pReq->ValidScatterEntries ; i++, pSg++) { - /* setup each sg entry */ - if ((unsigned long)pReq->ScatterList[i].pBuffer & 0x3) { - /* note some scatter engines can handle unaligned buffers, print this - * as informational only */ - AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER, - ("HIF: (%s) Scatter Buffer is unaligned 0x%lx\n", - pReq->Request & HIF_WRITE ? "WRITE":"READ", - (unsigned long)pReq->ScatterList[i].pBuffer)); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER, (" %d: Addr:0x%lX, Len:%d \n", - i,(unsigned long)pReq->ScatterList[i].pBuffer,pReq->ScatterList[i].Length)); - - sg_set_buf(pSg, pReq->ScatterList[i].pBuffer, pReq->ScatterList[i].Length); - } - /* set scatter-gather table for request */ - data.sg = pReqPriv->sgentries; - data.sg_len = pReq->ValidScatterEntries; - /* set command argument */ - SDIO_SET_CMD53_ARG(cmd.arg, - rw, - device->func->num, - _CMD53_ARG_BLOCK_BASIS, - opcode, - pReq->Address, - data.blocks); - - cmd.opcode = SD_IO_RW_EXTENDED; - cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_ADTC; - - mmcreq.cmd = &cmd; - mmcreq.data = &data; - - mmc_set_data_timeout(&data, device->func->card); - /* synchronous call to process request */ - mmc_wait_for_req(device->func->card->host, &mmcreq); - - if (cmd.error) { - status = A_ERROR; - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("HIF-SCATTER: cmd error: %d \n",cmd.error)); - } - - if (data.error) { - status = A_ERROR; - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("HIF-SCATTER: data error: %d \n",data.error)); - } - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("HIF-SCATTER: FAILED!!! (%s) Address: 0x%X, Block mode (BlockLen: %d, BlockCount: %d)\n", - (pReq->Request & HIF_WRITE) ? "WRITE":"READ",pReq->Address, data.blksz, data.blocks)); - } - - /* set completion status, fail or success */ - pReq->CompletionStatus = status; - - if (pReq->Request & HIF_ASYNCHRONOUS) { - AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER, ("HIF-SCATTER: async_task completion routine req: 0x%lX (%d)\n",(unsigned long)busrequest, status)); - /* complete the request */ - A_ASSERT(pReq->CompletionRoutine != NULL); - pReq->CompletionRoutine(pReq); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER, ("HIF-SCATTER async_task upping busrequest : 0x%lX (%d)\n", (unsigned long)busrequest,status)); - /* signal wait */ - up(&busrequest->sem_req); - } - - return status; -} - - /* callback to issue a read-write scatter request */ -static A_STATUS HifReadWriteScatter(HIF_DEVICE *device, HIF_SCATTER_REQ *pReq) -{ - A_STATUS status = A_EINVAL; - A_UINT32 request = pReq->Request; - HIF_SCATTER_REQ_PRIV *pReqPriv = (HIF_SCATTER_REQ_PRIV *)pReq->HIFPrivate[0]; - - do { - - A_ASSERT(pReqPriv != NULL); - - AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER, ("HIF-SCATTER: total len: %d Scatter Entries: %d\n", - pReq->TotalLength, pReq->ValidScatterEntries)); - - if (!(request & HIF_EXTENDED_IO)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, - ("HIF-SCATTER: Invalid command type: 0x%08x\n", request)); - break; - } - - if (!(request & (HIF_SYNCHRONOUS | HIF_ASYNCHRONOUS))) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, - ("HIF-SCATTER: Invalid execution mode: 0x%08x\n", request)); - break; - } - - if (!(request & HIF_BLOCK_BASIS)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, - ("HIF-SCATTER: Invalid data mode: 0x%08x\n", request)); - break; - } - - if (pReq->TotalLength > MAX_SCATTER_REQ_TRANSFER_SIZE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, - ("HIF-SCATTER: Invalid length: %d \n", pReq->TotalLength)); - break; - } - - if (pReq->TotalLength == 0) { - A_ASSERT(FALSE); - break; - } - - /* add bus request to the async list for the async I/O thread to process */ - AddToAsyncList(device, pReqPriv->busrequest); - - if (request & HIF_SYNCHRONOUS) { - AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER, ("HIF-SCATTER: queued sync req: 0x%lX\n", (unsigned long)pReqPriv->busrequest)); - /* signal thread and wait */ - up(&device->sem_async); - if (down_interruptible(&pReqPriv->busrequest->sem_req) != 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,("HIF-SCATTER: interrupted! \n")); - /* interrupted, exit */ - status = A_ERROR; - break; - } else { - status = pReq->CompletionStatus; - } - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER, ("HIF-SCATTER: queued async req: 0x%lX\n", (unsigned long)pReqPriv->busrequest)); - /* wake thread, it will process and then take care of the async callback */ - up(&device->sem_async); - status = A_OK; - } - - } while (FALSE); - - if (A_FAILED(status) && (request & HIF_ASYNCHRONOUS)) { - pReq->CompletionStatus = status; - pReq->CompletionRoutine(pReq); - status = A_OK; - } - - return status; -} - - /* setup of HIF scatter resources */ -A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_INFO *pInfo) -{ - A_STATUS status = A_ERROR; - int i; - HIF_SCATTER_REQ_PRIV *pReqPriv; - BUS_REQUEST *busrequest; - - do { - - /* check if host supports scatter requests and it meets our requirements */ - if (device->func->card->host->max_hw_segs < MAX_SCATTER_ENTRIES_PER_REQ) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("HIF-SCATTER : host only supports scatter of : %d entries, need: %d \n", - device->func->card->host->max_hw_segs, MAX_SCATTER_ENTRIES_PER_REQ)); - status = A_ENOTSUP; - break; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("HIF-SCATTER Enabled: max scatter req : %d entries: %d \n", - MAX_SCATTER_REQUESTS, MAX_SCATTER_ENTRIES_PER_REQ)); - - for (i = 0; i < MAX_SCATTER_REQUESTS; i++) { - /* allocate the private request blob */ - pReqPriv = (HIF_SCATTER_REQ_PRIV *)A_MALLOC(sizeof(HIF_SCATTER_REQ_PRIV)); - if (NULL == pReqPriv) { - break; - } - A_MEMZERO(pReqPriv, sizeof(HIF_SCATTER_REQ_PRIV)); - /* save the device instance*/ - pReqPriv->device = device; - /* allocate the scatter request */ - pReqPriv->pHifScatterReq = (HIF_SCATTER_REQ *)A_MALLOC(sizeof(HIF_SCATTER_REQ) + - (MAX_SCATTER_ENTRIES_PER_REQ - 1) * (sizeof(HIF_SCATTER_ITEM))); - - if (NULL == pReqPriv->pHifScatterReq) { - A_FREE(pReqPriv); - break; - } - /* just zero the main part of the scatter request */ - A_MEMZERO(pReqPriv->pHifScatterReq, sizeof(HIF_SCATTER_REQ)); - /* back pointer to the private struct */ - pReqPriv->pHifScatterReq->HIFPrivate[0] = pReqPriv; - /* allocate a bus request for this scatter request */ - busrequest = hifAllocateBusRequest(device); - if (NULL == busrequest) { - A_FREE(pReqPriv->pHifScatterReq); - A_FREE(pReqPriv); - break; - } - /* assign the scatter request to this bus request */ - busrequest->pScatterReq = pReqPriv; - /* point back to the request */ - pReqPriv->busrequest = busrequest; - /* add it to the scatter pool */ - FreeScatterReq(device,pReqPriv->pHifScatterReq); - } - - if (i != MAX_SCATTER_REQUESTS) { - status = A_NO_MEMORY; - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HIF-SCATTER : failed to alloc scatter resources !\n")); - break; - } - - /* set scatter function pointers */ - pInfo->pAllocateReqFunc = AllocScatterReq; - pInfo->pFreeReqFunc = FreeScatterReq; - pInfo->pReadWriteScatterFunc = HifReadWriteScatter; - pInfo->MaxScatterEntries = MAX_SCATTER_ENTRIES_PER_REQ; - pInfo->MaxTransferSizePerScatterReq = MAX_SCATTER_REQ_TRANSFER_SIZE; - - status = A_OK; - - } while (FALSE); - - if (A_FAILED(status)) { - CleanupHIFScatterResources(device); - } - - return status; -} - - /* clean up scatter support */ -void CleanupHIFScatterResources(HIF_DEVICE *device) -{ - HIF_SCATTER_REQ_PRIV *pReqPriv; - HIF_SCATTER_REQ *pReq; - - /* empty the free list */ - - while (1) { - - pReq = AllocScatterReq(device); - - if (NULL == pReq) { - break; - } - - pReqPriv = (HIF_SCATTER_REQ_PRIV *)pReq->HIFPrivate[0]; - A_ASSERT(pReqPriv != NULL); - - if (pReqPriv->busrequest != NULL) { - pReqPriv->busrequest->pScatterReq = NULL; - /* free bus request */ - hifFreeBusRequest(device, pReqPriv->busrequest); - pReqPriv->busrequest = NULL; - } - - if (pReqPriv->pHifScatterReq != NULL) { - A_FREE(pReqPriv->pHifScatterReq); - pReqPriv->pHifScatterReq = NULL; - } - - A_FREE(pReqPriv); - } -} - -#endif // HIF_LINUX_MMC_SCATTER_SUPPORT diff --git a/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k.c b/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k.c deleted file mode 100644 index bbddef7a3a53..000000000000 --- a/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k.c +++ /dev/null @@ -1,1463 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// AR6K device layer that handles register level I/O -// -// Author(s): ="Atheros" -//============================================================================== - -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" -#include "a_osapi.h" -#include "../htc_debug.h" -#include "hif.h" -#include "htc_packet.h" -#include "ar6k.h" -#include "target_reg_table.h" -#include "host_reg_table.h" - -#define MAILBOX_FOR_BLOCK_SIZE 1 - -A_STATUS DevEnableInterrupts(AR6K_DEVICE *pDev); -A_STATUS DevDisableInterrupts(AR6K_DEVICE *pDev); - -static void DevCleanupVirtualScatterSupport(AR6K_DEVICE *pDev); - -void AR6KFreeIOPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket) -{ - LOCK_AR6K(pDev); - HTC_PACKET_ENQUEUE(&pDev->RegisterIOList,pPacket); - UNLOCK_AR6K(pDev); -} - -HTC_PACKET *AR6KAllocIOPacket(AR6K_DEVICE *pDev) -{ - HTC_PACKET *pPacket; - - LOCK_AR6K(pDev); - pPacket = HTC_PACKET_DEQUEUE(&pDev->RegisterIOList); - UNLOCK_AR6K(pDev); - - return pPacket; -} - -void DevCleanup(AR6K_DEVICE *pDev) -{ - if (pDev->HifAttached) { - HIFDetachHTC(pDev->HIFDevice); - pDev->HifAttached = FALSE; - } - - DevCleanupVirtualScatterSupport(pDev); - - if (A_IS_MUTEX_VALID(&pDev->Lock)) { - A_MUTEX_DELETE(&pDev->Lock); - } -} - -A_STATUS DevSetup(AR6K_DEVICE *pDev) -{ - A_UINT32 blocksizes[AR6K_MAILBOXES]; - A_STATUS status = A_OK; - int i; - HTC_CALLBACKS htcCallbacks; - - do { - - DL_LIST_INIT(&pDev->ScatterReqHead); - /* initialize our free list of IO packets */ - INIT_HTC_PACKET_QUEUE(&pDev->RegisterIOList); - A_MUTEX_INIT(&pDev->Lock); - - A_MEMZERO(&htcCallbacks, sizeof(HTC_CALLBACKS)); - /* the device layer handles these */ - htcCallbacks.rwCompletionHandler = DevRWCompletionHandler; - htcCallbacks.dsrHandler = DevDsrHandler; - htcCallbacks.context = pDev; - - status = HIFAttachHTC(pDev->HIFDevice, &htcCallbacks); - - if (A_FAILED(status)) { - break; - } - - pDev->HifAttached = TRUE; - - /* get the addresses for all 4 mailboxes */ - status = HIFConfigureDevice(pDev->HIFDevice, HIF_DEVICE_GET_MBOX_ADDR, - &pDev->MailBoxInfo, sizeof(pDev->MailBoxInfo)); - - if (status != A_OK) { - A_ASSERT(FALSE); - break; - } - - /* carve up register I/O packets (these are for ASYNC register I/O ) */ - for (i = 0; i < AR6K_MAX_REG_IO_BUFFERS; i++) { - HTC_PACKET *pIOPacket; - pIOPacket = &pDev->RegIOBuffers[i].HtcPacket; - SET_HTC_PACKET_INFO_RX_REFILL(pIOPacket, - pDev, - pDev->RegIOBuffers[i].Buffer, - AR6K_REG_IO_BUFFER_SIZE, - 0); /* don't care */ - AR6KFreeIOPacket(pDev,pIOPacket); - } - - /* get the block sizes */ - status = HIFConfigureDevice(pDev->HIFDevice, HIF_DEVICE_GET_MBOX_BLOCK_SIZE, - blocksizes, sizeof(blocksizes)); - - if (status != A_OK) { - A_ASSERT(FALSE); - break; - } - - /* note: we actually get the block size of a mailbox other than 0, for SDIO the block - * size on mailbox 0 is artificially set to 1. So we use the block size that is set - * for the other 3 mailboxes */ - pDev->BlockSize = blocksizes[MAILBOX_FOR_BLOCK_SIZE]; - /* must be a power of 2 */ - A_ASSERT((pDev->BlockSize & (pDev->BlockSize - 1)) == 0); - - /* assemble mask, used for padding to a block */ - pDev->BlockMask = pDev->BlockSize - 1; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("BlockSize: %d, MailboxAddress:0x%X \n", - pDev->BlockSize, pDev->MailBoxInfo.MboxAddresses[HTC_MAILBOX])); - - pDev->GetPendingEventsFunc = NULL; - /* see if the HIF layer implements the get pending events function */ - HIFConfigureDevice(pDev->HIFDevice, - HIF_DEVICE_GET_PENDING_EVENTS_FUNC, - &pDev->GetPendingEventsFunc, - sizeof(pDev->GetPendingEventsFunc)); - - /* assume we can process HIF interrupt events asynchronously */ - pDev->HifIRQProcessingMode = HIF_DEVICE_IRQ_ASYNC_SYNC; - - /* see if the HIF layer overrides this assumption */ - HIFConfigureDevice(pDev->HIFDevice, - HIF_DEVICE_GET_IRQ_PROC_MODE, - &pDev->HifIRQProcessingMode, - sizeof(pDev->HifIRQProcessingMode)); - - switch (pDev->HifIRQProcessingMode) { - case HIF_DEVICE_IRQ_SYNC_ONLY: - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("HIF Interrupt processing is SYNC ONLY\n")); - /* see if HIF layer wants HTC to yield */ - HIFConfigureDevice(pDev->HIFDevice, - HIF_DEVICE_GET_IRQ_YIELD_PARAMS, - &pDev->HifIRQYieldParams, - sizeof(pDev->HifIRQYieldParams)); - - if (pDev->HifIRQYieldParams.RecvPacketYieldCount > 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, - ("HIF requests that DSR yield per %d RECV packets \n", - pDev->HifIRQYieldParams.RecvPacketYieldCount)); - pDev->DSRCanYield = TRUE; - } - break; - case HIF_DEVICE_IRQ_ASYNC_SYNC: - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("HIF Interrupt processing is ASYNC and SYNC\n")); - break; - default: - A_ASSERT(FALSE); - } - - pDev->HifMaskUmaskRecvEvent = NULL; - - /* see if the HIF layer implements the mask/unmask recv events function */ - HIFConfigureDevice(pDev->HIFDevice, - HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC, - &pDev->HifMaskUmaskRecvEvent, - sizeof(pDev->HifMaskUmaskRecvEvent)); - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("HIF special overrides : 0x%lX , 0x%lX\n", - (unsigned long)pDev->GetPendingEventsFunc, (unsigned long)pDev->HifMaskUmaskRecvEvent)); - - status = DevDisableInterrupts(pDev); - - if (A_FAILED(status)) { - break; - } - - } while (FALSE); - - if (A_FAILED(status)) { - if (pDev->HifAttached) { - HIFDetachHTC(pDev->HIFDevice); - pDev->HifAttached = FALSE; - } - } - - return status; - -} - -A_STATUS DevEnableInterrupts(AR6K_DEVICE *pDev) -{ - A_STATUS status; - AR6K_IRQ_ENABLE_REGISTERS regs; - - LOCK_AR6K(pDev); - - /* Enable all the interrupts except for the internal AR6000 CPU interrupt */ - pDev->IrqEnableRegisters.int_status_enable = INT_STATUS_ENABLE_ERROR_SET(0x01) | - INT_STATUS_ENABLE_CPU_SET(0x01) | - INT_STATUS_ENABLE_COUNTER_SET(0x01); - - if (NULL == pDev->GetPendingEventsFunc) { - pDev->IrqEnableRegisters.int_status_enable |= INT_STATUS_ENABLE_MBOX_DATA_SET(0x01); - } else { - /* The HIF layer provided us with a pending events function which means that - * the detection of pending mbox messages is handled in the HIF layer. - * This is the case for the SPI2 interface. - * In the normal case we enable MBOX interrupts, for the case - * with HIFs that offer this mechanism, we keep these interrupts - * masked */ - pDev->IrqEnableRegisters.int_status_enable &= ~INT_STATUS_ENABLE_MBOX_DATA_SET(0x01); - } - - - /* Set up the CPU Interrupt Status Register */ - pDev->IrqEnableRegisters.cpu_int_status_enable = CPU_INT_STATUS_ENABLE_BIT_SET(0x00); - - /* Set up the Error Interrupt Status Register */ - pDev->IrqEnableRegisters.error_status_enable = - ERROR_STATUS_ENABLE_RX_UNDERFLOW_SET(0x01) | - ERROR_STATUS_ENABLE_TX_OVERFLOW_SET(0x01); - - /* Set up the Counter Interrupt Status Register (only for debug interrupt to catch fatal errors) */ - pDev->IrqEnableRegisters.counter_int_status_enable = - COUNTER_INT_STATUS_ENABLE_BIT_SET(AR6K_TARGET_DEBUG_INTR_MASK); - - /* copy into our temp area */ - A_MEMCPY(®s,&pDev->IrqEnableRegisters,AR6K_IRQ_ENABLE_REGS_SIZE); - - UNLOCK_AR6K(pDev); - - /* always synchronous */ - status = HIFReadWrite(pDev->HIFDevice, - INT_STATUS_ENABLE_ADDRESS, - ®s.int_status_enable, - AR6K_IRQ_ENABLE_REGS_SIZE, - HIF_WR_SYNC_BYTE_INC, - NULL); - - if (status != A_OK) { - /* Can't write it for some reason */ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("Failed to update interrupt control registers err: %d\n", status)); - - } - - return status; -} - -A_STATUS DevDisableInterrupts(AR6K_DEVICE *pDev) -{ - AR6K_IRQ_ENABLE_REGISTERS regs; - - LOCK_AR6K(pDev); - /* Disable all interrupts */ - pDev->IrqEnableRegisters.int_status_enable = 0; - pDev->IrqEnableRegisters.cpu_int_status_enable = 0; - pDev->IrqEnableRegisters.error_status_enable = 0; - pDev->IrqEnableRegisters.counter_int_status_enable = 0; - /* copy into our temp area */ - A_MEMCPY(®s,&pDev->IrqEnableRegisters,AR6K_IRQ_ENABLE_REGS_SIZE); - - UNLOCK_AR6K(pDev); - - /* always synchronous */ - return HIFReadWrite(pDev->HIFDevice, - INT_STATUS_ENABLE_ADDRESS, - ®s.int_status_enable, - AR6K_IRQ_ENABLE_REGS_SIZE, - HIF_WR_SYNC_BYTE_INC, - NULL); -} - -/* enable device interrupts */ -A_STATUS DevUnmaskInterrupts(AR6K_DEVICE *pDev) -{ - /* for good measure, make sure interrupt are disabled before unmasking at the HIF - * layer. - * The rationale here is that between device insertion (where we clear the interrupts the first time) - * and when HTC is finally ready to handle interrupts, other software can perform target "soft" resets. - * The AR6K interrupt enables reset back to an "enabled" state when this happens. - * */ - DevDisableInterrupts(pDev); - - /* Unmask the host controller interrupts */ - HIFUnMaskInterrupt(pDev->HIFDevice); - - return DevEnableInterrupts(pDev); -} - -/* disable all device interrupts */ -A_STATUS DevMaskInterrupts(AR6K_DEVICE *pDev) -{ - /* mask the interrupt at the HIF layer, we don't want a stray interrupt taken while - * we zero out our shadow registers in DevDisableInterrupts()*/ - HIFMaskInterrupt(pDev->HIFDevice); - - return DevDisableInterrupts(pDev); -} - -/* callback when our fetch to enable/disable completes */ -static void DevDoEnableDisableRecvAsyncHandler(void *Context, HTC_PACKET *pPacket) -{ - AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context; - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+DevDoEnableDisableRecvAsyncHandler: (dev: 0x%lX)\n", (unsigned long)pDev)); - - if (A_FAILED(pPacket->Status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - (" Failed to disable receiver, status:%d \n", pPacket->Status)); - } - /* free this IO packet */ - AR6KFreeIOPacket(pDev,pPacket); - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("-DevDoEnableDisableRecvAsyncHandler \n")); -} - -/* disable packet reception (used in case the host runs out of buffers) - * this is the "override" method when the HIF reports another methods to - * disable recv events */ -static A_STATUS DevDoEnableDisableRecvOverride(AR6K_DEVICE *pDev, A_BOOL EnableRecv, A_BOOL AsyncMode) -{ - A_STATUS status = A_OK; - HTC_PACKET *pIOPacket = NULL; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("DevDoEnableDisableRecvOverride: Enable:%d Mode:%d\n", - EnableRecv,AsyncMode)); - - do { - - if (AsyncMode) { - - pIOPacket = AR6KAllocIOPacket(pDev); - - if (NULL == pIOPacket) { - status = A_NO_MEMORY; - A_ASSERT(FALSE); - break; - } - - /* stick in our completion routine when the I/O operation completes */ - pIOPacket->Completion = DevDoEnableDisableRecvAsyncHandler; - pIOPacket->pContext = pDev; - - /* call the HIF layer override and do this asynchronously */ - status = pDev->HifMaskUmaskRecvEvent(pDev->HIFDevice, - EnableRecv ? HIF_UNMASK_RECV : HIF_MASK_RECV, - pIOPacket); - break; - } - - /* if we get here we are doing it synchronously */ - status = pDev->HifMaskUmaskRecvEvent(pDev->HIFDevice, - EnableRecv ? HIF_UNMASK_RECV : HIF_MASK_RECV, - NULL); - - } while (FALSE); - - if (A_FAILED(status) && (pIOPacket != NULL)) { - AR6KFreeIOPacket(pDev,pIOPacket); - } - - return status; -} - -/* disable packet reception (used in case the host runs out of buffers) - * this is the "normal" method using the interrupt enable registers through - * the host I/F */ -static A_STATUS DevDoEnableDisableRecvNormal(AR6K_DEVICE *pDev, A_BOOL EnableRecv, A_BOOL AsyncMode) -{ - A_STATUS status = A_OK; - HTC_PACKET *pIOPacket = NULL; - AR6K_IRQ_ENABLE_REGISTERS regs; - - /* take the lock to protect interrupt enable shadows */ - LOCK_AR6K(pDev); - - if (EnableRecv) { - pDev->IrqEnableRegisters.int_status_enable |= INT_STATUS_ENABLE_MBOX_DATA_SET(0x01); - } else { - pDev->IrqEnableRegisters.int_status_enable &= ~INT_STATUS_ENABLE_MBOX_DATA_SET(0x01); - } - - /* copy into our temp area */ - A_MEMCPY(®s,&pDev->IrqEnableRegisters,AR6K_IRQ_ENABLE_REGS_SIZE); - UNLOCK_AR6K(pDev); - - do { - - if (AsyncMode) { - - pIOPacket = AR6KAllocIOPacket(pDev); - - if (NULL == pIOPacket) { - status = A_NO_MEMORY; - A_ASSERT(FALSE); - break; - } - - /* copy values to write to our async I/O buffer */ - A_MEMCPY(pIOPacket->pBuffer,®s,AR6K_IRQ_ENABLE_REGS_SIZE); - - /* stick in our completion routine when the I/O operation completes */ - pIOPacket->Completion = DevDoEnableDisableRecvAsyncHandler; - pIOPacket->pContext = pDev; - - /* write it out asynchronously */ - status = HIFReadWrite(pDev->HIFDevice, - INT_STATUS_ENABLE_ADDRESS, - pIOPacket->pBuffer, - AR6K_IRQ_ENABLE_REGS_SIZE, - HIF_WR_ASYNC_BYTE_INC, - pIOPacket); - break; - } - - /* if we get here we are doing it synchronously */ - - status = HIFReadWrite(pDev->HIFDevice, - INT_STATUS_ENABLE_ADDRESS, - ®s.int_status_enable, - AR6K_IRQ_ENABLE_REGS_SIZE, - HIF_WR_SYNC_BYTE_INC, - NULL); - - } while (FALSE); - - if (A_FAILED(status) && (pIOPacket != NULL)) { - AR6KFreeIOPacket(pDev,pIOPacket); - } - - return status; -} - - -A_STATUS DevStopRecv(AR6K_DEVICE *pDev, A_BOOL AsyncMode) -{ - if (NULL == pDev->HifMaskUmaskRecvEvent) { - return DevDoEnableDisableRecvNormal(pDev,FALSE,AsyncMode); - } else { - return DevDoEnableDisableRecvOverride(pDev,FALSE,AsyncMode); - } -} - -A_STATUS DevEnableRecv(AR6K_DEVICE *pDev, A_BOOL AsyncMode) -{ - if (NULL == pDev->HifMaskUmaskRecvEvent) { - return DevDoEnableDisableRecvNormal(pDev,TRUE,AsyncMode); - } else { - return DevDoEnableDisableRecvOverride(pDev,TRUE,AsyncMode); - } -} - -A_STATUS DevWaitForPendingRecv(AR6K_DEVICE *pDev,A_UINT32 TimeoutInMs,A_BOOL *pbIsRecvPending) -{ - A_STATUS status = A_OK; - A_UCHAR host_int_status = 0x0; - A_UINT32 counter = 0x0; - - if(TimeoutInMs < 100) - { - TimeoutInMs = 100; - } - - counter = TimeoutInMs / 100; - - do - { - //Read the Host Interrupt Status Register - status = HIFReadWrite(pDev->HIFDevice, - HOST_INT_STATUS_ADDRESS, - &host_int_status, - sizeof(A_UCHAR), - HIF_RD_SYNC_BYTE_INC, - NULL); - if(A_FAILED(status)) - { - AR_DEBUG_PRINTF(ATH_LOG_ERR,("DevWaitForPendingRecv:Read HOST_INT_STATUS_ADDRESS Failed 0x%X\n",status)); - break; - } - - host_int_status = A_SUCCESS(status) ? (host_int_status & (1 << 0)):0; - if(!host_int_status) - { - status = A_OK; - *pbIsRecvPending = FALSE; - break; - } - else - { - *pbIsRecvPending = TRUE; - } - - A_MDELAY(100); - - counter--; - - }while(counter); - return status; -} - -void DevDumpRegisters(AR6K_DEVICE *pDev, - AR6K_IRQ_PROC_REGISTERS *pIrqProcRegs, - AR6K_IRQ_ENABLE_REGISTERS *pIrqEnableRegs) -{ - - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, ("\n<------- Register Table -------->\n")); - - if (pIrqProcRegs != NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("Host Int Status: 0x%x\n",pIrqProcRegs->host_int_status)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("CPU Int Status: 0x%x\n",pIrqProcRegs->cpu_int_status)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("Error Int Status: 0x%x\n",pIrqProcRegs->error_int_status)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("Counter Int Status: 0x%x\n",pIrqProcRegs->counter_int_status)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("Mbox Frame: 0x%x\n",pIrqProcRegs->mbox_frame)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("Rx Lookahead Valid: 0x%x\n",pIrqProcRegs->rx_lookahead_valid)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("Rx Lookahead 0: 0x%x\n",pIrqProcRegs->rx_lookahead[0])); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("Rx Lookahead 1: 0x%x\n",pIrqProcRegs->rx_lookahead[1])); - - if (pDev->MailBoxInfo.GMboxAddress != 0) { - /* if the target supports GMBOX hardware, dump some additional state */ - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("GMBOX Host Int Status 2: 0x%x\n",pIrqProcRegs->host_int_status2)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("GMBOX RX Avail: 0x%x\n",pIrqProcRegs->gmbox_rx_avail)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("GMBOX lookahead alias 0: 0x%x\n",pIrqProcRegs->rx_gmbox_lookahead_alias[0])); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("GMBOX lookahead alias 1: 0x%x\n",pIrqProcRegs->rx_gmbox_lookahead_alias[1])); - } - - } - - if (pIrqEnableRegs != NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("Int Status Enable: 0x%x\n",pIrqEnableRegs->int_status_enable)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("Counter Int Status Enable: 0x%x\n",pIrqEnableRegs->counter_int_status_enable)); - } - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, ("<------------------------------->\n")); -} - - -#define DEV_GET_VIRT_DMA_INFO(p) ((DEV_SCATTER_DMA_VIRTUAL_INFO *)((p)->HIFPrivate[0])) - -static HIF_SCATTER_REQ *DevAllocScatterReq(HIF_DEVICE *Context) -{ - DL_LIST *pItem; - AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context; - LOCK_AR6K(pDev); - pItem = DL_ListRemoveItemFromHead(&pDev->ScatterReqHead); - UNLOCK_AR6K(pDev); - if (pItem != NULL) { - return A_CONTAINING_STRUCT(pItem, HIF_SCATTER_REQ, ListLink); - } - return NULL; -} - -static void DevFreeScatterReq(HIF_DEVICE *Context, HIF_SCATTER_REQ *pReq) -{ - AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context; - LOCK_AR6K(pDev); - DL_ListInsertTail(&pDev->ScatterReqHead, &pReq->ListLink); - UNLOCK_AR6K(pDev); -} - -A_STATUS DevCopyScatterListToFromDMABuffer(HIF_SCATTER_REQ *pReq, A_BOOL FromDMA) -{ - A_UINT8 *pDMABuffer = NULL; - int i, remaining; - A_UINT32 length; - - pDMABuffer = pReq->pScatterBounceBuffer; - - if (pDMABuffer == NULL) { - A_ASSERT(FALSE); - return A_EINVAL; - } - - remaining = (int)pReq->TotalLength; - - for (i = 0; i < pReq->ValidScatterEntries; i++) { - - length = min((int)pReq->ScatterList[i].Length, remaining); - - if (length != (int)pReq->ScatterList[i].Length) { - A_ASSERT(FALSE); - /* there is a problem with the scatter list */ - return A_EINVAL; - } - - if (FromDMA) { - /* from DMA buffer */ - A_MEMCPY(pReq->ScatterList[i].pBuffer, pDMABuffer , length); - } else { - /* to DMA buffer */ - A_MEMCPY(pDMABuffer, pReq->ScatterList[i].pBuffer, length); - } - - pDMABuffer += length; - remaining -= length; - } - - return A_OK; -} - -static void DevReadWriteScatterAsyncHandler(void *Context, HTC_PACKET *pPacket) -{ - AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context; - HIF_SCATTER_REQ *pReq = (HIF_SCATTER_REQ *)pPacket->pPktContext; - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+DevReadWriteScatterAsyncHandler: (dev: 0x%lX)\n", (unsigned long)pDev)); - - pReq->CompletionStatus = pPacket->Status; - - AR6KFreeIOPacket(pDev,pPacket); - - pReq->CompletionRoutine(pReq); - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("-DevReadWriteScatterAsyncHandler \n")); -} - -static A_STATUS DevReadWriteScatter(HIF_DEVICE *Context, HIF_SCATTER_REQ *pReq) -{ - AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context; - A_STATUS status = A_OK; - HTC_PACKET *pIOPacket = NULL; - A_UINT32 request = pReq->Request; - - do { - - if (pReq->TotalLength > AR6K_MAX_TRANSFER_SIZE_PER_SCATTER) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("Invalid length: %d \n", pReq->TotalLength)); - break; - } - - if (pReq->TotalLength == 0) { - A_ASSERT(FALSE); - break; - } - - if (request & HIF_ASYNCHRONOUS) { - /* use an I/O packet to carry this request */ - pIOPacket = AR6KAllocIOPacket(pDev); - if (NULL == pIOPacket) { - status = A_NO_MEMORY; - break; - } - - /* save the request */ - pIOPacket->pPktContext = pReq; - /* stick in our completion routine when the I/O operation completes */ - pIOPacket->Completion = DevReadWriteScatterAsyncHandler; - pIOPacket->pContext = pDev; - } - - if (request & HIF_WRITE) { - /* in virtual DMA, we are issuing the requests through the legacy HIFReadWrite API - * this API will adjust the address automatically for the last byte to fall on the mailbox - * EOM. */ - - /* if the address is an extended address, we can adjust the address here since the extended - * address will bypass the normal checks in legacy HIF layers */ - if (pReq->Address == pDev->MailBoxInfo.MboxProp[HTC_MAILBOX].ExtendedAddress) { - pReq->Address += pDev->MailBoxInfo.MboxProp[HTC_MAILBOX].ExtendedSize - pReq->TotalLength; - } - } - - /* use legacy readwrite */ - status = HIFReadWrite(pDev->HIFDevice, - pReq->Address, - DEV_GET_VIRT_DMA_INFO(pReq)->pVirtDmaBuffer, - pReq->TotalLength, - request, - (request & HIF_ASYNCHRONOUS) ? pIOPacket : NULL); - - } while (FALSE); - - if ((status != A_PENDING) && A_FAILED(status) && (request & HIF_ASYNCHRONOUS)) { - if (pIOPacket != NULL) { - AR6KFreeIOPacket(pDev,pIOPacket); - } - pReq->CompletionStatus = status; - pReq->CompletionRoutine(pReq); - status = A_OK; - } - - return status; -} - - -static void DevCleanupVirtualScatterSupport(AR6K_DEVICE *pDev) -{ - HIF_SCATTER_REQ *pReq; - - while (1) { - pReq = DevAllocScatterReq((HIF_DEVICE *)pDev); - if (NULL == pReq) { - break; - } - A_FREE(pReq); - } - -} - - /* function to set up virtual scatter support if HIF layer has not implemented the interface */ -static A_STATUS DevSetupVirtualScatterSupport(AR6K_DEVICE *pDev) -{ - A_STATUS status = A_OK; - int bufferSize, sgreqSize; - int i; - DEV_SCATTER_DMA_VIRTUAL_INFO *pVirtualInfo; - HIF_SCATTER_REQ *pReq; - - bufferSize = sizeof(DEV_SCATTER_DMA_VIRTUAL_INFO) + - 2 * (A_GET_CACHE_LINE_BYTES()) + AR6K_MAX_TRANSFER_SIZE_PER_SCATTER; - - sgreqSize = sizeof(HIF_SCATTER_REQ) + - (AR6K_SCATTER_ENTRIES_PER_REQ - 1) * (sizeof(HIF_SCATTER_ITEM)); - - for (i = 0; i < AR6K_SCATTER_REQS; i++) { - /* allocate the scatter request, buffer info and the actual virtual buffer itself */ - pReq = (HIF_SCATTER_REQ *)A_MALLOC_NOWAIT(sgreqSize + bufferSize); - - if (NULL == pReq) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Alloc HIF_SCATTER_REQ fail with NOWAIT func. Try wait version\n", __FUNCTION__)); - pReq = (HIF_SCATTER_REQ *)A_MALLOC(sgreqSize + bufferSize); - } - if (NULL == pReq) { - status = A_NO_MEMORY; - break; - } - - A_MEMZERO(pReq, sgreqSize); - - /* the virtual DMA starts after the scatter request struct */ - pVirtualInfo = (DEV_SCATTER_DMA_VIRTUAL_INFO *)((A_UINT8 *)pReq + sgreqSize); - A_MEMZERO(pVirtualInfo, sizeof(DEV_SCATTER_DMA_VIRTUAL_INFO)); - - pVirtualInfo->pVirtDmaBuffer = &pVirtualInfo->DataArea[0]; - /* align buffer to cache line in case host controller can actually DMA this */ - pVirtualInfo->pVirtDmaBuffer = A_ALIGN_TO_CACHE_LINE(pVirtualInfo->pVirtDmaBuffer); - /* store the structure in the private area */ - pReq->HIFPrivate[0] = pVirtualInfo; - /* we emulate a DMA bounce interface */ - pReq->ScatterMethod = HIF_SCATTER_DMA_BOUNCE; - pReq->pScatterBounceBuffer = pVirtualInfo->pVirtDmaBuffer; - /* free request to the list */ - DevFreeScatterReq((HIF_DEVICE *)pDev,pReq); - } - - if (A_FAILED(status)) { - DevCleanupVirtualScatterSupport(pDev); - } else { - pDev->HifScatterInfo.pAllocateReqFunc = DevAllocScatterReq; - pDev->HifScatterInfo.pFreeReqFunc = DevFreeScatterReq; - pDev->HifScatterInfo.pReadWriteScatterFunc = DevReadWriteScatter; - pDev->HifScatterInfo.MaxScatterEntries = AR6K_SCATTER_ENTRIES_PER_REQ; - pDev->HifScatterInfo.MaxTransferSizePerScatterReq = AR6K_MAX_TRANSFER_SIZE_PER_SCATTER; - pDev->ScatterIsVirtual = TRUE; - } - - return status; -} - -A_STATUS DevCleanupMsgBundling(AR6K_DEVICE *pDev) -{ - A_STATUS status = A_OK; - - if(NULL != pDev) - { - DevCleanupVirtualScatterSupport(pDev); - } - - return status; -} - -A_STATUS DevSetupMsgBundling(AR6K_DEVICE *pDev, int MaxMsgsPerTransfer) -{ - A_STATUS status; - - if (pDev->MailBoxInfo.Flags & HIF_MBOX_FLAG_NO_BUNDLING) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, ("HIF requires bundling disabled\n")); - return A_ENOTSUP; - } - - status = HIFConfigureDevice(pDev->HIFDevice, - HIF_CONFIGURE_QUERY_SCATTER_REQUEST_SUPPORT, - &pDev->HifScatterInfo, - sizeof(pDev->HifScatterInfo)); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, - ("AR6K: ** HIF layer does not support scatter requests (%d) \n",status)); - - /* we can try to use a virtual DMA scatter mechanism using legacy HIFReadWrite() */ - status = DevSetupVirtualScatterSupport(pDev); - - if (A_SUCCESS(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("AR6K: virtual scatter transfers enabled (max scatter items:%d: maxlen:%d) \n", - DEV_GET_MAX_MSG_PER_BUNDLE(pDev), DEV_GET_MAX_BUNDLE_LENGTH(pDev))); - } - - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("AR6K: HIF layer supports scatter requests (max scatter items:%d: maxlen:%d) \n", - DEV_GET_MAX_MSG_PER_BUNDLE(pDev), DEV_GET_MAX_BUNDLE_LENGTH(pDev))); - } - - if (A_SUCCESS(status)) { - /* for the recv path, the maximum number of bytes per recv bundle is just limited - * by the maximum transfer size at the HIF layer */ - pDev->MaxRecvBundleSize = pDev->HifScatterInfo.MaxTransferSizePerScatterReq; - - /* for the send path, the max transfer size is limited by the existence and size of - * the extended mailbox address range */ - if (pDev->MailBoxInfo.MboxProp[0].ExtendedAddress != 0) { - pDev->MaxSendBundleSize = pDev->MailBoxInfo.MboxProp[0].ExtendedSize; - } else { - /* legacy */ - pDev->MaxSendBundleSize = AR6K_LEGACY_MAX_WRITE_LENGTH; - } - - if (pDev->MaxSendBundleSize > pDev->HifScatterInfo.MaxTransferSizePerScatterReq) { - /* limit send bundle size to what the HIF can support for scatter requests */ - pDev->MaxSendBundleSize = pDev->HifScatterInfo.MaxTransferSizePerScatterReq; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("AR6K: max recv: %d max send: %d \n", - DEV_GET_MAX_BUNDLE_RECV_LENGTH(pDev), DEV_GET_MAX_BUNDLE_SEND_LENGTH(pDev))); - - } - return status; -} - -A_STATUS DevSubmitScatterRequest(AR6K_DEVICE *pDev, HIF_SCATTER_REQ *pScatterReq, A_BOOL Read, A_BOOL Async) -{ - A_STATUS status; - - if (Read) { - /* read operation */ - pScatterReq->Request = (Async) ? HIF_RD_ASYNC_BLOCK_FIX : HIF_RD_SYNC_BLOCK_FIX; - pScatterReq->Address = pDev->MailBoxInfo.MboxAddresses[HTC_MAILBOX]; - A_ASSERT(pScatterReq->TotalLength <= (A_UINT32)DEV_GET_MAX_BUNDLE_RECV_LENGTH(pDev)); - } else { - A_UINT32 mailboxWidth; - - /* write operation */ - pScatterReq->Request = (Async) ? HIF_WR_ASYNC_BLOCK_INC : HIF_WR_SYNC_BLOCK_INC; - A_ASSERT(pScatterReq->TotalLength <= (A_UINT32)DEV_GET_MAX_BUNDLE_SEND_LENGTH(pDev)); - if (pScatterReq->TotalLength > AR6K_LEGACY_MAX_WRITE_LENGTH) { - /* for large writes use the extended address */ - pScatterReq->Address = pDev->MailBoxInfo.MboxProp[HTC_MAILBOX].ExtendedAddress; - mailboxWidth = pDev->MailBoxInfo.MboxProp[HTC_MAILBOX].ExtendedSize; - } else { - pScatterReq->Address = pDev->MailBoxInfo.MboxAddresses[HTC_MAILBOX]; - mailboxWidth = AR6K_LEGACY_MAX_WRITE_LENGTH; - } - - if (!pDev->ScatterIsVirtual) { - /* we are passing this scatter list down to the HIF layer' scatter request handler, fixup the address - * so that the last byte falls on the EOM, we do this for those HIFs that support the - * scatter API */ - pScatterReq->Address += (mailboxWidth - pScatterReq->TotalLength); - } - - } - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV | ATH_DEBUG_SEND, - ("DevSubmitScatterRequest, Entries: %d, Total Length: %d Mbox:0x%X (mode: %s : %s)\n", - pScatterReq->ValidScatterEntries, - pScatterReq->TotalLength, - pScatterReq->Address, - Async ? "ASYNC" : "SYNC", - (Read) ? "RD" : "WR")); - - status = DEV_PREPARE_SCATTER_OPERATION(pScatterReq); - - if (A_FAILED(status)) { - if (Async) { - pScatterReq->CompletionStatus = status; - pScatterReq->CompletionRoutine(pScatterReq); - return A_OK; - } - return status; - } - - status = pDev->HifScatterInfo.pReadWriteScatterFunc(pDev->ScatterIsVirtual ? pDev : pDev->HIFDevice, - pScatterReq); - if (!Async) { - /* in sync mode, we can touch the scatter request */ - pScatterReq->CompletionStatus = status; - DEV_FINISH_SCATTER_OPERATION(pScatterReq); - } else { - if (status == A_PENDING) { - status = A_OK; - } - } - - return status; -} - - -#ifdef MBOXHW_UNIT_TEST - - -/* This is a mailbox hardware unit test that must be called in a schedulable context - * This test is very simple, it will send a list of buffers with a counting pattern - * and the target will invert the data and send the message back - * - * the unit test has the following constraints: - * - * The target has at least 8 buffers of 256 bytes each. The host will send - * the following pattern of buffers in rapid succession : - * - * 1 buffer - 128 bytes - * 1 buffer - 256 bytes - * 1 buffer - 512 bytes - * 1 buffer - 1024 bytes - * - * The host will send the buffers to one mailbox and wait for buffers to be reflected - * back from the same mailbox. The target sends the buffers FIFO order. - * Once the final buffer has been received for a mailbox, the next mailbox is tested. - * - * - * Note: To simplifythe test , we assume that the chosen buffer sizes - * will fall on a nice block pad - * - * It is expected that higher-order tests will be written to stress the mailboxes using - * a message-based protocol (with some performance timming) that can create more - * randomness in the packets sent over mailboxes. - * - * */ - -#define A_ROUND_UP_PWR2(x, align) (((int) (x) + ((align)-1)) & ~((align)-1)) - -#define BUFFER_BLOCK_PAD 128 - -#if 0 -#define BUFFER1 128 -#define BUFFER2 256 -#define BUFFER3 512 -#define BUFFER4 1024 -#endif - -#if 1 -#define BUFFER1 80 -#define BUFFER2 200 -#define BUFFER3 444 -#define BUFFER4 800 -#endif - -#define TOTAL_BYTES (A_ROUND_UP_PWR2(BUFFER1,BUFFER_BLOCK_PAD) + \ - A_ROUND_UP_PWR2(BUFFER2,BUFFER_BLOCK_PAD) + \ - A_ROUND_UP_PWR2(BUFFER3,BUFFER_BLOCK_PAD) + \ - A_ROUND_UP_PWR2(BUFFER4,BUFFER_BLOCK_PAD) ) - -#define TEST_BYTES (BUFFER1 + BUFFER2 + BUFFER3 + BUFFER4) - -#define TEST_CREDITS_RECV_TIMEOUT 100 - -static A_UINT8 g_Buffer[TOTAL_BYTES]; -static A_UINT32 g_MailboxAddrs[AR6K_MAILBOXES]; -static A_UINT32 g_BlockSizes[AR6K_MAILBOXES]; - -#define BUFFER_PROC_LIST_DEPTH 4 - -typedef struct _BUFFER_PROC_LIST{ - A_UINT8 *pBuffer; - A_UINT32 length; -}BUFFER_PROC_LIST; - - -#define PUSH_BUFF_PROC_ENTRY(pList,len,pCurrpos) \ -{ \ - (pList)->pBuffer = (pCurrpos); \ - (pList)->length = (len); \ - (pCurrpos) += (len); \ - (pList)++; \ -} - -/* a simple and crude way to send different "message" sizes */ -static void AssembleBufferList(BUFFER_PROC_LIST *pList) -{ - A_UINT8 *pBuffer = g_Buffer; - -#if BUFFER_PROC_LIST_DEPTH < 4 -#error "Buffer processing list depth is not deep enough!!" -#endif - - PUSH_BUFF_PROC_ENTRY(pList,BUFFER1,pBuffer); - PUSH_BUFF_PROC_ENTRY(pList,BUFFER2,pBuffer); - PUSH_BUFF_PROC_ENTRY(pList,BUFFER3,pBuffer); - PUSH_BUFF_PROC_ENTRY(pList,BUFFER4,pBuffer); - -} - -#define FILL_ZERO TRUE -#define FILL_COUNTING FALSE -static void InitBuffers(A_BOOL Zero) -{ - A_UINT16 *pBuffer16 = (A_UINT16 *)g_Buffer; - int i; - - /* fill buffer with 16 bit counting pattern or zeros */ - for (i = 0; i < (TOTAL_BYTES / 2) ; i++) { - if (!Zero) { - pBuffer16[i] = (A_UINT16)i; - } else { - pBuffer16[i] = 0; - } - } -} - - -static A_BOOL CheckOneBuffer(A_UINT16 *pBuffer16, int Length) -{ - int i; - A_UINT16 startCount; - A_BOOL success = TRUE; - - /* get the starting count */ - startCount = pBuffer16[0]; - /* invert it, this is the expected value */ - startCount = ~startCount; - /* scan the buffer and verify */ - for (i = 0; i < (Length / 2) ; i++,startCount++) { - /* target will invert all the data */ - if ((A_UINT16)pBuffer16[i] != (A_UINT16)~startCount) { - success = FALSE; - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Invalid Data Got:0x%X, Expecting:0x%X (offset:%d, total:%d) \n", - pBuffer16[i], ((A_UINT16)~startCount), i, Length)); - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("0x%X 0x%X 0x%X 0x%X \n", - pBuffer16[i], pBuffer16[i + 1], pBuffer16[i + 2],pBuffer16[i+3])); - break; - } - } - - return success; -} - -static A_BOOL CheckBuffers(void) -{ - int i; - A_BOOL success = TRUE; - BUFFER_PROC_LIST checkList[BUFFER_PROC_LIST_DEPTH]; - - /* assemble the list */ - AssembleBufferList(checkList); - - /* scan the buffers and verify */ - for (i = 0; i < BUFFER_PROC_LIST_DEPTH ; i++) { - success = CheckOneBuffer((A_UINT16 *)checkList[i].pBuffer, checkList[i].length); - if (!success) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Buffer : 0x%X, Length:%d failed verify \n", - (A_UINT32)checkList[i].pBuffer, checkList[i].length)); - break; - } - } - - return success; -} - - /* find the end marker for the last buffer we will be sending */ -static A_UINT16 GetEndMarker(void) -{ - A_UINT8 *pBuffer; - BUFFER_PROC_LIST checkList[BUFFER_PROC_LIST_DEPTH]; - - /* fill up buffers with the normal counting pattern */ - InitBuffers(FILL_COUNTING); - - /* assemble the list we will be sending down */ - AssembleBufferList(checkList); - /* point to the last 2 bytes of the last buffer */ - pBuffer = &(checkList[BUFFER_PROC_LIST_DEPTH - 1].pBuffer[(checkList[BUFFER_PROC_LIST_DEPTH - 1].length) - 2]); - - /* the last count in the last buffer is the marker */ - return (A_UINT16)pBuffer[0] | ((A_UINT16)pBuffer[1] << 8); -} - -#define ATH_PRINT_OUT_ZONE ATH_DEBUG_ERR - -/* send the ordered buffers to the target */ -static A_STATUS SendBuffers(AR6K_DEVICE *pDev, int mbox) -{ - A_STATUS status = A_OK; - A_UINT32 request = HIF_WR_SYNC_BLOCK_INC; - BUFFER_PROC_LIST sendList[BUFFER_PROC_LIST_DEPTH]; - int i; - int totalBytes = 0; - int paddedLength; - int totalwPadding = 0; - - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, ("Sending buffers on mailbox : %d \n",mbox)); - - /* fill buffer with counting pattern */ - InitBuffers(FILL_COUNTING); - - /* assemble the order in which we send */ - AssembleBufferList(sendList); - - for (i = 0; i < BUFFER_PROC_LIST_DEPTH; i++) { - - /* we are doing block transfers, so we need to pad everything to a block size */ - paddedLength = (sendList[i].length + (g_BlockSizes[mbox] - 1)) & - (~(g_BlockSizes[mbox] - 1)); - - /* send each buffer synchronously */ - status = HIFReadWrite(pDev->HIFDevice, - g_MailboxAddrs[mbox], - sendList[i].pBuffer, - paddedLength, - request, - NULL); - if (status != A_OK) { - break; - } - totalBytes += sendList[i].length; - totalwPadding += paddedLength; - } - - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, ("Sent %d bytes (%d padded bytes) to mailbox : %d \n",totalBytes,totalwPadding,mbox)); - - return status; -} - -/* poll the mailbox credit counter until we get a credit or timeout */ -static A_STATUS GetCredits(AR6K_DEVICE *pDev, int mbox, int *pCredits) -{ - A_STATUS status = A_OK; - int timeout = TEST_CREDITS_RECV_TIMEOUT; - A_UINT8 credits = 0; - A_UINT32 address; - - while (TRUE) { - - /* Read the counter register to get credits, this auto-decrements */ - address = COUNT_DEC_ADDRESS + (AR6K_MAILBOXES + mbox) * 4; - status = HIFReadWrite(pDev->HIFDevice, address, &credits, sizeof(credits), - HIF_RD_SYNC_BYTE_FIX, NULL); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("Unable to decrement the command credit count register (mbox=%d)\n",mbox)); - status = A_ERROR; - break; - } - - if (credits) { - break; - } - - timeout--; - - if (timeout <= 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - (" Timeout reading credit registers (mbox=%d, address:0x%X) \n",mbox,address)); - status = A_ERROR; - break; - } - - /* delay a little, target may not be ready */ - A_MDELAY(1000); - - } - - if (status == A_OK) { - *pCredits = credits; - } - - return status; -} - - -/* wait for the buffers to come back */ -static A_STATUS RecvBuffers(AR6K_DEVICE *pDev, int mbox) -{ - A_STATUS status = A_OK; - A_UINT32 request = HIF_RD_SYNC_BLOCK_INC; - BUFFER_PROC_LIST recvList[BUFFER_PROC_LIST_DEPTH]; - int curBuffer; - int credits; - int i; - int totalBytes = 0; - int paddedLength; - int totalwPadding = 0; - - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, ("Waiting for buffers on mailbox : %d \n",mbox)); - - /* zero the buffers */ - InitBuffers(FILL_ZERO); - - /* assemble the order in which we should receive */ - AssembleBufferList(recvList); - - curBuffer = 0; - - while (curBuffer < BUFFER_PROC_LIST_DEPTH) { - - /* get number of buffers that have been completed, this blocks - * until we get at least 1 credit or it times out */ - status = GetCredits(pDev, mbox, &credits); - - if (status != A_OK) { - break; - } - - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, ("Got %d messages on mailbox : %d \n",credits, mbox)); - - /* get all the buffers that are sitting on the queue */ - for (i = 0; i < credits; i++) { - A_ASSERT(curBuffer < BUFFER_PROC_LIST_DEPTH); - /* recv the current buffer synchronously, the buffers should come back in - * order... with padding applied by the target */ - paddedLength = (recvList[curBuffer].length + (g_BlockSizes[mbox] - 1)) & - (~(g_BlockSizes[mbox] - 1)); - - status = HIFReadWrite(pDev->HIFDevice, - g_MailboxAddrs[mbox], - recvList[curBuffer].pBuffer, - paddedLength, - request, - NULL); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to read %d bytes on mailbox:%d : address:0x%X \n", - recvList[curBuffer].length, mbox, g_MailboxAddrs[mbox])); - break; - } - - totalwPadding += paddedLength; - totalBytes += recvList[curBuffer].length; - curBuffer++; - } - - if (status != A_OK) { - break; - } - /* go back and get some more */ - credits = 0; - } - - if (totalBytes != TEST_BYTES) { - A_ASSERT(FALSE); - } else { - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, ("Got all buffers on mbox:%d total recv :%d (w/Padding : %d) \n", - mbox, totalBytes, totalwPadding)); - } - - return status; - - -} - -static A_STATUS DoOneMboxHWTest(AR6K_DEVICE *pDev, int mbox) -{ - A_STATUS status; - - do { - /* send out buffers */ - status = SendBuffers(pDev,mbox); - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Sending buffers Failed : %d mbox:%d\n",status,mbox)); - break; - } - - /* go get them, this will block */ - status = RecvBuffers(pDev, mbox); - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Recv buffers Failed : %d mbox:%d\n",status,mbox)); - break; - } - - /* check the returned data patterns */ - if (!CheckBuffers()) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Buffer Verify Failed : mbox:%d\n",mbox)); - status = A_ERROR; - break; - } - - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, (" Send/Recv success! mailbox : %d \n",mbox)); - - } while (FALSE); - - return status; -} - -/* here is where the test starts */ -A_STATUS DoMboxHWTest(AR6K_DEVICE *pDev) -{ - int i; - A_STATUS status; - int credits = 0; - A_UINT8 params[4]; - int numBufs; - int bufferSize; - A_UINT16 temp; - - - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, (" DoMboxHWTest START - \n")); - - do { - /* get the addresses for all 4 mailboxes */ - status = HIFConfigureDevice(pDev->HIFDevice, HIF_DEVICE_GET_MBOX_ADDR, - g_MailboxAddrs, sizeof(g_MailboxAddrs)); - - if (status != A_OK) { - A_ASSERT(FALSE); - break; - } - - /* get the block sizes */ - status = HIFConfigureDevice(pDev->HIFDevice, HIF_DEVICE_GET_MBOX_BLOCK_SIZE, - g_BlockSizes, sizeof(g_BlockSizes)); - - if (status != A_OK) { - A_ASSERT(FALSE); - break; - } - - /* note, the HIF layer usually reports mbox 0 to have a block size of - * 1, but our test wants to run in block-mode for all mailboxes, so we treat all mailboxes - * the same. */ - g_BlockSizes[0] = g_BlockSizes[1]; - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, ("Block Size to use: %d \n",g_BlockSizes[0])); - - if (g_BlockSizes[1] > BUFFER_BLOCK_PAD) { - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, ("%d Block size is too large for buffer pad %d\n", - g_BlockSizes[1], BUFFER_BLOCK_PAD)); - break; - } - - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, ("Waiting for target.... \n")); - - /* the target lets us know it is ready by giving us 1 credit on - * mailbox 0 */ - status = GetCredits(pDev, 0, &credits); - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to wait for target ready \n")); - break; - } - - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, ("Target is ready ...\n")); - - /* read the first 4 scratch registers */ - status = HIFReadWrite(pDev->HIFDevice, - SCRATCH_ADDRESS, - params, - 4, - HIF_RD_SYNC_BYTE_INC, - NULL); - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to wait get parameters \n")); - break; - } - - numBufs = params[0]; - bufferSize = (int)(((A_UINT16)params[2] << 8) | (A_UINT16)params[1]); - - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, - ("Target parameters: bufs per mailbox:%d, buffer size:%d bytes (total space: %d, minimum required space (w/padding): %d) \n", - numBufs, bufferSize, (numBufs * bufferSize), TOTAL_BYTES)); - - if ((numBufs * bufferSize) < TOTAL_BYTES) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Not Enough buffer space to run test! need:%d, got:%d \n", - TOTAL_BYTES, (numBufs*bufferSize))); - status = A_ERROR; - break; - } - - temp = GetEndMarker(); - - status = HIFReadWrite(pDev->HIFDevice, - SCRATCH_ADDRESS + 4, - (A_UINT8 *)&temp, - 2, - HIF_WR_SYNC_BYTE_INC, - NULL); - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to write end marker \n")); - break; - } - - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, ("End Marker: 0x%X \n",temp)); - - temp = (A_UINT16)g_BlockSizes[1]; - /* convert to a mask */ - temp = temp - 1; - status = HIFReadWrite(pDev->HIFDevice, - SCRATCH_ADDRESS + 6, - (A_UINT8 *)&temp, - 2, - HIF_WR_SYNC_BYTE_INC, - NULL); - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to write block mask \n")); - break; - } - - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, ("Set Block Mask: 0x%X \n",temp)); - - /* execute the test on each mailbox */ - for (i = 0; i < AR6K_MAILBOXES; i++) { - status = DoOneMboxHWTest(pDev, i); - if (status != A_OK) { - break; - } - } - - } while (FALSE); - - if (status == A_OK) { - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, (" DoMboxHWTest DONE - SUCCESS! - \n")); - } else { - AR_DEBUG_PRINTF(ATH_PRINT_OUT_ZONE, (" DoMboxHWTest DONE - FAILED! - \n")); - } - /* don't let HTC_Start continue, the target is actually not running any HTC code */ - return A_ERROR; -} -#endif - - - diff --git a/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k.h b/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k.h deleted file mode 100644 index a5a3c984554e..000000000000 --- a/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k.h +++ /dev/null @@ -1,399 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// AR6K device layer that handles register level I/O -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef AR6K_H_ -#define AR6K_H_ - -#include "hci_transport_api.h" -#include "../htc_debug.h" - -#define AR6K_MAILBOXES 4 - -/* HTC runs over mailbox 0 */ -#define HTC_MAILBOX 0 - -#define AR6K_TARGET_DEBUG_INTR_MASK 0x01 - -#define OTHER_INTS_ENABLED (INT_STATUS_ENABLE_ERROR_MASK | \ - INT_STATUS_ENABLE_CPU_MASK | \ - INT_STATUS_ENABLE_COUNTER_MASK) - - -//#define MBOXHW_UNIT_TEST 1 - -#include "athstartpack.h" -typedef PREPACK struct _AR6K_IRQ_PROC_REGISTERS { - A_UINT8 host_int_status; - A_UINT8 cpu_int_status; - A_UINT8 error_int_status; - A_UINT8 counter_int_status; - A_UINT8 mbox_frame; - A_UINT8 rx_lookahead_valid; - A_UINT8 host_int_status2; - A_UINT8 gmbox_rx_avail; - A_UINT32 rx_lookahead[2]; - A_UINT32 rx_gmbox_lookahead_alias[2]; -} POSTPACK AR6K_IRQ_PROC_REGISTERS; - -#define AR6K_IRQ_PROC_REGS_SIZE sizeof(AR6K_IRQ_PROC_REGISTERS) - -typedef PREPACK struct _AR6K_IRQ_ENABLE_REGISTERS { - A_UINT8 int_status_enable; - A_UINT8 cpu_int_status_enable; - A_UINT8 error_status_enable; - A_UINT8 counter_int_status_enable; -} POSTPACK AR6K_IRQ_ENABLE_REGISTERS; - -typedef PREPACK struct _AR6K_GMBOX_CTRL_REGISTERS { - A_UINT8 int_status_enable; -} POSTPACK AR6K_GMBOX_CTRL_REGISTERS; - -#include "athendpack.h" - -#define AR6K_IRQ_ENABLE_REGS_SIZE sizeof(AR6K_IRQ_ENABLE_REGISTERS) - -#define AR6K_REG_IO_BUFFER_SIZE 32 -#define AR6K_MAX_REG_IO_BUFFERS 8 -#define FROM_DMA_BUFFER TRUE -#define TO_DMA_BUFFER FALSE -#define AR6K_SCATTER_ENTRIES_PER_REQ 16 -#define AR6K_MAX_TRANSFER_SIZE_PER_SCATTER 16*1024 -#define AR6K_SCATTER_REQS 4 -#define AR6K_LEGACY_MAX_WRITE_LENGTH 2048 - -#ifndef A_CACHE_LINE_PAD -#define A_CACHE_LINE_PAD 128 -#endif - -/* buffers for ASYNC I/O */ -typedef struct AR6K_ASYNC_REG_IO_BUFFER { - HTC_PACKET HtcPacket; /* we use an HTC packet as a wrapper for our async register-based I/O */ - A_UINT8 _Pad1[A_CACHE_LINE_PAD]; - A_UINT8 Buffer[AR6K_REG_IO_BUFFER_SIZE]; /* cache-line safe with pads around */ - A_UINT8 _Pad2[A_CACHE_LINE_PAD]; -} AR6K_ASYNC_REG_IO_BUFFER; - -typedef struct _AR6K_GMBOX_INFO { - void *pProtocolContext; - A_STATUS (*pMessagePendingCallBack)(void *pContext, A_UINT8 LookAheadBytes[], int ValidBytes); - A_STATUS (*pCreditsPendingCallback)(void *pContext, int NumCredits, A_BOOL CreditIRQEnabled); - void (*pTargetFailureCallback)(void *pContext, A_STATUS Status); - void (*pStateDumpCallback)(void *pContext); - A_BOOL CreditCountIRQEnabled; -} AR6K_GMBOX_INFO; - -typedef struct _AR6K_DEVICE { - A_MUTEX_T Lock; - A_UINT8 _Pad1[A_CACHE_LINE_PAD]; - AR6K_IRQ_PROC_REGISTERS IrqProcRegisters; /* cache-line safe with pads around */ - A_UINT8 _Pad2[A_CACHE_LINE_PAD]; - AR6K_IRQ_ENABLE_REGISTERS IrqEnableRegisters; /* cache-line safe with pads around */ - A_UINT8 _Pad3[A_CACHE_LINE_PAD]; - void *HIFDevice; - A_UINT32 BlockSize; - A_UINT32 BlockMask; - HIF_DEVICE_MBOX_INFO MailBoxInfo; - HIF_PENDING_EVENTS_FUNC GetPendingEventsFunc; - void *HTCContext; - HTC_PACKET_QUEUE RegisterIOList; - AR6K_ASYNC_REG_IO_BUFFER RegIOBuffers[AR6K_MAX_REG_IO_BUFFERS]; - void (*TargetFailureCallback)(void *Context); - A_STATUS (*MessagePendingCallback)(void *Context, - A_UINT32 LookAheads[], - int NumLookAheads, - A_BOOL *pAsyncProc, - int *pNumPktsFetched); - HIF_DEVICE_IRQ_PROCESSING_MODE HifIRQProcessingMode; - HIF_MASK_UNMASK_RECV_EVENT HifMaskUmaskRecvEvent; - A_BOOL HifAttached; - HIF_DEVICE_IRQ_YIELD_PARAMS HifIRQYieldParams; - A_BOOL DSRCanYield; - int CurrentDSRRecvCount; - HIF_DEVICE_SCATTER_SUPPORT_INFO HifScatterInfo; - DL_LIST ScatterReqHead; - A_BOOL ScatterIsVirtual; - int MaxRecvBundleSize; - int MaxSendBundleSize; - AR6K_GMBOX_INFO GMboxInfo; - A_BOOL GMboxEnabled; - AR6K_GMBOX_CTRL_REGISTERS GMboxControlRegisters; - int RecheckIRQStatusCnt; -} AR6K_DEVICE; - -#define LOCK_AR6K(p) A_MUTEX_LOCK(&(p)->Lock); -#define UNLOCK_AR6K(p) A_MUTEX_UNLOCK(&(p)->Lock); -#define REF_IRQ_STATUS_RECHECK(p) (p)->RecheckIRQStatusCnt = 1 /* note: no need to lock this, it only gets set */ - -A_STATUS DevSetup(AR6K_DEVICE *pDev); -void DevCleanup(AR6K_DEVICE *pDev); -A_STATUS DevUnmaskInterrupts(AR6K_DEVICE *pDev); -A_STATUS DevMaskInterrupts(AR6K_DEVICE *pDev); -A_STATUS DevPollMboxMsgRecv(AR6K_DEVICE *pDev, - A_UINT32 *pLookAhead, - int TimeoutMS); -A_STATUS DevRWCompletionHandler(void *context, A_STATUS status); -A_STATUS DevDsrHandler(void *context); -A_STATUS DevCheckPendingRecvMsgsAsync(void *context); -void DevAsyncIrqProcessComplete(AR6K_DEVICE *pDev); -void DevDumpRegisters(AR6K_DEVICE *pDev, - AR6K_IRQ_PROC_REGISTERS *pIrqProcRegs, - AR6K_IRQ_ENABLE_REGISTERS *pIrqEnableRegs); - -#define DEV_STOP_RECV_ASYNC TRUE -#define DEV_STOP_RECV_SYNC FALSE -#define DEV_ENABLE_RECV_ASYNC TRUE -#define DEV_ENABLE_RECV_SYNC FALSE -A_STATUS DevStopRecv(AR6K_DEVICE *pDev, A_BOOL ASyncMode); -A_STATUS DevEnableRecv(AR6K_DEVICE *pDev, A_BOOL ASyncMode); -A_STATUS DevEnableInterrupts(AR6K_DEVICE *pDev); -A_STATUS DevDisableInterrupts(AR6K_DEVICE *pDev); -A_STATUS DevWaitForPendingRecv(AR6K_DEVICE *pDev,A_UINT32 TimeoutInMs,A_BOOL *pbIsRecvPending); - -#define DEV_CALC_RECV_PADDED_LEN(pDev, length) (((length) + (pDev)->BlockMask) & (~((pDev)->BlockMask))) -#define DEV_CALC_SEND_PADDED_LEN(pDev, length) DEV_CALC_RECV_PADDED_LEN(pDev,length) -#define DEV_IS_LEN_BLOCK_ALIGNED(pDev, length) (((length) % (pDev)->BlockSize) == 0) - -static INLINE A_STATUS DevSendPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 SendLength) { - A_UINT32 paddedLength; - A_BOOL sync = (pPacket->Completion == NULL) ? TRUE : FALSE; - A_STATUS status; - - /* adjust the length to be a multiple of block size if appropriate */ - paddedLength = DEV_CALC_SEND_PADDED_LEN(pDev, SendLength); - -#if 0 - if (paddedLength > pPacket->BufferLength) { - A_ASSERT(FALSE); - if (pPacket->Completion != NULL) { - COMPLETE_HTC_PACKET(pPacket,A_EINVAL); - return A_OK; - } - return A_EINVAL; - } -#endif - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, - ("DevSendPacket, Padded Length: %d Mbox:0x%X (mode:%s)\n", - paddedLength, - pDev->MailBoxInfo.MboxAddresses[HTC_MAILBOX], - sync ? "SYNC" : "ASYNC")); - - status = HIFReadWrite(pDev->HIFDevice, - pDev->MailBoxInfo.MboxAddresses[HTC_MAILBOX], - pPacket->pBuffer, - paddedLength, /* the padded length */ - sync ? HIF_WR_SYNC_BLOCK_INC : HIF_WR_ASYNC_BLOCK_INC, - sync ? NULL : pPacket); /* pass the packet as the context to the HIF request */ - - if (sync) { - pPacket->Status = status; - } else { - if (status == A_PENDING) { - status = A_OK; - } - } - - return status; -} - -static INLINE A_STATUS DevRecvPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 RecvLength) { - A_UINT32 paddedLength; - A_STATUS status; - A_BOOL sync = (pPacket->Completion == NULL) ? TRUE : FALSE; - - /* adjust the length to be a multiple of block size if appropriate */ - paddedLength = DEV_CALC_RECV_PADDED_LEN(pDev, RecvLength); - - if (paddedLength > pPacket->BufferLength) { - A_ASSERT(FALSE); - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("DevRecvPacket, Not enough space for padlen:%d recvlen:%d bufferlen:%d \n", - paddedLength,RecvLength,pPacket->BufferLength)); - if (pPacket->Completion != NULL) { - COMPLETE_HTC_PACKET(pPacket,A_EINVAL); - return A_OK; - } - return A_EINVAL; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - ("DevRecvPacket (0x%lX : hdr:0x%X) Padded Length: %d Mbox:0x%X (mode:%s)\n", - (unsigned long)pPacket, pPacket->PktInfo.AsRx.ExpectedHdr, - paddedLength, - pDev->MailBoxInfo.MboxAddresses[HTC_MAILBOX], - sync ? "SYNC" : "ASYNC")); - - status = HIFReadWrite(pDev->HIFDevice, - pDev->MailBoxInfo.MboxAddresses[HTC_MAILBOX], - pPacket->pBuffer, - paddedLength, - sync ? HIF_RD_SYNC_BLOCK_FIX : HIF_RD_ASYNC_BLOCK_FIX, - sync ? NULL : pPacket); /* pass the packet as the context to the HIF request */ - - if (sync) { - pPacket->Status = status; - } - - return status; -} - -#define DEV_CHECK_RECV_YIELD(pDev) \ - ((pDev)->CurrentDSRRecvCount >= (pDev)->HifIRQYieldParams.RecvPacketYieldCount) - -#define IS_DEV_IRQ_PROC_SYNC_MODE(pDev) (HIF_DEVICE_IRQ_SYNC_ONLY == (pDev)->HifIRQProcessingMode) -#define IS_DEV_IRQ_PROCESSING_ASYNC_ALLOWED(pDev) ((pDev)->HifIRQProcessingMode != HIF_DEVICE_IRQ_SYNC_ONLY) - -/**************************************************/ -/****** Scatter Function and Definitions - * - * - */ - -A_STATUS DevCopyScatterListToFromDMABuffer(HIF_SCATTER_REQ *pReq, A_BOOL FromDMA); - - /* copy any READ data back into scatter list */ -#define DEV_FINISH_SCATTER_OPERATION(pR) \ - if (A_SUCCESS((pR)->CompletionStatus) && \ - !((pR)->Request & HIF_WRITE) && \ - ((pR)->ScatterMethod == HIF_SCATTER_DMA_BOUNCE)) { \ - (pR)->CompletionStatus = DevCopyScatterListToFromDMABuffer((pR),FROM_DMA_BUFFER); \ - } - - /* copy any WRITE data to bounce buffer */ -static INLINE A_STATUS DEV_PREPARE_SCATTER_OPERATION(HIF_SCATTER_REQ *pReq) { - if ((pReq->Request & HIF_WRITE) && (pReq->ScatterMethod == HIF_SCATTER_DMA_BOUNCE)) { - return DevCopyScatterListToFromDMABuffer(pReq,TO_DMA_BUFFER); - } else { - return A_OK; - } -} - - -A_STATUS DevSetupMsgBundling(AR6K_DEVICE *pDev, int MaxMsgsPerTransfer); - -A_STATUS DevCleanupMsgBundling(AR6K_DEVICE *pDev); - - -#define DEV_GET_MAX_MSG_PER_BUNDLE(pDev) (pDev)->HifScatterInfo.MaxScatterEntries -#define DEV_GET_MAX_BUNDLE_LENGTH(pDev) (pDev)->HifScatterInfo.MaxTransferSizePerScatterReq -#define DEV_ALLOC_SCATTER_REQ(pDev) \ - (pDev)->HifScatterInfo.pAllocateReqFunc((pDev)->ScatterIsVirtual ? (pDev) : (pDev)->HIFDevice) - -#define DEV_FREE_SCATTER_REQ(pDev,pR) \ - (pDev)->HifScatterInfo.pFreeReqFunc((pDev)->ScatterIsVirtual ? (pDev) : (pDev)->HIFDevice,(pR)) - -#define DEV_GET_MAX_BUNDLE_RECV_LENGTH(pDev) (pDev)->MaxRecvBundleSize -#define DEV_GET_MAX_BUNDLE_SEND_LENGTH(pDev) (pDev)->MaxSendBundleSize - -#define DEV_SCATTER_READ TRUE -#define DEV_SCATTER_WRITE FALSE -#define DEV_SCATTER_ASYNC TRUE -#define DEV_SCATTER_SYNC FALSE -A_STATUS DevSubmitScatterRequest(AR6K_DEVICE *pDev, HIF_SCATTER_REQ *pScatterReq, A_BOOL Read, A_BOOL Async); - -#ifdef MBOXHW_UNIT_TEST -A_STATUS DoMboxHWTest(AR6K_DEVICE *pDev); -#endif - - /* completely virtual */ -typedef struct _DEV_SCATTER_DMA_VIRTUAL_INFO { - A_UINT8 *pVirtDmaBuffer; /* dma-able buffer - CPU accessible address */ - A_UINT8 DataArea[1]; /* start of data area */ -} DEV_SCATTER_DMA_VIRTUAL_INFO; - - - -void DumpAR6KDevState(AR6K_DEVICE *pDev); - -/**************************************************/ -/****** GMBOX functions and definitions - * - * - */ - -#ifdef ATH_AR6K_ENABLE_GMBOX - -void DevCleanupGMbox(AR6K_DEVICE *pDev); -A_STATUS DevSetupGMbox(AR6K_DEVICE *pDev); -A_STATUS DevCheckGMboxInterrupts(AR6K_DEVICE *pDev); -void DevNotifyGMboxTargetFailure(AR6K_DEVICE *pDev); - -#else - - /* compiled out */ -#define DevCleanupGMbox(p) -#define DevCheckGMboxInterrupts(p) A_OK -#define DevNotifyGMboxTargetFailure(p) - -static INLINE A_STATUS DevSetupGMbox(AR6K_DEVICE *pDev) { - pDev->GMboxEnabled = FALSE; - return A_OK; -} - -#endif - -#ifdef ATH_AR6K_ENABLE_GMBOX - - /* GMBOX protocol modules must expose each of these internal APIs */ -HCI_TRANSPORT_HANDLE GMboxAttachProtocol(AR6K_DEVICE *pDev, HCI_TRANSPORT_CONFIG_INFO *pInfo); -A_STATUS GMboxProtocolInstall(AR6K_DEVICE *pDev); -void GMboxProtocolUninstall(AR6K_DEVICE *pDev); - - /* API used by GMBOX protocol modules */ -AR6K_DEVICE *HTCGetAR6KDevice(void *HTCHandle); -#define DEV_GMBOX_SET_PROTOCOL(pDev,recv_callback,credits_pending,failure,statedump,context) \ -{ \ - (pDev)->GMboxInfo.pProtocolContext = (context); \ - (pDev)->GMboxInfo.pMessagePendingCallBack = (recv_callback); \ - (pDev)->GMboxInfo.pCreditsPendingCallback = (credits_pending); \ - (pDev)->GMboxInfo.pTargetFailureCallback = (failure); \ - (pDev)->GMboxInfo.pStateDumpCallback = (statedump); \ -} - -#define DEV_GMBOX_GET_PROTOCOL(pDev) (pDev)->GMboxInfo.pProtocolContext - -A_STATUS DevGMboxWrite(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 WriteLength); -A_STATUS DevGMboxRead(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 ReadLength); - -#define PROC_IO_ASYNC TRUE -#define PROC_IO_SYNC FALSE -typedef enum GMBOX_IRQ_ACTION_TYPE { - GMBOX_ACTION_NONE = 0, - GMBOX_DISABLE_ALL, - GMBOX_ERRORS_IRQ_ENABLE, - GMBOX_RECV_IRQ_ENABLE, - GMBOX_RECV_IRQ_DISABLE, - GMBOX_CREDIT_IRQ_ENABLE, - GMBOX_CREDIT_IRQ_DISABLE, -} GMBOX_IRQ_ACTION_TYPE; - -A_STATUS DevGMboxIRQAction(AR6K_DEVICE *pDev, GMBOX_IRQ_ACTION_TYPE, A_BOOL AsyncMode); -A_STATUS DevGMboxReadCreditCounter(AR6K_DEVICE *pDev, A_BOOL AsyncMode, int *pCredits); -A_STATUS DevGMboxReadCreditSize(AR6K_DEVICE *pDev, int *pCreditSize); -A_STATUS DevGMboxRecvLookAheadPeek(AR6K_DEVICE *pDev, A_UINT8 *pLookAheadBuffer, int *pLookAheadBytes); -A_STATUS DevGMboxSetTargetInterrupt(AR6K_DEVICE *pDev, int SignalNumber, int AckTimeoutMS); - -#endif - -#endif /*AR6K_H_*/ diff --git a/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k_events.c b/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k_events.c deleted file mode 100644 index 18b733e9e9f2..000000000000 --- a/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k_events.c +++ /dev/null @@ -1,767 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// AR6K Driver layer event handling (i.e. interrupts, message polling) -// -// Author(s): ="Atheros" -//============================================================================== - -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" -#include "a_osapi.h" -#include "../htc_debug.h" -#include "hif.h" -#include "htc_packet.h" -#include "ar6k.h" -#include "target_reg_table.h" -#include "host_reg_table.h" - -extern void AR6KFreeIOPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket); -extern HTC_PACKET *AR6KAllocIOPacket(AR6K_DEVICE *pDev); - -static A_STATUS DevServiceDebugInterrupt(AR6K_DEVICE *pDev); - -#define DELAY_PER_INTERVAL_MS 10 /* 10 MS delay per polling interval */ - -/* completion routine for ALL HIF layer async I/O */ -A_STATUS DevRWCompletionHandler(void *context, A_STATUS status) -{ - HTC_PACKET *pPacket = (HTC_PACKET *)context; - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - ("+DevRWCompletionHandler (Pkt:0x%lX) , Status: %d \n", - (unsigned long)pPacket, - status)); - - COMPLETE_HTC_PACKET(pPacket,status); - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - ("-DevRWCompletionHandler\n")); - - return A_OK; -} - -/* mailbox recv message polling */ -A_STATUS DevPollMboxMsgRecv(AR6K_DEVICE *pDev, - A_UINT32 *pLookAhead, - int TimeoutMS) -{ - A_STATUS status = A_OK; - int timeout = TimeoutMS/DELAY_PER_INTERVAL_MS; - - A_ASSERT(timeout > 0); - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+DevPollMboxMsgRecv \n")); - - while (TRUE) { - - if (pDev->GetPendingEventsFunc != NULL) { - - HIF_PENDING_EVENTS_INFO events; - - /* the HIF layer uses a special mechanism to get events, do this - * synchronously */ - status = pDev->GetPendingEventsFunc(pDev->HIFDevice, - &events, - NULL); - if (A_FAILED(status)) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to get pending events \n")); - break; - } - - if (events.Events & HIF_RECV_MSG_AVAIL) - { - /* there is a message available, the lookahead should be valid now */ - *pLookAhead = events.LookAhead; - - break; - } - } else { - - /* this is the standard HIF way.... */ - /* load the register table */ - status = HIFReadWrite(pDev->HIFDevice, - HOST_INT_STATUS_ADDRESS, - (A_UINT8 *)&pDev->IrqProcRegisters, - AR6K_IRQ_PROC_REGS_SIZE, - HIF_RD_SYNC_BYTE_INC, - NULL); - - if (A_FAILED(status)){ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to read register table \n")); - break; - } - - /* check for MBOX data and valid lookahead */ - if (pDev->IrqProcRegisters.host_int_status & (1 << HTC_MAILBOX)) { - if (pDev->IrqProcRegisters.rx_lookahead_valid & (1 << HTC_MAILBOX)) - { - /* mailbox has a message and the look ahead is valid */ - *pLookAhead = pDev->IrqProcRegisters.rx_lookahead[HTC_MAILBOX]; - break; - } - } - - } - - timeout--; - - if (timeout <= 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, (" Timeout waiting for recv message \n")); - status = A_ERROR; - - /* check if the target asserted */ - if ( pDev->IrqProcRegisters.counter_int_status & AR6K_TARGET_DEBUG_INTR_MASK) { - /* target signaled an assert, process this pending interrupt - * this will call the target failure handler */ - DevServiceDebugInterrupt(pDev); - } - - break; - } - - /* delay a little */ - A_MDELAY(DELAY_PER_INTERVAL_MS); - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,(" Retry Mbox Poll : %d \n",timeout)); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("-DevPollMboxMsgRecv \n")); - - return status; -} - -static A_STATUS DevServiceCPUInterrupt(AR6K_DEVICE *pDev) -{ - A_STATUS status; - A_UINT8 cpu_int_status; - A_UINT8 regBuffer[4]; - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("CPU Interrupt\n")); - cpu_int_status = pDev->IrqProcRegisters.cpu_int_status & - pDev->IrqEnableRegisters.cpu_int_status_enable; - A_ASSERT(cpu_int_status); - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, - ("Valid interrupt source(s) in CPU_INT_STATUS: 0x%x\n", - cpu_int_status)); - - /* Clear the interrupt */ - pDev->IrqProcRegisters.cpu_int_status &= ~cpu_int_status; /* W1C */ - - /* set up the register transfer buffer to hit the register 4 times , this is done - * to make the access 4-byte aligned to mitigate issues with host bus interconnects that - * restrict bus transfer lengths to be a multiple of 4-bytes */ - - /* set W1C value to clear the interrupt, this hits the register first */ - regBuffer[0] = cpu_int_status; - /* the remaining 4 values are set to zero which have no-effect */ - regBuffer[1] = 0; - regBuffer[2] = 0; - regBuffer[3] = 0; - - status = HIFReadWrite(pDev->HIFDevice, - CPU_INT_STATUS_ADDRESS, - regBuffer, - 4, - HIF_WR_SYNC_BYTE_FIX, - NULL); - - A_ASSERT(status == A_OK); - return status; -} - - -static A_STATUS DevServiceErrorInterrupt(AR6K_DEVICE *pDev) -{ - A_STATUS status; - A_UINT8 error_int_status; - A_UINT8 regBuffer[4]; - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("Error Interrupt\n")); - error_int_status = pDev->IrqProcRegisters.error_int_status & 0x0F; - A_ASSERT(error_int_status); - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, - ("Valid interrupt source(s) in ERROR_INT_STATUS: 0x%x\n", - error_int_status)); - - if (ERROR_INT_STATUS_WAKEUP_GET(error_int_status)) { - /* Wakeup */ - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("Error : Wakeup\n")); - } - - if (ERROR_INT_STATUS_RX_UNDERFLOW_GET(error_int_status)) { - /* Rx Underflow */ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Error : Rx Underflow\n")); - } - - if (ERROR_INT_STATUS_TX_OVERFLOW_GET(error_int_status)) { - /* Tx Overflow */ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Error : Tx Overflow\n")); - } - - /* Clear the interrupt */ - pDev->IrqProcRegisters.error_int_status &= ~error_int_status; /* W1C */ - - /* set up the register transfer buffer to hit the register 4 times , this is done - * to make the access 4-byte aligned to mitigate issues with host bus interconnects that - * restrict bus transfer lengths to be a multiple of 4-bytes */ - - /* set W1C value to clear the interrupt, this hits the register first */ - regBuffer[0] = error_int_status; - /* the remaining 4 values are set to zero which have no-effect */ - regBuffer[1] = 0; - regBuffer[2] = 0; - regBuffer[3] = 0; - - status = HIFReadWrite(pDev->HIFDevice, - ERROR_INT_STATUS_ADDRESS, - regBuffer, - 4, - HIF_WR_SYNC_BYTE_FIX, - NULL); - - A_ASSERT(status == A_OK); - return status; -} - -static A_STATUS DevServiceDebugInterrupt(AR6K_DEVICE *pDev) -{ - A_UINT32 dummy; - A_STATUS status; - - /* Send a target failure event to the application */ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Target debug interrupt\n")); - - if (pDev->TargetFailureCallback != NULL) { - pDev->TargetFailureCallback(pDev->HTCContext); - } - - if (pDev->GMboxEnabled) { - DevNotifyGMboxTargetFailure(pDev); - } - - /* clear the interrupt , the debug error interrupt is - * counter 0 */ - /* read counter to clear interrupt */ - status = HIFReadWrite(pDev->HIFDevice, - COUNT_DEC_ADDRESS, - (A_UINT8 *)&dummy, - 4, - HIF_RD_SYNC_BYTE_INC, - NULL); - - A_ASSERT(status == A_OK); - return status; -} - -static A_STATUS DevServiceCounterInterrupt(AR6K_DEVICE *pDev) -{ - A_UINT8 counter_int_status; - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("Counter Interrupt\n")); - - counter_int_status = pDev->IrqProcRegisters.counter_int_status & - pDev->IrqEnableRegisters.counter_int_status_enable; - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, - ("Valid interrupt source(s) in COUNTER_INT_STATUS: 0x%x\n", - counter_int_status)); - - /* Check if the debug interrupt is pending - * NOTE: other modules like GMBOX may use the counter interrupt for - * credit flow control on other counters, we only need to check for the debug assertion - * counter interrupt */ - if (counter_int_status & AR6K_TARGET_DEBUG_INTR_MASK) { - return DevServiceDebugInterrupt(pDev); - } - - return A_OK; -} - -/* callback when our fetch to get interrupt status registers completes */ -static void DevGetEventAsyncHandler(void *Context, HTC_PACKET *pPacket) -{ - AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context; - A_UINT32 lookAhead = 0; - A_BOOL otherInts = FALSE; - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+DevGetEventAsyncHandler: (dev: 0x%lX)\n", (unsigned long)pDev)); - - do { - - if (A_FAILED(pPacket->Status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - (" GetEvents I/O request failed, status:%d \n", pPacket->Status)); - /* bail out, don't unmask HIF interrupt */ - break; - } - - if (pDev->GetPendingEventsFunc != NULL) { - /* the HIF layer collected the information for us */ - HIF_PENDING_EVENTS_INFO *pEvents = (HIF_PENDING_EVENTS_INFO *)pPacket->pBuffer; - if (pEvents->Events & HIF_RECV_MSG_AVAIL) { - lookAhead = pEvents->LookAhead; - if (0 == lookAhead) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" DevGetEventAsyncHandler1, lookAhead is zero! \n")); - } - } - if (pEvents->Events & HIF_OTHER_EVENTS) { - otherInts = TRUE; - } - } else { - /* standard interrupt table handling.... */ - AR6K_IRQ_PROC_REGISTERS *pReg = (AR6K_IRQ_PROC_REGISTERS *)pPacket->pBuffer; - A_UINT8 host_int_status; - - host_int_status = pReg->host_int_status & pDev->IrqEnableRegisters.int_status_enable; - - if (host_int_status & (1 << HTC_MAILBOX)) { - host_int_status &= ~(1 << HTC_MAILBOX); - if (pReg->rx_lookahead_valid & (1 << HTC_MAILBOX)) { - /* mailbox has a message and the look ahead is valid */ - lookAhead = pReg->rx_lookahead[HTC_MAILBOX]; - if (0 == lookAhead) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" DevGetEventAsyncHandler2, lookAhead is zero! \n")); - } - } - } - - if (host_int_status) { - /* there are other interrupts to handle */ - otherInts = TRUE; - } - } - - if (otherInts || (lookAhead == 0)) { - /* if there are other interrupts to process, we cannot do this in the async handler so - * ack the interrupt which will cause our sync handler to run again - * if however there are no more messages, we can now ack the interrupt */ - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, - (" Acking interrupt from DevGetEventAsyncHandler (otherints:%d, lookahead:0x%X)\n", - otherInts, lookAhead)); - HIFAckInterrupt(pDev->HIFDevice); - } else { - int fetched = 0; - A_STATUS status; - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, - (" DevGetEventAsyncHandler : detected another message, lookahead :0x%X \n", - lookAhead)); - /* lookahead is non-zero and there are no other interrupts to service, - * go get the next message */ - status = pDev->MessagePendingCallback(pDev->HTCContext, &lookAhead, 1, NULL, &fetched); - - if (A_SUCCESS(status) && !fetched) { - /* HTC layer could not pull out messages due to lack of resources, stop IRQ processing */ - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("MessagePendingCallback did not pull any messages, force-ack \n")); - DevAsyncIrqProcessComplete(pDev); - } - } - - } while (FALSE); - - /* free this IO packet */ - AR6KFreeIOPacket(pDev,pPacket); - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("-DevGetEventAsyncHandler \n")); -} - -/* called by the HTC layer when it wants us to check if the device has any more pending - * recv messages, this starts off a series of async requests to read interrupt registers */ -A_STATUS DevCheckPendingRecvMsgsAsync(void *context) -{ - AR6K_DEVICE *pDev = (AR6K_DEVICE *)context; - A_STATUS status = A_OK; - HTC_PACKET *pIOPacket; - - /* this is called in an ASYNC only context, we may NOT block, sleep or call any apis that can - * cause us to switch contexts */ - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+DevCheckPendingRecvMsgsAsync: (dev: 0x%lX)\n", (unsigned long)pDev)); - - do { - - if (HIF_DEVICE_IRQ_SYNC_ONLY == pDev->HifIRQProcessingMode) { - /* break the async processing chain right here, no need to continue. - * The DevDsrHandler() will handle things in a loop when things are driven - * synchronously */ - break; - } - - /* an optimization to bypass reading the IRQ status registers unecessarily which can re-wake - * the target, if upper layers determine that we are in a low-throughput mode, we can - * rely on taking another interrupt rather than re-checking the status registers which can - * re-wake the target */ - if (pDev->RecheckIRQStatusCnt == 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("Bypassing IRQ Status re-check, re-acking HIF interrupts\n")); - /* ack interrupt */ - HIFAckInterrupt(pDev->HIFDevice); - break; - } - - /* first allocate one of our HTC packets we created for async I/O - * we reuse HTC packet definitions so that we can use the completion mechanism - * in DevRWCompletionHandler() */ - pIOPacket = AR6KAllocIOPacket(pDev); - - if (NULL == pIOPacket) { - /* there should be only 1 asynchronous request out at a time to read these registers - * so this should actually never happen */ - status = A_NO_MEMORY; - A_ASSERT(FALSE); - break; - } - - /* stick in our completion routine when the I/O operation completes */ - pIOPacket->Completion = DevGetEventAsyncHandler; - pIOPacket->pContext = pDev; - - if (pDev->GetPendingEventsFunc) { - /* HIF layer has it's own mechanism, pass the IO to it.. */ - status = pDev->GetPendingEventsFunc(pDev->HIFDevice, - (HIF_PENDING_EVENTS_INFO *)pIOPacket->pBuffer, - pIOPacket); - - } else { - /* standard way, read the interrupt register table asynchronously again */ - status = HIFReadWrite(pDev->HIFDevice, - HOST_INT_STATUS_ADDRESS, - pIOPacket->pBuffer, - AR6K_IRQ_PROC_REGS_SIZE, - HIF_RD_ASYNC_BYTE_INC, - pIOPacket); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,(" Async IO issued to get interrupt status...\n")); - } while (FALSE); - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("-DevCheckPendingRecvMsgsAsync \n")); - - return status; -} - -void DevAsyncIrqProcessComplete(AR6K_DEVICE *pDev) -{ - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("DevAsyncIrqProcessComplete - forcing HIF IRQ ACK \n")); - HIFAckInterrupt(pDev->HIFDevice); -} - -/* process pending interrupts synchronously */ -static A_STATUS ProcessPendingIRQs(AR6K_DEVICE *pDev, A_BOOL *pDone, A_BOOL *pASyncProcessing) -{ - A_STATUS status = A_OK; - A_UINT8 host_int_status = 0; - A_UINT32 lookAhead = 0; - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+ProcessPendingIRQs: (dev: 0x%lX)\n", (unsigned long)pDev)); - - /*** NOTE: the HIF implementation guarantees that the context of this call allows - * us to perform SYNCHRONOUS I/O, that is we can block, sleep or call any API that - * can block or switch thread/task ontexts. - * This is a fully schedulable context. - * */ - do { - - if (pDev->IrqEnableRegisters.int_status_enable == 0) { - /* interrupt enables have been cleared, do not try to process any pending interrupts that - * may result in more bus transactions. The target may be unresponsive at this - * point. */ - break; - } - - if (pDev->GetPendingEventsFunc != NULL) { - HIF_PENDING_EVENTS_INFO events; - - /* the HIF layer uses a special mechanism to get events - * get this synchronously */ - status = pDev->GetPendingEventsFunc(pDev->HIFDevice, - &events, - NULL); - - if (A_FAILED(status)) { - break; - } - - if (events.Events & HIF_RECV_MSG_AVAIL) { - lookAhead = events.LookAhead; - if (0 == lookAhead) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" ProcessPendingIRQs1 lookAhead is zero! \n")); - } - } - - if (!(events.Events & HIF_OTHER_EVENTS) || - !(pDev->IrqEnableRegisters.int_status_enable & OTHER_INTS_ENABLED)) { - /* no need to read the register table, no other interesting interrupts. - * Some interfaces (like SPI) can shadow interrupt sources without - * requiring the host to do a full table read */ - break; - } - - /* otherwise fall through and read the register table */ - } - - /* - * Read the first 28 bytes of the HTC register table. This will yield us - * the value of different int status registers and the lookahead - * registers. - * length = sizeof(int_status) + sizeof(cpu_int_status) + - * sizeof(error_int_status) + sizeof(counter_int_status) + - * sizeof(mbox_frame) + sizeof(rx_lookahead_valid) + - * sizeof(hole) + sizeof(rx_lookahead) + - * sizeof(int_status_enable) + sizeof(cpu_int_status_enable) + - * sizeof(error_status_enable) + - * sizeof(counter_int_status_enable); - * - */ - status = HIFReadWrite(pDev->HIFDevice, - HOST_INT_STATUS_ADDRESS, - (A_UINT8 *)&pDev->IrqProcRegisters, - AR6K_IRQ_PROC_REGS_SIZE, - HIF_RD_SYNC_BYTE_INC, - NULL); - - if (A_FAILED(status)) { - break; - } - - if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_IRQ)) { - DevDumpRegisters(pDev, - &pDev->IrqProcRegisters, - &pDev->IrqEnableRegisters); - } - - /* Update only those registers that are enabled */ - host_int_status = pDev->IrqProcRegisters.host_int_status & - pDev->IrqEnableRegisters.int_status_enable; - - if (NULL == pDev->GetPendingEventsFunc) { - /* only look at mailbox status if the HIF layer did not provide this function, - * on some HIF interfaces reading the RX lookahead is not valid to do */ - if (host_int_status & (1 << HTC_MAILBOX)) { - /* mask out pending mailbox value, we use "lookAhead" as the real flag for - * mailbox processing below */ - host_int_status &= ~(1 << HTC_MAILBOX); - if (pDev->IrqProcRegisters.rx_lookahead_valid & (1 << HTC_MAILBOX)) { - /* mailbox has a message and the look ahead is valid */ - lookAhead = pDev->IrqProcRegisters.rx_lookahead[HTC_MAILBOX]; - if (0 == lookAhead) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" ProcessPendingIRQs2, lookAhead is zero! \n")); - } - } - } - } else { - /* not valid to check if the HIF has another mechanism for reading mailbox pending status*/ - host_int_status &= ~(1 << HTC_MAILBOX); - } - - if (pDev->GMboxEnabled) { - /*call GMBOX layer to process any interrupts of interest */ - status = DevCheckGMboxInterrupts(pDev); - } - - } while (FALSE); - - - do { - - /* did the interrupt status fetches succeed? */ - if (A_FAILED(status)) { - break; - } - - if ((0 == host_int_status) && (0 == lookAhead)) { - /* nothing to process, the caller can use this to break out of a loop */ - *pDone = TRUE; - break; - } - - if (lookAhead != 0) { - int fetched = 0; - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("Pending mailbox message, LookAhead: 0x%X\n",lookAhead)); - /* Mailbox Interrupt, the HTC layer may issue async requests to empty the - * mailbox... - * When emptying the recv mailbox we use the async handler above called from the - * completion routine of the callers read request. This can improve performance - * by reducing context switching when we rapidly pull packets */ - status = pDev->MessagePendingCallback(pDev->HTCContext, &lookAhead, 1, pASyncProcessing, &fetched); - if (A_FAILED(status)) { - break; - } - - if (!fetched) { - /* HTC could not pull any messages out due to lack of resources */ - /* force DSR handler to ack the interrupt */ - *pASyncProcessing = FALSE; - pDev->RecheckIRQStatusCnt = 0; - } - } - - /* now handle the rest of them */ - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, - (" Valid interrupt source(s) for OTHER interrupts: 0x%x\n", - host_int_status)); - - if (HOST_INT_STATUS_CPU_GET(host_int_status)) { - /* CPU Interrupt */ - status = DevServiceCPUInterrupt(pDev); - if (A_FAILED(status)){ - break; - } - } - - if (HOST_INT_STATUS_ERROR_GET(host_int_status)) { - /* Error Interrupt */ - status = DevServiceErrorInterrupt(pDev); - if (A_FAILED(status)){ - break; - } - } - - if (HOST_INT_STATUS_COUNTER_GET(host_int_status)) { - /* Counter Interrupt */ - status = DevServiceCounterInterrupt(pDev); - if (A_FAILED(status)){ - break; - } - } - - } while (FALSE); - - /* an optimization to bypass reading the IRQ status registers unecessarily which can re-wake - * the target, if upper layers determine that we are in a low-throughput mode, we can - * rely on taking another interrupt rather than re-checking the status registers which can - * re-wake the target. - * - * NOTE : for host interfaces that use the special GetPendingEventsFunc, this optimization cannot - * be used due to possible side-effects. For example, SPI requires the host to drain all - * messages from the mailbox before exiting the ISR routine. */ - if (!(*pASyncProcessing) && (pDev->RecheckIRQStatusCnt == 0) && (pDev->GetPendingEventsFunc == NULL)) { - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("Bypassing IRQ Status re-check, forcing done \n")); - *pDone = TRUE; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("-ProcessPendingIRQs: (done:%d, async:%d) status=%d \n", - *pDone, *pASyncProcessing, status)); - - return status; -} - - -/* Synchronousinterrupt handler, this handler kicks off all interrupt processing.*/ -A_STATUS DevDsrHandler(void *context) -{ - AR6K_DEVICE *pDev = (AR6K_DEVICE *)context; - A_STATUS status = A_OK; - A_BOOL done = FALSE; - A_BOOL asyncProc = FALSE; - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+DevDsrHandler: (dev: 0x%lX)\n", (unsigned long)pDev)); - - /* reset the recv counter that tracks when we need to yield from the DSR */ - pDev->CurrentDSRRecvCount = 0; - /* reset counter used to flag a re-scan of IRQ status registers on the target */ - pDev->RecheckIRQStatusCnt = 0; - - while (!done) { - status = ProcessPendingIRQs(pDev, &done, &asyncProc); - if (A_FAILED(status)) { - break; - } - - if (HIF_DEVICE_IRQ_SYNC_ONLY == pDev->HifIRQProcessingMode) { - /* the HIF layer does not allow async IRQ processing, override the asyncProc flag */ - asyncProc = FALSE; - /* this will cause us to re-enter ProcessPendingIRQ() and re-read interrupt status registers. - * this has a nice side effect of blocking us until all async read requests are completed. - * This behavior is required on some HIF implementations that do not allow ASYNC - * processing in interrupt handlers (like Windows CE) */ - - if (pDev->DSRCanYield && DEV_CHECK_RECV_YIELD(pDev)) { - /* ProcessPendingIRQs() pulled enough recv messages to satisfy the yield count, stop - * checking for more messages and return */ - break; - } - } - - if (asyncProc) { - /* the function performed some async I/O for performance, we - need to exit the ISR immediately, the check below will prevent the interrupt from being - Ack'd while we handle it asynchronously */ - break; - } - - } - - if (A_SUCCESS(status) && !asyncProc) { - /* Ack the interrupt only if : - * 1. we did not get any errors in processing interrupts - * 2. there are no outstanding async processing requests */ - if (pDev->DSRCanYield) { - /* if the DSR can yield do not ACK the interrupt, there could be more pending messages. - * The HIF layer must ACK the interrupt on behalf of HTC */ - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,(" Yield in effect (cur RX count: %d) \n", pDev->CurrentDSRRecvCount)); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,(" Acking interrupt from DevDsrHandler \n")); - HIFAckInterrupt(pDev->HIFDevice); - } - } - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("-DevDsrHandler \n")); - return status; -} - -void DumpAR6KDevState(AR6K_DEVICE *pDev) -{ - A_STATUS status; - AR6K_IRQ_ENABLE_REGISTERS regs; - AR6K_IRQ_PROC_REGISTERS procRegs; - - LOCK_AR6K(pDev); - /* copy into our temp area */ - A_MEMCPY(®s,&pDev->IrqEnableRegisters,AR6K_IRQ_ENABLE_REGS_SIZE); - UNLOCK_AR6K(pDev); - - /* load the register table from the device */ - status = HIFReadWrite(pDev->HIFDevice, - HOST_INT_STATUS_ADDRESS, - (A_UINT8 *)&procRegs, - AR6K_IRQ_PROC_REGS_SIZE, - HIF_RD_SYNC_BYTE_INC, - NULL); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("DumpAR6KDevState : Failed to read register table (%d) \n",status)); - return; - } - - DevDumpRegisters(pDev,&procRegs,®s); - - if (pDev->GMboxInfo.pStateDumpCallback != NULL) { - pDev->GMboxInfo.pStateDumpCallback(pDev->GMboxInfo.pProtocolContext); - } - - /* dump any bus state at the HIF layer */ - HIFConfigureDevice(pDev->HIFDevice,HIF_DEVICE_DEBUG_BUS_STATE,NULL,0); - -} - - diff --git a/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k_gmbox.c b/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k_gmbox.c deleted file mode 100644 index 4aacbea60fb8..000000000000 --- a/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k_gmbox.c +++ /dev/null @@ -1,757 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Generic MBOX API implementation -// -// Author(s): ="Atheros" -//============================================================================== - -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" -#include "a_osapi.h" -#include "../htc_debug.h" -#include "hif.h" -#include "htc_packet.h" -#include "ar6k.h" -#include "hw/mbox_host_reg.h" -#include "gmboxif.h" - -/* - * This file provides management functions and a toolbox for GMBOX protocol modules. - * Only one protocol module can be installed at a time. The determination of which protocol - * module is installed is determined at compile time. - * - */ -#ifdef ATH_AR6K_ENABLE_GMBOX - /* GMBOX definitions */ -#define GMBOX_INT_STATUS_ENABLE_REG 0x488 -#define GMBOX_INT_STATUS_RX_DATA (1 << 0) -#define GMBOX_INT_STATUS_TX_OVERFLOW (1 << 1) -#define GMBOX_INT_STATUS_RX_OVERFLOW (1 << 2) - -#define GMBOX_LOOKAHEAD_MUX_REG 0x498 -#define GMBOX_LA_MUX_OVERRIDE_2_3 (1 << 0) - -#define AR6K_GMBOX_CREDIT_DEC_ADDRESS (COUNT_DEC_ADDRESS + 4 * AR6K_GMBOX_CREDIT_COUNTER) -#define AR6K_GMBOX_CREDIT_SIZE_ADDRESS (COUNT_ADDRESS + AR6K_GMBOX_CREDIT_SIZE_COUNTER) - - - /* external APIs for allocating and freeing internal I/O packets to handle ASYNC I/O */ -extern void AR6KFreeIOPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket); -extern HTC_PACKET *AR6KAllocIOPacket(AR6K_DEVICE *pDev); - - -/* callback when our fetch to enable/disable completes */ -static void DevGMboxIRQActionAsyncHandler(void *Context, HTC_PACKET *pPacket) -{ - AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context; - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+DevGMboxIRQActionAsyncHandler: (dev: 0x%lX)\n", (unsigned long)pDev)); - - if (A_FAILED(pPacket->Status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("IRQAction Operation (%d) failed! status:%d \n", pPacket->PktInfo.AsRx.HTCRxFlags,pPacket->Status)); - } - /* free this IO packet */ - AR6KFreeIOPacket(pDev,pPacket); - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("-DevGMboxIRQActionAsyncHandler \n")); -} - -static A_STATUS DevGMboxCounterEnableDisable(AR6K_DEVICE *pDev, GMBOX_IRQ_ACTION_TYPE IrqAction, A_BOOL AsyncMode) -{ - A_STATUS status = A_OK; - AR6K_IRQ_ENABLE_REGISTERS regs; - HTC_PACKET *pIOPacket = NULL; - - LOCK_AR6K(pDev); - - if (GMBOX_CREDIT_IRQ_ENABLE == IrqAction) { - pDev->GMboxInfo.CreditCountIRQEnabled = TRUE; - pDev->IrqEnableRegisters.counter_int_status_enable |= - COUNTER_INT_STATUS_ENABLE_BIT_SET(1 << AR6K_GMBOX_CREDIT_COUNTER); - pDev->IrqEnableRegisters.int_status_enable |= INT_STATUS_ENABLE_COUNTER_SET(0x01); - } else { - pDev->GMboxInfo.CreditCountIRQEnabled = FALSE; - pDev->IrqEnableRegisters.counter_int_status_enable &= - ~(COUNTER_INT_STATUS_ENABLE_BIT_SET(1 << AR6K_GMBOX_CREDIT_COUNTER)); - } - /* copy into our temp area */ - A_MEMCPY(®s,&pDev->IrqEnableRegisters,AR6K_IRQ_ENABLE_REGS_SIZE); - - UNLOCK_AR6K(pDev); - - do { - - if (AsyncMode) { - - pIOPacket = AR6KAllocIOPacket(pDev); - - if (NULL == pIOPacket) { - status = A_NO_MEMORY; - A_ASSERT(FALSE); - break; - } - - /* copy values to write to our async I/O buffer */ - A_MEMCPY(pIOPacket->pBuffer,&pDev->IrqEnableRegisters,AR6K_IRQ_ENABLE_REGS_SIZE); - - /* stick in our completion routine when the I/O operation completes */ - pIOPacket->Completion = DevGMboxIRQActionAsyncHandler; - pIOPacket->pContext = pDev; - pIOPacket->PktInfo.AsRx.HTCRxFlags = IrqAction; - /* write it out asynchronously */ - HIFReadWrite(pDev->HIFDevice, - INT_STATUS_ENABLE_ADDRESS, - pIOPacket->pBuffer, - AR6K_IRQ_ENABLE_REGS_SIZE, - HIF_WR_ASYNC_BYTE_INC, - pIOPacket); - - pIOPacket = NULL; - break; - } - - /* if we get here we are doing it synchronously */ - status = HIFReadWrite(pDev->HIFDevice, - INT_STATUS_ENABLE_ADDRESS, - ®s.int_status_enable, - AR6K_IRQ_ENABLE_REGS_SIZE, - HIF_WR_SYNC_BYTE_INC, - NULL); - } while (FALSE); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - (" IRQAction Operation (%d) failed! status:%d \n", IrqAction, status)); - } else { - if (!AsyncMode) { - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, - (" IRQAction Operation (%d) success \n", IrqAction)); - } - } - - if (pIOPacket != NULL) { - AR6KFreeIOPacket(pDev,pIOPacket); - } - - return status; -} - - -A_STATUS DevGMboxIRQAction(AR6K_DEVICE *pDev, GMBOX_IRQ_ACTION_TYPE IrqAction, A_BOOL AsyncMode) -{ - A_STATUS status = A_OK; - HTC_PACKET *pIOPacket = NULL; - A_UINT8 GMboxIntControl[4]; - - if (GMBOX_CREDIT_IRQ_ENABLE == IrqAction) { - return DevGMboxCounterEnableDisable(pDev, GMBOX_CREDIT_IRQ_ENABLE, AsyncMode); - } else if(GMBOX_CREDIT_IRQ_DISABLE == IrqAction) { - return DevGMboxCounterEnableDisable(pDev, GMBOX_CREDIT_IRQ_DISABLE, AsyncMode); - } - - if (GMBOX_DISABLE_ALL == IrqAction) { - /* disable credit IRQ, those are on a different set of registers */ - DevGMboxCounterEnableDisable(pDev, GMBOX_CREDIT_IRQ_DISABLE, AsyncMode); - } - - /* take the lock to protect interrupt enable shadows */ - LOCK_AR6K(pDev); - - switch (IrqAction) { - - case GMBOX_DISABLE_ALL: - pDev->GMboxControlRegisters.int_status_enable = 0; - break; - case GMBOX_ERRORS_IRQ_ENABLE: - pDev->GMboxControlRegisters.int_status_enable |= GMBOX_INT_STATUS_TX_OVERFLOW | - GMBOX_INT_STATUS_RX_OVERFLOW; - break; - case GMBOX_RECV_IRQ_ENABLE: - pDev->GMboxControlRegisters.int_status_enable |= GMBOX_INT_STATUS_RX_DATA; - break; - case GMBOX_RECV_IRQ_DISABLE: - pDev->GMboxControlRegisters.int_status_enable &= ~GMBOX_INT_STATUS_RX_DATA; - break; - case GMBOX_ACTION_NONE: - default: - A_ASSERT(FALSE); - break; - } - - GMboxIntControl[0] = pDev->GMboxControlRegisters.int_status_enable; - GMboxIntControl[1] = GMboxIntControl[0]; - GMboxIntControl[2] = GMboxIntControl[0]; - GMboxIntControl[3] = GMboxIntControl[0]; - - UNLOCK_AR6K(pDev); - - do { - - if (AsyncMode) { - - pIOPacket = AR6KAllocIOPacket(pDev); - - if (NULL == pIOPacket) { - status = A_NO_MEMORY; - A_ASSERT(FALSE); - break; - } - - /* copy values to write to our async I/O buffer */ - A_MEMCPY(pIOPacket->pBuffer,GMboxIntControl,sizeof(GMboxIntControl)); - - /* stick in our completion routine when the I/O operation completes */ - pIOPacket->Completion = DevGMboxIRQActionAsyncHandler; - pIOPacket->pContext = pDev; - pIOPacket->PktInfo.AsRx.HTCRxFlags = IrqAction; - /* write it out asynchronously */ - HIFReadWrite(pDev->HIFDevice, - GMBOX_INT_STATUS_ENABLE_REG, - pIOPacket->pBuffer, - sizeof(GMboxIntControl), - HIF_WR_ASYNC_BYTE_FIX, - pIOPacket); - pIOPacket = NULL; - break; - } - - /* if we get here we are doing it synchronously */ - - status = HIFReadWrite(pDev->HIFDevice, - GMBOX_INT_STATUS_ENABLE_REG, - GMboxIntControl, - sizeof(GMboxIntControl), - HIF_WR_SYNC_BYTE_FIX, - NULL); - - } while (FALSE); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - (" IRQAction Operation (%d) failed! status:%d \n", IrqAction, status)); - } else { - if (!AsyncMode) { - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, - (" IRQAction Operation (%d) success \n", IrqAction)); - } - } - - if (pIOPacket != NULL) { - AR6KFreeIOPacket(pDev,pIOPacket); - } - - return status; -} - -void DevCleanupGMbox(AR6K_DEVICE *pDev) -{ - if (pDev->GMboxEnabled) { - pDev->GMboxEnabled = FALSE; - GMboxProtocolUninstall(pDev); - } -} - -A_STATUS DevSetupGMbox(AR6K_DEVICE *pDev) -{ - A_STATUS status = A_OK; - A_UINT8 muxControl[4]; - - do { - - if (0 == pDev->MailBoxInfo.GMboxAddress) { - break; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,(" GMBOX Advertised: Address:0x%X , size:%d \n", - pDev->MailBoxInfo.GMboxAddress, pDev->MailBoxInfo.GMboxSize)); - - status = DevGMboxIRQAction(pDev, GMBOX_DISABLE_ALL, PROC_IO_SYNC); - - if (A_FAILED(status)) { - break; - } - - /* write to mailbox look ahead mux control register, we want the - * GMBOX lookaheads to appear on lookaheads 2 and 3 - * the register is 1-byte wide so we need to hit it 4 times to align the operation - * to 4-bytes */ - muxControl[0] = GMBOX_LA_MUX_OVERRIDE_2_3; - muxControl[1] = GMBOX_LA_MUX_OVERRIDE_2_3; - muxControl[2] = GMBOX_LA_MUX_OVERRIDE_2_3; - muxControl[3] = GMBOX_LA_MUX_OVERRIDE_2_3; - - status = HIFReadWrite(pDev->HIFDevice, - GMBOX_LOOKAHEAD_MUX_REG, - muxControl, - sizeof(muxControl), - HIF_WR_SYNC_BYTE_FIX, /* hit this register 4 times */ - NULL); - - if (A_FAILED(status)) { - break; - } - - status = GMboxProtocolInstall(pDev); - - if (A_FAILED(status)) { - break; - } - - pDev->GMboxEnabled = TRUE; - - } while (FALSE); - - return status; -} - -A_STATUS DevCheckGMboxInterrupts(AR6K_DEVICE *pDev) -{ - A_STATUS status = A_OK; - A_UINT8 counter_int_status; - int credits; - A_UINT8 host_int_status2; - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("+DevCheckGMboxInterrupts \n")); - - /* the caller guarantees that this is a context that allows for blocking I/O */ - - do { - - host_int_status2 = pDev->IrqProcRegisters.host_int_status2 & - pDev->GMboxControlRegisters.int_status_enable; - - if (host_int_status2 & GMBOX_INT_STATUS_TX_OVERFLOW) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("GMBOX : TX Overflow \n")); - status = A_ECOMM; - } - - if (host_int_status2 & GMBOX_INT_STATUS_RX_OVERFLOW) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("GMBOX : RX Overflow \n")); - status = A_ECOMM; - } - - if (A_FAILED(status)) { - if (pDev->GMboxInfo.pTargetFailureCallback != NULL) { - pDev->GMboxInfo.pTargetFailureCallback(pDev->GMboxInfo.pProtocolContext, status); - } - break; - } - - if (host_int_status2 & GMBOX_INT_STATUS_RX_DATA) { - if (pDev->IrqProcRegisters.gmbox_rx_avail > 0) { - A_ASSERT(pDev->GMboxInfo.pMessagePendingCallBack != NULL); - status = pDev->GMboxInfo.pMessagePendingCallBack( - pDev->GMboxInfo.pProtocolContext, - (A_UINT8 *)&pDev->IrqProcRegisters.rx_gmbox_lookahead_alias[0], - pDev->IrqProcRegisters.gmbox_rx_avail); - } - } - - if (A_FAILED(status)) { - break; - } - - counter_int_status = pDev->IrqProcRegisters.counter_int_status & - pDev->IrqEnableRegisters.counter_int_status_enable; - - /* check if credit interrupt is pending */ - if (counter_int_status & (COUNTER_INT_STATUS_ENABLE_BIT_SET(1 << AR6K_GMBOX_CREDIT_COUNTER))) { - - /* do synchronous read */ - status = DevGMboxReadCreditCounter(pDev, PROC_IO_SYNC, &credits); - - if (A_FAILED(status)) { - break; - } - - A_ASSERT(pDev->GMboxInfo.pCreditsPendingCallback != NULL); - status = pDev->GMboxInfo.pCreditsPendingCallback(pDev->GMboxInfo.pProtocolContext, - credits, - pDev->GMboxInfo.CreditCountIRQEnabled); - } - - } while (FALSE); - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("-DevCheckGMboxInterrupts (%d) \n",status)); - - return status; -} - - -A_STATUS DevGMboxWrite(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 WriteLength) -{ - A_UINT32 paddedLength; - A_BOOL sync = (pPacket->Completion == NULL) ? TRUE : FALSE; - A_STATUS status; - A_UINT32 address; - - /* adjust the length to be a multiple of block size if appropriate */ - paddedLength = DEV_CALC_SEND_PADDED_LEN(pDev, WriteLength); - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, - ("DevGMboxWrite, Padded Length: %d Mbox:0x%X (mode:%s)\n", - WriteLength, - pDev->MailBoxInfo.GMboxAddress, - sync ? "SYNC" : "ASYNC")); - - /* last byte of packet has to hit the EOM marker */ - address = pDev->MailBoxInfo.GMboxAddress + pDev->MailBoxInfo.GMboxSize - paddedLength; - - status = HIFReadWrite(pDev->HIFDevice, - address, - pPacket->pBuffer, - paddedLength, /* the padded length */ - sync ? HIF_WR_SYNC_BLOCK_INC : HIF_WR_ASYNC_BLOCK_INC, - sync ? NULL : pPacket); /* pass the packet as the context to the HIF request */ - - if (sync) { - pPacket->Status = status; - } else { - if (status == A_PENDING) { - status = A_OK; - } - } - - return status; -} - -A_STATUS DevGMboxRead(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 ReadLength) -{ - - A_UINT32 paddedLength; - A_STATUS status; - A_BOOL sync = (pPacket->Completion == NULL) ? TRUE : FALSE; - - /* adjust the length to be a multiple of block size if appropriate */ - paddedLength = DEV_CALC_RECV_PADDED_LEN(pDev, ReadLength); - - if (paddedLength > pPacket->BufferLength) { - A_ASSERT(FALSE); - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("DevGMboxRead, Not enough space for padlen:%d recvlen:%d bufferlen:%d \n", - paddedLength,ReadLength,pPacket->BufferLength)); - if (pPacket->Completion != NULL) { - COMPLETE_HTC_PACKET(pPacket,A_EINVAL); - return A_OK; - } - return A_EINVAL; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - ("DevGMboxRead (0x%lX : hdr:0x%X) Padded Length: %d Mbox:0x%X (mode:%s)\n", - (unsigned long)pPacket, pPacket->PktInfo.AsRx.ExpectedHdr, - paddedLength, - pDev->MailBoxInfo.GMboxAddress, - sync ? "SYNC" : "ASYNC")); - - status = HIFReadWrite(pDev->HIFDevice, - pDev->MailBoxInfo.GMboxAddress, - pPacket->pBuffer, - paddedLength, - sync ? HIF_RD_SYNC_BLOCK_FIX : HIF_RD_ASYNC_BLOCK_FIX, - sync ? NULL : pPacket); /* pass the packet as the context to the HIF request */ - - if (sync) { - pPacket->Status = status; - } - - return status; -} - - -static int ProcessCreditCounterReadBuffer(A_UINT8 *pBuffer, int Length) -{ - int credits = 0; - - /* theory of how this works: - * We read the credit decrement register multiple times on a byte-wide basis. - * The number of times (32) aligns the I/O operation to be a multiple of 4 bytes and provides a - * reasonable chance to acquire "all" pending credits in a single I/O operation. - * - * Once we obtain the filled buffer, we can walk through it looking for credit decrement transitions. - * Each non-zero byte represents a single credit decrement (which is a credit given back to the host) - * For example if the target provides 3 credits and added 4 more during the 32-byte read operation the following - * pattern "could" appear: - * - * 0x3 0x2 0x1 0x0 0x0 0x0 0x0 0x0 0x1 0x0 0x1 0x0 0x1 0x0 0x1 0x0 ......rest zeros - * <---------> <-----------------------------> - * \_ credits aleady there \_ target adding 4 more credits - * - * The total available credits would be 7, since there are 7 non-zero bytes in the buffer. - * - * */ - - if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_RECV)) { - DebugDumpBytes(pBuffer, Length, "GMBOX Credit read buffer"); - } - - while (Length) { - if (*pBuffer != 0) { - credits++; - } - Length--; - pBuffer++; - } - - return credits; -} - - -/* callback when our fetch to enable/disable completes */ -static void DevGMboxReadCreditsAsyncHandler(void *Context, HTC_PACKET *pPacket) -{ - AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context; - - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+DevGMboxReadCreditsAsyncHandler: (dev: 0x%lX)\n", (unsigned long)pDev)); - - if (A_FAILED(pPacket->Status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("Read Credit Operation failed! status:%d \n", pPacket->Status)); - } else { - int credits = 0; - credits = ProcessCreditCounterReadBuffer(pPacket->pBuffer, AR6K_REG_IO_BUFFER_SIZE); - pDev->GMboxInfo.pCreditsPendingCallback(pDev->GMboxInfo.pProtocolContext, - credits, - pDev->GMboxInfo.CreditCountIRQEnabled); - - - } - /* free this IO packet */ - AR6KFreeIOPacket(pDev,pPacket); - AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("-DevGMboxReadCreditsAsyncHandler \n")); -} - -A_STATUS DevGMboxReadCreditCounter(AR6K_DEVICE *pDev, A_BOOL AsyncMode, int *pCredits) -{ - A_STATUS status = A_OK; - HTC_PACKET *pIOPacket = NULL; - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+DevGMboxReadCreditCounter (%s) \n", AsyncMode ? "ASYNC" : "SYNC")); - - do { - - pIOPacket = AR6KAllocIOPacket(pDev); - - if (NULL == pIOPacket) { - status = A_NO_MEMORY; - A_ASSERT(FALSE); - break; - } - - A_MEMZERO(pIOPacket->pBuffer,AR6K_REG_IO_BUFFER_SIZE); - - if (AsyncMode) { - /* stick in our completion routine when the I/O operation completes */ - pIOPacket->Completion = DevGMboxReadCreditsAsyncHandler; - pIOPacket->pContext = pDev; - /* read registers asynchronously */ - HIFReadWrite(pDev->HIFDevice, - AR6K_GMBOX_CREDIT_DEC_ADDRESS, - pIOPacket->pBuffer, - AR6K_REG_IO_BUFFER_SIZE, /* hit the register multiple times */ - HIF_RD_ASYNC_BYTE_FIX, - pIOPacket); - pIOPacket = NULL; - break; - } - - pIOPacket->Completion = NULL; - /* if we get here we are doing it synchronously */ - status = HIFReadWrite(pDev->HIFDevice, - AR6K_GMBOX_CREDIT_DEC_ADDRESS, - pIOPacket->pBuffer, - AR6K_REG_IO_BUFFER_SIZE, - HIF_RD_SYNC_BYTE_FIX, - NULL); - } while (FALSE); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - (" DevGMboxReadCreditCounter failed! status:%d \n", status)); - } - - if (pIOPacket != NULL) { - if (A_SUCCESS(status)) { - /* sync mode processing */ - *pCredits = ProcessCreditCounterReadBuffer(pIOPacket->pBuffer, AR6K_REG_IO_BUFFER_SIZE); - } - AR6KFreeIOPacket(pDev,pIOPacket); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("-DevGMboxReadCreditCounter (%s) (%d) \n", - AsyncMode ? "ASYNC" : "SYNC", status)); - - return status; -} - -A_STATUS DevGMboxReadCreditSize(AR6K_DEVICE *pDev, int *pCreditSize) -{ - A_STATUS status; - A_UINT8 buffer[4]; - - status = HIFReadWrite(pDev->HIFDevice, - AR6K_GMBOX_CREDIT_SIZE_ADDRESS, - buffer, - sizeof(buffer), - HIF_RD_SYNC_BYTE_FIX, /* hit the register 4 times to align the I/O */ - NULL); - - if (A_SUCCESS(status)) { - if (buffer[0] == 0) { - *pCreditSize = 256; - } else { - *pCreditSize = buffer[0]; - } - - } - - return status; -} - -void DevNotifyGMboxTargetFailure(AR6K_DEVICE *pDev) -{ - /* Target ASSERTED!!! */ - if (pDev->GMboxInfo.pTargetFailureCallback != NULL) { - pDev->GMboxInfo.pTargetFailureCallback(pDev->GMboxInfo.pProtocolContext, A_HARDWARE); - } -} - -A_STATUS DevGMboxRecvLookAheadPeek(AR6K_DEVICE *pDev, A_UINT8 *pLookAheadBuffer, int *pLookAheadBytes) -{ - - A_STATUS status = A_OK; - AR6K_IRQ_PROC_REGISTERS procRegs; - int maxCopy; - - do { - /* on entry the caller provides the length of the lookahead buffer */ - if (*pLookAheadBytes > sizeof(procRegs.rx_gmbox_lookahead_alias)) { - A_ASSERT(FALSE); - status = A_EINVAL; - break; - } - - maxCopy = *pLookAheadBytes; - *pLookAheadBytes = 0; - /* load the register table from the device */ - status = HIFReadWrite(pDev->HIFDevice, - HOST_INT_STATUS_ADDRESS, - (A_UINT8 *)&procRegs, - AR6K_IRQ_PROC_REGS_SIZE, - HIF_RD_SYNC_BYTE_INC, - NULL); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("DevGMboxRecvLookAheadPeek : Failed to read register table (%d) \n",status)); - break; - } - - if (procRegs.gmbox_rx_avail > 0) { - int bytes = procRegs.gmbox_rx_avail > maxCopy ? maxCopy : procRegs.gmbox_rx_avail; - A_MEMCPY(pLookAheadBuffer,&procRegs.rx_gmbox_lookahead_alias[0],bytes); - *pLookAheadBytes = bytes; - } - - } while (FALSE); - - return status; -} - -A_STATUS DevGMboxSetTargetInterrupt(AR6K_DEVICE *pDev, int Signal, int AckTimeoutMS) -{ - A_STATUS status = A_OK; - int i; - A_UINT8 buffer[4]; - - A_MEMZERO(buffer, sizeof(buffer)); - - do { - - if (Signal >= MBOX_SIG_HCI_BRIDGE_MAX) { - status = A_EINVAL; - break; - } - - /* set the last buffer to do the actual signal trigger */ - buffer[3] = (1 << Signal); - - status = HIFReadWrite(pDev->HIFDevice, - INT_WLAN_ADDRESS, - buffer, - sizeof(buffer), - HIF_WR_SYNC_BYTE_FIX, /* hit the register 4 times to align the I/O */ - NULL); - - if (A_FAILED(status)) { - break; - } - - } while (FALSE); - - - if (A_SUCCESS(status)) { - /* now read back the register to see if the bit cleared */ - while (AckTimeoutMS) { - status = HIFReadWrite(pDev->HIFDevice, - INT_WLAN_ADDRESS, - buffer, - sizeof(buffer), - HIF_RD_SYNC_BYTE_FIX, - NULL); - - if (A_FAILED(status)) { - break; - } - - for (i = 0; i < sizeof(buffer); i++) { - if (buffer[i] & (1 << Signal)) { - /* bit is still set */ - break; - } - } - - if (i >= sizeof(buffer)) { - /* done */ - break; - } - - AckTimeoutMS--; - A_MDELAY(1); - } - - if (0 == AckTimeoutMS) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("DevGMboxSetTargetInterrupt : Ack Timed-out (sig:%d) \n",Signal)); - status = A_ERROR; - } - } - - return status; - -} - -#endif //ATH_AR6K_ENABLE_GMBOX - - - - diff --git a/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k_gmbox_hciuart.c b/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k_gmbox_hciuart.c deleted file mode 100644 index c840fef07612..000000000000 --- a/drivers/net/wireless/ar6003/host/htc2/AR6000/ar6k_gmbox_hciuart.c +++ /dev/null @@ -1,1289 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Protocol module for use in bridging HCI-UART packets over the GMBOX interface -// -// Author(s): ="Atheros" -//============================================================================== - -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" -#include "a_osapi.h" -#include "../htc_debug.h" -#include "hif.h" -#include "htc_packet.h" -#include "ar6k.h" -#include "hci_transport_api.h" -#include "gmboxif.h" -#include "ar6000_diag.h" -#include "hw/apb_map.h" -#include "hw/mbox_reg.h" - -#ifdef ATH_AR6K_ENABLE_GMBOX -#define HCI_UART_COMMAND_PKT 0x01 -#define HCI_UART_ACL_PKT 0x02 -#define HCI_UART_SCO_PKT 0x03 -#define HCI_UART_EVENT_PKT 0x04 - -#define HCI_RECV_WAIT_BUFFERS (1 << 0) - -#define HCI_SEND_WAIT_CREDITS (1 << 0) - -#define HCI_UART_BRIDGE_CREDIT_SIZE 128 - -#define CREDIT_POLL_COUNT 256 - -#define HCI_DELAY_PER_INTERVAL_MS 10 -#define BTON_TIMEOUT_MS 500 -#define BTOFF_TIMEOUT_MS 500 -#define BAUD_TIMEOUT_MS 1 -#define BTPWRSAV_TIMEOUT_MS 1 - -typedef struct { - HCI_TRANSPORT_CONFIG_INFO HCIConfig; - A_BOOL HCIAttached; - A_BOOL HCIStopped; - A_UINT32 RecvStateFlags; - A_UINT32 SendStateFlags; - HCI_TRANSPORT_PACKET_TYPE WaitBufferType; - HTC_PACKET_QUEUE SendQueue; /* write queue holding HCI Command and ACL packets */ - HTC_PACKET_QUEUE HCIACLRecvBuffers; /* recv queue holding buffers for incomming ACL packets */ - HTC_PACKET_QUEUE HCIEventBuffers; /* recv queue holding buffers for incomming event packets */ - AR6K_DEVICE *pDev; - A_MUTEX_T HCIRxLock; - A_MUTEX_T HCITxLock; - int CreditsMax; - int CreditsConsumed; - int CreditsAvailable; - int CreditSize; - int CreditsCurrentSeek; - int SendProcessCount; -} GMBOX_PROTO_HCI_UART; - -#define LOCK_HCI_RX(t) A_MUTEX_LOCK(&(t)->HCIRxLock); -#define UNLOCK_HCI_RX(t) A_MUTEX_UNLOCK(&(t)->HCIRxLock); -#define LOCK_HCI_TX(t) A_MUTEX_LOCK(&(t)->HCITxLock); -#define UNLOCK_HCI_TX(t) A_MUTEX_UNLOCK(&(t)->HCITxLock); - -#define DO_HCI_RECV_INDICATION(p,pt) \ -{ AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("HCI: Indicate Recv on packet:0x%lX status:%d len:%d type:%d \n", \ - (unsigned long)(pt),(pt)->Status, A_SUCCESS((pt)->Status) ? (pt)->ActualLength : 0, HCI_GET_PACKET_TYPE(pt))); \ - (p)->HCIConfig.pHCIPktRecv((p)->HCIConfig.pContext, (pt)); \ -} - -#define DO_HCI_SEND_INDICATION(p,pt) \ -{ AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("HCI: Indicate Send on packet:0x%lX status:%d type:%d \n", \ - (unsigned long)(pt),(pt)->Status,HCI_GET_PACKET_TYPE(pt))); \ - (p)->HCIConfig.pHCISendComplete((p)->HCIConfig.pContext, (pt)); \ -} - -static A_STATUS HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, A_BOOL Synchronous); - -static void HCIUartCleanup(GMBOX_PROTO_HCI_UART *pProtocol) -{ - A_ASSERT(pProtocol != NULL); - - A_MUTEX_DELETE(&pProtocol->HCIRxLock); - A_MUTEX_DELETE(&pProtocol->HCITxLock); - - A_FREE(pProtocol); -} - -static A_STATUS InitTxCreditState(GMBOX_PROTO_HCI_UART *pProt) -{ - A_STATUS status; - int credits; - int creditPollCount = CREDIT_POLL_COUNT; - A_BOOL gotCredits = FALSE; - - pProt->CreditsConsumed = 0; - - do { - - if (pProt->CreditsMax != 0) { - /* we can only call this only once per target reset */ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HCI: InitTxCreditState - already called! \n")); - A_ASSERT(FALSE); - status = A_EINVAL; - break; - } - - /* read the credit counter. At startup the target will set the credit counter - * to the max available, we read this in a loop because it may take - * multiple credit counter reads to get all credits */ - - while (creditPollCount) { - - credits = 0; - - status = DevGMboxReadCreditCounter(pProt->pDev, PROC_IO_SYNC, &credits); - - if (A_FAILED(status)) { - break; - } - - if (!gotCredits && (0 == credits)) { - creditPollCount--; - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("HCI: credit is 0, retrying (%d) \n",creditPollCount)); - A_MDELAY(HCI_DELAY_PER_INTERVAL_MS); - continue; - } else { - gotCredits = TRUE; - } - - if (0 == credits) { - break; - } - - pProt->CreditsMax += credits; - } - - if (A_FAILED(status)) { - break; - } - - if (0 == creditPollCount) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("** HCI : Failed to get credits! GMBOX Target was not available \n")); - status = A_ERROR; - break; - } - - /* now get the size */ - status = DevGMboxReadCreditSize(pProt->pDev, &pProt->CreditSize); - - if (A_FAILED(status)) { - break; - } - - } while (FALSE); - - if (A_SUCCESS(status)) { - pProt->CreditsAvailable = pProt->CreditsMax; - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("HCI : InitTxCreditState - credits avail: %d, size: %d \n", - pProt->CreditsAvailable, pProt->CreditSize)); - } - - return status; -} - -static A_STATUS CreditsAvailableCallback(void *pContext, int Credits, A_BOOL CreditIRQEnabled) -{ - GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)pContext; - A_BOOL enableCreditIrq = FALSE; - A_BOOL disableCreditIrq = FALSE; - A_BOOL doPendingSends = FALSE; - A_STATUS status = A_OK; - - /** this callback is called under 2 conditions: - * 1. The credit IRQ interrupt was enabled and signaled. - * 2. A credit counter read completed. - * - * The function must not assume that the calling context can block ! - */ - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+CreditsAvailableCallback (Credits:%d, IRQ:%s) \n", - Credits, CreditIRQEnabled ? "ON" : "OFF")); - - LOCK_HCI_TX(pProt); - - do { - - if (0 == Credits) { - if (!CreditIRQEnabled) { - /* enable credit IRQ */ - enableCreditIrq = TRUE; - } - break; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("HCI: current credit state, consumed:%d available:%d max:%d seek:%d\n", - pProt->CreditsConsumed, - pProt->CreditsAvailable, - pProt->CreditsMax, - pProt->CreditsCurrentSeek)); - - pProt->CreditsAvailable += Credits; - A_ASSERT(pProt->CreditsAvailable <= pProt->CreditsMax); - pProt->CreditsConsumed -= Credits; - A_ASSERT(pProt->CreditsConsumed >= 0); - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("HCI: new credit state, consumed:%d available:%d max:%d seek:%d\n", - pProt->CreditsConsumed, - pProt->CreditsAvailable, - pProt->CreditsMax, - pProt->CreditsCurrentSeek)); - - if (pProt->CreditsAvailable >= pProt->CreditsCurrentSeek) { - /* we have enough credits to fullfill at least 1 packet waiting in the queue */ - pProt->CreditsCurrentSeek = 0; - pProt->SendStateFlags &= ~HCI_SEND_WAIT_CREDITS; - doPendingSends = TRUE; - if (CreditIRQEnabled) { - /* credit IRQ was enabled, we shouldn't need it anymore */ - disableCreditIrq = TRUE; - } - } else { - /* not enough credits yet, enable credit IRQ if we haven't already */ - if (!CreditIRQEnabled) { - enableCreditIrq = TRUE; - } - } - - } while (FALSE); - - UNLOCK_HCI_TX(pProt); - - if (enableCreditIrq) { - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,(" Enabling credit count IRQ...\n")); - /* must use async only */ - status = DevGMboxIRQAction(pProt->pDev, GMBOX_CREDIT_IRQ_ENABLE, PROC_IO_ASYNC); - } else if (disableCreditIrq) { - /* must use async only */ - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,(" Disabling credit count IRQ...\n")); - status = DevGMboxIRQAction(pProt->pDev, GMBOX_CREDIT_IRQ_DISABLE, PROC_IO_ASYNC); - } - - if (doPendingSends) { - HCITrySend(pProt, NULL, FALSE); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+CreditsAvailableCallback \n")); - return status; -} - -static INLINE void NotifyTransportFailure(GMBOX_PROTO_HCI_UART *pProt, A_STATUS status) -{ - if (pProt->HCIConfig.TransportFailure != NULL) { - pProt->HCIConfig.TransportFailure(pProt->HCIConfig.pContext, status); - } -} - -static void FailureCallback(void *pContext, A_STATUS Status) -{ - GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)pContext; - - /* target assertion occured */ - NotifyTransportFailure(pProt, Status); -} - -static void StateDumpCallback(void *pContext) -{ - GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)pContext; - - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("============ HCIUart State ======================\n")); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("RecvStateFlags : 0x%X \n",pProt->RecvStateFlags)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("SendStateFlags : 0x%X \n",pProt->SendStateFlags)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("WaitBufferType : %d \n",pProt->WaitBufferType)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("SendQueue Depth : %d \n",HTC_PACKET_QUEUE_DEPTH(&pProt->SendQueue))); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("CreditsMax : %d \n",pProt->CreditsMax)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("CreditsConsumed : %d \n",pProt->CreditsConsumed)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("CreditsAvailable : %d \n",pProt->CreditsAvailable)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("==================================================\n")); -} - -static A_STATUS HCIUartMessagePending(void *pContext, A_UINT8 LookAheadBytes[], int ValidBytes) -{ - GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)pContext; - A_STATUS status = A_OK; - int totalRecvLength = 0; - HCI_TRANSPORT_PACKET_TYPE pktType = HCI_PACKET_INVALID; - A_BOOL recvRefillCalled = FALSE; - A_BOOL blockRecv = FALSE; - HTC_PACKET *pPacket = NULL; - - /** caller guarantees that this is a fully block-able context (synch I/O is allowed) */ - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+HCIUartMessagePending Lookahead Bytes:%d \n",ValidBytes)); - - LOCK_HCI_RX(pProt); - - do { - - if (ValidBytes < 3) { - /* not enough for ACL or event header */ - break; - } - - if ((LookAheadBytes[0] == HCI_UART_ACL_PKT) && (ValidBytes < 5)) { - /* not enough for ACL data header */ - break; - } - - switch (LookAheadBytes[0]) { - case HCI_UART_EVENT_PKT: - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("HCI Event: %d param length: %d \n", - LookAheadBytes[1], LookAheadBytes[2])); - totalRecvLength = LookAheadBytes[2]; - totalRecvLength += 3; /* add type + event code + length field */ - pktType = HCI_EVENT_TYPE; - break; - case HCI_UART_ACL_PKT: - totalRecvLength = (LookAheadBytes[4] << 8) | LookAheadBytes[3]; - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("HCI ACL: conn:0x%X length: %d \n", - ((LookAheadBytes[2] & 0xF0) << 8) | LookAheadBytes[1], totalRecvLength)); - totalRecvLength += 5; /* add type + connection handle + length field */ - pktType = HCI_ACL_TYPE; - break; - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("**Invalid HCI packet type: %d \n",LookAheadBytes[0])); - status = A_EPROTO; - break; - } - - if (A_FAILED(status)) { - break; - } - - if (pProt->HCIConfig.pHCIPktRecvAlloc != NULL) { - UNLOCK_HCI_RX(pProt); - /* user is using a per-packet allocation callback */ - pPacket = pProt->HCIConfig.pHCIPktRecvAlloc(pProt->HCIConfig.pContext, - pktType, - totalRecvLength); - LOCK_HCI_RX(pProt); - - } else { - HTC_PACKET_QUEUE *pQueue; - /* user is using a refill handler that can refill multiple HTC buffers */ - - /* select buffer queue */ - if (pktType == HCI_ACL_TYPE) { - pQueue = &pProt->HCIACLRecvBuffers; - } else { - pQueue = &pProt->HCIEventBuffers; - } - - if (HTC_QUEUE_EMPTY(pQueue)) { - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - ("** HCI pkt type: %d has no buffers available calling allocation handler \n", - pktType)); - /* check for refill handler */ - if (pProt->HCIConfig.pHCIPktRecvRefill != NULL) { - recvRefillCalled = TRUE; - UNLOCK_HCI_RX(pProt); - /* call the re-fill handler */ - pProt->HCIConfig.pHCIPktRecvRefill(pProt->HCIConfig.pContext, - pktType, - 0); - LOCK_HCI_RX(pProt); - /* check if we have more buffers */ - pPacket = HTC_PACKET_DEQUEUE(pQueue); - /* fall through */ - } - } else { - pPacket = HTC_PACKET_DEQUEUE(pQueue); - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - ("HCI pkt type: %d now has %d recv buffers left \n", - pktType, HTC_PACKET_QUEUE_DEPTH(pQueue))); - } - } - - if (NULL == pPacket) { - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - ("** HCI pkt type: %d has no buffers available stopping recv...\n", pktType)); - /* this is not an error, we simply need to mark that we are waiting for buffers.*/ - pProt->RecvStateFlags |= HCI_RECV_WAIT_BUFFERS; - pProt->WaitBufferType = pktType; - blockRecv = TRUE; - break; - } - - if (totalRecvLength > (int)pPacket->BufferLength) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("** HCI-UART pkt: %d requires %d bytes (%d buffer bytes avail) ! \n", - LookAheadBytes[0], totalRecvLength, pPacket->BufferLength)); - status = A_EINVAL; - break; - } - - } while (FALSE); - - UNLOCK_HCI_RX(pProt); - - /* locks are released, we can go fetch the packet */ - - do { - - if (A_FAILED(status) || (NULL == pPacket)) { - break; - } - - /* do this synchronously, we don't need to be fast here */ - pPacket->Completion = NULL; - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("HCI : getting recv packet len:%d hci-uart-type: %s \n", - totalRecvLength, (LookAheadBytes[0] == HCI_UART_EVENT_PKT) ? "EVENT" : "ACL")); - - status = DevGMboxRead(pProt->pDev, pPacket, totalRecvLength); - - if (A_FAILED(status)) { - break; - } - - if (pPacket->pBuffer[0] != LookAheadBytes[0]) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("** HCI buffer does not contain expected packet type: %d ! \n", - pPacket->pBuffer[0])); - status = A_EPROTO; - break; - } - - if (pPacket->pBuffer[0] == HCI_UART_EVENT_PKT) { - /* validate event header fields */ - if ((pPacket->pBuffer[1] != LookAheadBytes[1]) || - (pPacket->pBuffer[2] != LookAheadBytes[2])) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("** HCI buffer does not match lookahead! \n")); - DebugDumpBytes(LookAheadBytes, 3, "Expected HCI-UART Header"); - DebugDumpBytes(pPacket->pBuffer, 3, "** Bad HCI-UART Header"); - status = A_EPROTO; - break; - } - } else if (pPacket->pBuffer[0] == HCI_UART_ACL_PKT) { - /* validate acl header fields */ - if ((pPacket->pBuffer[1] != LookAheadBytes[1]) || - (pPacket->pBuffer[2] != LookAheadBytes[2]) || - (pPacket->pBuffer[3] != LookAheadBytes[3]) || - (pPacket->pBuffer[4] != LookAheadBytes[4])) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("** HCI buffer does not match lookahead! \n")); - DebugDumpBytes(LookAheadBytes, 5, "Expected HCI-UART Header"); - DebugDumpBytes(pPacket->pBuffer, 5, "** Bad HCI-UART Header"); - status = A_EPROTO; - break; - } - } - - /* adjust buffer to move past packet ID */ - pPacket->pBuffer++; - pPacket->ActualLength = totalRecvLength - 1; - pPacket->Status = A_OK; - /* indicate packet */ - DO_HCI_RECV_INDICATION(pProt,pPacket); - pPacket = NULL; - - /* check if we need to refill recv buffers */ - if ((pProt->HCIConfig.pHCIPktRecvRefill != NULL) && !recvRefillCalled) { - HTC_PACKET_QUEUE *pQueue; - int watermark; - - if (pktType == HCI_ACL_TYPE) { - watermark = pProt->HCIConfig.ACLRecvBufferWaterMark; - pQueue = &pProt->HCIACLRecvBuffers; - } else { - watermark = pProt->HCIConfig.EventRecvBufferWaterMark; - pQueue = &pProt->HCIEventBuffers; - } - - if (HTC_PACKET_QUEUE_DEPTH(pQueue) < watermark) { - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - ("** HCI pkt type: %d watermark hit (%d) current:%d \n", - pktType, watermark, HTC_PACKET_QUEUE_DEPTH(pQueue))); - /* call the re-fill handler */ - pProt->HCIConfig.pHCIPktRecvRefill(pProt->HCIConfig.pContext, - pktType, - HTC_PACKET_QUEUE_DEPTH(pQueue)); - } - } - - } while (FALSE); - - /* check if we need to disable the reciever */ - if (A_FAILED(status) || blockRecv) { - DevGMboxIRQAction(pProt->pDev, GMBOX_RECV_IRQ_DISABLE, PROC_IO_SYNC); - } - - /* see if we need to recycle the recv buffer */ - if (A_FAILED(status) && (pPacket != NULL)) { - HTC_PACKET_QUEUE queue = { {0} }; - - if (A_EPROTO == status) { - DebugDumpBytes(pPacket->pBuffer, totalRecvLength, "Bad HCI-UART Recv packet"); - } - /* recycle packet */ - HTC_PACKET_RESET_RX(pPacket); - INIT_HTC_PACKET_QUEUE_AND_ADD(&queue,pPacket); - HCI_TransportAddReceivePkts(pProt,&queue); - NotifyTransportFailure(pProt,status); - } - - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("-HCIUartMessagePending \n")); - - return status; -} - -static void HCISendPacketCompletion(void *Context, HTC_PACKET *pPacket) -{ - GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)Context; - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+HCISendPacketCompletion (pPacket:0x%lX) \n",(unsigned long)pPacket)); - - if (A_FAILED(pPacket->Status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" Send Packet (0x%lX) failed: %d , len:%d \n", - (unsigned long)pPacket, pPacket->Status, pPacket->ActualLength)); - } - - DO_HCI_SEND_INDICATION(pProt,pPacket); - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+HCISendPacketCompletion \n")); -} - -static A_STATUS SeekCreditsSynch(GMBOX_PROTO_HCI_UART *pProt) -{ - A_STATUS status = A_OK; - int credits; - int retry = 100; - - while (TRUE) { - credits = 0; - status = DevGMboxReadCreditCounter(pProt->pDev, PROC_IO_SYNC, &credits); - if (A_FAILED(status)) { - break; - } - LOCK_HCI_TX(pProt); - pProt->CreditsAvailable += credits; - pProt->CreditsConsumed -= credits; - if (pProt->CreditsAvailable >= pProt->CreditsCurrentSeek) { - pProt->CreditsCurrentSeek = 0; - UNLOCK_HCI_TX(pProt); - break; - } - UNLOCK_HCI_TX(pProt); - retry--; - if (0 == retry) { - status = A_EBUSY; - break; - } - A_MDELAY(20); - } - - return status; -} - -static A_STATUS HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, A_BOOL Synchronous) -{ - A_STATUS status = A_OK; - int transferLength; - int creditsRequired, remainder; - A_UINT8 hciUartType; - A_BOOL synchSendComplete = FALSE; - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+HCITrySend (pPacket:0x%lX) %s \n",(unsigned long)pPacket, - Synchronous ? "SYNC" :"ASYNC")); - - LOCK_HCI_TX(pProt); - - /* increment write processing count on entry */ - pProt->SendProcessCount++; - - do { - - if (pProt->HCIStopped) { - status = A_ECANCELED; - break; - } - - if (pPacket != NULL) { - /* packet was supplied */ - if (Synchronous) { - /* in synchronous mode, the send queue can only hold 1 packet */ - if (!HTC_QUEUE_EMPTY(&pProt->SendQueue)) { - status = A_EBUSY; - A_ASSERT(FALSE); - break; - } - - if (pProt->SendProcessCount > 1) { - /* another thread or task is draining the TX queues */ - status = A_EBUSY; - A_ASSERT(FALSE); - break; - } - - HTC_PACKET_ENQUEUE(&pProt->SendQueue,pPacket); - - } else { - /* see if adding this packet hits the max depth (asynchronous mode only) */ - if ((pProt->HCIConfig.MaxSendQueueDepth > 0) && - ((HTC_PACKET_QUEUE_DEPTH(&pProt->SendQueue) + 1) >= pProt->HCIConfig.MaxSendQueueDepth)) { - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("HCI Send queue is full, Depth:%d, Max:%d \n", - HTC_PACKET_QUEUE_DEPTH(&pProt->SendQueue), - pProt->HCIConfig.MaxSendQueueDepth)); - /* queue will be full, invoke any callbacks to determine what action to take */ - if (pProt->HCIConfig.pHCISendFull != NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, - ("HCI : Calling driver's send full callback.... \n")); - if (pProt->HCIConfig.pHCISendFull(pProt->HCIConfig.pContext, - pPacket) == HCI_SEND_FULL_DROP) { - /* drop it */ - status = A_NO_RESOURCE; - break; - } - } - } - - HTC_PACKET_ENQUEUE(&pProt->SendQueue,pPacket); - } - - } - - if (pProt->SendStateFlags & HCI_SEND_WAIT_CREDITS) { - break; - } - - if (pProt->SendProcessCount > 1) { - /* another thread or task is draining the TX queues */ - break; - } - - /***** beyond this point only 1 thread may enter ******/ - - /* now drain the send queue for transmission as long as we have enough - * credits */ - while (!HTC_QUEUE_EMPTY(&pProt->SendQueue)) { - - pPacket = HTC_PACKET_DEQUEUE(&pProt->SendQueue); - - switch (HCI_GET_PACKET_TYPE(pPacket)) { - case HCI_COMMAND_TYPE: - hciUartType = HCI_UART_COMMAND_PKT; - break; - case HCI_ACL_TYPE: - hciUartType = HCI_UART_ACL_PKT; - break; - default: - status = A_EINVAL; - A_ASSERT(FALSE); - break; - } - - if (A_FAILED(status)) { - break; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("HCI: Got head packet:0x%lX , Type:%d Length: %d Remaining Queue Depth: %d\n", - (unsigned long)pPacket, HCI_GET_PACKET_TYPE(pPacket), pPacket->ActualLength, - HTC_PACKET_QUEUE_DEPTH(&pProt->SendQueue))); - - transferLength = 1; /* UART type header is 1 byte */ - transferLength += pPacket->ActualLength; - transferLength = DEV_CALC_SEND_PADDED_LEN(pProt->pDev, transferLength); - - /* figure out how many credits this message requires */ - creditsRequired = transferLength / pProt->CreditSize; - remainder = transferLength % pProt->CreditSize; - - if (remainder) { - creditsRequired++; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("HCI: Creds Required:%d Got:%d\n", - creditsRequired, pProt->CreditsAvailable)); - - if (creditsRequired > pProt->CreditsAvailable) { - if (Synchronous) { - /* in synchronous mode we need to seek credits in synchronously */ - pProt->CreditsCurrentSeek = creditsRequired; - UNLOCK_HCI_TX(pProt); - status = SeekCreditsSynch(pProt); - LOCK_HCI_TX(pProt); - if (A_FAILED(status)) { - break; - } - /* fall through and continue processing this send op */ - } else { - /* not enough credits, queue back to the head */ - HTC_PACKET_ENQUEUE_TO_HEAD(&pProt->SendQueue,pPacket); - /* waiting for credits */ - pProt->SendStateFlags |= HCI_SEND_WAIT_CREDITS; - /* provide a hint to reduce attempts to re-send if credits are dribbling back - * this hint is the short fall of credits */ - pProt->CreditsCurrentSeek = creditsRequired; - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("HCI: packet:0x%lX placed back in queue. head packet needs: %d credits \n", - (unsigned long)pPacket, pProt->CreditsCurrentSeek)); - pPacket = NULL; - UNLOCK_HCI_TX(pProt); - - /* schedule a credit counter read, our CreditsAvailableCallback callback will be called - * with the result */ - DevGMboxReadCreditCounter(pProt->pDev, PROC_IO_ASYNC, NULL); - - LOCK_HCI_TX(pProt); - break; - } - } - - /* caller guarantees some head room */ - pPacket->pBuffer--; - pPacket->pBuffer[0] = hciUartType; - - pProt->CreditsAvailable -= creditsRequired; - pProt->CreditsConsumed += creditsRequired; - A_ASSERT(pProt->CreditsConsumed <= pProt->CreditsMax); - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("HCI: new credit state: consumed:%d available:%d max:%d\n", - pProt->CreditsConsumed, pProt->CreditsAvailable, pProt->CreditsMax)); - - UNLOCK_HCI_TX(pProt); - - /* write it out */ - if (Synchronous) { - pPacket->Completion = NULL; - pPacket->pContext = NULL; - } else { - pPacket->Completion = HCISendPacketCompletion; - pPacket->pContext = pProt; - } - - status = DevGMboxWrite(pProt->pDev,pPacket,transferLength); - if (Synchronous) { - synchSendComplete = TRUE; - } else { - pPacket = NULL; - } - - LOCK_HCI_TX(pProt); - - } - - } while (FALSE); - - pProt->SendProcessCount--; - A_ASSERT(pProt->SendProcessCount >= 0); - UNLOCK_HCI_TX(pProt); - - if (Synchronous) { - A_ASSERT(pPacket != NULL); - if (A_SUCCESS(status) && (!synchSendComplete)) { - status = A_EBUSY; - A_ASSERT(FALSE); - LOCK_HCI_TX(pProt); - - if (pPacket) - { - if (pPacket->ListLink.pNext != NULL) { - /* remove from the queue */ - HTC_PACKET_REMOVE(&pProt->SendQueue,pPacket); - } - } - UNLOCK_HCI_TX(pProt); - } - } else { - if (A_FAILED(status) && (pPacket != NULL)) { - pPacket->Status = status; - DO_HCI_SEND_INDICATION(pProt,pPacket); - } - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("-HCITrySend: \n")); - return status; -} - -static void FlushSendQueue(GMBOX_PROTO_HCI_UART *pProt) -{ - HTC_PACKET *pPacket; - HTC_PACKET_QUEUE discardQueue = { {0} }; - - INIT_HTC_PACKET_QUEUE(&discardQueue); - - LOCK_HCI_TX(pProt); - - if (!HTC_QUEUE_EMPTY(&pProt->SendQueue)) { - HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&discardQueue,&pProt->SendQueue); - } - - UNLOCK_HCI_TX(pProt); - - /* discard packets */ - while (!HTC_QUEUE_EMPTY(&discardQueue)) { - pPacket = HTC_PACKET_DEQUEUE(&discardQueue); - pPacket->Status = A_ECANCELED; - DO_HCI_SEND_INDICATION(pProt,pPacket); - } - -} - -static void FlushRecvBuffers(GMBOX_PROTO_HCI_UART *pProt) -{ - HTC_PACKET_QUEUE discardQueue = { {0} }; - HTC_PACKET *pPacket; - - INIT_HTC_PACKET_QUEUE(&discardQueue); - - LOCK_HCI_RX(pProt); - /*transfer list items from ACL and event buffer queues to the discard queue */ - if (!HTC_QUEUE_EMPTY(&pProt->HCIACLRecvBuffers)) { - HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&discardQueue,&pProt->HCIACLRecvBuffers); - } - if (!HTC_QUEUE_EMPTY(&pProt->HCIEventBuffers)) { - HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&discardQueue,&pProt->HCIEventBuffers); - } - UNLOCK_HCI_RX(pProt); - - /* now empty the discard queue */ - while (!HTC_QUEUE_EMPTY(&discardQueue)) { - pPacket = HTC_PACKET_DEQUEUE(&discardQueue); - pPacket->Status = A_ECANCELED; - DO_HCI_RECV_INDICATION(pProt,pPacket); - } - -} - -/*** protocol module install entry point ***/ - -A_STATUS GMboxProtocolInstall(AR6K_DEVICE *pDev) -{ - A_STATUS status = A_OK; - GMBOX_PROTO_HCI_UART *pProtocol = NULL; - - do { - - pProtocol = A_MALLOC(sizeof(GMBOX_PROTO_HCI_UART)); - - if (NULL == pProtocol) { - status = A_NO_MEMORY; - break; - } - - A_MEMZERO(pProtocol, sizeof(*pProtocol)); - pProtocol->pDev = pDev; - INIT_HTC_PACKET_QUEUE(&pProtocol->SendQueue); - INIT_HTC_PACKET_QUEUE(&pProtocol->HCIACLRecvBuffers); - INIT_HTC_PACKET_QUEUE(&pProtocol->HCIEventBuffers); - A_MUTEX_INIT(&pProtocol->HCIRxLock); - A_MUTEX_INIT(&pProtocol->HCITxLock); - - } while (FALSE); - - if (A_SUCCESS(status)) { - LOCK_AR6K(pDev); - DEV_GMBOX_SET_PROTOCOL(pDev, - HCIUartMessagePending, - CreditsAvailableCallback, - FailureCallback, - StateDumpCallback, - pProtocol); - UNLOCK_AR6K(pDev); - } else { - if (pProtocol != NULL) { - HCIUartCleanup(pProtocol); - } - } - - return status; -} - -/*** protocol module uninstall entry point ***/ -void GMboxProtocolUninstall(AR6K_DEVICE *pDev) -{ - GMBOX_PROTO_HCI_UART *pProtocol = (GMBOX_PROTO_HCI_UART *)DEV_GMBOX_GET_PROTOCOL(pDev); - - if (pProtocol != NULL) { - - /* notify anyone attached */ - if (pProtocol->HCIAttached) { - A_ASSERT(pProtocol->HCIConfig.TransportRemoved != NULL); - pProtocol->HCIConfig.TransportRemoved(pProtocol->HCIConfig.pContext); - pProtocol->HCIAttached = FALSE; - } - - HCIUartCleanup(pProtocol); - DEV_GMBOX_SET_PROTOCOL(pDev,NULL,NULL,NULL,NULL,NULL); - } - -} - -static A_STATUS NotifyTransportReady(GMBOX_PROTO_HCI_UART *pProt) -{ - HCI_TRANSPORT_PROPERTIES props; - A_STATUS status = A_OK; - - do { - - A_MEMZERO(&props,sizeof(props)); - - /* HCI UART only needs one extra byte at the head to indicate the packet TYPE */ - props.HeadRoom = 1; - props.TailRoom = 0; - props.IOBlockPad = pProt->pDev->BlockSize; - if (pProt->HCIAttached) { - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("HCI: notifying attached client to transport... \n")); - A_ASSERT(pProt->HCIConfig.TransportReady != NULL); - status = pProt->HCIConfig.TransportReady(pProt, - &props, - pProt->HCIConfig.pContext); - } - - } while (FALSE); - - return status; -} - -/*********** HCI UART protocol implementation ************************************************/ - -HCI_TRANSPORT_HANDLE HCI_TransportAttach(void *HTCHandle, HCI_TRANSPORT_CONFIG_INFO *pInfo) -{ - GMBOX_PROTO_HCI_UART *pProtocol = NULL; - AR6K_DEVICE *pDev; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("+HCI_TransportAttach \n")); - - pDev = HTCGetAR6KDevice(HTCHandle); - - LOCK_AR6K(pDev); - - do { - - pProtocol = (GMBOX_PROTO_HCI_UART *)DEV_GMBOX_GET_PROTOCOL(pDev); - - if (NULL == pProtocol) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("GMBOX protocol not installed! \n")); - break; - } - - if (pProtocol->HCIAttached) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("GMBOX protocol already attached! \n")); - break; - } - - A_MEMCPY(&pProtocol->HCIConfig, pInfo, sizeof(HCI_TRANSPORT_CONFIG_INFO)); - - A_ASSERT(pProtocol->HCIConfig.pHCIPktRecv != NULL); - A_ASSERT(pProtocol->HCIConfig.pHCISendComplete != NULL); - - pProtocol->HCIAttached = TRUE; - - } while (FALSE); - - UNLOCK_AR6K(pDev); - - if (pProtocol != NULL) { - /* TODO ... should we use a worker? */ - NotifyTransportReady(pProtocol); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("-HCI_TransportAttach (0x%lX) \n",(unsigned long)pProtocol)); - return (HCI_TRANSPORT_HANDLE)pProtocol; -} - -void HCI_TransportDetach(HCI_TRANSPORT_HANDLE HciTrans) -{ - GMBOX_PROTO_HCI_UART *pProtocol = (GMBOX_PROTO_HCI_UART *)HciTrans; - AR6K_DEVICE *pDev = pProtocol->pDev; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("+HCI_TransportDetach \n")); - - LOCK_AR6K(pDev); - if (!pProtocol->HCIAttached) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("GMBOX protocol not attached! \n")); - UNLOCK_AR6K(pDev); - return; - } - pProtocol->HCIAttached = FALSE; - UNLOCK_AR6K(pDev); - - HCI_TransportStop(HciTrans); - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("-HCI_TransportAttach \n")); -} - -A_STATUS HCI_TransportAddReceivePkts(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET_QUEUE *pQueue) -{ - GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans; - A_STATUS status = A_OK; - A_BOOL unblockRecv = FALSE; - HTC_PACKET *pPacket; - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+HCI_TransportAddReceivePkt \n")); - - LOCK_HCI_RX(pProt); - - do { - - if (pProt->HCIStopped) { - status = A_ECANCELED; - break; - } - - pPacket = HTC_GET_PKT_AT_HEAD(pQueue); - - if (NULL == pPacket) { - status = A_EINVAL; - break; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,(" HCI recv packet added, type :%d, len:%d num:%d \n", - HCI_GET_PACKET_TYPE(pPacket), pPacket->BufferLength, HTC_PACKET_QUEUE_DEPTH(pQueue))); - - if (HCI_GET_PACKET_TYPE(pPacket) == HCI_EVENT_TYPE) { - HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&pProt->HCIEventBuffers, pQueue); - } else if (HCI_GET_PACKET_TYPE(pPacket) == HCI_ACL_TYPE) { - HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&pProt->HCIACLRecvBuffers, pQueue); - } else { - status = A_EINVAL; - break; - } - - if (pProt->RecvStateFlags & HCI_RECV_WAIT_BUFFERS) { - if (pProt->WaitBufferType == HCI_GET_PACKET_TYPE(pPacket)) { - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,(" HCI recv was blocked on packet type :%d, unblocking.. \n", - pProt->WaitBufferType)); - pProt->RecvStateFlags &= ~HCI_RECV_WAIT_BUFFERS; - pProt->WaitBufferType = HCI_PACKET_INVALID; - unblockRecv = TRUE; - } - } - - } while (FALSE); - - UNLOCK_HCI_RX(pProt); - - if (A_FAILED(status)) { - while (!HTC_QUEUE_EMPTY(pQueue)) { - pPacket = HTC_PACKET_DEQUEUE(pQueue); - pPacket->Status = A_ECANCELED; - DO_HCI_RECV_INDICATION(pProt,pPacket); - } - } - - if (unblockRecv) { - DevGMboxIRQAction(pProt->pDev, GMBOX_RECV_IRQ_ENABLE, PROC_IO_ASYNC); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("-HCI_TransportAddReceivePkt \n")); - - return A_OK; -} - -A_STATUS HCI_TransportSendPkt(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET *pPacket, A_BOOL Synchronous) -{ - GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans; - - return HCITrySend(pProt,pPacket,Synchronous); -} - -void HCI_TransportStop(HCI_TRANSPORT_HANDLE HciTrans) -{ - GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("+HCI_TransportStop \n")); - - LOCK_AR6K(pProt->pDev); - if (pProt->HCIStopped) { - UNLOCK_AR6K(pProt->pDev); - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("-HCI_TransportStop \n")); - return; - } - pProt->CreditsAvailable = 0; - pProt->CreditsMax = 0; - pProt->HCIStopped = TRUE; - UNLOCK_AR6K(pProt->pDev); - - /* disable interrupts */ - DevGMboxIRQAction(pProt->pDev, GMBOX_DISABLE_ALL, PROC_IO_SYNC); - FlushSendQueue(pProt); - FlushRecvBuffers(pProt); - - /* signal bridge side to power down BT */ - DevGMboxSetTargetInterrupt(pProt->pDev, MBOX_SIG_HCI_BRIDGE_BT_OFF, BTOFF_TIMEOUT_MS); - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("-HCI_TransportStop \n")); -} - -A_STATUS HCI_TransportStart(HCI_TRANSPORT_HANDLE HciTrans) -{ - A_STATUS status; - GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("+HCI_TransportStart \n")); - - /* set stopped in case we have a problem in starting */ - pProt->HCIStopped = TRUE; - - do { - - status = InitTxCreditState(pProt); - - if (A_FAILED(status)) { - break; - } - - status = DevGMboxIRQAction(pProt->pDev, GMBOX_ERRORS_IRQ_ENABLE, PROC_IO_SYNC); - - if (A_FAILED(status)) { - break; - } - /* enable recv */ - status = DevGMboxIRQAction(pProt->pDev, GMBOX_RECV_IRQ_ENABLE, PROC_IO_SYNC); - - if (A_FAILED(status)) { - break; - } - /* signal bridge side to power up BT */ - status = DevGMboxSetTargetInterrupt(pProt->pDev, MBOX_SIG_HCI_BRIDGE_BT_ON, BTON_TIMEOUT_MS); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HCI_TransportStart : Failed to trigger BT ON \n")); - break; - } - - /* we made it */ - pProt->HCIStopped = FALSE; - - } while (FALSE); - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("-HCI_TransportStart \n")); - - return status; -} - -A_STATUS HCI_TransportEnableDisableAsyncRecv(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable) -{ - GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans; - return DevGMboxIRQAction(pProt->pDev, - Enable ? GMBOX_RECV_IRQ_ENABLE : GMBOX_RECV_IRQ_DISABLE, - PROC_IO_SYNC); - -} - -A_STATUS HCI_TransportRecvHCIEventSync(HCI_TRANSPORT_HANDLE HciTrans, - HTC_PACKET *pPacket, - int MaxPollMS) -{ - GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans; - A_STATUS status = A_OK; - A_UINT8 lookAhead[8]; - int bytes; - int totalRecvLength; - - MaxPollMS = MaxPollMS / 16; - - if (MaxPollMS < 2) { - MaxPollMS = 2; - } - - while (MaxPollMS) { - - bytes = sizeof(lookAhead); - status = DevGMboxRecvLookAheadPeek(pProt->pDev,lookAhead,&bytes); - if (A_FAILED(status)) { - break; - } - - if (bytes < 3) { - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("HCI recv poll got bytes: %d, retry : %d \n", - bytes, MaxPollMS)); - A_MDELAY(16); - MaxPollMS--; - continue; - } - - totalRecvLength = 0; - switch (lookAhead[0]) { - case HCI_UART_EVENT_PKT: - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("HCI Event: %d param length: %d \n", - lookAhead[1], lookAhead[2])); - totalRecvLength = lookAhead[2]; - totalRecvLength += 3; /* add type + event code + length field */ - break; - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("**Invalid HCI packet type: %d \n",lookAhead[0])); - status = A_EPROTO; - break; - } - - if (A_FAILED(status)) { - break; - } - - pPacket->Completion = NULL; - status = DevGMboxRead(pProt->pDev,pPacket,totalRecvLength); - if (A_FAILED(status)) { - break; - } - - pPacket->pBuffer++; - pPacket->ActualLength = totalRecvLength - 1; - pPacket->Status = A_OK; - break; - } - - if (MaxPollMS == 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HCI recv poll timeout! \n")); - status = A_ERROR; - } - - return status; -} - -A_STATUS HCI_TransportSetBaudRate(HCI_TRANSPORT_HANDLE HciTrans, A_UINT32 Baud) -{ - GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans; - HIF_DEVICE *pHIFDevice = (HIF_DEVICE *)(pProt->pDev->HIFDevice); - A_UINT32 scaledBaud, scratchAddr; - A_STATUS status = A_OK; - - /* Divide the desired baud rate by 100 - * Store the LSB in the local scratch register 4 and the MSB in the local - * scratch register 5 for the target to read - */ - scratchAddr = MBOX_BASE_ADDRESS | (LOCAL_SCRATCH_ADDRESS + 4 * LSB_SCRATCH_IDX); - scaledBaud = (Baud / 100) & LOCAL_SCRATCH_VALUE_MASK; - status = ar6000_WriteRegDiag(pHIFDevice, &scratchAddr, &scaledBaud); - scratchAddr = MBOX_BASE_ADDRESS | (LOCAL_SCRATCH_ADDRESS + 4 * MSB_SCRATCH_IDX); - scaledBaud = ((Baud / 100) >> (LOCAL_SCRATCH_VALUE_MSB+1)) & LOCAL_SCRATCH_VALUE_MASK; - status |= ar6000_WriteRegDiag(pHIFDevice, &scratchAddr, &scaledBaud); - if (A_OK != status) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to set up baud rate in scratch register!")); - return status; - } - - /* Now interrupt the target to tell it about the baud rate */ - status = DevGMboxSetTargetInterrupt(pProt->pDev, MBOX_SIG_HCI_BRIDGE_BAUD_SET, BAUD_TIMEOUT_MS); - if (A_OK != status) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to tell target to change baud rate!")); - } - - return status; -} - -A_STATUS HCI_TransportEnablePowerMgmt(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable) -{ - A_STATUS status; - GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans; - - if (Enable) { - status = DevGMboxSetTargetInterrupt(pProt->pDev, MBOX_SIG_HCI_BRIDGE_PWR_SAV_ON, BTPWRSAV_TIMEOUT_MS); - } else { - status = DevGMboxSetTargetInterrupt(pProt->pDev, MBOX_SIG_HCI_BRIDGE_PWR_SAV_OFF, BTPWRSAV_TIMEOUT_MS); - } - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to enable/disable HCI power management!\n")); - } else { - if (Enable) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HCI power management ENABLED!\n")); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HCI power management DISABLED!\n")); - } - } - - return status; -} - -#endif //ATH_AR6K_ENABLE_GMBOX - diff --git a/drivers/net/wireless/ar6003/host/htc2/AR6000/makefile b/drivers/net/wireless/ar6003/host/htc2/AR6000/makefile deleted file mode 100644 index 1ba034c4900e..000000000000 --- a/drivers/net/wireless/ar6003/host/htc2/AR6000/makefile +++ /dev/null @@ -1,26 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2005-2007 Atheros Corporation. All rights reserved. -# -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -#------------------------------------------------------------------------------ -#============================================================================== -# Author(s): ="Atheros" -#============================================================================== -!INCLUDE $(_MAKEENVROOT)\makefile.def - - - diff --git a/drivers/net/wireless/ar6003/host/htc2/htc.c b/drivers/net/wireless/ar6003/host/htc2/htc.c deleted file mode 100644 index 813b4ccbdad1..000000000000 --- a/drivers/net/wireless/ar6003/host/htc2/htc.c +++ /dev/null @@ -1,578 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#include "htc_internal.h" - -#ifdef DEBUG -static ATH_DEBUG_MASK_DESCRIPTION g_HTCDebugDescription[] = { - { ATH_DEBUG_SEND , "Send"}, - { ATH_DEBUG_RECV , "Recv"}, - { ATH_DEBUG_SYNC , "Sync"}, - { ATH_DEBUG_DUMP , "Dump Data (RX or TX)"}, - { ATH_DEBUG_IRQ , "Interrupt Processing"} -}; - -ATH_DEBUG_INSTANTIATE_MODULE_VAR(htc, - "htc", - "Host Target Communications", - ATH_DEBUG_MASK_DEFAULTS, - ATH_DEBUG_DESCRIPTION_COUNT(g_HTCDebugDescription), - g_HTCDebugDescription); - -#endif - -static void HTCReportFailure(void *Context); -static void ResetEndpointStates(HTC_TARGET *target); - -void HTCFreeControlBuffer(HTC_TARGET *target, HTC_PACKET *pPacket, HTC_PACKET_QUEUE *pList) -{ - LOCK_HTC(target); - HTC_PACKET_ENQUEUE(pList,pPacket); - UNLOCK_HTC(target); -} - -HTC_PACKET *HTCAllocControlBuffer(HTC_TARGET *target, HTC_PACKET_QUEUE *pList) -{ - HTC_PACKET *pPacket; - - LOCK_HTC(target); - pPacket = HTC_PACKET_DEQUEUE(pList); - UNLOCK_HTC(target); - - return pPacket; -} - -/* cleanup the HTC instance */ -static void HTCCleanup(HTC_TARGET *target) -{ - A_INT32 i; - - DevCleanup(&target->Device); - - for (i = 0;i < NUM_CONTROL_BUFFERS;i++) { - if (target->HTCControlBuffers[i].Buffer) { - A_FREE(target->HTCControlBuffers[i].Buffer); - } - } - - if (A_IS_MUTEX_VALID(&target->HTCLock)) { - A_MUTEX_DELETE(&target->HTCLock); - } - - if (A_IS_MUTEX_VALID(&target->HTCRxLock)) { - A_MUTEX_DELETE(&target->HTCRxLock); - } - - if (A_IS_MUTEX_VALID(&target->HTCTxLock)) { - A_MUTEX_DELETE(&target->HTCTxLock); - } - /* free our instance */ - A_FREE(target); -} - -/* registered target arrival callback from the HIF layer */ -HTC_HANDLE HTCCreate(void *hif_handle, HTC_INIT_INFO *pInfo) -{ - HTC_TARGET *target = NULL; - A_STATUS status = A_OK; - int i; - A_UINT32 ctrl_bufsz; - A_UINT32 blocksizes[HTC_MAILBOX_NUM_MAX]; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HTCCreate - Enter\n")); - - A_REGISTER_MODULE_DEBUG_INFO(htc); - - do { - - /* allocate target memory */ - if ((target = (HTC_TARGET *)A_MALLOC(sizeof(HTC_TARGET))) == NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to allocate memory\n")); - status = A_ERROR; - break; - } - - A_MEMZERO(target, sizeof(HTC_TARGET)); - A_MUTEX_INIT(&target->HTCLock); - A_MUTEX_INIT(&target->HTCRxLock); - A_MUTEX_INIT(&target->HTCTxLock); - INIT_HTC_PACKET_QUEUE(&target->ControlBufferTXFreeList); - INIT_HTC_PACKET_QUEUE(&target->ControlBufferRXFreeList); - - /* give device layer the hif device handle */ - target->Device.HIFDevice = hif_handle; - /* give the device layer our context (for event processing) - * the device layer will register it's own context with HIF - * so we need to set this so we can fetch it in the target remove handler */ - target->Device.HTCContext = target; - /* set device layer target failure callback */ - target->Device.TargetFailureCallback = HTCReportFailure; - /* set device layer recv message pending callback */ - target->Device.MessagePendingCallback = HTCRecvMessagePendingHandler; - target->EpWaitingForBuffers = ENDPOINT_MAX; - - A_MEMCPY(&target->HTCInitInfo,pInfo,sizeof(HTC_INIT_INFO)); - - ResetEndpointStates(target); - - /* setup device layer */ - status = DevSetup(&target->Device); - - if (A_FAILED(status)) { - break; - } - - - /* get the block sizes */ - status = HIFConfigureDevice(hif_handle, HIF_DEVICE_GET_MBOX_BLOCK_SIZE, - blocksizes, sizeof(blocksizes)); - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to get block size info from HIF layer...\n")); - break; - } - - /* Set the control buffer size based on the block size */ - if (blocksizes[1] > HTC_MAX_CONTROL_MESSAGE_LENGTH) { - ctrl_bufsz = blocksizes[1] + HTC_HDR_LENGTH; - } else { - ctrl_bufsz = HTC_MAX_CONTROL_MESSAGE_LENGTH + HTC_HDR_LENGTH; - } - for (i = 0;i < NUM_CONTROL_BUFFERS;i++) { - target->HTCControlBuffers[i].Buffer = A_MALLOC(ctrl_bufsz); - if (target->HTCControlBuffers[i].Buffer == NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to allocate memory\n")); - status = A_ERROR; - break; - } - } - - if (A_FAILED(status)) { - break; - } - - /* carve up buffers/packets for control messages */ - for (i = 0; i < NUM_CONTROL_RX_BUFFERS; i++) { - HTC_PACKET *pControlPacket; - pControlPacket = &target->HTCControlBuffers[i].HtcPacket; - SET_HTC_PACKET_INFO_RX_REFILL(pControlPacket, - target, - target->HTCControlBuffers[i].Buffer, - ctrl_bufsz, - ENDPOINT_0); - HTC_FREE_CONTROL_RX(target,pControlPacket); - } - - for (;i < NUM_CONTROL_BUFFERS;i++) { - HTC_PACKET *pControlPacket; - pControlPacket = &target->HTCControlBuffers[i].HtcPacket; - INIT_HTC_PACKET_INFO(pControlPacket, - target->HTCControlBuffers[i].Buffer, - ctrl_bufsz); - HTC_FREE_CONTROL_TX(target,pControlPacket); - } - - } while (FALSE); - - if (A_FAILED(status)) { - if (target != NULL) { - HTCCleanup(target); - target = NULL; - } - } - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HTCCreate - Exit\n")); - - return target; -} - -void HTCDestroy(HTC_HANDLE HTCHandle) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("+HTCDestroy .. Destroying :0x%lX \n",(unsigned long)target)); - HTCCleanup(target); - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-HTCDestroy \n")); -} - -/* get the low level HIF device for the caller , the caller may wish to do low level - * HIF requests */ -void *HTCGetHifDevice(HTC_HANDLE HTCHandle) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - return target->Device.HIFDevice; -} - -/* wait for the target to arrive (sends HTC Ready message) - * this operation is fully synchronous and the message is polled for */ -A_STATUS HTCWaitTarget(HTC_HANDLE HTCHandle) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - A_STATUS status; - HTC_PACKET *pPacket = NULL; - HTC_READY_EX_MSG *pRdyMsg; - HTC_SERVICE_CONNECT_REQ connect; - HTC_SERVICE_CONNECT_RESP resp; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HTCWaitTarget - Enter (target:0x%lX) \n", (unsigned long)target)); - - do { - -#ifdef MBOXHW_UNIT_TEST - - status = DoMboxHWTest(&target->Device); - - if (status != A_OK) { - break; - } - -#endif - - /* we should be getting 1 control message that the target is ready */ - status = HTCWaitforControlMessage(target, &pPacket); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, (" Target Not Available!!\n")); - break; - } - - /* we controlled the buffer creation so it has to be properly aligned */ - pRdyMsg = (HTC_READY_EX_MSG *)pPacket->pBuffer; - - if ((pRdyMsg->Version2_0_Info.MessageID != HTC_MSG_READY_ID) || - (pPacket->ActualLength < sizeof(HTC_READY_MSG))) { - /* this message is not valid */ - AR_DEBUG_ASSERT(FALSE); - status = A_EPROTO; - break; - } - - - if (pRdyMsg->Version2_0_Info.CreditCount == 0 || pRdyMsg->Version2_0_Info.CreditSize == 0) { - /* this message is not valid */ - AR_DEBUG_ASSERT(FALSE); - status = A_EPROTO; - break; - } - - target->TargetCredits = pRdyMsg->Version2_0_Info.CreditCount; - target->TargetCreditSize = pRdyMsg->Version2_0_Info.CreditSize; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, (" Target Ready: credits: %d credit size: %d\n", - target->TargetCredits, target->TargetCreditSize)); - - /* check if this is an extended ready message */ - if (pPacket->ActualLength >= sizeof(HTC_READY_EX_MSG)) { - /* this is an extended message */ - target->HTCTargetVersion = pRdyMsg->HTCVersion; - target->MaxMsgPerBundle = pRdyMsg->MaxMsgsPerHTCBundle; - } else { - /* legacy */ - target->HTCTargetVersion = HTC_VERSION_2P0; - target->MaxMsgPerBundle = 0; - } - -#ifdef HTC_FORCE_LEGACY_2P0 - /* for testing and comparison...*/ - target->HTCTargetVersion = HTC_VERSION_2P0; - target->MaxMsgPerBundle = 0; -#endif - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, - ("Using HTC Protocol Version : %s (%d)\n ", - (target->HTCTargetVersion == HTC_VERSION_2P0) ? "2.0" : ">= 2.1", - target->HTCTargetVersion)); - - if (target->MaxMsgPerBundle > 0) { - /* limit what HTC can handle */ - target->MaxMsgPerBundle = min(HTC_HOST_MAX_MSG_PER_BUNDLE, target->MaxMsgPerBundle); - /* target supports message bundling, setup device layer */ - if (A_FAILED(DevSetupMsgBundling(&target->Device,target->MaxMsgPerBundle))) { - /* device layer can't handle bundling */ - target->MaxMsgPerBundle = 0; - } else { - /* limit bundle what the device layer can handle */ - target->MaxMsgPerBundle = min(DEV_GET_MAX_MSG_PER_BUNDLE(&target->Device), - target->MaxMsgPerBundle); - } - } - - if (target->MaxMsgPerBundle > 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, - (" HTC bundling allowed. Max Msg Per HTC Bundle: %d\n", target->MaxMsgPerBundle)); - target->SendBundlingEnabled = TRUE; - target->RecvBundlingEnabled = TRUE; - if (!DEV_IS_LEN_BLOCK_ALIGNED(&target->Device,target->TargetCreditSize)) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, ("*** Credit size: %d is not block aligned! Disabling send bundling \n", - target->TargetCreditSize)); - /* disallow send bundling since the credit size is not aligned to a block size - * the I/O block padding will spill into the next credit buffer which is fatal */ - target->SendBundlingEnabled = FALSE; - } - } - - status = DevSetupGMbox(&target->Device); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, (" GMbox set up Failed!!\n")); - break; - } - - /* setup our pseudo HTC control endpoint connection */ - A_MEMZERO(&connect,sizeof(connect)); - A_MEMZERO(&resp,sizeof(resp)); - connect.EpCallbacks.pContext = target; - connect.EpCallbacks.EpTxComplete = HTCControlTxComplete; - connect.EpCallbacks.EpRecv = HTCControlRecv; - connect.EpCallbacks.EpRecvRefill = NULL; /* not needed */ - connect.EpCallbacks.EpSendFull = NULL; /* not nedded */ - connect.MaxSendQueueDepth = NUM_CONTROL_BUFFERS; - connect.ServiceID = HTC_CTRL_RSVD_SVC; - - /* connect fake service */ - status = HTCConnectService((HTC_HANDLE)target, - &connect, - &resp); - - if (!A_FAILED(status)) { - break; - } - - } while (FALSE); - - if (pPacket != NULL) { - HTC_FREE_CONTROL_RX(target,pPacket); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HTCWaitTarget - Exit\n")); - - return status; -} - - - -/* Start HTC, enable interrupts and let the target know host has finished setup */ -A_STATUS HTCStart(HTC_HANDLE HTCHandle) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - HTC_PACKET *pPacket; - A_STATUS status; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HTCStart Enter\n")); - - /* make sure interrupts are disabled at the chip level, - * this function can be called again from a reboot of the target without shutting down HTC */ - DevDisableInterrupts(&target->Device); - /* make sure state is cleared again */ - target->OpStateFlags = 0; - target->RecvStateFlags = 0; - - /* now that we are starting, push control receive buffers into the - * HTC control endpoint */ - - while (1) { - pPacket = HTC_ALLOC_CONTROL_RX(target); - if (NULL == pPacket) { - break; - } - HTCAddReceivePkt((HTC_HANDLE)target,pPacket); - } - - do { - - AR_DEBUG_ASSERT(target->InitCredits != NULL); - AR_DEBUG_ASSERT(target->EpCreditDistributionListHead != NULL); - AR_DEBUG_ASSERT(target->EpCreditDistributionListHead->pNext != NULL); - - /* call init credits callback to do the distribution , - * NOTE: the first entry in the distribution list is ENDPOINT_0, so - * we pass the start of the list after this one. */ - target->InitCredits(target->pCredDistContext, - target->EpCreditDistributionListHead->pNext, - target->TargetCredits); - - if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_TRC)) { - DumpCreditDistStates(target); - } - - /* the caller is done connecting to services, so we can indicate to the - * target that the setup phase is complete */ - status = HTCSendSetupComplete(target); - - if (A_FAILED(status)) { - break; - } - - /* unmask interrupts */ - status = DevUnmaskInterrupts(&target->Device); - - if (A_FAILED(status)) { - HTCStop(target); - } - - } while (FALSE); - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HTCStart Exit\n")); - return status; -} - -static void ResetEndpointStates(HTC_TARGET *target) -{ - HTC_ENDPOINT *pEndpoint; - int i; - - for (i = ENDPOINT_0; i < ENDPOINT_MAX; i++) { - pEndpoint = &target->EndPoint[i]; - - A_MEMZERO(&pEndpoint->CreditDist, sizeof(pEndpoint->CreditDist)); - pEndpoint->ServiceID = 0; - pEndpoint->MaxMsgLength = 0; - pEndpoint->MaxTxQueueDepth = 0; -#ifdef HTC_EP_STAT_PROFILING - A_MEMZERO(&pEndpoint->EndPointStats,sizeof(pEndpoint->EndPointStats)); -#endif - INIT_HTC_PACKET_QUEUE(&pEndpoint->RxBuffers); - INIT_HTC_PACKET_QUEUE(&pEndpoint->TxQueue); - INIT_HTC_PACKET_QUEUE(&pEndpoint->RecvIndicationQueue); - pEndpoint->target = target; - } - /* reset distribution list */ - target->EpCreditDistributionListHead = NULL; -} - -/* stop HTC communications, i.e. stop interrupt reception, and flush all queued buffers */ -void HTCStop(HTC_HANDLE HTCHandle) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("+HTCStop \n")); - - LOCK_HTC(target); - - /* mark that we are shutting down .. */ - target->OpStateFlags |= HTC_OP_STATE_STOPPING; - UNLOCK_HTC(target); - - /* Masking interrupts is a synchronous operation, when this function returns - * all pending HIF I/O has completed, we can safely flush the queues */ - DevMaskInterrupts (&target->Device); - - - /* flush all send packets */ - HTCFlushSendPkts(target); - /* flush all recv buffers */ - HTCFlushRecvBuffers(target); - - DevCleanupMsgBundling(&target->Device); - - DevCleanupGMbox(&target->Device); - - ResetEndpointStates(target); - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-HTCStop \n")); -} - -void HTCDumpCreditStates(HTC_HANDLE HTCHandle) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - - LOCK_HTC_TX(target); - - DumpCreditDistStates(target); - - UNLOCK_HTC_TX(target); - - DumpAR6KDevState(&target->Device); -} - -/* report a target failure from the device, this is a callback from the device layer - * which uses a mechanism to report errors from the target (i.e. special interrupts) */ -static void HTCReportFailure(void *Context) -{ - HTC_TARGET *target = (HTC_TARGET *)Context; - - target->TargetFailure = TRUE; - - if (target->HTCInitInfo.TargetFailure != NULL) { - /* let upper layer know, it needs to call HTCStop() */ - target->HTCInitInfo.TargetFailure(target->HTCInitInfo.pContext, A_ERROR); - } -} - -A_BOOL HTCGetEndpointStatistics(HTC_HANDLE HTCHandle, - HTC_ENDPOINT_ID Endpoint, - HTC_ENDPOINT_STAT_ACTION Action, - HTC_ENDPOINT_STATS *pStats) -{ - -#ifdef HTC_EP_STAT_PROFILING - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - A_BOOL clearStats = FALSE; - A_BOOL sample = FALSE; - - switch (Action) { - case HTC_EP_STAT_SAMPLE : - sample = TRUE; - break; - case HTC_EP_STAT_SAMPLE_AND_CLEAR : - sample = TRUE; - clearStats = TRUE; - break; - case HTC_EP_STAT_CLEAR : - clearStats = TRUE; - break; - default: - break; - } - - A_ASSERT(Endpoint < ENDPOINT_MAX); - if (!(Endpoint < ENDPOINT_MAX)) { - return FALSE; /* in case panic_on_assert==0 */ - } - /* lock out TX and RX while we sample and/or clear */ - LOCK_HTC_TX(target); - LOCK_HTC_RX(target); - - if (sample) { - A_ASSERT(pStats != NULL); - /* return the stats to the caller */ - A_MEMCPY(pStats, &target->EndPoint[Endpoint].EndPointStats, sizeof(HTC_ENDPOINT_STATS)); - } - - if (clearStats) { - /* reset stats */ - A_MEMZERO(&target->EndPoint[Endpoint].EndPointStats, sizeof(HTC_ENDPOINT_STATS)); - } - - UNLOCK_HTC_RX(target); - UNLOCK_HTC_TX(target); - - return TRUE; -#else - return FALSE; -#endif -} - -AR6K_DEVICE *HTCGetAR6KDevice(void *HTCHandle) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - return &target->Device; -} - diff --git a/drivers/net/wireless/ar6003/host/htc2/htc_debug.h b/drivers/net/wireless/ar6003/host/htc2/htc_debug.h deleted file mode 100644 index 8455703e221c..000000000000 --- a/drivers/net/wireless/ar6003/host/htc2/htc_debug.h +++ /dev/null @@ -1,38 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#ifndef HTC_DEBUG_H_ -#define HTC_DEBUG_H_ - -#define ATH_MODULE_NAME htc -#include "a_debug.h" - -/* ------- Debug related stuff ------- */ - -#define ATH_DEBUG_SEND ATH_DEBUG_MAKE_MODULE_MASK(0) -#define ATH_DEBUG_RECV ATH_DEBUG_MAKE_MODULE_MASK(1) -#define ATH_DEBUG_SYNC ATH_DEBUG_MAKE_MODULE_MASK(2) -#define ATH_DEBUG_DUMP ATH_DEBUG_MAKE_MODULE_MASK(3) -#define ATH_DEBUG_IRQ ATH_DEBUG_MAKE_MODULE_MASK(4) - - -#endif /*HTC_DEBUG_H_*/ diff --git a/drivers/net/wireless/ar6003/host/htc2/htc_internal.h b/drivers/net/wireless/ar6003/host/htc2/htc_internal.h deleted file mode 100644 index ca0ba3825fa6..000000000000 --- a/drivers/net/wireless/ar6003/host/htc2/htc_internal.h +++ /dev/null @@ -1,217 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#ifndef _HTC_INTERNAL_H_ -#define _HTC_INTERNAL_H_ - -/* for debugging, uncomment this to capture the last frame header, on frame header - * processing errors, the last frame header is dump for comparison */ -//#define HTC_CAPTURE_LAST_FRAME - -//#define HTC_EP_STAT_PROFILING - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* Header files */ - -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" -#include "a_osapi.h" -#include "htc_debug.h" -#include "htc.h" -#include "htc_api.h" -#include "bmi_msg.h" -#include "hif.h" -#include "AR6000/ar6k.h" - -/* HTC operational parameters */ -#define HTC_TARGET_RESPONSE_TIMEOUT 2000 /* in ms */ -#define HTC_TARGET_DEBUG_INTR_MASK 0x01 -#define HTC_TARGET_CREDIT_INTR_MASK 0xF0 - -#define HTC_HOST_MAX_MSG_PER_BUNDLE 8 -#define HTC_MIN_HTC_MSGS_TO_BUNDLE 2 - -/* packet flags */ - -#define HTC_RX_PKT_IGNORE_LOOKAHEAD (1 << 0) -#define HTC_RX_PKT_REFRESH_HDR (1 << 1) -#define HTC_RX_PKT_PART_OF_BUNDLE (1 << 2) -#define HTC_RX_PKT_NO_RECYCLE (1 << 3) - -/* scatter request flags */ - -#define HTC_SCATTER_REQ_FLAGS_PARTIAL_BUNDLE (1 << 0) - -typedef struct _HTC_ENDPOINT { - HTC_ENDPOINT_ID Id; - HTC_SERVICE_ID ServiceID; /* service ID this endpoint is bound to - non-zero value means this endpoint is in use */ - HTC_PACKET_QUEUE TxQueue; /* HTC frame buffer TX queue */ - HTC_PACKET_QUEUE RxBuffers; /* HTC frame buffer RX list */ - HTC_ENDPOINT_CREDIT_DIST CreditDist; /* credit distribution structure (exposed to driver layer) */ - HTC_EP_CALLBACKS EpCallBacks; /* callbacks associated with this endpoint */ - int MaxTxQueueDepth; /* max depth of the TX queue before we need to - call driver's full handler */ - int MaxMsgLength; /* max length of endpoint message */ - int TxProcessCount; /* reference count to continue tx processing */ - HTC_PACKET_QUEUE RecvIndicationQueue; /* recv packets ready to be indicated */ - int RxProcessCount; /* reference count to allow single processing context */ - struct _HTC_TARGET *target; /* back pointer to target */ - A_UINT8 SeqNo; /* TX seq no (helpful) for debugging */ - A_UINT32 LocalConnectionFlags; /* local connection flags */ -#ifdef HTC_EP_STAT_PROFILING - HTC_ENDPOINT_STATS EndPointStats; /* endpoint statistics */ -#endif -} HTC_ENDPOINT; - -#ifdef HTC_EP_STAT_PROFILING -#define INC_HTC_EP_STAT(p,stat,count) (p)->EndPointStats.stat += (count); -#else -#define INC_HTC_EP_STAT(p,stat,count) -#endif - -#define HTC_SERVICE_TX_PACKET_TAG HTC_TX_PACKET_TAG_INTERNAL - -#define NUM_CONTROL_BUFFERS 8 -#define NUM_CONTROL_TX_BUFFERS 2 -#define NUM_CONTROL_RX_BUFFERS (NUM_CONTROL_BUFFERS - NUM_CONTROL_TX_BUFFERS) - -typedef struct HTC_CONTROL_BUFFER { - HTC_PACKET HtcPacket; - A_UINT8 *Buffer; -} HTC_CONTROL_BUFFER; - -#define HTC_RECV_WAIT_BUFFERS (1 << 0) -#define HTC_OP_STATE_STOPPING (1 << 0) - -/* our HTC target state */ -typedef struct _HTC_TARGET { - HTC_ENDPOINT EndPoint[ENDPOINT_MAX]; - HTC_CONTROL_BUFFER HTCControlBuffers[NUM_CONTROL_BUFFERS]; - HTC_ENDPOINT_CREDIT_DIST *EpCreditDistributionListHead; - HTC_PACKET_QUEUE ControlBufferTXFreeList; - HTC_PACKET_QUEUE ControlBufferRXFreeList; - HTC_CREDIT_DIST_CALLBACK DistributeCredits; - HTC_CREDIT_INIT_CALLBACK InitCredits; - void *pCredDistContext; - int TargetCredits; - unsigned int TargetCreditSize; - A_MUTEX_T HTCLock; - A_MUTEX_T HTCRxLock; - A_MUTEX_T HTCTxLock; - AR6K_DEVICE Device; /* AR6K - specific state */ - A_UINT32 OpStateFlags; - A_UINT32 RecvStateFlags; - HTC_ENDPOINT_ID EpWaitingForBuffers; - A_BOOL TargetFailure; -#ifdef HTC_CAPTURE_LAST_FRAME - HTC_FRAME_HDR LastFrameHdr; /* useful for debugging */ - A_UINT8 LastTrailer[256]; - A_UINT8 LastTrailerLength; -#endif - HTC_INIT_INFO HTCInitInfo; - A_UINT8 HTCTargetVersion; - int MaxMsgPerBundle; /* max messages per bundle for HTC */ - A_BOOL SendBundlingEnabled; /* run time enable for send bundling (dynamic) */ - int RecvBundlingEnabled; /* run time enable for recv bundling (dynamic) */ -} HTC_TARGET; - -#define HTC_STOPPING(t) ((t)->OpStateFlags & HTC_OP_STATE_STOPPING) -#define LOCK_HTC(t) A_MUTEX_LOCK(&(t)->HTCLock); -#define UNLOCK_HTC(t) A_MUTEX_UNLOCK(&(t)->HTCLock); -#define LOCK_HTC_RX(t) A_MUTEX_LOCK(&(t)->HTCRxLock); -#define UNLOCK_HTC_RX(t) A_MUTEX_UNLOCK(&(t)->HTCRxLock); -#define LOCK_HTC_TX(t) A_MUTEX_LOCK(&(t)->HTCTxLock); -#define UNLOCK_HTC_TX(t) A_MUTEX_UNLOCK(&(t)->HTCTxLock); - -#define GET_HTC_TARGET_FROM_HANDLE(hnd) ((HTC_TARGET *)(hnd)) -#define HTC_RECYCLE_RX_PKT(target,p,e) \ -{ \ - if ((p)->PktInfo.AsRx.HTCRxFlags & HTC_RX_PKT_NO_RECYCLE) { \ - HTC_PACKET_RESET_RX(pPacket); \ - pPacket->Status = A_ECANCELED; \ - (e)->EpCallBacks.EpRecv((e)->EpCallBacks.pContext, \ - (p)); \ - } else { \ - HTC_PACKET_RESET_RX(pPacket); \ - HTCAddReceivePkt((HTC_HANDLE)(target),(p)); \ - } \ -} - -/* internal HTC functions */ -void HTCControlTxComplete(void *Context, HTC_PACKET *pPacket); -void HTCControlRecv(void *Context, HTC_PACKET *pPacket); -A_STATUS HTCWaitforControlMessage(HTC_TARGET *target, HTC_PACKET **ppControlPacket); -HTC_PACKET *HTCAllocControlBuffer(HTC_TARGET *target, HTC_PACKET_QUEUE *pList); -void HTCFreeControlBuffer(HTC_TARGET *target, HTC_PACKET *pPacket, HTC_PACKET_QUEUE *pList); -A_STATUS HTCIssueSend(HTC_TARGET *target, HTC_PACKET *pPacket); -void HTCRecvCompleteHandler(void *Context, HTC_PACKET *pPacket); -A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], int NumLookAheads, A_BOOL *pAsyncProc, int *pNumPktsFetched); -void HTCProcessCreditRpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt, int NumEntries, HTC_ENDPOINT_ID FromEndpoint); -A_STATUS HTCSendSetupComplete(HTC_TARGET *target); -void HTCFlushRecvBuffers(HTC_TARGET *target); -void HTCFlushSendPkts(HTC_TARGET *target); -void DumpCreditDist(HTC_ENDPOINT_CREDIT_DIST *pEPDist); -void DumpCreditDistStates(HTC_TARGET *target); -void DebugDumpBytes(A_UCHAR *buffer, A_UINT16 length, char *pDescription); - -static INLINE HTC_PACKET *HTC_ALLOC_CONTROL_TX(HTC_TARGET *target) { - HTC_PACKET *pPacket = HTCAllocControlBuffer(target,&target->ControlBufferTXFreeList); - if (pPacket != NULL) { - /* set payload pointer area with some headroom */ - pPacket->pBuffer = pPacket->pBufferStart + HTC_HDR_LENGTH; - } - return pPacket; -} - -#define HTC_FREE_CONTROL_TX(t,p) HTCFreeControlBuffer((t),(p),&(t)->ControlBufferTXFreeList) -#define HTC_ALLOC_CONTROL_RX(t) HTCAllocControlBuffer((t),&(t)->ControlBufferRXFreeList) -#define HTC_FREE_CONTROL_RX(t,p) \ -{ \ - HTC_PACKET_RESET_RX(p); \ - HTCFreeControlBuffer((t),(p),&(t)->ControlBufferRXFreeList); \ -} - -#define HTC_PREPARE_SEND_PKT(pP,sendflags,ctrl0,ctrl1) \ -{ \ - A_UINT8 *pHdrBuf; \ - (pP)->pBuffer -= HTC_HDR_LENGTH; \ - pHdrBuf = (pP)->pBuffer; \ - A_SET_UINT16_FIELD(pHdrBuf,HTC_FRAME_HDR,PayloadLen,(A_UINT16)(pP)->ActualLength); \ - A_SET_UINT8_FIELD(pHdrBuf,HTC_FRAME_HDR,Flags,(sendflags)); \ - A_SET_UINT8_FIELD(pHdrBuf,HTC_FRAME_HDR,EndpointID, (A_UINT8)(pP)->Endpoint); \ - A_SET_UINT8_FIELD(pHdrBuf,HTC_FRAME_HDR,ControlBytes[0], (A_UINT8)(ctrl0)); \ - A_SET_UINT8_FIELD(pHdrBuf,HTC_FRAME_HDR,ControlBytes[1], (A_UINT8)(ctrl1)); \ -} - -#define HTC_UNPREPARE_SEND_PKT(pP) \ - (pP)->pBuffer += HTC_HDR_LENGTH; \ - -#ifdef __cplusplus -} -#endif - -#endif /* _HTC_INTERNAL_H_ */ diff --git a/drivers/net/wireless/ar6003/host/htc2/htc_recv.c b/drivers/net/wireless/ar6003/host/htc2/htc_recv.c deleted file mode 100644 index d483f701713e..000000000000 --- a/drivers/net/wireless/ar6003/host/htc2/htc_recv.c +++ /dev/null @@ -1,1572 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#include "htc_internal.h" - -#define HTCIssueRecv(t, p) \ - DevRecvPacket(&(t)->Device, \ - (p), \ - (p)->ActualLength) - -#define DO_RCV_COMPLETION(e,q) DoRecvCompletion(e,q) - -#define DUMP_RECV_PKT_INFO(pP) \ - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, (" HTC RECV packet 0x%lX (%d bytes) (hdr:0x%X) on ep : %d \n", \ - (unsigned long)(pP), \ - (pP)->ActualLength, \ - (pP)->PktInfo.AsRx.ExpectedHdr, \ - (pP)->Endpoint)) - -#ifdef HTC_EP_STAT_PROFILING -#define HTC_RX_STAT_PROFILE(t,ep,numLookAheads) \ -{ \ - INC_HTC_EP_STAT((ep), RxReceived, 1); \ - if ((numLookAheads) == 1) { \ - INC_HTC_EP_STAT((ep), RxLookAheads, 1); \ - } else if ((numLookAheads) > 1) { \ - INC_HTC_EP_STAT((ep), RxBundleLookAheads, 1); \ - } \ -} -#else -#define HTC_RX_STAT_PROFILE(t,ep,lookAhead) -#endif - -static void DoRecvCompletion(HTC_ENDPOINT *pEndpoint, - HTC_PACKET_QUEUE *pQueueToIndicate) -{ - - do { - - if (HTC_QUEUE_EMPTY(pQueueToIndicate)) { - /* nothing to indicate */ - break; - } - - if (pEndpoint->EpCallBacks.EpRecvPktMultiple != NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, (" HTC calling ep %d, recv multiple callback (%d pkts) \n", - pEndpoint->Id, HTC_PACKET_QUEUE_DEPTH(pQueueToIndicate))); - /* a recv multiple handler is being used, pass the queue to the handler */ - pEndpoint->EpCallBacks.EpRecvPktMultiple(pEndpoint->EpCallBacks.pContext, - pQueueToIndicate); - INIT_HTC_PACKET_QUEUE(pQueueToIndicate); - } else { - HTC_PACKET *pPacket; - /* using legacy EpRecv */ - do { - pPacket = HTC_PACKET_DEQUEUE(pQueueToIndicate); - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, (" HTC calling ep %d recv callback on packet 0x%lX \n", \ - pEndpoint->Id, (unsigned long)(pPacket))); - pEndpoint->EpCallBacks.EpRecv(pEndpoint->EpCallBacks.pContext, pPacket); - } while (!HTC_QUEUE_EMPTY(pQueueToIndicate)); - } - - } while (FALSE); - -} - -static INLINE A_STATUS HTCProcessTrailer(HTC_TARGET *target, - A_UINT8 *pBuffer, - int Length, - A_UINT32 *pNextLookAheads, - int *pNumLookAheads, - HTC_ENDPOINT_ID FromEndpoint) -{ - HTC_RECORD_HDR *pRecord; - A_UINT8 *pRecordBuf; - HTC_LOOKAHEAD_REPORT *pLookAhead; - A_UINT8 *pOrigBuffer; - int origLength; - A_STATUS status; - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("+HTCProcessTrailer (length:%d) \n", Length)); - - if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_RECV)) { - AR_DEBUG_PRINTBUF(pBuffer,Length,"Recv Trailer"); - } - - pOrigBuffer = pBuffer; - origLength = Length; - status = A_OK; - - while (Length > 0) { - - if (Length < sizeof(HTC_RECORD_HDR)) { - status = A_EPROTO; - break; - } - /* these are byte aligned structs */ - pRecord = (HTC_RECORD_HDR *)pBuffer; - Length -= sizeof(HTC_RECORD_HDR); - pBuffer += sizeof(HTC_RECORD_HDR); - - if (pRecord->Length > Length) { - /* no room left in buffer for record */ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - (" invalid record length: %d (id:%d) buffer has: %d bytes left \n", - pRecord->Length, pRecord->RecordID, Length)); - status = A_EPROTO; - break; - } - /* start of record follows the header */ - pRecordBuf = pBuffer; - - switch (pRecord->RecordID) { - case HTC_RECORD_CREDITS: - AR_DEBUG_ASSERT(pRecord->Length >= sizeof(HTC_CREDIT_REPORT)); - HTCProcessCreditRpt(target, - (HTC_CREDIT_REPORT *)pRecordBuf, - pRecord->Length / (sizeof(HTC_CREDIT_REPORT)), - FromEndpoint); - break; - case HTC_RECORD_LOOKAHEAD: - AR_DEBUG_ASSERT(pRecord->Length >= sizeof(HTC_LOOKAHEAD_REPORT)); - pLookAhead = (HTC_LOOKAHEAD_REPORT *)pRecordBuf; - if ((pLookAhead->PreValid == ((~pLookAhead->PostValid) & 0xFF)) && - (pNextLookAheads != NULL)) { - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - (" LookAhead Report Found (pre valid:0x%X, post valid:0x%X) \n", - pLookAhead->PreValid, - pLookAhead->PostValid)); - - /* look ahead bytes are valid, copy them over */ - ((A_UINT8 *)(&pNextLookAheads[0]))[0] = pLookAhead->LookAhead[0]; - ((A_UINT8 *)(&pNextLookAheads[0]))[1] = pLookAhead->LookAhead[1]; - ((A_UINT8 *)(&pNextLookAheads[0]))[2] = pLookAhead->LookAhead[2]; - ((A_UINT8 *)(&pNextLookAheads[0]))[3] = pLookAhead->LookAhead[3]; - - if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_RECV)) { - DebugDumpBytes((A_UINT8 *)pNextLookAheads,4,"Next Look Ahead"); - } - /* just one normal lookahead */ - if (pNumLookAheads != NULL) { - *pNumLookAheads = 1; - } - } - break; - case HTC_RECORD_LOOKAHEAD_BUNDLE: - AR_DEBUG_ASSERT(pRecord->Length >= sizeof(HTC_BUNDLED_LOOKAHEAD_REPORT)); - if (pRecord->Length >= sizeof(HTC_BUNDLED_LOOKAHEAD_REPORT) && - (pNextLookAheads != NULL)) { - HTC_BUNDLED_LOOKAHEAD_REPORT *pBundledLookAheadRpt; - int i; - - pBundledLookAheadRpt = (HTC_BUNDLED_LOOKAHEAD_REPORT *)pRecordBuf; - - if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_RECV)) { - DebugDumpBytes(pRecordBuf,pRecord->Length,"Bundle LookAhead"); - } - - if ((pRecord->Length / (sizeof(HTC_BUNDLED_LOOKAHEAD_REPORT))) > - HTC_HOST_MAX_MSG_PER_BUNDLE) { - /* this should never happen, the target restricts the number - * of messages per bundle configured by the host */ - A_ASSERT(FALSE); - status = A_EPROTO; - break; - } - - for (i = 0; i < (int)(pRecord->Length / (sizeof(HTC_BUNDLED_LOOKAHEAD_REPORT))); i++) { - ((A_UINT8 *)(&pNextLookAheads[i]))[0] = pBundledLookAheadRpt->LookAhead[0]; - ((A_UINT8 *)(&pNextLookAheads[i]))[1] = pBundledLookAheadRpt->LookAhead[1]; - ((A_UINT8 *)(&pNextLookAheads[i]))[2] = pBundledLookAheadRpt->LookAhead[2]; - ((A_UINT8 *)(&pNextLookAheads[i]))[3] = pBundledLookAheadRpt->LookAhead[3]; - pBundledLookAheadRpt++; - } - - *pNumLookAheads = i; - } - break; - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, (" unhandled record: id:%d length:%d \n", - pRecord->RecordID, pRecord->Length)); - break; - } - - if (A_FAILED(status)) { - break; - } - - /* advance buffer past this record for next time around */ - pBuffer += pRecord->Length; - Length -= pRecord->Length; - } - - if (A_FAILED(status)) { - DebugDumpBytes(pOrigBuffer,origLength,"BAD Recv Trailer"); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("-HTCProcessTrailer \n")); - return status; - -} - -/* process a received message (i.e. strip off header, process any trailer data) - * note : locks must be released when this function is called */ -static A_STATUS HTCProcessRecvHeader(HTC_TARGET *target, - HTC_PACKET *pPacket, - A_UINT32 *pNextLookAheads, - int *pNumLookAheads) -{ - A_UINT8 temp; - A_UINT8 *pBuf; - A_STATUS status = A_OK; - A_UINT16 payloadLen; - A_UINT32 lookAhead; - - pBuf = pPacket->pBuffer; - - if (pNumLookAheads != NULL) { - *pNumLookAheads = 0; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("+HTCProcessRecvHeader \n")); - - if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_RECV)) { - AR_DEBUG_PRINTBUF(pBuf,pPacket->ActualLength,"HTC Recv PKT"); - } - - do { - /* note, we cannot assume the alignment of pBuffer, so we use the safe macros to - * retrieve 16 bit fields */ - payloadLen = A_GET_UINT16_FIELD(pBuf, HTC_FRAME_HDR, PayloadLen); - - ((A_UINT8 *)&lookAhead)[0] = pBuf[0]; - ((A_UINT8 *)&lookAhead)[1] = pBuf[1]; - ((A_UINT8 *)&lookAhead)[2] = pBuf[2]; - ((A_UINT8 *)&lookAhead)[3] = pBuf[3]; - - if (pPacket->PktInfo.AsRx.HTCRxFlags & HTC_RX_PKT_REFRESH_HDR) { - /* refresh expected hdr, since this was unknown at the time we grabbed the packets - * as part of a bundle */ - pPacket->PktInfo.AsRx.ExpectedHdr = lookAhead; - /* refresh actual length since we now have the real header */ - pPacket->ActualLength = payloadLen + HTC_HDR_LENGTH; - - /* validate the actual header that was refreshed */ - if (pPacket->ActualLength > pPacket->BufferLength) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("Refreshed HDR payload length (%d) in bundled RECV is invalid (hdr: 0x%X) \n", - payloadLen, lookAhead)); - /* limit this to max buffer just to print out some of the buffer */ - pPacket->ActualLength = min(pPacket->ActualLength, pPacket->BufferLength); - status = A_EPROTO; - break; - } - - if (pPacket->Endpoint != A_GET_UINT8_FIELD(pBuf, HTC_FRAME_HDR, EndpointID)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("Refreshed HDR endpoint (%d) does not match expected endpoint (%d) \n", - A_GET_UINT8_FIELD(pBuf, HTC_FRAME_HDR, EndpointID), pPacket->Endpoint)); - status = A_EPROTO; - break; - } - } - - if (lookAhead != pPacket->PktInfo.AsRx.ExpectedHdr) { - /* somehow the lookahead that gave us the full read length did not - * reflect the actual header in the pending message */ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("HTCProcessRecvHeader, lookahead mismatch! (pPkt:0x%lX flags:0x%X) \n", - (unsigned long)pPacket, pPacket->PktInfo.AsRx.HTCRxFlags)); -#ifdef ATH_DEBUG_MODULE - DebugDumpBytes((A_UINT8 *)&pPacket->PktInfo.AsRx.ExpectedHdr,4,"Expected Message LookAhead"); - DebugDumpBytes(pBuf,sizeof(HTC_FRAME_HDR),"Current Frame Header"); -#ifdef HTC_CAPTURE_LAST_FRAME - DebugDumpBytes((A_UINT8 *)&target->LastFrameHdr,sizeof(HTC_FRAME_HDR),"Last Frame Header"); - if (target->LastTrailerLength != 0) { - DebugDumpBytes(target->LastTrailer, - target->LastTrailerLength, - "Last trailer"); - } -#endif -#endif - status = A_EPROTO; - break; - } - - /* get flags */ - temp = A_GET_UINT8_FIELD(pBuf, HTC_FRAME_HDR, Flags); - - if (temp & HTC_FLAGS_RECV_TRAILER) { - /* this packet has a trailer */ - - /* extract the trailer length in control byte 0 */ - temp = A_GET_UINT8_FIELD(pBuf, HTC_FRAME_HDR, ControlBytes[0]); - - if ((temp < sizeof(HTC_RECORD_HDR)) || (temp > payloadLen)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("HTCProcessRecvHeader, invalid header (payloadlength should be :%d, CB[0] is:%d) \n", - payloadLen, temp)); - status = A_EPROTO; - break; - } - - if (pPacket->PktInfo.AsRx.HTCRxFlags & HTC_RX_PKT_IGNORE_LOOKAHEAD) { - /* this packet was fetched as part of an HTC bundle, the embedded lookahead is - * not valid since the next packet may have already been fetched as part of the - * bundle */ - pNextLookAheads = NULL; - pNumLookAheads = NULL; - } - - /* process trailer data that follows HDR + application payload */ - status = HTCProcessTrailer(target, - (pBuf + HTC_HDR_LENGTH + payloadLen - temp), - temp, - pNextLookAheads, - pNumLookAheads, - pPacket->Endpoint); - - if (A_FAILED(status)) { - break; - } - -#ifdef HTC_CAPTURE_LAST_FRAME - A_MEMCPY(target->LastTrailer, (pBuf + HTC_HDR_LENGTH + payloadLen - temp), temp); - target->LastTrailerLength = temp; -#endif - /* trim length by trailer bytes */ - pPacket->ActualLength -= temp; - } -#ifdef HTC_CAPTURE_LAST_FRAME - else { - target->LastTrailerLength = 0; - } -#endif - - /* if we get to this point, the packet is good */ - /* remove header and adjust length */ - pPacket->pBuffer += HTC_HDR_LENGTH; - pPacket->ActualLength -= HTC_HDR_LENGTH; - - } while (FALSE); - - if (A_FAILED(status)) { - /* dump the whole packet */ - DebugDumpBytes(pBuf,pPacket->ActualLength < 256 ? pPacket->ActualLength : 256 ,"BAD HTC Recv PKT"); - } else { -#ifdef HTC_CAPTURE_LAST_FRAME - A_MEMCPY(&target->LastFrameHdr,pBuf,sizeof(HTC_FRAME_HDR)); -#endif - if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_RECV)) { - if (pPacket->ActualLength > 0) { - AR_DEBUG_PRINTBUF(pPacket->pBuffer,pPacket->ActualLength,"HTC - Application Msg"); - } - } - } - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("-HTCProcessRecvHeader \n")); - return status; -} - -static INLINE void HTCAsyncRecvCheckMorePackets(HTC_TARGET *target, - A_UINT32 NextLookAheads[], - int NumLookAheads, - A_BOOL CheckMoreMsgs) -{ - /* was there a lookahead for the next packet? */ - if (NumLookAheads > 0) { - A_STATUS nextStatus; - int fetched = 0; - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - ("HTCAsyncRecvCheckMorePackets - num lookaheads were non-zero : %d \n", - NumLookAheads)); - /* force status re-check */ - REF_IRQ_STATUS_RECHECK(&target->Device); - /* we have more packets, get the next packet fetch started */ - nextStatus = HTCRecvMessagePendingHandler(target, NextLookAheads, NumLookAheads, NULL, &fetched); - if (A_EPROTO == nextStatus) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("Next look ahead from recv header was INVALID\n")); - DebugDumpBytes((A_UINT8 *)NextLookAheads, - NumLookAheads * (sizeof(A_UINT32)), - "BAD lookaheads from lookahead report"); - } - if (A_SUCCESS(nextStatus) && !fetched) { - /* we could not fetch any more packets due to resources */ - DevAsyncIrqProcessComplete(&target->Device); - } - } else { - if (CheckMoreMsgs) { - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - ("HTCAsyncRecvCheckMorePackets - rechecking for more messages...\n")); - /* if we did not get anything on the look-ahead, - * call device layer to asynchronously re-check for messages. If we can keep the async - * processing going we get better performance. If there is a pending message we will keep processing - * messages asynchronously which should pipeline things nicely */ - DevCheckPendingRecvMsgsAsync(&target->Device); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("HTCAsyncRecvCheckMorePackets - no check \n")); - } - } - - -} - - /* unload the recv completion queue */ -static INLINE void DrainRecvIndicationQueue(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint) -{ - HTC_PACKET_QUEUE recvCompletions = { {0} }; - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("+DrainRecvIndicationQueue \n")); - - INIT_HTC_PACKET_QUEUE(&recvCompletions); - - LOCK_HTC_RX(target); - - /* increment rx processing count on entry */ - pEndpoint->RxProcessCount++; - if (pEndpoint->RxProcessCount > 1) { - pEndpoint->RxProcessCount--; - /* another thread or task is draining the RX completion queue on this endpoint - * that thread will reset the rx processing count when the queue is drained */ - UNLOCK_HTC_RX(target); - return; - } - - /******* at this point only 1 thread may enter ******/ - - while (TRUE) { - - /* transfer items from main recv queue to the local one so we can release the lock */ - HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&recvCompletions, &pEndpoint->RecvIndicationQueue); - - if (HTC_QUEUE_EMPTY(&recvCompletions)) { - /* all drained */ - break; - } - - /* release lock while we do the recv completions - * other threads can now queue more recv completions */ - UNLOCK_HTC_RX(target); - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - ("DrainRecvIndicationQueue : completing %d RECV packets \n", - HTC_PACKET_QUEUE_DEPTH(&recvCompletions))); - /* do completion */ - DO_RCV_COMPLETION(pEndpoint,&recvCompletions); - - /* re-acquire lock to grab some more completions */ - LOCK_HTC_RX(target); - } - - /* reset count */ - pEndpoint->RxProcessCount = 0; - UNLOCK_HTC_RX(target); - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("-DrainRecvIndicationQueue \n")); - -} - - /* optimization for recv packets, we can indicate a "hint" that there are more - * single-packets to fetch on this endpoint */ -#define SET_MORE_RX_PACKET_INDICATION_FLAG(L,N,E,P) \ - if ((N) > 0) { SetRxPacketIndicationFlags((L)[0],(E),(P)); } - - /* for bundled frames, we can force the flag to indicate there are more packets */ -#define FORCE_MORE_RX_PACKET_INDICATION_FLAG(P) \ - (P)->PktInfo.AsRx.IndicationFlags |= HTC_RX_FLAGS_INDICATE_MORE_PKTS; - - /* note: this function can be called with the RX lock held */ -static INLINE void SetRxPacketIndicationFlags(A_UINT32 LookAhead, - HTC_ENDPOINT *pEndpoint, - HTC_PACKET *pPacket) -{ - HTC_FRAME_HDR *pHdr = (HTC_FRAME_HDR *)&LookAhead; - /* check to see if the "next" packet is from the same endpoint of the - completing packet */ - if (pHdr->EndpointID == pPacket->Endpoint) { - /* check that there is a buffer available to actually fetch it */ - if (!HTC_QUEUE_EMPTY(&pEndpoint->RxBuffers)) { - /* provide a hint that there are more RX packets to fetch */ - FORCE_MORE_RX_PACKET_INDICATION_FLAG(pPacket); - } - } -} - - -/* asynchronous completion handler for recv packet fetching, when the device layer - * completes a read request, it will call this completion handler */ -void HTCRecvCompleteHandler(void *Context, HTC_PACKET *pPacket) -{ - HTC_TARGET *target = (HTC_TARGET *)Context; - HTC_ENDPOINT *pEndpoint; - A_UINT32 nextLookAheads[HTC_HOST_MAX_MSG_PER_BUNDLE]; - int numLookAheads = 0; - A_STATUS status; - A_BOOL checkMorePkts = TRUE; - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("+HTCRecvCompleteHandler (pkt:0x%lX, status:%d, ep:%d) \n", - (unsigned long)pPacket, pPacket->Status, pPacket->Endpoint)); - - A_ASSERT(!IS_DEV_IRQ_PROC_SYNC_MODE(&target->Device)); - AR_DEBUG_ASSERT(pPacket->Endpoint < ENDPOINT_MAX); - pEndpoint = &target->EndPoint[pPacket->Endpoint]; - pPacket->Completion = NULL; - - /* get completion status */ - status = pPacket->Status; - - do { - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HTCRecvCompleteHandler: request failed (status:%d, ep:%d) \n", - pPacket->Status, pPacket->Endpoint)); - break; - } - /* process the header for any trailer data */ - status = HTCProcessRecvHeader(target,pPacket,nextLookAheads,&numLookAheads); - - if (A_FAILED(status)) { - break; - } - - if (pPacket->PktInfo.AsRx.HTCRxFlags & HTC_RX_PKT_IGNORE_LOOKAHEAD) { - /* this packet was part of a bundle that had to be broken up. - * It was fetched one message at a time. There may be other asynchronous reads queued behind this one. - * Do no issue another check for more packets since the last one in the series of requests - * will handle it */ - checkMorePkts = FALSE; - } - - DUMP_RECV_PKT_INFO(pPacket); - LOCK_HTC_RX(target); - SET_MORE_RX_PACKET_INDICATION_FLAG(nextLookAheads,numLookAheads,pEndpoint,pPacket); - /* we have a good packet, queue it to the completion queue */ - HTC_PACKET_ENQUEUE(&pEndpoint->RecvIndicationQueue,pPacket); - HTC_RX_STAT_PROFILE(target,pEndpoint,numLookAheads); - UNLOCK_HTC_RX(target); - - /* check for more recv packets before indicating */ - HTCAsyncRecvCheckMorePackets(target,nextLookAheads,numLookAheads,checkMorePkts); - - } while (FALSE); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("HTCRecvCompleteHandler , message fetch failed (status = %d) \n", - status)); - /* recycle this packet */ - HTC_RECYCLE_RX_PKT(target, pPacket, pEndpoint); - } else { - /* a good packet was queued, drain the queue */ - DrainRecvIndicationQueue(target,pEndpoint); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("-HTCRecvCompleteHandler\n")); -} - -/* synchronously wait for a control message from the target, - * This function is used at initialization time ONLY. At init messages - * on ENDPOINT 0 are expected. */ -A_STATUS HTCWaitforControlMessage(HTC_TARGET *target, HTC_PACKET **ppControlPacket) -{ - A_STATUS status; - A_UINT32 lookAhead; - HTC_PACKET *pPacket = NULL; - HTC_FRAME_HDR *pHdr; - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+HTCWaitforControlMessage \n")); - - do { - - *ppControlPacket = NULL; - - /* call the polling function to see if we have a message */ - status = DevPollMboxMsgRecv(&target->Device, - &lookAhead, - HTC_TARGET_RESPONSE_TIMEOUT); - - if (A_FAILED(status)) { - break; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - ("HTCWaitforControlMessage : lookAhead : 0x%X \n", lookAhead)); - - /* check the lookahead */ - pHdr = (HTC_FRAME_HDR *)&lookAhead; - - if (pHdr->EndpointID != ENDPOINT_0) { - /* unexpected endpoint number, should be zero */ - AR_DEBUG_ASSERT(FALSE); - status = A_EPROTO; - break; - } - - if (A_FAILED(status)) { - /* bad message */ - AR_DEBUG_ASSERT(FALSE); - status = A_EPROTO; - break; - } - - pPacket = HTC_ALLOC_CONTROL_RX(target); - - if (pPacket == NULL) { - AR_DEBUG_ASSERT(FALSE); - status = A_NO_MEMORY; - break; - } - - pPacket->PktInfo.AsRx.HTCRxFlags = 0; - pPacket->PktInfo.AsRx.ExpectedHdr = lookAhead; - pPacket->ActualLength = pHdr->PayloadLen + HTC_HDR_LENGTH; - - if (pPacket->ActualLength > pPacket->BufferLength) { - AR_DEBUG_ASSERT(FALSE); - status = A_EPROTO; - break; - } - - /* we want synchronous operation */ - pPacket->Completion = NULL; - - /* get the message from the device, this will block */ - status = HTCIssueRecv(target, pPacket); - - if (A_FAILED(status)) { - break; - } - - /* process receive header */ - status = HTCProcessRecvHeader(target,pPacket,NULL,NULL); - - pPacket->Status = status; - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("HTCWaitforControlMessage, HTCProcessRecvHeader failed (status = %d) \n", - status)); - break; - } - - /* give the caller this control message packet, they are responsible to free */ - *ppControlPacket = pPacket; - - } while (FALSE); - - if (A_FAILED(status)) { - if (pPacket != NULL) { - /* cleanup buffer on error */ - HTC_FREE_CONTROL_RX(target,pPacket); - } - } - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("-HTCWaitforControlMessage \n")); - - return status; -} - -static A_STATUS AllocAndPrepareRxPackets(HTC_TARGET *target, - A_UINT32 LookAheads[], - int Messages, - HTC_ENDPOINT *pEndpoint, - HTC_PACKET_QUEUE *pQueue) -{ - A_STATUS status = A_OK; - HTC_PACKET *pPacket; - HTC_FRAME_HDR *pHdr; - int i,j; - int numMessages; - int fullLength; - A_BOOL noRecycle; - - /* lock RX while we assemble the packet buffers */ - LOCK_HTC_RX(target); - - for (i = 0; i < Messages; i++) { - - pHdr = (HTC_FRAME_HDR *)&LookAheads[i]; - - if (pHdr->EndpointID >= ENDPOINT_MAX) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Invalid Endpoint in look-ahead: %d \n",pHdr->EndpointID)); - /* invalid endpoint */ - status = A_EPROTO; - break; - } - - if (pHdr->EndpointID != pEndpoint->Id) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Invalid Endpoint in look-ahead: %d should be : %d (index:%d)\n", - pHdr->EndpointID, pEndpoint->Id, i)); - /* invalid endpoint */ - status = A_EPROTO; - break; - } - - if (pHdr->PayloadLen > HTC_MAX_PAYLOAD_LENGTH) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Payload length %d exceeds max HTC : %d !\n", - pHdr->PayloadLen, (A_UINT32)HTC_MAX_PAYLOAD_LENGTH)); - status = A_EPROTO; - break; - } - - if (0 == pEndpoint->ServiceID) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Endpoint %d is not connected !\n",pHdr->EndpointID)); - /* endpoint isn't even connected */ - status = A_EPROTO; - break; - } - - if ((pHdr->Flags & HTC_FLAGS_RECV_BUNDLE_CNT_MASK) == 0) { - /* HTC header only indicates 1 message to fetch */ - numMessages = 1; - } else { - /* HTC header indicates that every packet to follow has the same padded length so that it can - * be optimally fetched as a full bundle */ - numMessages = (pHdr->Flags & HTC_FLAGS_RECV_BUNDLE_CNT_MASK) >> HTC_FLAGS_RECV_BUNDLE_CNT_SHIFT; - /* the count doesn't include the starter frame, just a count of frames to follow */ - numMessages++; - A_ASSERT(numMessages <= target->MaxMsgPerBundle); - INC_HTC_EP_STAT(pEndpoint, RxBundleIndFromHdr, 1); - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - ("HTC header indicates :%d messages can be fetched as a bundle \n",numMessages)); - } - - fullLength = DEV_CALC_RECV_PADDED_LEN(&target->Device,pHdr->PayloadLen + sizeof(HTC_FRAME_HDR)); - - /* get packet buffers for each message, if there was a bundle detected in the header, - * use pHdr as a template to fetch all packets in the bundle */ - for (j = 0; j < numMessages; j++) { - - /* reset flag, any packets allocated using the RecvAlloc() API cannot be recycled on cleanup, - * they must be explicitly returned */ - noRecycle = FALSE; - - if (pEndpoint->EpCallBacks.EpRecvAlloc != NULL) { - UNLOCK_HTC_RX(target); - noRecycle = TRUE; - /* user is using a per-packet allocation callback */ - pPacket = pEndpoint->EpCallBacks.EpRecvAlloc(pEndpoint->EpCallBacks.pContext, - pEndpoint->Id, - fullLength); - LOCK_HTC_RX(target); - - } else if ((pEndpoint->EpCallBacks.EpRecvAllocThresh != NULL) && - (fullLength > pEndpoint->EpCallBacks.RecvAllocThreshold)) { - INC_HTC_EP_STAT(pEndpoint,RxAllocThreshHit,1); - INC_HTC_EP_STAT(pEndpoint,RxAllocThreshBytes,pHdr->PayloadLen); - /* threshold was hit, call the special recv allocation callback */ - UNLOCK_HTC_RX(target); - noRecycle = TRUE; - /* user wants to allocate packets above a certain threshold */ - pPacket = pEndpoint->EpCallBacks.EpRecvAllocThresh(pEndpoint->EpCallBacks.pContext, - pEndpoint->Id, - fullLength); - LOCK_HTC_RX(target); - - } else { - /* user is using a refill handler that can refill multiple HTC buffers */ - - /* get a packet from the endpoint recv queue */ - pPacket = HTC_PACKET_DEQUEUE(&pEndpoint->RxBuffers); - - if (NULL == pPacket) { - /* check for refill handler */ - if (pEndpoint->EpCallBacks.EpRecvRefill != NULL) { - UNLOCK_HTC_RX(target); - /* call the re-fill handler */ - pEndpoint->EpCallBacks.EpRecvRefill(pEndpoint->EpCallBacks.pContext, - pEndpoint->Id); - LOCK_HTC_RX(target); - /* check if we have more buffers */ - pPacket = HTC_PACKET_DEQUEUE(&pEndpoint->RxBuffers); - /* fall through */ - } - } - } - - if (NULL == pPacket) { - /* this is not an error, we simply need to mark that we are waiting for buffers.*/ - target->RecvStateFlags |= HTC_RECV_WAIT_BUFFERS; - target->EpWaitingForBuffers = pEndpoint->Id; - status = A_NO_RESOURCE; - break; - } - - AR_DEBUG_ASSERT(pPacket->Endpoint == pEndpoint->Id); - /* clear flags */ - pPacket->PktInfo.AsRx.HTCRxFlags = 0; - pPacket->PktInfo.AsRx.IndicationFlags = 0; - pPacket->Status = A_OK; - - if (noRecycle) { - /* flag that these packets cannot be recycled, they have to be returned to the - * user */ - pPacket->PktInfo.AsRx.HTCRxFlags |= HTC_RX_PKT_NO_RECYCLE; - } - /* add packet to queue (also incase we need to cleanup down below) */ - HTC_PACKET_ENQUEUE(pQueue,pPacket); - - if (HTC_STOPPING(target)) { - status = A_ECANCELED; - break; - } - - /* make sure this message can fit in the endpoint buffer */ - if ((A_UINT32)fullLength > pPacket->BufferLength) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("Payload Length Error : header reports payload of: %d (%d) endpoint buffer size: %d \n", - pHdr->PayloadLen, fullLength, pPacket->BufferLength)); - status = A_EPROTO; - break; - } - - if (j > 0) { - /* for messages fetched in a bundle the expected lookahead is unknown since we - * are only using the lookahead of the first packet as a template of what to - * expect for lengths */ - /* flag that once we get the real HTC header we need to refesh the information */ - pPacket->PktInfo.AsRx.HTCRxFlags |= HTC_RX_PKT_REFRESH_HDR; - /* set it to something invalid */ - pPacket->PktInfo.AsRx.ExpectedHdr = 0xFFFFFFFF; - } else { - - pPacket->PktInfo.AsRx.ExpectedHdr = LookAheads[i]; /* set expected look ahead */ - } - /* set the amount of data to fetch */ - pPacket->ActualLength = pHdr->PayloadLen + HTC_HDR_LENGTH; - } - - if (A_FAILED(status)) { - if (A_NO_RESOURCE == status) { - /* this is actually okay */ - status = A_OK; - } - break; - } - - } - - UNLOCK_HTC_RX(target); - - if (A_FAILED(status)) { - while (!HTC_QUEUE_EMPTY(pQueue)) { - pPacket = HTC_PACKET_DEQUEUE(pQueue); - /* recycle all allocated packets */ - HTC_RECYCLE_RX_PKT(target,pPacket,&target->EndPoint[pPacket->Endpoint]); - } - } - - return status; -} - -static void HTCAsyncRecvScatterCompletion(HIF_SCATTER_REQ *pScatterReq) -{ - int i; - HTC_PACKET *pPacket; - HTC_ENDPOINT *pEndpoint; - A_UINT32 lookAheads[HTC_HOST_MAX_MSG_PER_BUNDLE]; - int numLookAheads = 0; - HTC_TARGET *target = (HTC_TARGET *)pScatterReq->Context; - A_STATUS status; - A_BOOL partialBundle = FALSE; - HTC_PACKET_QUEUE localRecvQueue = { {0} }; - A_BOOL procError = FALSE; - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+HTCAsyncRecvScatterCompletion TotLen: %d Entries: %d\n", - pScatterReq->TotalLength, pScatterReq->ValidScatterEntries)); - - A_ASSERT(!IS_DEV_IRQ_PROC_SYNC_MODE(&target->Device)); - - if (A_FAILED(pScatterReq->CompletionStatus)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("** Recv Scatter Request Failed: %d \n",pScatterReq->CompletionStatus)); - } - - if (pScatterReq->CallerFlags & HTC_SCATTER_REQ_FLAGS_PARTIAL_BUNDLE) { - partialBundle = TRUE; - } - - DEV_FINISH_SCATTER_OPERATION(pScatterReq); - - INIT_HTC_PACKET_QUEUE(&localRecvQueue); - - pPacket = (HTC_PACKET *)pScatterReq->ScatterList[0].pCallerContexts[0]; - /* note: all packets in a scatter req are for the same endpoint ! */ - pEndpoint = &target->EndPoint[pPacket->Endpoint]; - - /* walk through the scatter list and process */ - /* **** NOTE: DO NOT HOLD ANY LOCKS here, HTCProcessRecvHeader can take the TX lock - * as it processes credit reports */ - for (i = 0; i < pScatterReq->ValidScatterEntries; i++) { - pPacket = (HTC_PACKET *)pScatterReq->ScatterList[i].pCallerContexts[0]; - A_ASSERT(pPacket != NULL); - /* reset count, we are only interested in the look ahead in the last packet when we - * break out of this loop */ - numLookAheads = 0; - - if (A_SUCCESS(pScatterReq->CompletionStatus)) { - /* process header for each of the recv packets */ - status = HTCProcessRecvHeader(target,pPacket,lookAheads,&numLookAheads); - } else { - status = A_ERROR; - } - - if (A_SUCCESS(status)) { -#ifdef HTC_EP_STAT_PROFILING - LOCK_HTC_RX(target); - HTC_RX_STAT_PROFILE(target,pEndpoint,numLookAheads); - INC_HTC_EP_STAT(pEndpoint, RxPacketsBundled, 1); - UNLOCK_HTC_RX(target); -#endif - if (i == (pScatterReq->ValidScatterEntries - 1)) { - /* last packet's more packets flag is set based on the lookahead */ - SET_MORE_RX_PACKET_INDICATION_FLAG(lookAheads,numLookAheads,pEndpoint,pPacket); - } else { - /* packets in a bundle automatically have this flag set */ - FORCE_MORE_RX_PACKET_INDICATION_FLAG(pPacket); - } - - DUMP_RECV_PKT_INFO(pPacket); - /* since we can't hold a lock in this loop, we insert into our local recv queue for - * storage until we can transfer them to the recv completion queue */ - HTC_PACKET_ENQUEUE(&localRecvQueue,pPacket); - - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" Recv packet scatter entry %d failed (out of %d) \n", - i, pScatterReq->ValidScatterEntries)); - /* recycle failed recv */ - HTC_RECYCLE_RX_PKT(target, pPacket, pEndpoint); - /* set flag and continue processing the remaining scatter entries */ - procError = TRUE; - } - - } - - /* free scatter request */ - DEV_FREE_SCATTER_REQ(&target->Device,pScatterReq); - - LOCK_HTC_RX(target); - /* transfer the packets in the local recv queue to the recv completion queue */ - HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&pEndpoint->RecvIndicationQueue, &localRecvQueue); - - UNLOCK_HTC_RX(target); - - if (!procError) { - /* pipeline the next check (asynchronously) for more packets */ - HTCAsyncRecvCheckMorePackets(target, - lookAheads, - numLookAheads, - partialBundle ? FALSE : TRUE); - } - - /* now drain the indication queue */ - DrainRecvIndicationQueue(target,pEndpoint); - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("-HTCAsyncRecvScatterCompletion \n")); -} - -static A_STATUS HTCIssueRecvPacketBundle(HTC_TARGET *target, - HTC_PACKET_QUEUE *pRecvPktQueue, - HTC_PACKET_QUEUE *pSyncCompletionQueue, - int *pNumPacketsFetched, - A_BOOL PartialBundle) -{ - A_STATUS status = A_OK; - HIF_SCATTER_REQ *pScatterReq; - int i, totalLength; - int pktsToScatter; - HTC_PACKET *pPacket; - A_BOOL asyncMode = (pSyncCompletionQueue == NULL) ? TRUE : FALSE; - int scatterSpaceRemaining = DEV_GET_MAX_BUNDLE_RECV_LENGTH(&target->Device); - - pktsToScatter = HTC_PACKET_QUEUE_DEPTH(pRecvPktQueue); - pktsToScatter = min(pktsToScatter, target->MaxMsgPerBundle); - - if ((HTC_PACKET_QUEUE_DEPTH(pRecvPktQueue) - pktsToScatter) > 0) { - /* we were forced to split this bundle receive operation - * all packets in this partial bundle must have their lookaheads ignored */ - PartialBundle = TRUE; - /* this would only happen if the target ignored our max bundle limit */ - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, - ("HTCIssueRecvPacketBundle : partial bundle detected num:%d , %d \n", - HTC_PACKET_QUEUE_DEPTH(pRecvPktQueue), pktsToScatter)); - } - - totalLength = 0; - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+HTCIssueRecvPacketBundle (Numpackets: %d , actual : %d) \n", - HTC_PACKET_QUEUE_DEPTH(pRecvPktQueue), pktsToScatter)); - - do { - - pScatterReq = DEV_ALLOC_SCATTER_REQ(&target->Device); - - if (pScatterReq == NULL) { - /* no scatter resources left, just let caller handle it the legacy way */ - break; - } - - pScatterReq->CallerFlags = 0; - - if (PartialBundle) { - /* mark that this is a partial bundle, this has special ramifications to the - * scatter completion routine */ - pScatterReq->CallerFlags |= HTC_SCATTER_REQ_FLAGS_PARTIAL_BUNDLE; - } - - /* convert HTC packets to scatter list */ - for (i = 0; i < pktsToScatter; i++) { - int paddedLength; - - pPacket = HTC_PACKET_DEQUEUE(pRecvPktQueue); - A_ASSERT(pPacket != NULL); - - paddedLength = DEV_CALC_RECV_PADDED_LEN(&target->Device, pPacket->ActualLength); - - if ((scatterSpaceRemaining - paddedLength) < 0) { - /* exceeds what we can transfer, put the packet back */ - HTC_PACKET_ENQUEUE_TO_HEAD(pRecvPktQueue,pPacket); - break; - } - - scatterSpaceRemaining -= paddedLength; - - if (PartialBundle || (i < (pktsToScatter - 1))) { - /* packet 0..n-1 cannot be checked for look-aheads since we are fetching a bundle - * the last packet however can have it's lookahead used */ - pPacket->PktInfo.AsRx.HTCRxFlags |= HTC_RX_PKT_IGNORE_LOOKAHEAD; - } - - /* note: 1 HTC packet per scatter entry */ - /* setup packet into */ - pScatterReq->ScatterList[i].pBuffer = pPacket->pBuffer; - pScatterReq->ScatterList[i].Length = paddedLength; - - pPacket->PktInfo.AsRx.HTCRxFlags |= HTC_RX_PKT_PART_OF_BUNDLE; - - if (asyncMode) { - /* save HTC packet for async completion routine */ - pScatterReq->ScatterList[i].pCallerContexts[0] = pPacket; - } else { - /* queue to caller's sync completion queue, caller will unload this when we return */ - HTC_PACKET_ENQUEUE(pSyncCompletionQueue,pPacket); - } - - A_ASSERT(pScatterReq->ScatterList[i].Length); - totalLength += pScatterReq->ScatterList[i].Length; - } - - pScatterReq->TotalLength = totalLength; - pScatterReq->ValidScatterEntries = i; - - if (asyncMode) { - pScatterReq->CompletionRoutine = HTCAsyncRecvScatterCompletion; - pScatterReq->Context = target; - } - - status = DevSubmitScatterRequest(&target->Device, pScatterReq, DEV_SCATTER_READ, asyncMode); - - if (A_SUCCESS(status)) { - *pNumPacketsFetched = i; - } - - if (!asyncMode) { - /* free scatter request */ - DEV_FREE_SCATTER_REQ(&target->Device, pScatterReq); - } - - } while (FALSE); - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("-HTCIssueRecvPacketBundle (status:%d) (fetched:%d) \n", - status,*pNumPacketsFetched)); - - return status; -} - -static INLINE void CheckRecvWaterMark(HTC_ENDPOINT *pEndpoint) -{ - /* see if endpoint is using a refill watermark - * ** no need to use a lock here, since we are only inspecting... - * caller may must not hold locks when calling this function */ - if (pEndpoint->EpCallBacks.RecvRefillWaterMark > 0) { - if (HTC_PACKET_QUEUE_DEPTH(&pEndpoint->RxBuffers) < pEndpoint->EpCallBacks.RecvRefillWaterMark) { - /* call the re-fill handler before we continue */ - pEndpoint->EpCallBacks.EpRecvRefill(pEndpoint->EpCallBacks.pContext, - pEndpoint->Id); - } - } -} - -/* callback when device layer or lookahead report parsing detects a pending message */ -A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], int NumLookAheads, A_BOOL *pAsyncProc, int *pNumPktsFetched) -{ - HTC_TARGET *target = (HTC_TARGET *)Context; - A_STATUS status = A_OK; - HTC_PACKET *pPacket; - HTC_ENDPOINT *pEndpoint; - A_BOOL asyncProc = FALSE; - A_UINT32 lookAheads[HTC_HOST_MAX_MSG_PER_BUNDLE]; - int pktsFetched; - HTC_PACKET_QUEUE recvPktQueue = { {0} }; - HTC_PACKET_QUEUE syncCompletedPktsQueue = { {0} }; - A_BOOL partialBundle; - HTC_ENDPOINT_ID id; - int totalFetched = 0; - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+HTCRecvMessagePendingHandler NumLookAheads: %d \n",NumLookAheads)); - - if (pNumPktsFetched != NULL) { - *pNumPktsFetched = 0; - } - - if (IS_DEV_IRQ_PROCESSING_ASYNC_ALLOWED(&target->Device)) { - /* We use async mode to get the packets if the device layer supports it. - * The device layer interfaces with HIF in which HIF may have restrictions on - * how interrupts are processed */ - asyncProc = TRUE; - } - - if (pAsyncProc != NULL) { - /* indicate to caller how we decided to process this */ - *pAsyncProc = asyncProc; - } - - if (NumLookAheads > HTC_HOST_MAX_MSG_PER_BUNDLE) { - A_ASSERT(FALSE); - return A_EPROTO; - } - - /* on first entry copy the lookaheads into our temp array for processing */ - A_MEMCPY(lookAheads, MsgLookAheads, (sizeof(A_UINT32)) * NumLookAheads); - - while (TRUE) { - - /* reset packets queues */ - INIT_HTC_PACKET_QUEUE(&recvPktQueue); - INIT_HTC_PACKET_QUEUE(&syncCompletedPktsQueue); - - if (NumLookAheads > HTC_HOST_MAX_MSG_PER_BUNDLE) { - status = A_EPROTO; - A_ASSERT(FALSE); - break; - } - - /* first lookahead sets the expected endpoint IDs for all packets in a bundle */ - id = ((HTC_FRAME_HDR *)&lookAheads[0])->EndpointID; - pEndpoint = &target->EndPoint[id]; - - if (id >= ENDPOINT_MAX) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("MsgPend, Invalid Endpoint in look-ahead: %d \n",id)); - status = A_EPROTO; - break; - } - - /* try to allocate as many HTC RX packets indicated by the lookaheads - * these packets are stored in the recvPkt queue */ - status = AllocAndPrepareRxPackets(target, - lookAheads, - NumLookAheads, - pEndpoint, - &recvPktQueue); - if (A_FAILED(status)) { - break; - } - - if (HTC_PACKET_QUEUE_DEPTH(&recvPktQueue) >= 2) { - /* a recv bundle was detected, force IRQ status re-check again */ - REF_IRQ_STATUS_RECHECK(&target->Device); - } - - totalFetched += HTC_PACKET_QUEUE_DEPTH(&recvPktQueue); - - /* we've got packet buffers for all we can currently fetch, - * this count is not valid anymore */ - NumLookAheads = 0; - partialBundle = FALSE; - - /* now go fetch the list of HTC packets */ - while (!HTC_QUEUE_EMPTY(&recvPktQueue)) { - - pktsFetched = 0; - - if (target->RecvBundlingEnabled && (HTC_PACKET_QUEUE_DEPTH(&recvPktQueue) > 1)) { - /* there are enough packets to attempt a bundle transfer and recv bundling is allowed */ - status = HTCIssueRecvPacketBundle(target, - &recvPktQueue, - asyncProc ? NULL : &syncCompletedPktsQueue, - &pktsFetched, - partialBundle); - if (A_FAILED(status)) { - break; - } - - if (HTC_PACKET_QUEUE_DEPTH(&recvPktQueue) != 0) { - /* we couldn't fetch all packets at one time, this creates a broken - * bundle */ - partialBundle = TRUE; - } - } - - /* see if the previous operation fetched any packets using bundling */ - if (0 == pktsFetched) { - /* dequeue one packet */ - pPacket = HTC_PACKET_DEQUEUE(&recvPktQueue); - A_ASSERT(pPacket != NULL); - - if (asyncProc) { - /* we use async mode to get the packet if the device layer supports it - * set our callback and context */ - pPacket->Completion = HTCRecvCompleteHandler; - pPacket->pContext = target; - } else { - /* fully synchronous */ - pPacket->Completion = NULL; - } - - if (HTC_PACKET_QUEUE_DEPTH(&recvPktQueue) > 0) { - /* lookaheads in all packets except the last one in the bundle must be ignored */ - pPacket->PktInfo.AsRx.HTCRxFlags |= HTC_RX_PKT_IGNORE_LOOKAHEAD; - } - - /* go fetch the packet */ - status = HTCIssueRecv(target, pPacket); - if (A_FAILED(status)) { - break; - } - - if (!asyncProc) { - /* sent synchronously, queue this packet for synchronous completion */ - HTC_PACKET_ENQUEUE(&syncCompletedPktsQueue,pPacket); - } - - } - - } - - if (A_SUCCESS(status)) { - CheckRecvWaterMark(pEndpoint); - } - - if (asyncProc) { - /* we did this asynchronously so we can get out of the loop, the asynch processing - * creates a chain of requests to continue processing pending messages in the - * context of callbacks */ - break; - } - - /* synchronous handling */ - if (target->Device.DSRCanYield) { - /* for the SYNC case, increment count that tracks when the DSR should yield */ - target->Device.CurrentDSRRecvCount++; - } - - /* in the sync case, all packet buffers are now filled, - * we can process each packet, check lookaheads and then repeat */ - - /* unload sync completion queue */ - while (!HTC_QUEUE_EMPTY(&syncCompletedPktsQueue)) { - HTC_PACKET_QUEUE container; - - pPacket = HTC_PACKET_DEQUEUE(&syncCompletedPktsQueue); - A_ASSERT(pPacket != NULL); - - pEndpoint = &target->EndPoint[pPacket->Endpoint]; - /* reset count on each iteration, we are only interested in the last packet's lookahead - * information when we break out of this loop */ - NumLookAheads = 0; - /* process header for each of the recv packets - * note: the lookahead of the last packet is useful for us to continue in this loop */ - status = HTCProcessRecvHeader(target,pPacket,lookAheads,&NumLookAheads); - if (A_FAILED(status)) { - break; - } - - if (HTC_QUEUE_EMPTY(&syncCompletedPktsQueue)) { - /* last packet's more packets flag is set based on the lookahead */ - SET_MORE_RX_PACKET_INDICATION_FLAG(lookAheads,NumLookAheads,pEndpoint,pPacket); - } else { - /* packets in a bundle automatically have this flag set */ - FORCE_MORE_RX_PACKET_INDICATION_FLAG(pPacket); - } - /* good packet, indicate it */ - HTC_RX_STAT_PROFILE(target,pEndpoint,NumLookAheads); - - if (pPacket->PktInfo.AsRx.HTCRxFlags & HTC_RX_PKT_PART_OF_BUNDLE) { - INC_HTC_EP_STAT(pEndpoint, RxPacketsBundled, 1); - } - - INIT_HTC_PACKET_QUEUE_AND_ADD(&container,pPacket); - DO_RCV_COMPLETION(pEndpoint,&container); - } - - if (A_FAILED(status)) { - break; - } - - if (NumLookAheads == 0) { - /* no more look aheads */ - break; - } - - /* when we process recv synchronously we need to check if we should yield and stop - * fetching more packets indicated by the embedded lookaheads */ - if (target->Device.DSRCanYield) { - if (DEV_CHECK_RECV_YIELD(&target->Device)) { - /* break out, don't fetch any more packets */ - break; - } - } - - - /* check whether other OS contexts have queued any WMI command/data for WLAN. - * This check is needed only if WLAN Tx and Rx happens in same thread context */ - A_CHECK_DRV_TX(); - - /* for SYNCH processing, if we get here, we are running through the loop again due to a detected lookahead. - * Set flag that we should re-check IRQ status registers again before leaving IRQ processing, - * this can net better performance in high throughput situations */ - REF_IRQ_STATUS_RECHECK(&target->Device); - } - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("Failed to get pending recv messages (%d) \n",status)); - /* cleanup any packets we allocated but didn't use to actually fetch any packets */ - while (!HTC_QUEUE_EMPTY(&recvPktQueue)) { - pPacket = HTC_PACKET_DEQUEUE(&recvPktQueue); - /* clean up packets */ - HTC_RECYCLE_RX_PKT(target, pPacket, &target->EndPoint[pPacket->Endpoint]); - } - /* cleanup any packets in sync completion queue */ - while (!HTC_QUEUE_EMPTY(&syncCompletedPktsQueue)) { - pPacket = HTC_PACKET_DEQUEUE(&syncCompletedPktsQueue); - /* clean up packets */ - HTC_RECYCLE_RX_PKT(target, pPacket, &target->EndPoint[pPacket->Endpoint]); - } - if (HTC_STOPPING(target)) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, - (" Host is going to stop. blocking receiver for HTCStop.. \n")); - DevStopRecv(&target->Device, asyncProc ? DEV_STOP_RECV_ASYNC : DEV_STOP_RECV_SYNC); - } - } - /* before leaving, check to see if host ran out of buffers and needs to stop the - * receiver */ - if (target->RecvStateFlags & HTC_RECV_WAIT_BUFFERS) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, - (" Host has no RX buffers, blocking receiver to prevent overrun.. \n")); - /* try to stop receive at the device layer */ - DevStopRecv(&target->Device, asyncProc ? DEV_STOP_RECV_ASYNC : DEV_STOP_RECV_SYNC); - } - - if (pNumPktsFetched != NULL) { - *pNumPktsFetched = totalFetched; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("-HTCRecvMessagePendingHandler \n")); - - return status; -} - -A_STATUS HTCAddReceivePktMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueue) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - HTC_ENDPOINT *pEndpoint; - A_BOOL unblockRecv = FALSE; - A_STATUS status = A_OK; - HTC_PACKET *pFirstPacket; - - pFirstPacket = HTC_GET_PKT_AT_HEAD(pPktQueue); - - if (NULL == pFirstPacket) { - A_ASSERT(FALSE); - return A_EINVAL; - } - - AR_DEBUG_ASSERT(pFirstPacket->Endpoint < ENDPOINT_MAX); - - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, - ("+- HTCAddReceivePktMultiple : endPointId: %d, cnt:%d, length: %d\n", - pFirstPacket->Endpoint, - HTC_PACKET_QUEUE_DEPTH(pPktQueue), - pFirstPacket->BufferLength)); - - do { - - pEndpoint = &target->EndPoint[pFirstPacket->Endpoint]; - - LOCK_HTC_RX(target); - - if (HTC_STOPPING(target)) { - HTC_PACKET *pPacket; - - UNLOCK_HTC_RX(target); - - /* walk through queue and mark each one canceled */ - HTC_PACKET_QUEUE_ITERATE_ALLOW_REMOVE(pPktQueue,pPacket) { - pPacket->Status = A_ECANCELED; - } HTC_PACKET_QUEUE_ITERATE_END; - - DO_RCV_COMPLETION(pEndpoint,pPktQueue); - break; - } - - /* store receive packets */ - HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&pEndpoint->RxBuffers, pPktQueue); - - /* check if we are blocked waiting for a new buffer */ - if (target->RecvStateFlags & HTC_RECV_WAIT_BUFFERS) { - if (target->EpWaitingForBuffers == pFirstPacket->Endpoint) { - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,(" receiver was blocked on ep:%d, unblocking.. \n", - target->EpWaitingForBuffers)); - target->RecvStateFlags &= ~HTC_RECV_WAIT_BUFFERS; - target->EpWaitingForBuffers = ENDPOINT_MAX; - unblockRecv = TRUE; - } - } - - UNLOCK_HTC_RX(target); - - if (unblockRecv && !HTC_STOPPING(target)) { - /* TODO : implement a buffer threshold count? */ - DevEnableRecv(&target->Device,DEV_ENABLE_RECV_SYNC); - } - - } while (FALSE); - - return status; -} - -/* Makes a buffer available to the HTC module */ -A_STATUS HTCAddReceivePkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket) -{ - HTC_PACKET_QUEUE queue = { {0} }; - INIT_HTC_PACKET_QUEUE_AND_ADD(&queue,pPacket); - return HTCAddReceivePktMultiple(HTCHandle, &queue); -} - -void HTCUnblockRecv(HTC_HANDLE HTCHandle) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - A_BOOL unblockRecv = FALSE; - - LOCK_HTC_RX(target); - - /* check if we are blocked waiting for a new buffer */ - if (target->RecvStateFlags & HTC_RECV_WAIT_BUFFERS) { - AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("HTCUnblockRx : receiver was blocked on ep:%d, unblocking.. \n", - target->EpWaitingForBuffers)); - target->RecvStateFlags &= ~HTC_RECV_WAIT_BUFFERS; - target->EpWaitingForBuffers = ENDPOINT_MAX; - unblockRecv = TRUE; - } - - UNLOCK_HTC_RX(target); - - if (unblockRecv && !HTC_STOPPING(target)) { - /* re-enable */ - DevEnableRecv(&target->Device,DEV_ENABLE_RECV_ASYNC); - } -} - -static void HTCFlushRxQueue(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint, HTC_PACKET_QUEUE *pQueue) -{ - HTC_PACKET *pPacket; - HTC_PACKET_QUEUE container = { {0} }; - - LOCK_HTC_RX(target); - - while (1) { - pPacket = HTC_PACKET_DEQUEUE(pQueue); - if (NULL == pPacket) { - break; - } - UNLOCK_HTC_RX(target); - pPacket->Status = A_ECANCELED; - pPacket->ActualLength = 0; - AR_DEBUG_PRINTF(ATH_DEBUG_RECV, (" Flushing RX packet:0x%lX, length:%d, ep:%d \n", - (unsigned long)pPacket, pPacket->BufferLength, pPacket->Endpoint)); - INIT_HTC_PACKET_QUEUE_AND_ADD(&container,pPacket); - /* give the packet back */ - DO_RCV_COMPLETION(pEndpoint,&container); - LOCK_HTC_RX(target); - } - - UNLOCK_HTC_RX(target); -} - -static void HTCFlushEndpointRX(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint) -{ - /* flush any recv indications not already made */ - HTCFlushRxQueue(target,pEndpoint,&pEndpoint->RecvIndicationQueue); - /* flush any rx buffers */ - HTCFlushRxQueue(target,pEndpoint,&pEndpoint->RxBuffers); -} - -void HTCFlushRecvBuffers(HTC_TARGET *target) -{ - HTC_ENDPOINT *pEndpoint; - int i; - - for (i = ENDPOINT_0; i < ENDPOINT_MAX; i++) { - pEndpoint = &target->EndPoint[i]; - if (pEndpoint->ServiceID == 0) { - /* not in use.. */ - continue; - } - HTCFlushEndpointRX(target,pEndpoint); - } -} - - -void HTCEnableRecv(HTC_HANDLE HTCHandle) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - - if (!HTC_STOPPING(target)) { - /* re-enable */ - DevEnableRecv(&target->Device,DEV_ENABLE_RECV_SYNC); - } -} - -void HTCDisableRecv(HTC_HANDLE HTCHandle) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - - if (!HTC_STOPPING(target)) { - /* disable */ - DevStopRecv(&target->Device,DEV_ENABLE_RECV_SYNC); - } -} - -int HTCGetNumRecvBuffers(HTC_HANDLE HTCHandle, - HTC_ENDPOINT_ID Endpoint) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - return HTC_PACKET_QUEUE_DEPTH(&(target->EndPoint[Endpoint].RxBuffers)); -} - -A_STATUS HTCWaitForPendingRecv(HTC_HANDLE HTCHandle, - A_UINT32 TimeoutInMs, - A_BOOL *pbIsRecvPending) -{ - A_STATUS status = A_OK; - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - - status = DevWaitForPendingRecv(&target->Device, - TimeoutInMs, - pbIsRecvPending); - - return status; -} diff --git a/drivers/net/wireless/ar6003/host/htc2/htc_send.c b/drivers/net/wireless/ar6003/host/htc2/htc_send.c deleted file mode 100644 index cdc393485a56..000000000000 --- a/drivers/net/wireless/ar6003/host/htc2/htc_send.c +++ /dev/null @@ -1,1024 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#include "htc_internal.h" - -typedef enum _HTC_SEND_QUEUE_RESULT { - HTC_SEND_QUEUE_OK = 0, /* packet was queued */ - HTC_SEND_QUEUE_DROP = 1, /* this packet should be dropped */ -} HTC_SEND_QUEUE_RESULT; - -#define DO_EP_TX_COMPLETION(ep,q) DoSendCompletion(ep,q) - -/* call the distribute credits callback with the distribution */ -#define DO_DISTRIBUTION(t,reason,description,pList) \ -{ \ - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, \ - (" calling distribute function (%s) (dfn:0x%lX, ctxt:0x%lX, dist:0x%lX) \n", \ - (description), \ - (unsigned long)(t)->DistributeCredits, \ - (unsigned long)(t)->pCredDistContext, \ - (unsigned long)pList)); \ - (t)->DistributeCredits((t)->pCredDistContext, \ - (pList), \ - (reason)); \ -} - -static void DoSendCompletion(HTC_ENDPOINT *pEndpoint, - HTC_PACKET_QUEUE *pQueueToIndicate) -{ - do { - - if (HTC_QUEUE_EMPTY(pQueueToIndicate)) { - /* nothing to indicate */ - break; - } - - if (pEndpoint->EpCallBacks.EpTxCompleteMultiple != NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" HTC calling ep %d, send complete multiple callback (%d pkts) \n", - pEndpoint->Id, HTC_PACKET_QUEUE_DEPTH(pQueueToIndicate))); - /* a multiple send complete handler is being used, pass the queue to the handler */ - pEndpoint->EpCallBacks.EpTxCompleteMultiple(pEndpoint->EpCallBacks.pContext, - pQueueToIndicate); - /* all packets are now owned by the callback, reset queue to be safe */ - INIT_HTC_PACKET_QUEUE(pQueueToIndicate); - } else { - HTC_PACKET *pPacket; - /* using legacy EpTxComplete */ - do { - pPacket = HTC_PACKET_DEQUEUE(pQueueToIndicate); - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" HTC calling ep %d send complete callback on packet 0x%lX \n", \ - pEndpoint->Id, (unsigned long)(pPacket))); - pEndpoint->EpCallBacks.EpTxComplete(pEndpoint->EpCallBacks.pContext, pPacket); - } while (!HTC_QUEUE_EMPTY(pQueueToIndicate)); - } - - } while (FALSE); - -} - -/* do final completion on sent packet */ -static INLINE void CompleteSentPacket(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint, HTC_PACKET *pPacket) -{ - pPacket->Completion = NULL; - - if (A_FAILED(pPacket->Status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("CompleteSentPacket: request failed (status:%d, ep:%d, length:%d creds:%d) \n", - pPacket->Status, pPacket->Endpoint, pPacket->ActualLength, pPacket->PktInfo.AsTx.CreditsUsed)); - /* on failure to submit, reclaim credits for this packet */ - LOCK_HTC_TX(target); - pEndpoint->CreditDist.TxCreditsToDist += pPacket->PktInfo.AsTx.CreditsUsed; - pEndpoint->CreditDist.TxQueueDepth = HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue); - DO_DISTRIBUTION(target, - HTC_CREDIT_DIST_SEND_COMPLETE, - "Send Complete", - target->EpCreditDistributionListHead->pNext); - UNLOCK_HTC_TX(target); - } - /* first, fixup the head room we allocated */ - pPacket->pBuffer += HTC_HDR_LENGTH; -} - -/* our internal send packet completion handler when packets are submited to the AR6K device - * layer */ -static void HTCSendPktCompletionHandler(void *Context, HTC_PACKET *pPacket) -{ - HTC_TARGET *target = (HTC_TARGET *)Context; - HTC_ENDPOINT *pEndpoint = &target->EndPoint[pPacket->Endpoint]; - HTC_PACKET_QUEUE container = { {0} }; - - CompleteSentPacket(target,pEndpoint,pPacket); - INIT_HTC_PACKET_QUEUE_AND_ADD(&container,pPacket); - /* do completion */ - DO_EP_TX_COMPLETION(pEndpoint,&container); -} - -A_STATUS HTCIssueSend(HTC_TARGET *target, HTC_PACKET *pPacket) -{ - A_STATUS status; - A_BOOL sync = FALSE; - - if (pPacket->Completion == NULL) { - /* mark that this request was synchronously issued */ - sync = TRUE; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, - ("+-HTCIssueSend: transmit length : %d (%s) \n", - pPacket->ActualLength + (A_UINT32)HTC_HDR_LENGTH, - sync ? "SYNC" : "ASYNC" )); - - /* send message to device */ - status = DevSendPacket(&target->Device, - pPacket, - pPacket->ActualLength + HTC_HDR_LENGTH); - - if (sync) { - /* use local sync variable. If this was issued asynchronously, pPacket is no longer - * safe to access. */ - pPacket->pBuffer += HTC_HDR_LENGTH; - } - - /* if this request was asynchronous, the packet completion routine will be invoked by - * the device layer when the HIF layer completes the request */ - - return status; -} - - /* get HTC send packets from the TX queue on an endpoint */ -static INLINE void GetHTCSendPackets(HTC_TARGET *target, - HTC_ENDPOINT *pEndpoint, - HTC_PACKET_QUEUE *pQueue) -{ - int creditsRequired; - int remainder; - A_UINT8 sendFlags; - HTC_PACKET *pPacket; - unsigned int transferLength; - - /****** NOTE : the TX lock is held when this function is called *****************/ - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+GetHTCSendPackets \n")); - - /* loop until we can grab as many packets out of the queue as we can */ - while (TRUE) { - - sendFlags = 0; - /* get packet at head, but don't remove it */ - pPacket = HTC_GET_PKT_AT_HEAD(&pEndpoint->TxQueue); - if (pPacket == NULL) { - break; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,(" Got head packet:0x%lX , Queue Depth: %d\n", - (unsigned long)pPacket, HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue))); - - transferLength = DEV_CALC_SEND_PADDED_LEN(&target->Device, pPacket->ActualLength + HTC_HDR_LENGTH); - - if (transferLength <= target->TargetCreditSize) { - creditsRequired = 1; - } else { - /* figure out how many credits this message requires */ - creditsRequired = transferLength / target->TargetCreditSize; - remainder = transferLength % target->TargetCreditSize; - - if (remainder) { - creditsRequired++; - } - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,(" Creds Required:%d Got:%d\n", - creditsRequired, pEndpoint->CreditDist.TxCredits)); - - if (pEndpoint->CreditDist.TxCredits < creditsRequired) { - - /* not enough credits */ - if (pPacket->Endpoint == ENDPOINT_0) { - /* leave it in the queue */ - break; - } - /* invoke the registered distribution function only if this is not - * endpoint 0, we let the driver layer provide more credits if it can. - * We pass the credit distribution list starting at the endpoint in question - * */ - - /* set how many credits we need */ - pEndpoint->CreditDist.TxCreditsSeek = - creditsRequired - pEndpoint->CreditDist.TxCredits; - DO_DISTRIBUTION(target, - HTC_CREDIT_DIST_SEEK_CREDITS, - "Seek Credits", - &pEndpoint->CreditDist); - pEndpoint->CreditDist.TxCreditsSeek = 0; - - if (pEndpoint->CreditDist.TxCredits < creditsRequired) { - /* still not enough credits to send, leave packet in the queue */ - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, - (" Not enough credits for ep %d leaving packet in queue..\n", - pPacket->Endpoint)); - break; - } - - } - - pEndpoint->CreditDist.TxCredits -= creditsRequired; - INC_HTC_EP_STAT(pEndpoint, TxCreditsConsummed, creditsRequired); - - /* check if we need credits back from the target */ - if (pEndpoint->CreditDist.TxCredits < pEndpoint->CreditDist.TxCreditsPerMaxMsg) { - /* we are getting low on credits, see if we can ask for more from the distribution function */ - pEndpoint->CreditDist.TxCreditsSeek = - pEndpoint->CreditDist.TxCreditsPerMaxMsg - pEndpoint->CreditDist.TxCredits; - - DO_DISTRIBUTION(target, - HTC_CREDIT_DIST_SEEK_CREDITS, - "Seek Credits", - &pEndpoint->CreditDist); - - pEndpoint->CreditDist.TxCreditsSeek = 0; - /* see if we were successful in getting more */ - if (pEndpoint->CreditDist.TxCredits < pEndpoint->CreditDist.TxCreditsPerMaxMsg) { - /* tell the target we need credits ASAP! */ - sendFlags |= HTC_FLAGS_NEED_CREDIT_UPDATE; - INC_HTC_EP_STAT(pEndpoint, TxCreditLowIndications, 1); - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,(" Host Needs Credits \n")); - } - } - - /* now we can fully dequeue */ - pPacket = HTC_PACKET_DEQUEUE(&pEndpoint->TxQueue); - /* save the number of credits this packet consumed */ - pPacket->PktInfo.AsTx.CreditsUsed = creditsRequired; - /* all TX packets are handled asynchronously */ - pPacket->Completion = HTCSendPktCompletionHandler; - pPacket->pContext = target; - INC_HTC_EP_STAT(pEndpoint, TxIssued, 1); - /* save send flags */ - pPacket->PktInfo.AsTx.SendFlags = sendFlags; - pPacket->PktInfo.AsTx.SeqNo = pEndpoint->SeqNo; - pEndpoint->SeqNo++; - /* queue this packet into the caller's queue */ - HTC_PACKET_ENQUEUE(pQueue,pPacket); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("-GetHTCSendPackets \n")); - -} - -static void HTCAsyncSendScatterCompletion(HIF_SCATTER_REQ *pScatterReq) -{ - int i; - HTC_PACKET *pPacket; - HTC_ENDPOINT *pEndpoint = (HTC_ENDPOINT *)pScatterReq->Context; - HTC_TARGET *target = (HTC_TARGET *)pEndpoint->target; - A_STATUS status = A_OK; - HTC_PACKET_QUEUE sendCompletes = { {0} }; - - INIT_HTC_PACKET_QUEUE(&sendCompletes); - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+HTCAsyncSendScatterCompletion TotLen: %d Entries: %d\n", - pScatterReq->TotalLength, pScatterReq->ValidScatterEntries)); - - DEV_FINISH_SCATTER_OPERATION(pScatterReq); - - if (A_FAILED(pScatterReq->CompletionStatus)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("** Send Scatter Request Failed: %d \n",pScatterReq->CompletionStatus)); - status = A_ERROR; - } - - /* walk through the scatter list and process */ - for (i = 0; i < pScatterReq->ValidScatterEntries; i++) { - pPacket = (HTC_PACKET *)(pScatterReq->ScatterList[i].pCallerContexts[0]); - A_ASSERT(pPacket != NULL); - pPacket->Status = status; - CompleteSentPacket(target,pEndpoint,pPacket); - /* add it to the completion queue */ - HTC_PACKET_ENQUEUE(&sendCompletes, pPacket); - } - - /* free scatter request */ - DEV_FREE_SCATTER_REQ(&target->Device,pScatterReq); - /* complete all packets */ - DO_EP_TX_COMPLETION(pEndpoint,&sendCompletes); - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("-HTCAsyncSendScatterCompletion \n")); -} - - /* drain a queue and send as bundles - * this function may return without fully draining the queue under the following conditions : - * - scatter resources are exhausted - * - a message that will consume a partial credit will stop the bundling process early - * - we drop below the minimum number of messages for a bundle - * */ -static void HTCIssueSendBundle(HTC_ENDPOINT *pEndpoint, - HTC_PACKET_QUEUE *pQueue, - int *pBundlesSent, - int *pTotalBundlesPkts) -{ - int pktsToScatter; - unsigned int scatterSpaceRemaining; - HIF_SCATTER_REQ *pScatterReq = NULL; - int i, packetsInScatterReq; - unsigned int transferLength; - HTC_PACKET *pPacket; - A_BOOL done = FALSE; - int bundlesSent = 0; - int totalPktsInBundle = 0; - HTC_TARGET *target = pEndpoint->target; - int creditRemainder = 0; - int creditPad; - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+HTCIssueSendBundle \n")); - - while (!done) { - - pktsToScatter = HTC_PACKET_QUEUE_DEPTH(pQueue); - pktsToScatter = min(pktsToScatter, target->MaxMsgPerBundle); - - if (pktsToScatter < HTC_MIN_HTC_MSGS_TO_BUNDLE) { - /* not enough to bundle */ - break; - } - - pScatterReq = DEV_ALLOC_SCATTER_REQ(&target->Device); - - if (pScatterReq == NULL) { - /* no scatter resources */ - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,(" No more scatter resources \n")); - break; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,(" pkts to scatter: %d \n", pktsToScatter)); - - pScatterReq->TotalLength = 0; - pScatterReq->ValidScatterEntries = 0; - - packetsInScatterReq = 0; - scatterSpaceRemaining = DEV_GET_MAX_BUNDLE_SEND_LENGTH(&target->Device); - - for (i = 0; i < pktsToScatter; i++) { - - pScatterReq->ScatterList[i].pCallerContexts[0] = NULL; - - pPacket = HTC_GET_PKT_AT_HEAD(pQueue); - if (pPacket == NULL) { - A_ASSERT(FALSE); - break; - } - - creditPad = 0; - transferLength = DEV_CALC_SEND_PADDED_LEN(&target->Device, - pPacket->ActualLength + HTC_HDR_LENGTH); - /* see if the padded transfer length falls on a credit boundary */ - creditRemainder = transferLength % target->TargetCreditSize; - - if (creditRemainder != 0) { - /* the transfer consumes a "partial" credit, this packet cannot be bundled unless - * we add additional "dummy" padding (max 255 bytes) to consume the entire credit - *** NOTE: only allow the send padding if the endpoint is allowed to */ - if (pEndpoint->LocalConnectionFlags & HTC_LOCAL_CONN_FLAGS_ENABLE_SEND_BUNDLE_PADDING) { - if (transferLength < target->TargetCreditSize) { - /* special case where the transfer is less than a credit */ - creditPad = target->TargetCreditSize - transferLength; - } else { - creditPad = creditRemainder; - } - - /* now check to see if we can indicate padding in the HTC header */ - if ((creditPad > 0) && (creditPad <= 255)) { - /* adjust the transferlength of this packet with the new credit padding */ - transferLength += creditPad; - } else { - /* the amount to pad is too large, bail on this packet, we have to - * send it using the non-bundled method */ - pPacket = NULL; - } - } else { - /* bail on this packet, user does not want padding applied */ - pPacket = NULL; - } - } - - if (NULL == pPacket) { - /* can't bundle */ - done = TRUE; - break; - } - - if (scatterSpaceRemaining < transferLength) { - /* exceeds what we can transfer */ - break; - } - - scatterSpaceRemaining -= transferLength; - /* now remove it from the queue */ - pPacket = HTC_PACKET_DEQUEUE(pQueue); - /* save it in the scatter list */ - pScatterReq->ScatterList[i].pCallerContexts[0] = pPacket; - /* prepare packet and flag message as part of a send bundle */ - HTC_PREPARE_SEND_PKT(pPacket, - pPacket->PktInfo.AsTx.SendFlags | HTC_FLAGS_SEND_BUNDLE, - creditPad, - pPacket->PktInfo.AsTx.SeqNo); - pScatterReq->ScatterList[i].pBuffer = pPacket->pBuffer; - pScatterReq->ScatterList[i].Length = transferLength; - A_ASSERT(transferLength); - pScatterReq->TotalLength += transferLength; - pScatterReq->ValidScatterEntries++; - packetsInScatterReq++; - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,(" %d, Adding packet : 0x%lX, len:%d (remaining space:%d) \n", - i, (unsigned long)pPacket,transferLength,scatterSpaceRemaining)); - } - - if (packetsInScatterReq >= HTC_MIN_HTC_MSGS_TO_BUNDLE) { - /* send path is always asynchronous */ - pScatterReq->CompletionRoutine = HTCAsyncSendScatterCompletion; - pScatterReq->Context = pEndpoint; - bundlesSent++; - totalPktsInBundle += packetsInScatterReq; - packetsInScatterReq = 0; - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,(" Send Scatter total bytes: %d , entries: %d\n", - pScatterReq->TotalLength,pScatterReq->ValidScatterEntries)); - DevSubmitScatterRequest(&target->Device, pScatterReq, DEV_SCATTER_WRITE, DEV_SCATTER_ASYNC); - /* we don't own this anymore */ - pScatterReq = NULL; - /* try to send some more */ - continue; - } - - /* not enough packets to use the scatter request, cleanup */ - if (pScatterReq != NULL) { - if (packetsInScatterReq > 0) { - /* work backwards to requeue requests */ - for (i = (packetsInScatterReq - 1); i >= 0; i--) { - pPacket = (HTC_PACKET *)(pScatterReq->ScatterList[i].pCallerContexts[0]); - if (pPacket != NULL) { - /* undo any prep */ - HTC_UNPREPARE_SEND_PKT(pPacket); - /* queue back to the head */ - HTC_PACKET_ENQUEUE_TO_HEAD(pQueue,pPacket); - } - } - } - DEV_FREE_SCATTER_REQ(&target->Device,pScatterReq); - } - - /* if we get here, we sent all that we could, get out */ - break; - - } - - *pBundlesSent = bundlesSent; - *pTotalBundlesPkts = totalPktsInBundle; - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("-HTCIssueSendBundle (sent:%d) \n",bundlesSent)); - - return; -} - -/* - * if there are no credits, the packet(s) remains in the queue. - * this function returns the result of the attempt to send a queue of HTC packets */ -static HTC_SEND_QUEUE_RESULT HTCTrySend(HTC_TARGET *target, - HTC_ENDPOINT *pEndpoint, - HTC_PACKET_QUEUE *pCallersSendQueue) -{ - HTC_PACKET_QUEUE sendQueue = { {0} }; /* temp queue to hold packets at various stages */ - HTC_PACKET *pPacket; - int bundlesSent; - int pktsInBundles; - int overflow; - HTC_SEND_QUEUE_RESULT result = HTC_SEND_QUEUE_OK; - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+HTCTrySend (Queue:0x%lX Depth:%d)\n", - (unsigned long)pCallersSendQueue, - (pCallersSendQueue == NULL) ? 0 : HTC_PACKET_QUEUE_DEPTH(pCallersSendQueue))); - - /* init the local send queue */ - INIT_HTC_PACKET_QUEUE(&sendQueue); - - do { - - if (NULL == pCallersSendQueue) { - /* caller didn't provide a queue, just wants us to check queues and send */ - break; - } - - if (HTC_QUEUE_EMPTY(pCallersSendQueue)) { - /* empty queue */ - result = HTC_SEND_QUEUE_DROP; - break; - } - - if (HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue) >= pEndpoint->MaxTxQueueDepth) { - /* we've already overflowed */ - overflow = HTC_PACKET_QUEUE_DEPTH(pCallersSendQueue); - } else { - /* figure out how much we will overflow by */ - overflow = HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue); - overflow += HTC_PACKET_QUEUE_DEPTH(pCallersSendQueue); - /* figure out how much we will overflow the TX queue by */ - overflow -= pEndpoint->MaxTxQueueDepth; - } - - /* if overflow is negative or zero, we are okay */ - if (overflow > 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, - (" Endpoint %d, TX queue will overflow :%d , Tx Depth:%d, Max:%d \n", - pEndpoint->Id, overflow, HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue), pEndpoint->MaxTxQueueDepth)); - } - if ((overflow <= 0) || (pEndpoint->EpCallBacks.EpSendFull == NULL)) { - /* all packets will fit or caller did not provide send full indication handler - * -- just move all of them to the local sendQueue object */ - HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&sendQueue, pCallersSendQueue); - } else { - int i; - int goodPkts = HTC_PACKET_QUEUE_DEPTH(pCallersSendQueue) - overflow; - - A_ASSERT(goodPkts >= 0); - /* we have overflowed, and a callback is provided */ - /* dequeue all non-overflow packets into the sendqueue */ - for (i = 0; i < goodPkts; i++) { - /* pop off caller's queue*/ - pPacket = HTC_PACKET_DEQUEUE(pCallersSendQueue); - A_ASSERT(pPacket != NULL); - /* insert into local queue */ - HTC_PACKET_ENQUEUE(&sendQueue,pPacket); - } - - /* the caller's queue has all the packets that won't fit*/ - /* walk through the caller's queue and indicate each one to the send full handler */ - ITERATE_OVER_LIST_ALLOW_REMOVE(&pCallersSendQueue->QueueHead, pPacket, HTC_PACKET, ListLink) { - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" Indicating overflowed TX packet: 0x%lX \n", - (unsigned long)pPacket)); - if (pEndpoint->EpCallBacks.EpSendFull(pEndpoint->EpCallBacks.pContext, - pPacket) == HTC_SEND_FULL_DROP) { - /* callback wants the packet dropped */ - INC_HTC_EP_STAT(pEndpoint, TxDropped, 1); - /* leave this one in the caller's queue for cleanup */ - } else { - /* callback wants to keep this packet, remove from caller's queue */ - HTC_PACKET_REMOVE(pCallersSendQueue, pPacket); - /* put it in the send queue */ - HTC_PACKET_ENQUEUE(&sendQueue,pPacket); - } - - } ITERATE_END; - - if (HTC_QUEUE_EMPTY(&sendQueue)) { - /* no packets made it in, caller will cleanup */ - result = HTC_SEND_QUEUE_DROP; - break; - } - } - - } while (FALSE); - - if (result != HTC_SEND_QUEUE_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("-HTCTrySend: \n")); - return result; - } - - LOCK_HTC_TX(target); - - if (!HTC_QUEUE_EMPTY(&sendQueue)) { - /* transfer packets */ - HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&pEndpoint->TxQueue,&sendQueue); - A_ASSERT(HTC_QUEUE_EMPTY(&sendQueue)); - INIT_HTC_PACKET_QUEUE(&sendQueue); - } - - /* increment tx processing count on entry */ - pEndpoint->TxProcessCount++; - if (pEndpoint->TxProcessCount > 1) { - /* another thread or task is draining the TX queues on this endpoint - * that thread will reset the tx processing count when the queue is drained */ - pEndpoint->TxProcessCount--; - UNLOCK_HTC_TX(target); - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("-HTCTrySend (busy) \n")); - return HTC_SEND_QUEUE_OK; - } - - /***** beyond this point only 1 thread may enter ******/ - - /* now drain the endpoint TX queue for transmission as long as we have enough - * credits */ - while (TRUE) { - - if (HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue) == 0) { - break; - } - - /* get all the packets for this endpoint that we can for this pass */ - GetHTCSendPackets(target, pEndpoint, &sendQueue); - - if (HTC_PACKET_QUEUE_DEPTH(&sendQueue) == 0) { - /* didn't get any packets due to a lack of credits */ - break; - } - - UNLOCK_HTC_TX(target); - - /* any packets to send are now in our local send queue */ - - bundlesSent = 0; - pktsInBundles = 0; - - while (TRUE) { - - /* try to send a bundle on each pass */ - if ((target->SendBundlingEnabled) && - (HTC_PACKET_QUEUE_DEPTH(&sendQueue) >= HTC_MIN_HTC_MSGS_TO_BUNDLE)) { - int temp1,temp2; - /* bundling is enabled and there is at least a minimum number of packets in the send queue - * send what we can in this pass */ - HTCIssueSendBundle(pEndpoint, &sendQueue, &temp1, &temp2); - bundlesSent += temp1; - pktsInBundles += temp2; - } - - /* if not bundling or there was a packet that could not be placed in a bundle, pull it out - * and send it the normal way */ - pPacket = HTC_PACKET_DEQUEUE(&sendQueue); - if (NULL == pPacket) { - /* local queue is fully drained */ - break; - } - HTC_PREPARE_SEND_PKT(pPacket, - pPacket->PktInfo.AsTx.SendFlags, - 0, - pPacket->PktInfo.AsTx.SeqNo); - HTCIssueSend(target, pPacket); - - /* go back and see if we can bundle some more */ - } - - LOCK_HTC_TX(target); - - INC_HTC_EP_STAT(pEndpoint, TxBundles, bundlesSent); - INC_HTC_EP_STAT(pEndpoint, TxPacketsBundled, pktsInBundles); - - } - - /* done with this endpoint, we can clear the count */ - pEndpoint->TxProcessCount = 0; - UNLOCK_HTC_TX(target); - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("-HTCTrySend: \n")); - - return HTC_SEND_QUEUE_OK; -} - -A_STATUS HTCSendPktsMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueue) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - HTC_ENDPOINT *pEndpoint; - HTC_PACKET *pPacket; - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+HTCSendPktsMultiple: Queue: 0x%lX, Pkts %d \n", - (unsigned long)pPktQueue, HTC_PACKET_QUEUE_DEPTH(pPktQueue))); - - /* get packet at head to figure out which endpoint these packets will go into */ - pPacket = HTC_GET_PKT_AT_HEAD(pPktQueue); - if (NULL == pPacket) { - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-HTCSendPktsMultiple \n")); - return A_EINVAL; - } - - AR_DEBUG_ASSERT(pPacket->Endpoint < ENDPOINT_MAX); - pEndpoint = &target->EndPoint[pPacket->Endpoint]; - - HTCTrySend(target, pEndpoint, pPktQueue); - - /* do completion on any packets that couldn't get in */ - if (!HTC_QUEUE_EMPTY(pPktQueue)) { - - HTC_PACKET_QUEUE_ITERATE_ALLOW_REMOVE(pPktQueue,pPacket) { - if (HTC_STOPPING(target)) { - pPacket->Status = A_ECANCELED; - } else { - pPacket->Status = A_NO_RESOURCE; - } - } HTC_PACKET_QUEUE_ITERATE_END; - - DO_EP_TX_COMPLETION(pEndpoint,pPktQueue); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-HTCSendPktsMultiple \n")); - - return A_OK; -} - -/* HTC API - HTCSendPkt */ -A_STATUS HTCSendPkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket) -{ - HTC_PACKET_QUEUE queue = { {0} }; - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, - ("+-HTCSendPkt: Enter endPointId: %d, buffer: 0x%lX, length: %d \n", - pPacket->Endpoint, (unsigned long)pPacket->pBuffer, pPacket->ActualLength)); - INIT_HTC_PACKET_QUEUE_AND_ADD(&queue,pPacket); - return HTCSendPktsMultiple(HTCHandle, &queue); -} - -/* check TX queues to drain because of credit distribution update */ -static INLINE void HTCCheckEndpointTxQueues(HTC_TARGET *target) -{ - HTC_ENDPOINT *pEndpoint; - HTC_ENDPOINT_CREDIT_DIST *pDistItem; - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+HTCCheckEndpointTxQueues \n")); - pDistItem = target->EpCreditDistributionListHead; - - /* run through the credit distribution list to see - * if there are packets queued - * NOTE: no locks need to be taken since the distribution list - * is not dynamic (cannot be re-ordered) and we are not modifying any state */ - while (pDistItem != NULL) { - pEndpoint = (HTC_ENDPOINT *)pDistItem->pHTCReserved; - - if (HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue) > 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" Ep %d has %d credits and %d Packets in TX Queue \n", - pDistItem->Endpoint, pEndpoint->CreditDist.TxCredits, HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue))); - /* try to start the stalled queue, this list is ordered by priority. - * Highest priority queue get's processed first, if there are credits available the - * highest priority queue will get a chance to reclaim credits from lower priority - * ones */ - HTCTrySend(target, pEndpoint, NULL); - } - - pDistItem = pDistItem->pNext; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-HTCCheckEndpointTxQueues \n")); -} - -/* process credit reports and call distribution function */ -void HTCProcessCreditRpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt, int NumEntries, HTC_ENDPOINT_ID FromEndpoint) -{ - int i; - HTC_ENDPOINT *pEndpoint; - int totalCredits = 0; - A_BOOL doDist = FALSE; - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+HTCProcessCreditRpt, Credit Report Entries:%d \n", NumEntries)); - - /* lock out TX while we update credits */ - LOCK_HTC_TX(target); - - for (i = 0; i < NumEntries; i++, pRpt++) { - if (pRpt->EndpointID >= ENDPOINT_MAX) { - AR_DEBUG_ASSERT(FALSE); - break; - } - - pEndpoint = &target->EndPoint[pRpt->EndpointID]; - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" Endpoint %d got %d credits \n", - pRpt->EndpointID, pRpt->Credits)); - - -#ifdef HTC_EP_STAT_PROFILING - - INC_HTC_EP_STAT(pEndpoint, TxCreditRpts, 1); - INC_HTC_EP_STAT(pEndpoint, TxCreditsReturned, pRpt->Credits); - - if (FromEndpoint == pRpt->EndpointID) { - /* this credit report arrived on the same endpoint indicating it arrived in an RX - * packet */ - INC_HTC_EP_STAT(pEndpoint, TxCreditsFromRx, pRpt->Credits); - INC_HTC_EP_STAT(pEndpoint, TxCreditRptsFromRx, 1); - } else if (FromEndpoint == ENDPOINT_0) { - /* this credit arrived on endpoint 0 as a NULL message */ - INC_HTC_EP_STAT(pEndpoint, TxCreditsFromEp0, pRpt->Credits); - INC_HTC_EP_STAT(pEndpoint, TxCreditRptsFromEp0, 1); - } else { - /* arrived on another endpoint */ - INC_HTC_EP_STAT(pEndpoint, TxCreditsFromOther, pRpt->Credits); - INC_HTC_EP_STAT(pEndpoint, TxCreditRptsFromOther, 1); - } - -#endif - - if (ENDPOINT_0 == pRpt->EndpointID) { - /* always give endpoint 0 credits back */ - pEndpoint->CreditDist.TxCredits += pRpt->Credits; - } else { - /* for all other endpoints, update credits to distribute, the distribution function - * will handle giving out credits back to the endpoints */ - pEndpoint->CreditDist.TxCreditsToDist += pRpt->Credits; - /* flag that we have to do the distribution */ - doDist = TRUE; - } - - /* refresh tx depth for distribution function that will recover these credits - * NOTE: this is only valid when there are credits to recover! */ - pEndpoint->CreditDist.TxQueueDepth = HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue); - - totalCredits += pRpt->Credits; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" Report indicated %d credits to distribute \n", totalCredits)); - - if (doDist) { - /* this was a credit return based on a completed send operations - * note, this is done with the lock held */ - DO_DISTRIBUTION(target, - HTC_CREDIT_DIST_SEND_COMPLETE, - "Send Complete", - target->EpCreditDistributionListHead->pNext); - } - - UNLOCK_HTC_TX(target); - - if (totalCredits) { - HTCCheckEndpointTxQueues(target); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-HTCProcessCreditRpt \n")); -} - -/* flush endpoint TX queue */ -static void HTCFlushEndpointTX(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint, HTC_TX_TAG Tag) -{ - HTC_PACKET *pPacket; - HTC_PACKET_QUEUE discardQueue = { {0} }; - HTC_PACKET_QUEUE container = { {0} }; - - /* initialize the discard queue */ - INIT_HTC_PACKET_QUEUE(&discardQueue); - - LOCK_HTC_TX(target); - - /* interate from the front of the TX queue and flush out packets */ - ITERATE_OVER_LIST_ALLOW_REMOVE(&pEndpoint->TxQueue.QueueHead, pPacket, HTC_PACKET, ListLink) { - - /* check for removal */ - if ((HTC_TX_PACKET_TAG_ALL == Tag) || (Tag == pPacket->PktInfo.AsTx.Tag)) { - /* remove from queue */ - HTC_PACKET_REMOVE(&pEndpoint->TxQueue, pPacket); - /* add it to the discard pile */ - HTC_PACKET_ENQUEUE(&discardQueue, pPacket); - } - - } ITERATE_END; - - UNLOCK_HTC_TX(target); - - /* empty the discard queue */ - while (1) { - pPacket = HTC_PACKET_DEQUEUE(&discardQueue); - if (NULL == pPacket) { - break; - } - pPacket->Status = A_ECANCELED; - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, (" Flushing TX packet:0x%lX, length:%d, ep:%d tag:0x%X \n", - (unsigned long)pPacket, pPacket->ActualLength, pPacket->Endpoint, pPacket->PktInfo.AsTx.Tag)); - INIT_HTC_PACKET_QUEUE_AND_ADD(&container,pPacket); - DO_EP_TX_COMPLETION(pEndpoint,&container); - } - -} - -void DumpCreditDist(HTC_ENDPOINT_CREDIT_DIST *pEPDist) -{ - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, ("--- EP : %d ServiceID: 0x%X --------------\n", - pEPDist->Endpoint, pEPDist->ServiceID)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" this:0x%lX next:0x%lX prev:0x%lX\n", - (unsigned long)pEPDist, (unsigned long)pEPDist->pNext, (unsigned long)pEPDist->pPrev)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" DistFlags : 0x%X \n", pEPDist->DistFlags)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsNorm : %d \n", pEPDist->TxCreditsNorm)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsMin : %d \n", pEPDist->TxCreditsMin)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCredits : %d \n", pEPDist->TxCredits)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsAssigned : %d \n", pEPDist->TxCreditsAssigned)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsSeek : %d \n", pEPDist->TxCreditsSeek)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditSize : %d \n", pEPDist->TxCreditSize)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsPerMaxMsg : %d \n", pEPDist->TxCreditsPerMaxMsg)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsToDist : %d \n", pEPDist->TxCreditsToDist)); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxQueueDepth : %d \n", - HTC_PACKET_QUEUE_DEPTH(&((HTC_ENDPOINT *)pEPDist->pHTCReserved)->TxQueue))); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, ("----------------------------------------------------\n")); -} - -void DumpCreditDistStates(HTC_TARGET *target) -{ - HTC_ENDPOINT_CREDIT_DIST *pEPList = target->EpCreditDistributionListHead; - - while (pEPList != NULL) { - DumpCreditDist(pEPList); - pEPList = pEPList->pNext; - } - - if (target->DistributeCredits != NULL) { - DO_DISTRIBUTION(target, - HTC_DUMP_CREDIT_STATE, - "Dump State", - NULL); - } -} - -/* flush all send packets from all endpoint queues */ -void HTCFlushSendPkts(HTC_TARGET *target) -{ - HTC_ENDPOINT *pEndpoint; - int i; - - if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_TRC)) { - DumpCreditDistStates(target); - } - - for (i = ENDPOINT_0; i < ENDPOINT_MAX; i++) { - pEndpoint = &target->EndPoint[i]; - if (pEndpoint->ServiceID == 0) { - /* not in use.. */ - continue; - } - HTCFlushEndpointTX(target,pEndpoint,HTC_TX_PACKET_TAG_ALL); - } - - -} - -/* HTC API to flush an endpoint's TX queue*/ -void HTCFlushEndpoint(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint, HTC_TX_TAG Tag) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - HTC_ENDPOINT *pEndpoint = &target->EndPoint[Endpoint]; - - if (pEndpoint->ServiceID == 0) { - AR_DEBUG_ASSERT(FALSE); - /* not in use.. */ - return; - } - - HTCFlushEndpointTX(target, pEndpoint, Tag); -} - -/* HTC API to indicate activity to the credit distribution function */ -void HTCIndicateActivityChange(HTC_HANDLE HTCHandle, - HTC_ENDPOINT_ID Endpoint, - A_BOOL Active) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - HTC_ENDPOINT *pEndpoint = &target->EndPoint[Endpoint]; - A_BOOL doDist = FALSE; - - if (pEndpoint->ServiceID == 0) { - AR_DEBUG_ASSERT(FALSE); - /* not in use.. */ - return; - } - - LOCK_HTC_TX(target); - - if (Active) { - if (!(pEndpoint->CreditDist.DistFlags & HTC_EP_ACTIVE)) { - /* mark active now */ - pEndpoint->CreditDist.DistFlags |= HTC_EP_ACTIVE; - doDist = TRUE; - } - } else { - if (pEndpoint->CreditDist.DistFlags & HTC_EP_ACTIVE) { - /* mark inactive now */ - pEndpoint->CreditDist.DistFlags &= ~HTC_EP_ACTIVE; - doDist = TRUE; - } - } - - if (doDist) { - /* indicate current Tx Queue depth to the credit distribution function */ - pEndpoint->CreditDist.TxQueueDepth = HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue); - /* do distribution again based on activity change - * note, this is done with the lock held */ - DO_DISTRIBUTION(target, - HTC_CREDIT_DIST_ACTIVITY_CHANGE, - "Activity Change", - target->EpCreditDistributionListHead->pNext); - } - - UNLOCK_HTC_TX(target); - - if (doDist && !Active) { - /* if a stream went inactive and this resulted in a credit distribution change, - * some credits may now be available for HTC packets that are stuck in - * HTC queues */ - HTCCheckEndpointTxQueues(target); - } -} - -A_BOOL HTCIsEndpointActive(HTC_HANDLE HTCHandle, - HTC_ENDPOINT_ID Endpoint) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - HTC_ENDPOINT *pEndpoint = &target->EndPoint[Endpoint]; - - if (pEndpoint->ServiceID == 0) { - return FALSE; - } - - if (pEndpoint->CreditDist.DistFlags & HTC_EP_ACTIVE) { - return TRUE; - } - - return FALSE; -} diff --git a/drivers/net/wireless/ar6003/host/htc2/htc_services.c b/drivers/net/wireless/ar6003/host/htc2/htc_services.c deleted file mode 100644 index 3488208cd4cf..000000000000 --- a/drivers/net/wireless/ar6003/host/htc2/htc_services.c +++ /dev/null @@ -1,449 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#include "htc_internal.h" - -void HTCControlTxComplete(void *Context, HTC_PACKET *pPacket) -{ - /* not implemented - * we do not send control TX frames during normal runtime, only during setup */ - AR_DEBUG_ASSERT(FALSE); -} - - /* callback when a control message arrives on this endpoint */ -void HTCControlRecv(void *Context, HTC_PACKET *pPacket) -{ - AR_DEBUG_ASSERT(pPacket->Endpoint == ENDPOINT_0); - - if (pPacket->Status == A_ECANCELED) { - /* this is a flush operation, return the control packet back to the pool */ - HTC_FREE_CONTROL_RX((HTC_TARGET*)Context,pPacket); - return; - } - - /* the only control messages we are expecting are NULL messages (credit resports) */ - if (pPacket->ActualLength > 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("HTCControlRecv, got message with length:%d \n", - pPacket->ActualLength + (A_UINT32)HTC_HDR_LENGTH)); - - /* dump header and message */ - DebugDumpBytes(pPacket->pBuffer - HTC_HDR_LENGTH, - pPacket->ActualLength + HTC_HDR_LENGTH, - "Unexpected ENDPOINT 0 Message"); - } - - HTC_RECYCLE_RX_PKT((HTC_TARGET*)Context,pPacket,&((HTC_TARGET*)Context)->EndPoint[0]); -} - -A_STATUS HTCSendSetupComplete(HTC_TARGET *target) -{ - HTC_PACKET *pSendPacket = NULL; - A_STATUS status; - - do { - /* allocate a packet to send to the target */ - pSendPacket = HTC_ALLOC_CONTROL_TX(target); - - if (NULL == pSendPacket) { - status = A_NO_MEMORY; - break; - } - - if (target->HTCTargetVersion >= HTC_VERSION_2P1) { - HTC_SETUP_COMPLETE_EX_MSG *pSetupCompleteEx; - A_UINT32 setupFlags = 0; - - pSetupCompleteEx = (HTC_SETUP_COMPLETE_EX_MSG *)pSendPacket->pBuffer; - A_MEMZERO(pSetupCompleteEx, sizeof(HTC_SETUP_COMPLETE_EX_MSG)); - pSetupCompleteEx->MessageID = HTC_MSG_SETUP_COMPLETE_EX_ID; - if (target->MaxMsgPerBundle > 0) { - /* host can do HTC bundling, indicate this to the target */ - setupFlags |= HTC_SETUP_COMPLETE_FLAGS_ENABLE_BUNDLE_RECV; - pSetupCompleteEx->MaxMsgsPerBundledRecv = target->MaxMsgPerBundle; - } - A_MEMCPY(&pSetupCompleteEx->SetupFlags, &setupFlags, sizeof(pSetupCompleteEx->SetupFlags)); - SET_HTC_PACKET_INFO_TX(pSendPacket, - NULL, - (A_UINT8 *)pSetupCompleteEx, - sizeof(HTC_SETUP_COMPLETE_EX_MSG), - ENDPOINT_0, - HTC_SERVICE_TX_PACKET_TAG); - - } else { - HTC_SETUP_COMPLETE_MSG *pSetupComplete; - /* assemble setup complete message */ - pSetupComplete = (HTC_SETUP_COMPLETE_MSG *)pSendPacket->pBuffer; - A_MEMZERO(pSetupComplete, sizeof(HTC_SETUP_COMPLETE_MSG)); - pSetupComplete->MessageID = HTC_MSG_SETUP_COMPLETE_ID; - SET_HTC_PACKET_INFO_TX(pSendPacket, - NULL, - (A_UINT8 *)pSetupComplete, - sizeof(HTC_SETUP_COMPLETE_MSG), - ENDPOINT_0, - HTC_SERVICE_TX_PACKET_TAG); - } - - /* we want synchronous operation */ - pSendPacket->Completion = NULL; - HTC_PREPARE_SEND_PKT(pSendPacket,0,0,0); - /* send the message */ - status = HTCIssueSend(target,pSendPacket); - - } while (FALSE); - - if (pSendPacket != NULL) { - HTC_FREE_CONTROL_TX(target,pSendPacket); - } - - return status; -} - - -A_STATUS HTCConnectService(HTC_HANDLE HTCHandle, - HTC_SERVICE_CONNECT_REQ *pConnectReq, - HTC_SERVICE_CONNECT_RESP *pConnectResp) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - A_STATUS status = A_OK; - HTC_PACKET *pRecvPacket = NULL; - HTC_PACKET *pSendPacket = NULL; - HTC_CONNECT_SERVICE_RESPONSE_MSG *pResponseMsg; - HTC_CONNECT_SERVICE_MSG *pConnectMsg; - HTC_ENDPOINT_ID assignedEndpoint = ENDPOINT_MAX; - HTC_ENDPOINT *pEndpoint; - unsigned int maxMsgSize = 0; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("+HTCConnectService, target:0x%lX SvcID:0x%X \n", - (unsigned long)target, pConnectReq->ServiceID)); - - do { - - AR_DEBUG_ASSERT(pConnectReq->ServiceID != 0); - - if (HTC_CTRL_RSVD_SVC == pConnectReq->ServiceID) { - /* special case for pseudo control service */ - assignedEndpoint = ENDPOINT_0; - maxMsgSize = HTC_MAX_CONTROL_MESSAGE_LENGTH; - } else { - /* allocate a packet to send to the target */ - pSendPacket = HTC_ALLOC_CONTROL_TX(target); - - if (NULL == pSendPacket) { - AR_DEBUG_ASSERT(FALSE); - status = A_NO_MEMORY; - break; - } - /* assemble connect service message */ - pConnectMsg = (HTC_CONNECT_SERVICE_MSG *)pSendPacket->pBuffer; - AR_DEBUG_ASSERT(pConnectMsg != NULL); - A_MEMZERO(pConnectMsg,sizeof(HTC_CONNECT_SERVICE_MSG)); - pConnectMsg->MessageID = HTC_MSG_CONNECT_SERVICE_ID; - pConnectMsg->ServiceID = pConnectReq->ServiceID; - pConnectMsg->ConnectionFlags = pConnectReq->ConnectionFlags; - /* check caller if it wants to transfer meta data */ - if ((pConnectReq->pMetaData != NULL) && - (pConnectReq->MetaDataLength <= HTC_SERVICE_META_DATA_MAX_LENGTH)) { - /* copy meta data into message buffer (after header ) */ - A_MEMCPY((A_UINT8 *)pConnectMsg + sizeof(HTC_CONNECT_SERVICE_MSG), - pConnectReq->pMetaData, - pConnectReq->MetaDataLength); - pConnectMsg->ServiceMetaLength = pConnectReq->MetaDataLength; - } - - SET_HTC_PACKET_INFO_TX(pSendPacket, - NULL, - (A_UINT8 *)pConnectMsg, - sizeof(HTC_CONNECT_SERVICE_MSG) + pConnectMsg->ServiceMetaLength, - ENDPOINT_0, - HTC_SERVICE_TX_PACKET_TAG); - - /* we want synchronous operation */ - pSendPacket->Completion = NULL; - HTC_PREPARE_SEND_PKT(pSendPacket,0,0,0); - status = HTCIssueSend(target,pSendPacket); - - if (A_FAILED(status)) { - break; - } - - /* wait for response */ - status = HTCWaitforControlMessage(target, &pRecvPacket); - - if (A_FAILED(status)) { - break; - } - /* we controlled the buffer creation so it has to be properly aligned */ - pResponseMsg = (HTC_CONNECT_SERVICE_RESPONSE_MSG *)pRecvPacket->pBuffer; - - if ((pResponseMsg->MessageID != HTC_MSG_CONNECT_SERVICE_RESPONSE_ID) || - (pRecvPacket->ActualLength < sizeof(HTC_CONNECT_SERVICE_RESPONSE_MSG))) { - /* this message is not valid */ - AR_DEBUG_ASSERT(FALSE); - status = A_EPROTO; - break; - } - - pConnectResp->ConnectRespCode = pResponseMsg->Status; - /* check response status */ - if (pResponseMsg->Status != HTC_SERVICE_SUCCESS) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - (" Target failed service 0x%X connect request (status:%d)\n", - pResponseMsg->ServiceID, pResponseMsg->Status)); - status = A_EPROTO; - break; - } - - assignedEndpoint = (HTC_ENDPOINT_ID) pResponseMsg->EndpointID; - maxMsgSize = pResponseMsg->MaxMsgSize; - - if ((pConnectResp->pMetaData != NULL) && - (pResponseMsg->ServiceMetaLength > 0) && - (pResponseMsg->ServiceMetaLength <= HTC_SERVICE_META_DATA_MAX_LENGTH)) { - /* caller supplied a buffer and the target responded with data */ - int copyLength = min((int)pConnectResp->BufferLength, (int)pResponseMsg->ServiceMetaLength); - /* copy the meta data */ - A_MEMCPY(pConnectResp->pMetaData, - ((A_UINT8 *)pResponseMsg) + sizeof(HTC_CONNECT_SERVICE_RESPONSE_MSG), - copyLength); - pConnectResp->ActualLength = copyLength; - } - - } - - /* the rest of these are parameter checks so set the error status */ - status = A_EPROTO; - - if (assignedEndpoint >= ENDPOINT_MAX) { - AR_DEBUG_ASSERT(FALSE); - break; - } - - if (0 == maxMsgSize) { - AR_DEBUG_ASSERT(FALSE); - break; - } - - pEndpoint = &target->EndPoint[assignedEndpoint]; - pEndpoint->Id = assignedEndpoint; - if (pEndpoint->ServiceID != 0) { - /* endpoint already in use! */ - AR_DEBUG_ASSERT(FALSE); - break; - } - - /* return assigned endpoint to caller */ - pConnectResp->Endpoint = assignedEndpoint; - pConnectResp->MaxMsgLength = maxMsgSize; - - /* setup the endpoint */ - pEndpoint->ServiceID = pConnectReq->ServiceID; /* this marks the endpoint in use */ - pEndpoint->MaxTxQueueDepth = pConnectReq->MaxSendQueueDepth; - pEndpoint->MaxMsgLength = maxMsgSize; - /* copy all the callbacks */ - pEndpoint->EpCallBacks = pConnectReq->EpCallbacks; - /* set the credit distribution info for this endpoint, this information is - * passed back to the credit distribution callback function */ - pEndpoint->CreditDist.ServiceID = pConnectReq->ServiceID; - pEndpoint->CreditDist.pHTCReserved = pEndpoint; - pEndpoint->CreditDist.Endpoint = assignedEndpoint; - pEndpoint->CreditDist.TxCreditSize = target->TargetCreditSize; - - if (pConnectReq->MaxSendMsgSize != 0) { - /* override TxCreditsPerMaxMsg calculation, this optimizes the credit-low indications - * since the host will actually issue smaller messages in the Send path */ - if (pConnectReq->MaxSendMsgSize > maxMsgSize) { - /* can't be larger than the maximum the target can support */ - AR_DEBUG_ASSERT(FALSE); - break; - } - pEndpoint->CreditDist.TxCreditsPerMaxMsg = pConnectReq->MaxSendMsgSize / target->TargetCreditSize; - } else { - pEndpoint->CreditDist.TxCreditsPerMaxMsg = maxMsgSize / target->TargetCreditSize; - } - - if (0 == pEndpoint->CreditDist.TxCreditsPerMaxMsg) { - pEndpoint->CreditDist.TxCreditsPerMaxMsg = 1; - } - - /* save local connection flags */ - pEndpoint->LocalConnectionFlags = pConnectReq->LocalConnectionFlags; - - status = A_OK; - - } while (FALSE); - - if (pSendPacket != NULL) { - HTC_FREE_CONTROL_TX(target,pSendPacket); - } - - if (pRecvPacket != NULL) { - HTC_FREE_CONTROL_RX(target,pRecvPacket); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-HTCConnectService \n")); - - return status; -} - -static void AddToEndpointDistList(HTC_TARGET *target, HTC_ENDPOINT_CREDIT_DIST *pEpDist) -{ - HTC_ENDPOINT_CREDIT_DIST *pCurEntry = NULL; - HTC_ENDPOINT_CREDIT_DIST *pLastEntry = NULL; - - if (NULL == target->EpCreditDistributionListHead) { - target->EpCreditDistributionListHead = pEpDist; - pEpDist->pNext = NULL; - pEpDist->pPrev = NULL; - return; - } - - /* queue to the end of the list, this does not have to be very - * fast since this list is built at startup time */ - pCurEntry = target->EpCreditDistributionListHead; - - while (pCurEntry) { - pLastEntry = pCurEntry; - pCurEntry = pCurEntry->pNext; - } - - pLastEntry->pNext = pEpDist; - pEpDist->pPrev = pLastEntry; - pEpDist->pNext = NULL; -} - - - -/* default credit init callback */ -static void HTCDefaultCreditInit(void *Context, - HTC_ENDPOINT_CREDIT_DIST *pEPList, - int TotalCredits) -{ - HTC_ENDPOINT_CREDIT_DIST *pCurEpDist; - int totalEps = 0; - int creditsPerEndpoint; - - pCurEpDist = pEPList; - /* first run through the list and figure out how many endpoints we are dealing with */ - while (pCurEpDist != NULL) { - pCurEpDist = pCurEpDist->pNext; - totalEps++; - } - - /* even distribution */ - creditsPerEndpoint = TotalCredits/totalEps; - - pCurEpDist = pEPList; - /* run through the list and set minimum and normal credits and - * provide the endpoint with some credits to start */ - while (pCurEpDist != NULL) { - - if (creditsPerEndpoint < pCurEpDist->TxCreditsPerMaxMsg) { - /* too many endpoints and not enough credits */ - AR_DEBUG_ASSERT(FALSE); - break; - } - /* our minimum is set for at least 1 max message */ - pCurEpDist->TxCreditsMin = pCurEpDist->TxCreditsPerMaxMsg; - /* this value is ignored by our credit alg, since we do - * not dynamically adjust credits, this is the policy of - * the "default" credit distribution, something simple and easy */ - pCurEpDist->TxCreditsNorm = 0xFFFF; - /* give the endpoint minimum credits */ - pCurEpDist->TxCredits = creditsPerEndpoint; - pCurEpDist->TxCreditsAssigned = creditsPerEndpoint; - pCurEpDist = pCurEpDist->pNext; - } - -} - -/* default credit distribution callback, NOTE, this callback holds the TX lock */ -void HTCDefaultCreditDist(void *Context, - HTC_ENDPOINT_CREDIT_DIST *pEPDistList, - HTC_CREDIT_DIST_REASON Reason) -{ - HTC_ENDPOINT_CREDIT_DIST *pCurEpDist; - - if (Reason == HTC_CREDIT_DIST_SEND_COMPLETE) { - pCurEpDist = pEPDistList; - /* simple distribution */ - while (pCurEpDist != NULL) { - if (pCurEpDist->TxCreditsToDist > 0) { - /* just give the endpoint back the credits */ - pCurEpDist->TxCredits += pCurEpDist->TxCreditsToDist; - pCurEpDist->TxCreditsToDist = 0; - } - pCurEpDist = pCurEpDist->pNext; - } - } - - /* note we do not need to handle the other reason codes as this is a very - * simple distribution scheme, no need to seek for more credits or handle inactivity */ -} - -void HTCSetCreditDistribution(HTC_HANDLE HTCHandle, - void *pCreditDistContext, - HTC_CREDIT_DIST_CALLBACK CreditDistFunc, - HTC_CREDIT_INIT_CALLBACK CreditInitFunc, - HTC_SERVICE_ID ServicePriorityOrder[], - int ListLength) -{ - HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); - int i; - int ep; - - if (CreditInitFunc != NULL) { - /* caller has supplied their own distribution functions */ - target->InitCredits = CreditInitFunc; - AR_DEBUG_ASSERT(CreditDistFunc != NULL); - target->DistributeCredits = CreditDistFunc; - target->pCredDistContext = pCreditDistContext; - } else { - /* caller wants HTC to do distribution */ - /* if caller wants service to handle distributions then - * it must set both of these to NULL! */ - AR_DEBUG_ASSERT(CreditDistFunc == NULL); - target->InitCredits = HTCDefaultCreditInit; - target->DistributeCredits = HTCDefaultCreditDist; - target->pCredDistContext = target; - } - - /* always add HTC control endpoint first, we only expose the list after the - * first one, this is added for TX queue checking */ - AddToEndpointDistList(target, &target->EndPoint[ENDPOINT_0].CreditDist); - - /* build the list of credit distribution structures in priority order - * supplied by the caller, these will follow endpoint 0 */ - for (i = 0; i < ListLength; i++) { - /* match services with endpoints and add the endpoints to the distribution list - * in FIFO order */ - for (ep = ENDPOINT_1; ep < ENDPOINT_MAX; ep++) { - if (target->EndPoint[ep].ServiceID == ServicePriorityOrder[i]) { - /* queue this one to the list */ - AddToEndpointDistList(target, &target->EndPoint[ep].CreditDist); - break; - } - } - AR_DEBUG_ASSERT(ep < ENDPOINT_MAX); - } - -} diff --git a/drivers/net/wireless/ar6003/host/include/a_config.h b/drivers/net/wireless/ar6003/host/include/a_config.h deleted file mode 100644 index 5f789917b39b..000000000000 --- a/drivers/net/wireless/ar6003/host/include/a_config.h +++ /dev/null @@ -1,57 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file contains software configuration options that enables -// specific software "features" -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _A_CONFIG_H_ -#define _A_CONFIG_H_ - -#ifdef ATHR_WM_NWF -#include "../os/windows/include/config.h" -#endif - -#ifdef ATHR_CE_LEGACY -#include "../os/windows/include/config.h" -#endif - -#if defined(__linux__) && !defined(LINUX_EMULATION) -#include "../os/linux/include/config_linux.h" -#endif - -#ifdef REXOS -#include "../os/rexos/include/common/config_rexos.h" -#endif - -#ifdef ATHR_WIN_NWF -#include "../os/windows/include/config.h" -#pragma warning( disable:4242) -#pragma warning( disable:4100) -#pragma warning( disable:4189) -#pragma warning( disable:4244) -#pragma warning( disable:4701) -#pragma warning( disable:4389) -#pragma warning( disable:4057) -#pragma warning( disable:28193) -#endif - -#endif diff --git a/drivers/net/wireless/ar6003/host/include/a_debug.h b/drivers/net/wireless/ar6003/host/include/a_debug.h deleted file mode 100644 index bde27e6bea3e..000000000000 --- a/drivers/net/wireless/ar6003/host/include/a_debug.h +++ /dev/null @@ -1,219 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#ifndef _A_DEBUG_H_ -#define _A_DEBUG_H_ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include -#include - - /* standard debug print masks bits 0..7 */ -#define ATH_DEBUG_ERR (1 << 0) /* errors */ -#define ATH_DEBUG_WARN (1 << 1) /* warnings */ -#define ATH_DEBUG_INFO (1 << 2) /* informational (module startup info) */ -#define ATH_DEBUG_TRC (1 << 3) /* generic function call tracing */ -#define ATH_DEBUG_RSVD1 (1 << 4) -#define ATH_DEBUG_RSVD2 (1 << 5) -#define ATH_DEBUG_RSVD3 (1 << 6) -#define ATH_DEBUG_RSVD4 (1 << 7) - -#define ATH_DEBUG_MASK_DEFAULTS (ATH_DEBUG_ERR | ATH_DEBUG_WARN) -#define ATH_DEBUG_ANY 0xFFFF - - /* other aliases used throughout */ -#define ATH_DEBUG_ERROR ATH_DEBUG_ERR -#define ATH_LOG_ERR ATH_DEBUG_ERR -#define ATH_LOG_INF ATH_DEBUG_INFO -#define ATH_LOG_TRC ATH_DEBUG_TRC -#define ATH_DEBUG_TRACE ATH_DEBUG_TRC -#define ATH_DEBUG_INIT ATH_DEBUG_INFO - - /* bits 8..31 are module-specific masks */ -#define ATH_DEBUG_MODULE_MASK_SHIFT 8 - - /* macro to make a module-specific masks */ -#define ATH_DEBUG_MAKE_MODULE_MASK(index) (1 << (ATH_DEBUG_MODULE_MASK_SHIFT + (index))) - -void DebugDumpBytes(A_UCHAR *buffer, A_UINT16 length, char *pDescription); - -/* Debug support on a per-module basis - * - * Usage: - * - * Each module can utilize it's own debug mask variable. A set of commonly used - * masks are provided (ERRORS, WARNINGS, TRACE etc..). It is up to each module - * to define module-specific masks using the macros above. - * - * Each module defines a single debug mask variable debug_XXX where the "name" of the module is - * common to all C-files within that module. This requires every C-file that includes a_debug.h - * to define the module name in that file. - * - * Example: - * - * #define ATH_MODULE_NAME htc - * #include "a_debug.h" - * - * This will define a debug mask structure called debug_htc and all debug macros will reference this - * variable. - * - * A module can define module-specific bit masks using the ATH_DEBUG_MAKE_MODULE_MASK() macro: - * - * #define ATH_DEBUG_MY_MASK1 ATH_DEBUG_MAKE_MODULE_MASK(0) - * #define ATH_DEBUG_MY_MASK2 ATH_DEBUG_MAKE_MODULE_MASK(1) - * - * The instantiation of the debug structure should be made by the module. When a module is - * instantiated, the module can set a description string, a default mask and an array of description - * entries containing information on each module-defined debug mask. - * NOTE: The instantiation is statically allocated, only one instance can exist per module. - * - * Example: - * - * - * #define ATH_DEBUG_BMI ATH_DEBUG_MAKE_MODULE_MASK(0) - * - * #ifdef DEBUG - * static ATH_DEBUG_MASK_DESCRIPTION bmi_debug_desc[] = { - * { ATH_DEBUG_BMI , "BMI Tracing"}, <== description of the module specific mask - * }; - * - * ATH_DEBUG_INSTANTIATE_MODULE_VAR(bmi, - * "bmi" <== module name - * "Boot Manager Interface", <== description of module - * ATH_DEBUG_MASK_DEFAULTS, <== defaults - * ATH_DEBUG_DESCRIPTION_COUNT(bmi_debug_desc), - * bmi_debug_desc); - * - * #endif - * - * A module can optionally register it's debug module information in order for other tools to change the - * bit mask at runtime. A module can call A_REGISTER_MODULE_DEBUG_INFO() in it's module - * init code. This macro can be called multiple times without consequence. The debug info maintains - * state to indicate whether the information was previously registered. - * - * */ - -#define ATH_DEBUG_MAX_MASK_DESC_LENGTH 32 -#define ATH_DEBUG_MAX_MOD_DESC_LENGTH 64 - -typedef struct { - A_UINT32 Mask; - A_CHAR Description[ATH_DEBUG_MAX_MASK_DESC_LENGTH]; -} ATH_DEBUG_MASK_DESCRIPTION; - -#define ATH_DEBUG_INFO_FLAGS_REGISTERED (1 << 0) - -typedef struct _ATH_DEBUG_MODULE_DBG_INFO{ - struct _ATH_DEBUG_MODULE_DBG_INFO *pNext; - A_CHAR ModuleName[16]; - A_CHAR ModuleDescription[ATH_DEBUG_MAX_MOD_DESC_LENGTH]; - A_UINT32 Flags; - A_UINT32 CurrentMask; - int MaxDescriptions; - ATH_DEBUG_MASK_DESCRIPTION *pMaskDescriptions; /* pointer to array of descriptions */ -} ATH_DEBUG_MODULE_DBG_INFO; - -#define ATH_DEBUG_DESCRIPTION_COUNT(d) (int)((sizeof((d))) / (sizeof(ATH_DEBUG_MASK_DESCRIPTION))) - -#define GET_ATH_MODULE_DEBUG_VAR_NAME(s) _XGET_ATH_MODULE_NAME_DEBUG_(s) -#define GET_ATH_MODULE_DEBUG_VAR_MASK(s) _XGET_ATH_MODULE_NAME_DEBUG_(s).CurrentMask -#define _XGET_ATH_MODULE_NAME_DEBUG_(s) debug_ ## s - -#ifdef DEBUG - - /* for source files that will instantiate the debug variables */ -#define ATH_DEBUG_INSTANTIATE_MODULE_VAR(s,name,moddesc,initmask,count,descriptions) \ -ATH_DEBUG_MODULE_DBG_INFO GET_ATH_MODULE_DEBUG_VAR_NAME(s) = \ - {NULL,(name),(moddesc),0,(initmask),count,(descriptions)} - -#ifdef ATH_MODULE_NAME -extern ATH_DEBUG_MODULE_DBG_INFO GET_ATH_MODULE_DEBUG_VAR_NAME(ATH_MODULE_NAME); -#define AR_DEBUG_LVL_CHECK(lvl) (GET_ATH_MODULE_DEBUG_VAR_MASK(ATH_MODULE_NAME) & (lvl)) -#endif /* ATH_MODULE_NAME */ - -#define ATH_DEBUG_SET_DEBUG_MASK(s,lvl) GET_ATH_MODULE_DEBUG_VAR_MASK(s) = (lvl) - -#define ATH_DEBUG_DECLARE_EXTERN(s) \ - extern ATH_DEBUG_MODULE_DBG_INFO GET_ATH_MODULE_DEBUG_VAR_NAME(s) - -#define AR_DEBUG_PRINTBUF(buffer, length, desc) DebugDumpBytes(buffer,length,desc) - - -#define AR_DEBUG_ASSERT A_ASSERT - -void a_dump_module_debug_info(ATH_DEBUG_MODULE_DBG_INFO *pInfo); -void a_register_module_debug_info(ATH_DEBUG_MODULE_DBG_INFO *pInfo); -#define A_DUMP_MODULE_DEBUG_INFO(s) a_dump_module_debug_info(&(GET_ATH_MODULE_DEBUG_VAR_NAME(s))) -#define A_REGISTER_MODULE_DEBUG_INFO(s) a_register_module_debug_info(&(GET_ATH_MODULE_DEBUG_VAR_NAME(s))) - -#else /* !DEBUG */ - /* NON DEBUG */ -#define ATH_DEBUG_INSTANTIATE_MODULE_VAR(s,name,moddesc,initmask,count,descriptions) -#define AR_DEBUG_LVL_CHECK(lvl) 0 -#define AR_DEBUG_PRINTBUF(buffer, length, desc) -#define AR_DEBUG_ASSERT(test) -#define ATH_DEBUG_DECLARE_EXTERN(s) -#define ATH_DEBUG_SET_DEBUG_MASK(s,lvl) -#define A_DUMP_MODULE_DEBUG_INFO(s) -#define A_REGISTER_MODULE_DEBUG_INFO(s) - -#endif - -A_STATUS a_get_module_mask(A_CHAR *module_name, A_UINT32 *pMask); -A_STATUS a_set_module_mask(A_CHAR *module_name, A_UINT32 Mask); -void a_dump_module_debug_info_by_name(A_CHAR *module_name); -void a_module_debug_support_init(void); -void a_module_debug_support_cleanup(void); - -#ifdef ATHR_WM_NWF -#include "../os/windows/include/debug.h" -#endif - -#ifdef ATHR_CE_LEGACY -#include "../os/windows/include/debug.h" -#endif - -#if defined(__linux__) && !defined(LINUX_EMULATION) -#include "../os/linux/include/debug_linux.h" -#endif - -#ifdef REXOS -#include "../os/rexos/include/common/debug_rexos.h" -#endif - -#if defined ART_WIN -#include "../os/win_art/include/debug_win.h" -#endif - -#ifdef ATHR_WIN_NWF -#include "../os/windows/include/win/debug_win.h" -#endif - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/drivers/net/wireless/ar6003/host/include/a_drv.h b/drivers/net/wireless/ar6003/host/include/a_drv.h deleted file mode 100644 index e86f2e584ff1..000000000000 --- a/drivers/net/wireless/ar6003/host/include/a_drv.h +++ /dev/null @@ -1,50 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file contains the definitions of the basic atheros data types. -// It is used to map the data types in atheros files to a platform specific -// type. -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _A_DRV_H_ -#define _A_DRV_H_ - -#if defined(__linux__) && !defined(LINUX_EMULATION) -#include "../os/linux/include/athdrv_linux.h" -#endif - -#ifdef ATHR_WM_NWF -#include "../os/windows/include/athdrv.h" -#endif - -#ifdef ATHR_CE_LEGACY -#include "../os/windows/include/athdrv.h" -#endif - -#ifdef REXOS -#include "../os/rexos/include/common/athdrv_rexos.h" -#endif - -#ifdef ATHR_WIN_NWF -#include "../os/windows/include/athdrv.h" -#endif - -#endif /* _ADRV_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/a_drv_api.h b/drivers/net/wireless/ar6003/host/include/a_drv_api.h deleted file mode 100644 index 71bc3fd20032..000000000000 --- a/drivers/net/wireless/ar6003/host/include/a_drv_api.h +++ /dev/null @@ -1,333 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#ifndef _A_DRV_API_H_ -#define _A_DRV_API_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/****************************************************************************/ -/****************************************************************************/ -/** **/ -/** WMI related hooks **/ -/** **/ -/****************************************************************************/ -/****************************************************************************/ - -#include - -#define A_WMI_CHANNELLIST_RX(devt, numChan, chanList) \ - ar6000_channelList_rx((devt), (numChan), (chanList)) - -#define A_WMI_SET_NUMDATAENDPTS(devt, num) \ - ar6000_set_numdataendpts((devt), (num)) - -#define A_WMI_CONTROL_TX(devt, osbuf, streamID) \ - ar6000_control_tx((devt), (osbuf), (streamID)) - -#define A_WMI_TARGETSTATS_EVENT(devt, pStats, len) \ - ar6000_targetStats_event((devt), (pStats), (len)) - -#define A_WMI_SCANCOMPLETE_EVENT(devt, status) \ - ar6000_scanComplete_event((devt), (status)) - -#ifdef CONFIG_HOST_DSET_SUPPORT - -#define A_WMI_DSET_DATA_REQ(devt, access_cookie, offset, length, targ_buf, targ_reply_fn, targ_reply_arg) \ - ar6000_dset_data_req((devt), (access_cookie), (offset), (length), (targ_buf), (targ_reply_fn), (targ_reply_arg)) - -#define A_WMI_DSET_CLOSE(devt, access_cookie) \ - ar6000_dset_close((devt), (access_cookie)) - -#endif - -#define A_WMI_DSET_OPEN_REQ(devt, id, targ_handle, targ_reply_fn, targ_reply_arg) \ - ar6000_dset_open_req((devt), (id), (targ_handle), (targ_reply_fn), (targ_reply_arg)) - -#define A_WMI_CONNECT_EVENT(devt, pEvt) \ - ar6000_connect_event((devt), (pEvt)) - -#define A_WMI_PSPOLL_EVENT(devt, aid)\ - ar6000_pspoll_event((devt),(aid)) - -#define A_WMI_DTIMEXPIRY_EVENT(devt)\ - ar6000_dtimexpiry_event((devt)) - -#ifdef WAPI_ENABLE -#define A_WMI_WAPI_REKEY_EVENT(devt, type, mac)\ - ap_wapi_rekey_event((devt),(type),(mac)) -#endif - -#ifdef P2P -#define A_WMI_P2PGONEG_EVENT(devt, res, len)\ - p2p_go_neg_event((devt),(res), (len)) - -#define A_WMI_P2PGONEG_REQ_EVENT(devt, sa, dev_passwd_id)\ - p2p_go_neg_req_event((devt), (sa), (dev_passwd_id)) - -#define A_WMI_P2P_INVITE_SENT_RESULT_EVENT(devt, res, len)\ - p2p_invite_sent_result_event((devt), (res), (len)) - -#define A_WMI_P2P_INVITE_RCVD_RESULT_EVENT(devt, res, len)\ - p2p_invite_rcvd_result_event((devt), (res), (len)) - -#define A_WMI_P2PDEV_EVENT(devt, addr, dev_addr, \ - pri_dev_type, dev_name, dev_name_len, config_methods,\ - dev_capab, grp_capab)\ - ar6000_p2pdev_event((devt), (addr), (dev_addr),\ - (pri_dev_type), (dev_name), (dev_name_len), (config_methods),\ - (dev_capab), (grp_capab)) - -#define A_WMI_P2P_PROV_DISC_REQ_EVENT(devt, peer, config_methods, dev_addr, \ - pri_dev_type, dev_name, dev_name_len, supp_config_methods,\ - dev_capab, group_capab) \ - ar6000_p2p_prov_disc_req_event((devt), (peer), (config_methods), \ - (dev_addr), (pri_dev_type), (dev_name), (dev_name_len),\ - (supp_config_methods), (dev_capab), (group_capab)) - -#define A_WMI_P2P_PROV_DISC_RESP_EVENT(devt, peer, config_methods) \ - ar6000_p2p_prov_disc_resp_event((devt), (peer), (config_methods)) - -#define A_WMI_GET_P2P_CTX(devt) \ - get_p2p_ctx((devt)) - -#define A_WMI_GET_WMI_CTX(devt) \ - get_wmi_ctx((devt)) - -#define A_WMI_GET_DEV_NETWORK_SUBTYPE(devt) \ - get_network_subtype((devt)) - -#define A_WMI_P2P_SD_RX_EVENT(devt, ev) \ - ar6000_p2p_sd_rx_event((devt), (ev)) -#endif /* P2P */ - -#ifdef CONFIG_WLAN_RFKILL -#define A_WMI_RFKILL_STATE_CHANGE_EVENT(devt,radiostate) \ - ar6000_rfkill_state_change_event((devt),(radiostate)) - -#define A_WMI_RFKILL_GET_MODE_CMD_EVENT(devt,datap,len) \ - ar6000_rfkill_get_mode_cmd_event_rx((devt),(datap)); - -#endif - -#define A_WMI_REGDOMAIN_EVENT(devt, regCode) \ - ar6000_regDomain_event((devt), (regCode)) - -#define A_WMI_NEIGHBORREPORT_EVENT(devt, numAps, info) \ - ar6000_neighborReport_event((devt), (numAps), (info)) - -#define A_WMI_DISCONNECT_EVENT(devt, reason, bssid, assocRespLen, assocInfo, protocolReasonStatus) \ - ar6000_disconnect_event((devt), (reason), (bssid), (assocRespLen), (assocInfo), (protocolReasonStatus)) - -#ifdef ATH_SUPPORT_DFS - -#define A_WMI_DFS_ATTACH_EVENT(devt, capinfo) \ - ar6000_dfs_attach_event((devt),(capinfo)) - -#define A_WMI_DFS_INIT_EVENT(devt, capinfo) \ - ar6000_dfs_init_event((devt),(capinfo)) - -#define A_WMI_DFS_PHYERR_EVENT(devt, info) \ - ar6000_dfs_phyerr_event((devt),(info)) - -#define A_WMI_DFS_RESET_DELAYLINES_EVENT(devt) \ - ar6000_dfs_reset_delaylines_event((devt)) - -#define A_WMI_DFS_RESET_RADARQ_EVENT(devt) \ - ar6000_dfs_reset_radarq_event((devt)) - -#define A_WMI_DFS_RESET_AR_EVENT(devt) \ - ar6000_dfs_reset_ar_event((devt)) - -#define A_WMI_DFS_RESET_ARQ_EVENT(devt) \ - ar6000_dfs_reset_arq_event((devt)) - -#define A_WMI_DFS_SET_DUR_MULTIPLIER_EVENT(devt, value) \ - ar6000_dfs_set_dur_multiplier_event((devt), (value)) - -#define A_WMI_DFS_SET_BANGRADAR_EVENT(devt, value) \ - ar6000_dfs_set_bangradar_event((devt), (value)) - -#define A_WMI_DFS_SET_DEBUGLEVEL_EVENT(devt, value) \ - ar6000_dfs_set_debuglevel_event((devt), (value)) - -#endif /* ATH_SUPPORT_DFS */ - -#define A_WMI_TKIP_MICERR_EVENT(devt, keyid, ismcast) \ - ar6000_tkip_micerr_event((devt), (keyid), (ismcast)) - -#define A_WMI_BITRATE_RX(devt, rateKbps) \ - ar6000_bitrate_rx((devt), (rateKbps)) - -#define A_WMI_TXPWR_RX(devt, txPwr) \ - ar6000_txPwr_rx((devt), (txPwr)) - -#define A_WMI_READY_EVENT(devt, datap, phyCap, sw_ver, abi_ver) \ - ar6000_ready_event((devt), (datap), (phyCap), (sw_ver), (abi_ver)) - -#define A_WMI_DBGLOG_INIT_DONE(devt) \ - ar6000_dbglog_init_done(devt); - -#define A_WMI_RSSI_THRESHOLD_EVENT(devt, newThreshold, rssi) \ - ar6000_rssiThreshold_event((devt), (newThreshold), (rssi)) - -#define A_WMI_REPORT_ERROR_EVENT(devt, errorVal) \ - ar6000_reportError_event((devt), (errorVal)) - -#define A_WMI_ROAM_TABLE_EVENT(devt, pTbl) \ - ar6000_roam_tbl_event((devt), (pTbl)) - -#define A_WMI_ROAM_DATA_EVENT(devt, p) \ - ar6000_roam_data_event((devt), (p)) - -#define A_WMI_WOW_LIST_EVENT(devt, num_filters, wow_filters) \ - ar6000_wow_list_event((devt), (num_filters), (wow_filters)) - -#define A_WMI_CAC_EVENT(devt, ac, cac_indication, statusCode, tspecSuggestion) \ - ar6000_cac_event((devt), (ac), (cac_indication), (statusCode), (tspecSuggestion)) - -#define A_WMI_CHANNEL_CHANGE_EVENT(devt, oldChannel, newChannel) \ - ar6000_channel_change_event((devt), (oldChannel), (newChannel)) - -#define A_WMI_PMKID_LIST_EVENT(devt, num_pmkid, pmkid_list, bssid_list) \ - ar6000_pmkid_list_event((devt), (num_pmkid), (pmkid_list), (bssid_list)) - -#define A_WMI_PEER_EVENT(devt, eventCode, bssid) \ - ar6000_peer_event ((devt), (eventCode), (bssid)) - -#define A_WMI_WACINFO_EVENT(devt, pStats, len) \ - ar6000_wacinfo_event((devt), (pStats), (len)) - -#ifdef CONFIG_HOST_GPIO_SUPPORT - -#define A_WMI_GPIO_INTR_RX(devt, intr_mask, input_values) \ - ar6000_gpio_intr_rx((devt), (intr_mask), (input_values)) - -#define A_WMI_GPIO_DATA_RX(devt, reg_id, value) \ - ar6000_gpio_data_rx((devt), (reg_id), (value)) - -#define A_WMI_GPIO_ACK_RX(devt) \ - ar6000_gpio_ack_rx((devt)) - -#endif - -#ifdef SEND_EVENT_TO_APP - -#define A_WMI_SEND_EVENT_TO_APP(ar, eventId, datap, len) \ - ar6000_send_event_to_app((ar), (eventId), (datap), (len)) - -#define A_WMI_SEND_GENERIC_EVENT_TO_APP(ar, eventId, datap, len) \ - ar6000_send_generic_event_to_app((ar), (eventId), (datap), (len)) - -#else - -#define A_WMI_SEND_EVENT_TO_APP(ar, eventId, datap, len) -#define A_WMI_SEND_GENERIC_EVENT_TO_APP(ar, eventId, datap, len) - -#endif - -#ifdef CONFIG_HOST_TCMD_SUPPORT -#define A_WMI_TCMD_RX_REPORT_EVENT(devt, results, len) \ - ar6000_tcmd_rx_report_event((devt), (results), (len)) -#endif - -#define A_WMI_HBCHALLENGERESP_EVENT(devt, cookie, source) \ - ar6000_hbChallengeResp_event((devt), (cookie), (source)) - -#define A_WMI_TX_RETRY_ERR_EVENT(devt) \ - ar6000_tx_retry_err_event((devt)) - -#define A_WMI_SNR_THRESHOLD_EVENT_RX(devt, newThreshold, snr) \ - ar6000_snrThresholdEvent_rx((devt), (newThreshold), (snr)) - -#define A_WMI_LQ_THRESHOLD_EVENT_RX(devt, range, lqVal) \ - ar6000_lqThresholdEvent_rx((devt), (range), (lqVal)) - -#define A_WMI_RATEMASK_RX(devt, ratemask) \ - ar6000_ratemask_rx((devt), (ratemask)) - -#define A_WMI_KEEPALIVE_RX(devt, configured) \ - ar6000_keepalive_rx((devt), (configured)) - -#define A_WMI_BSSINFO_EVENT_RX(ar, datp, len) \ - ar6000_bssInfo_event_rx((ar), (datap), (len)) - -#define A_WMI_DBGLOG_EVENT(ar, dropped, buffer, length) \ - ar6000_dbglog_event((ar), (dropped), (buffer), (length)); - -#define A_WMI_STREAM_TX_ACTIVE(devt,trafficClass) \ - ar6000_indicate_tx_activity((devt),(trafficClass), TRUE) - -#define A_WMI_STREAM_TX_INACTIVE(devt,trafficClass) \ - ar6000_indicate_tx_activity((devt),(trafficClass), FALSE) -#define A_WMI_Ac2EndpointID(devht, ac)\ - ar6000_ac2_endpoint_id((devht), (ac)) - -#define A_WMI_AGGR_RECV_ADDBA_REQ_EVT(devt, cmd)\ - ar6000_aggr_rcv_addba_req_evt((devt), (cmd)) -#define A_WMI_AGGR_RECV_ADDBA_RESP_EVT(devt, cmd)\ - ar6000_aggr_rcv_addba_resp_evt((devt), (cmd)) -#define A_WMI_AGGR_RECV_DELBA_REQ_EVT(devt, cmd)\ - ar6000_aggr_rcv_delba_req_evt((devt), (cmd)) -#define A_WMI_HCI_EVENT_EVT(devt, cmd)\ - ar6000_hci_event_rcv_evt((devt), (cmd)) - -#define A_WMI_Endpoint2Ac(devt, ep) \ - ar6000_endpoint_id2_ac((devt), (ep)) - -#define A_WMI_BTCOEX_CONFIG_EVENT(devt, evt, len)\ - ar6000_btcoex_config_event((devt), (evt), (len)) - -#define A_WMI_BTCOEX_STATS_EVENT(devt, datap, len)\ - ar6000_btcoex_stats_event((devt), (datap), (len)) - -#define A_WMI_PROBERESP_RECV_EVENT(devt, datap, len, bssid)\ - ar6000_indicate_proberesp((devt), (datap), (len), (bssid)) - -#define A_WMI_BEACON_RECV_EVENT(devt, datap, len, bssid)\ - ar6000_indicate_beacon((devt), (datap), (len), (bssid)) - -#define A_WMI_ASSOC_REQ_REPORT_EVENT(devt, status, rspType, datap, len)\ - ar6000_assoc_req_report_event((devt),(status),(rspType),(datap),(len)) - -#define A_WMI_GET_DEVICE_ADDR(devt, addr) \ - ar6000_get_device_addr((devt), (addr)) - -/****************************************************************************/ -/****************************************************************************/ -/** **/ -/** HTC related hooks **/ -/** **/ -/****************************************************************************/ -/****************************************************************************/ - -#if defined(CONFIG_TARGET_PROFILE_SUPPORT) -#define A_WMI_PROF_COUNT_RX(addr, count) prof_count_rx((addr), (count)) -#endif /* CONFIG_TARGET_PROFILE_SUPPORT */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/drivers/net/wireless/ar6003/host/include/a_osapi.h b/drivers/net/wireless/ar6003/host/include/a_osapi.h deleted file mode 100644 index 47b088a33c2d..000000000000 --- a/drivers/net/wireless/ar6003/host/include/a_osapi.h +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file contains the definitions of the basic atheros data types. -// It is used to map the data types in atheros files to a platform specific -// type. -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _A_OSAPI_H_ -#define _A_OSAPI_H_ - -#if defined(__linux__) && !defined(LINUX_EMULATION) -#include "../os/linux/include/osapi_linux.h" -#endif - -#ifdef ATHR_WM_NWF -#include "../os/windows/include/osapi.h" -#include "../os/windows/include/netbuf.h" -#endif - -#ifdef ATHR_CE_LEGACY -#include "../os/windows/include/osapi.h" -#include "../os/windows/include/netbuf.h" -#endif - -#ifdef REXOS -#include "../os/rexos/include/common/osapi_rexos.h" -#endif - -#if defined ART_WIN -#include "../os/win_art/include/osapi_win.h" -#include "../os/win_art/include/netbuf.h" -#endif - -#ifdef ATHR_WIN_NWF -#include "../os/windows/include/win/osapi_win.h" -#include "../os/windows/include/netbuf.h" -#endif - -#endif /* _OSAPI_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/a_types.h b/drivers/net/wireless/ar6003/host/include/a_types.h deleted file mode 100644 index d80a78264342..000000000000 --- a/drivers/net/wireless/ar6003/host/include/a_types.h +++ /dev/null @@ -1,54 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file contains the definitions of the basic atheros data types. -// It is used to map the data types in atheros files to a platform specific -// type. -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _A_TYPES_H_ -#define _A_TYPES_H_ - -#if defined(__linux__) && !defined(LINUX_EMULATION) -#include "../os/linux/include/athtypes_linux.h" -#endif - -#ifdef ATHR_WM_NWF -#include "../os/windows/include/athtypes.h" -#endif - -#ifdef ATHR_CE_LEGACY -#include "../os/windows/include/athtypes.h" -#endif - -#ifdef REXOS -#include "../os/rexos/include/common/athtypes_rexos.h" -#endif - -#if defined ART_WIN -#include "../os/win_art/include/athtypes_win.h" -#endif - -#ifdef ATHR_WIN_NWF -#include -#endif - -#endif /* _ATHTYPES_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/aggr_recv_api.h b/drivers/net/wireless/ar6003/host/include/aggr_recv_api.h deleted file mode 100644 index e61ec6767b18..000000000000 --- a/drivers/net/wireless/ar6003/host/include/aggr_recv_api.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * - * Copyright (c) 2004-2010 Atheros Communications Inc. - * All rights reserved. - * - * -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// - * - */ - -#ifndef __AGGR_RECV_API_H__ -#define __AGGR_RECV_API_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void (* RX_CALLBACK)(void * dev, void *osbuf); - -typedef void (* ALLOC_NETBUFS)(A_NETBUF_QUEUE_T *q, A_UINT16 num); - -/* - * aggr_init: - * Initialises the data structures, allocates data queues and - * os buffers. Netbuf allocator is the input param, used by the - * aggr module for allocation of NETBUFs from driver context. - * These NETBUFs are used for AMSDU processing. - * - * Also registers OS call back function to deliver the - * frames to OS. This is generally the topmost layer of - * the driver context, after which the frames go to - * IP stack via the call back function. - * This dispatcher is active only when aggregation is ON. - * Returns A_OK if init success, else returns A_ERROR - */ -A_UINT8 -aggr_init(ALLOC_NETBUFS netbuf_allocator, RX_CALLBACK fn); - -/* - * aggr_init_conn: - * Initialises the data structures, allocates data queues and - * os buffers. Returns the context for a single conn aggr. - * For each supported conn, this API should be called. - */ -void * -aggr_init_conn(void); - -/* - * aggr_process_bar: - * When target receives BAR, it communicates to host driver - * for modifying window parameters. Target indicates this via the - * event: WMI_ADDBA_REQ_EVENTID. Host will dequeue all frames - * up to the indicated sequence number. - */ -void -aggr_process_bar(void *cntxt, A_UINT8 tid, A_UINT16 seq_no); - - -/* - * aggr_recv_addba_req_evt: - * This event is to initiate/modify the receive side window. - * Target will send WMI_ADDBA_REQ_EVENTID event to host - to setup - * recv re-ordering queues. Target will negotiate ADDBA with peer, - * and indicate via this event after succesfully completing the - * negotiation. This happens in two situations: - * 1. Initial setup of aggregation - * 2. Renegotiation of current recv window. - * Window size for re-ordering is limited by target buffer - * space, which is reflected in win_sz. - * (Re)Start the periodic timer to deliver long standing frames, - * in hold_q to OS. - */ -void -aggr_recv_addba_req_evt(void * cntxt, A_UINT8 tid, A_UINT16 seq_no, A_UINT8 win_sz); - - -/* - * aggr_recv_delba_req_evt: - * Target indicates deletion of a BA window for a tid via the - * WMI_DELBA_EVENTID. Host would deliver all the frames in the - * hold_q, reset tid config and disable the periodic timer, if - * aggr is not enabled on any tid. - */ -void -aggr_recv_delba_req_evt(void * cntxt, A_UINT8 tid); - - - -/* - * aggr_process_recv_frm: - * Called only for data frames. When aggr is ON for a tid, the buffer - * is always consumed, and osbuf would be NULL. For a non-aggr case, - * osbuf is not modified. - * AMSDU frames are consumed and are later freed. They are sliced and - * diced to individual frames and dispatched to stack. - * After consuming a osbuf(when aggr is ON), a previously registered - * callback may be called to deliver frames in order. - */ -void -aggr_process_recv_frm(void *cntxt, A_UINT8 tid, A_UINT16 seq_no, A_BOOL is_amsdu, void **osbuf); - - -/* - * aggr_module_destroy: - * Frees up all the queues and frames in them. - */ -void -aggr_module_destroy(void); - -/* - * * aggr_module_destroy_timers: - * * Disarm the timers. - * */ -void -aggr_module_destroy_timers(void *cntxt); - -/* - * aggr_module_destroy_conn: - * Frees up all the queues and frames in them. Releases the cntxt to OS. - */ -void -aggr_module_destroy_conn(void *cntxt); - -/* - * Dumps the aggregation stats - */ -void -aggr_dump_stats(void *cntxt, PACKET_LOG **log_buf); - -/* - * aggr_reset_state -- Called when it is deemed necessary to clear the aggregate - * hold Q state. Examples include when a Connect event or disconnect event is - * received. - */ -void -aggr_reset_state(void *cntxt, void *dev); - - -#ifdef __cplusplus -} -#endif - -#endif /*__AGGR_RECV_API_H__ */ diff --git a/drivers/net/wireless/ar6003/host/include/ar3kconfig.h b/drivers/net/wireless/ar6003/host/include/ar3kconfig.h deleted file mode 100644 index 3a5584e4bf02..000000000000 --- a/drivers/net/wireless/ar6003/host/include/ar3kconfig.h +++ /dev/null @@ -1,65 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2009-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -/* AR3K module configuration APIs for HCI-bridge operation */ - -#ifndef AR3KCONFIG_H_ -#define AR3KCONFIG_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define AR3K_CONFIG_FLAG_FORCE_MINBOOT_EXIT (1 << 0) -#define AR3K_CONFIG_FLAG_SET_AR3K_BAUD (1 << 1) -#define AR3K_CONFIG_FLAG_AR3K_BAUD_CHANGE_DELAY (1 << 2) -#define AR3K_CONFIG_FLAG_SET_AR6K_SCALE_STEP (1 << 3) - - -typedef struct { - A_UINT32 Flags; /* config flags */ - void *pHCIDev; /* HCI bridge device */ - HCI_TRANSPORT_PROPERTIES *pHCIProps; /* HCI bridge props */ - HIF_DEVICE *pHIFDevice; /* HIF layer device */ - - A_UINT32 AR3KBaudRate; /* AR3K operational baud rate */ - A_UINT16 AR6KScale; /* AR6K UART scale value */ - A_UINT16 AR6KStep; /* AR6K UART step value */ - struct hci_dev *pBtStackHCIDev; /* BT Stack HCI dev */ - A_UINT32 PwrMgmtEnabled; /* TLPM enabled? */ - A_UINT32 IdleTimeout; /* TLPM idle timeout */ - A_UINT16 WakeupTimeout; /* TLPM wakeup timeout */ - A_UINT8 bdaddr[6]; /* Bluetooth device address */ -} AR3K_CONFIG_INFO; - -A_STATUS AR3KConfigure(AR3K_CONFIG_INFO *pConfigInfo); - -A_STATUS AR3KConfigureExit(void *config); - -#ifdef __cplusplus -} -#endif - -#endif /*AR3KCONFIG_H_*/ diff --git a/drivers/net/wireless/ar6003/host/include/ar6000_api.h b/drivers/net/wireless/ar6003/host/include/ar6000_api.h deleted file mode 100644 index 62f7766aedf3..000000000000 --- a/drivers/net/wireless/ar6003/host/include/ar6000_api.h +++ /dev/null @@ -1,54 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file contains the API to access the OS dependent atheros host driver -// by the WMI or WLAN generic modules. -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _AR6000_API_H_ -#define _AR6000_API_H_ - -#if defined(__linux__) && !defined(LINUX_EMULATION) -#include "../os/linux/include/ar6xapi_linux.h" -#endif - -#ifdef ATHR_WM_NWF -#include "../os/windows/include/ar6xapi.h" -#endif - -#ifdef ATHR_CE_LEGACY -#include "../os/windows/include/ar6xapi.h" -#endif - -#ifdef REXOS -#include "../os/rexos/include/common/ar6xapi_rexos.h" -#endif - -#if defined ART_WIN -#include "../os/win_art/include/ar6xapi_win.h" -#endif - -#ifdef ATHR_WIN_NWF -#include "../os/windows/include/ar6xapi.h" -#endif - -#endif /* _AR6000_API_H */ - diff --git a/drivers/net/wireless/ar6003/host/include/ar6000_diag.h b/drivers/net/wireless/ar6003/host/include/ar6000_diag.h deleted file mode 100644 index b53512e23d32..000000000000 --- a/drivers/net/wireless/ar6003/host/include/ar6000_diag.h +++ /dev/null @@ -1,48 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef AR6000_DIAG_H_ -#define AR6000_DIAG_H_ - - -A_STATUS -ar6000_ReadRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data); - -A_STATUS -ar6000_WriteRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data); - -A_STATUS -ar6000_ReadDataDiag(HIF_DEVICE *hifDevice, A_UINT32 address, - A_UCHAR *data, A_UINT32 length); - -A_STATUS -ar6000_WriteDataDiag(HIF_DEVICE *hifDevice, A_UINT32 address, - A_UCHAR *data, A_UINT32 length); - -A_STATUS -ar6k_ReadTargetRegister(HIF_DEVICE *hifDevice, int regsel, A_UINT32 *regval); - -void -ar6k_FetchTargetRegs(HIF_DEVICE *hifDevice, A_UINT32 *targregs); - -#endif /*AR6000_DIAG_H_*/ diff --git a/drivers/net/wireless/ar6003/host/include/ar6kap_common.h b/drivers/net/wireless/ar6003/host/include/ar6kap_common.h deleted file mode 100644 index 9ab85314741d..000000000000 --- a/drivers/net/wireless/ar6003/host/include/ar6kap_common.h +++ /dev/null @@ -1,46 +0,0 @@ -//------------------------------------------------------------------------------ - -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ - -//============================================================================== - -// This file contains the definitions of common AP mode data structures. -// -// Author(s): ="Atheros" -//============================================================================== - -#ifndef _AR6KAP_COMMON_H_ -#define _AR6KAP_COMMON_H_ -/* - * Used with AR6000_XIOCTL_AP_GET_STA_LIST - */ -typedef struct { - A_UINT8 mac[ATH_MAC_LEN]; - A_UINT8 aid; - A_UINT8 keymgmt; - A_UINT8 ucipher; - A_UINT8 auth; - A_UINT8 wmode; -} station_t; - -typedef struct { - station_t sta[AP_MAX_NUM_STA]; -} ap_get_sta_t; -#endif /* _AR6KAP_COMMON_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/athbtfilter.h b/drivers/net/wireless/ar6003/host/include/athbtfilter.h deleted file mode 100644 index b7ba661f03d6..000000000000 --- a/drivers/net/wireless/ar6003/host/include/athbtfilter.h +++ /dev/null @@ -1,135 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Public Bluetooth filter APIs -// Author(s): ="Atheros" -//============================================================================== -#ifndef ATHBTFILTER_H_ -#define ATHBTFILTER_H_ - -#define ATH_DEBUG_INFO (1 << 2) -#define ATH_DEBUG_INF ATH_DEBUG_INFO - -typedef enum _ATHBT_HCI_CTRL_TYPE { - ATHBT_HCI_COMMAND = 0, - ATHBT_HCI_EVENT = 1, -} ATHBT_HCI_CTRL_TYPE; - -typedef enum _ATHBT_STATE_INDICATION { - ATH_BT_NOOP = 0, - ATH_BT_INQUIRY = 1, - ATH_BT_CONNECT = 2, - ATH_BT_SCO = 3, - ATH_BT_ACL = 4, - ATH_BT_A2DP = 5, - ATH_BT_ESCO = 6, - /* new states go here.. */ - - ATH_BT_MAX_STATE_INDICATION -} ATHBT_STATE_INDICATION; - - /* filter function for OUTGOING commands and INCOMMING events */ -typedef void (*ATHBT_FILTER_CMD_EVENTS_FN)(void *pContext, ATHBT_HCI_CTRL_TYPE Type, unsigned char *pBuffer, int Length); - - /* filter function for OUTGOING data HCI packets */ -typedef void (*ATHBT_FILTER_DATA_FN)(void *pContext, unsigned char *pBuffer, int Length); - -typedef enum _ATHBT_STATE { - STATE_OFF = 0, - STATE_ON = 1, - STATE_MAX -} ATHBT_STATE; - - /* BT state indication (when filter functions are not used) */ - -typedef void (*ATHBT_INDICATE_STATE_FN)(void *pContext, ATHBT_STATE_INDICATION Indication, ATHBT_STATE State, unsigned char LMPVersion); - -typedef struct _ATHBT_FILTER_INSTANCE { -#ifdef UNDER_CE - WCHAR *pWlanAdapterName; /* filled in by user */ -#else - A_CHAR *pWlanAdapterName; /* filled in by user */ -#endif /* UNDER_CE */ - int FilterEnabled; /* filtering is enabled */ - int Attached; /* filter library is attached */ - void *pContext; /* private context for filter library */ - ATHBT_FILTER_CMD_EVENTS_FN pFilterCmdEvents; /* function ptr to filter a command or event */ - ATHBT_FILTER_DATA_FN pFilterAclDataOut; /* function ptr to filter ACL data out (to radio) */ - ATHBT_FILTER_DATA_FN pFilterAclDataIn; /* function ptr to filter ACL data in (from radio) */ - ATHBT_INDICATE_STATE_FN pIndicateState; /* function ptr to indicate a state */ -} ATH_BT_FILTER_INSTANCE; - - -/* API MACROS */ - -#define AthBtFilterHciCommand(instance,packet,length) \ - if ((instance)->FilterEnabled) { \ - (instance)->pFilterCmdEvents((instance)->pContext, \ - ATHBT_HCI_COMMAND, \ - (unsigned char *)(packet), \ - (length)); \ - } - -#define AthBtFilterHciEvent(instance,packet,length) \ - if ((instance)->FilterEnabled) { \ - (instance)->pFilterCmdEvents((instance)->pContext, \ - ATHBT_HCI_EVENT, \ - (unsigned char *)(packet), \ - (length)); \ - } - -#define AthBtFilterHciAclDataOut(instance,packet,length) \ - if ((instance)->FilterEnabled) { \ - (instance)->pFilterAclDataOut((instance)->pContext, \ - (unsigned char *)(packet), \ - (length)); \ - } - -#define AthBtFilterHciAclDataIn(instance,packet,length) \ - if ((instance)->FilterEnabled) { \ - (instance)->pFilterAclDataIn((instance)->pContext, \ - (unsigned char *)(packet), \ - (length)); \ - } - -/* if filtering is not desired, the application can indicate the state directly using this - * macro: - */ -#define AthBtIndicateState(instance,indication,state) \ - if ((instance)->FilterEnabled) { \ - (instance)->pIndicateState((instance)->pContext, \ - (indication), \ - (state), \ - 0); \ - } - -#ifdef __cplusplus -extern "C" { -#endif - -/* API prototypes */ -int AthBtFilter_Attach(ATH_BT_FILTER_INSTANCE *pInstance, A_UINT32 flags); -void AthBtFilter_Detach(ATH_BT_FILTER_INSTANCE *pInstance); - -#ifdef __cplusplus -} -#endif - -#endif /*ATHBTFILTER_H_*/ diff --git a/drivers/net/wireless/ar6003/host/include/athendpack.h b/drivers/net/wireless/ar6003/host/include/athendpack.h deleted file mode 100644 index 96445d790752..000000000000 --- a/drivers/net/wireless/ar6003/host/include/athendpack.h +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// end compiler-specific structure packing -// -// Author(s): ="Atheros" -//============================================================================== -#ifdef VXWORKS -#endif /* VXWORKS */ - -#if defined(LINUX) || defined(__linux__) -#endif /* LINUX */ - -#ifdef QNX -#endif /* QNX */ - -#ifdef INTEGRITY -#include "integrity/athendpack_integrity.h" -#endif /* INTEGRITY */ - -#ifdef NUCLEUS -#endif /* NUCLEUS */ - - -#ifdef ATHR_WM_NWF -#include "../os/windows/include/athendpack.h" -#endif - -#ifdef ATHR_CE_LEGACY -#include "../os/windows/include/athendpack.h" -#endif /* WINCE */ - -#ifdef ATHR_WIN_NWF -#include -#endif diff --git a/drivers/net/wireless/ar6003/host/include/athstartpack.h b/drivers/net/wireless/ar6003/host/include/athstartpack.h deleted file mode 100644 index c81435b2405c..000000000000 --- a/drivers/net/wireless/ar6003/host/include/athstartpack.h +++ /dev/null @@ -1,69 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// start compiler-specific structure packing -// -// Author(s): ="Atheros" -//============================================================================== -#ifdef VXWORKS -#endif /* VXWORKS */ - -#if defined(LINUX) || defined(__linux__) -#endif /* LINUX */ - -#ifdef QNX -#endif /* QNX */ - -#ifdef INTEGRITY -#include "integrity/athstartpack_integrity.h" -#endif /* INTEGRITY */ - -#ifdef NUCLEUS -#endif /* NUCLEUS */ - -#ifdef ATHR_WM_NWF -#include "../os/windows/include/athstartpack.h" -#define PREPACK -#endif - -#ifdef ATHR_CE_LEGACY -#include "../os/windows/include/athstartpack.h" -#endif /* WINCE */ - -#ifdef ATHR_WIN_NWF - -#ifndef PREPACK -#define PREPACK __declspec(align(1)) -#endif - -#include -#define __ATTRIB_PACK POSTPACK - -#endif - -#if __LONG_MAX__ == __INT_MAX__ -/* 32-bit compilation */ -#define PREPACK64 -#define POSTPACK64 -#else -/* 64-bit compilation */ -#define PREPACK64 PREPACK -#define POSTPACK64 POSTPACK -#endif diff --git a/drivers/net/wireless/ar6003/host/include/bmi.h b/drivers/net/wireless/ar6003/host/include/bmi.h deleted file mode 100644 index 960294e228a8..000000000000 --- a/drivers/net/wireless/ar6003/host/include/bmi.h +++ /dev/null @@ -1,140 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// BMI declarations and prototypes -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _BMI_H_ -#define _BMI_H_ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* Header files */ -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" -#include "hif.h" -#include "a_osapi.h" -#include "bmi_msg.h" - -void -BMIInit(void); - -void -BMICleanup(void); - -A_STATUS -BMIDone(HIF_DEVICE *device); - -A_STATUS -BMIGetTargetInfo(HIF_DEVICE *device, struct bmi_target_info *targ_info); - -A_STATUS -BMIReadMemory(HIF_DEVICE *device, - A_UINT32 address, - A_UCHAR *buffer, - A_UINT32 length); - -A_STATUS -BMIWriteMemory(HIF_DEVICE *device, - A_UINT32 address, - A_UCHAR *buffer, - A_UINT32 length); - -A_STATUS -BMIExecute(HIF_DEVICE *device, - A_UINT32 address, - A_UINT32 *param); - -A_STATUS -BMISetAppStart(HIF_DEVICE *device, - A_UINT32 address); - -A_STATUS -BMIReadSOCRegister(HIF_DEVICE *device, - A_UINT32 address, - A_UINT32 *param); - -A_STATUS -BMIWriteSOCRegister(HIF_DEVICE *device, - A_UINT32 address, - A_UINT32 param); - -A_STATUS -BMIrompatchInstall(HIF_DEVICE *device, - A_UINT32 ROM_addr, - A_UINT32 RAM_addr, - A_UINT32 nbytes, - A_UINT32 do_activate, - A_UINT32 *patch_id); - -A_STATUS -BMIrompatchUninstall(HIF_DEVICE *device, - A_UINT32 rompatch_id); - -A_STATUS -BMIrompatchActivate(HIF_DEVICE *device, - A_UINT32 rompatch_count, - A_UINT32 *rompatch_list); - -A_STATUS -BMIrompatchDeactivate(HIF_DEVICE *device, - A_UINT32 rompatch_count, - A_UINT32 *rompatch_list); - -A_STATUS -BMILZStreamStart(HIF_DEVICE *device, - A_UINT32 address); - -A_STATUS -BMILZData(HIF_DEVICE *device, - A_UCHAR *buffer, - A_UINT32 length); - -A_STATUS -BMIFastDownload(HIF_DEVICE *device, - A_UINT32 address, - A_UCHAR *buffer, - A_UINT32 length); - -A_STATUS -BMInvramProcess(HIF_DEVICE *device, - A_UCHAR *seg_name, - A_UINT32 *retval); - -A_STATUS -BMIRawWrite(HIF_DEVICE *device, - A_UCHAR *buffer, - A_UINT32 length); - -A_STATUS -BMIRawRead(HIF_DEVICE *device, - A_UCHAR *buffer, - A_UINT32 length, - A_BOOL want_timeout); - -#ifdef __cplusplus -} -#endif - -#endif /* _BMI_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/common_drv.h b/drivers/net/wireless/ar6003/host/include/common_drv.h deleted file mode 100644 index 43dc19954078..000000000000 --- a/drivers/net/wireless/ar6003/host/include/common_drv.h +++ /dev/null @@ -1,107 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#ifndef COMMON_DRV_H_ -#define COMMON_DRV_H_ - -#include "hif.h" -#include "htc_packet.h" -#include "htc_api.h" - -/* structure that is the state information for the default credit distribution callback - * drivers should instantiate (zero-init as well) this structure in their driver instance - * and pass it as a context to the HTC credit distribution functions */ -typedef struct _COMMON_CREDIT_STATE_INFO { - int TotalAvailableCredits; /* total credits in the system at startup */ - int CurrentFreeCredits; /* credits available in the pool that have not been - given out to endpoints */ - HTC_ENDPOINT_CREDIT_DIST *pLowestPriEpDist; /* pointer to the lowest priority endpoint dist struct */ -} COMMON_CREDIT_STATE_INFO; - -typedef struct { - A_INT32 (*setupTransport)(void *ar); - void (*cleanupTransport)(void *ar); -} HCI_TRANSPORT_CALLBACKS; - -typedef struct { - void *netDevice; - void *hifDevice; - void *htcHandle; -} HCI_TRANSPORT_MISC_HANDLES; - -/* HTC TX packet tagging definitions */ -#define AR6K_CONTROL_PKT_TAG HTC_TX_PACKET_TAG_USER_DEFINED -#define AR6K_DATA_PKT_TAG (AR6K_CONTROL_PKT_TAG + 1) - -#define AR6002_VERSION_REV2 0x20000188 -#define AR6003_VERSION_REV2 0x30000384 - -#define AR6002_CUST_DATA_SIZE 112 -#define AR6003_CUST_DATA_SIZE 16 -#define MCKINLEY_CUST_DATA_SIZE 16 - -#ifdef __cplusplus -extern "C" { -#endif - -/* OS-independent APIs */ -A_STATUS ar6000_setup_credit_dist(HTC_HANDLE HTCHandle, COMMON_CREDIT_STATE_INFO *pCredInfo); - -A_STATUS ar6000_ReadRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data); - -A_STATUS ar6000_WriteRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data); - -A_STATUS ar6000_ReadDataDiag(HIF_DEVICE *hifDevice, A_UINT32 address, A_UCHAR *data, A_UINT32 length); - -A_STATUS ar6000_reset_device(HIF_DEVICE *hifDevice, A_UINT32 TargetType, A_BOOL waitForCompletion, A_BOOL coldReset); - -void ar6000_dump_target_assert_info(HIF_DEVICE *hifDevice, A_UINT32 TargetType); - -A_STATUS ar6000_set_htc_params(HIF_DEVICE *hifDevice, - A_UINT32 TargetType, - A_UINT32 MboxIsrYieldValue, - A_UINT8 HtcControlBuffers); - -A_STATUS ar6000_prepare_target(HIF_DEVICE *hifDevice, - A_UINT32 TargetType, - A_UINT32 TargetVersion); - -A_STATUS ar6000_set_hci_bridge_flags(HIF_DEVICE *hifDevice, - A_UINT32 TargetType, - A_UINT32 Flags); - -void ar6000_copy_cust_data_from_target(HIF_DEVICE *hifDevice, A_UINT32 TargetType); - -A_UINT8 *ar6000_get_cust_data_buffer(A_UINT32 TargetType); - -A_STATUS ar6000_setBTState(void *context, A_UINT8 *pInBuf, A_UINT32 InBufSize); - -A_STATUS ar6000_setDevicePowerState(void *context, A_UINT8 *pInBuf, A_UINT32 InBufSize); - -A_STATUS ar6000_setWowMode(void *context, A_UINT8 *pInBuf, A_UINT32 InBufSize); - -A_STATUS ar6000_setHostMode(void *context, A_UINT8 *pInBuf, A_UINT32 InBufSize); - -#ifdef __cplusplus -} -#endif - -#endif /*COMMON_DRV_H_*/ diff --git a/drivers/net/wireless/ar6003/host/include/dbglog_api.h b/drivers/net/wireless/ar6003/host/include/dbglog_api.h deleted file mode 100644 index 7aba883c8888..000000000000 --- a/drivers/net/wireless/ar6003/host/include/dbglog_api.h +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file contains host side debug primitives. -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _DBGLOG_API_H_ -#define _DBGLOG_API_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "dbglog.h" - -#define DBGLOG_HOST_LOG_BUFFER_SIZE DBGLOG_LOG_BUFFER_SIZE - -#define DBGLOG_GET_DBGID(arg) \ - ((arg & DBGLOG_DBGID_MASK) >> DBGLOG_DBGID_OFFSET) - -#define DBGLOG_GET_MODULEID(arg) \ - ((arg & DBGLOG_MODULEID_MASK) >> DBGLOG_MODULEID_OFFSET) - -#define DBGLOG_GET_NUMARGS(arg) \ - ((arg & DBGLOG_NUM_ARGS_MASK) >> DBGLOG_NUM_ARGS_OFFSET) - -#define DBGLOG_GET_TIMESTAMP(arg) \ - ((arg & DBGLOG_TIMESTAMP_MASK) >> DBGLOG_TIMESTAMP_OFFSET) - -/** - @param lv 0->RAW info, 1->Breif translated info, 2->Full info - @param logbuf dbglog buffer - */ -int dbg_formater(int lv, char *output, size_t len, A_UINT32 ts, A_INT32 *logbuf); - -#ifdef __cplusplus -} -#endif - -#endif /* _DBGLOG_API_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/dfs_host.h b/drivers/net/wireless/ar6003/host/include/dfs_host.h deleted file mode 100644 index fc54ec5cbd07..000000000000 --- a/drivers/net/wireless/ar6003/host/include/dfs_host.h +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Copyright (c) 2005-2006 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -#ifndef _DFS_HOST_H_ -#define _DFS_HOST_H_ - -#ifdef ATH_SUPPORT_DFS - -#include "dfs_host_project.h" - -#define DFS_MIN(a,b) ((a)<(b)?(a):(b)) -#define DFS_MAX(a,b) ((a)>(b)?(a):(b)) -#define DFS_DIFF(a,b) (DFS_MAX(a,b) - DFS_MIN(a,b)) -/* - * Maximum number of radar events to be processed in a single iteration. - * Allows soft watchdog to run. - */ -#define MAX_EVENTS 100 - - -#define DFS_MARGIN_EQUAL(a, b, margin) ((DFS_DIFF(a,b)) <= margin) -#define DFS_MAX_STAGGERED_BURSTS 3 - -/* All filter thresholds in the radar filter tables are effective at a 50% channel loading */ -#define DFS_CHAN_LOADING_THRESH 50 -#define DFS_EXT_CHAN_LOADING_THRESH 30 -#define DFS_DEFAULT_PRI_MARGIN 10 -#define DFS_DEFAULT_FIXEDPATTERN_PRI_MARGIN 6 - - -#define ATH_DFSQ_LOCK(_dfs) spin_lock(&(_dfs)->dfs_radarqlock) -#define ATH_DFSQ_UNLOCK(_dfs) spin_unlock(&(_dfs)->dfs_radarqlock) -#define ATH_DFSQ_LOCK_INIT(_dfs) spin_lock_init(&(_dfs)->dfs_radarqlock) - -#define ATH_ARQ_LOCK(_dfs) spin_lock(&(_dfs)->dfs_arqlock) -#define ATH_ARQ_UNLOCK(_dfs) spin_unlock(&(_dfs)->dfs_arqlock) -#define ATH_ARQ_LOCK_INIT(_dfs) spin_lock_init(&(_dfs)->dfs_arqlock) - -#define ATH_DFSEVENTQ_LOCK(_dfs) spin_lock(&(_dfs)->dfs_eventqlock) -#define ATH_DFSEVENTQ_UNLOCK(_dfs) spin_unlock(&(_dfs)->dfs_eventqlock) -#define ATH_DFSEVENTQ_LOCK_INIT(_dfs) spin_lock_init(&(_dfs)->dfs_eventqlock) - - -#define DFS_TSMASK 0xFFFFFFFF /* Mask for time stamp from descriptor */ -#define DFS_TSSHIFT 32 /* Shift for time stamp from descriptor */ -#define DFS_TSF_WRAP 0xFFFFFFFFFFFFFFFFULL /* 64 bit TSF wrap value */ -#define DFS_64BIT_TSFMASK 0x0000000000007FFFULL /* TS mask for 64 bit value */ - - -#define DFS_AR_RADAR_RSSI_THR 5 /* in dB */ -#define DFS_AR_RADAR_RESET_INT 1 /* in secs */ -#define DFS_AR_RADAR_MAX_HISTORY 500 -#define DFS_AR_REGION_WIDTH 128 -#define DFS_AR_RSSI_THRESH_STRONG_PKTS 17 /* in dB */ -#define DFS_AR_RSSI_DOUBLE_THRESHOLD 15 /* in dB */ -#define DFS_AR_MAX_NUM_ACK_REGIONS 9 -#define DFS_AR_ACK_DETECT_PAR_THRESH 20 -#define DFS_AR_PKT_COUNT_THRESH 20 - -#define DFS_MAX_DL_MASK 0x3F - -#define DFS_NOL_TIME 30*60*1000000 /* 30 minutes in usecs */ - -#define DFS_WAIT_TIME 60*1000000 /* 1 minute in usecs */ - -#define DFS_DISABLE_TIME 3*60*1000000 /* 3 minutes in usecs */ - -#define DFS_MAX_B5_SIZE 128 -#define DFS_MAX_B5_MASK 0x0000007F /* 128 */ - -#define DFS_MAX_RADAR_OVERLAP 16 /* Max number of overlapping filters */ - -#define DFS_MAX_EVENTS 1024 /* Max number of dfs events which can be q'd */ - -#define DFS_RADAR_EN 0x80000000 /* Radar detect is capable */ -#define DFS_AR_EN 0x40000000 /* AR detect is capable */ -#define DFS_MAX_RSSI_VALUE 0x7fffffff /* Max rssi value */ - -#define DFS_BIN_MAX_PULSES 60 /* max num of pulses in a burst */ -#define DFS_BIN5_PRI_LOWER_LIMIT 990 /* us */ -#define DFS_BIN5_PRI_HIGHER_LIMIT 2010 /* us */ -#define DFS_BIN5_WIDTH_MARGIN 4 /* us */ -#define DFS_BIN5_RSSI_MARGIN 5 /* dBm */ -/*Following threshold is not specified but should be okay statistically*/ -#define DFS_BIN5_BRI_LOWER_LIMIT 300000 /* us */ - -#define DFS_MAX_PULSE_BUFFER_SIZE 1024 /* Max number of pulses kept in buffer */ -#define DFS_MAX_PULSE_BUFFER_MASK 0x3ff - -#define DFS_FAST_CLOCK_MULTIPLIER (800/11) -#define DFS_NO_FAST_CLOCK_MULTIPLIER (80) - -typedef spinlock_t dfsq_lock_t; - -struct dfs_pulse { - A_UINT32 rp_numpulses; /* Num of pulses in radar burst */ - A_UINT32 rp_pulsedur; /* Duration of each pulse in usecs */ - A_UINT32 rp_pulsefreq; /* Frequency of pulses in burst */ - A_UINT32 rp_max_pulsefreq; /* Frequency of pulses in burst */ - A_UINT32 rp_patterntype; /*fixed or variable pattern type*/ - A_UINT32 rp_pulsevar; /* Time variation of pulse duration for - matched filter (single-sided) in usecs */ - A_UINT32 rp_threshold; /* Thershold for MF output to indicate - radar match */ - A_UINT32 rp_mindur; /* Min pulse duration to be considered for - this pulse type */ - A_UINT32 rp_maxdur; /* Max pusle duration to be considered for - this pulse type */ - A_UINT32 rp_rssithresh; /* Minimum rssi to be considered a radar pulse */ - A_UINT32 rp_meanoffset; /* Offset for timing adjustment */ - A_INT32 rp_rssimargin; /* rssi threshold margin. In Turbo Mode HW reports rssi 3dBm - * lower than in non TURBO mode. This will be used to offset - * that diff.*/ - A_UINT32 rp_pulseid; /* Unique ID for identifying filter */ - -}; - -struct dfs_bin5pulse { - A_UINT32 b5_threshold; /* Number of bin5 pulses to indicate detection */ - A_UINT32 b5_mindur; /* Min duration for a bin5 pulse */ - A_UINT32 b5_maxdur; /* Max duration for a bin5 pulse */ - A_UINT32 b5_timewindow; /* Window over which to count bin5 pulses */ - A_UINT32 b5_rssithresh; /* Min rssi to be considered a pulse */ - A_UINT32 b5_rssimargin; /* rssi threshold margin. In Turbo Mode HW reports rssi 3dB */ -}; - - -#define DFS_MAX_DL_SIZE 64 -#include "athstartpack.h" -PREPACK struct dfs_delayelem { - u_int32_t de_time; /* Current "filter" time for start of pulse in usecs*/ - u_int8_t de_dur; /* Duration of pulse in usecs*/ - u_int8_t de_rssi; /* rssi of pulse in dB*/ -} POSTPACK adf_os_packed; - -/* NB: The first element in the circular buffer is the oldest element */ - -PREPACK struct dfs_delayline { - struct dfs_delayelem dl_elems[DFS_MAX_DL_SIZE]; /* Array of pulses in delay line */ - u_int64_t dl_last_ts; /* Last timestamp the delay line was used (in usecs) */ - u_int32_t dl_firstelem; /* Index of the first element */ - u_int32_t dl_lastelem; /* Index of the last element */ - u_int32_t dl_numelems; /* Number of elements in the delay line */ -} POSTPACK adf_os_packed; - - -PREPACK struct dfs_filter { - struct dfs_delayline rf_dl; /* Delay line of pulses for this filter */ - u_int32_t rf_numpulses; /* Number of pulses in the filter */ - u_int32_t rf_minpri; /* min pri to be considered for this filter*/ - u_int32_t rf_maxpri; /* max pri to be considered for this filter*/ - u_int32_t rf_threshold; /* match filter output threshold for radar detect */ - u_int32_t rf_filterlen; /* Length (in usecs) of the filter */ - u_int32_t rf_patterntype; /* fixed or variable pattern type */ - u_int32_t rf_mindur; /* Min duration for this radar filter */ - u_int32_t rf_maxdur; /* Max duration for this radar filter */ - u_int32_t rf_pulseid; /* Unique ID corresponding to the original filter ID */ -} POSTPACK adf_os_packed; - - - -PREPACK struct dfs_pulseparams { - u_int64_t p_time; /* time for start of pulse in usecs*/ - u_int8_t p_dur; /* Duration of pulse in usecs*/ - u_int8_t p_rssi; /* Duration of pulse in usecs*/ -} POSTPACK adf_os_packed; - -PREPACK struct dfs_pulseline { - /* pl_elems - array of pulses in delay line */ - struct dfs_pulseparams pl_elems[DFS_MAX_PULSE_BUFFER_SIZE]; - u_int32_t pl_firstelem; /* Index of the first element */ - u_int32_t pl_lastelem; /* Index of the last element */ - u_int32_t pl_numelems; /* Number of elements in the delay line */ -} POSTPACK adf_os_packed; - -PREPACK struct dfs_event { - u_int64_t re_full_ts; /* 64-bit full timestamp from interrupt time */ - u_int32_t re_ts; /* Original 15 bit recv timestamp */ - u_int32_t re_ext_chan_busy; /* Ext channel busy % */ - u_int8_t re_rssi; /* rssi of radar event */ - u_int8_t re_dur; /* duration of radar pulse */ - u_int8_t re_chanindex; /* Channel of event */ - u_int8_t re_chanindextype; /* Primary channel or extension channel */ - STAILQ_ENTRY(dfs_event) re_list; /* List of radar events */ -} POSTPACK adf_os_packed; -#include "athendpack.h" - -#define DFS_AR_MAX_ACK_RADAR_DUR 511 -#define DFS_AR_MAX_NUM_PEAKS 3 -#define DFS_AR_ARQ_SIZE 2048 /* 8K AR events for buffer size */ -#define DFS_AR_ARQ_SEQSIZE 2049 /* Sequence counter wrap for AR */ - -#define DFS_RADARQ_SIZE 512 /* 1K radar events for buffer size */ -#define DFS_RADARQ_SEQSIZE 513 /* Sequence counter wrap for radar */ -#define DFS_NUM_RADAR_STATES 64 /* Number of radar channels we keep state for */ -#define DFS_MAX_NUM_RADAR_FILTERS 10 /* Max number radar filters for each type */ -#define DFS_MAX_RADAR_TYPES 32 /* Number of different radar types */ - -struct dfs_ar_state { - u_int32_t ar_prevwidth; - u_int32_t ar_phyerrcount[DFS_AR_MAX_ACK_RADAR_DUR]; - u_int32_t ar_acksum; - u_int32_t ar_packetthreshold; /* Thresh to determine traffic load */ - u_int32_t ar_parthreshold; /* Thresh to determine peak */ - u_int32_t ar_radarrssi; /* Rssi threshold for AR event */ - u_int16_t ar_prevtimestamp; - u_int16_t ar_peaklist[DFS_AR_MAX_NUM_PEAKS]; -}; - -struct dfs_filtertype { - struct dfs_filter ft_filters[DFS_MAX_NUM_RADAR_FILTERS]; - u_int32_t ft_filterdur; /* Duration of pulse which specifies filter type*/ - u_int32_t ft_numfilters; /* Num filters of this type */ - u_int64_t ft_last_ts; /* Last timestamp this filtertype was used - * (in usecs) */ - u_int32_t ft_mindur; /* min pulse duration to be considered - * for this filter type */ - u_int32_t ft_maxdur; /* max pulse duration to be considered - * for this filter type */ - u_int32_t ft_rssithresh; /* min rssi to be considered - * for this filter type */ - u_int32_t ft_numpulses; /* Num pulses in each filter of this type */ - u_int32_t ft_patterntype; /* fixed or variable pattern type */ - u_int32_t ft_minpri; /* min pri to be considered for this type */ - u_int32_t ft_rssimargin; /* rssi threshold margin. In Turbo Mode HW - * reports rssi 3dB lower than in non TURBO - * mode. This will offset that diff. */ -}; - - -#define DFS_NOL_TIMEOUT_S (30*60) /* 30 minutes in seconds */ -#define DFS_NOL_TIMEOUT_MS (DFS_NOL_TIMEOUT_S * 1000) -#define DFS_NOL_TIMEOUT_US (DFS_NOL_TIMEOUT_MS * 1000) - -#include "athstartpack.h" -PREPACK struct dfs_info_host { - u_int32_t rn_numradars; /* Number of different types of radars */ - u_int64_t rn_lastfull_ts; /* Last 64 bit timstamp from recv interrupt */ - u_int16_t rn_last_ts; /* last 15 bit ts from recv descriptor */ - u_int32_t rn_last_unique_ts; /* last unique 32 bit ts from recv descriptor */ - u_int64_t rn_ts_prefix; /* Prefix to prepend to 15 bit recv ts */ - u_int32_t rn_numbin5radars; /* Number of bin5 radar pulses to search for */ - u_int64_t dfs_bin5_chirp_ts; - u_int8_t dfs_last_bin5_dur; -} POSTPACK adf_os_packed; -#include "athendpack.h" - -struct dfs_bin5elem { - u_int64_t be_ts; /* Timestamp for the bin5 element */ - u_int32_t be_rssi; /* Rssi for the bin5 element */ - u_int32_t be_dur; /* Duration of bin5 element */ -}; - -struct dfs_bin5radars { - struct dfs_bin5elem br_elems[DFS_MAX_B5_SIZE]; /* List of bin5 elems that fall - * within the time window */ - u_int32_t br_firstelem; /* Index of the first element */ - u_int32_t br_lastelem; /* Index of the last element */ - u_int32_t br_numelems; /* Number of elements in the delay line */ - struct dfs_bin5pulse br_pulse; /* Original info about bin5 pulse */ -}; - - -#define ATH_DFS_RESET_TIME_S 7 -#define ATH_DFS_WAIT (60 + ATH_DFS_RESET_TIME_S) /* 60 seconds */ -#define ATH_DFS_WAIT_MS ((ATH_DFS_WAIT) * 1000) /*in MS*/ - -#define ATH_DFS_WEATHER_CHANNEL_WAIT_MIN 10 /*10 minutes*/ -#define ATH_DFS_WEATHER_CHANNEL_WAIT_S (ATH_DFS_WEATHER_CHANNEL_WAIT_MIN * 60) -#define ATH_DFS_WEATHER_CHANNEL_WAIT_MS ((ATH_DFS_WEATHER_CHANNEL_WAIT_S) * 1000) /*in MS*/ - -#define ATH_DFS_WAIT_POLL_PERIOD 2 /* 2 seconds */ -#define ATH_DFS_WAIT_POLL_PERIOD_MS ((ATH_DFS_WAIT_POLL_PERIOD) * 1000) /*in MS*/ -#define ATH_DFS_TEST_RETURN_PERIOD 2 /* 2 seconds */ -#define ATH_DFS_TEST_RETURN_PERIOD_MS ((ATH_DFS_TEST_RETURN_PERIOD) * 1000)/* n MS*/ - -#define IS_CHANNEL_WEATHER_RADAR(chan) ((chan->channel >= 5600) && (chan->channel <= 5650)) - -#define DFS_DEBUG_TIMEOUT_S 30 // debug timeout is 30 seconds -#define DFS_DEBUG_TIMEOUT_MS (DFS_DEBUG_TIMEOUT_S * 1000) -struct ath_dfs_host { - DEV_HDL dev_hdl; - u_int32_t dfs_debug_level; - OS_HDL os_hdl; - STAILQ_HEAD(,dfs_event) dfs_eventq; /* Q of free dfs event objects */ - dfsq_lock_t dfs_eventqlock; /* Lock for free dfs event list */ - STAILQ_HEAD(,dfs_event) dfs_radarq; /* Q of radar events */ - dfsq_lock_t dfs_radarqlock; /* Lock for dfs q */ - STAILQ_HEAD(,dfs_event) dfs_arq; /* Q of AR events */ - dfsq_lock_t dfs_arqlock; /* Lock for AR q */ - - struct dfs_pulseline *pulses; /* pulse history */ - struct dfs_event *events; /* Events structure */ - /* dfs_radarf - One filter for each radar pulse type */ - struct dfs_filtertype *dfs_radarf[DFS_MAX_RADAR_TYPES]; - - int8_t **dfs_radartable; /* map of radar durs to filter types */ - struct dfs_bin5radars *dfs_b5radars;/* array of bin5 radar events */ - struct dfs_ar_state dfs_ar_state; /* AR state */ - struct dfs_info_host dfs_rinfo; /* State vars for radar processing */ - u_int8_t dfs_bangradar; - u_int32_t dur_multiplier; - A_TIMER dfs_radar_task_timer; -}; - - -#define HAL_CAP_RADAR 0 -#define HAL_CAP_AR 1 -#define HAL_CAP_STRONG_DIV 2 - - -/* Attach, detach, handle ioctl prototypes */ -struct ath_dfs_host *dfs_attach_host(DEV_HDL dev, OS_HDL os, ATH_DFS_CAPINFO *cap_info); -void dfs_detach_host(struct ath_dfs_host *sc); - - -/* PHY error and radar event handling */ -void dfs_process_phyerr_host(struct ath_dfs_host *dfs, WMI_DFS_PHYERR_EVENT *ev); -int dfs_process_radarevent_host(struct ath_dfs_host *dfs, int16_t *chan_index, u_int8_t *bangradar); - - -/* FCC Bin5 detection prototypes */ -int dfs_bin5_addpulse(struct ath_dfs_host *sc, struct dfs_bin5radars *br, - struct dfs_event *re, u_int64_t thists); -int dfs_bin5_check(struct ath_dfs_host *dfs); -u_int8_t dfs_retain_bin5_burst_pattern(struct ath_dfs_host *dfs, u_int32_t diff_ts, u_int8_t old_dur); - -/* Debug prototypes */ -void dfs_print_delayline(struct ath_dfs_host *dfs, struct dfs_delayline *dl); -void dfs_print_filters(struct ath_dfs_host *dfs); -void dfs_print_filter(struct ath_dfs_host *dfs, struct dfs_filter *rf); - -/* Misc prototypes */ -u_int32_t dfs_round(int32_t val); - -/* Reset and init data structures */ - -int dfs_init_radar_filters_host(struct ath_dfs_host *dfs, struct ath_dfs_info *dfs_info); -void dfs_reset_alldelaylines(struct ath_dfs_host *dfs); -void dfs_reset_delayline(struct dfs_delayline *dl); -void dfs_reset_filter_delaylines(struct dfs_filtertype *dft); -void dfs_reset_radarq(struct ath_dfs_host *dfs); - -/* Detection algorithm prototypes */ -void dfs_add_pulse(struct ath_dfs_host *dfs, struct dfs_filter *rf, - struct dfs_event *re, u_int32_t deltaT); - -int dfs_bin_fixedpattern_check(struct ath_dfs_host *dfs, struct dfs_filter *rf, u_int32_t dur, int ext_chan_flag, u_int32_t ext_chan_busy); -int dfs_bin_check(struct ath_dfs_host *dfs, struct dfs_filter *rf, - u_int32_t deltaT, u_int32_t dur, int ext_chan_flag, u_int32_t ext_chan_busy); - - -int dfs_bin_pri_check(struct ath_dfs_host *dfs, struct dfs_filter *rf, - struct dfs_delayline *dl, u_int32_t score, - u_int32_t refpri, u_int32_t refdur, int ext_chan_flag, u_int32_t ext_chan_busy); -int dfs_staggered_check(struct ath_dfs_host *dfs, struct dfs_filter *rf, - u_int32_t deltaT, u_int32_t width, u_int32_t ext_chan_busy); - -/* AR related prototypes */ -u_int32_t dfs_process_ar_event(struct ath_dfs_host *dfs); -void dfs_reset_ar(struct ath_dfs_host *dfs); -void dfs_reset_arq(struct ath_dfs_host *dfs); - -void dfs_bangradar_enable(struct ath_dfs_host *dfs, u_int8_t enable); -void dfs_set_dur_multiplier(struct ath_dfs_host *dfs, u_int32_t dur_multiplier); -void dfs_set_debug_level_host(struct ath_dfs_host *dfs, u_int32_t level); - -/* False detection reduction */ -int dfs_get_pri_margin(int is_extchan_detect, int is_fixed_pattern, u_int64_t lastfull_ts, u_int32_t ext_chan_busy); -int dfs_get_filter_threshold(struct dfs_filter *rf, int is_extchan_detect, u_int64_t lastfull_ts, u_int32_t ext_chan_busy); - -#endif /* ATH_SUPPORT_DFS */ -#endif /* _DFS_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/dfs_host_project.h b/drivers/net/wireless/ar6003/host/include/dfs_host_project.h deleted file mode 100644 index 9f1ce2f2d717..000000000000 --- a/drivers/net/wireless/ar6003/host/include/dfs_host_project.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2005-2006 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -#ifndef _DFS_PROJECT_H_ -#define _DFS_PROJECT_H_ - -#ifdef ATH_SUPPORT_DFS - -#include -#include -#include -#include -#include -#include /* XXX: This is in target dir */ -#include "dfs_common.h" -#include "ar6000_drv.h" -#include "project.h" - -#define ATH_DFS_CAPINFO WMI_DFS_HOST_ATTACH_EVENT - -#define OS_HDL void * -#define DEV_HDL void * - -#define DFS_MALLOC(os_hdl, nbytes) A_MALLOC(nbytes) - -#define DFS_DPRINTK(pDfs, _m, _fmt, ...) do { \ - if ((_m) <= pDfs->dfs_debug_level) { \ - A_PRINTF(_fmt, __VA_ARGS__); \ - } \ -} while (0) - - -void dfs_radar_task (unsigned long arg); - -#define adf_os_packed - -typedef enum { - AH_FALSE = 0, /* NB: lots of code assumes false is zero */ - AH_TRUE = 1, -} HAL_BOOL; -#endif /* ATH_SUPPORT_DFS */ - -#endif /* _DFS_PROJECT_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/dl_list.h b/drivers/net/wireless/ar6003/host/include/dl_list.h deleted file mode 100644 index 662ee1a0708f..000000000000 --- a/drivers/net/wireless/ar6003/host/include/dl_list.h +++ /dev/null @@ -1,153 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Double-link list definitions (adapted from Atheros SDIO stack) -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef __DL_LIST_H___ -#define __DL_LIST_H___ - -#include "a_osapi.h" - -#define A_CONTAINING_STRUCT(address, struct_type, field_name)\ - ((struct_type *)((unsigned long)(address) - (unsigned long)(&((struct_type *)0)->field_name))) - -/* list functions */ -/* pointers for the list */ -typedef struct _DL_LIST { - struct _DL_LIST *pPrev; - struct _DL_LIST *pNext; -}DL_LIST, *PDL_LIST; -/* - * DL_LIST_INIT , initialize doubly linked list -*/ -#define DL_LIST_INIT(pList)\ - {(pList)->pPrev = pList; (pList)->pNext = pList;} - -/* faster macro to init list and add a single item */ -#define DL_LIST_INIT_AND_ADD(pList,pItem) \ -{ (pList)->pPrev = (pItem); \ - (pList)->pNext = (pItem); \ - (pItem)->pNext = (pList); \ - (pItem)->pPrev = (pList); \ -} - -#define DL_LIST_IS_EMPTY(pList) (((pList)->pPrev == (pList)) && ((pList)->pNext == (pList))) -#define DL_LIST_GET_ITEM_AT_HEAD(pList) (pList)->pNext -#define DL_LIST_GET_ITEM_AT_TAIL(pList) (pList)->pPrev -/* - * ITERATE_OVER_LIST pStart is the list, pTemp is a temp list member - * NOT: do not use this function if the items in the list are deleted inside the - * iteration loop -*/ -#define ITERATE_OVER_LIST(pStart, pTemp) \ - for((pTemp) =(pStart)->pNext; pTemp != (pStart); (pTemp) = (pTemp)->pNext) - - -/* safe iterate macro that allows the item to be removed from the list - * the iteration continues to the next item in the list - */ -#define ITERATE_OVER_LIST_ALLOW_REMOVE(pStart,pItem,st,offset) \ -{ \ - PDL_LIST pTemp; \ - pTemp = (pStart)->pNext; \ - while (pTemp != (pStart)) { \ - (pItem) = A_CONTAINING_STRUCT(pTemp,st,offset); \ - pTemp = pTemp->pNext; \ - -#define ITERATE_END }} - -/* - * DL_ListInsertTail - insert pAdd to the end of the list -*/ -static INLINE PDL_LIST DL_ListInsertTail(PDL_LIST pList, PDL_LIST pAdd) { - /* insert at tail */ - pAdd->pPrev = pList->pPrev; - pAdd->pNext = pList; - pList->pPrev->pNext = pAdd; - pList->pPrev = pAdd; - return pAdd; -} - -/* - * DL_ListInsertHead - insert pAdd into the head of the list -*/ -static INLINE PDL_LIST DL_ListInsertHead(PDL_LIST pList, PDL_LIST pAdd) { - /* insert at head */ - pAdd->pPrev = pList; - pAdd->pNext = pList->pNext; - pList->pNext->pPrev = pAdd; - pList->pNext = pAdd; - return pAdd; -} - -#define DL_ListAdd(pList,pItem) DL_ListInsertHead((pList),(pItem)) -/* - * DL_ListRemove - remove pDel from list -*/ -static INLINE PDL_LIST DL_ListRemove(PDL_LIST pDel) { - pDel->pNext->pPrev = pDel->pPrev; - pDel->pPrev->pNext = pDel->pNext; - /* point back to itself just to be safe, incase remove is called again */ - pDel->pNext = pDel; - pDel->pPrev = pDel; - return pDel; -} - -/* - * DL_ListRemoveItemFromHead - get a list item from the head -*/ -static INLINE PDL_LIST DL_ListRemoveItemFromHead(PDL_LIST pList) { - PDL_LIST pItem = NULL; - if (pList->pNext != pList) { - pItem = pList->pNext; - /* remove the first item from head */ - DL_ListRemove(pItem); - } - return pItem; -} - -static INLINE PDL_LIST DL_ListRemoveItemFromTail(PDL_LIST pList) { - PDL_LIST pItem = NULL; - if (pList->pPrev != pList) { - pItem = pList->pPrev; - /* remove the item from tail */ - DL_ListRemove(pItem); - } - return pItem; -} - -/* transfer src list items to the tail of the destination list */ -static INLINE void DL_ListTransferItemsToTail(PDL_LIST pDest, PDL_LIST pSrc) { - /* only concatenate if src is not empty */ - if (!DL_LIST_IS_EMPTY(pSrc)) { - /* cut out circular list in src and re-attach to end of dest */ - pSrc->pPrev->pNext = pDest; - pSrc->pNext->pPrev = pDest->pPrev; - pDest->pPrev->pNext = pSrc->pNext; - pDest->pPrev = pSrc->pPrev; - /* terminate src list, it is now empty */ - pSrc->pPrev = pSrc; - pSrc->pNext = pSrc; - } -} - -#endif /* __DL_LIST_H___ */ diff --git a/drivers/net/wireless/ar6003/host/include/dset_api.h b/drivers/net/wireless/ar6003/host/include/dset_api.h deleted file mode 100644 index 0cc121fd25a0..000000000000 --- a/drivers/net/wireless/ar6003/host/include/dset_api.h +++ /dev/null @@ -1,65 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Host-side DataSet API. -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _DSET_API_H_ -#define _DSET_API_H_ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* - * Host-side DataSet support is optional, and is not - * currently required for correct operation. To disable - * Host-side DataSet support, set this to 0. - */ -#ifndef CONFIG_HOST_DSET_SUPPORT -#define CONFIG_HOST_DSET_SUPPORT 1 -#endif - -/* Called to send a DataSet Open Reply back to the Target. */ -A_STATUS wmi_dset_open_reply(struct wmi_t *wmip, - A_UINT32 status, - A_UINT32 access_cookie, - A_UINT32 size, - A_UINT32 version, - A_UINT32 targ_handle, - A_UINT32 targ_reply_fn, - A_UINT32 targ_reply_arg); - -/* Called to send a DataSet Data Reply back to the Target. */ -A_STATUS wmi_dset_data_reply(struct wmi_t *wmip, - A_UINT32 status, - A_UINT8 *host_buf, - A_UINT32 length, - A_UINT32 targ_buf, - A_UINT32 targ_reply_fn, - A_UINT32 targ_reply_arg); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* _DSET_API_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/gpio_api.h b/drivers/net/wireless/ar6003/host/include/gpio_api.h deleted file mode 100644 index 96a150383358..000000000000 --- a/drivers/net/wireless/ar6003/host/include/gpio_api.h +++ /dev/null @@ -1,59 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Host-side General Purpose I/O API. -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _GPIO_API_H_ -#define _GPIO_API_H_ - -/* - * Send a command to the Target in order to change output on GPIO pins. - */ -A_STATUS wmi_gpio_output_set(struct wmi_t *wmip, - A_UINT32 set_mask, - A_UINT32 clear_mask, - A_UINT32 enable_mask, - A_UINT32 disable_mask); - -/* - * Send a command to the Target requesting input state of GPIO pins. - */ -A_STATUS wmi_gpio_input_get(struct wmi_t *wmip); - -/* - * Send a command to the Target to change the value of a GPIO register. - */ -A_STATUS wmi_gpio_register_set(struct wmi_t *wmip, - A_UINT32 gpioreg_id, - A_UINT32 value); - -/* - * Send a command to the Target to fetch the value of a GPIO register. - */ -A_STATUS wmi_gpio_register_get(struct wmi_t *wmip, A_UINT32 gpioreg_id); - -/* - * Send a command to the Target, acknowledging some GPIO interrupts. - */ -A_STATUS wmi_gpio_intr_ack(struct wmi_t *wmip, A_UINT32 ack_mask); - -#endif /* _GPIO_API_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/hci_transport_api.h b/drivers/net/wireless/ar6003/host/include/hci_transport_api.h deleted file mode 100644 index b5157ea5d9e9..000000000000 --- a/drivers/net/wireless/ar6003/host/include/hci_transport_api.h +++ /dev/null @@ -1,259 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2009-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#ifndef _HCI_TRANSPORT_API_H_ -#define _HCI_TRANSPORT_API_H_ - - /* Bluetooth HCI packets are stored in HTC packet containers */ -#include "htc_packet.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef void *HCI_TRANSPORT_HANDLE; - -typedef HTC_ENDPOINT_ID HCI_TRANSPORT_PACKET_TYPE; - - /* we map each HCI packet class to a static Endpoint ID */ -#define HCI_COMMAND_TYPE ENDPOINT_1 -#define HCI_EVENT_TYPE ENDPOINT_2 -#define HCI_ACL_TYPE ENDPOINT_3 -#define HCI_PACKET_INVALID ENDPOINT_MAX - -#define HCI_GET_PACKET_TYPE(pP) (pP)->Endpoint -#define HCI_SET_PACKET_TYPE(pP,s) (pP)->Endpoint = (s) - -/* callback when an HCI packet was completely sent */ -typedef void (*HCI_TRANSPORT_SEND_PKT_COMPLETE)(void *, HTC_PACKET *); -/* callback when an HCI packet is received */ -typedef void (*HCI_TRANSPORT_RECV_PKT)(void *, HTC_PACKET *); -/* Optional receive buffer re-fill callback, - * On some OSes (like Linux) packets are allocated from a global pool and indicated up - * to the network stack. The driver never gets the packets back from the OS. For these OSes - * a refill callback can be used to allocate and re-queue buffers into HTC. - * A refill callback is used for the reception of ACL and EVENT packets. The caller must - * set the watermark trigger point to cause a refill. - */ -typedef void (*HCI_TRANSPORT_RECV_REFILL)(void *, HCI_TRANSPORT_PACKET_TYPE Type, int BuffersAvailable); -/* Optional receive packet refill - * On some systems packet buffers are an extremely limited resource. Rather than - * queue largest-possible-sized buffers to the HCI bridge, some systems would rather - * allocate a specific size as the packet is received. The trade off is - * slightly more processing (callback invoked for each RX packet) - * for the benefit of committing fewer buffer resources into the bridge. - * - * The callback is provided the length of the pending packet to fetch. This includes the - * full transport header, HCI header, plus the length of payload. The callback can return a pointer to - * the allocated HTC packet for immediate use. - * - * NOTE*** This callback is mutually exclusive with the the refill callback above. - * - * */ -typedef HTC_PACKET *(*HCI_TRANSPORT_RECV_ALLOC)(void *, HCI_TRANSPORT_PACKET_TYPE Type, int Length); - -typedef enum _HCI_SEND_FULL_ACTION { - HCI_SEND_FULL_KEEP = 0, /* packet that overflowed should be kept in the queue */ - HCI_SEND_FULL_DROP = 1, /* packet that overflowed should be dropped */ -} HCI_SEND_FULL_ACTION; - -/* callback when an HCI send queue exceeds the caller's MaxSendQueueDepth threshold, - * the callback must return the send full action to take (either DROP or KEEP) */ -typedef HCI_SEND_FULL_ACTION (*HCI_TRANSPORT_SEND_FULL)(void *, HTC_PACKET *); - -typedef struct { - int HeadRoom; /* number of bytes in front of HCI packet for header space */ - int TailRoom; /* number of bytes at the end of the HCI packet for tail space */ - int IOBlockPad; /* I/O block padding required (always a power of 2) */ -} HCI_TRANSPORT_PROPERTIES; - -typedef struct _HCI_TRANSPORT_CONFIG_INFO { - int ACLRecvBufferWaterMark; /* low watermark to trigger recv refill */ - int EventRecvBufferWaterMark; /* low watermark to trigger recv refill */ - int MaxSendQueueDepth; /* max number of packets in the single send queue */ - void *pContext; /* context for all callbacks */ - void (*TransportFailure)(void *pContext, A_STATUS Status); /* transport failure callback */ - A_STATUS (*TransportReady)(HCI_TRANSPORT_HANDLE, HCI_TRANSPORT_PROPERTIES *,void *pContext); /* transport is ready */ - void (*TransportRemoved)(void *pContext); /* transport was removed */ - /* packet processing callbacks */ - HCI_TRANSPORT_SEND_PKT_COMPLETE pHCISendComplete; - HCI_TRANSPORT_RECV_PKT pHCIPktRecv; - HCI_TRANSPORT_RECV_REFILL pHCIPktRecvRefill; - HCI_TRANSPORT_RECV_ALLOC pHCIPktRecvAlloc; - HCI_TRANSPORT_SEND_FULL pHCISendFull; -} HCI_TRANSPORT_CONFIG_INFO; - -/* ------ Function Prototypes ------ */ -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Attach to the HCI transport module - @function name: HCI_TransportAttach - @input: HTCHandle - HTC handle (see HTC apis) - pInfo - initialization information - @output: - @return: HCI_TRANSPORT_HANDLE on success, NULL on failure - @notes: The HTC module provides HCI transport services. - @example: - @see also: HCI_TransportDetach -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -HCI_TRANSPORT_HANDLE HCI_TransportAttach(void *HTCHandle, HCI_TRANSPORT_CONFIG_INFO *pInfo); - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Detach from the HCI transport module - @function name: HCI_TransportDetach - @input: HciTrans - HCI transport handle - pInfo - initialization information - @output: - @return: - @notes: - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -void HCI_TransportDetach(HCI_TRANSPORT_HANDLE HciTrans); - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Add receive packets to the HCI transport - @function name: HCI_TransportAddReceivePkts - @input: HciTrans - HCI transport handle - pQueue - a queue holding one or more packets - @output: - @return: A_OK on success - @notes: user must supply HTC packets for capturing incomming HCI packets. The caller - must initialize each HTC packet using the SET_HTC_PACKET_INFO_RX_REFILL() - macro. Each packet in the queue must be of the same type and length - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_STATUS HCI_TransportAddReceivePkts(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET_QUEUE *pQueue); - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Send an HCI packet packet - @function name: HCI_TransportSendPkt - @input: HciTrans - HCI transport handle - pPacket - packet to send - Synchronous - send the packet synchronously (blocking) - @output: - @return: A_OK - @notes: Caller must initialize packet using SET_HTC_PACKET_INFO_TX() and - HCI_SET_PACKET_TYPE() macros to prepare the packet. - If Synchronous is set to FALSE the call is fully asynchronous. On error or completion, - the registered send complete callback will be called. - If Synchronous is set to TRUE, the call will block until the packet is sent, if the - interface cannot send the packet within a 2 second timeout, the function will return - the failure code : A_EBUSY. - - Synchronous Mode should only be used at start-up to initialize the HCI device using - custom HCI commands. It should NOT be mixed with Asynchronous operations. Mixed synchronous - and asynchronous operation behavior is undefined. - - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_STATUS HCI_TransportSendPkt(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET *pPacket, A_BOOL Synchronous); - - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Stop HCI transport - @function name: HCI_TransportStop - @input: HciTrans - hci transport handle - @output: - @return: - @notes: HCI transport communication will be halted. All receive and pending TX packets will - be flushed. - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -void HCI_TransportStop(HCI_TRANSPORT_HANDLE HciTrans); - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Start the HCI transport - @function name: HCI_TransportStart - @input: HciTrans - hci transport handle - @output: - @return: A_OK on success - @notes: HCI transport communication will begin, the caller can expect the arrival - of HCI recv packets as soon as this call returns. - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_STATUS HCI_TransportStart(HCI_TRANSPORT_HANDLE HciTrans); - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Enable or Disable Asynchronous Recv - @function name: HCI_TransportEnableDisableAsyncRecv - @input: HciTrans - hci transport handle - Enable - enable or disable asynchronous recv - @output: - @return: A_OK on success - @notes: This API must be called when HCI recv is handled synchronously - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_STATUS HCI_TransportEnableDisableAsyncRecv(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable); - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Receive an event packet from the HCI transport synchronously using polling - @function name: HCI_TransportRecvHCIEventSync - @input: HciTrans - hci transport handle - pPacket - HTC packet to hold the recv data - MaxPollMS - maximum polling duration in Milliseconds; - @output: - @return: A_OK on success - @notes: This API should be used only during HCI device initialization, the caller must call - HCI_TransportEnableDisableAsyncRecv with Enable=FALSE prior to using this API. - This API will only capture HCI Event packets. - @example: - @see also: HCI_TransportEnableDisableAsyncRecv -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_STATUS HCI_TransportRecvHCIEventSync(HCI_TRANSPORT_HANDLE HciTrans, - HTC_PACKET *pPacket, - int MaxPollMS); - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Set the desired baud rate for the underlying transport layer - @function name: HCI_TransportSetBaudRate - @input: HciTrans - hci transport handle - Baud - baud rate in bps - @output: - @return: A_OK on success - @notes: This API should be used only after HCI device initialization - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_STATUS HCI_TransportSetBaudRate(HCI_TRANSPORT_HANDLE HciTrans, A_UINT32 Baud); - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Enable/Disable HCI Transport Power Management - @function name: HCI_TransportEnablePowerMgmt - @input: HciTrans - hci transport handle - Enable - 1 = Enable, 0 = Disable - @output: - @return: A_OK on success - @notes: - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_STATUS HCI_TransportEnablePowerMgmt(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable); - -#ifdef __cplusplus -} -#endif - -#endif /* _HCI_TRANSPORT_API_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/hif.h b/drivers/net/wireless/ar6003/host/include/hif.h deleted file mode 100644 index df0d28f12ecb..000000000000 --- a/drivers/net/wireless/ar6003/host/include/hif.h +++ /dev/null @@ -1,517 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// HIF specific declarations and prototypes -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _HIF_H_ -#define _HIF_H_ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* Header files */ -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" -#include "a_osapi.h" -#include "dl_list.h" - - -typedef struct htc_callbacks HTC_CALLBACKS; -typedef struct hif_device HIF_DEVICE; - -#define HIF_TYPE_AR6002 2 -#define HIF_TYPE_AR6003 3 -#define HIF_TYPE_MCKINLEY 5 - -/* - * direction - Direction of transfer (HIF_READ/HIF_WRITE). - */ -#define HIF_READ 0x00000001 -#define HIF_WRITE 0x00000002 -#define HIF_DIR_MASK (HIF_READ | HIF_WRITE) - -/* - * type - An interface may support different kind of read/write commands. - * For example: SDIO supports CMD52/CMD53s. In case of MSIO it - * translates to using different kinds of TPCs. The command type - * is thus divided into a basic and an extended command and can - * be specified using HIF_BASIC_IO/HIF_EXTENDED_IO. - */ -#define HIF_BASIC_IO 0x00000004 -#define HIF_EXTENDED_IO 0x00000008 -#define HIF_TYPE_MASK (HIF_BASIC_IO | HIF_EXTENDED_IO) - -/* - * emode - This indicates the whether the command is to be executed in a - * blocking or non-blocking fashion (HIF_SYNCHRONOUS/ - * HIF_ASYNCHRONOUS). The read/write data paths in HTC have been - * implemented using the asynchronous mode allowing the the bus - * driver to indicate the completion of operation through the - * registered callback routine. The requirement primarily comes - * from the contexts these operations get called from (a driver's - * transmit context or the ISR context in case of receive). - * Support for both of these modes is essential. - */ -#define HIF_SYNCHRONOUS 0x00000010 -#define HIF_ASYNCHRONOUS 0x00000020 -#define HIF_EMODE_MASK (HIF_SYNCHRONOUS | HIF_ASYNCHRONOUS) - -/* - * dmode - An interface may support different kinds of commands based on - * the tradeoff between the amount of data it can carry and the - * setup time. Byte and Block modes are supported (HIF_BYTE_BASIS/ - * HIF_BLOCK_BASIS). In case of latter, the data is rounded off - * to the nearest block size by padding. The size of the block is - * configurable at compile time using the HIF_BLOCK_SIZE and is - * negotiated with the target during initialization after the - * AR6000 interrupts are enabled. - */ -#define HIF_BYTE_BASIS 0x00000040 -#define HIF_BLOCK_BASIS 0x00000080 -#define HIF_DMODE_MASK (HIF_BYTE_BASIS | HIF_BLOCK_BASIS) - -/* - * amode - This indicates if the address has to be incremented on AR6000 - * after every read/write operation (HIF?FIXED_ADDRESS/ - * HIF_INCREMENTAL_ADDRESS). - */ -#define HIF_FIXED_ADDRESS 0x00000100 -#define HIF_INCREMENTAL_ADDRESS 0x00000200 -#define HIF_AMODE_MASK (HIF_FIXED_ADDRESS | HIF_INCREMENTAL_ADDRESS) - -#define HIF_WR_ASYNC_BYTE_FIX \ - (HIF_WRITE | HIF_ASYNCHRONOUS | HIF_EXTENDED_IO | HIF_BYTE_BASIS | HIF_FIXED_ADDRESS) -#define HIF_WR_ASYNC_BYTE_INC \ - (HIF_WRITE | HIF_ASYNCHRONOUS | HIF_EXTENDED_IO | HIF_BYTE_BASIS | HIF_INCREMENTAL_ADDRESS) -#define HIF_WR_ASYNC_BLOCK_INC \ - (HIF_WRITE | HIF_ASYNCHRONOUS | HIF_EXTENDED_IO | HIF_BLOCK_BASIS | HIF_INCREMENTAL_ADDRESS) -#define HIF_WR_SYNC_BYTE_FIX \ - (HIF_WRITE | HIF_SYNCHRONOUS | HIF_EXTENDED_IO | HIF_BYTE_BASIS | HIF_FIXED_ADDRESS) -#define HIF_WR_SYNC_BYTE_INC \ - (HIF_WRITE | HIF_SYNCHRONOUS | HIF_EXTENDED_IO | HIF_BYTE_BASIS | HIF_INCREMENTAL_ADDRESS) -#define HIF_WR_SYNC_BLOCK_INC \ - (HIF_WRITE | HIF_SYNCHRONOUS | HIF_EXTENDED_IO | HIF_BLOCK_BASIS | HIF_INCREMENTAL_ADDRESS) -#define HIF_WR_ASYNC_BLOCK_FIX \ - (HIF_WRITE | HIF_ASYNCHRONOUS | HIF_EXTENDED_IO | HIF_BLOCK_BASIS | HIF_FIXED_ADDRESS) -#define HIF_WR_SYNC_BLOCK_FIX \ - (HIF_WRITE | HIF_SYNCHRONOUS | HIF_EXTENDED_IO | HIF_BLOCK_BASIS | HIF_FIXED_ADDRESS) -#define HIF_RD_SYNC_BYTE_INC \ - (HIF_READ | HIF_SYNCHRONOUS | HIF_EXTENDED_IO | HIF_BYTE_BASIS | HIF_INCREMENTAL_ADDRESS) -#define HIF_RD_SYNC_BYTE_FIX \ - (HIF_READ | HIF_SYNCHRONOUS | HIF_EXTENDED_IO | HIF_BYTE_BASIS | HIF_FIXED_ADDRESS) -#define HIF_RD_ASYNC_BYTE_FIX \ - (HIF_READ | HIF_ASYNCHRONOUS | HIF_EXTENDED_IO | HIF_BYTE_BASIS | HIF_FIXED_ADDRESS) -#define HIF_RD_ASYNC_BLOCK_FIX \ - (HIF_READ | HIF_ASYNCHRONOUS | HIF_EXTENDED_IO | HIF_BLOCK_BASIS | HIF_FIXED_ADDRESS) -#define HIF_RD_ASYNC_BYTE_INC \ - (HIF_READ | HIF_ASYNCHRONOUS | HIF_EXTENDED_IO | HIF_BYTE_BASIS | HIF_INCREMENTAL_ADDRESS) -#define HIF_RD_ASYNC_BLOCK_INC \ - (HIF_READ | HIF_ASYNCHRONOUS | HIF_EXTENDED_IO | HIF_BLOCK_BASIS | HIF_INCREMENTAL_ADDRESS) -#define HIF_RD_SYNC_BLOCK_INC \ - (HIF_READ | HIF_SYNCHRONOUS | HIF_EXTENDED_IO | HIF_BLOCK_BASIS | HIF_INCREMENTAL_ADDRESS) -#define HIF_RD_SYNC_BLOCK_FIX \ - (HIF_READ | HIF_SYNCHRONOUS | HIF_EXTENDED_IO | HIF_BLOCK_BASIS | HIF_FIXED_ADDRESS) - -typedef enum { - HIF_DEVICE_POWER_STATE = 0, - HIF_DEVICE_GET_MBOX_BLOCK_SIZE, - HIF_DEVICE_GET_MBOX_ADDR, - HIF_DEVICE_GET_PENDING_EVENTS_FUNC, - HIF_DEVICE_GET_IRQ_PROC_MODE, - HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC, - HIF_DEVICE_POWER_STATE_CHANGE, - HIF_DEVICE_GET_IRQ_YIELD_PARAMS, - HIF_CONFIGURE_QUERY_SCATTER_REQUEST_SUPPORT, - HIF_DEVICE_GET_OS_DEVICE, - HIF_DEVICE_DEBUG_BUS_STATE, -} HIF_DEVICE_CONFIG_OPCODE; - -/* - * HIF CONFIGURE definitions: - * - * HIF_DEVICE_GET_MBOX_BLOCK_SIZE - * input : none - * output : array of 4 A_UINT32s - * notes: block size is returned for each mailbox (4) - * - * HIF_DEVICE_GET_MBOX_ADDR - * input : none - * output : HIF_DEVICE_MBOX_INFO - * notes: - * - * HIF_DEVICE_GET_PENDING_EVENTS_FUNC - * input : none - * output: HIF_PENDING_EVENTS_FUNC function pointer - * notes: this is optional for the HIF layer, if the request is - * not handled then it indicates that the upper layer can use - * the standard device methods to get pending events (IRQs, mailbox messages etc..) - * otherwise it can call the function pointer to check pending events. - * - * HIF_DEVICE_GET_IRQ_PROC_MODE - * input : none - * output : HIF_DEVICE_IRQ_PROCESSING_MODE (interrupt processing mode) - * note: the hif layer interfaces with the underlying OS-specific bus driver. The HIF - * layer can report whether IRQ processing is requires synchronous behavior or - * can be processed using asynchronous bus requests (typically faster). - * - * HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC - * input : - * output : HIF_MASK_UNMASK_RECV_EVENT function pointer - * notes: this is optional for the HIF layer. The HIF layer may require a special mechanism - * to mask receive message events. The upper layer can call this pointer when it needs - * to mask/unmask receive events (in case it runs out of buffers). - * - * HIF_DEVICE_POWER_STATE_CHANGE - * - * input : HIF_DEVICE_POWER_CHANGE_TYPE - * output : none - * note: this is optional for the HIF layer. The HIF layer can handle power on/off state change - * requests in an interconnect specific way. This is highly OS and bus driver dependent. - * The caller must guarantee that no HIF read/write requests will be made after the device - * is powered down. - * - * HIF_DEVICE_GET_IRQ_YIELD_PARAMS - * - * input : none - * output : HIF_DEVICE_IRQ_YIELD_PARAMS - * note: This query checks if the HIF layer wishes to impose a processing yield count for the DSR handler. - * The DSR callback handler will exit after a fixed number of RX packets or events are processed. - * This query is only made if the device reports an IRQ processing mode of HIF_DEVICE_IRQ_SYNC_ONLY. - * The HIF implementation can ignore this command if it does not desire the DSR callback to yield. - * The HIF layer can indicate the maximum number of IRQ processing units (RX packets) before the - * DSR handler callback must yield and return control back to the HIF layer. When a yield limit is - * used the DSR callback will not call HIFAckInterrupts() as it would normally do before returning. - * The HIF implementation that requires a yield count must call HIFAckInterrupt() when it is prepared - * to process interrupts again. - * - * HIF_CONFIGURE_QUERY_SCATTER_REQUEST_SUPPORT - * input : none - * output : HIF_DEVICE_SCATTER_SUPPORT_INFO - * note: This query checks if the HIF layer implements the SCATTER request interface. Scatter requests - * allows upper layers to submit mailbox I/O operations using a list of buffers. This is useful for - * multi-message transfers that can better utilize the bus interconnect. - * - * - * HIF_DEVICE_GET_OS_DEVICE - * intput : none - * output : HIF_DEVICE_OS_DEVICE_INFO; - * note: On some operating systems, the HIF layer has a parent device object for the bus. This object - * may be required to register certain types of logical devices. - * - * HIF_DEVICE_DEBUG_BUS_STATE - * input : none - * output : none - * note: This configure option triggers the HIF interface to dump as much bus interface state. This - * configuration request is optional (No-OP on some HIF implementations) - * - */ - -typedef struct { - A_UINT32 ExtendedAddress; /* extended address for larger writes */ - A_UINT32 ExtendedSize; -} HIF_MBOX_PROPERTIES; - -#define HIF_MBOX_FLAG_NO_BUNDLING (1 << 0) /* do not allow bundling over the mailbox */ - -typedef struct { - A_UINT32 MboxAddresses[4]; /* must be first element for legacy HIFs that return the address in - and ARRAY of 32-bit words */ - - /* the following describe extended mailbox properties */ - HIF_MBOX_PROPERTIES MboxProp[4]; - /* if the HIF supports the GMbox extended address region it can report it - * here, some interfaces cannot support the GMBOX address range and not set this */ - A_UINT32 GMboxAddress; - A_UINT32 GMboxSize; - A_UINT32 Flags; /* flags to describe mbox behavior or usage */ -} HIF_DEVICE_MBOX_INFO; - -typedef enum { - HIF_DEVICE_IRQ_SYNC_ONLY, /* for HIF implementations that require the DSR to process all - interrupts before returning */ - HIF_DEVICE_IRQ_ASYNC_SYNC, /* for HIF implementations that allow DSR to process interrupts - using ASYNC I/O (that is HIFAckInterrupt can be called at a - later time */ -} HIF_DEVICE_IRQ_PROCESSING_MODE; - -typedef enum { - HIF_DEVICE_POWER_UP, /* HIF layer should power up interface and/or module */ - HIF_DEVICE_POWER_DOWN, /* HIF layer should initiate bus-specific measures to minimize power */ - HIF_DEVICE_POWER_CUT /* HIF layer should initiate bus-specific AND/OR platform-specific measures - to completely power-off the module and associated hardware (i.e. cut power supplies) - */ -} HIF_DEVICE_POWER_CHANGE_TYPE; - -typedef struct { - int RecvPacketYieldCount; /* max number of packets to force DSR to return */ -} HIF_DEVICE_IRQ_YIELD_PARAMS; - - -typedef struct _HIF_SCATTER_ITEM { - A_UINT8 *pBuffer; /* CPU accessible address of buffer */ - int Length; /* length of transfer to/from this buffer */ - void *pCallerContexts[2]; /* space for caller to insert a context associated with this item */ -} HIF_SCATTER_ITEM; - -struct _HIF_SCATTER_REQ; - -typedef void ( *HIF_SCATTER_COMP_CB)(struct _HIF_SCATTER_REQ *); - -typedef enum _HIF_SCATTER_METHOD { - HIF_SCATTER_NONE = 0, - HIF_SCATTER_DMA_REAL, /* Real SG support no restrictions */ - HIF_SCATTER_DMA_BOUNCE, /* Uses SG DMA but HIF layer uses an internal bounce buffer */ -} HIF_SCATTER_METHOD; - -typedef struct _HIF_SCATTER_REQ { - DL_LIST ListLink; /* link management */ - A_UINT32 Address; /* address for the read/write operation */ - A_UINT32 Request; /* request flags */ - A_UINT32 TotalLength; /* total length of entire transfer */ - A_UINT32 CallerFlags; /* caller specific flags can be stored here */ - HIF_SCATTER_COMP_CB CompletionRoutine; /* completion routine set by caller */ - A_STATUS CompletionStatus; /* status of completion */ - void *Context; /* caller context for this request */ - int ValidScatterEntries; /* number of valid entries set by caller */ - HIF_SCATTER_METHOD ScatterMethod; /* scatter method handled by HIF */ - void *HIFPrivate[4]; /* HIF private area */ - A_UINT8 *pScatterBounceBuffer; /* bounce buffer for upper layers to copy to/from */ - HIF_SCATTER_ITEM ScatterList[1]; /* start of scatter list */ -} HIF_SCATTER_REQ; - -typedef HIF_SCATTER_REQ * ( *HIF_ALLOCATE_SCATTER_REQUEST)(HIF_DEVICE *device); -typedef void ( *HIF_FREE_SCATTER_REQUEST)(HIF_DEVICE *device, HIF_SCATTER_REQ *request); -typedef A_STATUS ( *HIF_READWRITE_SCATTER)(HIF_DEVICE *device, HIF_SCATTER_REQ *request); - -typedef struct _HIF_DEVICE_SCATTER_SUPPORT_INFO { - /* information returned from HIF layer */ - HIF_ALLOCATE_SCATTER_REQUEST pAllocateReqFunc; - HIF_FREE_SCATTER_REQUEST pFreeReqFunc; - HIF_READWRITE_SCATTER pReadWriteScatterFunc; - int MaxScatterEntries; - int MaxTransferSizePerScatterReq; -} HIF_DEVICE_SCATTER_SUPPORT_INFO; - -typedef struct { - void *pOSDevice; -} HIF_DEVICE_OS_DEVICE_INFO; - -#define HIF_MAX_DEVICES 1 - -struct htc_callbacks { - void *context; /* context to pass to the dsrhandler - note : rwCompletionHandler is provided the context passed to HIFReadWrite */ - A_STATUS (* rwCompletionHandler)(void *rwContext, A_STATUS status); - A_STATUS (* dsrHandler)(void *context); -}; - -typedef struct osdrv_callbacks { - void *context; /* context to pass for all callbacks except deviceRemovedHandler - the deviceRemovedHandler is only called if the device is claimed */ - A_STATUS (* deviceInsertedHandler)(void *context, void *hif_handle); - A_STATUS (* deviceRemovedHandler)(void *claimedContext, void *hif_handle); - A_STATUS (* deviceSuspendHandler)(void *context); - A_STATUS (* deviceResumeHandler)(void *context); - A_STATUS (* deviceWakeupHandler)(void *context); - A_STATUS (* devicePowerChangeHandler)(void *context, HIF_DEVICE_POWER_CHANGE_TYPE config); -} OSDRV_CALLBACKS; - -#define HIF_OTHER_EVENTS (1 << 0) /* other interrupts (non-Recv) are pending, host - needs to read the register table to figure out what */ -#define HIF_RECV_MSG_AVAIL (1 << 1) /* pending recv packet */ - -typedef struct _HIF_PENDING_EVENTS_INFO { - A_UINT32 Events; - A_UINT32 LookAhead; - A_UINT32 AvailableRecvBytes; -} HIF_PENDING_EVENTS_INFO; - - /* function to get pending events , some HIF modules use special mechanisms - * to detect packet available and other interrupts */ -typedef A_STATUS ( *HIF_PENDING_EVENTS_FUNC)(HIF_DEVICE *device, - HIF_PENDING_EVENTS_INFO *pEvents, - void *AsyncContext); - -#define HIF_MASK_RECV TRUE -#define HIF_UNMASK_RECV FALSE - /* function to mask recv events */ -typedef A_STATUS ( *HIF_MASK_UNMASK_RECV_EVENT)(HIF_DEVICE *device, - A_BOOL Mask, - void *AsyncContext); - - -/* - * This API is used to perform any global initialization of the HIF layer - * and to set OS driver callbacks (i.e. insertion/removal) to the HIF layer - * - */ -A_STATUS HIFInit(OSDRV_CALLBACKS *callbacks); - -/* This API claims the HIF device and provides a context for handling removal. - * The device removal callback is only called when the OSDRV layer claims - * a device. The claimed context must be non-NULL */ -void HIFClaimDevice(HIF_DEVICE *device, void *claimedContext); -/* release the claimed device */ -void HIFReleaseDevice(HIF_DEVICE *device); - -/* This API allows the HTC layer to attach to the HIF device */ -A_STATUS HIFAttachHTC(HIF_DEVICE *device, HTC_CALLBACKS *callbacks); -/* This API detaches the HTC layer from the HIF device */ -void HIFDetachHTC(HIF_DEVICE *device); - -/* - * This API is used to provide the read/write interface over the specific bus - * interface. - * address - Starting address in the AR6000's address space. For mailbox - * writes, it refers to the start of the mbox boundary. It should - * be ensured that the last byte falls on the mailbox's EOM. For - * mailbox reads, it refers to the end of the mbox boundary. - * buffer - Pointer to the buffer containg the data to be transmitted or - * received. - * length - Amount of data to be transmitted or received. - * request - Characterizes the attributes of the command. - */ -A_STATUS -HIFReadWrite(HIF_DEVICE *device, - A_UINT32 address, - A_UCHAR *buffer, - A_UINT32 length, - A_UINT32 request, - void *context); - -/* - * This can be initiated from the unload driver context when the OSDRV layer has no more use for - * the device. - */ -void HIFShutDownDevice(HIF_DEVICE *device); - -/* - * This should translate to an acknowledgment to the bus driver indicating that - * the previous interrupt request has been serviced and the all the relevant - * sources have been cleared. HTC is ready to process more interrupts. - * This should prevent the bus driver from raising an interrupt unless the - * previous one has been serviced and acknowledged using the previous API. - */ -void HIFAckInterrupt(HIF_DEVICE *device); - -void HIFMaskInterrupt(HIF_DEVICE *device); - -void HIFUnMaskInterrupt(HIF_DEVICE *device); - -A_STATUS -HIFConfigureDevice(HIF_DEVICE *device, HIF_DEVICE_CONFIG_OPCODE opcode, - void *config, A_UINT32 configLen); - -/* - * This API wait for the remaining MBOX messages to be drained - * This should be moved to HTC AR6K layer - */ -A_STATUS hifWaitForPendingRecv(HIF_DEVICE *device); - -/****************************************************************/ -/* message based HIF interfaces */ -/****************************************************************/ - -#define HIF_BMI_EXCHANGE_NO_TIMEOUT ((A_UINT32)(0)) - -struct _HIF_MSG_OBJ; - -typedef void (* HIF_MSG_RECV_CALLBACK)(void *, struct _HIF_MSG_OBJ *); -typedef void (* HIF_MSG_REQ_COMPLETION)(void *,struct _HIF_MSG_OBJ *); - -typedef enum { - HIF_MSG_SIMPLE_BUFFER = 0, /* a simple buffer ptr and length */ - HIF_MSG_NET_BUFFER = 1 /* advanced OS-specific network buffer */ -} HIF_MSG_BUFFER_TYPE; - - /* object to pass HIF message requests from upper layers */ -typedef struct _HIF_MSG_OBJ { - DL_LIST ListLink; /* for list management */ - A_INT32 PipeId; /* pipe number to send on or recv'd from*/ - HIF_MSG_BUFFER_TYPE BufferType; - union { - struct HIF_MSG_NET_BUFFER { - void *pAppNetBuf; /* OS-specific net buf */ - } AsNetBuffer; - struct HIF_MSG_SIMPLE_BUFFER { - void *pBuffer; /* for future use.... */ - A_UINT32 Length; - } AsSimpleBuffer; - } BufferInfo; - void *pContext; /* caller context of message */ - HIF_MSG_REQ_COMPLETION CompletionRoutine; /* completion routine */ - A_STATUS Status; /* completion status */ - A_UINT32 Flags; /* request flags */ - void *HIFPriv[4]; /* private contexts for HIF layer to use */ - -} HIF_MSG_OBJ; - - /* API to handle HIF-specific BMI message exchanges, this API is synchronous - * and only allowed to be called from a context that can block (sleep) */ -A_STATUS HIFExchangeBMIMsg(HIF_DEVICE *device, - A_UINT8 *pSendMessage, - A_UINT32 Length, - A_UINT8 *pResponseMessage, - A_UINT32 *pResponseLength, - A_UINT32 TimeoutMS); - - /* API to handle HIF specific diagnostic window read accesses, this API is synchronous - * and only allowed to be called from a context that can block (sleep) */ -A_STATUS HIFDiagReadAccess(HIF_DEVICE *hifDevice, A_UINT32 address, A_UINT32 *data); - - /* API to handle HIF specific diagnostic window write accesses, this API is synchronous - * and only allowed to be called from a context that can block (sleep) */ -A_STATUS HIFDiagWriteAccess(HIF_DEVICE *hifDevice, A_UINT32 address, A_UINT32 data); - - /* get the Pipe ID associated with the service ID */ -A_STATUS HIFGetPipeId(HIF_DEVICE *hifDevice, A_UINT16 ServiceId, A_INT32 *pId); - - /* API to let HIF layer know that pipe communications should be enabled - * caller will start to exchange messages on service pipes */ -A_STATUS HIFEnablePipes(HIF_DEVICE *hifDevice); - - /* set the message recv handler for all incomming messages */ -void HIFSetMsgRecvHandler(HIF_DEVICE *hifDevice, - HIF_MSG_RECV_CALLBACK Callback, - void *pContext); - - /* upper layers should return the HIF_MSG_OBJ back to HIF as it may be associated - * with some recv resource. The objects could be returned in a chain (batch mode) - * Note, upper layers can take ownership of the buffer (free it) if it is of the type - * HIF_MSG_NET_BUFFER, in this case upper layers will set - * BufferInfo.AsNetBuffer.pAppNetBuf to NULL */ -void HIFReturnRecvMsgObjects(HIF_DEVICE *hifDevice, HIF_MSG_OBJ *pMessageObj); - - /* API for upper layers to send one or more messages. Note, HIF may - * take ownership of the buffer (it will free it) if it is of the type - * HIF_MSG_NET_BUFFER, in this case the HIF layer will set - * BufferInfo.AsNetBuffer.pAppNetBuf to NULL */ -A_STATUS HIFSendMessages(HIF_DEVICE *hifDevice, HIF_MSG_OBJ *pMessages); - - -#ifdef __cplusplus -} -#endif - -#endif /* _HIF_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/host_reg_table.h b/drivers/net/wireless/ar6003/host/include/host_reg_table.h deleted file mode 100644 index a664cd826f31..000000000000 --- a/drivers/net/wireless/ar6003/host/include/host_reg_table.h +++ /dev/null @@ -1,226 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2008 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Target register table macros and structure definitions -// -// Author(s): ="Atheros" -//============================================================================== - -#ifndef HOST_REG_TABLE_H_ -#define HOST_REG_TABLE_H_ - -#include "targaddrs.h" -/*** WARNING : Add to the end of the TABLE! do not change the order ****/ -typedef struct hostdef_s { - A_UINT32 d_INT_STATUS_ENABLE_ERROR_LSB; - A_UINT32 d_INT_STATUS_ENABLE_ERROR_MASK; - A_UINT32 d_INT_STATUS_ENABLE_CPU_LSB; - A_UINT32 d_INT_STATUS_ENABLE_CPU_MASK; - A_UINT32 d_INT_STATUS_ENABLE_COUNTER_LSB; - A_UINT32 d_INT_STATUS_ENABLE_COUNTER_MASK; - A_UINT32 d_INT_STATUS_ENABLE_MBOX_DATA_LSB; - A_UINT32 d_INT_STATUS_ENABLE_MBOX_DATA_MASK; - A_UINT32 d_ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB; - A_UINT32 d_ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK; - A_UINT32 d_ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB; - A_UINT32 d_ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK; - A_UINT32 d_COUNTER_INT_STATUS_ENABLE_BIT_LSB; - A_UINT32 d_COUNTER_INT_STATUS_ENABLE_BIT_MASK; - A_UINT32 d_INT_STATUS_ENABLE_ADDRESS; - A_UINT32 d_CPU_INT_STATUS_ENABLE_BIT_LSB; - A_UINT32 d_CPU_INT_STATUS_ENABLE_BIT_MASK; - A_UINT32 d_HOST_INT_STATUS_ADDRESS; - A_UINT32 d_CPU_INT_STATUS_ADDRESS; - A_UINT32 d_ERROR_INT_STATUS_ADDRESS; - A_UINT32 d_ERROR_INT_STATUS_WAKEUP_MASK; - A_UINT32 d_ERROR_INT_STATUS_WAKEUP_LSB; - A_UINT32 d_ERROR_INT_STATUS_RX_UNDERFLOW_MASK; - A_UINT32 d_ERROR_INT_STATUS_RX_UNDERFLOW_LSB; - A_UINT32 d_ERROR_INT_STATUS_TX_OVERFLOW_MASK; - A_UINT32 d_ERROR_INT_STATUS_TX_OVERFLOW_LSB; - A_UINT32 d_COUNT_DEC_ADDRESS; - A_UINT32 d_HOST_INT_STATUS_CPU_MASK; - A_UINT32 d_HOST_INT_STATUS_CPU_LSB; - A_UINT32 d_HOST_INT_STATUS_ERROR_MASK; - A_UINT32 d_HOST_INT_STATUS_ERROR_LSB; - A_UINT32 d_HOST_INT_STATUS_COUNTER_MASK; - A_UINT32 d_HOST_INT_STATUS_COUNTER_LSB; - A_UINT32 d_RX_LOOKAHEAD_VALID_ADDRESS; - A_UINT32 d_WINDOW_DATA_ADDRESS; - A_UINT32 d_WINDOW_READ_ADDR_ADDRESS; - A_UINT32 d_WINDOW_WRITE_ADDR_ADDRESS; -} HOST_REGISTER_TABLE; - -#if defined(MY_HOST_DEF) /* { */ -#if defined(ATHR_WIN_DEF) -#define ATH_REG_TABLE_DIRECT_ASSIGN -#endif -#ifdef ATH_REG_TABLE_DIRECT_ASSIGN - -static struct hostdef_s my_host_def = { - INT_STATUS_ENABLE_ERROR_LSB, - INT_STATUS_ENABLE_ERROR_MASK, - INT_STATUS_ENABLE_CPU_LSB, - INT_STATUS_ENABLE_CPU_MASK, - INT_STATUS_ENABLE_COUNTER_LSB, - INT_STATUS_ENABLE_COUNTER_MASK, - INT_STATUS_ENABLE_MBOX_DATA_LSB, - INT_STATUS_ENABLE_MBOX_DATA_MASK, - ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB, - ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK, - ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB, - ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK, - COUNTER_INT_STATUS_ENABLE_BIT_LSB, - COUNTER_INT_STATUS_ENABLE_BIT_MASK, - INT_STATUS_ENABLE_ADDRESS, - CPU_INT_STATUS_ENABLE_BIT_LSB, - CPU_INT_STATUS_ENABLE_BIT_MASK, - HOST_INT_STATUS_ADDRESS, - CPU_INT_STATUS_ADDRESS, - ERROR_INT_STATUS_ADDRESS, - ERROR_INT_STATUS_WAKEUP_MASK, - ERROR_INT_STATUS_WAKEUP_LSB, - ERROR_INT_STATUS_RX_UNDERFLOW_MASK, - ERROR_INT_STATUS_RX_UNDERFLOW_LSB, - ERROR_INT_STATUS_TX_OVERFLOW_MASK, - ERROR_INT_STATUS_TX_OVERFLOW_LSB, - COUNT_DEC_ADDRESS, - HOST_INT_STATUS_CPU_MASK, - HOST_INT_STATUS_CPU_LSB, - HOST_INT_STATUS_ERROR_MASK, - HOST_INT_STATUS_ERROR_LSB, - HOST_INT_STATUS_COUNTER_MASK, - HOST_INT_STATUS_COUNTER_LSB, - RX_LOOKAHEAD_VALID_ADDRESS, - WINDOW_DATA_ADDRESS, - WINDOW_READ_ADDR_ADDRESS, - WINDOW_WRITE_ADDR_ADDRESS, -}; - -#else - -static struct hostdef_s my_host_def = { - .d_INT_STATUS_ENABLE_ERROR_LSB = INT_STATUS_ENABLE_ERROR_LSB, - .d_INT_STATUS_ENABLE_ERROR_MASK = INT_STATUS_ENABLE_ERROR_MASK, - .d_INT_STATUS_ENABLE_CPU_LSB = INT_STATUS_ENABLE_CPU_LSB, - .d_INT_STATUS_ENABLE_CPU_MASK = INT_STATUS_ENABLE_CPU_MASK, - .d_INT_STATUS_ENABLE_COUNTER_LSB = INT_STATUS_ENABLE_COUNTER_LSB, - .d_INT_STATUS_ENABLE_COUNTER_MASK = INT_STATUS_ENABLE_COUNTER_MASK, - .d_INT_STATUS_ENABLE_MBOX_DATA_LSB = INT_STATUS_ENABLE_MBOX_DATA_LSB, - .d_INT_STATUS_ENABLE_MBOX_DATA_MASK = INT_STATUS_ENABLE_MBOX_DATA_MASK, - .d_ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB = ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB, - .d_ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK = ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK, - .d_ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB = ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB, - .d_ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK = ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK, - .d_COUNTER_INT_STATUS_ENABLE_BIT_LSB = COUNTER_INT_STATUS_ENABLE_BIT_LSB, - .d_COUNTER_INT_STATUS_ENABLE_BIT_MASK = COUNTER_INT_STATUS_ENABLE_BIT_MASK, - .d_INT_STATUS_ENABLE_ADDRESS = INT_STATUS_ENABLE_ADDRESS, - .d_CPU_INT_STATUS_ENABLE_BIT_LSB = CPU_INT_STATUS_ENABLE_BIT_LSB, - .d_CPU_INT_STATUS_ENABLE_BIT_MASK = CPU_INT_STATUS_ENABLE_BIT_MASK, - .d_HOST_INT_STATUS_ADDRESS = HOST_INT_STATUS_ADDRESS, - .d_CPU_INT_STATUS_ADDRESS = CPU_INT_STATUS_ADDRESS, - .d_ERROR_INT_STATUS_ADDRESS = ERROR_INT_STATUS_ADDRESS, - .d_ERROR_INT_STATUS_WAKEUP_MASK = ERROR_INT_STATUS_WAKEUP_MASK, - .d_ERROR_INT_STATUS_WAKEUP_LSB = ERROR_INT_STATUS_WAKEUP_LSB, - .d_ERROR_INT_STATUS_RX_UNDERFLOW_MASK = ERROR_INT_STATUS_RX_UNDERFLOW_MASK, - .d_ERROR_INT_STATUS_RX_UNDERFLOW_LSB = ERROR_INT_STATUS_RX_UNDERFLOW_LSB, - .d_ERROR_INT_STATUS_TX_OVERFLOW_MASK = ERROR_INT_STATUS_TX_OVERFLOW_MASK, - .d_ERROR_INT_STATUS_TX_OVERFLOW_LSB = ERROR_INT_STATUS_TX_OVERFLOW_LSB, - .d_COUNT_DEC_ADDRESS = COUNT_DEC_ADDRESS, - .d_HOST_INT_STATUS_CPU_MASK = HOST_INT_STATUS_CPU_MASK, - .d_HOST_INT_STATUS_CPU_LSB = HOST_INT_STATUS_CPU_LSB, - .d_HOST_INT_STATUS_ERROR_MASK = HOST_INT_STATUS_ERROR_MASK, - .d_HOST_INT_STATUS_ERROR_LSB = HOST_INT_STATUS_ERROR_LSB, - .d_HOST_INT_STATUS_COUNTER_MASK = HOST_INT_STATUS_COUNTER_MASK, - .d_HOST_INT_STATUS_COUNTER_LSB = HOST_INT_STATUS_COUNTER_LSB, - .d_RX_LOOKAHEAD_VALID_ADDRESS = RX_LOOKAHEAD_VALID_ADDRESS, - .d_WINDOW_DATA_ADDRESS = WINDOW_DATA_ADDRESS, - .d_WINDOW_READ_ADDR_ADDRESS = WINDOW_READ_ADDR_ADDRESS, - .d_WINDOW_WRITE_ADDR_ADDRESS = WINDOW_WRITE_ADDR_ADDRESS, -}; - -#endif - -struct hostdef_s *MY_HOST_DEF = &my_host_def; - -#else /* } { */ - -#define INT_STATUS_ENABLE_ERROR_LSB (hostdef->d_INT_STATUS_ENABLE_ERROR_LSB) -#define INT_STATUS_ENABLE_ERROR_MASK (hostdef->d_INT_STATUS_ENABLE_ERROR_MASK) -#define INT_STATUS_ENABLE_CPU_LSB (hostdef->d_INT_STATUS_ENABLE_CPU_LSB) -#define INT_STATUS_ENABLE_CPU_MASK (hostdef->d_INT_STATUS_ENABLE_CPU_MASK) -#define INT_STATUS_ENABLE_COUNTER_LSB (hostdef->d_INT_STATUS_ENABLE_COUNTER_LSB) -#define INT_STATUS_ENABLE_COUNTER_MASK (hostdef->d_INT_STATUS_ENABLE_COUNTER_MASK) -#define INT_STATUS_ENABLE_MBOX_DATA_LSB (hostdef->d_INT_STATUS_ENABLE_MBOX_DATA_LSB) -#define INT_STATUS_ENABLE_MBOX_DATA_MASK (hostdef->d_INT_STATUS_ENABLE_MBOX_DATA_MASK) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB (hostdef->d_ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK (hostdef->d_ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB (hostdef->d_ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK (hostdef->d_ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) -#define COUNTER_INT_STATUS_ENABLE_BIT_LSB (hostdef->d_COUNTER_INT_STATUS_ENABLE_BIT_LSB) -#define COUNTER_INT_STATUS_ENABLE_BIT_MASK (hostdef->d_COUNTER_INT_STATUS_ENABLE_BIT_MASK) -#define INT_STATUS_ENABLE_ADDRESS (hostdef->d_INT_STATUS_ENABLE_ADDRESS) -#define CPU_INT_STATUS_ENABLE_BIT_LSB (hostdef->d_CPU_INT_STATUS_ENABLE_BIT_LSB) -#define CPU_INT_STATUS_ENABLE_BIT_MASK (hostdef->d_CPU_INT_STATUS_ENABLE_BIT_MASK) -#define HOST_INT_STATUS_ADDRESS (hostdef->d_HOST_INT_STATUS_ADDRESS) -#define CPU_INT_STATUS_ADDRESS (hostdef->d_CPU_INT_STATUS_ADDRESS) -#define ERROR_INT_STATUS_ADDRESS (hostdef->d_ERROR_INT_STATUS_ADDRESS) -#define ERROR_INT_STATUS_WAKEUP_MASK (hostdef->d_ERROR_INT_STATUS_WAKEUP_MASK) -#define ERROR_INT_STATUS_WAKEUP_LSB (hostdef->d_ERROR_INT_STATUS_WAKEUP_LSB) -#define ERROR_INT_STATUS_RX_UNDERFLOW_MASK (hostdef->d_ERROR_INT_STATUS_RX_UNDERFLOW_MASK) -#define ERROR_INT_STATUS_RX_UNDERFLOW_LSB (hostdef->d_ERROR_INT_STATUS_RX_UNDERFLOW_LSB) -#define ERROR_INT_STATUS_TX_OVERFLOW_MASK (hostdef->d_ERROR_INT_STATUS_TX_OVERFLOW_MASK) -#define ERROR_INT_STATUS_TX_OVERFLOW_LSB (hostdef->d_ERROR_INT_STATUS_TX_OVERFLOW_LSB) -#define COUNT_DEC_ADDRESS (hostdef->d_COUNT_DEC_ADDRESS) -#define HOST_INT_STATUS_CPU_MASK (hostdef->d_HOST_INT_STATUS_CPU_MASK) -#define HOST_INT_STATUS_CPU_LSB (hostdef->d_HOST_INT_STATUS_CPU_LSB) -#define HOST_INT_STATUS_ERROR_MASK (hostdef->d_HOST_INT_STATUS_ERROR_MASK) -#define HOST_INT_STATUS_ERROR_LSB (hostdef->d_HOST_INT_STATUS_ERROR_LSB) -#define HOST_INT_STATUS_COUNTER_MASK (hostdef->d_HOST_INT_STATUS_COUNTER_MASK) -#define HOST_INT_STATUS_COUNTER_LSB (hostdef->d_HOST_INT_STATUS_COUNTER_LSB) -#define RX_LOOKAHEAD_VALID_ADDRESS (hostdef->d_RX_LOOKAHEAD_VALID_ADDRESS) -#define WINDOW_DATA_ADDRESS (hostdef->d_WINDOW_DATA_ADDRESS) -#define WINDOW_READ_ADDR_ADDRESS (hostdef->d_WINDOW_READ_ADDR_ADDRESS) -#define WINDOW_WRITE_ADDR_ADDRESS (hostdef->d_WINDOW_WRITE_ADDR_ADDRESS) - -/* SET macros */ -#define INT_STATUS_ENABLE_ERROR_SET(x) (((x) << INT_STATUS_ENABLE_ERROR_LSB) & INT_STATUS_ENABLE_ERROR_MASK) -#define INT_STATUS_ENABLE_CPU_SET(x) (((x) << INT_STATUS_ENABLE_CPU_LSB) & INT_STATUS_ENABLE_CPU_MASK) -#define INT_STATUS_ENABLE_COUNTER_SET(x) (((x) << INT_STATUS_ENABLE_COUNTER_LSB) & INT_STATUS_ENABLE_COUNTER_MASK) -#define INT_STATUS_ENABLE_MBOX_DATA_SET(x) (((x) << INT_STATUS_ENABLE_MBOX_DATA_LSB) & INT_STATUS_ENABLE_MBOX_DATA_MASK) -#define CPU_INT_STATUS_ENABLE_BIT_SET(x) (((x) << CPU_INT_STATUS_ENABLE_BIT_LSB) & CPU_INT_STATUS_ENABLE_BIT_MASK) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_SET(x) (((x) << ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) & ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_SET(x) (((x) << ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) & ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) -#define COUNTER_INT_STATUS_ENABLE_BIT_SET(x) (((x) << COUNTER_INT_STATUS_ENABLE_BIT_LSB) & COUNTER_INT_STATUS_ENABLE_BIT_MASK) -#define ERROR_INT_STATUS_WAKEUP_GET(x) (((x) & ERROR_INT_STATUS_WAKEUP_MASK) >> ERROR_INT_STATUS_WAKEUP_LSB) -#define ERROR_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & ERROR_INT_STATUS_RX_UNDERFLOW_MASK) >> ERROR_INT_STATUS_RX_UNDERFLOW_LSB) -#define ERROR_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & ERROR_INT_STATUS_TX_OVERFLOW_MASK) >> ERROR_INT_STATUS_TX_OVERFLOW_LSB) -#define HOST_INT_STATUS_CPU_GET(x) (((x) & HOST_INT_STATUS_CPU_MASK) >> HOST_INT_STATUS_CPU_LSB) -#define HOST_INT_STATUS_ERROR_GET(x) (((x) & HOST_INT_STATUS_ERROR_MASK) >> HOST_INT_STATUS_ERROR_LSB) -#define HOST_INT_STATUS_COUNTER_GET(x) (((x) & HOST_INT_STATUS_COUNTER_MASK) >> HOST_INT_STATUS_COUNTER_LSB) - - -extern struct hostdef_s *hostdef; - -#endif /* } */ - -#endif /*HOST_REG_TABLE_H_*/ - - diff --git a/drivers/net/wireless/ar6003/host/include/host_version.h b/drivers/net/wireless/ar6003/host/include/host_version.h deleted file mode 100644 index 74f1982c681b..000000000000 --- a/drivers/net/wireless/ar6003/host/include/host_version.h +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file contains version information for the sample host driver for the -// AR6000 chip -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _HOST_VERSION_H_ -#define _HOST_VERSION_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* - * The version number is made up of major, minor, patch and build - * numbers. These are 16 bit numbers. The build and release script will - * set the build number using a Perforce counter. Here the build number is - * set to 9999 so that builds done without the build-release script are easily - * identifiable. - */ - -#define ATH_SW_VER_MAJOR __VER_MAJOR_ -#define ATH_SW_VER_MINOR __VER_MINOR_ -#define ATH_SW_VER_PATCH __VER_PATCH_ -#define ATH_SW_VER_BUILD __BUILD_NUMBER_ - -#ifdef __cplusplus -} -#endif - -#endif /* _HOST_VERSION_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/htc_api.h b/drivers/net/wireless/ar6003/host/include/htc_api.h deleted file mode 100644 index b007051e0551..000000000000 --- a/drivers/net/wireless/ar6003/host/include/htc_api.h +++ /dev/null @@ -1,575 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#ifndef _HTC_API_H_ -#define _HTC_API_H_ - -#include "htc_packet.h" -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* TODO.. for BMI */ -#define ENDPOINT1 0 -// TODO -remove me, but we have to fix BMI first -#define HTC_MAILBOX_NUM_MAX 4 - -/* this is the amount of header room required by users of HTC */ -#define HTC_HEADER_LEN HTC_HDR_LENGTH - -typedef void *HTC_HANDLE; - -typedef A_UINT16 HTC_SERVICE_ID; - -typedef struct _HTC_INIT_INFO { - void *pContext; /* context for target failure notification */ - void (*TargetFailure)(void *Instance, A_STATUS Status); -} HTC_INIT_INFO; - -/* per service connection send completion */ -typedef void (*HTC_EP_SEND_PKT_COMPLETE)(void *,HTC_PACKET *); -/* per service connection callback when a plurality of packets have been sent - * The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from the callback) - * to hold a list of completed send packets. - * If the handler cannot fully traverse the packet queue before returning, it should - * transfer the items of the queue into the caller's private queue using: - * HTC_PACKET_ENQUEUE() */ -typedef void (*HTC_EP_SEND_PKT_COMP_MULTIPLE)(void *,HTC_PACKET_QUEUE *); -/* per service connection pkt received */ -typedef void (*HTC_EP_RECV_PKT)(void *,HTC_PACKET *); -/* per service connection callback when a plurality of packets are received - * The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from the callback) - * to hold a list of recv packets. - * If the handler cannot fully traverse the packet queue before returning, it should - * transfer the items of the queue into the caller's private queue using: - * HTC_PACKET_ENQUEUE() */ -typedef void (*HTC_EP_RECV_PKT_MULTIPLE)(void *,HTC_PACKET_QUEUE *); - -/* Optional per service connection receive buffer re-fill callback, - * On some OSes (like Linux) packets are allocated from a global pool and indicated up - * to the network stack. The driver never gets the packets back from the OS. For these OSes - * a refill callback can be used to allocate and re-queue buffers into HTC. - * - * On other OSes, the network stack can call into the driver's OS-specifc "return_packet" handler and - * the driver can re-queue these buffers into HTC. In this regard a refill callback is - * unnecessary */ -typedef void (*HTC_EP_RECV_REFILL)(void *, HTC_ENDPOINT_ID Endpoint); - -/* Optional per service connection receive buffer allocation callback. - * On some systems packet buffers are an extremely limited resource. Rather than - * queue largest-possible-sized buffers to HTC, some systems would rather - * allocate a specific size as the packet is received. The trade off is - * slightly more processing (callback invoked for each RX packet) - * for the benefit of committing fewer buffer resources into HTC. - * - * The callback is provided the length of the pending packet to fetch. This includes the - * HTC header length plus the length of payload. The callback can return a pointer to - * the allocated HTC packet for immediate use. - * - * Alternatively a variant of this handler can be used to allocate large receive packets as needed. - * For example an application can use the refill mechanism for normal packets and the recv-alloc mechanism to - * handle the case where a large packet buffer is required. This can significantly reduce the - * amount of "committed" memory used to receive packets. - * - * */ -typedef HTC_PACKET *(*HTC_EP_RECV_ALLOC)(void *, HTC_ENDPOINT_ID Endpoint, int Length); - -typedef enum _HTC_SEND_FULL_ACTION { - HTC_SEND_FULL_KEEP = 0, /* packet that overflowed should be kept in the queue */ - HTC_SEND_FULL_DROP = 1, /* packet that overflowed should be dropped */ -} HTC_SEND_FULL_ACTION; - -/* Optional per service connection callback when a send queue is full. This can occur if the - * host continues queueing up TX packets faster than credits can arrive - * To prevent the host (on some Oses like Linux) from continuously queueing packets - * and consuming resources, this callback is provided so that that the host - * can disable TX in the subsystem (i.e. network stack). - * This callback is invoked for each packet that "overflows" the HTC queue. The callback can - * determine whether the new packet that overflowed the queue can be kept (HTC_SEND_FULL_KEEP) or - * dropped (HTC_SEND_FULL_DROP). If a packet is dropped, the EpTxComplete handler will be called - * and the packet's status field will be set to A_NO_RESOURCE. - * Other OSes require a "per-packet" indication for each completed TX packet, this - * closed loop mechanism will prevent the network stack from overunning the NIC - * The packet to keep or drop is passed for inspection to the registered handler the handler - * must ONLY inspect the packet, it may not free or reclaim the packet. */ -typedef HTC_SEND_FULL_ACTION (*HTC_EP_SEND_QUEUE_FULL)(void *, HTC_PACKET *pPacket); - -typedef struct _HTC_EP_CALLBACKS { - void *pContext; /* context for each callback */ - HTC_EP_SEND_PKT_COMPLETE EpTxComplete; /* tx completion callback for connected endpoint */ - HTC_EP_RECV_PKT EpRecv; /* receive callback for connected endpoint */ - HTC_EP_RECV_REFILL EpRecvRefill; /* OPTIONAL receive re-fill callback for connected endpoint */ - HTC_EP_SEND_QUEUE_FULL EpSendFull; /* OPTIONAL send full callback */ - HTC_EP_RECV_ALLOC EpRecvAlloc; /* OPTIONAL recv allocation callback */ - HTC_EP_RECV_ALLOC EpRecvAllocThresh; /* OPTIONAL recv allocation callback based on a threshold */ - HTC_EP_SEND_PKT_COMP_MULTIPLE EpTxCompleteMultiple; /* OPTIONAL completion handler for multiple complete - indications (EpTxComplete must be NULL) */ - HTC_EP_RECV_PKT_MULTIPLE EpRecvPktMultiple; /* OPTIONAL completion handler for multiple - recv packet indications (EpRecv must be NULL) */ - int RecvAllocThreshold; /* if EpRecvAllocThresh is non-NULL, HTC will compare the - threshold value to the current recv packet length and invoke - the EpRecvAllocThresh callback to acquire a packet buffer */ - int RecvRefillWaterMark; /* if a EpRecvRefill handler is provided, this value - can be used to set a trigger refill callback - when the recv queue drops below this value - if set to 0, the refill is only called when packets - are empty */ -} HTC_EP_CALLBACKS; - -/* service connection information */ -typedef struct _HTC_SERVICE_CONNECT_REQ { - HTC_SERVICE_ID ServiceID; /* service ID to connect to */ - A_UINT16 ConnectionFlags; /* connection flags, see htc protocol definition */ - A_UINT8 *pMetaData; /* ptr to optional service-specific meta-data */ - A_UINT8 MetaDataLength; /* optional meta data length */ - HTC_EP_CALLBACKS EpCallbacks; /* endpoint callbacks */ - int MaxSendQueueDepth; /* maximum depth of any send queue */ - A_UINT32 LocalConnectionFlags; /* HTC flags for the host-side (local) connection */ - unsigned int MaxSendMsgSize; /* override max message size in send direction */ -} HTC_SERVICE_CONNECT_REQ; - -#define HTC_LOCAL_CONN_FLAGS_ENABLE_SEND_BUNDLE_PADDING (1 << 0) /* enable send bundle padding for this endpoint */ - -/* service connection response information */ -typedef struct _HTC_SERVICE_CONNECT_RESP { - A_UINT8 *pMetaData; /* caller supplied buffer to optional meta-data */ - A_UINT8 BufferLength; /* length of caller supplied buffer */ - A_UINT8 ActualLength; /* actual length of meta data */ - HTC_ENDPOINT_ID Endpoint; /* endpoint to communicate over */ - unsigned int MaxMsgLength; /* max length of all messages over this endpoint */ - A_UINT8 ConnectRespCode; /* connect response code from target */ -} HTC_SERVICE_CONNECT_RESP; - -/* endpoint distribution structure */ -typedef struct _HTC_ENDPOINT_CREDIT_DIST { - struct _HTC_ENDPOINT_CREDIT_DIST *pNext; - struct _HTC_ENDPOINT_CREDIT_DIST *pPrev; - HTC_SERVICE_ID ServiceID; /* Service ID (set by HTC) */ - HTC_ENDPOINT_ID Endpoint; /* endpoint for this distribution struct (set by HTC) */ - A_UINT32 DistFlags; /* distribution flags, distribution function can - set default activity using SET_EP_ACTIVE() macro */ - int TxCreditsNorm; /* credits for normal operation, anything above this - indicates the endpoint is over-subscribed, this field - is only relevant to the credit distribution function */ - int TxCreditsMin; /* floor for credit distribution, this field is - only relevant to the credit distribution function */ - int TxCreditsAssigned; /* number of credits assigned to this EP, this field - is only relevant to the credit dist function */ - int TxCredits; /* current credits available, this field is used by - HTC to determine whether a message can be sent or - must be queued */ - int TxCreditsToDist; /* pending credits to distribute on this endpoint, this - is set by HTC when credit reports arrive. - The credit distribution functions sets this to zero - when it distributes the credits */ - int TxCreditsSeek; /* this is the number of credits that the current pending TX - packet needs to transmit. This is set by HTC when - and endpoint needs credits in order to transmit */ - int TxCreditSize; /* size in bytes of each credit (set by HTC) */ - int TxCreditsPerMaxMsg; /* credits required for a maximum sized messages (set by HTC) */ - void *pHTCReserved; /* reserved for HTC use */ - int TxQueueDepth; /* current depth of TX queue , i.e. messages waiting for credits - This field is valid only when HTC_CREDIT_DIST_ACTIVITY_CHANGE - or HTC_CREDIT_DIST_SEND_COMPLETE is indicated on an endpoint - that has non-zero credits to recover - */ -} HTC_ENDPOINT_CREDIT_DIST; - -#define HTC_EP_ACTIVE ((A_UINT32) (1u << 31)) - -/* macro to check if an endpoint has gone active, useful for credit - * distributions */ -#define IS_EP_ACTIVE(epDist) ((epDist)->DistFlags & HTC_EP_ACTIVE) -#define SET_EP_ACTIVE(epDist) (epDist)->DistFlags |= HTC_EP_ACTIVE - - /* credit distibution code that is passed into the distrbution function, - * there are mandatory and optional codes that must be handled */ -typedef enum _HTC_CREDIT_DIST_REASON { - HTC_CREDIT_DIST_SEND_COMPLETE = 0, /* credits available as a result of completed - send operations (MANDATORY) resulting in credit reports */ - HTC_CREDIT_DIST_ACTIVITY_CHANGE = 1, /* a change in endpoint activity occured (OPTIONAL) */ - HTC_CREDIT_DIST_SEEK_CREDITS, /* an endpoint needs to "seek" credits (OPTIONAL) */ - HTC_DUMP_CREDIT_STATE /* for debugging, dump any state information that is kept by - the distribution function */ -} HTC_CREDIT_DIST_REASON; - -typedef void (*HTC_CREDIT_DIST_CALLBACK)(void *Context, - HTC_ENDPOINT_CREDIT_DIST *pEPList, - HTC_CREDIT_DIST_REASON Reason); - -typedef void (*HTC_CREDIT_INIT_CALLBACK)(void *Context, - HTC_ENDPOINT_CREDIT_DIST *pEPList, - int TotalCredits); - - /* endpoint statistics action */ -typedef enum _HTC_ENDPOINT_STAT_ACTION { - HTC_EP_STAT_SAMPLE = 0, /* only read statistics */ - HTC_EP_STAT_SAMPLE_AND_CLEAR = 1, /* sample and immediately clear statistics */ - HTC_EP_STAT_CLEAR /* clear only */ -} HTC_ENDPOINT_STAT_ACTION; - - /* endpoint statistics */ -typedef struct _HTC_ENDPOINT_STATS { - A_UINT32 TxCreditLowIndications; /* number of times the host set the credit-low flag in a send message on - this endpoint */ - A_UINT32 TxIssued; /* running count of total TX packets issued */ - A_UINT32 TxPacketsBundled; /* running count of TX packets that were issued in bundles */ - A_UINT32 TxBundles; /* running count of TX bundles that were issued */ - A_UINT32 TxDropped; /* tx packets that were dropped */ - A_UINT32 TxCreditRpts; /* running count of total credit reports received for this endpoint */ - A_UINT32 TxCreditRptsFromRx; /* credit reports received from this endpoint's RX packets */ - A_UINT32 TxCreditRptsFromOther; /* credit reports received from RX packets of other endpoints */ - A_UINT32 TxCreditRptsFromEp0; /* credit reports received from endpoint 0 RX packets */ - A_UINT32 TxCreditsFromRx; /* count of credits received via Rx packets on this endpoint */ - A_UINT32 TxCreditsFromOther; /* count of credits received via another endpoint */ - A_UINT32 TxCreditsFromEp0; /* count of credits received via another endpoint */ - A_UINT32 TxCreditsConsummed; /* count of consummed credits */ - A_UINT32 TxCreditsReturned; /* count of credits returned */ - A_UINT32 RxReceived; /* count of RX packets received */ - A_UINT32 RxLookAheads; /* count of lookahead records - found in messages received on this endpoint */ - A_UINT32 RxPacketsBundled; /* count of recv packets received in a bundle */ - A_UINT32 RxBundleLookAheads; /* count of number of bundled lookaheads */ - A_UINT32 RxBundleIndFromHdr; /* count of the number of bundle indications from the HTC header */ - A_UINT32 RxAllocThreshHit; /* count of the number of times the recv allocation threshhold was hit */ - A_UINT32 RxAllocThreshBytes; /* total number of bytes */ -} HTC_ENDPOINT_STATS; - -/* ------ Function Prototypes ------ */ -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Create an instance of HTC over the underlying HIF device - @function name: HTCCreate - @input: HifDevice - hif device handle, - pInfo - initialization information - @output: - @return: HTC_HANDLE on success, NULL on failure - @notes: - @example: - @see also: HTCDestroy -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -HTC_HANDLE HTCCreate(void *HifDevice, HTC_INIT_INFO *pInfo); -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Get the underlying HIF device handle - @function name: HTCGetHifDevice - @input: HTCHandle - handle passed into the AddInstance callback - @output: - @return: opaque HIF device handle usable in HIF API calls. - @notes: - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -void *HTCGetHifDevice(HTC_HANDLE HTCHandle); -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Set credit distribution parameters - @function name: HTCSetCreditDistribution - @input: HTCHandle - HTC handle - pCreditDistCont - caller supplied context to pass into distribution functions - CreditDistFunc - Distribution function callback - CreditDistInit - Credit Distribution initialization callback - ServicePriorityOrder - Array containing list of service IDs, lowest index is highest - priority - ListLength - number of elements in ServicePriorityOrder - @output: - @return: - @notes: The user can set a custom credit distribution function to handle special requirements - for each endpoint. A default credit distribution routine can be used by setting - CreditInitFunc to NULL. The default credit distribution is only provided for simple - "fair" credit distribution without regard to any prioritization. - - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -void HTCSetCreditDistribution(HTC_HANDLE HTCHandle, - void *pCreditDistContext, - HTC_CREDIT_DIST_CALLBACK CreditDistFunc, - HTC_CREDIT_INIT_CALLBACK CreditInitFunc, - HTC_SERVICE_ID ServicePriorityOrder[], - int ListLength); -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Wait for the target to indicate the HTC layer is ready - @function name: HTCWaitTarget - @input: HTCHandle - HTC handle - @output: - @return: - @notes: This API blocks until the target responds with an HTC ready message. - The caller should not connect services until the target has indicated it is - ready. - @example: - @see also: HTCConnectService -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_STATUS HTCWaitTarget(HTC_HANDLE HTCHandle); -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Start target service communications - @function name: HTCStart - @input: HTCHandle - HTC handle - @output: - @return: - @notes: This API indicates to the target that the service connection phase is complete - and the target can freely start all connected services. This API should only be - called AFTER all service connections have been made. TCStart will issue a - SETUP_COMPLETE message to the target to indicate that all service connections - have been made and the target can start communicating over the endpoints. - @example: - @see also: HTCConnectService -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_STATUS HTCStart(HTC_HANDLE HTCHandle); -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Add receive packet to HTC - @function name: HTCAddReceivePkt - @input: HTCHandle - HTC handle - pPacket - HTC receive packet to add - @output: - @return: A_OK on success - @notes: user must supply HTC packets for capturing incomming HTC frames. The caller - must initialize each HTC packet using the SET_HTC_PACKET_INFO_RX_REFILL() - macro. - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_STATUS HTCAddReceivePkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket); -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Connect to an HTC service - @function name: HTCConnectService - @input: HTCHandle - HTC handle - pReq - connection details - @output: pResp - connection response - @return: - @notes: Service connections must be performed before HTCStart. User provides callback handlers - for various endpoint events. - @example: - @see also: HTCStart -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_STATUS HTCConnectService(HTC_HANDLE HTCHandle, - HTC_SERVICE_CONNECT_REQ *pReq, - HTC_SERVICE_CONNECT_RESP *pResp); -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Send an HTC packet - @function name: HTCSendPkt - @input: HTCHandle - HTC handle - pPacket - packet to send - @output: - @return: A_OK - @notes: Caller must initialize packet using SET_HTC_PACKET_INFO_TX() macro. - This interface is fully asynchronous. On error, HTC SendPkt will - call the registered Endpoint callback to cleanup the packet. - @example: - @see also: HTCFlushEndpoint -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_STATUS HTCSendPkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket); -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Stop HTC service communications - @function name: HTCStop - @input: HTCHandle - HTC handle - @output: - @return: - @notes: HTC communications is halted. All receive and pending TX packets will - be flushed. - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -void HTCStop(HTC_HANDLE HTCHandle); -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Destory HTC service - @function name: HTCDestroy - @input: HTCHandle - @output: - @return: - @notes: This cleans up all resources allocated by HTCCreate(). - @example: - @see also: HTCCreate -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -void HTCDestroy(HTC_HANDLE HTCHandle); -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Flush pending TX packets - @function name: HTCFlushEndpoint - @input: HTCHandle - HTC handle - Endpoint - Endpoint to flush - Tag - flush tag - @output: - @return: - @notes: The Tag parameter is used to selectively flush packets with matching tags. - The value of 0 forces all packets to be flush regardless of tag. - @example: - @see also: HTCSendPkt -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -void HTCFlushEndpoint(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint, HTC_TX_TAG Tag); -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Dump credit distribution state - @function name: HTCDumpCreditStates - @input: HTCHandle - HTC handle - @output: - @return: - @notes: This dumps all credit distribution information to the debugger - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -void HTCDumpCreditStates(HTC_HANDLE HTCHandle); -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Indicate a traffic activity change on an endpoint - @function name: HTCIndicateActivityChange - @input: HTCHandle - HTC handle - Endpoint - endpoint in which activity has changed - Active - TRUE if active, FALSE if it has become inactive - @output: - @return: - @notes: This triggers the registered credit distribution function to - re-adjust credits for active/inactive endpoints. - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -void HTCIndicateActivityChange(HTC_HANDLE HTCHandle, - HTC_ENDPOINT_ID Endpoint, - A_BOOL Active); - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Get endpoint statistics - @function name: HTCGetEndpointStatistics - @input: HTCHandle - HTC handle - Endpoint - Endpoint identifier - Action - action to take with statistics - @output: - pStats - statistics that were sampled (can be NULL if Action is HTC_EP_STAT_CLEAR) - - @return: TRUE if statistics profiling is enabled, otherwise FALSE. - - @notes: Statistics is a compile-time option and this function may return FALSE - if HTC is not compiled with profiling. - - The caller can specify the statistic "action" to take when sampling - the statistics. This includes: - - HTC_EP_STAT_SAMPLE: The pStats structure is filled with the current values. - HTC_EP_STAT_SAMPLE_AND_CLEAR: The structure is filled and the current statistics - are cleared. - HTC_EP_STAT_CLEA : the statistics are cleared, the called can pass a NULL value for - pStats - - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_BOOL HTCGetEndpointStatistics(HTC_HANDLE HTCHandle, - HTC_ENDPOINT_ID Endpoint, - HTC_ENDPOINT_STAT_ACTION Action, - HTC_ENDPOINT_STATS *pStats); - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Unblock HTC message reception - @function name: HTCUnblockRecv - @input: HTCHandle - HTC handle - @output: - @return: - @notes: - HTC will block the receiver if the EpRecvAlloc callback fails to provide a packet. - The caller can use this API to indicate to HTC when resources (buffers) are available - such that the receiver can be unblocked and HTC may re-attempt fetching the pending message. - - This API is not required if the user uses the EpRecvRefill callback or uses the HTCAddReceivePacket() - API to recycle or provide receive packets to HTC. - - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -void HTCUnblockRecv(HTC_HANDLE HTCHandle); - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: send a series of HTC packets - @function name: HTCSendPktsMultiple - @input: HTCHandle - HTC handle - pPktQueue - local queue holding packets to send - @output: - @return: A_OK - @notes: Caller must initialize each packet using SET_HTC_PACKET_INFO_TX() macro. - The queue must only contain packets directed at the same endpoint. - Caller supplies a pointer to an HTC_PACKET_QUEUE structure holding the TX packets in FIFO order. - This API will remove the packets from the pkt queue and place them into the HTC Tx Queue - and bundle messages where possible. - The caller may allocate the pkt queue on the stack to hold the packets. - This interface is fully asynchronous. On error, HTCSendPkts will - call the registered Endpoint callback to cleanup the packet. - @example: - @see also: HTCFlushEndpoint -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_STATUS HTCSendPktsMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueue); - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Add multiple receive packets to HTC - @function name: HTCAddReceivePktMultiple - @input: HTCHandle - HTC handle - pPktQueue - HTC receive packet queue holding packets to add - @output: - @return: A_OK on success - @notes: user must supply HTC packets for capturing incomming HTC frames. The caller - must initialize each HTC packet using the SET_HTC_PACKET_INFO_RX_REFILL() - macro. The queue must only contain recv packets for the same endpoint. - Caller supplies a pointer to an HTC_PACKET_QUEUE structure holding the recv packet. - This API will remove the packets from the pkt queue and place them into internal - recv packet list. - The caller may allocate the pkt queue on the stack to hold the packets. - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_STATUS HTCAddReceivePktMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueue); - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Check if an endpoint is marked active - @function name: HTCIsEndpointActive - @input: HTCHandle - HTC handle - Endpoint - endpoint to check for active state - @output: - @return: returns TRUE if Endpoint is Active - @notes: - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -A_BOOL HTCIsEndpointActive(HTC_HANDLE HTCHandle, - HTC_ENDPOINT_ID Endpoint); - - -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @desc: Get the number of recv buffers currently queued into an HTC endpoint - @function name: HTCGetNumRecvBuffers - @input: HTCHandle - HTC handle - Endpoint - endpoint to check - @output: - @return: returns number of buffers in queue - @notes: - @example: - @see also: -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -int HTCGetNumRecvBuffers(HTC_HANDLE HTCHandle, - HTC_ENDPOINT_ID Endpoint); - -/* internally used functions for testing... */ -void HTCEnableRecv(HTC_HANDLE HTCHandle); -void HTCDisableRecv(HTC_HANDLE HTCHandle); -A_STATUS HTCWaitForPendingRecv(HTC_HANDLE HTCHandle, - A_UINT32 TimeoutInMs, - A_BOOL *pbIsRecvPending); - -#ifdef __cplusplus -} -#endif - -#endif /* _HTC_API_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/htc_packet.h b/drivers/net/wireless/ar6003/host/include/htc_packet.h deleted file mode 100644 index 15175cff2f28..000000000000 --- a/drivers/net/wireless/ar6003/host/include/htc_packet.h +++ /dev/null @@ -1,227 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#ifndef HTC_PACKET_H_ -#define HTC_PACKET_H_ - - -#include "dl_list.h" - -/* ------ Endpoint IDS ------ */ -typedef enum -{ - ENDPOINT_UNUSED = -1, - ENDPOINT_0 = 0, - ENDPOINT_1 = 1, - ENDPOINT_2 = 2, - ENDPOINT_3, - ENDPOINT_4, - ENDPOINT_5, - ENDPOINT_6, - ENDPOINT_7, - ENDPOINT_8, - ENDPOINT_MAX, -} HTC_ENDPOINT_ID; - -struct _HTC_PACKET; - -typedef void (* HTC_PACKET_COMPLETION)(void *,struct _HTC_PACKET *); - -typedef A_UINT16 HTC_TX_TAG; - -typedef struct _HTC_TX_PACKET_INFO { - HTC_TX_TAG Tag; /* tag used to selective flush packets */ - int CreditsUsed; /* number of credits used for this TX packet (HTC internal) */ - A_UINT8 SendFlags; /* send flags (HTC internal) */ - int SeqNo; /* internal seq no for debugging (HTC internal) */ -} HTC_TX_PACKET_INFO; - -#define HTC_TX_PACKET_TAG_ALL 0 /* a tag of zero is reserved and used to flush ALL packets */ -#define HTC_TX_PACKET_TAG_INTERNAL 1 /* internal tags start here */ -#define HTC_TX_PACKET_TAG_USER_DEFINED (HTC_TX_PACKET_TAG_INTERNAL + 9) /* user-defined tags start here */ - -typedef struct _HTC_RX_PACKET_INFO { - A_UINT32 ExpectedHdr; /* HTC internal use */ - A_UINT32 HTCRxFlags; /* HTC internal use */ - A_UINT32 IndicationFlags; /* indication flags set on each RX packet indication */ -} HTC_RX_PACKET_INFO; - -#define HTC_RX_FLAGS_INDICATE_MORE_PKTS (1 << 0) /* more packets on this endpoint are being fetched */ - -/* wrapper around endpoint-specific packets */ -typedef struct _HTC_PACKET { - DL_LIST ListLink; /* double link */ - void *pPktContext; /* caller's per packet specific context */ - - A_UINT8 *pBufferStart; /* the true buffer start , the caller can - store the real buffer start here. In - receive callbacks, the HTC layer sets pBuffer - to the start of the payload past the header. This - field allows the caller to reset pBuffer when it - recycles receive packets back to HTC */ - /* - * Pointer to the start of the buffer. In the transmit - * direction this points to the start of the payload. In the - * receive direction, however, the buffer when queued up - * points to the start of the HTC header but when returned - * to the caller points to the start of the payload - */ - A_UINT8 *pBuffer; /* payload start (RX/TX) */ - A_UINT32 BufferLength; /* length of buffer */ - A_UINT32 ActualLength; /* actual length of payload */ - HTC_ENDPOINT_ID Endpoint; /* endpoint that this packet was sent/recv'd from */ - A_STATUS Status; /* completion status */ - union { - HTC_TX_PACKET_INFO AsTx; /* Tx Packet specific info */ - HTC_RX_PACKET_INFO AsRx; /* Rx Packet specific info */ - } PktInfo; - - /* the following fields are for internal HTC use */ - HTC_PACKET_COMPLETION Completion; /* completion */ - void *pContext; /* HTC private completion context */ -} HTC_PACKET; - - - -#define COMPLETE_HTC_PACKET(p,status) \ -{ \ - (p)->Status = (status); \ - (p)->Completion((p)->pContext,(p)); \ -} - -#define INIT_HTC_PACKET_INFO(p,b,len) \ -{ \ - (p)->pBufferStart = (b); \ - (p)->BufferLength = (len); \ -} - -/* macro to set an initial RX packet for refilling HTC */ -#define SET_HTC_PACKET_INFO_RX_REFILL(p,c,b,len,ep) \ -{ \ - (p)->pPktContext = (c); \ - (p)->pBuffer = (b); \ - (p)->pBufferStart = (b); \ - (p)->BufferLength = (len); \ - (p)->Endpoint = (ep); \ -} - -/* fast macro to recycle an RX packet that will be re-queued to HTC */ -#define HTC_PACKET_RESET_RX(p) \ - { (p)->pBuffer = (p)->pBufferStart; (p)->ActualLength = 0; } - -/* macro to set packet parameters for TX */ -#define SET_HTC_PACKET_INFO_TX(p,c,b,len,ep,tag) \ -{ \ - (p)->pPktContext = (c); \ - (p)->pBuffer = (b); \ - (p)->ActualLength = (len); \ - (p)->Endpoint = (ep); \ - (p)->PktInfo.AsTx.Tag = (tag); \ -} - -/* HTC Packet Queueing Macros */ -typedef struct _HTC_PACKET_QUEUE { - DL_LIST QueueHead; - int Depth; -} HTC_PACKET_QUEUE; - -/* initialize queue */ -#define INIT_HTC_PACKET_QUEUE(pQ) \ -{ \ - DL_LIST_INIT(&(pQ)->QueueHead); \ - (pQ)->Depth = 0; \ -} - -/* enqueue HTC packet to the tail of the queue */ -#define HTC_PACKET_ENQUEUE(pQ,p) \ -{ DL_ListInsertTail(&(pQ)->QueueHead,&(p)->ListLink); \ - (pQ)->Depth++; \ -} - -/* enqueue HTC packet to the tail of the queue */ -#define HTC_PACKET_ENQUEUE_TO_HEAD(pQ,p) \ -{ DL_ListInsertHead(&(pQ)->QueueHead,&(p)->ListLink); \ - (pQ)->Depth++; \ -} -/* test if a queue is empty */ -#define HTC_QUEUE_EMPTY(pQ) ((pQ)->Depth == 0) -/* get packet at head without removing it */ -static INLINE HTC_PACKET *HTC_GET_PKT_AT_HEAD(HTC_PACKET_QUEUE *queue) { - if (queue->Depth == 0) { - return NULL; - } - return A_CONTAINING_STRUCT((DL_LIST_GET_ITEM_AT_HEAD(&queue->QueueHead)),HTC_PACKET,ListLink); -} -/* remove a packet from a queue, where-ever it is in the queue */ -#define HTC_PACKET_REMOVE(pQ,p) \ -{ \ - DL_ListRemove(&(p)->ListLink); \ - (pQ)->Depth--; \ -} - -/* dequeue an HTC packet from the head of the queue */ -static INLINE HTC_PACKET *HTC_PACKET_DEQUEUE(HTC_PACKET_QUEUE *queue) { - DL_LIST *pItem = DL_ListRemoveItemFromHead(&queue->QueueHead); - if (pItem != NULL) { - queue->Depth--; - return A_CONTAINING_STRUCT(pItem, HTC_PACKET, ListLink); - } - return NULL; -} - -/* dequeue an HTC packet from the tail of the queue */ -static INLINE HTC_PACKET *HTC_PACKET_DEQUEUE_TAIL(HTC_PACKET_QUEUE *queue) { - DL_LIST *pItem = DL_ListRemoveItemFromTail(&queue->QueueHead); - if (pItem != NULL) { - queue->Depth--; - return A_CONTAINING_STRUCT(pItem, HTC_PACKET, ListLink); - } - return NULL; -} - -#define HTC_PACKET_QUEUE_DEPTH(pQ) (pQ)->Depth - - -#define HTC_GET_ENDPOINT_FROM_PKT(p) (p)->Endpoint -#define HTC_GET_TAG_FROM_PKT(p) (p)->PktInfo.AsTx.Tag - - /* transfer the packets from one queue to the tail of another queue */ -#define HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(pQDest,pQSrc) \ -{ \ - DL_ListTransferItemsToTail(&(pQDest)->QueueHead,&(pQSrc)->QueueHead); \ - (pQDest)->Depth += (pQSrc)->Depth; \ - (pQSrc)->Depth = 0; \ -} - - /* fast version to init and add a single packet to a queue */ -#define INIT_HTC_PACKET_QUEUE_AND_ADD(pQ,pP) \ -{ \ - DL_LIST_INIT_AND_ADD(&(pQ)->QueueHead,&(pP)->ListLink) \ - (pQ)->Depth = 1; \ -} - -#define HTC_PACKET_QUEUE_ITERATE_ALLOW_REMOVE(pQ, pPTemp) \ - ITERATE_OVER_LIST_ALLOW_REMOVE(&(pQ)->QueueHead,(pPTemp), HTC_PACKET, ListLink) - -#define HTC_PACKET_QUEUE_ITERATE_END ITERATE_END - -#endif /*HTC_PACKET_H_*/ diff --git a/drivers/net/wireless/ar6003/host/include/p2p_api.h b/drivers/net/wireless/ar6003/host/include/p2p_api.h deleted file mode 100644 index 5b8837023d71..000000000000 --- a/drivers/net/wireless/ar6003/host/include/p2p_api.h +++ /dev/null @@ -1,116 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file contains definitions exported by the P2P host module. -// -// Author(s): ="Atheros" -//============================================================================== - -#ifndef _HOST_P2P_API_H_ -#define _HOST_P2P_API_H_ - -#include "utils_api.h" -#include "wmi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define P2P_OUI 0x99a6f50 - -static int __inline -isp2poui(const A_UINT8 *frm) -{ - return frm[1] > 3 && LE_READ_4(frm+2) == (P2P_OUI); -} - -/* API function declarations */ - -void *p2p_init(void *dev); - -struct host_p2p_dev *p2p_get_device(void *p2p_dev_ctx, const A_UINT8 *addr); - -void *p2p_bssinfo_rx(void *p2p_dev_ctx, WMI_BI_FTYPE fType, A_UINT8 *addr, A_UINT16 channel, const A_UINT8 *data, A_UINT32 len); - -void p2p_go_neg_req_rx(void *p2p_dev_ctx, const A_UINT8 *datap, A_UINT8 len); - -void p2p_invite_req_rx(void *p2p_dev_ctx, const A_UINT8 *datap, A_UINT8 len); - -void p2p_prov_disc_req_rx(void *p2p_dev_ctx, const A_UINT8 *datap, A_UINT8 len); -void p2p_prov_disc_resp_rx(void *p2p_dev_ctx, - const A_UINT8 *datap, A_UINT8 len); -void p2p_start_sdpd_event_rx(void *p2p_dev_ctx); -void p2p_sdpd_rx_event_rx(void *p2p_dev_ctx, - const A_UINT8 *datap, A_UINT8 len); -void p2p_free_all_devices(void *ctx); -void p2p_device_free(void *peer_dev); - -A_STATUS p2p_auth_go_neg(void *ctx, - WMI_P2P_GO_NEG_START_CMD *auth_go_neg_param); - -A_STATUS p2p_auth_invite(void *ctx, A_UINT8 *auth_peer); - -A_STATUS p2p_peer_reject(void *ctx, A_UINT8 *peer_addr); - -A_STATUS p2p_go_neg_start(void *ctx, WMI_P2P_GO_NEG_START_CMD *go_neg_param); - -A_STATUS p2p_invite_cmd(void *ctx, WMI_P2P_INVITE_CMD *invite_param); - -A_STATUS p2p_prov_disc_req(void *ctx, A_UINT8 *peer, A_UINT16 wps_method); - -A_STATUS p2p_peer(void *ctx, A_UINT8 *peer, A_UINT8 next); - -A_STATUS p2p_get_device_p2p_buf(void *ctx, A_UINT8 *peer, A_UINT8 **p2p_buf, A_UINT8 *p2p_buf_len); - -A_STATUS wmi_p2p_get_go_params(void *ctx, A_UINT8 *go_dev_addr, - A_UINT16 *oper_freq, A_UINT8 *ssid, A_UINT8 *ssid_len); - -A_STATUS p2p_get_devaddr (void *ctx, A_UINT8 *intf_addr); - -A_STATUS p2p_get_ifaddr (void *ctx, A_UINT8 *dev_addr); - -struct host_p2p_dev *p2p_get_device_intf_addrs(void *ctx, const A_UINT8 *intfaddr); - -void p2p_increment_dev_ref_count(struct host_p2p_dev *dev); - -void p2p_free_all_sd_queries(void *ctx); - -A_STATUS p2p_sd_request(void *ctx, A_UINT8 *peer_addr, A_UINT8 *tlvbuf, - A_UINT8 tlv_buflen, A_UINT32 *qid); - -A_STATUS p2p_sdpd_tx_cmd(void *ctx, WMI_P2P_SDPD_TX_CMD *sdpd_tx_cmd, A_UINT32 *qid); - -A_STATUS p2p_sd_cancel_request(void *ctx, A_UINT32 qid); - -void p2p_go_neg_complete_rx(void *ctx, const A_UINT8 *datap, A_UINT8 len); - -int p2p_get_peer_info(void *ctx, A_UINT8 *peer_addr, A_UINT8 *buf, A_UINT32 buflen); - -int p2p_get_next_addr(void *ctx, A_UINT8 *addr, A_UINT8 *buf, A_UINT32 buflen, int first_element); - -void p2p_clear_peers_reported_flag(void *ctx); - -void p2p_clear_peers_authorized_flag(void *ctx, const A_UINT8 *addr); - -#ifdef __cplusplus -} -#endif - -#endif /* _HOST_P2P_API_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/project.h b/drivers/net/wireless/ar6003/host/include/project.h deleted file mode 100644 index 43378ded9e53..000000000000 --- a/drivers/net/wireless/ar6003/host/include/project.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2008 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef _PROJECT_H_ -#define _PROJECT_H_ -#include "queue.h" - -#define OS_TIMER_FUNC(fn) void fn(A_HANDLE hdl, void *context) -#define OS_TIMER_FUNC_PTR(fn) void (* fn)(A_HANDLE hdl, void *context) -#define OS_CANCEL_TIMER(timer_hdl) A_UNTIMEOUT(timer_hdl) -#define OS_SET_TIMER(timer_hdl, period, repeat) A_TIMEOUT_MS(timer_hdl, period, repeat) -#define OS_INIT_TIMER(timer_hdl, fn, arg) A_INIT_TIMER(timer_hdl, fn, arg) - -typedef A_TIMER os_timer_t; - -/* Memory related */ -#define OS_MEMZERO(ptr, size) A_MEMZERO(ptr, size) -#define OS_MEMCPY(dst, src, len) A_MEMCPY(dst, src, len) -#define OS_MALLOC(nbytes) A_MALLOC(nbytes) -#define OS_FREE(ptr) A_FREE(ptr) - -#endif - - diff --git a/drivers/net/wireless/ar6003/host/include/target_reg_table.h b/drivers/net/wireless/ar6003/host/include/target_reg_table.h deleted file mode 100644 index 55caa43b84f4..000000000000 --- a/drivers/net/wireless/ar6003/host/include/target_reg_table.h +++ /dev/null @@ -1,349 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Target register table macros and structure definitions -// -// Author(s): ="Atheros" -//============================================================================== - -#ifndef TARGET_REG_TABLE_H_ -#define TARGET_REG_TABLE_H_ - -#include "targaddrs.h" -/*** WARNING : Add to the end of the TABLE! do not change the order ****/ -typedef struct targetdef_s { - A_UINT32 d_RTC_SOC_BASE_ADDRESS; - A_UINT32 d_RTC_WMAC_BASE_ADDRESS; - A_UINT32 d_SYSTEM_SLEEP_OFFSET; - A_UINT32 d_WLAN_SYSTEM_SLEEP_OFFSET; - A_UINT32 d_WLAN_SYSTEM_SLEEP_DISABLE_LSB; - A_UINT32 d_WLAN_SYSTEM_SLEEP_DISABLE_MASK; - A_UINT32 d_CLOCK_CONTROL_OFFSET; - A_UINT32 d_CLOCK_CONTROL_SI0_CLK_MASK; - A_UINT32 d_RESET_CONTROL_OFFSET; - A_UINT32 d_RESET_CONTROL_MBOX_RST_MASK; - A_UINT32 d_RESET_CONTROL_SI0_RST_MASK; - A_UINT32 d_WLAN_RESET_CONTROL_OFFSET; - A_UINT32 d_WLAN_RESET_CONTROL_COLD_RST_MASK; - A_UINT32 d_WLAN_RESET_CONTROL_WARM_RST_MASK; - A_UINT32 d_GPIO_BASE_ADDRESS; - A_UINT32 d_GPIO_PIN0_OFFSET; - A_UINT32 d_GPIO_PIN1_OFFSET; - A_UINT32 d_GPIO_PIN0_CONFIG_MASK; - A_UINT32 d_GPIO_PIN1_CONFIG_MASK; - A_UINT32 d_SI_CONFIG_BIDIR_OD_DATA_LSB; - A_UINT32 d_SI_CONFIG_BIDIR_OD_DATA_MASK; - A_UINT32 d_SI_CONFIG_I2C_LSB; - A_UINT32 d_SI_CONFIG_I2C_MASK; - A_UINT32 d_SI_CONFIG_POS_SAMPLE_LSB; - A_UINT32 d_SI_CONFIG_POS_SAMPLE_MASK; - A_UINT32 d_SI_CONFIG_INACTIVE_CLK_LSB; - A_UINT32 d_SI_CONFIG_INACTIVE_CLK_MASK; - A_UINT32 d_SI_CONFIG_INACTIVE_DATA_LSB; - A_UINT32 d_SI_CONFIG_INACTIVE_DATA_MASK; - A_UINT32 d_SI_CONFIG_DIVIDER_LSB; - A_UINT32 d_SI_CONFIG_DIVIDER_MASK; - A_UINT32 d_SI_BASE_ADDRESS; - A_UINT32 d_SI_CONFIG_OFFSET; - A_UINT32 d_SI_TX_DATA0_OFFSET; - A_UINT32 d_SI_TX_DATA1_OFFSET; - A_UINT32 d_SI_RX_DATA0_OFFSET; - A_UINT32 d_SI_RX_DATA1_OFFSET; - A_UINT32 d_SI_CS_OFFSET; - A_UINT32 d_SI_CS_DONE_ERR_MASK; - A_UINT32 d_SI_CS_DONE_INT_MASK; - A_UINT32 d_SI_CS_START_LSB; - A_UINT32 d_SI_CS_START_MASK; - A_UINT32 d_SI_CS_RX_CNT_LSB; - A_UINT32 d_SI_CS_RX_CNT_MASK; - A_UINT32 d_SI_CS_TX_CNT_LSB; - A_UINT32 d_SI_CS_TX_CNT_MASK; - A_UINT32 d_BOARD_DATA_SZ; - A_UINT32 d_BOARD_EXT_DATA_SZ; - A_UINT32 d_MBOX_BASE_ADDRESS; - A_UINT32 d_LOCAL_SCRATCH_OFFSET; - A_UINT32 d_CPU_CLOCK_OFFSET; - A_UINT32 d_LPO_CAL_OFFSET; - A_UINT32 d_GPIO_PIN10_OFFSET; - A_UINT32 d_GPIO_PIN11_OFFSET; - A_UINT32 d_GPIO_PIN12_OFFSET; - A_UINT32 d_GPIO_PIN13_OFFSET; - A_UINT32 d_CLOCK_GPIO_OFFSET; - A_UINT32 d_CPU_CLOCK_STANDARD_LSB; - A_UINT32 d_CPU_CLOCK_STANDARD_MASK; - A_UINT32 d_LPO_CAL_ENABLE_LSB; - A_UINT32 d_LPO_CAL_ENABLE_MASK; - A_UINT32 d_CLOCK_GPIO_BT_CLK_OUT_EN_LSB; - A_UINT32 d_CLOCK_GPIO_BT_CLK_OUT_EN_MASK; - A_UINT32 d_ANALOG_INTF_BASE_ADDRESS; -} TARGET_REGISTER_TABLE; - -#define ATH_UNSUPPORTED_REG_OFFSET 0xffffffff -#define ATH_SUPPORTED_BY_TARGET(reg_offset) ((reg_offset) != ATH_UNSUPPORTED_REG_OFFSET) - -#define BOARD_DATA_SZ_MAX 2048 - -#if defined(MY_TARGET_DEF) /* { */ -#if defined(ATHR_WIN_DEF) -#define ATH_REG_TABLE_DIRECT_ASSIGN -#endif - -/* Cross-platform compatibility */ -#if !defined(SOC_RESET_CONTROL_OFFSET) && defined(RESET_CONTROL_OFFSET) -#define SOC_RESET_CONTROL_OFFSET RESET_CONTROL_OFFSET -#endif -#if !defined(CLOCK_GPIO_OFFSET) -#define CLOCK_GPIO_OFFSET ATH_UNSUPPORTED_REG_OFFSET -#define CLOCK_GPIO_BT_CLK_OUT_EN_LSB 0 -#define CLOCK_GPIO_BT_CLK_OUT_EN_MASK 0 -#endif - -#ifdef ATH_REG_TABLE_DIRECT_ASSIGN - -static struct targetdef_s my_target_def = { - RTC_SOC_BASE_ADDRESS, - RTC_WMAC_BASE_ADDRESS, - SYSTEM_SLEEP_OFFSET, - WLAN_SYSTEM_SLEEP_OFFSET, - WLAN_SYSTEM_SLEEP_DISABLE_LSB, - WLAN_SYSTEM_SLEEP_DISABLE_MASK, - CLOCK_CONTROL_OFFSET, - CLOCK_CONTROL_SI0_CLK_MASK, - SOC_RESET_CONTROL_OFFSET, - RESET_CONTROL_MBOX_RST_MASK, - RESET_CONTROL_SI0_RST_MASK, - WLAN_RESET_CONTROL_OFFSET, - WLAN_RESET_CONTROL_COLD_RST_MASK, - WLAN_RESET_CONTROL_WARM_RST_MASK, - GPIO_BASE_ADDRESS, - GPIO_PIN0_OFFSET, - GPIO_PIN1_OFFSET, - GPIO_PIN0_CONFIG_MASK, - GPIO_PIN1_CONFIG_MASK, - SI_CONFIG_BIDIR_OD_DATA_LSB, - SI_CONFIG_BIDIR_OD_DATA_MASK, - SI_CONFIG_I2C_LSB, - SI_CONFIG_I2C_MASK, - SI_CONFIG_POS_SAMPLE_LSB, - SI_CONFIG_POS_SAMPLE_MASK, - SI_CONFIG_INACTIVE_CLK_LSB, - SI_CONFIG_INACTIVE_CLK_MASK, - SI_CONFIG_INACTIVE_DATA_LSB, - SI_CONFIG_INACTIVE_DATA_MASK, - SI_CONFIG_DIVIDER_LSB, - SI_CONFIG_DIVIDER_MASK, - SI_BASE_ADDRESS, - SI_CONFIG_OFFSET, - SI_TX_DATA0_OFFSET, - SI_TX_DATA1_OFFSET, - SI_RX_DATA0_OFFSET, - SI_RX_DATA1_OFFSET, - SI_CS_OFFSET, - SI_CS_DONE_ERR_MASK, - SI_CS_DONE_INT_MASK, - SI_CS_START_LSB, - SI_CS_START_MASK, - SI_CS_RX_CNT_LSB, - SI_CS_RX_CNT_MASK, - SI_CS_TX_CNT_LSB, - SI_CS_TX_CNT_MASK, - MY_TARGET_BOARD_DATA_SZ, - MY_TARGET_BOARD_EXT_DATA_SZ, - MBOX_BASE_ADDRESS, - LOCAL_SCRATCH_OFFSET, - CPU_CLOCK_OFFSET, - LPO_CAL_OFFSET, - GPIO_PIN10_OFFSET, - GPIO_PIN11_OFFSET, - GPIO_PIN12_OFFSET, - GPIO_PIN13_OFFSET, - CLOCK_GPIO_OFFSET, - CPU_CLOCK_STANDARD_LSB, - CPU_CLOCK_STANDARD_MASK, - LPO_CAL_ENABLE_LSB, - LPO_CAL_ENABLE_MASK, - CLOCK_GPIO_BT_CLK_OUT_EN_LSB, - CLOCK_GPIO_BT_CLK_OUT_EN_MASK, - ANALOG_INTF_BASE_ADDRESS, -}; - -#else - -static struct targetdef_s my_target_def = { - .d_RTC_SOC_BASE_ADDRESS = RTC_SOC_BASE_ADDRESS, - .d_RTC_WMAC_BASE_ADDRESS = RTC_WMAC_BASE_ADDRESS, - .d_SYSTEM_SLEEP_OFFSET = WLAN_SYSTEM_SLEEP_OFFSET, - .d_WLAN_SYSTEM_SLEEP_OFFSET = WLAN_SYSTEM_SLEEP_OFFSET, - .d_WLAN_SYSTEM_SLEEP_DISABLE_LSB = WLAN_SYSTEM_SLEEP_DISABLE_LSB, - .d_WLAN_SYSTEM_SLEEP_DISABLE_MASK = WLAN_SYSTEM_SLEEP_DISABLE_MASK, - .d_CLOCK_CONTROL_OFFSET = CLOCK_CONTROL_OFFSET, - .d_CLOCK_CONTROL_SI0_CLK_MASK = CLOCK_CONTROL_SI0_CLK_MASK, - .d_RESET_CONTROL_OFFSET = SOC_RESET_CONTROL_OFFSET, - .d_RESET_CONTROL_MBOX_RST_MASK = RESET_CONTROL_MBOX_RST_MASK, - .d_RESET_CONTROL_SI0_RST_MASK = RESET_CONTROL_SI0_RST_MASK, - .d_WLAN_RESET_CONTROL_OFFSET = WLAN_RESET_CONTROL_OFFSET, - .d_WLAN_RESET_CONTROL_COLD_RST_MASK = WLAN_RESET_CONTROL_COLD_RST_MASK, - .d_WLAN_RESET_CONTROL_WARM_RST_MASK = WLAN_RESET_CONTROL_WARM_RST_MASK, - .d_GPIO_BASE_ADDRESS = GPIO_BASE_ADDRESS, - .d_GPIO_PIN0_OFFSET = GPIO_PIN0_OFFSET, - .d_GPIO_PIN1_OFFSET = GPIO_PIN1_OFFSET, - .d_GPIO_PIN0_CONFIG_MASK = GPIO_PIN0_CONFIG_MASK, - .d_GPIO_PIN1_CONFIG_MASK = GPIO_PIN1_CONFIG_MASK, - .d_SI_CONFIG_BIDIR_OD_DATA_LSB = SI_CONFIG_BIDIR_OD_DATA_LSB, - .d_SI_CONFIG_BIDIR_OD_DATA_MASK = SI_CONFIG_BIDIR_OD_DATA_MASK, - .d_SI_CONFIG_I2C_LSB = SI_CONFIG_I2C_LSB, - .d_SI_CONFIG_I2C_MASK = SI_CONFIG_I2C_MASK, - .d_SI_CONFIG_POS_SAMPLE_LSB = SI_CONFIG_POS_SAMPLE_LSB, - .d_SI_CONFIG_POS_SAMPLE_MASK = SI_CONFIG_POS_SAMPLE_MASK, - .d_SI_CONFIG_INACTIVE_CLK_LSB = SI_CONFIG_INACTIVE_CLK_LSB, - .d_SI_CONFIG_INACTIVE_CLK_MASK = SI_CONFIG_INACTIVE_CLK_MASK, - .d_SI_CONFIG_INACTIVE_DATA_LSB = SI_CONFIG_INACTIVE_DATA_LSB, - .d_SI_CONFIG_INACTIVE_DATA_MASK = SI_CONFIG_INACTIVE_DATA_MASK, - .d_SI_CONFIG_DIVIDER_LSB = SI_CONFIG_DIVIDER_LSB, - .d_SI_CONFIG_DIVIDER_MASK = SI_CONFIG_DIVIDER_MASK, - .d_SI_BASE_ADDRESS = SI_BASE_ADDRESS, - .d_SI_CONFIG_OFFSET = SI_CONFIG_OFFSET, - .d_SI_TX_DATA0_OFFSET = SI_TX_DATA0_OFFSET, - .d_SI_TX_DATA1_OFFSET = SI_TX_DATA1_OFFSET, - .d_SI_RX_DATA0_OFFSET = SI_RX_DATA0_OFFSET, - .d_SI_RX_DATA1_OFFSET = SI_RX_DATA1_OFFSET, - .d_SI_CS_OFFSET = SI_CS_OFFSET, - .d_SI_CS_DONE_ERR_MASK = SI_CS_DONE_ERR_MASK, - .d_SI_CS_DONE_INT_MASK = SI_CS_DONE_INT_MASK, - .d_SI_CS_START_LSB = SI_CS_START_LSB, - .d_SI_CS_START_MASK = SI_CS_START_MASK, - .d_SI_CS_RX_CNT_LSB = SI_CS_RX_CNT_LSB, - .d_SI_CS_RX_CNT_MASK = SI_CS_RX_CNT_MASK, - .d_SI_CS_TX_CNT_LSB = SI_CS_TX_CNT_LSB, - .d_SI_CS_TX_CNT_MASK = SI_CS_TX_CNT_MASK, - .d_BOARD_DATA_SZ = MY_TARGET_BOARD_DATA_SZ, - .d_BOARD_EXT_DATA_SZ = MY_TARGET_BOARD_EXT_DATA_SZ, - .d_MBOX_BASE_ADDRESS = MBOX_BASE_ADDRESS, - .d_LOCAL_SCRATCH_OFFSET = LOCAL_SCRATCH_OFFSET, - .d_CPU_CLOCK_OFFSET = CPU_CLOCK_OFFSET, - .d_LPO_CAL_OFFSET = LPO_CAL_OFFSET, - .d_GPIO_PIN10_OFFSET = GPIO_PIN10_OFFSET, - .d_GPIO_PIN11_OFFSET = GPIO_PIN11_OFFSET, - .d_GPIO_PIN12_OFFSET = GPIO_PIN12_OFFSET, - .d_GPIO_PIN13_OFFSET = GPIO_PIN13_OFFSET, - .d_CLOCK_GPIO_OFFSET = CLOCK_GPIO_OFFSET, - .d_CPU_CLOCK_STANDARD_LSB = CPU_CLOCK_STANDARD_LSB, - .d_CPU_CLOCK_STANDARD_MASK = CPU_CLOCK_STANDARD_MASK, - .d_LPO_CAL_ENABLE_LSB = LPO_CAL_ENABLE_LSB, - .d_LPO_CAL_ENABLE_MASK = LPO_CAL_ENABLE_MASK, - .d_CLOCK_GPIO_BT_CLK_OUT_EN_LSB = CLOCK_GPIO_BT_CLK_OUT_EN_LSB, - .d_CLOCK_GPIO_BT_CLK_OUT_EN_MASK = CLOCK_GPIO_BT_CLK_OUT_EN_MASK, - .d_ANALOG_INTF_BASE_ADDRESS = ANALOG_INTF_BASE_ADDRESS, -}; - -#endif - -#if MY_TARGET_BOARD_DATA_SZ > BOARD_DATA_SZ_MAX -#error "BOARD_DATA_SZ_MAX is too small" -#endif - -struct targetdef_s *MY_TARGET_DEF = &my_target_def; - -#else /* } { */ - -#define RTC_SOC_BASE_ADDRESS (targetdef->d_RTC_SOC_BASE_ADDRESS) -#define RTC_WMAC_BASE_ADDRESS (targetdef->d_RTC_WMAC_BASE_ADDRESS) -#define SYSTEM_SLEEP_OFFSET (targetdef->d_SYSTEM_SLEEP_OFFSET) -#define WLAN_SYSTEM_SLEEP_OFFSET (targetdef->d_WLAN_SYSTEM_SLEEP_OFFSET) -#define WLAN_SYSTEM_SLEEP_DISABLE_LSB (targetdef->d_WLAN_SYSTEM_SLEEP_DISABLE_LSB) -#define WLAN_SYSTEM_SLEEP_DISABLE_MASK (targetdef->d_WLAN_SYSTEM_SLEEP_DISABLE_MASK) -#define CLOCK_CONTROL_OFFSET (targetdef->d_CLOCK_CONTROL_OFFSET) -#define CLOCK_CONTROL_SI0_CLK_MASK (targetdef->d_CLOCK_CONTROL_SI0_CLK_MASK) -#define RESET_CONTROL_OFFSET (targetdef->d_RESET_CONTROL_OFFSET) -#define RESET_CONTROL_MBOX_RST_MASK (targetdef->d_RESET_CONTROL_MBOX_RST_MASK) -#define RESET_CONTROL_SI0_RST_MASK (targetdef->d_RESET_CONTROL_SI0_RST_MASK) -#define WLAN_RESET_CONTROL_OFFSET (targetdef->d_WLAN_RESET_CONTROL_OFFSET) -#define WLAN_RESET_CONTROL_COLD_RST_MASK (targetdef->d_WLAN_RESET_CONTROL_COLD_RST_MASK) -#define WLAN_RESET_CONTROL_WARM_RST_MASK (targetdef->d_WLAN_RESET_CONTROL_WARM_RST_MASK) -#define GPIO_BASE_ADDRESS (targetdef->d_GPIO_BASE_ADDRESS) -#define GPIO_PIN0_OFFSET (targetdef->d_GPIO_PIN0_OFFSET) -#define GPIO_PIN1_OFFSET (targetdef->d_GPIO_PIN1_OFFSET) -#define GPIO_PIN0_CONFIG_MASK (targetdef->d_GPIO_PIN0_CONFIG_MASK) -#define GPIO_PIN1_CONFIG_MASK (targetdef->d_GPIO_PIN1_CONFIG_MASK) -#define SI_CONFIG_BIDIR_OD_DATA_LSB (targetdef->d_SI_CONFIG_BIDIR_OD_DATA_LSB) -#define SI_CONFIG_BIDIR_OD_DATA_MASK (targetdef->d_SI_CONFIG_BIDIR_OD_DATA_MASK) -#define SI_CONFIG_I2C_LSB (targetdef->d_SI_CONFIG_I2C_LSB) -#define SI_CONFIG_I2C_MASK (targetdef->d_SI_CONFIG_I2C_MASK) -#define SI_CONFIG_POS_SAMPLE_LSB (targetdef->d_SI_CONFIG_POS_SAMPLE_LSB) -#define SI_CONFIG_POS_SAMPLE_MASK (targetdef->d_SI_CONFIG_POS_SAMPLE_MASK) -#define SI_CONFIG_INACTIVE_CLK_LSB (targetdef->d_SI_CONFIG_INACTIVE_CLK_LSB) -#define SI_CONFIG_INACTIVE_CLK_MASK (targetdef->d_SI_CONFIG_INACTIVE_CLK_MASK) -#define SI_CONFIG_INACTIVE_DATA_LSB (targetdef->d_SI_CONFIG_INACTIVE_DATA_LSB) -#define SI_CONFIG_INACTIVE_DATA_MASK (targetdef->d_SI_CONFIG_INACTIVE_DATA_MASK) -#define SI_CONFIG_DIVIDER_LSB (targetdef->d_SI_CONFIG_DIVIDER_LSB) -#define SI_CONFIG_DIVIDER_MASK (targetdef->d_SI_CONFIG_DIVIDER_MASK) -#define SI_BASE_ADDRESS (targetdef->d_SI_BASE_ADDRESS) -#define SI_CONFIG_OFFSET (targetdef->d_SI_CONFIG_OFFSET) -#define SI_TX_DATA0_OFFSET (targetdef->d_SI_TX_DATA0_OFFSET) -#define SI_TX_DATA1_OFFSET (targetdef->d_SI_TX_DATA1_OFFSET) -#define SI_RX_DATA0_OFFSET (targetdef->d_SI_RX_DATA0_OFFSET) -#define SI_RX_DATA1_OFFSET (targetdef->d_SI_RX_DATA1_OFFSET) -#define SI_CS_OFFSET (targetdef->d_SI_CS_OFFSET) -#define SI_CS_DONE_ERR_MASK (targetdef->d_SI_CS_DONE_ERR_MASK) -#define SI_CS_DONE_INT_MASK (targetdef->d_SI_CS_DONE_INT_MASK) -#define SI_CS_START_LSB (targetdef->d_SI_CS_START_LSB) -#define SI_CS_START_MASK (targetdef->d_SI_CS_START_MASK) -#define SI_CS_RX_CNT_LSB (targetdef->d_SI_CS_RX_CNT_LSB) -#define SI_CS_RX_CNT_MASK (targetdef->d_SI_CS_RX_CNT_MASK) -#define SI_CS_TX_CNT_LSB (targetdef->d_SI_CS_TX_CNT_LSB) -#define SI_CS_TX_CNT_MASK (targetdef->d_SI_CS_TX_CNT_MASK) -#define EEPROM_SZ (targetdef->d_BOARD_DATA_SZ) -#define EEPROM_EXT_SZ (targetdef->d_BOARD_EXT_DATA_SZ) -#define MBOX_BASE_ADDRESS (targetdef->d_MBOX_BASE_ADDRESS) -#define LOCAL_SCRATCH_OFFSET (targetdef->d_LOCAL_SCRATCH_OFFSET) -#define CPU_CLOCK_OFFSET (targetdef->d_CPU_CLOCK_OFFSET) -#define LPO_CAL_OFFSET (targetdef->d_LPO_CAL_OFFSET) -#define GPIO_PIN10_OFFSET (targetdef->d_GPIO_PIN10_OFFSET) -#define GPIO_PIN11_OFFSET (targetdef->d_GPIO_PIN11_OFFSET) -#define GPIO_PIN12_OFFSET (targetdef->d_GPIO_PIN12_OFFSET) -#define GPIO_PIN13_OFFSET (targetdef->d_GPIO_PIN13_OFFSET) -#define CLOCK_GPIO_OFFSET (targetdef->d_CLOCK_GPIO_OFFSET) -#define CPU_CLOCK_STANDARD_LSB (targetdef->d_CPU_CLOCK_STANDARD_LSB) -#define CPU_CLOCK_STANDARD_MASK (targetdef->d_CPU_CLOCK_STANDARD_MASK) -#define LPO_CAL_ENABLE_LSB (targetdef->d_LPO_CAL_ENABLE_LSB) -#define LPO_CAL_ENABLE_MASK (targetdef->d_LPO_CAL_ENABLE_MASK) -#define CLOCK_GPIO_BT_CLK_OUT_EN_LSB (targetdef->d_CLOCK_GPIO_BT_CLK_OUT_EN_LSB) -#define CLOCK_GPIO_BT_CLK_OUT_EN_MASK (targetdef->d_CLOCK_GPIO_BT_CLK_OUT_EN_MASK) -#define ANALOG_INTF_BASE_ADDRESS (targetdef->d_ANALOG_INTF_BASE_ADDRESS) - -/* SET macros */ -#define WLAN_SYSTEM_SLEEP_DISABLE_SET(x) (((x) << WLAN_SYSTEM_SLEEP_DISABLE_LSB) & WLAN_SYSTEM_SLEEP_DISABLE_MASK) -#define SI_CONFIG_BIDIR_OD_DATA_SET(x) (((x) << SI_CONFIG_BIDIR_OD_DATA_LSB) & SI_CONFIG_BIDIR_OD_DATA_MASK) -#define SI_CONFIG_I2C_SET(x) (((x) << SI_CONFIG_I2C_LSB) & SI_CONFIG_I2C_MASK) -#define SI_CONFIG_POS_SAMPLE_SET(x) (((x) << SI_CONFIG_POS_SAMPLE_LSB) & SI_CONFIG_POS_SAMPLE_MASK) -#define SI_CONFIG_INACTIVE_CLK_SET(x) (((x) << SI_CONFIG_INACTIVE_CLK_LSB) & SI_CONFIG_INACTIVE_CLK_MASK) -#define SI_CONFIG_INACTIVE_DATA_SET(x) (((x) << SI_CONFIG_INACTIVE_DATA_LSB) & SI_CONFIG_INACTIVE_DATA_MASK) -#define SI_CONFIG_DIVIDER_SET(x) (((x) << SI_CONFIG_DIVIDER_LSB) & SI_CONFIG_DIVIDER_MASK) -#define SI_CS_START_SET(x) (((x) << SI_CS_START_LSB) & SI_CS_START_MASK) -#define SI_CS_RX_CNT_SET(x) (((x) << SI_CS_RX_CNT_LSB) & SI_CS_RX_CNT_MASK) -#define SI_CS_TX_CNT_SET(x) (((x) << SI_CS_TX_CNT_LSB) & SI_CS_TX_CNT_MASK) -#define LPO_CAL_ENABLE_SET(x) (((x) << LPO_CAL_ENABLE_LSB) & LPO_CAL_ENABLE_MASK) -#define CPU_CLOCK_STANDARD_SET(x) (((x) << CPU_CLOCK_STANDARD_LSB) & CPU_CLOCK_STANDARD_MASK) -#define CLOCK_GPIO_BT_CLK_OUT_EN_SET(x) (((x) << CLOCK_GPIO_BT_CLK_OUT_EN_LSB) & CLOCK_GPIO_BT_CLK_OUT_EN_MASK) -extern struct targetdef_s *targetdef; - -#endif /* } */ - -#endif /*TARGET_REG_TABLE_H_*/ diff --git a/drivers/net/wireless/ar6003/host/include/utils_api.h b/drivers/net/wireless/ar6003/host/include/utils_api.h deleted file mode 100644 index d3aad4ea9e64..000000000000 --- a/drivers/net/wireless/ar6003/host/include/utils_api.h +++ /dev/null @@ -1,103 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Utility Macros & Functions common across OS. -// Author(s): ="Atheros" -//============================================================================== -#ifndef _HOST_UTILS_API_H_ -#define _HOST_UTILS_API_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* unaligned little endian access */ -#define LE_READ_2(p) \ - ((A_UINT16) \ - ((((A_UINT8 *)(p))[0] ) | (((A_UINT8 *)(p))[1] << 8))) - -#define LE_READ_4(p) \ - ((A_UINT32) \ - ((((A_UINT8 *)(p))[0] ) | (((A_UINT8 *)(p))[1] << 8) | \ - (((A_UINT8 *)(p))[2] << 16) | (((A_UINT8 *)(p))[3] << 24))) - -#define WPA_GET_BE16(a) ((A_UINT16) (((a)[0] << 8) | (a)[1])) -#define WPA_PUT_BE16(a, val) \ - do { \ - (a)[0] = ((A_UINT16) (val)) >> 8; \ - (a)[1] = ((A_UINT16) (val)) & 0xff; \ - } while (0) - -#define WPA_GET_LE16(a) ((A_UINT16) (((a)[1] << 8) | (a)[0])) -#define WPA_PUT_LE16(a, val) \ - do { \ - (a)[1] = ((A_UINT16) (val)) >> 8; \ - (a)[0] = ((A_UINT16) (val)) & 0xff; \ - } while (0) - -#define WPA_GET_BE24(a) ((((A_UINT32) (a)[0]) << 16) | (((A_UINT32) (a)[1]) << 8) | \ - ((A_UINT32) (a)[2])) -#define WPA_PUT_BE24(a, val) \ - do { \ - (a)[0] = (A_UINT8) ((((A_UINT32) (val)) >> 16) & 0xff); \ - (a)[1] = (A_UINT8) ((((A_UINT32) (val)) >> 8) & 0xff); \ - (a)[2] = (A_UINT8) (((A_UINT32) (val)) & 0xff); \ - } while (0) - -#define WPA_GET_BE32(a) ((((A_UINT32) (a)[0]) << 24) | (((A_UINT32) (a)[1]) << 16) | \ - (((A_UINT32) (a)[2]) << 8) | ((A_UINT32) (a)[3])) -#define WPA_PUT_BE32(a, val) \ - do { \ - (a)[0] = (A_UINT8) ((((A_UINT32) (val)) >> 24) & 0xff); \ - (a)[1] = (A_UINT8) ((((A_UINT32) (val)) >> 16) & 0xff); \ - (a)[2] = (A_UINT8) ((((A_UINT32) (val)) >> 8) & 0xff); \ - (a)[3] = (A_UINT8) (((A_UINT32) (val)) & 0xff); \ - } while (0) - -#define WPA_GET_LE32(a) ((((A_UINT32) (a)[3]) << 24) | (((A_UINT32) (a)[2]) << 16) | \ - (((A_UINT32) (a)[1]) << 8) | ((A_UINT32) (a)[0])) -#define WPA_PUT_LE32(a, val) \ - do { \ - (a)[3] = (A_UINT8) ((((A_UINT32) (val)) >> 24) & 0xff); \ - (a)[2] = (A_UINT8) ((((A_UINT32) (val)) >> 16) & 0xff); \ - (a)[1] = (A_UINT8) ((((A_UINT32) (val)) >> 8) & 0xff); \ - (a)[0] = (A_UINT8) (((A_UINT32) (val)) & 0xff); \ - } while (0) - - -#define WPA_OUI 0xf25000 - -static int __inline -iswscoui(const A_UINT8 *frm) -{ - return frm[1] > 3 && LE_READ_4(frm+2) == ((0x04<<24)|WPA_OUI); -} - -static inline int is_zero_mac_addr(const A_UINT8 *addr) -{ - return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]); -} - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _HOST_UTILS_API_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/wlan_api.h b/drivers/net/wireless/ar6003/host/include/wlan_api.h deleted file mode 100644 index 5a53d18da5ff..000000000000 --- a/drivers/net/wireless/ar6003/host/include/wlan_api.h +++ /dev/null @@ -1,137 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file contains the API for the host wlan module -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _HOST_WLAN_API_H_ -#define _HOST_WLAN_API_H_ - - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -struct ieee80211_node_table; -struct ieee80211_frame; - -struct ieee80211_common_ie { - A_UINT16 ie_chan; - A_UINT8 *ie_tstamp; - A_UINT8 *ie_ssid; - A_UINT8 *ie_rates; - A_UINT8 *ie_xrates; - A_UINT8 *ie_country; - A_UINT8 *ie_wpa; - A_UINT8 *ie_rsn; - A_UINT8 *ie_wmm; - A_UINT8 *ie_ath; - A_UINT16 ie_capInfo; - A_UINT16 ie_beaconInt; - A_UINT8 *ie_tim; - A_UINT8 *ie_chswitch; - A_UINT8 ie_erp; - A_UINT8 *ie_wsc; - A_UINT8 *ie_htcap; - A_UINT8 *ie_htop; -#ifdef WAPI_ENABLE - A_UINT8 *ie_wapi; -#endif - - -}; - -typedef struct bss { - A_UINT8 ni_macaddr[6]; - A_UINT8 ni_snr; - A_INT16 ni_rssi; - struct bss *ni_list_next; - struct bss *ni_list_prev; - struct bss *ni_hash_next; - struct bss *ni_hash_prev; - struct ieee80211_common_ie ni_cie; -#ifdef P2P - void *p2p_dev; -#endif /* P2P */ - A_UINT8 *ni_buf; - A_UINT16 ni_framelen; - A_UINT8 ni_frametype; /* frame type in ni_buf */ - struct ieee80211_node_table *ni_table; - A_UINT32 ni_refcnt; - int ni_scangen; - - A_UINT32 ni_tstamp; - A_UINT32 ni_actcnt; -#ifdef OS_ROAM_MANAGEMENT - A_UINT32 ni_si_gen; -#endif -} bss_t; - -typedef void wlan_node_iter_func(void *arg, bss_t *); - -bss_t *wlan_node_alloc(struct ieee80211_node_table *nt, int wh_size); -void wlan_node_free(bss_t *ni); -void wlan_setup_node(struct ieee80211_node_table *nt, bss_t *ni, - const A_UINT8 *macaddr); -bss_t *wlan_find_node(struct ieee80211_node_table *nt, const A_UINT8 *macaddr); -void wlan_node_reclaim(struct ieee80211_node_table *nt, bss_t *ni); -A_STATUS wlan_node_buf_update(struct ieee80211_node_table *nt, bss_t *ni, A_UINT32 len); -void wlan_free_allnodes(struct ieee80211_node_table *nt); -void wlan_iterate_nodes(struct ieee80211_node_table *nt, wlan_node_iter_func *f, - void *arg); - -void wlan_node_table_init(void *wmip, struct ieee80211_node_table *nt); -void wlan_node_table_reset(struct ieee80211_node_table *nt); -void wlan_node_table_cleanup(struct ieee80211_node_table *nt); - -A_STATUS wlan_parse_beacon(A_UINT8 *buf, int framelen, - struct ieee80211_common_ie *cie); - -A_UINT16 wlan_ieee2freq(int chan); -A_UINT32 wlan_freq2ieee(A_UINT16 freq); - -void wlan_set_nodeage(struct ieee80211_node_table *nt, A_UINT32 nodeAge); - -void -wlan_refresh_inactive_nodes (struct ieee80211_node_table *nt); - -bss_t * -wlan_find_Ssidnode (struct ieee80211_node_table *nt, A_UCHAR *pSsid, - A_UINT32 ssidLength, A_BOOL bIsWPA2, A_BOOL bMatchSSID); - -void -wlan_node_return (struct ieee80211_node_table *nt, bss_t *ni); - -bss_t *wlan_node_remove(struct ieee80211_node_table *nt, A_UINT8 *bssid); - -bss_t * -wlan_find_matching_Ssidnode (struct ieee80211_node_table *nt, A_UCHAR *pSsid, - A_UINT32 ssidLength, A_UINT32 dot11AuthMode, A_UINT32 authMode, - A_UINT32 pairwiseCryptoType, A_UINT32 grpwiseCryptoTyp); - -void wlan_node_update_timestamp(struct ieee80211_node_table *nt, bss_t *ni); - -#ifdef __cplusplus -} -#endif - -#endif /* _HOST_WLAN_API_H_ */ diff --git a/drivers/net/wireless/ar6003/host/include/wmi_api.h b/drivers/net/wireless/ar6003/host/include/wmi_api.h deleted file mode 100644 index c992fd4fa1b7..000000000000 --- a/drivers/net/wireless/ar6003/host/include/wmi_api.h +++ /dev/null @@ -1,565 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file contains the definitions for the Wireless Module Interface (WMI). -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _WMI_API_H_ -#define _WMI_API_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - /* WMI converts a dix frame with an ethernet payload (up to 1500 bytes) - * to an 802.3 frame (adds SNAP header) and adds on a WMI data header */ -#define WMI_MAX_TX_DATA_FRAME_LENGTH (1500 + sizeof(WMI_DATA_HDR) + sizeof(ATH_MAC_HDR) + sizeof(ATH_LLC_SNAP_HDR)) - - /* A normal WMI data frame */ -#define WMI_MAX_NORMAL_RX_DATA_FRAME_LENGTH (1500 + sizeof(WMI_DATA_HDR) + sizeof(ATH_MAC_HDR) + sizeof(ATH_LLC_SNAP_HDR)) - - /* An AMSDU frame */ /* The MAX AMSDU length of AR6003 is 3839 */ -#define WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH (3840 + sizeof(WMI_DATA_HDR) + sizeof(ATH_MAC_HDR) + sizeof(ATH_LLC_SNAP_HDR)) - -/* - * IP QoS Field definitions according to 802.1p - */ -#define BEST_EFFORT_PRI 0 -#define BACKGROUND_PRI 1 -#define EXCELLENT_EFFORT_PRI 3 -#define CONTROLLED_LOAD_PRI 4 -#define VIDEO_PRI 5 -#define VOICE_PRI 6 -#define NETWORK_CONTROL_PRI 7 -#define MAX_NUM_PRI 8 - -#define UNDEFINED_PRI (0xff) - -#define WMI_IMPLICIT_PSTREAM_INACTIVITY_INT 5000 /* 5 seconds */ - -#define A_ROUND_UP(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) - -typedef enum { - ATHEROS_COMPLIANCE = 0x1, -}TSPEC_PARAM_COMPLIANCE; - -struct wmi_t; - -void *wmi_init(void *devt, int devid); - -void wmi_qos_state_init(struct wmi_t *wmip); -void wmi_shutdown(struct wmi_t *wmip); -HTC_ENDPOINT_ID wmi_get_control_ep(struct wmi_t * wmip); -void wmi_set_control_ep(struct wmi_t * wmip, HTC_ENDPOINT_ID eid); -A_UINT16 wmi_get_mapped_qos_queue(struct wmi_t *, A_UINT8); -A_STATUS wmi_dix_2_dot3(struct wmi_t *wmip, void *osbuf); -A_STATUS wmi_data_hdr_add(struct wmi_t *wmip, void *osbuf, A_UINT8 msgType, A_UINT32 flags , WMI_DATA_HDR_DATA_TYPE data_type,A_UINT8 metaVersion, void *pTxMetaS); -A_STATUS wmi_dot3_2_dix(void *osbuf); - -A_STATUS wmi_dot11_hdr_remove (struct wmi_t *wmip, void *osbuf); -A_STATUS wmi_dot11_hdr_add(struct wmi_t *wmip, void *osbuf, NETWORK_TYPE mode); - -A_STATUS wmi_data_hdr_remove(struct wmi_t *wmip, void *osbuf); -A_STATUS wmi_syncpoint(struct wmi_t *wmip); -A_STATUS wmi_syncpoint_reset(struct wmi_t *wmip); -A_UINT8 wmi_implicit_create_pstream(struct wmi_t *wmip, void *osbuf, A_UINT32 layer2Priority, A_BOOL wmmEnabled); - -A_UINT8 wmi_determine_userPriority (A_UINT8 *pkt, A_UINT32 layer2Pri); - -A_STATUS wmi_control_rx(struct wmi_t *wmip, void *osbuf); -void wmi_iterate_nodes(struct wmi_t *wmip, wlan_node_iter_func *f, void *arg); -void wmi_free_allnodes(struct wmi_t *wmip); -bss_t *wmi_find_node(struct wmi_t *wmip, const A_UINT8 *macaddr); -void wmi_free_node(struct wmi_t *wmip, const A_UINT8 *macaddr); - - -typedef enum { - NO_SYNC_WMIFLAG = 0, - SYNC_BEFORE_WMIFLAG, /* transmit all queued data before cmd */ - SYNC_AFTER_WMIFLAG, /* any new data waits until cmd execs */ - SYNC_BOTH_WMIFLAG, - END_WMIFLAG /* end marker */ -} WMI_SYNC_FLAG; - -A_STATUS wmi_cmd_send(struct wmi_t *wmip, void *osbuf, WMI_COMMAND_ID cmdId, - WMI_SYNC_FLAG flag); - -A_STATUS wmi_connect_cmd(struct wmi_t *wmip, - NETWORK_TYPE netType, - DOT11_AUTH_MODE dot11AuthMode, - AUTH_MODE authMode, - CRYPTO_TYPE pairwiseCrypto, - A_UINT8 pairwiseCryptoLen, - CRYPTO_TYPE groupCrypto, - A_UINT8 groupCryptoLen, - int ssidLength, - A_UCHAR *ssid, - A_UINT8 *bssid, - A_UINT16 channel, - A_UINT32 ctrl_flags); - -A_STATUS wmi_set_div_param_cmd(struct wmi_t *wmip, A_UINT32 divIdleTime, - A_UINT8 antRssiThresh, A_UINT8 divEnable, A_UINT16 active_treshold_rate); - - -A_STATUS wmi_reconnect_cmd(struct wmi_t *wmip, - A_UINT8 *bssid, - A_UINT16 channel); -A_STATUS wmi_disconnect_cmd(struct wmi_t *wmip); -A_STATUS wmi_getrev_cmd(struct wmi_t *wmip); -A_STATUS wmi_startscan_cmd(struct wmi_t *wmip, WMI_SCAN_TYPE scanType, - A_BOOL forceFgScan, A_BOOL isLegacy, - A_UINT32 homeDwellTime, A_UINT32 forceScanInterval, - A_INT8 numChan, A_UINT16 *channelList); -A_STATUS wmi_scanparams_cmd(struct wmi_t *wmip, A_UINT16 fg_start_sec, - A_UINT16 fg_end_sec, A_UINT16 bg_sec, - A_UINT16 minact_chdw_msec, - A_UINT16 maxact_chdw_msec, A_UINT16 pas_chdw_msec, - A_UINT8 shScanRatio, A_UINT8 scanCtrlFlags, - A_UINT32 max_dfsch_act_time, - A_UINT16 maxact_scan_per_ssid); -A_STATUS wmi_bssfilter_cmd(struct wmi_t *wmip, A_UINT8 filter, A_UINT32 ieMask); -A_STATUS wmi_probedSsid_cmd(struct wmi_t *wmip, A_UINT8 index, A_UINT8 flag, - A_UINT8 ssidLength, A_UCHAR *ssid); -A_STATUS wmi_listeninterval_cmd(struct wmi_t *wmip, A_UINT16 listenInterval, A_UINT16 listenBeacons); -A_STATUS wmi_bmisstime_cmd(struct wmi_t *wmip, A_UINT16 bmisstime, A_UINT16 bmissbeacons); -A_STATUS wmi_associnfo_cmd(struct wmi_t *wmip, A_UINT8 ieType, - A_UINT8 ieLen, A_UINT8 *ieInfo); -A_STATUS wmi_powermode_cmd(struct wmi_t *wmip, A_UINT8 powerMode); -A_STATUS wmi_ibsspmcaps_cmd(struct wmi_t *wmip, A_UINT8 pmEnable, A_UINT8 ttl, - A_UINT16 atim_windows, A_UINT16 timeout_value); -A_STATUS wmi_apps_cmd(struct wmi_t *wmip, A_UINT8 psType, A_UINT32 idle_time, - A_UINT32 ps_period, A_UINT8 sleep_period); -A_STATUS wmi_pmparams_cmd(struct wmi_t *wmip, A_UINT16 idlePeriod, - A_UINT16 psPollNum, A_UINT16 dtimPolicy, - A_UINT16 wakup_tx_policy, A_UINT16 num_tx_to_wakeup, - A_UINT16 ps_fail_event_policy); -A_STATUS wmi_disctimeout_cmd(struct wmi_t *wmip, A_UINT8 timeout); -A_STATUS wmi_sync_cmd(struct wmi_t *wmip, A_UINT8 syncNumber); -A_STATUS wmi_create_pstream_cmd(struct wmi_t *wmip, WMI_CREATE_PSTREAM_CMD *pstream); -A_STATUS wmi_delete_pstream_cmd(struct wmi_t *wmip, A_UINT8 trafficClass, A_UINT8 streamID); -A_STATUS wmi_set_framerate_cmd(struct wmi_t *wmip, A_UINT8 bEnable, A_UINT8 type, A_UINT8 subType, A_UINT16 rateMask); -A_STATUS wmi_set_bitrate_cmd(struct wmi_t *wmip, A_INT32 dataRate, A_INT32 mgmtRate, A_INT32 ctlRate); -A_STATUS wmi_get_bitrate_cmd(struct wmi_t *wmip); -A_INT8 wmi_validate_bitrate(struct wmi_t *wmip, A_INT32 rate, A_INT8 *rate_idx); -A_STATUS wmi_get_regDomain_cmd(struct wmi_t *wmip); -A_STATUS wmi_get_channelList_cmd(struct wmi_t *wmip); -A_STATUS wmi_set_channelParams_cmd(struct wmi_t *wmip, A_UINT8 scanParam, - WMI_PHY_MODE mode, A_INT8 numChan, - A_UINT16 *channelList); - -A_STATUS wmi_set_snr_threshold_params(struct wmi_t *wmip, - WMI_SNR_THRESHOLD_PARAMS_CMD *snrCmd); -A_STATUS wmi_set_rssi_threshold_params(struct wmi_t *wmip, - WMI_RSSI_THRESHOLD_PARAMS_CMD *rssiCmd); -A_STATUS wmi_clr_rssi_snr(struct wmi_t *wmip); -A_STATUS wmi_set_lq_threshold_params(struct wmi_t *wmip, - WMI_LQ_THRESHOLD_PARAMS_CMD *lqCmd); -A_STATUS wmi_set_rts_cmd(struct wmi_t *wmip, A_UINT16 threshold); -A_STATUS wmi_set_lpreamble_cmd(struct wmi_t *wmip, A_UINT8 status, A_UINT8 preamblePolicy); - -A_STATUS wmi_set_error_report_bitmask(struct wmi_t *wmip, A_UINT32 bitmask); - -A_STATUS wmi_get_challenge_resp_cmd(struct wmi_t *wmip, A_UINT32 cookie, - A_UINT32 source); - -A_STATUS wmi_config_debug_module_cmd(struct wmi_t *wmip, A_UINT16 mmask, - A_UINT16 tsr, A_BOOL rep, A_UINT16 size, - A_UINT32 valid); - -A_STATUS wmi_get_stats_cmd(struct wmi_t *wmip); - -A_STATUS wmi_addKey_cmd(struct wmi_t *wmip, A_UINT8 keyIndex, - CRYPTO_TYPE keyType, A_UINT8 keyUsage, - A_UINT8 keyLength,A_UINT8 *keyRSC, - A_UINT8 *keyMaterial, A_UINT8 key_op_ctrl, A_UINT8 *mac, - WMI_SYNC_FLAG sync_flag); -A_STATUS wmi_add_krk_cmd(struct wmi_t *wmip, A_UINT8 *krk); -A_STATUS wmi_delete_krk_cmd(struct wmi_t *wmip); -A_STATUS wmi_deleteKey_cmd(struct wmi_t *wmip, A_UINT8 keyIndex); -A_STATUS wmi_set_akmp_params_cmd(struct wmi_t *wmip, - WMI_SET_AKMP_PARAMS_CMD *akmpParams); -A_STATUS wmi_get_pmkid_list_cmd(struct wmi_t *wmip); -A_STATUS wmi_set_pmkid_list_cmd(struct wmi_t *wmip, - WMI_SET_PMKID_LIST_CMD *pmkInfo); -A_STATUS wmi_abort_scan_cmd(struct wmi_t *wmip); -A_STATUS wmi_set_txPwr_cmd(struct wmi_t *wmip, A_UINT8 dbM); -A_STATUS wmi_get_txPwr_cmd(struct wmi_t *wmip); -A_STATUS wmi_addBadAp_cmd(struct wmi_t *wmip, A_UINT8 apIndex, A_UINT8 *bssid); -A_STATUS wmi_deleteBadAp_cmd(struct wmi_t *wmip, A_UINT8 apIndex); -A_STATUS wmi_set_tkip_countermeasures_cmd(struct wmi_t *wmip, A_BOOL en); -A_STATUS wmi_setPmkid_cmd(struct wmi_t *wmip, A_UINT8 *bssid, A_UINT8 *pmkId, - A_BOOL set); -A_STATUS wmi_set_access_params_cmd(struct wmi_t *wmip, A_UINT8 ac, A_UINT16 txop, - A_UINT8 eCWmin, A_UINT8 eCWmax, - A_UINT8 aifsn); -A_STATUS wmi_set_retry_limits_cmd(struct wmi_t *wmip, A_UINT8 frameType, - A_UINT8 trafficClass, A_UINT8 maxRetries, - A_UINT8 enableNotify); - -void wmi_get_current_bssid(struct wmi_t *wmip, A_UINT8 *bssid); - -A_STATUS wmi_get_roam_tbl_cmd(struct wmi_t *wmip); -A_STATUS wmi_get_roam_data_cmd(struct wmi_t *wmip, A_UINT8 roamDataType); -A_STATUS wmi_set_roam_ctrl_cmd(struct wmi_t *wmip, WMI_SET_ROAM_CTRL_CMD *p, - A_UINT8 size); -A_STATUS wmi_set_powersave_timers_cmd(struct wmi_t *wmip, - WMI_POWERSAVE_TIMERS_POLICY_CMD *pCmd, - A_UINT8 size); - -A_STATUS wmi_set_opt_mode_cmd(struct wmi_t *wmip, A_UINT8 optMode); -A_STATUS wmi_opt_tx_frame_cmd(struct wmi_t *wmip, - A_UINT8 frmType, - A_UINT8 *dstMacAddr, - A_UINT8 *bssid, - A_UINT16 optIEDataLen, - A_UINT8 *optIEData); - -A_STATUS wmi_set_adhoc_bconIntvl_cmd(struct wmi_t *wmip, A_UINT16 intvl); -A_STATUS wmi_set_voice_pkt_size_cmd(struct wmi_t *wmip, A_UINT16 voicePktSize); -A_STATUS wmi_set_max_sp_len_cmd(struct wmi_t *wmip, A_UINT8 maxSpLen); -A_UINT8 convert_userPriority_to_trafficClass(A_UINT8 userPriority); -A_UINT8 wmi_get_power_mode_cmd(struct wmi_t *wmip); -A_STATUS wmi_verify_tspec_params(WMI_CREATE_PSTREAM_CMD *pCmd, A_BOOL tspecCompliance); - -#ifdef CONFIG_HOST_TCMD_SUPPORT -A_STATUS wmi_test_cmd(struct wmi_t *wmip, A_UINT8 *buf, A_UINT32 len); -#endif - -A_STATUS wmi_set_bt_status_cmd(struct wmi_t *wmip, A_UINT8 streamType, A_UINT8 status); -A_STATUS wmi_set_bt_params_cmd(struct wmi_t *wmip, WMI_SET_BT_PARAMS_CMD* cmd); - -A_STATUS wmi_set_btcoex_fe_ant_cmd(struct wmi_t *wmip, WMI_SET_BTCOEX_FE_ANT_CMD * cmd); - -A_STATUS wmi_set_btcoex_colocated_bt_dev_cmd(struct wmi_t *wmip, - WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD * cmd); - -A_STATUS wmi_set_btcoex_btinquiry_page_config_cmd(struct wmi_t *wmip, - WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD *cmd); - -A_STATUS wmi_set_btcoex_sco_config_cmd(struct wmi_t *wmip, - WMI_SET_BTCOEX_SCO_CONFIG_CMD * cmd); - -A_STATUS wmi_set_btcoex_a2dp_config_cmd(struct wmi_t *wmip, - WMI_SET_BTCOEX_A2DP_CONFIG_CMD* cmd); - - -A_STATUS wmi_set_btcoex_aclcoex_config_cmd(struct wmi_t *wmip, WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD* cmd); - -A_STATUS wmi_set_btcoex_debug_cmd(struct wmi_t *wmip, WMI_SET_BTCOEX_DEBUG_CMD * cmd); - -A_STATUS wmi_set_btcoex_bt_operating_status_cmd(struct wmi_t * wmip, - WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD * cmd); - -A_STATUS wmi_get_btcoex_config_cmd(struct wmi_t * wmip, WMI_GET_BTCOEX_CONFIG_CMD * cmd); - -A_STATUS wmi_get_btcoex_stats_cmd(struct wmi_t * wmip); - -A_STATUS wmi_SGI_cmd(struct wmi_t *wmip, A_UINT32 *sgiMask, A_UINT8 sgiPERThreshold); - -/* - * This function is used to configure the fix rates mask to the target. - */ -A_STATUS wmi_set_fixrates_cmd(struct wmi_t *wmip, A_UINT32 *fixRatesMask); -A_STATUS wmi_get_ratemask_cmd(struct wmi_t *wmip); - -A_STATUS wmi_set_authmode_cmd(struct wmi_t *wmip, A_UINT8 mode); - -A_STATUS wmi_set_reassocmode_cmd(struct wmi_t *wmip, A_UINT8 mode); - -A_STATUS wmi_set_qos_supp_cmd(struct wmi_t *wmip,A_UINT8 status); -A_STATUS wmi_set_wmm_cmd(struct wmi_t *wmip, WMI_WMM_STATUS status); -A_STATUS wmi_set_wmm_txop(struct wmi_t *wmip, WMI_TXOP_CFG txEnable); -A_STATUS wmi_set_country(struct wmi_t *wmip, A_UCHAR *countryCode); - -A_STATUS wmi_get_keepalive_configured(struct wmi_t *wmip); -A_UINT8 wmi_get_keepalive_cmd(struct wmi_t *wmip); -A_STATUS wmi_set_keepalive_cmd(struct wmi_t *wmip, A_UINT8 keepaliveInterval); - -A_STATUS wmi_set_appie_cmd(struct wmi_t *wmip, A_UINT8 mgmtFrmType, - A_UINT8 ieLen,A_UINT8 *ieInfo); - -A_STATUS wmi_set_halparam_cmd(struct wmi_t *wmip, A_UINT8 *cmd, A_UINT16 dataLen); - -A_INT32 wmi_get_rate(A_INT8 rateindex); - -A_STATUS wmi_set_ip_cmd(struct wmi_t *wmip, WMI_SET_IP_CMD *cmd); - -/*Wake on Wireless WMI commands*/ -A_STATUS wmi_set_host_sleep_mode_cmd(struct wmi_t *wmip, WMI_SET_HOST_SLEEP_MODE_CMD *cmd); -A_STATUS wmi_set_wow_mode_cmd(struct wmi_t *wmip, WMI_SET_WOW_MODE_CMD *cmd); -A_STATUS wmi_get_wow_list_cmd(struct wmi_t *wmip, WMI_GET_WOW_LIST_CMD *cmd); -A_STATUS wmi_add_wow_pattern_cmd(struct wmi_t *wmip, - WMI_ADD_WOW_PATTERN_CMD *cmd, A_UINT8* pattern, A_UINT8* mask, A_UINT8 pattern_size); -A_STATUS wmi_del_wow_pattern_cmd(struct wmi_t *wmip, - WMI_DEL_WOW_PATTERN_CMD *cmd); -A_STATUS wmi_set_wsc_status_cmd(struct wmi_t *wmip, A_UINT32 status); - -A_STATUS -wmi_set_params_cmd(struct wmi_t *wmip, A_UINT32 opcode, A_UINT32 length, A_CHAR* buffer); - -A_STATUS -wmi_set_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 *filter); - -A_STATUS -wmi_del_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 *filter); - -A_STATUS -wmi_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 enable); - -bss_t * -wmi_find_Ssidnode (struct wmi_t *wmip, A_UCHAR *pSsid, - A_UINT32 ssidLength, A_BOOL bIsWPA2, A_BOOL bMatchSSID); - - -void -wmi_node_return (struct wmi_t *wmip, bss_t *bss); - -void -wmi_node_update_timestamp(struct wmi_t *wmip, bss_t *bss); - -void wmi_setup_node(struct wmi_t *wmip, bss_t *bss, const A_UINT8 *bssid); - -bss_t *wmi_node_alloc(struct wmi_t *wmip, A_UINT8 len); - -void -wmi_set_nodeage(struct wmi_t *wmip, A_UINT32 nodeAge); - -#if defined(CONFIG_TARGET_PROFILE_SUPPORT) -A_STATUS wmi_prof_cfg_cmd(struct wmi_t *wmip, A_UINT32 period, A_UINT32 nbins); -A_STATUS wmi_prof_addr_set_cmd(struct wmi_t *wmip, A_UINT32 addr); -A_STATUS wmi_prof_start_cmd(struct wmi_t *wmip); -A_STATUS wmi_prof_stop_cmd(struct wmi_t *wmip); -A_STATUS wmi_prof_count_get_cmd(struct wmi_t *wmip); -#endif /* CONFIG_TARGET_PROFILE_SUPPORT */ -#ifdef OS_ROAM_MANAGEMENT -void wmi_scan_indication (struct wmi_t *wmip); -#endif - -A_STATUS -wmi_set_target_event_report_cmd(struct wmi_t *wmip, WMI_SET_TARGET_EVENT_REPORT_CMD* cmd); - -bss_t *wmi_rm_current_bss (struct wmi_t *wmip, A_UINT8 *id); -A_STATUS wmi_add_current_bss (struct wmi_t *wmip, A_UINT8 *id, bss_t *bss); - - -/* - * AP mode - */ -A_STATUS -wmi_ap_profile_commit(struct wmi_t *wmip, WMI_CONNECT_CMD *p); - -A_STATUS -wmi_ap_set_hidden_ssid(struct wmi_t *wmip, A_UINT8 hidden_ssid); - -A_STATUS -wmi_ap_set_num_sta(struct wmi_t *wmip, A_UINT8 num_sta); - -A_STATUS -wmi_ap_set_dfs(struct wmi_t *wmip, A_UINT8 enable); - -A_STATUS -wmi_ap_set_acl_policy(struct wmi_t *wmip, A_UINT8 policy); - -A_STATUS -wmi_ap_acl_mac_list(struct wmi_t *wmip, WMI_AP_ACL_MAC_CMD *a); - -A_UINT8 -acl_add_del_mac(WMI_AP_ACL *a, WMI_AP_ACL_MAC_CMD *acl); - -A_STATUS -wmi_ap_set_mlme(struct wmi_t *wmip, A_UINT8 cmd, A_UINT8 *mac, A_UINT16 reason); - -A_STATUS -wmi_set_pvb_cmd(struct wmi_t *wmip, A_UINT16 aid, A_BOOL flag); - -A_STATUS -wmi_ap_conn_inact_time(struct wmi_t *wmip, A_UINT32 period); - -A_STATUS -wmi_ap_bgscan_time(struct wmi_t *wmip, A_UINT32 period, A_UINT32 dwell); - -A_STATUS -wmi_ap_set_dtim(struct wmi_t *wmip, A_UINT8 dtim); - -A_STATUS -wmi_ap_set_rateset(struct wmi_t *wmip, A_UINT8 rateset); - -A_STATUS -wmi_set_ht_cap_cmd(struct wmi_t *wmip, WMI_SET_HT_CAP_CMD *cmd); - -A_STATUS -wmi_get_ht_cap_cmd(struct wmi_t *wmip, WMI_SET_HT_CAP_CMD *cmd); - -A_STATUS -wmi_set_ht_op_cmd(struct wmi_t *wmip, A_UINT8 sta_chan_width); - -A_STATUS -wmi_send_hci_cmd(struct wmi_t *wmip, A_UINT8 *buf, A_UINT16 sz); - -A_STATUS -wmi_set_tx_select_rates_cmd(struct wmi_t *wmip, A_UINT32 *pMaskArray); - -A_STATUS -wmi_setup_aggr_cmd(struct wmi_t *wmip, A_UINT8 tid); - -A_STATUS -wmi_delete_aggr_cmd(struct wmi_t *wmip, A_UINT8 tid, A_BOOL uplink); - -A_STATUS -wmi_allow_aggr_cmd(struct wmi_t *wmip, A_UINT16 tx_tidmask, A_UINT16 rx_tidmask); - -A_STATUS -wmi_set_rx_frame_format_cmd(struct wmi_t *wmip, A_UINT8 rxMetaVersion, A_BOOL rxDot11Hdr, A_BOOL defragOnHost); - -A_STATUS -wmi_set_thin_mode_cmd(struct wmi_t *wmip, A_BOOL bThinMode); - -A_STATUS -wmi_set_wlan_conn_precedence_cmd(struct wmi_t *wmip, BT_WLAN_CONN_PRECEDENCE precedence); - -A_STATUS -wmi_set_pmk_cmd(struct wmi_t *wmip, A_UINT8 *pmk); - -A_STATUS -wmi_set_passphrase_cmd(struct wmi_t *wmip, WMI_SET_PASSPHRASE_CMD *cmd); - -A_STATUS -wmi_set_excess_tx_retry_thres_cmd(struct wmi_t *wmip, WMI_SET_EXCESS_TX_RETRY_THRES_CMD *cmd); - -A_STATUS -wmi_assoc_req_enable_cmd(struct wmi_t *wmip, A_UINT8 enable); - -A_STATUS -wmi_assoc_req_report_cmd (struct wmi_t *wmip, A_UINT8 host_accept, A_UINT8 host_reaspncode, A_UINT8 target_status, A_UINT8 *sta_mac_addr, A_UINT8 rspType); - -#ifdef P2P -A_STATUS -wmi_p2p_discover(struct wmi_t *wmip, WMI_P2P_FIND_CMD *find_param); - -A_STATUS -wmi_p2p_stop_find(struct wmi_t *wmip); - -A_STATUS -wmi_p2p_cancel(struct wmi_t *wmip); - -A_STATUS -wmi_p2p_listen(struct wmi_t *wmip, A_UINT32 timeout); - -A_STATUS -wmi_p2p_go_neg_start(struct wmi_t *wmip, WMI_P2P_GO_NEG_START_CMD *go_param); - -A_STATUS wmi_p2p_sdpd_tx_cmd(struct wmi_t *wmip, WMI_P2P_SDPD_TX_CMD *buf); - -A_STATUS wmi_p2p_stop_sdpd(struct wmi_t *wmip); - -A_STATUS wmi_p2p_go_neg_rsp_cmd(struct wmi_t *wmip, A_UINT8 status, - A_UINT8 go_intent, A_UINT32 wps_method, A_UINT16 listen_freq, - A_UINT8 *wpsbuf, A_UINT32 wpslen, A_UINT8 *p2pbuf, A_UINT32 p2plen, - A_UINT8 dialog_token, A_UINT8 persistent_grp); - -A_STATUS -wmi_p2p_set_config(struct wmi_t *wmip, WMI_P2P_SET_CONFIG_CMD *config); - -A_STATUS -wmi_wps_set_config(struct wmi_t *wmip, WMI_WPS_SET_CONFIG_CMD *wps_config); - -A_STATUS wmi_p2p_grp_init_cmd(struct wmi_t *wmip, WMI_P2P_GRP_INIT_CMD *buf); - -A_STATUS wmi_p2p_grp_done_cmd(struct wmi_t *wmip, - WMI_P2P_GRP_FORMATION_DONE_CMD *buf); - -A_STATUS wmi_p2p_invite_cmd(struct wmi_t *wmip, WMI_P2P_INVITE_CMD *buf); - -A_STATUS wmi_p2p_invite_req_rsp_cmd(struct wmi_t *wmip, A_UINT8 status, - A_INT8 is_go, A_UINT8 *grp_bssid, A_UINT8 *p2pbuf, - A_UINT8 p2plen, A_UINT8 dialog_token); - -A_STATUS wmi_p2p_prov_disc_cmd(struct wmi_t *wmip, - WMI_P2P_PROV_DISC_REQ_CMD *buf); - -A_STATUS wmi_p2p_set_cmd(struct wmi_t *wmip, WMI_P2P_SET_CMD *buf); - -#endif /* P2P */ - -A_UINT16 -wmi_ieee2freq (int chan); - -A_UINT32 -wmi_freq2ieee (A_UINT16 freq); - -bss_t * -wmi_find_matching_Ssidnode (struct wmi_t *wmip, A_UCHAR *pSsid, - A_UINT32 ssidLength, - A_UINT32 dot11AuthMode, A_UINT32 authMode, - A_UINT32 pairwiseCryptoType, A_UINT32 grpwiseCryptoTyp); - -A_STATUS -wmi_radarDetected_cmd(struct wmi_t *wmip, A_INT16 chan_index, A_INT8 bang_radar); - -A_STATUS -wmi_set_dfs_maxpulsedur_cmd(struct wmi_t *wmip, A_UINT32 value); - -A_STATUS -wmi_set_dfs_minrssithresh_cmd(struct wmi_t *wmip, A_INT32 rssi); - -A_STATUS -wmi_beacon2bssnode (struct wmi_t *wmip, A_UINT8 *datap, int len, A_UINT8 *bssid, A_UINT16 channel); - -A_STATUS -wmi_set_tx_mac_rules_cmd (struct wmi_t *wmip, A_UINT32 rules); - -A_STATUS -wmi_set_promiscuous_mode_cmd (struct wmi_t *wmip, A_BOOL bMode); - -//WAC -A_STATUS wmi_wac_enable_cmd(struct wmi_t *wmip, WMI_WAC_ENABLE_CMD *param); - -A_STATUS -wmi_wac_scan_reply_cmd(struct wmi_t *wmip, WAC_SUBCMD param); - -A_STATUS -wmi_wac_ctrl_req_cmd(struct wmi_t *wmip, WMI_WAC_CTRL_REQ_CMD *param); - -#ifdef CONFIG_WLAN_RFKILL -A_STATUS -wmi_get_rfkill_mode_cmd(struct wmi_t *wmip); - -A_STATUS -wmi_set_rfkill_mode_cmd(struct wmi_t *wmip,WMI_RFKILL_MODE_CMD *pCmd); - -#endif - -A_STATUS -wmi_force_target_assert(struct wmi_t *wmip); - -A_STATUS -wmi_ap_set_apsd(struct wmi_t *wmip, A_UINT8 enable); - -A_STATUS -wmi_set_apsd_buffered_traffic_cmd(struct wmi_t *wmip, A_UINT16 aid, A_UINT16 bitmap, A_UINT32 flags); - - -#ifdef __cplusplus -} -#endif - -#endif /* _WMI_API_H_ */ diff --git a/drivers/net/wireless/ar6003/host/lib/wac/Makefile b/drivers/net/wireless/ar6003/host/lib/wac/Makefile deleted file mode 100644 index 22979973c956..000000000000 --- a/drivers/net/wireless/ar6003/host/lib/wac/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2005-2007 Atheros Corporation. All rights reserved. -# -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -#------------------------------------------------------------------------------ -#============================================================================== -# Author(s): ="Atheros" -#============================================================================== -CC := $(ATH_CROSS_COMPILE_TYPE)gcc -KERNEL_SRC :=$(ATH_LINUXPATH) - -ifndef CFLAGS -#CFLAGS = -MMD -O2 -Wall -g -CFLAGS = -Wall -endif - -CFLAGS += -DCONFIG_CTRL_IFACE_UNIX -DCONFIG_CTRL_IFACE -DWAPI_ENABLE - -all: - $(CC) $(CFLAGS) -I./ -I$(KERNEL_SRC)/include -I../../include -I../../../include -I../../wlan/include \ - -I../../os/linux/include -I../../3rdparty/supplicant/opensrc_0_6_9/src/common \ - -I../../os/linux/include -I../../3rdparty/supplicant/opensrc_0_6_9/src/utils wac.c -o wac - -#wpa_ctrl.o: os_internal.o -# $(CC) $(CFLAGS) -I./ -I$(KERNEL_SRC)/include -I../../include -I../../../include -I../../wlan/include \ -# -I../../os/linux/include -I../../3rdparty/supplicant/opensrc_0_6_9/src/utils \ -# -c ../../3rdparty/supplicant/opensrc_0_6_9/src/common/wpa_ctrl.c -# -#os_internal.o: -# $(CC) $(CFLAGS) -I./ -I$(KERNEL_SRC)/include -I../../include -I../../../include -I../../wlan/include \ -# -I../../os/linux/include -I../../3rdparty/supplicant/opensrc_0_6_9/src/utils \ -# -c ../../3rdparty/supplicant/opensrc_0_6_9/src/utils/os_internal.c diff --git a/drivers/net/wireless/ar6003/host/lib/wac/wac.c b/drivers/net/wireless/ar6003/host/lib/wac/wac.c deleted file mode 100644 index f39e63ceb4c9..000000000000 --- a/drivers/net/wireless/ar6003/host/lib/wac/wac.c +++ /dev/null @@ -1,1446 +0,0 @@ -/* - * Copyright (c) 2006 Atheros Communications Inc. - * All rights reserved. - * - * - * -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef ANDROID -#include "wireless_copy.h" -#else -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "wac_defs.h" -//#include "wpa_ctrl.h" -//#include "os.h" - -#undef DEBUG -#undef DBGLOG_DEBUG - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) -/* ---------- CONSTANTS --------------- */ -#define ATH_WE_HEADER_TYPE_NULL 0 /* Not available */ -#define ATH_WE_HEADER_TYPE_CHAR 2 /* char [IFNAMSIZ] */ -#define ATH_WE_HEADER_TYPE_UINT 4 /* __u32 */ -#define ATH_WE_HEADER_TYPE_FREQ 5 /* struct iw_freq */ -#define ATH_WE_HEADER_TYPE_ADDR 6 /* struct sockaddr */ -#define ATH_WE_HEADER_TYPE_POINT 8 /* struct iw_point */ -#define ATH_WE_HEADER_TYPE_PARAM 9 /* struct iw_param */ -#define ATH_WE_HEADER_TYPE_QUAL 10 /* struct iw_quality */ - -#define ATH_WE_DESCR_FLAG_DUMP 0x0001 /* Not part of the dump command */ -#define ATH_WE_DESCR_FLAG_EVENT 0x0002 /* Generate an event on SET */ -#define ATH_WE_DESCR_FLAG_RESTRICT 0x0004 /* GET : request is ROOT only */ -#define ATH_WE_DESCR_FLAG_NOMAX 0x0008 /* GET : no limit on request size */ - -#define ATH_SIOCSIWMODUL 0x8b2f -#define ATH_SIOCGIWMODUL 0x8b2f -#define ATH_WE_VERSION (A_INT16)22 -/* ---------------------------- TYPES ---------------------------- */ - -/* - * standard IOCTL looks like. - */ -struct ath_ioctl_description -{ - A_UINT8 header_type; /* NULL, iw_point or other */ - A_UINT8 token_type; /* Future */ - A_UINT16 token_size; /* Granularity of payload */ - A_UINT16 min_tokens; /* Min acceptable token number */ - A_UINT16 max_tokens; /* Max acceptable token number */ - A_UINT32 flags; /* Special handling of the request */ -}; - - -/* -------------------------- VARIABLES -------------------------- */ - -/* - * Meta-data about all the standard Wireless Extension request we - * know about. - */ -static const struct ath_ioctl_description standard_ioctl_descr[] = { - [SIOCSIWCOMMIT - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_NULL, - }, - [SIOCGIWNAME - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_CHAR, - .flags = ATH_WE_DESCR_FLAG_DUMP, - }, - [SIOCSIWNWID - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - .flags = ATH_WE_DESCR_FLAG_EVENT, - }, - [SIOCGIWNWID - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - .flags = ATH_WE_DESCR_FLAG_DUMP, - }, - [SIOCSIWFREQ - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_FREQ, - .flags = ATH_WE_DESCR_FLAG_EVENT, - }, - [SIOCGIWFREQ - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_FREQ, - .flags = ATH_WE_DESCR_FLAG_DUMP, - }, - [SIOCSIWMODE - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_UINT, - .flags = ATH_WE_DESCR_FLAG_EVENT, - }, - [SIOCGIWMODE - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_UINT, - .flags = ATH_WE_DESCR_FLAG_DUMP, - }, - [SIOCSIWSENS - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCGIWSENS - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCSIWRANGE - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_NULL, - }, - [SIOCGIWRANGE - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = sizeof(struct iw_range), - .flags = ATH_WE_DESCR_FLAG_DUMP, - }, - [SIOCSIWPRIV - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_NULL, - }, - [SIOCGIWPRIV - SIOCIWFIRST] = { /* (handled directly by us) */ - .header_type = ATH_WE_HEADER_TYPE_NULL, - }, - [SIOCSIWSTATS - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_NULL, - }, - [SIOCGIWSTATS - SIOCIWFIRST] = { /* (handled directly by us) */ - .header_type = ATH_WE_HEADER_TYPE_NULL, - .flags = ATH_WE_DESCR_FLAG_DUMP, - }, - [SIOCSIWSPY - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = sizeof(struct sockaddr), - .max_tokens = IW_MAX_SPY, - }, - [SIOCGIWSPY - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = sizeof(struct sockaddr) + - sizeof(struct iw_quality), - .max_tokens = IW_MAX_SPY, - }, - [SIOCSIWTHRSPY - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = sizeof(struct iw_thrspy), - .min_tokens = 1, - .max_tokens = 1, - }, - [SIOCGIWTHRSPY - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = sizeof(struct iw_thrspy), - .min_tokens = 1, - .max_tokens = 1, - }, - [SIOCSIWAP - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_ADDR, - }, - [SIOCGIWAP - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_ADDR, - .flags = ATH_WE_DESCR_FLAG_DUMP, - }, - [SIOCSIWMLME - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .min_tokens = sizeof(struct iw_mlme), - .max_tokens = sizeof(struct iw_mlme), - }, - [SIOCGIWAPLIST - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = sizeof(struct sockaddr) + - sizeof(struct iw_quality), - .max_tokens = IW_MAX_AP, - .flags = ATH_WE_DESCR_FLAG_NOMAX, - }, - [SIOCSIWSCAN - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .min_tokens = 0, - .max_tokens = sizeof(struct iw_scan_req), - }, - [SIOCGIWSCAN - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_SCAN_MAX_DATA, - .flags = ATH_WE_DESCR_FLAG_NOMAX, - }, - [SIOCSIWESSID - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_ESSID_MAX_SIZE + 1, - .flags = ATH_WE_DESCR_FLAG_EVENT, - }, - [SIOCGIWESSID - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_ESSID_MAX_SIZE + 1, - .flags = ATH_WE_DESCR_FLAG_DUMP, - }, - [SIOCSIWNICKN - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_ESSID_MAX_SIZE + 1, - }, - [SIOCGIWNICKN - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_ESSID_MAX_SIZE + 1, - }, - [SIOCSIWRATE - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCGIWRATE - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCSIWRTS - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCGIWRTS - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCSIWFRAG - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCGIWFRAG - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCSIWTXPOW - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCGIWTXPOW - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCSIWRETRY - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCGIWRETRY - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCSIWENCODE - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_ENCODING_TOKEN_MAX, - .flags = ATH_WE_DESCR_FLAG_EVENT | ATH_WE_DESCR_FLAG_RESTRICT, - }, - [SIOCGIWENCODE - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_ENCODING_TOKEN_MAX, - .flags = ATH_WE_DESCR_FLAG_DUMP | ATH_WE_DESCR_FLAG_RESTRICT, - }, - [SIOCSIWPOWER - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCGIWPOWER - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [ATH_SIOCSIWMODUL - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [ATH_SIOCGIWMODUL - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCSIWGENIE - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_GENERIC_IE_MAX, - }, - [SIOCGIWGENIE - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_GENERIC_IE_MAX, - }, - [SIOCSIWAUTH - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCGIWAUTH - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_PARAM, - }, - [SIOCSIWENCODEEXT - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .min_tokens = sizeof(struct iw_encode_ext), - .max_tokens = sizeof(struct iw_encode_ext) + - IW_ENCODING_TOKEN_MAX, - }, - [SIOCGIWENCODEEXT - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .min_tokens = sizeof(struct iw_encode_ext), - .max_tokens = sizeof(struct iw_encode_ext) + - IW_ENCODING_TOKEN_MAX, - }, - [SIOCSIWPMKSA - SIOCIWFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .min_tokens = sizeof(struct iw_pmksa), - .max_tokens = sizeof(struct iw_pmksa), - }, -}; -static const unsigned int standard_ioctl_num = (sizeof(standard_ioctl_descr) / - sizeof(struct ath_ioctl_description)); - -/* - * Meta-data about all the additional standard Wireless Extension events - */ -static const struct ath_ioctl_description standard_event_descr[] = { - [IWEVTXDROP - IWEVFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_ADDR, - }, - [IWEVQUAL - IWEVFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_QUAL, - }, - [IWEVCUSTOM - IWEVFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_CUSTOM_MAX, - }, - [IWEVREGISTERED - IWEVFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_ADDR, - }, - [IWEVEXPIRED - IWEVFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_ADDR, - }, - [IWEVGENIE - IWEVFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_GENERIC_IE_MAX, - }, - [IWEVMICHAELMICFAILURE - IWEVFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = sizeof(struct iw_michaelmicfailure), - }, - [IWEVASSOCREQIE - IWEVFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_GENERIC_IE_MAX, - }, - [IWEVASSOCRESPIE - IWEVFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_GENERIC_IE_MAX, - }, - [IWEVPMKIDCAND - IWEVFIRST] = { - .header_type = ATH_WE_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = sizeof(struct iw_pmkid_cand), - }, -}; -static const unsigned int standard_event_num = (sizeof(standard_event_descr) / - sizeof(struct ath_ioctl_description)); - -/* Size (in bytes) of various events */ -static const int event_type_size[] = { - IW_EV_LCP_PK_LEN, /* ATH_WE_HEADER_TYPE_NULL */ - 0, - IW_EV_CHAR_PK_LEN, /* ATH_WE_HEADER_TYPE_CHAR */ - 0, - IW_EV_UINT_PK_LEN, /* ATH_WE_HEADER_TYPE_UINT */ - IW_EV_FREQ_PK_LEN, /* ATH_WE_HEADER_TYPE_FREQ */ - IW_EV_ADDR_PK_LEN, /* ATH_WE_HEADER_TYPE_ADDR */ - 0, - IW_EV_POINT_PK_LEN, /* Without variable payload */ - IW_EV_PARAM_PK_LEN, /* ATH_WE_HEADER_TYPE_PARAM */ - IW_EV_QUAL_PK_LEN, /* ATH_WE_HEADER_TYPE_QUAL */ -}; - -//static const char *ctrl_iface_dir = "/var/run/wpa_supplicant"; -//static struct wpa_ctrl *ctrl_conn; -//static char *ctrl_ifname = NULL; - -/* Structure used for parsing event list, such as Wireless Events - * and scan results */ -typedef struct event_list -{ - A_INT8 * end; /* End of the list */ - A_INT8 * current; /* Current event in list of events */ - A_INT8 * value; /* Current value in event */ -} event_list; - -#endif /*#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) */ - - - - -#define MAX_WAC_BSS 10 -WMI_BSS_INFO_HDR2 myBssInfo[MAX_WAC_BSS]; -int myBssCnt = 0; -int wps_pending = 0; -char exec_path[128]; -char wps_pin[9]; - -//DBG -int fakeId = 0; - -// utilities functions -typedef long os_time_t; - -struct os_time { - os_time_t sec; - os_time_t usec; -}; - -static int os_get_random(unsigned char *buf, size_t len) -{ - FILE *f; - size_t rc; - - f = fopen("/dev/urandom", "rb"); - if (f == NULL) { - printf("Could not open /dev/urandom.\n"); - return -1; - } - - rc = fread(buf, 1, len, f); - fclose(f); - - return rc != len ? -1 : 0; -} - -static int os_get_time(struct os_time *t) -{ - int res; - struct timeval tv; - res = gettimeofday(&tv, NULL); - t->sec = tv.tv_sec; - t->usec = tv.tv_usec; - return res; -} - -static unsigned long os_random(void) -{ - return random(); -} - -/** - * wps_pin_checksum - Compute PIN checksum - * @pin: Seven digit PIN (i.e., eight digit PIN without the checksum digit) - * Returns: Checksum digit - */ -unsigned int wps_pin_checksum(unsigned int pin) -{ - unsigned int accum = 0; - while (pin) { - accum += 3 * (pin % 10); - pin /= 10; - accum += pin % 10; - pin /= 10; - } - - return (10 - accum % 10) % 10; -} - -/** - * wps_generate_pin - Generate a random PIN - * Returns: Eight digit PIN (i.e., including the checksum digit) - */ -unsigned int wps_generate_pin(void) -{ - unsigned int val; - - /* Generate seven random digits for the PIN */ - if (os_get_random((unsigned char *) &val, sizeof(val)) < 0) { - struct os_time now; - os_get_time(&now); - val = os_random() ^ now.sec ^ now.usec; - } - val %= 10000000; - - /* Append checksum digit */ - return val * 10 + wps_pin_checksum(val); -} - -static void str2hex(A_UINT8 *hex, char *str); -// -//////////////////////////////////////////////////////////////////////////////// -// Library APIs -int wac_enable(int s, int enable, unsigned int period, unsigned int scan_thres, int rssi_thres) -{ - char ifname[IFNAMSIZ]; - struct ifreq ifr; - char *ethIf; - char *cmd_buf = malloc(256); - WMI_WAC_ENABLE_CMD *cmd = (WMI_WAC_ENABLE_CMD *)(cmd_buf+4); - unsigned int pin = wps_generate_pin(); - - memset(cmd_buf, 0, sizeof(cmd_buf)); - memset(ifname, '\0', IFNAMSIZ); - cmd->enable = enable; - cmd->period = period; - cmd->threshold = scan_thres; - cmd->rssi = rssi_thres; - snprintf(wps_pin, 9, "%d", pin); - memcpy(cmd->wps_pin, wps_pin, 8); - - if ((ethIf = getenv("NETIF")) == NULL) { - ethIf = "eth1"; - } - strcpy(ifname, ethIf); - strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); - - ((int *)cmd_buf)[0] = AR6000_XIOCTL_WMI_ENABLE_WAC_PARAM; - ifr.ifr_data = cmd_buf; - if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) - { - err(1, "%s", ifr.ifr_name); - free(cmd_buf); - return -1; - } - printf("cmd = Wac Enable: %x, %x %x, %x\n", enable, period, scan_thres, rssi_thres); - printf("random PIN = %s\n", wps_pin); - free(cmd_buf); - - return 0; -} - -void wac_control_request( int s, - WAC_REQUEST_TYPE req, - WAC_COMMAND cmd, - WAC_FRAME_TYPE frm, - char *ie, - int *ret_val, - WAC_STATUS *status ) -{ - char ifname[IFNAMSIZ]; - struct ifreq ifr; - char *ethIf; - char *cmd_buf = malloc(256); - WMI_WAC_CTRL_REQ_CMD *ctrl_cmd = (WMI_WAC_CTRL_REQ_CMD *)(cmd_buf+4); - - memset(cmd_buf, 0, 256); - memset(ifname, '\0', IFNAMSIZ); - - if ((ethIf = getenv("NETIF")) == NULL) { - ethIf = "eth1"; - } - strcpy(ifname, ethIf); - strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); - - *ret_val = 0; - - if ( WAC_SET == req ) { - if ( PRBREQ == frm ) { - switch (cmd) { - case WAC_ADD: - { - if (0 != strncmp(ie, "0x", 2)) { - printf("expect \'ie\' in hex format with 0x\n"); - *ret_val = -1; - goto done_ctrl_req; - } - - if (0 != (strlen(ie) % 2)) { - printf("expect \'ie\' to be even length\n"); - *ret_val = -1; - goto done_ctrl_req; - } - - ctrl_cmd->req = WAC_SET; - ctrl_cmd->cmd = WAC_ADD; - ctrl_cmd->frame = PRBREQ; - str2hex(ctrl_cmd->ie, ie); - - ((int *)cmd_buf)[0] = AR6000_XIOCTL_WMI_WAC_CTRL_REQ; - ifr.ifr_data = cmd_buf; - if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) - { - err(1, "%s", ifr.ifr_name); - *ret_val = -1; - } - break; - } - - case WAC_DEL: - { - ctrl_cmd->req = WAC_SET; - ctrl_cmd->cmd = WAC_DEL; - ctrl_cmd->frame = PRBREQ; - - ((int *)cmd_buf)[0] = AR6000_XIOCTL_WMI_WAC_CTRL_REQ; - ifr.ifr_data = cmd_buf; - if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) - { - err(1, "%s", ifr.ifr_name); - *ret_val = -1; - } - break; - } - - default: - printf("unknown command %d\n", cmd); - *ret_val = -1; - break; - } - } - else { - printf("unknown set frame type %d\n", frm); - *ret_val = -1; - } - } - else if ( WAC_GET == req ) { - if ( WAC_GET_STATUS == cmd ) { // GET STATUS - ctrl_cmd->req = WAC_GET; - ctrl_cmd->cmd = WAC_GET_STATUS; - - ((int *)cmd_buf)[0] = AR6000_XIOCTL_WMI_WAC_CTRL_REQ; - ifr.ifr_data = cmd_buf; - if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) - { - err(1, "%s", ifr.ifr_name); - *ret_val = -1; - goto done_ctrl_req; - } - A_MEMCPY(status, ifr.ifr_data, sizeof(WAC_STATUS)); - } - else if ( PRBREQ == frm ) { // GET IE - ctrl_cmd->req = WAC_GET; - ctrl_cmd->cmd = WAC_GET_IE; - - ((int *)cmd_buf)[0] = AR6000_XIOCTL_WMI_WAC_CTRL_REQ; - ifr.ifr_data = cmd_buf; - if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) - { - err(1, "%s", ifr.ifr_name); - *ret_val = -1; - goto done_ctrl_req; - } - A_MEMCPY(ie, ifr.ifr_data, sizeof(WMI_GET_WAC_INFO)); - } - else { - printf("unknown get request\n"); - *ret_val = -1; - } - } - else - { - printf("unkown request type %d\n", req); - *ret_val = -1; - } - -done_ctrl_req: - free(cmd_buf); -} - -//////////////////////////////////////////////////////////////////////////////// - -static int htoi(char c) -{ - if (c >= 'a' && c <= 'f') { - return (c - 'a' + 10); - } - - if (c >= 'A' && c <= 'F') { - return (c - 'A' + 10); - } - - if (c >= '0' && c <= '9') { - return (c - '0'); - } - - return 0; -} - -static void str2hex(A_UINT8 *hex, char *str) -{ - int i; - int len = strlen(str); - - for (i = 2; i < len; i+=2) { - hex[(i-2)/2] = htoi(str[i]) * 16 + htoi(str[i+1]); - } -} - -static void getBssid(char *bssid) -{ - WMI_BSS_INFO_HDR2 *p = &myBssInfo[0]; - char tmp[3]; - - if (fakeId == (MAX_WAC_BSS+1)) { - strcpy(bssid, "1c:af:f7:1b:81:82"); - return; - } - - sprintf(tmp, "%02x", p->bssid[0]); - strcpy(bssid, tmp); - strcat(bssid, ":"); - sprintf(tmp, "%02x", p->bssid[1]); - strcat(bssid, tmp); - strcat(bssid, ":"); - sprintf(tmp, "%02x", p->bssid[2]); - strcat(bssid, tmp); - strcat(bssid, ":"); - sprintf(tmp, "%02x", p->bssid[3]); - strcat(bssid, tmp); - strcat(bssid, ":"); - sprintf(tmp, "%02x", p->bssid[4]); - strcat(bssid, tmp); - strcat(bssid, ":"); - sprintf(tmp, "%02x", p->bssid[5]); - strcat(bssid, tmp); - - printf("bssid = %s\n", bssid); -} - -static int check_stored_profile(A_UINT8 *bssid) -{ - FILE *fp; - char buffer[128]; - char full_cmd[256]; -// char *cmd = "../../.output/LOCAL_i686-SDIO/image/wpa_cli list_networks | grep -o \'\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w\'"; - - memset(full_cmd, '\0', 256); - strcpy(full_cmd, exec_path); - strcat(full_cmd, "../../.output/LOCAL_i686-SDIO/image/wpa_cli list_networks | grep -o \'\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w\'"); - - memset(buffer, '\0', 128); - fp = popen(full_cmd, "r"); - fgets(buffer, 128, fp); - pclose(fp); - - if (buffer[0] == '\0') { - printf("no stored profile\n"); - return 1; - } - - printf("profile bssid = %s\n", buffer); - - bssid[0] = htoi(buffer[0]) * 16 + htoi(buffer[1]); - bssid[1] = htoi(buffer[3]) * 16 + htoi(buffer[4]); - bssid[2] = htoi(buffer[6]) * 16 + htoi(buffer[7]); - bssid[3] = htoi(buffer[9]) * 16 + htoi(buffer[10]); - bssid[4] = htoi(buffer[12]) * 16 + htoi(buffer[13]); - bssid[5] = htoi(buffer[15]) * 16 + htoi(buffer[16]); - - printf("bssid in decimal: %d:%d:%d:%d:%d:%d\n", - bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]); - - return 0; -} - -static int match_stored_profile(A_UINT8 *myBssid) -{ - int i; - - for (i = 0; i < MAX_WAC_BSS; i++) { - if (0 == A_MEMCMP(myBssInfo[i].bssid, myBssid, 6)) { - break; - } - } - - if (i < MAX_WAC_BSS) { - printf("matched profile: %d\n", i); - return i; - } - else { - printf("no matched profile: %d\n", i); - return -1; - } -} - -static int select_best_bss() -{ - return 0; -} - -static void wpa_profile_reconnect(void) -{ - char full_cmd[128]; - - memset(full_cmd, '\0', 128); - strcpy(full_cmd, exec_path); - system(strcat(full_cmd, "../../.output/LOCAL_i686-SDIO/image/wpa_cli ap_scan 1")); - - memset(full_cmd, '\0', 128); - strcpy(full_cmd, exec_path); - system(strcat(full_cmd, "../../.output/LOCAL_i686-SDIO/image/wpa_cli save_config")); - - memset(full_cmd, '\0', 128); - strcpy(full_cmd, exec_path); - system(strcat(full_cmd, "../../.output/LOCAL_i686-SDIO/image/wpa_cli reconfigure")); - - // wpa_cli ap_scan 1 - // wpa_cli save_config - // wpa_cli reconfigure - // wpa_cli ap_scan 0 - // wpa_cli save_config -} - -static int wps_start(void) -{ - char full_cmd[128]; - char which_bssid[32]; - int ret = 0; - - memset(full_cmd, '\0', 128); - strcpy(full_cmd, exec_path); - system(strcat(full_cmd, "../../.output/LOCAL_i686-SDIO/image/wpa_cli ap_scan 1")); - - memset(full_cmd, '\0', 128); - strcpy(full_cmd, exec_path); - system(strcat(full_cmd, "../../.output/LOCAL_i686-SDIO/image/wpa_cli save_config")); - - memset(full_cmd, '\0', 128); - strcpy(full_cmd, exec_path); - system(strcat(full_cmd, "../../.output/LOCAL_i686-SDIO/image/wpa_cli reconfigure")); - - memset(which_bssid, '\0', 32); - getBssid(which_bssid); - - memset(full_cmd, '\0', 128); - strcpy(full_cmd, exec_path); - strcat(full_cmd, "../../.output/LOCAL_i686-SDIO/image/wpa_cli wps_pin "); - strcat(full_cmd, which_bssid); - strcat(full_cmd, " "); - strcat(full_cmd, wps_pin); - - wps_pending = 1; - printf("wps_start: %s\n", full_cmd); - - ret = system(full_cmd); - - return ret; -} - - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) -int app_extract_events(struct event_list* list, - struct iw_event * iwe); -#endif -static void -event_rtm_newlink(struct nlmsghdr *h, int len); - -static void -event_wireless(A_INT8 *data, int len); - -int -string_search(FILE *fp, char *string) -{ - char str[DBGLOG_DBGID_DEFINITION_LEN_MAX]; - - rewind(fp); - memset(str, 0, DBGLOG_DBGID_DEFINITION_LEN_MAX); - while (!feof(fp)) { - fscanf(fp, "%s", str); - if (strstr(str, string)) return 1; - } - - return 0; -} - -#define RECEVENT_DEBUG_PRINTF(args...) - -int s; //socket -int main(int argc, char** argv) -{ -// int s, c, ret; -// int s; - struct sockaddr_nl local; - struct sockaddr_nl from; - socklen_t fromlen; - struct nlmsghdr *h; - char buf[16384]; - int left; - FILE *fp; - char *cmd = "pwd"; - int len; - - //DBG - if (argc == 2) { - fakeId = atoi(argv[1]); - } - - // determine execution path - memset(exec_path, '\0', 128); - fp = popen(cmd, "r"); - fgets(exec_path, 128, fp); - pclose(fp); - - len = strlen(exec_path); - if ( '\n' == exec_path[len-1] ) { - exec_path[len-1] = '/'; - } - else { - exec_path[len] = '/'; - } - - printf("exec_path = %s\n", exec_path); - - s = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE); - if (s < 0) { - perror("socket(PF_NETLINK,SOCK_RAW,NETLINK_ROUTE)"); - return -1; - } - - memset(&local, 0, sizeof(local)); - local.nl_family = AF_NETLINK; - local.nl_groups = RTMGRP_LINK; - if (bind(s, (struct sockaddr *) &local, sizeof(local)) < 0) { - perror("bind(netlink)"); - close(s); - return -1; - } - - while (1) { - fromlen = sizeof(from); - left = recvfrom(s, buf, sizeof(buf), 0, - (struct sockaddr *) &from, &fromlen); - if (left < 0) { - if (errno != EINTR && errno != EAGAIN) - perror("recvfrom(netlink)"); - break; - } - - h = (struct nlmsghdr *) buf; - - while (left >= sizeof(*h)) { - int len, plen; - - len = h->nlmsg_len; - plen = len - sizeof(*h); - if (len > left || plen < 0) { - perror("Malformed netlink message: "); - break; - } - - switch (h->nlmsg_type) { - case RTM_NEWLINK: - event_rtm_newlink(h, plen); - break; - case RTM_DELLINK: - RECEVENT_DEBUG_PRINTF("DELLINK\n"); - break; - default: - RECEVENT_DEBUG_PRINTF("OTHERS\n"); - } - - len = NLMSG_ALIGN(len); - left -= len; - h = (struct nlmsghdr *) ((char *) h + len); - } - } - - close(s); - return 0; -} - -static void -event_rtm_newlink(struct nlmsghdr *h, int len) -{ - struct ifinfomsg *ifi; - int attrlen, nlmsg_len, rta_len; - struct rtattr * attr; - - if (len < sizeof(*ifi)) { - perror("too short\n"); - return; - } - - ifi = NLMSG_DATA(h); - - nlmsg_len = NLMSG_ALIGN(sizeof(struct ifinfomsg)); - - attrlen = h->nlmsg_len - nlmsg_len; - if (attrlen < 0) { - perror("bad attren\n"); - return; - } - - attr = (struct rtattr *) (((char *) ifi) + nlmsg_len); - - rta_len = RTA_ALIGN(sizeof(struct rtattr)); - while (RTA_OK(attr, attrlen)) { - if (attr->rta_type == IFLA_WIRELESS) { - event_wireless( ((A_INT8*)attr) + rta_len, attr->rta_len - rta_len); - } else if (attr->rta_type == IFLA_IFNAME) { - - } - attr = RTA_NEXT(attr, attrlen); - } -} - -#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) -/*------------------------------------------------------------------*/ -/* - * Extract the next event from the event list. - */ -int -app_extract_events(struct event_list* list, /* list of events */ - struct iw_event * iwe /* Extracted event */ - ) -{ - const struct ath_ioctl_description * descr = NULL; - int event_type = 0; - unsigned int event_len = 1; /* Invalid */ - A_INT8 * pointer; - A_INT16 we_version = ATH_WE_VERSION; - unsigned cmd_index; - - /* Check for end of list */ - if((list->current + IW_EV_LCP_PK_LEN) > list->end) - return(0); - - /* Extract the event header (to get the event id). - * Note : the event may be unaligned, therefore copy... */ - memcpy((char *) iwe, list->current, IW_EV_LCP_PK_LEN); - - /* Check invalid events */ - if(iwe->len <= IW_EV_LCP_PK_LEN) - return(-1); - - /* Get the type and length of that event */ - if(iwe->cmd <= SIOCIWLAST) - { - cmd_index = iwe->cmd - SIOCIWFIRST; - if(cmd_index < standard_ioctl_num) - descr = &(standard_ioctl_descr[cmd_index]); - } - else - { - cmd_index = iwe->cmd - IWEVFIRST; - if(cmd_index < standard_event_num) - descr = &(standard_event_descr[cmd_index]); - } - if(descr != NULL) - event_type = descr->header_type; - /* Unknown events -> event_type=0 => IW_EV_LCP_PK_LEN */ - event_len = event_type_size[event_type]; - /* Fixup for earlier version of WE */ - if((we_version <= 18) && (event_type == ATH_WE_HEADER_TYPE_POINT)) - event_len += IW_EV_POINT_OFF; - - /* Check if we know about this event */ - if(event_len <= IW_EV_LCP_PK_LEN) - { - /* Skip to next event */ - list->current += iwe->len; - return(2); - } - event_len -= IW_EV_LCP_PK_LEN; - - /* Set pointer on data */ - if(list->value != NULL) - pointer = list->value; /* Next value in event */ - else - pointer = list->current + IW_EV_LCP_PK_LEN; /* First value in event */ - - /* Copy the rest of the event (at least, fixed part) */ - if((pointer + event_len) > list->end) - { - /* Go to next event */ - list->current += iwe->len; - return(-2); - } - /* Fixup for WE-19 and later : pointer no longer in the list */ - /* Beware of alignement. Dest has local alignement, not packed */ - if((we_version > 18) && (event_type == ATH_WE_HEADER_TYPE_POINT)) - memcpy((char *) iwe + IW_EV_LCP_LEN + IW_EV_POINT_OFF, - pointer, event_len); - else - memcpy((char *) iwe + IW_EV_LCP_LEN, pointer, event_len); - - /* Skip event in the stream */ - pointer += event_len; - - /* Special processing for iw_point events */ - if(event_type == ATH_WE_HEADER_TYPE_POINT) - { - /* Check the length of the payload */ - unsigned int extra_len = iwe->len - (event_len + IW_EV_LCP_PK_LEN); - if(extra_len > 0) - { - /* Set pointer on variable part (warning : non aligned) */ - iwe->u.data.pointer = pointer; - - /* Check that we have a descriptor for the command */ - if(descr == NULL) - /* Can't check payload -> unsafe... */ - iwe->u.data.pointer = NULL; /* Discard paylod */ - else - { - /* Those checks are actually pretty hard to trigger, - * because of the checks done in the kernel... */ - - unsigned int token_len = iwe->u.data.length * descr->token_size; - - /* Ugly fixup for alignement issues. - * If the kernel is 64 bits and userspace 32 bits, - * we have an extra 4+4 bytes. - * Fixing that in the kernel would break 64 bits userspace. */ - if((token_len != extra_len) && (extra_len >= 4)) - { - A_UINT16 alt_dlen = *((A_UINT16 *) pointer); - unsigned int alt_token_len = alt_dlen * descr->token_size; - if((alt_token_len + 8) == extra_len) - { - /* Ok, let's redo everything */ - pointer -= event_len; - pointer += 4; - /* Dest has local alignement, not packed */ - memcpy((char*) iwe + IW_EV_LCP_LEN + IW_EV_POINT_OFF, - pointer, event_len); - pointer += event_len + 4; - iwe->u.data.pointer = pointer; - token_len = alt_token_len; - } - } - - /* Discard bogus events which advertise more tokens than - * what they carry... */ - if(token_len > extra_len) - iwe->u.data.pointer = NULL; /* Discard paylod */ - /* Check that the advertised token size is not going to - * produce buffer overflow to our caller... */ - if((iwe->u.data.length > descr->max_tokens) - && !(descr->flags & ATH_WE_DESCR_FLAG_NOMAX)) - iwe->u.data.pointer = NULL; /* Discard paylod */ - /* Same for underflows... */ - if(iwe->u.data.length < descr->min_tokens) - iwe->u.data.pointer = NULL; /* Discard paylod */ - } - } - else - /* No data */ - iwe->u.data.pointer = NULL; - - /* Go to next event */ - list->current += iwe->len; - } - else - { - /* Ugly fixup for alignement issues. - * If the kernel is 64 bits and userspace 32 bits, - * we have an extra 4 bytes. - * Fixing that in the kernel would break 64 bits userspace. */ - if((list->value == NULL) - && ((((iwe->len - IW_EV_LCP_PK_LEN) % event_len) == 4) - || ((iwe->len == 12) && ((event_type == ATH_WE_HEADER_TYPE_UINT) || - (event_type == ATH_WE_HEADER_TYPE_QUAL))) )) - { - pointer -= event_len; - pointer += 4; - /* Beware of alignement. Dest has local alignement, not packed */ - memcpy((char *) iwe + IW_EV_LCP_LEN, pointer, event_len); - pointer += event_len; - } - - /* Is there more value in the event ? */ - if((pointer + event_len) <= (list->current + iwe->len)) - /* Go to next value */ - list->value = pointer; - else - { - /* Go to next event */ - list->value = NULL; - list->current += iwe->len; - } - } - return(1); -} -#endif /*#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) */ - -static void -event_wireless(A_INT8 *data, int len) -{ - A_INT8 *pos, *end, *custom, *buf; - A_UINT16 eventid; -// int status; -// static int wps = 0; -// A_STATUS status; - - pos = data; - end = data + len; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) - struct iw_event iwe; - struct event_list list; - int ret; - - /* Cleanup */ - memset((char *) &list, '\0', sizeof(struct event_list)); - - /* Set things up */ - list.current = data; - list.end = data + len; - - do - { - /* Extract an event and print it */ - ret = app_extract_events(&list, &iwe); - if(ret != 0) - { - RECEVENT_DEBUG_PRINTF("\n cmd = %x, length = %d, ",iwe.cmd,iwe.u.data.length); - - switch (iwe.cmd) { - case IWEVCUSTOM: - custom = pos + IW_EV_POINT_LEN; - if (custom + iwe.u.data.length > end) - return; - buf = malloc(iwe.u.data.length + 1); - if (buf == NULL) return; - memcpy(buf, custom, iwe.u.data.length); - eventid = *((A_UINT16*)buf); - RECEVENT_DEBUG_PRINTF("\n eventid = %x",eventid); - - switch (eventid) { - case (WMI_READY_EVENTID): - printf("event = Wmi Ready, len = %d\n", iwe.u.data.length); -// status = app_wmiready_event_rx((A_UINT8 *)(buf + ID_LEN), iwe.u.data.length - ID_LEN); - break; - case (WMI_DISCONNECT_EVENTID): - printf("event = Wmi Disconnect, len = %d\n", iwe.u.data.length); - if (wps_pending) { - char full_cmd[128]; - - memset(full_cmd, '\0', 128); - strcpy(full_cmd, exec_path); - system(strcat(full_cmd, "../../.output/LOCAL_i686-SDIO/image/wpa_cli ap_scan 1")); - - memset(full_cmd, '\0', 128); - strcpy(full_cmd, exec_path); - system(strcat(full_cmd, "../../.output/LOCAL_i686-SDIO/image/wpa_cli save_config")); - - wps_pending = 0; - } -// status = app_disconnect_event_rx((A_UINT8 *)(buf + ID_LEN), iwe.u.data.length - ID_LEN); - break; - case (WMI_SCAN_COMPLETE_EVENTID): - printf("event = Wmi Scan Complete, len = %d\n", iwe.u.data.length); -// status = app_scan_complete_event_rx((A_UINT8 *)(buf + ID_LEN), iwe.u.data.length - ID_LEN); - break; - case (WMI_WAC_SCAN_DONE_EVENTID): - { - char ifname[IFNAMSIZ]; - struct ifreq ifr; - char *ethIf; - char *buf = malloc(256); - WMI_WAC_SCAN_REPLY_CMD *cmd = (WMI_WAC_SCAN_REPLY_CMD *)(buf+4); - int matched = 0, has_profile = 0; - - memset(buf, 0, sizeof(buf)); - memset(ifname, '\0', IFNAMSIZ); - - if ((ethIf = getenv("NETIF")) == NULL) { - ethIf = "eth1"; - } - strcpy(ifname, ethIf); - strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); - - printf("event = WAC scan done, len = %d\n", iwe.u.data.length); - - if (myBssCnt == 0) { - cmd->cmdid = -1; //no BSS, continue WAC scan - } - else { - A_UINT8 myBssid[6]; - // TODO: choose best BSS to connect - // OR match stored profile - if (check_stored_profile(myBssid)) { - // no stored profile, select best BSS to connect - has_profile = 0; - } - else { - has_profile = 1; - // has stored profile, match BSS with stored profile - if ( match_stored_profile(myBssid) >= 0 ) { - matched = 1; - } - } - - if (!matched || !has_profile) { - cmd->cmdid = select_best_bss(); - } - else { - // either has profile or found matched profile - // stop WAC scan - cmd->cmdid = -2; - } - } - - //DBG - if (fakeId != 0) { - cmd->cmdid = fakeId; //fake BSS info - } - printf("Sending WAC scan reply %d\n", cmd->cmdid); - - ((int *)buf)[0] = AR6000_XIOCTL_WAC_SCAN_REPLY; - ifr.ifr_data = buf; - if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) - { - err(1, "%s", ifr.ifr_name); - } - - if ( -2 == cmd->cmdid ) { - // stop WAC scan -> reconnect - wpa_profile_reconnect(); - } - - break; - } - case WMI_WAC_REPORT_BSS_EVENTID: - { - A_INT8 *rxB = buf+2; - WMI_BSS_INFO_HDR2 *p; - if (myBssCnt >= MAX_WAC_BSS) { - printf("Too many bss reported, quitting\n"); - break; - } - -// printf("event = WAC report bss, len = %d\n", iwe.u.data.length); - - p = &myBssInfo[myBssCnt++]; - memcpy((A_UINT8 *)p, rxB, sizeof(WMI_BSS_INFO_HDR2)); - - p = (WMI_BSS_INFO_HDR2 *) rxB; - printf("event = WAC report bss: %x:%x:%x:%x:%x:%x\n", - p->bssid[0], - p->bssid[1], - p->bssid[2], - p->bssid[3], - p->bssid[4], - p->bssid[5]); - break; - } - case WMI_WAC_START_WPS_EVENTID: -// printf("wps start\n"); - if (wps_start()) { - printf("wps start failed\n"); - } - break; - - default: - RECEVENT_DEBUG_PRINTF("Host received other event with id 0x%x\n", - eventid); - break; - } - free(buf); - break; - case IWEVGENIE: - custom = pos + IW_EV_POINT_LEN; - if (custom + iwe.u.data.length > end) - return; - buf = malloc(iwe.u.data.length + 1); - if (buf == NULL) return; - memcpy(buf, custom, iwe.u.data.length); - eventid = *((A_UINT16*)buf); - - switch (eventid) { - case (WMI_CONNECT_EVENTID): - { - char ifname[IFNAMSIZ]; - struct ifreq ifr; - char *ethIf; - char *buf = malloc(256); - WMI_WAC_ENABLE_CMD *cmd = (WMI_WAC_ENABLE_CMD *)(buf+4); - - memset(buf, 0, sizeof(buf)); - memset(ifname, '\0', IFNAMSIZ); - - if ((ethIf = getenv("NETIF")) == NULL) { - ethIf = "eth1"; - } - strcpy(ifname, ethIf); - strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); - - ((int *)buf)[0] = AR6000_XIOCTL_WMI_ENABLE_WAC_PARAM; - cmd->enable = 0; - ifr.ifr_data = buf; - if (ioctl(s, AR6000_IOCTL_EXTENDED, &ifr) < 0) - { - err(1, "%s", ifr.ifr_name); - } - printf("event = Wmi Connect, len = %d\n", iwe.u.data.length); - printf("disabling WAC\n"); - if (!wps_pending) { - char full_cmd[128]; - - memset(full_cmd, '\0', 128); - strcpy(full_cmd, exec_path); - system(strcat(full_cmd, "../../.output/LOCAL_i686-SDIO/image/wpa_cli ap_scan 0")); - - memset(full_cmd, '\0', 128); - strcpy(full_cmd, exec_path); - system(strcat(full_cmd, "../../.output/LOCAL_i686-SDIO/image/wpa_cli save_config")); - } - -// status = app_connect_event_rx((A_UINT8 *)(buf + ID_LEN), iwe.u.data.length - ID_LEN); - break; - } - case WMI_ENABLE_WAC_CMDID: - { - WMI_WAC_ENABLE_CMD *cmd = (WMI_WAC_ENABLE_CMD *)(buf+2); - - wac_enable(s, cmd->enable, cmd->period, cmd->threshold, cmd->rssi); - break; - } - default: - break; - } - free(buf); - break; - - default: - RECEVENT_DEBUG_PRINTF("event = Others\n"); - break; - } - } - } - while(ret > 0); - -#endif -} - diff --git a/drivers/net/wireless/ar6003/host/lib/wac/wac_lib_api.h b/drivers/net/wireless/ar6003/host/lib/wac/wac_lib_api.h deleted file mode 100644 index 72b1a22adb04..000000000000 --- a/drivers/net/wireless/ar6003/host/lib/wac/wac_lib_api.h +++ /dev/null @@ -1,92 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef __WAC_LIB_API_H__ -#define __WAC_LIB_API_H__ - -#include "wac_defs.h" - -/* - * Function to enable or disable the WAC feature. This is the entry point to WAC when the - * user pushed a button on the remote - * Input arguments: - * s - open file descriptor of socket - * enable - flag to enable/disable WAC. 1 = enable; 0 = disable - * for disablethe remaining arguments are don't cares - * period - time in milliseconds between consecutive scans when WAC is enabled - * scan_thres - number of scan retries before the STA gave up on looking for WAC AP - * rssi_thres - RSSI threshold the STA will check in beacon or probe response frames - * to qualify a WAC AP. This is absolute value of the signal strength in dBm - * Return value: - * 0 = success; -1 = failure - * - * Examples: - * To enable WAC: wac_enable(s, 1, 2000, 3, 25) - * - WAC enabled with 2-second interval between scans for up to 3 tries. RSSI threshold is -25dBm - * To disable WAC: wac_enable(s, 0, 0, 0, 0) - * - When the flag is disable, the rest of arguments are don't cares - */ -int wac_enable(int s, int enable, unsigned int period, unsigned int scan_thres, int rssi_thres); - -/* - * Function for I/O Control Request for Samsung IE as specified version 1.2 protocol - * Input arguments: - * s - open file descriptor for socket - * req - request type takes the possible values: - * WAC_SET - * WAC_GET - * cmd - command takes the possible values: - * WAC_ADD - * WAC_DEL - * WAC_GET_STATUS - * frm - frame type takes the possible values: - * PRBREQ (for STA) - * PRBRSP (for AP) - * BEACON (for AP) - * ie - pointer to char string that contains the IE to set or get - * ret_val - indicates whether the control request is successful - * 0 = success; -1 = failure - * status - status code returned by STA that takes possible values: - * WAC_FAILED_NO_WAC_AP - * WAC_FAILED_LOW_RSSI - * WAC_FAILED_INVALID_PARAM - * WAC_FAILED_REJECTED - * WAC_SUCCESS - * WAC_PROCEED_FIRST_PHASE - * WAC_PROCEED_SECOND_PHASE - * WAC_DISABLED - * Examples: - * To insert an IE into the probe request frame: - * wac_control_request(WAC_SET, WAC_ADD, PRBREQ, - * "0x0012fb0100010101083132333435363730" val, status) - * To query the WAC status from STA: - * wac_control_request(WAC_GET, WAC_GET_STATUS, NULL, NULL, val, status) - */ -void wac_control_request( int s, - WAC_REQUEST_TYPE req, - WAC_COMMAND cmd, - WAC_FRAME_TYPE frm, - char *ie, - int *ret_val, - WAC_STATUS *status ); - -#endif diff --git a/drivers/net/wireless/ar6003/host/localmake.linux.inc b/drivers/net/wireless/ar6003/host/localmake.linux.inc deleted file mode 100644 index 9b48f3fc1010..000000000000 --- a/drivers/net/wireless/ar6003/host/localmake.linux.inc +++ /dev/null @@ -1,40 +0,0 @@ -# -# Local Makefile includes for tool and kernel source paths -# -# Copyright 2004-2010 Atheros Communications, Inc. -# -# When creating a new build type, use the following template: -# ifeq ($(ATH_BUILD_TYPE),) -# ATH_ARCH_CPU_TYPE := < cpu architecture > -# ATH_CROSS_COMPILE_TYPE := < cross compiler path > -# ATH_LINUXPATH := < kernel source path > - -ATH_BUILD_TYPE := LOCAL_ARM_RK29 -ATH_BUS_TYPE := SDIO -ATH_LINUXPATH := /home/ko/work/customer/yifang/trunk_exp -ATH_CROSS_COMPILE_TYPE := /home/ko/work/customer/yifang/kernel_rk29_v0.1/toolchain/arm-eabi-4.4.0/bin/arm-eabi- -ATH_ARCH_CPU_TYPE := arm - - - $(info *************************) - $(info PLATFORM: $(ATH_BUILD_TYPE)) - $(info BSP: $(ATH_BSP_TYPE)) - $(info *************************) - # Some environment settings - ATH_BUILD_TYPE=$(ATH_BSP_TYPE)_ARM_NATIVEMMC - ATH_ANDROID_ENV := yes - ATH_SOFTMAC_FILE_USED := no - ATH_DEBUG_DRIVER := yes - ATH_HTC_RAW_INT_ENV :=yes - ATH_AR6K_OTA_TEST_MODE := no - - # Some common variable - ATH_BUS_TYPE := SDIO - ATH_OS_SUB_TYPE := linux_2_6 - ATH_BUS_SUBTYPE := linux_sdio - ATH_BUILD_3RDPARTY := no - ATH_CFG80211_ENV := no - ATH_BUILD_SYSTEM_TOOLS := no - ATH_AR6K_HCI_PAL := no - ATH_AR6K_DEBUG_ALLOC := no - ATH_BUILD_P2P :=no diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000/PS_ASIC.pst b/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000/PS_ASIC.pst deleted file mode 100644 index c9c7539bd273..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000/PS_ASIC.pst +++ /dev/null @@ -1,59 +0,0 @@ -// based on 1, change DVDD=0.85V, LPO measure time to 8ms, 1300ms reCal interval -// Radio table TAG -# -[H:S]012C -[H:S]0042 -[H:A]B1 B1 12 00 02 00 01 30 06 00 02 00 00 20 02 00 - 04 00 0C 40 01 00 48 00 00 48 54 9A 02 00 00 08 - 02 00 48 00 89 EE 70 E6 38 00 D8 70 EF 52 02 00 - 00 40 00 00 08 00 31 00 00 00 04 00 10 00 00 00 - B2 B2 -// System config TAG -# -[H:S]0013 -[H:S]009C -[H:A]C1 C1 17 02 02 00 01 30 48 00 0E CC 33 06 01 08 - 64 96 14 05 FF FF 05 80 00 00 FF CC 00 CC 01 00 - 20 80 FF CC 02 CC 04 00 DF EC 43 F8 00 21 00 E0 - FF CC 03 CC 06 00 80 F0 08 28 80 F4 0C 20 80 F8 - 0E 18 80 FC 14 10 80 00 18 08 80 04 16 00 FF CC - 04 CC 01 00 1A 12 40 96 01 C0 28 00 00 00 C0 01 - 40 06 00 01 00 00 C8 00 00 F0 00 00 FF CC 0C CC - 08 00 01 03 00 7E 08 08 00 7E 01 01 00 7E 01 03 - 00 7E 03 03 00 7E 61 63 00 7E 63 65 00 7E 6A 6C - 00 7E FF CC 09 CC 00 C9 FF CC C2 C2 -//Extern 32k + 24Mhz CPU -//# -//[H:S]0021 -//[H:S]0004 -//[H:A]09 00 00 00 -//Bdaddr -//# -//[H:S]0001 -//[H:S]0006 -//[H:A]89 60 41 7f 03 00 -//Audio -# -[H:S]0002 -[H:S]0004 -[H:A]23 08 01 33 -//Audio -# -[H:S]0003 -[H:S]0004 -[H:A]dd e5 2e 00 -//Audio -# -[H:S]0015 -[H:S]0004 -[H:A]12 00 00 00 -//Audio -# -[H:S]0016 -[H:S]0004 -[H:A]00 00 a7 02 -# -//PLC -[H:S]001F -[H:S]0008 -[H:A]01 1A 06 14 50 B4 32 96 diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000/RamPatch.txt b/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000/RamPatch.txt deleted file mode 100644 index badcc110d8e2..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000/RamPatch.txt +++ /dev/null @@ -1,2 +0,0 @@ -0569 -000000000e20000050800000000158000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d0915300d4915300d8915300dc91530098b0530064ce5300f8d2530008e7530008d253000cd2530098d95300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff051001010101ffffff50500101010180019800c8019800f4029800d0039800380498001404980024059800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000366100ad0581c206bd01e00800bd0a17641c0c0abd05815d080c0ce00800bd02dd03ed05815c080c0ce00800c60400ad05c1f802922b11819903c09920926b11e008000c021df0003681001c0e516d030c0720d074d241107911d0cd90b805a0cc11cabbb90160e6030c2a609034972a026062003801e2c1102203068d07cc8260e613102000fd061df072631122011072434fc805204290a044114acc882c0c1980a00407e805820c4b07e8079c7aa20c4b07ea12a2c3340c0b0cfc0c198191029911e008000c1972434ec805e8114acca82cd20c4ba0a00416aa0590fd20f24c4bcc4e820349f65878a1b1039805a20a034a9992990980aa01a0a831909821809901909831a7294a0c5a81bc04bd02e00800cd0aad0281be04e805c0b0744ace920c4b0c4dd09920924c4be008009c7a72434a860400ad020c4b81bf0492a0fe909d10924c4be0080060e613102000ad061df00c1a81bd04bd02e00800cd0a46ecff0c5a81bd04bd02e00800cd0a86e8ff0000368100305074bd0120407481c206ad04e00800922a11216d0390920516890ba18804b16e03c0200040349091f204a03311822992c02000b08810a08820a8028269923aaab20a49d2ca48579b08c20a4bc0c204161c08b24a4ae1d104524d01eae5f20e7fe20e803c29f7be4a1c0b424110d9111c0c1c0f1c0552c110fd05cd0580e6030c2e80d034d72e02806200bd05b20500c20500a802c0bb90a0bb11baaa924a3480e613102000420500d811403490520d01a03311ad04b20d0081c204cd05e00800a802b2a0fb3aaa920a4b0c12b09910924a4b1df00c021df0364100811e0621c0098808921207ece8ecc9e1b103b21206a21ef1b73a210c0a817c03d21ef0c1d603f16c03c80ce20f44a0bd11e0bd93d1d209e00800a252071df00000364100817f04916c03880892092880801466180acc79810d04a2a064e008001df0000000364100c02000c16c03e1940391d9032178030c0dd2628bf20902c02000f0ed83e2628cc02000d2628dc02000d2628e820c43b20c28d19d0210bb01d0bb10cc580cba0c53c600000c0a0c83c020000c1dd2628fc02000a2628ac02000b26289a209020c088cfa661a040c1ac60300662a05a2190026ca040c0a8607000c0af0ba01e1da03a2090ce0bb100c1ea0ae93e1f40230aa11e0aa10b0aa20b1fd03c02000a26bc1f209020c18f62f040c098604009209070c1a909a930c2af09911a09910d09920c02000d17f04926bc6d80de20c28d0d014661d0acc7e810d04a2a064e00800c020003262881df00036410081c305c1900920b074e19605d16e09e80ec02000d22d82b94ed92ec02000b90c30e6030c2a309034972a02306200e00800c02000fd0391250382a10082698000710030e6131020001df0 \ No newline at end of file diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/PS_ASIC.pst b/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/PS_ASIC.pst deleted file mode 100644 index dbfb680e6883..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/PS_ASIC.pst +++ /dev/null @@ -1,68 +0,0 @@ - -// Coex Configuration -# -[H:S]0017 -[H:S]0022 -[H:A]d1 d1 20 00 02 01 02 09 0c 00 24 0f 04 00 00 01 - 00 01 00 01 01 01 01 01 01 00 00 00 01 00 00 00 - d2 d2 -// Radio table TAG -# -[H:S]012C -[H:S]0042 -[H:A]B1 B1 12 00 06 00 01 30 06 00 02 00 00 20 02 00 - 04 00 0C 40 01 00 48 00 00 48 54 9A 02 00 00 08 - 02 00 48 00 89 EE 70 E6 38 00 D8 70 EF 52 02 00 - 00 40 00 00 08 00 31 00 00 00 04 00 10 00 00 00 - B2 B2 -// System config TAG -# -[H:S]0013 -[H:S]00B6 -[H:A]C1 C1 17 02 06 00 01 30 55 00 0E CC 33 06 01 08 - 64 96 14 05 FF FF 05 80 00 00 FF CC 00 CC 01 00 - 20 80 FF CC 02 CC 04 00 DF EC 43 F8 00 21 00 E0 - FF CC 03 CC 06 00 80 F0 08 28 80 F4 0C 20 80 F8 - 0E 18 80 FC 14 10 80 00 18 08 80 04 16 00 FF CC - 04 CC 01 00 1A 12 40 96 01 C0 28 00 00 00 C0 01 - 40 06 00 01 00 00 C8 00 00 F0 00 00 FF CC 0C CC - 08 00 01 03 00 7E 08 08 00 7E 01 01 00 7E 01 03 - 00 7E 03 03 00 7E 61 63 00 7E 63 65 00 7E 6A 6C - 00 7E FF CC 09 CC 00 C9 FF CC 0B CC 0A 17 07 B2 - 5E 01 52 0A 60 09 05 06 14 4B 00 00 58 02 D0 07 - 00 41 FF CC C2 C2 -//Extern 32k + 24Mhz CPU -//# -//[H:S]0021 -//[H:S]0004 -//[H:A]09 00 00 00 -//Bdaddr -//# -//[H:S]0001 -//[H:S]0006 -//[H:A]89 60 41 7f 03 00 -//Audio -# -[H:S]0002 -[H:S]0004 -[H:A]23 08 01 33 -//Audio -# -[H:S]0003 -[H:S]0004 -[H:A]dd e5 2e 00 -//Audio -# -[H:S]0015 -[H:S]0004 -[H:A]12 00 00 00 -//Audio -# -[H:S]0016 -[H:S]0004 -[H:A]00 00 a7 02 -# -//PLC -[H:S]001F -[H:S]0008 -[H:A]01 1A 06 14 50 B4 32 96 diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/PS_ASIC_aclHighPri.pst b/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/PS_ASIC_aclHighPri.pst deleted file mode 100644 index dbfb680e6883..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/PS_ASIC_aclHighPri.pst +++ /dev/null @@ -1,68 +0,0 @@ - -// Coex Configuration -# -[H:S]0017 -[H:S]0022 -[H:A]d1 d1 20 00 02 01 02 09 0c 00 24 0f 04 00 00 01 - 00 01 00 01 01 01 01 01 01 00 00 00 01 00 00 00 - d2 d2 -// Radio table TAG -# -[H:S]012C -[H:S]0042 -[H:A]B1 B1 12 00 06 00 01 30 06 00 02 00 00 20 02 00 - 04 00 0C 40 01 00 48 00 00 48 54 9A 02 00 00 08 - 02 00 48 00 89 EE 70 E6 38 00 D8 70 EF 52 02 00 - 00 40 00 00 08 00 31 00 00 00 04 00 10 00 00 00 - B2 B2 -// System config TAG -# -[H:S]0013 -[H:S]00B6 -[H:A]C1 C1 17 02 06 00 01 30 55 00 0E CC 33 06 01 08 - 64 96 14 05 FF FF 05 80 00 00 FF CC 00 CC 01 00 - 20 80 FF CC 02 CC 04 00 DF EC 43 F8 00 21 00 E0 - FF CC 03 CC 06 00 80 F0 08 28 80 F4 0C 20 80 F8 - 0E 18 80 FC 14 10 80 00 18 08 80 04 16 00 FF CC - 04 CC 01 00 1A 12 40 96 01 C0 28 00 00 00 C0 01 - 40 06 00 01 00 00 C8 00 00 F0 00 00 FF CC 0C CC - 08 00 01 03 00 7E 08 08 00 7E 01 01 00 7E 01 03 - 00 7E 03 03 00 7E 61 63 00 7E 63 65 00 7E 6A 6C - 00 7E FF CC 09 CC 00 C9 FF CC 0B CC 0A 17 07 B2 - 5E 01 52 0A 60 09 05 06 14 4B 00 00 58 02 D0 07 - 00 41 FF CC C2 C2 -//Extern 32k + 24Mhz CPU -//# -//[H:S]0021 -//[H:S]0004 -//[H:A]09 00 00 00 -//Bdaddr -//# -//[H:S]0001 -//[H:S]0006 -//[H:A]89 60 41 7f 03 00 -//Audio -# -[H:S]0002 -[H:S]0004 -[H:A]23 08 01 33 -//Audio -# -[H:S]0003 -[H:S]0004 -[H:A]dd e5 2e 00 -//Audio -# -[H:S]0015 -[H:S]0004 -[H:A]12 00 00 00 -//Audio -# -[H:S]0016 -[H:S]0004 -[H:A]00 00 a7 02 -# -//PLC -[H:S]001F -[H:S]0008 -[H:A]01 1A 06 14 50 B4 32 96 diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/PS_ASIC_aclLowPri.pst b/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/PS_ASIC_aclLowPri.pst deleted file mode 100644 index b2b9e3bc4b5b..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/PS_ASIC_aclLowPri.pst +++ /dev/null @@ -1,68 +0,0 @@ - -// Coex Configuration -# -[H:S]0017 -[H:S]0022 -[H:A]d1 d1 20 00 02 01 02 09 0c 00 24 0f 04 00 00 01 - 00 01 00 00 01 01 01 01 01 00 00 00 01 00 00 00 - d2 d2 -// Radio table TAG -# -[H:S]012C -[H:S]0042 -[H:A]B1 B1 12 00 06 00 01 30 06 00 02 00 00 20 02 00 - 04 00 0C 40 01 00 48 00 00 48 54 9A 02 00 00 08 - 02 00 48 00 89 EE 70 E6 38 00 D8 70 EF 52 02 00 - 00 40 00 00 08 00 31 00 00 00 04 00 10 00 00 00 - B2 B2 -// System config TAG -# -[H:S]0013 -[H:S]00B6 -[H:A]C1 C1 17 02 06 00 01 30 55 00 0E CC 33 06 01 08 - 64 96 14 05 FF FF 05 80 00 00 FF CC 00 CC 01 00 - 20 80 FF CC 02 CC 04 00 DF EC 43 F8 00 21 00 E0 - FF CC 03 CC 06 00 80 F0 08 28 80 F4 0C 20 80 F8 - 0E 18 80 FC 14 10 80 00 18 08 80 04 16 00 FF CC - 04 CC 01 00 1A 12 40 96 01 C0 28 00 00 00 C0 01 - 40 06 00 01 00 00 C8 00 00 F0 00 00 FF CC 0C CC - 08 00 01 03 00 7E 08 08 00 7E 01 01 00 7E 01 03 - 00 7E 03 03 00 7E 61 63 00 7E 63 65 00 7E 6A 6C - 00 7E FF CC 09 CC 00 C9 FF CC 0B CC 0A 17 07 B2 - 5E 01 52 0A 60 09 05 06 14 4B 00 00 58 02 D0 07 - 00 41 FF CC C2 C2 -//Extern 32k + 24Mhz CPU -//# -//[H:S]0021 -//[H:S]0004 -//[H:A]09 00 00 00 -//Bdaddr -//# -//[H:S]0001 -//[H:S]0006 -//[H:A]89 60 41 7f 03 00 -//Audio -# -[H:S]0002 -[H:S]0004 -[H:A]23 08 01 33 -//Audio -# -[H:S]0003 -[H:S]0004 -[H:A]dd e5 2e 00 -//Audio -# -[H:S]0015 -[H:S]0004 -[H:A]12 00 00 00 -//Audio -# -[H:S]0016 -[H:S]0004 -[H:A]00 00 a7 02 -# -//PLC -[H:S]001F -[H:S]0008 -[H:A]01 1A 06 14 50 B4 32 96 diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/RamPatch.txt b/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/RamPatch.txt deleted file mode 100644 index badcc110d8e2..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30000coex/RamPatch.txt +++ /dev/null @@ -1,2 +0,0 @@ -0569 -000000000e20000050800000000158000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d0915300d4915300d8915300dc91530098b0530064ce5300f8d2530008e7530008d253000cd2530098d95300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff051001010101ffffff50500101010180019800c8019800f4029800d0039800380498001404980024059800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000366100ad0581c206bd01e00800bd0a17641c0c0abd05815d080c0ce00800bd02dd03ed05815c080c0ce00800c60400ad05c1f802922b11819903c09920926b11e008000c021df0003681001c0e516d030c0720d074d241107911d0cd90b805a0cc11cabbb90160e6030c2a609034972a026062003801e2c1102203068d07cc8260e613102000fd061df072631122011072434fc805204290a044114acc882c0c1980a00407e805820c4b07e8079c7aa20c4b07ea12a2c3340c0b0cfc0c198191029911e008000c1972434ec805e8114acca82cd20c4ba0a00416aa0590fd20f24c4bcc4e820349f65878a1b1039805a20a034a9992990980aa01a0a831909821809901909831a7294a0c5a81bc04bd02e00800cd0aad0281be04e805c0b0744ace920c4b0c4dd09920924c4be008009c7a72434a860400ad020c4b81bf0492a0fe909d10924c4be0080060e613102000ad061df00c1a81bd04bd02e00800cd0a46ecff0c5a81bd04bd02e00800cd0a86e8ff0000368100305074bd0120407481c206ad04e00800922a11216d0390920516890ba18804b16e03c0200040349091f204a03311822992c02000b08810a08820a8028269923aaab20a49d2ca48579b08c20a4bc0c204161c08b24a4ae1d104524d01eae5f20e7fe20e803c29f7be4a1c0b424110d9111c0c1c0f1c0552c110fd05cd0580e6030c2e80d034d72e02806200bd05b20500c20500a802c0bb90a0bb11baaa924a3480e613102000420500d811403490520d01a03311ad04b20d0081c204cd05e00800a802b2a0fb3aaa920a4b0c12b09910924a4b1df00c021df0364100811e0621c0098808921207ece8ecc9e1b103b21206a21ef1b73a210c0a817c03d21ef0c1d603f16c03c80ce20f44a0bd11e0bd93d1d209e00800a252071df00000364100817f04916c03880892092880801466180acc79810d04a2a064e008001df0000000364100c02000c16c03e1940391d9032178030c0dd2628bf20902c02000f0ed83e2628cc02000d2628dc02000d2628e820c43b20c28d19d0210bb01d0bb10cc580cba0c53c600000c0a0c83c020000c1dd2628fc02000a2628ac02000b26289a209020c088cfa661a040c1ac60300662a05a2190026ca040c0a8607000c0af0ba01e1da03a2090ce0bb100c1ea0ae93e1f40230aa11e0aa10b0aa20b1fd03c02000a26bc1f209020c18f62f040c098604009209070c1a909a930c2af09911a09910d09920c02000d17f04926bc6d80de20c28d0d014661d0acc7e810d04a2a064e00800c020003262881df00036410081c305c1900920b074e19605d16e09e80ec02000d22d82b94ed92ec02000b90c30e6030c2a309034972a02306200e00800c02000fd0391250382a10082698000710030e6131020001df0 \ No newline at end of file diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101/PS_ASIC.pst b/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101/PS_ASIC.pst deleted file mode 100644 index 812e6505df26..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101/PS_ASIC.pst +++ /dev/null @@ -1,65 +0,0 @@ - -// Radio table TAG -# -[H:S]012C -[H:S]0042 -[H:A]B1 B1 12 00 08 00 01 30 06 00 02 00 00 20 02 00 - 04 00 0C 40 01 00 48 00 00 48 54 9A 02 00 00 08 - 02 00 48 00 89 EE 70 E6 38 00 D8 70 EF 52 02 00 - 00 40 00 00 08 00 31 00 00 00 04 00 10 00 00 00 - B2 B2 -// System config TAG -# -[H:S]0013 -[H:S]009C -[H:A]C1 C1 17 02 08 00 01 30 48 00 0E CC 33 26 01 08 - 64 96 14 05 FF FF 05 80 00 00 FF CC 00 CC 01 00 - 20 80 FF CC 02 CC 04 00 DF EC 43 F8 00 21 00 E0 - FF CC 03 CC 06 00 80 F0 08 28 80 F4 0C 20 80 F8 - 0E 18 80 FC 14 10 80 00 18 08 80 04 16 00 FF CC - 04 CC 01 00 1A 12 40 96 01 C0 28 00 00 00 C0 01 - 40 06 00 01 00 00 C8 00 00 F0 00 00 FF CC 0C CC - 08 00 01 03 00 7E 08 08 00 7E 01 01 00 7E 01 03 - 00 7E 03 03 00 7E 61 63 00 7E 63 65 00 7E 6A 6C - 00 7E FF CC 09 CC 00 C9 FF CC C2 C2 -//Extern 32k + 24Mhz CPU -//# -//[H:S]0021 -//[H:S]0004 -//[H:A]09 00 00 00 -//Bdaddr -//# -//[H:S]0001 -//[H:S]0006 -//[H:A]89 60 41 7f 03 00 -//Audio -# -[H:S]0002 -[H:S]0004 -[H:A]23 08 01 33 -//Audio -# -[H:S]0003 -[H:S]0004 -[H:A]dd e5 2e 00 -//Audio -# -[H:S]0015 -[H:S]0004 -[H:A]12 00 00 00 -//Audio -# -[H:S]0016 -[H:S]0004 -[H:A]00 00 a7 02 -# -//PLC -[H:S]001F -[H:S]0008 -[H:A]01 1A 06 14 50 B4 32 96 -//Sniff Recovery -# -[H:S]003D -[H:S]0018 -[H:A]A0 0F 00 00 00 08 00 00 0F 00 7D 04 E8 03 01 00 - 01 00 01 05 00 02 1F 01 diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101/RamPatch.txt b/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101/RamPatch.txt deleted file mode 100644 index 107fd0ff80c5..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101/RamPatch.txt +++ /dev/null @@ -1,2 +0,0 @@ -21c7 -000000000e20000050800000000158000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d8d5530024e7530030e1530060e15300ece1530070e353008ce4530054e1530088e1530040af530088e353008ce35300d4e25300d8e25300fce253003ce3530024e3530054e3530030dd530024b0530078d553000000000000000000000000000000000030d553002ca05300000000000000000000000000000000000000000080019800d80198006c029800ec049800fc0698005c0898009c08980020099800cc099800340a9800340b9800b00b9800700c9800e40c9800580d9800c40d9800300e9800600e9800380f9800d00f9800541198000000000000000000000000000000000084189800501b98000000000000000000000000000000000000000000364100813a03416f0382085148041618040c13bc040c07613b030c02680676942252a1085052821b225a564205062020742654052634026644079205bf1769011b773df04600000c077048c00c024023831df00c021df000364100569208c0200021ce0991f3020c04426992c0200042699398128d04ed0916c9063d09a802c859b809b912a90999028c9ca21e06b82ee00c00860300a21e088bce5c0b81d6020c8de0080098120c4bbcb9c1f302d819c02000ed0cd26c90dd0cc02000426c93c02000a812b26c92a81ac02000b22c910c0cb0bac0a61b04e813a79e0ac0200081f3020c1ff268931df0000036a100a2a0dcbd01810c030c1ce00800a2a0d24bb10c4c421202521201612d0782010092a0d49088827202008a26220280810c030c16e00800313d030c09a203005981076a1690b9a030bba0b21b0407eb0c1b9990907416b9fe4600000c196619040c09c600006d090c19cc290c121df00c2c7951810c03513b03b2a108b0b282b961a8050c02225104baaaa20a1db2a0cdbaaa8bb1e00800721104810c032931a80560d6a0303da0b2030ec2a108c0bb820c4cbaaaa20a1db2a0c8baaacbb1e008008bb10c2c810c03225104a805f831d2030ee2a108e0dd82f971daaaa20a1dd2a0cddaaae00800621104cbb10c4c810c03d861a8052931daaaa20a1dd2a0c8daaae00800e851c831e0e104161e12bd04a13c0381ef02a0ac10e00800d20315b871e881a0f4c0a811faeee040f4b0aac0b20310a020f4d09bc0c2c9feac7df13a03168c0f662c1ff20f539c9f52030e82a108805582813b0388085a88820879513b030b8816880da0f0f4e0a0f4f79a2f0c121df00c0277b60c6097c097bb062bbab794010c12d805e2030ef2a108f0ee82eaddd20d79cc4d82ccfe16d8081df0b941f991d9a1c9b1ba9af7a91a40a2c081b503b841e00800c8b1b841d8a1b08a82f8918a444040f4b941d9a1c9b1ba9f47a91820a4c081b503b841e00800b841c8b1b08a82d8a18a222020f447b204ba222020f4b7b209ba22ba444040f42020f4b092c09084c01658f620a4c016faf59aada0b4c0167bf5b66c404bcac7b40206d3ffd2c2fc47bd02c6d0ff0c021df0ad0c81ef02bd04e0080086b7fff20f53cd09d2cdfed0d07416bff1f66d0246c5ff2bc9d2cdfed0d07486c2ff1c4b673702c6c3ff70e6c0e73b0286c1fff2c2fef0f4c056dfef0c1286beff000000368100815308324114e008003d0a815208ad02e00800d1540837aa070c0aa25202860000a21202c20114daccc20c00921203a0cc827ce4b2cc1fc0bcb3b0b5211bbb40bb10b252019c69815308e008008ceab21203a21201baaa1baa40aa10a25201a13d03720114c20a000c09076c169089a0a088a082180407e80c1b9990907416b9fe4600000c19313b03513a03d2a0c86619070c0b9201004600000c1b9069a0a066a0bcfb0c4c81e905b803d2060ee2a108e0dd82a2a0c8dabbb20b1dd911aaab50bba0e008000c2cd811b80381e905dabbb20b1da2a0cdaaab50bb90b2cb10e00800d2a0c8812d0792a0d4907782b8037a7872078082a1088077820c4c7abbb20b1d81e905daab50bba0e008000c2cb80381e9057abbb20b1da2a0cdaaab50bb90b2cb10e008004bb6a2a0d281e9050c4ce00800a2a0dc0c1c81e905b2c114e00800312e03815508ad02e00800309ac056a909c21201a21202e20114b154080b9e1bdeba8e820800e0d993d0d074a08882dabbf20b00e2c81fa0ff8280e8b3e0e5211beed2cf1ff0dfb340ee10e0e0f4d0d5211bdd40dd10d0d0f4e7bd2582ccfe8080f4825201920b00a09982f2c91f90f9b3f0f5211bff40ff10f0f0f4873f830609002b9c9090f4925201e20b00a0ee82d2ce1fe0deb3d0d5211bdd40dd10d0d0f4d7b902c6d6ff0c0aa25202815308e00800dc1a91b706920907809901909831cc390c0aa252011df00000366100814d08ad02e008000c0541a50862a0d4606382a212016a44b2048a6d0a8cdb261b0b262b52212e031df02d0b1df0b21202821484921483b73837973b34c2cbfea72c1b81ef02e008009c2a815308e00800ccaa81ac07e00800cc2a0c021df0bd03815808ad02e00800b2120292120156bb0d52448a06ebffa13d0352448a920a0072a0cd0769189d0590b9a0a0bba0b21b0407eb0c1b9990907416b9fe4600000c19313b03d2a0c8513a036619070c0b9201004600000c1b9069a0a066a0bceb0c4cb80372060e82a108807782a2a0c87abbb20b1d81e905aaab50bba0e008000c2cb80381e9057abbb20b1da2a0cdaaab50bb90b2cb10e00800d2a0c872a0cdb80342047482a1088044820c4c4abbb20b1d81e905daab50bba0e00800b8030c2c4abbb20b1d81e9057aab50bb90b2cb10e008004bb6a2a0d281e9050c4ce00800815508ad02e00800a020f41df06099c05659ed52448a06c0ff00000036c1002241003241014911592169317941a2a0de0c1cb2c12022412081e90592211ad20164e22118e951d241189971e00800810609ad01e008002d0a1df00000366100a2a0debd01810c030c1ce008004202030c0761590782a0d48087828a66a2067f920100664a1ef6791b817e03c2166aa21669b20202caaab0aac0bd04e00800cc2a1cb21df0520206820202ac45b6352292166962166a0c239a668066c030a6c0817e03bd04e00800165afd2b333030745733e91b777070746697960c021df000003661000c03ad02a901b15907c2a0d4c0c382cabbc20b7f664c22c801d801721b6ab21b69d21d02c21c015d0dd7b7015d077795392d0b6d0c7d0d060d001b333030746693c30c0351cf0642a0ff30b3a050bba0820b00471809814c08a801e00800fc1a1b333030741613fec60d002d0c6d0b0c14bd0540a78281ef02aaa620aac0e00800dc3aa2a06481b503bd04e008001ce9a7b904212e031df01b444040746694d086e5ff0c021df00000364100ad03bd048159080c0ce00800ad058105070c29d21314f10905e8d30c4c0c0bb24316c24301f0ee10e9d3d25501c2132bc25503b24500924504e00800d22311877d17e203c4076e11bd04a2a4300c2cd2030081e3060c3ee00800815008ad03e008001df0003661004081040c0aa25100165808d172085c5ec20301b2030080cc11cabbb0b0f4a0ca90d0cca0f21c021baab79f5bd21c01d25100e2a410e0ebc0166e09f2a411f0fbc016df0882a42c808bc016480892a42d909bc016b907a2a3fda0abc0162a07c2a418c0cbc0166c050c1abd058175080c1ce00800a0a074bd02ed050c1c817408dd01e00800860c00a0a074e79a8f06e8ffad0581da062bb1e00800167a04c20a11b20300376c413c99979b3c81a50592a0f7909c10924a11e008000c021df0bd02ed050c0a0c1c817408dd01e0080006faff60a074bd02ed050c1c817408dd01e0080006f5ffb20300ad02cd03dd05ed06818908fd04e0080086efff00366100612d0782a0d48082828a66f6721481bd05a206a8e00800816108e00800a24301a2440c81a3080c19f20300f24100e20301e24101d203020be5e0e993d24102d20680c20303c241030c2cb20307b24104bd01a20304a24105a2a410e00800b1b70291b302822631a2262d908820b0aa20a2662d8266311df000368100612d0782a0d48082828a66f6722281bd05a206a8e00800816108e00800bd0aa24301921402a13503b2440ca09920925402220300224100f20305f24101e20301e24102d20302d24103d1b702c20303c24104c2262db20306b24105b1b302a20307d0cc20dd01a24106a226319203089241070c19b0aa20821305824108721305b2a42c70784172410942130642410a22130681740820284122410bf20304f2410ce2030ea26631c2662de2410de206801c0c0ba5a0a993e008001df0003661002060f481a408ad06e008002d0a26e61192a06d97160ba2a081a71605b2a06eb7960262a410624100424102bd010c2c0c190be582a0d460a841a24101808382e0e993312d07a2a3eb8a33811b07d20380e00800c1c203b2232dd223317cfee0e230e0dd10d26331c0bb10b2632d1df000003661002060f481a408ad06e008002d0a26e61192a06d97160ba2a081a71605b2a06eb7960262a42c624100424102bd010c2c0c190be582a0d460a841a24101808382e0e993312d07a2a4288a33816e07d20380e00800c1c203b2232dd223317cfee0e230e0dd10d26331c0bb10b2632d1df000003661002060f481a408ad06e0080082a0d480838231a5082d0a8a3326e60592a06d97960262a4108c959203850c1aa09920924385625100a2a3eabd010c2cd203740c190be4811d07e0e993e00800b1c203a2232ac2232e7cfdd0d230d0cc10c2632eb0aa10a2632a1df000003661002060f481a408ad06e0080082a0d480838231a5082d0a8a3326e60592a06d97960262a42c8c959203850c1aa09920924385625100a2a427bd010c2cd203740c190be4811d07e0e993e00800b1c203a2232ac2232e7cfdd0d230d0cc10c2632eb0aa10a2632a1df0000036410081610341b70691b40852a0d45052825a4451c2036224893224859066105033108066106264893264851df0000036410081a408ad02e0080091b706b2a0d4b0b382ba99922989a70909f6733756d5060c021df0f6734b5655ffc21402c0d014c0c20416dc08ad02bd0381b5082c3ce00800c60200ad02bd0381b6082c3ce008000c121df05675fc92140290d014909204160905ad02bd0381b5082c3ce0080006ebff1695fa92140290d014276926ad02bd0381b5082c3ce0080086f0ff92140290d0142769adad02bd0381b5082c3ce0080086eaffad02bd0381b6082c3ce00800c6e6ffad02bd0381b6082c3ce00800c6d6ffad02bd0381b6082c3ce0080046dfff0000003661000c0351a707cd02c91181c606e00800b2a0d4b0b3825a4b921450a099c016590672048581a80721b70662a1e02a2b6a62ad06e00800ad06b2145181aa072901e008009204852d0a771916a2a412d204780c3e81a907b801c2a1edcabb0c2ce00800d811e20484d7161c271e19224484d20478a2a4130c3e81ab07b801c2a1eccabb0c2ce008001b33303074d2c3f6567df71df0000036a100ad05bd0181da06225108e008007d0ac8da21bc03d19b02f13704e1c103176431b21108d70c02c63500922a11d0ac20a9d7f099209267118201000c1fb678028626000c0f20c920e0da20d9d7c26711862200d78c28922a11d0ac20a9d7f09920926711820100cd0af67802062900e0ca2020b920b267110c02c9d7460200e0fc100c1d0c02f02d838207014109056638420c7a812507bd07e00800bc3a8126070c7ae00800ac9aa21301b21302512e03a7bb6481ef02e00800817b08a25301b20100ad03e0080050aac00c19a09583861400c8d71ca240bc10b9d71df0ad0fdd03ed058174080c1ce00800860300bd07cd03dd02817d08a20100e008000c021df060a074dd03ed058174080c1ce0080046faff0c12c6dbffad03817b08b20100e008009d0afcf9ed02a2a3ea0c2cd20700b2c110811d07f207110c2990ff20f24711e00800cd03bd07817c08a21302a2572b92130192572aa20100e00800b8d740bb10b9d706e5ff50c9c056fcf7ad0798d781500840991099d7e008002c021df0364100c16d044c49a2a108813b03a0a2828808718403aa88820824a13d038088a0a088a08208137827908882b1c1048a778817216c039858a848904b457054a058656838ac4560d4b0d81d576d1de2050620d9105a5e8b55270910b0f510f71d0a204510c039104033203958a04b457054a058656084b0ac558818576821881762050678485a568b55206710270710b0951097160a20b510c0a710b0aa20a9481df0000036610056720e0c0b5c8c213a0381ad02ad02e0080082a0faa2a0f092a1e02c8b0c1c4c6d2c0e0caff24254e24243d24244c24224c24226c24242c24245c24246c2424ab25217b24248b2424b925219a2521882521a81e905a2a1040c099901a252265c0a1c4bb24249bd010c2cc242470c4ce00800813e03a2a0ffe00800818c0320e6030c2a209034972a02206200e00800818d03e00800818e03e00800818f03e00800819003e00800819103e00800819203e00800819303e00800819403e00800819503e00800819603e00800819703e00800819803e0080020e6131020008199039d02e00800819a03e008001df0364100cc3322a0641df00c0c0c0a769306a752011bcc1baabd03a2a06481ee02a0ac82e00800a020741df000368100c1a502613b0342a108404282680632a0a84a663a369206bf52262c67e913a21c2582a0808089201baaa25c258246bfc60400921660b206c20c1a001b4000aaa1a09920925660a2130c0cab92031a8178051b9992431ae00800a2431ba2031a0c07b69a0572431a72530c724316724338817905ad02e00800ad02817a05bd03e00800a2165482263bd13c03913b03c16c039809e13a034a99b2091d92292ce0bba0b80b780eb099c0c099109a77707141d077108077c0d07710f07711a7b7017d0aad02bd07cd010c0d81b8035941e00800d13a03b13b035d0ae80bc135034aee920e79f18103ec090c09b62a0582cafd56d80ea21d1ae20d29aacaa2ca14e0ac83a0a0f4a25100463600262a05264a02665a46ad02b21100817b05c13a03920e1dd22e2cc0e9a0e80ef2263be0ddc0e16c03c80ce0dd10daccd13c03c0c141d0cc10f0ccc0d0cc10f0cc11e00800b13b03c13503d13a03f18103880b1c0e4a888208bfa81f27e825f1a502921f261b99925f26c78a32a20d2c47ea2ce09a20817903924d2ce00800b13b03860600c78a17a20d2c476a1181790392a0ef909a10924d2ce00800b13b038841e80bf1c1024aeec20ebfd2a0fbd0cc10d82ec24ebfc2a0bfa80bf0dd204aaa920abfd92ec09910924abf28230c1a8022c0202a931df0a21100881f9911f7e80fc2165477bc09e20d29cc3ef2a4e2f911bd074bc18bd181d703cbe1e0080066550b8ba1cbb181d6034bc1e00800a8214c4cd831b81181c703dabbe00800b13b03c13503d13a03f18103a24316c6c7ff00000036a1000c067cf849612971dd03d981213b0342a0ff8991890191b703a802520904b2a10840e5c016ee0bb0b58272a0a8baaaf20a797a7a661f19c20ae09c3c818405ad05e0080098a70ba9167a1cb2c9fe161b1c817c03ad05e008004bc1dd01bd0a3d0a817d03ad05e008006d0a0b9a169907166a07a2cafd16ba1fb2c6fe163b19264602665654818505ad05e00800461200a2970a817e03b20712e00800cc3a0c0aa2570ac802d2a108d0d5821c0edaccd20cbfb62602c69a00e0dd200c9a0c0bd24cbf714d0381ae0352474be00800a1b7030c19924a050c0bb991c2c6fc165cf3d2c6fb16fdf228911df0b20716d802c2a108c0c582e13a03caddd20d1da827e0dda0d80df16c03d0eac0f0ee10e73b02c63f00c931b09ac056a617e20738e0e9c0ad050cbbd0cec0d16c03815705d0cc10e00800ed0ae951167a0db14d03a20b5a818605b0aab0a941a20a03e00800c2cafed851c901d73c02862d00913a03e871d831524e00c8028851daccf20c1da088c090ffa0f80f2ba88aff816c032bff80ff108881e13d03f908fd0ae20e00f991e0e004562e06f841f20f01661f5af65a57814d0382087c56e804d20cbfb2a080b0bd10f63a10c2a080c78d55d2071bed09e20e44e73d4aa9a1accb5c0a8bb1810c030c4ce00800b2010892071ba8a1b7b916d831c802daccc82c677c0bf13a03e21700f20f43f7be18b63a0246b6ff984192090126590a26390756b9ec4600000c36a861c871b881524c00390b564aebd8a7d2cdfe561d07e802f2a108f0f582faeef13a03e20e1df0eea0e80e0c2ff991f16c032beef0ee10f881e90f06a2ff817c03ad05e008000c0cdd01bd0a3d0a817d03a2073be008006d0a261a11262a0e263a0b92073b471995663692c6f3ff82a10852073b78028085828a7782a0a88a7786f7ffed0946a1ff920713a2970a16e9dfe61a02067effb20712e802b79a2df2a108f0f582faeed20ebf57ed1f0c2ab2a20e0c1c817f032c09909d20924ebfe008008c7a818003524a08e00800921708a837b16c03a0a3c0b0aa10a7b917c802d2a108d0d582daccd20cbf0c8e576d05e0ed20e24cbf816905ad05e0080056bad7818505ad05e008000c49a06993466cffb2a0efb0dd104663ff368100513a03713b0362a0ff41a803bd03a204050c13671a41820401d13c0380e00407e8109824c215179092c0d09910f09911c72924c807f2a108f0fa82faccc20c17b94180cc01c0c831e61c02066f00817b030c4be00800b8412204040c0d6092c01629219807e2a108e0e2820012409aeec20e79a2ce10ec4cf20e1780ff01f0f831e61f0b820e16808801808831a6180df805e22a37f0f141f0eec0169e21661c05821a741608210c0c00f3a1e21407a2a108a0a282a901f0ee20e254079aaa920a17e805809901909831a6195d9911821a80e0e1e480eec0e0e0e497eb3582054697282fb20551f63b29820a79661823b20545921a7cb7391ae921822a3fc93166981081b003ad02e00800c8310c0de82106140092040c3cba168904e73a45b21408f0bb20b25408460e00820545e21a7c873e2eb21408f0bb20b25408920a7966191fe20a1680ee01e0e831e61e13f22a3fc931669f0b81b003ad02e00800c8310c0d0c0e567c05a2040d9c3a92054797ba0eb801a807baaaa22a3f269a02668a38a805f20548a0a1e4f73e0ee2140ab20549e0eac0e0e0e4e7bb6122040467120f82a10880828228078a222202f5224404a2540ad2440c4611000ce9971ac1a2040c56bafba2040d2204048c3a1baaa2440d60b2c0ed0ac0ec93e2440d164b091c9c6712220caa0c0b914d0381ae03224953c24952e008003244001df02204040c0aa2440d86f0ff1df0b20407679b04a24407bd0adcee81af03e00800b20407c20401a09014a13c039092c030cc20c24401a0991099242d0b671bcb81ae03a14d035c09924a52b24a530c0b0caae00800b807c2a108c0c282cabbb20bf5324400b24407679ba0d20401e2a0fee0dd10d244011df0d2440cd2440df21407821408a805220402224404a0a1e4a2540af08810879f0ad25408a254095c0c060400c21409b2a078c0cac0c0c0e4c73be81c9cd2540786caffcc6ce20af31beee24af398070c1cc677ff366101a2a0dfb2c1100c4c42513c81e9050c1dd941d951e00800a2a0dfb2c11481e9050c4ce00800a2a0dfb2c110810c030c4ce00800a2a0dfb2c114810c030c4ce008000c0ad1b706f2c178c2a3f242113c816007e851984190ee01a099019941e951b2231190ee2080ee20e0bb10b26311c7247747ac02464600ad0381610720b074e00800d22311a1b706d0910416a93da21a04a0a004561a3dbd05a2c1201c0c91be0281d402909d10926311e00800811107e00800b2c120d2c140cd0a811207a2c36ce00800a2c37cb2c14481d4020ccce00800d20300ed07a2a3f3b2c1408113070c2ce008000c021df092a0d297a402063300d2a0d247ad02065800b0e00416be08bd040c02811a06ad02e00800224306ad030c1b810f072c0ce0080046f1ff92a08f9094c0564906a906920507e67205168947a672040ba9160a470c14c1c106b21d4c0c1dc2dcff40bb20b25c4ca672010c0dad03bd020c1c8124077cfee00800dcba0c5a812507bd03e00800166a438126070c5ae0080016ba420c1956f93ab2113c1c1a811a06a906e0080028061df0c2a3fac72471b2611947ac02062300cd05dd040cce0c1fa1b702816207a09b20926311ad03bd02e008002d0a1df0c2a076c7a40286420047ac0206d4ff076bbb42a0a4ad0391b902816307909b20926311e00800bd024ae30c2a1c6c810007d1db05e008000c0a811a061c6cc24303b2113ce00800c6b6ffa2a3f8a7a402c6410047aa02065100ad02bd03cd04dd05ed06816407fd07e00800c6adffb2a433b7a402463f0047ab020652000c1420b074816107ad03e00800424306ad03c20303810f070c0be0080006a2ffc2a3efc7a402865e0047ac02067100ad0381610720b074e008000c2abd03c1e202922311811007c09920926311e00800bd0581d4021c0ce008000c2abd020c8cd1db05e2a0a4810007eae3e008001c6a0c89815c06924303e00800d2a088dad316ca2dad02bd03ed06fd07816507c2a072e008004684ffb2a075b7a40246470047ab0286aaff42a400920305b20503b24306b099c0569918b2113c0c0a811a06a906e00800bd03c203060c0a922311810b07409920926311e008008672ffa2a3f6a0a4c0569ae6ad02bd03cd04816607dd05e00800066cff92a4329094c056f9e420b074816107ad03e00800ad03c203030c0b0c09810f07924306e00800c661ffa2a3f9a0a4c0566ae2bd0fed07a2a3ea0c2c811d07d20300e00800ad03816707bd06e00800c657ff92a43490a4c056eadfb21d04b0b004164b163c3a812507bd03e00800167a158126073c3ae0080016ca143c4a812507bd03e0080016fa138126073c4ae00800164a13ad0320b074ed070c0cdd06f2113c8168075901e00800066bff82a3ee8084c05638da0c0acd02dd0381f4061c3be00800863aff92c48c56c9d80c0a811a06bd04e00800815c061c7ae0080042a0884a43160a1aad02bd03dd04ed06fd07816907c2a070e00800062dff92a3f09094c05639d5d16a07c13704d0bb20c0bb20b26311a67208e1bc03e0eb20e26311ad02bd03cd04dd05ed06816b07fd07e00800c61effad05bd03cd02dd06ed078114070c4fe008008619ff0c2a812507bd03e00800164a098126070c2ae00800169a08b2113c0c0a0c0c811a06c906e00800ad03816c07b20306e008000b9a16f9c2ad030c4b922311812807409920926311e00800a2a3f66bb30c2cd20300816d070c3ee00800e2a0a4920306eae316290abd020c2a3c1c810007d1db05e008003c1992430306fafeed07a2a428b2c1600c2c816e0792a4343c72225131925130d20300e0080029063c721df0b2113c2c5a811a06a906e008000617ff811a06a1bb029223110c0cc24313b2113ca09920926311a806e00800ad038128070c2be008009203051699102caa812507bd03e0080016ba0b8126072caae00800160a0bad030c1b0cac0c09810f07924306e008000601ffbd020c2a1cac810007d1db05e008001ca946d6ff816f07ad0de0080046cffe0c0906f4febd042c1a811a06a906e0080046f4feb11f070c6c814e03922311a2a200a09920926311ad04e00800ecaab1b706b21b0407eb227ba5b1200781d4021c0ce00800ad02bd03dd05ed06fd07816907c2a06fe0080086b8fead04812107bd03e00800bd020c2a1c4cd1db05e2a0a4810007eae3e008001c4906b4ffad03812807b2a104e00800424313ed07a2a3f66bb30c2cd203000c09816d07924306e00800bd020c2a1cbcd1db05e2a0a4810007eae3e008001cbff2430386c9fead0320b074cd05d2113c8170070caee0080046c4fe \ No newline at end of file diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101/Readme.txt b/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101/Readme.txt deleted file mode 100644 index 9adbc9fa07b7..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101/Readme.txt +++ /dev/null @@ -1,22 +0,0 @@ --"PS_ASIC.pst" - This file contains radio, system, and firwmare configurabilities. - Details on how the ".pst" format and definitions can be found in the documents folder. - --"RamPatch.txt" - This file contains firmware fixes for known defects. Atheros will release patch files as needed. - -Both files are required for the system to be operational. - -- "ar3kbdaddr.pst" -This file contains the user configurable Bluetooth Address - -Linux: - -The files have to be copied to "\lib\firmware\" folder. - - -Windows CE. - -The files have to be copied to "platform\\Files" folder. - -Please refer the corresponding documents for the exacts steps to be followed. diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/PS_ASIC.pst b/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/PS_ASIC.pst deleted file mode 100644 index 87d25d40b923..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/PS_ASIC.pst +++ /dev/null @@ -1,93 +0,0 @@ - -// Coex Configuration -# -[H:S]0017 -[H:S]0022 -[H:A]d1 d1 20 00 02 01 02 09 0c 00 24 0f 04 00 00 01 - 00 01 00 01 01 01 01 01 01 00 00 00 01 00 00 00 - d2 d2 -// Radio table TAG -# -[H:S]012C -[H:S]0042 -[H:A]B1 B1 12 00 08 00 01 30 06 00 02 00 00 20 02 00 - 04 00 0C 40 01 00 48 00 00 48 54 9A 02 00 00 08 - 02 00 48 00 89 EE 70 E6 38 00 D8 70 EF 52 02 00 - 00 40 00 00 08 00 31 00 00 00 04 00 10 00 00 00 - B2 B2 -// System config TAG -# -[H:S]0013 -[H:S]00B6 -[H:A]C1 C1 17 02 06 00 01 30 55 00 0E CC 33 06 01 08 - 64 96 14 05 FF FF 05 80 00 00 FF CC 00 CC 01 00 - 20 80 FF CC 02 CC 04 00 DF EC 43 F8 00 21 00 E0 - FF CC 03 CC 06 00 80 F0 08 28 80 F4 0C 20 80 F8 - 0E 18 80 FC 14 10 80 00 18 08 80 04 16 00 FF CC - 04 CC 01 00 1A 12 40 96 01 C0 28 00 00 00 C0 01 - 40 06 00 01 00 00 C8 00 00 F0 00 00 FF CC 0C CC - 08 00 01 03 00 7E 08 08 00 7E 01 01 00 7E 01 03 - 00 7E 03 03 00 7E 61 63 00 7E 63 65 00 7E 6A 6C - 00 7E FF CC 09 CC 00 C9 FF CC 0B CC 0A 17 07 B2 - 5E 01 52 0A 60 09 05 06 14 4B 00 00 58 02 D0 07 - 00 41 FF CC C2 C2 -//Extern 32k + 24Mhz CPU -//bit 7: sleep disable/enable, default to enable -//e.g. to disable sleep, clear bit 7: -//[H:A]08 00 00 00 -# -[H:S]0021 -[H:S]0004 -[H:A]88 00 00 00 -//Bdaddr -//# -//[H:S]0001 -//[H:S]0006 -//[H:A]89 60 41 7f 03 00 -//Audio -# -[H:S]0002 -[H:S]0004 -[H:A]23 08 01 33 -//Audio -# -[H:S]0003 -[H:S]0004 -[H:A]dd e5 2e 00 -//Audio -# -[H:S]0015 -[H:S]0004 -[H:A]12 00 00 00 -//Audio -# -[H:S]0016 -[H:S]0004 -[H:A]00 00 a7 02 -# -//PLC -[H:S]001F -[H:S]0008 -[H:A]01 1A 06 14 50 B4 32 96 -//Sniff Recovery -# -[H:S]003D -[H:S]0018 -[H:A]A0 0F 00 00 00 08 00 00 0F 00 7D 04 E8 03 01 00 - 01 00 01 05 00 02 1F 01 -//BRM Config -# -[H:S]0026 -[H:S]000C -[H:A]01 20 46 01 0F 02 28 14 01 28 68 01 -//TLPM -//[79:64] - TLPM wakeup timeout in ms, default 10 -//[127:96] - TLPM idle timeout in ms, default 1000 -//e.g. to change the wakeup timeout to 5 and idle timeout to 2000 -//[H:A]03 00 03 00 00 00 00 00 05 00 0A 00 D0 07 00 00 -// E8 03 00 00 E8 03 00 00 -# -[H:S]0023 -[H:S]0018 -[H:A]03 00 03 00 00 00 00 00 0A 00 0A 00 E8 03 00 00 - E8 03 00 00 E8 03 00 00 diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/PS_ASIC_aclHighPri.pst b/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/PS_ASIC_aclHighPri.pst deleted file mode 100644 index 87d25d40b923..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/PS_ASIC_aclHighPri.pst +++ /dev/null @@ -1,93 +0,0 @@ - -// Coex Configuration -# -[H:S]0017 -[H:S]0022 -[H:A]d1 d1 20 00 02 01 02 09 0c 00 24 0f 04 00 00 01 - 00 01 00 01 01 01 01 01 01 00 00 00 01 00 00 00 - d2 d2 -// Radio table TAG -# -[H:S]012C -[H:S]0042 -[H:A]B1 B1 12 00 08 00 01 30 06 00 02 00 00 20 02 00 - 04 00 0C 40 01 00 48 00 00 48 54 9A 02 00 00 08 - 02 00 48 00 89 EE 70 E6 38 00 D8 70 EF 52 02 00 - 00 40 00 00 08 00 31 00 00 00 04 00 10 00 00 00 - B2 B2 -// System config TAG -# -[H:S]0013 -[H:S]00B6 -[H:A]C1 C1 17 02 06 00 01 30 55 00 0E CC 33 06 01 08 - 64 96 14 05 FF FF 05 80 00 00 FF CC 00 CC 01 00 - 20 80 FF CC 02 CC 04 00 DF EC 43 F8 00 21 00 E0 - FF CC 03 CC 06 00 80 F0 08 28 80 F4 0C 20 80 F8 - 0E 18 80 FC 14 10 80 00 18 08 80 04 16 00 FF CC - 04 CC 01 00 1A 12 40 96 01 C0 28 00 00 00 C0 01 - 40 06 00 01 00 00 C8 00 00 F0 00 00 FF CC 0C CC - 08 00 01 03 00 7E 08 08 00 7E 01 01 00 7E 01 03 - 00 7E 03 03 00 7E 61 63 00 7E 63 65 00 7E 6A 6C - 00 7E FF CC 09 CC 00 C9 FF CC 0B CC 0A 17 07 B2 - 5E 01 52 0A 60 09 05 06 14 4B 00 00 58 02 D0 07 - 00 41 FF CC C2 C2 -//Extern 32k + 24Mhz CPU -//bit 7: sleep disable/enable, default to enable -//e.g. to disable sleep, clear bit 7: -//[H:A]08 00 00 00 -# -[H:S]0021 -[H:S]0004 -[H:A]88 00 00 00 -//Bdaddr -//# -//[H:S]0001 -//[H:S]0006 -//[H:A]89 60 41 7f 03 00 -//Audio -# -[H:S]0002 -[H:S]0004 -[H:A]23 08 01 33 -//Audio -# -[H:S]0003 -[H:S]0004 -[H:A]dd e5 2e 00 -//Audio -# -[H:S]0015 -[H:S]0004 -[H:A]12 00 00 00 -//Audio -# -[H:S]0016 -[H:S]0004 -[H:A]00 00 a7 02 -# -//PLC -[H:S]001F -[H:S]0008 -[H:A]01 1A 06 14 50 B4 32 96 -//Sniff Recovery -# -[H:S]003D -[H:S]0018 -[H:A]A0 0F 00 00 00 08 00 00 0F 00 7D 04 E8 03 01 00 - 01 00 01 05 00 02 1F 01 -//BRM Config -# -[H:S]0026 -[H:S]000C -[H:A]01 20 46 01 0F 02 28 14 01 28 68 01 -//TLPM -//[79:64] - TLPM wakeup timeout in ms, default 10 -//[127:96] - TLPM idle timeout in ms, default 1000 -//e.g. to change the wakeup timeout to 5 and idle timeout to 2000 -//[H:A]03 00 03 00 00 00 00 00 05 00 0A 00 D0 07 00 00 -// E8 03 00 00 E8 03 00 00 -# -[H:S]0023 -[H:S]0018 -[H:A]03 00 03 00 00 00 00 00 0A 00 0A 00 E8 03 00 00 - E8 03 00 00 E8 03 00 00 diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/PS_ASIC_aclLowPri.pst b/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/PS_ASIC_aclLowPri.pst deleted file mode 100644 index 8f5f8992c2ff..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/PS_ASIC_aclLowPri.pst +++ /dev/null @@ -1,93 +0,0 @@ - -// Coex Configuration -# -[H:S]0017 -[H:S]0022 -[H:A]d1 d1 20 00 02 01 02 09 0c 00 24 0f 04 00 00 01 - 00 01 00 00 01 01 01 01 01 00 00 00 01 00 00 00 - d2 d2 -// Radio table TAG -# -[H:S]012C -[H:S]0042 -[H:A]B1 B1 12 00 08 00 01 30 06 00 02 00 00 20 02 00 - 04 00 0C 40 01 00 48 00 00 48 54 9A 02 00 00 08 - 02 00 48 00 89 EE 70 E6 38 00 D8 70 EF 52 02 00 - 00 40 00 00 08 00 31 00 00 00 04 00 10 00 00 00 - B2 B2 -// System config TAG -# -[H:S]0013 -[H:S]00B6 -[H:A]C1 C1 17 02 06 00 01 30 55 00 0E CC 33 06 01 08 - 64 96 14 05 FF FF 05 80 00 00 FF CC 00 CC 01 00 - 20 80 FF CC 02 CC 04 00 DF EC 43 F8 00 21 00 E0 - FF CC 03 CC 06 00 80 F0 08 28 80 F4 0C 20 80 F8 - 0E 18 80 FC 14 10 80 00 18 08 80 04 16 00 FF CC - 04 CC 01 00 1A 12 40 96 01 C0 28 00 00 00 C0 01 - 40 06 00 01 00 00 C8 00 00 F0 00 00 FF CC 0C CC - 08 00 01 03 00 7E 08 08 00 7E 01 01 00 7E 01 03 - 00 7E 03 03 00 7E 61 63 00 7E 63 65 00 7E 6A 6C - 00 7E FF CC 09 CC 00 C9 FF CC 0B CC 0A 17 07 B2 - 5E 01 52 0A 60 09 05 06 14 4B 00 00 58 02 D0 07 - 00 41 FF CC C2 C2 -//Extern 32k + 24Mhz CPU -//bit 7: sleep disable/enable, default to enable -//e.g. to disable sleep, clear bit 7: -//[H:A]08 00 00 00 -# -[H:S]0021 -[H:S]0004 -[H:A]88 00 00 00 -//Bdaddr -//# -//[H:S]0001 -//[H:S]0006 -//[H:A]89 60 41 7f 03 00 -//Audio -# -[H:S]0002 -[H:S]0004 -[H:A]23 08 01 33 -//Audio -# -[H:S]0003 -[H:S]0004 -[H:A]dd e5 2e 00 -//Audio -# -[H:S]0015 -[H:S]0004 -[H:A]12 00 00 00 -//Audio -# -[H:S]0016 -[H:S]0004 -[H:A]00 00 a7 02 -# -//PLC -[H:S]001F -[H:S]0008 -[H:A]01 1A 06 14 50 B4 32 96 -//Sniff Recovery -# -[H:S]003D -[H:S]0018 -[H:A]A0 0F 00 00 00 08 00 00 0F 00 7D 04 E8 03 01 00 - 01 00 01 05 00 02 1F 01 -//BRM Config -# -[H:S]0026 -[H:S]000C -[H:A]01 20 46 01 0F 02 28 14 01 28 68 01 -//TLPM -//[79:64] - TLPM wakeup timeout in ms, default 10 -//[127:96] - TLPM idle timeout in ms, default 1000 -//e.g. to change the wakeup timeout to 5 and idle timeout to 2000 -//[H:A]03 00 03 00 00 00 00 00 05 00 0A 00 D0 07 00 00 -// E8 03 00 00 E8 03 00 00 -# -[H:S]0023 -[H:S]0018 -[H:A]03 00 03 00 00 00 00 00 0A 00 0A 00 E8 03 00 00 - E8 03 00 00 E8 03 00 00 diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/RamPatch.txt b/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/RamPatch.txt deleted file mode 100644 index 107fd0ff80c5..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3k/30101coex/RamPatch.txt +++ /dev/null @@ -1,2 +0,0 @@ -21c7 -000000000e20000050800000000158000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d8d5530024e7530030e1530060e15300ece1530070e353008ce4530054e1530088e1530040af530088e353008ce35300d4e25300d8e25300fce253003ce3530024e3530054e3530030dd530024b0530078d553000000000000000000000000000000000030d553002ca05300000000000000000000000000000000000000000080019800d80198006c029800ec049800fc0698005c0898009c08980020099800cc099800340a9800340b9800b00b9800700c9800e40c9800580d9800c40d9800300e9800600e9800380f9800d00f9800541198000000000000000000000000000000000084189800501b98000000000000000000000000000000000000000000364100813a03416f0382085148041618040c13bc040c07613b030c02680676942252a1085052821b225a564205062020742654052634026644079205bf1769011b773df04600000c077048c00c024023831df00c021df000364100569208c0200021ce0991f3020c04426992c0200042699398128d04ed0916c9063d09a802c859b809b912a90999028c9ca21e06b82ee00c00860300a21e088bce5c0b81d6020c8de0080098120c4bbcb9c1f302d819c02000ed0cd26c90dd0cc02000426c93c02000a812b26c92a81ac02000b22c910c0cb0bac0a61b04e813a79e0ac0200081f3020c1ff268931df0000036a100a2a0dcbd01810c030c1ce00800a2a0d24bb10c4c421202521201612d0782010092a0d49088827202008a26220280810c030c16e00800313d030c09a203005981076a1690b9a030bba0b21b0407eb0c1b9990907416b9fe4600000c196619040c09c600006d090c19cc290c121df00c2c7951810c03513b03b2a108b0b282b961a8050c02225104baaaa20a1db2a0cdbaaa8bb1e00800721104810c032931a80560d6a0303da0b2030ec2a108c0bb820c4cbaaaa20a1db2a0c8baaacbb1e008008bb10c2c810c03225104a805f831d2030ee2a108e0dd82f971daaaa20a1dd2a0cddaaae00800621104cbb10c4c810c03d861a8052931daaaa20a1dd2a0c8daaae00800e851c831e0e104161e12bd04a13c0381ef02a0ac10e00800d20315b871e881a0f4c0a811faeee040f4b0aac0b20310a020f4d09bc0c2c9feac7df13a03168c0f662c1ff20f539c9f52030e82a108805582813b0388085a88820879513b030b8816880da0f0f4e0a0f4f79a2f0c121df00c0277b60c6097c097bb062bbab794010c12d805e2030ef2a108f0ee82eaddd20d79cc4d82ccfe16d8081df0b941f991d9a1c9b1ba9af7a91a40a2c081b503b841e00800c8b1b841d8a1b08a82f8918a444040f4b941d9a1c9b1ba9f47a91820a4c081b503b841e00800b841c8b1b08a82d8a18a222020f447b204ba222020f4b7b209ba22ba444040f42020f4b092c09084c01658f620a4c016faf59aada0b4c0167bf5b66c404bcac7b40206d3ffd2c2fc47bd02c6d0ff0c021df0ad0c81ef02bd04e0080086b7fff20f53cd09d2cdfed0d07416bff1f66d0246c5ff2bc9d2cdfed0d07486c2ff1c4b673702c6c3ff70e6c0e73b0286c1fff2c2fef0f4c056dfef0c1286beff000000368100815308324114e008003d0a815208ad02e00800d1540837aa070c0aa25202860000a21202c20114daccc20c00921203a0cc827ce4b2cc1fc0bcb3b0b5211bbb40bb10b252019c69815308e008008ceab21203a21201baaa1baa40aa10a25201a13d03720114c20a000c09076c169089a0a088a082180407e80c1b9990907416b9fe4600000c19313b03513a03d2a0c86619070c0b9201004600000c1b9069a0a066a0bcfb0c4c81e905b803d2060ee2a108e0dd82a2a0c8dabbb20b1dd911aaab50bba0e008000c2cd811b80381e905dabbb20b1da2a0cdaaab50bb90b2cb10e00800d2a0c8812d0792a0d4907782b8037a7872078082a1088077820c4c7abbb20b1d81e905daab50bba0e008000c2cb80381e9057abbb20b1da2a0cdaaab50bb90b2cb10e008004bb6a2a0d281e9050c4ce00800a2a0dc0c1c81e905b2c114e00800312e03815508ad02e00800309ac056a909c21201a21202e20114b154080b9e1bdeba8e820800e0d993d0d074a08882dabbf20b00e2c81fa0ff8280e8b3e0e5211beed2cf1ff0dfb340ee10e0e0f4d0d5211bdd40dd10d0d0f4e7bd2582ccfe8080f4825201920b00a09982f2c91f90f9b3f0f5211bff40ff10f0f0f4873f830609002b9c9090f4925201e20b00a0ee82d2ce1fe0deb3d0d5211bdd40dd10d0d0f4d7b902c6d6ff0c0aa25202815308e00800dc1a91b706920907809901909831cc390c0aa252011df00000366100814d08ad02e008000c0541a50862a0d4606382a212016a44b2048a6d0a8cdb261b0b262b52212e031df02d0b1df0b21202821484921483b73837973b34c2cbfea72c1b81ef02e008009c2a815308e00800ccaa81ac07e00800cc2a0c021df0bd03815808ad02e00800b2120292120156bb0d52448a06ebffa13d0352448a920a0072a0cd0769189d0590b9a0a0bba0b21b0407eb0c1b9990907416b9fe4600000c19313b03d2a0c8513a036619070c0b9201004600000c1b9069a0a066a0bceb0c4cb80372060e82a108807782a2a0c87abbb20b1d81e905aaab50bba0e008000c2cb80381e9057abbb20b1da2a0cdaaab50bb90b2cb10e00800d2a0c872a0cdb80342047482a1088044820c4c4abbb20b1d81e905daab50bba0e00800b8030c2c4abbb20b1d81e9057aab50bb90b2cb10e008004bb6a2a0d281e9050c4ce00800815508ad02e00800a020f41df06099c05659ed52448a06c0ff00000036c1002241003241014911592169317941a2a0de0c1cb2c12022412081e90592211ad20164e22118e951d241189971e00800810609ad01e008002d0a1df00000366100a2a0debd01810c030c1ce008004202030c0761590782a0d48087828a66a2067f920100664a1ef6791b817e03c2166aa21669b20202caaab0aac0bd04e00800cc2a1cb21df0520206820202ac45b6352292166962166a0c239a668066c030a6c0817e03bd04e00800165afd2b333030745733e91b777070746697960c021df000003661000c03ad02a901b15907c2a0d4c0c382cabbc20b7f664c22c801d801721b6ab21b69d21d02c21c015d0dd7b7015d077795392d0b6d0c7d0d060d001b333030746693c30c0351cf0642a0ff30b3a050bba0820b00471809814c08a801e00800fc1a1b333030741613fec60d002d0c6d0b0c14bd0540a78281ef02aaa620aac0e00800dc3aa2a06481b503bd04e008001ce9a7b904212e031df01b444040746694d086e5ff0c021df00000364100ad03bd048159080c0ce00800ad058105070c29d21314f10905e8d30c4c0c0bb24316c24301f0ee10e9d3d25501c2132bc25503b24500924504e00800d22311877d17e203c4076e11bd04a2a4300c2cd2030081e3060c3ee00800815008ad03e008001df0003661004081040c0aa25100165808d172085c5ec20301b2030080cc11cabbb0b0f4a0ca90d0cca0f21c021baab79f5bd21c01d25100e2a410e0ebc0166e09f2a411f0fbc016df0882a42c808bc016480892a42d909bc016b907a2a3fda0abc0162a07c2a418c0cbc0166c050c1abd058175080c1ce00800a0a074bd02ed050c1c817408dd01e00800860c00a0a074e79a8f06e8ffad0581da062bb1e00800167a04c20a11b20300376c413c99979b3c81a50592a0f7909c10924a11e008000c021df0bd02ed050c0a0c1c817408dd01e0080006faff60a074bd02ed050c1c817408dd01e0080006f5ffb20300ad02cd03dd05ed06818908fd04e0080086efff00366100612d0782a0d48082828a66f6721481bd05a206a8e00800816108e00800a24301a2440c81a3080c19f20300f24100e20301e24101d203020be5e0e993d24102d20680c20303c241030c2cb20307b24104bd01a20304a24105a2a410e00800b1b70291b302822631a2262d908820b0aa20a2662d8266311df000368100612d0782a0d48082828a66f6722281bd05a206a8e00800816108e00800bd0aa24301921402a13503b2440ca09920925402220300224100f20305f24101e20301e24102d20302d24103d1b702c20303c24104c2262db20306b24105b1b302a20307d0cc20dd01a24106a226319203089241070c19b0aa20821305824108721305b2a42c70784172410942130642410a22130681740820284122410bf20304f2410ce2030ea26631c2662de2410de206801c0c0ba5a0a993e008001df0003661002060f481a408ad06e008002d0a26e61192a06d97160ba2a081a71605b2a06eb7960262a410624100424102bd010c2c0c190be582a0d460a841a24101808382e0e993312d07a2a3eb8a33811b07d20380e00800c1c203b2232dd223317cfee0e230e0dd10d26331c0bb10b2632d1df000003661002060f481a408ad06e008002d0a26e61192a06d97160ba2a081a71605b2a06eb7960262a42c624100424102bd010c2c0c190be582a0d460a841a24101808382e0e993312d07a2a4288a33816e07d20380e00800c1c203b2232dd223317cfee0e230e0dd10d26331c0bb10b2632d1df000003661002060f481a408ad06e0080082a0d480838231a5082d0a8a3326e60592a06d97960262a4108c959203850c1aa09920924385625100a2a3eabd010c2cd203740c190be4811d07e0e993e00800b1c203a2232ac2232e7cfdd0d230d0cc10c2632eb0aa10a2632a1df000003661002060f481a408ad06e0080082a0d480838231a5082d0a8a3326e60592a06d97960262a42c8c959203850c1aa09920924385625100a2a427bd010c2cd203740c190be4811d07e0e993e00800b1c203a2232ac2232e7cfdd0d230d0cc10c2632eb0aa10a2632a1df0000036410081610341b70691b40852a0d45052825a4451c2036224893224859066105033108066106264893264851df0000036410081a408ad02e0080091b706b2a0d4b0b382ba99922989a70909f6733756d5060c021df0f6734b5655ffc21402c0d014c0c20416dc08ad02bd0381b5082c3ce00800c60200ad02bd0381b6082c3ce008000c121df05675fc92140290d014909204160905ad02bd0381b5082c3ce0080006ebff1695fa92140290d014276926ad02bd0381b5082c3ce0080086f0ff92140290d0142769adad02bd0381b5082c3ce0080086eaffad02bd0381b6082c3ce00800c6e6ffad02bd0381b6082c3ce00800c6d6ffad02bd0381b6082c3ce0080046dfff0000003661000c0351a707cd02c91181c606e00800b2a0d4b0b3825a4b921450a099c016590672048581a80721b70662a1e02a2b6a62ad06e00800ad06b2145181aa072901e008009204852d0a771916a2a412d204780c3e81a907b801c2a1edcabb0c2ce00800d811e20484d7161c271e19224484d20478a2a4130c3e81ab07b801c2a1eccabb0c2ce008001b33303074d2c3f6567df71df0000036a100ad05bd0181da06225108e008007d0ac8da21bc03d19b02f13704e1c103176431b21108d70c02c63500922a11d0ac20a9d7f099209267118201000c1fb678028626000c0f20c920e0da20d9d7c26711862200d78c28922a11d0ac20a9d7f09920926711820100cd0af67802062900e0ca2020b920b267110c02c9d7460200e0fc100c1d0c02f02d838207014109056638420c7a812507bd07e00800bc3a8126070c7ae00800ac9aa21301b21302512e03a7bb6481ef02e00800817b08a25301b20100ad03e0080050aac00c19a09583861400c8d71ca240bc10b9d71df0ad0fdd03ed058174080c1ce00800860300bd07cd03dd02817d08a20100e008000c021df060a074dd03ed058174080c1ce0080046faff0c12c6dbffad03817b08b20100e008009d0afcf9ed02a2a3ea0c2cd20700b2c110811d07f207110c2990ff20f24711e00800cd03bd07817c08a21302a2572b92130192572aa20100e00800b8d740bb10b9d706e5ff50c9c056fcf7ad0798d781500840991099d7e008002c021df0364100c16d044c49a2a108813b03a0a2828808718403aa88820824a13d038088a0a088a08208137827908882b1c1048a778817216c039858a848904b457054a058656838ac4560d4b0d81d576d1de2050620d9105a5e8b55270910b0f510f71d0a204510c039104033203958a04b457054a058656084b0ac558818576821881762050678485a568b55206710270710b0951097160a20b510c0a710b0aa20a9481df0000036610056720e0c0b5c8c213a0381ad02ad02e0080082a0faa2a0f092a1e02c8b0c1c4c6d2c0e0caff24254e24243d24244c24224c24226c24242c24245c24246c2424ab25217b24248b2424b925219a2521882521a81e905a2a1040c099901a252265c0a1c4bb24249bd010c2cc242470c4ce00800813e03a2a0ffe00800818c0320e6030c2a209034972a02206200e00800818d03e00800818e03e00800818f03e00800819003e00800819103e00800819203e00800819303e00800819403e00800819503e00800819603e00800819703e00800819803e0080020e6131020008199039d02e00800819a03e008001df0364100cc3322a0641df00c0c0c0a769306a752011bcc1baabd03a2a06481ee02a0ac82e00800a020741df000368100c1a502613b0342a108404282680632a0a84a663a369206bf52262c67e913a21c2582a0808089201baaa25c258246bfc60400921660b206c20c1a001b4000aaa1a09920925660a2130c0cab92031a8178051b9992431ae00800a2431ba2031a0c07b69a0572431a72530c724316724338817905ad02e00800ad02817a05bd03e00800a2165482263bd13c03913b03c16c039809e13a034a99b2091d92292ce0bba0b80b780eb099c0c099109a77707141d077108077c0d07710f07711a7b7017d0aad02bd07cd010c0d81b8035941e00800d13a03b13b035d0ae80bc135034aee920e79f18103ec090c09b62a0582cafd56d80ea21d1ae20d29aacaa2ca14e0ac83a0a0f4a25100463600262a05264a02665a46ad02b21100817b05c13a03920e1dd22e2cc0e9a0e80ef2263be0ddc0e16c03c80ce0dd10daccd13c03c0c141d0cc10f0ccc0d0cc10f0cc11e00800b13b03c13503d13a03f18103880b1c0e4a888208bfa81f27e825f1a502921f261b99925f26c78a32a20d2c47ea2ce09a20817903924d2ce00800b13b03860600c78a17a20d2c476a1181790392a0ef909a10924d2ce00800b13b038841e80bf1c1024aeec20ebfd2a0fbd0cc10d82ec24ebfc2a0bfa80bf0dd204aaa920abfd92ec09910924abf28230c1a8022c0202a931df0a21100881f9911f7e80fc2165477bc09e20d29cc3ef2a4e2f911bd074bc18bd181d703cbe1e0080066550b8ba1cbb181d6034bc1e00800a8214c4cd831b81181c703dabbe00800b13b03c13503d13a03f18103a24316c6c7ff00000036a1000c067cf849612971dd03d981213b0342a0ff8991890191b703a802520904b2a10840e5c016ee0bb0b58272a0a8baaaf20a797a7a661f19c20ae09c3c818405ad05e0080098a70ba9167a1cb2c9fe161b1c817c03ad05e008004bc1dd01bd0a3d0a817d03ad05e008006d0a0b9a169907166a07a2cafd16ba1fb2c6fe163b19264602665654818505ad05e00800461200a2970a817e03b20712e00800cc3a0c0aa2570ac802d2a108d0d5821c0edaccd20cbfb62602c69a00e0dd200c9a0c0bd24cbf714d0381ae0352474be00800a1b7030c19924a050c0bb991c2c6fc165cf3d2c6fb16fdf228911df0b20716d802c2a108c0c582e13a03caddd20d1da827e0dda0d80df16c03d0eac0f0ee10e73b02c63f00c931b09ac056a617e20738e0e9c0ad050cbbd0cec0d16c03815705d0cc10e00800ed0ae951167a0db14d03a20b5a818605b0aab0a941a20a03e00800c2cafed851c901d73c02862d00913a03e871d831524e00c8028851daccf20c1da088c090ffa0f80f2ba88aff816c032bff80ff108881e13d03f908fd0ae20e00f991e0e004562e06f841f20f01661f5af65a57814d0382087c56e804d20cbfb2a080b0bd10f63a10c2a080c78d55d2071bed09e20e44e73d4aa9a1accb5c0a8bb1810c030c4ce00800b2010892071ba8a1b7b916d831c802daccc82c677c0bf13a03e21700f20f43f7be18b63a0246b6ff984192090126590a26390756b9ec4600000c36a861c871b881524c00390b564aebd8a7d2cdfe561d07e802f2a108f0f582faeef13a03e20e1df0eea0e80e0c2ff991f16c032beef0ee10f881e90f06a2ff817c03ad05e008000c0cdd01bd0a3d0a817d03a2073be008006d0a261a11262a0e263a0b92073b471995663692c6f3ff82a10852073b78028085828a7782a0a88a7786f7ffed0946a1ff920713a2970a16e9dfe61a02067effb20712e802b79a2df2a108f0f582faeed20ebf57ed1f0c2ab2a20e0c1c817f032c09909d20924ebfe008008c7a818003524a08e00800921708a837b16c03a0a3c0b0aa10a7b917c802d2a108d0d582daccd20cbf0c8e576d05e0ed20e24cbf816905ad05e0080056bad7818505ad05e008000c49a06993466cffb2a0efb0dd104663ff368100513a03713b0362a0ff41a803bd03a204050c13671a41820401d13c0380e00407e8109824c215179092c0d09910f09911c72924c807f2a108f0fa82faccc20c17b94180cc01c0c831e61c02066f00817b030c4be00800b8412204040c0d6092c01629219807e2a108e0e2820012409aeec20e79a2ce10ec4cf20e1780ff01f0f831e61f0b820e16808801808831a6180df805e22a37f0f141f0eec0169e21661c05821a741608210c0c00f3a1e21407a2a108a0a282a901f0ee20e254079aaa920a17e805809901909831a6195d9911821a80e0e1e480eec0e0e0e497eb3582054697282fb20551f63b29820a79661823b20545921a7cb7391ae921822a3fc93166981081b003ad02e00800c8310c0de82106140092040c3cba168904e73a45b21408f0bb20b25408460e00820545e21a7c873e2eb21408f0bb20b25408920a7966191fe20a1680ee01e0e831e61e13f22a3fc931669f0b81b003ad02e00800c8310c0d0c0e567c05a2040d9c3a92054797ba0eb801a807baaaa22a3f269a02668a38a805f20548a0a1e4f73e0ee2140ab20549e0eac0e0e0e4e7bb6122040467120f82a10880828228078a222202f5224404a2540ad2440c4611000ce9971ac1a2040c56bafba2040d2204048c3a1baaa2440d60b2c0ed0ac0ec93e2440d164b091c9c6712220caa0c0b914d0381ae03224953c24952e008003244001df02204040c0aa2440d86f0ff1df0b20407679b04a24407bd0adcee81af03e00800b20407c20401a09014a13c039092c030cc20c24401a0991099242d0b671bcb81ae03a14d035c09924a52b24a530c0b0caae00800b807c2a108c0c282cabbb20bf5324400b24407679ba0d20401e2a0fee0dd10d244011df0d2440cd2440df21407821408a805220402224404a0a1e4a2540af08810879f0ad25408a254095c0c060400c21409b2a078c0cac0c0c0e4c73be81c9cd2540786caffcc6ce20af31beee24af398070c1cc677ff366101a2a0dfb2c1100c4c42513c81e9050c1dd941d951e00800a2a0dfb2c11481e9050c4ce00800a2a0dfb2c110810c030c4ce00800a2a0dfb2c114810c030c4ce008000c0ad1b706f2c178c2a3f242113c816007e851984190ee01a099019941e951b2231190ee2080ee20e0bb10b26311c7247747ac02464600ad0381610720b074e00800d22311a1b706d0910416a93da21a04a0a004561a3dbd05a2c1201c0c91be0281d402909d10926311e00800811107e00800b2c120d2c140cd0a811207a2c36ce00800a2c37cb2c14481d4020ccce00800d20300ed07a2a3f3b2c1408113070c2ce008000c021df092a0d297a402063300d2a0d247ad02065800b0e00416be08bd040c02811a06ad02e00800224306ad030c1b810f072c0ce0080046f1ff92a08f9094c0564906a906920507e67205168947a672040ba9160a470c14c1c106b21d4c0c1dc2dcff40bb20b25c4ca672010c0dad03bd020c1c8124077cfee00800dcba0c5a812507bd03e00800166a438126070c5ae0080016ba420c1956f93ab2113c1c1a811a06a906e0080028061df0c2a3fac72471b2611947ac02062300cd05dd040cce0c1fa1b702816207a09b20926311ad03bd02e008002d0a1df0c2a076c7a40286420047ac0206d4ff076bbb42a0a4ad0391b902816307909b20926311e00800bd024ae30c2a1c6c810007d1db05e008000c0a811a061c6cc24303b2113ce00800c6b6ffa2a3f8a7a402c6410047aa02065100ad02bd03cd04dd05ed06816407fd07e00800c6adffb2a433b7a402463f0047ab020652000c1420b074816107ad03e00800424306ad03c20303810f070c0be0080006a2ffc2a3efc7a402865e0047ac02067100ad0381610720b074e008000c2abd03c1e202922311811007c09920926311e00800bd0581d4021c0ce008000c2abd020c8cd1db05e2a0a4810007eae3e008001c6a0c89815c06924303e00800d2a088dad316ca2dad02bd03ed06fd07816507c2a072e008004684ffb2a075b7a40246470047ab0286aaff42a400920305b20503b24306b099c0569918b2113c0c0a811a06a906e00800bd03c203060c0a922311810b07409920926311e008008672ffa2a3f6a0a4c0569ae6ad02bd03cd04816607dd05e00800066cff92a4329094c056f9e420b074816107ad03e00800ad03c203030c0b0c09810f07924306e00800c661ffa2a3f9a0a4c0566ae2bd0fed07a2a3ea0c2c811d07d20300e00800ad03816707bd06e00800c657ff92a43490a4c056eadfb21d04b0b004164b163c3a812507bd03e00800167a158126073c3ae0080016ca143c4a812507bd03e0080016fa138126073c4ae00800164a13ad0320b074ed070c0cdd06f2113c8168075901e00800066bff82a3ee8084c05638da0c0acd02dd0381f4061c3be00800863aff92c48c56c9d80c0a811a06bd04e00800815c061c7ae0080042a0884a43160a1aad02bd03dd04ed06fd07816907c2a070e00800062dff92a3f09094c05639d5d16a07c13704d0bb20c0bb20b26311a67208e1bc03e0eb20e26311ad02bd03cd04dd05ed06816b07fd07e00800c61effad05bd03cd02dd06ed078114070c4fe008008619ff0c2a812507bd03e00800164a098126070c2ae00800169a08b2113c0c0a0c0c811a06c906e00800ad03816c07b20306e008000b9a16f9c2ad030c4b922311812807409920926311e00800a2a3f66bb30c2cd20300816d070c3ee00800e2a0a4920306eae316290abd020c2a3c1c810007d1db05e008003c1992430306fafeed07a2a428b2c1600c2c816e0792a4343c72225131925130d20300e0080029063c721df0b2113c2c5a811a06a906e008000617ff811a06a1bb029223110c0cc24313b2113ca09920926311a806e00800ad038128070c2be008009203051699102caa812507bd03e0080016ba0b8126072caae00800160a0bad030c1b0cac0c09810f07924306e008000601ffbd020c2a1cac810007d1db05e008001ca946d6ff816f07ad0de0080046cffe0c0906f4febd042c1a811a06a906e0080046f4feb11f070c6c814e03922311a2a200a09920926311ad04e00800ecaab1b706b21b0407eb227ba5b1200781d4021c0ce00800ad02bd03dd05ed06fd07816907c2a06fe0080086b8fead04812107bd03e00800bd020c2a1c4cd1db05e2a0a4810007eae3e008001c4906b4ffad03812807b2a104e00800424313ed07a2a3f66bb30c2cd203000c09816d07924306e00800bd020c2a1cbcd1db05e2a0a4810007eae3e008001cbff2430386c9fead0320b074cd05d2113c8170070caee0080046c4fe \ No newline at end of file diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3kconfig.c b/drivers/net/wireless/ar6003/host/miscdrv/ar3kconfig.c deleted file mode 100644 index 5965b3fcc517..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3kconfig.c +++ /dev/null @@ -1,569 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2009-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// AR3K configuration implementation -// -// Author(s): ="Atheros" -//============================================================================== - -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" -#include "a_osapi.h" -#define ATH_MODULE_NAME misc -#include "a_debug.h" -#include "common_drv.h" -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -#include "export_hci_transport.h" -#else -#include "hci_transport_api.h" -#endif -#include "ar3kconfig.h" -#include "tlpm.h" - -#define BAUD_CHANGE_COMMAND_STATUS_OFFSET 5 -#define HCI_EVENT_RESP_TIMEOUTMS 3000 -#define HCI_CMD_OPCODE_BYTE_LOW_OFFSET 0 -#define HCI_CMD_OPCODE_BYTE_HI_OFFSET 1 -#define HCI_EVENT_OPCODE_BYTE_LOW 3 -#define HCI_EVENT_OPCODE_BYTE_HI 4 -#define HCI_CMD_COMPLETE_EVENT_CODE 0xE -#define HCI_MAX_EVT_RECV_LENGTH 257 -#define EXIT_MIN_BOOT_COMMAND_STATUS_OFFSET 5 - -A_STATUS AthPSInitialize(AR3K_CONFIG_INFO *hdev); - -static A_STATUS SendHCICommand(AR3K_CONFIG_INFO *pConfig, - A_UINT8 *pBuffer, - int Length) -{ - HTC_PACKET *pPacket = NULL; - A_STATUS status = A_OK; - - do { - - pPacket = (HTC_PACKET *)A_MALLOC(sizeof(HTC_PACKET)); - if (NULL == pPacket) { - status = A_NO_MEMORY; - break; - } - - A_MEMZERO(pPacket,sizeof(HTC_PACKET)); - SET_HTC_PACKET_INFO_TX(pPacket, - NULL, - pBuffer, - Length, - HCI_COMMAND_TYPE, - AR6K_CONTROL_PKT_TAG); - - /* issue synchronously */ - status = HCI_TransportSendPkt(pConfig->pHCIDev,pPacket,TRUE); - - } while (FALSE); - - if (pPacket != NULL) { - A_FREE(pPacket); - } - - return status; -} - -static A_STATUS RecvHCIEvent(AR3K_CONFIG_INFO *pConfig, - A_UINT8 *pBuffer, - int *pLength) -{ - A_STATUS status = A_OK; - HTC_PACKET *pRecvPacket = NULL; - - do { - - pRecvPacket = (HTC_PACKET *)A_MALLOC(sizeof(HTC_PACKET)); - if (NULL == pRecvPacket) { - status = A_NO_MEMORY; - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to alloc HTC struct \n")); - break; - } - - A_MEMZERO(pRecvPacket,sizeof(HTC_PACKET)); - - SET_HTC_PACKET_INFO_RX_REFILL(pRecvPacket,NULL,pBuffer,*pLength,HCI_EVENT_TYPE); - - status = HCI_TransportRecvHCIEventSync(pConfig->pHCIDev, - pRecvPacket, - HCI_EVENT_RESP_TIMEOUTMS); - if (A_FAILED(status)) { - break; - } - - *pLength = pRecvPacket->ActualLength; - - } while (FALSE); - - if (pRecvPacket != NULL) { - A_FREE(pRecvPacket); - } - - return status; -} - -A_STATUS SendHCICommandWaitCommandComplete(AR3K_CONFIG_INFO *pConfig, - A_UINT8 *pHCICommand, - int CmdLength, - A_UINT8 **ppEventBuffer, - A_UINT8 **ppBufferToFree) -{ - A_STATUS status = A_OK; - A_UINT8 *pBuffer = NULL; - A_UINT8 *pTemp; - int length; - A_BOOL commandComplete = FALSE; - A_UINT8 opCodeBytes[2]; - - do { - - length = max(HCI_MAX_EVT_RECV_LENGTH,CmdLength); - length += pConfig->pHCIProps->HeadRoom + pConfig->pHCIProps->TailRoom; - length += pConfig->pHCIProps->IOBlockPad; - - pBuffer = (A_UINT8 *)A_MALLOC(length); - if (NULL == pBuffer) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR3K Config: Failed to allocate bt buffer \n")); - status = A_NO_MEMORY; - break; - } - - /* get the opcodes to check the command complete event */ - opCodeBytes[0] = pHCICommand[HCI_CMD_OPCODE_BYTE_LOW_OFFSET]; - opCodeBytes[1] = pHCICommand[HCI_CMD_OPCODE_BYTE_HI_OFFSET]; - - /* copy HCI command */ - A_MEMCPY(pBuffer + pConfig->pHCIProps->HeadRoom,pHCICommand,CmdLength); - /* send command */ - status = SendHCICommand(pConfig, - pBuffer + pConfig->pHCIProps->HeadRoom, - CmdLength); - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR3K Config: Failed to send HCI Command (%d) \n", status)); - AR_DEBUG_PRINTBUF(pHCICommand,CmdLength,"HCI Bridge Failed HCI Command"); - break; - } - - /* reuse buffer to capture command complete event */ - A_MEMZERO(pBuffer,length); - status = RecvHCIEvent(pConfig,pBuffer,&length); - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR3K Config: HCI event recv failed \n")); - AR_DEBUG_PRINTBUF(pHCICommand,CmdLength,"HCI Bridge Failed HCI Command"); - break; - } - - pTemp = pBuffer + pConfig->pHCIProps->HeadRoom; - if (pTemp[0] == HCI_CMD_COMPLETE_EVENT_CODE) { - if ((pTemp[HCI_EVENT_OPCODE_BYTE_LOW] == opCodeBytes[0]) && - (pTemp[HCI_EVENT_OPCODE_BYTE_HI] == opCodeBytes[1])) { - commandComplete = TRUE; - } - } - - if (!commandComplete) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR3K Config: Unexpected HCI event : %d \n",pTemp[0])); - AR_DEBUG_PRINTBUF(pTemp,pTemp[1],"Unexpected HCI event"); - status = A_ECOMM; - break; - } - - if (ppEventBuffer != NULL) { - /* caller wants to look at the event */ - *ppEventBuffer = pTemp; - if (ppBufferToFree == NULL) { - status = A_EINVAL; - break; - } - /* caller must free the buffer */ - *ppBufferToFree = pBuffer; - pBuffer = NULL; - } - - } while (FALSE); - - if (pBuffer != NULL) { - A_FREE(pBuffer); - } - - return status; -} - -static A_STATUS AR3KConfigureHCIBaud(AR3K_CONFIG_INFO *pConfig) -{ - A_STATUS status = A_OK; - A_UINT8 hciBaudChangeCommand[] = {0x0c,0xfc,0x2,0,0}; - A_UINT16 baudVal; - A_UINT8 *pEvent = NULL; - A_UINT8 *pBufferToFree = NULL; - - do { - - if (pConfig->Flags & AR3K_CONFIG_FLAG_SET_AR3K_BAUD) { - baudVal = (A_UINT16)(pConfig->AR3KBaudRate / 100); - hciBaudChangeCommand[3] = (A_UINT8)baudVal; - hciBaudChangeCommand[4] = (A_UINT8)(baudVal >> 8); - - status = SendHCICommandWaitCommandComplete(pConfig, - hciBaudChangeCommand, - sizeof(hciBaudChangeCommand), - &pEvent, - &pBufferToFree); - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR3K Config: Baud rate change failed! \n")); - break; - } - - if (pEvent[BAUD_CHANGE_COMMAND_STATUS_OFFSET] != 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("AR3K Config: Baud change command event status failed: %d \n", - pEvent[BAUD_CHANGE_COMMAND_STATUS_OFFSET])); - status = A_ECOMM; - break; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("AR3K Config: Baud Changed to %d \n",pConfig->AR3KBaudRate)); - } - - if (pConfig->Flags & AR3K_CONFIG_FLAG_AR3K_BAUD_CHANGE_DELAY) { - /* some versions of AR3K do not switch baud immediately, up to 300MS */ - A_MDELAY(325); - } - - if (pConfig->Flags & AR3K_CONFIG_FLAG_SET_AR6K_SCALE_STEP) { - /* Tell target to change UART baud rate for AR6K */ - status = HCI_TransportSetBaudRate(pConfig->pHCIDev, pConfig->AR3KBaudRate); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("AR3K Config: failed to set scale and step values: %d \n", status)); - break; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("AR3K Config: Baud changed to %d for AR6K\n", pConfig->AR3KBaudRate)); - } - - } while (FALSE); - - if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); - } - - return status; -} - -static A_STATUS AR3KExitMinBoot(AR3K_CONFIG_INFO *pConfig) -{ - A_STATUS status; - A_CHAR exitMinBootCmd[] = {0x25,0xFC,0x0c,0x03,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00}; - A_UINT8 *pEvent = NULL; - A_UINT8 *pBufferToFree = NULL; - - status = SendHCICommandWaitCommandComplete(pConfig, - exitMinBootCmd, - sizeof(exitMinBootCmd), - &pEvent, - &pBufferToFree); - - if (A_SUCCESS(status)) { - if (pEvent[EXIT_MIN_BOOT_COMMAND_STATUS_OFFSET] != 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("AR3K Config: MinBoot exit command event status failed: %d \n", - pEvent[EXIT_MIN_BOOT_COMMAND_STATUS_OFFSET])); - status = A_ECOMM; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("AR3K Config: MinBoot Exit Command Complete (Success) \n")); - A_MDELAY(1); - } - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR3K Config: MinBoot Exit Failed! \n")); - } - - if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); - } - - return status; -} - -static A_STATUS AR3KConfigureSendHCIReset(AR3K_CONFIG_INFO *pConfig) -{ - A_STATUS status = A_OK; - A_UINT8 hciResetCommand[] = {0x03,0x0c,0x0}; - A_UINT8 *pEvent = NULL; - A_UINT8 *pBufferToFree = NULL; - - status = SendHCICommandWaitCommandComplete( pConfig, - hciResetCommand, - sizeof(hciResetCommand), - &pEvent, - &pBufferToFree ); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR3K Config: HCI reset failed! \n")); - } - - if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); - } - - return status; -} - -static A_STATUS AR3KEnableTLPM(AR3K_CONFIG_INFO *pConfig) -{ - A_STATUS status; - /* AR3K vendor specific command for Host Wakeup Config */ - A_CHAR hostWakeupConfig[] = {0x31,0xFC,0x18, - 0x02,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00, - TLPM_DEFAULT_IDLE_TIMEOUT_LSB,TLPM_DEFAULT_IDLE_TIMEOUT_MSB,0x00,0x00, //idle timeout in ms - 0x00,0x00,0x00,0x00, - TLPM_DEFAULT_WAKEUP_TIMEOUT_MS,0x00,0x00,0x00, //wakeup timeout in ms - 0x00,0x00,0x00,0x00}; - /* AR3K vendor specific command for Target Wakeup Config */ - A_CHAR targetWakeupConfig[] = {0x31,0xFC,0x18, - 0x04,0x00,0x00,0x00, - 0x01,0x00,0x00,0x00, - TLPM_DEFAULT_IDLE_TIMEOUT_LSB,TLPM_DEFAULT_IDLE_TIMEOUT_MSB,0x00,0x00, //idle timeout in ms - 0x00,0x00,0x00,0x00, - TLPM_DEFAULT_WAKEUP_TIMEOUT_MS,0x00,0x00,0x00, //wakeup timeout in ms - 0x00,0x00,0x00,0x00}; - /* AR3K vendor specific command for Host Wakeup Enable */ - A_CHAR hostWakeupEnable[] = {0x31,0xFC,0x4, - 0x01,0x00,0x00,0x00}; - /* AR3K vendor specific command for Target Wakeup Enable */ - A_CHAR targetWakeupEnable[] = {0x31,0xFC,0x4, - 0x06,0x00,0x00,0x00}; - /* AR3K vendor specific command for Sleep Enable */ - A_CHAR sleepEnable[] = {0x4,0xFC,0x1, - 0x1}; - A_UINT8 *pEvent = NULL; - A_UINT8 *pBufferToFree = NULL; - - if (0 != pConfig->IdleTimeout) { - A_UINT8 idle_lsb = pConfig->IdleTimeout & 0xFF; - A_UINT8 idle_msb = (pConfig->IdleTimeout & 0xFF00) >> 8; - hostWakeupConfig[11] = targetWakeupConfig[11] = idle_lsb; - hostWakeupConfig[12] = targetWakeupConfig[12] = idle_msb; - } - - if (0 != pConfig->WakeupTimeout) { - hostWakeupConfig[19] = targetWakeupConfig[19] = (pConfig->WakeupTimeout & 0xFF); - } - - status = SendHCICommandWaitCommandComplete(pConfig, - hostWakeupConfig, - sizeof(hostWakeupConfig), - &pEvent, - &pBufferToFree); - if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); - } - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HostWakeup Config Failed! \n")); - return status; - } - - pEvent = NULL; - pBufferToFree = NULL; - status = SendHCICommandWaitCommandComplete(pConfig, - targetWakeupConfig, - sizeof(targetWakeupConfig), - &pEvent, - &pBufferToFree); - if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); - } - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Target Wakeup Config Failed! \n")); - return status; - } - - pEvent = NULL; - pBufferToFree = NULL; - status = SendHCICommandWaitCommandComplete(pConfig, - hostWakeupEnable, - sizeof(hostWakeupEnable), - &pEvent, - &pBufferToFree); - if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); - } - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HostWakeup Enable Failed! \n")); - return status; - } - - pEvent = NULL; - pBufferToFree = NULL; - status = SendHCICommandWaitCommandComplete(pConfig, - targetWakeupEnable, - sizeof(targetWakeupEnable), - &pEvent, - &pBufferToFree); - if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); - } - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Target Wakeup Enable Failed! \n")); - return status; - } - - pEvent = NULL; - pBufferToFree = NULL; - status = SendHCICommandWaitCommandComplete(pConfig, - sleepEnable, - sizeof(sleepEnable), - &pEvent, - &pBufferToFree); - if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); - } - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Sleep Enable Failed! \n")); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR3K Config: Enable TLPM Completed (status = %d) \n",status)); - - return status; -} - -A_STATUS AR3KConfigure(AR3K_CONFIG_INFO *pConfig) -{ - A_STATUS status = A_OK; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR3K Config: Configuring AR3K ...\n")); - - do { - - if ((pConfig->pHCIDev == NULL) || (pConfig->pHCIProps == NULL) || (pConfig->pHIFDevice == NULL)) { - status = A_EINVAL; - break; - } - - /* disable asynchronous recv while we issue commands and receive events synchronously */ - status = HCI_TransportEnableDisableAsyncRecv(pConfig->pHCIDev,FALSE); - if (A_FAILED(status)) { - break; - } - - if (pConfig->Flags & AR3K_CONFIG_FLAG_FORCE_MINBOOT_EXIT) { - status = AR3KExitMinBoot(pConfig); - if (A_FAILED(status)) { - break; - } - } - - - /* Load patching and PST file if available*/ - if (A_OK != AthPSInitialize(pConfig)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Patch Download Failed!\n")); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("TLPM - PwrMgmtEnabled=%d, IdleTimeout=%d, WakeupTimeout=%d\n", - pConfig->PwrMgmtEnabled, - pConfig->IdleTimeout, - pConfig->WakeupTimeout)); - - /* Send HCI reset to make PS tags take effect*/ - AR3KConfigureSendHCIReset(pConfig); - - if (pConfig->PwrMgmtEnabled) { - /* the delay is required after the previous HCI reset before further - * HCI commands can be issued - */ - A_MDELAY(200); - AR3KEnableTLPM(pConfig); - } - - if (pConfig->Flags & - (AR3K_CONFIG_FLAG_SET_AR3K_BAUD | AR3K_CONFIG_FLAG_SET_AR6K_SCALE_STEP)) { - status = AR3KConfigureHCIBaud(pConfig); - if (A_FAILED(status)) { - break; - } - } - - /* re-enable asynchronous recv */ - status = HCI_TransportEnableDisableAsyncRecv(pConfig->pHCIDev,TRUE); - if (A_FAILED(status)) { - break; - } - - - } while (FALSE); - - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR3K Config: Configuration Complete (status = %d) \n",status)); - - return status; -} - -A_STATUS AR3KConfigureExit(void *config) -{ - A_STATUS status = A_OK; - AR3K_CONFIG_INFO *pConfig = (AR3K_CONFIG_INFO *)config; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR3K Config: Cleaning up AR3K ...\n")); - - do { - - if ((pConfig->pHCIDev == NULL) || (pConfig->pHCIProps == NULL) || (pConfig->pHIFDevice == NULL)) { - status = A_EINVAL; - break; - } - - /* disable asynchronous recv while we issue commands and receive events synchronously */ - status = HCI_TransportEnableDisableAsyncRecv(pConfig->pHCIDev,FALSE); - if (A_FAILED(status)) { - break; - } - - if (pConfig->Flags & - (AR3K_CONFIG_FLAG_SET_AR3K_BAUD | AR3K_CONFIG_FLAG_SET_AR6K_SCALE_STEP)) { - status = AR3KConfigureHCIBaud(pConfig); - if (A_FAILED(status)) { - break; - } - } - - /* re-enable asynchronous recv */ - status = HCI_TransportEnableDisableAsyncRecv(pConfig->pHCIDev,TRUE); - if (A_FAILED(status)) { - break; - } - - - } while (FALSE); - - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR3K Config: Cleanup Complete (status = %d) \n",status)); - - return status; -} - diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3kps/ar3kpsconfig.c b/drivers/net/wireless/ar6003/host/miscdrv/ar3kps/ar3kpsconfig.c deleted file mode 100644 index df4cf8c16b97..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3kps/ar3kpsconfig.c +++ /dev/null @@ -1,694 +0,0 @@ -/* - * Copyright (c) 2004-2010 Atheros Communications Inc. - * All rights reserved. - * - * This file implements the Atheros PS and patch downloaded for HCI UART Transport driver. - * This file can be used for HCI SDIO transport implementation for AR6002 with HCI_TRANSPORT_SDIO - * defined. - * - * - * ar3kcpsconfig.c - * - * - * - * The software source and binaries included in this development package are - * licensed, not sold. You, or your company, received the package under one - * or more license agreements. The rights granted to you are specifically - * listed in these license agreement(s). All other rights remain with Atheros - * Communications, Inc., its subsidiaries, or the respective owner including - * those listed on the included copyright notices.. Distribution of any - * portion of this package must be in strict compliance with the license - * agreement(s) terms. - * - * - * - */ - - - -#include "ar3kpsconfig.h" -#ifndef HCI_TRANSPORT_SDIO -#include "hci_ath.h" -#include "hci_uart.h" -#endif /* #ifndef HCI_TRANSPORT_SDIO */ - -#define MAX_FW_PATH_LEN 50 -#define MAX_BDADDR_FORMAT_LENGTH 30 - -/* - * Structure used to send HCI packet, hci packet length and device info - * together as parameter to PSThread. - */ -typedef struct { - - PSCmdPacket *HciCmdList; - A_UINT32 num_packets; - AR3K_CONFIG_INFO *dev; -}HciCommandListParam; - -A_STATUS SendHCICommandWaitCommandComplete(AR3K_CONFIG_INFO *pConfig, - A_UINT8 *pHCICommand, - int CmdLength, - A_UINT8 **ppEventBuffer, - A_UINT8 **ppBufferToFree); - -void LoadHeader(A_UCHAR *HCI_PS_Command,A_UCHAR opcode,int length,int index); -A_UINT32 Rom_Version; -A_UINT32 Build_Version; -extern A_BOOL BDADDR; -extern A_UINT32 Patch_Count; - -A_STATUS getDeviceType(AR3K_CONFIG_INFO *pConfig, A_UINT32 * code); -A_STATUS ReadVersionInfo(AR3K_CONFIG_INFO *pConfig); -A_STATUS set_patch_ram(AR3K_CONFIG_INFO *pConfig,A_UCHAR *patch_loc,A_UINT8 len); -#ifndef HCI_TRANSPORT_SDIO - -DECLARE_WAIT_QUEUE_HEAD(PsCompleteEvent); -DECLARE_WAIT_QUEUE_HEAD(HciEvent); -A_UCHAR *HciEventpacket; -rwlock_t syncLock; -wait_queue_t Eventwait; - -int PSHciWritepacket(struct hci_dev*,A_UCHAR* Data, A_UINT32 len); -extern char *bdaddr; -#endif /* HCI_TRANSPORT_SDIO */ - -A_STATUS write_bdaddr(AR3K_CONFIG_INFO *pConfig,A_UCHAR *bdaddr,int type); - -int PSSendOps(void *arg); - -#ifdef BT_PS_DEBUG -void Hci_log(A_UCHAR * log_string,A_UCHAR *data,A_UINT32 len) -{ - int i; - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s : ",log_string)); - for (i = 0; i < len; i++) { - printk("0x%02x ", data[i]); - } - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("\n...................................\n")); -} -#else -#define Hci_log(string,data,len) -#endif /* BT_PS_DEBUG */ - - - - -A_STATUS AthPSInitialize(AR3K_CONFIG_INFO *hdev) -{ - A_STATUS status = A_OK; - if(hdev == NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Invalid Device handle received\n")); - return A_ERROR; - } - -#ifndef HCI_TRANSPORT_SDIO - DECLARE_WAITQUEUE(wait, current); -#endif /* HCI_TRANSPORT_SDIO */ - - -#ifdef HCI_TRANSPORT_SDIO - status = PSSendOps((void*)hdev); -#else - if(InitPSState(hdev) == -1) { - return A_ERROR; - } - allow_signal(SIGKILL); - add_wait_queue(&PsCompleteEvent,&wait); - set_current_state(TASK_INTERRUPTIBLE); - if(!kernel_thread(PSSendOps,(void*)hdev,CLONE_FS|CLONE_FILES|CLONE_SIGHAND|SIGCHLD)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Kthread Failed\n")); - remove_wait_queue(&PsCompleteEvent,&wait); - return A_ERROR; - } - wait_event_interruptible(PsCompleteEvent,(PSTagMode == FALSE)); - set_current_state(TASK_RUNNING); - remove_wait_queue(&PsCompleteEvent,&wait); - -#endif /* HCI_TRANSPORT_SDIO */ - - - return status; - -} - -int PSSendOps(void *arg) -{ - int i; - int ps_index; - int status = 0; - PSCmdPacket *HciCmdList; /* List storing the commands */ - const struct firmware* firmware; - A_UINT32 numCmds; - A_UINT8 *event; - A_UINT8 *bufferToFree; - struct hci_dev *device; - A_UCHAR *buffer; - A_UINT32 len; - A_UINT32 DevType; - A_UCHAR *PsFileName; - A_UCHAR *patchFileName; - A_UCHAR patch_loc[40]; - A_UCHAR *path = NULL; - A_UCHAR *config_path = NULL; - A_UCHAR config_bdaddr[MAX_BDADDR_FORMAT_LENGTH]; - AR3K_CONFIG_INFO *hdev = (AR3K_CONFIG_INFO*)arg; - struct device *firmwareDev = NULL; - A_UINT8 cFlags = 0; - A_UINT8 bit7 = 0; - - status = 0; - HciCmdList = NULL; -#ifdef HCI_TRANSPORT_SDIO - device = hdev->pBtStackHCIDev; - firmwareDev = device->parent; -#else - device = hdev; - firmwareDev = &device->dev; - AthEnableSyncCommandOp(TRUE); -#endif /* HCI_TRANSPORT_SDIO */ - /* First verify if the controller is an FPGA or ASIC, so depending on the device type the PS file to be written will be different. - */ - - path =(A_UCHAR *)A_MALLOC(MAX_FW_PATH_LEN); - if(path == NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Malloc failed to allocate %d bytes for path\n", MAX_FW_PATH_LEN)); - goto complete; - } - config_path = (A_UCHAR *) A_MALLOC(MAX_FW_PATH_LEN); - if(config_path == NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Malloc failed to allocate %d bytes for config_path\n", MAX_FW_PATH_LEN)); - goto complete; - } - - if(A_ERROR == getDeviceType(hdev,&DevType)) { - status = 1; - goto complete; - } - if(A_ERROR == ReadVersionInfo(hdev)) { - status = 1; - goto complete; - } - - patchFileName = PATCH_FILE; - snprintf(path, MAX_FW_PATH_LEN, "%s/%xcoex/",CONFIG_PATH,Rom_Version); - if(DevType){ - if(DevType == 0xdeadc0de){ - PsFileName = PS_ASIC_FILE; - } else{ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" FPGA Test Image : %x %x \n",Rom_Version,Build_Version)); - if((Rom_Version == 0x99999999) && (Build_Version == 1)){ - - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("FPGA Test Image : Skipping Patch File load\n")); - patchFileName = NULL; - } - PsFileName = PS_FPGA_FILE; - } - } - else{ - PsFileName = PS_ASIC_FILE; - } - - snprintf(config_path, MAX_FW_PATH_LEN, "%s%s",path,PsFileName); - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%x: FPGA/ASIC PS File Name %s\n", DevType,config_path)); - /* Read the PS file to a dynamically allocated buffer */ - if(A_REQUEST_FIRMWARE(&firmware,config_path,firmwareDev) < 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: firmware file open error\n", __FUNCTION__ )); - status = 1; - goto complete; - - } - if(NULL == firmware || firmware->size == 0) { - status = 1; - goto complete; - } - buffer = (A_UCHAR *)A_MALLOC(firmware->size); - if(buffer != NULL) { - /* Copy the read file to a local Dynamic buffer */ - memcpy(buffer,firmware->data,firmware->size); - len = firmware->size; - A_RELEASE_FIRMWARE(firmware); - /* Parse the PS buffer to a global variable */ - status = AthDoParsePS(buffer,len); - A_FREE(buffer); - } else { - A_RELEASE_FIRMWARE(firmware); - } - - - /* Read the patch file to a dynamically allocated buffer */ - if(patchFileName != NULL) - snprintf(config_path, - MAX_FW_PATH_LEN, "%s%s",path,patchFileName); - else { - status = 0; - } - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Patch File Name %s\n", config_path)); - if((patchFileName == NULL) || (A_REQUEST_FIRMWARE(&firmware,config_path,firmwareDev) < 0)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: firmware file open error\n", __FUNCTION__ )); - /* - * It is not necessary that Patch file be available, continue with PS Operations if. - * failed. - */ - status = 0; - - } else { - if(NULL == firmware || firmware->size == 0) { - status = 0; - } else { - buffer = (A_UCHAR *)A_MALLOC(firmware->size); - if(buffer != NULL) { - /* Copy the read file to a local Dynamic buffer */ - memcpy(buffer,firmware->data,firmware->size); - len = firmware->size; - A_RELEASE_FIRMWARE(firmware); - /* parse and store the Patch file contents to a global variables */ - patch_loc[0] = '\0'; - status = AthDoParsePatch(buffer,len, patch_loc); - - A_FREE(buffer); - } else { - A_RELEASE_FIRMWARE(firmware); - } - } - } - - /* Create an HCI command list from the parsed PS and patch information */ - AthCreateCommandList(&HciCmdList,&numCmds); -#define CONFIG_PLATFORM 0x21 -#define CONFIG_TLPM 0x23 -#define PLATFORM_CONFIG_BIT 0x01 -#define TLPM_CONFIG_BIT 0x02 -#define IDLE_TIMEOUT_OFFSET 12 -#define WAKEUP_TIMEOUT_OFFSET 8 -#define IDLE_TIMEOUT_DEFAULT_VAL 1000 -#define WAKEUP_TIMEOUT_DEFAULT_VAL 10 - - hdev->IdleTimeout = IDLE_TIMEOUT_DEFAULT_VAL; - hdev->WakeupTimeout = WAKEUP_TIMEOUT_DEFAULT_VAL; - hdev->PwrMgmtEnabled = 0; - - ps_index = 2; /* CRC + PS Reset */ - if (Patch_Count) - ps_index += Patch_Count + 1; /* Patches + Enable patch Cmd */ - - for(i = ps_index; i PwrMgmtEnabled = 1; - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("CONFIG PLATFORM present and Pwr Manage %x\n", hdev->PwrMgmtEnabled)); - } - } - else if((HciCmdList[i].Hcipacket[4] == CONFIG_TLPM) && - (HciCmdList[i].Hcipacket[5] == 0)) { - cFlags |= TLPM_CONFIG_BIT; - hdev->IdleTimeout = *((A_UINT32 *)&HciCmdList[i].Hcipacket[IDLE_TIMEOUT_OFFSET + 7]); - hdev->WakeupTimeout = *((A_UINT16 *)&HciCmdList[i].Hcipacket[WAKEUP_TIMEOUT_OFFSET + 7]); - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("hdev->idletimeout %d hdev->WakeupTimeout %d",hdev->IdleTimeout, hdev->WakeupTimeout)); - } - } - - - /* Form the parameter for PSSendOps() API */ - - - /* - * First Send the CRC packet, - * We have to continue with the PS operations only if the CRC packet has been replied with - * a Command complete event with status Error. - */ - - if(SendHCICommandWaitCommandComplete - (hdev, - HciCmdList[0].Hcipacket, - HciCmdList[0].packetLen, - &event, - &bufferToFree) == A_OK) { - if(ReadPSEvent(event) == A_OK) { /* Exit if the status is success */ - if(bufferToFree != NULL) { - A_FREE(bufferToFree); - } -#ifndef HCI_TRANSPORT_SDIO - if(bdaddr && bdaddr[0] !='\0') { - write_bdaddr(hdev,bdaddr,BDADDR_TYPE_STRING); - } -#endif - status = 1; - goto complete; - } - if(bufferToFree != NULL) { - A_FREE(bufferToFree); - } - } else { - status = 0; - goto complete; - } - /* Set Patch location */ - if(patch_loc[0] != '\0') { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Setting Patch Location %s\n", patch_loc)); - set_patch_ram(hdev,patch_loc,sizeof(patch_loc)); - } - for(i = 1; i ",HciCmdList[i].Hcipacket,HciCmdList[i].packetLen); - if(SendHCICommandWaitCommandComplete - (hdev, - HciCmdList[i].Hcipacket, - HciCmdList[i].packetLen, - &event, - &bufferToFree) == A_OK) { - if(ReadPSEvent(event) != A_OK) { /* Exit if the status is success */ - if(bufferToFree != NULL) { - A_FREE(bufferToFree); - } - status = 1; - goto complete; - } - if(bufferToFree != NULL) { - A_FREE(bufferToFree); - } - } else { - status = 0; - goto complete; - } - } -#ifdef HCI_TRANSPORT_SDIO - if(BDADDR == FALSE) - if(hdev->bdaddr[0] !=0x00 || - hdev->bdaddr[1] !=0x00 || - hdev->bdaddr[2] !=0x00 || - hdev->bdaddr[3] !=0x00 || - hdev->bdaddr[4] !=0x00 || - hdev->bdaddr[5] !=0x00) - write_bdaddr(hdev,hdev->bdaddr,BDADDR_TYPE_HEX); - - - /* if Platform config is present and TLPM is not available - * write HCI command for TLPM with default timeout values */ - if(bit7 && !(cFlags & TLPM_CONFIG_BIT)) { - A_UCHAR TLPMHciCmd[] = {0x0b, 0xfc, 0x1c, 0x01, 0x23, 0x00, 0x18, - 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0a, 0x00, 0x0a, 0x00, 0xe8, 0x03, - 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0xe8, - 0x03, 0x00, 0x00 }; - int CmdLen = sizeof(TLPMHciCmd); - - *((A_UINT32 *)&TLPMHciCmd[IDLE_TIMEOUT_OFFSET + 7]) = hdev->IdleTimeout; - *((A_UINT16 *)&TLPMHciCmd[WAKEUP_TIMEOUT_OFFSET + 7]) = hdev->WakeupTimeout; - - if(SendHCICommandWaitCommandComplete - (hdev, - TLPMHciCmd, - CmdLen, - &event, - &bufferToFree) == A_OK) { - if(ReadPSEvent(event) != A_OK) { /* Exit if the status is success */ - if(bufferToFree != NULL) { - A_FREE(bufferToFree); - } - status = 1; - goto complete; - } - if(bufferToFree != NULL) { - A_FREE(bufferToFree); - } - } else { - status = 0; - goto complete; - } - } - -#ifndef HCI_TRANSPORT_SDIO - - if(bdaddr && bdaddr[0] != '\0') { - write_bdaddr(hdev,bdaddr,BDADDR_TYPE_STRING); - } else -#endif /* HCI_TRANSPORT_SDIO */ - /* Write BDADDR Read from OTP here */ - - - -#endif - - { - /* Read Contents of BDADDR file if user has not provided any option */ - snprintf(config_path,MAX_FW_PATH_LEN, "%s%s",path,BDADDR_FILE); - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BDADDR File Name %s\n", config_path)); - if(A_REQUEST_FIRMWARE(&firmware,config_path,firmwareDev) < 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: firmware file open error\n", __FUNCTION__ )); - goto complete; - } - if(NULL == firmware || firmware->size == 0) { - goto complete; - } - len = (firmware->size > MAX_BDADDR_FORMAT_LENGTH)? MAX_BDADDR_FORMAT_LENGTH: firmware->size; - memcpy(config_bdaddr, firmware->data,len); - config_bdaddr[len] = '\0'; - write_bdaddr(hdev,config_bdaddr,BDADDR_TYPE_STRING); - A_RELEASE_FIRMWARE(firmware); - } -complete: -#ifndef HCI_TRANSPORT_SDIO - AthEnableSyncCommandOp(FALSE); - PSTagMode = FALSE; - wake_up_interruptible(&PsCompleteEvent); -#endif /* HCI_TRANSPORT_SDIO */ - if(NULL != HciCmdList) { - AthFreeCommandList(&HciCmdList,numCmds); - } - if(path) { - A_FREE(path); - } - if(config_path) { - A_FREE(config_path); - } - return status; -} -#ifndef HCI_TRANSPORT_SDIO -/* - * This API is used to send the HCI command to controller and return - * with a HCI Command Complete event. - * For HCI SDIO transport, this will be internally defined. - */ -A_STATUS SendHCICommandWaitCommandComplete(AR3K_CONFIG_INFO *pConfig, - A_UINT8 *pHCICommand, - int CmdLength, - A_UINT8 **ppEventBuffer, - A_UINT8 **ppBufferToFree) -{ - if(CmdLength == 0) { - return A_ERROR; - } - Hci_log("COM Write -->",pHCICommand,CmdLength); - PSAcked = FALSE; - if(PSHciWritepacket(pConfig,pHCICommand,CmdLength) == 0) { - /* If the controller is not available, return Error */ - return A_ERROR; - } - //add_timer(&psCmdTimer); - wait_event_interruptible(HciEvent,(PSAcked == TRUE)); - if(NULL != HciEventpacket) { - *ppEventBuffer = HciEventpacket; - *ppBufferToFree = HciEventpacket; - } else { - /* Did not get an event from controller. return error */ - *ppBufferToFree = NULL; - return A_ERROR; - } - - return A_OK; -} -#endif /* HCI_TRANSPORT_SDIO */ - -A_STATUS ReadPSEvent(A_UCHAR* Data){ - - if(Data[4] == 0xFC && Data[5] == 0x00) - { - switch(Data[3]){ - case 0x0B: - return A_OK; - break; - case 0x0C: - /* Change Baudrate */ - return A_OK; - break; - case 0x04: - return A_OK; - break; - case 0x1E: - Rom_Version = Data[9]; - Rom_Version = ((Rom_Version << 8) |Data[8]); - Rom_Version = ((Rom_Version << 8) |Data[7]); - Rom_Version = ((Rom_Version << 8) |Data[6]); - - Build_Version = Data[13]; - Build_Version = ((Build_Version << 8) |Data[12]); - Build_Version = ((Build_Version << 8) |Data[11]); - Build_Version = ((Build_Version << 8) |Data[10]); - return A_OK; - break; - - - } - } - - return A_ERROR; -} -int str2ba(unsigned char *str_bdaddr,unsigned char *bdaddr) -{ - unsigned char bdbyte[3]; - unsigned char *str_byte = str_bdaddr; - int i,j; - unsigned char colon_present = 0; - - if(NULL != strstr(str_bdaddr,":")) { - colon_present = 1; - } - - - bdbyte[2] = '\0'; - - for( i = 0,j = 5; i < 6; i++, j--) { - bdbyte[0] = str_byte[0]; - bdbyte[1] = str_byte[1]; - bdaddr[j] = A_STRTOL(bdbyte,NULL,16); - if(colon_present == 1) { - str_byte+=3; - } else { - str_byte+=2; - } - } - return 0; -} -A_STATUS set_patch_ram(AR3K_CONFIG_INFO *pConfig,A_UCHAR *patch_loc,A_UINT8 len) -{ - A_UCHAR cmd[] = { 0x0B, 0xFC, 0x07, 0x0D, 0x00, 0x00, 0x00, /* Loc */0x00, 0x00, 0x00, 0x00 }; - A_UCHAR i,j; - unsigned char loc_byte[3]; - A_UINT8 *event; - A_UINT8 *bufferToFree = NULL; - A_STATUS result = A_ERROR; - A_UCHAR *loc_ptr = &cmd[7]; - - if(!patch_loc) - return result; - - loc_byte[2] = '\0'; - - LoadHeader(cmd, 0x0D, 4, 0); - for( i = 0,j = 3; i < 4; i++, j--) { - loc_byte[0] = patch_loc[0]; - loc_byte[1] = patch_loc[1]; - loc_ptr[j] = A_STRTOL(loc_byte,NULL,16); - patch_loc+=2; - } - Hci_log("Patch Ram Write -->",cmd, sizeof(cmd)); - if(A_OK == SendHCICommandWaitCommandComplete(pConfig,cmd, - sizeof(cmd), - &event,&bufferToFree)) { - - result = ReadPSEvent(event); - - } - if(bufferToFree != NULL) { - A_FREE(bufferToFree); - } - return result; - -} -A_STATUS write_bdaddr(AR3K_CONFIG_INFO *pConfig,A_UCHAR *bdaddr,int type) -{ - A_UCHAR bdaddr_cmd[] = { 0x0B, 0xFC, 0x0A, 0x01, 0x01, - 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - - A_UINT8 *event; - A_UINT8 *bufferToFree = NULL; - A_STATUS result = A_ERROR; - int inc,outc; - - if (type == BDADDR_TYPE_STRING) - str2ba(bdaddr,&bdaddr_cmd[7]); - else { - /* Bdaddr has to be sent as LAP first */ - for(inc = 5 ,outc = 7; inc >=0; inc--, outc++) - bdaddr_cmd[outc] = bdaddr[inc]; - } - - Hci_log("BDADDR Write -->",bdaddr_cmd,sizeof(bdaddr_cmd)); - if(A_OK == SendHCICommandWaitCommandComplete(pConfig,bdaddr_cmd, - sizeof(bdaddr_cmd), - &event,&bufferToFree)) { - - if(event[4] == 0xFC && event[5] == 0x00){ - if(event[3] == 0x0B){ - result = A_OK; - } - } - - } - if(bufferToFree != NULL) { - A_FREE(bufferToFree); - } - return result; - -} -A_STATUS ReadVersionInfo(AR3K_CONFIG_INFO *pConfig) -{ - A_UINT8 hciCommand[] = {0x1E,0xfc,0x00}; - A_UINT8 *event; - A_UINT8 *bufferToFree = NULL; - A_STATUS result = A_ERROR; - Hci_log("Read Version -->",hciCommand,sizeof(hciCommand)); - if(A_OK == SendHCICommandWaitCommandComplete(pConfig,hciCommand,sizeof(hciCommand),&event,&bufferToFree)) { - result = ReadPSEvent(event); - - } - if(bufferToFree != NULL) { - A_FREE(bufferToFree); - } - return result; -} -A_STATUS getDeviceType(AR3K_CONFIG_INFO *pConfig, A_UINT32 * code) -{ - A_UINT8 hciCommand[] = {0x05,0xfc,0x05,0x00,0x00,0x00,0x00,0x04}; - A_UINT8 *event; - A_UINT8 *bufferToFree = NULL; - A_UINT32 reg; - A_STATUS result = A_ERROR; - *code = 0; - hciCommand[3] = (A_UINT8)(FPGA_REGISTER & 0xFF); - hciCommand[4] = (A_UINT8)((FPGA_REGISTER >> 8) & 0xFF); - hciCommand[5] = (A_UINT8)((FPGA_REGISTER >> 16) & 0xFF); - hciCommand[6] = (A_UINT8)((FPGA_REGISTER >> 24) & 0xFF); - if(A_OK == SendHCICommandWaitCommandComplete(pConfig,hciCommand,sizeof(hciCommand),&event,&bufferToFree)) { - - if(event[4] == 0xFC && event[5] == 0x00){ - switch(event[3]){ - case 0x05: - reg = event[9]; - reg = ((reg << 8) |event[8]); - reg = ((reg << 8) |event[7]); - reg = ((reg << 8) |event[6]); - *code = reg; - result = A_OK; - - break; - case 0x06: - //Sleep(500); - break; - } - } - - } - if(bufferToFree != NULL) { - A_FREE(bufferToFree); - } - return result; -} - - diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3kps/ar3kpsconfig.h b/drivers/net/wireless/ar6003/host/miscdrv/ar3kps/ar3kpsconfig.h deleted file mode 100644 index 4358834f6d71..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3kps/ar3kpsconfig.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2004-2010 Atheros Communications Inc. - * All rights reserved. - * - * This file defines the symbols exported by Atheros PS and patch download module. - * define the constant HCI_TRANSPORT_SDIO if the module is being used for HCI SDIO transport. - * defined. - * - * - * ar3kcpsconfig.h - * - * - * - * The software source and binaries included in this development package are - * licensed, not sold. You, or your company, received the package under one - * or more license agreements. The rights granted to you are specifically - * listed in these license agreement(s). All other rights remain with Atheros - * Communications, Inc., its subsidiaries, or the respective owner including - * those listed on the included copyright notices.. Distribution of any - * portion of this package must be in strict compliance with the license - * agreement(s) terms. - * - * - * - */ - - - -#ifndef __AR3KPSCONFIG_H -#define __AR3KPSCONFIG_H - -/* - * Define the flag HCI_TRANSPORT_SDIO and undefine HCI_TRANSPORT_UART if the transport being used is SDIO. - */ -#undef HCI_TRANSPORT_UART - -#include -#include -#include -#include -#include - - -#include -#include -#include -#include - - -#include -#include - -#include "ar3kpsparser.h" - -#define FPGA_REGISTER 0x4FFC -#define BDADDR_TYPE_STRING 0 -#define BDADDR_TYPE_HEX 1 -#define CONFIG_PATH "ar3k" - -#define PS_ASIC_FILE "PS_ASIC.pst" -#define PS_FPGA_FILE "PS_FPGA.pst" - -#define PATCH_FILE "RamPatch.txt" -#define BDADDR_FILE "ar3kbdaddr.pst" - -#define ROM_VER_AR3001_3_1_0 30000 -#define ROM_VER_AR3001_3_1_1 30101 - - -#ifndef HCI_TRANSPORT_SDIO -#define AR3K_CONFIG_INFO struct hci_dev -extern wait_queue_head_t HciEvent; -extern wait_queue_t Eventwait; -extern A_UCHAR *HciEventpacket; -#endif /* #ifndef HCI_TRANSPORT_SDIO */ - -A_STATUS AthPSInitialize(AR3K_CONFIG_INFO *hdev); -A_STATUS ReadPSEvent(A_UCHAR* Data); -#endif /* __AR3KPSCONFIG_H */ diff --git a/drivers/net/wireless/ar6003/host/miscdrv/ar3kps/ar3kpsparser.c b/drivers/net/wireless/ar6003/host/miscdrv/ar3kps/ar3kpsparser.c deleted file mode 100644 index d59ba438a428..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/ar3kps/ar3kpsparser.c +++ /dev/null @@ -1,989 +0,0 @@ -/* - * Copyright (c) 2004-2010 Atheros Communications Inc. - * All rights reserved. - * - * This file implements the Atheros PS and patch parser. - * It implements APIs to parse data buffer with patch and PS information and convert it to HCI commands. - * - * - * - * ar3kpsparser.c - * - * - * - * The software source and binaries included in this development package are - * licensed, not sold. You, or your company, received the package under one - * or more license agreements. The rights granted to you are specifically - * listed in these license agreement(s). All other rights remain with Atheros - * Communications, Inc., its subsidiaries, or the respective owner including - * those listed on the included copyright notices.. Distribution of any - * portion of this package must be in strict compliance with the license - * agreement(s) terms. - * - * - * - */ - - -#include "ar3kpsparser.h" - -#define BD_ADDR_SIZE 6 -#define WRITE_PATCH 8 -#define ENABLE_PATCH 11 -#define PS_RESET 2 -#define PS_WRITE 1 -#define PS_VERIFY_CRC 9 -#define CHANGE_BDADDR 15 - -#define HCI_COMMAND_HEADER 7 - -#define HCI_EVENT_SIZE 7 - -#define WRITE_PATCH_COMMAND_STATUS_OFFSET 5 - -#define PS_RAM_SIZE 2048 - -#define RAM_PS_REGION (1<<0) -#define RAM_PATCH_REGION (1<<1) -#define RAMPS_MAX_PS_DATA_PER_TAG 20000 -#define MAX_RADIO_CFG_TABLE_SIZE 244 -#define RAMPS_MAX_PS_TAGS_PER_FILE 50 - -#define PS_MAX_LEN 500 -#define LINE_SIZE_MAX (PS_MAX_LEN *2) - -/* Constant values used by parser */ -#define BYTES_OF_PS_DATA_PER_LINE 16 -#define RAMPS_MAX_PS_DATA_PER_TAG 20000 - - -/* Number pf PS/Patch entries in an HCI packet */ -#define MAX_BYTE_LENGTH 244 - -#define SKIP_BLANKS(str) while (*str == ' ') str++ -#define MIN(x, y) (((x) <= (y))? (x):(y)) -#define MAX(x, y) (((x) >= (y))? (x):(y)) - -#define UNUSED(x) (x=x) - -#define IS_BETWEEN(x, lower, upper) (((lower) <= (x)) && ((x) <= (upper))) -#define IS_DIGIT(c) (IS_BETWEEN((c), '0', '9')) -#define IS_HEX(c) (IS_BETWEEN((c), '0', '9') || IS_BETWEEN((c), 'a', 'f') || IS_BETWEEN((c), 'A', 'F')) -#define TO_LOWER(c) (IS_BETWEEN((c), 'A', 'Z') ? ((c) - 'A' + 'a') : (c)) -#define IS_BLANK(c) ((c) == ' ') -#define CONV_DEC_DIGIT_TO_VALUE(c) ((c) - '0') -#define CONV_HEX_DIGIT_TO_VALUE(c) (IS_DIGIT(c) ? ((c) - '0') : (IS_BETWEEN((c), 'A', 'Z') ? ((c) - 'A' + 10) : ((c) - 'a' + 10))) -#define CONV_VALUE_TO_HEX(v) ((A_UINT8)( ((v & 0x0F) <= 9) ? ((v & 0x0F) + '0') : ((v & 0x0F) - 10 + 'A') ) ) - - -enum MinBootFileFormatE -{ - MB_FILEFORMAT_RADIOTBL, - MB_FILEFORMAT_PATCH, - MB_FILEFORMAT_COEXCONFIG -}; - -enum RamPsSection -{ - RAM_PS_SECTION, - RAM_PATCH_SECTION, - RAM_DYN_MEM_SECTION -}; - -enum eType { - eHex, - edecimal -}; - - -typedef struct tPsTagEntry -{ - A_UINT32 TagId; - A_UINT32 TagLen; - A_UINT8 *TagData; -} tPsTagEntry, *tpPsTagEntry; - -typedef struct tRamPatch -{ - A_UINT16 Len; - A_UINT8 * Data; -} tRamPatch, *ptRamPatch; - - - -typedef struct ST_PS_DATA_FORMAT { - enum eType eDataType; - A_BOOL bIsArray; -}ST_PS_DATA_FORMAT; - -typedef struct ST_READ_STATUS { - unsigned uTagID; - unsigned uSection; - unsigned uLineCount; - unsigned uCharCount; - unsigned uByteCount; -}ST_READ_STATUS; - - -/* Stores the number of PS Tags */ -static A_UINT32 Tag_Count = 0; - -/* Stores the number of patch commands */ -A_UINT32 Patch_Count = 0; -static A_UINT32 Total_tag_lenght = 0; -A_BOOL BDADDR = FALSE; -A_UINT32 StartTagId; - -tPsTagEntry PsTagEntry[RAMPS_MAX_PS_TAGS_PER_FILE]; -tRamPatch RamPatch[MAX_NUM_PATCH_ENTRY]; - - -A_STATUS AthParseFilesUnified(A_UCHAR *srcbuffer,A_UINT32 srclen, int FileFormat); -char AthReadChar(A_UCHAR *buffer, A_UINT32 len,A_UINT32 *pos); -char * AthGetLine(char * buffer, int maxlen, A_UCHAR *srcbuffer,A_UINT32 len,A_UINT32 *pos); -static A_STATUS AthPSCreateHCICommand(A_UCHAR Opcode, A_UINT32 Param1,PSCmdPacket *PSPatchPacket,A_UINT32 *index); - -/* Function to reads the next character from the input buffer */ -char AthReadChar(A_UCHAR *buffer, A_UINT32 len,A_UINT32 *pos) -{ - char Ch; - if(buffer == NULL || *pos >=len ) - { - return '\0'; - } else { - Ch = buffer[*pos]; - (*pos)++; - return Ch; - } -} -/* PS parser helper function */ -unsigned int uGetInputDataFormat(char* pCharLine, ST_PS_DATA_FORMAT *pstFormat) -{ - if(pCharLine[0] != '[') { - pstFormat->eDataType = eHex; - pstFormat->bIsArray = true; - return 0; - } - switch(pCharLine[1]) { - case 'H': - case 'h': - if(pCharLine[2]==':') { - if((pCharLine[3]== 'a') || (pCharLine[3]== 'A')) { - if(pCharLine[4] == ']') { - pstFormat->eDataType = eHex; - pstFormat->bIsArray = true; - pCharLine += 5; - return 0; - } - else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Illegal Data format\n")); //[H:A - return 1; - } - } - if((pCharLine[3]== 'S') || (pCharLine[3]== 's')) { - if(pCharLine[4] == ']') { - pstFormat->eDataType = eHex; - pstFormat->bIsArray = false; - pCharLine += 5; - return 0; - } - else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Illegal Data format\n")); //[H:A - return 1; - } - } - else if(pCharLine[3] == ']') { //[H:] - pstFormat->eDataType = eHex; - pstFormat->bIsArray = true; - pCharLine += 4; - return 0; - } - else { //[H: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Illegal Data format\n")); - return 1; - } - } - else if(pCharLine[2]==']') { //[H] - pstFormat->eDataType = eHex; - pstFormat->bIsArray = true; - pCharLine += 3; - return 0; - } - else { //[H - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Illegal Data format\n")); - return 1; - } - break; - - case 'A': - case 'a': - if(pCharLine[2]==':') { - if((pCharLine[3]== 'h') || (pCharLine[3]== 'H')) { - if(pCharLine[4] == ']') { - pstFormat->eDataType = eHex; - pstFormat->bIsArray = true; - pCharLine += 5; - return 0; - } - else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Illegal Data format 1\n")); //[A:H - return 1; - } - } - else if(pCharLine[3]== ']') { //[A:] - pstFormat->eDataType = eHex; - pstFormat->bIsArray = true; - pCharLine += 4; - return 0; - } - else { //[A: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Illegal Data format 2\n")); - return 1; - } - } - else if(pCharLine[2]==']') { //[H] - pstFormat->eDataType = eHex; - pstFormat->bIsArray = true; - pCharLine += 3; - return 0; - } - else { //[H - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Illegal Data format 3\n")); - return 1; - } - break; - - case 'S': - case 's': - if(pCharLine[2]==':') { - if((pCharLine[3]== 'h') || (pCharLine[3]== 'H')) { - if(pCharLine[4] == ']') { - pstFormat->eDataType = eHex; - pstFormat->bIsArray = true; - pCharLine += 5; - return 0; - } - else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Illegal Data format 5\n")); //[A:H - return 1; - } - } - else if(pCharLine[3]== ']') { //[A:] - pstFormat->eDataType = eHex; - pstFormat->bIsArray = true; - pCharLine += 4; - return 0; - } - else { //[A: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Illegal Data format 6\n")); - return 1; - } - } - else if(pCharLine[2]==']') { //[H] - pstFormat->eDataType = eHex; - pstFormat->bIsArray = true; - pCharLine += 3; - return 0; - } - else { //[H - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Illegal Data format 7\n")); - return 1; - } - break; - - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Illegal Data format 8\n")); - return 1; - } -} - -unsigned int uReadDataInSection(char *pCharLine, ST_PS_DATA_FORMAT stPS_DataFormat) -{ - char *pTokenPtr = pCharLine; - - if(pTokenPtr[0] == '[') { - while(pTokenPtr[0] != ']' && pTokenPtr[0] != '\0') { - pTokenPtr++; - } - if(pTokenPtr[0] == '\0') { - return (0x0FFF); - } - pTokenPtr++; - - - } - if(stPS_DataFormat.eDataType == eHex) { - if(stPS_DataFormat.bIsArray == true) { - //Not implemented - return (0x0FFF); - } - else { - return (A_STRTOL(pTokenPtr, NULL, 16)); - } - } - else { - //Not implemented - return (0x0FFF); - } -} -A_STATUS AthParseFilesUnified(A_UCHAR *srcbuffer,A_UINT32 srclen, int FileFormat) -{ - char *Buffer; - char *pCharLine; - A_UINT8 TagCount; - A_UINT16 ByteCount; - A_UINT8 ParseSection=RAM_PS_SECTION; - A_UINT32 pos; - - - - int uReadCount; - ST_PS_DATA_FORMAT stPS_DataFormat; - ST_READ_STATUS stReadStatus = {0, 0, 0,0}; - pos = 0; - Buffer = NULL; - - if (srcbuffer == NULL || srclen == 0) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Could not open .\n")); - return A_ERROR; - } - TagCount = 0; - ByteCount = 0; - Buffer = A_MALLOC(LINE_SIZE_MAX + 1); - if(NULL == Buffer) { - return A_ERROR; - } - if (FileFormat == MB_FILEFORMAT_PATCH) - { - int LineRead = 0; - while((pCharLine = AthGetLine(Buffer, LINE_SIZE_MAX, srcbuffer,srclen,&pos)) != NULL) - { - - SKIP_BLANKS(pCharLine); - - // Comment line or empty line - if ((pCharLine[0] == '/') && (pCharLine[1] == '/')) - { - continue; - } - - if ((pCharLine[0] == '#')) { - if (stReadStatus.uSection != 0) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("error\n")); - if(Buffer != NULL) { - A_FREE(Buffer); - } - return A_ERROR; - } - else { - stReadStatus.uSection = 1; - continue; - } - } - if ((pCharLine[0] == '/') && (pCharLine[1] == '*')) - { - pCharLine+=2; - SKIP_BLANKS(pCharLine); - - if(!strncmp(pCharLine,"PA",2)||!strncmp(pCharLine,"Pa",2)||!strncmp(pCharLine,"pa",2)) - ParseSection=RAM_PATCH_SECTION; - - if(!strncmp(pCharLine,"DY",2)||!strncmp(pCharLine,"Dy",2)||!strncmp(pCharLine,"dy",2)) - ParseSection=RAM_DYN_MEM_SECTION; - - if(!strncmp(pCharLine,"PS",2)||!strncmp(pCharLine,"Ps",2)||!strncmp(pCharLine,"ps",2)) - ParseSection=RAM_PS_SECTION; - - LineRead = 0; - stReadStatus.uSection = 0; - - continue; - } - - switch(ParseSection) - { - case RAM_PS_SECTION: - { - if (stReadStatus.uSection == 1) //TagID - { - SKIP_BLANKS(pCharLine); - if(uGetInputDataFormat(pCharLine, &stPS_DataFormat)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("uGetInputDataFormat fail\n")); - if(Buffer != NULL) { - A_FREE(Buffer); - } - return A_ERROR; - } - //pCharLine +=5; - PsTagEntry[TagCount].TagId = uReadDataInSection(pCharLine, stPS_DataFormat); - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" TAG ID %d \n",PsTagEntry[TagCount].TagId)); - - //AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("tag # %x\n", PsTagEntry[TagCount].TagId); - if (TagCount == 0) - { - StartTagId = PsTagEntry[TagCount].TagId; - } - stReadStatus.uSection = 2; - } - else if (stReadStatus.uSection == 2) //TagLength - { - - if(uGetInputDataFormat(pCharLine, &stPS_DataFormat)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("uGetInputDataFormat fail \n")); - if(Buffer != NULL) { - A_FREE(Buffer); - } - return A_ERROR; - } - //pCharLine +=5; - ByteCount = uReadDataInSection(pCharLine, stPS_DataFormat); - - //AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("tag length %x\n", ByteCount)); - if (ByteCount > LINE_SIZE_MAX/2) - { - if(Buffer != NULL) { - A_FREE(Buffer); - } - return A_ERROR; - } - PsTagEntry[TagCount].TagLen = ByteCount; - PsTagEntry[TagCount].TagData = (A_UINT8*)A_MALLOC(ByteCount); - stReadStatus.uSection = 3; - stReadStatus.uLineCount = 0; - } - else if( stReadStatus.uSection == 3) { //Data - - if(stReadStatus.uLineCount == 0) { - if(uGetInputDataFormat(pCharLine,&stPS_DataFormat)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("uGetInputDataFormat Fail\n")); - if(Buffer != NULL) { - A_FREE(Buffer); - } - return A_ERROR; - } - //pCharLine +=5; - } - SKIP_BLANKS(pCharLine); - stReadStatus.uCharCount = 0; - if(pCharLine[stReadStatus.uCharCount] == '[') { - while(pCharLine[stReadStatus.uCharCount] != ']' && pCharLine[stReadStatus.uCharCount] != '\0' ) { - stReadStatus.uCharCount++; - } - if(pCharLine[stReadStatus.uCharCount] == ']' ) { - stReadStatus.uCharCount++; - } else { - stReadStatus.uCharCount = 0; - } - } - uReadCount = (ByteCount > BYTES_OF_PS_DATA_PER_LINE)? BYTES_OF_PS_DATA_PER_LINE: ByteCount; - //AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" ")); - if((stPS_DataFormat.eDataType == eHex) && stPS_DataFormat.bIsArray == true) { - while(uReadCount > 0) { - PsTagEntry[TagCount].TagData[stReadStatus.uByteCount] = - (A_UINT8)(CONV_HEX_DIGIT_TO_VALUE(pCharLine[stReadStatus.uCharCount]) << 4) - | (A_UINT8)(CONV_HEX_DIGIT_TO_VALUE(pCharLine[stReadStatus.uCharCount + 1])); - - PsTagEntry[TagCount].TagData[stReadStatus.uByteCount+1] = - (A_UINT8)(CONV_HEX_DIGIT_TO_VALUE(pCharLine[stReadStatus.uCharCount + 3]) << 4) - | (A_UINT8)(CONV_HEX_DIGIT_TO_VALUE(pCharLine[stReadStatus.uCharCount + 4])); - - stReadStatus.uCharCount += 6; // read two bytes, plus a space; - stReadStatus.uByteCount += 2; - uReadCount -= 2; - } - if(ByteCount > BYTES_OF_PS_DATA_PER_LINE) { - ByteCount -= BYTES_OF_PS_DATA_PER_LINE; - } - else { - ByteCount = 0; - } - } - else { - //to be implemented - } - - stReadStatus.uLineCount++; - - if(ByteCount == 0) { - stReadStatus.uSection = 0; - stReadStatus.uCharCount = 0; - stReadStatus.uLineCount = 0; - stReadStatus.uByteCount = 0; - } - else { - stReadStatus.uCharCount = 0; - } - - if((stReadStatus.uSection == 0)&&(++TagCount == RAMPS_MAX_PS_TAGS_PER_FILE)) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("\n Buffer over flow PS File too big!!!")); - if(Buffer != NULL) { - A_FREE(Buffer); - } - return A_ERROR; - //Sleep (3000); - //exit(1); - } - - } - } - - break; - default: - { - if(Buffer != NULL) { - A_FREE(Buffer); - } - return A_ERROR; - } - break; - } - LineRead++; - } - Tag_Count = TagCount; - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Number of Tags %d\n", Tag_Count)); - } - - - if (TagCount > RAMPS_MAX_PS_TAGS_PER_FILE) - { - - if(Buffer != NULL) { - A_FREE(Buffer); - } - return A_ERROR; - } - - if(Buffer != NULL) { - A_FREE(Buffer); - } - return A_OK; - -} - - - -/********************/ - - -A_STATUS GetNextTwoChar(A_UCHAR *srcbuffer,A_UINT32 len, A_UINT32 *pos, char * buffer) -{ - unsigned char ch; - - ch = AthReadChar(srcbuffer,len,pos); - if(ch != '\0' && IS_HEX(ch)) { - buffer[0] = ch; - } else - { - return A_ERROR; - } - ch = AthReadChar(srcbuffer,len,pos); - if(ch != '\0' && IS_HEX(ch)) { - buffer[1] = ch; - } else - { - return A_ERROR; - } - return A_OK; -} -#define PATCH_LOC_KEY "DA:" -#define PATCH_LOC_STRING_LEN 8 -A_STATUS AthDoParsePatch(A_UCHAR *patchbuffer, A_UINT32 patchlen, A_UCHAR *patch_loc) -{ - - char Byte[3]; - char Line[MAX_BYTE_LENGTH + 1]; - int ByteCount,ByteCount_Org; - int count; - int i,j,k; - int data; - A_UINT32 filepos; - Byte[2] = '\0'; - j = 0; - filepos = 0; - Patch_Count = 0; - - if(!patch_loc) - return A_ERROR; - - while(NULL != AthGetLine(Line,MAX_BYTE_LENGTH,patchbuffer,patchlen,&filepos)) { - if(strlen(Line) <= 1) { - continue; - } else if (strstr(Line, PATCH_LOC_KEY) == Line) { - strncpy(patch_loc, &Line[sizeof(PATCH_LOC_KEY) -1],PATCH_LOC_STRING_LEN); - patch_loc[PATCH_LOC_STRING_LEN] = '\0'; - continue; - } else if(IS_HEX(Line[0])){ - break; - } else { - return A_ERROR; - } - } - ByteCount = A_STRTOL(Line, NULL, 16); - ByteCount_Org = ByteCount; - - if(!ByteCount) - return A_ERROR; - - while(ByteCount > MAX_BYTE_LENGTH){ - - /* Handle case when the number of patch buffer is more than the 20K */ - if(MAX_NUM_PATCH_ENTRY == Patch_Count) { - for(i = 0; i < Patch_Count; i++) { - A_FREE(RamPatch[i].Data); - } - return A_ERROR; - } - RamPatch[Patch_Count].Len= MAX_BYTE_LENGTH; - RamPatch[Patch_Count].Data = (A_UINT8*)A_MALLOC(MAX_BYTE_LENGTH); - Patch_Count ++; - - - ByteCount= ByteCount - MAX_BYTE_LENGTH; - } - - RamPatch[Patch_Count].Len= (ByteCount & 0xFF); - if(ByteCount != 0) { - RamPatch[Patch_Count].Data = (A_UINT8*)A_MALLOC(ByteCount); - Patch_Count ++; - } - count = 0; - while(ByteCount_Org > MAX_BYTE_LENGTH){ - for (i = 0,k=0; i < MAX_BYTE_LENGTH*2; i += 2,k++,count +=2) { - if(GetNextTwoChar(patchbuffer,patchlen,&filepos,Byte) == A_ERROR) { - return A_ERROR; - } - data = A_STRTOUL(&Byte[0], NULL, 16); - RamPatch[j].Data[k] = (data & 0xFF); - - - } - j++; - ByteCount_Org = ByteCount_Org - MAX_BYTE_LENGTH; - } - if(j == 0){ - j++; - } - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" Index [%d]\n",j)); - for (k=0; k < ByteCount_Org; i += 2,k++,count+=2) { - if(GetNextTwoChar(patchbuffer,patchlen,&filepos,Byte) == A_ERROR) { - return A_ERROR; - } - data = A_STRTOUL(Byte, NULL, 16); - RamPatch[j].Data[k] = (data & 0xFF); - - - } - return A_OK; -} - - -/********************/ -A_STATUS AthDoParsePS(A_UCHAR *srcbuffer, A_UINT32 srclen) -{ - A_STATUS status; - int i; - A_BOOL BDADDR_Present = A_ERROR; - - Tag_Count = 0; - - Total_tag_lenght = 0; - BDADDR = FALSE; - - - status = A_ERROR; - - if(NULL != srcbuffer && srclen != 0) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("File Open Operation Successful\n")); - - status = AthParseFilesUnified(srcbuffer,srclen,MB_FILEFORMAT_PATCH); - } - - - - if(Tag_Count == 0){ - Total_tag_lenght = 10; - - } - else{ - for(i=0; i 0 && !BDADDR_Present){ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BD ADDR is not present adding 10 extra bytes \r\n")); - Total_tag_lenght=Total_tag_lenght + 10; - } - Total_tag_lenght = Total_tag_lenght+ 10 + (Tag_Count*4); - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("** Total Length %d\n",Total_tag_lenght)); - - - return status; -} -char * AthGetLine(char * buffer, int maxlen, A_UCHAR *srcbuffer,A_UINT32 len,A_UINT32 *pos) -{ - - int count; - static short flag; - char CharRead; - count = 0; - flag = A_ERROR; - - do - { - CharRead = AthReadChar(srcbuffer,len,pos); - if( CharRead == '\0' ) { - buffer[count+1] = '\0'; - if(count == 0) { - return NULL; - } - else { - return buffer; - } - } - - if(CharRead == 13) { - } else if(CharRead == 10) { - buffer[count] ='\0'; - flag = A_ERROR; - return buffer; - }else { - buffer[count++] = CharRead; - } - - } - while(count < maxlen-1 && CharRead != '\0'); - buffer[count] = '\0'; - - return buffer; -} - -void LoadHeader(A_UCHAR *HCI_PS_Command,A_UCHAR opcode,int length,int index){ - - HCI_PS_Command[0]= 0x0B; - HCI_PS_Command[1]= 0xFC; - HCI_PS_Command[2]= length + 4; - HCI_PS_Command[3]= opcode; - HCI_PS_Command[4]= (index & 0xFF); - HCI_PS_Command[5]= ((index>>8) & 0xFF); - HCI_PS_Command[6]= length; -} - -///////////////////////// -// -int AthCreateCommandList(PSCmdPacket **HciPacketList, A_UINT32 *numPackets) -{ - - A_UINT8 count; - A_UINT32 NumcmdEntry = 0; - - A_UINT32 Crc = 0; - *numPackets = 0; - - - if(Patch_Count > 0) - Crc |= RAM_PATCH_REGION; - if(Tag_Count > 0) - Crc |= RAM_PS_REGION; - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("PS Thread Started CRC %x Patch Count %d Tag Count %d \n",Crc,Patch_Count,Tag_Count)); - - if(Patch_Count || Tag_Count ){ - NumcmdEntry+=(2 + Patch_Count + Tag_Count); /* CRC Packet + PS Reset Packet + Patch List + PS List*/ - if(Patch_Count > 0) { - NumcmdEntry++; /* Patch Enable Command */ - } - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Num Cmd Entries %d Size %d \r\n",NumcmdEntry,(A_UINT32)sizeof(PSCmdPacket) * NumcmdEntry)); - (*HciPacketList) = A_MALLOC(sizeof(PSCmdPacket) * NumcmdEntry); - if(NULL == *HciPacketList) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("memory allocation failed \r\n")); - } - AthPSCreateHCICommand(PS_VERIFY_CRC,Crc,*HciPacketList,numPackets); - if(Patch_Count > 0){ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("*** Write Patch**** \r\n")); - AthPSCreateHCICommand(WRITE_PATCH,Patch_Count,*HciPacketList,numPackets); - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("*** Enable Patch**** \r\n")); - AthPSCreateHCICommand(ENABLE_PATCH,0,*HciPacketList,numPackets); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("*** PS Reset**** %d[0x%x] \r\n",PS_RAM_SIZE,PS_RAM_SIZE)); - AthPSCreateHCICommand(PS_RESET,PS_RAM_SIZE,*HciPacketList,numPackets); - if(Tag_Count > 0){ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("*** PS Write**** \r\n")); - AthPSCreateHCICommand(PS_WRITE,Tag_Count,*HciPacketList,numPackets); - } - } - if(!BDADDR){ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BD ADDR not present \r\n")); - - } - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("PS Count %d Patch Count %d",Tag_Count, Patch_Count)); - for(count = 0; count < Patch_Count; count++) { - - A_FREE(RamPatch[Patch_Count].Data); - } - - for(count = 0; count < Tag_Count; count++) { - - A_FREE(PsTagEntry[count].TagData); - } - -/* - * SDIO Transport uses synchronous mode of data transfer - * So, AthPSOperations() call returns only after receiving the - * command complete event. - */ - return *numPackets; -} - - -//////////////////////// - -///////////// -static A_STATUS AthPSCreateHCICommand(A_UCHAR Opcode, A_UINT32 Param1,PSCmdPacket *PSPatchPacket,A_UINT32 *index) -{ - A_UCHAR *HCI_PS_Command; - A_UINT32 Length; - int i,j; - - switch(Opcode) - { - case WRITE_PATCH: - - - for(i=0;i< Param1;i++){ - - HCI_PS_Command = (A_UCHAR *) A_MALLOC(RamPatch[i].Len+HCI_COMMAND_HEADER); - if(HCI_PS_Command == NULL){ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("MALLOC Failed\r\n")); - return A_ERROR; - } - memset (HCI_PS_Command, 0, RamPatch[i].Len+HCI_COMMAND_HEADER); - LoadHeader(HCI_PS_Command,Opcode,RamPatch[i].Len,i); - for(j=0;j> 8) & 0xFF); - PSPatchPacket[*index].Hcipacket = HCI_PS_Command; - PSPatchPacket[*index].packetLen = Length+HCI_COMMAND_HEADER; - (*index)++; - - break; - - case PS_WRITE: - for(i=0;i< Param1;i++){ - if(PsTagEntry[i].TagId ==1) - BDADDR = TRUE; - - HCI_PS_Command = (A_UCHAR *) A_MALLOC(PsTagEntry[i].TagLen+HCI_COMMAND_HEADER); - if(HCI_PS_Command == NULL){ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("MALLOC Failed\r\n")); - return A_ERROR; - } - - memset (HCI_PS_Command, 0, PsTagEntry[i].TagLen+HCI_COMMAND_HEADER); - LoadHeader(HCI_PS_Command,Opcode,PsTagEntry[i].TagLen,PsTagEntry[i].TagId); - - for(j=0;j -#include -#include "athdefs.h" -#ifdef HCI_TRANSPORT_SDIO -#include "a_config.h" -#include "a_types.h" -#include "a_osapi.h" -#define ATH_MODULE_NAME misc -#include "a_debug.h" -#include "common_drv.h" -#include "hci_transport_api.h" -#include "ar3kconfig.h" -#else -#ifndef A_PRINTF -#define A_PRINTF(args...) printk(KERN_ALERT args) -#endif /* A_PRINTF */ -#include "debug_linux.h" - -/* Helper data type declaration */ - -#ifndef A_UINT32 -#define A_UCHAR unsigned char -#define A_UINT32 unsigned long -#define A_UINT16 unsigned short -#define A_UINT8 unsigned char -#define A_BOOL unsigned char -#endif /* A_UINT32 */ - -#define ATH_DEBUG_ERR (1 << 0) -#define ATH_DEBUG_WARN (1 << 1) -#define ATH_DEBUG_INFO (1 << 2) - - - -#define FALSE 0 -#define TRUE 1 - -#ifndef A_MALLOC -#define A_MALLOC(size) kmalloc((size),GFP_KERNEL) -#endif /* A_MALLOC */ - - -#ifndef A_FREE -#define A_FREE(addr) kfree((addr)) -#endif /* A_MALLOC */ -#endif /* HCI_TRANSPORT_UART */ - -/* String manipulation APIs */ -#ifndef A_STRTOUL -#define A_STRTOUL simple_strtoul -#endif /* A_STRTOL */ - -#ifndef A_STRTOL -#define A_STRTOL simple_strtol -#endif /* A_STRTOL */ - - -/* The maximum number of bytes possible in a patch entry */ -#define MAX_PATCH_SIZE 30000 - -/* Maximum HCI packets that will be formed from the Patch file */ -#define MAX_NUM_PATCH_ENTRY (MAX_PATCH_SIZE/MAX_BYTE_LENGTH) + 1 - - - - - - - -typedef struct PSCmdPacket -{ - A_UCHAR *Hcipacket; - int packetLen; -} PSCmdPacket; - -/* Parses a Patch information buffer and store it in global structure */ -A_STATUS AthDoParsePatch(A_UCHAR *, A_UINT32, A_UCHAR*); - -/* parses a PS information buffer and stores it in a global structure */ -A_STATUS AthDoParsePS(A_UCHAR *, A_UINT32); - -/* - * Uses the output of Both AthDoParsePS and AthDoParsePatch APIs to form HCI command array with - * all the PS and patch commands. - * The list will have the below mentioned commands in order. - * CRC command packet - * Download patch command(s) - * Enable patch Command - * PS Reset Command - * PS Tag Command(s) - * - */ -int AthCreateCommandList(PSCmdPacket **, A_UINT32 *); - -/* Cleanup the dynamically allicated HCI command list */ -A_STATUS AthFreeCommandList(PSCmdPacket **HciPacketList, A_UINT32 numPackets); -#endif /* __AR3KPSPARSER_H */ diff --git a/drivers/net/wireless/ar6003/host/miscdrv/common_drv.c b/drivers/net/wireless/ar6003/host/miscdrv/common_drv.c deleted file mode 100644 index d3039178a177..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/common_drv.c +++ /dev/null @@ -1,882 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" - -#include "a_osapi.h" -#include "targaddrs.h" -#include "hif.h" -#include "htc_api.h" -#include "wmi.h" -#include "bmi.h" -#include "bmi_msg.h" -#include "common_drv.h" -#define ATH_MODULE_NAME misc -#include "a_debug.h" -#include "ar6000_diag.h" -#include "target_reg_table.h" -#include "host_reg_table.h" - -static ATH_DEBUG_MODULE_DBG_INFO *g_pModuleInfoHead = NULL; -static A_MUTEX_T g_ModuleListLock; -static A_BOOL g_ModuleDebugInit = FALSE; - -#ifdef DEBUG - -ATH_DEBUG_INSTANTIATE_MODULE_VAR(misc, - "misc", - "Common and misc APIs", - ATH_DEBUG_MASK_DEFAULTS, - 0, - NULL); - -#endif - -#define AR6001_LOCAL_COUNT_ADDRESS 0x0c014080 -#define AR6002_LOCAL_COUNT_ADDRESS 0x00018080 -#define AR6003_LOCAL_COUNT_ADDRESS 0x00018080 - -static A_UINT8 custDataAR6002[AR6002_CUST_DATA_SIZE]; -static A_UINT8 custDataAR6003[AR6003_CUST_DATA_SIZE]; -static A_UINT8 custDataMCKINLEY[MCKINLEY_CUST_DATA_SIZE]; - - -/* - * Read from the AR6000 through its diagnostic window. - * No cooperation from the Target is required for this. - */ -A_STATUS -ar6000_ReadRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data) -{ - return HIFDiagReadAccess(hifDevice, *address, data); -} - - -/* - * Write to the AR6000 through its diagnostic window. - * No cooperation from the Target is required for this. - */ -A_STATUS -ar6000_WriteRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data) -{ - return HIFDiagWriteAccess(hifDevice, *address, *data); -} - -A_STATUS -ar6000_ReadDataDiag(HIF_DEVICE *hifDevice, A_UINT32 address, - A_UCHAR *data, A_UINT32 length) -{ - A_UINT32 count; - A_STATUS status = A_OK; - - for (count = 0; count < length; count += 4, address += 4) { - if ((status = HIFDiagReadAccess(hifDevice, address, - (A_UINT32 *)&data[count])) != A_OK) - { - break; - } - } - - return status; -} - -A_STATUS -ar6000_WriteDataDiag(HIF_DEVICE *hifDevice, A_UINT32 address, - A_UCHAR *data, A_UINT32 length) -{ - A_UINT32 count; - A_STATUS status = A_OK; - - for (count = 0; count < length; count += 4, address += 4) { - if ((status = HIFDiagWriteAccess(hifDevice, address, - *((A_UINT32 *)&data[count]))) != A_OK) - { - break; - } - } - - return status; -} - -#ifdef HIF_MESSAGE_BASED - -/* TODO : for message based interfaces there are no HOST registers. These are just - * stub functions for now */ - -A_STATUS -ar6k_ReadTargetRegister(HIF_DEVICE *hifDevice, int regsel, A_UINT32 *regval) -{ - - /* TODO */ - return A_ERROR; -} - -void -ar6k_FetchTargetRegs(HIF_DEVICE *hifDevice, A_UINT32 *targregs) -{ - int i; - for (i=0; i REGISTER_DUMP_LEN_MAX -#error "REG_DUMP_COUNT_AR6001 too large" -#endif -#if REG_DUMP_COUNT_AR6002 > REGISTER_DUMP_LEN_MAX -#error "REG_DUMP_COUNT_AR6002 too large" -#endif -#if REG_DUMP_COUNT_AR6003 > REGISTER_DUMP_LEN_MAX -#error "REG_DUMP_COUNT_AR6003 too large" -#endif -#if REG_DUMP_COUNT_MCKINLEY > REGISTER_DUMP_LEN_MAX -#error "REG_DUMP_COUNT_MCKINLEY too large" -#endif - - -void ar6000_dump_target_assert_info(HIF_DEVICE *hifDevice, A_UINT32 TargetType) -{ - A_UINT32 address; - A_UINT32 regDumpArea = 0; - A_STATUS status; - A_UINT32 regDumpValues[REGISTER_DUMP_LEN_MAX]; - A_UINT32 regDumpCount = 0; - A_UINT32 i; - - do { - - /* the reg dump pointer is copied to the host interest area */ - address = HOST_INTEREST_ITEM_ADDRESS(TargetType, hi_failure_state); - address = TARG_VTOP(TargetType, address); - - if (TargetType == TARGET_TYPE_AR6002) { - regDumpCount = REG_DUMP_COUNT_AR6002; - } else if (TargetType == TARGET_TYPE_AR6003) { - regDumpCount = REG_DUMP_COUNT_AR6003; - } else if (TargetType == TARGET_TYPE_MCKINLEY) { - regDumpCount = REG_DUMP_COUNT_MCKINLEY; - } else { - A_ASSERT(0); - } - - /* read RAM location through diagnostic window */ - status = ar6000_ReadRegDiag(hifDevice, &address, ®DumpArea); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR6K: Failed to get ptr to register dump area \n")); - break; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR6K: Location of register dump data: 0x%X \n",regDumpArea)); - - if (regDumpArea == 0) { - /* no reg dump */ - break; - } - - regDumpArea = TARG_VTOP(TargetType, regDumpArea); - - /* fetch register dump data */ - status = ar6000_ReadDataDiag(hifDevice, - regDumpArea, - (A_UCHAR *)®DumpValues[0], - regDumpCount * (sizeof(A_UINT32))); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR6K: Failed to get register dump \n")); - break; - } - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR6K: Register Dump: \n")); - - for (i = 0; i < regDumpCount; i++) - { - AR_DEBUG_PRINTF (ATH_DEBUG_ERR,(" %d : 0x%8.8X \n",i, regDumpValues[i])); -#ifdef UNDER_CE - /* - * For Every logPrintf() Open the File so that in case of Crashes - * We will have until the Last Message Flushed on to the File - * So use logPrintf Sparingly..!! - */ - tgtassertPrintf (ATH_DEBUG_TRC," %d: 0x%8.8X \n",i, regDumpValues[i]); -#endif - } - - } while (FALSE); - -} - -/* set HTC/Mbox operational parameters, this can only be called when the target is in the - * BMI phase */ -A_STATUS ar6000_set_htc_params(HIF_DEVICE *hifDevice, - A_UINT32 TargetType, - A_UINT32 MboxIsrYieldValue, - A_UINT8 HtcControlBuffers) -{ - A_STATUS status; - A_UINT32 blocksizes[HTC_MAILBOX_NUM_MAX]; - - do { - /* get the block sizes */ - status = HIFConfigureDevice(hifDevice, HIF_DEVICE_GET_MBOX_BLOCK_SIZE, - blocksizes, sizeof(blocksizes)); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_LOG_ERR,("Failed to get block size info from HIF layer...\n")); - break; - } - /* note: we actually get the block size for mailbox 1, for SDIO the block - * size on mailbox 0 is artificially set to 1 */ - /* must be a power of 2 */ - A_ASSERT((blocksizes[1] & (blocksizes[1] - 1)) == 0); - - if (HtcControlBuffers != 0) { - /* set override for number of control buffers to use */ - blocksizes[1] |= ((A_UINT32)HtcControlBuffers) << 16; - } - - /* set the host interest area for the block size */ - status = BMIWriteMemory(hifDevice, - HOST_INTEREST_ITEM_ADDRESS(TargetType, hi_mbox_io_block_sz), - (A_UCHAR *)&blocksizes[1], - 4); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_LOG_ERR,("BMIWriteMemory for IO block size failed \n")); - break; - } - - AR_DEBUG_PRINTF(ATH_LOG_INF,("Block Size Set: %d (target address:0x%X)\n", - blocksizes[1], HOST_INTEREST_ITEM_ADDRESS(TargetType, hi_mbox_io_block_sz))); - - if (MboxIsrYieldValue != 0) { - /* set the host interest area for the mbox ISR yield limit */ - status = BMIWriteMemory(hifDevice, - HOST_INTEREST_ITEM_ADDRESS(TargetType, hi_mbox_isr_yield_limit), - (A_UCHAR *)&MboxIsrYieldValue, - 4); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_LOG_ERR,("BMIWriteMemory for yield limit failed \n")); - break; - } - } - - } while (FALSE); - - return status; -} - - -static A_STATUS prepare_ar6002(HIF_DEVICE *hifDevice, A_UINT32 TargetVersion) -{ - A_STATUS status = A_OK; - - /* placeholder */ - - return status; -} - -static A_STATUS prepare_ar6003(HIF_DEVICE *hifDevice, A_UINT32 TargetVersion) -{ - A_STATUS status = A_OK; - - /* placeholder */ - - return status; -} - -static A_STATUS prepare_MCKINLEY(HIF_DEVICE *hifDevice, A_UINT32 TargetVersion) -{ - A_STATUS status = A_OK; - A_UINT32 value = 0; - - /* force the setting to disable sleep for Bringup FIXME_MK */ - value |= WLAN_SYSTEM_SLEEP_DISABLE_MASK; - - status = BMIWriteMemory(hifDevice, - HOST_INTEREST_ITEM_ADDRESS(TARGET_TYPE_AR6002, hi_system_sleep_setting), - (A_UCHAR *)&value, - 4); - - return status; -} - -/* this function assumes the caller has already initialized the BMI APIs */ -A_STATUS ar6000_prepare_target(HIF_DEVICE *hifDevice, - A_UINT32 TargetType, - A_UINT32 TargetVersion) -{ - if (TargetType == TARGET_TYPE_AR6002) { - /* do any preparations for AR6002 devices */ - return prepare_ar6002(hifDevice,TargetVersion); - } else if (TargetType == TARGET_TYPE_AR6003) { - return prepare_ar6003(hifDevice,TargetVersion); - } else if (TargetType == TARGET_TYPE_MCKINLEY) { - return prepare_MCKINLEY(hifDevice,TargetVersion); - } - - return A_OK; -} - -#if defined(CONFIG_AR6002_REV1_FORCE_HOST) -/* - * Call this function just before the call to BMIInit - * in order to force* AR6002 rev 1.x firmware to detect a Host. - * THIS IS FOR USE ONLY WITH AR6002 REV 1.x. - * TBDXXX: Remove this function when REV 1.x is desupported. - */ -A_STATUS -ar6002_REV1_reset_force_host (HIF_DEVICE *hifDevice) -{ - A_INT32 i; - struct forceROM_s { - A_UINT32 addr; - A_UINT32 data; - }; - struct forceROM_s *ForceROM; - A_INT32 szForceROM; - A_STATUS status = A_OK; - A_UINT32 address; - A_UINT32 data; - - /* Force AR6002 REV1.x to recognize Host presence. - * - * Note: Use RAM at 0x52df80..0x52dfa0 with ROM Remap entry 0 - * so that this workaround functions with AR6002.war1.sh. We - * could fold that entire workaround into this one, but it's not - * worth the effort at this point. This workaround cannot be - * merged into the other workaround because this must be done - * before BMI. - */ - - static struct forceROM_s ForceROM_NEW[] = { - {0x52df80, 0x20f31c07}, - {0x52df84, 0x92374420}, - {0x52df88, 0x1d120c03}, - {0x52df8c, 0xff8216f0}, - {0x52df90, 0xf01d120c}, - {0x52df94, 0x81004136}, - {0x52df98, 0xbc9100bd}, - {0x52df9c, 0x00bba100}, - - {0x00008000|MC_TCAM_TARGET_ADDRESS, 0x0012dfe0}, /* Use remap entry 0 */ - {0x00008000|MC_TCAM_COMPARE_ADDRESS, 0x000e2380}, - {0x00008000|MC_TCAM_MASK_ADDRESS, 0x00000000}, - {0x00008000|MC_TCAM_VALID_ADDRESS, 0x00000001}, - - {0x00018000|(LOCAL_COUNT_ADDRESS+0x10), 0}, /* clear BMI credit counter */ - - {0x00004000|AR6002_RESET_CONTROL_ADDRESS, RESET_CONTROL_WARM_RST_MASK}, - }; - - address = 0x004ed4b0; /* REV1 target software ID is stored here */ - status = ar6000_ReadRegDiag(hifDevice, &address, &data); - if (A_FAILED(status) || (data != AR6002_VERSION_REV1)) { - return A_ERROR; /* Not AR6002 REV1 */ - } - - ForceROM = ForceROM_NEW; - szForceROM = sizeof(ForceROM_NEW)/sizeof(*ForceROM); - - ATH_DEBUG_PRINTF (DBG_MISC_DRV, ATH_DEBUG_TRC, ("Force Target to recognize Host....\n")); - for (i = 0; i < szForceROM; i++) - { - if (ar6000_WriteRegDiag(hifDevice, - &ForceROM[i].addr, - &ForceROM[i].data) != A_OK) - { - ATH_DEBUG_PRINTF (DBG_MISC_DRV, ATH_DEBUG_TRC, ("Cannot force Target to recognize Host!\n")); - return A_ERROR; - } - } - - A_MDELAY(1000); - - return A_OK; -} - -#endif /* CONFIG_AR6002_REV1_FORCE_HOST */ - -void DebugDumpBytes(A_UCHAR *buffer, A_UINT16 length, char *pDescription) -{ - A_CHAR stream[60]; - A_CHAR byteOffsetStr[10]; - A_UINT32 i; - A_UINT16 offset, count, byteOffset; - - A_PRINTF("<---------Dumping %d Bytes : %s ------>\n", length, pDescription); - - count = 0; - offset = 0; - byteOffset = 0; - for(i = 0; i < length; i++) { - A_SPRINTF(stream + offset, "%2.2X ", buffer[i]); - count ++; - offset += 3; - - if(count == 16) { - count = 0; - offset = 0; - A_SPRINTF(byteOffsetStr,"%4.4X",byteOffset); - A_PRINTF("[%s]: %s\n", byteOffsetStr, stream); - A_MEMZERO(stream, 60); - byteOffset += 16; - } - } - - if(offset != 0) { - A_SPRINTF(byteOffsetStr,"%4.4X",byteOffset); - A_PRINTF("[%s]: %s\n", byteOffsetStr, stream); - } - - A_PRINTF("<------------------------------------------------->\n"); -} - -void a_dump_module_debug_info(ATH_DEBUG_MODULE_DBG_INFO *pInfo) -{ - int i; - ATH_DEBUG_MASK_DESCRIPTION *pDesc; - - if (pInfo == NULL) { - return; - } - - pDesc = pInfo->pMaskDescriptions; - - A_PRINTF("========================================================\n\n"); - A_PRINTF("Module Debug Info => Name : %s \n", pInfo->ModuleName); - A_PRINTF(" => Descr. : %s \n", pInfo->ModuleDescription); - A_PRINTF("\n Current mask => 0x%8.8X \n", pInfo->CurrentMask); - A_PRINTF("\n Avail. Debug Masks :\n\n"); - - for (i = 0; i < pInfo->MaxDescriptions; i++,pDesc++) { - A_PRINTF(" => 0x%8.8X -- %s \n", pDesc->Mask, pDesc->Description); - } - - if (0 == i) { - A_PRINTF(" => * none defined * \n"); - } - - A_PRINTF("\n Standard Debug Masks :\n\n"); - /* print standard masks */ - A_PRINTF(" => 0x%8.8X -- Errors \n", ATH_DEBUG_ERR); - A_PRINTF(" => 0x%8.8X -- Warnings \n", ATH_DEBUG_WARN); - A_PRINTF(" => 0x%8.8X -- Informational \n", ATH_DEBUG_INFO); - A_PRINTF(" => 0x%8.8X -- Tracing \n", ATH_DEBUG_TRC); - A_PRINTF("\n========================================================\n"); - -} - - -static ATH_DEBUG_MODULE_DBG_INFO *FindModule(A_CHAR *module_name) -{ - ATH_DEBUG_MODULE_DBG_INFO *pInfo = g_pModuleInfoHead; - - if (!g_ModuleDebugInit) { - return NULL; - } - - while (pInfo != NULL) { - /* TODO: need to use something other than strlen */ - if (A_MEMCMP(pInfo->ModuleName,module_name,strlen(module_name)) == 0) { - break; - } - pInfo = pInfo->pNext; - } - - return pInfo; -} - - -void a_register_module_debug_info(ATH_DEBUG_MODULE_DBG_INFO *pInfo) -{ - if (!g_ModuleDebugInit) { - return; - } - - A_MUTEX_LOCK(&g_ModuleListLock); - - if (!(pInfo->Flags & ATH_DEBUG_INFO_FLAGS_REGISTERED)) { - if (g_pModuleInfoHead == NULL) { - g_pModuleInfoHead = pInfo; - } else { - pInfo->pNext = g_pModuleInfoHead; - g_pModuleInfoHead = pInfo; - } - pInfo->Flags |= ATH_DEBUG_INFO_FLAGS_REGISTERED; - } - - A_MUTEX_UNLOCK(&g_ModuleListLock); -} - -void a_dump_module_debug_info_by_name(A_CHAR *module_name) -{ - ATH_DEBUG_MODULE_DBG_INFO *pInfo = g_pModuleInfoHead; - - if (!g_ModuleDebugInit) { - return; - } - - if (A_MEMCMP(module_name,"all",3) == 0) { - /* dump all */ - while (pInfo != NULL) { - a_dump_module_debug_info(pInfo); - pInfo = pInfo->pNext; - } - return; - } - - pInfo = FindModule(module_name); - - if (pInfo != NULL) { - a_dump_module_debug_info(pInfo); - } - -} - -A_STATUS a_get_module_mask(A_CHAR *module_name, A_UINT32 *pMask) -{ - ATH_DEBUG_MODULE_DBG_INFO *pInfo = FindModule(module_name); - - if (NULL == pInfo) { - return A_ERROR; - } - - *pMask = pInfo->CurrentMask; - return A_OK; -} - -A_STATUS a_set_module_mask(A_CHAR *module_name, A_UINT32 Mask) -{ - ATH_DEBUG_MODULE_DBG_INFO *pInfo = FindModule(module_name); - - if (NULL == pInfo) { - return A_ERROR; - } - - pInfo->CurrentMask = Mask; - A_PRINTF("Module %s, new mask: 0x%8.8X \n",module_name,pInfo->CurrentMask); - return A_OK; -} - - -void a_module_debug_support_init(void) -{ - if (g_ModuleDebugInit) { - return; - } - A_MUTEX_INIT(&g_ModuleListLock); - g_pModuleInfoHead = NULL; - g_ModuleDebugInit = TRUE; - A_REGISTER_MODULE_DEBUG_INFO(misc); -} - -void a_module_debug_support_cleanup(void) -{ - ATH_DEBUG_MODULE_DBG_INFO *pInfo = g_pModuleInfoHead; - ATH_DEBUG_MODULE_DBG_INFO *pCur; - - if (!g_ModuleDebugInit) { - return; - } - - g_ModuleDebugInit = FALSE; - - A_MUTEX_LOCK(&g_ModuleListLock); - - while (pInfo != NULL) { - pCur = pInfo; - pInfo = pInfo->pNext; - pCur->pNext = NULL; - /* clear registered flag */ - pCur->Flags &= ~ATH_DEBUG_INFO_FLAGS_REGISTERED; - } - - A_MUTEX_UNLOCK(&g_ModuleListLock); - - A_MUTEX_DELETE(&g_ModuleListLock); - g_pModuleInfoHead = NULL; -} - - /* can only be called during bmi init stage */ -A_STATUS ar6000_set_hci_bridge_flags(HIF_DEVICE *hifDevice, - A_UINT32 TargetType, - A_UINT32 Flags) -{ - A_STATUS status = A_OK; - - do { - - if ((TargetType != TARGET_TYPE_AR6003) && (TargetType != TARGET_TYPE_MCKINLEY)) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, ("Target Type:%d, does not support HCI bridging! \n", - TargetType)); - break; - } - - /* set hci bridge flags */ - status = BMIWriteMemory(hifDevice, - HOST_INTEREST_ITEM_ADDRESS(TargetType, hi_hci_bridge_flags), - (A_UCHAR *)&Flags, - 4); - - - } while (FALSE); - - return status; -} - diff --git a/drivers/net/wireless/ar6003/host/miscdrv/credit_dist.c b/drivers/net/wireless/ar6003/host/miscdrv/credit_dist.c deleted file mode 100644 index f2f76d31d5fd..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/credit_dist.c +++ /dev/null @@ -1,417 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" -#include "a_osapi.h" -#define ATH_MODULE_NAME misc -#include "a_debug.h" -#include "htc_api.h" -#include "common_drv.h" - -/********* CREDIT DISTRIBUTION FUNCTIONS ******************************************/ - -#define NO_VO_SERVICE 1 /* currently WMI only uses 3 data streams, so we leave VO service inactive */ -#define CONFIG_GIVE_LOW_PRIORITY_STREAMS_MIN_CREDITS 1 - -#ifdef NO_VO_SERVICE -#define DATA_SVCS_USED 3 -#else -#define DATA_SVCS_USED 4 -#endif - -static void RedistributeCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, - HTC_ENDPOINT_CREDIT_DIST *pEPDistList); - -static void SeekCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, - HTC_ENDPOINT_CREDIT_DIST *pEPDistList); - -/* reduce an ep's credits back to a set limit */ -static INLINE void ReduceCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, - HTC_ENDPOINT_CREDIT_DIST *pEpDist, - int Limit) -{ - int credits; - - /* set the new limit */ - pEpDist->TxCreditsAssigned = Limit; - - if (pEpDist->TxCredits <= Limit) { - return; - } - - /* figure out how much to take away */ - credits = pEpDist->TxCredits - Limit; - /* take them away */ - pEpDist->TxCredits -= credits; - pCredInfo->CurrentFreeCredits += credits; -} - -/* give an endpoint some credits from the free credit pool */ -#define GiveCredits(pCredInfo,pEpDist,credits) \ -{ \ - (pEpDist)->TxCredits += (credits); \ - (pEpDist)->TxCreditsAssigned += (credits); \ - (pCredInfo)->CurrentFreeCredits -= (credits); \ -} - - -/* default credit init callback. - * This function is called in the context of HTCStart() to setup initial (application-specific) - * credit distributions */ -static void ar6000_credit_init(void *Context, - HTC_ENDPOINT_CREDIT_DIST *pEPList, - int TotalCredits) -{ - HTC_ENDPOINT_CREDIT_DIST *pCurEpDist; - int count; - COMMON_CREDIT_STATE_INFO *pCredInfo = (COMMON_CREDIT_STATE_INFO *)Context; - - pCredInfo->CurrentFreeCredits = TotalCredits; - pCredInfo->TotalAvailableCredits = TotalCredits; - - pCurEpDist = pEPList; - - /* run through the list and initialize */ - while (pCurEpDist != NULL) { - - /* set minimums for each endpoint */ - pCurEpDist->TxCreditsMin = pCurEpDist->TxCreditsPerMaxMsg; - -#ifdef CONFIG_GIVE_LOW_PRIORITY_STREAMS_MIN_CREDITS - if (TotalCredits > 4) - { - if ((pCurEpDist->ServiceID == WMI_DATA_BK_SVC) || (pCurEpDist->ServiceID == WMI_DATA_BE_SVC)){ - /* assign at least min credits to lower than VO priority services */ - GiveCredits(pCredInfo,pCurEpDist,pCurEpDist->TxCreditsMin); - /* force active */ - SET_EP_ACTIVE(pCurEpDist); - } - } - -#endif - - if (pCurEpDist->ServiceID == WMI_CONTROL_SVC) { - /* give control service some credits */ - GiveCredits(pCredInfo,pCurEpDist,pCurEpDist->TxCreditsMin); - /* control service is always marked active, it never goes inactive EVER */ - SET_EP_ACTIVE(pCurEpDist); - } else if (pCurEpDist->ServiceID == WMI_DATA_BK_SVC) { - /* this is the lowest priority data endpoint, save this off for easy access */ - pCredInfo->pLowestPriEpDist = pCurEpDist; - } - - /* Streams have to be created (explicit | implicit)for all kinds - * of traffic. BE endpoints are also inactive in the beginning. - * When BE traffic starts it creates implicit streams that - * redistributes credits. - */ - - /* note, all other endpoints have minimums set but are initially given NO credits. - * Credits will be distributed as traffic activity demands */ - pCurEpDist = pCurEpDist->pNext; - } - - if (pCredInfo->CurrentFreeCredits <= 0) { - AR_DEBUG_PRINTF(ATH_LOG_INF, ("Not enough credits (%d) to do credit distributions \n", TotalCredits)); - A_ASSERT(FALSE); - return; - } - - /* reset list */ - pCurEpDist = pEPList; - /* now run through the list and set max operating credit limits for everyone */ - while (pCurEpDist != NULL) { - if (pCurEpDist->ServiceID == WMI_CONTROL_SVC) { - /* control service max is just 1 max message */ - pCurEpDist->TxCreditsNorm = pCurEpDist->TxCreditsPerMaxMsg; - } else { - /* for the remaining data endpoints, we assume that each TxCreditsPerMaxMsg are - * the same. - * We use a simple calculation here, we take the remaining credits and - * determine how many max messages this can cover and then set each endpoint's - * normal value equal to 3/4 this amount. - * */ - count = (pCredInfo->CurrentFreeCredits/pCurEpDist->TxCreditsPerMaxMsg) * pCurEpDist->TxCreditsPerMaxMsg; - count = (count * 3) >> 2; - count = max(count,pCurEpDist->TxCreditsPerMaxMsg); - /* set normal */ - pCurEpDist->TxCreditsNorm = count; - - } - pCurEpDist = pCurEpDist->pNext; - } - -} - - -/* default credit distribution callback - * This callback is invoked whenever endpoints require credit distributions. - * A lock is held while this function is invoked, this function shall NOT block. - * The pEPDistList is a list of distribution structures in prioritized order as - * defined by the call to the HTCSetCreditDistribution() api. - * - */ -static void ar6000_credit_distribute(void *Context, - HTC_ENDPOINT_CREDIT_DIST *pEPDistList, - HTC_CREDIT_DIST_REASON Reason) -{ - HTC_ENDPOINT_CREDIT_DIST *pCurEpDist; - COMMON_CREDIT_STATE_INFO *pCredInfo = (COMMON_CREDIT_STATE_INFO *)Context; - - switch (Reason) { - case HTC_CREDIT_DIST_SEND_COMPLETE : - pCurEpDist = pEPDistList; - /* we are given the start of the endpoint distribution list. - * There may be one or more endpoints to service. - * Run through the list and distribute credits */ - while (pCurEpDist != NULL) { - - if (pCurEpDist->TxCreditsToDist > 0) { - /* return the credits back to the endpoint */ - pCurEpDist->TxCredits += pCurEpDist->TxCreditsToDist; - /* always zero out when we are done */ - pCurEpDist->TxCreditsToDist = 0; - - if (pCurEpDist->TxCredits > pCurEpDist->TxCreditsAssigned) { - /* reduce to the assigned limit, previous credit reductions - * could have caused the limit to change */ - ReduceCredits(pCredInfo, pCurEpDist, pCurEpDist->TxCreditsAssigned); - } - - if (pCurEpDist->TxCredits > pCurEpDist->TxCreditsNorm) { - /* oversubscribed endpoints need to reduce back to normal */ - ReduceCredits(pCredInfo, pCurEpDist, pCurEpDist->TxCreditsNorm); - } - - if (!IS_EP_ACTIVE(pCurEpDist)) { - /* endpoint is inactive, now check for messages waiting for credits */ - if (pCurEpDist->TxQueueDepth == 0) { - /* EP is inactive and there are no pending messages, - * reduce credits back to zero to recover credits */ - ReduceCredits(pCredInfo, pCurEpDist, 0); - } - } - } - - pCurEpDist = pCurEpDist->pNext; - } - - break; - - case HTC_CREDIT_DIST_ACTIVITY_CHANGE : - RedistributeCredits(pCredInfo,pEPDistList); - break; - case HTC_CREDIT_DIST_SEEK_CREDITS : - SeekCredits(pCredInfo,pEPDistList); - break; - case HTC_DUMP_CREDIT_STATE : - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Credit Distribution, total : %d, free : %d\n", - pCredInfo->TotalAvailableCredits, pCredInfo->CurrentFreeCredits)); - break; - default: - break; - - } - - /* sanity checks done after each distribution action */ - A_ASSERT(pCredInfo->CurrentFreeCredits <= pCredInfo->TotalAvailableCredits); - A_ASSERT(pCredInfo->CurrentFreeCredits >= 0); - -} - -/* redistribute credits based on activity change */ -static void RedistributeCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, - HTC_ENDPOINT_CREDIT_DIST *pEPDistList) -{ - HTC_ENDPOINT_CREDIT_DIST *pCurEpDist = pEPDistList; - - /* walk through the list and remove credits from inactive endpoints */ - while (pCurEpDist != NULL) { - -#ifdef CONFIG_GIVE_LOW_PRIORITY_STREAMS_MIN_CREDITS - - if ((pCurEpDist->ServiceID == WMI_DATA_BK_SVC) || (pCurEpDist->ServiceID == WMI_DATA_BE_SVC)) { - /* force low priority streams to always be active to retain their minimum credit distribution */ - SET_EP_ACTIVE(pCurEpDist); - } -#endif - - if (pCurEpDist->ServiceID != WMI_CONTROL_SVC) { - if (!IS_EP_ACTIVE(pCurEpDist)) { - if (pCurEpDist->TxQueueDepth == 0) { - /* EP is inactive and there are no pending messages, reduce credits back to zero */ - ReduceCredits(pCredInfo, pCurEpDist, 0); - } else { - /* we cannot zero the credits assigned to this EP, but to keep - * the credits available for these leftover packets, reduce to - * a minimum */ - ReduceCredits(pCredInfo, pCurEpDist, pCurEpDist->TxCreditsMin); - } - } - } - - /* NOTE in the active case, we do not need to do anything further, - * when an EP goes active and needs credits, HTC will call into - * our distribution function using a reason code of HTC_CREDIT_DIST_SEEK_CREDITS */ - - pCurEpDist = pCurEpDist->pNext; - } - -} - -/* HTC has an endpoint that needs credits, pEPDist is the endpoint in question */ -static void SeekCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, - HTC_ENDPOINT_CREDIT_DIST *pEPDist) -{ - HTC_ENDPOINT_CREDIT_DIST *pCurEpDist; - int credits = 0; - int need; - - do { - - if (pEPDist->ServiceID == WMI_CONTROL_SVC) { - /* we never oversubscribe on the control service, this is not - * a high performance path and the target never holds onto control - * credits for too long */ - break; - } - -#ifdef CONFIG_GIVE_LOW_PRIORITY_STREAMS_MIN_CREDITS - if (pEPDist->ServiceID == WMI_DATA_VI_SVC) { - if ((pEPDist->TxCreditsAssigned >= pEPDist->TxCreditsNorm)) { - /* limit VI service from oversubscribing */ - break; - } - } - - if (pEPDist->ServiceID == WMI_DATA_VO_SVC) { - if ((pEPDist->TxCreditsAssigned >= pEPDist->TxCreditsNorm)) { - /* limit VO service from oversubscribing */ - break; - } - } -#else - if (pEPDist->ServiceID == WMI_DATA_VI_SVC) { - if ((pEPDist->TxCreditsAssigned >= pEPDist->TxCreditsNorm) || - (pCredInfo->CurrentFreeCredits <= pEPDist->TxCreditsPerMaxMsg)) { - /* limit VI service from oversubscribing */ - /* at least one free credit will not be used by VI */ - break; - } - } - - if (pEPDist->ServiceID == WMI_DATA_VO_SVC) { - if ((pEPDist->TxCreditsAssigned >= pEPDist->TxCreditsNorm) || - (pCredInfo->CurrentFreeCredits <= pEPDist->TxCreditsPerMaxMsg)) { - /* limit VO service from oversubscribing */ - /* at least one free credit will not be used by VO */ - break; - } - } -#endif - - /* for all other services, we follow a simple algorithm of - * 1. checking the free pool for credits - * 2. checking lower priority endpoints for credits to take */ - - /* give what we can */ - credits = min(pCredInfo->CurrentFreeCredits,pEPDist->TxCreditsSeek); - - if (credits >= pEPDist->TxCreditsSeek) { - /* we found some to fullfill the seek request */ - break; - } - - /* we don't have enough in the free pool, try taking away from lower priority services - * - * The rule for taking away credits: - * 1. Only take from lower priority endpoints - * 2. Only take what is allocated above the minimum (never starve an endpoint completely) - * 3. Only take what you need. - * - * */ - - /* starting at the lowest priority */ - pCurEpDist = pCredInfo->pLowestPriEpDist; - - /* work backwards until we hit the endpoint again */ - while (pCurEpDist != pEPDist) { - /* calculate how many we need so far */ - need = pEPDist->TxCreditsSeek - pCredInfo->CurrentFreeCredits; - - if ((pCurEpDist->TxCreditsAssigned - need) >= pCurEpDist->TxCreditsMin) { - /* the current one has been allocated more than it's minimum and it - * has enough credits assigned above it's minimum to fullfill our need - * try to take away just enough to fullfill our need */ - ReduceCredits(pCredInfo, - pCurEpDist, - pCurEpDist->TxCreditsAssigned - need); - - if (pCredInfo->CurrentFreeCredits >= pEPDist->TxCreditsSeek) { - /* we have enough */ - break; - } - } - - pCurEpDist = pCurEpDist->pPrev; - } - - /* return what we can get */ - credits = min(pCredInfo->CurrentFreeCredits,pEPDist->TxCreditsSeek); - - } while (FALSE); - - /* did we find some credits? */ - if (credits) { - /* give what we can */ - GiveCredits(pCredInfo, pEPDist, credits); - } - -} - -/* initialize and setup credit distribution */ -A_STATUS ar6000_setup_credit_dist(HTC_HANDLE HTCHandle, COMMON_CREDIT_STATE_INFO *pCredInfo) -{ - HTC_SERVICE_ID servicepriority[5]; - - A_MEMZERO(pCredInfo,sizeof(COMMON_CREDIT_STATE_INFO)); - - servicepriority[0] = WMI_CONTROL_SVC; /* highest */ - servicepriority[1] = WMI_DATA_VO_SVC; - servicepriority[2] = WMI_DATA_VI_SVC; - servicepriority[3] = WMI_DATA_BE_SVC; - servicepriority[4] = WMI_DATA_BK_SVC; /* lowest */ - - /* set callbacks and priority list */ - HTCSetCreditDistribution(HTCHandle, - pCredInfo, - ar6000_credit_distribute, - ar6000_credit_init, - servicepriority, - 5); - - return A_OK; -} - diff --git a/drivers/net/wireless/ar6003/host/miscdrv/makefile b/drivers/net/wireless/ar6003/host/miscdrv/makefile deleted file mode 100644 index 1ba034c4900e..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/makefile +++ /dev/null @@ -1,26 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2005-2007 Atheros Corporation. All rights reserved. -# -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -#------------------------------------------------------------------------------ -#============================================================================== -# Author(s): ="Atheros" -#============================================================================== -!INCLUDE $(_MAKEENVROOT)\makefile.def - - - diff --git a/drivers/net/wireless/ar6003/host/miscdrv/miscdrv.h b/drivers/net/wireless/ar6003/host/miscdrv/miscdrv.h deleted file mode 100644 index 5defe9c636f4..000000000000 --- a/drivers/net/wireless/ar6003/host/miscdrv/miscdrv.h +++ /dev/null @@ -1,38 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#ifndef _MISCDRV_H -#define _MISCDRV_H - -A_UINT32 ar6kRev2Array[][128] = { - {0xFFFF, 0xFFFF}, // No Patches - }; - -#define CFG_REV2_ITEMS 0 // no patches so far -#define AR6K_RESET_ADDR 0x4000 -#define AR6K_RESET_VAL 0x100 - -#define EEPROM_SZ 768 -#define EEPROM_WAIT_LIMIT 4 - -#endif - diff --git a/drivers/net/wireless/ar6003/host/os/linux/Makefile b/drivers/net/wireless/ar6003/host/os/linux/Makefile deleted file mode 100644 index e4df8b1ef04d..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/Makefile +++ /dev/null @@ -1,338 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2005-2010 Atheros Corporation. All rights reserved. -# -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -#------------------------------------------------------------------------------ -#============================================================================== -# Author(s): ="Atheros" -#============================================================================== -####################################################################################### -# AR6K Kernel Module makefile. -# -# This makefile is invoked by the master makefile in the linux kernel, the linux kernel -# source must be initially compiled. The top level make will invoke the main linux kernel -# makefile which will subsequently pick up this makefile. -# -####################################################################################### - - -REV ?= 2 - -EXTRA_CFLAGS += -I$(ATH_SRC_BASE)/include -EXTRA_CFLAGS += -I$(ATH_SRC_BASE)/../include -EXTRA_CFLAGS += -I$(ATH_SRC_BASE)/wlan/include -EXTRA_CFLAGS += -I$(ATH_SRC_BASE)/os/linux/include -EXTRA_CFLAGS += -I$(ATH_SRC_BASE)/os/ -EXTRA_CFLAGS += -I$(ATH_SRC_BASE)/bmi/include -EXTRA_CFLAGS += -I$(ATH_SRC_BASE)/../include/AR6002 - -EXTRA_CFLAGS += -DLINUX -D__KERNEL__ \ - -DTCMD -DSEND_EVENT_TO_APP -DUSER_KEYS \ - -DNO_SYNC_FLUSH -DHTC_EP_STAT_PROFILING -DWLAN_HEADERS\ - -DATH_AR6K_11N_SUPPORT \ - -DATH_SUPPORT_DFS \ - -DWAPI_ENABLE #\ - -DMULTIPLE_FRAMES_PER_INTERRUPT -DAR6000REV$(REV) \ - -DBLOCK_TX_PATH_FLAG -DCHECKSUM_OFFLOAD \ - - -ifeq ($(ATH_CFG80211_ENV),yes) - EXTRA_CFLAGS += -DATH6K_CONFIG_CFG80211 - # EXTRA_CFLAGS += -DCFG80211_WAPI_ENABLE -endif - -ifeq ($(ATH_INIT_MODE_DRV_ENABLED), yes) -ifeq ($(ATH_AR600x_WB31_XXX),yes) -EXTRA_CFLAGS += -DAR600x_WB31_XXX -else -ifeq ($(ATH_AR600x_SD32_XXX),yes) -EXTRA_CFLAGS += -DAR600x_SD32_XXX -else -EXTRA_CFLAGS += -DAR600x_SD31_XXX -endif -endif -EXTRA_CFLAGS += -DINIT_MODE_DRV_ENABLED -DBMIENABLE_SET -endif - -ifeq ($(ATH_ANDROID_ENV),yes) - EXTRA_CFLAGS += -DANDROID_ENV -D__linux__ $(ATH_ANDROID_BUILD_FLAGS) - EXTRA_CFLAGS += -DINIT_MODE_DRV_ENABLED -DBMIENABLE_SET -DAR600x_SD31_XXX \ - -DATH6KL_CONFIG_HIF_VIRTUAL_SCATTER \ - -DCONFIG_AP_VIRTUAL_ADAPTER_SUPPORT -ifeq ($(ATH_AR6K_HCI_BRIDGE),yes) - EXTRA_CFLAGS += -DSETUPHCI_ENABLED -DSETUPBTDEV_ENABLED \ - -DATH6KL_CONFIG_GPIO_BT_RESET -DAR600x_BT_AR3001 -endif -endif - -EXTRA_CFLAGS += -DCONFIG_BT -ifeq ($(ATH_AR6K_HCI_PAL),yes) - EXTRA_CFLAGS += -DSETUPHCIPAL_ENABLED -ifeq ($(ATH_AR6K_DEBUG_HCI_PAL),yes) - EXTRA_CFLAGS += -DHCIPAL_DEBUG -endif -endif - -ifeq ($(ATH_SOFTMAC_FILE_USED),yes) - EXTRA_CFLAGS += -DSOFTMAC_FILE_USED -endif - -ifeq ($(ATH_AR6K_OTA_TEST_MODE),yes) - EXTRA_CFLAGS += -DATH6K_CONFIG_OTA_MODE -endif - -ifeq ($(ATH_AR6K_HCI_BRIDGE),yes) -EXTRA_CFLAGS += -I$(ATH_SRC_BASE)/miscdrv/ar3kps -EXTRA_CFLAGS += -I$(ATH_SRC_BASE)/../include/AR6002/hw4.0 - -EXTRA_CFLAGS += -DATH_AR6K_ENABLE_GMBOX \ - -DHCI_TRANSPORT_SDIO - -ifeq ($(ATH_AR6K_BUILTIN_HCI_TRANSPORT),no) -EXTRA_CFLAGS += -DEXPORT_HCI_BRIDGE_INTERFACE -endif -endif - - -ifeq ($(ATH_HTC_RAW_INT_ENV),yes) - EXTRA_CFLAGS += -DHTC_RAW_INTERFACE -endif - -ifeq ($(ATH_DEBUG_DRIVER),yes) - EXTRA_CFLAGS += -DDEBUG -DATH_DEBUG_MODULE -endif - -ifeq ($(ATH_BUILD_P2P),yes) - EXTRA_CFLAGS += -DP2P -endif - -ifeq ($(AR6002_REV),4) - EXTRA_CFLAGS += -DAR6002_REV4 -endif - -ifneq ("$(wildcard $(ATH_SRC_BASE)/../include/AR6002/hw2.0)","") - EXTRA_CFLAGS += -DAR6002_HEADERS_DEF -endif - -ifneq ("$(wildcard $(ATH_SRC_BASE)/../include/AR6002/hw4.0)","") - EXTRA_CFLAGS += -DAR6003_HEADERS_DEF -endif - -ifneq ("$(wildcard $(ATH_SRC_BASE)/../include/AR6002/hw6.0)","") - EXTRA_CFLAGS += -DMCKINLEY_HEADERS_DEF -endif - -ifneq ($(ATH_OS_SUB_TYPE),linux_2_4) -# linux 2.6 and higher kernel module build settings -EXTRA_CFLAGS += -DKERNEL_2_6 -obj-m += ar6000.o -ifeq ($(ATH_AR6K_BUILTIN_HCI_TRANSPORT),no) -obj-m += bt_hci_sdio.o -endif --include $(ATH_SRC_BASE)/hif/$(ATH_HIF_TYPE)/Makefile - -ifneq ($(ATH_HIF_MESSAGE_BASED),yes) -ar6000-objs += ../../htc2/AR6000/ar6k.o \ - ../../htc2/AR6000/ar6k_events.o \ - ../../htc2/htc_send.o \ - ../../htc2/htc_recv.o \ - ../../htc2/htc_services.o \ - ../../htc2/htc.o -endif - -ifeq ($(ATH_HIF_MESSAGE_BASED),yes) -ar6000-objs += ../../htc_thin/htc_send.o \ - ../../htc_thin/htc_recv.o \ - ../../htc_thin/htc_services.o \ - ../../htc_thin/htc.o -endif - - -ar6000-objs += ../../bmi/src/bmi.o \ - ar6000_drv.o \ - ar6000_pm.o \ - ar6000_raw_if.o \ - netbuf.o \ - wireless_ext.o \ - ioctl.o \ - ../../miscdrv/common_drv.o \ - ../../miscdrv/credit_dist.o \ - ../../wmi/wmi.o \ - ../../reorder/rcv_aggr.o \ - ../../dfs/dfs_ar.o \ - ../../dfs/dfs_bindetects.o \ - ../../dfs/dfs.o \ - ../../dfs/dfs_debug.o \ - ../../dfs/dfs_fcc_bin5.o \ - ../../dfs/dfs_init.o \ - ../../dfs/dfs_misc.o \ - ../../dfs/dfs_process_phyerr.o \ - ../../dfs/dfs_process_radarevent.o \ - ../../dfs/dfs_staggered.o \ - ../../dfs/dfs_host_project.o \ - ../../wlan/src/wlan_node.o \ - ../../wlan/src/wlan_recv_beacon.o \ - ../../wlan/src/wlan_utils.o \ - ../../regtable/regtable.o \ - ../../regtable/AR6002def.o \ - ../../regtable/AR6003def.o \ - ../../regtable/MCKINLEYdef.o - -ifeq ($(ATH_BUILD_P2P),yes) -ar6000-objs += ../../p2p/p2p_main.o -endif - -ifeq ($(ATH_HIF_TYPE),sdio) -ar6000-objs += ../../hif/common/hif_bmi_reg_access.o \ - ../../hif/common/hif_diag_reg_access.o - -endif - -ifeq ($(ATH_CFG80211_ENV),yes) -ar6000-objs += cfg80211.o -endif - -ifneq ($(ATH_AR6K_BUILTIN_HCI_TRANSPORT),no) -ar6000-objs += hci_bridge.o -endif - -ifneq ($(ATH_AR6K_BUILTIN_HCI_PAL),no) -ar6000-objs += ar6k_pal.o -else -obj-m += ar6k_pal.o -endif - -ifeq ($(ATH_AR6K_HCI_BRIDGE),yes) -ar6000-objs += ../../htc2/AR6000/ar6k_gmbox.o \ - ../../htc2/AR6000/ar6k_gmbox_hciuart.o -ifneq ($(ATH_AR6K_BUILTIN_HCI_TRANSPORT),no) -ar6000-objs += ../../miscdrv/ar3kconfig.o \ - ../../miscdrv/ar3kps/ar3kpsconfig.o \ - ../../miscdrv/ar3kps/ar3kpsparser.o -else -ar6000-objs += export_hci_transport.o -endif - -ifeq ($(ATH_AR6K_BUILTIN_HCI_TRANSPORT),no) -bt_hci_sdio-objs += hci_bridge.o \ - ../../miscdrv/ar3kconfig.o \ - ../../miscdrv/ar3kps/ar3kpsconfig.o \ - ../../miscdrv/ar3kps/ar3kpsparser.o -endif -endif - -ifeq ($(ATH_ANDROID_ENV),yes) - ar6000-objs += ar6000_android.o -endif - -ifeq ($(ATH_AR6K_DEBUG_ALLOC),yes) - EXTRA_CFLAGS += -DAR6K_ALLOC_DEBUG - ar6000-objs += ar6k_mem_debug.o -endif - -endif - -ifeq ($(ATH_OS_SUB_TYPE),linux_2_4) -# linux 2.4 kernel module build settings -EXTRA_CFLAGS += -DKERNEL_2_4 - -O_TARGET := ar6000.o -# need export line for module export -export-objs := ar6000_drv.o --include $(ATH_SRC_BASE)/hif/$(ATH_HIF_TYPE)/Makefile -obj-y += $(ATH_SRC_BASE)/htc2/htc.o \ - $(ATH_SRC_BASE)/htc2/htc_send.o \ - $(ATH_SRC_BASE)/htc2/htc_recv.o \ - $(ATH_SRC_BASE)/htc2/htc_services.o \ - $(ATH_SRC_BASE)/htc2/AR6000/ar6k.o \ - $(ATH_SRC_BASE)/htc2/AR6000/ar6k_events.o \ - $(ATH_SRC_BASE)/bmi/src/bmi.o \ - $(ATH_SRC_BASE)/wmi/wmi.o \ - $(ATH_SRC_BASE)/reorder/rcv_aggr.o \ - $(ATH_SRC_BASE)/dfs/dfs_ar.o \ - $(ATH_SRC_BASE)/dfs/dfs_bindetects.o \ - $(ATH_SRC_BASE)/dfs/dfs.o \ - $(ATH_SRC_BASE)/dfs/dfs_debug.o \ - $(ATH_SRC_BASE)/dfs/dfs_fcc_bin5.o \ - $(ATH_SRC_BASE)/dfs/dfs_init.o \ - $(ATH_SRC_BASE)/dfs/dfs_misc.o \ - $(ATH_SRC_BASE)/dfs/dfs_process_phyerr.o \ - $(ATH_SRC_BASE)/dfs/dfs_process_radarevent.o \ - $(ATH_SRC_BASE)/dfs/dfs_staggered.o \ - $(ATH_SRC_BASE)/dfs/dfs_host_project.o \ - $(ATH_SRC_BASE)/wlan/src/wlan_node.o \ - $(ATH_SRC_BASE)/wlan/src/wlan_recv_beacon.o \ - $(ATH_SRC_BASE)/wlan/src/wlan_utils.o \ - $(ATH_SRC_BASE)/os/linux/ar6000_drv.o \ - $(ATH_SRC_BASE)/os/linux/ar6000_raw_if.o \ - $(ATH_SRC_BASE)/os/linux/wireless_ext.o \ - $(ATH_SRC_BASE)/os/linux/ioctl.o \ - $(ATH_SRC_BASE)/os/linux/netbuf.o \ - $(ATH_SRC_BASE)/os/linux/hci_bridge.o \ - $(ATH_SRC_BASE)/miscdrv/common_drv.o \ - $(ATH_SRC_BASE)/miscdrv/credit_dist.o - -ifeq ($(ATH_HIF_TYPE),SPI2) -obj-y += $(ATH_SRC_BASE)/hif/common/hif_bmi_reg_access.o \ - $(ATH_SRC_BASE)/hif/common/hif_diag_reg_access.o - -endif - -obj-m += htc.o \ - htc_send.o \ - htc_recv.o \ - htc_services.o \ - ar6k_events.o \ - ar6k.o \ - ar6k_gmbox.o \ - ar6k_gmbox_hciuart.o \ - hif.o \ - bmi.o \ - wmi.o \ - dfs_ar.o \ - dfs_bindetects.o \ - dfs.o \ - dfs_debug.o \ - dfs_fcc_bin5.o \ - dfs_init.o \ - dfs_misc.o \ - dfs_process_phyerr.o \ - dfs_process_radarevent.o \ - dfs_staggered.o \ - dfs_host_project.o \ - wlan_node.o \ - wlan_recv_beacon.o \ - wlan_utils.o \ - ar6000_drv.o \ - ar6000_raw_if.o \ - common_drv.o \ - credit_dist.o \ - netbuf.o \ - wireless_ext.o \ - rcv_aggr.o \ - ioctl.o \ - hci_bridge.o \ - ar6000.o - -ifeq ($(ATH_HIF_TYPE),SPI2) -obj-m += hif_bmi_reg_access.o \ - hif_diag_reg_access.o - -endif - -include $(ATH_LINUXPATH)/Rules.make -endif diff --git a/drivers/net/wireless/ar6003/host/os/linux/ar6000_android.c b/drivers/net/wireless/ar6003/host/os/linux/ar6000_android.c deleted file mode 100644 index 3100618e3ef7..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/ar6000_android.c +++ /dev/null @@ -1,965 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ -#include "ar6000_drv.h" -#include "htc.h" -#include -#include - -#ifdef CONFIG_HAS_WAKELOCK -#include -#endif -#ifdef CONFIG_HAS_EARLYSUSPEND -#include -#endif - -#ifdef CONFIG_MMC_MSM -A_BOOL enable_mmc_host_detect_change = 1; -#else -A_BOOL enable_mmc_host_detect_change = 0; -#endif -static void ar6000_enable_mmchost_detect_change(int enable); - - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -#ifdef RK29 -#ifdef TCHIP -char softmac_path[256] = "/data/misc/wifi/ar6302"; -#endif -char fwpath[256] = "/system/etc/firmware"; -//char fwpath[256] = "/data/ar6302"; -#else -char fwpath[256] = "/system/wifi"; -#endif -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */ -int wowledon; -unsigned int enablelogcat; - -extern int bmienable; -extern struct net_device *ar6000_devices[]; -extern char ifname[]; - -#ifdef CONFIG_HAS_WAKELOCK -extern struct wake_lock ar6k_wow_wake_lock; -struct wake_lock ar6k_init_wake_lock; -#endif -extern int num_device; - -const char def_ifname[] = "wlan0"; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -module_param_string(fwpath, fwpath, sizeof(fwpath), 0644); -module_param(enablelogcat, uint, 0644); -module_param(wowledon, int, 0644); -#else -#define __user -/* for linux 2.4 and lower */ -MODULE_PARAM(wowledon,"i"); -#endif - -#ifdef CONFIG_HAS_EARLYSUSPEND -static int screen_is_off; -static struct early_suspend ar6k_early_suspend; -#endif - -static A_STATUS (*ar6000_avail_ev_p)(void *, void *); - -#if defined(CONFIG_ANDROID_LOGGER) && (!defined(CONFIG_MMC_MSM) || LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) -int logger_write(const enum logidx index, - const unsigned char prio, - const char __kernel * const tag, - const char __kernel * const fmt, - ...) -{ - int ret = 0; - va_list vargs; - struct file *filp = (struct file *)-ENOENT; - mm_segment_t oldfs; - struct iovec vec[3]; - int tag_bytes = strlen(tag) + 1, msg_bytes; - char *msg; - va_start(vargs, fmt); - msg = kvasprintf(GFP_ATOMIC, fmt, vargs); - va_end(vargs); - if (!msg) - return -ENOMEM; - if (in_interrupt()) { - /* we have no choice since aio_write may be blocked */ - printk(KERN_ALERT "%s", msg); - goto out_free_message; - } - msg_bytes = strlen(msg) + 1; - if (msg_bytes <= 1) /* empty message? */ - goto out_free_message; /* don't bother, then */ - if ((msg_bytes + tag_bytes + 1) > 2048) { - ret = -E2BIG; - goto out_free_message; - } - - vec[0].iov_base = (unsigned char *) &prio; - vec[0].iov_len = 1; - vec[1].iov_base = (void *) tag; - vec[1].iov_len = strlen(tag) + 1; - vec[2].iov_base = (void *) msg; - vec[2].iov_len = strlen(msg) + 1; - - oldfs = get_fs(); - set_fs(KERNEL_DS); - do { - filp = filp_open("/dev/log/main", O_WRONLY, S_IRUSR); - if (IS_ERR(filp) || !filp->f_op) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: filp_open /dev/log/main error\n", __FUNCTION__)); - ret = -ENOENT; - break; - } - - if (filp->f_op->aio_write) { - int nr_segs = sizeof(vec) / sizeof(vec[0]); - int len = vec[0].iov_len + vec[1].iov_len + vec[2].iov_len; - struct kiocb kiocb; - init_sync_kiocb(&kiocb, filp); - kiocb.ki_pos = 0; - kiocb.ki_left = len; - kiocb.ki_nbytes = len; - ret = filp->f_op->aio_write(&kiocb, vec, nr_segs, kiocb.ki_pos); - } - - } while (0); - - if (!IS_ERR(filp)) { - filp_close(filp, NULL); - } - set_fs(oldfs); -out_free_message: - if (msg) { - kfree(msg); - } - return ret; -} -#endif - -int android_logger_lv(void *module, int mask) -{ - switch (mask) { - case ATH_DEBUG_ERR: - return 6; - case ATH_DEBUG_INFO: - return 4; - case ATH_DEBUG_WARN: - return 5; - case ATH_DEBUG_TRC: - return 3; - default: -#ifdef DEBUG - if (!module) { - return 3; - } else if (module == &GET_ATH_MODULE_DEBUG_VAR_NAME(driver)) { - return (mask <=ATH_DEBUG_MAKE_MODULE_MASK(3)) ? 3 : 2; - } else if (module == &GET_ATH_MODULE_DEBUG_VAR_NAME(htc)) { - return 2; - } else { - return 3; - } -#else - return 3; /* DEBUG */ -#endif - } -} - -#ifdef RK29 -int -#else -static int -#endif -android_readwrite_file(const A_CHAR *filename, A_CHAR *rbuf, const A_CHAR *wbuf, size_t length) -{ - int ret = 0; - struct file *filp = (struct file *)-ENOENT; - mm_segment_t oldfs; - oldfs = get_fs(); - set_fs(KERNEL_DS); - do { - int mode = (wbuf) ? O_RDWR : O_RDONLY; -#ifdef TCHIP - if (strstr(filename, "softmac") && wbuf) { - mode = O_CREAT | O_RDWR; - } -#endif - filp = filp_open(filename, mode, S_IRUSR); - if (IS_ERR(filp) || !filp->f_op) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: file %s filp_open error\n", __FUNCTION__, filename)); - ret = -ENOENT; - break; - } - - if (length==0) { - /* Read the length of the file only */ - struct inode *inode; - - inode = GET_INODE_FROM_FILEP(filp); - if (!inode) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Get inode from %s failed\n", __FUNCTION__, filename)); - ret = -ENOENT; - break; - } - ret = i_size_read(inode->i_mapping->host); - break; - } - - if (wbuf) { - if ( (ret=filp->f_op->write(filp, wbuf, length, &filp->f_pos)) < 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Write %u bytes to file %s error %d\n", __FUNCTION__, - length, filename, ret)); - break; - } - } else { - if ( (ret=filp->f_op->read(filp, rbuf, length, &filp->f_pos)) < 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Read %u bytes from file %s error %d\n", __FUNCTION__, - length, filename, ret)); - break; - } - } - } while (0); - - if (!IS_ERR(filp)) { - filp_close(filp, NULL); - } - set_fs(oldfs); - - return ret; -} - -#ifdef TCHIP -void android_wifi_softmac_update(char *mac_buff, int len) -{ - char filename[256]; - sprintf(filename, "%s/%s", softmac_path, "softmac"); - - android_readwrite_file(filename, NULL, mac_buff, len); -} -#endif - -int android_request_firmware(const struct firmware **firmware_p, const char *name, - struct device *device) -{ - int ret = 0; - struct firmware *firmware; - char filename[256]; - const char *raw_filename = name; -#ifdef TCHIP - int sm = 0; - char mac[] = "00:00:00:00:00:00"; -#endif - - *firmware_p = firmware = A_MALLOC(sizeof(*firmware)); - if (!firmware) - return -ENOMEM; - A_MEMZERO(firmware, sizeof(*firmware)); - -#ifdef TCHIP - if(!strcmp(name,"softmac")) { - sprintf(filename, "%s/%s", softmac_path, raw_filename); - sm = 1; - } - else -#endif - sprintf(filename, "%s/%s", fwpath, raw_filename); - do { - size_t length, bufsize, bmisize; - - if ( (ret=android_readwrite_file(filename, NULL, NULL, 0)) < 0) { -#ifdef TCHIP - if (sm) { - android_wifi_softmac_update(mac, sizeof(mac)); - length = sizeof(mac); - } - else -#endif - break; - } else { - length = ret; - } - - bufsize = ALIGN(length, PAGE_SIZE); - bmisize = A_ROUND_UP(length, 4); - bufsize = max(bmisize, bufsize); - firmware->data = vmalloc(bufsize); - firmware->size = length; - if (!firmware->data) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: Cannot allocate buffer for firmware\n", __FUNCTION__)); - ret = -ENOMEM; - break; - } - - if ( (ret=android_readwrite_file(filename, (char*)firmware->data, NULL, length)) != length) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: file read error, ret %d request %d\n", __FUNCTION__, ret, length)); - ret = -1; - break; - } - - } while (0); - - if (ret<0) { - if (firmware) { - if (firmware->data) - vfree(firmware->data); - A_FREE(firmware); - } - *firmware_p = NULL; - } else { - ret = 0; - } - return ret; -} - -void android_release_firmware(const struct firmware *firmware) -{ - if (firmware) { - if (firmware->data) - vfree(firmware->data); - A_FREE((struct firmware *)firmware); - } -} - -static A_STATUS ar6000_android_avail_ev(void *context, void *hif_handle) -{ - A_STATUS ret; -#ifdef CONFIG_HAS_WAKELOCK - wake_lock(&ar6k_init_wake_lock); -#endif - ar6000_enable_mmchost_detect_change(0); - ret = ar6000_avail_ev_p(context, hif_handle); -#ifdef CONFIG_HAS_WAKELOCK - wake_unlock(&ar6k_init_wake_lock); -#endif - return ret; -} - -static int android_do_ioctl_direct(struct net_device *dev, int cmd, struct ifreq *ifr, void *data) -{ - int ret = -EIO; - int (*do_ioctl)(struct net_device *, struct ifreq *, int); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) - do_ioctl = dev->do_ioctl; -#else - do_ioctl = dev->netdev_ops->ndo_do_ioctl; -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) */ - - ifr->ifr_ifru.ifru_data = (__force void __user *)data; - - if (do_ioctl) { - mm_segment_t oldfs = get_fs(); - set_fs(KERNEL_DS); - ret = do_ioctl(dev, ifr, cmd); - set_fs(oldfs); - } - return ret; -} - -int android_ioctl_siwpriv(struct net_device *dev, - struct iw_request_info *__info, - struct iw_point *data, char *__extra) -{ - char cmd[384]; /* assume that android command will not excess 384 */ - char buf[512]; - int len = sizeof(cmd)-1; - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - - if (!data->pointer) { - return -EOPNOTSUPP; - } - if (data->length < len) { - len = data->length; - } - if (copy_from_user(cmd, data->pointer, len)) { - return -EIO; - } - cmd[len] = 0; - - if (strcasecmp(cmd, "RSSI")==0 || strcasecmp(cmd, "RSSI-APPROX") == 0) { - int rssi = -200; - struct iw_statistics *iwStats; - struct iw_statistics* (*get_iwstats)(struct net_device *); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) - get_iwstats = dev->get_wireless_stats; -#else - get_iwstats = dev->wireless_handlers->get_wireless_stats; -#endif - if (get_iwstats && arPriv->arConnected) { - iwStats = get_iwstats(dev); - if (iwStats) { - rssi = iwStats->qual.qual; - if (rssi == 255) - rssi = -200; - else - rssi += (161 - 256); - } - } - len = snprintf(buf, data->length, "SSID rssi %d\n", rssi) + 1; - return (copy_to_user(data->pointer, buf, len)==0) ? len : -1; - } else if (strcasecmp(cmd, "LINKSPEED")==0) { - /* We skip to use SIOCGIWRATE since Android always asked LINKSPEED just after RSSI*/ - unsigned int speed_mbps; - if (arPriv->arConnected) { - speed_mbps = arPriv->arTargetStats.tx_unicast_rate / 1000; - } else { - speed_mbps = 1; - } - len = snprintf(buf, data->length, "LinkSpeed %u\n", speed_mbps) + 1; - return (copy_to_user(data->pointer, buf, len)==0) ? len : -1; - } else if (memcmp(cmd, "CSCAN S\x01\x00\x00S\x00", 12)==0) { - int iocmd = SIOCSIWSCAN - SIOCSIWCOMMIT; - const iw_handler setScan = dev->wireless_handlers->standard[iocmd]; - A_INT32 home_dwell=0, pas_dwell=0, act_dwell=0; - A_UCHAR ssid[IW_ESSID_MAX_SIZE+1] = { 0 }; - A_INT32 ssid_len = 0, ie_len; - A_UINT8 index = 1; /* reserve index 0 for wext */ - A_INT32 ch = 0; - A_CHAR nprobe, scantype; - struct iw_freq chList[IW_MAX_FREQUENCIES]; - A_UCHAR *scanBuf = (A_UCHAR*)(cmd + 12); - A_UCHAR *scanEnd = (A_UCHAR*)(cmd + len); - A_BOOL broadcastSsid = FALSE; - - while ( scanBuf < scanEnd ) { - A_UCHAR *sp = scanBuf; - switch (*scanBuf) { - case 'S': /* SSID section */ - if (ssid_len > 0 && index < MAX_PROBED_SSID_INDEX) { - /* setup the last parsed ssid, reserve index 0 for wext */ - if (wmi_probedSsid_cmd(arPriv->arWmi, index, - SPECIFIC_SSID_FLAG, ssid_len, ssid) == A_OK) { - ++index; - if (arSta->scanSpecificSsidscanSpecificSsid = index; - } - } - } - ie_len = ((scanBuf + 1) < scanEnd) ? ((A_INT32)*(scanBuf+1) + 1) : 0; - if ((scanBuf+ie_len) < scanEnd ) { - ssid_len = *(scanBuf+1); - if (ssid_len == 0) { - broadcastSsid = TRUE; - } else { - A_MEMCPY(ssid, scanBuf+2, ssid_len); - ssid[ssid_len] = '\0'; - } - } - scanBuf += 1 + ie_len; - break; - case 'C': /* Channel section */ - if (scanBuf+1 < scanEnd) { - int value = *(scanBuf+1); - if (value == 0) { - ch = 0; /* scan for all channels */ - } else if (ch < IW_MAX_FREQUENCIES) { - if (value>1000) { - chList[ch].e = 1; - chList[ch].m = value * 100000; - } else { - chList[ch].e = 0; - chList[ch].m = value; - } - ++ch; - } - } - scanBuf += 2; - break; - case 'P': /* Passive dwell section */ - if (scanBuf+2 < scanEnd) { - pas_dwell = *(scanBuf+1) + (*(scanBuf+2) << 8); - } - scanBuf += 3; - break; - case 'H': /* Home dwell section */ - if (scanBuf+2 < scanEnd) { - home_dwell = *(scanBuf+1) + (*(scanBuf+2) << 8); - } - scanBuf += 3; - break; - case 'N': /* Number of probe section */ - if (scanBuf+1 < scanEnd) { - nprobe = *(scanBuf+1); - } - scanBuf += 2; - break; - case 'A': /* Active dwell section */ - if (scanBuf+2 < scanEnd) { - act_dwell = *(scanBuf+1) + (*(scanBuf+2) << 8); - } - scanBuf += 3; - break; - case 'T': /* Scan active type section */ - if (scanBuf+1 < scanEnd) { - scantype = *(scanBuf+1); - } - scanBuf += 2; - break; - default: - break; - } - if (sp == scanBuf) { - return -1; /* parsing error */ - } - } - - if (ssid_len>0) { - A_UINT8 idx; /* Clean up the last specific scan items */ - for (idx=index; idxscanSpecificSsid; ++idx) { - wmi_probedSsid_cmd(arPriv->arWmi, idx, DISABLE_SSID_FLAG, 0, NULL); - } - arSta->scanSpecificSsid = index; - /* - * There is no way to know when we need to send broadcast probe in current Android wpa_supplicant_6 - * combo scan implemenation. Always force to sent it here uniti future Android version will set - * the broadcast flags for combo scan. - */ -#if 0 - if (broadcastSsid) -#endif - { - /* setup the last index as broadcast SSID for combo scan */ - ++arSta->scanSpecificSsid; - wmi_probedSsid_cmd(arPriv->arWmi, index, ANY_SSID_FLAG, 0, NULL); - } - } - - if (pas_dwell>0) { - /* TODO: Should we change our passive dwell? There may be some impact for bt-coex */ - } - - if (home_dwell>0) { - /* TODO: Should we adjust home_dwell? How to pass it to wext handler? */ - } - - if (setScan) { - union iwreq_data miwr; - struct iw_request_info minfo; - struct iw_scan_req scanreq, *pScanReq = NULL; - A_MEMZERO(&minfo, sizeof(minfo)); - A_MEMZERO(&miwr, sizeof(miwr)); - A_MEMZERO(&scanreq, sizeof(scanreq)); - if (ssid_len > 0) { - pScanReq = &scanreq; - memcpy(scanreq.essid, ssid, ssid_len); - scanreq.essid_len = ssid_len; - miwr.data.flags |= IW_SCAN_THIS_ESSID; - } - if (ch > 0) { - pScanReq = &scanreq; - scanreq.num_channels = ch; - memcpy(scanreq.channel_list, chList, ch * sizeof(chList[0])); - miwr.data.flags |= IW_SCAN_THIS_FREQ; - } - if (pScanReq) { - miwr.data.pointer = (__force void __user *)&scanreq; - miwr.data.length = sizeof(scanreq); - } - minfo.cmd = SIOCSIWSCAN; - return setScan(dev, &minfo, &miwr, (char*)pScanReq); - } - return -1; - } else if (strcasecmp(cmd, "MACADDR")==0) { - /* reply comes back in the form "Macaddr = XX:XX:XX:XX:XX:XX" where XX */ - A_UCHAR *mac = dev->dev_addr; - len = snprintf(buf, data->length, "Macaddr = %02X:%02X:%02X:%02X:%02X:%02X\n", - mac[0], mac[1], mac[2], - mac[3], mac[4], mac[5]) + 1; - return (copy_to_user(data->pointer, buf, len)==0) ? len : -1; - } else if (strcasecmp(cmd, "SCAN-ACTIVE")==0) { - return 0; /* unsupport function. Suppress the error */ - } else if (strcasecmp(cmd, "SCAN-PASSIVE")==0) { - return 0; /* unsupport function. Suppress the error */ - } else if (strcasecmp(cmd, "START")==0 || strcasecmp(cmd, "STOP")==0) { - struct ifreq ifr; - char userBuf[16]; - int ex_arg = (strcasecmp(cmd, "START")==0) ? WLAN_ENABLED : WLAN_DISABLED; - int ret; - A_MEMZERO(userBuf, sizeof(userBuf)); - ((int *)userBuf)[0] = AR6000_XIOCTRL_WMI_SET_WLAN_STATE; - ((int *)userBuf)[1] = ex_arg; - ret = android_do_ioctl_direct(dev, AR6000_IOCTL_EXTENDED, &ifr, userBuf); - if (ret==0) { - /* Send wireless event which need by android supplicant */ - union iwreq_data wrqu; - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = strlen(cmd); - wireless_send_event(dev, IWEVCUSTOM, &wrqu, cmd); - } - return ret; - } else if (strncasecmp(cmd, "POWERMODE ", 10)==0) { - int mode; - if (sscanf(cmd, "%*s %d", &mode) == 1) { - int iocmd = SIOCSIWPOWER - SIOCSIWCOMMIT; - iw_handler setPower = dev->wireless_handlers->standard[iocmd]; - if (setPower) { - union iwreq_data miwr; - struct iw_request_info minfo; - A_MEMZERO(&minfo, sizeof(minfo)); - A_MEMZERO(&miwr, sizeof(miwr)); - minfo.cmd = SIOCSIWPOWER; - if (mode == 0 /* auto */) - miwr.power.disabled = 0; - else if (mode == 1 /* active */) - miwr.power.disabled = 1; - else - return -1; - return setPower(dev, &minfo, &miwr, NULL); - } - } - return -1; - } else if (strcasecmp(cmd, "GETPOWER")==0) { - struct ifreq ifr; - int userBuf[2]; - A_MEMZERO(userBuf, sizeof(userBuf)); - ((int *)userBuf)[0] = AR6000_XIOCTRL_WMI_GET_POWER_MODE; - if (android_do_ioctl_direct(dev, AR6000_IOCTL_EXTENDED, &ifr, userBuf)>=0) { - WMI_POWER_MODE_CMD *getPowerMode = (WMI_POWER_MODE_CMD *)userBuf; - len = snprintf(buf, data->length, "powermode = %u\n", - (getPowerMode->powerMode==MAX_PERF_POWER) ? 1/*active*/ : 0/*auto*/) + 1; - return (copy_to_user(data->pointer, buf, len)==0) ? len : -1; - } - return -1; - } else if (strncasecmp(cmd, "SETSUSPENDOPT ", 14)==0) { - int enable; - if (sscanf(cmd, "%*s %d", &enable)==1) { - /* - * We set our suspend mode by wlan_config.h now. - * Should we follow Android command?? TODO - */ - return 0; - } - return -1; - } else if (strcasecmp(cmd, "SCAN-CHANNELS")==0) { - // reply comes back in the form "Scan-Channels = X" where X is the number of channels - int iocmd = SIOCGIWRANGE - SIOCSIWCOMMIT; - iw_handler getRange = dev->wireless_handlers->standard[iocmd]; - if (getRange) { - union iwreq_data miwr; - struct iw_request_info minfo; - struct iw_range range; - A_MEMZERO(&minfo, sizeof(minfo)); - A_MEMZERO(&miwr, sizeof(miwr)); - A_MEMZERO(&range, sizeof(range)); - minfo.cmd = SIOCGIWRANGE; - miwr.data.pointer = (__force void __user *) ⦥ - miwr.data.length = sizeof(range); - getRange(dev, &minfo, &miwr, (char*)&range); - } - if (arSta->arNumChannels!=-1) { - len = snprintf(buf, data->length, "Scan-Channels = %d\n", arSta->arNumChannels) + 1; - return (copy_to_user(data->pointer, buf, len)==0) ? len : -1; - } - return -1; - } else if (strncasecmp(cmd, "SCAN-CHANNELS ", 14)==0 || - strncasecmp(cmd, "COUNTRY ", 8)==0) { - /* - * Set the available channels with WMI_SET_CHANNELPARAMS cmd - * However, the channels will be limited by the eeprom regulator domain - * Try to use a regulator domain which will not limited the channels range. - */ - int i; - int chan = 0; - A_UINT16 *clist; - struct ifreq ifr; - char ioBuf[256]; - WMI_CHANNEL_PARAMS_CMD *chParamCmd = (WMI_CHANNEL_PARAMS_CMD *)ioBuf; - if (strncasecmp(cmd, "COUNTRY ", 8)==0) { - char *country = cmd + 8; - if (strcasecmp(country, "US")==0) { - chan = 11; - } else if (strcasecmp(country, "JP")==0) { - chan = 14; - } else if (strcasecmp(country, "EU")==0) { - chan = 13; - } - } else if (sscanf(cmd, "%*s %d", &chan) != 1) { - return -1; - } - if ( (chan != 11) && (chan != 13) && (chan != 14)) { - return -1; - } - if (arPriv->arNextMode == AP_NETWORK) { - return -1; - } - A_MEMZERO(&ifr, sizeof(ifr)); - A_MEMZERO(ioBuf, sizeof(ioBuf)); - - chParamCmd->phyMode = WMI_11G_MODE; - clist = chParamCmd->channelList; - chParamCmd->numChannels = chan; - chParamCmd->scanParam = 1; - for (i = 0; i < chan; i++) { - clist[i] = wlan_ieee2freq(i + 1); - } - - return android_do_ioctl_direct(dev, AR6000_IOCTL_WMI_SET_CHANNELPARAMS, &ifr, ioBuf); - } else if (strncasecmp(cmd, "BTCOEXMODE ", 11)==0) { - int mode; - if (sscanf(cmd, "%*s %d", &mode)==1) { - /* - * Android disable BT-COEX when obtaining dhcp packet except there is headset is connected - * It enable the BT-COEX after dhcp process is finished - * We ignore since we have our way to do bt-coex during dhcp obtaining. - */ - switch (mode) { - case 1: /* Disable*/ - break; - case 0: /* Enable */ - /* fall through */ - case 2: /* Sense*/ - /* fall through */ - default: - break; - } - return 0; /* ignore it */ - } - return -1; - } else if (strcasecmp(cmd, "BTCOEXSCAN-START")==0) { - /* Android enable or disable Bluetooth coexistence scan mode. When this mode is on, - * some of the low-level scan parameters used by the driver are changed to - * reduce interference with A2DP streaming. - */ - return 0; /* ignore it since we have btfilter */ - } else if (strcasecmp(cmd, "BTCOEXSCAN-STOP")==0) { - return 0; /* ignore it since we have btfilter */ - } else if (strncasecmp(cmd, "RXFILTER-ADD ", 13)==0) { - return 0; /* ignore it */ - } else if (strncasecmp(cmd, "RXFILTER-REMOVE ", 16)==0) { - return 0; /* ignoret it */ - } else if (strcasecmp(cmd, "RXFILTER-START")==0 || strcasecmp(cmd, "RXFILTER-STOP")==0) { - unsigned int flags = dev->flags; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) - int mc_count = dev->mc_count; -#else - int mc_count = netdev_mc_count(dev); -#endif - if (strcasecmp(cmd, "RXFILTER-START")==0) { - if (mc_count > 0 || (flags & IFF_MULTICAST) ) { - flags &= ~IFF_MULTICAST; - } - } else { - flags |= IFF_MULTICAST; - } - if (flags != dev->flags) { - dev_change_flags(dev, flags); - } - return 0; - } - - return -EOPNOTSUPP; -} - -/* Useful for qualcom platform to detect our wlan card for mmc stack */ -static void ar6000_enable_mmchost_detect_change(int enable) -{ -#ifdef CONFIG_MMC_MSM -#define MMC_MSM_DEV "msm_sdcc.1" - char buf[3]; - int length; - - if (!enable_mmc_host_detect_change) { - return; - } - length = snprintf(buf, sizeof(buf), "%d\n", enable ? 1 : 0); - if (android_readwrite_file("/sys/devices/platform/" MMC_MSM_DEV "/detect_change", - NULL, buf, length) < 0) { - /* fall back to polling */ - android_readwrite_file("/sys/devices/platform/" MMC_MSM_DEV "/polling", NULL, buf, length); - A_MDELAY(50); - } -#endif -} - -#ifdef CONFIG_HAS_EARLYSUSPEND -static void android_early_suspend(struct early_suspend *h) -{ - screen_is_off = 1; -} - -static void android_late_resume(struct early_suspend *h) -{ - screen_is_off = 0; -} -#endif - -void android_module_init(OSDRV_CALLBACKS *osdrvCallbacks) -{ - bmienable = 1; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - if (ifname[0] == '\0') - strcpy(ifname, def_ifname); -#endif -#ifdef CONFIG_HAS_WAKELOCK - wake_lock_init(&ar6k_init_wake_lock, WAKE_LOCK_SUSPEND, "ar6k_init"); -#endif -#ifdef CONFIG_HAS_EARLYSUSPEND - ar6k_early_suspend.suspend = android_early_suspend; - ar6k_early_suspend.resume = android_late_resume; - ar6k_early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN; - register_early_suspend(&ar6k_early_suspend); -#endif - - ar6000_avail_ev_p = osdrvCallbacks->deviceInsertedHandler; - osdrvCallbacks->deviceInsertedHandler = ar6000_android_avail_ev; - - ar6000_enable_mmchost_detect_change(1); -} - -void android_module_exit(void) -{ -#ifdef CONFIG_HAS_EARLYSUSPEND - unregister_early_suspend(&ar6k_early_suspend); -#endif -#ifdef CONFIG_HAS_WAKELOCK - wake_lock_destroy(&ar6k_init_wake_lock); -#endif - ar6000_enable_mmchost_detect_change(1); - /* disable polling again after we remove our wlan card */ - ar6000_enable_mmchost_detect_change(0); -} - -#ifdef CONFIG_PM -void android_ar6k_check_wow_status(AR_SOFTC_T *ar, struct sk_buff *skb, A_BOOL isEvent) -{ -#ifdef CONFIG_HAS_WAKELOCK - unsigned long wake_timeout = HZ; /* 1 second for normal window's ping test */ -#endif - AR_SOFTC_DEV_T *arPriv; - A_UINT8 i; - A_BOOL needWake = FALSE; - for(i = 0; i < num_device; i++) - { - arPriv = ar->arDev[i]; - if ( -#ifdef CONFIG_HAS_EARLYSUSPEND - screen_is_off && -#endif - skb && arPriv->arConnected) { - if (isEvent) { - if (A_NETBUF_LEN(skb) >= sizeof(A_UINT16)) { - A_UINT16 cmd = *(const A_UINT16 *)A_NETBUF_DATA(skb); - switch (cmd) { - case WMI_CONNECT_EVENTID: -#ifdef CONFIG_HAS_WAKELOCK - wake_timeout = 3*HZ; -#endif - needWake = TRUE; - break; - default: - /* dont wake lock the system for other event */ - break; - } - } - } else if (A_NETBUF_LEN(skb) >= sizeof(ATH_MAC_HDR)) { - ATH_MAC_HDR *datap = (ATH_MAC_HDR *)A_NETBUF_DATA(skb); - if (!IEEE80211_IS_MULTICAST(datap->dstMac)) { - switch (A_BE2CPU16(datap->typeOrLen)) { - case 0x0800: /* IP */ - if (A_NETBUF_LEN(skb)>=24 && - *((A_UCHAR*)A_NETBUF_DATA(skb)+23)==0x11) { - A_UCHAR *udpPkt = (A_UCHAR*)A_NETBUF_DATA(skb)+14; - A_UINT8 ihl = (*udpPkt & 0x0f) * sizeof(A_UINT32); - const A_UCHAR ipsec_keepalive[] = { - 0x11, 0x94, 0x11, 0x94, 0x00, 0x09, 0x00, 0x00, 0xff - }; - udpPkt += ihl; - if (A_NETBUF_LEN(skb)>=14+ihl+sizeof(ipsec_keepalive) && - !memcmp(udpPkt, ipsec_keepalive, sizeof(ipsec_keepalive)-3) && - udpPkt[8]==0xff) { - /* - * RFC 3948 UDP Encapsulation of IPsec ESP Packets - * Source and Destination port must be 4500 - * Receivers MUST NOT depend upon the UDP checksum being zero - * Sender must use 1 byte payload with 0xff - * Receiver SHOULD ignore a received NAT-keepalive packet - * - * IPSec over UDP NAT keepalive packet. Just ignore - */ - break; - } - } - case 0x888e: /* EAPOL */ - case 0x88c7: /* RSN_PREAUTH */ - case 0x88b4: /* WAPI */ - needWake = TRUE; - break; - case 0x0806: /* ARP is not important to hold wake lock */ - needWake = (arPriv->arNetworkType==AP_NETWORK); - break; - default: - break; - } - } else if ( !IEEE80211_IS_BROADCAST(datap->dstMac) ) { - if (A_NETBUF_LEN(skb)>=14+20 ) { - /* check if it is mDNS packets */ - A_UINT8 *dstIpAddr = (A_UINT8*)(A_NETBUF_DATA(skb)+14+20-4); - struct net_device *ndev = arPriv->arNetDev; - needWake = ((dstIpAddr[3] & 0xf8) == 0xf8) && - (arPriv->arNetworkType==AP_NETWORK || - (ndev->flags & IFF_ALLMULTI || ndev->flags & IFF_MULTICAST)); - } - }else if (arPriv->arNetworkType==AP_NETWORK) { - switch (A_BE2CPU16(datap->typeOrLen)) { - case 0x0800: /* IP */ - if (A_NETBUF_LEN(skb)>=14+20+2) { - A_UINT16 dstPort = *(A_UINT16*)(A_NETBUF_DATA(skb)+14+20); - dstPort = A_BE2CPU16(dstPort); - needWake = (dstPort == 0x43); /* dhcp request */ - } - break; - case 0x0806: - needWake = TRUE; - default: - break; - } - } - } - } - } - if (needWake) { -#ifdef CONFIG_HAS_WAKELOCK - /* keep host wake up if there is any event and packate comming in*/ - wake_lock_timeout(&ar6k_wow_wake_lock, wake_timeout); -#endif - if (wowledon) { - char buf[32]; - int len = sprintf(buf, "on"); - android_readwrite_file("/sys/power/state", NULL, buf, len); - - len = sprintf(buf, "%d", 127); - android_readwrite_file("/sys/class/leds/lcd-backlight/brightness", - NULL, buf,len); - } - } -} -#endif /* CONFIG_PM */ - -void android_send_reload_event(AR_SOFTC_DEV_T *arPriv) -{ - struct net_device *ndev = arPriv->arNetDev; - union iwreq_data wrqu; - const char reloadEvt[] = "HANG"; - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = strlen(reloadEvt); - wireless_send_event(ndev, IWEVCUSTOM, &wrqu, reloadEvt); -} diff --git a/drivers/net/wireless/ar6003/host/os/linux/ar6000_drv.c b/drivers/net/wireless/ar6003/host/os/linux/ar6000_drv.c deleted file mode 100644 index e5d7952376ce..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/ar6000_drv.c +++ /dev/null @@ -1,8934 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -/* - * This driver is a pseudo ethernet driver to access the Atheros AR6000 - * WLAN Device - */ - -#ifdef ATH_AR6K_11N_SUPPORT -#define SUPPORT_11N -#include "wlan_defs.h" -#endif - -#include "ar6000_drv.h" -#ifdef ATH6K_CONFIG_CFG80211 -#include "cfg80211.h" -#endif /* ATH6K_CONFIG_CFG80211 */ -#include "htc.h" -#include "wmi_filter_linux.h" -#include "epping_test.h" -#include "wlan_config.h" -#include "ar3kconfig.h" -#include "dfs_host.h" -#include "ar6k_pal.h" -#include "AR6002/addrs.h" -#include "target_reg_table.h" -#include "p2p_api.h" - -/* LINUX_HACK_FUDGE_FACTOR -- this is used to provide a workaround for linux behavior. When - * the meta data was added to the header it was found that linux did not correctly provide - * enough headroom. However when more headroom was requested beyond what was truly needed - * Linux gave the requested headroom. Therefore to get the necessary headroom from Linux - * the driver requests more than is needed by the amount = LINUX_HACK_FUDGE_FACTOR */ -#define LINUX_HACK_FUDGE_FACTOR 16 -#define BDATA_BDADDR_OFFSET 28 - -A_UINT8 bcast_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -A_UINT8 null_mac[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; - -#ifdef DEBUG - -#define ATH_DEBUG_DBG_LOG ATH_DEBUG_MAKE_MODULE_MASK(0) -#define ATH_DEBUG_WLAN_CONNECT ATH_DEBUG_MAKE_MODULE_MASK(1) -#define ATH_DEBUG_WLAN_SCAN ATH_DEBUG_MAKE_MODULE_MASK(2) -#define ATH_DEBUG_WLAN_TX ATH_DEBUG_MAKE_MODULE_MASK(3) -#define ATH_DEBUG_WLAN_RX ATH_DEBUG_MAKE_MODULE_MASK(4) -#define ATH_DEBUG_HTC_RAW ATH_DEBUG_MAKE_MODULE_MASK(5) -#define ATH_DEBUG_HCI_BRIDGE ATH_DEBUG_MAKE_MODULE_MASK(6) - -static ATH_DEBUG_MASK_DESCRIPTION driver_debug_desc[] = { - { ATH_DEBUG_DBG_LOG , "Target Debug Logs"}, - { ATH_DEBUG_WLAN_CONNECT , "WLAN connect"}, - { ATH_DEBUG_WLAN_SCAN , "WLAN scan"}, - { ATH_DEBUG_WLAN_TX , "WLAN Tx"}, - { ATH_DEBUG_WLAN_RX , "WLAN Rx"}, - { ATH_DEBUG_HTC_RAW , "HTC Raw IF tracing"}, - { ATH_DEBUG_HCI_BRIDGE , "HCI Bridge Setup"}, - { ATH_DEBUG_HCI_RECV , "HCI Recv tracing"}, - { ATH_DEBUG_HCI_DUMP , "HCI Packet dumps"}, -}; - -ATH_DEBUG_INSTANTIATE_MODULE_VAR(driver, - "driver", - "Linux Driver Interface", - ATH_DEBUG_MASK_DEFAULTS | ATH_DEBUG_WLAN_SCAN | - ATH_DEBUG_HCI_BRIDGE, - ATH_DEBUG_DESCRIPTION_COUNT(driver_debug_desc), - driver_debug_desc); - -#endif - - -#define IS_MAC_NULL(mac) (mac[0]==0 && mac[1]==0 && mac[2]==0 && mac[3]==0 && mac[4]==0 && mac[5]==0) -#define IS_MAC_BCAST(mac) (*mac==0xff) - -#define DESCRIPTION "Driver to access the Atheros AR600x Device, version " __stringify(__VER_MAJOR_) "." __stringify(__VER_MINOR_) "." __stringify(__VER_PATCH_) "." __stringify(__BUILD_NUMBER_) - -MODULE_AUTHOR("Atheros Communications, Inc."); -MODULE_DESCRIPTION(DESCRIPTION); -MODULE_LICENSE("GPL and additional rights"); - -#ifndef REORG_APTC_HEURISTICS -#undef ADAPTIVE_POWER_THROUGHPUT_CONTROL -#endif /* REORG_APTC_HEURISTICS */ - -#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL -A_TIMER aptcTimer[NUM_DEV]; -#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -// callbacks registered by HCI transport driver -HCI_TRANSPORT_CALLBACKS ar6kHciTransCallbacks = { NULL }; -#endif - -unsigned int processDot11Hdr = 0; -char targetconf[10]={0,}; -int bmienable = BMIENABLE_DEFAULT; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -char ifname[IFNAMSIZ] = {0,}; -char devmode[32] ={0,}; -char submode[32] ={0,}; -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */ - -int regcode = 0x60; -int wlaninitmode = WLAN_INIT_MODE_DEFAULT; -unsigned int bypasswmi = 0; -unsigned int debuglevel = 0; -int tspecCompliance = ATHEROS_COMPLIANCE; -unsigned int busspeedlow = 0; -unsigned int onebitmode = 0; -unsigned int skipflash = 0; -unsigned int wmitimeout = 2; -unsigned int wlanNodeCaching = 1; -unsigned int enableuartprint = ENABLEUARTPRINT_DEFAULT; -unsigned int logWmiRawMsgs = 0; -unsigned int enabletimerwar = 0; -unsigned int fwmode = 1; -unsigned int fwsubmode = 0; -unsigned int mbox_yield_limit = 99; -unsigned int enablerssicompensation = 0; -int reduce_credit_dribble = 1 + HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_HALF; -int allow_trace_signal = 0; -#ifdef CONFIG_HOST_TCMD_SUPPORT -unsigned int testmode =0; -#endif -unsigned int firmware_bridge = 0; - -unsigned int irqprocmode = HIF_DEVICE_IRQ_SYNC_ONLY;//HIF_DEVICE_IRQ_ASYNC_SYNC; -unsigned int panic_on_assert = 1; -unsigned int nohifscattersupport = NOHIFSCATTERSUPPORT_DEFAULT; - -unsigned int setuphci = SETUPHCI_DEFAULT; -unsigned int setuphcipal = SETUPHCIPAL_DEFAULT; -unsigned int loghci = 0; -unsigned int setupbtdev = SETUPBTDEV_DEFAULT; -#ifndef EXPORT_HCI_BRIDGE_INTERFACE -unsigned int ar3khcibaud = AR3KHCIBAUD_DEFAULT; -unsigned int hciuartscale = HCIUARTSCALE_DEFAULT; -unsigned int hciuartstep = HCIUARTSTEP_DEFAULT; -#endif -#ifdef CONFIG_CHECKSUM_OFFLOAD -unsigned int csumOffload=0; -unsigned int csumOffloadTest=0; -#endif -unsigned int eppingtest=0; -unsigned int regscanmode=0; -unsigned int num_device=1; -unsigned char ar6k_init=FALSE; -unsigned int rtc_reset_only_on_exit=0; -unsigned int mac_addr_method=0; -A_BOOL avail_ev_called=FALSE; - - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -module_param_string(ifname, ifname, sizeof(ifname), 0644); -module_param(regcode, int, 0644); -module_param(wlaninitmode, int, 0644); -module_param(bmienable, int, 0644); -module_param(bypasswmi, uint, 0644); -module_param(debuglevel, uint, 0644); -module_param(tspecCompliance, int, 0644); -module_param(onebitmode, uint, 0644); -module_param(busspeedlow, uint, 0644); -module_param(skipflash, uint, 0644); -module_param(wmitimeout, uint, 0644); -module_param(wlanNodeCaching, uint, 0644); -module_param(logWmiRawMsgs, uint, 0644); -module_param(enableuartprint, uint, 0644); -module_param(enabletimerwar, uint, 0644); -module_param(mbox_yield_limit, uint, 0644); -module_param(reduce_credit_dribble, int, 0644); -module_param(allow_trace_signal, int, 0644); -module_param(enablerssicompensation, uint, 0644); -module_param(processDot11Hdr, uint, 0644); -#ifdef CONFIG_CHECKSUM_OFFLOAD -module_param(csumOffload, uint, 0644); -#endif -#ifdef CONFIG_HOST_TCMD_SUPPORT -module_param(testmode, uint, 0644); -#endif -module_param(firmware_bridge, uint, 0644); -module_param(irqprocmode, uint, 0644); -module_param(nohifscattersupport, uint, 0644); -module_param(panic_on_assert, uint, 0644); -module_param(setuphci, uint, 0644); -module_param(setuphcipal, uint, 0644); -module_param(loghci, uint, 0644); -module_param(setupbtdev, uint, 0644); -#ifndef EXPORT_HCI_BRIDGE_INTERFACE -module_param(ar3khcibaud, uint, 0644); -module_param(hciuartscale, uint, 0644); -module_param(hciuartstep, uint, 0644); -#endif -module_param(eppingtest, uint, 0644); -module_param(regscanmode, uint, 0644); -module_param_string(devmode, devmode, sizeof(devmode), 0644); -module_param_string(submode, submode, sizeof(submode), 0644); -module_param_string(targetconf, targetconf, sizeof(targetconf), 0644); -module_param(rtc_reset_only_on_exit, uint, 0644); -module_param(mac_addr_method, uint, 0644); -#else - -#define __user -/* for linux 2.4 and lower */ -MODULE_PARM(bmienable,"i"); -MODULE_PARM(wlaninitmode,"i"); -MODULE_PARM(bypasswmi,"i"); -MODULE_PARM(debuglevel, "i"); -MODULE_PARM(onebitmode,"i"); -MODULE_PARM(busspeedlow, "i"); -MODULE_PARM(skipflash, "i"); -MODULE_PARM(wmitimeout, "i"); -MODULE_PARM(wlanNodeCaching, "i"); -MODULE_PARM(enableuartprint,"i"); -MODULE_PARM(logWmiRawMsgs, "i"); -MODULE_PARM(enabletimerwar,"i"); -MODULE_PARM(mbox_yield_limit,"i"); -MODULE_PARM(reduce_credit_dribble,"i"); -MODULE_PARM(allow_trace_signal,"i"); -MODULE_PARM(enablerssicompensation,"i"); -MODULE_PARM(processDot11Hdr,"i"); -#ifdef CONFIG_CHECKSUM_OFFLOAD -MODULE_PARM(csumOffload,"i"); -#endif -#ifdef CONFIG_HOST_TCMD_SUPPORT -MODULE_PARM(testmode, "i"); -#endif -MODULE_PARM(irqprocmode, "i"); -MODULE_PARM(nohifscattersupport, "i"); -MODULE_PARM(panic_on_assert, "i"); -MODULE_PARM(setuphci, "i"); -MODULE_PARM(setuphcipal, "i"); -MODULE_PARM(loghci, "i"); -MODULE_PARM(regscanmode, "i"); -MODULE_PARM(rtc_reset_only_on_exit, "i"); -MODULE_PARM(mac_addr_method, "i"); -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) -/* in 2.6.10 and later this is now a pointer to a uint */ -unsigned int _mboxnum = HTC_MAILBOX_NUM_MAX; -#define mboxnum &_mboxnum -#else -unsigned int mboxnum = HTC_MAILBOX_NUM_MAX; -#endif - -#ifdef DEBUG -A_UINT32 g_dbg_flags = DBG_DEFAULTS; -unsigned int debugflags = 0; -int debugdriver = 0; -unsigned int debughtc = 0; -unsigned int debugbmi = 0; -unsigned int debughif = 0; -unsigned int txcreditsavailable[HTC_MAILBOX_NUM_MAX] = {0}; -unsigned int txcreditsconsumed[HTC_MAILBOX_NUM_MAX] = {0}; -unsigned int txcreditintrenable[HTC_MAILBOX_NUM_MAX] = {0}; -unsigned int txcreditintrenableaggregate[HTC_MAILBOX_NUM_MAX] = {0}; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -module_param(debugflags, uint, 0644); -module_param(debugdriver, int, 0644); -module_param(debughtc, uint, 0644); -module_param(debugbmi, uint, 0644); -module_param(debughif, uint, 0644); -module_param_array(txcreditsavailable, uint, mboxnum, 0644); -module_param_array(txcreditsconsumed, uint, mboxnum, 0644); -module_param_array(txcreditintrenable, uint, mboxnum, 0644); -module_param_array(txcreditintrenableaggregate, uint, mboxnum, 0644); -#else -/* linux 2.4 and lower */ -MODULE_PARM(debugflags,"i"); -MODULE_PARM(debugdriver, "i"); -MODULE_PARM(debughtc, "i"); -MODULE_PARM(debugbmi, "i"); -MODULE_PARM(debughif, "i"); -MODULE_PARM(txcreditsavailable, "0-3i"); -MODULE_PARM(txcreditsconsumed, "0-3i"); -MODULE_PARM(txcreditintrenable, "0-3i"); -MODULE_PARM(txcreditintrenableaggregate, "0-3i"); -#endif - -#endif /* DEBUG */ - -#ifdef RK29 -unsigned int resetok = 0; -#else -unsigned int resetok = 1; -#endif -unsigned int tx_attempt[HTC_MAILBOX_NUM_MAX] = {0}; -unsigned int tx_post[HTC_MAILBOX_NUM_MAX] = {0}; -unsigned int tx_complete[HTC_MAILBOX_NUM_MAX] = {0}; -unsigned int hifBusRequestNumMax = 40; -unsigned int war23838_disabled = 0; -#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL -unsigned int enableAPTCHeuristics = 1; -#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -module_param_array(tx_attempt, uint, mboxnum, 0644); -module_param_array(tx_post, uint, mboxnum, 0644); -module_param_array(tx_complete, uint, mboxnum, 0644); -module_param(hifBusRequestNumMax, uint, 0644); -module_param(war23838_disabled, uint, 0644); -module_param(resetok, uint, 0644); -#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL -module_param(enableAPTCHeuristics, uint, 0644); -#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ -#else -MODULE_PARM(tx_attempt, "0-3i"); -MODULE_PARM(tx_post, "0-3i"); -MODULE_PARM(tx_complete, "0-3i"); -MODULE_PARM(hifBusRequestNumMax, "i"); -MODULE_PARM(war23838_disabled, "i"); -MODULE_PARM(resetok, "i"); -#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL -MODULE_PARM(enableAPTCHeuristics, "i"); -#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ -#endif - -#ifdef BLOCK_TX_PATH_FLAG -int blocktx = 0; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -module_param(blocktx, int, 0644); -#else -MODULE_PARM(blocktx, "i"); -#endif -#endif /* BLOCK_TX_PATH_FLAG */ - -static A_INT16 rssi_compensation_table[NUM_DEV][96]; - -int reconnect_flag = 0; -static ar6k_pal_config_t ar6k_pal_config_g; - -/* Function declarations */ -static int ar6000_init_module(void); -static void ar6000_cleanup_module(void); - -int ar6000_init(struct net_device *dev); -static int ar6000_open(struct net_device *dev); -static int ar6000_close(struct net_device *dev); -static int ar6000_init_control_info(AR_SOFTC_DEV_T *arPriv); -static int ar6000_data_tx(struct sk_buff *skb, struct net_device *dev); - -void ar6000_destroy(struct net_device *dev, unsigned int unregister); -void ar6000_cleanup(AR_SOFTC_T *ar); -static void ar6000_detect_error(unsigned long ptr); -static void ar6000_set_multicast_list(struct net_device *dev); -static struct net_device_stats *ar6000_get_stats(struct net_device *dev); -static struct iw_statistics *ar6000_get_iwstats(struct net_device * dev); - -static void disconnect_timer_handler(unsigned long ptr); -static void ap_acs_handler(unsigned long ptr); - -void read_rssi_compensation_param(AR_SOFTC_T *ar); -void target_register_tbl_attach(A_UINT32 target_type); -static void ar6000_uapsd_trigger_frame_rx(AR_SOFTC_DEV_T *arPriv, conn_t *conn); - - /* for android builds we call external APIs that handle firmware download and configuration */ -#ifdef ANDROID_ENV -/* !!!! Interim android support to make it easier to patch the default driver for - * android use. You must define an external source file ar6000_android.c that handles the following - * APIs */ -extern void android_module_init(OSDRV_CALLBACKS *osdrvCallbacks); -extern void android_module_exit(void); -extern void android_send_reload_event(AR_SOFTC_DEV_T *arPriv); -#define ANDROID_RELOAD_THRESHOLD_FOR_EP_FULL 5 -static int android_epfull_cnt; -#endif -/* - * HTC service connection handlers - */ -static A_STATUS ar6000_avail_ev(void *context, void *hif_handle); - -static A_STATUS ar6000_unavail_ev(void *context, void *hif_handle); - -A_STATUS ar6000_configure_target(AR_SOFTC_T *ar); - -static void ar6000_target_failure(void *Instance, A_STATUS Status); - -static void ar6000_rx(void *Context, HTC_PACKET *pPacket); - -static void ar6000_rx_refill(void *Context,HTC_ENDPOINT_ID Endpoint); - -static void ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPackets); - -static HTC_SEND_FULL_ACTION ar6000_tx_queue_full(void *Context, HTC_PACKET *pPacket); - -#ifdef ATH_AR6K_11N_SUPPORT -static void ar6000_alloc_netbufs(A_NETBUF_QUEUE_T *q, A_UINT16 num); -#endif -static void ar6000_deliver_frames_to_nw_stack(void * dev, void *osbuf); -//static void ar6000_deliver_frames_to_bt_stack(void * dev, void *osbuf); - -static HTC_PACKET *ar6000_alloc_amsdu_rxbuf(void *Context, HTC_ENDPOINT_ID Endpoint, int Length); - -static void ar6000_refill_amsdu_rxbufs(AR_SOFTC_T *ar, int Count); - -static void ar6000_cleanup_amsdu_rxbufs(AR_SOFTC_T *ar); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) -static ssize_t -ar6000_sysfs_bmi_read(struct kobject *kobj, struct bin_attribute *bin_attr, - char *buf, loff_t pos, size_t count); - -static ssize_t -ar6000_sysfs_bmi_write(struct kobject *kobj, struct bin_attribute *bin_attr, - char *buf, loff_t pos, size_t count); -#else -static ssize_t -ar6000_sysfs_bmi_read(struct file *fp, struct kobject *kobj, - struct bin_attribute *bin_attr, - char *buf, loff_t pos, size_t count); - -static ssize_t -ar6000_sysfs_bmi_write(struct file *fp, struct kobject *kobj, - struct bin_attribute *bin_attr, - char *buf, loff_t pos, size_t count); -#endif - -static A_STATUS -ar6000_sysfs_bmi_init(AR_SOFTC_T *ar); - -/* HCI PAL callback function declarations */ -A_STATUS ar6k_setup_hci_pal(AR_SOFTC_DEV_T *ar); -void ar6k_cleanup_hci_pal(AR_SOFTC_DEV_T *ar); - -static void -ar6000_sysfs_bmi_deinit(AR_SOFTC_T *ar); - -A_STATUS -ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode); - -/* - * Static variables - */ - -struct net_device *ar6000_devices[NUM_DEV]; -extern struct iw_handler_def ath_iw_handler_def; -static void ar6000_cookie_init(AR_SOFTC_T *ar); -static void ar6000_cookie_cleanup(AR_SOFTC_T *ar); -static void ar6000_free_cookie(AR_SOFTC_T *ar, struct ar_cookie * cookie); -static struct ar_cookie *ar6000_alloc_cookie(AR_SOFTC_T *ar); - -#ifdef USER_KEYS -static A_STATUS ar6000_reinstall_keys(AR_SOFTC_DEV_T *arPriv,A_UINT8 key_op_ctrl); -#endif - - -static struct ar_cookie s_ar_cookie_mem[MAX_COOKIE_NUM]; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) -static struct net_device_ops ar6000_netdev_ops = { - .ndo_init = NULL, - .ndo_open = ar6000_open, - .ndo_stop = ar6000_close, - .ndo_get_stats = ar6000_get_stats, - .ndo_do_ioctl = ar6000_ioctl, - .ndo_start_xmit = ar6000_data_tx, - .ndo_set_multicast_list = ar6000_set_multicast_list, - .ndo_change_mtu = eth_change_mtu, -}; -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) */ - -/* Debug log support */ - -/* - * Flag to govern whether the debug logs should be parsed in the kernel - * or reported to the application. - */ -#define REPORT_DEBUG_LOGS_TO_APP - -A_STATUS -ar6000_set_host_app_area(AR_SOFTC_T *ar) -{ - A_UINT32 address, data; - struct host_app_area_s host_app_area; - - /* Fetch the address of the host_app_area_s instance in the host interest area */ - address = TARG_VTOP(ar->arTargetType, HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_app_host_interest)); - if (ar6000_ReadRegDiag(ar->arHifDevice, &address, &data) != A_OK) { - return A_ERROR; - } - address = TARG_VTOP(ar->arTargetType, data); - host_app_area.wmi_protocol_ver = WMI_PROTOCOL_VERSION; - if (ar6000_WriteDataDiag(ar->arHifDevice, address, - (A_UCHAR *)&host_app_area, - sizeof(struct host_app_area_s)) != A_OK) - { - return A_ERROR; - } - - return A_OK; -} - -A_UINT32 -dbglog_get_debug_hdr_ptr(AR_SOFTC_T *ar) -{ - A_UINT32 param; - A_UINT32 address; - A_STATUS status; - - address = TARG_VTOP(ar->arTargetType, HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_dbglog_hdr)); - if ((status = ar6000_ReadDataDiag(ar->arHifDevice, address, - (A_UCHAR *)¶m, 4)) != A_OK) - { - param = 0; - } - - return param; -} - -/* - * The dbglog module has been initialized. Its ok to access the relevant - * data stuctures over the diagnostic window. - */ -void -ar6000_dbglog_init_done(AR_SOFTC_DEV_T *arPriv) -{ - AR_SOFTC_T *ar = arPriv->arSoftc; - ar->dbglog_init_done = TRUE; -} - -A_UINT32 -dbglog_get_debug_fragment(A_INT8 *datap, A_UINT32 len, A_UINT32 limit) -{ - A_INT32 *buffer; - A_UINT32 count; - A_UINT32 numargs; - A_UINT32 length; - A_UINT32 fraglen; - - count = fraglen = 0; - buffer = (A_INT32 *)datap; - length = (limit >> 2); - - if (len <= limit) { - fraglen = len; - } else { - while (count < length) { - numargs = DBGLOG_GET_NUMARGS(buffer[count]); - fraglen = (count << 2); - count += numargs + 1; - } - } - - return fraglen; -} - -void -dbglog_parse_debug_logs(A_INT8 *datap, A_UINT32 len) -{ - A_INT32 *buffer; - A_UINT32 count; - A_UINT32 timestamp; - A_UINT32 debugid; - A_UINT32 moduleid; - A_UINT32 numargs; - A_UINT32 length; - - count = 0; - buffer = (A_INT32 *)datap; - length = (len >> 2); - while (count < length) { - debugid = DBGLOG_GET_DBGID(buffer[count]); - moduleid = DBGLOG_GET_MODULEID(buffer[count]); - numargs = DBGLOG_GET_NUMARGS(buffer[count]); - timestamp = DBGLOG_GET_TIMESTAMP(buffer[count]); - switch (numargs) { - case 0: - AR_DEBUG_PRINTF(ATH_DEBUG_DBG_LOG,("%d %d (%d)\n", moduleid, debugid, timestamp)); - break; - - case 1: - AR_DEBUG_PRINTF(ATH_DEBUG_DBG_LOG,("%d %d (%d): 0x%x\n", moduleid, debugid, - timestamp, buffer[count+1])); - break; - - case 2: - AR_DEBUG_PRINTF(ATH_DEBUG_DBG_LOG,("%d %d (%d): 0x%x, 0x%x\n", moduleid, debugid, - timestamp, buffer[count+1], buffer[count+2])); - break; - - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Invalid args: %d\n", numargs)); - } - count += numargs + 1; - } -} - -int -ar6000_dbglog_get_debug_logs(AR_SOFTC_T *ar) -{ - struct dbglog_hdr_s debug_hdr; - struct dbglog_buf_s debug_buf; - A_UINT32 address; - A_UINT32 length; - A_UINT32 dropped; - A_UINT32 firstbuf; - A_UINT32 debug_hdr_ptr; - - if (!ar->dbglog_init_done) return A_ERROR; - - - AR6000_SPIN_LOCK(&ar->arLock, 0); - - if (ar->dbgLogFetchInProgress) { - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - return A_EBUSY; - } - - /* block out others */ - ar->dbgLogFetchInProgress = TRUE; - - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - - debug_hdr_ptr = dbglog_get_debug_hdr_ptr(ar); - printk("debug_hdr_ptr: 0x%x\n", debug_hdr_ptr); - - /* Get the contents of the ring buffer */ - if (debug_hdr_ptr) { - address = TARG_VTOP(ar->arTargetType, debug_hdr_ptr); - length = sizeof(struct dbglog_hdr_s); - ar6000_ReadDataDiag(ar->arHifDevice, address, - (A_UCHAR *)&debug_hdr, length); - address = TARG_VTOP(ar->arTargetType, (A_UINT32)debug_hdr.dbuf); - firstbuf = address; - dropped = debug_hdr.dropped; - length = sizeof(struct dbglog_buf_s); - ar6000_ReadDataDiag(ar->arHifDevice, address, - (A_UCHAR *)&debug_buf, length); - - do { - address = TARG_VTOP(ar->arTargetType, (A_UINT32)debug_buf.buffer); - length = debug_buf.length; - if ((length) && (debug_buf.length <= debug_buf.bufsize)) { - /* Rewind the index if it is about to overrun the buffer */ - if (ar->log_cnt > (DBGLOG_HOST_LOG_BUFFER_SIZE - length)) { - ar->log_cnt = 0; - } - if(A_OK != ar6000_ReadDataDiag(ar->arHifDevice, address, - (A_UCHAR *)&ar->log_buffer[ar->log_cnt], length)) - { - break; - } - ar6000_dbglog_event(ar->arDev[0], dropped, (A_INT8*)&ar->log_buffer[ar->log_cnt], length); - ar->log_cnt += length; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_DBG_LOG,("Length: %d (Total size: %d)\n", - debug_buf.length, debug_buf.bufsize)); - } - - address = TARG_VTOP(ar->arTargetType, (A_UINT32)debug_buf.next); - length = sizeof(struct dbglog_buf_s); - if(A_OK != ar6000_ReadDataDiag(ar->arHifDevice, address, - (A_UCHAR *)&debug_buf, length)) - { - break; - } - - } while (address != firstbuf); - } - - ar->dbgLogFetchInProgress = FALSE; - - return A_OK; -} - -void -ar6000_dbglog_event(AR_SOFTC_DEV_T *arPriv, A_UINT32 dropped, - A_INT8 *buffer, A_UINT32 length) -{ -#ifdef REPORT_DEBUG_LOGS_TO_APP - #define MAX_WIRELESS_EVENT_SIZE 252 - /* - * Break it up into chunks of MAX_WIRELESS_EVENT_SIZE bytes of messages. - * There seems to be a limitation on the length of message that could be - * transmitted to the user app via this mechanism. - */ - A_UINT32 send, sent; - - sent = 0; - send = dbglog_get_debug_fragment(&buffer[sent], length - sent, - MAX_WIRELESS_EVENT_SIZE); - while (send) { - ar6000_send_event_to_app(arPriv, WMIX_DBGLOG_EVENTID, (A_UINT8*)&buffer[sent], send); - sent += send; - send = dbglog_get_debug_fragment(&buffer[sent], length - sent, - MAX_WIRELESS_EVENT_SIZE); - } -#else - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Dropped logs: 0x%x\nDebug info length: %d\n", - dropped, length)); - - /* Interpret the debug logs */ - dbglog_parse_debug_logs((A_INT8*)buffer, length); -#endif /* REPORT_DEBUG_LOGS_TO_APP */ -} - -void -ar6000_parse_dev_mode(A_CHAR *mode) -{ - A_UINT8 i, match = FALSE, mode_len; - A_UINT8 val_mode, val_submode; - A_UINT8 num_submode; - - char *valid_modes[] = { "sta", - "ap", - "ibss", - "bt30amp", - "sta,ap", - "ap,sta", - "ap,ap", - "sta,sta", - "sta,bt30amp", - "sta,ap,ap" - }; - char *valid_submodes[] = { "none", - "p2pdev", - /*"p2pclient",*/ //persistent p2p support - /*"p2pgo", */ // persistent p2p support - "none,none", - "none,none,none", - "none,p2pdev", - "p2pdev,none", - /*"none,p2pclient",*/ //persistent p2p support - /*"none,p2pgo"*/ // persistent p2p support - }; - - A_CHAR *dev_mode; - A_CHAR *str; - A_UINT32 host_int = 0; - - dev_mode = mode; - str = mode; - num_device = 0; - fwmode = 0; - - mode_len = strlen(dev_mode); - for (i=0; i <= 9; i++) { - if ((mode_len == strlen(valid_modes[i])) && (strcmp(dev_mode,valid_modes[i]))==0) { - match = TRUE; - break; - } - } - - if(!match) { - num_device = fwmode = 1; - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ERROR: Wrong mode. using default (single device STA mode).\n")); - return; - } - - do - { - str++; - if(*str == ',' || *str == '\0') { - num_device++; - if(strncmp(dev_mode,"ap",2) == 0) { - host_int = HI_OPTION_FW_MODE_AP; - } - else if(strncmp(dev_mode,"sta",3) == 0) { - host_int = HI_OPTION_FW_MODE_BSS_STA; - } - else if(strncmp(dev_mode,"ibss",4) == 0 ) { - host_int = HI_OPTION_FW_MODE_IBSS; - } else if(strncmp(dev_mode,"bt30amp",7) == 0) { - host_int = HI_OPTION_FW_MODE_BT30AMP; - } - - fwmode |= (host_int << ((num_device -1) * HI_OPTION_FW_MODE_BITS)); - dev_mode = ++str; - } - }while(*dev_mode != '\0'); - - /* Validate submode if present */ - if (!submode[0]) { - /* default "none" submode for all devices */ - fwsubmode = 0; - return; - } - - dev_mode = submode; - str = submode; - num_submode = 0; - fwsubmode = 0; - match = FALSE; - - mode_len = strlen(dev_mode); - for (i=0; i<6; i++) { - if ((mode_len == strlen(valid_submodes[i])) && (strcmp(dev_mode,valid_submodes[i]))==0) { - match = TRUE; - break; - } - } - - if (!match) { - fwsubmode = 0; - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ERROR: Wrong submode. using default (none for all devs).\n")); - return; - } - - do - { - str++; - if(*str == ',' || *str == '\0') { - num_submode++; - if(strncmp(dev_mode,"none",4) == 0) { - host_int = HI_OPTION_FW_SUBMODE_NONE; - } - else if(strncmp(dev_mode,"p2pdev",6) == 0) { - host_int = HI_OPTION_FW_SUBMODE_P2PDEV; - } - else if(strncmp(dev_mode,"p2pclient",9) == 0 ) { - host_int = HI_OPTION_FW_SUBMODE_P2PCLIENT; - } else if(strncmp(dev_mode,"p2pgo",5) == 0 ) { - host_int = HI_OPTION_FW_SUBMODE_P2PGO; - } - fwsubmode |= (host_int << ((num_submode -1) * HI_OPTION_FW_SUBMODE_BITS)); - dev_mode = ++str; - } - }while(*dev_mode != '\0'); - - /* Validate if the subopmode is specified for all the devs. - */ - if (num_device != num_submode) { - /* default to "none" submode for all devices */ - fwsubmode = 0; - return; - } - - /* Validate if the submode specified is appropriate for the device modes - * specified for each device. The following is the validation recipe. - * fwmode fwsubmode - * ----------------------- - * IBSS none - * STA none,p2pdev,p2pclient - * AP none,p2pgo - */ - for (i=0; i> (i * HI_OPTION_FW_MODE_BITS)) & - HI_OPTION_FW_MODE_MASK; - val_submode = (fwsubmode >> (i * HI_OPTION_FW_SUBMODE_BITS)) & - HI_OPTION_FW_SUBMODE_MASK; - switch (val_mode) { - case HI_OPTION_FW_MODE_IBSS: - if (val_submode != HI_OPTION_FW_SUBMODE_NONE) { - /* set submode to none */ - fwsubmode &= ~(HI_OPTION_FW_SUBMODE_MASK << (i*HI_OPTION_FW_SUBMODE_BITS)); - fwsubmode |= (HI_OPTION_FW_SUBMODE_NONE << (i * HI_OPTION_FW_SUBMODE_BITS)); - } - break; - - case HI_OPTION_FW_MODE_BSS_STA: - if (val_submode == HI_OPTION_FW_SUBMODE_P2PGO) { - /* set submode to none */ - fwsubmode &= ~(HI_OPTION_FW_SUBMODE_MASK << (i*HI_OPTION_FW_SUBMODE_BITS)); - fwsubmode |= (HI_OPTION_FW_SUBMODE_NONE << (i * HI_OPTION_FW_SUBMODE_BITS)); - } - - break; - case HI_OPTION_FW_MODE_AP: - if (val_submode == HI_OPTION_FW_SUBMODE_P2PDEV || - val_submode == HI_OPTION_FW_SUBMODE_P2PCLIENT) { - /* set submode to none */ - fwsubmode &= ~(HI_OPTION_FW_SUBMODE_MASK << (i*HI_OPTION_FW_SUBMODE_BITS)); - fwsubmode |= (HI_OPTION_FW_SUBMODE_NONE << (i * HI_OPTION_FW_SUBMODE_BITS)); - } - break; - - default: - break; - } - } - - return; -} - -#ifdef RK29 -static int -#else -static int __init -#endif -ar6000_init_module(void) -{ -#ifndef RK29 - static int probed = 0; -#endif - A_STATUS status; - OSDRV_CALLBACKS osdrvCallbacks; - - a_module_debug_support_init(); - -#ifdef DEBUG - /* check for debug mask overrides */ - if (debughtc != 0) { - ATH_DEBUG_SET_DEBUG_MASK(htc,debughtc); - } - if (debugbmi != 0) { - ATH_DEBUG_SET_DEBUG_MASK(bmi,debugbmi); - } - if (debughif != 0) { - ATH_DEBUG_SET_DEBUG_MASK(hif,debughif); - } - if (debugdriver != 0) { - ATH_DEBUG_SET_DEBUG_MASK(driver,debugdriver); - } - -#endif - - A_REGISTER_MODULE_DEBUG_INFO(driver); - ar6k_init = FALSE; - A_MEMZERO(&osdrvCallbacks,sizeof(osdrvCallbacks)); - osdrvCallbacks.deviceInsertedHandler = ar6000_avail_ev; - osdrvCallbacks.deviceRemovedHandler = ar6000_unavail_ev; - -#ifdef CONFIG_PM - osdrvCallbacks.deviceSuspendHandler = ar6000_suspend_ev; - osdrvCallbacks.deviceResumeHandler = ar6000_resume_ev; - osdrvCallbacks.devicePowerChangeHandler = ar6000_power_change_ev; -#endif - -#ifndef RK29 - ar6000_pm_init(); -#endif - - if(devmode[0]) - ar6000_parse_dev_mode(devmode); - -#ifdef ANDROID_ENV - android_module_init(&osdrvCallbacks); -#endif - -#ifdef DEBUG - /* Set the debug flags if specified at load time */ - if(debugflags != 0) - { - g_dbg_flags = debugflags; - } -#endif - -#ifndef RK29 - if (probed) { - return -ENODEV; - } - probed++; -#endif - -#ifdef CONFIG_HOST_GPIO_SUPPORT - ar6000_gpio_init(); -#endif /* CONFIG_HOST_GPIO_SUPPORT */ - - status = HIFInit(&osdrvCallbacks); - if(status != A_OK) - return -ENODEV; - - return 0; -} - -#ifdef RK29 -static void -#else -static void __exit -#endif -ar6000_cleanup_module(void) -{ - int i = 0; - struct net_device *ar6000_netdev; - AR_SOFTC_T *ar; - AR_SOFTC_DEV_T *arPriv = NULL; - - if(ar6000_devices[0] != NULL) { - arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(ar6000_devices[0]); - ar = arPriv->arSoftc; - ar6000_cleanup(ar); - } - for (i=0; i < num_device; i++) { -#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL - /* Delete the Adaptive Power Control timer */ - if (timer_pending(&aptcTimer[i])) { - del_timer_sync(&aptcTimer[i]); - } -#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ - if (ar6000_devices[i] != NULL) { - ar6000_netdev = ar6000_devices[i]; - ar6000_devices[i] = NULL; - ar6000_destroy(ar6000_netdev, 1); - if (arPriv) - A_UNTIMEOUT(&arPriv->arSta.disconnect_timer); - } - } - - HIFShutDownDevice(NULL); - - a_module_debug_support_cleanup(); - -#ifndef RK29 - ar6000_pm_exit(); -#endif - -#ifdef ANDROID_ENV - android_module_exit(); -#endif - a_meminfo_report(TRUE); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ar6000_cleanup: success\n")); -} - -#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL -void -aptcTimerHandler(unsigned long arg) -{ - A_UINT32 numbytes; - A_UINT32 throughput; - AR_SOFTC_T *ar; - A_STATUS status; - APTC_TRAFFIC_RECORD *aptcTR; - A_UNIT8 i; - - ar = (AR_SOFTC_T *)arg; - A_ASSERT(ar != NULL); - - for(i = 0; i < num_device; i++) { - aptcTR = ar->arDev[i].aptcTR; - A_ASSERT(!timer_pending(&aptcTimer[i])); - AR6000_SPIN_LOCK(&ar->arLock, 0); - - /* Get the number of bytes transferred */ - numbytes = aptcTR->bytesTransmitted + aptcTR->bytesReceived; - aptcTR->bytesTransmitted = aptcTR->bytesReceived = 0; - - /* Calculate and decide based on throughput thresholds */ - throughput = ((numbytes * 8)/APTC_TRAFFIC_SAMPLING_INTERVAL); /* Kbps */ - if (throughput < APTC_LOWER_THROUGHPUT_THRESHOLD) { - /* Enable Sleep and delete the timer */ - A_ASSERT(ar->arWmiReady == TRUE); - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - status = wmi_powermode_cmd(ar->arWmi, REC_POWER); - AR6000_SPIN_LOCK(&ar->arLock, 0); - A_ASSERT(status == A_OK); - aptcTR->timerScheduled = FALSE; - } else { - A_TIMEOUT_MS(&aptcTimer[i], APTC_TRAFFIC_SAMPLING_INTERVAL, 0); - } - - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - } -} -#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ - -#ifdef ATH_AR6K_11N_SUPPORT -static void -ar6000_alloc_netbufs(A_NETBUF_QUEUE_T *q, A_UINT16 num) -{ - void * osbuf; - - while(num) { - if((osbuf = A_NETBUF_ALLOC(AR6000_BUFFER_SIZE))) { - A_NETBUF_ENQUEUE(q, osbuf); - } else { - break; - } - num--; - } - - if(num) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s(), allocation of netbuf failed", __func__)); - } -} -#endif - -static struct bin_attribute bmi_attr = { - .attr = {.name = "bmi", .mode = 0600}, - .read = ar6000_sysfs_bmi_read, - .write = ar6000_sysfs_bmi_write, -}; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) -static ssize_t -ar6000_sysfs_bmi_read(struct kobject *kobj, struct bin_attribute *bin_attr, - char *buf, loff_t pos, size_t count) -#else -static ssize_t -ar6000_sysfs_bmi_read(struct file *fp, struct kobject *kobj, - struct bin_attribute *bin_attr, - char *buf, loff_t pos, size_t count) -#endif -{ - int index; - AR_SOFTC_DEV_T *arPriv; - AR_SOFTC_T *ar = NULL; - HIF_DEVICE_OS_DEVICE_INFO *osDevInfo; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Read %d bytes\n", count)); - for (index=0; index < num_device; index++) { - arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(ar6000_devices[index]); - ar = arPriv->arSoftc; - osDevInfo = &ar->osDevInfo; - if (kobj == (&(((struct device *)osDevInfo->pOSDevice)->kobj))) { - break; - } - } - - if (ar == NULL) return 0; - if (index == num_device) return 0; - - if ((BMIRawRead(ar->arHifDevice, (A_UCHAR*)buf, count, TRUE)) != A_OK) { - return 0; - } - - return count; -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) -static ssize_t -ar6000_sysfs_bmi_write(struct kobject *kobj, struct bin_attribute *bin_attr, - char *buf, loff_t pos, size_t count) -#else -static ssize_t -ar6000_sysfs_bmi_write(struct file *fp, struct kobject *kobj, - struct bin_attribute *bin_attr, - char *buf, loff_t pos, size_t count) -#endif -{ - int index; - AR_SOFTC_DEV_T *arPriv; - AR_SOFTC_T *ar = NULL; - HIF_DEVICE_OS_DEVICE_INFO *osDevInfo; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Write %d bytes\n", count)); - for (index=0; index < num_device; index++) { - arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(ar6000_devices[index]); - ar = arPriv->arSoftc; - osDevInfo = &ar->osDevInfo; - if (kobj == (&(((struct device *)osDevInfo->pOSDevice)->kobj))) { - break; - } - } - - if (ar == NULL) return 0; - if (index == num_device) return 0; - - if ((BMIRawWrite(ar->arHifDevice, (A_UCHAR*)buf, count)) != A_OK) { - return 0; - } - - return count; -} - -static A_STATUS -ar6000_sysfs_bmi_init(AR_SOFTC_T *ar) -{ - A_STATUS status; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Creating sysfs entry\n")); - A_MEMZERO(&ar->osDevInfo, sizeof(HIF_DEVICE_OS_DEVICE_INFO)); - - /* Get the underlying OS device */ - status = HIFConfigureDevice(ar->arHifDevice, - HIF_DEVICE_GET_OS_DEVICE, - &ar->osDevInfo, - sizeof(HIF_DEVICE_OS_DEVICE_INFO)); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI: Failed to get OS device info from HIF\n")); - return A_ERROR; - } - - /* Create a bmi entry in the sysfs filesystem */ - if ((sysfs_create_bin_file(&(((struct device *)ar->osDevInfo.pOSDevice)->kobj), &bmi_attr)) < 0) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMI: Failed to create entry for bmi in sysfs filesystem\n")); - return A_ERROR; - } - - return A_OK; -} - -static void -ar6000_sysfs_bmi_deinit(AR_SOFTC_T *ar) -{ - if (ar->osDevInfo.pOSDevice) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Deleting sysfs entry\n")); - sysfs_remove_bin_file(&(((struct device *)ar->osDevInfo.pOSDevice)->kobj), &bmi_attr); - ar->osDevInfo.pOSDevice = NULL; - } -} - -#define bmifn(fn) do { \ - if ((fn) < A_OK) { \ - A_PRINTF("BMI operation failed: %d\n", __LINE__); \ - return A_ERROR; \ - } \ -} while(0) - -#ifdef INIT_MODE_DRV_ENABLED - -#define MCKINLEY_MAC_ADDRESS_OFFSET 0x16 -static -void calculate_crc(A_UINT32 TargetType, A_UCHAR *eeprom_data, size_t eeprom_size) -{ - A_UINT16 *ptr_crc; - A_UINT16 *ptr16_eeprom; - A_UINT16 checksum; - A_UINT32 i; - - if (TargetType == TARGET_TYPE_AR6001) - { - ptr_crc = (A_UINT16 *)eeprom_data; - } - else if (TargetType == TARGET_TYPE_AR6003) - { - ptr_crc = (A_UINT16 *)((A_UCHAR *)eeprom_data + 0x04); - } - else if (TargetType == TARGET_TYPE_MCKINLEY) - { - eeprom_size = 1024; - ptr_crc = (A_UINT16 *)((A_UCHAR *)eeprom_data + 0x04); - } - else - { - ptr_crc = (A_UINT16 *)((A_UCHAR *)eeprom_data + 0x04); - } - - - // Clear the crc - *ptr_crc = 0; - - // Recalculate new CRC - checksum = 0; - ptr16_eeprom = (A_UINT16 *)eeprom_data; - for (i = 0;i < eeprom_size; i += 2) - { - checksum = checksum ^ (*ptr16_eeprom); - ptr16_eeprom++; - } - checksum = 0xFFFF ^ checksum; - *ptr_crc = checksum; -} - -#ifdef SOFTMAC_FILE_USED -#define AR6002_MAC_ADDRESS_OFFSET 0x0A -#define AR6003_MAC_ADDRESS_OFFSET 0x16 -static void -ar6000_softmac_update(AR_SOFTC_T *ar, A_UCHAR *eeprom_data, size_t eeprom_size) -{ - /* We need to store the MAC, which comes either from the softmac file or is - * randomly generated, because we do not want to load a new MAC address - * if the chip goes into suspend and then is resumed later on. We ONLY - * want to load a new MAC if the driver is unloaded and then reloaded - */ - static A_UCHAR random_mac[6]; - const char *source = "random generated"; - const struct firmware *softmac_entry; - A_UCHAR *ptr_mac; - switch (ar->arTargetType) { - case TARGET_TYPE_AR6002: - ptr_mac = (A_UINT8 *)((A_UCHAR *)eeprom_data + AR6002_MAC_ADDRESS_OFFSET); - break; - case TARGET_TYPE_AR6003: - ptr_mac = (A_UINT8 *)((A_UCHAR *)eeprom_data + AR6003_MAC_ADDRESS_OFFSET); - break; - case TARGET_TYPE_MCKINLEY: - ptr_mac = (A_UINT8 *)((A_UCHAR *)eeprom_data + MCKINLEY_MAC_ADDRESS_OFFSET); - break; - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Invalid Target Type \n")); - return; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, - ("MAC from EEPROM %02X:%02X:%02X:%02X:%02X:%02X\n", - ptr_mac[0], ptr_mac[1], ptr_mac[2], - ptr_mac[3], ptr_mac[4], ptr_mac[5])); - - if (memcmp(random_mac, "\0\0\0\0\0\0", 6)!=0) { - memcpy(ptr_mac, random_mac, 6); - } else { - /* create a random MAC in case we cannot read file from system */ - ptr_mac[0] = random_mac[0] = 2; /* locally administered */ - ptr_mac[1] = random_mac[1] = 0x03; - ptr_mac[2] = random_mac[2] = 0x7F; - ptr_mac[3] = random_mac[3] = random32() & 0xff; - ptr_mac[4] = random_mac[4] = random32() & 0xff; - ptr_mac[5] = random_mac[5] = random32() & 0xff; - } - - if ((A_REQUEST_FIRMWARE(&softmac_entry, "softmac", ((struct device *)ar->osDevInfo.pOSDevice))) == 0) - { - A_CHAR *macbuf = A_MALLOC_NOWAIT(softmac_entry->size+1); - if (macbuf) { - unsigned int softmac[6]; - memcpy(macbuf, softmac_entry->data, softmac_entry->size); - macbuf[softmac_entry->size] = '\0'; - if (sscanf(macbuf, "%02x:%02x:%02x:%02x:%02x:%02x", - &softmac[0], &softmac[1], &softmac[2], - &softmac[3], &softmac[4], &softmac[5])==6) { - int i; - -#ifdef TCHIP - if(IS_MAC_NULL(softmac)) { - softmac[0]= 0x20; - softmac[1]= 0x59; - softmac[2]= 0xa0; - softmac[3]= (random32() & 0x0f) + 0x30; - softmac[4]= random32() & 0xff; - softmac[5]= random32() & 0xff; - - //write to the file. - sprintf(macbuf, - "%02x:%02x:%02x:%02x:%02x:%02x", - softmac[0], softmac[1], softmac[2], - softmac[3], softmac[4], softmac[5]); - { - extern void android_wifi_softmac_update(char *mac_buff, int len); - android_wifi_softmac_update(macbuf, softmac_entry->size); - } - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("MAC random %02X:%02X:%02X:%02X:%02X:%02X\n", - softmac[0], softmac[1], softmac[2], - softmac[3], softmac[4], softmac[5])); - - } -#endif - - for (i=0; i<6; ++i) { - ptr_mac[i] = softmac[i] & 0xff; - } - source = "softmac file"; - A_MEMZERO(random_mac, sizeof(random_mac)); - } - A_FREE(macbuf); - } - A_RELEASE_FIRMWARE(softmac_entry); - } - - if (memcmp(random_mac, "\0\0\0\0\0\0", 6)!=0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Warning! Random MAC address is just for testing purpose\n")); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, - ("MAC from %s %02X:%02X:%02X:%02X:%02X:%02X\n", source, - ptr_mac[0], ptr_mac[1], ptr_mac[2], - ptr_mac[3], ptr_mac[4], ptr_mac[5])); - calculate_crc(ar->arTargetType, eeprom_data, eeprom_size); -} -#endif /* SOFTMAC_FILE_USED */ - -static void -ar6000_reg_update(AR_SOFTC_T *ar, A_UCHAR *eeprom_data, size_t eeprom_size, int regCode) -{ - A_UCHAR *ptr_reg; - switch (ar->arTargetType) { - case TARGET_TYPE_AR6002: - ptr_reg = (A_UINT8 *)((A_UCHAR *)eeprom_data + 8); - break; - case TARGET_TYPE_AR6003: - ptr_reg = (A_UINT8 *)((A_UCHAR *)eeprom_data + 12); - break; - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Invalid Target Type \n")); - return; - } - - ptr_reg[0] = (A_UCHAR)(regCode&0xFF); - ptr_reg[1] = (A_UCHAR)((regCode>>8)&0xFF); - calculate_crc(ar->arTargetType, eeprom_data, eeprom_size); -} - -static A_STATUS -ar6000_transfer_bin_file(AR_SOFTC_T *ar, AR6K_BIN_FILE file, A_UINT32 address, A_BOOL compressed) -{ - A_STATUS status; - const char *filename; - const struct firmware *fw_entry; - A_UINT32 fw_entry_size; - A_UCHAR *tempEeprom; - A_UINT32 board_data_size; - - switch (file) { - case AR6K_OTP_FILE: - if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { - filename = AR6003_REV2_OTP_FILE; - } else if (ar->arVersion.target_ver == AR6003_REV3_VERSION) { - filename = AR6003_REV3_OTP_FILE; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown firmware revision: %d\n", ar->arVersion.target_ver)); - return A_ERROR; - } - break; - - case AR6K_FIRMWARE_FILE: - if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { - filename = AR6003_REV2_FIRMWARE_FILE; - } else if (ar->arVersion.target_ver == AR6003_REV3_VERSION) { - if(ar->arVersion.targetconf_ver == AR6003_SUBVER_ROUTER) - filename = AR6003_REV3_ROUTER_FIRMWARE_FILE; - else if (ar->arVersion.targetconf_ver == AR6003_SUBVER_MOBILE) - filename = AR6003_REV3_MOBILE_FIRMWARE_FILE; - else if (ar->arVersion.targetconf_ver == AR6003_SUBVER_TABLET) - filename = AR6003_REV3_TABLET_FIRMWARE_FILE; - else - filename = AR6003_REV3_DEFAULT_FIRMWARE_FILE; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown firmware revision: %d\n", ar->arVersion.target_ver)); - return A_ERROR; - } - - if (eppingtest) { - bypasswmi = TRUE; - if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { - filename = AR6003_REV2_EPPING_FIRMWARE_FILE; - } else if (ar->arVersion.target_ver == AR6003_REV3_VERSION) { - filename = AR6003_REV3_EPPING_FIRMWARE_FILE; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("eppingtest : unsupported firmware revision: %d\n", - ar->arVersion.target_ver)); - return A_ERROR; - } - compressed = 0; - } - -#ifdef CONFIG_HOST_TCMD_SUPPORT - if(testmode == 1) { - if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { - filename = AR6003_REV2_TCMD_FIRMWARE_FILE; - } else if (ar->arVersion.target_ver == AR6003_REV3_VERSION) { - filename = AR6003_REV3_TCMD_FIRMWARE_FILE; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown firmware revision: %d\n", ar->arVersion.target_ver)); - return A_ERROR; - } - compressed = 0; - } -#endif -#ifdef HTC_RAW_INTERFACE - if (!eppingtest && bypasswmi) { - if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { - filename = AR6003_REV2_ART_FIRMWARE_FILE; - } else if (ar->arVersion.target_ver == AR6003_REV3_VERSION) { - filename = AR6003_REV3_ART_FIRMWARE_FILE; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown firmware revision: %d\n", ar->arVersion.target_ver)); - return A_ERROR; - } - compressed = 0; - } -#endif - break; - - case AR6K_PATCH_FILE: - if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { - filename = AR6003_REV2_PATCH_FILE; - } else if (ar->arVersion.target_ver == AR6003_REV3_VERSION) { - filename = AR6003_REV3_PATCH_FILE; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown firmware revision: %d\n", ar->arVersion.target_ver)); - return A_ERROR; - } - break; - - case AR6K_BOARD_DATA_FILE: - if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { - filename = AR6003_REV2_BOARD_DATA_FILE; - } else if (ar->arVersion.target_ver == AR6003_REV3_VERSION) { - filename = AR6003_REV3_BOARD_DATA_FILE; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown firmware revision: %d\n", ar->arVersion.target_ver)); - return A_ERROR; - } - break; - - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown file type: %d\n", file)); - return A_ERROR; - } - if ((A_REQUEST_FIRMWARE(&fw_entry, filename, ((struct device *)ar->osDevInfo.pOSDevice))) != 0) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to get %s\n", filename)); - return A_ENOENT; - } - - fw_entry_size = fw_entry->size; - tempEeprom = NULL; - - /* Load extended board data for AR6003 */ - if ((file==AR6K_BOARD_DATA_FILE) && (fw_entry->data)) { - A_UINT32 board_ext_address; - A_INT32 board_ext_data_size; - - tempEeprom = A_MALLOC_NOWAIT(fw_entry->size); - if (!tempEeprom) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Memory allocation failed\n")); - A_RELEASE_FIRMWARE(fw_entry); - return A_ERROR; - } - - board_data_size = (((ar)->arTargetType == TARGET_TYPE_AR6002) ? AR6002_BOARD_DATA_SZ : \ - (((ar)->arTargetType == TARGET_TYPE_AR6003) ? AR6003_BOARD_DATA_SZ : 0)); - - board_ext_data_size = 0; - if (ar->arTargetType == TARGET_TYPE_AR6002) { - board_ext_data_size = AR6002_BOARD_EXT_DATA_SZ; - } else if (ar->arTargetType == TARGET_TYPE_AR6003) { - if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { - board_ext_data_size = AR6003_VER2_BOARD_EXT_DATA_SZ; - } else { - board_ext_data_size = AR6003_BOARD_EXT_DATA_SZ; - } - } - - /* AR6003 2.1.1 support 1792 bytes and 2048 bytes board file */ - if ((board_ext_data_size) && - (fw_entry->size < (board_data_size + board_ext_data_size))) - { - board_ext_data_size = fw_entry->size - board_data_size; - if (board_ext_data_size < 0) { - board_ext_data_size = 0; - } - } - - A_MEMCPY(tempEeprom, (A_UCHAR *)fw_entry->data, fw_entry->size); - -#ifdef SOFTMAC_FILE_USED - ar6000_softmac_update(ar, tempEeprom, board_data_size); -#endif - if (regcode!=0) { - ar6000_reg_update(ar, tempEeprom, board_data_size, regcode); - } - - /* Determine where in Target RAM to write Board Data */ - bmifn(BMIReadMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_board_ext_data), (A_UCHAR *)&board_ext_address, 4)); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("Board extended Data download address: 0x%x\n", board_ext_address)); - - /* check whether the target has allocated memory for extended board data and file contains extended board data */ - if ((board_ext_address) && (fw_entry->size == (board_data_size + board_ext_data_size))) { - A_UINT32 param; - - status = BMIWriteMemory(ar->arHifDevice, board_ext_address, (A_UCHAR *)(((A_UINT32)tempEeprom) + board_data_size), board_ext_data_size); - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__)); - A_RELEASE_FIRMWARE(fw_entry); - return A_ERROR; - } - - /* Record the fact that extended board Data IS initialized */ - param = (board_ext_data_size << 16) | 1; - bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_board_ext_data_config), (A_UCHAR *)¶m, 4)); - } - fw_entry_size = board_data_size; - } - - if (compressed) { - status = BMIFastDownload(ar->arHifDevice, address, (A_UCHAR *)fw_entry->data, fw_entry_size); - } else { - if (file==AR6K_BOARD_DATA_FILE && fw_entry->data) - { - status = BMIWriteMemory(ar->arHifDevice, address, (A_UCHAR *)tempEeprom, fw_entry_size); - } - else - { - status = BMIWriteMemory(ar->arHifDevice, address, (A_UCHAR *)fw_entry->data, fw_entry_size); - } - } - - if (tempEeprom) { - A_FREE(tempEeprom); - } - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__)); - A_RELEASE_FIRMWARE(fw_entry); - return A_ERROR; - } - A_RELEASE_FIRMWARE(fw_entry); - return A_OK; -} -#endif /* INIT_MODE_DRV_ENABLED */ - -A_STATUS -ar6000_update_bdaddr(AR_SOFTC_T *ar) -{ - - if (setupbtdev != 0) { - A_UINT32 address; - - if (BMIReadMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_board_data), (A_UCHAR *)&address, 4) != A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIReadMemory for hi_board_data failed\n")); - return A_ERROR; - } - - if (BMIReadMemory(ar->arHifDevice, address + BDATA_BDADDR_OFFSET, (A_UCHAR *)ar->bdaddr, 6) != A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIReadMemory for BD address failed\n")); - return A_ERROR; - } - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BDADDR 0x%x:0x%x:0x%x:0x%x:0x%x:0x%x\n", ar->bdaddr[0], - ar->bdaddr[1], ar->bdaddr[2], ar->bdaddr[3], - ar->bdaddr[4], ar->bdaddr[5])); - } - -return A_OK; -} - -A_STATUS -ar6000_sysfs_bmi_get_config(AR_SOFTC_T *ar, A_UINT32 mode) -{ -#if defined(INIT_MODE_DRV_ENABLED) && defined(CONFIG_HOST_TCMD_SUPPORT) - const char *filename; - const struct firmware *fw_entry; -#endif - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Requesting device specific configuration\n")); - - if (mode == WLAN_INIT_MODE_UDEV) { - A_CHAR version[16]; - const struct firmware *fw_entry; - - /* Get config using udev through a script in user space */ - sprintf(version, "%2.2x", ar->arVersion.target_ver); - if ((A_REQUEST_FIRMWARE(&fw_entry, version, ((struct device *)ar->osDevInfo.pOSDevice))) != 0) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI: Failure to get configuration for target version: %s\n", version)); - return A_ERROR; - } - - A_RELEASE_FIRMWARE(fw_entry); -#ifdef INIT_MODE_DRV_ENABLED - } else { - /* The config is contained within the driver itself */ - A_STATUS status; - A_UINT32 param, options, sleep, address; - - /* Temporarily disable system sleep */ - address = MBOX_BASE_ADDRESS + LOCAL_SCRATCH_OFFSET; - bmifn(BMIReadSOCRegister(ar->arHifDevice, address, ¶m)); - options = param; - param |= AR6K_OPTION_SLEEP_DISABLE; - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - - address = RTC_WMAC_BASE_ADDRESS + WLAN_SYSTEM_SLEEP_OFFSET; - bmifn(BMIReadSOCRegister(ar->arHifDevice, address, ¶m)); - sleep = param; - param |= WLAN_SYSTEM_SLEEP_DISABLE_SET(1); - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("old options: %d, old sleep: %d\n", options, sleep)); - - if (ar->arTargetType == TARGET_TYPE_MCKINLEY) { - /* Run at 40/44MHz by default */ - param = CPU_CLOCK_STANDARD_SET(0); - } else if (ar->arTargetType == TARGET_TYPE_AR6003) { - /* Program analog PLL register */ - bmifn(BMIWriteSOCRegister(ar->arHifDevice, ANALOG_INTF_BASE_ADDRESS + 0x284, 0xF9104001)); - /* Run at 80/88MHz by default */ - param = CPU_CLOCK_STANDARD_SET(1); - } else { - /* Run at 40/44MHz by default */ - param = CPU_CLOCK_STANDARD_SET(0); - } - address = RTC_SOC_BASE_ADDRESS + CPU_CLOCK_OFFSET; - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - - param = 0; - if (ar->arTargetType == TARGET_TYPE_AR6002) { - bmifn(BMIReadMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_ext_clk_detected), - (A_UCHAR *)¶m, 4)); - } - - /* LPO_CAL.ENABLE = 1 if no external clk is detected */ - if (param != 1) { - address = RTC_SOC_BASE_ADDRESS + LPO_CAL_OFFSET; - param = LPO_CAL_ENABLE_SET(1); - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - } - - /* Venus2.0: Lower SDIO pad drive strength */ - if ((ar->arVersion.target_ver == AR6003_REV2_VERSION) || - (ar->arVersion.target_ver == AR6003_REV3_VERSION)) - { - param = 0x20; - address = GPIO_BASE_ADDRESS + GPIO_PIN10_OFFSET; - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - - address = GPIO_BASE_ADDRESS + GPIO_PIN11_OFFSET; - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - - address = GPIO_BASE_ADDRESS + GPIO_PIN12_OFFSET; - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - - address = GPIO_BASE_ADDRESS + GPIO_PIN13_OFFSET; - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - } - -#ifdef FORCE_INTERNAL_CLOCK - /* Ignore external clock, if any, and force use of internal clock */ - if (ar->arTargetType == TARGET_TYPE_AR6003 || ar->arTargetType == TARGET_TYPE_MCKINLEY) { - /* hi_ext_clk_detected = 0 */ - param = 0; - bmifn(BMIWriteMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_ext_clk_detected), - (A_UCHAR *)¶m, 4)); - - /* CLOCK_CONTROL &= ~LF_CLK32 */ - address = RTC_BASE_ADDRESS + CLOCK_CONTROL_ADDRESS; - bmifn(BMIReadSOCRegister(ar->arHifDevice, address, ¶m)); - param &= (~CLOCK_CONTROL_LF_CLK32_SET(1)); - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - } -#endif /* FORCE_INTERNAL_CLOCK */ - - /* Transfer Board Data from Target EEPROM to Target RAM */ - if (ar->arTargetType == TARGET_TYPE_AR6003 || ar->arTargetType == TARGET_TYPE_MCKINLEY) { - /* Determine where in Target RAM to write Board Data */ - bmifn(BMIReadMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_board_data), - (A_UCHAR *)&address, 4)); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("Board Data download address: 0x%x\n", address)); - - /* Write EEPROM data to Target RAM */ - if ((status=ar6000_transfer_bin_file(ar, AR6K_BOARD_DATA_FILE, address, FALSE)) != A_OK) { - return A_ERROR; - } - - /* Record the fact that Board Data IS initialized */ - param = 1; - bmifn(BMIWriteMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_board_data_initialized), - (A_UCHAR *)¶m, 4)); - - /* Transfer One time Programmable data */ - AR6K_APP_LOAD_ADDRESS(address, ar->arVersion.target_ver); - if (ar->arVersion.target_ver == AR6003_REV3_VERSION) { - address = BMI_SEGMENTED_WRITE_ADDR; - } - status = ar6000_transfer_bin_file(ar, AR6K_OTP_FILE, address, TRUE); - if (status == A_OK) { - /* Execute the OTP code */ -#ifdef SOFTMAC_FILE_USED - param = 1; -#else - param = 0; -#endif - if (regcode != 0) - param |= 0x2; - AR6K_APP_START_OVERRIDE_ADDRESS(address, ar->arVersion.target_ver); - bmifn(BMIExecute(ar->arHifDevice, address, ¶m)); - } else if (status != A_ENOENT) { - return A_ERROR; - } - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Programming of board data for chip %d not supported\n", ar->arTargetType)); - return A_ERROR; - } - - /* Download Target firmware */ - AR6K_APP_LOAD_ADDRESS(address, ar->arVersion.target_ver); - if (ar->arVersion.target_ver == AR6003_REV3_VERSION) { - address = BMI_SEGMENTED_WRITE_ADDR; - } - if ((ar6000_transfer_bin_file(ar, AR6K_FIRMWARE_FILE, address, TRUE)) != A_OK) { - return A_ERROR; - } - - if (ar->arVersion.target_ver == AR6003_REV2_VERSION) - { - /* Set starting address for firmware */ - AR6K_APP_START_OVERRIDE_ADDRESS(address, ar->arVersion.target_ver); - bmifn(BMISetAppStart(ar->arHifDevice, address)); - } - - /* Apply the patches */ - if (ar->arTargetType == TARGET_TYPE_AR6003) { - AR6K_DATASET_PATCH_ADDRESS(address, ar->arVersion.target_ver); - if ((ar6000_transfer_bin_file(ar, AR6K_PATCH_FILE, address, FALSE)) != A_OK) { - return A_ERROR; - } - param = address; - bmifn(BMIWriteMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_dset_list_head), - (A_UCHAR *)¶m, 4)); - } - - /* Restore system sleep */ - address = RTC_WMAC_BASE_ADDRESS + WLAN_SYSTEM_SLEEP_OFFSET; - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, sleep)); - - address = MBOX_BASE_ADDRESS + LOCAL_SCRATCH_OFFSET; - param = options | 0x20; - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - - if (ar->arTargetType == TARGET_TYPE_AR6003 || ar->arTargetType == TARGET_TYPE_MCKINLEY) { - /* Configure GPIO AR6003 UART */ -#ifndef CONFIG_AR600x_DEBUG_UART_TX_PIN -#define CONFIG_AR600x_DEBUG_UART_TX_PIN 8 -#endif - param = CONFIG_AR600x_DEBUG_UART_TX_PIN; - bmifn(BMIWriteMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_dbg_uart_txpin), - (A_UCHAR *)¶m, 4)); - -#if (CONFIG_AR600x_DEBUG_UART_TX_PIN == 23) - if (ATH_REGISTER_SUPPORTED_BY_TARGET(CLOCK_GPIO_OFFSET)) { - address = GPIO_BASE_ADDRESS + CLOCK_GPIO_OFFSET; - bmifn(BMIReadSOCRegister(ar->arHifDevice, address, ¶m)); - param |= CLOCK_GPIO_BT_CLK_OUT_EN_SET(1); - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - } else { - /* AR6004 has no need for a CLOCK_GPIO register */ - } -#endif - - /* Configure GPIO for BT Reset */ -#ifdef ATH6KL_CONFIG_GPIO_BT_RESET -#define CONFIG_AR600x_BT_RESET_PIN 0x16 - param = CONFIG_AR600x_BT_RESET_PIN; - bmifn(BMIWriteMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_hci_uart_support_pins), - (A_UCHAR *)¶m, 4)); -#endif /* ATH6KL_CONFIG_GPIO_BT_RESET */ - - /* Configure UART flow control polarity */ -#ifndef CONFIG_ATH6KL_BT_UART_FC_POLARITY -#define CONFIG_ATH6KL_BT_UART_FC_POLARITY 0 -#endif - -#if (CONFIG_ATH6KL_BT_UART_FC_POLARITY == 1) - if ((ar->arVersion.target_ver == AR6003_REV2_VERSION) || - (ar->arVersion.target_ver == AR6003_REV3_VERSION)) - { - param = ((CONFIG_ATH6KL_BT_UART_FC_POLARITY << 1) & 0x2); - bmifn(BMIWriteMemory(ar->arHifDevice, HOST_INTEREST_ITEM_ADDRESS(ar, hi_hci_uart_pwr_mgmt_params), (A_UCHAR *)¶m, 4)); - } -#endif /* CONFIG_ATH6KL_BT_UART_FC_POLARITY */ - } -#ifdef HTC_RAW_INTERFACE - if (!eppingtest && bypasswmi) { - /* Don't run BMIDone for ART mode and force resetok=0 */ - resetok = 0; - msleep(1000); - param = 1; - status = BMIWriteMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_board_data_initialized), - (A_UCHAR *)¶m, 4); - } -#endif /* HTC_RAW_INTERFACE */ - -#ifdef CONFIG_HOST_TCMD_SUPPORT - if (testmode == 2) { - if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { - filename = AR6003_REV2_UTF_FIRMWARE_FILE; - if ((A_REQUEST_FIRMWARE(&fw_entry, filename, ((struct device *)ar->osDevInfo.pOSDevice))) != 0) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to get %s\n", filename)); - return A_ENOENT; - } - /* Download Target firmware */ - AR6K_APP_LOAD_ADDRESS(address, ar->arVersion.target_ver); - status = BMIWriteMemory(ar->arHifDevice, address, (A_UCHAR *)fw_entry->data, fw_entry->size); - - address = HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_end_RAM_reserve_sz); - param = 11008; - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - - address = 0x57D884; - filename = AR6003_REV2_TESTSCRIPT_FILE; - if ((A_REQUEST_FIRMWARE(&fw_entry, filename, ((struct device *)ar->osDevInfo.pOSDevice))) != 0) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to get %s\n", filename)); - return A_ENOENT; - } - status = BMIWriteMemory(ar->arHifDevice, address, (A_UCHAR *)fw_entry->data, fw_entry->size); - - param = 0x57D884; - address = HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_ota_testscript); - bmifn(BMIWriteMemory(ar->arHifDevice, address, (A_UCHAR *)¶m, 4)); - - address = HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_test_apps_related); - bmifn(BMIReadSOCRegister(ar->arHifDevice, address, ¶m)); - param |= 1; - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - - A_RELEASE_FIRMWARE(fw_entry); - } - else if (ar->arVersion.target_ver == AR6003_REV3_VERSION) { - filename = AR6003_REV3_UTF_FIRMWARE_FILE; - if ((A_REQUEST_FIRMWARE(&fw_entry, filename, ((struct device *)ar->osDevInfo.pOSDevice))) != 0) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to get %s\n", filename)); - return A_ENOENT; - } - /* Download Target firmware */ - address = BMI_SEGMENTED_WRITE_ADDR; - status = BMIWriteMemory(ar->arHifDevice, address, (A_UCHAR *)fw_entry->data, fw_entry->size); - - address = HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_end_RAM_reserve_sz); - param = 4096; - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - - address = 0x57EF74; - filename = AR6003_REV3_TESTSCRIPT_FILE; - if ((A_REQUEST_FIRMWARE(&fw_entry, filename, ((struct device *)ar->osDevInfo.pOSDevice))) != 0) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to get %s\n", filename)); - return A_ENOENT; - } - status = BMIWriteMemory(ar->arHifDevice, address, (A_UCHAR *)fw_entry->data, fw_entry->size); - - param = 0x57EF74; - address = HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_ota_testscript); - bmifn(BMIWriteMemory(ar->arHifDevice, address, (A_UCHAR *)¶m, 4)); - - address = HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_test_apps_related); - bmifn(BMIReadSOCRegister(ar->arHifDevice, address, ¶m)); - param |= 1; - bmifn(BMIWriteSOCRegister(ar->arHifDevice, address, param)); - - A_RELEASE_FIRMWARE(fw_entry); - } - } -#endif -#endif /* INIT_MODE_DRV_ENABLED */ - } - - return A_OK; -} - -A_STATUS -ar6000_configure_target(AR_SOFTC_T *ar) -{ - A_UINT32 param; - if (enableuartprint) { - param = 1; - if (BMIWriteMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_serial_enable), - (A_UCHAR *)¶m, - 4)!= A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for enableuartprint failed \n")); - return A_ERROR; - } - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Serial console prints enabled\n")); - } - - /* Tell target which HTC version it is used*/ - param = HTC_PROTOCOL_VERSION; - if (BMIWriteMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_app_host_interest), - (A_UCHAR *)¶m, - 4)!= A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for htc version failed \n")); - return A_ERROR; - } - - if (enabletimerwar) { - A_UINT32 param; - - if (BMIReadMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_option_flag), - (A_UCHAR *)¶m, - 4)!= A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIReadMemory for enabletimerwar failed \n")); - return A_ERROR; - } - - param |= HI_OPTION_TIMER_WAR; - - if (BMIWriteMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_option_flag), - (A_UCHAR *)¶m, - 4) != A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for enabletimerwar failed \n")); - return A_ERROR; - } - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Timer WAR enabled\n")); - } - - /* set the firmware mode to STA/IBSS/AP */ - { - A_UINT32 param; - - if (BMIReadMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_option_flag), - (A_UCHAR *)¶m, - 4)!= A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIReadMemory for setting fwmode failed \n")); - return A_ERROR; - } - - param |= (num_device << HI_OPTION_NUM_DEV_SHIFT); - param |= (fwmode << HI_OPTION_FW_MODE_SHIFT); - param |= (mac_addr_method << HI_OPTION_MAC_ADDR_METHOD_SHIFT); - param |= (firmware_bridge << HI_OPTION_FW_BRIDGE_SHIFT); - param |= (fwsubmode << HI_OPTION_FW_SUBMODE_SHIFT); - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("NUM_DEV=%d FWMODE=0x%x FWSUBMODE=0x%x FWBR_BUF %d\n", - num_device, fwmode, fwsubmode, firmware_bridge)); - - if (BMIWriteMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_option_flag), - (A_UCHAR *)¶m, - 4) != A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for setting fwmode failed \n")); - return A_ERROR; - } - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Firmware mode set\n")); - } -#ifdef ATH6KL_DISABLE_TARGET_DBGLOGS - { - A_UINT32 param; - - if (BMIReadMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_option_flag), - (A_UCHAR *)¶m, - 4)!= A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIReadMemory for disabling debug logs failed\n")); - return A_ERROR; - } - - param |= HI_OPTION_DISABLE_DBGLOG; - - if (BMIWriteMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_option_flag), - (A_UCHAR *)¶m, - 4) != A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for HI_OPTION_DISABLE_DBGLOG\n")); - return A_ERROR; - } - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Firmware mode set\n")); - } -#endif /* ATH6KL_DISABLE_TARGET_DBGLOGS */ - - if (regscanmode) { - A_UINT32 param; - - if (BMIReadMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_option_flag), - (A_UCHAR *)¶m, - 4)!= A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIReadMemory for setting regscanmode failed\n")); - return A_ERROR; - } - - if (regscanmode == 1) { - param |= HI_OPTION_SKIP_REG_SCAN; - } else if (regscanmode == 2) { - param |= HI_OPTION_INIT_REG_SCAN; - } - - if (BMIWriteMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_option_flag), - (A_UCHAR *)¶m, - 4) != A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for setting regscanmode failed\n")); - return A_ERROR; - } - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Regulatory scan mode set\n")); - } - - /* - * Hardcode the address use for the extended board data - * Ideally this should be pre-allocate by the OS at boot time - * But since it is a new feature and board data is loaded - * at init time, we have to workaround this from host. - * It is difficult to patch the firmware boot code, - * but possible in theory. - */ - if (ar->arTargetType == TARGET_TYPE_AR6003) { - A_UINT32 ramReservedSz; - if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { - param = AR6003_REV2_BOARD_EXT_DATA_ADDRESS; - ramReservedSz = AR6003_REV2_RAM_RESERVE_SIZE; - } else { - param = AR6003_REV3_BOARD_EXT_DATA_ADDRESS; - ramReservedSz = AR6003_REV3_RAM_RESERVE_SIZE; - } - if (BMIWriteMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_board_ext_data), - (A_UCHAR *)¶m, - 4) != A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for hi_board_ext_data failed \n")); - return A_ERROR; - } - if (BMIWriteMemory(ar->arHifDevice, - HOST_INTEREST_ITEM_ADDRESS(ar->arTargetType, hi_end_RAM_reserve_sz), - (A_UCHAR *)&ramReservedSz, 4) != A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMIWriteMemory for hi_end_RAM_reserve_sz failed \n")); - return A_ERROR; - } - } - - - /* since BMIInit is called in the driver layer, we have to set the block - * size here for the target */ - - if (A_FAILED(ar6000_set_htc_params(ar->arHifDevice, - ar->arTargetType, - mbox_yield_limit, - 0 /* use default number of control buffers */ - ))) { - return A_ERROR; - } - - if (setupbtdev != 0) { - if (A_FAILED(ar6000_set_hci_bridge_flags(ar->arHifDevice, - ar->arTargetType, - setupbtdev))) { - return A_ERROR; - } - } - - return A_OK; -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) -static void ar6000_ethtool_get_drvinfo(struct net_device *dev, - struct ethtool_drvinfo *info) -{ - A_STATUS status; - HIF_DEVICE_OS_DEVICE_INFO osDevInfo; - AR_SOFTC_T *ar; - AR_SOFTC_DEV_T *arPriv; - struct ar6000_version *revinfo; - if((dev == NULL) || ((arPriv = ar6k_priv(dev)) == NULL)) { - return; - } - ar = arPriv->arSoftc; - revinfo = &ar->arVersion; - strcpy(info->driver, "AR6000"); - snprintf(info->version, sizeof(info->version), "%u.%u.%u.%u", - ((revinfo->host_ver)&0xf0000000)>>28, - ((revinfo->host_ver)&0x0f000000)>>24, - ((revinfo->host_ver)&0x00ff0000)>>16, - ((revinfo->host_ver)&0x0000ffff)); - snprintf(info->fw_version, sizeof(info->fw_version), "%u.%u.%u.%u", - ((revinfo->wlan_ver)&0xf0000000)>>28, - ((revinfo->wlan_ver)&0x0f000000)>>24, - ((revinfo->wlan_ver)&0x00ff0000)>>16, - ((revinfo->wlan_ver)&0x0000ffff)); - - status = HIFConfigureDevice(ar->arHifDevice, - HIF_DEVICE_GET_OS_DEVICE, - &osDevInfo, - sizeof(HIF_DEVICE_OS_DEVICE_INFO)); - if (A_SUCCESS(status) && osDevInfo.pOSDevice) { - struct device *dev = (struct device*)osDevInfo.pOSDevice; - if (dev->bus && dev->bus->name) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) - const char *dinfo = dev_name(dev); -#else - const char *dinfo = kobject_name(&dev->kobj); -#endif - snprintf(info->bus_info, sizeof(info->bus_info), dinfo); - } - } -} - -static u32 ar6000_ethtool_get_link(struct net_device *dev) -{ - AR_SOFTC_DEV_T *arPriv; - return ((arPriv = ar6k_priv(dev))!=NULL) ? arPriv->arConnected : 0; -} - -#ifdef CONFIG_CHECKSUM_OFFLOAD -static u32 ar6000_ethtool_get_rx_csum(struct net_device *dev) -{ - AR_SOFTC_DEV_T *arPriv; - if((dev == NULL) || ((arPriv = ar6k_priv(dev)) == NULL)) { - return 0; - } - return (arPriv->arSoftc->rxMetaVersion==WMI_META_VERSION_2); -} - -static int ar6000_ethtool_set_rx_csum(struct net_device *dev, u32 enable) -{ - AR_SOFTC_T *ar; - AR_SOFTC_DEV_T *arPriv; - A_UINT8 metaVersion; - if((dev == NULL) || ((arPriv = ar6k_priv(dev)) == NULL)) { - return -EIO; - } - ar = arPriv->arSoftc; - if (ar->arWmiReady == FALSE || ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - metaVersion = (enable) ? WMI_META_VERSION_2 : 0; - if ((wmi_set_rx_frame_format_cmd(arPriv->arWmi, metaVersion, processDot11Hdr, processDot11Hdr)) != A_OK) { - return -EFAULT; - } - ar->rxMetaVersion = metaVersion; - return 0; -} - -static u32 ar6000_ethtool_get_tx_csum(struct net_device *dev) -{ - return csumOffload; -} - -static int ar6000_ethtool_set_tx_csum(struct net_device *dev, u32 enable) -{ - csumOffload = enable; - if(enable){ - dev->features |= NETIF_F_IP_CSUM; - } else { - dev->features &= ~NETIF_F_IP_CSUM; - } - return 0; -} -#endif /* CONFIG_CHECKSUM_OFFLOAD */ - -static const struct ethtool_ops ar6000_ethtool_ops = { - .get_drvinfo = ar6000_ethtool_get_drvinfo, - .get_link = ar6000_ethtool_get_link, -#ifdef CONFIG_CHECKSUM_OFFLOAD - .get_rx_csum = ar6000_ethtool_get_rx_csum, - .set_rx_csum = ar6000_ethtool_set_rx_csum, - .get_tx_csum = ar6000_ethtool_get_tx_csum, - .set_tx_csum = ar6000_ethtool_set_tx_csum, -#endif /* CONFIG_CHECKSUM_OFFLOAD */ -}; -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) */ - -/* - * HTC Event handlers - */ -static A_STATUS -ar6000_avail_ev(void *context, void *hif_handle) -{ - int i; - struct net_device *dev; - void *ar_netif; - AR_SOFTC_T *ar=NULL; - AR_SOFTC_DEV_T *arPriv; - int device_index = 0; - HTC_INIT_INFO htcInfo; -#ifdef ATH6K_CONFIG_CFG80211 - struct wireless_dev *wdev; -#endif /* ATH6K_CONFIG_CFG80211 */ - A_STATUS init_status = A_OK; - unsigned char devnum = 0; - unsigned char cnt = 0; - - /* - * If ar6000_avail_ev is called more than once, this means that - * multiple AR600x devices have been inserted into the system. - * We do not support more than one AR600x device at this time. - */ -#ifndef RK29 - if (avail_ev_called) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ERROR: More than one AR600x device not supported by driver\n")); - return A_ERROR; - } - - avail_ev_called = TRUE; -#endif - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ar6000_available\n")); - - - - ar = A_MALLOC(sizeof(AR_SOFTC_T)); - - if (ar == NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR_SOFTC: can not allocate\n")); - return A_ERROR; - } - A_MEMZERO(ar, sizeof(AR_SOFTC_T)); - -#ifdef ATH_AR6K_11N_SUPPORT - if(aggr_init(ar6000_alloc_netbufs, ar6000_deliver_frames_to_nw_stack) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() Failed to initialize aggr.\n", __func__)); - init_status = A_ERROR; - goto avail_ev_failed; - } -#endif - - A_MEMZERO((A_UINT8 *)ar->connTbl, NUM_CONN * sizeof(conn_t)); - /* Init the PS queues */ - for (i=0; i < NUM_CONN ; i++) { -#ifdef ATH_AR6K_11N_SUPPORT - if((ar->connTbl[i].conn_aggr = aggr_init_conn()) == NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("%s() Failed to initialize aggr.\n", __func__)); - A_FREE(ar); - return A_ERROR; - } -#endif - A_MUTEX_INIT(&ar->connTbl[i].psqLock); - A_NETBUF_QUEUE_INIT(&ar->connTbl[i].psq); - A_NETBUF_QUEUE_INIT(&ar->connTbl[i].apsdq); - } - -#if 0//LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - if(ifname[0]) { - for(i = 0; i < strlen(ifname); i++) { - if(ifname[i] >= '0' && ifname[i] <= '9' ) { - devnum = (devnum * 10) + (ifname[i] - '0'); - } - else { - cnt++; - } - } - ifname[cnt]='\0'; - } -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */ - ar->arConfNumDev = num_device; - for (i=0; i < num_device; i++) { - - if (ar6000_devices[i] != NULL) { - break; - } - - /* Save this. It gives a bit better readability especially since */ - /* we use another local "i" variable below. */ - device_index = i; -#ifdef ATH6K_CONFIG_CFG80211 - wdev = ar6k_cfg80211_init(NULL); - if (IS_ERR(wdev)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: ar6k_cfg80211_init failed\n", __func__)); - return A_ERROR; - } - ar_netif = wdev_priv(wdev); -#else - dev = alloc_etherdev(sizeof(AR_SOFTC_DEV_T)); - if (dev == NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_available: can't alloc etherdev\n")); - A_FREE(ar); - return A_ERROR; - } - ether_setup(dev); - ar_netif = ar6k_priv(dev); -#endif /* ATH6K_CONFIG_CFG80211 */ - - if (ar_netif == NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Can't allocate ar6k priv memory\n", __func__)); - A_FREE(ar); - return A_ERROR; - } - - A_MEMZERO(ar_netif, sizeof(AR_SOFTC_DEV_T)); - arPriv = (AR_SOFTC_DEV_T *)ar_netif; - -#ifdef ATH6K_CONFIG_CFG80211 - arPriv->wdev = wdev; - wdev->iftype = NL80211_IFTYPE_STATION; - - dev = alloc_netdev_mq(0, "wlan%d", ether_setup, NUM_SUBQUEUE); - if (!dev) { - printk(KERN_CRIT "AR6K: no memory for network device instance\n"); - ar6k_cfg80211_deinit(arPriv); - A_FREE(ar); - return A_ERROR; - } - - dev->ieee80211_ptr = wdev; - SET_NETDEV_DEV(dev, wiphy_dev(wdev->wiphy)); - wdev->netdev = dev; - arPriv->arNetworkType = INFRA_NETWORK; -#endif /* ATH6K_CONFIG_CFG80211 */ - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - if (ifname[0]) - { - //sprintf(dev->name, "%s%d", ifname,(devnum + device_index)); - sprintf(dev->name, "%s", ifname); - } -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */ - -#ifdef SET_MODULE_OWNER - SET_MODULE_OWNER(dev); -#endif - -#ifdef SET_NETDEV_DEV -#if 0 - if (ar_netif) { - HIF_DEVICE_OS_DEVICE_INFO osDevInfo; - A_MEMZERO(&osDevInfo, sizeof(osDevInfo)); - if ( A_SUCCESS( HIFConfigureDevice(hif_handle, HIF_DEVICE_GET_OS_DEVICE, - &osDevInfo, sizeof(osDevInfo))) ) { - SET_NETDEV_DEV(dev, osDevInfo.pOSDevice); - } - } -#endif -#endif - - arPriv->arNetDev = dev; - ar6000_devices[device_index] = dev; - arPriv->arSoftc = ar; - ar->arDev[device_index] = arPriv; - ar->arWlanState = WLAN_ENABLED; - arPriv->arDeviceIndex = device_index; - - ar->arWlanPowerState = WLAN_POWER_STATE_ON; - - if(ar6000_init_control_info(arPriv) != A_OK) { - init_status = A_ERROR; - goto avail_ev_failed; - } - init_waitqueue_head(&arPriv->arEvent); - -#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL - A_INIT_TIMER(&aptcTimer[i], aptcTimerHandler, ar); -#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ - - spin_lock_init(&arPriv->arPrivLock); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) - dev->open = &ar6000_open; - dev->stop = &ar6000_close; - dev->hard_start_xmit = &ar6000_data_tx; - dev->get_stats = &ar6000_get_stats; - - /* dev->tx_timeout = ar6000_tx_timeout; */ - dev->do_ioctl = &ar6000_ioctl; - dev->set_multicast_list = &ar6000_set_multicast_list; -#else - dev->netdev_ops = &ar6000_netdev_ops; -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) - dev->ethtool_ops = &ar6000_ethtool_ops; -#endif - dev->watchdog_timeo = AR6000_TX_TIMEOUT; - dev->wireless_handlers = &ath_iw_handler_def; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) - dev->get_wireless_stats = ar6000_get_iwstats; /*Displayed via proc fs */ -#else - ath_iw_handler_def.get_wireless_stats = ar6000_get_iwstats; /*Displayed via proc fs */ -#endif -#ifdef CONFIG_CHECKSUM_OFFLOAD - if(csumOffload){ - - dev->features |= NETIF_F_IP_CSUM;/*advertise kernel capability - to do TCP/UDP CSUM offload for IPV4*/ - } -#endif - if (processDot11Hdr) { - dev->hard_header_len = sizeof(struct ieee80211_qosframe) + sizeof(ATH_LLC_SNAP_HDR) + sizeof(WMI_DATA_HDR) + HTC_HEADER_LEN + WMI_MAX_TX_META_SZ + LINUX_HACK_FUDGE_FACTOR; - } else { - /* - * We need the OS to provide us with more headroom in order to - * perform dix to 802.3, WMI header encap, and the HTC header - */ - dev->hard_header_len = ETH_HLEN + sizeof(ATH_LLC_SNAP_HDR) + - sizeof(WMI_DATA_HDR) + HTC_HEADER_LEN + WMI_MAX_TX_META_SZ + LINUX_HACK_FUDGE_FACTOR; - } - - if (!bypasswmi) - { - /* Indicate that WMI is enabled (although not ready yet) */ - arPriv->arWmiEnabled = TRUE; - if ((arPriv->arWmi = wmi_init((void *) arPriv,arPriv->arDeviceIndex)) == NULL) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() Failed to initialize WMI.\n", __func__)); - init_status = A_ERROR; - goto avail_ev_failed; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s() Got WMI @ 0x%08x.\n", __func__, - (unsigned int) arPriv->arWmi)); - } -#ifdef P2P - /* Allocate P2P module context if this dev is in any of the P2P modes. - * For non-P2P devices, this may be allocated just in time when the - * device assumes a P2P submode. This may be needed when we do - * mode switch between none and P2P submodes. For later enhancement. - */ - if (arPriv->arNetworkSubType == SUBTYPE_P2PDEV || - arPriv->arNetworkSubType == SUBTYPE_P2PCLIENT || - arPriv->arNetworkSubType == SUBTYPE_P2PGO) { - arPriv->p2p_ctx = p2p_init(arPriv); - } -#endif /* P2P */ - } - -#ifdef CONFIG_HOST_TCMD_SUPPORT - if(testmode) { - ar->arTargetMode = AR6000_TCMD_MODE; - }else { - ar->arTargetMode = AR6000_WLAN_MODE; - } -#endif - ar->arWlanOff = FALSE; /* We are in ON state */ -#ifdef CONFIG_PM - ar->arWowState = WLAN_WOW_STATE_NONE; - ar->arBTOff = TRUE; /* BT chip assumed to be OFF */ - ar->arBTSharing = WLAN_CONFIG_BT_SHARING; - ar->arWlanOffConfig = WLAN_CONFIG_WLAN_OFF; - ar->arSuspendConfig = WLAN_CONFIG_PM_SUSPEND; - ar->arWow2Config = WLAN_CONFIG_PM_WOW2; -#endif /* CONFIG_PM */ - - A_INIT_TIMER(&ar->arHBChallengeResp.timer, ar6000_detect_error, ar); - ar->arHBChallengeResp.seqNum = 0; - ar->arHBChallengeResp.outstanding = FALSE; - ar->arHBChallengeResp.missCnt = 0; - ar->arHBChallengeResp.frequency = AR6000_HB_CHALLENGE_RESP_FREQ_DEFAULT; - ar->arHBChallengeResp.missThres = AR6000_HB_CHALLENGE_RESP_MISS_THRES_DEFAULT; - ar->arHifDevice = hif_handle; - sema_init(&ar->arSem, 1); - ar->bIsDestroyProgress = FALSE; - - INIT_HTC_PACKET_QUEUE(&ar->amsdu_rx_buffer_queue); - /* - * If requested, perform some magic which requires no cooperation from - * the Target. It causes the Target to ignore flash and execute to the - * OS from ROM. - * - * This is intended to support recovery from a corrupted flash on Targets - * that support flash. - */ - if (skipflash) - { - //ar6000_reset_device_skipflash(ar->arHifDevice); - } - - BMIInit(); - - if (bmienable) { - ar6000_sysfs_bmi_init(ar); - } - - { - struct bmi_target_info targ_info; - A_MEMZERO(&targ_info, sizeof(targ_info)); - if (BMIGetTargetInfo(ar->arHifDevice, &targ_info) != A_OK) { - init_status = A_ERROR; - goto avail_ev_failed; - } - - ar->arVersion.target_ver = targ_info.target_ver; - ar->arTargetType = targ_info.target_type; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s() TARGET TYPE: %d\n", __func__,ar->arTargetType)); - target_register_tbl_attach(ar->arTargetType); - - /* do any target-specific preparation that can be done through BMI */ - if (ar6000_prepare_target(ar->arHifDevice, - targ_info.target_type, - targ_info.target_ver) != A_OK) { - init_status = A_ERROR; - goto avail_ev_failed; - } - - } - if (ar6000_configure_target(ar) != A_OK) { - init_status = A_ERROR; - goto avail_ev_failed; - } - - A_MEMZERO(&htcInfo,sizeof(htcInfo)); - htcInfo.pContext = ar; - htcInfo.TargetFailure = ar6000_target_failure; - - ar->arHtcTarget = HTCCreate(ar->arHifDevice,&htcInfo); - - if (ar->arHtcTarget == NULL) { - init_status = A_ERROR; - goto avail_ev_failed; - } - - spin_lock_init(&ar->arLock); - -#ifdef CONFIG_CHECKSUM_OFFLOAD - if(csumOffload){ - - ar->rxMetaVersion=WMI_META_VERSION_2;/*if external frame work is also needed, change and use an extended rxMetaVerion*/ - } -#endif - - HIFClaimDevice(ar->arHifDevice, ar); - - if (bmienable) - { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("BMI enabled: %d\n", wlaninitmode)); - if ((wlaninitmode == WLAN_INIT_MODE_UDEV) || - (wlaninitmode == WLAN_INIT_MODE_DRV)) - { - A_STATUS status = A_OK; - do { - if ((status = ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_config failed\n")); - break; - } - }while (FALSE); - } - } - - if(bmienable) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("BMI enabled: %d\n", wlaninitmode)); - if ((wlaninitmode == WLAN_INIT_MODE_UDEV) || - (wlaninitmode == WLAN_INIT_MODE_DRV)) - { - A_STATUS status = A_OK; - dev = ar6000_devices[0]; - do { -#ifdef HTC_RAW_INTERFACE - if (!eppingtest && bypasswmi) { - break; /* Don't call ar6000_init for ART */ - } -#endif - rtnl_lock(); - status = (ar6000_init(dev)==0) ? A_OK : A_ERROR; - rtnl_unlock(); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n")); - } - } while (FALSE); - - if (status != A_OK) { - init_status = status; - goto avail_ev_failed; - } - } - } - - for (i=0; i < num_device; i++) - { - dev = ar6000_devices[i]; - arPriv = ar6k_priv(dev); - ar = arPriv->arSoftc; - /* Don't install the init function if BMI is requested */ - if (!bmienable) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) - dev->init = ar6000_init; -#else - ar6000_netdev_ops.ndo_init = ar6000_init; -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) */ - } - - /* This runs the init function if registered */ - if (register_netdev(dev)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: register_netdev failed\n")); - ar6000_cleanup(ar); - ar6000_devices[i]=NULL; - ar6000_destroy(dev, 0); - return A_ERROR; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ar6000_avail: name=%s hifdevice=0x%lx, dev=0x%lx (%d), ar=0x%lx\n", - dev->name, (unsigned long)ar->arHifDevice, (unsigned long)dev, device_index, - (unsigned long)ar)); - - } - -avail_ev_failed : - if (A_FAILED(init_status)) { - if (bmienable) { - ar6000_sysfs_bmi_deinit(ar); - } - for (i=0; i < num_device; i++) - { - dev = ar6000_devices[i]; - arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - if(arPriv->arWmiEnabled == TRUE) - { - wmi_shutdown(arPriv->arWmi); - arPriv->arWmiEnabled = FALSE; - } - ar6000_devices[i] = NULL; - } - A_FREE(ar); - } - - return init_status; -} - -static void ar6000_target_failure(void *Instance, A_STATUS Status) -{ - AR_SOFTC_T *ar = (AR_SOFTC_T *)Instance; - WMI_TARGET_ERROR_REPORT_EVENT errEvent; - static A_BOOL sip = FALSE; - A_UINT8 i; - - if (Status != A_OK) { - - printk(KERN_ERR "ar6000_target_failure: target asserted \n"); - - if (timer_pending(&ar->arHBChallengeResp.timer)) { - A_UNTIMEOUT(&ar->arHBChallengeResp.timer); - } - - /* try dumping target assertion information (if any) */ - ar6000_dump_target_assert_info(ar->arHifDevice,ar->arTargetType); - - /* - * Fetch the logs from the target via the diagnostic - * window. - */ - ar6000_dbglog_get_debug_logs(ar); - - /* Report the error only once */ - if (!sip) { - sip = TRUE; - errEvent.errorVal = WMI_TARGET_COM_ERR | - WMI_TARGET_FATAL_ERR; - for(i = 0; i < num_device; i++) - { - - ar6000_send_event_to_app(ar->arDev[i], WMI_ERROR_REPORT_EVENTID, - (A_UINT8 *)&errEvent, - sizeof(WMI_TARGET_ERROR_REPORT_EVENT)); - - } - } - } -} - -static A_STATUS -ar6000_unavail_ev(void *context, void *hif_handle) -{ - unsigned int old_reset_ok = resetok; - A_UINT8 i; - struct net_device *ar6000_netdev; - AR_SOFTC_T *ar = (AR_SOFTC_T*)context; - resetok = 0; /* card is remove, don't reset */ - ar6000_cleanup(ar); - resetok = old_reset_ok; - /* NULL out it's entry in the global list */ - for(i = 0; i < num_device; i++) { - ar6000_netdev = ar6000_devices[i]; - ar6000_devices[i] = NULL; - ar6000_destroy(ar6000_netdev, 1); - } - - return A_OK; -} - - -void -ar6000_restart_endpoint(AR_SOFTC_T *ar) -{ - - A_STATUS status = A_OK; - AR_SOFTC_DEV_T *arPriv; - struct net_device *dev; - A_UINT8 i = 0; - - /* - * Call wmi_init for each device. This must be done BEFORE ar6000_init() is - * called, or we will get a null pointer exception in the wmi code. We must - * also set the arWmiEnabled flag for each device. - */ - for(i = 0; i < num_device; i++) { - arPriv = ar->arDev[i]; - arPriv->arWmiEnabled = TRUE; - if ((arPriv->arWmi = wmi_init((void *) arPriv,arPriv->arDeviceIndex)) == NULL) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() Failed to initialize WMI.\n", __func__)); - status = A_ERROR; - goto exit; - } - } - - - BMIInit(); - if (bmienable) { - ar6000_sysfs_bmi_init(ar); - } - do { - if ( (status=ar6000_configure_target(ar))!=A_OK) - break; - if ( (status=ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_config failed\n")); - break; - } - } while(0); - - dev = ar6000_devices[0]; - rtnl_lock(); - status = (ar6000_init(dev)==0) ? A_OK : A_ERROR; - rtnl_unlock(); - - if (status!=A_OK) { - goto exit; - } - - - for(i = 0; i < num_device; i++) { - arPriv = ar->arDev[i]; - if (arPriv->arDoConnectOnResume && - arPriv->arSsidLen && - ar->arWlanState == WLAN_ENABLED) - { - ar6000_connect_to_ap(arPriv); - } - } - - if (status==A_OK) { - return; - } - -exit: - for(i = 0; i < num_device; i++) { - arPriv = ar->arDev[i]; - ar6000_devices[i] = NULL; - ar6000_destroy(arPriv->arNetDev, 1); - } - -} - -void -ar6000_stop_endpoint(AR_SOFTC_T *ar, A_BOOL keepprofile, A_BOOL getdbglogs) -{ - - AR_SOFTC_DEV_T *arPriv ; - A_UINT8 i; - A_UINT8 ctr; - AR_SOFTC_STA_T *arSta; - - for(i = 0; i < num_device; i++) - { - arPriv = ar->arDev[i]; - arSta = &arPriv->arSta; - /* Stop the transmit queues */ - netif_stop_queue(arPriv->arNetDev); - - /* Disable the target and the interrupts associated with it */ - if (ar->arWmiReady == TRUE) - { - if (!bypasswmi) { - A_BOOL disconnectIssued; - - arPriv->arDoConnectOnResume = arPriv->arConnected; - - A_UNTIMEOUT(&arPriv->arSta.disconnect_timer); - A_UNTIMEOUT(&ar->ap_reconnect_timer); - A_UNTIMEOUT(&arPriv->ap_acs_timer); -#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL - /* Delete the Adaptive Power Control timer */ - if (timer_pending(&aptcTimer[i])) { - del_timer_sync(&aptcTimer[i]); - } -#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ -#ifdef ATH_AR6K_11N_SUPPORT - for (ctr=0; ctr < NUM_CONN ; ctr++) { - aggr_module_destroy_timers(ar->connTbl[ctr].conn_aggr); - } -#endif - - disconnectIssued = (arPriv->arConnected) || (arPriv->arSta.arConnectPending); - ar6000_disconnect(arPriv); - if (!keepprofile) { - ar6000_init_profile_info(arPriv); - } - if (getdbglogs) { - ar6000_dbglog_get_debug_logs(ar); - } - ar->arWmiReady = FALSE; - arPriv->arWmiEnabled = FALSE; - wmi_shutdown(arPriv->arWmi); - arPriv->arWmi = NULL; - /* - * After wmi_shudown all WMI events will be dropped. - * We need to cleanup the buffers allocated in AP mode - * and give disconnect notification to stack, which usually - * happens in the disconnect_event. - * Simulate the disconnect_event by calling the function directly. - * Sometimes disconnect_event will be received when the debug logs - * are collected. - */ - if (disconnectIssued) { - if(arPriv->arNetworkType & AP_NETWORK) { - ar6000_disconnect_event(arPriv, DISCONNECT_CMD, bcast_mac, 0, NULL, 0); - } else { - ar6000_disconnect_event(arPriv, DISCONNECT_CMD, arPriv->arBssid, 0, NULL, 0); - } - } -#ifdef USER_KEYS - arPriv->arSta.user_savedkeys_stat = USER_SAVEDKEYS_STAT_INIT; - arPriv->arSta.user_key_ctrl = 0; -#endif - } - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): WMI stopped\n", __func__)); - } - else - { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): WMI not ready 0x%lx 0x%lx\n", - __func__, (unsigned long) ar, (unsigned long) arPriv->arWmi)); - /* Shut down WMI if we have started it */ - if(arPriv->arWmiEnabled == TRUE) - { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s(): Shut down WMI\n", __func__)); - arPriv->arWmiEnabled = FALSE; - wmi_shutdown(arPriv->arWmi); - arPriv->arWmi = NULL; - } - } - /* cleanup hci pal driver data structures */ - if (setuphcipal && (arPriv->isBt30amp == TRUE)) { - ar6k_cleanup_hci_pal(arPriv); - } - } - - if (ar->arHtcTarget != NULL) { -#ifdef EXPORT_HCI_BRIDGE_INTERFACE - if (NULL != ar6kHciTransCallbacks.cleanupTransport) { - ar6kHciTransCallbacks.cleanupTransport(NULL); - } -#else - // FIXME: workaround to reset BT's UART baud rate to default - if (NULL != ar->exitCallback) { - AR3K_CONFIG_INFO ar3kconfig; - A_STATUS status; - - A_MEMZERO(&ar3kconfig,sizeof(ar3kconfig)); - ar6000_set_default_ar3kconfig(ar, (void *)&ar3kconfig); - status = ar->exitCallback(&ar3kconfig); - if (A_OK != status) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to reset AR3K baud rate! \n")); - } - } - // END workaround - if (setuphci) - ar6000_cleanup_hci(ar); -#endif - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" Shutting down HTC .... \n")); - /* stop HTC */ - HTCStop(ar->arHtcTarget); - ar6k_init = FALSE; - } - - if (resetok) { - /* try to reset the device if we can - * The driver may have been configure NOT to reset the target during - * a debug session */ - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,(" Attempting to reset target on instance destroy.... \n")); - if (ar->arHifDevice != NULL) { -#if defined(CONFIG_MMC_MSM) || defined(CONFIG_MMC_SDHCI_S3C) - A_BOOL coldReset = ((ar->arTargetType == TARGET_TYPE_AR6003)|| (ar->arTargetType == TARGET_TYPE_MCKINLEY)) ? TRUE: FALSE; -#else - A_BOOL coldReset = (ar->arTargetType == TARGET_TYPE_MCKINLEY) ? TRUE: FALSE; -#endif - ar6000_reset_device(ar->arHifDevice, ar->arTargetType, TRUE, coldReset); - } - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" Host does not want target reset. \n")); - } - /* Done with cookies */ - ar6000_cookie_cleanup(ar); - - /* cleanup any allocated AMSDU buffers */ - ar6000_cleanup_amsdu_rxbufs(ar); - - if (bmienable) { - ar6000_sysfs_bmi_deinit(ar); - } -} - -void ar6000_cleanup(AR_SOFTC_T *ar) -{ - A_UINT8 ctr; - ar->bIsDestroyProgress = TRUE; - - if (down_interruptible(&ar->arSem)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s(): down_interruptible failed \n", __func__)); - return; - } - - if (ar->arWlanPowerState != WLAN_POWER_STATE_CUT_PWR) { - /* only stop endpoint if we are not stop it in suspend_ev */ - ar6000_stop_endpoint(ar, FALSE, TRUE); - } else { - /* clear up the platform power state before rmmod */ - plat_setup_power(ar, 1, 0); - ar->arPlatPowerOff = FALSE; - } - -#ifdef ATH_AR6K_11N_SUPPORT - for (ctr=0; ctr < NUM_CONN ; ctr++) { - aggr_module_destroy_conn(ar->connTbl[ctr].conn_aggr); - } - aggr_module_destroy(); -#endif - - ar->arWlanState = WLAN_DISABLED; - if (ar->arHtcTarget != NULL) { - /* destroy HTC */ - HTCDestroy(ar->arHtcTarget); - } - if (ar->arHifDevice != NULL) { - /*release the device so we do not get called back on remove incase we - * we're explicity destroyed by module unload */ - HIFReleaseDevice(ar->arHifDevice); - HIFShutDownDevice(ar->arHifDevice); - } - /* Done with cookies */ - ar6000_cookie_cleanup(ar); - - /* cleanup any allocated AMSDU buffers */ - ar6000_cleanup_amsdu_rxbufs(ar); - - if (bmienable) { - ar6000_sysfs_bmi_deinit(ar); - } - - /* Cleanup BMI */ - BMICleanup(); - - /* Clear the tx counters */ - memset(tx_attempt, 0, sizeof(tx_attempt)); - memset(tx_post, 0, sizeof(tx_post)); - memset(tx_complete, 0, sizeof(tx_complete)); - -#ifdef HTC_RAW_INTERFACE - if (ar->arRawHtc) { - A_FREE(ar->arRawHtc); - ar->arRawHtc = NULL; - } -#endif - A_UNTIMEOUT(&ar->ap_reconnect_timer); - A_UNTIMEOUT(&ar->arHBChallengeResp.timer); - A_FREE(ar); - -} -/* - * We need to differentiate between the surprise and planned removal of the - * device because of the following consideration: - * - In case of surprise removal, the hcd already frees up the pending - * for the device and hence there is no need to unregister the function - * driver inorder to get these requests. For planned removal, the function - * driver has to explictly unregister itself to have the hcd return all the - * pending requests before the data structures for the devices are freed up. - * Note that as per the current implementation, the function driver will - * end up releasing all the devices since there is no API to selectively - * release a particular device. - * - Certain commands issued to the target can be skipped for surprise - * removal since they will anyway not go through. - */ -void -ar6000_destroy(struct net_device *dev, unsigned int unregister) -{ - AR_SOFTC_DEV_T *arPriv; - AR_SOFTC_AP_T *arAp; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("+ar6000_destroy \n")); - - if((dev == NULL) || ((arPriv = ar6k_priv(dev)) == NULL)) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s(): Failed to get device structure.\n", __func__)); - return; - } - - A_UNTIMEOUT(&arPriv->ap_acs_timer); - aggr_module_destroy_conn(arPriv->conn_aggr); - - if(arPriv->arNetworkType == AP_NETWORK) - { - arAp = &arPriv->arAp; - -#ifdef ATH_SUPPORT_DFS - dfs_detach_host(arAp->pDfs); -#endif - } - ar6k_init = FALSE; - /* Free up the device data structure */ - if (unregister) { - unregister_netdev(dev); - } -#define free_netdev_support -#ifndef free_netdev_support - kfree(dev); -#else - free_netdev(dev); -#endif - -#ifdef ATH6K_CONFIG_CFG80211 - ar6k_cfg80211_deinit(arPriv); -#endif /* ATH6K_CONFIG_CFG80211 */ - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("-ar6000_destroy \n")); -} - -static void ap_reconnect_timer_handler(unsigned long ptr) -{ - AR_SOFTC_T *ar= (AR_SOFTC_T *)ptr; - AR_SOFTC_DEV_T *arTempPriv = NULL; - A_UINT8 i=0; - A_UNTIMEOUT(&ar->ap_reconnect_timer); - - if(ar->arHoldConnection){ - ar->arHoldConnection = FALSE; - for(i=0;iarConfNumDev;i++){ - arTempPriv = ar->arDev[i]; - if((AP_NETWORK == arTempPriv->arNetworkType) && - (arTempPriv->arHoldConnection)){ - arTempPriv->arHoldConnection = FALSE; - ar6000_ap_mode_profile_commit(arTempPriv); - } - } - } -} -static void disconnect_timer_handler(unsigned long ptr) -{ - struct net_device *dev = (struct net_device *)ptr; - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - - A_UNTIMEOUT(&arPriv->arSta.disconnect_timer); - - ar6000_init_profile_info(arPriv); - ar6000_disconnect(arPriv); -} - -static void ar6000_detect_error(unsigned long ptr) -{ - AR_SOFTC_T *ar = (AR_SOFTC_T *)ptr; - A_UINT8 i; - WMI_TARGET_ERROR_REPORT_EVENT errEvent; - - AR6000_SPIN_LOCK(&ar->arLock, 0); - - if (ar->arHBChallengeResp.outstanding) { - ar->arHBChallengeResp.missCnt++; - } else { - ar->arHBChallengeResp.missCnt = 0; - } - - if (ar->arHBChallengeResp.missCnt > ar->arHBChallengeResp.missThres) { - /* Send Error Detect event to the application layer and do not reschedule the error detection module timer */ - ar->arHBChallengeResp.missCnt = 0; - ar->arHBChallengeResp.seqNum = 0; - errEvent.errorVal = WMI_TARGET_COM_ERR | WMI_TARGET_FATAL_ERR; - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - for(i = 0; i < num_device; i++) - { - ar6000_send_event_to_app(ar->arDev[i], WMI_ERROR_REPORT_EVENTID, - (A_UINT8 *)&errEvent, - sizeof(WMI_TARGET_ERROR_REPORT_EVENT)); - } - return; - } - - /* Generate the sequence number for the next challenge */ - ar->arHBChallengeResp.seqNum++; - ar->arHBChallengeResp.outstanding = TRUE; - - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - - /* Send the challenge on the control channel */ - if (wmi_get_challenge_resp_cmd(ar->arDev[0]->arWmi, ar->arHBChallengeResp.seqNum, DRV_HB_CHALLENGE) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to send heart beat challenge\n")); - } - - - /* Reschedule the timer for the next challenge */ - A_TIMEOUT_MS(&ar->arHBChallengeResp.timer, ar->arHBChallengeResp.frequency * 1000, 0); -} - -void ar6000_init_profile_info(AR_SOFTC_DEV_T *arPriv) -{ - A_UINT8 mode = 0; - A_UINT8 submode = 0; - mode = ((fwmode >> (arPriv->arDeviceIndex * HI_OPTION_FW_MODE_BITS)) & (HI_OPTION_FW_MODE_MASK )); - - switch(mode) { - case HI_OPTION_FW_MODE_IBSS: - arPriv->arNetworkType = arPriv->arNextMode = ADHOC_NETWORK; - break; - case HI_OPTION_FW_MODE_BSS_STA: - arPriv->arNetworkType = arPriv->arNextMode = INFRA_NETWORK; - break; - case HI_OPTION_FW_MODE_AP: - arPriv->arNetworkType = arPriv->arNextMode = AP_NETWORK; - break; - case HI_OPTION_FW_MODE_BT30AMP: - arPriv->arNetworkType = arPriv->arNextMode = INFRA_NETWORK; - arPriv->isBt30amp = TRUE; - break; - } - /* Initialize firware sub mode - */ - submode = ((fwsubmode>>(arPriv->arDeviceIndex * HI_OPTION_FW_SUBMODE_BITS)) - & (HI_OPTION_FW_SUBMODE_MASK)); - - switch(submode) { - case HI_OPTION_FW_SUBMODE_NONE: - arPriv->arNetworkSubType = SUBTYPE_NONE; - break; - case HI_OPTION_FW_SUBMODE_P2PDEV: - arPriv->arNetworkSubType = SUBTYPE_P2PDEV; - break; - case HI_OPTION_FW_SUBMODE_P2PCLIENT: - arPriv->arNetworkSubType = SUBTYPE_P2PCLIENT; - break; - case HI_OPTION_FW_SUBMODE_P2PGO: - arPriv->arNetworkSubType = SUBTYPE_P2PGO; - break; - } - - ar6000_init_mode_info(arPriv); -} - -static int -ar6000_init_control_info(AR_SOFTC_DEV_T *arPriv) -{ - AR_SOFTC_T *ar = arPriv->arSoftc; - - arPriv->arWmiEnabled = FALSE; - ar->arVersion.host_ver = AR6K_SW_VERSION; - - if(!(strcmp(targetconf,"mobile"))) - ar->arVersion.targetconf_ver = AR6003_SUBVER_MOBILE; - else if(!(strcmp(targetconf,"tablet"))) - ar->arVersion.targetconf_ver = AR6003_SUBVER_TABLET; - else if(!(strcmp(targetconf,"router"))) - ar->arVersion.targetconf_ver = AR6003_SUBVER_ROUTER; - else if(!(strcmp(targetconf,"default"))) - ar->arVersion.targetconf_ver = AR6003_SUBVER_DEFAULT; - else - ar->arVersion.targetconf_ver = AR6003_SUBVER_MOBILE; - - - ar6000_init_profile_info(arPriv); - - if((arPriv->conn_aggr = aggr_init_conn()) == NULL) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("%s() Failed to initialize aggr.\n", __func__)); - return A_ERROR; - } - return A_OK; -} - -static int -ar6000_open(struct net_device *dev) -{ - unsigned long flags; - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - - spin_lock_irqsave(&arPriv->arPrivLock, flags); - -#ifdef ATH6K_CONFIG_CFG80211 - if(arPriv->arSoftc->arWlanState == WLAN_DISABLED) { - arPriv->arSoftc->arWlanState = WLAN_ENABLED; - } -#endif /* ATH6K_CONFIG_CFG80211 */ - - if( arPriv->arConnected || bypasswmi) { - netif_carrier_on(dev); - /* Wake up the queues */ - netif_wake_queue(dev); - } - else - netif_carrier_off(dev); - - spin_unlock_irqrestore(&arPriv->arPrivLock, flags); - return 0; -} - -static int -ar6000_close(struct net_device *dev) -{ -#ifdef ATH6K_CONFIG_CFG80211 - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); -#endif /* ATH6K_CONFIG_CFG80211 */ - netif_stop_queue(dev); - -#ifdef ATH6K_CONFIG_CFG80211 - ar6000_disconnect(arPriv); - - if(arPriv->arSoftc->arWmiReady == TRUE) { - if (wmi_scanparams_cmd(arPriv->arWmi, 0xFFFF, 0, - 0, 0, 0, 0, 0, 0, 0, 0) != A_OK) { - return -EIO; - } - arPriv->arSoftc->arWlanState = WLAN_DISABLED; - } -#endif /* ATH6K_CONFIG_CFG80211 */ - - return 0; -} - -/* connect to a service */ -static A_STATUS ar6000_connectservice(AR_SOFTC_DEV_T *arPriv, - HTC_SERVICE_CONNECT_REQ *pConnect, - char *pDesc) -{ - A_STATUS status; - HTC_SERVICE_CONNECT_RESP response; - AR_SOFTC_T *ar = arPriv->arSoftc; - - do { - - A_MEMZERO(&response,sizeof(response)); - - status = HTCConnectService(ar->arHtcTarget, - pConnect, - &response); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" Failed to connect to %s service status:%d \n", - pDesc, status)); - break; - } - switch (pConnect->ServiceID) { - case WMI_CONTROL_SVC : - if(!bypasswmi) - { - /* set control endpoint for WMI use */ - wmi_set_control_ep(arPriv->arWmi, response.Endpoint); - /* save EP for fast lookup */ - ar->arControlEp = response.Endpoint; - } - break; - case WMI_DATA_BE_SVC : - arSetAc2EndpointIDMap(ar, WMM_AC_BE, response.Endpoint); - break; - case WMI_DATA_BK_SVC : - arSetAc2EndpointIDMap(ar, WMM_AC_BK, response.Endpoint); - break; - case WMI_DATA_VI_SVC : - arSetAc2EndpointIDMap(ar, WMM_AC_VI, response.Endpoint); - break; - case WMI_DATA_VO_SVC : - arSetAc2EndpointIDMap(ar, WMM_AC_VO, response.Endpoint); - break; - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ServiceID not mapped %d\n", pConnect->ServiceID)); - status = A_EINVAL; - break; - } - - } while (FALSE); - - return status; -} - -void ar6000_TxDataCleanup(AR_SOFTC_T *ar) -{ - /* flush all the data (non-control) streams - * we only flush packets that are tagged as data, we leave any control packets that - * were in the TX queues alone */ - HTCFlushEndpoint(ar->arHtcTarget, - arAc2EndpointID(ar, WMM_AC_BE), - AR6K_DATA_PKT_TAG); - HTCFlushEndpoint(ar->arHtcTarget, - arAc2EndpointID(ar, WMM_AC_BK), - AR6K_DATA_PKT_TAG); - HTCFlushEndpoint(ar->arHtcTarget, - arAc2EndpointID(ar, WMM_AC_VI), - AR6K_DATA_PKT_TAG); - HTCFlushEndpoint(ar->arHtcTarget, - arAc2EndpointID(ar, WMM_AC_VO), - AR6K_DATA_PKT_TAG); -} - -HTC_ENDPOINT_ID -ar6000_ac2_endpoint_id ( void * devt, A_UINT8 ac) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *) devt; - AR_SOFTC_T *ar = arPriv->arSoftc; - return(arAc2EndpointID(ar, ac)); -} - -A_UINT8 -ar6000_endpoint_id2_ac(void * devt, HTC_ENDPOINT_ID ep ) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *) devt; - AR_SOFTC_T *ar = arPriv->arSoftc; - return(arEndpoint2Ac(ar, ep )); -} - - -/* This function does one time initialization for the lifetime of the device */ -int ar6000_init(struct net_device *dev) -{ - AR_SOFTC_DEV_T *arPriv; - AR_SOFTC_T *ar; - int ret = 0; - int i = 0; - int j = 0; - A_STATUS status; - A_INT32 timeleft; -#if defined(INIT_MODE_DRV_ENABLED) && defined(ENABLE_COEXISTENCE) - WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD sbcb_cmd; - WMI_SET_BTCOEX_FE_ANT_CMD sbfa_cmd; -#endif /* INIT_MODE_DRV_ENABLED && ENABLE_COEXISTENCE */ - - dev_hold(dev); - rtnl_unlock(); - - if(ar6k_init) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR6000 Initialised\n")); - goto ar6000_init_done; - } - - ar6k_init = TRUE; - if((arPriv = ar6k_priv(dev)) == NULL) - { - ret = -EIO; - goto ar6000_init_done; - } - - ar = arPriv->arSoftc; - - if (wlaninitmode == WLAN_INIT_MODE_USR || wlaninitmode == WLAN_INIT_MODE_DRV) { - - ar6000_update_bdaddr(ar); - } - - if (enablerssicompensation) { - ar6000_copy_cust_data_from_target(ar->arHifDevice, ar->arTargetType); - read_rssi_compensation_param(ar); - for(j=0; jarDev[j],i); - } - } - } - - /* Do we need to finish the BMI phase */ - - if ((wlaninitmode==WLAN_INIT_MODE_USR || wlaninitmode==WLAN_INIT_MODE_DRV) && - (BMIDone(ar->arHifDevice) != A_OK)) - { - ret = -EIO; - goto ar6000_init_done; - } - - do { - HTC_SERVICE_CONNECT_REQ connect; - - /* the reason we have to wait for the target here is that the driver layer - * has to init BMI in order to set the host block size, - */ - status = HTCWaitTarget(ar->arHtcTarget); - - if (A_FAILED(status)) { - break; - } - - A_MEMZERO(&connect,sizeof(connect)); - /* meta data is unused for now */ - connect.pMetaData = NULL; - connect.MetaDataLength = 0; - /* these fields are the same for all service endpoints */ - connect.EpCallbacks.pContext = ar; - connect.EpCallbacks.EpTxCompleteMultiple = ar6000_tx_complete; - connect.EpCallbacks.EpRecv = ar6000_rx; - connect.EpCallbacks.EpRecvRefill = ar6000_rx_refill; - connect.EpCallbacks.EpSendFull = ar6000_tx_queue_full; - /* set the max queue depth so that our ar6000_tx_queue_full handler gets called. - * Linux has the peculiarity of not providing flow control between the - * NIC and the network stack. There is no API to indicate that a TX packet - * was sent which could provide some back pressure to the network stack. - * Under linux you would have to wait till the network stack consumed all sk_buffs - * before any back-flow kicked in. Which isn't very friendly. - * So we have to manage this ourselves */ - connect.MaxSendQueueDepth = MAX_DEFAULT_SEND_QUEUE_DEPTH; - connect.EpCallbacks.RecvRefillWaterMark = AR6000_MAX_RX_BUFFERS / 4; /* set to 25 % */ - if (0 == connect.EpCallbacks.RecvRefillWaterMark) { - connect.EpCallbacks.RecvRefillWaterMark++; - } - /* connect to control service */ - connect.ServiceID = WMI_CONTROL_SVC; - status = ar6000_connectservice(arPriv, - &connect, - "WMI CONTROL"); - if (A_FAILED(status)) { - break; - } - - connect.LocalConnectionFlags |= HTC_LOCAL_CONN_FLAGS_ENABLE_SEND_BUNDLE_PADDING; - /* limit the HTC message size on the send path, although we can receive A-MSDU frames of - * 4K, we will only send ethernet-sized (802.3) frames on the send path. */ - connect.MaxSendMsgSize = WMI_MAX_TX_DATA_FRAME_LENGTH; - - /* to reduce the amount of committed memory for larger A_MSDU frames, use the recv-alloc threshold - * mechanism for larger packets */ - connect.EpCallbacks.RecvAllocThreshold = AR6000_BUFFER_SIZE; - connect.EpCallbacks.EpRecvAllocThresh = ar6000_alloc_amsdu_rxbuf; - - /* for the remaining data services set the connection flag to reduce dribbling, - * if configured to do so */ - if (reduce_credit_dribble) { - connect.ConnectionFlags |= HTC_CONNECT_FLAGS_REDUCE_CREDIT_DRIBBLE; - /* the credit dribble trigger threshold is (reduce_credit_dribble - 1) for a value - * of 0-3 */ - connect.ConnectionFlags &= ~HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_MASK; - connect.ConnectionFlags |= - ((A_UINT16)reduce_credit_dribble - 1) & HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_MASK; - } - /* connect to best-effort service */ - connect.ServiceID = WMI_DATA_BE_SVC; - - status = ar6000_connectservice(arPriv, - &connect, - "WMI DATA BE"); - if (A_FAILED(status)) { - break; - } - - /* connect to back-ground - * map this to WMI LOW_PRI */ - connect.ServiceID = WMI_DATA_BK_SVC; - status = ar6000_connectservice(arPriv, - &connect, - "WMI DATA BK"); - if (A_FAILED(status)) { - break; - } - - /* connect to Video service, map this to - * to HI PRI */ - connect.ServiceID = WMI_DATA_VI_SVC; - status = ar6000_connectservice(arPriv, - &connect, - "WMI DATA VI"); - if (A_FAILED(status)) { - break; - } - - /* connect to VO service, this is currently not - * mapped to a WMI priority stream due to historical reasons. - * WMI originally defined 3 priorities over 3 mailboxes - * We can change this when WMI is reworked so that priorities are not - * dependent on mailboxes */ - connect.ServiceID = WMI_DATA_VO_SVC; - status = ar6000_connectservice(arPriv, - &connect, - "WMI DATA VO"); - if (A_FAILED(status)) { - break; - } - - A_ASSERT(arAc2EndpointID(ar,WMM_AC_BE) != 0); - A_ASSERT(arAc2EndpointID(ar,WMM_AC_BK) != 0); - A_ASSERT(arAc2EndpointID(ar,WMM_AC_VI) != 0); - A_ASSERT(arAc2EndpointID(ar,WMM_AC_VO) != 0); - - /* setup access class priority mappings */ - ar->arAcStreamPriMap[WMM_AC_BK] = 0; /* lowest */ - ar->arAcStreamPriMap[WMM_AC_BE] = 1; /* */ - ar->arAcStreamPriMap[WMM_AC_VI] = 2; /* */ - ar->arAcStreamPriMap[WMM_AC_VO] = 3; /* highest */ - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE - if (setuphci && (NULL != ar6kHciTransCallbacks.setupTransport)) { - HCI_TRANSPORT_MISC_HANDLES hciHandles; - - hciHandles.netDevice = ar->arNetDev; - hciHandles.hifDevice = ar->arHifDevice; - hciHandles.htcHandle = ar->arHtcTarget; - status = (A_STATUS)(ar6kHciTransCallbacks.setupTransport(&hciHandles)); - } -#else - if (setuphci) { - /* setup HCI */ - status = ar6000_setup_hci(ar); - } -#endif - - } while (FALSE); - - if (A_FAILED(status)) { - ret = -EIO; - goto ar6000_init_done; - } - - /* - * give our connected endpoints some buffers - */ - - ar6000_rx_refill(ar, ar->arControlEp); - ar6000_rx_refill(ar, arAc2EndpointID(ar,WMM_AC_BE)); - - /* - * We will post the receive buffers only for SPE or endpoint ping testing so we are - * making it conditional on the 'bypasswmi' flag. - */ - if (bypasswmi) { - ar6000_rx_refill(ar,arAc2EndpointID(ar,WMM_AC_BK)); - ar6000_rx_refill(ar,arAc2EndpointID(ar,WMM_AC_VI)); - ar6000_rx_refill(ar,arAc2EndpointID(ar,WMM_AC_VO)); - } - - /* allocate some buffers that handle larger AMSDU frames */ - ar6000_refill_amsdu_rxbufs(ar,AR6000_MAX_AMSDU_RX_BUFFERS); - - /* setup credit distribution */ - ar6000_setup_credit_dist(ar->arHtcTarget, &ar->arCreditStateInfo); - - /* Since cookies are used for HTC transports, they should be */ - /* initialized prior to enabling HTC. */ - ar6000_cookie_init(ar); - - /* start HTC */ - status = HTCStart(ar->arHtcTarget); - if (status != A_OK) { - for(i = 0; i < num_device; i++) - { - if (ar->arDev[i]->arWmiEnabled == TRUE) { - wmi_shutdown(ar->arDev[i]->arWmi); - ar->arDev[i]->arWmiEnabled = FALSE; - ar->arDev[i]->arWmi = NULL; - } - } - ar6000_cookie_cleanup(ar); - ret = -EIO; - goto ar6000_init_done; - } - - if (!bypasswmi) { - /* Wait for Wmi event to be ready */ - timeleft = wait_event_interruptible_timeout(ar->arDev[0]->arEvent, - (ar->arWmiReady == TRUE), wmitimeout * HZ); - - if (ar->arVersion.abi_ver != AR6K_ABI_VERSION) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ABI Version mismatch: Host(0x%x), Target(0x%x)\n", AR6K_ABI_VERSION, ar->arVersion.abi_ver)); -#ifndef ATH6KL_SKIP_ABI_VERSION_CHECK - ret = -EIO; - goto ar6000_init_done; -#endif /* ATH6KL_SKIP_ABI_VERSION_CHECK */ - } - - if(!timeleft || signal_pending(current)) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("WMI is not ready or wait was interrupted\n")); - ret = -EIO; - goto ar6000_init_done; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%s() WMI is ready\n", __func__)); - - /* init PAL driver after WMI is ready */ - - if(setuphcipal) { - A_BOOL bt30ampDevFound = FALSE; - for (i=0; i < num_device; i++) { - if ( ar->arDev[i]->isBt30amp == TRUE ) { - status = ar6k_setup_hci_pal(ar->arDev[i]); - bt30ampDevFound = TRUE; - } - - } - } - - /* Communicate the wmi protocol verision to the target */ - if ((ar6000_set_host_app_area(ar)) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set the host app area\n")); - } - - /* configure the device for rx dot11 header rules 0,0 are the default values - * therefore this command can be skipped if the inputs are 0,FALSE,FALSE.Required - if checksum offload is needed. Set RxMetaVersion to 2*/ - if ((wmi_set_rx_frame_format_cmd(arPriv->arWmi,ar->rxMetaVersion, processDot11Hdr, processDot11Hdr)) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set the rx frame format.\n")); - } - -#if defined(INIT_MODE_DRV_ENABLED) && defined(ENABLE_COEXISTENCE) - /* Configure the type of BT collocated with WLAN */ - A_MEMZERO(&sbcb_cmd, sizeof(WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD)); -#ifdef CONFIG_AR600x_BT_QCOM - sbcb_cmd.btcoexCoLocatedBTdev = 1; -#elif defined(CONFIG_AR600x_BT_CSR) - sbcb_cmd.btcoexCoLocatedBTdev = 2; -#elif defined(CONFIG_AR600x_BT_AR3001) - sbcb_cmd.btcoexCoLocatedBTdev = 3; -#else -#error Unsupported Bluetooth Type -#endif /* Collocated Bluetooth Type */ - - if ((wmi_set_btcoex_colocated_bt_dev_cmd(arPriv->arWmi, &sbcb_cmd)) != A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set collocated BT type\n")); - } - - /* Configure the type of BT collocated with WLAN */ - A_MEMZERO(&sbfa_cmd, sizeof(WMI_SET_BTCOEX_FE_ANT_CMD)); -#ifdef CONFIG_AR600x_DUAL_ANTENNA - sbfa_cmd.btcoexFeAntType = 2; -#elif defined(CONFIG_AR600x_SINGLE_ANTENNA) - sbfa_cmd.btcoexFeAntType = 1; -#else -#error Unsupported Front-End Antenna Configuration -#endif /* AR600x Front-End Antenna Configuration */ - - if ((wmi_set_btcoex_fe_ant_cmd(arPriv->arWmi, &sbfa_cmd)) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to set fornt end antenna configuration\n")); - } -#endif /* INIT_MODE_DRV_ENABLED && ENABLE_COEXISTENCE */ - } - - ar->arNumDataEndPts = 1; - - if (bypasswmi) { - /* for tests like endpoint ping, the MAC address needs to be non-zero otherwise - * the data path through a raw socket is disabled */ - dev->dev_addr[0] = 0x00; - dev->dev_addr[1] = 0x01; - dev->dev_addr[2] = 0x02; - dev->dev_addr[3] = 0xAA; - dev->dev_addr[4] = 0xBB; - dev->dev_addr[5] = 0xCC; - } - - -ar6000_init_done: - rtnl_lock(); - dev_put(dev); - - return ret; - -} - - -void -ar6000_bitrate_rx(void *devt, A_INT32 rateKbps) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)devt; - - arPriv->arBitRate = rateKbps; - wake_up(&arPriv->arEvent); -} - -void -ar6000_ratemask_rx(void *devt, A_UINT32 *ratemask) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)devt; - - arPriv->arRateMask[0] = ratemask[0]; - arPriv->arRateMask[1] = ratemask[1]; - wake_up(&arPriv->arEvent); -} - -void -ar6000_txPwr_rx(void *devt, A_UINT8 txPwr) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)devt; - - arPriv->arTxPwr = txPwr; - wake_up(&arPriv->arEvent); -} - - -void -ar6000_channelList_rx(void *devt, A_INT8 numChan, A_UINT16 *chanList) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)devt; - - A_MEMCPY(arPriv->arSta.arChannelList, chanList, numChan * sizeof (A_UINT16)); - arPriv->arSta.arNumChannels = numChan; - - wake_up(&arPriv->arEvent); -} - -A_UINT8 -ar6000_ibss_map_epid(struct sk_buff *skb, struct net_device *dev, A_UINT32 * mapNo) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - AR_SOFTC_T *ar = arPriv->arSoftc; - A_UINT8 *datap; - ATH_MAC_HDR *macHdr; - A_UINT32 i, eptMap; - - (*mapNo) = 0; - datap = A_NETBUF_DATA(skb); - macHdr = (ATH_MAC_HDR *)(datap + sizeof(WMI_DATA_HDR)); - if (IEEE80211_IS_MULTICAST(macHdr->dstMac)) { - return ENDPOINT_2; - } - - eptMap = -1; - for (i = 0; i < arSta->arNodeNum; i ++) { - if (IEEE80211_ADDR_EQ(macHdr->dstMac, arSta->arNodeMap[i].macAddress)) { - (*mapNo) = i + 1; - arSta->arNodeMap[i].txPending ++; - return arSta->arNodeMap[i].epId; - } - - if ((eptMap == -1) && !arSta->arNodeMap[i].txPending) { - eptMap = i; - } - } - - if (eptMap == -1) { - eptMap = arSta->arNodeNum; - arSta->arNodeNum ++; - A_ASSERT(arSta->arNodeNum <= MAX_NODE_NUM); - } - - A_MEMCPY(arSta->arNodeMap[eptMap].macAddress, macHdr->dstMac, IEEE80211_ADDR_LEN); - - for (i = ENDPOINT_2; i <= ENDPOINT_5; i ++) { - if (!ar->arTxPending[i]) { - arSta->arNodeMap[eptMap].epId = i; - break; - } - // No free endpoint is available, start redistribution on the inuse endpoints. - if (i == ENDPOINT_5) { - arSta->arNodeMap[eptMap].epId = arSta->arNexEpId; - arSta->arNexEpId ++; - if (arSta->arNexEpId > ENDPOINT_5) { - arSta->arNexEpId = ENDPOINT_2; - } - } - } - - (*mapNo) = eptMap + 1; - arSta->arNodeMap[eptMap].txPending ++; - - return arSta->arNodeMap[eptMap].epId; -} - -#ifdef DEBUG -static void ar6000_dump_skb(struct sk_buff *skb) -{ - u_char *ch; - for (ch = A_NETBUF_DATA(skb); - (A_UINT32)ch < ((A_UINT32)A_NETBUF_DATA(skb) + - A_NETBUF_LEN(skb)); ch++) - { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN,("%2.2x ", *ch)); - } - AR_DEBUG_PRINTF(ATH_DEBUG_WARN,("\n")); -} -#endif - -#ifdef HTC_TEST_SEND_PKTS -static void DoHTCSendPktsTest(AR_SOFTC_T *ar, int MapNo, HTC_ENDPOINT_ID eid, struct sk_buff *skb); -#endif - -void -check_addba_state(AR_SOFTC_DEV_T *arPriv, struct sk_buff *skb, conn_t *conn) -{ - A_UINT8 *datap; - A_UINT8 tid = 0; - WMI_DATA_HDR *dtHdr; - - /* Perform ADDBA if required */ - if(conn && (conn->wmode == MODE_11NG_HT20)) { - datap = A_NETBUF_DATA(skb); - dtHdr = (WMI_DATA_HDR *)datap; - tid = WMI_DATA_HDR_GET_UP(dtHdr); - - if(conn->ba_state[tid] < 3) { - wmi_setup_aggr_cmd(arPriv->arWmi, tid | (conn->aid << 4)); - conn->ba_state[tid]++; - } - } -} - -static int -ar6000_data_tx(struct sk_buff *skb, struct net_device *dev) -{ -#define AC_NOT_MAPPED 99 - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - AR_SOFTC_AP_T *arAp = &arPriv->arAp; - A_UINT8 ac = AC_NOT_MAPPED; - HTC_ENDPOINT_ID eid = ENDPOINT_UNUSED; - A_UINT32 mapNo = 0; - int len; - struct ar_cookie *cookie; - A_BOOL checkAdHocPsMapping = FALSE; - HTC_TX_TAG htc_tag = AR6K_DATA_PKT_TAG; - A_UINT8 dot11Hdr = processDot11Hdr; - A_UINT8 check_addba = 0; - conn_t *conn = NULL; - A_UINT32 wmiDataFlags = 0; - -#ifdef AR6K_ALLOC_DEBUG - A_NETBUF_CHECK(skb); -#endif - -#ifdef CONFIG_PM - if ((ar->arWowState != WLAN_WOW_STATE_NONE) || (ar->arWlanState == WLAN_DISABLED)) { - A_NETBUF_FREE(skb); - return 0; - } -#endif /* CONFIG_PM */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13) - skb->list = NULL; -#endif - - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_TX,("ar6000_data_tx start - skb=0x%x, data=0x%x, len=0x%x\n", - (A_UINT32)skb, (A_UINT32)A_NETBUF_DATA(skb), - A_NETBUF_LEN(skb))); - - /* If target is not associated */ - if( (!arPriv->arConnected && !bypasswmi) -#ifdef CONFIG_HOST_TCMD_SUPPORT - /* TCMD doesnt support any data, free the buf and return */ - || (ar->arTargetMode == AR6000_TCMD_MODE) -#endif - ) { - A_NETBUF_FREE(skb); - return 0; - } - - do { - - if (ar->arWmiReady == FALSE && bypasswmi == 0) { - break; - } - -#ifdef BLOCK_TX_PATH_FLAG - if (blocktx) { - break; - } -#endif /* BLOCK_TX_PATH_FLAG */ - - /* AP mode Power save processing */ - /* If the dst STA is in sleep state, queue the pkt in its PS queue */ - - if (arPriv->arNetworkType == AP_NETWORK) { - ATH_MAC_HDR *datap = (ATH_MAC_HDR *)A_NETBUF_DATA(skb); - - /* If the dstMac is a Multicast address & atleast one of the - * associated STA is in PS mode, then queue the pkt to the - * mcastq - */ - if (IEEE80211_IS_MULTICAST(datap->dstMac)) { - A_UINT8 ctr=0; - A_BOOL qMcast=FALSE; - - for (ctr=0; ctrconnTbl[ctr].arPriv == arPriv) { - if (STA_IS_PWR_SLEEP((&ar->connTbl[ctr]))) { - qMcast = TRUE; - } - } - } - if(qMcast) { - /* If this transmit is not because of a Dtim Expiry q it */ - if (arAp->DTIMExpired == FALSE) { - A_BOOL isMcastqEmpty = FALSE; - - A_MUTEX_LOCK(&arAp->mcastpsqLock); - isMcastqEmpty = A_NETBUF_QUEUE_EMPTY(&arAp->mcastpsq); - A_NETBUF_ENQUEUE(&arAp->mcastpsq, skb); - A_MUTEX_UNLOCK(&arAp->mcastpsqLock); - - /* If this is the first Mcast pkt getting queued - * indicate to the target to set the BitmapControl LSB - * of the TIM IE. - */ - if (isMcastqEmpty) { - wmi_set_pvb_cmd(arPriv->arWmi, MCAST_AID, 1); - } - return 0; - } else { - /* This transmit is because of Dtim expiry. Determine if - * MoreData bit has to be set. - */ - A_MUTEX_LOCK(&arAp->mcastpsqLock); - if(!A_NETBUF_QUEUE_EMPTY(&arAp->mcastpsq)) { - wmiDataFlags |= WMI_DATA_HDR_FLAGS_MORE; - } - A_MUTEX_UNLOCK(&arAp->mcastpsqLock); - } - } - } else { - conn = ieee80211_find_conn(arPriv, datap->dstMac); - if (conn) { - if (STA_IS_PWR_SLEEP(conn)) { - /* If this transmit is not because of a PsPoll q it*/ - if (!(STA_IS_PS_POLLED(conn) || STA_IS_APSD_TRIGGER(conn))) { - A_BOOL trigger = FALSE; - - if (conn->apsd_info) { - A_UINT8 up = 0; - A_UINT8 trafficClass; - - if (arPriv->arWmmEnabled) { - A_UINT16 ipType = IP_ETHERTYPE; - A_UINT16 etherType; - A_UINT8 *ipHdr; - - etherType = datap->typeOrLen; - if (IS_ETHERTYPE(A_BE2CPU16(etherType))) { - /* packet is in DIX format */ - ipHdr = (A_UINT8 *)(datap + 1); - } else { - /* packet is in 802.3 format */ - ATH_LLC_SNAP_HDR *llcHdr; - - llcHdr = (ATH_LLC_SNAP_HDR *)(datap + 1); - etherType = llcHdr->etherType; - ipHdr = (A_UINT8 *)(llcHdr + 1); - } - - if (etherType == A_CPU2BE16(ipType)) { - up = wmi_determine_userPriority (ipHdr, 0); - } - } - trafficClass = convert_userPriority_to_trafficClass(up); - if (conn->apsd_info & (1 << trafficClass)) { - trigger = TRUE; - } - } - - if (trigger) { - A_BOOL isApsdqEmpty; - /* Queue the frames if the STA is sleeping */ - A_MUTEX_LOCK(&conn->psqLock); - isApsdqEmpty = A_NETBUF_QUEUE_EMPTY(&conn->apsdq); - A_NETBUF_ENQUEUE(&conn->apsdq, skb); - A_MUTEX_UNLOCK(&conn->psqLock); - - /* If this is the first pkt getting queued - * for this STA, update the PVB for this STA - */ - if (isApsdqEmpty) { - wmi_set_apsd_buffered_traffic_cmd(arPriv->arWmi, conn->aid, 1, 0); - } - } else { - A_BOOL isPsqEmpty = FALSE; - /* Queue the frames if the STA is sleeping */ - A_MUTEX_LOCK(&conn->psqLock); - isPsqEmpty = A_NETBUF_QUEUE_EMPTY(&conn->psq); - A_NETBUF_ENQUEUE(&conn->psq, skb); - A_MUTEX_UNLOCK(&conn->psqLock); - - /* If this is the first pkt getting queued - * for this STA, update the PVB for this STA - */ - if (isPsqEmpty) { - wmi_set_pvb_cmd(arPriv->arWmi, conn->aid, 1); - } - } - - return 0; - } else { - /* - * This tx is because of a PsPoll or trigger. Determine if - * MoreData bit has to be set - */ - A_MUTEX_LOCK(&conn->psqLock); - if (STA_IS_PS_POLLED(conn)) { - if (!A_NETBUF_QUEUE_EMPTY(&conn->psq)) { - wmiDataFlags |= WMI_DATA_HDR_FLAGS_MORE; - } - } else { - /* - * This tx is because of a uAPSD trigger, determine - * more and EOSP bit. Set EOSP is queue is empty - * or sufficient frames is delivered for this trigger - */ - if (!A_NETBUF_QUEUE_EMPTY(&conn->apsdq)) { - wmiDataFlags |= WMI_DATA_HDR_FLAGS_MORE; - } - if (STA_IS_APSD_EOSP(conn)) { - wmiDataFlags |= WMI_DATA_HDR_FLAGS_EOSP; - } - } - A_MUTEX_UNLOCK(&conn->psqLock); - } - } - check_addba = 1; - } else { - - /* non existent STA. drop the frame */ - A_NETBUF_FREE(skb); - return 0; - } - } - } - - if (arPriv->arWmiEnabled) { -#ifdef CONFIG_CHECKSUM_OFFLOAD - A_UINT8 csumStart=0; - A_UINT8 csumDest=0; - A_UINT8 csum=skb->ip_summed; - if(csumOffload && (csum==CHECKSUM_PARTIAL)){ - csumStart=skb->csum_start-(skb->network_header-skb->head)+sizeof(ATH_LLC_SNAP_HDR); - csumDest=skb->csum_offset+csumStart; - } -#endif - if (A_NETBUF_HEADROOM(skb) < dev->hard_header_len - LINUX_HACK_FUDGE_FACTOR) { - struct sk_buff *newbuf; - - /* - * We really should have gotten enough headroom but sometimes - * we still get packets with not enough headroom. Copy the packet. - */ - len = A_NETBUF_LEN(skb); - newbuf = A_NETBUF_ALLOC(len); - if (newbuf == NULL) { - break; - } - A_NETBUF_PUT(newbuf, len); - A_MEMCPY(A_NETBUF_DATA(newbuf), A_NETBUF_DATA(skb), len); - A_NETBUF_FREE(skb); - skb = newbuf; - /* fall through and assemble header */ - } - - if (dot11Hdr) { - if (wmi_dot11_hdr_add(arPriv->arWmi,skb,arPriv->arNetworkType) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_data_tx-wmi_dot11_hdr_add failed\n")); - break; - } - } else { - if (wmi_dix_2_dot3(arPriv->arWmi, skb) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_data_tx - wmi_dix_2_dot3 failed\n")); - break; - } - } -#ifdef CONFIG_CHECKSUM_OFFLOAD - if(csumOffload && (csum ==CHECKSUM_PARTIAL)){ - WMI_TX_META_V2 metaV2; - metaV2.csumStart =csumStart; - metaV2.csumDest = csumDest; - metaV2.csumFlags = 0x1;/*instruct target to calculate checksum*/ - if (wmi_data_hdr_add(arPriv->arWmi, skb, DATA_MSGTYPE, wmiDataFlags, dot11Hdr, - WMI_META_VERSION_2,&metaV2) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_data_tx - wmi_data_hdr_add failed\n")); - break; - } - - } - else -#endif - { - if (wmi_data_hdr_add(arPriv->arWmi, skb, DATA_MSGTYPE, wmiDataFlags, dot11Hdr,0,NULL) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_data_tx - wmi_data_hdr_add failed\n")); - break; - } - } - - - if ((arPriv->arNetworkType == ADHOC_NETWORK) && - arSta->arIbssPsEnable && arPriv->arConnected) { - /* flag to check adhoc mapping once we take the lock below: */ - checkAdHocPsMapping = TRUE; - - } else { - /* get the stream mapping */ - ac = wmi_implicit_create_pstream(arPriv->arWmi, skb, 0, arPriv->arWmmEnabled); - if(check_addba && conn) { - check_addba_state(arPriv, skb, conn); - } - } - - } else { - EPPING_HEADER *eppingHdr; - - eppingHdr = A_NETBUF_DATA(skb); - - if (IS_EPPING_PACKET(eppingHdr)) { - /* the stream ID is mapped to an access class */ - ac = eppingHdr->StreamNo_h; - /* some EPPING packets cannot be dropped no matter what access class it was - * sent on. We can change the packet tag to guarantee it will not get dropped */ - if (IS_EPING_PACKET_NO_DROP(eppingHdr)) { - htc_tag = AR6K_CONTROL_PKT_TAG; - } - - if (ac == HCI_TRANSPORT_STREAM_NUM) { - /* pass this to HCI */ -#ifndef EXPORT_HCI_BRIDGE_INTERFACE - if (A_SUCCESS(hci_test_send(ar,skb))) { - return 0; - } -#endif - /* set AC to discard this skb */ - ac = AC_NOT_MAPPED; - } else { - /* a quirk of linux, the payload of the frame is 32-bit aligned and thus the addition - * of the HTC header will mis-align the start of the HTC frame, so we add some - * padding which will be stripped off in the target */ - if (EPPING_ALIGNMENT_PAD > 0) { - A_NETBUF_PUSH(skb, EPPING_ALIGNMENT_PAD); - } - } - - } else { - /* not a ping packet, drop it */ - ac = AC_NOT_MAPPED; - } - } - - } while (FALSE); - - /* did we succeed ? */ - if ((ac == AC_NOT_MAPPED) && !checkAdHocPsMapping) { - /* cleanup and exit */ - A_NETBUF_FREE(skb); - AR6000_STAT_INC(arPriv, tx_dropped); - AR6000_STAT_INC(arPriv, tx_aborted_errors); - return 0; - } - - cookie = NULL; - - /* take the lock to protect driver data */ - AR6000_SPIN_LOCK(&ar->arLock, 0); - - do { - - if (checkAdHocPsMapping) { - eid = ar6000_ibss_map_epid(skb, dev, &mapNo); - }else { - eid = arAc2EndpointID (ar, ac); - } - /* validate that the endpoint is connected */ - if (eid == 0 || eid == ENDPOINT_UNUSED ) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" eid %d is NOT mapped!\n", eid)); - break; - } - /* allocate resource for this packet */ - cookie = ar6000_alloc_cookie(ar); - - if (cookie != NULL) { - /* update counts while the lock is held */ - ar->arTxPending[eid]++; - ar->arTotalTxDataPending++; - } - - } while (FALSE); - - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - - if (cookie != NULL) { - cookie->arc_bp[0] = (A_UINT32)skb; - cookie->arc_bp[1] = mapNo; - SET_HTC_PACKET_INFO_TX(&cookie->HtcPkt, - cookie, - A_NETBUF_DATA(skb), - A_NETBUF_LEN(skb), - eid, - htc_tag); - -#ifdef DEBUG - if (debugdriver >= 3) { - ar6000_dump_skb(skb); - } -#endif -#ifdef HTC_TEST_SEND_PKTS - DoHTCSendPktsTest(ar,mapNo,eid,skb); -#endif - /* HTC interface is asynchronous, if this fails, cleanup will happen in - * the ar6000_tx_complete callback */ - HTCSendPkt(ar->arHtcTarget, &cookie->HtcPkt); - } else { - /* no packet to send, cleanup */ - A_NETBUF_FREE(skb); - AR6000_STAT_INC(arPriv, tx_dropped); - AR6000_STAT_INC(arPriv, tx_aborted_errors); - } - - return 0; -} - -int -ar6000_acl_data_tx(struct sk_buff *skb, AR_SOFTC_DEV_T *arPriv) -{ - struct ar_cookie *cookie; - AR_SOFTC_T *ar = arPriv->arSoftc; - HTC_ENDPOINT_ID eid = ENDPOINT_UNUSED; - - cookie = NULL; - AR6000_SPIN_LOCK(&ar->arLock, 0); - - /* For now we send ACL on BE endpoint: We can also have a dedicated EP */ - eid = arAc2EndpointID (ar, 0); - /* allocate resource for this packet */ - cookie = ar6000_alloc_cookie(ar); - - if (cookie != NULL) { - /* update counts while the lock is held */ - ar->arTxPending[eid]++; - ar->arTotalTxDataPending++; - } - - - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - - if (cookie != NULL) { - cookie->arc_bp[0] = (A_UINT32)skb; - cookie->arc_bp[1] = 0; - SET_HTC_PACKET_INFO_TX(&cookie->HtcPkt, - cookie, - A_NETBUF_DATA(skb), - A_NETBUF_LEN(skb), - eid, - AR6K_DATA_PKT_TAG); - - /* HTC interface is asynchronous, if this fails, cleanup will happen in - * the ar6000_tx_complete callback */ - HTCSendPkt(ar->arHtcTarget, &cookie->HtcPkt); - } else { - /* no packet to send, cleanup */ - A_NETBUF_FREE(skb); - AR6000_STAT_INC(arPriv, tx_dropped); - AR6000_STAT_INC(arPriv, tx_aborted_errors); - } - return 0; -} - - -#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL -static void -tvsub(register struct timeval *out, register struct timeval *in) -{ - if((out->tv_usec -= in->tv_usec) < 0) { - out->tv_sec--; - out->tv_usec += 1000000; - } - out->tv_sec -= in->tv_sec; -} - -void -applyAPTCHeuristics(AR_SOFTC_DEV_T *arPriv) -{ - A_UINT32 duration; - A_UINT32 numbytes; - A_UINT32 throughput; - struct timeval ts; - A_STATUS status; - APTC_TRAFFIC_RECORD *aptcTR; - AR_SOFTC_T *ar = arPriv->arSoftc; - - aptcTR = arPriv->aptcTR; - - AR6000_SPIN_LOCK(&arPriv->arPrivLock, 0); - - if ((enableAPTCHeuristics) && (!aptcTR->timerScheduled)) { - do_gettimeofday(&ts); - tvsub(&ts, &aptcTR->samplingTS); - duration = ts.tv_sec * 1000 + ts.tv_usec / 1000; /* ms */ - numbytes = aptcTR->bytesTransmitted + aptcTR->bytesReceived; - - if (duration > APTC_TRAFFIC_SAMPLING_INTERVAL) { - /* Initialize the time stamp and byte count */ - aptcTR->bytesTransmitted = aptcTR->bytesReceived = 0; - do_gettimeofday(&aptcTR->samplingTS); - - /* Calculate and decide based on throughput thresholds */ - throughput = ((numbytes * 8) / duration); - if (throughput > APTC_UPPER_THROUGHPUT_THRESHOLD) { - /* Disable Sleep and schedule a timer */ - A_ASSERT(ar->arWmiReady == TRUE); - AR6000_SPIN_UNLOCK(&arPriv->ariPrivLock, 0); - status = wmi_powermode_cmd(arPriv->arWmi, MAX_PERF_POWER); - AR6000_SPIN_LOCK(&arPriv->arPrivLock, 0); - A_TIMEOUT_MS(&aptcTimer[arPriv->arDeviceIndex], APTC_TRAFFIC_SAMPLING_INTERVAL, 0); - aptcTR->timerScheduled = TRUE; - } - } - } - - AR6000_SPIN_UNLOCK(&arPriv->arLock, 0); -} -#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ - -static HTC_SEND_FULL_ACTION ar6000_tx_queue_full(void *Context, HTC_PACKET *pPacket) -{ - AR_SOFTC_T *ar = (AR_SOFTC_T *)Context; - HTC_SEND_FULL_ACTION action = HTC_SEND_FULL_KEEP; - A_BOOL stopNet = FALSE; - HTC_ENDPOINT_ID Endpoint = HTC_GET_ENDPOINT_FROM_PKT(pPacket); - A_UINT8 i; - AR_SOFTC_DEV_T *arPriv; - - do { - - if (bypasswmi) { - int accessClass; - - if (HTC_GET_TAG_FROM_PKT(pPacket) == AR6K_CONTROL_PKT_TAG) { - /* don't drop special control packets */ - break; - } - - accessClass = arEndpoint2Ac(ar,Endpoint); - /* for endpoint ping testing drop Best Effort and Background */ - if ((accessClass == WMM_AC_BE) || (accessClass == WMM_AC_BK)) { - action = HTC_SEND_FULL_DROP; - stopNet = FALSE; - } else { - /* keep but stop the netqueues */ - stopNet = TRUE; - } - break; - } - - if (Endpoint == ar->arControlEp) { - /* under normal WMI if this is getting full, then something is running rampant - * the host should not be exhausting the WMI queue with too many commands - * the only exception to this is during testing using endpointping */ - AR6000_SPIN_LOCK(&ar->arLock, 0); - /* set flag to handle subsequent messages */ - ar->arWMIControlEpFull = TRUE; - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("WMI Control Endpoint is FULL!!! \n")); - /* no need to stop the network */ - stopNet = FALSE; - break; - } - - /* if we get here, we are dealing with data endpoints getting full */ - - if (HTC_GET_TAG_FROM_PKT(pPacket) == AR6K_CONTROL_PKT_TAG) { - /* don't drop control packets issued on ANY data endpoint */ - break; - } - - /* the last MAX_HI_COOKIE_NUM "batch" of cookies are reserved for the highest - * active stream */ - if (ar->arAcStreamPriMap[arEndpoint2Ac(ar,Endpoint)] < ar->arHiAcStreamActivePri && - ar->arCookieCount <= MAX_HI_COOKIE_NUM) { - /* this stream's priority is less than the highest active priority, we - * give preference to the highest priority stream by directing - * HTC to drop the packet that overflowed */ - action = HTC_SEND_FULL_DROP; - /* since we are dropping packets, no need to stop the network */ - stopNet = FALSE; - break; - } - - } while (FALSE); - - if (stopNet) { - for(i = 0; i < num_device; i++) - { - arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(ar6000_devices[i]); - AR6000_SPIN_LOCK(&arPriv->arPrivLock, 0); - arPriv->arNetQueueStopped = TRUE; - AR6000_SPIN_UNLOCK(&arPriv->arPrivLock, 0); - /* one of the data endpoints queues is getting full..need to stop network stack - * the queue will resume in ar6000_tx_complete() */ - netif_stop_queue(ar6000_devices[i]); - } - } - else - { - /* in adhoc mode, we cannot differentiate traffic priorities so there is no need to - * continue, however we should stop the network */ - for(i = 0; i < num_device; i++) - { - arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(ar6000_devices[i]); - if(arPriv->arNetworkType == ADHOC_NETWORK) { - AR6000_SPIN_LOCK(&arPriv->arPrivLock, 0); - arPriv->arNetQueueStopped = TRUE; - AR6000_SPIN_UNLOCK(&arPriv->arPrivLock, 0); - /* one of the data endpoints queues is getting full..need to stop network stack - * the queue will resume in ar6000_tx_complete() */ - netif_stop_queue(ar6000_devices[i]); - } - } - } - return action; -} - - -static void -ar6000_tx_complete(void *Context, HTC_PACKET_QUEUE *pPacketQueue) -{ - AR_SOFTC_T *ar = (AR_SOFTC_T *)Context; - A_UINT32 mapNo = 0; - A_STATUS status; - struct ar_cookie * ar_cookie; - HTC_ENDPOINT_ID eid; - A_BOOL wakeEvent = FALSE; - struct sk_buff_head skb_queue; - HTC_PACKET *pPacket; - struct sk_buff *pktSkb; - A_BOOL flushing[NUM_DEV]; - A_INT8 devid = -1; - AR_SOFTC_DEV_T *arPriv = NULL; - AR_SOFTC_STA_T *arSta; - A_UINT8 i; - - skb_queue_head_init(&skb_queue); - - /* lock the driver as we update internal state */ - AR6000_SPIN_LOCK(&ar->arLock, 0); - - /* reap completed packets */ - while (!HTC_QUEUE_EMPTY(pPacketQueue)) { - - pPacket = HTC_PACKET_DEQUEUE(pPacketQueue); - - ar_cookie = (struct ar_cookie *)pPacket->pPktContext; - A_ASSERT(ar_cookie); - - status = pPacket->Status; - pktSkb = (struct sk_buff *)ar_cookie->arc_bp[0]; - eid = pPacket->Endpoint; - mapNo = ar_cookie->arc_bp[1]; - - A_ASSERT(pktSkb); - A_ASSERT(pPacket->pBuffer == A_NETBUF_DATA(pktSkb)); - - /* add this to the list, use faster non-lock API */ - __skb_queue_tail(&skb_queue,pktSkb); - - if (A_SUCCESS(status)) { - A_ASSERT(pPacket->ActualLength == A_NETBUF_LEN(pktSkb)); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_TX,("ar6000_tx_complete skb=0x%x data=0x%x len=0x%x eid=%d ", - (A_UINT32)pktSkb, (A_UINT32)pPacket->pBuffer, - pPacket->ActualLength, - eid)); - - ar->arTxPending[eid]--; - - if(!bypasswmi) - { - - if (eid != ar->arControlEp) { - WMI_DATA_HDR *dhdr = (WMI_DATA_HDR *)A_NETBUF_DATA(pktSkb); - ar->arTotalTxDataPending--; - devid = WMI_DATA_HDR_GET_DEVID(dhdr); - arPriv = ar->arDev[devid]; - } - - if (eid == ar->arControlEp) - { - WMI_CMD_HDR *cmhdr = (WMI_CMD_HDR*)A_NETBUF_DATA(pktSkb); - if (ar->arWMIControlEpFull) { - /* since this packet completed, the WMI EP is no longer full */ - ar->arWMIControlEpFull = FALSE; -#ifdef ANDROID_ENV - android_epfull_cnt = 0; -#endif - } - - if (ar->arTxPending[eid] == 0) { - wakeEvent = TRUE; - } - devid = WMI_CMD_HDR_GET_DEVID(cmhdr); - arPriv = ar->arDev[devid]; - } - } - else - { - devid = 0; - arPriv = ar->arDev[devid]; - } - - - if (A_FAILED(status)) { - if (status == A_ECANCELED) { - /* a packet was flushed */ - flushing[devid] = TRUE; - } - AR6000_STAT_INC(arPriv, tx_errors); - if (status != A_NO_RESOURCE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() -TX ERROR, status: 0x%x\n", __func__, - status)); - } - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_TX,("OK\n")); - flushing[devid] = FALSE; - AR6000_STAT_INC(arPriv, tx_packets); - arPriv->arNetStats.tx_bytes += A_NETBUF_LEN(pktSkb); -#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL - arPriv->aptcTR.bytesTransmitted += a_netbuf_to_len(pktSkb); - applyAPTCHeuristics(arPriv); -#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ - } - - // TODO this needs to be looked at - if (arPriv->arNetworkType == ADHOC_NETWORK) - { - arSta = &arPriv->arSta; - if((arSta->arIbssPsEnable && (eid != ar->arControlEp) && mapNo)) - { - mapNo --; - arSta->arNodeMap[mapNo].txPending --; - - if (!arSta->arNodeMap[mapNo].txPending && (mapNo == (arSta->arNodeNum - 1))) { - A_UINT32 i; - for (i = arSta->arNodeNum; i > 0; i --) { - if (!arSta->arNodeMap[i - 1].txPending) { - A_MEMZERO(&arSta->arNodeMap[i - 1], sizeof(struct ar_node_mapping)); - arSta->arNodeNum --; - } else { - break; - } - } - } - } - } - - ar6000_free_cookie(ar, ar_cookie); - - if (arPriv->arNetQueueStopped) { - arPriv->arNetQueueStopped = FALSE; - } - } - - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - - /* lock is released, we can freely call other kernel APIs */ - - /* free all skbs in our local list */ - while (!skb_queue_empty(&skb_queue)) { - /* use non-lock version */ - pktSkb = __skb_dequeue(&skb_queue); - A_NETBUF_FREE(pktSkb); - } - for(i = 0; i < num_device; i++) { - arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(ar6000_devices[i]); - if (((arPriv->arNetworkType == INFRA_NETWORK ) && (arPriv->arConnected == TRUE)) - || (bypasswmi)) { - if (!flushing[i]) { - /* don't wake the queue if we are flushing, other wise it will just - * keep queueing packets, which will keep failing */ - - netif_wake_queue(arPriv->arNetDev); - } - } - - if (wakeEvent) { - wake_up(&arPriv->arEvent); - } - } - -} - -conn_t * -ieee80211_find_conn(AR_SOFTC_DEV_T *arPriv, A_UINT8 *node_addr) -{ - conn_t *conn = NULL; - A_UINT8 i; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (IS_MAC_NULL(node_addr)) { - return NULL; - } - - for (i = 0; i < NUM_CONN; i++) { - if (IEEE80211_ADDR_EQ(node_addr, ar->connTbl[i].mac)) { - conn = &ar->connTbl[i]; - break; - } - } - - return conn; -} - -conn_t *ieee80211_find_conn_for_aid(AR_SOFTC_DEV_T *arPriv, A_UINT8 aid) -{ - conn_t *conn = NULL; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (arPriv->arNetworkType != AP_NETWORK) { - conn = NULL; - } else if( (aid > 0) && (aid < NUM_CONN) ) { - if (ar->connTbl[aid-1].aid == aid) { - conn = &ar->connTbl[aid-1]; - } - } - return conn; -} - -void *get_aggr_ctx(AR_SOFTC_DEV_T *arPriv, conn_t *conn) -{ - if (arPriv->arNetworkType != AP_NETWORK) { - return (arPriv->conn_aggr); - } else { - return (conn->conn_aggr); - } -} - -/* - * Receive event handler. This is called by HTC when a packet is received - */ -int pktcount; -static void -ar6000_rx(void *Context, HTC_PACKET *pPacket) -{ - AR_SOFTC_T *ar = (AR_SOFTC_T *)Context; - struct sk_buff *skb = (struct sk_buff *)pPacket->pPktContext; - int minHdrLen; - A_UINT8 containsDot11Hdr = 0; - A_STATUS status = pPacket->Status; - HTC_ENDPOINT_ID ept = pPacket->Endpoint; - conn_t *conn = NULL; - AR_SOFTC_DEV_T *arPriv = NULL; - A_UINT8 devid ; - ATH_MAC_HDR *multicastcheck_datap = NULL; - - A_ASSERT((status != A_OK) || - (pPacket->pBuffer == (A_NETBUF_DATA(skb) + HTC_HEADER_LEN))); - - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_RX,("ar6000_rx ar=0x%x eid=%d, skb=0x%x, data=0x%x, len=0x%x status:%d", - (A_UINT32)ar, ept, (A_UINT32)skb, (A_UINT32)pPacket->pBuffer, - pPacket->ActualLength, status)); - - if (status != A_OK) { - if (status != A_ECANCELED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("RX ERR (%d) \n",status)); - } - A_NETBUF_FREE(skb); - goto rx_done; - } - - /* take lock to protect buffer counts - * and adaptive power throughput state */ - AR6000_SPIN_LOCK(&ar->arLock, 0); - A_NETBUF_PUT(skb, pPacket->ActualLength + HTC_HEADER_LEN); - A_NETBUF_PULL(skb, HTC_HEADER_LEN); - - if(!bypasswmi) - { - if(ept == ar->arControlEp) { - WMI_CMD_HDR *cmhdr = (WMI_CMD_HDR*)A_NETBUF_DATA(skb); - devid = WMI_CMD_HDR_GET_DEVID(cmhdr); - arPriv = ar->arDev[devid]; - } - else { - WMI_DATA_HDR *dhdr = (WMI_DATA_HDR *)A_NETBUF_DATA(skb); - devid = WMI_DATA_HDR_GET_DEVID(dhdr); - arPriv = ar->arDev[devid]; - } - } - else - { - devid = 0; - arPriv = ar->arDev[devid]; - } - - if (A_SUCCESS(status)) { - AR6000_STAT_INC(arPriv, rx_packets); - arPriv->arNetStats.rx_bytes += pPacket->ActualLength; -#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL - arPriv->aptcTR.bytesReceived += pPacket->ActualLength; - applyAPTCHeuristics(arPriv); -#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ - - -#ifdef DEBUG - if (debugdriver >= 2) { - ar6000_dump_skb(skb); - } -#endif /* DEBUG */ - } - - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - - skb->dev = arPriv->arNetDev; - if (status != A_OK) { - AR6000_STAT_INC(arPriv, rx_errors); - A_NETBUF_FREE(skb); - } else if (arPriv->arWmiEnabled == TRUE) { - if (ept == ar->arControlEp) { - /* - * this is a wmi control msg - */ -#ifdef CONFIG_PM - ar6000_check_wow_status(ar, skb, TRUE); -#endif /* CONFIG_PM */ - wmi_control_rx(arPriv->arWmi, skb); - } else { - WMI_DATA_HDR *dhdr = (WMI_DATA_HDR *)A_NETBUF_DATA(skb); - A_UINT8 is_amsdu, tid, is_acl_data_frame; - is_acl_data_frame = WMI_DATA_HDR_GET_DATA_TYPE(dhdr) == WMI_DATA_HDR_DATA_TYPE_ACL; -#ifdef CONFIG_PM - ar6000_check_wow_status(ar, NULL, FALSE); -#endif /* CONFIG_PM */ - /* - * this is a wmi data packet - */ - // NWF - - if (processDot11Hdr) { - minHdrLen = sizeof(WMI_DATA_HDR) + sizeof(struct ieee80211_frame) + sizeof(ATH_LLC_SNAP_HDR); - } else { - minHdrLen = sizeof (WMI_DATA_HDR) + sizeof(ATH_MAC_HDR) + - sizeof(ATH_LLC_SNAP_HDR); - } - - /* In the case of AP mode we may receive NULL data frames - * that do not have LLC hdr. They are 16 bytes in size. - * Allow these frames in the AP mode. - * ACL data frames don't follow ethernet frame bounds for - * min length - */ - if (arPriv->arNetworkType != AP_NETWORK && !is_acl_data_frame && - ((pPacket->ActualLength < minHdrLen) || - (pPacket->ActualLength > AR6000_MAX_RX_MESSAGE_SIZE))) - { - /* - * packet is too short or too long - */ - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("TOO SHORT or TOO LONG\n")); - AR6000_STAT_INC(arPriv, rx_errors); - AR6000_STAT_INC(arPriv, rx_length_errors); - A_NETBUF_FREE(skb); - } else { - A_UINT16 seq_no; - A_UINT8 meta_type; - -#if 0 - /* Access RSSI values here */ - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("RSSI %d\n", - ((WMI_DATA_HDR *) A_NETBUF_DATA(skb))->rssi)); -#endif - /* Get the Power save state of the STA */ - if (arPriv->arNetworkType == AP_NETWORK) { - A_UINT8 psState=0,prevPsState; - ATH_MAC_HDR *datap=NULL; - A_UINT16 offset; - A_UINT8 triggerState; - - meta_type = WMI_DATA_HDR_GET_META(dhdr); - - psState = (((WMI_DATA_HDR *)A_NETBUF_DATA(skb))->info - >> WMI_DATA_HDR_PS_SHIFT) & WMI_DATA_HDR_PS_MASK; - triggerState = WMI_DATA_HDR_IS_TRIGGER(dhdr); - - - offset = sizeof(WMI_DATA_HDR); - - switch (meta_type) { - case 0: - break; - case WMI_META_VERSION_1: - offset += sizeof(WMI_RX_META_V1); - break; -#ifdef CONFIG_CHECKSUM_OFFLOAD - case WMI_META_VERSION_2: - offset += sizeof(WMI_RX_META_V2); - break; -#endif - default: - break; - } -#ifdef DIX_RX_OFFLOAD -#define SKIP_LLC_LEN 8 - /*DIX to ETHERNET hdr conversion is offloaded to firmware */ - /*Empty LLC header is moved to get ethernet header*/ - A_UINT32 datalen = (A_UINT32)A_NETBUF_LEN(skb)-offset; - - is_amsdu = WMI_DATA_HDR_IS_AMSDU(dhdr); - containsDot11Hdr = WMI_DATA_HDR_GET_DOT11(dhdr); - if(!containsDot11Hdr && !is_amsdu && !is_acl_data_frame - && datalen >= (sizeof(ATH_MAC_HDR) + sizeof(ATH_LLC_SNAP_HDR))) { - datap = (ATH_MAC_HDR *)((A_INT8*)A_NETBUF_DATA(skb)+offset+SKIP_LLC_LEN); - } - else { - datap = (ATH_MAC_HDR *)((A_INT8*)A_NETBUF_DATA(skb)+offset); - } - -#else - datap = (ATH_MAC_HDR *)(A_NETBUF_DATA(skb)+offset); -#endif - conn = ieee80211_find_conn(arPriv, datap->srcMac); - - if (conn) { - /* if there is a change in PS state of the STA, - * take appropriate steps. - * 1. If Sleep-->Awake, flush the psq for the STA - * Clear the PVB for the STA. - * 2. If Awake-->Sleep, Starting queueing frames - * the STA. - */ - prevPsState = STA_IS_PWR_SLEEP(conn); - if (psState) { - STA_SET_PWR_SLEEP(conn); - } else { - STA_CLR_PWR_SLEEP(conn); - } - - if (STA_IS_PWR_SLEEP(conn)) { - /* Accept trigger only when the station is in sleep */ - if (triggerState) { - ar6000_uapsd_trigger_frame_rx(arPriv, conn); - } - } - - if (prevPsState ^ STA_IS_PWR_SLEEP(conn)) { - A_BOOL isApsdqEmptyAtStart; - - if (!STA_IS_PWR_SLEEP(conn)) { - - A_MUTEX_LOCK(&conn->psqLock); - - while (!A_NETBUF_QUEUE_EMPTY(&conn->psq)) { - struct sk_buff *skb=NULL; - - skb = A_NETBUF_DEQUEUE(&conn->psq); - A_MUTEX_UNLOCK(&conn->psqLock); - ar6000_data_tx(skb,arPriv->arNetDev); - A_MUTEX_LOCK(&conn->psqLock); - } - - isApsdqEmptyAtStart = A_NETBUF_QUEUE_EMPTY(&conn->apsdq); - - while (!A_NETBUF_QUEUE_EMPTY(&conn->apsdq)) { - struct sk_buff *skb=NULL; - - skb = A_NETBUF_DEQUEUE(&conn->apsdq); - A_MUTEX_UNLOCK(&conn->psqLock); - ar6000_data_tx(skb,arPriv->arNetDev); - A_MUTEX_LOCK(&conn->psqLock); - } - - A_MUTEX_UNLOCK(&conn->psqLock); - - /* Clear the APSD buffered bitmap for this STA */ - if (!isApsdqEmptyAtStart) { - wmi_set_apsd_buffered_traffic_cmd(arPriv->arWmi, conn->aid, 0, 0); - } - - /* Clear the PVB for this STA */ - wmi_set_pvb_cmd(arPriv->arWmi, conn->aid, 0); - } - } - - } else { - /* This frame is from a STA that is not associated*/ - A_NETBUF_FREE(skb); - goto rx_done; - } - - /* Drop NULL data frames here */ - if((pPacket->ActualLength < minHdrLen) || - (pPacket->ActualLength > AR6000_MAX_RX_MESSAGE_SIZE)) { - A_NETBUF_FREE(skb); - goto rx_done; - } - } - - is_amsdu = WMI_DATA_HDR_IS_AMSDU(dhdr); - tid = WMI_DATA_HDR_GET_UP(dhdr); - seq_no = WMI_DATA_HDR_GET_SEQNO(dhdr); - meta_type = WMI_DATA_HDR_GET_META(dhdr); - containsDot11Hdr = WMI_DATA_HDR_GET_DOT11(dhdr); - - wmi_data_hdr_remove(arPriv->arWmi, skb); - - switch (meta_type) { - case WMI_META_VERSION_1: - { - WMI_RX_META_V1 *pMeta = (WMI_RX_META_V1 *)A_NETBUF_DATA(skb); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("META %d %d %d %d %x\n", pMeta->status, pMeta->rix, pMeta->rssi, pMeta->channel, pMeta->flags)); - A_NETBUF_PULL((void*)skb, sizeof(WMI_RX_META_V1)); - break; - } -#ifdef CONFIG_CHECKSUM_OFFLOAD - case WMI_META_VERSION_2: - { - WMI_RX_META_V2 *pMeta = (WMI_RX_META_V2 *)A_NETBUF_DATA(skb); - if(pMeta->csumFlags & 0x1){ - skb->ip_summed=CHECKSUM_COMPLETE; - skb->csum=(pMeta->csum); - } - A_NETBUF_PULL((void*)skb, sizeof(WMI_RX_META_V2)); - break; - } -#endif - default: - break; - } - - A_ASSERT(status == A_OK); - - /* NWF: print the 802.11 hdr bytes */ - if(containsDot11Hdr) { - status = wmi_dot11_hdr_remove(arPriv->arWmi,skb); - } else if(!is_amsdu && !is_acl_data_frame) { -#ifdef DIX_RX_OFFLOAD - /*Skip the conversion its offloaded to firmware*/ - if(A_NETBUF_PULL(skb, sizeof(ATH_LLC_SNAP_HDR)) != A_OK) { - status = A_NO_MEMORY; - } - else { - status = A_OK; - } -#else - status = wmi_dot3_2_dix(skb); -#endif - } - - if (status != A_OK) { - /* Drop frames that could not be processed (lack of memory, etc.) */ - A_NETBUF_FREE(skb); - goto rx_done; - } - - if (is_acl_data_frame) { - A_NETBUF_PUSH(skb, sizeof(int)); - *((short *)A_NETBUF_DATA(skb)) = WMI_ACL_DATA_EVENTID; - /* send the data packet to PAL driver */ - if(ar6k_pal_config_g.fpar6k_pal_recv_pkt) { - if((*ar6k_pal_config_g.fpar6k_pal_recv_pkt)(arPriv->hcipal_info, skb) == TRUE) - goto rx_done; - } - } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - /* - * extra push and memcpy, for eth_type_trans() of 2.4 kernel - * will pull out hard_header_len bytes of the skb. - */ - A_NETBUF_PUSH(skb, sizeof(WMI_DATA_HDR) + sizeof(ATH_LLC_SNAP_HDR) + HTC_HEADER_LEN); - A_MEMCPY(A_NETBUF_DATA(skb), A_NETBUF_DATA(skb) + sizeof(WMI_DATA_HDR) + - sizeof(ATH_LLC_SNAP_HDR) + HTC_HEADER_LEN, sizeof(ATH_MAC_HDR)); -#endif - -#ifdef ATH_AR6K_11N_SUPPORT - multicastcheck_datap = (ATH_MAC_HDR *)A_NETBUF_DATA(skb); - - if ((!(IEEE80211_IS_MULTICAST(multicastcheck_datap->dstMac))) && (arPriv->arNetworkType != AP_NETWORK)){ - aggr_process_recv_frm(get_aggr_ctx(arPriv, conn), tid, seq_no, is_amsdu, (void **)&skb); - } -#endif - ar6000_deliver_frames_to_nw_stack((void *) arPriv->arNetDev, (void *)skb); - } - } - } else { - if (EPPING_ALIGNMENT_PAD > 0) { - A_NETBUF_PULL(skb, EPPING_ALIGNMENT_PAD); - } - ar6000_deliver_frames_to_nw_stack((void *)arPriv->arNetDev, (void *)skb); - } - -rx_done: - - return; -} - -static void -ar6000_deliver_frames_to_nw_stack(void *dev, void *osbuf) -{ - struct sk_buff *skb = (struct sk_buff *)osbuf; - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - if(skb) { - skb->dev = dev; - if ((skb->dev->flags & IFF_UP) == IFF_UP) { - - if (arPriv->arNetworkType == AP_NETWORK) { - - struct sk_buff *skb1 = NULL; - ATH_MAC_HDR *datap; - struct net_device *net_dev = arPriv->arNetDev; - -#ifdef CONFIG_PM - ar6000_check_wow_status(ar, skb, FALSE); -#endif /* CONFIG_PM */ - - - datap = (ATH_MAC_HDR *)A_NETBUF_DATA(skb); - - if (IEEE80211_IS_MULTICAST(datap->dstMac)) { - - /* Bcast/Mcast frames should be sent to the OS - * stack as well as on the air. - */ - skb1 = skb_copy(skb,GFP_ATOMIC); - } else { - - /* Search for a connected STA with dstMac as - * the Mac address. If found send the frame to - * it on the air else send the frame up the stack - */ - - AR_SOFTC_DEV_T *to_arPriv = NULL; - A_UINT8 is_forward = 0; - conn_t *to_conn = NULL; - - to_conn = ieee80211_find_conn(arPriv, datap->dstMac); - - if (to_conn) { - to_arPriv = (AR_SOFTC_DEV_T *)to_conn->arPriv; - /* Forward data within BSS */ - if(arPriv == to_arPriv) { - is_forward = arPriv->arAp.intra_bss; - } else { - /* Forward data within mBSS */ - is_forward = ar->inter_bss; - net_dev = to_arPriv->arNetDev; - } - if(is_forward && net_dev) { - skb1 = skb; - skb = NULL; - } else { - A_NETBUF_FREE(skb); - skb = NULL; - return; - } - } - - } - - if (skb1) { - ar6000_data_tx(skb1, net_dev); - if (!skb) - return; - } - } - -#ifdef CONFIG_PM - ar6000_check_wow_status(ar, skb, FALSE); -#endif /* CONFIG_PM */ - skb->protocol = eth_type_trans(skb, skb->dev); - /* - * If this routine is called on a ISR (Hard IRQ) or DSR (Soft IRQ) - * or tasklet use the netif_rx to deliver the packet to the stack - * netif_rx will queue the packet onto the receive queue and mark - * the softirq thread has a pending action to complete. Kernel will - * schedule the softIrq kernel thread after processing the DSR. - * - * If this routine is called on a process context, use netif_rx_ni - * which will schedle the softIrq kernel thread after queuing the packet. - */ - if (in_interrupt()) { - A_NETIF_RX(skb); - } else { - A_NETIF_RX_NI(skb); - } - } else { - A_NETBUF_FREE(skb); - } - } -} - -#if 0 -static void -ar6000_deliver_frames_to_bt_stack(void *dev, void *osbuf) -{ - struct sk_buff *skb = (struct sk_buff *)osbuf; - - if(skb) { - skb->dev = dev; - if ((skb->dev->flags & IFF_UP) == IFF_UP) { - skb->protocol = htons(ETH_P_CONTROL); - netif_rx(skb); - } else { - A_NETBUF_FREE(skb); - } - } -} -#endif - -static void -ar6000_rx_refill(void *Context, HTC_ENDPOINT_ID Endpoint) -{ - AR_SOFTC_T *ar = (AR_SOFTC_T *)Context; - void *osBuf; - int RxBuffers; - int buffersToRefill; - HTC_PACKET *pPacket; - HTC_PACKET_QUEUE queue; - - buffersToRefill = (int)AR6000_MAX_RX_BUFFERS - - HTCGetNumRecvBuffers(ar->arHtcTarget, Endpoint); - - if (buffersToRefill <= 0) { - /* fast return, nothing to fill */ - return; - } - - INIT_HTC_PACKET_QUEUE(&queue); - - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_RX,("ar6000_rx_refill: providing htc with %d buffers at eid=%d\n", - buffersToRefill, Endpoint)); - - for (RxBuffers = 0; RxBuffers < buffersToRefill; RxBuffers++) { - osBuf = A_NETBUF_ALLOC(AR6000_BUFFER_SIZE); - if (NULL == osBuf) { - break; - } - /* the HTC packet wrapper is at the head of the reserved area - * in the skb */ - pPacket = (HTC_PACKET *)(A_NETBUF_HEAD(osBuf)); - /* set re-fill info */ - SET_HTC_PACKET_INFO_RX_REFILL(pPacket,osBuf,A_NETBUF_DATA(osBuf),AR6000_BUFFER_SIZE,Endpoint); - /* add to queue */ - HTC_PACKET_ENQUEUE(&queue,pPacket); - } - - if (!HTC_QUEUE_EMPTY(&queue)) { - /* add packets */ - HTCAddReceivePktMultiple(ar->arHtcTarget, &queue); - } - -} - - /* clean up our amsdu buffer list */ -static void ar6000_cleanup_amsdu_rxbufs(AR_SOFTC_T *ar) -{ - HTC_PACKET *pPacket; - void *osBuf; - - /* empty AMSDU buffer queue and free OS bufs */ - while (TRUE) { - - AR6000_SPIN_LOCK(&ar->arLock, 0); - pPacket = HTC_PACKET_DEQUEUE(&ar->amsdu_rx_buffer_queue); - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - - if (NULL == pPacket) { - break; - } - - osBuf = pPacket->pPktContext; - if (NULL == osBuf) { - A_ASSERT(FALSE); - break; - } - - A_NETBUF_FREE(osBuf); - } - -} - - - /* refill the amsdu buffer list */ -static void ar6000_refill_amsdu_rxbufs(AR_SOFTC_T *ar, int Count) -{ - HTC_PACKET *pPacket; - void *osBuf; - - while (Count > 0) { - osBuf = A_NETBUF_ALLOC(AR6000_AMSDU_BUFFER_SIZE); - if (NULL == osBuf) { - break; - } - /* the HTC packet wrapper is at the head of the reserved area - * in the skb */ - pPacket = (HTC_PACKET *)(A_NETBUF_HEAD(osBuf)); - /* set re-fill info */ - SET_HTC_PACKET_INFO_RX_REFILL(pPacket,osBuf,A_NETBUF_DATA(osBuf),AR6000_AMSDU_BUFFER_SIZE,0); - - AR6000_SPIN_LOCK(&ar->arLock, 0); - /* put it in the list */ - HTC_PACKET_ENQUEUE(&ar->amsdu_rx_buffer_queue,pPacket); - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - Count--; - } - -} - - /* callback to allocate a large receive buffer for a pending packet. This function is called when - * an HTC packet arrives whose length exceeds a threshold value - * - * We use a pre-allocated list of buffers of maximum AMSDU size (4K). Under linux it is more optimal to - * keep the allocation size the same to optimize cached-slab allocations. - * - * */ -static HTC_PACKET *ar6000_alloc_amsdu_rxbuf(void *Context, HTC_ENDPOINT_ID Endpoint, int Length) -{ - HTC_PACKET *pPacket = NULL; - AR_SOFTC_T *ar = (AR_SOFTC_T *)Context; - int refillCount = 0; - - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_RX,("ar6000_alloc_amsdu_rxbuf: eid=%d, Length:%d\n",Endpoint,Length)); - - do { - - if (Length <= AR6000_BUFFER_SIZE) { - /* shouldn't be getting called on normal sized packets */ - A_ASSERT(FALSE); - break; - } - - if (Length > AR6000_AMSDU_BUFFER_SIZE) { - A_ASSERT(FALSE); - break; - } - - AR6000_SPIN_LOCK(&ar->arLock, 0); - /* allocate a packet from the list */ - pPacket = HTC_PACKET_DEQUEUE(&ar->amsdu_rx_buffer_queue); - /* see if we need to refill again */ - refillCount = AR6000_MAX_AMSDU_RX_BUFFERS - HTC_PACKET_QUEUE_DEPTH(&ar->amsdu_rx_buffer_queue); - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - - if (NULL == pPacket) { - break; - } - /* set actual endpoint ID */ - pPacket->Endpoint = Endpoint; - - } while (FALSE); - - if (refillCount >= AR6000_AMSDU_REFILL_THRESHOLD) { - ar6000_refill_amsdu_rxbufs(ar,refillCount); - } - - return pPacket; -} - -static void -ar6000_set_multicast_list(struct net_device *dev) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35) - int mc_count = dev->mc_count; - struct dev_mc_list *mc; - int j; -#else - int mc_count = netdev_mc_count(dev); - struct netdev_hw_addr *ha; -#endif - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - int i; - A_BOOL enableAll, disableAll; - enum { - IGNORE = 0, - MATCH = 1, - ADD = 2, - DELETE = 3 - } action[MAC_MAX_FILTERS_PER_LIST]; - A_BOOL mcValid; - A_UINT8 *mac; - A_UINT8 *filter; - A_BOOL filterValid; - - if (ar->arWmiReady == FALSE || ar->arWlanState == WLAN_DISABLED) - return; - - enableAll = FALSE; - disableAll = FALSE; - - /* - * Enable receive all multicast, if - * 1. promiscous mode, - * 2. Allow all multicast - * 3. H/W supported filters is less than application requested filter - */ - if ((dev->flags & IFF_PROMISC) || - (dev->flags & IFF_ALLMULTI) || - (mc_count > MAC_MAX_FILTERS_PER_LIST)) - { - enableAll = TRUE; - } else { - /* Disable all multicast if interface has multicast disable or list is empty */ - if ((!(dev->flags & IFF_MULTICAST)) || (!mc_count)) { - disableAll = TRUE; - } - } - - /* - * Firmware behaviour - * enableAll - set filter to enable and delete valid filters - * disableAll - set filter to disable and delete valid filers - * filter - set valid filters - */ - - /* - * Pass 1: Mark all the valid filters to delete - */ - for (i=0; imcast_filters[i]; - filterValid = (filter[1] || filter[2]); - if (filterValid) { - action[i] = DELETE; - } else { - action[i] = IGNORE; - } - } - - if ((!enableAll) && (!disableAll)) { - /* - * Pass 2: Mark all filters which match the previous ones - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) - for (j = 0, mc = dev->mc_list; mc && (j < dev->mc_count); - j++, mc = mc->next) { - mac = mc->dmi_addr; -#else - netdev_for_each_mc_addr(ha, dev) { - mac = ha->addr; -#endif - - mcValid = (mac[2] || mac[3] || mac[4] || mac[5]); - if (mcValid) { - for (i=0; imcast_filters[i]; - if ((A_MEMCMP(filter, &mac[0], AR_MCAST_FILTER_MAC_ADDR_SIZE)) == 0) { - action[i] = MATCH; - break; - } - } - } - } - - /* - * Delete old entries and free-up space for new additions - */ - for (i = 0; i < MAC_MAX_FILTERS_PER_LIST; i++) { - filter = arPriv->mcast_filters[i]; - if (action[i] == DELETE) { - A_PRINTF ("Delete Filter %d = %02x:%02x:%02x:%02x:%02x:%02x\n", - i, filter[0], filter[1], filter[2], filter[3], filter[4], filter[5]); - wmi_del_mcast_filter_cmd(arPriv->arWmi, filter); - A_MEMZERO(filter, AR_MCAST_FILTER_MAC_ADDR_SIZE); - /* Make this available for further additions */ - action[i] = IGNORE; - } - } - - /* - * Pass 3: Add new filters to empty slots - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) - for (j = 0, mc = dev->mc_list; mc && (j < dev->mc_count); - j++, mc = mc->next) { -#else - netdev_for_each_mc_addr(ha, dev) { - -#endif - A_BOOL match; - A_INT32 free; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) - mac = mc->dmi_addr; -#else - mac = ha->addr; -#endif - mcValid = (mac[2] || mac[3] || mac[4] || mac[5]); - if (mcValid) { - match = FALSE; - free = -1; - for (i=0; imcast_filters[i]; - if ((A_MEMCMP(filter, &mac[0], AR_MCAST_FILTER_MAC_ADDR_SIZE)) == 0) { - match = TRUE; - break; - } else if (action[i] != MATCH && action[i] != ADD) { - if (free == -1) { - free = i; // Mark the first free index - } - } - } - if ((!match) && (free != -1)) { - filter = arPriv->mcast_filters[free]; - A_MEMCPY(filter, &mac[0], AR_MCAST_FILTER_MAC_ADDR_SIZE); - action[free] = ADD; - } - } - } - } - - - for (i=0; imcast_filters[i]; - if (action[i] == DELETE) { - A_PRINTF ("Delete Filter %d = %02x:%02x:%02x:%02x:%02x:%02x\n", - i, filter[0], filter[1], filter[2], filter[3], filter[4], filter[5]); - wmi_del_mcast_filter_cmd(arPriv->arWmi, filter); - A_MEMZERO(filter, AR_MCAST_FILTER_MAC_ADDR_SIZE); - } else if (action[i] == ADD) { - A_PRINTF ("Add Filter %d = %02x:%02x:%02x:%02x:%02x:%02x\n", - i, filter[0], filter[1], filter[2], filter[3],filter[4],filter[5]); - wmi_set_mcast_filter_cmd(arPriv->arWmi, filter); - } else if (action[i] == MATCH) { - A_PRINTF ("Keep Filter %d = %02x:%02x:%02x:%02x:%02x:%02x\n", - i, filter[0], filter[1], filter[2], filter[3],filter[4],filter[5]); - } - } - - if (enableAll) { - /* target allow all multicast packets if fitler enable and fitler list is zero */ - wmi_mcast_filter_cmd(arPriv->arWmi, TRUE); - } else if (disableAll) { - /* target drop multicast packets if fitler disable and fitler list is zero */ - wmi_mcast_filter_cmd(arPriv->arWmi, FALSE); - } -} - -static struct net_device_stats * -ar6000_get_stats(struct net_device *dev) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - return &arPriv->arNetStats; -} - -static struct iw_statistics * -ar6000_get_iwstats(struct net_device * dev) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - TARGET_STATS *pStats = &arPriv->arTargetStats; - struct iw_statistics * pIwStats = &arPriv->arIwStats; - int rtnllocked; - -#ifdef CONFIG_HOST_TCMD_SUPPORT - if (ar->bIsDestroyProgress || ar->arWmiReady == FALSE || ar->arWlanState == WLAN_DISABLED || testmode) -#else - if (ar->bIsDestroyProgress || ar->arWmiReady == FALSE || ar->arWlanState == WLAN_DISABLED) -#endif - { - pIwStats->status = 0; - pIwStats->qual.qual = 0; - pIwStats->qual.level =0; - pIwStats->qual.noise = 0; - pIwStats->discard.code =0; - pIwStats->discard.retries=0; - pIwStats->miss.beacon =0; - return pIwStats; - } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - /* - * The in_atomic function is used to determine if the scheduling is - * allowed in the current context or not. This was introduced in 2.6 - * From what I have read on the differences between 2.4 and 2.6, the - * 2.4 kernel did not support preemption and so this check might not - * be required for 2.4 kernels. - */ - if (in_atomic()) - { - if (wmi_get_stats_cmd(arPriv->arWmi) == A_OK) { - } - - pIwStats->status = 1 ; - pIwStats->qual.qual = pStats->cs_aveBeacon_rssi - 161; - pIwStats->qual.level =pStats->cs_aveBeacon_rssi; /* noise is -95 dBm */ - pIwStats->qual.noise = pStats->noise_floor_calibation; - pIwStats->discard.code = pStats->rx_decrypt_err; - pIwStats->discard.retries = pStats->tx_retry_cnt; - pIwStats->miss.beacon = pStats->cs_bmiss_cnt; - return pIwStats; - } -#endif /* LINUX_VERSION_CODE */ - dev_hold(dev); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - rtnllocked = rtnl_is_locked(); -#else - rtnllocked = TRUE; -#endif - if (rtnllocked) { - rtnl_unlock(); - } - pIwStats->status = 0; - - if (down_interruptible(&ar->arSem)) { - goto err_exit; - } - - do { - - if (ar->bIsDestroyProgress || ar->arWlanState == WLAN_DISABLED) { - break; - } - - arPriv->statsUpdatePending = TRUE; - - if(wmi_get_stats_cmd(arPriv->arWmi) != A_OK) { - break; - } - - wait_event_interruptible_timeout(arPriv->arEvent, arPriv->statsUpdatePending == FALSE, wmitimeout * HZ); - if (signal_pending(current)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000 : WMI get stats timeout \n")); - break; - } - pIwStats->status = 1 ; - pIwStats->qual.qual = pStats->cs_aveBeacon_rssi - 161; - pIwStats->qual.level =pStats->cs_aveBeacon_rssi; /* noise is -95 dBm */ - pIwStats->qual.noise = pStats->noise_floor_calibation; - pIwStats->discard.code = pStats->rx_decrypt_err; - pIwStats->discard.retries = pStats->tx_retry_cnt; - pIwStats->miss.beacon = pStats->cs_bmiss_cnt; - } while (0); - up(&ar->arSem); - -err_exit: - if (rtnllocked) { - rtnl_lock(); - } - dev_put(dev); - return pIwStats; -} - -void -ar6000_ready_event(void *devt, A_UINT8 *datap, A_UINT8 phyCap, A_UINT32 sw_ver, A_UINT32 abi_ver) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)devt; - struct net_device *dev; - AR_SOFTC_T *ar = arPriv->arSoftc; - A_UINT8 i, j, k; - - ar->arWmiReady = TRUE; - ar->arVersion.wlan_ver = sw_ver; - ar->arVersion.abi_ver = abi_ver; - wake_up(&arPriv->arEvent); - - for(i = 0; i < num_device ; i++) { - dev = ar6000_devices[i]; - arPriv = ar->arDev[i]; - arPriv->arPhyCapability = phyCap; - if (arPriv->arPhyCapability == WMI_11NAG_CAPABILITY){ - arPriv->phymode = DEF_AP_WMODE_AG; - } else { - arPriv->phymode = DEF_AP_WMODE_G; - } - A_MEMCPY(dev->dev_addr, datap, AR6000_ETH_ADDR_LEN); - - if (i > 0) { - if(mac_addr_method) { - k = dev->dev_addr[5]; - dev->dev_addr[5] += i; - for(j=5; j>3; j--) { - if(dev->dev_addr[j] > k) { - break; - } - k = dev->dev_addr[j-1]; - dev->dev_addr[j-1]++; - } - } else { - dev->dev_addr[0] = (((dev->dev_addr[0]) ^ (1 << i))) | 0x02; - } - } - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("DEV%d mac address = %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n", - i, dev->dev_addr[0], dev->dev_addr[1], - dev->dev_addr[2], dev->dev_addr[3], - dev->dev_addr[4], dev->dev_addr[5])); - -#ifdef AR6K_ENABLE_HCI_PAL - ar6k_hci_pal_info_t *pHciPalInfo = (ar6k_hci_pal_info_t *)ar->hcipal_info; - pHciPalInfo->hdev->bdaddr.b[0]=dev->dev_addr[5]; - pHciPalInfo->hdev->bdaddr.b[1]=dev->dev_addr[4]; - pHciPalInfo->hdev->bdaddr.b[2]=dev->dev_addr[3]; - pHciPalInfo->hdev->bdaddr.b[3]=dev->dev_addr[2]; - pHciPalInfo->hdev->bdaddr.b[4]=dev->dev_addr[1]; - pHciPalInfo->hdev->bdaddr.b[5]=dev->dev_addr[0]; - -#endif - -#if WLAN_CONFIG_IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN - wmi_pmparams_cmd(arPriv->arWmi, 0, 1, 0, 0, 1, IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN); -#endif -#if WLAN_CONFIG_DONOT_IGNORE_BARKER_IN_ERP - wmi_set_lpreamble_cmd(arPriv->arWmi, 0, WMI_DONOT_IGNORE_BARKER_IN_ERP); -#endif - - wmi_set_keepalive_cmd(arPriv->arWmi, WLAN_CONFIG_KEEP_ALIVE_INTERVAL); - -#if WLAN_CONFIG_DISABLE_11N - { - WMI_SET_HT_CAP_CMD htCap; - - A_MEMZERO(&htCap, sizeof(WMI_SET_HT_CAP_CMD)); - htCap.band = 0; - wmi_set_ht_cap_cmd(arPriv->arWmi, &htCap); - - htCap.band = 1; - wmi_set_ht_cap_cmd(arPriv->arWmi, &htCap); - } -#endif /* WLAN_CONFIG_DISABLE_11N */ - -#ifdef ATH6K_CONFIG_OTA_MODE - wmi_powermode_cmd(arPriv->arWmi, MAX_PERF_POWER); -#endif - wmi_disctimeout_cmd(arPriv->arWmi, WLAN_CONFIG_DISCONNECT_TIMEOUT); - } -} - -void -add_new_sta(AR_SOFTC_DEV_T *arPriv, A_UINT8 *mac, A_UINT16 aid, A_UINT8 *wpaie, - A_UINT8 ielen, A_UINT8 keymgmt, A_UINT8 ucipher, A_UINT8 auth, A_UINT8 wmode, A_UINT8 apsd_info) -{ - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_AP_T *arAp = &arPriv->arAp; - A_UINT8 free_slot=aid-1; - - A_MEMCPY(ar->connTbl[free_slot].mac, mac, ATH_MAC_LEN); - A_MEMCPY(ar->connTbl[free_slot].wpa_ie, wpaie, ielen); - ar->connTbl[free_slot].arPriv = arPriv; - ar->connTbl[free_slot].aid = aid; - ar->connTbl[free_slot].keymgmt = keymgmt; - ar->connTbl[free_slot].ucipher = ucipher; - ar->connTbl[free_slot].auth = auth; - ar->connTbl[free_slot].wmode = wmode; - ar->connTbl[free_slot].apsd_info= apsd_info; - ar->arAPStats[free_slot].aid = aid; - A_MEMZERO(ar->connTbl[free_slot].ba_state, 8); - arAp->sta_list_index = arAp->sta_list_index | (1 << free_slot); - aggr_reset_state(ar->connTbl[free_slot].conn_aggr, (void *) arPriv->arNetDev); -} - -void -ar6000_connect_event(AR_SOFTC_DEV_T *arPriv, WMI_CONNECT_EVENT *pEvt) -{ - union iwreq_data wrqu; - int i, beacon_ie_pos, assoc_resp_ie_pos, assoc_req_ie_pos; - static const char *tag1 = "ASSOCINFO(ReqIEs="; - static const char *tag2 = "ASSOCRESPIE="; - static const char *beaconIetag = "BEACONIE="; - char buf[WMI_CONTROL_MSG_MAX_LEN * 2 + strlen(tag1) + 1]; - char *pos; - A_UINT8 key_op_ctrl; - unsigned long flags; - struct ieee80211req_key *ik; - CRYPTO_TYPE keyType = NONE_CRYPT; - AR_SOFTC_STA_T *arSta; - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_DEV_T *arTempPriv = NULL; - struct ieee80211_frame *wh; - A_UINT8 *frm, *efrm, *ssid, *rates, *xrates, *wpaie, wpaLen=0; - A_UINT16 subtype; - A_UINT8 beaconIeLen; - A_UINT8 assocReqLen; - A_UINT8 assocRespLen; - A_UINT8 *assocInfo; - A_UINT8 *bssid; - - beaconIeLen = pEvt->beaconIeLen; - assocReqLen = pEvt->assocReqLen; - assocRespLen = pEvt->assocRespLen; - assocInfo = pEvt->assocInfo; - - /* BSSID and MAC_ADDR is in the same location for all modes */ - bssid = pEvt->u.infra_ibss_bss.bssid; - - if(arPriv->arNetworkType & AP_NETWORK) { - struct net_device *dev = arPriv->arNetDev; - AR_SOFTC_AP_T *arAp = &arPriv->arAp; - A_UINT8 aid, wmode, keymgmt, auth_alg; - - if(A_MEMCMP(dev->dev_addr, bssid, ATH_MAC_LEN)==0) { - arPriv->arBssChannel = pEvt->u.ap_bss.channel; - ik = &arAp->ap_mode_bkey; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AP%d: [UP] SSID %s MAC %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n", - arPriv->arDeviceIndex, arPriv->arSsid, - bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5])); -#ifdef P2P - if(arPriv->arNetworkSubType == SUBTYPE_P2PDEV) - arPriv->arNetworkSubType = SUBTYPE_P2PGO; -#endif - - switch(arPriv->arAuthMode) { - case WMI_NONE_AUTH: -#ifdef WAPI_ENABLE - if(arPriv->arPairwiseCrypto == WAPI_CRYPT) { - ap_set_wapi_key(arPriv, ik); - } -#endif - break; - case WMI_WPA_PSK_AUTH: - case WMI_WPA2_PSK_AUTH: - case (WMI_WPA_PSK_AUTH|WMI_WPA2_PSK_AUTH): - switch (ik->ik_type) { - case IEEE80211_CIPHER_TKIP: - keyType = TKIP_CRYPT; - break; - case IEEE80211_CIPHER_AES_CCM: - keyType = AES_CRYPT; - break; - default: - goto skip_key; - } - - wmi_addKey_cmd(arPriv->arWmi, ik->ik_keyix, keyType, GROUP_USAGE, - ik->ik_keylen, (A_UINT8 *)&ik->ik_keyrsc, - ik->ik_keydata, KEY_OP_INIT_VAL, ik->ik_macaddr, - SYNC_BOTH_WMIFLAG); - - break; - } -skip_key: - wmi_bssfilter_cmd(arPriv->arWmi, NONE_BSS_FILTER, 0); - - arPriv->arConnected = TRUE; - return; - } - - wh = (struct ieee80211_frame *) (assocInfo + beaconIeLen); - subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; - frm = (A_UINT8 *)&wh[1]; - efrm = assocInfo + beaconIeLen + assocReqLen; - - /* capability information */ - frm += 2; - - /* listen int */ - frm += 2; - - /* Reassoc will have current AP addr field */ - if(subtype == IEEE80211_FC0_SUBTYPE_REASSOC_REQ) { - frm += 6; - } - - ssid = rates = xrates = wpaie = NULL; - while (frm < efrm) { - switch (*frm) { -/* currently unused */ -/* - case IEEE80211_ELEMID_SSID: - ssid = frm; - break; - case IEEE80211_ELEMID_RATES: - rates = frm; - break; - case IEEE80211_ELEMID_XRATES: - xrates = frm; - break; -*/ - case IEEE80211_ELEMID_VENDOR: - if( (frm[1] > 3) && (frm[2] == 0x00) && (frm[3] == 0x50) && - (frm[4] == 0xF2) && ((frm[5] == 0x01) || (frm[5] == 0x04)) ) - { - wpaie = frm; - wpaLen = wpaie[1]+2; - } - break; - case IEEE80211_ELEMID_RSN: - wpaie = frm; - wpaLen = wpaie[1]+2; - break; - } - frm += frm[1] + 2; - } - - aid = pEvt->u.ap_sta.aid; - wmode = pEvt->u.ap_sta.phymode; - keymgmt = pEvt->u.ap_sta.keymgmt; - auth_alg = pEvt->u.ap_sta.auth; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("NEW STA %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x \n " - " AID=%d AUTH=%d WMODE=%d KEYMGMT=%d CIPHER=%d APSD=%x\n", - pEvt->u.ap_sta.mac_addr[0], pEvt->u.ap_sta.mac_addr[1], pEvt->u.ap_sta.mac_addr[2], - pEvt->u.ap_sta.mac_addr[3], pEvt->u.ap_sta.mac_addr[4], pEvt->u.ap_sta.mac_addr[5], - aid, auth_alg, wmode, keymgmt, pEvt->u.ap_sta.cipher, pEvt->u.ap_sta.apsd_info)); - - add_new_sta(arPriv, pEvt->u.ap_sta.mac_addr, aid, wpaie, wpaLen, keymgmt, - pEvt->u.ap_sta.cipher, auth_alg, wmode, pEvt->u.ap_sta.apsd_info); - - /* Send event to application */ - A_MEMZERO(&wrqu, sizeof(wrqu)); - A_MEMCPY(wrqu.addr.sa_data, pEvt->u.ap_sta.mac_addr, ATH_MAC_LEN); - wireless_send_event(arPriv->arNetDev, IWEVREGISTERED, &wrqu, NULL); - /* In case the queue is stopped when we switch modes, this will - * wake it up - */ - netif_wake_queue(arPriv->arNetDev); - return; - } - arSta = &arPriv->arSta; -#ifdef ATH6K_CONFIG_CFG80211 - ar6k_cfg80211_connect_event(arPriv, pEvt->u.infra_ibss_bss.channel, bssid, - pEvt->u.infra_ibss_bss.listenInterval, pEvt->u.infra_ibss_bss.beaconInterval, - pEvt->u.infra_ibss_bss.networkType, beaconIeLen, - assocReqLen, assocRespLen, - assocInfo); -#endif /* ATH6K_CONFIG_CFG80211 */ - - A_MEMCPY(arPriv->arBssid, bssid, sizeof(arPriv->arBssid)); - arPriv->arBssChannel = pEvt->u.infra_ibss_bss.channel; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR6000 connected event on freq %d ", pEvt->u.infra_ibss_bss.channel)); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("with bssid %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x " - " listenInterval=%d, beaconInterval = %d, beaconIeLen = %d assocReqLen=%d" - " assocRespLen =%d\n", - bssid[0], bssid[1], bssid[2], - bssid[3], bssid[4], bssid[5], - pEvt->u.infra_ibss_bss.listenInterval, pEvt->u.infra_ibss_bss.beaconInterval, - beaconIeLen, assocReqLen, assocRespLen)); - if (pEvt->u.infra_ibss_bss.networkType & ADHOC_NETWORK) { - /* Disable BG Scan for ADHOC NETWORK */ - wmi_scanparams_cmd(arPriv->arWmi, 0, 0, - 0xFFFF, 0, 0, 0, WMI_SHORTSCANRATIO_DEFAULT,DEFAULT_SCAN_CTRL_FLAGS, 0, 0); - if (pEvt->u.infra_ibss_bss.networkType & ADHOC_CREATOR) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Network: Adhoc (Creator)\n")); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Network: Adhoc (Joiner)\n")); - } - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Network: Infrastructure\n")); - } - - if ((arPriv->arNetworkType == INFRA_NETWORK)) { - if (arSta->arConnectPending) { - wmi_listeninterval_cmd(arPriv->arWmi, arSta->arListenIntervalT, arSta->arListenIntervalB); - } - } -#ifdef P2P - if(arPriv->arNetworkSubType == SUBTYPE_P2PDEV) - arPriv->arNetworkSubType = SUBTYPE_P2PCLIENT; -#endif - - if (beaconIeLen && (sizeof(buf) > (9 + beaconIeLen * 2))) { - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("\nBeaconIEs= ")); - - beacon_ie_pos = 0; - A_MEMZERO(buf, sizeof(buf)); - sprintf(buf, "%s", beaconIetag); - pos = buf + 9; - for (i = beacon_ie_pos; i < beacon_ie_pos + beaconIeLen; i++) { - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("%2.2x ", assocInfo[i])); - sprintf(pos, "%2.2x", assocInfo[i]); - pos += 2; - } - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("\n")); - - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = strlen(buf); - if (wrqu.data.length <= IW_CUSTOM_MAX) { - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Fail to send BeaconIEs to upper layer\n")); - } - } - - if (assocRespLen && (sizeof(buf) > (12 + (assocRespLen * 2)))) - { - assoc_resp_ie_pos = beaconIeLen + assocReqLen + - sizeof(A_UINT16) + /* capinfo*/ - sizeof(A_UINT16) + /* status Code */ - sizeof(A_UINT16) ; /* associd */ - A_MEMZERO(buf, sizeof(buf)); - sprintf(buf, "%s", tag2); - pos = buf + 12; - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("\nAssocRespIEs= ")); - /* - * The Association Response Frame w.o. the WLAN header is delivered to - * the host, so skip over to the IEs - */ - for (i = assoc_resp_ie_pos; i < assoc_resp_ie_pos + assocRespLen - 6; i++) - { - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("%2.2x ", assocInfo[i])); - sprintf(pos, "%2.2x", assocInfo[i]); - pos += 2; - } - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("\n")); - - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = strlen(buf); - if (wrqu.data.length <= IW_CUSTOM_MAX) { - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); - } else { -#if (WIRELESS_EXT >= 18) - wrqu.data.length = (assocRespLen - 6); - wireless_send_event(arPriv->arNetDev, IWEVASSOCRESPIE, &wrqu, &assocInfo[assoc_resp_ie_pos]); -#else - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Fail to send Association Response to upper layer\n")); -#endif - } - } - - if (assocReqLen && (sizeof(buf) > (17 + (assocReqLen * 2)))) { - /* - * assoc Request includes capability and listen interval. Skip these. - */ - assoc_req_ie_pos = beaconIeLen + - sizeof(A_UINT16) + /* capinfo*/ - sizeof(A_UINT16); /* listen interval */ - - A_MEMZERO(buf, sizeof(buf)); - sprintf(buf, "%s", tag1); - pos = buf + 17; - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("AssocReqIEs= ")); - for (i = assoc_req_ie_pos; i < assoc_req_ie_pos + assocReqLen - 4; i++) { - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("%2.2x ", assocInfo[i])); - sprintf(pos, "%2.2x", assocInfo[i]); - pos += 2;; - } - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("\n")); - - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = strlen(buf); - if (wrqu.data.length <= IW_CUSTOM_MAX) { - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); - } else { -#if (WIRELESS_EXT >= 18) - wrqu.data.length = (assocReqLen - 4); - wireless_send_event(arPriv->arNetDev, IWEVASSOCREQIE, &wrqu, &assocInfo[assoc_req_ie_pos]); -#else - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Fail to send Association Request to upper layer\n")); -#endif - } - } - -#ifdef USER_KEYS - if (arSta->user_savedkeys_stat == USER_SAVEDKEYS_STAT_RUN && - arSta->user_saved_keys.keyOk == TRUE) - { - key_op_ctrl = KEY_OP_VALID_MASK & ~KEY_OP_INIT_TSC; - - if (arSta->user_key_ctrl & AR6000_USER_SETKEYS_RSC_UNCHANGED) { - key_op_ctrl &= ~KEY_OP_INIT_RSC; - } else { - key_op_ctrl |= KEY_OP_INIT_RSC; - } - ar6000_reinstall_keys(arPriv, key_op_ctrl); - } -#endif /* USER_KEYS */ - - netif_wake_queue(arPriv->arNetDev); - - /* For CFG80211 the key configuration and the default key comes in after connect so no point in plumbing invalid keys */ -#ifndef ATH6K_CONFIG_CFG80211 - if ((pEvt->u.infra_ibss_bss.networkType & ADHOC_NETWORK) && - (OPEN_AUTH == arPriv->arDot11AuthMode) && - (WMI_NONE_AUTH == arPriv->arAuthMode) && - (WEP_CRYPT == arPriv->arPairwiseCrypto)) - { - if (!arPriv->arConnected) { - wmi_addKey_cmd(arPriv->arWmi, - arPriv->arDefTxKeyIndex, - WEP_CRYPT, - GROUP_USAGE | TX_USAGE, - arPriv->arWepKeyList[arPriv->arDefTxKeyIndex].arKeyLen, - NULL, - arPriv->arWepKeyList[arPriv->arDefTxKeyIndex].arKey, KEY_OP_INIT_VAL, NULL, - NO_SYNC_WMIFLAG); - } - } -#endif /* ATH6K_CONFIG_CFG80211 */ - - /* Update connect & link status atomically */ - spin_lock_irqsave(&arPriv->arPrivLock, flags); - arPriv->arConnected = TRUE; - arSta->arConnectPending = FALSE; - netif_carrier_on(arPriv->arNetDev); - spin_unlock_irqrestore(&arPriv->arPrivLock, flags); - /* reset the rx aggr state */ - aggr_reset_state(arPriv->conn_aggr, (void *) arPriv->arNetDev); - reconnect_flag = 0; - - A_MEMZERO(&wrqu, sizeof(wrqu)); - A_MEMCPY(wrqu.addr.sa_data, bssid, IEEE80211_ADDR_LEN); - wrqu.addr.sa_family = ARPHRD_ETHER; - wireless_send_event(arPriv->arNetDev, SIOCGIWAP, &wrqu, NULL); - if ((arPriv->arNetworkType == ADHOC_NETWORK) && arSta->arIbssPsEnable) { - A_MEMZERO(arSta->arNodeMap, sizeof(arSta->arNodeMap)); - arSta->arNodeNum = 0; - arSta->arNexEpId = ENDPOINT_2; - } - if (!arSta->arUserBssFilter) { - wmi_bssfilter_cmd(arPriv->arWmi, NONE_BSS_FILTER, 0); - } - /* AP-STA Concurrency */ - if(ar->arHoldConnection){ - for(i=0;i < ar->arConfNumDev;i++) { - arTempPriv = ar->arDev[i]; - if((AP_NETWORK == arTempPriv->arNetworkType)){ - arTempPriv->arBssChannel = arTempPriv->arChannelHint = 0; - } - } - A_TIMEOUT_MS(&ar->ap_reconnect_timer, 1*1000, 0); - } -} - -void ar6000_set_numdataendpts(AR_SOFTC_DEV_T *arPriv, A_UINT32 num) -{ - AR_SOFTC_T *ar = arPriv->arSoftc; - A_ASSERT(num <= (HTC_MAILBOX_NUM_MAX - 1)); - ar->arNumDataEndPts = num; -} - -void -sta_cleanup(AR_SOFTC_DEV_T *arPriv, A_UINT8 i) -{ - struct sk_buff *skb; - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_AP_T *arAp = &arPriv->arAp; - - /* empty the queued pkts in the PS queue if any */ - A_MUTEX_LOCK(&ar->connTbl[i].psqLock); - while (!A_NETBUF_QUEUE_EMPTY(&ar->connTbl[i].psq)) { - skb = A_NETBUF_DEQUEUE(&ar->connTbl[i].psq); - A_NETBUF_FREE(skb); - } - while (!A_NETBUF_QUEUE_EMPTY(&ar->connTbl[i].apsdq)) { - skb = A_NETBUF_DEQUEUE(&ar->connTbl[i].apsdq); - A_NETBUF_FREE(skb); - } - A_MUTEX_UNLOCK(&ar->connTbl[i].psqLock); - - /* Zero out the state fields */ - A_MEMZERO(&ar->arAPStats[i], sizeof(WMI_PER_STA_STAT)); - A_MEMZERO(&ar->connTbl[i].mac, ATH_MAC_LEN); - A_MEMZERO(&ar->connTbl[i].wpa_ie, IEEE80211_MAX_IE); - ar->connTbl[i].aid = 0; - ar->connTbl[i].flags = 0; - ar->connTbl[i].arPriv = NULL; - - arAp->sta_list_index =arAp->sta_list_index & ~(1 << i); - aggr_reset_state(ar->connTbl[i].conn_aggr, NULL); -} - -void -ar6000_ap_cleanup(AR_SOFTC_DEV_T *arPriv) -{ - A_UINT8 ctr; - struct sk_buff *skb; - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_AP_T *arAp = &arPriv->arAp; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("DEL ALL STA\n")); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AP%d: [DOWN] SSID %s\n", arPriv->arDeviceIndex, arPriv->arSsid)); - - for (ctr=0; ctr < NUM_CONN; ctr++) { - if(ar->connTbl[ctr].arPriv == arPriv) { - remove_sta(arPriv, ar->connTbl[ctr].mac, 0); - } - } - A_MUTEX_LOCK(&arAp->mcastpsqLock); - while (!A_NETBUF_QUEUE_EMPTY(&arAp->mcastpsq)) { - skb = A_NETBUF_DEQUEUE(&arAp->mcastpsq); - A_NETBUF_FREE(skb); - } - A_MUTEX_UNLOCK(&arAp->mcastpsqLock); - arPriv->arConnected = FALSE; -} - -A_UINT8 -remove_sta(AR_SOFTC_DEV_T *arPriv, A_UINT8 *mac, A_UINT16 reason) -{ - A_UINT8 i, removed=0; - AR_SOFTC_T *ar = arPriv->arSoftc; - union iwreq_data wrqu; - struct sk_buff *skb; - - if(IS_MAC_NULL(mac)) { - return removed; - } - - if(reason == AP_DISCONNECT_MAX_STA) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("MAX STA %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n", mac[0], - mac[1], mac[2], mac[3], mac[4], mac[5])); - return removed; - } else if(reason == AP_DISCONNECT_ACL) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ACL STA %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n", mac[0], - mac[1], mac[2], mac[3], mac[4], mac[5])); - return removed; - } - - for(i=0; i < NUM_CONN; i++) { - if(A_MEMCMP(ar->connTbl[i].mac, mac, ATH_MAC_LEN)==0) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("DEL STA %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x " - " aid=%d REASON=%d\n", mac[0], mac[1], mac[2], - mac[3], mac[4], mac[5], ar->connTbl[i].aid, reason)); - - sta_cleanup(arPriv, i); - removed = 1; - - /* Send event to application */ - A_MEMZERO(&wrqu, sizeof(wrqu)); - A_MEMCPY(wrqu.addr.sa_data, mac, ATH_MAC_LEN); - wireless_send_event(arPriv->arNetDev, IWEVEXPIRED, &wrqu, NULL); - - break; - } - } - - /* If there are no more associated STAs, empty the mcast PS q */ - if (arPriv->arAp.sta_list_index == 0) { - A_MUTEX_LOCK(&arPriv->arAp.mcastpsqLock); - while (!A_NETBUF_QUEUE_EMPTY(&arPriv->arAp.mcastpsq)) { - skb = A_NETBUF_DEQUEUE(&arPriv->arAp.mcastpsq); - A_NETBUF_FREE(skb); - } - A_MUTEX_UNLOCK(&arPriv->arAp.mcastpsqLock); - - /* Clear the LSB of the BitMapCtl field of the TIM IE */ - if (ar->arWmiReady) { - wmi_set_pvb_cmd(arPriv->arWmi, MCAST_AID, 0); - } - } - - return removed; -} - -void -ar6000_disconnect_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 reason, A_UINT8 *bssid, - A_UINT8 assocRespLen, A_UINT8 *assocInfo, A_UINT16 protocolReasonStatus) -{ - A_UINT8 i; - unsigned long flags; - union iwreq_data wrqu; - AR_SOFTC_T *ar = arPriv->arSoftc; - A_BOOL bt30Devfound = FALSE; -#ifdef P2P - if((arPriv->arNetworkSubType == SUBTYPE_P2PCLIENT) || (arPriv->arNetworkSubType == SUBTYPE_P2PGO) - || (arPriv->arNetworkSubType == SUBTYPE_P2PDEV)){ - if(!(IS_MAC_BCAST(bssid))) - p2p_clear_peers_authorized_flag(arPriv->p2p_ctx, bssid); - } -#endif - - if(arPriv->arNetworkType & AP_NETWORK) { - if(IS_MAC_BCAST(bssid)) { - ar6000_ap_cleanup(arPriv); -#ifdef P2P - if(arPriv->arNetworkSubType == SUBTYPE_P2PGO) { - arPriv->arNextMode = INFRA_NETWORK; - ar6000_init_mode_info(arPriv); - arPriv->arNetworkType = INFRA_NETWORK; - arPriv->arNetworkSubType = SUBTYPE_P2PDEV; - } -#endif - } else { - remove_sta(arPriv, bssid, protocolReasonStatus); - } - return; - } - -#ifdef ATH6K_CONFIG_CFG80211 - ar6k_cfg80211_disconnect_event(arPriv, reason, bssid, - assocRespLen, assocInfo, - protocolReasonStatus); -#endif /* ATH6K_CONFIG_CFG80211 */ - - /* Send disconnect event to supplicant */ - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.addr.sa_family = ARPHRD_ETHER; - wireless_send_event(arPriv->arNetDev, SIOCGIWAP, &wrqu, NULL); - - /* it is necessary to clear the host-side rx aggregation state */ - aggr_reset_state(arPriv->conn_aggr, NULL); - - A_UNTIMEOUT(&arPriv->arSta.disconnect_timer); - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR6000 disconnected")); - if (bssid[0] || bssid[1] || bssid[2] || bssid[3] || bssid[4] || bssid[5]) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" from %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x ", - bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5])); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Disconnect Reason is %d, Status Code is %d", reason, protocolReasonStatus)); - - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("\nDisconnect Reason is %d", reason)); - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("\nProtocol Reason/Status Code is %d", protocolReasonStatus)); - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("\nAssocResp Frame = %s", - assocRespLen ? " " : "NULL")); - for (i = 0; i < assocRespLen; i++) { - if (!(i % 0x10)) { - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("\n")); - } - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("%2.2x ", assocInfo[i])); - } - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("\n")); - /* - * If the event is due to disconnect cmd from the host, only they the target - * would stop trying to connect. Under any other condition, target would - * keep trying to connect. - * - */ - if( reason == DISCONNECT_CMD) - { - if ((!arPriv->arSta.arUserBssFilter) && (ar->arWmiReady)) { - wmi_bssfilter_cmd(arPriv->arWmi, NONE_BSS_FILTER, 0); - } - } else { - arPriv->arSta.arConnectPending = TRUE; - if (((reason == ASSOC_FAILED) && (protocolReasonStatus == 0x11)) || - ((reason == ASSOC_FAILED) && (protocolReasonStatus == 0x0) && (reconnect_flag == 1))) { - arPriv->arConnected = TRUE; - return; - } - } - - if ((reason == NO_NETWORK_AVAIL) && (ar->arWmiReady)) - { - bss_t *pWmiSsidnode = NULL; - - /* remove the current associated bssid node */ - wmi_free_node (arPriv->arWmi, bssid); - - /* - * In case any other same SSID nodes are present - * remove it, since those nodes also not available now - */ - do - { - /* - * Find the nodes based on SSID and remove it - * NOTE :: This case will not work out for Hidden-SSID - */ - pWmiSsidnode = wmi_find_Ssidnode (arPriv->arWmi, arPriv->arSsid, arPriv->arSsidLen, FALSE, TRUE); - - if (pWmiSsidnode) - { - wmi_free_node (arPriv->arWmi, pWmiSsidnode->ni_macaddr); - } - - }while (pWmiSsidnode); - } - - /* Update connect & link status atomically */ - spin_lock_irqsave(&arPriv->arPrivLock, flags); - - arPriv->arConnected = FALSE; - netif_carrier_off(arPriv->arNetDev); - spin_unlock_irqrestore(&arPriv->arPrivLock, flags); -#ifdef P2P - if(arPriv->arNetworkSubType == SUBTYPE_P2PCLIENT) { - arPriv->arNextMode = INFRA_NETWORK; - ar6000_init_mode_info(arPriv); - arPriv->arNetworkType = INFRA_NETWORK; - arPriv->arNetworkSubType = SUBTYPE_P2PDEV; - } -#endif - - if( (reason != CSERV_DISCONNECT) || (reconnect_flag != 1) ) { - reconnect_flag = 0; - } - -#ifdef USER_KEYS - if (reason != CSERV_DISCONNECT) - { - arPriv->arSta.user_savedkeys_stat = USER_SAVEDKEYS_STAT_INIT; - arPriv->arSta.user_key_ctrl = 0; - } -#endif /* USER_KEYS */ - - netif_stop_queue(arPriv->arNetDev); - A_MEMZERO(arPriv->arBssid, sizeof(arPriv->arBssid)); - arPriv->arBssChannel = 0; - arPriv->arSta.arBeaconInterval = 0; - - for (i=0; i < num_device; i++) { - AR_SOFTC_DEV_T *temparPriv; - temparPriv = ar->arDev[i]; - if (temparPriv->isBt30amp == TRUE) { - bt30Devfound = TRUE; - } - } - if (bt30Devfound == FALSE) { - ar6000_TxDataCleanup(ar); - } - /* AP-STA Concurrency */ - if(ar->arHoldConnection){ - A_TIMEOUT_MS(&ar->ap_reconnect_timer, 2*1000, 0); - } - - if (arPriv->arNetworkType == ADHOC_NETWORK){ - /* Reset Scan params to default */ - wmi_scanparams_cmd(arPriv->arWmi, 0, 0, - 60, 0, 0, 0, WMI_SHORTSCANRATIO_DEFAULT,DEFAULT_SCAN_CTRL_FLAGS, 0, 0); - } -} - -void -ar6000_regDomain_event(AR_SOFTC_DEV_T *arPriv, A_UINT32 regCode) -{ - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR6000 Reg Code = 0x%x\n", regCode)); - arPriv->arRegCode = regCode; -} - -#ifdef ATH_AR6K_11N_SUPPORT -#define BA_EVT_GET_CONNID(a) ((a)>>4) -#define BA_EVT_GET_TID(b) ((b)&0xF) - -void -ar6000_aggr_rcv_addba_req_evt(AR_SOFTC_DEV_T *arPriv, WMI_ADDBA_REQ_EVENT *evt) -{ - A_UINT8 connid = BA_EVT_GET_CONNID(evt->tid); - A_UINT8 tid = BA_EVT_GET_TID(evt->tid); - conn_t *conn = ieee80211_find_conn_for_aid(arPriv, connid); - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ADDBA REQ: tid=%d, connid=%d, status=%d, win_sz=%d\n", tid, connid, evt->status, evt->win_sz)); - if(((arPriv->arNetworkType == INFRA_NETWORK) || (conn != NULL)) && evt->status == 0) { - aggr_recv_addba_req_evt(get_aggr_ctx(arPriv, conn), tid, evt->st_seq_no, evt->win_sz); - } -} - -void -ar6000_aggr_rcv_addba_resp_evt(AR_SOFTC_DEV_T *arPriv, WMI_ADDBA_RESP_EVENT *evt) -{ - A_UINT8 connid = BA_EVT_GET_CONNID(evt->tid); - A_UINT8 tid = BA_EVT_GET_TID(evt->tid); - conn_t *conn = ieee80211_find_conn_for_aid(arPriv, connid); - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ADDBA RSP: tid=%d, connid=%d, status=%d, sz=%d\n", tid, connid, evt->status, evt->amsdu_sz)); - if(conn) { - conn->ba_state[tid] = 0x80; - } - if(evt->status == 0) { - } -} - -void -ar6000_aggr_rcv_delba_req_evt(AR_SOFTC_DEV_T *arPriv, WMI_DELBA_EVENT *evt) -{ - A_UINT8 connid = BA_EVT_GET_CONNID(evt->tid); - A_UINT8 tid = BA_EVT_GET_TID(evt->tid); - conn_t *conn = ieee80211_find_conn_for_aid(arPriv, connid); - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("DELBA REQ: tid=%d, connid=%d\n", tid, connid)); - if((arPriv->arNetworkType == INFRA_NETWORK) || (conn != NULL)) { - aggr_recv_delba_req_evt(get_aggr_ctx(arPriv, conn), tid); - } -} -#endif - -void register_pal_cb(ar6k_pal_config_t *palConfig_p) -{ - ar6k_pal_config_g = *palConfig_p; -} - -void -ar6000_hci_event_rcv_evt(AR_SOFTC_DEV_T *arPriv, WMI_HCI_EVENT *cmd) -{ - void *osbuf = NULL; - A_INT8 i; - A_UINT8 size, *buf; - A_STATUS ret = A_OK; - - size = cmd->evt_buf_sz + 4; - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - ret = A_NO_MEMORY; - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Error in allocating netbuf \n")); - return; - } - - A_NETBUF_PUT(osbuf, size); - buf = (A_UINT8 *)A_NETBUF_DATA(osbuf); - /* First 2-bytes carry HCI event/ACL data type - * the next 2 are free - */ - *((short *)buf) = WMI_HCI_EVENT_EVENTID; - buf += sizeof(int); - A_MEMCPY(buf, cmd->buf, cmd->evt_buf_sz); - - if(ar6k_pal_config_g.fpar6k_pal_recv_pkt) - { - /* pass the cmd packet to PAL driver */ - if((*ar6k_pal_config_g.fpar6k_pal_recv_pkt)(arPriv->hcipal_info, osbuf) == TRUE) - return; - } - ar6000_deliver_frames_to_nw_stack(arPriv->arNetDev, osbuf); - if(loghci) { - A_PRINTF_LOG("HCI Event From PAL <-- \n"); - for(i = 0; i < cmd->evt_buf_sz; i++) { - A_PRINTF_LOG("0x%02x ", cmd->buf[i]); - if((i % 10) == 0) { - A_PRINTF_LOG("\n"); - } - } - A_PRINTF_LOG("\n"); - A_PRINTF_LOG("==================================\n"); - } -} - -void -ar6000_neighborReport_event(AR_SOFTC_DEV_T *arPriv, int numAps, WMI_NEIGHBOR_INFO *info) -{ -#if WIRELESS_EXT >= 18 - struct iw_pmkid_cand *pmkcand; -#else /* WIRELESS_EXT >= 18 */ - static const char *tag = "PRE-AUTH"; - char buf[128]; -#endif /* WIRELESS_EXT >= 18 */ - - union iwreq_data wrqu; - int i; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR6000 Neighbor Report Event\n")); - for (i=0; i < numAps; info++, i++) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("bssid %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x ", - info->bssid[0], info->bssid[1], info->bssid[2], - info->bssid[3], info->bssid[4], info->bssid[5])); - if (info->bssFlags & WMI_PREAUTH_CAPABLE_BSS) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("preauth-cap")); - } - if (info->bssFlags & WMI_PMKID_VALID_BSS) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" pmkid-valid\n")); - continue; /* we skip bss if the pmkid is already valid */ - } - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("\n")); - A_MEMZERO(&wrqu, sizeof(wrqu)); -#if WIRELESS_EXT >= 18 - pmkcand = A_MALLOC_NOWAIT(sizeof(struct iw_pmkid_cand)); - A_MEMZERO(pmkcand, sizeof(struct iw_pmkid_cand)); - pmkcand->index = i; - pmkcand->flags = info->bssFlags; - A_MEMCPY(pmkcand->bssid.sa_data, info->bssid, ATH_MAC_LEN); - wrqu.data.length = sizeof(struct iw_pmkid_cand); - wireless_send_event(arPriv->arNetDev, IWEVPMKIDCAND, &wrqu, (char *)pmkcand); - A_FREE(pmkcand); -#else /* WIRELESS_EXT >= 18 */ - snprintf(buf, sizeof(buf), "%s%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x", - tag, - info->bssid[0], info->bssid[1], info->bssid[2], - info->bssid[3], info->bssid[4], info->bssid[5], - i, info->bssFlags); - wrqu.data.length = strlen(buf); - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); -#endif /* WIRELESS_EXT >= 18 */ - } -} - -void -ar6000_indicate_proberesp(AR_SOFTC_DEV_T *arPriv , A_UINT8* pData , A_UINT16 len ,A_UINT8* bssid) -{ -} - -void -ar6000_indicate_beacon(AR_SOFTC_DEV_T *arPriv, A_UINT8* pData , A_UINT16 len ,A_UINT8* bssid) -{ -} - -void -ar6000_assoc_req_report_event (void *context, A_UINT8 status, A_UINT8 rspType, A_UINT8* pData, int len) -{ -} - -#ifdef ATH_SUPPORT_DFS - -void ar6000_dfs_attach_event(AR_SOFTC_DEV_T *arPriv, WMI_DFS_HOST_ATTACH_EVENT *capinfo) -{ - AR_SOFTC_AP_T *arAp=&arPriv->arAp; - arAp->pDfs = dfs_attach_host(arPriv, NULL, capinfo); - if(arAp->pDfs) - { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("\nDFS host attached\n")); - } - else - { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("\nDFS host ptr NULL\n")); - } -} - -void ar6000_dfs_init_event(AR_SOFTC_DEV_T *arPriv, WMI_DFS_HOST_INIT_EVENT *info) -{ - AR_SOFTC_AP_T *arAp=&arPriv->arAp; - dfs_init_radar_filters_host(arAp->pDfs, info); -} - -void ar6000_dfs_phyerr_event(AR_SOFTC_DEV_T *arPriv, WMI_DFS_PHYERR_EVENT *info) -{ - AR_SOFTC_AP_T *arAp=&arPriv->arAp; - dfs_process_phyerr_host(arAp->pDfs, info); -} - -void ar6000_dfs_reset_delaylines_event(AR_SOFTC_DEV_T *arPriv) -{ - AR_SOFTC_AP_T *arAp=&arPriv->arAp; - dfs_reset_alldelaylines(arAp->pDfs); -} - -void ar6000_dfs_reset_radarq_event(AR_SOFTC_DEV_T *arPriv) -{ - AR_SOFTC_AP_T *arAp=&arPriv->arAp; - dfs_reset_radarq(arAp->pDfs); -} - -void ar6000_dfs_reset_ar_event(AR_SOFTC_DEV_T *arPriv) -{ - AR_SOFTC_AP_T *arAp=&arPriv->arAp; - dfs_reset_ar(arAp->pDfs); -} - -void ar6000_dfs_reset_arq_event(AR_SOFTC_DEV_T *arPriv) -{ - AR_SOFTC_AP_T *arAp=&arPriv->arAp; - dfs_reset_arq(arAp->pDfs); -} - -void ar6000_dfs_set_dur_multiplier_event(AR_SOFTC_DEV_T *arPriv, A_UINT32 value) -{ - AR_SOFTC_AP_T *arAp=&arPriv->arAp; - dfs_set_dur_multiplier(arAp->pDfs, value); -} - -void ar6000_dfs_set_bangradar_event(AR_SOFTC_DEV_T *arPriv, A_UINT32 value) -{ - AR_SOFTC_AP_T *arAp=&arPriv->arAp; - dfs_bangradar_enable(arAp->pDfs, value); -} - -void ar6000_dfs_set_debuglevel_event(AR_SOFTC_DEV_T *arPriv, A_UINT32 value) -{ - AR_SOFTC_AP_T *arAp=&arPriv->arAp; - dfs_set_debug_level_host(arAp->pDfs, value); -} - -A_STATUS ar6000_dfs_set_maxpulsedur_cmd(AR_SOFTC_DEV_T *arPriv, A_UINT32 value) -{ - return wmi_set_dfs_maxpulsedur_cmd(arPriv->arWmi, value); -} - -A_STATUS ar6000_dfs_radar_detected_cmd(AR_SOFTC_DEV_T *arPriv, A_INT16 chan_index, A_INT8 bang_radar) -{ - return wmi_radarDetected_cmd(arPriv->arWmi, chan_index, bang_radar); -} - -A_STATUS ar6000_dfs_set_minrssithresh_cmd(AR_SOFTC_DEV_T *arPriv, A_INT32 rssi) -{ - return wmi_set_dfs_minrssithresh_cmd(arPriv->arWmi, rssi); -} - -#endif /* ATH_SUPPORT_DFS */ - -void -ar6000_tkip_micerr_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 keyid, A_BOOL ismcast) -{ - static const char *tag = "MLME-MICHAELMICFAILURE.indication"; - char buf[128]; - union iwreq_data wrqu; - - /* - * For AP case, keyid will have aid of STA which sent pkt with - * MIC error. Use this aid to get MAC & send it to hostapd. - */ - if (arPriv->arNetworkType == AP_NETWORK) { - conn_t *s = ieee80211_find_conn_for_aid(arPriv, (keyid >> 2)); - if(!s){ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AP TKIP MIC error received from Invalid aid / STA not found =%d\n", keyid)); - return; - } - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AP TKIP MIC error received from aid=%d\n", keyid)); - snprintf(buf,sizeof(buf), "%s addr=%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x", - tag, s->mac[0],s->mac[1],s->mac[2],s->mac[3],s->mac[4],s->mac[5]); - } else { - -#ifdef ATH6K_CONFIG_CFG80211 - ar6k_cfg80211_tkip_micerr_event(arPriv, keyid, ismcast); -#endif /* ATH6K_CONFIG_CFG80211 */ - - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR6000 TKIP MIC error received for keyid %d %scast\n", - keyid & 0x3, ismcast ? "multi": "uni")); - snprintf(buf, sizeof(buf), "%s(keyid=%d %sicast)", tag, keyid & 0x3, - ismcast ? "mult" : "un"); - } - - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.length = strlen(buf); - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); -} - -void -ar6000_scanComplete_event(AR_SOFTC_DEV_T *arPriv, A_STATUS status) -{ - -#ifdef ATH6K_CONFIG_CFG80211 - ar6k_cfg80211_scanComplete_event(arPriv, status); -#endif /* ATH6K_CONFIG_CFG80211 */ - - if (arPriv->arSoftc->arWmiReady && arPriv->arSoftc->arWlanState==WLAN_ENABLED) { - if (!arPriv->arSta.arUserBssFilter) { - wmi_bssfilter_cmd(arPriv->arWmi, NONE_BSS_FILTER, 0); - } - } - if (arPriv->arSta.scan_triggered) { - union iwreq_data wrqu; - A_MEMZERO(&wrqu, sizeof(wrqu)); - wireless_send_event(arPriv->arNetDev, SIOCGIWSCAN, &wrqu, NULL); - arPriv->arSta.scan_triggered = 0; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,( "AR6000 scan complete: %d\n", status)); -} - -void -ar6000_targetStats_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 *ptr, A_UINT32 len) -{ - A_UINT8 ac, i; - - if(arPriv->arNetworkType == AP_NETWORK) { - WMI_AP_MODE_STAT *p = (WMI_AP_MODE_STAT *)ptr; - WMI_PER_STA_STAT *ap = arPriv->arSoftc->arAPStats; - - if (len < sizeof(*p)) { - return; - } - - for(ac=0;acsta[ac].aid == 0) { - continue; - } - i = p->sta[ac].aid-1; - - ap[i].tx_bytes += p->sta[ac].tx_bytes; - ap[i].tx_pkts += p->sta[ac].tx_pkts; - ap[i].tx_error += p->sta[ac].tx_error; - ap[i].tx_discard += p->sta[ac].tx_discard; - ap[i].rx_bytes += p->sta[ac].rx_bytes; - ap[i].rx_pkts += p->sta[ac].rx_pkts; - ap[i].rx_error += p->sta[ac].rx_error; - ap[i].rx_discard += p->sta[ac].rx_discard; - } - } else { - WMI_TARGET_STATS *pTarget = (WMI_TARGET_STATS *)ptr; - TARGET_STATS *pStats = &arPriv->arTargetStats; - - if (len < sizeof(*pTarget)) { - return; - } - - // Update the RSSI of the connected bss. - if (arPriv->arConnected) { - bss_t *pConnBss = NULL; - - pConnBss = wmi_find_node(arPriv->arWmi,arPriv->arBssid); - if (pConnBss) - { - pConnBss->ni_rssi = pTarget->cservStats.cs_aveBeacon_rssi; - pConnBss->ni_snr = pTarget->cservStats.cs_aveBeacon_snr; - wmi_node_return(arPriv->arWmi, pConnBss); - } - } - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR6000 updating target stats\n")); - pStats->tx_packets += pTarget->txrxStats.tx_stats.tx_packets; - pStats->tx_bytes += pTarget->txrxStats.tx_stats.tx_bytes; - pStats->tx_unicast_pkts += pTarget->txrxStats.tx_stats.tx_unicast_pkts; - pStats->tx_unicast_bytes += pTarget->txrxStats.tx_stats.tx_unicast_bytes; - pStats->tx_multicast_pkts += pTarget->txrxStats.tx_stats.tx_multicast_pkts; - pStats->tx_multicast_bytes += pTarget->txrxStats.tx_stats.tx_multicast_bytes; - pStats->tx_broadcast_pkts += pTarget->txrxStats.tx_stats.tx_broadcast_pkts; - pStats->tx_broadcast_bytes += pTarget->txrxStats.tx_stats.tx_broadcast_bytes; - pStats->tx_rts_success_cnt += pTarget->txrxStats.tx_stats.tx_rts_success_cnt; - for(ac = 0; ac < WMM_NUM_AC; ac++) - pStats->tx_packet_per_ac[ac] += pTarget->txrxStats.tx_stats.tx_packet_per_ac[ac]; - pStats->tx_errors += pTarget->txrxStats.tx_stats.tx_errors; - pStats->tx_failed_cnt += pTarget->txrxStats.tx_stats.tx_failed_cnt; - pStats->tx_retry_cnt += pTarget->txrxStats.tx_stats.tx_retry_cnt; - pStats->tx_mult_retry_cnt += pTarget->txrxStats.tx_stats.tx_mult_retry_cnt; - pStats->tx_rts_fail_cnt += pTarget->txrxStats.tx_stats.tx_rts_fail_cnt; - pStats->tx_unicast_rate = wmi_get_rate(pTarget->txrxStats.tx_stats.tx_unicast_rate); - - pStats->rx_packets += pTarget->txrxStats.rx_stats.rx_packets; - pStats->rx_bytes += pTarget->txrxStats.rx_stats.rx_bytes; - pStats->rx_unicast_pkts += pTarget->txrxStats.rx_stats.rx_unicast_pkts; - pStats->rx_unicast_bytes += pTarget->txrxStats.rx_stats.rx_unicast_bytes; - pStats->rx_multicast_pkts += pTarget->txrxStats.rx_stats.rx_multicast_pkts; - pStats->rx_multicast_bytes += pTarget->txrxStats.rx_stats.rx_multicast_bytes; - pStats->rx_broadcast_pkts += pTarget->txrxStats.rx_stats.rx_broadcast_pkts; - pStats->rx_broadcast_bytes += pTarget->txrxStats.rx_stats.rx_broadcast_bytes; - pStats->rx_fragment_pkt += pTarget->txrxStats.rx_stats.rx_fragment_pkt; - pStats->rx_errors += pTarget->txrxStats.rx_stats.rx_errors; - pStats->rx_crcerr += pTarget->txrxStats.rx_stats.rx_crcerr; - pStats->rx_key_cache_miss += pTarget->txrxStats.rx_stats.rx_key_cache_miss; - pStats->rx_decrypt_err += pTarget->txrxStats.rx_stats.rx_decrypt_err; - pStats->rx_duplicate_frames += pTarget->txrxStats.rx_stats.rx_duplicate_frames; - pStats->rx_unicast_rate = wmi_get_rate(pTarget->txrxStats.rx_stats.rx_unicast_rate); - - - pStats->tkip_local_mic_failure - += pTarget->txrxStats.tkipCcmpStats.tkip_local_mic_failure; - pStats->tkip_counter_measures_invoked - += pTarget->txrxStats.tkipCcmpStats.tkip_counter_measures_invoked; - pStats->tkip_replays += pTarget->txrxStats.tkipCcmpStats.tkip_replays; - pStats->tkip_format_errors += pTarget->txrxStats.tkipCcmpStats.tkip_format_errors; - pStats->ccmp_format_errors += pTarget->txrxStats.tkipCcmpStats.ccmp_format_errors; - pStats->ccmp_replays += pTarget->txrxStats.tkipCcmpStats.ccmp_replays; - - pStats->power_save_failure_cnt += pTarget->pmStats.power_save_failure_cnt; - pStats->noise_floor_calibation = pTarget->noise_floor_calibation; - - pStats->cs_bmiss_cnt += pTarget->cservStats.cs_bmiss_cnt; - pStats->cs_lowRssi_cnt += pTarget->cservStats.cs_lowRssi_cnt; - pStats->cs_connect_cnt += pTarget->cservStats.cs_connect_cnt; - pStats->cs_disconnect_cnt += pTarget->cservStats.cs_disconnect_cnt; - pStats->cs_aveBeacon_snr = pTarget->cservStats.cs_aveBeacon_snr; - pStats->cs_aveBeacon_rssi = pTarget->cservStats.cs_aveBeacon_rssi; - - if (enablerssicompensation) { - pStats->cs_aveBeacon_rssi = - rssi_compensation_calc(arPriv, pStats->cs_aveBeacon_rssi); - } - pStats->cs_lastRoam_msec = pTarget->cservStats.cs_lastRoam_msec; - pStats->cs_snr = pTarget->cservStats.cs_snr; - pStats->cs_rssi = pTarget->cservStats.cs_rssi; - - pStats->lq_val = pTarget->lqVal; - - pStats->wow_num_pkts_dropped += pTarget->wowStats.wow_num_pkts_dropped; - pStats->wow_num_host_pkt_wakeups += pTarget->wowStats.wow_num_host_pkt_wakeups; - pStats->wow_num_host_event_wakeups += pTarget->wowStats.wow_num_host_event_wakeups; - pStats->wow_num_events_discarded += pTarget->wowStats.wow_num_events_discarded; - pStats->arp_received += pTarget->arpStats.arp_received; - pStats->arp_matched += pTarget->arpStats.arp_matched; - pStats->arp_replied += pTarget->arpStats.arp_replied; - - if (arPriv->statsUpdatePending) { - arPriv->statsUpdatePending = FALSE; - wake_up(&arPriv->arEvent); - } - } -} - -void -ar6000_rssiThreshold_event(AR_SOFTC_DEV_T *arPriv, WMI_RSSI_THRESHOLD_VAL newThreshold, A_INT16 rssi) -{ - USER_RSSI_THOLD userRssiThold; - - rssi = rssi + SIGNAL_QUALITY_NOISE_FLOOR; - - if (enablerssicompensation) { - rssi = rssi_compensation_calc(arPriv, rssi); - } - - /* Send an event to the app */ - userRssiThold.tag = arPriv->arSta.rssi_map[newThreshold].tag; - userRssiThold.rssi = rssi; - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("rssi Threshold range = %d tag = %d rssi = %d\n", newThreshold, - userRssiThold.tag, userRssiThold.rssi)); - - ar6000_send_event_to_app(arPriv, WMI_RSSI_THRESHOLD_EVENTID,(A_UINT8 *)&userRssiThold, sizeof(USER_RSSI_THOLD)); -} - - -void -ar6000_hbChallengeResp_event(AR_SOFTC_DEV_T *arPriv, A_UINT32 cookie, A_UINT32 source) -{ - AR_SOFTC_T *ar = arPriv->arSoftc; - if (source == APP_HB_CHALLENGE) { - /* Report it to the app in case it wants a positive acknowledgement */ - ar6000_send_event_to_app(arPriv, WMIX_HB_CHALLENGE_RESP_EVENTID, - (A_UINT8 *)&cookie, sizeof(cookie)); - } else { - /* This would ignore the replys that come in after their due time */ - if (cookie == ar->arHBChallengeResp.seqNum) { - ar->arHBChallengeResp.outstanding = FALSE; - } - } -} - - -void -ar6000_reportError_event(AR_SOFTC_DEV_T *arPriv, WMI_TARGET_ERROR_VAL errorVal) -{ - char *errString[] = { - [WMI_TARGET_PM_ERR_FAIL] "WMI_TARGET_PM_ERR_FAIL", - [WMI_TARGET_KEY_NOT_FOUND] "WMI_TARGET_KEY_NOT_FOUND", - [WMI_TARGET_DECRYPTION_ERR] "WMI_TARGET_DECRYPTION_ERR", - [WMI_TARGET_BMISS] "WMI_TARGET_BMISS", - [WMI_PSDISABLE_NODE_JOIN] "WMI_PSDISABLE_NODE_JOIN" - }; - - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR6000 Error on Target. Error = 0x%x\n", errorVal)); - - /* One error is reported at a time, and errorval is a bitmask */ - if(errorVal & (errorVal - 1)) - return; - - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR6000 Error type = ")); - switch(errorVal) - { - case WMI_TARGET_PM_ERR_FAIL: - case WMI_TARGET_KEY_NOT_FOUND: - case WMI_TARGET_DECRYPTION_ERR: - case WMI_TARGET_BMISS: - case WMI_PSDISABLE_NODE_JOIN: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s\n", errString[errorVal])); - break; - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("INVALID\n")); - break; - } - -} - - -void -ar6000_cac_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 ac, A_UINT8 cacIndication, - A_UINT8 statusCode, A_UINT8 *tspecSuggestion) -{ - WMM_TSPEC_IE *tspecIe; - - /* - * This is the TSPEC IE suggestion from AP. - * Suggestion provided by AP under some error - * cases, could be helpful for the host app. - * Check documentation. - */ - tspecIe = (WMM_TSPEC_IE *)tspecSuggestion; - - /* - * What do we do, if we get TSPEC rejection? One thought - * that comes to mind is implictly delete the pstream... - */ - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR6000 CAC notification. " - "AC = %d, cacIndication = 0x%x, statusCode = 0x%x\n", - ac, cacIndication, statusCode)); -} - -void -ar6000_channel_change_event(AR_SOFTC_DEV_T *arPriv, A_UINT16 oldChannel, - A_UINT16 newChannel) -{ - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Channel Change notification\nOld Channel: %d, New Channel: %d\n", - oldChannel, newChannel)); -} - -#define AR6000_PRINT_BSSID(_pBss) do { \ - A_PRINTF("%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x ",\ - (_pBss)[0],(_pBss)[1],(_pBss)[2],(_pBss)[3],\ - (_pBss)[4],(_pBss)[5]); \ -} while(0) - -void -ar6000_roam_tbl_event(AR_SOFTC_DEV_T *arPriv, WMI_TARGET_ROAM_TBL *pTbl) -{ - A_UINT8 i; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ROAM TABLE NO OF ENTRIES is %d ROAM MODE is %d\n", - pTbl->numEntries, pTbl->roamMode)); - for (i= 0; i < pTbl->numEntries; i++) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("[%d]bssid %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x ", i, - pTbl->bssRoamInfo[i].bssid[0], pTbl->bssRoamInfo[i].bssid[1], - pTbl->bssRoamInfo[i].bssid[2], - pTbl->bssRoamInfo[i].bssid[3], - pTbl->bssRoamInfo[i].bssid[4], - pTbl->bssRoamInfo[i].bssid[5])); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("RSSI %d RSSIDT %d LAST RSSI %d UTIL %d ROAM_UTIL %d" - " BIAS %d\n", - pTbl->bssRoamInfo[i].rssi, - pTbl->bssRoamInfo[i].rssidt, - pTbl->bssRoamInfo[i].last_rssi, - pTbl->bssRoamInfo[i].util, - pTbl->bssRoamInfo[i].roam_util, - pTbl->bssRoamInfo[i].bias)); - } -} - -void -ar6000_wow_list_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 num_filters, WMI_GET_WOW_LIST_REPLY *wow_reply) -{ - A_UINT8 i,j; - - /*Each event now contains exactly one filter, see bug 26613*/ - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("WOW pattern %d of %d patterns\n", wow_reply->this_filter_num, wow_reply->num_filters)); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("wow mode = %s host mode = %s\n", - (wow_reply->wow_mode == 0? "disabled":"enabled"), - (wow_reply->host_mode == 1 ? "awake":"asleep"))); - - - /*If there are no patterns, the reply will only contain generic - WoW information. Pattern information will exist only if there are - patterns present. Bug 26716*/ - - /* If this event contains pattern information, display it*/ - if (wow_reply->this_filter_num) { - i=0; - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("id=%d size=%d offset=%d\n", - wow_reply->wow_filters[i].wow_filter_id, - wow_reply->wow_filters[i].wow_filter_size, - wow_reply->wow_filters[i].wow_filter_offset)); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("wow pattern = ")); - for (j=0; j< wow_reply->wow_filters[i].wow_filter_size; j++) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%2.2x",wow_reply->wow_filters[i].wow_filter_pattern[j])); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("\nwow mask = ")); - for (j=0; j< wow_reply->wow_filters[i].wow_filter_size; j++) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%2.2x",wow_reply->wow_filters[i].wow_filter_mask[j])); - } - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("\n")); - } -} - -/* - * Report the Roaming related data collected on the target - */ -void -ar6000_display_roam_time(WMI_TARGET_ROAM_TIME *p) -{ - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Disconnect Data : BSSID: ")); - AR6000_PRINT_BSSID(p->disassoc_bssid); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" RSSI %d DISASSOC Time %d NO_TXRX_TIME %d\n", - p->disassoc_bss_rssi,p->disassoc_time, - p->no_txrx_time)); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Connect Data: BSSID: ")); - AR6000_PRINT_BSSID(p->assoc_bssid); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,(" RSSI %d ASSOC Time %d TXRX_TIME %d\n", - p->assoc_bss_rssi,p->assoc_time, - p->allow_txrx_time)); -} - -void -ar6000_roam_data_event(AR_SOFTC_DEV_T *arPriv, WMI_TARGET_ROAM_DATA *p) -{ - switch (p->roamDataType) { - case ROAM_DATA_TIME: - ar6000_display_roam_time(&p->u.roamTime); - break; - default: - break; - } -} - -void -ar6000_bssInfo_event_rx(AR_SOFTC_DEV_T *arPriv, A_UINT8 *datap, int len) -{ - struct sk_buff *skb; - WMI_BSS_INFO_HDR *bih = (WMI_BSS_INFO_HDR *)datap; - - - if (!arPriv->arSta.arMgmtFilter) { - return; - } - if (((arPriv->arSta.arMgmtFilter & IEEE80211_FILTER_TYPE_BEACON) && - (bih->frameType != BEACON_FTYPE)) || - ((arPriv->arSta.arMgmtFilter & IEEE80211_FILTER_TYPE_PROBE_RESP) && - (bih->frameType != PROBERESP_FTYPE))) - { - return; - } - - if ((skb = A_NETBUF_ALLOC_RAW(len)) != NULL) { - - A_NETBUF_PUT(skb, len); - A_MEMCPY(A_NETBUF_DATA(skb), datap, len); - skb->dev = arPriv->arNetDev; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) - A_MEMCPY(skb_mac_header(skb), A_NETBUF_DATA(skb), 6); -#else - skb->mac.raw = A_NETBUF_DATA(skb); -#endif - skb->ip_summed = CHECKSUM_NONE; - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = __constant_htons(0x0019); - A_NETIF_RX(skb); - } -} - -A_UINT32 wmiSendCmdNum; - -A_STATUS -ar6000_control_tx(void *devt, void *osbuf, HTC_ENDPOINT_ID eid) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)devt; - AR_SOFTC_T *ar = arPriv->arSoftc; - A_STATUS status = A_OK; - struct ar_cookie *cookie = NULL; - int i; - -#ifdef CONFIG_PM - if (ar->arWowState == WLAN_WOW_STATE_SUSPENDED) { - return A_EACCES; - } -#endif /* CONFIG_PM */ - /* take lock to protect ar6000_alloc_cookie() */ - AR6000_SPIN_LOCK(&ar->arLock, 0); - - do { - - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_TX,("ar_contrstatus = ol_tx: skb=0x%x, len=0x%x eid =%d\n", - (A_UINT32)osbuf, A_NETBUF_LEN(osbuf), eid)); - - if (ar->arWMIControlEpFull && (eid == ar->arControlEp)) { - /* control endpoint is full, don't allocate resources, we - * are just going to drop this packet */ - cookie = NULL; - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" WMI Control EP full, dropping packet : 0x%X, len:%d \n", - (A_UINT32)osbuf, A_NETBUF_LEN(osbuf))); -#ifdef ANDROID_ENV - if (++android_epfull_cnt > ANDROID_RELOAD_THRESHOLD_FOR_EP_FULL) { - android_send_reload_event(arPriv); - android_epfull_cnt = 0; - } -#endif - } else { - cookie = ar6000_alloc_cookie(ar); - } - - if (cookie == NULL) { - status = A_NO_MEMORY; - break; - } - - if(logWmiRawMsgs) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("WMI cmd send, msgNo %d :", wmiSendCmdNum)); - for(i = 0; i < a_netbuf_to_len(osbuf); i++) - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("%x ", ((A_UINT8 *)a_netbuf_to_data(osbuf))[i])); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("\n")); - } - - wmiSendCmdNum++; - - } while (FALSE); - - if (cookie != NULL) { - /* got a structure to send it out on */ - ar->arTxPending[eid]++; - - if (eid != ar->arControlEp) { - ar->arTotalTxDataPending++; - } - } - - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - - if (cookie != NULL) { - cookie->arc_bp[0] = (A_UINT32)osbuf; - cookie->arc_bp[1] = 0; - SET_HTC_PACKET_INFO_TX(&cookie->HtcPkt, - cookie, - A_NETBUF_DATA(osbuf), - A_NETBUF_LEN(osbuf), - eid, - AR6K_CONTROL_PKT_TAG); - /* this interface is asynchronous, if there is an error, cleanup will happen in the - * TX completion callback */ - HTCSendPkt(ar->arHtcTarget, &cookie->HtcPkt); - status = A_OK; - } - - return status; -} - -/* indicate tx activity or inactivity on a WMI stream */ -void ar6000_indicate_tx_activity(void *devt, A_UINT8 TrafficClass, A_BOOL Active) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)devt; - AR_SOFTC_T *ar = arPriv->arSoftc; - HTC_ENDPOINT_ID eid ; - int i; - - if (ar->arWmiReady) { - eid = arAc2EndpointID(ar, TrafficClass); - - AR6000_SPIN_LOCK(&ar->arLock, 0); - - ar->arAcStreamActive[TrafficClass] = Active; - - if (Active) { - /* when a stream goes active, keep track of the active stream with the highest priority */ - - if (ar->arAcStreamPriMap[TrafficClass] > ar->arHiAcStreamActivePri) { - /* set the new highest active priority */ - ar->arHiAcStreamActivePri = ar->arAcStreamPriMap[TrafficClass]; - } - - } else { - /* when a stream goes inactive, we may have to search for the next active stream - * that is the highest priority */ - - if (ar->arHiAcStreamActivePri == ar->arAcStreamPriMap[TrafficClass]) { - - /* the highest priority stream just went inactive */ - - /* reset and search for the "next" highest "active" priority stream */ - ar->arHiAcStreamActivePri = 0; - for (i = 0; i < WMM_NUM_AC; i++) { - if (ar->arAcStreamActive[i]) { - if (ar->arAcStreamPriMap[i] > ar->arHiAcStreamActivePri) { - /* set the new highest active priority */ - ar->arHiAcStreamActivePri = ar->arAcStreamPriMap[i]; - } - } - } - } - } - - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - - } else { - /* for mbox ping testing, the traffic class is mapped directly as a stream ID, - * see handling of AR6000_XIOCTL_TRAFFIC_ACTIVITY_CHANGE in ioctl.c - * convert the stream ID to a endpoint */ - eid = arAc2EndpointID(ar, TrafficClass); - } - - /* notify HTC, this may cause credit distribution changes */ - - HTCIndicateActivityChange(ar->arHtcTarget, - eid, - Active); - -} - -void -ar6000_btcoex_config_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 *ptr, A_UINT32 len) -{ - - WMI_BTCOEX_CONFIG_EVENT *pBtcoexConfig = (WMI_BTCOEX_CONFIG_EVENT *)ptr; - WMI_BTCOEX_CONFIG_EVENT *pArbtcoexConfig =&arPriv->arBtcoexConfig; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR6000 BTCOEX CONFIG EVENT \n")); - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("received config event\n")); - pArbtcoexConfig->btProfileType = pBtcoexConfig->btProfileType; - pArbtcoexConfig->linkId = pBtcoexConfig->linkId; - - switch (pBtcoexConfig->btProfileType) { - case WMI_BTCOEX_BT_PROFILE_SCO: - A_MEMCPY(&pArbtcoexConfig->info.scoConfigCmd, &pBtcoexConfig->info.scoConfigCmd, - sizeof(WMI_SET_BTCOEX_SCO_CONFIG_CMD)); - break; - case WMI_BTCOEX_BT_PROFILE_A2DP: - A_MEMCPY(&pArbtcoexConfig->info.a2dpConfigCmd, &pBtcoexConfig->info.a2dpConfigCmd, - sizeof(WMI_SET_BTCOEX_A2DP_CONFIG_CMD)); - break; - case WMI_BTCOEX_BT_PROFILE_ACLCOEX: - A_MEMCPY(&pArbtcoexConfig->info.aclcoexConfig, &pBtcoexConfig->info.aclcoexConfig, - sizeof(WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD)); - break; - case WMI_BTCOEX_BT_PROFILE_INQUIRY_PAGE: - A_MEMCPY(&pArbtcoexConfig->info.btinquiryPageConfigCmd, &pBtcoexConfig->info.btinquiryPageConfigCmd, - sizeof(WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD)); - break; - } - if (arPriv->statsUpdatePending) { - arPriv->statsUpdatePending = FALSE; - wake_up(&arPriv->arEvent); - } -} - -void -ar6000_btcoex_stats_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 *ptr, A_UINT32 len) -{ - WMI_BTCOEX_STATS_EVENT *pBtcoexStats = (WMI_BTCOEX_STATS_EVENT *)ptr; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR6000 BTCOEX CONFIG EVENT \n")); - - A_MEMCPY(&arPriv->arBtcoexStats, pBtcoexStats, sizeof(WMI_BTCOEX_STATS_EVENT)); - - if (arPriv->statsUpdatePending) { - arPriv->statsUpdatePending = FALSE; - wake_up(&arPriv->arEvent); - } - -} - -void -ar6000_wacinfo_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 *ptr, A_UINT32 len) -{ - WMI_GET_WAC_INFO *pWacInfo = (WMI_GET_WAC_INFO *)ptr; - - A_MEMCPY(&arPriv->wacInfo, pWacInfo, sizeof(WMI_GET_WAC_INFO)); - - if (arPriv->statsUpdatePending) { - arPriv->statsUpdatePending = FALSE; - wake_up(&arPriv->arEvent); - } -} - -#ifndef RK29 -module_init(ar6000_init_module); -module_exit(ar6000_cleanup_module); -#endif - -/* Init cookie queue */ -static void -ar6000_cookie_init(AR_SOFTC_T *ar) -{ - A_UINT32 i; - - ar->arCookieList = NULL; - ar->arCookieCount = 0; - - A_MEMZERO(s_ar_cookie_mem, sizeof(s_ar_cookie_mem)); - - for (i = 0; i < MAX_COOKIE_NUM; i++) { - ar6000_free_cookie(ar, &s_ar_cookie_mem[i]); - } -} - -/* cleanup cookie queue */ -static void -ar6000_cookie_cleanup(AR_SOFTC_T *ar) -{ - /* It is gone .... */ - ar->arCookieList = NULL; - ar->arCookieCount = 0; -} - -/* Init cookie queue */ -static void -ar6000_free_cookie(AR_SOFTC_T *ar, struct ar_cookie * cookie) -{ - /* Insert first */ - A_ASSERT(ar != NULL); - A_ASSERT(cookie != NULL); - - cookie->arc_list_next = ar->arCookieList; - ar->arCookieList = cookie; - ar->arCookieCount++; -} - -/* cleanup cookie queue */ -static struct ar_cookie * -ar6000_alloc_cookie(AR_SOFTC_T *ar) -{ - struct ar_cookie *cookie; - - cookie = ar->arCookieList; - if(cookie != NULL) - { - ar->arCookieList = cookie->arc_list_next; - ar->arCookieCount--; - } - - return cookie; -} - -#ifdef SEND_EVENT_TO_APP -/* - * This function is used to send event which come from taget to - * the application. The buf which send to application is include - * the event ID and event content. - */ -#define EVENT_ID_LEN 2 -void ar6000_send_event_to_app(AR_SOFTC_DEV_T *arPriv, A_UINT16 eventId, - A_UINT8 *datap, int len) -{ - -#if (WIRELESS_EXT >= 15) - -/* note: IWEVCUSTOM only exists in wireless extensions after version 15 */ - - char *buf; - A_UINT16 size; - union iwreq_data wrqu; - - size = len + EVENT_ID_LEN; - - if (size > IW_CUSTOM_MAX) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("WMI event ID : 0x%4.4X, len = %d too big for IWEVCUSTOM (max=%d) \n", - eventId, size, IW_CUSTOM_MAX)); - return; - } - - buf = A_MALLOC_NOWAIT(size); - if (NULL == buf){ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: failed to allocate %d bytes\n", __func__, size)); - return; - } - - A_MEMZERO(buf, size); - A_MEMCPY(buf, &eventId, EVENT_ID_LEN); - A_MEMCPY(buf+EVENT_ID_LEN, datap, len); - - //AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("event ID = %d,len = %d\n",*(A_UINT16*)buf, size)); - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = size; - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); - A_FREE(buf); - -#ifdef ANDROID_ENV - if (eventId == WMI_ERROR_REPORT_EVENTID) { - android_send_reload_event(arPriv); - } -#endif /* ANDROID_ENV */ - -#endif - - -} - -/* - * This function is used to send events larger than 256 bytes - * to the application. The buf which is sent to application - * includes the event ID and event content. - */ -void ar6000_send_generic_event_to_app(AR_SOFTC_DEV_T *arPriv, A_UINT16 eventId, - A_UINT8 *datap, int len) -{ - -#if (WIRELESS_EXT >= 18) - -/* IWEVGENIE exists in wireless extensions version 18 onwards */ - - char *buf; - A_UINT16 size; - union iwreq_data wrqu; - - size = len + EVENT_ID_LEN; - - if (size > IW_GENERIC_IE_MAX) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("WMI event ID : 0x%4.4X, len = %d too big for IWEVGENIE (max=%d) \n", - eventId, size, IW_GENERIC_IE_MAX)); - return; - } - - buf = A_MALLOC_NOWAIT(size); - if (NULL == buf){ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: failed to allocate %d bytes\n", __func__, size)); - return; - } - - A_MEMZERO(buf, size); - A_MEMCPY(buf, &eventId, EVENT_ID_LEN); - A_MEMCPY(buf+EVENT_ID_LEN, datap, len); - - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = size; - wireless_send_event(arPriv->arNetDev, IWEVGENIE, &wrqu, buf); - - A_FREE(buf); - -#endif /* (WIRELESS_EXT >= 18) */ - -} -#endif /* SEND_EVENT_TO_APP */ - - -void -ar6000_tx_retry_err_event(void *devt) -{ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Tx retries reach maximum!\n")); -} - -void -ar6000_snrThresholdEvent_rx(void *devt, WMI_SNR_THRESHOLD_VAL newThreshold, A_UINT8 snr) -{ - WMI_SNR_THRESHOLD_EVENT event; - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)devt; - - event.range = newThreshold; - event.snr = snr; - - ar6000_send_event_to_app(arPriv, WMI_SNR_THRESHOLD_EVENTID, (A_UINT8 *)&event, - sizeof(WMI_SNR_THRESHOLD_EVENT)); -} - -void -ar6000_lqThresholdEvent_rx(void *devt, WMI_LQ_THRESHOLD_VAL newThreshold, A_UINT8 lq) -{ - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("lq threshold range %d, lq %d\n", newThreshold, lq)); -} - - - -A_UINT32 -a_copy_to_user(void *to, const void *from, A_UINT32 n) -{ - return(copy_to_user(to, from, n)); -} - -A_UINT32 -a_copy_from_user(void *to, const void *from, A_UINT32 n) -{ - return(copy_from_user(to, from, n)); -} - - -A_STATUS -ar6000_get_driver_cfg(struct net_device *dev, - A_UINT16 cfgParam, - void *result) -{ - A_STATUS ret = A_OK; - - switch(cfgParam) - { - case AR6000_DRIVER_CFG_GET_WLANNODECACHING: - *((A_UINT32 *)result) = wlanNodeCaching; - break; - case AR6000_DRIVER_CFG_LOG_RAW_WMI_MSGS: - *((A_UINT32 *)result) = logWmiRawMsgs; - break; - default: - ret = A_EINVAL; - break; - } - - return ret; -} - -void -ar6000_keepalive_rx(void *devt, A_UINT8 configured) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)devt; - - arPriv->arSta.arKeepaliveConfigured = configured; - wake_up(&arPriv->arEvent); -} - -void -ar6000_pmkid_list_event(void *devt, A_UINT8 numPMKID, WMI_PMKID *pmkidList, - A_UINT8 *bssidList) -{ - A_UINT8 i, j; - - A_PRINTF("Number of Cached PMKIDs is %d\n", numPMKID); - - for (i = 0; i < numPMKID; i++) { - A_PRINTF("\nBSSID %d ", i); - for (j = 0; j < ATH_MAC_LEN; j++) { - A_PRINTF("%2.2x", bssidList[j]); - } - bssidList += (ATH_MAC_LEN + WMI_PMKID_LEN); - A_PRINTF("\nPMKID %d ", i); - for (j = 0; j < WMI_PMKID_LEN; j++) { - A_PRINTF("%2.2x", pmkidList->pmkid[j]); - } - pmkidList = (WMI_PMKID *)((A_UINT8 *)pmkidList + ATH_MAC_LEN + - WMI_PMKID_LEN); - } -} - -void ar6000_pspoll_event(AR_SOFTC_DEV_T *arPriv,A_UINT8 aid) -{ - conn_t *conn=NULL; - A_BOOL isPsqEmpty = FALSE; - - conn = ieee80211_find_conn_for_aid(arPriv, aid); - - if(!conn) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("PS-POLL from invalid STA\n")); - return; - } - - /* If the PS q for this STA is not empty, dequeue and send a pkt from - * the head of the q. Also update the More data bit in the WMI_DATA_HDR - * if there are more pkts for this STA in the PS q. If there are no more - * pkts for this STA, update the PVB for this STA. - */ - A_MUTEX_LOCK(&conn->psqLock); - isPsqEmpty = A_NETBUF_QUEUE_EMPTY(&conn->psq); - A_MUTEX_UNLOCK(&conn->psqLock); - - if (isPsqEmpty) { - /* TODO:No buffered pkts for this STA. Send out a NULL data frame */ - } else { - struct sk_buff *skb = NULL; - - A_MUTEX_LOCK(&conn->psqLock); - skb = A_NETBUF_DEQUEUE(&conn->psq); - A_MUTEX_UNLOCK(&conn->psqLock); - /* Set the STA flag to PSPolled, so that the frame will go out */ - STA_SET_PS_POLLED(conn); - ar6000_data_tx(skb, arPriv->arNetDev); - STA_CLR_PS_POLLED(conn); - - A_MUTEX_LOCK(&conn->psqLock); - isPsqEmpty = A_NETBUF_QUEUE_EMPTY(&conn->psq); - A_MUTEX_UNLOCK(&conn->psqLock); - - } - - /* Clear the PVB for this STA if the queue has become empty */ - if (isPsqEmpty) { - wmi_set_pvb_cmd(arPriv->arWmi, conn->aid, 0); - } -} - -void ar6000_dtimexpiry_event(AR_SOFTC_DEV_T *arPriv) -{ - A_BOOL isMcastQueued = FALSE; - struct sk_buff *skb = NULL; - AR_SOFTC_AP_T *arAp = &arPriv->arAp; - - /* If there are no associated STAs, ignore the DTIM expiry event. - * There can be potential race conditions where the last associated - * STA may disconnect & before the host could clear the 'Indicate DTIM' - * request to the firmware, the firmware would have just indicated a DTIM - * expiry event. The race is between 'clear DTIM expiry cmd' going - * from the host to the firmware & the DTIM expiry event happening from - * the firmware to the host. - */ - if (arAp->sta_list_index == 0) { - return; - } - - A_MUTEX_LOCK(&arAp->mcastpsqLock); - isMcastQueued = A_NETBUF_QUEUE_EMPTY(&arAp->mcastpsq); - A_MUTEX_UNLOCK(&arAp->mcastpsqLock); - - if(isMcastQueued == TRUE) { - return; - } - - /* Flush the mcast psq to the target */ - /* Set the STA flag to DTIMExpired, so that the frame will go out */ - arAp->DTIMExpired = TRUE; - - A_MUTEX_LOCK(&arAp->mcastpsqLock); - while (!A_NETBUF_QUEUE_EMPTY(&arAp->mcastpsq)) { - skb = A_NETBUF_DEQUEUE(&arAp->mcastpsq); - A_MUTEX_UNLOCK(&arAp->mcastpsqLock); - - ar6000_data_tx(skb, arPriv->arNetDev); - - A_MUTEX_LOCK(&arAp->mcastpsqLock); - } - A_MUTEX_UNLOCK(&arAp->mcastpsqLock); - - /* Reset the DTIMExpired flag back to 0 */ - arAp->DTIMExpired = FALSE; - - /* Clear the LSB of the BitMapCtl field of the TIM IE */ - wmi_set_pvb_cmd(arPriv->arWmi, MCAST_AID, 0); -} - -static void ar6000_uapsd_trigger_frame_rx(AR_SOFTC_DEV_T *arPriv, conn_t *conn) -{ - A_BOOL isApsdqEmpty; - A_BOOL isApsdqEmptyAtStart; - A_UINT32 numFramesToDeliver; - - /* If the APSD q for this STA is not empty, dequeue and send a pkt from - * the head of the q. Also update the More data bit in the WMI_DATA_HDR - * if there are more pkts for this STA in the APSD q. If there are no more - * pkts for this STA, update the APSD bitmap for this STA. - */ - - numFramesToDeliver = (conn->apsd_info >> 4) & 0xF; - - /* Number of frames to send in a service period is indicated by the station - * in the QOS_INFO of the association request - * If it is zero, send all frames - */ - if (!numFramesToDeliver) { - numFramesToDeliver = 0xFFFF; - } - - A_MUTEX_LOCK(&conn->psqLock); - isApsdqEmpty = A_NETBUF_QUEUE_EMPTY(&conn->apsdq); - A_MUTEX_UNLOCK(&conn->psqLock); - isApsdqEmptyAtStart = isApsdqEmpty; - - while ((!isApsdqEmpty) && (numFramesToDeliver)) { - struct sk_buff *skb = NULL; - - A_MUTEX_LOCK(&conn->psqLock); - skb = A_NETBUF_DEQUEUE(&conn->apsdq); - isApsdqEmpty = A_NETBUF_QUEUE_EMPTY(&conn->apsdq); - A_MUTEX_UNLOCK(&conn->psqLock); - - /* Set the STA flag to Trigger delivery, so that the frame will go out */ - STA_SET_APSD_TRIGGER(conn); - numFramesToDeliver--; - - /* Last frame in the service period, set EOSP or queue empty */ - if ((isApsdqEmpty) || (!numFramesToDeliver)) { - STA_SET_APSD_EOSP(conn); - } - ar6000_data_tx(skb, arPriv->arNetDev); - STA_CLR_APSD_TRIGGER(conn); - STA_CLR_APSD_EOSP(conn); - } - - if (isApsdqEmpty) { - if (isApsdqEmptyAtStart) { - wmi_set_apsd_buffered_traffic_cmd(arPriv->arWmi, conn->aid, 0, - WMI_AP_APSD_NO_DELIVERY_FRAMES_FOR_THIS_TRIGGER); - } else { - wmi_set_apsd_buffered_traffic_cmd(arPriv->arWmi, conn->aid, 0, 0); - } - } - - return; -} - -void -read_rssi_compensation_param(AR_SOFTC_T *ar) -{ - A_UINT8 *cust_data_ptr; - USER_RSSI_CPENSATION *rssi_compensation_param; -//#define RSSICOMPENSATION_PRINT -#ifdef RSSICOMPENSATION_PRINT - A_INT16 i; - cust_data_ptr = ar6000_get_cust_data_buffer(ar->arTargetType); - for (i=0; i<16; i++) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("cust_data_%d = %x \n", i, *(A_UINT8 *)cust_data_ptr)); - cust_data_ptr += 1; - } -#endif - rssi_compensation_param = &ar->rssi_compensation_param; - cust_data_ptr = ar6000_get_cust_data_buffer(ar->arTargetType); - - rssi_compensation_param->customerID = *(A_UINT16 *)cust_data_ptr & 0xffff; - rssi_compensation_param->enable = *(A_UINT16 *)(cust_data_ptr+2) & 0xffff; - rssi_compensation_param->bg_param_a = *(A_UINT16 *)(cust_data_ptr+4) & 0xffff; - rssi_compensation_param->bg_param_b = *(A_UINT16 *)(cust_data_ptr+6) & 0xffff; - rssi_compensation_param->a_param_a = *(A_UINT16 *)(cust_data_ptr+8) & 0xffff; - rssi_compensation_param->a_param_b = *(A_UINT16 *)(cust_data_ptr+10) &0xffff; - rssi_compensation_param->reserved = *(A_UINT32 *)(cust_data_ptr+12); - -#ifdef RSSICOMPENSATION_PRINT - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("customerID = 0x%x \n", rssi_compensation_param->customerID)); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("enable = 0x%x \n", rssi_compensation_param->enable)); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("bg_param_a = 0x%x and %d \n", rssi_compensation_param->bg_param_a, rssi_compensation_param->bg_param_a)); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("bg_param_b = 0x%x and %d \n", rssi_compensation_param->bg_param_b, rssi_compensation_param->bg_param_b)); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("a_param_a = 0x%x and %d \n", rssi_compensation_param->a_param_a, rssi_compensation_param->a_param_a)); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("a_param_b = 0x%x and %d \n", rssi_compensation_param->a_param_b, rssi_compensation_param->a_param_b)); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Last 4 bytes = 0x%x \n", rssi_compensation_param->reserved)); -#endif - - if (rssi_compensation_param->enable != 0x1) { - rssi_compensation_param->enable = 0; - } - - return; -} - -A_INT32 -rssi_compensation_calc_tcmd(AR_SOFTC_T *ar, A_UINT32 freq, A_INT32 rssi, A_UINT32 totalPkt) -{ - USER_RSSI_CPENSATION *rssi_compensation_param; - - rssi_compensation_param = &ar->rssi_compensation_param; - - if (freq > 5000) - { - if (rssi_compensation_param->enable) - { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, (">>> 11a\n")); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("rssi before compensation = %d, totalPkt = %d\n", rssi,totalPkt)); - rssi = rssi * rssi_compensation_param->a_param_a + totalPkt * rssi_compensation_param->a_param_b; - rssi = (rssi-50) /100; - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("rssi after compensation = %d\n", rssi)); - } - } - else - { - if (rssi_compensation_param->enable) - { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, (">>> 11bg\n")); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("rssi before compensation = %d, totalPkt = %d\n", rssi,totalPkt)); - rssi = rssi * rssi_compensation_param->bg_param_a + totalPkt * rssi_compensation_param->bg_param_b; - rssi = (rssi-50) /100; - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("rssi after compensation = %d\n", rssi)); - } - } - - return rssi; -} - -A_INT16 -rssi_compensation_calc(AR_SOFTC_DEV_T *arPriv, A_INT16 rssi) -{ - USER_RSSI_CPENSATION *rssi_compensation_param; - AR_SOFTC_T *ar = arPriv->arSoftc; - - rssi_compensation_param = &ar->rssi_compensation_param; - - if (arPriv->arBssChannel > 5000) - { - if (rssi_compensation_param->enable) - { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, (">>> 11a\n")); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("rssi before compensation = %d\n", rssi)); - rssi = rssi * rssi_compensation_param->a_param_a + rssi_compensation_param->a_param_b; - rssi = (rssi-50) /100; - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("rssi after compensation = %d\n", rssi)); - } - } - else - { - if (rssi_compensation_param->enable) - { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, (">>> 11bg\n")); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("rssi before compensation = %d\n", rssi)); - rssi = rssi * rssi_compensation_param->bg_param_a + rssi_compensation_param->bg_param_b; - rssi = (rssi-50) /100; - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("rssi after compensation = %d\n", rssi)); - } - } - - return rssi; -} - -A_INT16 -rssi_compensation_reverse_calc(AR_SOFTC_DEV_T *arPriv, A_INT16 rssi, A_BOOL Above) -{ - A_INT16 i; - - USER_RSSI_CPENSATION *rssi_compensation_param; - AR_SOFTC_T *ar = arPriv->arSoftc; - - rssi_compensation_param = &ar->rssi_compensation_param; - - if (arPriv->arBssChannel > 5000) - { - if (rssi_compensation_param->enable) - { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, (">>> 11a\n")); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("rssi before rev compensation = %d\n", rssi)); - rssi = rssi * 100; - rssi = (rssi - rssi_compensation_param->a_param_b) / rssi_compensation_param->a_param_a; - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("rssi after rev compensation = %d\n", rssi)); - } - } - else - { - if (rssi_compensation_param->enable) - { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, (">>> 11bg\n")); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("rssi before rev compensation = %d\n", rssi)); - - if (Above) { - for (i=95; i>=0; i--) { - if (rssi <= rssi_compensation_table[arPriv->arDeviceIndex][i]) { - rssi = 0 - i; - break; - } - } - } else { - for (i=0; i<=95; i++) { - if (rssi >= rssi_compensation_table[arPriv->arDeviceIndex][i]) { - rssi = 0 - i; - break; - } - } - } - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("rssi after rev compensation = %d\n", rssi)); - } - } - - return rssi; -} - -#ifdef WAPI_ENABLE -void ap_wapi_rekey_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 type, A_UINT8 *mac) -{ - union iwreq_data wrqu; - A_CHAR buf[20]; - - A_MEMZERO(buf, sizeof(buf)); - - strcpy(buf, "WAPI_REKEY"); - buf[10] = type; - A_MEMCPY(&buf[11], mac, ATH_MAC_LEN); - - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = 10+1+ATH_MAC_LEN; - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("WAPI REKEY - %d - %02x:%02x\n", type, mac[4], mac[5])); -} -#endif - -#ifdef P2P -void *get_p2p_ctx(AR_SOFTC_DEV_T *arPriv) -{ - return (arPriv->p2p_ctx); -} - -void *get_wmi_ctx(AR_SOFTC_DEV_T *arPriv) -{ - return (arPriv->arWmi); -} - -NETWORK_SUBTYPE get_network_subtype(AR_SOFTC_DEV_T *arPriv) -{ - return (arPriv->arNetworkSubType); -} - -#endif /* P2P */ - -#ifdef USER_KEYS -static A_STATUS - -ar6000_reinstall_keys(AR_SOFTC_DEV_T *arPriv, A_UINT8 key_op_ctrl) -{ - A_STATUS status = A_OK; - struct ieee80211req_key *uik = &arPriv->arSta.user_saved_keys.ucast_ik; - struct ieee80211req_key *bik = &arPriv->arSta.user_saved_keys.bcast_ik; - CRYPTO_TYPE keyType = arPriv->arSta.user_saved_keys.keyType; - - if (IEEE80211_CIPHER_CCKM_KRK != uik->ik_type) { - if (NONE_CRYPT == keyType) { - goto _reinstall_keys_out; - } - - if (uik->ik_keylen) { - status = wmi_addKey_cmd(arPriv->arWmi, uik->ik_keyix, - keyType, PAIRWISE_USAGE, - uik->ik_keylen, (A_UINT8 *)&uik->ik_keyrsc, - uik->ik_keydata, key_op_ctrl, uik->ik_macaddr, SYNC_BEFORE_WMIFLAG); - } - - } else { - status = wmi_add_krk_cmd(arPriv->arWmi, uik->ik_keydata); - } - - if (IEEE80211_CIPHER_CCKM_KRK != bik->ik_type) { - if (NONE_CRYPT == keyType) { - goto _reinstall_keys_out; - } - - if (bik->ik_keylen) { - status = wmi_addKey_cmd(arPriv->arWmi, bik->ik_keyix, - keyType, GROUP_USAGE, - bik->ik_keylen, (A_UINT8 *)&bik->ik_keyrsc, - bik->ik_keydata, key_op_ctrl, bik->ik_macaddr, NO_SYNC_WMIFLAG); - } - } else { - status = wmi_add_krk_cmd(arPriv->arWmi, bik->ik_keydata); - } - -_reinstall_keys_out: - arPriv->arSta.user_savedkeys_stat = USER_SAVEDKEYS_STAT_INIT; - arPriv->arSta.user_key_ctrl = 0; - - return status; -} -#endif /* USER_KEYS */ - - -void -ar6000_dset_open_req( - void *context, - A_UINT32 id, - A_UINT32 targHandle, - A_UINT32 targReplyFn, - A_UINT32 targReplyArg) -{ -} - -void -ar6000_dset_close( - void *context, - A_UINT32 access_cookie) -{ - return; -} - -void -ar6000_dset_data_req( - void *context, - A_UINT32 accessCookie, - A_UINT32 offset, - A_UINT32 length, - A_UINT32 targBuf, - A_UINT32 targReplyFn, - A_UINT32 targReplyArg) -{ -} -void -ar6000_init_mode_info(AR_SOFTC_DEV_T *arPriv) -{ - AR_SOFTC_T *ar = arPriv->arSoftc; - - arPriv->arDot11AuthMode = OPEN_AUTH; - arPriv->arAuthMode = WMI_NONE_AUTH; - arPriv->arPairwiseCrypto = NONE_CRYPT; - arPriv->arPairwiseCryptoLen = 0; - arPriv->arGroupCrypto = NONE_CRYPT; - arPriv->arGroupCryptoLen = 0; - arPriv->arChannelHint = 0; - arPriv->arDefTxKeyIndex = 0; - A_MEMZERO(arPriv->arBssid, sizeof(arPriv->arBssid)); - A_MEMZERO(arPriv->arSsid, sizeof(arPriv->arSsid)); - A_MEMZERO(arPriv->arWepKeyList, sizeof(arPriv->arWepKeyList)); - arPriv->arSsidLen = 0; - arPriv->arTxPwr = 0; - arPriv->arTxPwrSet = FALSE; - arPriv->arBitRate = -1; - arPriv->arMaxRetries = 0; - arPriv->arWmmEnabled = TRUE; - arPriv->ap_profile_flag = 0; - arPriv->num_sta = 0xFF; - ar->gNumSta = AP_MAX_NUM_STA; - - if(arPriv->arNextMode == AP_NETWORK) { - AR_SOFTC_AP_T *arAp; - if(arPriv->arNetworkType != AP_NETWORK) { - A_MEMZERO(&arPriv->arSta,sizeof(AR_SOFTC_STA_T)); - } - arAp = &arPriv->arAp; - arAp->intra_bss = 1; - ar->inter_bss = 1; - - /* init the Mutexes */ - A_NETBUF_QUEUE_INIT(&arAp->mcastpsq); - A_MUTEX_INIT(&arAp->mcastpsqLock); - A_MEMCPY(arAp->ap_country_code, DEF_AP_COUNTRY_CODE, 3); - if (arPriv->arPhyCapability == WMI_11NAG_CAPABILITY){ - arPriv->phymode = DEF_AP_WMODE_AG; - } else { - arPriv->phymode = DEF_AP_WMODE_G; - } - arAp->ap_dtim_period = DEF_AP_DTIM; - arAp->ap_beacon_interval = DEF_BEACON_INTERVAL; - A_INIT_TIMER(&arPriv->ap_acs_timer,ap_acs_handler, arPriv); - A_INIT_TIMER(&ar->ap_reconnect_timer,ap_reconnect_timer_handler, ar); - } else { - /*Station Mode intialisation*/ - AR_SOFTC_STA_T *arSta; - if(arPriv->arNetworkType == AP_NETWORK) { - A_MEMZERO(&arPriv->arAp,sizeof(AR_SOFTC_AP_T)); - } - arSta = &arPriv->arSta; - arSta->arListenIntervalT = A_DEFAULT_LISTEN_INTERVAL; - arSta->arListenIntervalB = 0; - arSta->arBmissTimeT = A_DEFAULT_BMISS_TIME; - arSta->arBmissTimeB = 0; - arSta->arRssi = 0; - arSta->arSkipScan = 0; - arSta->arBeaconInterval = 0; - arSta->scan_triggered = 0; - A_MEMZERO(&arSta->scParams, sizeof(arSta->scParams)); - arSta->scParams.shortScanRatio = WMI_SHORTSCANRATIO_DEFAULT; - arSta->scParams.scanCtrlFlags = DEFAULT_SCAN_CTRL_FLAGS; - A_MEMZERO(arSta->arReqBssid, sizeof(arSta->arReqBssid)); - if (!arSta->disconnect_timer_inited) { - A_INIT_TIMER(&arSta->disconnect_timer, disconnect_timer_handler, arPriv->arNetDev); - arSta->disconnect_timer_inited = 1; - } - else - { - A_UNTIMEOUT(&arSta->disconnect_timer); - } - } -} - -int -ar6000_ap_set_num_sta(AR_SOFTC_T *ar, AR_SOFTC_DEV_T *arPriv, A_UINT8 num_sta) -{ - int ret = A_OK; - A_UINT8 i, total_num_sta; - AR_SOFTC_DEV_T *tpriv = NULL; - - if(num_sta & 0x80) { - total_num_sta = (num_sta & (~0x80)); - for(i=0; inum_sta = 0xFF; - } - } else { - total_num_sta = num_sta; - arPriv->num_sta = num_sta; - ar->gNumSta = 0xFF; - for(i=0; inum_sta !=0xFF) && - (tpriv->arNetworkType == AP_NETWORK)) { - total_num_sta += tpriv->num_sta; - } - } - } - - if(total_num_sta > AP_MAX_NUM_STA) { - ret = -EINVAL; - } else { - if(num_sta & 0x80) { - ar->gNumSta = (num_sta & (~0x80)); - } else { - arPriv->num_sta = num_sta; - } - wmi_ap_set_num_sta(arPriv->arWmi, num_sta); - } - - return ret; -} - -int -check_channel(AR_SOFTC_DEV_T *arPriv) -{ - A_UINT8 i; - AR_SOFTC_DEV_T *temp_priv = NULL; - - for(i=0; iarNextMode == AP_NETWORK) && temp_priv->arConnected) { - if(!(temp_priv->arBssChannel || temp_priv->arChannelHint)) { - /* ACS inprogress */ - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AP%d: ACS in progress\n",temp_priv->arDeviceIndex)); - A_TIMEOUT_MS(&arPriv->ap_acs_timer, 1000, 0); - return 0; - } - } - } - - for(i=0; iarConnected) { - /* User has set the channel for this interface */ - if(arPriv->arChannelHint) { - if(temp_priv->arBssChannel != arPriv->arChannelHint) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Error: Channel should be %d MHz\n", temp_priv->arBssChannel)); - return 0; - } - } else { - /* ACS is enabled for this interface */ - if(temp_priv->arBssChannel) { - arPriv->arChannelHint = temp_priv->arBssChannel; - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Selected Channel %d\n", temp_priv->arBssChannel)); - return 1; - } - } - } - } - return 1; -} - -static void ap_acs_handler(unsigned long ptr) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ptr; - A_UNTIMEOUT(&arPriv->ap_acs_timer); - - if(check_channel(arPriv)) { - ar6000_ap_mode_profile_commit(arPriv); - } else { - A_TIMEOUT_MS(&arPriv->ap_acs_timer, 1000, 0); - } -} - -int -ar6000_ap_mode_profile_commit(AR_SOFTC_DEV_T *arPriv) -{ - AR_SOFTC_T *ar = arPriv->arSoftc; - WMI_CONNECT_CMD p; - unsigned long flags; - - /* No change in AP's profile configuration */ - if(arPriv->ap_profile_flag==0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("COMMIT: No change in profile!!!\n")); - return -ENODATA; - } - - if(!check_channel(arPriv)) { - return -EOPNOTSUPP; - } - - if(!arPriv->arSsidLen) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("SSID not set!!!\n")); - return -ECHRNG; - } - - switch(arPriv->arAuthMode) { - case WMI_NONE_AUTH: - if((arPriv->arPairwiseCrypto != NONE_CRYPT) && -#ifdef WAPI_ENABLE - (arPriv->arPairwiseCrypto != WAPI_CRYPT) && -#endif - (arPriv->arPairwiseCrypto != WEP_CRYPT)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Cipher not supported in AP mode Open auth\n")); - return -EOPNOTSUPP; - } - break; - case WMI_WPA_PSK_AUTH: - case WMI_WPA2_PSK_AUTH: - case (WMI_WPA_PSK_AUTH|WMI_WPA2_PSK_AUTH): - break; - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("This key mgmt type not supported in AP mode\n")); - return -EOPNOTSUPP; - } - - if ((arPriv->arAuthMode == WMI_NONE_AUTH) && - (arPriv->arPairwiseCrypto == WEP_CRYPT)) - { - ar6000_install_static_wep_keys(arPriv); - } - - /* Update the arNetworkType */ - arPriv->arNetworkType = arPriv->arNextMode; - arPriv->arBssChannel = 0; - - A_MEMZERO(&p,sizeof(p)); - p.ssidLength = arPriv->arSsidLen; - A_MEMCPY(p.ssid,arPriv->arSsid,p.ssidLength); - - /* - * p.channel == 0 [Do ACS and choose 1, 6, or 11] - * p.channel == 1 [Do ACS and choose 1, or 6] - * p.channel == xxxx [No ACS, use xxxx freq] - */ - if (((arPriv->phymode != WMI_11AG_MODE) && (arPriv->phymode != WMI_11A_MODE)) && (arPriv->arChannelHint >=5180 && arPriv->arChannelHint<= 5825)) { - arPriv->arChannelHint = 0; - } - if ((arPriv->arChannelHint == 0) && (ar->arAcsDisableHiChannel)) { - p.channel = 1; - } else { - p.channel = arPriv->arChannelHint; - if ((arPriv->arChannelHint >=5180) && (arPriv->arChannelHint<= 5825)) { - if (! (wmi_set_channelParams_cmd(arPriv->arWmi, 0, WMI_11A_MODE, 0, NULL))){ - arPriv->phymode= WMI_11A_MODE; - } - } else if ((arPriv->phymode == WMI_11A_MODE) || (arPriv->phymode == WMI_11AG_MODE)){ - if (! (wmi_set_channelParams_cmd(arPriv->arWmi, 0, WMI_11G_MODE, 0, NULL))){ - arPriv->phymode= WMI_11G_MODE; - } - } - } - - p.networkType = arPriv->arNetworkType; - p.dot11AuthMode = arPriv->arDot11AuthMode; - p.authMode = arPriv->arAuthMode; - p.pairwiseCryptoType = arPriv->arPairwiseCrypto; - p.pairwiseCryptoLen = arPriv->arPairwiseCryptoLen; - p.groupCryptoType = arPriv->arGroupCrypto; - p.groupCryptoLen = arPriv->arGroupCryptoLen; - p.ctrl_flags = arPriv->arSta.arConnectCtrlFlags; - -#if WLAN_CONFIG_NO_DISASSOC_UPON_DEAUTH - p.ctrl_flags |= AP_NO_DISASSOC_UPON_DEAUTH; -#endif - wmi_ap_profile_commit(arPriv->arWmi, &p); - spin_lock_irqsave(&arPriv->arPrivLock, flags); - arPriv->arConnected = TRUE; - netif_carrier_on(arPriv->arNetDev); - spin_unlock_irqrestore(&arPriv->arPrivLock, flags); - arPriv->ap_profile_flag = 0; - - return 0; -} - -A_STATUS -ar6000_connect_to_ap(AR_SOFTC_DEV_T *arPriv) -{ - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - - /* The ssid length check prevents second "essid off" from the user, - to be treated as a connect cmd. The second "essid off" is ignored. - */ - if((ar->arWmiReady == TRUE) && (arPriv->arSsidLen > 0) && arPriv->arNetworkType!=AP_NETWORK) - { - A_STATUS status; - if((ADHOC_NETWORK != arPriv->arNetworkType) && - (WMI_NONE_AUTH==arPriv->arAuthMode) && - (WEP_CRYPT==arPriv->arPairwiseCrypto)) { - ar6000_install_static_wep_keys(arPriv); - } - - if (!arSta->arUserBssFilter) { - if (wmi_bssfilter_cmd(arPriv->arWmi, ALL_BSS_FILTER, 0) != A_OK) { - return -EIO; - } - } - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("Connect called with authmode %d dot11 auth %d"\ - " PW crypto %d PW crypto Len %d GRP crypto %d"\ - " GRP crypto Len %d\n", - arPriv->arAuthMode, arPriv->arDot11AuthMode, - arPriv->arPairwiseCrypto, arPriv->arPairwiseCryptoLen, - arPriv->arGroupCrypto, arPriv->arGroupCryptoLen)); - reconnect_flag = 0; - /* Set the listen interval into 1000TUs or more. This value will be indicated to Ap in the conn. - later set it back locally at the STA to 100/1000 TUs depending on the power mode */ - if ((arPriv->arNetworkType == INFRA_NETWORK)) { - wmi_listeninterval_cmd(arPriv->arWmi, max(arSta->arListenIntervalT, (A_UINT16)A_MAX_WOW_LISTEN_INTERVAL), 0); - } - status = wmi_connect_cmd(arPriv->arWmi, arPriv->arNetworkType, - arPriv->arDot11AuthMode, arPriv->arAuthMode, - arPriv->arPairwiseCrypto, arPriv->arPairwiseCryptoLen, - arPriv->arGroupCrypto,arPriv->arGroupCryptoLen, - arPriv->arSsidLen, arPriv->arSsid, - arSta->arReqBssid, arPriv->arChannelHint, - arSta->arConnectCtrlFlags); - if (status != A_OK) { - wmi_listeninterval_cmd(arPriv->arWmi, arSta->arListenIntervalT, arSta->arListenIntervalB); - if (!arSta->arUserBssFilter) { - wmi_bssfilter_cmd(arPriv->arWmi, NONE_BSS_FILTER, 0); - } - return status; - } - - if ((!(arSta->arConnectCtrlFlags & CONNECT_DO_WPA_OFFLOAD)) && - ((WMI_WPA_PSK_AUTH == arPriv->arAuthMode) || (WMI_WPA2_PSK_AUTH == arPriv->arAuthMode))) - { - A_TIMEOUT_MS(&arSta->disconnect_timer, A_DISCONNECT_TIMER_INTERVAL, 0); - } - - arSta->arConnectCtrlFlags &= ~CONNECT_DO_WPA_OFFLOAD; - - arSta->arConnectPending = TRUE; - return status; - } - return A_ERROR; -} - -A_STATUS -ar6000_disconnect(AR_SOFTC_DEV_T *arPriv) -{ - if ((arPriv->arConnected == TRUE) || (arPriv->arSta.arConnectPending == TRUE)) { - wmi_disconnect_cmd(arPriv->arWmi); -#ifdef P2P - if(arPriv->arNetworkSubType == SUBTYPE_P2PCLIENT) { - wait_event_interruptible_timeout(arPriv->arEvent, arPriv->arConnected == FALSE, wmitimeout * HZ); - - if (signal_pending(current)) { - return -EINTR; - } - } -#endif - /* - * Disconnect cmd is issued, clear connectPending. - * arConnected will be cleard in disconnect_event notification. - */ - arPriv->arSta.arConnectPending = FALSE; - } - - return A_OK; -} - -A_STATUS -ar6000_ap_mode_get_wpa_ie(AR_SOFTC_DEV_T *arPriv, struct ieee80211req_wpaie *wpaie) -{ - conn_t *conn = NULL; - conn = ieee80211_find_conn(arPriv, wpaie->wpa_macaddr); - - A_MEMZERO(wpaie->wpa_ie, IEEE80211_MAX_IE); - A_MEMZERO(wpaie->rsn_ie, IEEE80211_MAX_IE); - - if(conn) { - A_MEMCPY(wpaie->wpa_ie, conn->wpa_ie, IEEE80211_MAX_IE); - } - - return 0; -} - -A_STATUS -is_iwioctl_allowed(A_UINT8 mode, A_UINT16 cmd) -{ - if(cmd >= SIOCSIWCOMMIT && cmd <= SIOCGIWPOWER) { - cmd -= SIOCSIWCOMMIT; - if(sioctl_filter[cmd] == 0xFF) return A_OK; - if(sioctl_filter[cmd] & mode) return A_OK; - } else if(cmd >= SIOCIWFIRSTPRIV && cmd <= (SIOCIWFIRSTPRIV+30)) { - cmd -= SIOCIWFIRSTPRIV; - if(pioctl_filter[cmd] == 0xFF) return A_OK; - if(pioctl_filter[cmd] & mode) return A_OK; - } else { - return A_ERROR; - } - return A_ENOTSUP; -} - -A_STATUS -is_xioctl_allowed(A_UINT8 mode, A_UINT8 submode, int cmd) -{ - A_UINT8 mode_bits, submode_bits; - A_BOOL is_valid_mode=FALSE, is_valid_submode=FALSE; - - if(sizeof(xioctl_filter)-1 < cmd) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Filter for this cmd=%d not defined\n",cmd)); - return A_OK; - } - - /* Valid for all modes/submodes */ - if(xioctl_filter[cmd] == 0xFF) return A_OK; - - /* Check if this cmd is valid for the set mode of this device. - */ -#define XIOCTL_FILTER_MODE_MASK 0x1F -#define XIOCTL_FILTER_MODE_BIT_OFFSET 0x0 - mode_bits = xioctl_filter[cmd] & XIOCTL_FILTER_MODE_MASK; - - if (mode_bits & (mode << XIOCTL_FILTER_MODE_BIT_OFFSET)) { - /* Valid cmd for this mode */ - is_valid_mode = TRUE; - } - - /* Check if this cmd is valid for the set submode of this device. - */ -#define XIOCTL_FILTER_SUBMODE_MASK 0xE0 -#define XIOCTL_FILTER_SUBMODE_BIT_OFFSET 0x0 - submode_bits = (xioctl_filter[cmd] & XIOCTL_FILTER_SUBMODE_MASK)>>XIOCTL_FILTER_SUBMODE_BIT_OFFSET; - - if (submode == SUBTYPE_P2PDEV || submode == SUBTYPE_P2PCLIENT || - submode == SUBTYPE_P2PGO) { - /* P2P Submode */ - if (submode_bits & XIOCTL_FILTER_P2P_SUBMODE) { - is_valid_submode = TRUE; - } - } else { - /* Non P2P Sub mode */ - if ((submode_bits & XIOCTL_FILTER_NONP2P_SUBMODE)) { - is_valid_submode = TRUE; - } - } - - if (is_valid_mode && is_valid_submode) { - return A_OK; - } - - return A_ERROR; -} - -#ifdef WAPI_ENABLE -int -ap_set_wapi_key(AR_SOFTC_DEV_T *arPriv, void *ikey) -{ - struct ieee80211req_key *ik = (struct ieee80211req_key *)ikey; - KEY_USAGE keyUsage = 0; - A_STATUS status; - - if (A_MEMCMP(ik->ik_macaddr, bcast_mac, IEEE80211_ADDR_LEN) == 0) { - keyUsage = GROUP_USAGE; - } else { - keyUsage = PAIRWISE_USAGE; - } - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("WAPI_KEY: Type:%d ix:%d mac:%02x:%02x len:%d\n", - keyUsage, ik->ik_keyix, ik->ik_macaddr[4], ik->ik_macaddr[5], - ik->ik_keylen)); - - status = wmi_addKey_cmd(arPriv->arWmi, ik->ik_keyix, WAPI_CRYPT, keyUsage, - ik->ik_keylen, (A_UINT8 *)&ik->ik_keyrsc, - ik->ik_keydata, KEY_OP_INIT_VAL, ik->ik_macaddr, - SYNC_BOTH_WMIFLAG); - - if (A_OK != status) { - return -EIO; - } - return 0; -} -#endif - -#ifdef P2P - -void ar6000_p2p_prov_disc_req_event(AR_SOFTC_DEV_T *arPriv, - const A_UINT8 *peer, A_UINT16 wps_config_method, - const A_UINT8 *dev_addr, const A_UINT8 *pri_dev_type, - const A_UINT8 *dev_name, A_UINT8 dev_name_len, - A_UINT16 supp_config_methods, A_UINT8 dev_capab, A_UINT8 group_capab) -{ - union iwreq_data wrqu; - A_UINT8 buf[100]; - A_UINT8 *pos=buf; - - A_MEMZERO(pos, sizeof(buf)); - A_MEMCPY(pos, "P2PPROVDISCREQ", 14); - pos += 14; - - A_MEMCPY(pos, peer, IEEE80211_ADDR_LEN); - pos += IEEE80211_ADDR_LEN; - - A_MEMCPY(pos, dev_addr, IEEE80211_ADDR_LEN); - pos += IEEE80211_ADDR_LEN; - - A_MEMCPY(pos, pri_dev_type, 8); - pos += 8; - - A_MEMCPY(pos, dev_name, dev_name_len); - pos += dev_name_len; - *pos++ = '\0'; - - A_MEMCPY(pos, (A_UINT8 *)&supp_config_methods, 2); - pos += 2; - - A_MEMCPY(pos, (A_UINT8 *)&wps_config_method, 2); - pos += 2; - - A_MEMCPY(pos, &dev_capab, 1); - pos++; - - A_MEMCPY(pos, &group_capab, 1); - pos++; - - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = (pos-buf); - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); -} - -void ar6000_p2p_prov_disc_resp_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 *peer, - A_UINT16 config_methods) -{ - union iwreq_data wrqu; - A_UINT8 buf[100]; - A_UINT8 *pos=buf; - - A_MEMZERO(pos, sizeof(buf)); - A_MEMCPY(pos, "P2PPROVDISCRESP", 15); - pos += 15; - - A_MEMCPY(pos, peer, IEEE80211_ADDR_LEN); - pos += IEEE80211_ADDR_LEN; - - A_MEMCPY(pos, (A_UINT8 *)&config_methods, 2); - pos += 2; - - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = (pos-buf); - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); -} - -void ar6000_p2pdev_event(AR_SOFTC_DEV_T *arPriv, const A_UINT8 *addr, - const A_UINT8 *dev_addr, - const A_UINT8 *pri_dev_type, const A_UINT8 *dev_name, - A_UINT8 dev_name_len, A_UINT16 config_methods, A_UINT8 dev_capab, - A_UINT8 grp_capab) -{ - union iwreq_data wrqu; - A_UINT8 buf[100]; - A_UINT8 *pos=buf; - - A_MEMZERO(pos, sizeof(buf)); - A_MEMCPY(pos, "P2PDEVFOUND", 11); - pos += 11; - - A_MEMCPY(pos, addr, IEEE80211_ADDR_LEN); - pos += IEEE80211_ADDR_LEN; - - A_MEMCPY(pos, dev_addr, IEEE80211_ADDR_LEN); - pos += IEEE80211_ADDR_LEN; - - /* Size of P2P Attributes hardcoded here. Can this be changed ? - */ - A_MEMCPY(pos, pri_dev_type, 8); - pos += 8; - - A_MEMCPY(pos, dev_name, dev_name_len); - pos += dev_name_len; - *pos++ = '\0'; - - A_MEMCPY(pos, (A_UINT8 *)&config_methods, 2); - pos += 2; - - A_MEMCPY(pos, &dev_capab, 1); - pos++; - - A_MEMCPY(pos, &grp_capab, 1); - pos++; - - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = (pos-buf); - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); - - return; -} - -void ar6000_p2p_sd_rx_event(AR_SOFTC_DEV_T *arPriv, WMI_P2P_SDPD_RX_EVENT *ev) -{ - union iwreq_data wrqu; - A_UINT8 *event_ptr; - A_UINT8 *pos; - A_UINT16 size; - -#define P2P_SD_REQ_RESP_STR_LEN 12 - size = P2P_SD_REQ_RESP_STR_LEN - + sizeof(WMI_P2P_SDPD_RX_EVENT) - + ev->tlv_length; - event_ptr = A_MALLOC_NOWAIT(size); - pos = event_ptr; - A_MEMZERO(pos, size); - A_MEMCPY(pos, "P2PSDREQRESP", P2P_SD_REQ_RESP_STR_LEN); - pos += P2P_SD_REQ_RESP_STR_LEN; -#undef P2P_SD_REQ_RESP_STR_LEN - - /* Copy the event followed by TLV, parsing will be dobe in supplicant */ - A_MEMCPY(pos, ev, sizeof(WMI_P2P_SDPD_RX_EVENT) + ev->tlv_length); - - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = size; - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, event_ptr); - - A_FREE(event_ptr); - return; -} - -void p2p_go_neg_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 *res, A_UINT8 len) -{ - union iwreq_data wrqu; - A_UINT8 buf[100]; - - A_MEMZERO(&buf, sizeof(buf)); - A_MEMCPY(buf, "P2PNEGCOMPLETE",14); - A_MEMCPY(&buf[14], res, len); - - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = 14+len; - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); -} - -void p2p_go_neg_req_event(AR_SOFTC_DEV_T *arPriv, const A_UINT8 *sa, A_UINT16 dev_passwd_id) -{ - union iwreq_data wrqu; - A_UINT8 buf[100]; - A_UINT8 *pos=buf; - - A_MEMZERO(pos, sizeof(buf)); - A_MEMCPY(pos, "P2PNEGREQEV", 11); - pos += 11; - - A_MEMCPY(pos, sa, IEEE80211_ADDR_LEN); - pos += IEEE80211_ADDR_LEN; - - A_MEMCPY(pos, (A_UINT8 *)&dev_passwd_id, 2); - pos += 2; - - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = (pos-buf); - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); -} - - -void p2p_invite_sent_result_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 *res, - A_UINT8 len) -{ - union iwreq_data wrqu; - A_UINT8 buf[100]; - - A_MEMZERO(&buf, sizeof(buf)); - A_MEMCPY(buf, "P2PINVITESENTRESULT", 19); - A_MEMCPY(&buf[19], res, len); - - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = 19 + len; - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); -} - -void p2p_invite_rcvd_result_event(AR_SOFTC_DEV_T *arPriv, - A_UINT8 *res, A_UINT8 len) -{ - union iwreq_data wrqu; - A_UINT8 buf[100]; - - A_MEMZERO(&buf, sizeof(buf)); - A_MEMCPY(buf, "P2PINVITERCVDRESULT", 19); - A_MEMCPY(&buf[19], res, len); - - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = 19 + len; - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); -} - -#endif /* P2P */ - -void ar6000_peer_event( - void *context, - A_UINT8 eventCode, - A_UINT8 *macAddr) -{ - A_UINT8 pos; - - for (pos=0;pos<6;pos++) - printk("%02x: ",*(macAddr+pos)); - printk("\n"); -} - -void ar6000_get_device_addr(AR_SOFTC_DEV_T *arPriv, A_UINT8 *addr) -{ - A_MEMCPY(addr, arPriv->arNetDev->dev_addr, IEEE80211_ADDR_LEN); - return; -} - -#ifdef HTC_TEST_SEND_PKTS -#define HTC_TEST_DUPLICATE 8 -static void DoHTCSendPktsTest(AR_SOFTC_T *ar, int MapNo, HTC_ENDPOINT_ID eid, struct sk_buff *dupskb) -{ - struct ar_cookie *cookie; - struct ar_cookie *cookieArray[HTC_TEST_DUPLICATE]; - struct sk_buff *new_skb; - int i; - int pkts = 0; - HTC_PACKET_QUEUE pktQueue; - EPPING_HEADER *eppingHdr; - - eppingHdr = A_NETBUF_DATA(dupskb); - - if (eppingHdr->Cmd_h == EPPING_CMD_NO_ECHO) { - /* skip test if this is already a tx perf test */ - return; - } - - for (i = 0; i < HTC_TEST_DUPLICATE; i++,pkts++) { - AR6000_SPIN_LOCK(&ar->arLock, 0); - cookie = ar6000_alloc_cookie(ar); - if (cookie != NULL) { - ar->arTxPending[eid]++; - ar->arTotalTxDataPending++; - } - - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - - if (NULL == cookie) { - break; - } - - new_skb = A_NETBUF_ALLOC(A_NETBUF_LEN(dupskb)); - - if (new_skb == NULL) { - AR6000_SPIN_LOCK(&ar->arLock, 0); - ar6000_free_cookie(ar,cookie); - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - break; - } - - A_NETBUF_PUT_DATA(new_skb, A_NETBUF_DATA(dupskb), A_NETBUF_LEN(dupskb)); - cookie->arc_bp[0] = (A_UINT32)new_skb; - cookie->arc_bp[1] = MapNo; - SET_HTC_PACKET_INFO_TX(&cookie->HtcPkt, - cookie, - A_NETBUF_DATA(new_skb), - A_NETBUF_LEN(new_skb), - eid, - AR6K_DATA_PKT_TAG); - - cookieArray[i] = cookie; - - { - EPPING_HEADER *pHdr = (EPPING_HEADER *)A_NETBUF_DATA(new_skb); - pHdr->Cmd_h = EPPING_CMD_NO_ECHO; /* do not echo the packet */ - } - } - - if (pkts == 0) { - return; - } - - INIT_HTC_PACKET_QUEUE(&pktQueue); - - for (i = 0; i < pkts; i++) { - HTC_PACKET_ENQUEUE(&pktQueue,&cookieArray[i]->HtcPkt); - } - - HTCSendPktsMultiple(ar->arHtcTarget, &pktQueue); - -} - -#endif - -#ifdef RK29 - -#include - -static struct wifi_platform_data *wifi_control_data = NULL; -struct semaphore wifi_control_sem; - -int wifi_set_carddetect(int on) -{ - if (wifi_control_data && wifi_control_data->set_carddetect) { - wifi_control_data->set_carddetect(on); - } - return 0; -} - -int wifi_set_power(int on, unsigned long msec) -{ - if (wifi_control_data && wifi_control_data->set_power) { - wifi_control_data->set_power(on); - } - if (msec) - mdelay(msec); - return 0; -} - -int wifi_set_reset(int on, unsigned long msec) -{ - if (wifi_control_data && wifi_control_data->set_reset) { - wifi_control_data->set_reset(on); - } - if (msec) - mdelay(msec); - return 0; -} - -static int wifi_probe(struct platform_device *pdev) -{ - struct wifi_platform_data *wifi_ctrl = - (struct wifi_platform_data *)(pdev->dev.platform_data); - - wifi_control_data = wifi_ctrl; - - /* make sure power-off */ - wifi_set_reset(0, 5); - wifi_set_power(0, 5); - - wifi_set_power(1, 50); /* Power On */ - wifi_set_reset(1, 150); /* Reset */ - wifi_set_carddetect(1); /* CardDetect (0->1) */ - - up(&wifi_control_sem); - return 0; -} - -static int wifi_remove(struct platform_device *pdev) -{ - struct wifi_platform_data *wifi_ctrl = - (struct wifi_platform_data *)(pdev->dev.platform_data); - - wifi_control_data = wifi_ctrl; - - wifi_set_reset(0, 5); /* Reset */ - wifi_set_power(0, 5); /* Power Off */ - wifi_set_carddetect(0); /* CardDetect (1->0) */ - - up(&wifi_control_sem); - return 0; -} - -static int wifi_suspend(struct platform_device *pdev, pm_message_t state) -{ - return 0; -} -static int wifi_resume(struct platform_device *pdev) -{ - return 0; -} - -static struct platform_driver wifi_device = { - .probe = wifi_probe, - .remove = wifi_remove, - .suspend = wifi_suspend, - .resume = wifi_resume, - .driver = { - .name = "bcm4329_wlan", - } -}; - -int wifi_add_dev(void) -{ - return platform_driver_register(&wifi_device); -} - -void wifi_del_dev(void) -{ - platform_driver_unregister(&wifi_device); -} - -static inline int _down_timeout(struct semaphore *sem, long jiffies) { - int i = 0, ret = 0; - static const int quantum_ms = 1000 / HZ; - - ret = down_trylock(sem); - for (i = jiffies; (i > 0 && ret != 0); i -= quantum_ms) { - schedule_timeout_interruptible(1); - ret = down_trylock(sem); - } - - return ret; -} - -int rockchip_wifi_init_module(void) -{ - int error; -#if 0//def TCHIP - extern char softmac_path[]; - char filename[256]; - extern int android_readwrite_file(const A_CHAR *filename, A_CHAR *rbuf, const A_CHAR *wbuf, size_t length); - - sprintf(filename, "%s/%s", softmac_path, "tcmd"); - if (android_readwrite_file(filename, NULL, NULL, 0) < 0) { - printk("%s :: normal mode\n", __func__); - testmode = 0; - } else { - printk("%s :: test mode\n", __func__); - testmode = 1; - } -#endif - printk("ar6003 diver rkversion: [v1.10]\n"); - - sema_init(&wifi_control_sem, 0); - error = wifi_add_dev(); - if (error) { - printk("%s: platform_driver_register failed\n", __FUNCTION__); - return -1; - } - - /* Waiting callback after platform_driver_register is done or exit with error */ - if (_down_timeout(&wifi_control_sem, msecs_to_jiffies(5000)) != 0) { - error = -EINVAL; - printk("%s: platform_driver_register timeout\n", __FUNCTION__); - wifi_del_dev(); - return -1; - } - - ifname[0] = 0; - devmode[0] = 0; - printk("ifname = %s, devmode = %s.\n", ifname, devmode); - - ar6000_init_module(); - ar6000_pm_init(); - - return 0; -} -#include "wifi_launcher/wlan_param.h" -int rockchip_wifi_init_module_param(wlan_param *param) -{ - int error; -#if 0//def TCHIP - extern char softmac_path[]; - char filename[256]; - extern int android_readwrite_file(const A_CHAR *filename, A_CHAR *rbuf, const A_CHAR *wbuf, size_t length); - - sprintf(filename, "%s/%s", softmac_path, "tcmd"); - if (android_readwrite_file(filename, NULL, NULL, 0) < 0) { - printk("%s :: normal mode\n", __func__); - testmode = 0; - } else { - printk("%s :: test mode\n", __func__); - testmode = 1; - } -#endif - - sema_init(&wifi_control_sem, 0); - error = wifi_add_dev(); - if (error) { - printk("%s: platform_driver_register failed\n", __FUNCTION__); - return -1; - } - - /* Waiting callback after platform_driver_register is done or exit with error */ - if (_down_timeout(&wifi_control_sem, msecs_to_jiffies(5000)) != 0) { - error = -EINVAL; - printk("%s: platform_driver_register timeout\n", __FUNCTION__); - wifi_del_dev(); - return -1; - } - - strcpy(ifname, param->ifname); - strcpy(devmode, param->devmode); - - printk("ifname = %s, devmode = %s.\n", ifname, devmode); - - ar6000_init_module(); - ar6000_pm_init(); - - return 0; -} -void rockchip_wifi_exit_module(void) -{ - ar6000_cleanup_module(); - ar6000_pm_exit(); - wifi_del_dev(); -} -EXPORT_SYMBOL(rockchip_wifi_init_module); -EXPORT_SYMBOL(rockchip_wifi_init_module_param); -EXPORT_SYMBOL(rockchip_wifi_exit_module); -//module_init(rockchip_wifi_init_module); -//module_exit(rockchip_wifi_exit_module); -#endif - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -EXPORT_SYMBOL(setupbtdev); -#endif diff --git a/drivers/net/wireless/ar6003/host/os/linux/ar6000_pm.c b/drivers/net/wireless/ar6003/host/os/linux/ar6000_pm.c deleted file mode 100644 index 9aecfe9bd5db..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/ar6000_pm.c +++ /dev/null @@ -1,1115 +0,0 @@ -// -// -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// -// -// - -/* - * Implementation of system power management - */ - -#include "ar6000_drv.h" -#include - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) -#include -#endif -#include "wlan_config.h" - -#ifdef CONFIG_HAS_WAKELOCK -#include -#endif - -#define WOW_ENABLE_MAX_INTERVAL 1 -#define WOW_SET_SCAN_PARAMS 1 - -extern unsigned int wmitimeout; -extern unsigned int num_device; - -#ifdef CONFIG_PM - -#if PLAT_WOW_GPIO_PIN || PLAT_WLAN_CHIP_PWD_PIN -#include -#endif - -#if PLAT_WOW_GPIO_PIN -static int wow_irq; -#endif /* PLAT_WOW_GPIO_PIN */ - -#ifdef CONFIG_HAS_WAKELOCK -struct wake_lock ar6k_suspend_wake_lock; -struct wake_lock ar6k_wow_wake_lock; -#endif -#endif /* CONFIG_PM */ - -#ifdef ANDROID_ENV -extern void android_ar6k_check_wow_status(AR_SOFTC_T *ar, struct sk_buff *skb, A_BOOL isEvent); -#endif -#undef ATH_MODULE_NAME -#define ATH_MODULE_NAME pm -#define ATH_DEBUG_PM ATH_DEBUG_MAKE_MODULE_MASK(0) - -#ifdef DEBUG -static ATH_DEBUG_MASK_DESCRIPTION pm_debug_desc[] = { - { ATH_DEBUG_PM , "System power management"}, -}; - -ATH_DEBUG_INSTANTIATE_MODULE_VAR(pm, - "pm", - "System Power Management", - ATH_DEBUG_MASK_DEFAULTS | ATH_DEBUG_PM, - ATH_DEBUG_DESCRIPTION_COUNT(pm_debug_desc), - pm_debug_desc); - -#endif /* DEBUG */ - -A_STATUS ar6000_exit_cut_power_state(AR_SOFTC_T *ar); - -#ifdef CONFIG_PM -static void ar6k_send_asleep_event_to_app(AR_SOFTC_DEV_T *arPriv, A_BOOL asleep) -{ - char buf[128]; - union iwreq_data wrqu; - - snprintf(buf, sizeof(buf), "HOST_ASLEEP=%s", asleep ? "asleep" : "awake"); - A_MEMZERO(&wrqu, sizeof(wrqu)); - wrqu.data.length = strlen(buf); - wireless_send_event(arPriv->arNetDev, IWEVCUSTOM, &wrqu, buf); -} - -static void ar6000_wow_resume(AR_SOFTC_T *ar) -{ - HIF_DEVICE_POWER_CHANGE_TYPE config; - AR_SOFTC_DEV_T *arPriv; - AR_SOFTC_STA_T *arSta; - A_UINT8 i; - - if (ar->arWowState!= WLAN_WOW_STATE_NONE) { - config = HIF_DEVICE_POWER_UP; - HIFConfigureDevice(ar->arHifDevice, - HIF_DEVICE_POWER_STATE_CHANGE, - &config, - sizeof(HIF_DEVICE_POWER_CHANGE_TYPE)); - } - - for(i = 0; i < num_device; i++) { - arPriv = ar->arDev[i]; - arSta = &arPriv->arSta; - - /* - * Free all wlan_nodes (scanned APs that we detected previously) - * because during the time we were suspended, the device may have - * been moved to a new location and these APs scanned for before - * suspend may not be valid - */ - wmi_free_allnodes(arPriv->arWmi); - - if (ar->arWowState!= WLAN_WOW_STATE_NONE) { - A_UINT16 fg_start_period = (arSta->scParams.fg_start_period==0) ? 1 : arSta->scParams.fg_start_period; - A_UINT16 bg_period = (arSta->scParams.bg_period==0) ? 60 : arSta->scParams.bg_period; - WMI_SET_HOST_SLEEP_MODE_CMD hostSleepMode = {TRUE, FALSE}; - ar->arWowState = WLAN_WOW_STATE_NONE; -#ifdef CONFIG_HAS_WAKELOCK - wake_lock_timeout(&ar6k_wow_wake_lock, 3*HZ); -#endif - if (wmi_set_host_sleep_mode_cmd(arPriv->arWmi, &hostSleepMode)!=A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to setup restore host awake\n")); - } - - if (arPriv->arNetworkType!=AP_NETWORK) { -#if WOW_SET_SCAN_PARAMS - wmi_scanparams_cmd(arPriv->arWmi, fg_start_period, - arSta->scParams.fg_end_period, - bg_period, - arSta->scParams.minact_chdwell_time, - arSta->scParams.maxact_chdwell_time, - arSta->scParams.pas_chdwell_time, - arSta->scParams.shortScanRatio, - arSta->scParams.scanCtrlFlags, - arSta->scParams.max_dfsch_act_time, - arSta->scParams.maxact_scan_per_ssid); -#else - (void)fg_start_period; - (void)bg_period; -#endif - - -#if WOW_ENABLE_MAX_INTERVAL /* we don't do it if the power consumption is already good enough. */ - if (wmi_listeninterval_cmd(arPriv->arWmi, arSta->arListenIntervalT, arSta->arListenIntervalB) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to restore WoW listen interval %d\n", arSta->arListenIntervalT)); - } else { - if (wmi_bmisstime_cmd(arPriv->arWmi, arSta->arBmissTimeT, arSta->arBmissTimeB) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to restore WoW bmiss %d\n", arSta->arBmissTimeT)); - } - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("WoW does not invoked. skip resume")); - } -#endif - } - ar6k_send_asleep_event_to_app(arPriv, FALSE); - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("Resume WoW successfully\n")); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("WoW does not invoked. skip resume")); - } - } - - ar->arWlanPowerState = WLAN_POWER_STATE_ON; -} - -static void ar6000_wow_suspend(AR_SOFTC_T *ar) -{ - struct net_device *ndev; - AR_SOFTC_DEV_T *arPriv; - AR_SOFTC_STA_T *arSta; - A_INT32 i, j; - A_STATUS status; -#define WOW_LIST_ID 1 - /* Setup WoW for unicast & Arp request for our own IP - * disable background scan. Set listen interval into 1000 TUs - * Enable keepliave for 110 seconds - */ - struct in_ifaddr **ifap = NULL; - struct in_ifaddr *ifa = NULL; - HIF_DEVICE_POWER_CHANGE_TYPE config; - struct in_device *in_dev; - WMI_ADD_WOW_PATTERN_CMD addWowCmd = { .filter = { 0 } }; - WMI_DEL_WOW_PATTERN_CMD delWowCmd; - WMI_SET_HOST_SLEEP_MODE_CMD hostSleepMode = {FALSE, TRUE}; - WMI_SET_WOW_MODE_CMD wowMode = { .enable_wow = TRUE, - .hostReqDelay = 500 };/*500 ms delay*/ - - if (ar->arWowState!= WLAN_WOW_STATE_NONE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("System already go into wow mode!\n")); - return; - } - - ar6000_TxDataCleanup(ar); /* IMPORTANT, otherwise there will be 11mA after listen interval as 1000*/ - - for(j = 0; j< num_device; j++) - { - arPriv = ar->arDev[j]; - arSta = &arPriv->arSta; - ndev = arPriv->arNetDev; - /* clear up our WoW pattern first */ - for (i=0; iarWmi, &delWowCmd); - } - - if (arPriv->arNetworkType == AP_NETWORK) { - /* setup all unicast IP packet pattern for WoW */ -#if WLAN_CONFIG_SIMPLE_WOW_AP_MODE - /* IP packets except boradcast */ - A_UINT8 allData[] = { 0x08 }; /* Either IP 0x0800, ARP 0x0806 or EAPOL-like 0x8800 */ - A_UINT8 allMask[] = { 0x7f }; - A_MEMZERO(&addWowCmd, sizeof(addWowCmd)); - addWowCmd.filter_list_id = WOW_LIST_ID; - addWowCmd.filter_size = sizeof(allMask); - addWowCmd.filter_offset = 20; - status = wmi_add_wow_pattern_cmd(ar->arWmi, &addWowCmd, allData, allMask, addWowCmd.filter_size); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to add WoW simple pattern for AP mode\n")); - } -#else - /* Unicast IP, EAPOL-like and ARP packets */ - A_UINT8 unicastData[] = { - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x08, }; - A_UINT8 unicastMask[] = { - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f }; - A_UINT8 discoverData[] = { 0xe0, 0x00, 0x00, 0xf8 }; - A_UINT8 discoverMask[] = { 0xf0, 0x00, 0x00, 0xf8 }; - A_UINT8 arpData[] = { 0x08, 0x06 }; - A_UINT8 arpMask[] = { 0xff, 0xff }; - A_UINT8 dhcpData[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x08, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x43 /* port 67 */ - }; - A_UINT8 dhcpMask[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff /* port 67 */ - }; - A_MEMZERO(&addWowCmd, sizeof(addWowCmd)); - addWowCmd.filter_list_id = WOW_LIST_ID; - addWowCmd.filter_size = sizeof(unicastMask); - addWowCmd.filter_offset = 0; - status = wmi_add_wow_pattern_cmd(arPriv->arWmi, &addWowCmd, unicastData, unicastMask, addWowCmd.filter_size); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to add WoW unicast IP pattern for AP mode\n")); - } - /* setup all ARP packet pattern for WoW */ - A_MEMZERO(&addWowCmd, sizeof(addWowCmd)); - addWowCmd.filter_list_id = WOW_LIST_ID; - addWowCmd.filter_size = sizeof(arpMask); - addWowCmd.filter_offset = 20; - status = wmi_add_wow_pattern_cmd(arPriv->arWmi, &addWowCmd, arpData, arpMask, addWowCmd.filter_size); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to add WoW ARP pattern for AP mode\n")); - } - /* Setup multicast pattern for mDNS 224.0.0.251, SSDP 239.255.255.250 and LLMNR 224.0.0.252*/ - A_MEMZERO(&addWowCmd, sizeof(addWowCmd)); - addWowCmd.filter_list_id = WOW_LIST_ID; - addWowCmd.filter_size = sizeof(discoverMask); - addWowCmd.filter_offset = 38; - status = wmi_add_wow_pattern_cmd(arPriv->arWmi, &addWowCmd, discoverData, discoverMask, addWowCmd.filter_size); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to add mDNS/SSDP/LLMNR pattern for AP mode WoW\n")); - } - /* setup all DHCP broadcast packet pattern for WoW */ - A_MEMZERO(&addWowCmd, sizeof(addWowCmd)); - addWowCmd.filter_list_id = WOW_LIST_ID; - addWowCmd.filter_size = sizeof(dhcpMask); - addWowCmd.filter_offset = 0; - status = wmi_add_wow_pattern_cmd(arPriv->arWmi, &addWowCmd, dhcpData, dhcpMask, addWowCmd.filter_size); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to add WoW DHCP broadcast pattern for AP mode\n")); - } -#endif /* WLAN_CONFIG_SIMPLE_WOW_AP_MODE */ - } else { - /* station mode */ - A_UINT8 macMask[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - A_UINT16 wow_listen_interval = A_MAX_WOW_LISTEN_INTERVAL; -#if WOW_ENABLE_MAX_INTERVAL /* we don't do it if the power consumption is already good enough. */ - if (wmi_listeninterval_cmd(arPriv->arWmi, wow_listen_interval, 0) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to setup WoW listen interval %d\n", wow_listen_interval)); - } else { - /* - * The default bmiss is 1500ms when listen interval is 100ms - * We set listen interval x 15 times as bmiss time here - */ - A_UINT16 bmissTime = wow_listen_interval*15; - if (bmissTime > MAX_BMISS_TIME) { - bmissTime = MAX_BMISS_TIME; - } - if (wmi_bmisstime_cmd(arPriv->arWmi, bmissTime, 0) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to setup WoW bmiss %d\n", bmissTime)); - } - } -#else - (void)wow_listen_interval; -#endif - -#if WOW_SET_SCAN_PARAMS - status = wmi_scanparams_cmd(arPriv->arWmi, 0xFFFF, 0, 0xFFFF, 0, 0, 0, 0, 0, 0, 0); -#endif - /* setup unicast packet pattern for WoW */ - if (ndev->dev_addr[1]) { - A_MEMZERO(&addWowCmd, sizeof(addWowCmd)); - addWowCmd.filter_list_id = WOW_LIST_ID; - addWowCmd.filter_size = 6; /* MAC address */ - addWowCmd.filter_offset = 0; - status = wmi_add_wow_pattern_cmd(arPriv->arWmi, &addWowCmd, ndev->dev_addr, macMask, addWowCmd.filter_size); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to add WoW pattern\n")); - } - } - - /* Setup multicast pattern for mDNS 224.0.0.251, SSDP 239.255.255.250 and LLMNR 224.0.0.252*/ - if ( ndev->flags & IFF_ALLMULTI || -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) - (ndev->flags & IFF_MULTICAST && ndev->mc_count>0) ) -#else - (ndev->flags & IFF_MULTICAST && netdev_mc_count(ndev)>0) ) -#endif - { - A_UINT8 discoverData[] = { 0xe0, 0x00, 0x00, 0xf8 }; - A_UINT8 discoverMask[] = { 0xf0, 0x00, 0x00, 0xf8 }; - A_MEMZERO(&addWowCmd, sizeof(addWowCmd)); - addWowCmd.filter_list_id = WOW_LIST_ID; - addWowCmd.filter_size = sizeof(discoverMask); - addWowCmd.filter_offset = 38; - status = wmi_add_wow_pattern_cmd(arPriv->arWmi, &addWowCmd, discoverData, discoverMask, addWowCmd.filter_size); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to add mDNS/SSDP/LLMNR pattern for WoW\n")); - } - } - - ar6k_send_asleep_event_to_app(arPriv, TRUE); - } - - ar->arWowState = WLAN_WOW_STATE_SUSPENDING; - - /* setup ARP request for our own IP */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) - if ((in_dev = __in_dev_get_rtnl(ndev)) != NULL) { - for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL; ifap = &ifa->ifa_next) { - if (!strcmp(ndev->name, ifa->ifa_label)) { - break; /* found */ - } - } - } -#endif - - if (ifa && ifa->ifa_local) { - WMI_SET_IP_CMD ipCmd; - memset(&ipCmd, 0, sizeof(ipCmd)); - ipCmd.ips[0] = ifa->ifa_local; - status = wmi_set_ip_cmd(arPriv->arWmi, &ipCmd); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to setup IP for ARP agent\n")); - } - } - -#ifndef ATH6K_CONFIG_OTA_MODE - wmi_powermode_cmd(arPriv->arWmi, REC_POWER); -#endif - - status = wmi_set_wow_mode_cmd(arPriv->arWmi, &wowMode); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to enable wow mode\n")); - } - - status = wmi_set_host_sleep_mode_cmd(arPriv->arWmi, &hostSleepMode); - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to set host asleep\n")); - } - - if (ar->arTxPending[ar->arControlEp]) { - A_UINT32 timeleft = wait_event_interruptible_timeout(arPriv->arEvent, - ar->arTxPending[ar->arControlEp] == 0, wmitimeout * HZ); - if (!timeleft || signal_pending(current)) { - /* what can I do? wow resume at once */ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to setup WoW. Pending wmi control data %d\n", ar->arTxPending[ar->arControlEp])); - } - } - } - - status = hifWaitForPendingRecv(ar->arHifDevice); - - config = HIF_DEVICE_POWER_DOWN; - status = HIFConfigureDevice(ar->arHifDevice, - HIF_DEVICE_POWER_STATE_CHANGE, - &config, - sizeof(HIF_DEVICE_POWER_CHANGE_TYPE)); - - ar->arWowState = WLAN_WOW_STATE_SUSPENDED; - ar->arWlanPowerState = WLAN_POWER_STATE_WOW; - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("Setup WoW successfully\n")); -} - -A_STATUS ar6000_suspend_ev(void *context) -{ - A_STATUS status = A_OK; - AR_SOFTC_T *ar = (AR_SOFTC_T *)context; - A_INT16 pmmode = ar->arSuspendConfig; - A_INT32 i; - A_BOOL needWow = FALSE; -wow_not_connected: - switch (pmmode) { - case WLAN_SUSPEND_WOW: - for(i = 0; i< num_device; i++) { - if (ar->arDev[i]->arConnected) { - needWow = TRUE; - break; - } - } - if (ar->arWmiReady && ar->arWlanState==WLAN_ENABLED && needWow) { - ar6000_wow_suspend(ar); - status = A_EBUSY; - AR_DEBUG_PRINTF(ATH_DEBUG_PM,("%s:Suspend for wow mode %d\n", __func__, ar->arWlanPowerState)); - } else { - pmmode = ar->arWow2Config; - goto wow_not_connected; - } - break; - case WLAN_SUSPEND_CUT_PWR: - /* fall through */ - case WLAN_SUSPEND_CUT_PWR_IF_BT_OFF: - /* fall through */ - case WLAN_SUSPEND_DEEP_SLEEP: - /* fall through */ - default: - status = ar6000_update_wlan_pwr_state(ar, WLAN_DISABLED, TRUE); - if (ar->arWlanPowerState==WLAN_POWER_STATE_ON || - ar->arWlanPowerState==WLAN_POWER_STATE_WOW) { - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("Strange suspend state for not wow mode %d", ar->arWlanPowerState)); - } - AR_DEBUG_PRINTF(ATH_DEBUG_PM,("%s:Suspend for %d mode pwr %d status %d\n", __func__, pmmode, ar->arWlanPowerState, status)); - if (ar->arWlanPowerState==WLAN_POWER_STATE_CUT_PWR) { - status = A_OK; - } else { - status = A_EBUSY; /* don't let mmc call sdio_init after resume */ - } - break; - } - - for(i = 0; i < num_device; i++) { - AR_SOFTC_DEV_T *arPriv = ar->arDev[i]; - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - if (arSta->scan_triggered) { - ar6000_scanComplete_event(arPriv, A_OK); - } - } - return status; -} - -A_STATUS ar6000_resume_ev(void *context) -{ - AR_SOFTC_T *ar = (AR_SOFTC_T *)context; - A_UINT16 powerState = ar->arWlanPowerState; - -#ifdef CONFIG_HAS_WAKELOCK - wake_lock(&ar6k_suspend_wake_lock); -#endif - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("%s: enter previous state %d wowState %d\n", __func__, powerState, ar->arWowState)); - switch (powerState) { - case WLAN_POWER_STATE_WOW: - ar6000_wow_resume(ar); - break; - case WLAN_POWER_STATE_CUT_PWR: - /* fall through */ - case WLAN_POWER_STATE_DEEP_SLEEP: - ar6000_update_wlan_pwr_state(ar, WLAN_ENABLED, TRUE); - AR_DEBUG_PRINTF(ATH_DEBUG_PM,("%s:Resume for %d mode pwr %d\n", __func__, powerState, ar->arWlanPowerState)); - break; - case WLAN_POWER_STATE_ON: - break; - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Strange SDIO bus power mode!!\n")); - break; - } -#ifdef CONFIG_HAS_WAKELOCK - wake_unlock(&ar6k_suspend_wake_lock); -#endif - return A_OK; -} - -void ar6000_check_wow_status(AR_SOFTC_T *ar, struct sk_buff *skb, A_BOOL isEvent) -{ - if (ar->arWowState!=WLAN_WOW_STATE_NONE) { - if (ar->arWowState==WLAN_WOW_STATE_SUSPENDING) { - AR_DEBUG_PRINTF(ATH_DEBUG_PM,("\n%s: Received IRQ while we are wow suspending!!!\n\n", __func__)); - return; - } - /* Wow resume from irq interrupt */ - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("%s: WoW resume from irq thread status %d\n", __func__, ar->arWlanPowerState)); - ar6000_wow_resume(ar); - } else { -#ifdef ANDROID_ENV - android_ar6k_check_wow_status(ar, skb, isEvent); -#endif - } -} - -A_STATUS ar6000_power_change_ev(void *context, A_UINT32 config) -{ - AR_SOFTC_T *ar = (AR_SOFTC_T *)context; - A_STATUS status = A_OK; - - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("%s: power change event callback %d \n", __func__, config)); - switch (config) { - case HIF_DEVICE_POWER_UP: - ar6000_restart_endpoint(ar); -#ifdef ANDROID_ENV - ar->arResumeDone = TRUE; - wake_up(&(ar->arDev[0]->arEvent)); -#endif /* ANDROID_ENV */ - status = A_OK; - break; - case HIF_DEVICE_POWER_DOWN: - case HIF_DEVICE_POWER_CUT: - status = A_OK; - break; - } - return status; -} - -#if PLAT_WOW_GPIO_PIN -static irqreturn_t -ar6000_wow_irq(int irq, void *dev_id) -{ - gpio_clear_detect_status(wow_irq); -#ifdef CONFIG_HAS_WAKELOCK - wake_lock_timeout(&ar6k_wow_wake_lock, 3*HZ); -#else - /* TODO: What should I do if there is no wake lock?? */ -#endif - return IRQ_HANDLED; -} -#endif /* PLAT_WOW_GPIO_PIN */ - -#if PLAT_WLAN_CHIP_PWD_PIN -void plat_setup_power_stub(AR_SOFTC_T *ar, int on, int detect) -{ -#if 0//def RK29 -extern int wifi_turn_on_card(void); -extern int wifi_turn_off_card(void); -extern int rk29sdk_wifi_set_carddetect(int val); -extern int wifi_power_up_wifi(void); -extern int wifi_power_down_wifi(void); - - printk("%s :: on %d, detect %d\n", __func__, on, detect); - if (on) { - wifi_turn_on_card(); - wifi_power_up_wifi(); - } else { - wifi_turn_off_card(); - wifi_power_down_wifi(); - } - /* rk29sdk_wifi_set_carddetect(detect ? 1 : 0); */ - -#else - A_BOOL chip_pwd_low_val; - - if (on) { - chip_pwd_low_val = 1; - } else { - chip_pwd_low_val = 0; - } - - if (gpio_request(PLAT_WLAN_CHIP_PWD_PIN, "wlan_chip_pwd_l")!=0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Cannot request CHIP_PWD GPIO")); - } else { - gpio_direction_output(PLAT_WLAN_CHIP_PWD_PIN, 0);/* WLAN_CHIP_PWD */ - gpio_set_value(PLAT_WLAN_CHIP_PWD_PIN, chip_pwd_low_val); - A_MDELAY(100); - gpio_free(PLAT_WLAN_CHIP_PWD_PIN); - } -#endif -} -#endif /* PLAT_WLAN_CHIP_PWD_PIN */ - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) -static int ar6000_pm_probe(struct platform_device *pdev) -{ - plat_setup_power(NULL, 1, 1); - return 0; -} - -static int ar6000_pm_remove(struct platform_device *pdev) -{ -#ifdef RK29 - plat_setup_power(NULL, 0, 0); -#else - plat_setup_power(NULL, 0, 1); -#endif - return 0; -} - -static int ar6000_pm_suspend(struct platform_device *pdev, pm_message_t state) -{ - return 0; -} - -static int ar6000_pm_resume(struct platform_device *pdev) -{ - int i; - extern struct net_device *ar6000_devices[MAX_AR6000]; - for (i=0; ar6000_devices[i]; ++i) { - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(ar6000_devices[i]); - AR_SOFTC_T *ar = (AR_SOFTC_T *)arPriv->arSoftc; - if (ar && ar->arPlatPowerOff) { - A_BOOL wlanOff = ar->arWlanOff; - A_UINT16 powerState = ar->arWlanPowerState; - A_BOOL btOff = ar->arBTOff; - - if (!wlanOff) { - if (powerState == WLAN_POWER_STATE_CUT_PWR) { - plat_setup_power(ar, 1, 0); - ar->arPlatPowerOff = FALSE; - } - } -#ifdef CONFIG_PM - else if (wlanOff) { - A_BOOL allowCutPwr = ((!ar->arBTSharing) || btOff); - if ((powerState==WLAN_POWER_STATE_CUT_PWR) && (!allowCutPwr)) { - plat_setup_power(ar, 1, 0); - ar->arPlatPowerOff = FALSE; - } - } -#endif /* CONFIG_PM */ - } - } - return 0; -} - -static struct platform_driver ar6000_pm_device = { - .probe = ar6000_pm_probe, - .remove = ar6000_pm_remove, - .suspend = ar6000_pm_suspend, - .resume = ar6000_pm_resume, - .driver = { - .name = "wlan_ar6000_pm_dev", - }, -}; -#endif -#endif /* CONFIG_PM */ - -A_STATUS -ar6000_setup_cut_power_state(struct ar6_softc *ar, AR6000_WLAN_STATE state) -{ - A_STATUS status = A_OK; - HIF_DEVICE_POWER_CHANGE_TYPE config; - - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("%s: Cut power %d %d \n", __func__,state, ar->arWlanPowerState)); -#ifdef CONFIG_PM - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("Wlan OFF %d BT OFf %d \n", ar->arWlanOff, ar->arBTOff)); -#endif - do { - if (state == WLAN_ENABLED) { - /* Not in cut power state.. exit */ - if (ar->arWlanPowerState != WLAN_POWER_STATE_CUT_PWR) { - break; - } - - if (ar->arPlatPowerOff) { - plat_setup_power(ar, 1, 0); - ar->arPlatPowerOff = FALSE; - } - - /* Change the state to ON */ - ar->arWlanPowerState = WLAN_POWER_STATE_ON; - -#ifdef ANDROID_ENV - ar->arResumeDone = FALSE; -#endif /* ANDROID_ENV */ - - /* Indicate POWER_UP to HIF */ - config = HIF_DEVICE_POWER_UP; - status = HIFConfigureDevice(ar->arHifDevice, - HIF_DEVICE_POWER_STATE_CHANGE, - &config, - sizeof(HIF_DEVICE_POWER_CHANGE_TYPE)); - - if (status == A_PENDING) { -#ifdef ANDROID_ENV - /* Wait for resume done event */ - A_UINT32 timeleft = wait_event_interruptible_timeout(ar->arDev[0]->arEvent, - (ar->arResumeDone == TRUE), wmitimeout * HZ); - if (!timeleft || signal_pending(current)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000 : Failed to get resume done event \n")); - status = A_ERROR; - break; - } -#endif - status = A_OK; - } else if (status == A_OK) { - ar6000_restart_endpoint(ar); -#ifdef ANDROID_ENV - ar->arResumeDone = TRUE; -#endif /* ANDROID_ENV */ - status = A_OK; - } - } else if (state == WLAN_DISABLED) { - - - /* Already in cut power state.. exit */ - if (ar->arWlanPowerState == WLAN_POWER_STATE_CUT_PWR) { - break; - } - ar6000_stop_endpoint(ar, TRUE, FALSE); - - config = HIF_DEVICE_POWER_CUT; - status = HIFConfigureDevice(ar->arHifDevice, - HIF_DEVICE_POWER_STATE_CHANGE, - &config, - sizeof(HIF_DEVICE_POWER_CHANGE_TYPE)); - - plat_setup_power(ar, 0, 0); - ar->arPlatPowerOff = TRUE; - - ar->arWlanPowerState = WLAN_POWER_STATE_CUT_PWR; - } - } while (0); - - return status; -} - -A_STATUS -ar6000_setup_deep_sleep_state(struct ar6_softc *ar, AR6000_WLAN_STATE state) -{ - A_STATUS status = A_OK; - - HIF_DEVICE_POWER_CHANGE_TYPE config; - AR_SOFTC_DEV_T *arPriv; - AR_SOFTC_STA_T *arSta; - A_UINT8 i; - - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("%s: Deep sleep %d %d \n", __func__,state, ar->arWlanPowerState)); -#ifdef CONFIG_PM - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("Wlan OFF %d BT OFf %d \n", ar->arWlanOff, ar->arBTOff)); -#endif - do { - WMI_SET_HOST_SLEEP_MODE_CMD hostSleepMode; - - if (state == WLAN_ENABLED) { - A_UINT16 fg_start_period; - - /* Not in deep sleep state.. exit */ - if (ar->arWlanPowerState != WLAN_POWER_STATE_DEEP_SLEEP) { - if (ar->arWlanPowerState != WLAN_POWER_STATE_ON) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Strange state when we resume from deep sleep %d\n", ar->arWlanPowerState)); - } - break; - } - - /* Indicate POWER_UP to HIF */ - config = HIF_DEVICE_POWER_UP; - status = HIFConfigureDevice(ar->arHifDevice, - HIF_DEVICE_POWER_STATE_CHANGE, - &config, - sizeof(HIF_DEVICE_POWER_CHANGE_TYPE)); - - for(i = 0; i < num_device; i++) - { - arPriv = ar->arDev[i]; - arSta = &arPriv->arSta; - - /* - * Free all wlan_nodes (scanned APs that we detected previously) - * because during the time we were suspended, the device may have - * been moved to a new location and these APs scanned for before - * suspend may not be valid - */ - wmi_free_allnodes(arPriv->arWmi); - - fg_start_period = (arSta->scParams.fg_start_period==0) ? 1 : arSta->scParams.fg_start_period; - hostSleepMode.awake = TRUE; - hostSleepMode.asleep = FALSE; - - if ((status=wmi_set_host_sleep_mode_cmd(arPriv->arWmi, &hostSleepMode)) != A_OK) { - break; - } - - /* Change the state to ON */ - ar->arWlanPowerState = WLAN_POWER_STATE_ON; - - /* Enable foreground scanning */ - if ((status=wmi_scanparams_cmd(arPriv->arWmi, fg_start_period, - arSta->scParams.fg_end_period, - arSta->scParams.bg_period, - arSta->scParams.minact_chdwell_time, - arSta->scParams.maxact_chdwell_time, - arSta->scParams.pas_chdwell_time, - arSta->scParams.shortScanRatio, - arSta->scParams.scanCtrlFlags, - arSta->scParams.max_dfsch_act_time, - arSta->scParams.maxact_scan_per_ssid)) != A_OK) - { - break; - } - - if (arPriv->arSsidLen) { - if (ar6000_connect_to_ap(arPriv) != A_OK) { - /* no need to report error if connection failed */ - break; - } - } - } - } else if (state == WLAN_DISABLED){ - WMI_SET_WOW_MODE_CMD wowMode = { .enable_wow = FALSE }; - - /* Already in deep sleep state.. exit */ - if (ar->arWlanPowerState != WLAN_POWER_STATE_ON) { - if (ar->arWlanPowerState != WLAN_POWER_STATE_DEEP_SLEEP) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Strange state when we suspend for deep sleep %d\n", ar->arWlanPowerState)); - } - break; - } - - for(i = 0; i < num_device; i++) - { - arPriv = ar->arDev[i]; - arSta = &arPriv->arSta; - /* make sure we disable wow for deep sleep */ - if ((status=wmi_set_wow_mode_cmd(arPriv->arWmi, &wowMode))!=A_OK) { - break; - } - - /* Disconnect from the AP and disable foreground scanning */ - AR6000_SPIN_LOCK(&arPriv->arPrivLock, 0); - if (arPriv->arConnected == TRUE || arSta->arConnectPending == TRUE) { - AR6000_SPIN_UNLOCK(&arPriv->arPrivLock, 0); - ar6000_disconnect(arPriv); - } else { - AR6000_SPIN_UNLOCK(&arPriv->arPrivLock, 0); - } - - if ((status=wmi_scanparams_cmd(arPriv->arWmi, 0xFFFF, 0, 0, 0, 0, 0, 0, 0, 0, 0)) != A_OK) { - break; - } - ar6000_TxDataCleanup(ar); -#ifndef ATH6K_CONFIG_OTA_MODE - wmi_powermode_cmd(arPriv->arWmi, REC_POWER); -#endif - - hostSleepMode.awake = FALSE; - hostSleepMode.asleep = TRUE; - if ((status=wmi_set_host_sleep_mode_cmd(arPriv->arWmi, &hostSleepMode))!=A_OK) { - break; - } - if (ar->arTxPending[ar->arControlEp]) { - A_UINT32 timeleft = wait_event_interruptible_timeout(arPriv->arEvent, - ar->arTxPending[ar->arControlEp] == 0, wmitimeout * HZ); - if (!timeleft || signal_pending(current)) { - status = A_ERROR; - break; - } - } - } - status = hifWaitForPendingRecv(ar->arHifDevice); - - config = HIF_DEVICE_POWER_DOWN; - status = HIFConfigureDevice(ar->arHifDevice, - HIF_DEVICE_POWER_STATE_CHANGE, - &config, - sizeof(HIF_DEVICE_POWER_CHANGE_TYPE)); - - ar->arWlanPowerState = WLAN_POWER_STATE_DEEP_SLEEP; - } - } while (0); - - if (status!=A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to enter/exit deep sleep %d\n", state)); - } - - return status; -} - -A_STATUS -ar6000_update_wlan_pwr_state(struct ar6_softc *ar, AR6000_WLAN_STATE state, A_BOOL pmEvent) -{ - A_STATUS status = A_OK; - A_UINT16 powerState, oldPowerState; - AR6000_WLAN_STATE oldstate = ar->arWlanState; - A_BOOL wlanOff = ar->arWlanOff; -#ifdef CONFIG_PM - A_BOOL btOff = ar->arBTOff; -#endif /* CONFIG_PM */ - A_UINT8 i; - AR_SOFTC_DEV_T *arPriv; - - if ((state!=WLAN_DISABLED && state!=WLAN_ENABLED)) { - return A_ERROR; - } - - if (ar->bIsDestroyProgress) { - return A_EBUSY; - } - - if (down_interruptible(&ar->arSem)) { - return A_ERROR; - } - - if (ar->bIsDestroyProgress) { - up(&ar->arSem); - return A_EBUSY; - } - - ar->arWlanState = wlanOff ? WLAN_DISABLED : state; - oldPowerState = ar->arWlanPowerState; - if (state == WLAN_ENABLED) { - powerState = ar->arWlanPowerState; - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("WLAN PWR set to ENABLE^^\n")); - if (!wlanOff) { - if (powerState == WLAN_POWER_STATE_DEEP_SLEEP) { - status = ar6000_setup_deep_sleep_state(ar, WLAN_ENABLED); - } else if (powerState == WLAN_POWER_STATE_CUT_PWR) { - status = ar6000_setup_cut_power_state(ar, WLAN_ENABLED); - } - } -#ifdef CONFIG_PM - else if (pmEvent && wlanOff) { - A_BOOL allowCutPwr = ((!ar->arBTSharing) || btOff); - if ((powerState==WLAN_POWER_STATE_CUT_PWR) && (!allowCutPwr)) { - /* Come out of cut power */ - ar6000_setup_cut_power_state(ar, WLAN_ENABLED); - status = ar6000_setup_deep_sleep_state(ar, WLAN_DISABLED); - } - } -#endif /* CONFIG_PM */ - } else if (state == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("WLAN PWR set to DISABLED~\n")); - powerState = WLAN_POWER_STATE_DEEP_SLEEP; -#ifdef CONFIG_PM - if (pmEvent) { /* disable due to suspend */ - A_BOOL suspendCutPwr = (ar->arSuspendConfig == WLAN_SUSPEND_CUT_PWR || - (ar->arSuspendConfig == WLAN_SUSPEND_WOW && - ar->arWow2Config==WLAN_SUSPEND_CUT_PWR)); - A_BOOL suspendCutIfBtOff = ((ar->arSuspendConfig == - WLAN_SUSPEND_CUT_PWR_IF_BT_OFF || - (ar->arSuspendConfig == WLAN_SUSPEND_WOW && - ar->arWow2Config==WLAN_SUSPEND_CUT_PWR_IF_BT_OFF)) && - (!ar->arBTSharing || btOff)); - if ((suspendCutPwr) || - (suspendCutIfBtOff) || - (ar->arWlanPowerState==WLAN_POWER_STATE_CUT_PWR)) - { - if (!wlanOff || ar->arWlanPowerState!=WLAN_POWER_STATE_DEEP_SLEEP) { - powerState = WLAN_POWER_STATE_CUT_PWR; - } - } - } else { - if ((wlanOff) && - (ar->arWlanOffConfig == WLAN_OFF_CUT_PWR) && - (!ar->arBTSharing || btOff)) - { - /* For BT clock sharing designs, CUT_POWER depend on BT state */ - powerState = WLAN_POWER_STATE_CUT_PWR; - } - } -#endif /* CONFIG_PM */ - - if (powerState == WLAN_POWER_STATE_DEEP_SLEEP) { - if (ar->arWlanPowerState == WLAN_POWER_STATE_CUT_PWR) { - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("Load firmware before set to deep sleep\n")); - ar6000_setup_cut_power_state(ar, WLAN_ENABLED); - } - status = ar6000_setup_deep_sleep_state(ar, WLAN_DISABLED); - } else if (powerState == WLAN_POWER_STATE_CUT_PWR) { - status = ar6000_setup_cut_power_state(ar, WLAN_DISABLED); - } - - } - - if (status!=A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to setup WLAN state %d\n", ar->arWlanState)); - ar->arWlanState = oldstate; - } else if (status == A_OK) { - WMI_REPORT_SLEEP_STATE_EVENT wmiSleepEvent, *pSleepEvent = NULL; - if ((ar->arWlanPowerState == WLAN_POWER_STATE_ON) && (oldPowerState != WLAN_POWER_STATE_ON)) { - wmiSleepEvent.sleepState = WMI_REPORT_SLEEP_STATUS_IS_AWAKE; - pSleepEvent = &wmiSleepEvent; - } else if ((ar->arWlanPowerState != WLAN_POWER_STATE_ON) && (oldPowerState == WLAN_POWER_STATE_ON)) { - wmiSleepEvent.sleepState = WMI_REPORT_SLEEP_STATUS_IS_DEEP_SLEEP; - pSleepEvent = &wmiSleepEvent; - } - if (pSleepEvent) { - AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("SENT WLAN Sleep Event %d\n", wmiSleepEvent.sleepState)); - for(i = 0; i < num_device; i++) - { - arPriv = ar->arDev[i]; - ar6000_send_event_to_app(arPriv, WMI_REPORT_SLEEP_STATE_EVENTID, (A_UINT8*)pSleepEvent, - sizeof(WMI_REPORT_SLEEP_STATE_EVENTID)); - } - } - } - up(&ar->arSem); - return status; -} - -A_STATUS -ar6000_set_bt_hw_state(struct ar6_softc *ar, A_UINT32 enable) -{ -#ifdef CONFIG_PM - A_BOOL off = (enable == 0); - A_STATUS status; - if (ar->arBTOff == off) { - return A_OK; - } - ar->arBTOff = off; - status = ar6000_update_wlan_pwr_state(ar, ar->arWlanOff ? WLAN_DISABLED : WLAN_ENABLED, FALSE); - return status; -#else - return A_OK; -#endif -} - -A_STATUS -ar6000_set_wlan_state(struct ar6_softc *ar, AR6000_WLAN_STATE state) -{ - A_INT32 i; - A_STATUS status; - A_BOOL off = (state == WLAN_DISABLED); - if (ar->arWlanOff == off) { - return A_OK; - } - ar->arWlanOff = off; - status = ar6000_update_wlan_pwr_state(ar, state, FALSE); - for(i = 0; i < num_device; i++) { - AR_SOFTC_DEV_T *arPriv = ar->arDev[i]; - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - if (arSta->scan_triggered) { - ar6000_scanComplete_event(arPriv, A_OK); - } - } - return status; -} - -void ar6000_pm_init() -{ - A_REGISTER_MODULE_DEBUG_INFO(pm); -#ifdef CONFIG_PM -#ifdef CONFIG_HAS_WAKELOCK - wake_lock_init(&ar6k_suspend_wake_lock, WAKE_LOCK_SUSPEND, "ar6k_suspend"); - wake_lock_init(&ar6k_wow_wake_lock, WAKE_LOCK_SUSPEND, "ar6k_wow"); -#endif - /* - * Register ar6000_pm_device into system. - * We should also add platform_device into the first item of array - * of devices[] in file arch/xxx/mach-xxx/board-xxxx.c - */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) - if (platform_driver_register(&ar6000_pm_device)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000: fail to register the power control driver.\n")); - } -#endif - -#if PLAT_WOW_GPIO_PIN - wow_irq = gpio_to_irq(PLAT_WOW_GPIO_PIN); - if (wow_irq) { - int ret; - ret = request_irq(wow_irq, ar6000_wow_irq, - IRQF_SHARED | IRQF_TRIGGER_RISING, - "ar6000" "sdiowakeup", &wow_irq); - if (!ret) { - ret = enable_irq_wake(wow_irq); - if (ret < 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Couldn't enable WoW IRQ as wakeup interrupt")); - } - } - } -#endif /* PLAT_WOW_GPIO_PIN */ -#endif /* CONFIG_PM */ -} - -void ar6000_pm_exit() -{ -#ifdef CONFIG_PM -#if PLAT_WOW_GPIO_PIN - if (wow_irq) { - if (disable_irq_wake(wow_irq)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Couldn't disable hostwake IRQ wakeup mode\n")); - } - free_irq(wow_irq, &wow_irq); - wow_irq = 0; - } -#endif /* PLAT_WOW_GPIO_PIN */ - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) - platform_driver_unregister(&ar6000_pm_device); -#endif -#ifdef CONFIG_HAS_WAKELOCK - wake_lock_destroy(&ar6k_suspend_wake_lock); - wake_lock_destroy(&ar6k_wow_wake_lock); -#endif -#endif /* CONFIG_PM */ -} - diff --git a/drivers/net/wireless/ar6003/host/os/linux/ar6000_raw_if.c b/drivers/net/wireless/ar6003/host/os/linux/ar6000_raw_if.c deleted file mode 100644 index 39e5823794a8..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/ar6000_raw_if.c +++ /dev/null @@ -1,465 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -#include "ar6000_drv.h" - -#ifdef HTC_RAW_INTERFACE - -static void -ar6000_htc_raw_read_cb(void *Context, HTC_PACKET *pPacket) -{ - AR_SOFTC_T *ar = (AR_SOFTC_T *)Context; - raw_htc_buffer *busy; - HTC_RAW_STREAM_ID streamID; - AR_RAW_HTC_T *arRaw = ar->arRawHtc; - - busy = (raw_htc_buffer *)pPacket->pPktContext; - A_ASSERT(busy != NULL); - - if (pPacket->Status == A_ECANCELED) { - /* - * HTC provides A_ECANCELED status when it doesn't want to be refilled - * (probably due to a shutdown) - */ - return; - } - - streamID = arEndpoint2RawStreamID(ar,pPacket->Endpoint); - A_ASSERT(streamID != HTC_RAW_STREAM_NOT_MAPPED); - if(streamID == HTC_RAW_STREAM_NOT_MAPPED) { - return; /* in case panic_on_assert==0 */ - } - -#ifdef CF - if (down_trylock(&arRaw->raw_htc_read_sem[streamID])) { -#else - if (down_interruptible(&arRaw->raw_htc_read_sem[streamID])) { -#endif /* CF */ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to down the semaphore\n")); - } - - A_ASSERT((pPacket->Status != A_OK) || - (pPacket->pBuffer == (busy->data + HTC_HEADER_LEN))); - - busy->length = pPacket->ActualLength + HTC_HEADER_LEN; - busy->currPtr = HTC_HEADER_LEN; - arRaw->read_buffer_available[streamID] = TRUE; - //AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("raw read cb: 0x%X 0x%X \n", busy->currPtr,busy->length); - up(&arRaw->raw_htc_read_sem[streamID]); - - /* Signal the waiting process */ - AR_DEBUG_PRINTF(ATH_DEBUG_HTC_RAW,("Waking up the StreamID(%d) read process\n", streamID)); - wake_up_interruptible(&arRaw->raw_htc_read_queue[streamID]); -} - -static void -ar6000_htc_raw_write_cb(void *Context, HTC_PACKET *pPacket) -{ - AR_SOFTC_T *ar = (AR_SOFTC_T *)Context; - raw_htc_buffer *free; - HTC_RAW_STREAM_ID streamID; - AR_RAW_HTC_T *arRaw = ar->arRawHtc; - - free = (raw_htc_buffer *)pPacket->pPktContext; - A_ASSERT(free != NULL); - - if (pPacket->Status == A_ECANCELED) { - /* - * HTC provides A_ECANCELED status when it doesn't want to be refilled - * (probably due to a shutdown) - */ - return; - } - - streamID = arEndpoint2RawStreamID(ar,pPacket->Endpoint); - A_ASSERT(streamID != HTC_RAW_STREAM_NOT_MAPPED); - if(streamID == HTC_RAW_STREAM_NOT_MAPPED) { - return; /* in case panic_on_assert==0 */ - } -#ifdef CF - if (down_trylock(&arRaw->raw_htc_write_sem[streamID])) { -#else - if (down_interruptible(&arRaw->raw_htc_write_sem[streamID])) { -#endif - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to down the semaphore\n")); - } - - A_ASSERT(pPacket->pBuffer == (free->data + HTC_HEADER_LEN)); - - free->length = 0; - arRaw->write_buffer_available[streamID] = TRUE; - up(&arRaw->raw_htc_write_sem[streamID]); - - /* Signal the waiting process */ - AR_DEBUG_PRINTF(ATH_DEBUG_HTC_RAW,("Waking up the StreamID(%d) write process\n", streamID)); - wake_up_interruptible(&arRaw->raw_htc_write_queue[streamID]); -} - -/* connect to a service */ -static A_STATUS ar6000_connect_raw_service(AR_SOFTC_T *ar, - HTC_RAW_STREAM_ID StreamID) -{ - A_STATUS status; - HTC_SERVICE_CONNECT_RESP response; - A_UINT8 streamNo; - HTC_SERVICE_CONNECT_REQ connect; - - do { - - A_MEMZERO(&connect,sizeof(connect)); - /* pass the stream ID as meta data to the RAW streams service */ - streamNo = (A_UINT8)StreamID; - connect.pMetaData = &streamNo; - connect.MetaDataLength = sizeof(A_UINT8); - /* these fields are the same for all endpoints */ - connect.EpCallbacks.pContext = ar; - connect.EpCallbacks.EpTxComplete = ar6000_htc_raw_write_cb; - connect.EpCallbacks.EpRecv = ar6000_htc_raw_read_cb; - /* simple interface, we don't need these optional callbacks */ - connect.EpCallbacks.EpRecvRefill = NULL; - connect.EpCallbacks.EpSendFull = NULL; - connect.MaxSendQueueDepth = RAW_HTC_WRITE_BUFFERS_NUM; - - /* connect to the raw streams service, we may be able to get 1 or more - * connections, depending on WHAT is running on the target */ - connect.ServiceID = HTC_RAW_STREAMS_SVC; - - A_MEMZERO(&response,sizeof(response)); - - /* try to connect to the raw stream, it is okay if this fails with - * status HTC_SERVICE_NO_MORE_EP */ - status = HTCConnectService(ar->arHtcTarget, - &connect, - &response); - - if (A_FAILED(status)) { - if (response.ConnectRespCode == HTC_SERVICE_NO_MORE_EP) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HTC RAW , No more streams allowed \n")); - status = A_OK; - } - break; - } - - /* set endpoint mapping for the RAW HTC streams */ - arSetRawStream2EndpointIDMap(ar,StreamID,response.Endpoint); - - AR_DEBUG_PRINTF(ATH_DEBUG_HTC_RAW,("HTC RAW : stream ID: %d, endpoint: %d\n", - StreamID, arRawStream2EndpointID(ar,StreamID))); - - } while (FALSE); - - return status; -} - -int ar6000_htc_raw_open(AR_SOFTC_T *ar) -{ - A_STATUS status; - int streamID, endPt, count2; - raw_htc_buffer *buffer; - HTC_SERVICE_ID servicepriority; - AR_RAW_HTC_T *arRaw = ar->arRawHtc; - if (!arRaw) { - arRaw = ar->arRawHtc = A_MALLOC(sizeof(AR_RAW_HTC_T)); - if (arRaw) { - A_MEMZERO(arRaw, sizeof(AR_RAW_HTC_T)); - } - } - A_ASSERT(ar->arHtcTarget != NULL); - if (!arRaw) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Faile to allocate memory for HTC RAW interface\n")); - return -ENOMEM; - } - /* wait for target */ - status = HTCWaitTarget(ar->arHtcTarget); - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HTCWaitTarget failed (%d)\n", status)); - return -ENODEV; - } - - for (endPt = 0; endPt < ENDPOINT_MAX; endPt++) { - arRaw->arEp2RawMapping[endPt] = HTC_RAW_STREAM_NOT_MAPPED; - } - - for (streamID = HTC_RAW_STREAM_0; streamID < HTC_RAW_STREAM_NUM_MAX; streamID++) { - /* Initialize the data structures */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) - sema_init(&arRaw->raw_htc_read_sem[streamID], 1); - sema_init(&arRaw->raw_htc_write_sem[streamID], 1); -#else - init_MUTEX(&arRaw->raw_htc_read_sem[streamID]); - init_MUTEX(&arRaw->raw_htc_write_sem[streamID]); -#endif - init_waitqueue_head(&arRaw->raw_htc_read_queue[streamID]); - init_waitqueue_head(&arRaw->raw_htc_write_queue[streamID]); - - /* try to connect to the raw service */ - status = ar6000_connect_raw_service(ar,streamID); - - if (A_FAILED(status)) { - break; - } - - if (arRawStream2EndpointID(ar,streamID) == 0) { - break; - } - - for (count2 = 0; count2 < RAW_HTC_READ_BUFFERS_NUM; count2 ++) { - /* Initialize the receive buffers */ - buffer = &arRaw->raw_htc_write_buffer[streamID][count2]; - memset(buffer, 0, sizeof(raw_htc_buffer)); - buffer = &arRaw->raw_htc_read_buffer[streamID][count2]; - memset(buffer, 0, sizeof(raw_htc_buffer)); - - SET_HTC_PACKET_INFO_RX_REFILL(&buffer->HTCPacket, - buffer, - buffer->data, - HTC_RAW_BUFFER_SIZE, - arRawStream2EndpointID(ar,streamID)); - - /* Queue buffers to HTC for receive */ - if ((status = HTCAddReceivePkt(ar->arHtcTarget, &buffer->HTCPacket)) != A_OK) - { - BMIInit(); - return -EIO; - } - } - - for (count2 = 0; count2 < RAW_HTC_WRITE_BUFFERS_NUM; count2 ++) { - /* Initialize the receive buffers */ - buffer = &arRaw->raw_htc_write_buffer[streamID][count2]; - memset(buffer, 0, sizeof(raw_htc_buffer)); - } - - arRaw->read_buffer_available[streamID] = FALSE; - arRaw->write_buffer_available[streamID] = TRUE; - } - - if (A_FAILED(status)) { - return -EIO; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("HTC RAW, number of streams the target supports: %d \n", streamID)); - - servicepriority = HTC_RAW_STREAMS_SVC; /* only 1 */ - - /* set callbacks and priority list */ - HTCSetCreditDistribution(ar->arHtcTarget, - ar, - NULL, /* use default */ - NULL, /* use default */ - &servicepriority, - 1); - - /* Start the HTC component */ - if ((status = HTCStart(ar->arHtcTarget)) != A_OK) { - BMIInit(); - return -EIO; - } - - (ar)->arRawIfInit = TRUE; - - return 0; -} - -int ar6000_htc_raw_close(AR_SOFTC_T *ar) -{ - A_PRINTF("ar6000_htc_raw_close called \n"); - HTCStop(ar->arHtcTarget); - - /* reset the device */ - ar6000_reset_device(ar->arHifDevice, ar->arTargetType, TRUE, FALSE); - /* Initialize the BMI component */ - BMIInit(); - - return 0; -} - -raw_htc_buffer * -get_filled_buffer(AR_SOFTC_T *ar, HTC_RAW_STREAM_ID StreamID) -{ - int count; - raw_htc_buffer *busy; - AR_RAW_HTC_T *arRaw = ar->arRawHtc; - - /* Check for data */ - for (count = 0; count < RAW_HTC_READ_BUFFERS_NUM; count ++) { - busy = &arRaw->raw_htc_read_buffer[StreamID][count]; - if (busy->length) { - break; - } - } - if (busy->length) { - arRaw->read_buffer_available[StreamID] = TRUE; - } else { - arRaw->read_buffer_available[StreamID] = FALSE; - } - - return busy; -} - -ssize_t ar6000_htc_raw_read(AR_SOFTC_T *ar, HTC_RAW_STREAM_ID StreamID, - char __user *buffer, size_t length) -{ - int readPtr; - raw_htc_buffer *busy; - AR_RAW_HTC_T *arRaw = ar->arRawHtc; - - if (arRawStream2EndpointID(ar,StreamID) == 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("StreamID(%d) not connected! \n", StreamID)); - return -EFAULT; - } - - if (down_interruptible(&arRaw->raw_htc_read_sem[StreamID])) { - return -ERESTARTSYS; - } - - busy = get_filled_buffer(ar,StreamID); - while (!arRaw->read_buffer_available[StreamID]) { - up(&arRaw->raw_htc_read_sem[StreamID]); - - /* Wait for the data */ - AR_DEBUG_PRINTF(ATH_DEBUG_HTC_RAW,("Sleeping StreamID(%d) read process\n", StreamID)); - if (wait_event_interruptible(arRaw->raw_htc_read_queue[StreamID], - arRaw->read_buffer_available[StreamID])) - { - return -EINTR; - } - if (down_interruptible(&arRaw->raw_htc_read_sem[StreamID])) { - return -ERESTARTSYS; - } - busy = get_filled_buffer(ar,StreamID); - } - - /* Read the data */ - readPtr = busy->currPtr; - if (length > busy->length - HTC_HEADER_LEN) { - length = busy->length - HTC_HEADER_LEN; - } - if (copy_to_user(buffer, &busy->data[readPtr], length)) { - up(&arRaw->raw_htc_read_sem[StreamID]); - return -EFAULT; - } - - busy->currPtr += length; - - if (busy->currPtr == busy->length) - { - busy->currPtr = 0; - busy->length = 0; - HTC_PACKET_RESET_RX(&busy->HTCPacket); - //AR_DEBUG_PRINTF(ATH_DEBUG_HTC_RAW,("raw read ioctl: ep for packet:%d \n", busy->HTCPacket.Endpoint)); - HTCAddReceivePkt(ar->arHtcTarget, &busy->HTCPacket); - } - arRaw->read_buffer_available[StreamID] = FALSE; - up(&arRaw->raw_htc_read_sem[StreamID]); - - return length; -} - -static raw_htc_buffer * -get_free_buffer(AR_SOFTC_T *ar, HTC_ENDPOINT_ID StreamID) -{ - int count; - raw_htc_buffer *free; - AR_RAW_HTC_T *arRaw = ar->arRawHtc; - - free = NULL; - for (count = 0; count < RAW_HTC_WRITE_BUFFERS_NUM; count ++) { - free = &arRaw->raw_htc_write_buffer[StreamID][count]; - if (free->length == 0) { - break; - } - } - if (!free->length) { - arRaw->write_buffer_available[StreamID] = TRUE; - } else { - arRaw->write_buffer_available[StreamID] = FALSE; - } - - return free; -} - -ssize_t ar6000_htc_raw_write(AR_SOFTC_T *ar, HTC_RAW_STREAM_ID StreamID, - char __user *buffer, size_t length) -{ - int writePtr; - raw_htc_buffer *free; - AR_RAW_HTC_T *arRaw = ar->arRawHtc; - if (arRawStream2EndpointID(ar,StreamID) == 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("StreamID(%d) not connected! \n", StreamID)); - return -EFAULT; - } - - if (down_interruptible(&arRaw->raw_htc_write_sem[StreamID])) { - return -ERESTARTSYS; - } - - /* Search for a free buffer */ - free = get_free_buffer(ar,StreamID); - - /* Check if there is space to write else wait */ - while (!arRaw->write_buffer_available[StreamID]) { - up(&arRaw->raw_htc_write_sem[StreamID]); - - /* Wait for buffer to become free */ - AR_DEBUG_PRINTF(ATH_DEBUG_HTC_RAW,("Sleeping StreamID(%d) write process\n", StreamID)); - if (wait_event_interruptible(arRaw->raw_htc_write_queue[StreamID], - arRaw->write_buffer_available[StreamID])) - { - return -EINTR; - } - if (down_interruptible(&arRaw->raw_htc_write_sem[StreamID])) { - return -ERESTARTSYS; - } - free = get_free_buffer(ar,StreamID); - } - - /* Send the data */ - writePtr = HTC_HEADER_LEN; - if (length > (HTC_RAW_BUFFER_SIZE - HTC_HEADER_LEN)) { - length = HTC_RAW_BUFFER_SIZE - HTC_HEADER_LEN; - } - - if (copy_from_user(&free->data[writePtr], buffer, length)) { - up(&arRaw->raw_htc_read_sem[StreamID]); - return -EFAULT; - } - - free->length = length; - - SET_HTC_PACKET_INFO_TX(&free->HTCPacket, - free, - &free->data[writePtr], - length, - arRawStream2EndpointID(ar,StreamID), - AR6K_DATA_PKT_TAG); - - HTCSendPkt(ar->arHtcTarget,&free->HTCPacket); - - arRaw->write_buffer_available[StreamID] = FALSE; - up(&arRaw->raw_htc_write_sem[StreamID]); - - return length; -} -#endif /* HTC_RAW_INTERFACE */ diff --git a/drivers/net/wireless/ar6003/host/os/linux/ar6k_mem_debug.c b/drivers/net/wireless/ar6003/host/os/linux/ar6k_mem_debug.c deleted file mode 100644 index cb7cd3084ba4..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/ar6k_mem_debug.c +++ /dev/null @@ -1,246 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ -// -#include "ar6000_drv.h" - -#define malloc(size) kmalloc((size), GFP_ATOMIC) -#define free(ptr) kfree((ptr)) - -typedef struct MemInfo { - void *ptr; - const char *caller; - int lineno; - size_t size; -} MemInfo; - - - -typedef unsigned long hash_key; - -typedef struct HashItem { - hash_key Key; - struct HashItem * Next; -} HashItem; - -typedef struct a_hash { - HashItem **Buckets; - size_t len; - int (*cmpKeyFunc)(const hash_key a, const hash_key b); - unsigned long (*hashFunc)(const hash_key key); - HashItem* (*mkNodeFunc)(hash_key key); -} a_hash; - -static a_hash* gMem; - -static int cmpMemInfo(const hash_key a, const hash_key b) -{ - return((const MemInfo*)a)->ptr - ((const MemInfo*)b)->ptr; -} - -static unsigned long hashMemInfo(const hash_key key) -{ - return(unsigned long)((const MemInfo*)key)->ptr; -} - -static HashItem* mkMemInfoItem(hash_key key) -{ - HashItem* item; - item = malloc(sizeof(HashItem)+ sizeof(MemInfo)); - item->Key = (hash_key)(item+1); - memcpy((void*)item->Key, (void*)key, sizeof(MemInfo)); - return item; -} - -static void rmItem(HashItem* item, void* data) -{ /* private function, don't use !! */ - free(item); -} - -HashItem* a_hash_add(a_hash *hash, const hash_key Key) -{ - int hashIndex = hash->hashFunc(Key) % hash->len; - HashItem* item = hash->mkNodeFunc(Key); - item->Next = hash->Buckets[hashIndex]; - hash->Buckets[hashIndex] = item; - return item; -} - -void a_hash_iterate(a_hash* hash, void (*func)(HashItem*, void*), void* data) -{ - size_t i; - HashItem *p, *next; - for (i=0; ilen; ++i) { - p = hash->Buckets[i]; - while (p) { - next = p->Next; - func(p, data); - p = next; - } - } -} - -void a_hash_clear(a_hash* hash) -{ - a_hash_iterate(hash, rmItem, NULL); - memset(hash->Buckets, 0, hash->len * sizeof(HashItem*)); -} - -void a_hash_destroy(a_hash* hash) -{ - a_hash_clear(hash); - free(hash); -} - -static HashItem** __a_hash_find(a_hash* hash, const hash_key Key) -{ - int hashIndex = hash->hashFunc(Key) % hash->len; - HashItem** result = &hash->Buckets[hashIndex]; - while (*result) { - if (hash->cmpKeyFunc((*result)->Key, Key)==0) - return result; - else - result = &(*result)->Next; - } - return result; -} - -HashItem* a_hash_find(a_hash* hash, const hash_key Key) -{ - return *__a_hash_find(hash, Key); -} - -HashItem* a_hash_findNext(a_hash* hash, HashItem* item) -{ - hash_key Key = (item) ? item->Key : 0; - if (item) - item = item->Next; - while (item) { - if (hash->cmpKeyFunc(item->Key, Key) == 0) - return item; - else - item = item->Next; - } - return item; -} - -void a_hash_erase(a_hash* hash, const hash_key Key) -{ - HashItem* p; - HashItem** prev = __a_hash_find(hash, Key); - p = *prev; - if (p) { - *prev = p->Next; - rmItem(p, NULL); - } -} - -void __a_meminfo_add(void *ptr, size_t msize, const char *func, int lineno) -{ - MemInfo info; - info.ptr = ptr; - info.lineno = lineno; - info.caller = func; - info.size = msize; - if (!gMem) { - int len = 512; - size_t size = sizeof(HashItem*) * len; - gMem = (a_hash*)malloc(sizeof(a_hash)+size); - memset(gMem, 0, sizeof(a_hash)+size); - gMem->Buckets = (HashItem**)(gMem+1); - gMem->len = len; - - gMem->mkNodeFunc = mkMemInfoItem; - gMem->cmpKeyFunc = cmpMemInfo; - gMem->hashFunc = hashMemInfo; - } - - a_hash_add(gMem, (hash_key)&info); -} - -void a_meminfo_del(void *ptr) -{ - MemInfo info; - info.ptr = ptr; - if (gMem) { - HashItem* p; - HashItem** prev = __a_hash_find(gMem, (unsigned long)&info); - p = *prev; - if (p) { - *prev = p->Next; - rmItem(p, NULL); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Warning! memory ptr %p not found!", __func__, ptr)); - } - } -} - -void* a_mem_alloc(size_t msize, int type, const char *func, int lineno) -{ - void *ptr = kmalloc(msize, type); - __a_meminfo_add(ptr, msize, func, lineno); - return ptr; -} - -void a_mem_free(void *ptr) -{ - a_meminfo_del(ptr); - kfree(ptr); -} - -static void printMemInfo(HashItem *item, void*arg) -{ - MemInfo *info = (MemInfo*)item->Key; - int *total = (int*)arg; - *total += info->size; - A_PRINTF("%s line %d size %d ptr %p\n", info->caller, info->lineno, info->size, info->ptr); -} - -void a_meminfo_report(int clear) -{ - int total = 0; - A_PRINTF("AR6K Memory Report\n"); - if (gMem) { - a_hash_iterate(gMem, printMemInfo, &total); - if (clear) { - a_hash_destroy(gMem); - } - } - A_PRINTF("Total %d bytes\n", total); -} - -A_BOOL a_meminfo_find(void *ptr) -{ - MemInfo info; - info.ptr = ptr; - if (gMem) { - HashItem* p; - HashItem** prev = __a_hash_find(gMem, (unsigned long)&info); - p = *prev; - if (p) { - return TRUE; - } else { - return FALSE; - } - } -} diff --git a/drivers/net/wireless/ar6003/host/os/linux/ar6k_pal.c b/drivers/net/wireless/ar6003/host/os/linux/ar6k_pal.c deleted file mode 100644 index 179a2f05688b..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/ar6k_pal.c +++ /dev/null @@ -1,471 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -/* PAL Transport driver for AR6003 */ - -#include "ar6000_drv.h" -#include -#include -#include - -extern unsigned int setupbtdev; -extern unsigned int loghci; - -#define bt_check_bit(val, bit) (val & bit) -#define bt_set_bit(val, bit) (val |= bit) -#define bt_clear_bit(val, bit) (val &= ~bit) - -/* export ATH_AR6K_DEBUG_HCI_PAL=yes in host/localmake.linux.inc - * to enable debug information */ -#ifdef HCIPAL_DEBUG -#define PRIN_LOG(format, args...) printk(KERN_ALERT "%s:%d - %s Msg:" format "\n",__FUNCTION__, __LINE__, __FILE__, ## args) -#else -#define PRIN_LOG(format, args...) -#endif - - -/*** BT Stack Entrypoints *******/ -/*************************************** - * bt_open - open a handle to the device - ***************************************/ -static int bt_open(struct hci_dev *hdev) -{ - PRIN_LOG("HCI PAL: bt_open - enter - x\n"); - set_bit(HCI_RUNNING, &hdev->flags); - set_bit(HCI_UP, &hdev->flags); - set_bit(HCI_INIT, &hdev->flags); - return 0; -} - -/*************************************** - * bt_close - close handle to the device - ***************************************/ -static int bt_close(struct hci_dev *hdev) -{ - PRIN_LOG("HCI PAL: bt_close - enter\n"); - clear_bit(HCI_RUNNING, &hdev->flags); - return 0; -} - -/***************************** - * bt_ioctl - ioctl processing - *****************************/ -static int bt_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) -{ - PRIN_LOG("HCI PAL: bt_ioctl - enter\n"); - return -ENOIOCTLCMD; -} - -/************************************** - * bt_flush - flush outstanding packets - **************************************/ -static int bt_flush(struct hci_dev *hdev) -{ - PRIN_LOG("HCI PAL: bt_flush - enter\n"); - return 0; -} - -/*************** - * bt_destruct - ***************/ -static void bt_destruct(struct hci_dev *hdev) -{ - PRIN_LOG("HCI PAL: bt_destruct - enter\n"); - /* nothing to do here */ -} - -/**************************************************** - * Invoked from bluetooth stack via hdev->send() - * to send the packet out via ar6k to PAL firmware. - * - * For HCI command packet wmi_send_hci_cmd() is invoked. - * wmi_send_hci_cmd adds WMI_CMD_HDR and sends the packet - * to PAL firmware. - * - * For HCI ACL data packet wmi_data_hdr_add is invoked - * to add WMI_DATA_HDR to the packet. ar6000_acl_data_tx - * is then invoked to send the packet to PAL firmware. - ******************************************************/ -static int btpal_send_frame(struct sk_buff *skb) -{ - struct hci_dev *hdev = (struct hci_dev *)skb->dev; - HCI_TRANSPORT_PACKET_TYPE type; - ar6k_hci_pal_info_t *pHciPalInfo; - A_STATUS status = A_OK; - struct sk_buff *txSkb = NULL; - AR_SOFTC_DEV_T *ar; - - if (!hdev) { - PRIN_LOG("HCI PAL: btpal_send_frame - no device\n"); - return -ENODEV; - } - - if (!test_bit(HCI_RUNNING, &hdev->flags)) { - PRIN_LOG("HCI PAL: btpal_send_frame - not open\n"); - return -EBUSY; - } - - pHciPalInfo = (ar6k_hci_pal_info_t *)hdev->driver_data; - A_ASSERT(pHciPalInfo != NULL); - ar = pHciPalInfo->ar; - - PRIN_LOG("+btpal_send_frame type: %d \n",bt_cb(skb)->pkt_type); - type = HCI_COMMAND_TYPE; - - switch (bt_cb(skb)->pkt_type) { - case HCI_COMMAND_PKT: - type = HCI_COMMAND_TYPE; - hdev->stat.cmd_tx++; - break; - - case HCI_ACLDATA_PKT: - type = HCI_ACL_TYPE; - hdev->stat.acl_tx++; - break; - - case HCI_SCODATA_PKT: - /* we don't support SCO over the pal */ - kfree_skb(skb); - return 0; - default: - A_ASSERT(FALSE); - kfree_skb(skb); - return 0; - } - - if(loghci) { - A_PRINTF(">>> Send HCI %s packet len: %d\n", - (type == HCI_COMMAND_TYPE) ? "COMMAND" : "ACL", - skb->len); - if (type == HCI_COMMAND_TYPE) { - A_PRINTF("HCI Command: OGF:0x%X OCF:0x%X \r\n", - (HCI_GET_OP_CODE(skb->data)) >> 10, - (HCI_GET_OP_CODE(skb->data)) & 0x3FF); - } - DebugDumpBytes(skb->data,skb->len,"BT HCI SEND Packet Dump"); - } - - do { - if(type == HCI_COMMAND_TYPE) - { - PRIN_LOG("HCI command"); - - if (ar->arSoftc->arWmiReady == FALSE) - { - PRIN_LOG("WMI not ready "); - break; - } - - if (wmi_send_hci_cmd(ar->arWmi, skb->data, skb->len) != A_OK) - { - PRIN_LOG("send hci cmd error"); - break; - } - } - else if(type == HCI_ACL_TYPE) - { - void *osbuf; - - PRIN_LOG("ACL data"); - if (ar->arSoftc->arWmiReady == FALSE) - { - PRIN_LOG("WMI not ready"); - break; - } - - /* need to add WMI header so allocate a skb with more space */ - txSkb = bt_skb_alloc(TX_PACKET_RSV_OFFSET + WMI_MAX_TX_META_SZ + - sizeof(WMI_DATA_HDR) + skb->len, - GFP_ATOMIC); - - if (txSkb == NULL) { - status = A_NO_MEMORY; - PRIN_LOG("No memory"); - break; - } - - bt_cb(txSkb)->pkt_type = bt_cb(skb)->pkt_type; - txSkb->dev = (void *)pHciPalInfo->hdev; - skb_reserve(txSkb, TX_PACKET_RSV_OFFSET + WMI_MAX_TX_META_SZ + sizeof(WMI_DATA_HDR)); - A_MEMCPY(txSkb->data, skb->data, skb->len); - skb_put(txSkb,skb->len); - /* Add WMI packet type */ - osbuf = (void *)txSkb; - - PRIN_LOG("\nAdd WMI header"); - if (wmi_data_hdr_add(ar->arWmi, osbuf, DATA_MSGTYPE, 0, WMI_DATA_HDR_DATA_TYPE_ACL,0,NULL) != A_OK) { - PRIN_LOG("XIOCTL_ACL_DATA - wmi_data_hdr_add failed\n"); - } else { - /* Send data buffer over HTC */ - PRIN_LOG("acl data tx"); - ar6000_acl_data_tx(osbuf, ar); - } - txSkb = NULL; - } - } while (FALSE); - - if (txSkb != NULL) { - PRIN_LOG("Free skb"); - kfree_skb(txSkb); - } - kfree_skb(skb); - return 0; -} - - -/*********************************************** - * Unregister HCI device and free HCI device info - ***********************************************/ -static void bt_cleanup_hci_pal(ar6k_hci_pal_info_t *pHciPalInfo) -{ - int err; - - if (bt_check_bit(pHciPalInfo->ulFlags, HCI_REGISTERED)) { - bt_clear_bit(pHciPalInfo->ulFlags, HCI_REGISTERED); - clear_bit(HCI_RUNNING, &pHciPalInfo->hdev->flags); - clear_bit(HCI_UP, &pHciPalInfo->hdev->flags); - clear_bit(HCI_INIT, &pHciPalInfo->hdev->flags); - A_ASSERT(pHciPalInfo->hdev != NULL); -#ifdef CONFIG_BT - /* unregister */ - PRIN_LOG("Unregister PAL device"); - if ((err = hci_unregister_dev(pHciPalInfo->hdev)) < 0) { - PRIN_LOG("HCI PAL: failed to unregister with bluetooth %d\n",err); - } -#else - (void)&err; -#endif - } - - if (pHciPalInfo->hdev != NULL) { - kfree(pHciPalInfo->hdev); - pHciPalInfo->hdev = NULL; - } -} - -/********************************************************* - * Allocate HCI device and store in PAL private info structure. - *********************************************************/ -static A_STATUS bt_setup_hci_pal(ar6k_hci_pal_info_t *pHciPalInfo) -{ -#ifdef CONFIG_BT - A_STATUS status = A_OK; - struct hci_dev *pHciDev = NULL; - -#if 0 //This condition is not required for PAL - if (!setupbtdev) { - return A_OK; - } -#endif - do { - /* allocate a BT HCI struct for this device */ - pHciDev = hci_alloc_dev(); - if (NULL == pHciDev) { - PRIN_LOG("HCI PAL driver - failed to allocate BT HCI struct \n"); - status = A_NO_MEMORY; - break; - } - - /* save the device, we'll register this later */ - pHciPalInfo->hdev = pHciDev; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37) - SET_HCI_BUS_TYPE(pHciDev, HCI_VIRTUAL, HCI_80211); -#else - SET_HCI_BUS_TYPE(pHciDev, HCI_VIRTUAL, HCI_AMP); -#endif - pHciDev->driver_data = pHciPalInfo; - pHciDev->open = bt_open; - pHciDev->close = bt_close; - pHciDev->send = btpal_send_frame; - pHciDev->ioctl = bt_ioctl; - pHciDev->flush = bt_flush; - pHciDev->destruct = bt_destruct; - pHciDev->owner = THIS_MODULE; - /* driver is running in normal BT mode */ - PRIN_LOG("Normal mode enabled"); - bt_set_bit(pHciPalInfo->ulFlags, HCI_NORMAL_MODE); - - } while (FALSE); - - if (A_FAILED(status)) { - bt_cleanup_hci_pal(pHciPalInfo); - } - return status; -#else - (void)&bt_open; - (void)&bt_close; - (void)&btpal_send_frame; - (void)&bt_ioctl; - (void)&bt_flush; - (void)&bt_destruct; - bt_cleanup_hci_pal(pHciPalInfo); - return A_ENOTSUP; -#endif -} - -/********************************************** - * Cleanup HCI device and free HCI PAL private info - *********************************************/ -void ar6k_cleanup_hci_pal(void *ar_p) -{ - AR_SOFTC_DEV_T *ar = (AR_SOFTC_DEV_T *)ar_p; - ar6k_hci_pal_info_t *pHciPalInfo = (ar6k_hci_pal_info_t *)ar->hcipal_info; - - if (pHciPalInfo != NULL) { - bt_cleanup_hci_pal(pHciPalInfo); - A_FREE(pHciPalInfo); - ar->hcipal_info = NULL; - } -} - -/**************************** - * Register HCI device - ****************************/ -static A_BOOL ar6k_pal_transport_ready(void *pHciPal) -{ -#ifdef CONFIG_BT - ar6k_hci_pal_info_t *pHciPalInfo = (ar6k_hci_pal_info_t *)pHciPal; - - PRIN_LOG("HCI device transport ready"); - if(pHciPalInfo == NULL) - return FALSE; - - if (hci_register_dev(pHciPalInfo->hdev) < 0) { - PRIN_LOG("Can't register HCI device"); - hci_free_dev(pHciPalInfo->hdev); - return FALSE; - } - PRIN_LOG("HCI device registered"); - pHciPalInfo->ulFlags |= HCI_REGISTERED; - return TRUE; -#else - return FALSE; -#endif -} - -/************************************************** - * Called from ar6k driver when command or ACL data - * packet is received. Pass the packet to bluetooth - * stack via hci_recv_frame. - **************************************************/ -A_BOOL ar6k_pal_recv_pkt(void *pHciPal, void *osbuf) -{ - struct sk_buff *skb = (struct sk_buff *)osbuf; - ar6k_hci_pal_info_t *pHciPalInfo; - A_BOOL success = FALSE; - A_UINT8 btType = 0; - pHciPalInfo = (ar6k_hci_pal_info_t *)pHciPal; - - do { - - /* if normal mode is not enabled pass on to the stack - * by returning failure */ - if(!(pHciPalInfo->ulFlags & HCI_NORMAL_MODE)) - { - PRIN_LOG("Normal mode not enabled"); - break; - } - - if (!test_bit(HCI_RUNNING, &pHciPalInfo->hdev->flags)) { - PRIN_LOG("HCI PAL: HCI - not running\n"); - break; - } - - if(*((short *)A_NETBUF_DATA(skb)) == WMI_ACL_DATA_EVENTID) - btType = HCI_ACLDATA_PKT; - else - btType = HCI_EVENT_PKT; - /* pull 4 bytes which contains WMI packet type */ - A_NETBUF_PULL(skb, sizeof(int)); - bt_cb(skb)->pkt_type = btType; - skb->dev = (void *)pHciPalInfo->hdev; - - if(loghci) { - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("<<< Recv HCI %s packet len:%d \n", - (btType == HCI_EVENT_TYPE) ? "EVENT" : "ACL", - skb->len)); - DebugDumpBytes(skb->data, skb->len,"BT HCI RECV Packet Dump"); - } - /* pass the received event packet up the stack */ -#ifdef CONFIG_BT - if (hci_recv_frame(skb) != 0) { -#else - if (1) { -#endif - PRIN_LOG("HCI PAL: hci_recv_frame failed \n"); - break; - } else { - PRIN_LOG("HCI PAL: Indicated RCV of type:%d, Length:%d \n",HCI_EVENT_PKT, skb->len); - } - PRIN_LOG("hci recv success"); - success = TRUE; - }while(FALSE); - return success; -} - -/********************************************************** - * HCI PAL init function called from ar6k when it is loaded.. - * Allocates PAL private info, stores the same in ar6k private info. - * Registers a HCI device. - * Registers packet receive callback function with ar6k - **********************************************************/ -A_STATUS ar6k_setup_hci_pal(void *ar_p) -{ - A_STATUS status = A_OK; - ar6k_hci_pal_info_t *pHciPalInfo; - ar6k_pal_config_t ar6k_pal_config; - AR_SOFTC_DEV_T *ar = (AR_SOFTC_DEV_T *)ar_p; - - do { - - pHciPalInfo = (ar6k_hci_pal_info_t *)A_MALLOC(sizeof(ar6k_hci_pal_info_t)); - - if (NULL == pHciPalInfo) { - status = A_NO_MEMORY; - break; - } - - A_MEMZERO(pHciPalInfo, sizeof(ar6k_hci_pal_info_t)); - ar->hcipal_info = pHciPalInfo; - pHciPalInfo->ar = ar; - - status = bt_setup_hci_pal(pHciPalInfo); - if (A_FAILED(status)) { - break; - } - - if(bt_check_bit(pHciPalInfo->ulFlags, HCI_NORMAL_MODE)) - PRIN_LOG("HCI PAL: running in normal mode... \n"); - else - PRIN_LOG("HCI PAL: running in test mode... \n"); - - ar6k_pal_config.fpar6k_pal_recv_pkt = ar6k_pal_recv_pkt; - register_pal_cb(&ar6k_pal_config); - ar6k_pal_transport_ready(ar->hcipal_info); - } while (FALSE); - - if (A_FAILED(status)) { - ar6k_cleanup_hci_pal(ar); - } - return status; -} diff --git a/drivers/net/wireless/ar6003/host/os/linux/cfg80211.c b/drivers/net/wireless/ar6003/host/os/linux/cfg80211.c deleted file mode 100644 index 97f6979028dd..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/cfg80211.c +++ /dev/null @@ -1,1638 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -#include -#include -#include -#include -#include - -#include "ar6000_drv.h" - - -extern unsigned int wmitimeout; -extern int reconnect_flag; - - -#define RATETAB_ENT(_rate, _rateid, _flags) { \ - .bitrate = (_rate), \ - .flags = (_flags), \ - .hw_value = (_rateid), \ -} - -#define CHAN2G(_channel, _freq, _flags) { \ - .band = IEEE80211_BAND_2GHZ, \ - .hw_value = (_channel), \ - .center_freq = (_freq), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -#define CHAN5G(_channel, _flags) { \ - .band = IEEE80211_BAND_5GHZ, \ - .hw_value = (_channel), \ - .center_freq = 5000 + (5 * (_channel)), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -static struct -ieee80211_rate ar6k_rates[] = { - RATETAB_ENT(10, 0x1, 0), - RATETAB_ENT(20, 0x2, 0), - RATETAB_ENT(55, 0x4, 0), - RATETAB_ENT(110, 0x8, 0), - RATETAB_ENT(60, 0x10, 0), - RATETAB_ENT(90, 0x20, 0), - RATETAB_ENT(120, 0x40, 0), - RATETAB_ENT(180, 0x80, 0), - RATETAB_ENT(240, 0x100, 0), - RATETAB_ENT(360, 0x200, 0), - RATETAB_ENT(480, 0x400, 0), - RATETAB_ENT(540, 0x800, 0), -}; - -#define ar6k_a_rates (ar6k_rates + 4) -#define ar6k_a_rates_size 8 -#define ar6k_g_rates (ar6k_rates + 0) -#define ar6k_g_rates_size 12 - -static struct -ieee80211_channel ar6k_2ghz_channels[] = { - CHAN2G(1, 2412, 0), - CHAN2G(2, 2417, 0), - CHAN2G(3, 2422, 0), - CHAN2G(4, 2427, 0), - CHAN2G(5, 2432, 0), - CHAN2G(6, 2437, 0), - CHAN2G(7, 2442, 0), - CHAN2G(8, 2447, 0), - CHAN2G(9, 2452, 0), - CHAN2G(10, 2457, 0), - CHAN2G(11, 2462, 0), - CHAN2G(12, 2467, 0), - CHAN2G(13, 2472, 0), - CHAN2G(14, 2484, 0), -}; - -static struct -ieee80211_channel ar6k_5ghz_a_channels[] = { - CHAN5G(34, 0), CHAN5G(36, 0), - CHAN5G(38, 0), CHAN5G(40, 0), - CHAN5G(42, 0), CHAN5G(44, 0), - CHAN5G(46, 0), CHAN5G(48, 0), - CHAN5G(52, 0), CHAN5G(56, 0), - CHAN5G(60, 0), CHAN5G(64, 0), - CHAN5G(100, 0), CHAN5G(104, 0), - CHAN5G(108, 0), CHAN5G(112, 0), - CHAN5G(116, 0), CHAN5G(120, 0), - CHAN5G(124, 0), CHAN5G(128, 0), - CHAN5G(132, 0), CHAN5G(136, 0), - CHAN5G(140, 0), CHAN5G(149, 0), - CHAN5G(153, 0), CHAN5G(157, 0), - CHAN5G(161, 0), CHAN5G(165, 0), - CHAN5G(184, 0), CHAN5G(188, 0), - CHAN5G(192, 0), CHAN5G(196, 0), - CHAN5G(200, 0), CHAN5G(204, 0), - CHAN5G(208, 0), CHAN5G(212, 0), - CHAN5G(216, 0), -}; - -static struct -ieee80211_supported_band ar6k_band_2ghz = { - .n_channels = ARRAY_SIZE(ar6k_2ghz_channels), - .channels = ar6k_2ghz_channels, - .n_bitrates = ar6k_g_rates_size, - .bitrates = ar6k_g_rates, -}; - -static struct -ieee80211_supported_band ar6k_band_5ghz = { - .n_channels = ARRAY_SIZE(ar6k_5ghz_a_channels), - .channels = ar6k_5ghz_a_channels, - .n_bitrates = ar6k_a_rates_size, - .bitrates = ar6k_a_rates, -}; - -static int -ar6k_set_wpa_version(AR_SOFTC_DEV_T *arPriv, enum nl80211_wpa_versions wpa_version) -{ - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: %u\n", __func__, wpa_version)); - - if (!wpa_version) { - arPriv->arAuthMode = WMI_NONE_AUTH; - } else if (wpa_version & NL80211_WPA_VERSION_1) { - arPriv->arAuthMode = WMI_WPA_AUTH; - } else if (wpa_version & NL80211_WPA_VERSION_2) { - arPriv->arAuthMode = WMI_WPA2_AUTH; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("%s: %u not spported\n", __func__, wpa_version)); - return -ENOTSUPP; - } - - return A_OK; -} - -static int -ar6k_set_auth_type(AR_SOFTC_DEV_T *arPriv, enum nl80211_auth_type auth_type) -{ - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: 0x%x\n", __func__, auth_type)); - - switch (auth_type) { - case NL80211_AUTHTYPE_OPEN_SYSTEM: - arPriv->arDot11AuthMode = OPEN_AUTH; - break; - case NL80211_AUTHTYPE_SHARED_KEY: - arPriv->arDot11AuthMode = SHARED_AUTH; - break; - case NL80211_AUTHTYPE_NETWORK_EAP: - arPriv->arDot11AuthMode = LEAP_AUTH; - break; - default: - arPriv->arDot11AuthMode = OPEN_AUTH; - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("%s: 0x%x not spported\n", __func__, auth_type)); - return -ENOTSUPP; - } - - return A_OK; -} - -static int -ar6k_set_cipher(AR_SOFTC_DEV_T *arPriv, A_UINT32 cipher, A_BOOL ucast) -{ - A_UINT8 *ar_cipher = ucast ? &arPriv->arPairwiseCrypto : - &arPriv->arGroupCrypto; - A_UINT8 *ar_cipher_len = ucast ? &arPriv->arPairwiseCryptoLen : - &arPriv->arGroupCryptoLen; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("%s: cipher 0x%x, ucast %u\n", __func__, cipher, ucast)); - - switch (cipher) { - case 0: - case IW_AUTH_CIPHER_NONE: - *ar_cipher = NONE_CRYPT; - *ar_cipher_len = 0; - break; - case WLAN_CIPHER_SUITE_WEP40: - *ar_cipher = WEP_CRYPT; - *ar_cipher_len = 5; - break; - case WLAN_CIPHER_SUITE_WEP104: - *ar_cipher = WEP_CRYPT; - *ar_cipher_len = 13; - break; - case WLAN_CIPHER_SUITE_TKIP: -#ifdef CFG80211_WAPI_ENABLE - *ar_cipher = WAPI_CRYPT; -#else - *ar_cipher = TKIP_CRYPT; -#endif - *ar_cipher_len = 0; - break; - case WLAN_CIPHER_SUITE_CCMP: - *ar_cipher = AES_CRYPT; - *ar_cipher_len = 0; - break; - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("%s: cipher 0x%x not supported\n", __func__, cipher)); - return -ENOTSUPP; - } - - return A_OK; -} - -static void -ar6k_set_key_mgmt(AR_SOFTC_DEV_T *arPriv, A_UINT32 key_mgmt) -{ - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: 0x%x\n", __func__, key_mgmt)); - - if (WLAN_AKM_SUITE_PSK == key_mgmt) { - if (WMI_WPA_AUTH == arPriv->arAuthMode) { - arPriv->arAuthMode = WMI_WPA_PSK_AUTH; - } else if (WMI_WPA2_AUTH == arPriv->arAuthMode) { - arPriv->arAuthMode = WMI_WPA2_PSK_AUTH; - } - } else if (WLAN_AKM_SUITE_8021X != key_mgmt) { - arPriv->arAuthMode = WMI_NONE_AUTH; - } -} - -static int -ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_connect_params *sme) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - A_STATUS status; -#ifdef CFG80211_WAPI_ENABLE - const unsigned char wps_oui[] = { 0x00, 0x50, 0xf2, 0x04 }; - const unsigned char wpa_oui[] = { 0x00, 0x50, 0xf2, 0x01 }; - unsigned char *ie = sme->ie; -#endif - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready yet\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - if(ar->bIsDestroyProgress) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: destroy in progress\n", __func__)); - return -EBUSY; - } - - if(!sme->ssid_len || IEEE80211_MAX_SSID_LEN < sme->ssid_len) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: ssid invalid\n", __func__)); - return -EINVAL; - } - - if(arSta->arSkipScan == TRUE && - ((sme->channel && sme->channel->center_freq == 0) || - (sme->bssid && !sme->bssid[0] && !sme->bssid[1] && !sme->bssid[2] && - !sme->bssid[3] && !sme->bssid[4] && !sme->bssid[5]))) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s:SkipScan: channel or bssid invalid\n", __func__)); - return -EINVAL; - } - - if(down_interruptible(&ar->arSem)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: busy, couldn't get access\n", __func__)); - return -ERESTARTSYS; - } - - if(ar->bIsDestroyProgress) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: busy, destroy in progress\n", __func__)); - up(&ar->arSem); - return -EBUSY; - } - - if(ar->arTxPending[wmi_get_control_ep(arPriv->arWmi)]) { - /* - * sleep until the command queue drains - */ - wait_event_interruptible_timeout(arPriv->arEvent, - ar->arTxPending[wmi_get_control_ep(arPriv->arWmi)] == 0, wmitimeout * HZ); - if (signal_pending(current)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: cmd queue drain timeout\n", __func__)); - up(&ar->arSem); - return -EINTR; - } - } - up(&ar->arSem); - - if(down_interruptible(&ar->arSem)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: busy, couldn't get access\n", __func__)); - return -ERESTARTSYS; - } - - if(arPriv->arConnected == TRUE && - arPriv->arSsidLen == sme->ssid_len && - !A_MEMCMP(arPriv->arSsid, sme->ssid, arPriv->arSsidLen)) { - reconnect_flag = TRUE; - status = wmi_reconnect_cmd(arPriv->arWmi, - arSta->arReqBssid, - arPriv->arChannelHint); - - if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_reconnect_cmd failed\n", __func__)); - return -EIO; - } - return 0; - } else if(arPriv->arSsidLen == sme->ssid_len && - !A_MEMCMP(arPriv->arSsid, sme->ssid, arPriv->arSsidLen)) { - ar6000_disconnect(arPriv); - } - - A_MEMZERO(arPriv->arSsid, sizeof(arPriv->arSsid)); - arPriv->arSsidLen = sme->ssid_len; - A_MEMCPY(arPriv->arSsid, sme->ssid, sme->ssid_len); - - if(sme->channel){ - arPriv->arChannelHint = sme->channel->center_freq; - } - - A_MEMZERO(arSta->arReqBssid, sizeof(arSta->arReqBssid)); - if(sme->bssid){ - if(A_MEMCMP(&sme->bssid, bcast_mac, AR6000_ETH_ADDR_LEN)) { - A_MEMCPY(arSta->arReqBssid, sme->bssid, sizeof(arSta->arReqBssid)); - } - } - - ar6k_set_wpa_version(arPriv, sme->crypto.wpa_versions); - ar6k_set_auth_type(arPriv, sme->auth_type); - - if(sme->crypto.n_ciphers_pairwise) { - ar6k_set_cipher(arPriv, sme->crypto.ciphers_pairwise[0], true); - } else { - ar6k_set_cipher(arPriv, IW_AUTH_CIPHER_NONE, true); - } - ar6k_set_cipher(arPriv, sme->crypto.cipher_group, false); - - if(sme->crypto.n_akm_suites) { - ar6k_set_key_mgmt(arPriv, sme->crypto.akm_suites[0]); - } - - if((sme->key_len) && - (WMI_NONE_AUTH == arPriv->arAuthMode) && - (WEP_CRYPT == arPriv->arPairwiseCrypto)) { - struct ar_key *key = NULL; - - if(sme->key_idx < WMI_MIN_KEY_INDEX || sme->key_idx > WMI_MAX_KEY_INDEX) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("%s: key index %d out of bounds\n", __func__, sme->key_idx)); - up(&ar->arSem); - return -ENOENT; - } - - key = &arPriv->keys[sme->key_idx]; - key->key_len = sme->key_len; - A_MEMCPY(key->key, sme->key, key->key_len); - key->cipher = arPriv->arPairwiseCrypto; - arPriv->arDefTxKeyIndex = sme->key_idx; - - wmi_addKey_cmd(arPriv->arWmi, sme->key_idx, - arPriv->arPairwiseCrypto, - GROUP_USAGE | TX_USAGE, - key->key_len, - NULL, - key->key, KEY_OP_INIT_VAL, NULL, - NO_SYNC_WMIFLAG); - } - - if (!arSta->arUserBssFilter) { - if (wmi_bssfilter_cmd(arPriv->arWmi, ALL_BSS_FILTER, 0) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Couldn't set bss filtering\n", __func__)); - up(&ar->arSem); - return -EIO; - } - } - - arPriv->arNetworkType = arPriv->arNextMode; - -#ifdef CFG80211_WAPI_ENABLE -/*the following codes for wps and wapi, but ONLY test wapi*/ - if (ie[0] == WLAN_EID_VENDOR_SPECIFIC && - memcmp(ie + 2, wps_oui, sizeof(wps_oui)) == 0) { - /* WPS IE detected, notify target */ - A_PRINTF("WPS IE detected -- setting WPS flag\n"); - arPriv->arSta.arConnectCtrlFlags |= CONNECT_WPS_FLAG; - arPriv->arAuthMode = 0; - } else { - if ((ie[0]==IEEE80211_ELEMID_RSN) || - (ie[0]==IEEE80211_ELEMID_VENDOR && - memcmp(&ie[2], wpa_oui, sizeof(wpa_oui))==0)) { - sme->ie_len = 0; /* Firmware will set for us. Clear the previous one */ - } - /* for WAPI */ - else if (ie[0]==IEEE80211_ELEMID_WAPI) - { - } - /************/ - arPriv->arSta.arConnectCtrlFlags &= ~CONNECT_WPS_FLAG; - } - wmi_set_appie_cmd(arPriv->arWmi, WMI_FRAME_ASSOC_REQ, sme->ie_len, ie); -/*********************************************************/ -#endif - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: Connect called with authmode %d dot11 auth %d"\ - " PW crypto %d PW crypto Len %d GRP crypto %d"\ - " GRP crypto Len %d channel hint %u\n", - __func__, arPriv->arAuthMode, arPriv->arDot11AuthMode, - arPriv->arPairwiseCrypto, arPriv->arPairwiseCryptoLen, - arPriv->arGroupCrypto, arPriv->arGroupCryptoLen, arPriv->arChannelHint)); - reconnect_flag = 0; - status = wmi_connect_cmd(arPriv->arWmi, arPriv->arNetworkType, - arPriv->arDot11AuthMode, arPriv->arAuthMode, - arPriv->arPairwiseCrypto, arPriv->arPairwiseCryptoLen, - arPriv->arGroupCrypto,arPriv->arGroupCryptoLen, - arPriv->arSsidLen, arPriv->arSsid, - arSta->arReqBssid, arPriv->arChannelHint, - arSta->arConnectCtrlFlags); - - up(&ar->arSem); - - if (A_EINVAL == status) { - A_MEMZERO(arPriv->arSsid, sizeof(arPriv->arSsid)); - arPriv->arSsidLen = 0; - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Invalid request\n", __func__)); - return -ENOENT; - } else if (status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_connect_cmd failed\n", __func__)); - return -EIO; - } - - if ((!(arSta->arConnectCtrlFlags & CONNECT_DO_WPA_OFFLOAD)) && - ((WMI_WPA_PSK_AUTH == arPriv->arAuthMode) || (WMI_WPA2_PSK_AUTH == arPriv->arAuthMode))) - { - A_TIMEOUT_MS(&arSta->disconnect_timer, A_DISCONNECT_TIMER_INTERVAL, 0); - } - - arSta->arConnectCtrlFlags &= ~CONNECT_DO_WPA_OFFLOAD; - arSta->arConnectPending = TRUE; - - return 0; -} - -void -ar6k_cfg80211_connect_event(AR_SOFTC_DEV_T *arPriv, A_UINT16 channel, - A_UINT8 *bssid, A_UINT16 listenInterval, - A_UINT16 beaconInterval,NETWORK_TYPE networkType, - A_UINT8 beaconIeLen, A_UINT8 assocReqLen, - A_UINT8 assocRespLen, A_UINT8 *assocInfo) -{ - A_UINT16 size = 0; - A_UINT16 capability = 0; - struct cfg80211_bss *bss = NULL; - struct ieee80211_mgmt *mgmt = NULL; - struct ieee80211_channel *ibss_channel = NULL; - s32 signal = 50 * 100; - A_UINT8 ie_buf_len = 0; - unsigned char ie_buf[256]; - unsigned char *ptr_ie_buf = ie_buf; - unsigned char *ieeemgmtbuf = NULL; - A_UINT8 source_mac[ATH_MAC_LEN]; - - A_UINT8 assocReqIeOffset = sizeof(A_UINT16) + /* capinfo*/ - sizeof(A_UINT16); /* listen interval */ - A_UINT8 assocRespIeOffset = sizeof(A_UINT16) + /* capinfo*/ - sizeof(A_UINT16) + /* status Code */ - sizeof(A_UINT16); /* associd */ - A_UINT8 *assocReqIe = assocInfo + beaconIeLen + assocReqIeOffset; - A_UINT8 *assocRespIe = assocInfo + beaconIeLen + assocReqLen + assocRespIeOffset; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__)); - - assocReqLen -= assocReqIeOffset; - assocRespLen -= assocRespIeOffset; - - if((ADHOC_NETWORK & networkType)) { - if(NL80211_IFTYPE_ADHOC != arPriv->wdev->iftype) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("%s: ath6k not in ibss mode\n", __func__)); - return; - } - } - - if((INFRA_NETWORK & networkType)) { - if(NL80211_IFTYPE_STATION != arPriv->wdev->iftype) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("%s: ath6k not in station mode\n", __func__)); - return; - } - } - - /* Before informing the join/connect event, make sure that - * bss entry is present in scan list, if it not present - * construct and insert into scan list, otherwise that - * event will be dropped on the way by cfg80211, due to - * this keys will not be plumbed in case of WEP and - * application will not be aware of join/connect status. */ - bss = cfg80211_get_bss(arPriv->wdev->wiphy, NULL, bssid, - arPriv->wdev->ssid, arPriv->wdev->ssid_len, - ((ADHOC_NETWORK & networkType) ? WLAN_CAPABILITY_IBSS : WLAN_CAPABILITY_ESS), - ((ADHOC_NETWORK & networkType) ? WLAN_CAPABILITY_IBSS : WLAN_CAPABILITY_ESS)); - - if(!bss) { - if (ADHOC_NETWORK & networkType) { - /* construct 802.11 mgmt beacon */ - if(ptr_ie_buf) { - *ptr_ie_buf++ = WLAN_EID_SSID; - *ptr_ie_buf++ = arPriv->arSsidLen; - A_MEMCPY(ptr_ie_buf, arPriv->arSsid, arPriv->arSsidLen); - ptr_ie_buf +=arPriv->arSsidLen; - - *ptr_ie_buf++ = WLAN_EID_IBSS_PARAMS; - *ptr_ie_buf++ = 2; /* length */ - *ptr_ie_buf++ = 0; /* ATIM window */ - *ptr_ie_buf++ = 0; /* ATIM window */ - - /* TODO: update ibss params and include supported rates, - * DS param set, extened support rates, wmm. */ - - ie_buf_len = ptr_ie_buf - ie_buf; - } - - capability |= IEEE80211_CAPINFO_IBSS; - if(WEP_CRYPT == arPriv->arPairwiseCrypto) { - capability |= IEEE80211_CAPINFO_PRIVACY; - } - A_MEMCPY(source_mac, arPriv->arNetDev->dev_addr, ATH_MAC_LEN); - ptr_ie_buf = ie_buf; - } else { - capability = *(A_UINT16 *)(&assocInfo[beaconIeLen]); - A_MEMCPY(source_mac, bssid, ATH_MAC_LEN); - ptr_ie_buf = assocReqIe; - ie_buf_len = assocReqLen; - } - - size = offsetof(struct ieee80211_mgmt, u) - + sizeof(mgmt->u.beacon) - + ie_buf_len; - - ieeemgmtbuf = A_MALLOC_NOWAIT(size); - if(!ieeemgmtbuf) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("%s: ieeeMgmtbuf alloc error\n", __func__)); - return; - } - - A_MEMZERO(ieeemgmtbuf, size); - mgmt = (struct ieee80211_mgmt *)ieeemgmtbuf; - mgmt->frame_control = (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); - A_MEMCPY(mgmt->da, bcast_mac, ATH_MAC_LEN); - A_MEMCPY(mgmt->sa, source_mac, ATH_MAC_LEN); - A_MEMCPY(mgmt->bssid, bssid, ATH_MAC_LEN); - mgmt->u.beacon.beacon_int = beaconInterval; - mgmt->u.beacon.capab_info = capability; - A_MEMCPY(mgmt->u.beacon.variable, ptr_ie_buf, ie_buf_len); - - ibss_channel = ieee80211_get_channel(arPriv->wdev->wiphy, (int)channel); - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("%s: inform bss with bssid %02x:%02x:%02x:%02x:%02x:%02x "\ - "channel %d beaconInterval %d capability 0x%x\n", - __func__, - mgmt->bssid[0], mgmt->bssid[1], mgmt->bssid[2], - mgmt->bssid[3], mgmt->bssid[4], mgmt->bssid[5], - ibss_channel->hw_value, beaconInterval, capability)); - - bss = cfg80211_inform_bss_frame(arPriv->wdev->wiphy, - ibss_channel, mgmt, - le16_to_cpu(size), - signal, GFP_ATOMIC); - A_FREE(ieeemgmtbuf); - cfg80211_put_bss(bss); - } - - if((ADHOC_NETWORK & networkType)) { - cfg80211_ibss_joined(arPriv->arNetDev, bssid, GFP_ATOMIC); - return; - } - - if (FALSE == arPriv->arConnected) { - /* inform connect result to cfg80211 */ - cfg80211_connect_result(arPriv->arNetDev, bssid, - assocReqIe, assocReqLen, - assocRespIe, assocRespLen, - WLAN_STATUS_SUCCESS, GFP_ATOMIC); - } else { - /* inform roam event to cfg80211 */ - cfg80211_roamed(arPriv->arNetDev, bssid, - assocReqIe, assocReqLen, - assocRespIe, assocRespLen, - GFP_ATOMIC); - } -} - -static int -ar6k_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, - A_UINT16 reason_code) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: reason=%u\n", __func__, reason_code)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - if(ar->bIsDestroyProgress) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: busy, destroy in progress\n", __func__)); - return -EBUSY; - } - - if(down_interruptible(&ar->arSem)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: busy, couldn't get access\n", __func__)); - return -ERESTARTSYS; - } - - reconnect_flag = 0; - ar6000_disconnect(arPriv); - A_MEMZERO(arPriv->arSsid, sizeof(arPriv->arSsid)); - arPriv->arSsidLen = 0; - - if (arPriv->arSta.arSkipScan == FALSE) { - A_MEMZERO(arPriv->arSta.arReqBssid, sizeof(arPriv->arSta.arReqBssid)); - } - - up(&ar->arSem); - - return 0; -} - -void -ar6k_cfg80211_disconnect_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 reason, - A_UINT8 *bssid, A_UINT8 assocRespLen, - A_UINT8 *assocInfo, A_UINT16 protocolReasonStatus) -{ - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: reason=%u\n", __func__, reason)); - - if((ADHOC_NETWORK & arPriv->arNetworkType)) { - if(NL80211_IFTYPE_ADHOC != arPriv->wdev->iftype) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("%s: ath6k not in ibss mode\n", __func__)); - return; - } - A_MEMZERO(bssid, ETH_ALEN); - cfg80211_ibss_joined(arPriv->arNetDev, bssid, GFP_ATOMIC); - return; - } - - if((INFRA_NETWORK & arPriv->arNetworkType)) { - if(NL80211_IFTYPE_STATION != arPriv->wdev->iftype) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("%s: ath6k not in station mode\n", __func__)); - return; - } - } - - if(FALSE == arPriv->arConnected) { - if(NO_NETWORK_AVAIL == reason) { - /* connect cmd failed */ - cfg80211_connect_result(arPriv->arNetDev, bssid, - NULL, 0, - NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, - GFP_ATOMIC); - } - } else { - /* connection loss due to disconnect cmd or low rssi */ - cfg80211_disconnected(arPriv->arNetDev, reason, NULL, 0, GFP_ATOMIC); - } -} - -void -ar6k_cfg80211_scan_node(void *arg, bss_t *ni) -{ - struct wiphy *wiphy = (struct wiphy *)arg; - A_UINT16 size; - unsigned char *ieeemgmtbuf = NULL; - struct ieee80211_mgmt *mgmt; - struct ieee80211_channel *channel; - struct ieee80211_supported_band *band; - struct ieee80211_common_ie *cie; - s32 signal; - int freq; - - cie = &ni->ni_cie; - -#define CHAN_IS_11A(x) (!((x >= 2412) && (x <= 2484))) - if(CHAN_IS_11A(cie->ie_chan)) { - /* 11a */ - band = wiphy->bands[IEEE80211_BAND_5GHZ]; - } else if((cie->ie_erp) || (cie->ie_xrates)) { - /* 11g */ - band = wiphy->bands[IEEE80211_BAND_2GHZ]; - } else { - /* 11b */ - band = wiphy->bands[IEEE80211_BAND_2GHZ]; - } - - size = ni->ni_framelen + offsetof(struct ieee80211_mgmt, u); - ieeemgmtbuf = A_MALLOC_NOWAIT(size); - if(!ieeemgmtbuf) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: ieeeMgmtbuf alloc error\n", __func__)); - return; - } - - /* Note: - TODO: Update target to include 802.11 mac header while sending bss info. - Target removes 802.11 mac header while sending the bss info to host, - cfg80211 needs it, for time being just filling the da, sa and bssid fields alone. - */ - mgmt = (struct ieee80211_mgmt *)ieeemgmtbuf; - A_MEMCPY(mgmt->da, bcast_mac, ATH_MAC_LEN); - A_MEMCPY(mgmt->sa, ni->ni_macaddr, ATH_MAC_LEN); - A_MEMCPY(mgmt->bssid, ni->ni_macaddr, ATH_MAC_LEN); - A_MEMCPY(ieeemgmtbuf + offsetof(struct ieee80211_mgmt, u), - ni->ni_buf, ni->ni_framelen); - - freq = cie->ie_chan; - channel = ieee80211_get_channel(wiphy, freq); - signal = ni->ni_snr * 100; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("%s: bssid %02x:%02x:%02x:%02x:%02x:%02x channel %d freq %d size %d\n", - __func__, - mgmt->bssid[0], mgmt->bssid[1], mgmt->bssid[2], - mgmt->bssid[3], mgmt->bssid[4], mgmt->bssid[5], - channel->hw_value, freq, size)); - cfg80211_inform_bss_frame(wiphy, channel, mgmt, - le16_to_cpu(size), - signal, GFP_ATOMIC); - - A_FREE (ieeemgmtbuf); -} - -static int -ar6k_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_scan_request *request) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(ndev); - AR_SOFTC_T *ar = arPriv->arSoftc; - int ret = 0; - A_BOOL forceFgScan = FALSE; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - if (!arPriv->arSta.arUserBssFilter) { - if (wmi_bssfilter_cmd(arPriv->arWmi, - (arPriv->arConnected ? ALL_BUT_BSS_FILTER : ALL_BSS_FILTER), - 0) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Couldn't set bss filtering\n", __func__)); - return -EIO; - } - } - - if(request->n_ssids && - request->ssids[0].ssid_len) { - A_UINT8 i; - - if(request->n_ssids > MAX_PROBED_SSID_INDEX) { - request->n_ssids = MAX_PROBED_SSID_INDEX; - } - - for (i = 0; i < request->n_ssids; i++) { - wmi_probedSsid_cmd(arPriv->arWmi, i, SPECIFIC_SSID_FLAG, - request->ssids[i].ssid_len, - request->ssids[i].ssid); - } - } - - if(arPriv->arConnected) { - forceFgScan = TRUE; - } - - if(wmi_startscan_cmd(arPriv->arWmi, WMI_LONG_SCAN, forceFgScan, FALSE, \ - 0, 0, 0, NULL) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_startscan_cmd failed\n", __func__)); - ret = -EIO; - } - - arPriv->scan_request = request; - - return ret; -} - -void -ar6k_cfg80211_scanComplete_event(AR_SOFTC_DEV_T *arPriv, A_STATUS status) -{ - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: status %d\n", __func__, status)); - - if(arPriv->scan_request) - { - /* Translate data to cfg80211 mgmt format */ - wmi_iterate_nodes(arPriv->arWmi, ar6k_cfg80211_scan_node, arPriv->wdev->wiphy); - - cfg80211_scan_done(arPriv->scan_request, - (status & A_ECANCELED) ? true : false); - - if(arPriv->scan_request->n_ssids && - arPriv->scan_request->ssids[0].ssid_len) { - A_UINT8 i; - - for (i = 0; i < arPriv->scan_request->n_ssids; i++) { - wmi_probedSsid_cmd(arPriv->arWmi, i, DISABLE_SSID_FLAG, - 0, NULL); - } - } - arPriv->scan_request = NULL; - } -} - -static int -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) -ar6k_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, - A_UINT8 key_index, bool pairwise, const A_UINT8 *mac_addr, - struct key_params *params) -#else -ar6k_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, - A_UINT8 key_index, const A_UINT8 *mac_addr, - struct key_params *params) -#endif -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(ndev); - AR_SOFTC_T *ar = arPriv->arSoftc; - struct ar_key *key = NULL; - A_UINT8 key_usage; - A_UINT8 key_type; - A_STATUS status = 0; -#ifdef CFG80211_WAPI_ENABLE - A_UINT32 *PN; - A_INT32 i; - A_UINT8 wapiKeyRsc[16] = {0}; - #define PN_INIT 0x5c365c36 -#endif - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s:\n", __func__)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - if(key_index < WMI_MIN_KEY_INDEX || key_index > WMI_MAX_KEY_INDEX) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("%s: key index %d out of bounds\n", __func__, key_index)); - return -ENOENT; - } - - key = &arPriv->keys[key_index]; - A_MEMZERO(key, sizeof(struct ar_key)); - - if(!mac_addr || is_broadcast_ether_addr(mac_addr)) { - key_usage = GROUP_USAGE; - } else { - key_usage = PAIRWISE_USAGE; - } - - if(params) { - if(params->key_len > WLAN_MAX_KEY_LEN || - params->seq_len > IW_ENCODE_SEQ_MAX_SIZE) - return -EINVAL; - - key->key_len = params->key_len; - A_MEMCPY(key->key, params->key, key->key_len); - key->seq_len = params->seq_len; - A_MEMCPY(key->seq, params->seq, key->seq_len); - key->cipher = params->cipher; - } - - switch (key->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - key_type = WEP_CRYPT; - break; - - case WLAN_CIPHER_SUITE_TKIP: - key_type = TKIP_CRYPT; - break; - - case WLAN_CIPHER_SUITE_CCMP: - key_type = AES_CRYPT; - break; - - default: - return -ENOTSUPP; - } - - if (((WMI_WPA_PSK_AUTH == arPriv->arAuthMode) || (WMI_WPA2_PSK_AUTH == arPriv->arAuthMode)) && - (GROUP_USAGE & key_usage)) - { - A_UNTIMEOUT(&arPriv->arSta.disconnect_timer); - } - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("%s: index %d, key_len %d, key_type 0x%x,"\ - " key_usage 0x%x, seq_len %d\n", - __func__, key_index, key->key_len, key_type, - key_usage, key->seq_len)); - arPriv->arDefTxKeyIndex = key_index; - -#ifdef CFG80211_WAPI_ENABLE - key_type = WAPI_CRYPT; - key_usage = 0; - if (is_broadcast_ether_addr(mac_addr)) { - key_usage |= GROUP_USAGE; - PN = (A_UINT32 *)wapiKeyRsc; - for (i = 0; i < 4; i++) { - PN[i] = PN_INIT; - } - } else { - key_usage |= PAIRWISE_USAGE; - } - status = wmi_addKey_cmd(arPriv->arWmi, arPriv->arDefTxKeyIndex, key_type, key_usage, - key->key_len, wapiKeyRsc, key->key, KEY_OP_INIT_VAL, - (A_UINT8*)mac_addr, SYNC_BOTH_WMIFLAG); -#else - status = wmi_addKey_cmd(arPriv->arWmi, arPriv->arDefTxKeyIndex, key_type, key_usage, - key->key_len, key->seq, key->key, KEY_OP_INIT_VAL, - (A_UINT8*)mac_addr, SYNC_BOTH_WMIFLAG); -#endif - - - if(status != A_OK) { - return -EIO; - } - - return 0; -} - -static int -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) -ar6k_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, - A_UINT8 key_index, bool pairwise, const A_UINT8 *mac_addr) -#else -ar6k_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, - A_UINT8 key_index, const A_UINT8 *mac_addr) -#endif -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(ndev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: index %d\n", __func__, key_index)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - if(key_index < WMI_MIN_KEY_INDEX || key_index > WMI_MAX_KEY_INDEX) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("%s: key index %d out of bounds\n", __func__, key_index)); - return -ENOENT; - } - - if(!arPriv->keys[key_index].key_len) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: index %d is empty\n", __func__, key_index)); - return 0; - } - - arPriv->keys[key_index].key_len = 0; - - return wmi_deleteKey_cmd(arPriv->arWmi, key_index); -} - - -static int -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) -ar6k_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, - A_UINT8 key_index, bool pairwise, const A_UINT8 *mac_addr, - void *cookie, - void (*callback)(void *cookie, struct key_params*)) -#else -ar6k_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, - A_UINT8 key_index, const A_UINT8 *mac_addr, void *cookie, - void (*callback)(void *cookie, struct key_params*)) -#endif -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(ndev); - AR_SOFTC_T *ar = arPriv->arSoftc; - struct ar_key *key = NULL; - struct key_params params; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: index %d\n", __func__, key_index)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - if(key_index < WMI_MIN_KEY_INDEX || key_index > WMI_MAX_KEY_INDEX) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("%s: key index %d out of bounds\n", __func__, key_index)); - return -ENOENT; - } - - key = &arPriv->keys[key_index]; - A_MEMZERO(¶ms, sizeof(params)); - params.cipher = key->cipher; - params.key_len = key->key_len; - params.seq_len = key->seq_len; - params.seq = key->seq; - params.key = key->key; - - callback(cookie, ¶ms); - - return key->key_len ? 0 : -ENOENT; -} - - -static int -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) -ar6k_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *ndev, - A_UINT8 key_index,bool unicast, bool multicast) -#else -ar6k_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *ndev, - A_UINT8 key_index) -#endif -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(ndev); - AR_SOFTC_T *ar = arPriv->arSoftc; - struct ar_key *key = NULL; - A_STATUS status = A_OK; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: index %d\n", __func__, key_index)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - if(key_index < WMI_MIN_KEY_INDEX || key_index > WMI_MAX_KEY_INDEX) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("%s: key index %d out of bounds\n", - __func__, key_index)); - return -ENOENT; - } - - if(!arPriv->keys[key_index].key_len) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: invalid key index %d\n", - __func__, key_index)); - return -EINVAL; - } - - arPriv->arDefTxKeyIndex = key_index; - key = &arPriv->keys[arPriv->arDefTxKeyIndex]; -#ifdef CFG80211_WAPI_ENABLE - /*if WAPI enable, we donot need to set it*/ -#else - status = wmi_addKey_cmd(arPriv->arWmi, arPriv->arDefTxKeyIndex, - arPriv->arPairwiseCrypto, GROUP_USAGE | TX_USAGE, - key->key_len, key->seq, key->key, KEY_OP_INIT_VAL, - NULL, SYNC_BOTH_WMIFLAG); - if (status != A_OK) { - return -EIO; - } -#endif - return 0; -} - -static int -ar6k_cfg80211_set_default_mgmt_key(struct wiphy *wiphy, struct net_device *ndev, - A_UINT8 key_index) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(ndev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: index %d\n", __func__, key_index)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: not supported\n", __func__)); - return -ENOTSUPP; -} - -void -ar6k_cfg80211_tkip_micerr_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 keyid, A_BOOL ismcast) -{ - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, - ("%s: keyid %d, ismcast %d\n", __func__, keyid, ismcast)); - - cfg80211_michael_mic_failure(arPriv->arNetDev, arPriv->arBssid, - (ismcast ? NL80211_KEYTYPE_GROUP : NL80211_KEYTYPE_PAIRWISE), - keyid, NULL, GFP_KERNEL); -} - -static int -ar6k_cfg80211_set_wiphy_params(struct wiphy *wiphy, A_UINT32 changed) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)wiphy_priv(wiphy); - AR_SOFTC_T *ar = arPriv->arSoftc; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: changed 0x%x\n", __func__, changed)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - if (changed & WIPHY_PARAM_RTS_THRESHOLD) { - if (wmi_set_rts_cmd(arPriv->arWmi,wiphy->rts_threshold) != A_OK){ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_set_rts_cmd failed\n", __func__)); - return -EIO; - } - } - - return 0; -} - -static int -ar6k_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, - const A_UINT8 *peer, - const struct cfg80211_bitrate_mask *mask) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - A_STATUS status; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: mask 0x%x\n", __func__, mask->fixed)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - status = wmi_set_fixrates_cmd(arPriv->arWmi, mask->fixed); - - if(status == A_EINVAL) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: invalid params\n", __func__)); - return -EINVAL; - } else if(status != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_set_fixrates_cmd failed\n", __func__)); - return -EIO; - } - - return 0; -#else - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Setting rates: Not supported\n")); - return -EIO; -#endif -} - -/* The type nl80211_tx_power_setting replaces the following data type from 2.6.36 onwards */ -static int -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) -ar6k_cfg80211_set_txpower(struct wiphy *wiphy, enum nl80211_tx_power_setting type, int dbm) -#else -ar6k_cfg80211_set_txpower(struct wiphy *wiphy, enum tx_power_setting type, int dbm) -#endif -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)wiphy_priv(wiphy); - AR_SOFTC_T *ar = arPriv->arSoftc; - A_UINT8 ar_dbm; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: type 0x%x, dbm %d\n", __func__, type, dbm)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - arPriv->arTxPwrSet = FALSE; - switch(type) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) - case NL80211_TX_POWER_AUTOMATIC: -#else - case TX_POWER_AUTOMATIC: -#endif - return 0; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) - case NL80211_TX_POWER_LIMITED: -#else - case TX_POWER_LIMITED: -#endif - arPriv->arTxPwr = ar_dbm = dbm; - arPriv->arTxPwrSet = TRUE; - break; - default: - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: type 0x%x not supported\n", __func__, type)); - return -EOPNOTSUPP; - } - - wmi_set_txPwr_cmd(arPriv->arWmi, ar_dbm); - - return 0; -} - -static int -ar6k_cfg80211_get_txpower(struct wiphy *wiphy, int *dbm) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)wiphy_priv(wiphy); - AR_SOFTC_T *ar = arPriv->arSoftc; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - if((arPriv->arConnected == TRUE)) { - arPriv->arTxPwr = 0; - - if(wmi_get_txPwr_cmd(arPriv->arWmi) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_get_txPwr_cmd failed\n", __func__)); - return -EIO; - } - - wait_event_interruptible_timeout(arPriv->arEvent, arPriv->arTxPwr != 0, 5 * HZ); - - if(signal_pending(current)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Target did not respond\n", __func__)); - return -EINTR; - } - } - - *dbm = arPriv->arTxPwr; - return 0; -} - -static int -ar6k_cfg80211_set_power_mgmt(struct wiphy *wiphy, - struct net_device *dev, - bool pmgmt, int timeout) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - WMI_POWER_MODE_CMD pwrMode; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: pmgmt %d, timeout %d\n", __func__, pmgmt, timeout)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - if(!pmgmt) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: Max Perf\n", __func__)); - pwrMode.powerMode = MAX_PERF_POWER; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: Rec Power\n", __func__)); - pwrMode.powerMode = REC_POWER; - } - - if(wmi_powermode_cmd(arPriv->arWmi, pwrMode.powerMode) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_powermode_cmd failed\n", __func__)); - return -EIO; - } - - return 0; -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) -struct net_device * -ar6k_cfg80211_add_virtual_intf(struct wiphy *wiphy, char *name, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -#else -static int -ar6k_cfg80211_add_virtual_intf(struct wiphy *wiphy, char *name, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -#endif -{ - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: not supported\n", __func__)); - - /* Multiple virtual interface is not supported. - * The default interface supports STA and IBSS type - */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) - return NULL; -#else - return -EOPNOTSUPP; -#endif -} - -static int -ar6k_cfg80211_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev) -{ - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: not supported\n", __func__)); - - /* Multiple virtual interface is not supported. - * The default interface supports STA and IBSS type - */ - return -EOPNOTSUPP; -} - -static int -ar6k_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(ndev); - AR_SOFTC_T *ar = arPriv->arSoftc; - struct wireless_dev *wdev = arPriv->wdev; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: type %u\n", __func__, type)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - switch (type) { - case NL80211_IFTYPE_STATION: - arPriv->arNextMode = INFRA_NETWORK; - break; - case NL80211_IFTYPE_ADHOC: - arPriv->arNextMode = ADHOC_NETWORK; - break; - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: type %u\n", __func__, type)); - return -EOPNOTSUPP; - } - - wdev->iftype = type; - - return 0; -} - -static int -ar6k_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ibss_params *ibss_param) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_STA_T *arSta; - A_STATUS status; - - arSta = &arPriv->arSta; - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - if(!ibss_param->ssid_len || IEEE80211_MAX_SSID_LEN < ibss_param->ssid_len) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: ssid invalid\n", __func__)); - return -EINVAL; - } - - arPriv->arSsidLen = ibss_param->ssid_len; - A_MEMCPY(arPriv->arSsid, ibss_param->ssid, arPriv->arSsidLen); - - if(ibss_param->channel) { - arPriv->arChannelHint = ibss_param->channel->center_freq; - } - - if(ibss_param->channel_fixed) { - /* TODO: channel_fixed: The channel should be fixed, do not search for - * IBSSs to join on other channels. Target firmware does not support this - * feature, needs to be updated.*/ - } - - A_MEMZERO(arSta->arReqBssid, sizeof(arSta->arReqBssid)); - if(ibss_param->bssid) { - if(A_MEMCMP(&ibss_param->bssid, bcast_mac, AR6000_ETH_ADDR_LEN)) { - A_MEMCPY(arSta->arReqBssid, ibss_param->bssid, sizeof(arSta->arReqBssid)); - } - } - - ar6k_set_wpa_version(arPriv, 0); - ar6k_set_auth_type(arPriv, NL80211_AUTHTYPE_OPEN_SYSTEM); - - if(ibss_param->privacy) { - ar6k_set_cipher(arPriv, WLAN_CIPHER_SUITE_WEP40, true); - ar6k_set_cipher(arPriv, WLAN_CIPHER_SUITE_WEP40, false); - } else { - ar6k_set_cipher(arPriv, IW_AUTH_CIPHER_NONE, true); - ar6k_set_cipher(arPriv, IW_AUTH_CIPHER_NONE, false); - } - - arPriv->arNetworkType = arPriv->arNextMode; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: Connect called with authmode %d dot11 auth %d"\ - " PW crypto %d PW crypto Len %d GRP crypto %d"\ - " GRP crypto Len %d channel hint %u\n", - __func__, arPriv->arAuthMode, arPriv->arDot11AuthMode, - arPriv->arPairwiseCrypto, arPriv->arPairwiseCryptoLen, - arPriv->arGroupCrypto, arPriv->arGroupCryptoLen, arPriv->arChannelHint)); - - status = wmi_connect_cmd(arPriv->arWmi, arPriv->arNetworkType, - arPriv->arDot11AuthMode, arPriv->arAuthMode, - arPriv->arPairwiseCrypto, arPriv->arPairwiseCryptoLen, - arPriv->arGroupCrypto,arPriv->arGroupCryptoLen, - arPriv->arSsidLen, arPriv->arSsid, - arSta->arReqBssid, arPriv->arChannelHint, - arSta->arConnectCtrlFlags); - arSta->arConnectPending = TRUE; - - return 0; -} - -static int -ar6k_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) -{ - - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__)); - - if(ar->arWmiReady == FALSE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); - return -EIO; - } - - if(ar->arWlanState == WLAN_DISABLED) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wlan disabled\n", __func__)); - return -EIO; - } - - ar6000_disconnect(arPriv); - A_MEMZERO(arPriv->arSsid, sizeof(arPriv->arSsid)); - arPriv->arSsidLen = 0; - - return 0; -} - - -static const -A_UINT32 cipher_suites[] = { - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, -}; - -static struct -cfg80211_ops ar6k_cfg80211_ops = { - .change_virtual_intf = ar6k_cfg80211_change_iface, - .add_virtual_intf = ar6k_cfg80211_add_virtual_intf, - .del_virtual_intf = ar6k_cfg80211_del_virtual_intf, - .scan = ar6k_cfg80211_scan, - .connect = ar6k_cfg80211_connect, - .disconnect = ar6k_cfg80211_disconnect, - .add_key = ar6k_cfg80211_add_key, - .get_key = ar6k_cfg80211_get_key, - .del_key = ar6k_cfg80211_del_key, - .set_default_key = ar6k_cfg80211_set_default_key, - .set_default_mgmt_key = ar6k_cfg80211_set_default_mgmt_key, - .set_wiphy_params = ar6k_cfg80211_set_wiphy_params, - .set_bitrate_mask = ar6k_cfg80211_set_bitrate_mask, - .set_tx_power = ar6k_cfg80211_set_txpower, - .get_tx_power = ar6k_cfg80211_get_txpower, - .set_power_mgmt = ar6k_cfg80211_set_power_mgmt, - .join_ibss = ar6k_cfg80211_join_ibss, - .leave_ibss = ar6k_cfg80211_leave_ibss, -}; - -struct wireless_dev * -ar6k_cfg80211_init(struct device *dev) -{ - int ret = 0; - struct wireless_dev *wdev; - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__)); - - wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); - if(!wdev) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("%s: Couldn't allocate wireless device\n", __func__)); - return ERR_PTR(-ENOMEM); - } - - /* create a new wiphy for use with cfg80211 */ - wdev->wiphy = wiphy_new(&ar6k_cfg80211_ops, sizeof(AR_SOFTC_T)); - if(!wdev->wiphy) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("%s: Couldn't allocate wiphy device\n", __func__)); - kfree(wdev); - return ERR_PTR(-ENOMEM); - } - - /* set device pointer for wiphy */ - set_wiphy_dev(wdev->wiphy, dev); - - wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC); - /* max num of ssids that can be probed during scanning */ - wdev->wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX; - wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &ar6k_band_2ghz; - wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &ar6k_band_5ghz; - wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - - wdev->wiphy->cipher_suites = cipher_suites; - wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); - - ret = wiphy_register(wdev->wiphy); - if(ret < 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("%s: Couldn't register wiphy device\n", __func__)); - wiphy_free(wdev->wiphy); - return ERR_PTR(ret); - } - - return wdev; -} - -void -ar6k_cfg80211_deinit(AR_SOFTC_DEV_T *arPriv) -{ - struct wireless_dev *wdev = arPriv->wdev; - - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__)); - - if(arPriv->scan_request) { - cfg80211_scan_done(arPriv->scan_request, true); - arPriv->scan_request = NULL; - } - - if(!wdev) - return; - - wiphy_unregister(wdev->wiphy); - wiphy_free(wdev->wiphy); - kfree(wdev); -} - - - - - - - diff --git a/drivers/net/wireless/ar6003/host/os/linux/eeprom.c b/drivers/net/wireless/ar6003/host/os/linux/eeprom.c deleted file mode 100644 index 5f6a14766aa2..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/eeprom.c +++ /dev/null @@ -1,569 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - - -#include "ar6000_drv.h" -#include "htc.h" -#include - -#include "target_reg_table.h" -#include "host_reg_table.h -// -// defines -// - -#define MAX_FILENAME 1023 -#define EEPROM_WAIT_LIMIT 16 - -#define EEPROM_SZ 768 - -/* soft mac */ -#define ATH_MAC_LEN 6 -#define ATH_SOFT_MAC_TMP_BUF_LEN 64 -unsigned char mac_addr[ATH_MAC_LEN]; -unsigned char soft_mac_tmp_buf[ATH_SOFT_MAC_TMP_BUF_LEN]; -char *p_mac = NULL; -/* soft mac */ - -// -// static variables -// - -static A_UCHAR eeprom_data[EEPROM_SZ]; -static A_UINT32 sys_sleep_reg; -static HIF_DEVICE *p_bmi_device; - -// -// Functions -// - -/* soft mac */ -static int -wmic_ether_aton(const char *orig, A_UINT8 *eth) -{ - const char *bufp; - int i; - - i = 0; - for(bufp = orig; *bufp != '\0'; ++bufp) { - unsigned int val; - unsigned char c = *bufp++; - if (c >= '0' && c <= '9') val = c - '0'; - else if (c >= 'a' && c <= 'f') val = c - 'a' + 10; - else if (c >= 'A' && c <= 'F') val = c - 'A' + 10; - else { - printk("%s: MAC value is invalid\n", __FUNCTION__); - break; - } - - val <<= 4; - c = *bufp++; - if (c >= '0' && c <= '9') val |= c - '0'; - else if (c >= 'a' && c <= 'f') val |= c - 'a' + 10; - else if (c >= 'A' && c <= 'F') val |= c - 'A' + 10; - else { - printk("%s: MAC value is invalid\n", __FUNCTION__); - break; - } - - eth[i] = (unsigned char) (val & 0377); - if(++i == ATH_MAC_LEN) { - /* That's it. Any trailing junk? */ - if (*bufp != '\0') { - return 0; - } - return 1; - } - if (*bufp != ':') - break; - } - return 0; -} - -static void -update_mac(unsigned char* eeprom, int size, unsigned char* macaddr) -{ - int i; - A_UINT16* ptr = (A_UINT16*)(eeprom+4); - A_UINT16 checksum = 0; - - memcpy(eeprom+10,macaddr,6); - - *ptr = 0; - ptr = (A_UINT16*)eeprom; - - for (i=0; i>7)); - - BMI_write_reg(SI_BASE_ADDRESS+SI_TX_DATA0_OFFSET, regval); - - regval = SI_CS_START_SET(1) | - SI_CS_RX_CNT_SET(8) | - SI_CS_TX_CNT_SET(3); - BMI_write_reg(SI_BASE_ADDRESS+SI_CS_OFFSET, regval); -} - -/* - * Tell the Target to start a 4-byte write to EEPROM, - * writing values from Target TX_DATA registers. - */ -static void -request_4byte_write(int offset, A_UINT32 data) -{ - A_UINT32 regval; - - printk("%s: request_4byte_write (0x%x) to offset 0x%x\n", __FUNCTION__, data, offset); - - /* SI_TX_DATA0 = write data to offset */ - regval = ((data & 0xffff) <<16) | - ((offset & 0xff)<<8) | - (0xa0 | ((offset & 0xff00)>>7)); - BMI_write_reg(SI_BASE_ADDRESS+SI_TX_DATA0_OFFSET, regval); - - regval = data >> 16; - BMI_write_reg(SI_BASE_ADDRESS+SI_TX_DATA1_OFFSET, regval); - - regval = SI_CS_START_SET(1) | - SI_CS_RX_CNT_SET(0) | - SI_CS_TX_CNT_SET(6); - BMI_write_reg(SI_BASE_ADDRESS+SI_CS_OFFSET, regval); -} - -/* - * Check whether or not an EEPROM request that was started - * earlier has completed yet. - */ -static A_BOOL -request_in_progress(void) -{ - A_UINT32 regval; - - /* Wait for DONE_INT in SI_CS */ - BMI_read_reg(SI_BASE_ADDRESS+SI_CS_OFFSET, ®val); - -// printk("%s: request in progress SI_CS=0x%x\n", __FUNCTION__, regval); - if (regval & SI_CS_DONE_ERR_MASK) { - printk("%s: EEPROM signaled ERROR (0x%x)\n", __FUNCTION__, regval); - } - - return (!(regval & SI_CS_DONE_INT_MASK)); -} - -/* - * try to detect the type of EEPROM,16bit address or 8bit address - */ - -static void eeprom_type_detect(void) -{ - A_UINT32 regval; - A_UINT8 i = 0; - - request_8byte_read(0x100); - /* Wait for DONE_INT in SI_CS */ - do{ - BMI_read_reg(SI_BASE_ADDRESS+SI_CS_OFFSET, ®val); - if (regval & SI_CS_DONE_ERR_MASK) { - printk("%s: ERROR : address type was wrongly set\n", __FUNCTION__); - break; - } - if (i++ == EEPROM_WAIT_LIMIT) { - printk("%s: EEPROM not responding\n", __FUNCTION__); - } - } while(!(regval & SI_CS_DONE_INT_MASK)); -} - -/* - * Extract the results of a completed EEPROM Read request - * and return them to the caller. - */ -inline void -read_8byte_results(A_UINT32 *data) -{ - /* Read SI_RX_DATA0 and SI_RX_DATA1 */ - BMI_read_reg(SI_BASE_ADDRESS+SI_RX_DATA0_OFFSET, &data[0]); - BMI_read_reg(SI_BASE_ADDRESS+SI_RX_DATA1_OFFSET, &data[1]); -} - - -/* - * Wait for a previously started command to complete. - * Timeout if the command is takes "too long". - */ -static void -wait_for_eeprom_completion(void) -{ - int i=0; - - while (request_in_progress()) { - if (i++ == EEPROM_WAIT_LIMIT) { - printk("%s: EEPROM not responding\n", __FUNCTION__); - } - } -} - -/* - * High-level function which starts an 8-byte read, - * waits for it to complete, and returns the result. - */ -static void -fetch_8bytes(int offset, A_UINT32 *data) -{ - request_8byte_read(offset); - wait_for_eeprom_completion(); - read_8byte_results(data); - - /* Clear any pending intr */ - BMI_write_reg(SI_BASE_ADDRESS+SI_CS_OFFSET, SI_CS_DONE_INT_MASK); -} - -/* - * High-level function which starts a 4-byte write, - * and waits for it to complete. - */ -inline void -commit_4bytes(int offset, A_UINT32 data) -{ - request_4byte_write(offset, data); - wait_for_eeprom_completion(); -} -/* ATHENV */ -#ifdef ANDROID_ENV -void eeprom_ar6000_transfer(HIF_DEVICE *device, char *fake_file, char *p_mac) -{ - A_UINT32 first_word; - A_UINT32 board_data_addr; - int i; - - printk("%s: Enter\n", __FUNCTION__); - - enable_SI(device); - eeprom_type_detect(); - - if (fake_file) { - /* - * Transfer from file to Target RAM. - * Fetch source data from file. - */ - mm_segment_t oldfs; - struct file *filp; - struct inode *inode = NULL; - int length; - - /* open file */ - oldfs = get_fs(); - set_fs(KERNEL_DS); - filp = filp_open(fake_file, O_RDONLY, S_IRUSR); - - if (IS_ERR(filp)) { - printk("%s: file %s filp_open error\n", __FUNCTION__, fake_file); - set_fs(oldfs); - return; - } - - if (!filp->f_op) { - printk("%s: File Operation Method Error\n", __FUNCTION__); - filp_close(filp, NULL); - set_fs(oldfs); - return; - } - - inode = GET_INODE_FROM_FILEP(filep); - if (!inode) { - printk("%s: Get inode from filp failed\n", __FUNCTION__); - filp_close(filp, NULL); - set_fs(oldfs); - return; - } - - printk("%s file offset opsition: %xh\n", __FUNCTION__, (unsigned)filp->f_pos); - - /* file's size */ - length = i_size_read(inode->i_mapping->host); - printk("%s: length=%d\n", __FUNCTION__, length); - if (length != EEPROM_SZ) { - printk("%s: The file's size is not as expected\n", __FUNCTION__); - filp_close(filp, NULL); - set_fs(oldfs); - return; - } - - /* read data */ - if (filp->f_op->read(filp, eeprom_data, length, &filp->f_pos) != length) { - printk("%s: file read error\n", __FUNCTION__); - filp_close(filp, NULL); - set_fs(oldfs); - return; - } - - /* read data out successfully */ - filp_close(filp, NULL); - set_fs(oldfs); - } else { - /* - * Read from EEPROM to file OR transfer from EEPROM to Target RAM. - * Fetch EEPROM_SZ Bytes of Board Data, 8 bytes at a time. - */ - - fetch_8bytes(0, (A_UINT32 *)(&eeprom_data[0])); - - /* Check the first word of EEPROM for validity */ - first_word = *((A_UINT32 *)eeprom_data); - - if ((first_word == 0) || (first_word == 0xffffffff)) { - printk("Did not find EEPROM with valid Board Data.\n"); - } - - for (i=8; if_op) { - printk("%s: File Operation Method Error\n", __FUNCTION__); - filp_close(filp, NULL); - set_fs(oldfs); - return; - } - - inode = GET_INODE_FROM_FILEP(filep); - if (!inode) { - printk("%s: Get inode from filp failed\n", __FUNCTION__); - filp_close(filp, NULL); - set_fs(oldfs); - return; - } - - printk("%s file offset opsition: %xh\n", __FUNCTION__, (unsigned)filp->f_pos); - - /* file's size */ - length = i_size_read(inode->i_mapping->host); - printk("%s: length=%d\n", __FUNCTION__, length); - if (length > ATH_SOFT_MAC_TMP_BUF_LEN) { - printk("%s: MAC file's size is not as expected\n", __FUNCTION__); - filp_close(filp, NULL); - set_fs(oldfs); - return; - } - - /* read data */ - if (filp->f_op->read(filp, soft_mac_tmp_buf, length, &filp->f_pos) != length) { - printk("%s: file read error\n", __FUNCTION__); - filp_close(filp, NULL); - set_fs(oldfs); - return; - } - -#if 0 - /* the data we just read */ - printk("%s: mac address from the file:\n", __FUNCTION__); - for (i = 0; i < length; i++) - printk("[%c(0x%x)],", soft_mac_tmp_buf[i], soft_mac_tmp_buf[i]); - printk("\n"); -#endif - - /* read data out successfully */ - filp_close(filp, NULL); - set_fs(oldfs); - - /* convert mac address */ - if (!wmic_ether_aton(soft_mac_tmp_buf, mac_addr)) { - printk("%s: convert mac value fail\n", __FUNCTION__); - return; - } - -#if 0 - /* the converted mac address */ - printk("%s: the converted mac value\n", __FUNCTION__); - for (i = 0; i < ATH_MAC_LEN; i++) - printk("[0x%x],", mac_addr[i]); - printk("\n"); -#endif - } - /* soft mac */ - - /* Determine where in Target RAM to write Board Data */ - BMI_read_mem( AR6002_HOST_INTEREST_ITEM_ADDRESS(hi_board_data), &board_data_addr); - if (board_data_addr == 0) { - printk("hi_board_data is zero\n"); - } - - /* soft mac */ -#if 1 - /* Update MAC address in RAM */ - if (p_mac) { - update_mac(eeprom_data, EEPROM_SZ, mac_addr); - } -#endif -#if 0 - /* mac address in eeprom array */ - printk("%s: mac values in eeprom array\n", __FUNCTION__); - for (i = 10; i < 10 + 6; i++) - printk("[0x%x],", eeprom_data[i]); - printk("\n"); -#endif - /* soft mac */ - - /* Write EEPROM data to Target RAM */ - BMI_write_mem(board_data_addr, ((A_UINT8 *)eeprom_data), EEPROM_SZ); - - /* Record the fact that Board Data IS initialized */ - { - A_UINT32 one = 1; - BMI_write_mem(AR6002_HOST_INTEREST_ITEM_ADDRESS(hi_board_data_initialized), - (A_UINT8 *)&one, sizeof(A_UINT32)); - } - - disable_SI(); -} diff --git a/drivers/net/wireless/ar6003/host/os/linux/export_hci_transport.c b/drivers/net/wireless/ar6003/host/os/linux/export_hci_transport.c deleted file mode 100644 index c44311b79665..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/export_hci_transport.c +++ /dev/null @@ -1,122 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2009-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// HCI bridge implementation -// -// Author(s): ="Atheros" -//============================================================================== -#include -#include -#include "a_types.h" -#include "a_osapi.h" -#include "htc_api.h" -#include "a_drv.h" -#include "hif.h" -#include "common_drv.h" -#include "a_debug.h" -#include "hci_transport_api.h" - - -HCI_TRANSPORT_HANDLE (*_HCI_TransportAttach)(void *HTCHandle, HCI_TRANSPORT_CONFIG_INFO *pInfo); -void (*_HCI_TransportDetach)(HCI_TRANSPORT_HANDLE HciTrans); -A_STATUS (*_HCI_TransportAddReceivePkts)(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET_QUEUE *pQueue); -A_STATUS (*_HCI_TransportSendPkt)(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET *pPacket, A_BOOL Synchronous); -void (*_HCI_TransportStop)(HCI_TRANSPORT_HANDLE HciTrans); -A_STATUS (*_HCI_TransportStart)(HCI_TRANSPORT_HANDLE HciTrans); -A_STATUS (*_HCI_TransportEnableDisableAsyncRecv)(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable); -A_STATUS (*_HCI_TransportRecvHCIEventSync)(HCI_TRANSPORT_HANDLE HciTrans, - HTC_PACKET *pPacket, - int MaxPollMS); -A_STATUS (*_HCI_TransportSetBaudRate)(HCI_TRANSPORT_HANDLE HciTrans, A_UINT32 Baud); -A_STATUS (*_HCI_TransportEnablePowerMgmt)(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable); - -extern HCI_TRANSPORT_CALLBACKS ar6kHciTransCallbacks; - -A_STATUS ar6000_register_hci_transport(HCI_TRANSPORT_CALLBACKS *hciTransCallbacks) -{ - ar6kHciTransCallbacks = *hciTransCallbacks; - - _HCI_TransportAttach = HCI_TransportAttach; - _HCI_TransportDetach = HCI_TransportDetach; - _HCI_TransportAddReceivePkts = HCI_TransportAddReceivePkts; - _HCI_TransportSendPkt = HCI_TransportSendPkt; - _HCI_TransportStop = HCI_TransportStop; - _HCI_TransportStart = HCI_TransportStart; - _HCI_TransportEnableDisableAsyncRecv = HCI_TransportEnableDisableAsyncRecv; - _HCI_TransportRecvHCIEventSync = HCI_TransportRecvHCIEventSync; - _HCI_TransportSetBaudRate = HCI_TransportSetBaudRate; - _HCI_TransportEnablePowerMgmt = HCI_TransportEnablePowerMgmt; - - return A_OK; -} - -A_STATUS -ar6000_get_hif_dev(HIF_DEVICE *device, void *config) -{ - A_STATUS status; - - status = HIFConfigureDevice(device, - HIF_DEVICE_GET_OS_DEVICE, - (HIF_DEVICE_OS_DEVICE_INFO *)config, - sizeof(HIF_DEVICE_OS_DEVICE_INFO)); - return status; -} - -A_STATUS ar6000_set_uart_config(HIF_DEVICE *hifDevice, - A_UINT32 scale, - A_UINT32 step) -{ - A_UINT32 regAddress; - A_UINT32 regVal; - A_STATUS status; - - regAddress = WLAN_UART_BASE_ADDRESS | UART_CLKDIV_ADDRESS; - regVal = ((A_UINT32)scale << 16) | step; - /* change the HCI UART scale/step values through the diagnostic window */ - status = ar6000_WriteRegDiag(hifDevice, ®Address, ®Val); - - return status; -} - -A_STATUS ar6000_get_core_clock_config(HIF_DEVICE *hifDevice, A_UINT32 *data) -{ - A_UINT32 regAddress; - A_STATUS status; - - regAddress = WLAN_RTC_BASE_ADDRESS | WLAN_CPU_CLOCK_ADDRESS; - /* read CPU clock settings*/ - status = ar6000_ReadRegDiag(hifDevice, ®Address, data); - - return status; -} - -EXPORT_SYMBOL(ar6000_register_hci_transport); -EXPORT_SYMBOL(ar6000_get_hif_dev); -EXPORT_SYMBOL(ar6000_set_uart_config); -EXPORT_SYMBOL(ar6000_get_core_clock_config); -EXPORT_SYMBOL(_HCI_TransportAttach); -EXPORT_SYMBOL(_HCI_TransportDetach); -EXPORT_SYMBOL(_HCI_TransportAddReceivePkts); -EXPORT_SYMBOL(_HCI_TransportSendPkt); -EXPORT_SYMBOL(_HCI_TransportStop); -EXPORT_SYMBOL(_HCI_TransportStart); -EXPORT_SYMBOL(_HCI_TransportEnableDisableAsyncRecv); -EXPORT_SYMBOL(_HCI_TransportRecvHCIEventSync); -EXPORT_SYMBOL(_HCI_TransportSetBaudRate); -EXPORT_SYMBOL(_HCI_TransportEnablePowerMgmt); diff --git a/drivers/net/wireless/ar6003/host/os/linux/hci_bridge.c b/drivers/net/wireless/ar6003/host/os/linux/hci_bridge.c deleted file mode 100644 index 1c6642082652..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/hci_bridge.c +++ /dev/null @@ -1,1174 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2009-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// HCI bridge implementation -// -// Author(s): ="Atheros" -//============================================================================== - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -#include -#include -#include -#include "a_types.h" -#include "a_osapi.h" -#include "htc_api.h" -#include "wmi.h" -#include "a_drv.h" -#include "hif.h" -#include "common_drv.h" -#include "a_debug.h" -#define ATH_DEBUG_HCI_BRIDGE ATH_DEBUG_MAKE_MODULE_MASK(6) -#define ATH_DEBUG_HCI_RECV ATH_DEBUG_MAKE_MODULE_MASK(7) -#define ATH_DEBUG_HCI_SEND ATH_DEBUG_MAKE_MODULE_MASK(8) -#define ATH_DEBUG_HCI_DUMP ATH_DEBUG_MAKE_MODULE_MASK(9) -#else -#include "ar6000_drv.h" -#endif /* EXPORT_HCI_BRIDGE_INTERFACE */ - -#ifdef ATH_AR6K_ENABLE_GMBOX -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -#include "export_hci_transport.h" -#else -#include "hci_transport_api.h" -#endif -#include "epping_test.h" -#include "gmboxif.h" -#include "ar3kconfig.h" -#include -#include - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) - /* only build on newer kernels which have BT configured */ -#if defined(CONFIG_BT_MODULE) || defined(CONFIG_BT) -#define CONFIG_BLUEZ_HCI_BRIDGE -#endif -#endif - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -unsigned int ar3khcibaud = 0; -unsigned int hciuartscale = 0; -unsigned int hciuartstep = 0; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -module_param(ar3khcibaud, int, 0644); -module_param(hciuartscale, int, 0644); -module_param(hciuartstep, int, 0644); -#else - -#define __user -/* for linux 2.4 and lower */ -MODULE_PARM(ar3khcibaud, "i"); -MODULE_PARM(hciuartscale, "i"); -MODULE_PARM(hciuartstep, "i"); -#endif -#else -extern unsigned int ar3khcibaud; -extern unsigned int hciuartscale; -extern unsigned int hciuartstep; -#endif /* EXPORT_HCI_BRIDGE_INTERFACE */ - -typedef struct { - void *pHCIDev; /* HCI bridge device */ - HCI_TRANSPORT_PROPERTIES HCIProps; /* HCI bridge props */ - struct hci_dev *pBtStackHCIDev; /* BT Stack HCI dev */ - A_BOOL HciNormalMode; /* Actual HCI mode enabled (non-TEST)*/ - A_BOOL HciRegistered; /* HCI device registered with stack */ - HTC_PACKET_QUEUE HTCPacketStructHead; - A_UINT8 *pHTCStructAlloc; - spinlock_t BridgeLock; -#ifdef EXPORT_HCI_BRIDGE_INTERFACE - HCI_TRANSPORT_MISC_HANDLES HCITransHdl; -#else - AR_SOFTC_T *ar; -#endif /* EXPORT_HCI_BRIDGE_INTERFACE */ -} AR6K_HCI_BRIDGE_INFO; - -#define MAX_ACL_RECV_BUFS 16 -#define MAX_EVT_RECV_BUFS 8 -#define MAX_HCI_WRITE_QUEUE_DEPTH 32 -#define MAX_ACL_RECV_LENGTH 1200 -#define MAX_EVT_RECV_LENGTH 257 -#define TX_PACKET_RSV_OFFSET 32 -#define NUM_HTC_PACKET_STRUCTS ((MAX_ACL_RECV_BUFS + MAX_EVT_RECV_BUFS + MAX_HCI_WRITE_QUEUE_DEPTH) * 2) - -#define HCI_GET_OP_CODE(p) (((A_UINT16)((p)[1])) << 8) | ((A_UINT16)((p)[0])) - -extern unsigned int setupbtdev; -AR3K_CONFIG_INFO ar3kconfig; - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -AR6K_HCI_BRIDGE_INFO *g_pHcidevInfo; -#endif - -static A_STATUS bt_setup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo); -static void bt_cleanup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo); -static A_STATUS bt_register_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo); -static A_BOOL bt_indicate_recv(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, - HCI_TRANSPORT_PACKET_TYPE Type, - struct sk_buff *skb); -static struct sk_buff *bt_alloc_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, int Length); -static void bt_free_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, struct sk_buff *skb); - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -A_STATUS ar6000_setup_hci(void *ar); -void ar6000_cleanup_hci(void *ar); -A_STATUS hci_test_send(void *ar, struct sk_buff *skb); -#else -A_STATUS ar6000_setup_hci(AR_SOFTC_T *ar); -void ar6000_cleanup_hci(AR_SOFTC_T *ar); -/* HCI bridge testing */ -A_STATUS hci_test_send(AR_SOFTC_T *ar, struct sk_buff *skb); -#endif /* EXPORT_HCI_BRIDGE_INTERFACE */ - -#define LOCK_BRIDGE(dev) spin_lock_bh(&(dev)->BridgeLock) -#define UNLOCK_BRIDGE(dev) spin_unlock_bh(&(dev)->BridgeLock) - -static inline void FreeBtOsBuf(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, void *osbuf) -{ - if (pHcidevInfo->HciNormalMode) { - bt_free_buffer(pHcidevInfo, (struct sk_buff *)osbuf); - } else { - /* in test mode, these are just ordinary netbuf allocations */ - A_NETBUF_FREE(osbuf); - } -} - -static void FreeHTCStruct(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, HTC_PACKET *pPacket) -{ - LOCK_BRIDGE(pHcidevInfo); - HTC_PACKET_ENQUEUE(&pHcidevInfo->HTCPacketStructHead,pPacket); - UNLOCK_BRIDGE(pHcidevInfo); -} - -static HTC_PACKET * AllocHTCStruct(AR6K_HCI_BRIDGE_INFO *pHcidevInfo) -{ - HTC_PACKET *pPacket = NULL; - LOCK_BRIDGE(pHcidevInfo); - pPacket = HTC_PACKET_DEQUEUE(&pHcidevInfo->HTCPacketStructHead); - UNLOCK_BRIDGE(pHcidevInfo); - return pPacket; -} - -#define BLOCK_ROUND_UP_PWR2(x, align) (((int) (x) + ((align)-1)) & ~((align)-1)) - -static void RefillRecvBuffers(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, - HCI_TRANSPORT_PACKET_TYPE Type, - int NumBuffers) -{ - int length, i; - void *osBuf = NULL; - HTC_PACKET_QUEUE queue; - HTC_PACKET *pPacket; - - INIT_HTC_PACKET_QUEUE(&queue); - - if (Type == HCI_ACL_TYPE) { - if (pHcidevInfo->HciNormalMode) { - length = HCI_MAX_FRAME_SIZE; - } else { - length = MAX_ACL_RECV_LENGTH; - } - } else { - length = MAX_EVT_RECV_LENGTH; - } - - /* add on transport head and tail room */ - length += pHcidevInfo->HCIProps.HeadRoom + pHcidevInfo->HCIProps.TailRoom; - /* round up to the required I/O padding */ - length = BLOCK_ROUND_UP_PWR2(length,pHcidevInfo->HCIProps.IOBlockPad); - - for (i = 0; i < NumBuffers; i++) { - - if (pHcidevInfo->HciNormalMode) { - osBuf = bt_alloc_buffer(pHcidevInfo,length); - } else { - osBuf = A_NETBUF_ALLOC(length); - } - - if (NULL == osBuf) { - break; - } - - pPacket = AllocHTCStruct(pHcidevInfo); - if (NULL == pPacket) { - FreeBtOsBuf(pHcidevInfo,osBuf); - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to alloc HTC struct \n")); - break; - } - - SET_HTC_PACKET_INFO_RX_REFILL(pPacket,osBuf,A_NETBUF_DATA(osBuf),length,Type); - /* add to queue */ - HTC_PACKET_ENQUEUE(&queue,pPacket); - } - - if (i > 0) { - HCI_TransportAddReceivePkts(pHcidevInfo->pHCIDev, &queue); - } -} - -static A_STATUS ar6000_hci_transport_ready(HCI_TRANSPORT_HANDLE HCIHandle, - HCI_TRANSPORT_PROPERTIES *pProps, - void *pContext) -{ - AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext; - A_STATUS status; - AR_SOFTC_DEV_T *arDev = pHcidevInfo->ar->arDev[0]; - - - pHcidevInfo->pHCIDev = HCIHandle; - - A_MEMCPY(&pHcidevInfo->HCIProps,pProps,sizeof(*pProps)); - - AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE,("HCI ready (hci:0x%lX, headroom:%d, tailroom:%d blockpad:%d) \n", - (unsigned long)HCIHandle, - pHcidevInfo->HCIProps.HeadRoom, - pHcidevInfo->HCIProps.TailRoom, - pHcidevInfo->HCIProps.IOBlockPad)); - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE - A_ASSERT((pProps->HeadRoom + pProps->TailRoom) <= (struct net_device *)(pHcidevInfo->HCITransHdl.netDevice)->hard_header_len); -#else - A_ASSERT((pProps->HeadRoom + pProps->TailRoom) <= arDev->arNetDev->hard_header_len); -#endif - - /* provide buffers */ - RefillRecvBuffers(pHcidevInfo, HCI_ACL_TYPE, MAX_ACL_RECV_BUFS); - RefillRecvBuffers(pHcidevInfo, HCI_EVENT_TYPE, MAX_EVT_RECV_BUFS); - - do { - /* start transport */ - status = HCI_TransportStart(pHcidevInfo->pHCIDev); - - if (A_FAILED(status)) { - break; - } - - if (!pHcidevInfo->HciNormalMode) { - /* in test mode, no need to go any further */ - break; - } - - // The delay is required when AR6K is driving the BT reset line - // where time is needed after the BT chip is out of reset (HCI_TransportStart) - // and before the first HCI command is issued (AR3KConfigure) - // FIXME - // The delay should be configurable and be only applied when AR6K driving the BT - // reset line. This could be done by some module parameter or based on some HW config - // info. For now apply 100ms delay blindly - A_MDELAY(100); - - A_MEMZERO(&ar3kconfig,sizeof(ar3kconfig)); - ar3kconfig.pHCIDev = pHcidevInfo->pHCIDev; - ar3kconfig.pHCIProps = &pHcidevInfo->HCIProps; -#ifdef EXPORT_HCI_BRIDGE_INTERFACE - ar3kconfig.pHIFDevice = (HIF_DEVICE *)(pHcidevInfo->HCITransHdl.hifDevice); -#else - ar3kconfig.pHIFDevice = pHcidevInfo->ar->arHifDevice; -#endif - ar3kconfig.pBtStackHCIDev = pHcidevInfo->pBtStackHCIDev; - - if (ar3khcibaud != 0) { - /* user wants ar3k baud rate change */ - ar3kconfig.Flags |= AR3K_CONFIG_FLAG_SET_AR3K_BAUD; - ar3kconfig.Flags |= AR3K_CONFIG_FLAG_AR3K_BAUD_CHANGE_DELAY; - ar3kconfig.AR3KBaudRate = ar3khcibaud; - } - - if ((hciuartscale != 0) || (hciuartstep != 0)) { - /* user wants to tune HCI bridge UART scale/step values */ - ar3kconfig.AR6KScale = (A_UINT16)hciuartscale; - ar3kconfig.AR6KStep = (A_UINT16)hciuartstep; - ar3kconfig.Flags |= AR3K_CONFIG_FLAG_SET_AR6K_SCALE_STEP; - } - - /* configure the AR3K device */ - memcpy(ar3kconfig.bdaddr,pHcidevInfo->ar->bdaddr,6); - status = AR3KConfigure(&ar3kconfig); - if (A_FAILED(status)) { - extern unsigned int setuphci; - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge: Fail to configure AR3K. No device? Cleanup HCI\n")); - pHcidevInfo->ar->exitCallback = NULL; - ar6000_cleanup_hci(pHcidevInfo->ar); - setuphci = 0; - pHcidevInfo->ar->arBTSharing = 0; - break; - } - - /* Make sure both AR6K and AR3K have power management enabled */ - if (ar3kconfig.PwrMgmtEnabled) { - A_UINT32 address, hci_uart_pwr_mgmt_params; - /* Fetch the address of the hi_hci_uart_pwr_mgmt_params instance in the host interest area */ - address = TARG_VTOP(pHcidevInfo->ar->arTargetType, - HOST_INTEREST_ITEM_ADDRESS(pHcidevInfo->ar->arTargetType, hi_hci_uart_pwr_mgmt_params)); - status = ar6000_ReadRegDiag(pHcidevInfo->ar->arHifDevice, &address, &hci_uart_pwr_mgmt_params); - hci_uart_pwr_mgmt_params &= 0xFFFF; - /* wakeup timeout is [31:16] */ - hci_uart_pwr_mgmt_params |= (ar3kconfig.WakeupTimeout << 16); - status |= ar6000_WriteRegDiag(pHcidevInfo->ar->arHifDevice, &address, &hci_uart_pwr_mgmt_params); - if (A_OK != status) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge: failed to write hci_uart_pwr_mgmt_params!\n")); - } - - /* Fetch the address of the hi_hci_uart_pwr_mgmt_params_ext instance in the host interest area */ - address = TARG_VTOP(pHcidevInfo->ar->arTargetType, - HOST_INTEREST_ITEM_ADDRESS(pHcidevInfo->ar->arTargetType, hi_hci_uart_pwr_mgmt_params_ext)); - status = ar6000_WriteRegDiag(pHcidevInfo->ar->arHifDevice, &address, &ar3kconfig.IdleTimeout); - if (A_OK != status) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge: failed to write hci_uart_pwr_mgmt_params_ext!\n")); - } - - status = HCI_TransportEnablePowerMgmt(pHcidevInfo->pHCIDev, TRUE); - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge: failed to enable TLPM for AR6K! \n")); - } - } - - status = bt_register_hci(pHcidevInfo); - - } while (FALSE); - - return status; -} - -static void ar6000_hci_transport_failure(void *pContext, A_STATUS Status) -{ - AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext; - - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge: transport failure! \n")); - - if (pHcidevInfo->HciNormalMode) { - /* TODO .. */ - } -} - -static void ar6000_hci_transport_removed(void *pContext) -{ - AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext; - - AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE, ("HCI Bridge: transport removed. \n")); - - A_ASSERT(pHcidevInfo->pHCIDev != NULL); - - HCI_TransportDetach(pHcidevInfo->pHCIDev); - bt_cleanup_hci(pHcidevInfo); - pHcidevInfo->pHCIDev = NULL; -} - -static void ar6000_hci_send_complete(void *pContext, HTC_PACKET *pPacket) -{ - AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext; - void *osbuf = pPacket->pPktContext; - A_ASSERT(osbuf != NULL); - A_ASSERT(pHcidevInfo != NULL); - - if (A_FAILED(pPacket->Status)) { - if ((pPacket->Status != A_ECANCELED) && (pPacket->Status != A_NO_RESOURCE)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge: Send Packet Failed: %d \n",pPacket->Status)); - } - } - - FreeHTCStruct(pHcidevInfo,pPacket); - FreeBtOsBuf(pHcidevInfo,osbuf); - -} - -static void ar6000_hci_pkt_recv(void *pContext, HTC_PACKET *pPacket) -{ - AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext; - struct sk_buff *skb; - AR_SOFTC_DEV_T *arDev = pHcidevInfo->ar->arDev[0]; - - A_ASSERT(pHcidevInfo != NULL); - skb = (struct sk_buff *)pPacket->pPktContext; - A_ASSERT(skb != NULL); - - do { - - if (A_FAILED(pPacket->Status)) { - break; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_HCI_RECV, - ("HCI Bridge, packet received type : %d len:%d \n", - HCI_GET_PACKET_TYPE(pPacket),pPacket->ActualLength)); - - /* set the actual buffer position in the os buffer, HTC recv buffers posted to HCI are set - * to fill the front of the buffer */ - A_NETBUF_PUT(skb,pPacket->ActualLength + pHcidevInfo->HCIProps.HeadRoom); - A_NETBUF_PULL(skb,pHcidevInfo->HCIProps.HeadRoom); - - if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_HCI_DUMP)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("<<< Recv HCI %s packet len:%d \n", - (HCI_GET_PACKET_TYPE(pPacket) == HCI_EVENT_TYPE) ? "EVENT" : "ACL", - skb->len)); - AR_DEBUG_PRINTBUF(skb->data, skb->len,"BT HCI RECV Packet Dump"); - } - - if (pHcidevInfo->HciNormalMode) { - /* indicate the packet */ - if (bt_indicate_recv(pHcidevInfo,HCI_GET_PACKET_TYPE(pPacket),skb)) { - /* bt stack accepted the packet */ - skb = NULL; - } - break; - } - - /* for testing, indicate packet to the network stack */ -#ifdef EXPORT_HCI_BRIDGE_INTERFACE - skb->dev = (struct net_device *)(pHcidevInfo->HCITransHdl.netDevice); - if ((((struct net_device *)pHcidevInfo->HCITransHdl.netDevice)->flags & IFF_UP) == IFF_UP) { - skb->protocol = eth_type_trans(skb, (struct net_device *)(pHcidevInfo->HCITransHdl.netDevice)); -#else - skb->dev = arDev->arNetDev; - if ((arDev->arNetDev->flags & IFF_UP) == IFF_UP) { - skb->protocol = eth_type_trans(skb, arDev->arNetDev); -#endif - A_NETIF_RX(skb); - skb = NULL; - } - - } while (FALSE); - - FreeHTCStruct(pHcidevInfo,pPacket); - - if (skb != NULL) { - /* packet was not accepted, free it */ - FreeBtOsBuf(pHcidevInfo,skb); - } - -} - -static void ar6000_hci_pkt_refill(void *pContext, HCI_TRANSPORT_PACKET_TYPE Type, int BuffersAvailable) -{ - AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext; - int refillCount; - - if (Type == HCI_ACL_TYPE) { - refillCount = MAX_ACL_RECV_BUFS - BuffersAvailable; - } else { - refillCount = MAX_EVT_RECV_BUFS - BuffersAvailable; - } - - if (refillCount > 0) { - RefillRecvBuffers(pHcidevInfo,Type,refillCount); - } - -} - -static HCI_SEND_FULL_ACTION ar6000_hci_pkt_send_full(void *pContext, HTC_PACKET *pPacket) -{ - AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext; - HCI_SEND_FULL_ACTION action = HCI_SEND_FULL_KEEP; - - if (!pHcidevInfo->HciNormalMode) { - /* for epping testing, check packet tag, some epping packets are - * special and cannot be dropped */ - if (HTC_GET_TAG_FROM_PKT(pPacket) == AR6K_DATA_PKT_TAG) { - action = HCI_SEND_FULL_DROP; - } - } - - return action; -} - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -A_STATUS ar6000_setup_hci(void *ar) -#else -A_STATUS ar6000_setup_hci(AR_SOFTC_T *ar) -#endif -{ - HCI_TRANSPORT_CONFIG_INFO config; - A_STATUS status = A_OK; - int i; - HTC_PACKET *pPacket; - AR6K_HCI_BRIDGE_INFO *pHcidevInfo; - - - do { - - pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)A_MALLOC(sizeof(AR6K_HCI_BRIDGE_INFO)); - - if (NULL == pHcidevInfo) { - status = A_NO_MEMORY; - break; - } - - A_MEMZERO(pHcidevInfo, sizeof(AR6K_HCI_BRIDGE_INFO)); -#ifdef EXPORT_HCI_BRIDGE_INTERFACE - g_pHcidevInfo = pHcidevInfo; - pHcidevInfo->HCITransHdl = *(HCI_TRANSPORT_MISC_HANDLES *)ar; -#else - ar->hcidev_info = pHcidevInfo; - pHcidevInfo->ar = ar; -#endif - spin_lock_init(&pHcidevInfo->BridgeLock); - INIT_HTC_PACKET_QUEUE(&pHcidevInfo->HTCPacketStructHead); - - ar->exitCallback = AR3KConfigureExit; - - status = bt_setup_hci(pHcidevInfo); - if (A_FAILED(status)) { - break; - } - - if (pHcidevInfo->HciNormalMode) { - AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE, ("HCI Bridge: running in normal mode... \n")); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE, ("HCI Bridge: running in test mode... \n")); - } - - pHcidevInfo->pHTCStructAlloc = (A_UINT8 *)A_MALLOC((sizeof(HTC_PACKET)) * NUM_HTC_PACKET_STRUCTS); - - if (NULL == pHcidevInfo->pHTCStructAlloc) { - status = A_NO_MEMORY; - break; - } - - pPacket = (HTC_PACKET *)pHcidevInfo->pHTCStructAlloc; - for (i = 0; i < NUM_HTC_PACKET_STRUCTS; i++,pPacket++) { - FreeHTCStruct(pHcidevInfo,pPacket); - } - - A_MEMZERO(&config,sizeof(HCI_TRANSPORT_CONFIG_INFO)); - config.ACLRecvBufferWaterMark = MAX_ACL_RECV_BUFS / 2; - config.EventRecvBufferWaterMark = MAX_EVT_RECV_BUFS / 2; - config.MaxSendQueueDepth = MAX_HCI_WRITE_QUEUE_DEPTH; - config.pContext = pHcidevInfo; - config.TransportFailure = ar6000_hci_transport_failure; - config.TransportReady = ar6000_hci_transport_ready; - config.TransportRemoved = ar6000_hci_transport_removed; - config.pHCISendComplete = ar6000_hci_send_complete; - config.pHCIPktRecv = ar6000_hci_pkt_recv; - config.pHCIPktRecvRefill = ar6000_hci_pkt_refill; - config.pHCISendFull = ar6000_hci_pkt_send_full; - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE - pHcidevInfo->pHCIDev = HCI_TransportAttach(pHcidevInfo->HCITransHdl.htcHandle, &config); -#else - pHcidevInfo->pHCIDev = HCI_TransportAttach(ar->arHtcTarget, &config); -#endif - - if (NULL == pHcidevInfo->pHCIDev) { - status = A_ERROR; - } - - } while (FALSE); - - if (A_FAILED(status)) { - if (pHcidevInfo != NULL) { - if (NULL == pHcidevInfo->pHCIDev) { - /* GMBOX may not be present in older chips */ - /* just return success */ - status = A_OK; - } - } - ar6000_cleanup_hci(ar); - } - - return status; -} - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -void ar6000_cleanup_hci(void *ar) -#else -void ar6000_cleanup_hci(AR_SOFTC_T *ar) -#endif -{ -#ifdef EXPORT_HCI_BRIDGE_INTERFACE - AR6K_HCI_BRIDGE_INFO *pHcidevInfo = g_pHcidevInfo; -#else - AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)ar->hcidev_info; -#endif - - if (pHcidevInfo != NULL) { - bt_cleanup_hci(pHcidevInfo); - - if (pHcidevInfo->pHCIDev != NULL) { - HCI_TransportStop(pHcidevInfo->pHCIDev); - HCI_TransportDetach(pHcidevInfo->pHCIDev); - pHcidevInfo->pHCIDev = NULL; - } - - if (pHcidevInfo->pHTCStructAlloc != NULL) { - A_FREE(pHcidevInfo->pHTCStructAlloc); - pHcidevInfo->pHTCStructAlloc = NULL; - } - - A_FREE(pHcidevInfo); -#ifndef EXPORT_HCI_BRIDGE_INTERFACE - ar->hcidev_info = NULL; - ar->exitCallback = NULL; -#endif - } - - -} - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -A_STATUS hci_test_send(void *ar, struct sk_buff *skb) -#else -A_STATUS hci_test_send(AR_SOFTC_T *ar, struct sk_buff *skb) -#endif -{ - int status = A_OK; - int length; - EPPING_HEADER *pHeader; - HTC_PACKET *pPacket; - HTC_TX_TAG htc_tag = AR6K_DATA_PKT_TAG; -#ifdef EXPORT_HCI_BRIDGE_INTERFACE - AR6K_HCI_BRIDGE_INFO *pHcidevInfo = g_pHcidevInfo; -#else - AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)ar->hcidev_info; -#endif - - do { - - if (NULL == pHcidevInfo) { - status = A_ERROR; - break; - } - - if (NULL == pHcidevInfo->pHCIDev) { - status = A_ERROR; - break; - } - - if (pHcidevInfo->HciNormalMode) { - /* this interface cannot run when normal WMI is running */ - status = A_ERROR; - break; - } - - pHeader = (EPPING_HEADER *)A_NETBUF_DATA(skb); - - if (!IS_EPPING_PACKET(pHeader)) { - status = A_EINVAL; - break; - } - - if (IS_EPING_PACKET_NO_DROP(pHeader)) { - htc_tag = AR6K_CONTROL_PKT_TAG; - } - - length = sizeof(EPPING_HEADER) + pHeader->DataLength; - - pPacket = AllocHTCStruct(pHcidevInfo); - if (NULL == pPacket) { - status = A_NO_MEMORY; - break; - } - - SET_HTC_PACKET_INFO_TX(pPacket, - skb, - A_NETBUF_DATA(skb), - length, - HCI_ACL_TYPE, /* send every thing out as ACL */ - htc_tag); - - HCI_TransportSendPkt(pHcidevInfo->pHCIDev,pPacket,FALSE); - pPacket = NULL; - - } while (FALSE); - - return status; -} - -void ar6000_set_default_ar3kconfig(AR_SOFTC_T *ar, void *ar3kconfig) -{ - AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)ar->hcidev_info; - AR3K_CONFIG_INFO *config = (AR3K_CONFIG_INFO *)ar3kconfig; - - config->pHCIDev = pHcidevInfo->pHCIDev; - config->pHCIProps = &pHcidevInfo->HCIProps; - config->pHIFDevice = ar->arHifDevice; - config->pBtStackHCIDev = pHcidevInfo->pBtStackHCIDev; - config->Flags |= AR3K_CONFIG_FLAG_SET_AR3K_BAUD; - config->AR3KBaudRate = 115200; -} - -#ifdef CONFIG_BLUEZ_HCI_BRIDGE -/*** BT Stack Entrypoints *******/ - -/* - * bt_open - open a handle to the device -*/ -static int bt_open(struct hci_dev *hdev) -{ - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HCI Bridge: bt_open - enter - x\n")); - set_bit(HCI_RUNNING, &hdev->flags); - set_bit(HCI_UP, &hdev->flags); - set_bit(HCI_INIT, &hdev->flags); - return 0; -} - -/* - * bt_close - close handle to the device -*/ -static int bt_close(struct hci_dev *hdev) -{ - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HCI Bridge: bt_close - enter\n")); - clear_bit(HCI_RUNNING, &hdev->flags); - return 0; -} - -/* - * bt_send_frame - send data frames -*/ -static int bt_send_frame(struct sk_buff *skb) -{ - struct hci_dev *hdev = (struct hci_dev *)skb->dev; - HCI_TRANSPORT_PACKET_TYPE type; - AR6K_HCI_BRIDGE_INFO *pHcidevInfo; - HTC_PACKET *pPacket; - A_STATUS status = A_OK; - struct sk_buff *txSkb = NULL; - - if (!hdev) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, ("HCI Bridge: bt_send_frame - no device\n")); - return -ENODEV; - } - - if (!test_bit(HCI_RUNNING, &hdev->flags)) { - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HCI Bridge: bt_send_frame - not open\n")); - return -EBUSY; - } - - pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)hdev->driver_data; - A_ASSERT(pHcidevInfo != NULL); - - AR_DEBUG_PRINTF(ATH_DEBUG_HCI_SEND, ("+bt_send_frame type: %d \n",bt_cb(skb)->pkt_type)); - type = HCI_COMMAND_TYPE; - - switch (bt_cb(skb)->pkt_type) { - case HCI_COMMAND_PKT: - type = HCI_COMMAND_TYPE; - hdev->stat.cmd_tx++; - break; - - case HCI_ACLDATA_PKT: - type = HCI_ACL_TYPE; - hdev->stat.acl_tx++; - break; - - case HCI_SCODATA_PKT: - /* we don't support SCO over the bridge */ - kfree_skb(skb); - return 0; - default: - A_ASSERT(FALSE); - kfree_skb(skb); - return 0; - } - - if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_HCI_DUMP)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,(">>> Send HCI %s packet len: %d\n", - (type == HCI_COMMAND_TYPE) ? "COMMAND" : "ACL", - skb->len)); - if (type == HCI_COMMAND_TYPE) { - A_UINT16 opcode = HCI_GET_OP_CODE(skb->data); - AR_DEBUG_PRINTF(ATH_DEBUG_ANY,(" HCI Command: OGF:0x%X OCF:0x%X \r\n", - opcode >> 10, opcode & 0x3FF)); - } - AR_DEBUG_PRINTBUF(skb->data,skb->len,"BT HCI SEND Packet Dump"); - } - - do { - - txSkb = bt_skb_alloc(TX_PACKET_RSV_OFFSET + pHcidevInfo->HCIProps.HeadRoom + - pHcidevInfo->HCIProps.TailRoom + skb->len, - GFP_ATOMIC); - - if (txSkb == NULL) { - status = A_NO_MEMORY; - break; - } - - bt_cb(txSkb)->pkt_type = bt_cb(skb)->pkt_type; - txSkb->dev = (void *)pHcidevInfo->pBtStackHCIDev; - skb_reserve(txSkb, TX_PACKET_RSV_OFFSET + pHcidevInfo->HCIProps.HeadRoom); - A_MEMCPY(txSkb->data, skb->data, skb->len); - skb_put(txSkb,skb->len); - - pPacket = AllocHTCStruct(pHcidevInfo); - if (NULL == pPacket) { - status = A_NO_MEMORY; - break; - } - - /* HCI packet length here doesn't include the 1-byte transport header which - * will be handled by the HCI transport layer. Enough headroom has already - * been reserved above for the transport header - */ - SET_HTC_PACKET_INFO_TX(pPacket, - txSkb, - txSkb->data, - txSkb->len, - type, - AR6K_CONTROL_PKT_TAG); /* HCI packets cannot be dropped */ - - AR_DEBUG_PRINTF(ATH_DEBUG_HCI_SEND, ("HCI Bridge: bt_send_frame skb:0x%lX \n",(unsigned long)txSkb)); - AR_DEBUG_PRINTF(ATH_DEBUG_HCI_SEND, ("HCI Bridge: type:%d, Total Length:%d Bytes \n", - type, txSkb->len)); - - status = HCI_TransportSendPkt(pHcidevInfo->pHCIDev,pPacket,FALSE); - pPacket = NULL; - txSkb = NULL; - - } while (FALSE); - - if (txSkb != NULL) { - kfree_skb(txSkb); - } - - kfree_skb(skb); - - AR_DEBUG_PRINTF(ATH_DEBUG_HCI_SEND, ("-bt_send_frame \n")); - return 0; -} - -/* - * bt_ioctl - ioctl processing -*/ -static int bt_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) -{ - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HCI Bridge: bt_ioctl - enter\n")); - return -ENOIOCTLCMD; -} - -/* - * bt_flush - flush outstandingbpackets -*/ -static int bt_flush(struct hci_dev *hdev) -{ - AR6K_HCI_BRIDGE_INFO *pHcidevInfo; - - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HCI Bridge: bt_flush - enter\n")); - - pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)hdev->driver_data; - - /* TODO??? */ - - return 0; -} - - -/* - * bt_destruct - -*/ -static void bt_destruct(struct hci_dev *hdev) -{ - AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HCI Bridge: bt_destruct - enter\n")); - /* nothing to do here */ -} - -static A_STATUS bt_setup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo) -{ - A_STATUS status = A_OK; - struct hci_dev *pHciDev = NULL; - HIF_DEVICE_OS_DEVICE_INFO osDevInfo; - - if (!setupbtdev) { - return A_OK; - } - - do { - - A_MEMZERO(&osDevInfo,sizeof(osDevInfo)); - /* get the underlying OS device */ -#ifdef EXPORT_HCI_BRIDGE_INTERFACE - status = ar6000_get_hif_dev((HIF_DEVICE *)(pHcidevInfo->HCITransHdl.hifDevice), - &osDevInfo); -#else - status = HIFConfigureDevice(pHcidevInfo->ar->arHifDevice, - HIF_DEVICE_GET_OS_DEVICE, - &osDevInfo, - sizeof(osDevInfo)); -#endif - - if (A_FAILED(status)) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to OS device info from HIF\n")); - break; - } - - /* allocate a BT HCI struct for this device */ - pHciDev = hci_alloc_dev(); - if (NULL == pHciDev) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge - failed to allocate bt struct \n")); - status = A_NO_MEMORY; - break; - } - /* save the device, we'll register this later */ - pHcidevInfo->pBtStackHCIDev = pHciDev; - SET_HCIDEV_DEV(pHciDev,osDevInfo.pOSDevice); - SET_HCI_BUS_TYPE(pHciDev, HCI_VIRTUAL, HCI_BREDR); - pHciDev->driver_data = pHcidevInfo; - pHciDev->open = bt_open; - pHciDev->close = bt_close; - pHciDev->send = bt_send_frame; - pHciDev->ioctl = bt_ioctl; - pHciDev->flush = bt_flush; - pHciDev->destruct = bt_destruct; - pHciDev->owner = THIS_MODULE; - /* driver is running in normal BT mode */ - pHcidevInfo->HciNormalMode = TRUE; - - } while (FALSE); - - if (A_FAILED(status)) { - bt_cleanup_hci(pHcidevInfo); - } - - return status; -} - -static void bt_cleanup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo) -{ - int err; - - if (pHcidevInfo->HciRegistered) { - pHcidevInfo->HciRegistered = FALSE; - clear_bit(HCI_RUNNING, &pHcidevInfo->pBtStackHCIDev->flags); - clear_bit(HCI_UP, &pHcidevInfo->pBtStackHCIDev->flags); - clear_bit(HCI_INIT, &pHcidevInfo->pBtStackHCIDev->flags); - A_ASSERT(pHcidevInfo->pBtStackHCIDev != NULL); - /* unregister */ - if ((err = hci_unregister_dev(pHcidevInfo->pBtStackHCIDev)) < 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge: failed to unregister with bluetooth %d\n",err)); - } - } - - if (pHcidevInfo->pBtStackHCIDev != NULL) { - kfree(pHcidevInfo->pBtStackHCIDev); - pHcidevInfo->pBtStackHCIDev = NULL; - } -} - -static A_STATUS bt_register_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo) -{ - int err; - A_STATUS status = A_OK; - - do { - AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE, ("HCI Bridge: registering HCI... \n")); - A_ASSERT(pHcidevInfo->pBtStackHCIDev != NULL); - /* mark that we are registered */ - pHcidevInfo->HciRegistered = TRUE; - if ((err = hci_register_dev(pHcidevInfo->pBtStackHCIDev)) < 0) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge: failed to register with bluetooth %d\n",err)); - pHcidevInfo->HciRegistered = FALSE; - status = A_ERROR; - break; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE, ("HCI Bridge: HCI registered \n")); - - } while (FALSE); - - return status; -} - -static A_BOOL bt_indicate_recv(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, - HCI_TRANSPORT_PACKET_TYPE Type, - struct sk_buff *skb) -{ - A_UINT8 btType; - int len; - A_BOOL success = FALSE; - BT_HCI_EVENT_HEADER *pEvent; - - do { - - if (!test_bit(HCI_RUNNING, &pHcidevInfo->pBtStackHCIDev->flags)) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, ("HCI Bridge: bt_indicate_recv - not running\n")); - break; - } - - switch (Type) { - case HCI_ACL_TYPE: - btType = HCI_ACLDATA_PKT; - break; - case HCI_EVENT_TYPE: - btType = HCI_EVENT_PKT; - break; - default: - btType = 0; - A_ASSERT(FALSE); - break; - } - - if (0 == btType) { - break; - } - - /* set the final type */ - bt_cb(skb)->pkt_type = btType; - /* set dev */ - skb->dev = (void *)pHcidevInfo->pBtStackHCIDev; - len = skb->len; - - if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_HCI_RECV)) { - if (bt_cb(skb)->pkt_type == HCI_EVENT_PKT) { - pEvent = (BT_HCI_EVENT_HEADER *)skb->data; - AR_DEBUG_PRINTF(ATH_DEBUG_HCI_RECV, ("BT HCI EventCode: %d, len:%d \n", - pEvent->EventCode, pEvent->ParamLength)); - } - } - - /* pass receive packet up the stack */ -#ifdef CONFIG_BT - if (hci_recv_frame(skb) != 0) { -#else - if (1) { -#endif - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge: hci_recv_frame failed \n")); - break; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_HCI_RECV, - ("HCI Bridge: Indicated RCV of type:%d, Length:%d \n",btType,len)); - } - - success = TRUE; - - } while (FALSE); - - return success; -} - -static struct sk_buff* bt_alloc_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, int Length) -{ - struct sk_buff *skb; - /* in normal HCI mode we need to alloc from the bt core APIs */ - skb = bt_skb_alloc(Length, GFP_ATOMIC); - if (NULL == skb) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to alloc bt sk_buff \n")); - } - return skb; -} - -static void bt_free_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, struct sk_buff *skb) -{ - kfree_skb(skb); -} - -#else // { CONFIG_BLUEZ_HCI_BRIDGE - - /* stubs when we only want to test the HCI bridging Interface without the HT stack */ -static A_STATUS bt_setup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo) -{ - return A_OK; -} -static void bt_cleanup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo) -{ - -} -static A_STATUS bt_register_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo) -{ - A_ASSERT(FALSE); - return A_ERROR; -} - -static A_BOOL bt_indicate_recv(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, - HCI_TRANSPORT_PACKET_TYPE Type, - struct sk_buff *skb) -{ - A_ASSERT(FALSE); - return FALSE; -} - -static struct sk_buff* bt_alloc_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, int Length) -{ - A_ASSERT(FALSE); - return NULL; -} -static void bt_free_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, struct sk_buff *skb) -{ - A_ASSERT(FALSE); -} - -#endif // } CONFIG_BLUEZ_HCI_BRIDGE - -#else // { ATH_AR6K_ENABLE_GMBOX - - /* stubs when GMBOX support is not needed */ - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -A_STATUS ar6000_setup_hci(void *ar) -#else -A_STATUS ar6000_setup_hci(AR_SOFTC_T *ar) -#endif -{ - return A_OK; -} - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -void ar6000_cleanup_hci(void *ar) -#else -void ar6000_cleanup_hci(AR_SOFTC_T *ar) -#endif -{ - return; -} - -#ifndef EXPORT_HCI_BRIDGE_INTERFACE -void ar6000_set_default_ar3kconfig(AR_SOFTC_T *ar, void *ar3kconfig) -{ - return; -} -#endif - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -int hci_test_send(void *ar, struct sk_buff *skb) -#else -int hci_test_send(AR_SOFTC_T *ar, struct sk_buff *skb) -#endif -{ - return -EOPNOTSUPP; -} - -#endif // } ATH_AR6K_ENABLE_GMBOX - - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -static int __init -hcibridge_init_module(void) -{ - A_STATUS status; - HCI_TRANSPORT_CALLBACKS hciTransCallbacks; - - hciTransCallbacks.setupTransport = ar6000_setup_hci; - hciTransCallbacks.cleanupTransport = ar6000_cleanup_hci; - - status = ar6000_register_hci_transport(&hciTransCallbacks); - if(status != A_OK) - return -ENODEV; - - return 0; -} - -static void __exit -hcibridge_cleanup_module(void) -{ -} - -module_init(hcibridge_init_module); -module_exit(hcibridge_cleanup_module); -MODULE_LICENSE("GPL and additional rights"); -#endif diff --git a/drivers/net/wireless/ar6003/host/os/linux/include/ar6000_drv.h b/drivers/net/wireless/ar6003/host/os/linux/include/ar6000_drv.h deleted file mode 100644 index 762ff5fc7836..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/include/ar6000_drv.h +++ /dev/null @@ -1,919 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -#ifndef _AR6000_H_ -#define _AR6000_H_ - -#include - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17) -#include -#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) -#include -#else -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) -#include -#else -#include -#endif -#include -#ifdef ATH6K_CONFIG_CFG80211 -#include -#endif /* ATH6K_CONFIG_CFG80211 */ -#include -#include - -#include -#include -#include "a_types.h" -#include "a_osapi.h" -#include "htc_api.h" -#include "wmi.h" -#include "a_drv.h" -#include "bmi.h" -#include -#include -#include -#include -#include "gpio_api.h" -#include "gpio.h" -#include "pkt_log.h" -#include "aggr_recv_api.h" -#include -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -#include -#else -#include -#include -#endif -#include "ar6000_api.h" -#ifdef CONFIG_HOST_TCMD_SUPPORT -#include -#endif -#include - -#include "targaddrs.h" -#include "dbglog_api.h" -#include "ar6000_diag.h" -#include "common_drv.h" -#include "roaming.h" -#include "hci_transport_api.h" -#define ATH_MODULE_NAME driver -#include "a_debug.h" - -#define ATH_DEBUG_DBG_LOG ATH_DEBUG_MAKE_MODULE_MASK(0) -#define ATH_DEBUG_WLAN_CONNECT ATH_DEBUG_MAKE_MODULE_MASK(1) -#define ATH_DEBUG_WLAN_SCAN ATH_DEBUG_MAKE_MODULE_MASK(2) -#define ATH_DEBUG_WLAN_TX ATH_DEBUG_MAKE_MODULE_MASK(3) -#define ATH_DEBUG_WLAN_RX ATH_DEBUG_MAKE_MODULE_MASK(4) -#define ATH_DEBUG_HTC_RAW ATH_DEBUG_MAKE_MODULE_MASK(5) -#define ATH_DEBUG_HCI_BRIDGE ATH_DEBUG_MAKE_MODULE_MASK(6) -#define ATH_DEBUG_HCI_RECV ATH_DEBUG_MAKE_MODULE_MASK(7) -#define ATH_DEBUG_HCI_SEND ATH_DEBUG_MAKE_MODULE_MASK(8) -#define ATH_DEBUG_HCI_DUMP ATH_DEBUG_MAKE_MODULE_MASK(9) - -#ifndef __dev_put -#define __dev_put(dev) dev_put(dev) -#endif - - - -#ifdef ATH6K_CONFIG_CFG80211 -#define NUM_SUBQUEUE 1 -#endif - -#ifdef USER_KEYS - -#define USER_SAVEDKEYS_STAT_INIT 0 -#define USER_SAVEDKEYS_STAT_RUN 1 - -// TODO this needs to move into the AR_SOFTC struct -struct USER_SAVEDKEYS { - struct ieee80211req_key ucast_ik; - struct ieee80211req_key bcast_ik; - CRYPTO_TYPE keyType; - A_BOOL keyOk; -}; -#endif - -#define DBG_INFO 0x00000001 -#define DBG_ERROR 0x00000002 -#define DBG_WARNING 0x00000004 -#define DBG_SDIO 0x00000008 -#define DBG_HIF 0x00000010 -#define DBG_HTC 0x00000020 -#define DBG_WMI 0x00000040 -#define DBG_WMI2 0x00000080 -#define DBG_DRIVER 0x00000100 - -#define DBG_DEFAULTS (DBG_ERROR|DBG_WARNING) - - -A_STATUS ar6000_ReadRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data); -A_STATUS ar6000_WriteRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data); - -#ifdef __cplusplus -extern "C" { -#endif - -#define MAX_AR6000 1 -#define AR6000_MAX_RX_BUFFERS 16 -#define AR6000_BUFFER_SIZE 1664 -#define AR6000_MAX_AMSDU_RX_BUFFERS 4 -#define AR6000_AMSDU_REFILL_THRESHOLD 3 -#define AR6000_AMSDU_BUFFER_SIZE (WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH + 128) -#define AR6000_MAX_RX_MESSAGE_SIZE (max(WMI_MAX_NORMAL_RX_DATA_FRAME_LENGTH,WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH)) - -#define AR6000_TX_TIMEOUT 10 -#define AR6000_ETH_ADDR_LEN 6 -#define AR6000_MAX_ENDPOINTS 4 -#define MAX_NODE_NUM 15 -/* MAX_HI_COOKIE_NUM are reserved for high priority traffic */ -#define MAX_DEF_COOKIE_NUM 150 -#define MAX_HI_COOKIE_NUM 15 /* 10% of MAX_COOKIE_NUM */ -#define MAX_COOKIE_NUM (MAX_DEF_COOKIE_NUM + MAX_HI_COOKIE_NUM) - -/* MAX_DEFAULT_SEND_QUEUE_DEPTH is used to set the default queue depth for the - * WMM send queues. If a queue exceeds this depth htc will query back to the - * OS specific layer by calling EpSendFull(). This gives the OS layer the - * opportunity to drop the packet if desired. Therefore changing - * MAX_DEFAULT_SEND_QUEUE_DEPTH does not affect resource utilization but - * does impact the threshold used to identify if a packet should be - * dropped. */ -// #define MAX_DEFAULT_SEND_QUEUE_DEPTH (MAX_DEF_COOKIE_NUM / WMM_NUM_AC) - -// Host Queue depth has been increased during performace chariot endpoint runs. Host may not pump -// as fast as host application expected, due to that panic/packet loss / chariot error happens -// adjusting queue depth size resolve this issue -#define MAX_DEFAULT_SEND_QUEUE_DEPTH 64 - -#define AR6000_HB_CHALLENGE_RESP_FREQ_DEFAULT 1 -#define AR6000_HB_CHALLENGE_RESP_MISS_THRES_DEFAULT 1 -#define A_DISCONNECT_TIMER_INTERVAL 10 * 1000 -#define A_DEFAULT_LISTEN_INTERVAL 100 -#define A_DEFAULT_BMISS_TIME 1500 -#define A_MAX_WOW_LISTEN_INTERVAL 300 -#define A_MAX_WOW_BMISS_TIME 4500 - -enum { - DRV_HB_CHALLENGE = 0, - APP_HB_CHALLENGE -}; - -enum { - WLAN_INIT_MODE_NONE = 0, - WLAN_INIT_MODE_USR, - WLAN_INIT_MODE_UDEV, - WLAN_INIT_MODE_DRV -}; - -/* Suspend - configuration */ -enum { - WLAN_SUSPEND_CUT_PWR = 0, - WLAN_SUSPEND_DEEP_SLEEP, - WLAN_SUSPEND_WOW, - WLAN_SUSPEND_CUT_PWR_IF_BT_OFF -}; - -/* WiFi OFF - configuration */ -enum { - WLAN_OFF_CUT_PWR = 0, - WLAN_OFF_DEEP_SLEEP, -}; - -/* WLAN low power state */ -enum { - WLAN_POWER_STATE_ON = 0, - WLAN_POWER_STATE_CUT_PWR = 1, - WLAN_POWER_STATE_DEEP_SLEEP, - WLAN_POWER_STATE_WOW -}; - -/* WLAN WoW State */ -enum { - WLAN_WOW_STATE_NONE = 0, - WLAN_WOW_STATE_SUSPENDING, - WLAN_WOW_STATE_SUSPENDED -}; - - -typedef enum _AR6K_BIN_FILE { - AR6K_OTP_FILE, - AR6K_FIRMWARE_FILE, - AR6K_PATCH_FILE, - AR6K_BOARD_DATA_FILE, -} AR6K_BIN_FILE; - -#ifdef SETUPHCI_ENABLED -#define SETUPHCI_DEFAULT 1 -#else -#define SETUPHCI_DEFAULT 0 -#endif /* SETUPHCI_ENABLED */ - -#ifdef SETUPHCIPAL_ENABLED -#define SETUPHCIPAL_DEFAULT 1 -#else -#define SETUPHCIPAL_DEFAULT 0 -#endif /* SETUPHCIPAL_ENABLED */ - -#ifdef SETUPBTDEV_ENABLED -#define SETUPBTDEV_DEFAULT 1 -#else -#define SETUPBTDEV_DEFAULT 0 -#endif /* SETUPBTDEV_ENABLED */ - -#ifdef BMIENABLE_SET -#define BMIENABLE_DEFAULT 1 -#else -#define BMIENABLE_DEFAULT 0 -#endif /* BMIENABLE_SET */ - -#ifdef ENABLEUARTPRINT_SET -#define ENABLEUARTPRINT_DEFAULT 1 -#else -#define ENABLEUARTPRINT_DEFAULT 0 -#endif /* ENABLEARTPRINT_SET */ - -#ifdef ATH6KL_CONFIG_HIF_VIRTUAL_SCATTER -#define NOHIFSCATTERSUPPORT_DEFAULT 1 -#else /* ATH6KL_CONFIG_HIF_VIRTUAL_SCATTER */ -#define NOHIFSCATTERSUPPORT_DEFAULT 0 -#endif /* ATH6KL_CONFIG_HIF_VIRTUAL_SCATTER */ - -#ifdef AR600x_BT_AR3001 -#define AR3KHCIBAUD_DEFAULT 3000000 -#define HCIUARTSCALE_DEFAULT 1 -#define HCIUARTSTEP_DEFAULT 8937 -#else -#define AR3KHCIBAUD_DEFAULT 0 -#define HCIUARTSCALE_DEFAULT 0 -#define HCIUARTSTEP_DEFAULT 0 -#endif /* AR600x_BT_AR3001 */ - -#ifdef INIT_MODE_DRV_ENABLED -#define WLAN_INIT_MODE_DEFAULT WLAN_INIT_MODE_DRV -#else -#define WLAN_INIT_MODE_DEFAULT WLAN_INIT_MODE_USR -#endif /* INIT_MODE_DRV_ENABLED */ - -#define AR6K_DATASET_PATCH_ADDRESS(_param, _ver) do { \ - if ((_ver) == AR6003_REV2_VERSION) { \ - (_param) = AR6003_REV2_DATASET_PATCH_ADDRESS; \ - } else if ((_ver) == AR6003_REV3_VERSION) { \ - (_param) = AR6003_REV3_DATASET_PATCH_ADDRESS; \ - } else { \ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown Version: %d\n", _ver)); \ - A_ASSERT(0); \ - } \ -} while (0) - -#define AR6K_APP_LOAD_ADDRESS(_param, _ver) do { \ - if ((_ver) == AR6003_REV2_VERSION) { \ - (_param) = AR6003_REV2_APP_LOAD_ADDRESS; \ - } else if ((_ver) == AR6003_REV3_VERSION) { \ - (_param) = AR6003_REV3_APP_LOAD_ADDRESS; \ - } else { \ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown Version: %d\n", _ver)); \ - A_ASSERT(0); \ - } \ -} while (0) - -#define AR6K_APP_START_OVERRIDE_ADDRESS(_param, _ver) do { \ - if ((_ver) == AR6003_REV2_VERSION) { \ - (_param) = AR6003_REV2_APP_START_OVERRIDE; \ - } else if ((_ver) == AR6003_REV3_VERSION) { \ - (_param) = AR6003_REV3_APP_START_OVERRIDE; \ - } else { \ - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown Version: %d\n", _ver)); \ - A_ASSERT(0); \ - } \ -} while (0) - -#define AR6003_SUBVER_DEFAULT 1 -#define AR6003_SUBVER_ROUTER 2 -#define AR6003_SUBVER_MOBILE 3 -#define AR6003_SUBVER_TABLET 4 - -/* AR6003 2.0 definitions */ -#define AR6003_REV2_VERSION 0x30000384 -#define AR6003_REV2_OTP_FILE "otp.bin.z77" -#define AR6003_REV2_FIRMWARE_FILE "athwlan.bin.z77" -#define AR6003_REV2_TCMD_FIRMWARE_FILE "athtcmd_ram.bin" -#define AR6003_REV2_TESTSCRIPT_FILE "testflow.bin" -#define AR6003_REV2_UTF_FIRMWARE_FILE "utf.bin" -#define AR6003_REV2_ART_FIRMWARE_FILE "device.bin" -#define AR6003_REV2_PATCH_FILE "data.patch.hw2_0.bin" -#define AR6003_REV2_EPPING_FIRMWARE_FILE "endpointping.bin" -#ifdef AR600x_SD31_XXX -#define AR6003_REV2_BOARD_DATA_FILE "bdata.SD31.bin" -#elif defined(AR600x_SD32_XXX) -#define AR6003_REV2_BOARD_DATA_FILE "bdata.SD32.bin" -#elif defined(AR600x_WB31_XXX) -#define AR6003_REV2_BOARD_DATA_FILE "bdata.WB31.bin" -#else -#define AR6003_REV2_BOARD_DATA_FILE "bdata.CUSTOM.bin" -#endif /* Board Data File */ - -/* AR6003 3.0 definitions */ -#define AR6003_REV3_VERSION 0x30000582 -#define AR6003_REV3_OTP_FILE "ath6k/AR6003/hw2.1.1/otp.bin" -#define AR6003_REV3_DEFAULT_FIRMWARE_FILE "ath6k/AR6003/hw2.1.1/athwlan.bin" -#define AR6003_REV3_ROUTER_FIRMWARE_FILE "ath6k/AR6003/hw2.1.1/athwlan_router.bin" -#define AR6003_REV3_MOBILE_FIRMWARE_FILE "ath6k/AR6003/hw2.1.1/athwlan_mobile.bin" -#define AR6003_REV3_TABLET_FIRMWARE_FILE "ath6k/AR6003/hw2.1.1/athwlan_tablet.bin" -#define AR6003_REV3_TCMD_FIRMWARE_FILE "ath6k/AR6003/hw2.1.1/athtcmd_ram.bin" -#define AR6003_REV3_TESTSCRIPT_FILE "ath6k/AR6003/hw2.1.1/testflow.bin" -#define AR6003_REV3_UTF_FIRMWARE_FILE "ath6k/AR6003/hw2.1.1/utf.bin" -#define AR6003_REV3_ART_FIRMWARE_FILE "ath6k/AR6003/hw2.1.1/device.bin" -#define AR6003_REV3_PATCH_FILE "ath6k/AR6003/hw2.1.1/data.patch.hw3_0.bin" -#define AR6003_REV3_EPPING_FIRMWARE_FILE "ath6k/AR6003/hw2.1.1/endpointping.bin" -#ifdef AR600x_SD31_XXX -#define AR6003_REV3_BOARD_DATA_FILE "ath6k/AR6003/hw2.1.1/bdata.SD31.bin" -#elif defined(AR600x_SD32_XXX) -#define AR6003_REV3_BOARD_DATA_FILE "ath6k/AR6003/hw2.1.1/bdata.SD32.bin" -#elif defined(AR600x_WB31_XXX) -#define AR6003_REV3_BOARD_DATA_FILE "ath6k/AR6003/hw2.1.1/bdata.WB31.bin" -#else -#define AR6003_REV3_BOARD_DATA_FILE "ath6k/AR6003/hw2.1.1/bdata.CUSTOM.bin" -#endif /* Board Data File */ - -/* AP-STA Concurrency */ -#define GET_CONN_AP_PRIV(_ar,_priv) do { \ - int i; \ - AR_SOFTC_DEV_T *tDev =NULL; \ - for(i=0;i<_ar->arConfNumDev;i++) { \ - tDev = _ar->arDev[i]; \ - if((tDev->arNetworkType == AP_NETWORK) && \ - (tDev->arConnected)) { \ - _priv = tDev; \ - break; \ - } \ - } \ -}while(0); - -/* Power states */ -enum { - WLAN_PWR_CTRL_UP = 0, - WLAN_PWR_CTRL_CUT_PWR, - WLAN_PWR_CTRL_DEEP_SLEEP, - WLAN_PWR_CTRL_WOW, - WLAN_PWR_CTRL_DEEP_SLEEP_DISABLED -}; - -/* HTC RAW streams */ -typedef enum _HTC_RAW_STREAM_ID { - HTC_RAW_STREAM_NOT_MAPPED = -1, - HTC_RAW_STREAM_0 = 0, - HTC_RAW_STREAM_1 = 1, - HTC_RAW_STREAM_2 = 2, - HTC_RAW_STREAM_3 = 3, - HTC_RAW_STREAM_NUM_MAX -} HTC_RAW_STREAM_ID; - -#define RAW_HTC_READ_BUFFERS_NUM 4 -#define RAW_HTC_WRITE_BUFFERS_NUM 4 - -#define HTC_RAW_BUFFER_SIZE 1664 - -typedef struct { - int currPtr; - int length; - A_UINT8 _Pad1[A_CACHE_LINE_PAD]; - unsigned char data[HTC_RAW_BUFFER_SIZE]; - A_UINT8 _Pad2[A_CACHE_LINE_PAD]; - HTC_PACKET HTCPacket; -} raw_htc_buffer; - -#ifdef CONFIG_HOST_TCMD_SUPPORT -/* - * add TCMD_MODE besides wmi and bypasswmi - * in TCMD_MODE, only few TCMD releated wmi commands - * counld be hanlder - */ -enum { - AR6000_WMI_MODE = 0, - AR6000_BYPASS_MODE, - AR6000_TCMD_MODE, - AR6000_WLAN_MODE -}; -#endif /* CONFIG_HOST_TCMD_SUPPORT */ - -struct ar_wep_key { - A_UINT8 arKeyIndex; - A_UINT8 arKeyLen; - A_UINT8 arKey[64]; -} ; - -#ifdef ATH6K_CONFIG_CFG80211 -struct ar_key { - A_UINT8 key[WLAN_MAX_KEY_LEN]; - A_UINT8 key_len; - A_UINT8 seq[IW_ENCODE_SEQ_MAX_SIZE]; - A_UINT8 seq_len; - A_UINT32 cipher; -}; -#endif /* ATH6K_CONFIG_CFG80211 */ - - -struct ar_node_mapping { - A_UINT8 macAddress[6]; - A_UINT8 epId; - A_UINT8 txPending; -}; - -struct ar_cookie { - unsigned long arc_bp[2]; /* Must be first field */ - HTC_PACKET HtcPkt; /* HTC packet wrapper */ - struct ar_cookie *arc_list_next; -}; - -struct ar_hb_chlng_resp { - A_TIMER timer; - A_UINT32 frequency; - A_UINT32 seqNum; - A_BOOL outstanding; - A_UINT8 missCnt; - A_UINT8 missThres; -}; - -/* Per STA data, used in AP mode */ -/*TODO: All this should move to OS independent dir */ - -#define STA_PWR_MGMT_MASK 0x1 -#define STA_PWR_MGMT_SHIFT 0x0 -#define STA_PWR_MGMT_AWAKE 0x0 -#define STA_PWR_MGMT_SLEEP 0x1 - -#define STA_SET_PWR_SLEEP(sta) (sta->flags |= (STA_PWR_MGMT_MASK << STA_PWR_MGMT_SHIFT)) -#define STA_CLR_PWR_SLEEP(sta) (sta->flags &= ~(STA_PWR_MGMT_MASK << STA_PWR_MGMT_SHIFT)) -#define STA_IS_PWR_SLEEP(sta) ((sta->flags >> STA_PWR_MGMT_SHIFT) & STA_PWR_MGMT_MASK) - -#define STA_PS_POLLED_MASK 0x1 -#define STA_PS_POLLED_SHIFT 0x1 - -#define STA_SET_PS_POLLED(sta) (sta->flags |= (STA_PS_POLLED_MASK << STA_PS_POLLED_SHIFT)) -#define STA_CLR_PS_POLLED(sta) (sta->flags &= ~(STA_PS_POLLED_MASK << STA_PS_POLLED_SHIFT)) -#define STA_IS_PS_POLLED(sta) (sta->flags & (STA_PS_POLLED_MASK << STA_PS_POLLED_SHIFT)) - -#define STA_APSD_TRIGGER_MASK 0x1 -#define STA_APSD_TRIGGER_SHIFT 0x2 -#define STA_APSD_EOSP_MASK 0x1 -#define STA_APSD_EOSP_SHIFT 0x3 - -#define STA_SET_APSD_TRIGGER(sta) (sta->flags |= (STA_APSD_TRIGGER_MASK << STA_APSD_TRIGGER_SHIFT)) -#define STA_CLR_APSD_TRIGGER(sta) (sta->flags &= ~(STA_APSD_TRIGGER_MASK << STA_APSD_TRIGGER_SHIFT)) -#define STA_IS_APSD_TRIGGER(sta) (sta->flags & (STA_APSD_TRIGGER_MASK << STA_APSD_TRIGGER_SHIFT)) - -#define STA_SET_APSD_EOSP(sta) (sta->flags |= (STA_APSD_EOSP_MASK << STA_APSD_EOSP_SHIFT)) -#define STA_CLR_APSD_EOSP(sta) (sta->flags &= ~(STA_APSD_EOSP_MASK << STA_APSD_EOSP_SHIFT)) -#define STA_IS_APSD_EOSP(sta) (sta->flags & (STA_APSD_EOSP_MASK << STA_APSD_EOSP_SHIFT)) - -#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL -#define APTC_TRAFFIC_SAMPLING_INTERVAL 100 /* msec */ -#define APTC_UPPER_THROUGHPUT_THRESHOLD 3000 /* Kbps */ -#define APTC_LOWER_THROUGHPUT_THRESHOLD 2000 /* Kbps */ - - -typedef struct aptc_traffic_record { - A_BOOL timerScheduled; - struct timeval samplingTS; - unsigned long bytesReceived; - unsigned long bytesTransmitted; -} APTC_TRAFFIC_RECORD; - -#endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ - -typedef struct user_rssi_compensation_t { - A_UINT16 customerID; - union { - A_UINT16 a_enable; - A_UINT16 bg_enable; - A_UINT16 enable; - }; - A_INT16 bg_param_a; - A_INT16 bg_param_b; - A_INT16 a_param_a; - A_INT16 a_param_b; - A_UINT32 reserved; -} USER_RSSI_CPENSATION; - - - -typedef struct { - A_UINT16 flags; - A_UINT8 mac[ATH_MAC_LEN]; - A_UINT8 aid; - A_UINT8 keymgmt; - A_UINT8 ucipher; - A_UINT8 auth; - A_UINT8 wmode; - A_UINT8 wpa_ie[IEEE80211_MAX_IE]; - A_UINT8 apsd_info; - A_NETBUF_QUEUE_T psq; /* power save q */ - A_NETBUF_QUEUE_T apsdq; /* APSD delivery enabled q */ - A_MUTEX_T psqLock; - A_UINT8 ba_state[8]; - void *conn_aggr; - void *arPriv; -} conn_t; - -typedef struct ar6_raw_htc { - HTC_ENDPOINT_ID arRaw2EpMapping[HTC_RAW_STREAM_NUM_MAX]; - HTC_RAW_STREAM_ID arEp2RawMapping[ENDPOINT_MAX]; - struct semaphore raw_htc_read_sem[HTC_RAW_STREAM_NUM_MAX]; - struct semaphore raw_htc_write_sem[HTC_RAW_STREAM_NUM_MAX]; - wait_queue_head_t raw_htc_read_queue[HTC_RAW_STREAM_NUM_MAX]; - wait_queue_head_t raw_htc_write_queue[HTC_RAW_STREAM_NUM_MAX]; - raw_htc_buffer raw_htc_read_buffer[HTC_RAW_STREAM_NUM_MAX][RAW_HTC_READ_BUFFERS_NUM]; - raw_htc_buffer raw_htc_write_buffer[HTC_RAW_STREAM_NUM_MAX][RAW_HTC_WRITE_BUFFERS_NUM]; - A_BOOL write_buffer_available[HTC_RAW_STREAM_NUM_MAX]; - A_BOOL read_buffer_available[HTC_RAW_STREAM_NUM_MAX]; -} AR_RAW_HTC_T; - -#ifdef CONFIG_HOST_TCMD_SUPPORT -typedef struct { - A_UINT16 len; - A_UINT8 ver; - A_UINT8 reserved; - A_UINT8 buf[TC_CMDS_SIZE_MAX]; -} AR_TCMD_RESP; -#endif /* CONFIG_HOST_TCMD_SUPPORT */ - -typedef struct ar6_softc { - spinlock_t arLock; - struct semaphore arSem; - A_BOOL arWmiReady; - int arTxPending[ENDPOINT_MAX]; - int arTotalTxDataPending; - A_UINT8 arNumDataEndPts; - HTC_HANDLE arHtcTarget; - void *arHifDevice; - struct ar6000_version arVersion; - A_UINT32 arTargetType; - AR6000_WLAN_STATE arWlanState; - struct ar_cookie *arCookieList; - A_UINT32 arCookieCount; - struct ar_hb_chlng_resp arHBChallengeResp; - HTC_ENDPOINT_ID arAc2EpMapping[WMM_NUM_AC]; - A_BOOL arAcStreamActive[WMM_NUM_AC]; - A_UINT8 arAcStreamPriMap[WMM_NUM_AC]; - A_UINT8 arHiAcStreamActivePri; - A_UINT8 arEp2AcMapping[ENDPOINT_MAX]; - HTC_ENDPOINT_ID arControlEp; -#ifdef HTC_RAW_INTERFACE - AR_RAW_HTC_T *arRawHtc; -#endif - A_BOOL arRawIfInit; - COMMON_CREDIT_STATE_INFO arCreditStateInfo; - A_BOOL arWMIControlEpFull; - A_BOOL dbgLogFetchInProgress; - A_UCHAR log_buffer[DBGLOG_HOST_LOG_BUFFER_SIZE]; - A_UINT32 log_cnt; - A_UINT32 dbglog_init_done; - HTC_PACKET_QUEUE amsdu_rx_buffer_queue; - A_BOOL bIsDestroyProgress; /* flag to indicate ar6k destroy is in progress */ - A_UINT8 rxMetaVersion; - A_INT32 (*exitCallback)(void *config); /* generic callback at AR6K exit */ - HIF_DEVICE_OS_DEVICE_INFO osDevInfo; - A_UINT16 arWlanPowerState; - A_BOOL arPlatPowerOff; - USER_RSSI_CPENSATION rssi_compensation_param; -#ifdef CONFIG_HOST_TCMD_SUPPORT - A_UINT8 tcmdRxReport; - A_UINT32 tcmdRxTotalPkt; - A_INT32 tcmdRxRssi; - A_UINT32 tcmdPm; - A_UINT32 arTargetMode; - A_UINT32 tcmdRxcrcErrPkt; - A_UINT32 tcmdRxsecErrPkt; - A_UINT16 tcmdRateCnt[TCMD_MAX_RATES]; - A_UINT16 tcmdRateCntShortGuard[TCMD_MAX_RATES]; - AR_TCMD_RESP tcmdResp; -#endif - A_BOOL arWlanOff; -#if CONFIG_PM - A_UINT16 arWowState; - A_BOOL arBTOff; - A_BOOL arBTSharing; - A_UINT16 arSuspendCutPwrConfig; - A_UINT16 arSuspendConfig; - A_UINT16 arWlanOffConfig; - A_UINT16 arWow2Config; -#endif -#ifndef EXPORT_HCI_BRIDGE_INTERFACE - void *hcidev_info; -#endif - conn_t connTbl[NUM_CONN]; /* AP mode */ - WMI_PER_STA_STAT arAPStats[NUM_CONN]; /* AP mode */ - A_UINT8 inter_bss; /* enable/disable inter bss data forward */ - A_UINT8 arAcsDisableHiChannel; - /* AP-STA Concurrency */ - A_UINT8 arConfNumDev; - A_UINT8 arHoldConnection; - A_TIMER ap_reconnect_timer; - A_UINT8 gNumSta; - /* AP-STA Concurrency */ - struct ar6_softc_dev *arDev[NUM_DEV]; - A_BOOL arResumeDone; - /* Bluetooth Address to be read from OTP */ - A_UINT8 bdaddr[6]; -} AR_SOFTC_T; - -typedef struct ar6_softc_ap { - WMI_AP_ACL g_acl; /* AP mode */ - A_UINT8 sta_list_index; /* AP mode */ - struct ieee80211req_key ap_mode_bkey; /* AP mode */ - A_NETBUF_QUEUE_T mcastpsq; /* power save q for Mcast frames */ - A_MUTEX_T mcastpsqLock; - A_BOOL DTIMExpired; /* flag to indicate DTIM expired */ - A_UINT8 intra_bss; /* enable/disable intra bss data forward */ - A_UINT8 ap_hidden_ssid; - A_UINT8 ap_country_code[3]; - A_UINT8 ap_dtim_period; - A_UINT16 ap_beacon_interval; - A_UINT16 arRTS; - void *pDfs; /* Pointer to DFS state structure */ - A_BOOL deKeySet; -}AR_SOFTC_AP_T; - -typedef struct ar6_softc_sta { - A_BOOL arConnectPending; - A_UINT8 arReqBssid[ATH_MAC_LEN]; - A_UINT16 arListenIntervalB; - A_UINT16 arListenIntervalT; - A_UINT16 arBmissTimeB; - A_UINT16 arBmissTimeT; - A_INT8 arRssi; - A_UINT8 arSkipScan; - A_UINT16 arBeaconInterval; - A_UINT8 arKeepaliveConfigured; - A_UINT8 arIbssPsEnable; - A_UINT32 arMgmtFilter; - struct ar_node_mapping arNodeMap[MAX_NODE_NUM]; - A_UINT8 arNodeNum; - A_UINT8 arNexEpId; - A_UINT32 arConnectCtrlFlags; -#ifdef USER_KEYS - A_INT32 user_savedkeys_stat; - A_UINT32 user_key_ctrl; - struct USER_SAVEDKEYS user_saved_keys; -#endif - USER_RSSI_THOLD rssi_map[12]; - A_TIMER disconnect_timer; - A_UINT8 arUserBssFilter; - A_INT8 arNumChannels; - A_UINT16 arChannelList[WMI_MAX_CHANNELS]; - A_UINT8 scan_triggered; - WMI_SCAN_PARAMS_CMD scParams; - A_UINT8 scanSpecificSsid; - A_BOOL wpaOffloadEnabled; - A_BOOL disconnect_timer_inited; -}AR_SOFTC_STA_T; - -typedef struct ar6_softc_dev { - struct net_device *arNetDev; /* net_device pointer */ - void *arWmi; - A_BOOL arWmiEnabled; - wait_queue_head_t arEvent; - spinlock_t arPrivLock; - A_INT8 arMaxRetries; - A_BOOL statsUpdatePending; - A_UINT8 arPhyCapability; - A_UINT16 arChannelHint; - A_UINT16 arBssChannel; - A_BOOL arConnected; - int arSsidLen; - u_char arSsid[WMI_MAX_SSID_LEN]; - A_UINT8 arNextMode; - A_UINT8 arNetworkType; - A_UINT8 arNetworkSubType; - A_UINT8 arDot11AuthMode; - A_UINT8 arAuthMode; - A_UINT8 arPairwiseCrypto; - A_UINT8 arPairwiseCryptoLen; - A_UINT8 arGroupCrypto; - A_UINT8 arGroupCryptoLen; - A_UINT8 arDefTxKeyIndex; - struct ar_wep_key arWepKeyList[WMI_MAX_KEY_INDEX + 1]; - A_UINT8 arBssid[ATH_MAC_LEN]; - A_UINT8 arTxPwr; - A_BOOL arTxPwrSet; - A_INT32 arBitRate; - struct net_device_stats arNetStats; - struct iw_statistics arIwStats; - A_UINT32 arRateMask[WMI_MAX_RATE_MASK]; - A_BOOL arNetQueueStopped; - A_UINT8 arDeviceIndex; - A_BOOL arWmmEnabled; - A_UINT32 arRegCode; - A_UINT16 ap_profile_flag; /* AP mode */ - WMI_BTCOEX_CONFIG_EVENT arBtcoexConfig; - WMI_BTCOEX_STATS_EVENT arBtcoexStats; - WMI_GET_WAC_INFO wacInfo; -#define AR_MCAST_FILTER_MAC_ADDR_SIZE 6 - A_UINT8 mcast_filters[MAC_MAX_FILTERS_PER_LIST][AR_MCAST_FILTER_MAC_ADDR_SIZE]; - A_UINT8 bdaddr[ATH_MAC_LEN]; -#ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL - APTC_TRAFFIC_RECORD aptcTR; -#endif -#ifdef ATH6K_CONFIG_CFG80211 - struct wireless_dev *wdev; - struct cfg80211_scan_request *scan_request; - struct ar_key keys[WMI_MAX_KEY_INDEX + 1]; -#endif /* ATH6K_CONFIG_CFG80211 */ - A_TIMER ap_acs_timer; - TARGET_STATS arTargetStats; - void *conn_aggr; - void *p2p_ctx; - AR_SOFTC_AP_T arAp; - AR_SOFTC_STA_T arSta; - AR_SOFTC_T *arSoftc; - A_UINT8 arHoldConnection; - A_BOOL arDoConnectOnResume; - A_UINT8 num_sta; - void *hcipal_info; - A_BOOL isBt30amp; - A_UINT8 phymode; -}AR_SOFTC_DEV_T; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -/* Looks like we need this for 2.4 kernels */ -static inline void *ar6k_priv(struct net_device *dev) -{ - return(dev->priv); -} -#else -#ifdef ATH6K_CONFIG_CFG80211 -static inline void *ar6k_priv(struct net_device *dev) -{ - return (wdev_priv(dev->ieee80211_ptr)); -} -#else -#define ar6k_priv netdev_priv -#endif /* ATH6K_CONFIG_CFG80211 */ -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) -#define SET_HCI_BUS_TYPE(pHciDev, __bus, __type) do { \ - (pHciDev)->type = (__bus); \ -} while(0) -#else -#define SET_HCI_BUS_TYPE(pHciDev, __bus, __type) do { \ - (pHciDev)->bus = (__bus); \ - (pHciDev)->dev_type = (__type); \ -} while(0) -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -#define GET_INODE_FROM_FILEP(filp) \ - (filp)->f_path.dentry->d_inode -#else -#define GET_INODE_FROM_FILEP(filp) \ - (filp)->f_dentry->d_inode -#endif - -#define arAc2EndpointID(ar,ac) (ar)->arAc2EpMapping[(ac)] -#define arSetAc2EndpointIDMap(ar,ac,ep) \ -{ (ar)->arAc2EpMapping[(ac)] = (ep); \ - (ar)->arEp2AcMapping[(ep)] = (ac); } -#define arEndpoint2Ac(ar,ep) (ar)->arEp2AcMapping[(ep)] - -#define arRawIfEnabled(ar) (ar)->arRawIfInit -#define arRawStream2EndpointID(ar,raw) (ar)->arRawHtc->arRaw2EpMapping[(raw)] -#define arSetRawStream2EndpointIDMap(ar,raw,ep) \ -{ (ar)->arRawHtc->arRaw2EpMapping[(raw)] = (ep); \ - (ar)->arRawHtc->arEp2RawMapping[(ep)] = (raw); } -#define arEndpoint2RawStreamID(ar,ep) (ar)->arRawHtc->arEp2RawMapping[(ep)] - -struct ar_giwscan_param { - char *current_ev; - char *end_buf; - A_UINT32 bytes_needed; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - struct iw_request_info *info; -#endif -}; - -#define AR6000_STAT_INC(ar, stat) (ar->arNetStats.stat++) - -#define AR6000_SPIN_LOCK(lock, param) do { \ - if (irqs_disabled()) { \ - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("IRQs disabled:AR6000_LOCK\n")); \ - } \ - spin_lock_bh(lock); \ -} while (0) - -#define AR6000_SPIN_UNLOCK(lock, param) do { \ - if (irqs_disabled()) { \ - AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("IRQs disabled: AR6000_UNLOCK\n")); \ - } \ - spin_unlock_bh(lock); \ -} while (0) - -int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -int ar6000_ioctl_dispatcher(struct net_device *dev, struct ifreq *rq, int cmd); -void ar6000_gpio_init(void); -void ar6000_init_profile_info(AR_SOFTC_DEV_T *arPriv); -void ar6000_install_static_wep_keys(AR_SOFTC_DEV_T *arPriv); -int ar6000_init(struct net_device *dev); -int ar6000_dbglog_get_debug_logs(AR_SOFTC_T *ar); -void ar6000_TxDataCleanup(AR_SOFTC_T *ar); -int ar6000_acl_data_tx(struct sk_buff *skb, AR_SOFTC_DEV_T *arPriv); -void ar6000_restart_endpoint(AR_SOFTC_T *ar); -void ar6000_stop_endpoint(AR_SOFTC_T *ar, A_BOOL keepprofile, A_BOOL getdbglogs); - -#ifdef HTC_RAW_INTERFACE - -#ifndef __user -#define __user -#endif - -int ar6000_htc_raw_open(AR_SOFTC_T *ar); -int ar6000_htc_raw_close(AR_SOFTC_T *ar); -ssize_t ar6000_htc_raw_read(AR_SOFTC_T *ar, - HTC_RAW_STREAM_ID StreamID, - char __user *buffer, size_t count); -ssize_t ar6000_htc_raw_write(AR_SOFTC_T *ar, - HTC_RAW_STREAM_ID StreamID, - char __user *buffer, size_t count); - -#endif /* HTC_RAW_INTERFACE */ - -/* AP mode */ -/*TODO: These routines should be moved to a file that is common across OS */ -conn_t * -ieee80211_find_conn(AR_SOFTC_DEV_T *arPriv, A_UINT8 *node_addr); - -conn_t * -ieee80211_find_conn_for_aid(AR_SOFTC_DEV_T *arPriv, A_UINT8 aid); - -A_UINT8 -remove_sta(AR_SOFTC_DEV_T *arPriv, A_UINT8 *mac, A_UINT16 reason); - -void -ar6000_ap_cleanup(AR_SOFTC_DEV_T *arPriv); - -int -ar6000_ap_set_num_sta(AR_SOFTC_T *ar, AR_SOFTC_DEV_T *arPriv, A_UINT8 num_sta); - -/* HCI support */ - -#ifndef EXPORT_HCI_BRIDGE_INTERFACE -A_STATUS ar6000_setup_hci(AR_SOFTC_T *ar); -void ar6000_cleanup_hci(AR_SOFTC_T *ar); -void ar6000_set_default_ar3kconfig(AR_SOFTC_T *ar, void *ar3kconfig); - -/* HCI bridge testing */ -A_STATUS hci_test_send(AR_SOFTC_T *ar, struct sk_buff *skb); -#endif -void ar6000_init_mode_info(AR_SOFTC_DEV_T *arPriv); -ATH_DEBUG_DECLARE_EXTERN(htc); -ATH_DEBUG_DECLARE_EXTERN(wmi); -ATH_DEBUG_DECLARE_EXTERN(bmi); -ATH_DEBUG_DECLARE_EXTERN(hif); -ATH_DEBUG_DECLARE_EXTERN(wlan); -ATH_DEBUG_DECLARE_EXTERN(misc); - -extern A_UINT8 bcast_mac[]; -extern A_UINT8 null_mac[]; - -#ifdef __cplusplus -} -#endif - -#endif /* _AR6000_H_ */ diff --git a/drivers/net/wireless/ar6003/host/os/linux/include/ar6k_pal.h b/drivers/net/wireless/ar6003/host/os/linux/include/ar6k_pal.h deleted file mode 100644 index 98eb1db224be..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/include/ar6k_pal.h +++ /dev/null @@ -1,47 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2009-2010 Atheros Corporation. All rights reserved. -// -// The software source and binaries included in this development package are -// licensed, not sold. You, or your company, received the package under one -// or more license agreements. The rights granted to you are specifically -// listed in these license agreement(s). All other rights remain with Atheros -// Communications, Inc., its subsidiaries, or the respective owner including -// those listed on the included copyright notices. Distribution of any -// portion of this package must be in strict compliance with the license -// agreement(s) terms. -// -// -// -// PAL driver for AR6003 -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#ifndef _HCI_PAL_H_ -#define _HCI_PAL_H_ -#define HCI_GET_OP_CODE(p) (((A_UINT16)((p)[1])) << 8) | ((A_UINT16)((p)[0])) -#define TX_PACKET_RSV_OFFSET 32 -/* pal specific config structure */ -typedef A_BOOL (*ar6k_pal_recv_pkt_t)(void *pHciPalInfo, void *skb); -typedef struct ar6k_pal_config_s -{ - ar6k_pal_recv_pkt_t fpar6k_pal_recv_pkt; -}ar6k_pal_config_t; - -/********************************** - * HCI PAL private info structure - *********************************/ -typedef struct ar6k_hci_pal_info_s{ - - unsigned long ulFlags; -#define HCI_NORMAL_MODE (1) -#define HCI_REGISTERED (1<<1) - struct hci_dev *hdev; /* BT Stack HCI dev */ - AR_SOFTC_DEV_T *ar; - -}ar6k_hci_pal_info_t; - -void register_pal_cb(ar6k_pal_config_t *palConfig_p); -#endif /* _HCI_PAL_H_ */ diff --git a/drivers/net/wireless/ar6003/host/os/linux/include/ar6xapi_linux.h b/drivers/net/wireless/ar6003/host/os/linux/include/ar6xapi_linux.h deleted file mode 100644 index c682f3ca7456..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/include/ar6xapi_linux.h +++ /dev/null @@ -1,244 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -#ifndef _AR6XAPI_LINUX_H -#define _AR6XAPI_LINUX_H - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -struct ar6_softc; -struct ar6_softc_dev; - -void ar6000_dfs_attach_event(struct ar6_softc_dev *arPriv, WMI_DFS_HOST_ATTACH_EVENT *capinfo); -void ar6000_dfs_init_event(struct ar6_softc_dev *arPriv, WMI_DFS_HOST_INIT_EVENT *info); -void ar6000_dfs_reset_delaylines_event(struct ar6_softc_dev *arPriv); -void ar6000_dfs_reset_radarq_event(struct ar6_softc_dev *arPriv); -void ar6000_dfs_reset_ar_event(struct ar6_softc_dev *arPriv); -void ar6000_dfs_reset_arq_event(struct ar6_softc_dev *arPriv); -void ar6000_dfs_set_dur_multiplier_event(struct ar6_softc_dev *arPriv, A_UINT32 value); -void ar6000_dfs_set_debuglevel_event(struct ar6_softc_dev *arPriv, A_UINT32 value); -void ar6000_dfs_set_bangradar_event(struct ar6_softc_dev *arPriv, A_UINT32 value); -A_STATUS ar6000_dfs_set_maxpulsedur_cmd(struct ar6_softc_dev *arPriv, A_UINT32 value); -A_STATUS ar6000_dfs_radar_detected_cmd(struct ar6_softc_dev *arPriv, A_INT16 chan_index, A_INT8 bang_radar); -A_STATUS ar6000_dfs_set_minrssithresh_cmd(struct ar6_softc_dev *arPriv, A_INT32 rssi); -void ar6000_dfs_phyerr_event(struct ar6_softc_dev *arPriv, WMI_DFS_PHYERR_EVENT *info); - -void ar6000_ready_event(void *devt, A_UINT8 *datap, A_UINT8 phyCap, - A_UINT32 sw_ver, A_UINT32 abi_ver); -A_STATUS ar6000_control_tx(void *devt, void *osbuf, HTC_ENDPOINT_ID eid); -void ar6000_connect_event(struct ar6_softc_dev *arPriv, WMI_CONNECT_EVENT *pEvt); -void ar6000_disconnect_event(struct ar6_softc_dev *arPriv, A_UINT8 reason, - A_UINT8 *bssid, A_UINT8 assocRespLen, - A_UINT8 *assocInfo, A_UINT16 protocolReasonStatus); -void ar6000_tkip_micerr_event(struct ar6_softc_dev *arPriv, A_UINT8 keyid, - A_BOOL ismcast); -void ar6000_bitrate_rx(void *devt, A_INT32 rateKbps); -void ar6000_channelList_rx(void *devt, A_INT8 numChan, A_UINT16 *chanList); -void ar6000_regDomain_event(struct ar6_softc_dev *arPriv, A_UINT32 regCode); -void ar6000_txPwr_rx(void *devt, A_UINT8 txPwr); -void ar6000_keepalive_rx(void *devt, A_UINT8 configured); -void ar6000_neighborReport_event(struct ar6_softc_dev *arPriv, int numAps, - WMI_NEIGHBOR_INFO *info); -void ar6000_set_numdataendpts(struct ar6_softc_dev *arPriv, A_UINT32 num); -void ar6000_scanComplete_event(struct ar6_softc_dev *arPriv, A_STATUS status); -void ar6000_targetStats_event(struct ar6_softc_dev *arPriv, A_UINT8 *ptr, A_UINT32 len); -void ar6000_rssiThreshold_event(struct ar6_softc_dev *arPriv, - WMI_RSSI_THRESHOLD_VAL newThreshold, - A_INT16 rssi); -void ar6000_reportError_event(struct ar6_softc_dev *, WMI_TARGET_ERROR_VAL errorVal); -void ar6000_cac_event(struct ar6_softc_dev *arPriv, A_UINT8 ac, A_UINT8 cac_indication, - A_UINT8 statusCode, A_UINT8 *tspecSuggestion); -void ar6000_channel_change_event(struct ar6_softc_dev *arPriv, A_UINT16 oldChannel, A_UINT16 newChannel); -void ar6000_hbChallengeResp_event(struct ar6_softc_dev *arPriv, A_UINT32 cookie, A_UINT32 source); -void -ar6000_roam_tbl_event(struct ar6_softc_dev *arPriv, WMI_TARGET_ROAM_TBL *pTbl); - -void -ar6000_roam_data_event(struct ar6_softc_dev *arPriv, WMI_TARGET_ROAM_DATA *p); - -void -ar6000_wow_list_event(struct ar6_softc_dev *ar, A_UINT8 num_filters, - WMI_GET_WOW_LIST_REPLY *wow_reply); - -void ar6000_pmkid_list_event(void *devt, A_UINT8 numPMKID, - WMI_PMKID *pmkidList, A_UINT8 *bssidList); - -void ar6000_gpio_intr_rx(struct ar6_softc_dev *arPriv, A_UINT32 intr_mask, A_UINT32 input_values); -void ar6000_gpio_data_rx(struct ar6_softc_dev *arPriv, A_UINT32 reg_id, A_UINT32 value); -void ar6000_gpio_ack_rx(struct ar6_softc_dev *arPriv); - -A_INT32 rssi_compensation_calc_tcmd(struct ar6_softc *ar, A_UINT32 freq, A_INT32 rssi, A_UINT32 totalPkt); -A_INT16 rssi_compensation_calc(struct ar6_softc_dev *arPriv, A_INT16 rssi); -A_INT16 rssi_compensation_reverse_calc(struct ar6_softc_dev *arPriv, A_INT16 rssi, A_BOOL Above); - -void ar6000_dbglog_init_done(struct ar6_softc_dev *arPriv); - -void ar6000_wacinfo_event(struct ar6_softc_dev *ar, A_UINT8 *ptr, A_UINT32 len); - -#ifdef SEND_EVENT_TO_APP -void ar6000_send_event_to_app(struct ar6_softc_dev *arPriv, A_UINT16 eventId, A_UINT8 *datap, int len); -void ar6000_send_generic_event_to_app(struct ar6_softc_dev *arPriv, A_UINT16 eventId, A_UINT8 *datap, int len); -#endif - -#ifdef CONFIG_HOST_TCMD_SUPPORT -void ar6000_tcmd_rx_report_event(struct ar6_softc_dev *arPriv, A_UINT8 * results, int len); -#endif - -void ar6000_tx_retry_err_event(void *devt); - -void ar6000_snrThresholdEvent_rx(void *devt, - WMI_SNR_THRESHOLD_VAL newThreshold, - A_UINT8 snr); - -void ar6000_lqThresholdEvent_rx(void *devt, WMI_LQ_THRESHOLD_VAL range, A_UINT8 lqVal); - - -void ar6000_ratemask_rx(void *devt, A_UINT32 *ratemask); - -A_STATUS ar6000_get_driver_cfg(struct net_device *dev, - A_UINT16 cfgParam, - void *result); -void ar6000_bssInfo_event_rx(struct ar6_softc_dev *arPriv, A_UINT8 *data, int len); - -void ar6000_dbglog_event(struct ar6_softc_dev *arPriv, A_UINT32 dropped, - A_INT8 *buffer, A_UINT32 length); - -int ar6000_dbglog_get_debug_logs(struct ar6_softc *ar); - -void ar6000_peer_event(void *devt, A_UINT8 eventCode, A_UINT8 *bssid); - -void ar6000_indicate_tx_activity(void *devt, A_UINT8 trafficClass, A_BOOL Active); -HTC_ENDPOINT_ID ar6000_ac2_endpoint_id ( void * devt, A_UINT8 ac); -A_UINT8 ar6000_endpoint_id2_ac (void * devt, HTC_ENDPOINT_ID ep ); - -void ar6000_btcoex_config_event(struct ar6_softc_dev *arPriv, A_UINT8 *ptr, A_UINT32 len); - -void ar6000_btcoex_stats_event(struct ar6_softc_dev *arPriv, A_UINT8 *ptr, A_UINT32 len) ; - -void ar6000_dset_open_req(void *devt, - A_UINT32 id, - A_UINT32 targ_handle, - A_UINT32 targ_reply_fn, - A_UINT32 targ_reply_arg); -void ar6000_dset_close(void *devt, A_UINT32 access_cookie); -void ar6000_dset_data_req(void *devt, - A_UINT32 access_cookie, - A_UINT32 offset, - A_UINT32 length, - A_UINT32 targ_buf, - A_UINT32 targ_reply_fn, - A_UINT32 targ_reply_arg); - - -#if defined(CONFIG_TARGET_PROFILE_SUPPORT) -void prof_count_rx(unsigned int addr, unsigned int count); -#endif - -A_UINT32 ar6000_getnodeAge (void); - -A_UINT32 ar6000_getclkfreq (void); - -int ar6000_ap_mode_profile_commit(struct ar6_softc_dev *arPriv); - -struct ieee80211req_wpaie; -A_STATUS -ar6000_ap_mode_get_wpa_ie(struct ar6_softc_dev *arPriv, struct ieee80211req_wpaie *wpaie); - -A_STATUS is_iwioctl_allowed(A_UINT8 mode, A_UINT16 cmd); - -A_STATUS is_xioctl_allowed(A_UINT8 mode, A_UINT8 submode, int cmd); - -void ar6000_pspoll_event(struct ar6_softc_dev *arPriv,A_UINT8 aid); - -void ar6000_dtimexpiry_event(struct ar6_softc_dev *arPriv); - -void ar6000_aggr_rcv_addba_req_evt(struct ar6_softc_dev *arPriv, WMI_ADDBA_REQ_EVENT *cmd); -void ar6000_aggr_rcv_addba_resp_evt(struct ar6_softc_dev *arPriv, WMI_ADDBA_RESP_EVENT *cmd); -void ar6000_aggr_rcv_delba_req_evt(struct ar6_softc_dev *arPriv, WMI_DELBA_EVENT *cmd); -void ar6000_hci_event_rcv_evt(struct ar6_softc_dev *arPriv, WMI_HCI_EVENT *cmd); - -#ifdef WAPI_ENABLE -int ap_set_wapi_key(struct ar6_softc_dev *arPriv, void *ik); -void ap_wapi_rekey_event(struct ar6_softc_dev *arPriv, A_UINT8 type, A_UINT8 *mac); -#endif - -#ifdef P2P -void ar6000_p2pdev_event(struct ar6_softc_dev *arPriv, const A_UINT8 *addr, - const A_UINT8 *dev_addr, - const A_UINT8 *pri_dev_type, const A_UINT8 *dev_name, - A_UINT8 dev_name_len, A_UINT16 config_methods, - A_UINT8 dev_capab, A_UINT8 grp_capab); -void p2p_go_neg_event(struct ar6_softc_dev *arPriv, A_UINT8 *res, A_UINT8 len); -void p2p_go_neg_req_event(struct ar6_softc_dev *arPriv, const A_UINT8 *sa, A_UINT16 dev_passwd_id); -void p2p_invite_sent_result_event(struct ar6_softc_dev *arPriv, A_UINT8 *res, - A_UINT8 len); -void p2p_invite_rcvd_result_event(struct ar6_softc_dev *arPriv, A_UINT8 *res, - A_UINT8 len); -void ar6000_p2p_prov_disc_req_event(struct ar6_softc_dev *arPriv, - const A_UINT8 *peer, A_UINT16 wps_config_method, - const A_UINT8 *dev_addr, const A_UINT8 *pri_dev_type, - const A_UINT8 *dev_name, A_UINT8 dev_name_len, - A_UINT16 supp_config_methods, A_UINT8 dev_capab, A_UINT8 group_capab); -void ar6000_p2p_prov_disc_resp_event(struct ar6_softc_dev *arPriv, - A_UINT8 *peer, A_UINT16 config_methods); -void *get_p2p_ctx(struct ar6_softc_dev *arPriv); -void *get_wmi_ctx(struct ar6_softc_dev *arPriv); -NETWORK_SUBTYPE get_network_subtype(struct ar6_softc_dev *arPriv); -void ar6000_p2p_sd_rx_event(struct ar6_softc_dev *arPriv, WMI_P2P_SDPD_RX_EVENT *ev); -#endif - -A_STATUS ar6000_connect_to_ap(struct ar6_softc_dev *arPriv); -A_STATUS ar6000_disconnect(struct ar6_softc_dev *arPriv); -A_STATUS ar6000_update_wlan_pwr_state(struct ar6_softc *ar, AR6000_WLAN_STATE state, A_BOOL suspending); - -A_STATUS ar6000_set_wlan_state(struct ar6_softc *ar, AR6000_WLAN_STATE state); -A_STATUS ar6000_set_bt_hw_state(struct ar6_softc *ar, A_UINT32 state); - -#ifdef CONFIG_PM -A_STATUS ar6000_suspend_ev(void *context); -A_STATUS ar6000_resume_ev(void *context); -A_STATUS ar6000_power_change_ev(void *context, A_UINT32 config); -void ar6000_check_wow_status(struct ar6_softc *ar, struct sk_buff *skb, A_BOOL isEvent); -#endif - -void ar6000_pm_init(void); -void ar6000_pm_exit(void); - -void ar6000_indicate_proberesp(struct ar6_softc_dev *arPriv , A_UINT8* pData , A_UINT16 len ,A_UINT8* bssid); -void ar6000_indicate_beacon(struct ar6_softc_dev *arPriv , A_UINT8* pData , A_UINT16 len ,A_UINT8* bssid); -void ar6000_assoc_req_report_event (void *context, A_UINT8 status, A_UINT8 rspType, A_UINT8* pData, int len); - -void ar6000_get_device_addr(struct ar6_softc_dev *arPriv, A_UINT8 *addr); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/drivers/net/wireless/ar6003/host/os/linux/include/athdrv_linux.h b/drivers/net/wireless/ar6003/host/os/linux/include/athdrv_linux.h deleted file mode 100644 index 1e20d6727b84..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/include/athdrv_linux.h +++ /dev/null @@ -1,1470 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -#ifndef _ATHDRV_LINUX_H -#define _ATHDRV_LINUX_H - -#ifdef __cplusplus -extern "C" { -#endif - - -/* - * There are two types of ioctl's here: Standard ioctls and - * eXtended ioctls. All extended ioctls (XIOCTL) are multiplexed - * off of the single ioctl command, AR6000_IOCTL_EXTENDED. The - * arguments for every XIOCTL starts with a 32-bit command word - * that is used to select which extended ioctl is in use. After - * the command word are command-specific arguments. - */ - -/* Linux standard Wireless Extensions, private ioctl interfaces */ -#define IEEE80211_IOCTL_SETPARAM (SIOCIWFIRSTPRIV+0) -#define IEEE80211_IOCTL_SETKEY (SIOCIWFIRSTPRIV+1) -#define IEEE80211_IOCTL_DELKEY (SIOCIWFIRSTPRIV+2) -#define IEEE80211_IOCTL_SETMLME (SIOCIWFIRSTPRIV+3) -#define IEEE80211_IOCTL_ADDPMKID (SIOCIWFIRSTPRIV+4) -#define IEEE80211_IOCTL_SETOPTIE (SIOCIWFIRSTPRIV+5) -//#define IEEE80211_IOCTL_GETPARAM (SIOCIWFIRSTPRIV+6) -//#define IEEE80211_IOCTL_SETWMMPARAMS (SIOCIWFIRSTPRIV+7) -//#define IEEE80211_IOCTL_GETWMMPARAMS (SIOCIWFIRSTPRIV+8) -//#define IEEE80211_IOCTL_GETOPTIE (SIOCIWFIRSTPRIV+9) -//#define IEEE80211_IOCTL_SETAUTHALG (SIOCIWFIRSTPRIV+10) -#define IEEE80211_IOCTL_LASTONE (SIOCIWFIRSTPRIV+10) - - - -/* ====WMI Ioctls==== */ -/* - * - * Many ioctls simply provide WMI services to application code: - * an application makes such an ioctl call with a set of arguments - * that are packaged into the corresponding WMI message, and sent - * to the Target. - */ - -#define AR6000_IOCTL_WMI_GETREV (SIOCIWFIRSTPRIV+11) -/* - * arguments: - * ar6000_version *revision - */ - -#define AR6000_IOCTL_WMI_SETPWR (SIOCIWFIRSTPRIV+12) -/* - * arguments: - * WMI_POWER_MODE_CMD pwrModeCmd (see include/wmi.h) - * uses: WMI_SET_POWER_MODE_CMDID - */ - -#define AR6000_IOCTL_WMI_SETSCAN (SIOCIWFIRSTPRIV+13) -/* - * arguments: - * WMI_SCAN_PARAMS_CMD scanParams (see include/wmi.h) - * uses: WMI_SET_SCAN_PARAMS_CMDID - */ - -#define AR6000_IOCTL_WMI_SETLISTENINT (SIOCIWFIRSTPRIV+14) -/* - * arguments: - * UINT32 listenInterval - * uses: WMI_SET_LISTEN_INT_CMDID - */ - -#define AR6000_IOCTL_WMI_SETBSSFILTER (SIOCIWFIRSTPRIV+15) -/* - * arguments: - * WMI_BSS_FILTER filter (see include/wmi.h) - * uses: WMI_SET_BSS_FILTER_CMDID - */ - -#define AR6000_IOCTL_WMI_SET_CHANNELPARAMS (SIOCIWFIRSTPRIV+16) -/* - * arguments: - * WMI_CHANNEL_PARAMS_CMD chParams - * uses: WMI_SET_CHANNEL_PARAMS_CMDID - */ - -#define AR6000_IOCTL_WMI_SET_PROBEDSSID (SIOCIWFIRSTPRIV+17) -/* - * arguments: - * WMI_PROBED_SSID_CMD probedSsids (see include/wmi.h) - * uses: WMI_SETPROBED_SSID_CMDID - */ - -#define AR6000_IOCTL_WMI_SET_PMPARAMS (SIOCIWFIRSTPRIV+18) -/* - * arguments: - * WMI_POWER_PARAMS_CMD powerParams (see include/wmi.h) - * uses: WMI_SET_POWER_PARAMS_CMDID - */ - -#define AR6000_IOCTL_WMI_SET_BADAP (SIOCIWFIRSTPRIV+19) -/* - * arguments: - * WMI_ADD_BAD_AP_CMD badAPs (see include/wmi.h) - * uses: WMI_ADD_BAD_AP_CMDID - */ - -#define AR6000_IOCTL_WMI_GET_QOS_QUEUE (SIOCIWFIRSTPRIV+20) -/* - * arguments: - * ar6000_queuereq queueRequest (see below) - */ - -#define AR6000_IOCTL_WMI_CREATE_QOS (SIOCIWFIRSTPRIV+21) -/* - * arguments: - * WMI_CREATE_PSTREAM createPstreamCmd (see include/wmi.h) - * uses: WMI_CREATE_PSTREAM_CMDID - */ - -#define AR6000_IOCTL_WMI_DELETE_QOS (SIOCIWFIRSTPRIV+22) -/* - * arguments: - * WMI_DELETE_PSTREAM_CMD deletePstreamCmd (see include/wmi.h) - * uses: WMI_DELETE_PSTREAM_CMDID - */ - -#define AR6000_IOCTL_WMI_SET_SNRTHRESHOLD (SIOCIWFIRSTPRIV+23) -/* - * arguments: - * WMI_SNR_THRESHOLD_PARAMS_CMD thresholdParams (see include/wmi.h) - * uses: WMI_SNR_THRESHOLD_PARAMS_CMDID - */ - -#define AR6000_IOCTL_WMI_SET_ERROR_REPORT_BITMASK (SIOCIWFIRSTPRIV+24) -/* - * arguments: - * WMI_TARGET_ERROR_REPORT_BITMASK errorReportBitMask (see include/wmi.h) - * uses: WMI_TARGET_ERROR_REPORT_BITMASK_CMDID - */ - -#define AR6000_IOCTL_WMI_GET_TARGET_STATS (SIOCIWFIRSTPRIV+25) -/* - * arguments: - * TARGET_STATS *targetStats (see below) - * uses: WMI_GET_STATISTICS_CMDID - */ - -#define AR6000_IOCTL_WMI_SET_ASSOC_INFO (SIOCIWFIRSTPRIV+26) -/* - * arguments: - * WMI_SET_ASSOC_INFO_CMD setAssocInfoCmd - * uses: WMI_SET_ASSOC_INFO_CMDID - */ - -#define AR6000_IOCTL_WMI_SET_ACCESS_PARAMS (SIOCIWFIRSTPRIV+27) -/* - * arguments: - * WMI_SET_ACCESS_PARAMS_CMD setAccessParams (see include/wmi.h) - * uses: WMI_SET_ACCESS_PARAMS_CMDID - */ - -#define AR6000_IOCTL_WMI_SET_BMISS_TIME (SIOCIWFIRSTPRIV+28) -/* - * arguments: - * UINT32 beaconMissTime - * uses: WMI_SET_BMISS_TIME_CMDID - */ - -#define AR6000_IOCTL_WMI_SET_DISC_TIMEOUT (SIOCIWFIRSTPRIV+29) -/* - * arguments: - * WMI_DISC_TIMEOUT_CMD disconnectTimeoutCmd (see include/wmi.h) - * uses: WMI_SET_DISC_TIMEOUT_CMDID - */ - -#define AR6000_IOCTL_WMI_SET_IBSS_PM_CAPS (SIOCIWFIRSTPRIV+30) -/* - * arguments: - * WMI_IBSS_PM_CAPS_CMD ibssPowerMgmtCapsCmd - * uses: WMI_SET_IBSS_PM_CAPS_CMDID - */ - -/* - * There is a very small space available for driver-private - * wireless ioctls. In order to circumvent this limitation, - * we multiplex a bunch of ioctls (XIOCTLs) on top of a - * single AR6000_IOCTL_EXTENDED ioctl. - */ -#define AR6000_IOCTL_EXTENDED (SIOCIWFIRSTPRIV+31) - -typedef enum { - AR6000_XIOCTL_BMI_DONE = 1, - AR6000_XIOCTL_BMI_READ_MEMORY, - AR6000_XIOCTL_BMI_WRITE_MEMORY, - AR6000_XIOCTL_BMI_EXECUTE, - AR6000_XIOCTL_BMI_SET_APP_START, - AR6000_XIOCTL_BMI_READ_SOC_REGISTER, - AR6000_XIOCTL_BMI_WRITE_SOC_REGISTER, - AR6000_XIOCTL_BMI_TEST, - AR6000_XIOCTL_UNUSED9, - AR6000_XIOCTL_UNUSED10, /* 10 */ - AR6000_XIOCTL_UNUSED11, - AR6000_XIOCTL_FORCE_TARGET_RESET, - AR6000_XIOCTL_HTC_RAW_OPEN, - AR6000_XIOCTL_HTC_RAW_CLOSE, - AR6000_XIOCTL_HTC_RAW_READ, - AR6000_XIOCTL_HTC_RAW_WRITE, - AR6000_XIOCTL_CHECK_TARGET_READY, - AR6000_XIOCTL_GPIO_OUTPUT_SET, - AR6000_XIOCTL_GPIO_INPUT_GET, - AR6000_XIOCTL_GPIO_REGISTER_SET, /* 20 */ - AR6000_XIOCTL_GPIO_REGISTER_GET, - AR6000_XIOCTL_GPIO_INTR_ACK, - AR6000_XIOCTL_GPIO_INTR_WAIT, - AR6000_XIOCTL_SET_ADHOC_BSSID, - AR6000_XIOCTL_UNUSED25, - AR6000_XIOCTL_UNUSED26, - AR6000_XIOCTL_SET_BEACON_INTVAL, - IEEE80211_IOCTL_SETAUTHALG, - AR6000_XIOCTL_SET_VOICE_PKT_SIZE, - AR6000_XIOCTL_SET_MAX_SP, /* 30 */ - AR6000_XIOCTL_WMI_GET_ROAM_TBL, - AR6000_XIOCTL_WMI_SET_ROAM_CTRL, - AR6000_XIOCTRL_WMI_SET_POWERSAVE_TIMERS, - AR6000_XIOCTRL_WMI_GET_POWER_MODE, - AR6000_XIOCTRL_WMI_SET_WLAN_STATE, - AR6000_XIOCTL_WMI_GET_ROAM_DATA, - AR6000_XIOCTL_WMI_SETRETRYLIMITS, - AR6000_XIOCTL_TCMD_CONT_TX, - AR6000_XIOCTL_TCMD_CONT_RX, - AR6000_XIOCTL_TCMD_PM, /* 40 */ - AR6000_XIOCTL_WMI_STARTSCAN, - AR6000_XIOCTL_WMI_SETFIXRATES, - AR6000_XIOCTL_WMI_GETFIXRATES, - AR6000_XIOCTL_WMI_SET_RSSITHRESHOLD, - AR6000_XIOCTL_WMI_CLR_RSSISNR, - AR6000_XIOCTL_WMI_SET_LQTHRESHOLD, - AR6000_XIOCTL_WMI_SET_RTS, - AR6000_XIOCTL_WMI_SET_LPREAMBLE, - AR6000_XIOCTL_WMI_SET_AUTHMODE, - AR6000_XIOCTL_WMI_SET_REASSOCMODE, /* 50 */ - AR6000_XIOCTL_WMI_SET_WMM, - AR6000_XIOCTL_WMI_SET_HB_CHALLENGE_RESP_PARAMS, - AR6000_XIOCTL_WMI_GET_HB_CHALLENGE_RESP, - AR6000_XIOCTL_WMI_GET_RD, - AR6000_XIOCTL_DIAG_READ, - AR6000_XIOCTL_DIAG_WRITE, - AR6000_XIOCTL_WMI_SET_TXOP, - AR6000_XIOCTL_USER_SETKEYS, - AR6000_XIOCTL_WMI_SET_KEEPALIVE, - AR6000_XIOCTL_WMI_GET_KEEPALIVE, /* 60 */ - AR6000_XIOCTL_BMI_ROMPATCH_INSTALL, - AR6000_XIOCTL_BMI_ROMPATCH_UNINSTALL, - AR6000_XIOCTL_BMI_ROMPATCH_ACTIVATE, - AR6000_XIOCTL_BMI_ROMPATCH_DEACTIVATE, - AR6000_XIOCTL_WMI_SET_APPIE, - AR6000_XIOCTL_WMI_SET_MGMT_FRM_RX_FILTER, - AR6000_XIOCTL_DBGLOG_CFG_MODULE, - AR6000_XIOCTL_DBGLOG_GET_DEBUG_LOGS, - AR6000_XIOCTL_WMI_SET_WSC_STATUS = 70, /* 70 */ - AR6000_XIOCTL_WMI_SET_BT_STATUS, - AR6000_XIOCTL_WMI_SET_BT_PARAMS, - AR6000_XIOCTL_WMI_SET_HOST_SLEEP_MODE, - AR6000_XIOCTL_WMI_SET_WOW_MODE, - AR6000_XIOCTL_WMI_GET_WOW_LIST, - AR6000_XIOCTL_WMI_ADD_WOW_PATTERN, - AR6000_XIOCTL_WMI_DEL_WOW_PATTERN, - AR6000_XIOCTL_TARGET_INFO, - AR6000_XIOCTL_DUMP_HTC_CREDIT_STATE, - AR6000_XIOCTL_TRAFFIC_ACTIVITY_CHANGE, /* 80 */ - AR6000_XIOCTL_WMI_SET_CONNECT_CTRL_FLAGS, - AR6000_XIOCTL_WMI_SET_AKMP_PARAMS, - AR6000_XIOCTL_WMI_GET_PMKID_LIST, - AR6000_XIOCTL_WMI_SET_PMKID_LIST, - AR6000_XIOCTL_WMI_SET_PARAMS, - AR6000_XIOCTL_WMI_SET_MCAST_FILTER, - AR6000_XIOCTL_WMI_DEL_MCAST_FILTER, - AR6000_XIOCTL_UNUSED90 = 90, /* 90 */ - AR6000_XIOCTL_BMI_LZ_STREAM_START, - AR6000_XIOCTL_BMI_LZ_DATA, - AR6000_XIOCTL_PROF_CFG, - AR6000_XIOCTL_PROF_ADDR_SET, - AR6000_XIOCTL_PROF_START, - AR6000_XIOCTL_PROF_STOP, - AR6000_XIOCTL_PROF_COUNT_GET, - AR6000_XIOCTL_WMI_ABORT_SCAN, - AR6000_XIOCTL_AP_GET_STA_LIST, - AR6000_XIOCTL_AP_HIDDEN_SSID, /* 100 */ - AR6000_XIOCTL_AP_SET_NUM_STA, - AR6000_XIOCTL_AP_SET_ACL_MAC, - AR6000_XIOCTL_AP_GET_ACL_LIST, - AR6000_XIOCTL_AP_COMMIT_CONFIG, - IEEE80211_IOCTL_GETWPAIE, - AR6000_XIOCTL_AP_CONN_INACT_TIME, - AR6000_XIOCTL_AP_PROT_SCAN_TIME, - AR6000_XIOCTL_AP_SET_COUNTRY, - AR6000_XIOCTL_AP_SET_DTIM, - AR6000_XIOCTL_WMI_TARGET_EVENT_REPORT, /* 110 */ - AR6000_XIOCTL_SET_IP, - AR6000_XIOCTL_AP_SET_ACL_POLICY, - AR6000_XIOCTL_AP_CTRL_BSS_COMM, - AR6000_XIOCTL_DUMP_MODULE_DEBUG_INFO, - AR6000_XIOCTL_MODULE_DEBUG_SET_MASK, - AR6000_XIOCTL_MODULE_DEBUG_GET_MASK, - AR6000_XIOCTL_DUMP_RCV_AGGR_STATS, - AR6000_XIOCTL_SET_HT_CAP, - AR6000_XIOCTL_SET_HT_OP, - AR6000_XIOCTL_AP_GET_STAT, /* 120 */ - AR6000_XIOCTL_SET_TX_SELECT_RATES, - AR6000_XIOCTL_SETUP_AGGR, - AR6000_XIOCTL_ALLOW_AGGR, - AR6000_XIOCTL_AP_GET_HIDDEN_SSID, - AR6000_XIOCTL_AP_GET_COUNTRY, - AR6000_XIOCTL_AP_GET_WMODE, - AR6000_XIOCTL_AP_GET_DTIM, - AR6000_XIOCTL_AP_GET_BINTVL, - AR6000_XIOCTL_AP_GET_RTS, - AR6000_XIOCTL_DELE_AGGR, /* 130 */ - AR6000_XIOCTL_FETCH_TARGET_REGS, - AR6000_XIOCTL_HCI_CMD, - AR6000_XIOCTL_ACL_DATA, - AR6000_XIOCTL_WLAN_CONN_PRECEDENCE, - AR6000_XIOCTL_AP_SET_11BG_RATESET, - AR6000_XIOCTL_WMI_SET_AP_PS, - AR6000_XIOCTL_WMI_MCAST_FILTER, - AR6000_XIOCTL_WMI_SET_BTCOEX_FE_ANT, - AR6000_XIOCTL_WMI_SET_BTCOEX_COLOCATED_BT_DEV, - AR6000_XIOCTL_WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG, /* 140 */ - AR6000_XIOCTL_WMI_SET_BTCOEX_SCO_CONFIG, - AR6000_XIOCTL_WMI_SET_BTCOEX_A2DP_CONFIG, - AR6000_XIOCTL_WMI_SET_BTCOEX_ACLCOEX_CONFIG, - AR6000_XIOCTL_WMI_SET_BTCOEX_DEBUG, - AR6000_XIOCTL_WMI_SET_BT_OPERATING_STATUS, - AR6000_XIOCTL_WMI_GET_BTCOEX_CONFIG, - AR6000_XIOCTL_WMI_GET_BTCOEX_STATS, - AR6000_XIOCTL_WMI_SET_QOS_SUPP, - AR6000_XIOCTL_AP_SET_DFS, - AR6000_XIOCTL_WMI_P2P_DISCOVER, /* 150 */ - AR6000_XIOCTL_WMI_P2P_STOP_FIND, - AR6000_XIOCTL_WMI_P2P_CANCEL, - AR6000_XIOCTL_WMI_P2P_LISTEN, - AR6000_XIOCTL_WMI_P2P_GO_NEG, - AR6000_XIOCTL_WMI_P2P_AUTH_GO_NEG, - AR6000_XIOCTL_WMI_P2P_REJECT, - AR6000_XIOCTL_WMI_P2P_CONFIG, - AR6000_XIOCTL_WMI_WPS_CONFIG, - AR6000_XIOCTL_WMI_P2P_FINDNODE, - AR6000_XIOCTL_WMI_P2P_GRP_INIT, /* 160 */ - AR6000_XIOCTL_WMI_P2P_GRP_FORMATION_DONE, - AR6000_XIOCTL_WMI_P2P_INVITE, - AR6000_XIOCTL_WMI_P2P_PROV_DISC, - AR6000_XIOCTL_WMI_P2P_SET, - AR6000_XIOCTL_WMI_P2P_PEER, - AR6000_XIOCTL_WMI_P2P_FLUSH, - AR6000_XIOCTL_WMI_GET_GO_PARAMS, - AR6000_XIOCTL_WMI_P2P_AUTH_INVITE, - AR6000_XIOCTL_WMI_P2P_GET_IF_ADDR, - AR6000_XIOCTL_WMI_P2P_GET_DEV_ADDR, /* 170 */ - AR6000_XIOCTL_WMI_P2P_SDPD_TX_CMD, - AR6000_XIOTCL_WMI_P2P_SD_CANCEL_REQUEST, - AR6000_XIOCTL_SET_BT_HW_POWER_STATE, - AR6000_XIOCTL_GET_BT_HW_POWER_STATE, - AR6000_XIOCTL_GET_WLAN_SLEEP_STATE, - AR6000_XIOCTL_WMI_SET_TX_SGI_PARAM, - AR6000_XIOCTL_WMI_ENABLE_WAC_PARAM, - AR6000_XIOCTL_WAC_SCAN_REPLY, - AR6000_XIOCTL_WMI_WAC_CTRL_REQ, - AR6000_XIOCTL_WMI_SET_WPA_OFFLOAD_STATE, /* 180 */ - AR6000_XIOCTL_WMI_SET_PASSPHRASE, - AR6000_XIOCTL_BMI_NVRAM_PROCESS, - AR6000_XIOCTL_WMI_SET_DIVERSITY_PARAM, - AR6000_XIOCTL_WMI_FORCE_ASSERT, - AR6000_XIOCTL_WMI_ENABLE_PKTLOG, - AR6000_XIOCTL_WMI_DISABLE_PKTLOG, - AR6000_XIOCTL_WMI_GET_PKTLOG, - AR6000_XIOCTL_AP_ACS_DISABLE_HI_CHANNELS, - AR6000_XIOCTL_TCMD_CMDS, - AR6000_XIOCTL_WMI_SET_EXCESS_TX_RETRY_THRES, /* 190 */ - AR6000_XIOCTL_AP_GET_NUM_STA, - AR6000_XIOCTL_SUSPEND_DRIVER, - AR6000_XIOCTL_RESUME_DRIVER, - AR6000_XIOCTL_GET_SUBMODE, - AR6000_XIOCTL_WMI_AP_SET_APSD, - AR6000_XIOCTL_TCMD_SETREG, - AR6000_XIOCTL_GET_HT_CAP, - AR6000_XIOCTL_WMI_GET_P2P_IE, /* 198 */ -} XTND_IOCLTS; - - - -///* ====BMI Extended Ioctls==== */ -// -//#define AR6000_XIOCTL_BMI_DONE 1 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_BMI_DONE) -// * uses: BMI_DONE -// */ -// -//#define AR6000_XIOCTL_BMI_READ_MEMORY 2 -///* -// * arguments: -// * union { -// * struct { -// * UINT32 cmd (AR6000_XIOCTL_BMI_READ_MEMORY) -// * UINT32 address -// * UINT32 length -// * } -// * char results[length] -// * } -// * uses: BMI_READ_MEMORY -// */ -// -//#define AR6000_XIOCTL_BMI_WRITE_MEMORY 3 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_BMI_WRITE_MEMORY) -// * UINT32 address -// * UINT32 length -// * char data[length] -// * uses: BMI_WRITE_MEMORY -// */ -// -//#define AR6000_XIOCTL_BMI_EXECUTE 4 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_BMI_EXECUTE) -// * UINT32 TargetAddress -// * UINT32 parameter -// * uses: BMI_EXECUTE -// */ -// -//#define AR6000_XIOCTL_BMI_SET_APP_START 5 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_BMI_SET_APP_START) -// * UINT32 TargetAddress -// * uses: BMI_SET_APP_START -// */ -// -//#define AR6000_XIOCTL_BMI_READ_SOC_REGISTER 6 -///* -// * arguments: -// * union { -// * struct { -// * UINT32 cmd (AR6000_XIOCTL_BMI_READ_SOC_REGISTER) -// * UINT32 TargetAddress, 32-bit aligned -// * } -// * UINT32 result -// * } -// * uses: BMI_READ_SOC_REGISTER -// */ -// -//#define AR6000_XIOCTL_BMI_WRITE_SOC_REGISTER 7 -///* -// * arguments: -// * struct { -// * UINT32 cmd (AR6000_XIOCTL_BMI_WRITE_SOC_REGISTER) -// * UINT32 TargetAddress, 32-bit aligned -// * UINT32 newValue -// * } -// * uses: BMI_WRITE_SOC_REGISTER -// */ -// -//#define AR6000_XIOCTL_BMI_TEST 8 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_BMI_TEST) -// * UINT32 address -// * UINT32 length -// * UINT32 count -// */ -// -// -// -///* Historical Host-side DataSet support */ -//#define AR6000_XIOCTL_UNUSED9 9 -//#define AR6000_XIOCTL_UNUSED10 10 -//#define AR6000_XIOCTL_UNUSED11 11 -// -///* ====Misc Extended Ioctls==== */ -// -//#define AR6000_XIOCTL_FORCE_TARGET_RESET 12 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_FORCE_TARGET_RESET) -// */ -// -// -//#ifdef HTC_RAW_INTERFACE -///* HTC Raw Interface Ioctls */ -//#define AR6000_XIOCTL_HTC_RAW_OPEN 13 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_HTC_RAW_OPEN) -// */ -// -//#define AR6000_XIOCTL_HTC_RAW_CLOSE 14 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_HTC_RAW_CLOSE) -// */ -// -//#define AR6000_XIOCTL_HTC_RAW_READ 15 -///* -// * arguments: -// * union { -// * struct { -// * UINT32 cmd (AR6000_XIOCTL_HTC_RAW_READ) -// * UINT32 mailboxID -// * UINT32 length -// * } -// * results[length] -// * } -// */ -// -//#define AR6000_XIOCTL_HTC_RAW_WRITE 16 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_HTC_RAW_WRITE) -// * UINT32 mailboxID -// * UINT32 length -// * char buffer[length] -// */ -//#endif /* HTC_RAW_INTERFACE */ -// -//#define AR6000_XIOCTL_CHECK_TARGET_READY 17 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_CHECK_TARGET_READY) -// */ -// -// -// -///* ====GPIO (General Purpose I/O) Extended Ioctls==== */ -// -//#define AR6000_XIOCTL_GPIO_OUTPUT_SET 18 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_GPIO_OUTPUT_SET) -// * ar6000_gpio_output_set_cmd_s (see below) -// * uses: WMIX_GPIO_OUTPUT_SET_CMDID -// */ -// -//#define AR6000_XIOCTL_GPIO_INPUT_GET 19 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_GPIO_INPUT_GET) -// * uses: WMIX_GPIO_INPUT_GET_CMDID -// */ -// -//#define AR6000_XIOCTL_GPIO_REGISTER_SET 20 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_GPIO_REGISTER_SET) -// * ar6000_gpio_register_cmd_s (see below) -// * uses: WMIX_GPIO_REGISTER_SET_CMDID -// */ -// -//#define AR6000_XIOCTL_GPIO_REGISTER_GET 21 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_GPIO_REGISTER_GET) -// * ar6000_gpio_register_cmd_s (see below) -// * uses: WMIX_GPIO_REGISTER_GET_CMDID -// */ -// -//#define AR6000_XIOCTL_GPIO_INTR_ACK 22 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_GPIO_INTR_ACK) -// * ar6000_cpio_intr_ack_cmd_s (see below) -// * uses: WMIX_GPIO_INTR_ACK_CMDID -// */ -// -//#define AR6000_XIOCTL_GPIO_INTR_WAIT 23 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_GPIO_INTR_WAIT) -// */ -// -// -// -///* ====more wireless commands==== */ -// -//#define AR6000_XIOCTL_SET_ADHOC_BSSID 24 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_SET_ADHOC_BSSID) -// * WMI_SET_ADHOC_BSSID_CMD setAdHocBssidCmd (see include/wmi.h) -// */ -// -//#define AR6000_XIOCTL_SET_OPT_MODE 25 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_SET_OPT_MODE) -// * WMI_SET_OPT_MODE_CMD setOptModeCmd (see include/wmi.h) -// * uses: WMI_SET_OPT_MODE_CMDID -// */ -// -//#define AR6000_XIOCTL_OPT_SEND_FRAME 26 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_OPT_SEND_FRAME) -// * WMI_OPT_TX_FRAME_CMD optTxFrameCmd (see include/wmi.h) -// * uses: WMI_OPT_TX_FRAME_CMDID -// */ -// -//#define AR6000_XIOCTL_SET_BEACON_INTVAL 27 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_SET_BEACON_INTVAL) -// * WMI_BEACON_INT_CMD beaconIntCmd (see include/wmi.h) -// * uses: WMI_SET_BEACON_INT_CMDID -// */ -// -// -//#define IEEE80211_IOCTL_SETAUTHALG 28 -// -// -//#define AR6000_XIOCTL_SET_VOICE_PKT_SIZE 29 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_SET_VOICE_PKT_SIZE) -// * WMI_SET_VOICE_PKT_SIZE_CMD setVoicePktSizeCmd (see include/wmi.h) -// * uses: WMI_SET_VOICE_PKT_SIZE_CMDID -// */ -// -// -//#define AR6000_XIOCTL_SET_MAX_SP 30 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_SET_MAX_SP) -// * WMI_SET_MAX_SP_LEN_CMD maxSPLen(see include/wmi.h) -// * uses: WMI_SET_MAX_SP_LEN_CMDID -// */ -// -//#define AR6000_XIOCTL_WMI_GET_ROAM_TBL 31 -// -//#define AR6000_XIOCTL_WMI_SET_ROAM_CTRL 32 -// -//#define AR6000_XIOCTRL_WMI_SET_POWERSAVE_TIMERS 33 -// -// -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTRL_WMI_SET_POWERSAVE_TIMERS) -// * WMI_SET_POWERSAVE_TIMERS_CMD powerSaveTimers(see include/wmi.h) -// * WMI_SET_POWERSAVE_TIMERS_CMDID -// */ -// -//#define AR6000_XIOCTRL_WMI_GET_POWER_MODE 34 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTRL_WMI_GET_POWER_MODE) -// */ -// -//#define AR6000_XIOCTRL_WMI_SET_WLAN_STATE 35 - -typedef enum { - WLAN_DISABLED, - WLAN_ENABLED -} AR6000_WLAN_STATE; - -///* -// * arguments: -// * enable/disable -// */ -// -//#define AR6000_XIOCTL_WMI_GET_ROAM_DATA 36 -// -//#define AR6000_XIOCTL_WMI_SETRETRYLIMITS 37 -///* -// * arguments: -// * WMI_SET_RETRY_LIMITS_CMD ibssSetRetryLimitsCmd -// * uses: WMI_SET_RETRY_LIMITS_CMDID -// */ -// -//#ifdef CONFIG_HOST_TCMD_SUPPORT -///* ====extended commands for radio test ==== */ -// -//#define AR6000_XIOCTL_TCMD_CONT_TX 38 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_TCMD_CONT_TX) -// * WMI_TCMD_CONT_TX_CMD contTxCmd (see include/wmi.h) -// * uses: WMI_TCMD_CONT_TX_CMDID -// */ -// -//#define AR6000_XIOCTL_TCMD_CONT_RX 39 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_TCMD_CONT_RX) -// * WMI_TCMD_CONT_RX_CMD rxCmd (see include/wmi.h) -// * uses: WMI_TCMD_CONT_RX_CMDID -// */ -// -//#define AR6000_XIOCTL_TCMD_PM 40 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_TCMD_PM) -// * WMI_TCMD_PM_CMD pmCmd (see include/wmi.h) -// * uses: WMI_TCMD_PM_CMDID -// */ -// -//#endif /* CONFIG_HOST_TCMD_SUPPORT */ -// -//#define AR6000_XIOCTL_WMI_STARTSCAN 41 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_WMI_STARTSCAN) -// * UINT8 scanType -// * UINT8 scanConnected -// * A_BOOL forceFgScan -// * uses: WMI_START_SCAN_CMDID -// */ -// -//#define AR6000_XIOCTL_WMI_SETFIXRATES 42 -// -//#define AR6000_XIOCTL_WMI_GETFIXRATES 43 -// -// -//#define AR6000_XIOCTL_WMI_SET_RSSITHRESHOLD 44 -///* -// * arguments: -// * WMI_RSSI_THRESHOLD_PARAMS_CMD thresholdParams (see include/wmi.h) -// * uses: WMI_RSSI_THRESHOLD_PARAMS_CMDID -// */ -// -//#define AR6000_XIOCTL_WMI_CLR_RSSISNR 45 -///* -// * arguments: -// * WMI_CLR_RSSISNR_CMD thresholdParams (see include/wmi.h) -// * uses: WMI_CLR_RSSISNR_CMDID -// */ -// -//#define AR6000_XIOCTL_WMI_SET_LQTHRESHOLD 46 -///* -// * arguments: -// * WMI_LQ_THRESHOLD_PARAMS_CMD thresholdParams (see include/wmi.h) -// * uses: WMI_LQ_THRESHOLD_PARAMS_CMDID -// */ -// -//#define AR6000_XIOCTL_WMI_SET_RTS 47 -///* -// * arguments: -// * WMI_SET_RTS_MODE_CMD (see include/wmi.h) -// * uses: WMI_SET_RTS_MODE_CMDID -// */ -// -//#define AR6000_XIOCTL_WMI_SET_LPREAMBLE 48 -// -//#define AR6000_XIOCTL_WMI_SET_AUTHMODE 49 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_WMI_SET_AUTHMODE) -// * UINT8 mode -// * uses: WMI_SET_RECONNECT_AUTH_MODE_CMDID -// */ -// -//#define AR6000_XIOCTL_WMI_SET_REASSOCMODE 50 -// -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_WMI_SET_WMM) -// * UINT8 mode -// * uses: WMI_SET_WMM_CMDID -// */ -//#define AR6000_XIOCTL_WMI_SET_WMM 51 -// -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_WMI_SET_HB_CHALLENGE_RESP_PARAMS) -// * UINT32 frequency -// * UINT8 threshold -// */ -//#define AR6000_XIOCTL_WMI_SET_HB_CHALLENGE_RESP_PARAMS 52 -// -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_WMI_GET_HB_CHALLENGE_RESP) -// * UINT32 cookie -// */ -//#define AR6000_XIOCTL_WMI_GET_HB_CHALLENGE_RESP 53 -// -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_WMI_GET_RD) -// * UINT32 regDomain -// */ -//#define AR6000_XIOCTL_WMI_GET_RD 54 -// -//#define AR6000_XIOCTL_DIAG_READ 55 -// -//#define AR6000_XIOCTL_DIAG_WRITE 56 -// -///* -// * arguments cmd (AR6000_XIOCTL_SET_TXOP) -// * WMI_TXOP_CFG txopEnable -// */ -//#define AR6000_XIOCTL_WMI_SET_TXOP 57 -// -//#ifdef USER_KEYS -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_USER_SETKEYS) -// * UINT32 keyOpCtrl -// * uses AR6000_USER_SETKEYS_INFO -// */ -//#define AR6000_XIOCTL_USER_SETKEYS 58 -//#endif /* USER_KEYS */ -// -//#define AR6000_XIOCTL_WMI_SET_KEEPALIVE 59 -///* -// * arguments: -// * UINT8 cmd (AR6000_XIOCTL_WMI_SET_KEEPALIVE) -// * UINT8 keepaliveInterval -// * uses: WMI_SET_KEEPALIVE_CMDID -// */ -// -//#define AR6000_XIOCTL_WMI_GET_KEEPALIVE 60 -///* -// * arguments: -// * UINT8 cmd (AR6000_XIOCTL_WMI_GET_KEEPALIVE) -// * UINT8 keepaliveInterval -// * A_BOOL configured -// * uses: WMI_GET_KEEPALIVE_CMDID -// */ -// -///* ====ROM Patching Extended Ioctls==== */ -// -//#define AR6000_XIOCTL_BMI_ROMPATCH_INSTALL 61 -///* -// * arguments: -// * union { -// * struct { -// * UINT32 cmd (AR6000_XIOCTL_BMI_ROMPATCH_INSTALL) -// * UINT32 ROM Address -// * UINT32 RAM Address -// * UINT32 number of bytes -// * UINT32 activate? (0 or 1) -// * } -// * A_UINT32 resulting rompatch ID -// * } -// * uses: BMI_ROMPATCH_INSTALL -// */ -// -//#define AR6000_XIOCTL_BMI_ROMPATCH_UNINSTALL 62 -///* -// * arguments: -// * struct { -// * UINT32 cmd (AR6000_XIOCTL_BMI_ROMPATCH_UNINSTALL) -// * UINT32 rompatch ID -// * } -// * uses: BMI_ROMPATCH_UNINSTALL -// */ -// -//#define AR6000_XIOCTL_BMI_ROMPATCH_ACTIVATE 63 -///* -// * arguments: -// * struct { -// * UINT32 cmd (AR6000_XIOCTL_BMI_ROMPATCH_ACTIVATE) -// * UINT32 rompatch count -// * UINT32 rompatch IDs[rompatch count] -// * } -// * uses: BMI_ROMPATCH_ACTIVATE -// */ -// -//#define AR6000_XIOCTL_BMI_ROMPATCH_DEACTIVATE 64 -///* -// * arguments: -// * struct { -// * UINT32 cmd (AR6000_XIOCTL_BMI_ROMPATCH_DEACTIVATE) -// * UINT32 rompatch count -// * UINT32 rompatch IDs[rompatch count] -// * } -// * uses: BMI_ROMPATCH_DEACTIVATE -// */ -// -//#define AR6000_XIOCTL_WMI_SET_APPIE 65 -///* -// * arguments: -// * struct { -// * UINT32 cmd (AR6000_XIOCTL_WMI_SET_APPIE) -// * UINT32 app_frmtype; -// * UINT32 app_buflen; -// * UINT8 app_buf[]; -// * } -// */ -//#define AR6000_XIOCTL_WMI_SET_MGMT_FRM_RX_FILTER 66 -///* -// * arguments: -// * A_UINT32 filter_type; -// */ -// -//#define AR6000_XIOCTL_DBGLOG_CFG_MODULE 67 -// -//#define AR6000_XIOCTL_DBGLOG_GET_DEBUG_LOGS 68 -// -//#define AR6000_XIOCTL_WMI_SET_WSC_STATUS 70 -///* -// * arguments: -// * A_UINT32 wsc_status; -// * (WSC_REG_INACTIVE or WSC_REG_ACTIVE) -// */ -// -///* -// * arguments: -// * struct { -// * A_UINT8 streamType; -// * A_UINT8 status; -// * } -// * uses: WMI_SET_BT_STATUS_CMDID -// */ -//#define AR6000_XIOCTL_WMI_SET_BT_STATUS 71 -// -///* -// * arguments: -// * struct { -// * A_UINT8 paramType; -// * union { -// * A_UINT8 noSCOPkts; -// * BT_PARAMS_A2DP a2dpParams; -// * BT_COEX_REGS regs; -// * }; -// * } -// * uses: WMI_SET_BT_PARAM_CMDID -// */ -//#define AR6000_XIOCTL_WMI_SET_BT_PARAMS 72 -// -//#define AR6000_XIOCTL_WMI_SET_HOST_SLEEP_MODE 73 -//#define AR6000_XIOCTL_WMI_SET_WOW_MODE 74 -//#define AR6000_XIOCTL_WMI_GET_WOW_LIST 75 -//#define AR6000_XIOCTL_WMI_ADD_WOW_PATTERN 76 -//#define AR6000_XIOCTL_WMI_DEL_WOW_PATTERN 77 -// -// -// -//#define AR6000_XIOCTL_TARGET_INFO 78 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_TARGET_INFO) -// * A_UINT32 TargetVersion (returned) -// * A_UINT32 TargetType (returned) -// * (See also bmi_msg.h target_ver and target_type) -// */ -// -//#define AR6000_XIOCTL_DUMP_HTC_CREDIT_STATE 79 -///* -// * arguments: -// * none -// */ -// -//#define AR6000_XIOCTL_TRAFFIC_ACTIVITY_CHANGE 80 -///* -// * This ioctl is used to emulate traffic activity -// * timeouts. Activity/inactivity will trigger the driver -// * to re-balance credits. -// * -// * arguments: -// * ar6000_traffic_activity_change -// */ -// -//#define AR6000_XIOCTL_WMI_SET_CONNECT_CTRL_FLAGS 81 -///* -// * This ioctl is used to set the connect control flags -// * -// * arguments: -// * A_UINT32 connectCtrlFlags -// */ -// -//#define AR6000_XIOCTL_WMI_SET_AKMP_PARAMS 82 -///* -// * This IOCTL sets any Authentication,Key Management and Protection -// * related parameters. This is used along with the information set in -// * Connect Command. -// * Currently this enables Multiple PMKIDs to an AP. -// * -// * arguments: -// * struct { -// * A_UINT32 akmpInfo; -// * } -// * uses: WMI_SET_AKMP_PARAMS_CMD -// */ -// -//#define AR6000_XIOCTL_WMI_GET_PMKID_LIST 83 -// -//#define AR6000_XIOCTL_WMI_SET_PMKID_LIST 84 -///* -// * This IOCTL is used to set a list of PMKIDs. This list of -// * PMKIDs is used in the [Re]AssocReq Frame. This list is used -// * only if the MultiPMKID option is enabled via the -// * AR6000_XIOCTL_WMI_SET_AKMP_PARAMS IOCTL. -// * -// * arguments: -// * struct { -// * A_UINT32 numPMKID; -// * WMI_PMKID pmkidList[WMI_MAX_PMKID_CACHE]; -// * } -// * uses: WMI_SET_PMKIDLIST_CMD -// */ -// -//#define AR6000_XIOCTL_WMI_SET_PARAMS 85 -//#define AR6000_XIOCTL_WMI_SET_MCAST_FILTER 86 -//#define AR6000_XIOCTL_WMI_DEL_MCAST_FILTER 87 -// -// -///* Historical DSETPATCH support for INI patches */ -//#define AR6000_XIOCTL_UNUSED90 90 -// -// -///* Support LZ-compressed firmware download */ -//#define AR6000_XIOCTL_BMI_LZ_STREAM_START 91 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_BMI_LZ_STREAM_START) -// * UINT32 address -// * uses: BMI_LZ_STREAM_START -// */ -// -//#define AR6000_XIOCTL_BMI_LZ_DATA 92 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_BMI_LZ_DATA) -// * UINT32 length -// * char data[length] -// * uses: BMI_LZ_DATA -// */ -// -//#define AR6000_XIOCTL_PROF_CFG 93 -///* -// * arguments: -// * A_UINT32 period -// * A_UINT32 nbins -// */ -// -//#define AR6000_XIOCTL_PROF_ADDR_SET 94 -///* -// * arguments: -// * A_UINT32 Target address -// */ -// -//#define AR6000_XIOCTL_PROF_START 95 -// -//#define AR6000_XIOCTL_PROF_STOP 96 -// -//#define AR6000_XIOCTL_PROF_COUNT_GET 97 -// -//#define AR6000_XIOCTL_WMI_ABORT_SCAN 98 -// -///* -// * AP mode -// */ -//#define AR6000_XIOCTL_AP_GET_STA_LIST 99 -// -//#define AR6000_XIOCTL_AP_HIDDEN_SSID 100 -// -//#define AR6000_XIOCTL_AP_SET_NUM_STA 101 -// -//#define AR6000_XIOCTL_AP_SET_ACL_MAC 102 -// -//#define AR6000_XIOCTL_AP_GET_ACL_LIST 103 -// -//#define AR6000_XIOCTL_AP_COMMIT_CONFIG 104 -// -//#define IEEE80211_IOCTL_GETWPAIE 105 -// -//#define AR6000_XIOCTL_AP_CONN_INACT_TIME 106 -// -//#define AR6000_XIOCTL_AP_PROT_SCAN_TIME 107 -// -//#define AR6000_XIOCTL_AP_SET_COUNTRY 108 -// -//#define AR6000_XIOCTL_AP_SET_DTIM 109 -// -// -// -// -//#define AR6000_XIOCTL_WMI_TARGET_EVENT_REPORT 110 -// -//#define AR6000_XIOCTL_SET_IP 111 -// -//#define AR6000_XIOCTL_AP_SET_ACL_POLICY 112 -// -//#define AR6000_XIOCTL_AP_CTRL_BSS_COMM 113 -// -//#define AR6000_XIOCTL_DUMP_MODULE_DEBUG_INFO 114 -// -//#define AR6000_XIOCTL_MODULE_DEBUG_SET_MASK 115 -// -//#define AR6000_XIOCTL_MODULE_DEBUG_GET_MASK 116 -// -//#define AR6000_XIOCTL_DUMP_RCV_AGGR_STATS 117 -// -//#define AR6000_XIOCTL_SET_HT_CAP 118 -// -//#define AR6000_XIOCTL_SET_HT_OP 119 -// -//#define AR6000_XIOCTL_AP_GET_STAT 120 -// -//#define AR6000_XIOCTL_SET_TX_SELECT_RATES 121 -// -//#define AR6000_XIOCTL_SETUP_AGGR 122 -// -//#define AR6000_XIOCTL_ALLOW_AGGR 123 -// -//#define AR6000_XIOCTL_AP_GET_HIDDEN_SSID 124 -// -//#define AR6000_XIOCTL_AP_GET_COUNTRY 125 -// -//#define AR6000_XIOCTL_AP_GET_WMODE 126 -// -//#define AR6000_XIOCTL_AP_GET_DTIM 127 -// -//#define AR6000_XIOCTL_AP_GET_BINTVL 128 -// -//#define AR6000_XIOCTL_AP_GET_RTS 129 -// -//#define AR6000_XIOCTL_DELE_AGGR 130 -// -//#define AR6000_XIOCTL_FETCH_TARGET_REGS 131 -// -//#define AR6000_XIOCTL_HCI_CMD 132 -// -//#define AR6000_XIOCTL_ACL_DATA 133 -// -//#define AR6000_XIOCTL_WLAN_CONN_PRECEDENCE 134 -// -//#define AR6000_XIOCTL_AP_SET_11BG_RATESET 135 -// -//#define AR6000_XIOCTL_WMI_SET_AP_PS 136 -// -//#define AR6000_XIOCTL_WMI_MCAST_FILTER 137 -// -//#define AR6000_XIOCTL_WMI_SET_BTCOEX_FE_ANT 138 -// -//#define AR6000_XIOCTL_WMI_SET_BTCOEX_COLOCATED_BT_DEV 139 -// -//#define AR6000_XIOCTL_WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG 140 -// -//#define AR6000_XIOCTL_WMI_SET_BTCOEX_SCO_CONFIG 141 -// -//#define AR6000_XIOCTL_WMI_SET_BTCOEX_A2DP_CONFIG 142 -// -//#define AR6000_XIOCTL_WMI_SET_BTCOEX_ACLCOEX_CONFIG 143 -// -//#define AR6000_XIOCTL_WMI_SET_BTCOEX_DEBUG 144 -// -//#define AR6000_XIOCTL_WMI_SET_BT_OPERATING_STATUS 145 -// -//#define AR6000_XIOCTL_WMI_GET_BTCOEX_CONFIG 146 -// -//#define AR6000_XIOCTL_WMI_GET_BTCOEX_STATS 147 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_WMI_SET_QOS_SUPP) -// * UINT8 mode -// * uses: WMI_SET_QOS_SUPP_CMDID -// */ -//#define AR6000_XIOCTL_WMI_SET_QOS_SUPP 148 -// -//#define AR6000_XIOCTL_AP_SET_DFS 149 -// -//#ifdef P2P -//#define AR6000_XIOCTL_WMI_P2P_DISCOVER 150 -//#define AR6000_XIOCTL_WMI_P2P_LISTEN 151 -//#define AR6000_XIOCTL_WMI_P2P_GO_NEG 152 -//#define AR6000_XIOCTL_WMI_P2P_CONFIG 153 -//#define AR6000_XIOCTL_WMI_WPS_CONFIG 154 -//#define AR6000_XIOCTL_WMI_P2P_FINDNODE 155 -//#endif -//#define AR6000_XIOCTL_SET_BT_HW_POWER_STATE 156 -//#define AR6000_XIOCTL_GET_BT_HW_POWER_STATE 157 -//#define AR6000_XIOCTL_GET_WLAN_SLEEP_STATE 158 -//#define AR6000_XIOCTL_WMI_SET_TX_SGI_PARAM 159 -///* -// * arguments: -// * WMI_AP_PS_CMD apPsCmd -// * uses: WMI_AP_PS_CMDID -// */ -// -// -//// WAC -//#define AR6000_XIOCTL_WMI_ENABLE_WAC_PARAM 160 -// -//#define AR6000_XIOCTL_WAC_SCAN_REPLY 161 -// -//#define AR6000_XIOCTL_WMI_WAC_CTRL_REQ 162 -// -//#define AR6000_XIOCTL_WMI_SET_WPA_OFFLOAD_STATE 163 -// -//#define AR6000_XIOCTL_WMI_SET_PASSPHRASE 164 -// -//#define AR6000_XIOCTL_BMI_NVRAM_PROCESS 165 -// -//#define AR6000_XIOCTL_AP_ACS_DISABLE_HI_CHANNELS 166 -// -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_BMI_NVRAM_PROCESS) -// * UINT8 name[BMI_NVRAM_SEG_NAME_SZ] -// * uses: BMI_NVRAM_PROCESS -// */ -// -// -//#ifdef CONFIG_HOST_TCMD_SUPPORT -///* ====additional extended commands for radio test ==== */ -// -//#define AR6000_XIOCTL_TCMD_CMDS 167 -///* -// * arguments: -// * UINT32 cmd (AR6000_XIOCTL_TCMD_CMDS) -// * WMI_TCMD_CMDS_CMD cmdsCmd (see include/wmi.h) -// * uses: WMI_TCMD_CMDS_CMDID -// */ -// -//#endif //ifdef CONFIG_HOST_TCMD_SUPPORT -// -//#define AR6000_XIOCTL_WMI_SET_DIVERSITY_PARAM 168 -// -//#define AR6000_XIOCTL_WMI_FORCE_ASSERT 169 -// -//#define AR6000_XIOCTL_WMI_SET_EXCESS_TX_RETRY_THRES 170 -// -//#define AR6000_XIOCTL_AP_GET_NUM_STA 171 -// -//#define AR6000_XIOCTL_SUSPEND_DRIVER 172 -// -//#define AR6000_XIOCTL_RESUME_DRIVER 173 - -/* used by AR6000_IOCTL_WMI_GETREV */ -struct ar6000_version { - A_UINT32 host_ver; - A_UINT32 target_ver; - A_UINT32 wlan_ver; - A_UINT32 abi_ver; - A_UINT32 targetconf_ver; -}; - -/* used by AR6000_IOCTL_WMI_GET_QOS_QUEUE */ -struct ar6000_queuereq { - A_UINT8 trafficClass; - A_UINT16 activeTsids; -}; - -/* used by AR6000_IOCTL_WMI_GET_TARGET_STATS */ -typedef struct targetStats_t { - A_UINT64 tx_packets; - A_UINT64 tx_bytes; - A_UINT64 tx_unicast_pkts; - A_UINT64 tx_unicast_bytes; - A_UINT64 tx_multicast_pkts; - A_UINT64 tx_multicast_bytes; - A_UINT64 tx_broadcast_pkts; - A_UINT64 tx_broadcast_bytes; - A_UINT64 tx_rts_success_cnt; - A_UINT64 tx_packet_per_ac[4]; - - A_UINT64 tx_errors; - A_UINT64 tx_failed_cnt; - A_UINT64 tx_retry_cnt; - A_UINT64 tx_mult_retry_cnt; - A_UINT64 tx_rts_fail_cnt; - - A_UINT64 rx_packets; - A_UINT64 rx_bytes; - A_UINT64 rx_unicast_pkts; - A_UINT64 rx_unicast_bytes; - A_UINT64 rx_multicast_pkts; - A_UINT64 rx_multicast_bytes; - A_UINT64 rx_broadcast_pkts; - A_UINT64 rx_broadcast_bytes; - A_UINT64 rx_fragment_pkt; - - A_UINT64 rx_errors; - A_UINT64 rx_crcerr; - A_UINT64 rx_key_cache_miss; - A_UINT64 rx_decrypt_err; - A_UINT64 rx_duplicate_frames; - - A_UINT64 tkip_local_mic_failure; - A_UINT64 tkip_counter_measures_invoked; - A_UINT64 tkip_replays; - A_UINT64 tkip_format_errors; - A_UINT64 ccmp_format_errors; - A_UINT64 ccmp_replays; - - A_UINT64 power_save_failure_cnt; - - A_UINT64 cs_bmiss_cnt; - A_UINT64 cs_lowRssi_cnt; - A_UINT64 cs_connect_cnt; - A_UINT64 cs_disconnect_cnt; - - A_INT32 tx_unicast_rate; - A_INT32 rx_unicast_rate; - - A_UINT32 lq_val; - - A_UINT32 wow_num_pkts_dropped; - A_UINT16 wow_num_events_discarded; - - A_INT16 noise_floor_calibation; - A_INT16 cs_rssi; - A_INT16 cs_aveBeacon_rssi; - A_UINT8 cs_aveBeacon_snr; - A_UINT8 cs_lastRoam_msec; - A_UINT8 cs_snr; - - A_UINT8 wow_num_host_pkt_wakeups; - A_UINT8 wow_num_host_event_wakeups; - - A_UINT32 arp_received; - A_UINT32 arp_matched; - A_UINT32 arp_replied; -}TARGET_STATS; - -typedef struct targetStats_cmd_t { - TARGET_STATS targetStats; - int clearStats; -} TARGET_STATS_CMD; - -/* used by AR6000_XIOCTL_USER_SETKEYS */ - -/* - * Setting this bit to 1 doesnot initialize the RSC on the firmware - */ -#define AR6000_XIOCTL_USER_SETKEYS_RSC_CTRL 1 -#define AR6000_USER_SETKEYS_RSC_UNCHANGED 0x00000002 - -typedef struct { - A_UINT32 keyOpCtrl; /* Bit Map of Key Mgmt Ctrl Flags */ -} AR6000_USER_SETKEYS_INFO; - - -/* used by AR6000_XIOCTL_GPIO_OUTPUT_SET */ -struct ar6000_gpio_output_set_cmd_s { - A_UINT32 set_mask; - A_UINT32 clear_mask; - A_UINT32 enable_mask; - A_UINT32 disable_mask; -}; - -/* - * used by AR6000_XIOCTL_GPIO_REGISTER_GET and AR6000_XIOCTL_GPIO_REGISTER_SET - */ -struct ar6000_gpio_register_cmd_s { - A_UINT32 gpioreg_id; - A_UINT32 value; -}; - -/* used by AR6000_XIOCTL_GPIO_INTR_ACK */ -struct ar6000_gpio_intr_ack_cmd_s { - A_UINT32 ack_mask; -}; - -/* used by AR6000_XIOCTL_GPIO_INTR_WAIT */ -struct ar6000_gpio_intr_wait_cmd_s { - A_UINT32 intr_mask; - A_UINT32 input_values; -}; - -/* used by the AR6000_XIOCTL_DBGLOG_CFG_MODULE */ -typedef struct ar6000_dbglog_module_config_s { - A_UINT32 valid; - A_UINT16 mmask; - A_UINT16 tsr; - A_BOOL rep; - A_UINT16 size; -} DBGLOG_MODULE_CONFIG; - -typedef struct user_rssi_thold_t { - A_INT16 tag; - A_INT16 rssi; -} USER_RSSI_THOLD; - -typedef struct user_rssi_params_t { - A_UINT8 weight; - A_UINT32 pollTime; - USER_RSSI_THOLD tholds[12]; -} USER_RSSI_PARAMS; - -typedef struct ar6000_get_btcoex_config_cmd_t{ - A_UINT32 btProfileType; - A_UINT32 linkId; - }AR6000_GET_BTCOEX_CONFIG_CMD; - -typedef struct ar6000_btcoex_config_t { - AR6000_GET_BTCOEX_CONFIG_CMD configCmd; - A_UINT32 * configEvent; -} AR6000_BTCOEX_CONFIG; - -typedef struct ar6000_btcoex_stats_t { - A_UINT32 * statsEvent; - }AR6000_BTCOEX_STATS; -/* - * Host driver may have some config parameters. Typically, these - * config params are one time config parameters. These could - * correspond to any of the underlying modules. Host driver exposes - * an api for the underlying modules to get this config. - */ -#define AR6000_DRIVER_CFG_BASE 0x8000 - -/* Should driver perform wlan node caching? */ -#define AR6000_DRIVER_CFG_GET_WLANNODECACHING 0x8001 -/*Should we log raw WMI msgs */ -#define AR6000_DRIVER_CFG_LOG_RAW_WMI_MSGS 0x8002 - -/* used by AR6000_XIOCTL_DIAG_READ & AR6000_XIOCTL_DIAG_WRITE */ -struct ar6000_diag_window_cmd_s { - unsigned int addr; - unsigned int value; -}; - - -struct ar6000_traffic_activity_change { - A_UINT32 StreamID; /* stream ID to indicate activity change */ - A_UINT32 Active; /* active (1) or inactive (0) */ -}; - -/* Used with AR6000_XIOCTL_PROF_COUNT_GET */ -struct prof_count_s { - A_UINT32 addr; /* bin start address */ - A_UINT32 count; /* hit count */ -}; - - -/* used by AR6000_XIOCTL_MODULE_DEBUG_SET_MASK */ -/* AR6000_XIOCTL_MODULE_DEBUG_GET_MASK */ -/* AR6000_XIOCTL_DUMP_MODULE_DEBUG_INFO */ -struct drv_debug_module_s { - A_CHAR modulename[128]; /* name of module */ - A_UINT32 mask; /* new mask to set .. or .. current mask */ -}; - -/* All HCI related rx events are sent up to the host app - * via a wmi event id. It can contain ACL data or HCI event, - * based on which it will be de-multiplexed. - */ -typedef enum { - PAL_HCI_EVENT = 0, - PAL_HCI_RX_DATA, -} WMI_PAL_EVENT_INFO; - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/drivers/net/wireless/ar6003/host/os/linux/include/athtypes_linux.h b/drivers/net/wireless/ar6003/host/os/linux/include/athtypes_linux.h deleted file mode 100644 index 9d9ecbb2a4d7..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/include/athtypes_linux.h +++ /dev/null @@ -1,53 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This file contains the definitions of the basic atheros data types. -// It is used to map the data types in atheros files to a platform specific -// type. -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -#ifndef _ATHTYPES_LINUX_H_ -#define _ATHTYPES_LINUX_H_ - -#ifdef __KERNEL__ -#include -#else -#include -#endif - -typedef int8_t A_INT8; -typedef int16_t A_INT16; -typedef int32_t A_INT32; -typedef int64_t A_INT64; - -typedef u_int8_t A_UINT8; -typedef u_int16_t A_UINT16; -typedef u_int32_t A_UINT32; -typedef u_int64_t A_UINT64; - -typedef int A_BOOL; -typedef char A_CHAR; -typedef unsigned char A_UCHAR; -typedef unsigned long A_ATH_TIMER; - - -#endif /* _ATHTYPES_LINUX_H_ */ diff --git a/drivers/net/wireless/ar6003/host/os/linux/include/cfg80211.h b/drivers/net/wireless/ar6003/host/os/linux/include/cfg80211.h deleted file mode 100644 index eeab404be789..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/include/cfg80211.h +++ /dev/null @@ -1,50 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -#ifndef _AR6K_CFG80211_H_ -#define _AR6K_CFG80211_H_ - -struct wireless_dev *ar6k_cfg80211_init(struct device *dev); -void ar6k_cfg80211_deinit(AR_SOFTC_DEV_T *arPriv); - -void ar6k_cfg80211_scanComplete_event(AR_SOFTC_DEV_T *arPriv, A_STATUS status); - -void ar6k_cfg80211_connect_event(AR_SOFTC_DEV_T *arPriv, A_UINT16 channel, - A_UINT8 *bssid, A_UINT16 listenInterval, - A_UINT16 beaconInterval,NETWORK_TYPE networkType, - A_UINT8 beaconIeLen, A_UINT8 assocReqLen, - A_UINT8 assocRespLen, A_UINT8 *assocInfo); - -void ar6k_cfg80211_disconnect_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 reason, - A_UINT8 *bssid, A_UINT8 assocRespLen, - A_UINT8 *assocInfo, A_UINT16 protocolReasonStatus); - -void ar6k_cfg80211_tkip_micerr_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 keyid, A_BOOL ismcast); - -#endif /* _AR6K_CFG80211_H_ */ - - - - - - diff --git a/drivers/net/wireless/ar6003/host/os/linux/include/config_linux.h b/drivers/net/wireless/ar6003/host/os/linux/include/config_linux.h deleted file mode 100644 index 16dc80474635..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/include/config_linux.h +++ /dev/null @@ -1,70 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -#ifndef _CONFIG_LINUX_H_ -#define _CONFIG_LINUX_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* - * Host-side GPIO support is optional. - * If run-time access to GPIO pins is not required, then - * this should be changed to #undef. - */ -#define CONFIG_HOST_GPIO_SUPPORT - -/* - * Host side Test Command support - * Note: when HCI SDIO is enabled, a low stack IRQ or statck overflow is - * hit on FC10. So with HCI SDIO, minimize the stack allocation by - * mutually exclude TCMD_SUPPORT, which allocates large buffers - * in AR_TCMD_RESP in AR_SOFTC_T - * - */ -#ifndef HCI_TRANSPORT_SDIO -//#define CONFIG_HOST_TCMD_SUPPORT -#endif - -/* Host-side support for Target-side profiling */ -#undef CONFIG_TARGET_PROFILE_SUPPORT -/*DIX OFFLOAD SUPPORT*/ -/*#define DIX_RX_OFFLOAD*/ -/*#define DIX_TX_OFFLOAD*/ - -/* IP/TCP checksum offload */ -/* Checksum offload is currently not supported for 64 bit platforms */ -#ifndef __LP64__ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) -#define CONFIG_CHECKSUM_OFFLOAD -#endif -#endif /* __LP64__ */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/drivers/net/wireless/ar6003/host/os/linux/include/debug_linux.h b/drivers/net/wireless/ar6003/host/os/linux/include/debug_linux.h deleted file mode 100644 index b8dba52badce..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/include/debug_linux.h +++ /dev/null @@ -1,50 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -#ifndef _DEBUG_LINUX_H_ -#define _DEBUG_LINUX_H_ - - /* macro to remove parens */ -#define ATH_PRINTX_ARG(arg...) arg - -#ifdef DEBUG - /* NOTE: the AR_DEBUG_PRINTF macro is defined here to handle special handling of variable arg macros - * which may be compiler dependent. */ -#define AR_DEBUG_PRINTF(mask, args) do { \ - if (GET_ATH_MODULE_DEBUG_VAR_MASK(ATH_MODULE_NAME) & (mask)) { \ - A_LOGGER(mask, ATH_MODULE_NAME, ATH_PRINTX_ARG args); \ - } \ -} while (0) -#else - /* on non-debug builds, keep in error and warning messages in the driver, all other - * message tracing will get compiled out */ -#define AR_DEBUG_PRINTF(mask, args) \ - if ((mask) & (ATH_DEBUG_ERR | ATH_DEBUG_WARN)) { A_PRINTF(ATH_PRINTX_ARG args); } - -#endif - - /* compile specific macro to get the function name string */ -#define _A_FUNCNAME_ __func__ - - -#endif /* _DEBUG_LINUX_H_ */ diff --git a/drivers/net/wireless/ar6003/host/os/linux/include/export_hci_transport.h b/drivers/net/wireless/ar6003/host/os/linux/include/export_hci_transport.h deleted file mode 100644 index c1506805a4d5..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/include/export_hci_transport.h +++ /dev/null @@ -1,76 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2009-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// HCI bridge implementation -// -// Author(s): ="Atheros" -//============================================================================== - -#include "hci_transport_api.h" -#include "common_drv.h" - -extern HCI_TRANSPORT_HANDLE (*_HCI_TransportAttach)(void *HTCHandle, HCI_TRANSPORT_CONFIG_INFO *pInfo); -extern void (*_HCI_TransportDetach)(HCI_TRANSPORT_HANDLE HciTrans); -extern A_STATUS (*_HCI_TransportAddReceivePkts)(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET_QUEUE *pQueue); -extern A_STATUS (*_HCI_TransportSendPkt)(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET *pPacket, A_BOOL Synchronous); -extern void (*_HCI_TransportStop)(HCI_TRANSPORT_HANDLE HciTrans); -extern A_STATUS (*_HCI_TransportStart)(HCI_TRANSPORT_HANDLE HciTrans); -extern A_STATUS (*_HCI_TransportEnableDisableAsyncRecv)(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable); -extern A_STATUS (*_HCI_TransportRecvHCIEventSync)(HCI_TRANSPORT_HANDLE HciTrans, - HTC_PACKET *pPacket, - int MaxPollMS); -extern A_STATUS (*_HCI_TransportSetBaudRate)(HCI_TRANSPORT_HANDLE HciTrans, A_UINT32 Baud); -extern A_STATUS (*_HCI_TransportEnablePowerMgmt)(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable); - - -#define HCI_TransportAttach(HTCHandle, pInfo) \ - _HCI_TransportAttach((HTCHandle), (pInfo)) -#define HCI_TransportDetach(HciTrans) \ - _HCI_TransportDetach(HciTrans) -#define HCI_TransportAddReceivePkts(HciTrans, pQueue) \ - _HCI_TransportAddReceivePkts((HciTrans), (pQueue)) -#define HCI_TransportSendPkt(HciTrans, pPacket, Synchronous) \ - _HCI_TransportSendPkt((HciTrans), (pPacket), (Synchronous)) -#define HCI_TransportStop(HciTrans) \ - _HCI_TransportStop((HciTrans)) -#define HCI_TransportStart(HciTrans) \ - _HCI_TransportStart((HciTrans)) -#define HCI_TransportEnableDisableAsyncRecv(HciTrans, Enable) \ - _HCI_TransportEnableDisableAsyncRecv((HciTrans), (Enable)) -#define HCI_TransportRecvHCIEventSync(HciTrans, pPacket, MaxPollMS) \ - _HCI_TransportRecvHCIEventSync((HciTrans), (pPacket), (MaxPollMS)) -#define HCI_TransportSetBaudRate(HciTrans, Baud) \ - _HCI_TransportSetBaudRate((HciTrans), (Baud)) -#define HCI_TransportEnablePowerMgmt(HciTrans, Enable) \ - _HCI_TransportEnablePowerMgmt((HciTrans), (Enable)) - - -extern A_STATUS ar6000_register_hci_transport(HCI_TRANSPORT_CALLBACKS *hciTransCallbacks); - -extern A_STATUS ar6000_get_hif_dev(HIF_DEVICE *device, void *config); - -extern A_STATUS ar6000_set_uart_config(HIF_DEVICE *hifDevice, A_UINT32 scale, A_UINT32 step); - -/* get core clock register settings - * data: 0 - 40/44MHz - * 1 - 80/88MHz - * where (5G band/2.4G band) - * assume 2.4G band for now - */ -extern A_STATUS ar6000_get_core_clock_config(HIF_DEVICE *hifDevice, A_UINT32 *data); diff --git a/drivers/net/wireless/ar6003/host/os/linux/include/ieee80211_ioctl.h b/drivers/net/wireless/ar6003/host/os/linux/include/ieee80211_ioctl.h deleted file mode 100644 index 714441211536..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/include/ieee80211_ioctl.h +++ /dev/null @@ -1,181 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -#ifndef _IEEE80211_IOCTL_H_ -#define _IEEE80211_IOCTL_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Extracted from the MADWIFI net80211/ieee80211_ioctl.h - */ - -/* - * WPA/RSN get/set key request. Specify the key/cipher - * type and whether the key is to be used for sending and/or - * receiving. The key index should be set only when working - * with global keys (use IEEE80211_KEYIX_NONE for ``no index''). - * Otherwise a unicast/pairwise key is specified by the bssid - * (on a station) or mac address (on an ap). They key length - * must include any MIC key data; otherwise it should be no - more than IEEE80211_KEYBUF_SIZE. - */ -struct ieee80211req_key { - u_int8_t ik_type; /* key/cipher type */ - u_int8_t ik_pad; - u_int16_t ik_keyix; /* key index */ - u_int8_t ik_keylen; /* key length in bytes */ - u_int8_t ik_flags; -#define IEEE80211_KEY_XMIT 0x01 -#define IEEE80211_KEY_RECV 0x02 -#define IEEE80211_KEY_DEFAULT 0x80 /* default xmit key */ - u_int8_t ik_macaddr[IEEE80211_ADDR_LEN]; - u_int64_t ik_keyrsc; /* key receive sequence counter */ - u_int64_t ik_keytsc; /* key transmit sequence counter */ - u_int8_t ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE]; -}; -/* - * Delete a key either by index or address. Set the index - * to IEEE80211_KEYIX_NONE when deleting a unicast key. - */ -struct ieee80211req_del_key { - u_int8_t idk_keyix; /* key index */ - u_int8_t idk_macaddr[IEEE80211_ADDR_LEN]; -}; -/* - * MLME state manipulation request. IEEE80211_MLME_ASSOC - * only makes sense when operating as a station. The other - * requests can be used when operating as a station or an - * ap (to effect a station). - */ -struct ieee80211req_mlme { - u_int8_t im_op; /* operation to perform */ -#define IEEE80211_MLME_ASSOC 1 /* associate station */ -#define IEEE80211_MLME_DISASSOC 2 /* disassociate station */ -#define IEEE80211_MLME_DEAUTH 3 /* deauthenticate station */ -#define IEEE80211_MLME_AUTHORIZE 4 /* authorize station */ -#define IEEE80211_MLME_UNAUTHORIZE 5 /* unauthorize station */ - u_int16_t im_reason; /* 802.11 reason code */ - u_int8_t im_macaddr[IEEE80211_ADDR_LEN]; -}; - -struct ieee80211req_addpmkid { - u_int8_t pi_bssid[IEEE80211_ADDR_LEN]; - u_int8_t pi_enable; - u_int8_t pi_pmkid[16]; -}; - -#define AUTH_ALG_OPEN_SYSTEM 0x01 -#define AUTH_ALG_SHARED_KEY 0x02 -#define AUTH_ALG_LEAP 0x04 - -struct ieee80211req_authalg { - u_int8_t auth_alg; -}; - -/* - * Request to add an IE to a Management Frame - */ -enum{ - IEEE80211_APPIE_FRAME_BEACON = 0, - IEEE80211_APPIE_FRAME_PROBE_REQ = 1, - IEEE80211_APPIE_FRAME_PROBE_RESP = 2, - IEEE80211_APPIE_FRAME_ASSOC_REQ = 3, - IEEE80211_APPIE_FRAME_ASSOC_RESP = 4, - IEEE80211_APPIE_NUM_OF_FRAME = 5 -}; - -/* - * The Maximum length of the IE that can be added to a Management frame - */ -#define IEEE80211_APPIE_FRAME_MAX_LEN 200 - -struct ieee80211req_getset_appiebuf { - u_int32_t app_frmtype; /* management frame type for which buffer is added */ - u_int32_t app_buflen; /*application supplied buffer length */ - u_int8_t app_buf[]; -}; - -/* - * The following definitions are used by an application to set filter - * for receiving management frames - */ -enum { - IEEE80211_FILTER_TYPE_BEACON = 0x1, - IEEE80211_FILTER_TYPE_PROBE_REQ = 0x2, - IEEE80211_FILTER_TYPE_PROBE_RESP = 0x4, - IEEE80211_FILTER_TYPE_ASSOC_REQ = 0x8, - IEEE80211_FILTER_TYPE_ASSOC_RESP = 0x10, - IEEE80211_FILTER_TYPE_AUTH = 0x20, - IEEE80211_FILTER_TYPE_DEAUTH = 0x40, - IEEE80211_FILTER_TYPE_DISASSOC = 0x80, - IEEE80211_FILTER_TYPE_ALL = 0xFF /* used to check the valid filter bits */ -}; - -struct ieee80211req_set_filter { - u_int32_t app_filterype; /* management frame filter type */ -}; - -enum { - IEEE80211_PARAM_AUTHMODE = 3, /* Authentication Mode */ - IEEE80211_PARAM_MCASTCIPHER = 5, - IEEE80211_PARAM_MCASTKEYLEN = 6, /* multicast key length */ - IEEE80211_PARAM_UCASTCIPHER = 8, - IEEE80211_PARAM_UCASTKEYLEN = 9, /* unicast key length */ - IEEE80211_PARAM_WPA = 10, /* WPA mode (0,1,2) */ - IEEE80211_PARAM_ROAMING = 12, /* roaming mode */ - IEEE80211_PARAM_PRIVACY = 13, /* privacy invoked */ - IEEE80211_PARAM_COUNTERMEASURES = 14, /* WPA/TKIP countermeasures */ - IEEE80211_PARAM_DROPUNENCRYPTED = 15, /* discard unencrypted frames */ - IEEE80211_PARAM_WAPI = 16, /* WAPI policy from wapid */ -}; - -/* - * Values for IEEE80211_PARAM_WPA - */ -#define WPA_MODE_WPA1 1 -#define WPA_MODE_WPA2 2 -#define WPA_MODE_AUTO 3 -#define WPA_MODE_NONE 4 - -struct ieee80211req_wpaie { - u_int8_t wpa_macaddr[IEEE80211_ADDR_LEN]; - u_int8_t wpa_ie[IEEE80211_MAX_IE]; - u_int8_t rsn_ie[IEEE80211_MAX_IE]; -}; - -#ifndef IW_ENCODE_ALG_PMK -#define IW_ENCODE_ALG_PMK 4 -#endif -#ifndef IW_ENCODE_ALG_KRK -#define IW_ENCODE_ALG_KRK 6 -#endif -#ifdef __cplusplus -} -#endif - -#endif /* _IEEE80211_IOCTL_H_ */ diff --git a/drivers/net/wireless/ar6003/host/os/linux/include/osapi_linux.h b/drivers/net/wireless/ar6003/host/os/linux/include/osapi_linux.h deleted file mode 100644 index bfdbba30b3be..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/include/osapi_linux.h +++ /dev/null @@ -1,432 +0,0 @@ -//------------------------------------------------------------------------------ -// This file contains the definitions of the basic atheros data types. -// It is used to map the data types in atheros files to a platform specific -// type. -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -#ifndef _OSAPI_LINUX_H_ -#define _OSAPI_LINUX_H_ - -#ifdef __KERNEL__ - -#include -#include -#include -#include -#include -#include -#include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) -#include -#endif -/*************************************/ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -#include -#endif -#include -#include -#include -#ifdef KERNEL_2_4 -#include -#include -#endif - -#include - -#ifdef __GNUC__ -#define __ATTRIB_PACK __attribute__ ((packed)) -#define __ATTRIB_PRINTF __attribute__ ((format (printf, 1, 2))) -#define __ATTRIB_NORETURN __attribute__ ((noreturn)) -#ifndef INLINE -#define INLINE __inline__ -#endif -#else /* Not GCC */ -#define __ATTRIB_PACK -#define __ATTRIB_PRINTF -#define __ATTRIB_NORETURN -#ifndef INLINE -#define INLINE __inline -#endif -#endif /* End __GNUC__ */ - -#define PREPACK -#define POSTPACK __ATTRIB_PACK - -/* - * Endianes macros - */ -#define A_BE2CPU8(x) ntohb(x) -#define A_BE2CPU16(x) ntohs(x) -#define A_BE2CPU32(x) ntohl(x) - -#define A_LE2CPU8(x) (x) -#define A_LE2CPU16(x) (x) -#define A_LE2CPU32(x) (x) - -#define A_CPU2BE8(x) htonb(x) -#define A_CPU2BE16(x) htons(x) -#define A_CPU2BE32(x) htonl(x) - -#define A_MEMCPY(dst, src, len) memcpy((A_UINT8 *)(dst), (src), (len)) -#define A_MEMZERO(addr, len) memset(addr, 0, len) -#define A_MEMCMP(addr1, addr2, len) memcmp((addr1), (addr2), (len)) - -#ifdef AR6K_ALLOC_DEBUG -#define a_meminfo_add(p, s) __a_meminfo_add(p, s, __func__, __LINE) -void __a_meminfo_add(void *ptr, size_t msize, const char *func, int lineno); -void a_meminfo_del(void *ptr); -void* a_mem_alloc(size_t msize, int type, const char *func, int lineno); -void a_mem_free(void *ptr); -void a_meminfo_report(int clear); -A_BOOL a_meminfo_find(void *ptr); -#define A_MALLOC(size) a_mem_alloc((size), GFP_KERNEL, __func__, __LINE__) -#define A_MALLOC_NOWAIT(size) a_mem_alloc((size), GFP_ATOMIC, __func__, __LINE__) -#define A_FREE(addr) a_mem_free(addr) -#define A_NETIF_RX(skb) do { a_meminfo_del(skb); netif_rx(skb); } while (0) -#define A_NETIF_RX_NI(skb) do { a_meminfo_del(skb); netif_rx_ni(skb); } while (0) -#else -#define a_meminfo_report(_c) -#define A_MALLOC(size) kmalloc((size), GFP_KERNEL) -#define A_MALLOC_NOWAIT(size) kmalloc((size), GFP_ATOMIC) -#define A_FREE(addr) kfree(addr) -#define A_NETIF_RX(skb) netif_rx(skb) -#define A_NETIF_RX_NI(skb) netif_rx_ni(skb) -#endif - -#if defined(ANDROID_ENV) && defined(CONFIG_ANDROID_LOGGER) -extern unsigned int enablelogcat; -extern int android_logger_lv(void* module, int mask); -enum logidx { LOG_MAIN_IDX = 0 }; -extern int logger_write(const enum logidx idx, - const unsigned char prio, - const char __kernel * const tag, - const char __kernel * const fmt, - ...); -#define A_ANDROID_PRINTF(mask, module, tags, args...) do { \ - if (enablelogcat) \ - logger_write(LOG_MAIN_IDX, android_logger_lv(module, mask), tags, args); \ - else \ - printk(KERN_ALERT args); \ -} while (0) -#ifdef DEBUG -#define A_LOGGER_MODULE_NAME(x) #x -#define A_LOGGER(mask, mod, args...) \ - A_ANDROID_PRINTF(mask, &GET_ATH_MODULE_DEBUG_VAR_NAME(mod), "ar6k_" A_LOGGER_MODULE_NAME(mod), args); -#endif -#define A_PRINTF(args...) A_ANDROID_PRINTF(ATH_DEBUG_INFO, NULL, "ar6k_driver", args) -#else -#define A_LOGGER(mask, mod, args...) printk(KERN_ALERT args) -#define A_PRINTF(args...) printk(KERN_ALERT args) -#endif /* ANDROID */ -#define A_PRINTF_LOG(args...) printk(args) -#define A_SPRINTF(buf, args...) sprintf (buf, args) - -/* Mutual Exclusion */ -typedef spinlock_t A_MUTEX_T; -#define A_MUTEX_INIT(mutex) spin_lock_init(mutex) -#define A_MUTEX_LOCK(mutex) spin_lock_bh(mutex) -#define A_MUTEX_UNLOCK(mutex) spin_unlock_bh(mutex) -#define A_IS_MUTEX_VALID(mutex) TRUE /* okay to return true, since A_MUTEX_DELETE does nothing */ -#define A_MUTEX_DELETE(mutex) /* spin locks are not kernel resources so nothing to free.. */ - -/* Get current time in ms adding a constant offset (in ms) */ -#define A_GET_MS(offset) \ - (((jiffies / HZ) * 1000) + (offset)) - -/* - * Timer Functions - */ -#define A_MDELAY(msecs) mdelay(msecs) -typedef struct timer_list A_TIMER; - -#define A_INIT_TIMER(pTimer, pFunction, pArg) do { \ - init_timer(pTimer); \ - (pTimer)->function = (pFunction); \ - (pTimer)->data = (unsigned long)(pArg); \ -} while (0) - -/* - * Start a Timer that elapses after 'periodMSec' milli-seconds - * Support is provided for a one-shot timer. The 'repeatFlag' is - * ignored. - */ -#define A_TIMEOUT_MS(pTimer, periodMSec, repeatFlag) do { \ - if (repeatFlag) { \ - printk("\n" __FILE__ ":%d: Timer Repeat requested\n",__LINE__); \ - panic("Timer Repeat"); \ - } \ - mod_timer((pTimer), jiffies + HZ * (periodMSec) / 1000); \ -} while (0) - -/* - * Cancel the Timer. - */ -#define A_UNTIMEOUT(pTimer) do { \ - del_timer((pTimer)); \ -} while (0) - -#define A_DELETE_TIMER(pTimer) do { \ -} while (0) - -/* - * Wait Queue related functions - */ -typedef wait_queue_head_t A_WAITQUEUE_HEAD; -#define A_INIT_WAITQUEUE_HEAD(head) init_waitqueue_head(head) -#ifndef wait_event_interruptible_timeout -#define __wait_event_interruptible_timeout(wq, condition, ret) \ -do { \ - wait_queue_t __wait; \ - init_waitqueue_entry(&__wait, current); \ - \ - add_wait_queue(&wq, &__wait); \ - for (;;) { \ - set_current_state(TASK_INTERRUPTIBLE); \ - if (condition) \ - break; \ - if (!signal_pending(current)) { \ - ret = schedule_timeout(ret); \ - if (!ret) \ - break; \ - continue; \ - } \ - ret = -ERESTARTSYS; \ - break; \ - } \ - current->state = TASK_RUNNING; \ - remove_wait_queue(&wq, &__wait); \ -} while (0) - -#define wait_event_interruptible_timeout(wq, condition, timeout) \ -({ \ - long __ret = timeout; \ - if (!(condition)) \ - __wait_event_interruptible_timeout(wq, condition, __ret); \ - __ret; \ -}) -#endif /* wait_event_interruptible_timeout */ - -#define A_WAIT_EVENT_INTERRUPTIBLE_TIMEOUT(head, condition, timeout) do { \ - wait_event_interruptible_timeout(head, condition, timeout); \ -} while (0) - -#define A_WAKE_UP(head) wake_up(head) - -#ifdef DEBUG -extern unsigned int panic_on_assert; -#define A_ASSERT(expr) \ - if (!(expr)) { \ - printk(KERN_ALERT"Debug Assert Caught, File %s, Line: %d, Test:%s \n",__FILE__, __LINE__,#expr); \ - if (panic_on_assert) panic(#expr); \ - } -#else -#define A_ASSERT(expr) -#endif /* DEBUG */ - -#ifdef ANDROID_ENV -struct firmware; -int android_request_firmware(const struct firmware **firmware_p, const char *filename, - struct device *device); -void android_release_firmware(const struct firmware *firmware); -#define A_REQUEST_FIRMWARE(_ppf, _pfile, _dev) android_request_firmware(_ppf, _pfile, _dev) -#define A_RELEASE_FIRMWARE(_pf) android_release_firmware(_pf) -#else -#define A_REQUEST_FIRMWARE(_ppf, _pfile, _dev) request_firmware(_ppf, _pfile, _dev) -#define A_RELEASE_FIRMWARE(_pf) release_firmware(_pf) -#endif - -/* - * Initialization of the network buffer subsystem - */ -#define A_NETBUF_INIT() - -/* - * Network buffer queue support - */ -typedef struct sk_buff_head A_NETBUF_QUEUE_T; - -#define A_NETBUF_QUEUE_INIT(q) \ - a_netbuf_queue_init(q) - -#define A_NETBUF_ENQUEUE(q, pkt) \ - a_netbuf_enqueue((q), (pkt)) -#define A_NETBUF_PREQUEUE(q, pkt) \ - a_netbuf_prequeue((q), (pkt)) -#define A_NETBUF_DEQUEUE(q) \ - (a_netbuf_dequeue(q)) -#define A_NETBUF_QUEUE_SIZE(q) \ - a_netbuf_queue_size(q) -#define A_NETBUF_QUEUE_EMPTY(q) \ - a_netbuf_queue_empty(q) - -/* - * Network buffer support - */ -#ifdef AR6K_ALLOC_DEBUG -#define A_NETBUF_ALLOC(size) \ - a_netbuf_alloc(size, __func__, __LINE__) -#define A_NETBUF_ALLOC_RAW(size) \ - a_netbuf_alloc_raw(size, __func__, __LINE__) -#define A_NETBUF_CHECK(bufPtr) \ - a_netbuf_check(bufPtr, __func__, __LINE__) -#else -#define A_NETBUF_ALLOC(size) \ - a_netbuf_alloc(size) -#define A_NETBUF_ALLOC_RAW(size) \ - a_netbuf_alloc_raw(size) -#endif /* AR6K_ALLOC_DEBUG */ -#define A_NETBUF_FREE(bufPtr) \ - a_netbuf_free(bufPtr) -#define A_NETBUF_DATA(bufPtr) \ - a_netbuf_to_data(bufPtr) -#define A_NETBUF_LEN(bufPtr) \ - a_netbuf_to_len(bufPtr) -#define A_NETBUF_PUSH(bufPtr, len) \ - a_netbuf_push(bufPtr, len) -#define A_NETBUF_PUT(bufPtr, len) \ - a_netbuf_put(bufPtr, len) -#define A_NETBUF_TRIM(bufPtr,len) \ - a_netbuf_trim(bufPtr, len) -#define A_NETBUF_PULL(bufPtr, len) \ - a_netbuf_pull(bufPtr, len) -#define A_NETBUF_HEADROOM(bufPtr)\ - a_netbuf_headroom(bufPtr) -#define A_NETBUF_SETLEN(bufPtr,len) \ - a_netbuf_setlen(bufPtr, len) - -/* Add data to end of a buffer */ -#define A_NETBUF_PUT_DATA(bufPtr, srcPtr, len) \ - a_netbuf_put_data(bufPtr, srcPtr, len) - -/* Add data to start of the buffer */ -#define A_NETBUF_PUSH_DATA(bufPtr, srcPtr, len) \ - a_netbuf_push_data(bufPtr, srcPtr, len) - -/* Remove data at start of the buffer */ -#define A_NETBUF_PULL_DATA(bufPtr, dstPtr, len) \ - a_netbuf_pull_data(bufPtr, dstPtr, len) - -/* Remove data from the end of the buffer */ -#define A_NETBUF_TRIM_DATA(bufPtr, dstPtr, len) \ - a_netbuf_trim_data(bufPtr, dstPtr, len) - -/* View data as "size" contiguous bytes of type "t" */ -#define A_NETBUF_VIEW_DATA(bufPtr, t, size) \ - (t )( ((struct skbuf *)(bufPtr))->data) - -/* return the beginning of the headroom for the buffer */ -#define A_NETBUF_HEAD(bufPtr) \ - ((((struct sk_buff *)(bufPtr))->head)) - -/* - * OS specific network buffer access routines - */ -#ifdef AR6K_ALLOC_DEBUG -void *a_netbuf_alloc(int size, const char *func, int lineno); -void *a_netbuf_alloc_raw(int size, const char *func, int lineno); -void a_netbuf_check(void *bufPtr, const char *func, int lineno); -#else -void *a_netbuf_alloc(int size); -void *a_netbuf_alloc_raw(int size); -#endif -void a_netbuf_free(void *bufPtr); -void *a_netbuf_to_data(void *bufPtr); -A_UINT32 a_netbuf_to_len(void *bufPtr); -A_STATUS a_netbuf_push(void *bufPtr, A_INT32 len); -A_STATUS a_netbuf_push_data(void *bufPtr, char *srcPtr, A_INT32 len); -A_STATUS a_netbuf_put(void *bufPtr, A_INT32 len); -A_STATUS a_netbuf_put_data(void *bufPtr, char *srcPtr, A_INT32 len); -A_STATUS a_netbuf_pull(void *bufPtr, A_INT32 len); -A_STATUS a_netbuf_pull_data(void *bufPtr, char *dstPtr, A_INT32 len); -A_STATUS a_netbuf_trim(void *bufPtr, A_INT32 len); -A_STATUS a_netbuf_trim_data(void *bufPtr, char *dstPtr, A_INT32 len); -A_STATUS a_netbuf_setlen(void *bufPtr, A_INT32 len); -A_INT32 a_netbuf_headroom(void *bufPtr); -void a_netbuf_enqueue(A_NETBUF_QUEUE_T *q, void *pkt); -void a_netbuf_prequeue(A_NETBUF_QUEUE_T *q, void *pkt); -void *a_netbuf_dequeue(A_NETBUF_QUEUE_T *q); -int a_netbuf_queue_size(A_NETBUF_QUEUE_T *q); -int a_netbuf_queue_empty(A_NETBUF_QUEUE_T *q); -int a_netbuf_queue_empty(A_NETBUF_QUEUE_T *q); -void a_netbuf_queue_init(A_NETBUF_QUEUE_T *q); - -/* - * Kernel v.s User space functions - */ -A_UINT32 a_copy_to_user(void *to, const void *from, A_UINT32 n); -A_UINT32 a_copy_from_user(void *to, const void *from, A_UINT32 n); - -/* In linux, WLAN Rx and Tx run in different contexts, so no need to check - * for any commands/data queued for WLAN */ -#define A_CHECK_DRV_TX() - -#define A_GET_CACHE_LINE_BYTES() L1_CACHE_BYTES - -#define A_CACHE_LINE_PAD 128 - -static inline void *A_ALIGN_TO_CACHE_LINE(void *ptr) { - return (void *)L1_CACHE_ALIGN((unsigned long)ptr); -} - -#else /* __KERNEL__ */ - -#ifdef __GNUC__ -#define __ATTRIB_PACK __attribute__ ((packed)) -#define __ATTRIB_PRINTF __attribute__ ((format (printf, 1, 2))) -#define __ATTRIB_NORETURN __attribute__ ((noreturn)) -#ifndef INLINE -#define INLINE __inline__ -#endif -#else /* Not GCC */ -#define __ATTRIB_PACK -#define __ATTRIB_PRINTF -#define __ATTRIB_NORETURN -#ifndef INLINE -#define INLINE __inline -#endif -#endif /* End __GNUC__ */ - -#define PREPACK -#define POSTPACK __ATTRIB_PACK - -#define A_MEMCPY(dst, src, len) memcpy((dst), (src), (len)) -#define A_MEMZERO(addr, len) memset((addr), 0, (len)) -#define A_MEMCMP(addr1, addr2, len) memcmp((addr1), (addr2), (len)) -#define A_MALLOC(size) malloc(size) -#define A_FREE(addr) free(addr) - -#ifdef ANDROID -#ifndef err -#include -#define err(_s, args...) do { \ - fprintf(stderr, "%s: line %d ", __FILE__, __LINE__); \ - fprintf(stderr, args); fprintf(stderr, ": %d\n", errno); \ - exit(_s); } while (0) -#endif -#else -#include -#endif - -#endif /* __KERNEL__ */ - -#endif /* _OSAPI_LINUX_H_ */ diff --git a/drivers/net/wireless/ar6003/host/os/linux/include/wlan_config.h b/drivers/net/wireless/ar6003/host/os/linux/include/wlan_config.h deleted file mode 100644 index c38db55427ef..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/include/wlan_config.h +++ /dev/null @@ -1,146 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file contains the tunable configuration items for the WLAN module -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _HOST_WLAN_CONFIG_H_ -#define _HOST_WLAN_CONFIG_H_ - -/* Include definitions here that can be used to tune the WLAN module behavior. - * Different customers can tune the behavior as per their needs, here. - */ - -/* This configuration item when defined will consider the barker preamble - * mentioned in the ERP IE of the beacons from the AP to determine the short - * preamble support sent in the (Re)Assoc request frames. - */ -#define WLAN_CONFIG_DONOT_IGNORE_BARKER_IN_ERP 0 - -/* This config item when defined will not send the power module state transition - * failure events that happen during scan, to the host. - */ -#define WLAN_CONFIG_IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN 0 - -/* This config item disables sending a DisAssoc frame prior to sending a - * DeAuth frame. - */ -#define WLAN_CONFIG_NO_DISASSOC_UPON_DEAUTH 0 - -/* - * This configuration item enable/disable keepalive support. - * Keepalive support: In the absence of any data traffic to AP, null - * frames will be sent to the AP at periodic interval, to keep the association - * active. This configuration item defines the periodic interval. - * Use value of zero to disable keepalive support - * Default: 60 seconds - */ -#define WLAN_CONFIG_KEEP_ALIVE_INTERVAL 60 - -/* - * This configuration item sets the value of disconnect timeout - * Firmware delays sending the disconnec event to the host for this - * timeout after is gets disconnected from the current AP. - * If the firmware successly roams within the disconnect timeout - * it sends a new connect event - */ -#ifdef ANDROID_ENV -#define WLAN_CONFIG_DISCONNECT_TIMEOUT 3 -#else -#define WLAN_CONFIG_DISCONNECT_TIMEOUT 10 -#endif /* ANDROID_ENV */ - -/* - * This configuration item enable BT clock sharing support - * 1 - Enable - * 0 - Disable (Default) - */ -#define WLAN_CONFIG_BT_SHARING 0 - -/* - * This configuration item sets WIFI OFF policy - * 0 - CUT_POWER - * 1 - DEEP_SLEEP (Default) - */ -#define WLAN_CONFIG_WLAN_OFF 1 - -/* - * This configuration item disables 11n support. - * 0 - Enable - * 1 - Disable - */ -#define WLAN_CONFIG_DISABLE_11N 0 - -/* - * This configuration item sets suspend policy - * 0 - CUT_POWER (Default) - * 1 - DEEP_SLEEP - * 2 - WoW - * 3 - CUT_POWER if BT OFF (clock sharing designs only) - */ -#define WLAN_CONFIG_PM_SUSPEND 0 - -/* - * This configuration item sets suspend policy to use if PM_SUSPEND is - * set to WoW and device is not connected at the time of suspend - * 0 - CUT_POWER (Default) - * 1 - DEEP_SLEEP - * 2 - WoW - * 3 - CUT_POWER if BT OFF (clock sharing designs only) - */ -#define WLAN_CONFIG_PM_WOW2 0 - -/* - * Define GPIO number for WoW in your platform other than zero - * Wake lock will be called when GPIO asserted. - */ -#define PLAT_WOW_GPIO_PIN 0 - -/* - * This configuration item for the WOW patterns in AP mode - * 0 - Wake up host only if any unicast IP, EAPOL-like and ARP, broadcast dhcp and ARP packets. (default) - * 1 - Wake up host if any unicast/broadcast/multicast packets - */ -#define WLAN_CONFIG_SIMPLE_WOW_AP_MODE 0 - -/* - * Define the GPIO number for WLAN CHIP_PWD PIN other than zero - * Only use when you define plat_setup_power as plat_setup_power_stub - */ - -#define PLAT_WLAN_CHIP_PWD_PIN 1 - -/* - * Platform specific function to power ON/OFF AR6000 with CHIP_PWD PIN - * and enable/disable SDIO card detection - * - * Either implement wlan CHIP_PWD PIN and power GPIO control into - * plat_setup_power_stub(..) place holder in ar6000_pm.c - * or redefine plat_setup_power(..) into your export funciton. - */ - -#if PLAT_WLAN_CHIP_PWD_PIN -extern void plat_setup_power_stub(struct ar6_softc *ar, int on, int detect); -#define plat_setup_power(ar, on, detect) plat_setup_power_stub(ar, on, detect) -#else -#define plat_setup_power(ar, on, detect) /* define as your function */ -#endif - -#endif /* _HOST_WLAN_CONFIG_H_ */ diff --git a/drivers/net/wireless/ar6003/host/os/linux/include/wmi_filter_linux.h b/drivers/net/wireless/ar6003/host/os/linux/include/wmi_filter_linux.h deleted file mode 100644 index 2c52f6d79484..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/include/wmi_filter_linux.h +++ /dev/null @@ -1,346 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -#ifndef _WMI_FILTER_LINUX_H_ -#define _WMI_FILTER_LINUX_H_ - -/* - * sioctl_filter - Standard ioctl - * pioctl_filter - Priv ioctl - * xioctl_filter - eXtended ioctl - * - * ---- Possible values for the WMI filter --------------- - * (0) - Block this cmd always (or) not implemented - * (INFRA_NETWORK) - Allow this cmd only in STA mode - * (ADHOC_NETWORK) - Allow this cmd only in IBSS mode - * (AP_NETWORK) - Allow this cmd only in AP mode - * (INFRA_NETWORK | ADHOC_NETWORK) - Block this cmd in AP mode - * (ADHOC_NETWORK | AP_NETWORK) - Block this cmd in STA mode - * (INFRA_NETWORK | AP_NETWORK) - Block this cmd in IBSS mode - * (INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK)- allow only when mode is set - * (0xFF) - Allow this cmd always irrespective of mode - */ - -A_UINT8 sioctl_filter[] = { -(AP_NETWORK), /* SIOCSIWCOMMIT 0x8B00 */ -(0xFF), /* SIOCGIWNAME 0x8B01 */ -(0), /* SIOCSIWNWID 0x8B02 */ -(0), /* SIOCGIWNWID 0x8B03 */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* SIOCSIWFREQ 0x8B04 */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* SIOCGIWFREQ 0x8B05 */ -(0xFF), /* SIOCSIWMODE 0x8B06 */ -(0xFF), /* SIOCGIWMODE 0x8B07 */ -(0), /* SIOCSIWSENS 0x8B08 */ -(0), /* SIOCGIWSENS 0x8B09 */ -(0), /* SIOCSIWRANGE 0x8B0A */ -(0xFF), /* SIOCGIWRANGE 0x8B0B */ -(0), /* SIOCSIWPRIV 0x8B0C */ -(0), /* SIOCGIWPRIV 0x8B0D */ -(0), /* SIOCSIWSTATS 0x8B0E */ -(0), /* SIOCGIWSTATS 0x8B0F */ -(0), /* SIOCSIWSPY 0x8B10 */ -(0), /* SIOCGIWSPY 0x8B11 */ -(0), /* SIOCSIWTHRSPY 0x8B12 */ -(0), /* SIOCGIWTHRSPY 0x8B13 */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* SIOCSIWAP 0x8B14 */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* SIOCGIWAP 0x8B15 */ -#if (WIRELESS_EXT >= 18) -(INFRA_NETWORK | ADHOC_NETWORK), /* SIOCSIWMLME 0X8B16 */ -#else -(0), /* Dummy 0 */ -#endif /* WIRELESS_EXT */ -(0), /* SIOCGIWAPLIST 0x8B17 */ -(INFRA_NETWORK | ADHOC_NETWORK), /* SIOCSIWSCAN 0x8B18 */ -(INFRA_NETWORK | ADHOC_NETWORK), /* SIOCGIWSCAN 0x8B19 */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* SIOCSIWESSID 0x8B1A */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* SIOCGIWESSID 0x8B1B */ -(0), /* SIOCSIWNICKN 0x8B1C */ -(0), /* SIOCGIWNICKN 0x8B1D */ -(0), /* Dummy 0 */ -(0), /* Dummy 0 */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* SIOCSIWRATE 0x8B20 */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* SIOCGIWRATE 0x8B21 */ -(0), /* SIOCSIWRTS 0x8B22 */ -(0), /* SIOCGIWRTS 0x8B23 */ -(0), /* SIOCSIWFRAG 0x8B24 */ -(0), /* SIOCGIWFRAG 0x8B25 */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* SIOCSIWTXPOW 0x8B26 */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* SIOCGIWTXPOW 0x8B27 */ -(INFRA_NETWORK | ADHOC_NETWORK), /* SIOCSIWRETRY 0x8B28 */ -(INFRA_NETWORK | ADHOC_NETWORK), /* SIOCGIWRETRY 0x8B29 */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* SIOCSIWENCODE 0x8B2A */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* SIOCGIWENCODE 0x8B2B */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* SIOCSIWPOWER 0x8B2C */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* SIOCGIWPOWER 0x8B2D */ -}; - - - -A_UINT8 pioctl_filter[] = { -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* IEEE80211_IOCTL_SETPARAM (SIOCIWFIRSTPRIV+0) */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* IEEE80211_IOCTL_SETKEY (SIOCIWFIRSTPRIV+1) */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* IEEE80211_IOCTL_DELKEY (SIOCIWFIRSTPRIV+2) */ -(AP_NETWORK), /* IEEE80211_IOCTL_SETMLME (SIOCIWFIRSTPRIV+3) */ -(INFRA_NETWORK), /* IEEE80211_IOCTL_ADDPMKID (SIOCIWFIRSTPRIV+4) */ -(0), /* IEEE80211_IOCTL_SETOPTIE (SIOCIWFIRSTPRIV+5) */ -(0), /* (SIOCIWFIRSTPRIV+6) */ -(0), /* (SIOCIWFIRSTPRIV+7) */ -(0), /* (SIOCIWFIRSTPRIV+8) */ -(0), /* (SIOCIWFIRSTPRIV+9) */ -(0), /* IEEE80211_IOCTL_LASTONE (SIOCIWFIRSTPRIV+10) */ -(0xFF), /* AR6000_IOCTL_WMI_GETREV (SIOCIWFIRSTPRIV+11) */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_IOCTL_WMI_SETPWR (SIOCIWFIRSTPRIV+12) */ -(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_IOCTL_WMI_SETSCAN (SIOCIWFIRSTPRIV+13) */ -(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_IOCTL_WMI_SETLISTENINT (SIOCIWFIRSTPRIV+14) */ -(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_IOCTL_WMI_SETBSSFILTER (SIOCIWFIRSTPRIV+15) */ -(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_IOCTL_WMI_SET_CHANNELPARAMS (SIOCIWFIRSTPRIV+16) */ -(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_IOCTL_WMI_SET_PROBEDSSID (SIOCIWFIRSTPRIV+17) */ -(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_IOCTL_WMI_SET_PMPARAMS (SIOCIWFIRSTPRIV+18) */ -(INFRA_NETWORK), /* AR6000_IOCTL_WMI_SET_BADAP (SIOCIWFIRSTPRIV+19) */ -(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_IOCTL_WMI_GET_QOS_QUEUE (SIOCIWFIRSTPRIV+20) */ -(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_IOCTL_WMI_CREATE_QOS (SIOCIWFIRSTPRIV+21) */ -(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_IOCTL_WMI_DELETE_QOS (SIOCIWFIRSTPRIV+22) */ -(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_IOCTL_WMI_SET_SNRTHRESHOLD (SIOCIWFIRSTPRIV+23) */ -(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_IOCTL_WMI_SET_ERROR_REPORT_BITMASK (SIOCIWFIRSTPRIV+24)*/ -(0xFF), /* AR6000_IOCTL_WMI_GET_TARGET_STATS (SIOCIWFIRSTPRIV+25) */ -(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_IOCTL_WMI_SET_ASSOC_INFO (SIOCIWFIRSTPRIV+26) */ -(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_IOCTL_WMI_SET_ACCESS_PARAMS (SIOCIWFIRSTPRIV+27) */ -(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_IOCTL_WMI_SET_BMISS_TIME (SIOCIWFIRSTPRIV+28) */ -(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_IOCTL_WMI_SET_DISC_TIMEOUT (SIOCIWFIRSTPRIV+29) */ -(ADHOC_NETWORK), /* AR6000_IOCTL_WMI_SET_IBSS_PM_CAPS (SIOCIWFIRSTPRIV+30) */ -}; - -/* Submode for the sake of filtering XIOCTLs are broadly set to 2 types. - * P2P Submode & Non-P2P submode. IOCLT cmds can be marked to be valid only in - * P2P Submode or Non-P2P submode or both. The bits- b5,b6,b7 are used to encode - * this information in the IOCTL filters. The LSBits b0-b4 are used to encode - * the mode information. - */ -#define XIOCTL_FILTER_P2P_SUBMODE 0x20 -#define XIOCTL_FILTER_NONP2P_SUBMODE 0x40 -#define XIOCTL_FILTER_SUBMODE_DONTCARE \ - (XIOCTL_FILTER_P2P_SUBMODE | XIOCTL_FILTER_NONP2P_SUBMODE) - -A_UINT8 xioctl_filter[] = { -(0xFF), /* Dummy 0 */ -(0xFF), /* AR6000_XIOCTL_BMI_DONE 1 */ -(0xFF), /* AR6000_XIOCTL_BMI_READ_MEMORY 2 */ -(0xFF), /* AR6000_XIOCTL_BMI_WRITE_MEMORY 3 */ -(0xFF), /* AR6000_XIOCTL_BMI_EXECUTE 4 */ -(0xFF), /* AR6000_XIOCTL_BMI_SET_APP_START 5 */ -(0xFF), /* AR6000_XIOCTL_BMI_READ_SOC_REGISTER 6 */ -(0xFF), /* AR6000_XIOCTL_BMI_WRITE_SOC_REGISTER 7 */ -(0xFF), /* AR6000_XIOCTL_BMI_TEST 8 */ -(0xFF), /* AR6000_XIOCTL_UNUSED9 9 */ -(0xFF), /* AR6000_XIOCTL_UNUSED10 10 */ -(0xFF), /* AR6000_XIOCTL_UNUSED11 11 */ -(0xFF), /* AR6000_XIOCTL_FORCE_TARGET_RESET 12 */ -(0xFF), /* AR6000_XIOCTL_HTC_RAW_OPEN 13 */ -(0xFF), /* AR6000_XIOCTL_HTC_RAW_CLOSE 14 */ -(0xFF), /* AR6000_XIOCTL_HTC_RAW_READ 15 */ -(0xFF), /* AR6000_XIOCTL_HTC_RAW_WRITE 16 */ -(0xFF), /* AR6000_XIOCTL_CHECK_TARGET_READY 17 */ -(0xFF), /* AR6000_XIOCTL_GPIO_OUTPUT_SET 18 */ -(0xFF), /* AR6000_XIOCTL_GPIO_INPUT_GET 19 */ -(0xFF), /* AR6000_XIOCTL_GPIO_REGISTER_SET 20 */ -(0xFF), /* AR6000_XIOCTL_GPIO_REGISTER_GET 21 */ -(0xFF), /* AR6000_XIOCTL_GPIO_INTR_ACK 22 */ -(0xFF), /* AR6000_XIOCTL_GPIO_INTR_WAIT 23 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_SET_ADHOC_BSSID 24 */ -(0x00), /*AR6000_XIOCTL_UNUSED 25 */ -(0x00), /*AR6000_XIOCTL_UNUSED 26 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_SET_BEACON_INTVAL 27 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* IEEE80211_IOCTL_SETAUTHALG 28 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_SET_VOICE_PKT_SIZE 29 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_SET_MAX_SP 30 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_GET_ROAM_TBL 31 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_ROAM_CTRL 32 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTRL_WMI_SET_POWERSAVE_TIMERS 33 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTRL_WMI_GET_POWER_MODE 34 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTRL_WMI_SET_WLAN_STATE 35 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_GET_ROAM_DATA 36 */ -(0xFF), /* AR6000_XIOCTL_WMI_SETRETRYLIMITS 37 */ -(0xFF), /* AR6000_XIOCTL_TCMD_CONT_TX 38 */ -(0xFF), /* AR6000_XIOCTL_TCMD_CONT_RX 39 */ -(0xFF), /* AR6000_XIOCTL_TCMD_PM 40 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_STARTSCAN 41 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SETFIXRATES 42 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_GETFIXRATES 43 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_RSSITHRESHOLD 44 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_CLR_RSSISNR 45 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_LQTHRESHOLD 46 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_RTS 47 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_LPREAMBLE 48 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_AUTHMODE 49 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_REASSOCMODE 50 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_WMM 51 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_HB_CHALLENGE_RESP_PARAMS 52 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_GET_HB_CHALLENGE_RESP 53 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_GET_RD 54 */ -(0xFF), /* AR6000_XIOCTL_DIAG_READ 55 */ -(0xFF), /* AR6000_XIOCTL_DIAG_WRITE 56 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_TXOP 57 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK), /* AR6000_XIOCTL_USER_SETKEYS 58 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK), /* AR6000_XIOCTL_WMI_SET_KEEPALIVE 59 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK), /* AR6000_XIOCTL_WMI_GET_KEEPALIVE 60 */ -(0xFF), /* AR6000_XIOCTL_BMI_ROMPATCH_INSTALL 61 */ -(0xFF), /* AR6000_XIOCTL_BMI_ROMPATCH_UNINSTALL 62 */ -(0xFF), /* AR6000_XIOCTL_BMI_ROMPATCH_ACTIVATE 63 */ -(0xFF), /* AR6000_XIOCTL_BMI_ROMPATCH_DEACTIVATE 64 */ -(0xFF), /* AR6000_XIOCTL_WMI_SET_APPIE 65 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | 0x1F), /* AR6000_XIOCTL_WMI_SET_MGMT_FRM_RX_FILTER 66 */ -(0xFF), /* AR6000_XIOCTL_DBGLOG_CFG_MODULE 67 */ -(0xFF), /* AR6000_XIOCTL_DBGLOG_GET_DEBUG_LOGS 68 */ -(0xFF), /* Dummy 69 */ -(0xFF), /* AR6000_XIOCTL_WMI_SET_WSC_STATUS 70 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_BT_STATUS 71 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_BT_PARAMS 72 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_HOST_SLEEP_MODE 73 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_WOW_MODE 74 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_GET_WOW_LIST 75 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_ADD_WOW_PATTERN 76 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_DEL_WOW_PATTERN 77 */ -(0xFF), /* AR6000_XIOCTL_TARGET_INFO 78 */ -(0xFF), /* AR6000_XIOCTL_DUMP_HTC_CREDIT_STATE 79 */ -(0xFF), /* AR6000_XIOCTL_TRAFFIC_ACTIVITY_CHANGE 80 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_CONNECT_CTRL_FLAGS 81 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_AKMP_PARAMS 82 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_GET_PMKID_LIST 83 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_PMKID_LIST 84 */ -(0xFF), /* Dummy 85 */ -(0xFF), /* Dummy 86 */ -(0xFF), /* Dummy 87 */ -(0xFF), /* Dummy 88 */ -(0xFF), /* Dummy 89 */ -(0xFF), /* AR6000_XIOCTL_UNUSED90 90 */ -(0xFF), /* AR6000_XIOCTL_BMI_LZ_STREAM_START 91 */ -(0xFF), /* AR6000_XIOCTL_BMI_LZ_DATA 92 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_PROF_CFG 93 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_PROF_ADDR_SET 94 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_PROF_START 95 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_PROF_STOP 96 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_PROF_COUNT_GET 97 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_ABORT_SCAN 98 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_GET_STA_LIST 99 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | AP_NETWORK), /* AR6000_XIOCTL_AP_HIDDEN_SSID 100 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_SET_NUM_STA 101 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_SET_ACL_MAC 102 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_GET_ACL_LIST 103 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_COMMIT_CONFIG 104 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* IEEE80211_IOCTL_GETWPAIE 105 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_CONN_INACT_TIME 106 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_PROT_SCAN_TIME 107 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_COUNTRY 108 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_SET_DTIM 109 */ -(0xFF), /* AR6000_XIOCTL_WMI_TARGET_EVENT_REPORT 110 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_SET_IP 111 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_SET_ACL_POLICY 112 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_CTRL_BSS_COMM 113 */ -(0xFF), /* AR6000_XIOCTL_DUMP_MODULE_DEBUG_INFO 114 */ -(0xFF), /* AR6000_XIOCTL_MODULE_DEBUG_SET_MASK 115 */ -(0xFF), /* AR6000_XIOCTL_MODULE_DEBUG_GET_MASK 116 */ -(0xFF), /* AR6000_XIOCTL_DUMP_RCV_AGGR_STATS 117 */ -(0xFF), /* AR6000_XIOCTL_SET_HT_CAP 118 */ -(0xFF), /* AR6000_XIOCTL_SET_HT_OP 119 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_GET_STAT 120 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | 0x1F), /* AR6000_XIOCTL_SET_TX_SELECT_RATES 121 */ -(0xFF), /* AR6000_XIOCTL_SETUP_AGGR 122 */ -(0xFF), /* AR6000_XIOCTL_ALLOW_AGGR 123 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | AP_NETWORK), /* AR6000_XIOCTL_AP_GET_HIDDEN_SSID 124 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_GET_COUNTRY 125 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_GET_WMODE 126 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_GET_DTIM 127 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_AP_GET_BINTVL 128 */ -(0xFF), /* AR6000_XIOCTL_AP_GET_RTS 129 */ -(0xFF), /* AR6000_XIOCTL_DELE_AGGR 130 */ -(0xFF), /* AR6000_XIOCTL_FETCH_TARGET_REGS 131 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | 0x1F), /* AR6000_XIOCTL_HCI_CMD 132 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | 0x1F), /* AR6000_XIOCTL_ACL_DATA 133 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | 0x1F), /* AR6000_XIOCTL_WLAN_CONN_PRECEDENCE 134 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | AP_NETWORK), /* AR6000_XIOCTL_AP_SET_11BG_RATESET 135 */ -(0xFF), -(0xFF), -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_BTCOEX_FE_ANT 138 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_BTCOEX_COLOCATED_BT_DEV 139 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG 140 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_BTCOEX_SCO_CONFIG 141 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_BTCOEX_A2DP_CONFIG 142 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_BTCOEX_ACLCOEX_CONFIG 143 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_BTCOEX_DEBUG 144 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_SET_BT_OPERATING_STATUS 145 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_GET_BTCOEX_CONFIG 146 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_GET_BTCOEX_GET_STATS 147 */ -(0xFF), /* AR6000_XIOCTL_WMI_SET_QOS_SUPP 148 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_SET_DFS 149 */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* P2P CMDS BEGIN AR6000_XIOCTL_WMI_P2P_DISCOVER 150 */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_STOP_FIND */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_CANCEL */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_LISTEN */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_GO_NEG */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_AUTH_GO_NEG */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_REJECT */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_CONFIG */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_WPS_CONFIG */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_FINDNODE */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_GRP_INIT 160 */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_GRP_FORMATION_DONE */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_INVITE */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_PROV_DISC */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_SET */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_PEER */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_FLUSH */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_GET_GO_PARAMS */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_AUTH_INVITE */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_GET_IF_ADDR */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_GET_DEV_ADDR 170 */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_P2P_SDPD_TX_CMD */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOTCL_WMI_P2P_SD_CANCEL_REQUEST */ -(0xFF), /* AR6000_XIOCTL_SET_BT_HW_POWER_STATE 173 */ -(0xFF), /* AR6000_XIOCTL_GET_BT_HW_POWER_STATE 174 */ -(0xFF), /* AR6000_XIOCTL_GET_WLAN_SLEEP_STATE 175 */ -(0xFF), /* AR6000_XIOCTL_WMI_SET_TX_SGI_PARAM 176 */ -(0xFF), /* R6000_XIOCTL_WMI_ENABLE_WAC_PARAM 177 */ -(0xFF), /* AR6000_XIOCTL_WAC_SCAN_REPLY 178 */ -(0xFF), /* AR6000_XIOCTL_WMI_WAC_CTRL_REQ 179 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_WPA_OFFLOAD_STATE 180 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_PASSPHRASE 181 */ -(0xFF), /* AR6000_XIOCTL_BMI_NVRAM_PROCESS 182 */ -(0xFF), /* AR6000_XIOCTL_WMI_SET_DIVERSITY_PARAM 183 */ -(0xFF), /* AR6000_XIOCTL_WMI_FORCE_ASSERT 184 */ -(0xFF), /* AR6000_XIOCTL_WMI_ENABLE_PKTLOG 185 */ -(0xFF), /* AR6000_XIOCTL_WMI_DISABLE_PKTLOG 186 */ -(0xFF), /* AR6000_XIOCTL_WMI_GET_PKTLOG 187 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | AP_NETWORK), /* AR6000_XIOCTL_AP_ACS_DISABLE_HI_CHANNELS 188 */ -(0xFF), /* AR6000_XIOCTL_TCMD_CMDS 189 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_EXCESS_TX_RETRY_THRES 190 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_AP_GET_NUM_STA 191 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | 0x1F), /* AR6000_XIOCTL_SUSPEND_DRIVER 192 */ -(XIOCTL_FILTER_NONP2P_SUBMODE | 0x1F), /* AR6000_XIOCTL_RESUME_DRIVER 193 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_GET_SUBMODE 194 */ -(XIOCTL_FILTER_SUBMODE_DONTCARE | AP_NETWORK), /* AR6000_XIOCTL_WMI_AP_APSD 195 */ -(0xFF), /* AR6000_XIOCTL_TCMD_SETREG 196 */ -(0xFF), /* AR6000_XIOCTL_GET_HT_CAP 197 */ -(XIOCTL_FILTER_P2P_SUBMODE | INFRA_NETWORK | AP_NETWORK), /* AR6000_XIOCTL_WMI_GET_P2P_IE 198 */ -}; - -#endif /*_WMI_FILTER_LINUX_H_*/ diff --git a/drivers/net/wireless/ar6003/host/os/linux/ioctl.c b/drivers/net/wireless/ar6003/host/os/linux/ioctl.c deleted file mode 100644 index f507446d938e..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/ioctl.c +++ /dev/null @@ -1,5611 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -#include "ar6000_drv.h" -#include "a_drv_api.h" -#include "ieee80211_ioctl.h" -#include "ar6kap_common.h" -#include "targaddrs.h" -#include "a_hci.h" -#include "wlan_config.h" -#include "wac_defs.h" -#ifdef P2P -#include "p2p_api.h" -#endif /* P2P */ - -extern int enablerssicompensation; -A_UINT32 tcmdRxFreq; -extern unsigned int wmitimeout; -extern int tspecCompliance; -extern int bmienable; -extern int bypasswmi; -extern int loghci; - -static int -ar6000_ioctl_get_roam_tbl(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if(wmi_get_roam_tbl_cmd(arPriv->arWmi) != A_OK) { - return -EIO; - } - - return 0; -} - -static int -ar6000_ioctl_get_roam_data(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - /* currently assume only roam times are required */ - if(wmi_get_roam_data_cmd(arPriv->arWmi, ROAM_DATA_TIME) != A_OK) { - return -EIO; - } - - - return 0; -} - -static int -ar6000_ioctl_set_roam_ctrl(struct net_device *dev, char *userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_ROAM_CTRL_CMD cmd; - A_UINT8 size = sizeof(cmd); - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, userdata, size)) { - return -EFAULT; - } - - if (cmd.roamCtrlType == WMI_SET_HOST_BIAS) { - if (cmd.info.bssBiasInfo.numBss > 1) { - size += (cmd.info.bssBiasInfo.numBss - 1) * sizeof(WMI_BSS_BIAS); - } - } - - if (copy_from_user(&cmd, userdata, size)) { - return -EFAULT; - } - - if(wmi_set_roam_ctrl_cmd(arPriv->arWmi, &cmd, size) != A_OK) { - return -EIO; - } - - return 0; -} - -static int -ar6000_ioctl_set_powersave_timers(struct net_device *dev, char *userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_POWERSAVE_TIMERS_POLICY_CMD cmd; - A_UINT8 size = sizeof(cmd); - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (copy_from_user(&cmd, userdata, size)) { - return -EFAULT; - } - - if (copy_from_user(&cmd, userdata, size)) { - return -EFAULT; - } - - if(wmi_set_powersave_timers_cmd(arPriv->arWmi, &cmd, size) != A_OK) { - return -EIO; - } - - return 0; -} - -static int -ar6000_ioctl_set_qos_supp(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_QOS_SUPP_CMD cmd; - A_STATUS ret; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (copy_from_user(&cmd, (char *)((unsigned int*)rq->ifr_data + 1), - sizeof(cmd))) - { - return -EFAULT; - } - - ret = wmi_set_qos_supp_cmd(arPriv->arWmi, cmd.status); - - switch (ret) { - case A_OK: - return 0; - case A_EBUSY : - return -EBUSY; - case A_NO_MEMORY: - return -ENOMEM; - case A_EINVAL: - default: - return -EFAULT; - } -} - -static int -ar6000_ioctl_set_wmm(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_WMM_CMD cmd; - A_STATUS ret; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (copy_from_user(&cmd, (char *)((unsigned int*)rq->ifr_data + 1), - sizeof(cmd))) - { - return -EFAULT; - } - - if (cmd.status == WMI_WMM_ENABLED) { - arPriv->arWmmEnabled = TRUE; - } else { - arPriv->arWmmEnabled = FALSE; - } - - ret = wmi_set_wmm_cmd(arPriv->arWmi, cmd.status); - - switch (ret) { - case A_OK: - return 0; - case A_EBUSY : - return -EBUSY; - case A_NO_MEMORY: - return -ENOMEM; - case A_EINVAL: - default: - return -EFAULT; - } -} - -static int -ar6000_ioctl_set_txop(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_WMM_TXOP_CMD cmd; - A_STATUS ret; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (copy_from_user(&cmd, (char *)((unsigned int*)rq->ifr_data + 1), - sizeof(cmd))) - { - return -EFAULT; - } - - ret = wmi_set_wmm_txop(arPriv->arWmi, cmd.txopEnable); - - switch (ret) { - case A_OK: - return 0; - case A_EBUSY : - return -EBUSY; - case A_NO_MEMORY: - return -ENOMEM; - case A_EINVAL: - default: - return -EFAULT; - } -} - -static int -ar6000_ioctl_get_rd(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - A_STATUS ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if(copy_to_user((char *)((unsigned int*)rq->ifr_data + 1), - &arPriv->arRegCode, sizeof(arPriv->arRegCode))) - ret = -EFAULT; - - return ret; -} - -static int -ar6000_ioctl_set_country(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_AP_SET_COUNTRY_CMD cmd; - A_STATUS ret; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (copy_from_user(&cmd, (char *)((unsigned int*)rq->ifr_data + 1), - sizeof(cmd))) - { - return -EFAULT; - } - - arPriv->ap_profile_flag = 1; /* There is a change in profile */ - - ret = wmi_set_country(arPriv->arWmi, cmd.countryCode); - A_MEMCPY(arPriv->arAp.ap_country_code, cmd.countryCode, 3); - - switch (ret) { - case A_OK: - return 0; - case A_EBUSY : - return -EBUSY; - case A_NO_MEMORY: - return -ENOMEM; - case A_EINVAL: - default: - return -EFAULT; - } -} - - -/* Get power mode command */ -static int -ar6000_ioctl_get_power_mode(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_POWER_MODE_CMD power_mode; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - power_mode.powerMode = wmi_get_power_mode_cmd(arPriv->arWmi); - if (copy_to_user(rq->ifr_data, &power_mode, sizeof(WMI_POWER_MODE_CMD))) { - ret = -EFAULT; - } - - return ret; -} - - -static int -ar6000_ioctl_set_channelParams(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_CHANNEL_PARAMS_CMD cmd, *cmdp; - int ret = 0; - int i = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_DEV_T *arTempPriv = NULL; - - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) { - return -EFAULT; - } - - if( (arPriv->arNextMode == AP_NETWORK) && (cmd.numChannels || cmd.scanParam) ) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ERROR: Only wmode is allowed in AP mode\n")); - return -EIO; - } - - if (cmd.numChannels > 1) { - cmdp = A_MALLOC(130); - if (copy_from_user(cmdp, rq->ifr_data, - sizeof (*cmdp) + - ((cmd.numChannels - 1) * sizeof(A_UINT16)))) - { - A_FREE(cmdp); - return -EFAULT; - } - } else { - cmdp = &cmd; - } - - if ((arPriv->arPhyCapability == WMI_11NG_CAPABILITY) && - ((cmdp->phyMode == WMI_11A_MODE) || (cmdp->phyMode == WMI_11AG_MODE))) - { - ret = -EINVAL; - } - - for(i = 0;i < ar->arConfNumDev;i++){ - arTempPriv = ar->arDev[i]; - if (arTempPriv != arPriv){ - if (((arTempPriv->phymode == WMI_11A_MODE) && (cmdp->phyMode != WMI_11A_MODE)) || (((arTempPriv->phymode != WMI_11A_MODE) && arTempPriv->phymode != WMI_11AG_MODE ) && (cmdp->phyMode == WMI_11A_MODE))){ - ret = -EINVAL; - break; - } - } - - } - if (!ret && - (wmi_set_channelParams_cmd(arPriv->arWmi, cmdp->scanParam, cmdp->phyMode, - cmdp->numChannels, cmdp->channelList) - != A_OK)) - { - ret = -EIO; - } - - if (!ret) - arPriv->phymode = cmdp->phyMode; - - if (cmd.numChannels > 1) { - A_FREE(cmdp); - } - - /* Set the profile change flag to allow a commit cmd */ - if (!ret) - arPriv->ap_profile_flag = 1; - - return ret; -} - - -static int -ar6000_ioctl_set_snr_threshold(struct net_device *dev, struct ifreq *rq) -{ - - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SNR_THRESHOLD_PARAMS_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) { - return -EFAULT; - } - - if( wmi_set_snr_threshold_params(arPriv->arWmi, &cmd) != A_OK ) { - ret = -EIO; - } - - return ret; -} - -static int -ar6000_ioctl_set_rssi_threshold(struct net_device *dev, struct ifreq *rq) -{ -#define SWAP_THOLD(thold1, thold2) do { \ - USER_RSSI_THOLD tmpThold; \ - tmpThold.tag = thold1.tag; \ - tmpThold.rssi = thold1.rssi; \ - thold1.tag = thold2.tag; \ - thold1.rssi = thold2.rssi; \ - thold2.tag = tmpThold.tag; \ - thold2.rssi = tmpThold.rssi; \ -} while (0) - - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - AR_SOFTC_T *ar = arPriv->arSoftc; - WMI_RSSI_THRESHOLD_PARAMS_CMD cmd; - USER_RSSI_PARAMS rssiParams; - A_INT32 i, j; - int ret = 0; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user((char *)&rssiParams, (char *)((unsigned int *)rq->ifr_data + 1), sizeof(USER_RSSI_PARAMS))) { - return -EFAULT; - } - cmd.weight = rssiParams.weight; - cmd.pollTime = rssiParams.pollTime; - - A_MEMCPY(arSta->rssi_map, &rssiParams.tholds, sizeof(arSta->rssi_map)); - /* - * only 6 elements, so use bubble sorting, in ascending order - */ - for (i = 5; i > 0; i--) { - for (j = 0; j < i; j++) { /* above tholds */ - if (arSta->rssi_map[j+1].rssi < arSta->rssi_map[j].rssi) { - SWAP_THOLD(arSta->rssi_map[j+1], arSta->rssi_map[j]); - } else if (arSta->rssi_map[j+1].rssi == arSta->rssi_map[j].rssi) { - return EFAULT; - } - } - } - for (i = 11; i > 6; i--) { - for (j = 6; j < i; j++) { /* below tholds */ - if (arSta->rssi_map[j+1].rssi < arSta->rssi_map[j].rssi) { - SWAP_THOLD(arSta->rssi_map[j+1], arSta->rssi_map[j]); - } else if (arSta->rssi_map[j+1].rssi == arSta->rssi_map[j].rssi) { - return EFAULT; - } - } - } - -#ifdef DEBUG - for (i = 0; i < 12; i++) { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("thold[%d].tag: %d, thold[%d].rssi: %d \n", - i, arSta->rssi_map[i].tag, i, arSta->rssi_map[i].rssi)); - } -#endif - - if (enablerssicompensation) { - for (i = 0; i < 6; i++) - arSta->rssi_map[i].rssi = rssi_compensation_reverse_calc(arPriv, arSta->rssi_map[i].rssi, TRUE); - for (i = 6; i < 12; i++) - arSta->rssi_map[i].rssi = rssi_compensation_reverse_calc(arPriv, arSta->rssi_map[i].rssi, FALSE); - } - - cmd.thresholdAbove1_Val = arSta->rssi_map[0].rssi; - cmd.thresholdAbove2_Val = arSta->rssi_map[1].rssi; - cmd.thresholdAbove3_Val = arSta->rssi_map[2].rssi; - cmd.thresholdAbove4_Val = arSta->rssi_map[3].rssi; - cmd.thresholdAbove5_Val = arSta->rssi_map[4].rssi; - cmd.thresholdAbove6_Val = arSta->rssi_map[5].rssi; - cmd.thresholdBelow1_Val = arSta->rssi_map[6].rssi; - cmd.thresholdBelow2_Val = arSta->rssi_map[7].rssi; - cmd.thresholdBelow3_Val = arSta->rssi_map[8].rssi; - cmd.thresholdBelow4_Val = arSta->rssi_map[9].rssi; - cmd.thresholdBelow5_Val = arSta->rssi_map[10].rssi; - cmd.thresholdBelow6_Val = arSta->rssi_map[11].rssi; - - if( wmi_set_rssi_threshold_params(arPriv->arWmi, &cmd) != A_OK ) { - ret = -EIO; - } - - return ret; -} - -static int -ar6000_ioctl_set_lq_threshold(struct net_device *dev, struct ifreq *rq) -{ - - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_LQ_THRESHOLD_PARAMS_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, (char *)((unsigned int *)rq->ifr_data + 1), sizeof(cmd))) { - return -EFAULT; - } - - if( wmi_set_lq_threshold_params(arPriv->arWmi, &cmd) != A_OK ) { - ret = -EIO; - } - - return ret; -} - - -static int -ar6000_ioctl_set_probedSsid(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_PROBED_SSID_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_probedSsid_cmd(arPriv->arWmi, cmd.entryIndex, cmd.flag, cmd.ssidLength, - cmd.ssid) != A_OK) - { - ret = -EIO; - } - - return ret; -} - -static int -ar6000_ioctl_set_badAp(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_ADD_BAD_AP_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) { - return -EFAULT; - } - - if (cmd.badApIndex > WMI_MAX_BAD_AP_INDEX) { - return -EIO; - } - - if (A_MEMCMP(cmd.bssid, null_mac, AR6000_ETH_ADDR_LEN) == 0) { - /* - * This is a delete badAP. - */ - if (wmi_deleteBadAp_cmd(arPriv->arWmi, cmd.badApIndex) != A_OK) { - ret = -EIO; - } - } else { - if (wmi_addBadAp_cmd(arPriv->arWmi, cmd.badApIndex, cmd.bssid) != A_OK) { - ret = -EIO; - } - } - - return ret; -} - -static int -ar6000_ioctl_create_qos(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_CREATE_PSTREAM_CMD cmd; - A_STATUS ret; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - - if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) { - return -EFAULT; - } - - ret = wmi_verify_tspec_params(&cmd, tspecCompliance); - if (ret == A_OK) - ret = wmi_create_pstream_cmd(arPriv->arWmi, &cmd); - - switch (ret) { - case A_OK: - return 0; - case A_EBUSY : - return -EBUSY; - case A_NO_MEMORY: - return -ENOMEM; - case A_EINVAL: - default: - return -EFAULT; - } -} - -static int -ar6000_ioctl_delete_qos(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_DELETE_PSTREAM_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) { - return -EFAULT; - } - - ret = wmi_delete_pstream_cmd(arPriv->arWmi, cmd.trafficClass, cmd.tsid); - - switch (ret) { - case A_OK: - return 0; - case A_EBUSY : - return -EBUSY; - case A_NO_MEMORY: - return -ENOMEM; - case A_EINVAL: - default: - return -EFAULT; - } -} - -static int -ar6000_ioctl_get_qos_queue(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - struct ar6000_queuereq qreq; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if( copy_from_user(&qreq, rq->ifr_data, - sizeof(struct ar6000_queuereq))) - return -EFAULT; - - qreq.activeTsids = wmi_get_mapped_qos_queue(arPriv->arWmi, qreq.trafficClass); - - if (copy_to_user(rq->ifr_data, &qreq, - sizeof(struct ar6000_queuereq))) - { - ret = -EFAULT; - } - - return ret; -} - -#ifdef CONFIG_HOST_TCMD_SUPPORT -static A_STATUS -ar6000_ioctl_tcmd_cmd_resp(struct net_device *dev, struct ifreq *rq, A_UINT8 *data, A_UINT32 len) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - A_UINT8 buf[4+TC_CMDS_SIZE_MAX]; - int ret = 0; - - if (ar->bIsDestroyProgress) { - return -EBUSY; - } - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (down_interruptible(&ar->arSem)) { - return -ERESTARTSYS; - } - - if (ar->bIsDestroyProgress) { - up(&ar->arSem); - return -EBUSY; - } - - ar->tcmdRxReport = 0; - if (wmi_test_cmd(arPriv->arWmi, data, len) != A_OK) { - up(&ar->arSem); - return -EIO; - } - - wait_event_interruptible_timeout(arPriv->arEvent, ar->tcmdRxReport != 0, wmitimeout * HZ); - - if (signal_pending(current)) { - ret = -EINTR; - } - - *(A_UINT16*)&(buf[0]) = ar->tcmdResp.len; - buf[2] = ar->tcmdResp.ver; - A_MEMCPY((buf+4), ar->tcmdResp.buf, sizeof(ar->tcmdResp.buf)); - - if (!ret && copy_to_user(rq->ifr_data, buf, sizeof(buf))) { - ret = -EFAULT; - } - - up(&ar->arSem); - - return ret; -} - -static A_STATUS -ar6000_ioctl_tcmd_get_rx_report(struct net_device *dev, - struct ifreq *rq, A_UINT8 *data, A_UINT32 len) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - A_UINT32 buf[4+TCMD_MAX_RATES]; - int ret = 0; - - if (ar->bIsDestroyProgress) { - return -EBUSY; - } - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (down_interruptible(&ar->arSem)) { - return -ERESTARTSYS; - } - - if (ar->bIsDestroyProgress) { - up(&ar->arSem); - return -EBUSY; - } - - ar->tcmdRxReport = 0; - if (wmi_test_cmd(arPriv->arWmi, data, len) != A_OK) { - up(&ar->arSem); - return -EIO; - } - - wait_event_interruptible_timeout(arPriv->arEvent, ar->tcmdRxReport != 0, wmitimeout * HZ); - - if (signal_pending(current)) { - ret = -EINTR; - } - - buf[0] = ar->tcmdRxTotalPkt; - buf[1] = ar->tcmdRxRssi; - buf[2] = ar->tcmdRxcrcErrPkt; - buf[3] = ar->tcmdRxsecErrPkt; - A_MEMCPY(((A_UCHAR *)buf)+(4*sizeof(A_UINT32)), ar->tcmdRateCnt, sizeof(ar->tcmdRateCnt)); - A_MEMCPY(((A_UCHAR *)buf)+(4*sizeof(A_UINT32))+(TCMD_MAX_RATES *sizeof(A_UINT16)), ar->tcmdRateCntShortGuard, sizeof(ar->tcmdRateCntShortGuard)); - - if (!ret && copy_to_user(rq->ifr_data, buf, sizeof(buf))) { - ret = -EFAULT; - } - - up(&ar->arSem); - - return ret; -} - -void -ar6000_tcmd_rx_report_event(AR_SOFTC_DEV_T *arPriv, A_UINT8 * results, int len) -{ - - AR_SOFTC_T *ar = arPriv->arSoftc; - TCMD_CONT_RX * rx_rep = (TCMD_CONT_RX *)results; - - if (TC_CMD_RESP == rx_rep->act) { - TC_CMDS *tCmd = (TC_CMDS *)results; - ar->tcmdResp.len = tCmd->hdr.u.parm.length; - ar->tcmdResp.ver = tCmd->hdr.u.parm.version; - A_MEMZERO(ar->tcmdResp.buf, sizeof(ar->tcmdResp.buf)); - A_MEMCPY(ar->tcmdResp.buf, tCmd->buf, sizeof(ar->tcmdResp.buf)); - ar->tcmdRxReport = 1; - } - else { /*(rx_rep->act == TCMD_CONT_RX_REPORT) */ - if (enablerssicompensation) { - rx_rep->u.report.rssiInDBm = rssi_compensation_calc_tcmd(ar, tcmdRxFreq, rx_rep->u.report.rssiInDBm,rx_rep->u.report.totalPkt); - } - - - ar->tcmdRxTotalPkt = rx_rep->u.report.totalPkt; - ar->tcmdRxRssi = rx_rep->u.report.rssiInDBm; - ar->tcmdRxcrcErrPkt = rx_rep->u.report.crcErrPkt; - ar->tcmdRxsecErrPkt = rx_rep->u.report.secErrPkt; - ar->tcmdRxReport = 1; - A_MEMZERO(ar->tcmdRateCnt, sizeof(ar->tcmdRateCnt)); - A_MEMZERO(ar->tcmdRateCntShortGuard, sizeof(ar->tcmdRateCntShortGuard)); - A_MEMCPY(ar->tcmdRateCnt, rx_rep->u.report.rateCnt, sizeof(ar->tcmdRateCnt)); - A_MEMCPY(ar->tcmdRateCntShortGuard, rx_rep->u.report.rateCntShortGuard, sizeof(ar->tcmdRateCntShortGuard)); - } - - wake_up(&arPriv->arEvent); -} -#endif /* CONFIG_HOST_TCMD_SUPPORT*/ - -static int -ar6000_ioctl_set_error_report_bitmask(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_TARGET_ERROR_REPORT_BITMASK cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) { - return -EFAULT; - } - - ret = wmi_set_error_report_bitmask(arPriv->arWmi, cmd.bitmask); - - return (ret==0 ? ret : -EINVAL); -} - -static int -ar6000_clear_target_stats(struct net_device *dev) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - TARGET_STATS *pStats = &arPriv->arTargetStats; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - AR6000_SPIN_LOCK(&arPriv->arPrivLock, 0); - A_MEMZERO(pStats, sizeof(TARGET_STATS)); - AR6000_SPIN_UNLOCK(&arPriv->arPrivLock, 0); - return ret; -} - -static int -ar6000_ioctl_get_target_stats(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - TARGET_STATS_CMD cmd; - TARGET_STATS *pStats = &arPriv->arTargetStats; - int ret = 0; - - if (ar->bIsDestroyProgress) { - return -EBUSY; - } - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) { - return -EFAULT; - } - if (down_interruptible(&ar->arSem)) { - return -ERESTARTSYS; - } - if (ar->bIsDestroyProgress) { - up(&ar->arSem); - return -EBUSY; - } - - arPriv->statsUpdatePending = TRUE; - - if(wmi_get_stats_cmd(arPriv->arWmi) != A_OK) { - up(&ar->arSem); - return -EIO; - } - - wait_event_interruptible_timeout(arPriv->arEvent, arPriv->statsUpdatePending == FALSE, wmitimeout * HZ); - - if (signal_pending(current)) { - ret = -EINTR; - } - - if (!ret && copy_to_user(rq->ifr_data, pStats, sizeof(*pStats))) { - ret = -EFAULT; - } - - if (cmd.clearStats == 1) { - ret = ar6000_clear_target_stats(dev); - } - - up(&ar->arSem); - - a_meminfo_report(FALSE); - - return ret; -} - -static int -ar6000_ioctl_get_ap_stats(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - A_UINT32 action; /* Allocating only the desired space on the frame. Declaring is as a WMI_AP_MODE_STAT variable results in exceeding the compiler imposed limit on the maximum frame size */ - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - WMI_PER_STA_STAT *pStats = ar->arAPStats; - WMI_AP_MODE_STAT ret_stat; - A_UINT8 i, j=0; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (copy_from_user(&action, (char *)((unsigned int*)rq->ifr_data + 1), - sizeof(A_UINT32))) - { - return -EFAULT; - } - if (action == AP_CLEAR_STATS) { - AR6000_SPIN_LOCK(&ar->arLock, 0); - for(i = 0; i < NUM_CONN; i++) { - if(ar->connTbl[i].arPriv == arPriv) { - pStats[i].tx_bytes = 0; - pStats[i].tx_pkts = 0; - pStats[i].tx_error = 0; - pStats[i].tx_discard = 0; - pStats[i].rx_bytes = 0; - pStats[i].rx_pkts = 0; - pStats[i].rx_error = 0; - pStats[i].rx_discard = 0; - } - } - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - return ret; - } - - if (down_interruptible(&ar->arSem)) { - return -ERESTARTSYS; - } - - arPriv->statsUpdatePending = TRUE; - - if(wmi_get_stats_cmd(arPriv->arWmi) != A_OK) { - up(&ar->arSem); - return -EIO; - } - - wait_event_interruptible_timeout(arPriv->arEvent, arPriv->statsUpdatePending == FALSE, wmitimeout * HZ); - - if (signal_pending(current)) { - ret = -EINTR; - } - - A_MEMZERO(&ret_stat, sizeof(ret_stat)); - for(i = 0; i < NUM_CONN; i++) { - if(ar->connTbl[i].arPriv == arPriv) { - ret_stat.sta[j].aid = pStats[i].aid; - ret_stat.sta[j].tx_bytes = pStats[i].tx_bytes; - ret_stat.sta[j].tx_pkts = pStats[i].tx_pkts; - ret_stat.sta[j].tx_error = pStats[i].tx_error; - ret_stat.sta[j].tx_discard = pStats[i].tx_discard; - ret_stat.sta[j].rx_bytes = pStats[i].rx_bytes; - ret_stat.sta[j].rx_pkts = pStats[i].rx_pkts; - ret_stat.sta[j].rx_error = pStats[i].rx_error; - ret_stat.sta[j].rx_discard = pStats[i].rx_discard; - j++; - } - } - - if (!ret && copy_to_user(rq->ifr_data, &ret_stat, sizeof(ret_stat))) { - ret = -EFAULT; - } - - up(&ar->arSem); - - return ret; -} - -static int -ar6000_ioctl_set_access_params(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_ACCESS_PARAMS_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_access_params_cmd(arPriv->arWmi, cmd.ac, cmd.txop, cmd.eCWmin, cmd.eCWmax, - cmd.aifsn) == A_OK) - { - ret = 0; - } else { - ret = -EINVAL; - } - - return (ret); -} - -static int -ar6000_ioctl_set_disconnect_timeout(struct net_device *dev, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_DISC_TIMEOUT_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, rq->ifr_data, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_disctimeout_cmd(arPriv->arWmi, cmd.disconnectTimeout) == A_OK) - { - ret = 0; - } else { - ret = -EINVAL; - } - - return (ret); -} - -static int -ar6000_xioctl_set_voice_pkt_size(struct net_device *dev, char * userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_VOICE_PKT_SIZE_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_voice_pkt_size_cmd(arPriv->arWmi, cmd.voicePktSize) == A_OK) - { - ret = 0; - } else { - ret = -EINVAL; - } - - - return (ret); -} - -static int -ar6000_xioctl_set_max_sp_len(struct net_device *dev, char * userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_MAX_SP_LEN_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_max_sp_len_cmd(arPriv->arWmi, cmd.maxSPLen) == A_OK) - { - ret = 0; - } else { - ret = -EINVAL; - } - - return (ret); -} - - -static int -ar6000_xioctl_set_bt_status_cmd(struct net_device *dev, char * userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_BT_STATUS_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_bt_status_cmd(arPriv->arWmi, cmd.streamType, cmd.status) == A_OK) - { - ret = 0; - } else { - ret = -EINVAL; - } - - return (ret); -} - -static int -ar6000_xioctl_set_bt_params_cmd(struct net_device *dev, char * userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_BT_PARAMS_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_bt_params_cmd(arPriv->arWmi, &cmd) == A_OK) - { - ret = 0; - } else { - ret = -EINVAL; - } - - return (ret); -} - -static int -ar6000_xioctl_set_btcoex_fe_ant_cmd(struct net_device * dev, char * userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_BTCOEX_FE_ANT_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_btcoex_fe_ant_cmd(arPriv->arWmi, &cmd) == A_OK) - { - ret = 0; - } else { - ret = -EINVAL; - } - - return(ret); -} - -static int -ar6000_xioctl_set_btcoex_colocated_bt_dev_cmd(struct net_device * dev, char * userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_btcoex_colocated_bt_dev_cmd(arPriv->arWmi, &cmd) == A_OK) - { - ret = 0; - } else { - ret = -EINVAL; - } - - return(ret); -} - -static int -ar6000_xioctl_set_btcoex_btinquiry_page_config_cmd(struct net_device * dev, char * userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_btcoex_btinquiry_page_config_cmd(arPriv->arWmi, &cmd) == A_OK) - { - ret = 0; - } else { - ret = -EINVAL; - } - - return(ret); -} - -static int -ar6000_xioctl_set_btcoex_sco_config_cmd(struct net_device * dev, char * userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_BTCOEX_SCO_CONFIG_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_btcoex_sco_config_cmd(arPriv->arWmi, &cmd) == A_OK) - { - ret = 0; - } else { - ret = -EINVAL; - } - - return(ret); -} - -static int -ar6000_xioctl_set_btcoex_a2dp_config_cmd(struct net_device * dev, - char * userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_BTCOEX_A2DP_CONFIG_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_btcoex_a2dp_config_cmd(arPriv->arWmi, &cmd) == A_OK) - { - ret = 0; - } else { - ret = -EINVAL; - } - - return(ret); -} - -static int -ar6000_xioctl_set_btcoex_aclcoex_config_cmd(struct net_device * dev, char * userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_btcoex_aclcoex_config_cmd(arPriv->arWmi, &cmd) == A_OK) - { - ret = 0; - } else { - ret = -EINVAL; - } - - return(ret); -} - -static int -ar60000_xioctl_set_btcoex_debug_cmd(struct net_device * dev, char * userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_BTCOEX_DEBUG_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_btcoex_debug_cmd(arPriv->arWmi, &cmd) == A_OK) - { - ret = 0; - } else { - ret = -EINVAL; - } - - return(ret); -} - -static int -ar6000_xioctl_set_btcoex_bt_operating_status_cmd(struct net_device * dev, char * userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD cmd; - int ret = 0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - - if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_btcoex_bt_operating_status_cmd(arPriv->arWmi, &cmd) == A_OK) - { - ret = 0; - } else { - ret = -EINVAL; - } - return(ret); -} - -static int -ar6000_xioctl_get_btcoex_config_cmd(struct net_device * dev, char * userdata, - struct ifreq *rq) -{ - - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - AR6000_BTCOEX_CONFIG btcoexConfig; - WMI_BTCOEX_CONFIG_EVENT *pbtcoexConfigEv = &arPriv->arBtcoexConfig; - - int ret = 0; - - if (ar->bIsDestroyProgress) { - return -EBUSY; - } - if (ar->arWmiReady == FALSE) { - return -EIO; - } - if (copy_from_user(&btcoexConfig.configCmd, userdata, sizeof(AR6000_BTCOEX_CONFIG))) { - return -EFAULT; - } - if (down_interruptible(&ar->arSem)) { - return -ERESTARTSYS; - } - - if (wmi_get_btcoex_config_cmd(arPriv->arWmi, (WMI_GET_BTCOEX_CONFIG_CMD *)&btcoexConfig.configCmd) != A_OK) - { - up(&ar->arSem); - return -EIO; - } - - arPriv->statsUpdatePending = TRUE; - - wait_event_interruptible_timeout(arPriv->arEvent, arPriv->statsUpdatePending == FALSE, wmitimeout * HZ); - - if (signal_pending(current)) { - ret = -EINTR; - } - - if (!ret && copy_to_user(btcoexConfig.configEvent, pbtcoexConfigEv, sizeof(WMI_BTCOEX_CONFIG_EVENT))) { - ret = -EFAULT; - } - up(&ar->arSem); - return ret; -} - -static int -ar6000_xioctl_get_btcoex_stats_cmd(struct net_device * dev, char * userdata, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - AR6000_BTCOEX_STATS btcoexStats; - WMI_BTCOEX_STATS_EVENT *pbtcoexStats = &arPriv->arBtcoexStats; - int ret = 0; - - if (ar->bIsDestroyProgress) { - return -EBUSY; - } - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (down_interruptible(&ar->arSem)) { - return -ERESTARTSYS; - } - - if (copy_from_user(&btcoexStats.statsEvent, userdata, sizeof(AR6000_BTCOEX_CONFIG))) { - return -EFAULT; - } - - if (wmi_get_btcoex_stats_cmd(arPriv->arWmi) != A_OK) - { - up(&ar->arSem); - return -EIO; - } - - arPriv->statsUpdatePending = TRUE; - - wait_event_interruptible_timeout(arPriv->arEvent, arPriv->statsUpdatePending == FALSE, wmitimeout * HZ); - - if (signal_pending(current)) { - ret = -EINTR; - } - - if (!ret && copy_to_user(btcoexStats.statsEvent, pbtcoexStats, sizeof(WMI_BTCOEX_STATS_EVENT))) { - ret = -EFAULT; - } - - - up(&ar->arSem); - - return(ret); -} - -static int -ar6000_xioctl_set_excess_tx_retry_thres_cmd(struct net_device * dev, char * userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - WMI_SET_EXCESS_TX_RETRY_THRES_CMD cmd; - int ret = 0; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_excess_tx_retry_thres_cmd(arPriv->arWmi, &cmd) != A_OK) - { - ret = -EINVAL; - } - return(ret); -} - -static int -ar6000_xioctl_wac_ctrl_req_get_cmd(struct net_device * dev, char * userdata, struct ifreq *rq) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - WMI_WAC_CTRL_REQ_CMD cmd; - int ret = 0; - - if (ar->bIsDestroyProgress) { - return -EBUSY; - } - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (down_interruptible(&ar->arSem)) { - return -ERESTARTSYS; - } - - if (copy_from_user(&cmd, userdata, sizeof(WMI_WAC_CTRL_REQ_CMD))) { - return -EFAULT; - } - - if (wmi_wac_ctrl_req_cmd(arPriv->arWmi, &cmd) != A_OK) - { - up(&ar->arSem); - return -EIO; - } - - arPriv->statsUpdatePending = TRUE; - - wait_event_interruptible_timeout(arPriv->arEvent, arPriv->statsUpdatePending == FALSE, wmitimeout * HZ); - - if (signal_pending(current)) { - ret = -EINTR; - } - - if (!ret && copy_to_user(rq->ifr_data, &arPriv->wacInfo, sizeof(WMI_GET_WAC_INFO))) { - ret = -EFAULT; - } - - up(&ar->arSem); - - return(ret); -} - -static int -ar6000_xioctl_set_passphrase_cmd(struct net_device * dev, char * userdata) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - WMI_SET_PASSPHRASE_CMD cmd; - int ret = 0; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - return -EFAULT; - } - - if (wmi_set_passphrase_cmd(arPriv->arWmi, &cmd) == A_OK) - { - /* enable WPA offload */ - arSta->arConnectCtrlFlags |= CONNECT_DO_WPA_OFFLOAD; - ret = 0; - } else { - ret = -EINVAL; - } - return(ret); -} - -#ifdef CONFIG_HOST_GPIO_SUPPORT -struct ar6000_gpio_intr_wait_cmd_s gpio_intr_results; -/* gpio_reg_results and gpio_data_available are protected by arSem */ -static struct ar6000_gpio_register_cmd_s gpio_reg_results; -static A_BOOL gpio_data_available; /* Requested GPIO data available */ -static A_BOOL gpio_intr_available; /* GPIO interrupt info available */ -static A_BOOL gpio_ack_received; /* GPIO ack was received */ - -/* Host-side initialization for General Purpose I/O support */ -void ar6000_gpio_init(void) -{ - gpio_intr_available = FALSE; - gpio_data_available = FALSE; - gpio_ack_received = FALSE; -} - -/* - * Called when a GPIO interrupt is received from the Target. - * intr_values shows which GPIO pins have interrupted. - * input_values shows a recent value of GPIO pins. - */ -void -ar6000_gpio_intr_rx(AR_SOFTC_DEV_T *arPriv, A_UINT32 intr_mask, A_UINT32 input_values) -{ - gpio_intr_results.intr_mask = intr_mask; - gpio_intr_results.input_values = input_values; - *((volatile A_BOOL *)&gpio_intr_available) = TRUE; - wake_up(&arPriv->arEvent); -} - -/* - * This is called when a response is received from the Target - * for a previous or ar6000_gpio_input_get or ar6000_gpio_register_get - * call. - */ -void -ar6000_gpio_data_rx(AR_SOFTC_DEV_T *arPriv, A_UINT32 reg_id, A_UINT32 value) -{ - gpio_reg_results.gpioreg_id = reg_id; - gpio_reg_results.value = value; - *((volatile A_BOOL *)&gpio_data_available) = TRUE; - wake_up(&arPriv->arEvent); -} - -/* - * This is called when an acknowledgement is received from the Target - * for a previous or ar6000_gpio_output_set or ar6000_gpio_register_set - * call. - */ -void -ar6000_gpio_ack_rx(AR_SOFTC_DEV_T *arPriv) -{ - gpio_ack_received = TRUE; - wake_up(&arPriv->arEvent); -} - -A_STATUS -ar6000_gpio_output_set(struct net_device *dev, - A_UINT32 set_mask, - A_UINT32 clear_mask, - A_UINT32 enable_mask, - A_UINT32 disable_mask) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - - gpio_ack_received = FALSE; - return wmi_gpio_output_set(arPriv->arWmi, - set_mask, clear_mask, enable_mask, disable_mask); -} - -static A_STATUS -ar6000_gpio_input_get(struct net_device *dev) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - - *((volatile A_BOOL *)&gpio_data_available) = FALSE; - return wmi_gpio_input_get(arPriv->arWmi); -} - -static A_STATUS -ar6000_gpio_register_set(struct net_device *dev, - A_UINT32 gpioreg_id, - A_UINT32 value) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - - gpio_ack_received = FALSE; - return wmi_gpio_register_set(arPriv->arWmi, gpioreg_id, value); -} - -static A_STATUS -ar6000_gpio_register_get(struct net_device *dev, - A_UINT32 gpioreg_id) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - - *((volatile A_BOOL *)&gpio_data_available) = FALSE; - return wmi_gpio_register_get(arPriv->arWmi, gpioreg_id); -} - -static A_STATUS -ar6000_gpio_intr_ack(struct net_device *dev, - A_UINT32 ack_mask) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - - gpio_intr_available = FALSE; - return wmi_gpio_intr_ack(arPriv->arWmi, ack_mask); -} -#endif /* CONFIG_HOST_GPIO_SUPPORT */ - -#if defined(CONFIG_TARGET_PROFILE_SUPPORT) -static struct prof_count_s prof_count_results; -static A_BOOL prof_count_available; /* Requested GPIO data available */ - -static A_STATUS -prof_count_get(struct net_device *dev) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - - *((volatile A_BOOL *)&prof_count_available) = FALSE; - return wmi_prof_count_get_cmd(arPriv->arWmi); -} - -/* - * This is called when a response is received from the Target - * for a previous prof_count_get call. - */ -void -prof_count_rx(A_UINT32 addr, A_UINT32 count) -{ - prof_count_results.addr = addr; - prof_count_results.count = count; - *((volatile A_BOOL *)&prof_count_available) = TRUE; - wake_up(&arEvent); -} -#endif /* CONFIG_TARGET_PROFILE_SUPPORT */ - - -static A_STATUS -ar6000_create_acl_data_osbuf(struct net_device *dev, A_UINT8 *userdata, void **p_osbuf) -{ - void *osbuf = NULL; - A_UINT8 tmp_space[8]; - HCI_ACL_DATA_PKT *acl; - A_UINT8 hdr_size, *datap=NULL; - A_STATUS ret = A_OK; - - /* ACL is in data path. There is a need to create pool - * mechanism for allocating and freeing NETBUFs - ToDo later. - */ - - *p_osbuf = NULL; - acl = (HCI_ACL_DATA_PKT *)tmp_space; - hdr_size = sizeof(acl->hdl_and_flags) + sizeof(acl->data_len); - - do { - if (a_copy_from_user(acl, userdata, hdr_size)) { - ret = A_EFAULT; - break; - } - - osbuf = A_NETBUF_ALLOC(hdr_size + acl->data_len); - if (osbuf == NULL) { - ret = A_NO_MEMORY; - break; - } - A_NETBUF_PUT(osbuf, hdr_size + acl->data_len); - datap = (A_UINT8 *)A_NETBUF_DATA(osbuf); - - /* Real copy to osbuf */ - acl = (HCI_ACL_DATA_PKT *)(datap); - A_MEMCPY(acl, tmp_space, hdr_size); - if (a_copy_from_user(acl->data, userdata + hdr_size, acl->data_len)) { - ret = A_EFAULT; - break; - } - } while(FALSE); - - if (ret == A_OK) { - *p_osbuf = osbuf; - } else { - A_NETBUF_FREE(osbuf); - } - return ret; -} - - - -int -ar6000_ioctl_ap_setparam(AR_SOFTC_DEV_T *arPriv, int param, int value) -{ - int ret=0; - - switch(param) { - case IEEE80211_PARAM_WPA: - switch (value) { - case WPA_MODE_WPA1: - arPriv->arAuthMode = WMI_WPA_AUTH; - break; - case WPA_MODE_WPA2: - arPriv->arAuthMode = WMI_WPA2_AUTH; - break; - case WPA_MODE_AUTO: - arPriv->arAuthMode = WMI_WPA_AUTH | WMI_WPA2_AUTH; - break; - case WPA_MODE_NONE: - arPriv->arAuthMode = WMI_NONE_AUTH; - break; - } - break; - case IEEE80211_PARAM_AUTHMODE: - if(value == IEEE80211_AUTH_WPA_PSK) { - if (WMI_WPA_AUTH == arPriv->arAuthMode) { - arPriv->arAuthMode = WMI_WPA_PSK_AUTH; - } else if (WMI_WPA2_AUTH == arPriv->arAuthMode) { - arPriv->arAuthMode = WMI_WPA2_PSK_AUTH; - } else if ((WMI_WPA_AUTH | WMI_WPA2_AUTH) == arPriv->arAuthMode) { - arPriv->arAuthMode = WMI_WPA_PSK_AUTH | WMI_WPA2_PSK_AUTH; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Error - Setting PSK "\ - "mode when WPA param was set to %d\n", - arPriv->arAuthMode)); - ret = -EIO; - } - } - break; - case IEEE80211_PARAM_UCASTCIPHER: - arPriv->arPairwiseCrypto = 0; - if(value & (1<arPairwiseCrypto |= AES_CRYPT; - } - if(value & (1<arPairwiseCrypto |= TKIP_CRYPT; - } - if(!arPriv->arPairwiseCrypto) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("Error - Invalid cipher in WPA \n")); - ret = -EIO; - } - break; - case IEEE80211_PARAM_PRIVACY: - if(value == 0) { - arPriv->arDot11AuthMode = OPEN_AUTH; - arPriv->arAuthMode = WMI_NONE_AUTH; - arPriv->arPairwiseCrypto = NONE_CRYPT; - arPriv->arPairwiseCryptoLen = 0; - arPriv->arGroupCrypto = NONE_CRYPT; - arPriv->arGroupCryptoLen = 0; - } - break; -#ifdef WAPI_ENABLE - case IEEE80211_PARAM_WAPI: - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("WAPI Policy: %d\n", value)); - arPriv->arDot11AuthMode = OPEN_AUTH; - arPriv->arAuthMode = WMI_NONE_AUTH; - if(value & 0x1) { - arPriv->arPairwiseCrypto = WAPI_CRYPT; - arPriv->arGroupCrypto = WAPI_CRYPT; - } else { - arPriv->arPairwiseCrypto = NONE_CRYPT; - arPriv->arGroupCrypto = NONE_CRYPT; - } - break; -#endif - } - return ret; -} - -int -ar6000_ioctl_setparam(AR_SOFTC_DEV_T *arPriv, int param, int value) -{ - A_BOOL profChanged = FALSE; - int ret=0; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if(arPriv->arNextMode == AP_NETWORK) { - arPriv->ap_profile_flag = 1; /* There is a change in profile */ - switch (param) { - case IEEE80211_PARAM_WPA: - case IEEE80211_PARAM_AUTHMODE: - case IEEE80211_PARAM_UCASTCIPHER: - case IEEE80211_PARAM_PRIVACY: - case IEEE80211_PARAM_WAPI: - ret = ar6000_ioctl_ap_setparam(arPriv, param, value); - return ret; - } - } - - switch (param) { - case IEEE80211_PARAM_WPA: - switch (value) { - case WPA_MODE_WPA1: - arPriv->arAuthMode = WMI_WPA_AUTH; - profChanged = TRUE; - break; - case WPA_MODE_WPA2: - arPriv->arAuthMode = WMI_WPA2_AUTH; - profChanged = TRUE; - break; - case WPA_MODE_NONE: - arPriv->arAuthMode = WMI_NONE_AUTH; - profChanged = TRUE; - break; - } - break; - case IEEE80211_PARAM_AUTHMODE: - switch(value) { - case IEEE80211_AUTH_WPA_PSK: - if (WMI_WPA_AUTH == arPriv->arAuthMode) { - arPriv->arAuthMode = WMI_WPA_PSK_AUTH; - profChanged = TRUE; - } else if (WMI_WPA2_AUTH == arPriv->arAuthMode) { - arPriv->arAuthMode = WMI_WPA2_PSK_AUTH; - profChanged = TRUE; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Error - Setting PSK "\ - "mode when WPA param was set to %d\n", - arPriv->arAuthMode)); - ret = -EIO; - } - break; - case IEEE80211_AUTH_WPA_CCKM: - if (WMI_WPA2_AUTH == arPriv->arAuthMode) { - arPriv->arAuthMode = WMI_WPA2_AUTH_CCKM; - } else { - arPriv->arAuthMode = WMI_WPA_AUTH_CCKM; - } - break; - default: - break; - } - break; - case IEEE80211_PARAM_UCASTCIPHER: - switch (value) { - case IEEE80211_CIPHER_AES_CCM: - arPriv->arPairwiseCrypto = AES_CRYPT; - profChanged = TRUE; - break; - case IEEE80211_CIPHER_TKIP: - arPriv->arPairwiseCrypto = TKIP_CRYPT; - profChanged = TRUE; - break; - case IEEE80211_CIPHER_WEP: - arPriv->arPairwiseCrypto = WEP_CRYPT; - profChanged = TRUE; - break; - case IEEE80211_CIPHER_NONE: - arPriv->arPairwiseCrypto = NONE_CRYPT; - profChanged = TRUE; - break; - } - break; - case IEEE80211_PARAM_UCASTKEYLEN: - if (!IEEE80211_IS_VALID_WEP_CIPHER_LEN(value)) { - ret = -EIO; - } else { - arPriv->arPairwiseCryptoLen = value; - } - break; - case IEEE80211_PARAM_MCASTCIPHER: - switch (value) { - case IEEE80211_CIPHER_AES_CCM: - arPriv->arGroupCrypto = AES_CRYPT; - profChanged = TRUE; - break; - case IEEE80211_CIPHER_TKIP: - arPriv->arGroupCrypto = TKIP_CRYPT; - profChanged = TRUE; - break; - case IEEE80211_CIPHER_WEP: - arPriv->arGroupCrypto = WEP_CRYPT; - profChanged = TRUE; - break; - case IEEE80211_CIPHER_NONE: - arPriv->arGroupCrypto = NONE_CRYPT; - profChanged = TRUE; - break; - } - break; - case IEEE80211_PARAM_MCASTKEYLEN: - if (!IEEE80211_IS_VALID_WEP_CIPHER_LEN(value)) { - ret = -EIO; - } else { - arPriv->arGroupCryptoLen = value; - } - break; - case IEEE80211_PARAM_COUNTERMEASURES: - if (ar->arWmiReady == FALSE) { - return -EIO; - } - wmi_set_tkip_countermeasures_cmd(arPriv->arWmi, value); - break; - default: - break; - } - if ((arPriv->arNextMode != AP_NETWORK) && (profChanged == TRUE)) { - /* - * profile has changed. Erase ssid to signal change - */ - A_MEMZERO(arPriv->arSsid, sizeof(arPriv->arSsid)); - } - - return ret; -} - -int -ar6000_sendkey(AR_SOFTC_DEV_T *arPriv, struct ieee80211req_key *ik, KEY_USAGE keyUsage) -{ - A_STATUS status; - CRYPTO_TYPE keyType = NONE_CRYPT; - - switch (ik->ik_type) { - case IEEE80211_CIPHER_WEP: - keyType = WEP_CRYPT; - break; - case IEEE80211_CIPHER_TKIP: - keyType = TKIP_CRYPT; - break; - case IEEE80211_CIPHER_AES_CCM: - keyType = AES_CRYPT; - break; - default: - break; - } - - if (IEEE80211_CIPHER_CCKM_KRK != ik->ik_type) { - if (NONE_CRYPT == keyType) { - return A_ERROR; - } - - if ((WEP_CRYPT == keyType)&&(!arPriv->arConnected)) { - int index = ik->ik_keyix; - - if (!IEEE80211_IS_VALID_WEP_CIPHER_LEN(ik->ik_keylen)) { - return A_ERROR; - } - - A_MEMZERO(arPriv->arWepKeyList[index].arKey, - sizeof(arPriv->arWepKeyList[index].arKey)); - A_MEMCPY(arPriv->arWepKeyList[index].arKey, ik->ik_keydata, ik->ik_keylen); - arPriv->arWepKeyList[index].arKeyLen = ik->ik_keylen; - - if(ik->ik_flags & IEEE80211_KEY_DEFAULT){ - arPriv->arDefTxKeyIndex = index; - } - - return A_OK; - } - - status = wmi_addKey_cmd(arPriv->arWmi, ik->ik_keyix, keyType, keyUsage, - ik->ik_keylen, (A_UINT8 *)&ik->ik_keyrsc, - ik->ik_keydata, KEY_OP_INIT_VAL, ik->ik_macaddr, - SYNC_BOTH_WMIFLAG); - - } else { - status = wmi_add_krk_cmd(arPriv->arWmi, ik->ik_keydata); - } - - return status; -} - -int -ar6000_ioctl_setkey(AR_SOFTC_DEV_T *arPriv, struct ieee80211req_key *ik) -{ - KEY_USAGE keyUsage; - A_STATUS status; - CRYPTO_TYPE keyType = NONE_CRYPT; - - if ( (0 == memcmp(ik->ik_macaddr, null_mac, IEEE80211_ADDR_LEN)) || - (0 == memcmp(ik->ik_macaddr, bcast_mac, IEEE80211_ADDR_LEN)) ) { - keyUsage = GROUP_USAGE; - } else { - keyUsage = PAIRWISE_USAGE; - } - - if(arPriv->arNextMode == AP_NETWORK) { - AR_SOFTC_AP_T *arAp = &arPriv->arAp; - - if (keyUsage == GROUP_USAGE) { - A_MEMCPY(&arAp->ap_mode_bkey, ik, sizeof(struct ieee80211req_key)); - } - - #ifdef WAPI_ENABLE - if(arPriv->arPairwiseCrypto == WAPI_CRYPT) { - return ap_set_wapi_key(arPriv, ik); - } - #endif - - status = ar6000_sendkey(arPriv, ik, keyUsage); - - } else { - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - - #ifdef USER_KEYS - arSta->user_saved_keys.keyOk = FALSE; - arSta->user_saved_keys.keyType = keyType; - if (keyUsage == GROUP_USAGE) { - A_MEMCPY(&arSta->user_saved_keys.bcast_ik, ik, - sizeof(struct ieee80211req_key)); - } else { - A_MEMCPY(&arSta->user_saved_keys.ucast_ik, ik, - sizeof(struct ieee80211req_key)); - } - #endif - - if (((WMI_WPA_PSK_AUTH == arPriv->arAuthMode) || - (WMI_WPA2_PSK_AUTH == arPriv->arAuthMode)) && - (GROUP_USAGE & keyUsage)) - { - A_UNTIMEOUT(&arSta->disconnect_timer); - } - - status = ar6000_sendkey(arPriv, ik, keyUsage); - - #ifdef USER_KEYS - if (status == A_OK) { - arSta->user_saved_keys.keyOk = TRUE; - } - #endif - } - - if (status != A_OK) { - return -EIO; - } - - return 0; -} - -int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - AR_SOFTC_AP_T *arAp = &arPriv->arAp; - HIF_DEVICE *hifDevice = ar->arHifDevice; - int ret = 0, param; - unsigned int address = 0; - unsigned int length = 0; - unsigned char *buffer; - char *userdata; - - /* - * ioctl operations may have to wait for the Target, so we cannot hold rtnl. - * Prevent the device from disappearing under us and release the lock during - * the ioctl operation. - */ - dev_hold(dev); - rtnl_unlock(); - - if (cmd == AR6000_IOCTL_EXTENDED) { - /* - * This allows for many more wireless ioctls than would otherwise - * be available. Applications embed the actual ioctl command in - * the first word of the parameter block, and use the command - * AR6000_IOCTL_EXTENDED_CMD on the ioctl call. - */ - get_user(cmd, (int *)rq->ifr_data); - userdata = (char *)(((unsigned int *)rq->ifr_data)+1); - if(is_xioctl_allowed(arPriv->arNextMode, - arPriv->arNetworkSubType, cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("xioctl: cmd=%d not allowed in this mode\n",cmd)); - ret = -EOPNOTSUPP; - goto ioctl_done; - } - } else { - A_STATUS ret = is_iwioctl_allowed(arPriv->arNextMode, cmd); - if(ret == A_ENOTSUP) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("iwioctl: cmd=0x%x not allowed in this mode\n", cmd)); - ret = -EOPNOTSUPP; - goto ioctl_done; - } else if (ret == A_ERROR) { - /* It is not our ioctl (out of range ioctl) */ - ret = -EOPNOTSUPP; - goto ioctl_done; - } - userdata = (char *)rq->ifr_data; - } - - if ((ar->arWlanState == WLAN_DISABLED) && - ((cmd != AR6000_XIOCTRL_WMI_SET_WLAN_STATE) && - (cmd != AR6000_XIOCTL_GET_WLAN_SLEEP_STATE) && - (cmd != AR6000_XIOCTL_DIAG_READ) && - (cmd != AR6000_XIOCTL_DIAG_WRITE) && - (cmd != AR6000_XIOCTL_SET_BT_HW_POWER_STATE) && - (cmd != AR6000_XIOCTL_GET_BT_HW_POWER_STATE) && - (cmd != AR6000_IOCTL_WMI_GETREV) && - (cmd != AR6000_XIOCTL_RESUME_DRIVER))) - { - ret = -EIO; - goto ioctl_done; - } - - - ret = 0; - switch(cmd) - { - case IEEE80211_IOCTL_SETPARAM: - { - int param, value; - int *ptr = (int *)rq->ifr_ifru.ifru_newname; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else { - param = *ptr++; - value = *ptr; - ret = ar6000_ioctl_setparam(arPriv,param,value); - } - break; - } - case IEEE80211_IOCTL_SETKEY: - { - struct ieee80211req_key keydata; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&keydata, userdata, - sizeof(struct ieee80211req_key))) { - ret = -EFAULT; - } else { - ar6000_ioctl_setkey(arPriv, &keydata); - } - break; - } - case IEEE80211_IOCTL_DELKEY: - case IEEE80211_IOCTL_SETOPTIE: - { - //ret = -EIO; - break; - } - case IEEE80211_IOCTL_SETMLME: - { - struct ieee80211req_mlme mlme; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&mlme, userdata, - sizeof(struct ieee80211req_mlme))) { - ret = -EFAULT; - } else { - switch (mlme.im_op) { - case IEEE80211_MLME_AUTHORIZE: - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("setmlme AUTHORIZE %02X:%02X\n", - mlme.im_macaddr[4], mlme.im_macaddr[5])); - break; - case IEEE80211_MLME_UNAUTHORIZE: - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("setmlme UNAUTHORIZE %02X:%02X\n", - mlme.im_macaddr[4], mlme.im_macaddr[5])); - break; - case IEEE80211_MLME_DEAUTH: - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("setmlme DEAUTH %02X:%02X\n", - mlme.im_macaddr[4], mlme.im_macaddr[5])); - //remove_sta(ar, mlme.im_macaddr); - break; - case IEEE80211_MLME_DISASSOC: - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("setmlme DISASSOC %02X:%02X\n", - mlme.im_macaddr[4], mlme.im_macaddr[5])); - //remove_sta(ar, mlme.im_macaddr); - break; - default: - ret = 0; - goto ioctl_done; - } - - wmi_ap_set_mlme(arPriv->arWmi, mlme.im_op, mlme.im_macaddr, - mlme.im_reason); - } - break; - } - case IEEE80211_IOCTL_ADDPMKID: - { - struct ieee80211req_addpmkid req; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&req, userdata, sizeof(struct ieee80211req_addpmkid))) { - ret = -EFAULT; - } else { - A_STATUS status; - - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("Add pmkid for %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x en=%d\n", - req.pi_bssid[0], req.pi_bssid[1], req.pi_bssid[2], - req.pi_bssid[3], req.pi_bssid[4], req.pi_bssid[5], - req.pi_enable)); - - status = wmi_setPmkid_cmd(arPriv->arWmi, req.pi_bssid, req.pi_pmkid, - req.pi_enable); - - if (status != A_OK) { - ret = -EIO; - goto ioctl_done; - } - } - break; - } -#ifdef CONFIG_HOST_TCMD_SUPPORT - case AR6000_XIOCTL_TCMD_CONT_TX: - { - TCMD_CONT_TX txCmd; - - if ((ar->tcmdPm == TCMD_PM_SLEEP) || - (ar->tcmdPm == TCMD_PM_DEEPSLEEP)) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Can NOT send tx tcmd when target is asleep! \n")); - ret = -EOPNOTSUPP; - goto ioctl_done; - } - - if(copy_from_user(&txCmd, userdata, sizeof(TCMD_CONT_TX))) { - ret = -EFAULT; - goto ioctl_done; - } else { - wmi_test_cmd(arPriv->arWmi,(A_UINT8 *)&txCmd, sizeof(TCMD_CONT_TX)); - } - } - break; - case AR6000_XIOCTL_TCMD_CONT_RX: - { - TCMD_CONT_RX rxCmd; - - if ((ar->tcmdPm == TCMD_PM_SLEEP) || - (ar->tcmdPm == TCMD_PM_DEEPSLEEP)) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Can NOT send rx tcmd when target is asleep! \n")); - ret = -EOPNOTSUPP; - goto ioctl_done; - } - if(copy_from_user(&rxCmd, userdata, sizeof(TCMD_CONT_RX))) { - ret = -EFAULT; - goto ioctl_done; - } - - switch(rxCmd.act) - { - case TCMD_CONT_RX_PROMIS: - case TCMD_CONT_RX_FILTER: - case TCMD_CONT_RX_SETMAC: - case TCMD_CONT_RX_SET_ANT_SWITCH_TABLE: - wmi_test_cmd(arPriv->arWmi,(A_UINT8 *)&rxCmd, - sizeof(TCMD_CONT_RX)); - tcmdRxFreq = rxCmd.u.para.freq; - break; - case TCMD_CONT_RX_REPORT: - ar6000_ioctl_tcmd_get_rx_report(dev, rq, - (A_UINT8 *)&rxCmd, sizeof(TCMD_CONT_RX)); - break; - default: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unknown Cont Rx mode: %d\n",rxCmd.act)); - ret = -EINVAL; - goto ioctl_done; - } - } - break; - case AR6000_XIOCTL_TCMD_PM: - { - TCMD_PM pmCmd; - - if(copy_from_user(&pmCmd, userdata, sizeof(TCMD_PM))) { - ret = -EFAULT; - goto ioctl_done; - } - ar->tcmdPm = pmCmd.mode; - wmi_test_cmd(arPriv->arWmi, (A_UINT8*)&pmCmd, sizeof(TCMD_PM)); - } - break; - - case AR6000_XIOCTL_TCMD_CMDS: - { - TC_CMDS cmdsCmd; - if(copy_from_user(&cmdsCmd, userdata, sizeof(TC_CMDS))) { - ret = -EFAULT; - goto ioctl_done; - } - ar6000_ioctl_tcmd_cmd_resp(dev, rq, (A_UINT8 *)&cmdsCmd, sizeof(TC_CMDS)); -#if 0 - wmi_test_cmd(arPriv->arWmi, (A_UINT8*)&cmdsCmd, sizeof(TC_CMDS)); -#endif - } - break; - - case AR6000_XIOCTL_TCMD_SETREG: - { - TCMD_SET_REG setRegCmd; - - if(copy_from_user(&setRegCmd, userdata, sizeof(TCMD_SET_REG))) { - ret = -EFAULT; - goto ioctl_done; - } - wmi_test_cmd(arPriv->arWmi, (A_UINT8*)&setRegCmd, sizeof(TCMD_SET_REG)); - } - break; -#endif /* CONFIG_HOST_TCMD_SUPPORT */ - - case AR6000_XIOCTL_BMI_DONE: - if(bmienable) - { - rtnl_lock(); /* ar6000_init expects to be called holding rtnl lock */ - ret = ar6000_init(dev); - rtnl_unlock(); - } - else - { - ret = BMIDone(hifDevice); - } - break; - - case AR6000_XIOCTL_BMI_READ_MEMORY: - get_user(address, (unsigned int *)userdata); - get_user(length, (unsigned int *)userdata + 1); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Read Memory (address: 0x%x, length: %d)\n", - address, length)); - if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) { - A_MEMZERO(buffer, length); - ret = BMIReadMemory(hifDevice, address, buffer, length); - if (copy_to_user(rq->ifr_data, buffer, length)) { - ret = -EFAULT; - } - A_FREE(buffer); - } else { - ret = -ENOMEM; - } - break; - - case AR6000_XIOCTL_BMI_WRITE_MEMORY: - get_user(address, (unsigned int *)userdata); - get_user(length, (unsigned int *)userdata + 1); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Write Memory (address: 0x%x, length: %d)\n", - address, length)); - if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) { - A_MEMZERO(buffer, length); - if (copy_from_user(buffer, &userdata[sizeof(address) + - sizeof(length)], length)) - { - ret = -EFAULT; - } else { - ret = BMIWriteMemory(hifDevice, address, buffer, length); - } - A_FREE(buffer); - } else { - ret = -ENOMEM; - } - break; - - case AR6000_XIOCTL_BMI_TEST: - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("No longer supported\n")); - ret = -EOPNOTSUPP; - break; - - case AR6000_XIOCTL_BMI_EXECUTE: - get_user(address, (unsigned int *)userdata); - get_user(param, (unsigned int *)userdata + 1); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Execute (address: 0x%x, param: %d)\n", - address, param)); - ret = BMIExecute(hifDevice, address, (A_UINT32*)¶m); - put_user(param, (unsigned int *)rq->ifr_data); /* return value */ - break; - - case AR6000_XIOCTL_BMI_SET_APP_START: - get_user(address, (unsigned int *)userdata); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Set App Start (address: 0x%x)\n", address)); - ret = BMISetAppStart(hifDevice, address); - break; - - case AR6000_XIOCTL_BMI_READ_SOC_REGISTER: - get_user(address, (unsigned int *)userdata); - ret = BMIReadSOCRegister(hifDevice, address, (A_UINT32*)¶m); - put_user(param, (unsigned int *)rq->ifr_data); /* return value */ - break; - - case AR6000_XIOCTL_BMI_WRITE_SOC_REGISTER: - get_user(address, (unsigned int *)userdata); - get_user(param, (unsigned int *)userdata + 1); - ret = BMIWriteSOCRegister(hifDevice, address, param); - break; - -#ifdef HTC_RAW_INTERFACE - case AR6000_XIOCTL_HTC_RAW_OPEN: - ret = A_OK; - if (!arRawIfEnabled(ar)) { - /* make sure block size is set in case the target was reset since last - * BMI phase (i.e. flashup downloads) */ - ret = ar6000_set_htc_params(ar->arHifDevice, - ar->arTargetType, - 0, /* use default yield */ - 0 /* use default number of HTC ctrl buffers */ - ); - if (A_FAILED(ret)) { - break; - } - /* Terminate the BMI phase */ - ret = BMIDone(hifDevice); - if (ret == A_OK) { - ret = ar6000_htc_raw_open(ar); - } - } - break; - - case AR6000_XIOCTL_HTC_RAW_CLOSE: - if (arRawIfEnabled(ar)) { - ret = ar6000_htc_raw_close(ar); - arRawIfEnabled(ar) = FALSE; - } else { - ret = A_ERROR; - } - break; - - case AR6000_XIOCTL_HTC_RAW_READ: - if (arRawIfEnabled(ar)) { - unsigned int streamID; - get_user(streamID, (unsigned int *)userdata); - get_user(length, (unsigned int *)userdata + 1); - buffer = (unsigned char*)rq->ifr_data + sizeof(length); - ret = ar6000_htc_raw_read(ar, (HTC_RAW_STREAM_ID)streamID, - (char*)buffer, length); - put_user(ret, (unsigned int *)rq->ifr_data); - } else { - ret = A_ERROR; - } - break; - - case AR6000_XIOCTL_HTC_RAW_WRITE: - if (arRawIfEnabled(ar)) { - unsigned int streamID; - get_user(streamID, (unsigned int *)userdata); - get_user(length, (unsigned int *)userdata + 1); - buffer = (unsigned char*)userdata + sizeof(streamID) + sizeof(length); - ret = ar6000_htc_raw_write(ar, (HTC_RAW_STREAM_ID)streamID, - (char*)buffer, length); - put_user(ret, (unsigned int *)rq->ifr_data); - } else { - ret = A_ERROR; - } - break; -#endif /* HTC_RAW_INTERFACE */ - - case AR6000_XIOCTL_BMI_LZ_STREAM_START: - get_user(address, (unsigned int *)userdata); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Start Compressed Stream (address: 0x%x)\n", address)); - ret = BMILZStreamStart(hifDevice, address); - break; - - case AR6000_XIOCTL_BMI_LZ_DATA: - get_user(length, (unsigned int *)userdata); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Send Compressed Data (length: %d)\n", length)); - if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) { - A_MEMZERO(buffer, length); - if (copy_from_user(buffer, &userdata[sizeof(length)], length)) - { - ret = -EFAULT; - } else { - ret = BMILZData(hifDevice, buffer, length); - } - A_FREE(buffer); - } else { - ret = -ENOMEM; - } - break; - -#if defined(CONFIG_TARGET_PROFILE_SUPPORT) - /* - * Optional support for Target-side profiling. - * Not needed in production. - */ - - /* Configure Target-side profiling */ - case AR6000_XIOCTL_PROF_CFG: - { - A_UINT32 period; - A_UINT32 nbins; - get_user(period, (unsigned int *)userdata); - get_user(nbins, (unsigned int *)userdata + 1); - - if (wmi_prof_cfg_cmd(arPriv->arWmi, period, nbins) != A_OK) { - ret = -EIO; - } - - break; - } - - /* Start a profiling bucket/bin at the specified address */ - case AR6000_XIOCTL_PROF_ADDR_SET: - { - A_UINT32 addr; - get_user(addr, (unsigned int *)userdata); - - if (wmi_prof_addr_set_cmd(arPriv->arWmi, addr) != A_OK) { - ret = -EIO; - } - - break; - } - - /* START Target-side profiling */ - case AR6000_XIOCTL_PROF_START: - wmi_prof_start_cmd(arPriv->arWmi); - break; - - /* STOP Target-side profiling */ - case AR6000_XIOCTL_PROF_STOP: - wmi_prof_stop_cmd(arPriv->arWmi); - break; - case AR6000_XIOCTL_PROF_COUNT_GET: - { - if (ar->bIsDestroyProgress) { - ret = -EBUSY; - goto ioctl_done; - } - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } - if (down_interruptible(&ar->arSem)) { - ret = -ERESTARTSYS; - goto ioctl_done; - } - if (ar->bIsDestroyProgress) { - up(&ar->arSem); - ret = -EBUSY; - goto ioctl_done; - } - - prof_count_available = FALSE; - ret = prof_count_get(dev); - if (ret != A_OK) { - up(&ar->arSem); - ret = -EIO; - goto ioctl_done; - } - - /* Wait for Target to respond. */ - wait_event_interruptible(arPriv->arEvent, prof_count_available); - if (signal_pending(current)) { - ret = -EINTR; - } else { - if (copy_to_user(userdata, &prof_count_results, - sizeof(prof_count_results))) - { - ret = -EFAULT; - } - } - up(&ar->arSem); - break; - } -#endif /* CONFIG_TARGET_PROFILE_SUPPORT */ - - case AR6000_IOCTL_WMI_GETREV: - { - if (copy_to_user(rq->ifr_data, &ar->arVersion, - sizeof(ar->arVersion))) - { - ret = -EFAULT; - } - break; - } - case AR6000_IOCTL_WMI_SETPWR: - { - WMI_POWER_MODE_CMD pwrModeCmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&pwrModeCmd, userdata, - sizeof(pwrModeCmd))) - { - ret = -EFAULT; - } else { - if (wmi_powermode_cmd(arPriv->arWmi, pwrModeCmd.powerMode) - != A_OK) - { - ret = -EIO; - } - } - break; - } - case AR6000_IOCTL_WMI_SET_IBSS_PM_CAPS: - { - WMI_IBSS_PM_CAPS_CMD ibssPmCaps; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&ibssPmCaps, userdata, - sizeof(ibssPmCaps))) - { - ret = -EFAULT; - } else { - if (wmi_ibsspmcaps_cmd(arPriv->arWmi, ibssPmCaps.power_saving, ibssPmCaps.ttl, - ibssPmCaps.atim_windows, ibssPmCaps.timeout_value) != A_OK) - { - ret = -EIO; - } - AR6000_SPIN_LOCK(&arPriv->arPrivLock, 0); - arPriv->arSta.arIbssPsEnable = ibssPmCaps.power_saving; - AR6000_SPIN_UNLOCK(&arPriv->arPrivLock, 0); - } - break; - } - case AR6000_XIOCTL_WMI_SET_AP_PS: - { - WMI_AP_PS_CMD apPsCmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&apPsCmd, userdata, - sizeof(apPsCmd))) - { - ret = -EFAULT; - } else { - if (wmi_apps_cmd(arPriv->arWmi, apPsCmd.psType, apPsCmd.idle_time, - apPsCmd.ps_period, apPsCmd.sleep_period) != A_OK) - { - ret = -EIO; - } - } - break; - } - case AR6000_IOCTL_WMI_SET_PMPARAMS: - { - WMI_POWER_PARAMS_CMD pmParams; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&pmParams, userdata, - sizeof(pmParams))) - { - ret = -EFAULT; - } else { - if (wmi_pmparams_cmd(arPriv->arWmi, pmParams.idle_period, - pmParams.pspoll_number, - pmParams.dtim_policy, - pmParams.tx_wakeup_policy, - pmParams.num_tx_to_wakeup, -#if WLAN_CONFIG_IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN - IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN -#else - SEND_POWER_SAVE_FAIL_EVENT_ALWAYS -#endif - ) != A_OK) - { - ret = -EIO; - } - } - break; - } - case AR6000_IOCTL_WMI_SETSCAN: - { - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&arSta->scParams, userdata, - sizeof(arSta->scParams))) - { - ret = -EFAULT; - } else { - if (CAN_SCAN_IN_CONNECT(arSta->scParams.scanCtrlFlags)) { - arSta->arSkipScan = FALSE; - } else { - arSta->arSkipScan = TRUE; - } - - if (wmi_scanparams_cmd(arPriv->arWmi, arSta->scParams.fg_start_period, - arSta->scParams.fg_end_period, - arSta->scParams.bg_period, - arSta->scParams.minact_chdwell_time, - arSta->scParams.maxact_chdwell_time, - arSta->scParams.pas_chdwell_time, - arSta->scParams.shortScanRatio, - arSta->scParams.scanCtrlFlags, - arSta->scParams.max_dfsch_act_time, - arSta->scParams.maxact_scan_per_ssid) != A_OK) - { - ret = -EIO; - } - } - break; - } - case AR6000_IOCTL_WMI_SETLISTENINT: - { - WMI_LISTEN_INT_CMD listenCmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&listenCmd, userdata, - sizeof(listenCmd))) - { - ret = -EFAULT; - } else { - if (wmi_listeninterval_cmd(arPriv->arWmi, listenCmd.listenInterval, listenCmd.numBeacons) != A_OK) { - ret = -EIO; - } else { - AR6000_SPIN_LOCK(&arPriv->arPrivLock, 0); - arSta->arListenIntervalT = listenCmd.listenInterval; - arSta->arListenIntervalB = listenCmd.numBeacons; - AR6000_SPIN_UNLOCK(&arPriv->arPrivLock, 0); - } - - } - break; - } - case AR6000_IOCTL_WMI_SET_BMISS_TIME: - { - WMI_BMISS_TIME_CMD bmissCmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&bmissCmd, userdata, - sizeof(bmissCmd))) - { - ret = -EFAULT; - } else { - if (wmi_bmisstime_cmd(arPriv->arWmi, bmissCmd.bmissTime, bmissCmd.numBeacons) != A_OK) { - ret = -EIO; - } - } - break; - } - case AR6000_IOCTL_WMI_SETBSSFILTER: - { - WMI_BSS_FILTER_CMD filt; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&filt, userdata, - sizeof(filt))) - { - ret = -EFAULT; - } else { - if (wmi_bssfilter_cmd(arPriv->arWmi, filt.bssFilter, filt.ieMask) - != A_OK) { - ret = -EIO; - } else { - arSta->arUserBssFilter = filt.bssFilter; - } - } - break; - } - - case AR6000_IOCTL_WMI_SET_SNRTHRESHOLD: - { - ret = ar6000_ioctl_set_snr_threshold(dev, rq); - break; - } - case AR6000_XIOCTL_WMI_SET_RSSITHRESHOLD: - { - ret = ar6000_ioctl_set_rssi_threshold(dev, rq); - break; - } - case AR6000_XIOCTL_WMI_CLR_RSSISNR: - { - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } - ret = wmi_clr_rssi_snr(arPriv->arWmi); - break; - } - case AR6000_XIOCTL_WMI_SET_LQTHRESHOLD: - { - ret = ar6000_ioctl_set_lq_threshold(dev, rq); - break; - } - case AR6000_XIOCTL_WMI_SET_LPREAMBLE: - { - WMI_SET_LPREAMBLE_CMD setLpreambleCmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&setLpreambleCmd, userdata, - sizeof(setLpreambleCmd))) - { - ret = -EFAULT; - } else { - if (wmi_set_lpreamble_cmd(arPriv->arWmi, setLpreambleCmd.status, -#if WLAN_CONFIG_DONOT_IGNORE_BARKER_IN_ERP - WMI_DONOT_IGNORE_BARKER_IN_ERP -#else - WMI_IGNORE_BARKER_IN_ERP -#endif - ) != A_OK) - { - ret = -EIO; - } - } - - break; - } - case AR6000_XIOCTL_WMI_SET_RTS: - { - WMI_SET_RTS_CMD rtsCmd; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&rtsCmd, userdata, - sizeof(rtsCmd))) - { - ret = -EFAULT; - } else { - if(arPriv->arNetworkType == AP_NETWORK) { - arAp->arRTS = rtsCmd.threshold; - } - if (wmi_set_rts_cmd(arPriv->arWmi, rtsCmd.threshold) - != A_OK) - { - ret = -EIO; - } - } - - break; - } - case AR6000_XIOCTL_WMI_SET_WMM: - { - ret = ar6000_ioctl_set_wmm(dev, rq); - break; - } - case AR6000_XIOCTL_WMI_SET_QOS_SUPP: - { - ret = ar6000_ioctl_set_qos_supp(dev, rq); - break; - } - case AR6000_XIOCTL_WMI_SET_TXOP: - { - ret = ar6000_ioctl_set_txop(dev, rq); - break; - } - case AR6000_XIOCTL_WMI_GET_RD: - { - ret = ar6000_ioctl_get_rd(dev, rq); - break; - } - case AR6000_IOCTL_WMI_SET_CHANNELPARAMS: - { - ret = ar6000_ioctl_set_channelParams(dev, rq); - break; - } - case AR6000_IOCTL_WMI_SET_PROBEDSSID: - { - ret = ar6000_ioctl_set_probedSsid(dev, rq); - break; - } - case AR6000_IOCTL_WMI_SET_BADAP: - { - ret = ar6000_ioctl_set_badAp(dev, rq); - break; - } - case AR6000_IOCTL_WMI_CREATE_QOS: - { - ret = ar6000_ioctl_create_qos(dev, rq); - break; - } - case AR6000_IOCTL_WMI_DELETE_QOS: - { - ret = ar6000_ioctl_delete_qos(dev, rq); - break; - } - case AR6000_IOCTL_WMI_GET_QOS_QUEUE: - { - ret = ar6000_ioctl_get_qos_queue(dev, rq); - break; - } - case AR6000_IOCTL_WMI_GET_TARGET_STATS: - { - ret = ar6000_ioctl_get_target_stats(dev, rq); - break; - } - case AR6000_IOCTL_WMI_SET_ERROR_REPORT_BITMASK: - { - ret = ar6000_ioctl_set_error_report_bitmask(dev, rq); - break; - } - case AR6000_IOCTL_WMI_SET_ASSOC_INFO: - { - WMI_SET_ASSOC_INFO_CMD cmd; - A_UINT8 assocInfo[WMI_MAX_ASSOC_INFO_LEN]; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else { - get_user(cmd.ieType, userdata); - if (cmd.ieType >= WMI_MAX_ASSOC_INFO_TYPE) { - ret = -EIO; - } else { - get_user(cmd.bufferSize, userdata + 1); - if (cmd.bufferSize > WMI_MAX_ASSOC_INFO_LEN) { - ret = -EFAULT; - break; - } - if (copy_from_user(assocInfo, userdata + 2, - cmd.bufferSize)) - { - ret = -EFAULT; - } else { - if (wmi_associnfo_cmd(arPriv->arWmi, cmd.ieType, - cmd.bufferSize, - assocInfo) != A_OK) - { - ret = -EIO; - } - } - } - } - break; - } - case AR6000_IOCTL_WMI_SET_ACCESS_PARAMS: - { - ret = ar6000_ioctl_set_access_params(dev, rq); - break; - } - case AR6000_IOCTL_WMI_SET_DISC_TIMEOUT: - { - ret = ar6000_ioctl_set_disconnect_timeout(dev, rq); - break; - } - case AR6000_XIOCTL_FORCE_TARGET_RESET: - { - if (ar->arHtcTarget) - { -// HTCForceReset(htcTarget); - } - else - { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN,("ar6000_ioctl cannot attempt reset.\n")); - } - break; - } - case AR6000_XIOCTL_TARGET_INFO: - case AR6000_XIOCTL_CHECK_TARGET_READY: /* backwards compatibility */ - { - /* If we made it to here, then the Target exists and is ready. */ - - if (cmd == AR6000_XIOCTL_TARGET_INFO) { - if (copy_to_user((A_UINT32 *)rq->ifr_data, &ar->arVersion.target_ver, - sizeof(ar->arVersion.target_ver))) - { - ret = -EFAULT; - } - if (copy_to_user(((A_UINT32 *)rq->ifr_data)+1, &ar->arTargetType, - sizeof(ar->arTargetType))) - { - ret = -EFAULT; - } - } - break; - } - case AR6000_XIOCTL_WMI_SET_HB_CHALLENGE_RESP_PARAMS: - { - WMI_SET_HB_CHALLENGE_RESP_PARAMS_CMD hbparam; - - if (copy_from_user(&hbparam, userdata, sizeof(hbparam))) - { - ret = -EFAULT; - } else { - AR6000_SPIN_LOCK(&ar->arLock, 0); - /* Start a cyclic timer with the parameters provided. */ - if (hbparam.frequency) { - ar->arHBChallengeResp.frequency = hbparam.frequency; - } - if (hbparam.threshold) { - ar->arHBChallengeResp.missThres = hbparam.threshold; - } - - /* Delete the pending timer and start a new one */ - if (timer_pending(&ar->arHBChallengeResp.timer)) { - A_UNTIMEOUT(&ar->arHBChallengeResp.timer); - } - A_TIMEOUT_MS(&ar->arHBChallengeResp.timer, ar->arHBChallengeResp.frequency * 1000, 0); - AR6000_SPIN_UNLOCK(&ar->arLock, 0); - } - break; - } - case AR6000_XIOCTL_WMI_GET_HB_CHALLENGE_RESP: - { - A_UINT32 cookie; - - if (copy_from_user(&cookie, userdata, sizeof(cookie))) { - ret = -EFAULT; - goto ioctl_done; - } - - /* Send the challenge on the control channel */ - if (wmi_get_challenge_resp_cmd(arPriv->arWmi, cookie, APP_HB_CHALLENGE) != A_OK) { - ret = -EIO; - goto ioctl_done; - } - break; - } -#ifdef USER_KEYS - case AR6000_XIOCTL_USER_SETKEYS: - { - - arSta->user_savedkeys_stat = USER_SAVEDKEYS_STAT_RUN; - - if (copy_from_user(&arSta->user_key_ctrl, userdata, - sizeof(arSta->user_key_ctrl))) - { - ret = -EFAULT; - goto ioctl_done; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ar6000 USER set key %x\n", arSta->user_key_ctrl)); - break; - } -#endif /* USER_KEYS */ - -#ifdef CONFIG_HOST_GPIO_SUPPORT - case AR6000_XIOCTL_GPIO_OUTPUT_SET: - { - struct ar6000_gpio_output_set_cmd_s gpio_output_set_cmd; - - if (ar->bIsDestroyProgress) { - ret = -EBUSY; - goto ioctl_done; - } - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } - if (down_interruptible(&ar->arSem)) { - ret = -ERESTARTSYS; - goto ioctl_done; - } - if (ar->bIsDestroyProgress) { - up(&ar->arSem); - ret = -EBUSY; - goto ioctl_done; - } - - if (copy_from_user(&gpio_output_set_cmd, userdata, - sizeof(gpio_output_set_cmd))) - { - ret = -EFAULT; - } else { - ret = ar6000_gpio_output_set(dev, - gpio_output_set_cmd.set_mask, - gpio_output_set_cmd.clear_mask, - gpio_output_set_cmd.enable_mask, - gpio_output_set_cmd.disable_mask); - if (ret != A_OK) { - ret = EIO; - } - } - up(&ar->arSem); - break; - } - case AR6000_XIOCTL_GPIO_INPUT_GET: - { - if (ar->bIsDestroyProgress) { - ret = -EBUSY; - goto ioctl_done; - } - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } - if (down_interruptible(&ar->arSem)) { - ret = -ERESTARTSYS; - goto ioctl_done; - } - if (ar->bIsDestroyProgress) { - up(&ar->arSem); - ret = -EBUSY; - goto ioctl_done; - } - - ret = ar6000_gpio_input_get(dev); - if (ret != A_OK) { - up(&ar->arSem); - ret = -EIO; - goto ioctl_done; - } - - /* Wait for Target to respond. */ - wait_event_interruptible(arPriv->arEvent, gpio_data_available); - if (signal_pending(current)) { - ret = -EINTR; - } else { - A_ASSERT(gpio_reg_results.gpioreg_id == GPIO_ID_NONE); - - if (copy_to_user(userdata, &gpio_reg_results.value, - sizeof(gpio_reg_results.value))) - { - ret = -EFAULT; - } - } - up(&ar->arSem); - break; - } - case AR6000_XIOCTL_GPIO_REGISTER_SET: - { - struct ar6000_gpio_register_cmd_s gpio_register_cmd; - - if (ar->bIsDestroyProgress) { - ret = -EBUSY; - goto ioctl_done; - } - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } - if (down_interruptible(&ar->arSem)) { - ret = -ERESTARTSYS; - goto ioctl_done; - } - if (ar->bIsDestroyProgress) { - up(&ar->arSem); - ret = -EBUSY; - goto ioctl_done; - } - - if (copy_from_user(&gpio_register_cmd, userdata, - sizeof(gpio_register_cmd))) - { - ret = -EFAULT; - } else { - ret = ar6000_gpio_register_set(dev, - gpio_register_cmd.gpioreg_id, - gpio_register_cmd.value); - if (ret != A_OK) { - ret = EIO; - } - - /* Wait for acknowledgement from Target */ - wait_event_interruptible(arPriv->arEvent, gpio_ack_received); - if (signal_pending(current)) { - ret = -EINTR; - } - } - up(&ar->arSem); - break; - } - case AR6000_XIOCTL_GPIO_REGISTER_GET: - { - struct ar6000_gpio_register_cmd_s gpio_register_cmd; - - if (ar->bIsDestroyProgress) { - ret = -EBUSY; - goto ioctl_done; - } - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } - if (down_interruptible(&ar->arSem)) { - ret = -ERESTARTSYS; - goto ioctl_done; - } - if (ar->bIsDestroyProgress) { - up(&ar->arSem); - ret = -EBUSY; - goto ioctl_done; - } - - if (copy_from_user(&gpio_register_cmd, userdata, - sizeof(gpio_register_cmd))) - { - ret = -EFAULT; - } else { - ret = ar6000_gpio_register_get(dev, gpio_register_cmd.gpioreg_id); - if (ret != A_OK) { - up(&ar->arSem); - ret = -EIO; - goto ioctl_done; - } - - /* Wait for Target to respond. */ - wait_event_interruptible(arPriv->arEvent, gpio_data_available); - if (signal_pending(current)) { - ret = -EINTR; - } else { - A_ASSERT(gpio_register_cmd.gpioreg_id == gpio_reg_results.gpioreg_id); - if (copy_to_user(userdata, &gpio_reg_results, - sizeof(gpio_reg_results))) - { - ret = -EFAULT; - } - } - } - up(&ar->arSem); - break; - } - case AR6000_XIOCTL_GPIO_INTR_ACK: - { - struct ar6000_gpio_intr_ack_cmd_s gpio_intr_ack_cmd; - - if (ar->bIsDestroyProgress) { - ret = -EBUSY; - goto ioctl_done; - } - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } - if (down_interruptible(&ar->arSem)) { - ret = -ERESTARTSYS; - goto ioctl_done; - } - - if (ar->bIsDestroyProgress) { - up(&ar->arSem); - ret = -EBUSY; - goto ioctl_done; - } - - if (copy_from_user(&gpio_intr_ack_cmd, userdata, - sizeof(gpio_intr_ack_cmd))) - { - ret = -EFAULT; - } else { - ret = ar6000_gpio_intr_ack(dev, gpio_intr_ack_cmd.ack_mask); - if (ret != A_OK) { - ret = EIO; - } - } - up(&ar->arSem); - break; - } - case AR6000_XIOCTL_GPIO_INTR_WAIT: - { - /* Wait for Target to report an interrupt. */ - wait_event_interruptible(arPriv->arEvent, gpio_intr_available); - - if (signal_pending(current)) { - ret = -EINTR; - } else { - if (copy_to_user(userdata, &gpio_intr_results, - sizeof(gpio_intr_results))) - { - ret = -EFAULT; - } - } - break; - } -#endif /* CONFIG_HOST_GPIO_SUPPORT */ - - case AR6000_XIOCTL_DBGLOG_CFG_MODULE: - { - struct ar6000_dbglog_module_config_s config; - - if (copy_from_user(&config, userdata, sizeof(config))) { - ret = -EFAULT; - goto ioctl_done; - } - - /* Send the challenge on the control channel */ - if (wmi_config_debug_module_cmd(arPriv->arWmi, config.mmask, - config.tsr, config.rep, - config.size, config.valid) != A_OK) - { - ret = -EIO; - goto ioctl_done; - } - break; - } - - case AR6000_XIOCTL_DBGLOG_GET_DEBUG_LOGS: - { - /* Send the challenge on the control channel */ - if (ar6000_dbglog_get_debug_logs(ar) != A_OK) - { - ret = -EIO; - goto ioctl_done; - } - break; - } - - case AR6000_XIOCTL_SET_ADHOC_BSSID: - { - WMI_SET_ADHOC_BSSID_CMD adhocBssid; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&adhocBssid, userdata, - sizeof(adhocBssid))) - { - ret = -EFAULT; - } else if (A_MEMCMP(adhocBssid.bssid, bcast_mac, - AR6000_ETH_ADDR_LEN) == 0) - { - ret = -EFAULT; - } else { - - A_MEMCPY(arSta->arReqBssid, adhocBssid.bssid, sizeof(arSta->arReqBssid)); - } - break; - } - - case AR6000_XIOCTL_WMI_SETRETRYLIMITS: - { - WMI_SET_RETRY_LIMITS_CMD setRetryParams; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&setRetryParams, userdata, - sizeof(setRetryParams))) - { - ret = -EFAULT; - } else { - if (wmi_set_retry_limits_cmd(arPriv->arWmi, setRetryParams.frameType, - setRetryParams.trafficClass, - setRetryParams.maxRetries, - setRetryParams.enableNotify) != A_OK) - { - ret = -EIO; - } - AR6000_SPIN_LOCK(&arPriv->arPrivLock, 0); - arPriv->arMaxRetries = setRetryParams.maxRetries; - AR6000_SPIN_UNLOCK(&arPriv->arPrivLock, 0); - } - break; - } - - case AR6000_XIOCTL_SET_BEACON_INTVAL: - { - WMI_BEACON_INT_CMD bIntvlCmd; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&bIntvlCmd, userdata, - sizeof(bIntvlCmd))) - { - ret = -EFAULT; - } else if (wmi_set_adhoc_bconIntvl_cmd(arPriv->arWmi, bIntvlCmd.beaconInterval) - != A_OK) - { - ret = -EIO; - } - if(ret == 0) { - arAp->ap_beacon_interval = bIntvlCmd.beaconInterval; - arPriv->ap_profile_flag = 1; /* There is a change in profile */ - } - break; - } - case IEEE80211_IOCTL_SETAUTHALG: - { - struct ieee80211req_authalg req; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&req, userdata, - sizeof(struct ieee80211req_authalg))) - { - ret = -EFAULT; - } else { - if (req.auth_alg & AUTH_ALG_OPEN_SYSTEM) { - arPriv->arDot11AuthMode |= OPEN_AUTH; - arPriv->arPairwiseCrypto = NONE_CRYPT; - arPriv->arGroupCrypto = NONE_CRYPT; - } - if (req.auth_alg & AUTH_ALG_SHARED_KEY) { - arPriv->arDot11AuthMode |= SHARED_AUTH; - arPriv->arPairwiseCrypto = WEP_CRYPT; - arPriv->arGroupCrypto = WEP_CRYPT; - arPriv->arAuthMode = WMI_NONE_AUTH; - } - if (req.auth_alg == AUTH_ALG_LEAP) { - arPriv->arDot11AuthMode = LEAP_AUTH; - } - } - break; - } - - case AR6000_XIOCTL_SET_VOICE_PKT_SIZE: - ret = ar6000_xioctl_set_voice_pkt_size(dev, userdata); - break; - - case AR6000_XIOCTL_SET_MAX_SP: - ret = ar6000_xioctl_set_max_sp_len(dev, userdata); - break; - - case AR6000_XIOCTL_WMI_GET_ROAM_TBL: - ret = ar6000_ioctl_get_roam_tbl(dev, rq); - break; - case AR6000_XIOCTL_WMI_SET_ROAM_CTRL: - ret = ar6000_ioctl_set_roam_ctrl(dev, userdata); - break; - case AR6000_XIOCTRL_WMI_SET_POWERSAVE_TIMERS: - ret = ar6000_ioctl_set_powersave_timers(dev, userdata); - break; - case AR6000_XIOCTRL_WMI_GET_POWER_MODE: - ret = ar6000_ioctl_get_power_mode(dev, rq); - break; - - case AR6000_XIOCTRL_WMI_SET_WLAN_STATE: - { - AR6000_WLAN_STATE state; - get_user(state, (unsigned int *)userdata); - if (ar6000_set_wlan_state(ar, state)!=A_OK) { - ret = -EIO; - } - break; - } - - case AR6000_XIOCTL_WMI_GET_ROAM_DATA: - ret = ar6000_ioctl_get_roam_data(dev, rq); - break; - - case AR6000_XIOCTL_WMI_SET_BT_STATUS: - ret = ar6000_xioctl_set_bt_status_cmd(dev, userdata); - break; - - case AR6000_XIOCTL_WMI_SET_BT_PARAMS: - ret = ar6000_xioctl_set_bt_params_cmd(dev, userdata); - break; - - case AR6000_XIOCTL_WMI_SET_BTCOEX_FE_ANT: - ret = ar6000_xioctl_set_btcoex_fe_ant_cmd(dev, userdata); - break; - - case AR6000_XIOCTL_WMI_SET_BTCOEX_COLOCATED_BT_DEV: - ret = ar6000_xioctl_set_btcoex_colocated_bt_dev_cmd(dev, userdata); - break; - - case AR6000_XIOCTL_WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG: - ret = ar6000_xioctl_set_btcoex_btinquiry_page_config_cmd(dev, userdata); - break; - - case AR6000_XIOCTL_WMI_SET_BTCOEX_SCO_CONFIG: - ret = ar6000_xioctl_set_btcoex_sco_config_cmd( dev, userdata); - break; - - case AR6000_XIOCTL_WMI_SET_BTCOEX_A2DP_CONFIG: - ret = ar6000_xioctl_set_btcoex_a2dp_config_cmd(dev, userdata); - break; - - case AR6000_XIOCTL_WMI_SET_BTCOEX_ACLCOEX_CONFIG: - ret = ar6000_xioctl_set_btcoex_aclcoex_config_cmd(dev, userdata); - break; - - case AR6000_XIOCTL_WMI_SET_BTCOEX_DEBUG: - ret = ar60000_xioctl_set_btcoex_debug_cmd(dev, userdata); - break; - - case AR6000_XIOCTL_WMI_SET_BT_OPERATING_STATUS: - ret = ar6000_xioctl_set_btcoex_bt_operating_status_cmd(dev, userdata); - break; - - case AR6000_XIOCTL_WMI_GET_BTCOEX_CONFIG: - ret = ar6000_xioctl_get_btcoex_config_cmd(dev, userdata, rq); - break; - - case AR6000_XIOCTL_WMI_GET_BTCOEX_STATS: - ret = ar6000_xioctl_get_btcoex_stats_cmd(dev, userdata, rq); - break; - - case AR6000_XIOCTL_WMI_STARTSCAN: - { - WMI_START_SCAN_CMD setStartScanCmd, *cmdp; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&setStartScanCmd, userdata, - sizeof(setStartScanCmd))) - { - ret = -EFAULT; - } else { - if (setStartScanCmd.numChannels > 1) { - cmdp = A_MALLOC(130); - if (copy_from_user(cmdp, userdata, - sizeof (*cmdp) + - ((setStartScanCmd.numChannels - 1) * - sizeof(A_UINT16)))) - { - A_FREE(cmdp); - ret = -EFAULT; - goto ioctl_done; - } - } else { - cmdp = &setStartScanCmd; - } - - if (wmi_startscan_cmd(arPriv->arWmi, cmdp->scanType, - cmdp->forceFgScan, - cmdp->isLegacy, - cmdp->homeDwellTime, - cmdp->forceScanInterval, - cmdp->numChannels, - cmdp->channelList) != A_OK) - { - ret = -EIO; - } - if (setStartScanCmd.numChannels > 1) { - A_FREE(cmdp); - } - } - break; - } - case AR6000_XIOCTL_WMI_SETFIXRATES: - { - WMI_FIX_RATES_CMD setFixRatesCmd; - A_STATUS returnStatus; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&setFixRatesCmd, userdata, - sizeof(setFixRatesCmd))) - { - ret = -EFAULT; - } else { - returnStatus = wmi_set_fixrates_cmd(arPriv->arWmi, setFixRatesCmd.fixRateMask); - if (returnStatus == A_EINVAL) { - ret = -EINVAL; - } else if(returnStatus != A_OK) { - ret = -EIO; - } else { - arPriv->ap_profile_flag = 1; /* There is a change in profile */ - } - } - break; - } - - case AR6000_XIOCTL_WMI_GETFIXRATES: - { - WMI_FIX_RATES_CMD getFixRatesCmd; - int ret = 0; - - if (ar->bIsDestroyProgress) { - ret = -EBUSY; - goto ioctl_done; - } - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } - - if (down_interruptible(&ar->arSem)) { - ret = -ERESTARTSYS; - goto ioctl_done; - } - if (ar->bIsDestroyProgress) { - up(&ar->arSem); - ret = -EBUSY; - goto ioctl_done; - } - /* Used copy_from_user/copy_to_user to access user space data */ - if (copy_from_user(&getFixRatesCmd, userdata, sizeof(getFixRatesCmd))) { - ret = -EFAULT; - } else { - arPriv->arRateMask[0] = 0xFFFFFFFF; - arPriv->arRateMask[1] = 0xFFFFFFFF; - - if (wmi_get_ratemask_cmd(arPriv->arWmi) != A_OK) { - up(&ar->arSem); - ret = -EIO; - goto ioctl_done; - } - - wait_event_interruptible_timeout(arPriv->arEvent, (arPriv->arRateMask[0] != 0xFFFFFFFF) && - (arPriv->arRateMask[1] != 0xFFFFFFFF), wmitimeout * HZ); - - if (signal_pending(current)) { - ret = -EINTR; - } - - if (!ret) { - getFixRatesCmd.fixRateMask[0] = arPriv->arRateMask[0]; - getFixRatesCmd.fixRateMask[1] = arPriv->arRateMask[1]; - } - - if(copy_to_user(userdata, &getFixRatesCmd, sizeof(getFixRatesCmd))) { - ret = -EFAULT; - } - - up(&ar->arSem); - } - break; - } - case AR6000_XIOCTL_WMI_SET_AUTHMODE: - { - WMI_SET_AUTH_MODE_CMD setAuthMode; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&setAuthMode, userdata, - sizeof(setAuthMode))) { - ret = -EFAULT; - } else { - if (wmi_set_authmode_cmd(arPriv->arWmi, setAuthMode.mode) != A_OK) - { - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_WMI_SET_REASSOCMODE: - { - WMI_SET_REASSOC_MODE_CMD setReassocMode; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&setReassocMode, userdata, - sizeof(setReassocMode))) { - ret = -EFAULT; - } else { - if (wmi_set_reassocmode_cmd(arPriv->arWmi, setReassocMode.mode) != A_OK) - { - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_DIAG_READ: - { - A_UINT32 addr, data; - get_user(addr, (unsigned int *)userdata); - addr = TARG_VTOP(ar->arTargetType, addr); - if (ar6000_ReadRegDiag(ar->arHifDevice, &addr, &data) != A_OK) { - ret = -EIO; - } - put_user(data, (unsigned int *)userdata + 1); - break; - } - case AR6000_XIOCTL_DIAG_WRITE: - { - A_UINT32 addr, data; - get_user(addr, (unsigned int *)userdata); - get_user(data, (unsigned int *)userdata + 1); - addr = TARG_VTOP(ar->arTargetType, addr); - if (ar6000_WriteRegDiag(ar->arHifDevice, &addr, &data) != A_OK) { - ret = -EIO; - } - break; - } - case AR6000_XIOCTL_WMI_SET_KEEPALIVE: - { - WMI_SET_KEEPALIVE_CMD setKeepAlive; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } else if (copy_from_user(&setKeepAlive, userdata, - sizeof(setKeepAlive))){ - ret = -EFAULT; - } else { - if (wmi_set_keepalive_cmd(arPriv->arWmi, setKeepAlive.keepaliveInterval) != A_OK) { - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_WMI_SET_PARAMS: - { - WMI_SET_PARAMS_CMD cmd; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } else if (copy_from_user(&cmd, userdata, - sizeof(cmd))){ - ret = -EFAULT; - } else if (copy_from_user(&cmd, userdata, - sizeof(cmd) + cmd.length)) - { - ret = -EFAULT; - } else { - if (wmi_set_params_cmd(arPriv->arWmi, cmd.opcode, cmd.length, cmd.buffer) != A_OK) { - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_WMI_SET_MCAST_FILTER: - { - WMI_SET_MCAST_FILTER_CMD cmd; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } else if (copy_from_user(&cmd, userdata, - sizeof(cmd))){ - ret = -EFAULT; - } else { - if (wmi_set_mcast_filter_cmd(arPriv->arWmi, &cmd.multicast_mac[0]) != A_OK) { - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_WMI_DEL_MCAST_FILTER: - { - WMI_SET_MCAST_FILTER_CMD cmd; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } else if (copy_from_user(&cmd, userdata, - sizeof(cmd))){ - ret = -EFAULT; - } else { - if (wmi_del_mcast_filter_cmd(arPriv->arWmi, &cmd.multicast_mac[0]) != A_OK) { - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_WMI_MCAST_FILTER: - { - WMI_MCAST_FILTER_CMD cmd; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } else if (copy_from_user(&cmd, userdata, - sizeof(cmd))){ - ret = -EFAULT; - } else { - if (wmi_mcast_filter_cmd(arPriv->arWmi, cmd.enable) != A_OK) { - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_WMI_GET_KEEPALIVE: - { - WMI_GET_KEEPALIVE_CMD getKeepAlive; - int ret = 0; - if (ar->bIsDestroyProgress) { - ret =-EBUSY; - goto ioctl_done; - } - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } - if (down_interruptible(&ar->arSem)) { - ret = -ERESTARTSYS; - goto ioctl_done; - } - if (ar->bIsDestroyProgress) { - up(&ar->arSem); - ret = -EBUSY; - goto ioctl_done; - } - if (copy_from_user(&getKeepAlive, userdata,sizeof(getKeepAlive))) { - ret = -EFAULT; - } else { - getKeepAlive.keepaliveInterval = wmi_get_keepalive_cmd(arPriv->arWmi); - arSta->arKeepaliveConfigured = 0xFF; - if (wmi_get_keepalive_configured(arPriv->arWmi) != A_OK){ - up(&ar->arSem); - ret = -EIO; - goto ioctl_done; - } - wait_event_interruptible_timeout(arPriv->arEvent, arSta->arKeepaliveConfigured != 0xFF, wmitimeout * HZ); - if (signal_pending(current)) { - ret = -EINTR; - } - - if (!ret) { - getKeepAlive.configured = arSta->arKeepaliveConfigured; - } - if (copy_to_user(userdata, &getKeepAlive, sizeof(getKeepAlive))) { - ret = -EFAULT; - } - } - up(&ar->arSem); - break; - } - case AR6000_XIOCTL_WMI_SET_APPIE: - { - WMI_SET_APPIE_CMD appIEcmd; - A_UINT8 appIeInfo[IEEE80211_APPIE_FRAME_MAX_LEN]; - A_UINT32 fType,ieLen; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } - get_user(fType, (A_UINT32 *)userdata); - appIEcmd.mgmtFrmType = fType; - if (appIEcmd.mgmtFrmType >= IEEE80211_APPIE_NUM_OF_FRAME) { - ret = -EIO; - } else { - get_user(ieLen, (A_UINT32 *)(userdata + 4)); - appIEcmd.ieLen = ieLen; - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("WPSIE: Type-%d, Len-%d\n",appIEcmd.mgmtFrmType, appIEcmd.ieLen)); - if (appIEcmd.ieLen > IEEE80211_APPIE_FRAME_MAX_LEN) { - ret = -EIO; - break; - } - if (copy_from_user(appIeInfo, userdata + 8, appIEcmd.ieLen)) { - ret = -EFAULT; - } else { - if (wmi_set_appie_cmd(arPriv->arWmi, appIEcmd.mgmtFrmType, - appIEcmd.ieLen, appIeInfo) != A_OK) - { - ret = -EIO; - } - } - } - break; - } - case AR6000_XIOCTL_WMI_SET_MGMT_FRM_RX_FILTER: - { - WMI_BSS_FILTER_CMD cmd; - A_UINT32 filterType; - - if (copy_from_user(&filterType, userdata, sizeof(A_UINT32))) - { - ret = -EFAULT; - goto ioctl_done; - } - if (filterType & (IEEE80211_FILTER_TYPE_BEACON | - IEEE80211_FILTER_TYPE_PROBE_RESP)) - { - cmd.bssFilter = ALL_BSS_FILTER; - } else { - cmd.bssFilter = NONE_BSS_FILTER; - } - if (wmi_bssfilter_cmd(arPriv->arWmi, cmd.bssFilter, 0) != A_OK) { - ret = -EIO; - } else { - arSta->arUserBssFilter = cmd.bssFilter; - } - - AR6000_SPIN_LOCK(&arPriv->arPrivLock, 0); - arSta->arMgmtFilter = filterType; - AR6000_SPIN_UNLOCK(&arPriv->arPrivLock, 0); - break; - } - case AR6000_XIOCTL_WMI_SET_WSC_STATUS: - { - A_UINT32 wsc_status; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - goto ioctl_done; - } else if (copy_from_user(&wsc_status, userdata, sizeof(A_UINT32))) { - ret = -EFAULT; - goto ioctl_done; - } - if (wmi_set_wsc_status_cmd(arPriv->arWmi, wsc_status) != A_OK) { - ret = -EIO; - } - break; - } - case AR6000_XIOCTL_BMI_ROMPATCH_INSTALL: - { - A_UINT32 ROM_addr; - A_UINT32 RAM_addr; - A_UINT32 nbytes; - A_UINT32 do_activate; - A_UINT32 rompatch_id; - - get_user(ROM_addr, (A_UINT32 *)userdata); - get_user(RAM_addr, (A_UINT32 *)userdata + 1); - get_user(nbytes, (A_UINT32 *)userdata + 2); - get_user(do_activate, (A_UINT32 *)userdata + 3); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Install rompatch from ROM: 0x%x to RAM: 0x%x length: %d\n", - ROM_addr, RAM_addr, nbytes)); - ret = BMIrompatchInstall(hifDevice, ROM_addr, RAM_addr, - nbytes, do_activate, &rompatch_id); - if (ret == A_OK) { - put_user(rompatch_id, (unsigned int *)rq->ifr_data); /* return value */ - } - break; - } - - case AR6000_XIOCTL_BMI_ROMPATCH_UNINSTALL: - { - A_UINT32 rompatch_id; - - get_user(rompatch_id, (A_UINT32 *)userdata); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("UNinstall rompatch_id %d\n", rompatch_id)); - ret = BMIrompatchUninstall(hifDevice, rompatch_id); - break; - } - - case AR6000_XIOCTL_BMI_ROMPATCH_ACTIVATE: - case AR6000_XIOCTL_BMI_ROMPATCH_DEACTIVATE: - { - A_UINT32 rompatch_count; - - get_user(rompatch_count, (A_UINT32 *)userdata); - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Change rompatch activation count=%d\n", rompatch_count)); - length = sizeof(A_UINT32) * rompatch_count; - if ((buffer = (unsigned char *)A_MALLOC(length)) != NULL) { - A_MEMZERO(buffer, length); - if (copy_from_user(buffer, &userdata[sizeof(rompatch_count)], length)) - { - ret = -EFAULT; - } else { - if (cmd == AR6000_XIOCTL_BMI_ROMPATCH_ACTIVATE) { - ret = BMIrompatchActivate(hifDevice, rompatch_count, (A_UINT32 *)buffer); - } else { - ret = BMIrompatchDeactivate(hifDevice, rompatch_count, (A_UINT32 *)buffer); - } - } - A_FREE(buffer); - } else { - ret = -ENOMEM; - } - - break; - } - case AR6000_XIOCTL_SET_IP: - { - WMI_SET_IP_CMD setIP; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&setIP, userdata, - sizeof(setIP))) { - ret = -EFAULT; - } else { - if (wmi_set_ip_cmd(arPriv->arWmi, - &setIP) != A_OK) - { - ret = -EIO; - } - } - break; - } - - case AR6000_XIOCTL_WMI_SET_HOST_SLEEP_MODE: - { - WMI_SET_HOST_SLEEP_MODE_CMD setHostSleepMode; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&setHostSleepMode, userdata, - sizeof(setHostSleepMode))) { - ret = -EFAULT; - } else { - if (wmi_set_host_sleep_mode_cmd(arPriv->arWmi, - &setHostSleepMode) != A_OK) - { - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_WMI_SET_WOW_MODE: - { - WMI_SET_WOW_MODE_CMD setWowMode; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&setWowMode, userdata, - sizeof(setWowMode))) { - ret = -EFAULT; - } else { - if (wmi_set_wow_mode_cmd(arPriv->arWmi, - &setWowMode) != A_OK) - { - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_WMI_GET_WOW_LIST: - { - WMI_GET_WOW_LIST_CMD getWowList; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&getWowList, userdata, - sizeof(getWowList))) { - ret = -EFAULT; - } else { - if (wmi_get_wow_list_cmd(arPriv->arWmi, - &getWowList) != A_OK) - { - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_WMI_ADD_WOW_PATTERN: - { -#define WOW_PATTERN_SIZE 64 -#define WOW_MASK_SIZE 64 - - WMI_ADD_WOW_PATTERN_CMD cmd; - A_UINT8 mask_data[WOW_PATTERN_SIZE]={0}; - A_UINT8 pattern_data[WOW_PATTERN_SIZE]={0}; - - do { - if (ar->arWmiReady == FALSE) { - ret = -EIO; - break; - } - if(copy_from_user(&cmd, userdata, - sizeof(WMI_ADD_WOW_PATTERN_CMD))) - { - ret = -EFAULT; - break; - } - if (copy_from_user(pattern_data, - userdata + 3, - cmd.filter_size)) - { - ret = -EFAULT; - break; - } - if (copy_from_user(mask_data, - (userdata + 3 + cmd.filter_size), - cmd.filter_size)) - { - ret = -EFAULT; - break; - } - if (wmi_add_wow_pattern_cmd(arPriv->arWmi, - &cmd, pattern_data, mask_data, cmd.filter_size) != A_OK) - { - ret = -EIO; - } - } while(FALSE); -#undef WOW_PATTERN_SIZE -#undef WOW_MASK_SIZE - break; - } - case AR6000_XIOCTL_WMI_DEL_WOW_PATTERN: - { - WMI_DEL_WOW_PATTERN_CMD delWowPattern; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&delWowPattern, userdata, - sizeof(delWowPattern))) { - ret = -EFAULT; - } else { - if (wmi_del_wow_pattern_cmd(arPriv->arWmi, - &delWowPattern) != A_OK) - { - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_DUMP_HTC_CREDIT_STATE: - if (ar->arHtcTarget != NULL) { -#ifdef ATH_DEBUG_MODULE - HTCDumpCreditStates(ar->arHtcTarget); -#endif /* ATH_DEBUG_MODULE */ -#ifdef HTC_EP_STAT_PROFILING - { - HTC_ENDPOINT_STATS stats; - int i; - - for (i = 0; i < 5; i++) { - if (HTCGetEndpointStatistics(ar->arHtcTarget, - i, - HTC_EP_STAT_SAMPLE_AND_CLEAR, - &stats)) { - A_PRINTF(KERN_ALERT"------- Profiling Endpoint : %d \n", i); - A_PRINTF(KERN_ALERT"TxCreditLowIndications : %d \n", stats.TxCreditLowIndications); - A_PRINTF(KERN_ALERT"TxIssued : %d \n", stats.TxIssued); - A_PRINTF(KERN_ALERT"TxDropped: %d \n", stats.TxDropped); - A_PRINTF(KERN_ALERT"TxPacketsBundled : %d \n", stats.TxPacketsBundled); - A_PRINTF(KERN_ALERT"TxBundles : %d \n", stats.TxBundles); - A_PRINTF(KERN_ALERT"TxCreditRpts : %d \n", stats.TxCreditRpts); - A_PRINTF(KERN_ALERT"TxCreditsRptsFromRx : %d \n", stats.TxCreditRptsFromRx); - A_PRINTF(KERN_ALERT"TxCreditsRptsFromOther : %d \n", stats.TxCreditRptsFromOther); - A_PRINTF(KERN_ALERT"TxCreditsRptsFromEp0 : %d \n", stats.TxCreditRptsFromEp0); - A_PRINTF(KERN_ALERT"TxCreditsFromRx : %d \n", stats.TxCreditsFromRx); - A_PRINTF(KERN_ALERT"TxCreditsFromOther : %d \n", stats.TxCreditsFromOther); - A_PRINTF(KERN_ALERT"TxCreditsFromEp0 : %d \n", stats.TxCreditsFromEp0); - A_PRINTF(KERN_ALERT"TxCreditsConsummed : %d \n", stats.TxCreditsConsummed); - A_PRINTF(KERN_ALERT"TxCreditsReturned : %d \n", stats.TxCreditsReturned); - A_PRINTF(KERN_ALERT"RxReceived : %d \n", stats.RxReceived); - A_PRINTF(KERN_ALERT"RxPacketsBundled : %d \n", stats.RxPacketsBundled); - A_PRINTF(KERN_ALERT"RxLookAheads : %d \n", stats.RxLookAheads); - A_PRINTF(KERN_ALERT"RxBundleLookAheads : %d \n", stats.RxBundleLookAheads); - A_PRINTF(KERN_ALERT"RxBundleIndFromHdr : %d \n", stats.RxBundleIndFromHdr); - A_PRINTF(KERN_ALERT"RxAllocThreshHit : %d \n", stats.RxAllocThreshHit); - A_PRINTF(KERN_ALERT"RxAllocThreshBytes : %d \n", stats.RxAllocThreshBytes); - A_PRINTF(KERN_ALERT"---- \n"); - - } - } - } -#endif - } - break; - case AR6000_XIOCTL_TRAFFIC_ACTIVITY_CHANGE: - if (ar->arHtcTarget != NULL) { - struct ar6000_traffic_activity_change data; - - if (copy_from_user(&data, userdata, sizeof(data))) - { - ret = -EFAULT; - goto ioctl_done; - } - /* note, this is used for testing (mbox ping testing), indicate activity - * change using the stream ID as the traffic class */ - ar6000_indicate_tx_activity(arPriv, - (A_UINT8)data.StreamID, - data.Active ? TRUE : FALSE); - } - break; - case AR6000_XIOCTL_WMI_SET_CONNECT_CTRL_FLAGS: - { - A_UINT32 connectCtrlFlags; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&connectCtrlFlags, userdata, - sizeof(connectCtrlFlags))) - { - ret = -EFAULT; - } else { - arSta->arConnectCtrlFlags = connectCtrlFlags; - } - } - break; - case AR6000_XIOCTL_WMI_SET_AKMP_PARAMS: - { - WMI_SET_AKMP_PARAMS_CMD akmpParams; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&akmpParams, userdata, - sizeof(WMI_SET_AKMP_PARAMS_CMD))) - { - ret = -EFAULT; - } else { - if (wmi_set_akmp_params_cmd(arPriv->arWmi, &akmpParams) != A_OK) { - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_WMI_SET_PMKID_LIST: - { - WMI_SET_PMKID_LIST_CMD pmkidInfo; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - break; - } - if (copy_from_user(&pmkidInfo.numPMKID, userdata, - sizeof(pmkidInfo.numPMKID))) { - ret = -EFAULT; - break; - } - if (copy_from_user(&pmkidInfo.pmkidList, - userdata + sizeof(pmkidInfo.numPMKID), - pmkidInfo.numPMKID * sizeof(WMI_PMKID))) - { - ret = -EFAULT; - break; - } - if (wmi_set_pmkid_list_cmd(arPriv->arWmi, &pmkidInfo) != A_OK) { - ret = -EIO; - } - break; - } - case AR6000_XIOCTL_WMI_GET_PMKID_LIST: - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (wmi_get_pmkid_list_cmd(arPriv->arWmi) != A_OK) { - ret = -EIO; - } - break; - case AR6000_XIOCTL_WMI_ABORT_SCAN: - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } - ret = wmi_abort_scan_cmd(arPriv->arWmi); - break; - case AR6000_XIOCTL_AP_HIDDEN_SSID: - { - A_UINT8 hidden_ssid; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&hidden_ssid, userdata, sizeof(hidden_ssid))) { - ret = -EFAULT; - } else { - wmi_ap_set_hidden_ssid(arPriv->arWmi, hidden_ssid); - arAp->ap_hidden_ssid = hidden_ssid; - arPriv->ap_profile_flag = 1; /* There is a change in profile */ - } - break; - } - case AR6000_XIOCTL_AP_GET_STA_LIST: - { - WMI_SET_HT_CAP_CMD htCap; - - htCap.band = A_BAND_24GHZ; - if(arPriv->phymode == WMI_11A_MODE) { - htCap.band = A_BAND_5GHZ; - } - wmi_get_ht_cap_cmd(arPriv->arWmi, &htCap); - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else { - A_UINT8 i, j=0; - ap_get_sta_t temp; - A_MEMZERO(&temp, sizeof(temp)); - for(i=0;iconnTbl[i].arPriv == arPriv) { - A_MEMCPY(temp.sta[j].mac, ar->connTbl[i].mac, ATH_MAC_LEN); - temp.sta[j].aid = ar->connTbl[i].aid; - temp.sta[j].keymgmt = ar->connTbl[i].keymgmt; - temp.sta[j].ucipher = ar->connTbl[i].ucipher; - temp.sta[j].auth = ar->connTbl[i].auth; - temp.sta[j].wmode = ar->connTbl[i].wmode; - if(htCap.enable == 2) { - /* Set MSB to indicate 11n-only mode */ - temp.sta[j].wmode |= 0x80; - } - j++; - } - } - if(copy_to_user((ap_get_sta_t *)rq->ifr_data, &temp, sizeof(temp))) { - ret = -EFAULT; - } - } - break; - } - case AR6000_XIOCTL_AP_SET_NUM_STA: - { - A_UINT8 num_sta; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&num_sta, userdata, sizeof(num_sta))) { - ret = -EFAULT; - } else { - ret = ar6000_ap_set_num_sta(ar, arPriv, num_sta); - } - break; - } - case AR6000_XIOCTL_AP_SET_DFS: - { -#ifdef ATH_SUPPORT_DFS - A_UINT8 enable; - if (copy_from_user(&enable, userdata, sizeof(enable))) { - ret = -EFAULT; - } else { - wmi_ap_set_dfs(arPriv->arWmi, enable); - } -#else - ret = -EIO; -#endif - break; - } - - case AR6000_XIOCTL_AP_SET_ACL_POLICY: - { - A_UINT8 policy; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&policy, userdata, sizeof(policy))) { - ret = -EFAULT; - } else { - if(!(policy & AP_ACL_RETAIN_LIST_MASK)) { - /* clear ACL list */ - memset(&arAp->g_acl,0,sizeof(WMI_AP_ACL)); - } - arAp->g_acl.policy = policy; - wmi_ap_set_acl_policy(arPriv->arWmi, policy); - } - break; - } - case AR6000_XIOCTL_AP_SET_ACL_MAC: - { - WMI_AP_ACL_MAC_CMD acl; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&acl, userdata, sizeof(acl))) { - ret = -EFAULT; - } else { - if(acl_add_del_mac(&arAp->g_acl, &acl)) { - wmi_ap_acl_mac_list(arPriv->arWmi, &acl); - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ACL list error\n")); - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_AP_GET_ACL_LIST: - { - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if(copy_to_user((WMI_AP_ACL *)rq->ifr_data, &arAp->g_acl, - sizeof(WMI_AP_ACL))) { - ret = -EFAULT; - } - break; - } - case AR6000_XIOCTL_AP_COMMIT_CONFIG: - { - ret = ar6000_ap_mode_profile_commit(arPriv); - break; - } - case IEEE80211_IOCTL_GETWPAIE: - { - struct ieee80211req_wpaie wpaie; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&wpaie, userdata, sizeof(wpaie))) { - ret = -EFAULT; - } else if (ar6000_ap_mode_get_wpa_ie(arPriv, &wpaie)) { - ret = -EFAULT; - } else if(copy_to_user(userdata, &wpaie, sizeof(wpaie))) { - ret = -EFAULT; - } - break; - } - case AR6000_XIOCTL_AP_CONN_INACT_TIME: - { - A_UINT32 period; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&period, userdata, sizeof(period))) { - ret = -EFAULT; - } else { - wmi_ap_conn_inact_time(arPriv->arWmi, period); - } - break; - } - case AR6000_XIOCTL_AP_PROT_SCAN_TIME: - { - WMI_AP_PROT_SCAN_TIME_CMD bgscan; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&bgscan, userdata, sizeof(bgscan))) { - ret = -EFAULT; - } else { - wmi_ap_bgscan_time(arPriv->arWmi, bgscan.period_min, bgscan.dwell_ms); - } - break; - } - case AR6000_XIOCTL_AP_SET_COUNTRY: - { - ret = ar6000_ioctl_set_country(dev, rq); - break; - } - case AR6000_XIOCTL_AP_SET_DTIM: - { - WMI_AP_SET_DTIM_CMD d; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&d, userdata, sizeof(d))) { - ret = -EFAULT; - } else { - if(d.dtim > 0 && d.dtim < 11) { - arAp->ap_dtim_period = d.dtim; - wmi_ap_set_dtim(arPriv->arWmi, d.dtim); - arPriv->ap_profile_flag = 1; /* There is a change in profile */ - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("DTIM out of range. Valid range is [1-10]\n")); - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_WMI_TARGET_EVENT_REPORT: - { - WMI_SET_TARGET_EVENT_REPORT_CMD evtCfgCmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } - if (copy_from_user(&evtCfgCmd, userdata, - sizeof(evtCfgCmd))) { - ret = -EFAULT; - break; - } - ret = wmi_set_target_event_report_cmd(arPriv->arWmi, &evtCfgCmd); - break; - } - case AR6000_XIOCTL_AP_CTRL_BSS_COMM: - { - A_UINT8 intra=0; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&intra, userdata, sizeof(intra))) { - ret = -EFAULT; - } else { - if(intra & 0x80) { /* interbss */ - ar->inter_bss = ( (intra & 0xF) ? 1 : 0 ); - } else { - arAp->intra_bss = ( intra ? 1 : 0 ); - } - } - /* If P2P is enabled on this device, also indicate intra_bss setting to the firmware - * so that it can be reflected in the Group Capability bit of the p2p-go. - */ -#ifdef P2P - { - NETWORK_SUBTYPE networkSubType = arPriv->arNetworkSubType; - - if (networkSubType == SUBTYPE_P2PDEV || - networkSubType == SUBTYPE_P2PCLIENT || - networkSubType == SUBTYPE_P2PGO) { - - WMI_P2P_SET_CMD set_p2p_config; - A_MEMZERO(&set_p2p_config, sizeof(WMI_P2P_SET_CMD)); - - set_p2p_config.config_id = WMI_P2P_CONFID_INTRA_BSS; - set_p2p_config.val.intra_bss.flag = intra; - - wmi_p2p_set_cmd(arPriv->arWmi, &set_p2p_config); - } - } -#endif /* P2P */ - break; - } - case AR6000_XIOCTL_DUMP_MODULE_DEBUG_INFO: - { - struct drv_debug_module_s moduleinfo; - - if (copy_from_user(&moduleinfo, userdata, sizeof(moduleinfo))) { - ret = -EFAULT; - break; - } - - a_dump_module_debug_info_by_name(moduleinfo.modulename); - ret = 0; - break; - } - case AR6000_XIOCTL_MODULE_DEBUG_SET_MASK: - { - struct drv_debug_module_s moduleinfo; - - if (copy_from_user(&moduleinfo, userdata, sizeof(moduleinfo))) { - ret = -EFAULT; - break; - } - - if (A_FAILED(a_set_module_mask(moduleinfo.modulename, moduleinfo.mask))) { - ret = -EFAULT; - } - - break; - } - case AR6000_XIOCTL_MODULE_DEBUG_GET_MASK: - { - struct drv_debug_module_s moduleinfo; - - if (copy_from_user(&moduleinfo, userdata, sizeof(moduleinfo))) { - ret = -EFAULT; - break; - } - - if (A_FAILED(a_get_module_mask(moduleinfo.modulename, &moduleinfo.mask))) { - ret = -EFAULT; - break; - } - - if (copy_to_user(userdata, &moduleinfo, sizeof(moduleinfo))) { - ret = -EFAULT; - break; - } - - break; - } -#ifdef ATH_AR6K_11N_SUPPORT - case AR6000_XIOCTL_DUMP_RCV_AGGR_STATS: - { - PACKET_LOG *copy_of_pkt_log; - - aggr_dump_stats(ar->connTbl[0].conn_aggr, ©_of_pkt_log); - if (copy_to_user(rq->ifr_data, copy_of_pkt_log, sizeof(PACKET_LOG))) { - ret = -EFAULT; - } - break; - } - case AR6000_XIOCTL_SETUP_AGGR: - { - WMI_ADDBA_REQ_CMD cmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - ret = -EFAULT; - } else { - wmi_setup_aggr_cmd(arPriv->arWmi, cmd.tid); - } - } - break; - - case AR6000_XIOCTL_DELE_AGGR: - { - WMI_DELBA_REQ_CMD cmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - ret = -EFAULT; - } else { - wmi_delete_aggr_cmd(arPriv->arWmi, cmd.tid, cmd.is_sender_initiator); - } - } - break; - - case AR6000_XIOCTL_ALLOW_AGGR: - { - WMI_ALLOW_AGGR_CMD cmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - ret = -EFAULT; - } else { - wmi_allow_aggr_cmd(arPriv->arWmi, cmd.tx_allow_aggr, cmd.rx_allow_aggr); - } - } - break; - - case AR6000_XIOCTL_SET_HT_CAP: - { - WMI_SET_HT_CAP_CMD htCap; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&htCap, userdata, sizeof(htCap))) { - ret = -EFAULT; - } else if (wmi_set_ht_cap_cmd(arPriv->arWmi, &htCap) != A_OK) { - ret = -EIO; - } - break; - } - - case AR6000_XIOCTL_GET_HT_CAP: - { - WMI_SET_HT_CAP_CMD htCap; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&htCap, userdata, sizeof(htCap))) { - ret = -EFAULT; - } else if (wmi_get_ht_cap_cmd(arPriv->arWmi, &htCap) != A_OK) { - ret = -EIO; - } else if(copy_to_user((WMI_SET_HT_CAP_CMD *)rq->ifr_data, - &htCap, sizeof(htCap))) { - ret = -EFAULT; - } - break; - } - - case AR6000_XIOCTL_SET_HT_OP: - { - WMI_SET_HT_OP_CMD htOp; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&htOp, userdata, - sizeof(htOp))){ - ret = -EFAULT; - } else { - - if (wmi_set_ht_op_cmd(arPriv->arWmi, htOp.sta_chan_width) != A_OK) - { - ret = -EIO; - } - } - break; - } -#endif - case AR6000_XIOCTL_ACL_DATA: - { - void *osbuf = NULL; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (ar6000_create_acl_data_osbuf(dev, (A_UINT8*)userdata, &osbuf) != A_OK) { - ret = -EIO; - } else { - if (wmi_data_hdr_add(arPriv->arWmi, osbuf, DATA_MSGTYPE, 0, WMI_DATA_HDR_DATA_TYPE_ACL,0,NULL) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("XIOCTL_ACL_DATA - wmi_data_hdr_add failed\n")); - } else { - /* Send data buffer over HTC */ - ar6000_acl_data_tx(osbuf, arPriv); - } - } - break; - } - case AR6000_XIOCTL_HCI_CMD: - { - char tmp_buf[512]; - A_INT8 i; - WMI_HCI_CMD *cmd = (WMI_HCI_CMD *)tmp_buf; - A_UINT8 size; - - size = sizeof(cmd->cmd_buf_sz); - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(cmd, userdata, size)) { - ret = -EFAULT; - } else if(copy_from_user(cmd->buf, userdata + size, cmd->cmd_buf_sz)) { - ret = -EFAULT; - } else { - if (wmi_send_hci_cmd(arPriv->arWmi, cmd->buf, cmd->cmd_buf_sz) != A_OK) { - ret = -EIO; - }else if(loghci) { - A_PRINTF_LOG("HCI Command To PAL --> \n"); - for(i = 0; i < cmd->cmd_buf_sz; i++) { - A_PRINTF_LOG("0x%02x ",cmd->buf[i]); - if((i % 10) == 0) { - A_PRINTF_LOG("\n"); - } - } - A_PRINTF_LOG("\n"); - A_PRINTF_LOG("==================================\n"); - } - } - break; - } - case AR6000_XIOCTL_WLAN_CONN_PRECEDENCE: - { - WMI_SET_BT_WLAN_CONN_PRECEDENCE cmd; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&cmd, userdata, sizeof(cmd))) { - ret = -EFAULT; - } else { - if (cmd.precedence == BT_WLAN_CONN_PRECDENCE_WLAN || - cmd.precedence == BT_WLAN_CONN_PRECDENCE_PAL) { - if ( wmi_set_wlan_conn_precedence_cmd(arPriv->arWmi, cmd.precedence) != A_OK) { - ret = -EIO; - } - } else { - ret = -EINVAL; - } - } - break; - } - case AR6000_XIOCTL_AP_GET_STAT: - { - ret = ar6000_ioctl_get_ap_stats(dev, rq); - break; - } - case AR6000_XIOCTL_SET_TX_SELECT_RATES: - { - WMI_SET_TX_SELECT_RATES_CMD masks; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&masks, userdata, - sizeof(masks))) { - ret = -EFAULT; - } else { - - if (wmi_set_tx_select_rates_cmd(arPriv->arWmi, masks.rateMasks) != A_OK) - { - ret = -EIO; - } - } - break; - } - case AR6000_XIOCTL_AP_GET_HIDDEN_SSID: - { - WMI_AP_HIDDEN_SSID_CMD ssid; - ssid.hidden_ssid = arAp->ap_hidden_ssid; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if(copy_to_user((WMI_AP_HIDDEN_SSID_CMD *)rq->ifr_data, - &ssid, sizeof(WMI_AP_HIDDEN_SSID_CMD))) { - ret = -EFAULT; - } - break; - } - case AR6000_XIOCTL_AP_GET_COUNTRY: - { - WMI_AP_SET_COUNTRY_CMD cty; - A_MEMCPY(cty.countryCode, arAp->ap_country_code, 3); - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if(copy_to_user((WMI_AP_SET_COUNTRY_CMD *)rq->ifr_data, - &cty, sizeof(WMI_AP_SET_COUNTRY_CMD))) { - ret = -EFAULT; - } - break; - } - case AR6000_XIOCTL_AP_GET_WMODE: - { - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if(copy_to_user((A_UINT8 *)rq->ifr_data, - &arPriv->phymode, sizeof(A_UINT8))) { - ret = -EFAULT; - } - break; - } - case AR6000_XIOCTL_AP_GET_DTIM: - { - WMI_AP_SET_DTIM_CMD dtim; - dtim.dtim = arAp->ap_dtim_period; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if(copy_to_user((WMI_AP_SET_DTIM_CMD *)rq->ifr_data, - &dtim, sizeof(WMI_AP_SET_DTIM_CMD))) { - ret = -EFAULT; - } - break; - } - case AR6000_XIOCTL_AP_GET_BINTVL: - { - WMI_BEACON_INT_CMD bi; - bi.beaconInterval = arAp->ap_beacon_interval; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if(copy_to_user((WMI_BEACON_INT_CMD *)rq->ifr_data, - &bi, sizeof(WMI_BEACON_INT_CMD))) { - ret = -EFAULT; - } - break; - } - case AR6000_XIOCTL_AP_GET_RTS: - { - WMI_SET_RTS_CMD rts; - rts.threshold = arAp->arRTS; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if(copy_to_user((WMI_SET_RTS_CMD *)rq->ifr_data, - &rts, sizeof(WMI_SET_RTS_CMD))) { - ret = -EFAULT; - } - break; - } - case AR6000_XIOCTL_FETCH_TARGET_REGS: - { - A_UINT32 targregs[AR6003_FETCH_TARG_REGS_COUNT]; - - if (ar->arTargetType == TARGET_TYPE_AR6003) { - ar6k_FetchTargetRegs(hifDevice, targregs); - if (copy_to_user((A_UINT32 *)rq->ifr_data, &targregs, sizeof(targregs))) - { - ret = -EFAULT; - } - } else { - ret = -EOPNOTSUPP; - } - break; - } - case AR6000_XIOCTL_AP_SET_11BG_RATESET: - { - WMI_AP_SET_11BG_RATESET_CMD rate; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&rate, userdata, sizeof(rate))) { - ret = -EFAULT; - } else { - wmi_ap_set_rateset(arPriv->arWmi, rate.rateset); - } - break; - } - case AR6000_XIOCTL_GET_WLAN_SLEEP_STATE: - { - WMI_REPORT_SLEEP_STATE_EVENT wmiSleepEvent ; - - if (ar->arWlanState == WLAN_ENABLED) { - wmiSleepEvent.sleepState = WMI_REPORT_SLEEP_STATUS_IS_AWAKE; - } else { - wmiSleepEvent.sleepState = WMI_REPORT_SLEEP_STATUS_IS_DEEP_SLEEP; - } - rq->ifr_ifru.ifru_ivalue = ar->arWlanState; /* return value */ - ar6000_send_event_to_app(arPriv, WMI_REPORT_SLEEP_STATE_EVENTID, (A_UINT8*)&wmiSleepEvent, - sizeof(WMI_REPORT_SLEEP_STATE_EVENTID)); - break; - } -#ifdef P2P - case AR6000_XIOCTL_WMI_P2P_DISCOVER: - { - WMI_BSS_FILTER_CMD filt; - - /*Issue the WMI_FIND CMD*/ - WMI_P2P_FIND_CMD find_param; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - break; - } - A_MEMZERO(&filt, sizeof(WMI_BSS_FILTER_CMD)); - /*Set BSS filter to ALL*/ - filt.bssFilter = ALL_BSS_FILTER; - - if (wmi_bssfilter_cmd(arPriv->arWmi, filt.bssFilter, filt.ieMask) - != A_OK) { - ret = -EIO; - } else { - arSta->arUserBssFilter = filt.bssFilter; - if (copy_from_user(&find_param, userdata, sizeof(WMI_P2P_FIND_CMD))) { - ret = -EFAULT; - } else { - p2p_clear_peers_reported_flag(A_WMI_GET_P2P_CTX(arPriv)); - wmi_p2p_discover(arPriv->arWmi, &find_param); - } - } - break; - } - case AR6000_XIOCTL_WMI_P2P_STOP_FIND: - { - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else { - wmi_p2p_stop_find(arPriv->arWmi); - } - break; - } - case AR6000_XIOCTL_WMI_P2P_CANCEL: - { - wmi_p2p_cancel(arPriv->arWmi); - break; - } - case AR6000_XIOCTL_WMI_P2P_LISTEN: - { - A_UINT32 timeout; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&timeout, userdata, sizeof(timeout))) { - ret = -EFAULT; - } else { - wmi_p2p_listen(arPriv->arWmi, timeout); - } - break; - } - case AR6000_XIOCTL_WMI_P2P_GO_NEG: - { - /*Issue the WMI_GO_NEG CMD*/ - WMI_P2P_GO_NEG_START_CMD go_param; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&go_param, userdata, sizeof(WMI_P2P_GO_NEG_START_CMD))) { - ret = -EFAULT; - } else { - if (p2p_go_neg_start(A_WMI_GET_P2P_CTX(arPriv), &go_param) - != A_OK) { - ret = -EFAULT; - } - } - break; - } - case AR6000_XIOCTL_WMI_P2P_AUTH_GO_NEG: - { - WMI_P2P_GO_NEG_START_CMD go_neg_auth_param; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&go_neg_auth_param, userdata, sizeof(WMI_P2P_GO_NEG_START_CMD))) { - ret = -EFAULT; - } else { - if (p2p_auth_go_neg(A_WMI_GET_P2P_CTX(arPriv), - &go_neg_auth_param) != A_OK) { - ret = -EFAULT; - } - } - break; - } - case AR6000_XIOCTL_WMI_P2P_REJECT: - { - A_UINT8 p2p_reject_peer[IEEE80211_ADDR_LEN]; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(p2p_reject_peer, userdata, - IEEE80211_ADDR_LEN)) { - ret = -EFAULT; - } else { - if (p2p_peer_reject(A_WMI_GET_P2P_CTX(arPriv), - p2p_reject_peer) != A_OK) { - ret = -EFAULT; - } - } - break; - } - case AR6000_XIOCTL_WMI_P2P_CONFIG: - { - WMI_P2P_SET_CONFIG_CMD set_p2p_config; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&set_p2p_config, userdata, sizeof(WMI_P2P_SET_CONFIG_CMD))) { - ret = -EFAULT; - } else { - wmi_p2p_set_config(arPriv->arWmi, &set_p2p_config); - } - break; - } - case AR6000_XIOCTL_WMI_WPS_CONFIG: - { - WMI_WPS_SET_CONFIG_CMD set_wps_config; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&set_wps_config, userdata, sizeof(WMI_WPS_SET_CONFIG_CMD))) { - ret = -EFAULT; - } else { - wmi_wps_set_config(arPriv->arWmi, &set_wps_config); - } - break; - } - case AR6000_XIOCTL_WMI_P2P_FINDNODE: - { - A_UINT8 macaddr[AR6000_ETH_ADDR_LEN]; - bss_t *ni; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(macaddr, userdata,AR6000_ETH_ADDR_LEN)) { - ret = -EFAULT; - } else { - ni = wmi_find_node(arPriv->arWmi, macaddr); - if (ni) { - if(copy_to_user((A_UINT16 *)rq->ifr_data, - &ni->ni_cie.ie_chan, sizeof(A_UINT16))) { - ret = -EFAULT; - } - } - else { - ret = -EFAULT; - } - } - break; - } - case AR6000_XIOCTL_WMI_P2P_GRP_INIT: - { - WMI_P2P_GRP_INIT_CMD p2p_grp_init_cmd; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&p2p_grp_init_cmd, userdata, - sizeof(WMI_P2P_GRP_INIT_CMD))) { - ret = -EFAULT; - } else { - wmi_p2p_grp_init_cmd(arPriv->arWmi, &p2p_grp_init_cmd); - } - break; - } - case AR6000_XIOCTL_WMI_P2P_GRP_FORMATION_DONE: - { - WMI_P2P_GRP_FORMATION_DONE_CMD p2p_grp_done_cmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&p2p_grp_done_cmd, userdata, - sizeof(WMI_P2P_GRP_FORMATION_DONE_CMD))) { - ret = -EFAULT; - } else { - wmi_p2p_grp_done_cmd(arPriv->arWmi, &p2p_grp_done_cmd); - } - break; - } - case AR6000_XIOCTL_WMI_P2P_INVITE: - { - WMI_P2P_INVITE_CMD p2p_invite_param; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&p2p_invite_param, userdata, - sizeof(WMI_P2P_INVITE_CMD))) { - ret = -EFAULT; - } else { - if (p2p_invite_cmd(A_WMI_GET_P2P_CTX(arPriv), &p2p_invite_param) - != A_OK) { - ret = -EFAULT; - } - } - break; - } - case AR6000_XIOCTL_WMI_P2P_PROV_DISC: - { - A_UINT8 peer[IEEE80211_ADDR_LEN]; - A_UINT16 wps_method; - A_UINT8 buf[8]; - - A_MEMZERO(peer, IEEE80211_ADDR_LEN); - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(buf, userdata, 8)) { - ret = -EFAULT; - } else { - A_MEMCPY(peer, buf, IEEE80211_ADDR_LEN); - wps_method = (*(A_UINT16 *)(&buf[6])); - - if (p2p_prov_disc_req(A_WMI_GET_P2P_CTX(arPriv), peer, wps_method) != A_OK) { - ret = -EFAULT; - } - } - - break; - } - case AR6000_XIOCTL_WMI_P2P_GET_IF_ADDR: - { - A_UINT8 buf[12]; - const A_UINT8 zero_mac[] = {0,0,0,0,0,0}; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(buf, userdata, 12)) { - ret = -EFAULT; - } else { - if (p2p_get_ifaddr(A_WMI_GET_P2P_CTX(arPriv), - buf) == A_OK) { - if(copy_to_user((A_UINT8 *)rq->ifr_data, - buf+6, IEEE80211_ADDR_LEN)) { - ret = -EFAULT; - } - } else { - if(copy_to_user((A_UINT8 *)rq->ifr_data, - zero_mac, IEEE80211_ADDR_LEN)) { - ret = -EFAULT; - } - } - } - break; - } - case AR6000_XIOCTL_WMI_P2P_GET_DEV_ADDR: - { - A_UINT8 buf[12]; - const A_UINT8 zero_mac[] = {0,0,0,0,0,0}; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(buf, userdata, 12)) { - ret = -EFAULT; - } else { - if (p2p_get_devaddr(A_WMI_GET_P2P_CTX(arPriv), - buf) == A_OK) { - if(copy_to_user((A_UINT8 *)rq->ifr_data, - buf+6, IEEE80211_ADDR_LEN)) { - ret = -EFAULT; - } - } else { - if(copy_to_user((A_UINT8 *)rq->ifr_data, - zero_mac, IEEE80211_ADDR_LEN)) { - ret = -EFAULT; - } - } - } - break; - } - case AR6000_XIOCTL_WMI_P2P_SET: - { - WMI_P2P_SET_CMD set_p2p_config; - A_MEMZERO(&set_p2p_config, sizeof(WMI_P2P_SET_CMD)); - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&set_p2p_config, userdata, sizeof(WMI_P2P_SET_CMD))) { - ret = -EFAULT; - } else { - wmi_p2p_set_cmd(arPriv->arWmi, &set_p2p_config); - } - break; - } - case AR6000_XIOCTL_WMI_P2P_PEER: - { - A_UINT8 buf[12]; - const A_UINT8 zero_mac[] = {0,0,0,0,0,0}; - - A_UINT8 peer_info_buf[1000]; - A_UINT32 peer_info_buf_used; - - int first_element; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(buf, userdata, 12)) { - ret = -EFAULT; - } else { - /* - * Check the "next" value set in driver_ar6003.c of the supplicant. - * This determines whether we have a "P2P_PEER FIRST" (if = 1) or - * "P2P_PEER NEXT-" (if = 2) command, or just a plain p2p_peer - * command (if = 0) - */ - if (buf[6] != 0) { - if (buf[6] == 1) { - first_element = 1; - } else { - first_element = 0; - } - peer_info_buf_used = p2p_get_next_addr(A_WMI_GET_P2P_CTX(arPriv), buf, peer_info_buf, sizeof(peer_info_buf), first_element); - if (peer_info_buf_used == 0) { - ret = -ENODEV; - } - *((A_UINT32 *)rq->ifr_data) = peer_info_buf_used; - if(copy_to_user(((A_UINT32 *)(rq->ifr_data)+1), - peer_info_buf, peer_info_buf_used)){ - ret = -EFAULT; - } - } else { - if (p2p_peer(A_WMI_GET_P2P_CTX(arPriv), - buf, *(buf+6)) == A_OK) { - peer_info_buf_used = p2p_get_peer_info(A_WMI_GET_P2P_CTX(arPriv), buf, - peer_info_buf, sizeof(peer_info_buf)); - *((A_UINT32 *)rq->ifr_data) = peer_info_buf_used; - if(copy_to_user(((A_UINT32 *)(rq->ifr_data)+1), - peer_info_buf, peer_info_buf_used)) { - ret = -EFAULT; - } - } else { - if(copy_to_user((A_UINT16 *)rq->ifr_data, - zero_mac, IEEE80211_ADDR_LEN)) { - ret = -EFAULT; - } - } - } - } - break; - } - case AR6000_XIOCTL_WMI_P2P_FLUSH: - { - p2p_free_all_devices(A_WMI_GET_P2P_CTX(arPriv)); - p2p_free_all_sd_queries(A_WMI_GET_P2P_CTX(arPriv)); - break; - } - case AR6000_XIOCTL_WMI_GET_GO_PARAMS: - { - A_UINT8 go_dev_addr[AR6000_ETH_ADDR_LEN]; - struct { - A_UINT16 oper_freq; - A_UINT8 ssid[WMI_MAX_SSID_LEN]; - A_UINT8 ssid_len; - } go_params; - - A_MEMZERO(&go_params, sizeof(go_params)); - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(go_dev_addr, - userdata, AR6000_ETH_ADDR_LEN)) { - ret = -EFAULT; - } else { - if (wmi_p2p_get_go_params(A_WMI_GET_P2P_CTX(arPriv), - go_dev_addr, &go_params.oper_freq, go_params.ssid, - &go_params.ssid_len) == A_OK) { - if(copy_to_user((A_UINT16 *)rq->ifr_data, - &go_params, sizeof(go_params))) { - ret = -EFAULT; - } - } else { - ret = -EFAULT; - } - } - break; - } - case AR6000_XIOCTL_WMI_P2P_AUTH_INVITE: - { - A_UINT8 auth_peer[IEEE80211_ADDR_LEN]={0,0,0,0,0,0}; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(auth_peer, userdata,IEEE80211_ADDR_LEN)) { - ret = -EFAULT; - } else { - if (p2p_auth_invite(A_WMI_GET_P2P_CTX(arPriv), - auth_peer) != A_OK) { - ret = -EFAULT; - } - } - break; - } - case AR6000_XIOCTL_WMI_P2P_SDPD_TX_CMD: - { - WMI_P2P_SDPD_TX_CMD sdpd_tx_cmd; - A_UINT32 qid = 0; - - A_MEMZERO(&sdpd_tx_cmd, sizeof(WMI_P2P_SDPD_TX_CMD)); - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&sdpd_tx_cmd, userdata, - sizeof(WMI_P2P_SDPD_TX_CMD))) { - ret = -EFAULT; - } else { - if (p2p_sdpd_tx_cmd(A_WMI_GET_P2P_CTX(arPriv), - &sdpd_tx_cmd, &qid) != - A_OK) { - ret = -EFAULT; - } else { - if(copy_to_user((A_UINT8 *)rq->ifr_data, - (void *)&qid, sizeof(A_UINT32))) { - ret = -EFAULT; - } - } - } - break; - } - case AR6000_XIOTCL_WMI_P2P_SD_CANCEL_REQUEST: - { - A_UINT32 qid; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&qid, userdata, sizeof(qid))) { - ret = -EFAULT; - } else if (p2p_sd_cancel_request(A_WMI_GET_P2P_CTX(arPriv),qid) != - A_OK) { - ret = -EFAULT; - } - break; - } - case AR6000_XIOCTL_WMI_GET_P2P_IE: - { - A_UINT8 buf[12]; - const A_UINT8 zero_mac[] = {0,0,0,0,0,0}; - A_UINT8 * p2p_buf = NULL; - A_UINT8 p2p_buf_len = 0; - - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(buf, userdata, 12)) { - ret = -EFAULT; - } else { - - if (p2p_peer(A_WMI_GET_P2P_CTX(arPriv), - buf, *(buf+6)) == A_OK) { - - p2p_get_device_p2p_buf(A_WMI_GET_P2P_CTX(arPriv),buf, &p2p_buf, &p2p_buf_len); - - if(p2p_buf) { - *((A_UINT8 *)rq->ifr_data) = p2p_buf_len; - - if(copy_to_user(((A_UINT8 *)(rq->ifr_data)+1), - p2p_buf, p2p_buf_len)) { - ret = -EFAULT; - } - } - } else { - if(copy_to_user((A_UINT16 *)rq->ifr_data, - zero_mac, IEEE80211_ADDR_LEN)) { - ret = -EFAULT; - } - } - } - break; - } -#endif /* P2P */ - -#ifdef CONFIG_PM - case AR6000_XIOCTL_SET_BT_HW_POWER_STATE: - { - unsigned int state; - get_user(state, (unsigned int *)userdata); - if (ar6000_set_bt_hw_state(ar, state)!=A_OK) { - ret = -EIO; - } - break; - } - case AR6000_XIOCTL_GET_BT_HW_POWER_STATE: - rq->ifr_ifru.ifru_ivalue = !ar->arBTOff; /* return value */ - break; -#endif - - case AR6000_XIOCTL_WMI_SET_TX_SGI_PARAM: - { - WMI_SET_TX_SGI_PARAM_CMD SGICmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&SGICmd, userdata, - sizeof(SGICmd))){ - ret = -EFAULT; - } else{ - if (wmi_SGI_cmd(arPriv->arWmi, SGICmd.sgiMask, SGICmd.sgiPERThreshold) != A_OK) { - ret = -EIO; - } - - } - break; - } - - case AR6000_XIOCTL_WMI_SET_PASSPHRASE: - { - ret = ar6000_xioctl_set_passphrase_cmd(dev, userdata); - break; - } - - case AR6000_XIOCTL_WMI_SET_EXCESS_TX_RETRY_THRES: - { - ret = ar6000_xioctl_set_excess_tx_retry_thres_cmd(dev, userdata); - break; - } - - case AR6000_XIOCTL_WMI_ENABLE_WAC_PARAM: - { - WMI_WAC_ENABLE_CMD cmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&cmd, userdata, sizeof(cmd))) - { - ret = -EFAULT; - } else { - if ( cmd.enable & 0x80 ) { - cmd.enable &= ~0x80; - ar6000_send_generic_event_to_app(arPriv, WMI_ENABLE_WAC_CMDID, - (A_UINT8*)&cmd, sizeof(WMI_WAC_ENABLE_CMD)); - } - else { - if (wmi_wac_enable_cmd(arPriv->arWmi, &cmd) - != A_OK) - { - ret = -EIO; - } - } - } - break; - } - - case AR6000_XIOCTL_WAC_SCAN_REPLY: - { - WMI_WAC_SCAN_REPLY_CMD cmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&cmd, userdata, sizeof(cmd))) - { - ret = -EFAULT; - } else { - if (wmi_wac_scan_reply_cmd(arPriv->arWmi, cmd.cmdid) - != A_OK) - { - ret = -EIO; - } - } - break; - } - - case AR6000_XIOCTL_WMI_WAC_CTRL_REQ: - { - WMI_WAC_CTRL_REQ_CMD cmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&cmd, userdata, sizeof(cmd))) - { - ret = -EFAULT; - } else { - if ( WAC_SET == cmd.req ) { - if (wmi_wac_ctrl_req_cmd(arPriv->arWmi, &cmd) - != A_OK) - { - ret = -EIO; - } - } - else if ( WAC_GET == cmd.req ) { - ret = ar6000_xioctl_wac_ctrl_req_get_cmd(dev, userdata, rq); - } - } - break; - } - - case AR6000_XIOCTL_WMI_SET_WPA_OFFLOAD_STATE: - { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - A_UINT8 wpaOffloadState = 0; - - if (copy_from_user(&wpaOffloadState, userdata, sizeof(A_UINT8))) { - ret = -EFAULT; - } else { - arSta->wpaOffloadEnabled = (wpaOffloadState) ? TRUE : FALSE; - } -#else - ret = -EOPNOTSUPP; -#endif /* LINUX_VERSION_CODE >= 2.6.27 */ - break; - } - - case AR6000_XIOCTL_BMI_NVRAM_PROCESS: - { - A_UCHAR seg_name[BMI_NVRAM_SEG_NAME_SZ+1]; - A_UINT32 rv = 0; - - if (copy_from_user(seg_name, userdata, sizeof(seg_name))) { - ret = -EFAULT; - break; - } - - seg_name[BMI_NVRAM_SEG_NAME_SZ] = '\0'; - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("Process NVRAM segment: %s\n", seg_name)); - - if (BMInvramProcess(hifDevice, seg_name, &rv) != A_OK) { - ret = -EIO; - } - put_user(rv, (unsigned int *)rq->ifr_data); /* return value */ - - break; - } - - case AR6000_XIOCTL_AP_ACS_DISABLE_HI_CHANNELS: - { - A_UINT32 acs; - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&acs, userdata, sizeof(acs))) { - ret = -EFAULT; - } else { - ar->arAcsDisableHiChannel = acs; - } - break; - } - - case AR6000_XIOCTL_WMI_FORCE_ASSERT: - { - if (wmi_force_target_assert(arPriv->arWmi) != A_OK) - { - ret = -EIO; - } - break; - } - - case AR6000_XIOCTL_WMI_SET_DIVERSITY_PARAM: - { - WMI_DIV_PARAMS_CMD cmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&cmd, userdata, sizeof(cmd))) - { - ret = -EFAULT; - } else - { - if (wmi_set_div_param_cmd(arPriv->arWmi, cmd.divIdleTime, cmd.antRssiThresh, cmd.divEnable, cmd.active_treshold_rate) - != A_OK) - { - ret = -EIO; - } - - } - break; - } - case AR6000_XIOCTL_AP_GET_NUM_STA: - { - A_UINT8 num_sta, ret_num_sta; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&num_sta, userdata, sizeof(num_sta))) { - ret = -EFAULT; - } else { - if(num_sta & 0x80) { - ret_num_sta = ar->gNumSta; - } else { - ret_num_sta = arPriv->num_sta; - } - if(copy_to_user((A_UINT8 *)rq->ifr_data, - &ret_num_sta, sizeof(A_UINT8))) { - ret = -EFAULT; - } - } - break; - } -#ifdef CONFIG_PM - case AR6000_XIOCTL_SUSPEND_DRIVER: - { - ar6000_suspend_ev(ar); - break; - } - case AR6000_XIOCTL_RESUME_DRIVER: - { - ar6000_resume_ev(ar); - break; - } -#endif - case AR6000_XIOCTL_GET_SUBMODE: - { - if (copy_to_user((A_UINT8 *)rq->ifr_data, &arPriv->arNetworkSubType, - sizeof(A_UINT8))) - { - ret = -EFAULT; - } - break; - } - case AR6000_XIOCTL_WMI_AP_SET_APSD: - { - WMI_AP_SET_APSD_CMD cmd; - - if (ar->arWmiReady == FALSE) { - ret = -EIO; - } else if (copy_from_user(&cmd, userdata, sizeof(WMI_AP_SET_APSD_CMD))) { - ret = -EFAULT; - } else { - if(wmi_ap_set_apsd(arPriv->arWmi, cmd.enable) != A_OK) { - ret = -EIO; - } else { - arPriv->ap_profile_flag = 1; /* There is a change in profile */ - } - } - break; - } - - default: - ret = -EOPNOTSUPP; - } - -ioctl_done: - rtnl_lock(); /* restore rtnl state */ - dev_put(dev); - - return ret; -} - -A_UINT8 mac_cmp_wild(A_UINT8 *mac, A_UINT8 *new_mac, A_UINT8 wild, A_UINT8 new_wild) -{ - A_UINT8 i; - - for(i=0;i=0;i--) - { - if(mac_cmp_wild(a->acl_mac[i], acl->mac, a->wildcard[i], - acl->wildcard)==0) - already_avail = i; - - if(!((1 << i) & a->index)) - free_slot = i; - } - - if(acl->action == ADD_MAC_ADDR) - { - /* Dont add mac if it is already available */ - if((already_avail >= 0) || (free_slot == -1)) - return 0; - - A_MEMCPY(a->acl_mac[free_slot], acl->mac, ATH_MAC_LEN); - a->index = a->index | (1 << free_slot); - acl->index = free_slot; - a->wildcard[free_slot] = acl->wildcard; - return 1; - } - else if(acl->action == DEL_MAC_ADDR) - { - if(acl->index > AP_ACL_SIZE) - return 0; - - if(!(a->index & (1 << acl->index))) - return 0; - - A_MEMZERO(a->acl_mac[acl->index],ATH_MAC_LEN); - a->index = a->index & ~(1 << acl->index); - a->wildcard[acl->index] = 0; - return 1; - } - - return 0; -} diff --git a/drivers/net/wireless/ar6003/host/os/linux/netbuf.c b/drivers/net/wireless/ar6003/host/os/linux/netbuf.c deleted file mode 100644 index 963b99e7cc9f..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/netbuf.c +++ /dev/null @@ -1,272 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ -#include -#include -#include -#include "athdefs.h" -#include "a_types.h" -#include "a_osapi.h" -#include "htc_packet.h" - -#define AR6000_DATA_OFFSET 64 - -void a_netbuf_enqueue(A_NETBUF_QUEUE_T *q, void *pkt) -{ - skb_queue_tail((struct sk_buff_head *) q, (struct sk_buff *) pkt); -} - -void a_netbuf_prequeue(A_NETBUF_QUEUE_T *q, void *pkt) -{ - skb_queue_head((struct sk_buff_head *) q, (struct sk_buff *) pkt); -} - -void *a_netbuf_dequeue(A_NETBUF_QUEUE_T *q) -{ - return((void *) skb_dequeue((struct sk_buff_head *) q)); -} - -int a_netbuf_queue_size(A_NETBUF_QUEUE_T *q) -{ - return(skb_queue_len((struct sk_buff_head *) q)); -} - -int a_netbuf_queue_empty(A_NETBUF_QUEUE_T *q) -{ - return(skb_queue_empty((struct sk_buff_head *) q)); -} - -void a_netbuf_queue_init(A_NETBUF_QUEUE_T *q) -{ - skb_queue_head_init((struct sk_buff_head *) q); -} - -#ifdef AR6K_ALLOC_DEBUG -void * -a_netbuf_alloc(int size, const char *func, int lineno) -#else -void * -a_netbuf_alloc(int size) -#endif -{ - struct sk_buff *skb; - size += 2 * (A_GET_CACHE_LINE_BYTES()); /* add some cacheline space at front and back of buffer */ - skb = dev_alloc_skb(AR6000_DATA_OFFSET + sizeof(HTC_PACKET) + size); - if (skb) { - skb_reserve(skb, AR6000_DATA_OFFSET + sizeof(HTC_PACKET) + A_GET_CACHE_LINE_BYTES()); -#ifdef AR6K_ALLOC_DEBUG - __a_meminfo_add(skb, size, func, lineno); -#endif - } - return ((void *)skb); -} - -/* - * Allocate an SKB w.o. any encapsulation requirement. - */ -#ifdef AR6K_ALLOC_DEBUG -void * -a_netbuf_alloc_raw(int size, const char *func, int lineno) -#else -void * -a_netbuf_alloc_raw(int size) -#endif -{ - struct sk_buff *skb; - - skb = dev_alloc_skb(size); -#ifdef AR6K_ALLOC_DEBUG - __a_meminfo_add(skb, size, func, lineno); -#endif - return ((void *)skb); -} - -void -a_netbuf_free(void *bufPtr) -{ - struct sk_buff *skb = (struct sk_buff *)bufPtr; -#ifdef AR6K_ALLOC_DEBUG - a_meminfo_del(bufPtr); -#endif - dev_kfree_skb(skb); -} - -A_UINT32 -a_netbuf_to_len(void *bufPtr) -{ - return (((struct sk_buff *)bufPtr)->len); -} - -void * -a_netbuf_to_data(void *bufPtr) -{ - return (((struct sk_buff *)bufPtr)->data); -} - -/* - * Add len # of bytes to the beginning of the network buffer - * pointed to by bufPtr - */ -A_STATUS -a_netbuf_push(void *bufPtr, A_INT32 len) -{ - skb_push((struct sk_buff *)bufPtr, len); - - return A_OK; -} - -/* - * Add len # of bytes to the beginning of the network buffer - * pointed to by bufPtr and also fill with data - */ -A_STATUS -a_netbuf_push_data(void *bufPtr, char *srcPtr, A_INT32 len) -{ - skb_push((struct sk_buff *) bufPtr, len); - A_MEMCPY(((struct sk_buff *)bufPtr)->data, srcPtr, len); - - return A_OK; -} - -/* - * Add len # of bytes to the end of the network buffer - * pointed to by bufPtr - */ -A_STATUS -a_netbuf_put(void *bufPtr, A_INT32 len) -{ - skb_put((struct sk_buff *)bufPtr, len); - - return A_OK; -} - -/* - * Add len # of bytes to the end of the network buffer - * pointed to by bufPtr and also fill with data - */ -A_STATUS -a_netbuf_put_data(void *bufPtr, char *srcPtr, A_INT32 len) -{ - char *start = (char*)(((struct sk_buff *)bufPtr)->data + - ((struct sk_buff *)bufPtr)->len); - skb_put((struct sk_buff *)bufPtr, len); - A_MEMCPY(start, srcPtr, len); - - return A_OK; -} - - -/* - * Trim the network buffer pointed to by bufPtr to len # of bytes - */ -A_STATUS -a_netbuf_setlen(void *bufPtr, A_INT32 len) -{ - skb_trim((struct sk_buff *)bufPtr, len); - - return A_OK; -} - -/* - * Chop of len # of bytes from the end of the buffer. - */ -A_STATUS -a_netbuf_trim(void *bufPtr, A_INT32 len) -{ - skb_trim((struct sk_buff *)bufPtr, ((struct sk_buff *)bufPtr)->len - len); - - return A_OK; -} - -/* - * Chop of len # of bytes from the end of the buffer and return the data. - */ -A_STATUS -a_netbuf_trim_data(void *bufPtr, char *dstPtr, A_INT32 len) -{ - char *start = (char*)(((struct sk_buff *)bufPtr)->data + - (((struct sk_buff *)bufPtr)->len - len)); - - A_MEMCPY(dstPtr, start, len); - skb_trim((struct sk_buff *)bufPtr, ((struct sk_buff *)bufPtr)->len - len); - - return A_OK; -} - - -/* - * Returns the number of bytes available to a a_netbuf_push() - */ -A_INT32 -a_netbuf_headroom(void *bufPtr) -{ - return (skb_headroom((struct sk_buff *)bufPtr)); -} - -/* - * Removes specified number of bytes from the beginning of the buffer - */ -A_STATUS -a_netbuf_pull(void *bufPtr, A_INT32 len) -{ - skb_pull((struct sk_buff *)bufPtr, len); - - return A_OK; -} - -/* - * Removes specified number of bytes from the beginning of the buffer - * and return the data - */ -A_STATUS -a_netbuf_pull_data(void *bufPtr, char *dstPtr, A_INT32 len) -{ - A_MEMCPY(dstPtr, ((struct sk_buff *)bufPtr)->data, len); - skb_pull((struct sk_buff *)bufPtr, len); - - return A_OK; -} - - -#ifdef AR6K_ALLOC_DEBUG -void a_netbuf_check(void *bufPtr, const char *func, int lineno) -{ - struct sk_buff *skb = (struct sk_buff *)bufPtr; - A_UINT32 len; - A_BOOL found = FALSE; - found = a_meminfo_find(skb); - - if (found == FALSE) - { - len = A_NETBUF_LEN(skb); - __a_meminfo_add(skb, len, func, lineno); - } -} -#endif - -#ifdef EXPORT_HCI_BRIDGE_INTERFACE -EXPORT_SYMBOL(a_netbuf_to_data); -EXPORT_SYMBOL(a_netbuf_put); -EXPORT_SYMBOL(a_netbuf_pull); -EXPORT_SYMBOL(a_netbuf_alloc); -EXPORT_SYMBOL(a_netbuf_free); -#endif diff --git a/drivers/net/wireless/ar6003/host/os/linux/wireless_ext.c b/drivers/net/wireless/ar6003/host/os/linux/wireless_ext.c deleted file mode 100644 index 3413ba376b97..000000000000 --- a/drivers/net/wireless/ar6003/host/os/linux/wireless_ext.c +++ /dev/null @@ -1,2945 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Communications Inc. -// All rights reserved. -// -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// -// Author(s): ="Atheros" -//------------------------------------------------------------------------------ - -#include "ar6000_drv.h" - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) -#define IWE_STREAM_ADD_EVENT(p1, p2, p3, p4, p5) \ - iwe_stream_add_event((p1), (p2), (p3), (p4), (p5)) -#else -#define IWE_STREAM_ADD_EVENT(p1, p2, p3, p4, p5) \ - iwe_stream_add_event((p2), (p3), (p4), (p5)) -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) -#define IWE_STREAM_ADD_POINT(p1, p2, p3, p4, p5) \ - iwe_stream_add_point((p1), (p2), (p3), (p4), (p5)) -#else -#define IWE_STREAM_ADD_POINT(p1, p2, p3, p4, p5) \ - iwe_stream_add_point((p2), (p3), (p4), (p5)) -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) -#define IWE_STREAM_ADD_VALUE(p1, p2, p3, p4, p5, p6) \ - iwe_stream_add_value((p1), (p2), (p3), (p4), (p5), (p6)) -#else -#define IWE_STREAM_ADD_VALUE(p1, p2, p3, p4, p5, p6) \ - iwe_stream_add_value((p2), (p3), (p4), (p5), (p6)) -#endif - -static void ar6000_set_quality(struct iw_quality *iq, A_INT8 rssi); -extern unsigned int wmitimeout; - -#if WIRELESS_EXT > 14 -/* - * Encode a WPA or RSN information element as a custom - * element using the hostap format. - */ -static u_int -encode_ie(void *buf, size_t bufsize, - const u_int8_t *ie, size_t ielen, - const char *leader, size_t leader_len) -{ - u_int8_t *p; - int i; - - if (bufsize < leader_len) - return 0; - p = buf; - memcpy(p, leader, leader_len); - bufsize -= leader_len; - p += leader_len; - for (i = 0; i < ielen && bufsize > 2; i++) - { - p += sprintf((char*)p, "%02x", ie[i]); - bufsize -= 2; - } - return (i == ielen ? p - (u_int8_t *)buf : 0); -} -#endif /* WIRELESS_EXT > 14 */ - -static A_UINT8 -get_bss_phy_capability(bss_t *bss) -{ - A_UINT8 capability = 0; - struct ieee80211_common_ie *cie = &bss->ni_cie; -#define CHAN_IS_11A(x) (!((x >= 2412) && (x <= 2484))) - if (CHAN_IS_11A(cie->ie_chan)) { - if (cie->ie_htcap) { - capability = WMI_11NA_CAPABILITY; - } else { - capability = WMI_11A_CAPABILITY; - } - } else if ((cie->ie_erp) || (cie->ie_xrates)) { - if (cie->ie_htcap) { - capability = WMI_11NG_CAPABILITY; - } else { - capability = WMI_11G_CAPABILITY; - } - } - return capability; -} - -void -ar6000_scan_node(void *arg, bss_t *ni) -{ - struct iw_event iwe; -#if WIRELESS_EXT > 14 - char buf[256]; -#endif - struct ar_giwscan_param *param; - A_CHAR *current_ev; - A_CHAR *end_buf; - struct ieee80211_common_ie *cie; - A_CHAR *current_val; - A_INT32 j; - A_UINT32 rate_len, data_len = 0; - - /* Node table now contains entries from P2P Action frames and Probe Request also. Return - * if the frame type is an action frame/ Probe request. - */ - if ((ni->ni_frametype == ACTION_MGMT_FTYPE) || (ni->ni_frametype == PROBEREQ_FTYPE) || (ni->ni_buf == NULL)) { - return; - } - - param = (struct ar_giwscan_param *)arg; - - current_ev = param->current_ev; - end_buf = param->end_buf; - - cie = &ni->ni_cie; - - if ((end_buf - current_ev) > IW_EV_ADDR_LEN) - { - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - A_MEMCPY(iwe.u.ap_addr.sa_data, ni->ni_macaddr, 6); - current_ev = IWE_STREAM_ADD_EVENT(param->info, current_ev, end_buf, - &iwe, IW_EV_ADDR_LEN); - } - param->bytes_needed += IW_EV_ADDR_LEN; - - data_len = cie->ie_ssid[1] + IW_EV_POINT_LEN; - if ((end_buf - current_ev) > data_len) - { - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = SIOCGIWESSID; - iwe.u.data.flags = 1; - iwe.u.data.length = cie->ie_ssid[1]; - current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, end_buf, - &iwe, (char*)&cie->ie_ssid[2]); - } - param->bytes_needed += data_len; - - if (cie->ie_capInfo & (IEEE80211_CAPINFO_ESS|IEEE80211_CAPINFO_IBSS)) { - if ((end_buf - current_ev) > IW_EV_UINT_LEN) - { - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = SIOCGIWMODE; - iwe.u.mode = cie->ie_capInfo & IEEE80211_CAPINFO_ESS ? - IW_MODE_MASTER : IW_MODE_ADHOC; - current_ev = IWE_STREAM_ADD_EVENT(param->info, current_ev, end_buf, - &iwe, IW_EV_UINT_LEN); - } - param->bytes_needed += IW_EV_UINT_LEN; - } - - if ((end_buf - current_ev) > IW_EV_FREQ_LEN) - { - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = SIOCGIWFREQ; - iwe.u.freq.m = cie->ie_chan * 100000; - iwe.u.freq.e = 1; - current_ev = IWE_STREAM_ADD_EVENT(param->info, current_ev, end_buf, - &iwe, IW_EV_FREQ_LEN); - } - param->bytes_needed += IW_EV_FREQ_LEN; - - if ((end_buf - current_ev) > IW_EV_QUAL_LEN) - { - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = IWEVQUAL; - ar6000_set_quality(&iwe.u.qual, ni->ni_snr); - current_ev = IWE_STREAM_ADD_EVENT(param->info, current_ev, end_buf, - &iwe, IW_EV_QUAL_LEN); - } - param->bytes_needed += IW_EV_QUAL_LEN; - - if ((end_buf - current_ev) > IW_EV_POINT_LEN) - { - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = SIOCGIWENCODE; - if (cie->ie_capInfo & IEEE80211_CAPINFO_PRIVACY) { - iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - } else { - iwe.u.data.flags = IW_ENCODE_DISABLED; - } - iwe.u.data.length = 0; - current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, end_buf, - &iwe, ""); - } - param->bytes_needed += IW_EV_POINT_LEN; - - /* supported bit rate */ - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = SIOCGIWRATE; - iwe.u.bitrate.fixed = 0; - iwe.u.bitrate.disabled = 0; - iwe.u.bitrate.value = 0; - current_val = current_ev + IW_EV_LCP_LEN; - param->bytes_needed += IW_EV_LCP_LEN; - - if (cie->ie_rates != NULL) { - rate_len = cie->ie_rates[1]; - data_len = (rate_len * (IW_EV_PARAM_LEN - IW_EV_LCP_LEN)); - if ((end_buf - current_ev) > data_len) - { - for (j = 0; j < rate_len; j++) { - unsigned char val; - val = cie->ie_rates[2 + j]; - iwe.u.bitrate.value = - (val >= 0x80)? ((val - 0x80) * 500000): (val * 500000); - current_val = IWE_STREAM_ADD_VALUE(param->info, current_ev, - current_val, end_buf, - &iwe, IW_EV_PARAM_LEN); - } - } - param->bytes_needed += data_len; - } - - if (cie->ie_xrates != NULL) { - rate_len = cie->ie_xrates[1]; - data_len = (rate_len * (IW_EV_PARAM_LEN - IW_EV_LCP_LEN)); - if ((end_buf - current_ev) > data_len) - { - for (j = 0; j < rate_len; j++) { - unsigned char val; - val = cie->ie_xrates[2 + j]; - iwe.u.bitrate.value = - (val >= 0x80)? ((val - 0x80) * 500000): (val * 500000); - current_val = IWE_STREAM_ADD_VALUE(param->info, current_ev, - current_val, end_buf, - &iwe, IW_EV_PARAM_LEN); - } - } - param->bytes_needed += data_len; - } - /* remove fixed header if no rates were added */ - if ((current_val - current_ev) > IW_EV_LCP_LEN) - current_ev = current_val; - -#if WIRELESS_EXT >= 18 - /* IE */ - if (cie->ie_wpa != NULL) { - data_len = cie->ie_wpa[1] + 2 + IW_EV_POINT_LEN; - if ((end_buf - current_ev) > data_len) - { - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = cie->ie_wpa[1] + 2; - current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, end_buf, - &iwe, (char*)cie->ie_wpa); - } - param->bytes_needed += data_len; - } - - if (cie->ie_rsn != NULL && cie->ie_rsn[0] == IEEE80211_ELEMID_RSN) { - data_len = cie->ie_rsn[1] + 2 + IW_EV_POINT_LEN; - if ((end_buf - current_ev) > data_len) - { - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = cie->ie_rsn[1] + 2; - current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, end_buf, - &iwe, (char*)cie->ie_rsn); - } - param->bytes_needed += data_len; - } - -#endif /* WIRELESS_EXT >= 18 */ - - if ((end_buf - current_ev) > IW_EV_CHAR_LEN) - { - /* protocol */ - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = SIOCGIWNAME; - switch (get_bss_phy_capability(ni)) { - case WMI_11A_CAPABILITY: - snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11a"); - break; - case WMI_11G_CAPABILITY: - snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11g"); - break; - case WMI_11NA_CAPABILITY: - snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11na"); - break; - case WMI_11NG_CAPABILITY: - snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11ng"); - break; - default: - snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11b"); - break; - } - current_ev = IWE_STREAM_ADD_EVENT(param->info, current_ev, end_buf, - &iwe, IW_EV_CHAR_LEN); - } - param->bytes_needed += IW_EV_CHAR_LEN; - -#if WIRELESS_EXT > 14 - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - iwe.u.data.length = snprintf(buf, sizeof(buf), "bcn_int=%d", cie->ie_beaconInt); - data_len = iwe.u.data.length + IW_EV_POINT_LEN; - if ((end_buf - current_ev) > data_len) - { - current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, end_buf, - &iwe, buf); - } - param->bytes_needed += data_len; - -#if WIRELESS_EXT < 18 - if (cie->ie_wpa != NULL) { - static const char wpa_leader[] = "wpa_ie="; - data_len = (sizeof(wpa_leader) - 1) + ((cie->ie_wpa[1]+2) * 2) + IW_EV_POINT_LEN; - if ((end_buf - current_ev) > data_len) - { - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - iwe.u.data.length = encode_ie(buf, sizeof(buf), cie->ie_wpa, - cie->ie_wpa[1]+2, - wpa_leader, sizeof(wpa_leader)-1); - - if (iwe.u.data.length != 0) { - current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, - end_buf, &iwe, buf); - } - } - param->bytes_needed += data_len; - } - - if (cie->ie_rsn != NULL && cie->ie_rsn[0] == IEEE80211_ELEMID_RSN) { - static const char rsn_leader[] = "rsn_ie="; - data_len = (sizeof(rsn_leader) - 1) + ((cie->ie_rsn[1]+2) * 2) + IW_EV_POINT_LEN; - if ((end_buf - current_ev) > data_len) - { - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - iwe.u.data.length = encode_ie(buf, sizeof(buf), cie->ie_rsn, - cie->ie_rsn[1]+2, - rsn_leader, sizeof(rsn_leader)-1); - - if (iwe.u.data.length != 0) { - current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, - end_buf, &iwe, buf); - } - } - param->bytes_needed += data_len; - } -#endif /* WIRELESS_EXT < 18 */ - - if (cie->ie_wmm != NULL) { - static const char wmm_leader[] = "wmm_ie="; - data_len = (sizeof(wmm_leader) - 1) + ((cie->ie_wmm[1]+2) * 2) + IW_EV_POINT_LEN; - if ((end_buf - current_ev) > data_len) - { - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - iwe.u.data.length = encode_ie(buf, sizeof(buf), cie->ie_wmm, - cie->ie_wmm[1]+2, - wmm_leader, sizeof(wmm_leader)-1); - if (iwe.u.data.length != 0) { - current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, - end_buf, &iwe, buf); - } - } - param->bytes_needed += data_len; - } - - if (cie->ie_ath != NULL) { - static const char ath_leader[] = "ath_ie="; - data_len = (sizeof(ath_leader) - 1) + ((cie->ie_ath[1]+2) * 2) + IW_EV_POINT_LEN; - if ((end_buf - current_ev) > data_len) - { - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - iwe.u.data.length = encode_ie(buf, sizeof(buf), cie->ie_ath, - cie->ie_ath[1]+2, - ath_leader, sizeof(ath_leader)-1); - if (iwe.u.data.length != 0) { - current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, - end_buf, &iwe, buf); - } - } - param->bytes_needed += data_len; - } - -#ifdef WAPI_ENABLE - if (cie->ie_wapi != NULL) { - static const char wapi_leader[] = "wapi_ie="; - data_len = (sizeof(wapi_leader) - 1) + ((cie->ie_wapi[1] + 2) * 2) + IW_EV_POINT_LEN; - if ((end_buf - current_ev) > data_len) { - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - iwe.u.data.length = encode_ie(buf, sizeof(buf), cie->ie_wapi, - cie->ie_wapi[1] + 2, - wapi_leader, sizeof(wapi_leader) - 1); - if (iwe.u.data.length != 0) { - current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, - end_buf, &iwe, buf); - } - } - param->bytes_needed += data_len; - } -#endif /* WAPI_ENABLE */ - -#endif /* WIRELESS_EXT > 14 */ - -#if WIRELESS_EXT >= 18 - if (cie->ie_wsc != NULL) { - data_len = (cie->ie_wsc[1] + 2) + IW_EV_POINT_LEN; - if ((end_buf - current_ev) > data_len) - { - A_MEMZERO(&iwe, sizeof(iwe)); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = cie->ie_wsc[1] + 2; - current_ev = IWE_STREAM_ADD_POINT(param->info, current_ev, end_buf, - &iwe, (char*)cie->ie_wsc); - } - param->bytes_needed += data_len; - } -#endif /* WIRELESS_EXT >= 18 */ - - param->current_ev = current_ev; -} - -int -ar6000_ioctl_giwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - struct ar_giwscan_param param; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - param.current_ev = extra; - param.end_buf = extra + data->length; - param.bytes_needed = 0; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - param.info = info; -#endif - - /* Translate data to WE format */ - wmi_iterate_nodes(arPriv->arWmi, ar6000_scan_node, ¶m); - - /* check if bytes needed is greater than bytes consumed */ - if (param.bytes_needed > (param.current_ev - extra)) - { - /* Request one byte more than needed, because when "data->length" equals bytes_needed, - it is not possible to add the last event data as all iwe_stream_add_xxxxx() functions - checks whether (cur_ptr + ev_len) < end_ptr, due to this one more retry would happen*/ - data->length = param.bytes_needed + 1; - - return -E2BIG; - } - - return 0; -} - -extern int reconnect_flag; -/* SIOCSIWESSID */ -static int -ar6000_ioctl_siwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *ssid) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_DEV_T *arTempPriv = NULL; - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - A_STATUS status; - A_UINT8 i=0; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->bIsDestroyProgress) { - return -EBUSY; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - -#if defined(WIRELESS_EXT) - if (WIRELESS_EXT > 20) { - data->length += 1; - } -#endif - /* Handling AP-STA Concurrency */ - if((ar->arConfNumDev > 1)) { - if ((data->flags) && - (arPriv->arNetworkType == INFRA_NETWORK) && - ((arPriv->arSsidLen != (data->length - 1)) || - (A_MEMCMP(arPriv->arSsid, ssid, arPriv->arSsidLen) != 0))){ - for(i=0;iarConfNumDev;i++) { - arTempPriv = ar->arDev[i]; - if((AP_NETWORK == arTempPriv->arNetworkType) && - (arTempPriv->arConnected)) { - wmi_disconnect_cmd(arTempPriv->arWmi); - /*Restart AP only in non P2P mode*/ - if((arTempPriv->arNetworkSubType != SUBTYPE_P2PGO) && - (arTempPriv->arNetworkSubType !=SUBTYPE_P2PDEV)){ - arTempPriv->arHoldConnection = TRUE; - ar->arHoldConnection = TRUE; - arTempPriv->ap_profile_flag = TRUE; - } - } - } - } - } - /* - * iwconfig passes a null terminated string with length including this - * so we need to account for this - */ - if (data->flags && (!data->length || (data->length == 1) || - ((data->length - 1) > sizeof(arPriv->arSsid)))) - { - /* - * ssid is invalid - */ - return -EINVAL; - } - - if (arPriv->arNetworkType == AP_NETWORK) { - if(!data->flags) { - /* stop AP */ - wmi_disconnect_cmd(arPriv->arWmi); - if(arPriv->arNetworkSubType == SUBTYPE_P2PGO) { - wait_event_interruptible_timeout(arPriv->arEvent, arPriv->arConnected == FALSE, wmitimeout * HZ); - if (signal_pending(current)) { - return -EINTR; - } - } - - } else if(A_MEMCMP(arPriv->arSsid,ssid,32) != 0) { - /* SSID change for AP network - Will take effect on commit */ - arPriv->arSsidLen = data->length - 1; - A_MEMZERO(arPriv->arSsid, WMI_MAX_SSID_LEN); - A_MEMCPY(arPriv->arSsid, ssid, arPriv->arSsidLen); - } - arPriv->ap_profile_flag = 1; /* There is a change in profile */ - arPriv->arConnected = FALSE; - return 0; - } - - /* Added for bug 25178, return an IOCTL error instead of target returning - Illegal parameter error when either the BSSID or channel is missing - and we cannot scan during connect. - */ - if (data->flags) { - if (arSta->arSkipScan == TRUE && - (arPriv->arChannelHint == 0 || - (!arSta->arReqBssid[0] && !arSta->arReqBssid[1] && !arSta->arReqBssid[2] && - !arSta->arReqBssid[3] && !arSta->arReqBssid[4] && !arSta->arReqBssid[5]))) - { - return -EINVAL; - } - } - - if (down_interruptible(&ar->arSem)) { - return -ERESTARTSYS; - } - - if (ar->bIsDestroyProgress || ar->arWlanState == WLAN_DISABLED) { - up(&ar->arSem); - return -EBUSY; - } - - if (ar->arTxPending[wmi_get_control_ep(arPriv->arWmi)]) { - /* - * sleep until the command queue drains - */ - wait_event_interruptible_timeout(arPriv->arEvent, - ar->arTxPending[wmi_get_control_ep(arPriv->arWmi)] == 0, wmitimeout * HZ); - if (signal_pending(current)) { - up(&ar->arSem); - return -EINTR; - } - } - - - if (!data->flags) { -#ifdef ATH6K_CONFIG_CFG80211 - if (arPriv->arConnected) { -#endif /* ATH6K_CONFIG_CFG80211 */ - ar6000_init_mode_info(arPriv); -#ifdef ATH6K_CONFIG_CFG80211 - } -#endif /* ATH6K_CONFIG_CFG80211 */ - } - - if (((arPriv->arSsidLen) || - ((arPriv->arSsidLen == 0) && (arPriv->arConnected || arSta->arConnectPending)) || - (!data->flags))) - { - if ((!data->flags) || - (A_MEMCMP(arPriv->arSsid, ssid, arPriv->arSsidLen) != 0) || - (arPriv->arSsidLen != (data->length - 1))) - { - /* - * SSID set previously or essid off has been issued. - * - * Disconnect Command is issued in two cases after wmi is ready - * (1) ssid is different from the previous setting - * (2) essid off has been issued - * - */ - if (ar->arWmiReady == TRUE) { - reconnect_flag = 0; - status = wmi_setPmkid_cmd(arPriv->arWmi, arPriv->arBssid, NULL, 0); - ar6000_disconnect(arPriv); - A_MEMZERO(arPriv->arSsid, sizeof(arPriv->arSsid)); - arPriv->arSsidLen = 0; - if (arSta->arSkipScan == FALSE) { - A_MEMZERO(arSta->arReqBssid, sizeof(arSta->arReqBssid)); - } - if (!data->flags) { - up(&ar->arSem); - return 0; - } - } else { - up(&ar->arSem); - } - } - else - { - /* - * SSID is same, so we assume profile hasn't changed. - * If the interface is up and wmi is ready, we issue - * a reconnect cmd. Issue a reconnect only we are already - * connected. - */ - if((arPriv->arConnected == TRUE) && (ar->arWmiReady == TRUE)) - { - reconnect_flag = TRUE; - status = wmi_reconnect_cmd(arPriv->arWmi,arSta->arReqBssid, - arPriv->arChannelHint); - up(&ar->arSem); - if (status != A_OK) { - return -EIO; - } - return 0; - } - else{ - /* - * Dont return if connect is pending. - */ - if(!(arSta->arConnectPending)) { - up(&ar->arSem); - return 0; - } - } - } - } - - arPriv->arSsidLen = data->length - 1; - A_MEMCPY(arPriv->arSsid, ssid, arPriv->arSsidLen); - - if (ar6000_connect_to_ap(arPriv)!= A_OK) { - up(&ar->arSem); - return -EIO; - }else{ - up(&ar->arSem); - } - return 0; -} - -/* SIOCGIWESSID */ -static int -ar6000_ioctl_giwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *essid) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if (!arPriv->arSsidLen) { - return -EINVAL; - } - - data->flags = 1; - data->length = arPriv->arSsidLen; - A_MEMCPY(essid, arPriv->arSsid, arPriv->arSsidLen); - - return 0; -} - - -void ar6000_install_static_wep_keys(AR_SOFTC_DEV_T *arPriv) -{ - A_UINT8 index; - A_UINT8 keyUsage; - AR_SOFTC_AP_T *ap = &arPriv->arAp; - - for (index = WMI_MIN_KEY_INDEX; index <= WMI_MAX_KEY_INDEX; index++) { - if (arPriv->arWepKeyList[index].arKeyLen) { - keyUsage = GROUP_USAGE; - if (index == arPriv->arDefTxKeyIndex) { - keyUsage |= TX_USAGE; - } - wmi_addKey_cmd(arPriv->arWmi, - index, - WEP_CRYPT, - keyUsage, - arPriv->arWepKeyList[index].arKeyLen, - NULL, - arPriv->arWepKeyList[index].arKey, KEY_OP_INIT_VAL, NULL, - NO_SYNC_WMIFLAG); - } - } - ap->deKeySet = FALSE; -} - -/* - * SIOCSIWRATE - */ -int -ar6000_ioctl_siwrate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - A_UINT32 kbps; - A_INT8 rate_idx; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (rrq->fixed) { - kbps = rrq->value / 1000; /* rrq->value is in bps */ - } else { - kbps = -1; /* -1 indicates auto rate */ - } - if(kbps != -1 && wmi_validate_bitrate(arPriv->arWmi, kbps, &rate_idx) != A_OK) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BitRate is not Valid %d\n", kbps)); - return -EINVAL; - } - arPriv->arBitRate = kbps; - if(ar->arWmiReady == TRUE) - { - if (wmi_set_bitrate_cmd(arPriv->arWmi, kbps, -1, -1) != A_OK) { - return -EINVAL; - } - } - return 0; -} - -/* - * SIOCGIWRATE - */ -int -ar6000_ioctl_giwrate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - int ret = 0; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->bIsDestroyProgress) { - return -EBUSY; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if ((arPriv->arNextMode != AP_NETWORK && !arPriv->arConnected) || ar->arWmiReady == FALSE) { - rrq->value = 1000 * 1000; - return 0; - } - - if (arPriv->arBitRate!=-1 && arPriv->arBitRate!=0xFFFF) { - rrq->fixed = TRUE; - rrq->value = arPriv->arBitRate * 1000; - return 0; - } - - if (down_interruptible(&ar->arSem)) { - return -ERESTARTSYS; - } - - if (ar->bIsDestroyProgress || ar->arWlanState == WLAN_DISABLED) { - up(&ar->arSem); - return -EBUSY; - } - - arPriv->arBitRate = 0xFFFF; - if (wmi_get_bitrate_cmd(arPriv->arWmi) != A_OK) { - up(&ar->arSem); - return -EIO; - } - wait_event_interruptible_timeout(arPriv->arEvent, arPriv->arBitRate != 0xFFFF, wmitimeout * HZ); - if (signal_pending(current)) { - ret = -EINTR; - } - /* If the interface is down or wmi is not ready or the target is not - connected - return the value stored in the device structure */ - if (!ret) { - if (arPriv->arBitRate == -1) { - rrq->fixed = TRUE; - rrq->value = 0; - } else { - rrq->fixed = FALSE; - rrq->value = arPriv->arBitRate * 1000; - } - arPriv->arBitRate = -1; /* clean it up for next query */ - } - - up(&ar->arSem); - - return ret; -} - -/* - * SIOCSIWTXPOW - */ -static int -ar6000_ioctl_siwtxpow(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - A_UINT8 dbM; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if (rrq->disabled) { - return -EOPNOTSUPP; - } - - if (rrq->fixed) { - if (rrq->flags != IW_TXPOW_DBM) { - return -EOPNOTSUPP; - } - arPriv->arTxPwr= dbM = rrq->value; - arPriv->arTxPwrSet = TRUE; - } else { - arPriv->arTxPwr = dbM = 0; - arPriv->arTxPwrSet = FALSE; - } - if(ar->arWmiReady == TRUE) - { - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_TX,("Set tx pwr cmd %d dbM\n", dbM)); - wmi_set_txPwr_cmd(arPriv->arWmi, dbM); - } - return 0; -} - -/* - * SIOCGIWTXPOW - */ -int -ar6000_ioctl_giwtxpow(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - int ret = 0; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->bIsDestroyProgress) { - return -EBUSY; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if (down_interruptible(&ar->arSem)) { - return -ERESTARTSYS; - } - - if (ar->bIsDestroyProgress) { - up(&ar->arSem); - return -EBUSY; - } - - if((ar->arWmiReady == TRUE) && (arPriv->arConnected == TRUE)) - { - arPriv->arTxPwr = 0; - - if (wmi_get_txPwr_cmd(arPriv->arWmi) != A_OK) { - up(&ar->arSem); - return -EIO; - } - - wait_event_interruptible_timeout(arPriv->arEvent, arPriv->arTxPwr != 0, wmitimeout * HZ); - - if (signal_pending(current)) { - ret = -EINTR; - } - } - /* If the interace is down or wmi is not ready or target is not connected - then return value stored in the device structure */ - - if (!ret) { - if (arPriv->arTxPwrSet == TRUE) { - rrq->fixed = TRUE; - } - rrq->value = arPriv->arTxPwr; - rrq->flags = IW_TXPOW_DBM; - // - // IWLIST need this flag to get TxPower - // - rrq->disabled = 0; - } - - up(&ar->arSem); - - return ret; -} - -/* - * SIOCSIWRETRY - * since iwconfig only provides us with one max retry value, we use it - * to apply to data frames of the BE traffic class. - */ -static int -ar6000_ioctl_siwretry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if (rrq->disabled) { - return -EOPNOTSUPP; - } - - if ((rrq->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT) { - return -EOPNOTSUPP; - } - - if ( !(rrq->value >= WMI_MIN_RETRIES) || !(rrq->value <= WMI_MAX_RETRIES)) { - return - EINVAL; - } - if(ar->arWmiReady == TRUE) - { - if (wmi_set_retry_limits_cmd(arPriv->arWmi, DATA_FRAMETYPE, WMM_AC_BE, - rrq->value, 0) != A_OK){ - return -EINVAL; - } - } - arPriv->arMaxRetries = rrq->value; - return 0; -} - -/* - * SIOCGIWRETRY - */ -static int -ar6000_ioctl_giwretry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - rrq->disabled = 0; - switch (rrq->flags & IW_RETRY_TYPE) { - case IW_RETRY_LIFETIME: - return -EOPNOTSUPP; - break; - case IW_RETRY_LIMIT: - rrq->flags = IW_RETRY_LIMIT; - switch (rrq->flags & IW_RETRY_MODIFIER) { - case IW_RETRY_MIN: - rrq->flags |= IW_RETRY_MIN; - rrq->value = WMI_MIN_RETRIES; - break; - case IW_RETRY_MAX: - rrq->flags |= IW_RETRY_MAX; - rrq->value = arPriv->arMaxRetries; - break; - } - break; - } - return 0; -} - -/* - * SIOCSIWENCODE - */ -static int -ar6000_ioctl_siwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *keybuf) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_AP_T *ap = &arPriv->arAp; - - int index; - A_INT32 auth = 0; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if(arPriv->arNextMode != AP_NETWORK) { - /* - * Static WEP Keys should be configured before setting the SSID - */ - if (arPriv->arSsid[0] && erq->length) { - return -EIO; - } - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - index = erq->flags & IW_ENCODE_INDEX; - - if (index && (((index - 1) < WMI_MIN_KEY_INDEX) || - ((index - 1) > WMI_MAX_KEY_INDEX))) - { - return -EIO; - } - - if (erq->flags & IW_ENCODE_DISABLED) { - /* - * Encryption disabled - */ - if (index) { - /* - * If key index was specified then clear the specified key - */ - index--; - A_MEMZERO(arPriv->arWepKeyList[index].arKey, - sizeof(arPriv->arWepKeyList[index].arKey)); - arPriv->arWepKeyList[index].arKeyLen = 0; - } - arPriv->arDot11AuthMode = OPEN_AUTH; - arPriv->arPairwiseCrypto = NONE_CRYPT; - arPriv->arGroupCrypto = NONE_CRYPT; - arPriv->arAuthMode = WMI_NONE_AUTH; - } else { - /* - * Enabling WEP encryption - */ - if (index) { - index--; /* keyindex is off base 1 in iwconfig */ - } - - if (erq->flags & IW_ENCODE_OPEN) { - auth |= OPEN_AUTH; - } - if (erq->flags & IW_ENCODE_RESTRICTED) { - auth |= SHARED_AUTH; - } - - if (!auth) { - auth = OPEN_AUTH; - } - - if (!ap->deKeySet) { - arPriv->arDefTxKeyIndex = index; - } - - if (erq->length) { - if (!IEEE80211_IS_VALID_WEP_CIPHER_LEN(erq->length)) { - return -EIO; - } - - A_MEMZERO(arPriv->arWepKeyList[index].arKey, - sizeof(arPriv->arWepKeyList[index].arKey)); - A_MEMCPY(arPriv->arWepKeyList[index].arKey, keybuf, erq->length); - arPriv->arWepKeyList[index].arKeyLen = erq->length; - arPriv->arDot11AuthMode = auth; - } else { - if (arPriv->arWepKeyList[index].arKeyLen == 0) { - return -EIO; - } - arPriv->arDefTxKeyIndex = index; - - if(arPriv->arSsidLen && arPriv->arWepKeyList[index].arKeyLen) { - wmi_addKey_cmd(arPriv->arWmi, - index, - WEP_CRYPT, - GROUP_USAGE | TX_USAGE, - arPriv->arWepKeyList[index].arKeyLen, - NULL, - arPriv->arWepKeyList[index].arKey, KEY_OP_INIT_VAL, NULL, - NO_SYNC_WMIFLAG); - } - ap->deKeySet = TRUE; - } - - arPriv->arPairwiseCrypto = WEP_CRYPT; - arPriv->arGroupCrypto = WEP_CRYPT; - arPriv->arAuthMode = WMI_NONE_AUTH; - } - - if(arPriv->arNextMode != AP_NETWORK) { - /* - * profile has changed. Erase ssid to signal change - */ - A_MEMZERO(arPriv->arSsid, sizeof(arPriv->arSsid)); - arPriv->arSsidLen = 0; - } - arPriv->ap_profile_flag = 1; /* There is a change in profile */ - return 0; -} - -static int -ar6000_ioctl_giwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *key) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - A_UINT8 keyIndex; - struct ar_wep_key *wk; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if (arPriv->arPairwiseCrypto == NONE_CRYPT) { - erq->length = 0; - erq->flags = IW_ENCODE_DISABLED; - } else { - if (arPriv->arPairwiseCrypto == WEP_CRYPT) { - /* get the keyIndex */ - keyIndex = erq->flags & IW_ENCODE_INDEX; - if (0 == keyIndex) { - keyIndex = arPriv->arDefTxKeyIndex; - } else if ((keyIndex - 1 < WMI_MIN_KEY_INDEX) || - (keyIndex - 1 > WMI_MAX_KEY_INDEX)) - { - keyIndex = WMI_MIN_KEY_INDEX; - } else { - keyIndex--; - } - erq->flags = keyIndex + 1; - erq->flags &= ~IW_ENCODE_DISABLED; - wk = &arPriv->arWepKeyList[keyIndex]; - if (erq->length > wk->arKeyLen) { - erq->length = wk->arKeyLen; - } - if (wk->arKeyLen) { - A_MEMCPY(key, wk->arKey, erq->length); - } - } else { - erq->flags &= ~IW_ENCODE_DISABLED; - if (arPriv->arSta.user_saved_keys.keyOk) { - erq->length = arPriv->arSta.user_saved_keys.ucast_ik.ik_keylen; - if (erq->length) { - A_MEMCPY(key, arPriv->arSta.user_saved_keys.ucast_ik.ik_keydata, erq->length); - } - } else { - erq->length = 1; // not really printing any key but let iwconfig know enc is on - } - } - - if (arPriv->arDot11AuthMode & OPEN_AUTH) { - erq->flags |= IW_ENCODE_OPEN; - } - if (arPriv->arDot11AuthMode & SHARED_AUTH) { - erq->flags |= IW_ENCODE_RESTRICTED; - } - } - - return 0; -} - -#if WIRELESS_EXT >= 18 -/* - * SIOCSIWGENIE - */ -static int -ar6000_ioctl_siwgenie(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - A_UCHAR *ie = extra; - A_UINT16 ieLen = erq->length; - const A_UINT8 wfa_oui[] = { 0x00, 0x50, 0xf2, 0x04 }; - const A_UINT8 wpa_oui[] = { 0x00, 0x50, 0xf2, 0x01 }; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - if (ieLen > IEEE80211_APPIE_FRAME_MAX_LEN) { - return -EIO; - } - - /* get the Information Element and check if it's a WPS IE */ - if (ieLen>=6 && - ((ie[0]==IEEE80211_ELEMID_VENDOR) && - memcmp(&ie[2], wfa_oui, sizeof(wfa_oui))==0)) { - /* WPS IE detected, notify target */ - AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("WPS IE detected -- setting WPS flag\n")); - arPriv->arSta.arConnectCtrlFlags |= CONNECT_WPS_FLAG; - } else { - if ((ieLen>=1 && ie[0]==IEEE80211_ELEMID_RSN) || - (ieLen>=6 && ie[0]==IEEE80211_ELEMID_VENDOR && - memcmp(&ie[2], wpa_oui, sizeof(wpa_oui))==0)) { - ieLen = 0; /* Firmware will set for us. Clear the previous one */ - } -#ifdef CONFIG_WAPI - else if (ieLen>=1 && ie[0]==IEEE80211_ELEMID_WAPI) { - //A_PRINTF("Set WAPI IE\n"); - } -#endif - arPriv->arSta.arConnectCtrlFlags &= ~CONNECT_WPS_FLAG; - } - - wmi_set_appie_cmd(arPriv->arWmi, WMI_FRAME_ASSOC_REQ, ieLen, ie); - return 0; -} - - -/* - * SIOCGIWGENIE - */ -static int -ar6000_ioctl_giwgenie(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - erq->length = 0; - erq->flags = 0; - - return 0; -} - -/* - * SIOCSIWAUTH - */ -static int -ar6000_ioctl_siwauth(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *data, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - - A_BOOL profChanged; - A_UINT16 param; - A_INT32 ret; - A_INT32 value; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - param = data->flags & IW_AUTH_INDEX; - value = data->value; - profChanged = TRUE; - ret = 0; - - switch (param) { - case IW_AUTH_WPA_VERSION: - if (value & IW_AUTH_WPA_VERSION_DISABLED) { - arPriv->arAuthMode = WMI_NONE_AUTH; - } else if (value & IW_AUTH_WPA_VERSION_WPA) { - arPriv->arAuthMode = WMI_WPA_AUTH; - } else if (value & IW_AUTH_WPA_VERSION_WPA2) { - arPriv->arAuthMode = WMI_WPA2_AUTH; - } else { - ret = -1; - profChanged = FALSE; - } - break; - case IW_AUTH_CIPHER_PAIRWISE: - if (value & IW_AUTH_CIPHER_NONE) { - arPriv->arPairwiseCrypto = NONE_CRYPT; - arPriv->arPairwiseCryptoLen = 0; - } else if (value & IW_AUTH_CIPHER_WEP40) { - arPriv->arPairwiseCrypto = WEP_CRYPT; - arPriv->arPairwiseCryptoLen = 5; - } else if (value & IW_AUTH_CIPHER_TKIP) { - arPriv->arPairwiseCrypto = TKIP_CRYPT; - arPriv->arPairwiseCryptoLen = 0; - } else if (value & IW_AUTH_CIPHER_CCMP) { - arPriv->arPairwiseCrypto = AES_CRYPT; - arPriv->arPairwiseCryptoLen = 0; - } else if (value & IW_AUTH_CIPHER_WEP104) { - arPriv->arPairwiseCrypto = WEP_CRYPT; - arPriv->arPairwiseCryptoLen = 13; -#ifdef WAPI_ENABLE - } else if (value & IW_AUTH_CIPHER_SMS4) { - arPriv->arPairwiseCrypto = WAPI_CRYPT; - arPriv->arPairwiseCryptoLen = 0; -#endif - } else { - ret = -1; - profChanged = FALSE; - } - break; - case IW_AUTH_CIPHER_GROUP: - if (value & IW_AUTH_CIPHER_NONE) { - arPriv->arGroupCrypto = NONE_CRYPT; - arPriv->arGroupCryptoLen = 0; - } else if (value & IW_AUTH_CIPHER_WEP40) { - arPriv->arGroupCrypto = WEP_CRYPT; - arPriv->arGroupCryptoLen = 5; - } else if (value & IW_AUTH_CIPHER_TKIP) { - arPriv->arGroupCrypto = TKIP_CRYPT; - arPriv->arGroupCryptoLen = 0; - } else if (value & IW_AUTH_CIPHER_CCMP) { - arPriv->arGroupCrypto = AES_CRYPT; - arPriv->arGroupCryptoLen = 0; - } else if (value & IW_AUTH_CIPHER_WEP104) { - arPriv->arGroupCrypto = WEP_CRYPT; - arPriv->arGroupCryptoLen = 13; -#ifdef WAPI_ENABLE - } else if (value & IW_AUTH_CIPHER_SMS4) { - arPriv->arGroupCrypto = WAPI_CRYPT; - arPriv->arGroupCryptoLen = 0; -#endif - } else { - ret = -1; - profChanged = FALSE; - } - break; - case IW_AUTH_KEY_MGMT: - if (value & IW_AUTH_KEY_MGMT_PSK) { - if (WMI_WPA_AUTH == arPriv->arAuthMode) { - arPriv->arAuthMode = WMI_WPA_PSK_AUTH; - } else if (WMI_WPA2_AUTH == arPriv->arAuthMode) { - arPriv->arAuthMode = WMI_WPA2_PSK_AUTH; - } else { - ret = -1; - } -#define IW_AUTH_KEY_MGMT_CCKM 8 - } else if (value & IW_AUTH_KEY_MGMT_CCKM) { - if (WMI_WPA_AUTH == arPriv->arAuthMode) { - arPriv->arAuthMode = WMI_WPA_AUTH_CCKM; - } else if (WMI_WPA2_AUTH == arPriv->arAuthMode) { - arPriv->arAuthMode = WMI_WPA2_AUTH_CCKM; - } else { - ret = -1; - } - } else if (!(value & IW_AUTH_KEY_MGMT_802_1X)) { - arPriv->arAuthMode = WMI_NONE_AUTH; - } - break; - case IW_AUTH_TKIP_COUNTERMEASURES: - wmi_set_tkip_countermeasures_cmd(arPriv->arWmi, value); - profChanged = FALSE; - break; - case IW_AUTH_DROP_UNENCRYPTED: - profChanged = FALSE; - break; - case IW_AUTH_80211_AUTH_ALG: - arPriv->arDot11AuthMode = 0; - if (value & IW_AUTH_ALG_OPEN_SYSTEM) { - arPriv->arDot11AuthMode |= OPEN_AUTH; - } - if (value & IW_AUTH_ALG_SHARED_KEY) { - arPriv->arDot11AuthMode |= SHARED_AUTH; - } - if (value & IW_AUTH_ALG_LEAP) { - arPriv->arDot11AuthMode = LEAP_AUTH; - } - if(arPriv->arDot11AuthMode == 0) { - ret = -1; - profChanged = FALSE; - } - break; - case IW_AUTH_WPA_ENABLED: - if (!value) { - arPriv->arAuthMode = WMI_NONE_AUTH; - /* when the supplicant is stopped, it calls this - * handler with value=0. The followings need to be - * reset if the STA were to connect again - * without security - */ - arPriv->arDot11AuthMode = OPEN_AUTH; - arPriv->arPairwiseCrypto = NONE_CRYPT; - arPriv->arPairwiseCryptoLen = 0; - arPriv->arGroupCrypto = NONE_CRYPT; - arPriv->arGroupCryptoLen = 0; - } - break; - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - profChanged = FALSE; - break; - case IW_AUTH_ROAMING_CONTROL: - profChanged = FALSE; - break; - case IW_AUTH_PRIVACY_INVOKED: - if (!value) { - arPriv->arPairwiseCrypto = NONE_CRYPT; - arPriv->arPairwiseCryptoLen = 0; - arPriv->arGroupCrypto = NONE_CRYPT; - arPriv->arGroupCryptoLen = 0; - } - break; - default: - ret = -1; - profChanged = FALSE; - break; - } - - if (profChanged == TRUE) { - /* - * profile has changed. Erase ssid to signal change - */ - A_MEMZERO(arPriv->arSsid, sizeof(arPriv->arSsid)); - arPriv->arSsidLen = 0; - } - - return ret; -} - - -/* - * SIOCGIWAUTH - */ -static int -ar6000_ioctl_giwauth(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *data, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - A_UINT16 param; - A_INT32 ret; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - param = data->flags & IW_AUTH_INDEX; - ret = 0; - data->value = 0; - - - switch (param) { - case IW_AUTH_WPA_VERSION: - if (arPriv->arAuthMode == WMI_NONE_AUTH) { - data->value |= IW_AUTH_WPA_VERSION_DISABLED; - } else if (arPriv->arAuthMode == WMI_WPA_AUTH) { - data->value |= IW_AUTH_WPA_VERSION_WPA; - } else if (arPriv->arAuthMode == WMI_WPA2_AUTH) { - data->value |= IW_AUTH_WPA_VERSION_WPA2; - } else { - ret = -1; - } - break; - case IW_AUTH_CIPHER_PAIRWISE: - if (arPriv->arPairwiseCrypto == NONE_CRYPT) { - data->value |= IW_AUTH_CIPHER_NONE; - } else if (arPriv->arPairwiseCrypto == WEP_CRYPT) { - if (arPriv->arPairwiseCryptoLen == 13) { - data->value |= IW_AUTH_CIPHER_WEP104; - } else { - data->value |= IW_AUTH_CIPHER_WEP40; - } - } else if (arPriv->arPairwiseCrypto == TKIP_CRYPT) { - data->value |= IW_AUTH_CIPHER_TKIP; - } else if (arPriv->arPairwiseCrypto == AES_CRYPT) { - data->value |= IW_AUTH_CIPHER_CCMP; - } else { - ret = -1; - } - break; - case IW_AUTH_CIPHER_GROUP: - if (arPriv->arGroupCrypto == NONE_CRYPT) { - data->value |= IW_AUTH_CIPHER_NONE; - } else if (arPriv->arGroupCrypto == WEP_CRYPT) { - if (arPriv->arGroupCryptoLen == 13) { - data->value |= IW_AUTH_CIPHER_WEP104; - } else { - data->value |= IW_AUTH_CIPHER_WEP40; - } - } else if (arPriv->arGroupCrypto == TKIP_CRYPT) { - data->value |= IW_AUTH_CIPHER_TKIP; - } else if (arPriv->arGroupCrypto == AES_CRYPT) { - data->value |= IW_AUTH_CIPHER_CCMP; - } else { - ret = -1; - } - break; - case IW_AUTH_KEY_MGMT: - if ((arPriv->arAuthMode == WMI_WPA_PSK_AUTH) || - (arPriv->arAuthMode == WMI_WPA2_PSK_AUTH)) { - data->value |= IW_AUTH_KEY_MGMT_PSK; - } else if ((arPriv->arAuthMode == WMI_WPA_AUTH) || - (arPriv->arAuthMode == WMI_WPA2_AUTH)) { - data->value |= IW_AUTH_KEY_MGMT_802_1X; - } - break; - case IW_AUTH_TKIP_COUNTERMEASURES: - // TODO. Save countermeassure enable/disable - data->value = 0; - break; - case IW_AUTH_DROP_UNENCRYPTED: - break; - case IW_AUTH_80211_AUTH_ALG: - if (arPriv->arDot11AuthMode == OPEN_AUTH) { - data->value |= IW_AUTH_ALG_OPEN_SYSTEM; - } else if (arPriv->arDot11AuthMode == SHARED_AUTH) { - data->value |= IW_AUTH_ALG_SHARED_KEY; - } else if (arPriv->arDot11AuthMode == LEAP_AUTH) { - data->value |= IW_AUTH_ALG_LEAP; - } else { - ret = -1; - } - break; - case IW_AUTH_WPA_ENABLED: - if (arPriv->arAuthMode == WMI_NONE_AUTH) { - data->value = 0; - } else { - data->value = 1; - } - break; - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - break; - case IW_AUTH_ROAMING_CONTROL: - break; - case IW_AUTH_PRIVACY_INVOKED: - if (arPriv->arPairwiseCrypto == NONE_CRYPT) { - data->value = 0; - } else { - data->value = 1; - } - break; - default: - ret = -1; - break; - } - - return 0; -} - -/* - * SIOCSIWPMKSA - */ -static int -ar6000_ioctl_siwpmksa(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - A_INT32 ret; - A_STATUS status; - struct iw_pmksa *pmksa; - - pmksa = (struct iw_pmksa *)extra; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - ret = 0; - status = A_OK; - - switch (pmksa->cmd) { - case IW_PMKSA_ADD: - status = wmi_setPmkid_cmd(arPriv->arWmi, (A_UINT8*)pmksa->bssid.sa_data, pmksa->pmkid, TRUE); - break; - case IW_PMKSA_REMOVE: - status = wmi_setPmkid_cmd(arPriv->arWmi, (A_UINT8*)pmksa->bssid.sa_data, pmksa->pmkid, FALSE); - break; - case IW_PMKSA_FLUSH: - if (arPriv->arConnected == TRUE) { - status = wmi_setPmkid_cmd(arPriv->arWmi, arPriv->arBssid, NULL, 0); - } - break; - default: - ret=-1; - break; - } - if (status != A_OK) { - ret = -1; - } - - return ret; -} - -#ifdef WAPI_ENABLE - -#define PN_INIT 0x5c365c36 - -static int ar6000_set_wapi_key(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - KEY_USAGE keyUsage = 0; - A_INT32 keyLen; - A_UINT8 *keyData; - A_INT32 index; - A_UINT32 *PN; - A_INT32 i; - A_STATUS status; - A_UINT8 wapiKeyRsc[16]; - CRYPTO_TYPE keyType = WAPI_CRYPT; - const A_UINT8 broadcastMac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - - index = erq->flags & IW_ENCODE_INDEX; - if (index && (((index - 1) < WMI_MIN_KEY_INDEX) || - ((index - 1) > WMI_MAX_KEY_INDEX))) { - return -EIO; - } - - index--; - if (index < 0 || index > 4) { - return -EIO; - } - keyData = (A_UINT8 *)(ext + 1); - keyLen = erq->length - sizeof(struct iw_encode_ext); - A_MEMCPY(wapiKeyRsc, ext->tx_seq, sizeof(wapiKeyRsc)); - - if (A_MEMCMP(ext->addr.sa_data, broadcastMac, sizeof(broadcastMac)) == 0) { - keyUsage |= GROUP_USAGE; - PN = (A_UINT32 *)wapiKeyRsc; - for (i = 0; i < 4; i++) { - PN[i] = PN_INIT; - } - } else { - keyUsage |= PAIRWISE_USAGE; - } - status = wmi_addKey_cmd(arPriv->arWmi, - index, - keyType, - keyUsage, - keyLen, - wapiKeyRsc, - keyData, - KEY_OP_INIT_WAPIPN, - NULL, - SYNC_BEFORE_WMIFLAG); - if (A_OK != status) { - return -EIO; - } - return 0; -} - -#endif - -/* - * SIOCSIWENCODEEXT - */ -static int -ar6000_ioctl_siwencodeext(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - A_INT32 index; - struct iw_encode_ext *ext; - KEY_USAGE keyUsage; - A_INT32 keyLen; - A_UINT8 *keyData; - A_UINT8 keyRsc[8]; - A_STATUS status; - CRYPTO_TYPE keyType; -#ifdef USER_KEYS - struct ieee80211req_key ik; -#endif /* USER_KEYS */ - AR_SOFTC_AP_T *arAp = &arPriv->arAp; - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - -#ifdef USER_KEYS - arPriv->arSta.user_saved_keys.keyOk = FALSE; -#endif /* USER_KEYS */ - - index = erq->flags & IW_ENCODE_INDEX; - - if (index && (((index - 1) < WMI_MIN_KEY_INDEX) || - ((index - 1) > WMI_MAX_KEY_INDEX))) - { - return -EIO; - } - - ext = (struct iw_encode_ext *)extra; - if (erq->flags & IW_ENCODE_DISABLED) { - /* - * Encryption disabled - */ - if (index) { - /* - * If key index was specified then clear the specified key - */ - index--; - A_MEMZERO(arPriv->arWepKeyList[index].arKey, - sizeof(arPriv->arWepKeyList[index].arKey)); - arPriv->arWepKeyList[index].arKeyLen = 0; - } - } else { - /* - * Enabling WEP encryption - */ - if (index) { - index--; /* keyindex is off base 1 in iwconfig */ - } - - keyUsage = 0; - keyLen = erq->length - sizeof(struct iw_encode_ext); - - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - keyUsage = TX_USAGE; - arPriv->arDefTxKeyIndex = index; - // Just setting the key index - if (keyLen == 0) { - return 0; - } - } - - if (keyLen <= 0) { - if (ext->alg == IW_ENCODE_ALG_KRK) { - wmi_delete_krk_cmd(arPriv->arWmi); - } - return -EIO; - } - - /* key follows iw_encode_ext */ - keyData = (A_UINT8 *)(ext + 1); - - switch (ext->alg) { - case IW_ENCODE_ALG_WEP: - keyType = WEP_CRYPT; -#ifdef USER_KEYS - ik.ik_type = IEEE80211_CIPHER_WEP; -#endif /* USER_KEYS */ - if(arPriv->arNextMode == AP_NETWORK) { - arAp->ap_mode_bkey.ik_type = IEEE80211_CIPHER_WEP; - } - if (!IEEE80211_IS_VALID_WEP_CIPHER_LEN(keyLen)) { - return -EIO; - } - - /* Check whether it is static wep. */ - if (!arPriv->arConnected) { - A_MEMZERO(arPriv->arWepKeyList[index].arKey, - sizeof(arPriv->arWepKeyList[index].arKey)); - A_MEMCPY(arPriv->arWepKeyList[index].arKey, keyData, keyLen); - arPriv->arWepKeyList[index].arKeyLen = keyLen; - - return 0; - } - break; - case IW_ENCODE_ALG_TKIP: - keyType = TKIP_CRYPT; -#ifdef USER_KEYS - ik.ik_type = IEEE80211_CIPHER_TKIP; -#endif /* USER_KEYS */ - if(arPriv->arNextMode == AP_NETWORK) { - arAp->ap_mode_bkey.ik_type = IEEE80211_CIPHER_TKIP; - } - break; - case IW_ENCODE_ALG_CCMP: - keyType = AES_CRYPT; -#ifdef USER_KEYS - ik.ik_type = IEEE80211_CIPHER_AES_CCM; -#endif /* USER_KEYS */ - if(arPriv->arNextMode == AP_NETWORK) { - arAp->ap_mode_bkey.ik_type = IEEE80211_CIPHER_AES_CCM; - } - break; -#ifdef WAPI_ENABLE - case IW_ENCODE_ALG_SM4: - return ar6000_set_wapi_key(dev, info, erq, extra); -#endif - case IW_ENCODE_ALG_PMK: - arPriv->arSta.arConnectCtrlFlags |= CONNECT_DO_WPA_OFFLOAD; - return wmi_set_pmk_cmd(arPriv->arWmi, keyData); - case IW_ENCODE_ALG_KRK: - return wmi_add_krk_cmd(arPriv->arWmi, keyData); - default: - return -EIO; - } - - - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - keyUsage |= GROUP_USAGE; - if(arPriv->arNextMode == AP_NETWORK) { - keyUsage &= ~TX_USAGE; - arAp->ap_mode_bkey.ik_keyix = index; - arAp->ap_mode_bkey.ik_keylen = keyLen; - memcpy(arAp->ap_mode_bkey.ik_keydata, keyData, keyLen); - memcpy(&arAp->ap_mode_bkey.ik_keyrsc, keyRsc, sizeof(keyRsc)); - memcpy(arAp->ap_mode_bkey.ik_macaddr, ext->addr.sa_data, ETH_ALEN); - } - } else { - keyUsage |= PAIRWISE_USAGE; - } - - if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { - A_MEMCPY(keyRsc, ext->rx_seq, sizeof(keyRsc)); - } else { - A_MEMZERO(keyRsc, sizeof(keyRsc)); - } - - if (((WMI_WPA_PSK_AUTH == arPriv->arAuthMode) || (WMI_WPA2_PSK_AUTH == arPriv->arAuthMode)) && - (GROUP_USAGE & keyUsage)) - { - A_UNTIMEOUT(&arPriv->arSta.disconnect_timer); - } - - status = wmi_addKey_cmd(arPriv->arWmi, index, keyType, keyUsage, - keyLen, keyRsc, - keyData, KEY_OP_INIT_VAL, - (A_UINT8*)ext->addr.sa_data, - SYNC_BOTH_WMIFLAG); - if (status != A_OK) { - return -EIO; - } - -#ifdef USER_KEYS - ik.ik_keyix = index; - ik.ik_keylen = keyLen; - memcpy(ik.ik_keydata, keyData, keyLen); - memcpy(&ik.ik_keyrsc, keyRsc, sizeof(keyRsc)); - memcpy(ik.ik_macaddr, ext->addr.sa_data, ETH_ALEN); - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - memcpy(&arPriv->arSta.user_saved_keys.bcast_ik, &ik, - sizeof(struct ieee80211req_key)); - } else { - memcpy(&arPriv->arSta.user_saved_keys.ucast_ik, &ik, - sizeof(struct ieee80211req_key)); - } - arPriv->arSta.user_saved_keys.keyOk = TRUE; -#endif /* USER_KEYS */ - } - - - return 0; -} - -/* - * SIOCGIWENCODEEXT - */ -static int -ar6000_ioctl_giwencodeext(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if (arPriv->arPairwiseCrypto == NONE_CRYPT) { - erq->length = 0; - erq->flags = IW_ENCODE_DISABLED; - } else { - erq->length = 0; - } - - return 0; -} -#endif // WIRELESS_EXT >= 18 - -#if WIRELESS_EXT > 20 -static int ar6000_ioctl_siwpower(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ -#ifndef ATH6K_CONFIG_OTA_MODE - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - WMI_POWER_MODE power_mode; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if (wrqu->power.disabled) - power_mode = MAX_PERF_POWER; - else - power_mode = REC_POWER; - - if (wmi_powermode_cmd(arPriv->arWmi, power_mode) < 0) - return -EIO; -#endif - return 0; -} - -static int ar6000_ioctl_giwpower(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - WMI_POWER_MODE power_mode; - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - power_mode = wmi_get_power_mode_cmd(arPriv->arWmi); - - if (power_mode == MAX_PERF_POWER) - wrqu->power.disabled = 1; - else - wrqu->power.disabled = 0; - - return 0; -} -#endif // WIRELESS_EXT > 20 - -/* - * SIOCGIWNAME - */ -int -ar6000_ioctl_giwname(struct net_device *dev, - struct iw_request_info *info, - char *name, char *extra) -{ - A_UINT8 capability; - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - capability = arPriv->arPhyCapability; - if(arPriv->arNetworkType == INFRA_NETWORK && arPriv->arConnected) { - bss_t *bss = wmi_find_node(arPriv->arWmi, arPriv->arBssid); - if (bss) { - capability = get_bss_phy_capability(bss); - wmi_node_return(arPriv->arWmi, bss); - } - } - switch (capability) { - case (WMI_11A_CAPABILITY): - strncpy(name, "AR6000 802.11a", IFNAMSIZ); - break; - case (WMI_11G_CAPABILITY): - strncpy(name, "AR6000 802.11g", IFNAMSIZ); - break; - case (WMI_11AG_CAPABILITY): - strncpy(name, "AR6000 802.11ag", IFNAMSIZ); - break; - case (WMI_11NA_CAPABILITY): - strncpy(name, "AR6000 802.11na", IFNAMSIZ); - break; - case (WMI_11NG_CAPABILITY): - strncpy(name, "AR6000 802.11ng", IFNAMSIZ); - break; - case (WMI_11NAG_CAPABILITY): - strncpy(name, "AR6K 802.11nag", IFNAMSIZ); - break; - default: - strncpy(name, "AR6000 802.11b", IFNAMSIZ); - break; - } - - return 0; -} - -/* - * SIOCSIWFREQ - */ -int -ar6000_ioctl_siwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - /* - * We support limiting the channels via wmiconfig. - * - * We use this command to configure the channel hint for the connect cmd - * so it is possible the target will end up connecting to a different - * channel. - */ - if (freq->e > 1) { - return -EINVAL; - } else if (freq->e == 1) { - if ((arPriv->arPhyCapability == WMI_11NG_CAPABILITY) && (((freq->m / 100000) >= 5180) && ((freq->m / 100000) <= 5825))) { - return -EINVAL; - } - arPriv->arChannelHint = freq->m / 100000; - } else if(freq->m > 0) { - if ((arPriv->arPhyCapability == WMI_11NG_CAPABILITY) && ((wlan_ieee2freq(freq->m) >=5180) && (wlan_ieee2freq(freq->m) <= 5825))) { - return -EINVAL; - } - arPriv->arChannelHint = wlan_ieee2freq(freq->m); - } else { - /* Auto Channel Selection */ - arPriv->arChannelHint = 0; - } - - arPriv->ap_profile_flag = 1; /* There is a change in profile */ - - A_PRINTF("channel hint set to %d\n", arPriv->arChannelHint); - return 0; -} - -/* - * SIOCGIWFREQ - */ -int -ar6000_ioctl_giwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if (arPriv->arNetworkType == AP_NETWORK) { - if(arPriv->arChannelHint) { - freq->m = arPriv->arChannelHint * 100000; - } else if(arPriv->arBssChannel) { - freq->m = arPriv->arBssChannel * 100000; - } else { - return -EINVAL; - } - } else { - if (arPriv->arConnected != TRUE) { - return -EINVAL; - } else { - freq->m = arPriv->arBssChannel * 100000; - } - } - - freq->e = 1; - - return 0; -} - -/* - * SIOCSIWMODE - */ -int -ar6000_ioctl_siwmode(struct net_device *dev, - struct iw_request_info *info, - __u32 *mode, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - -#if 0 - /* - * clear SSID during mode switch in connected state - */ - if(!(arPriv->arNetworkType == (((*mode) == IW_MODE_INFRA) ? INFRA_NETWORK : ADHOC_NETWORK)) - && (arPriv->arConnected == TRUE) ){ - A_MEMZERO(arPriv->arSsid, sizeof(arPriv->arSsid)); - arPriv->arSsidLen = 0; - } -#endif - - switch (*mode) { - case IW_MODE_INFRA: - arPriv->arNextMode = INFRA_NETWORK; - break; - case IW_MODE_ADHOC: - arPriv->arNextMode = ADHOC_NETWORK; - break; - case IW_MODE_MASTER: - arPriv->arNextMode = AP_NETWORK; - break; - default: - return -EINVAL; - } - - if (arPriv->arNetworkType != arPriv->arNextMode) { - ar6000_init_mode_info(arPriv); - } - - /* Update the arNetworkType */ - arPriv->arNetworkType = arPriv->arNextMode; - - return 0; -} - -/* - * SIOCGIWMODE - */ -int -ar6000_ioctl_giwmode(struct net_device *dev, - struct iw_request_info *info, - __u32 *mode, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - switch (arPriv->arNetworkType) { - case INFRA_NETWORK: - *mode = IW_MODE_INFRA; - break; - case ADHOC_NETWORK: - *mode = IW_MODE_ADHOC; - break; - case AP_NETWORK: - *mode = IW_MODE_MASTER; - break; - default: - return -EIO; - } - return 0; -} - -/* - * SIOCSIWSENS - */ -int -ar6000_ioctl_siwsens(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *sens, char *extra) -{ - return 0; -} - -/* - * SIOCGIWSENS - */ -int -ar6000_ioctl_giwsens(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *sens, char *extra) -{ - sens->value = 0; - sens->fixed = 1; - - return 0; -} - -/* - * SIOCGIWRANGE - */ -int -ar6000_ioctl_giwrange(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - struct iw_range *range = (struct iw_range *) extra; - int i, j, ret = 0; - const A_INT32 rateTable[] = { - 1000, 2000, 5500, 11000, - 6000, 9000, 12000, 18000, 24000, 36000, 48000, 54000, - 6500, 13000, 19500, 26000, 39000, 52000, 58500, 65000 }; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->bIsDestroyProgress) { - return -EBUSY; - } - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (down_interruptible(&ar->arSem)) { - return -ERESTARTSYS; - } - - if (ar->bIsDestroyProgress) { - up(&ar->arSem); - return -EBUSY; - } - - arSta->arNumChannels = -1; - A_MEMZERO(arSta->arChannelList, sizeof (arSta->arChannelList)); - - if (wmi_get_channelList_cmd(arPriv->arWmi) != A_OK) { - up(&ar->arSem); - return -EIO; - } - - wait_event_interruptible_timeout(arPriv->arEvent, arSta->arNumChannels != -1, wmitimeout * HZ); - - if (signal_pending(current)) { - up(&ar->arSem); - return -EINTR; - } - - data->length = sizeof(struct iw_range); - A_MEMZERO(range, sizeof(struct iw_range)); - - range->enc_capa |= IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2; - range->enc_capa |= IW_ENC_CAPA_CIPHER_TKIP|IW_ENC_CAPA_CIPHER_CCMP; - /* Event capability (kernel + driver) */ - range->event_capa[0] = (IW_EVENT_CAPA_K_0 | - IW_EVENT_CAPA_MASK(SIOCGIWAP) | - IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); - range->event_capa[1] = IW_EVENT_CAPA_K_1; - range->event_capa[4] = (IW_EVENT_CAPA_MASK(IWEVCUSTOM) | - IW_EVENT_CAPA_MASK(IWEVREGISTERED) | - IW_EVENT_CAPA_MASK(IWEVEXPIRED) | -#if WIRELESS_EXT >= 18 - IW_EVENT_CAPA_MASK(IWEVPMKIDCAND) | - IW_EVENT_CAPA_MASK(IWEVASSOCRESPIE) | - IW_EVENT_CAPA_MASK(IWEVASSOCREQIE) | - IW_EVENT_CAPA_MASK(IWEVGENIE) | -#endif - 0); - - range->scan_capa = IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_CHANNEL; - - range->txpower_capa = 0; - - range->min_pmp = 1 * 1024; - range->max_pmp = 65535 * 1024; - range->min_pmt = 1 * 1024; - range->max_pmt = 1000 * 1024; - range->pmp_flags = IW_POWER_PERIOD; - range->pmt_flags = IW_POWER_TIMEOUT; - range->pm_capa = 0; - - range->we_version_compiled = WIRELESS_EXT; - range->we_version_source = 13; - - range->retry_capa = IW_RETRY_LIMIT; - range->retry_flags = IW_RETRY_LIMIT; - range->min_retry = 0; - range->max_retry = 255; - - range->num_frequency = range->num_channels = arSta->arNumChannels; - for (i = 0; i < arSta->arNumChannels; i++) { - range->freq[i].i = wlan_freq2ieee(arSta->arChannelList[i]); - range->freq[i].m = arSta->arChannelList[i] * 100000; - range->freq[i].e = 1; - /* - * Linux supports max of 32 channels, bail out once you - * reach the max. - */ - if (i == IW_MAX_FREQUENCIES) { - break; - } - } - - /* Max quality is max field value minus noise floor */ - range->max_qual.qual = 0xff - 161; - - /* - * In order to use dBm measurements, 'level' must be lower - * than any possible measurement (see iw_print_stats() in - * wireless tools). It's unclear how this is meant to be - * done, but setting zero in these values forces dBm and - * the actual numbers are not used. - */ - range->max_qual.level = 0; - range->max_qual.noise = 0; - - range->sensitivity = 3; - - range->max_encoding_tokens = 4; - /* XXX query driver to find out supported key sizes */ - range->num_encoding_sizes = 3; - range->encoding_size[0] = 5; /* 40-bit */ - range->encoding_size[1] = 13; /* 104-bit */ - range->encoding_size[2] = 16; /* 128-bit */ - - for (i=0, j=0; iarWmi, rateTable[i], &rateIdx)==A_OK) { - range->bitrate[j] = wmi_get_rate(i) * 1000; - ++j; - } - } - range->num_bitrates = j; - - /* estimated maximum TCP throughput values (bps) */ - range->throughput = 22000000; - - range->min_rts = 0; - range->max_rts = 2347; - range->min_frag = 256; - range->max_frag = 2346; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) - if (arSta->wpaOffloadEnabled) { - range->enc_capa |= IW_ENC_CAPA_4WAY_HANDSHAKE; - } -#endif /* LINUX_VERSION_CODE >= 2.6.27 */ - - up(&ar->arSem); - - return ret; -} - -/* - * SIOCSIWPRIV - * - */ -int -ar6000_ioctl_siwpriv(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - int ret = -EOPNOTSUPP; - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; -#ifdef ANDROID_ENV - extern int android_ioctl_siwpriv(struct net_device *, struct iw_request_info *, struct iw_point *, char*); - char cmd[5]; - if (data->pointer) { - if (copy_from_user(cmd, data->pointer, sizeof(cmd))) - return -EIO; - } -#endif - - if (!ar || - ( (!ar->arWmiReady || (ar->arWlanState != WLAN_ENABLED)) -#ifdef ANDROID_ENV - && (!data->pointer || strncasecmp(cmd, "START", 5)!=0) -#endif - ) - ) { - return -EIO; - } - -#ifdef ANDROID_ENV - ret = android_ioctl_siwpriv(dev, info, data, extra); - if (ret!=-EOPNOTSUPP) { - return ret; - } -#endif - return ret; -} - -/* - * SIOCSIWAP - * This ioctl is used to set the desired bssid for the connect command. - */ -int -ar6000_ioctl_siwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if (ap_addr->sa_family != ARPHRD_ETHER) { - return -EIO; - } - - if (A_MEMCMP(&ap_addr->sa_data, bcast_mac, AR6000_ETH_ADDR_LEN) == 0) { - A_MEMZERO(arSta->arReqBssid, sizeof(arSta->arReqBssid)); - } else { - A_MEMCPY(arSta->arReqBssid, &ap_addr->sa_data, sizeof(arSta->arReqBssid)); - } - - return 0; -} - -/* - * SIOCGIWAP - */ -int -ar6000_ioctl_giwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if (arPriv->arNetworkType == AP_NETWORK) { - A_MEMCPY(&ap_addr->sa_data, dev->dev_addr, ATH_MAC_LEN); - ap_addr->sa_family = ARPHRD_ETHER; - return 0; - } - - if (arPriv->arConnected != TRUE) { - return -EINVAL; - } - - A_MEMCPY(&ap_addr->sa_data, arPriv->arBssid, sizeof(arPriv->arBssid)); - ap_addr->sa_family = ARPHRD_ETHER; - - return 0; -} - -#if (WIRELESS_EXT >= 18) -/* - * SIOCSIWMLME - */ -int -ar6000_ioctl_siwmlme(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->bIsDestroyProgress) { - return -EBUSY; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (down_interruptible(&ar->arSem)) { - return -ERESTARTSYS; - } - - if (data->pointer && data->length == sizeof(struct iw_mlme)) { - - A_UINT8 arNetworkType; - struct iw_mlme mlme; - - if (copy_from_user(&mlme, data->pointer, sizeof(struct iw_mlme))) { - up(&ar->arSem); - return -EIO; - } - - switch (mlme.cmd) { - - case IW_MLME_DEAUTH: - /* fall through */ - case IW_MLME_DISASSOC: - if ((arPriv->arConnected != TRUE) || - (memcmp(arPriv->arBssid, mlme.addr.sa_data, 6) != 0)) { - - up(&ar->arSem); - return -EINVAL; - } - wmi_setPmkid_cmd(arPriv->arWmi, arPriv->arBssid, NULL, 0); - arNetworkType = arPriv->arNetworkType; - ar6000_init_profile_info(arPriv); - arPriv->arNetworkType = arNetworkType; - reconnect_flag = 0; - ar6000_disconnect(arPriv); - A_MEMZERO(arPriv->arSsid, sizeof(arPriv->arSsid)); - arPriv->arSsidLen = 0; - if (arSta->arSkipScan == FALSE) { - A_MEMZERO(arSta->arReqBssid, sizeof(arSta->arReqBssid)); - } - break; - - case IW_MLME_AUTH: - /* fall through */ - case IW_MLME_ASSOC: - /* fall through */ - default: - up(&ar->arSem); - return -EOPNOTSUPP; - } - } - - up(&ar->arSem); - return 0; -} -#endif /* WIRELESS_EXT >= 18 */ - -/* - * SIOCGIWAPLIST - */ -int -ar6000_ioctl_iwaplist(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - return -EIO; /* for now */ -} - -/* - * SIOCSIWSCAN - */ -int -ar6000_ioctl_siwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ -#define ACT_DWELLTIME_DEFAULT 105 -#define HOME_TXDRAIN_TIME 100 -#define SCAN_INT HOME_TXDRAIN_TIME + ACT_DWELLTIME_DEFAULT - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_DEV_T *arApPriv = NULL; - AR_SOFTC_T *ar = arPriv->arSoftc; - AR_SOFTC_STA_T *arSta = &arPriv->arSta; - A_UINT16 connChannel = 0; - int ret = 0; - struct iw_scan_req *req = (struct iw_scan_req *) extra; - A_INT8 numChan = 0; - A_UINT16 channelList[IW_MAX_FREQUENCIES], *pChannelList = NULL; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - if (data->length < sizeof(struct iw_scan_req)) { - req = NULL; - } - - /* If scan is issued in the middle of ongoing scan or connect, - dont issue another one */ - if ( arSta->scan_triggered > 0 ) { - ++arSta->scan_triggered; - if (arSta->scan_triggered < 5) { - return 0; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_SCAN,("Scan request is triggered over 5 times. Not scan complete event\n")); - } - } - - if (!arSta->arUserBssFilter) { - if (wmi_bssfilter_cmd(arPriv->arWmi, ALL_BSS_FILTER, 0) != A_OK) { - return -EIO; - } - } - - if (arPriv->arConnected) { - if (wmi_get_stats_cmd(arPriv->arWmi) != A_OK) { - return -EIO; - } - } - -#if WIRELESS_EXT >= 18 - if ( req && (data->flags & IW_SCAN_THIS_ESSID) == IW_SCAN_THIS_ESSID ) { - if (wmi_probedSsid_cmd(arPriv->arWmi, 0, - SPECIFIC_SSID_FLAG, req->essid_len, req->essid) == A_OK) { - if (!arSta->scanSpecificSsid) { - arSta->scanSpecificSsid = 1; - } - } - } else { - A_UINT8 idx; - for (idx=0; idxscanSpecificSsid; ++idx) { - /* index 0 always reserves for broadcast SSID*/ - A_UINT8 flag = (idx==0) ? ANY_SSID_FLAG : DISABLE_SSID_FLAG; - wmi_probedSsid_cmd(arPriv->arWmi, idx, flag, 0, NULL); - } - arSta->scanSpecificSsid = 0; - } - - if ( req && (data->flags & IW_SCAN_THIS_FREQ) == IW_SCAN_THIS_FREQ && req->num_channels>0) { - A_UINT8 i; - for (i=0; inum_channels; ++i) { - struct iw_freq *freq = &req->channel_list[i]; - A_UINT16 *dst = &channelList[numChan]; - if (freq->e == 1) { - /* freq->m == (Freq HZ value) divided by (10 ^ freq->e) */ - *dst = freq->m / 100000; - ++numChan; - } else if (freq->e < 1 && freq->m) { - /* It is a channel number if freq->e == 0 */ - *dst = wlan_ieee2freq(freq->m); - ++numChan; - } - } - if (numChan > 0) { - pChannelList = channelList; - } - } -#endif /* WIRELESS_EXT >= 18 */ - - /* AP-STA concurrency. Allow scan only on connected channel when AP and STA - * both are functional. - */ - GET_CONN_AP_PRIV(ar,arApPriv); - if((arApPriv) && (arPriv->arConnected)){ - connChannel = arPriv->arBssChannel; - if (wmi_startscan_cmd(arPriv->arWmi, WMI_LONG_SCAN, FALSE, FALSE, \ - 0, 0, 1,&connChannel) != A_OK) { - ret = -EIO; - } - } else { - if (wmi_startscan_cmd(arPriv->arWmi, WMI_LONG_SCAN, FALSE, FALSE, \ - 0, 0, numChan, pChannelList) != A_OK) { - ret = -EIO; - } - } - if (ret == 0) { - arSta->scan_triggered = 1; - } - - return ret; -#undef ACT_DWELLTIME_DEFAULT -#undef HOME_TXDRAIN_TIME -#undef SCAN_INT -} - - -/* - * Units are in db above the noise floor. That means the - * rssi values reported in the tx/rx descriptors in the - * driver are the SNR expressed in db. - * - * If you assume that the noise floor is -95, which is an - * excellent assumption 99.5 % of the time, then you can - * derive the absolute signal level (i.e. -95 + rssi). - * There are some other slight factors to take into account - * depending on whether the rssi measurement is from 11b, - * 11g, or 11a. These differences are at most 2db and - * can be documented. - * - * NB: various calculations are based on the orinoco/wavelan - * drivers for compatibility - */ -static void -ar6000_set_quality(struct iw_quality *iq, A_INT8 rssi) -{ - if (rssi < 0) { - iq->qual = 0; - } else { - iq->qual = rssi; - } - - /* NB: max is 94 because noise is hardcoded to 161 */ - if (iq->qual > 94) - iq->qual = 94; - - iq->noise = 161; /* -95dBm */ - iq->level = iq->noise + iq->qual; - iq->updated = 7; -} - - -int -ar6000_ioctl_siwcommit(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - - AR_SOFTC_DEV_T *arPriv = (AR_SOFTC_DEV_T *)ar6k_priv(dev); - AR_SOFTC_T *ar = arPriv->arSoftc; - - if (is_iwioctl_allowed(arPriv->arNextMode, info->cmd) != A_OK) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("wext_ioctl: cmd=0x%x not allowed in this mode\n", info->cmd)); - return -EOPNOTSUPP; - } - - if (ar->arWmiReady == FALSE) { - return -EIO; - } - - if (ar->arWlanState == WLAN_DISABLED) { - return -EIO; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN_CONNECT,("AP: SSID %s freq %d authmode %d dot11 auth %d"\ - " PW crypto %d GRP crypto %d\n", - arPriv->arSsid, arPriv->arChannelHint, - arPriv->arAuthMode, arPriv->arDot11AuthMode, - arPriv->arPairwiseCrypto, arPriv->arGroupCrypto)); - - /* Stop getting pkts from upper stack */ - netif_stop_queue(arPriv->arNetDev); - /* Flush the Tx queues */ - ar6000_TxDataCleanup(ar); - /* Start getting pkts from upper stack */ - netif_wake_queue(arPriv->arNetDev); - - ar6000_ap_mode_profile_commit(arPriv); - - return 0; -} - -#define W_PROTO(_x) wait_ ## _x -#define WAIT_HANDLER_IMPL(_x, type) \ -int wait_ ## _x (struct net_device *dev, struct iw_request_info *info, type wrqu, char *extra) {\ - int ret; \ - dev_hold(dev); \ - rtnl_unlock(); \ - ret = _x(dev, info, wrqu, extra); \ - rtnl_lock(); \ - dev_put(dev); \ - return ret;\ -} - -WAIT_HANDLER_IMPL(ar6000_ioctl_siwessid, struct iw_point *) -WAIT_HANDLER_IMPL(ar6000_ioctl_giwrate, struct iw_param *) -WAIT_HANDLER_IMPL(ar6000_ioctl_giwtxpow, struct iw_param *) -WAIT_HANDLER_IMPL(ar6000_ioctl_giwrange, struct iw_point*) - -/* Structures to export the Wireless Handlers */ -static const iw_handler ath_handlers[] = { - (iw_handler) ar6000_ioctl_siwcommit, /* SIOCSIWCOMMIT */ - (iw_handler) ar6000_ioctl_giwname, /* SIOCGIWNAME */ - (iw_handler) NULL, /* SIOCSIWNWID */ - (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) ar6000_ioctl_siwfreq, /* SIOCSIWFREQ */ - (iw_handler) ar6000_ioctl_giwfreq, /* SIOCGIWFREQ */ - (iw_handler) ar6000_ioctl_siwmode, /* SIOCSIWMODE */ - (iw_handler) ar6000_ioctl_giwmode, /* SIOCGIWMODE */ - (iw_handler) ar6000_ioctl_siwsens, /* SIOCSIWSENS */ - (iw_handler) ar6000_ioctl_giwsens, /* SIOCGIWSENS */ - (iw_handler) NULL /* not _used */, /* SIOCSIWRANGE */ - (iw_handler) W_PROTO(ar6000_ioctl_giwrange),/* SIOCGIWRANGE */ - (iw_handler) ar6000_ioctl_siwpriv, /* SIOCSIWPRIV */ - (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */ - (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */ - (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */ - (iw_handler) NULL, /* SIOCSIWSPY */ - (iw_handler) NULL, /* SIOCGIWSPY */ - (iw_handler) NULL, /* SIOCSIWTHRSPY */ - (iw_handler) NULL, /* SIOCGIWTHRSPY */ - (iw_handler) ar6000_ioctl_siwap, /* SIOCSIWAP */ - (iw_handler) ar6000_ioctl_giwap, /* SIOCGIWAP */ -#if (WIRELESS_EXT >= 18) - (iw_handler) ar6000_ioctl_siwmlme, /* SIOCSIWMLME */ -#else - (iw_handler) NULL, /* -- hole -- */ -#endif /* WIRELESS_EXT >= 18 */ - (iw_handler) ar6000_ioctl_iwaplist, /* SIOCGIWAPLIST */ - (iw_handler) ar6000_ioctl_siwscan, /* SIOCSIWSCAN */ - (iw_handler) ar6000_ioctl_giwscan, /* SIOCGIWSCAN */ - (iw_handler) W_PROTO(ar6000_ioctl_siwessid),/* SIOCSIWESSID */ - (iw_handler) ar6000_ioctl_giwessid, /* SIOCGIWESSID */ - (iw_handler) NULL, /* SIOCSIWNICKN */ - (iw_handler) NULL, /* SIOCGIWNICKN */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) ar6000_ioctl_siwrate, /* SIOCSIWRATE */ - (iw_handler) W_PROTO(ar6000_ioctl_giwrate), /* SIOCGIWRATE */ - (iw_handler) NULL, /* SIOCSIWRTS */ - (iw_handler) NULL, /* SIOCGIWRTS */ - (iw_handler) NULL, /* SIOCSIWFRAG */ - (iw_handler) NULL, /* SIOCGIWFRAG */ - (iw_handler) ar6000_ioctl_siwtxpow, /* SIOCSIWTXPOW */ - (iw_handler) W_PROTO(ar6000_ioctl_giwtxpow),/* SIOCGIWTXPOW */ - (iw_handler) ar6000_ioctl_siwretry, /* SIOCSIWRETRY */ - (iw_handler) ar6000_ioctl_giwretry, /* SIOCGIWRETRY */ - (iw_handler) ar6000_ioctl_siwencode, /* SIOCSIWENCODE */ - (iw_handler) ar6000_ioctl_giwencode, /* SIOCGIWENCODE */ -#if WIRELESS_EXT > 20 - (iw_handler) ar6000_ioctl_siwpower, /* SIOCSIWPOWER */ - (iw_handler) ar6000_ioctl_giwpower, /* SIOCGIWPOWER */ -#endif // WIRELESS_EXT > 20 -#if WIRELESS_EXT >= 18 - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) ar6000_ioctl_siwgenie, /* SIOCSIWGENIE */ - (iw_handler) ar6000_ioctl_giwgenie, /* SIOCGIWGENIE */ - (iw_handler) ar6000_ioctl_siwauth, /* SIOCSIWAUTH */ - (iw_handler) ar6000_ioctl_giwauth, /* SIOCGIWAUTH */ - (iw_handler) ar6000_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */ - (iw_handler) ar6000_ioctl_giwencodeext, /* SIOCGIWENCODEEXT */ - (iw_handler) ar6000_ioctl_siwpmksa, /* SIOCSIWPMKSA */ -#endif // WIRELESS_EXT >= 18 -}; - -struct iw_handler_def ath_iw_handler_def = { - .standard = (iw_handler *)ath_handlers, - .num_standard = ARRAY_SIZE(ath_handlers), -// .private = NULL, -// .num_private = 0, -}; diff --git a/drivers/net/wireless/ar6003/host/p2p/makefile b/drivers/net/wireless/ar6003/host/p2p/makefile deleted file mode 100644 index 1ba034c4900e..000000000000 --- a/drivers/net/wireless/ar6003/host/p2p/makefile +++ /dev/null @@ -1,26 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2005-2007 Atheros Corporation. All rights reserved. -# -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -#------------------------------------------------------------------------------ -#============================================================================== -# Author(s): ="Atheros" -#============================================================================== -!INCLUDE $(_MAKEENVROOT)\makefile.def - - - diff --git a/drivers/net/wireless/ar6003/host/p2p/p2p_internal.h b/drivers/net/wireless/ar6003/host/p2p/p2p_internal.h deleted file mode 100644 index 4dc905992538..000000000000 --- a/drivers/net/wireless/ar6003/host/p2p/p2p_internal.h +++ /dev/null @@ -1,93 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file contains internal definitions for the host P2P module. -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef __P2P_INTERNAL_H__ -#define __P2P_INTERNAL_H__ - -#include -#include -#include -#include - -/* P2P peer device context */ -struct host_p2p_dev { - DL_LIST list; - struct p2p_device dev; - struct p2p_dev_ctx *p2p; - A_UINT8 ref_cnt; - A_UINT8 *p2p_buf; - A_UINT32 p2p_buf_len; - A_UINT8 persistent_grp; -/* Persistent P2P Info*/ - A_UINT8 role_go; - A_UINT8 ssid[WMI_MAX_SSID_LEN]; - A_UINT8 ssid_len; -}; - -/* Global P2P Context structure */ -struct p2p_ctx { - A_INT8 go_intent; -}; - -struct p2p_sd_query { - struct p2p_sd_query *next; - A_UINT8 peer[ETH_ALEN]; - A_UINT8 for_all_peers; - A_UINT8 *tlvs; - A_UINT16 tlv_len; -}; - -/* Device specific P2P context */ -struct p2p_dev_ctx { - struct p2p_ctx *p2p_ctx; - DL_LIST devices; - A_UINT8 peer_filter[ETH_ALEN]; - A_UINT8 p2p_auth_invite[ETH_ALEN]; - void *dev; /* AR6K priv context */ - struct p2p_sd_query *sd_queries; - struct p2p_sd_query *curr_sd_query; - A_UINT8 srv_update_indic; -}; - -#define P2P_MAX_GROUP_ENTRIES 10 - -struct p2p_client_info { - const A_UINT8 *p2p_device_addr; - const A_UINT8 *p2p_interface_addr; - const A_UINT8 *pri_dev_type; - const A_UINT8 *sec_dev_types; - const A_CHAR *dev_name; - A_UINT32 dev_name_len; - A_UINT16 config_methods; - A_UINT8 dev_capab; - A_UINT8 num_sec_dev_types; -}; - -struct p2p_group_info { - A_UINT32 num_clients; - struct p2p_client_info client[P2P_MAX_GROUP_ENTRIES]; -}; - -#define P2P_GROUP_CAPAB_PERSISTENT_GROUP (1<<1) -#endif /* __P2P_INTERNAL_H__ */ diff --git a/drivers/net/wireless/ar6003/host/p2p/p2p_main.c b/drivers/net/wireless/ar6003/host/p2p/p2p_main.c deleted file mode 100644 index 6702fc80f7c5..000000000000 --- a/drivers/net/wireless/ar6003/host/p2p/p2p_main.c +++ /dev/null @@ -1,2676 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2009-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file implements the host side P2P module. -// -// Author(s): ="Atheros" -//============================================================================== - -#include -#include -#include -#include -#include -#include -#include -#include -#include "p2p_internal.h" - -#include -#define WPS_DEV_TYPE_BUFSIZE 21 -#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] -#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" -#include - -struct wmi_t; - -extern A_STATUS wmi_p2p_go_neg_rsp_cmd(struct wmi_t *wmip, A_UINT8 status, - A_UINT8 go_intent, A_UINT32 wps_method, A_UINT16 listen_freq, - A_UINT8 *wpsbuf, A_UINT32 wpslen, A_UINT8 *p2pbuf, A_UINT32 p2plen, - A_UINT8 dialog_token, A_UINT8 persistent_grp); - -extern A_STATUS wmi_p2p_invite_req_rsp_cmd(struct wmi_t *wmip, A_UINT8 status, - A_INT8 is_go, A_UINT8 *grp_bssid, A_UINT8 *p2pbuf, - A_UINT8 p2plen, A_UINT8 dialog_token); - -extern A_STATUS -wmi_p2p_go_neg_start(struct wmi_t *wmip, WMI_P2P_GO_NEG_START_CMD *go_param); - -extern A_STATUS wmi_p2p_invite_cmd(struct wmi_t *wmip, WMI_P2P_INVITE_CMD *buf); - -extern A_STATUS wmi_p2p_prov_disc_cmd(struct wmi_t *wmip, - WMI_P2P_PROV_DISC_REQ_CMD *buf); - -extern A_STATUS wmi_p2p_stop_sdpd(struct wmi_t *wmip); - -extern void wmi_node_return (struct wmi_t *wmip, bss_t *bss); - -extern void wmi_node_update_timestamp(struct wmi_t *wmip, bss_t *bss); - -extern void wmi_setup_node(struct wmi_t *wmip, bss_t *bss, const A_UINT8 *bssid); -extern bss_t *wmi_node_alloc(struct wmi_t *wmip, A_UINT8 len); - -extern bss_t *wmi_find_node(struct wmi_t *wmip, const A_UINT8 *macaddr); - - -static struct p2p_sd_query *p2p_pending_sd_req(struct p2p_dev_ctx *p2p_dev_ctx, - struct host_p2p_dev *dev); - - -/* Global P2P context */ -static struct p2p_ctx *g_p2p_ctx; - -#define IEEE80211_ELEMID_VENDOR 221 /* vendor private */ -#define IEEE80211_ELEMID_SSID 0 - -static A_STATUS p2p_parse_subelement(A_UINT8 id, const A_UINT8 *data, - A_UINT16 len, struct p2p_ie *p2p_ie) -{ - A_STATUS status = A_OK; - const A_UINT8 *pos; - A_UINT32 i, nlen; - - switch (id) { - case P2P_ATTR_CAPABILITY: - if (len < 2) { - return A_ERROR; - } - p2p_ie->capability = data; - break; - case P2P_ATTR_GROUP_OWNER_INTENT: - if (len < 1) { - return A_ERROR; - } - p2p_ie->go_intent = data; - break; - case P2P_ATTR_STATUS: - if (len < 1) { - return A_ERROR; - } - p2p_ie->status = data; - break; - case P2P_ATTR_LISTEN_CHANNEL: - if (len == 0) { - break; - } - if (len < 2) { - return A_ERROR; - } - p2p_ie->listen_channel = data; - break; - - case P2P_ATTR_OPERATING_CHANNEL: - if (len == 0) { - break; - } - if (len < 2) { - return A_ERROR; - } - p2p_ie->operating_channel = data; - break; - - case P2P_ATTR_CHANNEL_LIST: - if (len < 3) { - return A_ERROR; - } - p2p_ie->channel_list = data; - p2p_ie->channel_list_len = len; - break; - case P2P_ATTR_GROUP_INFO: - p2p_ie->group_info = data; - p2p_ie->group_info_len = len; - break; - case P2P_ATTR_DEVICE_INFO: - if (len < ETH_ALEN + 2 + 8 + 1) { - return A_ERROR; - } - p2p_ie->p2p_device_info = data; - p2p_ie->p2p_device_info_len = len; - pos = data; - p2p_ie->p2p_device_addr = pos; - pos += ETH_ALEN; - p2p_ie->config_methods = WPA_GET_BE16(pos); - pos += 2; - p2p_ie->pri_dev_type = pos; - pos += 8; - p2p_ie->num_sec_dev_types = *pos++; - if (p2p_ie->num_sec_dev_types * 8 > data + len - pos) { - return A_ERROR; - } - pos += p2p_ie->num_sec_dev_types * 8; - if (data + len - pos < 4) { - return A_ERROR; - } - if (WPA_GET_BE16(pos) != ATTR_DEV_NAME) { - return A_ERROR; - } - pos += 2; - nlen = WPA_GET_BE16(pos); - pos += 2; - if (data + len - pos < (int) nlen || nlen > 32) { - return A_ERROR; - } - A_MEMCPY(p2p_ie->device_name, pos, nlen); - p2p_ie->dev_name_len = nlen; - for (i = 0; i < nlen; i++) { - if (p2p_ie->device_name[i] == '\0') - break; - if (p2p_ie->device_name[i] < 32) - p2p_ie->device_name[i] = '_'; - } - break; - case P2P_ATTR_CONFIGURATION_TIMEOUT: - if (len < 2) { - return A_ERROR; - } - p2p_ie->config_timeout = data; - break; - case P2P_ATTR_INTENDED_INTERFACE_ADDR: - if (len < ETH_ALEN) { - return A_ERROR; - } - p2p_ie->intended_addr = data; - break; - default: - break; - } - - return status; -} - - -/** - * p2p_parse_p2p_ie - Parse P2P IE - */ -static A_STATUS p2p_parse_p2p_ie(const A_UINT8 *data, A_UINT8 len, struct p2p_ie *msg) -{ - A_STATUS status = A_OK; - const A_UINT8 *pos = data; - const A_UINT8 *end = pos + len; - - while (pos < end) { - A_UINT16 attr_len; - if (pos + 2 >= end) { - return A_ERROR; - } - attr_len = WPA_GET_LE16((pos + 1)); - if (pos + 3 + attr_len > end) { - return A_ERROR; - } - if ((status = p2p_parse_subelement(pos[0], pos + 3, attr_len, msg)) != - A_OK) { - return A_ERROR; - } - pos += 3 + attr_len; - } - - return status; -} - -static A_STATUS wps_set_attr(struct wps_parse_attr *attr, A_UINT16 type, - const A_UINT8 *pos, A_UINT16 len) -{ - A_STATUS status = A_OK; - - switch (type) { - case ATTR_VERSION: - if (len != 1) { - return A_ERROR; - } - attr->version = pos; - break; - case ATTR_MSG_TYPE: - if (len != 1) { - return A_ERROR; - } - attr->msg_type = pos; - break; - case ATTR_ENROLLEE_NONCE: - if (len != WPS_NONCE_LEN) { - return A_ERROR; - } - attr->enrollee_nonce = pos; - break; - case ATTR_REGISTRAR_NONCE: - if (len != WPS_NONCE_LEN) { - return A_ERROR; - } - attr->registrar_nonce = pos; - break; - case ATTR_UUID_E: - if (len != WPS_UUID_LEN) { - return A_ERROR; - } - attr->uuid_e = pos; - break; - case ATTR_UUID_R: - if (len != WPS_UUID_LEN) { - return A_ERROR; - } - attr->uuid_r = pos; - break; - case ATTR_AUTH_TYPE_FLAGS: - if (len != 2) { - return A_ERROR; - } - attr->auth_type_flags = pos; - break; - case ATTR_ENCR_TYPE_FLAGS: - if (len != 2) { - return A_ERROR; - } - attr->encr_type_flags = pos; - break; - case ATTR_CONN_TYPE_FLAGS: - if (len != 1) { - return A_ERROR; - } - attr->conn_type_flags = pos; - break; - case ATTR_CONFIG_METHODS: - if (len != 2) { - return A_ERROR; - } - attr->config_methods = pos; - break; - case ATTR_SELECTED_REGISTRAR_CONFIG_METHODS: - if (len != 2) { - return A_ERROR; - } - attr->sel_reg_config_methods = pos; - break; - case ATTR_PRIMARY_DEV_TYPE: - if (len != WPS_DEV_TYPE_LEN) { - return A_ERROR; - } - attr->primary_dev_type = pos; - break; - case ATTR_RF_BANDS: - if (len != 1) { - return A_ERROR; - } - attr->rf_bands = pos; - break; - case ATTR_ASSOC_STATE: - if (len != 2) { - return A_ERROR; - } - attr->assoc_state = pos; - break; - case ATTR_CONFIG_ERROR: - if (len != 2) { - return A_ERROR; - } - attr->config_error = pos; - break; - case ATTR_DEV_PASSWORD_ID: - if (len != 2) { - return A_ERROR; - } - attr->dev_password_id = pos; - break; - case ATTR_OS_VERSION: - if (len != 4) { - return A_ERROR; - } - attr->os_version = pos; - break; - case ATTR_WPS_STATE: - if (len != 1) { - return A_ERROR; - } - attr->wps_state = pos; - break; - case ATTR_AUTHENTICATOR: - if (len != WPS_AUTHENTICATOR_LEN) { - return A_ERROR; - } - attr->authenticator = pos; - break; - case ATTR_R_HASH1: - if (len != WPS_HASH_LEN) { - return A_ERROR; - } - attr->r_hash1 = pos; - break; - case ATTR_R_HASH2: - if (len != WPS_HASH_LEN) { - return A_ERROR; - } - attr->r_hash2 = pos; - break; - case ATTR_E_HASH1: - if (len != WPS_HASH_LEN) { - return A_ERROR; - } - attr->e_hash1 = pos; - break; - case ATTR_E_HASH2: - if (len != WPS_HASH_LEN) { - return A_ERROR; - } - attr->e_hash2 = pos; - break; - case ATTR_R_SNONCE1: - if (len != WPS_SECRET_NONCE_LEN) { - return A_ERROR; - } - attr->r_snonce1 = pos; - break; - case ATTR_R_SNONCE2: - if (len != WPS_SECRET_NONCE_LEN) { - return A_ERROR; - } - attr->r_snonce2 = pos; - break; - case ATTR_E_SNONCE1: - if (len != WPS_SECRET_NONCE_LEN) { - return A_ERROR; - } - attr->e_snonce1 = pos; - break; - case ATTR_E_SNONCE2: - if (len != WPS_SECRET_NONCE_LEN) { - return A_ERROR; - } - attr->e_snonce2 = pos; - break; - case ATTR_KEY_WRAP_AUTH: - if (len != WPS_KWA_LEN) { - return A_ERROR; - } - attr->key_wrap_auth = pos; - break; - case ATTR_AUTH_TYPE: - if (len != 2) { - return A_ERROR; - } - attr->auth_type = pos; - break; - case ATTR_ENCR_TYPE: - if (len != 2) { - return A_ERROR; - } - attr->encr_type = pos; - break; - case ATTR_NETWORK_INDEX: - if (len != 1) { - return A_ERROR; - } - attr->network_idx = pos; - break; - case ATTR_NETWORK_KEY_INDEX: - if (len != 1) { - return A_ERROR; - } - attr->network_key_idx = pos; - break; - case ATTR_MAC_ADDR: - if (len != ETH_ALEN) { - return A_ERROR; - } - attr->mac_addr = pos; - break; - case ATTR_KEY_PROVIDED_AUTO: - if (len != 1) { - return A_ERROR; - } - attr->key_prov_auto = pos; - break; - case ATTR_802_1X_ENABLED: - if (len != 1) { - return A_ERROR; - } - attr->dot1x_enabled = pos; - break; - case ATTR_SELECTED_REGISTRAR: - if (len != 1) { - return A_ERROR; - } - attr->selected_registrar = pos; - break; - case ATTR_REQUEST_TYPE: - if (len != 1) { - return A_ERROR; - } - attr->request_type = pos; - break; - case ATTR_RESPONSE_TYPE: - if (len != 1) { - return A_ERROR; - } - attr->request_type = pos; - break; - case ATTR_MANUFACTURER: - attr->manufacturer = pos; - attr->manufacturer_len = len; - break; - case ATTR_MODEL_NAME: - attr->model_name = pos; - attr->model_name_len = len; - break; - case ATTR_MODEL_NUMBER: - attr->model_number = pos; - attr->model_number_len = len; - break; - case ATTR_SERIAL_NUMBER: - attr->serial_number = pos; - attr->serial_number_len = len; - break; - case ATTR_DEV_NAME: - attr->dev_name = pos; - attr->dev_name_len = len; - break; - case ATTR_PUBLIC_KEY: - attr->public_key = pos; - attr->public_key_len = len; - break; - case ATTR_ENCR_SETTINGS: - attr->encr_settings = pos; - attr->encr_settings_len = len; - break; - case ATTR_CRED: - if (attr->num_cred >= MAX_CRED_COUNT) { - break; - } - attr->cred[attr->num_cred] = pos; - attr->cred_len[attr->num_cred] = len; - attr->num_cred++; - break; - case ATTR_SSID: - attr->ssid = pos; - attr->ssid_len = len; - break; - case ATTR_NETWORK_KEY: - attr->network_key = pos; - attr->network_key_len = len; - break; - case ATTR_EAP_TYPE: - attr->eap_type = pos; - attr->eap_type_len = len; - break; - case ATTR_EAP_IDENTITY: - attr->eap_identity = pos; - attr->eap_identity_len = len; - break; - default: - break; - } - - return status; -} - -static A_STATUS wps_parse_msg(const A_UINT8 *data, A_UINT8 len, struct wps_parse_attr *attr) -{ - A_STATUS status = A_OK; - const A_UINT8 *pos, *end; - A_UINT16 type; - - A_MEMZERO(attr, sizeof(*attr)); - pos = data; - end = pos + len; - - while (pos < end) { - if (end - pos < 4) { - return A_ERROR; - } - - type = WPA_GET_BE16(pos); - pos += 2; - len = WPA_GET_BE16(pos); - pos += 2; - if (len > end - pos) { - return A_ERROR; - } - - if ((status = wps_set_attr(attr, type, pos, len)) != A_OK) { - return status; - } - - pos += len; - } - - return status; -} - - -static A_STATUS p2p_parse_wps_ie(const A_UINT8 *data, A_UINT8 len, struct p2p_ie *p2p_ie) -{ - A_STATUS status = A_OK; - struct wps_parse_attr attr; - - if ( (status = wps_parse_msg(data, len, &attr)) != A_OK ) { - return status; - } - - if (attr.dev_name && attr.dev_name_len < sizeof(p2p_ie->wps_device_name)) { - A_MEMCPY(p2p_ie->wps_device_name, attr.dev_name, attr.dev_name_len); - p2p_ie->wps_dev_name_len = attr.dev_name_len; - } - - if (attr.config_methods) { - p2p_ie->wps_config_methods = WPA_GET_BE16((attr.config_methods)); - } - - if (attr.dev_password_id) { - p2p_ie->dev_password_id = WPA_GET_BE16(attr.dev_password_id); - } - - if(attr.primary_dev_type) { - p2p_ie->wps_pri_dev_type = attr.primary_dev_type; - - } - - return status; -} -static A_STATUS p2p_get_ie(WMI_BI_FTYPE fType, const A_UINT8 *data, A_UINT32 len, A_UINT32 vendor_type, A_UINT8 **ie, A_UINT32 *ie_len) -{ - const A_UINT8 *frm, *efrm; - A_STATUS status = A_ENODEV; - struct p2p_ie p2p_ie ; - A_UINT8 tlv_len; - - switch(fType) { - case BEACON_FTYPE: - case PROBERESP_FTYPE: - /* - * beacon/probe response frame format - * [8] time stamp - * [2] beacon interval - * [2] capability information - * [tlv]s... - */ - data += 12; - len -= 12; - break; - case ACTION_MGMT_FTYPE: - /* Action frame format: - * [1] Category code - * [1] Action field - * [3] WFA Specific OUI - * [1] OUI Type - * [1] OUI SubType - * [1] Dialog Token - * [TLV]s... - * - P2P IE, WSC IE - */ - data += 8; - len -= 8; - break; - case PROBEREQ_FTYPE: - - break; - default: - A_ASSERT(FALSE); - break; - } - - frm = data; - efrm = (A_UINT8 *) (frm + len); - - while (frm < efrm) { - switch (*frm) { - case IEEE80211_ELEMID_VENDOR: - tlv_len = frm[1]-4; - if(isp2poui(frm) && (vendor_type == P2P_OUI) && (tlv_len)) { - status = p2p_parse_p2p_ie(frm+6, frm[1]-4, &p2p_ie); - if(status == A_OK && (frm[1] -4 !=0)) { - *ie = (A_UINT8 *)frm+6; - *ie_len = frm[1]-4 ; - } - } - break; - default: - break; - } - /* Discontinue parsing if there is a bad IE */ - if (status != A_OK && status != A_ENODEV) { - break; - } - frm += frm[1] + 2; - } - - return status; -} -/** - * p2p_parse_ies - Parse P2P message IEs (both WPS and P2P IE) - */ -static A_STATUS p2p_parse_ies(const A_UINT8 *data, A_UINT32 len, struct p2p_ie *p2p_ie) -{ - const A_UINT8 *frm, *efrm; - A_STATUS status = A_ENODEV; - A_BOOL found = FALSE; - - frm = data; - efrm = (A_UINT8 *) (frm + len); - - while (frm < efrm) { - switch (*frm) { - case IEEE80211_ELEMID_VENDOR: - if(iswscoui(frm)) { - status = p2p_parse_wps_ie(frm+6, frm[1]-4, p2p_ie); - } else if(isp2poui(frm)) { - found = TRUE; - status = p2p_parse_p2p_ie(frm+6, frm[1]-4, p2p_ie); - } - break; - case IEEE80211_ELEMID_SSID: - p2p_ie->ssid = frm; - break; - default: - break; - } - /* Discontinue parsing if there is a bad IE */ - if (status != A_OK && status != A_ENODEV) { - break; - } - frm += frm[1] + 2; - } - - if (status == A_OK && !found) { - status = A_ENODEV; - } - - return status; -} - -/* This function prunes the frame depending on its type to point the data ptr to - * the IEs portion of the frame & calls the p2p_parse_ies() to parse the P2P & - * WPS IEs. - */ -static A_STATUS p2p_parse(WMI_BI_FTYPE fType, const A_UINT8 *data, A_UINT32 len, struct p2p_ie *p2p_ie) -{ - A_STATUS status = A_OK; - - switch(fType) { - case BEACON_FTYPE: - case PROBERESP_FTYPE: - /* - * beacon/probe response frame format - * [8] time stamp - * [2] beacon interval - * [2] capability information - * [tlv]s... - */ - data += 12; - len -= 12; - break; - case ACTION_MGMT_FTYPE: - /* Action frame format: - * [1] Category code - * [1] Action field - * [3] WFA Specific OUI - * [1] OUI Type - * [1] OUI SubType - * [1] Dialog Token - * [TLV]s... - * - P2P IE, WSC IE - */ - p2p_ie->dialog_token = *(data+7); - data += 8; - len -= 8; - break; - - case PROBEREQ_FTYPE: - - break; - default: - A_ASSERT(FALSE); - break; - } - - status = p2p_parse_ies(data, len, p2p_ie); - - return status; -} - -static A_STATUS p2p_group_info_parse(const A_UINT8 *group_info, A_UINT32 group_info_len, - struct p2p_group_info *info) -{ - const A_UINT8 *start, *end; - - A_MEMZERO(info, sizeof(*info)); - - start = group_info; - end = start + group_info_len; - - - while (start < end) { - struct p2p_client_info *cli; - - const A_UINT8 *t, *cend; - A_UINT32 count; - - cli = &info->client[info->num_clients]; - cend = start + 1 + start[0]; - - if (cend > end) { - return A_ERROR; /* invalid data */ - } - - /* 'start' at begin of P2P Client Info Descriptor */ - /* t at Device Capability Bitmap */ - t = start + 1 + 2 * ETH_ALEN; - if (t > cend) { - return A_ERROR; /* invalid data */ - } - - cli->p2p_device_addr = start + 1; - cli->p2p_interface_addr = start + 1 + ETH_ALEN; - cli->dev_capab = t[0]; - - if (t + 1 + 2 + 8 + 1 > cend) { - return A_ERROR; /* invalid data */ - } - - cli->config_methods = WPA_GET_BE16(&t[1]); - cli->pri_dev_type = &t[3]; - - t += 1 + 2 + 8; - /* t at Number of Secondary Device Types */ - cli->num_sec_dev_types = *t++; - if (t + 8 * cli->num_sec_dev_types > cend) { - return A_ERROR; /* invalid data */ - } - cli->sec_dev_types = t; - t += 8 * cli->num_sec_dev_types; - - /* t at Device Name in WPS TLV format */ - if (t + 2 + 2 > cend) { - return A_ERROR; /* invalid data */ - } - if (WPA_GET_BE16(t) != ATTR_DEV_NAME) { - return A_ERROR; /* invalid Device Name TLV */ - } - t += 2; - count = WPA_GET_BE16(t); - t += 2; - if (count > cend - t) { - return A_ERROR; /* invalid Device Name TLV */ - } - if (count >= 32) { - count = 32; - } - cli->dev_name = (const char *) t; - cli->dev_name_len = count; - - start = cend; - - info->num_clients++; - if (info->num_clients == P2P_MAX_GROUP_ENTRIES) { - return A_ERROR; - } - } - - return A_OK; -} - -static void p2p_copy_client_info(struct host_p2p_dev *dev, - struct p2p_client_info *cli) -{ - A_MEMCPY((dev->dev).device_name, cli->dev_name, cli->dev_name_len); - (dev->dev).device_name[cli->dev_name_len] = '\0'; - (dev->dev).dev_capab = cli->dev_capab; - (dev->dev).config_methods = cli->config_methods; - A_MEMCPY((dev->dev).pri_dev_type, cli->pri_dev_type, 8); -} - - -//static A_STATUS ieee802_11_vendor_ie_concat(const A_UINT8 *ies, -// A_UINT32 ies_len, A_UINT32 oui_type, A_UINT8 *buf, A_UINT32 *buflen) -//{ -// const A_UINT8 *end, *pos, *ie; -// A_UINT8 len=0; -// -// pos = ies; -// end = ies + ies_len; -// ie = NULL; -// -// while (pos + 1 < end) { -// if (pos + 2 + pos[1] > end) -// return A_ERROR; -// if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 && -// WPA_GET_BE32(&pos[2]) == oui_type) { -// ie = pos; -// break; -// } -// pos += 2 + pos[1]; -// } -// -// if (ie == NULL) { -// *buflen = 0; -// return A_OK; /* No specified vendor IE found */ -// } -// -// if (buf == NULL) -// return A_ERROR; -// -// /* -// * There may be multiple vendor IEs in the message, so need to -// * concatenate their data fields. -// */ -// while (pos + 1 < end) { -// if (pos + 2 + pos[1] > end) -// break; -// if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 && -// WPA_GET_BE32(&pos[2]) == oui_type) { -//#define MAX_BUF_SIZE 512 -// A_ASSERT((len+pos[1]-4) <= MAX_BUF_SIZE); -// A_MEMCPY(buf+len, pos+6, pos[1]-4); -// len += pos[1]-4; -// } -// pos += 2 + pos[1]; -// } -// -// /* store the length of the IE to return to the caller. -// */ -// *buflen = len; -// -// return A_OK; -//} - -static A_INT16 p2p_channel_to_freq_j4(A_UINT8 reg_class, A_UINT8 channel) -{ - /* Table J-4 in P802.11REVmb/D4.0 - Global operating classes */ - /* TODO: more regulatory classes */ - switch (reg_class) { - case 81: - /* channels 1..13 */ - if (channel < 1 || channel > 13) - return -1; - return 2407 + 5 * channel; - case 82: - /* channel 14 */ - if (channel != 14) - return -1; - return 2414 + 5 * channel; - case 83: /* channels 1..9; 40 MHz */ - case 84: /* channels 5..13; 40 MHz */ - if (channel < 1 || channel > 13) - return -1; - return 2407 + 5 * channel; - case 115: /* channels 36,40,44,48; indoor only */ - case 118: /* channels 52,56,60,64; dfs */ - if (channel < 36 || channel > 64) - return -1; - return 5000 + 5 * channel; - case 124: /* channels 149,153,157,161 */ - case 125: /* channels 149,153,157,161,165,169 */ - if (channel < 149 || channel > 161) - return -1; - return 5000 + 5 * channel; - case 116: /* channels 36,44; 40 MHz; indoor only */ - case 117: /* channels 40,48; 40 MHz; indoor only */ - case 119: /* channels 52,60; 40 MHz; dfs */ - case 120: /* channels 56,64; 40 MHz; dfs */ - if (channel < 36 || channel > 64) - return -1; - return 5000 + 5 * channel; - case 126: /* channels 149,157; 40 MHz */ - case 127: /* channels 153,161; 40 MHz */ - if (channel < 149 || channel > 161) - return -1; - return 5000 + 5 * channel; - } - return -1; -} - - -/** - * p2p_channel_to_freq - Convert channel info to frequency - * @country: Country code - * @reg_class: Regulatory class - * @channel: Channel number - * Returns: Frequency in MHz or -1 if the specified channel is unknown - */ -static A_INT16 p2p_channel_to_freq(const A_CHAR *country, A_UINT8 reg_class, A_UINT8 channel) -{ - if (country[2] == 0x04) { - return p2p_channel_to_freq_j4(reg_class, channel); - } - - /* These are mainly for backwards compatibility; to be removed */ - switch (reg_class) { - case 1: /* US/1, EU/1, JP/1 = 5 GHz, channels 36,40,44,48 */ - if (channel < 36 || channel > 48) - return -1; - return 5000 + 5 * channel; - case 3: /* US/3 = 5 GHz, channels 149,153,157,161 */ - case 5: /* US/5 = 5 GHz, channels 149,153,157,161 */ - if (channel < 149 || channel > 161) - return -1; - return 5000 + 5 * channel; - case 4: /* EU/4 = 2.407 GHz, channels 1..13 */ - case 12: /* US/12 = 2.407 GHz, channels 1..11 */ - case 30: /* JP/30 = 2.407 GHz, channels 1..13 */ - if (channel < 1 || channel > 13) - return -1; - return 2407 + 5 * channel; - case 31: /* JP/31 = 2.414 GHz, channel 14 */ - if (channel != 14) - return -1; - return 2414 + 5 * channel; - } - - return -1; -} - -static void p2p_add_device_info_from_scan_data(struct p2p_dev_ctx *p2p_dev_ctx, struct host_p2p_dev *p2p_peer, A_UINT8 *addr, A_UINT16 channel, const A_UINT8 *p2p_dev_addr, struct p2p_ie *msg, const A_UINT8 *data, A_UINT32 len) -{ - if (A_MEMCMP(addr, p2p_dev_addr, ETH_ALEN) != 0) { - A_MEMCPY(p2p_peer->dev.interface_addr, addr, ETH_ALEN); - } - - if (msg->ssid && - (msg->ssid[1] != P2P_WILDCARD_SSID_LEN || - A_MEMCMP(msg->ssid + 2, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN) - != 0)) { - A_MEMCPY(p2p_peer->dev.oper_ssid, msg->ssid + 2, msg->ssid[1]); - p2p_peer->dev.oper_ssid_len = msg->ssid[1]; - - A_MEMCPY(p2p_peer->dev.interface_addr, addr, ETH_ALEN); - } - - p2p_peer->dev.listen_freq = channel; - - if (msg->group_info) { - p2p_peer->dev.oper_freq = channel; - } - - if (msg->pri_dev_type) { - A_MEMCPY(p2p_peer->dev.pri_dev_type, msg->pri_dev_type, - sizeof(p2p_peer->dev.pri_dev_type)); - } - - A_MEMCPY(p2p_peer->dev.device_name, msg->device_name, sizeof(p2p_peer->dev.device_name)); - - p2p_peer->dev.config_methods = msg->config_methods ? msg->config_methods : - msg->wps_config_methods; - - if (msg->capability) { - p2p_peer->dev.dev_capab = msg->capability[0]; - p2p_peer->dev.group_capab = msg->capability[1]; - } - - if (msg->ext_listen_timing) { - p2p_peer->dev.ext_listen_period = WPA_GET_LE16(msg->ext_listen_timing); - p2p_peer->dev.ext_listen_interval = - WPA_GET_LE16(msg->ext_listen_timing + 2); - } - - /* TODO: Add group clients if this is a beacon containing grp info attribute - * in the P2P IE. - */ - - /* If the device reported by other then probe req only then DONOT report again. - * But if this dev is reported ONLY by probe req, report again with mode info. - */ - if ((p2p_peer->dev.flags & P2P_DEV_REPORTED) && ((p2p_peer->dev.flags & P2P_DEV_PROBE_REQ_ONLY) == 0)) - return; - - if (p2p_peer->dev.flags & P2P_DEV_USER_REJECTED) { - return; - } - - /* report device to driver & App */ - A_WMI_P2PDEV_EVENT(p2p_dev_ctx->dev, addr, p2p_dev_addr, msg->pri_dev_type, - msg->device_name, msg->dev_name_len, - msg->config_methods, - msg->capability[0], msg->capability[1]); - - p2p_peer->dev.flags |= P2P_DEV_REPORTED; - - p2p_peer->dev.flags &= - ~(P2P_DEV_PROBE_REQ_ONLY | P2P_DEV_GROUP_CLIENT_ONLY); - return; -} - -static void p2p_add_device_info_from_action_frame(struct p2p_dev_ctx - *p2p_dev_ctx, struct host_p2p_dev *p2p_peer, - A_UINT8 *addr, struct p2p_ie *msg) -{ - A_INT16 freq; - - if (msg->pri_dev_type) { - A_MEMCPY(p2p_peer->dev.pri_dev_type, msg->pri_dev_type, - sizeof(p2p_peer->dev.pri_dev_type)); - } - - A_MEMCPY(p2p_peer->dev.device_name, msg->device_name, sizeof(p2p_peer->dev.device_name)); - - p2p_peer->dev.config_methods = msg->config_methods ? msg->config_methods : - msg->wps_config_methods; - - if (msg->capability) { - p2p_peer->dev.dev_capab = msg->capability[0]; - p2p_peer->dev.group_capab = msg->capability[1]; - } - - if (msg->listen_channel) { - freq = p2p_channel_to_freq((const A_CHAR *)msg->listen_channel, - msg->listen_channel[3], msg->listen_channel[4]); - if (freq > 0) { - p2p_peer->dev.listen_freq = freq; - } - } - - if (msg->ext_listen_timing) { - p2p_peer->dev.ext_listen_period = WPA_GET_LE16(msg->ext_listen_timing); - p2p_peer->dev.ext_listen_interval = - WPA_GET_LE16(msg->ext_listen_timing + 2); - } - - if (p2p_peer->dev.flags & P2P_DEV_PROBE_REQ_ONLY) { - p2p_peer->dev.flags &= ~P2P_DEV_PROBE_REQ_ONLY; - } - - p2p_peer->dev.flags &= ~P2P_DEV_GROUP_CLIENT_ONLY; - - - /* report device to driver & App */ - A_WMI_P2PDEV_EVENT(p2p_dev_ctx->dev, addr, p2p_peer->dev.p2p_device_addr, - msg->pri_dev_type, - msg->device_name, msg->dev_name_len, - msg->config_methods, - (msg->capability) ? msg->capability[0]:0, (msg->capability)?msg->capability[1]:0); - - p2p_peer->dev.flags |= P2P_DEV_REPORTED; - - return; -} - -struct host_p2p_dev *p2p_get_device(void *ctx, const A_UINT8 *addr) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - struct host_p2p_dev *dev; - PDL_LIST pListItem; - - ITERATE_OVER_LIST(&p2p_dev_ctx->devices, pListItem) { - dev = A_CONTAINING_STRUCT(pListItem, struct host_p2p_dev, list); - if (A_MEMCMP((dev->dev).p2p_device_addr, addr, ETH_ALEN) == 0) { - return dev; - } - } - - return NULL; -} - -struct host_p2p_dev *p2p_get_next_device(void *ctx, const A_UINT8 *addr, int first_element) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - struct host_p2p_dev *dev; - PDL_LIST pListItem; - - if (first_element) { - /* - * If the request is for the FIRST element, there is no - * address of the item before the desired item to return, - * so we just return the first element in the list. - */ - if (DL_LIST_IS_EMPTY(&p2p_dev_ctx->devices)) { - return NULL; - } - pListItem = DL_LIST_GET_ITEM_AT_HEAD(&p2p_dev_ctx->devices); - return A_CONTAINING_STRUCT(pListItem, struct host_p2p_dev, list); - } - ITERATE_OVER_LIST(&p2p_dev_ctx->devices, pListItem) { - /* - * Iterate over the list. If we find the item with the - * matching address, return the NEXT element in the list. - * The DL_LIST is a doubly-linked list with &p2p_dev_ctx->devices - * at both the head and tail of the list. This struct is - * not a list element itself, but is used to mark where the list - * begins and ends. Therefore, if the NEXT item in the list - * is &p2p_dev_ctx->devices, we've reached the end, and we should - * continue (which will break out of the ITERATE_OVER_LIST loop - * and then return NULL - */ - dev = A_CONTAINING_STRUCT(pListItem, struct host_p2p_dev, list); - if (A_MEMCMP((dev->dev).p2p_device_addr, addr, ETH_ALEN) == 0) { - if (pListItem->pNext == &p2p_dev_ctx->devices) { - continue; - } - return A_CONTAINING_STRUCT(pListItem->pNext, struct host_p2p_dev, list); - } - } - return NULL; -} - -struct host_p2p_dev *p2p_get_device_intf_addrs(void *ctx, const A_UINT8 *intfaddr) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - struct host_p2p_dev *dev; - PDL_LIST pListItem; - - ITERATE_OVER_LIST(&p2p_dev_ctx->devices, pListItem) { - dev = A_CONTAINING_STRUCT(pListItem, struct host_p2p_dev, list); - if (A_MEMCMP((dev->dev).interface_addr, intfaddr, ETH_ALEN) == 0) { - return dev; - } - } - - return NULL; -} - -static struct host_p2p_dev *p2p_create_device(struct p2p_dev_ctx *p2p_dev_ctx, - const A_UINT8 *addr) -{ - struct host_p2p_dev *p2p_dev = NULL; - - /* check if the device is already in the list. If so return the dev, - */ - p2p_dev = p2p_get_device(p2p_dev_ctx, addr); - - if (p2p_dev) { - return p2p_dev; - } - - p2p_dev = A_MALLOC_NOWAIT(sizeof(struct host_p2p_dev)); - if (!p2p_dev) { - return NULL; - } - A_MEMZERO(p2p_dev, sizeof(struct host_p2p_dev)); - DL_LIST_INIT(&p2p_dev->list); - p2p_dev->p2p = p2p_dev_ctx; - - /* Add to the device list */ - DL_ListAdd(&p2p_dev_ctx->devices,&p2p_dev->list); - A_MEMCPY((p2p_dev->dev).p2p_device_addr, addr, ETH_ALEN); - p2p_dev->p2p_buf = NULL; - p2p_dev->p2p_buf_len = 0; - - A_PRINTF("+: %x:%x\n", addr[4], addr[5]); - - return p2p_dev; -} - -/* API Routines */ - -void *p2p_init(void *dev) -{ - struct p2p_dev_ctx *p2p_dev_ctx = NULL; - - /* Allocate the global P2P context if not yet allocated */ - if (!g_p2p_ctx) { - g_p2p_ctx = (struct p2p_ctx *) A_MALLOC_NOWAIT(sizeof(struct p2p_ctx)); - if (!g_p2p_ctx) { - return NULL; - } - A_MEMZERO(g_p2p_ctx, sizeof(struct p2p_ctx)); - - /* Initialize dev common state. - */ - g_p2p_ctx->go_intent = -1; - } - - /* Allocate the device specific P2P context. - */ - p2p_dev_ctx = (struct p2p_dev_ctx *) - A_MALLOC_NOWAIT(sizeof(struct p2p_dev_ctx)); - if (!p2p_dev_ctx) { - return NULL; - } - A_MEMZERO(p2p_dev_ctx, sizeof(struct p2p_dev_ctx)); - p2p_dev_ctx->p2p_ctx = g_p2p_ctx; - - /* Store a ref to the dev in the device context - */ - p2p_dev_ctx->dev = dev; - DL_LIST_INIT(&p2p_dev_ctx->devices); - - return (void *)p2p_dev_ctx; -} - -void *p2p_bssinfo_rx(void *ctx, WMI_BI_FTYPE fType, A_UINT8 *addr, A_UINT16 channel, const A_UINT8 *data, A_UINT32 len) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - struct p2p_ie msg; - struct host_p2p_dev *peer_dev = NULL; - A_STATUS status = A_OK; - const A_UINT8 *p2p_dev_addr=NULL; - A_UINT8 myaddr[ETH_ALEN]; - - A_MEMZERO(&msg, sizeof(struct p2p_ie)); - - A_WMI_GET_DEVICE_ADDR(p2p_dev_ctx->dev, myaddr); - - status = p2p_parse(fType, data, len, &msg); - if (status != A_OK) { - /* No P2P IE or Bad P2P/WPS IE */ - return NULL; - } else { - if (fType == BEACON_FTYPE || fType == PROBERESP_FTYPE) { - /* If the bssinfo msg is of Beacon|Probe-resp type check if - * the device address or device id is present in the msg. if - * not ignore scan data without p2p device info or device id. - */ - if (msg.p2p_device_addr) { - p2p_dev_addr = msg.p2p_device_addr; - } else if (msg.device_id) { - p2p_dev_addr = msg.device_id; - } else { - /* No p2p device id or device address. Ignore this dev */ - return NULL; - } - - if (!is_zero_mac_addr(p2p_dev_ctx->peer_filter) && - A_MEMCMP(p2p_dev_addr, p2p_dev_ctx->peer_filter, - ETH_ALEN) != 0) { - /* dev does not match the set peer filter. Ignore this dev */ - return NULL; - } - - peer_dev = p2p_create_device(p2p_dev_ctx, p2p_dev_addr); - - if (!peer_dev) { - return NULL; - } - - /* Update device info frm scan data */ - p2p_add_device_info_from_scan_data(p2p_dev_ctx, peer_dev, addr, - channel, p2p_dev_addr, &msg, data, len); - - p2p_get_ie(fType, data, len, P2P_OUI, &peer_dev->p2p_buf, &peer_dev->p2p_buf_len); - - /* Mark the device for SD if any. - */ - if (p2p_pending_sd_req(p2p_dev_ctx, peer_dev)) { - peer_dev->dev.flags |= P2P_DEV_SD_SCHEDULE; - } - - /* Add device nodes for each client info descriptor in the Group Info element, - * if the Group Info element is present in the probe-resp frame. - */ - if (msg.group_info && msg.group_info_len) { - struct p2p_group_info info; - - /* Group Info element present. - */ - if (p2p_group_info_parse(msg.group_info, msg.group_info_len, &info) == A_OK) { - PDL_LIST pListItem; - struct host_p2p_dev *dev; - A_UINT8 num; - - /* Clear old data for this group. - */ - ITERATE_OVER_LIST(&p2p_dev_ctx->devices, pListItem) { - dev = A_CONTAINING_STRUCT(pListItem, struct host_p2p_dev, list); - if (A_MEMCMP((dev->dev).member_in_go_iface, addr, ETH_ALEN) == 0) { - A_MEMZERO((dev->dev).member_in_go_iface, ETH_ALEN); - A_MEMZERO((dev->dev).member_in_go_dev, ETH_ALEN); - } - } - - /* Update device list based on latest client info desc from this - * group. - */ - - for (num=0; num < info.num_clients; num++) { - struct p2p_client_info *cli = &info.client[num]; - - /* If this client info desc. is our own, discard it. - */ - if (A_MEMCMP(cli->p2p_device_addr, myaddr, ETH_ALEN) - == 0) { - continue; - } - - dev = p2p_get_device(p2p_dev_ctx, cli->p2p_device_addr); - if (dev) { - bss_t *bss=NULL; - /* Update device details if what is present is not got directly from the - * client. - */ - if ((dev->dev).flags & (P2P_DEV_GROUP_CLIENT_ONLY | P2P_DEV_PROBE_REQ_ONLY)) { - p2p_copy_client_info(dev, cli); - } - - if ((dev->dev).flags & P2P_DEV_PROBE_REQ_ONLY) { - (dev->dev).flags &= ~P2P_DEV_PROBE_REQ_ONLY; - } - - - /* Update the WLAN Node timestamp for this dev. - */ - bss = wmi_find_node(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev), cli->p2p_device_addr); - if (bss) { - wmi_node_update_timestamp(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev), bss); - wmi_node_return(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev), bss); - } - } else { - bss_t *bss=NULL; - /* Add new device to the list. Also setup a Node entry in the WLAN node - * (Scan table). - */ - dev = p2p_create_device(p2p_dev_ctx, cli->p2p_device_addr); - if (dev == NULL) { - continue; - } - - (dev->dev).flags |= P2P_DEV_GROUP_CLIENT_ONLY; - p2p_copy_client_info(dev, cli); - (dev->dev).oper_freq = channel; - - /* Mark the device for SD if any. - */ - if (p2p_pending_sd_req(p2p_dev_ctx, peer_dev)) { - peer_dev->dev.flags |= P2P_DEV_SD_SCHEDULE; - } - - /* Setup a WLAN node entry */ - bss = wmi_node_alloc(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev), 0); - - if (bss == NULL) { - p2p_device_free(dev); - continue; - } - - wmi_setup_node(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev), bss, cli->p2p_device_addr); - - /* Initialize bss state. - */ - bss->p2p_dev = dev; - /* Bump up the p2p dev ref. count. - */ - p2p_increment_dev_ref_count(dev); - bss->ni_frametype = fType; - - /* report device to driver & App */ - A_WMI_P2PDEV_EVENT(p2p_dev_ctx->dev, addr, cli->p2p_device_addr, cli->pri_dev_type, - cli->dev_name, cli->dev_name_len, - cli->config_methods, - cli->dev_capab, 0); - - dev->dev.flags |= P2P_DEV_REPORTED; - } - - A_MEMCPY((dev->dev).interface_addr, cli->p2p_interface_addr, ETH_ALEN); - A_MEMCPY((dev->dev).member_in_go_dev, p2p_dev_addr, ETH_ALEN); - A_MEMCPY((dev->dev).member_in_go_iface, addr, ETH_ALEN); - } - } - } - } /* BEACON_FTYPE || PROBERESP_FTYPE */ - else if (fType == ACTION_MGMT_FTYPE) { - peer_dev = p2p_create_device(p2p_dev_ctx, addr); - - if (!peer_dev) { - return NULL; - } - - /* Update device info from ACTION frame (GO Neg. Req. or Invitation - * or Provisional Disc Req. frames). - */ - p2p_add_device_info_from_action_frame(p2p_dev_ctx, peer_dev, addr, - &msg); - p2p_get_ie(fType, data, len, P2P_OUI, &peer_dev->p2p_buf, &peer_dev->p2p_buf_len); - - /* Mark the device for SD if any. - */ - if (p2p_pending_sd_req(p2p_dev_ctx, peer_dev)) { - peer_dev->dev.flags |= P2P_DEV_SD_SCHEDULE; - } - - } /* ACTION_MGMT_FTYPE */ - else if (fType == PROBEREQ_FTYPE) { - - /* Add this peer to device list only if it is a probe req with wildcard SSID. Probe - * req frames with non-wildcard SSID shall come from p2p groups & hence not used to - * populate our device list. - */ - if (msg.ssid == NULL || msg.ssid[1] != P2P_WILDCARD_SSID_LEN || - A_MEMCMP(msg.ssid + 2, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN) - != 0) { - return NULL; - } - - peer_dev = p2p_create_device(p2p_dev_ctx, addr); - - if (!peer_dev) { - return NULL; - } - - if (msg.capability) { - peer_dev->dev.dev_capab = msg.capability[0]; - peer_dev->dev.group_capab = msg.capability[1]; - } - - if (msg.listen_channel) { - A_MEMCPY(peer_dev->dev.country, msg.listen_channel, 3); - peer_dev->dev.listen_freq = p2p_channel_to_freq(peer_dev->dev.country, - msg.listen_channel[3], - msg.listen_channel[4]); - } - - A_MEMCPY(peer_dev->dev.device_name, msg.wps_device_name, sizeof(peer_dev->dev.device_name)); - - if (msg.pri_dev_type) { - A_MEMCPY(peer_dev->dev.pri_dev_type, msg.pri_dev_type, - sizeof(peer_dev->dev.pri_dev_type)); - } - else if(msg.wps_pri_dev_type) { - A_MEMCPY(peer_dev->dev.pri_dev_type, msg.wps_pri_dev_type, - sizeof(peer_dev->dev.pri_dev_type)); - } - - /* Mark the device for SD if any. - */ - if (p2p_pending_sd_req(p2p_dev_ctx, peer_dev)) { - peer_dev->dev.flags |= P2P_DEV_SD_SCHEDULE; - } - - if (peer_dev->dev.flags & P2P_DEV_REPORTED || - peer_dev->dev.flags & P2P_DEV_USER_REJECTED) { - return (void *)peer_dev; - } - peer_dev->dev.flags |= P2P_DEV_PROBE_REQ_ONLY; - - /* report device to driver & App */ - A_WMI_P2PDEV_EVENT(p2p_dev_ctx->dev, addr, peer_dev->dev.p2p_device_addr, - peer_dev->dev.pri_dev_type, - msg.wps_device_name, msg.wps_dev_name_len, - msg.wps_config_methods, - (msg.capability) ? msg.capability[0]:0, (msg.capability)?msg.capability[1]:0); - - peer_dev->dev.flags |= P2P_DEV_REPORTED; - - } /* PROBEREQ_FTYPE */ - } - - return (void *)peer_dev; -} - -void p2p_go_neg_req_rx(void *ctx, const A_UINT8 *datap, A_UINT8 len) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - struct p2p_ctx *p2p_cmn_ctx = (struct p2p_ctx *)p2p_dev_ctx->p2p_ctx; - WMI_P2P_GO_NEG_REQ_EVENT *ev = (WMI_P2P_GO_NEG_REQ_EVENT *)datap; - struct host_p2p_dev *peer = NULL; - enum p2p_status_code result = P2P_SC_SUCCESS; - - /* Get hold of the peer device from the device list. - */ - peer = p2p_get_device(p2p_dev_ctx, ev->sa); - - A_ASSERT(peer != NULL); - - if (peer->dev.flags & P2P_DEV_USER_REJECTED) { - result = P2P_SC_FAIL_REJECTED_BY_USER; - goto send_rsp; - } - - if (peer->dev.wps_method == WPS_NOT_READY) { - struct p2p_ie p2p_ie; - - A_MEMZERO(&p2p_ie, sizeof(struct p2p_ie)); - result = P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE; - peer->dev.flags |= P2P_DEV_PEER_WAITING_RESPONSE; - - /* Parse the dev passwd id from the WPS iE in the GO Neg. req. - */ - p2p_parse_wps_ie(ev->wps_buf, ev->wps_buflen, &p2p_ie); - - A_WMI_P2PGONEG_REQ_EVENT(p2p_dev_ctx->dev, ev->sa, p2p_ie.dev_password_id); - goto send_rsp; - } - /*Parse P2P IE */ - { - struct p2p_ie p2p_ie; - A_MEMZERO(&p2p_ie, sizeof(struct p2p_ie)); - p2p_parse_p2p_ie(ev->p2p_buf, ev->p2p_buflen, &p2p_ie); - if(p2p_ie.capability[1] & P2P_GROUP_CAPAB_PERSISTENT_GROUP) - peer->persistent_grp = 1; - } - - /* The P2P/WPS IEs from the req buffer are copied to the resp. buffer. - */ - - /* Send WMI_P2P_GO_NEG_REQ_RSP_CMD with the user result - * , WPS method to use, go_intent to use. - */ -send_rsp: - wmi_p2p_go_neg_rsp_cmd(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev), result, - p2p_cmn_ctx->go_intent, peer->dev.wps_method, peer->dev.listen_freq, - ev->wps_buf, ev->wps_buflen, ev->p2p_buf, ev->p2p_buflen, - ev->dialog_token, peer->persistent_grp); - - return; -} - -void p2p_invite_req_rx(void *ctx, const A_UINT8 *datap, A_UINT8 len) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - WMI_P2P_INVITE_REQ_EVENT *inv_req_ev = (WMI_P2P_INVITE_REQ_EVENT *)datap; - struct host_p2p_dev *dev = NULL; - enum p2p_status_code status = P2P_SC_SUCCESS; - A_INT8 is_go=0; - A_UINT8 grp_bssid[ETH_ALEN]; - - /* Get hold of the peer device from the device list. - */ - dev = p2p_get_device(p2p_dev_ctx, inv_req_ev->sa); - - /* Device is not there in the list. Send a failure response for the - * Invitation. - */ - if (dev == NULL) { - status = P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE; - } else { - /* if the peer device is present in our dev list, check if the user has - * authorized to accept an invitation from this peer to join an active - * group. - */ - if (!inv_req_ev->is_persistent) { - if (is_zero_mac_addr(p2p_dev_ctx->p2p_auth_invite) || - (A_MEMCMP(inv_req_ev->sa, - p2p_dev_ctx->p2p_auth_invite, ETH_ALEN) && - (!is_zero_mac_addr(inv_req_ev->go_dev_addr) && - A_MEMCMP(inv_req_ev->go_dev_addr, - p2p_dev_ctx->p2p_auth_invite, ETH_ALEN) - ))) - { - /* Do not accept Invitation automatically. TODO: We can - * notify the user here & request approval. - */ - status = P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE; - } - } else { - /*Persistent Group */ - if(A_MEMCMP(dev->ssid, inv_req_ev->ssid.ssid, dev->ssid_len) == 0) { - if(dev->role_go) { - A_MEMCPY(grp_bssid, inv_req_ev->go_dev_addr, ETH_ALEN); - is_go = 1; - } - } - } - } /* dev != NULL */ - - /* The P2P/WPS IEs from the req buffer are copied to the resp. buffer. - */ - wmi_p2p_invite_req_rsp_cmd(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev), status, - is_go, grp_bssid, inv_req_ev->p2p_buf, - inv_req_ev->p2p_buflen, inv_req_ev->dialog_token); - - return; -} - -void p2p_prov_disc_req_rx(void *ctx, const A_UINT8 *datap, A_UINT8 len) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - WMI_P2P_PROV_DISC_REQ_EVENT *prov_disc_req_ev = - (WMI_P2P_PROV_DISC_REQ_EVENT *)datap; - struct host_p2p_dev *peer = NULL; - - /* Get hold of the peer device from the device list. The peer dev should - * be present in our dev list.(atleast added to the list from the bss_info - * ev that the firmware would have sent prior to this event). - */ - peer = p2p_get_device(p2p_dev_ctx, prov_disc_req_ev->sa); - - /* Set up the WPS method in use by the peer in the device context. - */ - if (peer) { - peer->dev.flags &= ~(P2P_DEV_PD_PEER_DISPLAY | P2P_DEV_PD_PEER_KEYPAD); - } - if (prov_disc_req_ev->wps_config_method & WPS_CONFIG_DISPLAY) { - if (peer) { - peer->dev.flags |= P2P_DEV_PD_PEER_KEYPAD; - } - } else if (prov_disc_req_ev->wps_config_method & WPS_CONFIG_KEYPAD) { - if (peer) { - peer->dev.flags |= P2P_DEV_PD_PEER_DISPLAY; - } - } - - /* Report PD request event to the Supplicant so that the user App can - * be prompted for any necessary inputs. - */ - -printk(KERN_ALERT "wps_cfg_method: %d, dev_cfg_method: %d, \ - dev_capab: %d, grp_capab: %d\n", prov_disc_req_ev->wps_config_method, - prov_disc_req_ev->dev_config_methods, prov_disc_req_ev->device_capab, - prov_disc_req_ev->group_capab); - - A_WMI_P2P_PROV_DISC_REQ_EVENT(p2p_dev_ctx->dev, prov_disc_req_ev->sa, - prov_disc_req_ev->wps_config_method, prov_disc_req_ev->dev_addr, - prov_disc_req_ev->pri_dev_type, prov_disc_req_ev->device_name, - prov_disc_req_ev->dev_name_len, - prov_disc_req_ev->dev_config_methods, prov_disc_req_ev->device_capab, - prov_disc_req_ev->group_capab); - - return; -} - -void p2p_prov_disc_resp_rx(void *ctx, const A_UINT8 *datap, A_UINT8 len) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - WMI_P2P_PROV_DISC_RESP_EVENT *prov_disc_resp_ev = - (WMI_P2P_PROV_DISC_RESP_EVENT *)datap; - struct host_p2p_dev *peer = NULL; - - /* Get hold of the peer device from the device list. The peer dev should - * be present in our dev list.(atleast added to the list from the bss_info - * ev that the firmware would have sent prior to this event). - */ - peer = p2p_get_device(p2p_dev_ctx, prov_disc_resp_ev->peer); - - /* Set up the WPS method in use by the peer in the device context. - */ - if (peer) { - peer->dev.flags &= ~(P2P_DEV_PD_PEER_DISPLAY | P2P_DEV_PD_PEER_KEYPAD); - } - if (prov_disc_resp_ev->config_methods & WPS_CONFIG_DISPLAY) { - if (peer) { - peer->dev.flags |= P2P_DEV_PD_PEER_KEYPAD; - } - } else if (prov_disc_resp_ev->config_methods & WPS_CONFIG_KEYPAD) { - if (peer) { - peer->dev.flags |= P2P_DEV_PD_PEER_DISPLAY; - } - } - - peer->dev.req_config_methods = 0; - - /* Report PD response event to the Supplicant so that the user App can - * be prompted for any necessary inputs. - */ - A_WMI_P2P_PROV_DISC_RESP_EVENT(p2p_dev_ctx->dev, prov_disc_resp_ev->peer, - prov_disc_resp_ev->config_methods); - - return; -} - -A_STATUS p2p_auth_invite(void *ctx, A_UINT8 *auth_peer) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - A_STATUS status = A_OK; - - /* Mark the peer as authorized by the user for Invitation. - */ - A_MEMCPY(p2p_dev_ctx->p2p_auth_invite, auth_peer, ETH_ALEN); - - return status; -} - -A_STATUS p2p_auth_go_neg(void *ctx, WMI_P2P_GO_NEG_START_CMD *auth_go_neg_param) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - struct p2p_ctx *p2p_cmn_ctx = (struct p2p_ctx *)p2p_dev_ctx->p2p_ctx; - struct host_p2p_dev *peer = NULL; - A_STATUS status = A_OK; - - /* Get hold of the peer device. - */ - peer = p2p_get_device(ctx, auth_go_neg_param->peer_addr); - if (peer == NULL) { - /* Unknown peer device. - */ - status = A_ERROR; - } else { - /* Mark the peer as authorized by the user & ready for GO Negotiation. - */ - peer->dev.flags &= ~P2P_DEV_NOT_YET_READY; - peer->dev.flags &= ~P2P_DEV_USER_REJECTED; - - p2p_cmn_ctx->go_intent = auth_go_neg_param->go_intent; - peer->persistent_grp = auth_go_neg_param->persistent_grp; - peer->dev.wps_method = auth_go_neg_param->wps_method; - } - - return status; -} - -A_STATUS p2p_peer_reject(void *ctx, A_UINT8 *peer_addr) -{ - struct host_p2p_dev *peer = NULL; - A_STATUS status = A_OK; - - /* Get hold of the peer device. - */ - peer = p2p_get_device(ctx, peer_addr); - if (peer == NULL) { - /* Unknown peer device. - */ - status = A_ERROR; - } else { - peer->dev.flags |= P2P_DEV_USER_REJECTED; - } - - return status; -} - -A_STATUS p2p_go_neg_start(void *ctx, WMI_P2P_GO_NEG_START_CMD *go_neg_param) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - struct host_p2p_dev *peer = NULL; - struct host_p2p_dev *peer_go = NULL; - A_STATUS status = A_OK; - - /* Get hold of the peer device. - */ - peer = p2p_get_device(ctx, go_neg_param->peer_addr); - if (peer == NULL) { - /* Unknown peer device. - */ - return A_ERROR; - } - - /* Monotonically increasing per device dialog tokens - generated from host - * & wraps back to 0. Send in WMI param from host. - */ - peer->dev.dialog_token++; - if (peer->dev.dialog_token == 0) { - peer->dev.dialog_token = 1; - } - - /* Mark the peer as authorized by the user & ready for GO Negotiation. - */ - peer->dev.flags &= ~P2P_DEV_NOT_YET_READY; - peer->dev.flags &= ~P2P_DEV_USER_REJECTED; - - peer->dev.wps_method = go_neg_param->wps_method; - - if (peer->dev.listen_freq) { - go_neg_param->listen_freq = peer->dev.listen_freq; - } else if (peer->dev.oper_freq) { - go_neg_param->listen_freq = peer->dev.oper_freq; - } - - go_neg_param->dialog_token = peer->dev.dialog_token; - go_neg_param->dev_capab = peer->dev.dev_capab; - - - /* If this peer is a member of a group, then get info about the GO of that group. This is - * useful to send device discoverability request to its GO, in case this peer does not - * respond to our GO Negotiation request. - */ - if (!is_zero_mac_addr(peer->dev.member_in_go_dev)) { - A_MEMCPY(go_neg_param->member_in_go_dev, peer->dev.member_in_go_dev, ETH_ALEN); - - peer_go = p2p_get_device(ctx, peer->dev.member_in_go_dev); - - if (peer_go) { - - peer_go->dev.dialog_token++; - if (peer_go->dev.dialog_token == 0) { - peer_go->dev.dialog_token = 1; - } - go_neg_param->go_dev_dialog_token = peer_go->dev.dialog_token; - - go_neg_param->go_oper_freq = peer_go->dev.oper_freq; - - if (peer_go->dev.oper_ssid_len) { - A_MEMCPY(go_neg_param->peer_go_ssid.ssid, peer_go->dev.oper_ssid, - peer_go->dev.oper_ssid_len); - go_neg_param->peer_go_ssid.ssidLength = peer_go->dev.oper_ssid_len; - } - } - } - - status = wmi_p2p_go_neg_start(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev), - go_neg_param); - - return status; -} - -A_STATUS p2p_invite_cmd(void *ctx, WMI_P2P_INVITE_CMD *invite_param) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - struct host_p2p_dev *peer = NULL; - A_STATUS status = A_OK; - - /* Get hold of the peer device. - */ - peer = p2p_get_device(ctx, invite_param->peer_addr); - if (peer == NULL) { - /* Unknown peer device. - */ - return A_ERROR; - } - - /* Monotonically increasing per device dialog tokens - generated from host - * & wraps back to 0. Send in WMI param from host. - */ - peer->dev.dialog_token++; - if (peer->dev.dialog_token == 0) { - peer->dev.dialog_token = 1; - } - - invite_param->dialog_token = peer->dev.dialog_token; - - status = wmi_p2p_invite_cmd(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev), - invite_param); - - return status; -} - -A_STATUS p2p_prov_disc_req(void *ctx, A_UINT8 *peer_addr, A_UINT16 wps_method) -{ - - struct host_p2p_dev *peer = NULL; - - /* Get hold of the peer device. - */ - peer = p2p_get_device(ctx, peer_addr); - if (peer == NULL) { - /* Unknown peer device. - */ - peer = p2p_get_device_intf_addrs(ctx, peer_addr); - } - - if (peer == NULL || (peer->dev.flags & P2P_DEV_PROBE_REQ_ONLY)) { - return A_ERROR; - } - - peer->dev.req_config_methods = wps_method; - - /* Return from here. PD will happen in the context of p2p_find(). - */ - return A_OK; -} - - -void p2p_send_prov_disc_req(struct host_p2p_dev *peer) -{ - struct p2p_dev_ctx *p2p_dev_ctx = peer->p2p; - WMI_P2P_PROV_DISC_REQ_CMD prov_disc_req; - - - /* Set up the PD Request cmd params. - */ - A_MEMZERO(&prov_disc_req, sizeof(WMI_P2P_PROV_DISC_REQ_CMD)); - - A_MEMCPY(prov_disc_req.peer, peer->dev.p2p_device_addr, ATH_MAC_LEN); - prov_disc_req.wps_method = peer->dev.req_config_methods; - - /* Monotonically increasing per device dialog tokens - generated from host - * & wraps back to 0. Send in WMI param from host. - */ - peer->dev.dialog_token++; - if (peer->dev.dialog_token == 0) { - peer->dev.dialog_token = 1; - } - prov_disc_req.dialog_token = peer->dev.dialog_token; - - if (peer->dev.listen_freq) { - prov_disc_req.listen_freq = peer->dev.listen_freq; - } else if (peer->dev.oper_freq) { - prov_disc_req.listen_freq = peer->dev.oper_freq; - } - - if (peer->dev.oper_ssid_len) { - A_MEMCPY(prov_disc_req.go_oper_ssid.ssid, peer->dev.oper_ssid, peer->dev.oper_ssid_len); - prov_disc_req.go_oper_ssid.ssidLength = peer->dev.oper_ssid_len; - - if (!is_zero_mac_addr(peer->dev.interface_addr)) { - A_MEMCPY(prov_disc_req.go_dev_addr, peer->dev.interface_addr, - ATH_MAC_LEN); - } else { - A_MEMCPY(prov_disc_req.go_dev_addr, prov_disc_req.peer, - ATH_MAC_LEN); - } - } - - wmi_p2p_prov_disc_cmd(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev), &prov_disc_req); - - return; -} - -void p2p_free_all_devices(void *ctx) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - - /* - * In order to free all of the devices from the dl_list, we CANNOT - * simply call p2p_device_free on all of the peers. This is because - * there might be references to these devices from the scan table, and - * just freeing the devices would potentially cause a segfault. - * Therefore, we use wmi_free_allnodes to eliminate all references from - * the scan table as well as to free the devices from the dl_list. - */ - wmi_free_allnodes(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev)); -} - -void p2p_device_free(void *peer_dev) -{ - struct host_p2p_dev *peer = (struct host_p2p_dev *)peer_dev; - - /* decrement the ref count & free up the node if the ref. cnt becomes - * zero. - */ - if (--peer->ref_cnt == 0) { - DL_ListRemove(&peer->list); - A_PRINTF("-: %x:%x\n", (peer->dev).p2p_device_addr[4], - (peer->dev).p2p_device_addr[5]); - A_FREE(peer); - } - - A_PRINTF("-%d\n", peer->ref_cnt); - return; -} - -A_STATUS p2p_peer(void *ctx, A_UINT8 *peer_addr, A_UINT8 next) -{ - struct host_p2p_dev *peer = NULL; - A_STATUS status; - - /* Get hold of the peer device. - */ - peer = p2p_get_device(ctx, peer_addr); - if (peer) { - A_PRINTF("peer Found\n"); - status = A_OK; - } else { - A_PRINTF("peer NOTFound\n"); - status = A_DEVICE_NOT_FOUND; - } - - return status; -} - - -A_STATUS p2p_get_device_p2p_buf(void *ctx, A_UINT8 *peer_addr, A_UINT8 **ni_buf, A_UINT8 *ni_buf_len) -{ - struct host_p2p_dev *peer = NULL; - A_STATUS status; - /* Get hold of the peer device */ - peer = p2p_get_device(ctx, peer_addr); - if (peer) { - *ni_buf = peer->p2p_buf; - *ni_buf_len = peer->p2p_buf_len; - status = A_OK; - } else { - status = A_DEVICE_NOT_FOUND; - } - - return status; - -} - -A_STATUS p2p_get_ifaddr (void *ctx, A_UINT8 *dev_addr) -{ - struct host_p2p_dev *peer = NULL; - A_STATUS status; - - /* Get hold of the peer device. - */ - peer = p2p_get_device(ctx, dev_addr); - if (peer) { - A_MEMCPY((dev_addr+6), peer->dev.interface_addr, ATH_MAC_LEN); - status = A_OK; - } else { - status = A_DEVICE_NOT_FOUND; - } - - return status; - -} - -A_STATUS p2p_get_devaddr (void *ctx, A_UINT8 *intf_addr) -{ - struct host_p2p_dev *peer = NULL; - A_STATUS status; - - /* Get hold of the peer device by interface address. - */ - peer = p2p_get_device_intf_addrs(ctx, intf_addr); - if (peer) { - A_MEMCPY((intf_addr+6), (peer->dev).p2p_device_addr, ATH_MAC_LEN); - status = A_OK; - } else { - status = A_DEVICE_NOT_FOUND; - } - - return status; - -} - -A_STATUS wmi_p2p_get_go_params(void *ctx, A_UINT8 *go_dev_addr, - A_UINT16 *oper_freq, A_UINT8 *ssid, A_UINT8 *ssid_len) -{ - struct host_p2p_dev *peer = NULL; - A_STATUS status; - - /* Get hold of the peer device. - */ - peer = p2p_get_device(ctx, go_dev_addr); - if (peer) { - A_PRINTF("peer Found\n"); - *oper_freq = peer->dev.oper_freq; - - if (peer->dev.oper_ssid) { - A_MEMCPY(ssid, peer->dev.oper_ssid, peer->dev.oper_ssid_len); - *ssid_len = peer->dev.oper_ssid_len; - } - status = A_OK; - } else { - A_PRINTF("peer NOTFound\n"); - status = A_DEVICE_NOT_FOUND; - } - - return status; -} - -void p2p_increment_dev_ref_count(struct host_p2p_dev *dev) -{ - /* Increment the ref count. The dev ages out in 2 mins time (configurable) - * Unlikely to have more than 255 references to the dev before it - * ages out. - */ - dev->ref_cnt++; - - A_PRINTF("+%d\n", dev->ref_cnt); - - return; -} - -static void p2p_free_sd_query(struct p2p_sd_query *q) -{ - if (q == NULL) { - return; - } - if (q->tlvs) { - A_FREE(q->tlvs); - } - A_FREE(q); -} - -static int p2p_unlink_sd_query(void *ctx, struct p2p_sd_query *query) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - struct p2p_sd_query *q, *prev; - - q = p2p_dev_ctx->sd_queries; - prev = NULL; - - while (q) { - if (q == query) { - if (prev) - prev->next = q->next; - else - p2p_dev_ctx->sd_queries = q->next; - if (p2p_dev_ctx->sd_queries == query) - p2p_dev_ctx->sd_queries = NULL; - return 1; - } - prev = q; - q = q->next; - } - return 0; -} - -void p2p_free_all_sd_queries(void *ctx) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - struct p2p_sd_query *q, *next; - - /* - * Walk through the list and free all of the p2p_sd_queries - */ - q = p2p_dev_ctx->sd_queries; - - while (q) { - next = q->next; - if (p2p_unlink_sd_query(p2p_dev_ctx, q)) { - p2p_free_sd_query(q); - } - q = next; - } - - /* - * Null out the sd_queries pointer in the p2p_dev_ctx. This - * item no longer exists! - */ - p2p_dev_ctx->sd_queries = NULL; - - /* - * Now null out the curr_sd_query pointer because if it exists, - * the sd_query has been freed already. - */ - p2p_dev_ctx->curr_sd_query = NULL; -} - -A_STATUS p2p_sd_request(void *ctx, A_UINT8 *peer_addr, A_UINT8 *tlv_buf, A_UINT8 tlv_buflen, A_UINT32 *qid) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - struct p2p_sd_query *q; - - q = A_MALLOC_NOWAIT(sizeof(struct p2p_sd_query)); - if (q == NULL) { - return A_ERROR; - } - - A_MEMZERO(q, sizeof(struct p2p_sd_query)); - - if (is_zero_mac_addr(peer_addr)) { - q->for_all_peers = 1; - } else { - A_MEMCPY(q->peer, peer_addr, ETH_ALEN); - } - - q->tlvs = A_MALLOC_NOWAIT(tlv_buflen); - if (q->tlvs == NULL) { - p2p_free_sd_query(q); - return A_ERROR; - } - A_MEMZERO(q->tlvs, tlv_buflen); - - A_MEMCPY(q->tlvs, tlv_buf, tlv_buflen); - q->tlv_len = tlv_buflen; - - q->next = p2p_dev_ctx->sd_queries; - p2p_dev_ctx->sd_queries = q; - - *qid = (A_UINT32)q; - - return A_OK; -} - -A_STATUS p2p_sdpd_tx_cmd(void *ctx, WMI_P2P_SDPD_TX_CMD *sdpd_tx_cmd, A_UINT32 *qid) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - A_STATUS status; - - *qid = 0; - if (sdpd_tx_cmd->type == WMI_P2P_SD_TYPE_GAS_INITIAL_REQ) { - status = p2p_sd_request(ctx, sdpd_tx_cmd->peer_addr, sdpd_tx_cmd->tlv, sdpd_tx_cmd->tlv_length, qid); - } else { - status = wmi_p2p_sdpd_tx_cmd(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev), sdpd_tx_cmd); - } - - return status; -} - -A_STATUS p2p_sd_cancel_request(void *ctx, A_UINT32 qid) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - - if (p2p_unlink_sd_query(p2p_dev_ctx, (void *)qid)) { - p2p_free_sd_query((void *)qid); - } - - return A_OK; -} - -void p2p_start_sdpd_event_rx(void *ctx) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - struct host_p2p_dev *dev; - PDL_LIST pListItem; - WMI_P2P_SDPD_TX_CMD p2p_sdpd_req; - struct p2p_sd_query *query; - - ITERATE_OVER_LIST(&p2p_dev_ctx->devices, pListItem) { - - dev = A_CONTAINING_STRUCT(pListItem, struct host_p2p_dev, list); - - /* DO Service Discovery */ - if (dev->dev.flags & P2P_DEV_SD_SCHEDULE) { - A_MEMZERO(&p2p_sdpd_req, sizeof(WMI_P2P_SDPD_TX_CMD)); - - query = p2p_pending_sd_req(p2p_dev_ctx, dev); - - p2p_dev_ctx->curr_sd_query = query; - - if (query == NULL) { - continue; - } else { - if (dev->dev.listen_freq) { - p2p_sdpd_req.freq = dev->dev.listen_freq; - } else if (dev->dev.oper_freq) { - p2p_sdpd_req.freq = dev->dev.oper_freq; - } - p2p_sdpd_req.type = WMI_P2P_SD_TYPE_GAS_INITIAL_REQ; - A_MEMCPY(p2p_sdpd_req.peer_addr, dev->dev.p2p_device_addr, ETH_ALEN); - A_MEMCPY(p2p_sdpd_req.tlv, query->tlvs, query->tlv_len); - p2p_sdpd_req.tlv_length = query->tlv_len; - p2p_sdpd_req.update_indic = p2p_dev_ctx->srv_update_indic; - - wmi_p2p_sdpd_tx_cmd(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev), &p2p_sdpd_req); - return; - } - } else if (dev->dev.req_config_methods && !(dev->dev.flags & P2P_DEV_PD_FOR_JOIN)) { - /*Do Provisional Discovery */ - p2p_send_prov_disc_req(dev); - return; - } - } - - /* Send the WMI_P2P_SDPD_STOP_CMD for the firmware to continue with Listen in FIND. - */ - wmi_p2p_stop_sdpd(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev)); - - return; -} - -void p2p_sdpd_rx_event_rx(void *ctx, const A_UINT8 *datap, A_UINT8 len) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - WMI_P2P_SDPD_RX_EVENT *ev; - - ev = (WMI_P2P_SDPD_RX_EVENT *)datap; - - /* Pass the event up to the Supplicant */ - switch (ev->type) { - case WMI_P2P_SD_TYPE_GAS_INITIAL_REQ: - case WMI_P2P_SD_TYPE_GAS_COMEBACK_REQ: - case WMI_P2P_SD_TYPE_GAS_INITIAL_RESP: - case WMI_P2P_SD_TYPE_GAS_COMEBACK_RESP: - A_WMI_P2P_SD_RX_EVENT(p2p_dev_ctx->dev, ev); - break; - case WMI_P2P_SD_TYPE_STATUS_IND: - A_PRINTF("SDPD Status Indication\n"); - break; - case WMI_P2P_PD_TYPE_RESP: - A_PRINTF("PD response got\n"); - break; - default: - A_PRINTF("SDPD resp event %x not supported \n", ev->type); - break; - } - - /* Check the SD transaction status if it is a SD response & drive the FSM appropriately. - */ - switch (ev->type) { - case WMI_P2P_SD_TYPE_GAS_INITIAL_RESP: - case WMI_P2P_SD_TYPE_GAS_COMEBACK_RESP: - - if (ev->transaction_status == WMI_P2P_SDPD_TRANSACTION_COMP) { - struct host_p2p_dev *sd_peer = NULL; - - sd_peer = p2p_get_device(p2p_dev_ctx, ev->peer_addr); - - if (sd_peer) { - sd_peer->dev.flags |= P2P_DEV_SD_INFO; - } - - /* Remove directed queries that have been handled. - */ - if (p2p_dev_ctx->curr_sd_query && !(p2p_dev_ctx->curr_sd_query->for_all_peers)) { - if (p2p_unlink_sd_query(p2p_dev_ctx, p2p_dev_ctx->curr_sd_query)) { - p2p_free_sd_query((void *)p2p_dev_ctx->curr_sd_query); - } - } - } - - case WMI_P2P_SD_TYPE_STATUS_IND: - - if (ev->transaction_status == WMI_P2P_SDPD_TRANSACTION_COMP) { - struct host_p2p_dev *sd_peer = NULL; - - /* Clean up SD pending state for this dev for which the SD transaction - * completed. - */ - sd_peer = p2p_get_device(p2p_dev_ctx, ev->peer_addr); - - /* Query for this device completed. - */ - if (sd_peer) { - sd_peer->dev.flags &= ~P2P_DEV_SD_SCHEDULE; - } - - /* Proceed with the next SD/PD. - */ - p2p_start_sdpd_event_rx(ctx); - } - break; - - case WMI_P2P_PD_TYPE_RESP: - - /* Proceed with the next SD/PD. - */ - p2p_start_sdpd_event_rx(ctx); - break; - - default: - break; - } - - return; -} - -static struct p2p_sd_query *p2p_pending_sd_req(struct p2p_dev_ctx *p2p_dev_ctx, - struct host_p2p_dev *dev) -{ - struct p2p_sd_query *q; - - if (!(dev->dev.dev_capab & P2P_DEV_CAPAB_SERVICE_DISCOVERY)) { - return NULL; /* peer does not support SD */ - } - - for (q = p2p_dev_ctx->sd_queries; q; q = q->next) { - if (q->for_all_peers && !(dev->dev.flags & P2P_DEV_SD_INFO)) { - return q; - } - if (!q->for_all_peers && - A_MEMCMP(q->peer, dev->dev.p2p_device_addr, ETH_ALEN) == 0) - return q; - } - - return NULL; -} - -void p2p_go_neg_complete_rx(void *ctx, const A_UINT8 *datap, A_UINT8 len) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - WMI_P2P_GO_NEG_RESULT_EVENT *ev = (WMI_P2P_GO_NEG_RESULT_EVENT *)datap; - struct host_p2p_dev *peer = NULL; - - /* Get hold of the peer device from the device list. - */ - peer = p2p_get_device(p2p_dev_ctx, ev->peer_device_addr); - - A_ASSERT(peer != NULL); - /*Store minimal persistent group info for Invitation processing*/ - if(ev->persistent_grp) { - peer->persistent_grp = ev->persistent_grp; - peer->role_go = ev->role_go; - peer->ssid_len = ev->ssid_len; - A_MEMCPY(peer->ssid, ev->ssid, ev->ssid_len); - } - return; -} -/** - * wpa_ssid_txt - Convert SSID to a printable string - * @ssid: SSID (32-octet string) - * @ssid_len: Length of ssid in octets - * Returns: Pointer to a printable string - * - * This function can be used to convert SSIDs into printable form. In most - * cases, SSIDs do not use unprintable characters, but IEEE 802.11 standard - * does not limit the used character set, so anything could be used in an SSID. - * - * This function uses a static buffer, so only one call can be used at the - * time, i.e., this is not re-entrant and the returned buffer must be used - * before calling this again. - */ -static const char * wpa_ssid_txt(const u8 *ssid, A_UINT8 ssid_len) -{ - static char ssid_txt[33]; - char *pos; - - if (ssid_len > 32) - ssid_len = 32; - memcpy(ssid_txt, ssid, ssid_len); - ssid_txt[ssid_len] = '\0'; - for (pos = ssid_txt; *pos != '\0'; pos++) { - if ((u8) *pos < 32 || (u8) *pos >= 127) - *pos = '_'; - } - return ssid_txt; -} - -static const char * p2p_go_state_text(enum p2p_go_state go_state) -{ - switch (go_state) { - case UNKNOWN_GO: - return "unknown"; - case LOCAL_GO: - return "local"; - case REMOTE_GO: - return "remote"; - } - - return "??"; -} - -static char * wps_dev_type_bin2str(const u8 dev_type[WPS_DEV_TYPE_LEN], char *buf, - A_UINT32 buf_len) -{ - int ret; - - ret = snprintf(buf, buf_len, "%u-%08X-%u", - WPA_GET_BE16(dev_type), WPA_GET_BE32(&dev_type[2]), - WPA_GET_BE16(&dev_type[6])); - if (ret < 0 || (unsigned int) ret >= buf_len) - return NULL; - - return buf; -} - - -static const char * p2p_wps_method_text(enum p2p_wps_method method) -{ - switch (method) { - case WPS_NOT_READY: - return "not-ready"; - case WPS_PIN_LABEL: - return "Label"; - case WPS_PIN_DISPLAY: - return "Display"; - case WPS_PIN_KEYPAD: - return "Keypad"; - case WPS_PBC: - return "PBC"; - } - - return "??"; -} - - -int p2p_get_peer_info(void *ctx, A_UINT8 *peer_addr, A_UINT8 *buf, A_UINT32 buflen) -{ - struct host_p2p_dev *peer = NULL; - struct p2p_device *dev; - int res; - A_UINT8 *pos, *end; - A_UINT8 devtype[WPS_DEV_TYPE_BUFSIZE]; - bss_t *bss; - A_UINT32 level = 0; - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - - /* Get hold of the peer device - */ - peer = p2p_get_device(ctx, peer_addr); - if (!peer) { - return 0; - } - - dev = &peer->dev; - - bss = wmi_find_node(A_WMI_GET_WMI_CTX(p2p_dev_ctx->dev), dev->p2p_device_addr); - if(bss) { - level = bss->ni_snr; - /* NB: max is 94 because noise is hardcoded to 161 */ - if (level > 94) - level = 94; - - level += 161; /*Add Noise -95dBm*/ - /*level greater than Noise max_level*/ - if(level >=64) - level -=0x100; - } - pos = buf; - end = buf + buflen; - - res = snprintf(pos, end - pos, MACSTR "\n", - MAC2STR(dev->p2p_device_addr)); - - if (res < 0 || res >= end - pos) { - return pos - buf; - return A_NO_MEMORY; - } - - pos += res; - - res = snprintf(pos, end - pos, - "listen_freq=%d\n" - "level=%d\n" - "wps_method=%s\n" - "interface_addr=" MACSTR "\n" - "member_in_go_dev=" MACSTR "\n" - "member_in_go_iface=" MACSTR "\n" - "pri_dev_type=%s\n" - "device_name=%s\n" - "config_methods=0x%x\n" - "dev_capab=0x%x\n" - "group_capab=0x%x\n" - "go_neg_req_sent=%d\n" - "go_state=%s\n" - "dialog_token=%u\n" - "intended_addr=" MACSTR "\n" - "country=%c%c\n" - "oper_freq=%d\n" - "req_config_methods=0x%x\n" - "flags=%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n" - "status=%d\n" - "wait_count=%u\n" - "invitation_reqs=%u\n", - dev->listen_freq, - level, - p2p_wps_method_text(dev->wps_method), - MAC2STR(dev->interface_addr), - MAC2STR(dev->member_in_go_dev), - MAC2STR(dev->member_in_go_iface), - wps_dev_type_bin2str(dev->pri_dev_type, - devtype, sizeof(devtype)), - dev->device_name, - dev->config_methods, - dev->dev_capab, - dev->group_capab, - dev->go_neg_req_sent, - p2p_go_state_text(dev->go_state), - dev->dialog_token, - MAC2STR(dev->intended_addr), - dev->country[0] ? dev->country[0] : '_', - dev->country[1] ? dev->country[1] : '_', - dev->oper_freq, - dev->req_config_methods, - dev->flags & P2P_DEV_PROBE_REQ_ONLY ? - "[PROBE_REQ_ONLY]" : "", - dev->flags & P2P_DEV_REPORTED ? "[REPORTED]" : "", - dev->flags & P2P_DEV_NOT_YET_READY ? - "[NOT_YET_READY]" : "", - dev->flags & P2P_DEV_SD_INFO ? "[SD_INFO]" : "", - dev->flags & P2P_DEV_SD_SCHEDULE ? "[SD_SCHEDULE]" : - "", - dev->flags & P2P_DEV_PD_PEER_DISPLAY ? - "[PD_PEER_DISPLAY]" : "", - dev->flags & P2P_DEV_PD_PEER_KEYPAD ? - "[PD_PEER_KEYPAD]" : "", - dev->flags & P2P_DEV_USER_REJECTED ? - "[USER_REJECTED]" : "", - dev->flags & P2P_DEV_PEER_WAITING_RESPONSE ? - "[PEER_WAITING_RESPONSE]" : "", - dev->flags & P2P_DEV_PREFER_PERSISTENT_GROUP ? - "[PREFER_PERSISTENT_GROUP]" : "", - dev->flags & P2P_DEV_WAIT_GO_NEG_RESPONSE ? - "[WAIT_GO_NEG_RESPONSE]" : "", - dev->flags & P2P_DEV_WAIT_GO_NEG_CONFIRM ? - "[WAIT_GO_NEG_CONFIRM]" : "", - dev->flags & P2P_DEV_GROUP_CLIENT_ONLY ? - "[GROUP_CLIENT_ONLY]" : "", - dev->flags & P2P_DEV_FORCE_FREQ ? - "[FORCE_FREQ]" : "", - dev->status, - dev->wait_count, - dev->invitation_reqs); - if (res < 0 || res >= end - pos) { - return pos - buf; - } - - pos += res; - - if (dev->ext_listen_period) { - res = snprintf(pos, end - pos, - "ext_listen_period=%u\n" - "ext_listen_interval=%u\n", - dev->ext_listen_period, - dev->ext_listen_interval); - if (res < 0 || res >= end - pos) { - return pos - buf; - } - pos += res; - } - - if (dev->oper_ssid_len) { - res = snprintf(pos, end - pos, - "oper_ssid=%s\n", - wpa_ssid_txt(dev->oper_ssid, - dev->oper_ssid_len)); - if (res < 0 || res >= end - pos) { - return pos - buf; - } - } - return pos - buf; -} - -int p2p_get_next_addr(void *ctx, A_UINT8 *addr, A_UINT8 *buf, A_UINT32 buflen, int first_element) -{ - struct host_p2p_dev *peer = NULL; - struct p2p_device *dev; - int res; - A_UINT8 *pos, *end; - - peer = p2p_get_next_device(ctx, addr, first_element); - - if (!peer) { - return 0; - } - - dev = &peer->dev; - - pos = buf; - end = buf + buflen; - - res = snprintf(pos, end - pos, MACSTR "\n", - MAC2STR(dev->p2p_device_addr)); - - if (res < 0 || res >= end - pos) { - return pos - buf; - return A_NO_MEMORY; - } - - pos += res; - - return pos - buf; -} - -void p2p_clear_peers_reported_flag(void *ctx) -{ - struct p2p_dev_ctx *p2p_dev_ctx = (struct p2p_dev_ctx *)ctx; - struct host_p2p_dev *dev; - PDL_LIST pListItem; - - ITERATE_OVER_LIST(&p2p_dev_ctx->devices, pListItem) { - dev = A_CONTAINING_STRUCT(pListItem, struct host_p2p_dev, list); - dev->dev.flags &= (~P2P_DEV_REPORTED); - } -} - -void p2p_clear_peers_authorized_flag(void *ctx, const A_UINT8 *addr) -{ - struct host_p2p_dev *peer = NULL; - - /* Get hold of the peer device. - */ - peer = p2p_get_device(ctx, addr); - if (peer == NULL) { - /* Find using interface addr. - */ - peer = p2p_get_device_intf_addrs(ctx, addr); - } - - if (peer) { - peer->dev.wps_method = WPS_NOT_READY; - } - - return; -} - diff --git a/drivers/net/wireless/ar6003/host/regtable/AR6002def.c b/drivers/net/wireless/ar6003/host/regtable/AR6002def.c deleted file mode 100644 index 5bc66e246b2f..000000000000 --- a/drivers/net/wireless/ar6003/host/regtable/AR6002def.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2008 Atheros Communications, Inc. - * All rights reserved. - * - * - * -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// - * - */ - -#if defined(AR6002_HEADERS_DEF) || defined(ATHR_WIN_DEF) -#define AR6002 1 -#define AR6002_REV 2 - -#define UNDEFINED 0x0fffffff - -#include "common_drv.h" -#include "AR6002/hw2.0/hw/apb_map.h" -#include "AR6002/hw2.0/hw/gpio_reg.h" -#include "AR6002/hw2.0/hw/rtc_reg.h" -#include "AR6002/hw2.0/hw/si_reg.h" -#include "AR6002/hw2.0/hw/mbox_reg.h" -#include "AR6002/hw2.0/hw/mbox_host_reg.h" - -#define MY_TARGET_DEF AR6002_TARGETdef -#define MY_HOST_DEF AR6002_HOSTdef -#define MY_TARGET_BOARD_DATA_SZ AR6002_BOARD_DATA_SZ -#define MY_TARGET_BOARD_EXT_DATA_SZ AR6002_BOARD_EXT_DATA_SZ -#define RTC_WMAC_BASE_ADDRESS RTC_BASE_ADDRESS -#define RTC_SOC_BASE_ADDRESS RTC_BASE_ADDRESS -#define WLAN_SYSTEM_SLEEP_OFFSET SYSTEM_SLEEP_OFFSET -#define WLAN_SYSTEM_SLEEP_DISABLE_LSB SYSTEM_SLEEP_DISABLE_LSB -#define WLAN_SYSTEM_SLEEP_DISABLE_MASK SYSTEM_SLEEP_DISABLE_MASK -#define WLAN_RESET_CONTROL_OFFSET RESET_CONTROL_OFFSET -#define WLAN_RESET_CONTROL_COLD_RST_MASK RESET_CONTROL_COLD_RST_MASK -#define WLAN_RESET_CONTROL_WARM_RST_MASK RESET_CONTROL_WARM_RST_MASK - - -/* Should not be used for AR6002 */ -#define CLOCK_GPIO_OFFSET UNDEFINED -#define CLOCK_GPIO_BT_CLK_OUT_EN_LSB UNDEFINED -#define CLOCK_GPIO_BT_CLK_OUT_EN_MASK UNDEFINED - -#include "targetdef.h" -#include "hostdef.h" -#else -#include "common_drv.h" -#include "targetdef.h" -#include "hostdef.h" -struct targetdef_s *AR6002_TARGETdef=NULL; -struct hostdef_s *AR6002_HOSTdef=NULL; -#endif /* AR6002_HEADERS_DEF */ diff --git a/drivers/net/wireless/ar6003/host/regtable/AR6003def.c b/drivers/net/wireless/ar6003/host/regtable/AR6003def.c deleted file mode 100644 index 144b1bdcca7b..000000000000 --- a/drivers/net/wireless/ar6003/host/regtable/AR6003def.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2008 Atheros Communications, Inc. - * All rights reserved. - * - * - * -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// - * - */ - -#if defined(AR6003_HEADERS_DEF) || defined(ATHR_WIN_DEF) -#define AR6002 1 -#define AR6002_REV 4 - -#define WLAN_HEADERS 1 -#include "common_drv.h" -#include "AR6002/hw4.0/hw/apb_map.h" -#include "AR6002/hw4.0/hw/gpio_reg.h" -#include "AR6002/hw4.0/hw/rtc_reg.h" -#include "AR6002/hw4.0/hw/si_reg.h" -#include "AR6002/hw4.0/hw/mbox_reg.h" -#include "AR6002/hw4.0/hw/mbox_wlan_host_reg.h" - -#define MY_TARGET_DEF AR6003_TARGETdef -#define MY_HOST_DEF AR6003_HOSTdef -#define MY_TARGET_BOARD_DATA_SZ AR6003_BOARD_DATA_SZ -#define MY_TARGET_BOARD_EXT_DATA_SZ AR6003_BOARD_EXT_DATA_SZ -#define RTC_WMAC_BASE_ADDRESS RTC_BASE_ADDRESS -#define RTC_SOC_BASE_ADDRESS RTC_BASE_ADDRESS - -#include "targetdef.h" -#include "hostdef.h" -#else -#include "common_drv.h" -#include "targetdef.h" -#include "hostdef.h" -struct targetdef_s *AR6003_TARGETdef=NULL; -struct hostdef_s *AR6003_HOSTdef=NULL; -#endif /*AR6003_HEADERS_DEF */ diff --git a/drivers/net/wireless/ar6003/host/regtable/MCKINLEYdef.c b/drivers/net/wireless/ar6003/host/regtable/MCKINLEYdef.c deleted file mode 100644 index 6829bae5f0cc..000000000000 --- a/drivers/net/wireless/ar6003/host/regtable/MCKINLEYdef.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2010 Atheros Communications, Inc. - * All rights reserved. - * - * - * -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// - * - */ -#if defined(MCKINLEY_HEADERS_DEF) || defined(ATHR_WIN_DEF) -#define AR6002 1 -#define AR6002_REV 6 - -#define WLAN_HEADERS 1 -#include "common_drv.h" -#include "AR6002/hw6.0/hw/apb_map.h" -#include "AR6002/hw6.0/hw/gpio_reg.h" -#include "AR6002/hw6.0/hw/rtc_reg.h" -#include "AR6002/hw6.0/hw/si_reg.h" -#include "AR6002/hw6.0/hw/mbox_reg.h" -#include "AR6002/hw6.0/hw/mbox_wlan_host_reg.h" - -#define SYSTEM_SLEEP_OFFSET SOC_SYSTEM_SLEEP_OFFSET - -#define MY_TARGET_DEF MCKINLEY_TARGETdef -#define MY_HOST_DEF MCKINLEY_HOSTdef -#define MY_TARGET_BOARD_DATA_SZ MCKINLEY_BOARD_DATA_SZ -#define MY_TARGET_BOARD_EXT_DATA_SZ MCKINLEY_BOARD_EXT_DATA_SZ -#include "targetdef.h" -#include "hostdef.h" -#else -#include "common_drv.h" -#include "targetdef.h" -#include "hostdef.h" -struct targetdef_s *MCKINLEY_TARGETdef=NULL; -struct hostdef_s *MCKINLEY_HOSTdef=NULL; -#endif /*MCKINLEY_HEADERS_DEF */ diff --git a/drivers/net/wireless/ar6003/host/regtable/hostdef.h b/drivers/net/wireless/ar6003/host/regtable/hostdef.h deleted file mode 100644 index e1544751e462..000000000000 --- a/drivers/net/wireless/ar6003/host/regtable/hostdef.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2008 Atheros Communications, Inc. - * All rights reserved. - * - * - * -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// - * - */ - -#ifndef HOSTDEFS_H_ -#define HOSTDEFS_H_ - -#include -#include -#include -#include -#include "host_reg_table.h" - -extern struct hostdef_s *AR6002_HOSTdef; -extern struct hostdef_s *AR6003_HOSTdef; -extern struct hostdef_s *MCKINLEY_HOSTdef; - -#endif diff --git a/drivers/net/wireless/ar6003/host/regtable/makefile b/drivers/net/wireless/ar6003/host/regtable/makefile deleted file mode 100644 index 1ba034c4900e..000000000000 --- a/drivers/net/wireless/ar6003/host/regtable/makefile +++ /dev/null @@ -1,26 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2005-2007 Atheros Corporation. All rights reserved. -# -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -#------------------------------------------------------------------------------ -#============================================================================== -# Author(s): ="Atheros" -#============================================================================== -!INCLUDE $(_MAKEENVROOT)\makefile.def - - - diff --git a/drivers/net/wireless/ar6003/host/regtable/regtable.c b/drivers/net/wireless/ar6003/host/regtable/regtable.c deleted file mode 100644 index 000a72df8168..000000000000 --- a/drivers/net/wireless/ar6003/host/regtable/regtable.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2010 Atheros Communications, Inc. - * All rights reserved. - * - * - * -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// - * - */ - - -#include "common_drv.h" -#include "bmi_msg.h" - -#include "targetdef.h" -#include "hostdef.h" -#include "hif.h" - - -/* Target-dependent addresses and definitions */ -struct targetdef_s *targetdef; -/* HIF-dependent addresses and definitions */ -struct hostdef_s *hostdef; - -void target_register_tbl_attach(A_UINT32 target_type) -{ - switch (target_type) { - case TARGET_TYPE_AR6002: - targetdef = AR6002_TARGETdef; - break; - case TARGET_TYPE_AR6003: - targetdef = AR6003_TARGETdef; - break; - case TARGET_TYPE_MCKINLEY: - targetdef = MCKINLEY_TARGETdef; - break; - default: - break; - } -} - -void hif_register_tbl_attach(A_UINT32 hif_type) -{ - switch (hif_type) { - case HIF_TYPE_AR6002: - hostdef = AR6002_HOSTdef; - break; - case HIF_TYPE_AR6003: - hostdef = AR6003_HOSTdef; - break; - case HIF_TYPE_MCKINLEY: - hostdef = MCKINLEY_HOSTdef; - break; - default: - break; - } -} - -EXPORT_SYMBOL(targetdef); -EXPORT_SYMBOL(hostdef); diff --git a/drivers/net/wireless/ar6003/host/regtable/targetdef.h b/drivers/net/wireless/ar6003/host/regtable/targetdef.h deleted file mode 100644 index bc8b8f7db7ea..000000000000 --- a/drivers/net/wireless/ar6003/host/regtable/targetdef.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2008 Atheros Communications, Inc. - * All rights reserved. - * - * - * -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// - * - */ - -#ifndef TARGETDEFS_H_ -#define TARGETDEFS_H_ - -#include -#include -#include -#include -#include "target_reg_table.h" - -extern struct targetdef_s *AR6002_TARGETdef; -extern struct targetdef_s *AR6003_TARGETdef; -extern struct targetdef_s *MCKINLEY_TARGETdef; - -#endif diff --git a/drivers/net/wireless/ar6003/host/reorder/aggr_rx_internal.h b/drivers/net/wireless/ar6003/host/reorder/aggr_rx_internal.h deleted file mode 100644 index 00531c808430..000000000000 --- a/drivers/net/wireless/ar6003/host/reorder/aggr_rx_internal.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * - * Copyright (c) 2004-2010 Atheros Communications Inc. - * All rights reserved. - * - * -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// - * - */ - -#ifndef __AGGR_RX_INTERNAL_H__ -#define __AGGR_RX_INTERNAL_H__ - -#include "a_osapi.h" -#include "aggr_recv_api.h" - -//#define AGGR_DEBUG - -#define AGGR_WIN_IDX(x, y) ((x) % (y)) -#define AGGR_INCR_IDX(x, y) AGGR_WIN_IDX(((x)+1), (y)) -#define AGGR_DCRM_IDX(x, y) AGGR_WIN_IDX(((x)-1), (y)) -#define IEEE80211_MAX_SEQ_NO 0xFFF -#define IEEE80211_NEXT_SEQ_NO(x) (((x) + 1) & IEEE80211_MAX_SEQ_NO) - - -#define NUM_OF_TIDS 8 -#define AGGR_SZ_DEFAULT 8 - -#define AGGR_WIN_SZ_MIN 2 -#define AGGR_WIN_SZ_MAX 8 -/* TID Window sz is double of what is negotiated. Derive TID_WINDOW_SZ from win_sz, per tid */ -#define TID_WINDOW_SZ(_x) ((_x) << 1) - -#define AGGR_NUM_OF_FREE_NETBUFS 16 - -#define AGGR_GET_RXTID_STATS(_p, _x) (&(_p->stat[(_x)])) -#define AGGR_GET_RXTID(_p, _x) (&(_p->RxTid[(_x)])) - -/* Hold q is a function of win_sz, which is negotiated per tid */ -#define HOLD_Q_SZ(_x) (TID_WINDOW_SZ((_x))*sizeof(OSBUF_HOLD_Q)) -/* AGGR_RX_TIMEOUT value is important as a (too) small value can cause frames to be - * delivered out of order and a (too) large value can cause undesirable latency in - * certain situations. */ -#define AGGR_RX_TIMEOUT 400 /* Timeout(in ms) for delivery of frames, if they are stuck */ - -typedef enum { - ALL_SEQNO = 0, - CONTIGUOUS_SEQNO = 1, -}DELIVERY_ORDER; - -typedef struct { - void *osbuf; - A_BOOL is_amsdu; - A_UINT16 seq_no; -}OSBUF_HOLD_Q; - - -#if 0 -typedef struct { - A_UINT16 seqno_st; - A_UINT16 seqno_end; -}WINDOW_SNAPSHOT; -#endif - -typedef struct { - A_BOOL aggr; /* is it ON or OFF */ - A_BOOL progress; /* TRUE when frames have arrived after a timer start */ - A_BOOL timerMon; /* TRUE if the timer started for the sake of this TID */ - A_UINT16 win_sz; /* negotiated window size */ - A_UINT16 seq_next; /* Next seq no, in current window */ - A_UINT32 hold_q_sz; /* Num of frames that can be held in hold q */ - OSBUF_HOLD_Q *hold_q; /* Hold q for re-order */ -#if 0 - WINDOW_SNAPSHOT old_win; /* Sliding window snapshot - for timeout */ -#endif - A_NETBUF_QUEUE_T q; /* q head for enqueuing frames for dispatch */ - A_MUTEX_T lock; -}RXTID; - -typedef struct { - A_UINT32 num_into_aggr; /* hitting at the input of this module */ - A_UINT32 num_dups; /* duplicate */ - A_UINT32 num_oow; /* out of window */ - A_UINT32 num_mpdu; /* single payload 802.3/802.11 frame */ - A_UINT32 num_amsdu; /* AMSDU */ - A_UINT32 num_delivered; /* frames delivered to IP stack */ - A_UINT32 num_timeouts; /* num of timeouts, during which frames delivered */ - A_UINT32 num_hole; /* frame not present, when window moved over */ - A_UINT32 num_bar; /* num of resets of seq_num, via BAR */ -}RXTID_STATS; - -typedef struct { - void *dev; /* dev handle */ - A_UINT8 aggr_sz; /* config value of aggregation size */ - A_UINT8 timerScheduled; - A_TIMER timer; /* timer for returning held up pkts in re-order que */ - RXTID RxTid[NUM_OF_TIDS]; /* Per tid window */ -#ifdef AGGR_DEBUG - RXTID_STATS stat[NUM_OF_TIDS]; /* Tid based statistics */ -#endif -}AGGR_CONN_INFO; - -typedef struct { - RX_CALLBACK rx_fn; /* callback function to return frames; to upper layer */ - ALLOC_NETBUFS netbuf_allocator; /* OS netbuf alloc fn */ - A_NETBUF_QUEUE_T freeQ; /* pre-allocated buffers - for A_MSDU slicing */ -#ifdef AGGR_DEBUG - PACKET_LOG pkt_log; /* Log info of the packets */ -#endif -}AGGR_INFO; - -#endif /* __AGGR_RX_INTERNAL_H__ */ diff --git a/drivers/net/wireless/ar6003/host/reorder/makefile b/drivers/net/wireless/ar6003/host/reorder/makefile deleted file mode 100644 index 1ba034c4900e..000000000000 --- a/drivers/net/wireless/ar6003/host/reorder/makefile +++ /dev/null @@ -1,26 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2005-2007 Atheros Corporation. All rights reserved. -# -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -#------------------------------------------------------------------------------ -#============================================================================== -# Author(s): ="Atheros" -#============================================================================== -!INCLUDE $(_MAKEENVROOT)\makefile.def - - - diff --git a/drivers/net/wireless/ar6003/host/reorder/rcv_aggr.c b/drivers/net/wireless/ar6003/host/reorder/rcv_aggr.c deleted file mode 100644 index 047b06ed85c8..000000000000 --- a/drivers/net/wireless/ar6003/host/reorder/rcv_aggr.c +++ /dev/null @@ -1,749 +0,0 @@ -/* - * - * Copyright (c) 2010 Atheros Communications Inc. - * All rights reserved. - * - * -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// - * - */ - -#ifdef ATH_AR6K_11N_SUPPORT - -#include -#include -#include -#include -#include -#include "ieee80211.h" -#include "pkt_log.h" -#include "aggr_recv_api.h" -#include "aggr_rx_internal.h" -#include "wmi.h" - -extern A_STATUS -wmi_dot3_2_dix(void *osbuf); - -static void -aggr_slice_amsdu(AGGR_CONN_INFO *p_aggr_conn, RXTID *rxtid, void **osbuf); - -static void -aggr_timeout(A_ATH_TIMER arg); - -static void -aggr_deque_frms(AGGR_CONN_INFO *p_aggr_conn, A_UINT8 tid, A_UINT16 seq_no, A_UINT8 order); - -static void -aggr_dispatch_frames(AGGR_CONN_INFO *p_aggr_conn, A_NETBUF_QUEUE_T *q); - -static void * -aggr_get_osbuf(void); - -static AGGR_INFO *p_aggr = NULL; - -#define QOS_PAD_LEN 2 - -A_UINT8 -aggr_init(ALLOC_NETBUFS netbuf_allocator, RX_CALLBACK fn) -{ - p_aggr = A_MALLOC(sizeof(AGGR_INFO)); - - if(p_aggr) { - /* Init data structures */ - A_MEMZERO(p_aggr, sizeof(AGGR_INFO)); - A_NETBUF_QUEUE_INIT(&p_aggr->freeQ); - p_aggr->rx_fn = fn; - p_aggr->netbuf_allocator = netbuf_allocator; - p_aggr->netbuf_allocator(&p_aggr->freeQ, AGGR_NUM_OF_FREE_NETBUFS); - return A_OK; - } - - A_PRINTF("Failed to allocate memory for aggr_node\n"); - return ((A_UINT8)A_ERROR); -} - -void * -aggr_init_conn(void) -{ - AGGR_CONN_INFO *p_aggr_conn = NULL; - RXTID *rxtid; - A_UINT8 i; - - do { - p_aggr_conn = A_MALLOC(sizeof(AGGR_CONN_INFO)); - if(!p_aggr_conn) { - A_PRINTF("Failed to allocate memory for aggr_node_conn \n"); - break; - } - - /* Init timer and data structures */ - A_MEMZERO(p_aggr_conn, sizeof(AGGR_CONN_INFO)); - p_aggr_conn->aggr_sz = AGGR_SZ_DEFAULT; - A_INIT_TIMER(&p_aggr_conn->timer, aggr_timeout, p_aggr_conn); - p_aggr_conn->timerScheduled = FALSE; - - for(i = 0; i < NUM_OF_TIDS; i++) { - rxtid = AGGR_GET_RXTID(p_aggr_conn, i); - rxtid->aggr = FALSE; - rxtid->progress = FALSE; - rxtid->timerMon = FALSE; - A_NETBUF_QUEUE_INIT(&rxtid->q); - A_MUTEX_INIT(&rxtid->lock); - } - }while(FALSE); - - return (p_aggr_conn); -} - -/* utility function to clear rx hold_q for a tid */ -static void -aggr_delete_tid_state(AGGR_CONN_INFO *p_aggr_conn, A_UINT8 tid) -{ - RXTID *rxtid; - - A_ASSERT(tid < NUM_OF_TIDS && p_aggr_conn); - if (!(tid < NUM_OF_TIDS && p_aggr)) { - return; /* in case panic_on_assert==0 */ - } - rxtid = AGGR_GET_RXTID(p_aggr_conn, tid); - if(rxtid->aggr) { - aggr_deque_frms(p_aggr_conn, tid, 0, ALL_SEQNO); - } - - rxtid->aggr = FALSE; - rxtid->progress = FALSE; - rxtid->timerMon = FALSE; - rxtid->win_sz = 0; - rxtid->seq_next = 0; - rxtid->hold_q_sz = 0; - - if(rxtid->hold_q) { - A_FREE(rxtid->hold_q); - rxtid->hold_q = NULL; - } - -#ifdef AGGR_DEBUG - { - RXTID_STATS *stats; - stats = AGGR_GET_RXTID_STATS(p_aggr_conn, tid); - A_MEMZERO(stats, sizeof(RXTID_STATS)); - } -#endif - -} - -void -aggr_module_destroy(void) -{ - if(p_aggr) { - /* free the freeQ and its contents*/ - while(A_NETBUF_QUEUE_SIZE(&p_aggr->freeQ)) { - A_NETBUF_FREE(A_NETBUF_DEQUEUE(&p_aggr->freeQ)); - } - A_FREE(p_aggr); - p_aggr = NULL; - } -} - -void -aggr_module_destroy_timers(void *cntxt) -{ - - AGGR_CONN_INFO *p_aggr_conn = (AGGR_CONN_INFO *)cntxt; - - if(p_aggr_conn) { - if(p_aggr_conn->timerScheduled) { - A_UNTIMEOUT(&p_aggr_conn->timer); - p_aggr_conn->timerScheduled = FALSE; - } - - A_DELETE_TIMER (&p_aggr_conn->timer); - } -} - -void -aggr_module_destroy_conn(void *cntxt) -{ - AGGR_CONN_INFO *p_aggr_conn = (AGGR_CONN_INFO *)cntxt; - RXTID *rxtid; - A_UINT8 i, k; - A_ASSERT(p_aggr_conn); - - if(p_aggr_conn) { - if(p_aggr_conn->timerScheduled) { - A_UNTIMEOUT(&p_aggr_conn->timer); - p_aggr_conn->timerScheduled = FALSE; - } - - A_DELETE_TIMER (&p_aggr_conn->timer); - - for(i = 0; i < NUM_OF_TIDS; i++) { - rxtid = AGGR_GET_RXTID(p_aggr_conn, i); - /* Free the hold q contents and hold_q*/ - if(rxtid->hold_q) { - for(k = 0; k< rxtid->hold_q_sz; k++) { - if(rxtid->hold_q[k].osbuf) { - A_NETBUF_FREE(rxtid->hold_q[k].osbuf); - } - } - A_FREE(rxtid->hold_q); - rxtid->hold_q = NULL; - } - /* Free the dispatch q contents*/ - while(A_NETBUF_QUEUE_SIZE(&rxtid->q)) { - A_NETBUF_FREE(A_NETBUF_DEQUEUE(&rxtid->q)); - } - if (A_IS_MUTEX_VALID(&rxtid->lock)) { - A_MUTEX_DELETE(&rxtid->lock); - } - } - A_FREE(p_aggr_conn); - p_aggr_conn = NULL; - } -} - -void -aggr_process_bar(void *cntxt, A_UINT8 tid, A_UINT16 seq_no) -{ - AGGR_CONN_INFO *p_aggr_conn = (AGGR_CONN_INFO *)cntxt; - - A_ASSERT(p_aggr_conn); - -#ifdef AGGR_DEBUG - { - RXTID_STATS *stats; - stats = AGGR_GET_RXTID_STATS(p_aggr_conn, tid); - stats->num_bar++; - } -#endif - - aggr_deque_frms(p_aggr_conn, tid, seq_no, ALL_SEQNO); -} - - -void -aggr_recv_addba_req_evt(void *cntxt, A_UINT8 tid, A_UINT16 seq_no, A_UINT8 win_sz) -{ - AGGR_CONN_INFO *p_aggr_conn = (AGGR_CONN_INFO *)cntxt; - RXTID *rxtid; - - A_ASSERT(p_aggr_conn); - rxtid = AGGR_GET_RXTID(p_aggr_conn, tid); - - if(rxtid->aggr) { - /* Just go and deliver all the frames up from this - * queue, as if we got DELBA and re-initialize the queue - */ - aggr_delete_tid_state(p_aggr_conn, tid); - } - - rxtid->seq_next = seq_no; - /* create these queues, only upon receiving of ADDBA for a - * tid, reducing memory requirement - */ - rxtid->hold_q = A_MALLOC(HOLD_Q_SZ(win_sz)); - if((rxtid->hold_q == NULL)) { - A_PRINTF("Failed to allocate memory, tid = %d\n", tid); - A_ASSERT(0); - return; /* in case panic_on_assert==0 */ - } - A_MEMZERO(rxtid->hold_q, HOLD_Q_SZ(win_sz)); - - /* Update rxtid for the window sz */ - rxtid->win_sz = win_sz; - /* hold_q_sz inicates the depth of holding q - which is - * a factor of win_sz. Compute once, as it will be used often - */ - rxtid->hold_q_sz = TID_WINDOW_SZ(win_sz); - /* There should be no frames on q - even when second ADDBA comes in. - * If aggr was previously ON on this tid, we would have cleaned up - * the q - */ - if(A_NETBUF_QUEUE_SIZE(&rxtid->q) != 0) { - A_PRINTF("ERROR: Frames still on queue ?\n"); - A_ASSERT(0); - } - - rxtid->aggr = TRUE; -} - -void -aggr_recv_delba_req_evt(void *cntxt, A_UINT8 tid) -{ - AGGR_CONN_INFO *p_aggr_conn = (AGGR_CONN_INFO *)cntxt; - RXTID *rxtid; - - A_ASSERT(p_aggr_conn); - - rxtid = AGGR_GET_RXTID(p_aggr_conn, tid); - - if(rxtid->aggr) { - aggr_delete_tid_state(p_aggr_conn, tid); - } -} - -static void -aggr_deque_frms(AGGR_CONN_INFO *p_aggr_conn, A_UINT8 tid, A_UINT16 seq_no, A_UINT8 order) -{ - RXTID *rxtid; - OSBUF_HOLD_Q *node; - A_UINT16 idx, idx_end, seq_end; -#ifdef AGGR_DEBUG - RXTID_STATS *stats; -#endif - - A_ASSERT(p_aggr_conn); - rxtid = AGGR_GET_RXTID(p_aggr_conn, tid); -#ifdef AGGR_DEBUG - stats = AGGR_GET_RXTID_STATS(p_aggr_conn, tid); -#endif - - /* idx is absolute location for first frame */ - idx = AGGR_WIN_IDX(rxtid->seq_next, rxtid->hold_q_sz); - - /* idx_end is typically the last possible frame in the window, - * but changes to 'the' seq_no, when BAR comes. If seq_no - * is non-zero, we will go up to that and stop. - * Note: last seq no in current window will occupy the same - * index position as index that is just previous to start. - * An imp point : if win_sz is 7, for seq_no space of 4095, - * then, there would be holes when sequence wrap around occurs. - * Target should judiciously choose the win_sz, based on - * this condition. For 4095, (TID_WINDOW_SZ = 2 x win_sz - * 2, 4, 8, 16 win_sz works fine). - * We must deque from "idx" to "idx_end", including both. - */ - seq_end = (seq_no) ? seq_no : rxtid->seq_next; - idx_end = AGGR_WIN_IDX(seq_end, rxtid->hold_q_sz); - - /* Critical section begins */ - A_MUTEX_LOCK(&rxtid->lock); - do { - - node = &rxtid->hold_q[idx]; - - if((order == CONTIGUOUS_SEQNO) && (!node->osbuf)) - break; - - /* chain frames and deliver frames bcos: - * 1. either the frames are in order and window is contiguous, OR - * 2. we need to deque frames, irrespective of holes - */ - if(node->osbuf) { - if(node->is_amsdu) { - aggr_slice_amsdu(p_aggr_conn, rxtid, &node->osbuf); - } else { - A_NETBUF_ENQUEUE(&rxtid->q, node->osbuf); - } - node->osbuf = NULL; - } -#ifdef AGGR_DEBUG - else { - stats->num_hole++; - } -#endif - /* window is moving */ - rxtid->seq_next = IEEE80211_NEXT_SEQ_NO(rxtid->seq_next); - idx = AGGR_WIN_IDX(rxtid->seq_next, rxtid->hold_q_sz); - } while(idx != idx_end); - /* Critical section ends */ - A_MUTEX_UNLOCK(&rxtid->lock); - -#ifdef AGGR_DEBUG - stats->num_delivered += A_NETBUF_QUEUE_SIZE(&rxtid->q); -#endif - aggr_dispatch_frames(p_aggr_conn, &rxtid->q); -} - -static void * -aggr_get_osbuf(void) -{ - void *buf = NULL; - - /* Starving for buffers? get more from OS - * check for low netbuffers( < 1/4 AGGR_NUM_OF_FREE_NETBUFS) : - * re-allocate bufs if so - * allocate a free buf from freeQ - */ - if (A_NETBUF_QUEUE_SIZE(&p_aggr->freeQ) < (AGGR_NUM_OF_FREE_NETBUFS >> 2)) { - p_aggr->netbuf_allocator(&p_aggr->freeQ, AGGR_NUM_OF_FREE_NETBUFS); - } - - if (A_NETBUF_QUEUE_SIZE(&p_aggr->freeQ)) { - buf = A_NETBUF_DEQUEUE(&p_aggr->freeQ); - } - - return buf; -} - - -static void -aggr_slice_amsdu(AGGR_CONN_INFO *p_aggr_conn, RXTID *rxtid, void **osbuf) -{ - void *new_buf; - A_UINT16 frame_8023_len, payload_8023_len, mac_hdr_len, amsdu_len; - A_UINT8 *framep; - - - /* Frame format at this point: - * [DIX hdr | 802.3 | 802.3 | ... | 802.3] - * - * Strip the DIX header. - * Iterate through the osbuf and do: - * grab a free netbuf from freeQ - * find the start and end of a frame - * copy it to netbuf(Vista can do better here) - * convert all msdu's(802.3) frames to upper layer format - os routine - * -for now lets convert from 802.3 to dix - * enque this to dispatch q of tid - * repeat - * free the osbuf - to OS. It's been sliced. - */ - /* Frame format in native wifi path: - * [802.11 hdr | 802.3 | 802.3 |...|802.3] - * Save a pointer to the start of 802.11 Hdr and Strip the 802.11 hdr - * Iterate through the osbuf and do: - * grab a free netbuf from freeQ - * Find the start and end of the frame - * Copy the dot 11 header,followed by the payload data. 802.3 hdr in the - individual msdu must not be copied - * repeat - * free the osbuf containing the A-MSDU. - */ - - - mac_hdr_len = sizeof(ATH_MAC_HDR); - - framep = A_NETBUF_DATA(*osbuf) + mac_hdr_len; - amsdu_len = A_NETBUF_LEN(*osbuf) - mac_hdr_len; - - while(amsdu_len > mac_hdr_len) { - /* Begin of a 802.3 frame */ - payload_8023_len = A_BE2CPU16(((ATH_MAC_HDR *)framep)->typeOrLen); -#define MAX_MSDU_SUBFRAME_PAYLOAD_LEN 1508 -#define MIN_MSDU_SUBFRAME_PAYLOAD_LEN 46 - if(payload_8023_len < MIN_MSDU_SUBFRAME_PAYLOAD_LEN || payload_8023_len > MAX_MSDU_SUBFRAME_PAYLOAD_LEN) { - A_PRINTF("802.3 AMSDU frame bound check failed. len %d\n", payload_8023_len); - break; - } - frame_8023_len = payload_8023_len + mac_hdr_len; - new_buf = aggr_get_osbuf(); - if(new_buf == NULL) { - A_PRINTF("No buffer available \n"); - break; - } - - A_MEMCPY(A_NETBUF_DATA(new_buf), framep, frame_8023_len); - A_NETBUF_PUT(new_buf, frame_8023_len); - if (wmi_dot3_2_dix(new_buf) != A_OK) { - A_PRINTF("dot3_2_dix err..\n"); - A_NETBUF_FREE(new_buf); - break; - } - - - A_NETBUF_ENQUEUE(&rxtid->q, new_buf); - - /* Is this the last subframe within this aggregate ? */ - if ((amsdu_len - frame_8023_len) == 0) { - break; - } - - /* Add the length of A-MSDU subframe padding bytes - - * Round to nearest word. - */ - frame_8023_len = ((frame_8023_len + 3) & ~3); - - framep += frame_8023_len; - amsdu_len -= frame_8023_len; - } - - A_NETBUF_FREE(*osbuf); - *osbuf = NULL; -} - -void -aggr_process_recv_frm(void *cntxt, A_UINT8 tid, A_UINT16 seq_no, A_BOOL is_amsdu, void **osbuf) -{ - AGGR_CONN_INFO *p_aggr_conn = (AGGR_CONN_INFO *)cntxt; - RXTID *rxtid; -#ifdef AGGR_DEBUG - RXTID_STATS *stats; -#endif - A_UINT16 idx, st, cur, end; - OSBUF_HOLD_Q *node; - - A_ASSERT(p_aggr_conn); - A_ASSERT(tid < NUM_OF_TIDS); - - rxtid = AGGR_GET_RXTID(p_aggr_conn, tid); -#ifdef AGGR_DEBUG - stats = AGGR_GET_RXTID_STATS(p_aggr_conn, tid); - stats->num_into_aggr++; -#endif - - if(!rxtid->aggr) { - if(is_amsdu) { - aggr_slice_amsdu(p_aggr_conn, rxtid, osbuf); -#ifdef AGGR_DEBUG - stats->num_amsdu++; -#endif - aggr_dispatch_frames(p_aggr_conn, &rxtid->q); - } - return; - } - - /* Check the incoming sequence no, if it's in the window */ - st = rxtid->seq_next; - cur = seq_no; - end = (st + rxtid->hold_q_sz-1) & IEEE80211_MAX_SEQ_NO; - -#ifdef AGGR_DEBUG - { - A_UINT16 *log_idx; - PACKET_LOG *log; - - /* Log the pkt info for future analysis */ - log = &p_aggr->pkt_log; - log_idx = &log->last_idx; - log->info[*log_idx].cur = cur; - log->info[*log_idx].st = st; - log->info[*log_idx].end = end; - *log_idx = IEEE80211_NEXT_SEQ_NO(*log_idx); - } -#endif - - if(((st < end) && (cur < st || cur > end)) || - ((st > end) && (cur > end) && (cur < st))) { - /* the cur frame is outside the window. Since we know - * our target would not do this without reason it must - * be assumed that the window has moved for some valid reason. - * Therefore, we dequeue all frames and start fresh. - */ - A_UINT16 extended_end; - - extended_end = (end + rxtid->hold_q_sz-1) & IEEE80211_MAX_SEQ_NO; - - if(((end < extended_end) && (cur < end || cur > extended_end)) || - ((end > extended_end) && (cur > extended_end) && (cur < end))) { - // dequeue all frames in queue and shift window to new frame - aggr_deque_frms(p_aggr_conn, tid, 0, ALL_SEQNO); - //set window start so that new frame is last frame in window - if(cur >= rxtid->hold_q_sz-1) { - rxtid->seq_next = cur - (rxtid->hold_q_sz-1); - }else{ - rxtid->seq_next = IEEE80211_MAX_SEQ_NO - (rxtid->hold_q_sz-2 - cur); - } - } else { - // dequeue only those frames that are outside the new shifted window - if(cur >= rxtid->hold_q_sz-1) { - st = cur - (rxtid->hold_q_sz-1); - }else{ - st = IEEE80211_MAX_SEQ_NO - (rxtid->hold_q_sz-2 - cur); - } - - aggr_deque_frms(p_aggr_conn, tid, st, ALL_SEQNO); - } -#ifdef AGGR_DEBUG - stats->num_oow++; -#endif - } - - idx = AGGR_WIN_IDX(seq_no, rxtid->hold_q_sz); - - /*enque the frame, in hold_q */ - node = &rxtid->hold_q[idx]; - - A_MUTEX_LOCK(&rxtid->lock); - if(node->osbuf) { - /* Is the cur frame duplicate or something beyond our - * window(hold_q -> which is 2x, already)? - * 1. Duplicate is easy - drop incoming frame. - * 2. Not falling in current sliding window. - * 2a. is the frame_seq_no preceding current tid_seq_no? - * -> drop the frame. perhaps sender did not get our ACK. - * this is taken care of above. - * 2b. is the frame_seq_no beyond window(st, TID_WINDOW_SZ); - * -> Taken care of it above, by moving window forward. - * - */ - A_NETBUF_FREE(node->osbuf); -#ifdef AGGR_DEBUG - stats->num_dups++; -#endif - } - - node->osbuf = *osbuf; - node->is_amsdu = is_amsdu; - node->seq_no = seq_no; -#ifdef AGGR_DEBUG - if(node->is_amsdu) { - stats->num_amsdu++; - } else { - stats->num_mpdu++; - } -#endif - A_MUTEX_UNLOCK(&rxtid->lock); - - *osbuf = NULL; - aggr_deque_frms(p_aggr_conn, tid, 0, CONTIGUOUS_SEQNO); - - if(p_aggr_conn->timerScheduled) { - rxtid->progress = TRUE; - }else{ - for(idx=0 ; idxhold_q_sz ; idx++) { - if(rxtid->hold_q[idx].osbuf) { - /* there is a frame in the queue and no timer so - * start a timer to ensure that the frame doesn't remain - * stuck forever. */ - p_aggr_conn->timerScheduled = TRUE; - A_TIMEOUT_MS(&p_aggr_conn->timer, AGGR_RX_TIMEOUT, 0); - rxtid->progress = FALSE; - rxtid->timerMon = TRUE; - break; - } - } - } -} - -/* - * aggr_reset_state -- Called when it is deemed necessary to clear the aggregate - * hold Q state. Examples include when a Connect event or disconnect event is - * received. - */ -void -aggr_reset_state(void *cntxt, void *dev) -{ - A_UINT8 tid; - AGGR_CONN_INFO *p_aggr_conn = (AGGR_CONN_INFO *)cntxt; - - A_ASSERT(p_aggr_conn); - - p_aggr_conn->dev = dev; - for(tid=0 ; tidaggr == FALSE || - rxtid->timerMon == FALSE || - rxtid->progress == TRUE) { - continue; - } - // dequeue all frames in for this tid -#ifdef AGGR_DEBUG - stats->num_timeouts++; -#endif - A_PRINTF("TO: st %d end %d\n", rxtid->seq_next, ((rxtid->seq_next + rxtid->hold_q_sz-1) & IEEE80211_MAX_SEQ_NO)); - aggr_deque_frms(p_aggr_conn, i, 0, ALL_SEQNO); - } - - p_aggr_conn->timerScheduled = FALSE; - // determine whether a new timer should be started. - for(i = 0; i < NUM_OF_TIDS; i++) { - rxtid = AGGR_GET_RXTID(p_aggr_conn, i); - - if(rxtid->aggr == TRUE && rxtid->hold_q) { - for(j = 0 ; j < rxtid->hold_q_sz ; j++) - { - if(rxtid->hold_q[j].osbuf) - { - p_aggr_conn->timerScheduled = TRUE; - rxtid->timerMon = TRUE; - rxtid->progress = FALSE; - break; - } - } - - if(j >= rxtid->hold_q_sz) { - rxtid->timerMon = FALSE; - } - } - } - - if(p_aggr_conn->timerScheduled) { - /* Rearm the timer*/ - A_TIMEOUT_MS(&p_aggr_conn->timer, AGGR_RX_TIMEOUT, 0); - } - -} - -static void -aggr_dispatch_frames(AGGR_CONN_INFO *p_aggr_conn, A_NETBUF_QUEUE_T *q) -{ - void *osbuf; - - if(p_aggr_conn->dev == NULL) { - while(A_NETBUF_QUEUE_SIZE(q)) { - A_NETBUF_FREE(A_NETBUF_DEQUEUE(q)); - } - } - else { - while((osbuf = A_NETBUF_DEQUEUE(q))!= NULL) { - p_aggr->rx_fn(p_aggr_conn->dev, osbuf); - } - } -} - -void -aggr_dump_stats(void *cntxt, PACKET_LOG **log_buf) -{ -#ifdef AGGR_DEBUG - AGGR_CONN_INFO *p_aggr_conn = (AGGR_CONN_INFO *)cntxt; - RXTID *rxtid; - RXTID_STATS *stats; - A_UINT8 i; - - *log_buf = &p_aggr->pkt_log; - A_PRINTF("\n\n================================================\n"); - A_PRINTF("tid: num_into_aggr, dups, oow, mpdu, amsdu, delivered, timeouts, holes, bar, seq_next\n"); - for(i = 0; i < NUM_OF_TIDS; i++) { - stats = AGGR_GET_RXTID_STATS(p_aggr_conn, i); - rxtid = AGGR_GET_RXTID(p_aggr_conn, i); - A_PRINTF("%d: %d %d %d %d %d %d %d %d %d : %d\n", i, stats->num_into_aggr, stats->num_dups, - stats->num_oow, stats->num_mpdu, - stats->num_amsdu, stats->num_delivered, stats->num_timeouts, - stats->num_hole, stats->num_bar, - rxtid->seq_next); - } - A_PRINTF("================================================\n\n"); -#else - A_PRINTF("AGGR_DEBUG is not enabled\n"); -#endif -} - -#endif /* ATH_AR6K_11N_SUPPORT */ diff --git a/drivers/net/wireless/ar6003/host/wlan/include/ieee80211.h b/drivers/net/wireless/ar6003/host/wlan/include/ieee80211.h deleted file mode 100644 index c4fd13fe0a91..000000000000 --- a/drivers/net/wireless/ar6003/host/wlan/include/ieee80211.h +++ /dev/null @@ -1,401 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#ifndef _NET80211_IEEE80211_H_ -#define _NET80211_IEEE80211_H_ - -#include "athstartpack.h" - -/* - * 802.11 protocol definitions. - */ -#define IEEE80211_WEP_KEYLEN 5 /* 40bit */ -#define IEEE80211_WEP_IVLEN 3 /* 24bit */ -#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ -#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ -#define IEEE80211_WEP_NKID 4 /* number of key ids */ - -/* - * 802.11i defines an extended IV for use with non-WEP ciphers. - * When the EXTIV bit is set in the key id byte an additional - * 4 bytes immediately follow the IV for TKIP. For CCMP the - * EXTIV bit is likewise set but the 8 bytes represent the - * CCMP header rather than IV+extended-IV. - */ -#define IEEE80211_WEP_EXTIV 0x20 -#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */ -#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */ - -#define IEEE80211_CRC_LEN 4 - -#ifdef WAPI_ENABLE -#define IEEE80211_WAPI_EXTIVLEN 10 /* extended IV length */ -#endif /* WAPI ENABLE */ - - -#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ -/* is 802.11 address multicast/broadcast? */ -#define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01) -#define IEEE80211_IS_BROADCAST(_a) (*(_a) == 0xFF) -#define WEP_HEADER (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN) -#define WEP_TRAILER IEEE80211_WEP_CRCLEN -#define CCMP_HEADER (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + \ - IEEE80211_WEP_EXTIVLEN) -#define CCMP_TRAILER IEEE80211_WEP_MICLEN -#define TKIP_HEADER (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + \ - IEEE80211_WEP_EXTIVLEN) -#define TKIP_TRAILER IEEE80211_WEP_CRCLEN -#define TKIP_MICLEN IEEE80211_WEP_MICLEN - - -#define IEEE80211_ADDR_EQ(addr1, addr2) \ - (A_MEMCMP(addr1, addr2, IEEE80211_ADDR_LEN) == 0) - -#define IEEE80211_ADDR_COPY(dst,src) A_MEMCPY(dst,src,IEEE80211_ADDR_LEN) - -#define IEEE80211_KEYBUF_SIZE 16 -#define IEEE80211_MICBUF_SIZE (8+8) /* space for both tx and rx */ - -/* - * NB: these values are ordered carefully; there are lots of - * of implications in any reordering. In particular beware - * that 4 is not used to avoid conflicting with IEEE80211_F_PRIVACY. - */ -#define IEEE80211_CIPHER_WEP 0 -#define IEEE80211_CIPHER_TKIP 1 -#define IEEE80211_CIPHER_AES_OCB 2 -#define IEEE80211_CIPHER_AES_CCM 3 -#define IEEE80211_CIPHER_CKIP 5 -#define IEEE80211_CIPHER_CCKM_KRK 6 -#define IEEE80211_CIPHER_NONE 7 /* pseudo value */ - -#define IEEE80211_CIPHER_MAX (IEEE80211_CIPHER_NONE+1) - -#define IEEE80211_IS_VALID_WEP_CIPHER_LEN(len) \ - (((len) == 5) || ((len) == 13) || ((len) == 16)) - - - -/* - * generic definitions for IEEE 802.11 frames - */ -PREPACK struct ieee80211_frame { - A_UINT8 i_fc[2]; - A_UINT8 i_dur[2]; - A_UINT8 i_addr1[IEEE80211_ADDR_LEN]; - A_UINT8 i_addr2[IEEE80211_ADDR_LEN]; - A_UINT8 i_addr3[IEEE80211_ADDR_LEN]; - A_UINT8 i_seq[2]; - /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */ - /* see below */ -} POSTPACK; - -PREPACK struct ieee80211_qosframe { - A_UINT8 i_fc[2]; - A_UINT8 i_dur[2]; - A_UINT8 i_addr1[IEEE80211_ADDR_LEN]; - A_UINT8 i_addr2[IEEE80211_ADDR_LEN]; - A_UINT8 i_addr3[IEEE80211_ADDR_LEN]; - A_UINT8 i_seq[2]; - A_UINT8 i_qos[2]; -} POSTPACK; - -#define IEEE80211_FC0_VERSION_MASK 0x03 -#define IEEE80211_FC0_VERSION_SHIFT 0 -#define IEEE80211_FC0_VERSION_0 0x00 -#define IEEE80211_FC0_TYPE_MASK 0x0c -#define IEEE80211_FC0_TYPE_SHIFT 2 -#define IEEE80211_FC0_TYPE_MGT 0x00 -#define IEEE80211_FC0_TYPE_CTL 0x04 -#define IEEE80211_FC0_TYPE_DATA 0x08 - -#define IEEE80211_FC0_SUBTYPE_MASK 0xf0 -#define IEEE80211_FC0_SUBTYPE_SHIFT 4 -/* for TYPE_MGT */ -#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00 -#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10 -#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20 -#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30 -#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40 -#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50 -#define IEEE80211_FC0_SUBTYPE_BEACON 0x80 -#define IEEE80211_FC0_SUBTYPE_ATIM 0x90 -#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0 -#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0 -#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0 -/* for TYPE_CTL */ -#define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0 -#define IEEE80211_FC0_SUBTYPE_RTS 0xb0 -#define IEEE80211_FC0_SUBTYPE_CTS 0xc0 -#define IEEE80211_FC0_SUBTYPE_ACK 0xd0 -#define IEEE80211_FC0_SUBTYPE_CF_END 0xe0 -#define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0 -/* for TYPE_DATA (bit combination) */ -#define IEEE80211_FC0_SUBTYPE_DATA 0x00 -#define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10 -#define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20 -#define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30 -#define IEEE80211_FC0_SUBTYPE_NODATA 0x40 -#define IEEE80211_FC0_SUBTYPE_CFACK 0x50 -#define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60 -#define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70 -#define IEEE80211_FC0_SUBTYPE_QOS 0x80 -#define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0 - -#define IEEE80211_FC1_DIR_MASK 0x03 -#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ -#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ -#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ -#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ - -#define IEEE80211_FC1_MORE_FRAG 0x04 -#define IEEE80211_FC1_RETRY 0x08 -#define IEEE80211_FC1_PWR_MGT 0x10 -#define IEEE80211_FC1_MORE_DATA 0x20 -#define IEEE80211_FC1_WEP 0x40 -#define IEEE80211_FC1_ORDER 0x80 - -#define IEEE80211_SEQ_FRAG_MASK 0x000f -#define IEEE80211_SEQ_FRAG_SHIFT 0 -#define IEEE80211_SEQ_SEQ_MASK 0xfff0 -#define IEEE80211_SEQ_SEQ_SHIFT 4 - -#define IEEE80211_NWID_LEN 32 - -/* - * 802.11 rate set. - */ -#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */ -#define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */ - -#define WMM_NUM_AC 4 /* 4 AC categories */ - -#define WMM_PARAM_ACI_M 0x60 /* Mask for ACI field */ -#define WMM_PARAM_ACI_S 5 /* Shift for ACI field */ -#define WMM_PARAM_ACM_M 0x10 /* Mask for ACM bit */ -#define WMM_PARAM_ACM_S 4 /* Shift for ACM bit */ -#define WMM_PARAM_AIFSN_M 0x0f /* Mask for aifsn field */ -#define WMM_PARAM_LOGCWMIN_M 0x0f /* Mask for CwMin field (in log) */ -#define WMM_PARAM_LOGCWMAX_M 0xf0 /* Mask for CwMax field (in log) */ -#define WMM_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */ - -#define WMM_AC_TO_TID(_ac) ( \ - ((_ac) == WMM_AC_VO) ? 6 : \ - ((_ac) == WMM_AC_VI) ? 5 : \ - ((_ac) == WMM_AC_BK) ? 1 : \ - 0) - -#define TID_TO_WMM_AC(_tid) ( \ - ((_tid) < 1) ? WMM_AC_BE : \ - ((_tid) < 3) ? WMM_AC_BK : \ - ((_tid) < 6) ? WMM_AC_VI : \ - WMM_AC_VO) -/* - * Management information element payloads. - */ - -enum { - IEEE80211_ELEMID_SSID = 0, - IEEE80211_ELEMID_RATES = 1, - IEEE80211_ELEMID_FHPARMS = 2, - IEEE80211_ELEMID_DSPARMS = 3, - IEEE80211_ELEMID_CFPARMS = 4, - IEEE80211_ELEMID_TIM = 5, - IEEE80211_ELEMID_IBSSPARMS = 6, - IEEE80211_ELEMID_COUNTRY = 7, - IEEE80211_ELEMID_CHALLENGE = 16, - /* 17-31 reserved for challenge text extension */ - IEEE80211_ELEMID_PWRCNSTR = 32, - IEEE80211_ELEMID_PWRCAP = 33, - IEEE80211_ELEMID_TPCREQ = 34, - IEEE80211_ELEMID_TPCREP = 35, - IEEE80211_ELEMID_SUPPCHAN = 36, - IEEE80211_ELEMID_CHANSWITCH = 37, - IEEE80211_ELEMID_MEASREQ = 38, - IEEE80211_ELEMID_MEASREP = 39, - IEEE80211_ELEMID_QUIET = 40, - IEEE80211_ELEMID_IBSSDFS = 41, - IEEE80211_ELEMID_ERP = 42, - IEEE80211_ELEMID_HTCAP_ANA = 45, /* Address ANA, and non-ANA story, for interop. CL#171733 */ - IEEE80211_ELEMID_RSN = 48, - IEEE80211_ELEMID_XRATES = 50, - IEEE80211_ELEMID_HTINFO_ANA = 61, -#ifdef WAPI_ENABLE - IEEE80211_ELEMID_WAPI = 68, -#endif - IEEE80211_ELEMID_TPC = 150, - IEEE80211_ELEMID_CCKM = 156, - IEEE80211_ELEMID_VENDOR = 221, /* vendor private */ -}; - -#define ATH_OUI 0x7f0300 /* Atheros OUI */ -#define ATH_OUI_TYPE 0x01 -#define ATH_OUI_SUBTYPE 0x01 -#define ATH_OUI_VERSION 0x00 - -#define WPA_OUI 0xf25000 -#define WPA_OUI_TYPE 0x01 -#define WPA_VERSION 1 /* current supported version */ - -#define WPA_CSE_NULL 0x00 -#define WPA_CSE_WEP40 0x01 -#define WPA_CSE_TKIP 0x02 -#define WPA_CSE_CCMP 0x04 -#define WPA_CSE_WEP104 0x05 - -#define WPA_ASE_NONE 0x00 -#define WPA_ASE_8021X_UNSPEC 0x01 -#define WPA_ASE_8021X_PSK 0x02 - -#define RSN_OUI 0xac0f00 -#define RSN_VERSION 1 /* current supported version */ - -#define RSN_CSE_NULL 0x00 -#define RSN_CSE_WEP40 0x01 -#define RSN_CSE_TKIP 0x02 -#define RSN_CSE_WRAP 0x03 -#define RSN_CSE_CCMP 0x04 -#define RSN_CSE_WEP104 0x05 - -#define RSN_ASE_NONE 0x00 -#define RSN_ASE_8021X_UNSPEC 0x01 -#define RSN_ASE_8021X_PSK 0x02 - -#define RSN_CAP_PREAUTH 0x01 - -#define WMM_OUI 0xf25000 -#define WMM_OUI_TYPE 0x02 -#define WMM_INFO_OUI_SUBTYPE 0x00 -#define WMM_PARAM_OUI_SUBTYPE 0x01 -#define WMM_VERSION 1 - -/* WMM stream classes */ -#define WMM_NUM_AC 4 -#define WMM_AC_BE 0 /* best effort */ -#define WMM_AC_BK 1 /* background */ -#define WMM_AC_VI 2 /* video */ -#define WMM_AC_VO 3 /* voice */ - -/* TSPEC related */ -#define ACTION_CATEGORY_CODE_TSPEC 17 -#define ACTION_CODE_TSPEC_ADDTS 0 -#define ACTION_CODE_TSPEC_ADDTS_RESP 1 -#define ACTION_CODE_TSPEC_DELTS 2 - -typedef enum { - TSPEC_STATUS_CODE_ADMISSION_ACCEPTED = 0, - TSPEC_STATUS_CODE_ADDTS_INVALID_PARAMS = 0x1, - TSPEC_STATUS_CODE_ADDTS_REQUEST_REFUSED = 0x3, - TSPEC_STATUS_CODE_UNSPECIFIED_QOS_RELATED_FAILURE = 0xC8, - TSPEC_STATUS_CODE_REQUESTED_REFUSED_POLICY_CONFIGURATION = 0xC9, - TSPEC_STATUS_CODE_INSUFFCIENT_BANDWIDTH = 0xCA, - TSPEC_STATUS_CODE_INVALID_PARAMS = 0xCB, - TSPEC_STATUS_CODE_DELTS_SENT = 0x30, - TSPEC_STATUS_CODE_DELTS_RECV = 0x31, -} TSPEC_STATUS_CODE; - -#define TSPEC_TSID_MASK 0xF -#define TSPEC_TSID_S 1 - -/* - * WMM/802.11e Tspec Element - */ -typedef PREPACK struct wmm_tspec_ie_t { - A_UINT8 elementId; - A_UINT8 len; - A_UINT8 oui[3]; - A_UINT8 ouiType; - A_UINT8 ouiSubType; - A_UINT8 version; - A_UINT16 tsInfo_info; - A_UINT8 tsInfo_reserved; - A_UINT16 nominalMSDU; - A_UINT16 maxMSDU; - A_UINT32 minServiceInt; - A_UINT32 maxServiceInt; - A_UINT32 inactivityInt; - A_UINT32 suspensionInt; - A_UINT32 serviceStartTime; - A_UINT32 minDataRate; - A_UINT32 meanDataRate; - A_UINT32 peakDataRate; - A_UINT32 maxBurstSize; - A_UINT32 delayBound; - A_UINT32 minPhyRate; - A_UINT16 sba; - A_UINT16 mediumTime; -} POSTPACK WMM_TSPEC_IE; - - -/* - * BEACON management packets - * - * octet timestamp[8] - * octet beacon interval[2] - * octet capability information[2] - * information element - * octet elemid - * octet length - * octet information[length] - */ - -#define IEEE80211_BEACON_INTERVAL(beacon) \ - ((beacon)[8] | ((beacon)[9] << 8)) -#define IEEE80211_BEACON_CAPABILITY(beacon) \ - ((beacon)[10] | ((beacon)[11] << 8)) - -#define IEEE80211_CAPINFO_ESS 0x0001 -#define IEEE80211_CAPINFO_IBSS 0x0002 -#define IEEE80211_CAPINFO_CF_POLLABLE 0x0004 -#define IEEE80211_CAPINFO_CF_POLLREQ 0x0008 -#define IEEE80211_CAPINFO_PRIVACY 0x0010 -#define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020 -#define IEEE80211_CAPINFO_PBCC 0x0040 -#define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080 -/* bits 8-9 are reserved */ -#define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400 -#define IEEE80211_CAPINFO_APSD 0x0800 -/* bit 12 is reserved */ -#define IEEE80211_CAPINFO_DSSSOFDM 0x2000 -/* bits 14-15 are reserved */ - -/* - * Authentication Modes - */ - -enum ieee80211_authmode { - IEEE80211_AUTH_NONE = 0, - IEEE80211_AUTH_OPEN = 1, - IEEE80211_AUTH_SHARED = 2, - IEEE80211_AUTH_8021X = 3, - IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */ - /* NB: these are used only for ioctls */ - IEEE80211_AUTH_WPA = 5, /* WPA/RSN w/ 802.1x */ - IEEE80211_AUTH_WPA_PSK = 6, /* WPA/RSN w/ PSK */ - IEEE80211_AUTH_WPA_CCKM = 7, /* WPA/RSN IE w/ CCKM */ -}; - -#define IEEE80211_PS_MAX_QUEUE 50 /*Maximum no of buffers that can be queues for PS*/ - -#include "athendpack.h" - -#endif /* _NET80211_IEEE80211_H_ */ diff --git a/drivers/net/wireless/ar6003/host/wlan/include/ieee80211_node.h b/drivers/net/wireless/ar6003/host/wlan/include/ieee80211_node.h deleted file mode 100644 index 70a8ada59f6b..000000000000 --- a/drivers/net/wireless/ar6003/host/wlan/include/ieee80211_node.h +++ /dev/null @@ -1,84 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#ifndef _IEEE80211_NODE_H_ -#define _IEEE80211_NODE_H_ - -/* - * Node locking definitions. - */ -#define IEEE80211_NODE_LOCK_INIT(_nt) A_MUTEX_INIT(&(_nt)->nt_nodelock) -#define IEEE80211_NODE_LOCK_DESTROY(_nt) if (A_IS_MUTEX_VALID(&(_nt)->nt_nodelock)) { \ - A_MUTEX_DELETE(&(_nt)->nt_nodelock); } - -#define IEEE80211_NODE_LOCK(_nt) A_MUTEX_LOCK(&(_nt)->nt_nodelock) -#define IEEE80211_NODE_UNLOCK(_nt) A_MUTEX_UNLOCK(&(_nt)->nt_nodelock) -#define IEEE80211_NODE_LOCK_BH(_nt) A_MUTEX_LOCK(&(_nt)->nt_nodelock) -#define IEEE80211_NODE_UNLOCK_BH(_nt) A_MUTEX_UNLOCK(&(_nt)->nt_nodelock) -#define IEEE80211_NODE_LOCK_ASSERT(_nt) - -/* - * Node reference counting definitions. - * - * ieee80211_node_initref initialize the reference count to 1 - * ieee80211_node_incref add a reference - * ieee80211_node_decref remove a reference - * ieee80211_node_dectestref remove a reference and return 1 if this - * is the last reference, otherwise 0 - * ieee80211_node_refcnt reference count for printing (only) - */ -#define ieee80211_node_initref(_ni) ((_ni)->ni_refcnt = 1) -#define ieee80211_node_incref(_ni) ((_ni)->ni_refcnt++) -#define ieee80211_node_decref(_ni) ((_ni)->ni_refcnt--) -#define ieee80211_node_dectestref(_ni) (((_ni)->ni_refcnt--) == 1) -#define ieee80211_node_refcnt(_ni) ((_ni)->ni_refcnt) - -#define IEEE80211_NODE_HASHSIZE 32 -/* simple hash is enough for variation of macaddr */ -#define IEEE80211_NODE_HASH(addr) \ - (((const A_UINT8 *)(addr))[IEEE80211_ADDR_LEN - 1] % \ - IEEE80211_NODE_HASHSIZE) - -/* - * Table of ieee80211_node instances. Each ieee80211com - * has at least one for holding the scan candidates. - * When operating as an access point or in ibss mode there - * is a second table for associated stations or neighbors. - */ -struct ieee80211_node_table { - void *nt_wmip; /* back reference */ - A_MUTEX_T nt_nodelock; /* on node table */ - struct bss *nt_node_first; /* information of all nodes */ - struct bss *nt_node_last; /* information of all nodes */ - struct bss *nt_hash[IEEE80211_NODE_HASHSIZE]; - const char *nt_name; /* for debugging */ - A_UINT32 nt_scangen; /* gen# for timeout scan */ - A_UINT32 nt_nodeAge; /* node aging time */ -#ifdef OS_ROAM_MANAGEMENT - A_UINT32 nt_si_gen; /* gen# for scan indication*/ -#endif -}; - -#define WLAN_NODE_INACT_TIMEOUT_MSEC 120000 -#define WLAN_NODE_INACT_CNT 15 // gModify.4 - -#endif /* _IEEE80211_NODE_H_ */ diff --git a/drivers/net/wireless/ar6003/host/wlan/src/makefile b/drivers/net/wireless/ar6003/host/wlan/src/makefile deleted file mode 100644 index 1ba034c4900e..000000000000 --- a/drivers/net/wireless/ar6003/host/wlan/src/makefile +++ /dev/null @@ -1,26 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2005-2007 Atheros Corporation. All rights reserved. -# -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -#------------------------------------------------------------------------------ -#============================================================================== -# Author(s): ="Atheros" -#============================================================================== -!INCLUDE $(_MAKEENVROOT)\makefile.def - - - diff --git a/drivers/net/wireless/ar6003/host/wlan/src/wlan_node.c b/drivers/net/wireless/ar6003/host/wlan/src/wlan_node.c deleted file mode 100644 index a616ad705731..000000000000 --- a/drivers/net/wireless/ar6003/host/wlan/src/wlan_node.c +++ /dev/null @@ -1,644 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// IEEE 802.11 node handling support. -// -// Author(s): ="Atheros" -//============================================================================== -#include -#include -#include -#include -#define ATH_MODULE_NAME wlan -#include -#include "htc.h" -#include "htc_api.h" -#include -#include -#include -#include -#include -#ifdef P2P -#include -#endif /* P2P */ - -#define ATH_DEBUG_WLAN ATH_DEBUG_MAKE_MODULE_MASK(0) - -#ifdef DEBUG - -static ATH_DEBUG_MASK_DESCRIPTION wlan_debug_desc[] = { - { ATH_DEBUG_WLAN , "General WLAN Node Tracing"}, -}; - -ATH_DEBUG_INSTANTIATE_MODULE_VAR(wlan, - "wlan", - "WLAN Node Management", - ATH_DEBUG_MASK_DEFAULTS, - ATH_DEBUG_DESCRIPTION_COUNT(wlan_debug_desc), - wlan_debug_desc); - -#endif - -static bss_t * _ieee80211_find_node (struct ieee80211_node_table *nt, - const A_UINT8 *macaddr); - -bss_t * -wlan_node_alloc(struct ieee80211_node_table *nt, int wh_size) -{ - bss_t *ni; - - ni = A_MALLOC_NOWAIT(sizeof(bss_t)); - - if (ni != NULL) { - A_MEMZERO(ni, sizeof(bss_t)); - if (wh_size) - { - ni->ni_buf = A_MALLOC_NOWAIT(wh_size); - if (ni->ni_buf == NULL) { - A_FREE(ni); - ni = NULL; - return ni; - } else { - A_MEMZERO(ni->ni_buf, wh_size); - } - } - } else { - return ni; - } - - /* Make sure our lists are clean */ - ni->ni_list_next = NULL; - ni->ni_list_prev = NULL; - ni->ni_hash_next = NULL; - ni->ni_hash_prev = NULL; - - // - // ni_scangen never initialized before and during suspend/resume of winmobile, - // that some junk has been stored in this, due to this scan list didn't properly updated - // - ni->ni_scangen = 0; - -#ifdef OS_ROAM_MANAGEMENT - ni->ni_si_gen = 0; -#endif - - return ni; -} - -void -wlan_node_free(bss_t *ni) -{ - if (ni->ni_buf != NULL) { - A_FREE(ni->ni_buf); - ni->ni_buf = NULL; - } -#ifdef P2P - if (ni->p2p_dev) { - p2p_device_free(ni->p2p_dev); - } -#endif /* P2P */ - A_FREE(ni); - ni = NULL; -} - -void -wlan_node_update_timestamp(struct ieee80211_node_table *nt, bss_t *ni) -{ - ni->ni_tstamp = A_GET_MS(0); - ni->ni_actcnt = WLAN_NODE_INACT_CNT; - return; -} - -void -wlan_setup_node(struct ieee80211_node_table *nt, bss_t *ni, - const A_UINT8 *macaddr) -{ - int hash; - A_UINT32 timeoutValue = 0; - - A_MEMCPY(ni->ni_macaddr, macaddr, IEEE80211_ADDR_LEN); - hash = IEEE80211_NODE_HASH (macaddr); - ieee80211_node_initref (ni); /* mark referenced */ - - timeoutValue = nt->nt_nodeAge; - - wlan_node_update_timestamp(nt, ni); - - IEEE80211_NODE_LOCK_BH(nt); - - /* Insert at the end of the node list */ - ni->ni_list_next = NULL; - ni->ni_list_prev = nt->nt_node_last; - if(nt->nt_node_last != NULL) - { - nt->nt_node_last->ni_list_next = ni; - } - nt->nt_node_last = ni; - if(nt->nt_node_first == NULL) - { - nt->nt_node_first = ni; - } - - /* Insert into the hash list i.e. the bucket */ - if((ni->ni_hash_next = nt->nt_hash[hash]) != NULL) - { - nt->nt_hash[hash]->ni_hash_prev = ni; - } - ni->ni_hash_prev = NULL; - nt->nt_hash[hash] = ni; - - IEEE80211_NODE_UNLOCK_BH(nt); -} - -static bss_t * -_ieee80211_find_node(struct ieee80211_node_table *nt, - const A_UINT8 *macaddr) -{ - bss_t *ni = NULL; - int hash = 0; - - IEEE80211_NODE_LOCK_ASSERT(nt); - - hash = IEEE80211_NODE_HASH(macaddr); - - if (hash >= IEEE80211_NODE_HASHSIZE) - { - // overflow???? - return NULL; - } - - if (hash < 0) - { - // underflow???? - return NULL; - } - - if (NULL == nt) - { - return NULL; - } - - if (NULL == nt->nt_hash) - { - return NULL; - } - - if (NULL == nt->nt_hash[hash]) - { - return NULL; - } - - for(ni = nt->nt_hash[hash]; ni; ni = ni->ni_hash_next) { - if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr)) { - ieee80211_node_incref(ni); /* mark referenced */ - return ni; - } - } - return NULL; -} - -bss_t * -wlan_find_node(struct ieee80211_node_table *nt, const A_UINT8 *macaddr) -{ - bss_t *ni = NULL; - - if (NULL == nt || NULL == macaddr) - { - return ni; // NULL - } - - IEEE80211_NODE_LOCK(nt); - ni = _ieee80211_find_node(nt, macaddr); - IEEE80211_NODE_UNLOCK(nt); - return ni; -} - - -/* Update the buffer alone, not the entire node. - * This involves, - * 1) Freeing the buffer alone. - * 2) Allocating a new buffer - * 3) Update the node timestamp with the current time. - */ -A_STATUS -wlan_node_buf_update(struct ieee80211_node_table *nt, bss_t *ni, A_UINT32 len) -{ - IEEE80211_NODE_LOCK(nt); - - /* Free the ni_buf alone. - */ - if (ni->ni_buf != NULL) { - A_FREE(ni->ni_buf); - ni->ni_buf = NULL; - } - - /* Allocate ni_buf for the new length. - */ - if (len) { - ni->ni_buf = A_MALLOC_NOWAIT(len); - if (ni->ni_buf == NULL) { - return A_ERROR; - } else { - A_MEMZERO(ni->ni_buf, len); - } - } - - /* Update the Node's timestamp. - */ - wlan_node_update_timestamp(nt, ni); - - IEEE80211_NODE_UNLOCK(nt); - - return A_OK; -} - -/* - * Reclaim a node. If this is the last reference count then - * do the normal free work. Otherwise remove it from the node - * table and mark it gone by clearing the back-reference. - */ -void -wlan_node_reclaim(struct ieee80211_node_table *nt, bss_t *ni) -{ - IEEE80211_NODE_LOCK(nt); - - if(ni->ni_list_prev == NULL) - { - /* First in list so fix the list head */ - nt->nt_node_first = ni->ni_list_next; - } - else - { - ni->ni_list_prev->ni_list_next = ni->ni_list_next; - } - - if(ni->ni_list_next == NULL) - { - /* Last in list so fix list tail */ - nt->nt_node_last = ni->ni_list_prev; - } - else - { - ni->ni_list_next->ni_list_prev = ni->ni_list_prev; - } - - if(ni->ni_hash_prev == NULL) - { - /* First in list so fix the list head */ - int hash; - hash = IEEE80211_NODE_HASH(ni->ni_macaddr); - nt->nt_hash[hash] = ni->ni_hash_next; - } - else - { - ni->ni_hash_prev->ni_hash_next = ni->ni_hash_next; - } - - if(ni->ni_hash_next != NULL) - { - ni->ni_hash_next->ni_hash_prev = ni->ni_hash_prev; - } - wlan_node_free(ni); - - IEEE80211_NODE_UNLOCK(nt); -} - -static void -wlan_node_dec_free(bss_t *ni) -{ - if (ieee80211_node_dectestref(ni)) { - wlan_node_free(ni); - } -} - -void -wlan_free_allnodes(struct ieee80211_node_table *nt) -{ - bss_t *ni; - - while ((ni = nt->nt_node_first) != NULL) { - wlan_node_reclaim(nt, ni); - } -} - -void -wlan_iterate_nodes(struct ieee80211_node_table *nt, wlan_node_iter_func *f, - void *arg) -{ - bss_t *ni; - A_UINT32 gen; - - gen = ++nt->nt_scangen; - - IEEE80211_NODE_LOCK(nt); - for (ni = nt->nt_node_first; ni; ni = ni->ni_list_next) { - if (ni->ni_scangen != gen) { - ni->ni_scangen = gen; - (void) ieee80211_node_incref(ni); - (*f)(arg, ni); - wlan_node_dec_free(ni); - } - } - IEEE80211_NODE_UNLOCK(nt); -} - -/* - * Node table support. - */ -void -wlan_node_table_init(void *wmip, struct ieee80211_node_table *nt) -{ - int i; - - AR_DEBUG_PRINTF(ATH_DEBUG_WLAN, ("node table = 0x%lx\n", (unsigned long)nt)); - IEEE80211_NODE_LOCK_INIT(nt); - - A_REGISTER_MODULE_DEBUG_INFO(wlan); - - nt->nt_node_first = nt->nt_node_last = NULL; - for(i = 0; i < IEEE80211_NODE_HASHSIZE; i++) - { - nt->nt_hash[i] = NULL; - } - - nt->nt_wmip = wmip; - nt->nt_nodeAge = WLAN_NODE_INACT_TIMEOUT_MSEC; - - // - // nt_scangen never initialized before and during suspend/resume of winmobile, - // that some junk has been stored in this, due to this scan list didn't properly updated - // - nt->nt_scangen = 0; - -#ifdef OS_ROAM_MANAGEMENT - nt->nt_si_gen = 0; -#endif -} - -void -wlan_set_nodeage(struct ieee80211_node_table *nt, A_UINT32 nodeAge) -{ - nt->nt_nodeAge = nodeAge; - return; -} -void -wlan_refresh_inactive_nodes (struct ieee80211_node_table *nt) -{ - bss_t *bss, *nextBss; - A_UINT8 myBssid[IEEE80211_ADDR_LEN]; - A_UINT32 timeoutValue = 0; - A_UINT32 now = A_GET_MS(0); - timeoutValue = nt->nt_nodeAge; - - wmi_get_current_bssid(nt->nt_wmip, myBssid); - - bss = nt->nt_node_first; - while (bss != NULL) - { - nextBss = bss->ni_list_next; - if (A_MEMCMP(myBssid, bss->ni_macaddr, sizeof(myBssid)) != 0) - { -#ifdef P2P - if (((now - bss->ni_tstamp) > timeoutValue)) -#else - if (((now - bss->ni_tstamp) > timeoutValue) || --bss->ni_actcnt == 0) -#endif /* P2P */ - { - /* - * free up all but the current bss - if set - */ - wlan_node_reclaim(nt, bss); - } - } - bss = nextBss; - } -} - -void -wlan_node_table_cleanup(struct ieee80211_node_table *nt) -{ - wlan_free_allnodes(nt); - IEEE80211_NODE_LOCK_DESTROY(nt); -} - -bss_t * -wlan_find_Ssidnode (struct ieee80211_node_table *nt, A_UCHAR *pSsid, - A_UINT32 ssidLength, A_BOOL bIsWPA2, A_BOOL bMatchSSID) -{ - bss_t *ni = NULL; - A_UCHAR *pIESsid = NULL; - - IEEE80211_NODE_LOCK (nt); - - for (ni = nt->nt_node_first; ni; ni = ni->ni_list_next) { - pIESsid = ni->ni_cie.ie_ssid; - if ((pIESsid) && pIESsid[1] <= 32) { - - // Step 1 : Check SSID - if (0x00 == memcmp (pSsid, &pIESsid[2], ssidLength)) { - - // - // Step 2.1 : Check MatchSSID is TRUE, if so, return Matched SSID - // Profile, otherwise check whether WPA2 or WPA - // - if (TRUE == bMatchSSID) { - ieee80211_node_incref (ni); /* mark referenced */ - IEEE80211_NODE_UNLOCK (nt); - return ni; - } - - // Step 2 : if SSID matches, check WPA or WPA2 - if (TRUE == bIsWPA2 && NULL != ni->ni_cie.ie_rsn) { - ieee80211_node_incref (ni); /* mark referenced */ - IEEE80211_NODE_UNLOCK (nt); - return ni; - } - if (FALSE == bIsWPA2 && NULL != ni->ni_cie.ie_wpa) { - ieee80211_node_incref(ni); /* mark referenced */ - IEEE80211_NODE_UNLOCK (nt); - return ni; - } - } - } - } - - IEEE80211_NODE_UNLOCK (nt); - - return NULL; -} - -void -wlan_node_return (struct ieee80211_node_table *nt, bss_t *ni) -{ - IEEE80211_NODE_LOCK (nt); - wlan_node_dec_free (ni); - IEEE80211_NODE_UNLOCK (nt); -} - -void -wlan_node_remove_core (struct ieee80211_node_table *nt, bss_t *ni) -{ - if(ni->ni_list_prev == NULL) - { - /* First in list so fix the list head */ - nt->nt_node_first = ni->ni_list_next; - } - else - { - ni->ni_list_prev->ni_list_next = ni->ni_list_next; - } - - if(ni->ni_list_next == NULL) - { - /* Last in list so fix list tail */ - nt->nt_node_last = ni->ni_list_prev; - } - else - { - ni->ni_list_next->ni_list_prev = ni->ni_list_prev; - } - - if(ni->ni_hash_prev == NULL) - { - /* First in list so fix the list head */ - int hash; - hash = IEEE80211_NODE_HASH(ni->ni_macaddr); - nt->nt_hash[hash] = ni->ni_hash_next; - } - else - { - ni->ni_hash_prev->ni_hash_next = ni->ni_hash_next; - } - - if(ni->ni_hash_next != NULL) - { - ni->ni_hash_next->ni_hash_prev = ni->ni_hash_prev; - } -} - -bss_t * -wlan_node_remove(struct ieee80211_node_table *nt, A_UINT8 *bssid) -{ - bss_t *bss, *nextBss; - - IEEE80211_NODE_LOCK(nt); - - bss = nt->nt_node_first; - - while (bss != NULL) - { - nextBss = bss->ni_list_next; - - if (A_MEMCMP(bssid, bss->ni_macaddr, 6) == 0) - { - wlan_node_remove_core (nt, bss); - IEEE80211_NODE_UNLOCK(nt); - return bss; - } - - bss = nextBss; - } - - IEEE80211_NODE_UNLOCK(nt); - return NULL; -} - -bss_t * -wlan_find_matching_Ssidnode (struct ieee80211_node_table *nt, A_UCHAR *pSsid, - A_UINT32 ssidLength, A_UINT32 dot11AuthMode, A_UINT32 authMode, - A_UINT32 pairwiseCryptoType, A_UINT32 grpwiseCryptoTyp) -{ - bss_t *ni = NULL; - bss_t *best_ni = NULL; - A_UCHAR *pIESsid = NULL; - - IEEE80211_NODE_LOCK (nt); - - for (ni = nt->nt_node_first; ni; ni = ni->ni_list_next) { - pIESsid = ni->ni_cie.ie_ssid; - if (pIESsid[1] <= 32) { - - // Step 1 : Check SSID - if (0x00 == memcmp (pSsid, &pIESsid[2], ssidLength)) { - - if (ni->ni_cie.ie_capInfo & 0x10) - { - - if ((NULL != ni->ni_cie.ie_rsn) && (WMI_WPA2_PSK_AUTH == authMode)) - { - /* WPA2 */ - if (NULL == best_ni) - { - best_ni = ni; - } - else if (ni->ni_rssi > best_ni->ni_rssi) - { - best_ni = ni; - } - } - else if ((NULL != ni->ni_cie.ie_wpa) && (WMI_WPA_PSK_AUTH == authMode)) - { - /* WPA */ - if (NULL == best_ni) - { - best_ni = ni; - } - else if (ni->ni_rssi > best_ni->ni_rssi) - { - best_ni = ni; - } - } - else if (WEP_CRYPT == pairwiseCryptoType) - { - /* WEP */ - if (NULL == best_ni) - { - best_ni = ni; - } - else if (ni->ni_rssi > best_ni->ni_rssi) - { - best_ni = ni; - } - } - } - else - { - /* open AP */ - if ((OPEN_AUTH == authMode) && (NONE_CRYPT == pairwiseCryptoType)) - { - if (NULL == best_ni) - { - best_ni = ni; - } - else if (ni->ni_rssi > best_ni->ni_rssi) - { - best_ni = ni; - } - } - } - } - } - } - - IEEE80211_NODE_UNLOCK (nt); - - return best_ni; -} - diff --git a/drivers/net/wireless/ar6003/host/wlan/src/wlan_recv_beacon.c b/drivers/net/wireless/ar6003/host/wlan/src/wlan_recv_beacon.c deleted file mode 100644 index c0cbe39c3655..000000000000 --- a/drivers/net/wireless/ar6003/host/wlan/src/wlan_recv_beacon.c +++ /dev/null @@ -1,206 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// IEEE 802.11 input handling. -// -// Author(s): ="Atheros" -//============================================================================== - -#include "a_config.h" -#include "athdefs.h" -#include "a_types.h" -#include "a_osapi.h" -#include -#include -#include - -#define IEEE80211_VERIFY_LENGTH(_len, _minlen) do { \ - if ((_len) < (_minlen)) { \ - return A_EINVAL; \ - } \ -} while (0) - -#define IEEE80211_VERIFY_ELEMENT(__elem, __maxlen) do { \ - if ((__elem) == NULL) { \ - return A_EINVAL; \ - } \ - if ((__elem)[1] > (__maxlen)) { \ - return A_EINVAL; \ - } \ -} while (0) - - -/* unaligned little endian access */ -#define LE_READ_2(p) \ - ((A_UINT16) \ - ((((A_UINT8 *)(p))[0] ) | (((A_UINT8 *)(p))[1] << 8))) - -#define LE_READ_4(p) \ - ((A_UINT32) \ - ((((A_UINT8 *)(p))[0] ) | (((A_UINT8 *)(p))[1] << 8) | \ - (((A_UINT8 *)(p))[2] << 16) | (((A_UINT8 *)(p))[3] << 24))) - - -static int __inline -iswpaoui(const A_UINT8 *frm) -{ - return frm[1] > 3 && LE_READ_4(frm+2) == ((WPA_OUI_TYPE<<24)|WPA_OUI); -} - -static int __inline -iswmmoui(const A_UINT8 *frm) -{ - return frm[1] > 3 && LE_READ_4(frm+2) == ((WMM_OUI_TYPE<<24)|WMM_OUI); -} - -/* unused functions for now */ -#if 0 -static int __inline -iswmmparam(const A_UINT8 *frm) -{ - return frm[1] > 5 && frm[6] == WMM_PARAM_OUI_SUBTYPE; -} - -static int __inline -iswmminfo(const A_UINT8 *frm) -{ - return frm[1] > 5 && frm[6] == WMM_INFO_OUI_SUBTYPE; -} -#endif - -static int __inline -isatherosoui(const A_UINT8 *frm) -{ - return frm[1] > 3 && LE_READ_4(frm+2) == ((ATH_OUI_TYPE<<24)|ATH_OUI); -} - -static int __inline -iswscoui(const A_UINT8 *frm) -{ - return frm[1] > 3 && LE_READ_4(frm+2) == ((0x04<<24)|WPA_OUI); -} - -A_STATUS -wlan_parse_beacon(A_UINT8 *buf, int framelen, struct ieee80211_common_ie *cie) -{ - A_UINT8 *frm, *efrm; - A_UINT8 elemid_ssid = FALSE; - - frm = buf; - efrm = (A_UINT8 *) (frm + framelen); - - /* - * beacon/probe response frame format - * [8] time stamp - * [2] beacon interval - * [2] capability information - * [tlv] ssid - * [tlv] supported rates - * [tlv] country information - * [tlv] parameter set (FH/DS) - * [tlv] erp information - * [tlv] extended supported rates - * [tlv] WMM - * [tlv] WPA or RSN - * [tlv] Atheros Advanced Capabilities - */ - IEEE80211_VERIFY_LENGTH(efrm - frm, 12); - A_MEMZERO(cie, sizeof(*cie)); - - cie->ie_tstamp = frm; frm += 8; - cie->ie_beaconInt = A_LE2CPU16(*(A_UINT16 *)frm); frm += 2; - cie->ie_capInfo = A_LE2CPU16(*(A_UINT16 *)frm); frm += 2; - cie->ie_chan = 0; - - while (frm < efrm) { - switch (*frm) { - case IEEE80211_ELEMID_SSID: - if (!elemid_ssid) { - cie->ie_ssid = frm; - elemid_ssid = TRUE; - } - break; - case IEEE80211_ELEMID_RATES: - cie->ie_rates = frm; - break; - case IEEE80211_ELEMID_COUNTRY: - cie->ie_country = frm; - break; - case IEEE80211_ELEMID_FHPARMS: - break; - case IEEE80211_ELEMID_DSPARMS: - cie->ie_chan = frm[2]; - break; - case IEEE80211_ELEMID_TIM: - cie->ie_tim = frm; - break; - case IEEE80211_ELEMID_IBSSPARMS: - break; - case IEEE80211_ELEMID_XRATES: - cie->ie_xrates = frm; - break; - case IEEE80211_ELEMID_ERP: - if (frm[1] != 1) { - //A_PRINTF("Discarding ERP Element - Bad Len\n"); - return A_EINVAL; - } - cie->ie_erp = frm[2]; - break; - case IEEE80211_ELEMID_RSN: - /* - * Some APs, like TP-LINK, will report a RSN with zero unicast cipher suites in probe resp. - */ - if ((frm[1]<2+4+2) || (LE_READ_2(frm+2+2+4)==0)) { - return A_EINVAL; - } - cie->ie_rsn = frm; - break; - case IEEE80211_ELEMID_HTCAP_ANA: - cie->ie_htcap = frm; - break; - case IEEE80211_ELEMID_HTINFO_ANA: - cie->ie_htop = frm; - break; -#ifdef WAPI_ENABLE - case IEEE80211_ELEMID_WAPI: - cie->ie_wapi = frm; - break; -#endif - case IEEE80211_ELEMID_VENDOR: - if (iswpaoui(frm)) { - cie->ie_wpa = frm; - } else if (iswmmoui(frm)) { - cie->ie_wmm = frm; - } else if (isatherosoui(frm)) { - cie->ie_ath = frm; - } else if(iswscoui(frm)) { - cie->ie_wsc = frm; - } - break; - default: - break; - } - frm += frm[1] + 2; - } - IEEE80211_VERIFY_ELEMENT(cie->ie_rates, IEEE80211_RATE_MAXSIZE); - IEEE80211_VERIFY_ELEMENT(cie->ie_ssid, IEEE80211_NWID_LEN); - - return A_OK; -} diff --git a/drivers/net/wireless/ar6003/host/wlan/src/wlan_utils.c b/drivers/net/wireless/ar6003/host/wlan/src/wlan_utils.c deleted file mode 100644 index fc76132b36aa..000000000000 --- a/drivers/net/wireless/ar6003/host/wlan/src/wlan_utils.c +++ /dev/null @@ -1,62 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This module implements frequently used wlan utilies -// -// Author(s): ="Atheros" -//============================================================================== - -#include -#include -#include -#include - -/* - * converts ieee channel number to frequency - */ -A_UINT16 -wlan_ieee2freq(int chan) -{ - if (chan == 14) { - return 2484; - } - if (chan < 14) { /* 0-13 */ - return (2407 + (chan*5)); - } - if (chan < 27) { /* 15-26 */ - return (2512 + ((chan-15)*20)); - } - return (5000 + (chan*5)); -} - -/* - * Converts MHz frequency to IEEE channel number. - */ -A_UINT32 -wlan_freq2ieee(A_UINT16 freq) -{ - if (freq == 2484) - return 14; - if (freq < 2484) - return (freq - 2407) / 5; - if (freq < 5000) - return 15 + ((freq - 2512) / 20); - return (freq - 5000) / 5; -} diff --git a/drivers/net/wireless/ar6003/host/wmi/makefile b/drivers/net/wireless/ar6003/host/wmi/makefile deleted file mode 100644 index 1ba034c4900e..000000000000 --- a/drivers/net/wireless/ar6003/host/wmi/makefile +++ /dev/null @@ -1,26 +0,0 @@ -#------------------------------------------------------------------------------ -# -# Copyright (c) 2005-2007 Atheros Corporation. All rights reserved. -# -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -#------------------------------------------------------------------------------ -#============================================================================== -# Author(s): ="Atheros" -#============================================================================== -!INCLUDE $(_MAKEENVROOT)\makefile.def - - - diff --git a/drivers/net/wireless/ar6003/host/wmi/wmi.c b/drivers/net/wireless/ar6003/host/wmi/wmi.c deleted file mode 100644 index 7c33a2ac7b0e..000000000000 --- a/drivers/net/wireless/ar6003/host/wmi/wmi.c +++ /dev/null @@ -1,9173 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This module implements the hardware independent layer of the -// Wireless Module Interface (WMI) protocol. -// -// Author(s): ="Atheros" -//============================================================================== - -#include -#include -#include -#include -#include "htc.h" -#include "htc_api.h" -#include "wmi.h" -#include -#include -#include -#include -#include "dset_api.h" -#include "gpio_api.h" -#include "wmi_host.h" -#include "a_drv.h" -#include "a_drv_api.h" -#define ATH_MODULE_NAME wmi -#include "a_debug.h" -#include "dbglog_api.h" -#include "roaming.h" -#ifdef P2P -#include "p2p_api.h" -#endif /* P2P */ - -#define RSSI_AVE(avg, rssi, weight) \ - ((!(avg)) ? (rssi) : \ - ((((avg) * (weight)) + ((16 - (weight)) * (rssi))) / 16)) - -#define ATH_DEBUG_WMI ATH_DEBUG_MAKE_MODULE_MASK(0) - -#ifdef DEBUG - -static ATH_DEBUG_MASK_DESCRIPTION wmi_debug_desc[] = { - { ATH_DEBUG_WMI , "General WMI Tracing"}, -}; - -ATH_DEBUG_INSTANTIATE_MODULE_VAR(wmi, - "wmi", - "Wireless Module Interface", - ATH_DEBUG_MASK_DEFAULTS, - ATH_DEBUG_DESCRIPTION_COUNT(wmi_debug_desc), - wmi_debug_desc); - -#endif - -#ifndef REXOS -#define DBGARG _A_FUNCNAME_ -#define DBGFMT "%s() : " -#define DBG_WMI ATH_DEBUG_WMI -#define DBG_ERROR ATH_DEBUG_ERR -#define DBG_WMI2 ATH_DEBUG_WMI -#define A_DPRINTF AR_DEBUG_PRINTF -#endif - -#ifdef ATH_SUPPORT_DFS - -static A_STATUS -wmi_dfs_phyerr_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_STATUS -wmi_dfs_attach_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_STATUS -wmi_dfs_init_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_STATUS -wmi_dfs_reset_delaylines_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_STATUS -wmi_dfs_reset_radarq_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_STATUS -wmi_dfs_reset_ar_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_STATUS -wmi_dfs_reset_arq_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_STATUS -wmi_dfs_set_dur_multiplier_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_STATUS -wmi_dfs_set_bangradar_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_STATUS -wmi_dfs_set_debuglevel_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -#endif /* ATH_SUPPORT_DFS */ - -#ifdef CONFIG_WLAN_RFKILL - -static A_STATUS wmi_rfkill_state_change_event(struct wmi_t *wmip, A_UINT8* datap,int len); -static A_STATUS wmi_rfkill_get_mode_cmd_event_rx(struct wmi_t *wmip, A_UINT8* datap,int len); -#endif /* CONFIG_WLAN_RFKILL */ - -static A_STATUS wmi_ready_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_STATUS wmi_connect_event_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -static A_STATUS wmi_disconnect_event_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); - -static A_STATUS wmi_tkip_micerr_event_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -static A_STATUS wmi_bssInfo_event_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -static A_STATUS wmi_opt_frame_event_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -static A_STATUS wmi_pstream_timeout_event_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -static A_STATUS wmi_sync_point(struct wmi_t *wmip); - -static A_STATUS wmi_bitrate_reply_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -static A_STATUS wmi_ratemask_reply_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -static A_STATUS wmi_channelList_reply_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -static A_STATUS wmi_regDomain_event_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -static A_STATUS wmi_txPwr_reply_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -static A_STATUS wmi_neighborReport_event_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); - -static A_STATUS wmi_dset_open_req_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -#ifdef CONFIG_HOST_DSET_SUPPORT -static A_STATUS wmi_dset_close_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -static A_STATUS wmi_dset_data_req_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -#endif /* CONFIG_HOST_DSET_SUPPORT */ - - -static A_STATUS wmi_scanComplete_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -static A_STATUS wmi_errorEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -static A_STATUS wmi_statsEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -static A_STATUS wmi_rssiThresholdEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -static A_STATUS wmi_hbChallengeResp_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -static A_STATUS wmi_reportErrorEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -static A_STATUS wmi_cac_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -static A_STATUS wmi_channel_change_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -static A_STATUS wmi_roam_tbl_event_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -static A_STATUS wmi_roam_data_event_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -static A_STATUS wmi_get_wow_list_event_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -static A_STATUS -wmi_get_pmkid_list_event_rx(struct wmi_t *wmip, A_UINT8 *datap, A_UINT32 len); - -static A_STATUS -wmi_set_params_event_rx(struct wmi_t *wmip, A_UINT8 *datap, A_UINT32 len); - -static A_STATUS -wmi_wacGetInfoReply_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -#ifdef CONFIG_HOST_GPIO_SUPPORT -static A_STATUS wmi_gpio_intr_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -static A_STATUS wmi_gpio_data_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -static A_STATUS wmi_gpio_ack_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -#endif /* CONFIG_HOST_GPIO_SUPPORT */ - -#ifdef CONFIG_HOST_TCMD_SUPPORT -static A_STATUS -wmi_tcmd_test_report_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -#endif - -static A_STATUS -wmi_txRetryErrEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_STATUS -wmi_snrThresholdEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_STATUS -wmi_lqThresholdEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_BOOL -wmi_is_bitrate_index_valid(struct wmi_t *wmip, A_INT32 rateIndex); - -static A_STATUS -wmi_aplistEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_STATUS -wmi_dbglog_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -static A_STATUS wmi_keepalive_reply_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - -A_STATUS wmi_cmd_send_xtnd(struct wmi_t *wmip, void *osbuf, WMIX_COMMAND_ID cmdId, - WMI_SYNC_FLAG syncflag); - -A_UINT8 ar6000_get_upper_threshold(A_INT16 rssi, SQ_THRESHOLD_PARAMS *sq_thresh, A_UINT32 size); -A_UINT8 ar6000_get_lower_threshold(A_INT16 rssi, SQ_THRESHOLD_PARAMS *sq_thresh, A_UINT32 size); - -void wmi_cache_configure_rssithreshold(struct wmi_t *wmip, WMI_RSSI_THRESHOLD_PARAMS_CMD *rssiCmd); -void wmi_cache_configure_snrthreshold(struct wmi_t *wmip, WMI_SNR_THRESHOLD_PARAMS_CMD *snrCmd); -static A_STATUS wmi_send_rssi_threshold_params(struct wmi_t *wmip, - WMI_RSSI_THRESHOLD_PARAMS_CMD *rssiCmd); -static A_STATUS wmi_send_snr_threshold_params(struct wmi_t *wmip, - WMI_SNR_THRESHOLD_PARAMS_CMD *snrCmd); -#if defined(CONFIG_TARGET_PROFILE_SUPPORT) -static A_STATUS -wmi_prof_count_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -#endif /* CONFIG_TARGET_PROFILE_SUPPORT */ - -static A_STATUS wmi_pspoll_event_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -static A_STATUS wmi_dtimexpiry_event_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); - -static A_STATUS wmi_peer_node_event_rx (struct wmi_t *wmip, A_UINT8 *datap, - int len); -#ifdef ATH_AR6K_11N_SUPPORT -static A_STATUS wmi_addba_req_event_rx(struct wmi_t *, A_UINT8 *, int); -static A_STATUS wmi_addba_resp_event_rx(struct wmi_t *, A_UINT8 *, int); -static A_STATUS wmi_delba_req_event_rx(struct wmi_t *, A_UINT8 *, int); -static A_STATUS wmi_btcoex_config_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -static A_STATUS wmi_btcoex_stats_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); -#endif -static A_STATUS wmi_hci_event_rx(struct wmi_t *, A_UINT8 *, int); - -#ifdef WAPI_ENABLE -static A_STATUS wmi_wapi_rekey_event_rx(struct wmi_t *wmip, A_UINT8 *datap, - int len); -#endif - -static A_STATUS -wmi_report_assoc_req_rx(struct wmi_t *wmip, A_UINT8 *datap, int len); - - -#if defined(UNDER_CE) || defined(WIN_NWF) -#if defined(NDIS51_MINIPORT) -unsigned int processDot11Hdr = 0; -#else -unsigned int processDot11Hdr = 1; -#endif -#else -extern unsigned int processDot11Hdr; -#endif - -int wps_enable; -static const A_INT32 wmi_rateTable[][2] = { - //{W/O SGI, with SGI} - {1000, 1000}, - {2000, 2000}, - {5500, 5500}, - {11000, 11000}, - {6000, 6000}, - {9000, 9000}, - {12000, 12000}, - {18000, 18000}, - {24000, 24000}, - {36000, 36000}, - {48000, 48000}, - {54000, 54000}, - {6500, 7200}, - {13000, 14400}, - {19500, 21700}, - {26000, 28900}, - {39000, 43300}, - {52000, 57800}, - {58500, 65000}, - {65000, 72200}, - {13500, 15000}, - {27000, 30000}, - {40500, 45000}, - {54000, 60000}, - {81000, 90000}, - {108000, 120000}, - {121500, 135000}, - {135000, 150000}, - {0, 0}}; - -#define MODE_A_SUPPORT_RATE_START ((A_INT32) 4) -#define MODE_A_SUPPORT_RATE_STOP ((A_INT32) 11) - -#define MODE_GONLY_SUPPORT_RATE_START MODE_A_SUPPORT_RATE_START -#define MODE_GONLY_SUPPORT_RATE_STOP MODE_A_SUPPORT_RATE_STOP - -#define MODE_B_SUPPORT_RATE_START ((A_INT32) 0) -#define MODE_B_SUPPORT_RATE_STOP ((A_INT32) 3) - -#define MODE_G_SUPPORT_RATE_START ((A_INT32) 0) -#define MODE_G_SUPPORT_RATE_STOP ((A_INT32) 11) - -#define MODE_GHT20_SUPPORT_RATE_START ((A_INT32) 0) -#define MODE_GHT20_SUPPORT_RATE_STOP ((A_INT32) 19) - -#define MAX_NUMBER_OF_SUPPORT_RATES (MODE_GHT20_SUPPORT_RATE_STOP + 1) - -/* 802.1d to AC mapping. Refer pg 57 of WMM-test-plan-v1.2 */ -const A_UINT8 up_to_ac[]= { - WMM_AC_BE, - WMM_AC_BK, - WMM_AC_BK, - WMM_AC_BE, - WMM_AC_VI, - WMM_AC_VI, - WMM_AC_VO, - WMM_AC_VO, - }; - -#include "athstartpack.h" - -/* This stuff is used when we want a simple layer-3 visibility */ -typedef PREPACK struct _iphdr { - A_UINT8 ip_ver_hdrlen; /* version and hdr length */ - A_UINT8 ip_tos; /* type of service */ - A_UINT16 ip_len; /* total length */ - A_UINT16 ip_id; /* identification */ - A_INT16 ip_off; /* fragment offset field */ -#define IP_DF 0x4000 /* dont fragment flag */ -#define IP_MF 0x2000 /* more fragments flag */ -#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - A_UINT8 ip_ttl; /* time to live */ - A_UINT8 ip_p; /* protocol */ - A_UINT16 ip_sum; /* checksum */ - A_UINT8 ip_src[4]; /* source and dest address */ - A_UINT8 ip_dst[4]; -} POSTPACK iphdr; - -#include "athendpack.h" - -A_INT16 rssi_event_value = 0; -A_INT16 snr_event_value = 0; - -A_BOOL is_probe_ssid = FALSE; - -struct wmi_t *wmi_list[NUM_DEV]; -#ifdef P2P -static A_STATUS -wmi_p2p_goneg_result_event_rx(struct wmi_t *wmip, A_UINT8 *datap,A_UINT8 len); - -static A_STATUS wmi_p2p_goneg_req_rx(struct wmi_t *wmip, A_UINT8 *datap, - A_UINT8 len); -static A_STATUS wmi_p2p_invite_req_rx(struct wmi_t *wmip, A_UINT8 *datap, - A_UINT8 len); -static A_STATUS wmi_p2p_invite_rcvd_result_rx(struct wmi_t *wmip, - A_UINT8 *datap, A_UINT8 len); -static A_STATUS wmi_p2p_invite_sent_result_rx(struct wmi_t *wmip, A_UINT8 *datap, A_UINT8 len); -static A_STATUS wmi_p2p_prov_disc_resp_rx(struct wmi_t *wmip, - A_UINT8 *datap, A_UINT8 len); -static A_STATUS wmi_p2p_prov_disc_req_rx(struct wmi_t *wmip, - A_UINT8 *datap, A_UINT8 len); -static A_STATUS wmi_p2p_start_sdpd_event_rx(struct wmi_t *wmip, - A_UINT8 *datap, A_UINT8 len); -static A_STATUS wmi_p2p_sdpd_rx_event_rx(struct wmi_t *wmip, - A_UINT8 *datap, A_UINT8 len); -#endif /* P2P */ - -static struct wmi_priv_t *pWmiPriv = NULL; - -void * -wmi_init(void *devt, int devid) -{ - struct wmi_t *wmip; - - A_REGISTER_MODULE_DEBUG_INFO(wmi); - - wmip = A_MALLOC(sizeof(struct wmi_t)); - if (wmip == NULL) { - return (NULL); - } - A_MEMZERO(wmip, sizeof(*wmip)); - wmip->wmi_devt = devt; - wlan_node_table_init(wmip, &wmip->wmi_scan_table); - - wmip->wmi_powerMode = REC_POWER; - wmip->wmi_phyMode = WMI_11G_MODE; - - wmip->wmi_pair_crypto_type = NONE_CRYPT; - wmip->wmi_grp_crypto_type = NONE_CRYPT; - - A_MEMZERO(&wmip->wmi_ht_cap[A_BAND_24GHZ], sizeof(WMI_SET_HT_CAP_CMD)); - A_MEMZERO(&wmip->wmi_ht_cap[A_BAND_5GHZ], sizeof(WMI_SET_HT_CAP_CMD)); - - wmip->wmi_ht_cap[A_BAND_24GHZ].enable = 1; - wmip->wmi_ht_cap[A_BAND_5GHZ].enable = 1; - - wmip->wmi_ht_cap[A_BAND_24GHZ].short_GI_20MHz = 1; - wmip->wmi_ht_cap[A_BAND_5GHZ].short_GI_20MHz = 1; - - wmip->wmi_dev_index = devid; - wmi_list[devid] = wmip; - /*One time memory allocation for wmi virtual device structure*/ - if(pWmiPriv == NULL) { - pWmiPriv = A_MALLOC(sizeof(struct wmi_priv_t)); - if (pWmiPriv == NULL) { - return (NULL); - } - A_MEMZERO(pWmiPriv, sizeof(*pWmiPriv)); - A_MUTEX_INIT(&pWmiPriv->wmi_lock); - wmi_qos_state_init(NULL); - A_WMI_SET_NUMDATAENDPTS(wmip->wmi_devt, 1); - } - - return (wmip); -} - -void -wmi_qos_state_init(struct wmi_t *wmip) -{ - A_UINT8 i; - - if (pWmiPriv == NULL) { - return; - } - LOCK_WMI(pWmiPriv); - - /* Initialize QoS States */ - pWmiPriv->wmi_numQoSStream = 0; - - pWmiPriv->wmi_fatPipeExists = 0; - - for (i=0; i < WMM_NUM_AC; i++) { - pWmiPriv->wmi_streamExistsForAC[i]=0; - } - - UNLOCK_WMI(pWmiPriv); - -} - -void -wmi_set_control_ep(struct wmi_t * wmip, HTC_ENDPOINT_ID eid) -{ - A_ASSERT( eid != ENDPOINT_UNUSED); - pWmiPriv->wmi_endpoint_id = eid; -} - -HTC_ENDPOINT_ID -wmi_get_control_ep(struct wmi_t * wmip) -{ - return(pWmiPriv->wmi_endpoint_id); -} - -void -wmi_shutdown(struct wmi_t *wmip) -{ - - if (wmip != NULL) { - wlan_node_table_cleanup(&wmip->wmi_scan_table); - A_FREE(wmip); - wmip = NULL; - } - - if (pWmiPriv != NULL) { - if (A_IS_MUTEX_VALID(&pWmiPriv->wmi_lock)) { - A_MUTEX_DELETE(&pWmiPriv->wmi_lock); - } - A_FREE(pWmiPriv); - pWmiPriv = NULL; - } -} - -/* - * performs DIX to 802.3 encapsulation for transmit packets. - * uses passed in buffer. Returns buffer or NULL if failed. - * Assumes the entire DIX header is contigous and that there is - * enough room in the buffer for a 802.3 mac header and LLC+SNAP headers. - */ -A_STATUS -wmi_dix_2_dot3(struct wmi_t *wmip, void *osbuf) -{ - A_UINT8 *datap; - A_UINT16 typeorlen; - ATH_MAC_HDR macHdr; - ATH_LLC_SNAP_HDR *llcHdr; -#ifdef DIX_TX_OFFLOAD - /*Ethernet to DIX Conversion is offloaded to firmware */ - A_ASSERT(osbuf != NULL); - - if(A_NETBUF_HEADROOM(osbuf) < (sizeof(ATH_LLC_SNAP_HDR) + sizeof(WMI_DATA_HDR))) { - return A_NO_MEMORY; - } - - datap = A_NETBUF_DATA(osbuf); - typeorlen = *(A_UINT16 *)(datap + ATH_MAC_LEN + ATH_MAC_LEN); - - if(!IS_ETHERTYPE(A_BE2CPU16(typeorlen))) { - /*packet is already in 802.3 format - return success*/ - A_DPRINTF(DBG_WMI,(DBGFMT"packet in 802.3 format\n",DBGARG)); - return A_OK; - } - - /*Save MAC fields and lenght to be inserted later*/ - macHdr.typeOrLen = A_CPU2BE16(A_NETBUF_LEN(osbuf) - sizeof(ATH_MAC_HDR) + - sizeof(ATH_LLC_SNAP_HDR)); - - /*Make room for LLC+SNAP headers*/ - if(A_NETBUF_PUSH(osbuf, sizeof(ATH_LLC_SNAP_HDR)) != A_OK) { - return A_NO_MEMORY; - } - - datap = A_NETBUF_DATA(osbuf); - - llcHdr = (ATH_LLC_SNAP_HDR *)(datap); - llcHdr->etherType = macHdr.typeOrLen; - return (A_OK); -#else - - A_ASSERT(osbuf != NULL); - - if (A_NETBUF_HEADROOM(osbuf) < - (sizeof(ATH_LLC_SNAP_HDR) + sizeof(WMI_DATA_HDR))) - { - return A_NO_MEMORY; - } - - datap = A_NETBUF_DATA(osbuf); - - typeorlen = *(A_UINT16 *)(datap + ATH_MAC_LEN + ATH_MAC_LEN); - - if (!IS_ETHERTYPE(A_BE2CPU16(typeorlen))) { - /* - * packet is already in 802.3 format - return success - */ - A_DPRINTF(DBG_WMI, (DBGFMT "packet already 802.3\n", DBGARG)); - return (A_OK); - } - - /* - * Save mac fields and length to be inserted later - */ - A_MEMCPY(macHdr.dstMac, datap, ATH_MAC_LEN); - A_MEMCPY(macHdr.srcMac, datap + ATH_MAC_LEN, ATH_MAC_LEN); - macHdr.typeOrLen = A_CPU2BE16(A_NETBUF_LEN(osbuf) - sizeof(ATH_MAC_HDR) + - sizeof(ATH_LLC_SNAP_HDR)); - - /* - * Make room for LLC+SNAP headers - */ - if (A_NETBUF_PUSH(osbuf, sizeof(ATH_LLC_SNAP_HDR)) != A_OK) { - return A_NO_MEMORY; - } - datap = A_NETBUF_DATA(osbuf); - - A_MEMCPY(datap, &macHdr, sizeof (ATH_MAC_HDR)); - - llcHdr = (ATH_LLC_SNAP_HDR *)(datap + sizeof(ATH_MAC_HDR)); - llcHdr->dsap = 0xAA; - llcHdr->ssap = 0xAA; - llcHdr->cntl = 0x03; - llcHdr->orgCode[0] = 0x0; - llcHdr->orgCode[1] = 0x0; - llcHdr->orgCode[2] = 0x0; - llcHdr->etherType = typeorlen; - - return (A_OK); -#endif -} - -A_STATUS wmi_meta_add(struct wmi_t *wmip, void *osbuf, A_UINT8 *pVersion,void *pTxMetaS) -{ - switch(*pVersion){ - case 0: - return (A_OK); - case WMI_META_VERSION_1: - { - WMI_TX_META_V1 *pV1= NULL; - A_ASSERT(osbuf != NULL); - if (A_NETBUF_PUSH(osbuf, WMI_MAX_TX_META_SZ) != A_OK) { - return A_NO_MEMORY; - } - - pV1 = (WMI_TX_META_V1 *)A_NETBUF_DATA(osbuf); - /* the pktID is used in conjunction with txComplete messages - * allowing the target to notify which tx requests have been - * completed and how. */ - pV1->pktID = 0; - /* the ratePolicyID allows the host to specify which rate policy - * to use for transmitting this packet. 0 means use default behavior. */ - pV1->ratePolicyID = 0; - A_ASSERT(pVersion != NULL); - /* the version must be used to populate the meta field of the WMI_DATA_HDR */ - *pVersion = WMI_META_VERSION_1; - return (A_OK); - } -#ifdef CONFIG_CHECKSUM_OFFLOAD - case WMI_META_VERSION_2: - { - WMI_TX_META_V2 *pV2 ; - A_ASSERT(osbuf != NULL); - if (A_NETBUF_PUSH(osbuf, WMI_MAX_TX_META_SZ) != A_OK) { - return A_NO_MEMORY; - } - pV2 = (WMI_TX_META_V2 *)A_NETBUF_DATA(osbuf); - A_MEMCPY(pV2,(WMI_TX_META_V2 *)pTxMetaS,sizeof(WMI_TX_META_V2)); - return (A_OK); - } -#endif - default: - return (A_OK); - } -} - -/* Adds a WMI data header */ -A_STATUS -wmi_data_hdr_add(struct wmi_t *wmip, void *osbuf, A_UINT8 msgType, A_UINT32 flags, - WMI_DATA_HDR_DATA_TYPE data_type,A_UINT8 metaVersion, void *pTxMetaS) -{ - WMI_DATA_HDR *dtHdr; -// A_UINT8 metaVersion = 0; - A_STATUS status; - - A_ASSERT(osbuf != NULL); - - /* adds the meta data field after the wmi data hdr. If metaVersion - * is returns 0 then no meta field was added. */ - if ((status = wmi_meta_add(wmip, osbuf, &metaVersion,pTxMetaS)) != A_OK) { - return status; - } - - if (A_NETBUF_PUSH(osbuf, sizeof(WMI_DATA_HDR)) != A_OK) { - return A_NO_MEMORY; - } - - dtHdr = (WMI_DATA_HDR *)A_NETBUF_DATA(osbuf); - A_MEMZERO(dtHdr, sizeof(WMI_DATA_HDR)); - - WMI_DATA_HDR_SET_MSG_TYPE(dtHdr, msgType); - WMI_DATA_HDR_SET_DATA_TYPE(dtHdr, data_type); - - if (flags & WMI_DATA_HDR_FLAGS_MORE) { - WMI_DATA_HDR_SET_MORE_BIT(dtHdr); - } - if (flags & WMI_DATA_HDR_FLAGS_EOSP) { - WMI_DATA_HDR_SET_EOSP_BIT(dtHdr); - } - - WMI_DATA_HDR_SET_META(dtHdr, metaVersion); - //dtHdr->rssi = 0; - WMI_DATA_HDR_SET_DEVID(dtHdr, wmip->wmi_dev_index); - return (A_OK); -} - - -A_UINT8 wmi_implicit_create_pstream(struct wmi_t *wmip, void *osbuf, A_UINT32 layer2Priority, A_BOOL wmmEnabled) -{ - A_UINT8 *datap; - A_UINT8 trafficClass = WMM_AC_BE; - A_UINT16 ipType = IP_ETHERTYPE; - WMI_DATA_HDR *dtHdr; - A_BOOL streamExists = FALSE; - A_UINT8 userPriority; - A_UINT32 hdrsize, metasize; - ATH_LLC_SNAP_HDR *llcHdr; - - WMI_CREATE_PSTREAM_CMD cmd; - - A_ASSERT(osbuf != NULL); - - // - // Initialize header size - // - hdrsize = 0; - - datap = A_NETBUF_DATA(osbuf); - dtHdr = (WMI_DATA_HDR *)datap; - metasize = (WMI_DATA_HDR_GET_META(dtHdr))? WMI_MAX_TX_META_SZ : 0; - - if (!wmmEnabled) - { - /* If WMM is disabled all traffic goes as BE traffic */ - userPriority = 0; - } - else - { - if (processDot11Hdr) - { - hdrsize = A_ROUND_UP(sizeof(struct ieee80211_qosframe),sizeof(A_UINT32)); - llcHdr = (ATH_LLC_SNAP_HDR *)(datap + sizeof(WMI_DATA_HDR) + metasize + - hdrsize); - - - } - else - { - llcHdr = (ATH_LLC_SNAP_HDR *)(datap + sizeof(WMI_DATA_HDR) + metasize + - sizeof(ATH_MAC_HDR)); - } - - if (llcHdr->etherType == A_CPU2BE16(ipType)) - { - /* Extract the endpoint info from the TOS field in the IP header */ - - userPriority = wmi_determine_userPriority (((A_UINT8 *)llcHdr) + sizeof(ATH_LLC_SNAP_HDR),layer2Priority); - } - else - { - userPriority = layer2Priority & 0x7; - } - } - - trafficClass = convert_userPriority_to_trafficClass(userPriority); - - WMI_DATA_HDR_SET_UP(dtHdr, userPriority); - /* lower 3-bits are 802.1d priority */ - //dtHdr->info |= (userPriority & WMI_DATA_HDR_UP_MASK) << WMI_DATA_HDR_UP_SHIFT; - - LOCK_WMI(pWmiPriv); - streamExists = pWmiPriv->wmi_fatPipeExists; - UNLOCK_WMI(pWmiPriv); - - if (!(streamExists & (1 << trafficClass))) - { - - A_MEMZERO(&cmd, sizeof(cmd)); - cmd.trafficClass = trafficClass; - cmd.userPriority = userPriority; - cmd.inactivityInt = WMI_IMPLICIT_PSTREAM_INACTIVITY_INT; - - /* Implicit streams are created with TSID 0xFF */ - cmd.tsid = WMI_IMPLICIT_PSTREAM; - wmi_create_pstream_cmd(wmip, &cmd); - } - - return trafficClass; -} - -A_STATUS -wmi_dot11_hdr_add (struct wmi_t *wmip, void *osbuf, NETWORK_TYPE mode) -{ - A_UINT8 *datap; - A_UINT16 typeorlen; - ATH_MAC_HDR macHdr; - ATH_LLC_SNAP_HDR *llcHdr; - struct ieee80211_frame *wh; - A_UINT32 hdrsize; - - A_ASSERT(osbuf != NULL); - - if (A_NETBUF_HEADROOM(osbuf) < - (sizeof(struct ieee80211_qosframe) + sizeof(ATH_LLC_SNAP_HDR) + sizeof(WMI_DATA_HDR))) - { - return A_NO_MEMORY; - } - - datap = A_NETBUF_DATA(osbuf); - - typeorlen = *(A_UINT16 *)(datap + ATH_MAC_LEN + ATH_MAC_LEN); - - if (!IS_ETHERTYPE(A_BE2CPU16(typeorlen))) { -/* - * packet is already in 802.3 format - return success - */ - A_DPRINTF(DBG_WMI, (DBGFMT "packet already 802.3\n", DBGARG)); - goto AddDot11Hdr; - } - - /* - * Save mac fields and length to be inserted later - */ - A_MEMCPY(macHdr.dstMac, datap, ATH_MAC_LEN); - A_MEMCPY(macHdr.srcMac, datap + ATH_MAC_LEN, ATH_MAC_LEN); - macHdr.typeOrLen = A_CPU2BE16(A_NETBUF_LEN(osbuf) - sizeof(ATH_MAC_HDR) + - sizeof(ATH_LLC_SNAP_HDR)); - - // Remove the Ethernet hdr - A_NETBUF_PULL(osbuf, sizeof(ATH_MAC_HDR)); - /* - * Make room for LLC+SNAP headers - */ - if (A_NETBUF_PUSH(osbuf, sizeof(ATH_LLC_SNAP_HDR)) != A_OK) { - return A_NO_MEMORY; - } - datap = A_NETBUF_DATA(osbuf); - - llcHdr = (ATH_LLC_SNAP_HDR *)(datap); - llcHdr->dsap = 0xAA; - llcHdr->ssap = 0xAA; - llcHdr->cntl = 0x03; - llcHdr->orgCode[0] = 0x0; - llcHdr->orgCode[1] = 0x0; - llcHdr->orgCode[2] = 0x0; - llcHdr->etherType = typeorlen; - -AddDot11Hdr: - /* Make room for 802.11 hdr */ - if (wmip->wmi_is_wmm_enabled) - { - hdrsize = A_ROUND_UP(sizeof(struct ieee80211_qosframe),sizeof(A_UINT32)); - if (A_NETBUF_PUSH(osbuf, hdrsize) != A_OK) - { - return A_NO_MEMORY; - } - wh = (struct ieee80211_frame *) A_NETBUF_DATA(osbuf); - wh->i_fc[0] = IEEE80211_FC0_SUBTYPE_QOS; - } - else - { - hdrsize = A_ROUND_UP(sizeof(struct ieee80211_frame),sizeof(A_UINT32)); - if (A_NETBUF_PUSH(osbuf, hdrsize) != A_OK) - { - return A_NO_MEMORY; - } - wh = (struct ieee80211_frame *) A_NETBUF_DATA(osbuf); - wh->i_fc[0] = IEEE80211_FC0_SUBTYPE_DATA; - } - /* Setup the SA & DA */ - IEEE80211_ADDR_COPY(wh->i_addr2, macHdr.srcMac); - - if (mode == INFRA_NETWORK) { - IEEE80211_ADDR_COPY(wh->i_addr3, macHdr.dstMac); - } - else if (mode == ADHOC_NETWORK) { - IEEE80211_ADDR_COPY(wh->i_addr1, macHdr.dstMac); - } - - return (A_OK); -} - -A_STATUS -wmi_dot11_hdr_remove(struct wmi_t *wmip, void *osbuf) -{ - A_UINT8 *datap; - struct ieee80211_frame *pwh,wh; - A_UINT8 type,subtype; - ATH_LLC_SNAP_HDR *llcHdr; - ATH_MAC_HDR macHdr; - A_UINT32 hdrsize; - - A_ASSERT(osbuf != NULL); - datap = A_NETBUF_DATA(osbuf); - - pwh = (struct ieee80211_frame *)datap; - type = pwh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; - subtype = pwh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; - - A_MEMCPY((A_UINT8 *)&wh, datap, sizeof(struct ieee80211_frame)); - - /* strip off the 802.11 hdr*/ - if (subtype == IEEE80211_FC0_SUBTYPE_QOS) { - hdrsize = A_ROUND_UP(sizeof(struct ieee80211_qosframe),sizeof(A_UINT32)); - A_NETBUF_PULL(osbuf, hdrsize); - } else if (subtype == IEEE80211_FC0_SUBTYPE_DATA) { - A_NETBUF_PULL(osbuf, sizeof(struct ieee80211_frame)); - } - - datap = A_NETBUF_DATA(osbuf); - llcHdr = (ATH_LLC_SNAP_HDR *)(datap); - - macHdr.typeOrLen = llcHdr->etherType; - A_MEMZERO(macHdr.dstMac, sizeof(macHdr.dstMac)); - A_MEMZERO(macHdr.srcMac, sizeof(macHdr.srcMac)); - - switch (wh.i_fc[1] & IEEE80211_FC1_DIR_MASK) { - case IEEE80211_FC1_DIR_NODS: - IEEE80211_ADDR_COPY(macHdr.dstMac, wh.i_addr1); - IEEE80211_ADDR_COPY(macHdr.srcMac, wh.i_addr2); - break; - case IEEE80211_FC1_DIR_TODS: - IEEE80211_ADDR_COPY(macHdr.dstMac, wh.i_addr3); - IEEE80211_ADDR_COPY(macHdr.srcMac, wh.i_addr2); - break; - case IEEE80211_FC1_DIR_FROMDS: - IEEE80211_ADDR_COPY(macHdr.dstMac, wh.i_addr1); - IEEE80211_ADDR_COPY(macHdr.srcMac, wh.i_addr3); - break; - case IEEE80211_FC1_DIR_DSTODS: - break; - } - - // Remove the LLC Hdr. - A_NETBUF_PULL(osbuf, sizeof(ATH_LLC_SNAP_HDR)); - - // Insert the ATH MAC hdr. - - A_NETBUF_PUSH(osbuf, sizeof(ATH_MAC_HDR)); - datap = A_NETBUF_DATA(osbuf); - - A_MEMCPY (datap, &macHdr, sizeof(ATH_MAC_HDR)); - - return A_OK; -} - -/* - * performs 802.3 to DIX encapsulation for received packets. - * Assumes the entire 802.3 header is contigous. - */ -A_STATUS -wmi_dot3_2_dix(void *osbuf) -{ - A_UINT8 *datap; - ATH_MAC_HDR macHdr; - ATH_LLC_SNAP_HDR *llcHdr; - - A_ASSERT(osbuf != NULL); - - datap = A_NETBUF_DATA(osbuf); - - A_MEMCPY(&macHdr, datap, sizeof(ATH_MAC_HDR)); - llcHdr = (ATH_LLC_SNAP_HDR *)(datap + sizeof(ATH_MAC_HDR)); - macHdr.typeOrLen = llcHdr->etherType; - - if (A_NETBUF_PULL(osbuf, sizeof(ATH_LLC_SNAP_HDR)) != A_OK) { - return A_NO_MEMORY; - } - - datap = A_NETBUF_DATA(osbuf); - - A_MEMCPY(datap, &macHdr, sizeof (ATH_MAC_HDR)); - - return (A_OK); -} - -/* - * Removes a WMI data header - */ -A_STATUS -wmi_data_hdr_remove(struct wmi_t *wmip, void *osbuf) -{ - A_ASSERT(osbuf != NULL); - - return (A_NETBUF_PULL(osbuf, sizeof(WMI_DATA_HDR))); -} - -void -wmi_iterate_nodes(struct wmi_t *wmip, wlan_node_iter_func *f, void *arg) -{ - wlan_iterate_nodes(&wmip->wmi_scan_table, f, arg); -} - -static A_STATUS -wmi_report_wmm_params(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_REPORT_WMM_PARAMS_EVENT *ev; - A_UINT8 i; - - if (len < sizeof(*ev)) { - return A_EINVAL; - } - ev = (WMI_REPORT_WMM_PARAMS_EVENT *)datap; - - A_PRINTF("WMM params\n"); - for (i = 0; i < 4; i++) { - A_PRINTF("AC %d, ACM %d, AIFSN %d, CWmin %d, CWmax %d, TXOPlimit %d\n", i, - ev->wmm_params[i].acm, - ev->wmm_params[i].aifsn, - ev->wmm_params[i].logcwmin, - ev->wmm_params[i].logcwmax, - ev->wmm_params[i].txopLimit); - } - - return A_OK; -} - -/* - * WMI Extended Event received from Target. - */ -A_STATUS -wmi_control_rx_xtnd(struct wmi_t *wmip, void *osbuf) -{ - WMIX_CMD_HDR *cmd; - A_UINT16 id; - A_UINT8 *datap; - A_UINT32 len; - A_STATUS status = A_OK; - - if (A_NETBUF_LEN(osbuf) < sizeof(WMIX_CMD_HDR)) { - A_DPRINTF(DBG_WMI, (DBGFMT "bad packet 1\n", DBGARG)); - wmip->wmi_stats.cmd_len_err++; - return A_ERROR; - } - - cmd = (WMIX_CMD_HDR *)A_NETBUF_DATA(osbuf); - id = cmd->commandId; - - if (A_NETBUF_PULL(osbuf, sizeof(WMIX_CMD_HDR)) != A_OK) { - A_DPRINTF(DBG_WMI, (DBGFMT "bad packet 2\n", DBGARG)); - wmip->wmi_stats.cmd_len_err++; - return A_ERROR; - } - - datap = A_NETBUF_DATA(osbuf); - len = A_NETBUF_LEN(osbuf); - - switch (id) { - case (WMIX_DSETOPENREQ_EVENTID): - status = wmi_dset_open_req_rx(wmip, datap, len); - break; -#ifdef CONFIG_HOST_DSET_SUPPORT - case (WMIX_DSETCLOSE_EVENTID): - status = wmi_dset_close_rx(wmip, datap, len); - break; - case (WMIX_DSETDATAREQ_EVENTID): - status = wmi_dset_data_req_rx(wmip, datap, len); - break; -#endif /* CONFIG_HOST_DSET_SUPPORT */ -#ifdef CONFIG_HOST_GPIO_SUPPORT - case (WMIX_GPIO_INTR_EVENTID): - wmi_gpio_intr_rx(wmip, datap, len); - break; - case (WMIX_GPIO_DATA_EVENTID): - wmi_gpio_data_rx(wmip, datap, len); - break; - case (WMIX_GPIO_ACK_EVENTID): - wmi_gpio_ack_rx(wmip, datap, len); - break; -#endif /* CONFIG_HOST_GPIO_SUPPORT */ - case (WMIX_HB_CHALLENGE_RESP_EVENTID): - wmi_hbChallengeResp_rx(wmip, datap, len); - break; - case (WMIX_DBGLOG_EVENTID): - wmi_dbglog_event_rx(wmip, datap, len); - break; -#if defined(CONFIG_TARGET_PROFILE_SUPPORT) - case (WMIX_PROF_COUNT_EVENTID): - wmi_prof_count_rx(wmip, datap, len); - break; -#endif /* CONFIG_TARGET_PROFILE_SUPPORT */ - default: - A_DPRINTF(DBG_WMI|DBG_ERROR, - (DBGFMT "Unknown id 0x%x\n", DBGARG, id)); - wmip->wmi_stats.cmd_id_err++; - status = A_ERROR; - break; - } - - return status; -} - -/* - * Control Path - */ -A_UINT32 cmdRecvNum; - -A_STATUS -wmi_control_rx(struct wmi_t *wmip, void *osbuf) -{ - WMI_CMD_HDR *cmd; - A_UINT16 id; - A_UINT8 *datap; - A_UINT32 len, i, loggingReq; - A_STATUS status = A_OK; - - A_ASSERT(osbuf != NULL); - if (A_NETBUF_LEN(osbuf) < sizeof(WMI_CMD_HDR)) { - A_NETBUF_FREE(osbuf); - A_DPRINTF(DBG_WMI, (DBGFMT "bad packet 1\n", DBGARG)); - wmip->wmi_stats.cmd_len_err++; - return A_ERROR; - } - - cmd = (WMI_CMD_HDR *)A_NETBUF_DATA(osbuf); - id = cmd->commandId; - - if (A_NETBUF_PULL(osbuf, sizeof(WMI_CMD_HDR)) != A_OK) { - A_NETBUF_FREE(osbuf); - A_DPRINTF(DBG_WMI, (DBGFMT "bad packet 2\n", DBGARG)); - wmip->wmi_stats.cmd_len_err++; - return A_ERROR; - } - - datap = A_NETBUF_DATA(osbuf); - len = A_NETBUF_LEN(osbuf); - - loggingReq = 0; - - ar6000_get_driver_cfg(wmip->wmi_devt, - AR6000_DRIVER_CFG_LOG_RAW_WMI_MSGS, - &loggingReq); - - if(loggingReq) { - AR_DEBUG_PRINTF(ATH_DEBUG_WMI, ("WMI %d \n",id)); - AR_DEBUG_PRINTF(ATH_DEBUG_WMI, ("WMI devid %d \n",wmip->wmi_dev_index)); - AR_DEBUG_PRINTF(ATH_DEBUG_WMI, ("WMI recv, MsgNo %d : ", cmdRecvNum)); - for(i = 0; i < len; i++) - AR_DEBUG_PRINTF(ATH_DEBUG_WMI, ("%x ", datap[i])); - AR_DEBUG_PRINTF(ATH_DEBUG_WMI, ("\n")); - } - - LOCK_WMI(pWmiPriv); - cmdRecvNum++; - UNLOCK_WMI(pWmiPriv); - - switch (id) { - case (WMI_GET_BITRATE_CMDID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_GET_BITRATE_CMDID\n", DBGARG)); - status = wmi_bitrate_reply_rx(wmip, datap, len); - break; - case (WMI_GET_CHANNEL_LIST_CMDID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_GET_CHANNEL_LIST_CMDID\n", DBGARG)); - status = wmi_channelList_reply_rx(wmip, datap, len); - break; - case (WMI_GET_TX_PWR_CMDID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_GET_TX_PWR_CMDID\n", DBGARG)); - status = wmi_txPwr_reply_rx(wmip, datap, len); - break; - case (WMI_READY_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_READY_EVENTID\n", DBGARG)); - status = wmi_ready_event_rx(wmip, datap, len); - A_WMI_SEND_EVENT_TO_APP(wmip->wmi_devt, id, datap, len); - A_WMI_DBGLOG_INIT_DONE(wmip->wmi_devt); - break; - case (WMI_CONNECT_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_CONNECT_EVENTID\n", DBGARG)); - status = wmi_connect_event_rx(wmip, datap, len); - A_WMI_SEND_GENERIC_EVENT_TO_APP(wmip->wmi_devt, id, datap, len); - break; - case (WMI_DISCONNECT_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_DISCONNECT_EVENTID\n", DBGARG)); - status = wmi_disconnect_event_rx(wmip, datap, len); - A_WMI_SEND_EVENT_TO_APP(wmip->wmi_devt, id, datap, len); - break; - case (WMI_PEER_NODE_EVENTID): - A_DPRINTF (DBG_WMI, (DBGFMT "WMI_PEER_NODE_EVENTID\n", DBGARG)); - status = wmi_peer_node_event_rx(wmip, datap, len); - A_WMI_SEND_EVENT_TO_APP(wmip->wmi_devt, id, datap, len); - break; - case (WMI_TKIP_MICERR_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_TKIP_MICERR_EVENTID\n", DBGARG)); - status = wmi_tkip_micerr_event_rx(wmip, datap, len); - break; - case (WMI_BSSINFO_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_BSSINFO_EVENTID\n", DBGARG)); - { - /* - * convert WMI_BSS_INFO_HDR2 to WMI_BSS_INFO_HDR - * Take a local copy of the WMI_BSS_INFO_HDR2 from the wmi buffer - * and reconstruct the WMI_BSS_INFO_HDR in its place - */ - WMI_BSS_INFO_HDR2 bih2; - WMI_BSS_INFO_HDR *bih; - A_UINT16 devBitMap; - A_UINT16 dev_id = 0; - struct wmi_t *wmiptr; - A_MEMCPY(&bih2, datap, sizeof(WMI_BSS_INFO_HDR2)); - - A_NETBUF_PUSH(osbuf, 4); - datap = A_NETBUF_DATA(osbuf); - len = A_NETBUF_LEN(osbuf); - bih = (WMI_BSS_INFO_HDR *)datap; - - bih->channel = bih2.channel; - bih->frameType = bih2.frameType; - bih->snr = bih2.snr; - bih->rssi = bih2.snr - 95; - bih->ieMask = bih2.ieMask; - A_MEMCPY(bih->bssid, bih2.bssid, ATH_MAC_LEN); - /* Deliever the BSS info event based on the device id set - * by target - */ - devBitMap = (bih2.ieMask >> 12); - do { - - if(devBitMap & 1) { - wmiptr = wmi_list[dev_id]; - status = wmi_bssInfo_event_rx(wmiptr, datap, len); - A_WMI_SEND_GENERIC_EVENT_TO_APP(wmiptr->wmi_devt, id, datap, len); - } - devBitMap = (devBitMap >> 1); - dev_id++; - }while(devBitMap); - } - break; - case (WMI_REGDOMAIN_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_REGDOMAIN_EVENTID\n", DBGARG)); - status = wmi_regDomain_event_rx(wmip, datap, len); - break; - case (WMI_PSTREAM_TIMEOUT_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_PSTREAM_TIMEOUT_EVENTID\n", DBGARG)); - status = wmi_pstream_timeout_event_rx(wmip, datap, len); - /* pstreams are fatpipe abstractions that get implicitly created. - * User apps only deal with thinstreams. creation of a thinstream - * by the user or data traffic flow in an AC triggers implicit - * pstream creation. Do we need to send this event to App..? - * no harm in sending it. - */ - A_WMI_SEND_EVENT_TO_APP(wmip->wmi_devt, id, datap, len); - break; - case (WMI_NEIGHBOR_REPORT_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_NEIGHBOR_REPORT_EVENTID\n", DBGARG)); - status = wmi_neighborReport_event_rx(wmip, datap, len); - break; - case (WMI_SCAN_COMPLETE_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_SCAN_COMPLETE_EVENTID\n", DBGARG)); - status = wmi_scanComplete_rx(wmip, datap, len); - A_WMI_SEND_EVENT_TO_APP(wmip->wmi_devt, id, datap, len); - break; - case (WMI_CMDERROR_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_CMDERROR_EVENTID\n", DBGARG)); - status = wmi_errorEvent_rx(wmip, datap, len); - break; - case (WMI_REPORT_STATISTICS_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_REPORT_STATISTICS_EVENTID\n", DBGARG)); - status = wmi_statsEvent_rx(wmip, datap, len); - break; - case (WMI_RSSI_THRESHOLD_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_RSSI_THRESHOLD_EVENTID\n", DBGARG)); - status = wmi_rssiThresholdEvent_rx(wmip, datap, len); - break; - case (WMI_ERROR_REPORT_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_ERROR_REPORT_EVENTID\n", DBGARG)); - status = wmi_reportErrorEvent_rx(wmip, datap, len); - A_WMI_SEND_EVENT_TO_APP(wmip->wmi_devt, id, datap, len); - break; - case (WMI_OPT_RX_FRAME_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_OPT_RX_FRAME_EVENTID\n", DBGARG)); - status = wmi_opt_frame_event_rx(wmip, datap, len); - break; - case (WMI_REPORT_ROAM_TBL_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_REPORT_ROAM_TBL_EVENTID\n", DBGARG)); - status = wmi_roam_tbl_event_rx(wmip, datap, len); - break; - case (WMI_EXTENSION_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_EXTENSION_EVENTID\n", DBGARG)); - status = wmi_control_rx_xtnd(wmip, osbuf); - break; - case (WMI_CAC_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_CAC_EVENTID\n", DBGARG)); - status = wmi_cac_event_rx(wmip, datap, len); - break; - case (WMI_CHANNEL_CHANGE_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_CHANNEL_CHANGE_EVENTID\n", DBGARG)); - status = wmi_channel_change_event_rx(wmip, datap, len); - break; - case (WMI_REPORT_ROAM_DATA_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_REPORT_ROAM_DATA_EVENTID\n", DBGARG)); - status = wmi_roam_data_event_rx(wmip, datap, len); - break; -#ifdef CONFIG_HOST_TCMD_SUPPORT - case (WMI_TEST_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_TEST_EVENTID\n", DBGARG)); - status = wmi_tcmd_test_report_rx(wmip, datap, len); - break; -#endif - case (WMI_GET_FIXRATES_CMDID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_GET_FIXRATES_CMDID\n", DBGARG)); - status = wmi_ratemask_reply_rx(wmip, datap, len); - break; - case (WMI_TX_RETRY_ERR_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_TX_RETRY_ERR_EVENTID\n", DBGARG)); - status = wmi_txRetryErrEvent_rx(wmip, datap, len); - A_WMI_SEND_EVENT_TO_APP(wmip->wmi_devt, id, datap, len); - break; - case (WMI_SNR_THRESHOLD_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_SNR_THRESHOLD_EVENTID\n", DBGARG)); - status = wmi_snrThresholdEvent_rx(wmip, datap, len); - break; - case (WMI_LQ_THRESHOLD_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_LQ_THRESHOLD_EVENTID\n", DBGARG)); - status = wmi_lqThresholdEvent_rx(wmip, datap, len); - A_WMI_SEND_EVENT_TO_APP(wmip->wmi_devt, id, datap, len); - break; - case (WMI_APLIST_EVENTID): - AR_DEBUG_PRINTF(ATH_DEBUG_WMI, ("Received APLIST Event\n")); - status = wmi_aplistEvent_rx(wmip, datap, len); - break; - case (WMI_GET_KEEPALIVE_CMDID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_GET_KEEPALIVE_CMDID\n", DBGARG)); - status = wmi_keepalive_reply_rx(wmip, datap, len); - break; - case (WMI_GET_WOW_LIST_EVENTID): - status = wmi_get_wow_list_event_rx(wmip, datap, len); - break; - case (WMI_GET_PMKID_LIST_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_GET_PMKID_LIST Event\n", DBGARG)); - status = wmi_get_pmkid_list_event_rx(wmip, datap, len); - break; - case (WMI_PSPOLL_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_PSPOLL_EVENT\n", DBGARG)); - status = wmi_pspoll_event_rx(wmip, datap, len); - break; - case (WMI_DTIMEXPIRY_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_DTIMEXPIRY_EVENT\n", DBGARG)); - status = wmi_dtimexpiry_event_rx(wmip, datap, len); - break; - case (WMI_SET_PARAMS_REPLY_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_SET_PARAMS_REPLY Event\n", DBGARG)); - status = wmi_set_params_event_rx(wmip, datap, len); - break; -#ifdef ATH_AR6K_11N_SUPPORT - case (WMI_ADDBA_REQ_EVENTID): - status = wmi_addba_req_event_rx(wmip, datap, len); - break; - case (WMI_ADDBA_RESP_EVENTID): - status = wmi_addba_resp_event_rx(wmip, datap, len); - break; - case (WMI_DELBA_REQ_EVENTID): - status = wmi_delba_req_event_rx(wmip, datap, len); - break; - case (WMI_REPORT_BTCOEX_CONFIG_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_BTCOEX_CONFIG_EVENTID", DBGARG)); - status = wmi_btcoex_config_event_rx(wmip, datap, len); - break; - case (WMI_REPORT_BTCOEX_STATS_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_BTCOEX_STATS_EVENTID", DBGARG)); - status = wmi_btcoex_stats_event_rx(wmip, datap, len); - break; -#endif - case (WMI_TX_COMPLETE_EVENTID): - { - int index; - TX_COMPLETE_MSG_V1 *pV1; - WMI_TX_COMPLETE_EVENT *pEv = (WMI_TX_COMPLETE_EVENT *)datap; - A_PRINTF("comp: %d %d %d\n", pEv->numMessages, pEv->msgLen, pEv->msgType); - - for(index = 0 ; index < pEv->numMessages ; index++) { - pV1 = (TX_COMPLETE_MSG_V1 *)(datap + sizeof(WMI_TX_COMPLETE_EVENT) + index*sizeof(TX_COMPLETE_MSG_V1)); - A_PRINTF("msg: %d %d %d %d\n", pV1->status, pV1->pktID, pV1->rateIdx, pV1->ackFailures); - } - } - break; - case (WMI_HCI_EVENT_EVENTID): - status = wmi_hci_event_rx(wmip, datap, len); - break; -#ifdef WAPI_ENABLE - case (WMI_WAPI_REKEY_EVENTID): - A_DPRINTF(DBG_WMI, (DBGFMT "WMI_WAPI_REKEY_EVENTID", DBGARG)); - status = wmi_wapi_rekey_event_rx(wmip, datap, len); - break; -#endif - -#ifdef ATH_SUPPORT_DFS - case WMI_DFS_HOST_ATTACH_EVENTID: - status = wmi_dfs_attach_event_rx(wmip, datap, len); - break; - case WMI_DFS_HOST_INIT_EVENTID: - status = wmi_dfs_init_event_rx(wmip, datap, len); - break; - case WMI_DFS_RESET_DELAYLINES_EVENTID: - status = wmi_dfs_reset_delaylines_event_rx(wmip, datap, len); - break; - case WMI_DFS_RESET_RADARQ_EVENTID: - status = wmi_dfs_reset_radarq_event_rx(wmip, datap, len); - break; - case WMI_DFS_RESET_AR_EVENTID: - status = wmi_dfs_reset_ar_event_rx(wmip, datap, len); - break; - case WMI_DFS_RESET_ARQ_EVENTID: - status = wmi_dfs_reset_arq_event_rx(wmip, datap, len); - break; - case WMI_DFS_SET_DUR_MULTIPLIER_EVENTID: - status = wmi_dfs_set_dur_multiplier_event_rx(wmip, datap, len); - break; - case WMI_DFS_SET_BANGRADAR_EVENTID: - status = wmi_dfs_set_bangradar_event_rx(wmip, datap, len); - break; - case WMI_DFS_SET_DEBUGLEVEL_EVENTID: - status = wmi_dfs_set_debuglevel_event_rx(wmip, datap, len); - break; - case WMI_DFS_PHYERR_EVENTID: - status = wmi_dfs_phyerr_event_rx(wmip, datap, len); - break; -#endif /* ATH_SUPPORT_DFS */ -#ifdef P2P - case WMI_P2P_GO_NEG_RESULT_EVENTID: - status = wmi_p2p_goneg_result_event_rx(wmip, datap, len) ; - break; - - case WMI_P2P_GO_NEG_REQ_EVENTID: - status = wmi_p2p_goneg_req_rx(wmip, datap, len); - break; - - case WMI_P2P_INVITE_SENT_RESULT_EVENTID: - status = wmi_p2p_invite_sent_result_rx(wmip, datap, len); - break; - - case WMI_P2P_INVITE_REQ_EVENTID: - status = wmi_p2p_invite_req_rx(wmip, datap, len); - break; - - case WMI_P2P_INVITE_RCVD_RESULT_EVENTID: - status = wmi_p2p_invite_rcvd_result_rx(wmip, datap, len); - break; - - case WMI_P2P_PROV_DISC_REQ_EVENTID: - status = wmi_p2p_prov_disc_req_rx(wmip, datap, len); - break; - - case WMI_P2P_PROV_DISC_RESP_EVENTID: - status = wmi_p2p_prov_disc_resp_rx(wmip, datap, len); - break; - - case WMI_P2P_START_SDPD_EVENTID: - status = wmi_p2p_start_sdpd_event_rx(wmip, datap, len); - break; - - case WMI_P2P_SDPD_RX_EVENTID: - status = wmi_p2p_sdpd_rx_event_rx(wmip, datap, len); - break; -#endif /* P2P */ - - case WMI_WAC_REPORT_BSS_EVENTID: - { - WMI_BSS_INFO_HDR2 *p = (WMI_BSS_INFO_HDR2 *)datap; - A_DPRINTF(ATH_DEBUG_ERR, (DBGFMT "WMI_WAC_REPORT_BSS: %x:%x:%x:%x:%x:%x\n", DBGARG, - p->bssid[0], - p->bssid[1], - p->bssid[2], - p->bssid[3], - p->bssid[4], - p->bssid[5])); - } - case WMI_WAC_SCAN_DONE_EVENTID: - case WMI_WAC_START_WPS_EVENTID: - A_WMI_SEND_EVENT_TO_APP(wmip->wmi_devt, id, datap, len); - break; - case WMI_WAC_CTRL_REQ_REPLY_EVENTID: - { - status = wmi_wacGetInfoReply_rx(wmip, datap, len); - break; - } - case WMI_REPORT_WMM_PARAMS_EVENTID: - { - status = wmi_report_wmm_params(wmip, datap, len); - break; - } -#ifdef CONFIG_WLAN_RFKILL - case (WMI_RFKILL_STATE_CHANGE_EVENTID): - status = wmi_rfkill_state_change_event(wmip,datap,len); - break; - - case (WMI_RFKILL_GET_MODE_CMD_EVENTID): - status = wmi_rfkill_get_mode_cmd_event_rx(wmip,datap,len); - break; - -#endif /* CONFIG_WLAN_RFKILL */ - - case WMI_ASSOC_REQ_EVENTID: - status = wmi_report_assoc_req_rx(wmip, datap, len); - break; - - default: - A_DPRINTF(DBG_WMI|DBG_ERROR, - (DBGFMT "Unknown id 0x%x\n", DBGARG, id)); - wmip->wmi_stats.cmd_id_err++; - status = A_ERROR; - break; - } - - A_NETBUF_FREE(osbuf); - - return status; -} - -/* Send a "simple" wmi command -- one with no arguments */ -static A_STATUS -wmi_simple_cmd(struct wmi_t *wmip, WMI_COMMAND_ID cmdid) -{ - void *osbuf; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(0); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - status = wmi_cmd_send(wmip, osbuf, cmdid, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -/* Send a "simple" extended wmi command -- one with no arguments. - Enabling this command only if GPIO or profiling support is enabled. - This is to suppress warnings on some platforms */ -#if defined(CONFIG_HOST_GPIO_SUPPORT) || defined(CONFIG_TARGET_PROFILE_SUPPORT) -static A_STATUS -wmi_simple_cmd_xtnd(struct wmi_t *wmip, WMIX_COMMAND_ID cmdid) -{ - void *osbuf; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(0); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - status = wmi_cmd_send_xtnd(wmip, osbuf, cmdid, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} -#endif - -static A_STATUS -wmi_ready_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_READY_EVENT *ev = (WMI_READY_EVENT *)datap; - - if (len < sizeof(WMI_READY_EVENT)) { - return A_EINVAL; - } - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - pWmiPriv->wmi_ready = TRUE; - A_WMI_READY_EVENT(wmip->wmi_devt, ev->macaddr, ev->phyCapability, - ev->sw_version, ev->abi_version); - - return A_OK; -} - -#define LE_READ_4(p) \ - ((A_UINT32) \ - ((((A_UINT8 *)(p))[0] ) | (((A_UINT8 *)(p))[1] << 8) | \ - (((A_UINT8 *)(p))[2] << 16) | (((A_UINT8 *)(p))[3] << 24))) - -static int __inline -iswmmoui(const A_UINT8 *frm) -{ - return frm[1] > 3 && LE_READ_4(frm+2) == ((WMM_OUI_TYPE<<24)|WMM_OUI); -} - -static int __inline -iswmmparam(const A_UINT8 *frm) -{ - return frm[1] > 5 && frm[6] == WMM_PARAM_OUI_SUBTYPE; -} - - -static A_STATUS -wmi_connect_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_CONNECT_EVENT *ev; - A_UINT8 *pie,*peie; - - if (len < sizeof(WMI_CONNECT_EVENT)) - { - return A_EINVAL; - } - ev = (WMI_CONNECT_EVENT *)datap; - - A_MEMCPY(wmip->wmi_bssid, ev->u.infra_ibss_bss.bssid, ATH_MAC_LEN); - - /* initialize pointer to start of assoc rsp IEs */ - pie = ev->assocInfo + ev->beaconIeLen + ev->assocReqLen + - sizeof(A_UINT16) + /* capinfo*/ - sizeof(A_UINT16) + /* status Code */ - sizeof(A_UINT16) ; /* associd */ - - /* initialize pointer to end of assoc rsp IEs */ - peie = ev->assocInfo + ev->beaconIeLen + ev->assocReqLen + ev->assocRespLen; - - while (pie < peie) - { - switch (*pie) - { - case IEEE80211_ELEMID_VENDOR: - if (iswmmoui(pie)) - { - if(iswmmparam (pie)) - { - wmip->wmi_is_wmm_enabled = TRUE; - } - } - break; - } - - if (wmip->wmi_is_wmm_enabled) - { - break; - } - pie += pie[1] + 2; - } - - A_WMI_CONNECT_EVENT(wmip->wmi_devt, ev); - - return A_OK; -} - -static A_STATUS -wmi_regDomain_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_REG_DOMAIN_EVENT *ev; - - if (len < sizeof(*ev)) { - return A_EINVAL; - } - ev = (WMI_REG_DOMAIN_EVENT *)datap; - - A_WMI_REGDOMAIN_EVENT(wmip->wmi_devt, ev->regDomain); - - return A_OK; -} - -static A_STATUS -wmi_neighborReport_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_NEIGHBOR_REPORT_EVENT *ev; - int numAps; - - if (len < sizeof(*ev)) { - return A_EINVAL; - } - ev = (WMI_NEIGHBOR_REPORT_EVENT *)datap; - numAps = ev->numberOfAps; - - if (len < (int)(sizeof(*ev) + ((numAps - 1) * sizeof(WMI_NEIGHBOR_INFO)))) { - return A_EINVAL; - } - - A_WMI_NEIGHBORREPORT_EVENT(wmip->wmi_devt, numAps, ev->neighbor); - - return A_OK; -} - -static A_STATUS -wmi_disconnect_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_DISCONNECT_EVENT *ev; - - if (len < sizeof(WMI_DISCONNECT_EVENT)) { - return A_EINVAL; - } - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - ev = (WMI_DISCONNECT_EVENT *)datap; - - A_MEMZERO(wmip->wmi_bssid, sizeof(wmip->wmi_bssid)); - - wmip->wmi_is_wmm_enabled = FALSE; - wmip->wmi_pair_crypto_type = NONE_CRYPT; - wmip->wmi_grp_crypto_type = NONE_CRYPT; - - A_WMI_DISCONNECT_EVENT(wmip->wmi_devt, ev->disconnectReason, ev->bssid, - ev->assocRespLen, ev->assocInfo, ev->protocolReasonStatus); - - return A_OK; -} - - -#ifdef ATH_SUPPORT_DFS - -static A_STATUS -wmi_dfs_attach_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_DFS_HOST_ATTACH_EVENT *ev; - - if (len < sizeof(WMI_DFS_HOST_ATTACH_EVENT)) { - return A_EINVAL; - } - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - ev = (WMI_DFS_HOST_ATTACH_EVENT *)datap; - - A_WMI_DFS_ATTACH_EVENT(wmip->wmi_devt, ev); - - return A_OK; -} - -static A_STATUS -wmi_dfs_init_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_DFS_HOST_INIT_EVENT *ev; - if (len < sizeof(WMI_DFS_HOST_INIT_EVENT)) { - return A_EINVAL; - } - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - ev = (WMI_DFS_HOST_INIT_EVENT *)datap; - - A_WMI_DFS_INIT_EVENT(wmip->wmi_devt, ev); - return A_OK; -} - -static A_STATUS -wmi_dfs_phyerr_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_DFS_PHYERR_EVENT *ev; - if (len < sizeof(WMI_DFS_PHYERR_EVENT)) { - return A_EINVAL; - } - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - ev = (WMI_DFS_PHYERR_EVENT *)datap; - - A_WMI_DFS_PHYERR_EVENT(wmip->wmi_devt, ev); - return A_OK; -} - -static A_STATUS -wmi_dfs_set_dur_multiplier_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - A_UINT32 *ev; - if (len < sizeof(A_UINT32)) { - return A_EINVAL; - } - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - ev = (A_UINT32 *)datap; - - A_WMI_DFS_SET_DUR_MULTIPLIER_EVENT(wmip->wmi_devt, *ev); - return A_OK; -} - -static A_STATUS -wmi_dfs_set_bangradar_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - A_UINT32 *ev; - if (len < sizeof(A_UINT32)) { - return A_EINVAL; - } - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - ev = (A_UINT32 *)datap; - - A_WMI_DFS_SET_BANGRADAR_EVENT(wmip->wmi_devt, *ev); - return A_OK; -} - - -static A_STATUS -wmi_dfs_set_debuglevel_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - A_UINT32 *ev; - if (len < sizeof(A_UINT32)) { - return A_EINVAL; - } - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - ev = (A_UINT32 *)datap; - - A_WMI_DFS_SET_DEBUGLEVEL_EVENT(wmip->wmi_devt, *ev); - return A_OK; -} - -static A_STATUS -wmi_dfs_reset_delaylines_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_DFS_RESET_DELAYLINES_EVENT(wmip->wmi_devt); - return A_OK; -} - -static A_STATUS -wmi_dfs_reset_radarq_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_DFS_RESET_RADARQ_EVENT(wmip->wmi_devt); - return A_OK; -} - -static A_STATUS -wmi_dfs_reset_ar_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_DFS_RESET_AR_EVENT(wmip->wmi_devt); - return A_OK; -} - -static A_STATUS -wmi_dfs_reset_arq_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_DFS_RESET_ARQ_EVENT(wmip->wmi_devt); - return A_OK; -} - -A_STATUS -wmi_set_dfs_minrssithresh_cmd(struct wmi_t *wmip, A_INT32 rssi) -{ - void *osbuf; - A_INT32 *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (A_INT32 *)(A_NETBUF_DATA(osbuf)); - *cmd = rssi; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_DFS_MINRSSITHRESH_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_dfs_maxpulsedur_cmd(struct wmi_t *wmip, A_UINT32 value) -{ - void *osbuf; - A_INT32 *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (A_UINT32 *)(A_NETBUF_DATA(osbuf)); - *cmd = value; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_DFS_MAXPULSEDUR_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_radarDetected_cmd(struct wmi_t *wmip, A_INT16 chan_index, A_INT8 bang_radar) -{ - void *osbuf; - WMI_RADAR_DETECTED_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_RADAR_DETECTED_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->chan_index = chan_index; - cmd->bang_radar = bang_radar; - - status = wmi_cmd_send(wmip, osbuf, WMI_DFS_RADAR_DETECTED_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -/* - * IOCTL: AR6000_XIOCTL_AP_SET_DFS - * - * This command is used to enable/disable DFS before the device is up - * */ -A_STATUS -wmi_ap_set_dfs(struct wmi_t *wmip, A_UINT8 enable) -{ - void *osbuf; - WMI_SET_DFS_CMD *dfs; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_SET_DFS_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_SET_DFS_CMD)); - dfs = (WMI_SET_DFS_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(dfs, sizeof(*dfs)); - - dfs->enable = enable; - - A_DPRINTF(DBG_WMI, (DBGFMT "AR6000_XIOCTL_AP_SET_DFS %d\n", DBGARG , enable)); - status = wmi_cmd_send(wmip, osbuf, WMI_SET_DFS_ENABLE_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -#endif /* ATH_SUPPORT_DFS */ - -static A_STATUS -wmi_peer_node_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_PEER_NODE_EVENT *ev; - - if (len < sizeof(WMI_PEER_NODE_EVENT)) { - return A_EINVAL; - } - ev = (WMI_PEER_NODE_EVENT *)datap; - if (ev->eventCode == PEER_NODE_JOIN_EVENT) { - A_DPRINTF (DBG_WMI, (DBGFMT "Joined node with Macaddr: ", DBGARG)); - } else if(ev->eventCode == PEER_NODE_LEAVE_EVENT) { - A_DPRINTF (DBG_WMI, (DBGFMT "left node with Macaddr: ", DBGARG)); - } - - A_WMI_PEER_EVENT (wmip->wmi_devt, ev->eventCode, ev->peerMacAddr); - - return A_OK; -} - -static A_STATUS -wmi_tkip_micerr_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_TKIP_MICERR_EVENT *ev; - - if (len < sizeof(*ev)) { - return A_EINVAL; - } - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - ev = (WMI_TKIP_MICERR_EVENT *)datap; - A_WMI_TKIP_MICERR_EVENT(wmip->wmi_devt, ev->keyid, ev->ismcast); - - return A_OK; -} - -static A_STATUS -wmi_bssInfo_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - bss_t *bss = NULL; - WMI_BSS_INFO_HDR *bih; - A_UINT8 *buf; - A_UINT32 nodeCachingAllowed = 1; - A_UCHAR cached_ssid_len = 0; - A_UCHAR cached_ssid_buf[IEEE80211_NWID_LEN] = {0}; - A_UINT8 beacon_ssid_len = 0; - A_UINT8 newNode=0; - A_STATUS status = A_OK; - -#ifdef P2P - NETWORK_SUBTYPE networkSubType; -#endif /* P2P */ - - - if (len <= sizeof(WMI_BSS_INFO_HDR)) { - return A_EINVAL; - } - - bih = (WMI_BSS_INFO_HDR *)datap; - bss = wlan_find_node(&wmip->wmi_scan_table, bih->bssid); - - if (bih->rssi > 0) { - if (NULL == bss) - return A_OK; //no node found in the table, just drop the node with incorrect RSSI - else - bih->rssi = bss->ni_rssi; //Adjust RSSI in datap in case it is used in A_WMI_BSSINFO_EVENT_RX - } - - A_WMI_BSSINFO_EVENT_RX(wmip->wmi_devt, datap, len); - /* What is driver config for wlan node caching? */ - if(ar6000_get_driver_cfg(wmip->wmi_devt, - AR6000_DRIVER_CFG_GET_WLANNODECACHING, - &nodeCachingAllowed) != A_OK) { - status = A_EINVAL; - goto err_exit; - } - - if(!nodeCachingAllowed) { - status = A_OK; - goto err_exit; - } - - buf = datap + sizeof(WMI_BSS_INFO_HDR); - len -= sizeof(WMI_BSS_INFO_HDR); - if(bih->frameType == PROBERESP_FTYPE) - { - A_WMI_PROBERESP_RECV_EVENT(wmip->wmi_devt,buf,len,bih->bssid); - } - else if(bih->frameType == BEACON_FTYPE) - { - A_WMI_BEACON_RECV_EVENT(wmip->wmi_devt,buf,len,bih->bssid); - } - - A_DPRINTF(DBG_WMI2, (DBGFMT "bssInfo event - ch %u, rssi %02x, " - "bssid \"%02x:%02x:%02x:%02x:%02x:%02x\"\n", DBGARG, - bih->channel, (unsigned char) bih->rssi, bih->bssid[0], - bih->bssid[1], bih->bssid[2], bih->bssid[3], bih->bssid[4], - bih->bssid[5])); - - if(wps_enable && (bih->frameType == PROBERESP_FTYPE) ) { - status = A_OK; - goto err_exit; - } - - if (bss != NULL) { -#ifdef P2P - /* In the case of P2P device, BSS_INFO_EVENTS are generated not only for - * beacons/Probe-Resps but also P2P ACTION frames like GO-Neg-Req/ - * Invitation/Provisional-Discovery & Probe-Req frames. A existence of - * a peer device can be discovered from any of the above mentioned - * frames. But the primary means of gathering peer device information is - * a beacon/probe-resp. Other means are used when a beacon/Probe-resp - * is not got from that device or when we receive other frames (action) - * from that device even before we started scanning & discovered - * that device. - * If a probe resp/beacon is received from a peer, always update the - * device info from this buffer. - * If the peer device is already discovered by means of a probe-resp - * when we receive a GO-NEG-REQ or Invitation or Prov-disc frame from - * the same peer, do not update the buffer or the device info. - * If the peer is discovered by a Probe-Req. & we receive a - * beacon/probe-resp, Action frame, update the device info. - * If the peer is discovered by an Action frame & when we receive an - * Action frame, do not update the device info. - */ - - /* The WLAN Node table would be organized as below : - * The Node entries can be of the following types: - * 1. Due to a beacon/Probe-resp from a legacy Infrastructure AP. - * 2. Due to a Probe-resp from a p2p-device. - * 3. Due to a beacon/Probe-resp from a p2p-go. - * 4. Due to a client info descriptor in the group info element in the probe-resp from p2p-go. - * 5. Due to a P2P ACTION frame (GO-Neg-Req, Invitation, Prov-Disc-Req.) - * 6. Due to a Probe Req from a p2p-dev. - * In case 1) the WLAN Node key is the BSSID of the Infra AP. - * In case 2) the WLAN Node key is the device addr of the p2p-dev. - * In case 3) the WLAN Node key is the interface addr of the p2p-go. - * In case 4) the beacon/Probe-resp from the p2p-go can contain - * a P2P Group Info element in which case it will one Node entry added for each client info - * descriptor in the GroupInfo element of the probe-resp. In this case the Node key is the - * device addr of the p2p-client. - * In case 5) & 6), the WLAN Node key is the device addr of the p2p-dev. - */ - if ((bss->p2p_dev) && (bss->ni_frametype == BEACON_FTYPE || - bss->ni_frametype == PROBERESP_FTYPE || - bss->ni_frametype == ACTION_MGMT_FTYPE)) { - if ((bih->frameType == ACTION_MGMT_FTYPE || - bih->frameType == PROBEREQ_FTYPE)) { - /* Do not update the ni_buf in the node or update the device info. Just update the node - * timestamp. - */ - wmi_node_update_timestamp(wmip, bss); - status = A_OK; - goto err_exit; - } - } -#endif /* P2P */ - - /* Legacy Way - This is no longer valid. Retaining the comment to know - * the history. Now we do not reclaim the entire node. We only update - * the ni_buf. - * Free up the node. Not the most efficient process given - * we are about to allocate a new node but it is simple and should be - * adequate. - */ - /* In case of hidden AP, beacon will not have ssid, - * but a directed probe response will have it, - * so cache the probe-resp-ssid if already present. */ - if (((TRUE == is_probe_ssid) || IEEE80211_ADDR_EQ (wmip->wmi_bssid, bih->bssid)) && - ((BEACON_FTYPE == bih->frameType) || PROBERESP_FTYPE == bih->frameType)) - { - A_UCHAR *ie_ssid; - - ie_ssid = bss->ni_cie.ie_ssid; - if(ie_ssid && (ie_ssid[1] <= IEEE80211_NWID_LEN) && (ie_ssid[2] != 0)) - { - cached_ssid_len = ie_ssid[1]; - if (cached_ssid_len) - { - memcpy(cached_ssid_buf, ie_ssid + 2, cached_ssid_len); - } - } - } - - /* - * Use the current average rssi of associated AP base on assumpiton - * 1. Most os with GUI will update RSSI by wmi_get_stats_cmd() periodically - * 2. wmi_get_stats_cmd(..) will be called when calling wmi_startscan_cmd(...) - * The average value of RSSI give end-user better feeling for instance value of scan result - * It also sync up RSSI info in GUI between scan result and RSSI signal icon - */ - if (bss && IEEE80211_ADDR_EQ (wmip->wmi_bssid, bih->bssid)) { - bih->rssi = bss->ni_rssi; - bih->snr = bss->ni_snr; - } - - bih->rssi = RSSI_AVE(bss->ni_rssi, bih->rssi, 13); - bih->snr = RSSI_AVE(bss->ni_snr, bih->snr, 13); - - - /* beacon/probe response frame format - * [8] time stamp - * [2] beacon interval - * [2] capability information - * [tlv] ssid */ - beacon_ssid_len = buf[SSID_IE_LEN_INDEX]; - - /* If ssid is cached for this hidden AP, then change buffer len accordingly. */ - if (((TRUE == is_probe_ssid) || IEEE80211_ADDR_EQ (wmip->wmi_bssid, bih->bssid)) && - ((BEACON_FTYPE == bih->frameType) || (PROBERESP_FTYPE == bih->frameType)) && - (0 != cached_ssid_len) && - (0 == beacon_ssid_len || (cached_ssid_len > beacon_ssid_len && 0 == buf[SSID_IE_LEN_INDEX + 1]))) - { - len += (cached_ssid_len - beacon_ssid_len); - } - - /* - * Some APs, like TP-LINK, will report a RSN with zero unicast cipher suites in probe resp. - * Do not update the ni_buf if buf is invalid. It also handles other invalid IEs - */ - if (bih->frameType == PROBERESP_FTYPE) { - struct ieee80211_common_ie cie; - if (wlan_parse_beacon(buf, len, &cie)!=A_OK) { - wmi_node_update_timestamp(wmip, bss); - status = A_OK; - goto err_exit; - } - } - - /* Free up just the ni_buf from the node. Not the entire Node as done - * before. The previous method of reclaiming the entire node even for - * updates leads to frequent node reclaims/allocs in the case of P2P. - */ - - if (wlan_node_buf_update(&wmip->wmi_scan_table, bss, len) != A_OK) { - status = A_NO_MEMORY; - goto err_exit; - } - } else { -#ifdef P2P - /* If this bss_info_ev is for a p2p-client that is part of a P2P group, - * then its dev-addr wont be found in the WLAN node table. But this dev will - * be in the p2p-dev list. This will be part of the p2p-clients in the list - * that hangs from the WLAN Node that has the interface-addr of the p2p-go - * as its key. If this is the case, do not update the p2p-dev info from - * this frame if this is a ACTION or Probe-req frame. The p2p-dev info - * will be updated only from the probe-resp from its p2p-go. - */ - /*networkSubType = A_WMI_GET_DEV_NETWORK_SUBTYPE(wmip->wmi_devt); - if (networkSubType == SUBTYPE_P2PDEV || - networkSubType == SUBTYPE_P2PCLIENT || - networkSubType == SUBTYPE_P2PGO) { - if (p2p_get_device(A_WMI_GET_P2P_CTX(wmip->wmi_devt), - bih->bssid) != NULL) { - if ((bih->frameType == ACTION_MGMT_FTYPE || - bih->frameType == PROBEREQ_FTYPE)) { - status = A_OK; - goto err_exit; - } - } - }*/ -#endif /* P2P */ - - bss = wlan_node_alloc(&wmip->wmi_scan_table, len); - - if (bss == NULL) { - return A_NO_MEMORY; - } - - newNode = 1; - } - - bss->ni_frametype = bih->frameType; - bss->ni_snr = bih->snr; - bss->ni_rssi = bih->rssi; - A_ASSERT(bss->ni_buf != NULL); - - /* In case of hidden AP, beacon will not have ssid, - * but a directed probe response will have it, - * so place the cached-ssid(probe-resp) in the bssinfo. */ - if (((TRUE == is_probe_ssid) || IEEE80211_ADDR_EQ (wmip->wmi_bssid, bih->bssid)) && - ((BEACON_FTYPE == bih->frameType) || (PROBERESP_FTYPE == bih->frameType))&& - (0 != cached_ssid_len) && - (0 == beacon_ssid_len || (beacon_ssid_len && 0 == buf[SSID_IE_LEN_INDEX + 1]))) - { - A_UINT8 *ni_buf = bss->ni_buf; - int buf_len = len; - - /* copy the first 14 bytes such as - * time-stamp(8), beacon-interval(2), cap-info(2), ssid-id(1), ssid-len(1). */ - A_MEMCPY(ni_buf, buf, SSID_IE_LEN_INDEX + 1); - - ni_buf[SSID_IE_LEN_INDEX] = cached_ssid_len; - ni_buf += (SSID_IE_LEN_INDEX + 1); - - buf += (SSID_IE_LEN_INDEX + 1); - buf_len -= (SSID_IE_LEN_INDEX + 1); - - /* copy the cached ssid */ - A_MEMCPY(ni_buf, cached_ssid_buf, cached_ssid_len); - ni_buf += cached_ssid_len; - - buf += beacon_ssid_len; - buf_len -= beacon_ssid_len; - - if (cached_ssid_len > beacon_ssid_len) - buf_len -= (cached_ssid_len - beacon_ssid_len); - - if (buf_len) - { - /* now copy the rest of bytes */ - A_MEMCPY(ni_buf, buf, buf_len); - } - } - else - { - if (len) - { - A_MEMCPY(bss->ni_buf, buf, len); - } - } - - bss->ni_framelen = len; - - - if ((bih->frameType == BEACON_FTYPE || bih->frameType == PROBERESP_FTYPE) && - wlan_parse_beacon(bss->ni_buf, len, &bss->ni_cie) != A_OK) { - status = A_EINVAL; - goto err_exit; - } - -#ifdef P2P - /* If this device is in P2P submode, parse P2P IEs if any. - * BSSINFO_EVENT from p2p module in firmware can be generated for - * GO NEG REQ frame/INVITATION frame or probe req frame in addition to - * beacon/Probe resp frames. Pass these frames - * to the p2p module for parsing & creating a device entry - * if P2P IE is present in them. - */ - networkSubType = A_WMI_GET_DEV_NETWORK_SUBTYPE(wmip->wmi_devt); - if (networkSubType == SUBTYPE_P2PDEV || networkSubType == SUBTYPE_P2PCLIENT - || networkSubType == SUBTYPE_P2PGO) { - - if (bss->p2p_dev != NULL) { - /* A p2p-dev instance is already present in the p2p module. This - * BSS info event will just update it. - */ - p2p_bssinfo_rx(A_WMI_GET_P2P_CTX(wmip->wmi_devt), - bih->frameType, bih->bssid, bih->channel, bss->ni_buf, len); - } else { - /* A new BSS node entry is getting added. This node may get a ref. - * to an already existing p2p-dev instance or may create a new one. - * Increment its reference count here. - */ - bss->p2p_dev = p2p_bssinfo_rx(A_WMI_GET_P2P_CTX(wmip->wmi_devt), - bih->frameType, bih->bssid, bih->channel, bss->ni_buf, len); - if (bss->p2p_dev) { - p2p_increment_dev_ref_count(bss->p2p_dev); - } - } - } -#endif /* P2P */ - - - /* - * Update the frequency in ie_chan, overwriting of channel number - * which is done in wlan_parse_beacon - */ - bss->ni_cie.ie_chan = bih->channel; - - /* If the Node was updated, release the ref. count acquired by wlan_find_node() in the - * beginning. - */ -err_exit: - if (newNode) { - if (status == A_OK) { - wlan_setup_node(&wmip->wmi_scan_table, bss, bih->bssid); - } else if (bss) { - wlan_node_free(bss); - } - } else { - wmi_node_return(wmip, bss); - } - - return status; -} - -static A_STATUS -wmi_opt_frame_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - bss_t *bss; - WMI_OPT_RX_INFO_HDR *bih; - A_UINT8 *buf; - - if (len <= sizeof(WMI_OPT_RX_INFO_HDR)) { - return A_EINVAL; - } - - bih = (WMI_OPT_RX_INFO_HDR *)datap; - buf = datap + sizeof(WMI_OPT_RX_INFO_HDR); - len -= sizeof(WMI_OPT_RX_INFO_HDR); - - A_DPRINTF(DBG_WMI2, (DBGFMT "opt frame event %2.2x:%2.2x\n", DBGARG, - bih->bssid[4], bih->bssid[5])); - - bss = wlan_find_node(&wmip->wmi_scan_table, bih->bssid); - if (bss != NULL) { - /* - * Free up the node. Not the most efficient process given - * we are about to allocate a new node but it is simple and should be - * adequate. - */ - wlan_node_reclaim(&wmip->wmi_scan_table, bss); - } - - bss = wlan_node_alloc(&wmip->wmi_scan_table, len); - if (bss == NULL) { - return A_NO_MEMORY; - } - - bss->ni_snr = bih->snr; - bss->ni_cie.ie_chan = bih->channel; - A_ASSERT(bss->ni_buf != NULL); - - if (len) - { - A_MEMCPY(bss->ni_buf, buf, len); - } - - wlan_setup_node(&wmip->wmi_scan_table, bss, bih->bssid); - - return A_OK; -} - - /* This event indicates inactivity timeout of a fatpipe(pstream) - * at the target - */ -static A_STATUS -wmi_pstream_timeout_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_PSTREAM_TIMEOUT_EVENT *ev; - - if (len < sizeof(WMI_PSTREAM_TIMEOUT_EVENT)) { - return A_EINVAL; - } - - A_DPRINTF(DBG_WMI, (DBGFMT "wmi_pstream_timeout_event_rx\n", DBGARG)); - - ev = (WMI_PSTREAM_TIMEOUT_EVENT *)datap; - - /* When the pstream (fat pipe == AC) timesout, it means there were no - * thinStreams within this pstream & it got implicitly created due to - * data flow on this AC. We start the inactivity timer only for - * implicitly created pstream. Just reset the host state. - */ - /* Set the activeTsids for this AC to 0 */ - LOCK_WMI(pWmiPriv); - pWmiPriv->wmi_streamExistsForAC[ev->trafficClass]=0; - pWmiPriv->wmi_fatPipeExists &= ~(1 << ev->trafficClass); - UNLOCK_WMI(pWmiPriv); - - /*Indicate inactivity to driver layer for this fatpipe (pstream)*/ - A_WMI_STREAM_TX_INACTIVE(wmip->wmi_devt, ev->trafficClass); - - return A_OK; -} - -static A_STATUS -wmi_bitrate_reply_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_BIT_RATE_REPLY *reply; - A_INT32 rate; - A_UINT32 sgi,index; - /* 54149: - * WMI_BIT_RATE_CMD structure is changed to WMI_BIT_RATE_REPLY. - * since there is difference in the length and to avoid returning - * error value. - */ - if (len < sizeof(WMI_BIT_RATE_REPLY)) { - return A_EINVAL; - } - reply = (WMI_BIT_RATE_REPLY *)datap; - A_DPRINTF(DBG_WMI, - (DBGFMT "Enter - rateindex %d\n", DBGARG, reply->rateIndex)); - - if (reply->rateIndex == (A_INT8) RATE_AUTO) { - rate = RATE_AUTO; - } else { - // the SGI state is stored as the MSb of the rateIndex - index = reply->rateIndex & 0x7f; - sgi = (reply->rateIndex & 0x80)? 1:0; - rate = wmi_rateTable[index][sgi]; - } - - A_WMI_BITRATE_RX(wmip->wmi_devt, rate); - return A_OK; -} - -static A_STATUS -wmi_ratemask_reply_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_FIX_RATES_REPLY *reply; - - if (len < sizeof(WMI_FIX_RATES_REPLY)) { - return A_EINVAL; - } - reply = (WMI_FIX_RATES_REPLY *)datap; - A_DPRINTF(DBG_WMI, - (DBGFMT "Enter - fixed rate mask %04x%04x\n", DBGARG, reply->fixRateMask[0], reply->fixRateMask[1])); - - A_WMI_RATEMASK_RX(wmip->wmi_devt, reply->fixRateMask); - - return A_OK; -} - -static A_STATUS -wmi_channelList_reply_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_CHANNEL_LIST_REPLY *reply; - - if (len < sizeof(WMI_CHANNEL_LIST_REPLY)) { - return A_EINVAL; - } - reply = (WMI_CHANNEL_LIST_REPLY *)datap; - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_CHANNELLIST_RX(wmip->wmi_devt, reply->numChannels, - reply->channelList); - - return A_OK; -} - -static A_STATUS -wmi_txPwr_reply_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_TX_PWR_REPLY *reply; - - if (len < sizeof(*reply)) { - return A_EINVAL; - } - reply = (WMI_TX_PWR_REPLY *)datap; - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_TXPWR_RX(wmip->wmi_devt, reply->dbM); - - return A_OK; -} -static A_STATUS -wmi_keepalive_reply_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_GET_KEEPALIVE_CMD *reply; - - if (len < sizeof(*reply)) { - return A_EINVAL; - } - reply = (WMI_GET_KEEPALIVE_CMD *)datap; - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_KEEPALIVE_RX(wmip->wmi_devt, reply->configured); - - return A_OK; -} - - -static A_STATUS -wmi_dset_open_req_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMIX_DSETOPENREQ_EVENT *dsetopenreq; - - if (len < sizeof(WMIX_DSETOPENREQ_EVENT)) { - return A_EINVAL; - } - dsetopenreq = (WMIX_DSETOPENREQ_EVENT *)datap; - A_DPRINTF(DBG_WMI, - (DBGFMT "Enter - dset_id=0x%x\n", DBGARG, dsetopenreq->dset_id)); - A_WMI_DSET_OPEN_REQ(wmip->wmi_devt, - dsetopenreq->dset_id, - dsetopenreq->targ_dset_handle, - dsetopenreq->targ_reply_fn, - dsetopenreq->targ_reply_arg); - - return A_OK; -} - -#ifdef CONFIG_HOST_DSET_SUPPORT -static A_STATUS -wmi_dset_close_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMIX_DSETCLOSE_EVENT *dsetclose; - - if (len < sizeof(WMIX_DSETCLOSE_EVENT)) { - return A_EINVAL; - } - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - dsetclose = (WMIX_DSETCLOSE_EVENT *)datap; - A_WMI_DSET_CLOSE(wmip->wmi_devt, dsetclose->access_cookie); - - return A_OK; -} - -static A_STATUS -wmi_dset_data_req_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMIX_DSETDATAREQ_EVENT *dsetdatareq; - - if (len < sizeof(WMIX_DSETDATAREQ_EVENT)) { - return A_EINVAL; - } - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - dsetdatareq = (WMIX_DSETDATAREQ_EVENT *)datap; - A_WMI_DSET_DATA_REQ(wmip->wmi_devt, - dsetdatareq->access_cookie, - dsetdatareq->offset, - dsetdatareq->length, - dsetdatareq->targ_buf, - dsetdatareq->targ_reply_fn, - dsetdatareq->targ_reply_arg); - - return A_OK; -} -#endif /* CONFIG_HOST_DSET_SUPPORT */ - -static A_STATUS -wmi_scanComplete_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_SCAN_COMPLETE_EVENT *ev; - - ev = (WMI_SCAN_COMPLETE_EVENT *)datap; - if ((A_STATUS)ev->status == A_OK) { - wlan_refresh_inactive_nodes(&wmip->wmi_scan_table); - } - A_WMI_SCANCOMPLETE_EVENT(wmip->wmi_devt, (A_STATUS) ev->status); - //is_probe_ssid = FALSE; - - return A_OK; -} - -/* - * Target is reporting a programming error. This is for - * developer aid only. Target only checks a few common violations - * and it is responsibility of host to do all error checking. - * Behavior of target after wmi error event is undefined. - * A reset is recommended. - */ -static A_STATUS -wmi_errorEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_CMD_ERROR_EVENT *ev; - - ev = (WMI_CMD_ERROR_EVENT *)datap; - AR_DEBUG_PRINTF(ATH_DEBUG_WMI, ("Programming Error: cmd=%d Interface id: %d", - ev->commandId, wmip->wmi_dev_index)); - switch (ev->errorCode) { - case (INVALID_PARAM): - AR_DEBUG_PRINTF(ATH_DEBUG_WMI, ("Illegal Parameter\n")); - break; - case (ILLEGAL_STATE): - AR_DEBUG_PRINTF(ATH_DEBUG_WMI, ("Illegal State\n")); - break; - case (INTERNAL_ERROR): - AR_DEBUG_PRINTF(ATH_DEBUG_WMI, ("Internal Error\n")); - break; - } - - return A_OK; -} - - -static A_STATUS -wmi_statsEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_TARGETSTATS_EVENT(wmip->wmi_devt, datap, len); - - return A_OK; -} - -static A_STATUS -wmi_rssiThresholdEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_RSSI_THRESHOLD_EVENT *reply; - WMI_RSSI_THRESHOLD_VAL newThreshold; - WMI_RSSI_THRESHOLD_PARAMS_CMD cmd; - SQ_THRESHOLD_PARAMS *sq_thresh = - &wmip->wmi_SqThresholdParams[SIGNAL_QUALITY_METRICS_RSSI]; - A_UINT8 upper_rssi_threshold, lower_rssi_threshold; - A_INT16 rssi; - - if (len < sizeof(*reply)) { - return A_EINVAL; - } - reply = (WMI_RSSI_THRESHOLD_EVENT *)datap; - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - newThreshold = (WMI_RSSI_THRESHOLD_VAL) reply->range; - rssi = reply->rssi; - - /* - * Identify the threshold breached and communicate that to the app. After - * that install a new set of thresholds based on the signal quality - * reported by the target - */ - if (newThreshold) { - /* Upper threshold breached */ - if (rssi < sq_thresh->upper_threshold[0]) { - A_DPRINTF(DBG_WMI, (DBGFMT "Spurious upper RSSI threshold event: " - " %d\n", DBGARG, rssi)); - } else if ((rssi < sq_thresh->upper_threshold[1]) && - (rssi >= sq_thresh->upper_threshold[0])) - { - newThreshold = WMI_RSSI_THRESHOLD1_ABOVE; - } else if ((rssi < sq_thresh->upper_threshold[2]) && - (rssi >= sq_thresh->upper_threshold[1])) - { - newThreshold = WMI_RSSI_THRESHOLD2_ABOVE; - } else if ((rssi < sq_thresh->upper_threshold[3]) && - (rssi >= sq_thresh->upper_threshold[2])) - { - newThreshold = WMI_RSSI_THRESHOLD3_ABOVE; - } else if ((rssi < sq_thresh->upper_threshold[4]) && - (rssi >= sq_thresh->upper_threshold[3])) - { - newThreshold = WMI_RSSI_THRESHOLD4_ABOVE; - } else if ((rssi < sq_thresh->upper_threshold[5]) && - (rssi >= sq_thresh->upper_threshold[4])) - { - newThreshold = WMI_RSSI_THRESHOLD5_ABOVE; - } else if (rssi >= sq_thresh->upper_threshold[5]) { - newThreshold = WMI_RSSI_THRESHOLD6_ABOVE; - } - } else { - /* Lower threshold breached */ - if (rssi > sq_thresh->lower_threshold[0]) { - A_DPRINTF(DBG_WMI, (DBGFMT "Spurious lower RSSI threshold event: " - "%d %d\n", DBGARG, rssi, sq_thresh->lower_threshold[0])); - } else if ((rssi > sq_thresh->lower_threshold[1]) && - (rssi <= sq_thresh->lower_threshold[0])) - { - newThreshold = WMI_RSSI_THRESHOLD6_BELOW; - } else if ((rssi > sq_thresh->lower_threshold[2]) && - (rssi <= sq_thresh->lower_threshold[1])) - { - newThreshold = WMI_RSSI_THRESHOLD5_BELOW; - } else if ((rssi > sq_thresh->lower_threshold[3]) && - (rssi <= sq_thresh->lower_threshold[2])) - { - newThreshold = WMI_RSSI_THRESHOLD4_BELOW; - } else if ((rssi > sq_thresh->lower_threshold[4]) && - (rssi <= sq_thresh->lower_threshold[3])) - { - newThreshold = WMI_RSSI_THRESHOLD3_BELOW; - } else if ((rssi > sq_thresh->lower_threshold[5]) && - (rssi <= sq_thresh->lower_threshold[4])) - { - newThreshold = WMI_RSSI_THRESHOLD2_BELOW; - } else if (rssi <= sq_thresh->lower_threshold[5]) { - newThreshold = WMI_RSSI_THRESHOLD1_BELOW; - } - } - /* Calculate and install the next set of thresholds */ - lower_rssi_threshold = ar6000_get_lower_threshold(rssi, sq_thresh, - sq_thresh->lower_threshold_valid_count); - upper_rssi_threshold = ar6000_get_upper_threshold(rssi, sq_thresh, - sq_thresh->upper_threshold_valid_count); - /* Issue a wmi command to install the thresholds */ - cmd.thresholdAbove1_Val = upper_rssi_threshold; - cmd.thresholdBelow1_Val = lower_rssi_threshold; - cmd.weight = sq_thresh->weight; - cmd.pollTime = sq_thresh->polling_interval; - - rssi_event_value = rssi; - - if (wmi_send_rssi_threshold_params(wmip, &cmd) != A_OK) { - A_DPRINTF(DBG_WMI, (DBGFMT "Unable to configure the RSSI thresholds\n", - DBGARG)); - } - - A_WMI_RSSI_THRESHOLD_EVENT(wmip->wmi_devt, newThreshold, reply->rssi); - - return A_OK; -} - - -static A_STATUS -wmi_reportErrorEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_TARGET_ERROR_REPORT_EVENT *reply; - - if (len < sizeof(*reply)) { - return A_EINVAL; - } - reply = (WMI_TARGET_ERROR_REPORT_EVENT *)datap; - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_REPORT_ERROR_EVENT(wmip->wmi_devt, (WMI_TARGET_ERROR_VAL) reply->errorVal); - - return A_OK; -} - -static A_STATUS -wmi_cac_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_CAC_EVENT *reply; - WMM_TSPEC_IE *tspec_ie; - A_UINT16 activeTsids; - - if (len < sizeof(*reply)) { - return A_EINVAL; - } - reply = (WMI_CAC_EVENT *)datap; - - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - if ((reply->cac_indication == CAC_INDICATION_ADMISSION_RESP) && - (reply->statusCode != TSPEC_STATUS_CODE_ADMISSION_ACCEPTED)) { - tspec_ie = (WMM_TSPEC_IE *) &(reply->tspecSuggestion); - - wmi_delete_pstream_cmd(wmip, reply->ac, - (tspec_ie->tsInfo_info >> TSPEC_TSID_S) & TSPEC_TSID_MASK); - } - else if (reply->cac_indication == CAC_INDICATION_NO_RESP) { - A_UINT16 activeTsids; - A_UINT8 i; - - /* following assumes that there is only one outstanding ADDTS request - when this event is received */ - LOCK_WMI(pWmiPriv); - activeTsids = pWmiPriv->wmi_streamExistsForAC[reply->ac]; - UNLOCK_WMI(pWmiPriv); - - for (i = 0; i < sizeof(activeTsids) * 8; i++) { - if ((activeTsids >> i) & 1) { - break; - } - } - if (i < (sizeof(activeTsids) * 8)) { - wmi_delete_pstream_cmd(wmip, reply->ac, i); - } - } - /* - * Ev#72990: Clear active tsids and Add missing handling - * for delete qos stream from AP - */ - else if (reply->cac_indication == CAC_INDICATION_DELETE) { - A_UINT8 tsid = 0; - A_UINT8 tsidActive; - - tspec_ie = (WMM_TSPEC_IE *) &(reply->tspecSuggestion); - tsid= ((tspec_ie->tsInfo_info >> TSPEC_TSID_S) & TSPEC_TSID_MASK); - LOCK_WMI(pWmiPriv); - tsidActive = (pWmiPriv->wmi_streamExistsForAC[reply->ac] & (1<wmi_streamExistsForAC[reply->ac] &= ~(1<wmi_streamExistsForAC[reply->ac]; - UNLOCK_WMI(pWmiPriv); - - /* Indicate stream inactivity to driver layer only if all tsids - * within this AC are deleted. - */ - if ((!activeTsids) && (tsidActive)) { - A_WMI_STREAM_TX_INACTIVE(wmip->wmi_devt, reply->ac); - pWmiPriv->wmi_fatPipeExists &= ~(1 << reply->ac); - } - } - A_WMI_CAC_EVENT(wmip->wmi_devt, reply->ac, - reply->cac_indication, reply->statusCode, - reply->tspecSuggestion); - - return A_OK; -} - -static A_STATUS -wmi_channel_change_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_CHANNEL_CHANGE_EVENT *reply; - - if (len < sizeof(*reply)) { - return A_EINVAL; - } - reply = (WMI_CHANNEL_CHANGE_EVENT *)datap; - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_CHANNEL_CHANGE_EVENT(wmip->wmi_devt, reply->oldChannel, - reply->newChannel); - - return A_OK; -} - -static A_STATUS -wmi_hbChallengeResp_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMIX_HB_CHALLENGE_RESP_EVENT *reply; - - if (len < sizeof(*reply)) { - return A_EINVAL; - } - reply = (WMIX_HB_CHALLENGE_RESP_EVENT *)datap; - A_DPRINTF(DBG_WMI, (DBGFMT "wmi: challenge response event\n", DBGARG)); - - A_WMI_HBCHALLENGERESP_EVENT(wmip->wmi_devt, reply->cookie, reply->source); - - return A_OK; -} - -static A_STATUS -wmi_roam_tbl_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_TARGET_ROAM_TBL *reply; - - if (len < sizeof(*reply)) { - return A_EINVAL; - } - reply = (WMI_TARGET_ROAM_TBL *)datap; - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_ROAM_TABLE_EVENT(wmip->wmi_devt, reply); - - return A_OK; -} - -static A_STATUS -wmi_roam_data_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_TARGET_ROAM_DATA *reply; - - if (len < sizeof(*reply)) { - return A_EINVAL; - } - reply = (WMI_TARGET_ROAM_DATA *)datap; - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_ROAM_DATA_EVENT(wmip->wmi_devt, reply); - - return A_OK; -} - -static A_STATUS -wmi_txRetryErrEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - if (len < sizeof(WMI_TX_RETRY_ERR_EVENT)) { - return A_EINVAL; - } - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_TX_RETRY_ERR_EVENT(wmip->wmi_devt); - - return A_OK; -} - -static A_STATUS -wmi_snrThresholdEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_SNR_THRESHOLD_EVENT *reply; - SQ_THRESHOLD_PARAMS *sq_thresh = - &wmip->wmi_SqThresholdParams[SIGNAL_QUALITY_METRICS_SNR]; - WMI_SNR_THRESHOLD_VAL newThreshold; - WMI_SNR_THRESHOLD_PARAMS_CMD cmd; - A_UINT8 upper_snr_threshold, lower_snr_threshold; - A_INT16 snr; - - if (len < sizeof(*reply)) { - return A_EINVAL; - } - reply = (WMI_SNR_THRESHOLD_EVENT *)datap; - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - newThreshold = (WMI_SNR_THRESHOLD_VAL) reply->range; - snr = reply->snr; - /* - * Identify the threshold breached and communicate that to the app. After - * that install a new set of thresholds based on the signal quality - * reported by the target - */ - if (newThreshold) { - /* Upper threshold breached */ - if (snr < sq_thresh->upper_threshold[0]) { - A_DPRINTF(DBG_WMI, (DBGFMT "Spurious upper SNR threshold event: " - "%d\n", DBGARG, snr)); - } else if ((snr < sq_thresh->upper_threshold[1]) && - (snr >= sq_thresh->upper_threshold[0])) - { - newThreshold = WMI_SNR_THRESHOLD1_ABOVE; - } else if ((snr < sq_thresh->upper_threshold[2]) && - (snr >= sq_thresh->upper_threshold[1])) - { - newThreshold = WMI_SNR_THRESHOLD2_ABOVE; - } else if ((snr < sq_thresh->upper_threshold[3]) && - (snr >= sq_thresh->upper_threshold[2])) - { - newThreshold = WMI_SNR_THRESHOLD3_ABOVE; - } else if (snr >= sq_thresh->upper_threshold[3]) { - newThreshold = WMI_SNR_THRESHOLD4_ABOVE; - } - } else { - /* Lower threshold breached */ - if (snr > sq_thresh->lower_threshold[0]) { - A_DPRINTF(DBG_WMI, (DBGFMT "Spurious lower SNR threshold event: " - "%d %d\n", DBGARG, snr, sq_thresh->lower_threshold[0])); - } else if ((snr > sq_thresh->lower_threshold[1]) && - (snr <= sq_thresh->lower_threshold[0])) - { - newThreshold = WMI_SNR_THRESHOLD4_BELOW; - } else if ((snr > sq_thresh->lower_threshold[2]) && - (snr <= sq_thresh->lower_threshold[1])) - { - newThreshold = WMI_SNR_THRESHOLD3_BELOW; - } else if ((snr > sq_thresh->lower_threshold[3]) && - (snr <= sq_thresh->lower_threshold[2])) - { - newThreshold = WMI_SNR_THRESHOLD2_BELOW; - } else if (snr <= sq_thresh->lower_threshold[3]) { - newThreshold = WMI_SNR_THRESHOLD1_BELOW; - } - } - - /* Calculate and install the next set of thresholds */ - lower_snr_threshold = ar6000_get_lower_threshold(snr, sq_thresh, - sq_thresh->lower_threshold_valid_count); - upper_snr_threshold = ar6000_get_upper_threshold(snr, sq_thresh, - sq_thresh->upper_threshold_valid_count); - - /* Issue a wmi command to install the thresholds */ - cmd.thresholdAbove1_Val = upper_snr_threshold; - cmd.thresholdBelow1_Val = lower_snr_threshold; - cmd.weight = sq_thresh->weight; - cmd.pollTime = sq_thresh->polling_interval; - - A_DPRINTF(DBG_WMI, (DBGFMT "snr: %d, threshold: %d, lower: %d, upper: %d\n" - ,DBGARG, snr, newThreshold, lower_snr_threshold, - upper_snr_threshold)); - - snr_event_value = snr; - - if (wmi_send_snr_threshold_params(wmip, &cmd) != A_OK) { - A_DPRINTF(DBG_WMI, (DBGFMT "Unable to configure the SNR thresholds\n", - DBGARG)); - } - A_WMI_SNR_THRESHOLD_EVENT_RX(wmip->wmi_devt, newThreshold, reply->snr); - - return A_OK; -} - -static A_STATUS -wmi_lqThresholdEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_LQ_THRESHOLD_EVENT *reply; - - if (len < sizeof(*reply)) { - return A_EINVAL; - } - reply = (WMI_LQ_THRESHOLD_EVENT *)datap; - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_LQ_THRESHOLD_EVENT_RX(wmip->wmi_devt, - (WMI_LQ_THRESHOLD_VAL) reply->range, - reply->lq); - - return A_OK; -} - -static A_STATUS -wmi_aplistEvent_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - A_UINT16 ap_info_entry_size; - WMI_APLIST_EVENT *ev = (WMI_APLIST_EVENT *)datap; - WMI_AP_INFO_V1 *ap_info_v1; - A_UINT8 i; - - if (len < sizeof(WMI_APLIST_EVENT)) { - return A_EINVAL; - } - - if (ev->apListVer == APLIST_VER1) { - ap_info_entry_size = sizeof(WMI_AP_INFO_V1); - ap_info_v1 = (WMI_AP_INFO_V1 *)ev->apList; - } else { - return A_EINVAL; - } - - AR_DEBUG_PRINTF(ATH_DEBUG_WMI, ("Number of APs in APLIST Event is %d\n", ev->numAP)); - if (len < (int)(sizeof(WMI_APLIST_EVENT) + - (ev->numAP - 1) * ap_info_entry_size)) - { - return A_EINVAL; - } - - /* - * AP List Ver1 Contents - */ - for (i = 0; i < ev->numAP; i++) { - AR_DEBUG_PRINTF(ATH_DEBUG_WMI, ("AP#%d BSSID %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x "\ - "Channel %d\n", i, - ap_info_v1->bssid[0], ap_info_v1->bssid[1], - ap_info_v1->bssid[2], ap_info_v1->bssid[3], - ap_info_v1->bssid[4], ap_info_v1->bssid[5], - ap_info_v1->channel)); - ap_info_v1++; - } - return A_OK; -} - -static A_STATUS -wmi_dbglog_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - A_UINT32 dropped; - - dropped = *((A_UINT32 *)datap); - datap += sizeof(dropped); - len -= sizeof(dropped); - A_WMI_DBGLOG_EVENT(wmip->wmi_devt, dropped, (A_INT8*)datap, len); - return A_OK; -} - -static A_STATUS -wmi_wacGetInfoReply_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - A_WMI_WACINFO_EVENT(wmip->wmi_devt, datap, len); - - return A_OK; -} - -#ifdef CONFIG_HOST_GPIO_SUPPORT -static A_STATUS -wmi_gpio_intr_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMIX_GPIO_INTR_EVENT *gpio_intr = (WMIX_GPIO_INTR_EVENT *)datap; - - A_DPRINTF(DBG_WMI, - (DBGFMT "Enter - intrmask=0x%x input=0x%x.\n", DBGARG, - gpio_intr->intr_mask, gpio_intr->input_values)); - - A_WMI_GPIO_INTR_RX(wmip->wmi_devt, gpio_intr->intr_mask, gpio_intr->input_values); - - return A_OK; -} - -static A_STATUS -wmi_gpio_data_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMIX_GPIO_DATA_EVENT *gpio_data = (WMIX_GPIO_DATA_EVENT *)datap; - - A_DPRINTF(DBG_WMI, - (DBGFMT "Enter - reg=%d value=0x%x\n", DBGARG, - gpio_data->reg_id, gpio_data->value)); - - A_WMI_GPIO_DATA_RX(wmip->wmi_devt, gpio_data->reg_id, gpio_data->value); - - return A_OK; -} - -static A_STATUS -wmi_gpio_ack_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_GPIO_ACK_RX(wmip->wmi_devt); - - return A_OK; -} -#endif /* CONFIG_HOST_GPIO_SUPPORT */ - -/* - * Called to send a wmi command. Command specific data is already built - * on osbuf and current osbuf->data points to it. - */ -A_STATUS -wmi_cmd_send(struct wmi_t *wmip, void *osbuf, WMI_COMMAND_ID cmdId, - WMI_SYNC_FLAG syncflag) -{ - WMI_CMD_HDR *cHdr; - HTC_ENDPOINT_ID eid = pWmiPriv->wmi_endpoint_id; - A_STATUS status; - - A_ASSERT(osbuf != NULL); - - if (syncflag >= END_WMIFLAG) { - return A_EINVAL; - } - - if ((syncflag == SYNC_BEFORE_WMIFLAG) || (syncflag == SYNC_BOTH_WMIFLAG)) { - /* - * We want to make sure all data currently queued is transmitted before - * the cmd execution. Establish a new sync point. - */ - status = wmi_sync_point(wmip); - - if (status != A_OK) { - return status; - } - } - - if (A_NETBUF_PUSH(osbuf, sizeof(WMI_CMD_HDR)) != A_OK) { - return A_NO_MEMORY; - } - - cHdr = (WMI_CMD_HDR *)A_NETBUF_DATA(osbuf); - cHdr->commandId = (A_UINT16) cmdId; - WMI_CMD_HDR_SET_DEVID(cHdr, wmip->wmi_dev_index); // added for virtual interface - - status = A_WMI_CONTROL_TX(wmip->wmi_devt, osbuf, eid); - - if (status != A_OK) { - return status; - } - - if ((syncflag == SYNC_AFTER_WMIFLAG) || (syncflag == SYNC_BOTH_WMIFLAG)) { - /* - * We want to make sure all new data queued waits for the command to - * execute. Establish a new sync point. - */ - status = wmi_sync_point(wmip); - - if (status != A_OK) { - return status; - } - - } - return status; -#undef IS_OPT_TX_CMD -} - -A_STATUS -wmi_cmd_send_xtnd(struct wmi_t *wmip, void *osbuf, WMIX_COMMAND_ID cmdId, - WMI_SYNC_FLAG syncflag) -{ - WMIX_CMD_HDR *cHdr; - - if (A_NETBUF_PUSH(osbuf, sizeof(WMIX_CMD_HDR)) != A_OK) { - return A_NO_MEMORY; - } - - cHdr = (WMIX_CMD_HDR *)A_NETBUF_DATA(osbuf); - cHdr->commandId = (A_UINT32) cmdId; - - return wmi_cmd_send(wmip, osbuf, WMI_EXTENSION_CMDID, syncflag); -} - -A_STATUS -wmi_connect_cmd(struct wmi_t *wmip, NETWORK_TYPE netType, - DOT11_AUTH_MODE dot11AuthMode, AUTH_MODE authMode, - CRYPTO_TYPE pairwiseCrypto, A_UINT8 pairwiseCryptoLen, - CRYPTO_TYPE groupCrypto, A_UINT8 groupCryptoLen, - int ssidLength, A_UCHAR *ssid, - A_UINT8 *bssid, A_UINT16 channel, A_UINT32 ctrl_flags) -{ - void *osbuf; - WMI_CONNECT_CMD *cc; - A_STATUS status; - - if ((pairwiseCrypto == NONE_CRYPT) && (groupCrypto != NONE_CRYPT)) { - return A_EINVAL; - } - if ((pairwiseCrypto != NONE_CRYPT) && (groupCrypto == NONE_CRYPT)) { - return A_EINVAL; - } - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_CONNECT_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_CONNECT_CMD)); - - cc = (WMI_CONNECT_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cc, sizeof(*cc)); - - if (ssidLength) - { - A_MEMCPY(cc->ssid, ssid, ssidLength); - } - - cc->ssidLength = ssidLength; - cc->networkType = netType; - cc->dot11AuthMode = dot11AuthMode; - cc->authMode = authMode; - cc->pairwiseCryptoType = pairwiseCrypto; - cc->pairwiseCryptoLen = pairwiseCryptoLen; - cc->groupCryptoType = groupCrypto; - cc->groupCryptoLen = groupCryptoLen; - cc->channel = channel; - cc->ctrl_flags = ctrl_flags; - - if (bssid != NULL) { - A_MEMCPY(cc->bssid, bssid, ATH_MAC_LEN); - } - - wmip->wmi_pair_crypto_type = pairwiseCrypto; - wmip->wmi_grp_crypto_type = groupCrypto; - - status = wmi_cmd_send(wmip, osbuf, WMI_CONNECT_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_div_param_cmd(struct wmi_t *wmip, A_UINT32 divIdleTime, - A_UINT8 antRssiThresh, A_UINT8 divEnable, A_UINT16 active_treshold_rate) -{ - void *osbuf; - WMI_DIV_PARAMS_CMD *dc; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_DIV_PARAMS_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_DIV_PARAMS_CMD)); - - dc = (WMI_DIV_PARAMS_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(dc, sizeof(*dc)); - - dc->divIdleTime = divIdleTime; - dc->antRssiThresh = antRssiThresh; - dc->divEnable = divEnable; - dc->active_treshold_rate = active_treshold_rate; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_DIV_PARAMS_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_reconnect_cmd(struct wmi_t *wmip, A_UINT8 *bssid, A_UINT16 channel) -{ - void *osbuf; - WMI_RECONNECT_CMD *cc; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_RECONNECT_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_RECONNECT_CMD)); - - cc = (WMI_RECONNECT_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cc, sizeof(*cc)); - - cc->channel = channel; - - if (bssid != NULL) { - A_MEMCPY(cc->bssid, bssid, ATH_MAC_LEN); - } - - status = wmi_cmd_send(wmip, osbuf, WMI_RECONNECT_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_disconnect_cmd(struct wmi_t *wmip) -{ - A_STATUS status; - - /* Bug fix for 24817(elevator bug) - the disconnect command does not - need to do a SYNC before.*/ - status = wmi_simple_cmd(wmip, WMI_DISCONNECT_CMDID); - - return status; -} - -A_STATUS -wmi_startscan_cmd(struct wmi_t *wmip, WMI_SCAN_TYPE scanType, - A_BOOL forceFgScan, A_BOOL isLegacy, - A_UINT32 homeDwellTime, A_UINT32 forceScanInterval, - A_INT8 numChan, A_UINT16 *channelList) -{ - void *osbuf; - WMI_START_SCAN_CMD *sc; - A_INT8 size; - A_STATUS status; - - size = sizeof (*sc); - - if ((scanType != WMI_LONG_SCAN) && (scanType != WMI_SHORT_SCAN)) { - return A_EINVAL; - } - - if (numChan) { - if (numChan > WMI_MAX_CHANNELS) { - return A_EINVAL; - } - size += sizeof(A_UINT16) * (numChan - 1); - } - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, size); - - sc = (WMI_START_SCAN_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(sc, sizeof(*sc)); - sc->scanType = scanType; - sc->forceFgScan = forceFgScan; - sc->isLegacy = isLegacy; - sc->homeDwellTime = homeDwellTime; - sc->forceScanInterval = forceScanInterval; - sc->numChannels = numChan; - if (numChan) { - A_MEMCPY(sc->channelList, channelList, numChan * sizeof(A_UINT16)); - } - - status = wmi_cmd_send(wmip, osbuf, WMI_START_SCAN_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_scanparams_cmd(struct wmi_t *wmip, A_UINT16 fg_start_sec, - A_UINT16 fg_end_sec, A_UINT16 bg_sec, - A_UINT16 minact_chdw_msec, A_UINT16 maxact_chdw_msec, - A_UINT16 pas_chdw_msec, - A_UINT8 shScanRatio, A_UINT8 scanCtrlFlags, - A_UINT32 max_dfsch_act_time, A_UINT16 maxact_scan_per_ssid) -{ - void *osbuf; - WMI_SCAN_PARAMS_CMD *sc; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*sc)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*sc)); - - sc = (WMI_SCAN_PARAMS_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(sc, sizeof(*sc)); - sc->fg_start_period = fg_start_sec; - sc->fg_end_period = fg_end_sec; - sc->bg_period = bg_sec; - sc->minact_chdwell_time = minact_chdw_msec; - sc->maxact_chdwell_time = maxact_chdw_msec; - sc->pas_chdwell_time = pas_chdw_msec; - sc->shortScanRatio = shScanRatio; - sc->scanCtrlFlags = scanCtrlFlags; - sc->max_dfsch_act_time = max_dfsch_act_time; - sc->maxact_scan_per_ssid = maxact_scan_per_ssid; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_SCAN_PARAMS_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_bssfilter_cmd(struct wmi_t *wmip, A_UINT8 filter, A_UINT32 ieMask) -{ - void *osbuf; - WMI_BSS_FILTER_CMD *cmd; - A_STATUS status; - - if (filter >= LAST_BSS_FILTER) { - return A_EINVAL; - } - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_BSS_FILTER_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->bssFilter = filter; - cmd->ieMask = ieMask; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_BSS_FILTER_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_probedSsid_cmd(struct wmi_t *wmip, A_UINT8 index, A_UINT8 flag, - A_UINT8 ssidLength, A_UCHAR *ssid) -{ - void *osbuf; - WMI_PROBED_SSID_CMD *cmd; - A_STATUS status; - - if (index > MAX_PROBED_SSID_INDEX) { - return A_EINVAL; - } - if (ssidLength > sizeof(cmd->ssid)) { - return A_EINVAL; - } - if ((flag & (DISABLE_SSID_FLAG | ANY_SSID_FLAG)) && (ssidLength > 0)) { - is_probe_ssid = FALSE; - return A_EINVAL; - } - if ((flag & SPECIFIC_SSID_FLAG) && !ssidLength) { - return A_EINVAL; - } - - if (flag & SPECIFIC_SSID_FLAG) { - is_probe_ssid = TRUE; - } - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_PROBED_SSID_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->entryIndex = index; - cmd->flag = flag; - cmd->ssidLength = ssidLength; - - if (ssidLength) - { - A_MEMCPY(cmd->ssid, ssid, ssidLength); - } - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_PROBED_SSID_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_listeninterval_cmd(struct wmi_t *wmip, A_UINT16 listenInterval, A_UINT16 listenBeacons) -{ - void *osbuf; - WMI_LISTEN_INT_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_LISTEN_INT_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->listenInterval = listenInterval; - cmd->numBeacons = listenBeacons; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_LISTEN_INT_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_bmisstime_cmd(struct wmi_t *wmip, A_UINT16 bmissTime, A_UINT16 bmissBeacons) -{ - void *osbuf; - WMI_BMISS_TIME_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_BMISS_TIME_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->bmissTime = bmissTime; - cmd->numBeacons = bmissBeacons; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_BMISS_TIME_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_associnfo_cmd(struct wmi_t *wmip, A_UINT8 ieType, - A_UINT8 ieLen, A_UINT8 *ieInfo) -{ - void *osbuf; - WMI_SET_ASSOC_INFO_CMD *cmd; - A_UINT16 cmdLen; - A_STATUS status; - - cmdLen = sizeof(*cmd) + ieLen - 1; - osbuf = A_NETBUF_ALLOC(cmdLen); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, cmdLen); - - cmd = (WMI_SET_ASSOC_INFO_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, cmdLen); - cmd->ieType = ieType; - cmd->bufferSize = ieLen; - - if (ieLen) - { - A_MEMCPY(cmd->assocInfo, ieInfo, ieLen); - } - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_ASSOC_INFO_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_powermode_cmd(struct wmi_t *wmip, A_UINT8 powerMode) -{ - void *osbuf; - WMI_POWER_MODE_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_POWER_MODE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->powerMode = powerMode; - wmip->wmi_powerMode = powerMode; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_POWER_MODE_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_ibsspmcaps_cmd(struct wmi_t *wmip, A_UINT8 pmEnable, A_UINT8 ttl, - A_UINT16 atim_windows, A_UINT16 timeout_value) -{ - void *osbuf; - WMI_IBSS_PM_CAPS_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_IBSS_PM_CAPS_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->power_saving = pmEnable; - cmd->ttl = ttl; - cmd->atim_windows = atim_windows; - cmd->timeout_value = timeout_value; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_IBSS_PM_CAPS_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_apps_cmd(struct wmi_t *wmip, A_UINT8 psType, A_UINT32 idle_time, - A_UINT32 ps_period, A_UINT8 sleep_period) -{ - void *osbuf; - WMI_AP_PS_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_AP_PS_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->psType = psType; - cmd->idle_time = idle_time; - cmd->ps_period = ps_period; - cmd->sleep_period = sleep_period; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_AP_PS_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_pmparams_cmd(struct wmi_t *wmip, A_UINT16 idlePeriod, - A_UINT16 psPollNum, A_UINT16 dtimPolicy, - A_UINT16 tx_wakeup_policy, A_UINT16 num_tx_to_wakeup, - A_UINT16 ps_fail_event_policy) -{ - void *osbuf; - WMI_POWER_PARAMS_CMD *pm; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*pm)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*pm)); - - pm = (WMI_POWER_PARAMS_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(pm, sizeof(*pm)); - pm->idle_period = idlePeriod; - pm->pspoll_number = psPollNum; - pm->dtim_policy = dtimPolicy; - pm->tx_wakeup_policy = tx_wakeup_policy; - pm->num_tx_to_wakeup = num_tx_to_wakeup; - pm->ps_fail_event_policy = ps_fail_event_policy; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_POWER_PARAMS_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_disctimeout_cmd(struct wmi_t *wmip, A_UINT8 timeout) -{ - void *osbuf; - WMI_DISC_TIMEOUT_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_DISC_TIMEOUT_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->disconnectTimeout = timeout; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_DISC_TIMEOUT_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - - - -A_STATUS -wmi_addKey_cmd(struct wmi_t *wmip, A_UINT8 keyIndex, CRYPTO_TYPE keyType, - A_UINT8 keyUsage, A_UINT8 keyLength, A_UINT8 *keyRSC, - A_UINT8 *keyMaterial, A_UINT8 key_op_ctrl, A_UINT8 *macAddr, - WMI_SYNC_FLAG sync_flag) -{ - void *osbuf; - WMI_ADD_CIPHER_KEY_CMD *cmd; - A_STATUS status; - - if ((keyIndex > WMI_MAX_KEY_INDEX) || (keyLength > WMI_MAX_KEY_LEN) || - (keyMaterial == NULL)) - { - return A_EINVAL; - } - - if ((WEP_CRYPT != keyType) && (NULL == keyRSC)) { - return A_EINVAL; - } - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_ADD_CIPHER_KEY_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->keyIndex = keyIndex; - cmd->keyType = keyType; - cmd->keyUsage = keyUsage; - cmd->keyLength = keyLength; - A_MEMCPY(cmd->key, keyMaterial, keyLength); -#ifdef WAPI_ENABLE - if (NULL != keyRSC && key_op_ctrl != KEY_OP_INIT_WAPIPN) { -#else - if (NULL != keyRSC) { -#endif // WAPI_ENABLE - A_MEMCPY(cmd->keyRSC, keyRSC, sizeof(cmd->keyRSC)); - } - cmd->key_op_ctrl = key_op_ctrl; - - if(macAddr) { - A_MEMCPY(cmd->key_macaddr,macAddr,IEEE80211_ADDR_LEN); - } - - status = wmi_cmd_send(wmip, osbuf, WMI_ADD_CIPHER_KEY_CMDID, sync_flag); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_add_krk_cmd(struct wmi_t *wmip, A_UINT8 *krk) -{ - void *osbuf; - WMI_ADD_KRK_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_ADD_KRK_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - A_MEMCPY(cmd->krk, krk, WMI_KRK_LEN); - - status = wmi_cmd_send(wmip, osbuf, WMI_ADD_KRK_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_delete_krk_cmd(struct wmi_t *wmip) -{ - return wmi_simple_cmd(wmip, WMI_DELETE_KRK_CMDID); -} - -A_STATUS -wmi_deleteKey_cmd(struct wmi_t *wmip, A_UINT8 keyIndex) -{ - void *osbuf; - WMI_DELETE_CIPHER_KEY_CMD *cmd; - A_STATUS status; - - if (keyIndex > WMI_MAX_KEY_INDEX) { - return A_EINVAL; - } - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_DELETE_CIPHER_KEY_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->keyIndex = keyIndex; - - status = wmi_cmd_send(wmip, osbuf, WMI_DELETE_CIPHER_KEY_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_setPmkid_cmd(struct wmi_t *wmip, A_UINT8 *bssid, A_UINT8 *pmkId, - A_BOOL set) -{ - void *osbuf; - WMI_SET_PMKID_CMD *cmd; - A_STATUS status; - - if (bssid == NULL) { - return A_EINVAL; - } - - if ((set == TRUE) && (pmkId == NULL)) { - return A_EINVAL; - } - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_PMKID_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMCPY(cmd->bssid, bssid, sizeof(cmd->bssid)); - if (set == TRUE) { - A_MEMCPY(cmd->pmkid, pmkId, sizeof(cmd->pmkid)); - cmd->enable = PMKID_ENABLE; - } else { - A_MEMZERO(cmd->pmkid, sizeof(cmd->pmkid)); - cmd->enable = PMKID_DISABLE; - } - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_PMKID_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_tkip_countermeasures_cmd(struct wmi_t *wmip, A_BOOL en) -{ - void *osbuf; - WMI_SET_TKIP_COUNTERMEASURES_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_TKIP_COUNTERMEASURES_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->cm_en = (en == TRUE)? WMI_TKIP_CM_ENABLE : WMI_TKIP_CM_DISABLE; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_TKIP_COUNTERMEASURES_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_akmp_params_cmd(struct wmi_t *wmip, - WMI_SET_AKMP_PARAMS_CMD *akmpParams) -{ - void *osbuf; - WMI_SET_AKMP_PARAMS_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - cmd = (WMI_SET_AKMP_PARAMS_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->akmpInfo = akmpParams->akmpInfo; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_AKMP_PARAMS_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_pmkid_list_cmd(struct wmi_t *wmip, - WMI_SET_PMKID_LIST_CMD *pmkInfo) -{ - void *osbuf; - WMI_SET_PMKID_LIST_CMD *cmd; - A_UINT16 cmdLen; - A_UINT8 i; - A_STATUS status; - - cmdLen = sizeof(pmkInfo->numPMKID) + - pmkInfo->numPMKID * sizeof(WMI_PMKID); - - osbuf = A_NETBUF_ALLOC(cmdLen); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, cmdLen); - cmd = (WMI_SET_PMKID_LIST_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->numPMKID = pmkInfo->numPMKID; - - for (i = 0; i < cmd->numPMKID; i++) { - A_MEMCPY(&cmd->pmkidList[i], &pmkInfo->pmkidList[i], - WMI_PMKID_LEN); - } - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_PMKID_LIST_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_get_pmkid_list_cmd(struct wmi_t *wmip) -{ - return wmi_simple_cmd(wmip, WMI_GET_PMKID_LIST_CMDID); -} - -A_STATUS -wmi_dataSync_send(struct wmi_t *wmip, void *osbuf, HTC_ENDPOINT_ID eid) -{ - WMI_DATA_HDR *dtHdr; - - A_ASSERT( eid != pWmiPriv->wmi_endpoint_id); - A_ASSERT(osbuf != NULL); - - if (A_NETBUF_PUSH(osbuf, sizeof(WMI_DATA_HDR)) != A_OK) { - return A_NO_MEMORY; - } - - dtHdr = (WMI_DATA_HDR *)A_NETBUF_DATA(osbuf); - A_MEMZERO(dtHdr, sizeof(WMI_DATA_HDR)); - dtHdr->info = - (SYNC_MSGTYPE & WMI_DATA_HDR_MSG_TYPE_MASK) << WMI_DATA_HDR_MSG_TYPE_SHIFT; - - A_DPRINTF(DBG_WMI, (DBGFMT "Enter - eid %d\n", DBGARG, eid)); - - return (A_WMI_CONTROL_TX(wmip->wmi_devt, osbuf, eid)); -} - -typedef struct _WMI_DATA_SYNC_BUFS { - A_UINT8 trafficClass; - void *osbuf; -}WMI_DATA_SYNC_BUFS; - -static A_STATUS -wmi_sync_point(struct wmi_t *wmip) -{ - void *cmd_osbuf; - WMI_SYNC_CMD *cmd; - WMI_DATA_SYNC_BUFS dataSyncBufs[WMM_NUM_AC]; - A_UINT8 i,numPriStreams=0; - A_STATUS status = A_OK; - A_UINT8 wmi_fatPipeExists; - - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - memset(dataSyncBufs,0,sizeof(dataSyncBufs)); - - /* lock out while we walk through the priority list and assemble our local array */ - LOCK_WMI(pWmiPriv); - /* Cache the data stream exists within the lock */ - wmi_fatPipeExists =pWmiPriv->wmi_fatPipeExists; - - for (i=0; i < WMM_NUM_AC ; i++) { - if (wmi_fatPipeExists & (1 << i)) { - numPriStreams++; - dataSyncBufs[numPriStreams-1].trafficClass = i; - } - } - - UNLOCK_WMI(pWmiPriv); - - /* dataSyncBufs is now filled with entries (starting at index 0) containing valid streamIDs */ - - do { - /* - * We allocate all network buffers needed so we will be able to - * send all required frames. - */ - cmd_osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (cmd_osbuf == NULL) { - status = A_NO_MEMORY; - break; - } - - A_NETBUF_PUT(cmd_osbuf, sizeof(*cmd)); - - cmd = (WMI_SYNC_CMD *)(A_NETBUF_DATA(cmd_osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - - /* In the SYNC cmd sent on the control Ep, send a bitmap of the data - * eps on which the Data Sync will be sent - */ - cmd->dataSyncMap = wmi_fatPipeExists; - - for (i=0; i < numPriStreams ; i++) { - dataSyncBufs[i].osbuf = A_NETBUF_ALLOC(0); - if (dataSyncBufs[i].osbuf == NULL) { - status = A_NO_MEMORY; - break; - } - } //end for - - /* if Buffer allocation for any of the dataSync fails, then do not - * send the Synchronize cmd on the control ep - */ - if (A_FAILED(status)) { - break; - } - - /* - * Send sync cmd followed by sync data messages on all endpoints being - * used - */ - status = wmi_cmd_send(wmip, cmd_osbuf, WMI_SYNCHRONIZE_CMDID, - NO_SYNC_WMIFLAG); - - if (A_FAILED(status)) { - break; - } - /* cmd buffer sent, we no longer own it */ - cmd_osbuf = NULL; - - for(i=0; i < numPriStreams; i++) { - A_ASSERT(dataSyncBufs[i].osbuf != NULL); - status = wmi_dataSync_send(wmip, - dataSyncBufs[i].osbuf, - A_WMI_Ac2EndpointID(wmip->wmi_devt, - dataSyncBufs[i]. - trafficClass) - ); - - if (A_FAILED(status)) { - break; - } - /* we don't own this buffer anymore, NULL it out of the array so it - * won't get cleaned up */ - dataSyncBufs[i].osbuf = NULL; - } //end for - - } while(FALSE); - - /* free up any resources left over (possibly due to an error) */ - - if (cmd_osbuf != NULL) { - A_NETBUF_FREE(cmd_osbuf); - } - - for (i = 0; i < numPriStreams; i++) { - if (dataSyncBufs[i].osbuf != NULL) { - A_NETBUF_FREE(dataSyncBufs[i].osbuf); - } - } - - return (status); -} - -A_STATUS -wmi_create_pstream_cmd(struct wmi_t *wmip, WMI_CREATE_PSTREAM_CMD *params) -{ - void *osbuf; - WMI_CREATE_PSTREAM_CMD *cmd; - A_UINT8 fatPipeExistsForAC=0; - A_INT32 minimalPHY = 0; - A_INT32 nominalPHY = 0; - A_STATUS status; - - /* Validate all the parameters. */ - if( !((params->userPriority < 8) && - (params->userPriority <= 0x7) && - (convert_userPriority_to_trafficClass(params->userPriority) == params->trafficClass) && - (params->trafficDirection == UPLINK_TRAFFIC || - params->trafficDirection == DNLINK_TRAFFIC || - params->trafficDirection == BIDIR_TRAFFIC) && - (params->trafficType == TRAFFIC_TYPE_APERIODIC || - params->trafficType == TRAFFIC_TYPE_PERIODIC ) && - (params->voicePSCapability == DISABLE_FOR_THIS_AC || - params->voicePSCapability == ENABLE_FOR_THIS_AC || - params->voicePSCapability == ENABLE_FOR_ALL_AC) && - (params->tsid == WMI_IMPLICIT_PSTREAM || params->tsid <= WMI_MAX_THINSTREAM)) ) - { - return A_EINVAL; - } - - // - // check nominal PHY rate is >= minimalPHY, so that DUT - // can allow TSRS IE - // - - // get the physical rate - minimalPHY = ((params->minPhyRate / 1000)/1000); // unit of bps - - // check minimal phy < nominal phy rate - // - if (params->nominalPHY >= minimalPHY) - { - nominalPHY = (params->nominalPHY * 1000)/500; // unit of 500 kbps - A_DPRINTF(DBG_WMI, - (DBGFMT "TSRS IE Enabled::MinPhy %x->NominalPhy ===> %x\n", DBGARG, - minimalPHY, nominalPHY)); - - params->nominalPHY = nominalPHY; - } - else - { - params->nominalPHY = 0; - } - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - A_DPRINTF(DBG_WMI, - (DBGFMT "Sending create_pstream_cmd: ac=%d tsid:%d\n", DBGARG, - params->trafficClass, params->tsid)); - - cmd = (WMI_CREATE_PSTREAM_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - A_MEMCPY(cmd, params, sizeof(*cmd)); - - if (!cmd->inactivityInt) { - A_NETBUF_FREE(osbuf); - return A_EINVAL; - } - - /* this is an implicitly created Fat pipe */ - if ((A_UINT32)params->tsid == (A_UINT32)WMI_IMPLICIT_PSTREAM) { - LOCK_WMI(pWmiPriv); - fatPipeExistsForAC = (pWmiPriv->wmi_fatPipeExists & (1 << params->trafficClass)); - /* - * EV#84204 target assert failure in _tx_aggr_drain_post_process() - * To prevent the driver from sending the back-to-back CREATE_PSTREAM cmd - */ - if (fatPipeExistsForAC) { - UNLOCK_WMI(pWmiPriv); - A_NETBUF_FREE(osbuf); - return A_OK; - } - pWmiPriv->wmi_fatPipeExists |= (1<trafficClass); - UNLOCK_WMI(pWmiPriv); - } else { - /* this is an explicitly created thin stream within a fat pipe */ - LOCK_WMI(pWmiPriv); - fatPipeExistsForAC = (pWmiPriv->wmi_fatPipeExists & (1 << params->trafficClass)); - pWmiPriv->wmi_streamExistsForAC[params->trafficClass] |= (1<tsid); - /* if a thinstream becomes active, the fat pipe automatically - * becomes active - */ - pWmiPriv->wmi_fatPipeExists |= (1<trafficClass); - UNLOCK_WMI(pWmiPriv); - } - - /* Indicate activty change to driver layer only if this is the - * first TSID to get created in this AC explicitly or an implicit - * fat pipe is getting created. - */ - if (!fatPipeExistsForAC) { - A_WMI_STREAM_TX_ACTIVE(wmip->wmi_devt, params->trafficClass); - } - - /* mike: should be SYNC_BEFORE_WMIFLAG */ - status = wmi_cmd_send(wmip, osbuf, WMI_CREATE_PSTREAM_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_delete_pstream_cmd(struct wmi_t *wmip, A_UINT8 trafficClass, A_UINT8 tsid) -{ - void *osbuf; - WMI_DELETE_PSTREAM_CMD *cmd; - A_STATUS status; - A_UINT16 activeTsids=0; - - /* validate the parameters */ - if (trafficClass > 3) { - A_DPRINTF(DBG_WMI, (DBGFMT "Invalid trafficClass: %d\n", DBGARG, trafficClass)); - return A_EINVAL; - } - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_DELETE_PSTREAM_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - - cmd->trafficClass = trafficClass; - cmd->tsid = tsid; - - LOCK_WMI(pWmiPriv); - activeTsids = pWmiPriv->wmi_streamExistsForAC[trafficClass]; - UNLOCK_WMI(pWmiPriv); - - /* Check if the tsid was created & exists */ - if (!(activeTsids & (1<wmi_streamExistsForAC[trafficClass] &= ~(1<wmi_streamExistsForAC[trafficClass]; - UNLOCK_WMI(pWmiPriv); - - - /* Indicate stream inactivity to driver layer only if all tsids - * within this AC are deleted. - */ - if(!activeTsids) { - A_WMI_STREAM_TX_INACTIVE(wmip->wmi_devt, trafficClass); - pWmiPriv->wmi_fatPipeExists &= ~(1< 15)){ - - return A_EINVAL; - } - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_FRAME_RATES_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - - frameType = (A_UINT8)((subType << 4) | type); - - cmd->bEnableMask = bEnable; - cmd->frameType = frameType; - cmd->frameRateMask[0] = rateMask; - cmd->frameRateMask[1] = 0; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_FRAMERATES_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -/* - * used to set the bit rate. rate is in Kbps. If rate == -1 - * then auto selection is used. - */ -A_STATUS -wmi_set_bitrate_cmd(struct wmi_t *wmip, A_INT32 dataRate, A_INT32 mgmtRate, A_INT32 ctlRate) -{ - void *osbuf; - WMI_BIT_RATE_CMD *cmd; - A_INT8 drix, mrix, crix, ret_val; - A_STATUS status; - - if (dataRate != -1) { - ret_val = wmi_validate_bitrate(wmip, dataRate, &drix); - if(ret_val == A_EINVAL){ - return A_EINVAL; - } - } else { - drix = -1; - } - - if (mgmtRate != -1) { - ret_val = wmi_validate_bitrate(wmip, mgmtRate, &mrix); - if(ret_val == A_EINVAL){ - return A_EINVAL; - } - } else { - mrix = -1; - } - if (ctlRate != -1) { - ret_val = wmi_validate_bitrate(wmip, ctlRate, &crix); - if(ret_val == A_EINVAL){ - return A_EINVAL; - } - } else { - crix = -1; - } - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_BIT_RATE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - - cmd->rateIndex = drix; - cmd->mgmtRateIndex = mrix; - cmd->ctlRateIndex = crix; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_BITRATE_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_get_bitrate_cmd(struct wmi_t *wmip) -{ - return wmi_simple_cmd(wmip, WMI_GET_BITRATE_CMDID); -} - -/* - * Returns TRUE iff the given rate index is legal in the current PHY mode. - */ -A_BOOL -wmi_is_bitrate_index_valid(struct wmi_t *wmip, A_INT32 rateIndex) -{ - WMI_PHY_MODE phyMode = (WMI_PHY_MODE) wmip->wmi_phyMode; - A_BOOL isValid = TRUE; - switch(phyMode) { - case WMI_11A_MODE: - if (wmip->wmi_ht_cap[A_BAND_5GHZ].enable){ - if ((rateIndex < MODE_A_SUPPORT_RATE_START) || (rateIndex > MODE_GHT20_SUPPORT_RATE_STOP)) { - isValid = FALSE; - } - } else { - if ((rateIndex < MODE_A_SUPPORT_RATE_START) || (rateIndex > MODE_A_SUPPORT_RATE_STOP)) { - isValid = FALSE; - } - } - break; - - case WMI_11B_MODE: - if ((rateIndex < MODE_B_SUPPORT_RATE_START) || (rateIndex > MODE_B_SUPPORT_RATE_STOP)) { - isValid = FALSE; - } - break; - - case WMI_11GONLY_MODE: - if (wmip->wmi_ht_cap[A_BAND_24GHZ].enable){ - if ((rateIndex < MODE_GONLY_SUPPORT_RATE_START) || (rateIndex > MODE_GHT20_SUPPORT_RATE_STOP)) { - isValid = FALSE; - } - } else { - if ((rateIndex < MODE_GONLY_SUPPORT_RATE_START) || (rateIndex > MODE_GONLY_SUPPORT_RATE_STOP)) { - isValid = FALSE; - } - } - break; - - case WMI_11G_MODE: - case WMI_11AG_MODE: - if (wmip->wmi_ht_cap[A_BAND_24GHZ].enable){ - if ((rateIndex < MODE_G_SUPPORT_RATE_START) || (rateIndex > MODE_GHT20_SUPPORT_RATE_STOP)) { - isValid = FALSE; - } - } else { - if ((rateIndex < MODE_G_SUPPORT_RATE_START) || (rateIndex > MODE_G_SUPPORT_RATE_STOP)) { - isValid = FALSE; - } - } - break; - default: - A_ASSERT(FALSE); - break; - } - - return isValid; -} - -A_INT8 -wmi_validate_bitrate(struct wmi_t *wmip, A_INT32 rate, A_INT8 *rate_idx) -{ - A_INT8 i; - A_UINT8 sgi; - - sgi = wmip->wmi_ht_cap[A_BAND_24GHZ].short_GI_20MHz; - sgi |= wmip->wmi_ht_cap[A_BAND_5GHZ].short_GI_20MHz; - - for (i=0;;i++) - { - if (wmi_rateTable[(A_UINT32) i][sgi] == 0) { - return A_EINVAL; - } - if (wmi_rateTable[(A_UINT32) i][sgi] == rate) { - break; - } - } - - if(wmi_is_bitrate_index_valid(wmip, (A_INT32) i) != TRUE) { - return A_EINVAL; - } - - *rate_idx = i; - return A_OK; -} - -A_STATUS -wmi_set_fixrates_cmd(struct wmi_t *wmip, A_UINT32 *fixRatesMask) -{ - void *osbuf; - WMI_FIX_RATES_CMD *cmd; - A_STATUS status; -#if 0 - A_INT32 rateIndex; -/* This check does not work for AR6003 as the HT modes are enabled only when - * the STA is connected to a HT_BSS and is not based only on channel. It is - * safe to skip this check however because rate control will only use rates - * that are permitted by the valid rate mask and the fix rate mask. Meaning - * the fix rate mask is not sufficient by itself to cause an invalid rate - * to be used. */ - /* Make sure all rates in the mask are valid in the current PHY mode */ - for(rateIndex = 0; rateIndex < MAX_NUMBER_OF_SUPPORT_RATES; rateIndex++) { - if((1 << rateIndex) & (A_UINT32)fixRatesMask) { - if(wmi_is_bitrate_index_valid(wmip, rateIndex) != TRUE) { - A_DPRINTF(DBG_WMI, (DBGFMT "Set Fix Rates command failed: Given rate is illegal in current PHY mode\n", DBGARG)); - return A_EINVAL; - } - } - } -#endif - - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_FIX_RATES_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - - cmd->fixRateMask[0] = fixRatesMask[0]; - cmd->fixRateMask[1] = fixRatesMask[1]; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_FIXRATES_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_get_ratemask_cmd(struct wmi_t *wmip) -{ - return wmi_simple_cmd(wmip, WMI_GET_FIXRATES_CMDID); -} - -A_STATUS -wmi_get_channelList_cmd(struct wmi_t *wmip) -{ - return wmi_simple_cmd(wmip, WMI_GET_CHANNEL_LIST_CMDID); -} - -/* - * used to generate a wmi sey channel Parameters cmd. - * mode should always be specified and corresponds to the phy mode of the - * wlan. - * numChan should alway sbe specified. If zero indicates that all available - * channels should be used. - * channelList is an array of channel frequencies (in Mhz) which the radio - * should limit its operation to. It should be NULL if numChan == 0. Size of - * array should correspond to numChan entries. - */ -A_STATUS -wmi_set_channelParams_cmd(struct wmi_t *wmip, A_UINT8 scanParam, - WMI_PHY_MODE mode, A_INT8 numChan, - A_UINT16 *channelList) -{ - void *osbuf; - WMI_CHANNEL_PARAMS_CMD *cmd; - A_INT8 size; - A_STATUS status; - - if (wmip->wmi_phyMode != mode) { - wmi_free_allnodes(wmip); - } - - size = sizeof (*cmd); - - if (numChan) { - if (numChan > WMI_MAX_CHANNELS) { - return A_EINVAL; - } - size += sizeof(A_UINT16) * (numChan - 1); - } - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, size); - - cmd = (WMI_CHANNEL_PARAMS_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, size); - - wmip->wmi_phyMode = mode; - cmd->scanParam = scanParam; - cmd->phyMode = mode; - cmd->numChannels = numChan; - A_MEMCPY(cmd->channelList, channelList, numChan * sizeof(A_UINT16)); - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_CHANNEL_PARAMS_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -void -wmi_cache_configure_rssithreshold(struct wmi_t *wmip, WMI_RSSI_THRESHOLD_PARAMS_CMD *rssiCmd) -{ - SQ_THRESHOLD_PARAMS *sq_thresh = - &wmip->wmi_SqThresholdParams[SIGNAL_QUALITY_METRICS_RSSI]; - /* - * Parse the command and store the threshold values here. The checks - * for valid values can be put here - */ - sq_thresh->weight = rssiCmd->weight; - sq_thresh->polling_interval = rssiCmd->pollTime; - - sq_thresh->upper_threshold[0] = rssiCmd->thresholdAbove1_Val - SIGNAL_QUALITY_NOISE_FLOOR; - sq_thresh->upper_threshold[1] = rssiCmd->thresholdAbove2_Val - SIGNAL_QUALITY_NOISE_FLOOR; - sq_thresh->upper_threshold[2] = rssiCmd->thresholdAbove3_Val - SIGNAL_QUALITY_NOISE_FLOOR; - sq_thresh->upper_threshold[3] = rssiCmd->thresholdAbove4_Val - SIGNAL_QUALITY_NOISE_FLOOR; - sq_thresh->upper_threshold[4] = rssiCmd->thresholdAbove5_Val - SIGNAL_QUALITY_NOISE_FLOOR; - sq_thresh->upper_threshold[5] = rssiCmd->thresholdAbove6_Val - SIGNAL_QUALITY_NOISE_FLOOR; - sq_thresh->upper_threshold_valid_count = 6; - - /* List sorted in descending order */ - sq_thresh->lower_threshold[0] = rssiCmd->thresholdBelow6_Val - SIGNAL_QUALITY_NOISE_FLOOR; - sq_thresh->lower_threshold[1] = rssiCmd->thresholdBelow5_Val - SIGNAL_QUALITY_NOISE_FLOOR; - sq_thresh->lower_threshold[2] = rssiCmd->thresholdBelow4_Val - SIGNAL_QUALITY_NOISE_FLOOR; - sq_thresh->lower_threshold[3] = rssiCmd->thresholdBelow3_Val - SIGNAL_QUALITY_NOISE_FLOOR; - sq_thresh->lower_threshold[4] = rssiCmd->thresholdBelow2_Val - SIGNAL_QUALITY_NOISE_FLOOR; - sq_thresh->lower_threshold[5] = rssiCmd->thresholdBelow1_Val - SIGNAL_QUALITY_NOISE_FLOOR; - sq_thresh->lower_threshold_valid_count = 6; - - if (!rssi_event_value) { - /* - * Configuring the thresholds to their extremes allows the host to get an - * event from the target which is used for the configuring the correct - * thresholds - */ - rssiCmd->thresholdAbove1_Val = sq_thresh->upper_threshold[0]; - rssiCmd->thresholdBelow1_Val = sq_thresh->lower_threshold[0]; - } else { - /* - * In case the user issues multiple times of rssi_threshold_setting, - * we should not use the extreames anymore, the target does not expect that. - */ - rssiCmd->thresholdAbove1_Val = ar6000_get_upper_threshold(rssi_event_value, sq_thresh, - sq_thresh->upper_threshold_valid_count); - rssiCmd->thresholdBelow1_Val = ar6000_get_lower_threshold(rssi_event_value, sq_thresh, - sq_thresh->lower_threshold_valid_count); -} -} - -A_STATUS -wmi_set_rssi_threshold_params(struct wmi_t *wmip, - WMI_RSSI_THRESHOLD_PARAMS_CMD *rssiCmd) -{ - - /* Check these values are in ascending order */ - if( rssiCmd->thresholdAbove6_Val <= rssiCmd->thresholdAbove5_Val || - rssiCmd->thresholdAbove5_Val <= rssiCmd->thresholdAbove4_Val || - rssiCmd->thresholdAbove4_Val <= rssiCmd->thresholdAbove3_Val || - rssiCmd->thresholdAbove3_Val <= rssiCmd->thresholdAbove2_Val || - rssiCmd->thresholdAbove2_Val <= rssiCmd->thresholdAbove1_Val || - rssiCmd->thresholdBelow6_Val <= rssiCmd->thresholdBelow5_Val || - rssiCmd->thresholdBelow5_Val <= rssiCmd->thresholdBelow4_Val || - rssiCmd->thresholdBelow4_Val <= rssiCmd->thresholdBelow3_Val || - rssiCmd->thresholdBelow3_Val <= rssiCmd->thresholdBelow2_Val || - rssiCmd->thresholdBelow2_Val <= rssiCmd->thresholdBelow1_Val) - { - return A_EINVAL; - } - - wmi_cache_configure_rssithreshold(wmip, rssiCmd); - - return (wmi_send_rssi_threshold_params(wmip, rssiCmd)); -} - -A_STATUS -wmi_set_ip_cmd(struct wmi_t *wmip, WMI_SET_IP_CMD *ipCmd) -{ - void *osbuf; - WMI_SET_IP_CMD *cmd; - A_STATUS status; - - /* Multicast address are not valid */ - if((*((A_UINT8*)&ipCmd->ips[0]) >= 0xE0) || - (*((A_UINT8*)&ipCmd->ips[1]) >= 0xE0)) { - return A_EINVAL; - } - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_SET_IP_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_SET_IP_CMD)); - cmd = (WMI_SET_IP_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMCPY(cmd, ipCmd, sizeof(WMI_SET_IP_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_IP_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_host_sleep_mode_cmd(struct wmi_t *wmip, - WMI_SET_HOST_SLEEP_MODE_CMD *hostModeCmd) -{ - void *osbuf; - A_INT8 size; - WMI_SET_HOST_SLEEP_MODE_CMD *cmd; - A_UINT16 activeTsids=0; - A_UINT8 streamExists=0; - A_UINT8 i; - A_STATUS status; - - if( hostModeCmd->awake == hostModeCmd->asleep) { - return A_EINVAL; - } - - size = sizeof (*cmd); - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, size); - - cmd = (WMI_SET_HOST_SLEEP_MODE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, size); - A_MEMCPY(cmd, hostModeCmd, sizeof(WMI_SET_HOST_SLEEP_MODE_CMD)); - - if(hostModeCmd->asleep) { - /* - * Relinquish credits from all implicitly created pstreams since when we - * go to sleep. If user created explicit thinstreams exists with in a - * fatpipe leave them intact for the user to delete - */ - LOCK_WMI(pWmiPriv); - streamExists = pWmiPriv->wmi_fatPipeExists; - UNLOCK_WMI(pWmiPriv); - - for(i=0;i< WMM_NUM_AC;i++) { - if (streamExists & (1<wmi_streamExistsForAC[i]; - UNLOCK_WMI(pWmiPriv); - /* If there are no user created thin streams delete the fatpipe */ - if(!activeTsids) { - streamExists &= ~(1<wmi_devt,i); - } - } - } - - /* Update the fatpipes that exists*/ - LOCK_WMI(pWmiPriv); - pWmiPriv->wmi_fatPipeExists = streamExists; - UNLOCK_WMI(pWmiPriv); - } - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_HOST_SLEEP_MODE_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_wow_mode_cmd(struct wmi_t *wmip, - WMI_SET_WOW_MODE_CMD *wowModeCmd) -{ - void *osbuf; - A_INT8 size; - WMI_SET_WOW_MODE_CMD *cmd; - A_STATUS status; - - size = sizeof (*cmd); - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, size); - - cmd = (WMI_SET_WOW_MODE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, size); - A_MEMCPY(cmd, wowModeCmd, sizeof(WMI_SET_WOW_MODE_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_WOW_MODE_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_get_wow_list_cmd(struct wmi_t *wmip, - WMI_GET_WOW_LIST_CMD *wowListCmd) -{ - void *osbuf; - A_INT8 size; - WMI_GET_WOW_LIST_CMD *cmd; - A_STATUS status; - - size = sizeof (*cmd); - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, size); - - cmd = (WMI_GET_WOW_LIST_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, size); - A_MEMCPY(cmd, wowListCmd, sizeof(WMI_GET_WOW_LIST_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_GET_WOW_LIST_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -static A_STATUS -wmi_get_wow_list_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_GET_WOW_LIST_REPLY *reply; - - if (len < sizeof(WMI_GET_WOW_LIST_REPLY)) { - return A_EINVAL; - } - reply = (WMI_GET_WOW_LIST_REPLY *)datap; - - A_WMI_WOW_LIST_EVENT(wmip->wmi_devt, reply->num_filters, - reply); - - return A_OK; -} - -A_STATUS wmi_add_wow_pattern_cmd(struct wmi_t *wmip, - WMI_ADD_WOW_PATTERN_CMD *addWowCmd, - A_UINT8* pattern, A_UINT8* mask, - A_UINT8 pattern_size) -{ - void *osbuf; - A_INT8 size; - WMI_ADD_WOW_PATTERN_CMD *cmd; - A_UINT8 *filter_mask = NULL; - A_STATUS status; - - size = sizeof (*cmd); - - size += ((2 * addWowCmd->filter_size)* sizeof(A_UINT8)); - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, size); - - cmd = (WMI_ADD_WOW_PATTERN_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->filter_list_id = addWowCmd->filter_list_id; - cmd->filter_offset = addWowCmd->filter_offset; - cmd->filter_size = addWowCmd->filter_size; - - A_MEMCPY(cmd->filter, pattern, addWowCmd->filter_size); - - filter_mask = (A_UINT8*)(cmd->filter + cmd->filter_size); - A_MEMCPY(filter_mask, mask, addWowCmd->filter_size); - - - status = wmi_cmd_send(wmip, osbuf, WMI_ADD_WOW_PATTERN_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_del_wow_pattern_cmd(struct wmi_t *wmip, - WMI_DEL_WOW_PATTERN_CMD *delWowCmd) -{ - void *osbuf; - A_INT8 size; - WMI_DEL_WOW_PATTERN_CMD *cmd; - A_STATUS status; - - size = sizeof (*cmd); - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, size); - - cmd = (WMI_DEL_WOW_PATTERN_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, size); - A_MEMCPY(cmd, delWowCmd, sizeof(WMI_DEL_WOW_PATTERN_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_DEL_WOW_PATTERN_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -void -wmi_cache_configure_snrthreshold(struct wmi_t *wmip, WMI_SNR_THRESHOLD_PARAMS_CMD *snrCmd) -{ - SQ_THRESHOLD_PARAMS *sq_thresh = - &wmip->wmi_SqThresholdParams[SIGNAL_QUALITY_METRICS_SNR]; - /* - * Parse the command and store the threshold values here. The checks - * for valid values can be put here - */ - sq_thresh->weight = snrCmd->weight; - sq_thresh->polling_interval = snrCmd->pollTime; - - sq_thresh->upper_threshold[0] = snrCmd->thresholdAbove1_Val; - sq_thresh->upper_threshold[1] = snrCmd->thresholdAbove2_Val; - sq_thresh->upper_threshold[2] = snrCmd->thresholdAbove3_Val; - sq_thresh->upper_threshold[3] = snrCmd->thresholdAbove4_Val; - sq_thresh->upper_threshold_valid_count = 4; - - /* List sorted in descending order */ - sq_thresh->lower_threshold[0] = snrCmd->thresholdBelow4_Val; - sq_thresh->lower_threshold[1] = snrCmd->thresholdBelow3_Val; - sq_thresh->lower_threshold[2] = snrCmd->thresholdBelow2_Val; - sq_thresh->lower_threshold[3] = snrCmd->thresholdBelow1_Val; - sq_thresh->lower_threshold_valid_count = 4; - - if (!snr_event_value) { - /* - * Configuring the thresholds to their extremes allows the host to get an - * event from the target which is used for the configuring the correct - * thresholds - */ - snrCmd->thresholdAbove1_Val = (A_UINT8)sq_thresh->upper_threshold[0]; - snrCmd->thresholdBelow1_Val = (A_UINT8)sq_thresh->lower_threshold[0]; - } else { - /* - * In case the user issues multiple times of snr_threshold_setting, - * we should not use the extreames anymore, the target does not expect that. - */ - snrCmd->thresholdAbove1_Val = ar6000_get_upper_threshold(snr_event_value, sq_thresh, - sq_thresh->upper_threshold_valid_count); - snrCmd->thresholdBelow1_Val = ar6000_get_lower_threshold(snr_event_value, sq_thresh, - sq_thresh->lower_threshold_valid_count); - } - -} -A_STATUS -wmi_set_snr_threshold_params(struct wmi_t *wmip, - WMI_SNR_THRESHOLD_PARAMS_CMD *snrCmd) -{ - if( snrCmd->thresholdAbove4_Val <= snrCmd->thresholdAbove3_Val || - snrCmd->thresholdAbove3_Val <= snrCmd->thresholdAbove2_Val || - snrCmd->thresholdAbove2_Val <= snrCmd->thresholdAbove1_Val || - snrCmd->thresholdBelow4_Val <= snrCmd->thresholdBelow3_Val || - snrCmd->thresholdBelow3_Val <= snrCmd->thresholdBelow2_Val || - snrCmd->thresholdBelow2_Val <= snrCmd->thresholdBelow1_Val) - { - return A_EINVAL; - } - wmi_cache_configure_snrthreshold(wmip, snrCmd); - return (wmi_send_snr_threshold_params(wmip, snrCmd)); -} - -A_STATUS -wmi_clr_rssi_snr(struct wmi_t *wmip) -{ - void *osbuf; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(int)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - status = wmi_cmd_send(wmip, osbuf, WMI_CLR_RSSI_SNR_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_lq_threshold_params(struct wmi_t *wmip, - WMI_LQ_THRESHOLD_PARAMS_CMD *lqCmd) -{ - void *osbuf; - A_INT8 size; - WMI_LQ_THRESHOLD_PARAMS_CMD *cmd; - A_STATUS status; - /* These values are in ascending order */ - if( lqCmd->thresholdAbove4_Val <= lqCmd->thresholdAbove3_Val || - lqCmd->thresholdAbove3_Val <= lqCmd->thresholdAbove2_Val || - lqCmd->thresholdAbove2_Val <= lqCmd->thresholdAbove1_Val || - lqCmd->thresholdBelow4_Val <= lqCmd->thresholdBelow3_Val || - lqCmd->thresholdBelow3_Val <= lqCmd->thresholdBelow2_Val || - lqCmd->thresholdBelow2_Val <= lqCmd->thresholdBelow1_Val ) { - - return A_EINVAL; - } - - size = sizeof (*cmd); - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, size); - - cmd = (WMI_LQ_THRESHOLD_PARAMS_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, size); - A_MEMCPY(cmd, lqCmd, sizeof(WMI_LQ_THRESHOLD_PARAMS_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_LQ_THRESHOLD_PARAMS_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_error_report_bitmask(struct wmi_t *wmip, A_UINT32 mask) -{ - void *osbuf; - A_INT8 size; - WMI_TARGET_ERROR_REPORT_BITMASK *cmd; - A_STATUS status; - - size = sizeof (*cmd); - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, size); - - cmd = (WMI_TARGET_ERROR_REPORT_BITMASK *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, size); - - cmd->bitmask = mask; - - status = wmi_cmd_send(wmip, osbuf, WMI_TARGET_ERROR_REPORT_BITMASK_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_get_challenge_resp_cmd(struct wmi_t *wmip, A_UINT32 cookie, A_UINT32 source) -{ - void *osbuf; - WMIX_HB_CHALLENGE_RESP_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMIX_HB_CHALLENGE_RESP_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->cookie = cookie; - cmd->source = source; - - status = wmi_cmd_send_xtnd(wmip, osbuf, WMIX_HB_CHALLENGE_RESP_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_config_debug_module_cmd(struct wmi_t *wmip, A_UINT16 mmask, - A_UINT16 tsr, A_BOOL rep, A_UINT16 size, - A_UINT32 valid) -{ - void *osbuf; - WMIX_DBGLOG_CFG_MODULE_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMIX_DBGLOG_CFG_MODULE_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->config.cfgmmask = mmask; - cmd->config.cfgtsr = tsr; - cmd->config.cfgrep = rep; - cmd->config.cfgsize = size; - cmd->config.cfgvalid = valid; - - status = wmi_cmd_send_xtnd(wmip, osbuf, WMIX_DBGLOG_CFG_MODULE_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_get_stats_cmd(struct wmi_t *wmip) -{ - return wmi_simple_cmd(wmip, WMI_GET_STATISTICS_CMDID); -} - -A_STATUS -wmi_addBadAp_cmd(struct wmi_t *wmip, A_UINT8 apIndex, A_UINT8 *bssid) -{ - void *osbuf; - WMI_ADD_BAD_AP_CMD *cmd; - A_STATUS status; - - if ((bssid == NULL) || (apIndex > WMI_MAX_BAD_AP_INDEX)) { - return A_EINVAL; - } - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_ADD_BAD_AP_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->badApIndex = apIndex; - A_MEMCPY(cmd->bssid, bssid, sizeof(cmd->bssid)); - - status = wmi_cmd_send(wmip, osbuf, WMI_ADD_BAD_AP_CMDID, SYNC_BEFORE_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_deleteBadAp_cmd(struct wmi_t *wmip, A_UINT8 apIndex) -{ - void *osbuf; - WMI_DELETE_BAD_AP_CMD *cmd; - A_STATUS status; - - if (apIndex > WMI_MAX_BAD_AP_INDEX) { - return A_EINVAL; - } - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_DELETE_BAD_AP_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->badApIndex = apIndex; - - status = wmi_cmd_send(wmip, osbuf, WMI_DELETE_BAD_AP_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_abort_scan_cmd(struct wmi_t *wmip) -{ - return wmi_simple_cmd(wmip, WMI_ABORT_SCAN_CMDID); -} - -A_STATUS -wmi_set_txPwr_cmd(struct wmi_t *wmip, A_UINT8 dbM) -{ - void *osbuf; - WMI_SET_TX_PWR_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_TX_PWR_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->dbM = dbM; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_TX_PWR_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_get_txPwr_cmd(struct wmi_t *wmip) -{ - return wmi_simple_cmd(wmip, WMI_GET_TX_PWR_CMDID); -} - -A_UINT16 -wmi_get_mapped_qos_queue(struct wmi_t *wmip, A_UINT8 trafficClass) -{ - A_UINT16 activeTsids=0; - - LOCK_WMI(pWmiPriv); - activeTsids = pWmiPriv->wmi_streamExistsForAC[trafficClass]; - UNLOCK_WMI(pWmiPriv); - - return activeTsids; -} - -A_STATUS -wmi_get_roam_tbl_cmd(struct wmi_t *wmip) -{ - return wmi_simple_cmd(wmip, WMI_GET_ROAM_TBL_CMDID); -} - -A_STATUS -wmi_get_roam_data_cmd(struct wmi_t *wmip, A_UINT8 roamDataType) -{ - void *osbuf; - A_UINT32 size = sizeof(A_UINT8); - WMI_TARGET_ROAM_DATA *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(size); /* no payload */ - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, size); - - cmd = (WMI_TARGET_ROAM_DATA *)(A_NETBUF_DATA(osbuf)); - cmd->roamDataType = roamDataType; - - status = wmi_cmd_send(wmip, osbuf, WMI_GET_ROAM_DATA_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_roam_ctrl_cmd(struct wmi_t *wmip, WMI_SET_ROAM_CTRL_CMD *p, - A_UINT8 size) -{ - void *osbuf; - WMI_SET_ROAM_CTRL_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, size); - - cmd = (WMI_SET_ROAM_CTRL_CMD *)(A_NETBUF_DATA(osbuf)); - - if (size) - { - A_MEMZERO(cmd, size); - A_MEMCPY(cmd, p, size); - } - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_ROAM_CTRL_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_powersave_timers_cmd(struct wmi_t *wmip, - WMI_POWERSAVE_TIMERS_POLICY_CMD *pCmd, - A_UINT8 size) -{ - void *osbuf; - WMI_POWERSAVE_TIMERS_POLICY_CMD *cmd; - A_STATUS status; - - /* These timers can't be zero */ - if(!pCmd->psPollTimeout || !pCmd->triggerTimeout || - !(pCmd->apsdTimPolicy == IGNORE_TIM_ALL_QUEUES_APSD || - pCmd->apsdTimPolicy == PROCESS_TIM_ALL_QUEUES_APSD) || - !(pCmd->simulatedAPSDTimPolicy == IGNORE_TIM_SIMULATED_APSD || - pCmd->simulatedAPSDTimPolicy == PROCESS_TIM_SIMULATED_APSD)) - return A_EINVAL; - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, size); - - cmd = (WMI_POWERSAVE_TIMERS_POLICY_CMD *)(A_NETBUF_DATA(osbuf)); - - if (size) - { - A_MEMZERO(cmd, size); - A_MEMCPY(cmd, pCmd, size); - } - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_POWERSAVE_TIMERS_POLICY_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -#ifdef CONFIG_HOST_GPIO_SUPPORT -/* Send a command to Target to change GPIO output pins. */ -A_STATUS -wmi_gpio_output_set(struct wmi_t *wmip, - A_UINT32 set_mask, - A_UINT32 clear_mask, - A_UINT32 enable_mask, - A_UINT32 disable_mask) -{ - void *osbuf; - WMIX_GPIO_OUTPUT_SET_CMD *output_set; - int size; - A_STATUS status; - - size = sizeof(*output_set); - - A_DPRINTF(DBG_WMI, - (DBGFMT "Enter - set=0x%x clear=0x%x enb=0x%x dis=0x%x\n", DBGARG, - set_mask, clear_mask, enable_mask, disable_mask)); - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, size); - output_set = (WMIX_GPIO_OUTPUT_SET_CMD *)(A_NETBUF_DATA(osbuf)); - - output_set->set_mask = set_mask; - output_set->clear_mask = clear_mask; - output_set->enable_mask = enable_mask; - output_set->disable_mask = disable_mask; - - status = wmi_cmd_send_xtnd(wmip, osbuf, WMIX_GPIO_OUTPUT_SET_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -/* Send a command to the Target requesting state of the GPIO input pins */ -A_STATUS -wmi_gpio_input_get(struct wmi_t *wmip) -{ - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - return wmi_simple_cmd_xtnd(wmip, WMIX_GPIO_INPUT_GET_CMDID); -} - -/* Send a command to the Target that changes the value of a GPIO register. */ -A_STATUS -wmi_gpio_register_set(struct wmi_t *wmip, - A_UINT32 gpioreg_id, - A_UINT32 value) -{ - void *osbuf; - WMIX_GPIO_REGISTER_SET_CMD *register_set; - int size; - A_STATUS status; - - size = sizeof(*register_set); - - A_DPRINTF(DBG_WMI, - (DBGFMT "Enter - reg=%d value=0x%x\n", DBGARG, gpioreg_id, value)); - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, size); - register_set = (WMIX_GPIO_REGISTER_SET_CMD *)(A_NETBUF_DATA(osbuf)); - - register_set->gpioreg_id = gpioreg_id; - register_set->value = value; - - status = wmi_cmd_send_xtnd(wmip, osbuf, WMIX_GPIO_REGISTER_SET_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -/* Send a command to the Target to fetch the value of a GPIO register. */ -A_STATUS -wmi_gpio_register_get(struct wmi_t *wmip, - A_UINT32 gpioreg_id) -{ - void *osbuf; - WMIX_GPIO_REGISTER_GET_CMD *register_get; - int size; - A_STATUS status; - - size = sizeof(*register_get); - - A_DPRINTF(DBG_WMI, (DBGFMT "Enter - reg=%d\n", DBGARG, gpioreg_id)); - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, size); - register_get = (WMIX_GPIO_REGISTER_GET_CMD *)(A_NETBUF_DATA(osbuf)); - - register_get->gpioreg_id = gpioreg_id; - - status = wmi_cmd_send_xtnd(wmip, osbuf, WMIX_GPIO_REGISTER_GET_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -/* Send a command to the Target acknowledging some GPIO interrupts. */ -A_STATUS -wmi_gpio_intr_ack(struct wmi_t *wmip, - A_UINT32 ack_mask) -{ - void *osbuf; - WMIX_GPIO_INTR_ACK_CMD *intr_ack; - int size; - A_STATUS status; - - size = sizeof(*intr_ack); - - A_DPRINTF(DBG_WMI, (DBGFMT "Enter ack_mask=0x%x\n", DBGARG, ack_mask)); - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, size); - intr_ack = (WMIX_GPIO_INTR_ACK_CMD *)(A_NETBUF_DATA(osbuf)); - - intr_ack->ack_mask = ack_mask; - - status = wmi_cmd_send_xtnd(wmip, osbuf, WMIX_GPIO_INTR_ACK_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} -#endif /* CONFIG_HOST_GPIO_SUPPORT */ - -A_STATUS -wmi_set_access_params_cmd(struct wmi_t *wmip, A_UINT8 ac, A_UINT16 txop, A_UINT8 eCWmin, - A_UINT8 eCWmax, A_UINT8 aifsn) -{ - void *osbuf; - WMI_SET_ACCESS_PARAMS_CMD *cmd; - A_STATUS status; - - if ((eCWmin > WMI_MAX_CW_ACPARAM) || (eCWmax > WMI_MAX_CW_ACPARAM) || - (aifsn > WMI_MAX_AIFSN_ACPARAM) || (ac >= WMM_NUM_AC)) - { - return A_EINVAL; - } - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_ACCESS_PARAMS_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->txop = txop; - cmd->eCWmin = eCWmin; - cmd->eCWmax = eCWmax; - cmd->aifsn = aifsn; - cmd->ac = ac; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_ACCESS_PARAMS_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_retry_limits_cmd(struct wmi_t *wmip, A_UINT8 frameType, - A_UINT8 trafficClass, A_UINT8 maxRetries, - A_UINT8 enableNotify) -{ - void *osbuf; - WMI_SET_RETRY_LIMITS_CMD *cmd; - A_STATUS status; - - if ((frameType != MGMT_FRAMETYPE) && (frameType != CONTROL_FRAMETYPE) && - (frameType != DATA_FRAMETYPE)) - { - return A_EINVAL; - } - - if (maxRetries > WMI_MAX_RETRIES) { - return A_EINVAL; - } - - if (frameType != DATA_FRAMETYPE) { - trafficClass = 0; - } - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_RETRY_LIMITS_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->frameType = frameType; - cmd->trafficClass = trafficClass; - cmd->maxRetries = maxRetries; - cmd->enableNotify = enableNotify; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_RETRY_LIMITS_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -void -wmi_get_current_bssid(struct wmi_t *wmip, A_UINT8 *bssid) -{ - if (bssid != NULL) { - A_MEMCPY(bssid, wmip->wmi_bssid, ATH_MAC_LEN); - } -} - -A_STATUS -wmi_set_adhoc_bconIntvl_cmd(struct wmi_t *wmip, A_UINT16 intvl) -{ - void *osbuf; - WMI_BEACON_INT_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_BEACON_INT_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->beaconInterval = intvl; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_BEACON_INT_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - - -A_STATUS -wmi_set_voice_pkt_size_cmd(struct wmi_t *wmip, A_UINT16 voicePktSize) -{ - void *osbuf; - WMI_SET_VOICE_PKT_SIZE_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_VOICE_PKT_SIZE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->voicePktSize = voicePktSize; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_VOICE_PKT_SIZE_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - - -A_STATUS -wmi_set_max_sp_len_cmd(struct wmi_t *wmip, A_UINT8 maxSPLen) -{ - void *osbuf; - WMI_SET_MAX_SP_LEN_CMD *cmd; - A_STATUS status; - - /* maxSPLen is a two-bit value. If user trys to set anything - * other than this, then its invalid - */ - if(maxSPLen & ~0x03) - return A_EINVAL; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_MAX_SP_LEN_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->maxSPLen = maxSPLen; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_MAX_SP_LEN_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_UINT8 -wmi_determine_userPriority( - A_UINT8 *pkt, - A_UINT32 layer2Pri) -{ - A_UINT8 ipPri; - iphdr *ipHdr = (iphdr *)pkt; - - /* Determine IPTOS priority */ - /* - * IP Tos format : - * (Refer Pg 57 WMM-test-plan-v1.2) - * IP-TOS - 8bits - * : DSCP(6-bits) ECN(2-bits) - * : DSCP - P2 P1 P0 X X X - * where (P2 P1 P0) form 802.1D - */ - ipPri = ipHdr->ip_tos >> 5; - ipPri &= 0x7; - - if ((layer2Pri & 0x7) > ipPri) - return ((A_UINT8)layer2Pri & 0x7); - else - return ipPri; -} - -A_UINT8 -convert_userPriority_to_trafficClass(A_UINT8 userPriority) -{ - return (up_to_ac[userPriority & 0x7]); -} - -A_UINT8 -wmi_get_power_mode_cmd(struct wmi_t *wmip) -{ - return wmip->wmi_powerMode; -} - -A_STATUS -wmi_verify_tspec_params(WMI_CREATE_PSTREAM_CMD *pCmd, A_BOOL tspecCompliance) -{ - A_STATUS ret = A_OK; - -#define TSPEC_SUSPENSION_INTERVAL_ATHEROS_DEF (~0) -#define TSPEC_SERVICE_START_TIME_ATHEROS_DEF 0 -#define TSPEC_MAX_BURST_SIZE_ATHEROS_DEF 0 -#define TSPEC_DELAY_BOUND_ATHEROS_DEF 0 -#define TSPEC_MEDIUM_TIME_ATHEROS_DEF 0 -#define TSPEC_SBA_ATHEROS_DEF 0x2000 /* factor is 1 */ - - /* Verify TSPEC params for ATHEROS compliance */ - if(tspecCompliance == ATHEROS_COMPLIANCE) { - if ((pCmd->suspensionInt != TSPEC_SUSPENSION_INTERVAL_ATHEROS_DEF) || - (pCmd->serviceStartTime != TSPEC_SERVICE_START_TIME_ATHEROS_DEF) || - (pCmd->minDataRate != pCmd->meanDataRate) || - (pCmd->minDataRate != pCmd->peakDataRate) || - (pCmd->maxBurstSize != TSPEC_MAX_BURST_SIZE_ATHEROS_DEF) || - (pCmd->delayBound != TSPEC_DELAY_BOUND_ATHEROS_DEF) || - (pCmd->sba != TSPEC_SBA_ATHEROS_DEF) || - (pCmd->mediumTime != TSPEC_MEDIUM_TIME_ATHEROS_DEF)) { - - A_DPRINTF(DBG_WMI, (DBGFMT "Invalid TSPEC params\n", DBGARG)); - //A_PRINTF("%s: Invalid TSPEC params\n", __func__); - ret = A_EINVAL; - } - } - - return ret; -} - -#ifdef CONFIG_HOST_TCMD_SUPPORT -static A_STATUS -wmi_tcmd_test_report_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_TCMD_RX_REPORT_EVENT(wmip->wmi_devt, datap, len); - - return A_OK; -} - -#endif /* CONFIG_HOST_TCMD_SUPPORT*/ - -A_STATUS -wmi_set_authmode_cmd(struct wmi_t *wmip, A_UINT8 mode) -{ - void *osbuf; - WMI_SET_AUTH_MODE_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_AUTH_MODE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->mode = mode; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_AUTH_MODE_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_reassocmode_cmd(struct wmi_t *wmip, A_UINT8 mode) -{ - void *osbuf; - WMI_SET_REASSOC_MODE_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_REASSOC_MODE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->mode = mode; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_REASSOC_MODE_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_lpreamble_cmd(struct wmi_t *wmip, A_UINT8 status, A_UINT8 preamblePolicy) -{ - void *osbuf; - WMI_SET_LPREAMBLE_CMD *cmd; - A_STATUS wmi_cmd_send_status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_LPREAMBLE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->status = status; - cmd->preamblePolicy = preamblePolicy; - - wmi_cmd_send_status = wmi_cmd_send(wmip, osbuf, WMI_SET_LPREAMBLE_CMDID, - NO_SYNC_WMIFLAG); - - if (wmi_cmd_send_status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return wmi_cmd_send_status; -} - -A_STATUS -wmi_set_rts_cmd(struct wmi_t *wmip, A_UINT16 threshold) -{ - void *osbuf; - WMI_SET_RTS_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_RTS_CMD*)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->threshold = threshold; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_RTS_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_wmm_cmd(struct wmi_t *wmip, WMI_WMM_STATUS status) -{ - void *osbuf; - WMI_SET_WMM_CMD *cmd; - A_STATUS wmi_cmd_send_status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_WMM_CMD*)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->status = status; - - wmi_cmd_send_status = wmi_cmd_send(wmip, osbuf, WMI_SET_WMM_CMDID, - NO_SYNC_WMIFLAG); - - if (wmi_cmd_send_status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return wmi_cmd_send_status; -} - -A_STATUS -wmi_set_qos_supp_cmd(struct wmi_t *wmip, A_UINT8 status) -{ - void *osbuf; - WMI_SET_QOS_SUPP_CMD *cmd; - A_STATUS wmi_cmd_send_status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_QOS_SUPP_CMD*)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->status = status; - wmi_cmd_send_status = wmi_cmd_send(wmip, osbuf, WMI_SET_QOS_SUPP_CMDID, - NO_SYNC_WMIFLAG); - - if (wmi_cmd_send_status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return wmi_cmd_send_status; -} - - -A_STATUS -wmi_set_wmm_txop(struct wmi_t *wmip, WMI_TXOP_CFG cfg) -{ - void *osbuf; - WMI_SET_WMM_TXOP_CMD *cmd; - A_STATUS status; - - if( !((cfg == WMI_TXOP_DISABLED) || (cfg == WMI_TXOP_ENABLED)) ) - return A_EINVAL; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_WMM_TXOP_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->txopEnable = cfg; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_WMM_TXOP_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_country(struct wmi_t *wmip, A_UCHAR *countryCode) -{ - void *osbuf; - WMI_AP_SET_COUNTRY_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_AP_SET_COUNTRY_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - A_MEMCPY(cmd->countryCode,countryCode,3); - - status = wmi_cmd_send(wmip, osbuf, WMI_AP_SET_COUNTRY_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -#ifdef CONFIG_HOST_TCMD_SUPPORT -/* WMI layer doesn't need to know the data type of the test cmd. - This would be beneficial for customers like Qualcomm, who might - have different test command requirements from differnt manufacturers - */ -A_STATUS -wmi_test_cmd(struct wmi_t *wmip, A_UINT8 *buf, A_UINT32 len) -{ - void *osbuf; - char *data; - A_STATUS status; - - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - osbuf= A_NETBUF_ALLOC(len); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, len); - data = A_NETBUF_DATA(osbuf); - A_MEMCPY(data, buf, len); - - status = wmi_cmd_send(wmip, osbuf, WMI_TEST_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -#endif - -A_STATUS -wmi_set_bt_status_cmd(struct wmi_t *wmip, A_UINT8 streamType, A_UINT8 status) -{ - void *osbuf; - WMI_SET_BT_STATUS_CMD *cmd; - A_STATUS wmi_cmd_send_status; - - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, ("Enter - streamType=%d, status=%d\n", streamType, status)); - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_BT_STATUS_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->streamType = streamType; - cmd->status = status; - - wmi_cmd_send_status = wmi_cmd_send(wmip, osbuf, WMI_SET_BT_STATUS_CMDID, - NO_SYNC_WMIFLAG); - - if (wmi_cmd_send_status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return wmi_cmd_send_status; -} - -A_STATUS -wmi_set_bt_params_cmd(struct wmi_t *wmip, WMI_SET_BT_PARAMS_CMD* cmd) -{ - void *osbuf; - WMI_SET_BT_PARAMS_CMD* alloc_cmd; - A_STATUS status; - - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, ("cmd params is %d\n", cmd->paramType)); - - if (cmd->paramType == BT_PARAM_SCO) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, ("sco params %d %d %d %d %d %d %d %d %d %d %d %d\n", cmd->info.scoParams.numScoCyclesForceTrigger, - cmd->info.scoParams.dataResponseTimeout, - cmd->info.scoParams.stompScoRules, - cmd->info.scoParams.scoOptFlags, - cmd->info.scoParams.stompDutyCyleVal, - cmd->info.scoParams.stompDutyCyleMaxVal, - cmd->info.scoParams.psPollLatencyFraction, - cmd->info.scoParams.noSCOSlots, - cmd->info.scoParams.noIdleSlots, - cmd->info.scoParams.scoOptOffRssi, - cmd->info.scoParams.scoOptOnRssi, - cmd->info.scoParams.scoOptRtsCount)); - } - else if (cmd->paramType == BT_PARAM_A2DP) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, ("A2DP params %d %d %d %d %d %d %d %d\n", cmd->info.a2dpParams.a2dpWlanUsageLimit, - cmd->info.a2dpParams.a2dpBurstCntMin, - cmd->info.a2dpParams.a2dpDataRespTimeout, - cmd->info.a2dpParams.a2dpOptFlags, - cmd->info.a2dpParams.isCoLocatedBtRoleMaster, - cmd->info.a2dpParams.a2dpOptOffRssi, - cmd->info.a2dpParams.a2dpOptOnRssi, - cmd->info.a2dpParams.a2dpOptRtsCount)); - } - else if (cmd->paramType == BT_PARAM_ANTENNA_CONFIG) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, ("Ant config %d\n", cmd->info.antType)); - } - else if (cmd->paramType == BT_PARAM_COLOCATED_BT_DEVICE) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, ("co-located BT %d\n", cmd->info.coLocatedBtDev)); - } - else if (cmd->paramType == BT_PARAM_ACLCOEX) { - AR_DEBUG_PRINTF(ATH_DEBUG_WARN, ("ACL params %d %d %d\n", cmd->info.aclCoexParams.aclWlanMediumUsageTime, - cmd->info.aclCoexParams.aclBtMediumUsageTime, - cmd->info.aclCoexParams.aclDataRespTimeout)); - } - else if (cmd->paramType == BT_PARAM_11A_SEPARATE_ANT) { - A_DPRINTF(DBG_WMI, (DBGFMT "11A ant\n", DBGARG)); - } - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - alloc_cmd = (WMI_SET_BT_PARAMS_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(alloc_cmd, sizeof(*cmd)); - A_MEMCPY(alloc_cmd, cmd, sizeof(*cmd)); - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_BT_PARAMS_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_btcoex_fe_ant_cmd(struct wmi_t *wmip, WMI_SET_BTCOEX_FE_ANT_CMD * cmd) -{ - void *osbuf; - WMI_SET_BTCOEX_FE_ANT_CMD *alloc_cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - alloc_cmd = (WMI_SET_BTCOEX_FE_ANT_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(alloc_cmd, sizeof(*cmd)); - A_MEMCPY(alloc_cmd,cmd,sizeof(WMI_SET_BTCOEX_FE_ANT_CMD)); - status = wmi_cmd_send(wmip, osbuf, WMI_SET_BTCOEX_FE_ANT_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - - -A_STATUS -wmi_set_btcoex_colocated_bt_dev_cmd(struct wmi_t *wmip, - WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD * cmd) -{ - void *osbuf; - WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD *alloc_cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - alloc_cmd = (WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(alloc_cmd, sizeof(*cmd)); - A_MEMCPY(alloc_cmd,cmd,sizeof(WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD)); - A_PRINTF("colocated bt = %d\n", alloc_cmd->btcoexCoLocatedBTdev); - status = wmi_cmd_send(wmip, osbuf, WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_btcoex_btinquiry_page_config_cmd(struct wmi_t *wmip, - WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD* cmd) -{ - void *osbuf; - WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD *alloc_cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - alloc_cmd = (WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(alloc_cmd, sizeof(*cmd)); - A_MEMCPY(alloc_cmd,cmd,sizeof(WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD)); - status = wmi_cmd_send(wmip, osbuf, WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_btcoex_sco_config_cmd(struct wmi_t *wmip, - WMI_SET_BTCOEX_SCO_CONFIG_CMD * cmd) -{ - void *osbuf; - WMI_SET_BTCOEX_SCO_CONFIG_CMD *alloc_cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - alloc_cmd = (WMI_SET_BTCOEX_SCO_CONFIG_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(alloc_cmd, sizeof(*cmd)); - A_MEMCPY(alloc_cmd,cmd,sizeof(WMI_SET_BTCOEX_SCO_CONFIG_CMD)); - status = wmi_cmd_send(wmip, osbuf, WMI_SET_BTCOEX_SCO_CONFIG_CMDID , - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_btcoex_a2dp_config_cmd(struct wmi_t *wmip, - WMI_SET_BTCOEX_A2DP_CONFIG_CMD * cmd) -{ - void *osbuf; - WMI_SET_BTCOEX_A2DP_CONFIG_CMD *alloc_cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - alloc_cmd = (WMI_SET_BTCOEX_A2DP_CONFIG_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(alloc_cmd, sizeof(*cmd)); - A_MEMCPY(alloc_cmd,cmd,sizeof(WMI_SET_BTCOEX_A2DP_CONFIG_CMD)); - status = wmi_cmd_send(wmip, osbuf, WMI_SET_BTCOEX_A2DP_CONFIG_CMDID , - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_btcoex_aclcoex_config_cmd(struct wmi_t *wmip, - WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD * cmd) -{ - void *osbuf; - WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD *alloc_cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - alloc_cmd = (WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(alloc_cmd, sizeof(*cmd)); - A_MEMCPY(alloc_cmd,cmd,sizeof(WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD)); - status = wmi_cmd_send(wmip, osbuf, WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMDID , - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_btcoex_debug_cmd(struct wmi_t *wmip, WMI_SET_BTCOEX_DEBUG_CMD * cmd) -{ - void *osbuf; - WMI_SET_BTCOEX_DEBUG_CMD *alloc_cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - alloc_cmd = (WMI_SET_BTCOEX_DEBUG_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(alloc_cmd, sizeof(*cmd)); - A_MEMCPY(alloc_cmd,cmd,sizeof(WMI_SET_BTCOEX_DEBUG_CMD)); - status = wmi_cmd_send(wmip, osbuf, WMI_SET_BTCOEX_DEBUG_CMDID , - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_btcoex_bt_operating_status_cmd(struct wmi_t * wmip, - WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD * cmd) -{ - void *osbuf; - WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD *alloc_cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - alloc_cmd = (WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(alloc_cmd, sizeof(*cmd)); - A_MEMCPY(alloc_cmd,cmd,sizeof(WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD)); - status = wmi_cmd_send(wmip, osbuf, WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID , - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_get_btcoex_config_cmd(struct wmi_t * wmip, WMI_GET_BTCOEX_CONFIG_CMD * cmd) -{ - void *osbuf; - WMI_GET_BTCOEX_CONFIG_CMD *alloc_cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - alloc_cmd = (WMI_GET_BTCOEX_CONFIG_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(alloc_cmd, sizeof(*cmd)); - A_MEMCPY(alloc_cmd,cmd,sizeof(WMI_GET_BTCOEX_CONFIG_CMD)); - status = wmi_cmd_send(wmip, osbuf, WMI_GET_BTCOEX_CONFIG_CMDID , - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_get_btcoex_stats_cmd(struct wmi_t *wmip) -{ - - return wmi_simple_cmd(wmip, WMI_GET_BTCOEX_STATS_CMDID); - -} - -A_STATUS -wmi_get_keepalive_configured(struct wmi_t *wmip) -{ - void *osbuf; - WMI_GET_KEEPALIVE_CMD *cmd; - A_STATUS status; - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - cmd = (WMI_GET_KEEPALIVE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - status = wmi_cmd_send(wmip, osbuf, WMI_GET_KEEPALIVE_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_UINT8 -wmi_get_keepalive_cmd(struct wmi_t *wmip) -{ - return wmip->wmi_keepaliveInterval; -} - -A_STATUS -wmi_set_keepalive_cmd(struct wmi_t *wmip, A_UINT8 keepaliveInterval) -{ - void *osbuf; - WMI_SET_KEEPALIVE_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_KEEPALIVE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->keepaliveInterval = keepaliveInterval; - wmip->wmi_keepaliveInterval = keepaliveInterval; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_KEEPALIVE_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_params_cmd(struct wmi_t *wmip, A_UINT32 opcode, A_UINT32 length, A_CHAR* buffer) -{ - void *osbuf; - WMI_SET_PARAMS_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd) + length); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd) + length); - - cmd = (WMI_SET_PARAMS_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->opcode = opcode; - cmd->length = length; - - if (length) - { - A_MEMCPY(cmd->buffer, buffer, length); - } - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_PARAMS_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - - -A_STATUS -wmi_set_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 *filter) -{ - void *osbuf; - A_BOOL mcast_ipv6 = FALSE; - WMI_SET_MCAST_FILTER_CMD *cmd; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - if(filter[0] == 0x33 && filter[1] == 0x33) { - mcast_ipv6 = TRUE; - } - else - { - if(filter[0] == 0x01 && filter[1] == 0x00 && filter[2] == 0x5e && filter[3] <= 0x7F) { - mcast_ipv6 = FALSE; - } - else { - return A_BAD_ADDRESS; - } - } - - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_MCAST_FILTER_CMD *)(A_NETBUF_DATA(osbuf)); - if(mcast_ipv6) { - cmd->multicast_mac[0] = 0x33; - cmd->multicast_mac[1] = 0x33; - cmd->multicast_mac[2] = filter[2]; - cmd->multicast_mac[3] = filter[3]; - } - else { - cmd->multicast_mac[0] = 0x01; - cmd->multicast_mac[1] = 0x00; - cmd->multicast_mac[2] = 0x5e; - cmd->multicast_mac[3] = filter[3]&0x7F; - } - cmd->multicast_mac[4] = filter[4]; - cmd->multicast_mac[5] = filter[5]; - - return (wmi_cmd_send(wmip, osbuf, WMI_SET_MCAST_FILTER_CMDID, - NO_SYNC_WMIFLAG)); -} - - -A_STATUS -wmi_del_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 *filter) -{ - void *osbuf; - A_BOOL mcast_ipv6 = FALSE; - WMI_SET_MCAST_FILTER_CMD *cmd; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - if(filter[0] == 0x33 && filter[1] == 0x33) { - mcast_ipv6 = TRUE; - } - else - { - if(filter[0] == 0x01 && filter[1] == 0x00 && filter[2] == 0x5e && filter[3] <= 0x7F) { - mcast_ipv6 = FALSE; - } - else { - return A_BAD_ADDRESS; - } - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_MCAST_FILTER_CMD *)(A_NETBUF_DATA(osbuf)); - if(mcast_ipv6) { - cmd->multicast_mac[0] = 0x33; - cmd->multicast_mac[1] = 0x33; - cmd->multicast_mac[2] = filter[2]; - cmd->multicast_mac[3] = filter[3]; - } - else { - cmd->multicast_mac[0] = 0x01; - cmd->multicast_mac[1] = 0x00; - cmd->multicast_mac[2] = 0x5e; - cmd->multicast_mac[3] = filter[3]&0x7F; - } - cmd->multicast_mac[4] = filter[4]; - cmd->multicast_mac[5] = filter[5]; - - return (wmi_cmd_send(wmip, osbuf, WMI_DEL_MCAST_FILTER_CMDID, - NO_SYNC_WMIFLAG)); -} - -A_STATUS -wmi_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 enable) -{ - void *osbuf; - WMI_MCAST_FILTER_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_MCAST_FILTER_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->enable = enable; - - status = wmi_cmd_send(wmip, osbuf, WMI_MCAST_FILTER_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_appie_cmd(struct wmi_t *wmip, A_UINT8 mgmtFrmType, A_UINT8 ieLen, - A_UINT8 *ieInfo) -{ - void *osbuf; - WMI_SET_APPIE_CMD *cmd; - A_UINT16 cmdLen; - A_STATUS status; - - cmdLen = sizeof(*cmd) + ieLen - 1; - osbuf = A_NETBUF_ALLOC(cmdLen); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, cmdLen); - - cmd = (WMI_SET_APPIE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, cmdLen); - - cmd->mgmtFrmType = mgmtFrmType; - cmd->ieLen = ieLen; - A_MEMCPY(cmd->ieInfo, ieInfo, ieLen); - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_APPIE_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_halparam_cmd(struct wmi_t *wmip, A_UINT8 *cmd, A_UINT16 dataLen) -{ - void *osbuf; - A_UINT8 *data; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(dataLen); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, dataLen); - - data = A_NETBUF_DATA(osbuf); - - A_MEMCPY(data, cmd, dataLen); - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_WHALPARAM_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_INT32 -wmi_get_rate(A_INT8 rateindex) -{ - if (rateindex == RATE_AUTO) { - return 0; - } else { - return(wmi_rateTable[(A_UINT32) rateindex][0]); - } -} - -void -wmi_node_return (struct wmi_t *wmip, bss_t *bss) -{ - if (NULL != bss) - { - wlan_node_return(&wmip->wmi_scan_table, bss); - } -} - -void -wmi_node_update_timestamp(struct wmi_t *wmip, bss_t *bss) -{ - if (NULL != bss) { - wlan_node_update_timestamp(&wmip->wmi_scan_table, bss); - } -} - -void wmi_setup_node(struct wmi_t *wmip, bss_t *bss, const A_UINT8 *bssid) -{ - wlan_setup_node(&wmip->wmi_scan_table, bss, bssid); -} - -bss_t *wmi_node_alloc(struct wmi_t *wmip, A_UINT8 len) -{ - return wlan_node_alloc(&wmip->wmi_scan_table, len); -} - -void -wmi_set_nodeage(struct wmi_t *wmip, A_UINT32 nodeAge) -{ - wlan_set_nodeage(&wmip->wmi_scan_table,nodeAge); -} - -bss_t * -wmi_find_Ssidnode (struct wmi_t *wmip, A_UCHAR *pSsid, - A_UINT32 ssidLength, A_BOOL bIsWPA2, A_BOOL bMatchSSID) -{ - bss_t *node = NULL; - node = wlan_find_Ssidnode (&wmip->wmi_scan_table, pSsid, - ssidLength, bIsWPA2, bMatchSSID); - return node; -} - - -void -wmi_free_allnodes(struct wmi_t *wmip) -{ - wlan_free_allnodes(&wmip->wmi_scan_table); -} - -bss_t * -wmi_find_node(struct wmi_t *wmip, const A_UINT8 *macaddr) -{ - bss_t *ni=NULL; - ni=wlan_find_node(&wmip->wmi_scan_table,macaddr); - return ni; -} - -void -wmi_free_node(struct wmi_t *wmip, const A_UINT8 *macaddr) -{ - bss_t *ni=NULL; - - ni=wlan_find_node(&wmip->wmi_scan_table,macaddr); - if (ni != NULL) { - wlan_node_reclaim(&wmip->wmi_scan_table, ni); - } - - return; -} - -A_STATUS -wmi_dset_open_reply(struct wmi_t *wmip, - A_UINT32 status, - A_UINT32 access_cookie, - A_UINT32 dset_size, - A_UINT32 dset_version, - A_UINT32 targ_handle, - A_UINT32 targ_reply_fn, - A_UINT32 targ_reply_arg) -{ - void *osbuf; - WMIX_DSETOPEN_REPLY_CMD *open_reply; - A_STATUS wmi_cmd_send_xtnd_status; - - A_DPRINTF(DBG_WMI, (DBGFMT "Enter - wmip=0x%lx\n", DBGARG, (unsigned long)wmip)); - - osbuf = A_NETBUF_ALLOC(sizeof(*open_reply)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*open_reply)); - open_reply = (WMIX_DSETOPEN_REPLY_CMD *)(A_NETBUF_DATA(osbuf)); - - open_reply->status = status; - open_reply->targ_dset_handle = targ_handle; - open_reply->targ_reply_fn = targ_reply_fn; - open_reply->targ_reply_arg = targ_reply_arg; - open_reply->access_cookie = access_cookie; - open_reply->size = dset_size; - open_reply->version = dset_version; - - wmi_cmd_send_xtnd_status = wmi_cmd_send_xtnd(wmip, osbuf, WMIX_DSETOPEN_REPLY_CMDID, - NO_SYNC_WMIFLAG); - - if (wmi_cmd_send_xtnd_status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return wmi_cmd_send_xtnd_status; -} - -static A_STATUS -wmi_get_pmkid_list_event_rx(struct wmi_t *wmip, A_UINT8 *datap, A_UINT32 len) -{ - WMI_PMKID_LIST_REPLY *reply; - A_UINT32 expected_len; - - if (len < sizeof(WMI_PMKID_LIST_REPLY)) { - return A_EINVAL; - } - reply = (WMI_PMKID_LIST_REPLY *)datap; - expected_len = sizeof(reply->numPMKID) + reply->numPMKID * WMI_PMKID_LEN; - - if (len < expected_len) { - return A_EINVAL; - } - - A_WMI_PMKID_LIST_EVENT(wmip->wmi_devt, reply->numPMKID, - reply->pmkidList, reply->bssidList[0]); - - return A_OK; -} - - -static A_STATUS -wmi_set_params_event_rx(struct wmi_t *wmip, A_UINT8 *datap, A_UINT32 len) -{ - WMI_SET_PARAMS_REPLY *reply; - - if (len < sizeof(WMI_SET_PARAMS_REPLY)) { - return A_EINVAL; - } - reply = (WMI_SET_PARAMS_REPLY *)datap; - - if (A_OK == reply->status) - { - - } - else - { - - } - - return A_OK; -} - - - -#ifdef CONFIG_HOST_DSET_SUPPORT -A_STATUS -wmi_dset_data_reply(struct wmi_t *wmip, - A_UINT32 status, - A_UINT8 *user_buf, - A_UINT32 length, - A_UINT32 targ_buf, - A_UINT32 targ_reply_fn, - A_UINT32 targ_reply_arg) -{ - void *osbuf; - WMIX_DSETDATA_REPLY_CMD *data_reply; - A_UINT32 size; - A_STATUS wmi_cmd_send_xtnd_status; - - size = sizeof(*data_reply) + length; - - if (size <= length) { - return A_ERROR; - } - - A_DPRINTF(DBG_WMI, - (DBGFMT "Enter - length=%d status=%d\n", DBGARG, length, status)); - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - A_NETBUF_PUT(osbuf, size); - data_reply = (WMIX_DSETDATA_REPLY_CMD *)(A_NETBUF_DATA(osbuf)); - - data_reply->status = status; - data_reply->targ_buf = targ_buf; - data_reply->targ_reply_fn = targ_reply_fn; - data_reply->targ_reply_arg = targ_reply_arg; - data_reply->length = length; - - if (status == A_OK) { - if (a_copy_from_user(data_reply->buf, user_buf, length)) { - A_NETBUF_FREE(osbuf); - return A_ERROR; - } - } - - wmi_cmd_send_xtnd_status = wmi_cmd_send_xtnd(wmip, osbuf, WMIX_DSETDATA_REPLY_CMDID, - NO_SYNC_WMIFLAG); - - if (wmi_cmd_send_xtnd_status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return wmi_cmd_send_xtnd_status; -} -#endif /* CONFIG_HOST_DSET_SUPPORT */ - -A_STATUS -wmi_set_wsc_status_cmd(struct wmi_t *wmip, A_UINT32 status) -{ - void *osbuf; - char *cmd; - A_STATUS wmi_cmd_send_status; - - wps_enable = status; -#ifdef AR6K_ALLOC_DEBUG - osbuf = a_netbuf_alloc(sizeof(1), __func__, __LINE__); -#else - osbuf = a_netbuf_alloc(sizeof(1)); -#endif - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - a_netbuf_put(osbuf, sizeof(1)); - - cmd = (char *)(a_netbuf_to_data(osbuf)); - - A_MEMZERO(cmd, sizeof(*cmd)); - cmd[0] = (status?1:0); - wmi_cmd_send_status = wmi_cmd_send(wmip, osbuf, WMI_SET_WSC_STATUS_CMDID, - NO_SYNC_WMIFLAG); - - if (wmi_cmd_send_status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return wmi_cmd_send_status; -} - -#if defined(CONFIG_TARGET_PROFILE_SUPPORT) -A_STATUS -wmi_prof_cfg_cmd(struct wmi_t *wmip, - A_UINT32 period, - A_UINT32 nbins) -{ - void *osbuf; - WMIX_PROF_CFG_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMIX_PROF_CFG_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->period = period; - cmd->nbins = nbins; - - status = wmi_cmd_send_xtnd(wmip, osbuf, WMIX_PROF_CFG_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_prof_addr_set_cmd(struct wmi_t *wmip, A_UINT32 addr) -{ - void *osbuf; - WMIX_PROF_ADDR_SET_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMIX_PROF_ADDR_SET_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->addr = addr; - - status = wmi_cmd_send_xtnd(wmip, osbuf, WMIX_PROF_ADDR_SET_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_prof_start_cmd(struct wmi_t *wmip) -{ - return wmi_simple_cmd_xtnd(wmip, WMIX_PROF_START_CMDID); -} - -A_STATUS -wmi_prof_stop_cmd(struct wmi_t *wmip) -{ - return wmi_simple_cmd_xtnd(wmip, WMIX_PROF_STOP_CMDID); -} - -A_STATUS -wmi_prof_count_get_cmd(struct wmi_t *wmip) -{ - return wmi_simple_cmd_xtnd(wmip, WMIX_PROF_COUNT_GET_CMDID); -} - -/* Called to handle WMIX_PROF_CONT_EVENTID */ -static A_STATUS -wmi_prof_count_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMIX_PROF_COUNT_EVENT *prof_data = (WMIX_PROF_COUNT_EVENT *)datap; - - A_DPRINTF(DBG_WMI, - (DBGFMT "Enter - addr=0x%x count=%d\n", DBGARG, - prof_data->addr, prof_data->count)); - - A_WMI_PROF_COUNT_RX(prof_data->addr, prof_data->count); - - return A_OK; -} -#endif /* CONFIG_TARGET_PROFILE_SUPPORT */ - -#ifdef OS_ROAM_MANAGEMENT - -#define ETHERNET_MAC_ADDRESS_LENGTH 6 - -void -wmi_scan_indication (struct wmi_t *wmip) -{ - struct ieee80211_node_table *nt; - A_UINT32 gen; - A_UINT32 size; - A_UINT32 bsssize; - bss_t *bss; - A_UINT32 numbss; - PNDIS_802_11_BSSID_SCAN_INFO psi; - PBYTE pie; - NDIS_802_11_FIXED_IEs *pFixed; - NDIS_802_11_VARIABLE_IEs *pVar; - A_UINT32 RateSize; - - struct ar6kScanIndication - { - NDIS_802_11_STATUS_INDICATION ind; - NDIS_802_11_BSSID_SCAN_INFO_LIST slist; - } *pAr6kScanIndEvent; - - nt = &wmip->wmi_scan_table; - - ++nt->nt_si_gen; - - - gen = nt->nt_si_gen; - - size = offsetof(struct ar6kScanIndication, slist) + - offsetof(NDIS_802_11_BSSID_SCAN_INFO_LIST, BssidScanInfo); - - numbss = 0; - - IEEE80211_NODE_LOCK(nt); - - //calc size - for (bss = nt->nt_node_first; bss; bss = bss->ni_list_next) { - if (bss->ni_si_gen != gen) { - bsssize = offsetof(NDIS_802_11_BSSID_SCAN_INFO, Bssid) + offsetof(NDIS_WLAN_BSSID_EX, IEs); - bsssize = bsssize + sizeof(NDIS_802_11_FIXED_IEs); - -#ifdef SUPPORT_WPA2 - if (bss->ni_cie.ie_rsn) { - bsssize = bsssize + bss->ni_cie.ie_rsn[1] + 2; - } -#endif - if (bss->ni_cie.ie_wpa) { - bsssize = bsssize + bss->ni_cie.ie_wpa[1] + 2; - } - - // bsssize must be a multiple of 4 to maintain alignment. - bsssize = (bsssize + 3) & ~3; - - size += bsssize; - - numbss++; - } - } - - if (0 == numbss) - { -// RETAILMSG(1, (L"AR6K: scan indication: 0 bss\n")); - ar6000_scan_indication (wmip->wmi_devt, NULL, 0); - IEEE80211_NODE_UNLOCK (nt); - return; - } - - pAr6kScanIndEvent = A_MALLOC(size); - - if (NULL == pAr6kScanIndEvent) - { - IEEE80211_NODE_UNLOCK(nt); - return; - } - - A_MEMZERO(pAr6kScanIndEvent, size); - - //copy data - pAr6kScanIndEvent->ind.StatusType = Ndis802_11StatusType_BssidScanInfoList; - pAr6kScanIndEvent->slist.Version = 1; - pAr6kScanIndEvent->slist.NumItems = numbss; - - psi = &pAr6kScanIndEvent->slist.BssidScanInfo[0]; - - for (bss = nt->nt_node_first; bss; bss = bss->ni_list_next) { - if (bss->ni_si_gen != gen) { - - bss->ni_si_gen = gen; - - //Set scan time - psi->ScanTime = bss->ni_tstamp - WLAN_NODE_INACT_TIMEOUT_MSEC; - - // Copy data to bssid_ex - bsssize = offsetof(NDIS_WLAN_BSSID_EX, IEs); - bsssize = bsssize + sizeof(NDIS_802_11_FIXED_IEs); - -#ifdef SUPPORT_WPA2 - if (bss->ni_cie.ie_rsn) { - bsssize = bsssize + bss->ni_cie.ie_rsn[1] + 2; - } -#endif - if (bss->ni_cie.ie_wpa) { - bsssize = bsssize + bss->ni_cie.ie_wpa[1] + 2; - } - - // bsssize must be a multiple of 4 to maintain alignment. - bsssize = (bsssize + 3) & ~3; - - psi->Bssid.Length = bsssize; - - memcpy (psi->Bssid.MacAddress, bss->ni_macaddr, ETHERNET_MAC_ADDRESS_LENGTH); - - -//if (((bss->ni_macaddr[3] == 0xCE) && (bss->ni_macaddr[4] == 0xF0) && (bss->ni_macaddr[5] == 0xE7)) || -// ((bss->ni_macaddr[3] == 0x03) && (bss->ni_macaddr[4] == 0xE2) && (bss->ni_macaddr[5] == 0x70))) -// RETAILMSG (1, (L"%x\n",bss->ni_macaddr[5])); - - psi->Bssid.Ssid.SsidLength = 0; - pie = bss->ni_cie.ie_ssid; - - if (pie) { - // Format of SSID IE is: - // Type (1 octet) - // Length (1 octet) - // SSID (Length octets) - // - // Validation of the IE should have occurred within WMI. - // - if (pie[1] <= 32) { - psi->Bssid.Ssid.SsidLength = pie[1]; - memcpy(psi->Bssid.Ssid.Ssid, &pie[2], psi->Bssid.Ssid.SsidLength); - } - } - psi->Bssid.Privacy = (bss->ni_cie.ie_capInfo & 0x10) ? 1 : 0; - - //Post the RSSI value relative to the Standard Noise floor value. - psi->Bssid.Rssi = bss->ni_rssi; - - if (bss->ni_cie.ie_chan >= 2412 && bss->ni_cie.ie_chan <= 2484) { - - if (bss->ni_cie.ie_rates && bss->ni_cie.ie_xrates) { - psi->Bssid.NetworkTypeInUse = Ndis802_11OFDM24; - } - else { - psi->Bssid.NetworkTypeInUse = Ndis802_11DS; - } - } - else { - psi->Bssid.NetworkTypeInUse = Ndis802_11OFDM5; - } - - psi->Bssid.Configuration.Length = sizeof(psi->Bssid.Configuration); - psi->Bssid.Configuration.BeaconPeriod = bss->ni_cie.ie_beaconInt; // Units are Kmicroseconds (1024 us) - psi->Bssid.Configuration.ATIMWindow = 0; - psi->Bssid.Configuration.DSConfig = bss->ni_cie.ie_chan * 1000; - psi->Bssid.InfrastructureMode = ((bss->ni_cie.ie_capInfo & 0x03) == 0x01 ) ? Ndis802_11Infrastructure : Ndis802_11IBSS; - - RateSize = 0; - pie = bss->ni_cie.ie_rates; - if (pie) { - RateSize = (pie[1] < NDIS_802_11_LENGTH_RATES_EX) ? pie[1] : NDIS_802_11_LENGTH_RATES_EX; - memcpy(psi->Bssid.SupportedRates, &pie[2], RateSize); - } - pie = bss->ni_cie.ie_xrates; - if (pie && RateSize < NDIS_802_11_LENGTH_RATES_EX) { - memcpy(psi->Bssid.SupportedRates + RateSize, &pie[2], - (pie[1] < (NDIS_802_11_LENGTH_RATES_EX - RateSize)) ? pie[1] : (NDIS_802_11_LENGTH_RATES_EX - RateSize)); - } - - // Copy the fixed IEs - psi->Bssid.IELength = sizeof(NDIS_802_11_FIXED_IEs); - - pFixed = (NDIS_802_11_FIXED_IEs *)psi->Bssid.IEs; - memcpy(pFixed->Timestamp, bss->ni_cie.ie_tstamp, sizeof(pFixed->Timestamp)); - pFixed->BeaconInterval = bss->ni_cie.ie_beaconInt; - pFixed->Capabilities = bss->ni_cie.ie_capInfo; - - // Copy selected variable IEs - - pVar = (NDIS_802_11_VARIABLE_IEs *)((PBYTE)pFixed + sizeof(NDIS_802_11_FIXED_IEs)); - -#ifdef SUPPORT_WPA2 - // Copy the WPAv2 IE - if (bss->ni_cie.ie_rsn) { - pie = bss->ni_cie.ie_rsn; - psi->Bssid.IELength += pie[1] + 2; - memcpy(pVar, pie, pie[1] + 2); - pVar = (NDIS_802_11_VARIABLE_IEs *)((PBYTE)pVar + pie[1] + 2); - } -#endif - // Copy the WPAv1 IE - if (bss->ni_cie.ie_wpa) { - pie = bss->ni_cie.ie_wpa; - psi->Bssid.IELength += pie[1] + 2; - memcpy(pVar, pie, pie[1] + 2); - pVar = (NDIS_802_11_VARIABLE_IEs *)((PBYTE)pVar + pie[1] + 2); - } - - // Advance buffer pointer - psi = (PNDIS_802_11_BSSID_SCAN_INFO)((BYTE*)psi + bsssize + FIELD_OFFSET(NDIS_802_11_BSSID_SCAN_INFO, Bssid)); - } - } - - IEEE80211_NODE_UNLOCK(nt); - -// wmi_free_allnodes(wmip); - -// RETAILMSG(1, (L"AR6K: scan indication: %u bss\n", numbss)); - - ar6000_scan_indication (wmip->wmi_devt, pAr6kScanIndEvent, size); - - A_FREE(pAr6kScanIndEvent); -} -#endif - -A_UINT8 -ar6000_get_upper_threshold(A_INT16 rssi, SQ_THRESHOLD_PARAMS *sq_thresh, - A_UINT32 size) -{ - A_UINT32 index; - A_UINT8 threshold = (A_UINT8)sq_thresh->upper_threshold[size - 1]; - - /* The list is already in sorted order. Get the next lower value */ - for (index = 0; index < size; index ++) { - if (rssi < sq_thresh->upper_threshold[index]) { - threshold = (A_UINT8)sq_thresh->upper_threshold[index]; - break; - } - } - - return threshold; -} - -A_UINT8 -ar6000_get_lower_threshold(A_INT16 rssi, SQ_THRESHOLD_PARAMS *sq_thresh, - A_UINT32 size) -{ - A_UINT32 index; - A_UINT8 threshold = (A_UINT8)sq_thresh->lower_threshold[size - 1]; - - /* The list is already in sorted order. Get the next lower value */ - for (index = 0; index < size; index ++) { - if (rssi > sq_thresh->lower_threshold[index]) { - threshold = (A_UINT8)sq_thresh->lower_threshold[index]; - break; - } - } - - return threshold; -} -static A_STATUS -wmi_send_rssi_threshold_params(struct wmi_t *wmip, - WMI_RSSI_THRESHOLD_PARAMS_CMD *rssiCmd) -{ - void *osbuf; - A_INT8 size; - WMI_RSSI_THRESHOLD_PARAMS_CMD *cmd; - A_STATUS status; - - size = sizeof (*cmd); - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, size); - - cmd = (WMI_RSSI_THRESHOLD_PARAMS_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, size); - A_MEMCPY(cmd, rssiCmd, sizeof(WMI_RSSI_THRESHOLD_PARAMS_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_RSSI_THRESHOLD_PARAMS_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} -static A_STATUS -wmi_send_snr_threshold_params(struct wmi_t *wmip, - WMI_SNR_THRESHOLD_PARAMS_CMD *snrCmd) -{ - void *osbuf; - A_INT8 size; - WMI_SNR_THRESHOLD_PARAMS_CMD *cmd; - A_STATUS status; - - size = sizeof (*cmd); - - osbuf = A_NETBUF_ALLOC(size); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, size); - cmd = (WMI_SNR_THRESHOLD_PARAMS_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, size); - A_MEMCPY(cmd, snrCmd, sizeof(WMI_SNR_THRESHOLD_PARAMS_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_SNR_THRESHOLD_PARAMS_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_target_event_report_cmd(struct wmi_t *wmip, WMI_SET_TARGET_EVENT_REPORT_CMD* cmd) -{ - void *osbuf; - WMI_SET_TARGET_EVENT_REPORT_CMD* alloc_cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - alloc_cmd = (WMI_SET_TARGET_EVENT_REPORT_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(alloc_cmd, sizeof(*cmd)); - A_MEMCPY(alloc_cmd, cmd, sizeof(*cmd)); - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_TARGET_EVENT_REPORT_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -bss_t *wmi_rm_current_bss (struct wmi_t *wmip, A_UINT8 *id) -{ - wmi_get_current_bssid (wmip, id); - return wlan_node_remove (&wmip->wmi_scan_table, id); -} - -A_STATUS wmi_add_current_bss (struct wmi_t *wmip, A_UINT8 *id, bss_t *bss) -{ - wlan_setup_node (&wmip->wmi_scan_table, bss, id); - return A_OK; -} - -#ifdef ATH_AR6K_11N_SUPPORT -static A_STATUS -wmi_addba_req_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_ADDBA_REQ_EVENT *cmd = (WMI_ADDBA_REQ_EVENT *)datap; - - A_WMI_AGGR_RECV_ADDBA_REQ_EVT(wmip->wmi_devt, cmd); - - return A_OK; -} - - -static A_STATUS -wmi_addba_resp_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_ADDBA_RESP_EVENT *cmd = (WMI_ADDBA_RESP_EVENT *)datap; - - A_WMI_AGGR_RECV_ADDBA_RESP_EVT(wmip->wmi_devt, cmd); - - return A_OK; -} - -static A_STATUS -wmi_delba_req_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_DELBA_EVENT *cmd = (WMI_DELBA_EVENT *)datap; - - A_WMI_AGGR_RECV_DELBA_REQ_EVT(wmip->wmi_devt, cmd); - - return A_OK; -} - -A_STATUS -wmi_btcoex_config_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_BTCOEX_CONFIG_EVENT(wmip->wmi_devt, datap, len); - - return A_OK; -} - - -A_STATUS -wmi_btcoex_stats_event_rx(struct wmi_t * wmip,A_UINT8 * datap,int len) -{ - A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); - - A_WMI_BTCOEX_STATS_EVENT(wmip->wmi_devt, datap, len); - - return A_OK; - -} -#endif - -static A_STATUS -wmi_hci_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_HCI_EVENT *cmd = (WMI_HCI_EVENT *)datap; - A_WMI_HCI_EVENT_EVT(wmip->wmi_devt, cmd); - - return A_OK; -} - -//////////////////////////////////////////////////////////////////////////////// -//// //// -//// AP mode functions //// -//// //// -//////////////////////////////////////////////////////////////////////////////// -/* - * IOCTL: AR6000_XIOCTL_AP_COMMIT_CONFIG - * - * When AR6K in AP mode, This command will be called after - * changing ssid, channel etc. It will pass the profile to - * target with a flag which will indicate which parameter changed, - * also if this flag is 0, there was no change in parametes, so - * commit cmd will not be sent to target. Without calling this IOCTL - * the changes will not take effect. - */ -A_STATUS -wmi_ap_profile_commit(struct wmi_t *wmip, WMI_CONNECT_CMD *p) -{ - void *osbuf; - WMI_CONNECT_CMD *cm; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cm)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cm)); - cm = (WMI_CONNECT_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cm, sizeof(*cm)); - - A_MEMCPY(cm,p,sizeof(*cm)); - - status = wmi_cmd_send(wmip, osbuf, WMI_AP_CONFIG_COMMIT_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -/* - * IOCTL: AR6000_XIOCTL_AP_HIDDEN_SSID - * - * This command will be used to enable/disable hidden ssid functioanlity of - * beacon. If it is enabled, ssid will be NULL in beacon. - */ -A_STATUS -wmi_ap_set_hidden_ssid(struct wmi_t *wmip, A_UINT8 hidden_ssid) -{ - void *osbuf; - WMI_AP_HIDDEN_SSID_CMD *hs; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_AP_HIDDEN_SSID_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_AP_HIDDEN_SSID_CMD)); - hs = (WMI_AP_HIDDEN_SSID_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(hs, sizeof(*hs)); - - hs->hidden_ssid = hidden_ssid; - - A_DPRINTF(DBG_WMI, (DBGFMT "AR6000_XIOCTL_AP_HIDDEN_SSID %d\n", DBGARG , hidden_ssid)); - status = wmi_cmd_send(wmip, osbuf, WMI_AP_HIDDEN_SSID_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -/* - * IOCTL: AR6000_XIOCTL_AP_SET_MAX_NUM_STA - * - * This command is used to limit max num of STA that can connect - * with this AP. This value should not exceed AP_MAX_NUM_STA (this - * is max num of STA supported by AP). Value was already validated - * in ioctl.c - */ -A_STATUS -wmi_ap_set_num_sta(struct wmi_t *wmip, A_UINT8 num_sta) -{ - void *osbuf; - WMI_AP_NUM_STA_CMD *ns; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_AP_NUM_STA_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_AP_NUM_STA_CMD)); - ns = (WMI_AP_NUM_STA_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(ns, sizeof(*ns)); - - ns->num_sta = num_sta; - - A_DPRINTF(DBG_WMI, (DBGFMT "AR6000_XIOCTL_AP_SET_MAX_NUM_STA %d\n", DBGARG , num_sta)); - status = wmi_cmd_send(wmip, osbuf, WMI_AP_SET_NUM_STA_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -/* - * IOCTL: AR6000_XIOCTL_AP_SET_ACL_MAC - * - * This command is used to send list of mac of STAs which will - * be allowed to connect with this AP. When this list is empty - * firware will allow all STAs till the count reaches AP_MAX_NUM_STA. - */ -A_STATUS -wmi_ap_acl_mac_list(struct wmi_t *wmip, WMI_AP_ACL_MAC_CMD *acl) -{ - void *osbuf; - WMI_AP_ACL_MAC_CMD *a; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_AP_ACL_MAC_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_AP_ACL_MAC_CMD)); - a = (WMI_AP_ACL_MAC_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(a, sizeof(*a)); - A_MEMCPY(a,acl,sizeof(*acl)); - - status = wmi_cmd_send(wmip, osbuf, WMI_AP_ACL_MAC_LIST_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -/* - * IOCTL: AR6000_XIOCTL_AP_SET_MLME - * - * This command is used to send list of mac of STAs which will - * be allowed to connect with this AP. When this list is empty - * firware will allow all STAs till the count reaches AP_MAX_NUM_STA. - */ -A_STATUS -wmi_ap_set_mlme(struct wmi_t *wmip, A_UINT8 cmd, A_UINT8 *mac, A_UINT16 reason) -{ - void *osbuf; - WMI_AP_SET_MLME_CMD *mlme; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_AP_SET_MLME_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_AP_SET_MLME_CMD)); - mlme = (WMI_AP_SET_MLME_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(mlme, sizeof(*mlme)); - - mlme->cmd = cmd; - A_MEMCPY(mlme->mac, mac, ATH_MAC_LEN); - mlme->reason = reason; - - status = wmi_cmd_send(wmip, osbuf, WMI_AP_SET_MLME_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -static A_STATUS -wmi_pspoll_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_PSPOLL_EVENT *ev; - - if (len < sizeof(WMI_PSPOLL_EVENT)) { - return A_EINVAL; - } - ev = (WMI_PSPOLL_EVENT *)datap; - - A_WMI_PSPOLL_EVENT(wmip->wmi_devt, ev->aid); - return A_OK; -} - -static A_STATUS -wmi_dtimexpiry_event_rx(struct wmi_t *wmip, A_UINT8 *datap,int len) -{ - A_WMI_DTIMEXPIRY_EVENT(wmip->wmi_devt); - return A_OK; -} - -#ifdef WAPI_ENABLE -static A_STATUS -wmi_wapi_rekey_event_rx(struct wmi_t *wmip, A_UINT8 *datap,int len) -{ - A_UINT8 *ev; - - if (len < 7) { - return A_EINVAL; - } - ev = (A_UINT8 *)datap; - - A_WMI_WAPI_REKEY_EVENT(wmip->wmi_devt, *ev, &ev[1]); - return A_OK; -} -#endif - -#ifdef CONFIG_WLAN_RFKILL -static A_STATUS wmi_rfkill_get_mode_cmd_event_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - A_STATUS status = A_OK; - - do - { - if(len < sizeof(WMI_RFKILL_MODE_CMD)) - { - status = A_EINVAL; - break; - } - - A_WMI_RFKILL_GET_MODE_CMD_EVENT(wmip->wmi_devt,datap,len); - }while(FALSE); - - return status; -} - -static A_STATUS wmi_rfkill_state_change_event(struct wmi_t *wmip, A_UINT8* datap,int len) -{ - A_STATUS status = A_OK; - A_UINT8 *ev = NULL; - - if (len < sizeof(A_UINT8)) - { - return A_EINVAL; - } - - ev = (A_UINT8*)datap; - - A_WMI_RFKILL_STATE_CHANGE_EVENT(wmip->wmi_devt, *ev); - - return status; -} - -A_STATUS wmi_set_rfkill_mode_cmd(struct wmi_t *wmip,WMI_RFKILL_MODE_CMD *pCmd) -{ - A_STATUS status = A_OK; - void *osbuf = NULL; - WMI_RFKILL_MODE_CMD *prfkill_set_mode_cmd = NULL; - - do - { - osbuf = A_NETBUF_ALLOC(sizeof(WMI_RFKILL_MODE_CMD)); - if(NULL == osbuf) - { - status = A_NO_MEMORY; - break; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_RFKILL_MODE_CMD)); - - prfkill_set_mode_cmd = (WMI_RFKILL_MODE_CMD*)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(prfkill_set_mode_cmd, sizeof(WMI_RFKILL_MODE_CMD)); - A_MEMCPY(prfkill_set_mode_cmd,pCmd, sizeof(WMI_RFKILL_MODE_CMD)); - - status = wmi_cmd_send(wmip, - osbuf, - WMI_SET_RFKILL_MODE_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - }while(FALSE); - - return status; -} - -A_STATUS wmi_get_rfkill_mode_cmd(struct wmi_t *wmip) -{ - A_STATUS status = A_OK; - - status = wmi_simple_cmd(wmip,WMI_GET_RFKILL_MODE_CMDID); - - return status; -} -#endif /* CONFIG_WLAN_RFKILL */ - - -A_STATUS -wmi_set_pvb_cmd(struct wmi_t *wmip, A_UINT16 aid, A_BOOL flag) -{ - WMI_AP_SET_PVB_CMD *cmd; - void *osbuf = NULL; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_AP_SET_PVB_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_AP_SET_PVB_CMD)); - cmd = (WMI_AP_SET_PVB_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - - cmd->aid = aid; - cmd->flag = flag; - - status = wmi_cmd_send(wmip, osbuf, WMI_AP_SET_PVB_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_ap_conn_inact_time(struct wmi_t *wmip, A_UINT32 period) -{ - WMI_AP_CONN_INACT_CMD *cmd; - void *osbuf = NULL; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_AP_CONN_INACT_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_AP_CONN_INACT_CMD)); - cmd = (WMI_AP_CONN_INACT_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - - cmd->period = period; - - status = wmi_cmd_send(wmip, osbuf, WMI_AP_CONN_INACT_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_ap_bgscan_time(struct wmi_t *wmip, A_UINT32 period, A_UINT32 dwell) -{ - WMI_AP_PROT_SCAN_TIME_CMD *cmd; - void *osbuf = NULL; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_AP_PROT_SCAN_TIME_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_AP_PROT_SCAN_TIME_CMD)); - cmd = (WMI_AP_PROT_SCAN_TIME_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - - cmd->period_min = period; - cmd->dwell_ms = dwell; - - status = wmi_cmd_send(wmip, osbuf, WMI_AP_PROT_SCAN_TIME_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_ap_set_dtim(struct wmi_t *wmip, A_UINT8 dtim) -{ - WMI_AP_SET_DTIM_CMD *cmd; - void *osbuf = NULL; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_AP_SET_DTIM_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_AP_SET_DTIM_CMD)); - cmd = (WMI_AP_SET_DTIM_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - - cmd->dtim = dtim; - - status = wmi_cmd_send(wmip, osbuf, WMI_AP_SET_DTIM_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -/* - * IOCTL: AR6000_XIOCTL_AP_SET_ACL_POLICY - * - * This command is used to set ACL policay. While changing policy, if you - * want to retain the existing MAC addresses in the ACL list, policy should be - * OR with AP_ACL_RETAIN_LIST_MASK, else the existing list will be cleared. - * If there is no chage in policy, the list will be intact. - */ -A_STATUS -wmi_ap_set_acl_policy(struct wmi_t *wmip, A_UINT8 policy) -{ - void *osbuf; - WMI_AP_ACL_POLICY_CMD *po; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_AP_ACL_POLICY_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; -} - - A_NETBUF_PUT(osbuf, sizeof(WMI_AP_ACL_POLICY_CMD)); - po = (WMI_AP_ACL_POLICY_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(po, sizeof(*po)); - - po->policy = policy; - - status = wmi_cmd_send(wmip, osbuf, WMI_AP_ACL_POLICY_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_ap_set_rateset(struct wmi_t *wmip, A_UINT8 rateset) -{ - void *osbuf; - WMI_AP_SET_11BG_RATESET_CMD *rs; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_AP_SET_11BG_RATESET_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_AP_SET_11BG_RATESET_CMD)); - rs = (WMI_AP_SET_11BG_RATESET_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(rs, sizeof(*rs)); - - rs->rateset = rateset; - - status = wmi_cmd_send(wmip, osbuf, WMI_AP_SET_11BG_RATESET_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -#ifdef ATH_AR6K_11N_SUPPORT -A_STATUS -wmi_set_ht_cap_cmd(struct wmi_t *wmip, WMI_SET_HT_CAP_CMD *cmd) -{ - void *osbuf; - WMI_SET_HT_CAP_CMD *htCap; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*htCap)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*htCap)); - - A_MEMCPY(&wmip->wmi_ht_cap[cmd->band], cmd, sizeof(WMI_SET_HT_CAP_CMD)); - - htCap = (WMI_SET_HT_CAP_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(htCap, sizeof(*htCap)); - A_MEMCPY(htCap, cmd, sizeof(*htCap)); - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_HT_CAP_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_get_ht_cap_cmd(struct wmi_t *wmip, WMI_SET_HT_CAP_CMD *cmd) -{ - A_MEMCPY(cmd, &wmip->wmi_ht_cap[cmd->band], sizeof(WMI_SET_HT_CAP_CMD)); - - return A_OK; -} - -A_STATUS -wmi_set_ht_op_cmd(struct wmi_t *wmip, A_UINT8 sta_chan_width) -{ - void *osbuf; - WMI_SET_HT_OP_CMD *htInfo; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*htInfo)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*htInfo)); - - htInfo = (WMI_SET_HT_OP_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(htInfo, sizeof(*htInfo)); - htInfo->sta_chan_width = sta_chan_width; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_HT_OP_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} -#endif - -A_STATUS -wmi_set_tx_select_rates_cmd(struct wmi_t *wmip, A_UINT32 *pMaskArray) -{ - void *osbuf; - WMI_SET_TX_SELECT_RATES_CMD *pData; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*pData)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*pData)); - - pData = (WMI_SET_TX_SELECT_RATES_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMCPY(pData, pMaskArray, sizeof(*pData)); - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_TX_SELECT_RATES_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - - -A_STATUS -wmi_send_hci_cmd(struct wmi_t *wmip, A_UINT8 *buf, A_UINT16 sz) -{ - void *osbuf; - WMI_HCI_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd) + sz); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd) + sz); - cmd = (WMI_HCI_CMD *)(A_NETBUF_DATA(osbuf)); - - cmd->cmd_buf_sz = sz; - A_MEMCPY(cmd->buf, buf, sz); - status = wmi_cmd_send(wmip, osbuf, WMI_HCI_CMD_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -#ifdef ATH_AR6K_11N_SUPPORT -A_STATUS -wmi_allow_aggr_cmd(struct wmi_t *wmip, A_UINT16 tx_tidmask, A_UINT16 rx_tidmask) -{ - void *osbuf; - WMI_ALLOW_AGGR_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_ALLOW_AGGR_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->tx_allow_aggr = tx_tidmask; - cmd->rx_allow_aggr = rx_tidmask; - - status = wmi_cmd_send(wmip, osbuf, WMI_ALLOW_AGGR_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_setup_aggr_cmd(struct wmi_t *wmip, A_UINT8 tid) -{ - void *osbuf; - WMI_ADDBA_REQ_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_ADDBA_REQ_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->tid = tid; - - status = wmi_cmd_send(wmip, osbuf, WMI_ADDBA_REQ_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_delete_aggr_cmd(struct wmi_t *wmip, A_UINT8 tid, A_BOOL uplink) -{ - void *osbuf; - WMI_DELBA_REQ_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_DELBA_REQ_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->tid = tid; - cmd->is_sender_initiator = uplink; /* uplink =1 - uplink direction, 0=downlink direction */ - - /* Delete the local aggr state, on host */ - status = wmi_cmd_send(wmip, osbuf, WMI_DELBA_REQ_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} -#endif - -A_STATUS -wmi_set_rx_frame_format_cmd(struct wmi_t *wmip, A_UINT8 rxMetaVersion, - A_BOOL rxDot11Hdr, A_BOOL defragOnHost) -{ - void *osbuf; - WMI_RX_FRAME_FORMAT_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_RX_FRAME_FORMAT_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->dot11Hdr = (rxDot11Hdr==TRUE)? 1:0; - cmd->defragOnHost = (defragOnHost==TRUE)? 1:0; - cmd->metaVersion = rxMetaVersion; /* */ - - /* Delete the local aggr state, on host */ - status = wmi_cmd_send(wmip, osbuf, WMI_RX_FRAME_FORMAT_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - - -A_STATUS -wmi_set_tx_mac_rules_cmd (struct wmi_t *wmip, A_UINT32 rules) -{ - void *osbuf; - WMI_CONFIG_TX_MAC_RULES_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_CONFIG_TX_MAC_RULES_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->rules = rules; - - status = wmi_cmd_send(wmip, osbuf, WMI_CONFIG_TX_MAC_RULES_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_promiscuous_mode_cmd (struct wmi_t *wmip, A_BOOL bMode) -{ - void *osbuf; - WMI_SET_PROMISCUOUS_MODE_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_PROMISCUOUS_MODE_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->enable = (bMode==TRUE)? 1:0; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_PROMISCUOUS_MODE_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_thin_mode_cmd(struct wmi_t *wmip, A_BOOL bThinMode) -{ - void *osbuf; - WMI_SET_THIN_MODE_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_THIN_MODE_CMD *)(A_NETBUF_DATA(osbuf)); - cmd->enable = (bThinMode==TRUE)? 1:0; - - /* Delete the local aggr state, on host */ - status = wmi_cmd_send(wmip, osbuf, WMI_SET_THIN_MODE_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - - -A_STATUS -wmi_set_wlan_conn_precedence_cmd(struct wmi_t *wmip, BT_WLAN_CONN_PRECEDENCE precedence) -{ - void *osbuf; - WMI_SET_BT_WLAN_CONN_PRECEDENCE *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_BT_WLAN_CONN_PRECEDENCE *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->precedence = precedence; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_BT_WLAN_CONN_PRECEDENCE_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_pmk_cmd(struct wmi_t *wmip, A_UINT8 *pmk) -{ - void *osbuf; - WMI_SET_PMK_CMD *p; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_SET_PMK_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_SET_PMK_CMD)); - - p = (WMI_SET_PMK_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(p, sizeof(*p)); - - A_MEMCPY(p->pmk, pmk, WMI_PMK_LEN); - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_PMK_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_passphrase_cmd(struct wmi_t *wmip, WMI_SET_PASSPHRASE_CMD *cmd) -{ - void *osbuf; - WMI_SET_PASSPHRASE_CMD *p; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_SET_PASSPHRASE_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_SET_PASSPHRASE_CMD)); - - p = (WMI_SET_PASSPHRASE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(p, sizeof(*p)); - - A_MEMCPY(p->ssid, cmd->ssid, WMI_MAX_SSID_LEN); - p->ssid_len = cmd->ssid_len; - A_MEMCPY(p->passphrase, cmd->passphrase, WMI_PASSPHRASE_LEN); - p->passphrase_len = cmd->passphrase_len; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_PASSPHRASE_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_excess_tx_retry_thres_cmd(struct wmi_t *wmip, WMI_SET_EXCESS_TX_RETRY_THRES_CMD *cmd) -{ - void *osbuf; - WMI_SET_EXCESS_TX_RETRY_THRES_CMD *p; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_SET_EXCESS_TX_RETRY_THRES_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_SET_EXCESS_TX_RETRY_THRES_CMD)); - - p = (WMI_SET_EXCESS_TX_RETRY_THRES_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(p, sizeof(*p)); - - p->threshold = cmd->threshold; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_EXCESS_TX_RETRY_THRES_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_SGI_cmd(struct wmi_t *wmip, A_UINT32 *sgiMask, A_UINT8 sgiPERThreshold) -{ - void *osbuf; - WMI_SET_TX_SGI_PARAM_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY ; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_TX_SGI_PARAM_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->sgiMask[0] = sgiMask[0]; - cmd->sgiMask[1] = sgiMask[1]; - cmd->sgiPERThreshold = sgiPERThreshold; - status = wmi_cmd_send(wmip, osbuf, WMI_SET_TX_SGI_PARAM_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -#ifdef P2P -A_STATUS -wmi_p2p_discover(struct wmi_t *wmip, WMI_P2P_FIND_CMD *find_param) -{ - void *osbuf; - WMI_P2P_FIND_CMD *p; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_P2P_FIND_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_P2P_FIND_CMD)); - - p = (WMI_P2P_FIND_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(p, sizeof(*p)); - - A_MEMCPY(p, find_param, sizeof(WMI_P2P_FIND_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_P2P_FIND_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_p2p_stop_find(struct wmi_t *wmip) -{ - return wmi_simple_cmd(wmip, WMI_P2P_STOP_FIND_CMDID); -} - -A_STATUS -wmi_p2p_cancel(struct wmi_t *wmip) -{ - return wmi_simple_cmd(wmip, WMI_P2P_CANCEL_CMDID); -} - -A_STATUS -wmi_p2p_listen(struct wmi_t *wmip, A_UINT32 timeout) -{ - void *osbuf; - WMI_P2P_LISTEN_CMD *p; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_P2P_LISTEN_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_P2P_LISTEN_CMD)); - - p = (WMI_P2P_LISTEN_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(p, sizeof(*p)); - - p->timeout = timeout; - - status = wmi_cmd_send(wmip, osbuf, WMI_P2P_LISTEN_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_p2p_go_neg_start(struct wmi_t *wmip, WMI_P2P_GO_NEG_START_CMD *go_param) -{ - void *osbuf; - WMI_P2P_GO_NEG_START_CMD *p; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_P2P_GO_NEG_START_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_P2P_GO_NEG_START_CMD)); - - p = (WMI_P2P_GO_NEG_START_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(p, sizeof(*p)); - - A_MEMCPY(p, go_param, sizeof(WMI_P2P_GO_NEG_START_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_P2P_GO_NEG_START_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS wmi_p2p_go_neg_rsp_cmd(struct wmi_t *wmip, A_UINT8 status, - A_UINT8 go_intent, A_UINT32 wps_method, A_UINT16 listen_freq, - A_UINT8 *wpsbuf, A_UINT32 wpslen, A_UINT8 *p2pbuf, A_UINT32 p2plen, - A_UINT8 dialog_token, A_UINT8 persistent_grp) -{ - void *osbuf; - WMI_P2P_GO_NEG_REQ_RSP_CMD *pCmd; - A_STATUS wmi_cmd_send_status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_P2P_GO_NEG_REQ_RSP_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_P2P_GO_NEG_REQ_RSP_CMD)); - - pCmd = (WMI_P2P_GO_NEG_REQ_RSP_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(pCmd, sizeof(WMI_P2P_GO_NEG_REQ_RSP_CMD)); - - pCmd->status = status; - pCmd->go_intent = go_intent; - pCmd->wps_method = wps_method; - pCmd->listen_freq = listen_freq; - - pCmd->wps_buflen = wpslen; - A_MEMCPY(pCmd->wps_buf, wpsbuf, wpslen); - - pCmd->p2p_buflen = p2plen; - A_MEMCPY(pCmd->p2p_buf, p2pbuf, p2plen); - - pCmd->dialog_token = dialog_token; - pCmd->persistent_grp = persistent_grp; - - wmi_cmd_send_status = wmi_cmd_send(wmip, osbuf, WMI_P2P_GO_NEG_REQ_RSP_CMDID, NO_SYNC_WMIFLAG); - - if (wmi_cmd_send_status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return wmi_cmd_send_status; -} - -A_STATUS wmi_p2p_invite_req_rsp_cmd(struct wmi_t *wmip, A_UINT8 status, - A_INT8 is_go, A_UINT8 *grp_bssid, A_UINT8 *p2pbuf, - A_UINT8 p2plen, A_UINT8 dialog_token) -{ - void *osbuf; - WMI_P2P_INVITE_REQ_RSP_CMD *pCmd; - A_STATUS wmi_cmd_send_status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_P2P_INVITE_REQ_RSP_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_P2P_INVITE_REQ_RSP_CMD)); - - pCmd = (WMI_P2P_INVITE_REQ_RSP_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(pCmd, sizeof(WMI_P2P_INVITE_REQ_RSP_CMD)); - - pCmd->status = status; - /* TODO: For persistent group setup the is_go & grp_bssid params. - */ - - pCmd->p2p_buflen = p2plen; - A_MEMCPY(pCmd->p2p_buf, p2pbuf, p2plen); - A_MEMCPY(pCmd->group_bssid, grp_bssid, sizeof(ATH_MAC_LEN)); - pCmd->dialog_token = dialog_token; - pCmd->is_go = is_go; - - wmi_cmd_send_status = wmi_cmd_send(wmip, osbuf, WMI_P2P_INVITE_REQ_RSP_CMDID, NO_SYNC_WMIFLAG); - - if (wmi_cmd_send_status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return wmi_cmd_send_status; -} - -A_STATUS -wmi_p2p_set_config(struct wmi_t *wmip, WMI_P2P_SET_CONFIG_CMD *config) -{ - void *osbuf; - WMI_P2P_SET_CONFIG_CMD *p; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_P2P_SET_CONFIG_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_P2P_SET_CONFIG_CMD)); - - p = (WMI_P2P_SET_CONFIG_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(p, sizeof(*p)); - - A_MEMCPY(p, config, sizeof(WMI_P2P_SET_CONFIG_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_P2P_SET_CONFIG_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_wps_set_config(struct wmi_t *wmip, WMI_WPS_SET_CONFIG_CMD *wps_config) -{ - void *osbuf; - WMI_WPS_SET_CONFIG_CMD *p; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_WPS_SET_CONFIG_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_WPS_SET_CONFIG_CMD)); - - p = (WMI_WPS_SET_CONFIG_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(p, sizeof(*p)); - - A_MEMCPY(p, wps_config, sizeof(WMI_WPS_SET_CONFIG_CMD)); - - status = wmi_cmd_send(wmip, osbuf,WMI_WPS_SET_CONFIG_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS wmi_p2p_grp_init_cmd(struct wmi_t *wmip, WMI_P2P_GRP_INIT_CMD *buf) -{ - void *osbuf; - WMI_P2P_GRP_INIT_CMD *p2p_grp_init_cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_P2P_GRP_INIT_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_P2P_GRP_INIT_CMD)); - - p2p_grp_init_cmd = (WMI_P2P_GRP_INIT_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(p2p_grp_init_cmd, sizeof(WMI_P2P_GRP_INIT_CMD)); - - A_MEMCPY(p2p_grp_init_cmd, buf, sizeof(WMI_P2P_GRP_INIT_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_P2P_GRP_INIT_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS wmi_p2p_grp_done_cmd(struct wmi_t *wmip, - WMI_P2P_GRP_FORMATION_DONE_CMD *buf) -{ - void *osbuf; - WMI_P2P_GRP_FORMATION_DONE_CMD *p2p_grp_done_cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_P2P_GRP_FORMATION_DONE_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_P2P_GRP_FORMATION_DONE_CMD)); - - p2p_grp_done_cmd = (WMI_P2P_GRP_FORMATION_DONE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(p2p_grp_done_cmd, sizeof(WMI_P2P_GRP_FORMATION_DONE_CMD)); - - A_MEMCPY(p2p_grp_done_cmd, buf, sizeof(WMI_P2P_GRP_FORMATION_DONE_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_P2P_GRP_FORMATION_DONE_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS wmi_p2p_invite_cmd(struct wmi_t *wmip, WMI_P2P_INVITE_CMD *buf) -{ - void *osbuf; - WMI_P2P_INVITE_CMD *p2p_invite_cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_P2P_INVITE_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_P2P_INVITE_CMD)); - - p2p_invite_cmd = (WMI_P2P_INVITE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(p2p_invite_cmd, sizeof(WMI_P2P_INVITE_CMD)); - - A_MEMCPY(p2p_invite_cmd, buf, sizeof(WMI_P2P_INVITE_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_P2P_INVITE_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS wmi_p2p_prov_disc_cmd(struct wmi_t *wmip, - WMI_P2P_PROV_DISC_REQ_CMD *buf) -{ - void *osbuf; - WMI_P2P_PROV_DISC_REQ_CMD *p2p_prov_disc_req; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_P2P_PROV_DISC_REQ_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_P2P_PROV_DISC_REQ_CMD)); - - p2p_prov_disc_req = (WMI_P2P_PROV_DISC_REQ_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(p2p_prov_disc_req, sizeof(WMI_P2P_PROV_DISC_REQ_CMD)); - - A_MEMCPY(p2p_prov_disc_req, buf, sizeof(WMI_P2P_PROV_DISC_REQ_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_P2P_PROV_DISC_REQ_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS wmi_p2p_set_cmd(struct wmi_t *wmip, WMI_P2P_SET_CMD *buf) -{ - void *osbuf; - WMI_P2P_SET_CMD *p2p_set_config; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_P2P_SET_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_P2P_SET_CMD)); - - p2p_set_config = (WMI_P2P_SET_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(p2p_set_config, sizeof(WMI_P2P_SET_CMD)); - - A_MEMCPY(p2p_set_config, buf, sizeof(WMI_P2P_SET_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_P2P_SET_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS wmi_p2p_sdpd_tx_cmd(struct wmi_t *wmip, WMI_P2P_SDPD_TX_CMD *buf) -{ - void *osbuf; - WMI_P2P_SDPD_TX_CMD *p2p_sdpd_tx; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_P2P_SDPD_TX_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_P2P_SDPD_TX_CMD)); - - p2p_sdpd_tx = (WMI_P2P_SDPD_TX_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(p2p_sdpd_tx, sizeof(WMI_P2P_SDPD_TX_CMD)); - - A_MEMCPY(p2p_sdpd_tx, buf, sizeof(WMI_P2P_SDPD_TX_CMD)); - - status = wmi_cmd_send(wmip, osbuf, WMI_P2P_SDPD_TX_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS wmi_p2p_stop_sdpd(struct wmi_t *wmip) -{ - void *osbuf; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(1); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - status = wmi_cmd_send(wmip, osbuf, WMI_P2P_STOP_SDPD_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -static A_STATUS -wmi_p2p_goneg_result_event_rx(struct wmi_t *wmip, A_UINT8 *datap, A_UINT8 len) -{ - p2p_go_neg_complete_rx(A_WMI_GET_P2P_CTX(wmip->wmi_devt), datap, len); - A_WMI_P2PGONEG_EVENT(wmip->wmi_devt, datap, len); - return A_OK; -} - -static A_STATUS wmi_p2p_goneg_req_rx(struct wmi_t *wmip, A_UINT8 *datap, - A_UINT8 len) -{ - p2p_go_neg_req_rx(A_WMI_GET_P2P_CTX(wmip->wmi_devt), datap, len); - return A_OK; -} - -static A_STATUS wmi_p2p_invite_req_rx(struct wmi_t *wmip, A_UINT8 *datap, - A_UINT8 len) -{ - p2p_invite_req_rx(A_WMI_GET_P2P_CTX(wmip->wmi_devt), datap, len); - return A_OK; -} - - -static A_STATUS wmi_p2p_invite_sent_result_rx(struct wmi_t *wmip, - A_UINT8 *datap, A_UINT8 len) -{ - A_WMI_P2P_INVITE_SENT_RESULT_EVENT(wmip->wmi_devt, datap, len); - return A_OK; -} - -static A_STATUS wmi_p2p_prov_disc_resp_rx(struct wmi_t *wmip, - A_UINT8 *datap, A_UINT8 len) -{ - p2p_prov_disc_resp_rx(A_WMI_GET_P2P_CTX(wmip->wmi_devt), datap, len); - return A_OK; -} - -static A_STATUS wmi_p2p_start_sdpd_event_rx(struct wmi_t *wmip, - A_UINT8 *datap, A_UINT8 len) -{ - p2p_start_sdpd_event_rx(A_WMI_GET_P2P_CTX(wmip->wmi_devt)); - return A_OK; -} - -static A_STATUS wmi_p2p_sdpd_rx_event_rx(struct wmi_t *wmip, - A_UINT8 *datap, A_UINT8 len) -{ - p2p_sdpd_rx_event_rx(A_WMI_GET_P2P_CTX(wmip->wmi_devt), datap, len); - return A_OK; -} - -static A_STATUS wmi_p2p_prov_disc_req_rx(struct wmi_t *wmip, - A_UINT8 *datap, A_UINT8 len) -{ - p2p_prov_disc_req_rx(A_WMI_GET_P2P_CTX(wmip->wmi_devt), datap, len); - return A_OK; -} - -static A_STATUS wmi_p2p_invite_rcvd_result_rx(struct wmi_t *wmip, - A_UINT8 *datap, A_UINT8 len) -{ - A_WMI_P2P_INVITE_RCVD_RESULT_EVENT(wmip->wmi_devt, datap, len); - return A_OK; -} -#endif /* P2P */ - -bss_t * -wmi_find_matching_Ssidnode (struct wmi_t *wmip, A_UCHAR *pSsid, - A_UINT32 ssidLength, - A_UINT32 dot11AuthMode, A_UINT32 authMode, - A_UINT32 pairwiseCryptoType, A_UINT32 grpwiseCryptoTyp) -{ - bss_t *node = NULL; - node = wlan_find_matching_Ssidnode (&wmip->wmi_scan_table, pSsid, - ssidLength, dot11AuthMode, authMode, pairwiseCryptoType, grpwiseCryptoTyp); - - return node; -} - -A_UINT16 -wmi_ieee2freq (int chan) -{ - A_UINT16 freq = 0; - freq = wlan_ieee2freq (chan); - return freq; - -} - -A_UINT32 -wmi_freq2ieee (A_UINT16 freq) -{ - A_UINT16 chan = 0; - chan = wlan_freq2ieee (freq); - return chan; -} - -A_STATUS -wmi_beacon2bssnode (struct wmi_t *wmip, A_UINT8 *datap, int len, A_UINT8 *bssid, A_UINT16 channel) -{ - A_STATUS status = A_OK; - bss_t *bss = NULL; - - bss = wlan_node_alloc (&wmip->wmi_scan_table, len); - - if (bss == NULL) { - return A_NO_MEMORY; - } - - bss->ni_snr = 95; - bss->ni_rssi = -58; - - A_ASSERT(bss->ni_buf != NULL); - - A_MEMCPY(bss->ni_buf, datap, len); - - bss->ni_framelen = len; - if (wlan_parse_beacon(bss->ni_buf, len, &bss->ni_cie) != A_OK) { - wlan_node_free(bss); - return A_EINVAL; - } - - /* - * Update the frequency in ie_chan, overwriting of channel number - * which is done in wlan_parse_beacon - */ - bss->ni_cie.ie_chan = channel; - wlan_setup_node(&wmip->wmi_scan_table, bss, bssid); - return status; -} - -//WAC -A_STATUS -wmi_wac_enable_cmd(struct wmi_t *wmip, WMI_WAC_ENABLE_CMD *param) -{ - void *osbuf; - WMI_WAC_ENABLE_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_WAC_ENABLE_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->enable = param->enable; - cmd->period = param->period; - cmd->threshold = param->threshold; - cmd->rssi = param->rssi; - A_MEMCPY(cmd->wps_pin, param->wps_pin, 8); - - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("WAC ENABLE: 0x%x\n", WMI_ENABLE_WAC_CMDID)); - status = wmi_cmd_send(wmip, osbuf, WMI_ENABLE_WAC_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_wac_scan_reply_cmd(struct wmi_t *wmip, WAC_SUBCMD param) -{ - void *osbuf; - WMI_WAC_SCAN_REPLY_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_WAC_SCAN_REPLY_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->cmdid = param; - - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("WAC SCAN REPLY: 0x%x\n", WMI_WAC_SCAN_REPLY_CMDID)); - - status = wmi_cmd_send(wmip, osbuf, WMI_WAC_SCAN_REPLY_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_wac_ctrl_req_cmd(struct wmi_t *wmip, WMI_WAC_CTRL_REQ_CMD *param) -{ - void *osbuf; - WMI_WAC_CTRL_REQ_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_WAC_CTRL_REQ_CMD *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->req = param->req; - cmd->cmd = param->cmd; - cmd->frame = param->frame; - A_MEMCPY(cmd->ie, param->ie, 17); - - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("WAC CTRL REQ: 0x%x\n", WMI_WAC_CTRL_REQ_CMDID)); - status = wmi_cmd_send(wmip, osbuf, WMI_WAC_CTRL_REQ_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_assoc_req_report_cmd (struct wmi_t *wmip, A_UINT8 host_accept, A_UINT8 host_reaspncode, A_UINT8 target_status, A_UINT8 *sta_mac_addr, A_UINT8 rspType) -{ - void *osbuf; - WMI_SEND_ASSOCRES_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC (sizeof(*cmd)); - - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT (osbuf, sizeof(*cmd)); - - cmd = (WMI_SEND_ASSOCRES_CMD *)(A_NETBUF_DATA(osbuf)); - - A_MEMZERO (cmd, sizeof(*cmd)); - - cmd->host_accept = host_accept; - cmd->host_reasonCode = host_reaspncode; - cmd->target_status = target_status; - - A_MEMCPY (cmd->sta_mac_addr, sta_mac_addr, ATH_MAC_LEN); - - cmd->rspType = rspType; - - status = wmi_cmd_send(wmip, osbuf, WMI_SEND_ASSOC_RES_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_assoc_req_enable_cmd (struct wmi_t *wmip, A_UINT8 enable) -{ - void *osbuf; - WMI_SET_ASSOCREQ_RELAY *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(*cmd)); - - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(*cmd)); - - cmd = (WMI_SET_ASSOCREQ_RELAY *)(A_NETBUF_DATA(osbuf)); - A_MEMZERO(cmd, sizeof(*cmd)); - cmd->enable = enable; - - status = wmi_cmd_send(wmip, osbuf, WMI_SET_ASSOC_REQ_RELAY_CMDID, - NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -static A_STATUS -wmi_report_assoc_req_rx(struct wmi_t *wmip, A_UINT8 *datap, int len) -{ - WMI_ASSOCREQ_EVENT *ev; - - if (len < sizeof(WMI_ASSOCREQ_EVENT)) - { - return A_EINVAL; - } - - ev = (WMI_ASSOCREQ_EVENT *) datap; - - A_WMI_ASSOC_REQ_REPORT_EVENT(wmip->wmi_devt, ev->status, ev->rspType, datap, len); - - return A_OK; -} - -A_STATUS -wmi_force_target_assert(struct wmi_t *wmip) -{ - return wmi_simple_cmd(wmip, WMI_FORCE_TARGET_ASSERT_CMDID); -} - -/* - * This command will be used to enable/disable AP uAPSD feature - */ -A_STATUS -wmi_ap_set_apsd(struct wmi_t *wmip, A_UINT8 enable) -{ - void *osbuf; - WMI_AP_SET_APSD_CMD *cmd; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_AP_SET_APSD_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_AP_SET_APSD_CMD)); - cmd = (WMI_AP_SET_APSD_CMD *)(A_NETBUF_DATA(osbuf)); - - cmd->enable = enable; - - status = wmi_cmd_send(wmip, osbuf, WMI_AP_SET_APSD_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} - -A_STATUS -wmi_set_apsd_buffered_traffic_cmd(struct wmi_t *wmip, A_UINT16 aid, A_UINT16 bitmap, A_UINT32 flags) -{ - WMI_AP_APSD_BUFFERED_TRAFFIC_CMD *cmd; - void *osbuf; - A_STATUS status; - - osbuf = A_NETBUF_ALLOC(sizeof(WMI_AP_APSD_BUFFERED_TRAFFIC_CMD)); - if (osbuf == NULL) { - return A_NO_MEMORY; - } - - A_NETBUF_PUT(osbuf, sizeof(WMI_AP_APSD_BUFFERED_TRAFFIC_CMD)); - cmd = (WMI_AP_APSD_BUFFERED_TRAFFIC_CMD *)(A_NETBUF_DATA(osbuf)); - - cmd->aid = aid; - cmd->bitmap = bitmap; - cmd->flags = flags; - - status = wmi_cmd_send(wmip, osbuf, WMI_AP_APSD_BUFFERED_TRAFFIC_CMDID, NO_SYNC_WMIFLAG); - - if (status != A_OK) { - A_NETBUF_FREE(osbuf); - } - - return status; -} diff --git a/drivers/net/wireless/ar6003/host/wmi/wmi_host.h b/drivers/net/wireless/ar6003/host/wmi/wmi_host.h deleted file mode 100644 index 560cb8c001eb..000000000000 --- a/drivers/net/wireless/ar6003/host/wmi/wmi_host.h +++ /dev/null @@ -1,95 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file contains local definitios for the wmi host module. -// -// Author(s): ="Atheros" -//============================================================================== -#ifndef _WMI_HOST_H_ -#define _WMI_HOST_H_ - -#include "roaming.h" -#ifdef __cplusplus -extern "C" { -#endif - -struct wmi_stats { - A_UINT32 cmd_len_err; - A_UINT32 cmd_id_err; -}; - -#define SSID_IE_LEN_INDEX 13 - - -/* Host side link management data structures */ -#define SIGNAL_QUALITY_THRESHOLD_LEVELS 6 -#define SIGNAL_QUALITY_UPPER_THRESHOLD_LEVELS SIGNAL_QUALITY_THRESHOLD_LEVELS -#define SIGNAL_QUALITY_LOWER_THRESHOLD_LEVELS SIGNAL_QUALITY_THRESHOLD_LEVELS -typedef struct sq_threshold_params_s { - A_INT16 upper_threshold[SIGNAL_QUALITY_UPPER_THRESHOLD_LEVELS]; - A_INT16 lower_threshold[SIGNAL_QUALITY_LOWER_THRESHOLD_LEVELS]; - A_UINT32 upper_threshold_valid_count; - A_UINT32 lower_threshold_valid_count; - A_UINT32 polling_interval; - A_UINT8 weight; - A_UINT8 last_rssi; //normally you would expect this to be bss specific but we keep only one instance because its only valid when the device is in a connected state. Not sure if it belongs to host or target. - A_UINT8 last_rssi_poll_event; //Not sure if it belongs to host or target -} SQ_THRESHOLD_PARAMS; - -/* - * Virtual device specific wmi_t data structure - */ - -struct wmi_t { - void *wmi_devt; - struct ieee80211_node_table wmi_scan_table; - A_UINT8 wmi_bssid[ATH_MAC_LEN]; - A_UINT8 wmi_powerMode; - A_UINT8 wmi_phyMode; - A_UINT8 wmi_keepaliveInterval; - SQ_THRESHOLD_PARAMS wmi_SqThresholdParams[SIGNAL_QUALITY_METRICS_NUM_MAX]; - CRYPTO_TYPE wmi_pair_crypto_type; - CRYPTO_TYPE wmi_grp_crypto_type; - WMI_SET_HT_CAP_CMD wmi_ht_cap[A_NUM_BANDS]; - A_BOOL wmi_is_wmm_enabled; - A_UINT8 wmi_dev_index; - struct wmi_stats wmi_stats; -}; - -/* - * Virtual device independent wmi data structure - */ - -struct wmi_priv_t { - A_BOOL wmi_ready; - A_BOOL wmi_numQoSStream; - A_UINT8 wmi_fatPipeExists; - A_UINT16 wmi_streamExistsForAC[WMM_NUM_AC]; - HTC_ENDPOINT_ID wmi_endpoint_id; - A_MUTEX_T wmi_lock; -}; -#define LOCK_WMI(w) A_MUTEX_LOCK(&(w)->wmi_lock); -#define UNLOCK_WMI(w) A_MUTEX_UNLOCK(&(w)->wmi_lock); - -#ifdef __cplusplus -} -#endif - -#endif /* _WMI_HOST_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/AR6002_regdump.h b/drivers/net/wireless/ar6003/include/AR6002/AR6002_regdump.h deleted file mode 100644 index e3291cf4dbd4..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/AR6002_regdump.h +++ /dev/null @@ -1,60 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2006-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef __AR6002_REGDUMP_H__ -#define __AR6002_REGDUMP_H__ - -#if !defined(__ASSEMBLER__) -/* - * XTensa CPU state - * This must match the state saved by the target exception handler. - */ -struct XTensa_exception_frame_s { - A_UINT32 xt_pc; - A_UINT32 xt_ps; - A_UINT32 xt_sar; - A_UINT32 xt_vpri; - A_UINT32 xt_a2; - A_UINT32 xt_a3; - A_UINT32 xt_a4; - A_UINT32 xt_a5; - A_UINT32 xt_exccause; - A_UINT32 xt_lcount; - A_UINT32 xt_lbeg; - A_UINT32 xt_lend; - - A_UINT32 epc1, epc2, epc3, epc4; - - /* Extra info to simplify post-mortem stack walkback */ -#define AR6002_REGDUMP_FRAMES 10 - struct { - A_UINT32 a0; /* pc */ - A_UINT32 a1; /* sp */ - A_UINT32 a2; - A_UINT32 a3; - } wb[AR6002_REGDUMP_FRAMES]; -}; -typedef struct XTensa_exception_frame_s CPU_exception_frame_t; -#define RD_SIZE sizeof(CPU_exception_frame_t) - -#endif -#endif /* __AR6002_REGDUMP_H__ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/AR6K_version.h b/drivers/net/wireless/ar6003/include/AR6002/AR6K_version.h deleted file mode 100644 index 4a4c01d2dae9..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/AR6K_version.h +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#define __VER_MAJOR_ 3 -#define __VER_MINOR_ 1 -#define __VER_PATCH_ 1 - -/* The makear6ksdk script (used for release builds) modifies the following line. */ -#define __BUILD_NUMBER_ 488 - - -/* Format of the version number. */ -#define VER_MAJOR_BIT_OFFSET 28 -#define VER_MINOR_BIT_OFFSET 24 -#define VER_PATCH_BIT_OFFSET 16 -#define VER_BUILD_NUM_BIT_OFFSET 0 - - -/* - * The version has the following format: - * Bits 28-31: Major version - * Bits 24-27: Minor version - * Bits 16-23: Patch version - * Bits 0-15: Build number (automatically generated during build process ) - * E.g. Build 1.1.3.7 would be represented as 0x11030007. - * - * DO NOT split the following macro into multiple lines as this may confuse the build scripts. - */ -#define AR6K_SW_VERSION ( ( __VER_MAJOR_ << VER_MAJOR_BIT_OFFSET ) + ( __VER_MINOR_ << VER_MINOR_BIT_OFFSET ) + ( __VER_PATCH_ << VER_PATCH_BIT_OFFSET ) + ( __BUILD_NUMBER_ << VER_BUILD_NUM_BIT_OFFSET ) ) - -/* ABI Version. Reflects the version of binary interface exposed by AR6K target firmware. Needs to be incremented by 1 for any change in the firmware that requires upgrade of the driver on the host side for the change to work correctly */ -#define AR6K_ABI_VERSION 1 diff --git a/drivers/net/wireless/ar6003/include/AR6002/addrs.h b/drivers/net/wireless/ar6003/include/AR6002/addrs.h deleted file mode 100644 index 273779890390..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/addrs.h +++ /dev/null @@ -1,123 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef __ADDRS_H__ -#define __ADDRS_H__ - -/* - * Special AR6002 Addresses that may be needed by special - * applications (e.g. ART) on the Host as well as Target. - */ - -#if defined(AR6002_REV2) -#define AR6K_RAM_START 0x00500000 -#define TARG_RAM_OFFSET(vaddr) ((A_UINT32)(vaddr) & 0xfffff) -#define TARG_RAM_SZ (184*1024) -#define TARG_ROM_SZ (80*1024) -#endif -#if defined(AR6002_REV4) || defined(AR6003) -#define AR6K_RAM_START 0x00540000 -#define TARG_RAM_OFFSET(vaddr) (((A_UINT32)(vaddr) & 0xfffff) - 0x40000) -#define TARG_RAM_SZ (256*1024) -#define TARG_ROM_SZ (256*1024) -#endif -#if defined(AR6002_REV6) || defined(AR6004) -#define AR6K_RAM_START 0x00400000 -#define TARG_RAM_OFFSET(vaddr) (((A_UINT32)(vaddr) & 0x3fffff)) -#define TARG_RAM_SZ (256*1024) -#define TARG_ROM_SZ (512*1024) - -#define TARG_IRAM_START 0x00998000 -#define TARG_IRAM_SZ ((128+32)*1024) - -#define TARG_RAM_ACS_RESERVE 32 - -#endif - -#define AR6002_BOARD_DATA_SZ 768 -#define AR6002_BOARD_EXT_DATA_SZ 0 -#define AR6003_BOARD_DATA_SZ 1024 -/* Reserve space for extended board data */ -/* AR6003 v2 has only 768 bytes for extended board data */ -#define AR6003_VER2_BOARD_EXT_DATA_SZ 768 -#if defined(AR6002_REV42) -#define AR6003_BOARD_EXT_DATA_SZ AR6003_VER2_BOARD_EXT_DATA_SZ -#else -#define AR6003_BOARD_EXT_DATA_SZ 1024 -#endif /* AR6002_REV42 */ -#define MCKINLEY_BOARD_DATA_SZ 1024 -#define MCKINLEY_BOARD_EXT_DATA_SZ 0 - -#define AR6K_RAM_ADDR(byte_offset) (AR6K_RAM_START+(byte_offset)) -#define TARG_RAM_ADDRS(byte_offset) AR6K_RAM_ADDR(byte_offset) - -#if defined(AR6002_REV2) || defined(AR6002_REV4) -#define AR6K_ROM_START 0x004e0000 -#define TARG_ROM_OFFSET(vaddr) (((A_UINT32)(vaddr) & 0x1fffff) - 0xe0000) -#endif /* AR6002_REV2 || AR6002_REV4 */ -#if defined(AR6002_REV6) -#define AR6K_ROM_START 0x00900000 -#define TARG_ROM_OFFSET(vaddr) ((A_UINT32)(vaddr) & 0xfffff) -#endif /* AR6002_REV6 */ -#define AR6K_ROM_ADDR(byte_offset) (AR6K_ROM_START+(byte_offset)) -#define TARG_ROM_ADDRS(byte_offset) AR6K_ROM_ADDR(byte_offset) - -/* - * At this ROM address is a pointer to the start of the ROM DataSet Index. - * If there are no ROM DataSets, there's a 0 at this address. - */ -#define ROM_DATASET_INDEX_ADDR (TARG_ROM_ADDRS(TARG_ROM_SZ)-8) -#define ROM_MBIST_CKSUM_ADDR (TARG_ROM_ADDRS(TARG_ROM_SZ)-4) - -/* - * The API A_BOARD_DATA_ADDR() is the proper way to get a read pointer to - * board data. - */ - -/* Size of Board Data, in bytes */ -#if defined(AR6002_REV4) || defined(AR6003) -#define BOARD_DATA_SZ (AR6003_BOARD_DATA_SZ + AR6003_BOARD_EXT_DATA_SZ) -#endif -#if defined(AR6002_REV6) -#define BOARD_DATA_SZ MCKINLEY_BOARD_DATA_SZ -#endif -#if !defined(BOARD_DATA_SZ) -#define BOARD_DATA_SZ AR6002_BOARD_DATA_SZ -#endif - - -/* - * Constants used by ASM code to access fields of host_interest_s, - * which is at a fixed location in RAM. - */ -#if defined(AR6002_REV4) || defined(AR6003) || defined(AR6002_REV6) -#define HOST_INTEREST_FLASH_IS_PRESENT_ADDR (AR6K_RAM_START + 0x60c) -#endif -#if !defined(HOST_INTEREST_FLASH_IS_PRESENT_ADDR) -#define HOST_INTEREST_FLASH_IS_PRESENT_ADDR (AR6K_RAM_START + 0x40c) -#endif -#define FLASH_IS_PRESENT_TARGADDR HOST_INTEREST_FLASH_IS_PRESENT_ADDR - -#endif /* __ADDRS_H__ */ - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsEnv.vr b/drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsEnv.vr deleted file mode 100644 index aa95b3672da0..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsEnv.vr +++ /dev/null @@ -1,58 +0,0 @@ -#include -#include -#include "AveStdLib.vri" - -#ifndef SYNOPSYS_NTB - #include "MercuryEnv.vrh" - #include "LegacyRegsEnvConfig.vrh" - #include "LegacyRegsTop.vrh" -#endif - -class LegacyRegsEnv extends MercuryEnv { - LegacyRegsEnvConfig envConfig; - LegacyRegsTop regsTop; - - task new(string name = "LegacyRegsEnv", LegacyRegsEnvConfig envConfig = null); - virtual function AveEnvConfig GetEnvConfig(); - virtual task build(); - virtual task directed_test_t(); -} - - -task LegacyRegsEnv::new(string name = "LegacyRegsEnv", LegacyRegsEnvConfig envConfig = null) { - MercuryTopConfig mercuryTopConfig; - LegacyRegsTopConfig legacyRegsTopConfig; - - super.new(); - this.envConfig = envConfig; - if (this.envConfig == null) this.envConfig = new(); - cast_assign(mercuryTopConfig, this.envConfig.GetTopConfig()); - - // build and register LegacyRegsTopConfig - legacyRegsTopConfig = new(*, *, "legacyRegsTopConfig"); - mercuryTopConfig.RegisterConfig(legacyRegsTopConfig); -} - -function AveEnvConfig LegacyRegsEnv::GetEnvConfig() { - GetEnvConfig = this.envConfig; -} - -task LegacyRegsEnv::build() { - MercuryTopConfig mercuryTopConfig; - LegacyRegsTopConfig legacyRegsTopConfig; - super.build(); - - // build and register MercuryTop - cast_assign(mercuryTopConfig, this.envConfig.GetTopConfig()); - this.mercuryTop = new(mercuryTopConfig); - this.RegisterTop(this.mercuryTop); - - // build and register LegacyRegsTop. - cast_assign(legacyRegsTopConfig, mercuryTopConfig.GetConfigInstanceByName("legacyRegsTopConfig")); - this.regsTop = new("LegacyRegsTop", "regsTop", 0, legacyRegsTopConfig); - void = this.mercuryTop.RegisterXactor(this.regsTop, AVE_TOP_NO_WAIT_FOR_DONE); -} - -task LegacyRegsEnv::directed_test_t() { -} - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsEnvConfig.vr b/drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsEnvConfig.vr deleted file mode 100644 index ed706ac02fa2..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsEnvConfig.vr +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include "AveStdLib.vri" - -#ifndef SYNOPSYS_NTB - #include "MercuryEnvConfig.vrh" -#endif - -class LegacyRegsEnvConfig extends MercuryEnvConfig { - static local rvm_log log = new("LegacyRegsEnvConfig", "class"); - - constraint LegacyRegsEnvConfigConstraint { - numRuns == 1; - } - - constraint LegacyRegsEnvConfigTest; - - task new(rvm_log log = null); - virtual function rvm_data allocate(); - virtual function AveTopConfig GetTopConfig(); - virtual task SetTopConfig(AveTopConfig topConfig); -} - -task LegacyRegsEnvConfig::new(rvm_log log = null) { - super.new((log != null) ? log : this.log); - if (log != null) this.log = log; -} - -function rvm_data LegacyRegsEnvConfig::allocate() { - LegacyRegsEnvConfig envConfig = new(); - allocate = envConfig; -} - -function AveTopConfig LegacyRegsEnvConfig::GetTopConfig() { - GetTopConfig = this.topConfig; -} - -task LegacyRegsEnvConfig::SetTopConfig(AveTopConfig topConfig) { - if (!cast_assign(this.topConfig, topConfig, CHECK)) { - rvm_fatal(log, "Cannot set topConfig to non-LegacyRegsTopConfig instance"); - } -} - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsTop.vr b/drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsTop.vr deleted file mode 100644 index 17e9c626383b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsTop.vr +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include - -#ifndef SYNOPSYS_NTB - #include "AveTop.vrh" - #include "LegacyRegsTopConfig.vrh" -#endif - -class LegacyRegsTop extends AveTop { - LegacyRegsTopConfig topConfig; - - task new(string name, string instance, integer stream_id, LegacyRegsTopConfig topConfig); - virtual task reset_dut_t(); - virtual task start_xactor(); - virtual task stop_xactor(); - virtual task reset_xactor(integer rstType); -} - -task LegacyRegsTop::new(string name, string instance, integer stream_id, LegacyRegsTopConfig topConfig) { - super.new(name, instance, stream_id, topConfig); - this.topConfig = topConfig; -} - -task LegacyRegsTop::reset_dut_t() { - super.reset_dut_t(); -} - -task LegacyRegsTop::start_xactor() { - super.start_xactor(); -} - -task LegacyRegsTop::stop_xactor() { - super.stop_xactor(); -} - -task LegacyRegsTop::reset_xactor(integer rstType) { - super.reset_xactor(rstType); -} - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsTopConfig.vr b/drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsTopConfig.vr deleted file mode 100644 index 162195e5760f..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/LegacyRegsTopConfig.vr +++ /dev/null @@ -1,46 +0,0 @@ -#include - -#ifndef SYNOPSYS_NTB - #include "AveTopConfig.vr" -#endif - -class LegacyRegsTopConfig extends AveTopConfig { - local rvm_log log = new("LegacyRegsTopConfig", "class"); - - task new(rvm_log log = null, string name="LegacyRegsTopConfig", string instance="class"); - virtual function rvm_data allocate(); - virtual function rvm_data copy(rvm_data cpy = null); - virtual function AveData GetDutConfig(); - virtual task SetDutConfig(AveData dutConfig); -} - -task LegacyRegsTopConfig::new(rvm_log log = null, string name="LegacyRegsTopConfig", string instance="class") { - super.new(((log != null) ? log : this.log), name, instance); - if (log != null) this.log = log; -} - -function rvm_data LegacyRegsTopConfig::allocate() { - LegacyRegsTopConfig c = new(); - allocate = c; -} - -function rvm_data LegacyRegsTopConfig::copy(rvm_data cpy = null) { - LegacyRegsTopConfig to; - if (cpy == null) { - cast_assign(to, this.allocate()); - } - else { - if(!cast_assign(to, cpy, CHECK)) - rvm_error(this.log, "PROBLEM"); - } - void = super.copy(to); - copy = to; -} - -function AveData LegacyRegsTopConfig::GetDutConfig() { - GetDutConfig = null; -} - -task LegacyRegsTopConfig::SetDutConfig(AveData dutConfig) { -} - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/Makefile.child b/drivers/net/wireless/ar6003/include/AR6002/hw/Makefile.child deleted file mode 100644 index bff4ba902e61..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/Makefile.child +++ /dev/null @@ -1,10 +0,0 @@ -################################################################################ -# $Id: //depot/chips/mercury/2.1/dv/soc/src/ave/regs/Makefile.child#1 $ -################################################################################ - -NTB_SRCS += $(ROOT)/regs/LegacyRegsTopConfig.vr \ - $(ROOT)/regs/LegacyRegsTop.vr \ - $(ROOT)/regs/LegacyRegsEnvConfig.vr \ - $(ROOT)/regs/LegacyRegsEnv.vr \ - -NTB_INC_DIRS += $(ROOT)/regs diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/Makefile.reg b/drivers/net/wireless/ar6003/include/AR6002/hw/Makefile.reg deleted file mode 100644 index 946d31e9a986..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/Makefile.reg +++ /dev/null @@ -1,28 +0,0 @@ - - -GEN_VRH = reg -vrh -P4_EDIT = p4 edit -P4_SUBMIT = p4 submit - -REG_RTL_DIR = ../../../../../rtl -REG_SRCS = $(shell find $(REG_RTL_DIR) -name '*.reg'); -REG_VRH_TGTS = $(wildcard *_reg.vrh) - -REDO_ALL_REG_VRH = $(foreach var, $(REG_VRH_TGTS), $(GEN_VRH) $(filter %$(patsubst %vrh,%reg,$(var)), $(REG_SRCS));) - -VPATH = $(dir $(REG_SRCS)) - -all: $(REG_VRH_TGTS) - -refresh_all_reg_vrh: - $(P4_EDIT) $(REG_VRH_TGTS) - $(REDO_ALL_REG_VRH) - $(P4_SUBMIT) ... - -%_reg.vrh : %_reg.reg - $(P4_EDIT) $@ - $(GEN_VRH) $< - $(P4_SUBMIT) ... - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/addac.h b/drivers/net/wireless/ar6003/include/AR6002/hw/addac.h deleted file mode 100644 index 0c58cc04adad..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/addac.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef _ADDAC_REG_H_ -#define _ADDAC_REG_H_ - -#define ADDAC_ADDAC1_ADDRESS 0x00000000 -#define ADDAC_ADDAC1_OFFSET 0x00000000 -#define ADDAC_ADDAC1_PLL_SVREG_MSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_LSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_MASK 0x80000000 -#define ADDAC_ADDAC1_PLL_SVREG_GET(x) (((x) & ADDAC_ADDAC1_PLL_SVREG_MASK) >> ADDAC_ADDAC1_PLL_SVREG_LSB) -#define ADDAC_ADDAC1_PLL_SVREG_SET(x) (((x) << ADDAC_ADDAC1_PLL_SVREG_LSB) & ADDAC_ADDAC1_PLL_SVREG_MASK) -#define ADDAC_ADDAC1_PLL_SCLAMP_MSB 30 -#define ADDAC_ADDAC1_PLL_SCLAMP_LSB 28 -#define ADDAC_ADDAC1_PLL_SCLAMP_MASK 0x70000000 -#define ADDAC_ADDAC1_PLL_SCLAMP_GET(x) (((x) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) >> ADDAC_ADDAC1_PLL_SCLAMP_LSB) -#define ADDAC_ADDAC1_PLL_SCLAMP_SET(x) (((x) << ADDAC_ADDAC1_PLL_SCLAMP_LSB) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) -#define ADDAC_ADDAC1_PLL_ATB_MSB 27 -#define ADDAC_ADDAC1_PLL_ATB_LSB 26 -#define ADDAC_ADDAC1_PLL_ATB_MASK 0x0c000000 -#define ADDAC_ADDAC1_PLL_ATB_GET(x) (((x) & ADDAC_ADDAC1_PLL_ATB_MASK) >> ADDAC_ADDAC1_PLL_ATB_LSB) -#define ADDAC_ADDAC1_PLL_ATB_SET(x) (((x) << ADDAC_ADDAC1_PLL_ATB_LSB) & ADDAC_ADDAC1_PLL_ATB_MASK) -#define ADDAC_ADDAC1_PLL_ICP_MSB 25 -#define ADDAC_ADDAC1_PLL_ICP_LSB 23 -#define ADDAC_ADDAC1_PLL_ICP_MASK 0x03800000 -#define ADDAC_ADDAC1_PLL_ICP_GET(x) (((x) & ADDAC_ADDAC1_PLL_ICP_MASK) >> ADDAC_ADDAC1_PLL_ICP_LSB) -#define ADDAC_ADDAC1_PLL_ICP_SET(x) (((x) << ADDAC_ADDAC1_PLL_ICP_LSB) & ADDAC_ADDAC1_PLL_ICP_MASK) -#define ADDAC_ADDAC1_PLL_FILTER_MSB 22 -#define ADDAC_ADDAC1_PLL_FILTER_LSB 15 -#define ADDAC_ADDAC1_PLL_FILTER_MASK 0x007f8000 -#define ADDAC_ADDAC1_PLL_FILTER_GET(x) (((x) & ADDAC_ADDAC1_PLL_FILTER_MASK) >> ADDAC_ADDAC1_PLL_FILTER_LSB) -#define ADDAC_ADDAC1_PLL_FILTER_SET(x) (((x) << ADDAC_ADDAC1_PLL_FILTER_LSB) & ADDAC_ADDAC1_PLL_FILTER_MASK) -#define ADDAC_ADDAC1_PWDPLL_MSB 14 -#define ADDAC_ADDAC1_PWDPLL_LSB 14 -#define ADDAC_ADDAC1_PWDPLL_MASK 0x00004000 -#define ADDAC_ADDAC1_PWDPLL_GET(x) (((x) & ADDAC_ADDAC1_PWDPLL_MASK) >> ADDAC_ADDAC1_PWDPLL_LSB) -#define ADDAC_ADDAC1_PWDPLL_SET(x) (((x) << ADDAC_ADDAC1_PWDPLL_LSB) & ADDAC_ADDAC1_PWDPLL_MASK) -#define ADDAC_ADDAC1_PWDADC_MSB 13 -#define ADDAC_ADDAC1_PWDADC_LSB 13 -#define ADDAC_ADDAC1_PWDADC_MASK 0x00002000 -#define ADDAC_ADDAC1_PWDADC_GET(x) (((x) & ADDAC_ADDAC1_PWDADC_MASK) >> ADDAC_ADDAC1_PWDADC_LSB) -#define ADDAC_ADDAC1_PWDADC_SET(x) (((x) << ADDAC_ADDAC1_PWDADC_LSB) & ADDAC_ADDAC1_PWDADC_MASK) -#define ADDAC_ADDAC1_PWDDAC_MSB 12 -#define ADDAC_ADDAC1_PWDDAC_LSB 12 -#define ADDAC_ADDAC1_PWDDAC_MASK 0x00001000 -#define ADDAC_ADDAC1_PWDDAC_GET(x) (((x) & ADDAC_ADDAC1_PWDDAC_MASK) >> ADDAC_ADDAC1_PWDDAC_LSB) -#define ADDAC_ADDAC1_PWDDAC_SET(x) (((x) << ADDAC_ADDAC1_PWDDAC_LSB) & ADDAC_ADDAC1_PWDDAC_MASK) -#define ADDAC_ADDAC1_FORCEMSBLOW_MSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_LSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_MASK 0x00000800 -#define ADDAC_ADDAC1_FORCEMSBLOW_GET(x) (((x) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) >> ADDAC_ADDAC1_FORCEMSBLOW_LSB) -#define ADDAC_ADDAC1_FORCEMSBLOW_SET(x) (((x) << ADDAC_ADDAC1_FORCEMSBLOW_LSB) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) -#define ADDAC_ADDAC1_SELMANPWDS_MSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_LSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_MASK 0x00000400 -#define ADDAC_ADDAC1_SELMANPWDS_GET(x) (((x) & ADDAC_ADDAC1_SELMANPWDS_MASK) >> ADDAC_ADDAC1_SELMANPWDS_LSB) -#define ADDAC_ADDAC1_SELMANPWDS_SET(x) (((x) << ADDAC_ADDAC1_SELMANPWDS_LSB) & ADDAC_ADDAC1_SELMANPWDS_MASK) -#define ADDAC_ADDAC1_INV_CLK160_ADC_MSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_LSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_MASK 0x00000200 -#define ADDAC_ADDAC1_INV_CLK160_ADC_GET(x) (((x) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) >> ADDAC_ADDAC1_INV_CLK160_ADC_LSB) -#define ADDAC_ADDAC1_INV_CLK160_ADC_SET(x) (((x) << ADDAC_ADDAC1_INV_CLK160_ADC_LSB) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) -#define ADDAC_ADDAC1_CM_SEL_MSB 8 -#define ADDAC_ADDAC1_CM_SEL_LSB 7 -#define ADDAC_ADDAC1_CM_SEL_MASK 0x00000180 -#define ADDAC_ADDAC1_CM_SEL_GET(x) (((x) & ADDAC_ADDAC1_CM_SEL_MASK) >> ADDAC_ADDAC1_CM_SEL_LSB) -#define ADDAC_ADDAC1_CM_SEL_SET(x) (((x) << ADDAC_ADDAC1_CM_SEL_LSB) & ADDAC_ADDAC1_CM_SEL_MASK) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_LSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MASK 0x00000040 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_GET(x) (((x) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) >> ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_SET(x) (((x) << ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) -#define ADDAC_ADDAC1_SPARE_MSB 5 -#define ADDAC_ADDAC1_SPARE_LSB 0 -#define ADDAC_ADDAC1_SPARE_MASK 0x0000003f -#define ADDAC_ADDAC1_SPARE_GET(x) (((x) & ADDAC_ADDAC1_SPARE_MASK) >> ADDAC_ADDAC1_SPARE_LSB) -#define ADDAC_ADDAC1_SPARE_SET(x) (((x) << ADDAC_ADDAC1_SPARE_LSB) & ADDAC_ADDAC1_SPARE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct addac_reg_s { - volatile unsigned int addac_addac1; -} addac_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _ADDAC_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/addac.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/addac.vrh deleted file mode 100644 index caa44243dcc3..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/addac.vrh +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef _ADDAC_VRH_ -#define _ADDAC_VRH_ - -#define ADDAC_ADDAC1_ADDRESS 'h00000000 -#define ADDAC_ADDAC1_PLL_SVREG_MSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_LSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_MASK 'h80000000 -#define ADDAC_ADDAC1_PLL_SVREG_GET(x) (((x) & ADDAC_ADDAC1_PLL_SVREG_MASK) >> ADDAC_ADDAC1_PLL_SVREG_LSB) -#define ADDAC_ADDAC1_PLL_SVREG_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_SVREG_LSB) & ADDAC_ADDAC1_PLL_SVREG_MASK) -#define ADDAC_ADDAC1_PLL_SVREG_RESET 1'h1 -#define ADDAC_ADDAC1_PLL_SCLAMP_MSB 30 -#define ADDAC_ADDAC1_PLL_SCLAMP_LSB 28 -#define ADDAC_ADDAC1_PLL_SCLAMP_MASK 'h70000000 -#define ADDAC_ADDAC1_PLL_SCLAMP_GET(x) (((x) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) >> ADDAC_ADDAC1_PLL_SCLAMP_LSB) -#define ADDAC_ADDAC1_PLL_SCLAMP_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_SCLAMP_LSB) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) -#define ADDAC_ADDAC1_PLL_SCLAMP_RESET 3'h5 -#define ADDAC_ADDAC1_PLL_ATB_MSB 27 -#define ADDAC_ADDAC1_PLL_ATB_LSB 26 -#define ADDAC_ADDAC1_PLL_ATB_MASK 'h0c000000 -#define ADDAC_ADDAC1_PLL_ATB_GET(x) (((x) & ADDAC_ADDAC1_PLL_ATB_MASK) >> ADDAC_ADDAC1_PLL_ATB_LSB) -#define ADDAC_ADDAC1_PLL_ATB_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_ATB_LSB) & ADDAC_ADDAC1_PLL_ATB_MASK) -#define ADDAC_ADDAC1_PLL_ATB_RESET 2'h0 -#define ADDAC_ADDAC1_PLL_ICP_MSB 25 -#define ADDAC_ADDAC1_PLL_ICP_LSB 23 -#define ADDAC_ADDAC1_PLL_ICP_MASK 'h03800000 -#define ADDAC_ADDAC1_PLL_ICP_GET(x) (((x) & ADDAC_ADDAC1_PLL_ICP_MASK) >> ADDAC_ADDAC1_PLL_ICP_LSB) -#define ADDAC_ADDAC1_PLL_ICP_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_ICP_LSB) & ADDAC_ADDAC1_PLL_ICP_MASK) -#define ADDAC_ADDAC1_PLL_ICP_RESET 3'h0 -#define ADDAC_ADDAC1_PLL_FILTER_MSB 22 -#define ADDAC_ADDAC1_PLL_FILTER_LSB 15 -#define ADDAC_ADDAC1_PLL_FILTER_MASK 'h007f8000 -#define ADDAC_ADDAC1_PLL_FILTER_GET(x) (((x) & ADDAC_ADDAC1_PLL_FILTER_MASK) >> ADDAC_ADDAC1_PLL_FILTER_LSB) -#define ADDAC_ADDAC1_PLL_FILTER_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_FILTER_LSB) & ADDAC_ADDAC1_PLL_FILTER_MASK) -#define ADDAC_ADDAC1_PLL_FILTER_RESET 8'h35 -#define ADDAC_ADDAC1_PWDPLL_MSB 14 -#define ADDAC_ADDAC1_PWDPLL_LSB 14 -#define ADDAC_ADDAC1_PWDPLL_MASK 'h00004000 -#define ADDAC_ADDAC1_PWDPLL_GET(x) (((x) & ADDAC_ADDAC1_PWDPLL_MASK) >> ADDAC_ADDAC1_PWDPLL_LSB) -#define ADDAC_ADDAC1_PWDPLL_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PWDPLL_LSB) & ADDAC_ADDAC1_PWDPLL_MASK) -#define ADDAC_ADDAC1_PWDPLL_RESET 1'h0 -#define ADDAC_ADDAC1_PWDADC_MSB 13 -#define ADDAC_ADDAC1_PWDADC_LSB 13 -#define ADDAC_ADDAC1_PWDADC_MASK 'h00002000 -#define ADDAC_ADDAC1_PWDADC_GET(x) (((x) & ADDAC_ADDAC1_PWDADC_MASK) >> ADDAC_ADDAC1_PWDADC_LSB) -#define ADDAC_ADDAC1_PWDADC_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PWDADC_LSB) & ADDAC_ADDAC1_PWDADC_MASK) -#define ADDAC_ADDAC1_PWDADC_RESET 1'h0 -#define ADDAC_ADDAC1_PWDDAC_MSB 12 -#define ADDAC_ADDAC1_PWDDAC_LSB 12 -#define ADDAC_ADDAC1_PWDDAC_MASK 'h00001000 -#define ADDAC_ADDAC1_PWDDAC_GET(x) (((x) & ADDAC_ADDAC1_PWDDAC_MASK) >> ADDAC_ADDAC1_PWDDAC_LSB) -#define ADDAC_ADDAC1_PWDDAC_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PWDDAC_LSB) & ADDAC_ADDAC1_PWDDAC_MASK) -#define ADDAC_ADDAC1_PWDDAC_RESET 1'h0 -#define ADDAC_ADDAC1_FORCEMSBLOW_MSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_LSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_MASK 'h00000800 -#define ADDAC_ADDAC1_FORCEMSBLOW_GET(x) (((x) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) >> ADDAC_ADDAC1_FORCEMSBLOW_LSB) -#define ADDAC_ADDAC1_FORCEMSBLOW_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_FORCEMSBLOW_LSB) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) -#define ADDAC_ADDAC1_FORCEMSBLOW_RESET 1'h0 -#define ADDAC_ADDAC1_SELMANPWDS_MSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_LSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_MASK 'h00000400 -#define ADDAC_ADDAC1_SELMANPWDS_GET(x) (((x) & ADDAC_ADDAC1_SELMANPWDS_MASK) >> ADDAC_ADDAC1_SELMANPWDS_LSB) -#define ADDAC_ADDAC1_SELMANPWDS_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_SELMANPWDS_LSB) & ADDAC_ADDAC1_SELMANPWDS_MASK) -#define ADDAC_ADDAC1_SELMANPWDS_RESET 1'h0 -#define ADDAC_ADDAC1_INV_CLK160_ADC_MSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_LSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_MASK 'h00000200 -#define ADDAC_ADDAC1_INV_CLK160_ADC_GET(x) (((x) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) >> ADDAC_ADDAC1_INV_CLK160_ADC_LSB) -#define ADDAC_ADDAC1_INV_CLK160_ADC_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_INV_CLK160_ADC_LSB) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) -#define ADDAC_ADDAC1_INV_CLK160_ADC_RESET 1'h0 -#define ADDAC_ADDAC1_CM_SEL_MSB 8 -#define ADDAC_ADDAC1_CM_SEL_LSB 7 -#define ADDAC_ADDAC1_CM_SEL_MASK 'h00000180 -#define ADDAC_ADDAC1_CM_SEL_GET(x) (((x) & ADDAC_ADDAC1_CM_SEL_MASK) >> ADDAC_ADDAC1_CM_SEL_LSB) -#define ADDAC_ADDAC1_CM_SEL_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_CM_SEL_LSB) & ADDAC_ADDAC1_CM_SEL_MASK) -#define ADDAC_ADDAC1_CM_SEL_RESET 2'h1 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_LSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MASK 'h00000040 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_GET(x) (((x) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) >> ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_RESET 1'h0 -#define ADDAC_ADDAC1_SPARE_MSB 5 -#define ADDAC_ADDAC1_SPARE_LSB 0 -#define ADDAC_ADDAC1_SPARE_MASK 'h0000003f -#define ADDAC_ADDAC1_SPARE_GET(x) (((x) & ADDAC_ADDAC1_SPARE_MASK) >> ADDAC_ADDAC1_SPARE_LSB) -#define ADDAC_ADDAC1_SPARE_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_SPARE_LSB) & ADDAC_ADDAC1_SPARE_MASK) -#define ADDAC_ADDAC1_SPARE_RESET 6'h0 -#define ADDAC_ADDAC1_RESET (32'h0 | \ - ADDAC_ADDAC1_PLL_SVREG_SET(ADDAC_ADDAC1_PLL_SVREG_RESET) | \ - ADDAC_ADDAC1_PLL_SCLAMP_SET(ADDAC_ADDAC1_PLL_SCLAMP_RESET) | \ - ADDAC_ADDAC1_PLL_ATB_SET(ADDAC_ADDAC1_PLL_ATB_RESET) | \ - ADDAC_ADDAC1_PLL_ICP_SET(ADDAC_ADDAC1_PLL_ICP_RESET) | \ - ADDAC_ADDAC1_PLL_FILTER_SET(ADDAC_ADDAC1_PLL_FILTER_RESET) | \ - ADDAC_ADDAC1_PWDPLL_SET(ADDAC_ADDAC1_PWDPLL_RESET) | \ - ADDAC_ADDAC1_PWDADC_SET(ADDAC_ADDAC1_PWDADC_RESET) | \ - ADDAC_ADDAC1_PWDDAC_SET(ADDAC_ADDAC1_PWDDAC_RESET) | \ - ADDAC_ADDAC1_FORCEMSBLOW_SET(ADDAC_ADDAC1_FORCEMSBLOW_RESET) | \ - ADDAC_ADDAC1_SELMANPWDS_SET(ADDAC_ADDAC1_SELMANPWDS_RESET) | \ - ADDAC_ADDAC1_INV_CLK160_ADC_SET(ADDAC_ADDAC1_INV_CLK160_ADC_RESET) | \ - ADDAC_ADDAC1_CM_SEL_SET(ADDAC_ADDAC1_CM_SEL_RESET) | \ - ADDAC_ADDAC1_DISABLE_DAC_REG_SET(ADDAC_ADDAC1_DISABLE_DAC_REG_RESET) | \ - ADDAC_ADDAC1_SPARE_SET(ADDAC_ADDAC1_SPARE_RESET)) -#define ADDAC_ADDAC1_HW_MASK (32'h0) -#define ADDAC_ADDAC1_SW_MASK (32'h0 | \ - ADDAC_ADDAC1_PLL_SVREG_MASK | \ - ADDAC_ADDAC1_PLL_SCLAMP_MASK | \ - ADDAC_ADDAC1_PLL_ATB_MASK | \ - ADDAC_ADDAC1_PLL_ICP_MASK | \ - ADDAC_ADDAC1_PLL_FILTER_MASK | \ - ADDAC_ADDAC1_PWDPLL_MASK | \ - ADDAC_ADDAC1_PWDADC_MASK | \ - ADDAC_ADDAC1_PWDDAC_MASK | \ - ADDAC_ADDAC1_FORCEMSBLOW_MASK | \ - ADDAC_ADDAC1_SELMANPWDS_MASK | \ - ADDAC_ADDAC1_INV_CLK160_ADC_MASK | \ - ADDAC_ADDAC1_CM_SEL_MASK | \ - ADDAC_ADDAC1_DISABLE_DAC_REG_MASK | \ - ADDAC_ADDAC1_SPARE_MASK) - -#define ADDAC_ADDRESS_MSB 1 - -#endif /* _ADDAC_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/analog_intf_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/analog_intf_reg.h deleted file mode 100644 index 9c82767b6efb..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/analog_intf_reg.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef _ANALOG_INTF_REG_REG_H_ -#define _ANALOG_INTF_REG_REG_H_ - -#define SW_OVERRIDE_ADDRESS 0x00000080 -#define SW_OVERRIDE_OFFSET 0x00000080 -#define SW_OVERRIDE_SUPDATE_DELAY_MSB 1 -#define SW_OVERRIDE_SUPDATE_DELAY_LSB 1 -#define SW_OVERRIDE_SUPDATE_DELAY_MASK 0x00000002 -#define SW_OVERRIDE_SUPDATE_DELAY_GET(x) (((x) & SW_OVERRIDE_SUPDATE_DELAY_MASK) >> SW_OVERRIDE_SUPDATE_DELAY_LSB) -#define SW_OVERRIDE_SUPDATE_DELAY_SET(x) (((x) << SW_OVERRIDE_SUPDATE_DELAY_LSB) & SW_OVERRIDE_SUPDATE_DELAY_MASK) -#define SW_OVERRIDE_ENABLE_MSB 0 -#define SW_OVERRIDE_ENABLE_LSB 0 -#define SW_OVERRIDE_ENABLE_MASK 0x00000001 -#define SW_OVERRIDE_ENABLE_GET(x) (((x) & SW_OVERRIDE_ENABLE_MASK) >> SW_OVERRIDE_ENABLE_LSB) -#define SW_OVERRIDE_ENABLE_SET(x) (((x) << SW_OVERRIDE_ENABLE_LSB) & SW_OVERRIDE_ENABLE_MASK) - -#define SIN_VAL_ADDRESS 0x00000084 -#define SIN_VAL_OFFSET 0x00000084 -#define SIN_VAL_SIN_MSB 0 -#define SIN_VAL_SIN_LSB 0 -#define SIN_VAL_SIN_MASK 0x00000001 -#define SIN_VAL_SIN_GET(x) (((x) & SIN_VAL_SIN_MASK) >> SIN_VAL_SIN_LSB) -#define SIN_VAL_SIN_SET(x) (((x) << SIN_VAL_SIN_LSB) & SIN_VAL_SIN_MASK) - -#define SW_SCLK_ADDRESS 0x00000088 -#define SW_SCLK_OFFSET 0x00000088 -#define SW_SCLK_SW_SCLK_MSB 0 -#define SW_SCLK_SW_SCLK_LSB 0 -#define SW_SCLK_SW_SCLK_MASK 0x00000001 -#define SW_SCLK_SW_SCLK_GET(x) (((x) & SW_SCLK_SW_SCLK_MASK) >> SW_SCLK_SW_SCLK_LSB) -#define SW_SCLK_SW_SCLK_SET(x) (((x) << SW_SCLK_SW_SCLK_LSB) & SW_SCLK_SW_SCLK_MASK) - -#define SW_CNTL_ADDRESS 0x0000008c -#define SW_CNTL_OFFSET 0x0000008c -#define SW_CNTL_SW_SCAPTURE_MSB 2 -#define SW_CNTL_SW_SCAPTURE_LSB 2 -#define SW_CNTL_SW_SCAPTURE_MASK 0x00000004 -#define SW_CNTL_SW_SCAPTURE_GET(x) (((x) & SW_CNTL_SW_SCAPTURE_MASK) >> SW_CNTL_SW_SCAPTURE_LSB) -#define SW_CNTL_SW_SCAPTURE_SET(x) (((x) << SW_CNTL_SW_SCAPTURE_LSB) & SW_CNTL_SW_SCAPTURE_MASK) -#define SW_CNTL_SW_SUPDATE_MSB 1 -#define SW_CNTL_SW_SUPDATE_LSB 1 -#define SW_CNTL_SW_SUPDATE_MASK 0x00000002 -#define SW_CNTL_SW_SUPDATE_GET(x) (((x) & SW_CNTL_SW_SUPDATE_MASK) >> SW_CNTL_SW_SUPDATE_LSB) -#define SW_CNTL_SW_SUPDATE_SET(x) (((x) << SW_CNTL_SW_SUPDATE_LSB) & SW_CNTL_SW_SUPDATE_MASK) -#define SW_CNTL_SW_SOUT_MSB 0 -#define SW_CNTL_SW_SOUT_LSB 0 -#define SW_CNTL_SW_SOUT_MASK 0x00000001 -#define SW_CNTL_SW_SOUT_GET(x) (((x) & SW_CNTL_SW_SOUT_MASK) >> SW_CNTL_SW_SOUT_LSB) -#define SW_CNTL_SW_SOUT_SET(x) (((x) << SW_CNTL_SW_SOUT_LSB) & SW_CNTL_SW_SOUT_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct analog_intf_reg_reg_s { - unsigned char pad0[128]; /* pad to 0x80 */ - volatile unsigned int sw_override; - volatile unsigned int sin_val; - volatile unsigned int sw_sclk; - volatile unsigned int sw_cntl; -} analog_intf_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _ANALOG_INTF_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/analog_intf_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/analog_intf_reg.vrh deleted file mode 100644 index ade586e92eec..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/analog_intf_reg.vrh +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef _ANALOG_INTF_REG_VRH_ -#define _ANALOG_INTF_REG_VRH_ - -#define SW_OVERRIDE_ADDRESS 'h00000080 -#define SW_OVERRIDE_SUPDATE_DELAY_MSB 1 -#define SW_OVERRIDE_SUPDATE_DELAY_LSB 1 -#define SW_OVERRIDE_SUPDATE_DELAY_MASK 'h00000002 -#define SW_OVERRIDE_SUPDATE_DELAY_GET(x) (((x) & SW_OVERRIDE_SUPDATE_DELAY_MASK) >> SW_OVERRIDE_SUPDATE_DELAY_LSB) -#define SW_OVERRIDE_SUPDATE_DELAY_SET(x) (((32'd0 | (x)) << SW_OVERRIDE_SUPDATE_DELAY_LSB) & SW_OVERRIDE_SUPDATE_DELAY_MASK) -#define SW_OVERRIDE_SUPDATE_DELAY_RESET 1'h0 -#define SW_OVERRIDE_ENABLE_MSB 0 -#define SW_OVERRIDE_ENABLE_LSB 0 -#define SW_OVERRIDE_ENABLE_MASK 'h00000001 -#define SW_OVERRIDE_ENABLE_GET(x) (((x) & SW_OVERRIDE_ENABLE_MASK) >> SW_OVERRIDE_ENABLE_LSB) -#define SW_OVERRIDE_ENABLE_SET(x) (((32'd0 | (x)) << SW_OVERRIDE_ENABLE_LSB) & SW_OVERRIDE_ENABLE_MASK) -#define SW_OVERRIDE_ENABLE_RESET 1'h0 -#define SW_OVERRIDE_RESET (32'h0 | \ - SW_OVERRIDE_SUPDATE_DELAY_SET(SW_OVERRIDE_SUPDATE_DELAY_RESET) | \ - SW_OVERRIDE_ENABLE_SET(SW_OVERRIDE_ENABLE_RESET)) -#define SW_OVERRIDE_HW_MASK (32'h0) -#define SW_OVERRIDE_SW_MASK (32'h0 | \ - SW_OVERRIDE_SUPDATE_DELAY_MASK | \ - SW_OVERRIDE_ENABLE_MASK) - -#define SIN_VAL_ADDRESS 'h00000084 -#define SIN_VAL_SIN_MSB 0 -#define SIN_VAL_SIN_LSB 0 -#define SIN_VAL_SIN_MASK 'h00000001 -#define SIN_VAL_SIN_GET(x) (((x) & SIN_VAL_SIN_MASK) >> SIN_VAL_SIN_LSB) -#define SIN_VAL_SIN_SET(x) (((32'd0 | (x)) << SIN_VAL_SIN_LSB) & SIN_VAL_SIN_MASK) -#define SIN_VAL_SIN_RESET 1'h0 -#define SIN_VAL_RESET (32'h0 | \ - SIN_VAL_SIN_SET(SIN_VAL_SIN_RESET)) -#define SIN_VAL_HW_MASK (32'h0 | \ - SIN_VAL_SIN_MASK) -#define SIN_VAL_SW_MASK (32'h0) - -#define SW_SCLK_ADDRESS 'h00000088 -#define SW_SCLK_SW_SCLK_MSB 0 -#define SW_SCLK_SW_SCLK_LSB 0 -#define SW_SCLK_SW_SCLK_MASK 'h00000001 -#define SW_SCLK_SW_SCLK_GET(x) (((x) & SW_SCLK_SW_SCLK_MASK) >> SW_SCLK_SW_SCLK_LSB) -#define SW_SCLK_SW_SCLK_SET(x) (((32'd0 | (x)) << SW_SCLK_SW_SCLK_LSB) & SW_SCLK_SW_SCLK_MASK) -#define SW_SCLK_SW_SCLK_RESET 1'h0 -#define SW_SCLK_RESET (32'h0 | \ - SW_SCLK_SW_SCLK_SET(SW_SCLK_SW_SCLK_RESET)) -#define SW_SCLK_HW_MASK (32'h0) -#define SW_SCLK_SW_MASK (32'h0 | \ - SW_SCLK_SW_SCLK_MASK) - -#define SW_CNTL_ADDRESS 'h0000008c -#define SW_CNTL_SW_SCAPTURE_MSB 2 -#define SW_CNTL_SW_SCAPTURE_LSB 2 -#define SW_CNTL_SW_SCAPTURE_MASK 'h00000004 -#define SW_CNTL_SW_SCAPTURE_GET(x) (((x) & SW_CNTL_SW_SCAPTURE_MASK) >> SW_CNTL_SW_SCAPTURE_LSB) -#define SW_CNTL_SW_SCAPTURE_SET(x) (((32'd0 | (x)) << SW_CNTL_SW_SCAPTURE_LSB) & SW_CNTL_SW_SCAPTURE_MASK) -#define SW_CNTL_SW_SCAPTURE_RESET 1'h0 -#define SW_CNTL_SW_SUPDATE_MSB 1 -#define SW_CNTL_SW_SUPDATE_LSB 1 -#define SW_CNTL_SW_SUPDATE_MASK 'h00000002 -#define SW_CNTL_SW_SUPDATE_GET(x) (((x) & SW_CNTL_SW_SUPDATE_MASK) >> SW_CNTL_SW_SUPDATE_LSB) -#define SW_CNTL_SW_SUPDATE_SET(x) (((32'd0 | (x)) << SW_CNTL_SW_SUPDATE_LSB) & SW_CNTL_SW_SUPDATE_MASK) -#define SW_CNTL_SW_SUPDATE_RESET 1'h0 -#define SW_CNTL_SW_SOUT_MSB 0 -#define SW_CNTL_SW_SOUT_LSB 0 -#define SW_CNTL_SW_SOUT_MASK 'h00000001 -#define SW_CNTL_SW_SOUT_GET(x) (((x) & SW_CNTL_SW_SOUT_MASK) >> SW_CNTL_SW_SOUT_LSB) -#define SW_CNTL_SW_SOUT_SET(x) (((32'd0 | (x)) << SW_CNTL_SW_SOUT_LSB) & SW_CNTL_SW_SOUT_MASK) -#define SW_CNTL_SW_SOUT_RESET 1'h0 -#define SW_CNTL_RESET (32'h0 | \ - SW_CNTL_SW_SCAPTURE_SET(SW_CNTL_SW_SCAPTURE_RESET) | \ - SW_CNTL_SW_SUPDATE_SET(SW_CNTL_SW_SUPDATE_RESET) | \ - SW_CNTL_SW_SOUT_SET(SW_CNTL_SW_SOUT_RESET)) -#define SW_CNTL_HW_MASK (32'h0) -#define SW_CNTL_SW_MASK (32'h0 | \ - SW_CNTL_SW_SCAPTURE_MASK | \ - SW_CNTL_SW_SUPDATE_MASK | \ - SW_CNTL_SW_SOUT_MASK) - -#define ANALOG_INTF_REG_ADDRESS_MSB 7 - -#endif /* _ANALOG_INTF_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/analog_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/analog_reg.h deleted file mode 100644 index cf562b86f655..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/analog_reg.h +++ /dev/null @@ -1,1932 +0,0 @@ -#ifndef _ANALOG_REG_REG_H_ -#define _ANALOG_REG_REG_H_ - -#define SYNTH_SYNTH1_ADDRESS 0x00000000 -#define SYNTH_SYNTH1_OFFSET 0x00000000 -#define SYNTH_SYNTH1_PWD_BIAS_MSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_LSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_MASK 0x80000000 -#define SYNTH_SYNTH1_PWD_BIAS_GET(x) (((x) & SYNTH_SYNTH1_PWD_BIAS_MASK) >> SYNTH_SYNTH1_PWD_BIAS_LSB) -#define SYNTH_SYNTH1_PWD_BIAS_SET(x) (((x) << SYNTH_SYNTH1_PWD_BIAS_LSB) & SYNTH_SYNTH1_PWD_BIAS_MASK) -#define SYNTH_SYNTH1_PWD_CP_MSB 30 -#define SYNTH_SYNTH1_PWD_CP_LSB 30 -#define SYNTH_SYNTH1_PWD_CP_MASK 0x40000000 -#define SYNTH_SYNTH1_PWD_CP_GET(x) (((x) & SYNTH_SYNTH1_PWD_CP_MASK) >> SYNTH_SYNTH1_PWD_CP_LSB) -#define SYNTH_SYNTH1_PWD_CP_SET(x) (((x) << SYNTH_SYNTH1_PWD_CP_LSB) & SYNTH_SYNTH1_PWD_CP_MASK) -#define SYNTH_SYNTH1_PWD_VCMON_MSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_LSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_MASK 0x20000000 -#define SYNTH_SYNTH1_PWD_VCMON_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCMON_MASK) >> SYNTH_SYNTH1_PWD_VCMON_LSB) -#define SYNTH_SYNTH1_PWD_VCMON_SET(x) (((x) << SYNTH_SYNTH1_PWD_VCMON_LSB) & SYNTH_SYNTH1_PWD_VCMON_MASK) -#define SYNTH_SYNTH1_PWD_VCO_MSB 28 -#define SYNTH_SYNTH1_PWD_VCO_LSB 28 -#define SYNTH_SYNTH1_PWD_VCO_MASK 0x10000000 -#define SYNTH_SYNTH1_PWD_VCO_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCO_MASK) >> SYNTH_SYNTH1_PWD_VCO_LSB) -#define SYNTH_SYNTH1_PWD_VCO_SET(x) (((x) << SYNTH_SYNTH1_PWD_VCO_LSB) & SYNTH_SYNTH1_PWD_VCO_MASK) -#define SYNTH_SYNTH1_PWD_PRESC_MSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_LSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_MASK 0x08000000 -#define SYNTH_SYNTH1_PWD_PRESC_GET(x) (((x) & SYNTH_SYNTH1_PWD_PRESC_MASK) >> SYNTH_SYNTH1_PWD_PRESC_LSB) -#define SYNTH_SYNTH1_PWD_PRESC_SET(x) (((x) << SYNTH_SYNTH1_PWD_PRESC_LSB) & SYNTH_SYNTH1_PWD_PRESC_MASK) -#define SYNTH_SYNTH1_PWD_LODIV_MSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_LSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_MASK 0x04000000 -#define SYNTH_SYNTH1_PWD_LODIV_GET(x) (((x) & SYNTH_SYNTH1_PWD_LODIV_MASK) >> SYNTH_SYNTH1_PWD_LODIV_LSB) -#define SYNTH_SYNTH1_PWD_LODIV_SET(x) (((x) << SYNTH_SYNTH1_PWD_LODIV_LSB) & SYNTH_SYNTH1_PWD_LODIV_MASK) -#define SYNTH_SYNTH1_PWD_LOMIX_MSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_LSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_MASK 0x02000000 -#define SYNTH_SYNTH1_PWD_LOMIX_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOMIX_MASK) >> SYNTH_SYNTH1_PWD_LOMIX_LSB) -#define SYNTH_SYNTH1_PWD_LOMIX_SET(x) (((x) << SYNTH_SYNTH1_PWD_LOMIX_LSB) & SYNTH_SYNTH1_PWD_LOMIX_MASK) -#define SYNTH_SYNTH1_FORCE_LO_ON_MSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_LSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_MASK 0x01000000 -#define SYNTH_SYNTH1_FORCE_LO_ON_GET(x) (((x) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) >> SYNTH_SYNTH1_FORCE_LO_ON_LSB) -#define SYNTH_SYNTH1_FORCE_LO_ON_SET(x) (((x) << SYNTH_SYNTH1_FORCE_LO_ON_LSB) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) -#define SYNTH_SYNTH1_PWD_LOBUF5G_MSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_LSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_MASK 0x00800000 -#define SYNTH_SYNTH1_PWD_LOBUF5G_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) >> SYNTH_SYNTH1_PWD_LOBUF5G_LSB) -#define SYNTH_SYNTH1_PWD_LOBUF5G_SET(x) (((x) << SYNTH_SYNTH1_PWD_LOBUF5G_LSB) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) -#define SYNTH_SYNTH1_VCOREGBYPASS_MSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_LSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_MASK 0x00400000 -#define SYNTH_SYNTH1_VCOREGBYPASS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) >> SYNTH_SYNTH1_VCOREGBYPASS_LSB) -#define SYNTH_SYNTH1_VCOREGBYPASS_SET(x) (((x) << SYNTH_SYNTH1_VCOREGBYPASS_LSB) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) -#define SYNTH_SYNTH1_VCOREGLEVEL_MSB 21 -#define SYNTH_SYNTH1_VCOREGLEVEL_LSB 20 -#define SYNTH_SYNTH1_VCOREGLEVEL_MASK 0x00300000 -#define SYNTH_SYNTH1_VCOREGLEVEL_GET(x) (((x) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) >> SYNTH_SYNTH1_VCOREGLEVEL_LSB) -#define SYNTH_SYNTH1_VCOREGLEVEL_SET(x) (((x) << SYNTH_SYNTH1_VCOREGLEVEL_LSB) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) -#define SYNTH_SYNTH1_VCOREGBIAS_MSB 19 -#define SYNTH_SYNTH1_VCOREGBIAS_LSB 18 -#define SYNTH_SYNTH1_VCOREGBIAS_MASK 0x000c0000 -#define SYNTH_SYNTH1_VCOREGBIAS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBIAS_MASK) >> SYNTH_SYNTH1_VCOREGBIAS_LSB) -#define SYNTH_SYNTH1_VCOREGBIAS_SET(x) (((x) << SYNTH_SYNTH1_VCOREGBIAS_LSB) & SYNTH_SYNTH1_VCOREGBIAS_MASK) -#define SYNTH_SYNTH1_SLIDINGIF_MSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_LSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_MASK 0x00020000 -#define SYNTH_SYNTH1_SLIDINGIF_GET(x) (((x) & SYNTH_SYNTH1_SLIDINGIF_MASK) >> SYNTH_SYNTH1_SLIDINGIF_LSB) -#define SYNTH_SYNTH1_SLIDINGIF_SET(x) (((x) << SYNTH_SYNTH1_SLIDINGIF_LSB) & SYNTH_SYNTH1_SLIDINGIF_MASK) -#define SYNTH_SYNTH1_SPARE_PWD_MSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_LSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_MASK 0x00010000 -#define SYNTH_SYNTH1_SPARE_PWD_GET(x) (((x) & SYNTH_SYNTH1_SPARE_PWD_MASK) >> SYNTH_SYNTH1_SPARE_PWD_LSB) -#define SYNTH_SYNTH1_SPARE_PWD_SET(x) (((x) << SYNTH_SYNTH1_SPARE_PWD_LSB) & SYNTH_SYNTH1_SPARE_PWD_MASK) -#define SYNTH_SYNTH1_CON_VDDVCOREG_MSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_LSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_MASK 0x00008000 -#define SYNTH_SYNTH1_CON_VDDVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) >> SYNTH_SYNTH1_CON_VDDVCOREG_LSB) -#define SYNTH_SYNTH1_CON_VDDVCOREG_SET(x) (((x) << SYNTH_SYNTH1_CON_VDDVCOREG_LSB) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) -#define SYNTH_SYNTH1_CON_IVCOREG_MSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_LSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_MASK 0x00004000 -#define SYNTH_SYNTH1_CON_IVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOREG_MASK) >> SYNTH_SYNTH1_CON_IVCOREG_LSB) -#define SYNTH_SYNTH1_CON_IVCOREG_SET(x) (((x) << SYNTH_SYNTH1_CON_IVCOREG_LSB) & SYNTH_SYNTH1_CON_IVCOREG_MASK) -#define SYNTH_SYNTH1_CON_IVCOBUF_MSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_LSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_MASK 0x00002000 -#define SYNTH_SYNTH1_CON_IVCOBUF_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) >> SYNTH_SYNTH1_CON_IVCOBUF_LSB) -#define SYNTH_SYNTH1_CON_IVCOBUF_SET(x) (((x) << SYNTH_SYNTH1_CON_IVCOBUF_LSB) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) -#define SYNTH_SYNTH1_SEL_VCMONABUS_MSB 12 -#define SYNTH_SYNTH1_SEL_VCMONABUS_LSB 10 -#define SYNTH_SYNTH1_SEL_VCMONABUS_MASK 0x00001c00 -#define SYNTH_SYNTH1_SEL_VCMONABUS_GET(x) (((x) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) >> SYNTH_SYNTH1_SEL_VCMONABUS_LSB) -#define SYNTH_SYNTH1_SEL_VCMONABUS_SET(x) (((x) << SYNTH_SYNTH1_SEL_VCMONABUS_LSB) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK 0x00000200 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) >> SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_LSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MASK 0x00000100 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) >> SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK 0x00000080 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK 0x00000040 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_MSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_LSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_MASK 0x00000020 -#define SYNTH_SYNTH1_MONITOR_FB_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_MASK) >> SYNTH_SYNTH1_MONITOR_FB_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_FB_LSB) & SYNTH_SYNTH1_MONITOR_FB_MASK) -#define SYNTH_SYNTH1_MONITOR_REF_MSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_LSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_MASK 0x00000010 -#define SYNTH_SYNTH1_MONITOR_REF_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_REF_MASK) >> SYNTH_SYNTH1_MONITOR_REF_LSB) -#define SYNTH_SYNTH1_MONITOR_REF_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_REF_LSB) & SYNTH_SYNTH1_MONITOR_REF_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK 0x00000008 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) >> SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK 0x00000004 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) >> SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_LSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MASK 0x00000002 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) >> SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK 0x00000001 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) >> SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) - -#define SYNTH_SYNTH2_ADDRESS 0x00000004 -#define SYNTH_SYNTH2_OFFSET 0x00000004 -#define SYNTH_SYNTH2_VC_CAL_REF_MSB 31 -#define SYNTH_SYNTH2_VC_CAL_REF_LSB 29 -#define SYNTH_SYNTH2_VC_CAL_REF_MASK 0xe0000000 -#define SYNTH_SYNTH2_VC_CAL_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_CAL_REF_MASK) >> SYNTH_SYNTH2_VC_CAL_REF_LSB) -#define SYNTH_SYNTH2_VC_CAL_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_CAL_REF_LSB) & SYNTH_SYNTH2_VC_CAL_REF_MASK) -#define SYNTH_SYNTH2_VC_HI_REF_MSB 28 -#define SYNTH_SYNTH2_VC_HI_REF_LSB 26 -#define SYNTH_SYNTH2_VC_HI_REF_MASK 0x1c000000 -#define SYNTH_SYNTH2_VC_HI_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_HI_REF_MASK) >> SYNTH_SYNTH2_VC_HI_REF_LSB) -#define SYNTH_SYNTH2_VC_HI_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_HI_REF_LSB) & SYNTH_SYNTH2_VC_HI_REF_MASK) -#define SYNTH_SYNTH2_VC_MID_REF_MSB 25 -#define SYNTH_SYNTH2_VC_MID_REF_LSB 23 -#define SYNTH_SYNTH2_VC_MID_REF_MASK 0x03800000 -#define SYNTH_SYNTH2_VC_MID_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_MID_REF_MASK) >> SYNTH_SYNTH2_VC_MID_REF_LSB) -#define SYNTH_SYNTH2_VC_MID_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_MID_REF_LSB) & SYNTH_SYNTH2_VC_MID_REF_MASK) -#define SYNTH_SYNTH2_VC_LOW_REF_MSB 22 -#define SYNTH_SYNTH2_VC_LOW_REF_LSB 20 -#define SYNTH_SYNTH2_VC_LOW_REF_MASK 0x00700000 -#define SYNTH_SYNTH2_VC_LOW_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_LOW_REF_MASK) >> SYNTH_SYNTH2_VC_LOW_REF_LSB) -#define SYNTH_SYNTH2_VC_LOW_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_LOW_REF_LSB) & SYNTH_SYNTH2_VC_LOW_REF_MASK) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MSB 19 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB 15 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK 0x000f8000 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_GET(x) (((x) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) >> SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_SET(x) (((x) << SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) -#define SYNTH_SYNTH2_LOOP_CP_MSB 14 -#define SYNTH_SYNTH2_LOOP_CP_LSB 10 -#define SYNTH_SYNTH2_LOOP_CP_MASK 0x00007c00 -#define SYNTH_SYNTH2_LOOP_CP_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CP_MASK) >> SYNTH_SYNTH2_LOOP_CP_LSB) -#define SYNTH_SYNTH2_LOOP_CP_SET(x) (((x) << SYNTH_SYNTH2_LOOP_CP_LSB) & SYNTH_SYNTH2_LOOP_CP_MASK) -#define SYNTH_SYNTH2_LOOP_RS_MSB 9 -#define SYNTH_SYNTH2_LOOP_RS_LSB 5 -#define SYNTH_SYNTH2_LOOP_RS_MASK 0x000003e0 -#define SYNTH_SYNTH2_LOOP_RS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_RS_MASK) >> SYNTH_SYNTH2_LOOP_RS_LSB) -#define SYNTH_SYNTH2_LOOP_RS_SET(x) (((x) << SYNTH_SYNTH2_LOOP_RS_LSB) & SYNTH_SYNTH2_LOOP_RS_MASK) -#define SYNTH_SYNTH2_LOOP_CS_MSB 4 -#define SYNTH_SYNTH2_LOOP_CS_LSB 3 -#define SYNTH_SYNTH2_LOOP_CS_MASK 0x00000018 -#define SYNTH_SYNTH2_LOOP_CS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CS_MASK) >> SYNTH_SYNTH2_LOOP_CS_LSB) -#define SYNTH_SYNTH2_LOOP_CS_SET(x) (((x) << SYNTH_SYNTH2_LOOP_CS_LSB) & SYNTH_SYNTH2_LOOP_CS_MASK) -#define SYNTH_SYNTH2_SPARE_BITS_MSB 2 -#define SYNTH_SYNTH2_SPARE_BITS_LSB 0 -#define SYNTH_SYNTH2_SPARE_BITS_MASK 0x00000007 -#define SYNTH_SYNTH2_SPARE_BITS_GET(x) (((x) & SYNTH_SYNTH2_SPARE_BITS_MASK) >> SYNTH_SYNTH2_SPARE_BITS_LSB) -#define SYNTH_SYNTH2_SPARE_BITS_SET(x) (((x) << SYNTH_SYNTH2_SPARE_BITS_LSB) & SYNTH_SYNTH2_SPARE_BITS_MASK) - -#define SYNTH_SYNTH3_ADDRESS 0x00000008 -#define SYNTH_SYNTH3_OFFSET 0x00000008 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_LSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MASK 0x80000000 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_GET(x) (((x) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) >> SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) -#define SYNTH_SYNTH3_DIS_CLK_XTAL_SET(x) (((x) << SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_LSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MASK 0x40000000 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_GET(x) (((x) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) >> SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_SET(x) (((x) << SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MSB 29 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB 24 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK 0x3f000000 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_SET(x) (((x) << SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_PWRUP_MSB 23 -#define SYNTH_SYNTH3_WAIT_PWRUP_LSB 18 -#define SYNTH_SYNTH3_WAIT_PWRUP_MASK 0x00fc0000 -#define SYNTH_SYNTH3_WAIT_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_PWRUP_SET(x) (((x) << SYNTH_SYNTH3_WAIT_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MSB 17 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_LSB 12 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MASK 0x0003f000 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_SET(x) (((x) << SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MSB 11 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_LSB 6 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MASK 0x00000fc0 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_SET(x) (((x) << SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MSB 5 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_LSB 0 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MASK 0x0000003f -#define SYNTH_SYNTH3_WAIT_VC_CHECK_GET(x) (((x) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) >> SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_SET(x) (((x) << SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) - -#define SYNTH_SYNTH4_ADDRESS 0x0000000c -#define SYNTH_SYNTH4_OFFSET 0x0000000c -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK 0x80000000 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_GET(x) (((x) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) >> SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_SET(x) (((x) << SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) -#define SYNTH_SYNTH4_DIS_LOSTVC_MSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_LSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_MASK 0x40000000 -#define SYNTH_SYNTH4_DIS_LOSTVC_GET(x) (((x) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) >> SYNTH_SYNTH4_DIS_LOSTVC_LSB) -#define SYNTH_SYNTH4_DIS_LOSTVC_SET(x) (((x) << SYNTH_SYNTH4_DIS_LOSTVC_LSB) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_LSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MASK 0x20000000 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_GET(x) (((x) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) >> SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_SET(x) (((x) << SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK 0x10000000 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_GET(x) (((x) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) >> SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_SET(x) (((x) << SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) -#define SYNTH_SYNTH4_FORCE_PINVC_MSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_LSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_MASK 0x08000000 -#define SYNTH_SYNTH4_FORCE_PINVC_GET(x) (((x) & SYNTH_SYNTH4_FORCE_PINVC_MASK) >> SYNTH_SYNTH4_FORCE_PINVC_LSB) -#define SYNTH_SYNTH4_FORCE_PINVC_SET(x) (((x) << SYNTH_SYNTH4_FORCE_PINVC_LSB) & SYNTH_SYNTH4_FORCE_PINVC_MASK) -#define SYNTH_SYNTH4_FORCE_VCOCAP_MSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_LSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_MASK 0x04000000 -#define SYNTH_SYNTH4_FORCE_VCOCAP_GET(x) (((x) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) >> SYNTH_SYNTH4_FORCE_VCOCAP_LSB) -#define SYNTH_SYNTH4_FORCE_VCOCAP_SET(x) (((x) << SYNTH_SYNTH4_FORCE_VCOCAP_LSB) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) -#define SYNTH_SYNTH4_VCOCAP_OVR_MSB 25 -#define SYNTH_SYNTH4_VCOCAP_OVR_LSB 18 -#define SYNTH_SYNTH4_VCOCAP_OVR_MASK 0x03fc0000 -#define SYNTH_SYNTH4_VCOCAP_OVR_GET(x) (((x) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) >> SYNTH_SYNTH4_VCOCAP_OVR_LSB) -#define SYNTH_SYNTH4_VCOCAP_OVR_SET(x) (((x) << SYNTH_SYNTH4_VCOCAP_OVR_LSB) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) -#define SYNTH_SYNTH4_VCOCAPPULLUP_MSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_LSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_MASK 0x00020000 -#define SYNTH_SYNTH4_VCOCAPPULLUP_GET(x) (((x) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) >> SYNTH_SYNTH4_VCOCAPPULLUP_LSB) -#define SYNTH_SYNTH4_VCOCAPPULLUP_SET(x) (((x) << SYNTH_SYNTH4_VCOCAPPULLUP_LSB) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) -#define SYNTH_SYNTH4_REFDIVSEL_MSB 16 -#define SYNTH_SYNTH4_REFDIVSEL_LSB 15 -#define SYNTH_SYNTH4_REFDIVSEL_MASK 0x00018000 -#define SYNTH_SYNTH4_REFDIVSEL_GET(x) (((x) & SYNTH_SYNTH4_REFDIVSEL_MASK) >> SYNTH_SYNTH4_REFDIVSEL_LSB) -#define SYNTH_SYNTH4_REFDIVSEL_SET(x) (((x) << SYNTH_SYNTH4_REFDIVSEL_LSB) & SYNTH_SYNTH4_REFDIVSEL_MASK) -#define SYNTH_SYNTH4_PFDDELAY_MSB 14 -#define SYNTH_SYNTH4_PFDDELAY_LSB 14 -#define SYNTH_SYNTH4_PFDDELAY_MASK 0x00004000 -#define SYNTH_SYNTH4_PFDDELAY_GET(x) (((x) & SYNTH_SYNTH4_PFDDELAY_MASK) >> SYNTH_SYNTH4_PFDDELAY_LSB) -#define SYNTH_SYNTH4_PFDDELAY_SET(x) (((x) << SYNTH_SYNTH4_PFDDELAY_LSB) & SYNTH_SYNTH4_PFDDELAY_MASK) -#define SYNTH_SYNTH4_PFD_DISABLE_MSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_LSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_MASK 0x00002000 -#define SYNTH_SYNTH4_PFD_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_PFD_DISABLE_MASK) >> SYNTH_SYNTH4_PFD_DISABLE_LSB) -#define SYNTH_SYNTH4_PFD_DISABLE_SET(x) (((x) << SYNTH_SYNTH4_PFD_DISABLE_LSB) & SYNTH_SYNTH4_PFD_DISABLE_MASK) -#define SYNTH_SYNTH4_PRESCSEL_MSB 12 -#define SYNTH_SYNTH4_PRESCSEL_LSB 11 -#define SYNTH_SYNTH4_PRESCSEL_MASK 0x00001800 -#define SYNTH_SYNTH4_PRESCSEL_GET(x) (((x) & SYNTH_SYNTH4_PRESCSEL_MASK) >> SYNTH_SYNTH4_PRESCSEL_LSB) -#define SYNTH_SYNTH4_PRESCSEL_SET(x) (((x) << SYNTH_SYNTH4_PRESCSEL_LSB) & SYNTH_SYNTH4_PRESCSEL_MASK) -#define SYNTH_SYNTH4_RESET_PRESC_MSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_LSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_MASK 0x00000400 -#define SYNTH_SYNTH4_RESET_PRESC_GET(x) (((x) & SYNTH_SYNTH4_RESET_PRESC_MASK) >> SYNTH_SYNTH4_RESET_PRESC_LSB) -#define SYNTH_SYNTH4_RESET_PRESC_SET(x) (((x) << SYNTH_SYNTH4_RESET_PRESC_LSB) & SYNTH_SYNTH4_RESET_PRESC_MASK) -#define SYNTH_SYNTH4_SDM_DISABLE_MSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_LSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_MASK 0x00000200 -#define SYNTH_SYNTH4_SDM_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_SDM_DISABLE_MASK) >> SYNTH_SYNTH4_SDM_DISABLE_LSB) -#define SYNTH_SYNTH4_SDM_DISABLE_SET(x) (((x) << SYNTH_SYNTH4_SDM_DISABLE_LSB) & SYNTH_SYNTH4_SDM_DISABLE_MASK) -#define SYNTH_SYNTH4_SDM_MODE_MSB 8 -#define SYNTH_SYNTH4_SDM_MODE_LSB 8 -#define SYNTH_SYNTH4_SDM_MODE_MASK 0x00000100 -#define SYNTH_SYNTH4_SDM_MODE_GET(x) (((x) & SYNTH_SYNTH4_SDM_MODE_MASK) >> SYNTH_SYNTH4_SDM_MODE_LSB) -#define SYNTH_SYNTH4_SDM_MODE_SET(x) (((x) << SYNTH_SYNTH4_SDM_MODE_LSB) & SYNTH_SYNTH4_SDM_MODE_MASK) -#define SYNTH_SYNTH4_SDM_DITHER_MSB 7 -#define SYNTH_SYNTH4_SDM_DITHER_LSB 6 -#define SYNTH_SYNTH4_SDM_DITHER_MASK 0x000000c0 -#define SYNTH_SYNTH4_SDM_DITHER_GET(x) (((x) & SYNTH_SYNTH4_SDM_DITHER_MASK) >> SYNTH_SYNTH4_SDM_DITHER_LSB) -#define SYNTH_SYNTH4_SDM_DITHER_SET(x) (((x) << SYNTH_SYNTH4_SDM_DITHER_LSB) & SYNTH_SYNTH4_SDM_DITHER_MASK) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK 0x00000020 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_GET(x) (((x) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) >> SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_SET(x) (((x) << SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK 0x00000010 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_GET(x) (((x) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) >> SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_SET(x) (((x) << SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) -#define SYNTH_SYNTH4_SPARE_MISC_MSB 3 -#define SYNTH_SYNTH4_SPARE_MISC_LSB 2 -#define SYNTH_SYNTH4_SPARE_MISC_MASK 0x0000000c -#define SYNTH_SYNTH4_SPARE_MISC_GET(x) (((x) & SYNTH_SYNTH4_SPARE_MISC_MASK) >> SYNTH_SYNTH4_SPARE_MISC_LSB) -#define SYNTH_SYNTH4_SPARE_MISC_SET(x) (((x) << SYNTH_SYNTH4_SPARE_MISC_LSB) & SYNTH_SYNTH4_SPARE_MISC_MASK) -#define SYNTH_SYNTH4_LONGSHIFTSEL_MSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_LSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_MASK 0x00000002 -#define SYNTH_SYNTH4_LONGSHIFTSEL_GET(x) (((x) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) >> SYNTH_SYNTH4_LONGSHIFTSEL_LSB) -#define SYNTH_SYNTH4_LONGSHIFTSEL_SET(x) (((x) << SYNTH_SYNTH4_LONGSHIFTSEL_LSB) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_LSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MASK 0x00000001 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_GET(x) (((x) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) >> SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_SET(x) (((x) << SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) - -#define SYNTH_SYNTH5_ADDRESS 0x00000010 -#define SYNTH_SYNTH5_OFFSET 0x00000010 -#define SYNTH_SYNTH5_LOOP_IP0_MSB 31 -#define SYNTH_SYNTH5_LOOP_IP0_LSB 28 -#define SYNTH_SYNTH5_LOOP_IP0_MASK 0xf0000000 -#define SYNTH_SYNTH5_LOOP_IP0_GET(x) (((x) & SYNTH_SYNTH5_LOOP_IP0_MASK) >> SYNTH_SYNTH5_LOOP_IP0_LSB) -#define SYNTH_SYNTH5_LOOP_IP0_SET(x) (((x) << SYNTH_SYNTH5_LOOP_IP0_LSB) & SYNTH_SYNTH5_LOOP_IP0_MASK) -#define SYNTH_SYNTH5_SLOPE_IP_MSB 27 -#define SYNTH_SYNTH5_SLOPE_IP_LSB 25 -#define SYNTH_SYNTH5_SLOPE_IP_MASK 0x0e000000 -#define SYNTH_SYNTH5_SLOPE_IP_GET(x) (((x) & SYNTH_SYNTH5_SLOPE_IP_MASK) >> SYNTH_SYNTH5_SLOPE_IP_LSB) -#define SYNTH_SYNTH5_SLOPE_IP_SET(x) (((x) << SYNTH_SYNTH5_SLOPE_IP_LSB) & SYNTH_SYNTH5_SLOPE_IP_MASK) -#define SYNTH_SYNTH5_CPBIAS_MSB 24 -#define SYNTH_SYNTH5_CPBIAS_LSB 23 -#define SYNTH_SYNTH5_CPBIAS_MASK 0x01800000 -#define SYNTH_SYNTH5_CPBIAS_GET(x) (((x) & SYNTH_SYNTH5_CPBIAS_MASK) >> SYNTH_SYNTH5_CPBIAS_LSB) -#define SYNTH_SYNTH5_CPBIAS_SET(x) (((x) << SYNTH_SYNTH5_CPBIAS_LSB) & SYNTH_SYNTH5_CPBIAS_MASK) -#define SYNTH_SYNTH5_CPSTEERING_EN_MSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_LSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_MASK 0x00400000 -#define SYNTH_SYNTH5_CPSTEERING_EN_GET(x) (((x) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) >> SYNTH_SYNTH5_CPSTEERING_EN_LSB) -#define SYNTH_SYNTH5_CPSTEERING_EN_SET(x) (((x) << SYNTH_SYNTH5_CPSTEERING_EN_LSB) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) -#define SYNTH_SYNTH5_CPLOWLK_MSB 21 -#define SYNTH_SYNTH5_CPLOWLK_LSB 21 -#define SYNTH_SYNTH5_CPLOWLK_MASK 0x00200000 -#define SYNTH_SYNTH5_CPLOWLK_GET(x) (((x) & SYNTH_SYNTH5_CPLOWLK_MASK) >> SYNTH_SYNTH5_CPLOWLK_LSB) -#define SYNTH_SYNTH5_CPLOWLK_SET(x) (((x) << SYNTH_SYNTH5_CPLOWLK_LSB) & SYNTH_SYNTH5_CPLOWLK_MASK) -#define SYNTH_SYNTH5_LOOPLEAKCUR_MSB 20 -#define SYNTH_SYNTH5_LOOPLEAKCUR_LSB 17 -#define SYNTH_SYNTH5_LOOPLEAKCUR_MASK 0x001e0000 -#define SYNTH_SYNTH5_LOOPLEAKCUR_GET(x) (((x) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) >> SYNTH_SYNTH5_LOOPLEAKCUR_LSB) -#define SYNTH_SYNTH5_LOOPLEAKCUR_SET(x) (((x) << SYNTH_SYNTH5_LOOPLEAKCUR_LSB) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) -#define SYNTH_SYNTH5_CAPRANGE1_MSB 16 -#define SYNTH_SYNTH5_CAPRANGE1_LSB 13 -#define SYNTH_SYNTH5_CAPRANGE1_MASK 0x0001e000 -#define SYNTH_SYNTH5_CAPRANGE1_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE1_MASK) >> SYNTH_SYNTH5_CAPRANGE1_LSB) -#define SYNTH_SYNTH5_CAPRANGE1_SET(x) (((x) << SYNTH_SYNTH5_CAPRANGE1_LSB) & SYNTH_SYNTH5_CAPRANGE1_MASK) -#define SYNTH_SYNTH5_CAPRANGE2_MSB 12 -#define SYNTH_SYNTH5_CAPRANGE2_LSB 9 -#define SYNTH_SYNTH5_CAPRANGE2_MASK 0x00001e00 -#define SYNTH_SYNTH5_CAPRANGE2_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE2_MASK) >> SYNTH_SYNTH5_CAPRANGE2_LSB) -#define SYNTH_SYNTH5_CAPRANGE2_SET(x) (((x) << SYNTH_SYNTH5_CAPRANGE2_LSB) & SYNTH_SYNTH5_CAPRANGE2_MASK) -#define SYNTH_SYNTH5_CAPRANGE3_MSB 8 -#define SYNTH_SYNTH5_CAPRANGE3_LSB 5 -#define SYNTH_SYNTH5_CAPRANGE3_MASK 0x000001e0 -#define SYNTH_SYNTH5_CAPRANGE3_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE3_MASK) >> SYNTH_SYNTH5_CAPRANGE3_LSB) -#define SYNTH_SYNTH5_CAPRANGE3_SET(x) (((x) << SYNTH_SYNTH5_CAPRANGE3_LSB) & SYNTH_SYNTH5_CAPRANGE3_MASK) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK 0x00000010 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_SET(x) (((x) << SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MSB 3 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB 2 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK 0x0000000c -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_GET(x) (((x) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) >> SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_SET(x) (((x) << SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) -#define SYNTH_SYNTH5_SPARE_MSB 1 -#define SYNTH_SYNTH5_SPARE_LSB 0 -#define SYNTH_SYNTH5_SPARE_MASK 0x00000003 -#define SYNTH_SYNTH5_SPARE_GET(x) (((x) & SYNTH_SYNTH5_SPARE_MASK) >> SYNTH_SYNTH5_SPARE_LSB) -#define SYNTH_SYNTH5_SPARE_SET(x) (((x) << SYNTH_SYNTH5_SPARE_LSB) & SYNTH_SYNTH5_SPARE_MASK) - -#define SYNTH_SYNTH6_ADDRESS 0x00000014 -#define SYNTH_SYNTH6_OFFSET 0x00000014 -#define SYNTH_SYNTH6_IRCP_MSB 31 -#define SYNTH_SYNTH6_IRCP_LSB 29 -#define SYNTH_SYNTH6_IRCP_MASK 0xe0000000 -#define SYNTH_SYNTH6_IRCP_GET(x) (((x) & SYNTH_SYNTH6_IRCP_MASK) >> SYNTH_SYNTH6_IRCP_LSB) -#define SYNTH_SYNTH6_IRCP_SET(x) (((x) << SYNTH_SYNTH6_IRCP_LSB) & SYNTH_SYNTH6_IRCP_MASK) -#define SYNTH_SYNTH6_IRVCMON_MSB 28 -#define SYNTH_SYNTH6_IRVCMON_LSB 26 -#define SYNTH_SYNTH6_IRVCMON_MASK 0x1c000000 -#define SYNTH_SYNTH6_IRVCMON_GET(x) (((x) & SYNTH_SYNTH6_IRVCMON_MASK) >> SYNTH_SYNTH6_IRVCMON_LSB) -#define SYNTH_SYNTH6_IRVCMON_SET(x) (((x) << SYNTH_SYNTH6_IRVCMON_LSB) & SYNTH_SYNTH6_IRVCMON_MASK) -#define SYNTH_SYNTH6_IRSPARE_MSB 25 -#define SYNTH_SYNTH6_IRSPARE_LSB 23 -#define SYNTH_SYNTH6_IRSPARE_MASK 0x03800000 -#define SYNTH_SYNTH6_IRSPARE_GET(x) (((x) & SYNTH_SYNTH6_IRSPARE_MASK) >> SYNTH_SYNTH6_IRSPARE_LSB) -#define SYNTH_SYNTH6_IRSPARE_SET(x) (((x) << SYNTH_SYNTH6_IRSPARE_LSB) & SYNTH_SYNTH6_IRSPARE_MASK) -#define SYNTH_SYNTH6_ICPRESC_MSB 22 -#define SYNTH_SYNTH6_ICPRESC_LSB 20 -#define SYNTH_SYNTH6_ICPRESC_MASK 0x00700000 -#define SYNTH_SYNTH6_ICPRESC_GET(x) (((x) & SYNTH_SYNTH6_ICPRESC_MASK) >> SYNTH_SYNTH6_ICPRESC_LSB) -#define SYNTH_SYNTH6_ICPRESC_SET(x) (((x) << SYNTH_SYNTH6_ICPRESC_LSB) & SYNTH_SYNTH6_ICPRESC_MASK) -#define SYNTH_SYNTH6_ICLODIV_MSB 19 -#define SYNTH_SYNTH6_ICLODIV_LSB 17 -#define SYNTH_SYNTH6_ICLODIV_MASK 0x000e0000 -#define SYNTH_SYNTH6_ICLODIV_GET(x) (((x) & SYNTH_SYNTH6_ICLODIV_MASK) >> SYNTH_SYNTH6_ICLODIV_LSB) -#define SYNTH_SYNTH6_ICLODIV_SET(x) (((x) << SYNTH_SYNTH6_ICLODIV_LSB) & SYNTH_SYNTH6_ICLODIV_MASK) -#define SYNTH_SYNTH6_ICLOMIX_MSB 16 -#define SYNTH_SYNTH6_ICLOMIX_LSB 14 -#define SYNTH_SYNTH6_ICLOMIX_MASK 0x0001c000 -#define SYNTH_SYNTH6_ICLOMIX_GET(x) (((x) & SYNTH_SYNTH6_ICLOMIX_MASK) >> SYNTH_SYNTH6_ICLOMIX_LSB) -#define SYNTH_SYNTH6_ICLOMIX_SET(x) (((x) << SYNTH_SYNTH6_ICLOMIX_LSB) & SYNTH_SYNTH6_ICLOMIX_MASK) -#define SYNTH_SYNTH6_ICSPAREA_MSB 13 -#define SYNTH_SYNTH6_ICSPAREA_LSB 11 -#define SYNTH_SYNTH6_ICSPAREA_MASK 0x00003800 -#define SYNTH_SYNTH6_ICSPAREA_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREA_MASK) >> SYNTH_SYNTH6_ICSPAREA_LSB) -#define SYNTH_SYNTH6_ICSPAREA_SET(x) (((x) << SYNTH_SYNTH6_ICSPAREA_LSB) & SYNTH_SYNTH6_ICSPAREA_MASK) -#define SYNTH_SYNTH6_ICSPAREB_MSB 10 -#define SYNTH_SYNTH6_ICSPAREB_LSB 8 -#define SYNTH_SYNTH6_ICSPAREB_MASK 0x00000700 -#define SYNTH_SYNTH6_ICSPAREB_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREB_MASK) >> SYNTH_SYNTH6_ICSPAREB_LSB) -#define SYNTH_SYNTH6_ICSPAREB_SET(x) (((x) << SYNTH_SYNTH6_ICSPAREB_LSB) & SYNTH_SYNTH6_ICSPAREB_MASK) -#define SYNTH_SYNTH6_ICVCO_MSB 7 -#define SYNTH_SYNTH6_ICVCO_LSB 5 -#define SYNTH_SYNTH6_ICVCO_MASK 0x000000e0 -#define SYNTH_SYNTH6_ICVCO_GET(x) (((x) & SYNTH_SYNTH6_ICVCO_MASK) >> SYNTH_SYNTH6_ICVCO_LSB) -#define SYNTH_SYNTH6_ICVCO_SET(x) (((x) << SYNTH_SYNTH6_ICVCO_LSB) & SYNTH_SYNTH6_ICVCO_MASK) -#define SYNTH_SYNTH6_VCOBUFBIAS_MSB 4 -#define SYNTH_SYNTH6_VCOBUFBIAS_LSB 3 -#define SYNTH_SYNTH6_VCOBUFBIAS_MASK 0x00000018 -#define SYNTH_SYNTH6_VCOBUFBIAS_GET(x) (((x) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) >> SYNTH_SYNTH6_VCOBUFBIAS_LSB) -#define SYNTH_SYNTH6_VCOBUFBIAS_SET(x) (((x) << SYNTH_SYNTH6_VCOBUFBIAS_LSB) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) -#define SYNTH_SYNTH6_SPARE_BIAS_MSB 2 -#define SYNTH_SYNTH6_SPARE_BIAS_LSB 0 -#define SYNTH_SYNTH6_SPARE_BIAS_MASK 0x00000007 -#define SYNTH_SYNTH6_SPARE_BIAS_GET(x) (((x) & SYNTH_SYNTH6_SPARE_BIAS_MASK) >> SYNTH_SYNTH6_SPARE_BIAS_LSB) -#define SYNTH_SYNTH6_SPARE_BIAS_SET(x) (((x) << SYNTH_SYNTH6_SPARE_BIAS_LSB) & SYNTH_SYNTH6_SPARE_BIAS_MASK) - -#define SYNTH_SYNTH7_ADDRESS 0x00000018 -#define SYNTH_SYNTH7_OFFSET 0x00000018 -#define SYNTH_SYNTH7_SYNTH_ON_MSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_LSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_MASK 0x80000000 -#define SYNTH_SYNTH7_SYNTH_ON_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_ON_MASK) >> SYNTH_SYNTH7_SYNTH_ON_LSB) -#define SYNTH_SYNTH7_SYNTH_ON_SET(x) (((x) << SYNTH_SYNTH7_SYNTH_ON_LSB) & SYNTH_SYNTH7_SYNTH_ON_MASK) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MSB 30 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_LSB 27 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MASK 0x78000000 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) >> SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_SET(x) (((x) << SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) -#define SYNTH_SYNTH7_CAP_SEARCH_MSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_LSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_MASK 0x04000000 -#define SYNTH_SYNTH7_CAP_SEARCH_GET(x) (((x) & SYNTH_SYNTH7_CAP_SEARCH_MASK) >> SYNTH_SYNTH7_CAP_SEARCH_LSB) -#define SYNTH_SYNTH7_CAP_SEARCH_SET(x) (((x) << SYNTH_SYNTH7_CAP_SEARCH_LSB) & SYNTH_SYNTH7_CAP_SEARCH_MASK) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK 0x02000000 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) >> SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_SET(x) (((x) << SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) -#define SYNTH_SYNTH7_PIN_VC_MSB 24 -#define SYNTH_SYNTH7_PIN_VC_LSB 24 -#define SYNTH_SYNTH7_PIN_VC_MASK 0x01000000 -#define SYNTH_SYNTH7_PIN_VC_GET(x) (((x) & SYNTH_SYNTH7_PIN_VC_MASK) >> SYNTH_SYNTH7_PIN_VC_LSB) -#define SYNTH_SYNTH7_PIN_VC_SET(x) (((x) << SYNTH_SYNTH7_PIN_VC_LSB) & SYNTH_SYNTH7_PIN_VC_MASK) -#define SYNTH_SYNTH7_VCO_CAP_ST_MSB 23 -#define SYNTH_SYNTH7_VCO_CAP_ST_LSB 16 -#define SYNTH_SYNTH7_VCO_CAP_ST_MASK 0x00ff0000 -#define SYNTH_SYNTH7_VCO_CAP_ST_GET(x) (((x) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) >> SYNTH_SYNTH7_VCO_CAP_ST_LSB) -#define SYNTH_SYNTH7_VCO_CAP_ST_SET(x) (((x) << SYNTH_SYNTH7_VCO_CAP_ST_LSB) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) -#define SYNTH_SYNTH7_SHORT_R_MSB 15 -#define SYNTH_SYNTH7_SHORT_R_LSB 15 -#define SYNTH_SYNTH7_SHORT_R_MASK 0x00008000 -#define SYNTH_SYNTH7_SHORT_R_GET(x) (((x) & SYNTH_SYNTH7_SHORT_R_MASK) >> SYNTH_SYNTH7_SHORT_R_LSB) -#define SYNTH_SYNTH7_SHORT_R_SET(x) (((x) << SYNTH_SYNTH7_SHORT_R_LSB) & SYNTH_SYNTH7_SHORT_R_MASK) -#define SYNTH_SYNTH7_RESET_RFD_MSB 14 -#define SYNTH_SYNTH7_RESET_RFD_LSB 14 -#define SYNTH_SYNTH7_RESET_RFD_MASK 0x00004000 -#define SYNTH_SYNTH7_RESET_RFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_RFD_MASK) >> SYNTH_SYNTH7_RESET_RFD_LSB) -#define SYNTH_SYNTH7_RESET_RFD_SET(x) (((x) << SYNTH_SYNTH7_RESET_RFD_LSB) & SYNTH_SYNTH7_RESET_RFD_MASK) -#define SYNTH_SYNTH7_RESET_PFD_MSB 13 -#define SYNTH_SYNTH7_RESET_PFD_LSB 13 -#define SYNTH_SYNTH7_RESET_PFD_MASK 0x00002000 -#define SYNTH_SYNTH7_RESET_PFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_PFD_MASK) >> SYNTH_SYNTH7_RESET_PFD_LSB) -#define SYNTH_SYNTH7_RESET_PFD_SET(x) (((x) << SYNTH_SYNTH7_RESET_PFD_LSB) & SYNTH_SYNTH7_RESET_PFD_MASK) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK 0x00001000 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_GET(x) (((x) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) >> SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_SET(x) (((x) << SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) -#define SYNTH_SYNTH7_RESET_SDM_B_MSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_LSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_MASK 0x00000800 -#define SYNTH_SYNTH7_RESET_SDM_B_GET(x) (((x) & SYNTH_SYNTH7_RESET_SDM_B_MASK) >> SYNTH_SYNTH7_RESET_SDM_B_LSB) -#define SYNTH_SYNTH7_RESET_SDM_B_SET(x) (((x) << SYNTH_SYNTH7_RESET_SDM_B_LSB) & SYNTH_SYNTH7_RESET_SDM_B_MASK) -#define SYNTH_SYNTH7_VC2HIGH_MSB 10 -#define SYNTH_SYNTH7_VC2HIGH_LSB 10 -#define SYNTH_SYNTH7_VC2HIGH_MASK 0x00000400 -#define SYNTH_SYNTH7_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH7_VC2HIGH_MASK) >> SYNTH_SYNTH7_VC2HIGH_LSB) -#define SYNTH_SYNTH7_VC2HIGH_SET(x) (((x) << SYNTH_SYNTH7_VC2HIGH_LSB) & SYNTH_SYNTH7_VC2HIGH_MASK) -#define SYNTH_SYNTH7_VC2LOW_MSB 9 -#define SYNTH_SYNTH7_VC2LOW_LSB 9 -#define SYNTH_SYNTH7_VC2LOW_MASK 0x00000200 -#define SYNTH_SYNTH7_VC2LOW_GET(x) (((x) & SYNTH_SYNTH7_VC2LOW_MASK) >> SYNTH_SYNTH7_VC2LOW_LSB) -#define SYNTH_SYNTH7_VC2LOW_SET(x) (((x) << SYNTH_SYNTH7_VC2LOW_LSB) & SYNTH_SYNTH7_VC2LOW_MASK) -#define SYNTH_SYNTH7_LOOP_IP_MSB 8 -#define SYNTH_SYNTH7_LOOP_IP_LSB 5 -#define SYNTH_SYNTH7_LOOP_IP_MASK 0x000001e0 -#define SYNTH_SYNTH7_LOOP_IP_GET(x) (((x) & SYNTH_SYNTH7_LOOP_IP_MASK) >> SYNTH_SYNTH7_LOOP_IP_LSB) -#define SYNTH_SYNTH7_LOOP_IP_SET(x) (((x) << SYNTH_SYNTH7_LOOP_IP_LSB) & SYNTH_SYNTH7_LOOP_IP_MASK) -#define SYNTH_SYNTH7_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH7_LOBUF5GTUNE_LSB 3 -#define SYNTH_SYNTH7_LOBUF5GTUNE_MASK 0x00000018 -#define SYNTH_SYNTH7_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH7_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH7_LOBUF5GTUNE_SET(x) (((x) << SYNTH_SYNTH7_LOBUF5GTUNE_LSB) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH7_SPARE_READ_MSB 2 -#define SYNTH_SYNTH7_SPARE_READ_LSB 0 -#define SYNTH_SYNTH7_SPARE_READ_MASK 0x00000007 -#define SYNTH_SYNTH7_SPARE_READ_GET(x) (((x) & SYNTH_SYNTH7_SPARE_READ_MASK) >> SYNTH_SYNTH7_SPARE_READ_LSB) -#define SYNTH_SYNTH7_SPARE_READ_SET(x) (((x) << SYNTH_SYNTH7_SPARE_READ_LSB) & SYNTH_SYNTH7_SPARE_READ_MASK) - -#define SYNTH_SYNTH8_ADDRESS 0x0000001c -#define SYNTH_SYNTH8_OFFSET 0x0000001c -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK 0x80000000 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_GET(x) (((x) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) >> SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_SET(x) (((x) << SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) -#define SYNTH_SYNTH8_FRACMODE_MSB 30 -#define SYNTH_SYNTH8_FRACMODE_LSB 30 -#define SYNTH_SYNTH8_FRACMODE_MASK 0x40000000 -#define SYNTH_SYNTH8_FRACMODE_GET(x) (((x) & SYNTH_SYNTH8_FRACMODE_MASK) >> SYNTH_SYNTH8_FRACMODE_LSB) -#define SYNTH_SYNTH8_FRACMODE_SET(x) (((x) << SYNTH_SYNTH8_FRACMODE_LSB) & SYNTH_SYNTH8_FRACMODE_MASK) -#define SYNTH_SYNTH8_AMODEREFSEL_MSB 29 -#define SYNTH_SYNTH8_AMODEREFSEL_LSB 28 -#define SYNTH_SYNTH8_AMODEREFSEL_MASK 0x30000000 -#define SYNTH_SYNTH8_AMODEREFSEL_GET(x) (((x) & SYNTH_SYNTH8_AMODEREFSEL_MASK) >> SYNTH_SYNTH8_AMODEREFSEL_LSB) -#define SYNTH_SYNTH8_AMODEREFSEL_SET(x) (((x) << SYNTH_SYNTH8_AMODEREFSEL_LSB) & SYNTH_SYNTH8_AMODEREFSEL_MASK) -#define SYNTH_SYNTH8_SPARE_MSB 27 -#define SYNTH_SYNTH8_SPARE_LSB 27 -#define SYNTH_SYNTH8_SPARE_MASK 0x08000000 -#define SYNTH_SYNTH8_SPARE_GET(x) (((x) & SYNTH_SYNTH8_SPARE_MASK) >> SYNTH_SYNTH8_SPARE_LSB) -#define SYNTH_SYNTH8_SPARE_SET(x) (((x) << SYNTH_SYNTH8_SPARE_LSB) & SYNTH_SYNTH8_SPARE_MASK) -#define SYNTH_SYNTH8_CHANSEL_MSB 26 -#define SYNTH_SYNTH8_CHANSEL_LSB 18 -#define SYNTH_SYNTH8_CHANSEL_MASK 0x07fc0000 -#define SYNTH_SYNTH8_CHANSEL_GET(x) (((x) & SYNTH_SYNTH8_CHANSEL_MASK) >> SYNTH_SYNTH8_CHANSEL_LSB) -#define SYNTH_SYNTH8_CHANSEL_SET(x) (((x) << SYNTH_SYNTH8_CHANSEL_LSB) & SYNTH_SYNTH8_CHANSEL_MASK) -#define SYNTH_SYNTH8_CHANFRAC_MSB 17 -#define SYNTH_SYNTH8_CHANFRAC_LSB 1 -#define SYNTH_SYNTH8_CHANFRAC_MASK 0x0003fffe -#define SYNTH_SYNTH8_CHANFRAC_GET(x) (((x) & SYNTH_SYNTH8_CHANFRAC_MASK) >> SYNTH_SYNTH8_CHANFRAC_LSB) -#define SYNTH_SYNTH8_CHANFRAC_SET(x) (((x) << SYNTH_SYNTH8_CHANFRAC_LSB) & SYNTH_SYNTH8_CHANFRAC_MASK) -#define SYNTH_SYNTH8_FORCE_FRACLSB_MSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_LSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_MASK 0x00000001 -#define SYNTH_SYNTH8_FORCE_FRACLSB_GET(x) (((x) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) >> SYNTH_SYNTH8_FORCE_FRACLSB_LSB) -#define SYNTH_SYNTH8_FORCE_FRACLSB_SET(x) (((x) << SYNTH_SYNTH8_FORCE_FRACLSB_LSB) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) - -#define RF5G_RF5G1_ADDRESS 0x00000020 -#define RF5G_RF5G1_OFFSET 0x00000020 -#define RF5G_RF5G1_PDTXLO5_MSB 31 -#define RF5G_RF5G1_PDTXLO5_LSB 31 -#define RF5G_RF5G1_PDTXLO5_MASK 0x80000000 -#define RF5G_RF5G1_PDTXLO5_GET(x) (((x) & RF5G_RF5G1_PDTXLO5_MASK) >> RF5G_RF5G1_PDTXLO5_LSB) -#define RF5G_RF5G1_PDTXLO5_SET(x) (((x) << RF5G_RF5G1_PDTXLO5_LSB) & RF5G_RF5G1_PDTXLO5_MASK) -#define RF5G_RF5G1_PDTXMIX5_MSB 30 -#define RF5G_RF5G1_PDTXMIX5_LSB 30 -#define RF5G_RF5G1_PDTXMIX5_MASK 0x40000000 -#define RF5G_RF5G1_PDTXMIX5_GET(x) (((x) & RF5G_RF5G1_PDTXMIX5_MASK) >> RF5G_RF5G1_PDTXMIX5_LSB) -#define RF5G_RF5G1_PDTXMIX5_SET(x) (((x) << RF5G_RF5G1_PDTXMIX5_LSB) & RF5G_RF5G1_PDTXMIX5_MASK) -#define RF5G_RF5G1_PDTXBUF5_MSB 29 -#define RF5G_RF5G1_PDTXBUF5_LSB 29 -#define RF5G_RF5G1_PDTXBUF5_MASK 0x20000000 -#define RF5G_RF5G1_PDTXBUF5_GET(x) (((x) & RF5G_RF5G1_PDTXBUF5_MASK) >> RF5G_RF5G1_PDTXBUF5_LSB) -#define RF5G_RF5G1_PDTXBUF5_SET(x) (((x) << RF5G_RF5G1_PDTXBUF5_LSB) & RF5G_RF5G1_PDTXBUF5_MASK) -#define RF5G_RF5G1_PDPADRV5_MSB 28 -#define RF5G_RF5G1_PDPADRV5_LSB 28 -#define RF5G_RF5G1_PDPADRV5_MASK 0x10000000 -#define RF5G_RF5G1_PDPADRV5_GET(x) (((x) & RF5G_RF5G1_PDPADRV5_MASK) >> RF5G_RF5G1_PDPADRV5_LSB) -#define RF5G_RF5G1_PDPADRV5_SET(x) (((x) << RF5G_RF5G1_PDPADRV5_LSB) & RF5G_RF5G1_PDPADRV5_MASK) -#define RF5G_RF5G1_PDPAOUT5_MSB 27 -#define RF5G_RF5G1_PDPAOUT5_LSB 27 -#define RF5G_RF5G1_PDPAOUT5_MASK 0x08000000 -#define RF5G_RF5G1_PDPAOUT5_GET(x) (((x) & RF5G_RF5G1_PDPAOUT5_MASK) >> RF5G_RF5G1_PDPAOUT5_LSB) -#define RF5G_RF5G1_PDPAOUT5_SET(x) (((x) << RF5G_RF5G1_PDPAOUT5_LSB) & RF5G_RF5G1_PDPAOUT5_MASK) -#define RF5G_RF5G1_TUNE_PADRV5_MSB 26 -#define RF5G_RF5G1_TUNE_PADRV5_LSB 24 -#define RF5G_RF5G1_TUNE_PADRV5_MASK 0x07000000 -#define RF5G_RF5G1_TUNE_PADRV5_GET(x) (((x) & RF5G_RF5G1_TUNE_PADRV5_MASK) >> RF5G_RF5G1_TUNE_PADRV5_LSB) -#define RF5G_RF5G1_TUNE_PADRV5_SET(x) (((x) << RF5G_RF5G1_TUNE_PADRV5_LSB) & RF5G_RF5G1_TUNE_PADRV5_MASK) -#define RF5G_RF5G1_PWDTXPKD_MSB 23 -#define RF5G_RF5G1_PWDTXPKD_LSB 21 -#define RF5G_RF5G1_PWDTXPKD_MASK 0x00e00000 -#define RF5G_RF5G1_PWDTXPKD_GET(x) (((x) & RF5G_RF5G1_PWDTXPKD_MASK) >> RF5G_RF5G1_PWDTXPKD_LSB) -#define RF5G_RF5G1_PWDTXPKD_SET(x) (((x) << RF5G_RF5G1_PWDTXPKD_LSB) & RF5G_RF5G1_PWDTXPKD_MASK) -#define RF5G_RF5G1_DB5_MSB 20 -#define RF5G_RF5G1_DB5_LSB 18 -#define RF5G_RF5G1_DB5_MASK 0x001c0000 -#define RF5G_RF5G1_DB5_GET(x) (((x) & RF5G_RF5G1_DB5_MASK) >> RF5G_RF5G1_DB5_LSB) -#define RF5G_RF5G1_DB5_SET(x) (((x) << RF5G_RF5G1_DB5_LSB) & RF5G_RF5G1_DB5_MASK) -#define RF5G_RF5G1_OB5_MSB 17 -#define RF5G_RF5G1_OB5_LSB 15 -#define RF5G_RF5G1_OB5_MASK 0x00038000 -#define RF5G_RF5G1_OB5_GET(x) (((x) & RF5G_RF5G1_OB5_MASK) >> RF5G_RF5G1_OB5_LSB) -#define RF5G_RF5G1_OB5_SET(x) (((x) << RF5G_RF5G1_OB5_LSB) & RF5G_RF5G1_OB5_MASK) -#define RF5G_RF5G1_TX5_ATB_SEL_MSB 14 -#define RF5G_RF5G1_TX5_ATB_SEL_LSB 12 -#define RF5G_RF5G1_TX5_ATB_SEL_MASK 0x00007000 -#define RF5G_RF5G1_TX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_TX5_ATB_SEL_MASK) >> RF5G_RF5G1_TX5_ATB_SEL_LSB) -#define RF5G_RF5G1_TX5_ATB_SEL_SET(x) (((x) << RF5G_RF5G1_TX5_ATB_SEL_LSB) & RF5G_RF5G1_TX5_ATB_SEL_MASK) -#define RF5G_RF5G1_PDLO5DIV_MSB 11 -#define RF5G_RF5G1_PDLO5DIV_LSB 11 -#define RF5G_RF5G1_PDLO5DIV_MASK 0x00000800 -#define RF5G_RF5G1_PDLO5DIV_GET(x) (((x) & RF5G_RF5G1_PDLO5DIV_MASK) >> RF5G_RF5G1_PDLO5DIV_LSB) -#define RF5G_RF5G1_PDLO5DIV_SET(x) (((x) << RF5G_RF5G1_PDLO5DIV_LSB) & RF5G_RF5G1_PDLO5DIV_MASK) -#define RF5G_RF5G1_PDLO5MIX_MSB 10 -#define RF5G_RF5G1_PDLO5MIX_LSB 10 -#define RF5G_RF5G1_PDLO5MIX_MASK 0x00000400 -#define RF5G_RF5G1_PDLO5MIX_GET(x) (((x) & RF5G_RF5G1_PDLO5MIX_MASK) >> RF5G_RF5G1_PDLO5MIX_LSB) -#define RF5G_RF5G1_PDLO5MIX_SET(x) (((x) << RF5G_RF5G1_PDLO5MIX_LSB) & RF5G_RF5G1_PDLO5MIX_MASK) -#define RF5G_RF5G1_PDQBUF5_MSB 9 -#define RF5G_RF5G1_PDQBUF5_LSB 9 -#define RF5G_RF5G1_PDQBUF5_MASK 0x00000200 -#define RF5G_RF5G1_PDQBUF5_GET(x) (((x) & RF5G_RF5G1_PDQBUF5_MASK) >> RF5G_RF5G1_PDQBUF5_LSB) -#define RF5G_RF5G1_PDQBUF5_SET(x) (((x) << RF5G_RF5G1_PDQBUF5_LSB) & RF5G_RF5G1_PDQBUF5_MASK) -#define RF5G_RF5G1_PDLO5AGC_MSB 8 -#define RF5G_RF5G1_PDLO5AGC_LSB 8 -#define RF5G_RF5G1_PDLO5AGC_MASK 0x00000100 -#define RF5G_RF5G1_PDLO5AGC_GET(x) (((x) & RF5G_RF5G1_PDLO5AGC_MASK) >> RF5G_RF5G1_PDLO5AGC_LSB) -#define RF5G_RF5G1_PDLO5AGC_SET(x) (((x) << RF5G_RF5G1_PDLO5AGC_LSB) & RF5G_RF5G1_PDLO5AGC_MASK) -#define RF5G_RF5G1_PDREGLO5_MSB 7 -#define RF5G_RF5G1_PDREGLO5_LSB 7 -#define RF5G_RF5G1_PDREGLO5_MASK 0x00000080 -#define RF5G_RF5G1_PDREGLO5_GET(x) (((x) & RF5G_RF5G1_PDREGLO5_MASK) >> RF5G_RF5G1_PDREGLO5_LSB) -#define RF5G_RF5G1_PDREGLO5_SET(x) (((x) << RF5G_RF5G1_PDREGLO5_LSB) & RF5G_RF5G1_PDREGLO5_MASK) -#define RF5G_RF5G1_LO5_ATB_SEL_MSB 6 -#define RF5G_RF5G1_LO5_ATB_SEL_LSB 4 -#define RF5G_RF5G1_LO5_ATB_SEL_MASK 0x00000070 -#define RF5G_RF5G1_LO5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_LO5_ATB_SEL_MASK) >> RF5G_RF5G1_LO5_ATB_SEL_LSB) -#define RF5G_RF5G1_LO5_ATB_SEL_SET(x) (((x) << RF5G_RF5G1_LO5_ATB_SEL_LSB) & RF5G_RF5G1_LO5_ATB_SEL_MASK) -#define RF5G_RF5G1_LO5CONTROL_MSB 3 -#define RF5G_RF5G1_LO5CONTROL_LSB 3 -#define RF5G_RF5G1_LO5CONTROL_MASK 0x00000008 -#define RF5G_RF5G1_LO5CONTROL_GET(x) (((x) & RF5G_RF5G1_LO5CONTROL_MASK) >> RF5G_RF5G1_LO5CONTROL_LSB) -#define RF5G_RF5G1_LO5CONTROL_SET(x) (((x) << RF5G_RF5G1_LO5CONTROL_LSB) & RF5G_RF5G1_LO5CONTROL_MASK) -#define RF5G_RF5G1_REGLO_BYPASS5_MSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_LSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_MASK 0x00000004 -#define RF5G_RF5G1_REGLO_BYPASS5_GET(x) (((x) & RF5G_RF5G1_REGLO_BYPASS5_MASK) >> RF5G_RF5G1_REGLO_BYPASS5_LSB) -#define RF5G_RF5G1_REGLO_BYPASS5_SET(x) (((x) << RF5G_RF5G1_REGLO_BYPASS5_LSB) & RF5G_RF5G1_REGLO_BYPASS5_MASK) -#define RF5G_RF5G1_SPARE_MSB 1 -#define RF5G_RF5G1_SPARE_LSB 0 -#define RF5G_RF5G1_SPARE_MASK 0x00000003 -#define RF5G_RF5G1_SPARE_GET(x) (((x) & RF5G_RF5G1_SPARE_MASK) >> RF5G_RF5G1_SPARE_LSB) -#define RF5G_RF5G1_SPARE_SET(x) (((x) << RF5G_RF5G1_SPARE_LSB) & RF5G_RF5G1_SPARE_MASK) - -#define RF5G_RF5G2_ADDRESS 0x00000024 -#define RF5G_RF5G2_OFFSET 0x00000024 -#define RF5G_RF5G2_AGCLO_B_MSB 31 -#define RF5G_RF5G2_AGCLO_B_LSB 29 -#define RF5G_RF5G2_AGCLO_B_MASK 0xe0000000 -#define RF5G_RF5G2_AGCLO_B_GET(x) (((x) & RF5G_RF5G2_AGCLO_B_MASK) >> RF5G_RF5G2_AGCLO_B_LSB) -#define RF5G_RF5G2_AGCLO_B_SET(x) (((x) << RF5G_RF5G2_AGCLO_B_LSB) & RF5G_RF5G2_AGCLO_B_MASK) -#define RF5G_RF5G2_RX5_ATB_SEL_MSB 28 -#define RF5G_RF5G2_RX5_ATB_SEL_LSB 26 -#define RF5G_RF5G2_RX5_ATB_SEL_MASK 0x1c000000 -#define RF5G_RF5G2_RX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G2_RX5_ATB_SEL_MASK) >> RF5G_RF5G2_RX5_ATB_SEL_LSB) -#define RF5G_RF5G2_RX5_ATB_SEL_SET(x) (((x) << RF5G_RF5G2_RX5_ATB_SEL_LSB) & RF5G_RF5G2_RX5_ATB_SEL_MASK) -#define RF5G_RF5G2_PDCMOSLO5_MSB 25 -#define RF5G_RF5G2_PDCMOSLO5_LSB 25 -#define RF5G_RF5G2_PDCMOSLO5_MASK 0x02000000 -#define RF5G_RF5G2_PDCMOSLO5_GET(x) (((x) & RF5G_RF5G2_PDCMOSLO5_MASK) >> RF5G_RF5G2_PDCMOSLO5_LSB) -#define RF5G_RF5G2_PDCMOSLO5_SET(x) (((x) << RF5G_RF5G2_PDCMOSLO5_LSB) & RF5G_RF5G2_PDCMOSLO5_MASK) -#define RF5G_RF5G2_PDVGM5_MSB 24 -#define RF5G_RF5G2_PDVGM5_LSB 24 -#define RF5G_RF5G2_PDVGM5_MASK 0x01000000 -#define RF5G_RF5G2_PDVGM5_GET(x) (((x) & RF5G_RF5G2_PDVGM5_MASK) >> RF5G_RF5G2_PDVGM5_LSB) -#define RF5G_RF5G2_PDVGM5_SET(x) (((x) << RF5G_RF5G2_PDVGM5_LSB) & RF5G_RF5G2_PDVGM5_MASK) -#define RF5G_RF5G2_PDCSLNA5_MSB 23 -#define RF5G_RF5G2_PDCSLNA5_LSB 23 -#define RF5G_RF5G2_PDCSLNA5_MASK 0x00800000 -#define RF5G_RF5G2_PDCSLNA5_GET(x) (((x) & RF5G_RF5G2_PDCSLNA5_MASK) >> RF5G_RF5G2_PDCSLNA5_LSB) -#define RF5G_RF5G2_PDCSLNA5_SET(x) (((x) << RF5G_RF5G2_PDCSLNA5_LSB) & RF5G_RF5G2_PDCSLNA5_MASK) -#define RF5G_RF5G2_PDRFVGA5_MSB 22 -#define RF5G_RF5G2_PDRFVGA5_LSB 22 -#define RF5G_RF5G2_PDRFVGA5_MASK 0x00400000 -#define RF5G_RF5G2_PDRFVGA5_GET(x) (((x) & RF5G_RF5G2_PDRFVGA5_MASK) >> RF5G_RF5G2_PDRFVGA5_LSB) -#define RF5G_RF5G2_PDRFVGA5_SET(x) (((x) << RF5G_RF5G2_PDRFVGA5_LSB) & RF5G_RF5G2_PDRFVGA5_MASK) -#define RF5G_RF5G2_PDREGFE5_MSB 21 -#define RF5G_RF5G2_PDREGFE5_LSB 21 -#define RF5G_RF5G2_PDREGFE5_MASK 0x00200000 -#define RF5G_RF5G2_PDREGFE5_GET(x) (((x) & RF5G_RF5G2_PDREGFE5_MASK) >> RF5G_RF5G2_PDREGFE5_LSB) -#define RF5G_RF5G2_PDREGFE5_SET(x) (((x) << RF5G_RF5G2_PDREGFE5_LSB) & RF5G_RF5G2_PDREGFE5_MASK) -#define RF5G_RF5G2_TUNE_RFVGA5_MSB 20 -#define RF5G_RF5G2_TUNE_RFVGA5_LSB 18 -#define RF5G_RF5G2_TUNE_RFVGA5_MASK 0x001c0000 -#define RF5G_RF5G2_TUNE_RFVGA5_GET(x) (((x) & RF5G_RF5G2_TUNE_RFVGA5_MASK) >> RF5G_RF5G2_TUNE_RFVGA5_LSB) -#define RF5G_RF5G2_TUNE_RFVGA5_SET(x) (((x) << RF5G_RF5G2_TUNE_RFVGA5_LSB) & RF5G_RF5G2_TUNE_RFVGA5_MASK) -#define RF5G_RF5G2_BRFVGA5_MSB 17 -#define RF5G_RF5G2_BRFVGA5_LSB 15 -#define RF5G_RF5G2_BRFVGA5_MASK 0x00038000 -#define RF5G_RF5G2_BRFVGA5_GET(x) (((x) & RF5G_RF5G2_BRFVGA5_MASK) >> RF5G_RF5G2_BRFVGA5_LSB) -#define RF5G_RF5G2_BRFVGA5_SET(x) (((x) << RF5G_RF5G2_BRFVGA5_LSB) & RF5G_RF5G2_BRFVGA5_MASK) -#define RF5G_RF5G2_BCSLNA5_MSB 14 -#define RF5G_RF5G2_BCSLNA5_LSB 12 -#define RF5G_RF5G2_BCSLNA5_MASK 0x00007000 -#define RF5G_RF5G2_BCSLNA5_GET(x) (((x) & RF5G_RF5G2_BCSLNA5_MASK) >> RF5G_RF5G2_BCSLNA5_LSB) -#define RF5G_RF5G2_BCSLNA5_SET(x) (((x) << RF5G_RF5G2_BCSLNA5_LSB) & RF5G_RF5G2_BCSLNA5_MASK) -#define RF5G_RF5G2_BVGM5_MSB 11 -#define RF5G_RF5G2_BVGM5_LSB 9 -#define RF5G_RF5G2_BVGM5_MASK 0x00000e00 -#define RF5G_RF5G2_BVGM5_GET(x) (((x) & RF5G_RF5G2_BVGM5_MASK) >> RF5G_RF5G2_BVGM5_LSB) -#define RF5G_RF5G2_BVGM5_SET(x) (((x) << RF5G_RF5G2_BVGM5_LSB) & RF5G_RF5G2_BVGM5_MASK) -#define RF5G_RF5G2_REGFE_BYPASS5_MSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_LSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_MASK 0x00000100 -#define RF5G_RF5G2_REGFE_BYPASS5_GET(x) (((x) & RF5G_RF5G2_REGFE_BYPASS5_MASK) >> RF5G_RF5G2_REGFE_BYPASS5_LSB) -#define RF5G_RF5G2_REGFE_BYPASS5_SET(x) (((x) << RF5G_RF5G2_REGFE_BYPASS5_LSB) & RF5G_RF5G2_REGFE_BYPASS5_MASK) -#define RF5G_RF5G2_LNA5_ATTENMODE_MSB 7 -#define RF5G_RF5G2_LNA5_ATTENMODE_LSB 6 -#define RF5G_RF5G2_LNA5_ATTENMODE_MASK 0x000000c0 -#define RF5G_RF5G2_LNA5_ATTENMODE_GET(x) (((x) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) >> RF5G_RF5G2_LNA5_ATTENMODE_LSB) -#define RF5G_RF5G2_LNA5_ATTENMODE_SET(x) (((x) << RF5G_RF5G2_LNA5_ATTENMODE_LSB) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) -#define RF5G_RF5G2_ENABLE_PCA_MSB 5 -#define RF5G_RF5G2_ENABLE_PCA_LSB 5 -#define RF5G_RF5G2_ENABLE_PCA_MASK 0x00000020 -#define RF5G_RF5G2_ENABLE_PCA_GET(x) (((x) & RF5G_RF5G2_ENABLE_PCA_MASK) >> RF5G_RF5G2_ENABLE_PCA_LSB) -#define RF5G_RF5G2_ENABLE_PCA_SET(x) (((x) << RF5G_RF5G2_ENABLE_PCA_LSB) & RF5G_RF5G2_ENABLE_PCA_MASK) -#define RF5G_RF5G2_TUNE_LO_MSB 4 -#define RF5G_RF5G2_TUNE_LO_LSB 2 -#define RF5G_RF5G2_TUNE_LO_MASK 0x0000001c -#define RF5G_RF5G2_TUNE_LO_GET(x) (((x) & RF5G_RF5G2_TUNE_LO_MASK) >> RF5G_RF5G2_TUNE_LO_LSB) -#define RF5G_RF5G2_TUNE_LO_SET(x) (((x) << RF5G_RF5G2_TUNE_LO_LSB) & RF5G_RF5G2_TUNE_LO_MASK) -#define RF5G_RF5G2_SPARE_MSB 1 -#define RF5G_RF5G2_SPARE_LSB 0 -#define RF5G_RF5G2_SPARE_MASK 0x00000003 -#define RF5G_RF5G2_SPARE_GET(x) (((x) & RF5G_RF5G2_SPARE_MASK) >> RF5G_RF5G2_SPARE_LSB) -#define RF5G_RF5G2_SPARE_SET(x) (((x) << RF5G_RF5G2_SPARE_LSB) & RF5G_RF5G2_SPARE_MASK) - -#define RF2G_RF2G1_ADDRESS 0x00000028 -#define RF2G_RF2G1_OFFSET 0x00000028 -#define RF2G_RF2G1_BLNA1_MSB 31 -#define RF2G_RF2G1_BLNA1_LSB 29 -#define RF2G_RF2G1_BLNA1_MASK 0xe0000000 -#define RF2G_RF2G1_BLNA1_GET(x) (((x) & RF2G_RF2G1_BLNA1_MASK) >> RF2G_RF2G1_BLNA1_LSB) -#define RF2G_RF2G1_BLNA1_SET(x) (((x) << RF2G_RF2G1_BLNA1_LSB) & RF2G_RF2G1_BLNA1_MASK) -#define RF2G_RF2G1_BLNA1F_MSB 28 -#define RF2G_RF2G1_BLNA1F_LSB 26 -#define RF2G_RF2G1_BLNA1F_MASK 0x1c000000 -#define RF2G_RF2G1_BLNA1F_GET(x) (((x) & RF2G_RF2G1_BLNA1F_MASK) >> RF2G_RF2G1_BLNA1F_LSB) -#define RF2G_RF2G1_BLNA1F_SET(x) (((x) << RF2G_RF2G1_BLNA1F_LSB) & RF2G_RF2G1_BLNA1F_MASK) -#define RF2G_RF2G1_BLNA1BUF_MSB 25 -#define RF2G_RF2G1_BLNA1BUF_LSB 23 -#define RF2G_RF2G1_BLNA1BUF_MASK 0x03800000 -#define RF2G_RF2G1_BLNA1BUF_GET(x) (((x) & RF2G_RF2G1_BLNA1BUF_MASK) >> RF2G_RF2G1_BLNA1BUF_LSB) -#define RF2G_RF2G1_BLNA1BUF_SET(x) (((x) << RF2G_RF2G1_BLNA1BUF_LSB) & RF2G_RF2G1_BLNA1BUF_MASK) -#define RF2G_RF2G1_BLNA2_MSB 22 -#define RF2G_RF2G1_BLNA2_LSB 20 -#define RF2G_RF2G1_BLNA2_MASK 0x00700000 -#define RF2G_RF2G1_BLNA2_GET(x) (((x) & RF2G_RF2G1_BLNA2_MASK) >> RF2G_RF2G1_BLNA2_LSB) -#define RF2G_RF2G1_BLNA2_SET(x) (((x) << RF2G_RF2G1_BLNA2_LSB) & RF2G_RF2G1_BLNA2_MASK) -#define RF2G_RF2G1_DB_MSB 19 -#define RF2G_RF2G1_DB_LSB 17 -#define RF2G_RF2G1_DB_MASK 0x000e0000 -#define RF2G_RF2G1_DB_GET(x) (((x) & RF2G_RF2G1_DB_MASK) >> RF2G_RF2G1_DB_LSB) -#define RF2G_RF2G1_DB_SET(x) (((x) << RF2G_RF2G1_DB_LSB) & RF2G_RF2G1_DB_MASK) -#define RF2G_RF2G1_OB_MSB 16 -#define RF2G_RF2G1_OB_LSB 14 -#define RF2G_RF2G1_OB_MASK 0x0001c000 -#define RF2G_RF2G1_OB_GET(x) (((x) & RF2G_RF2G1_OB_MASK) >> RF2G_RF2G1_OB_LSB) -#define RF2G_RF2G1_OB_SET(x) (((x) << RF2G_RF2G1_OB_LSB) & RF2G_RF2G1_OB_MASK) -#define RF2G_RF2G1_FE_ATB_SEL_MSB 13 -#define RF2G_RF2G1_FE_ATB_SEL_LSB 11 -#define RF2G_RF2G1_FE_ATB_SEL_MASK 0x00003800 -#define RF2G_RF2G1_FE_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_FE_ATB_SEL_MASK) >> RF2G_RF2G1_FE_ATB_SEL_LSB) -#define RF2G_RF2G1_FE_ATB_SEL_SET(x) (((x) << RF2G_RF2G1_FE_ATB_SEL_LSB) & RF2G_RF2G1_FE_ATB_SEL_MASK) -#define RF2G_RF2G1_RF_ATB_SEL_MSB 10 -#define RF2G_RF2G1_RF_ATB_SEL_LSB 8 -#define RF2G_RF2G1_RF_ATB_SEL_MASK 0x00000700 -#define RF2G_RF2G1_RF_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_RF_ATB_SEL_MASK) >> RF2G_RF2G1_RF_ATB_SEL_LSB) -#define RF2G_RF2G1_RF_ATB_SEL_SET(x) (((x) << RF2G_RF2G1_RF_ATB_SEL_LSB) & RF2G_RF2G1_RF_ATB_SEL_MASK) -#define RF2G_RF2G1_SELLNA_MSB 7 -#define RF2G_RF2G1_SELLNA_LSB 7 -#define RF2G_RF2G1_SELLNA_MASK 0x00000080 -#define RF2G_RF2G1_SELLNA_GET(x) (((x) & RF2G_RF2G1_SELLNA_MASK) >> RF2G_RF2G1_SELLNA_LSB) -#define RF2G_RF2G1_SELLNA_SET(x) (((x) << RF2G_RF2G1_SELLNA_LSB) & RF2G_RF2G1_SELLNA_MASK) -#define RF2G_RF2G1_LOCONTROL_MSB 6 -#define RF2G_RF2G1_LOCONTROL_LSB 6 -#define RF2G_RF2G1_LOCONTROL_MASK 0x00000040 -#define RF2G_RF2G1_LOCONTROL_GET(x) (((x) & RF2G_RF2G1_LOCONTROL_MASK) >> RF2G_RF2G1_LOCONTROL_LSB) -#define RF2G_RF2G1_LOCONTROL_SET(x) (((x) << RF2G_RF2G1_LOCONTROL_LSB) & RF2G_RF2G1_LOCONTROL_MASK) -#define RF2G_RF2G1_SHORTLNA2_MSB 5 -#define RF2G_RF2G1_SHORTLNA2_LSB 5 -#define RF2G_RF2G1_SHORTLNA2_MASK 0x00000020 -#define RF2G_RF2G1_SHORTLNA2_GET(x) (((x) & RF2G_RF2G1_SHORTLNA2_MASK) >> RF2G_RF2G1_SHORTLNA2_LSB) -#define RF2G_RF2G1_SHORTLNA2_SET(x) (((x) << RF2G_RF2G1_SHORTLNA2_LSB) & RF2G_RF2G1_SHORTLNA2_MASK) -#define RF2G_RF2G1_SPARE_MSB 4 -#define RF2G_RF2G1_SPARE_LSB 0 -#define RF2G_RF2G1_SPARE_MASK 0x0000001f -#define RF2G_RF2G1_SPARE_GET(x) (((x) & RF2G_RF2G1_SPARE_MASK) >> RF2G_RF2G1_SPARE_LSB) -#define RF2G_RF2G1_SPARE_SET(x) (((x) << RF2G_RF2G1_SPARE_LSB) & RF2G_RF2G1_SPARE_MASK) - -#define RF2G_RF2G2_ADDRESS 0x0000002c -#define RF2G_RF2G2_OFFSET 0x0000002c -#define RF2G_RF2G2_PDCGLNA_MSB 31 -#define RF2G_RF2G2_PDCGLNA_LSB 31 -#define RF2G_RF2G2_PDCGLNA_MASK 0x80000000 -#define RF2G_RF2G2_PDCGLNA_GET(x) (((x) & RF2G_RF2G2_PDCGLNA_MASK) >> RF2G_RF2G2_PDCGLNA_LSB) -#define RF2G_RF2G2_PDCGLNA_SET(x) (((x) << RF2G_RF2G2_PDCGLNA_LSB) & RF2G_RF2G2_PDCGLNA_MASK) -#define RF2G_RF2G2_PDCGLNABUF_MSB 30 -#define RF2G_RF2G2_PDCGLNABUF_LSB 30 -#define RF2G_RF2G2_PDCGLNABUF_MASK 0x40000000 -#define RF2G_RF2G2_PDCGLNABUF_GET(x) (((x) & RF2G_RF2G2_PDCGLNABUF_MASK) >> RF2G_RF2G2_PDCGLNABUF_LSB) -#define RF2G_RF2G2_PDCGLNABUF_SET(x) (((x) << RF2G_RF2G2_PDCGLNABUF_LSB) & RF2G_RF2G2_PDCGLNABUF_MASK) -#define RF2G_RF2G2_PDCSLNA_MSB 29 -#define RF2G_RF2G2_PDCSLNA_LSB 29 -#define RF2G_RF2G2_PDCSLNA_MASK 0x20000000 -#define RF2G_RF2G2_PDCSLNA_GET(x) (((x) & RF2G_RF2G2_PDCSLNA_MASK) >> RF2G_RF2G2_PDCSLNA_LSB) -#define RF2G_RF2G2_PDCSLNA_SET(x) (((x) << RF2G_RF2G2_PDCSLNA_LSB) & RF2G_RF2G2_PDCSLNA_MASK) -#define RF2G_RF2G2_PDDIV_MSB 28 -#define RF2G_RF2G2_PDDIV_LSB 28 -#define RF2G_RF2G2_PDDIV_MASK 0x10000000 -#define RF2G_RF2G2_PDDIV_GET(x) (((x) & RF2G_RF2G2_PDDIV_MASK) >> RF2G_RF2G2_PDDIV_LSB) -#define RF2G_RF2G2_PDDIV_SET(x) (((x) << RF2G_RF2G2_PDDIV_LSB) & RF2G_RF2G2_PDDIV_MASK) -#define RF2G_RF2G2_PDPADRV_MSB 27 -#define RF2G_RF2G2_PDPADRV_LSB 27 -#define RF2G_RF2G2_PDPADRV_MASK 0x08000000 -#define RF2G_RF2G2_PDPADRV_GET(x) (((x) & RF2G_RF2G2_PDPADRV_MASK) >> RF2G_RF2G2_PDPADRV_LSB) -#define RF2G_RF2G2_PDPADRV_SET(x) (((x) << RF2G_RF2G2_PDPADRV_LSB) & RF2G_RF2G2_PDPADRV_MASK) -#define RF2G_RF2G2_PDPAOUT_MSB 26 -#define RF2G_RF2G2_PDPAOUT_LSB 26 -#define RF2G_RF2G2_PDPAOUT_MASK 0x04000000 -#define RF2G_RF2G2_PDPAOUT_GET(x) (((x) & RF2G_RF2G2_PDPAOUT_MASK) >> RF2G_RF2G2_PDPAOUT_LSB) -#define RF2G_RF2G2_PDPAOUT_SET(x) (((x) << RF2G_RF2G2_PDPAOUT_LSB) & RF2G_RF2G2_PDPAOUT_MASK) -#define RF2G_RF2G2_PDREGLNA_MSB 25 -#define RF2G_RF2G2_PDREGLNA_LSB 25 -#define RF2G_RF2G2_PDREGLNA_MASK 0x02000000 -#define RF2G_RF2G2_PDREGLNA_GET(x) (((x) & RF2G_RF2G2_PDREGLNA_MASK) >> RF2G_RF2G2_PDREGLNA_LSB) -#define RF2G_RF2G2_PDREGLNA_SET(x) (((x) << RF2G_RF2G2_PDREGLNA_LSB) & RF2G_RF2G2_PDREGLNA_MASK) -#define RF2G_RF2G2_PDREGLO_MSB 24 -#define RF2G_RF2G2_PDREGLO_LSB 24 -#define RF2G_RF2G2_PDREGLO_MASK 0x01000000 -#define RF2G_RF2G2_PDREGLO_GET(x) (((x) & RF2G_RF2G2_PDREGLO_MASK) >> RF2G_RF2G2_PDREGLO_LSB) -#define RF2G_RF2G2_PDREGLO_SET(x) (((x) << RF2G_RF2G2_PDREGLO_LSB) & RF2G_RF2G2_PDREGLO_MASK) -#define RF2G_RF2G2_PDRFGM_MSB 23 -#define RF2G_RF2G2_PDRFGM_LSB 23 -#define RF2G_RF2G2_PDRFGM_MASK 0x00800000 -#define RF2G_RF2G2_PDRFGM_GET(x) (((x) & RF2G_RF2G2_PDRFGM_MASK) >> RF2G_RF2G2_PDRFGM_LSB) -#define RF2G_RF2G2_PDRFGM_SET(x) (((x) << RF2G_RF2G2_PDRFGM_LSB) & RF2G_RF2G2_PDRFGM_MASK) -#define RF2G_RF2G2_PDRXLO_MSB 22 -#define RF2G_RF2G2_PDRXLO_LSB 22 -#define RF2G_RF2G2_PDRXLO_MASK 0x00400000 -#define RF2G_RF2G2_PDRXLO_GET(x) (((x) & RF2G_RF2G2_PDRXLO_MASK) >> RF2G_RF2G2_PDRXLO_LSB) -#define RF2G_RF2G2_PDRXLO_SET(x) (((x) << RF2G_RF2G2_PDRXLO_LSB) & RF2G_RF2G2_PDRXLO_MASK) -#define RF2G_RF2G2_PDTXLO_MSB 21 -#define RF2G_RF2G2_PDTXLO_LSB 21 -#define RF2G_RF2G2_PDTXLO_MASK 0x00200000 -#define RF2G_RF2G2_PDTXLO_GET(x) (((x) & RF2G_RF2G2_PDTXLO_MASK) >> RF2G_RF2G2_PDTXLO_LSB) -#define RF2G_RF2G2_PDTXLO_SET(x) (((x) << RF2G_RF2G2_PDTXLO_LSB) & RF2G_RF2G2_PDTXLO_MASK) -#define RF2G_RF2G2_PDTXMIX_MSB 20 -#define RF2G_RF2G2_PDTXMIX_LSB 20 -#define RF2G_RF2G2_PDTXMIX_MASK 0x00100000 -#define RF2G_RF2G2_PDTXMIX_GET(x) (((x) & RF2G_RF2G2_PDTXMIX_MASK) >> RF2G_RF2G2_PDTXMIX_LSB) -#define RF2G_RF2G2_PDTXMIX_SET(x) (((x) << RF2G_RF2G2_PDTXMIX_LSB) & RF2G_RF2G2_PDTXMIX_MASK) -#define RF2G_RF2G2_REGLNA_BYPASS_MSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_LSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_MASK 0x00080000 -#define RF2G_RF2G2_REGLNA_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLNA_BYPASS_MASK) >> RF2G_RF2G2_REGLNA_BYPASS_LSB) -#define RF2G_RF2G2_REGLNA_BYPASS_SET(x) (((x) << RF2G_RF2G2_REGLNA_BYPASS_LSB) & RF2G_RF2G2_REGLNA_BYPASS_MASK) -#define RF2G_RF2G2_REGLO_BYPASS_MSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_LSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_MASK 0x00040000 -#define RF2G_RF2G2_REGLO_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLO_BYPASS_MASK) >> RF2G_RF2G2_REGLO_BYPASS_LSB) -#define RF2G_RF2G2_REGLO_BYPASS_SET(x) (((x) << RF2G_RF2G2_REGLO_BYPASS_LSB) & RF2G_RF2G2_REGLO_BYPASS_MASK) -#define RF2G_RF2G2_ENABLE_PCB_MSB 17 -#define RF2G_RF2G2_ENABLE_PCB_LSB 17 -#define RF2G_RF2G2_ENABLE_PCB_MASK 0x00020000 -#define RF2G_RF2G2_ENABLE_PCB_GET(x) (((x) & RF2G_RF2G2_ENABLE_PCB_MASK) >> RF2G_RF2G2_ENABLE_PCB_LSB) -#define RF2G_RF2G2_ENABLE_PCB_SET(x) (((x) << RF2G_RF2G2_ENABLE_PCB_LSB) & RF2G_RF2G2_ENABLE_PCB_MASK) -#define RF2G_RF2G2_SPARE_MSB 16 -#define RF2G_RF2G2_SPARE_LSB 0 -#define RF2G_RF2G2_SPARE_MASK 0x0001ffff -#define RF2G_RF2G2_SPARE_GET(x) (((x) & RF2G_RF2G2_SPARE_MASK) >> RF2G_RF2G2_SPARE_LSB) -#define RF2G_RF2G2_SPARE_SET(x) (((x) << RF2G_RF2G2_SPARE_LSB) & RF2G_RF2G2_SPARE_MASK) - -#define TOP_GAIN_ADDRESS 0x00000030 -#define TOP_GAIN_OFFSET 0x00000030 -#define TOP_GAIN_TX6DBLOQGAIN_MSB 31 -#define TOP_GAIN_TX6DBLOQGAIN_LSB 30 -#define TOP_GAIN_TX6DBLOQGAIN_MASK 0xc0000000 -#define TOP_GAIN_TX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX6DBLOQGAIN_MASK) >> TOP_GAIN_TX6DBLOQGAIN_LSB) -#define TOP_GAIN_TX6DBLOQGAIN_SET(x) (((x) << TOP_GAIN_TX6DBLOQGAIN_LSB) & TOP_GAIN_TX6DBLOQGAIN_MASK) -#define TOP_GAIN_TX1DBLOQGAIN_MSB 29 -#define TOP_GAIN_TX1DBLOQGAIN_LSB 27 -#define TOP_GAIN_TX1DBLOQGAIN_MASK 0x38000000 -#define TOP_GAIN_TX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX1DBLOQGAIN_MASK) >> TOP_GAIN_TX1DBLOQGAIN_LSB) -#define TOP_GAIN_TX1DBLOQGAIN_SET(x) (((x) << TOP_GAIN_TX1DBLOQGAIN_LSB) & TOP_GAIN_TX1DBLOQGAIN_MASK) -#define TOP_GAIN_TXV2IGAIN_MSB 26 -#define TOP_GAIN_TXV2IGAIN_LSB 25 -#define TOP_GAIN_TXV2IGAIN_MASK 0x06000000 -#define TOP_GAIN_TXV2IGAIN_GET(x) (((x) & TOP_GAIN_TXV2IGAIN_MASK) >> TOP_GAIN_TXV2IGAIN_LSB) -#define TOP_GAIN_TXV2IGAIN_SET(x) (((x) << TOP_GAIN_TXV2IGAIN_LSB) & TOP_GAIN_TXV2IGAIN_MASK) -#define TOP_GAIN_PABUF5GN_MSB 24 -#define TOP_GAIN_PABUF5GN_LSB 24 -#define TOP_GAIN_PABUF5GN_MASK 0x01000000 -#define TOP_GAIN_PABUF5GN_GET(x) (((x) & TOP_GAIN_PABUF5GN_MASK) >> TOP_GAIN_PABUF5GN_LSB) -#define TOP_GAIN_PABUF5GN_SET(x) (((x) << TOP_GAIN_PABUF5GN_LSB) & TOP_GAIN_PABUF5GN_MASK) -#define TOP_GAIN_PADRVGN_MSB 23 -#define TOP_GAIN_PADRVGN_LSB 21 -#define TOP_GAIN_PADRVGN_MASK 0x00e00000 -#define TOP_GAIN_PADRVGN_GET(x) (((x) & TOP_GAIN_PADRVGN_MASK) >> TOP_GAIN_PADRVGN_LSB) -#define TOP_GAIN_PADRVGN_SET(x) (((x) << TOP_GAIN_PADRVGN_LSB) & TOP_GAIN_PADRVGN_MASK) -#define TOP_GAIN_PAOUT2GN_MSB 20 -#define TOP_GAIN_PAOUT2GN_LSB 18 -#define TOP_GAIN_PAOUT2GN_MASK 0x001c0000 -#define TOP_GAIN_PAOUT2GN_GET(x) (((x) & TOP_GAIN_PAOUT2GN_MASK) >> TOP_GAIN_PAOUT2GN_LSB) -#define TOP_GAIN_PAOUT2GN_SET(x) (((x) << TOP_GAIN_PAOUT2GN_LSB) & TOP_GAIN_PAOUT2GN_MASK) -#define TOP_GAIN_LNAON_MSB 17 -#define TOP_GAIN_LNAON_LSB 17 -#define TOP_GAIN_LNAON_MASK 0x00020000 -#define TOP_GAIN_LNAON_GET(x) (((x) & TOP_GAIN_LNAON_MASK) >> TOP_GAIN_LNAON_LSB) -#define TOP_GAIN_LNAON_SET(x) (((x) << TOP_GAIN_LNAON_LSB) & TOP_GAIN_LNAON_MASK) -#define TOP_GAIN_LNAGAIN_MSB 16 -#define TOP_GAIN_LNAGAIN_LSB 13 -#define TOP_GAIN_LNAGAIN_MASK 0x0001e000 -#define TOP_GAIN_LNAGAIN_GET(x) (((x) & TOP_GAIN_LNAGAIN_MASK) >> TOP_GAIN_LNAGAIN_LSB) -#define TOP_GAIN_LNAGAIN_SET(x) (((x) << TOP_GAIN_LNAGAIN_LSB) & TOP_GAIN_LNAGAIN_MASK) -#define TOP_GAIN_RFVGA5GAIN_MSB 12 -#define TOP_GAIN_RFVGA5GAIN_LSB 11 -#define TOP_GAIN_RFVGA5GAIN_MASK 0x00001800 -#define TOP_GAIN_RFVGA5GAIN_GET(x) (((x) & TOP_GAIN_RFVGA5GAIN_MASK) >> TOP_GAIN_RFVGA5GAIN_LSB) -#define TOP_GAIN_RFVGA5GAIN_SET(x) (((x) << TOP_GAIN_RFVGA5GAIN_LSB) & TOP_GAIN_RFVGA5GAIN_MASK) -#define TOP_GAIN_RFGMGN_MSB 10 -#define TOP_GAIN_RFGMGN_LSB 8 -#define TOP_GAIN_RFGMGN_MASK 0x00000700 -#define TOP_GAIN_RFGMGN_GET(x) (((x) & TOP_GAIN_RFGMGN_MASK) >> TOP_GAIN_RFGMGN_LSB) -#define TOP_GAIN_RFGMGN_SET(x) (((x) << TOP_GAIN_RFGMGN_LSB) & TOP_GAIN_RFGMGN_MASK) -#define TOP_GAIN_RX6DBLOQGAIN_MSB 7 -#define TOP_GAIN_RX6DBLOQGAIN_LSB 6 -#define TOP_GAIN_RX6DBLOQGAIN_MASK 0x000000c0 -#define TOP_GAIN_RX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBLOQGAIN_MASK) >> TOP_GAIN_RX6DBLOQGAIN_LSB) -#define TOP_GAIN_RX6DBLOQGAIN_SET(x) (((x) << TOP_GAIN_RX6DBLOQGAIN_LSB) & TOP_GAIN_RX6DBLOQGAIN_MASK) -#define TOP_GAIN_RX1DBLOQGAIN_MSB 5 -#define TOP_GAIN_RX1DBLOQGAIN_LSB 3 -#define TOP_GAIN_RX1DBLOQGAIN_MASK 0x00000038 -#define TOP_GAIN_RX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX1DBLOQGAIN_MASK) >> TOP_GAIN_RX1DBLOQGAIN_LSB) -#define TOP_GAIN_RX1DBLOQGAIN_SET(x) (((x) << TOP_GAIN_RX1DBLOQGAIN_LSB) & TOP_GAIN_RX1DBLOQGAIN_MASK) -#define TOP_GAIN_RX6DBHIQGAIN_MSB 2 -#define TOP_GAIN_RX6DBHIQGAIN_LSB 1 -#define TOP_GAIN_RX6DBHIQGAIN_MASK 0x00000006 -#define TOP_GAIN_RX6DBHIQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBHIQGAIN_MASK) >> TOP_GAIN_RX6DBHIQGAIN_LSB) -#define TOP_GAIN_RX6DBHIQGAIN_SET(x) (((x) << TOP_GAIN_RX6DBHIQGAIN_LSB) & TOP_GAIN_RX6DBHIQGAIN_MASK) -#define TOP_GAIN_SPARE_MSB 0 -#define TOP_GAIN_SPARE_LSB 0 -#define TOP_GAIN_SPARE_MASK 0x00000001 -#define TOP_GAIN_SPARE_GET(x) (((x) & TOP_GAIN_SPARE_MASK) >> TOP_GAIN_SPARE_LSB) -#define TOP_GAIN_SPARE_SET(x) (((x) << TOP_GAIN_SPARE_LSB) & TOP_GAIN_SPARE_MASK) - -#define TOP_TOP_ADDRESS 0x00000034 -#define TOP_TOP_OFFSET 0x00000034 -#define TOP_TOP_LOCALTXGAIN_MSB 31 -#define TOP_TOP_LOCALTXGAIN_LSB 31 -#define TOP_TOP_LOCALTXGAIN_MASK 0x80000000 -#define TOP_TOP_LOCALTXGAIN_GET(x) (((x) & TOP_TOP_LOCALTXGAIN_MASK) >> TOP_TOP_LOCALTXGAIN_LSB) -#define TOP_TOP_LOCALTXGAIN_SET(x) (((x) << TOP_TOP_LOCALTXGAIN_LSB) & TOP_TOP_LOCALTXGAIN_MASK) -#define TOP_TOP_LOCALRXGAIN_MSB 30 -#define TOP_TOP_LOCALRXGAIN_LSB 30 -#define TOP_TOP_LOCALRXGAIN_MASK 0x40000000 -#define TOP_TOP_LOCALRXGAIN_GET(x) (((x) & TOP_TOP_LOCALRXGAIN_MASK) >> TOP_TOP_LOCALRXGAIN_LSB) -#define TOP_TOP_LOCALRXGAIN_SET(x) (((x) << TOP_TOP_LOCALRXGAIN_LSB) & TOP_TOP_LOCALRXGAIN_MASK) -#define TOP_TOP_LOCALMODE_MSB 29 -#define TOP_TOP_LOCALMODE_LSB 29 -#define TOP_TOP_LOCALMODE_MASK 0x20000000 -#define TOP_TOP_LOCALMODE_GET(x) (((x) & TOP_TOP_LOCALMODE_MASK) >> TOP_TOP_LOCALMODE_LSB) -#define TOP_TOP_LOCALMODE_SET(x) (((x) << TOP_TOP_LOCALMODE_LSB) & TOP_TOP_LOCALMODE_MASK) -#define TOP_TOP_CALFC_MSB 28 -#define TOP_TOP_CALFC_LSB 28 -#define TOP_TOP_CALFC_MASK 0x10000000 -#define TOP_TOP_CALFC_GET(x) (((x) & TOP_TOP_CALFC_MASK) >> TOP_TOP_CALFC_LSB) -#define TOP_TOP_CALFC_SET(x) (((x) << TOP_TOP_CALFC_LSB) & TOP_TOP_CALFC_MASK) -#define TOP_TOP_CALDC_MSB 27 -#define TOP_TOP_CALDC_LSB 27 -#define TOP_TOP_CALDC_MASK 0x08000000 -#define TOP_TOP_CALDC_GET(x) (((x) & TOP_TOP_CALDC_MASK) >> TOP_TOP_CALDC_LSB) -#define TOP_TOP_CALDC_SET(x) (((x) << TOP_TOP_CALDC_LSB) & TOP_TOP_CALDC_MASK) -#define TOP_TOP_CAL_RESIDUE_MSB 26 -#define TOP_TOP_CAL_RESIDUE_LSB 26 -#define TOP_TOP_CAL_RESIDUE_MASK 0x04000000 -#define TOP_TOP_CAL_RESIDUE_GET(x) (((x) & TOP_TOP_CAL_RESIDUE_MASK) >> TOP_TOP_CAL_RESIDUE_LSB) -#define TOP_TOP_CAL_RESIDUE_SET(x) (((x) << TOP_TOP_CAL_RESIDUE_LSB) & TOP_TOP_CAL_RESIDUE_MASK) -#define TOP_TOP_BMODE_MSB 25 -#define TOP_TOP_BMODE_LSB 25 -#define TOP_TOP_BMODE_MASK 0x02000000 -#define TOP_TOP_BMODE_GET(x) (((x) & TOP_TOP_BMODE_MASK) >> TOP_TOP_BMODE_LSB) -#define TOP_TOP_BMODE_SET(x) (((x) << TOP_TOP_BMODE_LSB) & TOP_TOP_BMODE_MASK) -#define TOP_TOP_SYNTHON_MSB 24 -#define TOP_TOP_SYNTHON_LSB 24 -#define TOP_TOP_SYNTHON_MASK 0x01000000 -#define TOP_TOP_SYNTHON_GET(x) (((x) & TOP_TOP_SYNTHON_MASK) >> TOP_TOP_SYNTHON_LSB) -#define TOP_TOP_SYNTHON_SET(x) (((x) << TOP_TOP_SYNTHON_LSB) & TOP_TOP_SYNTHON_MASK) -#define TOP_TOP_RXON_MSB 23 -#define TOP_TOP_RXON_LSB 23 -#define TOP_TOP_RXON_MASK 0x00800000 -#define TOP_TOP_RXON_GET(x) (((x) & TOP_TOP_RXON_MASK) >> TOP_TOP_RXON_LSB) -#define TOP_TOP_RXON_SET(x) (((x) << TOP_TOP_RXON_LSB) & TOP_TOP_RXON_MASK) -#define TOP_TOP_TXON_MSB 22 -#define TOP_TOP_TXON_LSB 22 -#define TOP_TOP_TXON_MASK 0x00400000 -#define TOP_TOP_TXON_GET(x) (((x) & TOP_TOP_TXON_MASK) >> TOP_TOP_TXON_LSB) -#define TOP_TOP_TXON_SET(x) (((x) << TOP_TOP_TXON_LSB) & TOP_TOP_TXON_MASK) -#define TOP_TOP_PAON_MSB 21 -#define TOP_TOP_PAON_LSB 21 -#define TOP_TOP_PAON_MASK 0x00200000 -#define TOP_TOP_PAON_GET(x) (((x) & TOP_TOP_PAON_MASK) >> TOP_TOP_PAON_LSB) -#define TOP_TOP_PAON_SET(x) (((x) << TOP_TOP_PAON_LSB) & TOP_TOP_PAON_MASK) -#define TOP_TOP_CALTX_MSB 20 -#define TOP_TOP_CALTX_LSB 20 -#define TOP_TOP_CALTX_MASK 0x00100000 -#define TOP_TOP_CALTX_GET(x) (((x) & TOP_TOP_CALTX_MASK) >> TOP_TOP_CALTX_LSB) -#define TOP_TOP_CALTX_SET(x) (((x) << TOP_TOP_CALTX_LSB) & TOP_TOP_CALTX_MASK) -#define TOP_TOP_LOCALADDAC_MSB 19 -#define TOP_TOP_LOCALADDAC_LSB 19 -#define TOP_TOP_LOCALADDAC_MASK 0x00080000 -#define TOP_TOP_LOCALADDAC_GET(x) (((x) & TOP_TOP_LOCALADDAC_MASK) >> TOP_TOP_LOCALADDAC_LSB) -#define TOP_TOP_LOCALADDAC_SET(x) (((x) << TOP_TOP_LOCALADDAC_LSB) & TOP_TOP_LOCALADDAC_MASK) -#define TOP_TOP_PWDPLL_MSB 18 -#define TOP_TOP_PWDPLL_LSB 18 -#define TOP_TOP_PWDPLL_MASK 0x00040000 -#define TOP_TOP_PWDPLL_GET(x) (((x) & TOP_TOP_PWDPLL_MASK) >> TOP_TOP_PWDPLL_LSB) -#define TOP_TOP_PWDPLL_SET(x) (((x) << TOP_TOP_PWDPLL_LSB) & TOP_TOP_PWDPLL_MASK) -#define TOP_TOP_PWDADC_MSB 17 -#define TOP_TOP_PWDADC_LSB 17 -#define TOP_TOP_PWDADC_MASK 0x00020000 -#define TOP_TOP_PWDADC_GET(x) (((x) & TOP_TOP_PWDADC_MASK) >> TOP_TOP_PWDADC_LSB) -#define TOP_TOP_PWDADC_SET(x) (((x) << TOP_TOP_PWDADC_LSB) & TOP_TOP_PWDADC_MASK) -#define TOP_TOP_PWDDAC_MSB 16 -#define TOP_TOP_PWDDAC_LSB 16 -#define TOP_TOP_PWDDAC_MASK 0x00010000 -#define TOP_TOP_PWDDAC_GET(x) (((x) & TOP_TOP_PWDDAC_MASK) >> TOP_TOP_PWDDAC_LSB) -#define TOP_TOP_PWDDAC_SET(x) (((x) << TOP_TOP_PWDDAC_LSB) & TOP_TOP_PWDDAC_MASK) -#define TOP_TOP_LOCALXTAL_MSB 15 -#define TOP_TOP_LOCALXTAL_LSB 15 -#define TOP_TOP_LOCALXTAL_MASK 0x00008000 -#define TOP_TOP_LOCALXTAL_GET(x) (((x) & TOP_TOP_LOCALXTAL_MASK) >> TOP_TOP_LOCALXTAL_LSB) -#define TOP_TOP_LOCALXTAL_SET(x) (((x) << TOP_TOP_LOCALXTAL_LSB) & TOP_TOP_LOCALXTAL_MASK) -#define TOP_TOP_PWDCLKIN_MSB 14 -#define TOP_TOP_PWDCLKIN_LSB 14 -#define TOP_TOP_PWDCLKIN_MASK 0x00004000 -#define TOP_TOP_PWDCLKIN_GET(x) (((x) & TOP_TOP_PWDCLKIN_MASK) >> TOP_TOP_PWDCLKIN_LSB) -#define TOP_TOP_PWDCLKIN_SET(x) (((x) << TOP_TOP_PWDCLKIN_LSB) & TOP_TOP_PWDCLKIN_MASK) -#define TOP_TOP_OSCON_MSB 13 -#define TOP_TOP_OSCON_LSB 13 -#define TOP_TOP_OSCON_MASK 0x00002000 -#define TOP_TOP_OSCON_GET(x) (((x) & TOP_TOP_OSCON_MASK) >> TOP_TOP_OSCON_LSB) -#define TOP_TOP_OSCON_SET(x) (((x) << TOP_TOP_OSCON_LSB) & TOP_TOP_OSCON_MASK) -#define TOP_TOP_SCLKEN_FORCE_MSB 12 -#define TOP_TOP_SCLKEN_FORCE_LSB 12 -#define TOP_TOP_SCLKEN_FORCE_MASK 0x00001000 -#define TOP_TOP_SCLKEN_FORCE_GET(x) (((x) & TOP_TOP_SCLKEN_FORCE_MASK) >> TOP_TOP_SCLKEN_FORCE_LSB) -#define TOP_TOP_SCLKEN_FORCE_SET(x) (((x) << TOP_TOP_SCLKEN_FORCE_LSB) & TOP_TOP_SCLKEN_FORCE_MASK) -#define TOP_TOP_SYNTHON_FORCE_MSB 11 -#define TOP_TOP_SYNTHON_FORCE_LSB 11 -#define TOP_TOP_SYNTHON_FORCE_MASK 0x00000800 -#define TOP_TOP_SYNTHON_FORCE_GET(x) (((x) & TOP_TOP_SYNTHON_FORCE_MASK) >> TOP_TOP_SYNTHON_FORCE_LSB) -#define TOP_TOP_SYNTHON_FORCE_SET(x) (((x) << TOP_TOP_SYNTHON_FORCE_LSB) & TOP_TOP_SYNTHON_FORCE_MASK) -#define TOP_TOP_PDBIAS_MSB 10 -#define TOP_TOP_PDBIAS_LSB 10 -#define TOP_TOP_PDBIAS_MASK 0x00000400 -#define TOP_TOP_PDBIAS_GET(x) (((x) & TOP_TOP_PDBIAS_MASK) >> TOP_TOP_PDBIAS_LSB) -#define TOP_TOP_PDBIAS_SET(x) (((x) << TOP_TOP_PDBIAS_LSB) & TOP_TOP_PDBIAS_MASK) -#define TOP_TOP_DATAOUTSEL_MSB 9 -#define TOP_TOP_DATAOUTSEL_LSB 8 -#define TOP_TOP_DATAOUTSEL_MASK 0x00000300 -#define TOP_TOP_DATAOUTSEL_GET(x) (((x) & TOP_TOP_DATAOUTSEL_MASK) >> TOP_TOP_DATAOUTSEL_LSB) -#define TOP_TOP_DATAOUTSEL_SET(x) (((x) << TOP_TOP_DATAOUTSEL_LSB) & TOP_TOP_DATAOUTSEL_MASK) -#define TOP_TOP_REVID_MSB 7 -#define TOP_TOP_REVID_LSB 5 -#define TOP_TOP_REVID_MASK 0x000000e0 -#define TOP_TOP_REVID_GET(x) (((x) & TOP_TOP_REVID_MASK) >> TOP_TOP_REVID_LSB) -#define TOP_TOP_REVID_SET(x) (((x) << TOP_TOP_REVID_LSB) & TOP_TOP_REVID_MASK) -#define TOP_TOP_INT2PAD_MSB 4 -#define TOP_TOP_INT2PAD_LSB 4 -#define TOP_TOP_INT2PAD_MASK 0x00000010 -#define TOP_TOP_INT2PAD_GET(x) (((x) & TOP_TOP_INT2PAD_MASK) >> TOP_TOP_INT2PAD_LSB) -#define TOP_TOP_INT2PAD_SET(x) (((x) << TOP_TOP_INT2PAD_LSB) & TOP_TOP_INT2PAD_MASK) -#define TOP_TOP_INTH2PAD_MSB 3 -#define TOP_TOP_INTH2PAD_LSB 3 -#define TOP_TOP_INTH2PAD_MASK 0x00000008 -#define TOP_TOP_INTH2PAD_GET(x) (((x) & TOP_TOP_INTH2PAD_MASK) >> TOP_TOP_INTH2PAD_LSB) -#define TOP_TOP_INTH2PAD_SET(x) (((x) << TOP_TOP_INTH2PAD_LSB) & TOP_TOP_INTH2PAD_MASK) -#define TOP_TOP_PAD2GND_MSB 2 -#define TOP_TOP_PAD2GND_LSB 2 -#define TOP_TOP_PAD2GND_MASK 0x00000004 -#define TOP_TOP_PAD2GND_GET(x) (((x) & TOP_TOP_PAD2GND_MASK) >> TOP_TOP_PAD2GND_LSB) -#define TOP_TOP_PAD2GND_SET(x) (((x) << TOP_TOP_PAD2GND_LSB) & TOP_TOP_PAD2GND_MASK) -#define TOP_TOP_INT2GND_MSB 1 -#define TOP_TOP_INT2GND_LSB 1 -#define TOP_TOP_INT2GND_MASK 0x00000002 -#define TOP_TOP_INT2GND_GET(x) (((x) & TOP_TOP_INT2GND_MASK) >> TOP_TOP_INT2GND_LSB) -#define TOP_TOP_INT2GND_SET(x) (((x) << TOP_TOP_INT2GND_LSB) & TOP_TOP_INT2GND_MASK) -#define TOP_TOP_FORCE_XPAON_MSB 0 -#define TOP_TOP_FORCE_XPAON_LSB 0 -#define TOP_TOP_FORCE_XPAON_MASK 0x00000001 -#define TOP_TOP_FORCE_XPAON_GET(x) (((x) & TOP_TOP_FORCE_XPAON_MASK) >> TOP_TOP_FORCE_XPAON_LSB) -#define TOP_TOP_FORCE_XPAON_SET(x) (((x) << TOP_TOP_FORCE_XPAON_LSB) & TOP_TOP_FORCE_XPAON_MASK) - -#define BIAS_BIAS_SEL_ADDRESS 0x00000038 -#define BIAS_BIAS_SEL_OFFSET 0x00000038 -#define BIAS_BIAS_SEL_PADON_MSB 31 -#define BIAS_BIAS_SEL_PADON_LSB 31 -#define BIAS_BIAS_SEL_PADON_MASK 0x80000000 -#define BIAS_BIAS_SEL_PADON_GET(x) (((x) & BIAS_BIAS_SEL_PADON_MASK) >> BIAS_BIAS_SEL_PADON_LSB) -#define BIAS_BIAS_SEL_PADON_SET(x) (((x) << BIAS_BIAS_SEL_PADON_LSB) & BIAS_BIAS_SEL_PADON_MASK) -#define BIAS_BIAS_SEL_SEL_BIAS_MSB 30 -#define BIAS_BIAS_SEL_SEL_BIAS_LSB 25 -#define BIAS_BIAS_SEL_SEL_BIAS_MASK 0x7e000000 -#define BIAS_BIAS_SEL_SEL_BIAS_GET(x) (((x) & BIAS_BIAS_SEL_SEL_BIAS_MASK) >> BIAS_BIAS_SEL_SEL_BIAS_LSB) -#define BIAS_BIAS_SEL_SEL_BIAS_SET(x) (((x) << BIAS_BIAS_SEL_SEL_BIAS_LSB) & BIAS_BIAS_SEL_SEL_BIAS_MASK) -#define BIAS_BIAS_SEL_SEL_SPARE_MSB 24 -#define BIAS_BIAS_SEL_SEL_SPARE_LSB 21 -#define BIAS_BIAS_SEL_SEL_SPARE_MASK 0x01e00000 -#define BIAS_BIAS_SEL_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SEL_SPARE_SET(x) (((x) << BIAS_BIAS_SEL_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_SPARE_MSB 20 -#define BIAS_BIAS_SEL_SPARE_LSB 20 -#define BIAS_BIAS_SEL_SPARE_MASK 0x00100000 -#define BIAS_BIAS_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SPARE_SET(x) (((x) << BIAS_BIAS_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MSB 19 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB 17 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK 0x000e0000 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK 0x00010000 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_SET(x) (((x) << BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK 0x00008000 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_SET(x) (((x) << BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK 0x00004000 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_LSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MASK 0x00002000 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) >> BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MSB 12 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB 10 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK 0x00001c00 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MSB 9 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_LSB 7 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MASK 0x00000380 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) >> BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MSB 6 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_LSB 4 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MASK 0x00000070 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) >> BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MSB 3 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_LSB 1 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MASK 0x0000000e -#define BIAS_BIAS_SEL_PWD_ICTXPC25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) >> BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) -#define BIAS_BIAS_SEL_PWD_ICLDO25_MSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_LSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_MASK 0x00000001 -#define BIAS_BIAS_SEL_PWD_ICLDO25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) >> BIAS_BIAS_SEL_PWD_ICLDO25_LSB) -#define BIAS_BIAS_SEL_PWD_ICLDO25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICLDO25_LSB) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) - -#define BIAS_BIAS1_ADDRESS 0x0000003c -#define BIAS_BIAS1_OFFSET 0x0000003c -#define BIAS_BIAS1_PWD_ICDAC2BB25_MSB 31 -#define BIAS_BIAS1_PWD_ICDAC2BB25_LSB 29 -#define BIAS_BIAS1_PWD_ICDAC2BB25_MASK 0xe0000000 -#define BIAS_BIAS1_PWD_ICDAC2BB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) >> BIAS_BIAS1_PWD_ICDAC2BB25_LSB) -#define BIAS_BIAS1_PWD_ICDAC2BB25_SET(x) (((x) << BIAS_BIAS1_PWD_ICDAC2BB25_LSB) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) -#define BIAS_BIAS1_PWD_IC2GVGM25_MSB 28 -#define BIAS_BIAS1_PWD_IC2GVGM25_LSB 26 -#define BIAS_BIAS1_PWD_IC2GVGM25_MASK 0x1c000000 -#define BIAS_BIAS1_PWD_IC2GVGM25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) >> BIAS_BIAS1_PWD_IC2GVGM25_LSB) -#define BIAS_BIAS1_PWD_IC2GVGM25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GVGM25_LSB) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) -#define BIAS_BIAS1_PWD_IC2GRFFE25_MSB 25 -#define BIAS_BIAS1_PWD_IC2GRFFE25_LSB 23 -#define BIAS_BIAS1_PWD_IC2GRFFE25_MASK 0x03800000 -#define BIAS_BIAS1_PWD_IC2GRFFE25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) >> BIAS_BIAS1_PWD_IC2GRFFE25_LSB) -#define BIAS_BIAS1_PWD_IC2GRFFE25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GRFFE25_LSB) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) -#define BIAS_BIAS1_PWD_IC2GLOREG25_MSB 22 -#define BIAS_BIAS1_PWD_IC2GLOREG25_LSB 20 -#define BIAS_BIAS1_PWD_IC2GLOREG25_MASK 0x00700000 -#define BIAS_BIAS1_PWD_IC2GLOREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLOREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLOREG25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GLOREG25_LSB) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MSB 19 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_LSB 17 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MASK 0x000e0000 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORB25_MSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_LSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_MASK 0x00010000 -#define BIAS_BIAS1_PWD_ICDETECTORB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORB25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORB25_SET(x) (((x) << BIAS_BIAS1_PWD_ICDETECTORB25_LSB) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORA25_MSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_LSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_MASK 0x00008000 -#define BIAS_BIAS1_PWD_ICDETECTORA25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORA25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORA25_SET(x) (((x) << BIAS_BIAS1_PWD_ICDETECTORA25_LSB) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) -#define BIAS_BIAS1_PWD_IC5GRXRF25_MSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_LSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_MASK 0x00004000 -#define BIAS_BIAS1_PWD_IC5GRXRF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) >> BIAS_BIAS1_PWD_IC5GRXRF25_LSB) -#define BIAS_BIAS1_PWD_IC5GRXRF25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GRXRF25_LSB) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXPA25_MSB 13 -#define BIAS_BIAS1_PWD_IC5GTXPA25_LSB 11 -#define BIAS_BIAS1_PWD_IC5GTXPA25_MASK 0x00003800 -#define BIAS_BIAS1_PWD_IC5GTXPA25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) >> BIAS_BIAS1_PWD_IC5GTXPA25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXPA25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GTXPA25_LSB) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MSB 10 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_LSB 8 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MASK 0x00000700 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) >> BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) -#define BIAS_BIAS1_PWD_IC5GQB25_MSB 7 -#define BIAS_BIAS1_PWD_IC5GQB25_LSB 5 -#define BIAS_BIAS1_PWD_IC5GQB25_MASK 0x000000e0 -#define BIAS_BIAS1_PWD_IC5GQB25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GQB25_MASK) >> BIAS_BIAS1_PWD_IC5GQB25_LSB) -#define BIAS_BIAS1_PWD_IC5GQB25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GQB25_LSB) & BIAS_BIAS1_PWD_IC5GQB25_MASK) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MSB 4 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_LSB 2 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MASK 0x0000001c -#define BIAS_BIAS1_PWD_IC5GMIXQ25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) >> BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) -#define BIAS_BIAS1_SPARE_MSB 1 -#define BIAS_BIAS1_SPARE_LSB 0 -#define BIAS_BIAS1_SPARE_MASK 0x00000003 -#define BIAS_BIAS1_SPARE_GET(x) (((x) & BIAS_BIAS1_SPARE_MASK) >> BIAS_BIAS1_SPARE_LSB) -#define BIAS_BIAS1_SPARE_SET(x) (((x) << BIAS_BIAS1_SPARE_LSB) & BIAS_BIAS1_SPARE_MASK) - -#define BIAS_BIAS2_ADDRESS 0x00000040 -#define BIAS_BIAS2_OFFSET 0x00000040 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MSB 31 -#define BIAS_BIAS2_PWD_IC5GMIXI25_LSB 29 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MASK 0xe0000000 -#define BIAS_BIAS2_PWD_IC5GMIXI25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) >> BIAS_BIAS2_PWD_IC5GMIXI25_LSB) -#define BIAS_BIAS2_PWD_IC5GMIXI25_SET(x) (((x) << BIAS_BIAS2_PWD_IC5GMIXI25_LSB) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) -#define BIAS_BIAS2_PWD_IC5GDIV25_MSB 28 -#define BIAS_BIAS2_PWD_IC5GDIV25_LSB 26 -#define BIAS_BIAS2_PWD_IC5GDIV25_MASK 0x1c000000 -#define BIAS_BIAS2_PWD_IC5GDIV25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) >> BIAS_BIAS2_PWD_IC5GDIV25_LSB) -#define BIAS_BIAS2_PWD_IC5GDIV25_SET(x) (((x) << BIAS_BIAS2_PWD_IC5GDIV25_LSB) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) -#define BIAS_BIAS2_PWD_IC5GLOREG25_MSB 25 -#define BIAS_BIAS2_PWD_IC5GLOREG25_LSB 23 -#define BIAS_BIAS2_PWD_IC5GLOREG25_MASK 0x03800000 -#define BIAS_BIAS2_PWD_IC5GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) >> BIAS_BIAS2_PWD_IC5GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IC5GLOREG25_SET(x) (((x) << BIAS_BIAS2_PWD_IC5GLOREG25_LSB) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IRPLL25_MSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_LSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_MASK 0x00400000 -#define BIAS_BIAS2_PWD_IRPLL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRPLL25_MASK) >> BIAS_BIAS2_PWD_IRPLL25_LSB) -#define BIAS_BIAS2_PWD_IRPLL25_SET(x) (((x) << BIAS_BIAS2_PWD_IRPLL25_LSB) & BIAS_BIAS2_PWD_IRPLL25_MASK) -#define BIAS_BIAS2_PWD_IRXTAL25_MSB 21 -#define BIAS_BIAS2_PWD_IRXTAL25_LSB 19 -#define BIAS_BIAS2_PWD_IRXTAL25_MASK 0x00380000 -#define BIAS_BIAS2_PWD_IRXTAL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRXTAL25_MASK) >> BIAS_BIAS2_PWD_IRXTAL25_LSB) -#define BIAS_BIAS2_PWD_IRXTAL25_SET(x) (((x) << BIAS_BIAS2_PWD_IRXTAL25_LSB) & BIAS_BIAS2_PWD_IRXTAL25_MASK) -#define BIAS_BIAS2_PWD_IRTSENS25_MSB 18 -#define BIAS_BIAS2_PWD_IRTSENS25_LSB 16 -#define BIAS_BIAS2_PWD_IRTSENS25_MASK 0x00070000 -#define BIAS_BIAS2_PWD_IRTSENS25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTSENS25_MASK) >> BIAS_BIAS2_PWD_IRTSENS25_LSB) -#define BIAS_BIAS2_PWD_IRTSENS25_SET(x) (((x) << BIAS_BIAS2_PWD_IRTSENS25_LSB) & BIAS_BIAS2_PWD_IRTSENS25_MASK) -#define BIAS_BIAS2_PWD_IRTXPC25_MSB 15 -#define BIAS_BIAS2_PWD_IRTXPC25_LSB 13 -#define BIAS_BIAS2_PWD_IRTXPC25_MASK 0x0000e000 -#define BIAS_BIAS2_PWD_IRTXPC25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTXPC25_MASK) >> BIAS_BIAS2_PWD_IRTXPC25_LSB) -#define BIAS_BIAS2_PWD_IRTXPC25_SET(x) (((x) << BIAS_BIAS2_PWD_IRTXPC25_LSB) & BIAS_BIAS2_PWD_IRTXPC25_MASK) -#define BIAS_BIAS2_PWD_IRLDO25_MSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_LSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_MASK 0x00001000 -#define BIAS_BIAS2_PWD_IRLDO25_GET(x) (((x) & BIAS_BIAS2_PWD_IRLDO25_MASK) >> BIAS_BIAS2_PWD_IRLDO25_LSB) -#define BIAS_BIAS2_PWD_IRLDO25_SET(x) (((x) << BIAS_BIAS2_PWD_IRLDO25_LSB) & BIAS_BIAS2_PWD_IRLDO25_MASK) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MSB 11 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_LSB 9 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MASK 0x00000e00 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) >> BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_SET(x) (((x) << BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) -#define BIAS_BIAS2_PWD_IR2GLOREG25_MSB 8 -#define BIAS_BIAS2_PWD_IR2GLOREG25_LSB 6 -#define BIAS_BIAS2_PWD_IR2GLOREG25_MASK 0x000001c0 -#define BIAS_BIAS2_PWD_IR2GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLOREG25_SET(x) (((x) << BIAS_BIAS2_PWD_IR2GLOREG25_LSB) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MSB 5 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_LSB 3 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MASK 0x00000038 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_SET(x) (((x) << BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MSB 2 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB 0 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK 0x00000007 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_GET(x) (((x) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) >> BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_SET(x) (((x) << BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) - -#define BIAS_BIAS3_ADDRESS 0x00000044 -#define BIAS_BIAS3_OFFSET 0x00000044 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MSB 31 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_LSB 29 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MASK 0xe0000000 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) >> BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) -#define BIAS_BIAS3_PWD_IR5GTXMIX25_SET(x) (((x) << BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) -#define BIAS_BIAS3_PWD_IR5GAGC25_MSB 28 -#define BIAS_BIAS3_PWD_IR5GAGC25_LSB 26 -#define BIAS_BIAS3_PWD_IR5GAGC25_MASK 0x1c000000 -#define BIAS_BIAS3_PWD_IR5GAGC25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) >> BIAS_BIAS3_PWD_IR5GAGC25_LSB) -#define BIAS_BIAS3_PWD_IR5GAGC25_SET(x) (((x) << BIAS_BIAS3_PWD_IR5GAGC25_LSB) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) -#define BIAS_BIAS3_PWD_ICDAC50_MSB 25 -#define BIAS_BIAS3_PWD_ICDAC50_LSB 23 -#define BIAS_BIAS3_PWD_ICDAC50_MASK 0x03800000 -#define BIAS_BIAS3_PWD_ICDAC50_GET(x) (((x) & BIAS_BIAS3_PWD_ICDAC50_MASK) >> BIAS_BIAS3_PWD_ICDAC50_LSB) -#define BIAS_BIAS3_PWD_ICDAC50_SET(x) (((x) << BIAS_BIAS3_PWD_ICDAC50_LSB) & BIAS_BIAS3_PWD_ICDAC50_MASK) -#define BIAS_BIAS3_PWD_ICSYNTH50_MSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_LSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_MASK 0x00400000 -#define BIAS_BIAS3_PWD_ICSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) >> BIAS_BIAS3_PWD_ICSYNTH50_LSB) -#define BIAS_BIAS3_PWD_ICSYNTH50_SET(x) (((x) << BIAS_BIAS3_PWD_ICSYNTH50_LSB) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) -#define BIAS_BIAS3_PWD_ICBB50_MSB 21 -#define BIAS_BIAS3_PWD_ICBB50_LSB 21 -#define BIAS_BIAS3_PWD_ICBB50_MASK 0x00200000 -#define BIAS_BIAS3_PWD_ICBB50_GET(x) (((x) & BIAS_BIAS3_PWD_ICBB50_MASK) >> BIAS_BIAS3_PWD_ICBB50_LSB) -#define BIAS_BIAS3_PWD_ICBB50_SET(x) (((x) << BIAS_BIAS3_PWD_ICBB50_LSB) & BIAS_BIAS3_PWD_ICBB50_MASK) -#define BIAS_BIAS3_PWD_IC2GDIV50_MSB 20 -#define BIAS_BIAS3_PWD_IC2GDIV50_LSB 18 -#define BIAS_BIAS3_PWD_IC2GDIV50_MASK 0x001c0000 -#define BIAS_BIAS3_PWD_IC2GDIV50_GET(x) (((x) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) >> BIAS_BIAS3_PWD_IC2GDIV50_LSB) -#define BIAS_BIAS3_PWD_IC2GDIV50_SET(x) (((x) << BIAS_BIAS3_PWD_IC2GDIV50_LSB) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) -#define BIAS_BIAS3_PWD_IRSYNTH50_MSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_LSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_MASK 0x00020000 -#define BIAS_BIAS3_PWD_IRSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) >> BIAS_BIAS3_PWD_IRSYNTH50_LSB) -#define BIAS_BIAS3_PWD_IRSYNTH50_SET(x) (((x) << BIAS_BIAS3_PWD_IRSYNTH50_LSB) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) -#define BIAS_BIAS3_PWD_IRBB50_MSB 16 -#define BIAS_BIAS3_PWD_IRBB50_LSB 16 -#define BIAS_BIAS3_PWD_IRBB50_MASK 0x00010000 -#define BIAS_BIAS3_PWD_IRBB50_GET(x) (((x) & BIAS_BIAS3_PWD_IRBB50_MASK) >> BIAS_BIAS3_PWD_IRBB50_LSB) -#define BIAS_BIAS3_PWD_IRBB50_SET(x) (((x) << BIAS_BIAS3_PWD_IRBB50_LSB) & BIAS_BIAS3_PWD_IRBB50_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE1_MSB 15 -#define BIAS_BIAS3_PWD_IC25SPARE1_LSB 13 -#define BIAS_BIAS3_PWD_IC25SPARE1_MASK 0x0000e000 -#define BIAS_BIAS3_PWD_IC25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) >> BIAS_BIAS3_PWD_IC25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE1_SET(x) (((x) << BIAS_BIAS3_PWD_IC25SPARE1_LSB) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE2_MSB 12 -#define BIAS_BIAS3_PWD_IC25SPARE2_LSB 10 -#define BIAS_BIAS3_PWD_IC25SPARE2_MASK 0x00001c00 -#define BIAS_BIAS3_PWD_IC25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) >> BIAS_BIAS3_PWD_IC25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE2_SET(x) (((x) << BIAS_BIAS3_PWD_IC25SPARE2_LSB) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE1_MSB 9 -#define BIAS_BIAS3_PWD_IR25SPARE1_LSB 7 -#define BIAS_BIAS3_PWD_IR25SPARE1_MASK 0x00000380 -#define BIAS_BIAS3_PWD_IR25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) >> BIAS_BIAS3_PWD_IR25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE1_SET(x) (((x) << BIAS_BIAS3_PWD_IR25SPARE1_LSB) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE2_MSB 6 -#define BIAS_BIAS3_PWD_IR25SPARE2_LSB 4 -#define BIAS_BIAS3_PWD_IR25SPARE2_MASK 0x00000070 -#define BIAS_BIAS3_PWD_IR25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) >> BIAS_BIAS3_PWD_IR25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE2_SET(x) (((x) << BIAS_BIAS3_PWD_IR25SPARE2_LSB) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) -#define BIAS_BIAS3_PWD_ICDACREG12P5_MSB 3 -#define BIAS_BIAS3_PWD_ICDACREG12P5_LSB 1 -#define BIAS_BIAS3_PWD_ICDACREG12P5_MASK 0x0000000e -#define BIAS_BIAS3_PWD_ICDACREG12P5_GET(x) (((x) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) >> BIAS_BIAS3_PWD_ICDACREG12P5_LSB) -#define BIAS_BIAS3_PWD_ICDACREG12P5_SET(x) (((x) << BIAS_BIAS3_PWD_ICDACREG12P5_LSB) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) -#define BIAS_BIAS3_SPARE_MSB 0 -#define BIAS_BIAS3_SPARE_LSB 0 -#define BIAS_BIAS3_SPARE_MASK 0x00000001 -#define BIAS_BIAS3_SPARE_GET(x) (((x) & BIAS_BIAS3_SPARE_MASK) >> BIAS_BIAS3_SPARE_LSB) -#define BIAS_BIAS3_SPARE_SET(x) (((x) << BIAS_BIAS3_SPARE_LSB) & BIAS_BIAS3_SPARE_MASK) - -#define TXPC_TXPC_ADDRESS 0x00000048 -#define TXPC_TXPC_OFFSET 0x00000048 -#define TXPC_TXPC_SELINTPD_MSB 31 -#define TXPC_TXPC_SELINTPD_LSB 31 -#define TXPC_TXPC_SELINTPD_MASK 0x80000000 -#define TXPC_TXPC_SELINTPD_GET(x) (((x) & TXPC_TXPC_SELINTPD_MASK) >> TXPC_TXPC_SELINTPD_LSB) -#define TXPC_TXPC_SELINTPD_SET(x) (((x) << TXPC_TXPC_SELINTPD_LSB) & TXPC_TXPC_SELINTPD_MASK) -#define TXPC_TXPC_TEST_MSB 30 -#define TXPC_TXPC_TEST_LSB 30 -#define TXPC_TXPC_TEST_MASK 0x40000000 -#define TXPC_TXPC_TEST_GET(x) (((x) & TXPC_TXPC_TEST_MASK) >> TXPC_TXPC_TEST_LSB) -#define TXPC_TXPC_TEST_SET(x) (((x) << TXPC_TXPC_TEST_LSB) & TXPC_TXPC_TEST_MASK) -#define TXPC_TXPC_TESTGAIN_MSB 29 -#define TXPC_TXPC_TESTGAIN_LSB 28 -#define TXPC_TXPC_TESTGAIN_MASK 0x30000000 -#define TXPC_TXPC_TESTGAIN_GET(x) (((x) & TXPC_TXPC_TESTGAIN_MASK) >> TXPC_TXPC_TESTGAIN_LSB) -#define TXPC_TXPC_TESTGAIN_SET(x) (((x) << TXPC_TXPC_TESTGAIN_LSB) & TXPC_TXPC_TESTGAIN_MASK) -#define TXPC_TXPC_TESTDAC_MSB 27 -#define TXPC_TXPC_TESTDAC_LSB 22 -#define TXPC_TXPC_TESTDAC_MASK 0x0fc00000 -#define TXPC_TXPC_TESTDAC_GET(x) (((x) & TXPC_TXPC_TESTDAC_MASK) >> TXPC_TXPC_TESTDAC_LSB) -#define TXPC_TXPC_TESTDAC_SET(x) (((x) << TXPC_TXPC_TESTDAC_LSB) & TXPC_TXPC_TESTDAC_MASK) -#define TXPC_TXPC_TESTPWDPC_MSB 21 -#define TXPC_TXPC_TESTPWDPC_LSB 21 -#define TXPC_TXPC_TESTPWDPC_MASK 0x00200000 -#define TXPC_TXPC_TESTPWDPC_GET(x) (((x) & TXPC_TXPC_TESTPWDPC_MASK) >> TXPC_TXPC_TESTPWDPC_LSB) -#define TXPC_TXPC_TESTPWDPC_SET(x) (((x) << TXPC_TXPC_TESTPWDPC_LSB) & TXPC_TXPC_TESTPWDPC_MASK) -#define TXPC_TXPC_CURHALF_MSB 20 -#define TXPC_TXPC_CURHALF_LSB 20 -#define TXPC_TXPC_CURHALF_MASK 0x00100000 -#define TXPC_TXPC_CURHALF_GET(x) (((x) & TXPC_TXPC_CURHALF_MASK) >> TXPC_TXPC_CURHALF_LSB) -#define TXPC_TXPC_CURHALF_SET(x) (((x) << TXPC_TXPC_CURHALF_LSB) & TXPC_TXPC_CURHALF_MASK) -#define TXPC_TXPC_NEGOUT_MSB 19 -#define TXPC_TXPC_NEGOUT_LSB 19 -#define TXPC_TXPC_NEGOUT_MASK 0x00080000 -#define TXPC_TXPC_NEGOUT_GET(x) (((x) & TXPC_TXPC_NEGOUT_MASK) >> TXPC_TXPC_NEGOUT_LSB) -#define TXPC_TXPC_NEGOUT_SET(x) (((x) << TXPC_TXPC_NEGOUT_LSB) & TXPC_TXPC_NEGOUT_MASK) -#define TXPC_TXPC_CLKDELAY_MSB 18 -#define TXPC_TXPC_CLKDELAY_LSB 18 -#define TXPC_TXPC_CLKDELAY_MASK 0x00040000 -#define TXPC_TXPC_CLKDELAY_GET(x) (((x) & TXPC_TXPC_CLKDELAY_MASK) >> TXPC_TXPC_CLKDELAY_LSB) -#define TXPC_TXPC_CLKDELAY_SET(x) (((x) << TXPC_TXPC_CLKDELAY_LSB) & TXPC_TXPC_CLKDELAY_MASK) -#define TXPC_TXPC_SELMODREF_MSB 17 -#define TXPC_TXPC_SELMODREF_LSB 17 -#define TXPC_TXPC_SELMODREF_MASK 0x00020000 -#define TXPC_TXPC_SELMODREF_GET(x) (((x) & TXPC_TXPC_SELMODREF_MASK) >> TXPC_TXPC_SELMODREF_LSB) -#define TXPC_TXPC_SELMODREF_SET(x) (((x) << TXPC_TXPC_SELMODREF_LSB) & TXPC_TXPC_SELMODREF_MASK) -#define TXPC_TXPC_SELCMOUT_MSB 16 -#define TXPC_TXPC_SELCMOUT_LSB 16 -#define TXPC_TXPC_SELCMOUT_MASK 0x00010000 -#define TXPC_TXPC_SELCMOUT_GET(x) (((x) & TXPC_TXPC_SELCMOUT_MASK) >> TXPC_TXPC_SELCMOUT_LSB) -#define TXPC_TXPC_SELCMOUT_SET(x) (((x) << TXPC_TXPC_SELCMOUT_LSB) & TXPC_TXPC_SELCMOUT_MASK) -#define TXPC_TXPC_TSMODE_MSB 15 -#define TXPC_TXPC_TSMODE_LSB 14 -#define TXPC_TXPC_TSMODE_MASK 0x0000c000 -#define TXPC_TXPC_TSMODE_GET(x) (((x) & TXPC_TXPC_TSMODE_MASK) >> TXPC_TXPC_TSMODE_LSB) -#define TXPC_TXPC_TSMODE_SET(x) (((x) << TXPC_TXPC_TSMODE_LSB) & TXPC_TXPC_TSMODE_MASK) -#define TXPC_TXPC_N_MSB 13 -#define TXPC_TXPC_N_LSB 6 -#define TXPC_TXPC_N_MASK 0x00003fc0 -#define TXPC_TXPC_N_GET(x) (((x) & TXPC_TXPC_N_MASK) >> TXPC_TXPC_N_LSB) -#define TXPC_TXPC_N_SET(x) (((x) << TXPC_TXPC_N_LSB) & TXPC_TXPC_N_MASK) -#define TXPC_TXPC_ON1STSYNTHON_MSB 5 -#define TXPC_TXPC_ON1STSYNTHON_LSB 5 -#define TXPC_TXPC_ON1STSYNTHON_MASK 0x00000020 -#define TXPC_TXPC_ON1STSYNTHON_GET(x) (((x) & TXPC_TXPC_ON1STSYNTHON_MASK) >> TXPC_TXPC_ON1STSYNTHON_LSB) -#define TXPC_TXPC_ON1STSYNTHON_SET(x) (((x) << TXPC_TXPC_ON1STSYNTHON_LSB) & TXPC_TXPC_ON1STSYNTHON_MASK) -#define TXPC_TXPC_SELINIT_MSB 4 -#define TXPC_TXPC_SELINIT_LSB 3 -#define TXPC_TXPC_SELINIT_MASK 0x00000018 -#define TXPC_TXPC_SELINIT_GET(x) (((x) & TXPC_TXPC_SELINIT_MASK) >> TXPC_TXPC_SELINIT_LSB) -#define TXPC_TXPC_SELINIT_SET(x) (((x) << TXPC_TXPC_SELINIT_LSB) & TXPC_TXPC_SELINIT_MASK) -#define TXPC_TXPC_SELCOUNT_MSB 2 -#define TXPC_TXPC_SELCOUNT_LSB 2 -#define TXPC_TXPC_SELCOUNT_MASK 0x00000004 -#define TXPC_TXPC_SELCOUNT_GET(x) (((x) & TXPC_TXPC_SELCOUNT_MASK) >> TXPC_TXPC_SELCOUNT_LSB) -#define TXPC_TXPC_SELCOUNT_SET(x) (((x) << TXPC_TXPC_SELCOUNT_LSB) & TXPC_TXPC_SELCOUNT_MASK) -#define TXPC_TXPC_ATBSEL_MSB 1 -#define TXPC_TXPC_ATBSEL_LSB 0 -#define TXPC_TXPC_ATBSEL_MASK 0x00000003 -#define TXPC_TXPC_ATBSEL_GET(x) (((x) & TXPC_TXPC_ATBSEL_MASK) >> TXPC_TXPC_ATBSEL_LSB) -#define TXPC_TXPC_ATBSEL_SET(x) (((x) << TXPC_TXPC_ATBSEL_LSB) & TXPC_TXPC_ATBSEL_MASK) - -#define TXPC_MISC_ADDRESS 0x0000004c -#define TXPC_MISC_OFFSET 0x0000004c -#define TXPC_MISC_FLIPBMODE_MSB 31 -#define TXPC_MISC_FLIPBMODE_LSB 31 -#define TXPC_MISC_FLIPBMODE_MASK 0x80000000 -#define TXPC_MISC_FLIPBMODE_GET(x) (((x) & TXPC_MISC_FLIPBMODE_MASK) >> TXPC_MISC_FLIPBMODE_LSB) -#define TXPC_MISC_FLIPBMODE_SET(x) (((x) << TXPC_MISC_FLIPBMODE_LSB) & TXPC_MISC_FLIPBMODE_MASK) -#define TXPC_MISC_LEVEL_MSB 30 -#define TXPC_MISC_LEVEL_LSB 29 -#define TXPC_MISC_LEVEL_MASK 0x60000000 -#define TXPC_MISC_LEVEL_GET(x) (((x) & TXPC_MISC_LEVEL_MASK) >> TXPC_MISC_LEVEL_LSB) -#define TXPC_MISC_LEVEL_SET(x) (((x) << TXPC_MISC_LEVEL_LSB) & TXPC_MISC_LEVEL_MASK) -#define TXPC_MISC_LDO_TEST_MODE_MSB 28 -#define TXPC_MISC_LDO_TEST_MODE_LSB 28 -#define TXPC_MISC_LDO_TEST_MODE_MASK 0x10000000 -#define TXPC_MISC_LDO_TEST_MODE_GET(x) (((x) & TXPC_MISC_LDO_TEST_MODE_MASK) >> TXPC_MISC_LDO_TEST_MODE_LSB) -#define TXPC_MISC_LDO_TEST_MODE_SET(x) (((x) << TXPC_MISC_LDO_TEST_MODE_LSB) & TXPC_MISC_LDO_TEST_MODE_MASK) -#define TXPC_MISC_NOTCXODET_MSB 27 -#define TXPC_MISC_NOTCXODET_LSB 27 -#define TXPC_MISC_NOTCXODET_MASK 0x08000000 -#define TXPC_MISC_NOTCXODET_GET(x) (((x) & TXPC_MISC_NOTCXODET_MASK) >> TXPC_MISC_NOTCXODET_LSB) -#define TXPC_MISC_NOTCXODET_SET(x) (((x) << TXPC_MISC_NOTCXODET_LSB) & TXPC_MISC_NOTCXODET_MASK) -#define TXPC_MISC_PWDCLKIND_MSB 26 -#define TXPC_MISC_PWDCLKIND_LSB 26 -#define TXPC_MISC_PWDCLKIND_MASK 0x04000000 -#define TXPC_MISC_PWDCLKIND_GET(x) (((x) & TXPC_MISC_PWDCLKIND_MASK) >> TXPC_MISC_PWDCLKIND_LSB) -#define TXPC_MISC_PWDCLKIND_SET(x) (((x) << TXPC_MISC_PWDCLKIND_LSB) & TXPC_MISC_PWDCLKIND_MASK) -#define TXPC_MISC_PWDXINPAD_MSB 25 -#define TXPC_MISC_PWDXINPAD_LSB 25 -#define TXPC_MISC_PWDXINPAD_MASK 0x02000000 -#define TXPC_MISC_PWDXINPAD_GET(x) (((x) & TXPC_MISC_PWDXINPAD_MASK) >> TXPC_MISC_PWDXINPAD_LSB) -#define TXPC_MISC_PWDXINPAD_SET(x) (((x) << TXPC_MISC_PWDXINPAD_LSB) & TXPC_MISC_PWDXINPAD_MASK) -#define TXPC_MISC_LOCALBIAS_MSB 24 -#define TXPC_MISC_LOCALBIAS_LSB 24 -#define TXPC_MISC_LOCALBIAS_MASK 0x01000000 -#define TXPC_MISC_LOCALBIAS_GET(x) (((x) & TXPC_MISC_LOCALBIAS_MASK) >> TXPC_MISC_LOCALBIAS_LSB) -#define TXPC_MISC_LOCALBIAS_SET(x) (((x) << TXPC_MISC_LOCALBIAS_LSB) & TXPC_MISC_LOCALBIAS_MASK) -#define TXPC_MISC_LOCALBIAS2X_MSB 23 -#define TXPC_MISC_LOCALBIAS2X_LSB 23 -#define TXPC_MISC_LOCALBIAS2X_MASK 0x00800000 -#define TXPC_MISC_LOCALBIAS2X_GET(x) (((x) & TXPC_MISC_LOCALBIAS2X_MASK) >> TXPC_MISC_LOCALBIAS2X_LSB) -#define TXPC_MISC_LOCALBIAS2X_SET(x) (((x) << TXPC_MISC_LOCALBIAS2X_LSB) & TXPC_MISC_LOCALBIAS2X_MASK) -#define TXPC_MISC_SELTSP_MSB 22 -#define TXPC_MISC_SELTSP_LSB 22 -#define TXPC_MISC_SELTSP_MASK 0x00400000 -#define TXPC_MISC_SELTSP_GET(x) (((x) & TXPC_MISC_SELTSP_MASK) >> TXPC_MISC_SELTSP_LSB) -#define TXPC_MISC_SELTSP_SET(x) (((x) << TXPC_MISC_SELTSP_LSB) & TXPC_MISC_SELTSP_MASK) -#define TXPC_MISC_SELTSN_MSB 21 -#define TXPC_MISC_SELTSN_LSB 21 -#define TXPC_MISC_SELTSN_MASK 0x00200000 -#define TXPC_MISC_SELTSN_GET(x) (((x) & TXPC_MISC_SELTSN_MASK) >> TXPC_MISC_SELTSN_LSB) -#define TXPC_MISC_SELTSN_SET(x) (((x) << TXPC_MISC_SELTSN_LSB) & TXPC_MISC_SELTSN_MASK) -#define TXPC_MISC_SPARE_A_MSB 20 -#define TXPC_MISC_SPARE_A_LSB 18 -#define TXPC_MISC_SPARE_A_MASK 0x001c0000 -#define TXPC_MISC_SPARE_A_GET(x) (((x) & TXPC_MISC_SPARE_A_MASK) >> TXPC_MISC_SPARE_A_LSB) -#define TXPC_MISC_SPARE_A_SET(x) (((x) << TXPC_MISC_SPARE_A_LSB) & TXPC_MISC_SPARE_A_MASK) -#define TXPC_MISC_DECOUT_MSB 17 -#define TXPC_MISC_DECOUT_LSB 8 -#define TXPC_MISC_DECOUT_MASK 0x0003ff00 -#define TXPC_MISC_DECOUT_GET(x) (((x) & TXPC_MISC_DECOUT_MASK) >> TXPC_MISC_DECOUT_LSB) -#define TXPC_MISC_DECOUT_SET(x) (((x) << TXPC_MISC_DECOUT_LSB) & TXPC_MISC_DECOUT_MASK) -#define TXPC_MISC_XTALDIV_MSB 7 -#define TXPC_MISC_XTALDIV_LSB 6 -#define TXPC_MISC_XTALDIV_MASK 0x000000c0 -#define TXPC_MISC_XTALDIV_GET(x) (((x) & TXPC_MISC_XTALDIV_MASK) >> TXPC_MISC_XTALDIV_LSB) -#define TXPC_MISC_XTALDIV_SET(x) (((x) << TXPC_MISC_XTALDIV_LSB) & TXPC_MISC_XTALDIV_MASK) -#define TXPC_MISC_SPARE_MSB 5 -#define TXPC_MISC_SPARE_LSB 0 -#define TXPC_MISC_SPARE_MASK 0x0000003f -#define TXPC_MISC_SPARE_GET(x) (((x) & TXPC_MISC_SPARE_MASK) >> TXPC_MISC_SPARE_LSB) -#define TXPC_MISC_SPARE_SET(x) (((x) << TXPC_MISC_SPARE_LSB) & TXPC_MISC_SPARE_MASK) - -#define RXTXBB_RXTXBB1_ADDRESS 0x00000050 -#define RXTXBB_RXTXBB1_OFFSET 0x00000050 -#define RXTXBB_RXTXBB1_SPARE_MSB 31 -#define RXTXBB_RXTXBB1_SPARE_LSB 19 -#define RXTXBB_RXTXBB1_SPARE_MASK 0xfff80000 -#define RXTXBB_RXTXBB1_SPARE_GET(x) (((x) & RXTXBB_RXTXBB1_SPARE_MASK) >> RXTXBB_RXTXBB1_SPARE_LSB) -#define RXTXBB_RXTXBB1_SPARE_SET(x) (((x) << RXTXBB_RXTXBB1_SPARE_LSB) & RXTXBB_RXTXBB1_SPARE_MASK) -#define RXTXBB_RXTXBB1_FNOTCH_MSB 18 -#define RXTXBB_RXTXBB1_FNOTCH_LSB 17 -#define RXTXBB_RXTXBB1_FNOTCH_MASK 0x00060000 -#define RXTXBB_RXTXBB1_FNOTCH_GET(x) (((x) & RXTXBB_RXTXBB1_FNOTCH_MASK) >> RXTXBB_RXTXBB1_FNOTCH_LSB) -#define RXTXBB_RXTXBB1_FNOTCH_SET(x) (((x) << RXTXBB_RXTXBB1_FNOTCH_LSB) & RXTXBB_RXTXBB1_FNOTCH_MASK) -#define RXTXBB_RXTXBB1_SEL_ATB_MSB 16 -#define RXTXBB_RXTXBB1_SEL_ATB_LSB 9 -#define RXTXBB_RXTXBB1_SEL_ATB_MASK 0x0001fe00 -#define RXTXBB_RXTXBB1_SEL_ATB_GET(x) (((x) & RXTXBB_RXTXBB1_SEL_ATB_MASK) >> RXTXBB_RXTXBB1_SEL_ATB_LSB) -#define RXTXBB_RXTXBB1_SEL_ATB_SET(x) (((x) << RXTXBB_RXTXBB1_SEL_ATB_LSB) & RXTXBB_RXTXBB1_SEL_ATB_MASK) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_LSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MASK 0x00000100 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_GET(x) (((x) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) >> RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_SET(x) (((x) << RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) -#define RXTXBB_RXTXBB1_PDV2I_MSB 7 -#define RXTXBB_RXTXBB1_PDV2I_LSB 7 -#define RXTXBB_RXTXBB1_PDV2I_MASK 0x00000080 -#define RXTXBB_RXTXBB1_PDV2I_GET(x) (((x) & RXTXBB_RXTXBB1_PDV2I_MASK) >> RXTXBB_RXTXBB1_PDV2I_LSB) -#define RXTXBB_RXTXBB1_PDV2I_SET(x) (((x) << RXTXBB_RXTXBB1_PDV2I_LSB) & RXTXBB_RXTXBB1_PDV2I_MASK) -#define RXTXBB_RXTXBB1_PDI2V_MSB 6 -#define RXTXBB_RXTXBB1_PDI2V_LSB 6 -#define RXTXBB_RXTXBB1_PDI2V_MASK 0x00000040 -#define RXTXBB_RXTXBB1_PDI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDI2V_MASK) >> RXTXBB_RXTXBB1_PDI2V_LSB) -#define RXTXBB_RXTXBB1_PDI2V_SET(x) (((x) << RXTXBB_RXTXBB1_PDI2V_LSB) & RXTXBB_RXTXBB1_PDI2V_MASK) -#define RXTXBB_RXTXBB1_PDRXTXBB_MSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_LSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_MASK 0x00000020 -#define RXTXBB_RXTXBB1_PDRXTXBB_GET(x) (((x) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) >> RXTXBB_RXTXBB1_PDRXTXBB_LSB) -#define RXTXBB_RXTXBB1_PDRXTXBB_SET(x) (((x) << RXTXBB_RXTXBB1_PDRXTXBB_LSB) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK 0x00000010 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK 0x00000008 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_LSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MASK 0x00000004 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) >> RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_SET(x) (((x) << RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) -#define RXTXBB_RXTXBB1_PDLOQ_MSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_LSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_MASK 0x00000002 -#define RXTXBB_RXTXBB1_PDLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDLOQ_MASK) >> RXTXBB_RXTXBB1_PDLOQ_LSB) -#define RXTXBB_RXTXBB1_PDLOQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDLOQ_LSB) & RXTXBB_RXTXBB1_PDLOQ_MASK) -#define RXTXBB_RXTXBB1_PDHIQ_MSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_LSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_MASK 0x00000001 -#define RXTXBB_RXTXBB1_PDHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDHIQ_MASK) >> RXTXBB_RXTXBB1_PDHIQ_LSB) -#define RXTXBB_RXTXBB1_PDHIQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDHIQ_LSB) & RXTXBB_RXTXBB1_PDHIQ_MASK) - -#define RXTXBB_RXTXBB2_ADDRESS 0x00000054 -#define RXTXBB_RXTXBB2_OFFSET 0x00000054 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MSB 31 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB 29 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK 0xe0000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_SET(x) (((x) << RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MSB 28 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB 26 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK 0x1c000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_SET(x) (((x) << RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MSB 25 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB 23 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK 0x03800000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_SET(x) (((x) << RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) -#define RXTXBB_RXTXBB2_SPARE_MSB 22 -#define RXTXBB_RXTXBB2_SPARE_LSB 21 -#define RXTXBB_RXTXBB2_SPARE_MASK 0x00600000 -#define RXTXBB_RXTXBB2_SPARE_GET(x) (((x) & RXTXBB_RXTXBB2_SPARE_MASK) >> RXTXBB_RXTXBB2_SPARE_LSB) -#define RXTXBB_RXTXBB2_SPARE_SET(x) (((x) << RXTXBB_RXTXBB2_SPARE_LSB) & RXTXBB_RXTXBB2_SPARE_MASK) -#define RXTXBB_RXTXBB2_SHORTBUFFER_MSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_LSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_MASK 0x00100000 -#define RXTXBB_RXTXBB2_SHORTBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) >> RXTXBB_RXTXBB2_SHORTBUFFER_LSB) -#define RXTXBB_RXTXBB2_SHORTBUFFER_SET(x) (((x) << RXTXBB_RXTXBB2_SHORTBUFFER_LSB) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) -#define RXTXBB_RXTXBB2_SELBUFFER_MSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_LSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_MASK 0x00080000 -#define RXTXBB_RXTXBB2_SELBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SELBUFFER_MASK) >> RXTXBB_RXTXBB2_SELBUFFER_LSB) -#define RXTXBB_RXTXBB2_SELBUFFER_SET(x) (((x) << RXTXBB_RXTXBB2_SELBUFFER_LSB) & RXTXBB_RXTXBB2_SELBUFFER_MASK) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK 0x00040000 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK 0x00020000 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK 0x00010000 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK 0x00008000 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) -#define RXTXBB_RXTXBB2_CMSEL_MSB 14 -#define RXTXBB_RXTXBB2_CMSEL_LSB 13 -#define RXTXBB_RXTXBB2_CMSEL_MASK 0x00006000 -#define RXTXBB_RXTXBB2_CMSEL_GET(x) (((x) & RXTXBB_RXTXBB2_CMSEL_MASK) >> RXTXBB_RXTXBB2_CMSEL_LSB) -#define RXTXBB_RXTXBB2_CMSEL_SET(x) (((x) << RXTXBB_RXTXBB2_CMSEL_LSB) & RXTXBB_RXTXBB2_CMSEL_MASK) -#define RXTXBB_RXTXBB2_FILTERFC_MSB 12 -#define RXTXBB_RXTXBB2_FILTERFC_LSB 8 -#define RXTXBB_RXTXBB2_FILTERFC_MASK 0x00001f00 -#define RXTXBB_RXTXBB2_FILTERFC_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERFC_MASK) >> RXTXBB_RXTXBB2_FILTERFC_LSB) -#define RXTXBB_RXTXBB2_FILTERFC_SET(x) (((x) << RXTXBB_RXTXBB2_FILTERFC_LSB) & RXTXBB_RXTXBB2_FILTERFC_MASK) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK 0x00000080 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_GET(x) (((x) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) >> RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_SET(x) (((x) << RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK 0x00000040 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) >> RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_SET(x) (((x) << RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK 0x00000020 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK 0x00000010 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK 0x00000008 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK 0x00000004 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK 0x00000002 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK 0x00000001 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_GET(x) (((x) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) >> RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_SET(x) (((x) << RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) - -#define RXTXBB_RXTXBB3_ADDRESS 0x00000058 -#define RXTXBB_RXTXBB3_OFFSET 0x00000058 -#define RXTXBB_RXTXBB3_SPARE_MSB 31 -#define RXTXBB_RXTXBB3_SPARE_LSB 27 -#define RXTXBB_RXTXBB3_SPARE_MASK 0xf8000000 -#define RXTXBB_RXTXBB3_SPARE_GET(x) (((x) & RXTXBB_RXTXBB3_SPARE_MASK) >> RXTXBB_RXTXBB3_SPARE_LSB) -#define RXTXBB_RXTXBB3_SPARE_SET(x) (((x) << RXTXBB_RXTXBB3_SPARE_LSB) & RXTXBB_RXTXBB3_SPARE_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MSB 26 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB 24 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK 0x07000000 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MSB 23 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB 21 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK 0x00e00000 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MSB 20 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB 18 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK 0x001c0000 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MSB 17 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB 15 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK 0x00038000 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MSB 14 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB 12 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK 0x00007000 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MSB 11 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB 9 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK 0x00000e00 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MSB 8 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB 6 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK 0x000001c0 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MSB 5 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB 3 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK 0x00000038 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) >> RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MSB 2 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB 0 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK 0x00000007 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) - -#define RXTXBB_RXTXBB4_ADDRESS 0x0000005c -#define RXTXBB_RXTXBB4_OFFSET 0x0000005c -#define RXTXBB_RXTXBB4_SPARE_MSB 31 -#define RXTXBB_RXTXBB4_SPARE_LSB 31 -#define RXTXBB_RXTXBB4_SPARE_MASK 0x80000000 -#define RXTXBB_RXTXBB4_SPARE_GET(x) (((x) & RXTXBB_RXTXBB4_SPARE_MASK) >> RXTXBB_RXTXBB4_SPARE_LSB) -#define RXTXBB_RXTXBB4_SPARE_SET(x) (((x) << RXTXBB_RXTXBB4_SPARE_LSB) & RXTXBB_RXTXBB4_SPARE_MASK) -#define RXTXBB_RXTXBB4_LOCALOFFSET_MSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_LSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_MASK 0x40000000 -#define RXTXBB_RXTXBB4_LOCALOFFSET_GET(x) (((x) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) >> RXTXBB_RXTXBB4_LOCALOFFSET_LSB) -#define RXTXBB_RXTXBB4_LOCALOFFSET_SET(x) (((x) << RXTXBB_RXTXBB4_LOCALOFFSET_LSB) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHII_MSB 29 -#define RXTXBB_RXTXBB4_OFSTCORRHII_LSB 25 -#define RXTXBB_RXTXBB4_OFSTCORRHII_MASK 0x3e000000 -#define RXTXBB_RXTXBB4_OFSTCORRHII_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHII_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHII_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRHII_LSB) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MSB 24 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB 20 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK 0x01f00000 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MSB 19 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_LSB 15 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MASK 0x000f8000 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MSB 14 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB 10 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK 0x00007c00 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MSB 9 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB 5 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK 0x000003e0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MSB 4 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB 0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK 0x0000001f -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) - -#define ADDAC_ADDAC1_ADDRESS 0x00000060 -#define ADDAC_ADDAC1_OFFSET 0x00000060 -#define ADDAC_ADDAC1_PLL_SVREG_MSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_LSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_MASK 0x80000000 -#define ADDAC_ADDAC1_PLL_SVREG_GET(x) (((x) & ADDAC_ADDAC1_PLL_SVREG_MASK) >> ADDAC_ADDAC1_PLL_SVREG_LSB) -#define ADDAC_ADDAC1_PLL_SVREG_SET(x) (((x) << ADDAC_ADDAC1_PLL_SVREG_LSB) & ADDAC_ADDAC1_PLL_SVREG_MASK) -#define ADDAC_ADDAC1_PLL_SCLAMP_MSB 30 -#define ADDAC_ADDAC1_PLL_SCLAMP_LSB 28 -#define ADDAC_ADDAC1_PLL_SCLAMP_MASK 0x70000000 -#define ADDAC_ADDAC1_PLL_SCLAMP_GET(x) (((x) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) >> ADDAC_ADDAC1_PLL_SCLAMP_LSB) -#define ADDAC_ADDAC1_PLL_SCLAMP_SET(x) (((x) << ADDAC_ADDAC1_PLL_SCLAMP_LSB) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) -#define ADDAC_ADDAC1_PLL_ATB_MSB 27 -#define ADDAC_ADDAC1_PLL_ATB_LSB 26 -#define ADDAC_ADDAC1_PLL_ATB_MASK 0x0c000000 -#define ADDAC_ADDAC1_PLL_ATB_GET(x) (((x) & ADDAC_ADDAC1_PLL_ATB_MASK) >> ADDAC_ADDAC1_PLL_ATB_LSB) -#define ADDAC_ADDAC1_PLL_ATB_SET(x) (((x) << ADDAC_ADDAC1_PLL_ATB_LSB) & ADDAC_ADDAC1_PLL_ATB_MASK) -#define ADDAC_ADDAC1_PLL_ICP_MSB 25 -#define ADDAC_ADDAC1_PLL_ICP_LSB 23 -#define ADDAC_ADDAC1_PLL_ICP_MASK 0x03800000 -#define ADDAC_ADDAC1_PLL_ICP_GET(x) (((x) & ADDAC_ADDAC1_PLL_ICP_MASK) >> ADDAC_ADDAC1_PLL_ICP_LSB) -#define ADDAC_ADDAC1_PLL_ICP_SET(x) (((x) << ADDAC_ADDAC1_PLL_ICP_LSB) & ADDAC_ADDAC1_PLL_ICP_MASK) -#define ADDAC_ADDAC1_PLL_FILTER_MSB 22 -#define ADDAC_ADDAC1_PLL_FILTER_LSB 15 -#define ADDAC_ADDAC1_PLL_FILTER_MASK 0x007f8000 -#define ADDAC_ADDAC1_PLL_FILTER_GET(x) (((x) & ADDAC_ADDAC1_PLL_FILTER_MASK) >> ADDAC_ADDAC1_PLL_FILTER_LSB) -#define ADDAC_ADDAC1_PLL_FILTER_SET(x) (((x) << ADDAC_ADDAC1_PLL_FILTER_LSB) & ADDAC_ADDAC1_PLL_FILTER_MASK) -#define ADDAC_ADDAC1_PWDPLL_MSB 14 -#define ADDAC_ADDAC1_PWDPLL_LSB 14 -#define ADDAC_ADDAC1_PWDPLL_MASK 0x00004000 -#define ADDAC_ADDAC1_PWDPLL_GET(x) (((x) & ADDAC_ADDAC1_PWDPLL_MASK) >> ADDAC_ADDAC1_PWDPLL_LSB) -#define ADDAC_ADDAC1_PWDPLL_SET(x) (((x) << ADDAC_ADDAC1_PWDPLL_LSB) & ADDAC_ADDAC1_PWDPLL_MASK) -#define ADDAC_ADDAC1_PWDADC_MSB 13 -#define ADDAC_ADDAC1_PWDADC_LSB 13 -#define ADDAC_ADDAC1_PWDADC_MASK 0x00002000 -#define ADDAC_ADDAC1_PWDADC_GET(x) (((x) & ADDAC_ADDAC1_PWDADC_MASK) >> ADDAC_ADDAC1_PWDADC_LSB) -#define ADDAC_ADDAC1_PWDADC_SET(x) (((x) << ADDAC_ADDAC1_PWDADC_LSB) & ADDAC_ADDAC1_PWDADC_MASK) -#define ADDAC_ADDAC1_PWDDAC_MSB 12 -#define ADDAC_ADDAC1_PWDDAC_LSB 12 -#define ADDAC_ADDAC1_PWDDAC_MASK 0x00001000 -#define ADDAC_ADDAC1_PWDDAC_GET(x) (((x) & ADDAC_ADDAC1_PWDDAC_MASK) >> ADDAC_ADDAC1_PWDDAC_LSB) -#define ADDAC_ADDAC1_PWDDAC_SET(x) (((x) << ADDAC_ADDAC1_PWDDAC_LSB) & ADDAC_ADDAC1_PWDDAC_MASK) -#define ADDAC_ADDAC1_FORCEMSBLOW_MSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_LSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_MASK 0x00000800 -#define ADDAC_ADDAC1_FORCEMSBLOW_GET(x) (((x) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) >> ADDAC_ADDAC1_FORCEMSBLOW_LSB) -#define ADDAC_ADDAC1_FORCEMSBLOW_SET(x) (((x) << ADDAC_ADDAC1_FORCEMSBLOW_LSB) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) -#define ADDAC_ADDAC1_SELMANPWDS_MSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_LSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_MASK 0x00000400 -#define ADDAC_ADDAC1_SELMANPWDS_GET(x) (((x) & ADDAC_ADDAC1_SELMANPWDS_MASK) >> ADDAC_ADDAC1_SELMANPWDS_LSB) -#define ADDAC_ADDAC1_SELMANPWDS_SET(x) (((x) << ADDAC_ADDAC1_SELMANPWDS_LSB) & ADDAC_ADDAC1_SELMANPWDS_MASK) -#define ADDAC_ADDAC1_INV_CLK160_ADC_MSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_LSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_MASK 0x00000200 -#define ADDAC_ADDAC1_INV_CLK160_ADC_GET(x) (((x) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) >> ADDAC_ADDAC1_INV_CLK160_ADC_LSB) -#define ADDAC_ADDAC1_INV_CLK160_ADC_SET(x) (((x) << ADDAC_ADDAC1_INV_CLK160_ADC_LSB) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) -#define ADDAC_ADDAC1_CM_SEL_MSB 8 -#define ADDAC_ADDAC1_CM_SEL_LSB 7 -#define ADDAC_ADDAC1_CM_SEL_MASK 0x00000180 -#define ADDAC_ADDAC1_CM_SEL_GET(x) (((x) & ADDAC_ADDAC1_CM_SEL_MASK) >> ADDAC_ADDAC1_CM_SEL_LSB) -#define ADDAC_ADDAC1_CM_SEL_SET(x) (((x) << ADDAC_ADDAC1_CM_SEL_LSB) & ADDAC_ADDAC1_CM_SEL_MASK) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_LSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MASK 0x00000040 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_GET(x) (((x) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) >> ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_SET(x) (((x) << ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) -#define ADDAC_ADDAC1_SPARE_MSB 5 -#define ADDAC_ADDAC1_SPARE_LSB 0 -#define ADDAC_ADDAC1_SPARE_MASK 0x0000003f -#define ADDAC_ADDAC1_SPARE_GET(x) (((x) & ADDAC_ADDAC1_SPARE_MASK) >> ADDAC_ADDAC1_SPARE_LSB) -#define ADDAC_ADDAC1_SPARE_SET(x) (((x) << ADDAC_ADDAC1_SPARE_LSB) & ADDAC_ADDAC1_SPARE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct analog_reg_reg_s { - volatile unsigned int synth_synth1; - volatile unsigned int synth_synth2; - volatile unsigned int synth_synth3; - volatile unsigned int synth_synth4; - volatile unsigned int synth_synth5; - volatile unsigned int synth_synth6; - volatile unsigned int synth_synth7; - volatile unsigned int synth_synth8; - volatile unsigned int rf5g_rf5g1; - volatile unsigned int rf5g_rf5g2; - volatile unsigned int rf2g_rf2g1; - volatile unsigned int rf2g_rf2g2; - volatile unsigned int top_gain; - volatile unsigned int top_top; - volatile unsigned int bias_bias_sel; - volatile unsigned int bias_bias1; - volatile unsigned int bias_bias2; - volatile unsigned int bias_bias3; - volatile unsigned int txpc_txpc; - volatile unsigned int txpc_misc; - volatile unsigned int rxtxbb_rxtxbb1; - volatile unsigned int rxtxbb_rxtxbb2; - volatile unsigned int rxtxbb_rxtxbb3; - volatile unsigned int rxtxbb_rxtxbb4; - volatile unsigned int addac_addac1; -} analog_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _ANALOG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/analog_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/analog_reg.vrh deleted file mode 100644 index 9fd2269c3b6a..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/analog_reg.vrh +++ /dev/null @@ -1,3084 +0,0 @@ -#ifndef _ANALOG_REG_VRH_ -#define _ANALOG_REG_VRH_ - -#define SYNTH_SYNTH1_ADDRESS 'h00000000 -#define SYNTH_SYNTH1_PWD_BIAS_MSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_LSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_MASK 'h80000000 -#define SYNTH_SYNTH1_PWD_BIAS_GET(x) (((x) & SYNTH_SYNTH1_PWD_BIAS_MASK) >> SYNTH_SYNTH1_PWD_BIAS_LSB) -#define SYNTH_SYNTH1_PWD_BIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_BIAS_LSB) & SYNTH_SYNTH1_PWD_BIAS_MASK) -#define SYNTH_SYNTH1_PWD_BIAS_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_CP_MSB 30 -#define SYNTH_SYNTH1_PWD_CP_LSB 30 -#define SYNTH_SYNTH1_PWD_CP_MASK 'h40000000 -#define SYNTH_SYNTH1_PWD_CP_GET(x) (((x) & SYNTH_SYNTH1_PWD_CP_MASK) >> SYNTH_SYNTH1_PWD_CP_LSB) -#define SYNTH_SYNTH1_PWD_CP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_CP_LSB) & SYNTH_SYNTH1_PWD_CP_MASK) -#define SYNTH_SYNTH1_PWD_CP_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_VCMON_MSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_LSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_MASK 'h20000000 -#define SYNTH_SYNTH1_PWD_VCMON_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCMON_MASK) >> SYNTH_SYNTH1_PWD_VCMON_LSB) -#define SYNTH_SYNTH1_PWD_VCMON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_VCMON_LSB) & SYNTH_SYNTH1_PWD_VCMON_MASK) -#define SYNTH_SYNTH1_PWD_VCMON_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_VCO_MSB 28 -#define SYNTH_SYNTH1_PWD_VCO_LSB 28 -#define SYNTH_SYNTH1_PWD_VCO_MASK 'h10000000 -#define SYNTH_SYNTH1_PWD_VCO_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCO_MASK) >> SYNTH_SYNTH1_PWD_VCO_LSB) -#define SYNTH_SYNTH1_PWD_VCO_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_VCO_LSB) & SYNTH_SYNTH1_PWD_VCO_MASK) -#define SYNTH_SYNTH1_PWD_VCO_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_PRESC_MSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_LSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_MASK 'h08000000 -#define SYNTH_SYNTH1_PWD_PRESC_GET(x) (((x) & SYNTH_SYNTH1_PWD_PRESC_MASK) >> SYNTH_SYNTH1_PWD_PRESC_LSB) -#define SYNTH_SYNTH1_PWD_PRESC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_PRESC_LSB) & SYNTH_SYNTH1_PWD_PRESC_MASK) -#define SYNTH_SYNTH1_PWD_PRESC_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_LODIV_MSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_LSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_MASK 'h04000000 -#define SYNTH_SYNTH1_PWD_LODIV_GET(x) (((x) & SYNTH_SYNTH1_PWD_LODIV_MASK) >> SYNTH_SYNTH1_PWD_LODIV_LSB) -#define SYNTH_SYNTH1_PWD_LODIV_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_LODIV_LSB) & SYNTH_SYNTH1_PWD_LODIV_MASK) -#define SYNTH_SYNTH1_PWD_LODIV_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_LOMIX_MSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_LSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_MASK 'h02000000 -#define SYNTH_SYNTH1_PWD_LOMIX_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOMIX_MASK) >> SYNTH_SYNTH1_PWD_LOMIX_LSB) -#define SYNTH_SYNTH1_PWD_LOMIX_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_LOMIX_LSB) & SYNTH_SYNTH1_PWD_LOMIX_MASK) -#define SYNTH_SYNTH1_PWD_LOMIX_RESET 1'h0 -#define SYNTH_SYNTH1_FORCE_LO_ON_MSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_LSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_MASK 'h01000000 -#define SYNTH_SYNTH1_FORCE_LO_ON_GET(x) (((x) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) >> SYNTH_SYNTH1_FORCE_LO_ON_LSB) -#define SYNTH_SYNTH1_FORCE_LO_ON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_FORCE_LO_ON_LSB) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) -#define SYNTH_SYNTH1_FORCE_LO_ON_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_LOBUF5G_MSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_LSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_MASK 'h00800000 -#define SYNTH_SYNTH1_PWD_LOBUF5G_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) >> SYNTH_SYNTH1_PWD_LOBUF5G_LSB) -#define SYNTH_SYNTH1_PWD_LOBUF5G_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_LOBUF5G_LSB) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) -#define SYNTH_SYNTH1_PWD_LOBUF5G_RESET 1'h0 -#define SYNTH_SYNTH1_VCOREGBYPASS_MSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_LSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_MASK 'h00400000 -#define SYNTH_SYNTH1_VCOREGBYPASS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) >> SYNTH_SYNTH1_VCOREGBYPASS_LSB) -#define SYNTH_SYNTH1_VCOREGBYPASS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_VCOREGBYPASS_LSB) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) -#define SYNTH_SYNTH1_VCOREGBYPASS_RESET 1'h1 -#define SYNTH_SYNTH1_VCOREGLEVEL_MSB 21 -#define SYNTH_SYNTH1_VCOREGLEVEL_LSB 20 -#define SYNTH_SYNTH1_VCOREGLEVEL_MASK 'h00300000 -#define SYNTH_SYNTH1_VCOREGLEVEL_GET(x) (((x) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) >> SYNTH_SYNTH1_VCOREGLEVEL_LSB) -#define SYNTH_SYNTH1_VCOREGLEVEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_VCOREGLEVEL_LSB) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) -#define SYNTH_SYNTH1_VCOREGLEVEL_RESET 2'h1 -#define SYNTH_SYNTH1_VCOREGBIAS_MSB 19 -#define SYNTH_SYNTH1_VCOREGBIAS_LSB 18 -#define SYNTH_SYNTH1_VCOREGBIAS_MASK 'h000c0000 -#define SYNTH_SYNTH1_VCOREGBIAS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBIAS_MASK) >> SYNTH_SYNTH1_VCOREGBIAS_LSB) -#define SYNTH_SYNTH1_VCOREGBIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_VCOREGBIAS_LSB) & SYNTH_SYNTH1_VCOREGBIAS_MASK) -#define SYNTH_SYNTH1_VCOREGBIAS_RESET 2'h1 -#define SYNTH_SYNTH1_SLIDINGIF_MSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_LSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_MASK 'h00020000 -#define SYNTH_SYNTH1_SLIDINGIF_GET(x) (((x) & SYNTH_SYNTH1_SLIDINGIF_MASK) >> SYNTH_SYNTH1_SLIDINGIF_LSB) -#define SYNTH_SYNTH1_SLIDINGIF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_SLIDINGIF_LSB) & SYNTH_SYNTH1_SLIDINGIF_MASK) -#define SYNTH_SYNTH1_SLIDINGIF_RESET 1'h0 -#define SYNTH_SYNTH1_SPARE_PWD_MSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_LSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_MASK 'h00010000 -#define SYNTH_SYNTH1_SPARE_PWD_GET(x) (((x) & SYNTH_SYNTH1_SPARE_PWD_MASK) >> SYNTH_SYNTH1_SPARE_PWD_LSB) -#define SYNTH_SYNTH1_SPARE_PWD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_SPARE_PWD_LSB) & SYNTH_SYNTH1_SPARE_PWD_MASK) -#define SYNTH_SYNTH1_SPARE_PWD_RESET 1'h0 -#define SYNTH_SYNTH1_CON_VDDVCOREG_MSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_LSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_MASK 'h00008000 -#define SYNTH_SYNTH1_CON_VDDVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) >> SYNTH_SYNTH1_CON_VDDVCOREG_LSB) -#define SYNTH_SYNTH1_CON_VDDVCOREG_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_CON_VDDVCOREG_LSB) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) -#define SYNTH_SYNTH1_CON_VDDVCOREG_RESET 1'h0 -#define SYNTH_SYNTH1_CON_IVCOREG_MSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_LSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_MASK 'h00004000 -#define SYNTH_SYNTH1_CON_IVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOREG_MASK) >> SYNTH_SYNTH1_CON_IVCOREG_LSB) -#define SYNTH_SYNTH1_CON_IVCOREG_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_CON_IVCOREG_LSB) & SYNTH_SYNTH1_CON_IVCOREG_MASK) -#define SYNTH_SYNTH1_CON_IVCOREG_RESET 1'h0 -#define SYNTH_SYNTH1_CON_IVCOBUF_MSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_LSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_MASK 'h00002000 -#define SYNTH_SYNTH1_CON_IVCOBUF_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) >> SYNTH_SYNTH1_CON_IVCOBUF_LSB) -#define SYNTH_SYNTH1_CON_IVCOBUF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_CON_IVCOBUF_LSB) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) -#define SYNTH_SYNTH1_CON_IVCOBUF_RESET 1'h0 -#define SYNTH_SYNTH1_SEL_VCMONABUS_MSB 12 -#define SYNTH_SYNTH1_SEL_VCMONABUS_LSB 10 -#define SYNTH_SYNTH1_SEL_VCMONABUS_MASK 'h00001c00 -#define SYNTH_SYNTH1_SEL_VCMONABUS_GET(x) (((x) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) >> SYNTH_SYNTH1_SEL_VCMONABUS_LSB) -#define SYNTH_SYNTH1_SEL_VCMONABUS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_SEL_VCMONABUS_LSB) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) -#define SYNTH_SYNTH1_SEL_VCMONABUS_RESET 3'h0 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK 'h00000200 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) >> SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_RESET 1'h0 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_LSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MASK 'h00000100 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) >> SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_RESET 1'h0 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK 'h00000080 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_RESET 1'h0 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK 'h00000040 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_FB_MSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_LSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_MASK 'h00000020 -#define SYNTH_SYNTH1_MONITOR_FB_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_MASK) >> SYNTH_SYNTH1_MONITOR_FB_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_FB_LSB) & SYNTH_SYNTH1_MONITOR_FB_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_REF_MSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_LSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_MASK 'h00000010 -#define SYNTH_SYNTH1_MONITOR_REF_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_REF_MASK) >> SYNTH_SYNTH1_MONITOR_REF_LSB) -#define SYNTH_SYNTH1_MONITOR_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_REF_LSB) & SYNTH_SYNTH1_MONITOR_REF_MASK) -#define SYNTH_SYNTH1_MONITOR_REF_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK 'h00000008 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) >> SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK 'h00000004 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) >> SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_LSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MASK 'h00000002 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) >> SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK 'h00000001 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) >> SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_RESET 1'h0 -#define SYNTH_SYNTH1_RESET (32'h0 | \ - SYNTH_SYNTH1_PWD_BIAS_SET(SYNTH_SYNTH1_PWD_BIAS_RESET) | \ - SYNTH_SYNTH1_PWD_CP_SET(SYNTH_SYNTH1_PWD_CP_RESET) | \ - SYNTH_SYNTH1_PWD_VCMON_SET(SYNTH_SYNTH1_PWD_VCMON_RESET) | \ - SYNTH_SYNTH1_PWD_VCO_SET(SYNTH_SYNTH1_PWD_VCO_RESET) | \ - SYNTH_SYNTH1_PWD_PRESC_SET(SYNTH_SYNTH1_PWD_PRESC_RESET) | \ - SYNTH_SYNTH1_PWD_LODIV_SET(SYNTH_SYNTH1_PWD_LODIV_RESET) | \ - SYNTH_SYNTH1_PWD_LOMIX_SET(SYNTH_SYNTH1_PWD_LOMIX_RESET) | \ - SYNTH_SYNTH1_FORCE_LO_ON_SET(SYNTH_SYNTH1_FORCE_LO_ON_RESET) | \ - SYNTH_SYNTH1_PWD_LOBUF5G_SET(SYNTH_SYNTH1_PWD_LOBUF5G_RESET) | \ - SYNTH_SYNTH1_VCOREGBYPASS_SET(SYNTH_SYNTH1_VCOREGBYPASS_RESET) | \ - SYNTH_SYNTH1_VCOREGLEVEL_SET(SYNTH_SYNTH1_VCOREGLEVEL_RESET) | \ - SYNTH_SYNTH1_VCOREGBIAS_SET(SYNTH_SYNTH1_VCOREGBIAS_RESET) | \ - SYNTH_SYNTH1_SLIDINGIF_SET(SYNTH_SYNTH1_SLIDINGIF_RESET) | \ - SYNTH_SYNTH1_SPARE_PWD_SET(SYNTH_SYNTH1_SPARE_PWD_RESET) | \ - SYNTH_SYNTH1_CON_VDDVCOREG_SET(SYNTH_SYNTH1_CON_VDDVCOREG_RESET) | \ - SYNTH_SYNTH1_CON_IVCOREG_SET(SYNTH_SYNTH1_CON_IVCOREG_RESET) | \ - SYNTH_SYNTH1_CON_IVCOBUF_SET(SYNTH_SYNTH1_CON_IVCOBUF_RESET) | \ - SYNTH_SYNTH1_SEL_VCMONABUS_SET(SYNTH_SYNTH1_SEL_VCMONABUS_RESET) | \ - SYNTH_SYNTH1_PWUP_VCOBUF_PD_SET(SYNTH_SYNTH1_PWUP_VCOBUF_PD_RESET) | \ - SYNTH_SYNTH1_PWUP_LODIV_PD_SET(SYNTH_SYNTH1_PWUP_LODIV_PD_RESET) | \ - SYNTH_SYNTH1_PWUP_LOMIX_PD_SET(SYNTH_SYNTH1_PWUP_LOMIX_PD_RESET) | \ - SYNTH_SYNTH1_PWUP_LOBUF5G_PD_SET(SYNTH_SYNTH1_PWUP_LOBUF5G_PD_RESET) | \ - SYNTH_SYNTH1_MONITOR_FB_SET(SYNTH_SYNTH1_MONITOR_FB_RESET) | \ - SYNTH_SYNTH1_MONITOR_REF_SET(SYNTH_SYNTH1_MONITOR_REF_RESET) | \ - SYNTH_SYNTH1_MONITOR_FB_DIV2_SET(SYNTH_SYNTH1_MONITOR_FB_DIV2_RESET) | \ - SYNTH_SYNTH1_MONITOR_VC2HIGH_SET(SYNTH_SYNTH1_MONITOR_VC2HIGH_RESET) | \ - SYNTH_SYNTH1_MONITOR_VC2LOW_SET(SYNTH_SYNTH1_MONITOR_VC2LOW_RESET) | \ - SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_RESET)) -#define SYNTH_SYNTH1_HW_MASK (32'h0) -#define SYNTH_SYNTH1_SW_MASK (32'h0 | \ - SYNTH_SYNTH1_PWD_BIAS_MASK | \ - SYNTH_SYNTH1_PWD_CP_MASK | \ - SYNTH_SYNTH1_PWD_VCMON_MASK | \ - SYNTH_SYNTH1_PWD_VCO_MASK | \ - SYNTH_SYNTH1_PWD_PRESC_MASK | \ - SYNTH_SYNTH1_PWD_LODIV_MASK | \ - SYNTH_SYNTH1_PWD_LOMIX_MASK | \ - SYNTH_SYNTH1_FORCE_LO_ON_MASK | \ - SYNTH_SYNTH1_PWD_LOBUF5G_MASK | \ - SYNTH_SYNTH1_VCOREGBYPASS_MASK | \ - SYNTH_SYNTH1_VCOREGLEVEL_MASK | \ - SYNTH_SYNTH1_VCOREGBIAS_MASK | \ - SYNTH_SYNTH1_SLIDINGIF_MASK | \ - SYNTH_SYNTH1_SPARE_PWD_MASK | \ - SYNTH_SYNTH1_CON_VDDVCOREG_MASK | \ - SYNTH_SYNTH1_CON_IVCOREG_MASK | \ - SYNTH_SYNTH1_CON_IVCOBUF_MASK | \ - SYNTH_SYNTH1_SEL_VCMONABUS_MASK | \ - SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK | \ - SYNTH_SYNTH1_PWUP_LODIV_PD_MASK | \ - SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK | \ - SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK | \ - SYNTH_SYNTH1_MONITOR_FB_MASK | \ - SYNTH_SYNTH1_MONITOR_REF_MASK | \ - SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK | \ - SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK | \ - SYNTH_SYNTH1_MONITOR_VC2LOW_MASK | \ - SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) - -#define SYNTH_SYNTH2_ADDRESS 'h00000004 -#define SYNTH_SYNTH2_VC_CAL_REF_MSB 31 -#define SYNTH_SYNTH2_VC_CAL_REF_LSB 29 -#define SYNTH_SYNTH2_VC_CAL_REF_MASK 'he0000000 -#define SYNTH_SYNTH2_VC_CAL_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_CAL_REF_MASK) >> SYNTH_SYNTH2_VC_CAL_REF_LSB) -#define SYNTH_SYNTH2_VC_CAL_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_CAL_REF_LSB) & SYNTH_SYNTH2_VC_CAL_REF_MASK) -#define SYNTH_SYNTH2_VC_CAL_REF_RESET 3'h0 -#define SYNTH_SYNTH2_VC_HI_REF_MSB 28 -#define SYNTH_SYNTH2_VC_HI_REF_LSB 26 -#define SYNTH_SYNTH2_VC_HI_REF_MASK 'h1c000000 -#define SYNTH_SYNTH2_VC_HI_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_HI_REF_MASK) >> SYNTH_SYNTH2_VC_HI_REF_LSB) -#define SYNTH_SYNTH2_VC_HI_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_HI_REF_LSB) & SYNTH_SYNTH2_VC_HI_REF_MASK) -#define SYNTH_SYNTH2_VC_HI_REF_RESET 3'h3 -#define SYNTH_SYNTH2_VC_MID_REF_MSB 25 -#define SYNTH_SYNTH2_VC_MID_REF_LSB 23 -#define SYNTH_SYNTH2_VC_MID_REF_MASK 'h03800000 -#define SYNTH_SYNTH2_VC_MID_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_MID_REF_MASK) >> SYNTH_SYNTH2_VC_MID_REF_LSB) -#define SYNTH_SYNTH2_VC_MID_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_MID_REF_LSB) & SYNTH_SYNTH2_VC_MID_REF_MASK) -#define SYNTH_SYNTH2_VC_MID_REF_RESET 3'h4 -#define SYNTH_SYNTH2_VC_LOW_REF_MSB 22 -#define SYNTH_SYNTH2_VC_LOW_REF_LSB 20 -#define SYNTH_SYNTH2_VC_LOW_REF_MASK 'h00700000 -#define SYNTH_SYNTH2_VC_LOW_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_LOW_REF_MASK) >> SYNTH_SYNTH2_VC_LOW_REF_LSB) -#define SYNTH_SYNTH2_VC_LOW_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_LOW_REF_LSB) & SYNTH_SYNTH2_VC_LOW_REF_MASK) -#define SYNTH_SYNTH2_VC_LOW_REF_RESET 3'h4 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MSB 19 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB 15 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK 'h000f8000 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_GET(x) (((x) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) >> SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_RESET 5'h8 -#define SYNTH_SYNTH2_LOOP_CP_MSB 14 -#define SYNTH_SYNTH2_LOOP_CP_LSB 10 -#define SYNTH_SYNTH2_LOOP_CP_MASK 'h00007c00 -#define SYNTH_SYNTH2_LOOP_CP_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CP_MASK) >> SYNTH_SYNTH2_LOOP_CP_LSB) -#define SYNTH_SYNTH2_LOOP_CP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_CP_LSB) & SYNTH_SYNTH2_LOOP_CP_MASK) -#define SYNTH_SYNTH2_LOOP_CP_RESET 5'h8 -#define SYNTH_SYNTH2_LOOP_RS_MSB 9 -#define SYNTH_SYNTH2_LOOP_RS_LSB 5 -#define SYNTH_SYNTH2_LOOP_RS_MASK 'h000003e0 -#define SYNTH_SYNTH2_LOOP_RS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_RS_MASK) >> SYNTH_SYNTH2_LOOP_RS_LSB) -#define SYNTH_SYNTH2_LOOP_RS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_RS_LSB) & SYNTH_SYNTH2_LOOP_RS_MASK) -#define SYNTH_SYNTH2_LOOP_RS_RESET 5'h5 -#define SYNTH_SYNTH2_LOOP_CS_MSB 4 -#define SYNTH_SYNTH2_LOOP_CS_LSB 3 -#define SYNTH_SYNTH2_LOOP_CS_MASK 'h00000018 -#define SYNTH_SYNTH2_LOOP_CS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CS_MASK) >> SYNTH_SYNTH2_LOOP_CS_LSB) -#define SYNTH_SYNTH2_LOOP_CS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_CS_LSB) & SYNTH_SYNTH2_LOOP_CS_MASK) -#define SYNTH_SYNTH2_LOOP_CS_RESET 2'h3 -#define SYNTH_SYNTH2_SPARE_BITS_MSB 2 -#define SYNTH_SYNTH2_SPARE_BITS_LSB 0 -#define SYNTH_SYNTH2_SPARE_BITS_MASK 'h00000007 -#define SYNTH_SYNTH2_SPARE_BITS_GET(x) (((x) & SYNTH_SYNTH2_SPARE_BITS_MASK) >> SYNTH_SYNTH2_SPARE_BITS_LSB) -#define SYNTH_SYNTH2_SPARE_BITS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_SPARE_BITS_LSB) & SYNTH_SYNTH2_SPARE_BITS_MASK) -#define SYNTH_SYNTH2_SPARE_BITS_RESET 3'h0 -#define SYNTH_SYNTH2_RESET (32'h0 | \ - SYNTH_SYNTH2_VC_CAL_REF_SET(SYNTH_SYNTH2_VC_CAL_REF_RESET) | \ - SYNTH_SYNTH2_VC_HI_REF_SET(SYNTH_SYNTH2_VC_HI_REF_RESET) | \ - SYNTH_SYNTH2_VC_MID_REF_SET(SYNTH_SYNTH2_VC_MID_REF_RESET) | \ - SYNTH_SYNTH2_VC_LOW_REF_SET(SYNTH_SYNTH2_VC_LOW_REF_RESET) | \ - SYNTH_SYNTH2_LOOP_3RD_ORDER_R_SET(SYNTH_SYNTH2_LOOP_3RD_ORDER_R_RESET) | \ - SYNTH_SYNTH2_LOOP_CP_SET(SYNTH_SYNTH2_LOOP_CP_RESET) | \ - SYNTH_SYNTH2_LOOP_RS_SET(SYNTH_SYNTH2_LOOP_RS_RESET) | \ - SYNTH_SYNTH2_LOOP_CS_SET(SYNTH_SYNTH2_LOOP_CS_RESET) | \ - SYNTH_SYNTH2_SPARE_BITS_SET(SYNTH_SYNTH2_SPARE_BITS_RESET)) -#define SYNTH_SYNTH2_HW_MASK (32'h0) -#define SYNTH_SYNTH2_SW_MASK (32'h0 | \ - SYNTH_SYNTH2_VC_CAL_REF_MASK | \ - SYNTH_SYNTH2_VC_HI_REF_MASK | \ - SYNTH_SYNTH2_VC_MID_REF_MASK | \ - SYNTH_SYNTH2_VC_LOW_REF_MASK | \ - SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK | \ - SYNTH_SYNTH2_LOOP_CP_MASK | \ - SYNTH_SYNTH2_LOOP_RS_MASK | \ - SYNTH_SYNTH2_LOOP_CS_MASK | \ - SYNTH_SYNTH2_SPARE_BITS_MASK) - -#define SYNTH_SYNTH3_ADDRESS 'h00000008 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_LSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MASK 'h80000000 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_GET(x) (((x) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) >> SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) -#define SYNTH_SYNTH3_DIS_CLK_XTAL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) -#define SYNTH_SYNTH3_DIS_CLK_XTAL_RESET 1'h0 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_LSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MASK 'h40000000 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_GET(x) (((x) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) >> SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_RESET 1'h1 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MSB 29 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB 24 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK 'h3f000000 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_RESET 6'h14 -#define SYNTH_SYNTH3_WAIT_PWRUP_MSB 23 -#define SYNTH_SYNTH3_WAIT_PWRUP_LSB 18 -#define SYNTH_SYNTH3_WAIT_PWRUP_MASK 'h00fc0000 -#define SYNTH_SYNTH3_WAIT_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_PWRUP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_PWRUP_RESET 6'h8 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MSB 17 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_LSB 12 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MASK 'h0003f000 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_RESET 6'h14 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MSB 11 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_LSB 6 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MASK 'h00000fc0 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_RESET 6'h14 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MSB 5 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_LSB 0 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MASK 'h0000003f -#define SYNTH_SYNTH3_WAIT_VC_CHECK_GET(x) (((x) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) >> SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_RESET 6'h14 -#define SYNTH_SYNTH3_RESET (32'h0 | \ - SYNTH_SYNTH3_DIS_CLK_XTAL_SET(SYNTH_SYNTH3_DIS_CLK_XTAL_RESET) | \ - SYNTH_SYNTH3_SEL_CLK_DIV2_SET(SYNTH_SYNTH3_SEL_CLK_DIV2_RESET) | \ - SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_SET(SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_RESET) | \ - SYNTH_SYNTH3_WAIT_PWRUP_SET(SYNTH_SYNTH3_WAIT_PWRUP_RESET) | \ - SYNTH_SYNTH3_WAIT_CAL_BIN_SET(SYNTH_SYNTH3_WAIT_CAL_BIN_RESET) | \ - SYNTH_SYNTH3_WAIT_CAL_LIN_SET(SYNTH_SYNTH3_WAIT_CAL_LIN_RESET) | \ - SYNTH_SYNTH3_WAIT_VC_CHECK_SET(SYNTH_SYNTH3_WAIT_VC_CHECK_RESET)) -#define SYNTH_SYNTH3_HW_MASK (32'h0) -#define SYNTH_SYNTH3_SW_MASK (32'h0 | \ - SYNTH_SYNTH3_DIS_CLK_XTAL_MASK | \ - SYNTH_SYNTH3_SEL_CLK_DIV2_MASK | \ - SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK | \ - SYNTH_SYNTH3_WAIT_PWRUP_MASK | \ - SYNTH_SYNTH3_WAIT_CAL_BIN_MASK | \ - SYNTH_SYNTH3_WAIT_CAL_LIN_MASK | \ - SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) - -#define SYNTH_SYNTH4_ADDRESS 'h0000000c -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK 'h80000000 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_GET(x) (((x) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) >> SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_RESET 1'h0 -#define SYNTH_SYNTH4_DIS_LOSTVC_MSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_LSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_MASK 'h40000000 -#define SYNTH_SYNTH4_DIS_LOSTVC_GET(x) (((x) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) >> SYNTH_SYNTH4_DIS_LOSTVC_LSB) -#define SYNTH_SYNTH4_DIS_LOSTVC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_DIS_LOSTVC_LSB) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) -#define SYNTH_SYNTH4_DIS_LOSTVC_RESET 1'h0 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_LSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MASK 'h20000000 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_GET(x) (((x) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) >> SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_RESET 1'h0 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK 'h10000000 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_GET(x) (((x) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) >> SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_RESET 1'h1 -#define SYNTH_SYNTH4_FORCE_PINVC_MSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_LSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_MASK 'h08000000 -#define SYNTH_SYNTH4_FORCE_PINVC_GET(x) (((x) & SYNTH_SYNTH4_FORCE_PINVC_MASK) >> SYNTH_SYNTH4_FORCE_PINVC_LSB) -#define SYNTH_SYNTH4_FORCE_PINVC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_FORCE_PINVC_LSB) & SYNTH_SYNTH4_FORCE_PINVC_MASK) -#define SYNTH_SYNTH4_FORCE_PINVC_RESET 1'h0 -#define SYNTH_SYNTH4_FORCE_VCOCAP_MSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_LSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_MASK 'h04000000 -#define SYNTH_SYNTH4_FORCE_VCOCAP_GET(x) (((x) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) >> SYNTH_SYNTH4_FORCE_VCOCAP_LSB) -#define SYNTH_SYNTH4_FORCE_VCOCAP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_FORCE_VCOCAP_LSB) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) -#define SYNTH_SYNTH4_FORCE_VCOCAP_RESET 1'h0 -#define SYNTH_SYNTH4_VCOCAP_OVR_MSB 25 -#define SYNTH_SYNTH4_VCOCAP_OVR_LSB 18 -#define SYNTH_SYNTH4_VCOCAP_OVR_MASK 'h03fc0000 -#define SYNTH_SYNTH4_VCOCAP_OVR_GET(x) (((x) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) >> SYNTH_SYNTH4_VCOCAP_OVR_LSB) -#define SYNTH_SYNTH4_VCOCAP_OVR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_VCOCAP_OVR_LSB) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) -#define SYNTH_SYNTH4_VCOCAP_OVR_RESET 8'h80 -#define SYNTH_SYNTH4_VCOCAPPULLUP_MSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_LSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_MASK 'h00020000 -#define SYNTH_SYNTH4_VCOCAPPULLUP_GET(x) (((x) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) >> SYNTH_SYNTH4_VCOCAPPULLUP_LSB) -#define SYNTH_SYNTH4_VCOCAPPULLUP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_VCOCAPPULLUP_LSB) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) -#define SYNTH_SYNTH4_VCOCAPPULLUP_RESET 1'h1 -#define SYNTH_SYNTH4_REFDIVSEL_MSB 16 -#define SYNTH_SYNTH4_REFDIVSEL_LSB 15 -#define SYNTH_SYNTH4_REFDIVSEL_MASK 'h00018000 -#define SYNTH_SYNTH4_REFDIVSEL_GET(x) (((x) & SYNTH_SYNTH4_REFDIVSEL_MASK) >> SYNTH_SYNTH4_REFDIVSEL_LSB) -#define SYNTH_SYNTH4_REFDIVSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_REFDIVSEL_LSB) & SYNTH_SYNTH4_REFDIVSEL_MASK) -#define SYNTH_SYNTH4_REFDIVSEL_RESET 2'h0 -#define SYNTH_SYNTH4_PFDDELAY_MSB 14 -#define SYNTH_SYNTH4_PFDDELAY_LSB 14 -#define SYNTH_SYNTH4_PFDDELAY_MASK 'h00004000 -#define SYNTH_SYNTH4_PFDDELAY_GET(x) (((x) & SYNTH_SYNTH4_PFDDELAY_MASK) >> SYNTH_SYNTH4_PFDDELAY_LSB) -#define SYNTH_SYNTH4_PFDDELAY_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PFDDELAY_LSB) & SYNTH_SYNTH4_PFDDELAY_MASK) -#define SYNTH_SYNTH4_PFDDELAY_RESET 1'h1 -#define SYNTH_SYNTH4_PFD_DISABLE_MSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_LSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_MASK 'h00002000 -#define SYNTH_SYNTH4_PFD_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_PFD_DISABLE_MASK) >> SYNTH_SYNTH4_PFD_DISABLE_LSB) -#define SYNTH_SYNTH4_PFD_DISABLE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PFD_DISABLE_LSB) & SYNTH_SYNTH4_PFD_DISABLE_MASK) -#define SYNTH_SYNTH4_PFD_DISABLE_RESET 1'h0 -#define SYNTH_SYNTH4_PRESCSEL_MSB 12 -#define SYNTH_SYNTH4_PRESCSEL_LSB 11 -#define SYNTH_SYNTH4_PRESCSEL_MASK 'h00001800 -#define SYNTH_SYNTH4_PRESCSEL_GET(x) (((x) & SYNTH_SYNTH4_PRESCSEL_MASK) >> SYNTH_SYNTH4_PRESCSEL_LSB) -#define SYNTH_SYNTH4_PRESCSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PRESCSEL_LSB) & SYNTH_SYNTH4_PRESCSEL_MASK) -#define SYNTH_SYNTH4_PRESCSEL_RESET 2'h3 -#define SYNTH_SYNTH4_RESET_PRESC_MSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_LSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_MASK 'h00000400 -#define SYNTH_SYNTH4_RESET_PRESC_GET(x) (((x) & SYNTH_SYNTH4_RESET_PRESC_MASK) >> SYNTH_SYNTH4_RESET_PRESC_LSB) -#define SYNTH_SYNTH4_RESET_PRESC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_RESET_PRESC_LSB) & SYNTH_SYNTH4_RESET_PRESC_MASK) -#define SYNTH_SYNTH4_RESET_PRESC_RESET 1'h0 -#define SYNTH_SYNTH4_SDM_DISABLE_MSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_LSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_MASK 'h00000200 -#define SYNTH_SYNTH4_SDM_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_SDM_DISABLE_MASK) >> SYNTH_SYNTH4_SDM_DISABLE_LSB) -#define SYNTH_SYNTH4_SDM_DISABLE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SDM_DISABLE_LSB) & SYNTH_SYNTH4_SDM_DISABLE_MASK) -#define SYNTH_SYNTH4_SDM_DISABLE_RESET 1'h0 -#define SYNTH_SYNTH4_SDM_MODE_MSB 8 -#define SYNTH_SYNTH4_SDM_MODE_LSB 8 -#define SYNTH_SYNTH4_SDM_MODE_MASK 'h00000100 -#define SYNTH_SYNTH4_SDM_MODE_GET(x) (((x) & SYNTH_SYNTH4_SDM_MODE_MASK) >> SYNTH_SYNTH4_SDM_MODE_LSB) -#define SYNTH_SYNTH4_SDM_MODE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SDM_MODE_LSB) & SYNTH_SYNTH4_SDM_MODE_MASK) -#define SYNTH_SYNTH4_SDM_MODE_RESET 1'h0 -#define SYNTH_SYNTH4_SDM_DITHER_MSB 7 -#define SYNTH_SYNTH4_SDM_DITHER_LSB 6 -#define SYNTH_SYNTH4_SDM_DITHER_MASK 'h000000c0 -#define SYNTH_SYNTH4_SDM_DITHER_GET(x) (((x) & SYNTH_SYNTH4_SDM_DITHER_MASK) >> SYNTH_SYNTH4_SDM_DITHER_LSB) -#define SYNTH_SYNTH4_SDM_DITHER_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SDM_DITHER_LSB) & SYNTH_SYNTH4_SDM_DITHER_MASK) -#define SYNTH_SYNTH4_SDM_DITHER_RESET 2'h0 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK 'h00000020 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_GET(x) (((x) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) >> SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_RESET 1'h0 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK 'h00000010 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_GET(x) (((x) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) >> SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_RESET 1'h0 -#define SYNTH_SYNTH4_SPARE_MISC_MSB 3 -#define SYNTH_SYNTH4_SPARE_MISC_LSB 2 -#define SYNTH_SYNTH4_SPARE_MISC_MASK 'h0000000c -#define SYNTH_SYNTH4_SPARE_MISC_GET(x) (((x) & SYNTH_SYNTH4_SPARE_MISC_MASK) >> SYNTH_SYNTH4_SPARE_MISC_LSB) -#define SYNTH_SYNTH4_SPARE_MISC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SPARE_MISC_LSB) & SYNTH_SYNTH4_SPARE_MISC_MASK) -#define SYNTH_SYNTH4_SPARE_MISC_RESET 2'h0 -#define SYNTH_SYNTH4_LONGSHIFTSEL_MSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_LSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_MASK 'h00000002 -#define SYNTH_SYNTH4_LONGSHIFTSEL_GET(x) (((x) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) >> SYNTH_SYNTH4_LONGSHIFTSEL_LSB) -#define SYNTH_SYNTH4_LONGSHIFTSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_LONGSHIFTSEL_LSB) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) -#define SYNTH_SYNTH4_LONGSHIFTSEL_RESET 1'h0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_LSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MASK 'h00000001 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_GET(x) (((x) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) >> SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_RESET 1'h0 -#define SYNTH_SYNTH4_RESET (32'h0 | \ - SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_SET(SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_RESET) | \ - SYNTH_SYNTH4_DIS_LOSTVC_SET(SYNTH_SYNTH4_DIS_LOSTVC_RESET) | \ - SYNTH_SYNTH4_ALWAYS_SHORTR_SET(SYNTH_SYNTH4_ALWAYS_SHORTR_RESET) | \ - SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_SET(SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_RESET) | \ - SYNTH_SYNTH4_FORCE_PINVC_SET(SYNTH_SYNTH4_FORCE_PINVC_RESET) | \ - SYNTH_SYNTH4_FORCE_VCOCAP_SET(SYNTH_SYNTH4_FORCE_VCOCAP_RESET) | \ - SYNTH_SYNTH4_VCOCAP_OVR_SET(SYNTH_SYNTH4_VCOCAP_OVR_RESET) | \ - SYNTH_SYNTH4_VCOCAPPULLUP_SET(SYNTH_SYNTH4_VCOCAPPULLUP_RESET) | \ - SYNTH_SYNTH4_REFDIVSEL_SET(SYNTH_SYNTH4_REFDIVSEL_RESET) | \ - SYNTH_SYNTH4_PFDDELAY_SET(SYNTH_SYNTH4_PFDDELAY_RESET) | \ - SYNTH_SYNTH4_PFD_DISABLE_SET(SYNTH_SYNTH4_PFD_DISABLE_RESET) | \ - SYNTH_SYNTH4_PRESCSEL_SET(SYNTH_SYNTH4_PRESCSEL_RESET) | \ - SYNTH_SYNTH4_RESET_PRESC_SET(SYNTH_SYNTH4_RESET_PRESC_RESET) | \ - SYNTH_SYNTH4_SDM_DISABLE_SET(SYNTH_SYNTH4_SDM_DISABLE_RESET) | \ - SYNTH_SYNTH4_SDM_MODE_SET(SYNTH_SYNTH4_SDM_MODE_RESET) | \ - SYNTH_SYNTH4_SDM_DITHER_SET(SYNTH_SYNTH4_SDM_DITHER_RESET) | \ - SYNTH_SYNTH4_PSCOUNT_FBSEL_SET(SYNTH_SYNTH4_PSCOUNT_FBSEL_RESET) | \ - SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_SET(SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_RESET) | \ - SYNTH_SYNTH4_SPARE_MISC_SET(SYNTH_SYNTH4_SPARE_MISC_RESET) | \ - SYNTH_SYNTH4_LONGSHIFTSEL_SET(SYNTH_SYNTH4_LONGSHIFTSEL_RESET) | \ - SYNTH_SYNTH4_FORCE_SHIFTREG_SET(SYNTH_SYNTH4_FORCE_SHIFTREG_RESET)) -#define SYNTH_SYNTH4_HW_MASK (32'h0) -#define SYNTH_SYNTH4_SW_MASK (32'h0 | \ - SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK | \ - SYNTH_SYNTH4_DIS_LOSTVC_MASK | \ - SYNTH_SYNTH4_ALWAYS_SHORTR_MASK | \ - SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK | \ - SYNTH_SYNTH4_FORCE_PINVC_MASK | \ - SYNTH_SYNTH4_FORCE_VCOCAP_MASK | \ - SYNTH_SYNTH4_VCOCAP_OVR_MASK | \ - SYNTH_SYNTH4_VCOCAPPULLUP_MASK | \ - SYNTH_SYNTH4_REFDIVSEL_MASK | \ - SYNTH_SYNTH4_PFDDELAY_MASK | \ - SYNTH_SYNTH4_PFD_DISABLE_MASK | \ - SYNTH_SYNTH4_PRESCSEL_MASK | \ - SYNTH_SYNTH4_RESET_PRESC_MASK | \ - SYNTH_SYNTH4_SDM_DISABLE_MASK | \ - SYNTH_SYNTH4_SDM_MODE_MASK | \ - SYNTH_SYNTH4_SDM_DITHER_MASK | \ - SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK | \ - SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK | \ - SYNTH_SYNTH4_SPARE_MISC_MASK | \ - SYNTH_SYNTH4_LONGSHIFTSEL_MASK | \ - SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) - -#define SYNTH_SYNTH5_ADDRESS 'h00000010 -#define SYNTH_SYNTH5_LOOP_IP0_MSB 31 -#define SYNTH_SYNTH5_LOOP_IP0_LSB 28 -#define SYNTH_SYNTH5_LOOP_IP0_MASK 'hf0000000 -#define SYNTH_SYNTH5_LOOP_IP0_GET(x) (((x) & SYNTH_SYNTH5_LOOP_IP0_MASK) >> SYNTH_SYNTH5_LOOP_IP0_LSB) -#define SYNTH_SYNTH5_LOOP_IP0_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_LOOP_IP0_LSB) & SYNTH_SYNTH5_LOOP_IP0_MASK) -#define SYNTH_SYNTH5_LOOP_IP0_RESET 4'hd -#define SYNTH_SYNTH5_SLOPE_IP_MSB 27 -#define SYNTH_SYNTH5_SLOPE_IP_LSB 25 -#define SYNTH_SYNTH5_SLOPE_IP_MASK 'h0e000000 -#define SYNTH_SYNTH5_SLOPE_IP_GET(x) (((x) & SYNTH_SYNTH5_SLOPE_IP_MASK) >> SYNTH_SYNTH5_SLOPE_IP_LSB) -#define SYNTH_SYNTH5_SLOPE_IP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_SLOPE_IP_LSB) & SYNTH_SYNTH5_SLOPE_IP_MASK) -#define SYNTH_SYNTH5_SLOPE_IP_RESET 3'h0 -#define SYNTH_SYNTH5_CPBIAS_MSB 24 -#define SYNTH_SYNTH5_CPBIAS_LSB 23 -#define SYNTH_SYNTH5_CPBIAS_MASK 'h01800000 -#define SYNTH_SYNTH5_CPBIAS_GET(x) (((x) & SYNTH_SYNTH5_CPBIAS_MASK) >> SYNTH_SYNTH5_CPBIAS_LSB) -#define SYNTH_SYNTH5_CPBIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CPBIAS_LSB) & SYNTH_SYNTH5_CPBIAS_MASK) -#define SYNTH_SYNTH5_CPBIAS_RESET 2'h1 -#define SYNTH_SYNTH5_CPSTEERING_EN_MSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_LSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_MASK 'h00400000 -#define SYNTH_SYNTH5_CPSTEERING_EN_GET(x) (((x) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) >> SYNTH_SYNTH5_CPSTEERING_EN_LSB) -#define SYNTH_SYNTH5_CPSTEERING_EN_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CPSTEERING_EN_LSB) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) -#define SYNTH_SYNTH5_CPSTEERING_EN_RESET 1'h0 -#define SYNTH_SYNTH5_CPLOWLK_MSB 21 -#define SYNTH_SYNTH5_CPLOWLK_LSB 21 -#define SYNTH_SYNTH5_CPLOWLK_MASK 'h00200000 -#define SYNTH_SYNTH5_CPLOWLK_GET(x) (((x) & SYNTH_SYNTH5_CPLOWLK_MASK) >> SYNTH_SYNTH5_CPLOWLK_LSB) -#define SYNTH_SYNTH5_CPLOWLK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CPLOWLK_LSB) & SYNTH_SYNTH5_CPLOWLK_MASK) -#define SYNTH_SYNTH5_CPLOWLK_RESET 1'h0 -#define SYNTH_SYNTH5_LOOPLEAKCUR_MSB 20 -#define SYNTH_SYNTH5_LOOPLEAKCUR_LSB 17 -#define SYNTH_SYNTH5_LOOPLEAKCUR_MASK 'h001e0000 -#define SYNTH_SYNTH5_LOOPLEAKCUR_GET(x) (((x) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) >> SYNTH_SYNTH5_LOOPLEAKCUR_LSB) -#define SYNTH_SYNTH5_LOOPLEAKCUR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_LOOPLEAKCUR_LSB) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) -#define SYNTH_SYNTH5_LOOPLEAKCUR_RESET 4'h0 -#define SYNTH_SYNTH5_CAPRANGE1_MSB 16 -#define SYNTH_SYNTH5_CAPRANGE1_LSB 13 -#define SYNTH_SYNTH5_CAPRANGE1_MASK 'h0001e000 -#define SYNTH_SYNTH5_CAPRANGE1_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE1_MASK) >> SYNTH_SYNTH5_CAPRANGE1_LSB) -#define SYNTH_SYNTH5_CAPRANGE1_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CAPRANGE1_LSB) & SYNTH_SYNTH5_CAPRANGE1_MASK) -#define SYNTH_SYNTH5_CAPRANGE1_RESET 4'h4 -#define SYNTH_SYNTH5_CAPRANGE2_MSB 12 -#define SYNTH_SYNTH5_CAPRANGE2_LSB 9 -#define SYNTH_SYNTH5_CAPRANGE2_MASK 'h00001e00 -#define SYNTH_SYNTH5_CAPRANGE2_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE2_MASK) >> SYNTH_SYNTH5_CAPRANGE2_LSB) -#define SYNTH_SYNTH5_CAPRANGE2_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CAPRANGE2_LSB) & SYNTH_SYNTH5_CAPRANGE2_MASK) -#define SYNTH_SYNTH5_CAPRANGE2_RESET 4'h8 -#define SYNTH_SYNTH5_CAPRANGE3_MSB 8 -#define SYNTH_SYNTH5_CAPRANGE3_LSB 5 -#define SYNTH_SYNTH5_CAPRANGE3_MASK 'h000001e0 -#define SYNTH_SYNTH5_CAPRANGE3_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE3_MASK) >> SYNTH_SYNTH5_CAPRANGE3_LSB) -#define SYNTH_SYNTH5_CAPRANGE3_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CAPRANGE3_LSB) & SYNTH_SYNTH5_CAPRANGE3_MASK) -#define SYNTH_SYNTH5_CAPRANGE3_RESET 4'hc -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK 'h00000010 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_RESET 1'h0 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MSB 3 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB 2 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK 'h0000000c -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_GET(x) (((x) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) >> SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_RESET 2'h2 -#define SYNTH_SYNTH5_SPARE_MSB 1 -#define SYNTH_SYNTH5_SPARE_LSB 0 -#define SYNTH_SYNTH5_SPARE_MASK 'h00000003 -#define SYNTH_SYNTH5_SPARE_GET(x) (((x) & SYNTH_SYNTH5_SPARE_MASK) >> SYNTH_SYNTH5_SPARE_LSB) -#define SYNTH_SYNTH5_SPARE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_SPARE_LSB) & SYNTH_SYNTH5_SPARE_MASK) -#define SYNTH_SYNTH5_SPARE_RESET 2'h0 -#define SYNTH_SYNTH5_RESET (32'h0 | \ - SYNTH_SYNTH5_LOOP_IP0_SET(SYNTH_SYNTH5_LOOP_IP0_RESET) | \ - SYNTH_SYNTH5_SLOPE_IP_SET(SYNTH_SYNTH5_SLOPE_IP_RESET) | \ - SYNTH_SYNTH5_CPBIAS_SET(SYNTH_SYNTH5_CPBIAS_RESET) | \ - SYNTH_SYNTH5_CPSTEERING_EN_SET(SYNTH_SYNTH5_CPSTEERING_EN_RESET) | \ - SYNTH_SYNTH5_CPLOWLK_SET(SYNTH_SYNTH5_CPLOWLK_RESET) | \ - SYNTH_SYNTH5_LOOPLEAKCUR_SET(SYNTH_SYNTH5_LOOPLEAKCUR_RESET) | \ - SYNTH_SYNTH5_CAPRANGE1_SET(SYNTH_SYNTH5_CAPRANGE1_RESET) | \ - SYNTH_SYNTH5_CAPRANGE2_SET(SYNTH_SYNTH5_CAPRANGE2_RESET) | \ - SYNTH_SYNTH5_CAPRANGE3_SET(SYNTH_SYNTH5_CAPRANGE3_RESET) | \ - SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_SET(SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_RESET) | \ - SYNTH_SYNTH5_LOBUF5GTUNE_OVR_SET(SYNTH_SYNTH5_LOBUF5GTUNE_OVR_RESET) | \ - SYNTH_SYNTH5_SPARE_SET(SYNTH_SYNTH5_SPARE_RESET)) -#define SYNTH_SYNTH5_HW_MASK (32'h0) -#define SYNTH_SYNTH5_SW_MASK (32'h0 | \ - SYNTH_SYNTH5_LOOP_IP0_MASK | \ - SYNTH_SYNTH5_SLOPE_IP_MASK | \ - SYNTH_SYNTH5_CPBIAS_MASK | \ - SYNTH_SYNTH5_CPSTEERING_EN_MASK | \ - SYNTH_SYNTH5_CPLOWLK_MASK | \ - SYNTH_SYNTH5_LOOPLEAKCUR_MASK | \ - SYNTH_SYNTH5_CAPRANGE1_MASK | \ - SYNTH_SYNTH5_CAPRANGE2_MASK | \ - SYNTH_SYNTH5_CAPRANGE3_MASK | \ - SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK | \ - SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK | \ - SYNTH_SYNTH5_SPARE_MASK) - -#define SYNTH_SYNTH6_ADDRESS 'h00000014 -#define SYNTH_SYNTH6_IRCP_MSB 31 -#define SYNTH_SYNTH6_IRCP_LSB 29 -#define SYNTH_SYNTH6_IRCP_MASK 'he0000000 -#define SYNTH_SYNTH6_IRCP_GET(x) (((x) & SYNTH_SYNTH6_IRCP_MASK) >> SYNTH_SYNTH6_IRCP_LSB) -#define SYNTH_SYNTH6_IRCP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_IRCP_LSB) & SYNTH_SYNTH6_IRCP_MASK) -#define SYNTH_SYNTH6_IRCP_RESET 3'h4 -#define SYNTH_SYNTH6_IRVCMON_MSB 28 -#define SYNTH_SYNTH6_IRVCMON_LSB 26 -#define SYNTH_SYNTH6_IRVCMON_MASK 'h1c000000 -#define SYNTH_SYNTH6_IRVCMON_GET(x) (((x) & SYNTH_SYNTH6_IRVCMON_MASK) >> SYNTH_SYNTH6_IRVCMON_LSB) -#define SYNTH_SYNTH6_IRVCMON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_IRVCMON_LSB) & SYNTH_SYNTH6_IRVCMON_MASK) -#define SYNTH_SYNTH6_IRVCMON_RESET 3'h4 -#define SYNTH_SYNTH6_IRSPARE_MSB 25 -#define SYNTH_SYNTH6_IRSPARE_LSB 23 -#define SYNTH_SYNTH6_IRSPARE_MASK 'h03800000 -#define SYNTH_SYNTH6_IRSPARE_GET(x) (((x) & SYNTH_SYNTH6_IRSPARE_MASK) >> SYNTH_SYNTH6_IRSPARE_LSB) -#define SYNTH_SYNTH6_IRSPARE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_IRSPARE_LSB) & SYNTH_SYNTH6_IRSPARE_MASK) -#define SYNTH_SYNTH6_IRSPARE_RESET 3'h4 -#define SYNTH_SYNTH6_ICPRESC_MSB 22 -#define SYNTH_SYNTH6_ICPRESC_LSB 20 -#define SYNTH_SYNTH6_ICPRESC_MASK 'h00700000 -#define SYNTH_SYNTH6_ICPRESC_GET(x) (((x) & SYNTH_SYNTH6_ICPRESC_MASK) >> SYNTH_SYNTH6_ICPRESC_LSB) -#define SYNTH_SYNTH6_ICPRESC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICPRESC_LSB) & SYNTH_SYNTH6_ICPRESC_MASK) -#define SYNTH_SYNTH6_ICPRESC_RESET 3'h4 -#define SYNTH_SYNTH6_ICLODIV_MSB 19 -#define SYNTH_SYNTH6_ICLODIV_LSB 17 -#define SYNTH_SYNTH6_ICLODIV_MASK 'h000e0000 -#define SYNTH_SYNTH6_ICLODIV_GET(x) (((x) & SYNTH_SYNTH6_ICLODIV_MASK) >> SYNTH_SYNTH6_ICLODIV_LSB) -#define SYNTH_SYNTH6_ICLODIV_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICLODIV_LSB) & SYNTH_SYNTH6_ICLODIV_MASK) -#define SYNTH_SYNTH6_ICLODIV_RESET 3'h4 -#define SYNTH_SYNTH6_ICLOMIX_MSB 16 -#define SYNTH_SYNTH6_ICLOMIX_LSB 14 -#define SYNTH_SYNTH6_ICLOMIX_MASK 'h0001c000 -#define SYNTH_SYNTH6_ICLOMIX_GET(x) (((x) & SYNTH_SYNTH6_ICLOMIX_MASK) >> SYNTH_SYNTH6_ICLOMIX_LSB) -#define SYNTH_SYNTH6_ICLOMIX_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICLOMIX_LSB) & SYNTH_SYNTH6_ICLOMIX_MASK) -#define SYNTH_SYNTH6_ICLOMIX_RESET 3'h4 -#define SYNTH_SYNTH6_ICSPAREA_MSB 13 -#define SYNTH_SYNTH6_ICSPAREA_LSB 11 -#define SYNTH_SYNTH6_ICSPAREA_MASK 'h00003800 -#define SYNTH_SYNTH6_ICSPAREA_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREA_MASK) >> SYNTH_SYNTH6_ICSPAREA_LSB) -#define SYNTH_SYNTH6_ICSPAREA_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICSPAREA_LSB) & SYNTH_SYNTH6_ICSPAREA_MASK) -#define SYNTH_SYNTH6_ICSPAREA_RESET 3'h4 -#define SYNTH_SYNTH6_ICSPAREB_MSB 10 -#define SYNTH_SYNTH6_ICSPAREB_LSB 8 -#define SYNTH_SYNTH6_ICSPAREB_MASK 'h00000700 -#define SYNTH_SYNTH6_ICSPAREB_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREB_MASK) >> SYNTH_SYNTH6_ICSPAREB_LSB) -#define SYNTH_SYNTH6_ICSPAREB_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICSPAREB_LSB) & SYNTH_SYNTH6_ICSPAREB_MASK) -#define SYNTH_SYNTH6_ICSPAREB_RESET 3'h4 -#define SYNTH_SYNTH6_ICVCO_MSB 7 -#define SYNTH_SYNTH6_ICVCO_LSB 5 -#define SYNTH_SYNTH6_ICVCO_MASK 'h000000e0 -#define SYNTH_SYNTH6_ICVCO_GET(x) (((x) & SYNTH_SYNTH6_ICVCO_MASK) >> SYNTH_SYNTH6_ICVCO_LSB) -#define SYNTH_SYNTH6_ICVCO_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICVCO_LSB) & SYNTH_SYNTH6_ICVCO_MASK) -#define SYNTH_SYNTH6_ICVCO_RESET 3'h4 -#define SYNTH_SYNTH6_VCOBUFBIAS_MSB 4 -#define SYNTH_SYNTH6_VCOBUFBIAS_LSB 3 -#define SYNTH_SYNTH6_VCOBUFBIAS_MASK 'h00000018 -#define SYNTH_SYNTH6_VCOBUFBIAS_GET(x) (((x) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) >> SYNTH_SYNTH6_VCOBUFBIAS_LSB) -#define SYNTH_SYNTH6_VCOBUFBIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_VCOBUFBIAS_LSB) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) -#define SYNTH_SYNTH6_VCOBUFBIAS_RESET 2'h2 -#define SYNTH_SYNTH6_SPARE_BIAS_MSB 2 -#define SYNTH_SYNTH6_SPARE_BIAS_LSB 0 -#define SYNTH_SYNTH6_SPARE_BIAS_MASK 'h00000007 -#define SYNTH_SYNTH6_SPARE_BIAS_GET(x) (((x) & SYNTH_SYNTH6_SPARE_BIAS_MASK) >> SYNTH_SYNTH6_SPARE_BIAS_LSB) -#define SYNTH_SYNTH6_SPARE_BIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_SPARE_BIAS_LSB) & SYNTH_SYNTH6_SPARE_BIAS_MASK) -#define SYNTH_SYNTH6_SPARE_BIAS_RESET 3'h0 -#define SYNTH_SYNTH6_RESET (32'h0 | \ - SYNTH_SYNTH6_IRCP_SET(SYNTH_SYNTH6_IRCP_RESET) | \ - SYNTH_SYNTH6_IRVCMON_SET(SYNTH_SYNTH6_IRVCMON_RESET) | \ - SYNTH_SYNTH6_IRSPARE_SET(SYNTH_SYNTH6_IRSPARE_RESET) | \ - SYNTH_SYNTH6_ICPRESC_SET(SYNTH_SYNTH6_ICPRESC_RESET) | \ - SYNTH_SYNTH6_ICLODIV_SET(SYNTH_SYNTH6_ICLODIV_RESET) | \ - SYNTH_SYNTH6_ICLOMIX_SET(SYNTH_SYNTH6_ICLOMIX_RESET) | \ - SYNTH_SYNTH6_ICSPAREA_SET(SYNTH_SYNTH6_ICSPAREA_RESET) | \ - SYNTH_SYNTH6_ICSPAREB_SET(SYNTH_SYNTH6_ICSPAREB_RESET) | \ - SYNTH_SYNTH6_ICVCO_SET(SYNTH_SYNTH6_ICVCO_RESET) | \ - SYNTH_SYNTH6_VCOBUFBIAS_SET(SYNTH_SYNTH6_VCOBUFBIAS_RESET) | \ - SYNTH_SYNTH6_SPARE_BIAS_SET(SYNTH_SYNTH6_SPARE_BIAS_RESET)) -#define SYNTH_SYNTH6_HW_MASK (32'h0) -#define SYNTH_SYNTH6_SW_MASK (32'h0 | \ - SYNTH_SYNTH6_IRCP_MASK | \ - SYNTH_SYNTH6_IRVCMON_MASK | \ - SYNTH_SYNTH6_IRSPARE_MASK | \ - SYNTH_SYNTH6_ICPRESC_MASK | \ - SYNTH_SYNTH6_ICLODIV_MASK | \ - SYNTH_SYNTH6_ICLOMIX_MASK | \ - SYNTH_SYNTH6_ICSPAREA_MASK | \ - SYNTH_SYNTH6_ICSPAREB_MASK | \ - SYNTH_SYNTH6_ICVCO_MASK | \ - SYNTH_SYNTH6_VCOBUFBIAS_MASK | \ - SYNTH_SYNTH6_SPARE_BIAS_MASK) - -#define SYNTH_SYNTH7_ADDRESS 'h00000018 -#define SYNTH_SYNTH7_SYNTH_ON_MSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_LSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_MASK 'h80000000 -#define SYNTH_SYNTH7_SYNTH_ON_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_ON_MASK) >> SYNTH_SYNTH7_SYNTH_ON_LSB) -#define SYNTH_SYNTH7_SYNTH_ON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SYNTH_ON_LSB) & SYNTH_SYNTH7_SYNTH_ON_MASK) -#define SYNTH_SYNTH7_SYNTH_ON_RESET 1'h0 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MSB 30 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_LSB 27 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MASK 'h78000000 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) >> SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_RESET 4'h0 -#define SYNTH_SYNTH7_CAP_SEARCH_MSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_LSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_MASK 'h04000000 -#define SYNTH_SYNTH7_CAP_SEARCH_GET(x) (((x) & SYNTH_SYNTH7_CAP_SEARCH_MASK) >> SYNTH_SYNTH7_CAP_SEARCH_LSB) -#define SYNTH_SYNTH7_CAP_SEARCH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_CAP_SEARCH_LSB) & SYNTH_SYNTH7_CAP_SEARCH_MASK) -#define SYNTH_SYNTH7_CAP_SEARCH_RESET 1'h0 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK 'h02000000 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) >> SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_RESET 1'h0 -#define SYNTH_SYNTH7_PIN_VC_MSB 24 -#define SYNTH_SYNTH7_PIN_VC_LSB 24 -#define SYNTH_SYNTH7_PIN_VC_MASK 'h01000000 -#define SYNTH_SYNTH7_PIN_VC_GET(x) (((x) & SYNTH_SYNTH7_PIN_VC_MASK) >> SYNTH_SYNTH7_PIN_VC_LSB) -#define SYNTH_SYNTH7_PIN_VC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_PIN_VC_LSB) & SYNTH_SYNTH7_PIN_VC_MASK) -#define SYNTH_SYNTH7_PIN_VC_RESET 1'h0 -#define SYNTH_SYNTH7_VCO_CAP_ST_MSB 23 -#define SYNTH_SYNTH7_VCO_CAP_ST_LSB 16 -#define SYNTH_SYNTH7_VCO_CAP_ST_MASK 'h00ff0000 -#define SYNTH_SYNTH7_VCO_CAP_ST_GET(x) (((x) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) >> SYNTH_SYNTH7_VCO_CAP_ST_LSB) -#define SYNTH_SYNTH7_VCO_CAP_ST_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_VCO_CAP_ST_LSB) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) -#define SYNTH_SYNTH7_VCO_CAP_ST_RESET 8'h0 -#define SYNTH_SYNTH7_SHORT_R_MSB 15 -#define SYNTH_SYNTH7_SHORT_R_LSB 15 -#define SYNTH_SYNTH7_SHORT_R_MASK 'h00008000 -#define SYNTH_SYNTH7_SHORT_R_GET(x) (((x) & SYNTH_SYNTH7_SHORT_R_MASK) >> SYNTH_SYNTH7_SHORT_R_LSB) -#define SYNTH_SYNTH7_SHORT_R_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SHORT_R_LSB) & SYNTH_SYNTH7_SHORT_R_MASK) -#define SYNTH_SYNTH7_SHORT_R_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_RFD_MSB 14 -#define SYNTH_SYNTH7_RESET_RFD_LSB 14 -#define SYNTH_SYNTH7_RESET_RFD_MASK 'h00004000 -#define SYNTH_SYNTH7_RESET_RFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_RFD_MASK) >> SYNTH_SYNTH7_RESET_RFD_LSB) -#define SYNTH_SYNTH7_RESET_RFD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_RFD_LSB) & SYNTH_SYNTH7_RESET_RFD_MASK) -#define SYNTH_SYNTH7_RESET_RFD_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_PFD_MSB 13 -#define SYNTH_SYNTH7_RESET_PFD_LSB 13 -#define SYNTH_SYNTH7_RESET_PFD_MASK 'h00002000 -#define SYNTH_SYNTH7_RESET_PFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_PFD_MASK) >> SYNTH_SYNTH7_RESET_PFD_LSB) -#define SYNTH_SYNTH7_RESET_PFD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_PFD_LSB) & SYNTH_SYNTH7_RESET_PFD_MASK) -#define SYNTH_SYNTH7_RESET_PFD_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK 'h00001000 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_GET(x) (((x) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) >> SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_SDM_B_MSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_LSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_MASK 'h00000800 -#define SYNTH_SYNTH7_RESET_SDM_B_GET(x) (((x) & SYNTH_SYNTH7_RESET_SDM_B_MASK) >> SYNTH_SYNTH7_RESET_SDM_B_LSB) -#define SYNTH_SYNTH7_RESET_SDM_B_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_SDM_B_LSB) & SYNTH_SYNTH7_RESET_SDM_B_MASK) -#define SYNTH_SYNTH7_RESET_SDM_B_RESET 1'h0 -#define SYNTH_SYNTH7_VC2HIGH_MSB 10 -#define SYNTH_SYNTH7_VC2HIGH_LSB 10 -#define SYNTH_SYNTH7_VC2HIGH_MASK 'h00000400 -#define SYNTH_SYNTH7_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH7_VC2HIGH_MASK) >> SYNTH_SYNTH7_VC2HIGH_LSB) -#define SYNTH_SYNTH7_VC2HIGH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_VC2HIGH_LSB) & SYNTH_SYNTH7_VC2HIGH_MASK) -#define SYNTH_SYNTH7_VC2HIGH_RESET 1'h0 -#define SYNTH_SYNTH7_VC2LOW_MSB 9 -#define SYNTH_SYNTH7_VC2LOW_LSB 9 -#define SYNTH_SYNTH7_VC2LOW_MASK 'h00000200 -#define SYNTH_SYNTH7_VC2LOW_GET(x) (((x) & SYNTH_SYNTH7_VC2LOW_MASK) >> SYNTH_SYNTH7_VC2LOW_LSB) -#define SYNTH_SYNTH7_VC2LOW_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_VC2LOW_LSB) & SYNTH_SYNTH7_VC2LOW_MASK) -#define SYNTH_SYNTH7_VC2LOW_RESET 1'h0 -#define SYNTH_SYNTH7_LOOP_IP_MSB 8 -#define SYNTH_SYNTH7_LOOP_IP_LSB 5 -#define SYNTH_SYNTH7_LOOP_IP_MASK 'h000001e0 -#define SYNTH_SYNTH7_LOOP_IP_GET(x) (((x) & SYNTH_SYNTH7_LOOP_IP_MASK) >> SYNTH_SYNTH7_LOOP_IP_LSB) -#define SYNTH_SYNTH7_LOOP_IP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_LOOP_IP_LSB) & SYNTH_SYNTH7_LOOP_IP_MASK) -#define SYNTH_SYNTH7_LOOP_IP_RESET 4'h0 -#define SYNTH_SYNTH7_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH7_LOBUF5GTUNE_LSB 3 -#define SYNTH_SYNTH7_LOBUF5GTUNE_MASK 'h00000018 -#define SYNTH_SYNTH7_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH7_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH7_LOBUF5GTUNE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_LOBUF5GTUNE_LSB) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH7_LOBUF5GTUNE_RESET 2'h0 -#define SYNTH_SYNTH7_SPARE_READ_MSB 2 -#define SYNTH_SYNTH7_SPARE_READ_LSB 0 -#define SYNTH_SYNTH7_SPARE_READ_MASK 'h00000007 -#define SYNTH_SYNTH7_SPARE_READ_GET(x) (((x) & SYNTH_SYNTH7_SPARE_READ_MASK) >> SYNTH_SYNTH7_SPARE_READ_LSB) -#define SYNTH_SYNTH7_SPARE_READ_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SPARE_READ_LSB) & SYNTH_SYNTH7_SPARE_READ_MASK) -#define SYNTH_SYNTH7_SPARE_READ_RESET 3'h0 -#define SYNTH_SYNTH7_RESET (32'h0 | \ - SYNTH_SYNTH7_SYNTH_ON_SET(SYNTH_SYNTH7_SYNTH_ON_RESET) | \ - SYNTH_SYNTH7_SYNTH_SM_STATE_SET(SYNTH_SYNTH7_SYNTH_SM_STATE_RESET) | \ - SYNTH_SYNTH7_CAP_SEARCH_SET(SYNTH_SYNTH7_CAP_SEARCH_RESET) | \ - SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_SET(SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_RESET) | \ - SYNTH_SYNTH7_PIN_VC_SET(SYNTH_SYNTH7_PIN_VC_RESET) | \ - SYNTH_SYNTH7_VCO_CAP_ST_SET(SYNTH_SYNTH7_VCO_CAP_ST_RESET) | \ - SYNTH_SYNTH7_SHORT_R_SET(SYNTH_SYNTH7_SHORT_R_RESET) | \ - SYNTH_SYNTH7_RESET_RFD_SET(SYNTH_SYNTH7_RESET_RFD_RESET) | \ - SYNTH_SYNTH7_RESET_PFD_SET(SYNTH_SYNTH7_RESET_PFD_RESET) | \ - SYNTH_SYNTH7_RESET_PSCOUNTERS_SET(SYNTH_SYNTH7_RESET_PSCOUNTERS_RESET) | \ - SYNTH_SYNTH7_RESET_SDM_B_SET(SYNTH_SYNTH7_RESET_SDM_B_RESET) | \ - SYNTH_SYNTH7_VC2HIGH_SET(SYNTH_SYNTH7_VC2HIGH_RESET) | \ - SYNTH_SYNTH7_VC2LOW_SET(SYNTH_SYNTH7_VC2LOW_RESET) | \ - SYNTH_SYNTH7_LOOP_IP_SET(SYNTH_SYNTH7_LOOP_IP_RESET) | \ - SYNTH_SYNTH7_LOBUF5GTUNE_SET(SYNTH_SYNTH7_LOBUF5GTUNE_RESET) | \ - SYNTH_SYNTH7_SPARE_READ_SET(SYNTH_SYNTH7_SPARE_READ_RESET)) -#define SYNTH_SYNTH7_HW_MASK (32'h0 | \ - SYNTH_SYNTH7_SYNTH_ON_MASK | \ - SYNTH_SYNTH7_SYNTH_SM_STATE_MASK | \ - SYNTH_SYNTH7_CAP_SEARCH_MASK | \ - SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK | \ - SYNTH_SYNTH7_PIN_VC_MASK | \ - SYNTH_SYNTH7_VCO_CAP_ST_MASK | \ - SYNTH_SYNTH7_SHORT_R_MASK | \ - SYNTH_SYNTH7_RESET_RFD_MASK | \ - SYNTH_SYNTH7_RESET_PFD_MASK | \ - SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK | \ - SYNTH_SYNTH7_RESET_SDM_B_MASK | \ - SYNTH_SYNTH7_VC2HIGH_MASK | \ - SYNTH_SYNTH7_VC2LOW_MASK | \ - SYNTH_SYNTH7_LOOP_IP_MASK | \ - SYNTH_SYNTH7_LOBUF5GTUNE_MASK | \ - SYNTH_SYNTH7_SPARE_READ_MASK) -#define SYNTH_SYNTH7_SW_MASK (32'h0) - -#define SYNTH_SYNTH8_ADDRESS 'h0000001c -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK 'h80000000 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_GET(x) (((x) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) >> SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_RESET 1'h0 -#define SYNTH_SYNTH8_FRACMODE_MSB 30 -#define SYNTH_SYNTH8_FRACMODE_LSB 30 -#define SYNTH_SYNTH8_FRACMODE_MASK 'h40000000 -#define SYNTH_SYNTH8_FRACMODE_GET(x) (((x) & SYNTH_SYNTH8_FRACMODE_MASK) >> SYNTH_SYNTH8_FRACMODE_LSB) -#define SYNTH_SYNTH8_FRACMODE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_FRACMODE_LSB) & SYNTH_SYNTH8_FRACMODE_MASK) -#define SYNTH_SYNTH8_FRACMODE_RESET 1'h0 -#define SYNTH_SYNTH8_AMODEREFSEL_MSB 29 -#define SYNTH_SYNTH8_AMODEREFSEL_LSB 28 -#define SYNTH_SYNTH8_AMODEREFSEL_MASK 'h30000000 -#define SYNTH_SYNTH8_AMODEREFSEL_GET(x) (((x) & SYNTH_SYNTH8_AMODEREFSEL_MASK) >> SYNTH_SYNTH8_AMODEREFSEL_LSB) -#define SYNTH_SYNTH8_AMODEREFSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_AMODEREFSEL_LSB) & SYNTH_SYNTH8_AMODEREFSEL_MASK) -#define SYNTH_SYNTH8_AMODEREFSEL_RESET 2'h0 -#define SYNTH_SYNTH8_SPARE_MSB 27 -#define SYNTH_SYNTH8_SPARE_LSB 27 -#define SYNTH_SYNTH8_SPARE_MASK 'h08000000 -#define SYNTH_SYNTH8_SPARE_GET(x) (((x) & SYNTH_SYNTH8_SPARE_MASK) >> SYNTH_SYNTH8_SPARE_LSB) -#define SYNTH_SYNTH8_SPARE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_SPARE_LSB) & SYNTH_SYNTH8_SPARE_MASK) -#define SYNTH_SYNTH8_SPARE_RESET 1'h0 -#define SYNTH_SYNTH8_CHANSEL_MSB 26 -#define SYNTH_SYNTH8_CHANSEL_LSB 18 -#define SYNTH_SYNTH8_CHANSEL_MASK 'h07fc0000 -#define SYNTH_SYNTH8_CHANSEL_GET(x) (((x) & SYNTH_SYNTH8_CHANSEL_MASK) >> SYNTH_SYNTH8_CHANSEL_LSB) -#define SYNTH_SYNTH8_CHANSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_CHANSEL_LSB) & SYNTH_SYNTH8_CHANSEL_MASK) -#define SYNTH_SYNTH8_CHANSEL_RESET 9'h0 -#define SYNTH_SYNTH8_CHANFRAC_MSB 17 -#define SYNTH_SYNTH8_CHANFRAC_LSB 1 -#define SYNTH_SYNTH8_CHANFRAC_MASK 'h0003fffe -#define SYNTH_SYNTH8_CHANFRAC_GET(x) (((x) & SYNTH_SYNTH8_CHANFRAC_MASK) >> SYNTH_SYNTH8_CHANFRAC_LSB) -#define SYNTH_SYNTH8_CHANFRAC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_CHANFRAC_LSB) & SYNTH_SYNTH8_CHANFRAC_MASK) -#define SYNTH_SYNTH8_CHANFRAC_RESET 17'h0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_MSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_LSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_MASK 'h00000001 -#define SYNTH_SYNTH8_FORCE_FRACLSB_GET(x) (((x) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) >> SYNTH_SYNTH8_FORCE_FRACLSB_LSB) -#define SYNTH_SYNTH8_FORCE_FRACLSB_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_FORCE_FRACLSB_LSB) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) -#define SYNTH_SYNTH8_FORCE_FRACLSB_RESET 1'h0 -#define SYNTH_SYNTH8_RESET (32'h0 | \ - SYNTH_SYNTH8_LOADSYNTHCHANNEL_SET(SYNTH_SYNTH8_LOADSYNTHCHANNEL_RESET) | \ - SYNTH_SYNTH8_FRACMODE_SET(SYNTH_SYNTH8_FRACMODE_RESET) | \ - SYNTH_SYNTH8_AMODEREFSEL_SET(SYNTH_SYNTH8_AMODEREFSEL_RESET) | \ - SYNTH_SYNTH8_SPARE_SET(SYNTH_SYNTH8_SPARE_RESET) | \ - SYNTH_SYNTH8_CHANSEL_SET(SYNTH_SYNTH8_CHANSEL_RESET) | \ - SYNTH_SYNTH8_CHANFRAC_SET(SYNTH_SYNTH8_CHANFRAC_RESET) | \ - SYNTH_SYNTH8_FORCE_FRACLSB_SET(SYNTH_SYNTH8_FORCE_FRACLSB_RESET)) -#define SYNTH_SYNTH8_HW_MASK (32'h0 | \ - SYNTH_SYNTH8_FRACMODE_MASK | \ - SYNTH_SYNTH8_AMODEREFSEL_MASK | \ - SYNTH_SYNTH8_SPARE_MASK | \ - SYNTH_SYNTH8_CHANSEL_MASK | \ - SYNTH_SYNTH8_CHANFRAC_MASK) -#define SYNTH_SYNTH8_SW_MASK (32'h0 | \ - SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK | \ - SYNTH_SYNTH8_FRACMODE_MASK | \ - SYNTH_SYNTH8_AMODEREFSEL_MASK | \ - SYNTH_SYNTH8_SPARE_MASK | \ - SYNTH_SYNTH8_CHANSEL_MASK | \ - SYNTH_SYNTH8_CHANFRAC_MASK | \ - SYNTH_SYNTH8_FORCE_FRACLSB_MASK) - -#define RF5G_RF5G1_ADDRESS 'h00000020 -#define RF5G_RF5G1_PDTXLO5_MSB 31 -#define RF5G_RF5G1_PDTXLO5_LSB 31 -#define RF5G_RF5G1_PDTXLO5_MASK 'h80000000 -#define RF5G_RF5G1_PDTXLO5_GET(x) (((x) & RF5G_RF5G1_PDTXLO5_MASK) >> RF5G_RF5G1_PDTXLO5_LSB) -#define RF5G_RF5G1_PDTXLO5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDTXLO5_LSB) & RF5G_RF5G1_PDTXLO5_MASK) -#define RF5G_RF5G1_PDTXLO5_RESET 1'h0 -#define RF5G_RF5G1_PDTXMIX5_MSB 30 -#define RF5G_RF5G1_PDTXMIX5_LSB 30 -#define RF5G_RF5G1_PDTXMIX5_MASK 'h40000000 -#define RF5G_RF5G1_PDTXMIX5_GET(x) (((x) & RF5G_RF5G1_PDTXMIX5_MASK) >> RF5G_RF5G1_PDTXMIX5_LSB) -#define RF5G_RF5G1_PDTXMIX5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDTXMIX5_LSB) & RF5G_RF5G1_PDTXMIX5_MASK) -#define RF5G_RF5G1_PDTXMIX5_RESET 1'h0 -#define RF5G_RF5G1_PDTXBUF5_MSB 29 -#define RF5G_RF5G1_PDTXBUF5_LSB 29 -#define RF5G_RF5G1_PDTXBUF5_MASK 'h20000000 -#define RF5G_RF5G1_PDTXBUF5_GET(x) (((x) & RF5G_RF5G1_PDTXBUF5_MASK) >> RF5G_RF5G1_PDTXBUF5_LSB) -#define RF5G_RF5G1_PDTXBUF5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDTXBUF5_LSB) & RF5G_RF5G1_PDTXBUF5_MASK) -#define RF5G_RF5G1_PDTXBUF5_RESET 1'h0 -#define RF5G_RF5G1_PDPADRV5_MSB 28 -#define RF5G_RF5G1_PDPADRV5_LSB 28 -#define RF5G_RF5G1_PDPADRV5_MASK 'h10000000 -#define RF5G_RF5G1_PDPADRV5_GET(x) (((x) & RF5G_RF5G1_PDPADRV5_MASK) >> RF5G_RF5G1_PDPADRV5_LSB) -#define RF5G_RF5G1_PDPADRV5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDPADRV5_LSB) & RF5G_RF5G1_PDPADRV5_MASK) -#define RF5G_RF5G1_PDPADRV5_RESET 1'h0 -#define RF5G_RF5G1_PDPAOUT5_MSB 27 -#define RF5G_RF5G1_PDPAOUT5_LSB 27 -#define RF5G_RF5G1_PDPAOUT5_MASK 'h08000000 -#define RF5G_RF5G1_PDPAOUT5_GET(x) (((x) & RF5G_RF5G1_PDPAOUT5_MASK) >> RF5G_RF5G1_PDPAOUT5_LSB) -#define RF5G_RF5G1_PDPAOUT5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDPAOUT5_LSB) & RF5G_RF5G1_PDPAOUT5_MASK) -#define RF5G_RF5G1_PDPAOUT5_RESET 1'h0 -#define RF5G_RF5G1_TUNE_PADRV5_MSB 26 -#define RF5G_RF5G1_TUNE_PADRV5_LSB 24 -#define RF5G_RF5G1_TUNE_PADRV5_MASK 'h07000000 -#define RF5G_RF5G1_TUNE_PADRV5_GET(x) (((x) & RF5G_RF5G1_TUNE_PADRV5_MASK) >> RF5G_RF5G1_TUNE_PADRV5_LSB) -#define RF5G_RF5G1_TUNE_PADRV5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_TUNE_PADRV5_LSB) & RF5G_RF5G1_TUNE_PADRV5_MASK) -#define RF5G_RF5G1_TUNE_PADRV5_RESET 3'h0 -#define RF5G_RF5G1_PWDTXPKD_MSB 23 -#define RF5G_RF5G1_PWDTXPKD_LSB 21 -#define RF5G_RF5G1_PWDTXPKD_MASK 'h00e00000 -#define RF5G_RF5G1_PWDTXPKD_GET(x) (((x) & RF5G_RF5G1_PWDTXPKD_MASK) >> RF5G_RF5G1_PWDTXPKD_LSB) -#define RF5G_RF5G1_PWDTXPKD_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PWDTXPKD_LSB) & RF5G_RF5G1_PWDTXPKD_MASK) -#define RF5G_RF5G1_PWDTXPKD_RESET 3'h7 -#define RF5G_RF5G1_DB5_MSB 20 -#define RF5G_RF5G1_DB5_LSB 18 -#define RF5G_RF5G1_DB5_MASK 'h001c0000 -#define RF5G_RF5G1_DB5_GET(x) (((x) & RF5G_RF5G1_DB5_MASK) >> RF5G_RF5G1_DB5_LSB) -#define RF5G_RF5G1_DB5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_DB5_LSB) & RF5G_RF5G1_DB5_MASK) -#define RF5G_RF5G1_DB5_RESET 3'h4 -#define RF5G_RF5G1_OB5_MSB 17 -#define RF5G_RF5G1_OB5_LSB 15 -#define RF5G_RF5G1_OB5_MASK 'h00038000 -#define RF5G_RF5G1_OB5_GET(x) (((x) & RF5G_RF5G1_OB5_MASK) >> RF5G_RF5G1_OB5_LSB) -#define RF5G_RF5G1_OB5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_OB5_LSB) & RF5G_RF5G1_OB5_MASK) -#define RF5G_RF5G1_OB5_RESET 3'h4 -#define RF5G_RF5G1_TX5_ATB_SEL_MSB 14 -#define RF5G_RF5G1_TX5_ATB_SEL_LSB 12 -#define RF5G_RF5G1_TX5_ATB_SEL_MASK 'h00007000 -#define RF5G_RF5G1_TX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_TX5_ATB_SEL_MASK) >> RF5G_RF5G1_TX5_ATB_SEL_LSB) -#define RF5G_RF5G1_TX5_ATB_SEL_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_TX5_ATB_SEL_LSB) & RF5G_RF5G1_TX5_ATB_SEL_MASK) -#define RF5G_RF5G1_TX5_ATB_SEL_RESET 3'h0 -#define RF5G_RF5G1_PDLO5DIV_MSB 11 -#define RF5G_RF5G1_PDLO5DIV_LSB 11 -#define RF5G_RF5G1_PDLO5DIV_MASK 'h00000800 -#define RF5G_RF5G1_PDLO5DIV_GET(x) (((x) & RF5G_RF5G1_PDLO5DIV_MASK) >> RF5G_RF5G1_PDLO5DIV_LSB) -#define RF5G_RF5G1_PDLO5DIV_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDLO5DIV_LSB) & RF5G_RF5G1_PDLO5DIV_MASK) -#define RF5G_RF5G1_PDLO5DIV_RESET 1'h0 -#define RF5G_RF5G1_PDLO5MIX_MSB 10 -#define RF5G_RF5G1_PDLO5MIX_LSB 10 -#define RF5G_RF5G1_PDLO5MIX_MASK 'h00000400 -#define RF5G_RF5G1_PDLO5MIX_GET(x) (((x) & RF5G_RF5G1_PDLO5MIX_MASK) >> RF5G_RF5G1_PDLO5MIX_LSB) -#define RF5G_RF5G1_PDLO5MIX_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDLO5MIX_LSB) & RF5G_RF5G1_PDLO5MIX_MASK) -#define RF5G_RF5G1_PDLO5MIX_RESET 1'h0 -#define RF5G_RF5G1_PDQBUF5_MSB 9 -#define RF5G_RF5G1_PDQBUF5_LSB 9 -#define RF5G_RF5G1_PDQBUF5_MASK 'h00000200 -#define RF5G_RF5G1_PDQBUF5_GET(x) (((x) & RF5G_RF5G1_PDQBUF5_MASK) >> RF5G_RF5G1_PDQBUF5_LSB) -#define RF5G_RF5G1_PDQBUF5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDQBUF5_LSB) & RF5G_RF5G1_PDQBUF5_MASK) -#define RF5G_RF5G1_PDQBUF5_RESET 1'h0 -#define RF5G_RF5G1_PDLO5AGC_MSB 8 -#define RF5G_RF5G1_PDLO5AGC_LSB 8 -#define RF5G_RF5G1_PDLO5AGC_MASK 'h00000100 -#define RF5G_RF5G1_PDLO5AGC_GET(x) (((x) & RF5G_RF5G1_PDLO5AGC_MASK) >> RF5G_RF5G1_PDLO5AGC_LSB) -#define RF5G_RF5G1_PDLO5AGC_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDLO5AGC_LSB) & RF5G_RF5G1_PDLO5AGC_MASK) -#define RF5G_RF5G1_PDLO5AGC_RESET 1'h0 -#define RF5G_RF5G1_PDREGLO5_MSB 7 -#define RF5G_RF5G1_PDREGLO5_LSB 7 -#define RF5G_RF5G1_PDREGLO5_MASK 'h00000080 -#define RF5G_RF5G1_PDREGLO5_GET(x) (((x) & RF5G_RF5G1_PDREGLO5_MASK) >> RF5G_RF5G1_PDREGLO5_LSB) -#define RF5G_RF5G1_PDREGLO5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDREGLO5_LSB) & RF5G_RF5G1_PDREGLO5_MASK) -#define RF5G_RF5G1_PDREGLO5_RESET 1'h0 -#define RF5G_RF5G1_LO5_ATB_SEL_MSB 6 -#define RF5G_RF5G1_LO5_ATB_SEL_LSB 4 -#define RF5G_RF5G1_LO5_ATB_SEL_MASK 'h00000070 -#define RF5G_RF5G1_LO5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_LO5_ATB_SEL_MASK) >> RF5G_RF5G1_LO5_ATB_SEL_LSB) -#define RF5G_RF5G1_LO5_ATB_SEL_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_LO5_ATB_SEL_LSB) & RF5G_RF5G1_LO5_ATB_SEL_MASK) -#define RF5G_RF5G1_LO5_ATB_SEL_RESET 3'h0 -#define RF5G_RF5G1_LO5CONTROL_MSB 3 -#define RF5G_RF5G1_LO5CONTROL_LSB 3 -#define RF5G_RF5G1_LO5CONTROL_MASK 'h00000008 -#define RF5G_RF5G1_LO5CONTROL_GET(x) (((x) & RF5G_RF5G1_LO5CONTROL_MASK) >> RF5G_RF5G1_LO5CONTROL_LSB) -#define RF5G_RF5G1_LO5CONTROL_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_LO5CONTROL_LSB) & RF5G_RF5G1_LO5CONTROL_MASK) -#define RF5G_RF5G1_LO5CONTROL_RESET 1'h0 -#define RF5G_RF5G1_REGLO_BYPASS5_MSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_LSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_MASK 'h00000004 -#define RF5G_RF5G1_REGLO_BYPASS5_GET(x) (((x) & RF5G_RF5G1_REGLO_BYPASS5_MASK) >> RF5G_RF5G1_REGLO_BYPASS5_LSB) -#define RF5G_RF5G1_REGLO_BYPASS5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_REGLO_BYPASS5_LSB) & RF5G_RF5G1_REGLO_BYPASS5_MASK) -#define RF5G_RF5G1_REGLO_BYPASS5_RESET 1'h0 -#define RF5G_RF5G1_SPARE_MSB 1 -#define RF5G_RF5G1_SPARE_LSB 0 -#define RF5G_RF5G1_SPARE_MASK 'h00000003 -#define RF5G_RF5G1_SPARE_GET(x) (((x) & RF5G_RF5G1_SPARE_MASK) >> RF5G_RF5G1_SPARE_LSB) -#define RF5G_RF5G1_SPARE_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_SPARE_LSB) & RF5G_RF5G1_SPARE_MASK) -#define RF5G_RF5G1_SPARE_RESET 2'h0 -#define RF5G_RF5G1_RESET (32'h0 | \ - RF5G_RF5G1_PDTXLO5_SET(RF5G_RF5G1_PDTXLO5_RESET) | \ - RF5G_RF5G1_PDTXMIX5_SET(RF5G_RF5G1_PDTXMIX5_RESET) | \ - RF5G_RF5G1_PDTXBUF5_SET(RF5G_RF5G1_PDTXBUF5_RESET) | \ - RF5G_RF5G1_PDPADRV5_SET(RF5G_RF5G1_PDPADRV5_RESET) | \ - RF5G_RF5G1_PDPAOUT5_SET(RF5G_RF5G1_PDPAOUT5_RESET) | \ - RF5G_RF5G1_TUNE_PADRV5_SET(RF5G_RF5G1_TUNE_PADRV5_RESET) | \ - RF5G_RF5G1_PWDTXPKD_SET(RF5G_RF5G1_PWDTXPKD_RESET) | \ - RF5G_RF5G1_DB5_SET(RF5G_RF5G1_DB5_RESET) | \ - RF5G_RF5G1_OB5_SET(RF5G_RF5G1_OB5_RESET) | \ - RF5G_RF5G1_TX5_ATB_SEL_SET(RF5G_RF5G1_TX5_ATB_SEL_RESET) | \ - RF5G_RF5G1_PDLO5DIV_SET(RF5G_RF5G1_PDLO5DIV_RESET) | \ - RF5G_RF5G1_PDLO5MIX_SET(RF5G_RF5G1_PDLO5MIX_RESET) | \ - RF5G_RF5G1_PDQBUF5_SET(RF5G_RF5G1_PDQBUF5_RESET) | \ - RF5G_RF5G1_PDLO5AGC_SET(RF5G_RF5G1_PDLO5AGC_RESET) | \ - RF5G_RF5G1_PDREGLO5_SET(RF5G_RF5G1_PDREGLO5_RESET) | \ - RF5G_RF5G1_LO5_ATB_SEL_SET(RF5G_RF5G1_LO5_ATB_SEL_RESET) | \ - RF5G_RF5G1_LO5CONTROL_SET(RF5G_RF5G1_LO5CONTROL_RESET) | \ - RF5G_RF5G1_REGLO_BYPASS5_SET(RF5G_RF5G1_REGLO_BYPASS5_RESET) | \ - RF5G_RF5G1_SPARE_SET(RF5G_RF5G1_SPARE_RESET)) -#define RF5G_RF5G1_HW_MASK (32'h0) -#define RF5G_RF5G1_SW_MASK (32'h0 | \ - RF5G_RF5G1_PDTXLO5_MASK | \ - RF5G_RF5G1_PDTXMIX5_MASK | \ - RF5G_RF5G1_PDTXBUF5_MASK | \ - RF5G_RF5G1_PDPADRV5_MASK | \ - RF5G_RF5G1_PDPAOUT5_MASK | \ - RF5G_RF5G1_TUNE_PADRV5_MASK | \ - RF5G_RF5G1_PWDTXPKD_MASK | \ - RF5G_RF5G1_DB5_MASK | \ - RF5G_RF5G1_OB5_MASK | \ - RF5G_RF5G1_TX5_ATB_SEL_MASK | \ - RF5G_RF5G1_PDLO5DIV_MASK | \ - RF5G_RF5G1_PDLO5MIX_MASK | \ - RF5G_RF5G1_PDQBUF5_MASK | \ - RF5G_RF5G1_PDLO5AGC_MASK | \ - RF5G_RF5G1_PDREGLO5_MASK | \ - RF5G_RF5G1_LO5_ATB_SEL_MASK | \ - RF5G_RF5G1_LO5CONTROL_MASK | \ - RF5G_RF5G1_REGLO_BYPASS5_MASK | \ - RF5G_RF5G1_SPARE_MASK) - -#define RF5G_RF5G2_ADDRESS 'h00000024 -#define RF5G_RF5G2_AGCLO_B_MSB 31 -#define RF5G_RF5G2_AGCLO_B_LSB 29 -#define RF5G_RF5G2_AGCLO_B_MASK 'he0000000 -#define RF5G_RF5G2_AGCLO_B_GET(x) (((x) & RF5G_RF5G2_AGCLO_B_MASK) >> RF5G_RF5G2_AGCLO_B_LSB) -#define RF5G_RF5G2_AGCLO_B_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_AGCLO_B_LSB) & RF5G_RF5G2_AGCLO_B_MASK) -#define RF5G_RF5G2_AGCLO_B_RESET 3'h4 -#define RF5G_RF5G2_RX5_ATB_SEL_MSB 28 -#define RF5G_RF5G2_RX5_ATB_SEL_LSB 26 -#define RF5G_RF5G2_RX5_ATB_SEL_MASK 'h1c000000 -#define RF5G_RF5G2_RX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G2_RX5_ATB_SEL_MASK) >> RF5G_RF5G2_RX5_ATB_SEL_LSB) -#define RF5G_RF5G2_RX5_ATB_SEL_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_RX5_ATB_SEL_LSB) & RF5G_RF5G2_RX5_ATB_SEL_MASK) -#define RF5G_RF5G2_RX5_ATB_SEL_RESET 3'h0 -#define RF5G_RF5G2_PDCMOSLO5_MSB 25 -#define RF5G_RF5G2_PDCMOSLO5_LSB 25 -#define RF5G_RF5G2_PDCMOSLO5_MASK 'h02000000 -#define RF5G_RF5G2_PDCMOSLO5_GET(x) (((x) & RF5G_RF5G2_PDCMOSLO5_MASK) >> RF5G_RF5G2_PDCMOSLO5_LSB) -#define RF5G_RF5G2_PDCMOSLO5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDCMOSLO5_LSB) & RF5G_RF5G2_PDCMOSLO5_MASK) -#define RF5G_RF5G2_PDCMOSLO5_RESET 1'h0 -#define RF5G_RF5G2_PDVGM5_MSB 24 -#define RF5G_RF5G2_PDVGM5_LSB 24 -#define RF5G_RF5G2_PDVGM5_MASK 'h01000000 -#define RF5G_RF5G2_PDVGM5_GET(x) (((x) & RF5G_RF5G2_PDVGM5_MASK) >> RF5G_RF5G2_PDVGM5_LSB) -#define RF5G_RF5G2_PDVGM5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDVGM5_LSB) & RF5G_RF5G2_PDVGM5_MASK) -#define RF5G_RF5G2_PDVGM5_RESET 1'h0 -#define RF5G_RF5G2_PDCSLNA5_MSB 23 -#define RF5G_RF5G2_PDCSLNA5_LSB 23 -#define RF5G_RF5G2_PDCSLNA5_MASK 'h00800000 -#define RF5G_RF5G2_PDCSLNA5_GET(x) (((x) & RF5G_RF5G2_PDCSLNA5_MASK) >> RF5G_RF5G2_PDCSLNA5_LSB) -#define RF5G_RF5G2_PDCSLNA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDCSLNA5_LSB) & RF5G_RF5G2_PDCSLNA5_MASK) -#define RF5G_RF5G2_PDCSLNA5_RESET 1'h0 -#define RF5G_RF5G2_PDRFVGA5_MSB 22 -#define RF5G_RF5G2_PDRFVGA5_LSB 22 -#define RF5G_RF5G2_PDRFVGA5_MASK 'h00400000 -#define RF5G_RF5G2_PDRFVGA5_GET(x) (((x) & RF5G_RF5G2_PDRFVGA5_MASK) >> RF5G_RF5G2_PDRFVGA5_LSB) -#define RF5G_RF5G2_PDRFVGA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDRFVGA5_LSB) & RF5G_RF5G2_PDRFVGA5_MASK) -#define RF5G_RF5G2_PDRFVGA5_RESET 1'h0 -#define RF5G_RF5G2_PDREGFE5_MSB 21 -#define RF5G_RF5G2_PDREGFE5_LSB 21 -#define RF5G_RF5G2_PDREGFE5_MASK 'h00200000 -#define RF5G_RF5G2_PDREGFE5_GET(x) (((x) & RF5G_RF5G2_PDREGFE5_MASK) >> RF5G_RF5G2_PDREGFE5_LSB) -#define RF5G_RF5G2_PDREGFE5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDREGFE5_LSB) & RF5G_RF5G2_PDREGFE5_MASK) -#define RF5G_RF5G2_PDREGFE5_RESET 1'h0 -#define RF5G_RF5G2_TUNE_RFVGA5_MSB 20 -#define RF5G_RF5G2_TUNE_RFVGA5_LSB 18 -#define RF5G_RF5G2_TUNE_RFVGA5_MASK 'h001c0000 -#define RF5G_RF5G2_TUNE_RFVGA5_GET(x) (((x) & RF5G_RF5G2_TUNE_RFVGA5_MASK) >> RF5G_RF5G2_TUNE_RFVGA5_LSB) -#define RF5G_RF5G2_TUNE_RFVGA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_TUNE_RFVGA5_LSB) & RF5G_RF5G2_TUNE_RFVGA5_MASK) -#define RF5G_RF5G2_TUNE_RFVGA5_RESET 3'h0 -#define RF5G_RF5G2_BRFVGA5_MSB 17 -#define RF5G_RF5G2_BRFVGA5_LSB 15 -#define RF5G_RF5G2_BRFVGA5_MASK 'h00038000 -#define RF5G_RF5G2_BRFVGA5_GET(x) (((x) & RF5G_RF5G2_BRFVGA5_MASK) >> RF5G_RF5G2_BRFVGA5_LSB) -#define RF5G_RF5G2_BRFVGA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_BRFVGA5_LSB) & RF5G_RF5G2_BRFVGA5_MASK) -#define RF5G_RF5G2_BRFVGA5_RESET 3'h5 -#define RF5G_RF5G2_BCSLNA5_MSB 14 -#define RF5G_RF5G2_BCSLNA5_LSB 12 -#define RF5G_RF5G2_BCSLNA5_MASK 'h00007000 -#define RF5G_RF5G2_BCSLNA5_GET(x) (((x) & RF5G_RF5G2_BCSLNA5_MASK) >> RF5G_RF5G2_BCSLNA5_LSB) -#define RF5G_RF5G2_BCSLNA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_BCSLNA5_LSB) & RF5G_RF5G2_BCSLNA5_MASK) -#define RF5G_RF5G2_BCSLNA5_RESET 3'h3 -#define RF5G_RF5G2_BVGM5_MSB 11 -#define RF5G_RF5G2_BVGM5_LSB 9 -#define RF5G_RF5G2_BVGM5_MASK 'h00000e00 -#define RF5G_RF5G2_BVGM5_GET(x) (((x) & RF5G_RF5G2_BVGM5_MASK) >> RF5G_RF5G2_BVGM5_LSB) -#define RF5G_RF5G2_BVGM5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_BVGM5_LSB) & RF5G_RF5G2_BVGM5_MASK) -#define RF5G_RF5G2_BVGM5_RESET 3'h1 -#define RF5G_RF5G2_REGFE_BYPASS5_MSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_LSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_MASK 'h00000100 -#define RF5G_RF5G2_REGFE_BYPASS5_GET(x) (((x) & RF5G_RF5G2_REGFE_BYPASS5_MASK) >> RF5G_RF5G2_REGFE_BYPASS5_LSB) -#define RF5G_RF5G2_REGFE_BYPASS5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_REGFE_BYPASS5_LSB) & RF5G_RF5G2_REGFE_BYPASS5_MASK) -#define RF5G_RF5G2_REGFE_BYPASS5_RESET 1'h0 -#define RF5G_RF5G2_LNA5_ATTENMODE_MSB 7 -#define RF5G_RF5G2_LNA5_ATTENMODE_LSB 6 -#define RF5G_RF5G2_LNA5_ATTENMODE_MASK 'h000000c0 -#define RF5G_RF5G2_LNA5_ATTENMODE_GET(x) (((x) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) >> RF5G_RF5G2_LNA5_ATTENMODE_LSB) -#define RF5G_RF5G2_LNA5_ATTENMODE_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_LNA5_ATTENMODE_LSB) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) -#define RF5G_RF5G2_LNA5_ATTENMODE_RESET 2'h0 -#define RF5G_RF5G2_ENABLE_PCA_MSB 5 -#define RF5G_RF5G2_ENABLE_PCA_LSB 5 -#define RF5G_RF5G2_ENABLE_PCA_MASK 'h00000020 -#define RF5G_RF5G2_ENABLE_PCA_GET(x) (((x) & RF5G_RF5G2_ENABLE_PCA_MASK) >> RF5G_RF5G2_ENABLE_PCA_LSB) -#define RF5G_RF5G2_ENABLE_PCA_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_ENABLE_PCA_LSB) & RF5G_RF5G2_ENABLE_PCA_MASK) -#define RF5G_RF5G2_ENABLE_PCA_RESET 1'h0 -#define RF5G_RF5G2_TUNE_LO_MSB 4 -#define RF5G_RF5G2_TUNE_LO_LSB 2 -#define RF5G_RF5G2_TUNE_LO_MASK 'h0000001c -#define RF5G_RF5G2_TUNE_LO_GET(x) (((x) & RF5G_RF5G2_TUNE_LO_MASK) >> RF5G_RF5G2_TUNE_LO_LSB) -#define RF5G_RF5G2_TUNE_LO_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_TUNE_LO_LSB) & RF5G_RF5G2_TUNE_LO_MASK) -#define RF5G_RF5G2_TUNE_LO_RESET 3'h0 -#define RF5G_RF5G2_SPARE_MSB 1 -#define RF5G_RF5G2_SPARE_LSB 0 -#define RF5G_RF5G2_SPARE_MASK 'h00000003 -#define RF5G_RF5G2_SPARE_GET(x) (((x) & RF5G_RF5G2_SPARE_MASK) >> RF5G_RF5G2_SPARE_LSB) -#define RF5G_RF5G2_SPARE_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_SPARE_LSB) & RF5G_RF5G2_SPARE_MASK) -#define RF5G_RF5G2_SPARE_RESET 2'h0 -#define RF5G_RF5G2_RESET (32'h0 | \ - RF5G_RF5G2_AGCLO_B_SET(RF5G_RF5G2_AGCLO_B_RESET) | \ - RF5G_RF5G2_RX5_ATB_SEL_SET(RF5G_RF5G2_RX5_ATB_SEL_RESET) | \ - RF5G_RF5G2_PDCMOSLO5_SET(RF5G_RF5G2_PDCMOSLO5_RESET) | \ - RF5G_RF5G2_PDVGM5_SET(RF5G_RF5G2_PDVGM5_RESET) | \ - RF5G_RF5G2_PDCSLNA5_SET(RF5G_RF5G2_PDCSLNA5_RESET) | \ - RF5G_RF5G2_PDRFVGA5_SET(RF5G_RF5G2_PDRFVGA5_RESET) | \ - RF5G_RF5G2_PDREGFE5_SET(RF5G_RF5G2_PDREGFE5_RESET) | \ - RF5G_RF5G2_TUNE_RFVGA5_SET(RF5G_RF5G2_TUNE_RFVGA5_RESET) | \ - RF5G_RF5G2_BRFVGA5_SET(RF5G_RF5G2_BRFVGA5_RESET) | \ - RF5G_RF5G2_BCSLNA5_SET(RF5G_RF5G2_BCSLNA5_RESET) | \ - RF5G_RF5G2_BVGM5_SET(RF5G_RF5G2_BVGM5_RESET) | \ - RF5G_RF5G2_REGFE_BYPASS5_SET(RF5G_RF5G2_REGFE_BYPASS5_RESET) | \ - RF5G_RF5G2_LNA5_ATTENMODE_SET(RF5G_RF5G2_LNA5_ATTENMODE_RESET) | \ - RF5G_RF5G2_ENABLE_PCA_SET(RF5G_RF5G2_ENABLE_PCA_RESET) | \ - RF5G_RF5G2_TUNE_LO_SET(RF5G_RF5G2_TUNE_LO_RESET) | \ - RF5G_RF5G2_SPARE_SET(RF5G_RF5G2_SPARE_RESET)) -#define RF5G_RF5G2_HW_MASK (32'h0) -#define RF5G_RF5G2_SW_MASK (32'h0 | \ - RF5G_RF5G2_AGCLO_B_MASK | \ - RF5G_RF5G2_RX5_ATB_SEL_MASK | \ - RF5G_RF5G2_PDCMOSLO5_MASK | \ - RF5G_RF5G2_PDVGM5_MASK | \ - RF5G_RF5G2_PDCSLNA5_MASK | \ - RF5G_RF5G2_PDRFVGA5_MASK | \ - RF5G_RF5G2_PDREGFE5_MASK | \ - RF5G_RF5G2_TUNE_RFVGA5_MASK | \ - RF5G_RF5G2_BRFVGA5_MASK | \ - RF5G_RF5G2_BCSLNA5_MASK | \ - RF5G_RF5G2_BVGM5_MASK | \ - RF5G_RF5G2_REGFE_BYPASS5_MASK | \ - RF5G_RF5G2_LNA5_ATTENMODE_MASK | \ - RF5G_RF5G2_ENABLE_PCA_MASK | \ - RF5G_RF5G2_TUNE_LO_MASK | \ - RF5G_RF5G2_SPARE_MASK) - -#define RF2G_RF2G1_ADDRESS 'h00000028 -#define RF2G_RF2G1_BLNA1_MSB 31 -#define RF2G_RF2G1_BLNA1_LSB 29 -#define RF2G_RF2G1_BLNA1_MASK 'he0000000 -#define RF2G_RF2G1_BLNA1_GET(x) (((x) & RF2G_RF2G1_BLNA1_MASK) >> RF2G_RF2G1_BLNA1_LSB) -#define RF2G_RF2G1_BLNA1_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA1_LSB) & RF2G_RF2G1_BLNA1_MASK) -#define RF2G_RF2G1_BLNA1_RESET 3'h3 -#define RF2G_RF2G1_BLNA1F_MSB 28 -#define RF2G_RF2G1_BLNA1F_LSB 26 -#define RF2G_RF2G1_BLNA1F_MASK 'h1c000000 -#define RF2G_RF2G1_BLNA1F_GET(x) (((x) & RF2G_RF2G1_BLNA1F_MASK) >> RF2G_RF2G1_BLNA1F_LSB) -#define RF2G_RF2G1_BLNA1F_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA1F_LSB) & RF2G_RF2G1_BLNA1F_MASK) -#define RF2G_RF2G1_BLNA1F_RESET 3'h0 -#define RF2G_RF2G1_BLNA1BUF_MSB 25 -#define RF2G_RF2G1_BLNA1BUF_LSB 23 -#define RF2G_RF2G1_BLNA1BUF_MASK 'h03800000 -#define RF2G_RF2G1_BLNA1BUF_GET(x) (((x) & RF2G_RF2G1_BLNA1BUF_MASK) >> RF2G_RF2G1_BLNA1BUF_LSB) -#define RF2G_RF2G1_BLNA1BUF_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA1BUF_LSB) & RF2G_RF2G1_BLNA1BUF_MASK) -#define RF2G_RF2G1_BLNA1BUF_RESET 3'h3 -#define RF2G_RF2G1_BLNA2_MSB 22 -#define RF2G_RF2G1_BLNA2_LSB 20 -#define RF2G_RF2G1_BLNA2_MASK 'h00700000 -#define RF2G_RF2G1_BLNA2_GET(x) (((x) & RF2G_RF2G1_BLNA2_MASK) >> RF2G_RF2G1_BLNA2_LSB) -#define RF2G_RF2G1_BLNA2_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA2_LSB) & RF2G_RF2G1_BLNA2_MASK) -#define RF2G_RF2G1_BLNA2_RESET 3'h3 -#define RF2G_RF2G1_DB_MSB 19 -#define RF2G_RF2G1_DB_LSB 17 -#define RF2G_RF2G1_DB_MASK 'h000e0000 -#define RF2G_RF2G1_DB_GET(x) (((x) & RF2G_RF2G1_DB_MASK) >> RF2G_RF2G1_DB_LSB) -#define RF2G_RF2G1_DB_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_DB_LSB) & RF2G_RF2G1_DB_MASK) -#define RF2G_RF2G1_DB_RESET 3'h3 -#define RF2G_RF2G1_OB_MSB 16 -#define RF2G_RF2G1_OB_LSB 14 -#define RF2G_RF2G1_OB_MASK 'h0001c000 -#define RF2G_RF2G1_OB_GET(x) (((x) & RF2G_RF2G1_OB_MASK) >> RF2G_RF2G1_OB_LSB) -#define RF2G_RF2G1_OB_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_OB_LSB) & RF2G_RF2G1_OB_MASK) -#define RF2G_RF2G1_OB_RESET 3'h3 -#define RF2G_RF2G1_FE_ATB_SEL_MSB 13 -#define RF2G_RF2G1_FE_ATB_SEL_LSB 11 -#define RF2G_RF2G1_FE_ATB_SEL_MASK 'h00003800 -#define RF2G_RF2G1_FE_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_FE_ATB_SEL_MASK) >> RF2G_RF2G1_FE_ATB_SEL_LSB) -#define RF2G_RF2G1_FE_ATB_SEL_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_FE_ATB_SEL_LSB) & RF2G_RF2G1_FE_ATB_SEL_MASK) -#define RF2G_RF2G1_FE_ATB_SEL_RESET 3'h0 -#define RF2G_RF2G1_RF_ATB_SEL_MSB 10 -#define RF2G_RF2G1_RF_ATB_SEL_LSB 8 -#define RF2G_RF2G1_RF_ATB_SEL_MASK 'h00000700 -#define RF2G_RF2G1_RF_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_RF_ATB_SEL_MASK) >> RF2G_RF2G1_RF_ATB_SEL_LSB) -#define RF2G_RF2G1_RF_ATB_SEL_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_RF_ATB_SEL_LSB) & RF2G_RF2G1_RF_ATB_SEL_MASK) -#define RF2G_RF2G1_RF_ATB_SEL_RESET 3'h0 -#define RF2G_RF2G1_SELLNA_MSB 7 -#define RF2G_RF2G1_SELLNA_LSB 7 -#define RF2G_RF2G1_SELLNA_MASK 'h00000080 -#define RF2G_RF2G1_SELLNA_GET(x) (((x) & RF2G_RF2G1_SELLNA_MASK) >> RF2G_RF2G1_SELLNA_LSB) -#define RF2G_RF2G1_SELLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_SELLNA_LSB) & RF2G_RF2G1_SELLNA_MASK) -#define RF2G_RF2G1_SELLNA_RESET 1'h1 -#define RF2G_RF2G1_LOCONTROL_MSB 6 -#define RF2G_RF2G1_LOCONTROL_LSB 6 -#define RF2G_RF2G1_LOCONTROL_MASK 'h00000040 -#define RF2G_RF2G1_LOCONTROL_GET(x) (((x) & RF2G_RF2G1_LOCONTROL_MASK) >> RF2G_RF2G1_LOCONTROL_LSB) -#define RF2G_RF2G1_LOCONTROL_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_LOCONTROL_LSB) & RF2G_RF2G1_LOCONTROL_MASK) -#define RF2G_RF2G1_LOCONTROL_RESET 1'h0 -#define RF2G_RF2G1_SHORTLNA2_MSB 5 -#define RF2G_RF2G1_SHORTLNA2_LSB 5 -#define RF2G_RF2G1_SHORTLNA2_MASK 'h00000020 -#define RF2G_RF2G1_SHORTLNA2_GET(x) (((x) & RF2G_RF2G1_SHORTLNA2_MASK) >> RF2G_RF2G1_SHORTLNA2_LSB) -#define RF2G_RF2G1_SHORTLNA2_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_SHORTLNA2_LSB) & RF2G_RF2G1_SHORTLNA2_MASK) -#define RF2G_RF2G1_SHORTLNA2_RESET 1'h0 -#define RF2G_RF2G1_SPARE_MSB 4 -#define RF2G_RF2G1_SPARE_LSB 0 -#define RF2G_RF2G1_SPARE_MASK 'h0000001f -#define RF2G_RF2G1_SPARE_GET(x) (((x) & RF2G_RF2G1_SPARE_MASK) >> RF2G_RF2G1_SPARE_LSB) -#define RF2G_RF2G1_SPARE_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_SPARE_LSB) & RF2G_RF2G1_SPARE_MASK) -#define RF2G_RF2G1_SPARE_RESET 5'h0 -#define RF2G_RF2G1_RESET (32'h0 | \ - RF2G_RF2G1_BLNA1_SET(RF2G_RF2G1_BLNA1_RESET) | \ - RF2G_RF2G1_BLNA1F_SET(RF2G_RF2G1_BLNA1F_RESET) | \ - RF2G_RF2G1_BLNA1BUF_SET(RF2G_RF2G1_BLNA1BUF_RESET) | \ - RF2G_RF2G1_BLNA2_SET(RF2G_RF2G1_BLNA2_RESET) | \ - RF2G_RF2G1_DB_SET(RF2G_RF2G1_DB_RESET) | \ - RF2G_RF2G1_OB_SET(RF2G_RF2G1_OB_RESET) | \ - RF2G_RF2G1_FE_ATB_SEL_SET(RF2G_RF2G1_FE_ATB_SEL_RESET) | \ - RF2G_RF2G1_RF_ATB_SEL_SET(RF2G_RF2G1_RF_ATB_SEL_RESET) | \ - RF2G_RF2G1_SELLNA_SET(RF2G_RF2G1_SELLNA_RESET) | \ - RF2G_RF2G1_LOCONTROL_SET(RF2G_RF2G1_LOCONTROL_RESET) | \ - RF2G_RF2G1_SHORTLNA2_SET(RF2G_RF2G1_SHORTLNA2_RESET) | \ - RF2G_RF2G1_SPARE_SET(RF2G_RF2G1_SPARE_RESET)) -#define RF2G_RF2G1_HW_MASK (32'h0) -#define RF2G_RF2G1_SW_MASK (32'h0 | \ - RF2G_RF2G1_BLNA1_MASK | \ - RF2G_RF2G1_BLNA1F_MASK | \ - RF2G_RF2G1_BLNA1BUF_MASK | \ - RF2G_RF2G1_BLNA2_MASK | \ - RF2G_RF2G1_DB_MASK | \ - RF2G_RF2G1_OB_MASK | \ - RF2G_RF2G1_FE_ATB_SEL_MASK | \ - RF2G_RF2G1_RF_ATB_SEL_MASK | \ - RF2G_RF2G1_SELLNA_MASK | \ - RF2G_RF2G1_LOCONTROL_MASK | \ - RF2G_RF2G1_SHORTLNA2_MASK | \ - RF2G_RF2G1_SPARE_MASK) - -#define RF2G_RF2G2_ADDRESS 'h0000002c -#define RF2G_RF2G2_PDCGLNA_MSB 31 -#define RF2G_RF2G2_PDCGLNA_LSB 31 -#define RF2G_RF2G2_PDCGLNA_MASK 'h80000000 -#define RF2G_RF2G2_PDCGLNA_GET(x) (((x) & RF2G_RF2G2_PDCGLNA_MASK) >> RF2G_RF2G2_PDCGLNA_LSB) -#define RF2G_RF2G2_PDCGLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDCGLNA_LSB) & RF2G_RF2G2_PDCGLNA_MASK) -#define RF2G_RF2G2_PDCGLNA_RESET 1'h0 -#define RF2G_RF2G2_PDCGLNABUF_MSB 30 -#define RF2G_RF2G2_PDCGLNABUF_LSB 30 -#define RF2G_RF2G2_PDCGLNABUF_MASK 'h40000000 -#define RF2G_RF2G2_PDCGLNABUF_GET(x) (((x) & RF2G_RF2G2_PDCGLNABUF_MASK) >> RF2G_RF2G2_PDCGLNABUF_LSB) -#define RF2G_RF2G2_PDCGLNABUF_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDCGLNABUF_LSB) & RF2G_RF2G2_PDCGLNABUF_MASK) -#define RF2G_RF2G2_PDCGLNABUF_RESET 1'h0 -#define RF2G_RF2G2_PDCSLNA_MSB 29 -#define RF2G_RF2G2_PDCSLNA_LSB 29 -#define RF2G_RF2G2_PDCSLNA_MASK 'h20000000 -#define RF2G_RF2G2_PDCSLNA_GET(x) (((x) & RF2G_RF2G2_PDCSLNA_MASK) >> RF2G_RF2G2_PDCSLNA_LSB) -#define RF2G_RF2G2_PDCSLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDCSLNA_LSB) & RF2G_RF2G2_PDCSLNA_MASK) -#define RF2G_RF2G2_PDCSLNA_RESET 1'h0 -#define RF2G_RF2G2_PDDIV_MSB 28 -#define RF2G_RF2G2_PDDIV_LSB 28 -#define RF2G_RF2G2_PDDIV_MASK 'h10000000 -#define RF2G_RF2G2_PDDIV_GET(x) (((x) & RF2G_RF2G2_PDDIV_MASK) >> RF2G_RF2G2_PDDIV_LSB) -#define RF2G_RF2G2_PDDIV_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDDIV_LSB) & RF2G_RF2G2_PDDIV_MASK) -#define RF2G_RF2G2_PDDIV_RESET 1'h0 -#define RF2G_RF2G2_PDPADRV_MSB 27 -#define RF2G_RF2G2_PDPADRV_LSB 27 -#define RF2G_RF2G2_PDPADRV_MASK 'h08000000 -#define RF2G_RF2G2_PDPADRV_GET(x) (((x) & RF2G_RF2G2_PDPADRV_MASK) >> RF2G_RF2G2_PDPADRV_LSB) -#define RF2G_RF2G2_PDPADRV_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDPADRV_LSB) & RF2G_RF2G2_PDPADRV_MASK) -#define RF2G_RF2G2_PDPADRV_RESET 1'h0 -#define RF2G_RF2G2_PDPAOUT_MSB 26 -#define RF2G_RF2G2_PDPAOUT_LSB 26 -#define RF2G_RF2G2_PDPAOUT_MASK 'h04000000 -#define RF2G_RF2G2_PDPAOUT_GET(x) (((x) & RF2G_RF2G2_PDPAOUT_MASK) >> RF2G_RF2G2_PDPAOUT_LSB) -#define RF2G_RF2G2_PDPAOUT_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDPAOUT_LSB) & RF2G_RF2G2_PDPAOUT_MASK) -#define RF2G_RF2G2_PDPAOUT_RESET 1'h0 -#define RF2G_RF2G2_PDREGLNA_MSB 25 -#define RF2G_RF2G2_PDREGLNA_LSB 25 -#define RF2G_RF2G2_PDREGLNA_MASK 'h02000000 -#define RF2G_RF2G2_PDREGLNA_GET(x) (((x) & RF2G_RF2G2_PDREGLNA_MASK) >> RF2G_RF2G2_PDREGLNA_LSB) -#define RF2G_RF2G2_PDREGLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDREGLNA_LSB) & RF2G_RF2G2_PDREGLNA_MASK) -#define RF2G_RF2G2_PDREGLNA_RESET 1'h0 -#define RF2G_RF2G2_PDREGLO_MSB 24 -#define RF2G_RF2G2_PDREGLO_LSB 24 -#define RF2G_RF2G2_PDREGLO_MASK 'h01000000 -#define RF2G_RF2G2_PDREGLO_GET(x) (((x) & RF2G_RF2G2_PDREGLO_MASK) >> RF2G_RF2G2_PDREGLO_LSB) -#define RF2G_RF2G2_PDREGLO_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDREGLO_LSB) & RF2G_RF2G2_PDREGLO_MASK) -#define RF2G_RF2G2_PDREGLO_RESET 1'h0 -#define RF2G_RF2G2_PDRFGM_MSB 23 -#define RF2G_RF2G2_PDRFGM_LSB 23 -#define RF2G_RF2G2_PDRFGM_MASK 'h00800000 -#define RF2G_RF2G2_PDRFGM_GET(x) (((x) & RF2G_RF2G2_PDRFGM_MASK) >> RF2G_RF2G2_PDRFGM_LSB) -#define RF2G_RF2G2_PDRFGM_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDRFGM_LSB) & RF2G_RF2G2_PDRFGM_MASK) -#define RF2G_RF2G2_PDRFGM_RESET 1'h0 -#define RF2G_RF2G2_PDRXLO_MSB 22 -#define RF2G_RF2G2_PDRXLO_LSB 22 -#define RF2G_RF2G2_PDRXLO_MASK 'h00400000 -#define RF2G_RF2G2_PDRXLO_GET(x) (((x) & RF2G_RF2G2_PDRXLO_MASK) >> RF2G_RF2G2_PDRXLO_LSB) -#define RF2G_RF2G2_PDRXLO_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDRXLO_LSB) & RF2G_RF2G2_PDRXLO_MASK) -#define RF2G_RF2G2_PDRXLO_RESET 1'h0 -#define RF2G_RF2G2_PDTXLO_MSB 21 -#define RF2G_RF2G2_PDTXLO_LSB 21 -#define RF2G_RF2G2_PDTXLO_MASK 'h00200000 -#define RF2G_RF2G2_PDTXLO_GET(x) (((x) & RF2G_RF2G2_PDTXLO_MASK) >> RF2G_RF2G2_PDTXLO_LSB) -#define RF2G_RF2G2_PDTXLO_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDTXLO_LSB) & RF2G_RF2G2_PDTXLO_MASK) -#define RF2G_RF2G2_PDTXLO_RESET 1'h0 -#define RF2G_RF2G2_PDTXMIX_MSB 20 -#define RF2G_RF2G2_PDTXMIX_LSB 20 -#define RF2G_RF2G2_PDTXMIX_MASK 'h00100000 -#define RF2G_RF2G2_PDTXMIX_GET(x) (((x) & RF2G_RF2G2_PDTXMIX_MASK) >> RF2G_RF2G2_PDTXMIX_LSB) -#define RF2G_RF2G2_PDTXMIX_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDTXMIX_LSB) & RF2G_RF2G2_PDTXMIX_MASK) -#define RF2G_RF2G2_PDTXMIX_RESET 1'h0 -#define RF2G_RF2G2_REGLNA_BYPASS_MSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_LSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_MASK 'h00080000 -#define RF2G_RF2G2_REGLNA_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLNA_BYPASS_MASK) >> RF2G_RF2G2_REGLNA_BYPASS_LSB) -#define RF2G_RF2G2_REGLNA_BYPASS_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_REGLNA_BYPASS_LSB) & RF2G_RF2G2_REGLNA_BYPASS_MASK) -#define RF2G_RF2G2_REGLNA_BYPASS_RESET 1'h0 -#define RF2G_RF2G2_REGLO_BYPASS_MSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_LSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_MASK 'h00040000 -#define RF2G_RF2G2_REGLO_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLO_BYPASS_MASK) >> RF2G_RF2G2_REGLO_BYPASS_LSB) -#define RF2G_RF2G2_REGLO_BYPASS_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_REGLO_BYPASS_LSB) & RF2G_RF2G2_REGLO_BYPASS_MASK) -#define RF2G_RF2G2_REGLO_BYPASS_RESET 1'h0 -#define RF2G_RF2G2_ENABLE_PCB_MSB 17 -#define RF2G_RF2G2_ENABLE_PCB_LSB 17 -#define RF2G_RF2G2_ENABLE_PCB_MASK 'h00020000 -#define RF2G_RF2G2_ENABLE_PCB_GET(x) (((x) & RF2G_RF2G2_ENABLE_PCB_MASK) >> RF2G_RF2G2_ENABLE_PCB_LSB) -#define RF2G_RF2G2_ENABLE_PCB_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_ENABLE_PCB_LSB) & RF2G_RF2G2_ENABLE_PCB_MASK) -#define RF2G_RF2G2_ENABLE_PCB_RESET 1'h0 -#define RF2G_RF2G2_SPARE_MSB 16 -#define RF2G_RF2G2_SPARE_LSB 0 -#define RF2G_RF2G2_SPARE_MASK 'h0001ffff -#define RF2G_RF2G2_SPARE_GET(x) (((x) & RF2G_RF2G2_SPARE_MASK) >> RF2G_RF2G2_SPARE_LSB) -#define RF2G_RF2G2_SPARE_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_SPARE_LSB) & RF2G_RF2G2_SPARE_MASK) -#define RF2G_RF2G2_SPARE_RESET 17'h0 -#define RF2G_RF2G2_RESET (32'h0 | \ - RF2G_RF2G2_PDCGLNA_SET(RF2G_RF2G2_PDCGLNA_RESET) | \ - RF2G_RF2G2_PDCGLNABUF_SET(RF2G_RF2G2_PDCGLNABUF_RESET) | \ - RF2G_RF2G2_PDCSLNA_SET(RF2G_RF2G2_PDCSLNA_RESET) | \ - RF2G_RF2G2_PDDIV_SET(RF2G_RF2G2_PDDIV_RESET) | \ - RF2G_RF2G2_PDPADRV_SET(RF2G_RF2G2_PDPADRV_RESET) | \ - RF2G_RF2G2_PDPAOUT_SET(RF2G_RF2G2_PDPAOUT_RESET) | \ - RF2G_RF2G2_PDREGLNA_SET(RF2G_RF2G2_PDREGLNA_RESET) | \ - RF2G_RF2G2_PDREGLO_SET(RF2G_RF2G2_PDREGLO_RESET) | \ - RF2G_RF2G2_PDRFGM_SET(RF2G_RF2G2_PDRFGM_RESET) | \ - RF2G_RF2G2_PDRXLO_SET(RF2G_RF2G2_PDRXLO_RESET) | \ - RF2G_RF2G2_PDTXLO_SET(RF2G_RF2G2_PDTXLO_RESET) | \ - RF2G_RF2G2_PDTXMIX_SET(RF2G_RF2G2_PDTXMIX_RESET) | \ - RF2G_RF2G2_REGLNA_BYPASS_SET(RF2G_RF2G2_REGLNA_BYPASS_RESET) | \ - RF2G_RF2G2_REGLO_BYPASS_SET(RF2G_RF2G2_REGLO_BYPASS_RESET) | \ - RF2G_RF2G2_ENABLE_PCB_SET(RF2G_RF2G2_ENABLE_PCB_RESET) | \ - RF2G_RF2G2_SPARE_SET(RF2G_RF2G2_SPARE_RESET)) -#define RF2G_RF2G2_HW_MASK (32'h0) -#define RF2G_RF2G2_SW_MASK (32'h0 | \ - RF2G_RF2G2_PDCGLNA_MASK | \ - RF2G_RF2G2_PDCGLNABUF_MASK | \ - RF2G_RF2G2_PDCSLNA_MASK | \ - RF2G_RF2G2_PDDIV_MASK | \ - RF2G_RF2G2_PDPADRV_MASK | \ - RF2G_RF2G2_PDPAOUT_MASK | \ - RF2G_RF2G2_PDREGLNA_MASK | \ - RF2G_RF2G2_PDREGLO_MASK | \ - RF2G_RF2G2_PDRFGM_MASK | \ - RF2G_RF2G2_PDRXLO_MASK | \ - RF2G_RF2G2_PDTXLO_MASK | \ - RF2G_RF2G2_PDTXMIX_MASK | \ - RF2G_RF2G2_REGLNA_BYPASS_MASK | \ - RF2G_RF2G2_REGLO_BYPASS_MASK | \ - RF2G_RF2G2_ENABLE_PCB_MASK | \ - RF2G_RF2G2_SPARE_MASK) - -#define TOP_GAIN_ADDRESS 'h00000030 -#define TOP_GAIN_TX6DBLOQGAIN_MSB 31 -#define TOP_GAIN_TX6DBLOQGAIN_LSB 30 -#define TOP_GAIN_TX6DBLOQGAIN_MASK 'hc0000000 -#define TOP_GAIN_TX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX6DBLOQGAIN_MASK) >> TOP_GAIN_TX6DBLOQGAIN_LSB) -#define TOP_GAIN_TX6DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_TX6DBLOQGAIN_LSB) & TOP_GAIN_TX6DBLOQGAIN_MASK) -#define TOP_GAIN_TX6DBLOQGAIN_RESET 2'h3 -#define TOP_GAIN_TX1DBLOQGAIN_MSB 29 -#define TOP_GAIN_TX1DBLOQGAIN_LSB 27 -#define TOP_GAIN_TX1DBLOQGAIN_MASK 'h38000000 -#define TOP_GAIN_TX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX1DBLOQGAIN_MASK) >> TOP_GAIN_TX1DBLOQGAIN_LSB) -#define TOP_GAIN_TX1DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_TX1DBLOQGAIN_LSB) & TOP_GAIN_TX1DBLOQGAIN_MASK) -#define TOP_GAIN_TX1DBLOQGAIN_RESET 3'h6 -#define TOP_GAIN_TXV2IGAIN_MSB 26 -#define TOP_GAIN_TXV2IGAIN_LSB 25 -#define TOP_GAIN_TXV2IGAIN_MASK 'h06000000 -#define TOP_GAIN_TXV2IGAIN_GET(x) (((x) & TOP_GAIN_TXV2IGAIN_MASK) >> TOP_GAIN_TXV2IGAIN_LSB) -#define TOP_GAIN_TXV2IGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_TXV2IGAIN_LSB) & TOP_GAIN_TXV2IGAIN_MASK) -#define TOP_GAIN_TXV2IGAIN_RESET 2'h3 -#define TOP_GAIN_PABUF5GN_MSB 24 -#define TOP_GAIN_PABUF5GN_LSB 24 -#define TOP_GAIN_PABUF5GN_MASK 'h01000000 -#define TOP_GAIN_PABUF5GN_GET(x) (((x) & TOP_GAIN_PABUF5GN_MASK) >> TOP_GAIN_PABUF5GN_LSB) -#define TOP_GAIN_PABUF5GN_SET(x) (((32'd0 | (x)) << TOP_GAIN_PABUF5GN_LSB) & TOP_GAIN_PABUF5GN_MASK) -#define TOP_GAIN_PABUF5GN_RESET 1'h1 -#define TOP_GAIN_PADRVGN_MSB 23 -#define TOP_GAIN_PADRVGN_LSB 21 -#define TOP_GAIN_PADRVGN_MASK 'h00e00000 -#define TOP_GAIN_PADRVGN_GET(x) (((x) & TOP_GAIN_PADRVGN_MASK) >> TOP_GAIN_PADRVGN_LSB) -#define TOP_GAIN_PADRVGN_SET(x) (((32'd0 | (x)) << TOP_GAIN_PADRVGN_LSB) & TOP_GAIN_PADRVGN_MASK) -#define TOP_GAIN_PADRVGN_RESET 3'h7 -#define TOP_GAIN_PAOUT2GN_MSB 20 -#define TOP_GAIN_PAOUT2GN_LSB 18 -#define TOP_GAIN_PAOUT2GN_MASK 'h001c0000 -#define TOP_GAIN_PAOUT2GN_GET(x) (((x) & TOP_GAIN_PAOUT2GN_MASK) >> TOP_GAIN_PAOUT2GN_LSB) -#define TOP_GAIN_PAOUT2GN_SET(x) (((32'd0 | (x)) << TOP_GAIN_PAOUT2GN_LSB) & TOP_GAIN_PAOUT2GN_MASK) -#define TOP_GAIN_PAOUT2GN_RESET 3'h7 -#define TOP_GAIN_LNAON_MSB 17 -#define TOP_GAIN_LNAON_LSB 17 -#define TOP_GAIN_LNAON_MASK 'h00020000 -#define TOP_GAIN_LNAON_GET(x) (((x) & TOP_GAIN_LNAON_MASK) >> TOP_GAIN_LNAON_LSB) -#define TOP_GAIN_LNAON_SET(x) (((32'd0 | (x)) << TOP_GAIN_LNAON_LSB) & TOP_GAIN_LNAON_MASK) -#define TOP_GAIN_LNAON_RESET 1'h1 -#define TOP_GAIN_LNAGAIN_MSB 16 -#define TOP_GAIN_LNAGAIN_LSB 13 -#define TOP_GAIN_LNAGAIN_MASK 'h0001e000 -#define TOP_GAIN_LNAGAIN_GET(x) (((x) & TOP_GAIN_LNAGAIN_MASK) >> TOP_GAIN_LNAGAIN_LSB) -#define TOP_GAIN_LNAGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_LNAGAIN_LSB) & TOP_GAIN_LNAGAIN_MASK) -#define TOP_GAIN_LNAGAIN_RESET 4'hf -#define TOP_GAIN_RFVGA5GAIN_MSB 12 -#define TOP_GAIN_RFVGA5GAIN_LSB 11 -#define TOP_GAIN_RFVGA5GAIN_MASK 'h00001800 -#define TOP_GAIN_RFVGA5GAIN_GET(x) (((x) & TOP_GAIN_RFVGA5GAIN_MASK) >> TOP_GAIN_RFVGA5GAIN_LSB) -#define TOP_GAIN_RFVGA5GAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RFVGA5GAIN_LSB) & TOP_GAIN_RFVGA5GAIN_MASK) -#define TOP_GAIN_RFVGA5GAIN_RESET 2'h3 -#define TOP_GAIN_RFGMGN_MSB 10 -#define TOP_GAIN_RFGMGN_LSB 8 -#define TOP_GAIN_RFGMGN_MASK 'h00000700 -#define TOP_GAIN_RFGMGN_GET(x) (((x) & TOP_GAIN_RFGMGN_MASK) >> TOP_GAIN_RFGMGN_LSB) -#define TOP_GAIN_RFGMGN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RFGMGN_LSB) & TOP_GAIN_RFGMGN_MASK) -#define TOP_GAIN_RFGMGN_RESET 3'h7 -#define TOP_GAIN_RX6DBLOQGAIN_MSB 7 -#define TOP_GAIN_RX6DBLOQGAIN_LSB 6 -#define TOP_GAIN_RX6DBLOQGAIN_MASK 'h000000c0 -#define TOP_GAIN_RX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBLOQGAIN_MASK) >> TOP_GAIN_RX6DBLOQGAIN_LSB) -#define TOP_GAIN_RX6DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RX6DBLOQGAIN_LSB) & TOP_GAIN_RX6DBLOQGAIN_MASK) -#define TOP_GAIN_RX6DBLOQGAIN_RESET 2'h3 -#define TOP_GAIN_RX1DBLOQGAIN_MSB 5 -#define TOP_GAIN_RX1DBLOQGAIN_LSB 3 -#define TOP_GAIN_RX1DBLOQGAIN_MASK 'h00000038 -#define TOP_GAIN_RX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX1DBLOQGAIN_MASK) >> TOP_GAIN_RX1DBLOQGAIN_LSB) -#define TOP_GAIN_RX1DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RX1DBLOQGAIN_LSB) & TOP_GAIN_RX1DBLOQGAIN_MASK) -#define TOP_GAIN_RX1DBLOQGAIN_RESET 3'h6 -#define TOP_GAIN_RX6DBHIQGAIN_MSB 2 -#define TOP_GAIN_RX6DBHIQGAIN_LSB 1 -#define TOP_GAIN_RX6DBHIQGAIN_MASK 'h00000006 -#define TOP_GAIN_RX6DBHIQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBHIQGAIN_MASK) >> TOP_GAIN_RX6DBHIQGAIN_LSB) -#define TOP_GAIN_RX6DBHIQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RX6DBHIQGAIN_LSB) & TOP_GAIN_RX6DBHIQGAIN_MASK) -#define TOP_GAIN_RX6DBHIQGAIN_RESET 2'h3 -#define TOP_GAIN_SPARE_MSB 0 -#define TOP_GAIN_SPARE_LSB 0 -#define TOP_GAIN_SPARE_MASK 'h00000001 -#define TOP_GAIN_SPARE_GET(x) (((x) & TOP_GAIN_SPARE_MASK) >> TOP_GAIN_SPARE_LSB) -#define TOP_GAIN_SPARE_SET(x) (((32'd0 | (x)) << TOP_GAIN_SPARE_LSB) & TOP_GAIN_SPARE_MASK) -#define TOP_GAIN_SPARE_RESET 1'h0 -#define TOP_GAIN_RESET (32'h0 | \ - TOP_GAIN_TX6DBLOQGAIN_SET(TOP_GAIN_TX6DBLOQGAIN_RESET) | \ - TOP_GAIN_TX1DBLOQGAIN_SET(TOP_GAIN_TX1DBLOQGAIN_RESET) | \ - TOP_GAIN_TXV2IGAIN_SET(TOP_GAIN_TXV2IGAIN_RESET) | \ - TOP_GAIN_PABUF5GN_SET(TOP_GAIN_PABUF5GN_RESET) | \ - TOP_GAIN_PADRVGN_SET(TOP_GAIN_PADRVGN_RESET) | \ - TOP_GAIN_PAOUT2GN_SET(TOP_GAIN_PAOUT2GN_RESET) | \ - TOP_GAIN_LNAON_SET(TOP_GAIN_LNAON_RESET) | \ - TOP_GAIN_LNAGAIN_SET(TOP_GAIN_LNAGAIN_RESET) | \ - TOP_GAIN_RFVGA5GAIN_SET(TOP_GAIN_RFVGA5GAIN_RESET) | \ - TOP_GAIN_RFGMGN_SET(TOP_GAIN_RFGMGN_RESET) | \ - TOP_GAIN_RX6DBLOQGAIN_SET(TOP_GAIN_RX6DBLOQGAIN_RESET) | \ - TOP_GAIN_RX1DBLOQGAIN_SET(TOP_GAIN_RX1DBLOQGAIN_RESET) | \ - TOP_GAIN_RX6DBHIQGAIN_SET(TOP_GAIN_RX6DBHIQGAIN_RESET) | \ - TOP_GAIN_SPARE_SET(TOP_GAIN_SPARE_RESET)) -#define TOP_GAIN_HW_MASK (32'h0 | \ - TOP_GAIN_TX6DBLOQGAIN_MASK | \ - TOP_GAIN_TX1DBLOQGAIN_MASK | \ - TOP_GAIN_TXV2IGAIN_MASK | \ - TOP_GAIN_PABUF5GN_MASK | \ - TOP_GAIN_PADRVGN_MASK | \ - TOP_GAIN_PAOUT2GN_MASK | \ - TOP_GAIN_LNAON_MASK | \ - TOP_GAIN_LNAGAIN_MASK | \ - TOP_GAIN_RFVGA5GAIN_MASK | \ - TOP_GAIN_RFGMGN_MASK | \ - TOP_GAIN_RX6DBLOQGAIN_MASK | \ - TOP_GAIN_RX1DBLOQGAIN_MASK | \ - TOP_GAIN_RX6DBHIQGAIN_MASK | \ - TOP_GAIN_SPARE_MASK) -#define TOP_GAIN_SW_MASK (32'h0 | \ - TOP_GAIN_TX6DBLOQGAIN_MASK | \ - TOP_GAIN_TX1DBLOQGAIN_MASK | \ - TOP_GAIN_TXV2IGAIN_MASK | \ - TOP_GAIN_PABUF5GN_MASK | \ - TOP_GAIN_PADRVGN_MASK | \ - TOP_GAIN_PAOUT2GN_MASK | \ - TOP_GAIN_LNAON_MASK | \ - TOP_GAIN_LNAGAIN_MASK | \ - TOP_GAIN_RFVGA5GAIN_MASK | \ - TOP_GAIN_RFGMGN_MASK | \ - TOP_GAIN_RX6DBLOQGAIN_MASK | \ - TOP_GAIN_RX1DBLOQGAIN_MASK | \ - TOP_GAIN_RX6DBHIQGAIN_MASK | \ - TOP_GAIN_SPARE_MASK) - -#define TOP_TOP_ADDRESS 'h00000034 -#define TOP_TOP_LOCALTXGAIN_MSB 31 -#define TOP_TOP_LOCALTXGAIN_LSB 31 -#define TOP_TOP_LOCALTXGAIN_MASK 'h80000000 -#define TOP_TOP_LOCALTXGAIN_GET(x) (((x) & TOP_TOP_LOCALTXGAIN_MASK) >> TOP_TOP_LOCALTXGAIN_LSB) -#define TOP_TOP_LOCALTXGAIN_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALTXGAIN_LSB) & TOP_TOP_LOCALTXGAIN_MASK) -#define TOP_TOP_LOCALTXGAIN_RESET 1'h0 -#define TOP_TOP_LOCALRXGAIN_MSB 30 -#define TOP_TOP_LOCALRXGAIN_LSB 30 -#define TOP_TOP_LOCALRXGAIN_MASK 'h40000000 -#define TOP_TOP_LOCALRXGAIN_GET(x) (((x) & TOP_TOP_LOCALRXGAIN_MASK) >> TOP_TOP_LOCALRXGAIN_LSB) -#define TOP_TOP_LOCALRXGAIN_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALRXGAIN_LSB) & TOP_TOP_LOCALRXGAIN_MASK) -#define TOP_TOP_LOCALRXGAIN_RESET 1'h0 -#define TOP_TOP_LOCALMODE_MSB 29 -#define TOP_TOP_LOCALMODE_LSB 29 -#define TOP_TOP_LOCALMODE_MASK 'h20000000 -#define TOP_TOP_LOCALMODE_GET(x) (((x) & TOP_TOP_LOCALMODE_MASK) >> TOP_TOP_LOCALMODE_LSB) -#define TOP_TOP_LOCALMODE_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALMODE_LSB) & TOP_TOP_LOCALMODE_MASK) -#define TOP_TOP_LOCALMODE_RESET 1'h0 -#define TOP_TOP_CALFC_MSB 28 -#define TOP_TOP_CALFC_LSB 28 -#define TOP_TOP_CALFC_MASK 'h10000000 -#define TOP_TOP_CALFC_GET(x) (((x) & TOP_TOP_CALFC_MASK) >> TOP_TOP_CALFC_LSB) -#define TOP_TOP_CALFC_SET(x) (((32'd0 | (x)) << TOP_TOP_CALFC_LSB) & TOP_TOP_CALFC_MASK) -#define TOP_TOP_CALFC_RESET 1'h0 -#define TOP_TOP_CALDC_MSB 27 -#define TOP_TOP_CALDC_LSB 27 -#define TOP_TOP_CALDC_MASK 'h08000000 -#define TOP_TOP_CALDC_GET(x) (((x) & TOP_TOP_CALDC_MASK) >> TOP_TOP_CALDC_LSB) -#define TOP_TOP_CALDC_SET(x) (((32'd0 | (x)) << TOP_TOP_CALDC_LSB) & TOP_TOP_CALDC_MASK) -#define TOP_TOP_CALDC_RESET 1'h0 -#define TOP_TOP_CAL_RESIDUE_MSB 26 -#define TOP_TOP_CAL_RESIDUE_LSB 26 -#define TOP_TOP_CAL_RESIDUE_MASK 'h04000000 -#define TOP_TOP_CAL_RESIDUE_GET(x) (((x) & TOP_TOP_CAL_RESIDUE_MASK) >> TOP_TOP_CAL_RESIDUE_LSB) -#define TOP_TOP_CAL_RESIDUE_SET(x) (((32'd0 | (x)) << TOP_TOP_CAL_RESIDUE_LSB) & TOP_TOP_CAL_RESIDUE_MASK) -#define TOP_TOP_CAL_RESIDUE_RESET 1'h0 -#define TOP_TOP_BMODE_MSB 25 -#define TOP_TOP_BMODE_LSB 25 -#define TOP_TOP_BMODE_MASK 'h02000000 -#define TOP_TOP_BMODE_GET(x) (((x) & TOP_TOP_BMODE_MASK) >> TOP_TOP_BMODE_LSB) -#define TOP_TOP_BMODE_SET(x) (((32'd0 | (x)) << TOP_TOP_BMODE_LSB) & TOP_TOP_BMODE_MASK) -#define TOP_TOP_BMODE_RESET 1'h1 -#define TOP_TOP_SYNTHON_MSB 24 -#define TOP_TOP_SYNTHON_LSB 24 -#define TOP_TOP_SYNTHON_MASK 'h01000000 -#define TOP_TOP_SYNTHON_GET(x) (((x) & TOP_TOP_SYNTHON_MASK) >> TOP_TOP_SYNTHON_LSB) -#define TOP_TOP_SYNTHON_SET(x) (((32'd0 | (x)) << TOP_TOP_SYNTHON_LSB) & TOP_TOP_SYNTHON_MASK) -#define TOP_TOP_SYNTHON_RESET 1'h0 -#define TOP_TOP_RXON_MSB 23 -#define TOP_TOP_RXON_LSB 23 -#define TOP_TOP_RXON_MASK 'h00800000 -#define TOP_TOP_RXON_GET(x) (((x) & TOP_TOP_RXON_MASK) >> TOP_TOP_RXON_LSB) -#define TOP_TOP_RXON_SET(x) (((32'd0 | (x)) << TOP_TOP_RXON_LSB) & TOP_TOP_RXON_MASK) -#define TOP_TOP_RXON_RESET 1'h0 -#define TOP_TOP_TXON_MSB 22 -#define TOP_TOP_TXON_LSB 22 -#define TOP_TOP_TXON_MASK 'h00400000 -#define TOP_TOP_TXON_GET(x) (((x) & TOP_TOP_TXON_MASK) >> TOP_TOP_TXON_LSB) -#define TOP_TOP_TXON_SET(x) (((32'd0 | (x)) << TOP_TOP_TXON_LSB) & TOP_TOP_TXON_MASK) -#define TOP_TOP_TXON_RESET 1'h0 -#define TOP_TOP_PAON_MSB 21 -#define TOP_TOP_PAON_LSB 21 -#define TOP_TOP_PAON_MASK 'h00200000 -#define TOP_TOP_PAON_GET(x) (((x) & TOP_TOP_PAON_MASK) >> TOP_TOP_PAON_LSB) -#define TOP_TOP_PAON_SET(x) (((32'd0 | (x)) << TOP_TOP_PAON_LSB) & TOP_TOP_PAON_MASK) -#define TOP_TOP_PAON_RESET 1'h0 -#define TOP_TOP_CALTX_MSB 20 -#define TOP_TOP_CALTX_LSB 20 -#define TOP_TOP_CALTX_MASK 'h00100000 -#define TOP_TOP_CALTX_GET(x) (((x) & TOP_TOP_CALTX_MASK) >> TOP_TOP_CALTX_LSB) -#define TOP_TOP_CALTX_SET(x) (((32'd0 | (x)) << TOP_TOP_CALTX_LSB) & TOP_TOP_CALTX_MASK) -#define TOP_TOP_CALTX_RESET 1'h0 -#define TOP_TOP_LOCALADDAC_MSB 19 -#define TOP_TOP_LOCALADDAC_LSB 19 -#define TOP_TOP_LOCALADDAC_MASK 'h00080000 -#define TOP_TOP_LOCALADDAC_GET(x) (((x) & TOP_TOP_LOCALADDAC_MASK) >> TOP_TOP_LOCALADDAC_LSB) -#define TOP_TOP_LOCALADDAC_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALADDAC_LSB) & TOP_TOP_LOCALADDAC_MASK) -#define TOP_TOP_LOCALADDAC_RESET 1'h0 -#define TOP_TOP_PWDPLL_MSB 18 -#define TOP_TOP_PWDPLL_LSB 18 -#define TOP_TOP_PWDPLL_MASK 'h00040000 -#define TOP_TOP_PWDPLL_GET(x) (((x) & TOP_TOP_PWDPLL_MASK) >> TOP_TOP_PWDPLL_LSB) -#define TOP_TOP_PWDPLL_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDPLL_LSB) & TOP_TOP_PWDPLL_MASK) -#define TOP_TOP_PWDPLL_RESET 1'h0 -#define TOP_TOP_PWDADC_MSB 17 -#define TOP_TOP_PWDADC_LSB 17 -#define TOP_TOP_PWDADC_MASK 'h00020000 -#define TOP_TOP_PWDADC_GET(x) (((x) & TOP_TOP_PWDADC_MASK) >> TOP_TOP_PWDADC_LSB) -#define TOP_TOP_PWDADC_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDADC_LSB) & TOP_TOP_PWDADC_MASK) -#define TOP_TOP_PWDADC_RESET 1'h0 -#define TOP_TOP_PWDDAC_MSB 16 -#define TOP_TOP_PWDDAC_LSB 16 -#define TOP_TOP_PWDDAC_MASK 'h00010000 -#define TOP_TOP_PWDDAC_GET(x) (((x) & TOP_TOP_PWDDAC_MASK) >> TOP_TOP_PWDDAC_LSB) -#define TOP_TOP_PWDDAC_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDDAC_LSB) & TOP_TOP_PWDDAC_MASK) -#define TOP_TOP_PWDDAC_RESET 1'h0 -#define TOP_TOP_LOCALXTAL_MSB 15 -#define TOP_TOP_LOCALXTAL_LSB 15 -#define TOP_TOP_LOCALXTAL_MASK 'h00008000 -#define TOP_TOP_LOCALXTAL_GET(x) (((x) & TOP_TOP_LOCALXTAL_MASK) >> TOP_TOP_LOCALXTAL_LSB) -#define TOP_TOP_LOCALXTAL_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALXTAL_LSB) & TOP_TOP_LOCALXTAL_MASK) -#define TOP_TOP_LOCALXTAL_RESET 1'h0 -#define TOP_TOP_PWDCLKIN_MSB 14 -#define TOP_TOP_PWDCLKIN_LSB 14 -#define TOP_TOP_PWDCLKIN_MASK 'h00004000 -#define TOP_TOP_PWDCLKIN_GET(x) (((x) & TOP_TOP_PWDCLKIN_MASK) >> TOP_TOP_PWDCLKIN_LSB) -#define TOP_TOP_PWDCLKIN_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDCLKIN_LSB) & TOP_TOP_PWDCLKIN_MASK) -#define TOP_TOP_PWDCLKIN_RESET 1'h0 -#define TOP_TOP_OSCON_MSB 13 -#define TOP_TOP_OSCON_LSB 13 -#define TOP_TOP_OSCON_MASK 'h00002000 -#define TOP_TOP_OSCON_GET(x) (((x) & TOP_TOP_OSCON_MASK) >> TOP_TOP_OSCON_LSB) -#define TOP_TOP_OSCON_SET(x) (((32'd0 | (x)) << TOP_TOP_OSCON_LSB) & TOP_TOP_OSCON_MASK) -#define TOP_TOP_OSCON_RESET 1'h1 -#define TOP_TOP_SCLKEN_FORCE_MSB 12 -#define TOP_TOP_SCLKEN_FORCE_LSB 12 -#define TOP_TOP_SCLKEN_FORCE_MASK 'h00001000 -#define TOP_TOP_SCLKEN_FORCE_GET(x) (((x) & TOP_TOP_SCLKEN_FORCE_MASK) >> TOP_TOP_SCLKEN_FORCE_LSB) -#define TOP_TOP_SCLKEN_FORCE_SET(x) (((32'd0 | (x)) << TOP_TOP_SCLKEN_FORCE_LSB) & TOP_TOP_SCLKEN_FORCE_MASK) -#define TOP_TOP_SCLKEN_FORCE_RESET 1'h0 -#define TOP_TOP_SYNTHON_FORCE_MSB 11 -#define TOP_TOP_SYNTHON_FORCE_LSB 11 -#define TOP_TOP_SYNTHON_FORCE_MASK 'h00000800 -#define TOP_TOP_SYNTHON_FORCE_GET(x) (((x) & TOP_TOP_SYNTHON_FORCE_MASK) >> TOP_TOP_SYNTHON_FORCE_LSB) -#define TOP_TOP_SYNTHON_FORCE_SET(x) (((32'd0 | (x)) << TOP_TOP_SYNTHON_FORCE_LSB) & TOP_TOP_SYNTHON_FORCE_MASK) -#define TOP_TOP_SYNTHON_FORCE_RESET 1'h0 -#define TOP_TOP_PDBIAS_MSB 10 -#define TOP_TOP_PDBIAS_LSB 10 -#define TOP_TOP_PDBIAS_MASK 'h00000400 -#define TOP_TOP_PDBIAS_GET(x) (((x) & TOP_TOP_PDBIAS_MASK) >> TOP_TOP_PDBIAS_LSB) -#define TOP_TOP_PDBIAS_SET(x) (((32'd0 | (x)) << TOP_TOP_PDBIAS_LSB) & TOP_TOP_PDBIAS_MASK) -#define TOP_TOP_PDBIAS_RESET 1'h0 -#define TOP_TOP_DATAOUTSEL_MSB 9 -#define TOP_TOP_DATAOUTSEL_LSB 8 -#define TOP_TOP_DATAOUTSEL_MASK 'h00000300 -#define TOP_TOP_DATAOUTSEL_GET(x) (((x) & TOP_TOP_DATAOUTSEL_MASK) >> TOP_TOP_DATAOUTSEL_LSB) -#define TOP_TOP_DATAOUTSEL_SET(x) (((32'd0 | (x)) << TOP_TOP_DATAOUTSEL_LSB) & TOP_TOP_DATAOUTSEL_MASK) -#define TOP_TOP_DATAOUTSEL_RESET 2'h3 -#define TOP_TOP_REVID_MSB 7 -#define TOP_TOP_REVID_LSB 5 -#define TOP_TOP_REVID_MASK 'h000000e0 -#define TOP_TOP_REVID_GET(x) (((x) & TOP_TOP_REVID_MASK) >> TOP_TOP_REVID_LSB) -#define TOP_TOP_REVID_SET(x) (((32'd0 | (x)) << TOP_TOP_REVID_LSB) & TOP_TOP_REVID_MASK) -#define TOP_TOP_REVID_RESET 3'h0 -#define TOP_TOP_INT2PAD_MSB 4 -#define TOP_TOP_INT2PAD_LSB 4 -#define TOP_TOP_INT2PAD_MASK 'h00000010 -#define TOP_TOP_INT2PAD_GET(x) (((x) & TOP_TOP_INT2PAD_MASK) >> TOP_TOP_INT2PAD_LSB) -#define TOP_TOP_INT2PAD_SET(x) (((32'd0 | (x)) << TOP_TOP_INT2PAD_LSB) & TOP_TOP_INT2PAD_MASK) -#define TOP_TOP_INT2PAD_RESET 1'h0 -#define TOP_TOP_INTH2PAD_MSB 3 -#define TOP_TOP_INTH2PAD_LSB 3 -#define TOP_TOP_INTH2PAD_MASK 'h00000008 -#define TOP_TOP_INTH2PAD_GET(x) (((x) & TOP_TOP_INTH2PAD_MASK) >> TOP_TOP_INTH2PAD_LSB) -#define TOP_TOP_INTH2PAD_SET(x) (((32'd0 | (x)) << TOP_TOP_INTH2PAD_LSB) & TOP_TOP_INTH2PAD_MASK) -#define TOP_TOP_INTH2PAD_RESET 1'h0 -#define TOP_TOP_PAD2GND_MSB 2 -#define TOP_TOP_PAD2GND_LSB 2 -#define TOP_TOP_PAD2GND_MASK 'h00000004 -#define TOP_TOP_PAD2GND_GET(x) (((x) & TOP_TOP_PAD2GND_MASK) >> TOP_TOP_PAD2GND_LSB) -#define TOP_TOP_PAD2GND_SET(x) (((32'd0 | (x)) << TOP_TOP_PAD2GND_LSB) & TOP_TOP_PAD2GND_MASK) -#define TOP_TOP_PAD2GND_RESET 1'h0 -#define TOP_TOP_INT2GND_MSB 1 -#define TOP_TOP_INT2GND_LSB 1 -#define TOP_TOP_INT2GND_MASK 'h00000002 -#define TOP_TOP_INT2GND_GET(x) (((x) & TOP_TOP_INT2GND_MASK) >> TOP_TOP_INT2GND_LSB) -#define TOP_TOP_INT2GND_SET(x) (((32'd0 | (x)) << TOP_TOP_INT2GND_LSB) & TOP_TOP_INT2GND_MASK) -#define TOP_TOP_INT2GND_RESET 1'h0 -#define TOP_TOP_FORCE_XPAON_MSB 0 -#define TOP_TOP_FORCE_XPAON_LSB 0 -#define TOP_TOP_FORCE_XPAON_MASK 'h00000001 -#define TOP_TOP_FORCE_XPAON_GET(x) (((x) & TOP_TOP_FORCE_XPAON_MASK) >> TOP_TOP_FORCE_XPAON_LSB) -#define TOP_TOP_FORCE_XPAON_SET(x) (((32'd0 | (x)) << TOP_TOP_FORCE_XPAON_LSB) & TOP_TOP_FORCE_XPAON_MASK) -#define TOP_TOP_FORCE_XPAON_RESET 1'h0 -#define TOP_TOP_RESET (32'h0 | \ - TOP_TOP_LOCALTXGAIN_SET(TOP_TOP_LOCALTXGAIN_RESET) | \ - TOP_TOP_LOCALRXGAIN_SET(TOP_TOP_LOCALRXGAIN_RESET) | \ - TOP_TOP_LOCALMODE_SET(TOP_TOP_LOCALMODE_RESET) | \ - TOP_TOP_CALFC_SET(TOP_TOP_CALFC_RESET) | \ - TOP_TOP_CALDC_SET(TOP_TOP_CALDC_RESET) | \ - TOP_TOP_CAL_RESIDUE_SET(TOP_TOP_CAL_RESIDUE_RESET) | \ - TOP_TOP_BMODE_SET(TOP_TOP_BMODE_RESET) | \ - TOP_TOP_SYNTHON_SET(TOP_TOP_SYNTHON_RESET) | \ - TOP_TOP_RXON_SET(TOP_TOP_RXON_RESET) | \ - TOP_TOP_TXON_SET(TOP_TOP_TXON_RESET) | \ - TOP_TOP_PAON_SET(TOP_TOP_PAON_RESET) | \ - TOP_TOP_CALTX_SET(TOP_TOP_CALTX_RESET) | \ - TOP_TOP_LOCALADDAC_SET(TOP_TOP_LOCALADDAC_RESET) | \ - TOP_TOP_PWDPLL_SET(TOP_TOP_PWDPLL_RESET) | \ - TOP_TOP_PWDADC_SET(TOP_TOP_PWDADC_RESET) | \ - TOP_TOP_PWDDAC_SET(TOP_TOP_PWDDAC_RESET) | \ - TOP_TOP_LOCALXTAL_SET(TOP_TOP_LOCALXTAL_RESET) | \ - TOP_TOP_PWDCLKIN_SET(TOP_TOP_PWDCLKIN_RESET) | \ - TOP_TOP_OSCON_SET(TOP_TOP_OSCON_RESET) | \ - TOP_TOP_SCLKEN_FORCE_SET(TOP_TOP_SCLKEN_FORCE_RESET) | \ - TOP_TOP_SYNTHON_FORCE_SET(TOP_TOP_SYNTHON_FORCE_RESET) | \ - TOP_TOP_PDBIAS_SET(TOP_TOP_PDBIAS_RESET) | \ - TOP_TOP_DATAOUTSEL_SET(TOP_TOP_DATAOUTSEL_RESET) | \ - TOP_TOP_REVID_SET(TOP_TOP_REVID_RESET) | \ - TOP_TOP_INT2PAD_SET(TOP_TOP_INT2PAD_RESET) | \ - TOP_TOP_INTH2PAD_SET(TOP_TOP_INTH2PAD_RESET) | \ - TOP_TOP_PAD2GND_SET(TOP_TOP_PAD2GND_RESET) | \ - TOP_TOP_INT2GND_SET(TOP_TOP_INT2GND_RESET) | \ - TOP_TOP_FORCE_XPAON_SET(TOP_TOP_FORCE_XPAON_RESET)) -#define TOP_TOP_HW_MASK (32'h0 | \ - TOP_TOP_CALFC_MASK | \ - TOP_TOP_CALDC_MASK | \ - TOP_TOP_CAL_RESIDUE_MASK | \ - TOP_TOP_BMODE_MASK | \ - TOP_TOP_SYNTHON_MASK | \ - TOP_TOP_RXON_MASK | \ - TOP_TOP_TXON_MASK | \ - TOP_TOP_PAON_MASK | \ - TOP_TOP_CALTX_MASK | \ - TOP_TOP_PWDPLL_MASK | \ - TOP_TOP_PWDADC_MASK | \ - TOP_TOP_PWDDAC_MASK | \ - TOP_TOP_PWDCLKIN_MASK | \ - TOP_TOP_OSCON_MASK | \ - TOP_TOP_REVID_MASK) -#define TOP_TOP_SW_MASK (32'h0 | \ - TOP_TOP_LOCALTXGAIN_MASK | \ - TOP_TOP_LOCALRXGAIN_MASK | \ - TOP_TOP_LOCALMODE_MASK | \ - TOP_TOP_CALFC_MASK | \ - TOP_TOP_CALDC_MASK | \ - TOP_TOP_CAL_RESIDUE_MASK | \ - TOP_TOP_BMODE_MASK | \ - TOP_TOP_SYNTHON_MASK | \ - TOP_TOP_RXON_MASK | \ - TOP_TOP_TXON_MASK | \ - TOP_TOP_PAON_MASK | \ - TOP_TOP_CALTX_MASK | \ - TOP_TOP_LOCALADDAC_MASK | \ - TOP_TOP_PWDPLL_MASK | \ - TOP_TOP_PWDADC_MASK | \ - TOP_TOP_PWDDAC_MASK | \ - TOP_TOP_LOCALXTAL_MASK | \ - TOP_TOP_PWDCLKIN_MASK | \ - TOP_TOP_OSCON_MASK | \ - TOP_TOP_SCLKEN_FORCE_MASK | \ - TOP_TOP_SYNTHON_FORCE_MASK | \ - TOP_TOP_PDBIAS_MASK | \ - TOP_TOP_DATAOUTSEL_MASK | \ - TOP_TOP_INT2PAD_MASK | \ - TOP_TOP_INTH2PAD_MASK | \ - TOP_TOP_PAD2GND_MASK | \ - TOP_TOP_INT2GND_MASK | \ - TOP_TOP_FORCE_XPAON_MASK) - -#define BIAS_BIAS_SEL_ADDRESS 'h00000038 -#define BIAS_BIAS_SEL_PADON_MSB 31 -#define BIAS_BIAS_SEL_PADON_LSB 31 -#define BIAS_BIAS_SEL_PADON_MASK 'h80000000 -#define BIAS_BIAS_SEL_PADON_GET(x) (((x) & BIAS_BIAS_SEL_PADON_MASK) >> BIAS_BIAS_SEL_PADON_LSB) -#define BIAS_BIAS_SEL_PADON_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PADON_LSB) & BIAS_BIAS_SEL_PADON_MASK) -#define BIAS_BIAS_SEL_PADON_RESET 1'h0 -#define BIAS_BIAS_SEL_SEL_BIAS_MSB 30 -#define BIAS_BIAS_SEL_SEL_BIAS_LSB 25 -#define BIAS_BIAS_SEL_SEL_BIAS_MASK 'h7e000000 -#define BIAS_BIAS_SEL_SEL_BIAS_GET(x) (((x) & BIAS_BIAS_SEL_SEL_BIAS_MASK) >> BIAS_BIAS_SEL_SEL_BIAS_LSB) -#define BIAS_BIAS_SEL_SEL_BIAS_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_SEL_BIAS_LSB) & BIAS_BIAS_SEL_SEL_BIAS_MASK) -#define BIAS_BIAS_SEL_SEL_BIAS_RESET 6'h0 -#define BIAS_BIAS_SEL_SEL_SPARE_MSB 24 -#define BIAS_BIAS_SEL_SEL_SPARE_LSB 21 -#define BIAS_BIAS_SEL_SEL_SPARE_MASK 'h01e00000 -#define BIAS_BIAS_SEL_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SEL_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_SEL_SPARE_RESET 4'h0 -#define BIAS_BIAS_SEL_SPARE_MSB 20 -#define BIAS_BIAS_SEL_SPARE_LSB 20 -#define BIAS_BIAS_SEL_SPARE_MASK 'h00100000 -#define BIAS_BIAS_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_SPARE_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MSB 19 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB 17 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK 'h000e0000 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_RESET 3'h6 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK 'h00010000 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK 'h00008000 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK 'h00004000 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_LSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MASK 'h00002000 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) >> BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MSB 12 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB 10 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK 'h00001c00 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MSB 9 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_LSB 7 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MASK 'h00000380 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) >> BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MSB 6 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_LSB 4 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MASK 'h00000070 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) >> BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MSB 3 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_LSB 1 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MASK 'h0000000e -#define BIAS_BIAS_SEL_PWD_ICTXPC25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) >> BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICLDO25_MSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_LSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_MASK 'h00000001 -#define BIAS_BIAS_SEL_PWD_ICLDO25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) >> BIAS_BIAS_SEL_PWD_ICLDO25_LSB) -#define BIAS_BIAS_SEL_PWD_ICLDO25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICLDO25_LSB) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) -#define BIAS_BIAS_SEL_PWD_ICLDO25_RESET 1'h0 -#define BIAS_BIAS_SEL_RESET (32'h0 | \ - BIAS_BIAS_SEL_PADON_SET(BIAS_BIAS_SEL_PADON_RESET) | \ - BIAS_BIAS_SEL_SEL_BIAS_SET(BIAS_BIAS_SEL_SEL_BIAS_RESET) | \ - BIAS_BIAS_SEL_SEL_SPARE_SET(BIAS_BIAS_SEL_SEL_SPARE_RESET) | \ - BIAS_BIAS_SEL_SPARE_SET(BIAS_BIAS_SEL_SPARE_RESET) | \ - BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_SET(BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_RESET) | \ - BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_SET(BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_RESET) | \ - BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_SET(BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_RESET) | \ - BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_SET(BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICCPLL25_SET(BIAS_BIAS_SEL_PWD_ICCPLL25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_SET(BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICXTAL25_SET(BIAS_BIAS_SEL_PWD_ICXTAL25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICTSENS25_SET(BIAS_BIAS_SEL_PWD_ICTSENS25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICTXPC25_SET(BIAS_BIAS_SEL_PWD_ICTXPC25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICLDO25_SET(BIAS_BIAS_SEL_PWD_ICLDO25_RESET)) -#define BIAS_BIAS_SEL_HW_MASK (32'h0) -#define BIAS_BIAS_SEL_SW_MASK (32'h0 | \ - BIAS_BIAS_SEL_PADON_MASK | \ - BIAS_BIAS_SEL_SEL_BIAS_MASK | \ - BIAS_BIAS_SEL_SEL_SPARE_MASK | \ - BIAS_BIAS_SEL_SPARE_MASK | \ - BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK | \ - BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK | \ - BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK | \ - BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK | \ - BIAS_BIAS_SEL_PWD_ICCPLL25_MASK | \ - BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK | \ - BIAS_BIAS_SEL_PWD_ICXTAL25_MASK | \ - BIAS_BIAS_SEL_PWD_ICTSENS25_MASK | \ - BIAS_BIAS_SEL_PWD_ICTXPC25_MASK | \ - BIAS_BIAS_SEL_PWD_ICLDO25_MASK) - -#define BIAS_BIAS1_ADDRESS 'h0000003c -#define BIAS_BIAS1_PWD_ICDAC2BB25_MSB 31 -#define BIAS_BIAS1_PWD_ICDAC2BB25_LSB 29 -#define BIAS_BIAS1_PWD_ICDAC2BB25_MASK 'he0000000 -#define BIAS_BIAS1_PWD_ICDAC2BB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) >> BIAS_BIAS1_PWD_ICDAC2BB25_LSB) -#define BIAS_BIAS1_PWD_ICDAC2BB25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_ICDAC2BB25_LSB) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) -#define BIAS_BIAS1_PWD_ICDAC2BB25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GVGM25_MSB 28 -#define BIAS_BIAS1_PWD_IC2GVGM25_LSB 26 -#define BIAS_BIAS1_PWD_IC2GVGM25_MASK 'h1c000000 -#define BIAS_BIAS1_PWD_IC2GVGM25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) >> BIAS_BIAS1_PWD_IC2GVGM25_LSB) -#define BIAS_BIAS1_PWD_IC2GVGM25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GVGM25_LSB) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) -#define BIAS_BIAS1_PWD_IC2GVGM25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GRFFE25_MSB 25 -#define BIAS_BIAS1_PWD_IC2GRFFE25_LSB 23 -#define BIAS_BIAS1_PWD_IC2GRFFE25_MASK 'h03800000 -#define BIAS_BIAS1_PWD_IC2GRFFE25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) >> BIAS_BIAS1_PWD_IC2GRFFE25_LSB) -#define BIAS_BIAS1_PWD_IC2GRFFE25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GRFFE25_LSB) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) -#define BIAS_BIAS1_PWD_IC2GRFFE25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GLOREG25_MSB 22 -#define BIAS_BIAS1_PWD_IC2GLOREG25_LSB 20 -#define BIAS_BIAS1_PWD_IC2GLOREG25_MASK 'h00700000 -#define BIAS_BIAS1_PWD_IC2GLOREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLOREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLOREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GLOREG25_LSB) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) -#define BIAS_BIAS1_PWD_IC2GLOREG25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MSB 19 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_LSB 17 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MASK 'h000e0000 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_RESET 3'h3 -#define BIAS_BIAS1_PWD_ICDETECTORB25_MSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_LSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_MASK 'h00010000 -#define BIAS_BIAS1_PWD_ICDETECTORB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORB25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORB25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_ICDETECTORB25_LSB) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORB25_RESET 1'h0 -#define BIAS_BIAS1_PWD_ICDETECTORA25_MSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_LSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_MASK 'h00008000 -#define BIAS_BIAS1_PWD_ICDETECTORA25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORA25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORA25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_ICDETECTORA25_LSB) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORA25_RESET 1'h0 -#define BIAS_BIAS1_PWD_IC5GRXRF25_MSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_LSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_MASK 'h00004000 -#define BIAS_BIAS1_PWD_IC5GRXRF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) >> BIAS_BIAS1_PWD_IC5GRXRF25_LSB) -#define BIAS_BIAS1_PWD_IC5GRXRF25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GRXRF25_LSB) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) -#define BIAS_BIAS1_PWD_IC5GRXRF25_RESET 1'h0 -#define BIAS_BIAS1_PWD_IC5GTXPA25_MSB 13 -#define BIAS_BIAS1_PWD_IC5GTXPA25_LSB 11 -#define BIAS_BIAS1_PWD_IC5GTXPA25_MASK 'h00003800 -#define BIAS_BIAS1_PWD_IC5GTXPA25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) >> BIAS_BIAS1_PWD_IC5GTXPA25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXPA25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GTXPA25_LSB) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXPA25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MSB 10 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_LSB 8 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MASK 'h00000700 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) >> BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC5GQB25_MSB 7 -#define BIAS_BIAS1_PWD_IC5GQB25_LSB 5 -#define BIAS_BIAS1_PWD_IC5GQB25_MASK 'h000000e0 -#define BIAS_BIAS1_PWD_IC5GQB25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GQB25_MASK) >> BIAS_BIAS1_PWD_IC5GQB25_LSB) -#define BIAS_BIAS1_PWD_IC5GQB25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GQB25_LSB) & BIAS_BIAS1_PWD_IC5GQB25_MASK) -#define BIAS_BIAS1_PWD_IC5GQB25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MSB 4 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_LSB 2 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MASK 'h0000001c -#define BIAS_BIAS1_PWD_IC5GMIXQ25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) >> BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_RESET 3'h3 -#define BIAS_BIAS1_SPARE_MSB 1 -#define BIAS_BIAS1_SPARE_LSB 0 -#define BIAS_BIAS1_SPARE_MASK 'h00000003 -#define BIAS_BIAS1_SPARE_GET(x) (((x) & BIAS_BIAS1_SPARE_MASK) >> BIAS_BIAS1_SPARE_LSB) -#define BIAS_BIAS1_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_SPARE_LSB) & BIAS_BIAS1_SPARE_MASK) -#define BIAS_BIAS1_SPARE_RESET 2'h3 -#define BIAS_BIAS1_RESET (32'h0 | \ - BIAS_BIAS1_PWD_ICDAC2BB25_SET(BIAS_BIAS1_PWD_ICDAC2BB25_RESET) | \ - BIAS_BIAS1_PWD_IC2GVGM25_SET(BIAS_BIAS1_PWD_IC2GVGM25_RESET) | \ - BIAS_BIAS1_PWD_IC2GRFFE25_SET(BIAS_BIAS1_PWD_IC2GRFFE25_RESET) | \ - BIAS_BIAS1_PWD_IC2GLOREG25_SET(BIAS_BIAS1_PWD_IC2GLOREG25_RESET) | \ - BIAS_BIAS1_PWD_IC2GLNAREG25_SET(BIAS_BIAS1_PWD_IC2GLNAREG25_RESET) | \ - BIAS_BIAS1_PWD_ICDETECTORB25_SET(BIAS_BIAS1_PWD_ICDETECTORB25_RESET) | \ - BIAS_BIAS1_PWD_ICDETECTORA25_SET(BIAS_BIAS1_PWD_ICDETECTORA25_RESET) | \ - BIAS_BIAS1_PWD_IC5GRXRF25_SET(BIAS_BIAS1_PWD_IC5GRXRF25_RESET) | \ - BIAS_BIAS1_PWD_IC5GTXPA25_SET(BIAS_BIAS1_PWD_IC5GTXPA25_RESET) | \ - BIAS_BIAS1_PWD_IC5GTXBUF25_SET(BIAS_BIAS1_PWD_IC5GTXBUF25_RESET) | \ - BIAS_BIAS1_PWD_IC5GQB25_SET(BIAS_BIAS1_PWD_IC5GQB25_RESET) | \ - BIAS_BIAS1_PWD_IC5GMIXQ25_SET(BIAS_BIAS1_PWD_IC5GMIXQ25_RESET) | \ - BIAS_BIAS1_SPARE_SET(BIAS_BIAS1_SPARE_RESET)) -#define BIAS_BIAS1_HW_MASK (32'h0) -#define BIAS_BIAS1_SW_MASK (32'h0 | \ - BIAS_BIAS1_PWD_ICDAC2BB25_MASK | \ - BIAS_BIAS1_PWD_IC2GVGM25_MASK | \ - BIAS_BIAS1_PWD_IC2GRFFE25_MASK | \ - BIAS_BIAS1_PWD_IC2GLOREG25_MASK | \ - BIAS_BIAS1_PWD_IC2GLNAREG25_MASK | \ - BIAS_BIAS1_PWD_ICDETECTORB25_MASK | \ - BIAS_BIAS1_PWD_ICDETECTORA25_MASK | \ - BIAS_BIAS1_PWD_IC5GRXRF25_MASK | \ - BIAS_BIAS1_PWD_IC5GTXPA25_MASK | \ - BIAS_BIAS1_PWD_IC5GTXBUF25_MASK | \ - BIAS_BIAS1_PWD_IC5GQB25_MASK | \ - BIAS_BIAS1_PWD_IC5GMIXQ25_MASK | \ - BIAS_BIAS1_SPARE_MASK) - -#define BIAS_BIAS2_ADDRESS 'h00000040 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MSB 31 -#define BIAS_BIAS2_PWD_IC5GMIXI25_LSB 29 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MASK 'he0000000 -#define BIAS_BIAS2_PWD_IC5GMIXI25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) >> BIAS_BIAS2_PWD_IC5GMIXI25_LSB) -#define BIAS_BIAS2_PWD_IC5GMIXI25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IC5GMIXI25_LSB) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) -#define BIAS_BIAS2_PWD_IC5GMIXI25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IC5GDIV25_MSB 28 -#define BIAS_BIAS2_PWD_IC5GDIV25_LSB 26 -#define BIAS_BIAS2_PWD_IC5GDIV25_MASK 'h1c000000 -#define BIAS_BIAS2_PWD_IC5GDIV25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) >> BIAS_BIAS2_PWD_IC5GDIV25_LSB) -#define BIAS_BIAS2_PWD_IC5GDIV25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IC5GDIV25_LSB) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) -#define BIAS_BIAS2_PWD_IC5GDIV25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IC5GLOREG25_MSB 25 -#define BIAS_BIAS2_PWD_IC5GLOREG25_LSB 23 -#define BIAS_BIAS2_PWD_IC5GLOREG25_MASK 'h03800000 -#define BIAS_BIAS2_PWD_IC5GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) >> BIAS_BIAS2_PWD_IC5GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IC5GLOREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IC5GLOREG25_LSB) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IC5GLOREG25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRPLL25_MSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_LSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_MASK 'h00400000 -#define BIAS_BIAS2_PWD_IRPLL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRPLL25_MASK) >> BIAS_BIAS2_PWD_IRPLL25_LSB) -#define BIAS_BIAS2_PWD_IRPLL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRPLL25_LSB) & BIAS_BIAS2_PWD_IRPLL25_MASK) -#define BIAS_BIAS2_PWD_IRPLL25_RESET 1'h0 -#define BIAS_BIAS2_PWD_IRXTAL25_MSB 21 -#define BIAS_BIAS2_PWD_IRXTAL25_LSB 19 -#define BIAS_BIAS2_PWD_IRXTAL25_MASK 'h00380000 -#define BIAS_BIAS2_PWD_IRXTAL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRXTAL25_MASK) >> BIAS_BIAS2_PWD_IRXTAL25_LSB) -#define BIAS_BIAS2_PWD_IRXTAL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRXTAL25_LSB) & BIAS_BIAS2_PWD_IRXTAL25_MASK) -#define BIAS_BIAS2_PWD_IRXTAL25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRTSENS25_MSB 18 -#define BIAS_BIAS2_PWD_IRTSENS25_LSB 16 -#define BIAS_BIAS2_PWD_IRTSENS25_MASK 'h00070000 -#define BIAS_BIAS2_PWD_IRTSENS25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTSENS25_MASK) >> BIAS_BIAS2_PWD_IRTSENS25_LSB) -#define BIAS_BIAS2_PWD_IRTSENS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRTSENS25_LSB) & BIAS_BIAS2_PWD_IRTSENS25_MASK) -#define BIAS_BIAS2_PWD_IRTSENS25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRTXPC25_MSB 15 -#define BIAS_BIAS2_PWD_IRTXPC25_LSB 13 -#define BIAS_BIAS2_PWD_IRTXPC25_MASK 'h0000e000 -#define BIAS_BIAS2_PWD_IRTXPC25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTXPC25_MASK) >> BIAS_BIAS2_PWD_IRTXPC25_LSB) -#define BIAS_BIAS2_PWD_IRTXPC25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRTXPC25_LSB) & BIAS_BIAS2_PWD_IRTXPC25_MASK) -#define BIAS_BIAS2_PWD_IRTXPC25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRLDO25_MSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_LSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_MASK 'h00001000 -#define BIAS_BIAS2_PWD_IRLDO25_GET(x) (((x) & BIAS_BIAS2_PWD_IRLDO25_MASK) >> BIAS_BIAS2_PWD_IRLDO25_LSB) -#define BIAS_BIAS2_PWD_IRLDO25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRLDO25_LSB) & BIAS_BIAS2_PWD_IRLDO25_MASK) -#define BIAS_BIAS2_PWD_IRLDO25_RESET 1'h0 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MSB 11 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_LSB 9 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MASK 'h00000e00 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) >> BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IR2GLOREG25_MSB 8 -#define BIAS_BIAS2_PWD_IR2GLOREG25_LSB 6 -#define BIAS_BIAS2_PWD_IR2GLOREG25_MASK 'h000001c0 -#define BIAS_BIAS2_PWD_IR2GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLOREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR2GLOREG25_LSB) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IR2GLOREG25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MSB 5 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_LSB 3 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MASK 'h00000038 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MSB 2 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB 0 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK 'h00000007 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_GET(x) (((x) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) >> BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_RESET 3'h3 -#define BIAS_BIAS2_RESET (32'h0 | \ - BIAS_BIAS2_PWD_IC5GMIXI25_SET(BIAS_BIAS2_PWD_IC5GMIXI25_RESET) | \ - BIAS_BIAS2_PWD_IC5GDIV25_SET(BIAS_BIAS2_PWD_IC5GDIV25_RESET) | \ - BIAS_BIAS2_PWD_IC5GLOREG25_SET(BIAS_BIAS2_PWD_IC5GLOREG25_RESET) | \ - BIAS_BIAS2_PWD_IRPLL25_SET(BIAS_BIAS2_PWD_IRPLL25_RESET) | \ - BIAS_BIAS2_PWD_IRXTAL25_SET(BIAS_BIAS2_PWD_IRXTAL25_RESET) | \ - BIAS_BIAS2_PWD_IRTSENS25_SET(BIAS_BIAS2_PWD_IRTSENS25_RESET) | \ - BIAS_BIAS2_PWD_IRTXPC25_SET(BIAS_BIAS2_PWD_IRTXPC25_RESET) | \ - BIAS_BIAS2_PWD_IRLDO25_SET(BIAS_BIAS2_PWD_IRLDO25_RESET) | \ - BIAS_BIAS2_PWD_IR2GTXMIX25_SET(BIAS_BIAS2_PWD_IR2GTXMIX25_RESET) | \ - BIAS_BIAS2_PWD_IR2GLOREG25_SET(BIAS_BIAS2_PWD_IR2GLOREG25_RESET) | \ - BIAS_BIAS2_PWD_IR2GLNAREG25_SET(BIAS_BIAS2_PWD_IR2GLNAREG25_RESET) | \ - BIAS_BIAS2_PWD_IR5GRFVREF2525_SET(BIAS_BIAS2_PWD_IR5GRFVREF2525_RESET)) -#define BIAS_BIAS2_HW_MASK (32'h0) -#define BIAS_BIAS2_SW_MASK (32'h0 | \ - BIAS_BIAS2_PWD_IC5GMIXI25_MASK | \ - BIAS_BIAS2_PWD_IC5GDIV25_MASK | \ - BIAS_BIAS2_PWD_IC5GLOREG25_MASK | \ - BIAS_BIAS2_PWD_IRPLL25_MASK | \ - BIAS_BIAS2_PWD_IRXTAL25_MASK | \ - BIAS_BIAS2_PWD_IRTSENS25_MASK | \ - BIAS_BIAS2_PWD_IRTXPC25_MASK | \ - BIAS_BIAS2_PWD_IRLDO25_MASK | \ - BIAS_BIAS2_PWD_IR2GTXMIX25_MASK | \ - BIAS_BIAS2_PWD_IR2GLOREG25_MASK | \ - BIAS_BIAS2_PWD_IR2GLNAREG25_MASK | \ - BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) - -#define BIAS_BIAS3_ADDRESS 'h00000044 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MSB 31 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_LSB 29 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MASK 'he0000000 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) >> BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) -#define BIAS_BIAS3_PWD_IR5GTXMIX25_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) -#define BIAS_BIAS3_PWD_IR5GTXMIX25_RESET 3'h3 -#define BIAS_BIAS3_PWD_IR5GAGC25_MSB 28 -#define BIAS_BIAS3_PWD_IR5GAGC25_LSB 26 -#define BIAS_BIAS3_PWD_IR5GAGC25_MASK 'h1c000000 -#define BIAS_BIAS3_PWD_IR5GAGC25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) >> BIAS_BIAS3_PWD_IR5GAGC25_LSB) -#define BIAS_BIAS3_PWD_IR5GAGC25_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR5GAGC25_LSB) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) -#define BIAS_BIAS3_PWD_IR5GAGC25_RESET 3'h3 -#define BIAS_BIAS3_PWD_ICDAC50_MSB 25 -#define BIAS_BIAS3_PWD_ICDAC50_LSB 23 -#define BIAS_BIAS3_PWD_ICDAC50_MASK 'h03800000 -#define BIAS_BIAS3_PWD_ICDAC50_GET(x) (((x) & BIAS_BIAS3_PWD_ICDAC50_MASK) >> BIAS_BIAS3_PWD_ICDAC50_LSB) -#define BIAS_BIAS3_PWD_ICDAC50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICDAC50_LSB) & BIAS_BIAS3_PWD_ICDAC50_MASK) -#define BIAS_BIAS3_PWD_ICDAC50_RESET 3'h3 -#define BIAS_BIAS3_PWD_ICSYNTH50_MSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_LSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_MASK 'h00400000 -#define BIAS_BIAS3_PWD_ICSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) >> BIAS_BIAS3_PWD_ICSYNTH50_LSB) -#define BIAS_BIAS3_PWD_ICSYNTH50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICSYNTH50_LSB) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) -#define BIAS_BIAS3_PWD_ICSYNTH50_RESET 1'h0 -#define BIAS_BIAS3_PWD_ICBB50_MSB 21 -#define BIAS_BIAS3_PWD_ICBB50_LSB 21 -#define BIAS_BIAS3_PWD_ICBB50_MASK 'h00200000 -#define BIAS_BIAS3_PWD_ICBB50_GET(x) (((x) & BIAS_BIAS3_PWD_ICBB50_MASK) >> BIAS_BIAS3_PWD_ICBB50_LSB) -#define BIAS_BIAS3_PWD_ICBB50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICBB50_LSB) & BIAS_BIAS3_PWD_ICBB50_MASK) -#define BIAS_BIAS3_PWD_ICBB50_RESET 1'h0 -#define BIAS_BIAS3_PWD_IC2GDIV50_MSB 20 -#define BIAS_BIAS3_PWD_IC2GDIV50_LSB 18 -#define BIAS_BIAS3_PWD_IC2GDIV50_MASK 'h001c0000 -#define BIAS_BIAS3_PWD_IC2GDIV50_GET(x) (((x) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) >> BIAS_BIAS3_PWD_IC2GDIV50_LSB) -#define BIAS_BIAS3_PWD_IC2GDIV50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IC2GDIV50_LSB) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) -#define BIAS_BIAS3_PWD_IC2GDIV50_RESET 3'h3 -#define BIAS_BIAS3_PWD_IRSYNTH50_MSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_LSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_MASK 'h00020000 -#define BIAS_BIAS3_PWD_IRSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) >> BIAS_BIAS3_PWD_IRSYNTH50_LSB) -#define BIAS_BIAS3_PWD_IRSYNTH50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IRSYNTH50_LSB) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) -#define BIAS_BIAS3_PWD_IRSYNTH50_RESET 1'h0 -#define BIAS_BIAS3_PWD_IRBB50_MSB 16 -#define BIAS_BIAS3_PWD_IRBB50_LSB 16 -#define BIAS_BIAS3_PWD_IRBB50_MASK 'h00010000 -#define BIAS_BIAS3_PWD_IRBB50_GET(x) (((x) & BIAS_BIAS3_PWD_IRBB50_MASK) >> BIAS_BIAS3_PWD_IRBB50_LSB) -#define BIAS_BIAS3_PWD_IRBB50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IRBB50_LSB) & BIAS_BIAS3_PWD_IRBB50_MASK) -#define BIAS_BIAS3_PWD_IRBB50_RESET 1'h0 -#define BIAS_BIAS3_PWD_IC25SPARE1_MSB 15 -#define BIAS_BIAS3_PWD_IC25SPARE1_LSB 13 -#define BIAS_BIAS3_PWD_IC25SPARE1_MASK 'h0000e000 -#define BIAS_BIAS3_PWD_IC25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) >> BIAS_BIAS3_PWD_IC25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE1_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IC25SPARE1_LSB) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE1_RESET 3'h3 -#define BIAS_BIAS3_PWD_IC25SPARE2_MSB 12 -#define BIAS_BIAS3_PWD_IC25SPARE2_LSB 10 -#define BIAS_BIAS3_PWD_IC25SPARE2_MASK 'h00001c00 -#define BIAS_BIAS3_PWD_IC25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) >> BIAS_BIAS3_PWD_IC25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE2_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IC25SPARE2_LSB) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE2_RESET 3'h3 -#define BIAS_BIAS3_PWD_IR25SPARE1_MSB 9 -#define BIAS_BIAS3_PWD_IR25SPARE1_LSB 7 -#define BIAS_BIAS3_PWD_IR25SPARE1_MASK 'h00000380 -#define BIAS_BIAS3_PWD_IR25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) >> BIAS_BIAS3_PWD_IR25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE1_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR25SPARE1_LSB) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE1_RESET 3'h3 -#define BIAS_BIAS3_PWD_IR25SPARE2_MSB 6 -#define BIAS_BIAS3_PWD_IR25SPARE2_LSB 4 -#define BIAS_BIAS3_PWD_IR25SPARE2_MASK 'h00000070 -#define BIAS_BIAS3_PWD_IR25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) >> BIAS_BIAS3_PWD_IR25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE2_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR25SPARE2_LSB) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE2_RESET 3'h3 -#define BIAS_BIAS3_PWD_ICDACREG12P5_MSB 3 -#define BIAS_BIAS3_PWD_ICDACREG12P5_LSB 1 -#define BIAS_BIAS3_PWD_ICDACREG12P5_MASK 'h0000000e -#define BIAS_BIAS3_PWD_ICDACREG12P5_GET(x) (((x) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) >> BIAS_BIAS3_PWD_ICDACREG12P5_LSB) -#define BIAS_BIAS3_PWD_ICDACREG12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICDACREG12P5_LSB) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) -#define BIAS_BIAS3_PWD_ICDACREG12P5_RESET 3'h5 -#define BIAS_BIAS3_SPARE_MSB 0 -#define BIAS_BIAS3_SPARE_LSB 0 -#define BIAS_BIAS3_SPARE_MASK 'h00000001 -#define BIAS_BIAS3_SPARE_GET(x) (((x) & BIAS_BIAS3_SPARE_MASK) >> BIAS_BIAS3_SPARE_LSB) -#define BIAS_BIAS3_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_SPARE_LSB) & BIAS_BIAS3_SPARE_MASK) -#define BIAS_BIAS3_SPARE_RESET 1'h0 -#define BIAS_BIAS3_RESET (32'h0 | \ - BIAS_BIAS3_PWD_IR5GTXMIX25_SET(BIAS_BIAS3_PWD_IR5GTXMIX25_RESET) | \ - BIAS_BIAS3_PWD_IR5GAGC25_SET(BIAS_BIAS3_PWD_IR5GAGC25_RESET) | \ - BIAS_BIAS3_PWD_ICDAC50_SET(BIAS_BIAS3_PWD_ICDAC50_RESET) | \ - BIAS_BIAS3_PWD_ICSYNTH50_SET(BIAS_BIAS3_PWD_ICSYNTH50_RESET) | \ - BIAS_BIAS3_PWD_ICBB50_SET(BIAS_BIAS3_PWD_ICBB50_RESET) | \ - BIAS_BIAS3_PWD_IC2GDIV50_SET(BIAS_BIAS3_PWD_IC2GDIV50_RESET) | \ - BIAS_BIAS3_PWD_IRSYNTH50_SET(BIAS_BIAS3_PWD_IRSYNTH50_RESET) | \ - BIAS_BIAS3_PWD_IRBB50_SET(BIAS_BIAS3_PWD_IRBB50_RESET) | \ - BIAS_BIAS3_PWD_IC25SPARE1_SET(BIAS_BIAS3_PWD_IC25SPARE1_RESET) | \ - BIAS_BIAS3_PWD_IC25SPARE2_SET(BIAS_BIAS3_PWD_IC25SPARE2_RESET) | \ - BIAS_BIAS3_PWD_IR25SPARE1_SET(BIAS_BIAS3_PWD_IR25SPARE1_RESET) | \ - BIAS_BIAS3_PWD_IR25SPARE2_SET(BIAS_BIAS3_PWD_IR25SPARE2_RESET) | \ - BIAS_BIAS3_PWD_ICDACREG12P5_SET(BIAS_BIAS3_PWD_ICDACREG12P5_RESET) | \ - BIAS_BIAS3_SPARE_SET(BIAS_BIAS3_SPARE_RESET)) -#define BIAS_BIAS3_HW_MASK (32'h0) -#define BIAS_BIAS3_SW_MASK (32'h0 | \ - BIAS_BIAS3_PWD_IR5GTXMIX25_MASK | \ - BIAS_BIAS3_PWD_IR5GAGC25_MASK | \ - BIAS_BIAS3_PWD_ICDAC50_MASK | \ - BIAS_BIAS3_PWD_ICSYNTH50_MASK | \ - BIAS_BIAS3_PWD_ICBB50_MASK | \ - BIAS_BIAS3_PWD_IC2GDIV50_MASK | \ - BIAS_BIAS3_PWD_IRSYNTH50_MASK | \ - BIAS_BIAS3_PWD_IRBB50_MASK | \ - BIAS_BIAS3_PWD_IC25SPARE1_MASK | \ - BIAS_BIAS3_PWD_IC25SPARE2_MASK | \ - BIAS_BIAS3_PWD_IR25SPARE1_MASK | \ - BIAS_BIAS3_PWD_IR25SPARE2_MASK | \ - BIAS_BIAS3_PWD_ICDACREG12P5_MASK | \ - BIAS_BIAS3_SPARE_MASK) - -#define TXPC_TXPC_ADDRESS 'h00000048 -#define TXPC_TXPC_SELINTPD_MSB 31 -#define TXPC_TXPC_SELINTPD_LSB 31 -#define TXPC_TXPC_SELINTPD_MASK 'h80000000 -#define TXPC_TXPC_SELINTPD_GET(x) (((x) & TXPC_TXPC_SELINTPD_MASK) >> TXPC_TXPC_SELINTPD_LSB) -#define TXPC_TXPC_SELINTPD_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELINTPD_LSB) & TXPC_TXPC_SELINTPD_MASK) -#define TXPC_TXPC_SELINTPD_RESET 1'h0 -#define TXPC_TXPC_TEST_MSB 30 -#define TXPC_TXPC_TEST_LSB 30 -#define TXPC_TXPC_TEST_MASK 'h40000000 -#define TXPC_TXPC_TEST_GET(x) (((x) & TXPC_TXPC_TEST_MASK) >> TXPC_TXPC_TEST_LSB) -#define TXPC_TXPC_TEST_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TEST_LSB) & TXPC_TXPC_TEST_MASK) -#define TXPC_TXPC_TEST_RESET 1'h0 -#define TXPC_TXPC_TESTGAIN_MSB 29 -#define TXPC_TXPC_TESTGAIN_LSB 28 -#define TXPC_TXPC_TESTGAIN_MASK 'h30000000 -#define TXPC_TXPC_TESTGAIN_GET(x) (((x) & TXPC_TXPC_TESTGAIN_MASK) >> TXPC_TXPC_TESTGAIN_LSB) -#define TXPC_TXPC_TESTGAIN_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TESTGAIN_LSB) & TXPC_TXPC_TESTGAIN_MASK) -#define TXPC_TXPC_TESTGAIN_RESET 2'h0 -#define TXPC_TXPC_TESTDAC_MSB 27 -#define TXPC_TXPC_TESTDAC_LSB 22 -#define TXPC_TXPC_TESTDAC_MASK 'h0fc00000 -#define TXPC_TXPC_TESTDAC_GET(x) (((x) & TXPC_TXPC_TESTDAC_MASK) >> TXPC_TXPC_TESTDAC_LSB) -#define TXPC_TXPC_TESTDAC_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TESTDAC_LSB) & TXPC_TXPC_TESTDAC_MASK) -#define TXPC_TXPC_TESTDAC_RESET 6'h20 -#define TXPC_TXPC_TESTPWDPC_MSB 21 -#define TXPC_TXPC_TESTPWDPC_LSB 21 -#define TXPC_TXPC_TESTPWDPC_MASK 'h00200000 -#define TXPC_TXPC_TESTPWDPC_GET(x) (((x) & TXPC_TXPC_TESTPWDPC_MASK) >> TXPC_TXPC_TESTPWDPC_LSB) -#define TXPC_TXPC_TESTPWDPC_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TESTPWDPC_LSB) & TXPC_TXPC_TESTPWDPC_MASK) -#define TXPC_TXPC_TESTPWDPC_RESET 1'h0 -#define TXPC_TXPC_CURHALF_MSB 20 -#define TXPC_TXPC_CURHALF_LSB 20 -#define TXPC_TXPC_CURHALF_MASK 'h00100000 -#define TXPC_TXPC_CURHALF_GET(x) (((x) & TXPC_TXPC_CURHALF_MASK) >> TXPC_TXPC_CURHALF_LSB) -#define TXPC_TXPC_CURHALF_SET(x) (((32'd0 | (x)) << TXPC_TXPC_CURHALF_LSB) & TXPC_TXPC_CURHALF_MASK) -#define TXPC_TXPC_CURHALF_RESET 1'h1 -#define TXPC_TXPC_NEGOUT_MSB 19 -#define TXPC_TXPC_NEGOUT_LSB 19 -#define TXPC_TXPC_NEGOUT_MASK 'h00080000 -#define TXPC_TXPC_NEGOUT_GET(x) (((x) & TXPC_TXPC_NEGOUT_MASK) >> TXPC_TXPC_NEGOUT_LSB) -#define TXPC_TXPC_NEGOUT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_NEGOUT_LSB) & TXPC_TXPC_NEGOUT_MASK) -#define TXPC_TXPC_NEGOUT_RESET 1'h0 -#define TXPC_TXPC_CLKDELAY_MSB 18 -#define TXPC_TXPC_CLKDELAY_LSB 18 -#define TXPC_TXPC_CLKDELAY_MASK 'h00040000 -#define TXPC_TXPC_CLKDELAY_GET(x) (((x) & TXPC_TXPC_CLKDELAY_MASK) >> TXPC_TXPC_CLKDELAY_LSB) -#define TXPC_TXPC_CLKDELAY_SET(x) (((32'd0 | (x)) << TXPC_TXPC_CLKDELAY_LSB) & TXPC_TXPC_CLKDELAY_MASK) -#define TXPC_TXPC_CLKDELAY_RESET 1'h0 -#define TXPC_TXPC_SELMODREF_MSB 17 -#define TXPC_TXPC_SELMODREF_LSB 17 -#define TXPC_TXPC_SELMODREF_MASK 'h00020000 -#define TXPC_TXPC_SELMODREF_GET(x) (((x) & TXPC_TXPC_SELMODREF_MASK) >> TXPC_TXPC_SELMODREF_LSB) -#define TXPC_TXPC_SELMODREF_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELMODREF_LSB) & TXPC_TXPC_SELMODREF_MASK) -#define TXPC_TXPC_SELMODREF_RESET 1'h0 -#define TXPC_TXPC_SELCMOUT_MSB 16 -#define TXPC_TXPC_SELCMOUT_LSB 16 -#define TXPC_TXPC_SELCMOUT_MASK 'h00010000 -#define TXPC_TXPC_SELCMOUT_GET(x) (((x) & TXPC_TXPC_SELCMOUT_MASK) >> TXPC_TXPC_SELCMOUT_LSB) -#define TXPC_TXPC_SELCMOUT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELCMOUT_LSB) & TXPC_TXPC_SELCMOUT_MASK) -#define TXPC_TXPC_SELCMOUT_RESET 1'h0 -#define TXPC_TXPC_TSMODE_MSB 15 -#define TXPC_TXPC_TSMODE_LSB 14 -#define TXPC_TXPC_TSMODE_MASK 'h0000c000 -#define TXPC_TXPC_TSMODE_GET(x) (((x) & TXPC_TXPC_TSMODE_MASK) >> TXPC_TXPC_TSMODE_LSB) -#define TXPC_TXPC_TSMODE_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TSMODE_LSB) & TXPC_TXPC_TSMODE_MASK) -#define TXPC_TXPC_TSMODE_RESET 2'h0 -#define TXPC_TXPC_N_MSB 13 -#define TXPC_TXPC_N_LSB 6 -#define TXPC_TXPC_N_MASK 'h00003fc0 -#define TXPC_TXPC_N_GET(x) (((x) & TXPC_TXPC_N_MASK) >> TXPC_TXPC_N_LSB) -#define TXPC_TXPC_N_SET(x) (((32'd0 | (x)) << TXPC_TXPC_N_LSB) & TXPC_TXPC_N_MASK) -#define TXPC_TXPC_N_RESET 8'h80 -#define TXPC_TXPC_ON1STSYNTHON_MSB 5 -#define TXPC_TXPC_ON1STSYNTHON_LSB 5 -#define TXPC_TXPC_ON1STSYNTHON_MASK 'h00000020 -#define TXPC_TXPC_ON1STSYNTHON_GET(x) (((x) & TXPC_TXPC_ON1STSYNTHON_MASK) >> TXPC_TXPC_ON1STSYNTHON_LSB) -#define TXPC_TXPC_ON1STSYNTHON_SET(x) (((32'd0 | (x)) << TXPC_TXPC_ON1STSYNTHON_LSB) & TXPC_TXPC_ON1STSYNTHON_MASK) -#define TXPC_TXPC_ON1STSYNTHON_RESET 1'h1 -#define TXPC_TXPC_SELINIT_MSB 4 -#define TXPC_TXPC_SELINIT_LSB 3 -#define TXPC_TXPC_SELINIT_MASK 'h00000018 -#define TXPC_TXPC_SELINIT_GET(x) (((x) & TXPC_TXPC_SELINIT_MASK) >> TXPC_TXPC_SELINIT_LSB) -#define TXPC_TXPC_SELINIT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELINIT_LSB) & TXPC_TXPC_SELINIT_MASK) -#define TXPC_TXPC_SELINIT_RESET 2'h3 -#define TXPC_TXPC_SELCOUNT_MSB 2 -#define TXPC_TXPC_SELCOUNT_LSB 2 -#define TXPC_TXPC_SELCOUNT_MASK 'h00000004 -#define TXPC_TXPC_SELCOUNT_GET(x) (((x) & TXPC_TXPC_SELCOUNT_MASK) >> TXPC_TXPC_SELCOUNT_LSB) -#define TXPC_TXPC_SELCOUNT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELCOUNT_LSB) & TXPC_TXPC_SELCOUNT_MASK) -#define TXPC_TXPC_SELCOUNT_RESET 1'h1 -#define TXPC_TXPC_ATBSEL_MSB 1 -#define TXPC_TXPC_ATBSEL_LSB 0 -#define TXPC_TXPC_ATBSEL_MASK 'h00000003 -#define TXPC_TXPC_ATBSEL_GET(x) (((x) & TXPC_TXPC_ATBSEL_MASK) >> TXPC_TXPC_ATBSEL_LSB) -#define TXPC_TXPC_ATBSEL_SET(x) (((32'd0 | (x)) << TXPC_TXPC_ATBSEL_LSB) & TXPC_TXPC_ATBSEL_MASK) -#define TXPC_TXPC_ATBSEL_RESET 2'h0 -#define TXPC_TXPC_RESET (32'h0 | \ - TXPC_TXPC_SELINTPD_SET(TXPC_TXPC_SELINTPD_RESET) | \ - TXPC_TXPC_TEST_SET(TXPC_TXPC_TEST_RESET) | \ - TXPC_TXPC_TESTGAIN_SET(TXPC_TXPC_TESTGAIN_RESET) | \ - TXPC_TXPC_TESTDAC_SET(TXPC_TXPC_TESTDAC_RESET) | \ - TXPC_TXPC_TESTPWDPC_SET(TXPC_TXPC_TESTPWDPC_RESET) | \ - TXPC_TXPC_CURHALF_SET(TXPC_TXPC_CURHALF_RESET) | \ - TXPC_TXPC_NEGOUT_SET(TXPC_TXPC_NEGOUT_RESET) | \ - TXPC_TXPC_CLKDELAY_SET(TXPC_TXPC_CLKDELAY_RESET) | \ - TXPC_TXPC_SELMODREF_SET(TXPC_TXPC_SELMODREF_RESET) | \ - TXPC_TXPC_SELCMOUT_SET(TXPC_TXPC_SELCMOUT_RESET) | \ - TXPC_TXPC_TSMODE_SET(TXPC_TXPC_TSMODE_RESET) | \ - TXPC_TXPC_N_SET(TXPC_TXPC_N_RESET) | \ - TXPC_TXPC_ON1STSYNTHON_SET(TXPC_TXPC_ON1STSYNTHON_RESET) | \ - TXPC_TXPC_SELINIT_SET(TXPC_TXPC_SELINIT_RESET) | \ - TXPC_TXPC_SELCOUNT_SET(TXPC_TXPC_SELCOUNT_RESET) | \ - TXPC_TXPC_ATBSEL_SET(TXPC_TXPC_ATBSEL_RESET)) -#define TXPC_TXPC_HW_MASK (32'h0) -#define TXPC_TXPC_SW_MASK (32'h0 | \ - TXPC_TXPC_SELINTPD_MASK | \ - TXPC_TXPC_TEST_MASK | \ - TXPC_TXPC_TESTGAIN_MASK | \ - TXPC_TXPC_TESTDAC_MASK | \ - TXPC_TXPC_TESTPWDPC_MASK | \ - TXPC_TXPC_CURHALF_MASK | \ - TXPC_TXPC_NEGOUT_MASK | \ - TXPC_TXPC_CLKDELAY_MASK | \ - TXPC_TXPC_SELMODREF_MASK | \ - TXPC_TXPC_SELCMOUT_MASK | \ - TXPC_TXPC_TSMODE_MASK | \ - TXPC_TXPC_N_MASK | \ - TXPC_TXPC_ON1STSYNTHON_MASK | \ - TXPC_TXPC_SELINIT_MASK | \ - TXPC_TXPC_SELCOUNT_MASK | \ - TXPC_TXPC_ATBSEL_MASK) - -#define TXPC_MISC_ADDRESS 'h0000004c -#define TXPC_MISC_FLIPBMODE_MSB 31 -#define TXPC_MISC_FLIPBMODE_LSB 31 -#define TXPC_MISC_FLIPBMODE_MASK 'h80000000 -#define TXPC_MISC_FLIPBMODE_GET(x) (((x) & TXPC_MISC_FLIPBMODE_MASK) >> TXPC_MISC_FLIPBMODE_LSB) -#define TXPC_MISC_FLIPBMODE_SET(x) (((32'd0 | (x)) << TXPC_MISC_FLIPBMODE_LSB) & TXPC_MISC_FLIPBMODE_MASK) -#define TXPC_MISC_FLIPBMODE_RESET 1'h0 -#define TXPC_MISC_LEVEL_MSB 30 -#define TXPC_MISC_LEVEL_LSB 29 -#define TXPC_MISC_LEVEL_MASK 'h60000000 -#define TXPC_MISC_LEVEL_GET(x) (((x) & TXPC_MISC_LEVEL_MASK) >> TXPC_MISC_LEVEL_LSB) -#define TXPC_MISC_LEVEL_SET(x) (((32'd0 | (x)) << TXPC_MISC_LEVEL_LSB) & TXPC_MISC_LEVEL_MASK) -#define TXPC_MISC_LEVEL_RESET 2'h0 -#define TXPC_MISC_LDO_TEST_MODE_MSB 28 -#define TXPC_MISC_LDO_TEST_MODE_LSB 28 -#define TXPC_MISC_LDO_TEST_MODE_MASK 'h10000000 -#define TXPC_MISC_LDO_TEST_MODE_GET(x) (((x) & TXPC_MISC_LDO_TEST_MODE_MASK) >> TXPC_MISC_LDO_TEST_MODE_LSB) -#define TXPC_MISC_LDO_TEST_MODE_SET(x) (((32'd0 | (x)) << TXPC_MISC_LDO_TEST_MODE_LSB) & TXPC_MISC_LDO_TEST_MODE_MASK) -#define TXPC_MISC_LDO_TEST_MODE_RESET 1'h0 -#define TXPC_MISC_NOTCXODET_MSB 27 -#define TXPC_MISC_NOTCXODET_LSB 27 -#define TXPC_MISC_NOTCXODET_MASK 'h08000000 -#define TXPC_MISC_NOTCXODET_GET(x) (((x) & TXPC_MISC_NOTCXODET_MASK) >> TXPC_MISC_NOTCXODET_LSB) -#define TXPC_MISC_NOTCXODET_SET(x) (((32'd0 | (x)) << TXPC_MISC_NOTCXODET_LSB) & TXPC_MISC_NOTCXODET_MASK) -#define TXPC_MISC_NOTCXODET_RESET 1'h0 -#define TXPC_MISC_PWDCLKIND_MSB 26 -#define TXPC_MISC_PWDCLKIND_LSB 26 -#define TXPC_MISC_PWDCLKIND_MASK 'h04000000 -#define TXPC_MISC_PWDCLKIND_GET(x) (((x) & TXPC_MISC_PWDCLKIND_MASK) >> TXPC_MISC_PWDCLKIND_LSB) -#define TXPC_MISC_PWDCLKIND_SET(x) (((32'd0 | (x)) << TXPC_MISC_PWDCLKIND_LSB) & TXPC_MISC_PWDCLKIND_MASK) -#define TXPC_MISC_PWDCLKIND_RESET 1'h0 -#define TXPC_MISC_PWDXINPAD_MSB 25 -#define TXPC_MISC_PWDXINPAD_LSB 25 -#define TXPC_MISC_PWDXINPAD_MASK 'h02000000 -#define TXPC_MISC_PWDXINPAD_GET(x) (((x) & TXPC_MISC_PWDXINPAD_MASK) >> TXPC_MISC_PWDXINPAD_LSB) -#define TXPC_MISC_PWDXINPAD_SET(x) (((32'd0 | (x)) << TXPC_MISC_PWDXINPAD_LSB) & TXPC_MISC_PWDXINPAD_MASK) -#define TXPC_MISC_PWDXINPAD_RESET 1'h0 -#define TXPC_MISC_LOCALBIAS_MSB 24 -#define TXPC_MISC_LOCALBIAS_LSB 24 -#define TXPC_MISC_LOCALBIAS_MASK 'h01000000 -#define TXPC_MISC_LOCALBIAS_GET(x) (((x) & TXPC_MISC_LOCALBIAS_MASK) >> TXPC_MISC_LOCALBIAS_LSB) -#define TXPC_MISC_LOCALBIAS_SET(x) (((32'd0 | (x)) << TXPC_MISC_LOCALBIAS_LSB) & TXPC_MISC_LOCALBIAS_MASK) -#define TXPC_MISC_LOCALBIAS_RESET 1'h1 -#define TXPC_MISC_LOCALBIAS2X_MSB 23 -#define TXPC_MISC_LOCALBIAS2X_LSB 23 -#define TXPC_MISC_LOCALBIAS2X_MASK 'h00800000 -#define TXPC_MISC_LOCALBIAS2X_GET(x) (((x) & TXPC_MISC_LOCALBIAS2X_MASK) >> TXPC_MISC_LOCALBIAS2X_LSB) -#define TXPC_MISC_LOCALBIAS2X_SET(x) (((32'd0 | (x)) << TXPC_MISC_LOCALBIAS2X_LSB) & TXPC_MISC_LOCALBIAS2X_MASK) -#define TXPC_MISC_LOCALBIAS2X_RESET 1'h0 -#define TXPC_MISC_SELTSP_MSB 22 -#define TXPC_MISC_SELTSP_LSB 22 -#define TXPC_MISC_SELTSP_MASK 'h00400000 -#define TXPC_MISC_SELTSP_GET(x) (((x) & TXPC_MISC_SELTSP_MASK) >> TXPC_MISC_SELTSP_LSB) -#define TXPC_MISC_SELTSP_SET(x) (((32'd0 | (x)) << TXPC_MISC_SELTSP_LSB) & TXPC_MISC_SELTSP_MASK) -#define TXPC_MISC_SELTSP_RESET 1'h0 -#define TXPC_MISC_SELTSN_MSB 21 -#define TXPC_MISC_SELTSN_LSB 21 -#define TXPC_MISC_SELTSN_MASK 'h00200000 -#define TXPC_MISC_SELTSN_GET(x) (((x) & TXPC_MISC_SELTSN_MASK) >> TXPC_MISC_SELTSN_LSB) -#define TXPC_MISC_SELTSN_SET(x) (((32'd0 | (x)) << TXPC_MISC_SELTSN_LSB) & TXPC_MISC_SELTSN_MASK) -#define TXPC_MISC_SELTSN_RESET 1'h0 -#define TXPC_MISC_SPARE_A_MSB 20 -#define TXPC_MISC_SPARE_A_LSB 18 -#define TXPC_MISC_SPARE_A_MASK 'h001c0000 -#define TXPC_MISC_SPARE_A_GET(x) (((x) & TXPC_MISC_SPARE_A_MASK) >> TXPC_MISC_SPARE_A_LSB) -#define TXPC_MISC_SPARE_A_SET(x) (((32'd0 | (x)) << TXPC_MISC_SPARE_A_LSB) & TXPC_MISC_SPARE_A_MASK) -#define TXPC_MISC_SPARE_A_RESET 3'h0 -#define TXPC_MISC_DECOUT_MSB 17 -#define TXPC_MISC_DECOUT_LSB 8 -#define TXPC_MISC_DECOUT_MASK 'h0003ff00 -#define TXPC_MISC_DECOUT_GET(x) (((x) & TXPC_MISC_DECOUT_MASK) >> TXPC_MISC_DECOUT_LSB) -#define TXPC_MISC_DECOUT_SET(x) (((32'd0 | (x)) << TXPC_MISC_DECOUT_LSB) & TXPC_MISC_DECOUT_MASK) -#define TXPC_MISC_DECOUT_RESET 10'h0 -#define TXPC_MISC_XTALDIV_MSB 7 -#define TXPC_MISC_XTALDIV_LSB 6 -#define TXPC_MISC_XTALDIV_MASK 'h000000c0 -#define TXPC_MISC_XTALDIV_GET(x) (((x) & TXPC_MISC_XTALDIV_MASK) >> TXPC_MISC_XTALDIV_LSB) -#define TXPC_MISC_XTALDIV_SET(x) (((32'd0 | (x)) << TXPC_MISC_XTALDIV_LSB) & TXPC_MISC_XTALDIV_MASK) -#define TXPC_MISC_XTALDIV_RESET 2'h0 -#define TXPC_MISC_SPARE_MSB 5 -#define TXPC_MISC_SPARE_LSB 0 -#define TXPC_MISC_SPARE_MASK 'h0000003f -#define TXPC_MISC_SPARE_GET(x) (((x) & TXPC_MISC_SPARE_MASK) >> TXPC_MISC_SPARE_LSB) -#define TXPC_MISC_SPARE_SET(x) (((32'd0 | (x)) << TXPC_MISC_SPARE_LSB) & TXPC_MISC_SPARE_MASK) -#define TXPC_MISC_SPARE_RESET 6'h0 -#define TXPC_MISC_RESET (32'h0 | \ - TXPC_MISC_FLIPBMODE_SET(TXPC_MISC_FLIPBMODE_RESET) | \ - TXPC_MISC_LEVEL_SET(TXPC_MISC_LEVEL_RESET) | \ - TXPC_MISC_LDO_TEST_MODE_SET(TXPC_MISC_LDO_TEST_MODE_RESET) | \ - TXPC_MISC_NOTCXODET_SET(TXPC_MISC_NOTCXODET_RESET) | \ - TXPC_MISC_PWDCLKIND_SET(TXPC_MISC_PWDCLKIND_RESET) | \ - TXPC_MISC_PWDXINPAD_SET(TXPC_MISC_PWDXINPAD_RESET) | \ - TXPC_MISC_LOCALBIAS_SET(TXPC_MISC_LOCALBIAS_RESET) | \ - TXPC_MISC_LOCALBIAS2X_SET(TXPC_MISC_LOCALBIAS2X_RESET) | \ - TXPC_MISC_SELTSP_SET(TXPC_MISC_SELTSP_RESET) | \ - TXPC_MISC_SELTSN_SET(TXPC_MISC_SELTSN_RESET) | \ - TXPC_MISC_SPARE_A_SET(TXPC_MISC_SPARE_A_RESET) | \ - TXPC_MISC_DECOUT_SET(TXPC_MISC_DECOUT_RESET) | \ - TXPC_MISC_XTALDIV_SET(TXPC_MISC_XTALDIV_RESET) | \ - TXPC_MISC_SPARE_SET(TXPC_MISC_SPARE_RESET)) -#define TXPC_MISC_HW_MASK (32'h0 | \ - TXPC_MISC_DECOUT_MASK) -#define TXPC_MISC_SW_MASK (32'h0 | \ - TXPC_MISC_FLIPBMODE_MASK | \ - TXPC_MISC_LEVEL_MASK | \ - TXPC_MISC_LDO_TEST_MODE_MASK | \ - TXPC_MISC_NOTCXODET_MASK | \ - TXPC_MISC_PWDCLKIND_MASK | \ - TXPC_MISC_PWDXINPAD_MASK | \ - TXPC_MISC_LOCALBIAS_MASK | \ - TXPC_MISC_LOCALBIAS2X_MASK | \ - TXPC_MISC_SELTSP_MASK | \ - TXPC_MISC_SELTSN_MASK | \ - TXPC_MISC_SPARE_A_MASK | \ - TXPC_MISC_DECOUT_MASK | \ - TXPC_MISC_XTALDIV_MASK | \ - TXPC_MISC_SPARE_MASK) - -#define RXTXBB_RXTXBB1_ADDRESS 'h00000050 -#define RXTXBB_RXTXBB1_SPARE_MSB 31 -#define RXTXBB_RXTXBB1_SPARE_LSB 19 -#define RXTXBB_RXTXBB1_SPARE_MASK 'hfff80000 -#define RXTXBB_RXTXBB1_SPARE_GET(x) (((x) & RXTXBB_RXTXBB1_SPARE_MASK) >> RXTXBB_RXTXBB1_SPARE_LSB) -#define RXTXBB_RXTXBB1_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_SPARE_LSB) & RXTXBB_RXTXBB1_SPARE_MASK) -#define RXTXBB_RXTXBB1_SPARE_RESET 13'h0 -#define RXTXBB_RXTXBB1_FNOTCH_MSB 18 -#define RXTXBB_RXTXBB1_FNOTCH_LSB 17 -#define RXTXBB_RXTXBB1_FNOTCH_MASK 'h00060000 -#define RXTXBB_RXTXBB1_FNOTCH_GET(x) (((x) & RXTXBB_RXTXBB1_FNOTCH_MASK) >> RXTXBB_RXTXBB1_FNOTCH_LSB) -#define RXTXBB_RXTXBB1_FNOTCH_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_FNOTCH_LSB) & RXTXBB_RXTXBB1_FNOTCH_MASK) -#define RXTXBB_RXTXBB1_FNOTCH_RESET 2'h0 -#define RXTXBB_RXTXBB1_SEL_ATB_MSB 16 -#define RXTXBB_RXTXBB1_SEL_ATB_LSB 9 -#define RXTXBB_RXTXBB1_SEL_ATB_MASK 'h0001fe00 -#define RXTXBB_RXTXBB1_SEL_ATB_GET(x) (((x) & RXTXBB_RXTXBB1_SEL_ATB_MASK) >> RXTXBB_RXTXBB1_SEL_ATB_LSB) -#define RXTXBB_RXTXBB1_SEL_ATB_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_SEL_ATB_LSB) & RXTXBB_RXTXBB1_SEL_ATB_MASK) -#define RXTXBB_RXTXBB1_SEL_ATB_RESET 8'h0 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_LSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MASK 'h00000100 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_GET(x) (((x) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) >> RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDV2I_MSB 7 -#define RXTXBB_RXTXBB1_PDV2I_LSB 7 -#define RXTXBB_RXTXBB1_PDV2I_MASK 'h00000080 -#define RXTXBB_RXTXBB1_PDV2I_GET(x) (((x) & RXTXBB_RXTXBB1_PDV2I_MASK) >> RXTXBB_RXTXBB1_PDV2I_LSB) -#define RXTXBB_RXTXBB1_PDV2I_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDV2I_LSB) & RXTXBB_RXTXBB1_PDV2I_MASK) -#define RXTXBB_RXTXBB1_PDV2I_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDI2V_MSB 6 -#define RXTXBB_RXTXBB1_PDI2V_LSB 6 -#define RXTXBB_RXTXBB1_PDI2V_MASK 'h00000040 -#define RXTXBB_RXTXBB1_PDI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDI2V_MASK) >> RXTXBB_RXTXBB1_PDI2V_LSB) -#define RXTXBB_RXTXBB1_PDI2V_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDI2V_LSB) & RXTXBB_RXTXBB1_PDI2V_MASK) -#define RXTXBB_RXTXBB1_PDI2V_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDRXTXBB_MSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_LSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_MASK 'h00000020 -#define RXTXBB_RXTXBB1_PDRXTXBB_GET(x) (((x) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) >> RXTXBB_RXTXBB1_PDRXTXBB_LSB) -#define RXTXBB_RXTXBB1_PDRXTXBB_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDRXTXBB_LSB) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) -#define RXTXBB_RXTXBB1_PDRXTXBB_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK 'h00000010 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK 'h00000008 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_LSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MASK 'h00000004 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) >> RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDLOQ_MSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_LSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_MASK 'h00000002 -#define RXTXBB_RXTXBB1_PDLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDLOQ_MASK) >> RXTXBB_RXTXBB1_PDLOQ_LSB) -#define RXTXBB_RXTXBB1_PDLOQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDLOQ_LSB) & RXTXBB_RXTXBB1_PDLOQ_MASK) -#define RXTXBB_RXTXBB1_PDLOQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDHIQ_MSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_LSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_MASK 'h00000001 -#define RXTXBB_RXTXBB1_PDHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDHIQ_MASK) >> RXTXBB_RXTXBB1_PDHIQ_LSB) -#define RXTXBB_RXTXBB1_PDHIQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDHIQ_LSB) & RXTXBB_RXTXBB1_PDHIQ_MASK) -#define RXTXBB_RXTXBB1_PDHIQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_RESET (32'h0 | \ - RXTXBB_RXTXBB1_SPARE_SET(RXTXBB_RXTXBB1_SPARE_RESET) | \ - RXTXBB_RXTXBB1_FNOTCH_SET(RXTXBB_RXTXBB1_FNOTCH_RESET) | \ - RXTXBB_RXTXBB1_SEL_ATB_SET(RXTXBB_RXTXBB1_SEL_ATB_RESET) | \ - RXTXBB_RXTXBB1_PDDACINTERFACE_SET(RXTXBB_RXTXBB1_PDDACINTERFACE_RESET) | \ - RXTXBB_RXTXBB1_PDV2I_SET(RXTXBB_RXTXBB1_PDV2I_RESET) | \ - RXTXBB_RXTXBB1_PDI2V_SET(RXTXBB_RXTXBB1_PDI2V_RESET) | \ - RXTXBB_RXTXBB1_PDRXTXBB_SET(RXTXBB_RXTXBB1_PDRXTXBB_RESET) | \ - RXTXBB_RXTXBB1_PDOFFSETLOQ_SET(RXTXBB_RXTXBB1_PDOFFSETLOQ_RESET) | \ - RXTXBB_RXTXBB1_PDOFFSETHIQ_SET(RXTXBB_RXTXBB1_PDOFFSETHIQ_RESET) | \ - RXTXBB_RXTXBB1_PDOFFSETI2V_SET(RXTXBB_RXTXBB1_PDOFFSETI2V_RESET) | \ - RXTXBB_RXTXBB1_PDLOQ_SET(RXTXBB_RXTXBB1_PDLOQ_RESET) | \ - RXTXBB_RXTXBB1_PDHIQ_SET(RXTXBB_RXTXBB1_PDHIQ_RESET)) -#define RXTXBB_RXTXBB1_HW_MASK (32'h0) -#define RXTXBB_RXTXBB1_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB1_SPARE_MASK | \ - RXTXBB_RXTXBB1_FNOTCH_MASK | \ - RXTXBB_RXTXBB1_SEL_ATB_MASK | \ - RXTXBB_RXTXBB1_PDDACINTERFACE_MASK | \ - RXTXBB_RXTXBB1_PDV2I_MASK | \ - RXTXBB_RXTXBB1_PDI2V_MASK | \ - RXTXBB_RXTXBB1_PDRXTXBB_MASK | \ - RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK | \ - RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK | \ - RXTXBB_RXTXBB1_PDOFFSETI2V_MASK | \ - RXTXBB_RXTXBB1_PDLOQ_MASK | \ - RXTXBB_RXTXBB1_PDHIQ_MASK) - -#define RXTXBB_RXTXBB2_ADDRESS 'h00000054 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MSB 31 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB 29 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK 'he0000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_RESET 3'h6 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MSB 28 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB 26 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK 'h1c000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_RESET 3'h6 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MSB 25 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB 23 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK 'h03800000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_RESET 3'h6 -#define RXTXBB_RXTXBB2_SPARE_MSB 22 -#define RXTXBB_RXTXBB2_SPARE_LSB 21 -#define RXTXBB_RXTXBB2_SPARE_MASK 'h00600000 -#define RXTXBB_RXTXBB2_SPARE_GET(x) (((x) & RXTXBB_RXTXBB2_SPARE_MASK) >> RXTXBB_RXTXBB2_SPARE_LSB) -#define RXTXBB_RXTXBB2_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SPARE_LSB) & RXTXBB_RXTXBB2_SPARE_MASK) -#define RXTXBB_RXTXBB2_SPARE_RESET 2'h0 -#define RXTXBB_RXTXBB2_SHORTBUFFER_MSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_LSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_MASK 'h00100000 -#define RXTXBB_RXTXBB2_SHORTBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) >> RXTXBB_RXTXBB2_SHORTBUFFER_LSB) -#define RXTXBB_RXTXBB2_SHORTBUFFER_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SHORTBUFFER_LSB) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) -#define RXTXBB_RXTXBB2_SHORTBUFFER_RESET 1'h0 -#define RXTXBB_RXTXBB2_SELBUFFER_MSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_LSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_MASK 'h00080000 -#define RXTXBB_RXTXBB2_SELBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SELBUFFER_MASK) >> RXTXBB_RXTXBB2_SELBUFFER_LSB) -#define RXTXBB_RXTXBB2_SELBUFFER_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SELBUFFER_LSB) & RXTXBB_RXTXBB2_SELBUFFER_MASK) -#define RXTXBB_RXTXBB2_SELBUFFER_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK 'h00040000 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK 'h00020000 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK 'h00010000 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK 'h00008000 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_CMSEL_MSB 14 -#define RXTXBB_RXTXBB2_CMSEL_LSB 13 -#define RXTXBB_RXTXBB2_CMSEL_MASK 'h00006000 -#define RXTXBB_RXTXBB2_CMSEL_GET(x) (((x) & RXTXBB_RXTXBB2_CMSEL_MASK) >> RXTXBB_RXTXBB2_CMSEL_LSB) -#define RXTXBB_RXTXBB2_CMSEL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_CMSEL_LSB) & RXTXBB_RXTXBB2_CMSEL_MASK) -#define RXTXBB_RXTXBB2_CMSEL_RESET 2'h1 -#define RXTXBB_RXTXBB2_FILTERFC_MSB 12 -#define RXTXBB_RXTXBB2_FILTERFC_LSB 8 -#define RXTXBB_RXTXBB2_FILTERFC_MASK 'h00001f00 -#define RXTXBB_RXTXBB2_FILTERFC_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERFC_MASK) >> RXTXBB_RXTXBB2_FILTERFC_LSB) -#define RXTXBB_RXTXBB2_FILTERFC_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_FILTERFC_LSB) & RXTXBB_RXTXBB2_FILTERFC_MASK) -#define RXTXBB_RXTXBB2_FILTERFC_RESET 5'h10 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK 'h00000080 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_GET(x) (((x) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) >> RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_RESET 1'h0 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK 'h00000040 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) >> RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK 'h00000020 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK 'h00000010 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_RESET 1'h1 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK 'h00000008 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK 'h00000004 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK 'h00000002 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_RESET 1'h1 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK 'h00000001 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_GET(x) (((x) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) >> RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_RESET 1'h0 -#define RXTXBB_RXTXBB2_RESET (32'h0 | \ - RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_SET(RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_RESET) | \ - RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_SET(RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_RESET) | \ - RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_SET(RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_RESET) | \ - RXTXBB_RXTXBB2_SPARE_SET(RXTXBB_RXTXBB2_SPARE_RESET) | \ - RXTXBB_RXTXBB2_SHORTBUFFER_SET(RXTXBB_RXTXBB2_SHORTBUFFER_RESET) | \ - RXTXBB_RXTXBB2_SELBUFFER_SET(RXTXBB_RXTXBB2_SELBUFFER_RESET) | \ - RXTXBB_RXTXBB2_SEL_DAC_TEST_SET(RXTXBB_RXTXBB2_SEL_DAC_TEST_RESET) | \ - RXTXBB_RXTXBB2_SEL_LOQ_TEST_SET(RXTXBB_RXTXBB2_SEL_LOQ_TEST_RESET) | \ - RXTXBB_RXTXBB2_SEL_HIQ_TEST_SET(RXTXBB_RXTXBB2_SEL_HIQ_TEST_RESET) | \ - RXTXBB_RXTXBB2_SEL_I2V_TEST_SET(RXTXBB_RXTXBB2_SEL_I2V_TEST_RESET) | \ - RXTXBB_RXTXBB2_CMSEL_SET(RXTXBB_RXTXBB2_CMSEL_RESET) | \ - RXTXBB_RXTXBB2_FILTERFC_SET(RXTXBB_RXTXBB2_FILTERFC_RESET) | \ - RXTXBB_RXTXBB2_LOCALFILTERTUNING_SET(RXTXBB_RXTXBB2_LOCALFILTERTUNING_RESET) | \ - RXTXBB_RXTXBB2_FILTERDOUBLEBW_SET(RXTXBB_RXTXBB2_FILTERDOUBLEBW_RESET) | \ - RXTXBB_RXTXBB2_PATH2HIQ_EN_SET(RXTXBB_RXTXBB2_PATH2HIQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH1HIQ_EN_SET(RXTXBB_RXTXBB2_PATH1HIQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH3LOQ_EN_SET(RXTXBB_RXTXBB2_PATH3LOQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH2LOQ_EN_SET(RXTXBB_RXTXBB2_PATH2LOQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH1LOQ_EN_SET(RXTXBB_RXTXBB2_PATH1LOQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH_OVERRIDE_SET(RXTXBB_RXTXBB2_PATH_OVERRIDE_RESET)) -#define RXTXBB_RXTXBB2_HW_MASK (32'h0 | \ - RXTXBB_RXTXBB2_FILTERFC_MASK) -#define RXTXBB_RXTXBB2_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK | \ - RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK | \ - RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK | \ - RXTXBB_RXTXBB2_SPARE_MASK | \ - RXTXBB_RXTXBB2_SHORTBUFFER_MASK | \ - RXTXBB_RXTXBB2_SELBUFFER_MASK | \ - RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK | \ - RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK | \ - RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK | \ - RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK | \ - RXTXBB_RXTXBB2_CMSEL_MASK | \ - RXTXBB_RXTXBB2_FILTERFC_MASK | \ - RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK | \ - RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK | \ - RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) - -#define RXTXBB_RXTXBB3_ADDRESS 'h00000058 -#define RXTXBB_RXTXBB3_SPARE_MSB 31 -#define RXTXBB_RXTXBB3_SPARE_LSB 27 -#define RXTXBB_RXTXBB3_SPARE_MASK 'hf8000000 -#define RXTXBB_RXTXBB3_SPARE_GET(x) (((x) & RXTXBB_RXTXBB3_SPARE_MASK) >> RXTXBB_RXTXBB3_SPARE_LSB) -#define RXTXBB_RXTXBB3_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_SPARE_LSB) & RXTXBB_RXTXBB3_SPARE_MASK) -#define RXTXBB_RXTXBB3_SPARE_RESET 5'h0 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MSB 26 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB 24 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK 'h07000000 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MSB 23 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB 21 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK 'h00e00000 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MSB 20 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB 18 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK 'h001c0000 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MSB 17 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB 15 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK 'h00038000 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MSB 14 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB 12 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK 'h00007000 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MSB 11 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB 9 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK 'h00000e00 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MSB 8 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB 6 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK 'h000001c0 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MSB 5 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB 3 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK 'h00000038 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) >> RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_RESET 3'h2 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MSB 2 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB 0 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK 'h00000007 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_RESET (32'h0 | \ - RXTXBB_RXTXBB3_SPARE_SET(RXTXBB_RXTXBB3_SPARE_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_SET(RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_SET(RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_RESET)) -#define RXTXBB_RXTXBB3_HW_MASK (32'h0) -#define RXTXBB_RXTXBB3_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB3_SPARE_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) - -#define RXTXBB_RXTXBB4_ADDRESS 'h0000005c -#define RXTXBB_RXTXBB4_SPARE_MSB 31 -#define RXTXBB_RXTXBB4_SPARE_LSB 31 -#define RXTXBB_RXTXBB4_SPARE_MASK 'h80000000 -#define RXTXBB_RXTXBB4_SPARE_GET(x) (((x) & RXTXBB_RXTXBB4_SPARE_MASK) >> RXTXBB_RXTXBB4_SPARE_LSB) -#define RXTXBB_RXTXBB4_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_SPARE_LSB) & RXTXBB_RXTXBB4_SPARE_MASK) -#define RXTXBB_RXTXBB4_SPARE_RESET 1'h0 -#define RXTXBB_RXTXBB4_LOCALOFFSET_MSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_LSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_MASK 'h40000000 -#define RXTXBB_RXTXBB4_LOCALOFFSET_GET(x) (((x) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) >> RXTXBB_RXTXBB4_LOCALOFFSET_LSB) -#define RXTXBB_RXTXBB4_LOCALOFFSET_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_LOCALOFFSET_LSB) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) -#define RXTXBB_RXTXBB4_LOCALOFFSET_RESET 1'h0 -#define RXTXBB_RXTXBB4_OFSTCORRHII_MSB 29 -#define RXTXBB_RXTXBB4_OFSTCORRHII_LSB 25 -#define RXTXBB_RXTXBB4_OFSTCORRHII_MASK 'h3e000000 -#define RXTXBB_RXTXBB4_OFSTCORRHII_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHII_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHII_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRHII_LSB) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHII_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MSB 24 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB 20 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK 'h01f00000 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MSB 19 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_LSB 15 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MASK 'h000f8000 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MSB 14 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB 10 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK 'h00007c00 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MSB 9 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB 5 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK 'h000003e0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MSB 4 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB 0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK 'h0000001f -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_RESET 5'h10 -#define RXTXBB_RXTXBB4_RESET (32'h0 | \ - RXTXBB_RXTXBB4_SPARE_SET(RXTXBB_RXTXBB4_SPARE_RESET) | \ - RXTXBB_RXTXBB4_LOCALOFFSET_SET(RXTXBB_RXTXBB4_LOCALOFFSET_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRHII_SET(RXTXBB_RXTXBB4_OFSTCORRHII_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRHIQ_SET(RXTXBB_RXTXBB4_OFSTCORRHIQ_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRLOI_SET(RXTXBB_RXTXBB4_OFSTCORRLOI_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRLOQ_SET(RXTXBB_RXTXBB4_OFSTCORRLOQ_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRI2VI_SET(RXTXBB_RXTXBB4_OFSTCORRI2VI_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRI2VQ_SET(RXTXBB_RXTXBB4_OFSTCORRI2VQ_RESET)) -#define RXTXBB_RXTXBB4_HW_MASK (32'h0 | \ - RXTXBB_RXTXBB4_OFSTCORRHII_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) -#define RXTXBB_RXTXBB4_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB4_SPARE_MASK | \ - RXTXBB_RXTXBB4_LOCALOFFSET_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRHII_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) - -#define ADDAC_ADDAC1_ADDRESS 'h00000060 -#define ADDAC_ADDAC1_PLL_SVREG_MSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_LSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_MASK 'h80000000 -#define ADDAC_ADDAC1_PLL_SVREG_GET(x) (((x) & ADDAC_ADDAC1_PLL_SVREG_MASK) >> ADDAC_ADDAC1_PLL_SVREG_LSB) -#define ADDAC_ADDAC1_PLL_SVREG_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_SVREG_LSB) & ADDAC_ADDAC1_PLL_SVREG_MASK) -#define ADDAC_ADDAC1_PLL_SVREG_RESET 1'h1 -#define ADDAC_ADDAC1_PLL_SCLAMP_MSB 30 -#define ADDAC_ADDAC1_PLL_SCLAMP_LSB 28 -#define ADDAC_ADDAC1_PLL_SCLAMP_MASK 'h70000000 -#define ADDAC_ADDAC1_PLL_SCLAMP_GET(x) (((x) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) >> ADDAC_ADDAC1_PLL_SCLAMP_LSB) -#define ADDAC_ADDAC1_PLL_SCLAMP_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_SCLAMP_LSB) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) -#define ADDAC_ADDAC1_PLL_SCLAMP_RESET 3'h5 -#define ADDAC_ADDAC1_PLL_ATB_MSB 27 -#define ADDAC_ADDAC1_PLL_ATB_LSB 26 -#define ADDAC_ADDAC1_PLL_ATB_MASK 'h0c000000 -#define ADDAC_ADDAC1_PLL_ATB_GET(x) (((x) & ADDAC_ADDAC1_PLL_ATB_MASK) >> ADDAC_ADDAC1_PLL_ATB_LSB) -#define ADDAC_ADDAC1_PLL_ATB_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_ATB_LSB) & ADDAC_ADDAC1_PLL_ATB_MASK) -#define ADDAC_ADDAC1_PLL_ATB_RESET 2'h0 -#define ADDAC_ADDAC1_PLL_ICP_MSB 25 -#define ADDAC_ADDAC1_PLL_ICP_LSB 23 -#define ADDAC_ADDAC1_PLL_ICP_MASK 'h03800000 -#define ADDAC_ADDAC1_PLL_ICP_GET(x) (((x) & ADDAC_ADDAC1_PLL_ICP_MASK) >> ADDAC_ADDAC1_PLL_ICP_LSB) -#define ADDAC_ADDAC1_PLL_ICP_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_ICP_LSB) & ADDAC_ADDAC1_PLL_ICP_MASK) -#define ADDAC_ADDAC1_PLL_ICP_RESET 3'h0 -#define ADDAC_ADDAC1_PLL_FILTER_MSB 22 -#define ADDAC_ADDAC1_PLL_FILTER_LSB 15 -#define ADDAC_ADDAC1_PLL_FILTER_MASK 'h007f8000 -#define ADDAC_ADDAC1_PLL_FILTER_GET(x) (((x) & ADDAC_ADDAC1_PLL_FILTER_MASK) >> ADDAC_ADDAC1_PLL_FILTER_LSB) -#define ADDAC_ADDAC1_PLL_FILTER_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_FILTER_LSB) & ADDAC_ADDAC1_PLL_FILTER_MASK) -#define ADDAC_ADDAC1_PLL_FILTER_RESET 8'h35 -#define ADDAC_ADDAC1_PWDPLL_MSB 14 -#define ADDAC_ADDAC1_PWDPLL_LSB 14 -#define ADDAC_ADDAC1_PWDPLL_MASK 'h00004000 -#define ADDAC_ADDAC1_PWDPLL_GET(x) (((x) & ADDAC_ADDAC1_PWDPLL_MASK) >> ADDAC_ADDAC1_PWDPLL_LSB) -#define ADDAC_ADDAC1_PWDPLL_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PWDPLL_LSB) & ADDAC_ADDAC1_PWDPLL_MASK) -#define ADDAC_ADDAC1_PWDPLL_RESET 1'h0 -#define ADDAC_ADDAC1_PWDADC_MSB 13 -#define ADDAC_ADDAC1_PWDADC_LSB 13 -#define ADDAC_ADDAC1_PWDADC_MASK 'h00002000 -#define ADDAC_ADDAC1_PWDADC_GET(x) (((x) & ADDAC_ADDAC1_PWDADC_MASK) >> ADDAC_ADDAC1_PWDADC_LSB) -#define ADDAC_ADDAC1_PWDADC_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PWDADC_LSB) & ADDAC_ADDAC1_PWDADC_MASK) -#define ADDAC_ADDAC1_PWDADC_RESET 1'h0 -#define ADDAC_ADDAC1_PWDDAC_MSB 12 -#define ADDAC_ADDAC1_PWDDAC_LSB 12 -#define ADDAC_ADDAC1_PWDDAC_MASK 'h00001000 -#define ADDAC_ADDAC1_PWDDAC_GET(x) (((x) & ADDAC_ADDAC1_PWDDAC_MASK) >> ADDAC_ADDAC1_PWDDAC_LSB) -#define ADDAC_ADDAC1_PWDDAC_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PWDDAC_LSB) & ADDAC_ADDAC1_PWDDAC_MASK) -#define ADDAC_ADDAC1_PWDDAC_RESET 1'h0 -#define ADDAC_ADDAC1_FORCEMSBLOW_MSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_LSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_MASK 'h00000800 -#define ADDAC_ADDAC1_FORCEMSBLOW_GET(x) (((x) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) >> ADDAC_ADDAC1_FORCEMSBLOW_LSB) -#define ADDAC_ADDAC1_FORCEMSBLOW_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_FORCEMSBLOW_LSB) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) -#define ADDAC_ADDAC1_FORCEMSBLOW_RESET 1'h0 -#define ADDAC_ADDAC1_SELMANPWDS_MSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_LSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_MASK 'h00000400 -#define ADDAC_ADDAC1_SELMANPWDS_GET(x) (((x) & ADDAC_ADDAC1_SELMANPWDS_MASK) >> ADDAC_ADDAC1_SELMANPWDS_LSB) -#define ADDAC_ADDAC1_SELMANPWDS_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_SELMANPWDS_LSB) & ADDAC_ADDAC1_SELMANPWDS_MASK) -#define ADDAC_ADDAC1_SELMANPWDS_RESET 1'h0 -#define ADDAC_ADDAC1_INV_CLK160_ADC_MSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_LSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_MASK 'h00000200 -#define ADDAC_ADDAC1_INV_CLK160_ADC_GET(x) (((x) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) >> ADDAC_ADDAC1_INV_CLK160_ADC_LSB) -#define ADDAC_ADDAC1_INV_CLK160_ADC_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_INV_CLK160_ADC_LSB) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) -#define ADDAC_ADDAC1_INV_CLK160_ADC_RESET 1'h0 -#define ADDAC_ADDAC1_CM_SEL_MSB 8 -#define ADDAC_ADDAC1_CM_SEL_LSB 7 -#define ADDAC_ADDAC1_CM_SEL_MASK 'h00000180 -#define ADDAC_ADDAC1_CM_SEL_GET(x) (((x) & ADDAC_ADDAC1_CM_SEL_MASK) >> ADDAC_ADDAC1_CM_SEL_LSB) -#define ADDAC_ADDAC1_CM_SEL_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_CM_SEL_LSB) & ADDAC_ADDAC1_CM_SEL_MASK) -#define ADDAC_ADDAC1_CM_SEL_RESET 2'h1 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_LSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MASK 'h00000040 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_GET(x) (((x) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) >> ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_RESET 1'h0 -#define ADDAC_ADDAC1_SPARE_MSB 5 -#define ADDAC_ADDAC1_SPARE_LSB 0 -#define ADDAC_ADDAC1_SPARE_MASK 'h0000003f -#define ADDAC_ADDAC1_SPARE_GET(x) (((x) & ADDAC_ADDAC1_SPARE_MASK) >> ADDAC_ADDAC1_SPARE_LSB) -#define ADDAC_ADDAC1_SPARE_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_SPARE_LSB) & ADDAC_ADDAC1_SPARE_MASK) -#define ADDAC_ADDAC1_SPARE_RESET 6'h0 -#define ADDAC_ADDAC1_RESET (32'h0 | \ - ADDAC_ADDAC1_PLL_SVREG_SET(ADDAC_ADDAC1_PLL_SVREG_RESET) | \ - ADDAC_ADDAC1_PLL_SCLAMP_SET(ADDAC_ADDAC1_PLL_SCLAMP_RESET) | \ - ADDAC_ADDAC1_PLL_ATB_SET(ADDAC_ADDAC1_PLL_ATB_RESET) | \ - ADDAC_ADDAC1_PLL_ICP_SET(ADDAC_ADDAC1_PLL_ICP_RESET) | \ - ADDAC_ADDAC1_PLL_FILTER_SET(ADDAC_ADDAC1_PLL_FILTER_RESET) | \ - ADDAC_ADDAC1_PWDPLL_SET(ADDAC_ADDAC1_PWDPLL_RESET) | \ - ADDAC_ADDAC1_PWDADC_SET(ADDAC_ADDAC1_PWDADC_RESET) | \ - ADDAC_ADDAC1_PWDDAC_SET(ADDAC_ADDAC1_PWDDAC_RESET) | \ - ADDAC_ADDAC1_FORCEMSBLOW_SET(ADDAC_ADDAC1_FORCEMSBLOW_RESET) | \ - ADDAC_ADDAC1_SELMANPWDS_SET(ADDAC_ADDAC1_SELMANPWDS_RESET) | \ - ADDAC_ADDAC1_INV_CLK160_ADC_SET(ADDAC_ADDAC1_INV_CLK160_ADC_RESET) | \ - ADDAC_ADDAC1_CM_SEL_SET(ADDAC_ADDAC1_CM_SEL_RESET) | \ - ADDAC_ADDAC1_DISABLE_DAC_REG_SET(ADDAC_ADDAC1_DISABLE_DAC_REG_RESET) | \ - ADDAC_ADDAC1_SPARE_SET(ADDAC_ADDAC1_SPARE_RESET)) -#define ADDAC_ADDAC1_HW_MASK (32'h0) -#define ADDAC_ADDAC1_SW_MASK (32'h0 | \ - ADDAC_ADDAC1_PLL_SVREG_MASK | \ - ADDAC_ADDAC1_PLL_SCLAMP_MASK | \ - ADDAC_ADDAC1_PLL_ATB_MASK | \ - ADDAC_ADDAC1_PLL_ICP_MASK | \ - ADDAC_ADDAC1_PLL_FILTER_MASK | \ - ADDAC_ADDAC1_PWDPLL_MASK | \ - ADDAC_ADDAC1_PWDADC_MASK | \ - ADDAC_ADDAC1_PWDDAC_MASK | \ - ADDAC_ADDAC1_FORCEMSBLOW_MASK | \ - ADDAC_ADDAC1_SELMANPWDS_MASK | \ - ADDAC_ADDAC1_INV_CLK160_ADC_MASK | \ - ADDAC_ADDAC1_CM_SEL_MASK | \ - ADDAC_ADDAC1_DISABLE_DAC_REG_MASK | \ - ADDAC_ADDAC1_SPARE_MASK) - -#define ANALOG_REG_ADDRESS_MSB 6 - -#endif /* _ANALOG_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/apb_map.h b/drivers/net/wireless/ar6003/include/AR6002/hw/apb_map.h deleted file mode 100644 index f3bf6d6cc82b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/apb_map.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _APB_MAP_H_ -#define _APB_MAP_H_ - -#define RTC_BASE_ADDRESS 0x00004000 -#define VMC_BASE_ADDRESS 0x00008000 -#define UART_BASE_ADDRESS 0x0000c000 -#define SI_BASE_ADDRESS 0x00010000 -#define GPIO_BASE_ADDRESS 0x00014000 -#define MBOX_BASE_ADDRESS 0x00018000 -#define ANALOG_INTF_BASE_ADDRESS 0x0001c000 -#define MAC_BASE_ADDRESS 0x00020000 - -#endif /* _APB_MAP_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/apb_map.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/apb_map.vrh deleted file mode 100644 index 078e022f9d74..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/apb_map.vrh +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _APB_MAP_VRH_ -#define _APB_MAP_VRH_ - -#define RTC_BASE_ADDRESS 'h00004000 -#define RTC_END_ADDRESS 'h000041ff -#define VMC_BASE_ADDRESS 'h00008000 -#define VMC_END_ADDRESS 'h000083ff -#define UART_BASE_ADDRESS 'h0000c000 -#define UART_END_ADDRESS 'h0000c03f -#define SI_BASE_ADDRESS 'h00010000 -#define SI_END_ADDRESS 'h0001001f -#define GPIO_BASE_ADDRESS 'h00014000 -#define GPIO_END_ADDRESS 'h000140ff -#define MBOX_BASE_ADDRESS 'h00018000 -#define MBOX_END_ADDRESS 'h0001bfff -#define ANALOG_INTF_BASE_ADDRESS 'h0001c000 -#define ANALOG_INTF_END_ADDRESS 'h0001c0ff -#define MAC_BASE_ADDRESS 'h00020000 -#define MAC_END_ADDRESS 'h0002ffff - -#endif /* _APB_MAP_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/bias_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/bias_reg.h deleted file mode 100644 index f8ca13152959..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/bias_reg.h +++ /dev/null @@ -1,293 +0,0 @@ -#ifndef _BIAS_REG_REG_H_ -#define _BIAS_REG_REG_H_ - -#define BIAS_BIAS_SEL_ADDRESS 0x00000000 -#define BIAS_BIAS_SEL_OFFSET 0x00000000 -#define BIAS_BIAS_SEL_PADON_MSB 31 -#define BIAS_BIAS_SEL_PADON_LSB 31 -#define BIAS_BIAS_SEL_PADON_MASK 0x80000000 -#define BIAS_BIAS_SEL_PADON_GET(x) (((x) & BIAS_BIAS_SEL_PADON_MASK) >> BIAS_BIAS_SEL_PADON_LSB) -#define BIAS_BIAS_SEL_PADON_SET(x) (((x) << BIAS_BIAS_SEL_PADON_LSB) & BIAS_BIAS_SEL_PADON_MASK) -#define BIAS_BIAS_SEL_SEL_BIAS_MSB 30 -#define BIAS_BIAS_SEL_SEL_BIAS_LSB 25 -#define BIAS_BIAS_SEL_SEL_BIAS_MASK 0x7e000000 -#define BIAS_BIAS_SEL_SEL_BIAS_GET(x) (((x) & BIAS_BIAS_SEL_SEL_BIAS_MASK) >> BIAS_BIAS_SEL_SEL_BIAS_LSB) -#define BIAS_BIAS_SEL_SEL_BIAS_SET(x) (((x) << BIAS_BIAS_SEL_SEL_BIAS_LSB) & BIAS_BIAS_SEL_SEL_BIAS_MASK) -#define BIAS_BIAS_SEL_SEL_SPARE_MSB 24 -#define BIAS_BIAS_SEL_SEL_SPARE_LSB 21 -#define BIAS_BIAS_SEL_SEL_SPARE_MASK 0x01e00000 -#define BIAS_BIAS_SEL_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SEL_SPARE_SET(x) (((x) << BIAS_BIAS_SEL_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_SPARE_MSB 20 -#define BIAS_BIAS_SEL_SPARE_LSB 20 -#define BIAS_BIAS_SEL_SPARE_MASK 0x00100000 -#define BIAS_BIAS_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SPARE_SET(x) (((x) << BIAS_BIAS_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MSB 19 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB 17 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK 0x000e0000 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK 0x00010000 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_SET(x) (((x) << BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK 0x00008000 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_SET(x) (((x) << BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK 0x00004000 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_LSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MASK 0x00002000 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) >> BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MSB 12 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB 10 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK 0x00001c00 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MSB 9 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_LSB 7 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MASK 0x00000380 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) >> BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MSB 6 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_LSB 4 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MASK 0x00000070 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) >> BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MSB 3 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_LSB 1 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MASK 0x0000000e -#define BIAS_BIAS_SEL_PWD_ICTXPC25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) >> BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) -#define BIAS_BIAS_SEL_PWD_ICLDO25_MSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_LSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_MASK 0x00000001 -#define BIAS_BIAS_SEL_PWD_ICLDO25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) >> BIAS_BIAS_SEL_PWD_ICLDO25_LSB) -#define BIAS_BIAS_SEL_PWD_ICLDO25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICLDO25_LSB) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) - -#define BIAS_BIAS1_ADDRESS 0x00000004 -#define BIAS_BIAS1_OFFSET 0x00000004 -#define BIAS_BIAS1_PWD_ICDAC2BB25_MSB 31 -#define BIAS_BIAS1_PWD_ICDAC2BB25_LSB 29 -#define BIAS_BIAS1_PWD_ICDAC2BB25_MASK 0xe0000000 -#define BIAS_BIAS1_PWD_ICDAC2BB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) >> BIAS_BIAS1_PWD_ICDAC2BB25_LSB) -#define BIAS_BIAS1_PWD_ICDAC2BB25_SET(x) (((x) << BIAS_BIAS1_PWD_ICDAC2BB25_LSB) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) -#define BIAS_BIAS1_PWD_IC2GVGM25_MSB 28 -#define BIAS_BIAS1_PWD_IC2GVGM25_LSB 26 -#define BIAS_BIAS1_PWD_IC2GVGM25_MASK 0x1c000000 -#define BIAS_BIAS1_PWD_IC2GVGM25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) >> BIAS_BIAS1_PWD_IC2GVGM25_LSB) -#define BIAS_BIAS1_PWD_IC2GVGM25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GVGM25_LSB) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) -#define BIAS_BIAS1_PWD_IC2GRFFE25_MSB 25 -#define BIAS_BIAS1_PWD_IC2GRFFE25_LSB 23 -#define BIAS_BIAS1_PWD_IC2GRFFE25_MASK 0x03800000 -#define BIAS_BIAS1_PWD_IC2GRFFE25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) >> BIAS_BIAS1_PWD_IC2GRFFE25_LSB) -#define BIAS_BIAS1_PWD_IC2GRFFE25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GRFFE25_LSB) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) -#define BIAS_BIAS1_PWD_IC2GLOREG25_MSB 22 -#define BIAS_BIAS1_PWD_IC2GLOREG25_LSB 20 -#define BIAS_BIAS1_PWD_IC2GLOREG25_MASK 0x00700000 -#define BIAS_BIAS1_PWD_IC2GLOREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLOREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLOREG25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GLOREG25_LSB) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MSB 19 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_LSB 17 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MASK 0x000e0000 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORB25_MSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_LSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_MASK 0x00010000 -#define BIAS_BIAS1_PWD_ICDETECTORB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORB25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORB25_SET(x) (((x) << BIAS_BIAS1_PWD_ICDETECTORB25_LSB) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORA25_MSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_LSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_MASK 0x00008000 -#define BIAS_BIAS1_PWD_ICDETECTORA25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORA25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORA25_SET(x) (((x) << BIAS_BIAS1_PWD_ICDETECTORA25_LSB) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) -#define BIAS_BIAS1_PWD_IC5GRXRF25_MSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_LSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_MASK 0x00004000 -#define BIAS_BIAS1_PWD_IC5GRXRF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) >> BIAS_BIAS1_PWD_IC5GRXRF25_LSB) -#define BIAS_BIAS1_PWD_IC5GRXRF25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GRXRF25_LSB) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXPA25_MSB 13 -#define BIAS_BIAS1_PWD_IC5GTXPA25_LSB 11 -#define BIAS_BIAS1_PWD_IC5GTXPA25_MASK 0x00003800 -#define BIAS_BIAS1_PWD_IC5GTXPA25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) >> BIAS_BIAS1_PWD_IC5GTXPA25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXPA25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GTXPA25_LSB) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MSB 10 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_LSB 8 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MASK 0x00000700 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) >> BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) -#define BIAS_BIAS1_PWD_IC5GQB25_MSB 7 -#define BIAS_BIAS1_PWD_IC5GQB25_LSB 5 -#define BIAS_BIAS1_PWD_IC5GQB25_MASK 0x000000e0 -#define BIAS_BIAS1_PWD_IC5GQB25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GQB25_MASK) >> BIAS_BIAS1_PWD_IC5GQB25_LSB) -#define BIAS_BIAS1_PWD_IC5GQB25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GQB25_LSB) & BIAS_BIAS1_PWD_IC5GQB25_MASK) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MSB 4 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_LSB 2 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MASK 0x0000001c -#define BIAS_BIAS1_PWD_IC5GMIXQ25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) >> BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) -#define BIAS_BIAS1_SPARE_MSB 1 -#define BIAS_BIAS1_SPARE_LSB 0 -#define BIAS_BIAS1_SPARE_MASK 0x00000003 -#define BIAS_BIAS1_SPARE_GET(x) (((x) & BIAS_BIAS1_SPARE_MASK) >> BIAS_BIAS1_SPARE_LSB) -#define BIAS_BIAS1_SPARE_SET(x) (((x) << BIAS_BIAS1_SPARE_LSB) & BIAS_BIAS1_SPARE_MASK) - -#define BIAS_BIAS2_ADDRESS 0x00000008 -#define BIAS_BIAS2_OFFSET 0x00000008 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MSB 31 -#define BIAS_BIAS2_PWD_IC5GMIXI25_LSB 29 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MASK 0xe0000000 -#define BIAS_BIAS2_PWD_IC5GMIXI25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) >> BIAS_BIAS2_PWD_IC5GMIXI25_LSB) -#define BIAS_BIAS2_PWD_IC5GMIXI25_SET(x) (((x) << BIAS_BIAS2_PWD_IC5GMIXI25_LSB) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) -#define BIAS_BIAS2_PWD_IC5GDIV25_MSB 28 -#define BIAS_BIAS2_PWD_IC5GDIV25_LSB 26 -#define BIAS_BIAS2_PWD_IC5GDIV25_MASK 0x1c000000 -#define BIAS_BIAS2_PWD_IC5GDIV25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) >> BIAS_BIAS2_PWD_IC5GDIV25_LSB) -#define BIAS_BIAS2_PWD_IC5GDIV25_SET(x) (((x) << BIAS_BIAS2_PWD_IC5GDIV25_LSB) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) -#define BIAS_BIAS2_PWD_IC5GLOREG25_MSB 25 -#define BIAS_BIAS2_PWD_IC5GLOREG25_LSB 23 -#define BIAS_BIAS2_PWD_IC5GLOREG25_MASK 0x03800000 -#define BIAS_BIAS2_PWD_IC5GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) >> BIAS_BIAS2_PWD_IC5GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IC5GLOREG25_SET(x) (((x) << BIAS_BIAS2_PWD_IC5GLOREG25_LSB) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IRPLL25_MSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_LSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_MASK 0x00400000 -#define BIAS_BIAS2_PWD_IRPLL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRPLL25_MASK) >> BIAS_BIAS2_PWD_IRPLL25_LSB) -#define BIAS_BIAS2_PWD_IRPLL25_SET(x) (((x) << BIAS_BIAS2_PWD_IRPLL25_LSB) & BIAS_BIAS2_PWD_IRPLL25_MASK) -#define BIAS_BIAS2_PWD_IRXTAL25_MSB 21 -#define BIAS_BIAS2_PWD_IRXTAL25_LSB 19 -#define BIAS_BIAS2_PWD_IRXTAL25_MASK 0x00380000 -#define BIAS_BIAS2_PWD_IRXTAL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRXTAL25_MASK) >> BIAS_BIAS2_PWD_IRXTAL25_LSB) -#define BIAS_BIAS2_PWD_IRXTAL25_SET(x) (((x) << BIAS_BIAS2_PWD_IRXTAL25_LSB) & BIAS_BIAS2_PWD_IRXTAL25_MASK) -#define BIAS_BIAS2_PWD_IRTSENS25_MSB 18 -#define BIAS_BIAS2_PWD_IRTSENS25_LSB 16 -#define BIAS_BIAS2_PWD_IRTSENS25_MASK 0x00070000 -#define BIAS_BIAS2_PWD_IRTSENS25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTSENS25_MASK) >> BIAS_BIAS2_PWD_IRTSENS25_LSB) -#define BIAS_BIAS2_PWD_IRTSENS25_SET(x) (((x) << BIAS_BIAS2_PWD_IRTSENS25_LSB) & BIAS_BIAS2_PWD_IRTSENS25_MASK) -#define BIAS_BIAS2_PWD_IRTXPC25_MSB 15 -#define BIAS_BIAS2_PWD_IRTXPC25_LSB 13 -#define BIAS_BIAS2_PWD_IRTXPC25_MASK 0x0000e000 -#define BIAS_BIAS2_PWD_IRTXPC25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTXPC25_MASK) >> BIAS_BIAS2_PWD_IRTXPC25_LSB) -#define BIAS_BIAS2_PWD_IRTXPC25_SET(x) (((x) << BIAS_BIAS2_PWD_IRTXPC25_LSB) & BIAS_BIAS2_PWD_IRTXPC25_MASK) -#define BIAS_BIAS2_PWD_IRLDO25_MSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_LSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_MASK 0x00001000 -#define BIAS_BIAS2_PWD_IRLDO25_GET(x) (((x) & BIAS_BIAS2_PWD_IRLDO25_MASK) >> BIAS_BIAS2_PWD_IRLDO25_LSB) -#define BIAS_BIAS2_PWD_IRLDO25_SET(x) (((x) << BIAS_BIAS2_PWD_IRLDO25_LSB) & BIAS_BIAS2_PWD_IRLDO25_MASK) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MSB 11 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_LSB 9 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MASK 0x00000e00 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) >> BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_SET(x) (((x) << BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) -#define BIAS_BIAS2_PWD_IR2GLOREG25_MSB 8 -#define BIAS_BIAS2_PWD_IR2GLOREG25_LSB 6 -#define BIAS_BIAS2_PWD_IR2GLOREG25_MASK 0x000001c0 -#define BIAS_BIAS2_PWD_IR2GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLOREG25_SET(x) (((x) << BIAS_BIAS2_PWD_IR2GLOREG25_LSB) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MSB 5 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_LSB 3 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MASK 0x00000038 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_SET(x) (((x) << BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MSB 2 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB 0 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK 0x00000007 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_GET(x) (((x) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) >> BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_SET(x) (((x) << BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) - -#define BIAS_BIAS3_ADDRESS 0x0000000c -#define BIAS_BIAS3_OFFSET 0x0000000c -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MSB 31 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_LSB 29 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MASK 0xe0000000 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) >> BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) -#define BIAS_BIAS3_PWD_IR5GTXMIX25_SET(x) (((x) << BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) -#define BIAS_BIAS3_PWD_IR5GAGC25_MSB 28 -#define BIAS_BIAS3_PWD_IR5GAGC25_LSB 26 -#define BIAS_BIAS3_PWD_IR5GAGC25_MASK 0x1c000000 -#define BIAS_BIAS3_PWD_IR5GAGC25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) >> BIAS_BIAS3_PWD_IR5GAGC25_LSB) -#define BIAS_BIAS3_PWD_IR5GAGC25_SET(x) (((x) << BIAS_BIAS3_PWD_IR5GAGC25_LSB) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) -#define BIAS_BIAS3_PWD_ICDAC50_MSB 25 -#define BIAS_BIAS3_PWD_ICDAC50_LSB 23 -#define BIAS_BIAS3_PWD_ICDAC50_MASK 0x03800000 -#define BIAS_BIAS3_PWD_ICDAC50_GET(x) (((x) & BIAS_BIAS3_PWD_ICDAC50_MASK) >> BIAS_BIAS3_PWD_ICDAC50_LSB) -#define BIAS_BIAS3_PWD_ICDAC50_SET(x) (((x) << BIAS_BIAS3_PWD_ICDAC50_LSB) & BIAS_BIAS3_PWD_ICDAC50_MASK) -#define BIAS_BIAS3_PWD_ICSYNTH50_MSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_LSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_MASK 0x00400000 -#define BIAS_BIAS3_PWD_ICSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) >> BIAS_BIAS3_PWD_ICSYNTH50_LSB) -#define BIAS_BIAS3_PWD_ICSYNTH50_SET(x) (((x) << BIAS_BIAS3_PWD_ICSYNTH50_LSB) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) -#define BIAS_BIAS3_PWD_ICBB50_MSB 21 -#define BIAS_BIAS3_PWD_ICBB50_LSB 21 -#define BIAS_BIAS3_PWD_ICBB50_MASK 0x00200000 -#define BIAS_BIAS3_PWD_ICBB50_GET(x) (((x) & BIAS_BIAS3_PWD_ICBB50_MASK) >> BIAS_BIAS3_PWD_ICBB50_LSB) -#define BIAS_BIAS3_PWD_ICBB50_SET(x) (((x) << BIAS_BIAS3_PWD_ICBB50_LSB) & BIAS_BIAS3_PWD_ICBB50_MASK) -#define BIAS_BIAS3_PWD_IC2GDIV50_MSB 20 -#define BIAS_BIAS3_PWD_IC2GDIV50_LSB 18 -#define BIAS_BIAS3_PWD_IC2GDIV50_MASK 0x001c0000 -#define BIAS_BIAS3_PWD_IC2GDIV50_GET(x) (((x) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) >> BIAS_BIAS3_PWD_IC2GDIV50_LSB) -#define BIAS_BIAS3_PWD_IC2GDIV50_SET(x) (((x) << BIAS_BIAS3_PWD_IC2GDIV50_LSB) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) -#define BIAS_BIAS3_PWD_IRSYNTH50_MSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_LSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_MASK 0x00020000 -#define BIAS_BIAS3_PWD_IRSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) >> BIAS_BIAS3_PWD_IRSYNTH50_LSB) -#define BIAS_BIAS3_PWD_IRSYNTH50_SET(x) (((x) << BIAS_BIAS3_PWD_IRSYNTH50_LSB) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) -#define BIAS_BIAS3_PWD_IRBB50_MSB 16 -#define BIAS_BIAS3_PWD_IRBB50_LSB 16 -#define BIAS_BIAS3_PWD_IRBB50_MASK 0x00010000 -#define BIAS_BIAS3_PWD_IRBB50_GET(x) (((x) & BIAS_BIAS3_PWD_IRBB50_MASK) >> BIAS_BIAS3_PWD_IRBB50_LSB) -#define BIAS_BIAS3_PWD_IRBB50_SET(x) (((x) << BIAS_BIAS3_PWD_IRBB50_LSB) & BIAS_BIAS3_PWD_IRBB50_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE1_MSB 15 -#define BIAS_BIAS3_PWD_IC25SPARE1_LSB 13 -#define BIAS_BIAS3_PWD_IC25SPARE1_MASK 0x0000e000 -#define BIAS_BIAS3_PWD_IC25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) >> BIAS_BIAS3_PWD_IC25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE1_SET(x) (((x) << BIAS_BIAS3_PWD_IC25SPARE1_LSB) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE2_MSB 12 -#define BIAS_BIAS3_PWD_IC25SPARE2_LSB 10 -#define BIAS_BIAS3_PWD_IC25SPARE2_MASK 0x00001c00 -#define BIAS_BIAS3_PWD_IC25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) >> BIAS_BIAS3_PWD_IC25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE2_SET(x) (((x) << BIAS_BIAS3_PWD_IC25SPARE2_LSB) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE1_MSB 9 -#define BIAS_BIAS3_PWD_IR25SPARE1_LSB 7 -#define BIAS_BIAS3_PWD_IR25SPARE1_MASK 0x00000380 -#define BIAS_BIAS3_PWD_IR25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) >> BIAS_BIAS3_PWD_IR25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE1_SET(x) (((x) << BIAS_BIAS3_PWD_IR25SPARE1_LSB) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE2_MSB 6 -#define BIAS_BIAS3_PWD_IR25SPARE2_LSB 4 -#define BIAS_BIAS3_PWD_IR25SPARE2_MASK 0x00000070 -#define BIAS_BIAS3_PWD_IR25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) >> BIAS_BIAS3_PWD_IR25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE2_SET(x) (((x) << BIAS_BIAS3_PWD_IR25SPARE2_LSB) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) -#define BIAS_BIAS3_PWD_ICDACREG12P5_MSB 3 -#define BIAS_BIAS3_PWD_ICDACREG12P5_LSB 1 -#define BIAS_BIAS3_PWD_ICDACREG12P5_MASK 0x0000000e -#define BIAS_BIAS3_PWD_ICDACREG12P5_GET(x) (((x) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) >> BIAS_BIAS3_PWD_ICDACREG12P5_LSB) -#define BIAS_BIAS3_PWD_ICDACREG12P5_SET(x) (((x) << BIAS_BIAS3_PWD_ICDACREG12P5_LSB) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) -#define BIAS_BIAS3_SPARE_MSB 0 -#define BIAS_BIAS3_SPARE_LSB 0 -#define BIAS_BIAS3_SPARE_MASK 0x00000001 -#define BIAS_BIAS3_SPARE_GET(x) (((x) & BIAS_BIAS3_SPARE_MASK) >> BIAS_BIAS3_SPARE_LSB) -#define BIAS_BIAS3_SPARE_SET(x) (((x) << BIAS_BIAS3_SPARE_LSB) & BIAS_BIAS3_SPARE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct bias_reg_reg_s { - volatile unsigned int bias_bias_sel; - volatile unsigned int bias_bias1; - volatile unsigned int bias_bias2; - volatile unsigned int bias_bias3; -} bias_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _BIAS_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/bias_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/bias_reg.vrh deleted file mode 100644 index c5cc4fe95445..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/bias_reg.vrh +++ /dev/null @@ -1,450 +0,0 @@ -#ifndef _BIAS_REG_VRH_ -#define _BIAS_REG_VRH_ - -#define BIAS_BIAS_SEL_ADDRESS 'h00000000 -#define BIAS_BIAS_SEL_PADON_MSB 31 -#define BIAS_BIAS_SEL_PADON_LSB 31 -#define BIAS_BIAS_SEL_PADON_MASK 'h80000000 -#define BIAS_BIAS_SEL_PADON_GET(x) (((x) & BIAS_BIAS_SEL_PADON_MASK) >> BIAS_BIAS_SEL_PADON_LSB) -#define BIAS_BIAS_SEL_PADON_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PADON_LSB) & BIAS_BIAS_SEL_PADON_MASK) -#define BIAS_BIAS_SEL_PADON_RESET 1'h0 -#define BIAS_BIAS_SEL_SEL_BIAS_MSB 30 -#define BIAS_BIAS_SEL_SEL_BIAS_LSB 25 -#define BIAS_BIAS_SEL_SEL_BIAS_MASK 'h7e000000 -#define BIAS_BIAS_SEL_SEL_BIAS_GET(x) (((x) & BIAS_BIAS_SEL_SEL_BIAS_MASK) >> BIAS_BIAS_SEL_SEL_BIAS_LSB) -#define BIAS_BIAS_SEL_SEL_BIAS_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_SEL_BIAS_LSB) & BIAS_BIAS_SEL_SEL_BIAS_MASK) -#define BIAS_BIAS_SEL_SEL_BIAS_RESET 6'h0 -#define BIAS_BIAS_SEL_SEL_SPARE_MSB 24 -#define BIAS_BIAS_SEL_SEL_SPARE_LSB 21 -#define BIAS_BIAS_SEL_SEL_SPARE_MASK 'h01e00000 -#define BIAS_BIAS_SEL_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SEL_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_SEL_SPARE_RESET 4'h0 -#define BIAS_BIAS_SEL_SPARE_MSB 20 -#define BIAS_BIAS_SEL_SPARE_LSB 20 -#define BIAS_BIAS_SEL_SPARE_MASK 'h00100000 -#define BIAS_BIAS_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_SPARE_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MSB 19 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB 17 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK 'h000e0000 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_RESET 3'h6 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK 'h00010000 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK 'h00008000 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK 'h00004000 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_LSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MASK 'h00002000 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) >> BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MSB 12 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB 10 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK 'h00001c00 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MSB 9 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_LSB 7 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MASK 'h00000380 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) >> BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MSB 6 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_LSB 4 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MASK 'h00000070 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) >> BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MSB 3 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_LSB 1 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MASK 'h0000000e -#define BIAS_BIAS_SEL_PWD_ICTXPC25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) >> BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICLDO25_MSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_LSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_MASK 'h00000001 -#define BIAS_BIAS_SEL_PWD_ICLDO25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) >> BIAS_BIAS_SEL_PWD_ICLDO25_LSB) -#define BIAS_BIAS_SEL_PWD_ICLDO25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICLDO25_LSB) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) -#define BIAS_BIAS_SEL_PWD_ICLDO25_RESET 1'h0 -#define BIAS_BIAS_SEL_RESET (32'h0 | \ - BIAS_BIAS_SEL_PADON_SET(BIAS_BIAS_SEL_PADON_RESET) | \ - BIAS_BIAS_SEL_SEL_BIAS_SET(BIAS_BIAS_SEL_SEL_BIAS_RESET) | \ - BIAS_BIAS_SEL_SEL_SPARE_SET(BIAS_BIAS_SEL_SEL_SPARE_RESET) | \ - BIAS_BIAS_SEL_SPARE_SET(BIAS_BIAS_SEL_SPARE_RESET) | \ - BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_SET(BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_RESET) | \ - BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_SET(BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_RESET) | \ - BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_SET(BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_RESET) | \ - BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_SET(BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICCPLL25_SET(BIAS_BIAS_SEL_PWD_ICCPLL25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_SET(BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICXTAL25_SET(BIAS_BIAS_SEL_PWD_ICXTAL25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICTSENS25_SET(BIAS_BIAS_SEL_PWD_ICTSENS25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICTXPC25_SET(BIAS_BIAS_SEL_PWD_ICTXPC25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICLDO25_SET(BIAS_BIAS_SEL_PWD_ICLDO25_RESET)) -#define BIAS_BIAS_SEL_HW_MASK (32'h0) -#define BIAS_BIAS_SEL_SW_MASK (32'h0 | \ - BIAS_BIAS_SEL_PADON_MASK | \ - BIAS_BIAS_SEL_SEL_BIAS_MASK | \ - BIAS_BIAS_SEL_SEL_SPARE_MASK | \ - BIAS_BIAS_SEL_SPARE_MASK | \ - BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK | \ - BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK | \ - BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK | \ - BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK | \ - BIAS_BIAS_SEL_PWD_ICCPLL25_MASK | \ - BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK | \ - BIAS_BIAS_SEL_PWD_ICXTAL25_MASK | \ - BIAS_BIAS_SEL_PWD_ICTSENS25_MASK | \ - BIAS_BIAS_SEL_PWD_ICTXPC25_MASK | \ - BIAS_BIAS_SEL_PWD_ICLDO25_MASK) - -#define BIAS_BIAS1_ADDRESS 'h00000004 -#define BIAS_BIAS1_PWD_ICDAC2BB25_MSB 31 -#define BIAS_BIAS1_PWD_ICDAC2BB25_LSB 29 -#define BIAS_BIAS1_PWD_ICDAC2BB25_MASK 'he0000000 -#define BIAS_BIAS1_PWD_ICDAC2BB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) >> BIAS_BIAS1_PWD_ICDAC2BB25_LSB) -#define BIAS_BIAS1_PWD_ICDAC2BB25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_ICDAC2BB25_LSB) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) -#define BIAS_BIAS1_PWD_ICDAC2BB25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GVGM25_MSB 28 -#define BIAS_BIAS1_PWD_IC2GVGM25_LSB 26 -#define BIAS_BIAS1_PWD_IC2GVGM25_MASK 'h1c000000 -#define BIAS_BIAS1_PWD_IC2GVGM25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) >> BIAS_BIAS1_PWD_IC2GVGM25_LSB) -#define BIAS_BIAS1_PWD_IC2GVGM25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GVGM25_LSB) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) -#define BIAS_BIAS1_PWD_IC2GVGM25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GRFFE25_MSB 25 -#define BIAS_BIAS1_PWD_IC2GRFFE25_LSB 23 -#define BIAS_BIAS1_PWD_IC2GRFFE25_MASK 'h03800000 -#define BIAS_BIAS1_PWD_IC2GRFFE25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) >> BIAS_BIAS1_PWD_IC2GRFFE25_LSB) -#define BIAS_BIAS1_PWD_IC2GRFFE25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GRFFE25_LSB) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) -#define BIAS_BIAS1_PWD_IC2GRFFE25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GLOREG25_MSB 22 -#define BIAS_BIAS1_PWD_IC2GLOREG25_LSB 20 -#define BIAS_BIAS1_PWD_IC2GLOREG25_MASK 'h00700000 -#define BIAS_BIAS1_PWD_IC2GLOREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLOREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLOREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GLOREG25_LSB) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) -#define BIAS_BIAS1_PWD_IC2GLOREG25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MSB 19 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_LSB 17 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MASK 'h000e0000 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_RESET 3'h3 -#define BIAS_BIAS1_PWD_ICDETECTORB25_MSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_LSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_MASK 'h00010000 -#define BIAS_BIAS1_PWD_ICDETECTORB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORB25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORB25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_ICDETECTORB25_LSB) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORB25_RESET 1'h0 -#define BIAS_BIAS1_PWD_ICDETECTORA25_MSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_LSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_MASK 'h00008000 -#define BIAS_BIAS1_PWD_ICDETECTORA25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORA25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORA25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_ICDETECTORA25_LSB) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORA25_RESET 1'h0 -#define BIAS_BIAS1_PWD_IC5GRXRF25_MSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_LSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_MASK 'h00004000 -#define BIAS_BIAS1_PWD_IC5GRXRF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) >> BIAS_BIAS1_PWD_IC5GRXRF25_LSB) -#define BIAS_BIAS1_PWD_IC5GRXRF25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GRXRF25_LSB) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) -#define BIAS_BIAS1_PWD_IC5GRXRF25_RESET 1'h0 -#define BIAS_BIAS1_PWD_IC5GTXPA25_MSB 13 -#define BIAS_BIAS1_PWD_IC5GTXPA25_LSB 11 -#define BIAS_BIAS1_PWD_IC5GTXPA25_MASK 'h00003800 -#define BIAS_BIAS1_PWD_IC5GTXPA25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) >> BIAS_BIAS1_PWD_IC5GTXPA25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXPA25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GTXPA25_LSB) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXPA25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MSB 10 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_LSB 8 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MASK 'h00000700 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) >> BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC5GQB25_MSB 7 -#define BIAS_BIAS1_PWD_IC5GQB25_LSB 5 -#define BIAS_BIAS1_PWD_IC5GQB25_MASK 'h000000e0 -#define BIAS_BIAS1_PWD_IC5GQB25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GQB25_MASK) >> BIAS_BIAS1_PWD_IC5GQB25_LSB) -#define BIAS_BIAS1_PWD_IC5GQB25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GQB25_LSB) & BIAS_BIAS1_PWD_IC5GQB25_MASK) -#define BIAS_BIAS1_PWD_IC5GQB25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MSB 4 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_LSB 2 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MASK 'h0000001c -#define BIAS_BIAS1_PWD_IC5GMIXQ25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) >> BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_RESET 3'h3 -#define BIAS_BIAS1_SPARE_MSB 1 -#define BIAS_BIAS1_SPARE_LSB 0 -#define BIAS_BIAS1_SPARE_MASK 'h00000003 -#define BIAS_BIAS1_SPARE_GET(x) (((x) & BIAS_BIAS1_SPARE_MASK) >> BIAS_BIAS1_SPARE_LSB) -#define BIAS_BIAS1_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_SPARE_LSB) & BIAS_BIAS1_SPARE_MASK) -#define BIAS_BIAS1_SPARE_RESET 2'h3 -#define BIAS_BIAS1_RESET (32'h0 | \ - BIAS_BIAS1_PWD_ICDAC2BB25_SET(BIAS_BIAS1_PWD_ICDAC2BB25_RESET) | \ - BIAS_BIAS1_PWD_IC2GVGM25_SET(BIAS_BIAS1_PWD_IC2GVGM25_RESET) | \ - BIAS_BIAS1_PWD_IC2GRFFE25_SET(BIAS_BIAS1_PWD_IC2GRFFE25_RESET) | \ - BIAS_BIAS1_PWD_IC2GLOREG25_SET(BIAS_BIAS1_PWD_IC2GLOREG25_RESET) | \ - BIAS_BIAS1_PWD_IC2GLNAREG25_SET(BIAS_BIAS1_PWD_IC2GLNAREG25_RESET) | \ - BIAS_BIAS1_PWD_ICDETECTORB25_SET(BIAS_BIAS1_PWD_ICDETECTORB25_RESET) | \ - BIAS_BIAS1_PWD_ICDETECTORA25_SET(BIAS_BIAS1_PWD_ICDETECTORA25_RESET) | \ - BIAS_BIAS1_PWD_IC5GRXRF25_SET(BIAS_BIAS1_PWD_IC5GRXRF25_RESET) | \ - BIAS_BIAS1_PWD_IC5GTXPA25_SET(BIAS_BIAS1_PWD_IC5GTXPA25_RESET) | \ - BIAS_BIAS1_PWD_IC5GTXBUF25_SET(BIAS_BIAS1_PWD_IC5GTXBUF25_RESET) | \ - BIAS_BIAS1_PWD_IC5GQB25_SET(BIAS_BIAS1_PWD_IC5GQB25_RESET) | \ - BIAS_BIAS1_PWD_IC5GMIXQ25_SET(BIAS_BIAS1_PWD_IC5GMIXQ25_RESET) | \ - BIAS_BIAS1_SPARE_SET(BIAS_BIAS1_SPARE_RESET)) -#define BIAS_BIAS1_HW_MASK (32'h0) -#define BIAS_BIAS1_SW_MASK (32'h0 | \ - BIAS_BIAS1_PWD_ICDAC2BB25_MASK | \ - BIAS_BIAS1_PWD_IC2GVGM25_MASK | \ - BIAS_BIAS1_PWD_IC2GRFFE25_MASK | \ - BIAS_BIAS1_PWD_IC2GLOREG25_MASK | \ - BIAS_BIAS1_PWD_IC2GLNAREG25_MASK | \ - BIAS_BIAS1_PWD_ICDETECTORB25_MASK | \ - BIAS_BIAS1_PWD_ICDETECTORA25_MASK | \ - BIAS_BIAS1_PWD_IC5GRXRF25_MASK | \ - BIAS_BIAS1_PWD_IC5GTXPA25_MASK | \ - BIAS_BIAS1_PWD_IC5GTXBUF25_MASK | \ - BIAS_BIAS1_PWD_IC5GQB25_MASK | \ - BIAS_BIAS1_PWD_IC5GMIXQ25_MASK | \ - BIAS_BIAS1_SPARE_MASK) - -#define BIAS_BIAS2_ADDRESS 'h00000008 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MSB 31 -#define BIAS_BIAS2_PWD_IC5GMIXI25_LSB 29 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MASK 'he0000000 -#define BIAS_BIAS2_PWD_IC5GMIXI25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) >> BIAS_BIAS2_PWD_IC5GMIXI25_LSB) -#define BIAS_BIAS2_PWD_IC5GMIXI25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IC5GMIXI25_LSB) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) -#define BIAS_BIAS2_PWD_IC5GMIXI25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IC5GDIV25_MSB 28 -#define BIAS_BIAS2_PWD_IC5GDIV25_LSB 26 -#define BIAS_BIAS2_PWD_IC5GDIV25_MASK 'h1c000000 -#define BIAS_BIAS2_PWD_IC5GDIV25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) >> BIAS_BIAS2_PWD_IC5GDIV25_LSB) -#define BIAS_BIAS2_PWD_IC5GDIV25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IC5GDIV25_LSB) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) -#define BIAS_BIAS2_PWD_IC5GDIV25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IC5GLOREG25_MSB 25 -#define BIAS_BIAS2_PWD_IC5GLOREG25_LSB 23 -#define BIAS_BIAS2_PWD_IC5GLOREG25_MASK 'h03800000 -#define BIAS_BIAS2_PWD_IC5GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) >> BIAS_BIAS2_PWD_IC5GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IC5GLOREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IC5GLOREG25_LSB) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IC5GLOREG25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRPLL25_MSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_LSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_MASK 'h00400000 -#define BIAS_BIAS2_PWD_IRPLL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRPLL25_MASK) >> BIAS_BIAS2_PWD_IRPLL25_LSB) -#define BIAS_BIAS2_PWD_IRPLL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRPLL25_LSB) & BIAS_BIAS2_PWD_IRPLL25_MASK) -#define BIAS_BIAS2_PWD_IRPLL25_RESET 1'h0 -#define BIAS_BIAS2_PWD_IRXTAL25_MSB 21 -#define BIAS_BIAS2_PWD_IRXTAL25_LSB 19 -#define BIAS_BIAS2_PWD_IRXTAL25_MASK 'h00380000 -#define BIAS_BIAS2_PWD_IRXTAL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRXTAL25_MASK) >> BIAS_BIAS2_PWD_IRXTAL25_LSB) -#define BIAS_BIAS2_PWD_IRXTAL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRXTAL25_LSB) & BIAS_BIAS2_PWD_IRXTAL25_MASK) -#define BIAS_BIAS2_PWD_IRXTAL25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRTSENS25_MSB 18 -#define BIAS_BIAS2_PWD_IRTSENS25_LSB 16 -#define BIAS_BIAS2_PWD_IRTSENS25_MASK 'h00070000 -#define BIAS_BIAS2_PWD_IRTSENS25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTSENS25_MASK) >> BIAS_BIAS2_PWD_IRTSENS25_LSB) -#define BIAS_BIAS2_PWD_IRTSENS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRTSENS25_LSB) & BIAS_BIAS2_PWD_IRTSENS25_MASK) -#define BIAS_BIAS2_PWD_IRTSENS25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRTXPC25_MSB 15 -#define BIAS_BIAS2_PWD_IRTXPC25_LSB 13 -#define BIAS_BIAS2_PWD_IRTXPC25_MASK 'h0000e000 -#define BIAS_BIAS2_PWD_IRTXPC25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTXPC25_MASK) >> BIAS_BIAS2_PWD_IRTXPC25_LSB) -#define BIAS_BIAS2_PWD_IRTXPC25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRTXPC25_LSB) & BIAS_BIAS2_PWD_IRTXPC25_MASK) -#define BIAS_BIAS2_PWD_IRTXPC25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRLDO25_MSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_LSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_MASK 'h00001000 -#define BIAS_BIAS2_PWD_IRLDO25_GET(x) (((x) & BIAS_BIAS2_PWD_IRLDO25_MASK) >> BIAS_BIAS2_PWD_IRLDO25_LSB) -#define BIAS_BIAS2_PWD_IRLDO25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRLDO25_LSB) & BIAS_BIAS2_PWD_IRLDO25_MASK) -#define BIAS_BIAS2_PWD_IRLDO25_RESET 1'h0 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MSB 11 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_LSB 9 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MASK 'h00000e00 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) >> BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IR2GLOREG25_MSB 8 -#define BIAS_BIAS2_PWD_IR2GLOREG25_LSB 6 -#define BIAS_BIAS2_PWD_IR2GLOREG25_MASK 'h000001c0 -#define BIAS_BIAS2_PWD_IR2GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLOREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR2GLOREG25_LSB) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IR2GLOREG25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MSB 5 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_LSB 3 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MASK 'h00000038 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MSB 2 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB 0 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK 'h00000007 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_GET(x) (((x) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) >> BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_RESET 3'h3 -#define BIAS_BIAS2_RESET (32'h0 | \ - BIAS_BIAS2_PWD_IC5GMIXI25_SET(BIAS_BIAS2_PWD_IC5GMIXI25_RESET) | \ - BIAS_BIAS2_PWD_IC5GDIV25_SET(BIAS_BIAS2_PWD_IC5GDIV25_RESET) | \ - BIAS_BIAS2_PWD_IC5GLOREG25_SET(BIAS_BIAS2_PWD_IC5GLOREG25_RESET) | \ - BIAS_BIAS2_PWD_IRPLL25_SET(BIAS_BIAS2_PWD_IRPLL25_RESET) | \ - BIAS_BIAS2_PWD_IRXTAL25_SET(BIAS_BIAS2_PWD_IRXTAL25_RESET) | \ - BIAS_BIAS2_PWD_IRTSENS25_SET(BIAS_BIAS2_PWD_IRTSENS25_RESET) | \ - BIAS_BIAS2_PWD_IRTXPC25_SET(BIAS_BIAS2_PWD_IRTXPC25_RESET) | \ - BIAS_BIAS2_PWD_IRLDO25_SET(BIAS_BIAS2_PWD_IRLDO25_RESET) | \ - BIAS_BIAS2_PWD_IR2GTXMIX25_SET(BIAS_BIAS2_PWD_IR2GTXMIX25_RESET) | \ - BIAS_BIAS2_PWD_IR2GLOREG25_SET(BIAS_BIAS2_PWD_IR2GLOREG25_RESET) | \ - BIAS_BIAS2_PWD_IR2GLNAREG25_SET(BIAS_BIAS2_PWD_IR2GLNAREG25_RESET) | \ - BIAS_BIAS2_PWD_IR5GRFVREF2525_SET(BIAS_BIAS2_PWD_IR5GRFVREF2525_RESET)) -#define BIAS_BIAS2_HW_MASK (32'h0) -#define BIAS_BIAS2_SW_MASK (32'h0 | \ - BIAS_BIAS2_PWD_IC5GMIXI25_MASK | \ - BIAS_BIAS2_PWD_IC5GDIV25_MASK | \ - BIAS_BIAS2_PWD_IC5GLOREG25_MASK | \ - BIAS_BIAS2_PWD_IRPLL25_MASK | \ - BIAS_BIAS2_PWD_IRXTAL25_MASK | \ - BIAS_BIAS2_PWD_IRTSENS25_MASK | \ - BIAS_BIAS2_PWD_IRTXPC25_MASK | \ - BIAS_BIAS2_PWD_IRLDO25_MASK | \ - BIAS_BIAS2_PWD_IR2GTXMIX25_MASK | \ - BIAS_BIAS2_PWD_IR2GLOREG25_MASK | \ - BIAS_BIAS2_PWD_IR2GLNAREG25_MASK | \ - BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) - -#define BIAS_BIAS3_ADDRESS 'h0000000c -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MSB 31 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_LSB 29 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MASK 'he0000000 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) >> BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) -#define BIAS_BIAS3_PWD_IR5GTXMIX25_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) -#define BIAS_BIAS3_PWD_IR5GTXMIX25_RESET 3'h3 -#define BIAS_BIAS3_PWD_IR5GAGC25_MSB 28 -#define BIAS_BIAS3_PWD_IR5GAGC25_LSB 26 -#define BIAS_BIAS3_PWD_IR5GAGC25_MASK 'h1c000000 -#define BIAS_BIAS3_PWD_IR5GAGC25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) >> BIAS_BIAS3_PWD_IR5GAGC25_LSB) -#define BIAS_BIAS3_PWD_IR5GAGC25_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR5GAGC25_LSB) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) -#define BIAS_BIAS3_PWD_IR5GAGC25_RESET 3'h3 -#define BIAS_BIAS3_PWD_ICDAC50_MSB 25 -#define BIAS_BIAS3_PWD_ICDAC50_LSB 23 -#define BIAS_BIAS3_PWD_ICDAC50_MASK 'h03800000 -#define BIAS_BIAS3_PWD_ICDAC50_GET(x) (((x) & BIAS_BIAS3_PWD_ICDAC50_MASK) >> BIAS_BIAS3_PWD_ICDAC50_LSB) -#define BIAS_BIAS3_PWD_ICDAC50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICDAC50_LSB) & BIAS_BIAS3_PWD_ICDAC50_MASK) -#define BIAS_BIAS3_PWD_ICDAC50_RESET 3'h3 -#define BIAS_BIAS3_PWD_ICSYNTH50_MSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_LSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_MASK 'h00400000 -#define BIAS_BIAS3_PWD_ICSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) >> BIAS_BIAS3_PWD_ICSYNTH50_LSB) -#define BIAS_BIAS3_PWD_ICSYNTH50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICSYNTH50_LSB) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) -#define BIAS_BIAS3_PWD_ICSYNTH50_RESET 1'h0 -#define BIAS_BIAS3_PWD_ICBB50_MSB 21 -#define BIAS_BIAS3_PWD_ICBB50_LSB 21 -#define BIAS_BIAS3_PWD_ICBB50_MASK 'h00200000 -#define BIAS_BIAS3_PWD_ICBB50_GET(x) (((x) & BIAS_BIAS3_PWD_ICBB50_MASK) >> BIAS_BIAS3_PWD_ICBB50_LSB) -#define BIAS_BIAS3_PWD_ICBB50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICBB50_LSB) & BIAS_BIAS3_PWD_ICBB50_MASK) -#define BIAS_BIAS3_PWD_ICBB50_RESET 1'h0 -#define BIAS_BIAS3_PWD_IC2GDIV50_MSB 20 -#define BIAS_BIAS3_PWD_IC2GDIV50_LSB 18 -#define BIAS_BIAS3_PWD_IC2GDIV50_MASK 'h001c0000 -#define BIAS_BIAS3_PWD_IC2GDIV50_GET(x) (((x) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) >> BIAS_BIAS3_PWD_IC2GDIV50_LSB) -#define BIAS_BIAS3_PWD_IC2GDIV50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IC2GDIV50_LSB) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) -#define BIAS_BIAS3_PWD_IC2GDIV50_RESET 3'h3 -#define BIAS_BIAS3_PWD_IRSYNTH50_MSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_LSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_MASK 'h00020000 -#define BIAS_BIAS3_PWD_IRSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) >> BIAS_BIAS3_PWD_IRSYNTH50_LSB) -#define BIAS_BIAS3_PWD_IRSYNTH50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IRSYNTH50_LSB) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) -#define BIAS_BIAS3_PWD_IRSYNTH50_RESET 1'h0 -#define BIAS_BIAS3_PWD_IRBB50_MSB 16 -#define BIAS_BIAS3_PWD_IRBB50_LSB 16 -#define BIAS_BIAS3_PWD_IRBB50_MASK 'h00010000 -#define BIAS_BIAS3_PWD_IRBB50_GET(x) (((x) & BIAS_BIAS3_PWD_IRBB50_MASK) >> BIAS_BIAS3_PWD_IRBB50_LSB) -#define BIAS_BIAS3_PWD_IRBB50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IRBB50_LSB) & BIAS_BIAS3_PWD_IRBB50_MASK) -#define BIAS_BIAS3_PWD_IRBB50_RESET 1'h0 -#define BIAS_BIAS3_PWD_IC25SPARE1_MSB 15 -#define BIAS_BIAS3_PWD_IC25SPARE1_LSB 13 -#define BIAS_BIAS3_PWD_IC25SPARE1_MASK 'h0000e000 -#define BIAS_BIAS3_PWD_IC25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) >> BIAS_BIAS3_PWD_IC25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE1_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IC25SPARE1_LSB) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE1_RESET 3'h3 -#define BIAS_BIAS3_PWD_IC25SPARE2_MSB 12 -#define BIAS_BIAS3_PWD_IC25SPARE2_LSB 10 -#define BIAS_BIAS3_PWD_IC25SPARE2_MASK 'h00001c00 -#define BIAS_BIAS3_PWD_IC25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) >> BIAS_BIAS3_PWD_IC25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE2_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IC25SPARE2_LSB) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE2_RESET 3'h3 -#define BIAS_BIAS3_PWD_IR25SPARE1_MSB 9 -#define BIAS_BIAS3_PWD_IR25SPARE1_LSB 7 -#define BIAS_BIAS3_PWD_IR25SPARE1_MASK 'h00000380 -#define BIAS_BIAS3_PWD_IR25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) >> BIAS_BIAS3_PWD_IR25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE1_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR25SPARE1_LSB) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE1_RESET 3'h3 -#define BIAS_BIAS3_PWD_IR25SPARE2_MSB 6 -#define BIAS_BIAS3_PWD_IR25SPARE2_LSB 4 -#define BIAS_BIAS3_PWD_IR25SPARE2_MASK 'h00000070 -#define BIAS_BIAS3_PWD_IR25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) >> BIAS_BIAS3_PWD_IR25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE2_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR25SPARE2_LSB) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE2_RESET 3'h3 -#define BIAS_BIAS3_PWD_ICDACREG12P5_MSB 3 -#define BIAS_BIAS3_PWD_ICDACREG12P5_LSB 1 -#define BIAS_BIAS3_PWD_ICDACREG12P5_MASK 'h0000000e -#define BIAS_BIAS3_PWD_ICDACREG12P5_GET(x) (((x) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) >> BIAS_BIAS3_PWD_ICDACREG12P5_LSB) -#define BIAS_BIAS3_PWD_ICDACREG12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICDACREG12P5_LSB) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) -#define BIAS_BIAS3_PWD_ICDACREG12P5_RESET 3'h5 -#define BIAS_BIAS3_SPARE_MSB 0 -#define BIAS_BIAS3_SPARE_LSB 0 -#define BIAS_BIAS3_SPARE_MASK 'h00000001 -#define BIAS_BIAS3_SPARE_GET(x) (((x) & BIAS_BIAS3_SPARE_MASK) >> BIAS_BIAS3_SPARE_LSB) -#define BIAS_BIAS3_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_SPARE_LSB) & BIAS_BIAS3_SPARE_MASK) -#define BIAS_BIAS3_SPARE_RESET 1'h0 -#define BIAS_BIAS3_RESET (32'h0 | \ - BIAS_BIAS3_PWD_IR5GTXMIX25_SET(BIAS_BIAS3_PWD_IR5GTXMIX25_RESET) | \ - BIAS_BIAS3_PWD_IR5GAGC25_SET(BIAS_BIAS3_PWD_IR5GAGC25_RESET) | \ - BIAS_BIAS3_PWD_ICDAC50_SET(BIAS_BIAS3_PWD_ICDAC50_RESET) | \ - BIAS_BIAS3_PWD_ICSYNTH50_SET(BIAS_BIAS3_PWD_ICSYNTH50_RESET) | \ - BIAS_BIAS3_PWD_ICBB50_SET(BIAS_BIAS3_PWD_ICBB50_RESET) | \ - BIAS_BIAS3_PWD_IC2GDIV50_SET(BIAS_BIAS3_PWD_IC2GDIV50_RESET) | \ - BIAS_BIAS3_PWD_IRSYNTH50_SET(BIAS_BIAS3_PWD_IRSYNTH50_RESET) | \ - BIAS_BIAS3_PWD_IRBB50_SET(BIAS_BIAS3_PWD_IRBB50_RESET) | \ - BIAS_BIAS3_PWD_IC25SPARE1_SET(BIAS_BIAS3_PWD_IC25SPARE1_RESET) | \ - BIAS_BIAS3_PWD_IC25SPARE2_SET(BIAS_BIAS3_PWD_IC25SPARE2_RESET) | \ - BIAS_BIAS3_PWD_IR25SPARE1_SET(BIAS_BIAS3_PWD_IR25SPARE1_RESET) | \ - BIAS_BIAS3_PWD_IR25SPARE2_SET(BIAS_BIAS3_PWD_IR25SPARE2_RESET) | \ - BIAS_BIAS3_PWD_ICDACREG12P5_SET(BIAS_BIAS3_PWD_ICDACREG12P5_RESET) | \ - BIAS_BIAS3_SPARE_SET(BIAS_BIAS3_SPARE_RESET)) -#define BIAS_BIAS3_HW_MASK (32'h0) -#define BIAS_BIAS3_SW_MASK (32'h0 | \ - BIAS_BIAS3_PWD_IR5GTXMIX25_MASK | \ - BIAS_BIAS3_PWD_IR5GAGC25_MASK | \ - BIAS_BIAS3_PWD_ICDAC50_MASK | \ - BIAS_BIAS3_PWD_ICSYNTH50_MASK | \ - BIAS_BIAS3_PWD_ICBB50_MASK | \ - BIAS_BIAS3_PWD_IC2GDIV50_MASK | \ - BIAS_BIAS3_PWD_IRSYNTH50_MASK | \ - BIAS_BIAS3_PWD_IRBB50_MASK | \ - BIAS_BIAS3_PWD_IC25SPARE1_MASK | \ - BIAS_BIAS3_PWD_IC25SPARE2_MASK | \ - BIAS_BIAS3_PWD_IR25SPARE1_MASK | \ - BIAS_BIAS3_PWD_IR25SPARE2_MASK | \ - BIAS_BIAS3_PWD_ICDACREG12P5_MASK | \ - BIAS_BIAS3_SPARE_MASK) - -#define BIAS_REG_ADDRESS_MSB 3 - -#endif /* _BIAS_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/gpio_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/gpio_reg.h deleted file mode 100644 index 4f2b964b7df3..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/gpio_reg.h +++ /dev/null @@ -1,977 +0,0 @@ -#ifndef _GPIO_REG_REG_H_ -#define _GPIO_REG_REG_H_ - -#define GPIO_OUT_ADDRESS 0x00000000 -#define GPIO_OUT_OFFSET 0x00000000 -#define GPIO_OUT_DATA_MSB 17 -#define GPIO_OUT_DATA_LSB 0 -#define GPIO_OUT_DATA_MASK 0x0003ffff -#define GPIO_OUT_DATA_GET(x) (((x) & GPIO_OUT_DATA_MASK) >> GPIO_OUT_DATA_LSB) -#define GPIO_OUT_DATA_SET(x) (((x) << GPIO_OUT_DATA_LSB) & GPIO_OUT_DATA_MASK) - -#define GPIO_OUT_W1TS_ADDRESS 0x00000004 -#define GPIO_OUT_W1TS_OFFSET 0x00000004 -#define GPIO_OUT_W1TS_DATA_MSB 17 -#define GPIO_OUT_W1TS_DATA_LSB 0 -#define GPIO_OUT_W1TS_DATA_MASK 0x0003ffff -#define GPIO_OUT_W1TS_DATA_GET(x) (((x) & GPIO_OUT_W1TS_DATA_MASK) >> GPIO_OUT_W1TS_DATA_LSB) -#define GPIO_OUT_W1TS_DATA_SET(x) (((x) << GPIO_OUT_W1TS_DATA_LSB) & GPIO_OUT_W1TS_DATA_MASK) - -#define GPIO_OUT_W1TC_ADDRESS 0x00000008 -#define GPIO_OUT_W1TC_OFFSET 0x00000008 -#define GPIO_OUT_W1TC_DATA_MSB 17 -#define GPIO_OUT_W1TC_DATA_LSB 0 -#define GPIO_OUT_W1TC_DATA_MASK 0x0003ffff -#define GPIO_OUT_W1TC_DATA_GET(x) (((x) & GPIO_OUT_W1TC_DATA_MASK) >> GPIO_OUT_W1TC_DATA_LSB) -#define GPIO_OUT_W1TC_DATA_SET(x) (((x) << GPIO_OUT_W1TC_DATA_LSB) & GPIO_OUT_W1TC_DATA_MASK) - -#define GPIO_ENABLE_ADDRESS 0x0000000c -#define GPIO_ENABLE_OFFSET 0x0000000c -#define GPIO_ENABLE_DATA_MSB 17 -#define GPIO_ENABLE_DATA_LSB 0 -#define GPIO_ENABLE_DATA_MASK 0x0003ffff -#define GPIO_ENABLE_DATA_GET(x) (((x) & GPIO_ENABLE_DATA_MASK) >> GPIO_ENABLE_DATA_LSB) -#define GPIO_ENABLE_DATA_SET(x) (((x) << GPIO_ENABLE_DATA_LSB) & GPIO_ENABLE_DATA_MASK) - -#define GPIO_ENABLE_W1TS_ADDRESS 0x00000010 -#define GPIO_ENABLE_W1TS_OFFSET 0x00000010 -#define GPIO_ENABLE_W1TS_DATA_MSB 17 -#define GPIO_ENABLE_W1TS_DATA_LSB 0 -#define GPIO_ENABLE_W1TS_DATA_MASK 0x0003ffff -#define GPIO_ENABLE_W1TS_DATA_GET(x) (((x) & GPIO_ENABLE_W1TS_DATA_MASK) >> GPIO_ENABLE_W1TS_DATA_LSB) -#define GPIO_ENABLE_W1TS_DATA_SET(x) (((x) << GPIO_ENABLE_W1TS_DATA_LSB) & GPIO_ENABLE_W1TS_DATA_MASK) - -#define GPIO_ENABLE_W1TC_ADDRESS 0x00000014 -#define GPIO_ENABLE_W1TC_OFFSET 0x00000014 -#define GPIO_ENABLE_W1TC_DATA_MSB 17 -#define GPIO_ENABLE_W1TC_DATA_LSB 0 -#define GPIO_ENABLE_W1TC_DATA_MASK 0x0003ffff -#define GPIO_ENABLE_W1TC_DATA_GET(x) (((x) & GPIO_ENABLE_W1TC_DATA_MASK) >> GPIO_ENABLE_W1TC_DATA_LSB) -#define GPIO_ENABLE_W1TC_DATA_SET(x) (((x) << GPIO_ENABLE_W1TC_DATA_LSB) & GPIO_ENABLE_W1TC_DATA_MASK) - -#define GPIO_IN_ADDRESS 0x00000018 -#define GPIO_IN_OFFSET 0x00000018 -#define GPIO_IN_DATA_MSB 17 -#define GPIO_IN_DATA_LSB 0 -#define GPIO_IN_DATA_MASK 0x0003ffff -#define GPIO_IN_DATA_GET(x) (((x) & GPIO_IN_DATA_MASK) >> GPIO_IN_DATA_LSB) -#define GPIO_IN_DATA_SET(x) (((x) << GPIO_IN_DATA_LSB) & GPIO_IN_DATA_MASK) - -#define GPIO_STATUS_ADDRESS 0x0000001c -#define GPIO_STATUS_OFFSET 0x0000001c -#define GPIO_STATUS_INTERRUPT_MSB 17 -#define GPIO_STATUS_INTERRUPT_LSB 0 -#define GPIO_STATUS_INTERRUPT_MASK 0x0003ffff -#define GPIO_STATUS_INTERRUPT_GET(x) (((x) & GPIO_STATUS_INTERRUPT_MASK) >> GPIO_STATUS_INTERRUPT_LSB) -#define GPIO_STATUS_INTERRUPT_SET(x) (((x) << GPIO_STATUS_INTERRUPT_LSB) & GPIO_STATUS_INTERRUPT_MASK) - -#define GPIO_STATUS_W1TS_ADDRESS 0x00000020 -#define GPIO_STATUS_W1TS_OFFSET 0x00000020 -#define GPIO_STATUS_W1TS_INTERRUPT_MSB 17 -#define GPIO_STATUS_W1TS_INTERRUPT_LSB 0 -#define GPIO_STATUS_W1TS_INTERRUPT_MASK 0x0003ffff -#define GPIO_STATUS_W1TS_INTERRUPT_GET(x) (((x) & GPIO_STATUS_W1TS_INTERRUPT_MASK) >> GPIO_STATUS_W1TS_INTERRUPT_LSB) -#define GPIO_STATUS_W1TS_INTERRUPT_SET(x) (((x) << GPIO_STATUS_W1TS_INTERRUPT_LSB) & GPIO_STATUS_W1TS_INTERRUPT_MASK) - -#define GPIO_STATUS_W1TC_ADDRESS 0x00000024 -#define GPIO_STATUS_W1TC_OFFSET 0x00000024 -#define GPIO_STATUS_W1TC_INTERRUPT_MSB 17 -#define GPIO_STATUS_W1TC_INTERRUPT_LSB 0 -#define GPIO_STATUS_W1TC_INTERRUPT_MASK 0x0003ffff -#define GPIO_STATUS_W1TC_INTERRUPT_GET(x) (((x) & GPIO_STATUS_W1TC_INTERRUPT_MASK) >> GPIO_STATUS_W1TC_INTERRUPT_LSB) -#define GPIO_STATUS_W1TC_INTERRUPT_SET(x) (((x) << GPIO_STATUS_W1TC_INTERRUPT_LSB) & GPIO_STATUS_W1TC_INTERRUPT_MASK) - -#define GPIO_PIN0_ADDRESS 0x00000028 -#define GPIO_PIN0_OFFSET 0x00000028 -#define GPIO_PIN0_CONFIG_MSB 12 -#define GPIO_PIN0_CONFIG_LSB 11 -#define GPIO_PIN0_CONFIG_MASK 0x00001800 -#define GPIO_PIN0_CONFIG_GET(x) (((x) & GPIO_PIN0_CONFIG_MASK) >> GPIO_PIN0_CONFIG_LSB) -#define GPIO_PIN0_CONFIG_SET(x) (((x) << GPIO_PIN0_CONFIG_LSB) & GPIO_PIN0_CONFIG_MASK) -#define GPIO_PIN0_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN0_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN0_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN0_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN0_WAKEUP_ENABLE_MASK) >> GPIO_PIN0_WAKEUP_ENABLE_LSB) -#define GPIO_PIN0_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN0_WAKEUP_ENABLE_LSB) & GPIO_PIN0_WAKEUP_ENABLE_MASK) -#define GPIO_PIN0_INT_TYPE_MSB 9 -#define GPIO_PIN0_INT_TYPE_LSB 7 -#define GPIO_PIN0_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN0_INT_TYPE_GET(x) (((x) & GPIO_PIN0_INT_TYPE_MASK) >> GPIO_PIN0_INT_TYPE_LSB) -#define GPIO_PIN0_INT_TYPE_SET(x) (((x) << GPIO_PIN0_INT_TYPE_LSB) & GPIO_PIN0_INT_TYPE_MASK) -#define GPIO_PIN0_PAD_DRIVER_MSB 2 -#define GPIO_PIN0_PAD_DRIVER_LSB 2 -#define GPIO_PIN0_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN0_PAD_DRIVER_GET(x) (((x) & GPIO_PIN0_PAD_DRIVER_MASK) >> GPIO_PIN0_PAD_DRIVER_LSB) -#define GPIO_PIN0_PAD_DRIVER_SET(x) (((x) << GPIO_PIN0_PAD_DRIVER_LSB) & GPIO_PIN0_PAD_DRIVER_MASK) -#define GPIO_PIN0_SOURCE_MSB 0 -#define GPIO_PIN0_SOURCE_LSB 0 -#define GPIO_PIN0_SOURCE_MASK 0x00000001 -#define GPIO_PIN0_SOURCE_GET(x) (((x) & GPIO_PIN0_SOURCE_MASK) >> GPIO_PIN0_SOURCE_LSB) -#define GPIO_PIN0_SOURCE_SET(x) (((x) << GPIO_PIN0_SOURCE_LSB) & GPIO_PIN0_SOURCE_MASK) - -#define GPIO_PIN1_ADDRESS 0x0000002c -#define GPIO_PIN1_OFFSET 0x0000002c -#define GPIO_PIN1_CONFIG_MSB 12 -#define GPIO_PIN1_CONFIG_LSB 11 -#define GPIO_PIN1_CONFIG_MASK 0x00001800 -#define GPIO_PIN1_CONFIG_GET(x) (((x) & GPIO_PIN1_CONFIG_MASK) >> GPIO_PIN1_CONFIG_LSB) -#define GPIO_PIN1_CONFIG_SET(x) (((x) << GPIO_PIN1_CONFIG_LSB) & GPIO_PIN1_CONFIG_MASK) -#define GPIO_PIN1_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN1_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN1_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN1_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN1_WAKEUP_ENABLE_MASK) >> GPIO_PIN1_WAKEUP_ENABLE_LSB) -#define GPIO_PIN1_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN1_WAKEUP_ENABLE_LSB) & GPIO_PIN1_WAKEUP_ENABLE_MASK) -#define GPIO_PIN1_INT_TYPE_MSB 9 -#define GPIO_PIN1_INT_TYPE_LSB 7 -#define GPIO_PIN1_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN1_INT_TYPE_GET(x) (((x) & GPIO_PIN1_INT_TYPE_MASK) >> GPIO_PIN1_INT_TYPE_LSB) -#define GPIO_PIN1_INT_TYPE_SET(x) (((x) << GPIO_PIN1_INT_TYPE_LSB) & GPIO_PIN1_INT_TYPE_MASK) -#define GPIO_PIN1_PAD_DRIVER_MSB 2 -#define GPIO_PIN1_PAD_DRIVER_LSB 2 -#define GPIO_PIN1_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN1_PAD_DRIVER_GET(x) (((x) & GPIO_PIN1_PAD_DRIVER_MASK) >> GPIO_PIN1_PAD_DRIVER_LSB) -#define GPIO_PIN1_PAD_DRIVER_SET(x) (((x) << GPIO_PIN1_PAD_DRIVER_LSB) & GPIO_PIN1_PAD_DRIVER_MASK) -#define GPIO_PIN1_SOURCE_MSB 0 -#define GPIO_PIN1_SOURCE_LSB 0 -#define GPIO_PIN1_SOURCE_MASK 0x00000001 -#define GPIO_PIN1_SOURCE_GET(x) (((x) & GPIO_PIN1_SOURCE_MASK) >> GPIO_PIN1_SOURCE_LSB) -#define GPIO_PIN1_SOURCE_SET(x) (((x) << GPIO_PIN1_SOURCE_LSB) & GPIO_PIN1_SOURCE_MASK) - -#define GPIO_PIN2_ADDRESS 0x00000030 -#define GPIO_PIN2_OFFSET 0x00000030 -#define GPIO_PIN2_CONFIG_MSB 12 -#define GPIO_PIN2_CONFIG_LSB 11 -#define GPIO_PIN2_CONFIG_MASK 0x00001800 -#define GPIO_PIN2_CONFIG_GET(x) (((x) & GPIO_PIN2_CONFIG_MASK) >> GPIO_PIN2_CONFIG_LSB) -#define GPIO_PIN2_CONFIG_SET(x) (((x) << GPIO_PIN2_CONFIG_LSB) & GPIO_PIN2_CONFIG_MASK) -#define GPIO_PIN2_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN2_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN2_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN2_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN2_WAKEUP_ENABLE_MASK) >> GPIO_PIN2_WAKEUP_ENABLE_LSB) -#define GPIO_PIN2_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN2_WAKEUP_ENABLE_LSB) & GPIO_PIN2_WAKEUP_ENABLE_MASK) -#define GPIO_PIN2_INT_TYPE_MSB 9 -#define GPIO_PIN2_INT_TYPE_LSB 7 -#define GPIO_PIN2_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN2_INT_TYPE_GET(x) (((x) & GPIO_PIN2_INT_TYPE_MASK) >> GPIO_PIN2_INT_TYPE_LSB) -#define GPIO_PIN2_INT_TYPE_SET(x) (((x) << GPIO_PIN2_INT_TYPE_LSB) & GPIO_PIN2_INT_TYPE_MASK) -#define GPIO_PIN2_PAD_DRIVER_MSB 2 -#define GPIO_PIN2_PAD_DRIVER_LSB 2 -#define GPIO_PIN2_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN2_PAD_DRIVER_GET(x) (((x) & GPIO_PIN2_PAD_DRIVER_MASK) >> GPIO_PIN2_PAD_DRIVER_LSB) -#define GPIO_PIN2_PAD_DRIVER_SET(x) (((x) << GPIO_PIN2_PAD_DRIVER_LSB) & GPIO_PIN2_PAD_DRIVER_MASK) -#define GPIO_PIN2_SOURCE_MSB 0 -#define GPIO_PIN2_SOURCE_LSB 0 -#define GPIO_PIN2_SOURCE_MASK 0x00000001 -#define GPIO_PIN2_SOURCE_GET(x) (((x) & GPIO_PIN2_SOURCE_MASK) >> GPIO_PIN2_SOURCE_LSB) -#define GPIO_PIN2_SOURCE_SET(x) (((x) << GPIO_PIN2_SOURCE_LSB) & GPIO_PIN2_SOURCE_MASK) - -#define GPIO_PIN3_ADDRESS 0x00000034 -#define GPIO_PIN3_OFFSET 0x00000034 -#define GPIO_PIN3_CONFIG_MSB 12 -#define GPIO_PIN3_CONFIG_LSB 11 -#define GPIO_PIN3_CONFIG_MASK 0x00001800 -#define GPIO_PIN3_CONFIG_GET(x) (((x) & GPIO_PIN3_CONFIG_MASK) >> GPIO_PIN3_CONFIG_LSB) -#define GPIO_PIN3_CONFIG_SET(x) (((x) << GPIO_PIN3_CONFIG_LSB) & GPIO_PIN3_CONFIG_MASK) -#define GPIO_PIN3_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN3_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN3_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN3_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN3_WAKEUP_ENABLE_MASK) >> GPIO_PIN3_WAKEUP_ENABLE_LSB) -#define GPIO_PIN3_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN3_WAKEUP_ENABLE_LSB) & GPIO_PIN3_WAKEUP_ENABLE_MASK) -#define GPIO_PIN3_INT_TYPE_MSB 9 -#define GPIO_PIN3_INT_TYPE_LSB 7 -#define GPIO_PIN3_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN3_INT_TYPE_GET(x) (((x) & GPIO_PIN3_INT_TYPE_MASK) >> GPIO_PIN3_INT_TYPE_LSB) -#define GPIO_PIN3_INT_TYPE_SET(x) (((x) << GPIO_PIN3_INT_TYPE_LSB) & GPIO_PIN3_INT_TYPE_MASK) -#define GPIO_PIN3_PAD_DRIVER_MSB 2 -#define GPIO_PIN3_PAD_DRIVER_LSB 2 -#define GPIO_PIN3_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN3_PAD_DRIVER_GET(x) (((x) & GPIO_PIN3_PAD_DRIVER_MASK) >> GPIO_PIN3_PAD_DRIVER_LSB) -#define GPIO_PIN3_PAD_DRIVER_SET(x) (((x) << GPIO_PIN3_PAD_DRIVER_LSB) & GPIO_PIN3_PAD_DRIVER_MASK) -#define GPIO_PIN3_SOURCE_MSB 0 -#define GPIO_PIN3_SOURCE_LSB 0 -#define GPIO_PIN3_SOURCE_MASK 0x00000001 -#define GPIO_PIN3_SOURCE_GET(x) (((x) & GPIO_PIN3_SOURCE_MASK) >> GPIO_PIN3_SOURCE_LSB) -#define GPIO_PIN3_SOURCE_SET(x) (((x) << GPIO_PIN3_SOURCE_LSB) & GPIO_PIN3_SOURCE_MASK) - -#define GPIO_PIN4_ADDRESS 0x00000038 -#define GPIO_PIN4_OFFSET 0x00000038 -#define GPIO_PIN4_CONFIG_MSB 12 -#define GPIO_PIN4_CONFIG_LSB 11 -#define GPIO_PIN4_CONFIG_MASK 0x00001800 -#define GPIO_PIN4_CONFIG_GET(x) (((x) & GPIO_PIN4_CONFIG_MASK) >> GPIO_PIN4_CONFIG_LSB) -#define GPIO_PIN4_CONFIG_SET(x) (((x) << GPIO_PIN4_CONFIG_LSB) & GPIO_PIN4_CONFIG_MASK) -#define GPIO_PIN4_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN4_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN4_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN4_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN4_WAKEUP_ENABLE_MASK) >> GPIO_PIN4_WAKEUP_ENABLE_LSB) -#define GPIO_PIN4_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN4_WAKEUP_ENABLE_LSB) & GPIO_PIN4_WAKEUP_ENABLE_MASK) -#define GPIO_PIN4_INT_TYPE_MSB 9 -#define GPIO_PIN4_INT_TYPE_LSB 7 -#define GPIO_PIN4_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN4_INT_TYPE_GET(x) (((x) & GPIO_PIN4_INT_TYPE_MASK) >> GPIO_PIN4_INT_TYPE_LSB) -#define GPIO_PIN4_INT_TYPE_SET(x) (((x) << GPIO_PIN4_INT_TYPE_LSB) & GPIO_PIN4_INT_TYPE_MASK) -#define GPIO_PIN4_PAD_DRIVER_MSB 2 -#define GPIO_PIN4_PAD_DRIVER_LSB 2 -#define GPIO_PIN4_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN4_PAD_DRIVER_GET(x) (((x) & GPIO_PIN4_PAD_DRIVER_MASK) >> GPIO_PIN4_PAD_DRIVER_LSB) -#define GPIO_PIN4_PAD_DRIVER_SET(x) (((x) << GPIO_PIN4_PAD_DRIVER_LSB) & GPIO_PIN4_PAD_DRIVER_MASK) -#define GPIO_PIN4_SOURCE_MSB 0 -#define GPIO_PIN4_SOURCE_LSB 0 -#define GPIO_PIN4_SOURCE_MASK 0x00000001 -#define GPIO_PIN4_SOURCE_GET(x) (((x) & GPIO_PIN4_SOURCE_MASK) >> GPIO_PIN4_SOURCE_LSB) -#define GPIO_PIN4_SOURCE_SET(x) (((x) << GPIO_PIN4_SOURCE_LSB) & GPIO_PIN4_SOURCE_MASK) - -#define GPIO_PIN5_ADDRESS 0x0000003c -#define GPIO_PIN5_OFFSET 0x0000003c -#define GPIO_PIN5_CONFIG_MSB 12 -#define GPIO_PIN5_CONFIG_LSB 11 -#define GPIO_PIN5_CONFIG_MASK 0x00001800 -#define GPIO_PIN5_CONFIG_GET(x) (((x) & GPIO_PIN5_CONFIG_MASK) >> GPIO_PIN5_CONFIG_LSB) -#define GPIO_PIN5_CONFIG_SET(x) (((x) << GPIO_PIN5_CONFIG_LSB) & GPIO_PIN5_CONFIG_MASK) -#define GPIO_PIN5_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN5_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN5_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN5_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN5_WAKEUP_ENABLE_MASK) >> GPIO_PIN5_WAKEUP_ENABLE_LSB) -#define GPIO_PIN5_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN5_WAKEUP_ENABLE_LSB) & GPIO_PIN5_WAKEUP_ENABLE_MASK) -#define GPIO_PIN5_INT_TYPE_MSB 9 -#define GPIO_PIN5_INT_TYPE_LSB 7 -#define GPIO_PIN5_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN5_INT_TYPE_GET(x) (((x) & GPIO_PIN5_INT_TYPE_MASK) >> GPIO_PIN5_INT_TYPE_LSB) -#define GPIO_PIN5_INT_TYPE_SET(x) (((x) << GPIO_PIN5_INT_TYPE_LSB) & GPIO_PIN5_INT_TYPE_MASK) -#define GPIO_PIN5_PAD_DRIVER_MSB 2 -#define GPIO_PIN5_PAD_DRIVER_LSB 2 -#define GPIO_PIN5_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN5_PAD_DRIVER_GET(x) (((x) & GPIO_PIN5_PAD_DRIVER_MASK) >> GPIO_PIN5_PAD_DRIVER_LSB) -#define GPIO_PIN5_PAD_DRIVER_SET(x) (((x) << GPIO_PIN5_PAD_DRIVER_LSB) & GPIO_PIN5_PAD_DRIVER_MASK) -#define GPIO_PIN5_SOURCE_MSB 0 -#define GPIO_PIN5_SOURCE_LSB 0 -#define GPIO_PIN5_SOURCE_MASK 0x00000001 -#define GPIO_PIN5_SOURCE_GET(x) (((x) & GPIO_PIN5_SOURCE_MASK) >> GPIO_PIN5_SOURCE_LSB) -#define GPIO_PIN5_SOURCE_SET(x) (((x) << GPIO_PIN5_SOURCE_LSB) & GPIO_PIN5_SOURCE_MASK) - -#define GPIO_PIN6_ADDRESS 0x00000040 -#define GPIO_PIN6_OFFSET 0x00000040 -#define GPIO_PIN6_CONFIG_MSB 12 -#define GPIO_PIN6_CONFIG_LSB 11 -#define GPIO_PIN6_CONFIG_MASK 0x00001800 -#define GPIO_PIN6_CONFIG_GET(x) (((x) & GPIO_PIN6_CONFIG_MASK) >> GPIO_PIN6_CONFIG_LSB) -#define GPIO_PIN6_CONFIG_SET(x) (((x) << GPIO_PIN6_CONFIG_LSB) & GPIO_PIN6_CONFIG_MASK) -#define GPIO_PIN6_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN6_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN6_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN6_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN6_WAKEUP_ENABLE_MASK) >> GPIO_PIN6_WAKEUP_ENABLE_LSB) -#define GPIO_PIN6_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN6_WAKEUP_ENABLE_LSB) & GPIO_PIN6_WAKEUP_ENABLE_MASK) -#define GPIO_PIN6_INT_TYPE_MSB 9 -#define GPIO_PIN6_INT_TYPE_LSB 7 -#define GPIO_PIN6_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN6_INT_TYPE_GET(x) (((x) & GPIO_PIN6_INT_TYPE_MASK) >> GPIO_PIN6_INT_TYPE_LSB) -#define GPIO_PIN6_INT_TYPE_SET(x) (((x) << GPIO_PIN6_INT_TYPE_LSB) & GPIO_PIN6_INT_TYPE_MASK) -#define GPIO_PIN6_PAD_DRIVER_MSB 2 -#define GPIO_PIN6_PAD_DRIVER_LSB 2 -#define GPIO_PIN6_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN6_PAD_DRIVER_GET(x) (((x) & GPIO_PIN6_PAD_DRIVER_MASK) >> GPIO_PIN6_PAD_DRIVER_LSB) -#define GPIO_PIN6_PAD_DRIVER_SET(x) (((x) << GPIO_PIN6_PAD_DRIVER_LSB) & GPIO_PIN6_PAD_DRIVER_MASK) -#define GPIO_PIN6_SOURCE_MSB 0 -#define GPIO_PIN6_SOURCE_LSB 0 -#define GPIO_PIN6_SOURCE_MASK 0x00000001 -#define GPIO_PIN6_SOURCE_GET(x) (((x) & GPIO_PIN6_SOURCE_MASK) >> GPIO_PIN6_SOURCE_LSB) -#define GPIO_PIN6_SOURCE_SET(x) (((x) << GPIO_PIN6_SOURCE_LSB) & GPIO_PIN6_SOURCE_MASK) - -#define GPIO_PIN7_ADDRESS 0x00000044 -#define GPIO_PIN7_OFFSET 0x00000044 -#define GPIO_PIN7_CONFIG_MSB 12 -#define GPIO_PIN7_CONFIG_LSB 11 -#define GPIO_PIN7_CONFIG_MASK 0x00001800 -#define GPIO_PIN7_CONFIG_GET(x) (((x) & GPIO_PIN7_CONFIG_MASK) >> GPIO_PIN7_CONFIG_LSB) -#define GPIO_PIN7_CONFIG_SET(x) (((x) << GPIO_PIN7_CONFIG_LSB) & GPIO_PIN7_CONFIG_MASK) -#define GPIO_PIN7_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN7_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN7_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN7_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN7_WAKEUP_ENABLE_MASK) >> GPIO_PIN7_WAKEUP_ENABLE_LSB) -#define GPIO_PIN7_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN7_WAKEUP_ENABLE_LSB) & GPIO_PIN7_WAKEUP_ENABLE_MASK) -#define GPIO_PIN7_INT_TYPE_MSB 9 -#define GPIO_PIN7_INT_TYPE_LSB 7 -#define GPIO_PIN7_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN7_INT_TYPE_GET(x) (((x) & GPIO_PIN7_INT_TYPE_MASK) >> GPIO_PIN7_INT_TYPE_LSB) -#define GPIO_PIN7_INT_TYPE_SET(x) (((x) << GPIO_PIN7_INT_TYPE_LSB) & GPIO_PIN7_INT_TYPE_MASK) -#define GPIO_PIN7_PAD_DRIVER_MSB 2 -#define GPIO_PIN7_PAD_DRIVER_LSB 2 -#define GPIO_PIN7_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN7_PAD_DRIVER_GET(x) (((x) & GPIO_PIN7_PAD_DRIVER_MASK) >> GPIO_PIN7_PAD_DRIVER_LSB) -#define GPIO_PIN7_PAD_DRIVER_SET(x) (((x) << GPIO_PIN7_PAD_DRIVER_LSB) & GPIO_PIN7_PAD_DRIVER_MASK) -#define GPIO_PIN7_SOURCE_MSB 0 -#define GPIO_PIN7_SOURCE_LSB 0 -#define GPIO_PIN7_SOURCE_MASK 0x00000001 -#define GPIO_PIN7_SOURCE_GET(x) (((x) & GPIO_PIN7_SOURCE_MASK) >> GPIO_PIN7_SOURCE_LSB) -#define GPIO_PIN7_SOURCE_SET(x) (((x) << GPIO_PIN7_SOURCE_LSB) & GPIO_PIN7_SOURCE_MASK) - -#define GPIO_PIN8_ADDRESS 0x00000048 -#define GPIO_PIN8_OFFSET 0x00000048 -#define GPIO_PIN8_CONFIG_MSB 12 -#define GPIO_PIN8_CONFIG_LSB 11 -#define GPIO_PIN8_CONFIG_MASK 0x00001800 -#define GPIO_PIN8_CONFIG_GET(x) (((x) & GPIO_PIN8_CONFIG_MASK) >> GPIO_PIN8_CONFIG_LSB) -#define GPIO_PIN8_CONFIG_SET(x) (((x) << GPIO_PIN8_CONFIG_LSB) & GPIO_PIN8_CONFIG_MASK) -#define GPIO_PIN8_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN8_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN8_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN8_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN8_WAKEUP_ENABLE_MASK) >> GPIO_PIN8_WAKEUP_ENABLE_LSB) -#define GPIO_PIN8_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN8_WAKEUP_ENABLE_LSB) & GPIO_PIN8_WAKEUP_ENABLE_MASK) -#define GPIO_PIN8_INT_TYPE_MSB 9 -#define GPIO_PIN8_INT_TYPE_LSB 7 -#define GPIO_PIN8_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN8_INT_TYPE_GET(x) (((x) & GPIO_PIN8_INT_TYPE_MASK) >> GPIO_PIN8_INT_TYPE_LSB) -#define GPIO_PIN8_INT_TYPE_SET(x) (((x) << GPIO_PIN8_INT_TYPE_LSB) & GPIO_PIN8_INT_TYPE_MASK) -#define GPIO_PIN8_PAD_DRIVER_MSB 2 -#define GPIO_PIN8_PAD_DRIVER_LSB 2 -#define GPIO_PIN8_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN8_PAD_DRIVER_GET(x) (((x) & GPIO_PIN8_PAD_DRIVER_MASK) >> GPIO_PIN8_PAD_DRIVER_LSB) -#define GPIO_PIN8_PAD_DRIVER_SET(x) (((x) << GPIO_PIN8_PAD_DRIVER_LSB) & GPIO_PIN8_PAD_DRIVER_MASK) -#define GPIO_PIN8_SOURCE_MSB 0 -#define GPIO_PIN8_SOURCE_LSB 0 -#define GPIO_PIN8_SOURCE_MASK 0x00000001 -#define GPIO_PIN8_SOURCE_GET(x) (((x) & GPIO_PIN8_SOURCE_MASK) >> GPIO_PIN8_SOURCE_LSB) -#define GPIO_PIN8_SOURCE_SET(x) (((x) << GPIO_PIN8_SOURCE_LSB) & GPIO_PIN8_SOURCE_MASK) - -#define GPIO_PIN9_ADDRESS 0x0000004c -#define GPIO_PIN9_OFFSET 0x0000004c -#define GPIO_PIN9_CONFIG_MSB 12 -#define GPIO_PIN9_CONFIG_LSB 11 -#define GPIO_PIN9_CONFIG_MASK 0x00001800 -#define GPIO_PIN9_CONFIG_GET(x) (((x) & GPIO_PIN9_CONFIG_MASK) >> GPIO_PIN9_CONFIG_LSB) -#define GPIO_PIN9_CONFIG_SET(x) (((x) << GPIO_PIN9_CONFIG_LSB) & GPIO_PIN9_CONFIG_MASK) -#define GPIO_PIN9_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN9_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN9_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN9_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN9_WAKEUP_ENABLE_MASK) >> GPIO_PIN9_WAKEUP_ENABLE_LSB) -#define GPIO_PIN9_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN9_WAKEUP_ENABLE_LSB) & GPIO_PIN9_WAKEUP_ENABLE_MASK) -#define GPIO_PIN9_INT_TYPE_MSB 9 -#define GPIO_PIN9_INT_TYPE_LSB 7 -#define GPIO_PIN9_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN9_INT_TYPE_GET(x) (((x) & GPIO_PIN9_INT_TYPE_MASK) >> GPIO_PIN9_INT_TYPE_LSB) -#define GPIO_PIN9_INT_TYPE_SET(x) (((x) << GPIO_PIN9_INT_TYPE_LSB) & GPIO_PIN9_INT_TYPE_MASK) -#define GPIO_PIN9_PAD_DRIVER_MSB 2 -#define GPIO_PIN9_PAD_DRIVER_LSB 2 -#define GPIO_PIN9_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN9_PAD_DRIVER_GET(x) (((x) & GPIO_PIN9_PAD_DRIVER_MASK) >> GPIO_PIN9_PAD_DRIVER_LSB) -#define GPIO_PIN9_PAD_DRIVER_SET(x) (((x) << GPIO_PIN9_PAD_DRIVER_LSB) & GPIO_PIN9_PAD_DRIVER_MASK) -#define GPIO_PIN9_SOURCE_MSB 0 -#define GPIO_PIN9_SOURCE_LSB 0 -#define GPIO_PIN9_SOURCE_MASK 0x00000001 -#define GPIO_PIN9_SOURCE_GET(x) (((x) & GPIO_PIN9_SOURCE_MASK) >> GPIO_PIN9_SOURCE_LSB) -#define GPIO_PIN9_SOURCE_SET(x) (((x) << GPIO_PIN9_SOURCE_LSB) & GPIO_PIN9_SOURCE_MASK) - -#define GPIO_PIN10_ADDRESS 0x00000050 -#define GPIO_PIN10_OFFSET 0x00000050 -#define GPIO_PIN10_CONFIG_MSB 12 -#define GPIO_PIN10_CONFIG_LSB 11 -#define GPIO_PIN10_CONFIG_MASK 0x00001800 -#define GPIO_PIN10_CONFIG_GET(x) (((x) & GPIO_PIN10_CONFIG_MASK) >> GPIO_PIN10_CONFIG_LSB) -#define GPIO_PIN10_CONFIG_SET(x) (((x) << GPIO_PIN10_CONFIG_LSB) & GPIO_PIN10_CONFIG_MASK) -#define GPIO_PIN10_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN10_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN10_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN10_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN10_WAKEUP_ENABLE_MASK) >> GPIO_PIN10_WAKEUP_ENABLE_LSB) -#define GPIO_PIN10_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN10_WAKEUP_ENABLE_LSB) & GPIO_PIN10_WAKEUP_ENABLE_MASK) -#define GPIO_PIN10_INT_TYPE_MSB 9 -#define GPIO_PIN10_INT_TYPE_LSB 7 -#define GPIO_PIN10_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN10_INT_TYPE_GET(x) (((x) & GPIO_PIN10_INT_TYPE_MASK) >> GPIO_PIN10_INT_TYPE_LSB) -#define GPIO_PIN10_INT_TYPE_SET(x) (((x) << GPIO_PIN10_INT_TYPE_LSB) & GPIO_PIN10_INT_TYPE_MASK) -#define GPIO_PIN10_PAD_DRIVER_MSB 2 -#define GPIO_PIN10_PAD_DRIVER_LSB 2 -#define GPIO_PIN10_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN10_PAD_DRIVER_GET(x) (((x) & GPIO_PIN10_PAD_DRIVER_MASK) >> GPIO_PIN10_PAD_DRIVER_LSB) -#define GPIO_PIN10_PAD_DRIVER_SET(x) (((x) << GPIO_PIN10_PAD_DRIVER_LSB) & GPIO_PIN10_PAD_DRIVER_MASK) -#define GPIO_PIN10_SOURCE_MSB 0 -#define GPIO_PIN10_SOURCE_LSB 0 -#define GPIO_PIN10_SOURCE_MASK 0x00000001 -#define GPIO_PIN10_SOURCE_GET(x) (((x) & GPIO_PIN10_SOURCE_MASK) >> GPIO_PIN10_SOURCE_LSB) -#define GPIO_PIN10_SOURCE_SET(x) (((x) << GPIO_PIN10_SOURCE_LSB) & GPIO_PIN10_SOURCE_MASK) - -#define GPIO_PIN11_ADDRESS 0x00000054 -#define GPIO_PIN11_OFFSET 0x00000054 -#define GPIO_PIN11_CONFIG_MSB 12 -#define GPIO_PIN11_CONFIG_LSB 11 -#define GPIO_PIN11_CONFIG_MASK 0x00001800 -#define GPIO_PIN11_CONFIG_GET(x) (((x) & GPIO_PIN11_CONFIG_MASK) >> GPIO_PIN11_CONFIG_LSB) -#define GPIO_PIN11_CONFIG_SET(x) (((x) << GPIO_PIN11_CONFIG_LSB) & GPIO_PIN11_CONFIG_MASK) -#define GPIO_PIN11_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN11_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN11_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN11_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN11_WAKEUP_ENABLE_MASK) >> GPIO_PIN11_WAKEUP_ENABLE_LSB) -#define GPIO_PIN11_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN11_WAKEUP_ENABLE_LSB) & GPIO_PIN11_WAKEUP_ENABLE_MASK) -#define GPIO_PIN11_INT_TYPE_MSB 9 -#define GPIO_PIN11_INT_TYPE_LSB 7 -#define GPIO_PIN11_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN11_INT_TYPE_GET(x) (((x) & GPIO_PIN11_INT_TYPE_MASK) >> GPIO_PIN11_INT_TYPE_LSB) -#define GPIO_PIN11_INT_TYPE_SET(x) (((x) << GPIO_PIN11_INT_TYPE_LSB) & GPIO_PIN11_INT_TYPE_MASK) -#define GPIO_PIN11_PAD_DRIVER_MSB 2 -#define GPIO_PIN11_PAD_DRIVER_LSB 2 -#define GPIO_PIN11_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN11_PAD_DRIVER_GET(x) (((x) & GPIO_PIN11_PAD_DRIVER_MASK) >> GPIO_PIN11_PAD_DRIVER_LSB) -#define GPIO_PIN11_PAD_DRIVER_SET(x) (((x) << GPIO_PIN11_PAD_DRIVER_LSB) & GPIO_PIN11_PAD_DRIVER_MASK) -#define GPIO_PIN11_SOURCE_MSB 0 -#define GPIO_PIN11_SOURCE_LSB 0 -#define GPIO_PIN11_SOURCE_MASK 0x00000001 -#define GPIO_PIN11_SOURCE_GET(x) (((x) & GPIO_PIN11_SOURCE_MASK) >> GPIO_PIN11_SOURCE_LSB) -#define GPIO_PIN11_SOURCE_SET(x) (((x) << GPIO_PIN11_SOURCE_LSB) & GPIO_PIN11_SOURCE_MASK) - -#define GPIO_PIN12_ADDRESS 0x00000058 -#define GPIO_PIN12_OFFSET 0x00000058 -#define GPIO_PIN12_CONFIG_MSB 12 -#define GPIO_PIN12_CONFIG_LSB 11 -#define GPIO_PIN12_CONFIG_MASK 0x00001800 -#define GPIO_PIN12_CONFIG_GET(x) (((x) & GPIO_PIN12_CONFIG_MASK) >> GPIO_PIN12_CONFIG_LSB) -#define GPIO_PIN12_CONFIG_SET(x) (((x) << GPIO_PIN12_CONFIG_LSB) & GPIO_PIN12_CONFIG_MASK) -#define GPIO_PIN12_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN12_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN12_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN12_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN12_WAKEUP_ENABLE_MASK) >> GPIO_PIN12_WAKEUP_ENABLE_LSB) -#define GPIO_PIN12_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN12_WAKEUP_ENABLE_LSB) & GPIO_PIN12_WAKEUP_ENABLE_MASK) -#define GPIO_PIN12_INT_TYPE_MSB 9 -#define GPIO_PIN12_INT_TYPE_LSB 7 -#define GPIO_PIN12_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN12_INT_TYPE_GET(x) (((x) & GPIO_PIN12_INT_TYPE_MASK) >> GPIO_PIN12_INT_TYPE_LSB) -#define GPIO_PIN12_INT_TYPE_SET(x) (((x) << GPIO_PIN12_INT_TYPE_LSB) & GPIO_PIN12_INT_TYPE_MASK) -#define GPIO_PIN12_PAD_DRIVER_MSB 2 -#define GPIO_PIN12_PAD_DRIVER_LSB 2 -#define GPIO_PIN12_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN12_PAD_DRIVER_GET(x) (((x) & GPIO_PIN12_PAD_DRIVER_MASK) >> GPIO_PIN12_PAD_DRIVER_LSB) -#define GPIO_PIN12_PAD_DRIVER_SET(x) (((x) << GPIO_PIN12_PAD_DRIVER_LSB) & GPIO_PIN12_PAD_DRIVER_MASK) -#define GPIO_PIN12_SOURCE_MSB 0 -#define GPIO_PIN12_SOURCE_LSB 0 -#define GPIO_PIN12_SOURCE_MASK 0x00000001 -#define GPIO_PIN12_SOURCE_GET(x) (((x) & GPIO_PIN12_SOURCE_MASK) >> GPIO_PIN12_SOURCE_LSB) -#define GPIO_PIN12_SOURCE_SET(x) (((x) << GPIO_PIN12_SOURCE_LSB) & GPIO_PIN12_SOURCE_MASK) - -#define GPIO_PIN13_ADDRESS 0x0000005c -#define GPIO_PIN13_OFFSET 0x0000005c -#define GPIO_PIN13_CONFIG_MSB 12 -#define GPIO_PIN13_CONFIG_LSB 11 -#define GPIO_PIN13_CONFIG_MASK 0x00001800 -#define GPIO_PIN13_CONFIG_GET(x) (((x) & GPIO_PIN13_CONFIG_MASK) >> GPIO_PIN13_CONFIG_LSB) -#define GPIO_PIN13_CONFIG_SET(x) (((x) << GPIO_PIN13_CONFIG_LSB) & GPIO_PIN13_CONFIG_MASK) -#define GPIO_PIN13_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN13_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN13_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN13_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN13_WAKEUP_ENABLE_MASK) >> GPIO_PIN13_WAKEUP_ENABLE_LSB) -#define GPIO_PIN13_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN13_WAKEUP_ENABLE_LSB) & GPIO_PIN13_WAKEUP_ENABLE_MASK) -#define GPIO_PIN13_INT_TYPE_MSB 9 -#define GPIO_PIN13_INT_TYPE_LSB 7 -#define GPIO_PIN13_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN13_INT_TYPE_GET(x) (((x) & GPIO_PIN13_INT_TYPE_MASK) >> GPIO_PIN13_INT_TYPE_LSB) -#define GPIO_PIN13_INT_TYPE_SET(x) (((x) << GPIO_PIN13_INT_TYPE_LSB) & GPIO_PIN13_INT_TYPE_MASK) -#define GPIO_PIN13_PAD_DRIVER_MSB 2 -#define GPIO_PIN13_PAD_DRIVER_LSB 2 -#define GPIO_PIN13_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN13_PAD_DRIVER_GET(x) (((x) & GPIO_PIN13_PAD_DRIVER_MASK) >> GPIO_PIN13_PAD_DRIVER_LSB) -#define GPIO_PIN13_PAD_DRIVER_SET(x) (((x) << GPIO_PIN13_PAD_DRIVER_LSB) & GPIO_PIN13_PAD_DRIVER_MASK) -#define GPIO_PIN13_SOURCE_MSB 0 -#define GPIO_PIN13_SOURCE_LSB 0 -#define GPIO_PIN13_SOURCE_MASK 0x00000001 -#define GPIO_PIN13_SOURCE_GET(x) (((x) & GPIO_PIN13_SOURCE_MASK) >> GPIO_PIN13_SOURCE_LSB) -#define GPIO_PIN13_SOURCE_SET(x) (((x) << GPIO_PIN13_SOURCE_LSB) & GPIO_PIN13_SOURCE_MASK) - -#define GPIO_PIN14_ADDRESS 0x00000060 -#define GPIO_PIN14_OFFSET 0x00000060 -#define GPIO_PIN14_CONFIG_MSB 12 -#define GPIO_PIN14_CONFIG_LSB 11 -#define GPIO_PIN14_CONFIG_MASK 0x00001800 -#define GPIO_PIN14_CONFIG_GET(x) (((x) & GPIO_PIN14_CONFIG_MASK) >> GPIO_PIN14_CONFIG_LSB) -#define GPIO_PIN14_CONFIG_SET(x) (((x) << GPIO_PIN14_CONFIG_LSB) & GPIO_PIN14_CONFIG_MASK) -#define GPIO_PIN14_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN14_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN14_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN14_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN14_WAKEUP_ENABLE_MASK) >> GPIO_PIN14_WAKEUP_ENABLE_LSB) -#define GPIO_PIN14_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN14_WAKEUP_ENABLE_LSB) & GPIO_PIN14_WAKEUP_ENABLE_MASK) -#define GPIO_PIN14_INT_TYPE_MSB 9 -#define GPIO_PIN14_INT_TYPE_LSB 7 -#define GPIO_PIN14_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN14_INT_TYPE_GET(x) (((x) & GPIO_PIN14_INT_TYPE_MASK) >> GPIO_PIN14_INT_TYPE_LSB) -#define GPIO_PIN14_INT_TYPE_SET(x) (((x) << GPIO_PIN14_INT_TYPE_LSB) & GPIO_PIN14_INT_TYPE_MASK) -#define GPIO_PIN14_PAD_DRIVER_MSB 2 -#define GPIO_PIN14_PAD_DRIVER_LSB 2 -#define GPIO_PIN14_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN14_PAD_DRIVER_GET(x) (((x) & GPIO_PIN14_PAD_DRIVER_MASK) >> GPIO_PIN14_PAD_DRIVER_LSB) -#define GPIO_PIN14_PAD_DRIVER_SET(x) (((x) << GPIO_PIN14_PAD_DRIVER_LSB) & GPIO_PIN14_PAD_DRIVER_MASK) -#define GPIO_PIN14_SOURCE_MSB 0 -#define GPIO_PIN14_SOURCE_LSB 0 -#define GPIO_PIN14_SOURCE_MASK 0x00000001 -#define GPIO_PIN14_SOURCE_GET(x) (((x) & GPIO_PIN14_SOURCE_MASK) >> GPIO_PIN14_SOURCE_LSB) -#define GPIO_PIN14_SOURCE_SET(x) (((x) << GPIO_PIN14_SOURCE_LSB) & GPIO_PIN14_SOURCE_MASK) - -#define GPIO_PIN15_ADDRESS 0x00000064 -#define GPIO_PIN15_OFFSET 0x00000064 -#define GPIO_PIN15_CONFIG_MSB 12 -#define GPIO_PIN15_CONFIG_LSB 11 -#define GPIO_PIN15_CONFIG_MASK 0x00001800 -#define GPIO_PIN15_CONFIG_GET(x) (((x) & GPIO_PIN15_CONFIG_MASK) >> GPIO_PIN15_CONFIG_LSB) -#define GPIO_PIN15_CONFIG_SET(x) (((x) << GPIO_PIN15_CONFIG_LSB) & GPIO_PIN15_CONFIG_MASK) -#define GPIO_PIN15_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN15_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN15_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN15_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN15_WAKEUP_ENABLE_MASK) >> GPIO_PIN15_WAKEUP_ENABLE_LSB) -#define GPIO_PIN15_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN15_WAKEUP_ENABLE_LSB) & GPIO_PIN15_WAKEUP_ENABLE_MASK) -#define GPIO_PIN15_INT_TYPE_MSB 9 -#define GPIO_PIN15_INT_TYPE_LSB 7 -#define GPIO_PIN15_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN15_INT_TYPE_GET(x) (((x) & GPIO_PIN15_INT_TYPE_MASK) >> GPIO_PIN15_INT_TYPE_LSB) -#define GPIO_PIN15_INT_TYPE_SET(x) (((x) << GPIO_PIN15_INT_TYPE_LSB) & GPIO_PIN15_INT_TYPE_MASK) -#define GPIO_PIN15_PAD_DRIVER_MSB 2 -#define GPIO_PIN15_PAD_DRIVER_LSB 2 -#define GPIO_PIN15_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN15_PAD_DRIVER_GET(x) (((x) & GPIO_PIN15_PAD_DRIVER_MASK) >> GPIO_PIN15_PAD_DRIVER_LSB) -#define GPIO_PIN15_PAD_DRIVER_SET(x) (((x) << GPIO_PIN15_PAD_DRIVER_LSB) & GPIO_PIN15_PAD_DRIVER_MASK) -#define GPIO_PIN15_SOURCE_MSB 0 -#define GPIO_PIN15_SOURCE_LSB 0 -#define GPIO_PIN15_SOURCE_MASK 0x00000001 -#define GPIO_PIN15_SOURCE_GET(x) (((x) & GPIO_PIN15_SOURCE_MASK) >> GPIO_PIN15_SOURCE_LSB) -#define GPIO_PIN15_SOURCE_SET(x) (((x) << GPIO_PIN15_SOURCE_LSB) & GPIO_PIN15_SOURCE_MASK) - -#define GPIO_PIN16_ADDRESS 0x00000068 -#define GPIO_PIN16_OFFSET 0x00000068 -#define GPIO_PIN16_CONFIG_MSB 12 -#define GPIO_PIN16_CONFIG_LSB 11 -#define GPIO_PIN16_CONFIG_MASK 0x00001800 -#define GPIO_PIN16_CONFIG_GET(x) (((x) & GPIO_PIN16_CONFIG_MASK) >> GPIO_PIN16_CONFIG_LSB) -#define GPIO_PIN16_CONFIG_SET(x) (((x) << GPIO_PIN16_CONFIG_LSB) & GPIO_PIN16_CONFIG_MASK) -#define GPIO_PIN16_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN16_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN16_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN16_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN16_WAKEUP_ENABLE_MASK) >> GPIO_PIN16_WAKEUP_ENABLE_LSB) -#define GPIO_PIN16_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN16_WAKEUP_ENABLE_LSB) & GPIO_PIN16_WAKEUP_ENABLE_MASK) -#define GPIO_PIN16_INT_TYPE_MSB 9 -#define GPIO_PIN16_INT_TYPE_LSB 7 -#define GPIO_PIN16_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN16_INT_TYPE_GET(x) (((x) & GPIO_PIN16_INT_TYPE_MASK) >> GPIO_PIN16_INT_TYPE_LSB) -#define GPIO_PIN16_INT_TYPE_SET(x) (((x) << GPIO_PIN16_INT_TYPE_LSB) & GPIO_PIN16_INT_TYPE_MASK) -#define GPIO_PIN16_PAD_DRIVER_MSB 2 -#define GPIO_PIN16_PAD_DRIVER_LSB 2 -#define GPIO_PIN16_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN16_PAD_DRIVER_GET(x) (((x) & GPIO_PIN16_PAD_DRIVER_MASK) >> GPIO_PIN16_PAD_DRIVER_LSB) -#define GPIO_PIN16_PAD_DRIVER_SET(x) (((x) << GPIO_PIN16_PAD_DRIVER_LSB) & GPIO_PIN16_PAD_DRIVER_MASK) -#define GPIO_PIN16_SOURCE_MSB 0 -#define GPIO_PIN16_SOURCE_LSB 0 -#define GPIO_PIN16_SOURCE_MASK 0x00000001 -#define GPIO_PIN16_SOURCE_GET(x) (((x) & GPIO_PIN16_SOURCE_MASK) >> GPIO_PIN16_SOURCE_LSB) -#define GPIO_PIN16_SOURCE_SET(x) (((x) << GPIO_PIN16_SOURCE_LSB) & GPIO_PIN16_SOURCE_MASK) - -#define GPIO_PIN17_ADDRESS 0x0000006c -#define GPIO_PIN17_OFFSET 0x0000006c -#define GPIO_PIN17_CONFIG_MSB 12 -#define GPIO_PIN17_CONFIG_LSB 11 -#define GPIO_PIN17_CONFIG_MASK 0x00001800 -#define GPIO_PIN17_CONFIG_GET(x) (((x) & GPIO_PIN17_CONFIG_MASK) >> GPIO_PIN17_CONFIG_LSB) -#define GPIO_PIN17_CONFIG_SET(x) (((x) << GPIO_PIN17_CONFIG_LSB) & GPIO_PIN17_CONFIG_MASK) -#define GPIO_PIN17_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN17_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN17_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN17_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN17_WAKEUP_ENABLE_MASK) >> GPIO_PIN17_WAKEUP_ENABLE_LSB) -#define GPIO_PIN17_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN17_WAKEUP_ENABLE_LSB) & GPIO_PIN17_WAKEUP_ENABLE_MASK) -#define GPIO_PIN17_INT_TYPE_MSB 9 -#define GPIO_PIN17_INT_TYPE_LSB 7 -#define GPIO_PIN17_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN17_INT_TYPE_GET(x) (((x) & GPIO_PIN17_INT_TYPE_MASK) >> GPIO_PIN17_INT_TYPE_LSB) -#define GPIO_PIN17_INT_TYPE_SET(x) (((x) << GPIO_PIN17_INT_TYPE_LSB) & GPIO_PIN17_INT_TYPE_MASK) -#define GPIO_PIN17_PAD_DRIVER_MSB 2 -#define GPIO_PIN17_PAD_DRIVER_LSB 2 -#define GPIO_PIN17_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN17_PAD_DRIVER_GET(x) (((x) & GPIO_PIN17_PAD_DRIVER_MASK) >> GPIO_PIN17_PAD_DRIVER_LSB) -#define GPIO_PIN17_PAD_DRIVER_SET(x) (((x) << GPIO_PIN17_PAD_DRIVER_LSB) & GPIO_PIN17_PAD_DRIVER_MASK) -#define GPIO_PIN17_SOURCE_MSB 0 -#define GPIO_PIN17_SOURCE_LSB 0 -#define GPIO_PIN17_SOURCE_MASK 0x00000001 -#define GPIO_PIN17_SOURCE_GET(x) (((x) & GPIO_PIN17_SOURCE_MASK) >> GPIO_PIN17_SOURCE_LSB) -#define GPIO_PIN17_SOURCE_SET(x) (((x) << GPIO_PIN17_SOURCE_LSB) & GPIO_PIN17_SOURCE_MASK) - -#define SDIO_PIN_ADDRESS 0x00000070 -#define SDIO_PIN_OFFSET 0x00000070 -#define SDIO_PIN_PAD_PULL_MSB 3 -#define SDIO_PIN_PAD_PULL_LSB 2 -#define SDIO_PIN_PAD_PULL_MASK 0x0000000c -#define SDIO_PIN_PAD_PULL_GET(x) (((x) & SDIO_PIN_PAD_PULL_MASK) >> SDIO_PIN_PAD_PULL_LSB) -#define SDIO_PIN_PAD_PULL_SET(x) (((x) << SDIO_PIN_PAD_PULL_LSB) & SDIO_PIN_PAD_PULL_MASK) -#define SDIO_PIN_PAD_STRENGTH_MSB 1 -#define SDIO_PIN_PAD_STRENGTH_LSB 0 -#define SDIO_PIN_PAD_STRENGTH_MASK 0x00000003 -#define SDIO_PIN_PAD_STRENGTH_GET(x) (((x) & SDIO_PIN_PAD_STRENGTH_MASK) >> SDIO_PIN_PAD_STRENGTH_LSB) -#define SDIO_PIN_PAD_STRENGTH_SET(x) (((x) << SDIO_PIN_PAD_STRENGTH_LSB) & SDIO_PIN_PAD_STRENGTH_MASK) - -#define CLK_REQ_PIN_ADDRESS 0x00000074 -#define CLK_REQ_PIN_OFFSET 0x00000074 -#define CLK_REQ_PIN_ATE_OE_L_MSB 4 -#define CLK_REQ_PIN_ATE_OE_L_LSB 4 -#define CLK_REQ_PIN_ATE_OE_L_MASK 0x00000010 -#define CLK_REQ_PIN_ATE_OE_L_GET(x) (((x) & CLK_REQ_PIN_ATE_OE_L_MASK) >> CLK_REQ_PIN_ATE_OE_L_LSB) -#define CLK_REQ_PIN_ATE_OE_L_SET(x) (((x) << CLK_REQ_PIN_ATE_OE_L_LSB) & CLK_REQ_PIN_ATE_OE_L_MASK) -#define CLK_REQ_PIN_PAD_PULL_MSB 3 -#define CLK_REQ_PIN_PAD_PULL_LSB 2 -#define CLK_REQ_PIN_PAD_PULL_MASK 0x0000000c -#define CLK_REQ_PIN_PAD_PULL_GET(x) (((x) & CLK_REQ_PIN_PAD_PULL_MASK) >> CLK_REQ_PIN_PAD_PULL_LSB) -#define CLK_REQ_PIN_PAD_PULL_SET(x) (((x) << CLK_REQ_PIN_PAD_PULL_LSB) & CLK_REQ_PIN_PAD_PULL_MASK) -#define CLK_REQ_PIN_PAD_STRENGTH_MSB 1 -#define CLK_REQ_PIN_PAD_STRENGTH_LSB 0 -#define CLK_REQ_PIN_PAD_STRENGTH_MASK 0x00000003 -#define CLK_REQ_PIN_PAD_STRENGTH_GET(x) (((x) & CLK_REQ_PIN_PAD_STRENGTH_MASK) >> CLK_REQ_PIN_PAD_STRENGTH_LSB) -#define CLK_REQ_PIN_PAD_STRENGTH_SET(x) (((x) << CLK_REQ_PIN_PAD_STRENGTH_LSB) & CLK_REQ_PIN_PAD_STRENGTH_MASK) - -#define SIGMA_DELTA_ADDRESS 0x00000078 -#define SIGMA_DELTA_OFFSET 0x00000078 -#define SIGMA_DELTA_ENABLE_MSB 16 -#define SIGMA_DELTA_ENABLE_LSB 16 -#define SIGMA_DELTA_ENABLE_MASK 0x00010000 -#define SIGMA_DELTA_ENABLE_GET(x) (((x) & SIGMA_DELTA_ENABLE_MASK) >> SIGMA_DELTA_ENABLE_LSB) -#define SIGMA_DELTA_ENABLE_SET(x) (((x) << SIGMA_DELTA_ENABLE_LSB) & SIGMA_DELTA_ENABLE_MASK) -#define SIGMA_DELTA_PRESCALAR_MSB 15 -#define SIGMA_DELTA_PRESCALAR_LSB 8 -#define SIGMA_DELTA_PRESCALAR_MASK 0x0000ff00 -#define SIGMA_DELTA_PRESCALAR_GET(x) (((x) & SIGMA_DELTA_PRESCALAR_MASK) >> SIGMA_DELTA_PRESCALAR_LSB) -#define SIGMA_DELTA_PRESCALAR_SET(x) (((x) << SIGMA_DELTA_PRESCALAR_LSB) & SIGMA_DELTA_PRESCALAR_MASK) -#define SIGMA_DELTA_TARGET_MSB 7 -#define SIGMA_DELTA_TARGET_LSB 0 -#define SIGMA_DELTA_TARGET_MASK 0x000000ff -#define SIGMA_DELTA_TARGET_GET(x) (((x) & SIGMA_DELTA_TARGET_MASK) >> SIGMA_DELTA_TARGET_LSB) -#define SIGMA_DELTA_TARGET_SET(x) (((x) << SIGMA_DELTA_TARGET_LSB) & SIGMA_DELTA_TARGET_MASK) - -#define DEBUG_CONTROL_ADDRESS 0x0000007c -#define DEBUG_CONTROL_OFFSET 0x0000007c -#define DEBUG_CONTROL_OBS_OE_L_MSB 1 -#define DEBUG_CONTROL_OBS_OE_L_LSB 1 -#define DEBUG_CONTROL_OBS_OE_L_MASK 0x00000002 -#define DEBUG_CONTROL_OBS_OE_L_GET(x) (((x) & DEBUG_CONTROL_OBS_OE_L_MASK) >> DEBUG_CONTROL_OBS_OE_L_LSB) -#define DEBUG_CONTROL_OBS_OE_L_SET(x) (((x) << DEBUG_CONTROL_OBS_OE_L_LSB) & DEBUG_CONTROL_OBS_OE_L_MASK) -#define DEBUG_CONTROL_ENABLE_MSB 0 -#define DEBUG_CONTROL_ENABLE_LSB 0 -#define DEBUG_CONTROL_ENABLE_MASK 0x00000001 -#define DEBUG_CONTROL_ENABLE_GET(x) (((x) & DEBUG_CONTROL_ENABLE_MASK) >> DEBUG_CONTROL_ENABLE_LSB) -#define DEBUG_CONTROL_ENABLE_SET(x) (((x) << DEBUG_CONTROL_ENABLE_LSB) & DEBUG_CONTROL_ENABLE_MASK) - -#define DEBUG_INPUT_SEL_ADDRESS 0x00000080 -#define DEBUG_INPUT_SEL_OFFSET 0x00000080 -#define DEBUG_INPUT_SEL_SRC_MSB 3 -#define DEBUG_INPUT_SEL_SRC_LSB 0 -#define DEBUG_INPUT_SEL_SRC_MASK 0x0000000f -#define DEBUG_INPUT_SEL_SRC_GET(x) (((x) & DEBUG_INPUT_SEL_SRC_MASK) >> DEBUG_INPUT_SEL_SRC_LSB) -#define DEBUG_INPUT_SEL_SRC_SET(x) (((x) << DEBUG_INPUT_SEL_SRC_LSB) & DEBUG_INPUT_SEL_SRC_MASK) - -#define DEBUG_OUT_ADDRESS 0x00000084 -#define DEBUG_OUT_OFFSET 0x00000084 -#define DEBUG_OUT_DATA_MSB 17 -#define DEBUG_OUT_DATA_LSB 0 -#define DEBUG_OUT_DATA_MASK 0x0003ffff -#define DEBUG_OUT_DATA_GET(x) (((x) & DEBUG_OUT_DATA_MASK) >> DEBUG_OUT_DATA_LSB) -#define DEBUG_OUT_DATA_SET(x) (((x) << DEBUG_OUT_DATA_LSB) & DEBUG_OUT_DATA_MASK) - -#define LA_CONTROL_ADDRESS 0x00000088 -#define LA_CONTROL_OFFSET 0x00000088 -#define LA_CONTROL_RUN_MSB 1 -#define LA_CONTROL_RUN_LSB 1 -#define LA_CONTROL_RUN_MASK 0x00000002 -#define LA_CONTROL_RUN_GET(x) (((x) & LA_CONTROL_RUN_MASK) >> LA_CONTROL_RUN_LSB) -#define LA_CONTROL_RUN_SET(x) (((x) << LA_CONTROL_RUN_LSB) & LA_CONTROL_RUN_MASK) -#define LA_CONTROL_TRIGGERED_MSB 0 -#define LA_CONTROL_TRIGGERED_LSB 0 -#define LA_CONTROL_TRIGGERED_MASK 0x00000001 -#define LA_CONTROL_TRIGGERED_GET(x) (((x) & LA_CONTROL_TRIGGERED_MASK) >> LA_CONTROL_TRIGGERED_LSB) -#define LA_CONTROL_TRIGGERED_SET(x) (((x) << LA_CONTROL_TRIGGERED_LSB) & LA_CONTROL_TRIGGERED_MASK) - -#define LA_CLOCK_ADDRESS 0x0000008c -#define LA_CLOCK_OFFSET 0x0000008c -#define LA_CLOCK_DIV_MSB 7 -#define LA_CLOCK_DIV_LSB 0 -#define LA_CLOCK_DIV_MASK 0x000000ff -#define LA_CLOCK_DIV_GET(x) (((x) & LA_CLOCK_DIV_MASK) >> LA_CLOCK_DIV_LSB) -#define LA_CLOCK_DIV_SET(x) (((x) << LA_CLOCK_DIV_LSB) & LA_CLOCK_DIV_MASK) - -#define LA_STATUS_ADDRESS 0x00000090 -#define LA_STATUS_OFFSET 0x00000090 -#define LA_STATUS_INTERRUPT_MSB 0 -#define LA_STATUS_INTERRUPT_LSB 0 -#define LA_STATUS_INTERRUPT_MASK 0x00000001 -#define LA_STATUS_INTERRUPT_GET(x) (((x) & LA_STATUS_INTERRUPT_MASK) >> LA_STATUS_INTERRUPT_LSB) -#define LA_STATUS_INTERRUPT_SET(x) (((x) << LA_STATUS_INTERRUPT_LSB) & LA_STATUS_INTERRUPT_MASK) - -#define LA_TRIGGER_SAMPLE_ADDRESS 0x00000094 -#define LA_TRIGGER_SAMPLE_OFFSET 0x00000094 -#define LA_TRIGGER_SAMPLE_COUNT_MSB 15 -#define LA_TRIGGER_SAMPLE_COUNT_LSB 0 -#define LA_TRIGGER_SAMPLE_COUNT_MASK 0x0000ffff -#define LA_TRIGGER_SAMPLE_COUNT_GET(x) (((x) & LA_TRIGGER_SAMPLE_COUNT_MASK) >> LA_TRIGGER_SAMPLE_COUNT_LSB) -#define LA_TRIGGER_SAMPLE_COUNT_SET(x) (((x) << LA_TRIGGER_SAMPLE_COUNT_LSB) & LA_TRIGGER_SAMPLE_COUNT_MASK) - -#define LA_TRIGGER_POSITION_ADDRESS 0x00000098 -#define LA_TRIGGER_POSITION_OFFSET 0x00000098 -#define LA_TRIGGER_POSITION_VALUE_MSB 15 -#define LA_TRIGGER_POSITION_VALUE_LSB 0 -#define LA_TRIGGER_POSITION_VALUE_MASK 0x0000ffff -#define LA_TRIGGER_POSITION_VALUE_GET(x) (((x) & LA_TRIGGER_POSITION_VALUE_MASK) >> LA_TRIGGER_POSITION_VALUE_LSB) -#define LA_TRIGGER_POSITION_VALUE_SET(x) (((x) << LA_TRIGGER_POSITION_VALUE_LSB) & LA_TRIGGER_POSITION_VALUE_MASK) - -#define LA_PRE_TRIGGER_ADDRESS 0x0000009c -#define LA_PRE_TRIGGER_OFFSET 0x0000009c -#define LA_PRE_TRIGGER_COUNT_MSB 15 -#define LA_PRE_TRIGGER_COUNT_LSB 0 -#define LA_PRE_TRIGGER_COUNT_MASK 0x0000ffff -#define LA_PRE_TRIGGER_COUNT_GET(x) (((x) & LA_PRE_TRIGGER_COUNT_MASK) >> LA_PRE_TRIGGER_COUNT_LSB) -#define LA_PRE_TRIGGER_COUNT_SET(x) (((x) << LA_PRE_TRIGGER_COUNT_LSB) & LA_PRE_TRIGGER_COUNT_MASK) - -#define LA_POST_TRIGGER_ADDRESS 0x000000a0 -#define LA_POST_TRIGGER_OFFSET 0x000000a0 -#define LA_POST_TRIGGER_COUNT_MSB 15 -#define LA_POST_TRIGGER_COUNT_LSB 0 -#define LA_POST_TRIGGER_COUNT_MASK 0x0000ffff -#define LA_POST_TRIGGER_COUNT_GET(x) (((x) & LA_POST_TRIGGER_COUNT_MASK) >> LA_POST_TRIGGER_COUNT_LSB) -#define LA_POST_TRIGGER_COUNT_SET(x) (((x) << LA_POST_TRIGGER_COUNT_LSB) & LA_POST_TRIGGER_COUNT_MASK) - -#define LA_FILTER_CONTROL_ADDRESS 0x000000a4 -#define LA_FILTER_CONTROL_OFFSET 0x000000a4 -#define LA_FILTER_CONTROL_DELTA_MSB 0 -#define LA_FILTER_CONTROL_DELTA_LSB 0 -#define LA_FILTER_CONTROL_DELTA_MASK 0x00000001 -#define LA_FILTER_CONTROL_DELTA_GET(x) (((x) & LA_FILTER_CONTROL_DELTA_MASK) >> LA_FILTER_CONTROL_DELTA_LSB) -#define LA_FILTER_CONTROL_DELTA_SET(x) (((x) << LA_FILTER_CONTROL_DELTA_LSB) & LA_FILTER_CONTROL_DELTA_MASK) - -#define LA_FILTER_DATA_ADDRESS 0x000000a8 -#define LA_FILTER_DATA_OFFSET 0x000000a8 -#define LA_FILTER_DATA_MATCH_MSB 17 -#define LA_FILTER_DATA_MATCH_LSB 0 -#define LA_FILTER_DATA_MATCH_MASK 0x0003ffff -#define LA_FILTER_DATA_MATCH_GET(x) (((x) & LA_FILTER_DATA_MATCH_MASK) >> LA_FILTER_DATA_MATCH_LSB) -#define LA_FILTER_DATA_MATCH_SET(x) (((x) << LA_FILTER_DATA_MATCH_LSB) & LA_FILTER_DATA_MATCH_MASK) - -#define LA_FILTER_WILDCARD_ADDRESS 0x000000ac -#define LA_FILTER_WILDCARD_OFFSET 0x000000ac -#define LA_FILTER_WILDCARD_MATCH_MSB 17 -#define LA_FILTER_WILDCARD_MATCH_LSB 0 -#define LA_FILTER_WILDCARD_MATCH_MASK 0x0003ffff -#define LA_FILTER_WILDCARD_MATCH_GET(x) (((x) & LA_FILTER_WILDCARD_MATCH_MASK) >> LA_FILTER_WILDCARD_MATCH_LSB) -#define LA_FILTER_WILDCARD_MATCH_SET(x) (((x) << LA_FILTER_WILDCARD_MATCH_LSB) & LA_FILTER_WILDCARD_MATCH_MASK) - -#define LA_TRIGGERA_DATA_ADDRESS 0x000000b0 -#define LA_TRIGGERA_DATA_OFFSET 0x000000b0 -#define LA_TRIGGERA_DATA_MATCH_MSB 17 -#define LA_TRIGGERA_DATA_MATCH_LSB 0 -#define LA_TRIGGERA_DATA_MATCH_MASK 0x0003ffff -#define LA_TRIGGERA_DATA_MATCH_GET(x) (((x) & LA_TRIGGERA_DATA_MATCH_MASK) >> LA_TRIGGERA_DATA_MATCH_LSB) -#define LA_TRIGGERA_DATA_MATCH_SET(x) (((x) << LA_TRIGGERA_DATA_MATCH_LSB) & LA_TRIGGERA_DATA_MATCH_MASK) - -#define LA_TRIGGERA_WILDCARD_ADDRESS 0x000000b4 -#define LA_TRIGGERA_WILDCARD_OFFSET 0x000000b4 -#define LA_TRIGGERA_WILDCARD_MATCH_MSB 17 -#define LA_TRIGGERA_WILDCARD_MATCH_LSB 0 -#define LA_TRIGGERA_WILDCARD_MATCH_MASK 0x0003ffff -#define LA_TRIGGERA_WILDCARD_MATCH_GET(x) (((x) & LA_TRIGGERA_WILDCARD_MATCH_MASK) >> LA_TRIGGERA_WILDCARD_MATCH_LSB) -#define LA_TRIGGERA_WILDCARD_MATCH_SET(x) (((x) << LA_TRIGGERA_WILDCARD_MATCH_LSB) & LA_TRIGGERA_WILDCARD_MATCH_MASK) - -#define LA_TRIGGERB_DATA_ADDRESS 0x000000b8 -#define LA_TRIGGERB_DATA_OFFSET 0x000000b8 -#define LA_TRIGGERB_DATA_MATCH_MSB 17 -#define LA_TRIGGERB_DATA_MATCH_LSB 0 -#define LA_TRIGGERB_DATA_MATCH_MASK 0x0003ffff -#define LA_TRIGGERB_DATA_MATCH_GET(x) (((x) & LA_TRIGGERB_DATA_MATCH_MASK) >> LA_TRIGGERB_DATA_MATCH_LSB) -#define LA_TRIGGERB_DATA_MATCH_SET(x) (((x) << LA_TRIGGERB_DATA_MATCH_LSB) & LA_TRIGGERB_DATA_MATCH_MASK) - -#define LA_TRIGGERB_WILDCARD_ADDRESS 0x000000bc -#define LA_TRIGGERB_WILDCARD_OFFSET 0x000000bc -#define LA_TRIGGERB_WILDCARD_MATCH_MSB 17 -#define LA_TRIGGERB_WILDCARD_MATCH_LSB 0 -#define LA_TRIGGERB_WILDCARD_MATCH_MASK 0x0003ffff -#define LA_TRIGGERB_WILDCARD_MATCH_GET(x) (((x) & LA_TRIGGERB_WILDCARD_MATCH_MASK) >> LA_TRIGGERB_WILDCARD_MATCH_LSB) -#define LA_TRIGGERB_WILDCARD_MATCH_SET(x) (((x) << LA_TRIGGERB_WILDCARD_MATCH_LSB) & LA_TRIGGERB_WILDCARD_MATCH_MASK) - -#define LA_TRIGGER_ADDRESS 0x000000c0 -#define LA_TRIGGER_OFFSET 0x000000c0 -#define LA_TRIGGER_EVENT_MSB 2 -#define LA_TRIGGER_EVENT_LSB 0 -#define LA_TRIGGER_EVENT_MASK 0x00000007 -#define LA_TRIGGER_EVENT_GET(x) (((x) & LA_TRIGGER_EVENT_MASK) >> LA_TRIGGER_EVENT_LSB) -#define LA_TRIGGER_EVENT_SET(x) (((x) << LA_TRIGGER_EVENT_LSB) & LA_TRIGGER_EVENT_MASK) - -#define LA_FIFO_ADDRESS 0x000000c4 -#define LA_FIFO_OFFSET 0x000000c4 -#define LA_FIFO_FULL_MSB 1 -#define LA_FIFO_FULL_LSB 1 -#define LA_FIFO_FULL_MASK 0x00000002 -#define LA_FIFO_FULL_GET(x) (((x) & LA_FIFO_FULL_MASK) >> LA_FIFO_FULL_LSB) -#define LA_FIFO_FULL_SET(x) (((x) << LA_FIFO_FULL_LSB) & LA_FIFO_FULL_MASK) -#define LA_FIFO_EMPTY_MSB 0 -#define LA_FIFO_EMPTY_LSB 0 -#define LA_FIFO_EMPTY_MASK 0x00000001 -#define LA_FIFO_EMPTY_GET(x) (((x) & LA_FIFO_EMPTY_MASK) >> LA_FIFO_EMPTY_LSB) -#define LA_FIFO_EMPTY_SET(x) (((x) << LA_FIFO_EMPTY_LSB) & LA_FIFO_EMPTY_MASK) - -#define LA_ADDRESS 0x000000c8 -#define LA_OFFSET 0x000000c8 -#define LA_DATA_MSB 17 -#define LA_DATA_LSB 0 -#define LA_DATA_MASK 0x0003ffff -#define LA_DATA_GET(x) (((x) & LA_DATA_MASK) >> LA_DATA_LSB) -#define LA_DATA_SET(x) (((x) << LA_DATA_LSB) & LA_DATA_MASK) - -#define ANT_PIN_ADDRESS 0x000000d0 -#define ANT_PIN_OFFSET 0x000000d0 -#define ANT_PIN_PAD_PULL_MSB 3 -#define ANT_PIN_PAD_PULL_LSB 2 -#define ANT_PIN_PAD_PULL_MASK 0x0000000c -#define ANT_PIN_PAD_PULL_GET(x) (((x) & ANT_PIN_PAD_PULL_MASK) >> ANT_PIN_PAD_PULL_LSB) -#define ANT_PIN_PAD_PULL_SET(x) (((x) << ANT_PIN_PAD_PULL_LSB) & ANT_PIN_PAD_PULL_MASK) -#define ANT_PIN_PAD_STRENGTH_MSB 1 -#define ANT_PIN_PAD_STRENGTH_LSB 0 -#define ANT_PIN_PAD_STRENGTH_MASK 0x00000003 -#define ANT_PIN_PAD_STRENGTH_GET(x) (((x) & ANT_PIN_PAD_STRENGTH_MASK) >> ANT_PIN_PAD_STRENGTH_LSB) -#define ANT_PIN_PAD_STRENGTH_SET(x) (((x) << ANT_PIN_PAD_STRENGTH_LSB) & ANT_PIN_PAD_STRENGTH_MASK) - -#define ANTD_PIN_ADDRESS 0x000000d4 -#define ANTD_PIN_OFFSET 0x000000d4 -#define ANTD_PIN_PAD_PULL_MSB 1 -#define ANTD_PIN_PAD_PULL_LSB 0 -#define ANTD_PIN_PAD_PULL_MASK 0x00000003 -#define ANTD_PIN_PAD_PULL_GET(x) (((x) & ANTD_PIN_PAD_PULL_MASK) >> ANTD_PIN_PAD_PULL_LSB) -#define ANTD_PIN_PAD_PULL_SET(x) (((x) << ANTD_PIN_PAD_PULL_LSB) & ANTD_PIN_PAD_PULL_MASK) - -#define GPIO_PIN_ADDRESS 0x000000d8 -#define GPIO_PIN_OFFSET 0x000000d8 -#define GPIO_PIN_PAD_PULL_MSB 3 -#define GPIO_PIN_PAD_PULL_LSB 2 -#define GPIO_PIN_PAD_PULL_MASK 0x0000000c -#define GPIO_PIN_PAD_PULL_GET(x) (((x) & GPIO_PIN_PAD_PULL_MASK) >> GPIO_PIN_PAD_PULL_LSB) -#define GPIO_PIN_PAD_PULL_SET(x) (((x) << GPIO_PIN_PAD_PULL_LSB) & GPIO_PIN_PAD_PULL_MASK) -#define GPIO_PIN_PAD_STRENGTH_MSB 1 -#define GPIO_PIN_PAD_STRENGTH_LSB 0 -#define GPIO_PIN_PAD_STRENGTH_MASK 0x00000003 -#define GPIO_PIN_PAD_STRENGTH_GET(x) (((x) & GPIO_PIN_PAD_STRENGTH_MASK) >> GPIO_PIN_PAD_STRENGTH_LSB) -#define GPIO_PIN_PAD_STRENGTH_SET(x) (((x) << GPIO_PIN_PAD_STRENGTH_LSB) & GPIO_PIN_PAD_STRENGTH_MASK) - -#define GPIO_H_PIN_ADDRESS 0x000000dc -#define GPIO_H_PIN_OFFSET 0x000000dc -#define GPIO_H_PIN_PAD_PULL_MSB 1 -#define GPIO_H_PIN_PAD_PULL_LSB 0 -#define GPIO_H_PIN_PAD_PULL_MASK 0x00000003 -#define GPIO_H_PIN_PAD_PULL_GET(x) (((x) & GPIO_H_PIN_PAD_PULL_MASK) >> GPIO_H_PIN_PAD_PULL_LSB) -#define GPIO_H_PIN_PAD_PULL_SET(x) (((x) << GPIO_H_PIN_PAD_PULL_LSB) & GPIO_H_PIN_PAD_PULL_MASK) - -#define BT_PIN_ADDRESS 0x000000e0 -#define BT_PIN_OFFSET 0x000000e0 -#define BT_PIN_PAD_PULL_MSB 3 -#define BT_PIN_PAD_PULL_LSB 2 -#define BT_PIN_PAD_PULL_MASK 0x0000000c -#define BT_PIN_PAD_PULL_GET(x) (((x) & BT_PIN_PAD_PULL_MASK) >> BT_PIN_PAD_PULL_LSB) -#define BT_PIN_PAD_PULL_SET(x) (((x) << BT_PIN_PAD_PULL_LSB) & BT_PIN_PAD_PULL_MASK) -#define BT_PIN_PAD_STRENGTH_MSB 1 -#define BT_PIN_PAD_STRENGTH_LSB 0 -#define BT_PIN_PAD_STRENGTH_MASK 0x00000003 -#define BT_PIN_PAD_STRENGTH_GET(x) (((x) & BT_PIN_PAD_STRENGTH_MASK) >> BT_PIN_PAD_STRENGTH_LSB) -#define BT_PIN_PAD_STRENGTH_SET(x) (((x) << BT_PIN_PAD_STRENGTH_LSB) & BT_PIN_PAD_STRENGTH_MASK) - -#define BT_WLAN_PIN_ADDRESS 0x000000e4 -#define BT_WLAN_PIN_OFFSET 0x000000e4 -#define BT_WLAN_PIN_PAD_PULL_MSB 1 -#define BT_WLAN_PIN_PAD_PULL_LSB 0 -#define BT_WLAN_PIN_PAD_PULL_MASK 0x00000003 -#define BT_WLAN_PIN_PAD_PULL_GET(x) (((x) & BT_WLAN_PIN_PAD_PULL_MASK) >> BT_WLAN_PIN_PAD_PULL_LSB) -#define BT_WLAN_PIN_PAD_PULL_SET(x) (((x) << BT_WLAN_PIN_PAD_PULL_LSB) & BT_WLAN_PIN_PAD_PULL_MASK) - -#define SI_UART_PIN_ADDRESS 0x000000e8 -#define SI_UART_PIN_OFFSET 0x000000e8 -#define SI_UART_PIN_PAD_PULL_MSB 3 -#define SI_UART_PIN_PAD_PULL_LSB 2 -#define SI_UART_PIN_PAD_PULL_MASK 0x0000000c -#define SI_UART_PIN_PAD_PULL_GET(x) (((x) & SI_UART_PIN_PAD_PULL_MASK) >> SI_UART_PIN_PAD_PULL_LSB) -#define SI_UART_PIN_PAD_PULL_SET(x) (((x) << SI_UART_PIN_PAD_PULL_LSB) & SI_UART_PIN_PAD_PULL_MASK) -#define SI_UART_PIN_PAD_STRENGTH_MSB 1 -#define SI_UART_PIN_PAD_STRENGTH_LSB 0 -#define SI_UART_PIN_PAD_STRENGTH_MASK 0x00000003 -#define SI_UART_PIN_PAD_STRENGTH_GET(x) (((x) & SI_UART_PIN_PAD_STRENGTH_MASK) >> SI_UART_PIN_PAD_STRENGTH_LSB) -#define SI_UART_PIN_PAD_STRENGTH_SET(x) (((x) << SI_UART_PIN_PAD_STRENGTH_LSB) & SI_UART_PIN_PAD_STRENGTH_MASK) - -#define CLK32K_PIN_ADDRESS 0x000000ec -#define CLK32K_PIN_OFFSET 0x000000ec -#define CLK32K_PIN_PAD_PULL_MSB 1 -#define CLK32K_PIN_PAD_PULL_LSB 0 -#define CLK32K_PIN_PAD_PULL_MASK 0x00000003 -#define CLK32K_PIN_PAD_PULL_GET(x) (((x) & CLK32K_PIN_PAD_PULL_MASK) >> CLK32K_PIN_PAD_PULL_LSB) -#define CLK32K_PIN_PAD_PULL_SET(x) (((x) << CLK32K_PIN_PAD_PULL_LSB) & CLK32K_PIN_PAD_PULL_MASK) - -#define RESET_TUPLE_STATUS_ADDRESS 0x000000f0 -#define RESET_TUPLE_STATUS_OFFSET 0x000000f0 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MSB 11 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB 8 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK 0x00000f00 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_GET(x) (((x) & RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK) >> RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB) -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_SET(x) (((x) << RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB) & RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK) -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MSB 7 -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB 0 -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK 0x000000ff -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_GET(x) (((x) & RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK) >> RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB) -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_SET(x) (((x) << RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB) & RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct gpio_reg_reg_s { - volatile unsigned int gpio_out; - volatile unsigned int gpio_out_w1ts; - volatile unsigned int gpio_out_w1tc; - volatile unsigned int gpio_enable; - volatile unsigned int gpio_enable_w1ts; - volatile unsigned int gpio_enable_w1tc; - volatile unsigned int gpio_in; - volatile unsigned int gpio_status; - volatile unsigned int gpio_status_w1ts; - volatile unsigned int gpio_status_w1tc; - volatile unsigned int gpio_pin0; - volatile unsigned int gpio_pin1; - volatile unsigned int gpio_pin2; - volatile unsigned int gpio_pin3; - volatile unsigned int gpio_pin4; - volatile unsigned int gpio_pin5; - volatile unsigned int gpio_pin6; - volatile unsigned int gpio_pin7; - volatile unsigned int gpio_pin8; - volatile unsigned int gpio_pin9; - volatile unsigned int gpio_pin10; - volatile unsigned int gpio_pin11; - volatile unsigned int gpio_pin12; - volatile unsigned int gpio_pin13; - volatile unsigned int gpio_pin14; - volatile unsigned int gpio_pin15; - volatile unsigned int gpio_pin16; - volatile unsigned int gpio_pin17; - volatile unsigned int sdio_pin; - volatile unsigned int clk_req_pin; - volatile unsigned int sigma_delta; - volatile unsigned int debug_control; - volatile unsigned int debug_input_sel; - volatile unsigned int debug_out; - volatile unsigned int la_control; - volatile unsigned int la_clock; - volatile unsigned int la_status; - volatile unsigned int la_trigger_sample; - volatile unsigned int la_trigger_position; - volatile unsigned int la_pre_trigger; - volatile unsigned int la_post_trigger; - volatile unsigned int la_filter_control; - volatile unsigned int la_filter_data; - volatile unsigned int la_filter_wildcard; - volatile unsigned int la_triggera_data; - volatile unsigned int la_triggera_wildcard; - volatile unsigned int la_triggerb_data; - volatile unsigned int la_triggerb_wildcard; - volatile unsigned int la_trigger; - volatile unsigned int la_fifo; - volatile unsigned int la[2]; - volatile unsigned int ant_pin; - volatile unsigned int antd_pin; - volatile unsigned int gpio_pin; - volatile unsigned int gpio_h_pin; - volatile unsigned int bt_pin; - volatile unsigned int bt_wlan_pin; - volatile unsigned int si_uart_pin; - volatile unsigned int clk32k_pin; - volatile unsigned int reset_tuple_status; -} gpio_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _GPIO_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/gpio_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/gpio_reg.vrh deleted file mode 100644 index 82a4f9a9ca00..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/gpio_reg.vrh +++ /dev/null @@ -1,1471 +0,0 @@ -#ifndef _GPIO_REG_VRH_ -#define _GPIO_REG_VRH_ - -#define GPIO_OUT_ADDRESS 'h00000000 -#define GPIO_OUT_DATA_MSB 17 -#define GPIO_OUT_DATA_LSB 0 -#define GPIO_OUT_DATA_MASK 'h0003ffff -#define GPIO_OUT_DATA_GET(x) (((x) & GPIO_OUT_DATA_MASK) >> GPIO_OUT_DATA_LSB) -#define GPIO_OUT_DATA_SET(x) (((32'd0 | (x)) << GPIO_OUT_DATA_LSB) & GPIO_OUT_DATA_MASK) -#define GPIO_OUT_DATA_RESET 18'h0 -#define GPIO_OUT_RESET (32'h0 | \ - GPIO_OUT_DATA_SET(GPIO_OUT_DATA_RESET)) -#define GPIO_OUT_HW_MASK (32'h0) -#define GPIO_OUT_SW_MASK (32'h0 | \ - GPIO_OUT_DATA_MASK) - -#define GPIO_OUT_W1TS_ADDRESS 'h00000004 -#define GPIO_OUT_W1TS_DATA_MSB 17 -#define GPIO_OUT_W1TS_DATA_LSB 0 -#define GPIO_OUT_W1TS_DATA_MASK 'h0003ffff -#define GPIO_OUT_W1TS_DATA_GET(x) (((x) & GPIO_OUT_W1TS_DATA_MASK) >> GPIO_OUT_W1TS_DATA_LSB) -#define GPIO_OUT_W1TS_DATA_SET(x) (((32'd0 | (x)) << GPIO_OUT_W1TS_DATA_LSB) & GPIO_OUT_W1TS_DATA_MASK) -#define GPIO_OUT_W1TS_DATA_RESET 18'h0 -#define GPIO_OUT_W1TS_RESET (32'h0 | \ - GPIO_OUT_W1TS_DATA_SET(GPIO_OUT_W1TS_DATA_RESET)) -#define GPIO_OUT_W1TS_HW_MASK (32'h0) -#define GPIO_OUT_W1TS_SW_MASK (32'h0 | \ - GPIO_OUT_W1TS_DATA_MASK) - -#define GPIO_OUT_W1TC_ADDRESS 'h00000008 -#define GPIO_OUT_W1TC_DATA_MSB 17 -#define GPIO_OUT_W1TC_DATA_LSB 0 -#define GPIO_OUT_W1TC_DATA_MASK 'h0003ffff -#define GPIO_OUT_W1TC_DATA_GET(x) (((x) & GPIO_OUT_W1TC_DATA_MASK) >> GPIO_OUT_W1TC_DATA_LSB) -#define GPIO_OUT_W1TC_DATA_SET(x) (((32'd0 | (x)) << GPIO_OUT_W1TC_DATA_LSB) & GPIO_OUT_W1TC_DATA_MASK) -#define GPIO_OUT_W1TC_DATA_RESET 18'h0 -#define GPIO_OUT_W1TC_RESET (32'h0 | \ - GPIO_OUT_W1TC_DATA_SET(GPIO_OUT_W1TC_DATA_RESET)) -#define GPIO_OUT_W1TC_HW_MASK (32'h0) -#define GPIO_OUT_W1TC_SW_MASK (32'h0 | \ - GPIO_OUT_W1TC_DATA_MASK) - -#define GPIO_ENABLE_ADDRESS 'h0000000c -#define GPIO_ENABLE_DATA_MSB 17 -#define GPIO_ENABLE_DATA_LSB 0 -#define GPIO_ENABLE_DATA_MASK 'h0003ffff -#define GPIO_ENABLE_DATA_GET(x) (((x) & GPIO_ENABLE_DATA_MASK) >> GPIO_ENABLE_DATA_LSB) -#define GPIO_ENABLE_DATA_SET(x) (((32'd0 | (x)) << GPIO_ENABLE_DATA_LSB) & GPIO_ENABLE_DATA_MASK) -#define GPIO_ENABLE_DATA_RESET 18'h0 -#define GPIO_ENABLE_RESET (32'h0 | \ - GPIO_ENABLE_DATA_SET(GPIO_ENABLE_DATA_RESET)) -#define GPIO_ENABLE_HW_MASK (32'h0) -#define GPIO_ENABLE_SW_MASK (32'h0 | \ - GPIO_ENABLE_DATA_MASK) - -#define GPIO_ENABLE_W1TS_ADDRESS 'h00000010 -#define GPIO_ENABLE_W1TS_DATA_MSB 17 -#define GPIO_ENABLE_W1TS_DATA_LSB 0 -#define GPIO_ENABLE_W1TS_DATA_MASK 'h0003ffff -#define GPIO_ENABLE_W1TS_DATA_GET(x) (((x) & GPIO_ENABLE_W1TS_DATA_MASK) >> GPIO_ENABLE_W1TS_DATA_LSB) -#define GPIO_ENABLE_W1TS_DATA_SET(x) (((32'd0 | (x)) << GPIO_ENABLE_W1TS_DATA_LSB) & GPIO_ENABLE_W1TS_DATA_MASK) -#define GPIO_ENABLE_W1TS_DATA_RESET 18'h0 -#define GPIO_ENABLE_W1TS_RESET (32'h0 | \ - GPIO_ENABLE_W1TS_DATA_SET(GPIO_ENABLE_W1TS_DATA_RESET)) -#define GPIO_ENABLE_W1TS_HW_MASK (32'h0) -#define GPIO_ENABLE_W1TS_SW_MASK (32'h0 | \ - GPIO_ENABLE_W1TS_DATA_MASK) - -#define GPIO_ENABLE_W1TC_ADDRESS 'h00000014 -#define GPIO_ENABLE_W1TC_DATA_MSB 17 -#define GPIO_ENABLE_W1TC_DATA_LSB 0 -#define GPIO_ENABLE_W1TC_DATA_MASK 'h0003ffff -#define GPIO_ENABLE_W1TC_DATA_GET(x) (((x) & GPIO_ENABLE_W1TC_DATA_MASK) >> GPIO_ENABLE_W1TC_DATA_LSB) -#define GPIO_ENABLE_W1TC_DATA_SET(x) (((32'd0 | (x)) << GPIO_ENABLE_W1TC_DATA_LSB) & GPIO_ENABLE_W1TC_DATA_MASK) -#define GPIO_ENABLE_W1TC_DATA_RESET 18'h0 -#define GPIO_ENABLE_W1TC_RESET (32'h0 | \ - GPIO_ENABLE_W1TC_DATA_SET(GPIO_ENABLE_W1TC_DATA_RESET)) -#define GPIO_ENABLE_W1TC_HW_MASK (32'h0) -#define GPIO_ENABLE_W1TC_SW_MASK (32'h0 | \ - GPIO_ENABLE_W1TC_DATA_MASK) - -#define GPIO_IN_ADDRESS 'h00000018 -#define GPIO_IN_DATA_MSB 17 -#define GPIO_IN_DATA_LSB 0 -#define GPIO_IN_DATA_MASK 'h0003ffff -#define GPIO_IN_DATA_GET(x) (((x) & GPIO_IN_DATA_MASK) >> GPIO_IN_DATA_LSB) -#define GPIO_IN_DATA_SET(x) (((32'd0 | (x)) << GPIO_IN_DATA_LSB) & GPIO_IN_DATA_MASK) -#define GPIO_IN_DATA_RESET 18'h0 -#define GPIO_IN_RESET (32'h0 | \ - GPIO_IN_DATA_SET(GPIO_IN_DATA_RESET)) -#define GPIO_IN_HW_MASK (32'h0 | \ - GPIO_IN_DATA_MASK) -#define GPIO_IN_SW_MASK (32'h0) - -#define GPIO_STATUS_ADDRESS 'h0000001c -#define GPIO_STATUS_INTERRUPT_MSB 17 -#define GPIO_STATUS_INTERRUPT_LSB 0 -#define GPIO_STATUS_INTERRUPT_MASK 'h0003ffff -#define GPIO_STATUS_INTERRUPT_GET(x) (((x) & GPIO_STATUS_INTERRUPT_MASK) >> GPIO_STATUS_INTERRUPT_LSB) -#define GPIO_STATUS_INTERRUPT_SET(x) (((32'd0 | (x)) << GPIO_STATUS_INTERRUPT_LSB) & GPIO_STATUS_INTERRUPT_MASK) -#define GPIO_STATUS_INTERRUPT_RESET 18'h0 -#define GPIO_STATUS_RESET (32'h0 | \ - GPIO_STATUS_INTERRUPT_SET(GPIO_STATUS_INTERRUPT_RESET)) -#define GPIO_STATUS_HW_MASK (32'h0 | \ - GPIO_STATUS_INTERRUPT_MASK) -#define GPIO_STATUS_SW_MASK (32'h0 | \ - GPIO_STATUS_INTERRUPT_MASK) - -#define GPIO_STATUS_W1TS_ADDRESS 'h00000020 -#define GPIO_STATUS_W1TS_INTERRUPT_MSB 17 -#define GPIO_STATUS_W1TS_INTERRUPT_LSB 0 -#define GPIO_STATUS_W1TS_INTERRUPT_MASK 'h0003ffff -#define GPIO_STATUS_W1TS_INTERRUPT_GET(x) (((x) & GPIO_STATUS_W1TS_INTERRUPT_MASK) >> GPIO_STATUS_W1TS_INTERRUPT_LSB) -#define GPIO_STATUS_W1TS_INTERRUPT_SET(x) (((32'd0 | (x)) << GPIO_STATUS_W1TS_INTERRUPT_LSB) & GPIO_STATUS_W1TS_INTERRUPT_MASK) -#define GPIO_STATUS_W1TS_INTERRUPT_RESET 18'h0 -#define GPIO_STATUS_W1TS_RESET (32'h0 | \ - GPIO_STATUS_W1TS_INTERRUPT_SET(GPIO_STATUS_W1TS_INTERRUPT_RESET)) -#define GPIO_STATUS_W1TS_HW_MASK (32'h0) -#define GPIO_STATUS_W1TS_SW_MASK (32'h0 | \ - GPIO_STATUS_W1TS_INTERRUPT_MASK) - -#define GPIO_STATUS_W1TC_ADDRESS 'h00000024 -#define GPIO_STATUS_W1TC_INTERRUPT_MSB 17 -#define GPIO_STATUS_W1TC_INTERRUPT_LSB 0 -#define GPIO_STATUS_W1TC_INTERRUPT_MASK 'h0003ffff -#define GPIO_STATUS_W1TC_INTERRUPT_GET(x) (((x) & GPIO_STATUS_W1TC_INTERRUPT_MASK) >> GPIO_STATUS_W1TC_INTERRUPT_LSB) -#define GPIO_STATUS_W1TC_INTERRUPT_SET(x) (((32'd0 | (x)) << GPIO_STATUS_W1TC_INTERRUPT_LSB) & GPIO_STATUS_W1TC_INTERRUPT_MASK) -#define GPIO_STATUS_W1TC_INTERRUPT_RESET 18'h0 -#define GPIO_STATUS_W1TC_RESET (32'h0 | \ - GPIO_STATUS_W1TC_INTERRUPT_SET(GPIO_STATUS_W1TC_INTERRUPT_RESET)) -#define GPIO_STATUS_W1TC_HW_MASK (32'h0) -#define GPIO_STATUS_W1TC_SW_MASK (32'h0 | \ - GPIO_STATUS_W1TC_INTERRUPT_MASK) - -#define GPIO_PIN0_ADDRESS 'h00000028 -#define GPIO_PIN0_CONFIG_MSB 12 -#define GPIO_PIN0_CONFIG_LSB 11 -#define GPIO_PIN0_CONFIG_MASK 'h00001800 -#define GPIO_PIN0_CONFIG_GET(x) (((x) & GPIO_PIN0_CONFIG_MASK) >> GPIO_PIN0_CONFIG_LSB) -#define GPIO_PIN0_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN0_CONFIG_LSB) & GPIO_PIN0_CONFIG_MASK) -#define GPIO_PIN0_CONFIG_RESET 2'h0 -#define GPIO_PIN0_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN0_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN0_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN0_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN0_WAKEUP_ENABLE_MASK) >> GPIO_PIN0_WAKEUP_ENABLE_LSB) -#define GPIO_PIN0_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN0_WAKEUP_ENABLE_LSB) & GPIO_PIN0_WAKEUP_ENABLE_MASK) -#define GPIO_PIN0_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN0_INT_TYPE_MSB 9 -#define GPIO_PIN0_INT_TYPE_LSB 7 -#define GPIO_PIN0_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN0_INT_TYPE_GET(x) (((x) & GPIO_PIN0_INT_TYPE_MASK) >> GPIO_PIN0_INT_TYPE_LSB) -#define GPIO_PIN0_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN0_INT_TYPE_LSB) & GPIO_PIN0_INT_TYPE_MASK) -#define GPIO_PIN0_INT_TYPE_RESET 3'h0 -#define GPIO_PIN0_PAD_DRIVER_MSB 2 -#define GPIO_PIN0_PAD_DRIVER_LSB 2 -#define GPIO_PIN0_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN0_PAD_DRIVER_GET(x) (((x) & GPIO_PIN0_PAD_DRIVER_MASK) >> GPIO_PIN0_PAD_DRIVER_LSB) -#define GPIO_PIN0_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN0_PAD_DRIVER_LSB) & GPIO_PIN0_PAD_DRIVER_MASK) -#define GPIO_PIN0_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN0_SOURCE_MSB 0 -#define GPIO_PIN0_SOURCE_LSB 0 -#define GPIO_PIN0_SOURCE_MASK 'h00000001 -#define GPIO_PIN0_SOURCE_GET(x) (((x) & GPIO_PIN0_SOURCE_MASK) >> GPIO_PIN0_SOURCE_LSB) -#define GPIO_PIN0_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN0_SOURCE_LSB) & GPIO_PIN0_SOURCE_MASK) -#define GPIO_PIN0_SOURCE_RESET 1'h0 -#define GPIO_PIN0_RESET (32'h0 | \ - GPIO_PIN0_CONFIG_SET(GPIO_PIN0_CONFIG_RESET) | \ - GPIO_PIN0_WAKEUP_ENABLE_SET(GPIO_PIN0_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN0_INT_TYPE_SET(GPIO_PIN0_INT_TYPE_RESET) | \ - GPIO_PIN0_PAD_DRIVER_SET(GPIO_PIN0_PAD_DRIVER_RESET) | \ - GPIO_PIN0_SOURCE_SET(GPIO_PIN0_SOURCE_RESET)) -#define GPIO_PIN0_HW_MASK (32'h0) -#define GPIO_PIN0_SW_MASK (32'h0 | \ - GPIO_PIN0_CONFIG_MASK | \ - GPIO_PIN0_WAKEUP_ENABLE_MASK | \ - GPIO_PIN0_INT_TYPE_MASK | \ - GPIO_PIN0_PAD_DRIVER_MASK | \ - GPIO_PIN0_SOURCE_MASK) - -#define GPIO_PIN1_ADDRESS 'h0000002c -#define GPIO_PIN1_CONFIG_MSB 12 -#define GPIO_PIN1_CONFIG_LSB 11 -#define GPIO_PIN1_CONFIG_MASK 'h00001800 -#define GPIO_PIN1_CONFIG_GET(x) (((x) & GPIO_PIN1_CONFIG_MASK) >> GPIO_PIN1_CONFIG_LSB) -#define GPIO_PIN1_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN1_CONFIG_LSB) & GPIO_PIN1_CONFIG_MASK) -#define GPIO_PIN1_CONFIG_RESET 2'h0 -#define GPIO_PIN1_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN1_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN1_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN1_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN1_WAKEUP_ENABLE_MASK) >> GPIO_PIN1_WAKEUP_ENABLE_LSB) -#define GPIO_PIN1_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN1_WAKEUP_ENABLE_LSB) & GPIO_PIN1_WAKEUP_ENABLE_MASK) -#define GPIO_PIN1_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN1_INT_TYPE_MSB 9 -#define GPIO_PIN1_INT_TYPE_LSB 7 -#define GPIO_PIN1_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN1_INT_TYPE_GET(x) (((x) & GPIO_PIN1_INT_TYPE_MASK) >> GPIO_PIN1_INT_TYPE_LSB) -#define GPIO_PIN1_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN1_INT_TYPE_LSB) & GPIO_PIN1_INT_TYPE_MASK) -#define GPIO_PIN1_INT_TYPE_RESET 3'h0 -#define GPIO_PIN1_PAD_DRIVER_MSB 2 -#define GPIO_PIN1_PAD_DRIVER_LSB 2 -#define GPIO_PIN1_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN1_PAD_DRIVER_GET(x) (((x) & GPIO_PIN1_PAD_DRIVER_MASK) >> GPIO_PIN1_PAD_DRIVER_LSB) -#define GPIO_PIN1_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN1_PAD_DRIVER_LSB) & GPIO_PIN1_PAD_DRIVER_MASK) -#define GPIO_PIN1_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN1_SOURCE_MSB 0 -#define GPIO_PIN1_SOURCE_LSB 0 -#define GPIO_PIN1_SOURCE_MASK 'h00000001 -#define GPIO_PIN1_SOURCE_GET(x) (((x) & GPIO_PIN1_SOURCE_MASK) >> GPIO_PIN1_SOURCE_LSB) -#define GPIO_PIN1_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN1_SOURCE_LSB) & GPIO_PIN1_SOURCE_MASK) -#define GPIO_PIN1_SOURCE_RESET 1'h0 -#define GPIO_PIN1_RESET (32'h0 | \ - GPIO_PIN1_CONFIG_SET(GPIO_PIN1_CONFIG_RESET) | \ - GPIO_PIN1_WAKEUP_ENABLE_SET(GPIO_PIN1_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN1_INT_TYPE_SET(GPIO_PIN1_INT_TYPE_RESET) | \ - GPIO_PIN1_PAD_DRIVER_SET(GPIO_PIN1_PAD_DRIVER_RESET) | \ - GPIO_PIN1_SOURCE_SET(GPIO_PIN1_SOURCE_RESET)) -#define GPIO_PIN1_HW_MASK (32'h0) -#define GPIO_PIN1_SW_MASK (32'h0 | \ - GPIO_PIN1_CONFIG_MASK | \ - GPIO_PIN1_WAKEUP_ENABLE_MASK | \ - GPIO_PIN1_INT_TYPE_MASK | \ - GPIO_PIN1_PAD_DRIVER_MASK | \ - GPIO_PIN1_SOURCE_MASK) - -#define GPIO_PIN2_ADDRESS 'h00000030 -#define GPIO_PIN2_CONFIG_MSB 12 -#define GPIO_PIN2_CONFIG_LSB 11 -#define GPIO_PIN2_CONFIG_MASK 'h00001800 -#define GPIO_PIN2_CONFIG_GET(x) (((x) & GPIO_PIN2_CONFIG_MASK) >> GPIO_PIN2_CONFIG_LSB) -#define GPIO_PIN2_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN2_CONFIG_LSB) & GPIO_PIN2_CONFIG_MASK) -#define GPIO_PIN2_CONFIG_RESET 2'h0 -#define GPIO_PIN2_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN2_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN2_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN2_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN2_WAKEUP_ENABLE_MASK) >> GPIO_PIN2_WAKEUP_ENABLE_LSB) -#define GPIO_PIN2_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN2_WAKEUP_ENABLE_LSB) & GPIO_PIN2_WAKEUP_ENABLE_MASK) -#define GPIO_PIN2_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN2_INT_TYPE_MSB 9 -#define GPIO_PIN2_INT_TYPE_LSB 7 -#define GPIO_PIN2_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN2_INT_TYPE_GET(x) (((x) & GPIO_PIN2_INT_TYPE_MASK) >> GPIO_PIN2_INT_TYPE_LSB) -#define GPIO_PIN2_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN2_INT_TYPE_LSB) & GPIO_PIN2_INT_TYPE_MASK) -#define GPIO_PIN2_INT_TYPE_RESET 3'h0 -#define GPIO_PIN2_PAD_DRIVER_MSB 2 -#define GPIO_PIN2_PAD_DRIVER_LSB 2 -#define GPIO_PIN2_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN2_PAD_DRIVER_GET(x) (((x) & GPIO_PIN2_PAD_DRIVER_MASK) >> GPIO_PIN2_PAD_DRIVER_LSB) -#define GPIO_PIN2_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN2_PAD_DRIVER_LSB) & GPIO_PIN2_PAD_DRIVER_MASK) -#define GPIO_PIN2_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN2_SOURCE_MSB 0 -#define GPIO_PIN2_SOURCE_LSB 0 -#define GPIO_PIN2_SOURCE_MASK 'h00000001 -#define GPIO_PIN2_SOURCE_GET(x) (((x) & GPIO_PIN2_SOURCE_MASK) >> GPIO_PIN2_SOURCE_LSB) -#define GPIO_PIN2_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN2_SOURCE_LSB) & GPIO_PIN2_SOURCE_MASK) -#define GPIO_PIN2_SOURCE_RESET 1'h0 -#define GPIO_PIN2_RESET (32'h0 | \ - GPIO_PIN2_CONFIG_SET(GPIO_PIN2_CONFIG_RESET) | \ - GPIO_PIN2_WAKEUP_ENABLE_SET(GPIO_PIN2_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN2_INT_TYPE_SET(GPIO_PIN2_INT_TYPE_RESET) | \ - GPIO_PIN2_PAD_DRIVER_SET(GPIO_PIN2_PAD_DRIVER_RESET) | \ - GPIO_PIN2_SOURCE_SET(GPIO_PIN2_SOURCE_RESET)) -#define GPIO_PIN2_HW_MASK (32'h0) -#define GPIO_PIN2_SW_MASK (32'h0 | \ - GPIO_PIN2_CONFIG_MASK | \ - GPIO_PIN2_WAKEUP_ENABLE_MASK | \ - GPIO_PIN2_INT_TYPE_MASK | \ - GPIO_PIN2_PAD_DRIVER_MASK | \ - GPIO_PIN2_SOURCE_MASK) - -#define GPIO_PIN3_ADDRESS 'h00000034 -#define GPIO_PIN3_CONFIG_MSB 12 -#define GPIO_PIN3_CONFIG_LSB 11 -#define GPIO_PIN3_CONFIG_MASK 'h00001800 -#define GPIO_PIN3_CONFIG_GET(x) (((x) & GPIO_PIN3_CONFIG_MASK) >> GPIO_PIN3_CONFIG_LSB) -#define GPIO_PIN3_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN3_CONFIG_LSB) & GPIO_PIN3_CONFIG_MASK) -#define GPIO_PIN3_CONFIG_RESET 2'h0 -#define GPIO_PIN3_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN3_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN3_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN3_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN3_WAKEUP_ENABLE_MASK) >> GPIO_PIN3_WAKEUP_ENABLE_LSB) -#define GPIO_PIN3_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN3_WAKEUP_ENABLE_LSB) & GPIO_PIN3_WAKEUP_ENABLE_MASK) -#define GPIO_PIN3_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN3_INT_TYPE_MSB 9 -#define GPIO_PIN3_INT_TYPE_LSB 7 -#define GPIO_PIN3_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN3_INT_TYPE_GET(x) (((x) & GPIO_PIN3_INT_TYPE_MASK) >> GPIO_PIN3_INT_TYPE_LSB) -#define GPIO_PIN3_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN3_INT_TYPE_LSB) & GPIO_PIN3_INT_TYPE_MASK) -#define GPIO_PIN3_INT_TYPE_RESET 3'h0 -#define GPIO_PIN3_PAD_DRIVER_MSB 2 -#define GPIO_PIN3_PAD_DRIVER_LSB 2 -#define GPIO_PIN3_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN3_PAD_DRIVER_GET(x) (((x) & GPIO_PIN3_PAD_DRIVER_MASK) >> GPIO_PIN3_PAD_DRIVER_LSB) -#define GPIO_PIN3_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN3_PAD_DRIVER_LSB) & GPIO_PIN3_PAD_DRIVER_MASK) -#define GPIO_PIN3_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN3_SOURCE_MSB 0 -#define GPIO_PIN3_SOURCE_LSB 0 -#define GPIO_PIN3_SOURCE_MASK 'h00000001 -#define GPIO_PIN3_SOURCE_GET(x) (((x) & GPIO_PIN3_SOURCE_MASK) >> GPIO_PIN3_SOURCE_LSB) -#define GPIO_PIN3_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN3_SOURCE_LSB) & GPIO_PIN3_SOURCE_MASK) -#define GPIO_PIN3_SOURCE_RESET 1'h0 -#define GPIO_PIN3_RESET (32'h0 | \ - GPIO_PIN3_CONFIG_SET(GPIO_PIN3_CONFIG_RESET) | \ - GPIO_PIN3_WAKEUP_ENABLE_SET(GPIO_PIN3_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN3_INT_TYPE_SET(GPIO_PIN3_INT_TYPE_RESET) | \ - GPIO_PIN3_PAD_DRIVER_SET(GPIO_PIN3_PAD_DRIVER_RESET) | \ - GPIO_PIN3_SOURCE_SET(GPIO_PIN3_SOURCE_RESET)) -#define GPIO_PIN3_HW_MASK (32'h0) -#define GPIO_PIN3_SW_MASK (32'h0 | \ - GPIO_PIN3_CONFIG_MASK | \ - GPIO_PIN3_WAKEUP_ENABLE_MASK | \ - GPIO_PIN3_INT_TYPE_MASK | \ - GPIO_PIN3_PAD_DRIVER_MASK | \ - GPIO_PIN3_SOURCE_MASK) - -#define GPIO_PIN4_ADDRESS 'h00000038 -#define GPIO_PIN4_CONFIG_MSB 12 -#define GPIO_PIN4_CONFIG_LSB 11 -#define GPIO_PIN4_CONFIG_MASK 'h00001800 -#define GPIO_PIN4_CONFIG_GET(x) (((x) & GPIO_PIN4_CONFIG_MASK) >> GPIO_PIN4_CONFIG_LSB) -#define GPIO_PIN4_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN4_CONFIG_LSB) & GPIO_PIN4_CONFIG_MASK) -#define GPIO_PIN4_CONFIG_RESET 2'h0 -#define GPIO_PIN4_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN4_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN4_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN4_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN4_WAKEUP_ENABLE_MASK) >> GPIO_PIN4_WAKEUP_ENABLE_LSB) -#define GPIO_PIN4_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN4_WAKEUP_ENABLE_LSB) & GPIO_PIN4_WAKEUP_ENABLE_MASK) -#define GPIO_PIN4_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN4_INT_TYPE_MSB 9 -#define GPIO_PIN4_INT_TYPE_LSB 7 -#define GPIO_PIN4_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN4_INT_TYPE_GET(x) (((x) & GPIO_PIN4_INT_TYPE_MASK) >> GPIO_PIN4_INT_TYPE_LSB) -#define GPIO_PIN4_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN4_INT_TYPE_LSB) & GPIO_PIN4_INT_TYPE_MASK) -#define GPIO_PIN4_INT_TYPE_RESET 3'h0 -#define GPIO_PIN4_PAD_DRIVER_MSB 2 -#define GPIO_PIN4_PAD_DRIVER_LSB 2 -#define GPIO_PIN4_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN4_PAD_DRIVER_GET(x) (((x) & GPIO_PIN4_PAD_DRIVER_MASK) >> GPIO_PIN4_PAD_DRIVER_LSB) -#define GPIO_PIN4_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN4_PAD_DRIVER_LSB) & GPIO_PIN4_PAD_DRIVER_MASK) -#define GPIO_PIN4_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN4_SOURCE_MSB 0 -#define GPIO_PIN4_SOURCE_LSB 0 -#define GPIO_PIN4_SOURCE_MASK 'h00000001 -#define GPIO_PIN4_SOURCE_GET(x) (((x) & GPIO_PIN4_SOURCE_MASK) >> GPIO_PIN4_SOURCE_LSB) -#define GPIO_PIN4_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN4_SOURCE_LSB) & GPIO_PIN4_SOURCE_MASK) -#define GPIO_PIN4_SOURCE_RESET 1'h0 -#define GPIO_PIN4_RESET (32'h0 | \ - GPIO_PIN4_CONFIG_SET(GPIO_PIN4_CONFIG_RESET) | \ - GPIO_PIN4_WAKEUP_ENABLE_SET(GPIO_PIN4_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN4_INT_TYPE_SET(GPIO_PIN4_INT_TYPE_RESET) | \ - GPIO_PIN4_PAD_DRIVER_SET(GPIO_PIN4_PAD_DRIVER_RESET) | \ - GPIO_PIN4_SOURCE_SET(GPIO_PIN4_SOURCE_RESET)) -#define GPIO_PIN4_HW_MASK (32'h0) -#define GPIO_PIN4_SW_MASK (32'h0 | \ - GPIO_PIN4_CONFIG_MASK | \ - GPIO_PIN4_WAKEUP_ENABLE_MASK | \ - GPIO_PIN4_INT_TYPE_MASK | \ - GPIO_PIN4_PAD_DRIVER_MASK | \ - GPIO_PIN4_SOURCE_MASK) - -#define GPIO_PIN5_ADDRESS 'h0000003c -#define GPIO_PIN5_CONFIG_MSB 12 -#define GPIO_PIN5_CONFIG_LSB 11 -#define GPIO_PIN5_CONFIG_MASK 'h00001800 -#define GPIO_PIN5_CONFIG_GET(x) (((x) & GPIO_PIN5_CONFIG_MASK) >> GPIO_PIN5_CONFIG_LSB) -#define GPIO_PIN5_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN5_CONFIG_LSB) & GPIO_PIN5_CONFIG_MASK) -#define GPIO_PIN5_CONFIG_RESET 2'h0 -#define GPIO_PIN5_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN5_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN5_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN5_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN5_WAKEUP_ENABLE_MASK) >> GPIO_PIN5_WAKEUP_ENABLE_LSB) -#define GPIO_PIN5_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN5_WAKEUP_ENABLE_LSB) & GPIO_PIN5_WAKEUP_ENABLE_MASK) -#define GPIO_PIN5_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN5_INT_TYPE_MSB 9 -#define GPIO_PIN5_INT_TYPE_LSB 7 -#define GPIO_PIN5_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN5_INT_TYPE_GET(x) (((x) & GPIO_PIN5_INT_TYPE_MASK) >> GPIO_PIN5_INT_TYPE_LSB) -#define GPIO_PIN5_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN5_INT_TYPE_LSB) & GPIO_PIN5_INT_TYPE_MASK) -#define GPIO_PIN5_INT_TYPE_RESET 3'h0 -#define GPIO_PIN5_PAD_DRIVER_MSB 2 -#define GPIO_PIN5_PAD_DRIVER_LSB 2 -#define GPIO_PIN5_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN5_PAD_DRIVER_GET(x) (((x) & GPIO_PIN5_PAD_DRIVER_MASK) >> GPIO_PIN5_PAD_DRIVER_LSB) -#define GPIO_PIN5_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN5_PAD_DRIVER_LSB) & GPIO_PIN5_PAD_DRIVER_MASK) -#define GPIO_PIN5_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN5_SOURCE_MSB 0 -#define GPIO_PIN5_SOURCE_LSB 0 -#define GPIO_PIN5_SOURCE_MASK 'h00000001 -#define GPIO_PIN5_SOURCE_GET(x) (((x) & GPIO_PIN5_SOURCE_MASK) >> GPIO_PIN5_SOURCE_LSB) -#define GPIO_PIN5_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN5_SOURCE_LSB) & GPIO_PIN5_SOURCE_MASK) -#define GPIO_PIN5_SOURCE_RESET 1'h0 -#define GPIO_PIN5_RESET (32'h0 | \ - GPIO_PIN5_CONFIG_SET(GPIO_PIN5_CONFIG_RESET) | \ - GPIO_PIN5_WAKEUP_ENABLE_SET(GPIO_PIN5_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN5_INT_TYPE_SET(GPIO_PIN5_INT_TYPE_RESET) | \ - GPIO_PIN5_PAD_DRIVER_SET(GPIO_PIN5_PAD_DRIVER_RESET) | \ - GPIO_PIN5_SOURCE_SET(GPIO_PIN5_SOURCE_RESET)) -#define GPIO_PIN5_HW_MASK (32'h0) -#define GPIO_PIN5_SW_MASK (32'h0 | \ - GPIO_PIN5_CONFIG_MASK | \ - GPIO_PIN5_WAKEUP_ENABLE_MASK | \ - GPIO_PIN5_INT_TYPE_MASK | \ - GPIO_PIN5_PAD_DRIVER_MASK | \ - GPIO_PIN5_SOURCE_MASK) - -#define GPIO_PIN6_ADDRESS 'h00000040 -#define GPIO_PIN6_CONFIG_MSB 12 -#define GPIO_PIN6_CONFIG_LSB 11 -#define GPIO_PIN6_CONFIG_MASK 'h00001800 -#define GPIO_PIN6_CONFIG_GET(x) (((x) & GPIO_PIN6_CONFIG_MASK) >> GPIO_PIN6_CONFIG_LSB) -#define GPIO_PIN6_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN6_CONFIG_LSB) & GPIO_PIN6_CONFIG_MASK) -#define GPIO_PIN6_CONFIG_RESET 2'h0 -#define GPIO_PIN6_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN6_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN6_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN6_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN6_WAKEUP_ENABLE_MASK) >> GPIO_PIN6_WAKEUP_ENABLE_LSB) -#define GPIO_PIN6_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN6_WAKEUP_ENABLE_LSB) & GPIO_PIN6_WAKEUP_ENABLE_MASK) -#define GPIO_PIN6_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN6_INT_TYPE_MSB 9 -#define GPIO_PIN6_INT_TYPE_LSB 7 -#define GPIO_PIN6_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN6_INT_TYPE_GET(x) (((x) & GPIO_PIN6_INT_TYPE_MASK) >> GPIO_PIN6_INT_TYPE_LSB) -#define GPIO_PIN6_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN6_INT_TYPE_LSB) & GPIO_PIN6_INT_TYPE_MASK) -#define GPIO_PIN6_INT_TYPE_RESET 3'h0 -#define GPIO_PIN6_PAD_DRIVER_MSB 2 -#define GPIO_PIN6_PAD_DRIVER_LSB 2 -#define GPIO_PIN6_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN6_PAD_DRIVER_GET(x) (((x) & GPIO_PIN6_PAD_DRIVER_MASK) >> GPIO_PIN6_PAD_DRIVER_LSB) -#define GPIO_PIN6_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN6_PAD_DRIVER_LSB) & GPIO_PIN6_PAD_DRIVER_MASK) -#define GPIO_PIN6_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN6_SOURCE_MSB 0 -#define GPIO_PIN6_SOURCE_LSB 0 -#define GPIO_PIN6_SOURCE_MASK 'h00000001 -#define GPIO_PIN6_SOURCE_GET(x) (((x) & GPIO_PIN6_SOURCE_MASK) >> GPIO_PIN6_SOURCE_LSB) -#define GPIO_PIN6_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN6_SOURCE_LSB) & GPIO_PIN6_SOURCE_MASK) -#define GPIO_PIN6_SOURCE_RESET 1'h0 -#define GPIO_PIN6_RESET (32'h0 | \ - GPIO_PIN6_CONFIG_SET(GPIO_PIN6_CONFIG_RESET) | \ - GPIO_PIN6_WAKEUP_ENABLE_SET(GPIO_PIN6_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN6_INT_TYPE_SET(GPIO_PIN6_INT_TYPE_RESET) | \ - GPIO_PIN6_PAD_DRIVER_SET(GPIO_PIN6_PAD_DRIVER_RESET) | \ - GPIO_PIN6_SOURCE_SET(GPIO_PIN6_SOURCE_RESET)) -#define GPIO_PIN6_HW_MASK (32'h0) -#define GPIO_PIN6_SW_MASK (32'h0 | \ - GPIO_PIN6_CONFIG_MASK | \ - GPIO_PIN6_WAKEUP_ENABLE_MASK | \ - GPIO_PIN6_INT_TYPE_MASK | \ - GPIO_PIN6_PAD_DRIVER_MASK | \ - GPIO_PIN6_SOURCE_MASK) - -#define GPIO_PIN7_ADDRESS 'h00000044 -#define GPIO_PIN7_CONFIG_MSB 12 -#define GPIO_PIN7_CONFIG_LSB 11 -#define GPIO_PIN7_CONFIG_MASK 'h00001800 -#define GPIO_PIN7_CONFIG_GET(x) (((x) & GPIO_PIN7_CONFIG_MASK) >> GPIO_PIN7_CONFIG_LSB) -#define GPIO_PIN7_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN7_CONFIG_LSB) & GPIO_PIN7_CONFIG_MASK) -#define GPIO_PIN7_CONFIG_RESET 2'h0 -#define GPIO_PIN7_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN7_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN7_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN7_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN7_WAKEUP_ENABLE_MASK) >> GPIO_PIN7_WAKEUP_ENABLE_LSB) -#define GPIO_PIN7_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN7_WAKEUP_ENABLE_LSB) & GPIO_PIN7_WAKEUP_ENABLE_MASK) -#define GPIO_PIN7_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN7_INT_TYPE_MSB 9 -#define GPIO_PIN7_INT_TYPE_LSB 7 -#define GPIO_PIN7_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN7_INT_TYPE_GET(x) (((x) & GPIO_PIN7_INT_TYPE_MASK) >> GPIO_PIN7_INT_TYPE_LSB) -#define GPIO_PIN7_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN7_INT_TYPE_LSB) & GPIO_PIN7_INT_TYPE_MASK) -#define GPIO_PIN7_INT_TYPE_RESET 3'h0 -#define GPIO_PIN7_PAD_DRIVER_MSB 2 -#define GPIO_PIN7_PAD_DRIVER_LSB 2 -#define GPIO_PIN7_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN7_PAD_DRIVER_GET(x) (((x) & GPIO_PIN7_PAD_DRIVER_MASK) >> GPIO_PIN7_PAD_DRIVER_LSB) -#define GPIO_PIN7_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN7_PAD_DRIVER_LSB) & GPIO_PIN7_PAD_DRIVER_MASK) -#define GPIO_PIN7_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN7_SOURCE_MSB 0 -#define GPIO_PIN7_SOURCE_LSB 0 -#define GPIO_PIN7_SOURCE_MASK 'h00000001 -#define GPIO_PIN7_SOURCE_GET(x) (((x) & GPIO_PIN7_SOURCE_MASK) >> GPIO_PIN7_SOURCE_LSB) -#define GPIO_PIN7_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN7_SOURCE_LSB) & GPIO_PIN7_SOURCE_MASK) -#define GPIO_PIN7_SOURCE_RESET 1'h0 -#define GPIO_PIN7_RESET (32'h0 | \ - GPIO_PIN7_CONFIG_SET(GPIO_PIN7_CONFIG_RESET) | \ - GPIO_PIN7_WAKEUP_ENABLE_SET(GPIO_PIN7_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN7_INT_TYPE_SET(GPIO_PIN7_INT_TYPE_RESET) | \ - GPIO_PIN7_PAD_DRIVER_SET(GPIO_PIN7_PAD_DRIVER_RESET) | \ - GPIO_PIN7_SOURCE_SET(GPIO_PIN7_SOURCE_RESET)) -#define GPIO_PIN7_HW_MASK (32'h0) -#define GPIO_PIN7_SW_MASK (32'h0 | \ - GPIO_PIN7_CONFIG_MASK | \ - GPIO_PIN7_WAKEUP_ENABLE_MASK | \ - GPIO_PIN7_INT_TYPE_MASK | \ - GPIO_PIN7_PAD_DRIVER_MASK | \ - GPIO_PIN7_SOURCE_MASK) - -#define GPIO_PIN8_ADDRESS 'h00000048 -#define GPIO_PIN8_CONFIG_MSB 12 -#define GPIO_PIN8_CONFIG_LSB 11 -#define GPIO_PIN8_CONFIG_MASK 'h00001800 -#define GPIO_PIN8_CONFIG_GET(x) (((x) & GPIO_PIN8_CONFIG_MASK) >> GPIO_PIN8_CONFIG_LSB) -#define GPIO_PIN8_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN8_CONFIG_LSB) & GPIO_PIN8_CONFIG_MASK) -#define GPIO_PIN8_CONFIG_RESET 2'h0 -#define GPIO_PIN8_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN8_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN8_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN8_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN8_WAKEUP_ENABLE_MASK) >> GPIO_PIN8_WAKEUP_ENABLE_LSB) -#define GPIO_PIN8_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN8_WAKEUP_ENABLE_LSB) & GPIO_PIN8_WAKEUP_ENABLE_MASK) -#define GPIO_PIN8_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN8_INT_TYPE_MSB 9 -#define GPIO_PIN8_INT_TYPE_LSB 7 -#define GPIO_PIN8_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN8_INT_TYPE_GET(x) (((x) & GPIO_PIN8_INT_TYPE_MASK) >> GPIO_PIN8_INT_TYPE_LSB) -#define GPIO_PIN8_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN8_INT_TYPE_LSB) & GPIO_PIN8_INT_TYPE_MASK) -#define GPIO_PIN8_INT_TYPE_RESET 3'h0 -#define GPIO_PIN8_PAD_DRIVER_MSB 2 -#define GPIO_PIN8_PAD_DRIVER_LSB 2 -#define GPIO_PIN8_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN8_PAD_DRIVER_GET(x) (((x) & GPIO_PIN8_PAD_DRIVER_MASK) >> GPIO_PIN8_PAD_DRIVER_LSB) -#define GPIO_PIN8_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN8_PAD_DRIVER_LSB) & GPIO_PIN8_PAD_DRIVER_MASK) -#define GPIO_PIN8_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN8_SOURCE_MSB 0 -#define GPIO_PIN8_SOURCE_LSB 0 -#define GPIO_PIN8_SOURCE_MASK 'h00000001 -#define GPIO_PIN8_SOURCE_GET(x) (((x) & GPIO_PIN8_SOURCE_MASK) >> GPIO_PIN8_SOURCE_LSB) -#define GPIO_PIN8_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN8_SOURCE_LSB) & GPIO_PIN8_SOURCE_MASK) -#define GPIO_PIN8_SOURCE_RESET 1'h0 -#define GPIO_PIN8_RESET (32'h0 | \ - GPIO_PIN8_CONFIG_SET(GPIO_PIN8_CONFIG_RESET) | \ - GPIO_PIN8_WAKEUP_ENABLE_SET(GPIO_PIN8_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN8_INT_TYPE_SET(GPIO_PIN8_INT_TYPE_RESET) | \ - GPIO_PIN8_PAD_DRIVER_SET(GPIO_PIN8_PAD_DRIVER_RESET) | \ - GPIO_PIN8_SOURCE_SET(GPIO_PIN8_SOURCE_RESET)) -#define GPIO_PIN8_HW_MASK (32'h0) -#define GPIO_PIN8_SW_MASK (32'h0 | \ - GPIO_PIN8_CONFIG_MASK | \ - GPIO_PIN8_WAKEUP_ENABLE_MASK | \ - GPIO_PIN8_INT_TYPE_MASK | \ - GPIO_PIN8_PAD_DRIVER_MASK | \ - GPIO_PIN8_SOURCE_MASK) - -#define GPIO_PIN9_ADDRESS 'h0000004c -#define GPIO_PIN9_CONFIG_MSB 12 -#define GPIO_PIN9_CONFIG_LSB 11 -#define GPIO_PIN9_CONFIG_MASK 'h00001800 -#define GPIO_PIN9_CONFIG_GET(x) (((x) & GPIO_PIN9_CONFIG_MASK) >> GPIO_PIN9_CONFIG_LSB) -#define GPIO_PIN9_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN9_CONFIG_LSB) & GPIO_PIN9_CONFIG_MASK) -#define GPIO_PIN9_CONFIG_RESET 2'h0 -#define GPIO_PIN9_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN9_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN9_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN9_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN9_WAKEUP_ENABLE_MASK) >> GPIO_PIN9_WAKEUP_ENABLE_LSB) -#define GPIO_PIN9_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN9_WAKEUP_ENABLE_LSB) & GPIO_PIN9_WAKEUP_ENABLE_MASK) -#define GPIO_PIN9_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN9_INT_TYPE_MSB 9 -#define GPIO_PIN9_INT_TYPE_LSB 7 -#define GPIO_PIN9_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN9_INT_TYPE_GET(x) (((x) & GPIO_PIN9_INT_TYPE_MASK) >> GPIO_PIN9_INT_TYPE_LSB) -#define GPIO_PIN9_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN9_INT_TYPE_LSB) & GPIO_PIN9_INT_TYPE_MASK) -#define GPIO_PIN9_INT_TYPE_RESET 3'h0 -#define GPIO_PIN9_PAD_DRIVER_MSB 2 -#define GPIO_PIN9_PAD_DRIVER_LSB 2 -#define GPIO_PIN9_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN9_PAD_DRIVER_GET(x) (((x) & GPIO_PIN9_PAD_DRIVER_MASK) >> GPIO_PIN9_PAD_DRIVER_LSB) -#define GPIO_PIN9_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN9_PAD_DRIVER_LSB) & GPIO_PIN9_PAD_DRIVER_MASK) -#define GPIO_PIN9_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN9_SOURCE_MSB 0 -#define GPIO_PIN9_SOURCE_LSB 0 -#define GPIO_PIN9_SOURCE_MASK 'h00000001 -#define GPIO_PIN9_SOURCE_GET(x) (((x) & GPIO_PIN9_SOURCE_MASK) >> GPIO_PIN9_SOURCE_LSB) -#define GPIO_PIN9_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN9_SOURCE_LSB) & GPIO_PIN9_SOURCE_MASK) -#define GPIO_PIN9_SOURCE_RESET 1'h0 -#define GPIO_PIN9_RESET (32'h0 | \ - GPIO_PIN9_CONFIG_SET(GPIO_PIN9_CONFIG_RESET) | \ - GPIO_PIN9_WAKEUP_ENABLE_SET(GPIO_PIN9_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN9_INT_TYPE_SET(GPIO_PIN9_INT_TYPE_RESET) | \ - GPIO_PIN9_PAD_DRIVER_SET(GPIO_PIN9_PAD_DRIVER_RESET) | \ - GPIO_PIN9_SOURCE_SET(GPIO_PIN9_SOURCE_RESET)) -#define GPIO_PIN9_HW_MASK (32'h0) -#define GPIO_PIN9_SW_MASK (32'h0 | \ - GPIO_PIN9_CONFIG_MASK | \ - GPIO_PIN9_WAKEUP_ENABLE_MASK | \ - GPIO_PIN9_INT_TYPE_MASK | \ - GPIO_PIN9_PAD_DRIVER_MASK | \ - GPIO_PIN9_SOURCE_MASK) - -#define GPIO_PIN10_ADDRESS 'h00000050 -#define GPIO_PIN10_CONFIG_MSB 12 -#define GPIO_PIN10_CONFIG_LSB 11 -#define GPIO_PIN10_CONFIG_MASK 'h00001800 -#define GPIO_PIN10_CONFIG_GET(x) (((x) & GPIO_PIN10_CONFIG_MASK) >> GPIO_PIN10_CONFIG_LSB) -#define GPIO_PIN10_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN10_CONFIG_LSB) & GPIO_PIN10_CONFIG_MASK) -#define GPIO_PIN10_CONFIG_RESET 2'h0 -#define GPIO_PIN10_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN10_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN10_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN10_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN10_WAKEUP_ENABLE_MASK) >> GPIO_PIN10_WAKEUP_ENABLE_LSB) -#define GPIO_PIN10_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN10_WAKEUP_ENABLE_LSB) & GPIO_PIN10_WAKEUP_ENABLE_MASK) -#define GPIO_PIN10_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN10_INT_TYPE_MSB 9 -#define GPIO_PIN10_INT_TYPE_LSB 7 -#define GPIO_PIN10_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN10_INT_TYPE_GET(x) (((x) & GPIO_PIN10_INT_TYPE_MASK) >> GPIO_PIN10_INT_TYPE_LSB) -#define GPIO_PIN10_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN10_INT_TYPE_LSB) & GPIO_PIN10_INT_TYPE_MASK) -#define GPIO_PIN10_INT_TYPE_RESET 3'h0 -#define GPIO_PIN10_PAD_DRIVER_MSB 2 -#define GPIO_PIN10_PAD_DRIVER_LSB 2 -#define GPIO_PIN10_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN10_PAD_DRIVER_GET(x) (((x) & GPIO_PIN10_PAD_DRIVER_MASK) >> GPIO_PIN10_PAD_DRIVER_LSB) -#define GPIO_PIN10_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN10_PAD_DRIVER_LSB) & GPIO_PIN10_PAD_DRIVER_MASK) -#define GPIO_PIN10_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN10_SOURCE_MSB 0 -#define GPIO_PIN10_SOURCE_LSB 0 -#define GPIO_PIN10_SOURCE_MASK 'h00000001 -#define GPIO_PIN10_SOURCE_GET(x) (((x) & GPIO_PIN10_SOURCE_MASK) >> GPIO_PIN10_SOURCE_LSB) -#define GPIO_PIN10_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN10_SOURCE_LSB) & GPIO_PIN10_SOURCE_MASK) -#define GPIO_PIN10_SOURCE_RESET 1'h0 -#define GPIO_PIN10_RESET (32'h0 | \ - GPIO_PIN10_CONFIG_SET(GPIO_PIN10_CONFIG_RESET) | \ - GPIO_PIN10_WAKEUP_ENABLE_SET(GPIO_PIN10_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN10_INT_TYPE_SET(GPIO_PIN10_INT_TYPE_RESET) | \ - GPIO_PIN10_PAD_DRIVER_SET(GPIO_PIN10_PAD_DRIVER_RESET) | \ - GPIO_PIN10_SOURCE_SET(GPIO_PIN10_SOURCE_RESET)) -#define GPIO_PIN10_HW_MASK (32'h0) -#define GPIO_PIN10_SW_MASK (32'h0 | \ - GPIO_PIN10_CONFIG_MASK | \ - GPIO_PIN10_WAKEUP_ENABLE_MASK | \ - GPIO_PIN10_INT_TYPE_MASK | \ - GPIO_PIN10_PAD_DRIVER_MASK | \ - GPIO_PIN10_SOURCE_MASK) - -#define GPIO_PIN11_ADDRESS 'h00000054 -#define GPIO_PIN11_CONFIG_MSB 12 -#define GPIO_PIN11_CONFIG_LSB 11 -#define GPIO_PIN11_CONFIG_MASK 'h00001800 -#define GPIO_PIN11_CONFIG_GET(x) (((x) & GPIO_PIN11_CONFIG_MASK) >> GPIO_PIN11_CONFIG_LSB) -#define GPIO_PIN11_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN11_CONFIG_LSB) & GPIO_PIN11_CONFIG_MASK) -#define GPIO_PIN11_CONFIG_RESET 2'h0 -#define GPIO_PIN11_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN11_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN11_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN11_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN11_WAKEUP_ENABLE_MASK) >> GPIO_PIN11_WAKEUP_ENABLE_LSB) -#define GPIO_PIN11_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN11_WAKEUP_ENABLE_LSB) & GPIO_PIN11_WAKEUP_ENABLE_MASK) -#define GPIO_PIN11_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN11_INT_TYPE_MSB 9 -#define GPIO_PIN11_INT_TYPE_LSB 7 -#define GPIO_PIN11_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN11_INT_TYPE_GET(x) (((x) & GPIO_PIN11_INT_TYPE_MASK) >> GPIO_PIN11_INT_TYPE_LSB) -#define GPIO_PIN11_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN11_INT_TYPE_LSB) & GPIO_PIN11_INT_TYPE_MASK) -#define GPIO_PIN11_INT_TYPE_RESET 3'h0 -#define GPIO_PIN11_PAD_DRIVER_MSB 2 -#define GPIO_PIN11_PAD_DRIVER_LSB 2 -#define GPIO_PIN11_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN11_PAD_DRIVER_GET(x) (((x) & GPIO_PIN11_PAD_DRIVER_MASK) >> GPIO_PIN11_PAD_DRIVER_LSB) -#define GPIO_PIN11_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN11_PAD_DRIVER_LSB) & GPIO_PIN11_PAD_DRIVER_MASK) -#define GPIO_PIN11_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN11_SOURCE_MSB 0 -#define GPIO_PIN11_SOURCE_LSB 0 -#define GPIO_PIN11_SOURCE_MASK 'h00000001 -#define GPIO_PIN11_SOURCE_GET(x) (((x) & GPIO_PIN11_SOURCE_MASK) >> GPIO_PIN11_SOURCE_LSB) -#define GPIO_PIN11_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN11_SOURCE_LSB) & GPIO_PIN11_SOURCE_MASK) -#define GPIO_PIN11_SOURCE_RESET 1'h0 -#define GPIO_PIN11_RESET (32'h0 | \ - GPIO_PIN11_CONFIG_SET(GPIO_PIN11_CONFIG_RESET) | \ - GPIO_PIN11_WAKEUP_ENABLE_SET(GPIO_PIN11_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN11_INT_TYPE_SET(GPIO_PIN11_INT_TYPE_RESET) | \ - GPIO_PIN11_PAD_DRIVER_SET(GPIO_PIN11_PAD_DRIVER_RESET) | \ - GPIO_PIN11_SOURCE_SET(GPIO_PIN11_SOURCE_RESET)) -#define GPIO_PIN11_HW_MASK (32'h0) -#define GPIO_PIN11_SW_MASK (32'h0 | \ - GPIO_PIN11_CONFIG_MASK | \ - GPIO_PIN11_WAKEUP_ENABLE_MASK | \ - GPIO_PIN11_INT_TYPE_MASK | \ - GPIO_PIN11_PAD_DRIVER_MASK | \ - GPIO_PIN11_SOURCE_MASK) - -#define GPIO_PIN12_ADDRESS 'h00000058 -#define GPIO_PIN12_CONFIG_MSB 12 -#define GPIO_PIN12_CONFIG_LSB 11 -#define GPIO_PIN12_CONFIG_MASK 'h00001800 -#define GPIO_PIN12_CONFIG_GET(x) (((x) & GPIO_PIN12_CONFIG_MASK) >> GPIO_PIN12_CONFIG_LSB) -#define GPIO_PIN12_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN12_CONFIG_LSB) & GPIO_PIN12_CONFIG_MASK) -#define GPIO_PIN12_CONFIG_RESET 2'h0 -#define GPIO_PIN12_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN12_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN12_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN12_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN12_WAKEUP_ENABLE_MASK) >> GPIO_PIN12_WAKEUP_ENABLE_LSB) -#define GPIO_PIN12_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN12_WAKEUP_ENABLE_LSB) & GPIO_PIN12_WAKEUP_ENABLE_MASK) -#define GPIO_PIN12_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN12_INT_TYPE_MSB 9 -#define GPIO_PIN12_INT_TYPE_LSB 7 -#define GPIO_PIN12_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN12_INT_TYPE_GET(x) (((x) & GPIO_PIN12_INT_TYPE_MASK) >> GPIO_PIN12_INT_TYPE_LSB) -#define GPIO_PIN12_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN12_INT_TYPE_LSB) & GPIO_PIN12_INT_TYPE_MASK) -#define GPIO_PIN12_INT_TYPE_RESET 3'h0 -#define GPIO_PIN12_PAD_DRIVER_MSB 2 -#define GPIO_PIN12_PAD_DRIVER_LSB 2 -#define GPIO_PIN12_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN12_PAD_DRIVER_GET(x) (((x) & GPIO_PIN12_PAD_DRIVER_MASK) >> GPIO_PIN12_PAD_DRIVER_LSB) -#define GPIO_PIN12_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN12_PAD_DRIVER_LSB) & GPIO_PIN12_PAD_DRIVER_MASK) -#define GPIO_PIN12_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN12_SOURCE_MSB 0 -#define GPIO_PIN12_SOURCE_LSB 0 -#define GPIO_PIN12_SOURCE_MASK 'h00000001 -#define GPIO_PIN12_SOURCE_GET(x) (((x) & GPIO_PIN12_SOURCE_MASK) >> GPIO_PIN12_SOURCE_LSB) -#define GPIO_PIN12_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN12_SOURCE_LSB) & GPIO_PIN12_SOURCE_MASK) -#define GPIO_PIN12_SOURCE_RESET 1'h0 -#define GPIO_PIN12_RESET (32'h0 | \ - GPIO_PIN12_CONFIG_SET(GPIO_PIN12_CONFIG_RESET) | \ - GPIO_PIN12_WAKEUP_ENABLE_SET(GPIO_PIN12_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN12_INT_TYPE_SET(GPIO_PIN12_INT_TYPE_RESET) | \ - GPIO_PIN12_PAD_DRIVER_SET(GPIO_PIN12_PAD_DRIVER_RESET) | \ - GPIO_PIN12_SOURCE_SET(GPIO_PIN12_SOURCE_RESET)) -#define GPIO_PIN12_HW_MASK (32'h0) -#define GPIO_PIN12_SW_MASK (32'h0 | \ - GPIO_PIN12_CONFIG_MASK | \ - GPIO_PIN12_WAKEUP_ENABLE_MASK | \ - GPIO_PIN12_INT_TYPE_MASK | \ - GPIO_PIN12_PAD_DRIVER_MASK | \ - GPIO_PIN12_SOURCE_MASK) - -#define GPIO_PIN13_ADDRESS 'h0000005c -#define GPIO_PIN13_CONFIG_MSB 12 -#define GPIO_PIN13_CONFIG_LSB 11 -#define GPIO_PIN13_CONFIG_MASK 'h00001800 -#define GPIO_PIN13_CONFIG_GET(x) (((x) & GPIO_PIN13_CONFIG_MASK) >> GPIO_PIN13_CONFIG_LSB) -#define GPIO_PIN13_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN13_CONFIG_LSB) & GPIO_PIN13_CONFIG_MASK) -#define GPIO_PIN13_CONFIG_RESET 2'h0 -#define GPIO_PIN13_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN13_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN13_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN13_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN13_WAKEUP_ENABLE_MASK) >> GPIO_PIN13_WAKEUP_ENABLE_LSB) -#define GPIO_PIN13_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN13_WAKEUP_ENABLE_LSB) & GPIO_PIN13_WAKEUP_ENABLE_MASK) -#define GPIO_PIN13_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN13_INT_TYPE_MSB 9 -#define GPIO_PIN13_INT_TYPE_LSB 7 -#define GPIO_PIN13_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN13_INT_TYPE_GET(x) (((x) & GPIO_PIN13_INT_TYPE_MASK) >> GPIO_PIN13_INT_TYPE_LSB) -#define GPIO_PIN13_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN13_INT_TYPE_LSB) & GPIO_PIN13_INT_TYPE_MASK) -#define GPIO_PIN13_INT_TYPE_RESET 3'h0 -#define GPIO_PIN13_PAD_DRIVER_MSB 2 -#define GPIO_PIN13_PAD_DRIVER_LSB 2 -#define GPIO_PIN13_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN13_PAD_DRIVER_GET(x) (((x) & GPIO_PIN13_PAD_DRIVER_MASK) >> GPIO_PIN13_PAD_DRIVER_LSB) -#define GPIO_PIN13_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN13_PAD_DRIVER_LSB) & GPIO_PIN13_PAD_DRIVER_MASK) -#define GPIO_PIN13_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN13_SOURCE_MSB 0 -#define GPIO_PIN13_SOURCE_LSB 0 -#define GPIO_PIN13_SOURCE_MASK 'h00000001 -#define GPIO_PIN13_SOURCE_GET(x) (((x) & GPIO_PIN13_SOURCE_MASK) >> GPIO_PIN13_SOURCE_LSB) -#define GPIO_PIN13_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN13_SOURCE_LSB) & GPIO_PIN13_SOURCE_MASK) -#define GPIO_PIN13_SOURCE_RESET 1'h0 -#define GPIO_PIN13_RESET (32'h0 | \ - GPIO_PIN13_CONFIG_SET(GPIO_PIN13_CONFIG_RESET) | \ - GPIO_PIN13_WAKEUP_ENABLE_SET(GPIO_PIN13_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN13_INT_TYPE_SET(GPIO_PIN13_INT_TYPE_RESET) | \ - GPIO_PIN13_PAD_DRIVER_SET(GPIO_PIN13_PAD_DRIVER_RESET) | \ - GPIO_PIN13_SOURCE_SET(GPIO_PIN13_SOURCE_RESET)) -#define GPIO_PIN13_HW_MASK (32'h0) -#define GPIO_PIN13_SW_MASK (32'h0 | \ - GPIO_PIN13_CONFIG_MASK | \ - GPIO_PIN13_WAKEUP_ENABLE_MASK | \ - GPIO_PIN13_INT_TYPE_MASK | \ - GPIO_PIN13_PAD_DRIVER_MASK | \ - GPIO_PIN13_SOURCE_MASK) - -#define GPIO_PIN14_ADDRESS 'h00000060 -#define GPIO_PIN14_CONFIG_MSB 12 -#define GPIO_PIN14_CONFIG_LSB 11 -#define GPIO_PIN14_CONFIG_MASK 'h00001800 -#define GPIO_PIN14_CONFIG_GET(x) (((x) & GPIO_PIN14_CONFIG_MASK) >> GPIO_PIN14_CONFIG_LSB) -#define GPIO_PIN14_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN14_CONFIG_LSB) & GPIO_PIN14_CONFIG_MASK) -#define GPIO_PIN14_CONFIG_RESET 2'h0 -#define GPIO_PIN14_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN14_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN14_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN14_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN14_WAKEUP_ENABLE_MASK) >> GPIO_PIN14_WAKEUP_ENABLE_LSB) -#define GPIO_PIN14_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN14_WAKEUP_ENABLE_LSB) & GPIO_PIN14_WAKEUP_ENABLE_MASK) -#define GPIO_PIN14_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN14_INT_TYPE_MSB 9 -#define GPIO_PIN14_INT_TYPE_LSB 7 -#define GPIO_PIN14_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN14_INT_TYPE_GET(x) (((x) & GPIO_PIN14_INT_TYPE_MASK) >> GPIO_PIN14_INT_TYPE_LSB) -#define GPIO_PIN14_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN14_INT_TYPE_LSB) & GPIO_PIN14_INT_TYPE_MASK) -#define GPIO_PIN14_INT_TYPE_RESET 3'h0 -#define GPIO_PIN14_PAD_DRIVER_MSB 2 -#define GPIO_PIN14_PAD_DRIVER_LSB 2 -#define GPIO_PIN14_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN14_PAD_DRIVER_GET(x) (((x) & GPIO_PIN14_PAD_DRIVER_MASK) >> GPIO_PIN14_PAD_DRIVER_LSB) -#define GPIO_PIN14_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN14_PAD_DRIVER_LSB) & GPIO_PIN14_PAD_DRIVER_MASK) -#define GPIO_PIN14_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN14_SOURCE_MSB 0 -#define GPIO_PIN14_SOURCE_LSB 0 -#define GPIO_PIN14_SOURCE_MASK 'h00000001 -#define GPIO_PIN14_SOURCE_GET(x) (((x) & GPIO_PIN14_SOURCE_MASK) >> GPIO_PIN14_SOURCE_LSB) -#define GPIO_PIN14_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN14_SOURCE_LSB) & GPIO_PIN14_SOURCE_MASK) -#define GPIO_PIN14_SOURCE_RESET 1'h0 -#define GPIO_PIN14_RESET (32'h0 | \ - GPIO_PIN14_CONFIG_SET(GPIO_PIN14_CONFIG_RESET) | \ - GPIO_PIN14_WAKEUP_ENABLE_SET(GPIO_PIN14_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN14_INT_TYPE_SET(GPIO_PIN14_INT_TYPE_RESET) | \ - GPIO_PIN14_PAD_DRIVER_SET(GPIO_PIN14_PAD_DRIVER_RESET) | \ - GPIO_PIN14_SOURCE_SET(GPIO_PIN14_SOURCE_RESET)) -#define GPIO_PIN14_HW_MASK (32'h0) -#define GPIO_PIN14_SW_MASK (32'h0 | \ - GPIO_PIN14_CONFIG_MASK | \ - GPIO_PIN14_WAKEUP_ENABLE_MASK | \ - GPIO_PIN14_INT_TYPE_MASK | \ - GPIO_PIN14_PAD_DRIVER_MASK | \ - GPIO_PIN14_SOURCE_MASK) - -#define GPIO_PIN15_ADDRESS 'h00000064 -#define GPIO_PIN15_CONFIG_MSB 12 -#define GPIO_PIN15_CONFIG_LSB 11 -#define GPIO_PIN15_CONFIG_MASK 'h00001800 -#define GPIO_PIN15_CONFIG_GET(x) (((x) & GPIO_PIN15_CONFIG_MASK) >> GPIO_PIN15_CONFIG_LSB) -#define GPIO_PIN15_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN15_CONFIG_LSB) & GPIO_PIN15_CONFIG_MASK) -#define GPIO_PIN15_CONFIG_RESET 2'h0 -#define GPIO_PIN15_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN15_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN15_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN15_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN15_WAKEUP_ENABLE_MASK) >> GPIO_PIN15_WAKEUP_ENABLE_LSB) -#define GPIO_PIN15_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN15_WAKEUP_ENABLE_LSB) & GPIO_PIN15_WAKEUP_ENABLE_MASK) -#define GPIO_PIN15_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN15_INT_TYPE_MSB 9 -#define GPIO_PIN15_INT_TYPE_LSB 7 -#define GPIO_PIN15_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN15_INT_TYPE_GET(x) (((x) & GPIO_PIN15_INT_TYPE_MASK) >> GPIO_PIN15_INT_TYPE_LSB) -#define GPIO_PIN15_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN15_INT_TYPE_LSB) & GPIO_PIN15_INT_TYPE_MASK) -#define GPIO_PIN15_INT_TYPE_RESET 3'h0 -#define GPIO_PIN15_PAD_DRIVER_MSB 2 -#define GPIO_PIN15_PAD_DRIVER_LSB 2 -#define GPIO_PIN15_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN15_PAD_DRIVER_GET(x) (((x) & GPIO_PIN15_PAD_DRIVER_MASK) >> GPIO_PIN15_PAD_DRIVER_LSB) -#define GPIO_PIN15_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN15_PAD_DRIVER_LSB) & GPIO_PIN15_PAD_DRIVER_MASK) -#define GPIO_PIN15_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN15_SOURCE_MSB 0 -#define GPIO_PIN15_SOURCE_LSB 0 -#define GPIO_PIN15_SOURCE_MASK 'h00000001 -#define GPIO_PIN15_SOURCE_GET(x) (((x) & GPIO_PIN15_SOURCE_MASK) >> GPIO_PIN15_SOURCE_LSB) -#define GPIO_PIN15_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN15_SOURCE_LSB) & GPIO_PIN15_SOURCE_MASK) -#define GPIO_PIN15_SOURCE_RESET 1'h0 -#define GPIO_PIN15_RESET (32'h0 | \ - GPIO_PIN15_CONFIG_SET(GPIO_PIN15_CONFIG_RESET) | \ - GPIO_PIN15_WAKEUP_ENABLE_SET(GPIO_PIN15_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN15_INT_TYPE_SET(GPIO_PIN15_INT_TYPE_RESET) | \ - GPIO_PIN15_PAD_DRIVER_SET(GPIO_PIN15_PAD_DRIVER_RESET) | \ - GPIO_PIN15_SOURCE_SET(GPIO_PIN15_SOURCE_RESET)) -#define GPIO_PIN15_HW_MASK (32'h0) -#define GPIO_PIN15_SW_MASK (32'h0 | \ - GPIO_PIN15_CONFIG_MASK | \ - GPIO_PIN15_WAKEUP_ENABLE_MASK | \ - GPIO_PIN15_INT_TYPE_MASK | \ - GPIO_PIN15_PAD_DRIVER_MASK | \ - GPIO_PIN15_SOURCE_MASK) - -#define GPIO_PIN16_ADDRESS 'h00000068 -#define GPIO_PIN16_CONFIG_MSB 12 -#define GPIO_PIN16_CONFIG_LSB 11 -#define GPIO_PIN16_CONFIG_MASK 'h00001800 -#define GPIO_PIN16_CONFIG_GET(x) (((x) & GPIO_PIN16_CONFIG_MASK) >> GPIO_PIN16_CONFIG_LSB) -#define GPIO_PIN16_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN16_CONFIG_LSB) & GPIO_PIN16_CONFIG_MASK) -#define GPIO_PIN16_CONFIG_RESET 2'h0 -#define GPIO_PIN16_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN16_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN16_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN16_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN16_WAKEUP_ENABLE_MASK) >> GPIO_PIN16_WAKEUP_ENABLE_LSB) -#define GPIO_PIN16_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN16_WAKEUP_ENABLE_LSB) & GPIO_PIN16_WAKEUP_ENABLE_MASK) -#define GPIO_PIN16_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN16_INT_TYPE_MSB 9 -#define GPIO_PIN16_INT_TYPE_LSB 7 -#define GPIO_PIN16_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN16_INT_TYPE_GET(x) (((x) & GPIO_PIN16_INT_TYPE_MASK) >> GPIO_PIN16_INT_TYPE_LSB) -#define GPIO_PIN16_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN16_INT_TYPE_LSB) & GPIO_PIN16_INT_TYPE_MASK) -#define GPIO_PIN16_INT_TYPE_RESET 3'h0 -#define GPIO_PIN16_PAD_DRIVER_MSB 2 -#define GPIO_PIN16_PAD_DRIVER_LSB 2 -#define GPIO_PIN16_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN16_PAD_DRIVER_GET(x) (((x) & GPIO_PIN16_PAD_DRIVER_MASK) >> GPIO_PIN16_PAD_DRIVER_LSB) -#define GPIO_PIN16_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN16_PAD_DRIVER_LSB) & GPIO_PIN16_PAD_DRIVER_MASK) -#define GPIO_PIN16_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN16_SOURCE_MSB 0 -#define GPIO_PIN16_SOURCE_LSB 0 -#define GPIO_PIN16_SOURCE_MASK 'h00000001 -#define GPIO_PIN16_SOURCE_GET(x) (((x) & GPIO_PIN16_SOURCE_MASK) >> GPIO_PIN16_SOURCE_LSB) -#define GPIO_PIN16_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN16_SOURCE_LSB) & GPIO_PIN16_SOURCE_MASK) -#define GPIO_PIN16_SOURCE_RESET 1'h0 -#define GPIO_PIN16_RESET (32'h0 | \ - GPIO_PIN16_CONFIG_SET(GPIO_PIN16_CONFIG_RESET) | \ - GPIO_PIN16_WAKEUP_ENABLE_SET(GPIO_PIN16_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN16_INT_TYPE_SET(GPIO_PIN16_INT_TYPE_RESET) | \ - GPIO_PIN16_PAD_DRIVER_SET(GPIO_PIN16_PAD_DRIVER_RESET) | \ - GPIO_PIN16_SOURCE_SET(GPIO_PIN16_SOURCE_RESET)) -#define GPIO_PIN16_HW_MASK (32'h0) -#define GPIO_PIN16_SW_MASK (32'h0 | \ - GPIO_PIN16_CONFIG_MASK | \ - GPIO_PIN16_WAKEUP_ENABLE_MASK | \ - GPIO_PIN16_INT_TYPE_MASK | \ - GPIO_PIN16_PAD_DRIVER_MASK | \ - GPIO_PIN16_SOURCE_MASK) - -#define GPIO_PIN17_ADDRESS 'h0000006c -#define GPIO_PIN17_CONFIG_MSB 12 -#define GPIO_PIN17_CONFIG_LSB 11 -#define GPIO_PIN17_CONFIG_MASK 'h00001800 -#define GPIO_PIN17_CONFIG_GET(x) (((x) & GPIO_PIN17_CONFIG_MASK) >> GPIO_PIN17_CONFIG_LSB) -#define GPIO_PIN17_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN17_CONFIG_LSB) & GPIO_PIN17_CONFIG_MASK) -#define GPIO_PIN17_CONFIG_RESET 2'h0 -#define GPIO_PIN17_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN17_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN17_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN17_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN17_WAKEUP_ENABLE_MASK) >> GPIO_PIN17_WAKEUP_ENABLE_LSB) -#define GPIO_PIN17_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN17_WAKEUP_ENABLE_LSB) & GPIO_PIN17_WAKEUP_ENABLE_MASK) -#define GPIO_PIN17_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN17_INT_TYPE_MSB 9 -#define GPIO_PIN17_INT_TYPE_LSB 7 -#define GPIO_PIN17_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN17_INT_TYPE_GET(x) (((x) & GPIO_PIN17_INT_TYPE_MASK) >> GPIO_PIN17_INT_TYPE_LSB) -#define GPIO_PIN17_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN17_INT_TYPE_LSB) & GPIO_PIN17_INT_TYPE_MASK) -#define GPIO_PIN17_INT_TYPE_RESET 3'h0 -#define GPIO_PIN17_PAD_DRIVER_MSB 2 -#define GPIO_PIN17_PAD_DRIVER_LSB 2 -#define GPIO_PIN17_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN17_PAD_DRIVER_GET(x) (((x) & GPIO_PIN17_PAD_DRIVER_MASK) >> GPIO_PIN17_PAD_DRIVER_LSB) -#define GPIO_PIN17_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN17_PAD_DRIVER_LSB) & GPIO_PIN17_PAD_DRIVER_MASK) -#define GPIO_PIN17_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN17_SOURCE_MSB 0 -#define GPIO_PIN17_SOURCE_LSB 0 -#define GPIO_PIN17_SOURCE_MASK 'h00000001 -#define GPIO_PIN17_SOURCE_GET(x) (((x) & GPIO_PIN17_SOURCE_MASK) >> GPIO_PIN17_SOURCE_LSB) -#define GPIO_PIN17_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN17_SOURCE_LSB) & GPIO_PIN17_SOURCE_MASK) -#define GPIO_PIN17_SOURCE_RESET 1'h0 -#define GPIO_PIN17_RESET (32'h0 | \ - GPIO_PIN17_CONFIG_SET(GPIO_PIN17_CONFIG_RESET) | \ - GPIO_PIN17_WAKEUP_ENABLE_SET(GPIO_PIN17_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN17_INT_TYPE_SET(GPIO_PIN17_INT_TYPE_RESET) | \ - GPIO_PIN17_PAD_DRIVER_SET(GPIO_PIN17_PAD_DRIVER_RESET) | \ - GPIO_PIN17_SOURCE_SET(GPIO_PIN17_SOURCE_RESET)) -#define GPIO_PIN17_HW_MASK (32'h0) -#define GPIO_PIN17_SW_MASK (32'h0 | \ - GPIO_PIN17_CONFIG_MASK | \ - GPIO_PIN17_WAKEUP_ENABLE_MASK | \ - GPIO_PIN17_INT_TYPE_MASK | \ - GPIO_PIN17_PAD_DRIVER_MASK | \ - GPIO_PIN17_SOURCE_MASK) - -#define SDIO_PIN_ADDRESS 'h00000070 -#define SDIO_PIN_PAD_PULL_MSB 3 -#define SDIO_PIN_PAD_PULL_LSB 2 -#define SDIO_PIN_PAD_PULL_MASK 'h0000000c -#define SDIO_PIN_PAD_PULL_GET(x) (((x) & SDIO_PIN_PAD_PULL_MASK) >> SDIO_PIN_PAD_PULL_LSB) -#define SDIO_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << SDIO_PIN_PAD_PULL_LSB) & SDIO_PIN_PAD_PULL_MASK) -#define SDIO_PIN_PAD_PULL_RESET 2'h1 -#define SDIO_PIN_PAD_STRENGTH_MSB 1 -#define SDIO_PIN_PAD_STRENGTH_LSB 0 -#define SDIO_PIN_PAD_STRENGTH_MASK 'h00000003 -#define SDIO_PIN_PAD_STRENGTH_GET(x) (((x) & SDIO_PIN_PAD_STRENGTH_MASK) >> SDIO_PIN_PAD_STRENGTH_LSB) -#define SDIO_PIN_PAD_STRENGTH_SET(x) (((32'd0 | (x)) << SDIO_PIN_PAD_STRENGTH_LSB) & SDIO_PIN_PAD_STRENGTH_MASK) -#define SDIO_PIN_PAD_STRENGTH_RESET 2'h1 -#define SDIO_PIN_RESET (32'h0 | \ - SDIO_PIN_PAD_PULL_SET(SDIO_PIN_PAD_PULL_RESET) | \ - SDIO_PIN_PAD_STRENGTH_SET(SDIO_PIN_PAD_STRENGTH_RESET)) -#define SDIO_PIN_HW_MASK (32'h0) -#define SDIO_PIN_SW_MASK (32'h0 | \ - SDIO_PIN_PAD_PULL_MASK | \ - SDIO_PIN_PAD_STRENGTH_MASK) - -#define CLK_REQ_PIN_ADDRESS 'h00000074 -#define CLK_REQ_PIN_ATE_OE_L_MSB 4 -#define CLK_REQ_PIN_ATE_OE_L_LSB 4 -#define CLK_REQ_PIN_ATE_OE_L_MASK 'h00000010 -#define CLK_REQ_PIN_ATE_OE_L_GET(x) (((x) & CLK_REQ_PIN_ATE_OE_L_MASK) >> CLK_REQ_PIN_ATE_OE_L_LSB) -#define CLK_REQ_PIN_ATE_OE_L_SET(x) (((32'd0 | (x)) << CLK_REQ_PIN_ATE_OE_L_LSB) & CLK_REQ_PIN_ATE_OE_L_MASK) -#define CLK_REQ_PIN_ATE_OE_L_RESET 1'h0 -#define CLK_REQ_PIN_PAD_PULL_MSB 3 -#define CLK_REQ_PIN_PAD_PULL_LSB 2 -#define CLK_REQ_PIN_PAD_PULL_MASK 'h0000000c -#define CLK_REQ_PIN_PAD_PULL_GET(x) (((x) & CLK_REQ_PIN_PAD_PULL_MASK) >> CLK_REQ_PIN_PAD_PULL_LSB) -#define CLK_REQ_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << CLK_REQ_PIN_PAD_PULL_LSB) & CLK_REQ_PIN_PAD_PULL_MASK) -#define CLK_REQ_PIN_PAD_PULL_RESET 2'h2 -#define CLK_REQ_PIN_PAD_STRENGTH_MSB 1 -#define CLK_REQ_PIN_PAD_STRENGTH_LSB 0 -#define CLK_REQ_PIN_PAD_STRENGTH_MASK 'h00000003 -#define CLK_REQ_PIN_PAD_STRENGTH_GET(x) (((x) & CLK_REQ_PIN_PAD_STRENGTH_MASK) >> CLK_REQ_PIN_PAD_STRENGTH_LSB) -#define CLK_REQ_PIN_PAD_STRENGTH_SET(x) (((32'd0 | (x)) << CLK_REQ_PIN_PAD_STRENGTH_LSB) & CLK_REQ_PIN_PAD_STRENGTH_MASK) -#define CLK_REQ_PIN_PAD_STRENGTH_RESET 2'h1 -#define CLK_REQ_PIN_RESET (32'h0 | \ - CLK_REQ_PIN_ATE_OE_L_SET(CLK_REQ_PIN_ATE_OE_L_RESET) | \ - CLK_REQ_PIN_PAD_PULL_SET(CLK_REQ_PIN_PAD_PULL_RESET) | \ - CLK_REQ_PIN_PAD_STRENGTH_SET(CLK_REQ_PIN_PAD_STRENGTH_RESET)) -#define CLK_REQ_PIN_HW_MASK (32'h0) -#define CLK_REQ_PIN_SW_MASK (32'h0 | \ - CLK_REQ_PIN_ATE_OE_L_MASK | \ - CLK_REQ_PIN_PAD_PULL_MASK | \ - CLK_REQ_PIN_PAD_STRENGTH_MASK) - -#define SIGMA_DELTA_ADDRESS 'h00000078 -#define SIGMA_DELTA_ENABLE_MSB 16 -#define SIGMA_DELTA_ENABLE_LSB 16 -#define SIGMA_DELTA_ENABLE_MASK 'h00010000 -#define SIGMA_DELTA_ENABLE_GET(x) (((x) & SIGMA_DELTA_ENABLE_MASK) >> SIGMA_DELTA_ENABLE_LSB) -#define SIGMA_DELTA_ENABLE_SET(x) (((32'd0 | (x)) << SIGMA_DELTA_ENABLE_LSB) & SIGMA_DELTA_ENABLE_MASK) -#define SIGMA_DELTA_ENABLE_RESET 1'h0 -#define SIGMA_DELTA_PRESCALAR_MSB 15 -#define SIGMA_DELTA_PRESCALAR_LSB 8 -#define SIGMA_DELTA_PRESCALAR_MASK 'h0000ff00 -#define SIGMA_DELTA_PRESCALAR_GET(x) (((x) & SIGMA_DELTA_PRESCALAR_MASK) >> SIGMA_DELTA_PRESCALAR_LSB) -#define SIGMA_DELTA_PRESCALAR_SET(x) (((32'd0 | (x)) << SIGMA_DELTA_PRESCALAR_LSB) & SIGMA_DELTA_PRESCALAR_MASK) -#define SIGMA_DELTA_PRESCALAR_RESET 8'h0 -#define SIGMA_DELTA_TARGET_MSB 7 -#define SIGMA_DELTA_TARGET_LSB 0 -#define SIGMA_DELTA_TARGET_MASK 'h000000ff -#define SIGMA_DELTA_TARGET_GET(x) (((x) & SIGMA_DELTA_TARGET_MASK) >> SIGMA_DELTA_TARGET_LSB) -#define SIGMA_DELTA_TARGET_SET(x) (((32'd0 | (x)) << SIGMA_DELTA_TARGET_LSB) & SIGMA_DELTA_TARGET_MASK) -#define SIGMA_DELTA_TARGET_RESET 8'h0 -#define SIGMA_DELTA_RESET (32'h0 | \ - SIGMA_DELTA_ENABLE_SET(SIGMA_DELTA_ENABLE_RESET) | \ - SIGMA_DELTA_PRESCALAR_SET(SIGMA_DELTA_PRESCALAR_RESET) | \ - SIGMA_DELTA_TARGET_SET(SIGMA_DELTA_TARGET_RESET)) -#define SIGMA_DELTA_HW_MASK (32'h0) -#define SIGMA_DELTA_SW_MASK (32'h0 | \ - SIGMA_DELTA_ENABLE_MASK | \ - SIGMA_DELTA_PRESCALAR_MASK | \ - SIGMA_DELTA_TARGET_MASK) - -#define DEBUG_CONTROL_ADDRESS 'h0000007c -#define DEBUG_CONTROL_OBS_OE_L_MSB 1 -#define DEBUG_CONTROL_OBS_OE_L_LSB 1 -#define DEBUG_CONTROL_OBS_OE_L_MASK 'h00000002 -#define DEBUG_CONTROL_OBS_OE_L_GET(x) (((x) & DEBUG_CONTROL_OBS_OE_L_MASK) >> DEBUG_CONTROL_OBS_OE_L_LSB) -#define DEBUG_CONTROL_OBS_OE_L_SET(x) (((32'd0 | (x)) << DEBUG_CONTROL_OBS_OE_L_LSB) & DEBUG_CONTROL_OBS_OE_L_MASK) -#define DEBUG_CONTROL_OBS_OE_L_RESET 1'h1 -#define DEBUG_CONTROL_ENABLE_MSB 0 -#define DEBUG_CONTROL_ENABLE_LSB 0 -#define DEBUG_CONTROL_ENABLE_MASK 'h00000001 -#define DEBUG_CONTROL_ENABLE_GET(x) (((x) & DEBUG_CONTROL_ENABLE_MASK) >> DEBUG_CONTROL_ENABLE_LSB) -#define DEBUG_CONTROL_ENABLE_SET(x) (((32'd0 | (x)) << DEBUG_CONTROL_ENABLE_LSB) & DEBUG_CONTROL_ENABLE_MASK) -#define DEBUG_CONTROL_ENABLE_RESET 1'h0 -#define DEBUG_CONTROL_RESET (32'h0 | \ - DEBUG_CONTROL_OBS_OE_L_SET(DEBUG_CONTROL_OBS_OE_L_RESET) | \ - DEBUG_CONTROL_ENABLE_SET(DEBUG_CONTROL_ENABLE_RESET)) -#define DEBUG_CONTROL_HW_MASK (32'h0) -#define DEBUG_CONTROL_SW_MASK (32'h0 | \ - DEBUG_CONTROL_OBS_OE_L_MASK | \ - DEBUG_CONTROL_ENABLE_MASK) - -#define DEBUG_INPUT_SEL_ADDRESS 'h00000080 -#define DEBUG_INPUT_SEL_SRC_MSB 3 -#define DEBUG_INPUT_SEL_SRC_LSB 0 -#define DEBUG_INPUT_SEL_SRC_MASK 'h0000000f -#define DEBUG_INPUT_SEL_SRC_GET(x) (((x) & DEBUG_INPUT_SEL_SRC_MASK) >> DEBUG_INPUT_SEL_SRC_LSB) -#define DEBUG_INPUT_SEL_SRC_SET(x) (((32'd0 | (x)) << DEBUG_INPUT_SEL_SRC_LSB) & DEBUG_INPUT_SEL_SRC_MASK) -#define DEBUG_INPUT_SEL_SRC_RESET 4'h0 -#define DEBUG_INPUT_SEL_RESET (32'h0 | \ - DEBUG_INPUT_SEL_SRC_SET(DEBUG_INPUT_SEL_SRC_RESET)) -#define DEBUG_INPUT_SEL_HW_MASK (32'h0) -#define DEBUG_INPUT_SEL_SW_MASK (32'h0 | \ - DEBUG_INPUT_SEL_SRC_MASK) - -#define DEBUG_OUT_ADDRESS 'h00000084 -#define DEBUG_OUT_DATA_MSB 17 -#define DEBUG_OUT_DATA_LSB 0 -#define DEBUG_OUT_DATA_MASK 'h0003ffff -#define DEBUG_OUT_DATA_GET(x) (((x) & DEBUG_OUT_DATA_MASK) >> DEBUG_OUT_DATA_LSB) -#define DEBUG_OUT_DATA_SET(x) (((32'd0 | (x)) << DEBUG_OUT_DATA_LSB) & DEBUG_OUT_DATA_MASK) -#define DEBUG_OUT_DATA_RESET 18'h0 -#define DEBUG_OUT_RESET (32'h0 | \ - DEBUG_OUT_DATA_SET(DEBUG_OUT_DATA_RESET)) -#define DEBUG_OUT_HW_MASK (32'h0 | \ - DEBUG_OUT_DATA_MASK) -#define DEBUG_OUT_SW_MASK (32'h0) - -#define LA_CONTROL_ADDRESS 'h00000088 -#define LA_CONTROL_RUN_MSB 1 -#define LA_CONTROL_RUN_LSB 1 -#define LA_CONTROL_RUN_MASK 'h00000002 -#define LA_CONTROL_RUN_GET(x) (((x) & LA_CONTROL_RUN_MASK) >> LA_CONTROL_RUN_LSB) -#define LA_CONTROL_RUN_SET(x) (((32'd0 | (x)) << LA_CONTROL_RUN_LSB) & LA_CONTROL_RUN_MASK) -#define LA_CONTROL_RUN_RESET 1'h0 -#define LA_CONTROL_TRIGGERED_MSB 0 -#define LA_CONTROL_TRIGGERED_LSB 0 -#define LA_CONTROL_TRIGGERED_MASK 'h00000001 -#define LA_CONTROL_TRIGGERED_GET(x) (((x) & LA_CONTROL_TRIGGERED_MASK) >> LA_CONTROL_TRIGGERED_LSB) -#define LA_CONTROL_TRIGGERED_SET(x) (((32'd0 | (x)) << LA_CONTROL_TRIGGERED_LSB) & LA_CONTROL_TRIGGERED_MASK) -#define LA_CONTROL_TRIGGERED_RESET 1'h0 -#define LA_CONTROL_RESET (32'h0 | \ - LA_CONTROL_RUN_SET(LA_CONTROL_RUN_RESET) | \ - LA_CONTROL_TRIGGERED_SET(LA_CONTROL_TRIGGERED_RESET)) -#define LA_CONTROL_HW_MASK (32'h0 | \ - LA_CONTROL_RUN_MASK | \ - LA_CONTROL_TRIGGERED_MASK) -#define LA_CONTROL_SW_MASK (32'h0 | \ - LA_CONTROL_RUN_MASK) - -#define LA_CLOCK_ADDRESS 'h0000008c -#define LA_CLOCK_DIV_MSB 7 -#define LA_CLOCK_DIV_LSB 0 -#define LA_CLOCK_DIV_MASK 'h000000ff -#define LA_CLOCK_DIV_GET(x) (((x) & LA_CLOCK_DIV_MASK) >> LA_CLOCK_DIV_LSB) -#define LA_CLOCK_DIV_SET(x) (((32'd0 | (x)) << LA_CLOCK_DIV_LSB) & LA_CLOCK_DIV_MASK) -#define LA_CLOCK_DIV_RESET 8'h0 -#define LA_CLOCK_RESET (32'h0 | \ - LA_CLOCK_DIV_SET(LA_CLOCK_DIV_RESET)) -#define LA_CLOCK_HW_MASK (32'h0) -#define LA_CLOCK_SW_MASK (32'h0 | \ - LA_CLOCK_DIV_MASK) - -#define LA_STATUS_ADDRESS 'h00000090 -#define LA_STATUS_INTERRUPT_MSB 0 -#define LA_STATUS_INTERRUPT_LSB 0 -#define LA_STATUS_INTERRUPT_MASK 'h00000001 -#define LA_STATUS_INTERRUPT_GET(x) (((x) & LA_STATUS_INTERRUPT_MASK) >> LA_STATUS_INTERRUPT_LSB) -#define LA_STATUS_INTERRUPT_SET(x) (((32'd0 | (x)) << LA_STATUS_INTERRUPT_LSB) & LA_STATUS_INTERRUPT_MASK) -#define LA_STATUS_INTERRUPT_RESET 1'h0 -#define LA_STATUS_RESET (32'h0 | \ - LA_STATUS_INTERRUPT_SET(LA_STATUS_INTERRUPT_RESET)) -#define LA_STATUS_HW_MASK (32'h0 | \ - LA_STATUS_INTERRUPT_MASK) -#define LA_STATUS_SW_MASK (32'h0 | \ - LA_STATUS_INTERRUPT_MASK) - -#define LA_TRIGGER_SAMPLE_ADDRESS 'h00000094 -#define LA_TRIGGER_SAMPLE_COUNT_MSB 15 -#define LA_TRIGGER_SAMPLE_COUNT_LSB 0 -#define LA_TRIGGER_SAMPLE_COUNT_MASK 'h0000ffff -#define LA_TRIGGER_SAMPLE_COUNT_GET(x) (((x) & LA_TRIGGER_SAMPLE_COUNT_MASK) >> LA_TRIGGER_SAMPLE_COUNT_LSB) -#define LA_TRIGGER_SAMPLE_COUNT_SET(x) (((32'd0 | (x)) << LA_TRIGGER_SAMPLE_COUNT_LSB) & LA_TRIGGER_SAMPLE_COUNT_MASK) -#define LA_TRIGGER_SAMPLE_COUNT_RESET 16'h0 -#define LA_TRIGGER_SAMPLE_RESET (32'h0 | \ - LA_TRIGGER_SAMPLE_COUNT_SET(LA_TRIGGER_SAMPLE_COUNT_RESET)) -#define LA_TRIGGER_SAMPLE_HW_MASK (32'h0) -#define LA_TRIGGER_SAMPLE_SW_MASK (32'h0 | \ - LA_TRIGGER_SAMPLE_COUNT_MASK) - -#define LA_TRIGGER_POSITION_ADDRESS 'h00000098 -#define LA_TRIGGER_POSITION_VALUE_MSB 15 -#define LA_TRIGGER_POSITION_VALUE_LSB 0 -#define LA_TRIGGER_POSITION_VALUE_MASK 'h0000ffff -#define LA_TRIGGER_POSITION_VALUE_GET(x) (((x) & LA_TRIGGER_POSITION_VALUE_MASK) >> LA_TRIGGER_POSITION_VALUE_LSB) -#define LA_TRIGGER_POSITION_VALUE_SET(x) (((32'd0 | (x)) << LA_TRIGGER_POSITION_VALUE_LSB) & LA_TRIGGER_POSITION_VALUE_MASK) -#define LA_TRIGGER_POSITION_VALUE_RESET 16'h1 -#define LA_TRIGGER_POSITION_RESET (32'h0 | \ - LA_TRIGGER_POSITION_VALUE_SET(LA_TRIGGER_POSITION_VALUE_RESET)) -#define LA_TRIGGER_POSITION_HW_MASK (32'h0) -#define LA_TRIGGER_POSITION_SW_MASK (32'h0 | \ - LA_TRIGGER_POSITION_VALUE_MASK) - -#define LA_PRE_TRIGGER_ADDRESS 'h0000009c -#define LA_PRE_TRIGGER_COUNT_MSB 15 -#define LA_PRE_TRIGGER_COUNT_LSB 0 -#define LA_PRE_TRIGGER_COUNT_MASK 'h0000ffff -#define LA_PRE_TRIGGER_COUNT_GET(x) (((x) & LA_PRE_TRIGGER_COUNT_MASK) >> LA_PRE_TRIGGER_COUNT_LSB) -#define LA_PRE_TRIGGER_COUNT_SET(x) (((32'd0 | (x)) << LA_PRE_TRIGGER_COUNT_LSB) & LA_PRE_TRIGGER_COUNT_MASK) -#define LA_PRE_TRIGGER_COUNT_RESET 16'h0 -#define LA_PRE_TRIGGER_RESET (32'h0 | \ - LA_PRE_TRIGGER_COUNT_SET(LA_PRE_TRIGGER_COUNT_RESET)) -#define LA_PRE_TRIGGER_HW_MASK (32'h0 | \ - LA_PRE_TRIGGER_COUNT_MASK) -#define LA_PRE_TRIGGER_SW_MASK (32'h0 | \ - LA_PRE_TRIGGER_COUNT_MASK) - -#define LA_POST_TRIGGER_ADDRESS 'h000000a0 -#define LA_POST_TRIGGER_COUNT_MSB 15 -#define LA_POST_TRIGGER_COUNT_LSB 0 -#define LA_POST_TRIGGER_COUNT_MASK 'h0000ffff -#define LA_POST_TRIGGER_COUNT_GET(x) (((x) & LA_POST_TRIGGER_COUNT_MASK) >> LA_POST_TRIGGER_COUNT_LSB) -#define LA_POST_TRIGGER_COUNT_SET(x) (((32'd0 | (x)) << LA_POST_TRIGGER_COUNT_LSB) & LA_POST_TRIGGER_COUNT_MASK) -#define LA_POST_TRIGGER_COUNT_RESET 16'h0 -#define LA_POST_TRIGGER_RESET (32'h0 | \ - LA_POST_TRIGGER_COUNT_SET(LA_POST_TRIGGER_COUNT_RESET)) -#define LA_POST_TRIGGER_HW_MASK (32'h0 | \ - LA_POST_TRIGGER_COUNT_MASK) -#define LA_POST_TRIGGER_SW_MASK (32'h0 | \ - LA_POST_TRIGGER_COUNT_MASK) - -#define LA_FILTER_CONTROL_ADDRESS 'h000000a4 -#define LA_FILTER_CONTROL_DELTA_MSB 0 -#define LA_FILTER_CONTROL_DELTA_LSB 0 -#define LA_FILTER_CONTROL_DELTA_MASK 'h00000001 -#define LA_FILTER_CONTROL_DELTA_GET(x) (((x) & LA_FILTER_CONTROL_DELTA_MASK) >> LA_FILTER_CONTROL_DELTA_LSB) -#define LA_FILTER_CONTROL_DELTA_SET(x) (((32'd0 | (x)) << LA_FILTER_CONTROL_DELTA_LSB) & LA_FILTER_CONTROL_DELTA_MASK) -#define LA_FILTER_CONTROL_DELTA_RESET 1'h0 -#define LA_FILTER_CONTROL_RESET (32'h0 | \ - LA_FILTER_CONTROL_DELTA_SET(LA_FILTER_CONTROL_DELTA_RESET)) -#define LA_FILTER_CONTROL_HW_MASK (32'h0) -#define LA_FILTER_CONTROL_SW_MASK (32'h0 | \ - LA_FILTER_CONTROL_DELTA_MASK) - -#define LA_FILTER_DATA_ADDRESS 'h000000a8 -#define LA_FILTER_DATA_MATCH_MSB 17 -#define LA_FILTER_DATA_MATCH_LSB 0 -#define LA_FILTER_DATA_MATCH_MASK 'h0003ffff -#define LA_FILTER_DATA_MATCH_GET(x) (((x) & LA_FILTER_DATA_MATCH_MASK) >> LA_FILTER_DATA_MATCH_LSB) -#define LA_FILTER_DATA_MATCH_SET(x) (((32'd0 | (x)) << LA_FILTER_DATA_MATCH_LSB) & LA_FILTER_DATA_MATCH_MASK) -#define LA_FILTER_DATA_MATCH_RESET 18'h0 -#define LA_FILTER_DATA_RESET (32'h0 | \ - LA_FILTER_DATA_MATCH_SET(LA_FILTER_DATA_MATCH_RESET)) -#define LA_FILTER_DATA_HW_MASK (32'h0) -#define LA_FILTER_DATA_SW_MASK (32'h0 | \ - LA_FILTER_DATA_MATCH_MASK) - -#define LA_FILTER_WILDCARD_ADDRESS 'h000000ac -#define LA_FILTER_WILDCARD_MATCH_MSB 17 -#define LA_FILTER_WILDCARD_MATCH_LSB 0 -#define LA_FILTER_WILDCARD_MATCH_MASK 'h0003ffff -#define LA_FILTER_WILDCARD_MATCH_GET(x) (((x) & LA_FILTER_WILDCARD_MATCH_MASK) >> LA_FILTER_WILDCARD_MATCH_LSB) -#define LA_FILTER_WILDCARD_MATCH_SET(x) (((32'd0 | (x)) << LA_FILTER_WILDCARD_MATCH_LSB) & LA_FILTER_WILDCARD_MATCH_MASK) -#define LA_FILTER_WILDCARD_MATCH_RESET 18'h0 -#define LA_FILTER_WILDCARD_RESET (32'h0 | \ - LA_FILTER_WILDCARD_MATCH_SET(LA_FILTER_WILDCARD_MATCH_RESET)) -#define LA_FILTER_WILDCARD_HW_MASK (32'h0) -#define LA_FILTER_WILDCARD_SW_MASK (32'h0 | \ - LA_FILTER_WILDCARD_MATCH_MASK) - -#define LA_TRIGGERA_DATA_ADDRESS 'h000000b0 -#define LA_TRIGGERA_DATA_MATCH_MSB 17 -#define LA_TRIGGERA_DATA_MATCH_LSB 0 -#define LA_TRIGGERA_DATA_MATCH_MASK 'h0003ffff -#define LA_TRIGGERA_DATA_MATCH_GET(x) (((x) & LA_TRIGGERA_DATA_MATCH_MASK) >> LA_TRIGGERA_DATA_MATCH_LSB) -#define LA_TRIGGERA_DATA_MATCH_SET(x) (((32'd0 | (x)) << LA_TRIGGERA_DATA_MATCH_LSB) & LA_TRIGGERA_DATA_MATCH_MASK) -#define LA_TRIGGERA_DATA_MATCH_RESET 18'h0 -#define LA_TRIGGERA_DATA_RESET (32'h0 | \ - LA_TRIGGERA_DATA_MATCH_SET(LA_TRIGGERA_DATA_MATCH_RESET)) -#define LA_TRIGGERA_DATA_HW_MASK (32'h0) -#define LA_TRIGGERA_DATA_SW_MASK (32'h0 | \ - LA_TRIGGERA_DATA_MATCH_MASK) - -#define LA_TRIGGERA_WILDCARD_ADDRESS 'h000000b4 -#define LA_TRIGGERA_WILDCARD_MATCH_MSB 17 -#define LA_TRIGGERA_WILDCARD_MATCH_LSB 0 -#define LA_TRIGGERA_WILDCARD_MATCH_MASK 'h0003ffff -#define LA_TRIGGERA_WILDCARD_MATCH_GET(x) (((x) & LA_TRIGGERA_WILDCARD_MATCH_MASK) >> LA_TRIGGERA_WILDCARD_MATCH_LSB) -#define LA_TRIGGERA_WILDCARD_MATCH_SET(x) (((32'd0 | (x)) << LA_TRIGGERA_WILDCARD_MATCH_LSB) & LA_TRIGGERA_WILDCARD_MATCH_MASK) -#define LA_TRIGGERA_WILDCARD_MATCH_RESET 18'h0 -#define LA_TRIGGERA_WILDCARD_RESET (32'h0 | \ - LA_TRIGGERA_WILDCARD_MATCH_SET(LA_TRIGGERA_WILDCARD_MATCH_RESET)) -#define LA_TRIGGERA_WILDCARD_HW_MASK (32'h0) -#define LA_TRIGGERA_WILDCARD_SW_MASK (32'h0 | \ - LA_TRIGGERA_WILDCARD_MATCH_MASK) - -#define LA_TRIGGERB_DATA_ADDRESS 'h000000b8 -#define LA_TRIGGERB_DATA_MATCH_MSB 17 -#define LA_TRIGGERB_DATA_MATCH_LSB 0 -#define LA_TRIGGERB_DATA_MATCH_MASK 'h0003ffff -#define LA_TRIGGERB_DATA_MATCH_GET(x) (((x) & LA_TRIGGERB_DATA_MATCH_MASK) >> LA_TRIGGERB_DATA_MATCH_LSB) -#define LA_TRIGGERB_DATA_MATCH_SET(x) (((32'd0 | (x)) << LA_TRIGGERB_DATA_MATCH_LSB) & LA_TRIGGERB_DATA_MATCH_MASK) -#define LA_TRIGGERB_DATA_MATCH_RESET 18'h0 -#define LA_TRIGGERB_DATA_RESET (32'h0 | \ - LA_TRIGGERB_DATA_MATCH_SET(LA_TRIGGERB_DATA_MATCH_RESET)) -#define LA_TRIGGERB_DATA_HW_MASK (32'h0) -#define LA_TRIGGERB_DATA_SW_MASK (32'h0 | \ - LA_TRIGGERB_DATA_MATCH_MASK) - -#define LA_TRIGGERB_WILDCARD_ADDRESS 'h000000bc -#define LA_TRIGGERB_WILDCARD_MATCH_MSB 17 -#define LA_TRIGGERB_WILDCARD_MATCH_LSB 0 -#define LA_TRIGGERB_WILDCARD_MATCH_MASK 'h0003ffff -#define LA_TRIGGERB_WILDCARD_MATCH_GET(x) (((x) & LA_TRIGGERB_WILDCARD_MATCH_MASK) >> LA_TRIGGERB_WILDCARD_MATCH_LSB) -#define LA_TRIGGERB_WILDCARD_MATCH_SET(x) (((32'd0 | (x)) << LA_TRIGGERB_WILDCARD_MATCH_LSB) & LA_TRIGGERB_WILDCARD_MATCH_MASK) -#define LA_TRIGGERB_WILDCARD_MATCH_RESET 18'h0 -#define LA_TRIGGERB_WILDCARD_RESET (32'h0 | \ - LA_TRIGGERB_WILDCARD_MATCH_SET(LA_TRIGGERB_WILDCARD_MATCH_RESET)) -#define LA_TRIGGERB_WILDCARD_HW_MASK (32'h0) -#define LA_TRIGGERB_WILDCARD_SW_MASK (32'h0 | \ - LA_TRIGGERB_WILDCARD_MATCH_MASK) - -#define LA_TRIGGER_ADDRESS 'h000000c0 -#define LA_TRIGGER_EVENT_MSB 2 -#define LA_TRIGGER_EVENT_LSB 0 -#define LA_TRIGGER_EVENT_MASK 'h00000007 -#define LA_TRIGGER_EVENT_GET(x) (((x) & LA_TRIGGER_EVENT_MASK) >> LA_TRIGGER_EVENT_LSB) -#define LA_TRIGGER_EVENT_SET(x) (((32'd0 | (x)) << LA_TRIGGER_EVENT_LSB) & LA_TRIGGER_EVENT_MASK) -#define LA_TRIGGER_EVENT_RESET 3'h0 -#define LA_TRIGGER_RESET (32'h0 | \ - LA_TRIGGER_EVENT_SET(LA_TRIGGER_EVENT_RESET)) -#define LA_TRIGGER_HW_MASK (32'h0) -#define LA_TRIGGER_SW_MASK (32'h0 | \ - LA_TRIGGER_EVENT_MASK) - -#define LA_FIFO_ADDRESS 'h000000c4 -#define LA_FIFO_FULL_MSB 1 -#define LA_FIFO_FULL_LSB 1 -#define LA_FIFO_FULL_MASK 'h00000002 -#define LA_FIFO_FULL_GET(x) (((x) & LA_FIFO_FULL_MASK) >> LA_FIFO_FULL_LSB) -#define LA_FIFO_FULL_SET(x) (((32'd0 | (x)) << LA_FIFO_FULL_LSB) & LA_FIFO_FULL_MASK) -#define LA_FIFO_FULL_RESET 1'h0 -#define LA_FIFO_EMPTY_MSB 0 -#define LA_FIFO_EMPTY_LSB 0 -#define LA_FIFO_EMPTY_MASK 'h00000001 -#define LA_FIFO_EMPTY_GET(x) (((x) & LA_FIFO_EMPTY_MASK) >> LA_FIFO_EMPTY_LSB) -#define LA_FIFO_EMPTY_SET(x) (((32'd0 | (x)) << LA_FIFO_EMPTY_LSB) & LA_FIFO_EMPTY_MASK) -#define LA_FIFO_EMPTY_RESET 1'h0 -#define LA_FIFO_RESET (32'h0 | \ - LA_FIFO_FULL_SET(LA_FIFO_FULL_RESET) | \ - LA_FIFO_EMPTY_SET(LA_FIFO_EMPTY_RESET)) -#define LA_FIFO_HW_MASK (32'h0 | \ - LA_FIFO_FULL_MASK | \ - LA_FIFO_EMPTY_MASK) -#define LA_FIFO_SW_MASK (32'h0) - -#define LA_ADDRESS 'h000000c8 -#define LA_DATA_MSB 17 -#define LA_DATA_LSB 0 -#define LA_DATA_MASK 'h0003ffff -#define LA_DATA_GET(x) (((x) & LA_DATA_MASK) >> LA_DATA_LSB) -#define LA_DATA_SET(x) (((32'd0 | (x)) << LA_DATA_LSB) & LA_DATA_MASK) -#define LA_DATA_RESET 18'h0 -#define LA_RESET (32'h0 | \ - LA_DATA_SET(LA_DATA_RESET)) -#define LA_HW_MASK (32'h0 | \ - LA_DATA_MASK) -#define LA_SW_MASK (32'h0) - -#define ANT_PIN_ADDRESS 'h000000d0 -#define ANT_PIN_PAD_PULL_MSB 3 -#define ANT_PIN_PAD_PULL_LSB 2 -#define ANT_PIN_PAD_PULL_MASK 'h0000000c -#define ANT_PIN_PAD_PULL_GET(x) (((x) & ANT_PIN_PAD_PULL_MASK) >> ANT_PIN_PAD_PULL_LSB) -#define ANT_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << ANT_PIN_PAD_PULL_LSB) & ANT_PIN_PAD_PULL_MASK) -#define ANT_PIN_PAD_PULL_RESET 2'h2 -#define ANT_PIN_PAD_STRENGTH_MSB 1 -#define ANT_PIN_PAD_STRENGTH_LSB 0 -#define ANT_PIN_PAD_STRENGTH_MASK 'h00000003 -#define ANT_PIN_PAD_STRENGTH_GET(x) (((x) & ANT_PIN_PAD_STRENGTH_MASK) >> ANT_PIN_PAD_STRENGTH_LSB) -#define ANT_PIN_PAD_STRENGTH_SET(x) (((32'd0 | (x)) << ANT_PIN_PAD_STRENGTH_LSB) & ANT_PIN_PAD_STRENGTH_MASK) -#define ANT_PIN_PAD_STRENGTH_RESET 2'h1 -#define ANT_PIN_RESET (32'h0 | \ - ANT_PIN_PAD_PULL_SET(ANT_PIN_PAD_PULL_RESET) | \ - ANT_PIN_PAD_STRENGTH_SET(ANT_PIN_PAD_STRENGTH_RESET)) -#define ANT_PIN_HW_MASK (32'h0) -#define ANT_PIN_SW_MASK (32'h0 | \ - ANT_PIN_PAD_PULL_MASK | \ - ANT_PIN_PAD_STRENGTH_MASK) - -#define ANTD_PIN_ADDRESS 'h000000d4 -#define ANTD_PIN_PAD_PULL_MSB 1 -#define ANTD_PIN_PAD_PULL_LSB 0 -#define ANTD_PIN_PAD_PULL_MASK 'h00000003 -#define ANTD_PIN_PAD_PULL_GET(x) (((x) & ANTD_PIN_PAD_PULL_MASK) >> ANTD_PIN_PAD_PULL_LSB) -#define ANTD_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << ANTD_PIN_PAD_PULL_LSB) & ANTD_PIN_PAD_PULL_MASK) -#define ANTD_PIN_PAD_PULL_RESET 2'h1 -#define ANTD_PIN_RESET (32'h0 | \ - ANTD_PIN_PAD_PULL_SET(ANTD_PIN_PAD_PULL_RESET)) -#define ANTD_PIN_HW_MASK (32'h0) -#define ANTD_PIN_SW_MASK (32'h0 | \ - ANTD_PIN_PAD_PULL_MASK) - -#define GPIO_PIN_ADDRESS 'h000000d8 -#define GPIO_PIN_PAD_PULL_MSB 3 -#define GPIO_PIN_PAD_PULL_LSB 2 -#define GPIO_PIN_PAD_PULL_MASK 'h0000000c -#define GPIO_PIN_PAD_PULL_GET(x) (((x) & GPIO_PIN_PAD_PULL_MASK) >> GPIO_PIN_PAD_PULL_LSB) -#define GPIO_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << GPIO_PIN_PAD_PULL_LSB) & GPIO_PIN_PAD_PULL_MASK) -#define GPIO_PIN_PAD_PULL_RESET 2'h2 -#define GPIO_PIN_PAD_STRENGTH_MSB 1 -#define GPIO_PIN_PAD_STRENGTH_LSB 0 -#define GPIO_PIN_PAD_STRENGTH_MASK 'h00000003 -#define GPIO_PIN_PAD_STRENGTH_GET(x) (((x) & GPIO_PIN_PAD_STRENGTH_MASK) >> GPIO_PIN_PAD_STRENGTH_LSB) -#define GPIO_PIN_PAD_STRENGTH_SET(x) (((32'd0 | (x)) << GPIO_PIN_PAD_STRENGTH_LSB) & GPIO_PIN_PAD_STRENGTH_MASK) -#define GPIO_PIN_PAD_STRENGTH_RESET 2'h1 -#define GPIO_PIN_RESET (32'h0 | \ - GPIO_PIN_PAD_PULL_SET(GPIO_PIN_PAD_PULL_RESET) | \ - GPIO_PIN_PAD_STRENGTH_SET(GPIO_PIN_PAD_STRENGTH_RESET)) -#define GPIO_PIN_HW_MASK (32'h0) -#define GPIO_PIN_SW_MASK (32'h0 | \ - GPIO_PIN_PAD_PULL_MASK | \ - GPIO_PIN_PAD_STRENGTH_MASK) - -#define GPIO_H_PIN_ADDRESS 'h000000dc -#define GPIO_H_PIN_PAD_PULL_MSB 1 -#define GPIO_H_PIN_PAD_PULL_LSB 0 -#define GPIO_H_PIN_PAD_PULL_MASK 'h00000003 -#define GPIO_H_PIN_PAD_PULL_GET(x) (((x) & GPIO_H_PIN_PAD_PULL_MASK) >> GPIO_H_PIN_PAD_PULL_LSB) -#define GPIO_H_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << GPIO_H_PIN_PAD_PULL_LSB) & GPIO_H_PIN_PAD_PULL_MASK) -#define GPIO_H_PIN_PAD_PULL_RESET 2'h0 -#define GPIO_H_PIN_RESET (32'h0 | \ - GPIO_H_PIN_PAD_PULL_SET(GPIO_H_PIN_PAD_PULL_RESET)) -#define GPIO_H_PIN_HW_MASK (32'h0) -#define GPIO_H_PIN_SW_MASK (32'h0 | \ - GPIO_H_PIN_PAD_PULL_MASK) - -#define BT_PIN_ADDRESS 'h000000e0 -#define BT_PIN_PAD_PULL_MSB 3 -#define BT_PIN_PAD_PULL_LSB 2 -#define BT_PIN_PAD_PULL_MASK 'h0000000c -#define BT_PIN_PAD_PULL_GET(x) (((x) & BT_PIN_PAD_PULL_MASK) >> BT_PIN_PAD_PULL_LSB) -#define BT_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << BT_PIN_PAD_PULL_LSB) & BT_PIN_PAD_PULL_MASK) -#define BT_PIN_PAD_PULL_RESET 2'h0 -#define BT_PIN_PAD_STRENGTH_MSB 1 -#define BT_PIN_PAD_STRENGTH_LSB 0 -#define BT_PIN_PAD_STRENGTH_MASK 'h00000003 -#define BT_PIN_PAD_STRENGTH_GET(x) (((x) & BT_PIN_PAD_STRENGTH_MASK) >> BT_PIN_PAD_STRENGTH_LSB) -#define BT_PIN_PAD_STRENGTH_SET(x) (((32'd0 | (x)) << BT_PIN_PAD_STRENGTH_LSB) & BT_PIN_PAD_STRENGTH_MASK) -#define BT_PIN_PAD_STRENGTH_RESET 2'h1 -#define BT_PIN_RESET (32'h0 | \ - BT_PIN_PAD_PULL_SET(BT_PIN_PAD_PULL_RESET) | \ - BT_PIN_PAD_STRENGTH_SET(BT_PIN_PAD_STRENGTH_RESET)) -#define BT_PIN_HW_MASK (32'h0) -#define BT_PIN_SW_MASK (32'h0 | \ - BT_PIN_PAD_PULL_MASK | \ - BT_PIN_PAD_STRENGTH_MASK) - -#define BT_WLAN_PIN_ADDRESS 'h000000e4 -#define BT_WLAN_PIN_PAD_PULL_MSB 1 -#define BT_WLAN_PIN_PAD_PULL_LSB 0 -#define BT_WLAN_PIN_PAD_PULL_MASK 'h00000003 -#define BT_WLAN_PIN_PAD_PULL_GET(x) (((x) & BT_WLAN_PIN_PAD_PULL_MASK) >> BT_WLAN_PIN_PAD_PULL_LSB) -#define BT_WLAN_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << BT_WLAN_PIN_PAD_PULL_LSB) & BT_WLAN_PIN_PAD_PULL_MASK) -#define BT_WLAN_PIN_PAD_PULL_RESET 2'h2 -#define BT_WLAN_PIN_RESET (32'h0 | \ - BT_WLAN_PIN_PAD_PULL_SET(BT_WLAN_PIN_PAD_PULL_RESET)) -#define BT_WLAN_PIN_HW_MASK (32'h0) -#define BT_WLAN_PIN_SW_MASK (32'h0 | \ - BT_WLAN_PIN_PAD_PULL_MASK) - -#define SI_UART_PIN_ADDRESS 'h000000e8 -#define SI_UART_PIN_PAD_PULL_MSB 3 -#define SI_UART_PIN_PAD_PULL_LSB 2 -#define SI_UART_PIN_PAD_PULL_MASK 'h0000000c -#define SI_UART_PIN_PAD_PULL_GET(x) (((x) & SI_UART_PIN_PAD_PULL_MASK) >> SI_UART_PIN_PAD_PULL_LSB) -#define SI_UART_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << SI_UART_PIN_PAD_PULL_LSB) & SI_UART_PIN_PAD_PULL_MASK) -#define SI_UART_PIN_PAD_PULL_RESET 2'h1 -#define SI_UART_PIN_PAD_STRENGTH_MSB 1 -#define SI_UART_PIN_PAD_STRENGTH_LSB 0 -#define SI_UART_PIN_PAD_STRENGTH_MASK 'h00000003 -#define SI_UART_PIN_PAD_STRENGTH_GET(x) (((x) & SI_UART_PIN_PAD_STRENGTH_MASK) >> SI_UART_PIN_PAD_STRENGTH_LSB) -#define SI_UART_PIN_PAD_STRENGTH_SET(x) (((32'd0 | (x)) << SI_UART_PIN_PAD_STRENGTH_LSB) & SI_UART_PIN_PAD_STRENGTH_MASK) -#define SI_UART_PIN_PAD_STRENGTH_RESET 2'h1 -#define SI_UART_PIN_RESET (32'h0 | \ - SI_UART_PIN_PAD_PULL_SET(SI_UART_PIN_PAD_PULL_RESET) | \ - SI_UART_PIN_PAD_STRENGTH_SET(SI_UART_PIN_PAD_STRENGTH_RESET)) -#define SI_UART_PIN_HW_MASK (32'h0) -#define SI_UART_PIN_SW_MASK (32'h0 | \ - SI_UART_PIN_PAD_PULL_MASK | \ - SI_UART_PIN_PAD_STRENGTH_MASK) - -#define CLK32K_PIN_ADDRESS 'h000000ec -#define CLK32K_PIN_PAD_PULL_MSB 1 -#define CLK32K_PIN_PAD_PULL_LSB 0 -#define CLK32K_PIN_PAD_PULL_MASK 'h00000003 -#define CLK32K_PIN_PAD_PULL_GET(x) (((x) & CLK32K_PIN_PAD_PULL_MASK) >> CLK32K_PIN_PAD_PULL_LSB) -#define CLK32K_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << CLK32K_PIN_PAD_PULL_LSB) & CLK32K_PIN_PAD_PULL_MASK) -#define CLK32K_PIN_PAD_PULL_RESET 2'h0 -#define CLK32K_PIN_RESET (32'h0 | \ - CLK32K_PIN_PAD_PULL_SET(CLK32K_PIN_PAD_PULL_RESET)) -#define CLK32K_PIN_HW_MASK (32'h0) -#define CLK32K_PIN_SW_MASK (32'h0 | \ - CLK32K_PIN_PAD_PULL_MASK) - -#define RESET_TUPLE_STATUS_ADDRESS 'h000000f0 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MSB 11 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB 8 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK 'h00000f00 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_GET(x) (((x) & RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK) >> RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB) -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_SET(x) (((32'd0 | (x)) << RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB) & RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK) -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_RESET 4'h0 -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MSB 7 -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB 0 -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK 'h000000ff -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_GET(x) (((x) & RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK) >> RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB) -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_SET(x) (((32'd0 | (x)) << RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB) & RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK) -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_RESET 8'h0 -#define RESET_TUPLE_STATUS_RESET (32'h0 | \ - RESET_TUPLE_STATUS_TEST_RESET_TUPLE_SET(RESET_TUPLE_STATUS_TEST_RESET_TUPLE_RESET) | \ - RESET_TUPLE_STATUS_PIN_RESET_TUPLE_SET(RESET_TUPLE_STATUS_PIN_RESET_TUPLE_RESET)) -#define RESET_TUPLE_STATUS_HW_MASK (32'h0 | \ - RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK | \ - RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK) -#define RESET_TUPLE_STATUS_SW_MASK (32'h0) - -#define GPIO_REG_ADDRESS_MSB 7 - -#endif /* _GPIO_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/mac_pcu.h b/drivers/net/wireless/ar6003/include/AR6002/hw/mac_pcu.h deleted file mode 100644 index 6a07583b91b8..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/mac_pcu.h +++ /dev/null @@ -1,980 +0,0 @@ -#ifndef _MAC_PCU_H -#define _MAC_PCU_H - -#define FIFO_BOUND 1024 - -#define CLK32_TIMER0 0 -#define CLK32_TIMER1 1 -#define CLK32_TIMER2 2 -#define CLK32_TIMER3 3 -#define CLK32_TSF_L32 4 -#define CLK32_TSF_U32 5 -#define CLK32_SLP1 6 -#define CLK32_SLP2 7 -#define CLK32_SLP3 8 -#define CLK32_QT1 9 -#define CLK32_QT2 10 -//#define CLK32_TSFCAL 11 - -//#define CLK_S_SYNC1 0 -//#define CLK_S_SYNC6 1 -//#define CLK_S_SYNC7 2 -//#define CLK_S_SYNC8 3 - -#define KTYPE_40 0 -#define KTYPE_104 1 -#define KTYPE_TKIP_NO_MIC 2 -#define KTYPE_128 3 -#define KTYPE_TKIP 4 -//#define KTYPE_AES_OCB 5 -#define KTYPE_WAPI 5 -#define KTYPE_AES_CCM 6 -#define KTYPE_NOTHING 7 - -//Frame Type in Descriptor -#define TXDESC_FT_NORMAL 0 -#define TXDESC_FT_ATIM 1 -#define TXDESC_FT_PS_POLL 2 -#define TXDESC_FT_BEACON 3 -#define TXDESC_FT_PROBE_RESP 4 -#define TXDESC_FT_CHIRP 5 -#define TXDESC_FT_GROUP_POLL 6 -#define TXDESC_FT_DIRECT_POLL 7 -//#define TXDESC_FT_SYNC 8 -#define TXDESC_FT_BEACON_NO_TSF_UPDATE 9 - -//Frame Type: Management -#define FTYPE_ASSOCIATION_REQ 0x00 -#define FTYPE_ASSOCIATION_RES 0x04 -#define FTYPE_REASSOCIATION_REQ 0x08 -#define FTYPE_REASSOCIATION_RES 0x0c -#define FTYPE_PBREQ 0x10 // change to TYPE_PROBE_REQ TBD -#define FTYPE_PBRES 0x14 // change to TYPE_PROBE_RES TBD -#define FTYPE_BEACON 0x20 -#define FTYPE_ATIM 0x24 -#define FTYPE_DISASSOCIATE 0x28 -#define FTYPE_AUTHENICATE 0x2c -#define FTYPE_DEAUTHENICATE 0x30 - -//Frame Type: Control -#define FTYPE_PSPOLL 0x29 -#define FTYPE_RTS 0x2d -#define FTYPE_CTS 0x31 -#define FTYPE_ACK 0x35 -#define FTYPE_CFEND 0x39 -#define FTYPE_CFEND_ACK 0x3d // change to FTYPE_CFEND_ACK TBD - -//Frame Type: Data -#define FTYPE_DATA 0x02 -#define FTYPE_DATA_CFACK 0x06 -#define FTYPE_DATA_CFPOLL 0x0a -#define FTYPE_DATA_CFACK_CFPOLL 0x0e -#define FTYPE_NULL 0x12 -#define FTYPE_CFACK 0x16 -#define FTYPE_CFPOLL 0x1a -#define FTYPE_CFACK_CFPOLL 0x1e - -//Frame Control Fields -#define FCTL_TO_DS 8 -#define FCTL_FROM_DS 9 -#define FCTL_MORE_FRAG 10 -#define FCTL_RETRY 11 -#define FCTL_POWER_MGNT 12 -#define FCTL_MORE_DATA 13 -#define FCTL_WEP 14 -#define FCTL_TYPE 3:2 - -//Rate -#define OFDM_RATE_6Mb 0x0b -#define OFDM_RATE_9Mb 0x0f -#define OFDM_RATE_12Mb 0x0a -#define OFDM_RATE_18Mb 0x0e -#define OFDM_RATE_24Mb 0x09 -#define OFDM_RATE_36Mb 0x0d -#define OFDM_RATE_48Mb 0x08 -#define OFDM_RATE_54Mb 0x0c -#define CCK_RATE_1Mb_L 0x1b -#define CCK_RATE_2Mb_L 0x1a -#define CCK_RATE_2Mb_S 0x1e -#define CCK_RATE_5_5Mb_L 0x19 -#define CCK_RATE_5_5Mb_S 0x1d -#define CCK_RATE_11Mb_L 0x18 - -#define CCK_RATE_11Mb_S 0x1c -#define XR_RATE_0_25Mb 0x03 -#define XR_RATE_0_5Mb 0x07 -#define XR_RATE_1Mb 0x02 -#define XR_RATE_2Mb 0x06 -#define XR_RATE_3Mb 0x01 - -//Registers -#define PCU_REG 0x0 -#define KEY_REG 0x1 -#define D2A2_REG 0x3 - -#define REG_STA_ID0 0x0 -#define STA_ADDR_L32 31:0 - -#define REG_STA_ID1 0x1 -#define STA_ADDR_U16 15:0 -#define AP 16 -#define ADHOC 17 -#define PWR_SV 18 -#define NO_KEYSRCH 19 -#define PCF 20 -#define USE_DEF_ANT 21 -#define DEF_ANT_UPDATE 22 -#define RTS_DEF_ANT 23 -#define ACKCTS_6MB 24 -#define RATE_11B 25 -#define SECTOR_SELF_GEN 26 -#define CRPT_MIC_ENABLE 27 -#define KSRCH_MODE 28 -#define PRESERVE_SEQNUM 29 -#define CBCIV_ENDIAN 30 -#define ADHOC_MCAST_SEARCH 31 - -#define REG_BSS_ID0 0x2 -#define BSSID_L32 31:0 - -#define REG_BSS_ID1 0x3 -#define BSSID_U16 15:0 -#define AID 31:16 - -#define MAC_PCU_REG_BCNRSSI_OFFSET 0x4 -#define MAC_PCU_REG_BCNRSSI_BCN_RSSI_AVE_FIELD 11:0 -#define MAC_PCU_REG_BCNRSSI_BCN_RSSI_AVE_RESET 0x800 - -#define REG_TIME_OUT 0x5 -#define ACK_TIME_OUT 15:0 -#define CTS_TIME_OUT 31:16 - -#define MAC_PCU_REG_BCNSIG_OFFSET 0x6 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_LO_THR_FIELD 7:0 -#define MAC_PCU_REG_BCNSIG_BCN_MISS_THR_FIELD 15:8 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_HI_THR_FIELD 23:16 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_WEIGHT_FIELD 28:24 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_RESET_FIELD 29 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_LO_THR_RESET 0 -#define MAC_PCU_REG_BCNSIG_BCN_MISS_THR_RESET 0xFF -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_HI_THR_RESET 0x7F -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_WEIGHT_RESET 0 - -#define REG_USEC 0x7 -#define USEC 6:0 -#define USEC32 13:7 -#define TX_DELAY 18:14 -#define RX_DELAY 24:19 - -#define REG_BEACON 0x8 -#define BEACON_PERIOD 15:0 -#define TIM_OFFSET 22:16 -#define RESET_TSF 24 - -#define REG_CFP_PERIOD 0x9 - -#define REG_TIMER0 0xa - -#define REG_TIMER1 0xb - -#define REG_TIMER2 0xc - -#define REG_TIMER3 0xd - -#define REG_CFP_DUR 0xe - -#define REG_RX_FILTER 0xf -#define UNICAST 0 -#define MULTICAST 1 -#define BROADCAST 2 -#define CONTROL 3 -#define BEACON 4 -#define PROMISCUOUS 5 -#define XR_POLL 6 -#define PROBE_REQ 7 -//#define SYNC 8 -#define MY_BEACON 9 - -#define REG_MCAST_FIL0 0x10 - -#define REG_MCAST_FIL1 0x11 - -#define MAC_PCU_REG_DIAGSW_OFFSET 0x12 -#define MAC_PCU_REG_DIAGSW_DIS_WEP_ACK_FIELD 0 -#define MAC_PCU_REG_DIAGSW_DIS_ACK_FIELD 1 -#define MAC_PCU_REG_DIAGSW_DIS_CTS_FIELD 2 -#define MAC_PCU_REG_DIAGSW_DIS_ENC_FIELD 3 -#define MAC_PCU_REG_DIAGSW_DIS_DEC_FIELD 4 -#define MAC_PCU_REG_DIAGSW_DIS_RX_FIELD 5 -#define MAC_PCU_REG_DIAGSW_LOOP_BACK_FIELD 6 -#define MAC_PCU_REG_DIAGSW_CORR_FCS_FIELD 7 -#define MAC_PCU_REG_DIAGSW_CHAN_INFO_FIELD 8 -#define MAC_PCU_REG_DIAGSW_RESERVED_FIELD 16:9 -#define MAC_PCU_REG_DIAGSW_ACCEPT_NONV0_FIELD 17 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_0_1_FIELD 19:18 -#define MAC_PCU_REG_DIAGSW_RXCLR_HIGH_FIELD 20 -#define MAC_PCU_REG_DIAGSW_IGNORE_NAV_FIELD 21 -#define MAC_PCU_REG_DIAGSW_CHANIDLE_HIGH_FIELD 22 -#define MAC_PCU_REG_DIAGSW_PHYERR_ENABLE_NEW_FIELD 23 -#define MAC_PCU_REG_DIAGSW_DUAL_CHAIN_CHAN_INFO_FIELD 24 -#define MAC_PCU_REG_DIAGSW_FORCE_RX_ABORT_FIELD 25 -#define MAC_PCU_REG_DIAGSW_SATURATE_CYCLE_CNT_FIELD 26 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_2_FIELD 27 -#define MAC_PCU_REG_DIAGSW_DIS_WEP_ACK_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_ACK_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_CTS_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_ENC_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_DEC_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_RX_RESET 0 -#define MAC_PCU_REG_DIAGSW_LOOP_BACK_RESET 0 -#define MAC_PCU_REG_DIAGSW_CORR_FCS_RESET 0 -#define MAC_PCU_REG_DIAGSW_CHAN_INFO_RESET 0 -#define MAC_PCU_REG_DIAGSW_RESERVED_RESET 0 -#define MAC_PCU_REG_DIAGSW_ACCEPT_NONV0_RESET 0 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_0_1_RESET 0 -#define MAC_PCU_REG_DIAGSW_RXCLR_HIGH_RESET 0 -#define MAC_PCU_REG_DIAGSW_IGNORE_NAV_RESET 0 -#define MAC_PCU_REG_DIAGSW_CHANIDLE_HIGH_RESET 0 -#define MAC_PCU_REG_DIAGSW_PHYERR_ENABLE_NEW_RESET 0 -#define MAC_PCU_REG_DIAGSW_DUAL_CHAIN_CHAN_INFO_RESET 0 -#define MAC_PCU_REG_DIAGSW_FORCE_RX_ABORT_RESET 0 -#define MAC_PCU_REG_DIAGSW_SATURATE_CYCLE_CNT_RESET 0 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_2_RESET 0 - -#define REG_TSF_L32 0x13 - -#define REG_TSF_U32 0x14 - -#define REG_TST_ADDAC 0x15 -#define TEST_MODE 0 -#define TEST_LOOP 1 -#define LOOP_LEN 12:2 -#define TEST_UPPER_8B 13 -#define TEST_MSB 14 -#define TEST_CAPTURE 15 - -#define REG_DEF_ANT 0x16 - -#define MAC_PCU_REG_MUTE_MASKS0_OFFSET 0x17 -#define MAC_PCU_REG_MUTE_MASKS0_FC_FIELD 15:0 -#define MAC_PCU_REG_MUTE_MASKS0_QOS_FIELD 31:16 -#define MAC_PCU_REG_MUTE_MASKS0_FC_RESET 0xC7FF -#define MAC_PCU_REG_MUTE_MASKS0_QOS_RESET 0xFFFF - -#define MAC_PCU_REG_MUTE_MASKS1_OFFSET 0x18 -#define MAC_PCU_REG_MUTE_MASKS1_SEQ_FIELD 15:0 -#define MAC_PCU_REG_MUTE_MASKS1_FC_MGMT_FIELD 31:16 -#define MAC_PCU_REG_MUTE_MASKS1_SEQ_RESET 0x000F -#define MAC_PCU_REG_MUTE_MASKS1_FC_MGMT_RESET 0xE7FF - -#define MAC_PCU_REG_GATED_CLKS_OFFSET 0x19 -//#define MAC_PCU_REG_GATED_SYNC_FIELD 0 -#define MAC_PCU_REG_GATED_TX_FIELD 1 -#define MAC_PCU_REG_GATED_RX_FIELD 2 -#define MAC_PCU_REG_GATED_REG_FIELD 3 -//#define MAC_PCU_REG_GATED_SYNC_RESET 0x1 -#define MAC_PCU_REG_GATED_TX_RESET 0x0 -#define MAC_PCU_REG_GATED_RX_RESET 0x0 -#define MAC_PCU_REG_GATED_REG_RESET 0x0 - -#define MAC_PCU_REG_OBS2_OFFSET 0x1a -#define MAC_PCU_REG_OBS2_OBS_BUS_FIELD 17:0 - -#define MAC_PCU_REG_OBS1_OFFSET 0x1b -#define MAC_PCU_REG_OBS1_TX_STATE_FIELD 28:24 -#define MAC_PCU_REG_OBS1_RX_STATE_FIELD 23:20 -#define MAC_PCU_REG_OBS1_WEP_STATE_FIELD 17:12 -#define MAC_PCU_REG_OBS1_RX_CLEAR_FIELD 11 -#define MAC_PCU_REG_OBS1_RX_FRAME_FIELD 10 -#define MAC_PCU_REG_OBS1_TX_FRAME_FIELD 9 -#define MAC_PCU_REG_OBS1_TX_HOLD_FIELD 8 -#define MAC_PCU_REG_OBS1_CHAN_IDLE_FIELD 7 -#define MAC_PCU_REG_OBS1_QUIET_TIME_FIELD 6 -#define MAC_PCU_REG_OBS1_TX_HCF_FIELD 5 -#define MAC_PCU_REG_OBS1_FILTER_PASS_FIELD 4 -#define MAC_PCU_REG_OBS1_RX_MY_BEACON_FIELD 3 -#define MAC_PCU_REG_OBS1_RX_WEP_FIELD 2 -#define MAC_PCU_REG_OBS1_PCU_RX_END_FIELD 1 -#define MAC_PCU_REG_OBS1_PCU_DIRECTED_FIELD 0 - -#define REG_LAST_TSTP 0x20 - -#define REG_NAV 0x21 - -#define REG_RTS_OK 0x22 - -#define REG_RTS_FAIL 0x23 - -#define REG_ACK_FAIL 0x24 - -#define REG_FCS_FAIL 0x25 - -#define REG_BEACON_CNT 0x26 - -#define MAC_PCU_REG_XRMODE_OFFSET 0x30 -#define MAC_PCU_REG_XRMODE_XR_POLL_TYPE_FIELD 5:0 -#define MAC_PCU_REG_XRMODE_XR_WAIT_FOR_POLL_FIELD 7 -#define MAC_PCU_REG_XRMODE_XR_FRAME_HOLD_FIELD 31:20 -#define MAC_PCU_REG_XRMODE_XR_POLL_TYPE_RESET 0x1A -#define MAC_PCU_REG_XRMODE_XR_WAIT_FOR_POLL_RESET 0x0 -#define MAC_PCU_REG_XRMODE_XR_FRAME_HOLD_RESET 680 - -#define MAC_PCU_REG_XRDEL_OFFSET 0x31 -#define MAC_PCU_REG_XRDEL_XR_SLOT_DELAY_FIELD 15:0 -#define MAC_PCU_REG_XRDEL_XR_CHIRP_DATA_DELAY_FIELD 31:16 -#define MAC_PCU_REG_XRDEL_XR_SLOT_DELAY_RESET 360 -#define MAC_PCU_REG_XRDEL_XR_CHIRP_DATA_DELAY_RESET 1680 - -#define MAC_PCU_REG_XRTO_OFFSET 0x32 -#define MAC_PCU_REG_XRTO_XR_CHIRP_TIMEOUT_FIELD 15:0 -#define MAC_PCU_REG_XRTO_XR_POLL_TIMEOUT_FIELD 31:16 -#define MAC_PCU_REG_XRTO_XR_CHIRP_TIMEOUT_RESET 7200 -#define MAC_PCU_REG_XRTO_XR_POLL_TIMEOUT_RESET 5000 - -#define MAC_PCU_REG_XRCRP_OFFSET 0x33 -#define MAC_PCU_REG_XRCRP_XR_SEND_CHIRP_FIELD 0 -#define MAC_PCU_REG_XRCRP_XR_CHIRP_GAP_FIELD 31:16 -#define MAC_PCU_REG_XRCRP_XR_SEND_CHIRP_RESET 0x0 -#define MAC_PCU_REG_XRCRP_XR_CHIRP_GAP_RESET 500 - -#define MAC_PCU_REG_XRSTMP_OFFSET 0x34 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_FIELD 0 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_BSSID_FIELD 1 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_FIELD 2 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_BSSID_FIELD 3 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_DATA_FIELD 4 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_DATA_FIELD 5 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_THRESH_FIELD 15:8 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_THRESH_FIELD 23:16 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_RESET 0x0 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_BSSID_RESET 0x0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_RESET 0x0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_BSSID_RESET 0x0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_DATA_RESET 0x0 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_DATA_RESET 0x0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_THRESH_RESET 0x25 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_THRESH_RESET 0x25 - -#define MAC_PCU_REG_SLP1_OFFSET 0x35 -//#define MAC_PCU_REG_SLP1_NEXT_DTIM_FIELD 18:0 -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_EXT_FIELD 4:0 -#define MAC_PCU_REG_SLP1_ASSUME_DTIM_FIELD 19 -//#define MAC_PCU_REG_SLP1_ENH_SLEEP_ENABLE_FIELD 20 -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_FIELD 31:21 -// #define MAC_PCU_REG_SLP1_NEXT_DTIM_RESET 0x2aaaa -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_EXT_RESET 0x0 -#define MAC_PCU_REG_SLP1_ASSUME_DTIM_RESET 0x0 -//#define MAC_PCU_REG_SLP1_ENH_SLEEP_ENABLE_RESET 0x1 -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_RESET 5 - -#define MAC_PCU_REG_SLP2_OFFSET 0x36 -//#define MAC_PCU_REG_SLP2_NEXT_TIM_FIELD 18:0 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_EXT_FIELD 4:0 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_FIELD 31:21 -//#define MAC_PCU_REG_SLP2_NEXT_TIM_RESET 0x55555 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_EXT_RESET 0x0 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_RESET 2 - -//#define MAC_PCU_REG_SLP3_OFFSET 0x37 -//#define MAC_PCU_REG_SLP3_TIM_PERIOD_FIELD 15:0 -//#define MAC_PCU_REG_SLP3_DTIM_PERIOD_FIELD 31:16 -//#define MAC_PCU_REG_SLP3_TIM_PERIOD_RESET 2 -//#define MAC_PCU_REG_SLP3_DTIM_PERIOD_RESET 3 - -#define MAC_PCU_REG_BSSMSKL_OFFSET 0x38 -#define MAC_PCU_REG_BSSMSKL_BSSID_MASK_L_FIELD 31:0 -#define MAC_PCU_REG_BSSMSKL_BSSID_MASK_L_RESET 0xFFFFFFFF - -#define MAC_PCU_REG_BSSMSKH_OFFSET 0x39 -#define MAC_PCU_REG_BSSMSKH_BSSID_MASK_H_FIELD 15:0 -#define MAC_PCU_REG_BSSMSKH_BSSID_MASK_H_RESET 0xFFFF - -#define MAC_PCU_REG_TPC_OFFSET 0x3A -#define MAC_PCU_REG_TPC_ACK_PWR_FIELD 5:0 -#define MAC_PCU_REG_TPC_CTS_PWR_FIELD 13:8 -#define MAC_PCU_REG_TPC_CHIRP_PWR_FIELD 21:16 -#define MAC_PCU_REG_TPC_ACK_PWR_RESET 0x3f -#define MAC_PCU_REG_TPC_CTS_PWR_RESET 0x3f -#define MAC_PCU_REG_TPC_CHIRP_PWR_RESET 0x3f - -#define MAC_PCU_REG_TFC_OFFSET 0x3B -#define MAC_PCU_REG_TFC_TX_FRAME_CNT_FIELD 31:0 -#define MAC_PCU_REG_TFC_TX_FRAME_CNT_RESET 0 - -#define MAC_PCU_REG_RFC_OFFSET 0x3C -#define MAC_PCU_REG_RFC_RX_FRAME_CNT_FIELD 31:0 -#define MAC_PCU_REG_RFC_RX_FRAME_CNT_RESET 0 - -#define MAC_PCU_REG_RCC_OFFSET 0x3D -#define MAC_PCU_REG_RCC_RX_CLEAR_CNT_FIELD 31:0 -#define MAC_PCU_REG_RCC_RX_CLEAR_CNT_RESET 0 - -#define MAC_PCU_REG_CC_OFFSET 0x3E -#define MAC_PCU_REG_CC_CYCLE_CNT_FIELD 31:0 -#define MAC_PCU_REG_CC_CYCLE_CNT_RESET 0 - -#define MAC_PCU_REG_QT1_OFFSET 0x3F -#define MAC_PCU_REG_QT1_NEXT_QUIET_FIELD 15:0 -#define MAC_PCU_REG_QT1_QUIET_ENABLE_FIELD 16 -#define MAC_PCU_REG_QT1_QUIET_ACK_CTS_ENABLE_FIELD 17 -#define MAC_PCU_REG_QT1_NEXT_QUIET_RESET 0 -#define MAC_PCU_REG_QT1_QUIET_ENABLE_RESET 0x0 -#define MAC_PCU_REG_QT1_QUIET_ACK_CTS_ENABLE_RESET 0x1 - -#define MAC_PCU_REG_QT2_OFFSET 0x40 -#define MAC_PCU_REG_QT2_QUIET_PERIOD_FIELD 15:0 -#define MAC_PCU_REG_QT2_QUIET_DURATION_FIELD 31:16 -#define MAC_PCU_REG_QT2_QUIET_PERIOD_RESET 0002 -#define MAC_PCU_REG_QT2_QUIET_DURATION_RESET 0001 - -#define MAC_PCU_REG_TSF_OFFSET 0x41 -#define MAC_PCU_REG_TSF_INCREMENT_FIELD 7:0 -#define MAC_PCU_REG_TSF_INCREMENT_RESET 0x01 - -#define MAC_PCU_REG_NOACK_OFFSET 0x42 -#define MAC_PCU_REG_NOACK_2_BIT_VALUES_FIELD 3:0 -#define MAC_PCU_REG_NOACK_BIT_OFFSET_FIELD 6:4 -#define MAC_PCU_REG_NOACK_BYTE_OFFSET_FIELD 8:7 -#define MAC_PCU_REG_NOACK_2_BIT_VALUES_RESET 0x2 -#define MAC_PCU_REG_NOACK_BIT_OFFSET_RESET 0x5 -#define MAC_PCU_REG_NOACK_BYTE_OFFSET_RESET 0x0 - -#define MAC_PCU_REG_PHYERR_OFFSET 0x43 -#define MAC_PCU_REG_PHYERR_MASK_FIELD 31:0 -#define MAC_PCU_REG_PHYERR_MASK_RESET 0x0 - -#define MAC_PCU_REG_XRLAT_OFFSET 0x44 -#define MAC_PCU_REG_XRLAT_XR_TX_DELAY_FIELD 11:0 -#define MAC_PCU_REG_XRLAT_XR_TX_DELAY_RESET 0x168 - -#define MAC_PCU_REG_ACKSIFS_OFFSET_RESERVED 0x45 -#define MAC_PCU_REG_ACKSIFS_INCREMENT_FIELD_RESERVED 7:0 -#define MAC_PCU_REG_ACKSIFS_INCREMENT_RESET_RESERVED 0x0 - -#define MAC_PCU_REG_MICQOSCTL_OFFSET 0x46 -#define MAC_PCU_REG_MICQOSCTL_FIELD 15:0 -#define MAC_PCU_REG_MICQOSCTL_ENABLE_FIELD 16 -#define MAC_PCU_REG_MICQOSCTL_RESET 0x00aa -#define MAC_PCU_REG_MICQOSCTL_ENABLE_RESET 0x1 - -#define MAC_PCU_REG_MICQOSSEL_OFFSET 0x47 -#define MAC_PCU_REG_MICQOSSEL_FIELD 31:0 -#define MAC_PCU_REG_MICQOSSEL_RESET 0x00003210 - -#define MAC_PCU_REG_MISCMODE_OFFSET 0x48 -#define MAC_PCU_REG_MISCMODE_BSSID_MATCH_FORCE_FIELD 0 -#define MAC_PCU_REG_MISCMODE_ACKSIFS_MEMORY_FIELD_RESERVED 1 -#define MAC_PCU_REG_MISCMODE_MIC_NEW_LOCATION_FIELD 2 -#define MAC_PCU_REG_MISCMODE_TX_ADD_TSF_FIELD 3 -#define MAC_PCU_REG_MISCMODE_CCK_SIFS_MODE_FIELD 4 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MODE_FIELD_RESERVED 5 -#define MAC_PCU_REG_MISCMODE_BFCOEF_ENABLE_FIELD 6 -#define MAC_PCU_REG_MISCMODE_BFCOEF_UPDATE_SELF_GEN_FIELD 7 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MCAST_FIELD 8 -#define MAC_PCU_REG_MISCMODE_DUAL_CHAIN_ANT_MODE_FIELD 9 -#define MAC_PCU_REG_MISCMODE_FALCON_DESC_MODE_FIELD 10 -#define MAC_PCU_REG_MISCMODE_KC_RX_ANT_UPDATE_FIELD 11 -#define MAC_PCU_REG_MISCMODE_TXOP_TBTT_LIMIT_FIELD 12 -#define MAC_PCU_REG_MISCMODE_FALCON_BB_INTERFACE_FIELD 13 -#define MAC_PCU_REG_MISCMODE_MISS_BEACON_IN_SLEEP_FIELD 14 -#define MAC_PCU_REG_MISCMODE_BUG_12306_FIX_ENABLE_FIELD 17 -#define MAC_PCU_REG_MISCMODE_FORCE_QUIET_COLLISION_FIELD 18 -#define MAC_PCU_REG_MISCMODE_BUG_12549_FORCE_TXBF_FIELD 19 -#define MAC_PCU_REG_MISCMODE_BT_ANT_PREVENTS_RX_FIELD 20 -#define MAC_PCU_REG_MISCMODE_TBTT_PROTECT_FIELD 21 -#define MAC_PCU_REG_MISCMODE_HCF_POLL_CANCELS_NAV_FIELD 22 -#define MAC_PCU_REG_MISCMODE_RX_HCF_POLL_ENABLE_FIELD 23 -#define MAC_PCU_REG_MISCMODE_CLEAR_VMF_FIELD 24 -#define MAC_PCU_REG_MISCMODE_CLEAR_FIRST_HCF_FIELD 25 -#define MAC_PCU_REG_MISCMODE_ADHOC_MCAST_KEYID_ENABLE_FIELD 26 -#define MAC_PCU_REG_MISCMODE_ALLOW_RAC_FIELD 27 -#define MAC_PCU_REG_MISCMODE_BSSID_MATCH_FORCE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_ACKSIFS_MEMORY_RESET_RESERVED 0x0 -#define MAC_PCU_REG_MISCMODE_MIC_NEW_LOCATION_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_TX_ADD_TSF_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_CCK_SIFS_MODE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MODE_RESET_RESERVED 0x0 -#define MAC_PCU_REG_MISCMODE_BFCOEF_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_BFCOEF_UPDATE_SELF_GEN_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MCAST_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_DUAL_CHAIN_ANT_MODE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_FALCON_DESC_MODE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_KC_RX_ANT_UPDATE_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_TXOP_TBTT_LIMIT_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_FALCON_BB_INTERFACE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_MISS_BEACON_IN_SLEEP_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_BUG_12306_FIX_ENABLE_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_FORCE_QUIET_COLLISION_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_BUG_12549_FORCE_TXBF_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_BT_ANT_PREVENTS_RX_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_TBTT_PROTECT_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_HCF_POLL_CANCELS_NAV_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_RX_HCF_POLL_ENABLE_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_CLEAR_VMF_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_CLEAR_FIRST_HCF_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_ADHOC_MCAST_KEYID_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_ALLOW_RAC_RESET 0x0 - -#define MAC_PCU_REG_FILTOFDM_OFFSET 0x49 -#define MAC_PCU_REG_FILTOFDM_CNT_FIELD 23:0 -#define MAC_PCU_REG_FILTOFDM_CNT_RESET 0x0 - -#define MAC_PCU_REG_FILTCCK_OFFSET 0x4A -#define MAC_PCU_REG_FILTCCK_CNT_FIELD 23:0 -#define MAC_PCU_REG_FILTCCK_CNT_RESET 0x0 - -#define MAC_PCU_REG_PHYCNT1_OFFSET 0x4B -#define MAC_PCU_REG_PHYCNT1_FIELD 23:0 -#define MAC_PCU_REG_PHYCNT1_RESET 0x0 - -#define MAC_PCU_REG_PHYCNTMASK1_OFFSET 0x4C -#define MAC_PCU_REG_PHYCNTMASK1_FIELD 31:0 -#define MAC_PCU_REG_PHYCNTMASK1_RESET 0x0 - -#define MAC_PCU_REG_PHYCNT2_OFFSET 0x4D -#define MAC_PCU_REG_PHYCNT2_FIELD 23:0 -#define MAC_PCU_REG_PHYCNT2_RESET 0x0 - -#define MAC_PCU_REG_PHYCNTMASK2_OFFSET 0x4E -#define MAC_PCU_REG_PHYCNTMASK2_FIELD 31:0 -#define MAC_PCU_REG_PHYCNTMASK2_RESET 0x0 - -#define MAC_PCU_REG_TSFTHRESH_OFFSET 0x4F -#define MAC_PCU_REG_TSFTHRESH_FIELD 15:0 -#define MAC_PCU_REG_TSFTHRESH_RESET 0xFFFF - -//#define MAC_PCU_REG_TSFCAL_OFFSET 0x50 -//#define MAC_PCU_REG_TSFCAL_COUNT_FIELD 3:0 -//#define MAC_PCU_REG_TSFCAL_INTERVAL_FIELD 7:4 -//#define MAC_PCU_REG_TSFCAL_ENABLE_FIELD 8 -//#define MAC_PCU_REG_TSFCAL_AUTO_CAL_FIELD 9 -//#define MAC_PCU_REG_TSFCAL_VALUE_WE_FIELD 10 -//#define MAC_PCU_REG_TSFCAL_VALUE_FIELD 31:16 -//#define MAC_PCU_REG_TSFCAL_COUNT_RESET 0x8 -//#define MAC_PCU_REG_TSFCAL_INTERVAL_RESET 0xa -//#define MAC_PCU_REG_TSFCAL_ENABLE_RESET 0x1 -//#define MAC_PCU_REG_TSFCAL_AUTO_CAL_RESET 0x1 -//#define MAC_PCU_REG_TSFCAL_VALUE_WE_RESET 0x0 -//#define MAC_PCU_REG_TSFCAL_VALUE_RESET 0x8000 - -#define MAC_PCU_REG_PHYERR_EIFS_OFFSET 0x51 -#define MAC_PCU_REG_PHYERR_EIFS_MASK_FIELD 31:0 -#define MAC_PCU_REG_PHYERR_EIFS_MASK_RESET 0x0 - -//#define MAC_PCU_REG_SYNC1_OFFSET 0x52 -//#define MAC_PCU_REG_SYNC1_TIME_FIELD 30:0 -//#define MAC_PCU_REG_SYNC1_TIME_RESET 0x0 - -//#define MAC_PCU_REG_SYNC2_OFFSET 0x53 -//#define MAC_PCU_REG_SYNC2_TIME_OFFSET_FIELD 7:0 -//#define MAC_PCU_REG_SYNC2_MASTER_FIELD 8 -//#define MAC_PCU_REG_SYNC2_REPLACE_FIELD 9 -//#define MAC_PCU_REG_SYNC2_TUNE_FIELD 10 -//#define MAC_PCU_REG_SYNC2_CLEAR_FIELD 11 -//#define MAC_PCU_REG_SYNC2_INTR_THRESH_FIELD 31:16 -//#define MAC_PCU_REG_SYNC2_TIME_OFFSET_RESET 0x0 -//#define MAC_PCU_REG_SYNC2_MASTER_RESET 0x0 -//#define MAC_PCU_REG_SYNC2_REPLACE_RESET 0x0 -//#define MAC_PCU_REG_SYNC2_TUNE_RESET 0x0 -//#define MAC_PCU_REG_SYNC2_CLEAR_RESET 0x0 -//#define MAC_PCU_REG_SYNC2_INTR_THRESH_RESET 0xFFFF - -//#define MAC_PCU_REG_SYNC3_OFFSET 0x54 -//#define MAC_PCU_REG_SYNC3_MCAST_ADDR_L_FIELD 31:0 -//#define MAC_PCU_REG_SYNC3_MCAST_ADDR_L_RESET 0x0 - -//#define MAC_PCU_REG_SYNC4_OFFSET 0x55 -//#define MAC_PCU_REG_SYNC4_MCAST_ADDR_U_FIELD 15:0 -//#define MAC_PCU_REG_SYNC4_MCAST_ADDR_U_RESET 0x0 - -//#define MAC_PCU_REG_SYNC5_OFFSET 0x56 -//#define MAC_PCU_REG_SYNC5_RX_TIME_FIELD 30:0 - -//#define MAC_PCU_REG_SYNC6_OFFSET 0x57 -//#define MAC_PCU_REG_SYNC6_INC_FIELD 31:0 - -//#define MAC_PCU_REG_SYNC7_OFFSET 0x58 -//#define MAC_PCU_REG_SYNC7_LAST_TIME_FIELD 30:0 - -//#define MAC_PCU_REG_SYNC8_OFFSET 0x59 -//#define MAC_PCU_REG_SYNC8_UPDATED_TIME_FIELD 30:0 - -#define MAC_PCU_REG_PHYCNT3_OFFSET 0x5A -#define MAC_PCU_REG_PHYCNT3_FIELD 23:0 -#define MAC_PCU_REG_PHYCNT3_RESET 0x0 - -#define MAC_PCU_REG_PHYCNTMASK3_OFFSET 0x5B -#define MAC_PCU_REG_PHYCNTMASK3_FIELD 31:0 -#define MAC_PCU_REG_PHYCNTMASK3_RESET 0x0 - -#define MAC_PCU_REG_BTMODE_OFFSET 0x5C -#define MAC_PCU_REG_BTMODE_TIME_EXTEND_FIELD 7:0 -#define MAC_PCU_REG_BTMODE_TXSTATE_EXTEND_FIELD 8 -#define MAC_PCU_REG_BTMODE_TX_FRAME_EXTEND_FIELD 9 -#define MAC_PCU_REG_BTMODE_MODE_FIELD 11:10 -#define MAC_PCU_REG_BTMODE_QUIET_FIELD 12 -#define MAC_PCU_REG_BTMODE_QCU_THRESH_FIELD 16:13 -#define MAC_PCU_REG_BTMODE_RX_CLEAR_POLARITY_FIELD 17 -#define MAC_PCU_REG_BTMODE_PRIORITY_TIME_FIELD 23:18 -#define MAC_PCU_REG_BTMODE_FIRST_SLOT_TIME_FIELD 31:24 -#define MAC_PCU_REG_BTMODE_TIME_EXTEND_RESET 0x20 -#define MAC_PCU_REG_BTMODE_TXSTATE_EXTEND_RESET 0x1 -#define MAC_PCU_REG_BTMODE_TX_FRAME_EXTEND_RESET 0x1 -#define MAC_PCU_REG_BTMODE_MODE_RESET 0x3 -#define MAC_PCU_REG_BTMODE_QUIET_RESET 0x1 -#define MAC_PCU_REG_BTMODE_QCU_THRESH_RESET 0x1 -#define MAC_PCU_REG_BTMODE_RX_CLEAR_POLARITY_RESET 0x0 -#define MAC_PCU_REG_BTMODE_PRIORITY_TIME_RESET 0x05 -#define MAC_PCU_REG_BTMODE_FIRST_SLOT_TIME_RESET 0x9B - -#define MAC_PCU_REG_BTWEIGHT_OFFSET 0x5D -#define MAC_PCU_REG_BTWEIGHT_BT_WEIGHT_FIELD 15:0 -#define MAC_PCU_REG_BTWEIGHT_WL_WEIGHT_FIELD 31:16 -#define MAC_PCU_REG_BTWEIGHT_BT_WEIGHT_RESET 0xFA50 -#define MAC_PCU_REG_BTWEIGHT_WL_WEIGHT_RESET 0xFAA4 - -#define MAC_PCU_REG_HCF_OFFSET 0x5E -#define MAC_PCU_REG_HCF_TIMEOUT_FIELD 15:0 -#define MAC_PCU_REG_HCF_TIMEOUT_RESET 0x100 - -#define MAC_PCU_REG_BTMODE2_OFFSET 0x5F -#define MAC_PCU_REG_BTMODE2_BT_BCN_MISS_THRESH_FIELD 7:0 -#define MAC_PCU_REG_BTMODE2_BCN_MISS_CNT_FIELD 15:8 -#define MAC_PCU_REG_BTMODE2_BT_HOLD_RX_CLEAR_FIELD 16 -#define MAC_PCU_REG_BTMODE2_WL_CONTROL_ANT_FIELD 17 -#define MAC_PCU_REG_BTMODE2_RESPOND_TO_BT_ACTIVE_FIELD 18 -#define MAC_PCU_REG_BTMODE2_PROTECT_BT_AFTER_WAKEUP_FIELD 19 -#define MAC_PCU_REG_BTMODE2_DISABLE_BT_ANT_FIELD 20 -#define MAC_PCU_REG_BTMODE2_BT_BCN_MISS_THRESH_RESET 0 -#define MAC_PCU_REG_BTMODE2_BT_HOLD_RX_CLEAR_RESET 0 -#define MAC_PCU_REG_BTMODE2_WL_CONTROL_ANT_RESET 0x0 -#define MAC_PCU_REG_BTMODE2_RESPOND_TO_BT_ACTIVE_RESET 0x0 -#define MAC_PCU_REG_BTMODE2_PROTECT_BT_AFTER_WAKEUP_RESET 0x0 -#define MAC_PCU_REG_BTMODE2_DISABLE_BT_ANT_RESET 0x0 - -#define MAC_PCU_REG_BFCOEF1_OFFSET 0x60 -#define MAC_PCU_REG_BFCOEF1_UPPER_OFFSET 0x67 -#define MAC_PCU_REG_BFCOEF1_KEY_VALID_FIELD 31 -#define MAC_PCU_REG_BFCOEF1_KEYIDX_FIELD 30:24 -#define MAC_PCU_REG_BFCOEF1_TSF_FIELD 23:0 -#define MAC_PCU_REG_BFCOEF1_KEY_VALID_RESET 0x0 - -#define MAC_PCU_REG_BFCOEF2_OFFSET 0x70 -#define MAC_PCU_REG_BFCOEF2_THRESH_FIELD 22:0 -#define MAC_PCU_REG_BFCOEF2_LOCK_FIELD 31:24 -#define MAC_PCU_REG_BFCOEF2_THRESH_RESET 0x0 -#define MAC_PCU_REG_BFCOEF2_LOCK_RESET 0x0 - -#define MAC_PCU_REG_KCMASK_OFFSET 0x71 -#define MAC_PCU_REG_KCMASK_47_32_FIELD 15:0 -#define MAC_PCU_REG_KCMASK_47_32_RESET 0 -#define MAC_PCU_REG_KCMASK_31_0_FIELD 16 -#define MAC_PCU_REG_KCMASK_31_0_RESET 0 - -#define MAC_PCU_REG_TXSIFS_OFFSET 0x74 -#define MAC_PCU_REG_TXSIFS_SIFS_TIME_FIELD 7:0 -#define MAC_PCU_REG_TXSIFS_TX_LATENCY_FIELD 11:8 -#define MAC_PCU_REG_TXSIFS_ACK_SHIFT_FIELD 14:12 -#define MAC_PCU_REG_TXSIFS_SIFS_TIME_RESET 16 -#define MAC_PCU_REG_TXSIFS_TX_LATENCY_RESET 2 -#define MAC_PCU_REG_TXSIFS_ACK_SHIFT_RESET 3 - -#define MAC_PCU_REG_TXOP_X_OFFSET 0x7b -#define MAC_PCU_REG_TXOP_X_FIELD 7:0 -#define MAC_PCU_REG_TXOP_X_RESET 0 - -#define MAC_PCU_REG_TXOP_0_3_OFFSET 0x7c -#define MAC_PCU_REG_TXOP_0_FIELD 7:0 -#define MAC_PCU_REG_TXOP_1_FIELD 15:8 -#define MAC_PCU_REG_TXOP_2_FIELD 23:16 -#define MAC_PCU_REG_TXOP_3_FIELD 31:24 -#define MAC_PCU_REG_TXOP_0_RESET 0 -#define MAC_PCU_REG_TXOP_1_RESET 0 -#define MAC_PCU_REG_TXOP_2_RESET 0 -#define MAC_PCU_REG_TXOP_3_RESET 0 - -#define MAC_PCU_REG_TXOP_4_7_OFFSET 0x7d -#define MAC_PCU_REG_TXOP_4_FIELD 7:0 -#define MAC_PCU_REG_TXOP_5_FIELD 15:8 -#define MAC_PCU_REG_TXOP_6_FIELD 23:16 -#define MAC_PCU_REG_TXOP_7_FIELD 31:24 -#define MAC_PCU_REG_TXOP_4_RESET 0 -#define MAC_PCU_REG_TXOP_5_RESET 0 -#define MAC_PCU_REG_TXOP_6_RESET 0 -#define MAC_PCU_REG_TXOP_7_RESET 0 - -#define MAC_PCU_REG_TXOP_8_11_OFFSET 0x7e -#define MAC_PCU_REG_TXOP_8_FIELD 7:0 -#define MAC_PCU_REG_TXOP_9_FIELD 15:8 -#define MAC_PCU_REG_TXOP_10_FIELD 23:16 -#define MAC_PCU_REG_TXOP_11_FIELD 31:24 -#define MAC_PCU_REG_TXOP_8_RESET 0 -#define MAC_PCU_REG_TXOP_9_RESET 0 -#define MAC_PCU_REG_TXOP_10_RESET 0 -#define MAC_PCU_REG_TXOP_11_RESET 0 - -#define MAC_PCU_REG_TXOP_12_15_OFFSET 0x7f -#define MAC_PCU_REG_TXOP_12_FIELD 7:0 -#define MAC_PCU_REG_TXOP_13_FIELD 15:8 -#define MAC_PCU_REG_TXOP_14_FIELD 23:16 -#define MAC_PCU_REG_TXOP_15_FIELD 31:24 -#define MAC_PCU_REG_TXOP_12_RESET 0 -#define MAC_PCU_REG_TXOP_13_RESET 0 -#define MAC_PCU_REG_TXOP_14_RESET 0 -#define MAC_PCU_REG_TXOP_15_RESET 0 - -#define MAC_PCU_REG_GNRCTMR_N_OFFSET 0x80 -#define MAC_PCU_REG_GNRCTMR_N_UPPER_OFFSET 0x87 -#define MAC_PCU_REG_GNRCTMR_N_FIELD 31:0 - -#define MAC_PCU_REG_GNRCTMR_P_OFFSET 0x88 -#define MAC_PCU_REG_GNRCTMR_P_UPPER_OFFSET 0x8F -#define MAC_PCU_REG_GNRCTMR_P_FIELD 27:0 - -#define MAC_PCU_REG_GNRCTMR_M_OFFSET 0x90 -#define MAC_PCU_REG_GNRCTMR_M_ENABLE_FIELD 7:0 -#define MAC_PCU_REG_GNRCTMR_M_OVERFLOW_INDEX_FIELD 10:8 -#define MAC_PCU_REG_GNRCTMR_M_THRESH_FIELD 31:12 -#define MAC_PCU_REG_GNRCTMR_M_ENABLE_RESET 0x0 -#define MAC_PCU_REG_GNRCTMR_M_THRESH_RESET 0x00100 - -#define MAC_PCU_REG_SLP32_MODE_OFFSET 0x91 -#define MAC_PCU_REG_SLP32_MODE_HALF_CLK_LATENCY_FIELD 19:0 -#define MAC_PCU_REG_SLP32_MODE_ENABLE_FIELD 20 -#define MAC_PCU_REG_SLP32_MODE_TSF_WRITE_STAT_FIELD 21 -#define MAC_PCU_REG_SLP32_MODE_HALF_CLK_LATENCY_RESET 0x0F424 -#define MAC_PCU_REG_SLP32_MODE_ENABLE_RESET 0x1 - -#define MAC_PCU_REG_SLP32_WAKE_OFFSET 0x92 -#define MAC_PCU_REG_SLP32_WAKE_XTL_TIME_FIELD 15:0 -#define MAC_PCU_REG_SLP32_WAKE_XTL_TIME_RESET 0x07EF - -#define MAC_PCU_REG_SLP32_TSF_INC_OFFSET 0x93 -#define MAC_PCU_REG_SLP32_TSF_INC_FIELD 19:0 -#define MAC_PCU_REG_SLP32_TSF_INC_RESET 0x1E848 - -#define MAC_PCU_REG_SLPMIB1_OFFSET 0x94 -#define MAC_PCU_REG_SLPMIB1_SLEEP_CNT_FIELD 31:0 - -#define MAC_PCU_REG_SLPMIB2_OFFSET 0x95 -#define MAC_PCU_REG_SLPMIB2_CYCLE_CNT_FIELD 31:0 - -#define MAC_PCU_REG_SLPMIB3_OFFSET 0x96 -#define MAC_PCU_REG_SLPMIB3_CLR_CNT_FIELD 0 -#define MAC_PCU_REG_SLPMIB3_PEND_FIELD 1 - -#define MAC_PCU_REG_MISCMODE2_OFFSET 0x97 -#define MAC_PCU_REG_MISCMODE2_MGMT_CRYPTO_ENABLE_FIELD 0 -#define MAC_PCU_REG_MISCMODE2_NO_CRYPTO_FOR_NON_DATA_PKT_FIELD 1 -#define MAC_PCU_REG_MISCMODE2_MGMT_QOS_FIELD 15:8 -#define MAC_PCU_REG_MISCMODE2_BC_MC_WAPI_MODE_FIELD 16 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_FOR_1ST_PKT_FIELD 17 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_IF_ZERO_FIELD 18 -#define MAC_PCU_REG_MISCMODE2_MGMT_CRYPTO_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE2_NO_CRYPTO_FOR_NON_DATA_PKT_RESET 0x0 -#define MAC_PCU_REG_MISCMODE2_MGMT_QOS_RESET 0x10 -#define MAC_PCU_REG_MISCMODE2_BC_MC_WAPI_MODE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_FOR_1ST_PKT_RESET 0x0 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_IF_ZERO_RESET 0x0 - -#define MAC_PCU_REG_SLP4_OFFSET 0x98 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_DUR_FIELD 15:0 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_ENABLE_FIELD 16 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_DUR_RESET 0x5 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_ENABLE_RESET 0x0 - -#define MAC_PCU_REG_SLP5_OFFSET 0x99 -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_FIELD 23:0 -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_ENABLE_FIELD 24 -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_RESET 0xff_ffff -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_ENABLE_RESET 0x0 - -#define MAC_PCU_REG_MCICTL_OFFSET 0x9a -#define MAC_PCU_REG_MCICTL_MCI_ENABLE_FIELD 0 -#define MAC_PCU_REG_MCICTL_OLA_ENABLE_FIELD 1 -#define MAC_PCU_REG_MCICTL_PREEMPT_ENABLE_FIELD 2 -#define MAC_PCU_REG_MCICTL_CHANNEL_BUSY_ENABLE_FIELD 3 -#define MAC_PCU_REG_MCICTL_EARLY_NOTIFY_DELAY_FIELD 9:4 -#define MAC_PCU_REG_MCICTL_BMISS_FORCE_WL_FIELD 10 -#define MAC_PCU_REG_MCICTL_SLEEP_FORCE_BT_FIELD 11 -#define MAC_PCU_REG_MCICTL_HP_QCU_STOMP_BT_FIELD 12 -#define MAC_PCU_REG_MCICTL_MCI_BUSY_FIELD 31 -#define MAC_PCU_REG_MCICTL_MCI_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MCICTL_OLA_ENABLE_RESET 0x1 -#define MAC_PCU_REG_MCICTL_PREEMPT_ENABLE_RESET 0x1 -#define MAC_PCU_REG_MCICTL_CHANNEL_BUSY_ENABLE_RESET 0x1 -#define MAC_PCU_REG_MCICTL_EARLY_NOTIFY_DELAY_RESET 0x5 -#define MAC_PCU_REG_MCICTL_BMISS_FORCE_WL_RESET 0x0 -#define MAC_PCU_REG_MCICTL_SLEEP_FORCE_BT_RESET 0x1 -#define MAC_PCU_REG_MCICTL_HP_QCU_STOMP_BT_RESET 0x0 - -#define MAC_PCU_REG_MCIISR_OFFSET 0x9b -#define MAC_PCU_REG_MCIISR_ACT_RPT_RCV_INT_FIELD 0 -#define MAC_PCU_REG_MCIISR_ACT_DEN_RCV_INT_FIELD 1 -#define MAC_PCU_REG_MCIISR_FRQ_RPT_RCV_INT_FIELD 2 -#define MAC_PCU_REG_MCIISR_QOS_RPT_RCV_INT_FIELD 3 -#define MAC_PCU_REG_MCIISR_GEN_RPT_RCV_INT_FIELD 4 -#define MAC_PCU_REG_MCIISR_ACT_RPT_RCV_INT_RESET 0x0 -#define MAC_PCU_REG_MCIISR_ACT_DEN_RCV_INT_RESET 0x0 -#define MAC_PCU_REG_MCIISR_FRQ_RPT_RCV_INT_RESET 0x0 -#define MAC_PCU_REG_MCIISR_QOS_RPT_RCV_INT_RESET 0x0 -#define MAC_PCU_REG_MCIISR_GEN_RPT_RCV_INT_RESET 0x0 - -#define MAC_PCU_REG_MCIIER_OFFSET 0x9c -#define MAC_PCU_REG_MCIIER_ACT_RPT_RCV_INT_ENABLE_FIELD 0 -#define MAC_PCU_REG_MCIIER_ACT_DEN_RCV_INT_ENABLE_FIELD 1 -#define MAC_PCU_REG_MCIIER_FRQ_RPT_RCV_INT_ENABLE_FIELD 2 -#define MAC_PCU_REG_MCIIER_QOS_RPT_RCV_INT_ENABLE_FIELD 3 -#define MAC_PCU_REG_MCIIER_GEN_RPT_RCV_INT_ENABLE_FIELD 4 -#define MAC_PCU_REG_MCIIER_ACT_RPT_RCV_INT_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MCIIER_ACT_DEN_RCV_INT_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MCIIER_FRQ_RPT_RCV_INT_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MCIIER_QOS_RPT_RCV_INT_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MCIIER_GEN_RPT_RCV_INT_ENABLE_RESET 0x0 - -#define MAC_PCU_REG_MCIWLP_OFFSET 0x9d -#define MAC_PCU_REG_MCIWLP_RESET 0x0 - -#define MAC_PCU_REG_MCIARW_OFFSET 0x9e -#define MAC_PCU_REG_MCIARW_RESET 0x0 - -#define MAC_PCU_REG_MCIARR_OFFSET 0x9f - -#define MAC_PCU_REG_MCIADW_OFFSET 0xa0 -#define MAC_PCU_REG_MCIADW_RESET 0x0 - -#define MAC_PCU_REG_MCIADR_OFFSET 0xa1 - -#define MAC_PCU_REG_MCIFRW_OFFSET 0xa2 -#define MAC_PCU_REG_MCIFRW_RESET 0x0 - -#define MAC_PCU_REG_MCIFRR_OFFSET 0xa3 - -#define MAC_PCU_REG_MCIQRW_OFFSET 0xa4 -#define MAC_PCU_REG_MCIQRW_RESET 0x0 - -#define MAC_PCU_REG_MCIQRR_OFFSET 0xa5 - -#define MAC_PCU_REG_MCIGRW_OFFSET 0xa6 -#define MAC_PCU_REG_MCIGRW_RESET 0x0 - -#define MAC_PCU_REG_MCIGRR_OFFSET 0xa7 - -#define MAC_PCU_REG_MCISTAT_OFFSET 0xa8 -#define MAC_PCU_REG_MCISTAT_ACT_RPT_RCV_CNT_FIELD 7:0 -#define MAC_PCU_REG_MCISTAT_QC_CNT_FIELD 15:8 -#define MAC_PCU_REG_MCISTAT_OLA_CNT_FIELD 23:16 -#define MAC_PCU_REG_MCISTAT_PREEMPT_CNT_FIELD 31:24 -#define MAC_PCU_REG_MCISTAT_ACT_RPT_RCV_CNT_RESET 0x0 -#define MAC_PCU_REG_MCISTAT_QC_CNT_RESET 0x0 -#define MAC_PCU_REG_MCISTAT_OLA_CNT_RESET 0x0 -#define MAC_PCU_REG_MCISTAT_PREEMPT_CNT_RESET 0x0 - -#define MAC_PCU_REG_BASIC_RATE_SET0_OFFSET 0xa9 -#define MAC_PCU_REG_BRATE_1MB_L_FIELD 4:0 -#define MAC_PCU_REG_BRATE_2MB_L_FIELD 9:5 -#define MAC_PCU_REG_BRATE_2MB_S_FIELD 14:10 -#define MAC_PCU_REG_BRATE_5_5MB_L_FIELD 19:15 -#define MAC_PCU_REG_BRATE_5_5MB_S_FIELD 24:20 -#define MAC_PCU_REG_BRATE_11MB_L_FIELD 29:25 -#define MAC_PCU_REG_BRATE_1MB_L_RESET #CCK_RATE_1Mb_L -#define MAC_PCU_REG_BRATE_2MB_L_RESET #CCK_RATE_2Mb_L -#define MAC_PCU_REG_BRATE_2MB_S_RESET #CCK_RATE_2Mb_S -#define MAC_PCU_REG_BRATE_5_5MB_L_RESET #CCK_RATE_5_5Mb_L -#define MAC_PCU_REG_BRATE_5_5MB_S_RESET #CCK_RATE_5_5Mb_S -#define MAC_PCU_REG_BRATE_11MB_L_RESET #CCK_RATE_11Mb_L - -#define MAC_PCU_REG_BASIC_RATE_SET1_OFFSET 0xaa -#define MAC_PCU_REG_BRATE_11MB_S_FIELD 4:0 -#define MAC_PCU_REG_BRATE_6MB_FIELD 9:5 -#define MAC_PCU_REG_BRATE_9MB_FIELD 14:10 -#define MAC_PCU_REG_BRATE_12MB_FIELD 19:15 -#define MAC_PCU_REG_BRATE_18MB_FIELD 24:20 -#define MAC_PCU_REG_BRATE_24MB_FIELD 29:25 -#define MAC_PCU_REG_BRATE_11MB_S_RESET #CCK_RATE_11Mb_S -#define MAC_PCU_REG_BRATE_6MB_RESET #OFDM_RATE_6Mb -#define MAC_PCU_REG_BRATE_9MB_RESET #OFDM_RATE_6Mb -#define MAC_PCU_REG_BRATE_12MB_RESET #OFDM_RATE_12Mb -#define MAC_PCU_REG_BRATE_18MB_RESET #OFDM_RATE_12Mb -#define MAC_PCU_REG_BRATE_24MB_RESET #OFDM_RATE_24Mb - -#define MAC_PCU_REG_BASIC_RATE_SET2_OFFSET 0xab -#define MAC_PCU_REG_BRATE_36MB_FIELD 4:0 -#define MAC_PCU_REG_BRATE_48MB_FIELD 9:5 -#define MAC_PCU_REG_BRATE_54MB_FIELD 14:10 -#define MAC_PCU_REG_BRATE_36MB_RESET #OFDM_RATE_24Mb -#define MAC_PCU_REG_BRATE_48MB_RESET #OFDM_RATE_24Mb -#define MAC_PCU_REG_BRATE_54MB_RESET #OFDM_RATE_24Mb - -#define MAC_PCU_REG_SEC_BSSID_L32_OFFSET 0xac -#define MAC_PCU_REG_SEC_BSSID_L32_FIELD 31:0 -#define MAC_PCU_REG_SEC_BSSID_L32_RESET 0x0 - -#define MAC_PCU_REG_SEC_BSSID_U16_OFFSET 0xad -#define MAC_PCU_REG_SEC_BSSID_U16_FIELD 15:0 -#define MAC_PCU_REG_SEC_BSSID_ENABLE_FIELD 16 -#define MAC_PCU_REG_SEC_BSSID_U16_RESET 0x0 -#define MAC_PCU_REG_SEC_BSSID_ENABLE_RESET 0x0 - -#define MAC_PCU_REG_FTYPE_OFFSET 0x140 -#define MAC_PCU_REG_FTYPE_UPPER_OFFSET 0x17F -#define MAC_PCU_REG_FTYPE_BFCOEF_RX_UPDATE_NORMAL_FIELD 0 -#define MAC_PCU_REG_FTYPE_BFCOEF_RX_UPDATE_SELF_GEN_FIELD 1 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_NORMAL_FIELD 2 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_SELF_GEN_FIELD 3 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_GEN_FIELD 4 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_MCAST_FIELD 5 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_ALL_FIELD 6 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_DIRECTED_FIELD 7 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_MCAST_FIELD 8 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_BCAST_FIELD 9 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_MC_BC_BSSID_FIELD 10 - -#define MAC_PCU_REG_ACKSIFSMEM_OFFSET_RESERVED 0x1A0 -#define MAC_PCU_REG_ACKSIFSMEM_UPPER_OFFSET_RESERVED 0x1BF -#define MAC_PCU_REG_ACKSIFSMEM_NORMAL_FIELD_RESERVED 9:0 -#define MAC_PCU_REG_ACKSIFSMEM_TURBO_FIELD_RESERVED 19:10 - -#define MAC_PCU_REG_DUR_OFFSET 0x1C0 -#define MAC_PCU_REG_DUR_UPPER_OFFSET 0x1DF -#define MAC_PCU_REG_DUR_RATE_TO_DURATION_FIELD 15:0 - -#define MAC_PCU_REG_RTD_OFFSET 0x1F0 -#define MAC_PCU_REG_RTD_UPPER_OFFSET 0x1F7 -#define MAC_PCU_REG_RTD_RATE_TO_DB_0_FIELD 4:0 -#define MAC_PCU_REG_RTD_RATE_TO_DB_1_FIELD 12:8 -#define MAC_PCU_REG_RTD_RATE_TO_DB_2_FIELD 20:16 -#define MAC_PCU_REG_RTD_RATE_TO_DB_3_FIELD 28:24 - -#define MAC_PCU_REG_DTR_OFFSET 0x1F8 -#define MAC_PCU_REG_DTR_UPPER_OFFSET 0x1FF -#define MAC_PCU_REG_DTR_DB_TO_RATE_0_FIELD 4:0 -#define MAC_PCU_REG_DTR_DB_TO_RATE_1_FIELD 12:8 -#define MAC_PCU_REG_DTR_DB_TO_RATE_2_FIELD 20:16 -#define MAC_PCU_REG_DTR_DB_TO_RATE_3_FIELD 28:24 - -#define MAC_PCU_REG_KC_OFFSET 0x200 -#define MAC_PCU_REG_KC_UPPER_OFFSET 0x5FF -#define MAC_PCU_REG_KC_KEY_31_0_FIELD 31:0 -#define MAC_PCU_REG_KC_KEY_47_32_FIELD 15:0 -#define MAC_PCU_REG_KC_KEY_79_48_FIELD 31:0 -#define MAC_PCU_REG_KC_KEY_95_80_FIELD 15:0 -#define MAC_PCU_REG_KC_KEY_127_96_FIELD 31:0 -#define MAC_PCU_REG_KC_KEY_TYPE_FIELD 2:0 -#define MAC_PCU_REG_KC_LAST_ANTENNA_FIELD 3 -#define MAC_PCU_REG_KC_ASYNC_ACK_OFFSET_FIELD 8:4 -#define MAC_PCU_REG_KC_UPDATE_BEAM_FORMING_FIELD 9 -#define MAC_PCU_REG_KC_RX_CHAIN_0_ACK_ANT_FIELD 10 -#define MAC_PCU_REG_KC_RX_CHAIN_1_ACK_ANT_FIELD 11 -#define MAC_PCU_REG_KC_TX_CHAIN_0_ANT_SEL_FIELD 12 -#define MAC_PCU_REG_KC_TX_CHAIN_1_ANT_SEL_FIELD 13 -#define MAC_PCU_REG_KC_TX_CHAIN_SEL_FIELD 14 -#define MAC_PCU_REG_KC_ADDR_32_1_FIELD 31:0 -#define MAC_PCU_REG_KC_ADDR_47_33_FIELD 14:0 -#define MAC_PCU_REG_KC_VALID_FIELD 1 - -//Misc -#define ELEM_START 36 -#define CFP_ELEM 4 - -#endif diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/mac_pcu.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/mac_pcu.vrh deleted file mode 100644 index 0ed8ff6737d0..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/mac_pcu.vrh +++ /dev/null @@ -1,979 +0,0 @@ - -#define _MAC_PCU_H - -#define FIFO_BOUND 1024 - -#define CLK32_TIMER0 0 -#define CLK32_TIMER1 1 -#define CLK32_TIMER2 2 -#define CLK32_TIMER3 3 -#define CLK32_TSF_L32 4 -#define CLK32_TSF_U32 5 -#define CLK32_SLP1 6 -#define CLK32_SLP2 7 -#define CLK32_SLP3 8 -#define CLK32_QT1 9 -#define CLK32_QT2 10 -//#define CLK32_TSFCAL 11 - -//#define CLK_S_SYNC1 0 -//#define CLK_S_SYNC6 1 -//#define CLK_S_SYNC7 2 -//#define CLK_S_SYNC8 3 - -#define KTYPE_40 0 -#define KTYPE_104 1 -#define KTYPE_TKIP_NO_MIC 2 -#define KTYPE_128 3 -#define KTYPE_TKIP 4 -//#define KTYPE_AES_OCB 5 -#define KTYPE_WAPI 5 -#define KTYPE_AES_CCM 6 -#define KTYPE_NOTHING 7 - -//Frame Type in Descriptor -#define TXDESC_FT_NORMAL 0 -#define TXDESC_FT_ATIM 1 -#define TXDESC_FT_PS_POLL 2 -#define TXDESC_FT_BEACON 3 -#define TXDESC_FT_PROBE_RESP 4 -#define TXDESC_FT_CHIRP 5 -#define TXDESC_FT_GROUP_POLL 6 -#define TXDESC_FT_DIRECT_POLL 7 -//#define TXDESC_FT_SYNC 8 -#define TXDESC_FT_BEACON_NO_TSF_UPDATE 9 - -//Frame Type: Management -#define FTYPE_ASSOCIATION_REQ 6'b000000 -#define FTYPE_ASSOCIATION_RES 6'b000100 -#define FTYPE_REASSOCIATION_REQ 6'b001000 -#define FTYPE_REASSOCIATION_RES 6'b001100 -#define FTYPE_PBREQ 6'b010000 // change to TYPE_PROBE_REQ TBD -#define FTYPE_PBRES 6'b010100 // change to TYPE_PROBE_RES TBD -#define FTYPE_BEACON 6'b100000 -#define FTYPE_ATIM 6'b100100 -#define FTYPE_DISASSOCIATE 6'b101000 -#define FTYPE_AUTHENICATE 6'b101100 -#define FTYPE_DEAUTHENICATE 6'b110000 - -//Frame Type: Control -#define FTYPE_PSPOLL 6'b101001 -#define FTYPE_RTS 6'b101101 -#define FTYPE_CTS 6'b110001 -#define FTYPE_ACK 6'b110101 -#define FTYPE_CFEND 6'b111001 -#define FTYPE_CFEND_ACK 6'b111101 // change to FTYPE_CFEND_ACK TBD - -//Frame Type: Data -#define FTYPE_DATA 6'b000010 -#define FTYPE_DATA_CFACK 6'b000110 -#define FTYPE_DATA_CFPOLL 6'b001010 -#define FTYPE_DATA_CFACK_CFPOLL 6'b001110 -#define FTYPE_NULL 6'b010010 -#define FTYPE_CFACK 6'b010110 -#define FTYPE_CFPOLL 6'b011010 -#define FTYPE_CFACK_CFPOLL 6'b011110 - -//Frame Control Fields -#define FCTL_TO_DS 8 -#define FCTL_FROM_DS 9 -#define FCTL_MORE_FRAG 10 -#define FCTL_RETRY 11 -#define FCTL_POWER_MGNT 12 -#define FCTL_MORE_DATA 13 -#define FCTL_WEP 14 -#define FCTL_TYPE 3:2 - -//Rate -#define OFDM_RATE_6Mb 5'h0b -#define OFDM_RATE_9Mb 5'h0f -#define OFDM_RATE_12Mb 5'h0a -#define OFDM_RATE_18Mb 5'h0e -#define OFDM_RATE_24Mb 5'h09 -#define OFDM_RATE_36Mb 5'h0d -#define OFDM_RATE_48Mb 5'h08 -#define OFDM_RATE_54Mb 5'h0c -#define CCK_RATE_1Mb_L 5'h1b -#define CCK_RATE_2Mb_L 5'h1a -#define CCK_RATE_2Mb_S 5'h1e -#define CCK_RATE_5_5Mb_L 5'h19 -#define CCK_RATE_5_5Mb_S 5'h1d -#define CCK_RATE_11Mb_L 5'h18 - -#define CCK_RATE_11Mb_S 5'h1c -#define XR_RATE_0_25Mb 5'h03 -#define XR_RATE_0_5Mb 5'h07 -#define XR_RATE_1Mb 5'h02 -#define XR_RATE_2Mb 5'h06 -#define XR_RATE_3Mb 5'h01 - -//Registers -#define PCU_REG 'h0 -#define KEY_REG 'h1 -#define D2A2_REG 'h3 - -#define REG_STA_ID0 'h0 -#define STA_ADDR_L32 31:0 - -#define REG_STA_ID1 'h1 -#define STA_ADDR_U16 15:0 -#define AP 16 -#define ADHOC 17 -#define PWR_SV 18 -#define NO_KEYSRCH 19 -#define PCF 20 -#define USE_DEF_ANT 21 -#define DEF_ANT_UPDATE 22 -#define RTS_DEF_ANT 23 -#define ACKCTS_6MB 24 -#define RATE_11B 25 -#define SECTOR_SELF_GEN 26 -#define CRPT_MIC_ENABLE 27 -#define KSRCH_MODE 28 -#define PRESERVE_SEQNUM 29 -#define CBCIV_ENDIAN 30 -#define ADHOC_MCAST_SEARCH 31 - -#define REG_BSS_ID0 'h2 -#define BSSID_L32 31:0 - -#define REG_BSS_ID1 'h3 -#define BSSID_U16 15:0 -#define AID 31:16 - -#define MAC_PCU_REG_BCNRSSI_OFFSET 'h4 -#define MAC_PCU_REG_BCNRSSI_BCN_RSSI_AVE_FIELD 11:0 -#define MAC_PCU_REG_BCNRSSI_BCN_RSSI_AVE_RESET 12'h800 - -#define REG_TIME_OUT 'h5 -#define ACK_TIME_OUT 15:0 -#define CTS_TIME_OUT 31:16 - -#define MAC_PCU_REG_BCNSIG_OFFSET 'h6 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_LO_THR_FIELD 7:0 -#define MAC_PCU_REG_BCNSIG_BCN_MISS_THR_FIELD 15:8 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_HI_THR_FIELD 23:16 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_WEIGHT_FIELD 28:24 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_RESET_FIELD 29 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_LO_THR_RESET 0 -#define MAC_PCU_REG_BCNSIG_BCN_MISS_THR_RESET 8'hFF -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_HI_THR_RESET 8'h7F -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_WEIGHT_RESET 0 - -#define REG_USEC 'h7 -#define USEC 6:0 -#define USEC32 13:7 -#define TX_DELAY 18:14 -#define RX_DELAY 24:19 - -#define REG_BEACON 'h8 -#define BEACON_PERIOD 15:0 -#define TIM_OFFSET 22:16 -#define RESET_TSF 24 - -#define REG_CFP_PERIOD 'h9 - -#define REG_TIMER0 'ha - -#define REG_TIMER1 'hb - -#define REG_TIMER2 'hc - -#define REG_TIMER3 'hd - -#define REG_CFP_DUR 'he - -#define REG_RX_FILTER 'hf -#define UNICAST 0 -#define MULTICAST 1 -#define BROADCAST 2 -#define CONTROL 3 -#define BEACON 4 -#define PROMISCUOUS 5 -#define XR_POLL 6 -#define PROBE_REQ 7 -//#define SYNC 8 -#define MY_BEACON 9 - -#define REG_MCAST_FIL0 'h10 - -#define REG_MCAST_FIL1 'h11 - -#define MAC_PCU_REG_DIAGSW_OFFSET 'h12 -#define MAC_PCU_REG_DIAGSW_DIS_WEP_ACK_FIELD 0 -#define MAC_PCU_REG_DIAGSW_DIS_ACK_FIELD 1 -#define MAC_PCU_REG_DIAGSW_DIS_CTS_FIELD 2 -#define MAC_PCU_REG_DIAGSW_DIS_ENC_FIELD 3 -#define MAC_PCU_REG_DIAGSW_DIS_DEC_FIELD 4 -#define MAC_PCU_REG_DIAGSW_DIS_RX_FIELD 5 -#define MAC_PCU_REG_DIAGSW_LOOP_BACK_FIELD 6 -#define MAC_PCU_REG_DIAGSW_CORR_FCS_FIELD 7 -#define MAC_PCU_REG_DIAGSW_CHAN_INFO_FIELD 8 -#define MAC_PCU_REG_DIAGSW_RESERVED_FIELD 16:9 -#define MAC_PCU_REG_DIAGSW_ACCEPT_NONV0_FIELD 17 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_0_1_FIELD 19:18 -#define MAC_PCU_REG_DIAGSW_RXCLR_HIGH_FIELD 20 -#define MAC_PCU_REG_DIAGSW_IGNORE_NAV_FIELD 21 -#define MAC_PCU_REG_DIAGSW_CHANIDLE_HIGH_FIELD 22 -#define MAC_PCU_REG_DIAGSW_PHYERR_ENABLE_NEW_FIELD 23 -#define MAC_PCU_REG_DIAGSW_DUAL_CHAIN_CHAN_INFO_FIELD 24 -#define MAC_PCU_REG_DIAGSW_FORCE_RX_ABORT_FIELD 25 -#define MAC_PCU_REG_DIAGSW_SATURATE_CYCLE_CNT_FIELD 26 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_2_FIELD 27 -#define MAC_PCU_REG_DIAGSW_DIS_WEP_ACK_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_ACK_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_CTS_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_ENC_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_DEC_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_RX_RESET 0 -#define MAC_PCU_REG_DIAGSW_LOOP_BACK_RESET 0 -#define MAC_PCU_REG_DIAGSW_CORR_FCS_RESET 0 -#define MAC_PCU_REG_DIAGSW_CHAN_INFO_RESET 0 -#define MAC_PCU_REG_DIAGSW_RESERVED_RESET 0 -#define MAC_PCU_REG_DIAGSW_ACCEPT_NONV0_RESET 0 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_0_1_RESET 0 -#define MAC_PCU_REG_DIAGSW_RXCLR_HIGH_RESET 0 -#define MAC_PCU_REG_DIAGSW_IGNORE_NAV_RESET 0 -#define MAC_PCU_REG_DIAGSW_CHANIDLE_HIGH_RESET 0 -#define MAC_PCU_REG_DIAGSW_PHYERR_ENABLE_NEW_RESET 0 -#define MAC_PCU_REG_DIAGSW_DUAL_CHAIN_CHAN_INFO_RESET 0 -#define MAC_PCU_REG_DIAGSW_FORCE_RX_ABORT_RESET 0 -#define MAC_PCU_REG_DIAGSW_SATURATE_CYCLE_CNT_RESET 0 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_2_RESET 0 - -#define REG_TSF_L32 'h13 - -#define REG_TSF_U32 'h14 - -#define REG_TST_ADDAC 'h15 -#define TEST_MODE 0 -#define TEST_LOOP 1 -#define LOOP_LEN 12:2 -#define TEST_UPPER_8B 13 -#define TEST_MSB 14 -#define TEST_CAPTURE 15 - -#define REG_DEF_ANT 'h16 - -#define MAC_PCU_REG_MUTE_MASKS0_OFFSET 'h17 -#define MAC_PCU_REG_MUTE_MASKS0_FC_FIELD 15:0 -#define MAC_PCU_REG_MUTE_MASKS0_QOS_FIELD 31:16 -#define MAC_PCU_REG_MUTE_MASKS0_FC_RESET 16'hC7FF -#define MAC_PCU_REG_MUTE_MASKS0_QOS_RESET 16'hFFFF - -#define MAC_PCU_REG_MUTE_MASKS1_OFFSET 'h18 -#define MAC_PCU_REG_MUTE_MASKS1_SEQ_FIELD 15:0 -#define MAC_PCU_REG_MUTE_MASKS1_FC_MGMT_FIELD 31:16 -#define MAC_PCU_REG_MUTE_MASKS1_SEQ_RESET 16'h000F -#define MAC_PCU_REG_MUTE_MASKS1_FC_MGMT_RESET 16'hE7FF - -#define MAC_PCU_REG_GATED_CLKS_OFFSET 'h19 -//#define MAC_PCU_REG_GATED_SYNC_FIELD 0 -#define MAC_PCU_REG_GATED_TX_FIELD 1 -#define MAC_PCU_REG_GATED_RX_FIELD 2 -#define MAC_PCU_REG_GATED_REG_FIELD 3 -//#define MAC_PCU_REG_GATED_SYNC_RESET 1'b1 -#define MAC_PCU_REG_GATED_TX_RESET 1'b0 -#define MAC_PCU_REG_GATED_RX_RESET 1'b0 -#define MAC_PCU_REG_GATED_REG_RESET 1'b0 - -#define MAC_PCU_REG_OBS2_OFFSET 'h1a -#define MAC_PCU_REG_OBS2_OBS_BUS_FIELD 17:0 - -#define MAC_PCU_REG_OBS1_OFFSET 'h1b -#define MAC_PCU_REG_OBS1_TX_STATE_FIELD 28:24 -#define MAC_PCU_REG_OBS1_RX_STATE_FIELD 23:20 -#define MAC_PCU_REG_OBS1_WEP_STATE_FIELD 17:12 -#define MAC_PCU_REG_OBS1_RX_CLEAR_FIELD 11 -#define MAC_PCU_REG_OBS1_RX_FRAME_FIELD 10 -#define MAC_PCU_REG_OBS1_TX_FRAME_FIELD 9 -#define MAC_PCU_REG_OBS1_TX_HOLD_FIELD 8 -#define MAC_PCU_REG_OBS1_CHAN_IDLE_FIELD 7 -#define MAC_PCU_REG_OBS1_QUIET_TIME_FIELD 6 -#define MAC_PCU_REG_OBS1_TX_HCF_FIELD 5 -#define MAC_PCU_REG_OBS1_FILTER_PASS_FIELD 4 -#define MAC_PCU_REG_OBS1_RX_MY_BEACON_FIELD 3 -#define MAC_PCU_REG_OBS1_RX_WEP_FIELD 2 -#define MAC_PCU_REG_OBS1_PCU_RX_END_FIELD 1 -#define MAC_PCU_REG_OBS1_PCU_DIRECTED_FIELD 0 - -#define REG_LAST_TSTP 'h20 - -#define REG_NAV 'h21 - -#define REG_RTS_OK 'h22 - -#define REG_RTS_FAIL 'h23 - -#define REG_ACK_FAIL 'h24 - -#define REG_FCS_FAIL 'h25 - -#define REG_BEACON_CNT 'h26 - -#define MAC_PCU_REG_XRMODE_OFFSET 'h30 -#define MAC_PCU_REG_XRMODE_XR_POLL_TYPE_FIELD 5:0 -#define MAC_PCU_REG_XRMODE_XR_WAIT_FOR_POLL_FIELD 7 -#define MAC_PCU_REG_XRMODE_XR_FRAME_HOLD_FIELD 31:20 -#define MAC_PCU_REG_XRMODE_XR_POLL_TYPE_RESET 6'h1A -#define MAC_PCU_REG_XRMODE_XR_WAIT_FOR_POLL_RESET 1'b0 -#define MAC_PCU_REG_XRMODE_XR_FRAME_HOLD_RESET 12'd680 - -#define MAC_PCU_REG_XRDEL_OFFSET 'h31 -#define MAC_PCU_REG_XRDEL_XR_SLOT_DELAY_FIELD 15:0 -#define MAC_PCU_REG_XRDEL_XR_CHIRP_DATA_DELAY_FIELD 31:16 -#define MAC_PCU_REG_XRDEL_XR_SLOT_DELAY_RESET 16'd360 -#define MAC_PCU_REG_XRDEL_XR_CHIRP_DATA_DELAY_RESET 16'd1680 - -#define MAC_PCU_REG_XRTO_OFFSET 'h32 -#define MAC_PCU_REG_XRTO_XR_CHIRP_TIMEOUT_FIELD 15:0 -#define MAC_PCU_REG_XRTO_XR_POLL_TIMEOUT_FIELD 31:16 -#define MAC_PCU_REG_XRTO_XR_CHIRP_TIMEOUT_RESET 16'd7200 -#define MAC_PCU_REG_XRTO_XR_POLL_TIMEOUT_RESET 16'd5000 - -#define MAC_PCU_REG_XRCRP_OFFSET 'h33 -#define MAC_PCU_REG_XRCRP_XR_SEND_CHIRP_FIELD 0 -#define MAC_PCU_REG_XRCRP_XR_CHIRP_GAP_FIELD 31:16 -#define MAC_PCU_REG_XRCRP_XR_SEND_CHIRP_RESET 1'b0 -#define MAC_PCU_REG_XRCRP_XR_CHIRP_GAP_RESET 16'd500 - -#define MAC_PCU_REG_XRSTMP_OFFSET 'h34 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_FIELD 0 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_BSSID_FIELD 1 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_FIELD 2 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_BSSID_FIELD 3 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_DATA_FIELD 4 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_DATA_FIELD 5 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_THRESH_FIELD 15:8 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_THRESH_FIELD 23:16 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_RESET 1'b0 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_BSSID_RESET 1'b0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_RESET 1'b0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_BSSID_RESET 1'b0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_DATA_RESET 1'b0 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_DATA_RESET 1'b0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_THRESH_RESET 8'h25 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_THRESH_RESET 8'h25 - -#define MAC_PCU_REG_SLP1_OFFSET 'h35 -//#define MAC_PCU_REG_SLP1_NEXT_DTIM_FIELD 18:0 -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_EXT_FIELD 4:0 -#define MAC_PCU_REG_SLP1_ASSUME_DTIM_FIELD 19 -//#define MAC_PCU_REG_SLP1_ENH_SLEEP_ENABLE_FIELD 20 -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_FIELD 31:21 -// #define MAC_PCU_REG_SLP1_NEXT_DTIM_RESET 19'h2aaaa -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_EXT_RESET 5'h0 -#define MAC_PCU_REG_SLP1_ASSUME_DTIM_RESET 1'b0 -//#define MAC_PCU_REG_SLP1_ENH_SLEEP_ENABLE_RESET 1'b1 -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_RESET 11'd5 - -#define MAC_PCU_REG_SLP2_OFFSET 'h36 -//#define MAC_PCU_REG_SLP2_NEXT_TIM_FIELD 18:0 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_EXT_FIELD 4:0 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_FIELD 31:21 -//#define MAC_PCU_REG_SLP2_NEXT_TIM_RESET 19'h55555 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_EXT_RESET 5'h0 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_RESET 11'd2 - -//#define MAC_PCU_REG_SLP3_OFFSET 'h37 -//#define MAC_PCU_REG_SLP3_TIM_PERIOD_FIELD 15:0 -//#define MAC_PCU_REG_SLP3_DTIM_PERIOD_FIELD 31:16 -//#define MAC_PCU_REG_SLP3_TIM_PERIOD_RESET 16'd2 -//#define MAC_PCU_REG_SLP3_DTIM_PERIOD_RESET 16'd3 - -#define MAC_PCU_REG_BSSMSKL_OFFSET 'h38 -#define MAC_PCU_REG_BSSMSKL_BSSID_MASK_L_FIELD 31:0 -#define MAC_PCU_REG_BSSMSKL_BSSID_MASK_L_RESET 32'hFFFFFFFF - -#define MAC_PCU_REG_BSSMSKH_OFFSET 'h39 -#define MAC_PCU_REG_BSSMSKH_BSSID_MASK_H_FIELD 15:0 -#define MAC_PCU_REG_BSSMSKH_BSSID_MASK_H_RESET 16'hFFFF - -#define MAC_PCU_REG_TPC_OFFSET 'h3A -#define MAC_PCU_REG_TPC_ACK_PWR_FIELD 5:0 -#define MAC_PCU_REG_TPC_CTS_PWR_FIELD 13:8 -#define MAC_PCU_REG_TPC_CHIRP_PWR_FIELD 21:16 -#define MAC_PCU_REG_TPC_ACK_PWR_RESET 6'h3f -#define MAC_PCU_REG_TPC_CTS_PWR_RESET 6'h3f -#define MAC_PCU_REG_TPC_CHIRP_PWR_RESET 6'h3f - -#define MAC_PCU_REG_TFC_OFFSET 'h3B -#define MAC_PCU_REG_TFC_TX_FRAME_CNT_FIELD 31:0 -#define MAC_PCU_REG_TFC_TX_FRAME_CNT_RESET 0 - -#define MAC_PCU_REG_RFC_OFFSET 'h3C -#define MAC_PCU_REG_RFC_RX_FRAME_CNT_FIELD 31:0 -#define MAC_PCU_REG_RFC_RX_FRAME_CNT_RESET 0 - -#define MAC_PCU_REG_RCC_OFFSET 'h3D -#define MAC_PCU_REG_RCC_RX_CLEAR_CNT_FIELD 31:0 -#define MAC_PCU_REG_RCC_RX_CLEAR_CNT_RESET 0 - -#define MAC_PCU_REG_CC_OFFSET 'h3E -#define MAC_PCU_REG_CC_CYCLE_CNT_FIELD 31:0 -#define MAC_PCU_REG_CC_CYCLE_CNT_RESET 0 - -#define MAC_PCU_REG_QT1_OFFSET 'h3F -#define MAC_PCU_REG_QT1_NEXT_QUIET_FIELD 15:0 -#define MAC_PCU_REG_QT1_QUIET_ENABLE_FIELD 16 -#define MAC_PCU_REG_QT1_QUIET_ACK_CTS_ENABLE_FIELD 17 -#define MAC_PCU_REG_QT1_NEXT_QUIET_RESET 16'd0 -#define MAC_PCU_REG_QT1_QUIET_ENABLE_RESET 1'b0 -#define MAC_PCU_REG_QT1_QUIET_ACK_CTS_ENABLE_RESET 1'b1 - -#define MAC_PCU_REG_QT2_OFFSET 'h40 -#define MAC_PCU_REG_QT2_QUIET_PERIOD_FIELD 15:0 -#define MAC_PCU_REG_QT2_QUIET_DURATION_FIELD 31:16 -#define MAC_PCU_REG_QT2_QUIET_PERIOD_RESET 16'd0002 -#define MAC_PCU_REG_QT2_QUIET_DURATION_RESET 16'd0001 - -#define MAC_PCU_REG_TSF_OFFSET 'h41 -#define MAC_PCU_REG_TSF_INCREMENT_FIELD 7:0 -#define MAC_PCU_REG_TSF_INCREMENT_RESET 8'h01 - -#define MAC_PCU_REG_NOACK_OFFSET 'h42 -#define MAC_PCU_REG_NOACK_2_BIT_VALUES_FIELD 3:0 -#define MAC_PCU_REG_NOACK_BIT_OFFSET_FIELD 6:4 -#define MAC_PCU_REG_NOACK_BYTE_OFFSET_FIELD 8:7 -#define MAC_PCU_REG_NOACK_2_BIT_VALUES_RESET 4'h2 -#define MAC_PCU_REG_NOACK_BIT_OFFSET_RESET 3'h5 -#define MAC_PCU_REG_NOACK_BYTE_OFFSET_RESET 2'h0 - -#define MAC_PCU_REG_PHYERR_OFFSET 'h43 -#define MAC_PCU_REG_PHYERR_MASK_FIELD 31:0 -#define MAC_PCU_REG_PHYERR_MASK_RESET 32'h0 - -#define MAC_PCU_REG_XRLAT_OFFSET 'h44 -#define MAC_PCU_REG_XRLAT_XR_TX_DELAY_FIELD 11:0 -#define MAC_PCU_REG_XRLAT_XR_TX_DELAY_RESET 12'h168 - -#define MAC_PCU_REG_ACKSIFS_OFFSET_RESERVED 'h45 -#define MAC_PCU_REG_ACKSIFS_INCREMENT_FIELD_RESERVED 7:0 -#define MAC_PCU_REG_ACKSIFS_INCREMENT_RESET_RESERVED 8'h0 - -#define MAC_PCU_REG_MICQOSCTL_OFFSET 'h46 -#define MAC_PCU_REG_MICQOSCTL_FIELD 15:0 -#define MAC_PCU_REG_MICQOSCTL_ENABLE_FIELD 16 -#define MAC_PCU_REG_MICQOSCTL_RESET 16'h00aa -#define MAC_PCU_REG_MICQOSCTL_ENABLE_RESET 1'h1 - -#define MAC_PCU_REG_MICQOSSEL_OFFSET 'h47 -#define MAC_PCU_REG_MICQOSSEL_FIELD 31:0 -#define MAC_PCU_REG_MICQOSSEL_RESET 32'h00003210 - -#define MAC_PCU_REG_MISCMODE_OFFSET 'h48 -#define MAC_PCU_REG_MISCMODE_BSSID_MATCH_FORCE_FIELD 0 -#define MAC_PCU_REG_MISCMODE_ACKSIFS_MEMORY_FIELD_RESERVED 1 -#define MAC_PCU_REG_MISCMODE_MIC_NEW_LOCATION_FIELD 2 -#define MAC_PCU_REG_MISCMODE_TX_ADD_TSF_FIELD 3 -#define MAC_PCU_REG_MISCMODE_CCK_SIFS_MODE_FIELD 4 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MODE_FIELD_RESERVED 5 -#define MAC_PCU_REG_MISCMODE_BFCOEF_ENABLE_FIELD 6 -#define MAC_PCU_REG_MISCMODE_BFCOEF_UPDATE_SELF_GEN_FIELD 7 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MCAST_FIELD 8 -#define MAC_PCU_REG_MISCMODE_DUAL_CHAIN_ANT_MODE_FIELD 9 -#define MAC_PCU_REG_MISCMODE_FALCON_DESC_MODE_FIELD 10 -#define MAC_PCU_REG_MISCMODE_KC_RX_ANT_UPDATE_FIELD 11 -#define MAC_PCU_REG_MISCMODE_TXOP_TBTT_LIMIT_FIELD 12 -#define MAC_PCU_REG_MISCMODE_FALCON_BB_INTERFACE_FIELD 13 -#define MAC_PCU_REG_MISCMODE_MISS_BEACON_IN_SLEEP_FIELD 14 -#define MAC_PCU_REG_MISCMODE_BUG_12306_FIX_ENABLE_FIELD 17 -#define MAC_PCU_REG_MISCMODE_FORCE_QUIET_COLLISION_FIELD 18 -#define MAC_PCU_REG_MISCMODE_BUG_12549_FORCE_TXBF_FIELD 19 -#define MAC_PCU_REG_MISCMODE_BT_ANT_PREVENTS_RX_FIELD 20 -#define MAC_PCU_REG_MISCMODE_TBTT_PROTECT_FIELD 21 -#define MAC_PCU_REG_MISCMODE_HCF_POLL_CANCELS_NAV_FIELD 22 -#define MAC_PCU_REG_MISCMODE_RX_HCF_POLL_ENABLE_FIELD 23 -#define MAC_PCU_REG_MISCMODE_CLEAR_VMF_FIELD 24 -#define MAC_PCU_REG_MISCMODE_CLEAR_FIRST_HCF_FIELD 25 -#define MAC_PCU_REG_MISCMODE_ADHOC_MCAST_KEYID_ENABLE_FIELD 26 -#define MAC_PCU_REG_MISCMODE_ALLOW_RAC_FIELD 27 -#define MAC_PCU_REG_MISCMODE_BSSID_MATCH_FORCE_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_ACKSIFS_MEMORY_RESET_RESERVED 1'h0 -#define MAC_PCU_REG_MISCMODE_MIC_NEW_LOCATION_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_TX_ADD_TSF_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_CCK_SIFS_MODE_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MODE_RESET_RESERVED 1'h0 -#define MAC_PCU_REG_MISCMODE_BFCOEF_ENABLE_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_BFCOEF_UPDATE_SELF_GEN_RESET 1'h1 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MCAST_RESET 1'h1 -#define MAC_PCU_REG_MISCMODE_DUAL_CHAIN_ANT_MODE_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_FALCON_DESC_MODE_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_KC_RX_ANT_UPDATE_RESET 1'h1 -#define MAC_PCU_REG_MISCMODE_TXOP_TBTT_LIMIT_RESET 1'b0 -#define MAC_PCU_REG_MISCMODE_FALCON_BB_INTERFACE_RESET 1'b0 -#define MAC_PCU_REG_MISCMODE_MISS_BEACON_IN_SLEEP_RESET 1'h1 -#define MAC_PCU_REG_MISCMODE_BUG_12306_FIX_ENABLE_RESET 1'h1 -#define MAC_PCU_REG_MISCMODE_FORCE_QUIET_COLLISION_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_BUG_12549_FORCE_TXBF_RESET 1'b0 -#define MAC_PCU_REG_MISCMODE_BT_ANT_PREVENTS_RX_RESET 1'b1 -#define MAC_PCU_REG_MISCMODE_TBTT_PROTECT_RESET 1'b1 -#define MAC_PCU_REG_MISCMODE_HCF_POLL_CANCELS_NAV_RESET 1'b1 -#define MAC_PCU_REG_MISCMODE_RX_HCF_POLL_ENABLE_RESET 1'b1 -#define MAC_PCU_REG_MISCMODE_CLEAR_VMF_RESET 1'b0 -#define MAC_PCU_REG_MISCMODE_CLEAR_FIRST_HCF_RESET 1'b0 -#define MAC_PCU_REG_MISCMODE_ADHOC_MCAST_KEYID_ENABLE_RESET 1'b0 -#define MAC_PCU_REG_MISCMODE_ALLOW_RAC_RESET 1'b0 - -#define MAC_PCU_REG_FILTOFDM_OFFSET 'h49 -#define MAC_PCU_REG_FILTOFDM_CNT_FIELD 23:0 -#define MAC_PCU_REG_FILTOFDM_CNT_RESET 24'h0 - -#define MAC_PCU_REG_FILTCCK_OFFSET 'h4A -#define MAC_PCU_REG_FILTCCK_CNT_FIELD 23:0 -#define MAC_PCU_REG_FILTCCK_CNT_RESET 24'h0 - -#define MAC_PCU_REG_PHYCNT1_OFFSET 'h4B -#define MAC_PCU_REG_PHYCNT1_FIELD 23:0 -#define MAC_PCU_REG_PHYCNT1_RESET 24'h0 - -#define MAC_PCU_REG_PHYCNTMASK1_OFFSET 'h4C -#define MAC_PCU_REG_PHYCNTMASK1_FIELD 31:0 -#define MAC_PCU_REG_PHYCNTMASK1_RESET 32'h0 - -#define MAC_PCU_REG_PHYCNT2_OFFSET 'h4D -#define MAC_PCU_REG_PHYCNT2_FIELD 23:0 -#define MAC_PCU_REG_PHYCNT2_RESET 24'h0 - -#define MAC_PCU_REG_PHYCNTMASK2_OFFSET 'h4E -#define MAC_PCU_REG_PHYCNTMASK2_FIELD 31:0 -#define MAC_PCU_REG_PHYCNTMASK2_RESET 32'h0 - -#define MAC_PCU_REG_TSFTHRESH_OFFSET 'h4F -#define MAC_PCU_REG_TSFTHRESH_FIELD 15:0 -#define MAC_PCU_REG_TSFTHRESH_RESET 16'hFFFF - -//#define MAC_PCU_REG_TSFCAL_OFFSET 'h50 -//#define MAC_PCU_REG_TSFCAL_COUNT_FIELD 3:0 -//#define MAC_PCU_REG_TSFCAL_INTERVAL_FIELD 7:4 -//#define MAC_PCU_REG_TSFCAL_ENABLE_FIELD 8 -//#define MAC_PCU_REG_TSFCAL_AUTO_CAL_FIELD 9 -//#define MAC_PCU_REG_TSFCAL_VALUE_WE_FIELD 10 -//#define MAC_PCU_REG_TSFCAL_VALUE_FIELD 31:16 -//#define MAC_PCU_REG_TSFCAL_COUNT_RESET 'h8 -//#define MAC_PCU_REG_TSFCAL_INTERVAL_RESET 'ha -//#define MAC_PCU_REG_TSFCAL_ENABLE_RESET 'h1 -//#define MAC_PCU_REG_TSFCAL_AUTO_CAL_RESET 'h1 -//#define MAC_PCU_REG_TSFCAL_VALUE_WE_RESET 'h0 -//#define MAC_PCU_REG_TSFCAL_VALUE_RESET 'h8000 - -#define MAC_PCU_REG_PHYERR_EIFS_OFFSET 'h51 -#define MAC_PCU_REG_PHYERR_EIFS_MASK_FIELD 31:0 -#define MAC_PCU_REG_PHYERR_EIFS_MASK_RESET 'h0 - -//#define MAC_PCU_REG_SYNC1_OFFSET 'h52 -//#define MAC_PCU_REG_SYNC1_TIME_FIELD 30:0 -//#define MAC_PCU_REG_SYNC1_TIME_RESET 32'h0 - -//#define MAC_PCU_REG_SYNC2_OFFSET 'h53 -//#define MAC_PCU_REG_SYNC2_TIME_OFFSET_FIELD 7:0 -//#define MAC_PCU_REG_SYNC2_MASTER_FIELD 8 -//#define MAC_PCU_REG_SYNC2_REPLACE_FIELD 9 -//#define MAC_PCU_REG_SYNC2_TUNE_FIELD 10 -//#define MAC_PCU_REG_SYNC2_CLEAR_FIELD 11 -//#define MAC_PCU_REG_SYNC2_INTR_THRESH_FIELD 31:16 -//#define MAC_PCU_REG_SYNC2_TIME_OFFSET_RESET 8'h0 -//#define MAC_PCU_REG_SYNC2_MASTER_RESET 1'h0 -//#define MAC_PCU_REG_SYNC2_REPLACE_RESET 1'h0 -//#define MAC_PCU_REG_SYNC2_TUNE_RESET 1'h0 -//#define MAC_PCU_REG_SYNC2_CLEAR_RESET 1'h0 -//#define MAC_PCU_REG_SYNC2_INTR_THRESH_RESET 16'hFFFF - -//#define MAC_PCU_REG_SYNC3_OFFSET 'h54 -//#define MAC_PCU_REG_SYNC3_MCAST_ADDR_L_FIELD 31:0 -//#define MAC_PCU_REG_SYNC3_MCAST_ADDR_L_RESET 32'h0 - -//#define MAC_PCU_REG_SYNC4_OFFSET 'h55 -//#define MAC_PCU_REG_SYNC4_MCAST_ADDR_U_FIELD 15:0 -//#define MAC_PCU_REG_SYNC4_MCAST_ADDR_U_RESET 16'h0 - -//#define MAC_PCU_REG_SYNC5_OFFSET 'h56 -//#define MAC_PCU_REG_SYNC5_RX_TIME_FIELD 30:0 - -//#define MAC_PCU_REG_SYNC6_OFFSET 'h57 -//#define MAC_PCU_REG_SYNC6_INC_FIELD 31:0 - -//#define MAC_PCU_REG_SYNC7_OFFSET 'h58 -//#define MAC_PCU_REG_SYNC7_LAST_TIME_FIELD 30:0 - -//#define MAC_PCU_REG_SYNC8_OFFSET 'h59 -//#define MAC_PCU_REG_SYNC8_UPDATED_TIME_FIELD 30:0 - -#define MAC_PCU_REG_PHYCNT3_OFFSET 'h5A -#define MAC_PCU_REG_PHYCNT3_FIELD 23:0 -#define MAC_PCU_REG_PHYCNT3_RESET 24'h0 - -#define MAC_PCU_REG_PHYCNTMASK3_OFFSET 'h5B -#define MAC_PCU_REG_PHYCNTMASK3_FIELD 31:0 -#define MAC_PCU_REG_PHYCNTMASK3_RESET 32'h0 - -#define MAC_PCU_REG_BTMODE_OFFSET 'h5C -#define MAC_PCU_REG_BTMODE_TIME_EXTEND_FIELD 7:0 -#define MAC_PCU_REG_BTMODE_TXSTATE_EXTEND_FIELD 8 -#define MAC_PCU_REG_BTMODE_TX_FRAME_EXTEND_FIELD 9 -#define MAC_PCU_REG_BTMODE_MODE_FIELD 11:10 -#define MAC_PCU_REG_BTMODE_QUIET_FIELD 12 -#define MAC_PCU_REG_BTMODE_QCU_THRESH_FIELD 16:13 -#define MAC_PCU_REG_BTMODE_RX_CLEAR_POLARITY_FIELD 17 -#define MAC_PCU_REG_BTMODE_PRIORITY_TIME_FIELD 23:18 -#define MAC_PCU_REG_BTMODE_FIRST_SLOT_TIME_FIELD 31:24 -#define MAC_PCU_REG_BTMODE_TIME_EXTEND_RESET 8'h20 -#define MAC_PCU_REG_BTMODE_TXSTATE_EXTEND_RESET 1'b1 -#define MAC_PCU_REG_BTMODE_TX_FRAME_EXTEND_RESET 1'b1 -#define MAC_PCU_REG_BTMODE_MODE_RESET 2'h3 -#define MAC_PCU_REG_BTMODE_QUIET_RESET 1'b1 -#define MAC_PCU_REG_BTMODE_QCU_THRESH_RESET 4'b0001 -#define MAC_PCU_REG_BTMODE_RX_CLEAR_POLARITY_RESET 1'b0 -#define MAC_PCU_REG_BTMODE_PRIORITY_TIME_RESET 6'h05 -#define MAC_PCU_REG_BTMODE_FIRST_SLOT_TIME_RESET 8'h9B - -#define MAC_PCU_REG_BTWEIGHT_OFFSET 'h5D -#define MAC_PCU_REG_BTWEIGHT_BT_WEIGHT_FIELD 15:0 -#define MAC_PCU_REG_BTWEIGHT_WL_WEIGHT_FIELD 31:16 -#define MAC_PCU_REG_BTWEIGHT_BT_WEIGHT_RESET 16'b11_11_10_10_01_01_00_00 -#define MAC_PCU_REG_BTWEIGHT_WL_WEIGHT_RESET 16'b11_11_10_10_10_10_01_00 - -#define MAC_PCU_REG_HCF_OFFSET 'h5E -#define MAC_PCU_REG_HCF_TIMEOUT_FIELD 15:0 -#define MAC_PCU_REG_HCF_TIMEOUT_RESET 'h100 - -#define MAC_PCU_REG_BTMODE2_OFFSET 'h5F -#define MAC_PCU_REG_BTMODE2_BT_BCN_MISS_THRESH_FIELD 7:0 -#define MAC_PCU_REG_BTMODE2_BCN_MISS_CNT_FIELD 15:8 -#define MAC_PCU_REG_BTMODE2_BT_HOLD_RX_CLEAR_FIELD 16 -#define MAC_PCU_REG_BTMODE2_WL_CONTROL_ANT_FIELD 17 -#define MAC_PCU_REG_BTMODE2_RESPOND_TO_BT_ACTIVE_FIELD 18 -#define MAC_PCU_REG_BTMODE2_PROTECT_BT_AFTER_WAKEUP_FIELD 19 -#define MAC_PCU_REG_BTMODE2_DISABLE_BT_ANT_FIELD 20 -#define MAC_PCU_REG_BTMODE2_BT_BCN_MISS_THRESH_RESET 0 -#define MAC_PCU_REG_BTMODE2_BT_HOLD_RX_CLEAR_RESET 0 -#define MAC_PCU_REG_BTMODE2_WL_CONTROL_ANT_RESET 1'h0 -#define MAC_PCU_REG_BTMODE2_RESPOND_TO_BT_ACTIVE_RESET 1'h0 -#define MAC_PCU_REG_BTMODE2_PROTECT_BT_AFTER_WAKEUP_RESET 1'h0 -#define MAC_PCU_REG_BTMODE2_DISABLE_BT_ANT_RESET 1'h0 - -#define MAC_PCU_REG_BFCOEF1_OFFSET 'h60 -#define MAC_PCU_REG_BFCOEF1_UPPER_OFFSET 'h67 -#define MAC_PCU_REG_BFCOEF1_KEY_VALID_FIELD 31 -#define MAC_PCU_REG_BFCOEF1_KEYIDX_FIELD 30:24 -#define MAC_PCU_REG_BFCOEF1_TSF_FIELD 23:0 -#define MAC_PCU_REG_BFCOEF1_KEY_VALID_RESET 1'b0 - -#define MAC_PCU_REG_BFCOEF2_OFFSET 'h70 -#define MAC_PCU_REG_BFCOEF2_THRESH_FIELD 22:0 -#define MAC_PCU_REG_BFCOEF2_LOCK_FIELD 31:24 -#define MAC_PCU_REG_BFCOEF2_THRESH_RESET 23'b0 -#define MAC_PCU_REG_BFCOEF2_LOCK_RESET 8'b0 - -#define MAC_PCU_REG_KCMASK_OFFSET 'h71 -#define MAC_PCU_REG_KCMASK_47_32_FIELD 15:0 -#define MAC_PCU_REG_KCMASK_47_32_RESET 0 -#define MAC_PCU_REG_KCMASK_31_0_FIELD 16 -#define MAC_PCU_REG_KCMASK_31_0_RESET 0 - -#define MAC_PCU_REG_TXSIFS_OFFSET 'h74 -#define MAC_PCU_REG_TXSIFS_SIFS_TIME_FIELD 7:0 -#define MAC_PCU_REG_TXSIFS_TX_LATENCY_FIELD 11:8 -#define MAC_PCU_REG_TXSIFS_ACK_SHIFT_FIELD 14:12 -#define MAC_PCU_REG_TXSIFS_SIFS_TIME_RESET 16 -#define MAC_PCU_REG_TXSIFS_TX_LATENCY_RESET 2 -#define MAC_PCU_REG_TXSIFS_ACK_SHIFT_RESET 3 - -#define MAC_PCU_REG_TXOP_X_OFFSET 'h7b -#define MAC_PCU_REG_TXOP_X_FIELD 7:0 -#define MAC_PCU_REG_TXOP_X_RESET 0 - -#define MAC_PCU_REG_TXOP_0_3_OFFSET 'h7c -#define MAC_PCU_REG_TXOP_0_FIELD 7:0 -#define MAC_PCU_REG_TXOP_1_FIELD 15:8 -#define MAC_PCU_REG_TXOP_2_FIELD 23:16 -#define MAC_PCU_REG_TXOP_3_FIELD 31:24 -#define MAC_PCU_REG_TXOP_0_RESET 0 -#define MAC_PCU_REG_TXOP_1_RESET 0 -#define MAC_PCU_REG_TXOP_2_RESET 0 -#define MAC_PCU_REG_TXOP_3_RESET 0 - -#define MAC_PCU_REG_TXOP_4_7_OFFSET 'h7d -#define MAC_PCU_REG_TXOP_4_FIELD 7:0 -#define MAC_PCU_REG_TXOP_5_FIELD 15:8 -#define MAC_PCU_REG_TXOP_6_FIELD 23:16 -#define MAC_PCU_REG_TXOP_7_FIELD 31:24 -#define MAC_PCU_REG_TXOP_4_RESET 0 -#define MAC_PCU_REG_TXOP_5_RESET 0 -#define MAC_PCU_REG_TXOP_6_RESET 0 -#define MAC_PCU_REG_TXOP_7_RESET 0 - -#define MAC_PCU_REG_TXOP_8_11_OFFSET 'h7e -#define MAC_PCU_REG_TXOP_8_FIELD 7:0 -#define MAC_PCU_REG_TXOP_9_FIELD 15:8 -#define MAC_PCU_REG_TXOP_10_FIELD 23:16 -#define MAC_PCU_REG_TXOP_11_FIELD 31:24 -#define MAC_PCU_REG_TXOP_8_RESET 0 -#define MAC_PCU_REG_TXOP_9_RESET 0 -#define MAC_PCU_REG_TXOP_10_RESET 0 -#define MAC_PCU_REG_TXOP_11_RESET 0 - -#define MAC_PCU_REG_TXOP_12_15_OFFSET 'h7f -#define MAC_PCU_REG_TXOP_12_FIELD 7:0 -#define MAC_PCU_REG_TXOP_13_FIELD 15:8 -#define MAC_PCU_REG_TXOP_14_FIELD 23:16 -#define MAC_PCU_REG_TXOP_15_FIELD 31:24 -#define MAC_PCU_REG_TXOP_12_RESET 0 -#define MAC_PCU_REG_TXOP_13_RESET 0 -#define MAC_PCU_REG_TXOP_14_RESET 0 -#define MAC_PCU_REG_TXOP_15_RESET 0 - -#define MAC_PCU_REG_GNRCTMR_N_OFFSET 'h80 -#define MAC_PCU_REG_GNRCTMR_N_UPPER_OFFSET 'h87 -#define MAC_PCU_REG_GNRCTMR_N_FIELD 31:0 - -#define MAC_PCU_REG_GNRCTMR_P_OFFSET 'h88 -#define MAC_PCU_REG_GNRCTMR_P_UPPER_OFFSET 'h8F -#define MAC_PCU_REG_GNRCTMR_P_FIELD 27:0 - -#define MAC_PCU_REG_GNRCTMR_M_OFFSET 'h90 -#define MAC_PCU_REG_GNRCTMR_M_ENABLE_FIELD 7:0 -#define MAC_PCU_REG_GNRCTMR_M_OVERFLOW_INDEX_FIELD 10:8 -#define MAC_PCU_REG_GNRCTMR_M_THRESH_FIELD 31:12 -#define MAC_PCU_REG_GNRCTMR_M_ENABLE_RESET 8'h0 -#define MAC_PCU_REG_GNRCTMR_M_THRESH_RESET 20'h00100 - -#define MAC_PCU_REG_SLP32_MODE_OFFSET 'h91 -#define MAC_PCU_REG_SLP32_MODE_HALF_CLK_LATENCY_FIELD 19:0 -#define MAC_PCU_REG_SLP32_MODE_ENABLE_FIELD 20 -#define MAC_PCU_REG_SLP32_MODE_TSF_WRITE_STAT_FIELD 21 -#define MAC_PCU_REG_SLP32_MODE_HALF_CLK_LATENCY_RESET 20'h0F424 -#define MAC_PCU_REG_SLP32_MODE_ENABLE_RESET 1'b1 - -#define MAC_PCU_REG_SLP32_WAKE_OFFSET 'h92 -#define MAC_PCU_REG_SLP32_WAKE_XTL_TIME_FIELD 15:0 -#define MAC_PCU_REG_SLP32_WAKE_XTL_TIME_RESET 16'h07EF - -#define MAC_PCU_REG_SLP32_TSF_INC_OFFSET 'h93 -#define MAC_PCU_REG_SLP32_TSF_INC_FIELD 19:0 -#define MAC_PCU_REG_SLP32_TSF_INC_RESET 20'h1E848 - -#define MAC_PCU_REG_SLPMIB1_OFFSET 'h94 -#define MAC_PCU_REG_SLPMIB1_SLEEP_CNT_FIELD 31:0 - -#define MAC_PCU_REG_SLPMIB2_OFFSET 'h95 -#define MAC_PCU_REG_SLPMIB2_CYCLE_CNT_FIELD 31:0 - -#define MAC_PCU_REG_SLPMIB3_OFFSET 'h96 -#define MAC_PCU_REG_SLPMIB3_CLR_CNT_FIELD 0 -#define MAC_PCU_REG_SLPMIB3_PEND_FIELD 1 - -#define MAC_PCU_REG_MISCMODE2_OFFSET 'h97 -#define MAC_PCU_REG_MISCMODE2_MGMT_CRYPTO_ENABLE_FIELD 0 -#define MAC_PCU_REG_MISCMODE2_NO_CRYPTO_FOR_NON_DATA_PKT_FIELD 1 -#define MAC_PCU_REG_MISCMODE2_MGMT_QOS_FIELD 15:8 -#define MAC_PCU_REG_MISCMODE2_BC_MC_WAPI_MODE_FIELD 16 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_FOR_1ST_PKT_FIELD 17 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_IF_ZERO_FIELD 18 -#define MAC_PCU_REG_MISCMODE2_MGMT_CRYPTO_ENABLE_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE2_NO_CRYPTO_FOR_NON_DATA_PKT_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE2_MGMT_QOS_RESET 8'h10 -#define MAC_PCU_REG_MISCMODE2_BC_MC_WAPI_MODE_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_FOR_1ST_PKT_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_IF_ZERO_RESET 1'h0 - -#define MAC_PCU_REG_SLP4_OFFSET 'h98 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_DUR_FIELD 15:0 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_ENABLE_FIELD 16 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_DUR_RESET 16'h5 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_ENABLE_RESET 1'h0 - -#define MAC_PCU_REG_SLP5_OFFSET 'h99 -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_FIELD 23:0 -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_ENABLE_FIELD 24 -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_RESET 24'hff_ffff -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_ENABLE_RESET 1'h0 - -#define MAC_PCU_REG_MCICTL_OFFSET 'h9a -#define MAC_PCU_REG_MCICTL_MCI_ENABLE_FIELD 0 -#define MAC_PCU_REG_MCICTL_OLA_ENABLE_FIELD 1 -#define MAC_PCU_REG_MCICTL_PREEMPT_ENABLE_FIELD 2 -#define MAC_PCU_REG_MCICTL_CHANNEL_BUSY_ENABLE_FIELD 3 -#define MAC_PCU_REG_MCICTL_EARLY_NOTIFY_DELAY_FIELD 9:4 -#define MAC_PCU_REG_MCICTL_BMISS_FORCE_WL_FIELD 10 -#define MAC_PCU_REG_MCICTL_SLEEP_FORCE_BT_FIELD 11 -#define MAC_PCU_REG_MCICTL_HP_QCU_STOMP_BT_FIELD 12 -#define MAC_PCU_REG_MCICTL_MCI_BUSY_FIELD 31 -#define MAC_PCU_REG_MCICTL_MCI_ENABLE_RESET 1'h0 -#define MAC_PCU_REG_MCICTL_OLA_ENABLE_RESET 1'h1 -#define MAC_PCU_REG_MCICTL_PREEMPT_ENABLE_RESET 1'h1 -#define MAC_PCU_REG_MCICTL_CHANNEL_BUSY_ENABLE_RESET 1'h1 -#define MAC_PCU_REG_MCICTL_EARLY_NOTIFY_DELAY_RESET 6'h5 -#define MAC_PCU_REG_MCICTL_BMISS_FORCE_WL_RESET 1'b0 -#define MAC_PCU_REG_MCICTL_SLEEP_FORCE_BT_RESET 1'b1 -#define MAC_PCU_REG_MCICTL_HP_QCU_STOMP_BT_RESET 1'b0 - -#define MAC_PCU_REG_MCIISR_OFFSET 'h9b -#define MAC_PCU_REG_MCIISR_ACT_RPT_RCV_INT_FIELD 0 -#define MAC_PCU_REG_MCIISR_ACT_DEN_RCV_INT_FIELD 1 -#define MAC_PCU_REG_MCIISR_FRQ_RPT_RCV_INT_FIELD 2 -#define MAC_PCU_REG_MCIISR_QOS_RPT_RCV_INT_FIELD 3 -#define MAC_PCU_REG_MCIISR_GEN_RPT_RCV_INT_FIELD 4 -#define MAC_PCU_REG_MCIISR_ACT_RPT_RCV_INT_RESET 1'b0 -#define MAC_PCU_REG_MCIISR_ACT_DEN_RCV_INT_RESET 1'b0 -#define MAC_PCU_REG_MCIISR_FRQ_RPT_RCV_INT_RESET 1'b0 -#define MAC_PCU_REG_MCIISR_QOS_RPT_RCV_INT_RESET 1'b0 -#define MAC_PCU_REG_MCIISR_GEN_RPT_RCV_INT_RESET 1'b0 - -#define MAC_PCU_REG_MCIIER_OFFSET 'h9c -#define MAC_PCU_REG_MCIIER_ACT_RPT_RCV_INT_ENABLE_FIELD 0 -#define MAC_PCU_REG_MCIIER_ACT_DEN_RCV_INT_ENABLE_FIELD 1 -#define MAC_PCU_REG_MCIIER_FRQ_RPT_RCV_INT_ENABLE_FIELD 2 -#define MAC_PCU_REG_MCIIER_QOS_RPT_RCV_INT_ENABLE_FIELD 3 -#define MAC_PCU_REG_MCIIER_GEN_RPT_RCV_INT_ENABLE_FIELD 4 -#define MAC_PCU_REG_MCIIER_ACT_RPT_RCV_INT_ENABLE_RESET 1'b0 -#define MAC_PCU_REG_MCIIER_ACT_DEN_RCV_INT_ENABLE_RESET 1'b0 -#define MAC_PCU_REG_MCIIER_FRQ_RPT_RCV_INT_ENABLE_RESET 1'b0 -#define MAC_PCU_REG_MCIIER_QOS_RPT_RCV_INT_ENABLE_RESET 1'b0 -#define MAC_PCU_REG_MCIIER_GEN_RPT_RCV_INT_ENABLE_RESET 1'b0 - -#define MAC_PCU_REG_MCIWLP_OFFSET 'h9d -#define MAC_PCU_REG_MCIWLP_RESET 30'h0 - -#define MAC_PCU_REG_MCIARW_OFFSET 'h9e -#define MAC_PCU_REG_MCIARW_RESET 32'h0 - -#define MAC_PCU_REG_MCIARR_OFFSET 'h9f - -#define MAC_PCU_REG_MCIADW_OFFSET 'ha0 -#define MAC_PCU_REG_MCIADW_RESET 32'h0 - -#define MAC_PCU_REG_MCIADR_OFFSET 'ha1 - -#define MAC_PCU_REG_MCIFRW_OFFSET 'ha2 -#define MAC_PCU_REG_MCIFRW_RESET 32'h0 - -#define MAC_PCU_REG_MCIFRR_OFFSET 'ha3 - -#define MAC_PCU_REG_MCIQRW_OFFSET 'ha4 -#define MAC_PCU_REG_MCIQRW_RESET 32'h0 - -#define MAC_PCU_REG_MCIQRR_OFFSET 'ha5 - -#define MAC_PCU_REG_MCIGRW_OFFSET 'ha6 -#define MAC_PCU_REG_MCIGRW_RESET 32'h0 - -#define MAC_PCU_REG_MCIGRR_OFFSET 'ha7 - -#define MAC_PCU_REG_MCISTAT_OFFSET 'ha8 -#define MAC_PCU_REG_MCISTAT_ACT_RPT_RCV_CNT_FIELD 7:0 -#define MAC_PCU_REG_MCISTAT_QC_CNT_FIELD 15:8 -#define MAC_PCU_REG_MCISTAT_OLA_CNT_FIELD 23:16 -#define MAC_PCU_REG_MCISTAT_PREEMPT_CNT_FIELD 31:24 -#define MAC_PCU_REG_MCISTAT_ACT_RPT_RCV_CNT_RESET 8'h0 -#define MAC_PCU_REG_MCISTAT_QC_CNT_RESET 8'h0 -#define MAC_PCU_REG_MCISTAT_OLA_CNT_RESET 8'h0 -#define MAC_PCU_REG_MCISTAT_PREEMPT_CNT_RESET 8'h0 - -#define MAC_PCU_REG_BASIC_RATE_SET0_OFFSET 'ha9 -#define MAC_PCU_REG_BRATE_1MB_L_FIELD 4:0 -#define MAC_PCU_REG_BRATE_2MB_L_FIELD 9:5 -#define MAC_PCU_REG_BRATE_2MB_S_FIELD 14:10 -#define MAC_PCU_REG_BRATE_5_5MB_L_FIELD 19:15 -#define MAC_PCU_REG_BRATE_5_5MB_S_FIELD 24:20 -#define MAC_PCU_REG_BRATE_11MB_L_FIELD 29:25 -#define MAC_PCU_REG_BRATE_1MB_L_RESET #CCK_RATE_1Mb_L -#define MAC_PCU_REG_BRATE_2MB_L_RESET #CCK_RATE_2Mb_L -#define MAC_PCU_REG_BRATE_2MB_S_RESET #CCK_RATE_2Mb_S -#define MAC_PCU_REG_BRATE_5_5MB_L_RESET #CCK_RATE_5_5Mb_L -#define MAC_PCU_REG_BRATE_5_5MB_S_RESET #CCK_RATE_5_5Mb_S -#define MAC_PCU_REG_BRATE_11MB_L_RESET #CCK_RATE_11Mb_L - -#define MAC_PCU_REG_BASIC_RATE_SET1_OFFSET 'haa -#define MAC_PCU_REG_BRATE_11MB_S_FIELD 4:0 -#define MAC_PCU_REG_BRATE_6MB_FIELD 9:5 -#define MAC_PCU_REG_BRATE_9MB_FIELD 14:10 -#define MAC_PCU_REG_BRATE_12MB_FIELD 19:15 -#define MAC_PCU_REG_BRATE_18MB_FIELD 24:20 -#define MAC_PCU_REG_BRATE_24MB_FIELD 29:25 -#define MAC_PCU_REG_BRATE_11MB_S_RESET #CCK_RATE_11Mb_S -#define MAC_PCU_REG_BRATE_6MB_RESET #OFDM_RATE_6Mb -#define MAC_PCU_REG_BRATE_9MB_RESET #OFDM_RATE_6Mb -#define MAC_PCU_REG_BRATE_12MB_RESET #OFDM_RATE_12Mb -#define MAC_PCU_REG_BRATE_18MB_RESET #OFDM_RATE_12Mb -#define MAC_PCU_REG_BRATE_24MB_RESET #OFDM_RATE_24Mb - -#define MAC_PCU_REG_BASIC_RATE_SET2_OFFSET 'hab -#define MAC_PCU_REG_BRATE_36MB_FIELD 4:0 -#define MAC_PCU_REG_BRATE_48MB_FIELD 9:5 -#define MAC_PCU_REG_BRATE_54MB_FIELD 14:10 -#define MAC_PCU_REG_BRATE_36MB_RESET #OFDM_RATE_24Mb -#define MAC_PCU_REG_BRATE_48MB_RESET #OFDM_RATE_24Mb -#define MAC_PCU_REG_BRATE_54MB_RESET #OFDM_RATE_24Mb - -#define MAC_PCU_REG_SEC_BSSID_L32_OFFSET 'hac -#define MAC_PCU_REG_SEC_BSSID_L32_FIELD 31:0 -#define MAC_PCU_REG_SEC_BSSID_L32_RESET 32'h0 - -#define MAC_PCU_REG_SEC_BSSID_U16_OFFSET 'had -#define MAC_PCU_REG_SEC_BSSID_U16_FIELD 15:0 -#define MAC_PCU_REG_SEC_BSSID_ENABLE_FIELD 16 -#define MAC_PCU_REG_SEC_BSSID_U16_RESET 16'h0 -#define MAC_PCU_REG_SEC_BSSID_ENABLE_RESET 1'b0 - -#define MAC_PCU_REG_FTYPE_OFFSET 'h140 -#define MAC_PCU_REG_FTYPE_UPPER_OFFSET 'h17F -#define MAC_PCU_REG_FTYPE_BFCOEF_RX_UPDATE_NORMAL_FIELD 0 -#define MAC_PCU_REG_FTYPE_BFCOEF_RX_UPDATE_SELF_GEN_FIELD 1 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_NORMAL_FIELD 2 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_SELF_GEN_FIELD 3 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_GEN_FIELD 4 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_MCAST_FIELD 5 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_ALL_FIELD 6 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_DIRECTED_FIELD 7 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_MCAST_FIELD 8 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_BCAST_FIELD 9 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_MC_BC_BSSID_FIELD 10 - -#define MAC_PCU_REG_ACKSIFSMEM_OFFSET_RESERVED 'h1A0 -#define MAC_PCU_REG_ACKSIFSMEM_UPPER_OFFSET_RESERVED 'h1BF -#define MAC_PCU_REG_ACKSIFSMEM_NORMAL_FIELD_RESERVED 9:0 -#define MAC_PCU_REG_ACKSIFSMEM_TURBO_FIELD_RESERVED 19:10 - -#define MAC_PCU_REG_DUR_OFFSET 'h1C0 -#define MAC_PCU_REG_DUR_UPPER_OFFSET 'h1DF -#define MAC_PCU_REG_DUR_RATE_TO_DURATION_FIELD 15:0 - -#define MAC_PCU_REG_RTD_OFFSET 'h1F0 -#define MAC_PCU_REG_RTD_UPPER_OFFSET 'h1F7 -#define MAC_PCU_REG_RTD_RATE_TO_DB_0_FIELD 4:0 -#define MAC_PCU_REG_RTD_RATE_TO_DB_1_FIELD 12:8 -#define MAC_PCU_REG_RTD_RATE_TO_DB_2_FIELD 20:16 -#define MAC_PCU_REG_RTD_RATE_TO_DB_3_FIELD 28:24 - -#define MAC_PCU_REG_DTR_OFFSET 'h1F8 -#define MAC_PCU_REG_DTR_UPPER_OFFSET 'h1FF -#define MAC_PCU_REG_DTR_DB_TO_RATE_0_FIELD 4:0 -#define MAC_PCU_REG_DTR_DB_TO_RATE_1_FIELD 12:8 -#define MAC_PCU_REG_DTR_DB_TO_RATE_2_FIELD 20:16 -#define MAC_PCU_REG_DTR_DB_TO_RATE_3_FIELD 28:24 - -#define MAC_PCU_REG_KC_OFFSET 'h200 -#define MAC_PCU_REG_KC_UPPER_OFFSET 'h5FF -#define MAC_PCU_REG_KC_KEY_31_0_FIELD 31:0 -#define MAC_PCU_REG_KC_KEY_47_32_FIELD 15:0 -#define MAC_PCU_REG_KC_KEY_79_48_FIELD 31:0 -#define MAC_PCU_REG_KC_KEY_95_80_FIELD 15:0 -#define MAC_PCU_REG_KC_KEY_127_96_FIELD 31:0 -#define MAC_PCU_REG_KC_KEY_TYPE_FIELD 2:0 -#define MAC_PCU_REG_KC_LAST_ANTENNA_FIELD 3 -#define MAC_PCU_REG_KC_ASYNC_ACK_OFFSET_FIELD 8:4 -#define MAC_PCU_REG_KC_UPDATE_BEAM_FORMING_FIELD 9 -#define MAC_PCU_REG_KC_RX_CHAIN_0_ACK_ANT_FIELD 10 -#define MAC_PCU_REG_KC_RX_CHAIN_1_ACK_ANT_FIELD 11 -#define MAC_PCU_REG_KC_TX_CHAIN_0_ANT_SEL_FIELD 12 -#define MAC_PCU_REG_KC_TX_CHAIN_1_ANT_SEL_FIELD 13 -#define MAC_PCU_REG_KC_TX_CHAIN_SEL_FIELD 14 -#define MAC_PCU_REG_KC_ADDR_32_1_FIELD 31:0 -#define MAC_PCU_REG_KC_ADDR_47_33_FIELD 14:0 -#define MAC_PCU_REG_KC_VALID_FIELD 1 - -//Misc -#define ELEM_START 36 -#define CFP_ELEM 4 - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/mbox_host_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/mbox_host_reg.h deleted file mode 100644 index f836ae47a303..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/mbox_host_reg.h +++ /dev/null @@ -1,386 +0,0 @@ -#ifndef _MBOX_HOST_REG_REG_H_ -#define _MBOX_HOST_REG_REG_H_ - -#define HOST_INT_STATUS_ADDRESS 0x00000400 -#define HOST_INT_STATUS_OFFSET 0x00000400 -#define HOST_INT_STATUS_ERROR_MSB 7 -#define HOST_INT_STATUS_ERROR_LSB 7 -#define HOST_INT_STATUS_ERROR_MASK 0x00000080 -#define HOST_INT_STATUS_ERROR_GET(x) (((x) & HOST_INT_STATUS_ERROR_MASK) >> HOST_INT_STATUS_ERROR_LSB) -#define HOST_INT_STATUS_ERROR_SET(x) (((x) << HOST_INT_STATUS_ERROR_LSB) & HOST_INT_STATUS_ERROR_MASK) -#define HOST_INT_STATUS_CPU_MSB 6 -#define HOST_INT_STATUS_CPU_LSB 6 -#define HOST_INT_STATUS_CPU_MASK 0x00000040 -#define HOST_INT_STATUS_CPU_GET(x) (((x) & HOST_INT_STATUS_CPU_MASK) >> HOST_INT_STATUS_CPU_LSB) -#define HOST_INT_STATUS_CPU_SET(x) (((x) << HOST_INT_STATUS_CPU_LSB) & HOST_INT_STATUS_CPU_MASK) -#define HOST_INT_STATUS_DRAGON_INT_MSB 5 -#define HOST_INT_STATUS_DRAGON_INT_LSB 5 -#define HOST_INT_STATUS_DRAGON_INT_MASK 0x00000020 -#define HOST_INT_STATUS_DRAGON_INT_GET(x) (((x) & HOST_INT_STATUS_DRAGON_INT_MASK) >> HOST_INT_STATUS_DRAGON_INT_LSB) -#define HOST_INT_STATUS_DRAGON_INT_SET(x) (((x) << HOST_INT_STATUS_DRAGON_INT_LSB) & HOST_INT_STATUS_DRAGON_INT_MASK) -#define HOST_INT_STATUS_COUNTER_MSB 4 -#define HOST_INT_STATUS_COUNTER_LSB 4 -#define HOST_INT_STATUS_COUNTER_MASK 0x00000010 -#define HOST_INT_STATUS_COUNTER_GET(x) (((x) & HOST_INT_STATUS_COUNTER_MASK) >> HOST_INT_STATUS_COUNTER_LSB) -#define HOST_INT_STATUS_COUNTER_SET(x) (((x) << HOST_INT_STATUS_COUNTER_LSB) & HOST_INT_STATUS_COUNTER_MASK) -#define HOST_INT_STATUS_MBOX_DATA_MSB 3 -#define HOST_INT_STATUS_MBOX_DATA_LSB 0 -#define HOST_INT_STATUS_MBOX_DATA_MASK 0x0000000f -#define HOST_INT_STATUS_MBOX_DATA_GET(x) (((x) & HOST_INT_STATUS_MBOX_DATA_MASK) >> HOST_INT_STATUS_MBOX_DATA_LSB) -#define HOST_INT_STATUS_MBOX_DATA_SET(x) (((x) << HOST_INT_STATUS_MBOX_DATA_LSB) & HOST_INT_STATUS_MBOX_DATA_MASK) - -#define CPU_INT_STATUS_ADDRESS 0x00000401 -#define CPU_INT_STATUS_OFFSET 0x00000401 -#define CPU_INT_STATUS_BIT_MSB 7 -#define CPU_INT_STATUS_BIT_LSB 0 -#define CPU_INT_STATUS_BIT_MASK 0x000000ff -#define CPU_INT_STATUS_BIT_GET(x) (((x) & CPU_INT_STATUS_BIT_MASK) >> CPU_INT_STATUS_BIT_LSB) -#define CPU_INT_STATUS_BIT_SET(x) (((x) << CPU_INT_STATUS_BIT_LSB) & CPU_INT_STATUS_BIT_MASK) - -#define ERROR_INT_STATUS_ADDRESS 0x00000402 -#define ERROR_INT_STATUS_OFFSET 0x00000402 -#define ERROR_INT_STATUS_SPI_MSB 3 -#define ERROR_INT_STATUS_SPI_LSB 3 -#define ERROR_INT_STATUS_SPI_MASK 0x00000008 -#define ERROR_INT_STATUS_SPI_GET(x) (((x) & ERROR_INT_STATUS_SPI_MASK) >> ERROR_INT_STATUS_SPI_LSB) -#define ERROR_INT_STATUS_SPI_SET(x) (((x) << ERROR_INT_STATUS_SPI_LSB) & ERROR_INT_STATUS_SPI_MASK) -#define ERROR_INT_STATUS_WAKEUP_MSB 2 -#define ERROR_INT_STATUS_WAKEUP_LSB 2 -#define ERROR_INT_STATUS_WAKEUP_MASK 0x00000004 -#define ERROR_INT_STATUS_WAKEUP_GET(x) (((x) & ERROR_INT_STATUS_WAKEUP_MASK) >> ERROR_INT_STATUS_WAKEUP_LSB) -#define ERROR_INT_STATUS_WAKEUP_SET(x) (((x) << ERROR_INT_STATUS_WAKEUP_LSB) & ERROR_INT_STATUS_WAKEUP_MASK) -#define ERROR_INT_STATUS_RX_UNDERFLOW_MSB 1 -#define ERROR_INT_STATUS_RX_UNDERFLOW_LSB 1 -#define ERROR_INT_STATUS_RX_UNDERFLOW_MASK 0x00000002 -#define ERROR_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & ERROR_INT_STATUS_RX_UNDERFLOW_MASK) >> ERROR_INT_STATUS_RX_UNDERFLOW_LSB) -#define ERROR_INT_STATUS_RX_UNDERFLOW_SET(x) (((x) << ERROR_INT_STATUS_RX_UNDERFLOW_LSB) & ERROR_INT_STATUS_RX_UNDERFLOW_MASK) -#define ERROR_INT_STATUS_TX_OVERFLOW_MSB 0 -#define ERROR_INT_STATUS_TX_OVERFLOW_LSB 0 -#define ERROR_INT_STATUS_TX_OVERFLOW_MASK 0x00000001 -#define ERROR_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & ERROR_INT_STATUS_TX_OVERFLOW_MASK) >> ERROR_INT_STATUS_TX_OVERFLOW_LSB) -#define ERROR_INT_STATUS_TX_OVERFLOW_SET(x) (((x) << ERROR_INT_STATUS_TX_OVERFLOW_LSB) & ERROR_INT_STATUS_TX_OVERFLOW_MASK) - -#define COUNTER_INT_STATUS_ADDRESS 0x00000403 -#define COUNTER_INT_STATUS_OFFSET 0x00000403 -#define COUNTER_INT_STATUS_COUNTER_MSB 7 -#define COUNTER_INT_STATUS_COUNTER_LSB 0 -#define COUNTER_INT_STATUS_COUNTER_MASK 0x000000ff -#define COUNTER_INT_STATUS_COUNTER_GET(x) (((x) & COUNTER_INT_STATUS_COUNTER_MASK) >> COUNTER_INT_STATUS_COUNTER_LSB) -#define COUNTER_INT_STATUS_COUNTER_SET(x) (((x) << COUNTER_INT_STATUS_COUNTER_LSB) & COUNTER_INT_STATUS_COUNTER_MASK) - -#define MBOX_FRAME_ADDRESS 0x00000404 -#define MBOX_FRAME_OFFSET 0x00000404 -#define MBOX_FRAME_RX_EOM_MSB 7 -#define MBOX_FRAME_RX_EOM_LSB 4 -#define MBOX_FRAME_RX_EOM_MASK 0x000000f0 -#define MBOX_FRAME_RX_EOM_GET(x) (((x) & MBOX_FRAME_RX_EOM_MASK) >> MBOX_FRAME_RX_EOM_LSB) -#define MBOX_FRAME_RX_EOM_SET(x) (((x) << MBOX_FRAME_RX_EOM_LSB) & MBOX_FRAME_RX_EOM_MASK) -#define MBOX_FRAME_RX_SOM_MSB 3 -#define MBOX_FRAME_RX_SOM_LSB 0 -#define MBOX_FRAME_RX_SOM_MASK 0x0000000f -#define MBOX_FRAME_RX_SOM_GET(x) (((x) & MBOX_FRAME_RX_SOM_MASK) >> MBOX_FRAME_RX_SOM_LSB) -#define MBOX_FRAME_RX_SOM_SET(x) (((x) << MBOX_FRAME_RX_SOM_LSB) & MBOX_FRAME_RX_SOM_MASK) - -#define RX_LOOKAHEAD_VALID_ADDRESS 0x00000405 -#define RX_LOOKAHEAD_VALID_OFFSET 0x00000405 -#define RX_LOOKAHEAD_VALID_MBOX_MSB 3 -#define RX_LOOKAHEAD_VALID_MBOX_LSB 0 -#define RX_LOOKAHEAD_VALID_MBOX_MASK 0x0000000f -#define RX_LOOKAHEAD_VALID_MBOX_GET(x) (((x) & RX_LOOKAHEAD_VALID_MBOX_MASK) >> RX_LOOKAHEAD_VALID_MBOX_LSB) -#define RX_LOOKAHEAD_VALID_MBOX_SET(x) (((x) << RX_LOOKAHEAD_VALID_MBOX_LSB) & RX_LOOKAHEAD_VALID_MBOX_MASK) - -#define RX_LOOKAHEAD0_ADDRESS 0x00000408 -#define RX_LOOKAHEAD0_OFFSET 0x00000408 -#define RX_LOOKAHEAD0_DATA_MSB 7 -#define RX_LOOKAHEAD0_DATA_LSB 0 -#define RX_LOOKAHEAD0_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD0_DATA_GET(x) (((x) & RX_LOOKAHEAD0_DATA_MASK) >> RX_LOOKAHEAD0_DATA_LSB) -#define RX_LOOKAHEAD0_DATA_SET(x) (((x) << RX_LOOKAHEAD0_DATA_LSB) & RX_LOOKAHEAD0_DATA_MASK) - -#define RX_LOOKAHEAD1_ADDRESS 0x0000040c -#define RX_LOOKAHEAD1_OFFSET 0x0000040c -#define RX_LOOKAHEAD1_DATA_MSB 7 -#define RX_LOOKAHEAD1_DATA_LSB 0 -#define RX_LOOKAHEAD1_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD1_DATA_GET(x) (((x) & RX_LOOKAHEAD1_DATA_MASK) >> RX_LOOKAHEAD1_DATA_LSB) -#define RX_LOOKAHEAD1_DATA_SET(x) (((x) << RX_LOOKAHEAD1_DATA_LSB) & RX_LOOKAHEAD1_DATA_MASK) - -#define RX_LOOKAHEAD2_ADDRESS 0x00000410 -#define RX_LOOKAHEAD2_OFFSET 0x00000410 -#define RX_LOOKAHEAD2_DATA_MSB 7 -#define RX_LOOKAHEAD2_DATA_LSB 0 -#define RX_LOOKAHEAD2_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD2_DATA_GET(x) (((x) & RX_LOOKAHEAD2_DATA_MASK) >> RX_LOOKAHEAD2_DATA_LSB) -#define RX_LOOKAHEAD2_DATA_SET(x) (((x) << RX_LOOKAHEAD2_DATA_LSB) & RX_LOOKAHEAD2_DATA_MASK) - -#define RX_LOOKAHEAD3_ADDRESS 0x00000414 -#define RX_LOOKAHEAD3_OFFSET 0x00000414 -#define RX_LOOKAHEAD3_DATA_MSB 7 -#define RX_LOOKAHEAD3_DATA_LSB 0 -#define RX_LOOKAHEAD3_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD3_DATA_GET(x) (((x) & RX_LOOKAHEAD3_DATA_MASK) >> RX_LOOKAHEAD3_DATA_LSB) -#define RX_LOOKAHEAD3_DATA_SET(x) (((x) << RX_LOOKAHEAD3_DATA_LSB) & RX_LOOKAHEAD3_DATA_MASK) - -#define INT_STATUS_ENABLE_ADDRESS 0x00000418 -#define INT_STATUS_ENABLE_OFFSET 0x00000418 -#define INT_STATUS_ENABLE_ERROR_MSB 7 -#define INT_STATUS_ENABLE_ERROR_LSB 7 -#define INT_STATUS_ENABLE_ERROR_MASK 0x00000080 -#define INT_STATUS_ENABLE_ERROR_GET(x) (((x) & INT_STATUS_ENABLE_ERROR_MASK) >> INT_STATUS_ENABLE_ERROR_LSB) -#define INT_STATUS_ENABLE_ERROR_SET(x) (((x) << INT_STATUS_ENABLE_ERROR_LSB) & INT_STATUS_ENABLE_ERROR_MASK) -#define INT_STATUS_ENABLE_CPU_MSB 6 -#define INT_STATUS_ENABLE_CPU_LSB 6 -#define INT_STATUS_ENABLE_CPU_MASK 0x00000040 -#define INT_STATUS_ENABLE_CPU_GET(x) (((x) & INT_STATUS_ENABLE_CPU_MASK) >> INT_STATUS_ENABLE_CPU_LSB) -#define INT_STATUS_ENABLE_CPU_SET(x) (((x) << INT_STATUS_ENABLE_CPU_LSB) & INT_STATUS_ENABLE_CPU_MASK) -#define INT_STATUS_ENABLE_DRAGON_INT_MSB 5 -#define INT_STATUS_ENABLE_DRAGON_INT_LSB 5 -#define INT_STATUS_ENABLE_DRAGON_INT_MASK 0x00000020 -#define INT_STATUS_ENABLE_DRAGON_INT_GET(x) (((x) & INT_STATUS_ENABLE_DRAGON_INT_MASK) >> INT_STATUS_ENABLE_DRAGON_INT_LSB) -#define INT_STATUS_ENABLE_DRAGON_INT_SET(x) (((x) << INT_STATUS_ENABLE_DRAGON_INT_LSB) & INT_STATUS_ENABLE_DRAGON_INT_MASK) -#define INT_STATUS_ENABLE_COUNTER_MSB 4 -#define INT_STATUS_ENABLE_COUNTER_LSB 4 -#define INT_STATUS_ENABLE_COUNTER_MASK 0x00000010 -#define INT_STATUS_ENABLE_COUNTER_GET(x) (((x) & INT_STATUS_ENABLE_COUNTER_MASK) >> INT_STATUS_ENABLE_COUNTER_LSB) -#define INT_STATUS_ENABLE_COUNTER_SET(x) (((x) << INT_STATUS_ENABLE_COUNTER_LSB) & INT_STATUS_ENABLE_COUNTER_MASK) -#define INT_STATUS_ENABLE_MBOX_DATA_MSB 3 -#define INT_STATUS_ENABLE_MBOX_DATA_LSB 0 -#define INT_STATUS_ENABLE_MBOX_DATA_MASK 0x0000000f -#define INT_STATUS_ENABLE_MBOX_DATA_GET(x) (((x) & INT_STATUS_ENABLE_MBOX_DATA_MASK) >> INT_STATUS_ENABLE_MBOX_DATA_LSB) -#define INT_STATUS_ENABLE_MBOX_DATA_SET(x) (((x) << INT_STATUS_ENABLE_MBOX_DATA_LSB) & INT_STATUS_ENABLE_MBOX_DATA_MASK) - -#define CPU_INT_STATUS_ENABLE_ADDRESS 0x00000419 -#define CPU_INT_STATUS_ENABLE_OFFSET 0x00000419 -#define CPU_INT_STATUS_ENABLE_BIT_MSB 7 -#define CPU_INT_STATUS_ENABLE_BIT_LSB 0 -#define CPU_INT_STATUS_ENABLE_BIT_MASK 0x000000ff -#define CPU_INT_STATUS_ENABLE_BIT_GET(x) (((x) & CPU_INT_STATUS_ENABLE_BIT_MASK) >> CPU_INT_STATUS_ENABLE_BIT_LSB) -#define CPU_INT_STATUS_ENABLE_BIT_SET(x) (((x) << CPU_INT_STATUS_ENABLE_BIT_LSB) & CPU_INT_STATUS_ENABLE_BIT_MASK) - -#define ERROR_STATUS_ENABLE_ADDRESS 0x0000041a -#define ERROR_STATUS_ENABLE_OFFSET 0x0000041a -#define ERROR_STATUS_ENABLE_WAKEUP_MSB 2 -#define ERROR_STATUS_ENABLE_WAKEUP_LSB 2 -#define ERROR_STATUS_ENABLE_WAKEUP_MASK 0x00000004 -#define ERROR_STATUS_ENABLE_WAKEUP_GET(x) (((x) & ERROR_STATUS_ENABLE_WAKEUP_MASK) >> ERROR_STATUS_ENABLE_WAKEUP_LSB) -#define ERROR_STATUS_ENABLE_WAKEUP_SET(x) (((x) << ERROR_STATUS_ENABLE_WAKEUP_LSB) & ERROR_STATUS_ENABLE_WAKEUP_MASK) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MSB 1 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB 1 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 0x00000002 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK) >> ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_SET(x) (((x) << ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) & ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_MSB 0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB 0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK 0x00000001 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) >> ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_SET(x) (((x) << ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) & ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) - -#define COUNTER_INT_STATUS_ENABLE_ADDRESS 0x0000041b -#define COUNTER_INT_STATUS_ENABLE_OFFSET 0x0000041b -#define COUNTER_INT_STATUS_ENABLE_BIT_MSB 7 -#define COUNTER_INT_STATUS_ENABLE_BIT_LSB 0 -#define COUNTER_INT_STATUS_ENABLE_BIT_MASK 0x000000ff -#define COUNTER_INT_STATUS_ENABLE_BIT_GET(x) (((x) & COUNTER_INT_STATUS_ENABLE_BIT_MASK) >> COUNTER_INT_STATUS_ENABLE_BIT_LSB) -#define COUNTER_INT_STATUS_ENABLE_BIT_SET(x) (((x) << COUNTER_INT_STATUS_ENABLE_BIT_LSB) & COUNTER_INT_STATUS_ENABLE_BIT_MASK) - -#define COUNT_ADDRESS 0x00000420 -#define COUNT_OFFSET 0x00000420 -#define COUNT_VALUE_MSB 7 -#define COUNT_VALUE_LSB 0 -#define COUNT_VALUE_MASK 0x000000ff -#define COUNT_VALUE_GET(x) (((x) & COUNT_VALUE_MASK) >> COUNT_VALUE_LSB) -#define COUNT_VALUE_SET(x) (((x) << COUNT_VALUE_LSB) & COUNT_VALUE_MASK) - -#define COUNT_DEC_ADDRESS 0x00000440 -#define COUNT_DEC_OFFSET 0x00000440 -#define COUNT_DEC_VALUE_MSB 7 -#define COUNT_DEC_VALUE_LSB 0 -#define COUNT_DEC_VALUE_MASK 0x000000ff -#define COUNT_DEC_VALUE_GET(x) (((x) & COUNT_DEC_VALUE_MASK) >> COUNT_DEC_VALUE_LSB) -#define COUNT_DEC_VALUE_SET(x) (((x) << COUNT_DEC_VALUE_LSB) & COUNT_DEC_VALUE_MASK) - -#define SCRATCH_ADDRESS 0x00000460 -#define SCRATCH_OFFSET 0x00000460 -#define SCRATCH_VALUE_MSB 7 -#define SCRATCH_VALUE_LSB 0 -#define SCRATCH_VALUE_MASK 0x000000ff -#define SCRATCH_VALUE_GET(x) (((x) & SCRATCH_VALUE_MASK) >> SCRATCH_VALUE_LSB) -#define SCRATCH_VALUE_SET(x) (((x) << SCRATCH_VALUE_LSB) & SCRATCH_VALUE_MASK) - -#define FIFO_TIMEOUT_ADDRESS 0x00000468 -#define FIFO_TIMEOUT_OFFSET 0x00000468 -#define FIFO_TIMEOUT_VALUE_MSB 7 -#define FIFO_TIMEOUT_VALUE_LSB 0 -#define FIFO_TIMEOUT_VALUE_MASK 0x000000ff -#define FIFO_TIMEOUT_VALUE_GET(x) (((x) & FIFO_TIMEOUT_VALUE_MASK) >> FIFO_TIMEOUT_VALUE_LSB) -#define FIFO_TIMEOUT_VALUE_SET(x) (((x) << FIFO_TIMEOUT_VALUE_LSB) & FIFO_TIMEOUT_VALUE_MASK) - -#define FIFO_TIMEOUT_ENABLE_ADDRESS 0x00000469 -#define FIFO_TIMEOUT_ENABLE_OFFSET 0x00000469 -#define FIFO_TIMEOUT_ENABLE_SET_MSB 0 -#define FIFO_TIMEOUT_ENABLE_SET_LSB 0 -#define FIFO_TIMEOUT_ENABLE_SET_MASK 0x00000001 -#define FIFO_TIMEOUT_ENABLE_SET_GET(x) (((x) & FIFO_TIMEOUT_ENABLE_SET_MASK) >> FIFO_TIMEOUT_ENABLE_SET_LSB) -#define FIFO_TIMEOUT_ENABLE_SET_SET(x) (((x) << FIFO_TIMEOUT_ENABLE_SET_LSB) & FIFO_TIMEOUT_ENABLE_SET_MASK) - -#define DISABLE_SLEEP_ADDRESS 0x0000046a -#define DISABLE_SLEEP_OFFSET 0x0000046a -#define DISABLE_SLEEP_FOR_INT_MSB 1 -#define DISABLE_SLEEP_FOR_INT_LSB 1 -#define DISABLE_SLEEP_FOR_INT_MASK 0x00000002 -#define DISABLE_SLEEP_FOR_INT_GET(x) (((x) & DISABLE_SLEEP_FOR_INT_MASK) >> DISABLE_SLEEP_FOR_INT_LSB) -#define DISABLE_SLEEP_FOR_INT_SET(x) (((x) << DISABLE_SLEEP_FOR_INT_LSB) & DISABLE_SLEEP_FOR_INT_MASK) -#define DISABLE_SLEEP_ON_MSB 0 -#define DISABLE_SLEEP_ON_LSB 0 -#define DISABLE_SLEEP_ON_MASK 0x00000001 -#define DISABLE_SLEEP_ON_GET(x) (((x) & DISABLE_SLEEP_ON_MASK) >> DISABLE_SLEEP_ON_LSB) -#define DISABLE_SLEEP_ON_SET(x) (((x) << DISABLE_SLEEP_ON_LSB) & DISABLE_SLEEP_ON_MASK) - -#define LOCAL_BUS_ADDRESS 0x00000470 -#define LOCAL_BUS_OFFSET 0x00000470 -#define LOCAL_BUS_STATE_MSB 1 -#define LOCAL_BUS_STATE_LSB 0 -#define LOCAL_BUS_STATE_MASK 0x00000003 -#define LOCAL_BUS_STATE_GET(x) (((x) & LOCAL_BUS_STATE_MASK) >> LOCAL_BUS_STATE_LSB) -#define LOCAL_BUS_STATE_SET(x) (((x) << LOCAL_BUS_STATE_LSB) & LOCAL_BUS_STATE_MASK) - -#define INT_WLAN_ADDRESS 0x00000472 -#define INT_WLAN_OFFSET 0x00000472 -#define INT_WLAN_VECTOR_MSB 7 -#define INT_WLAN_VECTOR_LSB 0 -#define INT_WLAN_VECTOR_MASK 0x000000ff -#define INT_WLAN_VECTOR_GET(x) (((x) & INT_WLAN_VECTOR_MASK) >> INT_WLAN_VECTOR_LSB) -#define INT_WLAN_VECTOR_SET(x) (((x) << INT_WLAN_VECTOR_LSB) & INT_WLAN_VECTOR_MASK) - -#define WINDOW_DATA_ADDRESS 0x00000474 -#define WINDOW_DATA_OFFSET 0x00000474 -#define WINDOW_DATA_DATA_MSB 7 -#define WINDOW_DATA_DATA_LSB 0 -#define WINDOW_DATA_DATA_MASK 0x000000ff -#define WINDOW_DATA_DATA_GET(x) (((x) & WINDOW_DATA_DATA_MASK) >> WINDOW_DATA_DATA_LSB) -#define WINDOW_DATA_DATA_SET(x) (((x) << WINDOW_DATA_DATA_LSB) & WINDOW_DATA_DATA_MASK) - -#define WINDOW_WRITE_ADDR_ADDRESS 0x00000478 -#define WINDOW_WRITE_ADDR_OFFSET 0x00000478 -#define WINDOW_WRITE_ADDR_ADDR_MSB 7 -#define WINDOW_WRITE_ADDR_ADDR_LSB 0 -#define WINDOW_WRITE_ADDR_ADDR_MASK 0x000000ff -#define WINDOW_WRITE_ADDR_ADDR_GET(x) (((x) & WINDOW_WRITE_ADDR_ADDR_MASK) >> WINDOW_WRITE_ADDR_ADDR_LSB) -#define WINDOW_WRITE_ADDR_ADDR_SET(x) (((x) << WINDOW_WRITE_ADDR_ADDR_LSB) & WINDOW_WRITE_ADDR_ADDR_MASK) - -#define WINDOW_READ_ADDR_ADDRESS 0x0000047c -#define WINDOW_READ_ADDR_OFFSET 0x0000047c -#define WINDOW_READ_ADDR_ADDR_MSB 7 -#define WINDOW_READ_ADDR_ADDR_LSB 0 -#define WINDOW_READ_ADDR_ADDR_MASK 0x000000ff -#define WINDOW_READ_ADDR_ADDR_GET(x) (((x) & WINDOW_READ_ADDR_ADDR_MASK) >> WINDOW_READ_ADDR_ADDR_LSB) -#define WINDOW_READ_ADDR_ADDR_SET(x) (((x) << WINDOW_READ_ADDR_ADDR_LSB) & WINDOW_READ_ADDR_ADDR_MASK) - -#define SPI_CONFIG_ADDRESS 0x00000480 -#define SPI_CONFIG_OFFSET 0x00000480 -#define SPI_CONFIG_SPI_RESET_MSB 4 -#define SPI_CONFIG_SPI_RESET_LSB 4 -#define SPI_CONFIG_SPI_RESET_MASK 0x00000010 -#define SPI_CONFIG_SPI_RESET_GET(x) (((x) & SPI_CONFIG_SPI_RESET_MASK) >> SPI_CONFIG_SPI_RESET_LSB) -#define SPI_CONFIG_SPI_RESET_SET(x) (((x) << SPI_CONFIG_SPI_RESET_LSB) & SPI_CONFIG_SPI_RESET_MASK) -#define SPI_CONFIG_INTERRUPT_ENABLE_MSB 3 -#define SPI_CONFIG_INTERRUPT_ENABLE_LSB 3 -#define SPI_CONFIG_INTERRUPT_ENABLE_MASK 0x00000008 -#define SPI_CONFIG_INTERRUPT_ENABLE_GET(x) (((x) & SPI_CONFIG_INTERRUPT_ENABLE_MASK) >> SPI_CONFIG_INTERRUPT_ENABLE_LSB) -#define SPI_CONFIG_INTERRUPT_ENABLE_SET(x) (((x) << SPI_CONFIG_INTERRUPT_ENABLE_LSB) & SPI_CONFIG_INTERRUPT_ENABLE_MASK) -#define SPI_CONFIG_TEST_MODE_MSB 2 -#define SPI_CONFIG_TEST_MODE_LSB 2 -#define SPI_CONFIG_TEST_MODE_MASK 0x00000004 -#define SPI_CONFIG_TEST_MODE_GET(x) (((x) & SPI_CONFIG_TEST_MODE_MASK) >> SPI_CONFIG_TEST_MODE_LSB) -#define SPI_CONFIG_TEST_MODE_SET(x) (((x) << SPI_CONFIG_TEST_MODE_LSB) & SPI_CONFIG_TEST_MODE_MASK) -#define SPI_CONFIG_DATA_SIZE_MSB 1 -#define SPI_CONFIG_DATA_SIZE_LSB 0 -#define SPI_CONFIG_DATA_SIZE_MASK 0x00000003 -#define SPI_CONFIG_DATA_SIZE_GET(x) (((x) & SPI_CONFIG_DATA_SIZE_MASK) >> SPI_CONFIG_DATA_SIZE_LSB) -#define SPI_CONFIG_DATA_SIZE_SET(x) (((x) << SPI_CONFIG_DATA_SIZE_LSB) & SPI_CONFIG_DATA_SIZE_MASK) - -#define SPI_STATUS_ADDRESS 0x00000481 -#define SPI_STATUS_OFFSET 0x00000481 -#define SPI_STATUS_ADDR_ERR_MSB 3 -#define SPI_STATUS_ADDR_ERR_LSB 3 -#define SPI_STATUS_ADDR_ERR_MASK 0x00000008 -#define SPI_STATUS_ADDR_ERR_GET(x) (((x) & SPI_STATUS_ADDR_ERR_MASK) >> SPI_STATUS_ADDR_ERR_LSB) -#define SPI_STATUS_ADDR_ERR_SET(x) (((x) << SPI_STATUS_ADDR_ERR_LSB) & SPI_STATUS_ADDR_ERR_MASK) -#define SPI_STATUS_RD_ERR_MSB 2 -#define SPI_STATUS_RD_ERR_LSB 2 -#define SPI_STATUS_RD_ERR_MASK 0x00000004 -#define SPI_STATUS_RD_ERR_GET(x) (((x) & SPI_STATUS_RD_ERR_MASK) >> SPI_STATUS_RD_ERR_LSB) -#define SPI_STATUS_RD_ERR_SET(x) (((x) << SPI_STATUS_RD_ERR_LSB) & SPI_STATUS_RD_ERR_MASK) -#define SPI_STATUS_WR_ERR_MSB 1 -#define SPI_STATUS_WR_ERR_LSB 1 -#define SPI_STATUS_WR_ERR_MASK 0x00000002 -#define SPI_STATUS_WR_ERR_GET(x) (((x) & SPI_STATUS_WR_ERR_MASK) >> SPI_STATUS_WR_ERR_LSB) -#define SPI_STATUS_WR_ERR_SET(x) (((x) << SPI_STATUS_WR_ERR_LSB) & SPI_STATUS_WR_ERR_MASK) -#define SPI_STATUS_READY_MSB 0 -#define SPI_STATUS_READY_LSB 0 -#define SPI_STATUS_READY_MASK 0x00000001 -#define SPI_STATUS_READY_GET(x) (((x) & SPI_STATUS_READY_MASK) >> SPI_STATUS_READY_LSB) -#define SPI_STATUS_READY_SET(x) (((x) << SPI_STATUS_READY_LSB) & SPI_STATUS_READY_MASK) - -#define NON_ASSOC_SLEEP_EN_ADDRESS 0x00000482 -#define NON_ASSOC_SLEEP_EN_OFFSET 0x00000482 -#define NON_ASSOC_SLEEP_EN_BIT_MSB 0 -#define NON_ASSOC_SLEEP_EN_BIT_LSB 0 -#define NON_ASSOC_SLEEP_EN_BIT_MASK 0x00000001 -#define NON_ASSOC_SLEEP_EN_BIT_GET(x) (((x) & NON_ASSOC_SLEEP_EN_BIT_MASK) >> NON_ASSOC_SLEEP_EN_BIT_LSB) -#define NON_ASSOC_SLEEP_EN_BIT_SET(x) (((x) << NON_ASSOC_SLEEP_EN_BIT_LSB) & NON_ASSOC_SLEEP_EN_BIT_MASK) - -#define CIS_WINDOW_ADDRESS 0x00000600 -#define CIS_WINDOW_OFFSET 0x00000600 -#define CIS_WINDOW_DATA_MSB 7 -#define CIS_WINDOW_DATA_LSB 0 -#define CIS_WINDOW_DATA_MASK 0x000000ff -#define CIS_WINDOW_DATA_GET(x) (((x) & CIS_WINDOW_DATA_MASK) >> CIS_WINDOW_DATA_LSB) -#define CIS_WINDOW_DATA_SET(x) (((x) << CIS_WINDOW_DATA_LSB) & CIS_WINDOW_DATA_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct mbox_host_reg_reg_s { - unsigned char pad0[1024]; /* pad to 0x400 */ - volatile unsigned char host_int_status; - volatile unsigned char cpu_int_status; - volatile unsigned char error_int_status; - volatile unsigned char counter_int_status; - volatile unsigned char mbox_frame; - volatile unsigned char rx_lookahead_valid; - unsigned char pad1[2]; /* pad to 0x408 */ - volatile unsigned char rx_lookahead0[4]; - volatile unsigned char rx_lookahead1[4]; - volatile unsigned char rx_lookahead2[4]; - volatile unsigned char rx_lookahead3[4]; - volatile unsigned char int_status_enable; - volatile unsigned char cpu_int_status_enable; - volatile unsigned char error_status_enable; - volatile unsigned char counter_int_status_enable; - unsigned char pad2[4]; /* pad to 0x420 */ - volatile unsigned char count[8]; - unsigned char pad3[24]; /* pad to 0x440 */ - volatile unsigned char count_dec[32]; - volatile unsigned char scratch[8]; - volatile unsigned char fifo_timeout; - volatile unsigned char fifo_timeout_enable; - volatile unsigned char disable_sleep; - unsigned char pad4[5]; /* pad to 0x470 */ - volatile unsigned char local_bus; - unsigned char pad5[1]; /* pad to 0x472 */ - volatile unsigned char int_wlan; - unsigned char pad6[1]; /* pad to 0x474 */ - volatile unsigned char window_data[4]; - volatile unsigned char window_write_addr[4]; - volatile unsigned char window_read_addr[4]; - volatile unsigned char spi_config; - volatile unsigned char spi_status; - volatile unsigned char non_assoc_sleep_en; - unsigned char pad7[381]; /* pad to 0x600 */ - volatile unsigned char cis_window[512]; -} mbox_host_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _MBOX_HOST_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/mbox_host_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/mbox_host_reg.vrh deleted file mode 100644 index 3cf45eaa0cee..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/mbox_host_reg.vrh +++ /dev/null @@ -1,563 +0,0 @@ -#ifndef _MBOX_HOST_REG_VRH_ -#define _MBOX_HOST_REG_VRH_ - -#define HOST_INT_STATUS_ADDRESS 'h00000400 -#define HOST_INT_STATUS_ERROR_MSB 7 -#define HOST_INT_STATUS_ERROR_LSB 7 -#define HOST_INT_STATUS_ERROR_MASK 'h00000080 -#define HOST_INT_STATUS_ERROR_GET(x) (((x) & HOST_INT_STATUS_ERROR_MASK) >> HOST_INT_STATUS_ERROR_LSB) -#define HOST_INT_STATUS_ERROR_SET(x) (((8'd0 | (x)) << HOST_INT_STATUS_ERROR_LSB) & HOST_INT_STATUS_ERROR_MASK) -#define HOST_INT_STATUS_ERROR_RESET 1'h0 -#define HOST_INT_STATUS_CPU_MSB 6 -#define HOST_INT_STATUS_CPU_LSB 6 -#define HOST_INT_STATUS_CPU_MASK 'h00000040 -#define HOST_INT_STATUS_CPU_GET(x) (((x) & HOST_INT_STATUS_CPU_MASK) >> HOST_INT_STATUS_CPU_LSB) -#define HOST_INT_STATUS_CPU_SET(x) (((8'd0 | (x)) << HOST_INT_STATUS_CPU_LSB) & HOST_INT_STATUS_CPU_MASK) -#define HOST_INT_STATUS_CPU_RESET 1'h0 -#define HOST_INT_STATUS_DRAGON_INT_MSB 5 -#define HOST_INT_STATUS_DRAGON_INT_LSB 5 -#define HOST_INT_STATUS_DRAGON_INT_MASK 'h00000020 -#define HOST_INT_STATUS_DRAGON_INT_GET(x) (((x) & HOST_INT_STATUS_DRAGON_INT_MASK) >> HOST_INT_STATUS_DRAGON_INT_LSB) -#define HOST_INT_STATUS_DRAGON_INT_SET(x) (((8'd0 | (x)) << HOST_INT_STATUS_DRAGON_INT_LSB) & HOST_INT_STATUS_DRAGON_INT_MASK) -#define HOST_INT_STATUS_DRAGON_INT_RESET 1'h0 -#define HOST_INT_STATUS_COUNTER_MSB 4 -#define HOST_INT_STATUS_COUNTER_LSB 4 -#define HOST_INT_STATUS_COUNTER_MASK 'h00000010 -#define HOST_INT_STATUS_COUNTER_GET(x) (((x) & HOST_INT_STATUS_COUNTER_MASK) >> HOST_INT_STATUS_COUNTER_LSB) -#define HOST_INT_STATUS_COUNTER_SET(x) (((8'd0 | (x)) << HOST_INT_STATUS_COUNTER_LSB) & HOST_INT_STATUS_COUNTER_MASK) -#define HOST_INT_STATUS_COUNTER_RESET 1'h0 -#define HOST_INT_STATUS_MBOX_DATA_MSB 3 -#define HOST_INT_STATUS_MBOX_DATA_LSB 0 -#define HOST_INT_STATUS_MBOX_DATA_MASK 'h0000000f -#define HOST_INT_STATUS_MBOX_DATA_GET(x) (((x) & HOST_INT_STATUS_MBOX_DATA_MASK) >> HOST_INT_STATUS_MBOX_DATA_LSB) -#define HOST_INT_STATUS_MBOX_DATA_SET(x) (((8'd0 | (x)) << HOST_INT_STATUS_MBOX_DATA_LSB) & HOST_INT_STATUS_MBOX_DATA_MASK) -#define HOST_INT_STATUS_MBOX_DATA_RESET 4'h0 -#define HOST_INT_STATUS_RESET (8'h0 | \ - HOST_INT_STATUS_ERROR_SET(HOST_INT_STATUS_ERROR_RESET) | \ - HOST_INT_STATUS_CPU_SET(HOST_INT_STATUS_CPU_RESET) | \ - HOST_INT_STATUS_DRAGON_INT_SET(HOST_INT_STATUS_DRAGON_INT_RESET) | \ - HOST_INT_STATUS_COUNTER_SET(HOST_INT_STATUS_COUNTER_RESET) | \ - HOST_INT_STATUS_MBOX_DATA_SET(HOST_INT_STATUS_MBOX_DATA_RESET)) -#define HOST_INT_STATUS_HW_MASK (8'h0 | \ - HOST_INT_STATUS_ERROR_MASK | \ - HOST_INT_STATUS_CPU_MASK | \ - HOST_INT_STATUS_DRAGON_INT_MASK | \ - HOST_INT_STATUS_COUNTER_MASK | \ - HOST_INT_STATUS_MBOX_DATA_MASK) -#define HOST_INT_STATUS_SW_MASK (8'h0) - -#define CPU_INT_STATUS_ADDRESS 'h00000401 -#define CPU_INT_STATUS_BIT_MSB 7 -#define CPU_INT_STATUS_BIT_LSB 0 -#define CPU_INT_STATUS_BIT_MASK 'h000000ff -#define CPU_INT_STATUS_BIT_GET(x) (((x) & CPU_INT_STATUS_BIT_MASK) >> CPU_INT_STATUS_BIT_LSB) -#define CPU_INT_STATUS_BIT_SET(x) (((8'd0 | (x)) << CPU_INT_STATUS_BIT_LSB) & CPU_INT_STATUS_BIT_MASK) -#define CPU_INT_STATUS_BIT_RESET 8'h0 -#define CPU_INT_STATUS_RESET (8'h0 | \ - CPU_INT_STATUS_BIT_SET(CPU_INT_STATUS_BIT_RESET)) -#define CPU_INT_STATUS_HW_MASK (8'h0 | \ - CPU_INT_STATUS_BIT_MASK) -#define CPU_INT_STATUS_SW_MASK (8'h0 | \ - CPU_INT_STATUS_BIT_MASK) - -#define ERROR_INT_STATUS_ADDRESS 'h00000402 -#define ERROR_INT_STATUS_SPI_MSB 3 -#define ERROR_INT_STATUS_SPI_LSB 3 -#define ERROR_INT_STATUS_SPI_MASK 'h00000008 -#define ERROR_INT_STATUS_SPI_GET(x) (((x) & ERROR_INT_STATUS_SPI_MASK) >> ERROR_INT_STATUS_SPI_LSB) -#define ERROR_INT_STATUS_SPI_SET(x) (((8'd0 | (x)) << ERROR_INT_STATUS_SPI_LSB) & ERROR_INT_STATUS_SPI_MASK) -#define ERROR_INT_STATUS_SPI_RESET 1'h0 -#define ERROR_INT_STATUS_WAKEUP_MSB 2 -#define ERROR_INT_STATUS_WAKEUP_LSB 2 -#define ERROR_INT_STATUS_WAKEUP_MASK 'h00000004 -#define ERROR_INT_STATUS_WAKEUP_GET(x) (((x) & ERROR_INT_STATUS_WAKEUP_MASK) >> ERROR_INT_STATUS_WAKEUP_LSB) -#define ERROR_INT_STATUS_WAKEUP_SET(x) (((8'd0 | (x)) << ERROR_INT_STATUS_WAKEUP_LSB) & ERROR_INT_STATUS_WAKEUP_MASK) -#define ERROR_INT_STATUS_WAKEUP_RESET 1'h0 -#define ERROR_INT_STATUS_RX_UNDERFLOW_MSB 1 -#define ERROR_INT_STATUS_RX_UNDERFLOW_LSB 1 -#define ERROR_INT_STATUS_RX_UNDERFLOW_MASK 'h00000002 -#define ERROR_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & ERROR_INT_STATUS_RX_UNDERFLOW_MASK) >> ERROR_INT_STATUS_RX_UNDERFLOW_LSB) -#define ERROR_INT_STATUS_RX_UNDERFLOW_SET(x) (((8'd0 | (x)) << ERROR_INT_STATUS_RX_UNDERFLOW_LSB) & ERROR_INT_STATUS_RX_UNDERFLOW_MASK) -#define ERROR_INT_STATUS_RX_UNDERFLOW_RESET 1'h0 -#define ERROR_INT_STATUS_TX_OVERFLOW_MSB 0 -#define ERROR_INT_STATUS_TX_OVERFLOW_LSB 0 -#define ERROR_INT_STATUS_TX_OVERFLOW_MASK 'h00000001 -#define ERROR_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & ERROR_INT_STATUS_TX_OVERFLOW_MASK) >> ERROR_INT_STATUS_TX_OVERFLOW_LSB) -#define ERROR_INT_STATUS_TX_OVERFLOW_SET(x) (((8'd0 | (x)) << ERROR_INT_STATUS_TX_OVERFLOW_LSB) & ERROR_INT_STATUS_TX_OVERFLOW_MASK) -#define ERROR_INT_STATUS_TX_OVERFLOW_RESET 1'h0 -#define ERROR_INT_STATUS_RESET (8'h0 | \ - ERROR_INT_STATUS_SPI_SET(ERROR_INT_STATUS_SPI_RESET) | \ - ERROR_INT_STATUS_WAKEUP_SET(ERROR_INT_STATUS_WAKEUP_RESET) | \ - ERROR_INT_STATUS_RX_UNDERFLOW_SET(ERROR_INT_STATUS_RX_UNDERFLOW_RESET) | \ - ERROR_INT_STATUS_TX_OVERFLOW_SET(ERROR_INT_STATUS_TX_OVERFLOW_RESET)) -#define ERROR_INT_STATUS_HW_MASK (8'h0 | \ - ERROR_INT_STATUS_SPI_MASK | \ - ERROR_INT_STATUS_WAKEUP_MASK | \ - ERROR_INT_STATUS_RX_UNDERFLOW_MASK | \ - ERROR_INT_STATUS_TX_OVERFLOW_MASK) -#define ERROR_INT_STATUS_SW_MASK (8'h0 | \ - ERROR_INT_STATUS_WAKEUP_MASK | \ - ERROR_INT_STATUS_RX_UNDERFLOW_MASK | \ - ERROR_INT_STATUS_TX_OVERFLOW_MASK) - -#define COUNTER_INT_STATUS_ADDRESS 'h00000403 -#define COUNTER_INT_STATUS_COUNTER_MSB 7 -#define COUNTER_INT_STATUS_COUNTER_LSB 0 -#define COUNTER_INT_STATUS_COUNTER_MASK 'h000000ff -#define COUNTER_INT_STATUS_COUNTER_GET(x) (((x) & COUNTER_INT_STATUS_COUNTER_MASK) >> COUNTER_INT_STATUS_COUNTER_LSB) -#define COUNTER_INT_STATUS_COUNTER_SET(x) (((8'd0 | (x)) << COUNTER_INT_STATUS_COUNTER_LSB) & COUNTER_INT_STATUS_COUNTER_MASK) -#define COUNTER_INT_STATUS_COUNTER_RESET 8'h0 -#define COUNTER_INT_STATUS_RESET (8'h0 | \ - COUNTER_INT_STATUS_COUNTER_SET(COUNTER_INT_STATUS_COUNTER_RESET)) -#define COUNTER_INT_STATUS_HW_MASK (8'h0 | \ - COUNTER_INT_STATUS_COUNTER_MASK) -#define COUNTER_INT_STATUS_SW_MASK (8'h0) - -#define MBOX_FRAME_ADDRESS 'h00000404 -#define MBOX_FRAME_RX_EOM_MSB 7 -#define MBOX_FRAME_RX_EOM_LSB 4 -#define MBOX_FRAME_RX_EOM_MASK 'h000000f0 -#define MBOX_FRAME_RX_EOM_GET(x) (((x) & MBOX_FRAME_RX_EOM_MASK) >> MBOX_FRAME_RX_EOM_LSB) -#define MBOX_FRAME_RX_EOM_SET(x) (((8'd0 | (x)) << MBOX_FRAME_RX_EOM_LSB) & MBOX_FRAME_RX_EOM_MASK) -#define MBOX_FRAME_RX_EOM_RESET 4'h0 -#define MBOX_FRAME_RX_SOM_MSB 3 -#define MBOX_FRAME_RX_SOM_LSB 0 -#define MBOX_FRAME_RX_SOM_MASK 'h0000000f -#define MBOX_FRAME_RX_SOM_GET(x) (((x) & MBOX_FRAME_RX_SOM_MASK) >> MBOX_FRAME_RX_SOM_LSB) -#define MBOX_FRAME_RX_SOM_SET(x) (((8'd0 | (x)) << MBOX_FRAME_RX_SOM_LSB) & MBOX_FRAME_RX_SOM_MASK) -#define MBOX_FRAME_RX_SOM_RESET 4'hf -#define MBOX_FRAME_RESET (8'h0 | \ - MBOX_FRAME_RX_EOM_SET(MBOX_FRAME_RX_EOM_RESET) | \ - MBOX_FRAME_RX_SOM_SET(MBOX_FRAME_RX_SOM_RESET)) -#define MBOX_FRAME_HW_MASK (8'h0 | \ - MBOX_FRAME_RX_EOM_MASK | \ - MBOX_FRAME_RX_SOM_MASK) -#define MBOX_FRAME_SW_MASK (8'h0) - -#define RX_LOOKAHEAD_VALID_ADDRESS 'h00000405 -#define RX_LOOKAHEAD_VALID_MBOX_MSB 3 -#define RX_LOOKAHEAD_VALID_MBOX_LSB 0 -#define RX_LOOKAHEAD_VALID_MBOX_MASK 'h0000000f -#define RX_LOOKAHEAD_VALID_MBOX_GET(x) (((x) & RX_LOOKAHEAD_VALID_MBOX_MASK) >> RX_LOOKAHEAD_VALID_MBOX_LSB) -#define RX_LOOKAHEAD_VALID_MBOX_SET(x) (((8'd0 | (x)) << RX_LOOKAHEAD_VALID_MBOX_LSB) & RX_LOOKAHEAD_VALID_MBOX_MASK) -#define RX_LOOKAHEAD_VALID_MBOX_RESET 4'h0 -#define RX_LOOKAHEAD_VALID_RESET (8'h0 | \ - RX_LOOKAHEAD_VALID_MBOX_SET(RX_LOOKAHEAD_VALID_MBOX_RESET)) -#define RX_LOOKAHEAD_VALID_HW_MASK (8'h0 | \ - RX_LOOKAHEAD_VALID_MBOX_MASK) -#define RX_LOOKAHEAD_VALID_SW_MASK (8'h0) - -#define RX_LOOKAHEAD0_ADDRESS 'h00000408 -#define RX_LOOKAHEAD0_DATA_MSB 7 -#define RX_LOOKAHEAD0_DATA_LSB 0 -#define RX_LOOKAHEAD0_DATA_MASK 'h000000ff -#define RX_LOOKAHEAD0_DATA_GET(x) (((x) & RX_LOOKAHEAD0_DATA_MASK) >> RX_LOOKAHEAD0_DATA_LSB) -#define RX_LOOKAHEAD0_DATA_SET(x) (((8'd0 | (x)) << RX_LOOKAHEAD0_DATA_LSB) & RX_LOOKAHEAD0_DATA_MASK) -#define RX_LOOKAHEAD0_DATA_RESET 8'h0 -#define RX_LOOKAHEAD0_RESET (8'h0 | \ - RX_LOOKAHEAD0_DATA_SET(RX_LOOKAHEAD0_DATA_RESET)) -#define RX_LOOKAHEAD0_HW_MASK (8'h0 | \ - RX_LOOKAHEAD0_DATA_MASK) -#define RX_LOOKAHEAD0_SW_MASK (8'h0) - -#define RX_LOOKAHEAD1_ADDRESS 'h0000040c -#define RX_LOOKAHEAD1_DATA_MSB 7 -#define RX_LOOKAHEAD1_DATA_LSB 0 -#define RX_LOOKAHEAD1_DATA_MASK 'h000000ff -#define RX_LOOKAHEAD1_DATA_GET(x) (((x) & RX_LOOKAHEAD1_DATA_MASK) >> RX_LOOKAHEAD1_DATA_LSB) -#define RX_LOOKAHEAD1_DATA_SET(x) (((8'd0 | (x)) << RX_LOOKAHEAD1_DATA_LSB) & RX_LOOKAHEAD1_DATA_MASK) -#define RX_LOOKAHEAD1_DATA_RESET 8'h0 -#define RX_LOOKAHEAD1_RESET (8'h0 | \ - RX_LOOKAHEAD1_DATA_SET(RX_LOOKAHEAD1_DATA_RESET)) -#define RX_LOOKAHEAD1_HW_MASK (8'h0 | \ - RX_LOOKAHEAD1_DATA_MASK) -#define RX_LOOKAHEAD1_SW_MASK (8'h0) - -#define RX_LOOKAHEAD2_ADDRESS 'h00000410 -#define RX_LOOKAHEAD2_DATA_MSB 7 -#define RX_LOOKAHEAD2_DATA_LSB 0 -#define RX_LOOKAHEAD2_DATA_MASK 'h000000ff -#define RX_LOOKAHEAD2_DATA_GET(x) (((x) & RX_LOOKAHEAD2_DATA_MASK) >> RX_LOOKAHEAD2_DATA_LSB) -#define RX_LOOKAHEAD2_DATA_SET(x) (((8'd0 | (x)) << RX_LOOKAHEAD2_DATA_LSB) & RX_LOOKAHEAD2_DATA_MASK) -#define RX_LOOKAHEAD2_DATA_RESET 8'h0 -#define RX_LOOKAHEAD2_RESET (8'h0 | \ - RX_LOOKAHEAD2_DATA_SET(RX_LOOKAHEAD2_DATA_RESET)) -#define RX_LOOKAHEAD2_HW_MASK (8'h0 | \ - RX_LOOKAHEAD2_DATA_MASK) -#define RX_LOOKAHEAD2_SW_MASK (8'h0) - -#define RX_LOOKAHEAD3_ADDRESS 'h00000414 -#define RX_LOOKAHEAD3_DATA_MSB 7 -#define RX_LOOKAHEAD3_DATA_LSB 0 -#define RX_LOOKAHEAD3_DATA_MASK 'h000000ff -#define RX_LOOKAHEAD3_DATA_GET(x) (((x) & RX_LOOKAHEAD3_DATA_MASK) >> RX_LOOKAHEAD3_DATA_LSB) -#define RX_LOOKAHEAD3_DATA_SET(x) (((8'd0 | (x)) << RX_LOOKAHEAD3_DATA_LSB) & RX_LOOKAHEAD3_DATA_MASK) -#define RX_LOOKAHEAD3_DATA_RESET 8'h0 -#define RX_LOOKAHEAD3_RESET (8'h0 | \ - RX_LOOKAHEAD3_DATA_SET(RX_LOOKAHEAD3_DATA_RESET)) -#define RX_LOOKAHEAD3_HW_MASK (8'h0 | \ - RX_LOOKAHEAD3_DATA_MASK) -#define RX_LOOKAHEAD3_SW_MASK (8'h0) - -#define INT_STATUS_ENABLE_ADDRESS 'h00000418 -#define INT_STATUS_ENABLE_ERROR_MSB 7 -#define INT_STATUS_ENABLE_ERROR_LSB 7 -#define INT_STATUS_ENABLE_ERROR_MASK 'h00000080 -#define INT_STATUS_ENABLE_ERROR_GET(x) (((x) & INT_STATUS_ENABLE_ERROR_MASK) >> INT_STATUS_ENABLE_ERROR_LSB) -#define INT_STATUS_ENABLE_ERROR_SET(x) (((8'd0 | (x)) << INT_STATUS_ENABLE_ERROR_LSB) & INT_STATUS_ENABLE_ERROR_MASK) -#define INT_STATUS_ENABLE_ERROR_RESET 1'h1 -#define INT_STATUS_ENABLE_CPU_MSB 6 -#define INT_STATUS_ENABLE_CPU_LSB 6 -#define INT_STATUS_ENABLE_CPU_MASK 'h00000040 -#define INT_STATUS_ENABLE_CPU_GET(x) (((x) & INT_STATUS_ENABLE_CPU_MASK) >> INT_STATUS_ENABLE_CPU_LSB) -#define INT_STATUS_ENABLE_CPU_SET(x) (((8'd0 | (x)) << INT_STATUS_ENABLE_CPU_LSB) & INT_STATUS_ENABLE_CPU_MASK) -#define INT_STATUS_ENABLE_CPU_RESET 1'h1 -#define INT_STATUS_ENABLE_DRAGON_INT_MSB 5 -#define INT_STATUS_ENABLE_DRAGON_INT_LSB 5 -#define INT_STATUS_ENABLE_DRAGON_INT_MASK 'h00000020 -#define INT_STATUS_ENABLE_DRAGON_INT_GET(x) (((x) & INT_STATUS_ENABLE_DRAGON_INT_MASK) >> INT_STATUS_ENABLE_DRAGON_INT_LSB) -#define INT_STATUS_ENABLE_DRAGON_INT_SET(x) (((8'd0 | (x)) << INT_STATUS_ENABLE_DRAGON_INT_LSB) & INT_STATUS_ENABLE_DRAGON_INT_MASK) -#define INT_STATUS_ENABLE_DRAGON_INT_RESET 1'h0 -#define INT_STATUS_ENABLE_COUNTER_MSB 4 -#define INT_STATUS_ENABLE_COUNTER_LSB 4 -#define INT_STATUS_ENABLE_COUNTER_MASK 'h00000010 -#define INT_STATUS_ENABLE_COUNTER_GET(x) (((x) & INT_STATUS_ENABLE_COUNTER_MASK) >> INT_STATUS_ENABLE_COUNTER_LSB) -#define INT_STATUS_ENABLE_COUNTER_SET(x) (((8'd0 | (x)) << INT_STATUS_ENABLE_COUNTER_LSB) & INT_STATUS_ENABLE_COUNTER_MASK) -#define INT_STATUS_ENABLE_COUNTER_RESET 1'h0 -#define INT_STATUS_ENABLE_MBOX_DATA_MSB 3 -#define INT_STATUS_ENABLE_MBOX_DATA_LSB 0 -#define INT_STATUS_ENABLE_MBOX_DATA_MASK 'h0000000f -#define INT_STATUS_ENABLE_MBOX_DATA_GET(x) (((x) & INT_STATUS_ENABLE_MBOX_DATA_MASK) >> INT_STATUS_ENABLE_MBOX_DATA_LSB) -#define INT_STATUS_ENABLE_MBOX_DATA_SET(x) (((8'd0 | (x)) << INT_STATUS_ENABLE_MBOX_DATA_LSB) & INT_STATUS_ENABLE_MBOX_DATA_MASK) -#define INT_STATUS_ENABLE_MBOX_DATA_RESET 4'hf -#define INT_STATUS_ENABLE_RESET (8'h0 | \ - INT_STATUS_ENABLE_ERROR_SET(INT_STATUS_ENABLE_ERROR_RESET) | \ - INT_STATUS_ENABLE_CPU_SET(INT_STATUS_ENABLE_CPU_RESET) | \ - INT_STATUS_ENABLE_DRAGON_INT_SET(INT_STATUS_ENABLE_DRAGON_INT_RESET) | \ - INT_STATUS_ENABLE_COUNTER_SET(INT_STATUS_ENABLE_COUNTER_RESET) | \ - INT_STATUS_ENABLE_MBOX_DATA_SET(INT_STATUS_ENABLE_MBOX_DATA_RESET)) -#define INT_STATUS_ENABLE_HW_MASK (8'h0) -#define INT_STATUS_ENABLE_SW_MASK (8'h0 | \ - INT_STATUS_ENABLE_ERROR_MASK | \ - INT_STATUS_ENABLE_CPU_MASK | \ - INT_STATUS_ENABLE_DRAGON_INT_MASK | \ - INT_STATUS_ENABLE_COUNTER_MASK | \ - INT_STATUS_ENABLE_MBOX_DATA_MASK) - -#define CPU_INT_STATUS_ENABLE_ADDRESS 'h00000419 -#define CPU_INT_STATUS_ENABLE_BIT_MSB 7 -#define CPU_INT_STATUS_ENABLE_BIT_LSB 0 -#define CPU_INT_STATUS_ENABLE_BIT_MASK 'h000000ff -#define CPU_INT_STATUS_ENABLE_BIT_GET(x) (((x) & CPU_INT_STATUS_ENABLE_BIT_MASK) >> CPU_INT_STATUS_ENABLE_BIT_LSB) -#define CPU_INT_STATUS_ENABLE_BIT_SET(x) (((8'd0 | (x)) << CPU_INT_STATUS_ENABLE_BIT_LSB) & CPU_INT_STATUS_ENABLE_BIT_MASK) -#define CPU_INT_STATUS_ENABLE_BIT_RESET 8'hff -#define CPU_INT_STATUS_ENABLE_RESET (8'h0 | \ - CPU_INT_STATUS_ENABLE_BIT_SET(CPU_INT_STATUS_ENABLE_BIT_RESET)) -#define CPU_INT_STATUS_ENABLE_HW_MASK (8'h0) -#define CPU_INT_STATUS_ENABLE_SW_MASK (8'h0 | \ - CPU_INT_STATUS_ENABLE_BIT_MASK) - -#define ERROR_STATUS_ENABLE_ADDRESS 'h0000041a -#define ERROR_STATUS_ENABLE_WAKEUP_MSB 2 -#define ERROR_STATUS_ENABLE_WAKEUP_LSB 2 -#define ERROR_STATUS_ENABLE_WAKEUP_MASK 'h00000004 -#define ERROR_STATUS_ENABLE_WAKEUP_GET(x) (((x) & ERROR_STATUS_ENABLE_WAKEUP_MASK) >> ERROR_STATUS_ENABLE_WAKEUP_LSB) -#define ERROR_STATUS_ENABLE_WAKEUP_SET(x) (((8'd0 | (x)) << ERROR_STATUS_ENABLE_WAKEUP_LSB) & ERROR_STATUS_ENABLE_WAKEUP_MASK) -#define ERROR_STATUS_ENABLE_WAKEUP_RESET 1'h0 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MSB 1 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB 1 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 'h00000002 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK) >> ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_SET(x) (((8'd0 | (x)) << ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) & ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_RESET 1'h0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_MSB 0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB 0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK 'h00000001 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) >> ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_SET(x) (((8'd0 | (x)) << ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) & ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_RESET 1'h0 -#define ERROR_STATUS_ENABLE_RESET (8'h0 | \ - ERROR_STATUS_ENABLE_WAKEUP_SET(ERROR_STATUS_ENABLE_WAKEUP_RESET) | \ - ERROR_STATUS_ENABLE_RX_UNDERFLOW_SET(ERROR_STATUS_ENABLE_RX_UNDERFLOW_RESET) | \ - ERROR_STATUS_ENABLE_TX_OVERFLOW_SET(ERROR_STATUS_ENABLE_TX_OVERFLOW_RESET)) -#define ERROR_STATUS_ENABLE_HW_MASK (8'h0) -#define ERROR_STATUS_ENABLE_SW_MASK (8'h0 | \ - ERROR_STATUS_ENABLE_WAKEUP_MASK | \ - ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK | \ - ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) - -#define COUNTER_INT_STATUS_ENABLE_ADDRESS 'h0000041b -#define COUNTER_INT_STATUS_ENABLE_BIT_MSB 7 -#define COUNTER_INT_STATUS_ENABLE_BIT_LSB 0 -#define COUNTER_INT_STATUS_ENABLE_BIT_MASK 'h000000ff -#define COUNTER_INT_STATUS_ENABLE_BIT_GET(x) (((x) & COUNTER_INT_STATUS_ENABLE_BIT_MASK) >> COUNTER_INT_STATUS_ENABLE_BIT_LSB) -#define COUNTER_INT_STATUS_ENABLE_BIT_SET(x) (((8'd0 | (x)) << COUNTER_INT_STATUS_ENABLE_BIT_LSB) & COUNTER_INT_STATUS_ENABLE_BIT_MASK) -#define COUNTER_INT_STATUS_ENABLE_BIT_RESET 8'hff -#define COUNTER_INT_STATUS_ENABLE_RESET (8'h0 | \ - COUNTER_INT_STATUS_ENABLE_BIT_SET(COUNTER_INT_STATUS_ENABLE_BIT_RESET)) -#define COUNTER_INT_STATUS_ENABLE_HW_MASK (8'h0) -#define COUNTER_INT_STATUS_ENABLE_SW_MASK (8'h0 | \ - COUNTER_INT_STATUS_ENABLE_BIT_MASK) - -#define COUNT_ADDRESS 'h00000420 -#define COUNT_VALUE_MSB 7 -#define COUNT_VALUE_LSB 0 -#define COUNT_VALUE_MASK 'h000000ff -#define COUNT_VALUE_GET(x) (((x) & COUNT_VALUE_MASK) >> COUNT_VALUE_LSB) -#define COUNT_VALUE_SET(x) (((8'd0 | (x)) << COUNT_VALUE_LSB) & COUNT_VALUE_MASK) -#define COUNT_VALUE_RESET 8'h0 -#define COUNT_RESET (8'h0 | \ - COUNT_VALUE_SET(COUNT_VALUE_RESET)) -#define COUNT_HW_MASK (8'h0 | \ - COUNT_VALUE_MASK) -#define COUNT_SW_MASK (8'h0 | \ - COUNT_VALUE_MASK) - -#define COUNT_DEC_ADDRESS 'h00000440 -#define COUNT_DEC_VALUE_MSB 7 -#define COUNT_DEC_VALUE_LSB 0 -#define COUNT_DEC_VALUE_MASK 'h000000ff -#define COUNT_DEC_VALUE_GET(x) (((x) & COUNT_DEC_VALUE_MASK) >> COUNT_DEC_VALUE_LSB) -#define COUNT_DEC_VALUE_SET(x) (((8'd0 | (x)) << COUNT_DEC_VALUE_LSB) & COUNT_DEC_VALUE_MASK) -#define COUNT_DEC_VALUE_RESET 8'h0 -#define COUNT_DEC_RESET (8'h0 | \ - COUNT_DEC_VALUE_SET(COUNT_DEC_VALUE_RESET)) -#define COUNT_DEC_HW_MASK (8'h0 | \ - COUNT_DEC_VALUE_MASK) -#define COUNT_DEC_SW_MASK (8'h0 | \ - COUNT_DEC_VALUE_MASK) - -#define SCRATCH_ADDRESS 'h00000460 -#define SCRATCH_VALUE_MSB 7 -#define SCRATCH_VALUE_LSB 0 -#define SCRATCH_VALUE_MASK 'h000000ff -#define SCRATCH_VALUE_GET(x) (((x) & SCRATCH_VALUE_MASK) >> SCRATCH_VALUE_LSB) -#define SCRATCH_VALUE_SET(x) (((8'd0 | (x)) << SCRATCH_VALUE_LSB) & SCRATCH_VALUE_MASK) -#define SCRATCH_VALUE_RESET 8'h0 -#define SCRATCH_RESET (8'h0 | \ - SCRATCH_VALUE_SET(SCRATCH_VALUE_RESET)) -#define SCRATCH_HW_MASK (8'h0 | \ - SCRATCH_VALUE_MASK) -#define SCRATCH_SW_MASK (8'h0 | \ - SCRATCH_VALUE_MASK) - -#define FIFO_TIMEOUT_ADDRESS 'h00000468 -#define FIFO_TIMEOUT_VALUE_MSB 7 -#define FIFO_TIMEOUT_VALUE_LSB 0 -#define FIFO_TIMEOUT_VALUE_MASK 'h000000ff -#define FIFO_TIMEOUT_VALUE_GET(x) (((x) & FIFO_TIMEOUT_VALUE_MASK) >> FIFO_TIMEOUT_VALUE_LSB) -#define FIFO_TIMEOUT_VALUE_SET(x) (((8'd0 | (x)) << FIFO_TIMEOUT_VALUE_LSB) & FIFO_TIMEOUT_VALUE_MASK) -#define FIFO_TIMEOUT_VALUE_RESET 8'hff -#define FIFO_TIMEOUT_RESET (8'h0 | \ - FIFO_TIMEOUT_VALUE_SET(FIFO_TIMEOUT_VALUE_RESET)) -#define FIFO_TIMEOUT_HW_MASK (8'h0) -#define FIFO_TIMEOUT_SW_MASK (8'h0 | \ - FIFO_TIMEOUT_VALUE_MASK) - -#define FIFO_TIMEOUT_ENABLE_ADDRESS 'h00000469 -#define FIFO_TIMEOUT_ENABLE_SET_MSB 0 -#define FIFO_TIMEOUT_ENABLE_SET_LSB 0 -#define FIFO_TIMEOUT_ENABLE_SET_MASK 'h00000001 -#define FIFO_TIMEOUT_ENABLE_SET_GET(x) (((x) & FIFO_TIMEOUT_ENABLE_SET_MASK) >> FIFO_TIMEOUT_ENABLE_SET_LSB) -#define FIFO_TIMEOUT_ENABLE_SET_SET(x) (((8'd0 | (x)) << FIFO_TIMEOUT_ENABLE_SET_LSB) & FIFO_TIMEOUT_ENABLE_SET_MASK) -#define FIFO_TIMEOUT_ENABLE_SET_RESET 1'h1 -#define FIFO_TIMEOUT_ENABLE_RESET (8'h0 | \ - FIFO_TIMEOUT_ENABLE_SET_SET(FIFO_TIMEOUT_ENABLE_SET_RESET)) -#define FIFO_TIMEOUT_ENABLE_HW_MASK (8'h0) -#define FIFO_TIMEOUT_ENABLE_SW_MASK (8'h0 | \ - FIFO_TIMEOUT_ENABLE_SET_MASK) - -#define DISABLE_SLEEP_ADDRESS 'h0000046a -#define DISABLE_SLEEP_FOR_INT_MSB 1 -#define DISABLE_SLEEP_FOR_INT_LSB 1 -#define DISABLE_SLEEP_FOR_INT_MASK 'h00000002 -#define DISABLE_SLEEP_FOR_INT_GET(x) (((x) & DISABLE_SLEEP_FOR_INT_MASK) >> DISABLE_SLEEP_FOR_INT_LSB) -#define DISABLE_SLEEP_FOR_INT_SET(x) (((8'd0 | (x)) << DISABLE_SLEEP_FOR_INT_LSB) & DISABLE_SLEEP_FOR_INT_MASK) -#define DISABLE_SLEEP_FOR_INT_RESET 1'h0 -#define DISABLE_SLEEP_ON_MSB 0 -#define DISABLE_SLEEP_ON_LSB 0 -#define DISABLE_SLEEP_ON_MASK 'h00000001 -#define DISABLE_SLEEP_ON_GET(x) (((x) & DISABLE_SLEEP_ON_MASK) >> DISABLE_SLEEP_ON_LSB) -#define DISABLE_SLEEP_ON_SET(x) (((8'd0 | (x)) << DISABLE_SLEEP_ON_LSB) & DISABLE_SLEEP_ON_MASK) -#define DISABLE_SLEEP_ON_RESET 1'h0 -#define DISABLE_SLEEP_RESET (8'h0 | \ - DISABLE_SLEEP_FOR_INT_SET(DISABLE_SLEEP_FOR_INT_RESET) | \ - DISABLE_SLEEP_ON_SET(DISABLE_SLEEP_ON_RESET)) -#define DISABLE_SLEEP_HW_MASK (8'h0) -#define DISABLE_SLEEP_SW_MASK (8'h0 | \ - DISABLE_SLEEP_FOR_INT_MASK | \ - DISABLE_SLEEP_ON_MASK) - -#define LOCAL_BUS_ADDRESS 'h00000470 -#define LOCAL_BUS_STATE_MSB 1 -#define LOCAL_BUS_STATE_LSB 0 -#define LOCAL_BUS_STATE_MASK 'h00000003 -#define LOCAL_BUS_STATE_GET(x) (((x) & LOCAL_BUS_STATE_MASK) >> LOCAL_BUS_STATE_LSB) -#define LOCAL_BUS_STATE_SET(x) (((8'd0 | (x)) << LOCAL_BUS_STATE_LSB) & LOCAL_BUS_STATE_MASK) -#define LOCAL_BUS_STATE_RESET 2'h0 -#define LOCAL_BUS_RESET (8'h0 | \ - LOCAL_BUS_STATE_SET(LOCAL_BUS_STATE_RESET)) -#define LOCAL_BUS_HW_MASK (8'h0 | \ - LOCAL_BUS_STATE_MASK) -#define LOCAL_BUS_SW_MASK (8'h0) - -#define INT_WLAN_ADDRESS 'h00000472 -#define INT_WLAN_VECTOR_MSB 7 -#define INT_WLAN_VECTOR_LSB 0 -#define INT_WLAN_VECTOR_MASK 'h000000ff -#define INT_WLAN_VECTOR_GET(x) (((x) & INT_WLAN_VECTOR_MASK) >> INT_WLAN_VECTOR_LSB) -#define INT_WLAN_VECTOR_SET(x) (((8'd0 | (x)) << INT_WLAN_VECTOR_LSB) & INT_WLAN_VECTOR_MASK) -#define INT_WLAN_VECTOR_RESET 8'h0 -#define INT_WLAN_RESET (8'h0 | \ - INT_WLAN_VECTOR_SET(INT_WLAN_VECTOR_RESET)) -#define INT_WLAN_HW_MASK (8'h0 | \ - INT_WLAN_VECTOR_MASK) -#define INT_WLAN_SW_MASK (8'h0 | \ - INT_WLAN_VECTOR_MASK) - -#define WINDOW_DATA_ADDRESS 'h00000474 -#define WINDOW_DATA_DATA_MSB 7 -#define WINDOW_DATA_DATA_LSB 0 -#define WINDOW_DATA_DATA_MASK 'h000000ff -#define WINDOW_DATA_DATA_GET(x) (((x) & WINDOW_DATA_DATA_MASK) >> WINDOW_DATA_DATA_LSB) -#define WINDOW_DATA_DATA_SET(x) (((8'd0 | (x)) << WINDOW_DATA_DATA_LSB) & WINDOW_DATA_DATA_MASK) -#define WINDOW_DATA_DATA_RESET 8'h0 -#define WINDOW_DATA_RESET (8'h0 | \ - WINDOW_DATA_DATA_SET(WINDOW_DATA_DATA_RESET)) -#define WINDOW_DATA_HW_MASK (8'h0 | \ - WINDOW_DATA_DATA_MASK) -#define WINDOW_DATA_SW_MASK (8'h0 | \ - WINDOW_DATA_DATA_MASK) - -#define WINDOW_WRITE_ADDR_ADDRESS 'h00000478 -#define WINDOW_WRITE_ADDR_ADDR_MSB 7 -#define WINDOW_WRITE_ADDR_ADDR_LSB 0 -#define WINDOW_WRITE_ADDR_ADDR_MASK 'h000000ff -#define WINDOW_WRITE_ADDR_ADDR_GET(x) (((x) & WINDOW_WRITE_ADDR_ADDR_MASK) >> WINDOW_WRITE_ADDR_ADDR_LSB) -#define WINDOW_WRITE_ADDR_ADDR_SET(x) (((8'd0 | (x)) << WINDOW_WRITE_ADDR_ADDR_LSB) & WINDOW_WRITE_ADDR_ADDR_MASK) -#define WINDOW_WRITE_ADDR_ADDR_RESET 8'h0 -#define WINDOW_WRITE_ADDR_RESET (8'h0 | \ - WINDOW_WRITE_ADDR_ADDR_SET(WINDOW_WRITE_ADDR_ADDR_RESET)) -#define WINDOW_WRITE_ADDR_HW_MASK (8'h0) -#define WINDOW_WRITE_ADDR_SW_MASK (8'h0 | \ - WINDOW_WRITE_ADDR_ADDR_MASK) - -#define WINDOW_READ_ADDR_ADDRESS 'h0000047c -#define WINDOW_READ_ADDR_ADDR_MSB 7 -#define WINDOW_READ_ADDR_ADDR_LSB 0 -#define WINDOW_READ_ADDR_ADDR_MASK 'h000000ff -#define WINDOW_READ_ADDR_ADDR_GET(x) (((x) & WINDOW_READ_ADDR_ADDR_MASK) >> WINDOW_READ_ADDR_ADDR_LSB) -#define WINDOW_READ_ADDR_ADDR_SET(x) (((8'd0 | (x)) << WINDOW_READ_ADDR_ADDR_LSB) & WINDOW_READ_ADDR_ADDR_MASK) -#define WINDOW_READ_ADDR_ADDR_RESET 8'h0 -#define WINDOW_READ_ADDR_RESET (8'h0 | \ - WINDOW_READ_ADDR_ADDR_SET(WINDOW_READ_ADDR_ADDR_RESET)) -#define WINDOW_READ_ADDR_HW_MASK (8'h0) -#define WINDOW_READ_ADDR_SW_MASK (8'h0 | \ - WINDOW_READ_ADDR_ADDR_MASK) - -#define SPI_CONFIG_ADDRESS 'h00000480 -#define SPI_CONFIG_SPI_RESET_MSB 4 -#define SPI_CONFIG_SPI_RESET_LSB 4 -#define SPI_CONFIG_SPI_RESET_MASK 'h00000010 -#define SPI_CONFIG_SPI_RESET_GET(x) (((x) & SPI_CONFIG_SPI_RESET_MASK) >> SPI_CONFIG_SPI_RESET_LSB) -#define SPI_CONFIG_SPI_RESET_SET(x) (((8'd0 | (x)) << SPI_CONFIG_SPI_RESET_LSB) & SPI_CONFIG_SPI_RESET_MASK) -#define SPI_CONFIG_SPI_RESET_RESET 1'h0 -#define SPI_CONFIG_INTERRUPT_ENABLE_MSB 3 -#define SPI_CONFIG_INTERRUPT_ENABLE_LSB 3 -#define SPI_CONFIG_INTERRUPT_ENABLE_MASK 'h00000008 -#define SPI_CONFIG_INTERRUPT_ENABLE_GET(x) (((x) & SPI_CONFIG_INTERRUPT_ENABLE_MASK) >> SPI_CONFIG_INTERRUPT_ENABLE_LSB) -#define SPI_CONFIG_INTERRUPT_ENABLE_SET(x) (((8'd0 | (x)) << SPI_CONFIG_INTERRUPT_ENABLE_LSB) & SPI_CONFIG_INTERRUPT_ENABLE_MASK) -#define SPI_CONFIG_INTERRUPT_ENABLE_RESET 1'h0 -#define SPI_CONFIG_TEST_MODE_MSB 2 -#define SPI_CONFIG_TEST_MODE_LSB 2 -#define SPI_CONFIG_TEST_MODE_MASK 'h00000004 -#define SPI_CONFIG_TEST_MODE_GET(x) (((x) & SPI_CONFIG_TEST_MODE_MASK) >> SPI_CONFIG_TEST_MODE_LSB) -#define SPI_CONFIG_TEST_MODE_SET(x) (((8'd0 | (x)) << SPI_CONFIG_TEST_MODE_LSB) & SPI_CONFIG_TEST_MODE_MASK) -#define SPI_CONFIG_TEST_MODE_RESET 1'h0 -#define SPI_CONFIG_DATA_SIZE_MSB 1 -#define SPI_CONFIG_DATA_SIZE_LSB 0 -#define SPI_CONFIG_DATA_SIZE_MASK 'h00000003 -#define SPI_CONFIG_DATA_SIZE_GET(x) (((x) & SPI_CONFIG_DATA_SIZE_MASK) >> SPI_CONFIG_DATA_SIZE_LSB) -#define SPI_CONFIG_DATA_SIZE_SET(x) (((8'd0 | (x)) << SPI_CONFIG_DATA_SIZE_LSB) & SPI_CONFIG_DATA_SIZE_MASK) -#define SPI_CONFIG_DATA_SIZE_RESET 2'h2 -#define SPI_CONFIG_RESET (8'h0 | \ - SPI_CONFIG_SPI_RESET_SET(SPI_CONFIG_SPI_RESET_RESET) | \ - SPI_CONFIG_INTERRUPT_ENABLE_SET(SPI_CONFIG_INTERRUPT_ENABLE_RESET) | \ - SPI_CONFIG_TEST_MODE_SET(SPI_CONFIG_TEST_MODE_RESET) | \ - SPI_CONFIG_DATA_SIZE_SET(SPI_CONFIG_DATA_SIZE_RESET)) -#define SPI_CONFIG_HW_MASK (8'h0) -#define SPI_CONFIG_SW_MASK (8'h0 | \ - SPI_CONFIG_SPI_RESET_MASK | \ - SPI_CONFIG_INTERRUPT_ENABLE_MASK | \ - SPI_CONFIG_TEST_MODE_MASK | \ - SPI_CONFIG_DATA_SIZE_MASK) - -#define SPI_STATUS_ADDRESS 'h00000481 -#define SPI_STATUS_ADDR_ERR_MSB 3 -#define SPI_STATUS_ADDR_ERR_LSB 3 -#define SPI_STATUS_ADDR_ERR_MASK 'h00000008 -#define SPI_STATUS_ADDR_ERR_GET(x) (((x) & SPI_STATUS_ADDR_ERR_MASK) >> SPI_STATUS_ADDR_ERR_LSB) -#define SPI_STATUS_ADDR_ERR_SET(x) (((8'd0 | (x)) << SPI_STATUS_ADDR_ERR_LSB) & SPI_STATUS_ADDR_ERR_MASK) -#define SPI_STATUS_ADDR_ERR_RESET 1'h0 -#define SPI_STATUS_RD_ERR_MSB 2 -#define SPI_STATUS_RD_ERR_LSB 2 -#define SPI_STATUS_RD_ERR_MASK 'h00000004 -#define SPI_STATUS_RD_ERR_GET(x) (((x) & SPI_STATUS_RD_ERR_MASK) >> SPI_STATUS_RD_ERR_LSB) -#define SPI_STATUS_RD_ERR_SET(x) (((8'd0 | (x)) << SPI_STATUS_RD_ERR_LSB) & SPI_STATUS_RD_ERR_MASK) -#define SPI_STATUS_RD_ERR_RESET 1'h0 -#define SPI_STATUS_WR_ERR_MSB 1 -#define SPI_STATUS_WR_ERR_LSB 1 -#define SPI_STATUS_WR_ERR_MASK 'h00000002 -#define SPI_STATUS_WR_ERR_GET(x) (((x) & SPI_STATUS_WR_ERR_MASK) >> SPI_STATUS_WR_ERR_LSB) -#define SPI_STATUS_WR_ERR_SET(x) (((8'd0 | (x)) << SPI_STATUS_WR_ERR_LSB) & SPI_STATUS_WR_ERR_MASK) -#define SPI_STATUS_WR_ERR_RESET 1'h0 -#define SPI_STATUS_READY_MSB 0 -#define SPI_STATUS_READY_LSB 0 -#define SPI_STATUS_READY_MASK 'h00000001 -#define SPI_STATUS_READY_GET(x) (((x) & SPI_STATUS_READY_MASK) >> SPI_STATUS_READY_LSB) -#define SPI_STATUS_READY_SET(x) (((8'd0 | (x)) << SPI_STATUS_READY_LSB) & SPI_STATUS_READY_MASK) -#define SPI_STATUS_READY_RESET 1'h1 -#define SPI_STATUS_RESET (8'h0 | \ - SPI_STATUS_ADDR_ERR_SET(SPI_STATUS_ADDR_ERR_RESET) | \ - SPI_STATUS_RD_ERR_SET(SPI_STATUS_RD_ERR_RESET) | \ - SPI_STATUS_WR_ERR_SET(SPI_STATUS_WR_ERR_RESET) | \ - SPI_STATUS_READY_SET(SPI_STATUS_READY_RESET)) -#define SPI_STATUS_HW_MASK (8'h0 | \ - SPI_STATUS_ADDR_ERR_MASK | \ - SPI_STATUS_RD_ERR_MASK | \ - SPI_STATUS_WR_ERR_MASK | \ - SPI_STATUS_READY_MASK) -#define SPI_STATUS_SW_MASK (8'h0 | \ - SPI_STATUS_ADDR_ERR_MASK | \ - SPI_STATUS_RD_ERR_MASK | \ - SPI_STATUS_WR_ERR_MASK) - -#define NON_ASSOC_SLEEP_EN_ADDRESS 'h00000482 -#define NON_ASSOC_SLEEP_EN_BIT_MSB 0 -#define NON_ASSOC_SLEEP_EN_BIT_LSB 0 -#define NON_ASSOC_SLEEP_EN_BIT_MASK 'h00000001 -#define NON_ASSOC_SLEEP_EN_BIT_GET(x) (((x) & NON_ASSOC_SLEEP_EN_BIT_MASK) >> NON_ASSOC_SLEEP_EN_BIT_LSB) -#define NON_ASSOC_SLEEP_EN_BIT_SET(x) (((8'd0 | (x)) << NON_ASSOC_SLEEP_EN_BIT_LSB) & NON_ASSOC_SLEEP_EN_BIT_MASK) -#define NON_ASSOC_SLEEP_EN_BIT_RESET 1'h0 -#define NON_ASSOC_SLEEP_EN_RESET (8'h0 | \ - NON_ASSOC_SLEEP_EN_BIT_SET(NON_ASSOC_SLEEP_EN_BIT_RESET)) -#define NON_ASSOC_SLEEP_EN_HW_MASK (8'h0) -#define NON_ASSOC_SLEEP_EN_SW_MASK (8'h0 | \ - NON_ASSOC_SLEEP_EN_BIT_MASK) - -#define CIS_WINDOW_ADDRESS 'h00000600 -#define CIS_WINDOW_DATA_MSB 7 -#define CIS_WINDOW_DATA_LSB 0 -#define CIS_WINDOW_DATA_MASK 'h000000ff -#define CIS_WINDOW_DATA_GET(x) (((x) & CIS_WINDOW_DATA_MASK) >> CIS_WINDOW_DATA_LSB) -#define CIS_WINDOW_DATA_SET(x) (((8'd0 | (x)) << CIS_WINDOW_DATA_LSB) & CIS_WINDOW_DATA_MASK) -#define CIS_WINDOW_DATA_RESET 8'h0 -#define CIS_WINDOW_RESET (8'h0 | \ - CIS_WINDOW_DATA_SET(CIS_WINDOW_DATA_RESET)) -#define CIS_WINDOW_HW_MASK (8'h0) -#define CIS_WINDOW_SW_MASK (8'h0 | \ - CIS_WINDOW_DATA_MASK) - -#define MBOX_HOST_REG_ADDRESS_MSB 10 - -#endif /* _MBOX_HOST_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/mbox_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/mbox_reg.h deleted file mode 100644 index 4e07d2286107..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/mbox_reg.h +++ /dev/null @@ -1,481 +0,0 @@ -#ifndef _MBOX_REG_REG_H_ -#define _MBOX_REG_REG_H_ - -#define MBOX_FIFO_ADDRESS 0x00000000 -#define MBOX_FIFO_OFFSET 0x00000000 -#define MBOX_FIFO_DATA_MSB 19 -#define MBOX_FIFO_DATA_LSB 0 -#define MBOX_FIFO_DATA_MASK 0x000fffff -#define MBOX_FIFO_DATA_GET(x) (((x) & MBOX_FIFO_DATA_MASK) >> MBOX_FIFO_DATA_LSB) -#define MBOX_FIFO_DATA_SET(x) (((x) << MBOX_FIFO_DATA_LSB) & MBOX_FIFO_DATA_MASK) - -#define MBOX_FIFO_STATUS_ADDRESS 0x00000010 -#define MBOX_FIFO_STATUS_OFFSET 0x00000010 -#define MBOX_FIFO_STATUS_EMPTY_MSB 19 -#define MBOX_FIFO_STATUS_EMPTY_LSB 16 -#define MBOX_FIFO_STATUS_EMPTY_MASK 0x000f0000 -#define MBOX_FIFO_STATUS_EMPTY_GET(x) (((x) & MBOX_FIFO_STATUS_EMPTY_MASK) >> MBOX_FIFO_STATUS_EMPTY_LSB) -#define MBOX_FIFO_STATUS_EMPTY_SET(x) (((x) << MBOX_FIFO_STATUS_EMPTY_LSB) & MBOX_FIFO_STATUS_EMPTY_MASK) -#define MBOX_FIFO_STATUS_FULL_MSB 15 -#define MBOX_FIFO_STATUS_FULL_LSB 12 -#define MBOX_FIFO_STATUS_FULL_MASK 0x0000f000 -#define MBOX_FIFO_STATUS_FULL_GET(x) (((x) & MBOX_FIFO_STATUS_FULL_MASK) >> MBOX_FIFO_STATUS_FULL_LSB) -#define MBOX_FIFO_STATUS_FULL_SET(x) (((x) << MBOX_FIFO_STATUS_FULL_LSB) & MBOX_FIFO_STATUS_FULL_MASK) - -#define MBOX_DMA_POLICY_ADDRESS 0x00000014 -#define MBOX_DMA_POLICY_OFFSET 0x00000014 -#define MBOX_DMA_POLICY_TX_QUANTUM_MSB 3 -#define MBOX_DMA_POLICY_TX_QUANTUM_LSB 3 -#define MBOX_DMA_POLICY_TX_QUANTUM_MASK 0x00000008 -#define MBOX_DMA_POLICY_TX_QUANTUM_GET(x) (((x) & MBOX_DMA_POLICY_TX_QUANTUM_MASK) >> MBOX_DMA_POLICY_TX_QUANTUM_LSB) -#define MBOX_DMA_POLICY_TX_QUANTUM_SET(x) (((x) << MBOX_DMA_POLICY_TX_QUANTUM_LSB) & MBOX_DMA_POLICY_TX_QUANTUM_MASK) -#define MBOX_DMA_POLICY_TX_ORDER_MSB 2 -#define MBOX_DMA_POLICY_TX_ORDER_LSB 2 -#define MBOX_DMA_POLICY_TX_ORDER_MASK 0x00000004 -#define MBOX_DMA_POLICY_TX_ORDER_GET(x) (((x) & MBOX_DMA_POLICY_TX_ORDER_MASK) >> MBOX_DMA_POLICY_TX_ORDER_LSB) -#define MBOX_DMA_POLICY_TX_ORDER_SET(x) (((x) << MBOX_DMA_POLICY_TX_ORDER_LSB) & MBOX_DMA_POLICY_TX_ORDER_MASK) -#define MBOX_DMA_POLICY_RX_QUANTUM_MSB 1 -#define MBOX_DMA_POLICY_RX_QUANTUM_LSB 1 -#define MBOX_DMA_POLICY_RX_QUANTUM_MASK 0x00000002 -#define MBOX_DMA_POLICY_RX_QUANTUM_GET(x) (((x) & MBOX_DMA_POLICY_RX_QUANTUM_MASK) >> MBOX_DMA_POLICY_RX_QUANTUM_LSB) -#define MBOX_DMA_POLICY_RX_QUANTUM_SET(x) (((x) << MBOX_DMA_POLICY_RX_QUANTUM_LSB) & MBOX_DMA_POLICY_RX_QUANTUM_MASK) -#define MBOX_DMA_POLICY_RX_ORDER_MSB 0 -#define MBOX_DMA_POLICY_RX_ORDER_LSB 0 -#define MBOX_DMA_POLICY_RX_ORDER_MASK 0x00000001 -#define MBOX_DMA_POLICY_RX_ORDER_GET(x) (((x) & MBOX_DMA_POLICY_RX_ORDER_MASK) >> MBOX_DMA_POLICY_RX_ORDER_LSB) -#define MBOX_DMA_POLICY_RX_ORDER_SET(x) (((x) << MBOX_DMA_POLICY_RX_ORDER_LSB) & MBOX_DMA_POLICY_RX_ORDER_MASK) - -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000018 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000018 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX0_DMA_RX_CONTROL_ADDRESS 0x0000001c -#define MBOX0_DMA_RX_CONTROL_OFFSET 0x0000001c -#define MBOX0_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX0_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX0_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX0_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_RESUME_MASK) >> MBOX0_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX0_DMA_RX_CONTROL_RESUME_SET(x) (((x) << MBOX0_DMA_RX_CONTROL_RESUME_LSB) & MBOX0_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX0_DMA_RX_CONTROL_START_MSB 1 -#define MBOX0_DMA_RX_CONTROL_START_LSB 1 -#define MBOX0_DMA_RX_CONTROL_START_MASK 0x00000002 -#define MBOX0_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_START_MASK) >> MBOX0_DMA_RX_CONTROL_START_LSB) -#define MBOX0_DMA_RX_CONTROL_START_SET(x) (((x) << MBOX0_DMA_RX_CONTROL_START_LSB) & MBOX0_DMA_RX_CONTROL_START_MASK) -#define MBOX0_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX0_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX0_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define MBOX0_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_STOP_MASK) >> MBOX0_DMA_RX_CONTROL_STOP_LSB) -#define MBOX0_DMA_RX_CONTROL_STOP_SET(x) (((x) << MBOX0_DMA_RX_CONTROL_STOP_LSB) & MBOX0_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000020 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000020 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX0_DMA_TX_CONTROL_ADDRESS 0x00000024 -#define MBOX0_DMA_TX_CONTROL_OFFSET 0x00000024 -#define MBOX0_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX0_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX0_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX0_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_RESUME_MASK) >> MBOX0_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX0_DMA_TX_CONTROL_RESUME_SET(x) (((x) << MBOX0_DMA_TX_CONTROL_RESUME_LSB) & MBOX0_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX0_DMA_TX_CONTROL_START_MSB 1 -#define MBOX0_DMA_TX_CONTROL_START_LSB 1 -#define MBOX0_DMA_TX_CONTROL_START_MASK 0x00000002 -#define MBOX0_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_START_MASK) >> MBOX0_DMA_TX_CONTROL_START_LSB) -#define MBOX0_DMA_TX_CONTROL_START_SET(x) (((x) << MBOX0_DMA_TX_CONTROL_START_LSB) & MBOX0_DMA_TX_CONTROL_START_MASK) -#define MBOX0_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX0_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX0_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define MBOX0_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_STOP_MASK) >> MBOX0_DMA_TX_CONTROL_STOP_LSB) -#define MBOX0_DMA_TX_CONTROL_STOP_SET(x) (((x) << MBOX0_DMA_TX_CONTROL_STOP_LSB) & MBOX0_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000028 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000028 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX1_DMA_RX_CONTROL_ADDRESS 0x0000002c -#define MBOX1_DMA_RX_CONTROL_OFFSET 0x0000002c -#define MBOX1_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX1_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX1_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX1_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX1_DMA_RX_CONTROL_RESUME_MASK) >> MBOX1_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX1_DMA_RX_CONTROL_RESUME_SET(x) (((x) << MBOX1_DMA_RX_CONTROL_RESUME_LSB) & MBOX1_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX1_DMA_RX_CONTROL_START_MSB 1 -#define MBOX1_DMA_RX_CONTROL_START_LSB 1 -#define MBOX1_DMA_RX_CONTROL_START_MASK 0x00000002 -#define MBOX1_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX1_DMA_RX_CONTROL_START_MASK) >> MBOX1_DMA_RX_CONTROL_START_LSB) -#define MBOX1_DMA_RX_CONTROL_START_SET(x) (((x) << MBOX1_DMA_RX_CONTROL_START_LSB) & MBOX1_DMA_RX_CONTROL_START_MASK) -#define MBOX1_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX1_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX1_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define MBOX1_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX1_DMA_RX_CONTROL_STOP_MASK) >> MBOX1_DMA_RX_CONTROL_STOP_LSB) -#define MBOX1_DMA_RX_CONTROL_STOP_SET(x) (((x) << MBOX1_DMA_RX_CONTROL_STOP_LSB) & MBOX1_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000030 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000030 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX1_DMA_TX_CONTROL_ADDRESS 0x00000034 -#define MBOX1_DMA_TX_CONTROL_OFFSET 0x00000034 -#define MBOX1_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX1_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX1_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX1_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX1_DMA_TX_CONTROL_RESUME_MASK) >> MBOX1_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX1_DMA_TX_CONTROL_RESUME_SET(x) (((x) << MBOX1_DMA_TX_CONTROL_RESUME_LSB) & MBOX1_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX1_DMA_TX_CONTROL_START_MSB 1 -#define MBOX1_DMA_TX_CONTROL_START_LSB 1 -#define MBOX1_DMA_TX_CONTROL_START_MASK 0x00000002 -#define MBOX1_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX1_DMA_TX_CONTROL_START_MASK) >> MBOX1_DMA_TX_CONTROL_START_LSB) -#define MBOX1_DMA_TX_CONTROL_START_SET(x) (((x) << MBOX1_DMA_TX_CONTROL_START_LSB) & MBOX1_DMA_TX_CONTROL_START_MASK) -#define MBOX1_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX1_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX1_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define MBOX1_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX1_DMA_TX_CONTROL_STOP_MASK) >> MBOX1_DMA_TX_CONTROL_STOP_LSB) -#define MBOX1_DMA_TX_CONTROL_STOP_SET(x) (((x) << MBOX1_DMA_TX_CONTROL_STOP_LSB) & MBOX1_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000038 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000038 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX2_DMA_RX_CONTROL_ADDRESS 0x0000003c -#define MBOX2_DMA_RX_CONTROL_OFFSET 0x0000003c -#define MBOX2_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX2_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX2_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX2_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX2_DMA_RX_CONTROL_RESUME_MASK) >> MBOX2_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX2_DMA_RX_CONTROL_RESUME_SET(x) (((x) << MBOX2_DMA_RX_CONTROL_RESUME_LSB) & MBOX2_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX2_DMA_RX_CONTROL_START_MSB 1 -#define MBOX2_DMA_RX_CONTROL_START_LSB 1 -#define MBOX2_DMA_RX_CONTROL_START_MASK 0x00000002 -#define MBOX2_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX2_DMA_RX_CONTROL_START_MASK) >> MBOX2_DMA_RX_CONTROL_START_LSB) -#define MBOX2_DMA_RX_CONTROL_START_SET(x) (((x) << MBOX2_DMA_RX_CONTROL_START_LSB) & MBOX2_DMA_RX_CONTROL_START_MASK) -#define MBOX2_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX2_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX2_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define MBOX2_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX2_DMA_RX_CONTROL_STOP_MASK) >> MBOX2_DMA_RX_CONTROL_STOP_LSB) -#define MBOX2_DMA_RX_CONTROL_STOP_SET(x) (((x) << MBOX2_DMA_RX_CONTROL_STOP_LSB) & MBOX2_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000040 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000040 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX2_DMA_TX_CONTROL_ADDRESS 0x00000044 -#define MBOX2_DMA_TX_CONTROL_OFFSET 0x00000044 -#define MBOX2_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX2_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX2_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX2_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX2_DMA_TX_CONTROL_RESUME_MASK) >> MBOX2_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX2_DMA_TX_CONTROL_RESUME_SET(x) (((x) << MBOX2_DMA_TX_CONTROL_RESUME_LSB) & MBOX2_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX2_DMA_TX_CONTROL_START_MSB 1 -#define MBOX2_DMA_TX_CONTROL_START_LSB 1 -#define MBOX2_DMA_TX_CONTROL_START_MASK 0x00000002 -#define MBOX2_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX2_DMA_TX_CONTROL_START_MASK) >> MBOX2_DMA_TX_CONTROL_START_LSB) -#define MBOX2_DMA_TX_CONTROL_START_SET(x) (((x) << MBOX2_DMA_TX_CONTROL_START_LSB) & MBOX2_DMA_TX_CONTROL_START_MASK) -#define MBOX2_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX2_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX2_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define MBOX2_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX2_DMA_TX_CONTROL_STOP_MASK) >> MBOX2_DMA_TX_CONTROL_STOP_LSB) -#define MBOX2_DMA_TX_CONTROL_STOP_SET(x) (((x) << MBOX2_DMA_TX_CONTROL_STOP_LSB) & MBOX2_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000048 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000048 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX3_DMA_RX_CONTROL_ADDRESS 0x0000004c -#define MBOX3_DMA_RX_CONTROL_OFFSET 0x0000004c -#define MBOX3_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX3_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX3_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX3_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX3_DMA_RX_CONTROL_RESUME_MASK) >> MBOX3_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX3_DMA_RX_CONTROL_RESUME_SET(x) (((x) << MBOX3_DMA_RX_CONTROL_RESUME_LSB) & MBOX3_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX3_DMA_RX_CONTROL_START_MSB 1 -#define MBOX3_DMA_RX_CONTROL_START_LSB 1 -#define MBOX3_DMA_RX_CONTROL_START_MASK 0x00000002 -#define MBOX3_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX3_DMA_RX_CONTROL_START_MASK) >> MBOX3_DMA_RX_CONTROL_START_LSB) -#define MBOX3_DMA_RX_CONTROL_START_SET(x) (((x) << MBOX3_DMA_RX_CONTROL_START_LSB) & MBOX3_DMA_RX_CONTROL_START_MASK) -#define MBOX3_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX3_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX3_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define MBOX3_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX3_DMA_RX_CONTROL_STOP_MASK) >> MBOX3_DMA_RX_CONTROL_STOP_LSB) -#define MBOX3_DMA_RX_CONTROL_STOP_SET(x) (((x) << MBOX3_DMA_RX_CONTROL_STOP_LSB) & MBOX3_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000050 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000050 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX3_DMA_TX_CONTROL_ADDRESS 0x00000054 -#define MBOX3_DMA_TX_CONTROL_OFFSET 0x00000054 -#define MBOX3_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX3_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX3_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX3_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX3_DMA_TX_CONTROL_RESUME_MASK) >> MBOX3_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX3_DMA_TX_CONTROL_RESUME_SET(x) (((x) << MBOX3_DMA_TX_CONTROL_RESUME_LSB) & MBOX3_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX3_DMA_TX_CONTROL_START_MSB 1 -#define MBOX3_DMA_TX_CONTROL_START_LSB 1 -#define MBOX3_DMA_TX_CONTROL_START_MASK 0x00000002 -#define MBOX3_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX3_DMA_TX_CONTROL_START_MASK) >> MBOX3_DMA_TX_CONTROL_START_LSB) -#define MBOX3_DMA_TX_CONTROL_START_SET(x) (((x) << MBOX3_DMA_TX_CONTROL_START_LSB) & MBOX3_DMA_TX_CONTROL_START_MASK) -#define MBOX3_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX3_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX3_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define MBOX3_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX3_DMA_TX_CONTROL_STOP_MASK) >> MBOX3_DMA_TX_CONTROL_STOP_LSB) -#define MBOX3_DMA_TX_CONTROL_STOP_SET(x) (((x) << MBOX3_DMA_TX_CONTROL_STOP_LSB) & MBOX3_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX_INT_STATUS_ADDRESS 0x00000058 -#define MBOX_INT_STATUS_OFFSET 0x00000058 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_MSB 31 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB 28 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK 0xf0000000 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) >> MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) (((x) << MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) & MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB 27 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB 24 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK 0x0f000000 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) >> MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) (((x) << MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) & MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_MSB 23 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB 20 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK 0x00f00000 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) >> MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) (((x) << MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) & MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) -#define MBOX_INT_STATUS_TX_OVERFLOW_MSB 17 -#define MBOX_INT_STATUS_TX_OVERFLOW_LSB 17 -#define MBOX_INT_STATUS_TX_OVERFLOW_MASK 0x00020000 -#define MBOX_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & MBOX_INT_STATUS_TX_OVERFLOW_MASK) >> MBOX_INT_STATUS_TX_OVERFLOW_LSB) -#define MBOX_INT_STATUS_TX_OVERFLOW_SET(x) (((x) << MBOX_INT_STATUS_TX_OVERFLOW_LSB) & MBOX_INT_STATUS_TX_OVERFLOW_MASK) -#define MBOX_INT_STATUS_RX_UNDERFLOW_MSB 16 -#define MBOX_INT_STATUS_RX_UNDERFLOW_LSB 16 -#define MBOX_INT_STATUS_RX_UNDERFLOW_MASK 0x00010000 -#define MBOX_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & MBOX_INT_STATUS_RX_UNDERFLOW_MASK) >> MBOX_INT_STATUS_RX_UNDERFLOW_LSB) -#define MBOX_INT_STATUS_RX_UNDERFLOW_SET(x) (((x) << MBOX_INT_STATUS_RX_UNDERFLOW_LSB) & MBOX_INT_STATUS_RX_UNDERFLOW_MASK) -#define MBOX_INT_STATUS_TX_NOT_EMPTY_MSB 15 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_LSB 12 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_MASK 0x0000f000 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) (((x) & MBOX_INT_STATUS_TX_NOT_EMPTY_MASK) >> MBOX_INT_STATUS_TX_NOT_EMPTY_LSB) -#define MBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) (((x) << MBOX_INT_STATUS_TX_NOT_EMPTY_LSB) & MBOX_INT_STATUS_TX_NOT_EMPTY_MASK) -#define MBOX_INT_STATUS_RX_NOT_FULL_MSB 11 -#define MBOX_INT_STATUS_RX_NOT_FULL_LSB 8 -#define MBOX_INT_STATUS_RX_NOT_FULL_MASK 0x00000f00 -#define MBOX_INT_STATUS_RX_NOT_FULL_GET(x) (((x) & MBOX_INT_STATUS_RX_NOT_FULL_MASK) >> MBOX_INT_STATUS_RX_NOT_FULL_LSB) -#define MBOX_INT_STATUS_RX_NOT_FULL_SET(x) (((x) << MBOX_INT_STATUS_RX_NOT_FULL_LSB) & MBOX_INT_STATUS_RX_NOT_FULL_MASK) -#define MBOX_INT_STATUS_HOST_MSB 7 -#define MBOX_INT_STATUS_HOST_LSB 0 -#define MBOX_INT_STATUS_HOST_MASK 0x000000ff -#define MBOX_INT_STATUS_HOST_GET(x) (((x) & MBOX_INT_STATUS_HOST_MASK) >> MBOX_INT_STATUS_HOST_LSB) -#define MBOX_INT_STATUS_HOST_SET(x) (((x) << MBOX_INT_STATUS_HOST_LSB) & MBOX_INT_STATUS_HOST_MASK) - -#define MBOX_INT_ENABLE_ADDRESS 0x0000005c -#define MBOX_INT_ENABLE_OFFSET 0x0000005c -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB 31 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB 28 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK 0xf0000000 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) >> MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) (((x) << MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) & MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB 27 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB 24 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK 0x0f000000 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) >> MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) (((x) << MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) & MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB 23 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB 20 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK 0x00f00000 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) >> MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) (((x) << MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) & MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) -#define MBOX_INT_ENABLE_TX_OVERFLOW_MSB 17 -#define MBOX_INT_ENABLE_TX_OVERFLOW_LSB 17 -#define MBOX_INT_ENABLE_TX_OVERFLOW_MASK 0x00020000 -#define MBOX_INT_ENABLE_TX_OVERFLOW_GET(x) (((x) & MBOX_INT_ENABLE_TX_OVERFLOW_MASK) >> MBOX_INT_ENABLE_TX_OVERFLOW_LSB) -#define MBOX_INT_ENABLE_TX_OVERFLOW_SET(x) (((x) << MBOX_INT_ENABLE_TX_OVERFLOW_LSB) & MBOX_INT_ENABLE_TX_OVERFLOW_MASK) -#define MBOX_INT_ENABLE_RX_UNDERFLOW_MSB 16 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_LSB 16 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_MASK 0x00010000 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) (((x) & MBOX_INT_ENABLE_RX_UNDERFLOW_MASK) >> MBOX_INT_ENABLE_RX_UNDERFLOW_LSB) -#define MBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) (((x) << MBOX_INT_ENABLE_RX_UNDERFLOW_LSB) & MBOX_INT_ENABLE_RX_UNDERFLOW_MASK) -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_MSB 15 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB 12 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK 0x0000f000 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) (((x) & MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) >> MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) (((x) << MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) & MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) -#define MBOX_INT_ENABLE_RX_NOT_FULL_MSB 11 -#define MBOX_INT_ENABLE_RX_NOT_FULL_LSB 8 -#define MBOX_INT_ENABLE_RX_NOT_FULL_MASK 0x00000f00 -#define MBOX_INT_ENABLE_RX_NOT_FULL_GET(x) (((x) & MBOX_INT_ENABLE_RX_NOT_FULL_MASK) >> MBOX_INT_ENABLE_RX_NOT_FULL_LSB) -#define MBOX_INT_ENABLE_RX_NOT_FULL_SET(x) (((x) << MBOX_INT_ENABLE_RX_NOT_FULL_LSB) & MBOX_INT_ENABLE_RX_NOT_FULL_MASK) -#define MBOX_INT_ENABLE_HOST_MSB 7 -#define MBOX_INT_ENABLE_HOST_LSB 0 -#define MBOX_INT_ENABLE_HOST_MASK 0x000000ff -#define MBOX_INT_ENABLE_HOST_GET(x) (((x) & MBOX_INT_ENABLE_HOST_MASK) >> MBOX_INT_ENABLE_HOST_LSB) -#define MBOX_INT_ENABLE_HOST_SET(x) (((x) << MBOX_INT_ENABLE_HOST_LSB) & MBOX_INT_ENABLE_HOST_MASK) - -#define INT_HOST_ADDRESS 0x00000060 -#define INT_HOST_OFFSET 0x00000060 -#define INT_HOST_VECTOR_MSB 7 -#define INT_HOST_VECTOR_LSB 0 -#define INT_HOST_VECTOR_MASK 0x000000ff -#define INT_HOST_VECTOR_GET(x) (((x) & INT_HOST_VECTOR_MASK) >> INT_HOST_VECTOR_LSB) -#define INT_HOST_VECTOR_SET(x) (((x) << INT_HOST_VECTOR_LSB) & INT_HOST_VECTOR_MASK) - -#define LOCAL_COUNT_ADDRESS 0x00000080 -#define LOCAL_COUNT_OFFSET 0x00000080 -#define LOCAL_COUNT_VALUE_MSB 7 -#define LOCAL_COUNT_VALUE_LSB 0 -#define LOCAL_COUNT_VALUE_MASK 0x000000ff -#define LOCAL_COUNT_VALUE_GET(x) (((x) & LOCAL_COUNT_VALUE_MASK) >> LOCAL_COUNT_VALUE_LSB) -#define LOCAL_COUNT_VALUE_SET(x) (((x) << LOCAL_COUNT_VALUE_LSB) & LOCAL_COUNT_VALUE_MASK) - -#define COUNT_INC_ADDRESS 0x000000a0 -#define COUNT_INC_OFFSET 0x000000a0 -#define COUNT_INC_VALUE_MSB 7 -#define COUNT_INC_VALUE_LSB 0 -#define COUNT_INC_VALUE_MASK 0x000000ff -#define COUNT_INC_VALUE_GET(x) (((x) & COUNT_INC_VALUE_MASK) >> COUNT_INC_VALUE_LSB) -#define COUNT_INC_VALUE_SET(x) (((x) << COUNT_INC_VALUE_LSB) & COUNT_INC_VALUE_MASK) - -#define LOCAL_SCRATCH_ADDRESS 0x000000c0 -#define LOCAL_SCRATCH_OFFSET 0x000000c0 -#define LOCAL_SCRATCH_VALUE_MSB 7 -#define LOCAL_SCRATCH_VALUE_LSB 0 -#define LOCAL_SCRATCH_VALUE_MASK 0x000000ff -#define LOCAL_SCRATCH_VALUE_GET(x) (((x) & LOCAL_SCRATCH_VALUE_MASK) >> LOCAL_SCRATCH_VALUE_LSB) -#define LOCAL_SCRATCH_VALUE_SET(x) (((x) << LOCAL_SCRATCH_VALUE_LSB) & LOCAL_SCRATCH_VALUE_MASK) - -#define USE_LOCAL_BUS_ADDRESS 0x000000e0 -#define USE_LOCAL_BUS_OFFSET 0x000000e0 -#define USE_LOCAL_BUS_PIN_INIT_MSB 0 -#define USE_LOCAL_BUS_PIN_INIT_LSB 0 -#define USE_LOCAL_BUS_PIN_INIT_MASK 0x00000001 -#define USE_LOCAL_BUS_PIN_INIT_GET(x) (((x) & USE_LOCAL_BUS_PIN_INIT_MASK) >> USE_LOCAL_BUS_PIN_INIT_LSB) -#define USE_LOCAL_BUS_PIN_INIT_SET(x) (((x) << USE_LOCAL_BUS_PIN_INIT_LSB) & USE_LOCAL_BUS_PIN_INIT_MASK) - -#define SDIO_CONFIG_ADDRESS 0x000000e4 -#define SDIO_CONFIG_OFFSET 0x000000e4 -#define SDIO_CONFIG_CCCR_IOR1_MSB 0 -#define SDIO_CONFIG_CCCR_IOR1_LSB 0 -#define SDIO_CONFIG_CCCR_IOR1_MASK 0x00000001 -#define SDIO_CONFIG_CCCR_IOR1_GET(x) (((x) & SDIO_CONFIG_CCCR_IOR1_MASK) >> SDIO_CONFIG_CCCR_IOR1_LSB) -#define SDIO_CONFIG_CCCR_IOR1_SET(x) (((x) << SDIO_CONFIG_CCCR_IOR1_LSB) & SDIO_CONFIG_CCCR_IOR1_MASK) - -#define MBOX_DEBUG_ADDRESS 0x000000e8 -#define MBOX_DEBUG_OFFSET 0x000000e8 -#define MBOX_DEBUG_SEL_MSB 2 -#define MBOX_DEBUG_SEL_LSB 0 -#define MBOX_DEBUG_SEL_MASK 0x00000007 -#define MBOX_DEBUG_SEL_GET(x) (((x) & MBOX_DEBUG_SEL_MASK) >> MBOX_DEBUG_SEL_LSB) -#define MBOX_DEBUG_SEL_SET(x) (((x) << MBOX_DEBUG_SEL_LSB) & MBOX_DEBUG_SEL_MASK) - -#define MBOX_FIFO_RESET_ADDRESS 0x000000ec -#define MBOX_FIFO_RESET_OFFSET 0x000000ec -#define MBOX_FIFO_RESET_INIT_MSB 0 -#define MBOX_FIFO_RESET_INIT_LSB 0 -#define MBOX_FIFO_RESET_INIT_MASK 0x00000001 -#define MBOX_FIFO_RESET_INIT_GET(x) (((x) & MBOX_FIFO_RESET_INIT_MASK) >> MBOX_FIFO_RESET_INIT_LSB) -#define MBOX_FIFO_RESET_INIT_SET(x) (((x) << MBOX_FIFO_RESET_INIT_LSB) & MBOX_FIFO_RESET_INIT_MASK) - -#define MBOX_TXFIFO_POP_ADDRESS 0x000000f0 -#define MBOX_TXFIFO_POP_OFFSET 0x000000f0 -#define MBOX_TXFIFO_POP_DATA_MSB 0 -#define MBOX_TXFIFO_POP_DATA_LSB 0 -#define MBOX_TXFIFO_POP_DATA_MASK 0x00000001 -#define MBOX_TXFIFO_POP_DATA_GET(x) (((x) & MBOX_TXFIFO_POP_DATA_MASK) >> MBOX_TXFIFO_POP_DATA_LSB) -#define MBOX_TXFIFO_POP_DATA_SET(x) (((x) << MBOX_TXFIFO_POP_DATA_LSB) & MBOX_TXFIFO_POP_DATA_MASK) - -#define MBOX_RXFIFO_POP_ADDRESS 0x00000100 -#define MBOX_RXFIFO_POP_OFFSET 0x00000100 -#define MBOX_RXFIFO_POP_DATA_MSB 0 -#define MBOX_RXFIFO_POP_DATA_LSB 0 -#define MBOX_RXFIFO_POP_DATA_MASK 0x00000001 -#define MBOX_RXFIFO_POP_DATA_GET(x) (((x) & MBOX_RXFIFO_POP_DATA_MASK) >> MBOX_RXFIFO_POP_DATA_LSB) -#define MBOX_RXFIFO_POP_DATA_SET(x) (((x) << MBOX_RXFIFO_POP_DATA_LSB) & MBOX_RXFIFO_POP_DATA_MASK) - -#define SDIO_DEBUG_ADDRESS 0x00000110 -#define SDIO_DEBUG_OFFSET 0x00000110 -#define SDIO_DEBUG_SEL_MSB 3 -#define SDIO_DEBUG_SEL_LSB 0 -#define SDIO_DEBUG_SEL_MASK 0x0000000f -#define SDIO_DEBUG_SEL_GET(x) (((x) & SDIO_DEBUG_SEL_MASK) >> SDIO_DEBUG_SEL_LSB) -#define SDIO_DEBUG_SEL_SET(x) (((x) << SDIO_DEBUG_SEL_LSB) & SDIO_DEBUG_SEL_MASK) - -#define HOST_IF_WINDOW_ADDRESS 0x00002000 -#define HOST_IF_WINDOW_OFFSET 0x00002000 -#define HOST_IF_WINDOW_DATA_MSB 7 -#define HOST_IF_WINDOW_DATA_LSB 0 -#define HOST_IF_WINDOW_DATA_MASK 0x000000ff -#define HOST_IF_WINDOW_DATA_GET(x) (((x) & HOST_IF_WINDOW_DATA_MASK) >> HOST_IF_WINDOW_DATA_LSB) -#define HOST_IF_WINDOW_DATA_SET(x) (((x) << HOST_IF_WINDOW_DATA_LSB) & HOST_IF_WINDOW_DATA_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct mbox_reg_reg_s { - volatile unsigned int mbox_fifo[4]; - volatile unsigned int mbox_fifo_status; - volatile unsigned int mbox_dma_policy; - volatile unsigned int mbox0_dma_rx_descriptor_base; - volatile unsigned int mbox0_dma_rx_control; - volatile unsigned int mbox0_dma_tx_descriptor_base; - volatile unsigned int mbox0_dma_tx_control; - volatile unsigned int mbox1_dma_rx_descriptor_base; - volatile unsigned int mbox1_dma_rx_control; - volatile unsigned int mbox1_dma_tx_descriptor_base; - volatile unsigned int mbox1_dma_tx_control; - volatile unsigned int mbox2_dma_rx_descriptor_base; - volatile unsigned int mbox2_dma_rx_control; - volatile unsigned int mbox2_dma_tx_descriptor_base; - volatile unsigned int mbox2_dma_tx_control; - volatile unsigned int mbox3_dma_rx_descriptor_base; - volatile unsigned int mbox3_dma_rx_control; - volatile unsigned int mbox3_dma_tx_descriptor_base; - volatile unsigned int mbox3_dma_tx_control; - volatile unsigned int mbox_int_status; - volatile unsigned int mbox_int_enable; - volatile unsigned int int_host; - unsigned char pad0[28]; /* pad to 0x80 */ - volatile unsigned int local_count[8]; - volatile unsigned int count_inc[8]; - volatile unsigned int local_scratch[8]; - volatile unsigned int use_local_bus; - volatile unsigned int sdio_config; - volatile unsigned int mbox_debug; - volatile unsigned int mbox_fifo_reset; - volatile unsigned int mbox_txfifo_pop[4]; - volatile unsigned int mbox_rxfifo_pop[4]; - volatile unsigned int sdio_debug; - unsigned char pad1[7916]; /* pad to 0x2000 */ - volatile unsigned int host_if_window[2048]; -} mbox_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _MBOX_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/mbox_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/mbox_reg.vrh deleted file mode 100644 index a6d23e84b9a4..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/mbox_reg.vrh +++ /dev/null @@ -1,746 +0,0 @@ -#ifndef _MBOX_REG_VRH_ -#define _MBOX_REG_VRH_ - -#define MBOX_FIFO_ADDRESS 'h00000000 -#define MBOX_FIFO_DATA_MSB 19 -#define MBOX_FIFO_DATA_LSB 0 -#define MBOX_FIFO_DATA_MASK 'h000fffff -#define MBOX_FIFO_DATA_GET(x) (((x) & MBOX_FIFO_DATA_MASK) >> MBOX_FIFO_DATA_LSB) -#define MBOX_FIFO_DATA_SET(x) (((32'd0 | (x)) << MBOX_FIFO_DATA_LSB) & MBOX_FIFO_DATA_MASK) -#define MBOX_FIFO_DATA_RESET 20'h0 -#define MBOX_FIFO_RESET (32'h0 | \ - MBOX_FIFO_DATA_SET(MBOX_FIFO_DATA_RESET)) -#define MBOX_FIFO_HW_MASK (32'h0 | \ - MBOX_FIFO_DATA_MASK) -#define MBOX_FIFO_SW_MASK (32'h0 | \ - MBOX_FIFO_DATA_MASK) - -#define MBOX_FIFO_STATUS_ADDRESS 'h00000010 -#define MBOX_FIFO_STATUS_EMPTY_MSB 19 -#define MBOX_FIFO_STATUS_EMPTY_LSB 16 -#define MBOX_FIFO_STATUS_EMPTY_MASK 'h000f0000 -#define MBOX_FIFO_STATUS_EMPTY_GET(x) (((x) & MBOX_FIFO_STATUS_EMPTY_MASK) >> MBOX_FIFO_STATUS_EMPTY_LSB) -#define MBOX_FIFO_STATUS_EMPTY_SET(x) (((32'd0 | (x)) << MBOX_FIFO_STATUS_EMPTY_LSB) & MBOX_FIFO_STATUS_EMPTY_MASK) -#define MBOX_FIFO_STATUS_EMPTY_RESET 4'hf -#define MBOX_FIFO_STATUS_FULL_MSB 15 -#define MBOX_FIFO_STATUS_FULL_LSB 12 -#define MBOX_FIFO_STATUS_FULL_MASK 'h0000f000 -#define MBOX_FIFO_STATUS_FULL_GET(x) (((x) & MBOX_FIFO_STATUS_FULL_MASK) >> MBOX_FIFO_STATUS_FULL_LSB) -#define MBOX_FIFO_STATUS_FULL_SET(x) (((32'd0 | (x)) << MBOX_FIFO_STATUS_FULL_LSB) & MBOX_FIFO_STATUS_FULL_MASK) -#define MBOX_FIFO_STATUS_FULL_RESET 4'h0 -#define MBOX_FIFO_STATUS_RESET (32'h0 | \ - MBOX_FIFO_STATUS_EMPTY_SET(MBOX_FIFO_STATUS_EMPTY_RESET) | \ - MBOX_FIFO_STATUS_FULL_SET(MBOX_FIFO_STATUS_FULL_RESET)) -#define MBOX_FIFO_STATUS_HW_MASK (32'h0 | \ - MBOX_FIFO_STATUS_EMPTY_MASK | \ - MBOX_FIFO_STATUS_FULL_MASK) -#define MBOX_FIFO_STATUS_SW_MASK (32'h0) - -#define MBOX_DMA_POLICY_ADDRESS 'h00000014 -#define MBOX_DMA_POLICY_TX_QUANTUM_MSB 3 -#define MBOX_DMA_POLICY_TX_QUANTUM_LSB 3 -#define MBOX_DMA_POLICY_TX_QUANTUM_MASK 'h00000008 -#define MBOX_DMA_POLICY_TX_QUANTUM_GET(x) (((x) & MBOX_DMA_POLICY_TX_QUANTUM_MASK) >> MBOX_DMA_POLICY_TX_QUANTUM_LSB) -#define MBOX_DMA_POLICY_TX_QUANTUM_SET(x) (((32'd0 | (x)) << MBOX_DMA_POLICY_TX_QUANTUM_LSB) & MBOX_DMA_POLICY_TX_QUANTUM_MASK) -#define MBOX_DMA_POLICY_TX_QUANTUM_RESET 1'h0 -#define MBOX_DMA_POLICY_TX_ORDER_MSB 2 -#define MBOX_DMA_POLICY_TX_ORDER_LSB 2 -#define MBOX_DMA_POLICY_TX_ORDER_MASK 'h00000004 -#define MBOX_DMA_POLICY_TX_ORDER_GET(x) (((x) & MBOX_DMA_POLICY_TX_ORDER_MASK) >> MBOX_DMA_POLICY_TX_ORDER_LSB) -#define MBOX_DMA_POLICY_TX_ORDER_SET(x) (((32'd0 | (x)) << MBOX_DMA_POLICY_TX_ORDER_LSB) & MBOX_DMA_POLICY_TX_ORDER_MASK) -#define MBOX_DMA_POLICY_TX_ORDER_RESET 1'h0 -#define MBOX_DMA_POLICY_RX_QUANTUM_MSB 1 -#define MBOX_DMA_POLICY_RX_QUANTUM_LSB 1 -#define MBOX_DMA_POLICY_RX_QUANTUM_MASK 'h00000002 -#define MBOX_DMA_POLICY_RX_QUANTUM_GET(x) (((x) & MBOX_DMA_POLICY_RX_QUANTUM_MASK) >> MBOX_DMA_POLICY_RX_QUANTUM_LSB) -#define MBOX_DMA_POLICY_RX_QUANTUM_SET(x) (((32'd0 | (x)) << MBOX_DMA_POLICY_RX_QUANTUM_LSB) & MBOX_DMA_POLICY_RX_QUANTUM_MASK) -#define MBOX_DMA_POLICY_RX_QUANTUM_RESET 1'h0 -#define MBOX_DMA_POLICY_RX_ORDER_MSB 0 -#define MBOX_DMA_POLICY_RX_ORDER_LSB 0 -#define MBOX_DMA_POLICY_RX_ORDER_MASK 'h00000001 -#define MBOX_DMA_POLICY_RX_ORDER_GET(x) (((x) & MBOX_DMA_POLICY_RX_ORDER_MASK) >> MBOX_DMA_POLICY_RX_ORDER_LSB) -#define MBOX_DMA_POLICY_RX_ORDER_SET(x) (((32'd0 | (x)) << MBOX_DMA_POLICY_RX_ORDER_LSB) & MBOX_DMA_POLICY_RX_ORDER_MASK) -#define MBOX_DMA_POLICY_RX_ORDER_RESET 1'h0 -#define MBOX_DMA_POLICY_RESET (32'h0 | \ - MBOX_DMA_POLICY_TX_QUANTUM_SET(MBOX_DMA_POLICY_TX_QUANTUM_RESET) | \ - MBOX_DMA_POLICY_TX_ORDER_SET(MBOX_DMA_POLICY_TX_ORDER_RESET) | \ - MBOX_DMA_POLICY_RX_QUANTUM_SET(MBOX_DMA_POLICY_RX_QUANTUM_RESET) | \ - MBOX_DMA_POLICY_RX_ORDER_SET(MBOX_DMA_POLICY_RX_ORDER_RESET)) -#define MBOX_DMA_POLICY_HW_MASK (32'h0) -#define MBOX_DMA_POLICY_SW_MASK (32'h0 | \ - MBOX_DMA_POLICY_TX_QUANTUM_MASK | \ - MBOX_DMA_POLICY_TX_ORDER_MASK | \ - MBOX_DMA_POLICY_RX_QUANTUM_MASK | \ - MBOX_DMA_POLICY_RX_ORDER_MASK) - -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS 'h00000018 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX0_DMA_RX_CONTROL_ADDRESS 'h0000001c -#define MBOX0_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX0_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX0_DMA_RX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX0_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_RESUME_MASK) >> MBOX0_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX0_DMA_RX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX0_DMA_RX_CONTROL_RESUME_LSB) & MBOX0_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX0_DMA_RX_CONTROL_RESUME_RESET 1'h0 -#define MBOX0_DMA_RX_CONTROL_START_MSB 1 -#define MBOX0_DMA_RX_CONTROL_START_LSB 1 -#define MBOX0_DMA_RX_CONTROL_START_MASK 'h00000002 -#define MBOX0_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_START_MASK) >> MBOX0_DMA_RX_CONTROL_START_LSB) -#define MBOX0_DMA_RX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX0_DMA_RX_CONTROL_START_LSB) & MBOX0_DMA_RX_CONTROL_START_MASK) -#define MBOX0_DMA_RX_CONTROL_START_RESET 1'h0 -#define MBOX0_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX0_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX0_DMA_RX_CONTROL_STOP_MASK 'h00000001 -#define MBOX0_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_STOP_MASK) >> MBOX0_DMA_RX_CONTROL_STOP_LSB) -#define MBOX0_DMA_RX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX0_DMA_RX_CONTROL_STOP_LSB) & MBOX0_DMA_RX_CONTROL_STOP_MASK) -#define MBOX0_DMA_RX_CONTROL_STOP_RESET 1'h0 -#define MBOX0_DMA_RX_CONTROL_RESET (32'h0 | \ - MBOX0_DMA_RX_CONTROL_RESUME_SET(MBOX0_DMA_RX_CONTROL_RESUME_RESET) | \ - MBOX0_DMA_RX_CONTROL_START_SET(MBOX0_DMA_RX_CONTROL_START_RESET) | \ - MBOX0_DMA_RX_CONTROL_STOP_SET(MBOX0_DMA_RX_CONTROL_STOP_RESET)) -#define MBOX0_DMA_RX_CONTROL_HW_MASK (32'h0 | \ - MBOX0_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX0_DMA_RX_CONTROL_START_MASK | \ - MBOX0_DMA_RX_CONTROL_STOP_MASK) -#define MBOX0_DMA_RX_CONTROL_SW_MASK (32'h0 | \ - MBOX0_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX0_DMA_RX_CONTROL_START_MASK | \ - MBOX0_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS 'h00000020 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX0_DMA_TX_CONTROL_ADDRESS 'h00000024 -#define MBOX0_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX0_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX0_DMA_TX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX0_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_RESUME_MASK) >> MBOX0_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX0_DMA_TX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX0_DMA_TX_CONTROL_RESUME_LSB) & MBOX0_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX0_DMA_TX_CONTROL_RESUME_RESET 1'h0 -#define MBOX0_DMA_TX_CONTROL_START_MSB 1 -#define MBOX0_DMA_TX_CONTROL_START_LSB 1 -#define MBOX0_DMA_TX_CONTROL_START_MASK 'h00000002 -#define MBOX0_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_START_MASK) >> MBOX0_DMA_TX_CONTROL_START_LSB) -#define MBOX0_DMA_TX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX0_DMA_TX_CONTROL_START_LSB) & MBOX0_DMA_TX_CONTROL_START_MASK) -#define MBOX0_DMA_TX_CONTROL_START_RESET 1'h0 -#define MBOX0_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX0_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX0_DMA_TX_CONTROL_STOP_MASK 'h00000001 -#define MBOX0_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_STOP_MASK) >> MBOX0_DMA_TX_CONTROL_STOP_LSB) -#define MBOX0_DMA_TX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX0_DMA_TX_CONTROL_STOP_LSB) & MBOX0_DMA_TX_CONTROL_STOP_MASK) -#define MBOX0_DMA_TX_CONTROL_STOP_RESET 1'h0 -#define MBOX0_DMA_TX_CONTROL_RESET (32'h0 | \ - MBOX0_DMA_TX_CONTROL_RESUME_SET(MBOX0_DMA_TX_CONTROL_RESUME_RESET) | \ - MBOX0_DMA_TX_CONTROL_START_SET(MBOX0_DMA_TX_CONTROL_START_RESET) | \ - MBOX0_DMA_TX_CONTROL_STOP_SET(MBOX0_DMA_TX_CONTROL_STOP_RESET)) -#define MBOX0_DMA_TX_CONTROL_HW_MASK (32'h0 | \ - MBOX0_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX0_DMA_TX_CONTROL_START_MASK | \ - MBOX0_DMA_TX_CONTROL_STOP_MASK) -#define MBOX0_DMA_TX_CONTROL_SW_MASK (32'h0 | \ - MBOX0_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX0_DMA_TX_CONTROL_START_MASK | \ - MBOX0_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS 'h00000028 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX1_DMA_RX_CONTROL_ADDRESS 'h0000002c -#define MBOX1_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX1_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX1_DMA_RX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX1_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX1_DMA_RX_CONTROL_RESUME_MASK) >> MBOX1_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX1_DMA_RX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX1_DMA_RX_CONTROL_RESUME_LSB) & MBOX1_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX1_DMA_RX_CONTROL_RESUME_RESET 1'h0 -#define MBOX1_DMA_RX_CONTROL_START_MSB 1 -#define MBOX1_DMA_RX_CONTROL_START_LSB 1 -#define MBOX1_DMA_RX_CONTROL_START_MASK 'h00000002 -#define MBOX1_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX1_DMA_RX_CONTROL_START_MASK) >> MBOX1_DMA_RX_CONTROL_START_LSB) -#define MBOX1_DMA_RX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX1_DMA_RX_CONTROL_START_LSB) & MBOX1_DMA_RX_CONTROL_START_MASK) -#define MBOX1_DMA_RX_CONTROL_START_RESET 1'h0 -#define MBOX1_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX1_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX1_DMA_RX_CONTROL_STOP_MASK 'h00000001 -#define MBOX1_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX1_DMA_RX_CONTROL_STOP_MASK) >> MBOX1_DMA_RX_CONTROL_STOP_LSB) -#define MBOX1_DMA_RX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX1_DMA_RX_CONTROL_STOP_LSB) & MBOX1_DMA_RX_CONTROL_STOP_MASK) -#define MBOX1_DMA_RX_CONTROL_STOP_RESET 1'h0 -#define MBOX1_DMA_RX_CONTROL_RESET (32'h0 | \ - MBOX1_DMA_RX_CONTROL_RESUME_SET(MBOX1_DMA_RX_CONTROL_RESUME_RESET) | \ - MBOX1_DMA_RX_CONTROL_START_SET(MBOX1_DMA_RX_CONTROL_START_RESET) | \ - MBOX1_DMA_RX_CONTROL_STOP_SET(MBOX1_DMA_RX_CONTROL_STOP_RESET)) -#define MBOX1_DMA_RX_CONTROL_HW_MASK (32'h0 | \ - MBOX1_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX1_DMA_RX_CONTROL_START_MASK | \ - MBOX1_DMA_RX_CONTROL_STOP_MASK) -#define MBOX1_DMA_RX_CONTROL_SW_MASK (32'h0 | \ - MBOX1_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX1_DMA_RX_CONTROL_START_MASK | \ - MBOX1_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS 'h00000030 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX1_DMA_TX_CONTROL_ADDRESS 'h00000034 -#define MBOX1_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX1_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX1_DMA_TX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX1_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX1_DMA_TX_CONTROL_RESUME_MASK) >> MBOX1_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX1_DMA_TX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX1_DMA_TX_CONTROL_RESUME_LSB) & MBOX1_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX1_DMA_TX_CONTROL_RESUME_RESET 1'h0 -#define MBOX1_DMA_TX_CONTROL_START_MSB 1 -#define MBOX1_DMA_TX_CONTROL_START_LSB 1 -#define MBOX1_DMA_TX_CONTROL_START_MASK 'h00000002 -#define MBOX1_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX1_DMA_TX_CONTROL_START_MASK) >> MBOX1_DMA_TX_CONTROL_START_LSB) -#define MBOX1_DMA_TX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX1_DMA_TX_CONTROL_START_LSB) & MBOX1_DMA_TX_CONTROL_START_MASK) -#define MBOX1_DMA_TX_CONTROL_START_RESET 1'h0 -#define MBOX1_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX1_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX1_DMA_TX_CONTROL_STOP_MASK 'h00000001 -#define MBOX1_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX1_DMA_TX_CONTROL_STOP_MASK) >> MBOX1_DMA_TX_CONTROL_STOP_LSB) -#define MBOX1_DMA_TX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX1_DMA_TX_CONTROL_STOP_LSB) & MBOX1_DMA_TX_CONTROL_STOP_MASK) -#define MBOX1_DMA_TX_CONTROL_STOP_RESET 1'h0 -#define MBOX1_DMA_TX_CONTROL_RESET (32'h0 | \ - MBOX1_DMA_TX_CONTROL_RESUME_SET(MBOX1_DMA_TX_CONTROL_RESUME_RESET) | \ - MBOX1_DMA_TX_CONTROL_START_SET(MBOX1_DMA_TX_CONTROL_START_RESET) | \ - MBOX1_DMA_TX_CONTROL_STOP_SET(MBOX1_DMA_TX_CONTROL_STOP_RESET)) -#define MBOX1_DMA_TX_CONTROL_HW_MASK (32'h0 | \ - MBOX1_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX1_DMA_TX_CONTROL_START_MASK | \ - MBOX1_DMA_TX_CONTROL_STOP_MASK) -#define MBOX1_DMA_TX_CONTROL_SW_MASK (32'h0 | \ - MBOX1_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX1_DMA_TX_CONTROL_START_MASK | \ - MBOX1_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS 'h00000038 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX2_DMA_RX_CONTROL_ADDRESS 'h0000003c -#define MBOX2_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX2_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX2_DMA_RX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX2_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX2_DMA_RX_CONTROL_RESUME_MASK) >> MBOX2_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX2_DMA_RX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX2_DMA_RX_CONTROL_RESUME_LSB) & MBOX2_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX2_DMA_RX_CONTROL_RESUME_RESET 1'h0 -#define MBOX2_DMA_RX_CONTROL_START_MSB 1 -#define MBOX2_DMA_RX_CONTROL_START_LSB 1 -#define MBOX2_DMA_RX_CONTROL_START_MASK 'h00000002 -#define MBOX2_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX2_DMA_RX_CONTROL_START_MASK) >> MBOX2_DMA_RX_CONTROL_START_LSB) -#define MBOX2_DMA_RX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX2_DMA_RX_CONTROL_START_LSB) & MBOX2_DMA_RX_CONTROL_START_MASK) -#define MBOX2_DMA_RX_CONTROL_START_RESET 1'h0 -#define MBOX2_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX2_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX2_DMA_RX_CONTROL_STOP_MASK 'h00000001 -#define MBOX2_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX2_DMA_RX_CONTROL_STOP_MASK) >> MBOX2_DMA_RX_CONTROL_STOP_LSB) -#define MBOX2_DMA_RX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX2_DMA_RX_CONTROL_STOP_LSB) & MBOX2_DMA_RX_CONTROL_STOP_MASK) -#define MBOX2_DMA_RX_CONTROL_STOP_RESET 1'h0 -#define MBOX2_DMA_RX_CONTROL_RESET (32'h0 | \ - MBOX2_DMA_RX_CONTROL_RESUME_SET(MBOX2_DMA_RX_CONTROL_RESUME_RESET) | \ - MBOX2_DMA_RX_CONTROL_START_SET(MBOX2_DMA_RX_CONTROL_START_RESET) | \ - MBOX2_DMA_RX_CONTROL_STOP_SET(MBOX2_DMA_RX_CONTROL_STOP_RESET)) -#define MBOX2_DMA_RX_CONTROL_HW_MASK (32'h0 | \ - MBOX2_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX2_DMA_RX_CONTROL_START_MASK | \ - MBOX2_DMA_RX_CONTROL_STOP_MASK) -#define MBOX2_DMA_RX_CONTROL_SW_MASK (32'h0 | \ - MBOX2_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX2_DMA_RX_CONTROL_START_MASK | \ - MBOX2_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS 'h00000040 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX2_DMA_TX_CONTROL_ADDRESS 'h00000044 -#define MBOX2_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX2_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX2_DMA_TX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX2_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX2_DMA_TX_CONTROL_RESUME_MASK) >> MBOX2_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX2_DMA_TX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX2_DMA_TX_CONTROL_RESUME_LSB) & MBOX2_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX2_DMA_TX_CONTROL_RESUME_RESET 1'h0 -#define MBOX2_DMA_TX_CONTROL_START_MSB 1 -#define MBOX2_DMA_TX_CONTROL_START_LSB 1 -#define MBOX2_DMA_TX_CONTROL_START_MASK 'h00000002 -#define MBOX2_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX2_DMA_TX_CONTROL_START_MASK) >> MBOX2_DMA_TX_CONTROL_START_LSB) -#define MBOX2_DMA_TX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX2_DMA_TX_CONTROL_START_LSB) & MBOX2_DMA_TX_CONTROL_START_MASK) -#define MBOX2_DMA_TX_CONTROL_START_RESET 1'h0 -#define MBOX2_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX2_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX2_DMA_TX_CONTROL_STOP_MASK 'h00000001 -#define MBOX2_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX2_DMA_TX_CONTROL_STOP_MASK) >> MBOX2_DMA_TX_CONTROL_STOP_LSB) -#define MBOX2_DMA_TX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX2_DMA_TX_CONTROL_STOP_LSB) & MBOX2_DMA_TX_CONTROL_STOP_MASK) -#define MBOX2_DMA_TX_CONTROL_STOP_RESET 1'h0 -#define MBOX2_DMA_TX_CONTROL_RESET (32'h0 | \ - MBOX2_DMA_TX_CONTROL_RESUME_SET(MBOX2_DMA_TX_CONTROL_RESUME_RESET) | \ - MBOX2_DMA_TX_CONTROL_START_SET(MBOX2_DMA_TX_CONTROL_START_RESET) | \ - MBOX2_DMA_TX_CONTROL_STOP_SET(MBOX2_DMA_TX_CONTROL_STOP_RESET)) -#define MBOX2_DMA_TX_CONTROL_HW_MASK (32'h0 | \ - MBOX2_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX2_DMA_TX_CONTROL_START_MASK | \ - MBOX2_DMA_TX_CONTROL_STOP_MASK) -#define MBOX2_DMA_TX_CONTROL_SW_MASK (32'h0 | \ - MBOX2_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX2_DMA_TX_CONTROL_START_MASK | \ - MBOX2_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS 'h00000048 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX3_DMA_RX_CONTROL_ADDRESS 'h0000004c -#define MBOX3_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX3_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX3_DMA_RX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX3_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX3_DMA_RX_CONTROL_RESUME_MASK) >> MBOX3_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX3_DMA_RX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX3_DMA_RX_CONTROL_RESUME_LSB) & MBOX3_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX3_DMA_RX_CONTROL_RESUME_RESET 1'h0 -#define MBOX3_DMA_RX_CONTROL_START_MSB 1 -#define MBOX3_DMA_RX_CONTROL_START_LSB 1 -#define MBOX3_DMA_RX_CONTROL_START_MASK 'h00000002 -#define MBOX3_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX3_DMA_RX_CONTROL_START_MASK) >> MBOX3_DMA_RX_CONTROL_START_LSB) -#define MBOX3_DMA_RX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX3_DMA_RX_CONTROL_START_LSB) & MBOX3_DMA_RX_CONTROL_START_MASK) -#define MBOX3_DMA_RX_CONTROL_START_RESET 1'h0 -#define MBOX3_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX3_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX3_DMA_RX_CONTROL_STOP_MASK 'h00000001 -#define MBOX3_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX3_DMA_RX_CONTROL_STOP_MASK) >> MBOX3_DMA_RX_CONTROL_STOP_LSB) -#define MBOX3_DMA_RX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX3_DMA_RX_CONTROL_STOP_LSB) & MBOX3_DMA_RX_CONTROL_STOP_MASK) -#define MBOX3_DMA_RX_CONTROL_STOP_RESET 1'h0 -#define MBOX3_DMA_RX_CONTROL_RESET (32'h0 | \ - MBOX3_DMA_RX_CONTROL_RESUME_SET(MBOX3_DMA_RX_CONTROL_RESUME_RESET) | \ - MBOX3_DMA_RX_CONTROL_START_SET(MBOX3_DMA_RX_CONTROL_START_RESET) | \ - MBOX3_DMA_RX_CONTROL_STOP_SET(MBOX3_DMA_RX_CONTROL_STOP_RESET)) -#define MBOX3_DMA_RX_CONTROL_HW_MASK (32'h0 | \ - MBOX3_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX3_DMA_RX_CONTROL_START_MASK | \ - MBOX3_DMA_RX_CONTROL_STOP_MASK) -#define MBOX3_DMA_RX_CONTROL_SW_MASK (32'h0 | \ - MBOX3_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX3_DMA_RX_CONTROL_START_MASK | \ - MBOX3_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS 'h00000050 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX3_DMA_TX_CONTROL_ADDRESS 'h00000054 -#define MBOX3_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX3_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX3_DMA_TX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX3_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX3_DMA_TX_CONTROL_RESUME_MASK) >> MBOX3_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX3_DMA_TX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX3_DMA_TX_CONTROL_RESUME_LSB) & MBOX3_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX3_DMA_TX_CONTROL_RESUME_RESET 1'h0 -#define MBOX3_DMA_TX_CONTROL_START_MSB 1 -#define MBOX3_DMA_TX_CONTROL_START_LSB 1 -#define MBOX3_DMA_TX_CONTROL_START_MASK 'h00000002 -#define MBOX3_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX3_DMA_TX_CONTROL_START_MASK) >> MBOX3_DMA_TX_CONTROL_START_LSB) -#define MBOX3_DMA_TX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX3_DMA_TX_CONTROL_START_LSB) & MBOX3_DMA_TX_CONTROL_START_MASK) -#define MBOX3_DMA_TX_CONTROL_START_RESET 1'h0 -#define MBOX3_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX3_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX3_DMA_TX_CONTROL_STOP_MASK 'h00000001 -#define MBOX3_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX3_DMA_TX_CONTROL_STOP_MASK) >> MBOX3_DMA_TX_CONTROL_STOP_LSB) -#define MBOX3_DMA_TX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX3_DMA_TX_CONTROL_STOP_LSB) & MBOX3_DMA_TX_CONTROL_STOP_MASK) -#define MBOX3_DMA_TX_CONTROL_STOP_RESET 1'h0 -#define MBOX3_DMA_TX_CONTROL_RESET (32'h0 | \ - MBOX3_DMA_TX_CONTROL_RESUME_SET(MBOX3_DMA_TX_CONTROL_RESUME_RESET) | \ - MBOX3_DMA_TX_CONTROL_START_SET(MBOX3_DMA_TX_CONTROL_START_RESET) | \ - MBOX3_DMA_TX_CONTROL_STOP_SET(MBOX3_DMA_TX_CONTROL_STOP_RESET)) -#define MBOX3_DMA_TX_CONTROL_HW_MASK (32'h0 | \ - MBOX3_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX3_DMA_TX_CONTROL_START_MASK | \ - MBOX3_DMA_TX_CONTROL_STOP_MASK) -#define MBOX3_DMA_TX_CONTROL_SW_MASK (32'h0 | \ - MBOX3_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX3_DMA_TX_CONTROL_START_MASK | \ - MBOX3_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX_INT_STATUS_ADDRESS 'h00000058 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_MSB 31 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB 28 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK 'hf0000000 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) >> MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) & MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_RESET 4'h0 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB 27 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB 24 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK 'h0f000000 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) >> MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) & MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_RESET 4'h0 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_MSB 23 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB 20 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK 'h00f00000 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) >> MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) & MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_RESET 4'h0 -#define MBOX_INT_STATUS_TX_OVERFLOW_MSB 17 -#define MBOX_INT_STATUS_TX_OVERFLOW_LSB 17 -#define MBOX_INT_STATUS_TX_OVERFLOW_MASK 'h00020000 -#define MBOX_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & MBOX_INT_STATUS_TX_OVERFLOW_MASK) >> MBOX_INT_STATUS_TX_OVERFLOW_LSB) -#define MBOX_INT_STATUS_TX_OVERFLOW_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_TX_OVERFLOW_LSB) & MBOX_INT_STATUS_TX_OVERFLOW_MASK) -#define MBOX_INT_STATUS_TX_OVERFLOW_RESET 1'h0 -#define MBOX_INT_STATUS_RX_UNDERFLOW_MSB 16 -#define MBOX_INT_STATUS_RX_UNDERFLOW_LSB 16 -#define MBOX_INT_STATUS_RX_UNDERFLOW_MASK 'h00010000 -#define MBOX_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & MBOX_INT_STATUS_RX_UNDERFLOW_MASK) >> MBOX_INT_STATUS_RX_UNDERFLOW_LSB) -#define MBOX_INT_STATUS_RX_UNDERFLOW_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_RX_UNDERFLOW_LSB) & MBOX_INT_STATUS_RX_UNDERFLOW_MASK) -#define MBOX_INT_STATUS_RX_UNDERFLOW_RESET 1'h0 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_MSB 15 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_LSB 12 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_MASK 'h0000f000 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) (((x) & MBOX_INT_STATUS_TX_NOT_EMPTY_MASK) >> MBOX_INT_STATUS_TX_NOT_EMPTY_LSB) -#define MBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_TX_NOT_EMPTY_LSB) & MBOX_INT_STATUS_TX_NOT_EMPTY_MASK) -#define MBOX_INT_STATUS_TX_NOT_EMPTY_RESET 4'h0 -#define MBOX_INT_STATUS_RX_NOT_FULL_MSB 11 -#define MBOX_INT_STATUS_RX_NOT_FULL_LSB 8 -#define MBOX_INT_STATUS_RX_NOT_FULL_MASK 'h00000f00 -#define MBOX_INT_STATUS_RX_NOT_FULL_GET(x) (((x) & MBOX_INT_STATUS_RX_NOT_FULL_MASK) >> MBOX_INT_STATUS_RX_NOT_FULL_LSB) -#define MBOX_INT_STATUS_RX_NOT_FULL_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_RX_NOT_FULL_LSB) & MBOX_INT_STATUS_RX_NOT_FULL_MASK) -#define MBOX_INT_STATUS_RX_NOT_FULL_RESET 4'h0 -#define MBOX_INT_STATUS_HOST_MSB 7 -#define MBOX_INT_STATUS_HOST_LSB 0 -#define MBOX_INT_STATUS_HOST_MASK 'h000000ff -#define MBOX_INT_STATUS_HOST_GET(x) (((x) & MBOX_INT_STATUS_HOST_MASK) >> MBOX_INT_STATUS_HOST_LSB) -#define MBOX_INT_STATUS_HOST_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_HOST_LSB) & MBOX_INT_STATUS_HOST_MASK) -#define MBOX_INT_STATUS_HOST_RESET 8'h0 -#define MBOX_INT_STATUS_RESET (32'h0 | \ - MBOX_INT_STATUS_RX_DMA_COMPLETE_SET(MBOX_INT_STATUS_RX_DMA_COMPLETE_RESET) | \ - MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_RESET) | \ - MBOX_INT_STATUS_TX_DMA_COMPLETE_SET(MBOX_INT_STATUS_TX_DMA_COMPLETE_RESET) | \ - MBOX_INT_STATUS_TX_OVERFLOW_SET(MBOX_INT_STATUS_TX_OVERFLOW_RESET) | \ - MBOX_INT_STATUS_RX_UNDERFLOW_SET(MBOX_INT_STATUS_RX_UNDERFLOW_RESET) | \ - MBOX_INT_STATUS_TX_NOT_EMPTY_SET(MBOX_INT_STATUS_TX_NOT_EMPTY_RESET) | \ - MBOX_INT_STATUS_RX_NOT_FULL_SET(MBOX_INT_STATUS_RX_NOT_FULL_RESET) | \ - MBOX_INT_STATUS_HOST_SET(MBOX_INT_STATUS_HOST_RESET)) -#define MBOX_INT_STATUS_HW_MASK (32'h0 | \ - MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK | \ - MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK | \ - MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK | \ - MBOX_INT_STATUS_TX_OVERFLOW_MASK | \ - MBOX_INT_STATUS_RX_UNDERFLOW_MASK | \ - MBOX_INT_STATUS_TX_NOT_EMPTY_MASK | \ - MBOX_INT_STATUS_RX_NOT_FULL_MASK | \ - MBOX_INT_STATUS_HOST_MASK) -#define MBOX_INT_STATUS_SW_MASK (32'h0 | \ - MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK | \ - MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK | \ - MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK | \ - MBOX_INT_STATUS_TX_OVERFLOW_MASK | \ - MBOX_INT_STATUS_RX_UNDERFLOW_MASK | \ - MBOX_INT_STATUS_TX_NOT_EMPTY_MASK | \ - MBOX_INT_STATUS_RX_NOT_FULL_MASK | \ - MBOX_INT_STATUS_HOST_MASK) - -#define MBOX_INT_ENABLE_ADDRESS 'h0000005c -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB 31 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB 28 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK 'hf0000000 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) >> MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) & MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_RESET 4'h0 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB 27 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB 24 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK 'h0f000000 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) >> MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) & MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_RESET 4'h0 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB 23 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB 20 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK 'h00f00000 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) >> MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) & MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_RESET 4'h0 -#define MBOX_INT_ENABLE_TX_OVERFLOW_MSB 17 -#define MBOX_INT_ENABLE_TX_OVERFLOW_LSB 17 -#define MBOX_INT_ENABLE_TX_OVERFLOW_MASK 'h00020000 -#define MBOX_INT_ENABLE_TX_OVERFLOW_GET(x) (((x) & MBOX_INT_ENABLE_TX_OVERFLOW_MASK) >> MBOX_INT_ENABLE_TX_OVERFLOW_LSB) -#define MBOX_INT_ENABLE_TX_OVERFLOW_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_TX_OVERFLOW_LSB) & MBOX_INT_ENABLE_TX_OVERFLOW_MASK) -#define MBOX_INT_ENABLE_TX_OVERFLOW_RESET 1'h0 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_MSB 16 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_LSB 16 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_MASK 'h00010000 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) (((x) & MBOX_INT_ENABLE_RX_UNDERFLOW_MASK) >> MBOX_INT_ENABLE_RX_UNDERFLOW_LSB) -#define MBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_RX_UNDERFLOW_LSB) & MBOX_INT_ENABLE_RX_UNDERFLOW_MASK) -#define MBOX_INT_ENABLE_RX_UNDERFLOW_RESET 1'h0 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_MSB 15 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB 12 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK 'h0000f000 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) (((x) & MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) >> MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) & MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_RESET 4'h0 -#define MBOX_INT_ENABLE_RX_NOT_FULL_MSB 11 -#define MBOX_INT_ENABLE_RX_NOT_FULL_LSB 8 -#define MBOX_INT_ENABLE_RX_NOT_FULL_MASK 'h00000f00 -#define MBOX_INT_ENABLE_RX_NOT_FULL_GET(x) (((x) & MBOX_INT_ENABLE_RX_NOT_FULL_MASK) >> MBOX_INT_ENABLE_RX_NOT_FULL_LSB) -#define MBOX_INT_ENABLE_RX_NOT_FULL_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_RX_NOT_FULL_LSB) & MBOX_INT_ENABLE_RX_NOT_FULL_MASK) -#define MBOX_INT_ENABLE_RX_NOT_FULL_RESET 4'h0 -#define MBOX_INT_ENABLE_HOST_MSB 7 -#define MBOX_INT_ENABLE_HOST_LSB 0 -#define MBOX_INT_ENABLE_HOST_MASK 'h000000ff -#define MBOX_INT_ENABLE_HOST_GET(x) (((x) & MBOX_INT_ENABLE_HOST_MASK) >> MBOX_INT_ENABLE_HOST_LSB) -#define MBOX_INT_ENABLE_HOST_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_HOST_LSB) & MBOX_INT_ENABLE_HOST_MASK) -#define MBOX_INT_ENABLE_HOST_RESET 8'hff -#define MBOX_INT_ENABLE_RESET (32'h0 | \ - MBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(MBOX_INT_ENABLE_RX_DMA_COMPLETE_RESET) | \ - MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_RESET) | \ - MBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(MBOX_INT_ENABLE_TX_DMA_COMPLETE_RESET) | \ - MBOX_INT_ENABLE_TX_OVERFLOW_SET(MBOX_INT_ENABLE_TX_OVERFLOW_RESET) | \ - MBOX_INT_ENABLE_RX_UNDERFLOW_SET(MBOX_INT_ENABLE_RX_UNDERFLOW_RESET) | \ - MBOX_INT_ENABLE_TX_NOT_EMPTY_SET(MBOX_INT_ENABLE_TX_NOT_EMPTY_RESET) | \ - MBOX_INT_ENABLE_RX_NOT_FULL_SET(MBOX_INT_ENABLE_RX_NOT_FULL_RESET) | \ - MBOX_INT_ENABLE_HOST_SET(MBOX_INT_ENABLE_HOST_RESET)) -#define MBOX_INT_ENABLE_HW_MASK (32'h0) -#define MBOX_INT_ENABLE_SW_MASK (32'h0 | \ - MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK | \ - MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK | \ - MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK | \ - MBOX_INT_ENABLE_TX_OVERFLOW_MASK | \ - MBOX_INT_ENABLE_RX_UNDERFLOW_MASK | \ - MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK | \ - MBOX_INT_ENABLE_RX_NOT_FULL_MASK | \ - MBOX_INT_ENABLE_HOST_MASK) - -#define INT_HOST_ADDRESS 'h00000060 -#define INT_HOST_VECTOR_MSB 7 -#define INT_HOST_VECTOR_LSB 0 -#define INT_HOST_VECTOR_MASK 'h000000ff -#define INT_HOST_VECTOR_GET(x) (((x) & INT_HOST_VECTOR_MASK) >> INT_HOST_VECTOR_LSB) -#define INT_HOST_VECTOR_SET(x) (((32'd0 | (x)) << INT_HOST_VECTOR_LSB) & INT_HOST_VECTOR_MASK) -#define INT_HOST_VECTOR_RESET 8'h0 -#define INT_HOST_RESET (32'h0 | \ - INT_HOST_VECTOR_SET(INT_HOST_VECTOR_RESET)) -#define INT_HOST_HW_MASK (32'h0 | \ - INT_HOST_VECTOR_MASK) -#define INT_HOST_SW_MASK (32'h0 | \ - INT_HOST_VECTOR_MASK) - -#define LOCAL_COUNT_ADDRESS 'h00000080 -#define LOCAL_COUNT_VALUE_MSB 7 -#define LOCAL_COUNT_VALUE_LSB 0 -#define LOCAL_COUNT_VALUE_MASK 'h000000ff -#define LOCAL_COUNT_VALUE_GET(x) (((x) & LOCAL_COUNT_VALUE_MASK) >> LOCAL_COUNT_VALUE_LSB) -#define LOCAL_COUNT_VALUE_SET(x) (((32'd0 | (x)) << LOCAL_COUNT_VALUE_LSB) & LOCAL_COUNT_VALUE_MASK) -#define LOCAL_COUNT_VALUE_RESET 8'h0 -#define LOCAL_COUNT_RESET (32'h0 | \ - LOCAL_COUNT_VALUE_SET(LOCAL_COUNT_VALUE_RESET)) -#define LOCAL_COUNT_HW_MASK (32'h0 | \ - LOCAL_COUNT_VALUE_MASK) -#define LOCAL_COUNT_SW_MASK (32'h0 | \ - LOCAL_COUNT_VALUE_MASK) - -#define COUNT_INC_ADDRESS 'h000000a0 -#define COUNT_INC_VALUE_MSB 7 -#define COUNT_INC_VALUE_LSB 0 -#define COUNT_INC_VALUE_MASK 'h000000ff -#define COUNT_INC_VALUE_GET(x) (((x) & COUNT_INC_VALUE_MASK) >> COUNT_INC_VALUE_LSB) -#define COUNT_INC_VALUE_SET(x) (((32'd0 | (x)) << COUNT_INC_VALUE_LSB) & COUNT_INC_VALUE_MASK) -#define COUNT_INC_VALUE_RESET 8'h0 -#define COUNT_INC_RESET (32'h0 | \ - COUNT_INC_VALUE_SET(COUNT_INC_VALUE_RESET)) -#define COUNT_INC_HW_MASK (32'h0 | \ - COUNT_INC_VALUE_MASK) -#define COUNT_INC_SW_MASK (32'h0 | \ - COUNT_INC_VALUE_MASK) - -#define LOCAL_SCRATCH_ADDRESS 'h000000c0 -#define LOCAL_SCRATCH_VALUE_MSB 7 -#define LOCAL_SCRATCH_VALUE_LSB 0 -#define LOCAL_SCRATCH_VALUE_MASK 'h000000ff -#define LOCAL_SCRATCH_VALUE_GET(x) (((x) & LOCAL_SCRATCH_VALUE_MASK) >> LOCAL_SCRATCH_VALUE_LSB) -#define LOCAL_SCRATCH_VALUE_SET(x) (((32'd0 | (x)) << LOCAL_SCRATCH_VALUE_LSB) & LOCAL_SCRATCH_VALUE_MASK) -#define LOCAL_SCRATCH_VALUE_RESET 8'h0 -#define LOCAL_SCRATCH_RESET (32'h0 | \ - LOCAL_SCRATCH_VALUE_SET(LOCAL_SCRATCH_VALUE_RESET)) -#define LOCAL_SCRATCH_HW_MASK (32'h0 | \ - LOCAL_SCRATCH_VALUE_MASK) -#define LOCAL_SCRATCH_SW_MASK (32'h0 | \ - LOCAL_SCRATCH_VALUE_MASK) - -#define USE_LOCAL_BUS_ADDRESS 'h000000e0 -#define USE_LOCAL_BUS_PIN_INIT_MSB 0 -#define USE_LOCAL_BUS_PIN_INIT_LSB 0 -#define USE_LOCAL_BUS_PIN_INIT_MASK 'h00000001 -#define USE_LOCAL_BUS_PIN_INIT_GET(x) (((x) & USE_LOCAL_BUS_PIN_INIT_MASK) >> USE_LOCAL_BUS_PIN_INIT_LSB) -#define USE_LOCAL_BUS_PIN_INIT_SET(x) (((32'd0 | (x)) << USE_LOCAL_BUS_PIN_INIT_LSB) & USE_LOCAL_BUS_PIN_INIT_MASK) -#define USE_LOCAL_BUS_PIN_INIT_RESET 1'h0 -#define USE_LOCAL_BUS_RESET (32'h0 | \ - USE_LOCAL_BUS_PIN_INIT_SET(USE_LOCAL_BUS_PIN_INIT_RESET)) -#define USE_LOCAL_BUS_HW_MASK (32'h0 | \ - USE_LOCAL_BUS_PIN_INIT_MASK) -#define USE_LOCAL_BUS_SW_MASK (32'h0) - -#define SDIO_CONFIG_ADDRESS 'h000000e4 -#define SDIO_CONFIG_CCCR_IOR1_MSB 0 -#define SDIO_CONFIG_CCCR_IOR1_LSB 0 -#define SDIO_CONFIG_CCCR_IOR1_MASK 'h00000001 -#define SDIO_CONFIG_CCCR_IOR1_GET(x) (((x) & SDIO_CONFIG_CCCR_IOR1_MASK) >> SDIO_CONFIG_CCCR_IOR1_LSB) -#define SDIO_CONFIG_CCCR_IOR1_SET(x) (((32'd0 | (x)) << SDIO_CONFIG_CCCR_IOR1_LSB) & SDIO_CONFIG_CCCR_IOR1_MASK) -#define SDIO_CONFIG_CCCR_IOR1_RESET 1'h0 -#define SDIO_CONFIG_RESET (32'h0 | \ - SDIO_CONFIG_CCCR_IOR1_SET(SDIO_CONFIG_CCCR_IOR1_RESET)) -#define SDIO_CONFIG_HW_MASK (32'h0) -#define SDIO_CONFIG_SW_MASK (32'h0 | \ - SDIO_CONFIG_CCCR_IOR1_MASK) - -#define MBOX_DEBUG_ADDRESS 'h000000e8 -#define MBOX_DEBUG_SEL_MSB 2 -#define MBOX_DEBUG_SEL_LSB 0 -#define MBOX_DEBUG_SEL_MASK 'h00000007 -#define MBOX_DEBUG_SEL_GET(x) (((x) & MBOX_DEBUG_SEL_MASK) >> MBOX_DEBUG_SEL_LSB) -#define MBOX_DEBUG_SEL_SET(x) (((32'd0 | (x)) << MBOX_DEBUG_SEL_LSB) & MBOX_DEBUG_SEL_MASK) -#define MBOX_DEBUG_SEL_RESET 3'h0 -#define MBOX_DEBUG_RESET (32'h0 | \ - MBOX_DEBUG_SEL_SET(MBOX_DEBUG_SEL_RESET)) -#define MBOX_DEBUG_HW_MASK (32'h0) -#define MBOX_DEBUG_SW_MASK (32'h0 | \ - MBOX_DEBUG_SEL_MASK) - -#define MBOX_FIFO_RESET_ADDRESS 'h000000ec -#define MBOX_FIFO_RESET_INIT_MSB 0 -#define MBOX_FIFO_RESET_INIT_LSB 0 -#define MBOX_FIFO_RESET_INIT_MASK 'h00000001 -#define MBOX_FIFO_RESET_INIT_GET(x) (((x) & MBOX_FIFO_RESET_INIT_MASK) >> MBOX_FIFO_RESET_INIT_LSB) -#define MBOX_FIFO_RESET_INIT_SET(x) (((32'd0 | (x)) << MBOX_FIFO_RESET_INIT_LSB) & MBOX_FIFO_RESET_INIT_MASK) -#define MBOX_FIFO_RESET_INIT_RESET 1'h0 -#define MBOX_FIFO_RESET_RESET (32'h0 | \ - MBOX_FIFO_RESET_INIT_SET(MBOX_FIFO_RESET_INIT_RESET)) -#define MBOX_FIFO_RESET_HW_MASK (32'h0 | \ - MBOX_FIFO_RESET_INIT_MASK) -#define MBOX_FIFO_RESET_SW_MASK (32'h0 | \ - MBOX_FIFO_RESET_INIT_MASK) - -#define MBOX_TXFIFO_POP_ADDRESS 'h000000f0 -#define MBOX_TXFIFO_POP_DATA_MSB 0 -#define MBOX_TXFIFO_POP_DATA_LSB 0 -#define MBOX_TXFIFO_POP_DATA_MASK 'h00000001 -#define MBOX_TXFIFO_POP_DATA_GET(x) (((x) & MBOX_TXFIFO_POP_DATA_MASK) >> MBOX_TXFIFO_POP_DATA_LSB) -#define MBOX_TXFIFO_POP_DATA_SET(x) (((32'd0 | (x)) << MBOX_TXFIFO_POP_DATA_LSB) & MBOX_TXFIFO_POP_DATA_MASK) -#define MBOX_TXFIFO_POP_DATA_RESET 1'h0 -#define MBOX_TXFIFO_POP_RESET (32'h0 | \ - MBOX_TXFIFO_POP_DATA_SET(MBOX_TXFIFO_POP_DATA_RESET)) -#define MBOX_TXFIFO_POP_HW_MASK (32'h0) -#define MBOX_TXFIFO_POP_SW_MASK (32'h0 | \ - MBOX_TXFIFO_POP_DATA_MASK) - -#define MBOX_RXFIFO_POP_ADDRESS 'h00000100 -#define MBOX_RXFIFO_POP_DATA_MSB 0 -#define MBOX_RXFIFO_POP_DATA_LSB 0 -#define MBOX_RXFIFO_POP_DATA_MASK 'h00000001 -#define MBOX_RXFIFO_POP_DATA_GET(x) (((x) & MBOX_RXFIFO_POP_DATA_MASK) >> MBOX_RXFIFO_POP_DATA_LSB) -#define MBOX_RXFIFO_POP_DATA_SET(x) (((32'd0 | (x)) << MBOX_RXFIFO_POP_DATA_LSB) & MBOX_RXFIFO_POP_DATA_MASK) -#define MBOX_RXFIFO_POP_DATA_RESET 1'h0 -#define MBOX_RXFIFO_POP_RESET (32'h0 | \ - MBOX_RXFIFO_POP_DATA_SET(MBOX_RXFIFO_POP_DATA_RESET)) -#define MBOX_RXFIFO_POP_HW_MASK (32'h0) -#define MBOX_RXFIFO_POP_SW_MASK (32'h0 | \ - MBOX_RXFIFO_POP_DATA_MASK) - -#define SDIO_DEBUG_ADDRESS 'h00000110 -#define SDIO_DEBUG_SEL_MSB 3 -#define SDIO_DEBUG_SEL_LSB 0 -#define SDIO_DEBUG_SEL_MASK 'h0000000f -#define SDIO_DEBUG_SEL_GET(x) (((x) & SDIO_DEBUG_SEL_MASK) >> SDIO_DEBUG_SEL_LSB) -#define SDIO_DEBUG_SEL_SET(x) (((32'd0 | (x)) << SDIO_DEBUG_SEL_LSB) & SDIO_DEBUG_SEL_MASK) -#define SDIO_DEBUG_SEL_RESET 4'h0 -#define SDIO_DEBUG_RESET (32'h0 | \ - SDIO_DEBUG_SEL_SET(SDIO_DEBUG_SEL_RESET)) -#define SDIO_DEBUG_HW_MASK (32'h0) -#define SDIO_DEBUG_SW_MASK (32'h0 | \ - SDIO_DEBUG_SEL_MASK) - -#define HOST_IF_WINDOW_ADDRESS 'h00002000 -#define HOST_IF_WINDOW_DATA_MSB 7 -#define HOST_IF_WINDOW_DATA_LSB 0 -#define HOST_IF_WINDOW_DATA_MASK 'h000000ff -#define HOST_IF_WINDOW_DATA_GET(x) (((x) & HOST_IF_WINDOW_DATA_MASK) >> HOST_IF_WINDOW_DATA_LSB) -#define HOST_IF_WINDOW_DATA_SET(x) (((32'd0 | (x)) << HOST_IF_WINDOW_DATA_LSB) & HOST_IF_WINDOW_DATA_MASK) -#define HOST_IF_WINDOW_DATA_RESET 8'h0 -#define HOST_IF_WINDOW_RESET (32'h0 | \ - HOST_IF_WINDOW_DATA_SET(HOST_IF_WINDOW_DATA_RESET)) -#define HOST_IF_WINDOW_HW_MASK (32'h0 | \ - HOST_IF_WINDOW_DATA_MASK) -#define HOST_IF_WINDOW_SW_MASK (32'h0 | \ - HOST_IF_WINDOW_DATA_MASK) - -#define MBOX_REG_ADDRESS_MSB 13 - -#endif /* _MBOX_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/rf2G_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/rf2G_reg.h deleted file mode 100644 index f214c9c101c3..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/rf2G_reg.h +++ /dev/null @@ -1,160 +0,0 @@ -#ifndef _RF2G_REG_REG_H_ -#define _RF2G_REG_REG_H_ - -#define RF2G_RF2G1_ADDRESS 0x00000000 -#define RF2G_RF2G1_OFFSET 0x00000000 -#define RF2G_RF2G1_BLNA1_MSB 31 -#define RF2G_RF2G1_BLNA1_LSB 29 -#define RF2G_RF2G1_BLNA1_MASK 0xe0000000 -#define RF2G_RF2G1_BLNA1_GET(x) (((x) & RF2G_RF2G1_BLNA1_MASK) >> RF2G_RF2G1_BLNA1_LSB) -#define RF2G_RF2G1_BLNA1_SET(x) (((x) << RF2G_RF2G1_BLNA1_LSB) & RF2G_RF2G1_BLNA1_MASK) -#define RF2G_RF2G1_BLNA1F_MSB 28 -#define RF2G_RF2G1_BLNA1F_LSB 26 -#define RF2G_RF2G1_BLNA1F_MASK 0x1c000000 -#define RF2G_RF2G1_BLNA1F_GET(x) (((x) & RF2G_RF2G1_BLNA1F_MASK) >> RF2G_RF2G1_BLNA1F_LSB) -#define RF2G_RF2G1_BLNA1F_SET(x) (((x) << RF2G_RF2G1_BLNA1F_LSB) & RF2G_RF2G1_BLNA1F_MASK) -#define RF2G_RF2G1_BLNA1BUF_MSB 25 -#define RF2G_RF2G1_BLNA1BUF_LSB 23 -#define RF2G_RF2G1_BLNA1BUF_MASK 0x03800000 -#define RF2G_RF2G1_BLNA1BUF_GET(x) (((x) & RF2G_RF2G1_BLNA1BUF_MASK) >> RF2G_RF2G1_BLNA1BUF_LSB) -#define RF2G_RF2G1_BLNA1BUF_SET(x) (((x) << RF2G_RF2G1_BLNA1BUF_LSB) & RF2G_RF2G1_BLNA1BUF_MASK) -#define RF2G_RF2G1_BLNA2_MSB 22 -#define RF2G_RF2G1_BLNA2_LSB 20 -#define RF2G_RF2G1_BLNA2_MASK 0x00700000 -#define RF2G_RF2G1_BLNA2_GET(x) (((x) & RF2G_RF2G1_BLNA2_MASK) >> RF2G_RF2G1_BLNA2_LSB) -#define RF2G_RF2G1_BLNA2_SET(x) (((x) << RF2G_RF2G1_BLNA2_LSB) & RF2G_RF2G1_BLNA2_MASK) -#define RF2G_RF2G1_DB_MSB 19 -#define RF2G_RF2G1_DB_LSB 17 -#define RF2G_RF2G1_DB_MASK 0x000e0000 -#define RF2G_RF2G1_DB_GET(x) (((x) & RF2G_RF2G1_DB_MASK) >> RF2G_RF2G1_DB_LSB) -#define RF2G_RF2G1_DB_SET(x) (((x) << RF2G_RF2G1_DB_LSB) & RF2G_RF2G1_DB_MASK) -#define RF2G_RF2G1_OB_MSB 16 -#define RF2G_RF2G1_OB_LSB 14 -#define RF2G_RF2G1_OB_MASK 0x0001c000 -#define RF2G_RF2G1_OB_GET(x) (((x) & RF2G_RF2G1_OB_MASK) >> RF2G_RF2G1_OB_LSB) -#define RF2G_RF2G1_OB_SET(x) (((x) << RF2G_RF2G1_OB_LSB) & RF2G_RF2G1_OB_MASK) -#define RF2G_RF2G1_FE_ATB_SEL_MSB 13 -#define RF2G_RF2G1_FE_ATB_SEL_LSB 11 -#define RF2G_RF2G1_FE_ATB_SEL_MASK 0x00003800 -#define RF2G_RF2G1_FE_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_FE_ATB_SEL_MASK) >> RF2G_RF2G1_FE_ATB_SEL_LSB) -#define RF2G_RF2G1_FE_ATB_SEL_SET(x) (((x) << RF2G_RF2G1_FE_ATB_SEL_LSB) & RF2G_RF2G1_FE_ATB_SEL_MASK) -#define RF2G_RF2G1_RF_ATB_SEL_MSB 10 -#define RF2G_RF2G1_RF_ATB_SEL_LSB 8 -#define RF2G_RF2G1_RF_ATB_SEL_MASK 0x00000700 -#define RF2G_RF2G1_RF_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_RF_ATB_SEL_MASK) >> RF2G_RF2G1_RF_ATB_SEL_LSB) -#define RF2G_RF2G1_RF_ATB_SEL_SET(x) (((x) << RF2G_RF2G1_RF_ATB_SEL_LSB) & RF2G_RF2G1_RF_ATB_SEL_MASK) -#define RF2G_RF2G1_SELLNA_MSB 7 -#define RF2G_RF2G1_SELLNA_LSB 7 -#define RF2G_RF2G1_SELLNA_MASK 0x00000080 -#define RF2G_RF2G1_SELLNA_GET(x) (((x) & RF2G_RF2G1_SELLNA_MASK) >> RF2G_RF2G1_SELLNA_LSB) -#define RF2G_RF2G1_SELLNA_SET(x) (((x) << RF2G_RF2G1_SELLNA_LSB) & RF2G_RF2G1_SELLNA_MASK) -#define RF2G_RF2G1_LOCONTROL_MSB 6 -#define RF2G_RF2G1_LOCONTROL_LSB 6 -#define RF2G_RF2G1_LOCONTROL_MASK 0x00000040 -#define RF2G_RF2G1_LOCONTROL_GET(x) (((x) & RF2G_RF2G1_LOCONTROL_MASK) >> RF2G_RF2G1_LOCONTROL_LSB) -#define RF2G_RF2G1_LOCONTROL_SET(x) (((x) << RF2G_RF2G1_LOCONTROL_LSB) & RF2G_RF2G1_LOCONTROL_MASK) -#define RF2G_RF2G1_SHORTLNA2_MSB 5 -#define RF2G_RF2G1_SHORTLNA2_LSB 5 -#define RF2G_RF2G1_SHORTLNA2_MASK 0x00000020 -#define RF2G_RF2G1_SHORTLNA2_GET(x) (((x) & RF2G_RF2G1_SHORTLNA2_MASK) >> RF2G_RF2G1_SHORTLNA2_LSB) -#define RF2G_RF2G1_SHORTLNA2_SET(x) (((x) << RF2G_RF2G1_SHORTLNA2_LSB) & RF2G_RF2G1_SHORTLNA2_MASK) -#define RF2G_RF2G1_SPARE_MSB 4 -#define RF2G_RF2G1_SPARE_LSB 0 -#define RF2G_RF2G1_SPARE_MASK 0x0000001f -#define RF2G_RF2G1_SPARE_GET(x) (((x) & RF2G_RF2G1_SPARE_MASK) >> RF2G_RF2G1_SPARE_LSB) -#define RF2G_RF2G1_SPARE_SET(x) (((x) << RF2G_RF2G1_SPARE_LSB) & RF2G_RF2G1_SPARE_MASK) - -#define RF2G_RF2G2_ADDRESS 0x00000004 -#define RF2G_RF2G2_OFFSET 0x00000004 -#define RF2G_RF2G2_PDCGLNA_MSB 31 -#define RF2G_RF2G2_PDCGLNA_LSB 31 -#define RF2G_RF2G2_PDCGLNA_MASK 0x80000000 -#define RF2G_RF2G2_PDCGLNA_GET(x) (((x) & RF2G_RF2G2_PDCGLNA_MASK) >> RF2G_RF2G2_PDCGLNA_LSB) -#define RF2G_RF2G2_PDCGLNA_SET(x) (((x) << RF2G_RF2G2_PDCGLNA_LSB) & RF2G_RF2G2_PDCGLNA_MASK) -#define RF2G_RF2G2_PDCGLNABUF_MSB 30 -#define RF2G_RF2G2_PDCGLNABUF_LSB 30 -#define RF2G_RF2G2_PDCGLNABUF_MASK 0x40000000 -#define RF2G_RF2G2_PDCGLNABUF_GET(x) (((x) & RF2G_RF2G2_PDCGLNABUF_MASK) >> RF2G_RF2G2_PDCGLNABUF_LSB) -#define RF2G_RF2G2_PDCGLNABUF_SET(x) (((x) << RF2G_RF2G2_PDCGLNABUF_LSB) & RF2G_RF2G2_PDCGLNABUF_MASK) -#define RF2G_RF2G2_PDCSLNA_MSB 29 -#define RF2G_RF2G2_PDCSLNA_LSB 29 -#define RF2G_RF2G2_PDCSLNA_MASK 0x20000000 -#define RF2G_RF2G2_PDCSLNA_GET(x) (((x) & RF2G_RF2G2_PDCSLNA_MASK) >> RF2G_RF2G2_PDCSLNA_LSB) -#define RF2G_RF2G2_PDCSLNA_SET(x) (((x) << RF2G_RF2G2_PDCSLNA_LSB) & RF2G_RF2G2_PDCSLNA_MASK) -#define RF2G_RF2G2_PDDIV_MSB 28 -#define RF2G_RF2G2_PDDIV_LSB 28 -#define RF2G_RF2G2_PDDIV_MASK 0x10000000 -#define RF2G_RF2G2_PDDIV_GET(x) (((x) & RF2G_RF2G2_PDDIV_MASK) >> RF2G_RF2G2_PDDIV_LSB) -#define RF2G_RF2G2_PDDIV_SET(x) (((x) << RF2G_RF2G2_PDDIV_LSB) & RF2G_RF2G2_PDDIV_MASK) -#define RF2G_RF2G2_PDPADRV_MSB 27 -#define RF2G_RF2G2_PDPADRV_LSB 27 -#define RF2G_RF2G2_PDPADRV_MASK 0x08000000 -#define RF2G_RF2G2_PDPADRV_GET(x) (((x) & RF2G_RF2G2_PDPADRV_MASK) >> RF2G_RF2G2_PDPADRV_LSB) -#define RF2G_RF2G2_PDPADRV_SET(x) (((x) << RF2G_RF2G2_PDPADRV_LSB) & RF2G_RF2G2_PDPADRV_MASK) -#define RF2G_RF2G2_PDPAOUT_MSB 26 -#define RF2G_RF2G2_PDPAOUT_LSB 26 -#define RF2G_RF2G2_PDPAOUT_MASK 0x04000000 -#define RF2G_RF2G2_PDPAOUT_GET(x) (((x) & RF2G_RF2G2_PDPAOUT_MASK) >> RF2G_RF2G2_PDPAOUT_LSB) -#define RF2G_RF2G2_PDPAOUT_SET(x) (((x) << RF2G_RF2G2_PDPAOUT_LSB) & RF2G_RF2G2_PDPAOUT_MASK) -#define RF2G_RF2G2_PDREGLNA_MSB 25 -#define RF2G_RF2G2_PDREGLNA_LSB 25 -#define RF2G_RF2G2_PDREGLNA_MASK 0x02000000 -#define RF2G_RF2G2_PDREGLNA_GET(x) (((x) & RF2G_RF2G2_PDREGLNA_MASK) >> RF2G_RF2G2_PDREGLNA_LSB) -#define RF2G_RF2G2_PDREGLNA_SET(x) (((x) << RF2G_RF2G2_PDREGLNA_LSB) & RF2G_RF2G2_PDREGLNA_MASK) -#define RF2G_RF2G2_PDREGLO_MSB 24 -#define RF2G_RF2G2_PDREGLO_LSB 24 -#define RF2G_RF2G2_PDREGLO_MASK 0x01000000 -#define RF2G_RF2G2_PDREGLO_GET(x) (((x) & RF2G_RF2G2_PDREGLO_MASK) >> RF2G_RF2G2_PDREGLO_LSB) -#define RF2G_RF2G2_PDREGLO_SET(x) (((x) << RF2G_RF2G2_PDREGLO_LSB) & RF2G_RF2G2_PDREGLO_MASK) -#define RF2G_RF2G2_PDRFGM_MSB 23 -#define RF2G_RF2G2_PDRFGM_LSB 23 -#define RF2G_RF2G2_PDRFGM_MASK 0x00800000 -#define RF2G_RF2G2_PDRFGM_GET(x) (((x) & RF2G_RF2G2_PDRFGM_MASK) >> RF2G_RF2G2_PDRFGM_LSB) -#define RF2G_RF2G2_PDRFGM_SET(x) (((x) << RF2G_RF2G2_PDRFGM_LSB) & RF2G_RF2G2_PDRFGM_MASK) -#define RF2G_RF2G2_PDRXLO_MSB 22 -#define RF2G_RF2G2_PDRXLO_LSB 22 -#define RF2G_RF2G2_PDRXLO_MASK 0x00400000 -#define RF2G_RF2G2_PDRXLO_GET(x) (((x) & RF2G_RF2G2_PDRXLO_MASK) >> RF2G_RF2G2_PDRXLO_LSB) -#define RF2G_RF2G2_PDRXLO_SET(x) (((x) << RF2G_RF2G2_PDRXLO_LSB) & RF2G_RF2G2_PDRXLO_MASK) -#define RF2G_RF2G2_PDTXLO_MSB 21 -#define RF2G_RF2G2_PDTXLO_LSB 21 -#define RF2G_RF2G2_PDTXLO_MASK 0x00200000 -#define RF2G_RF2G2_PDTXLO_GET(x) (((x) & RF2G_RF2G2_PDTXLO_MASK) >> RF2G_RF2G2_PDTXLO_LSB) -#define RF2G_RF2G2_PDTXLO_SET(x) (((x) << RF2G_RF2G2_PDTXLO_LSB) & RF2G_RF2G2_PDTXLO_MASK) -#define RF2G_RF2G2_PDTXMIX_MSB 20 -#define RF2G_RF2G2_PDTXMIX_LSB 20 -#define RF2G_RF2G2_PDTXMIX_MASK 0x00100000 -#define RF2G_RF2G2_PDTXMIX_GET(x) (((x) & RF2G_RF2G2_PDTXMIX_MASK) >> RF2G_RF2G2_PDTXMIX_LSB) -#define RF2G_RF2G2_PDTXMIX_SET(x) (((x) << RF2G_RF2G2_PDTXMIX_LSB) & RF2G_RF2G2_PDTXMIX_MASK) -#define RF2G_RF2G2_REGLNA_BYPASS_MSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_LSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_MASK 0x00080000 -#define RF2G_RF2G2_REGLNA_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLNA_BYPASS_MASK) >> RF2G_RF2G2_REGLNA_BYPASS_LSB) -#define RF2G_RF2G2_REGLNA_BYPASS_SET(x) (((x) << RF2G_RF2G2_REGLNA_BYPASS_LSB) & RF2G_RF2G2_REGLNA_BYPASS_MASK) -#define RF2G_RF2G2_REGLO_BYPASS_MSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_LSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_MASK 0x00040000 -#define RF2G_RF2G2_REGLO_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLO_BYPASS_MASK) >> RF2G_RF2G2_REGLO_BYPASS_LSB) -#define RF2G_RF2G2_REGLO_BYPASS_SET(x) (((x) << RF2G_RF2G2_REGLO_BYPASS_LSB) & RF2G_RF2G2_REGLO_BYPASS_MASK) -#define RF2G_RF2G2_ENABLE_PCB_MSB 17 -#define RF2G_RF2G2_ENABLE_PCB_LSB 17 -#define RF2G_RF2G2_ENABLE_PCB_MASK 0x00020000 -#define RF2G_RF2G2_ENABLE_PCB_GET(x) (((x) & RF2G_RF2G2_ENABLE_PCB_MASK) >> RF2G_RF2G2_ENABLE_PCB_LSB) -#define RF2G_RF2G2_ENABLE_PCB_SET(x) (((x) << RF2G_RF2G2_ENABLE_PCB_LSB) & RF2G_RF2G2_ENABLE_PCB_MASK) -#define RF2G_RF2G2_SPARE_MSB 16 -#define RF2G_RF2G2_SPARE_LSB 0 -#define RF2G_RF2G2_SPARE_MASK 0x0001ffff -#define RF2G_RF2G2_SPARE_GET(x) (((x) & RF2G_RF2G2_SPARE_MASK) >> RF2G_RF2G2_SPARE_LSB) -#define RF2G_RF2G2_SPARE_SET(x) (((x) << RF2G_RF2G2_SPARE_LSB) & RF2G_RF2G2_SPARE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct rf2g_reg_reg_s { - volatile unsigned int rf2g_rf2g1; - volatile unsigned int rf2g_rf2g2; -} rf2g_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _RF2G_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/rf2G_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/rf2G_reg.vrh deleted file mode 100644 index abcf5f12caf0..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/rf2G_reg.vrh +++ /dev/null @@ -1,240 +0,0 @@ -#ifndef _RF2G_REG_VRH_ -#define _RF2G_REG_VRH_ - -#define RF2G_RF2G1_ADDRESS 'h00000000 -#define RF2G_RF2G1_BLNA1_MSB 31 -#define RF2G_RF2G1_BLNA1_LSB 29 -#define RF2G_RF2G1_BLNA1_MASK 'he0000000 -#define RF2G_RF2G1_BLNA1_GET(x) (((x) & RF2G_RF2G1_BLNA1_MASK) >> RF2G_RF2G1_BLNA1_LSB) -#define RF2G_RF2G1_BLNA1_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA1_LSB) & RF2G_RF2G1_BLNA1_MASK) -#define RF2G_RF2G1_BLNA1_RESET 3'h3 -#define RF2G_RF2G1_BLNA1F_MSB 28 -#define RF2G_RF2G1_BLNA1F_LSB 26 -#define RF2G_RF2G1_BLNA1F_MASK 'h1c000000 -#define RF2G_RF2G1_BLNA1F_GET(x) (((x) & RF2G_RF2G1_BLNA1F_MASK) >> RF2G_RF2G1_BLNA1F_LSB) -#define RF2G_RF2G1_BLNA1F_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA1F_LSB) & RF2G_RF2G1_BLNA1F_MASK) -#define RF2G_RF2G1_BLNA1F_RESET 3'h0 -#define RF2G_RF2G1_BLNA1BUF_MSB 25 -#define RF2G_RF2G1_BLNA1BUF_LSB 23 -#define RF2G_RF2G1_BLNA1BUF_MASK 'h03800000 -#define RF2G_RF2G1_BLNA1BUF_GET(x) (((x) & RF2G_RF2G1_BLNA1BUF_MASK) >> RF2G_RF2G1_BLNA1BUF_LSB) -#define RF2G_RF2G1_BLNA1BUF_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA1BUF_LSB) & RF2G_RF2G1_BLNA1BUF_MASK) -#define RF2G_RF2G1_BLNA1BUF_RESET 3'h3 -#define RF2G_RF2G1_BLNA2_MSB 22 -#define RF2G_RF2G1_BLNA2_LSB 20 -#define RF2G_RF2G1_BLNA2_MASK 'h00700000 -#define RF2G_RF2G1_BLNA2_GET(x) (((x) & RF2G_RF2G1_BLNA2_MASK) >> RF2G_RF2G1_BLNA2_LSB) -#define RF2G_RF2G1_BLNA2_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA2_LSB) & RF2G_RF2G1_BLNA2_MASK) -#define RF2G_RF2G1_BLNA2_RESET 3'h3 -#define RF2G_RF2G1_DB_MSB 19 -#define RF2G_RF2G1_DB_LSB 17 -#define RF2G_RF2G1_DB_MASK 'h000e0000 -#define RF2G_RF2G1_DB_GET(x) (((x) & RF2G_RF2G1_DB_MASK) >> RF2G_RF2G1_DB_LSB) -#define RF2G_RF2G1_DB_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_DB_LSB) & RF2G_RF2G1_DB_MASK) -#define RF2G_RF2G1_DB_RESET 3'h3 -#define RF2G_RF2G1_OB_MSB 16 -#define RF2G_RF2G1_OB_LSB 14 -#define RF2G_RF2G1_OB_MASK 'h0001c000 -#define RF2G_RF2G1_OB_GET(x) (((x) & RF2G_RF2G1_OB_MASK) >> RF2G_RF2G1_OB_LSB) -#define RF2G_RF2G1_OB_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_OB_LSB) & RF2G_RF2G1_OB_MASK) -#define RF2G_RF2G1_OB_RESET 3'h3 -#define RF2G_RF2G1_FE_ATB_SEL_MSB 13 -#define RF2G_RF2G1_FE_ATB_SEL_LSB 11 -#define RF2G_RF2G1_FE_ATB_SEL_MASK 'h00003800 -#define RF2G_RF2G1_FE_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_FE_ATB_SEL_MASK) >> RF2G_RF2G1_FE_ATB_SEL_LSB) -#define RF2G_RF2G1_FE_ATB_SEL_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_FE_ATB_SEL_LSB) & RF2G_RF2G1_FE_ATB_SEL_MASK) -#define RF2G_RF2G1_FE_ATB_SEL_RESET 3'h0 -#define RF2G_RF2G1_RF_ATB_SEL_MSB 10 -#define RF2G_RF2G1_RF_ATB_SEL_LSB 8 -#define RF2G_RF2G1_RF_ATB_SEL_MASK 'h00000700 -#define RF2G_RF2G1_RF_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_RF_ATB_SEL_MASK) >> RF2G_RF2G1_RF_ATB_SEL_LSB) -#define RF2G_RF2G1_RF_ATB_SEL_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_RF_ATB_SEL_LSB) & RF2G_RF2G1_RF_ATB_SEL_MASK) -#define RF2G_RF2G1_RF_ATB_SEL_RESET 3'h0 -#define RF2G_RF2G1_SELLNA_MSB 7 -#define RF2G_RF2G1_SELLNA_LSB 7 -#define RF2G_RF2G1_SELLNA_MASK 'h00000080 -#define RF2G_RF2G1_SELLNA_GET(x) (((x) & RF2G_RF2G1_SELLNA_MASK) >> RF2G_RF2G1_SELLNA_LSB) -#define RF2G_RF2G1_SELLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_SELLNA_LSB) & RF2G_RF2G1_SELLNA_MASK) -#define RF2G_RF2G1_SELLNA_RESET 1'h1 -#define RF2G_RF2G1_LOCONTROL_MSB 6 -#define RF2G_RF2G1_LOCONTROL_LSB 6 -#define RF2G_RF2G1_LOCONTROL_MASK 'h00000040 -#define RF2G_RF2G1_LOCONTROL_GET(x) (((x) & RF2G_RF2G1_LOCONTROL_MASK) >> RF2G_RF2G1_LOCONTROL_LSB) -#define RF2G_RF2G1_LOCONTROL_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_LOCONTROL_LSB) & RF2G_RF2G1_LOCONTROL_MASK) -#define RF2G_RF2G1_LOCONTROL_RESET 1'h0 -#define RF2G_RF2G1_SHORTLNA2_MSB 5 -#define RF2G_RF2G1_SHORTLNA2_LSB 5 -#define RF2G_RF2G1_SHORTLNA2_MASK 'h00000020 -#define RF2G_RF2G1_SHORTLNA2_GET(x) (((x) & RF2G_RF2G1_SHORTLNA2_MASK) >> RF2G_RF2G1_SHORTLNA2_LSB) -#define RF2G_RF2G1_SHORTLNA2_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_SHORTLNA2_LSB) & RF2G_RF2G1_SHORTLNA2_MASK) -#define RF2G_RF2G1_SHORTLNA2_RESET 1'h0 -#define RF2G_RF2G1_SPARE_MSB 4 -#define RF2G_RF2G1_SPARE_LSB 0 -#define RF2G_RF2G1_SPARE_MASK 'h0000001f -#define RF2G_RF2G1_SPARE_GET(x) (((x) & RF2G_RF2G1_SPARE_MASK) >> RF2G_RF2G1_SPARE_LSB) -#define RF2G_RF2G1_SPARE_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_SPARE_LSB) & RF2G_RF2G1_SPARE_MASK) -#define RF2G_RF2G1_SPARE_RESET 5'h0 -#define RF2G_RF2G1_RESET (32'h0 | \ - RF2G_RF2G1_BLNA1_SET(RF2G_RF2G1_BLNA1_RESET) | \ - RF2G_RF2G1_BLNA1F_SET(RF2G_RF2G1_BLNA1F_RESET) | \ - RF2G_RF2G1_BLNA1BUF_SET(RF2G_RF2G1_BLNA1BUF_RESET) | \ - RF2G_RF2G1_BLNA2_SET(RF2G_RF2G1_BLNA2_RESET) | \ - RF2G_RF2G1_DB_SET(RF2G_RF2G1_DB_RESET) | \ - RF2G_RF2G1_OB_SET(RF2G_RF2G1_OB_RESET) | \ - RF2G_RF2G1_FE_ATB_SEL_SET(RF2G_RF2G1_FE_ATB_SEL_RESET) | \ - RF2G_RF2G1_RF_ATB_SEL_SET(RF2G_RF2G1_RF_ATB_SEL_RESET) | \ - RF2G_RF2G1_SELLNA_SET(RF2G_RF2G1_SELLNA_RESET) | \ - RF2G_RF2G1_LOCONTROL_SET(RF2G_RF2G1_LOCONTROL_RESET) | \ - RF2G_RF2G1_SHORTLNA2_SET(RF2G_RF2G1_SHORTLNA2_RESET) | \ - RF2G_RF2G1_SPARE_SET(RF2G_RF2G1_SPARE_RESET)) -#define RF2G_RF2G1_HW_MASK (32'h0) -#define RF2G_RF2G1_SW_MASK (32'h0 | \ - RF2G_RF2G1_BLNA1_MASK | \ - RF2G_RF2G1_BLNA1F_MASK | \ - RF2G_RF2G1_BLNA1BUF_MASK | \ - RF2G_RF2G1_BLNA2_MASK | \ - RF2G_RF2G1_DB_MASK | \ - RF2G_RF2G1_OB_MASK | \ - RF2G_RF2G1_FE_ATB_SEL_MASK | \ - RF2G_RF2G1_RF_ATB_SEL_MASK | \ - RF2G_RF2G1_SELLNA_MASK | \ - RF2G_RF2G1_LOCONTROL_MASK | \ - RF2G_RF2G1_SHORTLNA2_MASK | \ - RF2G_RF2G1_SPARE_MASK) - -#define RF2G_RF2G2_ADDRESS 'h00000004 -#define RF2G_RF2G2_PDCGLNA_MSB 31 -#define RF2G_RF2G2_PDCGLNA_LSB 31 -#define RF2G_RF2G2_PDCGLNA_MASK 'h80000000 -#define RF2G_RF2G2_PDCGLNA_GET(x) (((x) & RF2G_RF2G2_PDCGLNA_MASK) >> RF2G_RF2G2_PDCGLNA_LSB) -#define RF2G_RF2G2_PDCGLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDCGLNA_LSB) & RF2G_RF2G2_PDCGLNA_MASK) -#define RF2G_RF2G2_PDCGLNA_RESET 1'h0 -#define RF2G_RF2G2_PDCGLNABUF_MSB 30 -#define RF2G_RF2G2_PDCGLNABUF_LSB 30 -#define RF2G_RF2G2_PDCGLNABUF_MASK 'h40000000 -#define RF2G_RF2G2_PDCGLNABUF_GET(x) (((x) & RF2G_RF2G2_PDCGLNABUF_MASK) >> RF2G_RF2G2_PDCGLNABUF_LSB) -#define RF2G_RF2G2_PDCGLNABUF_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDCGLNABUF_LSB) & RF2G_RF2G2_PDCGLNABUF_MASK) -#define RF2G_RF2G2_PDCGLNABUF_RESET 1'h0 -#define RF2G_RF2G2_PDCSLNA_MSB 29 -#define RF2G_RF2G2_PDCSLNA_LSB 29 -#define RF2G_RF2G2_PDCSLNA_MASK 'h20000000 -#define RF2G_RF2G2_PDCSLNA_GET(x) (((x) & RF2G_RF2G2_PDCSLNA_MASK) >> RF2G_RF2G2_PDCSLNA_LSB) -#define RF2G_RF2G2_PDCSLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDCSLNA_LSB) & RF2G_RF2G2_PDCSLNA_MASK) -#define RF2G_RF2G2_PDCSLNA_RESET 1'h0 -#define RF2G_RF2G2_PDDIV_MSB 28 -#define RF2G_RF2G2_PDDIV_LSB 28 -#define RF2G_RF2G2_PDDIV_MASK 'h10000000 -#define RF2G_RF2G2_PDDIV_GET(x) (((x) & RF2G_RF2G2_PDDIV_MASK) >> RF2G_RF2G2_PDDIV_LSB) -#define RF2G_RF2G2_PDDIV_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDDIV_LSB) & RF2G_RF2G2_PDDIV_MASK) -#define RF2G_RF2G2_PDDIV_RESET 1'h0 -#define RF2G_RF2G2_PDPADRV_MSB 27 -#define RF2G_RF2G2_PDPADRV_LSB 27 -#define RF2G_RF2G2_PDPADRV_MASK 'h08000000 -#define RF2G_RF2G2_PDPADRV_GET(x) (((x) & RF2G_RF2G2_PDPADRV_MASK) >> RF2G_RF2G2_PDPADRV_LSB) -#define RF2G_RF2G2_PDPADRV_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDPADRV_LSB) & RF2G_RF2G2_PDPADRV_MASK) -#define RF2G_RF2G2_PDPADRV_RESET 1'h0 -#define RF2G_RF2G2_PDPAOUT_MSB 26 -#define RF2G_RF2G2_PDPAOUT_LSB 26 -#define RF2G_RF2G2_PDPAOUT_MASK 'h04000000 -#define RF2G_RF2G2_PDPAOUT_GET(x) (((x) & RF2G_RF2G2_PDPAOUT_MASK) >> RF2G_RF2G2_PDPAOUT_LSB) -#define RF2G_RF2G2_PDPAOUT_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDPAOUT_LSB) & RF2G_RF2G2_PDPAOUT_MASK) -#define RF2G_RF2G2_PDPAOUT_RESET 1'h0 -#define RF2G_RF2G2_PDREGLNA_MSB 25 -#define RF2G_RF2G2_PDREGLNA_LSB 25 -#define RF2G_RF2G2_PDREGLNA_MASK 'h02000000 -#define RF2G_RF2G2_PDREGLNA_GET(x) (((x) & RF2G_RF2G2_PDREGLNA_MASK) >> RF2G_RF2G2_PDREGLNA_LSB) -#define RF2G_RF2G2_PDREGLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDREGLNA_LSB) & RF2G_RF2G2_PDREGLNA_MASK) -#define RF2G_RF2G2_PDREGLNA_RESET 1'h0 -#define RF2G_RF2G2_PDREGLO_MSB 24 -#define RF2G_RF2G2_PDREGLO_LSB 24 -#define RF2G_RF2G2_PDREGLO_MASK 'h01000000 -#define RF2G_RF2G2_PDREGLO_GET(x) (((x) & RF2G_RF2G2_PDREGLO_MASK) >> RF2G_RF2G2_PDREGLO_LSB) -#define RF2G_RF2G2_PDREGLO_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDREGLO_LSB) & RF2G_RF2G2_PDREGLO_MASK) -#define RF2G_RF2G2_PDREGLO_RESET 1'h0 -#define RF2G_RF2G2_PDRFGM_MSB 23 -#define RF2G_RF2G2_PDRFGM_LSB 23 -#define RF2G_RF2G2_PDRFGM_MASK 'h00800000 -#define RF2G_RF2G2_PDRFGM_GET(x) (((x) & RF2G_RF2G2_PDRFGM_MASK) >> RF2G_RF2G2_PDRFGM_LSB) -#define RF2G_RF2G2_PDRFGM_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDRFGM_LSB) & RF2G_RF2G2_PDRFGM_MASK) -#define RF2G_RF2G2_PDRFGM_RESET 1'h0 -#define RF2G_RF2G2_PDRXLO_MSB 22 -#define RF2G_RF2G2_PDRXLO_LSB 22 -#define RF2G_RF2G2_PDRXLO_MASK 'h00400000 -#define RF2G_RF2G2_PDRXLO_GET(x) (((x) & RF2G_RF2G2_PDRXLO_MASK) >> RF2G_RF2G2_PDRXLO_LSB) -#define RF2G_RF2G2_PDRXLO_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDRXLO_LSB) & RF2G_RF2G2_PDRXLO_MASK) -#define RF2G_RF2G2_PDRXLO_RESET 1'h0 -#define RF2G_RF2G2_PDTXLO_MSB 21 -#define RF2G_RF2G2_PDTXLO_LSB 21 -#define RF2G_RF2G2_PDTXLO_MASK 'h00200000 -#define RF2G_RF2G2_PDTXLO_GET(x) (((x) & RF2G_RF2G2_PDTXLO_MASK) >> RF2G_RF2G2_PDTXLO_LSB) -#define RF2G_RF2G2_PDTXLO_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDTXLO_LSB) & RF2G_RF2G2_PDTXLO_MASK) -#define RF2G_RF2G2_PDTXLO_RESET 1'h0 -#define RF2G_RF2G2_PDTXMIX_MSB 20 -#define RF2G_RF2G2_PDTXMIX_LSB 20 -#define RF2G_RF2G2_PDTXMIX_MASK 'h00100000 -#define RF2G_RF2G2_PDTXMIX_GET(x) (((x) & RF2G_RF2G2_PDTXMIX_MASK) >> RF2G_RF2G2_PDTXMIX_LSB) -#define RF2G_RF2G2_PDTXMIX_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDTXMIX_LSB) & RF2G_RF2G2_PDTXMIX_MASK) -#define RF2G_RF2G2_PDTXMIX_RESET 1'h0 -#define RF2G_RF2G2_REGLNA_BYPASS_MSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_LSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_MASK 'h00080000 -#define RF2G_RF2G2_REGLNA_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLNA_BYPASS_MASK) >> RF2G_RF2G2_REGLNA_BYPASS_LSB) -#define RF2G_RF2G2_REGLNA_BYPASS_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_REGLNA_BYPASS_LSB) & RF2G_RF2G2_REGLNA_BYPASS_MASK) -#define RF2G_RF2G2_REGLNA_BYPASS_RESET 1'h0 -#define RF2G_RF2G2_REGLO_BYPASS_MSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_LSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_MASK 'h00040000 -#define RF2G_RF2G2_REGLO_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLO_BYPASS_MASK) >> RF2G_RF2G2_REGLO_BYPASS_LSB) -#define RF2G_RF2G2_REGLO_BYPASS_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_REGLO_BYPASS_LSB) & RF2G_RF2G2_REGLO_BYPASS_MASK) -#define RF2G_RF2G2_REGLO_BYPASS_RESET 1'h0 -#define RF2G_RF2G2_ENABLE_PCB_MSB 17 -#define RF2G_RF2G2_ENABLE_PCB_LSB 17 -#define RF2G_RF2G2_ENABLE_PCB_MASK 'h00020000 -#define RF2G_RF2G2_ENABLE_PCB_GET(x) (((x) & RF2G_RF2G2_ENABLE_PCB_MASK) >> RF2G_RF2G2_ENABLE_PCB_LSB) -#define RF2G_RF2G2_ENABLE_PCB_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_ENABLE_PCB_LSB) & RF2G_RF2G2_ENABLE_PCB_MASK) -#define RF2G_RF2G2_ENABLE_PCB_RESET 1'h0 -#define RF2G_RF2G2_SPARE_MSB 16 -#define RF2G_RF2G2_SPARE_LSB 0 -#define RF2G_RF2G2_SPARE_MASK 'h0001ffff -#define RF2G_RF2G2_SPARE_GET(x) (((x) & RF2G_RF2G2_SPARE_MASK) >> RF2G_RF2G2_SPARE_LSB) -#define RF2G_RF2G2_SPARE_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_SPARE_LSB) & RF2G_RF2G2_SPARE_MASK) -#define RF2G_RF2G2_SPARE_RESET 17'h0 -#define RF2G_RF2G2_RESET (32'h0 | \ - RF2G_RF2G2_PDCGLNA_SET(RF2G_RF2G2_PDCGLNA_RESET) | \ - RF2G_RF2G2_PDCGLNABUF_SET(RF2G_RF2G2_PDCGLNABUF_RESET) | \ - RF2G_RF2G2_PDCSLNA_SET(RF2G_RF2G2_PDCSLNA_RESET) | \ - RF2G_RF2G2_PDDIV_SET(RF2G_RF2G2_PDDIV_RESET) | \ - RF2G_RF2G2_PDPADRV_SET(RF2G_RF2G2_PDPADRV_RESET) | \ - RF2G_RF2G2_PDPAOUT_SET(RF2G_RF2G2_PDPAOUT_RESET) | \ - RF2G_RF2G2_PDREGLNA_SET(RF2G_RF2G2_PDREGLNA_RESET) | \ - RF2G_RF2G2_PDREGLO_SET(RF2G_RF2G2_PDREGLO_RESET) | \ - RF2G_RF2G2_PDRFGM_SET(RF2G_RF2G2_PDRFGM_RESET) | \ - RF2G_RF2G2_PDRXLO_SET(RF2G_RF2G2_PDRXLO_RESET) | \ - RF2G_RF2G2_PDTXLO_SET(RF2G_RF2G2_PDTXLO_RESET) | \ - RF2G_RF2G2_PDTXMIX_SET(RF2G_RF2G2_PDTXMIX_RESET) | \ - RF2G_RF2G2_REGLNA_BYPASS_SET(RF2G_RF2G2_REGLNA_BYPASS_RESET) | \ - RF2G_RF2G2_REGLO_BYPASS_SET(RF2G_RF2G2_REGLO_BYPASS_RESET) | \ - RF2G_RF2G2_ENABLE_PCB_SET(RF2G_RF2G2_ENABLE_PCB_RESET) | \ - RF2G_RF2G2_SPARE_SET(RF2G_RF2G2_SPARE_RESET)) -#define RF2G_RF2G2_HW_MASK (32'h0) -#define RF2G_RF2G2_SW_MASK (32'h0 | \ - RF2G_RF2G2_PDCGLNA_MASK | \ - RF2G_RF2G2_PDCGLNABUF_MASK | \ - RF2G_RF2G2_PDCSLNA_MASK | \ - RF2G_RF2G2_PDDIV_MASK | \ - RF2G_RF2G2_PDPADRV_MASK | \ - RF2G_RF2G2_PDPAOUT_MASK | \ - RF2G_RF2G2_PDREGLNA_MASK | \ - RF2G_RF2G2_PDREGLO_MASK | \ - RF2G_RF2G2_PDRFGM_MASK | \ - RF2G_RF2G2_PDRXLO_MASK | \ - RF2G_RF2G2_PDTXLO_MASK | \ - RF2G_RF2G2_PDTXMIX_MASK | \ - RF2G_RF2G2_REGLNA_BYPASS_MASK | \ - RF2G_RF2G2_REGLO_BYPASS_MASK | \ - RF2G_RF2G2_ENABLE_PCB_MASK | \ - RF2G_RF2G2_SPARE_MASK) - -#define RF2G_REG_ADDRESS_MSB 2 - -#endif /* _RF2G_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/rf5G_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/rf5G_reg.h deleted file mode 100644 index 463529e9b62b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/rf5G_reg.h +++ /dev/null @@ -1,195 +0,0 @@ -#ifndef _RF5G_REG_REG_H_ -#define _RF5G_REG_REG_H_ - -#define RF5G_RF5G1_ADDRESS 0x00000000 -#define RF5G_RF5G1_OFFSET 0x00000000 -#define RF5G_RF5G1_PDTXLO5_MSB 31 -#define RF5G_RF5G1_PDTXLO5_LSB 31 -#define RF5G_RF5G1_PDTXLO5_MASK 0x80000000 -#define RF5G_RF5G1_PDTXLO5_GET(x) (((x) & RF5G_RF5G1_PDTXLO5_MASK) >> RF5G_RF5G1_PDTXLO5_LSB) -#define RF5G_RF5G1_PDTXLO5_SET(x) (((x) << RF5G_RF5G1_PDTXLO5_LSB) & RF5G_RF5G1_PDTXLO5_MASK) -#define RF5G_RF5G1_PDTXMIX5_MSB 30 -#define RF5G_RF5G1_PDTXMIX5_LSB 30 -#define RF5G_RF5G1_PDTXMIX5_MASK 0x40000000 -#define RF5G_RF5G1_PDTXMIX5_GET(x) (((x) & RF5G_RF5G1_PDTXMIX5_MASK) >> RF5G_RF5G1_PDTXMIX5_LSB) -#define RF5G_RF5G1_PDTXMIX5_SET(x) (((x) << RF5G_RF5G1_PDTXMIX5_LSB) & RF5G_RF5G1_PDTXMIX5_MASK) -#define RF5G_RF5G1_PDTXBUF5_MSB 29 -#define RF5G_RF5G1_PDTXBUF5_LSB 29 -#define RF5G_RF5G1_PDTXBUF5_MASK 0x20000000 -#define RF5G_RF5G1_PDTXBUF5_GET(x) (((x) & RF5G_RF5G1_PDTXBUF5_MASK) >> RF5G_RF5G1_PDTXBUF5_LSB) -#define RF5G_RF5G1_PDTXBUF5_SET(x) (((x) << RF5G_RF5G1_PDTXBUF5_LSB) & RF5G_RF5G1_PDTXBUF5_MASK) -#define RF5G_RF5G1_PDPADRV5_MSB 28 -#define RF5G_RF5G1_PDPADRV5_LSB 28 -#define RF5G_RF5G1_PDPADRV5_MASK 0x10000000 -#define RF5G_RF5G1_PDPADRV5_GET(x) (((x) & RF5G_RF5G1_PDPADRV5_MASK) >> RF5G_RF5G1_PDPADRV5_LSB) -#define RF5G_RF5G1_PDPADRV5_SET(x) (((x) << RF5G_RF5G1_PDPADRV5_LSB) & RF5G_RF5G1_PDPADRV5_MASK) -#define RF5G_RF5G1_PDPAOUT5_MSB 27 -#define RF5G_RF5G1_PDPAOUT5_LSB 27 -#define RF5G_RF5G1_PDPAOUT5_MASK 0x08000000 -#define RF5G_RF5G1_PDPAOUT5_GET(x) (((x) & RF5G_RF5G1_PDPAOUT5_MASK) >> RF5G_RF5G1_PDPAOUT5_LSB) -#define RF5G_RF5G1_PDPAOUT5_SET(x) (((x) << RF5G_RF5G1_PDPAOUT5_LSB) & RF5G_RF5G1_PDPAOUT5_MASK) -#define RF5G_RF5G1_TUNE_PADRV5_MSB 26 -#define RF5G_RF5G1_TUNE_PADRV5_LSB 24 -#define RF5G_RF5G1_TUNE_PADRV5_MASK 0x07000000 -#define RF5G_RF5G1_TUNE_PADRV5_GET(x) (((x) & RF5G_RF5G1_TUNE_PADRV5_MASK) >> RF5G_RF5G1_TUNE_PADRV5_LSB) -#define RF5G_RF5G1_TUNE_PADRV5_SET(x) (((x) << RF5G_RF5G1_TUNE_PADRV5_LSB) & RF5G_RF5G1_TUNE_PADRV5_MASK) -#define RF5G_RF5G1_PWDTXPKD_MSB 23 -#define RF5G_RF5G1_PWDTXPKD_LSB 21 -#define RF5G_RF5G1_PWDTXPKD_MASK 0x00e00000 -#define RF5G_RF5G1_PWDTXPKD_GET(x) (((x) & RF5G_RF5G1_PWDTXPKD_MASK) >> RF5G_RF5G1_PWDTXPKD_LSB) -#define RF5G_RF5G1_PWDTXPKD_SET(x) (((x) << RF5G_RF5G1_PWDTXPKD_LSB) & RF5G_RF5G1_PWDTXPKD_MASK) -#define RF5G_RF5G1_DB5_MSB 20 -#define RF5G_RF5G1_DB5_LSB 18 -#define RF5G_RF5G1_DB5_MASK 0x001c0000 -#define RF5G_RF5G1_DB5_GET(x) (((x) & RF5G_RF5G1_DB5_MASK) >> RF5G_RF5G1_DB5_LSB) -#define RF5G_RF5G1_DB5_SET(x) (((x) << RF5G_RF5G1_DB5_LSB) & RF5G_RF5G1_DB5_MASK) -#define RF5G_RF5G1_OB5_MSB 17 -#define RF5G_RF5G1_OB5_LSB 15 -#define RF5G_RF5G1_OB5_MASK 0x00038000 -#define RF5G_RF5G1_OB5_GET(x) (((x) & RF5G_RF5G1_OB5_MASK) >> RF5G_RF5G1_OB5_LSB) -#define RF5G_RF5G1_OB5_SET(x) (((x) << RF5G_RF5G1_OB5_LSB) & RF5G_RF5G1_OB5_MASK) -#define RF5G_RF5G1_TX5_ATB_SEL_MSB 14 -#define RF5G_RF5G1_TX5_ATB_SEL_LSB 12 -#define RF5G_RF5G1_TX5_ATB_SEL_MASK 0x00007000 -#define RF5G_RF5G1_TX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_TX5_ATB_SEL_MASK) >> RF5G_RF5G1_TX5_ATB_SEL_LSB) -#define RF5G_RF5G1_TX5_ATB_SEL_SET(x) (((x) << RF5G_RF5G1_TX5_ATB_SEL_LSB) & RF5G_RF5G1_TX5_ATB_SEL_MASK) -#define RF5G_RF5G1_PDLO5DIV_MSB 11 -#define RF5G_RF5G1_PDLO5DIV_LSB 11 -#define RF5G_RF5G1_PDLO5DIV_MASK 0x00000800 -#define RF5G_RF5G1_PDLO5DIV_GET(x) (((x) & RF5G_RF5G1_PDLO5DIV_MASK) >> RF5G_RF5G1_PDLO5DIV_LSB) -#define RF5G_RF5G1_PDLO5DIV_SET(x) (((x) << RF5G_RF5G1_PDLO5DIV_LSB) & RF5G_RF5G1_PDLO5DIV_MASK) -#define RF5G_RF5G1_PDLO5MIX_MSB 10 -#define RF5G_RF5G1_PDLO5MIX_LSB 10 -#define RF5G_RF5G1_PDLO5MIX_MASK 0x00000400 -#define RF5G_RF5G1_PDLO5MIX_GET(x) (((x) & RF5G_RF5G1_PDLO5MIX_MASK) >> RF5G_RF5G1_PDLO5MIX_LSB) -#define RF5G_RF5G1_PDLO5MIX_SET(x) (((x) << RF5G_RF5G1_PDLO5MIX_LSB) & RF5G_RF5G1_PDLO5MIX_MASK) -#define RF5G_RF5G1_PDQBUF5_MSB 9 -#define RF5G_RF5G1_PDQBUF5_LSB 9 -#define RF5G_RF5G1_PDQBUF5_MASK 0x00000200 -#define RF5G_RF5G1_PDQBUF5_GET(x) (((x) & RF5G_RF5G1_PDQBUF5_MASK) >> RF5G_RF5G1_PDQBUF5_LSB) -#define RF5G_RF5G1_PDQBUF5_SET(x) (((x) << RF5G_RF5G1_PDQBUF5_LSB) & RF5G_RF5G1_PDQBUF5_MASK) -#define RF5G_RF5G1_PDLO5AGC_MSB 8 -#define RF5G_RF5G1_PDLO5AGC_LSB 8 -#define RF5G_RF5G1_PDLO5AGC_MASK 0x00000100 -#define RF5G_RF5G1_PDLO5AGC_GET(x) (((x) & RF5G_RF5G1_PDLO5AGC_MASK) >> RF5G_RF5G1_PDLO5AGC_LSB) -#define RF5G_RF5G1_PDLO5AGC_SET(x) (((x) << RF5G_RF5G1_PDLO5AGC_LSB) & RF5G_RF5G1_PDLO5AGC_MASK) -#define RF5G_RF5G1_PDREGLO5_MSB 7 -#define RF5G_RF5G1_PDREGLO5_LSB 7 -#define RF5G_RF5G1_PDREGLO5_MASK 0x00000080 -#define RF5G_RF5G1_PDREGLO5_GET(x) (((x) & RF5G_RF5G1_PDREGLO5_MASK) >> RF5G_RF5G1_PDREGLO5_LSB) -#define RF5G_RF5G1_PDREGLO5_SET(x) (((x) << RF5G_RF5G1_PDREGLO5_LSB) & RF5G_RF5G1_PDREGLO5_MASK) -#define RF5G_RF5G1_LO5_ATB_SEL_MSB 6 -#define RF5G_RF5G1_LO5_ATB_SEL_LSB 4 -#define RF5G_RF5G1_LO5_ATB_SEL_MASK 0x00000070 -#define RF5G_RF5G1_LO5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_LO5_ATB_SEL_MASK) >> RF5G_RF5G1_LO5_ATB_SEL_LSB) -#define RF5G_RF5G1_LO5_ATB_SEL_SET(x) (((x) << RF5G_RF5G1_LO5_ATB_SEL_LSB) & RF5G_RF5G1_LO5_ATB_SEL_MASK) -#define RF5G_RF5G1_LO5CONTROL_MSB 3 -#define RF5G_RF5G1_LO5CONTROL_LSB 3 -#define RF5G_RF5G1_LO5CONTROL_MASK 0x00000008 -#define RF5G_RF5G1_LO5CONTROL_GET(x) (((x) & RF5G_RF5G1_LO5CONTROL_MASK) >> RF5G_RF5G1_LO5CONTROL_LSB) -#define RF5G_RF5G1_LO5CONTROL_SET(x) (((x) << RF5G_RF5G1_LO5CONTROL_LSB) & RF5G_RF5G1_LO5CONTROL_MASK) -#define RF5G_RF5G1_REGLO_BYPASS5_MSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_LSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_MASK 0x00000004 -#define RF5G_RF5G1_REGLO_BYPASS5_GET(x) (((x) & RF5G_RF5G1_REGLO_BYPASS5_MASK) >> RF5G_RF5G1_REGLO_BYPASS5_LSB) -#define RF5G_RF5G1_REGLO_BYPASS5_SET(x) (((x) << RF5G_RF5G1_REGLO_BYPASS5_LSB) & RF5G_RF5G1_REGLO_BYPASS5_MASK) -#define RF5G_RF5G1_SPARE_MSB 1 -#define RF5G_RF5G1_SPARE_LSB 0 -#define RF5G_RF5G1_SPARE_MASK 0x00000003 -#define RF5G_RF5G1_SPARE_GET(x) (((x) & RF5G_RF5G1_SPARE_MASK) >> RF5G_RF5G1_SPARE_LSB) -#define RF5G_RF5G1_SPARE_SET(x) (((x) << RF5G_RF5G1_SPARE_LSB) & RF5G_RF5G1_SPARE_MASK) - -#define RF5G_RF5G2_ADDRESS 0x00000004 -#define RF5G_RF5G2_OFFSET 0x00000004 -#define RF5G_RF5G2_AGCLO_B_MSB 31 -#define RF5G_RF5G2_AGCLO_B_LSB 29 -#define RF5G_RF5G2_AGCLO_B_MASK 0xe0000000 -#define RF5G_RF5G2_AGCLO_B_GET(x) (((x) & RF5G_RF5G2_AGCLO_B_MASK) >> RF5G_RF5G2_AGCLO_B_LSB) -#define RF5G_RF5G2_AGCLO_B_SET(x) (((x) << RF5G_RF5G2_AGCLO_B_LSB) & RF5G_RF5G2_AGCLO_B_MASK) -#define RF5G_RF5G2_RX5_ATB_SEL_MSB 28 -#define RF5G_RF5G2_RX5_ATB_SEL_LSB 26 -#define RF5G_RF5G2_RX5_ATB_SEL_MASK 0x1c000000 -#define RF5G_RF5G2_RX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G2_RX5_ATB_SEL_MASK) >> RF5G_RF5G2_RX5_ATB_SEL_LSB) -#define RF5G_RF5G2_RX5_ATB_SEL_SET(x) (((x) << RF5G_RF5G2_RX5_ATB_SEL_LSB) & RF5G_RF5G2_RX5_ATB_SEL_MASK) -#define RF5G_RF5G2_PDCMOSLO5_MSB 25 -#define RF5G_RF5G2_PDCMOSLO5_LSB 25 -#define RF5G_RF5G2_PDCMOSLO5_MASK 0x02000000 -#define RF5G_RF5G2_PDCMOSLO5_GET(x) (((x) & RF5G_RF5G2_PDCMOSLO5_MASK) >> RF5G_RF5G2_PDCMOSLO5_LSB) -#define RF5G_RF5G2_PDCMOSLO5_SET(x) (((x) << RF5G_RF5G2_PDCMOSLO5_LSB) & RF5G_RF5G2_PDCMOSLO5_MASK) -#define RF5G_RF5G2_PDVGM5_MSB 24 -#define RF5G_RF5G2_PDVGM5_LSB 24 -#define RF5G_RF5G2_PDVGM5_MASK 0x01000000 -#define RF5G_RF5G2_PDVGM5_GET(x) (((x) & RF5G_RF5G2_PDVGM5_MASK) >> RF5G_RF5G2_PDVGM5_LSB) -#define RF5G_RF5G2_PDVGM5_SET(x) (((x) << RF5G_RF5G2_PDVGM5_LSB) & RF5G_RF5G2_PDVGM5_MASK) -#define RF5G_RF5G2_PDCSLNA5_MSB 23 -#define RF5G_RF5G2_PDCSLNA5_LSB 23 -#define RF5G_RF5G2_PDCSLNA5_MASK 0x00800000 -#define RF5G_RF5G2_PDCSLNA5_GET(x) (((x) & RF5G_RF5G2_PDCSLNA5_MASK) >> RF5G_RF5G2_PDCSLNA5_LSB) -#define RF5G_RF5G2_PDCSLNA5_SET(x) (((x) << RF5G_RF5G2_PDCSLNA5_LSB) & RF5G_RF5G2_PDCSLNA5_MASK) -#define RF5G_RF5G2_PDRFVGA5_MSB 22 -#define RF5G_RF5G2_PDRFVGA5_LSB 22 -#define RF5G_RF5G2_PDRFVGA5_MASK 0x00400000 -#define RF5G_RF5G2_PDRFVGA5_GET(x) (((x) & RF5G_RF5G2_PDRFVGA5_MASK) >> RF5G_RF5G2_PDRFVGA5_LSB) -#define RF5G_RF5G2_PDRFVGA5_SET(x) (((x) << RF5G_RF5G2_PDRFVGA5_LSB) & RF5G_RF5G2_PDRFVGA5_MASK) -#define RF5G_RF5G2_PDREGFE5_MSB 21 -#define RF5G_RF5G2_PDREGFE5_LSB 21 -#define RF5G_RF5G2_PDREGFE5_MASK 0x00200000 -#define RF5G_RF5G2_PDREGFE5_GET(x) (((x) & RF5G_RF5G2_PDREGFE5_MASK) >> RF5G_RF5G2_PDREGFE5_LSB) -#define RF5G_RF5G2_PDREGFE5_SET(x) (((x) << RF5G_RF5G2_PDREGFE5_LSB) & RF5G_RF5G2_PDREGFE5_MASK) -#define RF5G_RF5G2_TUNE_RFVGA5_MSB 20 -#define RF5G_RF5G2_TUNE_RFVGA5_LSB 18 -#define RF5G_RF5G2_TUNE_RFVGA5_MASK 0x001c0000 -#define RF5G_RF5G2_TUNE_RFVGA5_GET(x) (((x) & RF5G_RF5G2_TUNE_RFVGA5_MASK) >> RF5G_RF5G2_TUNE_RFVGA5_LSB) -#define RF5G_RF5G2_TUNE_RFVGA5_SET(x) (((x) << RF5G_RF5G2_TUNE_RFVGA5_LSB) & RF5G_RF5G2_TUNE_RFVGA5_MASK) -#define RF5G_RF5G2_BRFVGA5_MSB 17 -#define RF5G_RF5G2_BRFVGA5_LSB 15 -#define RF5G_RF5G2_BRFVGA5_MASK 0x00038000 -#define RF5G_RF5G2_BRFVGA5_GET(x) (((x) & RF5G_RF5G2_BRFVGA5_MASK) >> RF5G_RF5G2_BRFVGA5_LSB) -#define RF5G_RF5G2_BRFVGA5_SET(x) (((x) << RF5G_RF5G2_BRFVGA5_LSB) & RF5G_RF5G2_BRFVGA5_MASK) -#define RF5G_RF5G2_BCSLNA5_MSB 14 -#define RF5G_RF5G2_BCSLNA5_LSB 12 -#define RF5G_RF5G2_BCSLNA5_MASK 0x00007000 -#define RF5G_RF5G2_BCSLNA5_GET(x) (((x) & RF5G_RF5G2_BCSLNA5_MASK) >> RF5G_RF5G2_BCSLNA5_LSB) -#define RF5G_RF5G2_BCSLNA5_SET(x) (((x) << RF5G_RF5G2_BCSLNA5_LSB) & RF5G_RF5G2_BCSLNA5_MASK) -#define RF5G_RF5G2_BVGM5_MSB 11 -#define RF5G_RF5G2_BVGM5_LSB 9 -#define RF5G_RF5G2_BVGM5_MASK 0x00000e00 -#define RF5G_RF5G2_BVGM5_GET(x) (((x) & RF5G_RF5G2_BVGM5_MASK) >> RF5G_RF5G2_BVGM5_LSB) -#define RF5G_RF5G2_BVGM5_SET(x) (((x) << RF5G_RF5G2_BVGM5_LSB) & RF5G_RF5G2_BVGM5_MASK) -#define RF5G_RF5G2_REGFE_BYPASS5_MSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_LSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_MASK 0x00000100 -#define RF5G_RF5G2_REGFE_BYPASS5_GET(x) (((x) & RF5G_RF5G2_REGFE_BYPASS5_MASK) >> RF5G_RF5G2_REGFE_BYPASS5_LSB) -#define RF5G_RF5G2_REGFE_BYPASS5_SET(x) (((x) << RF5G_RF5G2_REGFE_BYPASS5_LSB) & RF5G_RF5G2_REGFE_BYPASS5_MASK) -#define RF5G_RF5G2_LNA5_ATTENMODE_MSB 7 -#define RF5G_RF5G2_LNA5_ATTENMODE_LSB 6 -#define RF5G_RF5G2_LNA5_ATTENMODE_MASK 0x000000c0 -#define RF5G_RF5G2_LNA5_ATTENMODE_GET(x) (((x) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) >> RF5G_RF5G2_LNA5_ATTENMODE_LSB) -#define RF5G_RF5G2_LNA5_ATTENMODE_SET(x) (((x) << RF5G_RF5G2_LNA5_ATTENMODE_LSB) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) -#define RF5G_RF5G2_ENABLE_PCA_MSB 5 -#define RF5G_RF5G2_ENABLE_PCA_LSB 5 -#define RF5G_RF5G2_ENABLE_PCA_MASK 0x00000020 -#define RF5G_RF5G2_ENABLE_PCA_GET(x) (((x) & RF5G_RF5G2_ENABLE_PCA_MASK) >> RF5G_RF5G2_ENABLE_PCA_LSB) -#define RF5G_RF5G2_ENABLE_PCA_SET(x) (((x) << RF5G_RF5G2_ENABLE_PCA_LSB) & RF5G_RF5G2_ENABLE_PCA_MASK) -#define RF5G_RF5G2_TUNE_LO_MSB 4 -#define RF5G_RF5G2_TUNE_LO_LSB 2 -#define RF5G_RF5G2_TUNE_LO_MASK 0x0000001c -#define RF5G_RF5G2_TUNE_LO_GET(x) (((x) & RF5G_RF5G2_TUNE_LO_MASK) >> RF5G_RF5G2_TUNE_LO_LSB) -#define RF5G_RF5G2_TUNE_LO_SET(x) (((x) << RF5G_RF5G2_TUNE_LO_LSB) & RF5G_RF5G2_TUNE_LO_MASK) -#define RF5G_RF5G2_SPARE_MSB 1 -#define RF5G_RF5G2_SPARE_LSB 0 -#define RF5G_RF5G2_SPARE_MASK 0x00000003 -#define RF5G_RF5G2_SPARE_GET(x) (((x) & RF5G_RF5G2_SPARE_MASK) >> RF5G_RF5G2_SPARE_LSB) -#define RF5G_RF5G2_SPARE_SET(x) (((x) << RF5G_RF5G2_SPARE_LSB) & RF5G_RF5G2_SPARE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct rf5g_reg_reg_s { - volatile unsigned int rf5g_rf5g1; - volatile unsigned int rf5g_rf5g2; -} rf5g_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _RF5G_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/rf5G_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/rf5G_reg.vrh deleted file mode 100644 index 6627936f3063..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/rf5G_reg.vrh +++ /dev/null @@ -1,296 +0,0 @@ -#ifndef _RF5G_REG_VRH_ -#define _RF5G_REG_VRH_ - -#define RF5G_RF5G1_ADDRESS 'h00000000 -#define RF5G_RF5G1_PDTXLO5_MSB 31 -#define RF5G_RF5G1_PDTXLO5_LSB 31 -#define RF5G_RF5G1_PDTXLO5_MASK 'h80000000 -#define RF5G_RF5G1_PDTXLO5_GET(x) (((x) & RF5G_RF5G1_PDTXLO5_MASK) >> RF5G_RF5G1_PDTXLO5_LSB) -#define RF5G_RF5G1_PDTXLO5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDTXLO5_LSB) & RF5G_RF5G1_PDTXLO5_MASK) -#define RF5G_RF5G1_PDTXLO5_RESET 1'h0 -#define RF5G_RF5G1_PDTXMIX5_MSB 30 -#define RF5G_RF5G1_PDTXMIX5_LSB 30 -#define RF5G_RF5G1_PDTXMIX5_MASK 'h40000000 -#define RF5G_RF5G1_PDTXMIX5_GET(x) (((x) & RF5G_RF5G1_PDTXMIX5_MASK) >> RF5G_RF5G1_PDTXMIX5_LSB) -#define RF5G_RF5G1_PDTXMIX5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDTXMIX5_LSB) & RF5G_RF5G1_PDTXMIX5_MASK) -#define RF5G_RF5G1_PDTXMIX5_RESET 1'h0 -#define RF5G_RF5G1_PDTXBUF5_MSB 29 -#define RF5G_RF5G1_PDTXBUF5_LSB 29 -#define RF5G_RF5G1_PDTXBUF5_MASK 'h20000000 -#define RF5G_RF5G1_PDTXBUF5_GET(x) (((x) & RF5G_RF5G1_PDTXBUF5_MASK) >> RF5G_RF5G1_PDTXBUF5_LSB) -#define RF5G_RF5G1_PDTXBUF5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDTXBUF5_LSB) & RF5G_RF5G1_PDTXBUF5_MASK) -#define RF5G_RF5G1_PDTXBUF5_RESET 1'h0 -#define RF5G_RF5G1_PDPADRV5_MSB 28 -#define RF5G_RF5G1_PDPADRV5_LSB 28 -#define RF5G_RF5G1_PDPADRV5_MASK 'h10000000 -#define RF5G_RF5G1_PDPADRV5_GET(x) (((x) & RF5G_RF5G1_PDPADRV5_MASK) >> RF5G_RF5G1_PDPADRV5_LSB) -#define RF5G_RF5G1_PDPADRV5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDPADRV5_LSB) & RF5G_RF5G1_PDPADRV5_MASK) -#define RF5G_RF5G1_PDPADRV5_RESET 1'h0 -#define RF5G_RF5G1_PDPAOUT5_MSB 27 -#define RF5G_RF5G1_PDPAOUT5_LSB 27 -#define RF5G_RF5G1_PDPAOUT5_MASK 'h08000000 -#define RF5G_RF5G1_PDPAOUT5_GET(x) (((x) & RF5G_RF5G1_PDPAOUT5_MASK) >> RF5G_RF5G1_PDPAOUT5_LSB) -#define RF5G_RF5G1_PDPAOUT5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDPAOUT5_LSB) & RF5G_RF5G1_PDPAOUT5_MASK) -#define RF5G_RF5G1_PDPAOUT5_RESET 1'h0 -#define RF5G_RF5G1_TUNE_PADRV5_MSB 26 -#define RF5G_RF5G1_TUNE_PADRV5_LSB 24 -#define RF5G_RF5G1_TUNE_PADRV5_MASK 'h07000000 -#define RF5G_RF5G1_TUNE_PADRV5_GET(x) (((x) & RF5G_RF5G1_TUNE_PADRV5_MASK) >> RF5G_RF5G1_TUNE_PADRV5_LSB) -#define RF5G_RF5G1_TUNE_PADRV5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_TUNE_PADRV5_LSB) & RF5G_RF5G1_TUNE_PADRV5_MASK) -#define RF5G_RF5G1_TUNE_PADRV5_RESET 3'h0 -#define RF5G_RF5G1_PWDTXPKD_MSB 23 -#define RF5G_RF5G1_PWDTXPKD_LSB 21 -#define RF5G_RF5G1_PWDTXPKD_MASK 'h00e00000 -#define RF5G_RF5G1_PWDTXPKD_GET(x) (((x) & RF5G_RF5G1_PWDTXPKD_MASK) >> RF5G_RF5G1_PWDTXPKD_LSB) -#define RF5G_RF5G1_PWDTXPKD_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PWDTXPKD_LSB) & RF5G_RF5G1_PWDTXPKD_MASK) -#define RF5G_RF5G1_PWDTXPKD_RESET 3'h7 -#define RF5G_RF5G1_DB5_MSB 20 -#define RF5G_RF5G1_DB5_LSB 18 -#define RF5G_RF5G1_DB5_MASK 'h001c0000 -#define RF5G_RF5G1_DB5_GET(x) (((x) & RF5G_RF5G1_DB5_MASK) >> RF5G_RF5G1_DB5_LSB) -#define RF5G_RF5G1_DB5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_DB5_LSB) & RF5G_RF5G1_DB5_MASK) -#define RF5G_RF5G1_DB5_RESET 3'h4 -#define RF5G_RF5G1_OB5_MSB 17 -#define RF5G_RF5G1_OB5_LSB 15 -#define RF5G_RF5G1_OB5_MASK 'h00038000 -#define RF5G_RF5G1_OB5_GET(x) (((x) & RF5G_RF5G1_OB5_MASK) >> RF5G_RF5G1_OB5_LSB) -#define RF5G_RF5G1_OB5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_OB5_LSB) & RF5G_RF5G1_OB5_MASK) -#define RF5G_RF5G1_OB5_RESET 3'h4 -#define RF5G_RF5G1_TX5_ATB_SEL_MSB 14 -#define RF5G_RF5G1_TX5_ATB_SEL_LSB 12 -#define RF5G_RF5G1_TX5_ATB_SEL_MASK 'h00007000 -#define RF5G_RF5G1_TX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_TX5_ATB_SEL_MASK) >> RF5G_RF5G1_TX5_ATB_SEL_LSB) -#define RF5G_RF5G1_TX5_ATB_SEL_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_TX5_ATB_SEL_LSB) & RF5G_RF5G1_TX5_ATB_SEL_MASK) -#define RF5G_RF5G1_TX5_ATB_SEL_RESET 3'h0 -#define RF5G_RF5G1_PDLO5DIV_MSB 11 -#define RF5G_RF5G1_PDLO5DIV_LSB 11 -#define RF5G_RF5G1_PDLO5DIV_MASK 'h00000800 -#define RF5G_RF5G1_PDLO5DIV_GET(x) (((x) & RF5G_RF5G1_PDLO5DIV_MASK) >> RF5G_RF5G1_PDLO5DIV_LSB) -#define RF5G_RF5G1_PDLO5DIV_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDLO5DIV_LSB) & RF5G_RF5G1_PDLO5DIV_MASK) -#define RF5G_RF5G1_PDLO5DIV_RESET 1'h0 -#define RF5G_RF5G1_PDLO5MIX_MSB 10 -#define RF5G_RF5G1_PDLO5MIX_LSB 10 -#define RF5G_RF5G1_PDLO5MIX_MASK 'h00000400 -#define RF5G_RF5G1_PDLO5MIX_GET(x) (((x) & RF5G_RF5G1_PDLO5MIX_MASK) >> RF5G_RF5G1_PDLO5MIX_LSB) -#define RF5G_RF5G1_PDLO5MIX_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDLO5MIX_LSB) & RF5G_RF5G1_PDLO5MIX_MASK) -#define RF5G_RF5G1_PDLO5MIX_RESET 1'h0 -#define RF5G_RF5G1_PDQBUF5_MSB 9 -#define RF5G_RF5G1_PDQBUF5_LSB 9 -#define RF5G_RF5G1_PDQBUF5_MASK 'h00000200 -#define RF5G_RF5G1_PDQBUF5_GET(x) (((x) & RF5G_RF5G1_PDQBUF5_MASK) >> RF5G_RF5G1_PDQBUF5_LSB) -#define RF5G_RF5G1_PDQBUF5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDQBUF5_LSB) & RF5G_RF5G1_PDQBUF5_MASK) -#define RF5G_RF5G1_PDQBUF5_RESET 1'h0 -#define RF5G_RF5G1_PDLO5AGC_MSB 8 -#define RF5G_RF5G1_PDLO5AGC_LSB 8 -#define RF5G_RF5G1_PDLO5AGC_MASK 'h00000100 -#define RF5G_RF5G1_PDLO5AGC_GET(x) (((x) & RF5G_RF5G1_PDLO5AGC_MASK) >> RF5G_RF5G1_PDLO5AGC_LSB) -#define RF5G_RF5G1_PDLO5AGC_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDLO5AGC_LSB) & RF5G_RF5G1_PDLO5AGC_MASK) -#define RF5G_RF5G1_PDLO5AGC_RESET 1'h0 -#define RF5G_RF5G1_PDREGLO5_MSB 7 -#define RF5G_RF5G1_PDREGLO5_LSB 7 -#define RF5G_RF5G1_PDREGLO5_MASK 'h00000080 -#define RF5G_RF5G1_PDREGLO5_GET(x) (((x) & RF5G_RF5G1_PDREGLO5_MASK) >> RF5G_RF5G1_PDREGLO5_LSB) -#define RF5G_RF5G1_PDREGLO5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDREGLO5_LSB) & RF5G_RF5G1_PDREGLO5_MASK) -#define RF5G_RF5G1_PDREGLO5_RESET 1'h0 -#define RF5G_RF5G1_LO5_ATB_SEL_MSB 6 -#define RF5G_RF5G1_LO5_ATB_SEL_LSB 4 -#define RF5G_RF5G1_LO5_ATB_SEL_MASK 'h00000070 -#define RF5G_RF5G1_LO5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_LO5_ATB_SEL_MASK) >> RF5G_RF5G1_LO5_ATB_SEL_LSB) -#define RF5G_RF5G1_LO5_ATB_SEL_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_LO5_ATB_SEL_LSB) & RF5G_RF5G1_LO5_ATB_SEL_MASK) -#define RF5G_RF5G1_LO5_ATB_SEL_RESET 3'h0 -#define RF5G_RF5G1_LO5CONTROL_MSB 3 -#define RF5G_RF5G1_LO5CONTROL_LSB 3 -#define RF5G_RF5G1_LO5CONTROL_MASK 'h00000008 -#define RF5G_RF5G1_LO5CONTROL_GET(x) (((x) & RF5G_RF5G1_LO5CONTROL_MASK) >> RF5G_RF5G1_LO5CONTROL_LSB) -#define RF5G_RF5G1_LO5CONTROL_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_LO5CONTROL_LSB) & RF5G_RF5G1_LO5CONTROL_MASK) -#define RF5G_RF5G1_LO5CONTROL_RESET 1'h0 -#define RF5G_RF5G1_REGLO_BYPASS5_MSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_LSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_MASK 'h00000004 -#define RF5G_RF5G1_REGLO_BYPASS5_GET(x) (((x) & RF5G_RF5G1_REGLO_BYPASS5_MASK) >> RF5G_RF5G1_REGLO_BYPASS5_LSB) -#define RF5G_RF5G1_REGLO_BYPASS5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_REGLO_BYPASS5_LSB) & RF5G_RF5G1_REGLO_BYPASS5_MASK) -#define RF5G_RF5G1_REGLO_BYPASS5_RESET 1'h0 -#define RF5G_RF5G1_SPARE_MSB 1 -#define RF5G_RF5G1_SPARE_LSB 0 -#define RF5G_RF5G1_SPARE_MASK 'h00000003 -#define RF5G_RF5G1_SPARE_GET(x) (((x) & RF5G_RF5G1_SPARE_MASK) >> RF5G_RF5G1_SPARE_LSB) -#define RF5G_RF5G1_SPARE_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_SPARE_LSB) & RF5G_RF5G1_SPARE_MASK) -#define RF5G_RF5G1_SPARE_RESET 2'h0 -#define RF5G_RF5G1_RESET (32'h0 | \ - RF5G_RF5G1_PDTXLO5_SET(RF5G_RF5G1_PDTXLO5_RESET) | \ - RF5G_RF5G1_PDTXMIX5_SET(RF5G_RF5G1_PDTXMIX5_RESET) | \ - RF5G_RF5G1_PDTXBUF5_SET(RF5G_RF5G1_PDTXBUF5_RESET) | \ - RF5G_RF5G1_PDPADRV5_SET(RF5G_RF5G1_PDPADRV5_RESET) | \ - RF5G_RF5G1_PDPAOUT5_SET(RF5G_RF5G1_PDPAOUT5_RESET) | \ - RF5G_RF5G1_TUNE_PADRV5_SET(RF5G_RF5G1_TUNE_PADRV5_RESET) | \ - RF5G_RF5G1_PWDTXPKD_SET(RF5G_RF5G1_PWDTXPKD_RESET) | \ - RF5G_RF5G1_DB5_SET(RF5G_RF5G1_DB5_RESET) | \ - RF5G_RF5G1_OB5_SET(RF5G_RF5G1_OB5_RESET) | \ - RF5G_RF5G1_TX5_ATB_SEL_SET(RF5G_RF5G1_TX5_ATB_SEL_RESET) | \ - RF5G_RF5G1_PDLO5DIV_SET(RF5G_RF5G1_PDLO5DIV_RESET) | \ - RF5G_RF5G1_PDLO5MIX_SET(RF5G_RF5G1_PDLO5MIX_RESET) | \ - RF5G_RF5G1_PDQBUF5_SET(RF5G_RF5G1_PDQBUF5_RESET) | \ - RF5G_RF5G1_PDLO5AGC_SET(RF5G_RF5G1_PDLO5AGC_RESET) | \ - RF5G_RF5G1_PDREGLO5_SET(RF5G_RF5G1_PDREGLO5_RESET) | \ - RF5G_RF5G1_LO5_ATB_SEL_SET(RF5G_RF5G1_LO5_ATB_SEL_RESET) | \ - RF5G_RF5G1_LO5CONTROL_SET(RF5G_RF5G1_LO5CONTROL_RESET) | \ - RF5G_RF5G1_REGLO_BYPASS5_SET(RF5G_RF5G1_REGLO_BYPASS5_RESET) | \ - RF5G_RF5G1_SPARE_SET(RF5G_RF5G1_SPARE_RESET)) -#define RF5G_RF5G1_HW_MASK (32'h0) -#define RF5G_RF5G1_SW_MASK (32'h0 | \ - RF5G_RF5G1_PDTXLO5_MASK | \ - RF5G_RF5G1_PDTXMIX5_MASK | \ - RF5G_RF5G1_PDTXBUF5_MASK | \ - RF5G_RF5G1_PDPADRV5_MASK | \ - RF5G_RF5G1_PDPAOUT5_MASK | \ - RF5G_RF5G1_TUNE_PADRV5_MASK | \ - RF5G_RF5G1_PWDTXPKD_MASK | \ - RF5G_RF5G1_DB5_MASK | \ - RF5G_RF5G1_OB5_MASK | \ - RF5G_RF5G1_TX5_ATB_SEL_MASK | \ - RF5G_RF5G1_PDLO5DIV_MASK | \ - RF5G_RF5G1_PDLO5MIX_MASK | \ - RF5G_RF5G1_PDQBUF5_MASK | \ - RF5G_RF5G1_PDLO5AGC_MASK | \ - RF5G_RF5G1_PDREGLO5_MASK | \ - RF5G_RF5G1_LO5_ATB_SEL_MASK | \ - RF5G_RF5G1_LO5CONTROL_MASK | \ - RF5G_RF5G1_REGLO_BYPASS5_MASK | \ - RF5G_RF5G1_SPARE_MASK) - -#define RF5G_RF5G2_ADDRESS 'h00000004 -#define RF5G_RF5G2_AGCLO_B_MSB 31 -#define RF5G_RF5G2_AGCLO_B_LSB 29 -#define RF5G_RF5G2_AGCLO_B_MASK 'he0000000 -#define RF5G_RF5G2_AGCLO_B_GET(x) (((x) & RF5G_RF5G2_AGCLO_B_MASK) >> RF5G_RF5G2_AGCLO_B_LSB) -#define RF5G_RF5G2_AGCLO_B_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_AGCLO_B_LSB) & RF5G_RF5G2_AGCLO_B_MASK) -#define RF5G_RF5G2_AGCLO_B_RESET 3'h4 -#define RF5G_RF5G2_RX5_ATB_SEL_MSB 28 -#define RF5G_RF5G2_RX5_ATB_SEL_LSB 26 -#define RF5G_RF5G2_RX5_ATB_SEL_MASK 'h1c000000 -#define RF5G_RF5G2_RX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G2_RX5_ATB_SEL_MASK) >> RF5G_RF5G2_RX5_ATB_SEL_LSB) -#define RF5G_RF5G2_RX5_ATB_SEL_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_RX5_ATB_SEL_LSB) & RF5G_RF5G2_RX5_ATB_SEL_MASK) -#define RF5G_RF5G2_RX5_ATB_SEL_RESET 3'h0 -#define RF5G_RF5G2_PDCMOSLO5_MSB 25 -#define RF5G_RF5G2_PDCMOSLO5_LSB 25 -#define RF5G_RF5G2_PDCMOSLO5_MASK 'h02000000 -#define RF5G_RF5G2_PDCMOSLO5_GET(x) (((x) & RF5G_RF5G2_PDCMOSLO5_MASK) >> RF5G_RF5G2_PDCMOSLO5_LSB) -#define RF5G_RF5G2_PDCMOSLO5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDCMOSLO5_LSB) & RF5G_RF5G2_PDCMOSLO5_MASK) -#define RF5G_RF5G2_PDCMOSLO5_RESET 1'h0 -#define RF5G_RF5G2_PDVGM5_MSB 24 -#define RF5G_RF5G2_PDVGM5_LSB 24 -#define RF5G_RF5G2_PDVGM5_MASK 'h01000000 -#define RF5G_RF5G2_PDVGM5_GET(x) (((x) & RF5G_RF5G2_PDVGM5_MASK) >> RF5G_RF5G2_PDVGM5_LSB) -#define RF5G_RF5G2_PDVGM5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDVGM5_LSB) & RF5G_RF5G2_PDVGM5_MASK) -#define RF5G_RF5G2_PDVGM5_RESET 1'h0 -#define RF5G_RF5G2_PDCSLNA5_MSB 23 -#define RF5G_RF5G2_PDCSLNA5_LSB 23 -#define RF5G_RF5G2_PDCSLNA5_MASK 'h00800000 -#define RF5G_RF5G2_PDCSLNA5_GET(x) (((x) & RF5G_RF5G2_PDCSLNA5_MASK) >> RF5G_RF5G2_PDCSLNA5_LSB) -#define RF5G_RF5G2_PDCSLNA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDCSLNA5_LSB) & RF5G_RF5G2_PDCSLNA5_MASK) -#define RF5G_RF5G2_PDCSLNA5_RESET 1'h0 -#define RF5G_RF5G2_PDRFVGA5_MSB 22 -#define RF5G_RF5G2_PDRFVGA5_LSB 22 -#define RF5G_RF5G2_PDRFVGA5_MASK 'h00400000 -#define RF5G_RF5G2_PDRFVGA5_GET(x) (((x) & RF5G_RF5G2_PDRFVGA5_MASK) >> RF5G_RF5G2_PDRFVGA5_LSB) -#define RF5G_RF5G2_PDRFVGA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDRFVGA5_LSB) & RF5G_RF5G2_PDRFVGA5_MASK) -#define RF5G_RF5G2_PDRFVGA5_RESET 1'h0 -#define RF5G_RF5G2_PDREGFE5_MSB 21 -#define RF5G_RF5G2_PDREGFE5_LSB 21 -#define RF5G_RF5G2_PDREGFE5_MASK 'h00200000 -#define RF5G_RF5G2_PDREGFE5_GET(x) (((x) & RF5G_RF5G2_PDREGFE5_MASK) >> RF5G_RF5G2_PDREGFE5_LSB) -#define RF5G_RF5G2_PDREGFE5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDREGFE5_LSB) & RF5G_RF5G2_PDREGFE5_MASK) -#define RF5G_RF5G2_PDREGFE5_RESET 1'h0 -#define RF5G_RF5G2_TUNE_RFVGA5_MSB 20 -#define RF5G_RF5G2_TUNE_RFVGA5_LSB 18 -#define RF5G_RF5G2_TUNE_RFVGA5_MASK 'h001c0000 -#define RF5G_RF5G2_TUNE_RFVGA5_GET(x) (((x) & RF5G_RF5G2_TUNE_RFVGA5_MASK) >> RF5G_RF5G2_TUNE_RFVGA5_LSB) -#define RF5G_RF5G2_TUNE_RFVGA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_TUNE_RFVGA5_LSB) & RF5G_RF5G2_TUNE_RFVGA5_MASK) -#define RF5G_RF5G2_TUNE_RFVGA5_RESET 3'h0 -#define RF5G_RF5G2_BRFVGA5_MSB 17 -#define RF5G_RF5G2_BRFVGA5_LSB 15 -#define RF5G_RF5G2_BRFVGA5_MASK 'h00038000 -#define RF5G_RF5G2_BRFVGA5_GET(x) (((x) & RF5G_RF5G2_BRFVGA5_MASK) >> RF5G_RF5G2_BRFVGA5_LSB) -#define RF5G_RF5G2_BRFVGA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_BRFVGA5_LSB) & RF5G_RF5G2_BRFVGA5_MASK) -#define RF5G_RF5G2_BRFVGA5_RESET 3'h5 -#define RF5G_RF5G2_BCSLNA5_MSB 14 -#define RF5G_RF5G2_BCSLNA5_LSB 12 -#define RF5G_RF5G2_BCSLNA5_MASK 'h00007000 -#define RF5G_RF5G2_BCSLNA5_GET(x) (((x) & RF5G_RF5G2_BCSLNA5_MASK) >> RF5G_RF5G2_BCSLNA5_LSB) -#define RF5G_RF5G2_BCSLNA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_BCSLNA5_LSB) & RF5G_RF5G2_BCSLNA5_MASK) -#define RF5G_RF5G2_BCSLNA5_RESET 3'h3 -#define RF5G_RF5G2_BVGM5_MSB 11 -#define RF5G_RF5G2_BVGM5_LSB 9 -#define RF5G_RF5G2_BVGM5_MASK 'h00000e00 -#define RF5G_RF5G2_BVGM5_GET(x) (((x) & RF5G_RF5G2_BVGM5_MASK) >> RF5G_RF5G2_BVGM5_LSB) -#define RF5G_RF5G2_BVGM5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_BVGM5_LSB) & RF5G_RF5G2_BVGM5_MASK) -#define RF5G_RF5G2_BVGM5_RESET 3'h1 -#define RF5G_RF5G2_REGFE_BYPASS5_MSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_LSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_MASK 'h00000100 -#define RF5G_RF5G2_REGFE_BYPASS5_GET(x) (((x) & RF5G_RF5G2_REGFE_BYPASS5_MASK) >> RF5G_RF5G2_REGFE_BYPASS5_LSB) -#define RF5G_RF5G2_REGFE_BYPASS5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_REGFE_BYPASS5_LSB) & RF5G_RF5G2_REGFE_BYPASS5_MASK) -#define RF5G_RF5G2_REGFE_BYPASS5_RESET 1'h0 -#define RF5G_RF5G2_LNA5_ATTENMODE_MSB 7 -#define RF5G_RF5G2_LNA5_ATTENMODE_LSB 6 -#define RF5G_RF5G2_LNA5_ATTENMODE_MASK 'h000000c0 -#define RF5G_RF5G2_LNA5_ATTENMODE_GET(x) (((x) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) >> RF5G_RF5G2_LNA5_ATTENMODE_LSB) -#define RF5G_RF5G2_LNA5_ATTENMODE_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_LNA5_ATTENMODE_LSB) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) -#define RF5G_RF5G2_LNA5_ATTENMODE_RESET 2'h0 -#define RF5G_RF5G2_ENABLE_PCA_MSB 5 -#define RF5G_RF5G2_ENABLE_PCA_LSB 5 -#define RF5G_RF5G2_ENABLE_PCA_MASK 'h00000020 -#define RF5G_RF5G2_ENABLE_PCA_GET(x) (((x) & RF5G_RF5G2_ENABLE_PCA_MASK) >> RF5G_RF5G2_ENABLE_PCA_LSB) -#define RF5G_RF5G2_ENABLE_PCA_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_ENABLE_PCA_LSB) & RF5G_RF5G2_ENABLE_PCA_MASK) -#define RF5G_RF5G2_ENABLE_PCA_RESET 1'h0 -#define RF5G_RF5G2_TUNE_LO_MSB 4 -#define RF5G_RF5G2_TUNE_LO_LSB 2 -#define RF5G_RF5G2_TUNE_LO_MASK 'h0000001c -#define RF5G_RF5G2_TUNE_LO_GET(x) (((x) & RF5G_RF5G2_TUNE_LO_MASK) >> RF5G_RF5G2_TUNE_LO_LSB) -#define RF5G_RF5G2_TUNE_LO_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_TUNE_LO_LSB) & RF5G_RF5G2_TUNE_LO_MASK) -#define RF5G_RF5G2_TUNE_LO_RESET 3'h0 -#define RF5G_RF5G2_SPARE_MSB 1 -#define RF5G_RF5G2_SPARE_LSB 0 -#define RF5G_RF5G2_SPARE_MASK 'h00000003 -#define RF5G_RF5G2_SPARE_GET(x) (((x) & RF5G_RF5G2_SPARE_MASK) >> RF5G_RF5G2_SPARE_LSB) -#define RF5G_RF5G2_SPARE_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_SPARE_LSB) & RF5G_RF5G2_SPARE_MASK) -#define RF5G_RF5G2_SPARE_RESET 2'h0 -#define RF5G_RF5G2_RESET (32'h0 | \ - RF5G_RF5G2_AGCLO_B_SET(RF5G_RF5G2_AGCLO_B_RESET) | \ - RF5G_RF5G2_RX5_ATB_SEL_SET(RF5G_RF5G2_RX5_ATB_SEL_RESET) | \ - RF5G_RF5G2_PDCMOSLO5_SET(RF5G_RF5G2_PDCMOSLO5_RESET) | \ - RF5G_RF5G2_PDVGM5_SET(RF5G_RF5G2_PDVGM5_RESET) | \ - RF5G_RF5G2_PDCSLNA5_SET(RF5G_RF5G2_PDCSLNA5_RESET) | \ - RF5G_RF5G2_PDRFVGA5_SET(RF5G_RF5G2_PDRFVGA5_RESET) | \ - RF5G_RF5G2_PDREGFE5_SET(RF5G_RF5G2_PDREGFE5_RESET) | \ - RF5G_RF5G2_TUNE_RFVGA5_SET(RF5G_RF5G2_TUNE_RFVGA5_RESET) | \ - RF5G_RF5G2_BRFVGA5_SET(RF5G_RF5G2_BRFVGA5_RESET) | \ - RF5G_RF5G2_BCSLNA5_SET(RF5G_RF5G2_BCSLNA5_RESET) | \ - RF5G_RF5G2_BVGM5_SET(RF5G_RF5G2_BVGM5_RESET) | \ - RF5G_RF5G2_REGFE_BYPASS5_SET(RF5G_RF5G2_REGFE_BYPASS5_RESET) | \ - RF5G_RF5G2_LNA5_ATTENMODE_SET(RF5G_RF5G2_LNA5_ATTENMODE_RESET) | \ - RF5G_RF5G2_ENABLE_PCA_SET(RF5G_RF5G2_ENABLE_PCA_RESET) | \ - RF5G_RF5G2_TUNE_LO_SET(RF5G_RF5G2_TUNE_LO_RESET) | \ - RF5G_RF5G2_SPARE_SET(RF5G_RF5G2_SPARE_RESET)) -#define RF5G_RF5G2_HW_MASK (32'h0) -#define RF5G_RF5G2_SW_MASK (32'h0 | \ - RF5G_RF5G2_AGCLO_B_MASK | \ - RF5G_RF5G2_RX5_ATB_SEL_MASK | \ - RF5G_RF5G2_PDCMOSLO5_MASK | \ - RF5G_RF5G2_PDVGM5_MASK | \ - RF5G_RF5G2_PDCSLNA5_MASK | \ - RF5G_RF5G2_PDRFVGA5_MASK | \ - RF5G_RF5G2_PDREGFE5_MASK | \ - RF5G_RF5G2_TUNE_RFVGA5_MASK | \ - RF5G_RF5G2_BRFVGA5_MASK | \ - RF5G_RF5G2_BCSLNA5_MASK | \ - RF5G_RF5G2_BVGM5_MASK | \ - RF5G_RF5G2_REGFE_BYPASS5_MASK | \ - RF5G_RF5G2_LNA5_ATTENMODE_MASK | \ - RF5G_RF5G2_ENABLE_PCA_MASK | \ - RF5G_RF5G2_TUNE_LO_MASK | \ - RF5G_RF5G2_SPARE_MASK) - -#define RF5G_REG_ADDRESS_MSB 2 - -#endif /* _RF5G_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/rtc_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/rtc_reg.h deleted file mode 100644 index 8b3980afb643..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/rtc_reg.h +++ /dev/null @@ -1,1163 +0,0 @@ -#ifndef _RTC_REG_REG_H_ -#define _RTC_REG_REG_H_ - -#define RESET_CONTROL_ADDRESS 0x00000000 -#define RESET_CONTROL_OFFSET 0x00000000 -#define RESET_CONTROL_CPU_INIT_RESET_MSB 11 -#define RESET_CONTROL_CPU_INIT_RESET_LSB 11 -#define RESET_CONTROL_CPU_INIT_RESET_MASK 0x00000800 -#define RESET_CONTROL_CPU_INIT_RESET_GET(x) (((x) & RESET_CONTROL_CPU_INIT_RESET_MASK) >> RESET_CONTROL_CPU_INIT_RESET_LSB) -#define RESET_CONTROL_CPU_INIT_RESET_SET(x) (((x) << RESET_CONTROL_CPU_INIT_RESET_LSB) & RESET_CONTROL_CPU_INIT_RESET_MASK) -#define RESET_CONTROL_VMC_REMAP_RESET_MSB 10 -#define RESET_CONTROL_VMC_REMAP_RESET_LSB 10 -#define RESET_CONTROL_VMC_REMAP_RESET_MASK 0x00000400 -#define RESET_CONTROL_VMC_REMAP_RESET_GET(x) (((x) & RESET_CONTROL_VMC_REMAP_RESET_MASK) >> RESET_CONTROL_VMC_REMAP_RESET_LSB) -#define RESET_CONTROL_VMC_REMAP_RESET_SET(x) (((x) << RESET_CONTROL_VMC_REMAP_RESET_LSB) & RESET_CONTROL_VMC_REMAP_RESET_MASK) -#define RESET_CONTROL_RST_OUT_MSB 9 -#define RESET_CONTROL_RST_OUT_LSB 9 -#define RESET_CONTROL_RST_OUT_MASK 0x00000200 -#define RESET_CONTROL_RST_OUT_GET(x) (((x) & RESET_CONTROL_RST_OUT_MASK) >> RESET_CONTROL_RST_OUT_LSB) -#define RESET_CONTROL_RST_OUT_SET(x) (((x) << RESET_CONTROL_RST_OUT_LSB) & RESET_CONTROL_RST_OUT_MASK) -#define RESET_CONTROL_COLD_RST_MSB 8 -#define RESET_CONTROL_COLD_RST_LSB 8 -#define RESET_CONTROL_COLD_RST_MASK 0x00000100 -#define RESET_CONTROL_COLD_RST_GET(x) (((x) & RESET_CONTROL_COLD_RST_MASK) >> RESET_CONTROL_COLD_RST_LSB) -#define RESET_CONTROL_COLD_RST_SET(x) (((x) << RESET_CONTROL_COLD_RST_LSB) & RESET_CONTROL_COLD_RST_MASK) -#define RESET_CONTROL_WARM_RST_MSB 7 -#define RESET_CONTROL_WARM_RST_LSB 7 -#define RESET_CONTROL_WARM_RST_MASK 0x00000080 -#define RESET_CONTROL_WARM_RST_GET(x) (((x) & RESET_CONTROL_WARM_RST_MASK) >> RESET_CONTROL_WARM_RST_LSB) -#define RESET_CONTROL_WARM_RST_SET(x) (((x) << RESET_CONTROL_WARM_RST_LSB) & RESET_CONTROL_WARM_RST_MASK) -#define RESET_CONTROL_CPU_WARM_RST_MSB 6 -#define RESET_CONTROL_CPU_WARM_RST_LSB 6 -#define RESET_CONTROL_CPU_WARM_RST_MASK 0x00000040 -#define RESET_CONTROL_CPU_WARM_RST_GET(x) (((x) & RESET_CONTROL_CPU_WARM_RST_MASK) >> RESET_CONTROL_CPU_WARM_RST_LSB) -#define RESET_CONTROL_CPU_WARM_RST_SET(x) (((x) << RESET_CONTROL_CPU_WARM_RST_LSB) & RESET_CONTROL_CPU_WARM_RST_MASK) -#define RESET_CONTROL_MAC_COLD_RST_MSB 5 -#define RESET_CONTROL_MAC_COLD_RST_LSB 5 -#define RESET_CONTROL_MAC_COLD_RST_MASK 0x00000020 -#define RESET_CONTROL_MAC_COLD_RST_GET(x) (((x) & RESET_CONTROL_MAC_COLD_RST_MASK) >> RESET_CONTROL_MAC_COLD_RST_LSB) -#define RESET_CONTROL_MAC_COLD_RST_SET(x) (((x) << RESET_CONTROL_MAC_COLD_RST_LSB) & RESET_CONTROL_MAC_COLD_RST_MASK) -#define RESET_CONTROL_MAC_WARM_RST_MSB 4 -#define RESET_CONTROL_MAC_WARM_RST_LSB 4 -#define RESET_CONTROL_MAC_WARM_RST_MASK 0x00000010 -#define RESET_CONTROL_MAC_WARM_RST_GET(x) (((x) & RESET_CONTROL_MAC_WARM_RST_MASK) >> RESET_CONTROL_MAC_WARM_RST_LSB) -#define RESET_CONTROL_MAC_WARM_RST_SET(x) (((x) << RESET_CONTROL_MAC_WARM_RST_LSB) & RESET_CONTROL_MAC_WARM_RST_MASK) -#define RESET_CONTROL_MBOX_RST_MSB 2 -#define RESET_CONTROL_MBOX_RST_LSB 2 -#define RESET_CONTROL_MBOX_RST_MASK 0x00000004 -#define RESET_CONTROL_MBOX_RST_GET(x) (((x) & RESET_CONTROL_MBOX_RST_MASK) >> RESET_CONTROL_MBOX_RST_LSB) -#define RESET_CONTROL_MBOX_RST_SET(x) (((x) << RESET_CONTROL_MBOX_RST_LSB) & RESET_CONTROL_MBOX_RST_MASK) -#define RESET_CONTROL_UART_RST_MSB 1 -#define RESET_CONTROL_UART_RST_LSB 1 -#define RESET_CONTROL_UART_RST_MASK 0x00000002 -#define RESET_CONTROL_UART_RST_GET(x) (((x) & RESET_CONTROL_UART_RST_MASK) >> RESET_CONTROL_UART_RST_LSB) -#define RESET_CONTROL_UART_RST_SET(x) (((x) << RESET_CONTROL_UART_RST_LSB) & RESET_CONTROL_UART_RST_MASK) -#define RESET_CONTROL_SI0_RST_MSB 0 -#define RESET_CONTROL_SI0_RST_LSB 0 -#define RESET_CONTROL_SI0_RST_MASK 0x00000001 -#define RESET_CONTROL_SI0_RST_GET(x) (((x) & RESET_CONTROL_SI0_RST_MASK) >> RESET_CONTROL_SI0_RST_LSB) -#define RESET_CONTROL_SI0_RST_SET(x) (((x) << RESET_CONTROL_SI0_RST_LSB) & RESET_CONTROL_SI0_RST_MASK) - -#define XTAL_CONTROL_ADDRESS 0x00000004 -#define XTAL_CONTROL_OFFSET 0x00000004 -#define XTAL_CONTROL_TCXO_MSB 0 -#define XTAL_CONTROL_TCXO_LSB 0 -#define XTAL_CONTROL_TCXO_MASK 0x00000001 -#define XTAL_CONTROL_TCXO_GET(x) (((x) & XTAL_CONTROL_TCXO_MASK) >> XTAL_CONTROL_TCXO_LSB) -#define XTAL_CONTROL_TCXO_SET(x) (((x) << XTAL_CONTROL_TCXO_LSB) & XTAL_CONTROL_TCXO_MASK) - -#define TCXO_DETECT_ADDRESS 0x00000008 -#define TCXO_DETECT_OFFSET 0x00000008 -#define TCXO_DETECT_PRESENT_MSB 0 -#define TCXO_DETECT_PRESENT_LSB 0 -#define TCXO_DETECT_PRESENT_MASK 0x00000001 -#define TCXO_DETECT_PRESENT_GET(x) (((x) & TCXO_DETECT_PRESENT_MASK) >> TCXO_DETECT_PRESENT_LSB) -#define TCXO_DETECT_PRESENT_SET(x) (((x) << TCXO_DETECT_PRESENT_LSB) & TCXO_DETECT_PRESENT_MASK) - -#define XTAL_TEST_ADDRESS 0x0000000c -#define XTAL_TEST_OFFSET 0x0000000c -#define XTAL_TEST_NOTCXODET_MSB 0 -#define XTAL_TEST_NOTCXODET_LSB 0 -#define XTAL_TEST_NOTCXODET_MASK 0x00000001 -#define XTAL_TEST_NOTCXODET_GET(x) (((x) & XTAL_TEST_NOTCXODET_MASK) >> XTAL_TEST_NOTCXODET_LSB) -#define XTAL_TEST_NOTCXODET_SET(x) (((x) << XTAL_TEST_NOTCXODET_LSB) & XTAL_TEST_NOTCXODET_MASK) - -#define QUADRATURE_ADDRESS 0x00000010 -#define QUADRATURE_OFFSET 0x00000010 -#define QUADRATURE_ADC_MSB 5 -#define QUADRATURE_ADC_LSB 4 -#define QUADRATURE_ADC_MASK 0x00000030 -#define QUADRATURE_ADC_GET(x) (((x) & QUADRATURE_ADC_MASK) >> QUADRATURE_ADC_LSB) -#define QUADRATURE_ADC_SET(x) (((x) << QUADRATURE_ADC_LSB) & QUADRATURE_ADC_MASK) -#define QUADRATURE_SEL_MSB 2 -#define QUADRATURE_SEL_LSB 2 -#define QUADRATURE_SEL_MASK 0x00000004 -#define QUADRATURE_SEL_GET(x) (((x) & QUADRATURE_SEL_MASK) >> QUADRATURE_SEL_LSB) -#define QUADRATURE_SEL_SET(x) (((x) << QUADRATURE_SEL_LSB) & QUADRATURE_SEL_MASK) -#define QUADRATURE_DAC_MSB 1 -#define QUADRATURE_DAC_LSB 0 -#define QUADRATURE_DAC_MASK 0x00000003 -#define QUADRATURE_DAC_GET(x) (((x) & QUADRATURE_DAC_MASK) >> QUADRATURE_DAC_LSB) -#define QUADRATURE_DAC_SET(x) (((x) << QUADRATURE_DAC_LSB) & QUADRATURE_DAC_MASK) - -#define PLL_CONTROL_ADDRESS 0x00000014 -#define PLL_CONTROL_OFFSET 0x00000014 -#define PLL_CONTROL_DIG_TEST_CLK_MSB 20 -#define PLL_CONTROL_DIG_TEST_CLK_LSB 20 -#define PLL_CONTROL_DIG_TEST_CLK_MASK 0x00100000 -#define PLL_CONTROL_DIG_TEST_CLK_GET(x) (((x) & PLL_CONTROL_DIG_TEST_CLK_MASK) >> PLL_CONTROL_DIG_TEST_CLK_LSB) -#define PLL_CONTROL_DIG_TEST_CLK_SET(x) (((x) << PLL_CONTROL_DIG_TEST_CLK_LSB) & PLL_CONTROL_DIG_TEST_CLK_MASK) -#define PLL_CONTROL_MAC_OVERRIDE_MSB 19 -#define PLL_CONTROL_MAC_OVERRIDE_LSB 19 -#define PLL_CONTROL_MAC_OVERRIDE_MASK 0x00080000 -#define PLL_CONTROL_MAC_OVERRIDE_GET(x) (((x) & PLL_CONTROL_MAC_OVERRIDE_MASK) >> PLL_CONTROL_MAC_OVERRIDE_LSB) -#define PLL_CONTROL_MAC_OVERRIDE_SET(x) (((x) << PLL_CONTROL_MAC_OVERRIDE_LSB) & PLL_CONTROL_MAC_OVERRIDE_MASK) -#define PLL_CONTROL_NOPWD_MSB 18 -#define PLL_CONTROL_NOPWD_LSB 18 -#define PLL_CONTROL_NOPWD_MASK 0x00040000 -#define PLL_CONTROL_NOPWD_GET(x) (((x) & PLL_CONTROL_NOPWD_MASK) >> PLL_CONTROL_NOPWD_LSB) -#define PLL_CONTROL_NOPWD_SET(x) (((x) << PLL_CONTROL_NOPWD_LSB) & PLL_CONTROL_NOPWD_MASK) -#define PLL_CONTROL_UPDATING_MSB 17 -#define PLL_CONTROL_UPDATING_LSB 17 -#define PLL_CONTROL_UPDATING_MASK 0x00020000 -#define PLL_CONTROL_UPDATING_GET(x) (((x) & PLL_CONTROL_UPDATING_MASK) >> PLL_CONTROL_UPDATING_LSB) -#define PLL_CONTROL_UPDATING_SET(x) (((x) << PLL_CONTROL_UPDATING_LSB) & PLL_CONTROL_UPDATING_MASK) -#define PLL_CONTROL_BYPASS_MSB 16 -#define PLL_CONTROL_BYPASS_LSB 16 -#define PLL_CONTROL_BYPASS_MASK 0x00010000 -#define PLL_CONTROL_BYPASS_GET(x) (((x) & PLL_CONTROL_BYPASS_MASK) >> PLL_CONTROL_BYPASS_LSB) -#define PLL_CONTROL_BYPASS_SET(x) (((x) << PLL_CONTROL_BYPASS_LSB) & PLL_CONTROL_BYPASS_MASK) -#define PLL_CONTROL_REFDIV_MSB 15 -#define PLL_CONTROL_REFDIV_LSB 12 -#define PLL_CONTROL_REFDIV_MASK 0x0000f000 -#define PLL_CONTROL_REFDIV_GET(x) (((x) & PLL_CONTROL_REFDIV_MASK) >> PLL_CONTROL_REFDIV_LSB) -#define PLL_CONTROL_REFDIV_SET(x) (((x) << PLL_CONTROL_REFDIV_LSB) & PLL_CONTROL_REFDIV_MASK) -#define PLL_CONTROL_DIV_MSB 9 -#define PLL_CONTROL_DIV_LSB 0 -#define PLL_CONTROL_DIV_MASK 0x000003ff -#define PLL_CONTROL_DIV_GET(x) (((x) & PLL_CONTROL_DIV_MASK) >> PLL_CONTROL_DIV_LSB) -#define PLL_CONTROL_DIV_SET(x) (((x) << PLL_CONTROL_DIV_LSB) & PLL_CONTROL_DIV_MASK) - -#define PLL_SETTLE_ADDRESS 0x00000018 -#define PLL_SETTLE_OFFSET 0x00000018 -#define PLL_SETTLE_TIME_MSB 11 -#define PLL_SETTLE_TIME_LSB 0 -#define PLL_SETTLE_TIME_MASK 0x00000fff -#define PLL_SETTLE_TIME_GET(x) (((x) & PLL_SETTLE_TIME_MASK) >> PLL_SETTLE_TIME_LSB) -#define PLL_SETTLE_TIME_SET(x) (((x) << PLL_SETTLE_TIME_LSB) & PLL_SETTLE_TIME_MASK) - -#define XTAL_SETTLE_ADDRESS 0x0000001c -#define XTAL_SETTLE_OFFSET 0x0000001c -#define XTAL_SETTLE_TIME_MSB 7 -#define XTAL_SETTLE_TIME_LSB 0 -#define XTAL_SETTLE_TIME_MASK 0x000000ff -#define XTAL_SETTLE_TIME_GET(x) (((x) & XTAL_SETTLE_TIME_MASK) >> XTAL_SETTLE_TIME_LSB) -#define XTAL_SETTLE_TIME_SET(x) (((x) << XTAL_SETTLE_TIME_LSB) & XTAL_SETTLE_TIME_MASK) - -#define CPU_CLOCK_ADDRESS 0x00000020 -#define CPU_CLOCK_OFFSET 0x00000020 -#define CPU_CLOCK_STANDARD_MSB 1 -#define CPU_CLOCK_STANDARD_LSB 0 -#define CPU_CLOCK_STANDARD_MASK 0x00000003 -#define CPU_CLOCK_STANDARD_GET(x) (((x) & CPU_CLOCK_STANDARD_MASK) >> CPU_CLOCK_STANDARD_LSB) -#define CPU_CLOCK_STANDARD_SET(x) (((x) << CPU_CLOCK_STANDARD_LSB) & CPU_CLOCK_STANDARD_MASK) - -#define CLOCK_OUT_ADDRESS 0x00000024 -#define CLOCK_OUT_OFFSET 0x00000024 -#define CLOCK_OUT_SELECT_MSB 3 -#define CLOCK_OUT_SELECT_LSB 0 -#define CLOCK_OUT_SELECT_MASK 0x0000000f -#define CLOCK_OUT_SELECT_GET(x) (((x) & CLOCK_OUT_SELECT_MASK) >> CLOCK_OUT_SELECT_LSB) -#define CLOCK_OUT_SELECT_SET(x) (((x) << CLOCK_OUT_SELECT_LSB) & CLOCK_OUT_SELECT_MASK) - -#define CLOCK_CONTROL_ADDRESS 0x00000028 -#define CLOCK_CONTROL_OFFSET 0x00000028 -#define CLOCK_CONTROL_LF_CLK32_MSB 2 -#define CLOCK_CONTROL_LF_CLK32_LSB 2 -#define CLOCK_CONTROL_LF_CLK32_MASK 0x00000004 -#define CLOCK_CONTROL_LF_CLK32_GET(x) (((x) & CLOCK_CONTROL_LF_CLK32_MASK) >> CLOCK_CONTROL_LF_CLK32_LSB) -#define CLOCK_CONTROL_LF_CLK32_SET(x) (((x) << CLOCK_CONTROL_LF_CLK32_LSB) & CLOCK_CONTROL_LF_CLK32_MASK) -#define CLOCK_CONTROL_UART_CLK_MSB 1 -#define CLOCK_CONTROL_UART_CLK_LSB 1 -#define CLOCK_CONTROL_UART_CLK_MASK 0x00000002 -#define CLOCK_CONTROL_UART_CLK_GET(x) (((x) & CLOCK_CONTROL_UART_CLK_MASK) >> CLOCK_CONTROL_UART_CLK_LSB) -#define CLOCK_CONTROL_UART_CLK_SET(x) (((x) << CLOCK_CONTROL_UART_CLK_LSB) & CLOCK_CONTROL_UART_CLK_MASK) -#define CLOCK_CONTROL_SI0_CLK_MSB 0 -#define CLOCK_CONTROL_SI0_CLK_LSB 0 -#define CLOCK_CONTROL_SI0_CLK_MASK 0x00000001 -#define CLOCK_CONTROL_SI0_CLK_GET(x) (((x) & CLOCK_CONTROL_SI0_CLK_MASK) >> CLOCK_CONTROL_SI0_CLK_LSB) -#define CLOCK_CONTROL_SI0_CLK_SET(x) (((x) << CLOCK_CONTROL_SI0_CLK_LSB) & CLOCK_CONTROL_SI0_CLK_MASK) - -#define BIAS_OVERRIDE_ADDRESS 0x0000002c -#define BIAS_OVERRIDE_OFFSET 0x0000002c -#define BIAS_OVERRIDE_ON_MSB 0 -#define BIAS_OVERRIDE_ON_LSB 0 -#define BIAS_OVERRIDE_ON_MASK 0x00000001 -#define BIAS_OVERRIDE_ON_GET(x) (((x) & BIAS_OVERRIDE_ON_MASK) >> BIAS_OVERRIDE_ON_LSB) -#define BIAS_OVERRIDE_ON_SET(x) (((x) << BIAS_OVERRIDE_ON_LSB) & BIAS_OVERRIDE_ON_MASK) - -#define WDT_CONTROL_ADDRESS 0x00000030 -#define WDT_CONTROL_OFFSET 0x00000030 -#define WDT_CONTROL_ACTION_MSB 2 -#define WDT_CONTROL_ACTION_LSB 0 -#define WDT_CONTROL_ACTION_MASK 0x00000007 -#define WDT_CONTROL_ACTION_GET(x) (((x) & WDT_CONTROL_ACTION_MASK) >> WDT_CONTROL_ACTION_LSB) -#define WDT_CONTROL_ACTION_SET(x) (((x) << WDT_CONTROL_ACTION_LSB) & WDT_CONTROL_ACTION_MASK) - -#define WDT_STATUS_ADDRESS 0x00000034 -#define WDT_STATUS_OFFSET 0x00000034 -#define WDT_STATUS_INTERRUPT_MSB 0 -#define WDT_STATUS_INTERRUPT_LSB 0 -#define WDT_STATUS_INTERRUPT_MASK 0x00000001 -#define WDT_STATUS_INTERRUPT_GET(x) (((x) & WDT_STATUS_INTERRUPT_MASK) >> WDT_STATUS_INTERRUPT_LSB) -#define WDT_STATUS_INTERRUPT_SET(x) (((x) << WDT_STATUS_INTERRUPT_LSB) & WDT_STATUS_INTERRUPT_MASK) - -#define WDT_ADDRESS 0x00000038 -#define WDT_OFFSET 0x00000038 -#define WDT_TARGET_MSB 21 -#define WDT_TARGET_LSB 0 -#define WDT_TARGET_MASK 0x003fffff -#define WDT_TARGET_GET(x) (((x) & WDT_TARGET_MASK) >> WDT_TARGET_LSB) -#define WDT_TARGET_SET(x) (((x) << WDT_TARGET_LSB) & WDT_TARGET_MASK) - -#define WDT_COUNT_ADDRESS 0x0000003c -#define WDT_COUNT_OFFSET 0x0000003c -#define WDT_COUNT_VALUE_MSB 21 -#define WDT_COUNT_VALUE_LSB 0 -#define WDT_COUNT_VALUE_MASK 0x003fffff -#define WDT_COUNT_VALUE_GET(x) (((x) & WDT_COUNT_VALUE_MASK) >> WDT_COUNT_VALUE_LSB) -#define WDT_COUNT_VALUE_SET(x) (((x) << WDT_COUNT_VALUE_LSB) & WDT_COUNT_VALUE_MASK) - -#define WDT_RESET_ADDRESS 0x00000040 -#define WDT_RESET_OFFSET 0x00000040 -#define WDT_RESET_VALUE_MSB 0 -#define WDT_RESET_VALUE_LSB 0 -#define WDT_RESET_VALUE_MASK 0x00000001 -#define WDT_RESET_VALUE_GET(x) (((x) & WDT_RESET_VALUE_MASK) >> WDT_RESET_VALUE_LSB) -#define WDT_RESET_VALUE_SET(x) (((x) << WDT_RESET_VALUE_LSB) & WDT_RESET_VALUE_MASK) - -#define INT_STATUS_ADDRESS 0x00000044 -#define INT_STATUS_OFFSET 0x00000044 -#define INT_STATUS_RTC_POWER_MSB 14 -#define INT_STATUS_RTC_POWER_LSB 14 -#define INT_STATUS_RTC_POWER_MASK 0x00004000 -#define INT_STATUS_RTC_POWER_GET(x) (((x) & INT_STATUS_RTC_POWER_MASK) >> INT_STATUS_RTC_POWER_LSB) -#define INT_STATUS_RTC_POWER_SET(x) (((x) << INT_STATUS_RTC_POWER_LSB) & INT_STATUS_RTC_POWER_MASK) -#define INT_STATUS_MAC_MSB 13 -#define INT_STATUS_MAC_LSB 13 -#define INT_STATUS_MAC_MASK 0x00002000 -#define INT_STATUS_MAC_GET(x) (((x) & INT_STATUS_MAC_MASK) >> INT_STATUS_MAC_LSB) -#define INT_STATUS_MAC_SET(x) (((x) << INT_STATUS_MAC_LSB) & INT_STATUS_MAC_MASK) -#define INT_STATUS_MAILBOX_MSB 12 -#define INT_STATUS_MAILBOX_LSB 12 -#define INT_STATUS_MAILBOX_MASK 0x00001000 -#define INT_STATUS_MAILBOX_GET(x) (((x) & INT_STATUS_MAILBOX_MASK) >> INT_STATUS_MAILBOX_LSB) -#define INT_STATUS_MAILBOX_SET(x) (((x) << INT_STATUS_MAILBOX_LSB) & INT_STATUS_MAILBOX_MASK) -#define INT_STATUS_RTC_ALARM_MSB 11 -#define INT_STATUS_RTC_ALARM_LSB 11 -#define INT_STATUS_RTC_ALARM_MASK 0x00000800 -#define INT_STATUS_RTC_ALARM_GET(x) (((x) & INT_STATUS_RTC_ALARM_MASK) >> INT_STATUS_RTC_ALARM_LSB) -#define INT_STATUS_RTC_ALARM_SET(x) (((x) << INT_STATUS_RTC_ALARM_LSB) & INT_STATUS_RTC_ALARM_MASK) -#define INT_STATUS_HF_TIMER_MSB 10 -#define INT_STATUS_HF_TIMER_LSB 10 -#define INT_STATUS_HF_TIMER_MASK 0x00000400 -#define INT_STATUS_HF_TIMER_GET(x) (((x) & INT_STATUS_HF_TIMER_MASK) >> INT_STATUS_HF_TIMER_LSB) -#define INT_STATUS_HF_TIMER_SET(x) (((x) << INT_STATUS_HF_TIMER_LSB) & INT_STATUS_HF_TIMER_MASK) -#define INT_STATUS_LF_TIMER3_MSB 9 -#define INT_STATUS_LF_TIMER3_LSB 9 -#define INT_STATUS_LF_TIMER3_MASK 0x00000200 -#define INT_STATUS_LF_TIMER3_GET(x) (((x) & INT_STATUS_LF_TIMER3_MASK) >> INT_STATUS_LF_TIMER3_LSB) -#define INT_STATUS_LF_TIMER3_SET(x) (((x) << INT_STATUS_LF_TIMER3_LSB) & INT_STATUS_LF_TIMER3_MASK) -#define INT_STATUS_LF_TIMER2_MSB 8 -#define INT_STATUS_LF_TIMER2_LSB 8 -#define INT_STATUS_LF_TIMER2_MASK 0x00000100 -#define INT_STATUS_LF_TIMER2_GET(x) (((x) & INT_STATUS_LF_TIMER2_MASK) >> INT_STATUS_LF_TIMER2_LSB) -#define INT_STATUS_LF_TIMER2_SET(x) (((x) << INT_STATUS_LF_TIMER2_LSB) & INT_STATUS_LF_TIMER2_MASK) -#define INT_STATUS_LF_TIMER1_MSB 7 -#define INT_STATUS_LF_TIMER1_LSB 7 -#define INT_STATUS_LF_TIMER1_MASK 0x00000080 -#define INT_STATUS_LF_TIMER1_GET(x) (((x) & INT_STATUS_LF_TIMER1_MASK) >> INT_STATUS_LF_TIMER1_LSB) -#define INT_STATUS_LF_TIMER1_SET(x) (((x) << INT_STATUS_LF_TIMER1_LSB) & INT_STATUS_LF_TIMER1_MASK) -#define INT_STATUS_LF_TIMER0_MSB 6 -#define INT_STATUS_LF_TIMER0_LSB 6 -#define INT_STATUS_LF_TIMER0_MASK 0x00000040 -#define INT_STATUS_LF_TIMER0_GET(x) (((x) & INT_STATUS_LF_TIMER0_MASK) >> INT_STATUS_LF_TIMER0_LSB) -#define INT_STATUS_LF_TIMER0_SET(x) (((x) << INT_STATUS_LF_TIMER0_LSB) & INT_STATUS_LF_TIMER0_MASK) -#define INT_STATUS_KEYPAD_MSB 5 -#define INT_STATUS_KEYPAD_LSB 5 -#define INT_STATUS_KEYPAD_MASK 0x00000020 -#define INT_STATUS_KEYPAD_GET(x) (((x) & INT_STATUS_KEYPAD_MASK) >> INT_STATUS_KEYPAD_LSB) -#define INT_STATUS_KEYPAD_SET(x) (((x) << INT_STATUS_KEYPAD_LSB) & INT_STATUS_KEYPAD_MASK) -#define INT_STATUS_SI_MSB 4 -#define INT_STATUS_SI_LSB 4 -#define INT_STATUS_SI_MASK 0x00000010 -#define INT_STATUS_SI_GET(x) (((x) & INT_STATUS_SI_MASK) >> INT_STATUS_SI_LSB) -#define INT_STATUS_SI_SET(x) (((x) << INT_STATUS_SI_LSB) & INT_STATUS_SI_MASK) -#define INT_STATUS_GPIO_MSB 3 -#define INT_STATUS_GPIO_LSB 3 -#define INT_STATUS_GPIO_MASK 0x00000008 -#define INT_STATUS_GPIO_GET(x) (((x) & INT_STATUS_GPIO_MASK) >> INT_STATUS_GPIO_LSB) -#define INT_STATUS_GPIO_SET(x) (((x) << INT_STATUS_GPIO_LSB) & INT_STATUS_GPIO_MASK) -#define INT_STATUS_UART_MSB 2 -#define INT_STATUS_UART_LSB 2 -#define INT_STATUS_UART_MASK 0x00000004 -#define INT_STATUS_UART_GET(x) (((x) & INT_STATUS_UART_MASK) >> INT_STATUS_UART_LSB) -#define INT_STATUS_UART_SET(x) (((x) << INT_STATUS_UART_LSB) & INT_STATUS_UART_MASK) -#define INT_STATUS_ERROR_MSB 1 -#define INT_STATUS_ERROR_LSB 1 -#define INT_STATUS_ERROR_MASK 0x00000002 -#define INT_STATUS_ERROR_GET(x) (((x) & INT_STATUS_ERROR_MASK) >> INT_STATUS_ERROR_LSB) -#define INT_STATUS_ERROR_SET(x) (((x) << INT_STATUS_ERROR_LSB) & INT_STATUS_ERROR_MASK) -#define INT_STATUS_WDT_INT_MSB 0 -#define INT_STATUS_WDT_INT_LSB 0 -#define INT_STATUS_WDT_INT_MASK 0x00000001 -#define INT_STATUS_WDT_INT_GET(x) (((x) & INT_STATUS_WDT_INT_MASK) >> INT_STATUS_WDT_INT_LSB) -#define INT_STATUS_WDT_INT_SET(x) (((x) << INT_STATUS_WDT_INT_LSB) & INT_STATUS_WDT_INT_MASK) - -#define LF_TIMER0_ADDRESS 0x00000048 -#define LF_TIMER0_OFFSET 0x00000048 -#define LF_TIMER0_TARGET_MSB 31 -#define LF_TIMER0_TARGET_LSB 0 -#define LF_TIMER0_TARGET_MASK 0xffffffff -#define LF_TIMER0_TARGET_GET(x) (((x) & LF_TIMER0_TARGET_MASK) >> LF_TIMER0_TARGET_LSB) -#define LF_TIMER0_TARGET_SET(x) (((x) << LF_TIMER0_TARGET_LSB) & LF_TIMER0_TARGET_MASK) - -#define LF_TIMER_COUNT0_ADDRESS 0x0000004c -#define LF_TIMER_COUNT0_OFFSET 0x0000004c -#define LF_TIMER_COUNT0_VALUE_MSB 31 -#define LF_TIMER_COUNT0_VALUE_LSB 0 -#define LF_TIMER_COUNT0_VALUE_MASK 0xffffffff -#define LF_TIMER_COUNT0_VALUE_GET(x) (((x) & LF_TIMER_COUNT0_VALUE_MASK) >> LF_TIMER_COUNT0_VALUE_LSB) -#define LF_TIMER_COUNT0_VALUE_SET(x) (((x) << LF_TIMER_COUNT0_VALUE_LSB) & LF_TIMER_COUNT0_VALUE_MASK) - -#define LF_TIMER_CONTROL0_ADDRESS 0x00000050 -#define LF_TIMER_CONTROL0_OFFSET 0x00000050 -#define LF_TIMER_CONTROL0_ENABLE_MSB 2 -#define LF_TIMER_CONTROL0_ENABLE_LSB 2 -#define LF_TIMER_CONTROL0_ENABLE_MASK 0x00000004 -#define LF_TIMER_CONTROL0_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL0_ENABLE_MASK) >> LF_TIMER_CONTROL0_ENABLE_LSB) -#define LF_TIMER_CONTROL0_ENABLE_SET(x) (((x) << LF_TIMER_CONTROL0_ENABLE_LSB) & LF_TIMER_CONTROL0_ENABLE_MASK) -#define LF_TIMER_CONTROL0_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL0_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL0_AUTO_RESTART_MASK 0x00000002 -#define LF_TIMER_CONTROL0_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL0_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL0_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL0_AUTO_RESTART_SET(x) (((x) << LF_TIMER_CONTROL0_AUTO_RESTART_LSB) & LF_TIMER_CONTROL0_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL0_RESET_MSB 0 -#define LF_TIMER_CONTROL0_RESET_LSB 0 -#define LF_TIMER_CONTROL0_RESET_MASK 0x00000001 -#define LF_TIMER_CONTROL0_RESET_GET(x) (((x) & LF_TIMER_CONTROL0_RESET_MASK) >> LF_TIMER_CONTROL0_RESET_LSB) -#define LF_TIMER_CONTROL0_RESET_SET(x) (((x) << LF_TIMER_CONTROL0_RESET_LSB) & LF_TIMER_CONTROL0_RESET_MASK) - -#define LF_TIMER_STATUS0_ADDRESS 0x00000054 -#define LF_TIMER_STATUS0_OFFSET 0x00000054 -#define LF_TIMER_STATUS0_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS0_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS0_INTERRUPT_MASK 0x00000001 -#define LF_TIMER_STATUS0_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS0_INTERRUPT_MASK) >> LF_TIMER_STATUS0_INTERRUPT_LSB) -#define LF_TIMER_STATUS0_INTERRUPT_SET(x) (((x) << LF_TIMER_STATUS0_INTERRUPT_LSB) & LF_TIMER_STATUS0_INTERRUPT_MASK) - -#define LF_TIMER1_ADDRESS 0x00000058 -#define LF_TIMER1_OFFSET 0x00000058 -#define LF_TIMER1_TARGET_MSB 31 -#define LF_TIMER1_TARGET_LSB 0 -#define LF_TIMER1_TARGET_MASK 0xffffffff -#define LF_TIMER1_TARGET_GET(x) (((x) & LF_TIMER1_TARGET_MASK) >> LF_TIMER1_TARGET_LSB) -#define LF_TIMER1_TARGET_SET(x) (((x) << LF_TIMER1_TARGET_LSB) & LF_TIMER1_TARGET_MASK) - -#define LF_TIMER_COUNT1_ADDRESS 0x0000005c -#define LF_TIMER_COUNT1_OFFSET 0x0000005c -#define LF_TIMER_COUNT1_VALUE_MSB 31 -#define LF_TIMER_COUNT1_VALUE_LSB 0 -#define LF_TIMER_COUNT1_VALUE_MASK 0xffffffff -#define LF_TIMER_COUNT1_VALUE_GET(x) (((x) & LF_TIMER_COUNT1_VALUE_MASK) >> LF_TIMER_COUNT1_VALUE_LSB) -#define LF_TIMER_COUNT1_VALUE_SET(x) (((x) << LF_TIMER_COUNT1_VALUE_LSB) & LF_TIMER_COUNT1_VALUE_MASK) - -#define LF_TIMER_CONTROL1_ADDRESS 0x00000060 -#define LF_TIMER_CONTROL1_OFFSET 0x00000060 -#define LF_TIMER_CONTROL1_ENABLE_MSB 2 -#define LF_TIMER_CONTROL1_ENABLE_LSB 2 -#define LF_TIMER_CONTROL1_ENABLE_MASK 0x00000004 -#define LF_TIMER_CONTROL1_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL1_ENABLE_MASK) >> LF_TIMER_CONTROL1_ENABLE_LSB) -#define LF_TIMER_CONTROL1_ENABLE_SET(x) (((x) << LF_TIMER_CONTROL1_ENABLE_LSB) & LF_TIMER_CONTROL1_ENABLE_MASK) -#define LF_TIMER_CONTROL1_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL1_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL1_AUTO_RESTART_MASK 0x00000002 -#define LF_TIMER_CONTROL1_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL1_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL1_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL1_AUTO_RESTART_SET(x) (((x) << LF_TIMER_CONTROL1_AUTO_RESTART_LSB) & LF_TIMER_CONTROL1_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL1_RESET_MSB 0 -#define LF_TIMER_CONTROL1_RESET_LSB 0 -#define LF_TIMER_CONTROL1_RESET_MASK 0x00000001 -#define LF_TIMER_CONTROL1_RESET_GET(x) (((x) & LF_TIMER_CONTROL1_RESET_MASK) >> LF_TIMER_CONTROL1_RESET_LSB) -#define LF_TIMER_CONTROL1_RESET_SET(x) (((x) << LF_TIMER_CONTROL1_RESET_LSB) & LF_TIMER_CONTROL1_RESET_MASK) - -#define LF_TIMER_STATUS1_ADDRESS 0x00000064 -#define LF_TIMER_STATUS1_OFFSET 0x00000064 -#define LF_TIMER_STATUS1_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS1_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS1_INTERRUPT_MASK 0x00000001 -#define LF_TIMER_STATUS1_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS1_INTERRUPT_MASK) >> LF_TIMER_STATUS1_INTERRUPT_LSB) -#define LF_TIMER_STATUS1_INTERRUPT_SET(x) (((x) << LF_TIMER_STATUS1_INTERRUPT_LSB) & LF_TIMER_STATUS1_INTERRUPT_MASK) - -#define LF_TIMER2_ADDRESS 0x00000068 -#define LF_TIMER2_OFFSET 0x00000068 -#define LF_TIMER2_TARGET_MSB 31 -#define LF_TIMER2_TARGET_LSB 0 -#define LF_TIMER2_TARGET_MASK 0xffffffff -#define LF_TIMER2_TARGET_GET(x) (((x) & LF_TIMER2_TARGET_MASK) >> LF_TIMER2_TARGET_LSB) -#define LF_TIMER2_TARGET_SET(x) (((x) << LF_TIMER2_TARGET_LSB) & LF_TIMER2_TARGET_MASK) - -#define LF_TIMER_COUNT2_ADDRESS 0x0000006c -#define LF_TIMER_COUNT2_OFFSET 0x0000006c -#define LF_TIMER_COUNT2_VALUE_MSB 31 -#define LF_TIMER_COUNT2_VALUE_LSB 0 -#define LF_TIMER_COUNT2_VALUE_MASK 0xffffffff -#define LF_TIMER_COUNT2_VALUE_GET(x) (((x) & LF_TIMER_COUNT2_VALUE_MASK) >> LF_TIMER_COUNT2_VALUE_LSB) -#define LF_TIMER_COUNT2_VALUE_SET(x) (((x) << LF_TIMER_COUNT2_VALUE_LSB) & LF_TIMER_COUNT2_VALUE_MASK) - -#define LF_TIMER_CONTROL2_ADDRESS 0x00000070 -#define LF_TIMER_CONTROL2_OFFSET 0x00000070 -#define LF_TIMER_CONTROL2_ENABLE_MSB 2 -#define LF_TIMER_CONTROL2_ENABLE_LSB 2 -#define LF_TIMER_CONTROL2_ENABLE_MASK 0x00000004 -#define LF_TIMER_CONTROL2_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL2_ENABLE_MASK) >> LF_TIMER_CONTROL2_ENABLE_LSB) -#define LF_TIMER_CONTROL2_ENABLE_SET(x) (((x) << LF_TIMER_CONTROL2_ENABLE_LSB) & LF_TIMER_CONTROL2_ENABLE_MASK) -#define LF_TIMER_CONTROL2_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL2_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL2_AUTO_RESTART_MASK 0x00000002 -#define LF_TIMER_CONTROL2_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL2_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL2_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL2_AUTO_RESTART_SET(x) (((x) << LF_TIMER_CONTROL2_AUTO_RESTART_LSB) & LF_TIMER_CONTROL2_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL2_RESET_MSB 0 -#define LF_TIMER_CONTROL2_RESET_LSB 0 -#define LF_TIMER_CONTROL2_RESET_MASK 0x00000001 -#define LF_TIMER_CONTROL2_RESET_GET(x) (((x) & LF_TIMER_CONTROL2_RESET_MASK) >> LF_TIMER_CONTROL2_RESET_LSB) -#define LF_TIMER_CONTROL2_RESET_SET(x) (((x) << LF_TIMER_CONTROL2_RESET_LSB) & LF_TIMER_CONTROL2_RESET_MASK) - -#define LF_TIMER_STATUS2_ADDRESS 0x00000074 -#define LF_TIMER_STATUS2_OFFSET 0x00000074 -#define LF_TIMER_STATUS2_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS2_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS2_INTERRUPT_MASK 0x00000001 -#define LF_TIMER_STATUS2_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS2_INTERRUPT_MASK) >> LF_TIMER_STATUS2_INTERRUPT_LSB) -#define LF_TIMER_STATUS2_INTERRUPT_SET(x) (((x) << LF_TIMER_STATUS2_INTERRUPT_LSB) & LF_TIMER_STATUS2_INTERRUPT_MASK) - -#define LF_TIMER3_ADDRESS 0x00000078 -#define LF_TIMER3_OFFSET 0x00000078 -#define LF_TIMER3_TARGET_MSB 31 -#define LF_TIMER3_TARGET_LSB 0 -#define LF_TIMER3_TARGET_MASK 0xffffffff -#define LF_TIMER3_TARGET_GET(x) (((x) & LF_TIMER3_TARGET_MASK) >> LF_TIMER3_TARGET_LSB) -#define LF_TIMER3_TARGET_SET(x) (((x) << LF_TIMER3_TARGET_LSB) & LF_TIMER3_TARGET_MASK) - -#define LF_TIMER_COUNT3_ADDRESS 0x0000007c -#define LF_TIMER_COUNT3_OFFSET 0x0000007c -#define LF_TIMER_COUNT3_VALUE_MSB 31 -#define LF_TIMER_COUNT3_VALUE_LSB 0 -#define LF_TIMER_COUNT3_VALUE_MASK 0xffffffff -#define LF_TIMER_COUNT3_VALUE_GET(x) (((x) & LF_TIMER_COUNT3_VALUE_MASK) >> LF_TIMER_COUNT3_VALUE_LSB) -#define LF_TIMER_COUNT3_VALUE_SET(x) (((x) << LF_TIMER_COUNT3_VALUE_LSB) & LF_TIMER_COUNT3_VALUE_MASK) - -#define LF_TIMER_CONTROL3_ADDRESS 0x00000080 -#define LF_TIMER_CONTROL3_OFFSET 0x00000080 -#define LF_TIMER_CONTROL3_ENABLE_MSB 2 -#define LF_TIMER_CONTROL3_ENABLE_LSB 2 -#define LF_TIMER_CONTROL3_ENABLE_MASK 0x00000004 -#define LF_TIMER_CONTROL3_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL3_ENABLE_MASK) >> LF_TIMER_CONTROL3_ENABLE_LSB) -#define LF_TIMER_CONTROL3_ENABLE_SET(x) (((x) << LF_TIMER_CONTROL3_ENABLE_LSB) & LF_TIMER_CONTROL3_ENABLE_MASK) -#define LF_TIMER_CONTROL3_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL3_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL3_AUTO_RESTART_MASK 0x00000002 -#define LF_TIMER_CONTROL3_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL3_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL3_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL3_AUTO_RESTART_SET(x) (((x) << LF_TIMER_CONTROL3_AUTO_RESTART_LSB) & LF_TIMER_CONTROL3_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL3_RESET_MSB 0 -#define LF_TIMER_CONTROL3_RESET_LSB 0 -#define LF_TIMER_CONTROL3_RESET_MASK 0x00000001 -#define LF_TIMER_CONTROL3_RESET_GET(x) (((x) & LF_TIMER_CONTROL3_RESET_MASK) >> LF_TIMER_CONTROL3_RESET_LSB) -#define LF_TIMER_CONTROL3_RESET_SET(x) (((x) << LF_TIMER_CONTROL3_RESET_LSB) & LF_TIMER_CONTROL3_RESET_MASK) - -#define LF_TIMER_STATUS3_ADDRESS 0x00000084 -#define LF_TIMER_STATUS3_OFFSET 0x00000084 -#define LF_TIMER_STATUS3_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS3_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS3_INTERRUPT_MASK 0x00000001 -#define LF_TIMER_STATUS3_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS3_INTERRUPT_MASK) >> LF_TIMER_STATUS3_INTERRUPT_LSB) -#define LF_TIMER_STATUS3_INTERRUPT_SET(x) (((x) << LF_TIMER_STATUS3_INTERRUPT_LSB) & LF_TIMER_STATUS3_INTERRUPT_MASK) - -#define HF_TIMER_ADDRESS 0x00000088 -#define HF_TIMER_OFFSET 0x00000088 -#define HF_TIMER_TARGET_MSB 31 -#define HF_TIMER_TARGET_LSB 12 -#define HF_TIMER_TARGET_MASK 0xfffff000 -#define HF_TIMER_TARGET_GET(x) (((x) & HF_TIMER_TARGET_MASK) >> HF_TIMER_TARGET_LSB) -#define HF_TIMER_TARGET_SET(x) (((x) << HF_TIMER_TARGET_LSB) & HF_TIMER_TARGET_MASK) - -#define HF_TIMER_COUNT_ADDRESS 0x0000008c -#define HF_TIMER_COUNT_OFFSET 0x0000008c -#define HF_TIMER_COUNT_VALUE_MSB 31 -#define HF_TIMER_COUNT_VALUE_LSB 12 -#define HF_TIMER_COUNT_VALUE_MASK 0xfffff000 -#define HF_TIMER_COUNT_VALUE_GET(x) (((x) & HF_TIMER_COUNT_VALUE_MASK) >> HF_TIMER_COUNT_VALUE_LSB) -#define HF_TIMER_COUNT_VALUE_SET(x) (((x) << HF_TIMER_COUNT_VALUE_LSB) & HF_TIMER_COUNT_VALUE_MASK) - -#define HF_LF_COUNT_ADDRESS 0x00000090 -#define HF_LF_COUNT_OFFSET 0x00000090 -#define HF_LF_COUNT_VALUE_MSB 31 -#define HF_LF_COUNT_VALUE_LSB 0 -#define HF_LF_COUNT_VALUE_MASK 0xffffffff -#define HF_LF_COUNT_VALUE_GET(x) (((x) & HF_LF_COUNT_VALUE_MASK) >> HF_LF_COUNT_VALUE_LSB) -#define HF_LF_COUNT_VALUE_SET(x) (((x) << HF_LF_COUNT_VALUE_LSB) & HF_LF_COUNT_VALUE_MASK) - -#define HF_TIMER_CONTROL_ADDRESS 0x00000094 -#define HF_TIMER_CONTROL_OFFSET 0x00000094 -#define HF_TIMER_CONTROL_ENABLE_MSB 3 -#define HF_TIMER_CONTROL_ENABLE_LSB 3 -#define HF_TIMER_CONTROL_ENABLE_MASK 0x00000008 -#define HF_TIMER_CONTROL_ENABLE_GET(x) (((x) & HF_TIMER_CONTROL_ENABLE_MASK) >> HF_TIMER_CONTROL_ENABLE_LSB) -#define HF_TIMER_CONTROL_ENABLE_SET(x) (((x) << HF_TIMER_CONTROL_ENABLE_LSB) & HF_TIMER_CONTROL_ENABLE_MASK) -#define HF_TIMER_CONTROL_ON_MSB 2 -#define HF_TIMER_CONTROL_ON_LSB 2 -#define HF_TIMER_CONTROL_ON_MASK 0x00000004 -#define HF_TIMER_CONTROL_ON_GET(x) (((x) & HF_TIMER_CONTROL_ON_MASK) >> HF_TIMER_CONTROL_ON_LSB) -#define HF_TIMER_CONTROL_ON_SET(x) (((x) << HF_TIMER_CONTROL_ON_LSB) & HF_TIMER_CONTROL_ON_MASK) -#define HF_TIMER_CONTROL_AUTO_RESTART_MSB 1 -#define HF_TIMER_CONTROL_AUTO_RESTART_LSB 1 -#define HF_TIMER_CONTROL_AUTO_RESTART_MASK 0x00000002 -#define HF_TIMER_CONTROL_AUTO_RESTART_GET(x) (((x) & HF_TIMER_CONTROL_AUTO_RESTART_MASK) >> HF_TIMER_CONTROL_AUTO_RESTART_LSB) -#define HF_TIMER_CONTROL_AUTO_RESTART_SET(x) (((x) << HF_TIMER_CONTROL_AUTO_RESTART_LSB) & HF_TIMER_CONTROL_AUTO_RESTART_MASK) -#define HF_TIMER_CONTROL_RESET_MSB 0 -#define HF_TIMER_CONTROL_RESET_LSB 0 -#define HF_TIMER_CONTROL_RESET_MASK 0x00000001 -#define HF_TIMER_CONTROL_RESET_GET(x) (((x) & HF_TIMER_CONTROL_RESET_MASK) >> HF_TIMER_CONTROL_RESET_LSB) -#define HF_TIMER_CONTROL_RESET_SET(x) (((x) << HF_TIMER_CONTROL_RESET_LSB) & HF_TIMER_CONTROL_RESET_MASK) - -#define HF_TIMER_STATUS_ADDRESS 0x00000098 -#define HF_TIMER_STATUS_OFFSET 0x00000098 -#define HF_TIMER_STATUS_INTERRUPT_MSB 0 -#define HF_TIMER_STATUS_INTERRUPT_LSB 0 -#define HF_TIMER_STATUS_INTERRUPT_MASK 0x00000001 -#define HF_TIMER_STATUS_INTERRUPT_GET(x) (((x) & HF_TIMER_STATUS_INTERRUPT_MASK) >> HF_TIMER_STATUS_INTERRUPT_LSB) -#define HF_TIMER_STATUS_INTERRUPT_SET(x) (((x) << HF_TIMER_STATUS_INTERRUPT_LSB) & HF_TIMER_STATUS_INTERRUPT_MASK) - -#define RTC_CONTROL_ADDRESS 0x0000009c -#define RTC_CONTROL_OFFSET 0x0000009c -#define RTC_CONTROL_ENABLE_MSB 2 -#define RTC_CONTROL_ENABLE_LSB 2 -#define RTC_CONTROL_ENABLE_MASK 0x00000004 -#define RTC_CONTROL_ENABLE_GET(x) (((x) & RTC_CONTROL_ENABLE_MASK) >> RTC_CONTROL_ENABLE_LSB) -#define RTC_CONTROL_ENABLE_SET(x) (((x) << RTC_CONTROL_ENABLE_LSB) & RTC_CONTROL_ENABLE_MASK) -#define RTC_CONTROL_LOAD_RTC_MSB 1 -#define RTC_CONTROL_LOAD_RTC_LSB 1 -#define RTC_CONTROL_LOAD_RTC_MASK 0x00000002 -#define RTC_CONTROL_LOAD_RTC_GET(x) (((x) & RTC_CONTROL_LOAD_RTC_MASK) >> RTC_CONTROL_LOAD_RTC_LSB) -#define RTC_CONTROL_LOAD_RTC_SET(x) (((x) << RTC_CONTROL_LOAD_RTC_LSB) & RTC_CONTROL_LOAD_RTC_MASK) -#define RTC_CONTROL_LOAD_ALARM_MSB 0 -#define RTC_CONTROL_LOAD_ALARM_LSB 0 -#define RTC_CONTROL_LOAD_ALARM_MASK 0x00000001 -#define RTC_CONTROL_LOAD_ALARM_GET(x) (((x) & RTC_CONTROL_LOAD_ALARM_MASK) >> RTC_CONTROL_LOAD_ALARM_LSB) -#define RTC_CONTROL_LOAD_ALARM_SET(x) (((x) << RTC_CONTROL_LOAD_ALARM_LSB) & RTC_CONTROL_LOAD_ALARM_MASK) - -#define RTC_TIME_ADDRESS 0x000000a0 -#define RTC_TIME_OFFSET 0x000000a0 -#define RTC_TIME_WEEK_DAY_MSB 26 -#define RTC_TIME_WEEK_DAY_LSB 24 -#define RTC_TIME_WEEK_DAY_MASK 0x07000000 -#define RTC_TIME_WEEK_DAY_GET(x) (((x) & RTC_TIME_WEEK_DAY_MASK) >> RTC_TIME_WEEK_DAY_LSB) -#define RTC_TIME_WEEK_DAY_SET(x) (((x) << RTC_TIME_WEEK_DAY_LSB) & RTC_TIME_WEEK_DAY_MASK) -#define RTC_TIME_HOUR_MSB 21 -#define RTC_TIME_HOUR_LSB 16 -#define RTC_TIME_HOUR_MASK 0x003f0000 -#define RTC_TIME_HOUR_GET(x) (((x) & RTC_TIME_HOUR_MASK) >> RTC_TIME_HOUR_LSB) -#define RTC_TIME_HOUR_SET(x) (((x) << RTC_TIME_HOUR_LSB) & RTC_TIME_HOUR_MASK) -#define RTC_TIME_MINUTE_MSB 14 -#define RTC_TIME_MINUTE_LSB 8 -#define RTC_TIME_MINUTE_MASK 0x00007f00 -#define RTC_TIME_MINUTE_GET(x) (((x) & RTC_TIME_MINUTE_MASK) >> RTC_TIME_MINUTE_LSB) -#define RTC_TIME_MINUTE_SET(x) (((x) << RTC_TIME_MINUTE_LSB) & RTC_TIME_MINUTE_MASK) -#define RTC_TIME_SECOND_MSB 6 -#define RTC_TIME_SECOND_LSB 0 -#define RTC_TIME_SECOND_MASK 0x0000007f -#define RTC_TIME_SECOND_GET(x) (((x) & RTC_TIME_SECOND_MASK) >> RTC_TIME_SECOND_LSB) -#define RTC_TIME_SECOND_SET(x) (((x) << RTC_TIME_SECOND_LSB) & RTC_TIME_SECOND_MASK) - -#define RTC_DATE_ADDRESS 0x000000a4 -#define RTC_DATE_OFFSET 0x000000a4 -#define RTC_DATE_YEAR_MSB 23 -#define RTC_DATE_YEAR_LSB 16 -#define RTC_DATE_YEAR_MASK 0x00ff0000 -#define RTC_DATE_YEAR_GET(x) (((x) & RTC_DATE_YEAR_MASK) >> RTC_DATE_YEAR_LSB) -#define RTC_DATE_YEAR_SET(x) (((x) << RTC_DATE_YEAR_LSB) & RTC_DATE_YEAR_MASK) -#define RTC_DATE_MONTH_MSB 12 -#define RTC_DATE_MONTH_LSB 8 -#define RTC_DATE_MONTH_MASK 0x00001f00 -#define RTC_DATE_MONTH_GET(x) (((x) & RTC_DATE_MONTH_MASK) >> RTC_DATE_MONTH_LSB) -#define RTC_DATE_MONTH_SET(x) (((x) << RTC_DATE_MONTH_LSB) & RTC_DATE_MONTH_MASK) -#define RTC_DATE_MONTH_DAY_MSB 5 -#define RTC_DATE_MONTH_DAY_LSB 0 -#define RTC_DATE_MONTH_DAY_MASK 0x0000003f -#define RTC_DATE_MONTH_DAY_GET(x) (((x) & RTC_DATE_MONTH_DAY_MASK) >> RTC_DATE_MONTH_DAY_LSB) -#define RTC_DATE_MONTH_DAY_SET(x) (((x) << RTC_DATE_MONTH_DAY_LSB) & RTC_DATE_MONTH_DAY_MASK) - -#define RTC_SET_TIME_ADDRESS 0x000000a8 -#define RTC_SET_TIME_OFFSET 0x000000a8 -#define RTC_SET_TIME_WEEK_DAY_MSB 26 -#define RTC_SET_TIME_WEEK_DAY_LSB 24 -#define RTC_SET_TIME_WEEK_DAY_MASK 0x07000000 -#define RTC_SET_TIME_WEEK_DAY_GET(x) (((x) & RTC_SET_TIME_WEEK_DAY_MASK) >> RTC_SET_TIME_WEEK_DAY_LSB) -#define RTC_SET_TIME_WEEK_DAY_SET(x) (((x) << RTC_SET_TIME_WEEK_DAY_LSB) & RTC_SET_TIME_WEEK_DAY_MASK) -#define RTC_SET_TIME_HOUR_MSB 21 -#define RTC_SET_TIME_HOUR_LSB 16 -#define RTC_SET_TIME_HOUR_MASK 0x003f0000 -#define RTC_SET_TIME_HOUR_GET(x) (((x) & RTC_SET_TIME_HOUR_MASK) >> RTC_SET_TIME_HOUR_LSB) -#define RTC_SET_TIME_HOUR_SET(x) (((x) << RTC_SET_TIME_HOUR_LSB) & RTC_SET_TIME_HOUR_MASK) -#define RTC_SET_TIME_MINUTE_MSB 14 -#define RTC_SET_TIME_MINUTE_LSB 8 -#define RTC_SET_TIME_MINUTE_MASK 0x00007f00 -#define RTC_SET_TIME_MINUTE_GET(x) (((x) & RTC_SET_TIME_MINUTE_MASK) >> RTC_SET_TIME_MINUTE_LSB) -#define RTC_SET_TIME_MINUTE_SET(x) (((x) << RTC_SET_TIME_MINUTE_LSB) & RTC_SET_TIME_MINUTE_MASK) -#define RTC_SET_TIME_SECOND_MSB 6 -#define RTC_SET_TIME_SECOND_LSB 0 -#define RTC_SET_TIME_SECOND_MASK 0x0000007f -#define RTC_SET_TIME_SECOND_GET(x) (((x) & RTC_SET_TIME_SECOND_MASK) >> RTC_SET_TIME_SECOND_LSB) -#define RTC_SET_TIME_SECOND_SET(x) (((x) << RTC_SET_TIME_SECOND_LSB) & RTC_SET_TIME_SECOND_MASK) - -#define RTC_SET_DATE_ADDRESS 0x000000ac -#define RTC_SET_DATE_OFFSET 0x000000ac -#define RTC_SET_DATE_YEAR_MSB 23 -#define RTC_SET_DATE_YEAR_LSB 16 -#define RTC_SET_DATE_YEAR_MASK 0x00ff0000 -#define RTC_SET_DATE_YEAR_GET(x) (((x) & RTC_SET_DATE_YEAR_MASK) >> RTC_SET_DATE_YEAR_LSB) -#define RTC_SET_DATE_YEAR_SET(x) (((x) << RTC_SET_DATE_YEAR_LSB) & RTC_SET_DATE_YEAR_MASK) -#define RTC_SET_DATE_MONTH_MSB 12 -#define RTC_SET_DATE_MONTH_LSB 8 -#define RTC_SET_DATE_MONTH_MASK 0x00001f00 -#define RTC_SET_DATE_MONTH_GET(x) (((x) & RTC_SET_DATE_MONTH_MASK) >> RTC_SET_DATE_MONTH_LSB) -#define RTC_SET_DATE_MONTH_SET(x) (((x) << RTC_SET_DATE_MONTH_LSB) & RTC_SET_DATE_MONTH_MASK) -#define RTC_SET_DATE_MONTH_DAY_MSB 5 -#define RTC_SET_DATE_MONTH_DAY_LSB 0 -#define RTC_SET_DATE_MONTH_DAY_MASK 0x0000003f -#define RTC_SET_DATE_MONTH_DAY_GET(x) (((x) & RTC_SET_DATE_MONTH_DAY_MASK) >> RTC_SET_DATE_MONTH_DAY_LSB) -#define RTC_SET_DATE_MONTH_DAY_SET(x) (((x) << RTC_SET_DATE_MONTH_DAY_LSB) & RTC_SET_DATE_MONTH_DAY_MASK) - -#define RTC_SET_ALARM_ADDRESS 0x000000b0 -#define RTC_SET_ALARM_OFFSET 0x000000b0 -#define RTC_SET_ALARM_HOUR_MSB 21 -#define RTC_SET_ALARM_HOUR_LSB 16 -#define RTC_SET_ALARM_HOUR_MASK 0x003f0000 -#define RTC_SET_ALARM_HOUR_GET(x) (((x) & RTC_SET_ALARM_HOUR_MASK) >> RTC_SET_ALARM_HOUR_LSB) -#define RTC_SET_ALARM_HOUR_SET(x) (((x) << RTC_SET_ALARM_HOUR_LSB) & RTC_SET_ALARM_HOUR_MASK) -#define RTC_SET_ALARM_MINUTE_MSB 14 -#define RTC_SET_ALARM_MINUTE_LSB 8 -#define RTC_SET_ALARM_MINUTE_MASK 0x00007f00 -#define RTC_SET_ALARM_MINUTE_GET(x) (((x) & RTC_SET_ALARM_MINUTE_MASK) >> RTC_SET_ALARM_MINUTE_LSB) -#define RTC_SET_ALARM_MINUTE_SET(x) (((x) << RTC_SET_ALARM_MINUTE_LSB) & RTC_SET_ALARM_MINUTE_MASK) -#define RTC_SET_ALARM_SECOND_MSB 6 -#define RTC_SET_ALARM_SECOND_LSB 0 -#define RTC_SET_ALARM_SECOND_MASK 0x0000007f -#define RTC_SET_ALARM_SECOND_GET(x) (((x) & RTC_SET_ALARM_SECOND_MASK) >> RTC_SET_ALARM_SECOND_LSB) -#define RTC_SET_ALARM_SECOND_SET(x) (((x) << RTC_SET_ALARM_SECOND_LSB) & RTC_SET_ALARM_SECOND_MASK) - -#define RTC_CONFIG_ADDRESS 0x000000b4 -#define RTC_CONFIG_OFFSET 0x000000b4 -#define RTC_CONFIG_BCD_MSB 2 -#define RTC_CONFIG_BCD_LSB 2 -#define RTC_CONFIG_BCD_MASK 0x00000004 -#define RTC_CONFIG_BCD_GET(x) (((x) & RTC_CONFIG_BCD_MASK) >> RTC_CONFIG_BCD_LSB) -#define RTC_CONFIG_BCD_SET(x) (((x) << RTC_CONFIG_BCD_LSB) & RTC_CONFIG_BCD_MASK) -#define RTC_CONFIG_TWELVE_HOUR_MSB 1 -#define RTC_CONFIG_TWELVE_HOUR_LSB 1 -#define RTC_CONFIG_TWELVE_HOUR_MASK 0x00000002 -#define RTC_CONFIG_TWELVE_HOUR_GET(x) (((x) & RTC_CONFIG_TWELVE_HOUR_MASK) >> RTC_CONFIG_TWELVE_HOUR_LSB) -#define RTC_CONFIG_TWELVE_HOUR_SET(x) (((x) << RTC_CONFIG_TWELVE_HOUR_LSB) & RTC_CONFIG_TWELVE_HOUR_MASK) -#define RTC_CONFIG_DSE_MSB 0 -#define RTC_CONFIG_DSE_LSB 0 -#define RTC_CONFIG_DSE_MASK 0x00000001 -#define RTC_CONFIG_DSE_GET(x) (((x) & RTC_CONFIG_DSE_MASK) >> RTC_CONFIG_DSE_LSB) -#define RTC_CONFIG_DSE_SET(x) (((x) << RTC_CONFIG_DSE_LSB) & RTC_CONFIG_DSE_MASK) - -#define RTC_ALARM_STATUS_ADDRESS 0x000000b8 -#define RTC_ALARM_STATUS_OFFSET 0x000000b8 -#define RTC_ALARM_STATUS_ENABLE_MSB 1 -#define RTC_ALARM_STATUS_ENABLE_LSB 1 -#define RTC_ALARM_STATUS_ENABLE_MASK 0x00000002 -#define RTC_ALARM_STATUS_ENABLE_GET(x) (((x) & RTC_ALARM_STATUS_ENABLE_MASK) >> RTC_ALARM_STATUS_ENABLE_LSB) -#define RTC_ALARM_STATUS_ENABLE_SET(x) (((x) << RTC_ALARM_STATUS_ENABLE_LSB) & RTC_ALARM_STATUS_ENABLE_MASK) -#define RTC_ALARM_STATUS_INTERRUPT_MSB 0 -#define RTC_ALARM_STATUS_INTERRUPT_LSB 0 -#define RTC_ALARM_STATUS_INTERRUPT_MASK 0x00000001 -#define RTC_ALARM_STATUS_INTERRUPT_GET(x) (((x) & RTC_ALARM_STATUS_INTERRUPT_MASK) >> RTC_ALARM_STATUS_INTERRUPT_LSB) -#define RTC_ALARM_STATUS_INTERRUPT_SET(x) (((x) << RTC_ALARM_STATUS_INTERRUPT_LSB) & RTC_ALARM_STATUS_INTERRUPT_MASK) - -#define UART_WAKEUP_ADDRESS 0x000000bc -#define UART_WAKEUP_OFFSET 0x000000bc -#define UART_WAKEUP_ENABLE_MSB 0 -#define UART_WAKEUP_ENABLE_LSB 0 -#define UART_WAKEUP_ENABLE_MASK 0x00000001 -#define UART_WAKEUP_ENABLE_GET(x) (((x) & UART_WAKEUP_ENABLE_MASK) >> UART_WAKEUP_ENABLE_LSB) -#define UART_WAKEUP_ENABLE_SET(x) (((x) << UART_WAKEUP_ENABLE_LSB) & UART_WAKEUP_ENABLE_MASK) - -#define RESET_CAUSE_ADDRESS 0x000000c0 -#define RESET_CAUSE_OFFSET 0x000000c0 -#define RESET_CAUSE_LAST_MSB 2 -#define RESET_CAUSE_LAST_LSB 0 -#define RESET_CAUSE_LAST_MASK 0x00000007 -#define RESET_CAUSE_LAST_GET(x) (((x) & RESET_CAUSE_LAST_MASK) >> RESET_CAUSE_LAST_LSB) -#define RESET_CAUSE_LAST_SET(x) (((x) << RESET_CAUSE_LAST_LSB) & RESET_CAUSE_LAST_MASK) - -#define SYSTEM_SLEEP_ADDRESS 0x000000c4 -#define SYSTEM_SLEEP_OFFSET 0x000000c4 -#define SYSTEM_SLEEP_HOST_IF_MSB 4 -#define SYSTEM_SLEEP_HOST_IF_LSB 4 -#define SYSTEM_SLEEP_HOST_IF_MASK 0x00000010 -#define SYSTEM_SLEEP_HOST_IF_GET(x) (((x) & SYSTEM_SLEEP_HOST_IF_MASK) >> SYSTEM_SLEEP_HOST_IF_LSB) -#define SYSTEM_SLEEP_HOST_IF_SET(x) (((x) << SYSTEM_SLEEP_HOST_IF_LSB) & SYSTEM_SLEEP_HOST_IF_MASK) -#define SYSTEM_SLEEP_MBOX_MSB 3 -#define SYSTEM_SLEEP_MBOX_LSB 3 -#define SYSTEM_SLEEP_MBOX_MASK 0x00000008 -#define SYSTEM_SLEEP_MBOX_GET(x) (((x) & SYSTEM_SLEEP_MBOX_MASK) >> SYSTEM_SLEEP_MBOX_LSB) -#define SYSTEM_SLEEP_MBOX_SET(x) (((x) << SYSTEM_SLEEP_MBOX_LSB) & SYSTEM_SLEEP_MBOX_MASK) -#define SYSTEM_SLEEP_MAC_IF_MSB 2 -#define SYSTEM_SLEEP_MAC_IF_LSB 2 -#define SYSTEM_SLEEP_MAC_IF_MASK 0x00000004 -#define SYSTEM_SLEEP_MAC_IF_GET(x) (((x) & SYSTEM_SLEEP_MAC_IF_MASK) >> SYSTEM_SLEEP_MAC_IF_LSB) -#define SYSTEM_SLEEP_MAC_IF_SET(x) (((x) << SYSTEM_SLEEP_MAC_IF_LSB) & SYSTEM_SLEEP_MAC_IF_MASK) -#define SYSTEM_SLEEP_LIGHT_MSB 1 -#define SYSTEM_SLEEP_LIGHT_LSB 1 -#define SYSTEM_SLEEP_LIGHT_MASK 0x00000002 -#define SYSTEM_SLEEP_LIGHT_GET(x) (((x) & SYSTEM_SLEEP_LIGHT_MASK) >> SYSTEM_SLEEP_LIGHT_LSB) -#define SYSTEM_SLEEP_LIGHT_SET(x) (((x) << SYSTEM_SLEEP_LIGHT_LSB) & SYSTEM_SLEEP_LIGHT_MASK) -#define SYSTEM_SLEEP_DISABLE_MSB 0 -#define SYSTEM_SLEEP_DISABLE_LSB 0 -#define SYSTEM_SLEEP_DISABLE_MASK 0x00000001 -#define SYSTEM_SLEEP_DISABLE_GET(x) (((x) & SYSTEM_SLEEP_DISABLE_MASK) >> SYSTEM_SLEEP_DISABLE_LSB) -#define SYSTEM_SLEEP_DISABLE_SET(x) (((x) << SYSTEM_SLEEP_DISABLE_LSB) & SYSTEM_SLEEP_DISABLE_MASK) - -#define SDIO_WRAPPER_ADDRESS 0x000000c8 -#define SDIO_WRAPPER_OFFSET 0x000000c8 -#define SDIO_WRAPPER_SLEEP_MSB 3 -#define SDIO_WRAPPER_SLEEP_LSB 3 -#define SDIO_WRAPPER_SLEEP_MASK 0x00000008 -#define SDIO_WRAPPER_SLEEP_GET(x) (((x) & SDIO_WRAPPER_SLEEP_MASK) >> SDIO_WRAPPER_SLEEP_LSB) -#define SDIO_WRAPPER_SLEEP_SET(x) (((x) << SDIO_WRAPPER_SLEEP_LSB) & SDIO_WRAPPER_SLEEP_MASK) -#define SDIO_WRAPPER_WAKEUP_MSB 2 -#define SDIO_WRAPPER_WAKEUP_LSB 2 -#define SDIO_WRAPPER_WAKEUP_MASK 0x00000004 -#define SDIO_WRAPPER_WAKEUP_GET(x) (((x) & SDIO_WRAPPER_WAKEUP_MASK) >> SDIO_WRAPPER_WAKEUP_LSB) -#define SDIO_WRAPPER_WAKEUP_SET(x) (((x) << SDIO_WRAPPER_WAKEUP_LSB) & SDIO_WRAPPER_WAKEUP_MASK) -#define SDIO_WRAPPER_SOC_ON_MSB 1 -#define SDIO_WRAPPER_SOC_ON_LSB 1 -#define SDIO_WRAPPER_SOC_ON_MASK 0x00000002 -#define SDIO_WRAPPER_SOC_ON_GET(x) (((x) & SDIO_WRAPPER_SOC_ON_MASK) >> SDIO_WRAPPER_SOC_ON_LSB) -#define SDIO_WRAPPER_SOC_ON_SET(x) (((x) << SDIO_WRAPPER_SOC_ON_LSB) & SDIO_WRAPPER_SOC_ON_MASK) -#define SDIO_WRAPPER_ON_MSB 0 -#define SDIO_WRAPPER_ON_LSB 0 -#define SDIO_WRAPPER_ON_MASK 0x00000001 -#define SDIO_WRAPPER_ON_GET(x) (((x) & SDIO_WRAPPER_ON_MASK) >> SDIO_WRAPPER_ON_LSB) -#define SDIO_WRAPPER_ON_SET(x) (((x) << SDIO_WRAPPER_ON_LSB) & SDIO_WRAPPER_ON_MASK) - -#define MAC_SLEEP_CONTROL_ADDRESS 0x000000cc -#define MAC_SLEEP_CONTROL_OFFSET 0x000000cc -#define MAC_SLEEP_CONTROL_ENABLE_MSB 1 -#define MAC_SLEEP_CONTROL_ENABLE_LSB 0 -#define MAC_SLEEP_CONTROL_ENABLE_MASK 0x00000003 -#define MAC_SLEEP_CONTROL_ENABLE_GET(x) (((x) & MAC_SLEEP_CONTROL_ENABLE_MASK) >> MAC_SLEEP_CONTROL_ENABLE_LSB) -#define MAC_SLEEP_CONTROL_ENABLE_SET(x) (((x) << MAC_SLEEP_CONTROL_ENABLE_LSB) & MAC_SLEEP_CONTROL_ENABLE_MASK) - -#define KEEP_AWAKE_ADDRESS 0x000000d0 -#define KEEP_AWAKE_OFFSET 0x000000d0 -#define KEEP_AWAKE_COUNT_MSB 7 -#define KEEP_AWAKE_COUNT_LSB 0 -#define KEEP_AWAKE_COUNT_MASK 0x000000ff -#define KEEP_AWAKE_COUNT_GET(x) (((x) & KEEP_AWAKE_COUNT_MASK) >> KEEP_AWAKE_COUNT_LSB) -#define KEEP_AWAKE_COUNT_SET(x) (((x) << KEEP_AWAKE_COUNT_LSB) & KEEP_AWAKE_COUNT_MASK) - -#define LPO_CAL_TIME_ADDRESS 0x000000d4 -#define LPO_CAL_TIME_OFFSET 0x000000d4 -#define LPO_CAL_TIME_LENGTH_MSB 13 -#define LPO_CAL_TIME_LENGTH_LSB 0 -#define LPO_CAL_TIME_LENGTH_MASK 0x00003fff -#define LPO_CAL_TIME_LENGTH_GET(x) (((x) & LPO_CAL_TIME_LENGTH_MASK) >> LPO_CAL_TIME_LENGTH_LSB) -#define LPO_CAL_TIME_LENGTH_SET(x) (((x) << LPO_CAL_TIME_LENGTH_LSB) & LPO_CAL_TIME_LENGTH_MASK) - -#define LPO_INIT_DIVIDEND_INT_ADDRESS 0x000000d8 -#define LPO_INIT_DIVIDEND_INT_OFFSET 0x000000d8 -#define LPO_INIT_DIVIDEND_INT_VALUE_MSB 23 -#define LPO_INIT_DIVIDEND_INT_VALUE_LSB 0 -#define LPO_INIT_DIVIDEND_INT_VALUE_MASK 0x00ffffff -#define LPO_INIT_DIVIDEND_INT_VALUE_GET(x) (((x) & LPO_INIT_DIVIDEND_INT_VALUE_MASK) >> LPO_INIT_DIVIDEND_INT_VALUE_LSB) -#define LPO_INIT_DIVIDEND_INT_VALUE_SET(x) (((x) << LPO_INIT_DIVIDEND_INT_VALUE_LSB) & LPO_INIT_DIVIDEND_INT_VALUE_MASK) - -#define LPO_INIT_DIVIDEND_FRACTION_ADDRESS 0x000000dc -#define LPO_INIT_DIVIDEND_FRACTION_OFFSET 0x000000dc -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_MSB 10 -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB 0 -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK 0x000007ff -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_GET(x) (((x) & LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK) >> LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB) -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_SET(x) (((x) << LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB) & LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK) - -#define LPO_CAL_ADDRESS 0x000000e0 -#define LPO_CAL_OFFSET 0x000000e0 -#define LPO_CAL_ENABLE_MSB 20 -#define LPO_CAL_ENABLE_LSB 20 -#define LPO_CAL_ENABLE_MASK 0x00100000 -#define LPO_CAL_ENABLE_GET(x) (((x) & LPO_CAL_ENABLE_MASK) >> LPO_CAL_ENABLE_LSB) -#define LPO_CAL_ENABLE_SET(x) (((x) << LPO_CAL_ENABLE_LSB) & LPO_CAL_ENABLE_MASK) -#define LPO_CAL_COUNT_MSB 19 -#define LPO_CAL_COUNT_LSB 0 -#define LPO_CAL_COUNT_MASK 0x000fffff -#define LPO_CAL_COUNT_GET(x) (((x) & LPO_CAL_COUNT_MASK) >> LPO_CAL_COUNT_LSB) -#define LPO_CAL_COUNT_SET(x) (((x) << LPO_CAL_COUNT_LSB) & LPO_CAL_COUNT_MASK) - -#define LPO_CAL_TEST_CONTROL_ADDRESS 0x000000e4 -#define LPO_CAL_TEST_CONTROL_OFFSET 0x000000e4 -#define LPO_CAL_TEST_CONTROL_ENABLE_MSB 5 -#define LPO_CAL_TEST_CONTROL_ENABLE_LSB 5 -#define LPO_CAL_TEST_CONTROL_ENABLE_MASK 0x00000020 -#define LPO_CAL_TEST_CONTROL_ENABLE_GET(x) (((x) & LPO_CAL_TEST_CONTROL_ENABLE_MASK) >> LPO_CAL_TEST_CONTROL_ENABLE_LSB) -#define LPO_CAL_TEST_CONTROL_ENABLE_SET(x) (((x) << LPO_CAL_TEST_CONTROL_ENABLE_LSB) & LPO_CAL_TEST_CONTROL_ENABLE_MASK) -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_MSB 4 -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB 0 -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK 0x0000001f -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_GET(x) (((x) & LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK) >> LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB) -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_SET(x) (((x) << LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB) & LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK) - -#define LPO_CAL_TEST_STATUS_ADDRESS 0x000000e8 -#define LPO_CAL_TEST_STATUS_OFFSET 0x000000e8 -#define LPO_CAL_TEST_STATUS_READY_MSB 16 -#define LPO_CAL_TEST_STATUS_READY_LSB 16 -#define LPO_CAL_TEST_STATUS_READY_MASK 0x00010000 -#define LPO_CAL_TEST_STATUS_READY_GET(x) (((x) & LPO_CAL_TEST_STATUS_READY_MASK) >> LPO_CAL_TEST_STATUS_READY_LSB) -#define LPO_CAL_TEST_STATUS_READY_SET(x) (((x) << LPO_CAL_TEST_STATUS_READY_LSB) & LPO_CAL_TEST_STATUS_READY_MASK) -#define LPO_CAL_TEST_STATUS_COUNT_MSB 15 -#define LPO_CAL_TEST_STATUS_COUNT_LSB 0 -#define LPO_CAL_TEST_STATUS_COUNT_MASK 0x0000ffff -#define LPO_CAL_TEST_STATUS_COUNT_GET(x) (((x) & LPO_CAL_TEST_STATUS_COUNT_MASK) >> LPO_CAL_TEST_STATUS_COUNT_LSB) -#define LPO_CAL_TEST_STATUS_COUNT_SET(x) (((x) << LPO_CAL_TEST_STATUS_COUNT_LSB) & LPO_CAL_TEST_STATUS_COUNT_MASK) - -#define CHIP_ID_ADDRESS 0x000000ec -#define CHIP_ID_OFFSET 0x000000ec -#define CHIP_ID_DEVICE_ID_MSB 31 -#define CHIP_ID_DEVICE_ID_LSB 16 -#define CHIP_ID_DEVICE_ID_MASK 0xffff0000 -#define CHIP_ID_DEVICE_ID_GET(x) (((x) & CHIP_ID_DEVICE_ID_MASK) >> CHIP_ID_DEVICE_ID_LSB) -#define CHIP_ID_DEVICE_ID_SET(x) (((x) << CHIP_ID_DEVICE_ID_LSB) & CHIP_ID_DEVICE_ID_MASK) -#define CHIP_ID_CONFIG_ID_MSB 15 -#define CHIP_ID_CONFIG_ID_LSB 4 -#define CHIP_ID_CONFIG_ID_MASK 0x0000fff0 -#define CHIP_ID_CONFIG_ID_GET(x) (((x) & CHIP_ID_CONFIG_ID_MASK) >> CHIP_ID_CONFIG_ID_LSB) -#define CHIP_ID_CONFIG_ID_SET(x) (((x) << CHIP_ID_CONFIG_ID_LSB) & CHIP_ID_CONFIG_ID_MASK) -#define CHIP_ID_VERSION_ID_MSB 3 -#define CHIP_ID_VERSION_ID_LSB 0 -#define CHIP_ID_VERSION_ID_MASK 0x0000000f -#define CHIP_ID_VERSION_ID_GET(x) (((x) & CHIP_ID_VERSION_ID_MASK) >> CHIP_ID_VERSION_ID_LSB) -#define CHIP_ID_VERSION_ID_SET(x) (((x) << CHIP_ID_VERSION_ID_LSB) & CHIP_ID_VERSION_ID_MASK) - -#define DERIVED_RTC_CLK_ADDRESS 0x000000f0 -#define DERIVED_RTC_CLK_OFFSET 0x000000f0 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MSB 20 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB 20 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK 0x00100000 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_GET(x) (((x) & DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK) >> DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_SET(x) (((x) << DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB) & DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_MSB 18 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB 18 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK 0x00040000 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_GET(x) (((x) & DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK) >> DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_SET(x) (((x) << DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB) & DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK) -#define DERIVED_RTC_CLK_FORCE_MSB 17 -#define DERIVED_RTC_CLK_FORCE_LSB 16 -#define DERIVED_RTC_CLK_FORCE_MASK 0x00030000 -#define DERIVED_RTC_CLK_FORCE_GET(x) (((x) & DERIVED_RTC_CLK_FORCE_MASK) >> DERIVED_RTC_CLK_FORCE_LSB) -#define DERIVED_RTC_CLK_FORCE_SET(x) (((x) << DERIVED_RTC_CLK_FORCE_LSB) & DERIVED_RTC_CLK_FORCE_MASK) -#define DERIVED_RTC_CLK_PERIOD_MSB 15 -#define DERIVED_RTC_CLK_PERIOD_LSB 1 -#define DERIVED_RTC_CLK_PERIOD_MASK 0x0000fffe -#define DERIVED_RTC_CLK_PERIOD_GET(x) (((x) & DERIVED_RTC_CLK_PERIOD_MASK) >> DERIVED_RTC_CLK_PERIOD_LSB) -#define DERIVED_RTC_CLK_PERIOD_SET(x) (((x) << DERIVED_RTC_CLK_PERIOD_LSB) & DERIVED_RTC_CLK_PERIOD_MASK) - -#define MAC_PCU_SLP32_MODE_ADDRESS 0x000000f4 -#define MAC_PCU_SLP32_MODE_OFFSET 0x000000f4 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MSB 21 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_LSB 21 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MASK 0x00200000 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_GET(x) (((x) & MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MASK) >> MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_LSB) -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_SET(x) (((x) << MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_LSB) & MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MASK) -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MSB 19 -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB 0 -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK 0x000fffff -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_GET(x) (((x) & MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK) >> MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB) -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_SET(x) (((x) << MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB) & MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK) - -#define MAC_PCU_SLP32_WAKE_ADDRESS 0x000000f8 -#define MAC_PCU_SLP32_WAKE_OFFSET 0x000000f8 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_MSB 15 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_LSB 0 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_MASK 0x0000ffff -#define MAC_PCU_SLP32_WAKE_XTL_TIME_GET(x) (((x) & MAC_PCU_SLP32_WAKE_XTL_TIME_MASK) >> MAC_PCU_SLP32_WAKE_XTL_TIME_LSB) -#define MAC_PCU_SLP32_WAKE_XTL_TIME_SET(x) (((x) << MAC_PCU_SLP32_WAKE_XTL_TIME_LSB) & MAC_PCU_SLP32_WAKE_XTL_TIME_MASK) - -#define MAC_PCU_SLP32_INC_ADDRESS 0x000000fc -#define MAC_PCU_SLP32_INC_OFFSET 0x000000fc -#define MAC_PCU_SLP32_INC_TSF_INC_MSB 19 -#define MAC_PCU_SLP32_INC_TSF_INC_LSB 0 -#define MAC_PCU_SLP32_INC_TSF_INC_MASK 0x000fffff -#define MAC_PCU_SLP32_INC_TSF_INC_GET(x) (((x) & MAC_PCU_SLP32_INC_TSF_INC_MASK) >> MAC_PCU_SLP32_INC_TSF_INC_LSB) -#define MAC_PCU_SLP32_INC_TSF_INC_SET(x) (((x) << MAC_PCU_SLP32_INC_TSF_INC_LSB) & MAC_PCU_SLP32_INC_TSF_INC_MASK) - -#define MAC_PCU_SLP_MIB1_ADDRESS 0x00000100 -#define MAC_PCU_SLP_MIB1_OFFSET 0x00000100 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_MSB 31 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB 0 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK 0xffffffff -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK) >> MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB) -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_SET(x) (((x) << MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB) & MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK) - -#define MAC_PCU_SLP_MIB2_ADDRESS 0x00000104 -#define MAC_PCU_SLP_MIB2_OFFSET 0x00000104 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_MSB 31 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB 0 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK 0xffffffff -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK) >> MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB) -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_SET(x) (((x) << MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB) & MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK) - -#define MAC_PCU_SLP_MIB3_ADDRESS 0x00000108 -#define MAC_PCU_SLP_MIB3_OFFSET 0x00000108 -#define MAC_PCU_SLP_MIB3_PENDING_MSB 1 -#define MAC_PCU_SLP_MIB3_PENDING_LSB 1 -#define MAC_PCU_SLP_MIB3_PENDING_MASK 0x00000002 -#define MAC_PCU_SLP_MIB3_PENDING_GET(x) (((x) & MAC_PCU_SLP_MIB3_PENDING_MASK) >> MAC_PCU_SLP_MIB3_PENDING_LSB) -#define MAC_PCU_SLP_MIB3_PENDING_SET(x) (((x) << MAC_PCU_SLP_MIB3_PENDING_LSB) & MAC_PCU_SLP_MIB3_PENDING_MASK) -#define MAC_PCU_SLP_MIB3_CLR_CNT_MSB 0 -#define MAC_PCU_SLP_MIB3_CLR_CNT_LSB 0 -#define MAC_PCU_SLP_MIB3_CLR_CNT_MASK 0x00000001 -#define MAC_PCU_SLP_MIB3_CLR_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB3_CLR_CNT_MASK) >> MAC_PCU_SLP_MIB3_CLR_CNT_LSB) -#define MAC_PCU_SLP_MIB3_CLR_CNT_SET(x) (((x) << MAC_PCU_SLP_MIB3_CLR_CNT_LSB) & MAC_PCU_SLP_MIB3_CLR_CNT_MASK) - -#define MAC_PCU_SLP_BEACON_ADDRESS 0x0000010c -#define MAC_PCU_SLP_BEACON_OFFSET 0x0000010c -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MSB 24 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_LSB 24 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MASK 0x01000000 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_GET(x) (((x) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MASK) >> MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_LSB) -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_SET(x) (((x) << MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_LSB) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MASK) -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MSB 23 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_LSB 0 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MASK 0x00ffffff -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_GET(x) (((x) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MASK) >> MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_LSB) -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_SET(x) (((x) << MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_LSB) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MASK) - -#define POWER_REG_ADDRESS 0x00000110 -#define POWER_REG_OFFSET 0x00000110 -#define POWER_REG_VLVL_MSB 11 -#define POWER_REG_VLVL_LSB 8 -#define POWER_REG_VLVL_MASK 0x00000f00 -#define POWER_REG_VLVL_GET(x) (((x) & POWER_REG_VLVL_MASK) >> POWER_REG_VLVL_LSB) -#define POWER_REG_VLVL_SET(x) (((x) << POWER_REG_VLVL_LSB) & POWER_REG_VLVL_MASK) -#define POWER_REG_CPU_INT_ENABLE_MSB 7 -#define POWER_REG_CPU_INT_ENABLE_LSB 7 -#define POWER_REG_CPU_INT_ENABLE_MASK 0x00000080 -#define POWER_REG_CPU_INT_ENABLE_GET(x) (((x) & POWER_REG_CPU_INT_ENABLE_MASK) >> POWER_REG_CPU_INT_ENABLE_LSB) -#define POWER_REG_CPU_INT_ENABLE_SET(x) (((x) << POWER_REG_CPU_INT_ENABLE_LSB) & POWER_REG_CPU_INT_ENABLE_MASK) -#define POWER_REG_WLAN_ISO_DIS_MSB 6 -#define POWER_REG_WLAN_ISO_DIS_LSB 6 -#define POWER_REG_WLAN_ISO_DIS_MASK 0x00000040 -#define POWER_REG_WLAN_ISO_DIS_GET(x) (((x) & POWER_REG_WLAN_ISO_DIS_MASK) >> POWER_REG_WLAN_ISO_DIS_LSB) -#define POWER_REG_WLAN_ISO_DIS_SET(x) (((x) << POWER_REG_WLAN_ISO_DIS_LSB) & POWER_REG_WLAN_ISO_DIS_MASK) -#define POWER_REG_WLAN_ISO_CNTL_MSB 5 -#define POWER_REG_WLAN_ISO_CNTL_LSB 5 -#define POWER_REG_WLAN_ISO_CNTL_MASK 0x00000020 -#define POWER_REG_WLAN_ISO_CNTL_GET(x) (((x) & POWER_REG_WLAN_ISO_CNTL_MASK) >> POWER_REG_WLAN_ISO_CNTL_LSB) -#define POWER_REG_WLAN_ISO_CNTL_SET(x) (((x) << POWER_REG_WLAN_ISO_CNTL_LSB) & POWER_REG_WLAN_ISO_CNTL_MASK) -#define POWER_REG_RADIO_PWD_EN_MSB 4 -#define POWER_REG_RADIO_PWD_EN_LSB 4 -#define POWER_REG_RADIO_PWD_EN_MASK 0x00000010 -#define POWER_REG_RADIO_PWD_EN_GET(x) (((x) & POWER_REG_RADIO_PWD_EN_MASK) >> POWER_REG_RADIO_PWD_EN_LSB) -#define POWER_REG_RADIO_PWD_EN_SET(x) (((x) << POWER_REG_RADIO_PWD_EN_LSB) & POWER_REG_RADIO_PWD_EN_MASK) -#define POWER_REG_SOC_SCALE_EN_MSB 3 -#define POWER_REG_SOC_SCALE_EN_LSB 3 -#define POWER_REG_SOC_SCALE_EN_MASK 0x00000008 -#define POWER_REG_SOC_SCALE_EN_GET(x) (((x) & POWER_REG_SOC_SCALE_EN_MASK) >> POWER_REG_SOC_SCALE_EN_LSB) -#define POWER_REG_SOC_SCALE_EN_SET(x) (((x) << POWER_REG_SOC_SCALE_EN_LSB) & POWER_REG_SOC_SCALE_EN_MASK) -#define POWER_REG_WLAN_SCALE_EN_MSB 2 -#define POWER_REG_WLAN_SCALE_EN_LSB 2 -#define POWER_REG_WLAN_SCALE_EN_MASK 0x00000004 -#define POWER_REG_WLAN_SCALE_EN_GET(x) (((x) & POWER_REG_WLAN_SCALE_EN_MASK) >> POWER_REG_WLAN_SCALE_EN_LSB) -#define POWER_REG_WLAN_SCALE_EN_SET(x) (((x) << POWER_REG_WLAN_SCALE_EN_LSB) & POWER_REG_WLAN_SCALE_EN_MASK) -#define POWER_REG_WLAN_PWD_EN_MSB 1 -#define POWER_REG_WLAN_PWD_EN_LSB 1 -#define POWER_REG_WLAN_PWD_EN_MASK 0x00000002 -#define POWER_REG_WLAN_PWD_EN_GET(x) (((x) & POWER_REG_WLAN_PWD_EN_MASK) >> POWER_REG_WLAN_PWD_EN_LSB) -#define POWER_REG_WLAN_PWD_EN_SET(x) (((x) << POWER_REG_WLAN_PWD_EN_LSB) & POWER_REG_WLAN_PWD_EN_MASK) -#define POWER_REG_POWER_EN_MSB 0 -#define POWER_REG_POWER_EN_LSB 0 -#define POWER_REG_POWER_EN_MASK 0x00000001 -#define POWER_REG_POWER_EN_GET(x) (((x) & POWER_REG_POWER_EN_MASK) >> POWER_REG_POWER_EN_LSB) -#define POWER_REG_POWER_EN_SET(x) (((x) << POWER_REG_POWER_EN_LSB) & POWER_REG_POWER_EN_MASK) - -#define CORE_CLK_CTRL_ADDRESS 0x00000114 -#define CORE_CLK_CTRL_OFFSET 0x00000114 -#define CORE_CLK_CTRL_DIV_MSB 2 -#define CORE_CLK_CTRL_DIV_LSB 0 -#define CORE_CLK_CTRL_DIV_MASK 0x00000007 -#define CORE_CLK_CTRL_DIV_GET(x) (((x) & CORE_CLK_CTRL_DIV_MASK) >> CORE_CLK_CTRL_DIV_LSB) -#define CORE_CLK_CTRL_DIV_SET(x) (((x) << CORE_CLK_CTRL_DIV_LSB) & CORE_CLK_CTRL_DIV_MASK) - -#define SDIO_SETUP_CIRCUIT_ADDRESS 0x00000120 -#define SDIO_SETUP_CIRCUIT_OFFSET 0x00000120 -#define SDIO_SETUP_CIRCUIT_VECTOR_MSB 7 -#define SDIO_SETUP_CIRCUIT_VECTOR_LSB 0 -#define SDIO_SETUP_CIRCUIT_VECTOR_MASK 0x000000ff -#define SDIO_SETUP_CIRCUIT_VECTOR_GET(x) (((x) & SDIO_SETUP_CIRCUIT_VECTOR_MASK) >> SDIO_SETUP_CIRCUIT_VECTOR_LSB) -#define SDIO_SETUP_CIRCUIT_VECTOR_SET(x) (((x) << SDIO_SETUP_CIRCUIT_VECTOR_LSB) & SDIO_SETUP_CIRCUIT_VECTOR_MASK) - -#define SDIO_SETUP_CONFIG_ADDRESS 0x00000140 -#define SDIO_SETUP_CONFIG_OFFSET 0x00000140 -#define SDIO_SETUP_CONFIG_ENABLE_MSB 1 -#define SDIO_SETUP_CONFIG_ENABLE_LSB 1 -#define SDIO_SETUP_CONFIG_ENABLE_MASK 0x00000002 -#define SDIO_SETUP_CONFIG_ENABLE_GET(x) (((x) & SDIO_SETUP_CONFIG_ENABLE_MASK) >> SDIO_SETUP_CONFIG_ENABLE_LSB) -#define SDIO_SETUP_CONFIG_ENABLE_SET(x) (((x) << SDIO_SETUP_CONFIG_ENABLE_LSB) & SDIO_SETUP_CONFIG_ENABLE_MASK) -#define SDIO_SETUP_CONFIG_CLEAR_MSB 0 -#define SDIO_SETUP_CONFIG_CLEAR_LSB 0 -#define SDIO_SETUP_CONFIG_CLEAR_MASK 0x00000001 -#define SDIO_SETUP_CONFIG_CLEAR_GET(x) (((x) & SDIO_SETUP_CONFIG_CLEAR_MASK) >> SDIO_SETUP_CONFIG_CLEAR_LSB) -#define SDIO_SETUP_CONFIG_CLEAR_SET(x) (((x) << SDIO_SETUP_CONFIG_CLEAR_LSB) & SDIO_SETUP_CONFIG_CLEAR_MASK) - -#define CPU_SETUP_CONFIG_ADDRESS 0x00000144 -#define CPU_SETUP_CONFIG_OFFSET 0x00000144 -#define CPU_SETUP_CONFIG_ENABLE_MSB 1 -#define CPU_SETUP_CONFIG_ENABLE_LSB 1 -#define CPU_SETUP_CONFIG_ENABLE_MASK 0x00000002 -#define CPU_SETUP_CONFIG_ENABLE_GET(x) (((x) & CPU_SETUP_CONFIG_ENABLE_MASK) >> CPU_SETUP_CONFIG_ENABLE_LSB) -#define CPU_SETUP_CONFIG_ENABLE_SET(x) (((x) << CPU_SETUP_CONFIG_ENABLE_LSB) & CPU_SETUP_CONFIG_ENABLE_MASK) -#define CPU_SETUP_CONFIG_CLEAR_MSB 0 -#define CPU_SETUP_CONFIG_CLEAR_LSB 0 -#define CPU_SETUP_CONFIG_CLEAR_MASK 0x00000001 -#define CPU_SETUP_CONFIG_CLEAR_GET(x) (((x) & CPU_SETUP_CONFIG_CLEAR_MASK) >> CPU_SETUP_CONFIG_CLEAR_LSB) -#define CPU_SETUP_CONFIG_CLEAR_SET(x) (((x) << CPU_SETUP_CONFIG_CLEAR_LSB) & CPU_SETUP_CONFIG_CLEAR_MASK) - -#define CPU_SETUP_CIRCUIT_ADDRESS 0x00000160 -#define CPU_SETUP_CIRCUIT_OFFSET 0x00000160 -#define CPU_SETUP_CIRCUIT_VECTOR_MSB 7 -#define CPU_SETUP_CIRCUIT_VECTOR_LSB 0 -#define CPU_SETUP_CIRCUIT_VECTOR_MASK 0x000000ff -#define CPU_SETUP_CIRCUIT_VECTOR_GET(x) (((x) & CPU_SETUP_CIRCUIT_VECTOR_MASK) >> CPU_SETUP_CIRCUIT_VECTOR_LSB) -#define CPU_SETUP_CIRCUIT_VECTOR_SET(x) (((x) << CPU_SETUP_CIRCUIT_VECTOR_LSB) & CPU_SETUP_CIRCUIT_VECTOR_MASK) - -#define BB_SETUP_CONFIG_ADDRESS 0x00000180 -#define BB_SETUP_CONFIG_OFFSET 0x00000180 -#define BB_SETUP_CONFIG_ENABLE_MSB 1 -#define BB_SETUP_CONFIG_ENABLE_LSB 1 -#define BB_SETUP_CONFIG_ENABLE_MASK 0x00000002 -#define BB_SETUP_CONFIG_ENABLE_GET(x) (((x) & BB_SETUP_CONFIG_ENABLE_MASK) >> BB_SETUP_CONFIG_ENABLE_LSB) -#define BB_SETUP_CONFIG_ENABLE_SET(x) (((x) << BB_SETUP_CONFIG_ENABLE_LSB) & BB_SETUP_CONFIG_ENABLE_MASK) -#define BB_SETUP_CONFIG_CLEAR_MSB 0 -#define BB_SETUP_CONFIG_CLEAR_LSB 0 -#define BB_SETUP_CONFIG_CLEAR_MASK 0x00000001 -#define BB_SETUP_CONFIG_CLEAR_GET(x) (((x) & BB_SETUP_CONFIG_CLEAR_MASK) >> BB_SETUP_CONFIG_CLEAR_LSB) -#define BB_SETUP_CONFIG_CLEAR_SET(x) (((x) << BB_SETUP_CONFIG_CLEAR_LSB) & BB_SETUP_CONFIG_CLEAR_MASK) - -#define BB_SETUP_CIRCUIT_ADDRESS 0x000001a0 -#define BB_SETUP_CIRCUIT_OFFSET 0x000001a0 -#define BB_SETUP_CIRCUIT_VECTOR_MSB 7 -#define BB_SETUP_CIRCUIT_VECTOR_LSB 0 -#define BB_SETUP_CIRCUIT_VECTOR_MASK 0x000000ff -#define BB_SETUP_CIRCUIT_VECTOR_GET(x) (((x) & BB_SETUP_CIRCUIT_VECTOR_MASK) >> BB_SETUP_CIRCUIT_VECTOR_LSB) -#define BB_SETUP_CIRCUIT_VECTOR_SET(x) (((x) << BB_SETUP_CIRCUIT_VECTOR_LSB) & BB_SETUP_CIRCUIT_VECTOR_MASK) - -#define GPIO_WAKEUP_CONTROL_ADDRESS 0x000001c0 -#define GPIO_WAKEUP_CONTROL_OFFSET 0x000001c0 -#define GPIO_WAKEUP_CONTROL_ENABLE_MSB 0 -#define GPIO_WAKEUP_CONTROL_ENABLE_LSB 0 -#define GPIO_WAKEUP_CONTROL_ENABLE_MASK 0x00000001 -#define GPIO_WAKEUP_CONTROL_ENABLE_GET(x) (((x) & GPIO_WAKEUP_CONTROL_ENABLE_MASK) >> GPIO_WAKEUP_CONTROL_ENABLE_LSB) -#define GPIO_WAKEUP_CONTROL_ENABLE_SET(x) (((x) << GPIO_WAKEUP_CONTROL_ENABLE_LSB) & GPIO_WAKEUP_CONTROL_ENABLE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct rtc_reg_reg_s { - volatile unsigned int reset_control; - volatile unsigned int xtal_control; - volatile unsigned int tcxo_detect; - volatile unsigned int xtal_test; - volatile unsigned int quadrature; - volatile unsigned int pll_control; - volatile unsigned int pll_settle; - volatile unsigned int xtal_settle; - volatile unsigned int cpu_clock; - volatile unsigned int clock_out; - volatile unsigned int clock_control; - volatile unsigned int bias_override; - volatile unsigned int wdt_control; - volatile unsigned int wdt_status; - volatile unsigned int wdt; - volatile unsigned int wdt_count; - volatile unsigned int wdt_reset; - volatile unsigned int int_status; - volatile unsigned int lf_timer0; - volatile unsigned int lf_timer_count0; - volatile unsigned int lf_timer_control0; - volatile unsigned int lf_timer_status0; - volatile unsigned int lf_timer1; - volatile unsigned int lf_timer_count1; - volatile unsigned int lf_timer_control1; - volatile unsigned int lf_timer_status1; - volatile unsigned int lf_timer2; - volatile unsigned int lf_timer_count2; - volatile unsigned int lf_timer_control2; - volatile unsigned int lf_timer_status2; - volatile unsigned int lf_timer3; - volatile unsigned int lf_timer_count3; - volatile unsigned int lf_timer_control3; - volatile unsigned int lf_timer_status3; - volatile unsigned int hf_timer; - volatile unsigned int hf_timer_count; - volatile unsigned int hf_lf_count; - volatile unsigned int hf_timer_control; - volatile unsigned int hf_timer_status; - volatile unsigned int rtc_control; - volatile unsigned int rtc_time; - volatile unsigned int rtc_date; - volatile unsigned int rtc_set_time; - volatile unsigned int rtc_set_date; - volatile unsigned int rtc_set_alarm; - volatile unsigned int rtc_config; - volatile unsigned int rtc_alarm_status; - volatile unsigned int uart_wakeup; - volatile unsigned int reset_cause; - volatile unsigned int system_sleep; - volatile unsigned int sdio_wrapper; - volatile unsigned int mac_sleep_control; - volatile unsigned int keep_awake; - volatile unsigned int lpo_cal_time; - volatile unsigned int lpo_init_dividend_int; - volatile unsigned int lpo_init_dividend_fraction; - volatile unsigned int lpo_cal; - volatile unsigned int lpo_cal_test_control; - volatile unsigned int lpo_cal_test_status; - volatile unsigned int chip_id; - volatile unsigned int derived_rtc_clk; - volatile unsigned int mac_pcu_slp32_mode; - volatile unsigned int mac_pcu_slp32_wake; - volatile unsigned int mac_pcu_slp32_inc; - volatile unsigned int mac_pcu_slp_mib1; - volatile unsigned int mac_pcu_slp_mib2; - volatile unsigned int mac_pcu_slp_mib3; - volatile unsigned int mac_pcu_slp_beacon; - volatile unsigned int power_reg; - volatile unsigned int core_clk_ctrl; - unsigned char pad0[8]; /* pad to 0x120 */ - volatile unsigned int sdio_setup_circuit[8]; - volatile unsigned int sdio_setup_config; - volatile unsigned int cpu_setup_config; - unsigned char pad1[24]; /* pad to 0x160 */ - volatile unsigned int cpu_setup_circuit[8]; - volatile unsigned int bb_setup_config; - unsigned char pad2[28]; /* pad to 0x1a0 */ - volatile unsigned int bb_setup_circuit[8]; - volatile unsigned int gpio_wakeup_control; -} rtc_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _RTC_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/rtc_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/rtc_reg.vrh deleted file mode 100644 index a95f3422d38b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/rtc_reg.vrh +++ /dev/null @@ -1,1758 +0,0 @@ -#ifndef _RTC_REG_VRH_ -#define _RTC_REG_VRH_ - -#define RESET_CONTROL_ADDRESS 'h00000000 -#define RESET_CONTROL_CPU_INIT_RESET_MSB 11 -#define RESET_CONTROL_CPU_INIT_RESET_LSB 11 -#define RESET_CONTROL_CPU_INIT_RESET_MASK 'h00000800 -#define RESET_CONTROL_CPU_INIT_RESET_GET(x) (((x) & RESET_CONTROL_CPU_INIT_RESET_MASK) >> RESET_CONTROL_CPU_INIT_RESET_LSB) -#define RESET_CONTROL_CPU_INIT_RESET_SET(x) (((32'd0 | (x)) << RESET_CONTROL_CPU_INIT_RESET_LSB) & RESET_CONTROL_CPU_INIT_RESET_MASK) -#define RESET_CONTROL_CPU_INIT_RESET_RESET 1'h1 -#define RESET_CONTROL_VMC_REMAP_RESET_MSB 10 -#define RESET_CONTROL_VMC_REMAP_RESET_LSB 10 -#define RESET_CONTROL_VMC_REMAP_RESET_MASK 'h00000400 -#define RESET_CONTROL_VMC_REMAP_RESET_GET(x) (((x) & RESET_CONTROL_VMC_REMAP_RESET_MASK) >> RESET_CONTROL_VMC_REMAP_RESET_LSB) -#define RESET_CONTROL_VMC_REMAP_RESET_SET(x) (((32'd0 | (x)) << RESET_CONTROL_VMC_REMAP_RESET_LSB) & RESET_CONTROL_VMC_REMAP_RESET_MASK) -#define RESET_CONTROL_VMC_REMAP_RESET_RESET 1'h0 -#define RESET_CONTROL_RST_OUT_MSB 9 -#define RESET_CONTROL_RST_OUT_LSB 9 -#define RESET_CONTROL_RST_OUT_MASK 'h00000200 -#define RESET_CONTROL_RST_OUT_GET(x) (((x) & RESET_CONTROL_RST_OUT_MASK) >> RESET_CONTROL_RST_OUT_LSB) -#define RESET_CONTROL_RST_OUT_SET(x) (((32'd0 | (x)) << RESET_CONTROL_RST_OUT_LSB) & RESET_CONTROL_RST_OUT_MASK) -#define RESET_CONTROL_RST_OUT_RESET 1'h0 -#define RESET_CONTROL_COLD_RST_MSB 8 -#define RESET_CONTROL_COLD_RST_LSB 8 -#define RESET_CONTROL_COLD_RST_MASK 'h00000100 -#define RESET_CONTROL_COLD_RST_GET(x) (((x) & RESET_CONTROL_COLD_RST_MASK) >> RESET_CONTROL_COLD_RST_LSB) -#define RESET_CONTROL_COLD_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_COLD_RST_LSB) & RESET_CONTROL_COLD_RST_MASK) -#define RESET_CONTROL_COLD_RST_RESET 1'h0 -#define RESET_CONTROL_WARM_RST_MSB 7 -#define RESET_CONTROL_WARM_RST_LSB 7 -#define RESET_CONTROL_WARM_RST_MASK 'h00000080 -#define RESET_CONTROL_WARM_RST_GET(x) (((x) & RESET_CONTROL_WARM_RST_MASK) >> RESET_CONTROL_WARM_RST_LSB) -#define RESET_CONTROL_WARM_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_WARM_RST_LSB) & RESET_CONTROL_WARM_RST_MASK) -#define RESET_CONTROL_WARM_RST_RESET 1'h0 -#define RESET_CONTROL_CPU_WARM_RST_MSB 6 -#define RESET_CONTROL_CPU_WARM_RST_LSB 6 -#define RESET_CONTROL_CPU_WARM_RST_MASK 'h00000040 -#define RESET_CONTROL_CPU_WARM_RST_GET(x) (((x) & RESET_CONTROL_CPU_WARM_RST_MASK) >> RESET_CONTROL_CPU_WARM_RST_LSB) -#define RESET_CONTROL_CPU_WARM_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_CPU_WARM_RST_LSB) & RESET_CONTROL_CPU_WARM_RST_MASK) -#define RESET_CONTROL_CPU_WARM_RST_RESET 1'h0 -#define RESET_CONTROL_MAC_COLD_RST_MSB 5 -#define RESET_CONTROL_MAC_COLD_RST_LSB 5 -#define RESET_CONTROL_MAC_COLD_RST_MASK 'h00000020 -#define RESET_CONTROL_MAC_COLD_RST_GET(x) (((x) & RESET_CONTROL_MAC_COLD_RST_MASK) >> RESET_CONTROL_MAC_COLD_RST_LSB) -#define RESET_CONTROL_MAC_COLD_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_MAC_COLD_RST_LSB) & RESET_CONTROL_MAC_COLD_RST_MASK) -#define RESET_CONTROL_MAC_COLD_RST_RESET 1'h1 -#define RESET_CONTROL_MAC_WARM_RST_MSB 4 -#define RESET_CONTROL_MAC_WARM_RST_LSB 4 -#define RESET_CONTROL_MAC_WARM_RST_MASK 'h00000010 -#define RESET_CONTROL_MAC_WARM_RST_GET(x) (((x) & RESET_CONTROL_MAC_WARM_RST_MASK) >> RESET_CONTROL_MAC_WARM_RST_LSB) -#define RESET_CONTROL_MAC_WARM_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_MAC_WARM_RST_LSB) & RESET_CONTROL_MAC_WARM_RST_MASK) -#define RESET_CONTROL_MAC_WARM_RST_RESET 1'h1 -#define RESET_CONTROL_MBOX_RST_MSB 2 -#define RESET_CONTROL_MBOX_RST_LSB 2 -#define RESET_CONTROL_MBOX_RST_MASK 'h00000004 -#define RESET_CONTROL_MBOX_RST_GET(x) (((x) & RESET_CONTROL_MBOX_RST_MASK) >> RESET_CONTROL_MBOX_RST_LSB) -#define RESET_CONTROL_MBOX_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_MBOX_RST_LSB) & RESET_CONTROL_MBOX_RST_MASK) -#define RESET_CONTROL_MBOX_RST_RESET 1'h0 -#define RESET_CONTROL_UART_RST_MSB 1 -#define RESET_CONTROL_UART_RST_LSB 1 -#define RESET_CONTROL_UART_RST_MASK 'h00000002 -#define RESET_CONTROL_UART_RST_GET(x) (((x) & RESET_CONTROL_UART_RST_MASK) >> RESET_CONTROL_UART_RST_LSB) -#define RESET_CONTROL_UART_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_UART_RST_LSB) & RESET_CONTROL_UART_RST_MASK) -#define RESET_CONTROL_UART_RST_RESET 1'h0 -#define RESET_CONTROL_SI0_RST_MSB 0 -#define RESET_CONTROL_SI0_RST_LSB 0 -#define RESET_CONTROL_SI0_RST_MASK 'h00000001 -#define RESET_CONTROL_SI0_RST_GET(x) (((x) & RESET_CONTROL_SI0_RST_MASK) >> RESET_CONTROL_SI0_RST_LSB) -#define RESET_CONTROL_SI0_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_SI0_RST_LSB) & RESET_CONTROL_SI0_RST_MASK) -#define RESET_CONTROL_SI0_RST_RESET 1'h0 -#define RESET_CONTROL_RESET (32'h0 | \ - RESET_CONTROL_CPU_INIT_RESET_SET(RESET_CONTROL_CPU_INIT_RESET_RESET) | \ - RESET_CONTROL_VMC_REMAP_RESET_SET(RESET_CONTROL_VMC_REMAP_RESET_RESET) | \ - RESET_CONTROL_RST_OUT_SET(RESET_CONTROL_RST_OUT_RESET) | \ - RESET_CONTROL_COLD_RST_SET(RESET_CONTROL_COLD_RST_RESET) | \ - RESET_CONTROL_WARM_RST_SET(RESET_CONTROL_WARM_RST_RESET) | \ - RESET_CONTROL_CPU_WARM_RST_SET(RESET_CONTROL_CPU_WARM_RST_RESET) | \ - RESET_CONTROL_MAC_COLD_RST_SET(RESET_CONTROL_MAC_COLD_RST_RESET) | \ - RESET_CONTROL_MAC_WARM_RST_SET(RESET_CONTROL_MAC_WARM_RST_RESET) | \ - RESET_CONTROL_MBOX_RST_SET(RESET_CONTROL_MBOX_RST_RESET) | \ - RESET_CONTROL_UART_RST_SET(RESET_CONTROL_UART_RST_RESET) | \ - RESET_CONTROL_SI0_RST_SET(RESET_CONTROL_SI0_RST_RESET)) -#define RESET_CONTROL_HW_MASK (32'h0 | \ - RESET_CONTROL_WARM_RST_MASK | \ - RESET_CONTROL_CPU_WARM_RST_MASK | \ - RESET_CONTROL_MAC_COLD_RST_MASK | \ - RESET_CONTROL_MAC_WARM_RST_MASK) -#define RESET_CONTROL_SW_MASK (32'h0 | \ - RESET_CONTROL_CPU_INIT_RESET_MASK | \ - RESET_CONTROL_VMC_REMAP_RESET_MASK | \ - RESET_CONTROL_RST_OUT_MASK | \ - RESET_CONTROL_COLD_RST_MASK | \ - RESET_CONTROL_WARM_RST_MASK | \ - RESET_CONTROL_CPU_WARM_RST_MASK | \ - RESET_CONTROL_MAC_COLD_RST_MASK | \ - RESET_CONTROL_MAC_WARM_RST_MASK | \ - RESET_CONTROL_MBOX_RST_MASK | \ - RESET_CONTROL_UART_RST_MASK | \ - RESET_CONTROL_SI0_RST_MASK) - -#define XTAL_CONTROL_ADDRESS 'h00000004 -#define XTAL_CONTROL_TCXO_MSB 0 -#define XTAL_CONTROL_TCXO_LSB 0 -#define XTAL_CONTROL_TCXO_MASK 'h00000001 -#define XTAL_CONTROL_TCXO_GET(x) (((x) & XTAL_CONTROL_TCXO_MASK) >> XTAL_CONTROL_TCXO_LSB) -#define XTAL_CONTROL_TCXO_SET(x) (((32'd0 | (x)) << XTAL_CONTROL_TCXO_LSB) & XTAL_CONTROL_TCXO_MASK) -#define XTAL_CONTROL_TCXO_RESET 1'h0 -#define XTAL_CONTROL_RESET (32'h0 | \ - XTAL_CONTROL_TCXO_SET(XTAL_CONTROL_TCXO_RESET)) -#define XTAL_CONTROL_HW_MASK (32'h0) -#define XTAL_CONTROL_SW_MASK (32'h0 | \ - XTAL_CONTROL_TCXO_MASK) - -#define TCXO_DETECT_ADDRESS 'h00000008 -#define TCXO_DETECT_PRESENT_MSB 0 -#define TCXO_DETECT_PRESENT_LSB 0 -#define TCXO_DETECT_PRESENT_MASK 'h00000001 -#define TCXO_DETECT_PRESENT_GET(x) (((x) & TCXO_DETECT_PRESENT_MASK) >> TCXO_DETECT_PRESENT_LSB) -#define TCXO_DETECT_PRESENT_SET(x) (((32'd0 | (x)) << TCXO_DETECT_PRESENT_LSB) & TCXO_DETECT_PRESENT_MASK) -#define TCXO_DETECT_PRESENT_RESET 1'h0 -#define TCXO_DETECT_RESET (32'h0 | \ - TCXO_DETECT_PRESENT_SET(TCXO_DETECT_PRESENT_RESET)) -#define TCXO_DETECT_HW_MASK (32'h0 | \ - TCXO_DETECT_PRESENT_MASK) -#define TCXO_DETECT_SW_MASK (32'h0) - -#define XTAL_TEST_ADDRESS 'h0000000c -#define XTAL_TEST_NOTCXODET_MSB 0 -#define XTAL_TEST_NOTCXODET_LSB 0 -#define XTAL_TEST_NOTCXODET_MASK 'h00000001 -#define XTAL_TEST_NOTCXODET_GET(x) (((x) & XTAL_TEST_NOTCXODET_MASK) >> XTAL_TEST_NOTCXODET_LSB) -#define XTAL_TEST_NOTCXODET_SET(x) (((32'd0 | (x)) << XTAL_TEST_NOTCXODET_LSB) & XTAL_TEST_NOTCXODET_MASK) -#define XTAL_TEST_NOTCXODET_RESET 1'h0 -#define XTAL_TEST_RESET (32'h0 | \ - XTAL_TEST_NOTCXODET_SET(XTAL_TEST_NOTCXODET_RESET)) -#define XTAL_TEST_HW_MASK (32'h0) -#define XTAL_TEST_SW_MASK (32'h0 | \ - XTAL_TEST_NOTCXODET_MASK) - -#define QUADRATURE_ADDRESS 'h00000010 -#define QUADRATURE_ADC_MSB 5 -#define QUADRATURE_ADC_LSB 4 -#define QUADRATURE_ADC_MASK 'h00000030 -#define QUADRATURE_ADC_GET(x) (((x) & QUADRATURE_ADC_MASK) >> QUADRATURE_ADC_LSB) -#define QUADRATURE_ADC_SET(x) (((32'd0 | (x)) << QUADRATURE_ADC_LSB) & QUADRATURE_ADC_MASK) -#define QUADRATURE_ADC_RESET 2'h0 -#define QUADRATURE_SEL_MSB 2 -#define QUADRATURE_SEL_LSB 2 -#define QUADRATURE_SEL_MASK 'h00000004 -#define QUADRATURE_SEL_GET(x) (((x) & QUADRATURE_SEL_MASK) >> QUADRATURE_SEL_LSB) -#define QUADRATURE_SEL_SET(x) (((32'd0 | (x)) << QUADRATURE_SEL_LSB) & QUADRATURE_SEL_MASK) -#define QUADRATURE_SEL_RESET 1'h0 -#define QUADRATURE_DAC_MSB 1 -#define QUADRATURE_DAC_LSB 0 -#define QUADRATURE_DAC_MASK 'h00000003 -#define QUADRATURE_DAC_GET(x) (((x) & QUADRATURE_DAC_MASK) >> QUADRATURE_DAC_LSB) -#define QUADRATURE_DAC_SET(x) (((32'd0 | (x)) << QUADRATURE_DAC_LSB) & QUADRATURE_DAC_MASK) -#define QUADRATURE_DAC_RESET 2'h2 -#define QUADRATURE_RESET (32'h0 | \ - QUADRATURE_ADC_SET(QUADRATURE_ADC_RESET) | \ - QUADRATURE_SEL_SET(QUADRATURE_SEL_RESET) | \ - QUADRATURE_DAC_SET(QUADRATURE_DAC_RESET)) -#define QUADRATURE_HW_MASK (32'h0) -#define QUADRATURE_SW_MASK (32'h0 | \ - QUADRATURE_ADC_MASK | \ - QUADRATURE_SEL_MASK | \ - QUADRATURE_DAC_MASK) - -#define PLL_CONTROL_ADDRESS 'h00000014 -#define PLL_CONTROL_DIG_TEST_CLK_MSB 20 -#define PLL_CONTROL_DIG_TEST_CLK_LSB 20 -#define PLL_CONTROL_DIG_TEST_CLK_MASK 'h00100000 -#define PLL_CONTROL_DIG_TEST_CLK_GET(x) (((x) & PLL_CONTROL_DIG_TEST_CLK_MASK) >> PLL_CONTROL_DIG_TEST_CLK_LSB) -#define PLL_CONTROL_DIG_TEST_CLK_SET(x) (((32'd0 | (x)) << PLL_CONTROL_DIG_TEST_CLK_LSB) & PLL_CONTROL_DIG_TEST_CLK_MASK) -#define PLL_CONTROL_DIG_TEST_CLK_RESET 1'h0 -#define PLL_CONTROL_MAC_OVERRIDE_MSB 19 -#define PLL_CONTROL_MAC_OVERRIDE_LSB 19 -#define PLL_CONTROL_MAC_OVERRIDE_MASK 'h00080000 -#define PLL_CONTROL_MAC_OVERRIDE_GET(x) (((x) & PLL_CONTROL_MAC_OVERRIDE_MASK) >> PLL_CONTROL_MAC_OVERRIDE_LSB) -#define PLL_CONTROL_MAC_OVERRIDE_SET(x) (((32'd0 | (x)) << PLL_CONTROL_MAC_OVERRIDE_LSB) & PLL_CONTROL_MAC_OVERRIDE_MASK) -#define PLL_CONTROL_MAC_OVERRIDE_RESET 1'h0 -#define PLL_CONTROL_NOPWD_MSB 18 -#define PLL_CONTROL_NOPWD_LSB 18 -#define PLL_CONTROL_NOPWD_MASK 'h00040000 -#define PLL_CONTROL_NOPWD_GET(x) (((x) & PLL_CONTROL_NOPWD_MASK) >> PLL_CONTROL_NOPWD_LSB) -#define PLL_CONTROL_NOPWD_SET(x) (((32'd0 | (x)) << PLL_CONTROL_NOPWD_LSB) & PLL_CONTROL_NOPWD_MASK) -#define PLL_CONTROL_NOPWD_RESET 1'h0 -#define PLL_CONTROL_UPDATING_MSB 17 -#define PLL_CONTROL_UPDATING_LSB 17 -#define PLL_CONTROL_UPDATING_MASK 'h00020000 -#define PLL_CONTROL_UPDATING_GET(x) (((x) & PLL_CONTROL_UPDATING_MASK) >> PLL_CONTROL_UPDATING_LSB) -#define PLL_CONTROL_UPDATING_SET(x) (((32'd0 | (x)) << PLL_CONTROL_UPDATING_LSB) & PLL_CONTROL_UPDATING_MASK) -#define PLL_CONTROL_UPDATING_RESET 1'h0 -#define PLL_CONTROL_BYPASS_MSB 16 -#define PLL_CONTROL_BYPASS_LSB 16 -#define PLL_CONTROL_BYPASS_MASK 'h00010000 -#define PLL_CONTROL_BYPASS_GET(x) (((x) & PLL_CONTROL_BYPASS_MASK) >> PLL_CONTROL_BYPASS_LSB) -#define PLL_CONTROL_BYPASS_SET(x) (((32'd0 | (x)) << PLL_CONTROL_BYPASS_LSB) & PLL_CONTROL_BYPASS_MASK) -#define PLL_CONTROL_BYPASS_RESET 1'h1 -#define PLL_CONTROL_REFDIV_MSB 15 -#define PLL_CONTROL_REFDIV_LSB 12 -#define PLL_CONTROL_REFDIV_MASK 'h0000f000 -#define PLL_CONTROL_REFDIV_GET(x) (((x) & PLL_CONTROL_REFDIV_MASK) >> PLL_CONTROL_REFDIV_LSB) -#define PLL_CONTROL_REFDIV_SET(x) (((32'd0 | (x)) << PLL_CONTROL_REFDIV_LSB) & PLL_CONTROL_REFDIV_MASK) -#define PLL_CONTROL_REFDIV_RESET 4'h5 -#define PLL_CONTROL_DIV_MSB 9 -#define PLL_CONTROL_DIV_LSB 0 -#define PLL_CONTROL_DIV_MASK 'h000003ff -#define PLL_CONTROL_DIV_GET(x) (((x) & PLL_CONTROL_DIV_MASK) >> PLL_CONTROL_DIV_LSB) -#define PLL_CONTROL_DIV_SET(x) (((32'd0 | (x)) << PLL_CONTROL_DIV_LSB) & PLL_CONTROL_DIV_MASK) -#define PLL_CONTROL_DIV_RESET 10'h28 -#define PLL_CONTROL_RESET (32'h0 | \ - PLL_CONTROL_DIG_TEST_CLK_SET(PLL_CONTROL_DIG_TEST_CLK_RESET) | \ - PLL_CONTROL_MAC_OVERRIDE_SET(PLL_CONTROL_MAC_OVERRIDE_RESET) | \ - PLL_CONTROL_NOPWD_SET(PLL_CONTROL_NOPWD_RESET) | \ - PLL_CONTROL_UPDATING_SET(PLL_CONTROL_UPDATING_RESET) | \ - PLL_CONTROL_BYPASS_SET(PLL_CONTROL_BYPASS_RESET) | \ - PLL_CONTROL_REFDIV_SET(PLL_CONTROL_REFDIV_RESET) | \ - PLL_CONTROL_DIV_SET(PLL_CONTROL_DIV_RESET)) -#define PLL_CONTROL_HW_MASK (32'h0 | \ - PLL_CONTROL_UPDATING_MASK) -#define PLL_CONTROL_SW_MASK (32'h0 | \ - PLL_CONTROL_DIG_TEST_CLK_MASK | \ - PLL_CONTROL_MAC_OVERRIDE_MASK | \ - PLL_CONTROL_NOPWD_MASK | \ - PLL_CONTROL_BYPASS_MASK | \ - PLL_CONTROL_REFDIV_MASK | \ - PLL_CONTROL_DIV_MASK) - -#define PLL_SETTLE_ADDRESS 'h00000018 -#define PLL_SETTLE_TIME_MSB 11 -#define PLL_SETTLE_TIME_LSB 0 -#define PLL_SETTLE_TIME_MASK 'h00000fff -#define PLL_SETTLE_TIME_GET(x) (((x) & PLL_SETTLE_TIME_MASK) >> PLL_SETTLE_TIME_LSB) -#define PLL_SETTLE_TIME_SET(x) (((32'd0 | (x)) << PLL_SETTLE_TIME_LSB) & PLL_SETTLE_TIME_MASK) -#define PLL_SETTLE_TIME_RESET 12'h400 -#define PLL_SETTLE_RESET (32'h0 | \ - PLL_SETTLE_TIME_SET(PLL_SETTLE_TIME_RESET)) -#define PLL_SETTLE_HW_MASK (32'h0) -#define PLL_SETTLE_SW_MASK (32'h0 | \ - PLL_SETTLE_TIME_MASK) - -#define XTAL_SETTLE_ADDRESS 'h0000001c -#define XTAL_SETTLE_TIME_MSB 7 -#define XTAL_SETTLE_TIME_LSB 0 -#define XTAL_SETTLE_TIME_MASK 'h000000ff -#define XTAL_SETTLE_TIME_GET(x) (((x) & XTAL_SETTLE_TIME_MASK) >> XTAL_SETTLE_TIME_LSB) -#define XTAL_SETTLE_TIME_SET(x) (((32'd0 | (x)) << XTAL_SETTLE_TIME_LSB) & XTAL_SETTLE_TIME_MASK) -#define XTAL_SETTLE_TIME_RESET 8'h7f -#define XTAL_SETTLE_RESET (32'h0 | \ - XTAL_SETTLE_TIME_SET(XTAL_SETTLE_TIME_RESET)) -#define XTAL_SETTLE_HW_MASK (32'h0 | \ - XTAL_SETTLE_TIME_MASK) -#define XTAL_SETTLE_SW_MASK (32'h0 | \ - XTAL_SETTLE_TIME_MASK) - -#define CPU_CLOCK_ADDRESS 'h00000020 -#define CPU_CLOCK_STANDARD_MSB 1 -#define CPU_CLOCK_STANDARD_LSB 0 -#define CPU_CLOCK_STANDARD_MASK 'h00000003 -#define CPU_CLOCK_STANDARD_GET(x) (((x) & CPU_CLOCK_STANDARD_MASK) >> CPU_CLOCK_STANDARD_LSB) -#define CPU_CLOCK_STANDARD_SET(x) (((32'd0 | (x)) << CPU_CLOCK_STANDARD_LSB) & CPU_CLOCK_STANDARD_MASK) -#define CPU_CLOCK_STANDARD_RESET 2'h3 -#define CPU_CLOCK_RESET (32'h0 | \ - CPU_CLOCK_STANDARD_SET(CPU_CLOCK_STANDARD_RESET)) -#define CPU_CLOCK_HW_MASK (32'h0) -#define CPU_CLOCK_SW_MASK (32'h0 | \ - CPU_CLOCK_STANDARD_MASK) - -#define CLOCK_OUT_ADDRESS 'h00000024 -#define CLOCK_OUT_SELECT_MSB 3 -#define CLOCK_OUT_SELECT_LSB 0 -#define CLOCK_OUT_SELECT_MASK 'h0000000f -#define CLOCK_OUT_SELECT_GET(x) (((x) & CLOCK_OUT_SELECT_MASK) >> CLOCK_OUT_SELECT_LSB) -#define CLOCK_OUT_SELECT_SET(x) (((32'd0 | (x)) << CLOCK_OUT_SELECT_LSB) & CLOCK_OUT_SELECT_MASK) -#define CLOCK_OUT_SELECT_RESET 4'hf -#define CLOCK_OUT_RESET (32'h0 | \ - CLOCK_OUT_SELECT_SET(CLOCK_OUT_SELECT_RESET)) -#define CLOCK_OUT_HW_MASK (32'h0) -#define CLOCK_OUT_SW_MASK (32'h0 | \ - CLOCK_OUT_SELECT_MASK) - -#define CLOCK_CONTROL_ADDRESS 'h00000028 -#define CLOCK_CONTROL_LF_CLK32_MSB 2 -#define CLOCK_CONTROL_LF_CLK32_LSB 2 -#define CLOCK_CONTROL_LF_CLK32_MASK 'h00000004 -#define CLOCK_CONTROL_LF_CLK32_GET(x) (((x) & CLOCK_CONTROL_LF_CLK32_MASK) >> CLOCK_CONTROL_LF_CLK32_LSB) -#define CLOCK_CONTROL_LF_CLK32_SET(x) (((32'd0 | (x)) << CLOCK_CONTROL_LF_CLK32_LSB) & CLOCK_CONTROL_LF_CLK32_MASK) -#define CLOCK_CONTROL_LF_CLK32_RESET 1'h0 -#define CLOCK_CONTROL_UART_CLK_MSB 1 -#define CLOCK_CONTROL_UART_CLK_LSB 1 -#define CLOCK_CONTROL_UART_CLK_MASK 'h00000002 -#define CLOCK_CONTROL_UART_CLK_GET(x) (((x) & CLOCK_CONTROL_UART_CLK_MASK) >> CLOCK_CONTROL_UART_CLK_LSB) -#define CLOCK_CONTROL_UART_CLK_SET(x) (((32'd0 | (x)) << CLOCK_CONTROL_UART_CLK_LSB) & CLOCK_CONTROL_UART_CLK_MASK) -#define CLOCK_CONTROL_UART_CLK_RESET 1'h0 -#define CLOCK_CONTROL_SI0_CLK_MSB 0 -#define CLOCK_CONTROL_SI0_CLK_LSB 0 -#define CLOCK_CONTROL_SI0_CLK_MASK 'h00000001 -#define CLOCK_CONTROL_SI0_CLK_GET(x) (((x) & CLOCK_CONTROL_SI0_CLK_MASK) >> CLOCK_CONTROL_SI0_CLK_LSB) -#define CLOCK_CONTROL_SI0_CLK_SET(x) (((32'd0 | (x)) << CLOCK_CONTROL_SI0_CLK_LSB) & CLOCK_CONTROL_SI0_CLK_MASK) -#define CLOCK_CONTROL_SI0_CLK_RESET 1'h1 -#define CLOCK_CONTROL_RESET (32'h0 | \ - CLOCK_CONTROL_LF_CLK32_SET(CLOCK_CONTROL_LF_CLK32_RESET) | \ - CLOCK_CONTROL_UART_CLK_SET(CLOCK_CONTROL_UART_CLK_RESET) | \ - CLOCK_CONTROL_SI0_CLK_SET(CLOCK_CONTROL_SI0_CLK_RESET)) -#define CLOCK_CONTROL_HW_MASK (32'h0) -#define CLOCK_CONTROL_SW_MASK (32'h0 | \ - CLOCK_CONTROL_LF_CLK32_MASK | \ - CLOCK_CONTROL_UART_CLK_MASK | \ - CLOCK_CONTROL_SI0_CLK_MASK) - -#define BIAS_OVERRIDE_ADDRESS 'h0000002c -#define BIAS_OVERRIDE_ON_MSB 0 -#define BIAS_OVERRIDE_ON_LSB 0 -#define BIAS_OVERRIDE_ON_MASK 'h00000001 -#define BIAS_OVERRIDE_ON_GET(x) (((x) & BIAS_OVERRIDE_ON_MASK) >> BIAS_OVERRIDE_ON_LSB) -#define BIAS_OVERRIDE_ON_SET(x) (((32'd0 | (x)) << BIAS_OVERRIDE_ON_LSB) & BIAS_OVERRIDE_ON_MASK) -#define BIAS_OVERRIDE_ON_RESET 1'h0 -#define BIAS_OVERRIDE_RESET (32'h0 | \ - BIAS_OVERRIDE_ON_SET(BIAS_OVERRIDE_ON_RESET)) -#define BIAS_OVERRIDE_HW_MASK (32'h0) -#define BIAS_OVERRIDE_SW_MASK (32'h0 | \ - BIAS_OVERRIDE_ON_MASK) - -#define WDT_CONTROL_ADDRESS 'h00000030 -#define WDT_CONTROL_ACTION_MSB 2 -#define WDT_CONTROL_ACTION_LSB 0 -#define WDT_CONTROL_ACTION_MASK 'h00000007 -#define WDT_CONTROL_ACTION_GET(x) (((x) & WDT_CONTROL_ACTION_MASK) >> WDT_CONTROL_ACTION_LSB) -#define WDT_CONTROL_ACTION_SET(x) (((32'd0 | (x)) << WDT_CONTROL_ACTION_LSB) & WDT_CONTROL_ACTION_MASK) -#define WDT_CONTROL_ACTION_RESET 3'h2 -#define WDT_CONTROL_RESET (32'h0 | \ - WDT_CONTROL_ACTION_SET(WDT_CONTROL_ACTION_RESET)) -#define WDT_CONTROL_HW_MASK (32'h0) -#define WDT_CONTROL_SW_MASK (32'h0 | \ - WDT_CONTROL_ACTION_MASK) - -#define WDT_STATUS_ADDRESS 'h00000034 -#define WDT_STATUS_INTERRUPT_MSB 0 -#define WDT_STATUS_INTERRUPT_LSB 0 -#define WDT_STATUS_INTERRUPT_MASK 'h00000001 -#define WDT_STATUS_INTERRUPT_GET(x) (((x) & WDT_STATUS_INTERRUPT_MASK) >> WDT_STATUS_INTERRUPT_LSB) -#define WDT_STATUS_INTERRUPT_SET(x) (((32'd0 | (x)) << WDT_STATUS_INTERRUPT_LSB) & WDT_STATUS_INTERRUPT_MASK) -#define WDT_STATUS_INTERRUPT_RESET 1'h0 -#define WDT_STATUS_RESET (32'h0 | \ - WDT_STATUS_INTERRUPT_SET(WDT_STATUS_INTERRUPT_RESET)) -#define WDT_STATUS_HW_MASK (32'h0 | \ - WDT_STATUS_INTERRUPT_MASK) -#define WDT_STATUS_SW_MASK (32'h0 | \ - WDT_STATUS_INTERRUPT_MASK) - -#define WDT_ADDRESS 'h00000038 -#define WDT_TARGET_MSB 21 -#define WDT_TARGET_LSB 0 -#define WDT_TARGET_MASK 'h003fffff -#define WDT_TARGET_GET(x) (((x) & WDT_TARGET_MASK) >> WDT_TARGET_LSB) -#define WDT_TARGET_SET(x) (((32'd0 | (x)) << WDT_TARGET_LSB) & WDT_TARGET_MASK) -#define WDT_TARGET_RESET 22'h3fffff -#define WDT_RESET (32'h0 | \ - WDT_TARGET_SET(WDT_TARGET_RESET)) -#define WDT_HW_MASK (32'h0) -#define WDT_SW_MASK (32'h0 | \ - WDT_TARGET_MASK) - -#define WDT_COUNT_ADDRESS 'h0000003c -#define WDT_COUNT_VALUE_MSB 21 -#define WDT_COUNT_VALUE_LSB 0 -#define WDT_COUNT_VALUE_MASK 'h003fffff -#define WDT_COUNT_VALUE_GET(x) (((x) & WDT_COUNT_VALUE_MASK) >> WDT_COUNT_VALUE_LSB) -#define WDT_COUNT_VALUE_SET(x) (((32'd0 | (x)) << WDT_COUNT_VALUE_LSB) & WDT_COUNT_VALUE_MASK) -#define WDT_COUNT_VALUE_RESET 22'h0 -#define WDT_COUNT_RESET (32'h0 | \ - WDT_COUNT_VALUE_SET(WDT_COUNT_VALUE_RESET)) -#define WDT_COUNT_HW_MASK (32'h0 | \ - WDT_COUNT_VALUE_MASK) -#define WDT_COUNT_SW_MASK (32'h0) - -#define WDT_RESET_ADDRESS 'h00000040 -#define WDT_RESET_VALUE_MSB 0 -#define WDT_RESET_VALUE_LSB 0 -#define WDT_RESET_VALUE_MASK 'h00000001 -#define WDT_RESET_VALUE_GET(x) (((x) & WDT_RESET_VALUE_MASK) >> WDT_RESET_VALUE_LSB) -#define WDT_RESET_VALUE_SET(x) (((32'd0 | (x)) << WDT_RESET_VALUE_LSB) & WDT_RESET_VALUE_MASK) -#define WDT_RESET_VALUE_RESET 1'h0 -#define WDT_RESET_RESET (32'h0 | \ - WDT_RESET_VALUE_SET(WDT_RESET_VALUE_RESET)) -#define WDT_RESET_HW_MASK (32'h0 | \ - WDT_RESET_VALUE_MASK) -#define WDT_RESET_SW_MASK (32'h0 | \ - WDT_RESET_VALUE_MASK) - -#define INT_STATUS_ADDRESS 'h00000044 -#define INT_STATUS_RTC_POWER_MSB 14 -#define INT_STATUS_RTC_POWER_LSB 14 -#define INT_STATUS_RTC_POWER_MASK 'h00004000 -#define INT_STATUS_RTC_POWER_GET(x) (((x) & INT_STATUS_RTC_POWER_MASK) >> INT_STATUS_RTC_POWER_LSB) -#define INT_STATUS_RTC_POWER_SET(x) (((32'd0 | (x)) << INT_STATUS_RTC_POWER_LSB) & INT_STATUS_RTC_POWER_MASK) -#define INT_STATUS_RTC_POWER_RESET 1'h0 -#define INT_STATUS_MAC_MSB 13 -#define INT_STATUS_MAC_LSB 13 -#define INT_STATUS_MAC_MASK 'h00002000 -#define INT_STATUS_MAC_GET(x) (((x) & INT_STATUS_MAC_MASK) >> INT_STATUS_MAC_LSB) -#define INT_STATUS_MAC_SET(x) (((32'd0 | (x)) << INT_STATUS_MAC_LSB) & INT_STATUS_MAC_MASK) -#define INT_STATUS_MAC_RESET 1'h0 -#define INT_STATUS_MAILBOX_MSB 12 -#define INT_STATUS_MAILBOX_LSB 12 -#define INT_STATUS_MAILBOX_MASK 'h00001000 -#define INT_STATUS_MAILBOX_GET(x) (((x) & INT_STATUS_MAILBOX_MASK) >> INT_STATUS_MAILBOX_LSB) -#define INT_STATUS_MAILBOX_SET(x) (((32'd0 | (x)) << INT_STATUS_MAILBOX_LSB) & INT_STATUS_MAILBOX_MASK) -#define INT_STATUS_MAILBOX_RESET 1'h0 -#define INT_STATUS_RTC_ALARM_MSB 11 -#define INT_STATUS_RTC_ALARM_LSB 11 -#define INT_STATUS_RTC_ALARM_MASK 'h00000800 -#define INT_STATUS_RTC_ALARM_GET(x) (((x) & INT_STATUS_RTC_ALARM_MASK) >> INT_STATUS_RTC_ALARM_LSB) -#define INT_STATUS_RTC_ALARM_SET(x) (((32'd0 | (x)) << INT_STATUS_RTC_ALARM_LSB) & INT_STATUS_RTC_ALARM_MASK) -#define INT_STATUS_RTC_ALARM_RESET 1'h0 -#define INT_STATUS_HF_TIMER_MSB 10 -#define INT_STATUS_HF_TIMER_LSB 10 -#define INT_STATUS_HF_TIMER_MASK 'h00000400 -#define INT_STATUS_HF_TIMER_GET(x) (((x) & INT_STATUS_HF_TIMER_MASK) >> INT_STATUS_HF_TIMER_LSB) -#define INT_STATUS_HF_TIMER_SET(x) (((32'd0 | (x)) << INT_STATUS_HF_TIMER_LSB) & INT_STATUS_HF_TIMER_MASK) -#define INT_STATUS_HF_TIMER_RESET 1'h0 -#define INT_STATUS_LF_TIMER3_MSB 9 -#define INT_STATUS_LF_TIMER3_LSB 9 -#define INT_STATUS_LF_TIMER3_MASK 'h00000200 -#define INT_STATUS_LF_TIMER3_GET(x) (((x) & INT_STATUS_LF_TIMER3_MASK) >> INT_STATUS_LF_TIMER3_LSB) -#define INT_STATUS_LF_TIMER3_SET(x) (((32'd0 | (x)) << INT_STATUS_LF_TIMER3_LSB) & INT_STATUS_LF_TIMER3_MASK) -#define INT_STATUS_LF_TIMER3_RESET 1'h0 -#define INT_STATUS_LF_TIMER2_MSB 8 -#define INT_STATUS_LF_TIMER2_LSB 8 -#define INT_STATUS_LF_TIMER2_MASK 'h00000100 -#define INT_STATUS_LF_TIMER2_GET(x) (((x) & INT_STATUS_LF_TIMER2_MASK) >> INT_STATUS_LF_TIMER2_LSB) -#define INT_STATUS_LF_TIMER2_SET(x) (((32'd0 | (x)) << INT_STATUS_LF_TIMER2_LSB) & INT_STATUS_LF_TIMER2_MASK) -#define INT_STATUS_LF_TIMER2_RESET 1'h0 -#define INT_STATUS_LF_TIMER1_MSB 7 -#define INT_STATUS_LF_TIMER1_LSB 7 -#define INT_STATUS_LF_TIMER1_MASK 'h00000080 -#define INT_STATUS_LF_TIMER1_GET(x) (((x) & INT_STATUS_LF_TIMER1_MASK) >> INT_STATUS_LF_TIMER1_LSB) -#define INT_STATUS_LF_TIMER1_SET(x) (((32'd0 | (x)) << INT_STATUS_LF_TIMER1_LSB) & INT_STATUS_LF_TIMER1_MASK) -#define INT_STATUS_LF_TIMER1_RESET 1'h0 -#define INT_STATUS_LF_TIMER0_MSB 6 -#define INT_STATUS_LF_TIMER0_LSB 6 -#define INT_STATUS_LF_TIMER0_MASK 'h00000040 -#define INT_STATUS_LF_TIMER0_GET(x) (((x) & INT_STATUS_LF_TIMER0_MASK) >> INT_STATUS_LF_TIMER0_LSB) -#define INT_STATUS_LF_TIMER0_SET(x) (((32'd0 | (x)) << INT_STATUS_LF_TIMER0_LSB) & INT_STATUS_LF_TIMER0_MASK) -#define INT_STATUS_LF_TIMER0_RESET 1'h0 -#define INT_STATUS_KEYPAD_MSB 5 -#define INT_STATUS_KEYPAD_LSB 5 -#define INT_STATUS_KEYPAD_MASK 'h00000020 -#define INT_STATUS_KEYPAD_GET(x) (((x) & INT_STATUS_KEYPAD_MASK) >> INT_STATUS_KEYPAD_LSB) -#define INT_STATUS_KEYPAD_SET(x) (((32'd0 | (x)) << INT_STATUS_KEYPAD_LSB) & INT_STATUS_KEYPAD_MASK) -#define INT_STATUS_KEYPAD_RESET 1'h0 -#define INT_STATUS_SI_MSB 4 -#define INT_STATUS_SI_LSB 4 -#define INT_STATUS_SI_MASK 'h00000010 -#define INT_STATUS_SI_GET(x) (((x) & INT_STATUS_SI_MASK) >> INT_STATUS_SI_LSB) -#define INT_STATUS_SI_SET(x) (((32'd0 | (x)) << INT_STATUS_SI_LSB) & INT_STATUS_SI_MASK) -#define INT_STATUS_SI_RESET 1'h0 -#define INT_STATUS_GPIO_MSB 3 -#define INT_STATUS_GPIO_LSB 3 -#define INT_STATUS_GPIO_MASK 'h00000008 -#define INT_STATUS_GPIO_GET(x) (((x) & INT_STATUS_GPIO_MASK) >> INT_STATUS_GPIO_LSB) -#define INT_STATUS_GPIO_SET(x) (((32'd0 | (x)) << INT_STATUS_GPIO_LSB) & INT_STATUS_GPIO_MASK) -#define INT_STATUS_GPIO_RESET 1'h0 -#define INT_STATUS_UART_MSB 2 -#define INT_STATUS_UART_LSB 2 -#define INT_STATUS_UART_MASK 'h00000004 -#define INT_STATUS_UART_GET(x) (((x) & INT_STATUS_UART_MASK) >> INT_STATUS_UART_LSB) -#define INT_STATUS_UART_SET(x) (((32'd0 | (x)) << INT_STATUS_UART_LSB) & INT_STATUS_UART_MASK) -#define INT_STATUS_UART_RESET 1'h0 -#define INT_STATUS_ERROR_MSB 1 -#define INT_STATUS_ERROR_LSB 1 -#define INT_STATUS_ERROR_MASK 'h00000002 -#define INT_STATUS_ERROR_GET(x) (((x) & INT_STATUS_ERROR_MASK) >> INT_STATUS_ERROR_LSB) -#define INT_STATUS_ERROR_SET(x) (((32'd0 | (x)) << INT_STATUS_ERROR_LSB) & INT_STATUS_ERROR_MASK) -#define INT_STATUS_ERROR_RESET 1'h0 -#define INT_STATUS_WDT_INT_MSB 0 -#define INT_STATUS_WDT_INT_LSB 0 -#define INT_STATUS_WDT_INT_MASK 'h00000001 -#define INT_STATUS_WDT_INT_GET(x) (((x) & INT_STATUS_WDT_INT_MASK) >> INT_STATUS_WDT_INT_LSB) -#define INT_STATUS_WDT_INT_SET(x) (((32'd0 | (x)) << INT_STATUS_WDT_INT_LSB) & INT_STATUS_WDT_INT_MASK) -#define INT_STATUS_WDT_INT_RESET 1'h0 -#define INT_STATUS_RESET (32'h0 | \ - INT_STATUS_RTC_POWER_SET(INT_STATUS_RTC_POWER_RESET) | \ - INT_STATUS_MAC_SET(INT_STATUS_MAC_RESET) | \ - INT_STATUS_MAILBOX_SET(INT_STATUS_MAILBOX_RESET) | \ - INT_STATUS_RTC_ALARM_SET(INT_STATUS_RTC_ALARM_RESET) | \ - INT_STATUS_HF_TIMER_SET(INT_STATUS_HF_TIMER_RESET) | \ - INT_STATUS_LF_TIMER3_SET(INT_STATUS_LF_TIMER3_RESET) | \ - INT_STATUS_LF_TIMER2_SET(INT_STATUS_LF_TIMER2_RESET) | \ - INT_STATUS_LF_TIMER1_SET(INT_STATUS_LF_TIMER1_RESET) | \ - INT_STATUS_LF_TIMER0_SET(INT_STATUS_LF_TIMER0_RESET) | \ - INT_STATUS_KEYPAD_SET(INT_STATUS_KEYPAD_RESET) | \ - INT_STATUS_SI_SET(INT_STATUS_SI_RESET) | \ - INT_STATUS_GPIO_SET(INT_STATUS_GPIO_RESET) | \ - INT_STATUS_UART_SET(INT_STATUS_UART_RESET) | \ - INT_STATUS_ERROR_SET(INT_STATUS_ERROR_RESET) | \ - INT_STATUS_WDT_INT_SET(INT_STATUS_WDT_INT_RESET)) -#define INT_STATUS_HW_MASK (32'h0 | \ - INT_STATUS_RTC_POWER_MASK | \ - INT_STATUS_MAC_MASK | \ - INT_STATUS_MAILBOX_MASK | \ - INT_STATUS_RTC_ALARM_MASK | \ - INT_STATUS_HF_TIMER_MASK | \ - INT_STATUS_LF_TIMER3_MASK | \ - INT_STATUS_LF_TIMER2_MASK | \ - INT_STATUS_LF_TIMER1_MASK | \ - INT_STATUS_LF_TIMER0_MASK | \ - INT_STATUS_KEYPAD_MASK | \ - INT_STATUS_SI_MASK | \ - INT_STATUS_GPIO_MASK | \ - INT_STATUS_UART_MASK | \ - INT_STATUS_ERROR_MASK | \ - INT_STATUS_WDT_INT_MASK) -#define INT_STATUS_SW_MASK (32'h0) - -#define LF_TIMER0_ADDRESS 'h00000048 -#define LF_TIMER0_TARGET_MSB 31 -#define LF_TIMER0_TARGET_LSB 0 -#define LF_TIMER0_TARGET_MASK 'hffffffff -#define LF_TIMER0_TARGET_GET(x) (((x) & LF_TIMER0_TARGET_MASK) >> LF_TIMER0_TARGET_LSB) -#define LF_TIMER0_TARGET_SET(x) (((32'd0 | (x)) << LF_TIMER0_TARGET_LSB) & LF_TIMER0_TARGET_MASK) -#define LF_TIMER0_TARGET_RESET 32'h0 -#define LF_TIMER0_RESET (32'h0 | \ - LF_TIMER0_TARGET_SET(LF_TIMER0_TARGET_RESET)) -#define LF_TIMER0_HW_MASK (32'h0) -#define LF_TIMER0_SW_MASK (32'h0 | \ - LF_TIMER0_TARGET_MASK) - -#define LF_TIMER_COUNT0_ADDRESS 'h0000004c -#define LF_TIMER_COUNT0_VALUE_MSB 31 -#define LF_TIMER_COUNT0_VALUE_LSB 0 -#define LF_TIMER_COUNT0_VALUE_MASK 'hffffffff -#define LF_TIMER_COUNT0_VALUE_GET(x) (((x) & LF_TIMER_COUNT0_VALUE_MASK) >> LF_TIMER_COUNT0_VALUE_LSB) -#define LF_TIMER_COUNT0_VALUE_SET(x) (((32'd0 | (x)) << LF_TIMER_COUNT0_VALUE_LSB) & LF_TIMER_COUNT0_VALUE_MASK) -#define LF_TIMER_COUNT0_VALUE_RESET 32'h0 -#define LF_TIMER_COUNT0_RESET (32'h0 | \ - LF_TIMER_COUNT0_VALUE_SET(LF_TIMER_COUNT0_VALUE_RESET)) -#define LF_TIMER_COUNT0_HW_MASK (32'h0 | \ - LF_TIMER_COUNT0_VALUE_MASK) -#define LF_TIMER_COUNT0_SW_MASK (32'h0) - -#define LF_TIMER_CONTROL0_ADDRESS 'h00000050 -#define LF_TIMER_CONTROL0_ENABLE_MSB 2 -#define LF_TIMER_CONTROL0_ENABLE_LSB 2 -#define LF_TIMER_CONTROL0_ENABLE_MASK 'h00000004 -#define LF_TIMER_CONTROL0_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL0_ENABLE_MASK) >> LF_TIMER_CONTROL0_ENABLE_LSB) -#define LF_TIMER_CONTROL0_ENABLE_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL0_ENABLE_LSB) & LF_TIMER_CONTROL0_ENABLE_MASK) -#define LF_TIMER_CONTROL0_ENABLE_RESET 1'h0 -#define LF_TIMER_CONTROL0_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL0_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL0_AUTO_RESTART_MASK 'h00000002 -#define LF_TIMER_CONTROL0_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL0_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL0_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL0_AUTO_RESTART_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL0_AUTO_RESTART_LSB) & LF_TIMER_CONTROL0_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL0_AUTO_RESTART_RESET 1'h0 -#define LF_TIMER_CONTROL0_RESET_MSB 0 -#define LF_TIMER_CONTROL0_RESET_LSB 0 -#define LF_TIMER_CONTROL0_RESET_MASK 'h00000001 -#define LF_TIMER_CONTROL0_RESET_GET(x) (((x) & LF_TIMER_CONTROL0_RESET_MASK) >> LF_TIMER_CONTROL0_RESET_LSB) -#define LF_TIMER_CONTROL0_RESET_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL0_RESET_LSB) & LF_TIMER_CONTROL0_RESET_MASK) -#define LF_TIMER_CONTROL0_RESET_RESET 1'h0 -#define LF_TIMER_CONTROL0_RESET (32'h0 | \ - LF_TIMER_CONTROL0_ENABLE_SET(LF_TIMER_CONTROL0_ENABLE_RESET) | \ - LF_TIMER_CONTROL0_AUTO_RESTART_SET(LF_TIMER_CONTROL0_AUTO_RESTART_RESET) | \ - LF_TIMER_CONTROL0_RESET_SET(LF_TIMER_CONTROL0_RESET_RESET)) -#define LF_TIMER_CONTROL0_HW_MASK (32'h0 | \ - LF_TIMER_CONTROL0_RESET_MASK) -#define LF_TIMER_CONTROL0_SW_MASK (32'h0 | \ - LF_TIMER_CONTROL0_ENABLE_MASK | \ - LF_TIMER_CONTROL0_AUTO_RESTART_MASK | \ - LF_TIMER_CONTROL0_RESET_MASK) - -#define LF_TIMER_STATUS0_ADDRESS 'h00000054 -#define LF_TIMER_STATUS0_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS0_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS0_INTERRUPT_MASK 'h00000001 -#define LF_TIMER_STATUS0_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS0_INTERRUPT_MASK) >> LF_TIMER_STATUS0_INTERRUPT_LSB) -#define LF_TIMER_STATUS0_INTERRUPT_SET(x) (((32'd0 | (x)) << LF_TIMER_STATUS0_INTERRUPT_LSB) & LF_TIMER_STATUS0_INTERRUPT_MASK) -#define LF_TIMER_STATUS0_INTERRUPT_RESET 1'h0 -#define LF_TIMER_STATUS0_RESET (32'h0 | \ - LF_TIMER_STATUS0_INTERRUPT_SET(LF_TIMER_STATUS0_INTERRUPT_RESET)) -#define LF_TIMER_STATUS0_HW_MASK (32'h0 | \ - LF_TIMER_STATUS0_INTERRUPT_MASK) -#define LF_TIMER_STATUS0_SW_MASK (32'h0 | \ - LF_TIMER_STATUS0_INTERRUPT_MASK) - -#define LF_TIMER1_ADDRESS 'h00000058 -#define LF_TIMER1_TARGET_MSB 31 -#define LF_TIMER1_TARGET_LSB 0 -#define LF_TIMER1_TARGET_MASK 'hffffffff -#define LF_TIMER1_TARGET_GET(x) (((x) & LF_TIMER1_TARGET_MASK) >> LF_TIMER1_TARGET_LSB) -#define LF_TIMER1_TARGET_SET(x) (((32'd0 | (x)) << LF_TIMER1_TARGET_LSB) & LF_TIMER1_TARGET_MASK) -#define LF_TIMER1_TARGET_RESET 32'h0 -#define LF_TIMER1_RESET (32'h0 | \ - LF_TIMER1_TARGET_SET(LF_TIMER1_TARGET_RESET)) -#define LF_TIMER1_HW_MASK (32'h0) -#define LF_TIMER1_SW_MASK (32'h0 | \ - LF_TIMER1_TARGET_MASK) - -#define LF_TIMER_COUNT1_ADDRESS 'h0000005c -#define LF_TIMER_COUNT1_VALUE_MSB 31 -#define LF_TIMER_COUNT1_VALUE_LSB 0 -#define LF_TIMER_COUNT1_VALUE_MASK 'hffffffff -#define LF_TIMER_COUNT1_VALUE_GET(x) (((x) & LF_TIMER_COUNT1_VALUE_MASK) >> LF_TIMER_COUNT1_VALUE_LSB) -#define LF_TIMER_COUNT1_VALUE_SET(x) (((32'd0 | (x)) << LF_TIMER_COUNT1_VALUE_LSB) & LF_TIMER_COUNT1_VALUE_MASK) -#define LF_TIMER_COUNT1_VALUE_RESET 32'h0 -#define LF_TIMER_COUNT1_RESET (32'h0 | \ - LF_TIMER_COUNT1_VALUE_SET(LF_TIMER_COUNT1_VALUE_RESET)) -#define LF_TIMER_COUNT1_HW_MASK (32'h0 | \ - LF_TIMER_COUNT1_VALUE_MASK) -#define LF_TIMER_COUNT1_SW_MASK (32'h0) - -#define LF_TIMER_CONTROL1_ADDRESS 'h00000060 -#define LF_TIMER_CONTROL1_ENABLE_MSB 2 -#define LF_TIMER_CONTROL1_ENABLE_LSB 2 -#define LF_TIMER_CONTROL1_ENABLE_MASK 'h00000004 -#define LF_TIMER_CONTROL1_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL1_ENABLE_MASK) >> LF_TIMER_CONTROL1_ENABLE_LSB) -#define LF_TIMER_CONTROL1_ENABLE_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL1_ENABLE_LSB) & LF_TIMER_CONTROL1_ENABLE_MASK) -#define LF_TIMER_CONTROL1_ENABLE_RESET 1'h0 -#define LF_TIMER_CONTROL1_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL1_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL1_AUTO_RESTART_MASK 'h00000002 -#define LF_TIMER_CONTROL1_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL1_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL1_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL1_AUTO_RESTART_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL1_AUTO_RESTART_LSB) & LF_TIMER_CONTROL1_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL1_AUTO_RESTART_RESET 1'h0 -#define LF_TIMER_CONTROL1_RESET_MSB 0 -#define LF_TIMER_CONTROL1_RESET_LSB 0 -#define LF_TIMER_CONTROL1_RESET_MASK 'h00000001 -#define LF_TIMER_CONTROL1_RESET_GET(x) (((x) & LF_TIMER_CONTROL1_RESET_MASK) >> LF_TIMER_CONTROL1_RESET_LSB) -#define LF_TIMER_CONTROL1_RESET_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL1_RESET_LSB) & LF_TIMER_CONTROL1_RESET_MASK) -#define LF_TIMER_CONTROL1_RESET_RESET 1'h0 -#define LF_TIMER_CONTROL1_RESET (32'h0 | \ - LF_TIMER_CONTROL1_ENABLE_SET(LF_TIMER_CONTROL1_ENABLE_RESET) | \ - LF_TIMER_CONTROL1_AUTO_RESTART_SET(LF_TIMER_CONTROL1_AUTO_RESTART_RESET) | \ - LF_TIMER_CONTROL1_RESET_SET(LF_TIMER_CONTROL1_RESET_RESET)) -#define LF_TIMER_CONTROL1_HW_MASK (32'h0 | \ - LF_TIMER_CONTROL1_RESET_MASK) -#define LF_TIMER_CONTROL1_SW_MASK (32'h0 | \ - LF_TIMER_CONTROL1_ENABLE_MASK | \ - LF_TIMER_CONTROL1_AUTO_RESTART_MASK | \ - LF_TIMER_CONTROL1_RESET_MASK) - -#define LF_TIMER_STATUS1_ADDRESS 'h00000064 -#define LF_TIMER_STATUS1_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS1_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS1_INTERRUPT_MASK 'h00000001 -#define LF_TIMER_STATUS1_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS1_INTERRUPT_MASK) >> LF_TIMER_STATUS1_INTERRUPT_LSB) -#define LF_TIMER_STATUS1_INTERRUPT_SET(x) (((32'd0 | (x)) << LF_TIMER_STATUS1_INTERRUPT_LSB) & LF_TIMER_STATUS1_INTERRUPT_MASK) -#define LF_TIMER_STATUS1_INTERRUPT_RESET 1'h0 -#define LF_TIMER_STATUS1_RESET (32'h0 | \ - LF_TIMER_STATUS1_INTERRUPT_SET(LF_TIMER_STATUS1_INTERRUPT_RESET)) -#define LF_TIMER_STATUS1_HW_MASK (32'h0 | \ - LF_TIMER_STATUS1_INTERRUPT_MASK) -#define LF_TIMER_STATUS1_SW_MASK (32'h0 | \ - LF_TIMER_STATUS1_INTERRUPT_MASK) - -#define LF_TIMER2_ADDRESS 'h00000068 -#define LF_TIMER2_TARGET_MSB 31 -#define LF_TIMER2_TARGET_LSB 0 -#define LF_TIMER2_TARGET_MASK 'hffffffff -#define LF_TIMER2_TARGET_GET(x) (((x) & LF_TIMER2_TARGET_MASK) >> LF_TIMER2_TARGET_LSB) -#define LF_TIMER2_TARGET_SET(x) (((32'd0 | (x)) << LF_TIMER2_TARGET_LSB) & LF_TIMER2_TARGET_MASK) -#define LF_TIMER2_TARGET_RESET 32'h0 -#define LF_TIMER2_RESET (32'h0 | \ - LF_TIMER2_TARGET_SET(LF_TIMER2_TARGET_RESET)) -#define LF_TIMER2_HW_MASK (32'h0) -#define LF_TIMER2_SW_MASK (32'h0 | \ - LF_TIMER2_TARGET_MASK) - -#define LF_TIMER_COUNT2_ADDRESS 'h0000006c -#define LF_TIMER_COUNT2_VALUE_MSB 31 -#define LF_TIMER_COUNT2_VALUE_LSB 0 -#define LF_TIMER_COUNT2_VALUE_MASK 'hffffffff -#define LF_TIMER_COUNT2_VALUE_GET(x) (((x) & LF_TIMER_COUNT2_VALUE_MASK) >> LF_TIMER_COUNT2_VALUE_LSB) -#define LF_TIMER_COUNT2_VALUE_SET(x) (((32'd0 | (x)) << LF_TIMER_COUNT2_VALUE_LSB) & LF_TIMER_COUNT2_VALUE_MASK) -#define LF_TIMER_COUNT2_VALUE_RESET 32'h0 -#define LF_TIMER_COUNT2_RESET (32'h0 | \ - LF_TIMER_COUNT2_VALUE_SET(LF_TIMER_COUNT2_VALUE_RESET)) -#define LF_TIMER_COUNT2_HW_MASK (32'h0 | \ - LF_TIMER_COUNT2_VALUE_MASK) -#define LF_TIMER_COUNT2_SW_MASK (32'h0) - -#define LF_TIMER_CONTROL2_ADDRESS 'h00000070 -#define LF_TIMER_CONTROL2_ENABLE_MSB 2 -#define LF_TIMER_CONTROL2_ENABLE_LSB 2 -#define LF_TIMER_CONTROL2_ENABLE_MASK 'h00000004 -#define LF_TIMER_CONTROL2_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL2_ENABLE_MASK) >> LF_TIMER_CONTROL2_ENABLE_LSB) -#define LF_TIMER_CONTROL2_ENABLE_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL2_ENABLE_LSB) & LF_TIMER_CONTROL2_ENABLE_MASK) -#define LF_TIMER_CONTROL2_ENABLE_RESET 1'h0 -#define LF_TIMER_CONTROL2_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL2_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL2_AUTO_RESTART_MASK 'h00000002 -#define LF_TIMER_CONTROL2_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL2_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL2_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL2_AUTO_RESTART_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL2_AUTO_RESTART_LSB) & LF_TIMER_CONTROL2_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL2_AUTO_RESTART_RESET 1'h0 -#define LF_TIMER_CONTROL2_RESET_MSB 0 -#define LF_TIMER_CONTROL2_RESET_LSB 0 -#define LF_TIMER_CONTROL2_RESET_MASK 'h00000001 -#define LF_TIMER_CONTROL2_RESET_GET(x) (((x) & LF_TIMER_CONTROL2_RESET_MASK) >> LF_TIMER_CONTROL2_RESET_LSB) -#define LF_TIMER_CONTROL2_RESET_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL2_RESET_LSB) & LF_TIMER_CONTROL2_RESET_MASK) -#define LF_TIMER_CONTROL2_RESET_RESET 1'h0 -#define LF_TIMER_CONTROL2_RESET (32'h0 | \ - LF_TIMER_CONTROL2_ENABLE_SET(LF_TIMER_CONTROL2_ENABLE_RESET) | \ - LF_TIMER_CONTROL2_AUTO_RESTART_SET(LF_TIMER_CONTROL2_AUTO_RESTART_RESET) | \ - LF_TIMER_CONTROL2_RESET_SET(LF_TIMER_CONTROL2_RESET_RESET)) -#define LF_TIMER_CONTROL2_HW_MASK (32'h0 | \ - LF_TIMER_CONTROL2_RESET_MASK) -#define LF_TIMER_CONTROL2_SW_MASK (32'h0 | \ - LF_TIMER_CONTROL2_ENABLE_MASK | \ - LF_TIMER_CONTROL2_AUTO_RESTART_MASK | \ - LF_TIMER_CONTROL2_RESET_MASK) - -#define LF_TIMER_STATUS2_ADDRESS 'h00000074 -#define LF_TIMER_STATUS2_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS2_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS2_INTERRUPT_MASK 'h00000001 -#define LF_TIMER_STATUS2_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS2_INTERRUPT_MASK) >> LF_TIMER_STATUS2_INTERRUPT_LSB) -#define LF_TIMER_STATUS2_INTERRUPT_SET(x) (((32'd0 | (x)) << LF_TIMER_STATUS2_INTERRUPT_LSB) & LF_TIMER_STATUS2_INTERRUPT_MASK) -#define LF_TIMER_STATUS2_INTERRUPT_RESET 1'h0 -#define LF_TIMER_STATUS2_RESET (32'h0 | \ - LF_TIMER_STATUS2_INTERRUPT_SET(LF_TIMER_STATUS2_INTERRUPT_RESET)) -#define LF_TIMER_STATUS2_HW_MASK (32'h0 | \ - LF_TIMER_STATUS2_INTERRUPT_MASK) -#define LF_TIMER_STATUS2_SW_MASK (32'h0 | \ - LF_TIMER_STATUS2_INTERRUPT_MASK) - -#define LF_TIMER3_ADDRESS 'h00000078 -#define LF_TIMER3_TARGET_MSB 31 -#define LF_TIMER3_TARGET_LSB 0 -#define LF_TIMER3_TARGET_MASK 'hffffffff -#define LF_TIMER3_TARGET_GET(x) (((x) & LF_TIMER3_TARGET_MASK) >> LF_TIMER3_TARGET_LSB) -#define LF_TIMER3_TARGET_SET(x) (((32'd0 | (x)) << LF_TIMER3_TARGET_LSB) & LF_TIMER3_TARGET_MASK) -#define LF_TIMER3_TARGET_RESET 32'h0 -#define LF_TIMER3_RESET (32'h0 | \ - LF_TIMER3_TARGET_SET(LF_TIMER3_TARGET_RESET)) -#define LF_TIMER3_HW_MASK (32'h0) -#define LF_TIMER3_SW_MASK (32'h0 | \ - LF_TIMER3_TARGET_MASK) - -#define LF_TIMER_COUNT3_ADDRESS 'h0000007c -#define LF_TIMER_COUNT3_VALUE_MSB 31 -#define LF_TIMER_COUNT3_VALUE_LSB 0 -#define LF_TIMER_COUNT3_VALUE_MASK 'hffffffff -#define LF_TIMER_COUNT3_VALUE_GET(x) (((x) & LF_TIMER_COUNT3_VALUE_MASK) >> LF_TIMER_COUNT3_VALUE_LSB) -#define LF_TIMER_COUNT3_VALUE_SET(x) (((32'd0 | (x)) << LF_TIMER_COUNT3_VALUE_LSB) & LF_TIMER_COUNT3_VALUE_MASK) -#define LF_TIMER_COUNT3_VALUE_RESET 32'h0 -#define LF_TIMER_COUNT3_RESET (32'h0 | \ - LF_TIMER_COUNT3_VALUE_SET(LF_TIMER_COUNT3_VALUE_RESET)) -#define LF_TIMER_COUNT3_HW_MASK (32'h0 | \ - LF_TIMER_COUNT3_VALUE_MASK) -#define LF_TIMER_COUNT3_SW_MASK (32'h0) - -#define LF_TIMER_CONTROL3_ADDRESS 'h00000080 -#define LF_TIMER_CONTROL3_ENABLE_MSB 2 -#define LF_TIMER_CONTROL3_ENABLE_LSB 2 -#define LF_TIMER_CONTROL3_ENABLE_MASK 'h00000004 -#define LF_TIMER_CONTROL3_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL3_ENABLE_MASK) >> LF_TIMER_CONTROL3_ENABLE_LSB) -#define LF_TIMER_CONTROL3_ENABLE_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL3_ENABLE_LSB) & LF_TIMER_CONTROL3_ENABLE_MASK) -#define LF_TIMER_CONTROL3_ENABLE_RESET 1'h0 -#define LF_TIMER_CONTROL3_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL3_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL3_AUTO_RESTART_MASK 'h00000002 -#define LF_TIMER_CONTROL3_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL3_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL3_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL3_AUTO_RESTART_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL3_AUTO_RESTART_LSB) & LF_TIMER_CONTROL3_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL3_AUTO_RESTART_RESET 1'h0 -#define LF_TIMER_CONTROL3_RESET_MSB 0 -#define LF_TIMER_CONTROL3_RESET_LSB 0 -#define LF_TIMER_CONTROL3_RESET_MASK 'h00000001 -#define LF_TIMER_CONTROL3_RESET_GET(x) (((x) & LF_TIMER_CONTROL3_RESET_MASK) >> LF_TIMER_CONTROL3_RESET_LSB) -#define LF_TIMER_CONTROL3_RESET_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL3_RESET_LSB) & LF_TIMER_CONTROL3_RESET_MASK) -#define LF_TIMER_CONTROL3_RESET_RESET 1'h0 -#define LF_TIMER_CONTROL3_RESET (32'h0 | \ - LF_TIMER_CONTROL3_ENABLE_SET(LF_TIMER_CONTROL3_ENABLE_RESET) | \ - LF_TIMER_CONTROL3_AUTO_RESTART_SET(LF_TIMER_CONTROL3_AUTO_RESTART_RESET) | \ - LF_TIMER_CONTROL3_RESET_SET(LF_TIMER_CONTROL3_RESET_RESET)) -#define LF_TIMER_CONTROL3_HW_MASK (32'h0 | \ - LF_TIMER_CONTROL3_RESET_MASK) -#define LF_TIMER_CONTROL3_SW_MASK (32'h0 | \ - LF_TIMER_CONTROL3_ENABLE_MASK | \ - LF_TIMER_CONTROL3_AUTO_RESTART_MASK | \ - LF_TIMER_CONTROL3_RESET_MASK) - -#define LF_TIMER_STATUS3_ADDRESS 'h00000084 -#define LF_TIMER_STATUS3_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS3_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS3_INTERRUPT_MASK 'h00000001 -#define LF_TIMER_STATUS3_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS3_INTERRUPT_MASK) >> LF_TIMER_STATUS3_INTERRUPT_LSB) -#define LF_TIMER_STATUS3_INTERRUPT_SET(x) (((32'd0 | (x)) << LF_TIMER_STATUS3_INTERRUPT_LSB) & LF_TIMER_STATUS3_INTERRUPT_MASK) -#define LF_TIMER_STATUS3_INTERRUPT_RESET 1'h0 -#define LF_TIMER_STATUS3_RESET (32'h0 | \ - LF_TIMER_STATUS3_INTERRUPT_SET(LF_TIMER_STATUS3_INTERRUPT_RESET)) -#define LF_TIMER_STATUS3_HW_MASK (32'h0 | \ - LF_TIMER_STATUS3_INTERRUPT_MASK) -#define LF_TIMER_STATUS3_SW_MASK (32'h0 | \ - LF_TIMER_STATUS3_INTERRUPT_MASK) - -#define HF_TIMER_ADDRESS 'h00000088 -#define HF_TIMER_TARGET_MSB 31 -#define HF_TIMER_TARGET_LSB 12 -#define HF_TIMER_TARGET_MASK 'hfffff000 -#define HF_TIMER_TARGET_GET(x) (((x) & HF_TIMER_TARGET_MASK) >> HF_TIMER_TARGET_LSB) -#define HF_TIMER_TARGET_SET(x) (((32'd0 | (x)) << HF_TIMER_TARGET_LSB) & HF_TIMER_TARGET_MASK) -#define HF_TIMER_TARGET_RESET 20'h0 -#define HF_TIMER_RESET (32'h0 | \ - HF_TIMER_TARGET_SET(HF_TIMER_TARGET_RESET)) -#define HF_TIMER_HW_MASK (32'h0) -#define HF_TIMER_SW_MASK (32'h0 | \ - HF_TIMER_TARGET_MASK) - -#define HF_TIMER_COUNT_ADDRESS 'h0000008c -#define HF_TIMER_COUNT_VALUE_MSB 31 -#define HF_TIMER_COUNT_VALUE_LSB 12 -#define HF_TIMER_COUNT_VALUE_MASK 'hfffff000 -#define HF_TIMER_COUNT_VALUE_GET(x) (((x) & HF_TIMER_COUNT_VALUE_MASK) >> HF_TIMER_COUNT_VALUE_LSB) -#define HF_TIMER_COUNT_VALUE_SET(x) (((32'd0 | (x)) << HF_TIMER_COUNT_VALUE_LSB) & HF_TIMER_COUNT_VALUE_MASK) -#define HF_TIMER_COUNT_VALUE_RESET 20'h0 -#define HF_TIMER_COUNT_RESET (32'h0 | \ - HF_TIMER_COUNT_VALUE_SET(HF_TIMER_COUNT_VALUE_RESET)) -#define HF_TIMER_COUNT_HW_MASK (32'h0 | \ - HF_TIMER_COUNT_VALUE_MASK) -#define HF_TIMER_COUNT_SW_MASK (32'h0) - -#define HF_LF_COUNT_ADDRESS 'h00000090 -#define HF_LF_COUNT_VALUE_MSB 31 -#define HF_LF_COUNT_VALUE_LSB 0 -#define HF_LF_COUNT_VALUE_MASK 'hffffffff -#define HF_LF_COUNT_VALUE_GET(x) (((x) & HF_LF_COUNT_VALUE_MASK) >> HF_LF_COUNT_VALUE_LSB) -#define HF_LF_COUNT_VALUE_SET(x) (((32'd0 | (x)) << HF_LF_COUNT_VALUE_LSB) & HF_LF_COUNT_VALUE_MASK) -#define HF_LF_COUNT_VALUE_RESET 32'h0 -#define HF_LF_COUNT_RESET (32'h0 | \ - HF_LF_COUNT_VALUE_SET(HF_LF_COUNT_VALUE_RESET)) -#define HF_LF_COUNT_HW_MASK (32'h0 | \ - HF_LF_COUNT_VALUE_MASK) -#define HF_LF_COUNT_SW_MASK (32'h0) - -#define HF_TIMER_CONTROL_ADDRESS 'h00000094 -#define HF_TIMER_CONTROL_ENABLE_MSB 3 -#define HF_TIMER_CONTROL_ENABLE_LSB 3 -#define HF_TIMER_CONTROL_ENABLE_MASK 'h00000008 -#define HF_TIMER_CONTROL_ENABLE_GET(x) (((x) & HF_TIMER_CONTROL_ENABLE_MASK) >> HF_TIMER_CONTROL_ENABLE_LSB) -#define HF_TIMER_CONTROL_ENABLE_SET(x) (((32'd0 | (x)) << HF_TIMER_CONTROL_ENABLE_LSB) & HF_TIMER_CONTROL_ENABLE_MASK) -#define HF_TIMER_CONTROL_ENABLE_RESET 1'h1 -#define HF_TIMER_CONTROL_ON_MSB 2 -#define HF_TIMER_CONTROL_ON_LSB 2 -#define HF_TIMER_CONTROL_ON_MASK 'h00000004 -#define HF_TIMER_CONTROL_ON_GET(x) (((x) & HF_TIMER_CONTROL_ON_MASK) >> HF_TIMER_CONTROL_ON_LSB) -#define HF_TIMER_CONTROL_ON_SET(x) (((32'd0 | (x)) << HF_TIMER_CONTROL_ON_LSB) & HF_TIMER_CONTROL_ON_MASK) -#define HF_TIMER_CONTROL_ON_RESET 1'h0 -#define HF_TIMER_CONTROL_AUTO_RESTART_MSB 1 -#define HF_TIMER_CONTROL_AUTO_RESTART_LSB 1 -#define HF_TIMER_CONTROL_AUTO_RESTART_MASK 'h00000002 -#define HF_TIMER_CONTROL_AUTO_RESTART_GET(x) (((x) & HF_TIMER_CONTROL_AUTO_RESTART_MASK) >> HF_TIMER_CONTROL_AUTO_RESTART_LSB) -#define HF_TIMER_CONTROL_AUTO_RESTART_SET(x) (((32'd0 | (x)) << HF_TIMER_CONTROL_AUTO_RESTART_LSB) & HF_TIMER_CONTROL_AUTO_RESTART_MASK) -#define HF_TIMER_CONTROL_AUTO_RESTART_RESET 1'h0 -#define HF_TIMER_CONTROL_RESET_MSB 0 -#define HF_TIMER_CONTROL_RESET_LSB 0 -#define HF_TIMER_CONTROL_RESET_MASK 'h00000001 -#define HF_TIMER_CONTROL_RESET_GET(x) (((x) & HF_TIMER_CONTROL_RESET_MASK) >> HF_TIMER_CONTROL_RESET_LSB) -#define HF_TIMER_CONTROL_RESET_SET(x) (((32'd0 | (x)) << HF_TIMER_CONTROL_RESET_LSB) & HF_TIMER_CONTROL_RESET_MASK) -#define HF_TIMER_CONTROL_RESET_RESET 1'h0 -#define HF_TIMER_CONTROL_RESET (32'h0 | \ - HF_TIMER_CONTROL_ENABLE_SET(HF_TIMER_CONTROL_ENABLE_RESET) | \ - HF_TIMER_CONTROL_ON_SET(HF_TIMER_CONTROL_ON_RESET) | \ - HF_TIMER_CONTROL_AUTO_RESTART_SET(HF_TIMER_CONTROL_AUTO_RESTART_RESET) | \ - HF_TIMER_CONTROL_RESET_SET(HF_TIMER_CONTROL_RESET_RESET)) -#define HF_TIMER_CONTROL_HW_MASK (32'h0 | \ - HF_TIMER_CONTROL_RESET_MASK) -#define HF_TIMER_CONTROL_SW_MASK (32'h0 | \ - HF_TIMER_CONTROL_ENABLE_MASK | \ - HF_TIMER_CONTROL_ON_MASK | \ - HF_TIMER_CONTROL_AUTO_RESTART_MASK | \ - HF_TIMER_CONTROL_RESET_MASK) - -#define HF_TIMER_STATUS_ADDRESS 'h00000098 -#define HF_TIMER_STATUS_INTERRUPT_MSB 0 -#define HF_TIMER_STATUS_INTERRUPT_LSB 0 -#define HF_TIMER_STATUS_INTERRUPT_MASK 'h00000001 -#define HF_TIMER_STATUS_INTERRUPT_GET(x) (((x) & HF_TIMER_STATUS_INTERRUPT_MASK) >> HF_TIMER_STATUS_INTERRUPT_LSB) -#define HF_TIMER_STATUS_INTERRUPT_SET(x) (((32'd0 | (x)) << HF_TIMER_STATUS_INTERRUPT_LSB) & HF_TIMER_STATUS_INTERRUPT_MASK) -#define HF_TIMER_STATUS_INTERRUPT_RESET 1'h0 -#define HF_TIMER_STATUS_RESET (32'h0 | \ - HF_TIMER_STATUS_INTERRUPT_SET(HF_TIMER_STATUS_INTERRUPT_RESET)) -#define HF_TIMER_STATUS_HW_MASK (32'h0 | \ - HF_TIMER_STATUS_INTERRUPT_MASK) -#define HF_TIMER_STATUS_SW_MASK (32'h0 | \ - HF_TIMER_STATUS_INTERRUPT_MASK) - -#define RTC_CONTROL_ADDRESS 'h0000009c -#define RTC_CONTROL_ENABLE_MSB 2 -#define RTC_CONTROL_ENABLE_LSB 2 -#define RTC_CONTROL_ENABLE_MASK 'h00000004 -#define RTC_CONTROL_ENABLE_GET(x) (((x) & RTC_CONTROL_ENABLE_MASK) >> RTC_CONTROL_ENABLE_LSB) -#define RTC_CONTROL_ENABLE_SET(x) (((32'd0 | (x)) << RTC_CONTROL_ENABLE_LSB) & RTC_CONTROL_ENABLE_MASK) -#define RTC_CONTROL_ENABLE_RESET 1'h0 -#define RTC_CONTROL_LOAD_RTC_MSB 1 -#define RTC_CONTROL_LOAD_RTC_LSB 1 -#define RTC_CONTROL_LOAD_RTC_MASK 'h00000002 -#define RTC_CONTROL_LOAD_RTC_GET(x) (((x) & RTC_CONTROL_LOAD_RTC_MASK) >> RTC_CONTROL_LOAD_RTC_LSB) -#define RTC_CONTROL_LOAD_RTC_SET(x) (((32'd0 | (x)) << RTC_CONTROL_LOAD_RTC_LSB) & RTC_CONTROL_LOAD_RTC_MASK) -#define RTC_CONTROL_LOAD_RTC_RESET 1'h0 -#define RTC_CONTROL_LOAD_ALARM_MSB 0 -#define RTC_CONTROL_LOAD_ALARM_LSB 0 -#define RTC_CONTROL_LOAD_ALARM_MASK 'h00000001 -#define RTC_CONTROL_LOAD_ALARM_GET(x) (((x) & RTC_CONTROL_LOAD_ALARM_MASK) >> RTC_CONTROL_LOAD_ALARM_LSB) -#define RTC_CONTROL_LOAD_ALARM_SET(x) (((32'd0 | (x)) << RTC_CONTROL_LOAD_ALARM_LSB) & RTC_CONTROL_LOAD_ALARM_MASK) -#define RTC_CONTROL_LOAD_ALARM_RESET 1'h0 -#define RTC_CONTROL_RESET (32'h0 | \ - RTC_CONTROL_ENABLE_SET(RTC_CONTROL_ENABLE_RESET) | \ - RTC_CONTROL_LOAD_RTC_SET(RTC_CONTROL_LOAD_RTC_RESET) | \ - RTC_CONTROL_LOAD_ALARM_SET(RTC_CONTROL_LOAD_ALARM_RESET)) -#define RTC_CONTROL_HW_MASK (32'h0 | \ - RTC_CONTROL_LOAD_RTC_MASK | \ - RTC_CONTROL_LOAD_ALARM_MASK) -#define RTC_CONTROL_SW_MASK (32'h0 | \ - RTC_CONTROL_ENABLE_MASK | \ - RTC_CONTROL_LOAD_RTC_MASK | \ - RTC_CONTROL_LOAD_ALARM_MASK) - -#define RTC_TIME_ADDRESS 'h000000a0 -#define RTC_TIME_WEEK_DAY_MSB 26 -#define RTC_TIME_WEEK_DAY_LSB 24 -#define RTC_TIME_WEEK_DAY_MASK 'h07000000 -#define RTC_TIME_WEEK_DAY_GET(x) (((x) & RTC_TIME_WEEK_DAY_MASK) >> RTC_TIME_WEEK_DAY_LSB) -#define RTC_TIME_WEEK_DAY_SET(x) (((32'd0 | (x)) << RTC_TIME_WEEK_DAY_LSB) & RTC_TIME_WEEK_DAY_MASK) -#define RTC_TIME_WEEK_DAY_RESET 3'h1 -#define RTC_TIME_HOUR_MSB 21 -#define RTC_TIME_HOUR_LSB 16 -#define RTC_TIME_HOUR_MASK 'h003f0000 -#define RTC_TIME_HOUR_GET(x) (((x) & RTC_TIME_HOUR_MASK) >> RTC_TIME_HOUR_LSB) -#define RTC_TIME_HOUR_SET(x) (((32'd0 | (x)) << RTC_TIME_HOUR_LSB) & RTC_TIME_HOUR_MASK) -#define RTC_TIME_HOUR_RESET 6'h12 -#define RTC_TIME_MINUTE_MSB 14 -#define RTC_TIME_MINUTE_LSB 8 -#define RTC_TIME_MINUTE_MASK 'h00007f00 -#define RTC_TIME_MINUTE_GET(x) (((x) & RTC_TIME_MINUTE_MASK) >> RTC_TIME_MINUTE_LSB) -#define RTC_TIME_MINUTE_SET(x) (((32'd0 | (x)) << RTC_TIME_MINUTE_LSB) & RTC_TIME_MINUTE_MASK) -#define RTC_TIME_MINUTE_RESET 7'h0 -#define RTC_TIME_SECOND_MSB 6 -#define RTC_TIME_SECOND_LSB 0 -#define RTC_TIME_SECOND_MASK 'h0000007f -#define RTC_TIME_SECOND_GET(x) (((x) & RTC_TIME_SECOND_MASK) >> RTC_TIME_SECOND_LSB) -#define RTC_TIME_SECOND_SET(x) (((32'd0 | (x)) << RTC_TIME_SECOND_LSB) & RTC_TIME_SECOND_MASK) -#define RTC_TIME_SECOND_RESET 7'h0 -#define RTC_TIME_RESET (32'h0 | \ - RTC_TIME_WEEK_DAY_SET(RTC_TIME_WEEK_DAY_RESET) | \ - RTC_TIME_HOUR_SET(RTC_TIME_HOUR_RESET) | \ - RTC_TIME_MINUTE_SET(RTC_TIME_MINUTE_RESET) | \ - RTC_TIME_SECOND_SET(RTC_TIME_SECOND_RESET)) -#define RTC_TIME_HW_MASK (32'h0 | \ - RTC_TIME_WEEK_DAY_MASK | \ - RTC_TIME_HOUR_MASK | \ - RTC_TIME_MINUTE_MASK | \ - RTC_TIME_SECOND_MASK) -#define RTC_TIME_SW_MASK (32'h0) - -#define RTC_DATE_ADDRESS 'h000000a4 -#define RTC_DATE_YEAR_MSB 23 -#define RTC_DATE_YEAR_LSB 16 -#define RTC_DATE_YEAR_MASK 'h00ff0000 -#define RTC_DATE_YEAR_GET(x) (((x) & RTC_DATE_YEAR_MASK) >> RTC_DATE_YEAR_LSB) -#define RTC_DATE_YEAR_SET(x) (((32'd0 | (x)) << RTC_DATE_YEAR_LSB) & RTC_DATE_YEAR_MASK) -#define RTC_DATE_YEAR_RESET 8'h0 -#define RTC_DATE_MONTH_MSB 12 -#define RTC_DATE_MONTH_LSB 8 -#define RTC_DATE_MONTH_MASK 'h00001f00 -#define RTC_DATE_MONTH_GET(x) (((x) & RTC_DATE_MONTH_MASK) >> RTC_DATE_MONTH_LSB) -#define RTC_DATE_MONTH_SET(x) (((32'd0 | (x)) << RTC_DATE_MONTH_LSB) & RTC_DATE_MONTH_MASK) -#define RTC_DATE_MONTH_RESET 5'h1 -#define RTC_DATE_MONTH_DAY_MSB 5 -#define RTC_DATE_MONTH_DAY_LSB 0 -#define RTC_DATE_MONTH_DAY_MASK 'h0000003f -#define RTC_DATE_MONTH_DAY_GET(x) (((x) & RTC_DATE_MONTH_DAY_MASK) >> RTC_DATE_MONTH_DAY_LSB) -#define RTC_DATE_MONTH_DAY_SET(x) (((32'd0 | (x)) << RTC_DATE_MONTH_DAY_LSB) & RTC_DATE_MONTH_DAY_MASK) -#define RTC_DATE_MONTH_DAY_RESET 6'h1 -#define RTC_DATE_RESET (32'h0 | \ - RTC_DATE_YEAR_SET(RTC_DATE_YEAR_RESET) | \ - RTC_DATE_MONTH_SET(RTC_DATE_MONTH_RESET) | \ - RTC_DATE_MONTH_DAY_SET(RTC_DATE_MONTH_DAY_RESET)) -#define RTC_DATE_HW_MASK (32'h0 | \ - RTC_DATE_YEAR_MASK | \ - RTC_DATE_MONTH_MASK | \ - RTC_DATE_MONTH_DAY_MASK) -#define RTC_DATE_SW_MASK (32'h0) - -#define RTC_SET_TIME_ADDRESS 'h000000a8 -#define RTC_SET_TIME_WEEK_DAY_MSB 26 -#define RTC_SET_TIME_WEEK_DAY_LSB 24 -#define RTC_SET_TIME_WEEK_DAY_MASK 'h07000000 -#define RTC_SET_TIME_WEEK_DAY_GET(x) (((x) & RTC_SET_TIME_WEEK_DAY_MASK) >> RTC_SET_TIME_WEEK_DAY_LSB) -#define RTC_SET_TIME_WEEK_DAY_SET(x) (((32'd0 | (x)) << RTC_SET_TIME_WEEK_DAY_LSB) & RTC_SET_TIME_WEEK_DAY_MASK) -#define RTC_SET_TIME_WEEK_DAY_RESET 3'h1 -#define RTC_SET_TIME_HOUR_MSB 21 -#define RTC_SET_TIME_HOUR_LSB 16 -#define RTC_SET_TIME_HOUR_MASK 'h003f0000 -#define RTC_SET_TIME_HOUR_GET(x) (((x) & RTC_SET_TIME_HOUR_MASK) >> RTC_SET_TIME_HOUR_LSB) -#define RTC_SET_TIME_HOUR_SET(x) (((32'd0 | (x)) << RTC_SET_TIME_HOUR_LSB) & RTC_SET_TIME_HOUR_MASK) -#define RTC_SET_TIME_HOUR_RESET 6'h0 -#define RTC_SET_TIME_MINUTE_MSB 14 -#define RTC_SET_TIME_MINUTE_LSB 8 -#define RTC_SET_TIME_MINUTE_MASK 'h00007f00 -#define RTC_SET_TIME_MINUTE_GET(x) (((x) & RTC_SET_TIME_MINUTE_MASK) >> RTC_SET_TIME_MINUTE_LSB) -#define RTC_SET_TIME_MINUTE_SET(x) (((32'd0 | (x)) << RTC_SET_TIME_MINUTE_LSB) & RTC_SET_TIME_MINUTE_MASK) -#define RTC_SET_TIME_MINUTE_RESET 7'h0 -#define RTC_SET_TIME_SECOND_MSB 6 -#define RTC_SET_TIME_SECOND_LSB 0 -#define RTC_SET_TIME_SECOND_MASK 'h0000007f -#define RTC_SET_TIME_SECOND_GET(x) (((x) & RTC_SET_TIME_SECOND_MASK) >> RTC_SET_TIME_SECOND_LSB) -#define RTC_SET_TIME_SECOND_SET(x) (((32'd0 | (x)) << RTC_SET_TIME_SECOND_LSB) & RTC_SET_TIME_SECOND_MASK) -#define RTC_SET_TIME_SECOND_RESET 7'h0 -#define RTC_SET_TIME_RESET (32'h0 | \ - RTC_SET_TIME_WEEK_DAY_SET(RTC_SET_TIME_WEEK_DAY_RESET) | \ - RTC_SET_TIME_HOUR_SET(RTC_SET_TIME_HOUR_RESET) | \ - RTC_SET_TIME_MINUTE_SET(RTC_SET_TIME_MINUTE_RESET) | \ - RTC_SET_TIME_SECOND_SET(RTC_SET_TIME_SECOND_RESET)) -#define RTC_SET_TIME_HW_MASK (32'h0) -#define RTC_SET_TIME_SW_MASK (32'h0 | \ - RTC_SET_TIME_WEEK_DAY_MASK | \ - RTC_SET_TIME_HOUR_MASK | \ - RTC_SET_TIME_MINUTE_MASK | \ - RTC_SET_TIME_SECOND_MASK) - -#define RTC_SET_DATE_ADDRESS 'h000000ac -#define RTC_SET_DATE_YEAR_MSB 23 -#define RTC_SET_DATE_YEAR_LSB 16 -#define RTC_SET_DATE_YEAR_MASK 'h00ff0000 -#define RTC_SET_DATE_YEAR_GET(x) (((x) & RTC_SET_DATE_YEAR_MASK) >> RTC_SET_DATE_YEAR_LSB) -#define RTC_SET_DATE_YEAR_SET(x) (((32'd0 | (x)) << RTC_SET_DATE_YEAR_LSB) & RTC_SET_DATE_YEAR_MASK) -#define RTC_SET_DATE_YEAR_RESET 8'h0 -#define RTC_SET_DATE_MONTH_MSB 12 -#define RTC_SET_DATE_MONTH_LSB 8 -#define RTC_SET_DATE_MONTH_MASK 'h00001f00 -#define RTC_SET_DATE_MONTH_GET(x) (((x) & RTC_SET_DATE_MONTH_MASK) >> RTC_SET_DATE_MONTH_LSB) -#define RTC_SET_DATE_MONTH_SET(x) (((32'd0 | (x)) << RTC_SET_DATE_MONTH_LSB) & RTC_SET_DATE_MONTH_MASK) -#define RTC_SET_DATE_MONTH_RESET 5'h1 -#define RTC_SET_DATE_MONTH_DAY_MSB 5 -#define RTC_SET_DATE_MONTH_DAY_LSB 0 -#define RTC_SET_DATE_MONTH_DAY_MASK 'h0000003f -#define RTC_SET_DATE_MONTH_DAY_GET(x) (((x) & RTC_SET_DATE_MONTH_DAY_MASK) >> RTC_SET_DATE_MONTH_DAY_LSB) -#define RTC_SET_DATE_MONTH_DAY_SET(x) (((32'd0 | (x)) << RTC_SET_DATE_MONTH_DAY_LSB) & RTC_SET_DATE_MONTH_DAY_MASK) -#define RTC_SET_DATE_MONTH_DAY_RESET 6'h1 -#define RTC_SET_DATE_RESET (32'h0 | \ - RTC_SET_DATE_YEAR_SET(RTC_SET_DATE_YEAR_RESET) | \ - RTC_SET_DATE_MONTH_SET(RTC_SET_DATE_MONTH_RESET) | \ - RTC_SET_DATE_MONTH_DAY_SET(RTC_SET_DATE_MONTH_DAY_RESET)) -#define RTC_SET_DATE_HW_MASK (32'h0) -#define RTC_SET_DATE_SW_MASK (32'h0 | \ - RTC_SET_DATE_YEAR_MASK | \ - RTC_SET_DATE_MONTH_MASK | \ - RTC_SET_DATE_MONTH_DAY_MASK) - -#define RTC_SET_ALARM_ADDRESS 'h000000b0 -#define RTC_SET_ALARM_HOUR_MSB 21 -#define RTC_SET_ALARM_HOUR_LSB 16 -#define RTC_SET_ALARM_HOUR_MASK 'h003f0000 -#define RTC_SET_ALARM_HOUR_GET(x) (((x) & RTC_SET_ALARM_HOUR_MASK) >> RTC_SET_ALARM_HOUR_LSB) -#define RTC_SET_ALARM_HOUR_SET(x) (((32'd0 | (x)) << RTC_SET_ALARM_HOUR_LSB) & RTC_SET_ALARM_HOUR_MASK) -#define RTC_SET_ALARM_HOUR_RESET 6'h0 -#define RTC_SET_ALARM_MINUTE_MSB 14 -#define RTC_SET_ALARM_MINUTE_LSB 8 -#define RTC_SET_ALARM_MINUTE_MASK 'h00007f00 -#define RTC_SET_ALARM_MINUTE_GET(x) (((x) & RTC_SET_ALARM_MINUTE_MASK) >> RTC_SET_ALARM_MINUTE_LSB) -#define RTC_SET_ALARM_MINUTE_SET(x) (((32'd0 | (x)) << RTC_SET_ALARM_MINUTE_LSB) & RTC_SET_ALARM_MINUTE_MASK) -#define RTC_SET_ALARM_MINUTE_RESET 7'h0 -#define RTC_SET_ALARM_SECOND_MSB 6 -#define RTC_SET_ALARM_SECOND_LSB 0 -#define RTC_SET_ALARM_SECOND_MASK 'h0000007f -#define RTC_SET_ALARM_SECOND_GET(x) (((x) & RTC_SET_ALARM_SECOND_MASK) >> RTC_SET_ALARM_SECOND_LSB) -#define RTC_SET_ALARM_SECOND_SET(x) (((32'd0 | (x)) << RTC_SET_ALARM_SECOND_LSB) & RTC_SET_ALARM_SECOND_MASK) -#define RTC_SET_ALARM_SECOND_RESET 7'h0 -#define RTC_SET_ALARM_RESET (32'h0 | \ - RTC_SET_ALARM_HOUR_SET(RTC_SET_ALARM_HOUR_RESET) | \ - RTC_SET_ALARM_MINUTE_SET(RTC_SET_ALARM_MINUTE_RESET) | \ - RTC_SET_ALARM_SECOND_SET(RTC_SET_ALARM_SECOND_RESET)) -#define RTC_SET_ALARM_HW_MASK (32'h0) -#define RTC_SET_ALARM_SW_MASK (32'h0 | \ - RTC_SET_ALARM_HOUR_MASK | \ - RTC_SET_ALARM_MINUTE_MASK | \ - RTC_SET_ALARM_SECOND_MASK) - -#define RTC_CONFIG_ADDRESS 'h000000b4 -#define RTC_CONFIG_BCD_MSB 2 -#define RTC_CONFIG_BCD_LSB 2 -#define RTC_CONFIG_BCD_MASK 'h00000004 -#define RTC_CONFIG_BCD_GET(x) (((x) & RTC_CONFIG_BCD_MASK) >> RTC_CONFIG_BCD_LSB) -#define RTC_CONFIG_BCD_SET(x) (((32'd0 | (x)) << RTC_CONFIG_BCD_LSB) & RTC_CONFIG_BCD_MASK) -#define RTC_CONFIG_BCD_RESET 1'h1 -#define RTC_CONFIG_TWELVE_HOUR_MSB 1 -#define RTC_CONFIG_TWELVE_HOUR_LSB 1 -#define RTC_CONFIG_TWELVE_HOUR_MASK 'h00000002 -#define RTC_CONFIG_TWELVE_HOUR_GET(x) (((x) & RTC_CONFIG_TWELVE_HOUR_MASK) >> RTC_CONFIG_TWELVE_HOUR_LSB) -#define RTC_CONFIG_TWELVE_HOUR_SET(x) (((32'd0 | (x)) << RTC_CONFIG_TWELVE_HOUR_LSB) & RTC_CONFIG_TWELVE_HOUR_MASK) -#define RTC_CONFIG_TWELVE_HOUR_RESET 1'h1 -#define RTC_CONFIG_DSE_MSB 0 -#define RTC_CONFIG_DSE_LSB 0 -#define RTC_CONFIG_DSE_MASK 'h00000001 -#define RTC_CONFIG_DSE_GET(x) (((x) & RTC_CONFIG_DSE_MASK) >> RTC_CONFIG_DSE_LSB) -#define RTC_CONFIG_DSE_SET(x) (((32'd0 | (x)) << RTC_CONFIG_DSE_LSB) & RTC_CONFIG_DSE_MASK) -#define RTC_CONFIG_DSE_RESET 1'h1 -#define RTC_CONFIG_RESET (32'h0 | \ - RTC_CONFIG_BCD_SET(RTC_CONFIG_BCD_RESET) | \ - RTC_CONFIG_TWELVE_HOUR_SET(RTC_CONFIG_TWELVE_HOUR_RESET) | \ - RTC_CONFIG_DSE_SET(RTC_CONFIG_DSE_RESET)) -#define RTC_CONFIG_HW_MASK (32'h0) -#define RTC_CONFIG_SW_MASK (32'h0 | \ - RTC_CONFIG_BCD_MASK | \ - RTC_CONFIG_TWELVE_HOUR_MASK | \ - RTC_CONFIG_DSE_MASK) - -#define RTC_ALARM_STATUS_ADDRESS 'h000000b8 -#define RTC_ALARM_STATUS_ENABLE_MSB 1 -#define RTC_ALARM_STATUS_ENABLE_LSB 1 -#define RTC_ALARM_STATUS_ENABLE_MASK 'h00000002 -#define RTC_ALARM_STATUS_ENABLE_GET(x) (((x) & RTC_ALARM_STATUS_ENABLE_MASK) >> RTC_ALARM_STATUS_ENABLE_LSB) -#define RTC_ALARM_STATUS_ENABLE_SET(x) (((32'd0 | (x)) << RTC_ALARM_STATUS_ENABLE_LSB) & RTC_ALARM_STATUS_ENABLE_MASK) -#define RTC_ALARM_STATUS_ENABLE_RESET 1'h0 -#define RTC_ALARM_STATUS_INTERRUPT_MSB 0 -#define RTC_ALARM_STATUS_INTERRUPT_LSB 0 -#define RTC_ALARM_STATUS_INTERRUPT_MASK 'h00000001 -#define RTC_ALARM_STATUS_INTERRUPT_GET(x) (((x) & RTC_ALARM_STATUS_INTERRUPT_MASK) >> RTC_ALARM_STATUS_INTERRUPT_LSB) -#define RTC_ALARM_STATUS_INTERRUPT_SET(x) (((32'd0 | (x)) << RTC_ALARM_STATUS_INTERRUPT_LSB) & RTC_ALARM_STATUS_INTERRUPT_MASK) -#define RTC_ALARM_STATUS_INTERRUPT_RESET 1'h0 -#define RTC_ALARM_STATUS_RESET (32'h0 | \ - RTC_ALARM_STATUS_ENABLE_SET(RTC_ALARM_STATUS_ENABLE_RESET) | \ - RTC_ALARM_STATUS_INTERRUPT_SET(RTC_ALARM_STATUS_INTERRUPT_RESET)) -#define RTC_ALARM_STATUS_HW_MASK (32'h0 | \ - RTC_ALARM_STATUS_ENABLE_MASK | \ - RTC_ALARM_STATUS_INTERRUPT_MASK) -#define RTC_ALARM_STATUS_SW_MASK (32'h0 | \ - RTC_ALARM_STATUS_ENABLE_MASK | \ - RTC_ALARM_STATUS_INTERRUPT_MASK) - -#define UART_WAKEUP_ADDRESS 'h000000bc -#define UART_WAKEUP_ENABLE_MSB 0 -#define UART_WAKEUP_ENABLE_LSB 0 -#define UART_WAKEUP_ENABLE_MASK 'h00000001 -#define UART_WAKEUP_ENABLE_GET(x) (((x) & UART_WAKEUP_ENABLE_MASK) >> UART_WAKEUP_ENABLE_LSB) -#define UART_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << UART_WAKEUP_ENABLE_LSB) & UART_WAKEUP_ENABLE_MASK) -#define UART_WAKEUP_ENABLE_RESET 1'h0 -#define UART_WAKEUP_RESET (32'h0 | \ - UART_WAKEUP_ENABLE_SET(UART_WAKEUP_ENABLE_RESET)) -#define UART_WAKEUP_HW_MASK (32'h0) -#define UART_WAKEUP_SW_MASK (32'h0 | \ - UART_WAKEUP_ENABLE_MASK) - -#define RESET_CAUSE_ADDRESS 'h000000c0 -#define RESET_CAUSE_LAST_MSB 2 -#define RESET_CAUSE_LAST_LSB 0 -#define RESET_CAUSE_LAST_MASK 'h00000007 -#define RESET_CAUSE_LAST_GET(x) (((x) & RESET_CAUSE_LAST_MASK) >> RESET_CAUSE_LAST_LSB) -#define RESET_CAUSE_LAST_SET(x) (((32'd0 | (x)) << RESET_CAUSE_LAST_LSB) & RESET_CAUSE_LAST_MASK) -#define RESET_CAUSE_LAST_RESET 3'h0 -#define RESET_CAUSE_RESET (32'h0 | \ - RESET_CAUSE_LAST_SET(RESET_CAUSE_LAST_RESET)) -#define RESET_CAUSE_HW_MASK (32'h0 | \ - RESET_CAUSE_LAST_MASK) -#define RESET_CAUSE_SW_MASK (32'h0) - -#define SYSTEM_SLEEP_ADDRESS 'h000000c4 -#define SYSTEM_SLEEP_HOST_IF_MSB 4 -#define SYSTEM_SLEEP_HOST_IF_LSB 4 -#define SYSTEM_SLEEP_HOST_IF_MASK 'h00000010 -#define SYSTEM_SLEEP_HOST_IF_GET(x) (((x) & SYSTEM_SLEEP_HOST_IF_MASK) >> SYSTEM_SLEEP_HOST_IF_LSB) -#define SYSTEM_SLEEP_HOST_IF_SET(x) (((32'd0 | (x)) << SYSTEM_SLEEP_HOST_IF_LSB) & SYSTEM_SLEEP_HOST_IF_MASK) -#define SYSTEM_SLEEP_HOST_IF_RESET 1'h1 -#define SYSTEM_SLEEP_MBOX_MSB 3 -#define SYSTEM_SLEEP_MBOX_LSB 3 -#define SYSTEM_SLEEP_MBOX_MASK 'h00000008 -#define SYSTEM_SLEEP_MBOX_GET(x) (((x) & SYSTEM_SLEEP_MBOX_MASK) >> SYSTEM_SLEEP_MBOX_LSB) -#define SYSTEM_SLEEP_MBOX_SET(x) (((32'd0 | (x)) << SYSTEM_SLEEP_MBOX_LSB) & SYSTEM_SLEEP_MBOX_MASK) -#define SYSTEM_SLEEP_MBOX_RESET 1'h1 -#define SYSTEM_SLEEP_MAC_IF_MSB 2 -#define SYSTEM_SLEEP_MAC_IF_LSB 2 -#define SYSTEM_SLEEP_MAC_IF_MASK 'h00000004 -#define SYSTEM_SLEEP_MAC_IF_GET(x) (((x) & SYSTEM_SLEEP_MAC_IF_MASK) >> SYSTEM_SLEEP_MAC_IF_LSB) -#define SYSTEM_SLEEP_MAC_IF_SET(x) (((32'd0 | (x)) << SYSTEM_SLEEP_MAC_IF_LSB) & SYSTEM_SLEEP_MAC_IF_MASK) -#define SYSTEM_SLEEP_MAC_IF_RESET 1'h1 -#define SYSTEM_SLEEP_LIGHT_MSB 1 -#define SYSTEM_SLEEP_LIGHT_LSB 1 -#define SYSTEM_SLEEP_LIGHT_MASK 'h00000002 -#define SYSTEM_SLEEP_LIGHT_GET(x) (((x) & SYSTEM_SLEEP_LIGHT_MASK) >> SYSTEM_SLEEP_LIGHT_LSB) -#define SYSTEM_SLEEP_LIGHT_SET(x) (((32'd0 | (x)) << SYSTEM_SLEEP_LIGHT_LSB) & SYSTEM_SLEEP_LIGHT_MASK) -#define SYSTEM_SLEEP_LIGHT_RESET 1'h0 -#define SYSTEM_SLEEP_DISABLE_MSB 0 -#define SYSTEM_SLEEP_DISABLE_LSB 0 -#define SYSTEM_SLEEP_DISABLE_MASK 'h00000001 -#define SYSTEM_SLEEP_DISABLE_GET(x) (((x) & SYSTEM_SLEEP_DISABLE_MASK) >> SYSTEM_SLEEP_DISABLE_LSB) -#define SYSTEM_SLEEP_DISABLE_SET(x) (((32'd0 | (x)) << SYSTEM_SLEEP_DISABLE_LSB) & SYSTEM_SLEEP_DISABLE_MASK) -#define SYSTEM_SLEEP_DISABLE_RESET 1'h1 -#define SYSTEM_SLEEP_RESET (32'h0 | \ - SYSTEM_SLEEP_HOST_IF_SET(SYSTEM_SLEEP_HOST_IF_RESET) | \ - SYSTEM_SLEEP_MBOX_SET(SYSTEM_SLEEP_MBOX_RESET) | \ - SYSTEM_SLEEP_MAC_IF_SET(SYSTEM_SLEEP_MAC_IF_RESET) | \ - SYSTEM_SLEEP_LIGHT_SET(SYSTEM_SLEEP_LIGHT_RESET) | \ - SYSTEM_SLEEP_DISABLE_SET(SYSTEM_SLEEP_DISABLE_RESET)) -#define SYSTEM_SLEEP_HW_MASK (32'h0 | \ - SYSTEM_SLEEP_HOST_IF_MASK | \ - SYSTEM_SLEEP_MBOX_MASK | \ - SYSTEM_SLEEP_MAC_IF_MASK) -#define SYSTEM_SLEEP_SW_MASK (32'h0 | \ - SYSTEM_SLEEP_LIGHT_MASK | \ - SYSTEM_SLEEP_DISABLE_MASK) - -#define SDIO_WRAPPER_ADDRESS 'h000000c8 -#define SDIO_WRAPPER_SLEEP_MSB 3 -#define SDIO_WRAPPER_SLEEP_LSB 3 -#define SDIO_WRAPPER_SLEEP_MASK 'h00000008 -#define SDIO_WRAPPER_SLEEP_GET(x) (((x) & SDIO_WRAPPER_SLEEP_MASK) >> SDIO_WRAPPER_SLEEP_LSB) -#define SDIO_WRAPPER_SLEEP_SET(x) (((32'd0 | (x)) << SDIO_WRAPPER_SLEEP_LSB) & SDIO_WRAPPER_SLEEP_MASK) -#define SDIO_WRAPPER_SLEEP_RESET 1'h1 -#define SDIO_WRAPPER_WAKEUP_MSB 2 -#define SDIO_WRAPPER_WAKEUP_LSB 2 -#define SDIO_WRAPPER_WAKEUP_MASK 'h00000004 -#define SDIO_WRAPPER_WAKEUP_GET(x) (((x) & SDIO_WRAPPER_WAKEUP_MASK) >> SDIO_WRAPPER_WAKEUP_LSB) -#define SDIO_WRAPPER_WAKEUP_SET(x) (((32'd0 | (x)) << SDIO_WRAPPER_WAKEUP_LSB) & SDIO_WRAPPER_WAKEUP_MASK) -#define SDIO_WRAPPER_WAKEUP_RESET 1'h1 -#define SDIO_WRAPPER_SOC_ON_MSB 1 -#define SDIO_WRAPPER_SOC_ON_LSB 1 -#define SDIO_WRAPPER_SOC_ON_MASK 'h00000002 -#define SDIO_WRAPPER_SOC_ON_GET(x) (((x) & SDIO_WRAPPER_SOC_ON_MASK) >> SDIO_WRAPPER_SOC_ON_LSB) -#define SDIO_WRAPPER_SOC_ON_SET(x) (((32'd0 | (x)) << SDIO_WRAPPER_SOC_ON_LSB) & SDIO_WRAPPER_SOC_ON_MASK) -#define SDIO_WRAPPER_SOC_ON_RESET 1'h1 -#define SDIO_WRAPPER_ON_MSB 0 -#define SDIO_WRAPPER_ON_LSB 0 -#define SDIO_WRAPPER_ON_MASK 'h00000001 -#define SDIO_WRAPPER_ON_GET(x) (((x) & SDIO_WRAPPER_ON_MASK) >> SDIO_WRAPPER_ON_LSB) -#define SDIO_WRAPPER_ON_SET(x) (((32'd0 | (x)) << SDIO_WRAPPER_ON_LSB) & SDIO_WRAPPER_ON_MASK) -#define SDIO_WRAPPER_ON_RESET 1'h1 -#define SDIO_WRAPPER_RESET (32'h0 | \ - SDIO_WRAPPER_SLEEP_SET(SDIO_WRAPPER_SLEEP_RESET) | \ - SDIO_WRAPPER_WAKEUP_SET(SDIO_WRAPPER_WAKEUP_RESET) | \ - SDIO_WRAPPER_SOC_ON_SET(SDIO_WRAPPER_SOC_ON_RESET) | \ - SDIO_WRAPPER_ON_SET(SDIO_WRAPPER_ON_RESET)) -#define SDIO_WRAPPER_HW_MASK (32'h0) -#define SDIO_WRAPPER_SW_MASK (32'h0 | \ - SDIO_WRAPPER_SLEEP_MASK | \ - SDIO_WRAPPER_WAKEUP_MASK | \ - SDIO_WRAPPER_SOC_ON_MASK | \ - SDIO_WRAPPER_ON_MASK) - -#define MAC_SLEEP_CONTROL_ADDRESS 'h000000cc -#define MAC_SLEEP_CONTROL_ENABLE_MSB 1 -#define MAC_SLEEP_CONTROL_ENABLE_LSB 0 -#define MAC_SLEEP_CONTROL_ENABLE_MASK 'h00000003 -#define MAC_SLEEP_CONTROL_ENABLE_GET(x) (((x) & MAC_SLEEP_CONTROL_ENABLE_MASK) >> MAC_SLEEP_CONTROL_ENABLE_LSB) -#define MAC_SLEEP_CONTROL_ENABLE_SET(x) (((32'd0 | (x)) << MAC_SLEEP_CONTROL_ENABLE_LSB) & MAC_SLEEP_CONTROL_ENABLE_MASK) -#define MAC_SLEEP_CONTROL_ENABLE_RESET 2'h1 -#define MAC_SLEEP_CONTROL_RESET (32'h0 | \ - MAC_SLEEP_CONTROL_ENABLE_SET(MAC_SLEEP_CONTROL_ENABLE_RESET)) -#define MAC_SLEEP_CONTROL_HW_MASK (32'h0) -#define MAC_SLEEP_CONTROL_SW_MASK (32'h0 | \ - MAC_SLEEP_CONTROL_ENABLE_MASK) - -#define KEEP_AWAKE_ADDRESS 'h000000d0 -#define KEEP_AWAKE_COUNT_MSB 7 -#define KEEP_AWAKE_COUNT_LSB 0 -#define KEEP_AWAKE_COUNT_MASK 'h000000ff -#define KEEP_AWAKE_COUNT_GET(x) (((x) & KEEP_AWAKE_COUNT_MASK) >> KEEP_AWAKE_COUNT_LSB) -#define KEEP_AWAKE_COUNT_SET(x) (((32'd0 | (x)) << KEEP_AWAKE_COUNT_LSB) & KEEP_AWAKE_COUNT_MASK) -#define KEEP_AWAKE_COUNT_RESET 8'h2 -#define KEEP_AWAKE_RESET (32'h0 | \ - KEEP_AWAKE_COUNT_SET(KEEP_AWAKE_COUNT_RESET)) -#define KEEP_AWAKE_HW_MASK (32'h0) -#define KEEP_AWAKE_SW_MASK (32'h0 | \ - KEEP_AWAKE_COUNT_MASK) - -#define LPO_CAL_TIME_ADDRESS 'h000000d4 -#define LPO_CAL_TIME_LENGTH_MSB 13 -#define LPO_CAL_TIME_LENGTH_LSB 0 -#define LPO_CAL_TIME_LENGTH_MASK 'h00003fff -#define LPO_CAL_TIME_LENGTH_GET(x) (((x) & LPO_CAL_TIME_LENGTH_MASK) >> LPO_CAL_TIME_LENGTH_LSB) -#define LPO_CAL_TIME_LENGTH_SET(x) (((32'd0 | (x)) << LPO_CAL_TIME_LENGTH_LSB) & LPO_CAL_TIME_LENGTH_MASK) -#define LPO_CAL_TIME_LENGTH_RESET 14'h421 -#define LPO_CAL_TIME_RESET (32'h0 | \ - LPO_CAL_TIME_LENGTH_SET(LPO_CAL_TIME_LENGTH_RESET)) -#define LPO_CAL_TIME_HW_MASK (32'h0) -#define LPO_CAL_TIME_SW_MASK (32'h0 | \ - LPO_CAL_TIME_LENGTH_MASK) - -#define LPO_INIT_DIVIDEND_INT_ADDRESS 'h000000d8 -#define LPO_INIT_DIVIDEND_INT_VALUE_MSB 23 -#define LPO_INIT_DIVIDEND_INT_VALUE_LSB 0 -#define LPO_INIT_DIVIDEND_INT_VALUE_MASK 'h00ffffff -#define LPO_INIT_DIVIDEND_INT_VALUE_GET(x) (((x) & LPO_INIT_DIVIDEND_INT_VALUE_MASK) >> LPO_INIT_DIVIDEND_INT_VALUE_LSB) -#define LPO_INIT_DIVIDEND_INT_VALUE_SET(x) (((32'd0 | (x)) << LPO_INIT_DIVIDEND_INT_VALUE_LSB) & LPO_INIT_DIVIDEND_INT_VALUE_MASK) -#define LPO_INIT_DIVIDEND_INT_VALUE_RESET 24'hcce41 -#define LPO_INIT_DIVIDEND_INT_RESET (32'h0 | \ - LPO_INIT_DIVIDEND_INT_VALUE_SET(LPO_INIT_DIVIDEND_INT_VALUE_RESET)) -#define LPO_INIT_DIVIDEND_INT_HW_MASK (32'h0) -#define LPO_INIT_DIVIDEND_INT_SW_MASK (32'h0 | \ - LPO_INIT_DIVIDEND_INT_VALUE_MASK) - -#define LPO_INIT_DIVIDEND_FRACTION_ADDRESS 'h000000dc -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_MSB 10 -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB 0 -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK 'h000007ff -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_GET(x) (((x) & LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK) >> LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB) -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_SET(x) (((32'd0 | (x)) << LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB) & LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK) -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_RESET 11'h330 -#define LPO_INIT_DIVIDEND_FRACTION_RESET (32'h0 | \ - LPO_INIT_DIVIDEND_FRACTION_VALUE_SET(LPO_INIT_DIVIDEND_FRACTION_VALUE_RESET)) -#define LPO_INIT_DIVIDEND_FRACTION_HW_MASK (32'h0) -#define LPO_INIT_DIVIDEND_FRACTION_SW_MASK (32'h0 | \ - LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK) - -#define LPO_CAL_ADDRESS 'h000000e0 -#define LPO_CAL_ENABLE_MSB 20 -#define LPO_CAL_ENABLE_LSB 20 -#define LPO_CAL_ENABLE_MASK 'h00100000 -#define LPO_CAL_ENABLE_GET(x) (((x) & LPO_CAL_ENABLE_MASK) >> LPO_CAL_ENABLE_LSB) -#define LPO_CAL_ENABLE_SET(x) (((32'd0 | (x)) << LPO_CAL_ENABLE_LSB) & LPO_CAL_ENABLE_MASK) -#define LPO_CAL_ENABLE_RESET 1'h0 -#define LPO_CAL_COUNT_MSB 19 -#define LPO_CAL_COUNT_LSB 0 -#define LPO_CAL_COUNT_MASK 'h000fffff -#define LPO_CAL_COUNT_GET(x) (((x) & LPO_CAL_COUNT_MASK) >> LPO_CAL_COUNT_LSB) -#define LPO_CAL_COUNT_SET(x) (((32'd0 | (x)) << LPO_CAL_COUNT_LSB) & LPO_CAL_COUNT_MASK) -#define LPO_CAL_COUNT_RESET 20'h12c00 -#define LPO_CAL_RESET (32'h0 | \ - LPO_CAL_ENABLE_SET(LPO_CAL_ENABLE_RESET) | \ - LPO_CAL_COUNT_SET(LPO_CAL_COUNT_RESET)) -#define LPO_CAL_HW_MASK (32'h0 | \ - LPO_CAL_COUNT_MASK) -#define LPO_CAL_SW_MASK (32'h0 | \ - LPO_CAL_ENABLE_MASK) - -#define LPO_CAL_TEST_CONTROL_ADDRESS 'h000000e4 -#define LPO_CAL_TEST_CONTROL_ENABLE_MSB 5 -#define LPO_CAL_TEST_CONTROL_ENABLE_LSB 5 -#define LPO_CAL_TEST_CONTROL_ENABLE_MASK 'h00000020 -#define LPO_CAL_TEST_CONTROL_ENABLE_GET(x) (((x) & LPO_CAL_TEST_CONTROL_ENABLE_MASK) >> LPO_CAL_TEST_CONTROL_ENABLE_LSB) -#define LPO_CAL_TEST_CONTROL_ENABLE_SET(x) (((32'd0 | (x)) << LPO_CAL_TEST_CONTROL_ENABLE_LSB) & LPO_CAL_TEST_CONTROL_ENABLE_MASK) -#define LPO_CAL_TEST_CONTROL_ENABLE_RESET 1'h0 -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_MSB 4 -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB 0 -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK 'h0000001f -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_GET(x) (((x) & LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK) >> LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB) -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_SET(x) (((32'd0 | (x)) << LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB) & LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK) -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_RESET 5'h0 -#define LPO_CAL_TEST_CONTROL_RESET (32'h0 | \ - LPO_CAL_TEST_CONTROL_ENABLE_SET(LPO_CAL_TEST_CONTROL_ENABLE_RESET) | \ - LPO_CAL_TEST_CONTROL_RTC_CYCLES_SET(LPO_CAL_TEST_CONTROL_RTC_CYCLES_RESET)) -#define LPO_CAL_TEST_CONTROL_HW_MASK (32'h0) -#define LPO_CAL_TEST_CONTROL_SW_MASK (32'h0 | \ - LPO_CAL_TEST_CONTROL_ENABLE_MASK | \ - LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK) - -#define LPO_CAL_TEST_STATUS_ADDRESS 'h000000e8 -#define LPO_CAL_TEST_STATUS_READY_MSB 16 -#define LPO_CAL_TEST_STATUS_READY_LSB 16 -#define LPO_CAL_TEST_STATUS_READY_MASK 'h00010000 -#define LPO_CAL_TEST_STATUS_READY_GET(x) (((x) & LPO_CAL_TEST_STATUS_READY_MASK) >> LPO_CAL_TEST_STATUS_READY_LSB) -#define LPO_CAL_TEST_STATUS_READY_SET(x) (((32'd0 | (x)) << LPO_CAL_TEST_STATUS_READY_LSB) & LPO_CAL_TEST_STATUS_READY_MASK) -#define LPO_CAL_TEST_STATUS_READY_RESET 1'h0 -#define LPO_CAL_TEST_STATUS_COUNT_MSB 15 -#define LPO_CAL_TEST_STATUS_COUNT_LSB 0 -#define LPO_CAL_TEST_STATUS_COUNT_MASK 'h0000ffff -#define LPO_CAL_TEST_STATUS_COUNT_GET(x) (((x) & LPO_CAL_TEST_STATUS_COUNT_MASK) >> LPO_CAL_TEST_STATUS_COUNT_LSB) -#define LPO_CAL_TEST_STATUS_COUNT_SET(x) (((32'd0 | (x)) << LPO_CAL_TEST_STATUS_COUNT_LSB) & LPO_CAL_TEST_STATUS_COUNT_MASK) -#define LPO_CAL_TEST_STATUS_COUNT_RESET 16'h0 -#define LPO_CAL_TEST_STATUS_RESET (32'h0 | \ - LPO_CAL_TEST_STATUS_READY_SET(LPO_CAL_TEST_STATUS_READY_RESET) | \ - LPO_CAL_TEST_STATUS_COUNT_SET(LPO_CAL_TEST_STATUS_COUNT_RESET)) -#define LPO_CAL_TEST_STATUS_HW_MASK (32'h0 | \ - LPO_CAL_TEST_STATUS_READY_MASK | \ - LPO_CAL_TEST_STATUS_COUNT_MASK) -#define LPO_CAL_TEST_STATUS_SW_MASK (32'h0) - -#define CHIP_ID_ADDRESS 'h000000ec -#define CHIP_ID_DEVICE_ID_MSB 31 -#define CHIP_ID_DEVICE_ID_LSB 16 -#define CHIP_ID_DEVICE_ID_MASK 'hffff0000 -#define CHIP_ID_DEVICE_ID_GET(x) (((x) & CHIP_ID_DEVICE_ID_MASK) >> CHIP_ID_DEVICE_ID_LSB) -#define CHIP_ID_DEVICE_ID_SET(x) (((32'd0 | (x)) << CHIP_ID_DEVICE_ID_LSB) & CHIP_ID_DEVICE_ID_MASK) -#define CHIP_ID_DEVICE_ID_RESET 16'h0 -#define CHIP_ID_CONFIG_ID_MSB 15 -#define CHIP_ID_CONFIG_ID_LSB 4 -#define CHIP_ID_CONFIG_ID_MASK 'h0000fff0 -#define CHIP_ID_CONFIG_ID_GET(x) (((x) & CHIP_ID_CONFIG_ID_MASK) >> CHIP_ID_CONFIG_ID_LSB) -#define CHIP_ID_CONFIG_ID_SET(x) (((32'd0 | (x)) << CHIP_ID_CONFIG_ID_LSB) & CHIP_ID_CONFIG_ID_MASK) -#define CHIP_ID_CONFIG_ID_RESET 12'h0 -#define CHIP_ID_VERSION_ID_MSB 3 -#define CHIP_ID_VERSION_ID_LSB 0 -#define CHIP_ID_VERSION_ID_MASK 'h0000000f -#define CHIP_ID_VERSION_ID_GET(x) (((x) & CHIP_ID_VERSION_ID_MASK) >> CHIP_ID_VERSION_ID_LSB) -#define CHIP_ID_VERSION_ID_SET(x) (((32'd0 | (x)) << CHIP_ID_VERSION_ID_LSB) & CHIP_ID_VERSION_ID_MASK) -#define CHIP_ID_VERSION_ID_RESET 4'h1 -#define CHIP_ID_RESET (32'h0 | \ - CHIP_ID_DEVICE_ID_SET(CHIP_ID_DEVICE_ID_RESET) | \ - CHIP_ID_CONFIG_ID_SET(CHIP_ID_CONFIG_ID_RESET) | \ - CHIP_ID_VERSION_ID_SET(CHIP_ID_VERSION_ID_RESET)) -#define CHIP_ID_HW_MASK (32'h0 | \ - CHIP_ID_DEVICE_ID_MASK | \ - CHIP_ID_CONFIG_ID_MASK | \ - CHIP_ID_VERSION_ID_MASK) -#define CHIP_ID_SW_MASK (32'h0) - -#define DERIVED_RTC_CLK_ADDRESS 'h000000f0 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MSB 20 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB 20 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK 'h00100000 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_GET(x) (((x) & DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK) >> DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_SET(x) (((32'd0 | (x)) << DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB) & DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_RESET 1'h0 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_MSB 18 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB 18 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK 'h00040000 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_GET(x) (((x) & DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK) >> DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_SET(x) (((32'd0 | (x)) << DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB) & DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_RESET 1'h0 -#define DERIVED_RTC_CLK_FORCE_MSB 17 -#define DERIVED_RTC_CLK_FORCE_LSB 16 -#define DERIVED_RTC_CLK_FORCE_MASK 'h00030000 -#define DERIVED_RTC_CLK_FORCE_GET(x) (((x) & DERIVED_RTC_CLK_FORCE_MASK) >> DERIVED_RTC_CLK_FORCE_LSB) -#define DERIVED_RTC_CLK_FORCE_SET(x) (((32'd0 | (x)) << DERIVED_RTC_CLK_FORCE_LSB) & DERIVED_RTC_CLK_FORCE_MASK) -#define DERIVED_RTC_CLK_FORCE_RESET 2'h0 -#define DERIVED_RTC_CLK_PERIOD_MSB 15 -#define DERIVED_RTC_CLK_PERIOD_LSB 1 -#define DERIVED_RTC_CLK_PERIOD_MASK 'h0000fffe -#define DERIVED_RTC_CLK_PERIOD_GET(x) (((x) & DERIVED_RTC_CLK_PERIOD_MASK) >> DERIVED_RTC_CLK_PERIOD_LSB) -#define DERIVED_RTC_CLK_PERIOD_SET(x) (((32'd0 | (x)) << DERIVED_RTC_CLK_PERIOD_LSB) & DERIVED_RTC_CLK_PERIOD_MASK) -#define DERIVED_RTC_CLK_PERIOD_RESET 15'h262 -#define DERIVED_RTC_CLK_RESET (32'h0 | \ - DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_SET(DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_RESET) | \ - DERIVED_RTC_CLK_EXTERNAL_DETECT_SET(DERIVED_RTC_CLK_EXTERNAL_DETECT_RESET) | \ - DERIVED_RTC_CLK_FORCE_SET(DERIVED_RTC_CLK_FORCE_RESET) | \ - DERIVED_RTC_CLK_PERIOD_SET(DERIVED_RTC_CLK_PERIOD_RESET)) -#define DERIVED_RTC_CLK_HW_MASK (32'h0 | \ - DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK) -#define DERIVED_RTC_CLK_SW_MASK (32'h0 | \ - DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK | \ - DERIVED_RTC_CLK_FORCE_MASK | \ - DERIVED_RTC_CLK_PERIOD_MASK) - -#define MAC_PCU_SLP32_MODE_ADDRESS 'h000000f4 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MSB 21 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_LSB 21 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MASK 'h00200000 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_GET(x) (((x) & MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MASK) >> MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_LSB) -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_LSB) & MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MASK) -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_RESET 1'h1 -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MSB 19 -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB 0 -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK 'h000fffff -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_GET(x) (((x) & MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK) >> MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB) -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB) & MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK) -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_RESET 20'hf424 -#define MAC_PCU_SLP32_MODE_RESET (32'h0 | \ - MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_SET(MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_RESET) | \ - MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_SET(MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_RESET)) -#define MAC_PCU_SLP32_MODE_HW_MASK (32'h0 | \ - MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MASK) -#define MAC_PCU_SLP32_MODE_SW_MASK (32'h0 | \ - MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK) - -#define MAC_PCU_SLP32_WAKE_ADDRESS 'h000000f8 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_MSB 15 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_LSB 0 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_MASK 'h0000ffff -#define MAC_PCU_SLP32_WAKE_XTL_TIME_GET(x) (((x) & MAC_PCU_SLP32_WAKE_XTL_TIME_MASK) >> MAC_PCU_SLP32_WAKE_XTL_TIME_LSB) -#define MAC_PCU_SLP32_WAKE_XTL_TIME_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP32_WAKE_XTL_TIME_LSB) & MAC_PCU_SLP32_WAKE_XTL_TIME_MASK) -#define MAC_PCU_SLP32_WAKE_XTL_TIME_RESET 16'h100 -#define MAC_PCU_SLP32_WAKE_RESET (32'h0 | \ - MAC_PCU_SLP32_WAKE_XTL_TIME_SET(MAC_PCU_SLP32_WAKE_XTL_TIME_RESET)) -#define MAC_PCU_SLP32_WAKE_HW_MASK (32'h0) -#define MAC_PCU_SLP32_WAKE_SW_MASK (32'h0 | \ - MAC_PCU_SLP32_WAKE_XTL_TIME_MASK) - -#define MAC_PCU_SLP32_INC_ADDRESS 'h000000fc -#define MAC_PCU_SLP32_INC_TSF_INC_MSB 19 -#define MAC_PCU_SLP32_INC_TSF_INC_LSB 0 -#define MAC_PCU_SLP32_INC_TSF_INC_MASK 'h000fffff -#define MAC_PCU_SLP32_INC_TSF_INC_GET(x) (((x) & MAC_PCU_SLP32_INC_TSF_INC_MASK) >> MAC_PCU_SLP32_INC_TSF_INC_LSB) -#define MAC_PCU_SLP32_INC_TSF_INC_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP32_INC_TSF_INC_LSB) & MAC_PCU_SLP32_INC_TSF_INC_MASK) -#define MAC_PCU_SLP32_INC_TSF_INC_RESET 20'h1e848 -#define MAC_PCU_SLP32_INC_RESET (32'h0 | \ - MAC_PCU_SLP32_INC_TSF_INC_SET(MAC_PCU_SLP32_INC_TSF_INC_RESET)) -#define MAC_PCU_SLP32_INC_HW_MASK (32'h0) -#define MAC_PCU_SLP32_INC_SW_MASK (32'h0 | \ - MAC_PCU_SLP32_INC_TSF_INC_MASK) - -#define MAC_PCU_SLP_MIB1_ADDRESS 'h00000100 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_MSB 31 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB 0 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK 'hffffffff -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK) >> MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB) -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB) & MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK) -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_RESET 32'h0 -#define MAC_PCU_SLP_MIB1_RESET (32'h0 | \ - MAC_PCU_SLP_MIB1_SLEEP_CNT_SET(MAC_PCU_SLP_MIB1_SLEEP_CNT_RESET)) -#define MAC_PCU_SLP_MIB1_HW_MASK (32'h0 | \ - MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK) -#define MAC_PCU_SLP_MIB1_SW_MASK (32'h0 | \ - MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK) - -#define MAC_PCU_SLP_MIB2_ADDRESS 'h00000104 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_MSB 31 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB 0 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK 'hffffffff -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK) >> MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB) -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB) & MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK) -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_RESET 32'h0 -#define MAC_PCU_SLP_MIB2_RESET (32'h0 | \ - MAC_PCU_SLP_MIB2_CYCLE_CNT_SET(MAC_PCU_SLP_MIB2_CYCLE_CNT_RESET)) -#define MAC_PCU_SLP_MIB2_HW_MASK (32'h0 | \ - MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK) -#define MAC_PCU_SLP_MIB2_SW_MASK (32'h0 | \ - MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK) - -#define MAC_PCU_SLP_MIB3_ADDRESS 'h00000108 -#define MAC_PCU_SLP_MIB3_PENDING_MSB 1 -#define MAC_PCU_SLP_MIB3_PENDING_LSB 1 -#define MAC_PCU_SLP_MIB3_PENDING_MASK 'h00000002 -#define MAC_PCU_SLP_MIB3_PENDING_GET(x) (((x) & MAC_PCU_SLP_MIB3_PENDING_MASK) >> MAC_PCU_SLP_MIB3_PENDING_LSB) -#define MAC_PCU_SLP_MIB3_PENDING_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP_MIB3_PENDING_LSB) & MAC_PCU_SLP_MIB3_PENDING_MASK) -#define MAC_PCU_SLP_MIB3_PENDING_RESET 1'h0 -#define MAC_PCU_SLP_MIB3_CLR_CNT_MSB 0 -#define MAC_PCU_SLP_MIB3_CLR_CNT_LSB 0 -#define MAC_PCU_SLP_MIB3_CLR_CNT_MASK 'h00000001 -#define MAC_PCU_SLP_MIB3_CLR_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB3_CLR_CNT_MASK) >> MAC_PCU_SLP_MIB3_CLR_CNT_LSB) -#define MAC_PCU_SLP_MIB3_CLR_CNT_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP_MIB3_CLR_CNT_LSB) & MAC_PCU_SLP_MIB3_CLR_CNT_MASK) -#define MAC_PCU_SLP_MIB3_CLR_CNT_RESET 1'h0 -#define MAC_PCU_SLP_MIB3_RESET (32'h0 | \ - MAC_PCU_SLP_MIB3_PENDING_SET(MAC_PCU_SLP_MIB3_PENDING_RESET) | \ - MAC_PCU_SLP_MIB3_CLR_CNT_SET(MAC_PCU_SLP_MIB3_CLR_CNT_RESET)) -#define MAC_PCU_SLP_MIB3_HW_MASK (32'h0 | \ - MAC_PCU_SLP_MIB3_PENDING_MASK) -#define MAC_PCU_SLP_MIB3_SW_MASK (32'h0 | \ - MAC_PCU_SLP_MIB3_CLR_CNT_MASK) - -#define MAC_PCU_SLP_BEACON_ADDRESS 'h0000010c -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MSB 24 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_LSB 24 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MASK 'h01000000 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_GET(x) (((x) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MASK) >> MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_LSB) -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_LSB) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MASK) -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_RESET 1'h0 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MSB 23 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_LSB 0 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MASK 'h00ffffff -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_GET(x) (((x) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MASK) >> MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_LSB) -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_LSB) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MASK) -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_RESET 24'hffffff -#define MAC_PCU_SLP_BEACON_RESET (32'h0 | \ - MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_SET(MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_RESET) | \ - MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_SET(MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_RESET)) -#define MAC_PCU_SLP_BEACON_HW_MASK (32'h0) -#define MAC_PCU_SLP_BEACON_SW_MASK (32'h0 | \ - MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MASK | \ - MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MASK) - -#define POWER_REG_ADDRESS 'h00000110 -#define POWER_REG_VLVL_MSB 11 -#define POWER_REG_VLVL_LSB 8 -#define POWER_REG_VLVL_MASK 'h00000f00 -#define POWER_REG_VLVL_GET(x) (((x) & POWER_REG_VLVL_MASK) >> POWER_REG_VLVL_LSB) -#define POWER_REG_VLVL_SET(x) (((32'd0 | (x)) << POWER_REG_VLVL_LSB) & POWER_REG_VLVL_MASK) -#define POWER_REG_VLVL_RESET 4'h0 -#define POWER_REG_CPU_INT_ENABLE_MSB 7 -#define POWER_REG_CPU_INT_ENABLE_LSB 7 -#define POWER_REG_CPU_INT_ENABLE_MASK 'h00000080 -#define POWER_REG_CPU_INT_ENABLE_GET(x) (((x) & POWER_REG_CPU_INT_ENABLE_MASK) >> POWER_REG_CPU_INT_ENABLE_LSB) -#define POWER_REG_CPU_INT_ENABLE_SET(x) (((32'd0 | (x)) << POWER_REG_CPU_INT_ENABLE_LSB) & POWER_REG_CPU_INT_ENABLE_MASK) -#define POWER_REG_CPU_INT_ENABLE_RESET 1'h0 -#define POWER_REG_WLAN_ISO_DIS_MSB 6 -#define POWER_REG_WLAN_ISO_DIS_LSB 6 -#define POWER_REG_WLAN_ISO_DIS_MASK 'h00000040 -#define POWER_REG_WLAN_ISO_DIS_GET(x) (((x) & POWER_REG_WLAN_ISO_DIS_MASK) >> POWER_REG_WLAN_ISO_DIS_LSB) -#define POWER_REG_WLAN_ISO_DIS_SET(x) (((32'd0 | (x)) << POWER_REG_WLAN_ISO_DIS_LSB) & POWER_REG_WLAN_ISO_DIS_MASK) -#define POWER_REG_WLAN_ISO_DIS_RESET 1'h0 -#define POWER_REG_WLAN_ISO_CNTL_MSB 5 -#define POWER_REG_WLAN_ISO_CNTL_LSB 5 -#define POWER_REG_WLAN_ISO_CNTL_MASK 'h00000020 -#define POWER_REG_WLAN_ISO_CNTL_GET(x) (((x) & POWER_REG_WLAN_ISO_CNTL_MASK) >> POWER_REG_WLAN_ISO_CNTL_LSB) -#define POWER_REG_WLAN_ISO_CNTL_SET(x) (((32'd0 | (x)) << POWER_REG_WLAN_ISO_CNTL_LSB) & POWER_REG_WLAN_ISO_CNTL_MASK) -#define POWER_REG_WLAN_ISO_CNTL_RESET 1'h0 -#define POWER_REG_RADIO_PWD_EN_MSB 4 -#define POWER_REG_RADIO_PWD_EN_LSB 4 -#define POWER_REG_RADIO_PWD_EN_MASK 'h00000010 -#define POWER_REG_RADIO_PWD_EN_GET(x) (((x) & POWER_REG_RADIO_PWD_EN_MASK) >> POWER_REG_RADIO_PWD_EN_LSB) -#define POWER_REG_RADIO_PWD_EN_SET(x) (((32'd0 | (x)) << POWER_REG_RADIO_PWD_EN_LSB) & POWER_REG_RADIO_PWD_EN_MASK) -#define POWER_REG_RADIO_PWD_EN_RESET 1'h0 -#define POWER_REG_SOC_SCALE_EN_MSB 3 -#define POWER_REG_SOC_SCALE_EN_LSB 3 -#define POWER_REG_SOC_SCALE_EN_MASK 'h00000008 -#define POWER_REG_SOC_SCALE_EN_GET(x) (((x) & POWER_REG_SOC_SCALE_EN_MASK) >> POWER_REG_SOC_SCALE_EN_LSB) -#define POWER_REG_SOC_SCALE_EN_SET(x) (((32'd0 | (x)) << POWER_REG_SOC_SCALE_EN_LSB) & POWER_REG_SOC_SCALE_EN_MASK) -#define POWER_REG_SOC_SCALE_EN_RESET 1'h0 -#define POWER_REG_WLAN_SCALE_EN_MSB 2 -#define POWER_REG_WLAN_SCALE_EN_LSB 2 -#define POWER_REG_WLAN_SCALE_EN_MASK 'h00000004 -#define POWER_REG_WLAN_SCALE_EN_GET(x) (((x) & POWER_REG_WLAN_SCALE_EN_MASK) >> POWER_REG_WLAN_SCALE_EN_LSB) -#define POWER_REG_WLAN_SCALE_EN_SET(x) (((32'd0 | (x)) << POWER_REG_WLAN_SCALE_EN_LSB) & POWER_REG_WLAN_SCALE_EN_MASK) -#define POWER_REG_WLAN_SCALE_EN_RESET 1'h0 -#define POWER_REG_WLAN_PWD_EN_MSB 1 -#define POWER_REG_WLAN_PWD_EN_LSB 1 -#define POWER_REG_WLAN_PWD_EN_MASK 'h00000002 -#define POWER_REG_WLAN_PWD_EN_GET(x) (((x) & POWER_REG_WLAN_PWD_EN_MASK) >> POWER_REG_WLAN_PWD_EN_LSB) -#define POWER_REG_WLAN_PWD_EN_SET(x) (((32'd0 | (x)) << POWER_REG_WLAN_PWD_EN_LSB) & POWER_REG_WLAN_PWD_EN_MASK) -#define POWER_REG_WLAN_PWD_EN_RESET 1'h0 -#define POWER_REG_POWER_EN_MSB 0 -#define POWER_REG_POWER_EN_LSB 0 -#define POWER_REG_POWER_EN_MASK 'h00000001 -#define POWER_REG_POWER_EN_GET(x) (((x) & POWER_REG_POWER_EN_MASK) >> POWER_REG_POWER_EN_LSB) -#define POWER_REG_POWER_EN_SET(x) (((32'd0 | (x)) << POWER_REG_POWER_EN_LSB) & POWER_REG_POWER_EN_MASK) -#define POWER_REG_POWER_EN_RESET 1'h0 -#define POWER_REG_RESET (32'h0 | \ - POWER_REG_VLVL_SET(POWER_REG_VLVL_RESET) | \ - POWER_REG_CPU_INT_ENABLE_SET(POWER_REG_CPU_INT_ENABLE_RESET) | \ - POWER_REG_WLAN_ISO_DIS_SET(POWER_REG_WLAN_ISO_DIS_RESET) | \ - POWER_REG_WLAN_ISO_CNTL_SET(POWER_REG_WLAN_ISO_CNTL_RESET) | \ - POWER_REG_RADIO_PWD_EN_SET(POWER_REG_RADIO_PWD_EN_RESET) | \ - POWER_REG_SOC_SCALE_EN_SET(POWER_REG_SOC_SCALE_EN_RESET) | \ - POWER_REG_WLAN_SCALE_EN_SET(POWER_REG_WLAN_SCALE_EN_RESET) | \ - POWER_REG_WLAN_PWD_EN_SET(POWER_REG_WLAN_PWD_EN_RESET) | \ - POWER_REG_POWER_EN_SET(POWER_REG_POWER_EN_RESET)) -#define POWER_REG_HW_MASK (32'h0) -#define POWER_REG_SW_MASK (32'h0 | \ - POWER_REG_VLVL_MASK | \ - POWER_REG_CPU_INT_ENABLE_MASK | \ - POWER_REG_WLAN_ISO_DIS_MASK | \ - POWER_REG_WLAN_ISO_CNTL_MASK | \ - POWER_REG_RADIO_PWD_EN_MASK | \ - POWER_REG_SOC_SCALE_EN_MASK | \ - POWER_REG_WLAN_SCALE_EN_MASK | \ - POWER_REG_WLAN_PWD_EN_MASK | \ - POWER_REG_POWER_EN_MASK) - -#define CORE_CLK_CTRL_ADDRESS 'h00000114 -#define CORE_CLK_CTRL_DIV_MSB 2 -#define CORE_CLK_CTRL_DIV_LSB 0 -#define CORE_CLK_CTRL_DIV_MASK 'h00000007 -#define CORE_CLK_CTRL_DIV_GET(x) (((x) & CORE_CLK_CTRL_DIV_MASK) >> CORE_CLK_CTRL_DIV_LSB) -#define CORE_CLK_CTRL_DIV_SET(x) (((32'd0 | (x)) << CORE_CLK_CTRL_DIV_LSB) & CORE_CLK_CTRL_DIV_MASK) -#define CORE_CLK_CTRL_DIV_RESET 3'h2 -#define CORE_CLK_CTRL_RESET (32'h0 | \ - CORE_CLK_CTRL_DIV_SET(CORE_CLK_CTRL_DIV_RESET)) -#define CORE_CLK_CTRL_HW_MASK (32'h0) -#define CORE_CLK_CTRL_SW_MASK (32'h0 | \ - CORE_CLK_CTRL_DIV_MASK) - -#define SDIO_SETUP_CIRCUIT_ADDRESS 'h00000120 -#define SDIO_SETUP_CIRCUIT_VECTOR_MSB 7 -#define SDIO_SETUP_CIRCUIT_VECTOR_LSB 0 -#define SDIO_SETUP_CIRCUIT_VECTOR_MASK 'h000000ff -#define SDIO_SETUP_CIRCUIT_VECTOR_GET(x) (((x) & SDIO_SETUP_CIRCUIT_VECTOR_MASK) >> SDIO_SETUP_CIRCUIT_VECTOR_LSB) -#define SDIO_SETUP_CIRCUIT_VECTOR_SET(x) (((32'd0 | (x)) << SDIO_SETUP_CIRCUIT_VECTOR_LSB) & SDIO_SETUP_CIRCUIT_VECTOR_MASK) -#define SDIO_SETUP_CIRCUIT_VECTOR_RESET 8'h0 -#define SDIO_SETUP_CIRCUIT_RESET (32'h0 | \ - SDIO_SETUP_CIRCUIT_VECTOR_SET(SDIO_SETUP_CIRCUIT_VECTOR_RESET)) -#define SDIO_SETUP_CIRCUIT_HW_MASK (32'h0 | \ - SDIO_SETUP_CIRCUIT_VECTOR_MASK) -#define SDIO_SETUP_CIRCUIT_SW_MASK (32'h0) - -#define SDIO_SETUP_CONFIG_ADDRESS 'h00000140 -#define SDIO_SETUP_CONFIG_ENABLE_MSB 1 -#define SDIO_SETUP_CONFIG_ENABLE_LSB 1 -#define SDIO_SETUP_CONFIG_ENABLE_MASK 'h00000002 -#define SDIO_SETUP_CONFIG_ENABLE_GET(x) (((x) & SDIO_SETUP_CONFIG_ENABLE_MASK) >> SDIO_SETUP_CONFIG_ENABLE_LSB) -#define SDIO_SETUP_CONFIG_ENABLE_SET(x) (((32'd0 | (x)) << SDIO_SETUP_CONFIG_ENABLE_LSB) & SDIO_SETUP_CONFIG_ENABLE_MASK) -#define SDIO_SETUP_CONFIG_ENABLE_RESET 1'h0 -#define SDIO_SETUP_CONFIG_CLEAR_MSB 0 -#define SDIO_SETUP_CONFIG_CLEAR_LSB 0 -#define SDIO_SETUP_CONFIG_CLEAR_MASK 'h00000001 -#define SDIO_SETUP_CONFIG_CLEAR_GET(x) (((x) & SDIO_SETUP_CONFIG_CLEAR_MASK) >> SDIO_SETUP_CONFIG_CLEAR_LSB) -#define SDIO_SETUP_CONFIG_CLEAR_SET(x) (((32'd0 | (x)) << SDIO_SETUP_CONFIG_CLEAR_LSB) & SDIO_SETUP_CONFIG_CLEAR_MASK) -#define SDIO_SETUP_CONFIG_CLEAR_RESET 1'h1 -#define SDIO_SETUP_CONFIG_RESET (32'h0 | \ - SDIO_SETUP_CONFIG_ENABLE_SET(SDIO_SETUP_CONFIG_ENABLE_RESET) | \ - SDIO_SETUP_CONFIG_CLEAR_SET(SDIO_SETUP_CONFIG_CLEAR_RESET)) -#define SDIO_SETUP_CONFIG_HW_MASK (32'h0) -#define SDIO_SETUP_CONFIG_SW_MASK (32'h0 | \ - SDIO_SETUP_CONFIG_ENABLE_MASK | \ - SDIO_SETUP_CONFIG_CLEAR_MASK) - -#define CPU_SETUP_CONFIG_ADDRESS 'h00000144 -#define CPU_SETUP_CONFIG_ENABLE_MSB 1 -#define CPU_SETUP_CONFIG_ENABLE_LSB 1 -#define CPU_SETUP_CONFIG_ENABLE_MASK 'h00000002 -#define CPU_SETUP_CONFIG_ENABLE_GET(x) (((x) & CPU_SETUP_CONFIG_ENABLE_MASK) >> CPU_SETUP_CONFIG_ENABLE_LSB) -#define CPU_SETUP_CONFIG_ENABLE_SET(x) (((32'd0 | (x)) << CPU_SETUP_CONFIG_ENABLE_LSB) & CPU_SETUP_CONFIG_ENABLE_MASK) -#define CPU_SETUP_CONFIG_ENABLE_RESET 1'h0 -#define CPU_SETUP_CONFIG_CLEAR_MSB 0 -#define CPU_SETUP_CONFIG_CLEAR_LSB 0 -#define CPU_SETUP_CONFIG_CLEAR_MASK 'h00000001 -#define CPU_SETUP_CONFIG_CLEAR_GET(x) (((x) & CPU_SETUP_CONFIG_CLEAR_MASK) >> CPU_SETUP_CONFIG_CLEAR_LSB) -#define CPU_SETUP_CONFIG_CLEAR_SET(x) (((32'd0 | (x)) << CPU_SETUP_CONFIG_CLEAR_LSB) & CPU_SETUP_CONFIG_CLEAR_MASK) -#define CPU_SETUP_CONFIG_CLEAR_RESET 1'h0 -#define CPU_SETUP_CONFIG_RESET (32'h0 | \ - CPU_SETUP_CONFIG_ENABLE_SET(CPU_SETUP_CONFIG_ENABLE_RESET) | \ - CPU_SETUP_CONFIG_CLEAR_SET(CPU_SETUP_CONFIG_CLEAR_RESET)) -#define CPU_SETUP_CONFIG_HW_MASK (32'h0) -#define CPU_SETUP_CONFIG_SW_MASK (32'h0 | \ - CPU_SETUP_CONFIG_ENABLE_MASK | \ - CPU_SETUP_CONFIG_CLEAR_MASK) - -#define CPU_SETUP_CIRCUIT_ADDRESS 'h00000160 -#define CPU_SETUP_CIRCUIT_VECTOR_MSB 7 -#define CPU_SETUP_CIRCUIT_VECTOR_LSB 0 -#define CPU_SETUP_CIRCUIT_VECTOR_MASK 'h000000ff -#define CPU_SETUP_CIRCUIT_VECTOR_GET(x) (((x) & CPU_SETUP_CIRCUIT_VECTOR_MASK) >> CPU_SETUP_CIRCUIT_VECTOR_LSB) -#define CPU_SETUP_CIRCUIT_VECTOR_SET(x) (((32'd0 | (x)) << CPU_SETUP_CIRCUIT_VECTOR_LSB) & CPU_SETUP_CIRCUIT_VECTOR_MASK) -#define CPU_SETUP_CIRCUIT_VECTOR_RESET 8'h0 -#define CPU_SETUP_CIRCUIT_RESET (32'h0 | \ - CPU_SETUP_CIRCUIT_VECTOR_SET(CPU_SETUP_CIRCUIT_VECTOR_RESET)) -#define CPU_SETUP_CIRCUIT_HW_MASK (32'h0 | \ - CPU_SETUP_CIRCUIT_VECTOR_MASK) -#define CPU_SETUP_CIRCUIT_SW_MASK (32'h0) - -#define BB_SETUP_CONFIG_ADDRESS 'h00000180 -#define BB_SETUP_CONFIG_ENABLE_MSB 1 -#define BB_SETUP_CONFIG_ENABLE_LSB 1 -#define BB_SETUP_CONFIG_ENABLE_MASK 'h00000002 -#define BB_SETUP_CONFIG_ENABLE_GET(x) (((x) & BB_SETUP_CONFIG_ENABLE_MASK) >> BB_SETUP_CONFIG_ENABLE_LSB) -#define BB_SETUP_CONFIG_ENABLE_SET(x) (((32'd0 | (x)) << BB_SETUP_CONFIG_ENABLE_LSB) & BB_SETUP_CONFIG_ENABLE_MASK) -#define BB_SETUP_CONFIG_ENABLE_RESET 1'h0 -#define BB_SETUP_CONFIG_CLEAR_MSB 0 -#define BB_SETUP_CONFIG_CLEAR_LSB 0 -#define BB_SETUP_CONFIG_CLEAR_MASK 'h00000001 -#define BB_SETUP_CONFIG_CLEAR_GET(x) (((x) & BB_SETUP_CONFIG_CLEAR_MASK) >> BB_SETUP_CONFIG_CLEAR_LSB) -#define BB_SETUP_CONFIG_CLEAR_SET(x) (((32'd0 | (x)) << BB_SETUP_CONFIG_CLEAR_LSB) & BB_SETUP_CONFIG_CLEAR_MASK) -#define BB_SETUP_CONFIG_CLEAR_RESET 1'h0 -#define BB_SETUP_CONFIG_RESET (32'h0 | \ - BB_SETUP_CONFIG_ENABLE_SET(BB_SETUP_CONFIG_ENABLE_RESET) | \ - BB_SETUP_CONFIG_CLEAR_SET(BB_SETUP_CONFIG_CLEAR_RESET)) -#define BB_SETUP_CONFIG_HW_MASK (32'h0) -#define BB_SETUP_CONFIG_SW_MASK (32'h0 | \ - BB_SETUP_CONFIG_ENABLE_MASK | \ - BB_SETUP_CONFIG_CLEAR_MASK) - -#define BB_SETUP_CIRCUIT_ADDRESS 'h000001a0 -#define BB_SETUP_CIRCUIT_VECTOR_MSB 7 -#define BB_SETUP_CIRCUIT_VECTOR_LSB 0 -#define BB_SETUP_CIRCUIT_VECTOR_MASK 'h000000ff -#define BB_SETUP_CIRCUIT_VECTOR_GET(x) (((x) & BB_SETUP_CIRCUIT_VECTOR_MASK) >> BB_SETUP_CIRCUIT_VECTOR_LSB) -#define BB_SETUP_CIRCUIT_VECTOR_SET(x) (((32'd0 | (x)) << BB_SETUP_CIRCUIT_VECTOR_LSB) & BB_SETUP_CIRCUIT_VECTOR_MASK) -#define BB_SETUP_CIRCUIT_VECTOR_RESET 8'h0 -#define BB_SETUP_CIRCUIT_RESET (32'h0 | \ - BB_SETUP_CIRCUIT_VECTOR_SET(BB_SETUP_CIRCUIT_VECTOR_RESET)) -#define BB_SETUP_CIRCUIT_HW_MASK (32'h0 | \ - BB_SETUP_CIRCUIT_VECTOR_MASK) -#define BB_SETUP_CIRCUIT_SW_MASK (32'h0) - -#define GPIO_WAKEUP_CONTROL_ADDRESS 'h000001c0 -#define GPIO_WAKEUP_CONTROL_ENABLE_MSB 0 -#define GPIO_WAKEUP_CONTROL_ENABLE_LSB 0 -#define GPIO_WAKEUP_CONTROL_ENABLE_MASK 'h00000001 -#define GPIO_WAKEUP_CONTROL_ENABLE_GET(x) (((x) & GPIO_WAKEUP_CONTROL_ENABLE_MASK) >> GPIO_WAKEUP_CONTROL_ENABLE_LSB) -#define GPIO_WAKEUP_CONTROL_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_WAKEUP_CONTROL_ENABLE_LSB) & GPIO_WAKEUP_CONTROL_ENABLE_MASK) -#define GPIO_WAKEUP_CONTROL_ENABLE_RESET 1'h0 -#define GPIO_WAKEUP_CONTROL_RESET (32'h0 | \ - GPIO_WAKEUP_CONTROL_ENABLE_SET(GPIO_WAKEUP_CONTROL_ENABLE_RESET)) -#define GPIO_WAKEUP_CONTROL_HW_MASK (32'h0) -#define GPIO_WAKEUP_CONTROL_SW_MASK (32'h0 | \ - GPIO_WAKEUP_CONTROL_ENABLE_MASK) - -#define RTC_REG_ADDRESS_MSB 8 - -#endif /* _RTC_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/rxtxbb_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/rxtxbb_reg.h deleted file mode 100644 index 498d78701818..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/rxtxbb_reg.h +++ /dev/null @@ -1,278 +0,0 @@ -#ifndef _RXTXBB_REG_REG_H_ -#define _RXTXBB_REG_REG_H_ - -#define RXTXBB_RXTXBB1_ADDRESS 0x00000000 -#define RXTXBB_RXTXBB1_OFFSET 0x00000000 -#define RXTXBB_RXTXBB1_SPARE_MSB 31 -#define RXTXBB_RXTXBB1_SPARE_LSB 19 -#define RXTXBB_RXTXBB1_SPARE_MASK 0xfff80000 -#define RXTXBB_RXTXBB1_SPARE_GET(x) (((x) & RXTXBB_RXTXBB1_SPARE_MASK) >> RXTXBB_RXTXBB1_SPARE_LSB) -#define RXTXBB_RXTXBB1_SPARE_SET(x) (((x) << RXTXBB_RXTXBB1_SPARE_LSB) & RXTXBB_RXTXBB1_SPARE_MASK) -#define RXTXBB_RXTXBB1_FNOTCH_MSB 18 -#define RXTXBB_RXTXBB1_FNOTCH_LSB 17 -#define RXTXBB_RXTXBB1_FNOTCH_MASK 0x00060000 -#define RXTXBB_RXTXBB1_FNOTCH_GET(x) (((x) & RXTXBB_RXTXBB1_FNOTCH_MASK) >> RXTXBB_RXTXBB1_FNOTCH_LSB) -#define RXTXBB_RXTXBB1_FNOTCH_SET(x) (((x) << RXTXBB_RXTXBB1_FNOTCH_LSB) & RXTXBB_RXTXBB1_FNOTCH_MASK) -#define RXTXBB_RXTXBB1_SEL_ATB_MSB 16 -#define RXTXBB_RXTXBB1_SEL_ATB_LSB 9 -#define RXTXBB_RXTXBB1_SEL_ATB_MASK 0x0001fe00 -#define RXTXBB_RXTXBB1_SEL_ATB_GET(x) (((x) & RXTXBB_RXTXBB1_SEL_ATB_MASK) >> RXTXBB_RXTXBB1_SEL_ATB_LSB) -#define RXTXBB_RXTXBB1_SEL_ATB_SET(x) (((x) << RXTXBB_RXTXBB1_SEL_ATB_LSB) & RXTXBB_RXTXBB1_SEL_ATB_MASK) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_LSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MASK 0x00000100 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_GET(x) (((x) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) >> RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_SET(x) (((x) << RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) -#define RXTXBB_RXTXBB1_PDV2I_MSB 7 -#define RXTXBB_RXTXBB1_PDV2I_LSB 7 -#define RXTXBB_RXTXBB1_PDV2I_MASK 0x00000080 -#define RXTXBB_RXTXBB1_PDV2I_GET(x) (((x) & RXTXBB_RXTXBB1_PDV2I_MASK) >> RXTXBB_RXTXBB1_PDV2I_LSB) -#define RXTXBB_RXTXBB1_PDV2I_SET(x) (((x) << RXTXBB_RXTXBB1_PDV2I_LSB) & RXTXBB_RXTXBB1_PDV2I_MASK) -#define RXTXBB_RXTXBB1_PDI2V_MSB 6 -#define RXTXBB_RXTXBB1_PDI2V_LSB 6 -#define RXTXBB_RXTXBB1_PDI2V_MASK 0x00000040 -#define RXTXBB_RXTXBB1_PDI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDI2V_MASK) >> RXTXBB_RXTXBB1_PDI2V_LSB) -#define RXTXBB_RXTXBB1_PDI2V_SET(x) (((x) << RXTXBB_RXTXBB1_PDI2V_LSB) & RXTXBB_RXTXBB1_PDI2V_MASK) -#define RXTXBB_RXTXBB1_PDRXTXBB_MSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_LSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_MASK 0x00000020 -#define RXTXBB_RXTXBB1_PDRXTXBB_GET(x) (((x) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) >> RXTXBB_RXTXBB1_PDRXTXBB_LSB) -#define RXTXBB_RXTXBB1_PDRXTXBB_SET(x) (((x) << RXTXBB_RXTXBB1_PDRXTXBB_LSB) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK 0x00000010 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK 0x00000008 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_LSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MASK 0x00000004 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) >> RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_SET(x) (((x) << RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) -#define RXTXBB_RXTXBB1_PDLOQ_MSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_LSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_MASK 0x00000002 -#define RXTXBB_RXTXBB1_PDLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDLOQ_MASK) >> RXTXBB_RXTXBB1_PDLOQ_LSB) -#define RXTXBB_RXTXBB1_PDLOQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDLOQ_LSB) & RXTXBB_RXTXBB1_PDLOQ_MASK) -#define RXTXBB_RXTXBB1_PDHIQ_MSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_LSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_MASK 0x00000001 -#define RXTXBB_RXTXBB1_PDHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDHIQ_MASK) >> RXTXBB_RXTXBB1_PDHIQ_LSB) -#define RXTXBB_RXTXBB1_PDHIQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDHIQ_LSB) & RXTXBB_RXTXBB1_PDHIQ_MASK) - -#define RXTXBB_RXTXBB2_ADDRESS 0x00000004 -#define RXTXBB_RXTXBB2_OFFSET 0x00000004 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MSB 31 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB 29 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK 0xe0000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_SET(x) (((x) << RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MSB 28 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB 26 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK 0x1c000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_SET(x) (((x) << RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MSB 25 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB 23 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK 0x03800000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_SET(x) (((x) << RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) -#define RXTXBB_RXTXBB2_SPARE_MSB 22 -#define RXTXBB_RXTXBB2_SPARE_LSB 21 -#define RXTXBB_RXTXBB2_SPARE_MASK 0x00600000 -#define RXTXBB_RXTXBB2_SPARE_GET(x) (((x) & RXTXBB_RXTXBB2_SPARE_MASK) >> RXTXBB_RXTXBB2_SPARE_LSB) -#define RXTXBB_RXTXBB2_SPARE_SET(x) (((x) << RXTXBB_RXTXBB2_SPARE_LSB) & RXTXBB_RXTXBB2_SPARE_MASK) -#define RXTXBB_RXTXBB2_SHORTBUFFER_MSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_LSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_MASK 0x00100000 -#define RXTXBB_RXTXBB2_SHORTBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) >> RXTXBB_RXTXBB2_SHORTBUFFER_LSB) -#define RXTXBB_RXTXBB2_SHORTBUFFER_SET(x) (((x) << RXTXBB_RXTXBB2_SHORTBUFFER_LSB) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) -#define RXTXBB_RXTXBB2_SELBUFFER_MSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_LSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_MASK 0x00080000 -#define RXTXBB_RXTXBB2_SELBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SELBUFFER_MASK) >> RXTXBB_RXTXBB2_SELBUFFER_LSB) -#define RXTXBB_RXTXBB2_SELBUFFER_SET(x) (((x) << RXTXBB_RXTXBB2_SELBUFFER_LSB) & RXTXBB_RXTXBB2_SELBUFFER_MASK) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK 0x00040000 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK 0x00020000 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK 0x00010000 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK 0x00008000 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) -#define RXTXBB_RXTXBB2_CMSEL_MSB 14 -#define RXTXBB_RXTXBB2_CMSEL_LSB 13 -#define RXTXBB_RXTXBB2_CMSEL_MASK 0x00006000 -#define RXTXBB_RXTXBB2_CMSEL_GET(x) (((x) & RXTXBB_RXTXBB2_CMSEL_MASK) >> RXTXBB_RXTXBB2_CMSEL_LSB) -#define RXTXBB_RXTXBB2_CMSEL_SET(x) (((x) << RXTXBB_RXTXBB2_CMSEL_LSB) & RXTXBB_RXTXBB2_CMSEL_MASK) -#define RXTXBB_RXTXBB2_FILTERFC_MSB 12 -#define RXTXBB_RXTXBB2_FILTERFC_LSB 8 -#define RXTXBB_RXTXBB2_FILTERFC_MASK 0x00001f00 -#define RXTXBB_RXTXBB2_FILTERFC_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERFC_MASK) >> RXTXBB_RXTXBB2_FILTERFC_LSB) -#define RXTXBB_RXTXBB2_FILTERFC_SET(x) (((x) << RXTXBB_RXTXBB2_FILTERFC_LSB) & RXTXBB_RXTXBB2_FILTERFC_MASK) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK 0x00000080 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_GET(x) (((x) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) >> RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_SET(x) (((x) << RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK 0x00000040 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) >> RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_SET(x) (((x) << RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK 0x00000020 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK 0x00000010 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK 0x00000008 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK 0x00000004 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK 0x00000002 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK 0x00000001 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_GET(x) (((x) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) >> RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_SET(x) (((x) << RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) - -#define RXTXBB_RXTXBB3_ADDRESS 0x00000008 -#define RXTXBB_RXTXBB3_OFFSET 0x00000008 -#define RXTXBB_RXTXBB3_SPARE_MSB 31 -#define RXTXBB_RXTXBB3_SPARE_LSB 27 -#define RXTXBB_RXTXBB3_SPARE_MASK 0xf8000000 -#define RXTXBB_RXTXBB3_SPARE_GET(x) (((x) & RXTXBB_RXTXBB3_SPARE_MASK) >> RXTXBB_RXTXBB3_SPARE_LSB) -#define RXTXBB_RXTXBB3_SPARE_SET(x) (((x) << RXTXBB_RXTXBB3_SPARE_LSB) & RXTXBB_RXTXBB3_SPARE_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MSB 26 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB 24 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK 0x07000000 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MSB 23 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB 21 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK 0x00e00000 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MSB 20 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB 18 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK 0x001c0000 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MSB 17 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB 15 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK 0x00038000 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MSB 14 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB 12 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK 0x00007000 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MSB 11 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB 9 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK 0x00000e00 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MSB 8 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB 6 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK 0x000001c0 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MSB 5 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB 3 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK 0x00000038 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) >> RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MSB 2 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB 0 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK 0x00000007 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) - -#define RXTXBB_RXTXBB4_ADDRESS 0x0000000c -#define RXTXBB_RXTXBB4_OFFSET 0x0000000c -#define RXTXBB_RXTXBB4_SPARE_MSB 31 -#define RXTXBB_RXTXBB4_SPARE_LSB 31 -#define RXTXBB_RXTXBB4_SPARE_MASK 0x80000000 -#define RXTXBB_RXTXBB4_SPARE_GET(x) (((x) & RXTXBB_RXTXBB4_SPARE_MASK) >> RXTXBB_RXTXBB4_SPARE_LSB) -#define RXTXBB_RXTXBB4_SPARE_SET(x) (((x) << RXTXBB_RXTXBB4_SPARE_LSB) & RXTXBB_RXTXBB4_SPARE_MASK) -#define RXTXBB_RXTXBB4_LOCALOFFSET_MSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_LSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_MASK 0x40000000 -#define RXTXBB_RXTXBB4_LOCALOFFSET_GET(x) (((x) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) >> RXTXBB_RXTXBB4_LOCALOFFSET_LSB) -#define RXTXBB_RXTXBB4_LOCALOFFSET_SET(x) (((x) << RXTXBB_RXTXBB4_LOCALOFFSET_LSB) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHII_MSB 29 -#define RXTXBB_RXTXBB4_OFSTCORRHII_LSB 25 -#define RXTXBB_RXTXBB4_OFSTCORRHII_MASK 0x3e000000 -#define RXTXBB_RXTXBB4_OFSTCORRHII_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHII_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHII_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRHII_LSB) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MSB 24 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB 20 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK 0x01f00000 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MSB 19 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_LSB 15 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MASK 0x000f8000 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MSB 14 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB 10 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK 0x00007c00 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MSB 9 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB 5 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK 0x000003e0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MSB 4 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB 0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK 0x0000001f -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct rxtxbb_reg_reg_s { - volatile unsigned int rxtxbb_rxtxbb1; - volatile unsigned int rxtxbb_rxtxbb2; - volatile unsigned int rxtxbb_rxtxbb3; - volatile unsigned int rxtxbb_rxtxbb4; -} rxtxbb_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _RXTXBB_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/rxtxbb_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/rxtxbb_reg.vrh deleted file mode 100644 index 0b15458c4635..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/rxtxbb_reg.vrh +++ /dev/null @@ -1,433 +0,0 @@ -#ifndef _RXTXBB_REG_VRH_ -#define _RXTXBB_REG_VRH_ - -#define RXTXBB_RXTXBB1_ADDRESS 'h00000000 -#define RXTXBB_RXTXBB1_SPARE_MSB 31 -#define RXTXBB_RXTXBB1_SPARE_LSB 19 -#define RXTXBB_RXTXBB1_SPARE_MASK 'hfff80000 -#define RXTXBB_RXTXBB1_SPARE_GET(x) (((x) & RXTXBB_RXTXBB1_SPARE_MASK) >> RXTXBB_RXTXBB1_SPARE_LSB) -#define RXTXBB_RXTXBB1_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_SPARE_LSB) & RXTXBB_RXTXBB1_SPARE_MASK) -#define RXTXBB_RXTXBB1_SPARE_RESET 13'h0 -#define RXTXBB_RXTXBB1_FNOTCH_MSB 18 -#define RXTXBB_RXTXBB1_FNOTCH_LSB 17 -#define RXTXBB_RXTXBB1_FNOTCH_MASK 'h00060000 -#define RXTXBB_RXTXBB1_FNOTCH_GET(x) (((x) & RXTXBB_RXTXBB1_FNOTCH_MASK) >> RXTXBB_RXTXBB1_FNOTCH_LSB) -#define RXTXBB_RXTXBB1_FNOTCH_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_FNOTCH_LSB) & RXTXBB_RXTXBB1_FNOTCH_MASK) -#define RXTXBB_RXTXBB1_FNOTCH_RESET 2'h0 -#define RXTXBB_RXTXBB1_SEL_ATB_MSB 16 -#define RXTXBB_RXTXBB1_SEL_ATB_LSB 9 -#define RXTXBB_RXTXBB1_SEL_ATB_MASK 'h0001fe00 -#define RXTXBB_RXTXBB1_SEL_ATB_GET(x) (((x) & RXTXBB_RXTXBB1_SEL_ATB_MASK) >> RXTXBB_RXTXBB1_SEL_ATB_LSB) -#define RXTXBB_RXTXBB1_SEL_ATB_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_SEL_ATB_LSB) & RXTXBB_RXTXBB1_SEL_ATB_MASK) -#define RXTXBB_RXTXBB1_SEL_ATB_RESET 8'h0 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_LSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MASK 'h00000100 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_GET(x) (((x) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) >> RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDV2I_MSB 7 -#define RXTXBB_RXTXBB1_PDV2I_LSB 7 -#define RXTXBB_RXTXBB1_PDV2I_MASK 'h00000080 -#define RXTXBB_RXTXBB1_PDV2I_GET(x) (((x) & RXTXBB_RXTXBB1_PDV2I_MASK) >> RXTXBB_RXTXBB1_PDV2I_LSB) -#define RXTXBB_RXTXBB1_PDV2I_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDV2I_LSB) & RXTXBB_RXTXBB1_PDV2I_MASK) -#define RXTXBB_RXTXBB1_PDV2I_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDI2V_MSB 6 -#define RXTXBB_RXTXBB1_PDI2V_LSB 6 -#define RXTXBB_RXTXBB1_PDI2V_MASK 'h00000040 -#define RXTXBB_RXTXBB1_PDI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDI2V_MASK) >> RXTXBB_RXTXBB1_PDI2V_LSB) -#define RXTXBB_RXTXBB1_PDI2V_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDI2V_LSB) & RXTXBB_RXTXBB1_PDI2V_MASK) -#define RXTXBB_RXTXBB1_PDI2V_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDRXTXBB_MSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_LSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_MASK 'h00000020 -#define RXTXBB_RXTXBB1_PDRXTXBB_GET(x) (((x) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) >> RXTXBB_RXTXBB1_PDRXTXBB_LSB) -#define RXTXBB_RXTXBB1_PDRXTXBB_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDRXTXBB_LSB) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) -#define RXTXBB_RXTXBB1_PDRXTXBB_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK 'h00000010 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK 'h00000008 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_LSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MASK 'h00000004 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) >> RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDLOQ_MSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_LSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_MASK 'h00000002 -#define RXTXBB_RXTXBB1_PDLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDLOQ_MASK) >> RXTXBB_RXTXBB1_PDLOQ_LSB) -#define RXTXBB_RXTXBB1_PDLOQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDLOQ_LSB) & RXTXBB_RXTXBB1_PDLOQ_MASK) -#define RXTXBB_RXTXBB1_PDLOQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDHIQ_MSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_LSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_MASK 'h00000001 -#define RXTXBB_RXTXBB1_PDHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDHIQ_MASK) >> RXTXBB_RXTXBB1_PDHIQ_LSB) -#define RXTXBB_RXTXBB1_PDHIQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDHIQ_LSB) & RXTXBB_RXTXBB1_PDHIQ_MASK) -#define RXTXBB_RXTXBB1_PDHIQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_RESET (32'h0 | \ - RXTXBB_RXTXBB1_SPARE_SET(RXTXBB_RXTXBB1_SPARE_RESET) | \ - RXTXBB_RXTXBB1_FNOTCH_SET(RXTXBB_RXTXBB1_FNOTCH_RESET) | \ - RXTXBB_RXTXBB1_SEL_ATB_SET(RXTXBB_RXTXBB1_SEL_ATB_RESET) | \ - RXTXBB_RXTXBB1_PDDACINTERFACE_SET(RXTXBB_RXTXBB1_PDDACINTERFACE_RESET) | \ - RXTXBB_RXTXBB1_PDV2I_SET(RXTXBB_RXTXBB1_PDV2I_RESET) | \ - RXTXBB_RXTXBB1_PDI2V_SET(RXTXBB_RXTXBB1_PDI2V_RESET) | \ - RXTXBB_RXTXBB1_PDRXTXBB_SET(RXTXBB_RXTXBB1_PDRXTXBB_RESET) | \ - RXTXBB_RXTXBB1_PDOFFSETLOQ_SET(RXTXBB_RXTXBB1_PDOFFSETLOQ_RESET) | \ - RXTXBB_RXTXBB1_PDOFFSETHIQ_SET(RXTXBB_RXTXBB1_PDOFFSETHIQ_RESET) | \ - RXTXBB_RXTXBB1_PDOFFSETI2V_SET(RXTXBB_RXTXBB1_PDOFFSETI2V_RESET) | \ - RXTXBB_RXTXBB1_PDLOQ_SET(RXTXBB_RXTXBB1_PDLOQ_RESET) | \ - RXTXBB_RXTXBB1_PDHIQ_SET(RXTXBB_RXTXBB1_PDHIQ_RESET)) -#define RXTXBB_RXTXBB1_HW_MASK (32'h0) -#define RXTXBB_RXTXBB1_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB1_SPARE_MASK | \ - RXTXBB_RXTXBB1_FNOTCH_MASK | \ - RXTXBB_RXTXBB1_SEL_ATB_MASK | \ - RXTXBB_RXTXBB1_PDDACINTERFACE_MASK | \ - RXTXBB_RXTXBB1_PDV2I_MASK | \ - RXTXBB_RXTXBB1_PDI2V_MASK | \ - RXTXBB_RXTXBB1_PDRXTXBB_MASK | \ - RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK | \ - RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK | \ - RXTXBB_RXTXBB1_PDOFFSETI2V_MASK | \ - RXTXBB_RXTXBB1_PDLOQ_MASK | \ - RXTXBB_RXTXBB1_PDHIQ_MASK) - -#define RXTXBB_RXTXBB2_ADDRESS 'h00000004 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MSB 31 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB 29 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK 'he0000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_RESET 3'h6 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MSB 28 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB 26 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK 'h1c000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_RESET 3'h6 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MSB 25 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB 23 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK 'h03800000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_RESET 3'h6 -#define RXTXBB_RXTXBB2_SPARE_MSB 22 -#define RXTXBB_RXTXBB2_SPARE_LSB 21 -#define RXTXBB_RXTXBB2_SPARE_MASK 'h00600000 -#define RXTXBB_RXTXBB2_SPARE_GET(x) (((x) & RXTXBB_RXTXBB2_SPARE_MASK) >> RXTXBB_RXTXBB2_SPARE_LSB) -#define RXTXBB_RXTXBB2_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SPARE_LSB) & RXTXBB_RXTXBB2_SPARE_MASK) -#define RXTXBB_RXTXBB2_SPARE_RESET 2'h0 -#define RXTXBB_RXTXBB2_SHORTBUFFER_MSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_LSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_MASK 'h00100000 -#define RXTXBB_RXTXBB2_SHORTBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) >> RXTXBB_RXTXBB2_SHORTBUFFER_LSB) -#define RXTXBB_RXTXBB2_SHORTBUFFER_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SHORTBUFFER_LSB) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) -#define RXTXBB_RXTXBB2_SHORTBUFFER_RESET 1'h0 -#define RXTXBB_RXTXBB2_SELBUFFER_MSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_LSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_MASK 'h00080000 -#define RXTXBB_RXTXBB2_SELBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SELBUFFER_MASK) >> RXTXBB_RXTXBB2_SELBUFFER_LSB) -#define RXTXBB_RXTXBB2_SELBUFFER_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SELBUFFER_LSB) & RXTXBB_RXTXBB2_SELBUFFER_MASK) -#define RXTXBB_RXTXBB2_SELBUFFER_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK 'h00040000 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK 'h00020000 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK 'h00010000 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK 'h00008000 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_CMSEL_MSB 14 -#define RXTXBB_RXTXBB2_CMSEL_LSB 13 -#define RXTXBB_RXTXBB2_CMSEL_MASK 'h00006000 -#define RXTXBB_RXTXBB2_CMSEL_GET(x) (((x) & RXTXBB_RXTXBB2_CMSEL_MASK) >> RXTXBB_RXTXBB2_CMSEL_LSB) -#define RXTXBB_RXTXBB2_CMSEL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_CMSEL_LSB) & RXTXBB_RXTXBB2_CMSEL_MASK) -#define RXTXBB_RXTXBB2_CMSEL_RESET 2'h1 -#define RXTXBB_RXTXBB2_FILTERFC_MSB 12 -#define RXTXBB_RXTXBB2_FILTERFC_LSB 8 -#define RXTXBB_RXTXBB2_FILTERFC_MASK 'h00001f00 -#define RXTXBB_RXTXBB2_FILTERFC_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERFC_MASK) >> RXTXBB_RXTXBB2_FILTERFC_LSB) -#define RXTXBB_RXTXBB2_FILTERFC_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_FILTERFC_LSB) & RXTXBB_RXTXBB2_FILTERFC_MASK) -#define RXTXBB_RXTXBB2_FILTERFC_RESET 5'h10 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK 'h00000080 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_GET(x) (((x) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) >> RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_RESET 1'h0 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK 'h00000040 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) >> RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK 'h00000020 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK 'h00000010 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_RESET 1'h1 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK 'h00000008 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK 'h00000004 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK 'h00000002 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_RESET 1'h1 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK 'h00000001 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_GET(x) (((x) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) >> RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_RESET 1'h0 -#define RXTXBB_RXTXBB2_RESET (32'h0 | \ - RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_SET(RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_RESET) | \ - RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_SET(RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_RESET) | \ - RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_SET(RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_RESET) | \ - RXTXBB_RXTXBB2_SPARE_SET(RXTXBB_RXTXBB2_SPARE_RESET) | \ - RXTXBB_RXTXBB2_SHORTBUFFER_SET(RXTXBB_RXTXBB2_SHORTBUFFER_RESET) | \ - RXTXBB_RXTXBB2_SELBUFFER_SET(RXTXBB_RXTXBB2_SELBUFFER_RESET) | \ - RXTXBB_RXTXBB2_SEL_DAC_TEST_SET(RXTXBB_RXTXBB2_SEL_DAC_TEST_RESET) | \ - RXTXBB_RXTXBB2_SEL_LOQ_TEST_SET(RXTXBB_RXTXBB2_SEL_LOQ_TEST_RESET) | \ - RXTXBB_RXTXBB2_SEL_HIQ_TEST_SET(RXTXBB_RXTXBB2_SEL_HIQ_TEST_RESET) | \ - RXTXBB_RXTXBB2_SEL_I2V_TEST_SET(RXTXBB_RXTXBB2_SEL_I2V_TEST_RESET) | \ - RXTXBB_RXTXBB2_CMSEL_SET(RXTXBB_RXTXBB2_CMSEL_RESET) | \ - RXTXBB_RXTXBB2_FILTERFC_SET(RXTXBB_RXTXBB2_FILTERFC_RESET) | \ - RXTXBB_RXTXBB2_LOCALFILTERTUNING_SET(RXTXBB_RXTXBB2_LOCALFILTERTUNING_RESET) | \ - RXTXBB_RXTXBB2_FILTERDOUBLEBW_SET(RXTXBB_RXTXBB2_FILTERDOUBLEBW_RESET) | \ - RXTXBB_RXTXBB2_PATH2HIQ_EN_SET(RXTXBB_RXTXBB2_PATH2HIQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH1HIQ_EN_SET(RXTXBB_RXTXBB2_PATH1HIQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH3LOQ_EN_SET(RXTXBB_RXTXBB2_PATH3LOQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH2LOQ_EN_SET(RXTXBB_RXTXBB2_PATH2LOQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH1LOQ_EN_SET(RXTXBB_RXTXBB2_PATH1LOQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH_OVERRIDE_SET(RXTXBB_RXTXBB2_PATH_OVERRIDE_RESET)) -#define RXTXBB_RXTXBB2_HW_MASK (32'h0 | \ - RXTXBB_RXTXBB2_FILTERFC_MASK) -#define RXTXBB_RXTXBB2_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK | \ - RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK | \ - RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK | \ - RXTXBB_RXTXBB2_SPARE_MASK | \ - RXTXBB_RXTXBB2_SHORTBUFFER_MASK | \ - RXTXBB_RXTXBB2_SELBUFFER_MASK | \ - RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK | \ - RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK | \ - RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK | \ - RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK | \ - RXTXBB_RXTXBB2_CMSEL_MASK | \ - RXTXBB_RXTXBB2_FILTERFC_MASK | \ - RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK | \ - RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK | \ - RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) - -#define RXTXBB_RXTXBB3_ADDRESS 'h00000008 -#define RXTXBB_RXTXBB3_SPARE_MSB 31 -#define RXTXBB_RXTXBB3_SPARE_LSB 27 -#define RXTXBB_RXTXBB3_SPARE_MASK 'hf8000000 -#define RXTXBB_RXTXBB3_SPARE_GET(x) (((x) & RXTXBB_RXTXBB3_SPARE_MASK) >> RXTXBB_RXTXBB3_SPARE_LSB) -#define RXTXBB_RXTXBB3_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_SPARE_LSB) & RXTXBB_RXTXBB3_SPARE_MASK) -#define RXTXBB_RXTXBB3_SPARE_RESET 5'h0 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MSB 26 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB 24 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK 'h07000000 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MSB 23 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB 21 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK 'h00e00000 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MSB 20 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB 18 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK 'h001c0000 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MSB 17 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB 15 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK 'h00038000 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MSB 14 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB 12 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK 'h00007000 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MSB 11 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB 9 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK 'h00000e00 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MSB 8 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB 6 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK 'h000001c0 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MSB 5 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB 3 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK 'h00000038 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) >> RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_RESET 3'h2 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MSB 2 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB 0 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK 'h00000007 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_RESET (32'h0 | \ - RXTXBB_RXTXBB3_SPARE_SET(RXTXBB_RXTXBB3_SPARE_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_SET(RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_SET(RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_RESET)) -#define RXTXBB_RXTXBB3_HW_MASK (32'h0) -#define RXTXBB_RXTXBB3_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB3_SPARE_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) - -#define RXTXBB_RXTXBB4_ADDRESS 'h0000000c -#define RXTXBB_RXTXBB4_SPARE_MSB 31 -#define RXTXBB_RXTXBB4_SPARE_LSB 31 -#define RXTXBB_RXTXBB4_SPARE_MASK 'h80000000 -#define RXTXBB_RXTXBB4_SPARE_GET(x) (((x) & RXTXBB_RXTXBB4_SPARE_MASK) >> RXTXBB_RXTXBB4_SPARE_LSB) -#define RXTXBB_RXTXBB4_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_SPARE_LSB) & RXTXBB_RXTXBB4_SPARE_MASK) -#define RXTXBB_RXTXBB4_SPARE_RESET 1'h0 -#define RXTXBB_RXTXBB4_LOCALOFFSET_MSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_LSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_MASK 'h40000000 -#define RXTXBB_RXTXBB4_LOCALOFFSET_GET(x) (((x) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) >> RXTXBB_RXTXBB4_LOCALOFFSET_LSB) -#define RXTXBB_RXTXBB4_LOCALOFFSET_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_LOCALOFFSET_LSB) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) -#define RXTXBB_RXTXBB4_LOCALOFFSET_RESET 1'h0 -#define RXTXBB_RXTXBB4_OFSTCORRHII_MSB 29 -#define RXTXBB_RXTXBB4_OFSTCORRHII_LSB 25 -#define RXTXBB_RXTXBB4_OFSTCORRHII_MASK 'h3e000000 -#define RXTXBB_RXTXBB4_OFSTCORRHII_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHII_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHII_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRHII_LSB) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHII_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MSB 24 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB 20 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK 'h01f00000 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MSB 19 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_LSB 15 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MASK 'h000f8000 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MSB 14 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB 10 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK 'h00007c00 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MSB 9 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB 5 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK 'h000003e0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MSB 4 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB 0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK 'h0000001f -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_RESET 5'h10 -#define RXTXBB_RXTXBB4_RESET (32'h0 | \ - RXTXBB_RXTXBB4_SPARE_SET(RXTXBB_RXTXBB4_SPARE_RESET) | \ - RXTXBB_RXTXBB4_LOCALOFFSET_SET(RXTXBB_RXTXBB4_LOCALOFFSET_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRHII_SET(RXTXBB_RXTXBB4_OFSTCORRHII_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRHIQ_SET(RXTXBB_RXTXBB4_OFSTCORRHIQ_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRLOI_SET(RXTXBB_RXTXBB4_OFSTCORRLOI_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRLOQ_SET(RXTXBB_RXTXBB4_OFSTCORRLOQ_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRI2VI_SET(RXTXBB_RXTXBB4_OFSTCORRI2VI_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRI2VQ_SET(RXTXBB_RXTXBB4_OFSTCORRI2VQ_RESET)) -#define RXTXBB_RXTXBB4_HW_MASK (32'h0 | \ - RXTXBB_RXTXBB4_OFSTCORRHII_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) -#define RXTXBB_RXTXBB4_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB4_SPARE_MASK | \ - RXTXBB_RXTXBB4_LOCALOFFSET_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRHII_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) - -#define RXTXBB_REG_ADDRESS_MSB 3 - -#endif /* _RXTXBB_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/si_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/si_reg.h deleted file mode 100644 index 16fb99cfd0b8..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/si_reg.h +++ /dev/null @@ -1,186 +0,0 @@ -#ifndef _SI_REG_REG_H_ -#define _SI_REG_REG_H_ - -#define SI_CONFIG_ADDRESS 0x00000000 -#define SI_CONFIG_OFFSET 0x00000000 -#define SI_CONFIG_ERR_INT_MSB 19 -#define SI_CONFIG_ERR_INT_LSB 19 -#define SI_CONFIG_ERR_INT_MASK 0x00080000 -#define SI_CONFIG_ERR_INT_GET(x) (((x) & SI_CONFIG_ERR_INT_MASK) >> SI_CONFIG_ERR_INT_LSB) -#define SI_CONFIG_ERR_INT_SET(x) (((x) << SI_CONFIG_ERR_INT_LSB) & SI_CONFIG_ERR_INT_MASK) -#define SI_CONFIG_BIDIR_OD_DATA_MSB 18 -#define SI_CONFIG_BIDIR_OD_DATA_LSB 18 -#define SI_CONFIG_BIDIR_OD_DATA_MASK 0x00040000 -#define SI_CONFIG_BIDIR_OD_DATA_GET(x) (((x) & SI_CONFIG_BIDIR_OD_DATA_MASK) >> SI_CONFIG_BIDIR_OD_DATA_LSB) -#define SI_CONFIG_BIDIR_OD_DATA_SET(x) (((x) << SI_CONFIG_BIDIR_OD_DATA_LSB) & SI_CONFIG_BIDIR_OD_DATA_MASK) -#define SI_CONFIG_I2C_MSB 16 -#define SI_CONFIG_I2C_LSB 16 -#define SI_CONFIG_I2C_MASK 0x00010000 -#define SI_CONFIG_I2C_GET(x) (((x) & SI_CONFIG_I2C_MASK) >> SI_CONFIG_I2C_LSB) -#define SI_CONFIG_I2C_SET(x) (((x) << SI_CONFIG_I2C_LSB) & SI_CONFIG_I2C_MASK) -#define SI_CONFIG_POS_SAMPLE_MSB 7 -#define SI_CONFIG_POS_SAMPLE_LSB 7 -#define SI_CONFIG_POS_SAMPLE_MASK 0x00000080 -#define SI_CONFIG_POS_SAMPLE_GET(x) (((x) & SI_CONFIG_POS_SAMPLE_MASK) >> SI_CONFIG_POS_SAMPLE_LSB) -#define SI_CONFIG_POS_SAMPLE_SET(x) (((x) << SI_CONFIG_POS_SAMPLE_LSB) & SI_CONFIG_POS_SAMPLE_MASK) -#define SI_CONFIG_POS_DRIVE_MSB 6 -#define SI_CONFIG_POS_DRIVE_LSB 6 -#define SI_CONFIG_POS_DRIVE_MASK 0x00000040 -#define SI_CONFIG_POS_DRIVE_GET(x) (((x) & SI_CONFIG_POS_DRIVE_MASK) >> SI_CONFIG_POS_DRIVE_LSB) -#define SI_CONFIG_POS_DRIVE_SET(x) (((x) << SI_CONFIG_POS_DRIVE_LSB) & SI_CONFIG_POS_DRIVE_MASK) -#define SI_CONFIG_INACTIVE_DATA_MSB 5 -#define SI_CONFIG_INACTIVE_DATA_LSB 5 -#define SI_CONFIG_INACTIVE_DATA_MASK 0x00000020 -#define SI_CONFIG_INACTIVE_DATA_GET(x) (((x) & SI_CONFIG_INACTIVE_DATA_MASK) >> SI_CONFIG_INACTIVE_DATA_LSB) -#define SI_CONFIG_INACTIVE_DATA_SET(x) (((x) << SI_CONFIG_INACTIVE_DATA_LSB) & SI_CONFIG_INACTIVE_DATA_MASK) -#define SI_CONFIG_INACTIVE_CLK_MSB 4 -#define SI_CONFIG_INACTIVE_CLK_LSB 4 -#define SI_CONFIG_INACTIVE_CLK_MASK 0x00000010 -#define SI_CONFIG_INACTIVE_CLK_GET(x) (((x) & SI_CONFIG_INACTIVE_CLK_MASK) >> SI_CONFIG_INACTIVE_CLK_LSB) -#define SI_CONFIG_INACTIVE_CLK_SET(x) (((x) << SI_CONFIG_INACTIVE_CLK_LSB) & SI_CONFIG_INACTIVE_CLK_MASK) -#define SI_CONFIG_DIVIDER_MSB 3 -#define SI_CONFIG_DIVIDER_LSB 0 -#define SI_CONFIG_DIVIDER_MASK 0x0000000f -#define SI_CONFIG_DIVIDER_GET(x) (((x) & SI_CONFIG_DIVIDER_MASK) >> SI_CONFIG_DIVIDER_LSB) -#define SI_CONFIG_DIVIDER_SET(x) (((x) << SI_CONFIG_DIVIDER_LSB) & SI_CONFIG_DIVIDER_MASK) - -#define SI_CS_ADDRESS 0x00000004 -#define SI_CS_OFFSET 0x00000004 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_MSB 13 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_LSB 11 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_MASK 0x00003800 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_GET(x) (((x) & SI_CS_BIT_CNT_IN_LAST_BYTE_MASK) >> SI_CS_BIT_CNT_IN_LAST_BYTE_LSB) -#define SI_CS_BIT_CNT_IN_LAST_BYTE_SET(x) (((x) << SI_CS_BIT_CNT_IN_LAST_BYTE_LSB) & SI_CS_BIT_CNT_IN_LAST_BYTE_MASK) -#define SI_CS_DONE_ERR_MSB 10 -#define SI_CS_DONE_ERR_LSB 10 -#define SI_CS_DONE_ERR_MASK 0x00000400 -#define SI_CS_DONE_ERR_GET(x) (((x) & SI_CS_DONE_ERR_MASK) >> SI_CS_DONE_ERR_LSB) -#define SI_CS_DONE_ERR_SET(x) (((x) << SI_CS_DONE_ERR_LSB) & SI_CS_DONE_ERR_MASK) -#define SI_CS_DONE_INT_MSB 9 -#define SI_CS_DONE_INT_LSB 9 -#define SI_CS_DONE_INT_MASK 0x00000200 -#define SI_CS_DONE_INT_GET(x) (((x) & SI_CS_DONE_INT_MASK) >> SI_CS_DONE_INT_LSB) -#define SI_CS_DONE_INT_SET(x) (((x) << SI_CS_DONE_INT_LSB) & SI_CS_DONE_INT_MASK) -#define SI_CS_START_MSB 8 -#define SI_CS_START_LSB 8 -#define SI_CS_START_MASK 0x00000100 -#define SI_CS_START_GET(x) (((x) & SI_CS_START_MASK) >> SI_CS_START_LSB) -#define SI_CS_START_SET(x) (((x) << SI_CS_START_LSB) & SI_CS_START_MASK) -#define SI_CS_RX_CNT_MSB 7 -#define SI_CS_RX_CNT_LSB 4 -#define SI_CS_RX_CNT_MASK 0x000000f0 -#define SI_CS_RX_CNT_GET(x) (((x) & SI_CS_RX_CNT_MASK) >> SI_CS_RX_CNT_LSB) -#define SI_CS_RX_CNT_SET(x) (((x) << SI_CS_RX_CNT_LSB) & SI_CS_RX_CNT_MASK) -#define SI_CS_TX_CNT_MSB 3 -#define SI_CS_TX_CNT_LSB 0 -#define SI_CS_TX_CNT_MASK 0x0000000f -#define SI_CS_TX_CNT_GET(x) (((x) & SI_CS_TX_CNT_MASK) >> SI_CS_TX_CNT_LSB) -#define SI_CS_TX_CNT_SET(x) (((x) << SI_CS_TX_CNT_LSB) & SI_CS_TX_CNT_MASK) - -#define SI_TX_DATA0_ADDRESS 0x00000008 -#define SI_TX_DATA0_OFFSET 0x00000008 -#define SI_TX_DATA0_DATA3_MSB 31 -#define SI_TX_DATA0_DATA3_LSB 24 -#define SI_TX_DATA0_DATA3_MASK 0xff000000 -#define SI_TX_DATA0_DATA3_GET(x) (((x) & SI_TX_DATA0_DATA3_MASK) >> SI_TX_DATA0_DATA3_LSB) -#define SI_TX_DATA0_DATA3_SET(x) (((x) << SI_TX_DATA0_DATA3_LSB) & SI_TX_DATA0_DATA3_MASK) -#define SI_TX_DATA0_DATA2_MSB 23 -#define SI_TX_DATA0_DATA2_LSB 16 -#define SI_TX_DATA0_DATA2_MASK 0x00ff0000 -#define SI_TX_DATA0_DATA2_GET(x) (((x) & SI_TX_DATA0_DATA2_MASK) >> SI_TX_DATA0_DATA2_LSB) -#define SI_TX_DATA0_DATA2_SET(x) (((x) << SI_TX_DATA0_DATA2_LSB) & SI_TX_DATA0_DATA2_MASK) -#define SI_TX_DATA0_DATA1_MSB 15 -#define SI_TX_DATA0_DATA1_LSB 8 -#define SI_TX_DATA0_DATA1_MASK 0x0000ff00 -#define SI_TX_DATA0_DATA1_GET(x) (((x) & SI_TX_DATA0_DATA1_MASK) >> SI_TX_DATA0_DATA1_LSB) -#define SI_TX_DATA0_DATA1_SET(x) (((x) << SI_TX_DATA0_DATA1_LSB) & SI_TX_DATA0_DATA1_MASK) -#define SI_TX_DATA0_DATA0_MSB 7 -#define SI_TX_DATA0_DATA0_LSB 0 -#define SI_TX_DATA0_DATA0_MASK 0x000000ff -#define SI_TX_DATA0_DATA0_GET(x) (((x) & SI_TX_DATA0_DATA0_MASK) >> SI_TX_DATA0_DATA0_LSB) -#define SI_TX_DATA0_DATA0_SET(x) (((x) << SI_TX_DATA0_DATA0_LSB) & SI_TX_DATA0_DATA0_MASK) - -#define SI_TX_DATA1_ADDRESS 0x0000000c -#define SI_TX_DATA1_OFFSET 0x0000000c -#define SI_TX_DATA1_DATA7_MSB 31 -#define SI_TX_DATA1_DATA7_LSB 24 -#define SI_TX_DATA1_DATA7_MASK 0xff000000 -#define SI_TX_DATA1_DATA7_GET(x) (((x) & SI_TX_DATA1_DATA7_MASK) >> SI_TX_DATA1_DATA7_LSB) -#define SI_TX_DATA1_DATA7_SET(x) (((x) << SI_TX_DATA1_DATA7_LSB) & SI_TX_DATA1_DATA7_MASK) -#define SI_TX_DATA1_DATA6_MSB 23 -#define SI_TX_DATA1_DATA6_LSB 16 -#define SI_TX_DATA1_DATA6_MASK 0x00ff0000 -#define SI_TX_DATA1_DATA6_GET(x) (((x) & SI_TX_DATA1_DATA6_MASK) >> SI_TX_DATA1_DATA6_LSB) -#define SI_TX_DATA1_DATA6_SET(x) (((x) << SI_TX_DATA1_DATA6_LSB) & SI_TX_DATA1_DATA6_MASK) -#define SI_TX_DATA1_DATA5_MSB 15 -#define SI_TX_DATA1_DATA5_LSB 8 -#define SI_TX_DATA1_DATA5_MASK 0x0000ff00 -#define SI_TX_DATA1_DATA5_GET(x) (((x) & SI_TX_DATA1_DATA5_MASK) >> SI_TX_DATA1_DATA5_LSB) -#define SI_TX_DATA1_DATA5_SET(x) (((x) << SI_TX_DATA1_DATA5_LSB) & SI_TX_DATA1_DATA5_MASK) -#define SI_TX_DATA1_DATA4_MSB 7 -#define SI_TX_DATA1_DATA4_LSB 0 -#define SI_TX_DATA1_DATA4_MASK 0x000000ff -#define SI_TX_DATA1_DATA4_GET(x) (((x) & SI_TX_DATA1_DATA4_MASK) >> SI_TX_DATA1_DATA4_LSB) -#define SI_TX_DATA1_DATA4_SET(x) (((x) << SI_TX_DATA1_DATA4_LSB) & SI_TX_DATA1_DATA4_MASK) - -#define SI_RX_DATA0_ADDRESS 0x00000010 -#define SI_RX_DATA0_OFFSET 0x00000010 -#define SI_RX_DATA0_DATA3_MSB 31 -#define SI_RX_DATA0_DATA3_LSB 24 -#define SI_RX_DATA0_DATA3_MASK 0xff000000 -#define SI_RX_DATA0_DATA3_GET(x) (((x) & SI_RX_DATA0_DATA3_MASK) >> SI_RX_DATA0_DATA3_LSB) -#define SI_RX_DATA0_DATA3_SET(x) (((x) << SI_RX_DATA0_DATA3_LSB) & SI_RX_DATA0_DATA3_MASK) -#define SI_RX_DATA0_DATA2_MSB 23 -#define SI_RX_DATA0_DATA2_LSB 16 -#define SI_RX_DATA0_DATA2_MASK 0x00ff0000 -#define SI_RX_DATA0_DATA2_GET(x) (((x) & SI_RX_DATA0_DATA2_MASK) >> SI_RX_DATA0_DATA2_LSB) -#define SI_RX_DATA0_DATA2_SET(x) (((x) << SI_RX_DATA0_DATA2_LSB) & SI_RX_DATA0_DATA2_MASK) -#define SI_RX_DATA0_DATA1_MSB 15 -#define SI_RX_DATA0_DATA1_LSB 8 -#define SI_RX_DATA0_DATA1_MASK 0x0000ff00 -#define SI_RX_DATA0_DATA1_GET(x) (((x) & SI_RX_DATA0_DATA1_MASK) >> SI_RX_DATA0_DATA1_LSB) -#define SI_RX_DATA0_DATA1_SET(x) (((x) << SI_RX_DATA0_DATA1_LSB) & SI_RX_DATA0_DATA1_MASK) -#define SI_RX_DATA0_DATA0_MSB 7 -#define SI_RX_DATA0_DATA0_LSB 0 -#define SI_RX_DATA0_DATA0_MASK 0x000000ff -#define SI_RX_DATA0_DATA0_GET(x) (((x) & SI_RX_DATA0_DATA0_MASK) >> SI_RX_DATA0_DATA0_LSB) -#define SI_RX_DATA0_DATA0_SET(x) (((x) << SI_RX_DATA0_DATA0_LSB) & SI_RX_DATA0_DATA0_MASK) - -#define SI_RX_DATA1_ADDRESS 0x00000014 -#define SI_RX_DATA1_OFFSET 0x00000014 -#define SI_RX_DATA1_DATA7_MSB 31 -#define SI_RX_DATA1_DATA7_LSB 24 -#define SI_RX_DATA1_DATA7_MASK 0xff000000 -#define SI_RX_DATA1_DATA7_GET(x) (((x) & SI_RX_DATA1_DATA7_MASK) >> SI_RX_DATA1_DATA7_LSB) -#define SI_RX_DATA1_DATA7_SET(x) (((x) << SI_RX_DATA1_DATA7_LSB) & SI_RX_DATA1_DATA7_MASK) -#define SI_RX_DATA1_DATA6_MSB 23 -#define SI_RX_DATA1_DATA6_LSB 16 -#define SI_RX_DATA1_DATA6_MASK 0x00ff0000 -#define SI_RX_DATA1_DATA6_GET(x) (((x) & SI_RX_DATA1_DATA6_MASK) >> SI_RX_DATA1_DATA6_LSB) -#define SI_RX_DATA1_DATA6_SET(x) (((x) << SI_RX_DATA1_DATA6_LSB) & SI_RX_DATA1_DATA6_MASK) -#define SI_RX_DATA1_DATA5_MSB 15 -#define SI_RX_DATA1_DATA5_LSB 8 -#define SI_RX_DATA1_DATA5_MASK 0x0000ff00 -#define SI_RX_DATA1_DATA5_GET(x) (((x) & SI_RX_DATA1_DATA5_MASK) >> SI_RX_DATA1_DATA5_LSB) -#define SI_RX_DATA1_DATA5_SET(x) (((x) << SI_RX_DATA1_DATA5_LSB) & SI_RX_DATA1_DATA5_MASK) -#define SI_RX_DATA1_DATA4_MSB 7 -#define SI_RX_DATA1_DATA4_LSB 0 -#define SI_RX_DATA1_DATA4_MASK 0x000000ff -#define SI_RX_DATA1_DATA4_GET(x) (((x) & SI_RX_DATA1_DATA4_MASK) >> SI_RX_DATA1_DATA4_LSB) -#define SI_RX_DATA1_DATA4_SET(x) (((x) << SI_RX_DATA1_DATA4_LSB) & SI_RX_DATA1_DATA4_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct si_reg_reg_s { - volatile unsigned int si_config; - volatile unsigned int si_cs; - volatile unsigned int si_tx_data0; - volatile unsigned int si_tx_data1; - volatile unsigned int si_rx_data0; - volatile unsigned int si_rx_data1; -} si_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _SI_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/si_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/si_reg.vrh deleted file mode 100644 index 10751ad46f80..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/si_reg.vrh +++ /dev/null @@ -1,278 +0,0 @@ -#ifndef _SI_REG_VRH_ -#define _SI_REG_VRH_ - -#define SI_CONFIG_ADDRESS 'h00000000 -#define SI_CONFIG_ERR_INT_MSB 19 -#define SI_CONFIG_ERR_INT_LSB 19 -#define SI_CONFIG_ERR_INT_MASK 'h00080000 -#define SI_CONFIG_ERR_INT_GET(x) (((x) & SI_CONFIG_ERR_INT_MASK) >> SI_CONFIG_ERR_INT_LSB) -#define SI_CONFIG_ERR_INT_SET(x) (((32'd0 | (x)) << SI_CONFIG_ERR_INT_LSB) & SI_CONFIG_ERR_INT_MASK) -#define SI_CONFIG_ERR_INT_RESET 1'h0 -#define SI_CONFIG_BIDIR_OD_DATA_MSB 18 -#define SI_CONFIG_BIDIR_OD_DATA_LSB 18 -#define SI_CONFIG_BIDIR_OD_DATA_MASK 'h00040000 -#define SI_CONFIG_BIDIR_OD_DATA_GET(x) (((x) & SI_CONFIG_BIDIR_OD_DATA_MASK) >> SI_CONFIG_BIDIR_OD_DATA_LSB) -#define SI_CONFIG_BIDIR_OD_DATA_SET(x) (((32'd0 | (x)) << SI_CONFIG_BIDIR_OD_DATA_LSB) & SI_CONFIG_BIDIR_OD_DATA_MASK) -#define SI_CONFIG_BIDIR_OD_DATA_RESET 1'h1 -#define SI_CONFIG_I2C_MSB 16 -#define SI_CONFIG_I2C_LSB 16 -#define SI_CONFIG_I2C_MASK 'h00010000 -#define SI_CONFIG_I2C_GET(x) (((x) & SI_CONFIG_I2C_MASK) >> SI_CONFIG_I2C_LSB) -#define SI_CONFIG_I2C_SET(x) (((32'd0 | (x)) << SI_CONFIG_I2C_LSB) & SI_CONFIG_I2C_MASK) -#define SI_CONFIG_I2C_RESET 1'h1 -#define SI_CONFIG_POS_SAMPLE_MSB 7 -#define SI_CONFIG_POS_SAMPLE_LSB 7 -#define SI_CONFIG_POS_SAMPLE_MASK 'h00000080 -#define SI_CONFIG_POS_SAMPLE_GET(x) (((x) & SI_CONFIG_POS_SAMPLE_MASK) >> SI_CONFIG_POS_SAMPLE_LSB) -#define SI_CONFIG_POS_SAMPLE_SET(x) (((32'd0 | (x)) << SI_CONFIG_POS_SAMPLE_LSB) & SI_CONFIG_POS_SAMPLE_MASK) -#define SI_CONFIG_POS_SAMPLE_RESET 1'h1 -#define SI_CONFIG_POS_DRIVE_MSB 6 -#define SI_CONFIG_POS_DRIVE_LSB 6 -#define SI_CONFIG_POS_DRIVE_MASK 'h00000040 -#define SI_CONFIG_POS_DRIVE_GET(x) (((x) & SI_CONFIG_POS_DRIVE_MASK) >> SI_CONFIG_POS_DRIVE_LSB) -#define SI_CONFIG_POS_DRIVE_SET(x) (((32'd0 | (x)) << SI_CONFIG_POS_DRIVE_LSB) & SI_CONFIG_POS_DRIVE_MASK) -#define SI_CONFIG_POS_DRIVE_RESET 1'h0 -#define SI_CONFIG_INACTIVE_DATA_MSB 5 -#define SI_CONFIG_INACTIVE_DATA_LSB 5 -#define SI_CONFIG_INACTIVE_DATA_MASK 'h00000020 -#define SI_CONFIG_INACTIVE_DATA_GET(x) (((x) & SI_CONFIG_INACTIVE_DATA_MASK) >> SI_CONFIG_INACTIVE_DATA_LSB) -#define SI_CONFIG_INACTIVE_DATA_SET(x) (((32'd0 | (x)) << SI_CONFIG_INACTIVE_DATA_LSB) & SI_CONFIG_INACTIVE_DATA_MASK) -#define SI_CONFIG_INACTIVE_DATA_RESET 1'h1 -#define SI_CONFIG_INACTIVE_CLK_MSB 4 -#define SI_CONFIG_INACTIVE_CLK_LSB 4 -#define SI_CONFIG_INACTIVE_CLK_MASK 'h00000010 -#define SI_CONFIG_INACTIVE_CLK_GET(x) (((x) & SI_CONFIG_INACTIVE_CLK_MASK) >> SI_CONFIG_INACTIVE_CLK_LSB) -#define SI_CONFIG_INACTIVE_CLK_SET(x) (((32'd0 | (x)) << SI_CONFIG_INACTIVE_CLK_LSB) & SI_CONFIG_INACTIVE_CLK_MASK) -#define SI_CONFIG_INACTIVE_CLK_RESET 1'h1 -#define SI_CONFIG_DIVIDER_MSB 3 -#define SI_CONFIG_DIVIDER_LSB 0 -#define SI_CONFIG_DIVIDER_MASK 'h0000000f -#define SI_CONFIG_DIVIDER_GET(x) (((x) & SI_CONFIG_DIVIDER_MASK) >> SI_CONFIG_DIVIDER_LSB) -#define SI_CONFIG_DIVIDER_SET(x) (((32'd0 | (x)) << SI_CONFIG_DIVIDER_LSB) & SI_CONFIG_DIVIDER_MASK) -#define SI_CONFIG_DIVIDER_RESET 4'h0 -#define SI_CONFIG_RESET (32'h0 | \ - SI_CONFIG_ERR_INT_SET(SI_CONFIG_ERR_INT_RESET) | \ - SI_CONFIG_BIDIR_OD_DATA_SET(SI_CONFIG_BIDIR_OD_DATA_RESET) | \ - SI_CONFIG_I2C_SET(SI_CONFIG_I2C_RESET) | \ - SI_CONFIG_POS_SAMPLE_SET(SI_CONFIG_POS_SAMPLE_RESET) | \ - SI_CONFIG_POS_DRIVE_SET(SI_CONFIG_POS_DRIVE_RESET) | \ - SI_CONFIG_INACTIVE_DATA_SET(SI_CONFIG_INACTIVE_DATA_RESET) | \ - SI_CONFIG_INACTIVE_CLK_SET(SI_CONFIG_INACTIVE_CLK_RESET) | \ - SI_CONFIG_DIVIDER_SET(SI_CONFIG_DIVIDER_RESET)) -#define SI_CONFIG_HW_MASK (32'h0) -#define SI_CONFIG_SW_MASK (32'h0 | \ - SI_CONFIG_ERR_INT_MASK | \ - SI_CONFIG_BIDIR_OD_DATA_MASK | \ - SI_CONFIG_I2C_MASK | \ - SI_CONFIG_POS_SAMPLE_MASK | \ - SI_CONFIG_POS_DRIVE_MASK | \ - SI_CONFIG_INACTIVE_DATA_MASK | \ - SI_CONFIG_INACTIVE_CLK_MASK | \ - SI_CONFIG_DIVIDER_MASK) - -#define SI_CS_ADDRESS 'h00000004 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_MSB 13 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_LSB 11 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_MASK 'h00003800 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_GET(x) (((x) & SI_CS_BIT_CNT_IN_LAST_BYTE_MASK) >> SI_CS_BIT_CNT_IN_LAST_BYTE_LSB) -#define SI_CS_BIT_CNT_IN_LAST_BYTE_SET(x) (((32'd0 | (x)) << SI_CS_BIT_CNT_IN_LAST_BYTE_LSB) & SI_CS_BIT_CNT_IN_LAST_BYTE_MASK) -#define SI_CS_BIT_CNT_IN_LAST_BYTE_RESET 3'h0 -#define SI_CS_DONE_ERR_MSB 10 -#define SI_CS_DONE_ERR_LSB 10 -#define SI_CS_DONE_ERR_MASK 'h00000400 -#define SI_CS_DONE_ERR_GET(x) (((x) & SI_CS_DONE_ERR_MASK) >> SI_CS_DONE_ERR_LSB) -#define SI_CS_DONE_ERR_SET(x) (((32'd0 | (x)) << SI_CS_DONE_ERR_LSB) & SI_CS_DONE_ERR_MASK) -#define SI_CS_DONE_ERR_RESET 1'h0 -#define SI_CS_DONE_INT_MSB 9 -#define SI_CS_DONE_INT_LSB 9 -#define SI_CS_DONE_INT_MASK 'h00000200 -#define SI_CS_DONE_INT_GET(x) (((x) & SI_CS_DONE_INT_MASK) >> SI_CS_DONE_INT_LSB) -#define SI_CS_DONE_INT_SET(x) (((32'd0 | (x)) << SI_CS_DONE_INT_LSB) & SI_CS_DONE_INT_MASK) -#define SI_CS_DONE_INT_RESET 1'h0 -#define SI_CS_START_MSB 8 -#define SI_CS_START_LSB 8 -#define SI_CS_START_MASK 'h00000100 -#define SI_CS_START_GET(x) (((x) & SI_CS_START_MASK) >> SI_CS_START_LSB) -#define SI_CS_START_SET(x) (((32'd0 | (x)) << SI_CS_START_LSB) & SI_CS_START_MASK) -#define SI_CS_START_RESET 1'h0 -#define SI_CS_RX_CNT_MSB 7 -#define SI_CS_RX_CNT_LSB 4 -#define SI_CS_RX_CNT_MASK 'h000000f0 -#define SI_CS_RX_CNT_GET(x) (((x) & SI_CS_RX_CNT_MASK) >> SI_CS_RX_CNT_LSB) -#define SI_CS_RX_CNT_SET(x) (((32'd0 | (x)) << SI_CS_RX_CNT_LSB) & SI_CS_RX_CNT_MASK) -#define SI_CS_RX_CNT_RESET 4'h0 -#define SI_CS_TX_CNT_MSB 3 -#define SI_CS_TX_CNT_LSB 0 -#define SI_CS_TX_CNT_MASK 'h0000000f -#define SI_CS_TX_CNT_GET(x) (((x) & SI_CS_TX_CNT_MASK) >> SI_CS_TX_CNT_LSB) -#define SI_CS_TX_CNT_SET(x) (((32'd0 | (x)) << SI_CS_TX_CNT_LSB) & SI_CS_TX_CNT_MASK) -#define SI_CS_TX_CNT_RESET 4'h0 -#define SI_CS_RESET (32'h0 | \ - SI_CS_BIT_CNT_IN_LAST_BYTE_SET(SI_CS_BIT_CNT_IN_LAST_BYTE_RESET) | \ - SI_CS_DONE_ERR_SET(SI_CS_DONE_ERR_RESET) | \ - SI_CS_DONE_INT_SET(SI_CS_DONE_INT_RESET) | \ - SI_CS_START_SET(SI_CS_START_RESET) | \ - SI_CS_RX_CNT_SET(SI_CS_RX_CNT_RESET) | \ - SI_CS_TX_CNT_SET(SI_CS_TX_CNT_RESET)) -#define SI_CS_HW_MASK (32'h0 | \ - SI_CS_DONE_ERR_MASK | \ - SI_CS_DONE_INT_MASK | \ - SI_CS_START_MASK) -#define SI_CS_SW_MASK (32'h0 | \ - SI_CS_BIT_CNT_IN_LAST_BYTE_MASK | \ - SI_CS_DONE_INT_MASK | \ - SI_CS_START_MASK | \ - SI_CS_RX_CNT_MASK | \ - SI_CS_TX_CNT_MASK) - -#define SI_TX_DATA0_ADDRESS 'h00000008 -#define SI_TX_DATA0_DATA3_MSB 31 -#define SI_TX_DATA0_DATA3_LSB 24 -#define SI_TX_DATA0_DATA3_MASK 'hff000000 -#define SI_TX_DATA0_DATA3_GET(x) (((x) & SI_TX_DATA0_DATA3_MASK) >> SI_TX_DATA0_DATA3_LSB) -#define SI_TX_DATA0_DATA3_SET(x) (((32'd0 | (x)) << SI_TX_DATA0_DATA3_LSB) & SI_TX_DATA0_DATA3_MASK) -#define SI_TX_DATA0_DATA3_RESET 8'h0 -#define SI_TX_DATA0_DATA2_MSB 23 -#define SI_TX_DATA0_DATA2_LSB 16 -#define SI_TX_DATA0_DATA2_MASK 'h00ff0000 -#define SI_TX_DATA0_DATA2_GET(x) (((x) & SI_TX_DATA0_DATA2_MASK) >> SI_TX_DATA0_DATA2_LSB) -#define SI_TX_DATA0_DATA2_SET(x) (((32'd0 | (x)) << SI_TX_DATA0_DATA2_LSB) & SI_TX_DATA0_DATA2_MASK) -#define SI_TX_DATA0_DATA2_RESET 8'h0 -#define SI_TX_DATA0_DATA1_MSB 15 -#define SI_TX_DATA0_DATA1_LSB 8 -#define SI_TX_DATA0_DATA1_MASK 'h0000ff00 -#define SI_TX_DATA0_DATA1_GET(x) (((x) & SI_TX_DATA0_DATA1_MASK) >> SI_TX_DATA0_DATA1_LSB) -#define SI_TX_DATA0_DATA1_SET(x) (((32'd0 | (x)) << SI_TX_DATA0_DATA1_LSB) & SI_TX_DATA0_DATA1_MASK) -#define SI_TX_DATA0_DATA1_RESET 8'h0 -#define SI_TX_DATA0_DATA0_MSB 7 -#define SI_TX_DATA0_DATA0_LSB 0 -#define SI_TX_DATA0_DATA0_MASK 'h000000ff -#define SI_TX_DATA0_DATA0_GET(x) (((x) & SI_TX_DATA0_DATA0_MASK) >> SI_TX_DATA0_DATA0_LSB) -#define SI_TX_DATA0_DATA0_SET(x) (((32'd0 | (x)) << SI_TX_DATA0_DATA0_LSB) & SI_TX_DATA0_DATA0_MASK) -#define SI_TX_DATA0_DATA0_RESET 8'h0 -#define SI_TX_DATA0_RESET (32'h0 | \ - SI_TX_DATA0_DATA3_SET(SI_TX_DATA0_DATA3_RESET) | \ - SI_TX_DATA0_DATA2_SET(SI_TX_DATA0_DATA2_RESET) | \ - SI_TX_DATA0_DATA1_SET(SI_TX_DATA0_DATA1_RESET) | \ - SI_TX_DATA0_DATA0_SET(SI_TX_DATA0_DATA0_RESET)) -#define SI_TX_DATA0_HW_MASK (32'h0) -#define SI_TX_DATA0_SW_MASK (32'h0 | \ - SI_TX_DATA0_DATA3_MASK | \ - SI_TX_DATA0_DATA2_MASK | \ - SI_TX_DATA0_DATA1_MASK | \ - SI_TX_DATA0_DATA0_MASK) - -#define SI_TX_DATA1_ADDRESS 'h0000000c -#define SI_TX_DATA1_DATA7_MSB 31 -#define SI_TX_DATA1_DATA7_LSB 24 -#define SI_TX_DATA1_DATA7_MASK 'hff000000 -#define SI_TX_DATA1_DATA7_GET(x) (((x) & SI_TX_DATA1_DATA7_MASK) >> SI_TX_DATA1_DATA7_LSB) -#define SI_TX_DATA1_DATA7_SET(x) (((32'd0 | (x)) << SI_TX_DATA1_DATA7_LSB) & SI_TX_DATA1_DATA7_MASK) -#define SI_TX_DATA1_DATA7_RESET 8'h0 -#define SI_TX_DATA1_DATA6_MSB 23 -#define SI_TX_DATA1_DATA6_LSB 16 -#define SI_TX_DATA1_DATA6_MASK 'h00ff0000 -#define SI_TX_DATA1_DATA6_GET(x) (((x) & SI_TX_DATA1_DATA6_MASK) >> SI_TX_DATA1_DATA6_LSB) -#define SI_TX_DATA1_DATA6_SET(x) (((32'd0 | (x)) << SI_TX_DATA1_DATA6_LSB) & SI_TX_DATA1_DATA6_MASK) -#define SI_TX_DATA1_DATA6_RESET 8'h0 -#define SI_TX_DATA1_DATA5_MSB 15 -#define SI_TX_DATA1_DATA5_LSB 8 -#define SI_TX_DATA1_DATA5_MASK 'h0000ff00 -#define SI_TX_DATA1_DATA5_GET(x) (((x) & SI_TX_DATA1_DATA5_MASK) >> SI_TX_DATA1_DATA5_LSB) -#define SI_TX_DATA1_DATA5_SET(x) (((32'd0 | (x)) << SI_TX_DATA1_DATA5_LSB) & SI_TX_DATA1_DATA5_MASK) -#define SI_TX_DATA1_DATA5_RESET 8'h0 -#define SI_TX_DATA1_DATA4_MSB 7 -#define SI_TX_DATA1_DATA4_LSB 0 -#define SI_TX_DATA1_DATA4_MASK 'h000000ff -#define SI_TX_DATA1_DATA4_GET(x) (((x) & SI_TX_DATA1_DATA4_MASK) >> SI_TX_DATA1_DATA4_LSB) -#define SI_TX_DATA1_DATA4_SET(x) (((32'd0 | (x)) << SI_TX_DATA1_DATA4_LSB) & SI_TX_DATA1_DATA4_MASK) -#define SI_TX_DATA1_DATA4_RESET 8'h0 -#define SI_TX_DATA1_RESET (32'h0 | \ - SI_TX_DATA1_DATA7_SET(SI_TX_DATA1_DATA7_RESET) | \ - SI_TX_DATA1_DATA6_SET(SI_TX_DATA1_DATA6_RESET) | \ - SI_TX_DATA1_DATA5_SET(SI_TX_DATA1_DATA5_RESET) | \ - SI_TX_DATA1_DATA4_SET(SI_TX_DATA1_DATA4_RESET)) -#define SI_TX_DATA1_HW_MASK (32'h0) -#define SI_TX_DATA1_SW_MASK (32'h0 | \ - SI_TX_DATA1_DATA7_MASK | \ - SI_TX_DATA1_DATA6_MASK | \ - SI_TX_DATA1_DATA5_MASK | \ - SI_TX_DATA1_DATA4_MASK) - -#define SI_RX_DATA0_ADDRESS 'h00000010 -#define SI_RX_DATA0_DATA3_MSB 31 -#define SI_RX_DATA0_DATA3_LSB 24 -#define SI_RX_DATA0_DATA3_MASK 'hff000000 -#define SI_RX_DATA0_DATA3_GET(x) (((x) & SI_RX_DATA0_DATA3_MASK) >> SI_RX_DATA0_DATA3_LSB) -#define SI_RX_DATA0_DATA3_SET(x) (((32'd0 | (x)) << SI_RX_DATA0_DATA3_LSB) & SI_RX_DATA0_DATA3_MASK) -#define SI_RX_DATA0_DATA3_RESET 8'h0 -#define SI_RX_DATA0_DATA2_MSB 23 -#define SI_RX_DATA0_DATA2_LSB 16 -#define SI_RX_DATA0_DATA2_MASK 'h00ff0000 -#define SI_RX_DATA0_DATA2_GET(x) (((x) & SI_RX_DATA0_DATA2_MASK) >> SI_RX_DATA0_DATA2_LSB) -#define SI_RX_DATA0_DATA2_SET(x) (((32'd0 | (x)) << SI_RX_DATA0_DATA2_LSB) & SI_RX_DATA0_DATA2_MASK) -#define SI_RX_DATA0_DATA2_RESET 8'h0 -#define SI_RX_DATA0_DATA1_MSB 15 -#define SI_RX_DATA0_DATA1_LSB 8 -#define SI_RX_DATA0_DATA1_MASK 'h0000ff00 -#define SI_RX_DATA0_DATA1_GET(x) (((x) & SI_RX_DATA0_DATA1_MASK) >> SI_RX_DATA0_DATA1_LSB) -#define SI_RX_DATA0_DATA1_SET(x) (((32'd0 | (x)) << SI_RX_DATA0_DATA1_LSB) & SI_RX_DATA0_DATA1_MASK) -#define SI_RX_DATA0_DATA1_RESET 8'h0 -#define SI_RX_DATA0_DATA0_MSB 7 -#define SI_RX_DATA0_DATA0_LSB 0 -#define SI_RX_DATA0_DATA0_MASK 'h000000ff -#define SI_RX_DATA0_DATA0_GET(x) (((x) & SI_RX_DATA0_DATA0_MASK) >> SI_RX_DATA0_DATA0_LSB) -#define SI_RX_DATA0_DATA0_SET(x) (((32'd0 | (x)) << SI_RX_DATA0_DATA0_LSB) & SI_RX_DATA0_DATA0_MASK) -#define SI_RX_DATA0_DATA0_RESET 8'h0 -#define SI_RX_DATA0_RESET (32'h0 | \ - SI_RX_DATA0_DATA3_SET(SI_RX_DATA0_DATA3_RESET) | \ - SI_RX_DATA0_DATA2_SET(SI_RX_DATA0_DATA2_RESET) | \ - SI_RX_DATA0_DATA1_SET(SI_RX_DATA0_DATA1_RESET) | \ - SI_RX_DATA0_DATA0_SET(SI_RX_DATA0_DATA0_RESET)) -#define SI_RX_DATA0_HW_MASK (32'h0 | \ - SI_RX_DATA0_DATA3_MASK | \ - SI_RX_DATA0_DATA2_MASK | \ - SI_RX_DATA0_DATA1_MASK | \ - SI_RX_DATA0_DATA0_MASK) -#define SI_RX_DATA0_SW_MASK (32'h0) - -#define SI_RX_DATA1_ADDRESS 'h00000014 -#define SI_RX_DATA1_DATA7_MSB 31 -#define SI_RX_DATA1_DATA7_LSB 24 -#define SI_RX_DATA1_DATA7_MASK 'hff000000 -#define SI_RX_DATA1_DATA7_GET(x) (((x) & SI_RX_DATA1_DATA7_MASK) >> SI_RX_DATA1_DATA7_LSB) -#define SI_RX_DATA1_DATA7_SET(x) (((32'd0 | (x)) << SI_RX_DATA1_DATA7_LSB) & SI_RX_DATA1_DATA7_MASK) -#define SI_RX_DATA1_DATA7_RESET 8'h0 -#define SI_RX_DATA1_DATA6_MSB 23 -#define SI_RX_DATA1_DATA6_LSB 16 -#define SI_RX_DATA1_DATA6_MASK 'h00ff0000 -#define SI_RX_DATA1_DATA6_GET(x) (((x) & SI_RX_DATA1_DATA6_MASK) >> SI_RX_DATA1_DATA6_LSB) -#define SI_RX_DATA1_DATA6_SET(x) (((32'd0 | (x)) << SI_RX_DATA1_DATA6_LSB) & SI_RX_DATA1_DATA6_MASK) -#define SI_RX_DATA1_DATA6_RESET 8'h0 -#define SI_RX_DATA1_DATA5_MSB 15 -#define SI_RX_DATA1_DATA5_LSB 8 -#define SI_RX_DATA1_DATA5_MASK 'h0000ff00 -#define SI_RX_DATA1_DATA5_GET(x) (((x) & SI_RX_DATA1_DATA5_MASK) >> SI_RX_DATA1_DATA5_LSB) -#define SI_RX_DATA1_DATA5_SET(x) (((32'd0 | (x)) << SI_RX_DATA1_DATA5_LSB) & SI_RX_DATA1_DATA5_MASK) -#define SI_RX_DATA1_DATA5_RESET 8'h0 -#define SI_RX_DATA1_DATA4_MSB 7 -#define SI_RX_DATA1_DATA4_LSB 0 -#define SI_RX_DATA1_DATA4_MASK 'h000000ff -#define SI_RX_DATA1_DATA4_GET(x) (((x) & SI_RX_DATA1_DATA4_MASK) >> SI_RX_DATA1_DATA4_LSB) -#define SI_RX_DATA1_DATA4_SET(x) (((32'd0 | (x)) << SI_RX_DATA1_DATA4_LSB) & SI_RX_DATA1_DATA4_MASK) -#define SI_RX_DATA1_DATA4_RESET 8'h0 -#define SI_RX_DATA1_RESET (32'h0 | \ - SI_RX_DATA1_DATA7_SET(SI_RX_DATA1_DATA7_RESET) | \ - SI_RX_DATA1_DATA6_SET(SI_RX_DATA1_DATA6_RESET) | \ - SI_RX_DATA1_DATA5_SET(SI_RX_DATA1_DATA5_RESET) | \ - SI_RX_DATA1_DATA4_SET(SI_RX_DATA1_DATA4_RESET)) -#define SI_RX_DATA1_HW_MASK (32'h0 | \ - SI_RX_DATA1_DATA7_MASK | \ - SI_RX_DATA1_DATA6_MASK | \ - SI_RX_DATA1_DATA5_MASK | \ - SI_RX_DATA1_DATA4_MASK) -#define SI_RX_DATA1_SW_MASK (32'h0) - -#define SI_REG_ADDRESS_MSB 4 - -#endif /* _SI_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/synth_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/synth_reg.h deleted file mode 100644 index 2cdbc0d86b82..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/synth_reg.h +++ /dev/null @@ -1,599 +0,0 @@ -#ifndef _SYNTH_REG_REG_H_ -#define _SYNTH_REG_REG_H_ - -#define SYNTH_SYNTH1_ADDRESS 0x00000000 -#define SYNTH_SYNTH1_OFFSET 0x00000000 -#define SYNTH_SYNTH1_PWD_BIAS_MSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_LSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_MASK 0x80000000 -#define SYNTH_SYNTH1_PWD_BIAS_GET(x) (((x) & SYNTH_SYNTH1_PWD_BIAS_MASK) >> SYNTH_SYNTH1_PWD_BIAS_LSB) -#define SYNTH_SYNTH1_PWD_BIAS_SET(x) (((x) << SYNTH_SYNTH1_PWD_BIAS_LSB) & SYNTH_SYNTH1_PWD_BIAS_MASK) -#define SYNTH_SYNTH1_PWD_CP_MSB 30 -#define SYNTH_SYNTH1_PWD_CP_LSB 30 -#define SYNTH_SYNTH1_PWD_CP_MASK 0x40000000 -#define SYNTH_SYNTH1_PWD_CP_GET(x) (((x) & SYNTH_SYNTH1_PWD_CP_MASK) >> SYNTH_SYNTH1_PWD_CP_LSB) -#define SYNTH_SYNTH1_PWD_CP_SET(x) (((x) << SYNTH_SYNTH1_PWD_CP_LSB) & SYNTH_SYNTH1_PWD_CP_MASK) -#define SYNTH_SYNTH1_PWD_VCMON_MSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_LSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_MASK 0x20000000 -#define SYNTH_SYNTH1_PWD_VCMON_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCMON_MASK) >> SYNTH_SYNTH1_PWD_VCMON_LSB) -#define SYNTH_SYNTH1_PWD_VCMON_SET(x) (((x) << SYNTH_SYNTH1_PWD_VCMON_LSB) & SYNTH_SYNTH1_PWD_VCMON_MASK) -#define SYNTH_SYNTH1_PWD_VCO_MSB 28 -#define SYNTH_SYNTH1_PWD_VCO_LSB 28 -#define SYNTH_SYNTH1_PWD_VCO_MASK 0x10000000 -#define SYNTH_SYNTH1_PWD_VCO_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCO_MASK) >> SYNTH_SYNTH1_PWD_VCO_LSB) -#define SYNTH_SYNTH1_PWD_VCO_SET(x) (((x) << SYNTH_SYNTH1_PWD_VCO_LSB) & SYNTH_SYNTH1_PWD_VCO_MASK) -#define SYNTH_SYNTH1_PWD_PRESC_MSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_LSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_MASK 0x08000000 -#define SYNTH_SYNTH1_PWD_PRESC_GET(x) (((x) & SYNTH_SYNTH1_PWD_PRESC_MASK) >> SYNTH_SYNTH1_PWD_PRESC_LSB) -#define SYNTH_SYNTH1_PWD_PRESC_SET(x) (((x) << SYNTH_SYNTH1_PWD_PRESC_LSB) & SYNTH_SYNTH1_PWD_PRESC_MASK) -#define SYNTH_SYNTH1_PWD_LODIV_MSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_LSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_MASK 0x04000000 -#define SYNTH_SYNTH1_PWD_LODIV_GET(x) (((x) & SYNTH_SYNTH1_PWD_LODIV_MASK) >> SYNTH_SYNTH1_PWD_LODIV_LSB) -#define SYNTH_SYNTH1_PWD_LODIV_SET(x) (((x) << SYNTH_SYNTH1_PWD_LODIV_LSB) & SYNTH_SYNTH1_PWD_LODIV_MASK) -#define SYNTH_SYNTH1_PWD_LOMIX_MSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_LSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_MASK 0x02000000 -#define SYNTH_SYNTH1_PWD_LOMIX_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOMIX_MASK) >> SYNTH_SYNTH1_PWD_LOMIX_LSB) -#define SYNTH_SYNTH1_PWD_LOMIX_SET(x) (((x) << SYNTH_SYNTH1_PWD_LOMIX_LSB) & SYNTH_SYNTH1_PWD_LOMIX_MASK) -#define SYNTH_SYNTH1_FORCE_LO_ON_MSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_LSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_MASK 0x01000000 -#define SYNTH_SYNTH1_FORCE_LO_ON_GET(x) (((x) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) >> SYNTH_SYNTH1_FORCE_LO_ON_LSB) -#define SYNTH_SYNTH1_FORCE_LO_ON_SET(x) (((x) << SYNTH_SYNTH1_FORCE_LO_ON_LSB) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) -#define SYNTH_SYNTH1_PWD_LOBUF5G_MSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_LSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_MASK 0x00800000 -#define SYNTH_SYNTH1_PWD_LOBUF5G_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) >> SYNTH_SYNTH1_PWD_LOBUF5G_LSB) -#define SYNTH_SYNTH1_PWD_LOBUF5G_SET(x) (((x) << SYNTH_SYNTH1_PWD_LOBUF5G_LSB) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) -#define SYNTH_SYNTH1_VCOREGBYPASS_MSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_LSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_MASK 0x00400000 -#define SYNTH_SYNTH1_VCOREGBYPASS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) >> SYNTH_SYNTH1_VCOREGBYPASS_LSB) -#define SYNTH_SYNTH1_VCOREGBYPASS_SET(x) (((x) << SYNTH_SYNTH1_VCOREGBYPASS_LSB) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) -#define SYNTH_SYNTH1_VCOREGLEVEL_MSB 21 -#define SYNTH_SYNTH1_VCOREGLEVEL_LSB 20 -#define SYNTH_SYNTH1_VCOREGLEVEL_MASK 0x00300000 -#define SYNTH_SYNTH1_VCOREGLEVEL_GET(x) (((x) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) >> SYNTH_SYNTH1_VCOREGLEVEL_LSB) -#define SYNTH_SYNTH1_VCOREGLEVEL_SET(x) (((x) << SYNTH_SYNTH1_VCOREGLEVEL_LSB) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) -#define SYNTH_SYNTH1_VCOREGBIAS_MSB 19 -#define SYNTH_SYNTH1_VCOREGBIAS_LSB 18 -#define SYNTH_SYNTH1_VCOREGBIAS_MASK 0x000c0000 -#define SYNTH_SYNTH1_VCOREGBIAS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBIAS_MASK) >> SYNTH_SYNTH1_VCOREGBIAS_LSB) -#define SYNTH_SYNTH1_VCOREGBIAS_SET(x) (((x) << SYNTH_SYNTH1_VCOREGBIAS_LSB) & SYNTH_SYNTH1_VCOREGBIAS_MASK) -#define SYNTH_SYNTH1_SLIDINGIF_MSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_LSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_MASK 0x00020000 -#define SYNTH_SYNTH1_SLIDINGIF_GET(x) (((x) & SYNTH_SYNTH1_SLIDINGIF_MASK) >> SYNTH_SYNTH1_SLIDINGIF_LSB) -#define SYNTH_SYNTH1_SLIDINGIF_SET(x) (((x) << SYNTH_SYNTH1_SLIDINGIF_LSB) & SYNTH_SYNTH1_SLIDINGIF_MASK) -#define SYNTH_SYNTH1_SPARE_PWD_MSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_LSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_MASK 0x00010000 -#define SYNTH_SYNTH1_SPARE_PWD_GET(x) (((x) & SYNTH_SYNTH1_SPARE_PWD_MASK) >> SYNTH_SYNTH1_SPARE_PWD_LSB) -#define SYNTH_SYNTH1_SPARE_PWD_SET(x) (((x) << SYNTH_SYNTH1_SPARE_PWD_LSB) & SYNTH_SYNTH1_SPARE_PWD_MASK) -#define SYNTH_SYNTH1_CON_VDDVCOREG_MSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_LSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_MASK 0x00008000 -#define SYNTH_SYNTH1_CON_VDDVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) >> SYNTH_SYNTH1_CON_VDDVCOREG_LSB) -#define SYNTH_SYNTH1_CON_VDDVCOREG_SET(x) (((x) << SYNTH_SYNTH1_CON_VDDVCOREG_LSB) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) -#define SYNTH_SYNTH1_CON_IVCOREG_MSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_LSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_MASK 0x00004000 -#define SYNTH_SYNTH1_CON_IVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOREG_MASK) >> SYNTH_SYNTH1_CON_IVCOREG_LSB) -#define SYNTH_SYNTH1_CON_IVCOREG_SET(x) (((x) << SYNTH_SYNTH1_CON_IVCOREG_LSB) & SYNTH_SYNTH1_CON_IVCOREG_MASK) -#define SYNTH_SYNTH1_CON_IVCOBUF_MSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_LSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_MASK 0x00002000 -#define SYNTH_SYNTH1_CON_IVCOBUF_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) >> SYNTH_SYNTH1_CON_IVCOBUF_LSB) -#define SYNTH_SYNTH1_CON_IVCOBUF_SET(x) (((x) << SYNTH_SYNTH1_CON_IVCOBUF_LSB) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) -#define SYNTH_SYNTH1_SEL_VCMONABUS_MSB 12 -#define SYNTH_SYNTH1_SEL_VCMONABUS_LSB 10 -#define SYNTH_SYNTH1_SEL_VCMONABUS_MASK 0x00001c00 -#define SYNTH_SYNTH1_SEL_VCMONABUS_GET(x) (((x) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) >> SYNTH_SYNTH1_SEL_VCMONABUS_LSB) -#define SYNTH_SYNTH1_SEL_VCMONABUS_SET(x) (((x) << SYNTH_SYNTH1_SEL_VCMONABUS_LSB) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK 0x00000200 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) >> SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_LSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MASK 0x00000100 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) >> SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK 0x00000080 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK 0x00000040 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_MSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_LSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_MASK 0x00000020 -#define SYNTH_SYNTH1_MONITOR_FB_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_MASK) >> SYNTH_SYNTH1_MONITOR_FB_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_FB_LSB) & SYNTH_SYNTH1_MONITOR_FB_MASK) -#define SYNTH_SYNTH1_MONITOR_REF_MSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_LSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_MASK 0x00000010 -#define SYNTH_SYNTH1_MONITOR_REF_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_REF_MASK) >> SYNTH_SYNTH1_MONITOR_REF_LSB) -#define SYNTH_SYNTH1_MONITOR_REF_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_REF_LSB) & SYNTH_SYNTH1_MONITOR_REF_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK 0x00000008 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) >> SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK 0x00000004 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) >> SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_LSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MASK 0x00000002 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) >> SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK 0x00000001 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) >> SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) - -#define SYNTH_SYNTH2_ADDRESS 0x00000004 -#define SYNTH_SYNTH2_OFFSET 0x00000004 -#define SYNTH_SYNTH2_VC_CAL_REF_MSB 31 -#define SYNTH_SYNTH2_VC_CAL_REF_LSB 29 -#define SYNTH_SYNTH2_VC_CAL_REF_MASK 0xe0000000 -#define SYNTH_SYNTH2_VC_CAL_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_CAL_REF_MASK) >> SYNTH_SYNTH2_VC_CAL_REF_LSB) -#define SYNTH_SYNTH2_VC_CAL_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_CAL_REF_LSB) & SYNTH_SYNTH2_VC_CAL_REF_MASK) -#define SYNTH_SYNTH2_VC_HI_REF_MSB 28 -#define SYNTH_SYNTH2_VC_HI_REF_LSB 26 -#define SYNTH_SYNTH2_VC_HI_REF_MASK 0x1c000000 -#define SYNTH_SYNTH2_VC_HI_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_HI_REF_MASK) >> SYNTH_SYNTH2_VC_HI_REF_LSB) -#define SYNTH_SYNTH2_VC_HI_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_HI_REF_LSB) & SYNTH_SYNTH2_VC_HI_REF_MASK) -#define SYNTH_SYNTH2_VC_MID_REF_MSB 25 -#define SYNTH_SYNTH2_VC_MID_REF_LSB 23 -#define SYNTH_SYNTH2_VC_MID_REF_MASK 0x03800000 -#define SYNTH_SYNTH2_VC_MID_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_MID_REF_MASK) >> SYNTH_SYNTH2_VC_MID_REF_LSB) -#define SYNTH_SYNTH2_VC_MID_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_MID_REF_LSB) & SYNTH_SYNTH2_VC_MID_REF_MASK) -#define SYNTH_SYNTH2_VC_LOW_REF_MSB 22 -#define SYNTH_SYNTH2_VC_LOW_REF_LSB 20 -#define SYNTH_SYNTH2_VC_LOW_REF_MASK 0x00700000 -#define SYNTH_SYNTH2_VC_LOW_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_LOW_REF_MASK) >> SYNTH_SYNTH2_VC_LOW_REF_LSB) -#define SYNTH_SYNTH2_VC_LOW_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_LOW_REF_LSB) & SYNTH_SYNTH2_VC_LOW_REF_MASK) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MSB 19 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB 15 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK 0x000f8000 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_GET(x) (((x) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) >> SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_SET(x) (((x) << SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) -#define SYNTH_SYNTH2_LOOP_CP_MSB 14 -#define SYNTH_SYNTH2_LOOP_CP_LSB 10 -#define SYNTH_SYNTH2_LOOP_CP_MASK 0x00007c00 -#define SYNTH_SYNTH2_LOOP_CP_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CP_MASK) >> SYNTH_SYNTH2_LOOP_CP_LSB) -#define SYNTH_SYNTH2_LOOP_CP_SET(x) (((x) << SYNTH_SYNTH2_LOOP_CP_LSB) & SYNTH_SYNTH2_LOOP_CP_MASK) -#define SYNTH_SYNTH2_LOOP_RS_MSB 9 -#define SYNTH_SYNTH2_LOOP_RS_LSB 5 -#define SYNTH_SYNTH2_LOOP_RS_MASK 0x000003e0 -#define SYNTH_SYNTH2_LOOP_RS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_RS_MASK) >> SYNTH_SYNTH2_LOOP_RS_LSB) -#define SYNTH_SYNTH2_LOOP_RS_SET(x) (((x) << SYNTH_SYNTH2_LOOP_RS_LSB) & SYNTH_SYNTH2_LOOP_RS_MASK) -#define SYNTH_SYNTH2_LOOP_CS_MSB 4 -#define SYNTH_SYNTH2_LOOP_CS_LSB 3 -#define SYNTH_SYNTH2_LOOP_CS_MASK 0x00000018 -#define SYNTH_SYNTH2_LOOP_CS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CS_MASK) >> SYNTH_SYNTH2_LOOP_CS_LSB) -#define SYNTH_SYNTH2_LOOP_CS_SET(x) (((x) << SYNTH_SYNTH2_LOOP_CS_LSB) & SYNTH_SYNTH2_LOOP_CS_MASK) -#define SYNTH_SYNTH2_SPARE_BITS_MSB 2 -#define SYNTH_SYNTH2_SPARE_BITS_LSB 0 -#define SYNTH_SYNTH2_SPARE_BITS_MASK 0x00000007 -#define SYNTH_SYNTH2_SPARE_BITS_GET(x) (((x) & SYNTH_SYNTH2_SPARE_BITS_MASK) >> SYNTH_SYNTH2_SPARE_BITS_LSB) -#define SYNTH_SYNTH2_SPARE_BITS_SET(x) (((x) << SYNTH_SYNTH2_SPARE_BITS_LSB) & SYNTH_SYNTH2_SPARE_BITS_MASK) - -#define SYNTH_SYNTH3_ADDRESS 0x00000008 -#define SYNTH_SYNTH3_OFFSET 0x00000008 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_LSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MASK 0x80000000 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_GET(x) (((x) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) >> SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) -#define SYNTH_SYNTH3_DIS_CLK_XTAL_SET(x) (((x) << SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_LSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MASK 0x40000000 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_GET(x) (((x) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) >> SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_SET(x) (((x) << SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MSB 29 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB 24 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK 0x3f000000 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_SET(x) (((x) << SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_PWRUP_MSB 23 -#define SYNTH_SYNTH3_WAIT_PWRUP_LSB 18 -#define SYNTH_SYNTH3_WAIT_PWRUP_MASK 0x00fc0000 -#define SYNTH_SYNTH3_WAIT_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_PWRUP_SET(x) (((x) << SYNTH_SYNTH3_WAIT_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MSB 17 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_LSB 12 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MASK 0x0003f000 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_SET(x) (((x) << SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MSB 11 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_LSB 6 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MASK 0x00000fc0 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_SET(x) (((x) << SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MSB 5 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_LSB 0 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MASK 0x0000003f -#define SYNTH_SYNTH3_WAIT_VC_CHECK_GET(x) (((x) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) >> SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_SET(x) (((x) << SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) - -#define SYNTH_SYNTH4_ADDRESS 0x0000000c -#define SYNTH_SYNTH4_OFFSET 0x0000000c -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK 0x80000000 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_GET(x) (((x) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) >> SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_SET(x) (((x) << SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) -#define SYNTH_SYNTH4_DIS_LOSTVC_MSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_LSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_MASK 0x40000000 -#define SYNTH_SYNTH4_DIS_LOSTVC_GET(x) (((x) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) >> SYNTH_SYNTH4_DIS_LOSTVC_LSB) -#define SYNTH_SYNTH4_DIS_LOSTVC_SET(x) (((x) << SYNTH_SYNTH4_DIS_LOSTVC_LSB) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_LSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MASK 0x20000000 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_GET(x) (((x) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) >> SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_SET(x) (((x) << SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK 0x10000000 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_GET(x) (((x) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) >> SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_SET(x) (((x) << SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) -#define SYNTH_SYNTH4_FORCE_PINVC_MSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_LSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_MASK 0x08000000 -#define SYNTH_SYNTH4_FORCE_PINVC_GET(x) (((x) & SYNTH_SYNTH4_FORCE_PINVC_MASK) >> SYNTH_SYNTH4_FORCE_PINVC_LSB) -#define SYNTH_SYNTH4_FORCE_PINVC_SET(x) (((x) << SYNTH_SYNTH4_FORCE_PINVC_LSB) & SYNTH_SYNTH4_FORCE_PINVC_MASK) -#define SYNTH_SYNTH4_FORCE_VCOCAP_MSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_LSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_MASK 0x04000000 -#define SYNTH_SYNTH4_FORCE_VCOCAP_GET(x) (((x) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) >> SYNTH_SYNTH4_FORCE_VCOCAP_LSB) -#define SYNTH_SYNTH4_FORCE_VCOCAP_SET(x) (((x) << SYNTH_SYNTH4_FORCE_VCOCAP_LSB) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) -#define SYNTH_SYNTH4_VCOCAP_OVR_MSB 25 -#define SYNTH_SYNTH4_VCOCAP_OVR_LSB 18 -#define SYNTH_SYNTH4_VCOCAP_OVR_MASK 0x03fc0000 -#define SYNTH_SYNTH4_VCOCAP_OVR_GET(x) (((x) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) >> SYNTH_SYNTH4_VCOCAP_OVR_LSB) -#define SYNTH_SYNTH4_VCOCAP_OVR_SET(x) (((x) << SYNTH_SYNTH4_VCOCAP_OVR_LSB) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) -#define SYNTH_SYNTH4_VCOCAPPULLUP_MSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_LSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_MASK 0x00020000 -#define SYNTH_SYNTH4_VCOCAPPULLUP_GET(x) (((x) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) >> SYNTH_SYNTH4_VCOCAPPULLUP_LSB) -#define SYNTH_SYNTH4_VCOCAPPULLUP_SET(x) (((x) << SYNTH_SYNTH4_VCOCAPPULLUP_LSB) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) -#define SYNTH_SYNTH4_REFDIVSEL_MSB 16 -#define SYNTH_SYNTH4_REFDIVSEL_LSB 15 -#define SYNTH_SYNTH4_REFDIVSEL_MASK 0x00018000 -#define SYNTH_SYNTH4_REFDIVSEL_GET(x) (((x) & SYNTH_SYNTH4_REFDIVSEL_MASK) >> SYNTH_SYNTH4_REFDIVSEL_LSB) -#define SYNTH_SYNTH4_REFDIVSEL_SET(x) (((x) << SYNTH_SYNTH4_REFDIVSEL_LSB) & SYNTH_SYNTH4_REFDIVSEL_MASK) -#define SYNTH_SYNTH4_PFDDELAY_MSB 14 -#define SYNTH_SYNTH4_PFDDELAY_LSB 14 -#define SYNTH_SYNTH4_PFDDELAY_MASK 0x00004000 -#define SYNTH_SYNTH4_PFDDELAY_GET(x) (((x) & SYNTH_SYNTH4_PFDDELAY_MASK) >> SYNTH_SYNTH4_PFDDELAY_LSB) -#define SYNTH_SYNTH4_PFDDELAY_SET(x) (((x) << SYNTH_SYNTH4_PFDDELAY_LSB) & SYNTH_SYNTH4_PFDDELAY_MASK) -#define SYNTH_SYNTH4_PFD_DISABLE_MSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_LSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_MASK 0x00002000 -#define SYNTH_SYNTH4_PFD_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_PFD_DISABLE_MASK) >> SYNTH_SYNTH4_PFD_DISABLE_LSB) -#define SYNTH_SYNTH4_PFD_DISABLE_SET(x) (((x) << SYNTH_SYNTH4_PFD_DISABLE_LSB) & SYNTH_SYNTH4_PFD_DISABLE_MASK) -#define SYNTH_SYNTH4_PRESCSEL_MSB 12 -#define SYNTH_SYNTH4_PRESCSEL_LSB 11 -#define SYNTH_SYNTH4_PRESCSEL_MASK 0x00001800 -#define SYNTH_SYNTH4_PRESCSEL_GET(x) (((x) & SYNTH_SYNTH4_PRESCSEL_MASK) >> SYNTH_SYNTH4_PRESCSEL_LSB) -#define SYNTH_SYNTH4_PRESCSEL_SET(x) (((x) << SYNTH_SYNTH4_PRESCSEL_LSB) & SYNTH_SYNTH4_PRESCSEL_MASK) -#define SYNTH_SYNTH4_RESET_PRESC_MSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_LSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_MASK 0x00000400 -#define SYNTH_SYNTH4_RESET_PRESC_GET(x) (((x) & SYNTH_SYNTH4_RESET_PRESC_MASK) >> SYNTH_SYNTH4_RESET_PRESC_LSB) -#define SYNTH_SYNTH4_RESET_PRESC_SET(x) (((x) << SYNTH_SYNTH4_RESET_PRESC_LSB) & SYNTH_SYNTH4_RESET_PRESC_MASK) -#define SYNTH_SYNTH4_SDM_DISABLE_MSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_LSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_MASK 0x00000200 -#define SYNTH_SYNTH4_SDM_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_SDM_DISABLE_MASK) >> SYNTH_SYNTH4_SDM_DISABLE_LSB) -#define SYNTH_SYNTH4_SDM_DISABLE_SET(x) (((x) << SYNTH_SYNTH4_SDM_DISABLE_LSB) & SYNTH_SYNTH4_SDM_DISABLE_MASK) -#define SYNTH_SYNTH4_SDM_MODE_MSB 8 -#define SYNTH_SYNTH4_SDM_MODE_LSB 8 -#define SYNTH_SYNTH4_SDM_MODE_MASK 0x00000100 -#define SYNTH_SYNTH4_SDM_MODE_GET(x) (((x) & SYNTH_SYNTH4_SDM_MODE_MASK) >> SYNTH_SYNTH4_SDM_MODE_LSB) -#define SYNTH_SYNTH4_SDM_MODE_SET(x) (((x) << SYNTH_SYNTH4_SDM_MODE_LSB) & SYNTH_SYNTH4_SDM_MODE_MASK) -#define SYNTH_SYNTH4_SDM_DITHER_MSB 7 -#define SYNTH_SYNTH4_SDM_DITHER_LSB 6 -#define SYNTH_SYNTH4_SDM_DITHER_MASK 0x000000c0 -#define SYNTH_SYNTH4_SDM_DITHER_GET(x) (((x) & SYNTH_SYNTH4_SDM_DITHER_MASK) >> SYNTH_SYNTH4_SDM_DITHER_LSB) -#define SYNTH_SYNTH4_SDM_DITHER_SET(x) (((x) << SYNTH_SYNTH4_SDM_DITHER_LSB) & SYNTH_SYNTH4_SDM_DITHER_MASK) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK 0x00000020 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_GET(x) (((x) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) >> SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_SET(x) (((x) << SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK 0x00000010 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_GET(x) (((x) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) >> SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_SET(x) (((x) << SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) -#define SYNTH_SYNTH4_SPARE_MISC_MSB 3 -#define SYNTH_SYNTH4_SPARE_MISC_LSB 2 -#define SYNTH_SYNTH4_SPARE_MISC_MASK 0x0000000c -#define SYNTH_SYNTH4_SPARE_MISC_GET(x) (((x) & SYNTH_SYNTH4_SPARE_MISC_MASK) >> SYNTH_SYNTH4_SPARE_MISC_LSB) -#define SYNTH_SYNTH4_SPARE_MISC_SET(x) (((x) << SYNTH_SYNTH4_SPARE_MISC_LSB) & SYNTH_SYNTH4_SPARE_MISC_MASK) -#define SYNTH_SYNTH4_LONGSHIFTSEL_MSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_LSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_MASK 0x00000002 -#define SYNTH_SYNTH4_LONGSHIFTSEL_GET(x) (((x) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) >> SYNTH_SYNTH4_LONGSHIFTSEL_LSB) -#define SYNTH_SYNTH4_LONGSHIFTSEL_SET(x) (((x) << SYNTH_SYNTH4_LONGSHIFTSEL_LSB) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_LSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MASK 0x00000001 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_GET(x) (((x) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) >> SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_SET(x) (((x) << SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) - -#define SYNTH_SYNTH5_ADDRESS 0x00000010 -#define SYNTH_SYNTH5_OFFSET 0x00000010 -#define SYNTH_SYNTH5_LOOP_IP0_MSB 31 -#define SYNTH_SYNTH5_LOOP_IP0_LSB 28 -#define SYNTH_SYNTH5_LOOP_IP0_MASK 0xf0000000 -#define SYNTH_SYNTH5_LOOP_IP0_GET(x) (((x) & SYNTH_SYNTH5_LOOP_IP0_MASK) >> SYNTH_SYNTH5_LOOP_IP0_LSB) -#define SYNTH_SYNTH5_LOOP_IP0_SET(x) (((x) << SYNTH_SYNTH5_LOOP_IP0_LSB) & SYNTH_SYNTH5_LOOP_IP0_MASK) -#define SYNTH_SYNTH5_SLOPE_IP_MSB 27 -#define SYNTH_SYNTH5_SLOPE_IP_LSB 25 -#define SYNTH_SYNTH5_SLOPE_IP_MASK 0x0e000000 -#define SYNTH_SYNTH5_SLOPE_IP_GET(x) (((x) & SYNTH_SYNTH5_SLOPE_IP_MASK) >> SYNTH_SYNTH5_SLOPE_IP_LSB) -#define SYNTH_SYNTH5_SLOPE_IP_SET(x) (((x) << SYNTH_SYNTH5_SLOPE_IP_LSB) & SYNTH_SYNTH5_SLOPE_IP_MASK) -#define SYNTH_SYNTH5_CPBIAS_MSB 24 -#define SYNTH_SYNTH5_CPBIAS_LSB 23 -#define SYNTH_SYNTH5_CPBIAS_MASK 0x01800000 -#define SYNTH_SYNTH5_CPBIAS_GET(x) (((x) & SYNTH_SYNTH5_CPBIAS_MASK) >> SYNTH_SYNTH5_CPBIAS_LSB) -#define SYNTH_SYNTH5_CPBIAS_SET(x) (((x) << SYNTH_SYNTH5_CPBIAS_LSB) & SYNTH_SYNTH5_CPBIAS_MASK) -#define SYNTH_SYNTH5_CPSTEERING_EN_MSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_LSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_MASK 0x00400000 -#define SYNTH_SYNTH5_CPSTEERING_EN_GET(x) (((x) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) >> SYNTH_SYNTH5_CPSTEERING_EN_LSB) -#define SYNTH_SYNTH5_CPSTEERING_EN_SET(x) (((x) << SYNTH_SYNTH5_CPSTEERING_EN_LSB) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) -#define SYNTH_SYNTH5_CPLOWLK_MSB 21 -#define SYNTH_SYNTH5_CPLOWLK_LSB 21 -#define SYNTH_SYNTH5_CPLOWLK_MASK 0x00200000 -#define SYNTH_SYNTH5_CPLOWLK_GET(x) (((x) & SYNTH_SYNTH5_CPLOWLK_MASK) >> SYNTH_SYNTH5_CPLOWLK_LSB) -#define SYNTH_SYNTH5_CPLOWLK_SET(x) (((x) << SYNTH_SYNTH5_CPLOWLK_LSB) & SYNTH_SYNTH5_CPLOWLK_MASK) -#define SYNTH_SYNTH5_LOOPLEAKCUR_MSB 20 -#define SYNTH_SYNTH5_LOOPLEAKCUR_LSB 17 -#define SYNTH_SYNTH5_LOOPLEAKCUR_MASK 0x001e0000 -#define SYNTH_SYNTH5_LOOPLEAKCUR_GET(x) (((x) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) >> SYNTH_SYNTH5_LOOPLEAKCUR_LSB) -#define SYNTH_SYNTH5_LOOPLEAKCUR_SET(x) (((x) << SYNTH_SYNTH5_LOOPLEAKCUR_LSB) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) -#define SYNTH_SYNTH5_CAPRANGE1_MSB 16 -#define SYNTH_SYNTH5_CAPRANGE1_LSB 13 -#define SYNTH_SYNTH5_CAPRANGE1_MASK 0x0001e000 -#define SYNTH_SYNTH5_CAPRANGE1_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE1_MASK) >> SYNTH_SYNTH5_CAPRANGE1_LSB) -#define SYNTH_SYNTH5_CAPRANGE1_SET(x) (((x) << SYNTH_SYNTH5_CAPRANGE1_LSB) & SYNTH_SYNTH5_CAPRANGE1_MASK) -#define SYNTH_SYNTH5_CAPRANGE2_MSB 12 -#define SYNTH_SYNTH5_CAPRANGE2_LSB 9 -#define SYNTH_SYNTH5_CAPRANGE2_MASK 0x00001e00 -#define SYNTH_SYNTH5_CAPRANGE2_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE2_MASK) >> SYNTH_SYNTH5_CAPRANGE2_LSB) -#define SYNTH_SYNTH5_CAPRANGE2_SET(x) (((x) << SYNTH_SYNTH5_CAPRANGE2_LSB) & SYNTH_SYNTH5_CAPRANGE2_MASK) -#define SYNTH_SYNTH5_CAPRANGE3_MSB 8 -#define SYNTH_SYNTH5_CAPRANGE3_LSB 5 -#define SYNTH_SYNTH5_CAPRANGE3_MASK 0x000001e0 -#define SYNTH_SYNTH5_CAPRANGE3_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE3_MASK) >> SYNTH_SYNTH5_CAPRANGE3_LSB) -#define SYNTH_SYNTH5_CAPRANGE3_SET(x) (((x) << SYNTH_SYNTH5_CAPRANGE3_LSB) & SYNTH_SYNTH5_CAPRANGE3_MASK) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK 0x00000010 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_SET(x) (((x) << SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MSB 3 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB 2 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK 0x0000000c -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_GET(x) (((x) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) >> SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_SET(x) (((x) << SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) -#define SYNTH_SYNTH5_SPARE_MSB 1 -#define SYNTH_SYNTH5_SPARE_LSB 0 -#define SYNTH_SYNTH5_SPARE_MASK 0x00000003 -#define SYNTH_SYNTH5_SPARE_GET(x) (((x) & SYNTH_SYNTH5_SPARE_MASK) >> SYNTH_SYNTH5_SPARE_LSB) -#define SYNTH_SYNTH5_SPARE_SET(x) (((x) << SYNTH_SYNTH5_SPARE_LSB) & SYNTH_SYNTH5_SPARE_MASK) - -#define SYNTH_SYNTH6_ADDRESS 0x00000014 -#define SYNTH_SYNTH6_OFFSET 0x00000014 -#define SYNTH_SYNTH6_IRCP_MSB 31 -#define SYNTH_SYNTH6_IRCP_LSB 29 -#define SYNTH_SYNTH6_IRCP_MASK 0xe0000000 -#define SYNTH_SYNTH6_IRCP_GET(x) (((x) & SYNTH_SYNTH6_IRCP_MASK) >> SYNTH_SYNTH6_IRCP_LSB) -#define SYNTH_SYNTH6_IRCP_SET(x) (((x) << SYNTH_SYNTH6_IRCP_LSB) & SYNTH_SYNTH6_IRCP_MASK) -#define SYNTH_SYNTH6_IRVCMON_MSB 28 -#define SYNTH_SYNTH6_IRVCMON_LSB 26 -#define SYNTH_SYNTH6_IRVCMON_MASK 0x1c000000 -#define SYNTH_SYNTH6_IRVCMON_GET(x) (((x) & SYNTH_SYNTH6_IRVCMON_MASK) >> SYNTH_SYNTH6_IRVCMON_LSB) -#define SYNTH_SYNTH6_IRVCMON_SET(x) (((x) << SYNTH_SYNTH6_IRVCMON_LSB) & SYNTH_SYNTH6_IRVCMON_MASK) -#define SYNTH_SYNTH6_IRSPARE_MSB 25 -#define SYNTH_SYNTH6_IRSPARE_LSB 23 -#define SYNTH_SYNTH6_IRSPARE_MASK 0x03800000 -#define SYNTH_SYNTH6_IRSPARE_GET(x) (((x) & SYNTH_SYNTH6_IRSPARE_MASK) >> SYNTH_SYNTH6_IRSPARE_LSB) -#define SYNTH_SYNTH6_IRSPARE_SET(x) (((x) << SYNTH_SYNTH6_IRSPARE_LSB) & SYNTH_SYNTH6_IRSPARE_MASK) -#define SYNTH_SYNTH6_ICPRESC_MSB 22 -#define SYNTH_SYNTH6_ICPRESC_LSB 20 -#define SYNTH_SYNTH6_ICPRESC_MASK 0x00700000 -#define SYNTH_SYNTH6_ICPRESC_GET(x) (((x) & SYNTH_SYNTH6_ICPRESC_MASK) >> SYNTH_SYNTH6_ICPRESC_LSB) -#define SYNTH_SYNTH6_ICPRESC_SET(x) (((x) << SYNTH_SYNTH6_ICPRESC_LSB) & SYNTH_SYNTH6_ICPRESC_MASK) -#define SYNTH_SYNTH6_ICLODIV_MSB 19 -#define SYNTH_SYNTH6_ICLODIV_LSB 17 -#define SYNTH_SYNTH6_ICLODIV_MASK 0x000e0000 -#define SYNTH_SYNTH6_ICLODIV_GET(x) (((x) & SYNTH_SYNTH6_ICLODIV_MASK) >> SYNTH_SYNTH6_ICLODIV_LSB) -#define SYNTH_SYNTH6_ICLODIV_SET(x) (((x) << SYNTH_SYNTH6_ICLODIV_LSB) & SYNTH_SYNTH6_ICLODIV_MASK) -#define SYNTH_SYNTH6_ICLOMIX_MSB 16 -#define SYNTH_SYNTH6_ICLOMIX_LSB 14 -#define SYNTH_SYNTH6_ICLOMIX_MASK 0x0001c000 -#define SYNTH_SYNTH6_ICLOMIX_GET(x) (((x) & SYNTH_SYNTH6_ICLOMIX_MASK) >> SYNTH_SYNTH6_ICLOMIX_LSB) -#define SYNTH_SYNTH6_ICLOMIX_SET(x) (((x) << SYNTH_SYNTH6_ICLOMIX_LSB) & SYNTH_SYNTH6_ICLOMIX_MASK) -#define SYNTH_SYNTH6_ICSPAREA_MSB 13 -#define SYNTH_SYNTH6_ICSPAREA_LSB 11 -#define SYNTH_SYNTH6_ICSPAREA_MASK 0x00003800 -#define SYNTH_SYNTH6_ICSPAREA_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREA_MASK) >> SYNTH_SYNTH6_ICSPAREA_LSB) -#define SYNTH_SYNTH6_ICSPAREA_SET(x) (((x) << SYNTH_SYNTH6_ICSPAREA_LSB) & SYNTH_SYNTH6_ICSPAREA_MASK) -#define SYNTH_SYNTH6_ICSPAREB_MSB 10 -#define SYNTH_SYNTH6_ICSPAREB_LSB 8 -#define SYNTH_SYNTH6_ICSPAREB_MASK 0x00000700 -#define SYNTH_SYNTH6_ICSPAREB_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREB_MASK) >> SYNTH_SYNTH6_ICSPAREB_LSB) -#define SYNTH_SYNTH6_ICSPAREB_SET(x) (((x) << SYNTH_SYNTH6_ICSPAREB_LSB) & SYNTH_SYNTH6_ICSPAREB_MASK) -#define SYNTH_SYNTH6_ICVCO_MSB 7 -#define SYNTH_SYNTH6_ICVCO_LSB 5 -#define SYNTH_SYNTH6_ICVCO_MASK 0x000000e0 -#define SYNTH_SYNTH6_ICVCO_GET(x) (((x) & SYNTH_SYNTH6_ICVCO_MASK) >> SYNTH_SYNTH6_ICVCO_LSB) -#define SYNTH_SYNTH6_ICVCO_SET(x) (((x) << SYNTH_SYNTH6_ICVCO_LSB) & SYNTH_SYNTH6_ICVCO_MASK) -#define SYNTH_SYNTH6_VCOBUFBIAS_MSB 4 -#define SYNTH_SYNTH6_VCOBUFBIAS_LSB 3 -#define SYNTH_SYNTH6_VCOBUFBIAS_MASK 0x00000018 -#define SYNTH_SYNTH6_VCOBUFBIAS_GET(x) (((x) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) >> SYNTH_SYNTH6_VCOBUFBIAS_LSB) -#define SYNTH_SYNTH6_VCOBUFBIAS_SET(x) (((x) << SYNTH_SYNTH6_VCOBUFBIAS_LSB) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) -#define SYNTH_SYNTH6_SPARE_BIAS_MSB 2 -#define SYNTH_SYNTH6_SPARE_BIAS_LSB 0 -#define SYNTH_SYNTH6_SPARE_BIAS_MASK 0x00000007 -#define SYNTH_SYNTH6_SPARE_BIAS_GET(x) (((x) & SYNTH_SYNTH6_SPARE_BIAS_MASK) >> SYNTH_SYNTH6_SPARE_BIAS_LSB) -#define SYNTH_SYNTH6_SPARE_BIAS_SET(x) (((x) << SYNTH_SYNTH6_SPARE_BIAS_LSB) & SYNTH_SYNTH6_SPARE_BIAS_MASK) - -#define SYNTH_SYNTH7_ADDRESS 0x00000018 -#define SYNTH_SYNTH7_OFFSET 0x00000018 -#define SYNTH_SYNTH7_SYNTH_ON_MSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_LSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_MASK 0x80000000 -#define SYNTH_SYNTH7_SYNTH_ON_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_ON_MASK) >> SYNTH_SYNTH7_SYNTH_ON_LSB) -#define SYNTH_SYNTH7_SYNTH_ON_SET(x) (((x) << SYNTH_SYNTH7_SYNTH_ON_LSB) & SYNTH_SYNTH7_SYNTH_ON_MASK) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MSB 30 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_LSB 27 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MASK 0x78000000 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) >> SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_SET(x) (((x) << SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) -#define SYNTH_SYNTH7_CAP_SEARCH_MSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_LSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_MASK 0x04000000 -#define SYNTH_SYNTH7_CAP_SEARCH_GET(x) (((x) & SYNTH_SYNTH7_CAP_SEARCH_MASK) >> SYNTH_SYNTH7_CAP_SEARCH_LSB) -#define SYNTH_SYNTH7_CAP_SEARCH_SET(x) (((x) << SYNTH_SYNTH7_CAP_SEARCH_LSB) & SYNTH_SYNTH7_CAP_SEARCH_MASK) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK 0x02000000 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) >> SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_SET(x) (((x) << SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) -#define SYNTH_SYNTH7_PIN_VC_MSB 24 -#define SYNTH_SYNTH7_PIN_VC_LSB 24 -#define SYNTH_SYNTH7_PIN_VC_MASK 0x01000000 -#define SYNTH_SYNTH7_PIN_VC_GET(x) (((x) & SYNTH_SYNTH7_PIN_VC_MASK) >> SYNTH_SYNTH7_PIN_VC_LSB) -#define SYNTH_SYNTH7_PIN_VC_SET(x) (((x) << SYNTH_SYNTH7_PIN_VC_LSB) & SYNTH_SYNTH7_PIN_VC_MASK) -#define SYNTH_SYNTH7_VCO_CAP_ST_MSB 23 -#define SYNTH_SYNTH7_VCO_CAP_ST_LSB 16 -#define SYNTH_SYNTH7_VCO_CAP_ST_MASK 0x00ff0000 -#define SYNTH_SYNTH7_VCO_CAP_ST_GET(x) (((x) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) >> SYNTH_SYNTH7_VCO_CAP_ST_LSB) -#define SYNTH_SYNTH7_VCO_CAP_ST_SET(x) (((x) << SYNTH_SYNTH7_VCO_CAP_ST_LSB) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) -#define SYNTH_SYNTH7_SHORT_R_MSB 15 -#define SYNTH_SYNTH7_SHORT_R_LSB 15 -#define SYNTH_SYNTH7_SHORT_R_MASK 0x00008000 -#define SYNTH_SYNTH7_SHORT_R_GET(x) (((x) & SYNTH_SYNTH7_SHORT_R_MASK) >> SYNTH_SYNTH7_SHORT_R_LSB) -#define SYNTH_SYNTH7_SHORT_R_SET(x) (((x) << SYNTH_SYNTH7_SHORT_R_LSB) & SYNTH_SYNTH7_SHORT_R_MASK) -#define SYNTH_SYNTH7_RESET_RFD_MSB 14 -#define SYNTH_SYNTH7_RESET_RFD_LSB 14 -#define SYNTH_SYNTH7_RESET_RFD_MASK 0x00004000 -#define SYNTH_SYNTH7_RESET_RFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_RFD_MASK) >> SYNTH_SYNTH7_RESET_RFD_LSB) -#define SYNTH_SYNTH7_RESET_RFD_SET(x) (((x) << SYNTH_SYNTH7_RESET_RFD_LSB) & SYNTH_SYNTH7_RESET_RFD_MASK) -#define SYNTH_SYNTH7_RESET_PFD_MSB 13 -#define SYNTH_SYNTH7_RESET_PFD_LSB 13 -#define SYNTH_SYNTH7_RESET_PFD_MASK 0x00002000 -#define SYNTH_SYNTH7_RESET_PFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_PFD_MASK) >> SYNTH_SYNTH7_RESET_PFD_LSB) -#define SYNTH_SYNTH7_RESET_PFD_SET(x) (((x) << SYNTH_SYNTH7_RESET_PFD_LSB) & SYNTH_SYNTH7_RESET_PFD_MASK) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK 0x00001000 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_GET(x) (((x) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) >> SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_SET(x) (((x) << SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) -#define SYNTH_SYNTH7_RESET_SDM_B_MSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_LSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_MASK 0x00000800 -#define SYNTH_SYNTH7_RESET_SDM_B_GET(x) (((x) & SYNTH_SYNTH7_RESET_SDM_B_MASK) >> SYNTH_SYNTH7_RESET_SDM_B_LSB) -#define SYNTH_SYNTH7_RESET_SDM_B_SET(x) (((x) << SYNTH_SYNTH7_RESET_SDM_B_LSB) & SYNTH_SYNTH7_RESET_SDM_B_MASK) -#define SYNTH_SYNTH7_VC2HIGH_MSB 10 -#define SYNTH_SYNTH7_VC2HIGH_LSB 10 -#define SYNTH_SYNTH7_VC2HIGH_MASK 0x00000400 -#define SYNTH_SYNTH7_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH7_VC2HIGH_MASK) >> SYNTH_SYNTH7_VC2HIGH_LSB) -#define SYNTH_SYNTH7_VC2HIGH_SET(x) (((x) << SYNTH_SYNTH7_VC2HIGH_LSB) & SYNTH_SYNTH7_VC2HIGH_MASK) -#define SYNTH_SYNTH7_VC2LOW_MSB 9 -#define SYNTH_SYNTH7_VC2LOW_LSB 9 -#define SYNTH_SYNTH7_VC2LOW_MASK 0x00000200 -#define SYNTH_SYNTH7_VC2LOW_GET(x) (((x) & SYNTH_SYNTH7_VC2LOW_MASK) >> SYNTH_SYNTH7_VC2LOW_LSB) -#define SYNTH_SYNTH7_VC2LOW_SET(x) (((x) << SYNTH_SYNTH7_VC2LOW_LSB) & SYNTH_SYNTH7_VC2LOW_MASK) -#define SYNTH_SYNTH7_LOOP_IP_MSB 8 -#define SYNTH_SYNTH7_LOOP_IP_LSB 5 -#define SYNTH_SYNTH7_LOOP_IP_MASK 0x000001e0 -#define SYNTH_SYNTH7_LOOP_IP_GET(x) (((x) & SYNTH_SYNTH7_LOOP_IP_MASK) >> SYNTH_SYNTH7_LOOP_IP_LSB) -#define SYNTH_SYNTH7_LOOP_IP_SET(x) (((x) << SYNTH_SYNTH7_LOOP_IP_LSB) & SYNTH_SYNTH7_LOOP_IP_MASK) -#define SYNTH_SYNTH7_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH7_LOBUF5GTUNE_LSB 3 -#define SYNTH_SYNTH7_LOBUF5GTUNE_MASK 0x00000018 -#define SYNTH_SYNTH7_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH7_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH7_LOBUF5GTUNE_SET(x) (((x) << SYNTH_SYNTH7_LOBUF5GTUNE_LSB) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH7_SPARE_READ_MSB 2 -#define SYNTH_SYNTH7_SPARE_READ_LSB 0 -#define SYNTH_SYNTH7_SPARE_READ_MASK 0x00000007 -#define SYNTH_SYNTH7_SPARE_READ_GET(x) (((x) & SYNTH_SYNTH7_SPARE_READ_MASK) >> SYNTH_SYNTH7_SPARE_READ_LSB) -#define SYNTH_SYNTH7_SPARE_READ_SET(x) (((x) << SYNTH_SYNTH7_SPARE_READ_LSB) & SYNTH_SYNTH7_SPARE_READ_MASK) - -#define SYNTH_SYNTH8_ADDRESS 0x0000001c -#define SYNTH_SYNTH8_OFFSET 0x0000001c -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK 0x80000000 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_GET(x) (((x) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) >> SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_SET(x) (((x) << SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) -#define SYNTH_SYNTH8_FRACMODE_MSB 30 -#define SYNTH_SYNTH8_FRACMODE_LSB 30 -#define SYNTH_SYNTH8_FRACMODE_MASK 0x40000000 -#define SYNTH_SYNTH8_FRACMODE_GET(x) (((x) & SYNTH_SYNTH8_FRACMODE_MASK) >> SYNTH_SYNTH8_FRACMODE_LSB) -#define SYNTH_SYNTH8_FRACMODE_SET(x) (((x) << SYNTH_SYNTH8_FRACMODE_LSB) & SYNTH_SYNTH8_FRACMODE_MASK) -#define SYNTH_SYNTH8_AMODEREFSEL_MSB 29 -#define SYNTH_SYNTH8_AMODEREFSEL_LSB 28 -#define SYNTH_SYNTH8_AMODEREFSEL_MASK 0x30000000 -#define SYNTH_SYNTH8_AMODEREFSEL_GET(x) (((x) & SYNTH_SYNTH8_AMODEREFSEL_MASK) >> SYNTH_SYNTH8_AMODEREFSEL_LSB) -#define SYNTH_SYNTH8_AMODEREFSEL_SET(x) (((x) << SYNTH_SYNTH8_AMODEREFSEL_LSB) & SYNTH_SYNTH8_AMODEREFSEL_MASK) -#define SYNTH_SYNTH8_SPARE_MSB 27 -#define SYNTH_SYNTH8_SPARE_LSB 27 -#define SYNTH_SYNTH8_SPARE_MASK 0x08000000 -#define SYNTH_SYNTH8_SPARE_GET(x) (((x) & SYNTH_SYNTH8_SPARE_MASK) >> SYNTH_SYNTH8_SPARE_LSB) -#define SYNTH_SYNTH8_SPARE_SET(x) (((x) << SYNTH_SYNTH8_SPARE_LSB) & SYNTH_SYNTH8_SPARE_MASK) -#define SYNTH_SYNTH8_CHANSEL_MSB 26 -#define SYNTH_SYNTH8_CHANSEL_LSB 18 -#define SYNTH_SYNTH8_CHANSEL_MASK 0x07fc0000 -#define SYNTH_SYNTH8_CHANSEL_GET(x) (((x) & SYNTH_SYNTH8_CHANSEL_MASK) >> SYNTH_SYNTH8_CHANSEL_LSB) -#define SYNTH_SYNTH8_CHANSEL_SET(x) (((x) << SYNTH_SYNTH8_CHANSEL_LSB) & SYNTH_SYNTH8_CHANSEL_MASK) -#define SYNTH_SYNTH8_CHANFRAC_MSB 17 -#define SYNTH_SYNTH8_CHANFRAC_LSB 1 -#define SYNTH_SYNTH8_CHANFRAC_MASK 0x0003fffe -#define SYNTH_SYNTH8_CHANFRAC_GET(x) (((x) & SYNTH_SYNTH8_CHANFRAC_MASK) >> SYNTH_SYNTH8_CHANFRAC_LSB) -#define SYNTH_SYNTH8_CHANFRAC_SET(x) (((x) << SYNTH_SYNTH8_CHANFRAC_LSB) & SYNTH_SYNTH8_CHANFRAC_MASK) -#define SYNTH_SYNTH8_FORCE_FRACLSB_MSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_LSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_MASK 0x00000001 -#define SYNTH_SYNTH8_FORCE_FRACLSB_GET(x) (((x) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) >> SYNTH_SYNTH8_FORCE_FRACLSB_LSB) -#define SYNTH_SYNTH8_FORCE_FRACLSB_SET(x) (((x) << SYNTH_SYNTH8_FORCE_FRACLSB_LSB) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct synth_reg_reg_s { - volatile unsigned int synth_synth1; - volatile unsigned int synth_synth2; - volatile unsigned int synth_synth3; - volatile unsigned int synth_synth4; - volatile unsigned int synth_synth5; - volatile unsigned int synth_synth6; - volatile unsigned int synth_synth7; - volatile unsigned int synth_synth8; -} synth_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _SYNTH_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/synth_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/synth_reg.vrh deleted file mode 100644 index 306c6471becb..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/synth_reg.vrh +++ /dev/null @@ -1,939 +0,0 @@ -#ifndef _SYNTH_REG_VRH_ -#define _SYNTH_REG_VRH_ - -#define SYNTH_SYNTH1_ADDRESS 'h00000000 -#define SYNTH_SYNTH1_PWD_BIAS_MSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_LSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_MASK 'h80000000 -#define SYNTH_SYNTH1_PWD_BIAS_GET(x) (((x) & SYNTH_SYNTH1_PWD_BIAS_MASK) >> SYNTH_SYNTH1_PWD_BIAS_LSB) -#define SYNTH_SYNTH1_PWD_BIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_BIAS_LSB) & SYNTH_SYNTH1_PWD_BIAS_MASK) -#define SYNTH_SYNTH1_PWD_BIAS_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_CP_MSB 30 -#define SYNTH_SYNTH1_PWD_CP_LSB 30 -#define SYNTH_SYNTH1_PWD_CP_MASK 'h40000000 -#define SYNTH_SYNTH1_PWD_CP_GET(x) (((x) & SYNTH_SYNTH1_PWD_CP_MASK) >> SYNTH_SYNTH1_PWD_CP_LSB) -#define SYNTH_SYNTH1_PWD_CP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_CP_LSB) & SYNTH_SYNTH1_PWD_CP_MASK) -#define SYNTH_SYNTH1_PWD_CP_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_VCMON_MSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_LSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_MASK 'h20000000 -#define SYNTH_SYNTH1_PWD_VCMON_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCMON_MASK) >> SYNTH_SYNTH1_PWD_VCMON_LSB) -#define SYNTH_SYNTH1_PWD_VCMON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_VCMON_LSB) & SYNTH_SYNTH1_PWD_VCMON_MASK) -#define SYNTH_SYNTH1_PWD_VCMON_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_VCO_MSB 28 -#define SYNTH_SYNTH1_PWD_VCO_LSB 28 -#define SYNTH_SYNTH1_PWD_VCO_MASK 'h10000000 -#define SYNTH_SYNTH1_PWD_VCO_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCO_MASK) >> SYNTH_SYNTH1_PWD_VCO_LSB) -#define SYNTH_SYNTH1_PWD_VCO_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_VCO_LSB) & SYNTH_SYNTH1_PWD_VCO_MASK) -#define SYNTH_SYNTH1_PWD_VCO_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_PRESC_MSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_LSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_MASK 'h08000000 -#define SYNTH_SYNTH1_PWD_PRESC_GET(x) (((x) & SYNTH_SYNTH1_PWD_PRESC_MASK) >> SYNTH_SYNTH1_PWD_PRESC_LSB) -#define SYNTH_SYNTH1_PWD_PRESC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_PRESC_LSB) & SYNTH_SYNTH1_PWD_PRESC_MASK) -#define SYNTH_SYNTH1_PWD_PRESC_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_LODIV_MSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_LSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_MASK 'h04000000 -#define SYNTH_SYNTH1_PWD_LODIV_GET(x) (((x) & SYNTH_SYNTH1_PWD_LODIV_MASK) >> SYNTH_SYNTH1_PWD_LODIV_LSB) -#define SYNTH_SYNTH1_PWD_LODIV_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_LODIV_LSB) & SYNTH_SYNTH1_PWD_LODIV_MASK) -#define SYNTH_SYNTH1_PWD_LODIV_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_LOMIX_MSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_LSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_MASK 'h02000000 -#define SYNTH_SYNTH1_PWD_LOMIX_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOMIX_MASK) >> SYNTH_SYNTH1_PWD_LOMIX_LSB) -#define SYNTH_SYNTH1_PWD_LOMIX_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_LOMIX_LSB) & SYNTH_SYNTH1_PWD_LOMIX_MASK) -#define SYNTH_SYNTH1_PWD_LOMIX_RESET 1'h0 -#define SYNTH_SYNTH1_FORCE_LO_ON_MSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_LSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_MASK 'h01000000 -#define SYNTH_SYNTH1_FORCE_LO_ON_GET(x) (((x) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) >> SYNTH_SYNTH1_FORCE_LO_ON_LSB) -#define SYNTH_SYNTH1_FORCE_LO_ON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_FORCE_LO_ON_LSB) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) -#define SYNTH_SYNTH1_FORCE_LO_ON_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_LOBUF5G_MSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_LSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_MASK 'h00800000 -#define SYNTH_SYNTH1_PWD_LOBUF5G_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) >> SYNTH_SYNTH1_PWD_LOBUF5G_LSB) -#define SYNTH_SYNTH1_PWD_LOBUF5G_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_LOBUF5G_LSB) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) -#define SYNTH_SYNTH1_PWD_LOBUF5G_RESET 1'h0 -#define SYNTH_SYNTH1_VCOREGBYPASS_MSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_LSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_MASK 'h00400000 -#define SYNTH_SYNTH1_VCOREGBYPASS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) >> SYNTH_SYNTH1_VCOREGBYPASS_LSB) -#define SYNTH_SYNTH1_VCOREGBYPASS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_VCOREGBYPASS_LSB) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) -#define SYNTH_SYNTH1_VCOREGBYPASS_RESET 1'h1 -#define SYNTH_SYNTH1_VCOREGLEVEL_MSB 21 -#define SYNTH_SYNTH1_VCOREGLEVEL_LSB 20 -#define SYNTH_SYNTH1_VCOREGLEVEL_MASK 'h00300000 -#define SYNTH_SYNTH1_VCOREGLEVEL_GET(x) (((x) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) >> SYNTH_SYNTH1_VCOREGLEVEL_LSB) -#define SYNTH_SYNTH1_VCOREGLEVEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_VCOREGLEVEL_LSB) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) -#define SYNTH_SYNTH1_VCOREGLEVEL_RESET 2'h1 -#define SYNTH_SYNTH1_VCOREGBIAS_MSB 19 -#define SYNTH_SYNTH1_VCOREGBIAS_LSB 18 -#define SYNTH_SYNTH1_VCOREGBIAS_MASK 'h000c0000 -#define SYNTH_SYNTH1_VCOREGBIAS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBIAS_MASK) >> SYNTH_SYNTH1_VCOREGBIAS_LSB) -#define SYNTH_SYNTH1_VCOREGBIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_VCOREGBIAS_LSB) & SYNTH_SYNTH1_VCOREGBIAS_MASK) -#define SYNTH_SYNTH1_VCOREGBIAS_RESET 2'h1 -#define SYNTH_SYNTH1_SLIDINGIF_MSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_LSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_MASK 'h00020000 -#define SYNTH_SYNTH1_SLIDINGIF_GET(x) (((x) & SYNTH_SYNTH1_SLIDINGIF_MASK) >> SYNTH_SYNTH1_SLIDINGIF_LSB) -#define SYNTH_SYNTH1_SLIDINGIF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_SLIDINGIF_LSB) & SYNTH_SYNTH1_SLIDINGIF_MASK) -#define SYNTH_SYNTH1_SLIDINGIF_RESET 1'h0 -#define SYNTH_SYNTH1_SPARE_PWD_MSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_LSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_MASK 'h00010000 -#define SYNTH_SYNTH1_SPARE_PWD_GET(x) (((x) & SYNTH_SYNTH1_SPARE_PWD_MASK) >> SYNTH_SYNTH1_SPARE_PWD_LSB) -#define SYNTH_SYNTH1_SPARE_PWD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_SPARE_PWD_LSB) & SYNTH_SYNTH1_SPARE_PWD_MASK) -#define SYNTH_SYNTH1_SPARE_PWD_RESET 1'h0 -#define SYNTH_SYNTH1_CON_VDDVCOREG_MSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_LSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_MASK 'h00008000 -#define SYNTH_SYNTH1_CON_VDDVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) >> SYNTH_SYNTH1_CON_VDDVCOREG_LSB) -#define SYNTH_SYNTH1_CON_VDDVCOREG_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_CON_VDDVCOREG_LSB) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) -#define SYNTH_SYNTH1_CON_VDDVCOREG_RESET 1'h0 -#define SYNTH_SYNTH1_CON_IVCOREG_MSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_LSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_MASK 'h00004000 -#define SYNTH_SYNTH1_CON_IVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOREG_MASK) >> SYNTH_SYNTH1_CON_IVCOREG_LSB) -#define SYNTH_SYNTH1_CON_IVCOREG_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_CON_IVCOREG_LSB) & SYNTH_SYNTH1_CON_IVCOREG_MASK) -#define SYNTH_SYNTH1_CON_IVCOREG_RESET 1'h0 -#define SYNTH_SYNTH1_CON_IVCOBUF_MSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_LSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_MASK 'h00002000 -#define SYNTH_SYNTH1_CON_IVCOBUF_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) >> SYNTH_SYNTH1_CON_IVCOBUF_LSB) -#define SYNTH_SYNTH1_CON_IVCOBUF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_CON_IVCOBUF_LSB) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) -#define SYNTH_SYNTH1_CON_IVCOBUF_RESET 1'h0 -#define SYNTH_SYNTH1_SEL_VCMONABUS_MSB 12 -#define SYNTH_SYNTH1_SEL_VCMONABUS_LSB 10 -#define SYNTH_SYNTH1_SEL_VCMONABUS_MASK 'h00001c00 -#define SYNTH_SYNTH1_SEL_VCMONABUS_GET(x) (((x) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) >> SYNTH_SYNTH1_SEL_VCMONABUS_LSB) -#define SYNTH_SYNTH1_SEL_VCMONABUS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_SEL_VCMONABUS_LSB) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) -#define SYNTH_SYNTH1_SEL_VCMONABUS_RESET 3'h0 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK 'h00000200 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) >> SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_RESET 1'h0 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_LSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MASK 'h00000100 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) >> SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_RESET 1'h0 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK 'h00000080 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_RESET 1'h0 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK 'h00000040 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_FB_MSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_LSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_MASK 'h00000020 -#define SYNTH_SYNTH1_MONITOR_FB_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_MASK) >> SYNTH_SYNTH1_MONITOR_FB_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_FB_LSB) & SYNTH_SYNTH1_MONITOR_FB_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_REF_MSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_LSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_MASK 'h00000010 -#define SYNTH_SYNTH1_MONITOR_REF_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_REF_MASK) >> SYNTH_SYNTH1_MONITOR_REF_LSB) -#define SYNTH_SYNTH1_MONITOR_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_REF_LSB) & SYNTH_SYNTH1_MONITOR_REF_MASK) -#define SYNTH_SYNTH1_MONITOR_REF_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK 'h00000008 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) >> SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK 'h00000004 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) >> SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_LSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MASK 'h00000002 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) >> SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK 'h00000001 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) >> SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_RESET 1'h0 -#define SYNTH_SYNTH1_RESET (32'h0 | \ - SYNTH_SYNTH1_PWD_BIAS_SET(SYNTH_SYNTH1_PWD_BIAS_RESET) | \ - SYNTH_SYNTH1_PWD_CP_SET(SYNTH_SYNTH1_PWD_CP_RESET) | \ - SYNTH_SYNTH1_PWD_VCMON_SET(SYNTH_SYNTH1_PWD_VCMON_RESET) | \ - SYNTH_SYNTH1_PWD_VCO_SET(SYNTH_SYNTH1_PWD_VCO_RESET) | \ - SYNTH_SYNTH1_PWD_PRESC_SET(SYNTH_SYNTH1_PWD_PRESC_RESET) | \ - SYNTH_SYNTH1_PWD_LODIV_SET(SYNTH_SYNTH1_PWD_LODIV_RESET) | \ - SYNTH_SYNTH1_PWD_LOMIX_SET(SYNTH_SYNTH1_PWD_LOMIX_RESET) | \ - SYNTH_SYNTH1_FORCE_LO_ON_SET(SYNTH_SYNTH1_FORCE_LO_ON_RESET) | \ - SYNTH_SYNTH1_PWD_LOBUF5G_SET(SYNTH_SYNTH1_PWD_LOBUF5G_RESET) | \ - SYNTH_SYNTH1_VCOREGBYPASS_SET(SYNTH_SYNTH1_VCOREGBYPASS_RESET) | \ - SYNTH_SYNTH1_VCOREGLEVEL_SET(SYNTH_SYNTH1_VCOREGLEVEL_RESET) | \ - SYNTH_SYNTH1_VCOREGBIAS_SET(SYNTH_SYNTH1_VCOREGBIAS_RESET) | \ - SYNTH_SYNTH1_SLIDINGIF_SET(SYNTH_SYNTH1_SLIDINGIF_RESET) | \ - SYNTH_SYNTH1_SPARE_PWD_SET(SYNTH_SYNTH1_SPARE_PWD_RESET) | \ - SYNTH_SYNTH1_CON_VDDVCOREG_SET(SYNTH_SYNTH1_CON_VDDVCOREG_RESET) | \ - SYNTH_SYNTH1_CON_IVCOREG_SET(SYNTH_SYNTH1_CON_IVCOREG_RESET) | \ - SYNTH_SYNTH1_CON_IVCOBUF_SET(SYNTH_SYNTH1_CON_IVCOBUF_RESET) | \ - SYNTH_SYNTH1_SEL_VCMONABUS_SET(SYNTH_SYNTH1_SEL_VCMONABUS_RESET) | \ - SYNTH_SYNTH1_PWUP_VCOBUF_PD_SET(SYNTH_SYNTH1_PWUP_VCOBUF_PD_RESET) | \ - SYNTH_SYNTH1_PWUP_LODIV_PD_SET(SYNTH_SYNTH1_PWUP_LODIV_PD_RESET) | \ - SYNTH_SYNTH1_PWUP_LOMIX_PD_SET(SYNTH_SYNTH1_PWUP_LOMIX_PD_RESET) | \ - SYNTH_SYNTH1_PWUP_LOBUF5G_PD_SET(SYNTH_SYNTH1_PWUP_LOBUF5G_PD_RESET) | \ - SYNTH_SYNTH1_MONITOR_FB_SET(SYNTH_SYNTH1_MONITOR_FB_RESET) | \ - SYNTH_SYNTH1_MONITOR_REF_SET(SYNTH_SYNTH1_MONITOR_REF_RESET) | \ - SYNTH_SYNTH1_MONITOR_FB_DIV2_SET(SYNTH_SYNTH1_MONITOR_FB_DIV2_RESET) | \ - SYNTH_SYNTH1_MONITOR_VC2HIGH_SET(SYNTH_SYNTH1_MONITOR_VC2HIGH_RESET) | \ - SYNTH_SYNTH1_MONITOR_VC2LOW_SET(SYNTH_SYNTH1_MONITOR_VC2LOW_RESET) | \ - SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_RESET)) -#define SYNTH_SYNTH1_HW_MASK (32'h0) -#define SYNTH_SYNTH1_SW_MASK (32'h0 | \ - SYNTH_SYNTH1_PWD_BIAS_MASK | \ - SYNTH_SYNTH1_PWD_CP_MASK | \ - SYNTH_SYNTH1_PWD_VCMON_MASK | \ - SYNTH_SYNTH1_PWD_VCO_MASK | \ - SYNTH_SYNTH1_PWD_PRESC_MASK | \ - SYNTH_SYNTH1_PWD_LODIV_MASK | \ - SYNTH_SYNTH1_PWD_LOMIX_MASK | \ - SYNTH_SYNTH1_FORCE_LO_ON_MASK | \ - SYNTH_SYNTH1_PWD_LOBUF5G_MASK | \ - SYNTH_SYNTH1_VCOREGBYPASS_MASK | \ - SYNTH_SYNTH1_VCOREGLEVEL_MASK | \ - SYNTH_SYNTH1_VCOREGBIAS_MASK | \ - SYNTH_SYNTH1_SLIDINGIF_MASK | \ - SYNTH_SYNTH1_SPARE_PWD_MASK | \ - SYNTH_SYNTH1_CON_VDDVCOREG_MASK | \ - SYNTH_SYNTH1_CON_IVCOREG_MASK | \ - SYNTH_SYNTH1_CON_IVCOBUF_MASK | \ - SYNTH_SYNTH1_SEL_VCMONABUS_MASK | \ - SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK | \ - SYNTH_SYNTH1_PWUP_LODIV_PD_MASK | \ - SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK | \ - SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK | \ - SYNTH_SYNTH1_MONITOR_FB_MASK | \ - SYNTH_SYNTH1_MONITOR_REF_MASK | \ - SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK | \ - SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK | \ - SYNTH_SYNTH1_MONITOR_VC2LOW_MASK | \ - SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) - -#define SYNTH_SYNTH2_ADDRESS 'h00000004 -#define SYNTH_SYNTH2_VC_CAL_REF_MSB 31 -#define SYNTH_SYNTH2_VC_CAL_REF_LSB 29 -#define SYNTH_SYNTH2_VC_CAL_REF_MASK 'he0000000 -#define SYNTH_SYNTH2_VC_CAL_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_CAL_REF_MASK) >> SYNTH_SYNTH2_VC_CAL_REF_LSB) -#define SYNTH_SYNTH2_VC_CAL_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_CAL_REF_LSB) & SYNTH_SYNTH2_VC_CAL_REF_MASK) -#define SYNTH_SYNTH2_VC_CAL_REF_RESET 3'h0 -#define SYNTH_SYNTH2_VC_HI_REF_MSB 28 -#define SYNTH_SYNTH2_VC_HI_REF_LSB 26 -#define SYNTH_SYNTH2_VC_HI_REF_MASK 'h1c000000 -#define SYNTH_SYNTH2_VC_HI_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_HI_REF_MASK) >> SYNTH_SYNTH2_VC_HI_REF_LSB) -#define SYNTH_SYNTH2_VC_HI_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_HI_REF_LSB) & SYNTH_SYNTH2_VC_HI_REF_MASK) -#define SYNTH_SYNTH2_VC_HI_REF_RESET 3'h3 -#define SYNTH_SYNTH2_VC_MID_REF_MSB 25 -#define SYNTH_SYNTH2_VC_MID_REF_LSB 23 -#define SYNTH_SYNTH2_VC_MID_REF_MASK 'h03800000 -#define SYNTH_SYNTH2_VC_MID_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_MID_REF_MASK) >> SYNTH_SYNTH2_VC_MID_REF_LSB) -#define SYNTH_SYNTH2_VC_MID_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_MID_REF_LSB) & SYNTH_SYNTH2_VC_MID_REF_MASK) -#define SYNTH_SYNTH2_VC_MID_REF_RESET 3'h4 -#define SYNTH_SYNTH2_VC_LOW_REF_MSB 22 -#define SYNTH_SYNTH2_VC_LOW_REF_LSB 20 -#define SYNTH_SYNTH2_VC_LOW_REF_MASK 'h00700000 -#define SYNTH_SYNTH2_VC_LOW_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_LOW_REF_MASK) >> SYNTH_SYNTH2_VC_LOW_REF_LSB) -#define SYNTH_SYNTH2_VC_LOW_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_LOW_REF_LSB) & SYNTH_SYNTH2_VC_LOW_REF_MASK) -#define SYNTH_SYNTH2_VC_LOW_REF_RESET 3'h4 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MSB 19 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB 15 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK 'h000f8000 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_GET(x) (((x) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) >> SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_RESET 5'h8 -#define SYNTH_SYNTH2_LOOP_CP_MSB 14 -#define SYNTH_SYNTH2_LOOP_CP_LSB 10 -#define SYNTH_SYNTH2_LOOP_CP_MASK 'h00007c00 -#define SYNTH_SYNTH2_LOOP_CP_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CP_MASK) >> SYNTH_SYNTH2_LOOP_CP_LSB) -#define SYNTH_SYNTH2_LOOP_CP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_CP_LSB) & SYNTH_SYNTH2_LOOP_CP_MASK) -#define SYNTH_SYNTH2_LOOP_CP_RESET 5'h8 -#define SYNTH_SYNTH2_LOOP_RS_MSB 9 -#define SYNTH_SYNTH2_LOOP_RS_LSB 5 -#define SYNTH_SYNTH2_LOOP_RS_MASK 'h000003e0 -#define SYNTH_SYNTH2_LOOP_RS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_RS_MASK) >> SYNTH_SYNTH2_LOOP_RS_LSB) -#define SYNTH_SYNTH2_LOOP_RS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_RS_LSB) & SYNTH_SYNTH2_LOOP_RS_MASK) -#define SYNTH_SYNTH2_LOOP_RS_RESET 5'h5 -#define SYNTH_SYNTH2_LOOP_CS_MSB 4 -#define SYNTH_SYNTH2_LOOP_CS_LSB 3 -#define SYNTH_SYNTH2_LOOP_CS_MASK 'h00000018 -#define SYNTH_SYNTH2_LOOP_CS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CS_MASK) >> SYNTH_SYNTH2_LOOP_CS_LSB) -#define SYNTH_SYNTH2_LOOP_CS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_CS_LSB) & SYNTH_SYNTH2_LOOP_CS_MASK) -#define SYNTH_SYNTH2_LOOP_CS_RESET 2'h3 -#define SYNTH_SYNTH2_SPARE_BITS_MSB 2 -#define SYNTH_SYNTH2_SPARE_BITS_LSB 0 -#define SYNTH_SYNTH2_SPARE_BITS_MASK 'h00000007 -#define SYNTH_SYNTH2_SPARE_BITS_GET(x) (((x) & SYNTH_SYNTH2_SPARE_BITS_MASK) >> SYNTH_SYNTH2_SPARE_BITS_LSB) -#define SYNTH_SYNTH2_SPARE_BITS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_SPARE_BITS_LSB) & SYNTH_SYNTH2_SPARE_BITS_MASK) -#define SYNTH_SYNTH2_SPARE_BITS_RESET 3'h0 -#define SYNTH_SYNTH2_RESET (32'h0 | \ - SYNTH_SYNTH2_VC_CAL_REF_SET(SYNTH_SYNTH2_VC_CAL_REF_RESET) | \ - SYNTH_SYNTH2_VC_HI_REF_SET(SYNTH_SYNTH2_VC_HI_REF_RESET) | \ - SYNTH_SYNTH2_VC_MID_REF_SET(SYNTH_SYNTH2_VC_MID_REF_RESET) | \ - SYNTH_SYNTH2_VC_LOW_REF_SET(SYNTH_SYNTH2_VC_LOW_REF_RESET) | \ - SYNTH_SYNTH2_LOOP_3RD_ORDER_R_SET(SYNTH_SYNTH2_LOOP_3RD_ORDER_R_RESET) | \ - SYNTH_SYNTH2_LOOP_CP_SET(SYNTH_SYNTH2_LOOP_CP_RESET) | \ - SYNTH_SYNTH2_LOOP_RS_SET(SYNTH_SYNTH2_LOOP_RS_RESET) | \ - SYNTH_SYNTH2_LOOP_CS_SET(SYNTH_SYNTH2_LOOP_CS_RESET) | \ - SYNTH_SYNTH2_SPARE_BITS_SET(SYNTH_SYNTH2_SPARE_BITS_RESET)) -#define SYNTH_SYNTH2_HW_MASK (32'h0) -#define SYNTH_SYNTH2_SW_MASK (32'h0 | \ - SYNTH_SYNTH2_VC_CAL_REF_MASK | \ - SYNTH_SYNTH2_VC_HI_REF_MASK | \ - SYNTH_SYNTH2_VC_MID_REF_MASK | \ - SYNTH_SYNTH2_VC_LOW_REF_MASK | \ - SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK | \ - SYNTH_SYNTH2_LOOP_CP_MASK | \ - SYNTH_SYNTH2_LOOP_RS_MASK | \ - SYNTH_SYNTH2_LOOP_CS_MASK | \ - SYNTH_SYNTH2_SPARE_BITS_MASK) - -#define SYNTH_SYNTH3_ADDRESS 'h00000008 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_LSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MASK 'h80000000 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_GET(x) (((x) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) >> SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) -#define SYNTH_SYNTH3_DIS_CLK_XTAL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) -#define SYNTH_SYNTH3_DIS_CLK_XTAL_RESET 1'h0 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_LSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MASK 'h40000000 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_GET(x) (((x) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) >> SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_RESET 1'h1 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MSB 29 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB 24 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK 'h3f000000 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_RESET 6'h14 -#define SYNTH_SYNTH3_WAIT_PWRUP_MSB 23 -#define SYNTH_SYNTH3_WAIT_PWRUP_LSB 18 -#define SYNTH_SYNTH3_WAIT_PWRUP_MASK 'h00fc0000 -#define SYNTH_SYNTH3_WAIT_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_PWRUP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_PWRUP_RESET 6'h8 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MSB 17 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_LSB 12 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MASK 'h0003f000 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_RESET 6'h14 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MSB 11 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_LSB 6 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MASK 'h00000fc0 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_RESET 6'h14 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MSB 5 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_LSB 0 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MASK 'h0000003f -#define SYNTH_SYNTH3_WAIT_VC_CHECK_GET(x) (((x) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) >> SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_RESET 6'h14 -#define SYNTH_SYNTH3_RESET (32'h0 | \ - SYNTH_SYNTH3_DIS_CLK_XTAL_SET(SYNTH_SYNTH3_DIS_CLK_XTAL_RESET) | \ - SYNTH_SYNTH3_SEL_CLK_DIV2_SET(SYNTH_SYNTH3_SEL_CLK_DIV2_RESET) | \ - SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_SET(SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_RESET) | \ - SYNTH_SYNTH3_WAIT_PWRUP_SET(SYNTH_SYNTH3_WAIT_PWRUP_RESET) | \ - SYNTH_SYNTH3_WAIT_CAL_BIN_SET(SYNTH_SYNTH3_WAIT_CAL_BIN_RESET) | \ - SYNTH_SYNTH3_WAIT_CAL_LIN_SET(SYNTH_SYNTH3_WAIT_CAL_LIN_RESET) | \ - SYNTH_SYNTH3_WAIT_VC_CHECK_SET(SYNTH_SYNTH3_WAIT_VC_CHECK_RESET)) -#define SYNTH_SYNTH3_HW_MASK (32'h0) -#define SYNTH_SYNTH3_SW_MASK (32'h0 | \ - SYNTH_SYNTH3_DIS_CLK_XTAL_MASK | \ - SYNTH_SYNTH3_SEL_CLK_DIV2_MASK | \ - SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK | \ - SYNTH_SYNTH3_WAIT_PWRUP_MASK | \ - SYNTH_SYNTH3_WAIT_CAL_BIN_MASK | \ - SYNTH_SYNTH3_WAIT_CAL_LIN_MASK | \ - SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) - -#define SYNTH_SYNTH4_ADDRESS 'h0000000c -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK 'h80000000 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_GET(x) (((x) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) >> SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_RESET 1'h0 -#define SYNTH_SYNTH4_DIS_LOSTVC_MSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_LSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_MASK 'h40000000 -#define SYNTH_SYNTH4_DIS_LOSTVC_GET(x) (((x) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) >> SYNTH_SYNTH4_DIS_LOSTVC_LSB) -#define SYNTH_SYNTH4_DIS_LOSTVC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_DIS_LOSTVC_LSB) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) -#define SYNTH_SYNTH4_DIS_LOSTVC_RESET 1'h0 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_LSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MASK 'h20000000 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_GET(x) (((x) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) >> SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_RESET 1'h0 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK 'h10000000 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_GET(x) (((x) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) >> SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_RESET 1'h1 -#define SYNTH_SYNTH4_FORCE_PINVC_MSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_LSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_MASK 'h08000000 -#define SYNTH_SYNTH4_FORCE_PINVC_GET(x) (((x) & SYNTH_SYNTH4_FORCE_PINVC_MASK) >> SYNTH_SYNTH4_FORCE_PINVC_LSB) -#define SYNTH_SYNTH4_FORCE_PINVC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_FORCE_PINVC_LSB) & SYNTH_SYNTH4_FORCE_PINVC_MASK) -#define SYNTH_SYNTH4_FORCE_PINVC_RESET 1'h0 -#define SYNTH_SYNTH4_FORCE_VCOCAP_MSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_LSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_MASK 'h04000000 -#define SYNTH_SYNTH4_FORCE_VCOCAP_GET(x) (((x) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) >> SYNTH_SYNTH4_FORCE_VCOCAP_LSB) -#define SYNTH_SYNTH4_FORCE_VCOCAP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_FORCE_VCOCAP_LSB) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) -#define SYNTH_SYNTH4_FORCE_VCOCAP_RESET 1'h0 -#define SYNTH_SYNTH4_VCOCAP_OVR_MSB 25 -#define SYNTH_SYNTH4_VCOCAP_OVR_LSB 18 -#define SYNTH_SYNTH4_VCOCAP_OVR_MASK 'h03fc0000 -#define SYNTH_SYNTH4_VCOCAP_OVR_GET(x) (((x) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) >> SYNTH_SYNTH4_VCOCAP_OVR_LSB) -#define SYNTH_SYNTH4_VCOCAP_OVR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_VCOCAP_OVR_LSB) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) -#define SYNTH_SYNTH4_VCOCAP_OVR_RESET 8'h80 -#define SYNTH_SYNTH4_VCOCAPPULLUP_MSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_LSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_MASK 'h00020000 -#define SYNTH_SYNTH4_VCOCAPPULLUP_GET(x) (((x) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) >> SYNTH_SYNTH4_VCOCAPPULLUP_LSB) -#define SYNTH_SYNTH4_VCOCAPPULLUP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_VCOCAPPULLUP_LSB) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) -#define SYNTH_SYNTH4_VCOCAPPULLUP_RESET 1'h1 -#define SYNTH_SYNTH4_REFDIVSEL_MSB 16 -#define SYNTH_SYNTH4_REFDIVSEL_LSB 15 -#define SYNTH_SYNTH4_REFDIVSEL_MASK 'h00018000 -#define SYNTH_SYNTH4_REFDIVSEL_GET(x) (((x) & SYNTH_SYNTH4_REFDIVSEL_MASK) >> SYNTH_SYNTH4_REFDIVSEL_LSB) -#define SYNTH_SYNTH4_REFDIVSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_REFDIVSEL_LSB) & SYNTH_SYNTH4_REFDIVSEL_MASK) -#define SYNTH_SYNTH4_REFDIVSEL_RESET 2'h0 -#define SYNTH_SYNTH4_PFDDELAY_MSB 14 -#define SYNTH_SYNTH4_PFDDELAY_LSB 14 -#define SYNTH_SYNTH4_PFDDELAY_MASK 'h00004000 -#define SYNTH_SYNTH4_PFDDELAY_GET(x) (((x) & SYNTH_SYNTH4_PFDDELAY_MASK) >> SYNTH_SYNTH4_PFDDELAY_LSB) -#define SYNTH_SYNTH4_PFDDELAY_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PFDDELAY_LSB) & SYNTH_SYNTH4_PFDDELAY_MASK) -#define SYNTH_SYNTH4_PFDDELAY_RESET 1'h1 -#define SYNTH_SYNTH4_PFD_DISABLE_MSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_LSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_MASK 'h00002000 -#define SYNTH_SYNTH4_PFD_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_PFD_DISABLE_MASK) >> SYNTH_SYNTH4_PFD_DISABLE_LSB) -#define SYNTH_SYNTH4_PFD_DISABLE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PFD_DISABLE_LSB) & SYNTH_SYNTH4_PFD_DISABLE_MASK) -#define SYNTH_SYNTH4_PFD_DISABLE_RESET 1'h0 -#define SYNTH_SYNTH4_PRESCSEL_MSB 12 -#define SYNTH_SYNTH4_PRESCSEL_LSB 11 -#define SYNTH_SYNTH4_PRESCSEL_MASK 'h00001800 -#define SYNTH_SYNTH4_PRESCSEL_GET(x) (((x) & SYNTH_SYNTH4_PRESCSEL_MASK) >> SYNTH_SYNTH4_PRESCSEL_LSB) -#define SYNTH_SYNTH4_PRESCSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PRESCSEL_LSB) & SYNTH_SYNTH4_PRESCSEL_MASK) -#define SYNTH_SYNTH4_PRESCSEL_RESET 2'h3 -#define SYNTH_SYNTH4_RESET_PRESC_MSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_LSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_MASK 'h00000400 -#define SYNTH_SYNTH4_RESET_PRESC_GET(x) (((x) & SYNTH_SYNTH4_RESET_PRESC_MASK) >> SYNTH_SYNTH4_RESET_PRESC_LSB) -#define SYNTH_SYNTH4_RESET_PRESC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_RESET_PRESC_LSB) & SYNTH_SYNTH4_RESET_PRESC_MASK) -#define SYNTH_SYNTH4_RESET_PRESC_RESET 1'h0 -#define SYNTH_SYNTH4_SDM_DISABLE_MSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_LSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_MASK 'h00000200 -#define SYNTH_SYNTH4_SDM_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_SDM_DISABLE_MASK) >> SYNTH_SYNTH4_SDM_DISABLE_LSB) -#define SYNTH_SYNTH4_SDM_DISABLE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SDM_DISABLE_LSB) & SYNTH_SYNTH4_SDM_DISABLE_MASK) -#define SYNTH_SYNTH4_SDM_DISABLE_RESET 1'h0 -#define SYNTH_SYNTH4_SDM_MODE_MSB 8 -#define SYNTH_SYNTH4_SDM_MODE_LSB 8 -#define SYNTH_SYNTH4_SDM_MODE_MASK 'h00000100 -#define SYNTH_SYNTH4_SDM_MODE_GET(x) (((x) & SYNTH_SYNTH4_SDM_MODE_MASK) >> SYNTH_SYNTH4_SDM_MODE_LSB) -#define SYNTH_SYNTH4_SDM_MODE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SDM_MODE_LSB) & SYNTH_SYNTH4_SDM_MODE_MASK) -#define SYNTH_SYNTH4_SDM_MODE_RESET 1'h0 -#define SYNTH_SYNTH4_SDM_DITHER_MSB 7 -#define SYNTH_SYNTH4_SDM_DITHER_LSB 6 -#define SYNTH_SYNTH4_SDM_DITHER_MASK 'h000000c0 -#define SYNTH_SYNTH4_SDM_DITHER_GET(x) (((x) & SYNTH_SYNTH4_SDM_DITHER_MASK) >> SYNTH_SYNTH4_SDM_DITHER_LSB) -#define SYNTH_SYNTH4_SDM_DITHER_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SDM_DITHER_LSB) & SYNTH_SYNTH4_SDM_DITHER_MASK) -#define SYNTH_SYNTH4_SDM_DITHER_RESET 2'h0 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK 'h00000020 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_GET(x) (((x) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) >> SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_RESET 1'h0 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK 'h00000010 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_GET(x) (((x) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) >> SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_RESET 1'h0 -#define SYNTH_SYNTH4_SPARE_MISC_MSB 3 -#define SYNTH_SYNTH4_SPARE_MISC_LSB 2 -#define SYNTH_SYNTH4_SPARE_MISC_MASK 'h0000000c -#define SYNTH_SYNTH4_SPARE_MISC_GET(x) (((x) & SYNTH_SYNTH4_SPARE_MISC_MASK) >> SYNTH_SYNTH4_SPARE_MISC_LSB) -#define SYNTH_SYNTH4_SPARE_MISC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SPARE_MISC_LSB) & SYNTH_SYNTH4_SPARE_MISC_MASK) -#define SYNTH_SYNTH4_SPARE_MISC_RESET 2'h0 -#define SYNTH_SYNTH4_LONGSHIFTSEL_MSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_LSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_MASK 'h00000002 -#define SYNTH_SYNTH4_LONGSHIFTSEL_GET(x) (((x) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) >> SYNTH_SYNTH4_LONGSHIFTSEL_LSB) -#define SYNTH_SYNTH4_LONGSHIFTSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_LONGSHIFTSEL_LSB) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) -#define SYNTH_SYNTH4_LONGSHIFTSEL_RESET 1'h0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_LSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MASK 'h00000001 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_GET(x) (((x) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) >> SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_RESET 1'h0 -#define SYNTH_SYNTH4_RESET (32'h0 | \ - SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_SET(SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_RESET) | \ - SYNTH_SYNTH4_DIS_LOSTVC_SET(SYNTH_SYNTH4_DIS_LOSTVC_RESET) | \ - SYNTH_SYNTH4_ALWAYS_SHORTR_SET(SYNTH_SYNTH4_ALWAYS_SHORTR_RESET) | \ - SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_SET(SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_RESET) | \ - SYNTH_SYNTH4_FORCE_PINVC_SET(SYNTH_SYNTH4_FORCE_PINVC_RESET) | \ - SYNTH_SYNTH4_FORCE_VCOCAP_SET(SYNTH_SYNTH4_FORCE_VCOCAP_RESET) | \ - SYNTH_SYNTH4_VCOCAP_OVR_SET(SYNTH_SYNTH4_VCOCAP_OVR_RESET) | \ - SYNTH_SYNTH4_VCOCAPPULLUP_SET(SYNTH_SYNTH4_VCOCAPPULLUP_RESET) | \ - SYNTH_SYNTH4_REFDIVSEL_SET(SYNTH_SYNTH4_REFDIVSEL_RESET) | \ - SYNTH_SYNTH4_PFDDELAY_SET(SYNTH_SYNTH4_PFDDELAY_RESET) | \ - SYNTH_SYNTH4_PFD_DISABLE_SET(SYNTH_SYNTH4_PFD_DISABLE_RESET) | \ - SYNTH_SYNTH4_PRESCSEL_SET(SYNTH_SYNTH4_PRESCSEL_RESET) | \ - SYNTH_SYNTH4_RESET_PRESC_SET(SYNTH_SYNTH4_RESET_PRESC_RESET) | \ - SYNTH_SYNTH4_SDM_DISABLE_SET(SYNTH_SYNTH4_SDM_DISABLE_RESET) | \ - SYNTH_SYNTH4_SDM_MODE_SET(SYNTH_SYNTH4_SDM_MODE_RESET) | \ - SYNTH_SYNTH4_SDM_DITHER_SET(SYNTH_SYNTH4_SDM_DITHER_RESET) | \ - SYNTH_SYNTH4_PSCOUNT_FBSEL_SET(SYNTH_SYNTH4_PSCOUNT_FBSEL_RESET) | \ - SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_SET(SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_RESET) | \ - SYNTH_SYNTH4_SPARE_MISC_SET(SYNTH_SYNTH4_SPARE_MISC_RESET) | \ - SYNTH_SYNTH4_LONGSHIFTSEL_SET(SYNTH_SYNTH4_LONGSHIFTSEL_RESET) | \ - SYNTH_SYNTH4_FORCE_SHIFTREG_SET(SYNTH_SYNTH4_FORCE_SHIFTREG_RESET)) -#define SYNTH_SYNTH4_HW_MASK (32'h0) -#define SYNTH_SYNTH4_SW_MASK (32'h0 | \ - SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK | \ - SYNTH_SYNTH4_DIS_LOSTVC_MASK | \ - SYNTH_SYNTH4_ALWAYS_SHORTR_MASK | \ - SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK | \ - SYNTH_SYNTH4_FORCE_PINVC_MASK | \ - SYNTH_SYNTH4_FORCE_VCOCAP_MASK | \ - SYNTH_SYNTH4_VCOCAP_OVR_MASK | \ - SYNTH_SYNTH4_VCOCAPPULLUP_MASK | \ - SYNTH_SYNTH4_REFDIVSEL_MASK | \ - SYNTH_SYNTH4_PFDDELAY_MASK | \ - SYNTH_SYNTH4_PFD_DISABLE_MASK | \ - SYNTH_SYNTH4_PRESCSEL_MASK | \ - SYNTH_SYNTH4_RESET_PRESC_MASK | \ - SYNTH_SYNTH4_SDM_DISABLE_MASK | \ - SYNTH_SYNTH4_SDM_MODE_MASK | \ - SYNTH_SYNTH4_SDM_DITHER_MASK | \ - SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK | \ - SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK | \ - SYNTH_SYNTH4_SPARE_MISC_MASK | \ - SYNTH_SYNTH4_LONGSHIFTSEL_MASK | \ - SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) - -#define SYNTH_SYNTH5_ADDRESS 'h00000010 -#define SYNTH_SYNTH5_LOOP_IP0_MSB 31 -#define SYNTH_SYNTH5_LOOP_IP0_LSB 28 -#define SYNTH_SYNTH5_LOOP_IP0_MASK 'hf0000000 -#define SYNTH_SYNTH5_LOOP_IP0_GET(x) (((x) & SYNTH_SYNTH5_LOOP_IP0_MASK) >> SYNTH_SYNTH5_LOOP_IP0_LSB) -#define SYNTH_SYNTH5_LOOP_IP0_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_LOOP_IP0_LSB) & SYNTH_SYNTH5_LOOP_IP0_MASK) -#define SYNTH_SYNTH5_LOOP_IP0_RESET 4'hd -#define SYNTH_SYNTH5_SLOPE_IP_MSB 27 -#define SYNTH_SYNTH5_SLOPE_IP_LSB 25 -#define SYNTH_SYNTH5_SLOPE_IP_MASK 'h0e000000 -#define SYNTH_SYNTH5_SLOPE_IP_GET(x) (((x) & SYNTH_SYNTH5_SLOPE_IP_MASK) >> SYNTH_SYNTH5_SLOPE_IP_LSB) -#define SYNTH_SYNTH5_SLOPE_IP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_SLOPE_IP_LSB) & SYNTH_SYNTH5_SLOPE_IP_MASK) -#define SYNTH_SYNTH5_SLOPE_IP_RESET 3'h0 -#define SYNTH_SYNTH5_CPBIAS_MSB 24 -#define SYNTH_SYNTH5_CPBIAS_LSB 23 -#define SYNTH_SYNTH5_CPBIAS_MASK 'h01800000 -#define SYNTH_SYNTH5_CPBIAS_GET(x) (((x) & SYNTH_SYNTH5_CPBIAS_MASK) >> SYNTH_SYNTH5_CPBIAS_LSB) -#define SYNTH_SYNTH5_CPBIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CPBIAS_LSB) & SYNTH_SYNTH5_CPBIAS_MASK) -#define SYNTH_SYNTH5_CPBIAS_RESET 2'h1 -#define SYNTH_SYNTH5_CPSTEERING_EN_MSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_LSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_MASK 'h00400000 -#define SYNTH_SYNTH5_CPSTEERING_EN_GET(x) (((x) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) >> SYNTH_SYNTH5_CPSTEERING_EN_LSB) -#define SYNTH_SYNTH5_CPSTEERING_EN_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CPSTEERING_EN_LSB) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) -#define SYNTH_SYNTH5_CPSTEERING_EN_RESET 1'h0 -#define SYNTH_SYNTH5_CPLOWLK_MSB 21 -#define SYNTH_SYNTH5_CPLOWLK_LSB 21 -#define SYNTH_SYNTH5_CPLOWLK_MASK 'h00200000 -#define SYNTH_SYNTH5_CPLOWLK_GET(x) (((x) & SYNTH_SYNTH5_CPLOWLK_MASK) >> SYNTH_SYNTH5_CPLOWLK_LSB) -#define SYNTH_SYNTH5_CPLOWLK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CPLOWLK_LSB) & SYNTH_SYNTH5_CPLOWLK_MASK) -#define SYNTH_SYNTH5_CPLOWLK_RESET 1'h0 -#define SYNTH_SYNTH5_LOOPLEAKCUR_MSB 20 -#define SYNTH_SYNTH5_LOOPLEAKCUR_LSB 17 -#define SYNTH_SYNTH5_LOOPLEAKCUR_MASK 'h001e0000 -#define SYNTH_SYNTH5_LOOPLEAKCUR_GET(x) (((x) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) >> SYNTH_SYNTH5_LOOPLEAKCUR_LSB) -#define SYNTH_SYNTH5_LOOPLEAKCUR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_LOOPLEAKCUR_LSB) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) -#define SYNTH_SYNTH5_LOOPLEAKCUR_RESET 4'h0 -#define SYNTH_SYNTH5_CAPRANGE1_MSB 16 -#define SYNTH_SYNTH5_CAPRANGE1_LSB 13 -#define SYNTH_SYNTH5_CAPRANGE1_MASK 'h0001e000 -#define SYNTH_SYNTH5_CAPRANGE1_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE1_MASK) >> SYNTH_SYNTH5_CAPRANGE1_LSB) -#define SYNTH_SYNTH5_CAPRANGE1_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CAPRANGE1_LSB) & SYNTH_SYNTH5_CAPRANGE1_MASK) -#define SYNTH_SYNTH5_CAPRANGE1_RESET 4'h4 -#define SYNTH_SYNTH5_CAPRANGE2_MSB 12 -#define SYNTH_SYNTH5_CAPRANGE2_LSB 9 -#define SYNTH_SYNTH5_CAPRANGE2_MASK 'h00001e00 -#define SYNTH_SYNTH5_CAPRANGE2_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE2_MASK) >> SYNTH_SYNTH5_CAPRANGE2_LSB) -#define SYNTH_SYNTH5_CAPRANGE2_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CAPRANGE2_LSB) & SYNTH_SYNTH5_CAPRANGE2_MASK) -#define SYNTH_SYNTH5_CAPRANGE2_RESET 4'h8 -#define SYNTH_SYNTH5_CAPRANGE3_MSB 8 -#define SYNTH_SYNTH5_CAPRANGE3_LSB 5 -#define SYNTH_SYNTH5_CAPRANGE3_MASK 'h000001e0 -#define SYNTH_SYNTH5_CAPRANGE3_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE3_MASK) >> SYNTH_SYNTH5_CAPRANGE3_LSB) -#define SYNTH_SYNTH5_CAPRANGE3_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CAPRANGE3_LSB) & SYNTH_SYNTH5_CAPRANGE3_MASK) -#define SYNTH_SYNTH5_CAPRANGE3_RESET 4'hc -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK 'h00000010 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_RESET 1'h0 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MSB 3 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB 2 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK 'h0000000c -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_GET(x) (((x) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) >> SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_RESET 2'h2 -#define SYNTH_SYNTH5_SPARE_MSB 1 -#define SYNTH_SYNTH5_SPARE_LSB 0 -#define SYNTH_SYNTH5_SPARE_MASK 'h00000003 -#define SYNTH_SYNTH5_SPARE_GET(x) (((x) & SYNTH_SYNTH5_SPARE_MASK) >> SYNTH_SYNTH5_SPARE_LSB) -#define SYNTH_SYNTH5_SPARE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_SPARE_LSB) & SYNTH_SYNTH5_SPARE_MASK) -#define SYNTH_SYNTH5_SPARE_RESET 2'h0 -#define SYNTH_SYNTH5_RESET (32'h0 | \ - SYNTH_SYNTH5_LOOP_IP0_SET(SYNTH_SYNTH5_LOOP_IP0_RESET) | \ - SYNTH_SYNTH5_SLOPE_IP_SET(SYNTH_SYNTH5_SLOPE_IP_RESET) | \ - SYNTH_SYNTH5_CPBIAS_SET(SYNTH_SYNTH5_CPBIAS_RESET) | \ - SYNTH_SYNTH5_CPSTEERING_EN_SET(SYNTH_SYNTH5_CPSTEERING_EN_RESET) | \ - SYNTH_SYNTH5_CPLOWLK_SET(SYNTH_SYNTH5_CPLOWLK_RESET) | \ - SYNTH_SYNTH5_LOOPLEAKCUR_SET(SYNTH_SYNTH5_LOOPLEAKCUR_RESET) | \ - SYNTH_SYNTH5_CAPRANGE1_SET(SYNTH_SYNTH5_CAPRANGE1_RESET) | \ - SYNTH_SYNTH5_CAPRANGE2_SET(SYNTH_SYNTH5_CAPRANGE2_RESET) | \ - SYNTH_SYNTH5_CAPRANGE3_SET(SYNTH_SYNTH5_CAPRANGE3_RESET) | \ - SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_SET(SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_RESET) | \ - SYNTH_SYNTH5_LOBUF5GTUNE_OVR_SET(SYNTH_SYNTH5_LOBUF5GTUNE_OVR_RESET) | \ - SYNTH_SYNTH5_SPARE_SET(SYNTH_SYNTH5_SPARE_RESET)) -#define SYNTH_SYNTH5_HW_MASK (32'h0) -#define SYNTH_SYNTH5_SW_MASK (32'h0 | \ - SYNTH_SYNTH5_LOOP_IP0_MASK | \ - SYNTH_SYNTH5_SLOPE_IP_MASK | \ - SYNTH_SYNTH5_CPBIAS_MASK | \ - SYNTH_SYNTH5_CPSTEERING_EN_MASK | \ - SYNTH_SYNTH5_CPLOWLK_MASK | \ - SYNTH_SYNTH5_LOOPLEAKCUR_MASK | \ - SYNTH_SYNTH5_CAPRANGE1_MASK | \ - SYNTH_SYNTH5_CAPRANGE2_MASK | \ - SYNTH_SYNTH5_CAPRANGE3_MASK | \ - SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK | \ - SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK | \ - SYNTH_SYNTH5_SPARE_MASK) - -#define SYNTH_SYNTH6_ADDRESS 'h00000014 -#define SYNTH_SYNTH6_IRCP_MSB 31 -#define SYNTH_SYNTH6_IRCP_LSB 29 -#define SYNTH_SYNTH6_IRCP_MASK 'he0000000 -#define SYNTH_SYNTH6_IRCP_GET(x) (((x) & SYNTH_SYNTH6_IRCP_MASK) >> SYNTH_SYNTH6_IRCP_LSB) -#define SYNTH_SYNTH6_IRCP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_IRCP_LSB) & SYNTH_SYNTH6_IRCP_MASK) -#define SYNTH_SYNTH6_IRCP_RESET 3'h4 -#define SYNTH_SYNTH6_IRVCMON_MSB 28 -#define SYNTH_SYNTH6_IRVCMON_LSB 26 -#define SYNTH_SYNTH6_IRVCMON_MASK 'h1c000000 -#define SYNTH_SYNTH6_IRVCMON_GET(x) (((x) & SYNTH_SYNTH6_IRVCMON_MASK) >> SYNTH_SYNTH6_IRVCMON_LSB) -#define SYNTH_SYNTH6_IRVCMON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_IRVCMON_LSB) & SYNTH_SYNTH6_IRVCMON_MASK) -#define SYNTH_SYNTH6_IRVCMON_RESET 3'h4 -#define SYNTH_SYNTH6_IRSPARE_MSB 25 -#define SYNTH_SYNTH6_IRSPARE_LSB 23 -#define SYNTH_SYNTH6_IRSPARE_MASK 'h03800000 -#define SYNTH_SYNTH6_IRSPARE_GET(x) (((x) & SYNTH_SYNTH6_IRSPARE_MASK) >> SYNTH_SYNTH6_IRSPARE_LSB) -#define SYNTH_SYNTH6_IRSPARE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_IRSPARE_LSB) & SYNTH_SYNTH6_IRSPARE_MASK) -#define SYNTH_SYNTH6_IRSPARE_RESET 3'h4 -#define SYNTH_SYNTH6_ICPRESC_MSB 22 -#define SYNTH_SYNTH6_ICPRESC_LSB 20 -#define SYNTH_SYNTH6_ICPRESC_MASK 'h00700000 -#define SYNTH_SYNTH6_ICPRESC_GET(x) (((x) & SYNTH_SYNTH6_ICPRESC_MASK) >> SYNTH_SYNTH6_ICPRESC_LSB) -#define SYNTH_SYNTH6_ICPRESC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICPRESC_LSB) & SYNTH_SYNTH6_ICPRESC_MASK) -#define SYNTH_SYNTH6_ICPRESC_RESET 3'h4 -#define SYNTH_SYNTH6_ICLODIV_MSB 19 -#define SYNTH_SYNTH6_ICLODIV_LSB 17 -#define SYNTH_SYNTH6_ICLODIV_MASK 'h000e0000 -#define SYNTH_SYNTH6_ICLODIV_GET(x) (((x) & SYNTH_SYNTH6_ICLODIV_MASK) >> SYNTH_SYNTH6_ICLODIV_LSB) -#define SYNTH_SYNTH6_ICLODIV_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICLODIV_LSB) & SYNTH_SYNTH6_ICLODIV_MASK) -#define SYNTH_SYNTH6_ICLODIV_RESET 3'h4 -#define SYNTH_SYNTH6_ICLOMIX_MSB 16 -#define SYNTH_SYNTH6_ICLOMIX_LSB 14 -#define SYNTH_SYNTH6_ICLOMIX_MASK 'h0001c000 -#define SYNTH_SYNTH6_ICLOMIX_GET(x) (((x) & SYNTH_SYNTH6_ICLOMIX_MASK) >> SYNTH_SYNTH6_ICLOMIX_LSB) -#define SYNTH_SYNTH6_ICLOMIX_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICLOMIX_LSB) & SYNTH_SYNTH6_ICLOMIX_MASK) -#define SYNTH_SYNTH6_ICLOMIX_RESET 3'h4 -#define SYNTH_SYNTH6_ICSPAREA_MSB 13 -#define SYNTH_SYNTH6_ICSPAREA_LSB 11 -#define SYNTH_SYNTH6_ICSPAREA_MASK 'h00003800 -#define SYNTH_SYNTH6_ICSPAREA_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREA_MASK) >> SYNTH_SYNTH6_ICSPAREA_LSB) -#define SYNTH_SYNTH6_ICSPAREA_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICSPAREA_LSB) & SYNTH_SYNTH6_ICSPAREA_MASK) -#define SYNTH_SYNTH6_ICSPAREA_RESET 3'h4 -#define SYNTH_SYNTH6_ICSPAREB_MSB 10 -#define SYNTH_SYNTH6_ICSPAREB_LSB 8 -#define SYNTH_SYNTH6_ICSPAREB_MASK 'h00000700 -#define SYNTH_SYNTH6_ICSPAREB_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREB_MASK) >> SYNTH_SYNTH6_ICSPAREB_LSB) -#define SYNTH_SYNTH6_ICSPAREB_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICSPAREB_LSB) & SYNTH_SYNTH6_ICSPAREB_MASK) -#define SYNTH_SYNTH6_ICSPAREB_RESET 3'h4 -#define SYNTH_SYNTH6_ICVCO_MSB 7 -#define SYNTH_SYNTH6_ICVCO_LSB 5 -#define SYNTH_SYNTH6_ICVCO_MASK 'h000000e0 -#define SYNTH_SYNTH6_ICVCO_GET(x) (((x) & SYNTH_SYNTH6_ICVCO_MASK) >> SYNTH_SYNTH6_ICVCO_LSB) -#define SYNTH_SYNTH6_ICVCO_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICVCO_LSB) & SYNTH_SYNTH6_ICVCO_MASK) -#define SYNTH_SYNTH6_ICVCO_RESET 3'h4 -#define SYNTH_SYNTH6_VCOBUFBIAS_MSB 4 -#define SYNTH_SYNTH6_VCOBUFBIAS_LSB 3 -#define SYNTH_SYNTH6_VCOBUFBIAS_MASK 'h00000018 -#define SYNTH_SYNTH6_VCOBUFBIAS_GET(x) (((x) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) >> SYNTH_SYNTH6_VCOBUFBIAS_LSB) -#define SYNTH_SYNTH6_VCOBUFBIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_VCOBUFBIAS_LSB) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) -#define SYNTH_SYNTH6_VCOBUFBIAS_RESET 2'h2 -#define SYNTH_SYNTH6_SPARE_BIAS_MSB 2 -#define SYNTH_SYNTH6_SPARE_BIAS_LSB 0 -#define SYNTH_SYNTH6_SPARE_BIAS_MASK 'h00000007 -#define SYNTH_SYNTH6_SPARE_BIAS_GET(x) (((x) & SYNTH_SYNTH6_SPARE_BIAS_MASK) >> SYNTH_SYNTH6_SPARE_BIAS_LSB) -#define SYNTH_SYNTH6_SPARE_BIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_SPARE_BIAS_LSB) & SYNTH_SYNTH6_SPARE_BIAS_MASK) -#define SYNTH_SYNTH6_SPARE_BIAS_RESET 3'h0 -#define SYNTH_SYNTH6_RESET (32'h0 | \ - SYNTH_SYNTH6_IRCP_SET(SYNTH_SYNTH6_IRCP_RESET) | \ - SYNTH_SYNTH6_IRVCMON_SET(SYNTH_SYNTH6_IRVCMON_RESET) | \ - SYNTH_SYNTH6_IRSPARE_SET(SYNTH_SYNTH6_IRSPARE_RESET) | \ - SYNTH_SYNTH6_ICPRESC_SET(SYNTH_SYNTH6_ICPRESC_RESET) | \ - SYNTH_SYNTH6_ICLODIV_SET(SYNTH_SYNTH6_ICLODIV_RESET) | \ - SYNTH_SYNTH6_ICLOMIX_SET(SYNTH_SYNTH6_ICLOMIX_RESET) | \ - SYNTH_SYNTH6_ICSPAREA_SET(SYNTH_SYNTH6_ICSPAREA_RESET) | \ - SYNTH_SYNTH6_ICSPAREB_SET(SYNTH_SYNTH6_ICSPAREB_RESET) | \ - SYNTH_SYNTH6_ICVCO_SET(SYNTH_SYNTH6_ICVCO_RESET) | \ - SYNTH_SYNTH6_VCOBUFBIAS_SET(SYNTH_SYNTH6_VCOBUFBIAS_RESET) | \ - SYNTH_SYNTH6_SPARE_BIAS_SET(SYNTH_SYNTH6_SPARE_BIAS_RESET)) -#define SYNTH_SYNTH6_HW_MASK (32'h0) -#define SYNTH_SYNTH6_SW_MASK (32'h0 | \ - SYNTH_SYNTH6_IRCP_MASK | \ - SYNTH_SYNTH6_IRVCMON_MASK | \ - SYNTH_SYNTH6_IRSPARE_MASK | \ - SYNTH_SYNTH6_ICPRESC_MASK | \ - SYNTH_SYNTH6_ICLODIV_MASK | \ - SYNTH_SYNTH6_ICLOMIX_MASK | \ - SYNTH_SYNTH6_ICSPAREA_MASK | \ - SYNTH_SYNTH6_ICSPAREB_MASK | \ - SYNTH_SYNTH6_ICVCO_MASK | \ - SYNTH_SYNTH6_VCOBUFBIAS_MASK | \ - SYNTH_SYNTH6_SPARE_BIAS_MASK) - -#define SYNTH_SYNTH7_ADDRESS 'h00000018 -#define SYNTH_SYNTH7_SYNTH_ON_MSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_LSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_MASK 'h80000000 -#define SYNTH_SYNTH7_SYNTH_ON_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_ON_MASK) >> SYNTH_SYNTH7_SYNTH_ON_LSB) -#define SYNTH_SYNTH7_SYNTH_ON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SYNTH_ON_LSB) & SYNTH_SYNTH7_SYNTH_ON_MASK) -#define SYNTH_SYNTH7_SYNTH_ON_RESET 1'h0 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MSB 30 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_LSB 27 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MASK 'h78000000 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) >> SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_RESET 4'h0 -#define SYNTH_SYNTH7_CAP_SEARCH_MSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_LSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_MASK 'h04000000 -#define SYNTH_SYNTH7_CAP_SEARCH_GET(x) (((x) & SYNTH_SYNTH7_CAP_SEARCH_MASK) >> SYNTH_SYNTH7_CAP_SEARCH_LSB) -#define SYNTH_SYNTH7_CAP_SEARCH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_CAP_SEARCH_LSB) & SYNTH_SYNTH7_CAP_SEARCH_MASK) -#define SYNTH_SYNTH7_CAP_SEARCH_RESET 1'h0 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK 'h02000000 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) >> SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_RESET 1'h0 -#define SYNTH_SYNTH7_PIN_VC_MSB 24 -#define SYNTH_SYNTH7_PIN_VC_LSB 24 -#define SYNTH_SYNTH7_PIN_VC_MASK 'h01000000 -#define SYNTH_SYNTH7_PIN_VC_GET(x) (((x) & SYNTH_SYNTH7_PIN_VC_MASK) >> SYNTH_SYNTH7_PIN_VC_LSB) -#define SYNTH_SYNTH7_PIN_VC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_PIN_VC_LSB) & SYNTH_SYNTH7_PIN_VC_MASK) -#define SYNTH_SYNTH7_PIN_VC_RESET 1'h0 -#define SYNTH_SYNTH7_VCO_CAP_ST_MSB 23 -#define SYNTH_SYNTH7_VCO_CAP_ST_LSB 16 -#define SYNTH_SYNTH7_VCO_CAP_ST_MASK 'h00ff0000 -#define SYNTH_SYNTH7_VCO_CAP_ST_GET(x) (((x) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) >> SYNTH_SYNTH7_VCO_CAP_ST_LSB) -#define SYNTH_SYNTH7_VCO_CAP_ST_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_VCO_CAP_ST_LSB) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) -#define SYNTH_SYNTH7_VCO_CAP_ST_RESET 8'h0 -#define SYNTH_SYNTH7_SHORT_R_MSB 15 -#define SYNTH_SYNTH7_SHORT_R_LSB 15 -#define SYNTH_SYNTH7_SHORT_R_MASK 'h00008000 -#define SYNTH_SYNTH7_SHORT_R_GET(x) (((x) & SYNTH_SYNTH7_SHORT_R_MASK) >> SYNTH_SYNTH7_SHORT_R_LSB) -#define SYNTH_SYNTH7_SHORT_R_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SHORT_R_LSB) & SYNTH_SYNTH7_SHORT_R_MASK) -#define SYNTH_SYNTH7_SHORT_R_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_RFD_MSB 14 -#define SYNTH_SYNTH7_RESET_RFD_LSB 14 -#define SYNTH_SYNTH7_RESET_RFD_MASK 'h00004000 -#define SYNTH_SYNTH7_RESET_RFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_RFD_MASK) >> SYNTH_SYNTH7_RESET_RFD_LSB) -#define SYNTH_SYNTH7_RESET_RFD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_RFD_LSB) & SYNTH_SYNTH7_RESET_RFD_MASK) -#define SYNTH_SYNTH7_RESET_RFD_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_PFD_MSB 13 -#define SYNTH_SYNTH7_RESET_PFD_LSB 13 -#define SYNTH_SYNTH7_RESET_PFD_MASK 'h00002000 -#define SYNTH_SYNTH7_RESET_PFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_PFD_MASK) >> SYNTH_SYNTH7_RESET_PFD_LSB) -#define SYNTH_SYNTH7_RESET_PFD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_PFD_LSB) & SYNTH_SYNTH7_RESET_PFD_MASK) -#define SYNTH_SYNTH7_RESET_PFD_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK 'h00001000 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_GET(x) (((x) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) >> SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_SDM_B_MSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_LSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_MASK 'h00000800 -#define SYNTH_SYNTH7_RESET_SDM_B_GET(x) (((x) & SYNTH_SYNTH7_RESET_SDM_B_MASK) >> SYNTH_SYNTH7_RESET_SDM_B_LSB) -#define SYNTH_SYNTH7_RESET_SDM_B_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_SDM_B_LSB) & SYNTH_SYNTH7_RESET_SDM_B_MASK) -#define SYNTH_SYNTH7_RESET_SDM_B_RESET 1'h0 -#define SYNTH_SYNTH7_VC2HIGH_MSB 10 -#define SYNTH_SYNTH7_VC2HIGH_LSB 10 -#define SYNTH_SYNTH7_VC2HIGH_MASK 'h00000400 -#define SYNTH_SYNTH7_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH7_VC2HIGH_MASK) >> SYNTH_SYNTH7_VC2HIGH_LSB) -#define SYNTH_SYNTH7_VC2HIGH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_VC2HIGH_LSB) & SYNTH_SYNTH7_VC2HIGH_MASK) -#define SYNTH_SYNTH7_VC2HIGH_RESET 1'h0 -#define SYNTH_SYNTH7_VC2LOW_MSB 9 -#define SYNTH_SYNTH7_VC2LOW_LSB 9 -#define SYNTH_SYNTH7_VC2LOW_MASK 'h00000200 -#define SYNTH_SYNTH7_VC2LOW_GET(x) (((x) & SYNTH_SYNTH7_VC2LOW_MASK) >> SYNTH_SYNTH7_VC2LOW_LSB) -#define SYNTH_SYNTH7_VC2LOW_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_VC2LOW_LSB) & SYNTH_SYNTH7_VC2LOW_MASK) -#define SYNTH_SYNTH7_VC2LOW_RESET 1'h0 -#define SYNTH_SYNTH7_LOOP_IP_MSB 8 -#define SYNTH_SYNTH7_LOOP_IP_LSB 5 -#define SYNTH_SYNTH7_LOOP_IP_MASK 'h000001e0 -#define SYNTH_SYNTH7_LOOP_IP_GET(x) (((x) & SYNTH_SYNTH7_LOOP_IP_MASK) >> SYNTH_SYNTH7_LOOP_IP_LSB) -#define SYNTH_SYNTH7_LOOP_IP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_LOOP_IP_LSB) & SYNTH_SYNTH7_LOOP_IP_MASK) -#define SYNTH_SYNTH7_LOOP_IP_RESET 4'h0 -#define SYNTH_SYNTH7_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH7_LOBUF5GTUNE_LSB 3 -#define SYNTH_SYNTH7_LOBUF5GTUNE_MASK 'h00000018 -#define SYNTH_SYNTH7_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH7_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH7_LOBUF5GTUNE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_LOBUF5GTUNE_LSB) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH7_LOBUF5GTUNE_RESET 2'h0 -#define SYNTH_SYNTH7_SPARE_READ_MSB 2 -#define SYNTH_SYNTH7_SPARE_READ_LSB 0 -#define SYNTH_SYNTH7_SPARE_READ_MASK 'h00000007 -#define SYNTH_SYNTH7_SPARE_READ_GET(x) (((x) & SYNTH_SYNTH7_SPARE_READ_MASK) >> SYNTH_SYNTH7_SPARE_READ_LSB) -#define SYNTH_SYNTH7_SPARE_READ_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SPARE_READ_LSB) & SYNTH_SYNTH7_SPARE_READ_MASK) -#define SYNTH_SYNTH7_SPARE_READ_RESET 3'h0 -#define SYNTH_SYNTH7_RESET (32'h0 | \ - SYNTH_SYNTH7_SYNTH_ON_SET(SYNTH_SYNTH7_SYNTH_ON_RESET) | \ - SYNTH_SYNTH7_SYNTH_SM_STATE_SET(SYNTH_SYNTH7_SYNTH_SM_STATE_RESET) | \ - SYNTH_SYNTH7_CAP_SEARCH_SET(SYNTH_SYNTH7_CAP_SEARCH_RESET) | \ - SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_SET(SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_RESET) | \ - SYNTH_SYNTH7_PIN_VC_SET(SYNTH_SYNTH7_PIN_VC_RESET) | \ - SYNTH_SYNTH7_VCO_CAP_ST_SET(SYNTH_SYNTH7_VCO_CAP_ST_RESET) | \ - SYNTH_SYNTH7_SHORT_R_SET(SYNTH_SYNTH7_SHORT_R_RESET) | \ - SYNTH_SYNTH7_RESET_RFD_SET(SYNTH_SYNTH7_RESET_RFD_RESET) | \ - SYNTH_SYNTH7_RESET_PFD_SET(SYNTH_SYNTH7_RESET_PFD_RESET) | \ - SYNTH_SYNTH7_RESET_PSCOUNTERS_SET(SYNTH_SYNTH7_RESET_PSCOUNTERS_RESET) | \ - SYNTH_SYNTH7_RESET_SDM_B_SET(SYNTH_SYNTH7_RESET_SDM_B_RESET) | \ - SYNTH_SYNTH7_VC2HIGH_SET(SYNTH_SYNTH7_VC2HIGH_RESET) | \ - SYNTH_SYNTH7_VC2LOW_SET(SYNTH_SYNTH7_VC2LOW_RESET) | \ - SYNTH_SYNTH7_LOOP_IP_SET(SYNTH_SYNTH7_LOOP_IP_RESET) | \ - SYNTH_SYNTH7_LOBUF5GTUNE_SET(SYNTH_SYNTH7_LOBUF5GTUNE_RESET) | \ - SYNTH_SYNTH7_SPARE_READ_SET(SYNTH_SYNTH7_SPARE_READ_RESET)) -#define SYNTH_SYNTH7_HW_MASK (32'h0 | \ - SYNTH_SYNTH7_SYNTH_ON_MASK | \ - SYNTH_SYNTH7_SYNTH_SM_STATE_MASK | \ - SYNTH_SYNTH7_CAP_SEARCH_MASK | \ - SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK | \ - SYNTH_SYNTH7_PIN_VC_MASK | \ - SYNTH_SYNTH7_VCO_CAP_ST_MASK | \ - SYNTH_SYNTH7_SHORT_R_MASK | \ - SYNTH_SYNTH7_RESET_RFD_MASK | \ - SYNTH_SYNTH7_RESET_PFD_MASK | \ - SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK | \ - SYNTH_SYNTH7_RESET_SDM_B_MASK | \ - SYNTH_SYNTH7_VC2HIGH_MASK | \ - SYNTH_SYNTH7_VC2LOW_MASK | \ - SYNTH_SYNTH7_LOOP_IP_MASK | \ - SYNTH_SYNTH7_LOBUF5GTUNE_MASK | \ - SYNTH_SYNTH7_SPARE_READ_MASK) -#define SYNTH_SYNTH7_SW_MASK (32'h0) - -#define SYNTH_SYNTH8_ADDRESS 'h0000001c -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK 'h80000000 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_GET(x) (((x) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) >> SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_RESET 1'h0 -#define SYNTH_SYNTH8_FRACMODE_MSB 30 -#define SYNTH_SYNTH8_FRACMODE_LSB 30 -#define SYNTH_SYNTH8_FRACMODE_MASK 'h40000000 -#define SYNTH_SYNTH8_FRACMODE_GET(x) (((x) & SYNTH_SYNTH8_FRACMODE_MASK) >> SYNTH_SYNTH8_FRACMODE_LSB) -#define SYNTH_SYNTH8_FRACMODE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_FRACMODE_LSB) & SYNTH_SYNTH8_FRACMODE_MASK) -#define SYNTH_SYNTH8_FRACMODE_RESET 1'h0 -#define SYNTH_SYNTH8_AMODEREFSEL_MSB 29 -#define SYNTH_SYNTH8_AMODEREFSEL_LSB 28 -#define SYNTH_SYNTH8_AMODEREFSEL_MASK 'h30000000 -#define SYNTH_SYNTH8_AMODEREFSEL_GET(x) (((x) & SYNTH_SYNTH8_AMODEREFSEL_MASK) >> SYNTH_SYNTH8_AMODEREFSEL_LSB) -#define SYNTH_SYNTH8_AMODEREFSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_AMODEREFSEL_LSB) & SYNTH_SYNTH8_AMODEREFSEL_MASK) -#define SYNTH_SYNTH8_AMODEREFSEL_RESET 2'h0 -#define SYNTH_SYNTH8_SPARE_MSB 27 -#define SYNTH_SYNTH8_SPARE_LSB 27 -#define SYNTH_SYNTH8_SPARE_MASK 'h08000000 -#define SYNTH_SYNTH8_SPARE_GET(x) (((x) & SYNTH_SYNTH8_SPARE_MASK) >> SYNTH_SYNTH8_SPARE_LSB) -#define SYNTH_SYNTH8_SPARE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_SPARE_LSB) & SYNTH_SYNTH8_SPARE_MASK) -#define SYNTH_SYNTH8_SPARE_RESET 1'h0 -#define SYNTH_SYNTH8_CHANSEL_MSB 26 -#define SYNTH_SYNTH8_CHANSEL_LSB 18 -#define SYNTH_SYNTH8_CHANSEL_MASK 'h07fc0000 -#define SYNTH_SYNTH8_CHANSEL_GET(x) (((x) & SYNTH_SYNTH8_CHANSEL_MASK) >> SYNTH_SYNTH8_CHANSEL_LSB) -#define SYNTH_SYNTH8_CHANSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_CHANSEL_LSB) & SYNTH_SYNTH8_CHANSEL_MASK) -#define SYNTH_SYNTH8_CHANSEL_RESET 9'h0 -#define SYNTH_SYNTH8_CHANFRAC_MSB 17 -#define SYNTH_SYNTH8_CHANFRAC_LSB 1 -#define SYNTH_SYNTH8_CHANFRAC_MASK 'h0003fffe -#define SYNTH_SYNTH8_CHANFRAC_GET(x) (((x) & SYNTH_SYNTH8_CHANFRAC_MASK) >> SYNTH_SYNTH8_CHANFRAC_LSB) -#define SYNTH_SYNTH8_CHANFRAC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_CHANFRAC_LSB) & SYNTH_SYNTH8_CHANFRAC_MASK) -#define SYNTH_SYNTH8_CHANFRAC_RESET 17'h0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_MSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_LSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_MASK 'h00000001 -#define SYNTH_SYNTH8_FORCE_FRACLSB_GET(x) (((x) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) >> SYNTH_SYNTH8_FORCE_FRACLSB_LSB) -#define SYNTH_SYNTH8_FORCE_FRACLSB_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_FORCE_FRACLSB_LSB) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) -#define SYNTH_SYNTH8_FORCE_FRACLSB_RESET 1'h0 -#define SYNTH_SYNTH8_RESET (32'h0 | \ - SYNTH_SYNTH8_LOADSYNTHCHANNEL_SET(SYNTH_SYNTH8_LOADSYNTHCHANNEL_RESET) | \ - SYNTH_SYNTH8_FRACMODE_SET(SYNTH_SYNTH8_FRACMODE_RESET) | \ - SYNTH_SYNTH8_AMODEREFSEL_SET(SYNTH_SYNTH8_AMODEREFSEL_RESET) | \ - SYNTH_SYNTH8_SPARE_SET(SYNTH_SYNTH8_SPARE_RESET) | \ - SYNTH_SYNTH8_CHANSEL_SET(SYNTH_SYNTH8_CHANSEL_RESET) | \ - SYNTH_SYNTH8_CHANFRAC_SET(SYNTH_SYNTH8_CHANFRAC_RESET) | \ - SYNTH_SYNTH8_FORCE_FRACLSB_SET(SYNTH_SYNTH8_FORCE_FRACLSB_RESET)) -#define SYNTH_SYNTH8_HW_MASK (32'h0 | \ - SYNTH_SYNTH8_FRACMODE_MASK | \ - SYNTH_SYNTH8_AMODEREFSEL_MASK | \ - SYNTH_SYNTH8_SPARE_MASK | \ - SYNTH_SYNTH8_CHANSEL_MASK | \ - SYNTH_SYNTH8_CHANFRAC_MASK) -#define SYNTH_SYNTH8_SW_MASK (32'h0 | \ - SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK | \ - SYNTH_SYNTH8_FRACMODE_MASK | \ - SYNTH_SYNTH8_AMODEREFSEL_MASK | \ - SYNTH_SYNTH8_SPARE_MASK | \ - SYNTH_SYNTH8_CHANSEL_MASK | \ - SYNTH_SYNTH8_CHANFRAC_MASK | \ - SYNTH_SYNTH8_FORCE_FRACLSB_MASK) - -#define SYNTH_REG_ADDRESS_MSB 4 - -#endif /* _SYNTH_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/top_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/top_reg.h deleted file mode 100644 index 14ed9bfdcb6d..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/top_reg.h +++ /dev/null @@ -1,235 +0,0 @@ -#ifndef _TOP_REG_REG_H_ -#define _TOP_REG_REG_H_ - -#define TOP_GAIN_ADDRESS 0x00000000 -#define TOP_GAIN_OFFSET 0x00000000 -#define TOP_GAIN_TX6DBLOQGAIN_MSB 31 -#define TOP_GAIN_TX6DBLOQGAIN_LSB 30 -#define TOP_GAIN_TX6DBLOQGAIN_MASK 0xc0000000 -#define TOP_GAIN_TX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX6DBLOQGAIN_MASK) >> TOP_GAIN_TX6DBLOQGAIN_LSB) -#define TOP_GAIN_TX6DBLOQGAIN_SET(x) (((x) << TOP_GAIN_TX6DBLOQGAIN_LSB) & TOP_GAIN_TX6DBLOQGAIN_MASK) -#define TOP_GAIN_TX1DBLOQGAIN_MSB 29 -#define TOP_GAIN_TX1DBLOQGAIN_LSB 27 -#define TOP_GAIN_TX1DBLOQGAIN_MASK 0x38000000 -#define TOP_GAIN_TX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX1DBLOQGAIN_MASK) >> TOP_GAIN_TX1DBLOQGAIN_LSB) -#define TOP_GAIN_TX1DBLOQGAIN_SET(x) (((x) << TOP_GAIN_TX1DBLOQGAIN_LSB) & TOP_GAIN_TX1DBLOQGAIN_MASK) -#define TOP_GAIN_TXV2IGAIN_MSB 26 -#define TOP_GAIN_TXV2IGAIN_LSB 25 -#define TOP_GAIN_TXV2IGAIN_MASK 0x06000000 -#define TOP_GAIN_TXV2IGAIN_GET(x) (((x) & TOP_GAIN_TXV2IGAIN_MASK) >> TOP_GAIN_TXV2IGAIN_LSB) -#define TOP_GAIN_TXV2IGAIN_SET(x) (((x) << TOP_GAIN_TXV2IGAIN_LSB) & TOP_GAIN_TXV2IGAIN_MASK) -#define TOP_GAIN_PABUF5GN_MSB 24 -#define TOP_GAIN_PABUF5GN_LSB 24 -#define TOP_GAIN_PABUF5GN_MASK 0x01000000 -#define TOP_GAIN_PABUF5GN_GET(x) (((x) & TOP_GAIN_PABUF5GN_MASK) >> TOP_GAIN_PABUF5GN_LSB) -#define TOP_GAIN_PABUF5GN_SET(x) (((x) << TOP_GAIN_PABUF5GN_LSB) & TOP_GAIN_PABUF5GN_MASK) -#define TOP_GAIN_PADRVGN_MSB 23 -#define TOP_GAIN_PADRVGN_LSB 21 -#define TOP_GAIN_PADRVGN_MASK 0x00e00000 -#define TOP_GAIN_PADRVGN_GET(x) (((x) & TOP_GAIN_PADRVGN_MASK) >> TOP_GAIN_PADRVGN_LSB) -#define TOP_GAIN_PADRVGN_SET(x) (((x) << TOP_GAIN_PADRVGN_LSB) & TOP_GAIN_PADRVGN_MASK) -#define TOP_GAIN_PAOUT2GN_MSB 20 -#define TOP_GAIN_PAOUT2GN_LSB 18 -#define TOP_GAIN_PAOUT2GN_MASK 0x001c0000 -#define TOP_GAIN_PAOUT2GN_GET(x) (((x) & TOP_GAIN_PAOUT2GN_MASK) >> TOP_GAIN_PAOUT2GN_LSB) -#define TOP_GAIN_PAOUT2GN_SET(x) (((x) << TOP_GAIN_PAOUT2GN_LSB) & TOP_GAIN_PAOUT2GN_MASK) -#define TOP_GAIN_LNAON_MSB 17 -#define TOP_GAIN_LNAON_LSB 17 -#define TOP_GAIN_LNAON_MASK 0x00020000 -#define TOP_GAIN_LNAON_GET(x) (((x) & TOP_GAIN_LNAON_MASK) >> TOP_GAIN_LNAON_LSB) -#define TOP_GAIN_LNAON_SET(x) (((x) << TOP_GAIN_LNAON_LSB) & TOP_GAIN_LNAON_MASK) -#define TOP_GAIN_LNAGAIN_MSB 16 -#define TOP_GAIN_LNAGAIN_LSB 13 -#define TOP_GAIN_LNAGAIN_MASK 0x0001e000 -#define TOP_GAIN_LNAGAIN_GET(x) (((x) & TOP_GAIN_LNAGAIN_MASK) >> TOP_GAIN_LNAGAIN_LSB) -#define TOP_GAIN_LNAGAIN_SET(x) (((x) << TOP_GAIN_LNAGAIN_LSB) & TOP_GAIN_LNAGAIN_MASK) -#define TOP_GAIN_RFVGA5GAIN_MSB 12 -#define TOP_GAIN_RFVGA5GAIN_LSB 11 -#define TOP_GAIN_RFVGA5GAIN_MASK 0x00001800 -#define TOP_GAIN_RFVGA5GAIN_GET(x) (((x) & TOP_GAIN_RFVGA5GAIN_MASK) >> TOP_GAIN_RFVGA5GAIN_LSB) -#define TOP_GAIN_RFVGA5GAIN_SET(x) (((x) << TOP_GAIN_RFVGA5GAIN_LSB) & TOP_GAIN_RFVGA5GAIN_MASK) -#define TOP_GAIN_RFGMGN_MSB 10 -#define TOP_GAIN_RFGMGN_LSB 8 -#define TOP_GAIN_RFGMGN_MASK 0x00000700 -#define TOP_GAIN_RFGMGN_GET(x) (((x) & TOP_GAIN_RFGMGN_MASK) >> TOP_GAIN_RFGMGN_LSB) -#define TOP_GAIN_RFGMGN_SET(x) (((x) << TOP_GAIN_RFGMGN_LSB) & TOP_GAIN_RFGMGN_MASK) -#define TOP_GAIN_RX6DBLOQGAIN_MSB 7 -#define TOP_GAIN_RX6DBLOQGAIN_LSB 6 -#define TOP_GAIN_RX6DBLOQGAIN_MASK 0x000000c0 -#define TOP_GAIN_RX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBLOQGAIN_MASK) >> TOP_GAIN_RX6DBLOQGAIN_LSB) -#define TOP_GAIN_RX6DBLOQGAIN_SET(x) (((x) << TOP_GAIN_RX6DBLOQGAIN_LSB) & TOP_GAIN_RX6DBLOQGAIN_MASK) -#define TOP_GAIN_RX1DBLOQGAIN_MSB 5 -#define TOP_GAIN_RX1DBLOQGAIN_LSB 3 -#define TOP_GAIN_RX1DBLOQGAIN_MASK 0x00000038 -#define TOP_GAIN_RX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX1DBLOQGAIN_MASK) >> TOP_GAIN_RX1DBLOQGAIN_LSB) -#define TOP_GAIN_RX1DBLOQGAIN_SET(x) (((x) << TOP_GAIN_RX1DBLOQGAIN_LSB) & TOP_GAIN_RX1DBLOQGAIN_MASK) -#define TOP_GAIN_RX6DBHIQGAIN_MSB 2 -#define TOP_GAIN_RX6DBHIQGAIN_LSB 1 -#define TOP_GAIN_RX6DBHIQGAIN_MASK 0x00000006 -#define TOP_GAIN_RX6DBHIQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBHIQGAIN_MASK) >> TOP_GAIN_RX6DBHIQGAIN_LSB) -#define TOP_GAIN_RX6DBHIQGAIN_SET(x) (((x) << TOP_GAIN_RX6DBHIQGAIN_LSB) & TOP_GAIN_RX6DBHIQGAIN_MASK) -#define TOP_GAIN_SPARE_MSB 0 -#define TOP_GAIN_SPARE_LSB 0 -#define TOP_GAIN_SPARE_MASK 0x00000001 -#define TOP_GAIN_SPARE_GET(x) (((x) & TOP_GAIN_SPARE_MASK) >> TOP_GAIN_SPARE_LSB) -#define TOP_GAIN_SPARE_SET(x) (((x) << TOP_GAIN_SPARE_LSB) & TOP_GAIN_SPARE_MASK) - -#define TOP_TOP_ADDRESS 0x00000004 -#define TOP_TOP_OFFSET 0x00000004 -#define TOP_TOP_LOCALTXGAIN_MSB 31 -#define TOP_TOP_LOCALTXGAIN_LSB 31 -#define TOP_TOP_LOCALTXGAIN_MASK 0x80000000 -#define TOP_TOP_LOCALTXGAIN_GET(x) (((x) & TOP_TOP_LOCALTXGAIN_MASK) >> TOP_TOP_LOCALTXGAIN_LSB) -#define TOP_TOP_LOCALTXGAIN_SET(x) (((x) << TOP_TOP_LOCALTXGAIN_LSB) & TOP_TOP_LOCALTXGAIN_MASK) -#define TOP_TOP_LOCALRXGAIN_MSB 30 -#define TOP_TOP_LOCALRXGAIN_LSB 30 -#define TOP_TOP_LOCALRXGAIN_MASK 0x40000000 -#define TOP_TOP_LOCALRXGAIN_GET(x) (((x) & TOP_TOP_LOCALRXGAIN_MASK) >> TOP_TOP_LOCALRXGAIN_LSB) -#define TOP_TOP_LOCALRXGAIN_SET(x) (((x) << TOP_TOP_LOCALRXGAIN_LSB) & TOP_TOP_LOCALRXGAIN_MASK) -#define TOP_TOP_LOCALMODE_MSB 29 -#define TOP_TOP_LOCALMODE_LSB 29 -#define TOP_TOP_LOCALMODE_MASK 0x20000000 -#define TOP_TOP_LOCALMODE_GET(x) (((x) & TOP_TOP_LOCALMODE_MASK) >> TOP_TOP_LOCALMODE_LSB) -#define TOP_TOP_LOCALMODE_SET(x) (((x) << TOP_TOP_LOCALMODE_LSB) & TOP_TOP_LOCALMODE_MASK) -#define TOP_TOP_CALFC_MSB 28 -#define TOP_TOP_CALFC_LSB 28 -#define TOP_TOP_CALFC_MASK 0x10000000 -#define TOP_TOP_CALFC_GET(x) (((x) & TOP_TOP_CALFC_MASK) >> TOP_TOP_CALFC_LSB) -#define TOP_TOP_CALFC_SET(x) (((x) << TOP_TOP_CALFC_LSB) & TOP_TOP_CALFC_MASK) -#define TOP_TOP_CALDC_MSB 27 -#define TOP_TOP_CALDC_LSB 27 -#define TOP_TOP_CALDC_MASK 0x08000000 -#define TOP_TOP_CALDC_GET(x) (((x) & TOP_TOP_CALDC_MASK) >> TOP_TOP_CALDC_LSB) -#define TOP_TOP_CALDC_SET(x) (((x) << TOP_TOP_CALDC_LSB) & TOP_TOP_CALDC_MASK) -#define TOP_TOP_CAL_RESIDUE_MSB 26 -#define TOP_TOP_CAL_RESIDUE_LSB 26 -#define TOP_TOP_CAL_RESIDUE_MASK 0x04000000 -#define TOP_TOP_CAL_RESIDUE_GET(x) (((x) & TOP_TOP_CAL_RESIDUE_MASK) >> TOP_TOP_CAL_RESIDUE_LSB) -#define TOP_TOP_CAL_RESIDUE_SET(x) (((x) << TOP_TOP_CAL_RESIDUE_LSB) & TOP_TOP_CAL_RESIDUE_MASK) -#define TOP_TOP_BMODE_MSB 25 -#define TOP_TOP_BMODE_LSB 25 -#define TOP_TOP_BMODE_MASK 0x02000000 -#define TOP_TOP_BMODE_GET(x) (((x) & TOP_TOP_BMODE_MASK) >> TOP_TOP_BMODE_LSB) -#define TOP_TOP_BMODE_SET(x) (((x) << TOP_TOP_BMODE_LSB) & TOP_TOP_BMODE_MASK) -#define TOP_TOP_SYNTHON_MSB 24 -#define TOP_TOP_SYNTHON_LSB 24 -#define TOP_TOP_SYNTHON_MASK 0x01000000 -#define TOP_TOP_SYNTHON_GET(x) (((x) & TOP_TOP_SYNTHON_MASK) >> TOP_TOP_SYNTHON_LSB) -#define TOP_TOP_SYNTHON_SET(x) (((x) << TOP_TOP_SYNTHON_LSB) & TOP_TOP_SYNTHON_MASK) -#define TOP_TOP_RXON_MSB 23 -#define TOP_TOP_RXON_LSB 23 -#define TOP_TOP_RXON_MASK 0x00800000 -#define TOP_TOP_RXON_GET(x) (((x) & TOP_TOP_RXON_MASK) >> TOP_TOP_RXON_LSB) -#define TOP_TOP_RXON_SET(x) (((x) << TOP_TOP_RXON_LSB) & TOP_TOP_RXON_MASK) -#define TOP_TOP_TXON_MSB 22 -#define TOP_TOP_TXON_LSB 22 -#define TOP_TOP_TXON_MASK 0x00400000 -#define TOP_TOP_TXON_GET(x) (((x) & TOP_TOP_TXON_MASK) >> TOP_TOP_TXON_LSB) -#define TOP_TOP_TXON_SET(x) (((x) << TOP_TOP_TXON_LSB) & TOP_TOP_TXON_MASK) -#define TOP_TOP_PAON_MSB 21 -#define TOP_TOP_PAON_LSB 21 -#define TOP_TOP_PAON_MASK 0x00200000 -#define TOP_TOP_PAON_GET(x) (((x) & TOP_TOP_PAON_MASK) >> TOP_TOP_PAON_LSB) -#define TOP_TOP_PAON_SET(x) (((x) << TOP_TOP_PAON_LSB) & TOP_TOP_PAON_MASK) -#define TOP_TOP_CALTX_MSB 20 -#define TOP_TOP_CALTX_LSB 20 -#define TOP_TOP_CALTX_MASK 0x00100000 -#define TOP_TOP_CALTX_GET(x) (((x) & TOP_TOP_CALTX_MASK) >> TOP_TOP_CALTX_LSB) -#define TOP_TOP_CALTX_SET(x) (((x) << TOP_TOP_CALTX_LSB) & TOP_TOP_CALTX_MASK) -#define TOP_TOP_LOCALADDAC_MSB 19 -#define TOP_TOP_LOCALADDAC_LSB 19 -#define TOP_TOP_LOCALADDAC_MASK 0x00080000 -#define TOP_TOP_LOCALADDAC_GET(x) (((x) & TOP_TOP_LOCALADDAC_MASK) >> TOP_TOP_LOCALADDAC_LSB) -#define TOP_TOP_LOCALADDAC_SET(x) (((x) << TOP_TOP_LOCALADDAC_LSB) & TOP_TOP_LOCALADDAC_MASK) -#define TOP_TOP_PWDPLL_MSB 18 -#define TOP_TOP_PWDPLL_LSB 18 -#define TOP_TOP_PWDPLL_MASK 0x00040000 -#define TOP_TOP_PWDPLL_GET(x) (((x) & TOP_TOP_PWDPLL_MASK) >> TOP_TOP_PWDPLL_LSB) -#define TOP_TOP_PWDPLL_SET(x) (((x) << TOP_TOP_PWDPLL_LSB) & TOP_TOP_PWDPLL_MASK) -#define TOP_TOP_PWDADC_MSB 17 -#define TOP_TOP_PWDADC_LSB 17 -#define TOP_TOP_PWDADC_MASK 0x00020000 -#define TOP_TOP_PWDADC_GET(x) (((x) & TOP_TOP_PWDADC_MASK) >> TOP_TOP_PWDADC_LSB) -#define TOP_TOP_PWDADC_SET(x) (((x) << TOP_TOP_PWDADC_LSB) & TOP_TOP_PWDADC_MASK) -#define TOP_TOP_PWDDAC_MSB 16 -#define TOP_TOP_PWDDAC_LSB 16 -#define TOP_TOP_PWDDAC_MASK 0x00010000 -#define TOP_TOP_PWDDAC_GET(x) (((x) & TOP_TOP_PWDDAC_MASK) >> TOP_TOP_PWDDAC_LSB) -#define TOP_TOP_PWDDAC_SET(x) (((x) << TOP_TOP_PWDDAC_LSB) & TOP_TOP_PWDDAC_MASK) -#define TOP_TOP_LOCALXTAL_MSB 15 -#define TOP_TOP_LOCALXTAL_LSB 15 -#define TOP_TOP_LOCALXTAL_MASK 0x00008000 -#define TOP_TOP_LOCALXTAL_GET(x) (((x) & TOP_TOP_LOCALXTAL_MASK) >> TOP_TOP_LOCALXTAL_LSB) -#define TOP_TOP_LOCALXTAL_SET(x) (((x) << TOP_TOP_LOCALXTAL_LSB) & TOP_TOP_LOCALXTAL_MASK) -#define TOP_TOP_PWDCLKIN_MSB 14 -#define TOP_TOP_PWDCLKIN_LSB 14 -#define TOP_TOP_PWDCLKIN_MASK 0x00004000 -#define TOP_TOP_PWDCLKIN_GET(x) (((x) & TOP_TOP_PWDCLKIN_MASK) >> TOP_TOP_PWDCLKIN_LSB) -#define TOP_TOP_PWDCLKIN_SET(x) (((x) << TOP_TOP_PWDCLKIN_LSB) & TOP_TOP_PWDCLKIN_MASK) -#define TOP_TOP_OSCON_MSB 13 -#define TOP_TOP_OSCON_LSB 13 -#define TOP_TOP_OSCON_MASK 0x00002000 -#define TOP_TOP_OSCON_GET(x) (((x) & TOP_TOP_OSCON_MASK) >> TOP_TOP_OSCON_LSB) -#define TOP_TOP_OSCON_SET(x) (((x) << TOP_TOP_OSCON_LSB) & TOP_TOP_OSCON_MASK) -#define TOP_TOP_SCLKEN_FORCE_MSB 12 -#define TOP_TOP_SCLKEN_FORCE_LSB 12 -#define TOP_TOP_SCLKEN_FORCE_MASK 0x00001000 -#define TOP_TOP_SCLKEN_FORCE_GET(x) (((x) & TOP_TOP_SCLKEN_FORCE_MASK) >> TOP_TOP_SCLKEN_FORCE_LSB) -#define TOP_TOP_SCLKEN_FORCE_SET(x) (((x) << TOP_TOP_SCLKEN_FORCE_LSB) & TOP_TOP_SCLKEN_FORCE_MASK) -#define TOP_TOP_SYNTHON_FORCE_MSB 11 -#define TOP_TOP_SYNTHON_FORCE_LSB 11 -#define TOP_TOP_SYNTHON_FORCE_MASK 0x00000800 -#define TOP_TOP_SYNTHON_FORCE_GET(x) (((x) & TOP_TOP_SYNTHON_FORCE_MASK) >> TOP_TOP_SYNTHON_FORCE_LSB) -#define TOP_TOP_SYNTHON_FORCE_SET(x) (((x) << TOP_TOP_SYNTHON_FORCE_LSB) & TOP_TOP_SYNTHON_FORCE_MASK) -#define TOP_TOP_PDBIAS_MSB 10 -#define TOP_TOP_PDBIAS_LSB 10 -#define TOP_TOP_PDBIAS_MASK 0x00000400 -#define TOP_TOP_PDBIAS_GET(x) (((x) & TOP_TOP_PDBIAS_MASK) >> TOP_TOP_PDBIAS_LSB) -#define TOP_TOP_PDBIAS_SET(x) (((x) << TOP_TOP_PDBIAS_LSB) & TOP_TOP_PDBIAS_MASK) -#define TOP_TOP_DATAOUTSEL_MSB 9 -#define TOP_TOP_DATAOUTSEL_LSB 8 -#define TOP_TOP_DATAOUTSEL_MASK 0x00000300 -#define TOP_TOP_DATAOUTSEL_GET(x) (((x) & TOP_TOP_DATAOUTSEL_MASK) >> TOP_TOP_DATAOUTSEL_LSB) -#define TOP_TOP_DATAOUTSEL_SET(x) (((x) << TOP_TOP_DATAOUTSEL_LSB) & TOP_TOP_DATAOUTSEL_MASK) -#define TOP_TOP_REVID_MSB 7 -#define TOP_TOP_REVID_LSB 5 -#define TOP_TOP_REVID_MASK 0x000000e0 -#define TOP_TOP_REVID_GET(x) (((x) & TOP_TOP_REVID_MASK) >> TOP_TOP_REVID_LSB) -#define TOP_TOP_REVID_SET(x) (((x) << TOP_TOP_REVID_LSB) & TOP_TOP_REVID_MASK) -#define TOP_TOP_INT2PAD_MSB 4 -#define TOP_TOP_INT2PAD_LSB 4 -#define TOP_TOP_INT2PAD_MASK 0x00000010 -#define TOP_TOP_INT2PAD_GET(x) (((x) & TOP_TOP_INT2PAD_MASK) >> TOP_TOP_INT2PAD_LSB) -#define TOP_TOP_INT2PAD_SET(x) (((x) << TOP_TOP_INT2PAD_LSB) & TOP_TOP_INT2PAD_MASK) -#define TOP_TOP_INTH2PAD_MSB 3 -#define TOP_TOP_INTH2PAD_LSB 3 -#define TOP_TOP_INTH2PAD_MASK 0x00000008 -#define TOP_TOP_INTH2PAD_GET(x) (((x) & TOP_TOP_INTH2PAD_MASK) >> TOP_TOP_INTH2PAD_LSB) -#define TOP_TOP_INTH2PAD_SET(x) (((x) << TOP_TOP_INTH2PAD_LSB) & TOP_TOP_INTH2PAD_MASK) -#define TOP_TOP_PAD2GND_MSB 2 -#define TOP_TOP_PAD2GND_LSB 2 -#define TOP_TOP_PAD2GND_MASK 0x00000004 -#define TOP_TOP_PAD2GND_GET(x) (((x) & TOP_TOP_PAD2GND_MASK) >> TOP_TOP_PAD2GND_LSB) -#define TOP_TOP_PAD2GND_SET(x) (((x) << TOP_TOP_PAD2GND_LSB) & TOP_TOP_PAD2GND_MASK) -#define TOP_TOP_INT2GND_MSB 1 -#define TOP_TOP_INT2GND_LSB 1 -#define TOP_TOP_INT2GND_MASK 0x00000002 -#define TOP_TOP_INT2GND_GET(x) (((x) & TOP_TOP_INT2GND_MASK) >> TOP_TOP_INT2GND_LSB) -#define TOP_TOP_INT2GND_SET(x) (((x) << TOP_TOP_INT2GND_LSB) & TOP_TOP_INT2GND_MASK) -#define TOP_TOP_FORCE_XPAON_MSB 0 -#define TOP_TOP_FORCE_XPAON_LSB 0 -#define TOP_TOP_FORCE_XPAON_MASK 0x00000001 -#define TOP_TOP_FORCE_XPAON_GET(x) (((x) & TOP_TOP_FORCE_XPAON_MASK) >> TOP_TOP_FORCE_XPAON_LSB) -#define TOP_TOP_FORCE_XPAON_SET(x) (((x) << TOP_TOP_FORCE_XPAON_LSB) & TOP_TOP_FORCE_XPAON_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct top_reg_reg_s { - volatile unsigned int top_gain; - volatile unsigned int top_top; -} top_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _TOP_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/top_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/top_reg.vrh deleted file mode 100644 index 8641cc058ea1..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/top_reg.vrh +++ /dev/null @@ -1,388 +0,0 @@ -#ifndef _TOP_REG_VRH_ -#define _TOP_REG_VRH_ - -#define TOP_GAIN_ADDRESS 'h00000000 -#define TOP_GAIN_TX6DBLOQGAIN_MSB 31 -#define TOP_GAIN_TX6DBLOQGAIN_LSB 30 -#define TOP_GAIN_TX6DBLOQGAIN_MASK 'hc0000000 -#define TOP_GAIN_TX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX6DBLOQGAIN_MASK) >> TOP_GAIN_TX6DBLOQGAIN_LSB) -#define TOP_GAIN_TX6DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_TX6DBLOQGAIN_LSB) & TOP_GAIN_TX6DBLOQGAIN_MASK) -#define TOP_GAIN_TX6DBLOQGAIN_RESET 2'h3 -#define TOP_GAIN_TX1DBLOQGAIN_MSB 29 -#define TOP_GAIN_TX1DBLOQGAIN_LSB 27 -#define TOP_GAIN_TX1DBLOQGAIN_MASK 'h38000000 -#define TOP_GAIN_TX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX1DBLOQGAIN_MASK) >> TOP_GAIN_TX1DBLOQGAIN_LSB) -#define TOP_GAIN_TX1DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_TX1DBLOQGAIN_LSB) & TOP_GAIN_TX1DBLOQGAIN_MASK) -#define TOP_GAIN_TX1DBLOQGAIN_RESET 3'h6 -#define TOP_GAIN_TXV2IGAIN_MSB 26 -#define TOP_GAIN_TXV2IGAIN_LSB 25 -#define TOP_GAIN_TXV2IGAIN_MASK 'h06000000 -#define TOP_GAIN_TXV2IGAIN_GET(x) (((x) & TOP_GAIN_TXV2IGAIN_MASK) >> TOP_GAIN_TXV2IGAIN_LSB) -#define TOP_GAIN_TXV2IGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_TXV2IGAIN_LSB) & TOP_GAIN_TXV2IGAIN_MASK) -#define TOP_GAIN_TXV2IGAIN_RESET 2'h3 -#define TOP_GAIN_PABUF5GN_MSB 24 -#define TOP_GAIN_PABUF5GN_LSB 24 -#define TOP_GAIN_PABUF5GN_MASK 'h01000000 -#define TOP_GAIN_PABUF5GN_GET(x) (((x) & TOP_GAIN_PABUF5GN_MASK) >> TOP_GAIN_PABUF5GN_LSB) -#define TOP_GAIN_PABUF5GN_SET(x) (((32'd0 | (x)) << TOP_GAIN_PABUF5GN_LSB) & TOP_GAIN_PABUF5GN_MASK) -#define TOP_GAIN_PABUF5GN_RESET 1'h1 -#define TOP_GAIN_PADRVGN_MSB 23 -#define TOP_GAIN_PADRVGN_LSB 21 -#define TOP_GAIN_PADRVGN_MASK 'h00e00000 -#define TOP_GAIN_PADRVGN_GET(x) (((x) & TOP_GAIN_PADRVGN_MASK) >> TOP_GAIN_PADRVGN_LSB) -#define TOP_GAIN_PADRVGN_SET(x) (((32'd0 | (x)) << TOP_GAIN_PADRVGN_LSB) & TOP_GAIN_PADRVGN_MASK) -#define TOP_GAIN_PADRVGN_RESET 3'h7 -#define TOP_GAIN_PAOUT2GN_MSB 20 -#define TOP_GAIN_PAOUT2GN_LSB 18 -#define TOP_GAIN_PAOUT2GN_MASK 'h001c0000 -#define TOP_GAIN_PAOUT2GN_GET(x) (((x) & TOP_GAIN_PAOUT2GN_MASK) >> TOP_GAIN_PAOUT2GN_LSB) -#define TOP_GAIN_PAOUT2GN_SET(x) (((32'd0 | (x)) << TOP_GAIN_PAOUT2GN_LSB) & TOP_GAIN_PAOUT2GN_MASK) -#define TOP_GAIN_PAOUT2GN_RESET 3'h7 -#define TOP_GAIN_LNAON_MSB 17 -#define TOP_GAIN_LNAON_LSB 17 -#define TOP_GAIN_LNAON_MASK 'h00020000 -#define TOP_GAIN_LNAON_GET(x) (((x) & TOP_GAIN_LNAON_MASK) >> TOP_GAIN_LNAON_LSB) -#define TOP_GAIN_LNAON_SET(x) (((32'd0 | (x)) << TOP_GAIN_LNAON_LSB) & TOP_GAIN_LNAON_MASK) -#define TOP_GAIN_LNAON_RESET 1'h1 -#define TOP_GAIN_LNAGAIN_MSB 16 -#define TOP_GAIN_LNAGAIN_LSB 13 -#define TOP_GAIN_LNAGAIN_MASK 'h0001e000 -#define TOP_GAIN_LNAGAIN_GET(x) (((x) & TOP_GAIN_LNAGAIN_MASK) >> TOP_GAIN_LNAGAIN_LSB) -#define TOP_GAIN_LNAGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_LNAGAIN_LSB) & TOP_GAIN_LNAGAIN_MASK) -#define TOP_GAIN_LNAGAIN_RESET 4'hf -#define TOP_GAIN_RFVGA5GAIN_MSB 12 -#define TOP_GAIN_RFVGA5GAIN_LSB 11 -#define TOP_GAIN_RFVGA5GAIN_MASK 'h00001800 -#define TOP_GAIN_RFVGA5GAIN_GET(x) (((x) & TOP_GAIN_RFVGA5GAIN_MASK) >> TOP_GAIN_RFVGA5GAIN_LSB) -#define TOP_GAIN_RFVGA5GAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RFVGA5GAIN_LSB) & TOP_GAIN_RFVGA5GAIN_MASK) -#define TOP_GAIN_RFVGA5GAIN_RESET 2'h3 -#define TOP_GAIN_RFGMGN_MSB 10 -#define TOP_GAIN_RFGMGN_LSB 8 -#define TOP_GAIN_RFGMGN_MASK 'h00000700 -#define TOP_GAIN_RFGMGN_GET(x) (((x) & TOP_GAIN_RFGMGN_MASK) >> TOP_GAIN_RFGMGN_LSB) -#define TOP_GAIN_RFGMGN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RFGMGN_LSB) & TOP_GAIN_RFGMGN_MASK) -#define TOP_GAIN_RFGMGN_RESET 3'h7 -#define TOP_GAIN_RX6DBLOQGAIN_MSB 7 -#define TOP_GAIN_RX6DBLOQGAIN_LSB 6 -#define TOP_GAIN_RX6DBLOQGAIN_MASK 'h000000c0 -#define TOP_GAIN_RX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBLOQGAIN_MASK) >> TOP_GAIN_RX6DBLOQGAIN_LSB) -#define TOP_GAIN_RX6DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RX6DBLOQGAIN_LSB) & TOP_GAIN_RX6DBLOQGAIN_MASK) -#define TOP_GAIN_RX6DBLOQGAIN_RESET 2'h3 -#define TOP_GAIN_RX1DBLOQGAIN_MSB 5 -#define TOP_GAIN_RX1DBLOQGAIN_LSB 3 -#define TOP_GAIN_RX1DBLOQGAIN_MASK 'h00000038 -#define TOP_GAIN_RX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX1DBLOQGAIN_MASK) >> TOP_GAIN_RX1DBLOQGAIN_LSB) -#define TOP_GAIN_RX1DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RX1DBLOQGAIN_LSB) & TOP_GAIN_RX1DBLOQGAIN_MASK) -#define TOP_GAIN_RX1DBLOQGAIN_RESET 3'h6 -#define TOP_GAIN_RX6DBHIQGAIN_MSB 2 -#define TOP_GAIN_RX6DBHIQGAIN_LSB 1 -#define TOP_GAIN_RX6DBHIQGAIN_MASK 'h00000006 -#define TOP_GAIN_RX6DBHIQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBHIQGAIN_MASK) >> TOP_GAIN_RX6DBHIQGAIN_LSB) -#define TOP_GAIN_RX6DBHIQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RX6DBHIQGAIN_LSB) & TOP_GAIN_RX6DBHIQGAIN_MASK) -#define TOP_GAIN_RX6DBHIQGAIN_RESET 2'h3 -#define TOP_GAIN_SPARE_MSB 0 -#define TOP_GAIN_SPARE_LSB 0 -#define TOP_GAIN_SPARE_MASK 'h00000001 -#define TOP_GAIN_SPARE_GET(x) (((x) & TOP_GAIN_SPARE_MASK) >> TOP_GAIN_SPARE_LSB) -#define TOP_GAIN_SPARE_SET(x) (((32'd0 | (x)) << TOP_GAIN_SPARE_LSB) & TOP_GAIN_SPARE_MASK) -#define TOP_GAIN_SPARE_RESET 1'h0 -#define TOP_GAIN_RESET (32'h0 | \ - TOP_GAIN_TX6DBLOQGAIN_SET(TOP_GAIN_TX6DBLOQGAIN_RESET) | \ - TOP_GAIN_TX1DBLOQGAIN_SET(TOP_GAIN_TX1DBLOQGAIN_RESET) | \ - TOP_GAIN_TXV2IGAIN_SET(TOP_GAIN_TXV2IGAIN_RESET) | \ - TOP_GAIN_PABUF5GN_SET(TOP_GAIN_PABUF5GN_RESET) | \ - TOP_GAIN_PADRVGN_SET(TOP_GAIN_PADRVGN_RESET) | \ - TOP_GAIN_PAOUT2GN_SET(TOP_GAIN_PAOUT2GN_RESET) | \ - TOP_GAIN_LNAON_SET(TOP_GAIN_LNAON_RESET) | \ - TOP_GAIN_LNAGAIN_SET(TOP_GAIN_LNAGAIN_RESET) | \ - TOP_GAIN_RFVGA5GAIN_SET(TOP_GAIN_RFVGA5GAIN_RESET) | \ - TOP_GAIN_RFGMGN_SET(TOP_GAIN_RFGMGN_RESET) | \ - TOP_GAIN_RX6DBLOQGAIN_SET(TOP_GAIN_RX6DBLOQGAIN_RESET) | \ - TOP_GAIN_RX1DBLOQGAIN_SET(TOP_GAIN_RX1DBLOQGAIN_RESET) | \ - TOP_GAIN_RX6DBHIQGAIN_SET(TOP_GAIN_RX6DBHIQGAIN_RESET) | \ - TOP_GAIN_SPARE_SET(TOP_GAIN_SPARE_RESET)) -#define TOP_GAIN_HW_MASK (32'h0 | \ - TOP_GAIN_TX6DBLOQGAIN_MASK | \ - TOP_GAIN_TX1DBLOQGAIN_MASK | \ - TOP_GAIN_TXV2IGAIN_MASK | \ - TOP_GAIN_PABUF5GN_MASK | \ - TOP_GAIN_PADRVGN_MASK | \ - TOP_GAIN_PAOUT2GN_MASK | \ - TOP_GAIN_LNAON_MASK | \ - TOP_GAIN_LNAGAIN_MASK | \ - TOP_GAIN_RFVGA5GAIN_MASK | \ - TOP_GAIN_RFGMGN_MASK | \ - TOP_GAIN_RX6DBLOQGAIN_MASK | \ - TOP_GAIN_RX1DBLOQGAIN_MASK | \ - TOP_GAIN_RX6DBHIQGAIN_MASK | \ - TOP_GAIN_SPARE_MASK) -#define TOP_GAIN_SW_MASK (32'h0 | \ - TOP_GAIN_TX6DBLOQGAIN_MASK | \ - TOP_GAIN_TX1DBLOQGAIN_MASK | \ - TOP_GAIN_TXV2IGAIN_MASK | \ - TOP_GAIN_PABUF5GN_MASK | \ - TOP_GAIN_PADRVGN_MASK | \ - TOP_GAIN_PAOUT2GN_MASK | \ - TOP_GAIN_LNAON_MASK | \ - TOP_GAIN_LNAGAIN_MASK | \ - TOP_GAIN_RFVGA5GAIN_MASK | \ - TOP_GAIN_RFGMGN_MASK | \ - TOP_GAIN_RX6DBLOQGAIN_MASK | \ - TOP_GAIN_RX1DBLOQGAIN_MASK | \ - TOP_GAIN_RX6DBHIQGAIN_MASK | \ - TOP_GAIN_SPARE_MASK) - -#define TOP_TOP_ADDRESS 'h00000004 -#define TOP_TOP_LOCALTXGAIN_MSB 31 -#define TOP_TOP_LOCALTXGAIN_LSB 31 -#define TOP_TOP_LOCALTXGAIN_MASK 'h80000000 -#define TOP_TOP_LOCALTXGAIN_GET(x) (((x) & TOP_TOP_LOCALTXGAIN_MASK) >> TOP_TOP_LOCALTXGAIN_LSB) -#define TOP_TOP_LOCALTXGAIN_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALTXGAIN_LSB) & TOP_TOP_LOCALTXGAIN_MASK) -#define TOP_TOP_LOCALTXGAIN_RESET 1'h0 -#define TOP_TOP_LOCALRXGAIN_MSB 30 -#define TOP_TOP_LOCALRXGAIN_LSB 30 -#define TOP_TOP_LOCALRXGAIN_MASK 'h40000000 -#define TOP_TOP_LOCALRXGAIN_GET(x) (((x) & TOP_TOP_LOCALRXGAIN_MASK) >> TOP_TOP_LOCALRXGAIN_LSB) -#define TOP_TOP_LOCALRXGAIN_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALRXGAIN_LSB) & TOP_TOP_LOCALRXGAIN_MASK) -#define TOP_TOP_LOCALRXGAIN_RESET 1'h0 -#define TOP_TOP_LOCALMODE_MSB 29 -#define TOP_TOP_LOCALMODE_LSB 29 -#define TOP_TOP_LOCALMODE_MASK 'h20000000 -#define TOP_TOP_LOCALMODE_GET(x) (((x) & TOP_TOP_LOCALMODE_MASK) >> TOP_TOP_LOCALMODE_LSB) -#define TOP_TOP_LOCALMODE_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALMODE_LSB) & TOP_TOP_LOCALMODE_MASK) -#define TOP_TOP_LOCALMODE_RESET 1'h0 -#define TOP_TOP_CALFC_MSB 28 -#define TOP_TOP_CALFC_LSB 28 -#define TOP_TOP_CALFC_MASK 'h10000000 -#define TOP_TOP_CALFC_GET(x) (((x) & TOP_TOP_CALFC_MASK) >> TOP_TOP_CALFC_LSB) -#define TOP_TOP_CALFC_SET(x) (((32'd0 | (x)) << TOP_TOP_CALFC_LSB) & TOP_TOP_CALFC_MASK) -#define TOP_TOP_CALFC_RESET 1'h0 -#define TOP_TOP_CALDC_MSB 27 -#define TOP_TOP_CALDC_LSB 27 -#define TOP_TOP_CALDC_MASK 'h08000000 -#define TOP_TOP_CALDC_GET(x) (((x) & TOP_TOP_CALDC_MASK) >> TOP_TOP_CALDC_LSB) -#define TOP_TOP_CALDC_SET(x) (((32'd0 | (x)) << TOP_TOP_CALDC_LSB) & TOP_TOP_CALDC_MASK) -#define TOP_TOP_CALDC_RESET 1'h0 -#define TOP_TOP_CAL_RESIDUE_MSB 26 -#define TOP_TOP_CAL_RESIDUE_LSB 26 -#define TOP_TOP_CAL_RESIDUE_MASK 'h04000000 -#define TOP_TOP_CAL_RESIDUE_GET(x) (((x) & TOP_TOP_CAL_RESIDUE_MASK) >> TOP_TOP_CAL_RESIDUE_LSB) -#define TOP_TOP_CAL_RESIDUE_SET(x) (((32'd0 | (x)) << TOP_TOP_CAL_RESIDUE_LSB) & TOP_TOP_CAL_RESIDUE_MASK) -#define TOP_TOP_CAL_RESIDUE_RESET 1'h0 -#define TOP_TOP_BMODE_MSB 25 -#define TOP_TOP_BMODE_LSB 25 -#define TOP_TOP_BMODE_MASK 'h02000000 -#define TOP_TOP_BMODE_GET(x) (((x) & TOP_TOP_BMODE_MASK) >> TOP_TOP_BMODE_LSB) -#define TOP_TOP_BMODE_SET(x) (((32'd0 | (x)) << TOP_TOP_BMODE_LSB) & TOP_TOP_BMODE_MASK) -#define TOP_TOP_BMODE_RESET 1'h1 -#define TOP_TOP_SYNTHON_MSB 24 -#define TOP_TOP_SYNTHON_LSB 24 -#define TOP_TOP_SYNTHON_MASK 'h01000000 -#define TOP_TOP_SYNTHON_GET(x) (((x) & TOP_TOP_SYNTHON_MASK) >> TOP_TOP_SYNTHON_LSB) -#define TOP_TOP_SYNTHON_SET(x) (((32'd0 | (x)) << TOP_TOP_SYNTHON_LSB) & TOP_TOP_SYNTHON_MASK) -#define TOP_TOP_SYNTHON_RESET 1'h0 -#define TOP_TOP_RXON_MSB 23 -#define TOP_TOP_RXON_LSB 23 -#define TOP_TOP_RXON_MASK 'h00800000 -#define TOP_TOP_RXON_GET(x) (((x) & TOP_TOP_RXON_MASK) >> TOP_TOP_RXON_LSB) -#define TOP_TOP_RXON_SET(x) (((32'd0 | (x)) << TOP_TOP_RXON_LSB) & TOP_TOP_RXON_MASK) -#define TOP_TOP_RXON_RESET 1'h0 -#define TOP_TOP_TXON_MSB 22 -#define TOP_TOP_TXON_LSB 22 -#define TOP_TOP_TXON_MASK 'h00400000 -#define TOP_TOP_TXON_GET(x) (((x) & TOP_TOP_TXON_MASK) >> TOP_TOP_TXON_LSB) -#define TOP_TOP_TXON_SET(x) (((32'd0 | (x)) << TOP_TOP_TXON_LSB) & TOP_TOP_TXON_MASK) -#define TOP_TOP_TXON_RESET 1'h0 -#define TOP_TOP_PAON_MSB 21 -#define TOP_TOP_PAON_LSB 21 -#define TOP_TOP_PAON_MASK 'h00200000 -#define TOP_TOP_PAON_GET(x) (((x) & TOP_TOP_PAON_MASK) >> TOP_TOP_PAON_LSB) -#define TOP_TOP_PAON_SET(x) (((32'd0 | (x)) << TOP_TOP_PAON_LSB) & TOP_TOP_PAON_MASK) -#define TOP_TOP_PAON_RESET 1'h0 -#define TOP_TOP_CALTX_MSB 20 -#define TOP_TOP_CALTX_LSB 20 -#define TOP_TOP_CALTX_MASK 'h00100000 -#define TOP_TOP_CALTX_GET(x) (((x) & TOP_TOP_CALTX_MASK) >> TOP_TOP_CALTX_LSB) -#define TOP_TOP_CALTX_SET(x) (((32'd0 | (x)) << TOP_TOP_CALTX_LSB) & TOP_TOP_CALTX_MASK) -#define TOP_TOP_CALTX_RESET 1'h0 -#define TOP_TOP_LOCALADDAC_MSB 19 -#define TOP_TOP_LOCALADDAC_LSB 19 -#define TOP_TOP_LOCALADDAC_MASK 'h00080000 -#define TOP_TOP_LOCALADDAC_GET(x) (((x) & TOP_TOP_LOCALADDAC_MASK) >> TOP_TOP_LOCALADDAC_LSB) -#define TOP_TOP_LOCALADDAC_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALADDAC_LSB) & TOP_TOP_LOCALADDAC_MASK) -#define TOP_TOP_LOCALADDAC_RESET 1'h0 -#define TOP_TOP_PWDPLL_MSB 18 -#define TOP_TOP_PWDPLL_LSB 18 -#define TOP_TOP_PWDPLL_MASK 'h00040000 -#define TOP_TOP_PWDPLL_GET(x) (((x) & TOP_TOP_PWDPLL_MASK) >> TOP_TOP_PWDPLL_LSB) -#define TOP_TOP_PWDPLL_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDPLL_LSB) & TOP_TOP_PWDPLL_MASK) -#define TOP_TOP_PWDPLL_RESET 1'h0 -#define TOP_TOP_PWDADC_MSB 17 -#define TOP_TOP_PWDADC_LSB 17 -#define TOP_TOP_PWDADC_MASK 'h00020000 -#define TOP_TOP_PWDADC_GET(x) (((x) & TOP_TOP_PWDADC_MASK) >> TOP_TOP_PWDADC_LSB) -#define TOP_TOP_PWDADC_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDADC_LSB) & TOP_TOP_PWDADC_MASK) -#define TOP_TOP_PWDADC_RESET 1'h0 -#define TOP_TOP_PWDDAC_MSB 16 -#define TOP_TOP_PWDDAC_LSB 16 -#define TOP_TOP_PWDDAC_MASK 'h00010000 -#define TOP_TOP_PWDDAC_GET(x) (((x) & TOP_TOP_PWDDAC_MASK) >> TOP_TOP_PWDDAC_LSB) -#define TOP_TOP_PWDDAC_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDDAC_LSB) & TOP_TOP_PWDDAC_MASK) -#define TOP_TOP_PWDDAC_RESET 1'h0 -#define TOP_TOP_LOCALXTAL_MSB 15 -#define TOP_TOP_LOCALXTAL_LSB 15 -#define TOP_TOP_LOCALXTAL_MASK 'h00008000 -#define TOP_TOP_LOCALXTAL_GET(x) (((x) & TOP_TOP_LOCALXTAL_MASK) >> TOP_TOP_LOCALXTAL_LSB) -#define TOP_TOP_LOCALXTAL_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALXTAL_LSB) & TOP_TOP_LOCALXTAL_MASK) -#define TOP_TOP_LOCALXTAL_RESET 1'h0 -#define TOP_TOP_PWDCLKIN_MSB 14 -#define TOP_TOP_PWDCLKIN_LSB 14 -#define TOP_TOP_PWDCLKIN_MASK 'h00004000 -#define TOP_TOP_PWDCLKIN_GET(x) (((x) & TOP_TOP_PWDCLKIN_MASK) >> TOP_TOP_PWDCLKIN_LSB) -#define TOP_TOP_PWDCLKIN_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDCLKIN_LSB) & TOP_TOP_PWDCLKIN_MASK) -#define TOP_TOP_PWDCLKIN_RESET 1'h0 -#define TOP_TOP_OSCON_MSB 13 -#define TOP_TOP_OSCON_LSB 13 -#define TOP_TOP_OSCON_MASK 'h00002000 -#define TOP_TOP_OSCON_GET(x) (((x) & TOP_TOP_OSCON_MASK) >> TOP_TOP_OSCON_LSB) -#define TOP_TOP_OSCON_SET(x) (((32'd0 | (x)) << TOP_TOP_OSCON_LSB) & TOP_TOP_OSCON_MASK) -#define TOP_TOP_OSCON_RESET 1'h1 -#define TOP_TOP_SCLKEN_FORCE_MSB 12 -#define TOP_TOP_SCLKEN_FORCE_LSB 12 -#define TOP_TOP_SCLKEN_FORCE_MASK 'h00001000 -#define TOP_TOP_SCLKEN_FORCE_GET(x) (((x) & TOP_TOP_SCLKEN_FORCE_MASK) >> TOP_TOP_SCLKEN_FORCE_LSB) -#define TOP_TOP_SCLKEN_FORCE_SET(x) (((32'd0 | (x)) << TOP_TOP_SCLKEN_FORCE_LSB) & TOP_TOP_SCLKEN_FORCE_MASK) -#define TOP_TOP_SCLKEN_FORCE_RESET 1'h0 -#define TOP_TOP_SYNTHON_FORCE_MSB 11 -#define TOP_TOP_SYNTHON_FORCE_LSB 11 -#define TOP_TOP_SYNTHON_FORCE_MASK 'h00000800 -#define TOP_TOP_SYNTHON_FORCE_GET(x) (((x) & TOP_TOP_SYNTHON_FORCE_MASK) >> TOP_TOP_SYNTHON_FORCE_LSB) -#define TOP_TOP_SYNTHON_FORCE_SET(x) (((32'd0 | (x)) << TOP_TOP_SYNTHON_FORCE_LSB) & TOP_TOP_SYNTHON_FORCE_MASK) -#define TOP_TOP_SYNTHON_FORCE_RESET 1'h0 -#define TOP_TOP_PDBIAS_MSB 10 -#define TOP_TOP_PDBIAS_LSB 10 -#define TOP_TOP_PDBIAS_MASK 'h00000400 -#define TOP_TOP_PDBIAS_GET(x) (((x) & TOP_TOP_PDBIAS_MASK) >> TOP_TOP_PDBIAS_LSB) -#define TOP_TOP_PDBIAS_SET(x) (((32'd0 | (x)) << TOP_TOP_PDBIAS_LSB) & TOP_TOP_PDBIAS_MASK) -#define TOP_TOP_PDBIAS_RESET 1'h0 -#define TOP_TOP_DATAOUTSEL_MSB 9 -#define TOP_TOP_DATAOUTSEL_LSB 8 -#define TOP_TOP_DATAOUTSEL_MASK 'h00000300 -#define TOP_TOP_DATAOUTSEL_GET(x) (((x) & TOP_TOP_DATAOUTSEL_MASK) >> TOP_TOP_DATAOUTSEL_LSB) -#define TOP_TOP_DATAOUTSEL_SET(x) (((32'd0 | (x)) << TOP_TOP_DATAOUTSEL_LSB) & TOP_TOP_DATAOUTSEL_MASK) -#define TOP_TOP_DATAOUTSEL_RESET 2'h3 -#define TOP_TOP_REVID_MSB 7 -#define TOP_TOP_REVID_LSB 5 -#define TOP_TOP_REVID_MASK 'h000000e0 -#define TOP_TOP_REVID_GET(x) (((x) & TOP_TOP_REVID_MASK) >> TOP_TOP_REVID_LSB) -#define TOP_TOP_REVID_SET(x) (((32'd0 | (x)) << TOP_TOP_REVID_LSB) & TOP_TOP_REVID_MASK) -#define TOP_TOP_REVID_RESET 3'h0 -#define TOP_TOP_INT2PAD_MSB 4 -#define TOP_TOP_INT2PAD_LSB 4 -#define TOP_TOP_INT2PAD_MASK 'h00000010 -#define TOP_TOP_INT2PAD_GET(x) (((x) & TOP_TOP_INT2PAD_MASK) >> TOP_TOP_INT2PAD_LSB) -#define TOP_TOP_INT2PAD_SET(x) (((32'd0 | (x)) << TOP_TOP_INT2PAD_LSB) & TOP_TOP_INT2PAD_MASK) -#define TOP_TOP_INT2PAD_RESET 1'h0 -#define TOP_TOP_INTH2PAD_MSB 3 -#define TOP_TOP_INTH2PAD_LSB 3 -#define TOP_TOP_INTH2PAD_MASK 'h00000008 -#define TOP_TOP_INTH2PAD_GET(x) (((x) & TOP_TOP_INTH2PAD_MASK) >> TOP_TOP_INTH2PAD_LSB) -#define TOP_TOP_INTH2PAD_SET(x) (((32'd0 | (x)) << TOP_TOP_INTH2PAD_LSB) & TOP_TOP_INTH2PAD_MASK) -#define TOP_TOP_INTH2PAD_RESET 1'h0 -#define TOP_TOP_PAD2GND_MSB 2 -#define TOP_TOP_PAD2GND_LSB 2 -#define TOP_TOP_PAD2GND_MASK 'h00000004 -#define TOP_TOP_PAD2GND_GET(x) (((x) & TOP_TOP_PAD2GND_MASK) >> TOP_TOP_PAD2GND_LSB) -#define TOP_TOP_PAD2GND_SET(x) (((32'd0 | (x)) << TOP_TOP_PAD2GND_LSB) & TOP_TOP_PAD2GND_MASK) -#define TOP_TOP_PAD2GND_RESET 1'h0 -#define TOP_TOP_INT2GND_MSB 1 -#define TOP_TOP_INT2GND_LSB 1 -#define TOP_TOP_INT2GND_MASK 'h00000002 -#define TOP_TOP_INT2GND_GET(x) (((x) & TOP_TOP_INT2GND_MASK) >> TOP_TOP_INT2GND_LSB) -#define TOP_TOP_INT2GND_SET(x) (((32'd0 | (x)) << TOP_TOP_INT2GND_LSB) & TOP_TOP_INT2GND_MASK) -#define TOP_TOP_INT2GND_RESET 1'h0 -#define TOP_TOP_FORCE_XPAON_MSB 0 -#define TOP_TOP_FORCE_XPAON_LSB 0 -#define TOP_TOP_FORCE_XPAON_MASK 'h00000001 -#define TOP_TOP_FORCE_XPAON_GET(x) (((x) & TOP_TOP_FORCE_XPAON_MASK) >> TOP_TOP_FORCE_XPAON_LSB) -#define TOP_TOP_FORCE_XPAON_SET(x) (((32'd0 | (x)) << TOP_TOP_FORCE_XPAON_LSB) & TOP_TOP_FORCE_XPAON_MASK) -#define TOP_TOP_FORCE_XPAON_RESET 1'h0 -#define TOP_TOP_RESET (32'h0 | \ - TOP_TOP_LOCALTXGAIN_SET(TOP_TOP_LOCALTXGAIN_RESET) | \ - TOP_TOP_LOCALRXGAIN_SET(TOP_TOP_LOCALRXGAIN_RESET) | \ - TOP_TOP_LOCALMODE_SET(TOP_TOP_LOCALMODE_RESET) | \ - TOP_TOP_CALFC_SET(TOP_TOP_CALFC_RESET) | \ - TOP_TOP_CALDC_SET(TOP_TOP_CALDC_RESET) | \ - TOP_TOP_CAL_RESIDUE_SET(TOP_TOP_CAL_RESIDUE_RESET) | \ - TOP_TOP_BMODE_SET(TOP_TOP_BMODE_RESET) | \ - TOP_TOP_SYNTHON_SET(TOP_TOP_SYNTHON_RESET) | \ - TOP_TOP_RXON_SET(TOP_TOP_RXON_RESET) | \ - TOP_TOP_TXON_SET(TOP_TOP_TXON_RESET) | \ - TOP_TOP_PAON_SET(TOP_TOP_PAON_RESET) | \ - TOP_TOP_CALTX_SET(TOP_TOP_CALTX_RESET) | \ - TOP_TOP_LOCALADDAC_SET(TOP_TOP_LOCALADDAC_RESET) | \ - TOP_TOP_PWDPLL_SET(TOP_TOP_PWDPLL_RESET) | \ - TOP_TOP_PWDADC_SET(TOP_TOP_PWDADC_RESET) | \ - TOP_TOP_PWDDAC_SET(TOP_TOP_PWDDAC_RESET) | \ - TOP_TOP_LOCALXTAL_SET(TOP_TOP_LOCALXTAL_RESET) | \ - TOP_TOP_PWDCLKIN_SET(TOP_TOP_PWDCLKIN_RESET) | \ - TOP_TOP_OSCON_SET(TOP_TOP_OSCON_RESET) | \ - TOP_TOP_SCLKEN_FORCE_SET(TOP_TOP_SCLKEN_FORCE_RESET) | \ - TOP_TOP_SYNTHON_FORCE_SET(TOP_TOP_SYNTHON_FORCE_RESET) | \ - TOP_TOP_PDBIAS_SET(TOP_TOP_PDBIAS_RESET) | \ - TOP_TOP_DATAOUTSEL_SET(TOP_TOP_DATAOUTSEL_RESET) | \ - TOP_TOP_REVID_SET(TOP_TOP_REVID_RESET) | \ - TOP_TOP_INT2PAD_SET(TOP_TOP_INT2PAD_RESET) | \ - TOP_TOP_INTH2PAD_SET(TOP_TOP_INTH2PAD_RESET) | \ - TOP_TOP_PAD2GND_SET(TOP_TOP_PAD2GND_RESET) | \ - TOP_TOP_INT2GND_SET(TOP_TOP_INT2GND_RESET) | \ - TOP_TOP_FORCE_XPAON_SET(TOP_TOP_FORCE_XPAON_RESET)) -#define TOP_TOP_HW_MASK (32'h0 | \ - TOP_TOP_CALFC_MASK | \ - TOP_TOP_CALDC_MASK | \ - TOP_TOP_CAL_RESIDUE_MASK | \ - TOP_TOP_BMODE_MASK | \ - TOP_TOP_SYNTHON_MASK | \ - TOP_TOP_RXON_MASK | \ - TOP_TOP_TXON_MASK | \ - TOP_TOP_PAON_MASK | \ - TOP_TOP_CALTX_MASK | \ - TOP_TOP_PWDPLL_MASK | \ - TOP_TOP_PWDADC_MASK | \ - TOP_TOP_PWDDAC_MASK | \ - TOP_TOP_PWDCLKIN_MASK | \ - TOP_TOP_OSCON_MASK | \ - TOP_TOP_REVID_MASK) -#define TOP_TOP_SW_MASK (32'h0 | \ - TOP_TOP_LOCALTXGAIN_MASK | \ - TOP_TOP_LOCALRXGAIN_MASK | \ - TOP_TOP_LOCALMODE_MASK | \ - TOP_TOP_CALFC_MASK | \ - TOP_TOP_CALDC_MASK | \ - TOP_TOP_CAL_RESIDUE_MASK | \ - TOP_TOP_BMODE_MASK | \ - TOP_TOP_SYNTHON_MASK | \ - TOP_TOP_RXON_MASK | \ - TOP_TOP_TXON_MASK | \ - TOP_TOP_PAON_MASK | \ - TOP_TOP_CALTX_MASK | \ - TOP_TOP_LOCALADDAC_MASK | \ - TOP_TOP_PWDPLL_MASK | \ - TOP_TOP_PWDADC_MASK | \ - TOP_TOP_PWDDAC_MASK | \ - TOP_TOP_LOCALXTAL_MASK | \ - TOP_TOP_PWDCLKIN_MASK | \ - TOP_TOP_OSCON_MASK | \ - TOP_TOP_SCLKEN_FORCE_MASK | \ - TOP_TOP_SYNTHON_FORCE_MASK | \ - TOP_TOP_PDBIAS_MASK | \ - TOP_TOP_DATAOUTSEL_MASK | \ - TOP_TOP_INT2PAD_MASK | \ - TOP_TOP_INTH2PAD_MASK | \ - TOP_TOP_PAD2GND_MASK | \ - TOP_TOP_INT2GND_MASK | \ - TOP_TOP_FORCE_XPAON_MASK) - -#define TOP_REG_ADDRESS_MSB 2 - -#endif /* _TOP_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/txpc_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/txpc_reg.h deleted file mode 100644 index ed2b1260464d..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/txpc_reg.h +++ /dev/null @@ -1,170 +0,0 @@ -#ifndef _TXPC_REG_REG_H_ -#define _TXPC_REG_REG_H_ - -#define TXPC_TXPC_ADDRESS 0x00000000 -#define TXPC_TXPC_OFFSET 0x00000000 -#define TXPC_TXPC_SELINTPD_MSB 31 -#define TXPC_TXPC_SELINTPD_LSB 31 -#define TXPC_TXPC_SELINTPD_MASK 0x80000000 -#define TXPC_TXPC_SELINTPD_GET(x) (((x) & TXPC_TXPC_SELINTPD_MASK) >> TXPC_TXPC_SELINTPD_LSB) -#define TXPC_TXPC_SELINTPD_SET(x) (((x) << TXPC_TXPC_SELINTPD_LSB) & TXPC_TXPC_SELINTPD_MASK) -#define TXPC_TXPC_TEST_MSB 30 -#define TXPC_TXPC_TEST_LSB 30 -#define TXPC_TXPC_TEST_MASK 0x40000000 -#define TXPC_TXPC_TEST_GET(x) (((x) & TXPC_TXPC_TEST_MASK) >> TXPC_TXPC_TEST_LSB) -#define TXPC_TXPC_TEST_SET(x) (((x) << TXPC_TXPC_TEST_LSB) & TXPC_TXPC_TEST_MASK) -#define TXPC_TXPC_TESTGAIN_MSB 29 -#define TXPC_TXPC_TESTGAIN_LSB 28 -#define TXPC_TXPC_TESTGAIN_MASK 0x30000000 -#define TXPC_TXPC_TESTGAIN_GET(x) (((x) & TXPC_TXPC_TESTGAIN_MASK) >> TXPC_TXPC_TESTGAIN_LSB) -#define TXPC_TXPC_TESTGAIN_SET(x) (((x) << TXPC_TXPC_TESTGAIN_LSB) & TXPC_TXPC_TESTGAIN_MASK) -#define TXPC_TXPC_TESTDAC_MSB 27 -#define TXPC_TXPC_TESTDAC_LSB 22 -#define TXPC_TXPC_TESTDAC_MASK 0x0fc00000 -#define TXPC_TXPC_TESTDAC_GET(x) (((x) & TXPC_TXPC_TESTDAC_MASK) >> TXPC_TXPC_TESTDAC_LSB) -#define TXPC_TXPC_TESTDAC_SET(x) (((x) << TXPC_TXPC_TESTDAC_LSB) & TXPC_TXPC_TESTDAC_MASK) -#define TXPC_TXPC_TESTPWDPC_MSB 21 -#define TXPC_TXPC_TESTPWDPC_LSB 21 -#define TXPC_TXPC_TESTPWDPC_MASK 0x00200000 -#define TXPC_TXPC_TESTPWDPC_GET(x) (((x) & TXPC_TXPC_TESTPWDPC_MASK) >> TXPC_TXPC_TESTPWDPC_LSB) -#define TXPC_TXPC_TESTPWDPC_SET(x) (((x) << TXPC_TXPC_TESTPWDPC_LSB) & TXPC_TXPC_TESTPWDPC_MASK) -#define TXPC_TXPC_CURHALF_MSB 20 -#define TXPC_TXPC_CURHALF_LSB 20 -#define TXPC_TXPC_CURHALF_MASK 0x00100000 -#define TXPC_TXPC_CURHALF_GET(x) (((x) & TXPC_TXPC_CURHALF_MASK) >> TXPC_TXPC_CURHALF_LSB) -#define TXPC_TXPC_CURHALF_SET(x) (((x) << TXPC_TXPC_CURHALF_LSB) & TXPC_TXPC_CURHALF_MASK) -#define TXPC_TXPC_NEGOUT_MSB 19 -#define TXPC_TXPC_NEGOUT_LSB 19 -#define TXPC_TXPC_NEGOUT_MASK 0x00080000 -#define TXPC_TXPC_NEGOUT_GET(x) (((x) & TXPC_TXPC_NEGOUT_MASK) >> TXPC_TXPC_NEGOUT_LSB) -#define TXPC_TXPC_NEGOUT_SET(x) (((x) << TXPC_TXPC_NEGOUT_LSB) & TXPC_TXPC_NEGOUT_MASK) -#define TXPC_TXPC_CLKDELAY_MSB 18 -#define TXPC_TXPC_CLKDELAY_LSB 18 -#define TXPC_TXPC_CLKDELAY_MASK 0x00040000 -#define TXPC_TXPC_CLKDELAY_GET(x) (((x) & TXPC_TXPC_CLKDELAY_MASK) >> TXPC_TXPC_CLKDELAY_LSB) -#define TXPC_TXPC_CLKDELAY_SET(x) (((x) << TXPC_TXPC_CLKDELAY_LSB) & TXPC_TXPC_CLKDELAY_MASK) -#define TXPC_TXPC_SELMODREF_MSB 17 -#define TXPC_TXPC_SELMODREF_LSB 17 -#define TXPC_TXPC_SELMODREF_MASK 0x00020000 -#define TXPC_TXPC_SELMODREF_GET(x) (((x) & TXPC_TXPC_SELMODREF_MASK) >> TXPC_TXPC_SELMODREF_LSB) -#define TXPC_TXPC_SELMODREF_SET(x) (((x) << TXPC_TXPC_SELMODREF_LSB) & TXPC_TXPC_SELMODREF_MASK) -#define TXPC_TXPC_SELCMOUT_MSB 16 -#define TXPC_TXPC_SELCMOUT_LSB 16 -#define TXPC_TXPC_SELCMOUT_MASK 0x00010000 -#define TXPC_TXPC_SELCMOUT_GET(x) (((x) & TXPC_TXPC_SELCMOUT_MASK) >> TXPC_TXPC_SELCMOUT_LSB) -#define TXPC_TXPC_SELCMOUT_SET(x) (((x) << TXPC_TXPC_SELCMOUT_LSB) & TXPC_TXPC_SELCMOUT_MASK) -#define TXPC_TXPC_TSMODE_MSB 15 -#define TXPC_TXPC_TSMODE_LSB 14 -#define TXPC_TXPC_TSMODE_MASK 0x0000c000 -#define TXPC_TXPC_TSMODE_GET(x) (((x) & TXPC_TXPC_TSMODE_MASK) >> TXPC_TXPC_TSMODE_LSB) -#define TXPC_TXPC_TSMODE_SET(x) (((x) << TXPC_TXPC_TSMODE_LSB) & TXPC_TXPC_TSMODE_MASK) -#define TXPC_TXPC_N_MSB 13 -#define TXPC_TXPC_N_LSB 6 -#define TXPC_TXPC_N_MASK 0x00003fc0 -#define TXPC_TXPC_N_GET(x) (((x) & TXPC_TXPC_N_MASK) >> TXPC_TXPC_N_LSB) -#define TXPC_TXPC_N_SET(x) (((x) << TXPC_TXPC_N_LSB) & TXPC_TXPC_N_MASK) -#define TXPC_TXPC_ON1STSYNTHON_MSB 5 -#define TXPC_TXPC_ON1STSYNTHON_LSB 5 -#define TXPC_TXPC_ON1STSYNTHON_MASK 0x00000020 -#define TXPC_TXPC_ON1STSYNTHON_GET(x) (((x) & TXPC_TXPC_ON1STSYNTHON_MASK) >> TXPC_TXPC_ON1STSYNTHON_LSB) -#define TXPC_TXPC_ON1STSYNTHON_SET(x) (((x) << TXPC_TXPC_ON1STSYNTHON_LSB) & TXPC_TXPC_ON1STSYNTHON_MASK) -#define TXPC_TXPC_SELINIT_MSB 4 -#define TXPC_TXPC_SELINIT_LSB 3 -#define TXPC_TXPC_SELINIT_MASK 0x00000018 -#define TXPC_TXPC_SELINIT_GET(x) (((x) & TXPC_TXPC_SELINIT_MASK) >> TXPC_TXPC_SELINIT_LSB) -#define TXPC_TXPC_SELINIT_SET(x) (((x) << TXPC_TXPC_SELINIT_LSB) & TXPC_TXPC_SELINIT_MASK) -#define TXPC_TXPC_SELCOUNT_MSB 2 -#define TXPC_TXPC_SELCOUNT_LSB 2 -#define TXPC_TXPC_SELCOUNT_MASK 0x00000004 -#define TXPC_TXPC_SELCOUNT_GET(x) (((x) & TXPC_TXPC_SELCOUNT_MASK) >> TXPC_TXPC_SELCOUNT_LSB) -#define TXPC_TXPC_SELCOUNT_SET(x) (((x) << TXPC_TXPC_SELCOUNT_LSB) & TXPC_TXPC_SELCOUNT_MASK) -#define TXPC_TXPC_ATBSEL_MSB 1 -#define TXPC_TXPC_ATBSEL_LSB 0 -#define TXPC_TXPC_ATBSEL_MASK 0x00000003 -#define TXPC_TXPC_ATBSEL_GET(x) (((x) & TXPC_TXPC_ATBSEL_MASK) >> TXPC_TXPC_ATBSEL_LSB) -#define TXPC_TXPC_ATBSEL_SET(x) (((x) << TXPC_TXPC_ATBSEL_LSB) & TXPC_TXPC_ATBSEL_MASK) - -#define TXPC_MISC_ADDRESS 0x00000004 -#define TXPC_MISC_OFFSET 0x00000004 -#define TXPC_MISC_FLIPBMODE_MSB 31 -#define TXPC_MISC_FLIPBMODE_LSB 31 -#define TXPC_MISC_FLIPBMODE_MASK 0x80000000 -#define TXPC_MISC_FLIPBMODE_GET(x) (((x) & TXPC_MISC_FLIPBMODE_MASK) >> TXPC_MISC_FLIPBMODE_LSB) -#define TXPC_MISC_FLIPBMODE_SET(x) (((x) << TXPC_MISC_FLIPBMODE_LSB) & TXPC_MISC_FLIPBMODE_MASK) -#define TXPC_MISC_LEVEL_MSB 30 -#define TXPC_MISC_LEVEL_LSB 29 -#define TXPC_MISC_LEVEL_MASK 0x60000000 -#define TXPC_MISC_LEVEL_GET(x) (((x) & TXPC_MISC_LEVEL_MASK) >> TXPC_MISC_LEVEL_LSB) -#define TXPC_MISC_LEVEL_SET(x) (((x) << TXPC_MISC_LEVEL_LSB) & TXPC_MISC_LEVEL_MASK) -#define TXPC_MISC_LDO_TEST_MODE_MSB 28 -#define TXPC_MISC_LDO_TEST_MODE_LSB 28 -#define TXPC_MISC_LDO_TEST_MODE_MASK 0x10000000 -#define TXPC_MISC_LDO_TEST_MODE_GET(x) (((x) & TXPC_MISC_LDO_TEST_MODE_MASK) >> TXPC_MISC_LDO_TEST_MODE_LSB) -#define TXPC_MISC_LDO_TEST_MODE_SET(x) (((x) << TXPC_MISC_LDO_TEST_MODE_LSB) & TXPC_MISC_LDO_TEST_MODE_MASK) -#define TXPC_MISC_NOTCXODET_MSB 27 -#define TXPC_MISC_NOTCXODET_LSB 27 -#define TXPC_MISC_NOTCXODET_MASK 0x08000000 -#define TXPC_MISC_NOTCXODET_GET(x) (((x) & TXPC_MISC_NOTCXODET_MASK) >> TXPC_MISC_NOTCXODET_LSB) -#define TXPC_MISC_NOTCXODET_SET(x) (((x) << TXPC_MISC_NOTCXODET_LSB) & TXPC_MISC_NOTCXODET_MASK) -#define TXPC_MISC_PWDCLKIND_MSB 26 -#define TXPC_MISC_PWDCLKIND_LSB 26 -#define TXPC_MISC_PWDCLKIND_MASK 0x04000000 -#define TXPC_MISC_PWDCLKIND_GET(x) (((x) & TXPC_MISC_PWDCLKIND_MASK) >> TXPC_MISC_PWDCLKIND_LSB) -#define TXPC_MISC_PWDCLKIND_SET(x) (((x) << TXPC_MISC_PWDCLKIND_LSB) & TXPC_MISC_PWDCLKIND_MASK) -#define TXPC_MISC_PWDXINPAD_MSB 25 -#define TXPC_MISC_PWDXINPAD_LSB 25 -#define TXPC_MISC_PWDXINPAD_MASK 0x02000000 -#define TXPC_MISC_PWDXINPAD_GET(x) (((x) & TXPC_MISC_PWDXINPAD_MASK) >> TXPC_MISC_PWDXINPAD_LSB) -#define TXPC_MISC_PWDXINPAD_SET(x) (((x) << TXPC_MISC_PWDXINPAD_LSB) & TXPC_MISC_PWDXINPAD_MASK) -#define TXPC_MISC_LOCALBIAS_MSB 24 -#define TXPC_MISC_LOCALBIAS_LSB 24 -#define TXPC_MISC_LOCALBIAS_MASK 0x01000000 -#define TXPC_MISC_LOCALBIAS_GET(x) (((x) & TXPC_MISC_LOCALBIAS_MASK) >> TXPC_MISC_LOCALBIAS_LSB) -#define TXPC_MISC_LOCALBIAS_SET(x) (((x) << TXPC_MISC_LOCALBIAS_LSB) & TXPC_MISC_LOCALBIAS_MASK) -#define TXPC_MISC_LOCALBIAS2X_MSB 23 -#define TXPC_MISC_LOCALBIAS2X_LSB 23 -#define TXPC_MISC_LOCALBIAS2X_MASK 0x00800000 -#define TXPC_MISC_LOCALBIAS2X_GET(x) (((x) & TXPC_MISC_LOCALBIAS2X_MASK) >> TXPC_MISC_LOCALBIAS2X_LSB) -#define TXPC_MISC_LOCALBIAS2X_SET(x) (((x) << TXPC_MISC_LOCALBIAS2X_LSB) & TXPC_MISC_LOCALBIAS2X_MASK) -#define TXPC_MISC_SELTSP_MSB 22 -#define TXPC_MISC_SELTSP_LSB 22 -#define TXPC_MISC_SELTSP_MASK 0x00400000 -#define TXPC_MISC_SELTSP_GET(x) (((x) & TXPC_MISC_SELTSP_MASK) >> TXPC_MISC_SELTSP_LSB) -#define TXPC_MISC_SELTSP_SET(x) (((x) << TXPC_MISC_SELTSP_LSB) & TXPC_MISC_SELTSP_MASK) -#define TXPC_MISC_SELTSN_MSB 21 -#define TXPC_MISC_SELTSN_LSB 21 -#define TXPC_MISC_SELTSN_MASK 0x00200000 -#define TXPC_MISC_SELTSN_GET(x) (((x) & TXPC_MISC_SELTSN_MASK) >> TXPC_MISC_SELTSN_LSB) -#define TXPC_MISC_SELTSN_SET(x) (((x) << TXPC_MISC_SELTSN_LSB) & TXPC_MISC_SELTSN_MASK) -#define TXPC_MISC_SPARE_A_MSB 20 -#define TXPC_MISC_SPARE_A_LSB 18 -#define TXPC_MISC_SPARE_A_MASK 0x001c0000 -#define TXPC_MISC_SPARE_A_GET(x) (((x) & TXPC_MISC_SPARE_A_MASK) >> TXPC_MISC_SPARE_A_LSB) -#define TXPC_MISC_SPARE_A_SET(x) (((x) << TXPC_MISC_SPARE_A_LSB) & TXPC_MISC_SPARE_A_MASK) -#define TXPC_MISC_DECOUT_MSB 17 -#define TXPC_MISC_DECOUT_LSB 8 -#define TXPC_MISC_DECOUT_MASK 0x0003ff00 -#define TXPC_MISC_DECOUT_GET(x) (((x) & TXPC_MISC_DECOUT_MASK) >> TXPC_MISC_DECOUT_LSB) -#define TXPC_MISC_DECOUT_SET(x) (((x) << TXPC_MISC_DECOUT_LSB) & TXPC_MISC_DECOUT_MASK) -#define TXPC_MISC_XTALDIV_MSB 7 -#define TXPC_MISC_XTALDIV_LSB 6 -#define TXPC_MISC_XTALDIV_MASK 0x000000c0 -#define TXPC_MISC_XTALDIV_GET(x) (((x) & TXPC_MISC_XTALDIV_MASK) >> TXPC_MISC_XTALDIV_LSB) -#define TXPC_MISC_XTALDIV_SET(x) (((x) << TXPC_MISC_XTALDIV_LSB) & TXPC_MISC_XTALDIV_MASK) -#define TXPC_MISC_SPARE_MSB 5 -#define TXPC_MISC_SPARE_LSB 0 -#define TXPC_MISC_SPARE_MASK 0x0000003f -#define TXPC_MISC_SPARE_GET(x) (((x) & TXPC_MISC_SPARE_MASK) >> TXPC_MISC_SPARE_LSB) -#define TXPC_MISC_SPARE_SET(x) (((x) << TXPC_MISC_SPARE_LSB) & TXPC_MISC_SPARE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct txpc_reg_reg_s { - volatile unsigned int txpc_txpc; - volatile unsigned int txpc_misc; -} txpc_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _TXPC_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/txpc_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/txpc_reg.vrh deleted file mode 100644 index 0b5423f0805a..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/txpc_reg.vrh +++ /dev/null @@ -1,257 +0,0 @@ -#ifndef _TXPC_REG_VRH_ -#define _TXPC_REG_VRH_ - -#define TXPC_TXPC_ADDRESS 'h00000000 -#define TXPC_TXPC_SELINTPD_MSB 31 -#define TXPC_TXPC_SELINTPD_LSB 31 -#define TXPC_TXPC_SELINTPD_MASK 'h80000000 -#define TXPC_TXPC_SELINTPD_GET(x) (((x) & TXPC_TXPC_SELINTPD_MASK) >> TXPC_TXPC_SELINTPD_LSB) -#define TXPC_TXPC_SELINTPD_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELINTPD_LSB) & TXPC_TXPC_SELINTPD_MASK) -#define TXPC_TXPC_SELINTPD_RESET 1'h0 -#define TXPC_TXPC_TEST_MSB 30 -#define TXPC_TXPC_TEST_LSB 30 -#define TXPC_TXPC_TEST_MASK 'h40000000 -#define TXPC_TXPC_TEST_GET(x) (((x) & TXPC_TXPC_TEST_MASK) >> TXPC_TXPC_TEST_LSB) -#define TXPC_TXPC_TEST_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TEST_LSB) & TXPC_TXPC_TEST_MASK) -#define TXPC_TXPC_TEST_RESET 1'h0 -#define TXPC_TXPC_TESTGAIN_MSB 29 -#define TXPC_TXPC_TESTGAIN_LSB 28 -#define TXPC_TXPC_TESTGAIN_MASK 'h30000000 -#define TXPC_TXPC_TESTGAIN_GET(x) (((x) & TXPC_TXPC_TESTGAIN_MASK) >> TXPC_TXPC_TESTGAIN_LSB) -#define TXPC_TXPC_TESTGAIN_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TESTGAIN_LSB) & TXPC_TXPC_TESTGAIN_MASK) -#define TXPC_TXPC_TESTGAIN_RESET 2'h0 -#define TXPC_TXPC_TESTDAC_MSB 27 -#define TXPC_TXPC_TESTDAC_LSB 22 -#define TXPC_TXPC_TESTDAC_MASK 'h0fc00000 -#define TXPC_TXPC_TESTDAC_GET(x) (((x) & TXPC_TXPC_TESTDAC_MASK) >> TXPC_TXPC_TESTDAC_LSB) -#define TXPC_TXPC_TESTDAC_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TESTDAC_LSB) & TXPC_TXPC_TESTDAC_MASK) -#define TXPC_TXPC_TESTDAC_RESET 6'h20 -#define TXPC_TXPC_TESTPWDPC_MSB 21 -#define TXPC_TXPC_TESTPWDPC_LSB 21 -#define TXPC_TXPC_TESTPWDPC_MASK 'h00200000 -#define TXPC_TXPC_TESTPWDPC_GET(x) (((x) & TXPC_TXPC_TESTPWDPC_MASK) >> TXPC_TXPC_TESTPWDPC_LSB) -#define TXPC_TXPC_TESTPWDPC_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TESTPWDPC_LSB) & TXPC_TXPC_TESTPWDPC_MASK) -#define TXPC_TXPC_TESTPWDPC_RESET 1'h0 -#define TXPC_TXPC_CURHALF_MSB 20 -#define TXPC_TXPC_CURHALF_LSB 20 -#define TXPC_TXPC_CURHALF_MASK 'h00100000 -#define TXPC_TXPC_CURHALF_GET(x) (((x) & TXPC_TXPC_CURHALF_MASK) >> TXPC_TXPC_CURHALF_LSB) -#define TXPC_TXPC_CURHALF_SET(x) (((32'd0 | (x)) << TXPC_TXPC_CURHALF_LSB) & TXPC_TXPC_CURHALF_MASK) -#define TXPC_TXPC_CURHALF_RESET 1'h1 -#define TXPC_TXPC_NEGOUT_MSB 19 -#define TXPC_TXPC_NEGOUT_LSB 19 -#define TXPC_TXPC_NEGOUT_MASK 'h00080000 -#define TXPC_TXPC_NEGOUT_GET(x) (((x) & TXPC_TXPC_NEGOUT_MASK) >> TXPC_TXPC_NEGOUT_LSB) -#define TXPC_TXPC_NEGOUT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_NEGOUT_LSB) & TXPC_TXPC_NEGOUT_MASK) -#define TXPC_TXPC_NEGOUT_RESET 1'h0 -#define TXPC_TXPC_CLKDELAY_MSB 18 -#define TXPC_TXPC_CLKDELAY_LSB 18 -#define TXPC_TXPC_CLKDELAY_MASK 'h00040000 -#define TXPC_TXPC_CLKDELAY_GET(x) (((x) & TXPC_TXPC_CLKDELAY_MASK) >> TXPC_TXPC_CLKDELAY_LSB) -#define TXPC_TXPC_CLKDELAY_SET(x) (((32'd0 | (x)) << TXPC_TXPC_CLKDELAY_LSB) & TXPC_TXPC_CLKDELAY_MASK) -#define TXPC_TXPC_CLKDELAY_RESET 1'h0 -#define TXPC_TXPC_SELMODREF_MSB 17 -#define TXPC_TXPC_SELMODREF_LSB 17 -#define TXPC_TXPC_SELMODREF_MASK 'h00020000 -#define TXPC_TXPC_SELMODREF_GET(x) (((x) & TXPC_TXPC_SELMODREF_MASK) >> TXPC_TXPC_SELMODREF_LSB) -#define TXPC_TXPC_SELMODREF_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELMODREF_LSB) & TXPC_TXPC_SELMODREF_MASK) -#define TXPC_TXPC_SELMODREF_RESET 1'h0 -#define TXPC_TXPC_SELCMOUT_MSB 16 -#define TXPC_TXPC_SELCMOUT_LSB 16 -#define TXPC_TXPC_SELCMOUT_MASK 'h00010000 -#define TXPC_TXPC_SELCMOUT_GET(x) (((x) & TXPC_TXPC_SELCMOUT_MASK) >> TXPC_TXPC_SELCMOUT_LSB) -#define TXPC_TXPC_SELCMOUT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELCMOUT_LSB) & TXPC_TXPC_SELCMOUT_MASK) -#define TXPC_TXPC_SELCMOUT_RESET 1'h0 -#define TXPC_TXPC_TSMODE_MSB 15 -#define TXPC_TXPC_TSMODE_LSB 14 -#define TXPC_TXPC_TSMODE_MASK 'h0000c000 -#define TXPC_TXPC_TSMODE_GET(x) (((x) & TXPC_TXPC_TSMODE_MASK) >> TXPC_TXPC_TSMODE_LSB) -#define TXPC_TXPC_TSMODE_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TSMODE_LSB) & TXPC_TXPC_TSMODE_MASK) -#define TXPC_TXPC_TSMODE_RESET 2'h0 -#define TXPC_TXPC_N_MSB 13 -#define TXPC_TXPC_N_LSB 6 -#define TXPC_TXPC_N_MASK 'h00003fc0 -#define TXPC_TXPC_N_GET(x) (((x) & TXPC_TXPC_N_MASK) >> TXPC_TXPC_N_LSB) -#define TXPC_TXPC_N_SET(x) (((32'd0 | (x)) << TXPC_TXPC_N_LSB) & TXPC_TXPC_N_MASK) -#define TXPC_TXPC_N_RESET 8'h80 -#define TXPC_TXPC_ON1STSYNTHON_MSB 5 -#define TXPC_TXPC_ON1STSYNTHON_LSB 5 -#define TXPC_TXPC_ON1STSYNTHON_MASK 'h00000020 -#define TXPC_TXPC_ON1STSYNTHON_GET(x) (((x) & TXPC_TXPC_ON1STSYNTHON_MASK) >> TXPC_TXPC_ON1STSYNTHON_LSB) -#define TXPC_TXPC_ON1STSYNTHON_SET(x) (((32'd0 | (x)) << TXPC_TXPC_ON1STSYNTHON_LSB) & TXPC_TXPC_ON1STSYNTHON_MASK) -#define TXPC_TXPC_ON1STSYNTHON_RESET 1'h1 -#define TXPC_TXPC_SELINIT_MSB 4 -#define TXPC_TXPC_SELINIT_LSB 3 -#define TXPC_TXPC_SELINIT_MASK 'h00000018 -#define TXPC_TXPC_SELINIT_GET(x) (((x) & TXPC_TXPC_SELINIT_MASK) >> TXPC_TXPC_SELINIT_LSB) -#define TXPC_TXPC_SELINIT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELINIT_LSB) & TXPC_TXPC_SELINIT_MASK) -#define TXPC_TXPC_SELINIT_RESET 2'h3 -#define TXPC_TXPC_SELCOUNT_MSB 2 -#define TXPC_TXPC_SELCOUNT_LSB 2 -#define TXPC_TXPC_SELCOUNT_MASK 'h00000004 -#define TXPC_TXPC_SELCOUNT_GET(x) (((x) & TXPC_TXPC_SELCOUNT_MASK) >> TXPC_TXPC_SELCOUNT_LSB) -#define TXPC_TXPC_SELCOUNT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELCOUNT_LSB) & TXPC_TXPC_SELCOUNT_MASK) -#define TXPC_TXPC_SELCOUNT_RESET 1'h1 -#define TXPC_TXPC_ATBSEL_MSB 1 -#define TXPC_TXPC_ATBSEL_LSB 0 -#define TXPC_TXPC_ATBSEL_MASK 'h00000003 -#define TXPC_TXPC_ATBSEL_GET(x) (((x) & TXPC_TXPC_ATBSEL_MASK) >> TXPC_TXPC_ATBSEL_LSB) -#define TXPC_TXPC_ATBSEL_SET(x) (((32'd0 | (x)) << TXPC_TXPC_ATBSEL_LSB) & TXPC_TXPC_ATBSEL_MASK) -#define TXPC_TXPC_ATBSEL_RESET 2'h0 -#define TXPC_TXPC_RESET (32'h0 | \ - TXPC_TXPC_SELINTPD_SET(TXPC_TXPC_SELINTPD_RESET) | \ - TXPC_TXPC_TEST_SET(TXPC_TXPC_TEST_RESET) | \ - TXPC_TXPC_TESTGAIN_SET(TXPC_TXPC_TESTGAIN_RESET) | \ - TXPC_TXPC_TESTDAC_SET(TXPC_TXPC_TESTDAC_RESET) | \ - TXPC_TXPC_TESTPWDPC_SET(TXPC_TXPC_TESTPWDPC_RESET) | \ - TXPC_TXPC_CURHALF_SET(TXPC_TXPC_CURHALF_RESET) | \ - TXPC_TXPC_NEGOUT_SET(TXPC_TXPC_NEGOUT_RESET) | \ - TXPC_TXPC_CLKDELAY_SET(TXPC_TXPC_CLKDELAY_RESET) | \ - TXPC_TXPC_SELMODREF_SET(TXPC_TXPC_SELMODREF_RESET) | \ - TXPC_TXPC_SELCMOUT_SET(TXPC_TXPC_SELCMOUT_RESET) | \ - TXPC_TXPC_TSMODE_SET(TXPC_TXPC_TSMODE_RESET) | \ - TXPC_TXPC_N_SET(TXPC_TXPC_N_RESET) | \ - TXPC_TXPC_ON1STSYNTHON_SET(TXPC_TXPC_ON1STSYNTHON_RESET) | \ - TXPC_TXPC_SELINIT_SET(TXPC_TXPC_SELINIT_RESET) | \ - TXPC_TXPC_SELCOUNT_SET(TXPC_TXPC_SELCOUNT_RESET) | \ - TXPC_TXPC_ATBSEL_SET(TXPC_TXPC_ATBSEL_RESET)) -#define TXPC_TXPC_HW_MASK (32'h0) -#define TXPC_TXPC_SW_MASK (32'h0 | \ - TXPC_TXPC_SELINTPD_MASK | \ - TXPC_TXPC_TEST_MASK | \ - TXPC_TXPC_TESTGAIN_MASK | \ - TXPC_TXPC_TESTDAC_MASK | \ - TXPC_TXPC_TESTPWDPC_MASK | \ - TXPC_TXPC_CURHALF_MASK | \ - TXPC_TXPC_NEGOUT_MASK | \ - TXPC_TXPC_CLKDELAY_MASK | \ - TXPC_TXPC_SELMODREF_MASK | \ - TXPC_TXPC_SELCMOUT_MASK | \ - TXPC_TXPC_TSMODE_MASK | \ - TXPC_TXPC_N_MASK | \ - TXPC_TXPC_ON1STSYNTHON_MASK | \ - TXPC_TXPC_SELINIT_MASK | \ - TXPC_TXPC_SELCOUNT_MASK | \ - TXPC_TXPC_ATBSEL_MASK) - -#define TXPC_MISC_ADDRESS 'h00000004 -#define TXPC_MISC_FLIPBMODE_MSB 31 -#define TXPC_MISC_FLIPBMODE_LSB 31 -#define TXPC_MISC_FLIPBMODE_MASK 'h80000000 -#define TXPC_MISC_FLIPBMODE_GET(x) (((x) & TXPC_MISC_FLIPBMODE_MASK) >> TXPC_MISC_FLIPBMODE_LSB) -#define TXPC_MISC_FLIPBMODE_SET(x) (((32'd0 | (x)) << TXPC_MISC_FLIPBMODE_LSB) & TXPC_MISC_FLIPBMODE_MASK) -#define TXPC_MISC_FLIPBMODE_RESET 1'h0 -#define TXPC_MISC_LEVEL_MSB 30 -#define TXPC_MISC_LEVEL_LSB 29 -#define TXPC_MISC_LEVEL_MASK 'h60000000 -#define TXPC_MISC_LEVEL_GET(x) (((x) & TXPC_MISC_LEVEL_MASK) >> TXPC_MISC_LEVEL_LSB) -#define TXPC_MISC_LEVEL_SET(x) (((32'd0 | (x)) << TXPC_MISC_LEVEL_LSB) & TXPC_MISC_LEVEL_MASK) -#define TXPC_MISC_LEVEL_RESET 2'h0 -#define TXPC_MISC_LDO_TEST_MODE_MSB 28 -#define TXPC_MISC_LDO_TEST_MODE_LSB 28 -#define TXPC_MISC_LDO_TEST_MODE_MASK 'h10000000 -#define TXPC_MISC_LDO_TEST_MODE_GET(x) (((x) & TXPC_MISC_LDO_TEST_MODE_MASK) >> TXPC_MISC_LDO_TEST_MODE_LSB) -#define TXPC_MISC_LDO_TEST_MODE_SET(x) (((32'd0 | (x)) << TXPC_MISC_LDO_TEST_MODE_LSB) & TXPC_MISC_LDO_TEST_MODE_MASK) -#define TXPC_MISC_LDO_TEST_MODE_RESET 1'h0 -#define TXPC_MISC_NOTCXODET_MSB 27 -#define TXPC_MISC_NOTCXODET_LSB 27 -#define TXPC_MISC_NOTCXODET_MASK 'h08000000 -#define TXPC_MISC_NOTCXODET_GET(x) (((x) & TXPC_MISC_NOTCXODET_MASK) >> TXPC_MISC_NOTCXODET_LSB) -#define TXPC_MISC_NOTCXODET_SET(x) (((32'd0 | (x)) << TXPC_MISC_NOTCXODET_LSB) & TXPC_MISC_NOTCXODET_MASK) -#define TXPC_MISC_NOTCXODET_RESET 1'h0 -#define TXPC_MISC_PWDCLKIND_MSB 26 -#define TXPC_MISC_PWDCLKIND_LSB 26 -#define TXPC_MISC_PWDCLKIND_MASK 'h04000000 -#define TXPC_MISC_PWDCLKIND_GET(x) (((x) & TXPC_MISC_PWDCLKIND_MASK) >> TXPC_MISC_PWDCLKIND_LSB) -#define TXPC_MISC_PWDCLKIND_SET(x) (((32'd0 | (x)) << TXPC_MISC_PWDCLKIND_LSB) & TXPC_MISC_PWDCLKIND_MASK) -#define TXPC_MISC_PWDCLKIND_RESET 1'h0 -#define TXPC_MISC_PWDXINPAD_MSB 25 -#define TXPC_MISC_PWDXINPAD_LSB 25 -#define TXPC_MISC_PWDXINPAD_MASK 'h02000000 -#define TXPC_MISC_PWDXINPAD_GET(x) (((x) & TXPC_MISC_PWDXINPAD_MASK) >> TXPC_MISC_PWDXINPAD_LSB) -#define TXPC_MISC_PWDXINPAD_SET(x) (((32'd0 | (x)) << TXPC_MISC_PWDXINPAD_LSB) & TXPC_MISC_PWDXINPAD_MASK) -#define TXPC_MISC_PWDXINPAD_RESET 1'h0 -#define TXPC_MISC_LOCALBIAS_MSB 24 -#define TXPC_MISC_LOCALBIAS_LSB 24 -#define TXPC_MISC_LOCALBIAS_MASK 'h01000000 -#define TXPC_MISC_LOCALBIAS_GET(x) (((x) & TXPC_MISC_LOCALBIAS_MASK) >> TXPC_MISC_LOCALBIAS_LSB) -#define TXPC_MISC_LOCALBIAS_SET(x) (((32'd0 | (x)) << TXPC_MISC_LOCALBIAS_LSB) & TXPC_MISC_LOCALBIAS_MASK) -#define TXPC_MISC_LOCALBIAS_RESET 1'h1 -#define TXPC_MISC_LOCALBIAS2X_MSB 23 -#define TXPC_MISC_LOCALBIAS2X_LSB 23 -#define TXPC_MISC_LOCALBIAS2X_MASK 'h00800000 -#define TXPC_MISC_LOCALBIAS2X_GET(x) (((x) & TXPC_MISC_LOCALBIAS2X_MASK) >> TXPC_MISC_LOCALBIAS2X_LSB) -#define TXPC_MISC_LOCALBIAS2X_SET(x) (((32'd0 | (x)) << TXPC_MISC_LOCALBIAS2X_LSB) & TXPC_MISC_LOCALBIAS2X_MASK) -#define TXPC_MISC_LOCALBIAS2X_RESET 1'h0 -#define TXPC_MISC_SELTSP_MSB 22 -#define TXPC_MISC_SELTSP_LSB 22 -#define TXPC_MISC_SELTSP_MASK 'h00400000 -#define TXPC_MISC_SELTSP_GET(x) (((x) & TXPC_MISC_SELTSP_MASK) >> TXPC_MISC_SELTSP_LSB) -#define TXPC_MISC_SELTSP_SET(x) (((32'd0 | (x)) << TXPC_MISC_SELTSP_LSB) & TXPC_MISC_SELTSP_MASK) -#define TXPC_MISC_SELTSP_RESET 1'h0 -#define TXPC_MISC_SELTSN_MSB 21 -#define TXPC_MISC_SELTSN_LSB 21 -#define TXPC_MISC_SELTSN_MASK 'h00200000 -#define TXPC_MISC_SELTSN_GET(x) (((x) & TXPC_MISC_SELTSN_MASK) >> TXPC_MISC_SELTSN_LSB) -#define TXPC_MISC_SELTSN_SET(x) (((32'd0 | (x)) << TXPC_MISC_SELTSN_LSB) & TXPC_MISC_SELTSN_MASK) -#define TXPC_MISC_SELTSN_RESET 1'h0 -#define TXPC_MISC_SPARE_A_MSB 20 -#define TXPC_MISC_SPARE_A_LSB 18 -#define TXPC_MISC_SPARE_A_MASK 'h001c0000 -#define TXPC_MISC_SPARE_A_GET(x) (((x) & TXPC_MISC_SPARE_A_MASK) >> TXPC_MISC_SPARE_A_LSB) -#define TXPC_MISC_SPARE_A_SET(x) (((32'd0 | (x)) << TXPC_MISC_SPARE_A_LSB) & TXPC_MISC_SPARE_A_MASK) -#define TXPC_MISC_SPARE_A_RESET 3'h0 -#define TXPC_MISC_DECOUT_MSB 17 -#define TXPC_MISC_DECOUT_LSB 8 -#define TXPC_MISC_DECOUT_MASK 'h0003ff00 -#define TXPC_MISC_DECOUT_GET(x) (((x) & TXPC_MISC_DECOUT_MASK) >> TXPC_MISC_DECOUT_LSB) -#define TXPC_MISC_DECOUT_SET(x) (((32'd0 | (x)) << TXPC_MISC_DECOUT_LSB) & TXPC_MISC_DECOUT_MASK) -#define TXPC_MISC_DECOUT_RESET 10'h0 -#define TXPC_MISC_XTALDIV_MSB 7 -#define TXPC_MISC_XTALDIV_LSB 6 -#define TXPC_MISC_XTALDIV_MASK 'h000000c0 -#define TXPC_MISC_XTALDIV_GET(x) (((x) & TXPC_MISC_XTALDIV_MASK) >> TXPC_MISC_XTALDIV_LSB) -#define TXPC_MISC_XTALDIV_SET(x) (((32'd0 | (x)) << TXPC_MISC_XTALDIV_LSB) & TXPC_MISC_XTALDIV_MASK) -#define TXPC_MISC_XTALDIV_RESET 2'h0 -#define TXPC_MISC_SPARE_MSB 5 -#define TXPC_MISC_SPARE_LSB 0 -#define TXPC_MISC_SPARE_MASK 'h0000003f -#define TXPC_MISC_SPARE_GET(x) (((x) & TXPC_MISC_SPARE_MASK) >> TXPC_MISC_SPARE_LSB) -#define TXPC_MISC_SPARE_SET(x) (((32'd0 | (x)) << TXPC_MISC_SPARE_LSB) & TXPC_MISC_SPARE_MASK) -#define TXPC_MISC_SPARE_RESET 6'h0 -#define TXPC_MISC_RESET (32'h0 | \ - TXPC_MISC_FLIPBMODE_SET(TXPC_MISC_FLIPBMODE_RESET) | \ - TXPC_MISC_LEVEL_SET(TXPC_MISC_LEVEL_RESET) | \ - TXPC_MISC_LDO_TEST_MODE_SET(TXPC_MISC_LDO_TEST_MODE_RESET) | \ - TXPC_MISC_NOTCXODET_SET(TXPC_MISC_NOTCXODET_RESET) | \ - TXPC_MISC_PWDCLKIND_SET(TXPC_MISC_PWDCLKIND_RESET) | \ - TXPC_MISC_PWDXINPAD_SET(TXPC_MISC_PWDXINPAD_RESET) | \ - TXPC_MISC_LOCALBIAS_SET(TXPC_MISC_LOCALBIAS_RESET) | \ - TXPC_MISC_LOCALBIAS2X_SET(TXPC_MISC_LOCALBIAS2X_RESET) | \ - TXPC_MISC_SELTSP_SET(TXPC_MISC_SELTSP_RESET) | \ - TXPC_MISC_SELTSN_SET(TXPC_MISC_SELTSN_RESET) | \ - TXPC_MISC_SPARE_A_SET(TXPC_MISC_SPARE_A_RESET) | \ - TXPC_MISC_DECOUT_SET(TXPC_MISC_DECOUT_RESET) | \ - TXPC_MISC_XTALDIV_SET(TXPC_MISC_XTALDIV_RESET) | \ - TXPC_MISC_SPARE_SET(TXPC_MISC_SPARE_RESET)) -#define TXPC_MISC_HW_MASK (32'h0 | \ - TXPC_MISC_DECOUT_MASK) -#define TXPC_MISC_SW_MASK (32'h0 | \ - TXPC_MISC_FLIPBMODE_MASK | \ - TXPC_MISC_LEVEL_MASK | \ - TXPC_MISC_LDO_TEST_MODE_MASK | \ - TXPC_MISC_NOTCXODET_MASK | \ - TXPC_MISC_PWDCLKIND_MASK | \ - TXPC_MISC_PWDXINPAD_MASK | \ - TXPC_MISC_LOCALBIAS_MASK | \ - TXPC_MISC_LOCALBIAS2X_MASK | \ - TXPC_MISC_SELTSP_MASK | \ - TXPC_MISC_SELTSN_MASK | \ - TXPC_MISC_SPARE_A_MASK | \ - TXPC_MISC_DECOUT_MASK | \ - TXPC_MISC_XTALDIV_MASK | \ - TXPC_MISC_SPARE_MASK) - -#define TXPC_REG_ADDRESS_MSB 2 - -#endif /* _TXPC_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/uart_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/uart_reg.h deleted file mode 100644 index 5db321b72b2c..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/uart_reg.h +++ /dev/null @@ -1,327 +0,0 @@ -#ifndef _UART_REG_REG_H_ -#define _UART_REG_REG_H_ - -#define RBR_ADDRESS 0x00000000 -#define RBR_OFFSET 0x00000000 -#define RBR_RBR_MSB 7 -#define RBR_RBR_LSB 0 -#define RBR_RBR_MASK 0x000000ff -#define RBR_RBR_GET(x) (((x) & RBR_RBR_MASK) >> RBR_RBR_LSB) -#define RBR_RBR_SET(x) (((x) << RBR_RBR_LSB) & RBR_RBR_MASK) - -#define THR_ADDRESS 0x00000000 -#define THR_OFFSET 0x00000000 -#define THR_THR_MSB 7 -#define THR_THR_LSB 0 -#define THR_THR_MASK 0x000000ff -#define THR_THR_GET(x) (((x) & THR_THR_MASK) >> THR_THR_LSB) -#define THR_THR_SET(x) (((x) << THR_THR_LSB) & THR_THR_MASK) - -#define DLL_ADDRESS 0x00000000 -#define DLL_OFFSET 0x00000000 -#define DLL_DLL_MSB 7 -#define DLL_DLL_LSB 0 -#define DLL_DLL_MASK 0x000000ff -#define DLL_DLL_GET(x) (((x) & DLL_DLL_MASK) >> DLL_DLL_LSB) -#define DLL_DLL_SET(x) (((x) << DLL_DLL_LSB) & DLL_DLL_MASK) - -#define DLH_ADDRESS 0x00000004 -#define DLH_OFFSET 0x00000004 -#define DLH_DLH_MSB 7 -#define DLH_DLH_LSB 0 -#define DLH_DLH_MASK 0x000000ff -#define DLH_DLH_GET(x) (((x) & DLH_DLH_MASK) >> DLH_DLH_LSB) -#define DLH_DLH_SET(x) (((x) << DLH_DLH_LSB) & DLH_DLH_MASK) - -#define IER_ADDRESS 0x00000004 -#define IER_OFFSET 0x00000004 -#define IER_EDDSI_MSB 3 -#define IER_EDDSI_LSB 3 -#define IER_EDDSI_MASK 0x00000008 -#define IER_EDDSI_GET(x) (((x) & IER_EDDSI_MASK) >> IER_EDDSI_LSB) -#define IER_EDDSI_SET(x) (((x) << IER_EDDSI_LSB) & IER_EDDSI_MASK) -#define IER_ELSI_MSB 2 -#define IER_ELSI_LSB 2 -#define IER_ELSI_MASK 0x00000004 -#define IER_ELSI_GET(x) (((x) & IER_ELSI_MASK) >> IER_ELSI_LSB) -#define IER_ELSI_SET(x) (((x) << IER_ELSI_LSB) & IER_ELSI_MASK) -#define IER_ETBEI_MSB 1 -#define IER_ETBEI_LSB 1 -#define IER_ETBEI_MASK 0x00000002 -#define IER_ETBEI_GET(x) (((x) & IER_ETBEI_MASK) >> IER_ETBEI_LSB) -#define IER_ETBEI_SET(x) (((x) << IER_ETBEI_LSB) & IER_ETBEI_MASK) -#define IER_ERBFI_MSB 0 -#define IER_ERBFI_LSB 0 -#define IER_ERBFI_MASK 0x00000001 -#define IER_ERBFI_GET(x) (((x) & IER_ERBFI_MASK) >> IER_ERBFI_LSB) -#define IER_ERBFI_SET(x) (((x) << IER_ERBFI_LSB) & IER_ERBFI_MASK) - -#define IIR_ADDRESS 0x00000008 -#define IIR_OFFSET 0x00000008 -#define IIR_FIFO_STATUS_MSB 7 -#define IIR_FIFO_STATUS_LSB 6 -#define IIR_FIFO_STATUS_MASK 0x000000c0 -#define IIR_FIFO_STATUS_GET(x) (((x) & IIR_FIFO_STATUS_MASK) >> IIR_FIFO_STATUS_LSB) -#define IIR_FIFO_STATUS_SET(x) (((x) << IIR_FIFO_STATUS_LSB) & IIR_FIFO_STATUS_MASK) -#define IIR_IID_MSB 3 -#define IIR_IID_LSB 0 -#define IIR_IID_MASK 0x0000000f -#define IIR_IID_GET(x) (((x) & IIR_IID_MASK) >> IIR_IID_LSB) -#define IIR_IID_SET(x) (((x) << IIR_IID_LSB) & IIR_IID_MASK) - -#define FCR_ADDRESS 0x00000008 -#define FCR_OFFSET 0x00000008 -#define FCR_RCVR_TRIG_MSB 7 -#define FCR_RCVR_TRIG_LSB 6 -#define FCR_RCVR_TRIG_MASK 0x000000c0 -#define FCR_RCVR_TRIG_GET(x) (((x) & FCR_RCVR_TRIG_MASK) >> FCR_RCVR_TRIG_LSB) -#define FCR_RCVR_TRIG_SET(x) (((x) << FCR_RCVR_TRIG_LSB) & FCR_RCVR_TRIG_MASK) -#define FCR_DMA_MODE_MSB 3 -#define FCR_DMA_MODE_LSB 3 -#define FCR_DMA_MODE_MASK 0x00000008 -#define FCR_DMA_MODE_GET(x) (((x) & FCR_DMA_MODE_MASK) >> FCR_DMA_MODE_LSB) -#define FCR_DMA_MODE_SET(x) (((x) << FCR_DMA_MODE_LSB) & FCR_DMA_MODE_MASK) -#define FCR_XMIT_FIFO_RST_MSB 2 -#define FCR_XMIT_FIFO_RST_LSB 2 -#define FCR_XMIT_FIFO_RST_MASK 0x00000004 -#define FCR_XMIT_FIFO_RST_GET(x) (((x) & FCR_XMIT_FIFO_RST_MASK) >> FCR_XMIT_FIFO_RST_LSB) -#define FCR_XMIT_FIFO_RST_SET(x) (((x) << FCR_XMIT_FIFO_RST_LSB) & FCR_XMIT_FIFO_RST_MASK) -#define FCR_RCVR_FIFO_RST_MSB 1 -#define FCR_RCVR_FIFO_RST_LSB 1 -#define FCR_RCVR_FIFO_RST_MASK 0x00000002 -#define FCR_RCVR_FIFO_RST_GET(x) (((x) & FCR_RCVR_FIFO_RST_MASK) >> FCR_RCVR_FIFO_RST_LSB) -#define FCR_RCVR_FIFO_RST_SET(x) (((x) << FCR_RCVR_FIFO_RST_LSB) & FCR_RCVR_FIFO_RST_MASK) -#define FCR_FIFO_EN_MSB 0 -#define FCR_FIFO_EN_LSB 0 -#define FCR_FIFO_EN_MASK 0x00000001 -#define FCR_FIFO_EN_GET(x) (((x) & FCR_FIFO_EN_MASK) >> FCR_FIFO_EN_LSB) -#define FCR_FIFO_EN_SET(x) (((x) << FCR_FIFO_EN_LSB) & FCR_FIFO_EN_MASK) - -#define LCR_ADDRESS 0x0000000c -#define LCR_OFFSET 0x0000000c -#define LCR_DLAB_MSB 7 -#define LCR_DLAB_LSB 7 -#define LCR_DLAB_MASK 0x00000080 -#define LCR_DLAB_GET(x) (((x) & LCR_DLAB_MASK) >> LCR_DLAB_LSB) -#define LCR_DLAB_SET(x) (((x) << LCR_DLAB_LSB) & LCR_DLAB_MASK) -#define LCR_BREAK_MSB 6 -#define LCR_BREAK_LSB 6 -#define LCR_BREAK_MASK 0x00000040 -#define LCR_BREAK_GET(x) (((x) & LCR_BREAK_MASK) >> LCR_BREAK_LSB) -#define LCR_BREAK_SET(x) (((x) << LCR_BREAK_LSB) & LCR_BREAK_MASK) -#define LCR_EPS_MSB 4 -#define LCR_EPS_LSB 4 -#define LCR_EPS_MASK 0x00000010 -#define LCR_EPS_GET(x) (((x) & LCR_EPS_MASK) >> LCR_EPS_LSB) -#define LCR_EPS_SET(x) (((x) << LCR_EPS_LSB) & LCR_EPS_MASK) -#define LCR_PEN_MSB 3 -#define LCR_PEN_LSB 3 -#define LCR_PEN_MASK 0x00000008 -#define LCR_PEN_GET(x) (((x) & LCR_PEN_MASK) >> LCR_PEN_LSB) -#define LCR_PEN_SET(x) (((x) << LCR_PEN_LSB) & LCR_PEN_MASK) -#define LCR_STOP_MSB 2 -#define LCR_STOP_LSB 2 -#define LCR_STOP_MASK 0x00000004 -#define LCR_STOP_GET(x) (((x) & LCR_STOP_MASK) >> LCR_STOP_LSB) -#define LCR_STOP_SET(x) (((x) << LCR_STOP_LSB) & LCR_STOP_MASK) -#define LCR_CLS_MSB 1 -#define LCR_CLS_LSB 0 -#define LCR_CLS_MASK 0x00000003 -#define LCR_CLS_GET(x) (((x) & LCR_CLS_MASK) >> LCR_CLS_LSB) -#define LCR_CLS_SET(x) (((x) << LCR_CLS_LSB) & LCR_CLS_MASK) - -#define MCR_ADDRESS 0x00000010 -#define MCR_OFFSET 0x00000010 -#define MCR_LOOPBACK_MSB 5 -#define MCR_LOOPBACK_LSB 5 -#define MCR_LOOPBACK_MASK 0x00000020 -#define MCR_LOOPBACK_GET(x) (((x) & MCR_LOOPBACK_MASK) >> MCR_LOOPBACK_LSB) -#define MCR_LOOPBACK_SET(x) (((x) << MCR_LOOPBACK_LSB) & MCR_LOOPBACK_MASK) -#define MCR_OUT2_MSB 3 -#define MCR_OUT2_LSB 3 -#define MCR_OUT2_MASK 0x00000008 -#define MCR_OUT2_GET(x) (((x) & MCR_OUT2_MASK) >> MCR_OUT2_LSB) -#define MCR_OUT2_SET(x) (((x) << MCR_OUT2_LSB) & MCR_OUT2_MASK) -#define MCR_OUT1_MSB 2 -#define MCR_OUT1_LSB 2 -#define MCR_OUT1_MASK 0x00000004 -#define MCR_OUT1_GET(x) (((x) & MCR_OUT1_MASK) >> MCR_OUT1_LSB) -#define MCR_OUT1_SET(x) (((x) << MCR_OUT1_LSB) & MCR_OUT1_MASK) -#define MCR_RTS_MSB 1 -#define MCR_RTS_LSB 1 -#define MCR_RTS_MASK 0x00000002 -#define MCR_RTS_GET(x) (((x) & MCR_RTS_MASK) >> MCR_RTS_LSB) -#define MCR_RTS_SET(x) (((x) << MCR_RTS_LSB) & MCR_RTS_MASK) -#define MCR_DTR_MSB 0 -#define MCR_DTR_LSB 0 -#define MCR_DTR_MASK 0x00000001 -#define MCR_DTR_GET(x) (((x) & MCR_DTR_MASK) >> MCR_DTR_LSB) -#define MCR_DTR_SET(x) (((x) << MCR_DTR_LSB) & MCR_DTR_MASK) - -#define LSR_ADDRESS 0x00000014 -#define LSR_OFFSET 0x00000014 -#define LSR_FERR_MSB 7 -#define LSR_FERR_LSB 7 -#define LSR_FERR_MASK 0x00000080 -#define LSR_FERR_GET(x) (((x) & LSR_FERR_MASK) >> LSR_FERR_LSB) -#define LSR_FERR_SET(x) (((x) << LSR_FERR_LSB) & LSR_FERR_MASK) -#define LSR_TEMT_MSB 6 -#define LSR_TEMT_LSB 6 -#define LSR_TEMT_MASK 0x00000040 -#define LSR_TEMT_GET(x) (((x) & LSR_TEMT_MASK) >> LSR_TEMT_LSB) -#define LSR_TEMT_SET(x) (((x) << LSR_TEMT_LSB) & LSR_TEMT_MASK) -#define LSR_THRE_MSB 5 -#define LSR_THRE_LSB 5 -#define LSR_THRE_MASK 0x00000020 -#define LSR_THRE_GET(x) (((x) & LSR_THRE_MASK) >> LSR_THRE_LSB) -#define LSR_THRE_SET(x) (((x) << LSR_THRE_LSB) & LSR_THRE_MASK) -#define LSR_BI_MSB 4 -#define LSR_BI_LSB 4 -#define LSR_BI_MASK 0x00000010 -#define LSR_BI_GET(x) (((x) & LSR_BI_MASK) >> LSR_BI_LSB) -#define LSR_BI_SET(x) (((x) << LSR_BI_LSB) & LSR_BI_MASK) -#define LSR_FE_MSB 3 -#define LSR_FE_LSB 3 -#define LSR_FE_MASK 0x00000008 -#define LSR_FE_GET(x) (((x) & LSR_FE_MASK) >> LSR_FE_LSB) -#define LSR_FE_SET(x) (((x) << LSR_FE_LSB) & LSR_FE_MASK) -#define LSR_PE_MSB 2 -#define LSR_PE_LSB 2 -#define LSR_PE_MASK 0x00000004 -#define LSR_PE_GET(x) (((x) & LSR_PE_MASK) >> LSR_PE_LSB) -#define LSR_PE_SET(x) (((x) << LSR_PE_LSB) & LSR_PE_MASK) -#define LSR_OE_MSB 1 -#define LSR_OE_LSB 1 -#define LSR_OE_MASK 0x00000002 -#define LSR_OE_GET(x) (((x) & LSR_OE_MASK) >> LSR_OE_LSB) -#define LSR_OE_SET(x) (((x) << LSR_OE_LSB) & LSR_OE_MASK) -#define LSR_DR_MSB 0 -#define LSR_DR_LSB 0 -#define LSR_DR_MASK 0x00000001 -#define LSR_DR_GET(x) (((x) & LSR_DR_MASK) >> LSR_DR_LSB) -#define LSR_DR_SET(x) (((x) << LSR_DR_LSB) & LSR_DR_MASK) - -#define MSR_ADDRESS 0x00000018 -#define MSR_OFFSET 0x00000018 -#define MSR_DCD_MSB 7 -#define MSR_DCD_LSB 7 -#define MSR_DCD_MASK 0x00000080 -#define MSR_DCD_GET(x) (((x) & MSR_DCD_MASK) >> MSR_DCD_LSB) -#define MSR_DCD_SET(x) (((x) << MSR_DCD_LSB) & MSR_DCD_MASK) -#define MSR_RI_MSB 6 -#define MSR_RI_LSB 6 -#define MSR_RI_MASK 0x00000040 -#define MSR_RI_GET(x) (((x) & MSR_RI_MASK) >> MSR_RI_LSB) -#define MSR_RI_SET(x) (((x) << MSR_RI_LSB) & MSR_RI_MASK) -#define MSR_DSR_MSB 5 -#define MSR_DSR_LSB 5 -#define MSR_DSR_MASK 0x00000020 -#define MSR_DSR_GET(x) (((x) & MSR_DSR_MASK) >> MSR_DSR_LSB) -#define MSR_DSR_SET(x) (((x) << MSR_DSR_LSB) & MSR_DSR_MASK) -#define MSR_CTS_MSB 4 -#define MSR_CTS_LSB 4 -#define MSR_CTS_MASK 0x00000010 -#define MSR_CTS_GET(x) (((x) & MSR_CTS_MASK) >> MSR_CTS_LSB) -#define MSR_CTS_SET(x) (((x) << MSR_CTS_LSB) & MSR_CTS_MASK) -#define MSR_DDCD_MSB 3 -#define MSR_DDCD_LSB 3 -#define MSR_DDCD_MASK 0x00000008 -#define MSR_DDCD_GET(x) (((x) & MSR_DDCD_MASK) >> MSR_DDCD_LSB) -#define MSR_DDCD_SET(x) (((x) << MSR_DDCD_LSB) & MSR_DDCD_MASK) -#define MSR_TERI_MSB 2 -#define MSR_TERI_LSB 2 -#define MSR_TERI_MASK 0x00000004 -#define MSR_TERI_GET(x) (((x) & MSR_TERI_MASK) >> MSR_TERI_LSB) -#define MSR_TERI_SET(x) (((x) << MSR_TERI_LSB) & MSR_TERI_MASK) -#define MSR_DDSR_MSB 1 -#define MSR_DDSR_LSB 1 -#define MSR_DDSR_MASK 0x00000002 -#define MSR_DDSR_GET(x) (((x) & MSR_DDSR_MASK) >> MSR_DDSR_LSB) -#define MSR_DDSR_SET(x) (((x) << MSR_DDSR_LSB) & MSR_DDSR_MASK) -#define MSR_DCTS_MSB 0 -#define MSR_DCTS_LSB 0 -#define MSR_DCTS_MASK 0x00000001 -#define MSR_DCTS_GET(x) (((x) & MSR_DCTS_MASK) >> MSR_DCTS_LSB) -#define MSR_DCTS_SET(x) (((x) << MSR_DCTS_LSB) & MSR_DCTS_MASK) - -#define SCR_ADDRESS 0x0000001c -#define SCR_OFFSET 0x0000001c -#define SCR_SCR_MSB 7 -#define SCR_SCR_LSB 0 -#define SCR_SCR_MASK 0x000000ff -#define SCR_SCR_GET(x) (((x) & SCR_SCR_MASK) >> SCR_SCR_LSB) -#define SCR_SCR_SET(x) (((x) << SCR_SCR_LSB) & SCR_SCR_MASK) - -#define SRBR_ADDRESS 0x00000020 -#define SRBR_OFFSET 0x00000020 -#define SRBR_SRBR_MSB 7 -#define SRBR_SRBR_LSB 0 -#define SRBR_SRBR_MASK 0x000000ff -#define SRBR_SRBR_GET(x) (((x) & SRBR_SRBR_MASK) >> SRBR_SRBR_LSB) -#define SRBR_SRBR_SET(x) (((x) << SRBR_SRBR_LSB) & SRBR_SRBR_MASK) - -#define SIIR_ADDRESS 0x00000028 -#define SIIR_OFFSET 0x00000028 -#define SIIR_SIIR_MSB 7 -#define SIIR_SIIR_LSB 0 -#define SIIR_SIIR_MASK 0x000000ff -#define SIIR_SIIR_GET(x) (((x) & SIIR_SIIR_MASK) >> SIIR_SIIR_LSB) -#define SIIR_SIIR_SET(x) (((x) << SIIR_SIIR_LSB) & SIIR_SIIR_MASK) - -#define MWR_ADDRESS 0x0000002c -#define MWR_OFFSET 0x0000002c -#define MWR_MWR_MSB 31 -#define MWR_MWR_LSB 0 -#define MWR_MWR_MASK 0xffffffff -#define MWR_MWR_GET(x) (((x) & MWR_MWR_MASK) >> MWR_MWR_LSB) -#define MWR_MWR_SET(x) (((x) << MWR_MWR_LSB) & MWR_MWR_MASK) - -#define SLSR_ADDRESS 0x00000034 -#define SLSR_OFFSET 0x00000034 -#define SLSR_SLSR_MSB 7 -#define SLSR_SLSR_LSB 0 -#define SLSR_SLSR_MASK 0x000000ff -#define SLSR_SLSR_GET(x) (((x) & SLSR_SLSR_MASK) >> SLSR_SLSR_LSB) -#define SLSR_SLSR_SET(x) (((x) << SLSR_SLSR_LSB) & SLSR_SLSR_MASK) - -#define SMSR_ADDRESS 0x00000038 -#define SMSR_OFFSET 0x00000038 -#define SMSR_SMSR_MSB 7 -#define SMSR_SMSR_LSB 0 -#define SMSR_SMSR_MASK 0x000000ff -#define SMSR_SMSR_GET(x) (((x) & SMSR_SMSR_MASK) >> SMSR_SMSR_LSB) -#define SMSR_SMSR_SET(x) (((x) << SMSR_SMSR_LSB) & SMSR_SMSR_MASK) - -#define MRR_ADDRESS 0x0000003c -#define MRR_OFFSET 0x0000003c -#define MRR_MRR_MSB 31 -#define MRR_MRR_LSB 0 -#define MRR_MRR_MASK 0xffffffff -#define MRR_MRR_GET(x) (((x) & MRR_MRR_MASK) >> MRR_MRR_LSB) -#define MRR_MRR_SET(x) (((x) << MRR_MRR_LSB) & MRR_MRR_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct uart_reg_reg_s { - volatile unsigned int rbr; - volatile unsigned int dlh; - volatile unsigned int iir; - volatile unsigned int lcr; - volatile unsigned int mcr; - volatile unsigned int lsr; - volatile unsigned int msr; - volatile unsigned int scr; - volatile unsigned int srbr; - unsigned char pad0[4]; /* pad to 0x28 */ - volatile unsigned int siir; - volatile unsigned int mwr; - unsigned char pad1[4]; /* pad to 0x34 */ - volatile unsigned int slsr; - volatile unsigned int smsr; - volatile unsigned int mrr; -} uart_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _UART_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/uart_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/uart_reg.vrh deleted file mode 100644 index fe59c18daa3f..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/uart_reg.vrh +++ /dev/null @@ -1,488 +0,0 @@ -#ifndef _UART_REG_VRH_ -#define _UART_REG_VRH_ - -#define RBR_ADDRESS 'h00000000 -#define RBR_RBR_MSB 7 -#define RBR_RBR_LSB 0 -#define RBR_RBR_MASK 'h000000ff -#define RBR_RBR_GET(x) (((x) & RBR_RBR_MASK) >> RBR_RBR_LSB) -#define RBR_RBR_SET(x) (((32'd0 | (x)) << RBR_RBR_LSB) & RBR_RBR_MASK) -#define RBR_RBR_RESET 8'h0 -#define RBR_RESET (32'h0 | \ - RBR_RBR_SET(RBR_RBR_RESET)) -#define RBR_HW_MASK (32'h0 | \ - RBR_RBR_MASK) -#define RBR_SW_MASK (32'h0) - -#define THR_ADDRESS 'h00000000 -#define THR_THR_MSB 7 -#define THR_THR_LSB 0 -#define THR_THR_MASK 'h000000ff -#define THR_THR_GET(x) (((x) & THR_THR_MASK) >> THR_THR_LSB) -#define THR_THR_SET(x) (((32'd0 | (x)) << THR_THR_LSB) & THR_THR_MASK) -#define THR_THR_RESET 8'h0 -#define THR_RESET (32'h0 | \ - THR_THR_SET(THR_THR_RESET)) -#define THR_HW_MASK (32'h0) -#define THR_SW_MASK (32'h0 | \ - THR_THR_MASK) - -#define DLL_ADDRESS 'h00000000 -#define DLL_DLL_MSB 7 -#define DLL_DLL_LSB 0 -#define DLL_DLL_MASK 'h000000ff -#define DLL_DLL_GET(x) (((x) & DLL_DLL_MASK) >> DLL_DLL_LSB) -#define DLL_DLL_SET(x) (((32'd0 | (x)) << DLL_DLL_LSB) & DLL_DLL_MASK) -#define DLL_DLL_RESET 8'h0 -#define DLL_RESET (32'h0 | \ - DLL_DLL_SET(DLL_DLL_RESET)) -#define DLL_HW_MASK (32'h0) -#define DLL_SW_MASK (32'h0 | \ - DLL_DLL_MASK) - -#define DLH_ADDRESS 'h00000004 -#define DLH_DLH_MSB 7 -#define DLH_DLH_LSB 0 -#define DLH_DLH_MASK 'h000000ff -#define DLH_DLH_GET(x) (((x) & DLH_DLH_MASK) >> DLH_DLH_LSB) -#define DLH_DLH_SET(x) (((32'd0 | (x)) << DLH_DLH_LSB) & DLH_DLH_MASK) -#define DLH_DLH_RESET 8'h0 -#define DLH_RESET (32'h0 | \ - DLH_DLH_SET(DLH_DLH_RESET)) -#define DLH_HW_MASK (32'h0) -#define DLH_SW_MASK (32'h0 | \ - DLH_DLH_MASK) - -#define IER_ADDRESS 'h00000004 -#define IER_EDDSI_MSB 3 -#define IER_EDDSI_LSB 3 -#define IER_EDDSI_MASK 'h00000008 -#define IER_EDDSI_GET(x) (((x) & IER_EDDSI_MASK) >> IER_EDDSI_LSB) -#define IER_EDDSI_SET(x) (((32'd0 | (x)) << IER_EDDSI_LSB) & IER_EDDSI_MASK) -#define IER_EDDSI_RESET 1'h0 -#define IER_ELSI_MSB 2 -#define IER_ELSI_LSB 2 -#define IER_ELSI_MASK 'h00000004 -#define IER_ELSI_GET(x) (((x) & IER_ELSI_MASK) >> IER_ELSI_LSB) -#define IER_ELSI_SET(x) (((32'd0 | (x)) << IER_ELSI_LSB) & IER_ELSI_MASK) -#define IER_ELSI_RESET 1'h0 -#define IER_ETBEI_MSB 1 -#define IER_ETBEI_LSB 1 -#define IER_ETBEI_MASK 'h00000002 -#define IER_ETBEI_GET(x) (((x) & IER_ETBEI_MASK) >> IER_ETBEI_LSB) -#define IER_ETBEI_SET(x) (((32'd0 | (x)) << IER_ETBEI_LSB) & IER_ETBEI_MASK) -#define IER_ETBEI_RESET 1'h0 -#define IER_ERBFI_MSB 0 -#define IER_ERBFI_LSB 0 -#define IER_ERBFI_MASK 'h00000001 -#define IER_ERBFI_GET(x) (((x) & IER_ERBFI_MASK) >> IER_ERBFI_LSB) -#define IER_ERBFI_SET(x) (((32'd0 | (x)) << IER_ERBFI_LSB) & IER_ERBFI_MASK) -#define IER_ERBFI_RESET 1'h0 -#define IER_RESET (32'h0 | \ - IER_EDDSI_SET(IER_EDDSI_RESET) | \ - IER_ELSI_SET(IER_ELSI_RESET) | \ - IER_ETBEI_SET(IER_ETBEI_RESET) | \ - IER_ERBFI_SET(IER_ERBFI_RESET)) -#define IER_HW_MASK (32'h0) -#define IER_SW_MASK (32'h0 | \ - IER_EDDSI_MASK | \ - IER_ELSI_MASK | \ - IER_ETBEI_MASK | \ - IER_ERBFI_MASK) - -#define IIR_ADDRESS 'h00000008 -#define IIR_FIFO_STATUS_MSB 7 -#define IIR_FIFO_STATUS_LSB 6 -#define IIR_FIFO_STATUS_MASK 'h000000c0 -#define IIR_FIFO_STATUS_GET(x) (((x) & IIR_FIFO_STATUS_MASK) >> IIR_FIFO_STATUS_LSB) -#define IIR_FIFO_STATUS_SET(x) (((32'd0 | (x)) << IIR_FIFO_STATUS_LSB) & IIR_FIFO_STATUS_MASK) -#define IIR_FIFO_STATUS_RESET 2'h0 -#define IIR_IID_MSB 3 -#define IIR_IID_LSB 0 -#define IIR_IID_MASK 'h0000000f -#define IIR_IID_GET(x) (((x) & IIR_IID_MASK) >> IIR_IID_LSB) -#define IIR_IID_SET(x) (((32'd0 | (x)) << IIR_IID_LSB) & IIR_IID_MASK) -#define IIR_IID_RESET 4'h0 -#define IIR_RESET (32'h0 | \ - IIR_FIFO_STATUS_SET(IIR_FIFO_STATUS_RESET) | \ - IIR_IID_SET(IIR_IID_RESET)) -#define IIR_HW_MASK (32'h0 | \ - IIR_FIFO_STATUS_MASK | \ - IIR_IID_MASK) -#define IIR_SW_MASK (32'h0) - -#define FCR_ADDRESS 'h00000008 -#define FCR_RCVR_TRIG_MSB 7 -#define FCR_RCVR_TRIG_LSB 6 -#define FCR_RCVR_TRIG_MASK 'h000000c0 -#define FCR_RCVR_TRIG_GET(x) (((x) & FCR_RCVR_TRIG_MASK) >> FCR_RCVR_TRIG_LSB) -#define FCR_RCVR_TRIG_SET(x) (((32'd0 | (x)) << FCR_RCVR_TRIG_LSB) & FCR_RCVR_TRIG_MASK) -#define FCR_RCVR_TRIG_RESET 2'h0 -#define FCR_DMA_MODE_MSB 3 -#define FCR_DMA_MODE_LSB 3 -#define FCR_DMA_MODE_MASK 'h00000008 -#define FCR_DMA_MODE_GET(x) (((x) & FCR_DMA_MODE_MASK) >> FCR_DMA_MODE_LSB) -#define FCR_DMA_MODE_SET(x) (((32'd0 | (x)) << FCR_DMA_MODE_LSB) & FCR_DMA_MODE_MASK) -#define FCR_DMA_MODE_RESET 1'h0 -#define FCR_XMIT_FIFO_RST_MSB 2 -#define FCR_XMIT_FIFO_RST_LSB 2 -#define FCR_XMIT_FIFO_RST_MASK 'h00000004 -#define FCR_XMIT_FIFO_RST_GET(x) (((x) & FCR_XMIT_FIFO_RST_MASK) >> FCR_XMIT_FIFO_RST_LSB) -#define FCR_XMIT_FIFO_RST_SET(x) (((32'd0 | (x)) << FCR_XMIT_FIFO_RST_LSB) & FCR_XMIT_FIFO_RST_MASK) -#define FCR_XMIT_FIFO_RST_RESET 1'h0 -#define FCR_RCVR_FIFO_RST_MSB 1 -#define FCR_RCVR_FIFO_RST_LSB 1 -#define FCR_RCVR_FIFO_RST_MASK 'h00000002 -#define FCR_RCVR_FIFO_RST_GET(x) (((x) & FCR_RCVR_FIFO_RST_MASK) >> FCR_RCVR_FIFO_RST_LSB) -#define FCR_RCVR_FIFO_RST_SET(x) (((32'd0 | (x)) << FCR_RCVR_FIFO_RST_LSB) & FCR_RCVR_FIFO_RST_MASK) -#define FCR_RCVR_FIFO_RST_RESET 1'h0 -#define FCR_FIFO_EN_MSB 0 -#define FCR_FIFO_EN_LSB 0 -#define FCR_FIFO_EN_MASK 'h00000001 -#define FCR_FIFO_EN_GET(x) (((x) & FCR_FIFO_EN_MASK) >> FCR_FIFO_EN_LSB) -#define FCR_FIFO_EN_SET(x) (((32'd0 | (x)) << FCR_FIFO_EN_LSB) & FCR_FIFO_EN_MASK) -#define FCR_FIFO_EN_RESET 1'h0 -#define FCR_RESET (32'h0 | \ - FCR_RCVR_TRIG_SET(FCR_RCVR_TRIG_RESET) | \ - FCR_DMA_MODE_SET(FCR_DMA_MODE_RESET) | \ - FCR_XMIT_FIFO_RST_SET(FCR_XMIT_FIFO_RST_RESET) | \ - FCR_RCVR_FIFO_RST_SET(FCR_RCVR_FIFO_RST_RESET) | \ - FCR_FIFO_EN_SET(FCR_FIFO_EN_RESET)) -#define FCR_HW_MASK (32'h0) -#define FCR_SW_MASK (32'h0 | \ - FCR_RCVR_TRIG_MASK | \ - FCR_DMA_MODE_MASK | \ - FCR_XMIT_FIFO_RST_MASK | \ - FCR_RCVR_FIFO_RST_MASK | \ - FCR_FIFO_EN_MASK) - -#define LCR_ADDRESS 'h0000000c -#define LCR_DLAB_MSB 7 -#define LCR_DLAB_LSB 7 -#define LCR_DLAB_MASK 'h00000080 -#define LCR_DLAB_GET(x) (((x) & LCR_DLAB_MASK) >> LCR_DLAB_LSB) -#define LCR_DLAB_SET(x) (((32'd0 | (x)) << LCR_DLAB_LSB) & LCR_DLAB_MASK) -#define LCR_DLAB_RESET 1'h0 -#define LCR_BREAK_MSB 6 -#define LCR_BREAK_LSB 6 -#define LCR_BREAK_MASK 'h00000040 -#define LCR_BREAK_GET(x) (((x) & LCR_BREAK_MASK) >> LCR_BREAK_LSB) -#define LCR_BREAK_SET(x) (((32'd0 | (x)) << LCR_BREAK_LSB) & LCR_BREAK_MASK) -#define LCR_BREAK_RESET 1'h0 -#define LCR_EPS_MSB 4 -#define LCR_EPS_LSB 4 -#define LCR_EPS_MASK 'h00000010 -#define LCR_EPS_GET(x) (((x) & LCR_EPS_MASK) >> LCR_EPS_LSB) -#define LCR_EPS_SET(x) (((32'd0 | (x)) << LCR_EPS_LSB) & LCR_EPS_MASK) -#define LCR_EPS_RESET 1'h0 -#define LCR_PEN_MSB 3 -#define LCR_PEN_LSB 3 -#define LCR_PEN_MASK 'h00000008 -#define LCR_PEN_GET(x) (((x) & LCR_PEN_MASK) >> LCR_PEN_LSB) -#define LCR_PEN_SET(x) (((32'd0 | (x)) << LCR_PEN_LSB) & LCR_PEN_MASK) -#define LCR_PEN_RESET 1'h0 -#define LCR_STOP_MSB 2 -#define LCR_STOP_LSB 2 -#define LCR_STOP_MASK 'h00000004 -#define LCR_STOP_GET(x) (((x) & LCR_STOP_MASK) >> LCR_STOP_LSB) -#define LCR_STOP_SET(x) (((32'd0 | (x)) << LCR_STOP_LSB) & LCR_STOP_MASK) -#define LCR_STOP_RESET 1'h0 -#define LCR_CLS_MSB 1 -#define LCR_CLS_LSB 0 -#define LCR_CLS_MASK 'h00000003 -#define LCR_CLS_GET(x) (((x) & LCR_CLS_MASK) >> LCR_CLS_LSB) -#define LCR_CLS_SET(x) (((32'd0 | (x)) << LCR_CLS_LSB) & LCR_CLS_MASK) -#define LCR_CLS_RESET 2'h0 -#define LCR_RESET (32'h0 | \ - LCR_DLAB_SET(LCR_DLAB_RESET) | \ - LCR_BREAK_SET(LCR_BREAK_RESET) | \ - LCR_EPS_SET(LCR_EPS_RESET) | \ - LCR_PEN_SET(LCR_PEN_RESET) | \ - LCR_STOP_SET(LCR_STOP_RESET) | \ - LCR_CLS_SET(LCR_CLS_RESET)) -#define LCR_HW_MASK (32'h0) -#define LCR_SW_MASK (32'h0 | \ - LCR_DLAB_MASK | \ - LCR_BREAK_MASK | \ - LCR_EPS_MASK | \ - LCR_PEN_MASK | \ - LCR_STOP_MASK | \ - LCR_CLS_MASK) - -#define MCR_ADDRESS 'h00000010 -#define MCR_LOOPBACK_MSB 5 -#define MCR_LOOPBACK_LSB 5 -#define MCR_LOOPBACK_MASK 'h00000020 -#define MCR_LOOPBACK_GET(x) (((x) & MCR_LOOPBACK_MASK) >> MCR_LOOPBACK_LSB) -#define MCR_LOOPBACK_SET(x) (((32'd0 | (x)) << MCR_LOOPBACK_LSB) & MCR_LOOPBACK_MASK) -#define MCR_LOOPBACK_RESET 1'h1 -#define MCR_OUT2_MSB 3 -#define MCR_OUT2_LSB 3 -#define MCR_OUT2_MASK 'h00000008 -#define MCR_OUT2_GET(x) (((x) & MCR_OUT2_MASK) >> MCR_OUT2_LSB) -#define MCR_OUT2_SET(x) (((32'd0 | (x)) << MCR_OUT2_LSB) & MCR_OUT2_MASK) -#define MCR_OUT2_RESET 1'h1 -#define MCR_OUT1_MSB 2 -#define MCR_OUT1_LSB 2 -#define MCR_OUT1_MASK 'h00000004 -#define MCR_OUT1_GET(x) (((x) & MCR_OUT1_MASK) >> MCR_OUT1_LSB) -#define MCR_OUT1_SET(x) (((32'd0 | (x)) << MCR_OUT1_LSB) & MCR_OUT1_MASK) -#define MCR_OUT1_RESET 1'h1 -#define MCR_RTS_MSB 1 -#define MCR_RTS_LSB 1 -#define MCR_RTS_MASK 'h00000002 -#define MCR_RTS_GET(x) (((x) & MCR_RTS_MASK) >> MCR_RTS_LSB) -#define MCR_RTS_SET(x) (((32'd0 | (x)) << MCR_RTS_LSB) & MCR_RTS_MASK) -#define MCR_RTS_RESET 1'h1 -#define MCR_DTR_MSB 0 -#define MCR_DTR_LSB 0 -#define MCR_DTR_MASK 'h00000001 -#define MCR_DTR_GET(x) (((x) & MCR_DTR_MASK) >> MCR_DTR_LSB) -#define MCR_DTR_SET(x) (((32'd0 | (x)) << MCR_DTR_LSB) & MCR_DTR_MASK) -#define MCR_DTR_RESET 1'h1 -#define MCR_RESET (32'h0 | \ - MCR_LOOPBACK_SET(MCR_LOOPBACK_RESET) | \ - MCR_OUT2_SET(MCR_OUT2_RESET) | \ - MCR_OUT1_SET(MCR_OUT1_RESET) | \ - MCR_RTS_SET(MCR_RTS_RESET) | \ - MCR_DTR_SET(MCR_DTR_RESET)) -#define MCR_HW_MASK (32'h0) -#define MCR_SW_MASK (32'h0 | \ - MCR_LOOPBACK_MASK | \ - MCR_OUT2_MASK | \ - MCR_OUT1_MASK | \ - MCR_RTS_MASK | \ - MCR_DTR_MASK) - -#define LSR_ADDRESS 'h00000014 -#define LSR_FERR_MSB 7 -#define LSR_FERR_LSB 7 -#define LSR_FERR_MASK 'h00000080 -#define LSR_FERR_GET(x) (((x) & LSR_FERR_MASK) >> LSR_FERR_LSB) -#define LSR_FERR_SET(x) (((32'd0 | (x)) << LSR_FERR_LSB) & LSR_FERR_MASK) -#define LSR_FERR_RESET 1'h0 -#define LSR_TEMT_MSB 6 -#define LSR_TEMT_LSB 6 -#define LSR_TEMT_MASK 'h00000040 -#define LSR_TEMT_GET(x) (((x) & LSR_TEMT_MASK) >> LSR_TEMT_LSB) -#define LSR_TEMT_SET(x) (((32'd0 | (x)) << LSR_TEMT_LSB) & LSR_TEMT_MASK) -#define LSR_TEMT_RESET 1'h0 -#define LSR_THRE_MSB 5 -#define LSR_THRE_LSB 5 -#define LSR_THRE_MASK 'h00000020 -#define LSR_THRE_GET(x) (((x) & LSR_THRE_MASK) >> LSR_THRE_LSB) -#define LSR_THRE_SET(x) (((32'd0 | (x)) << LSR_THRE_LSB) & LSR_THRE_MASK) -#define LSR_THRE_RESET 1'h0 -#define LSR_BI_MSB 4 -#define LSR_BI_LSB 4 -#define LSR_BI_MASK 'h00000010 -#define LSR_BI_GET(x) (((x) & LSR_BI_MASK) >> LSR_BI_LSB) -#define LSR_BI_SET(x) (((32'd0 | (x)) << LSR_BI_LSB) & LSR_BI_MASK) -#define LSR_BI_RESET 1'h0 -#define LSR_FE_MSB 3 -#define LSR_FE_LSB 3 -#define LSR_FE_MASK 'h00000008 -#define LSR_FE_GET(x) (((x) & LSR_FE_MASK) >> LSR_FE_LSB) -#define LSR_FE_SET(x) (((32'd0 | (x)) << LSR_FE_LSB) & LSR_FE_MASK) -#define LSR_FE_RESET 1'h0 -#define LSR_PE_MSB 2 -#define LSR_PE_LSB 2 -#define LSR_PE_MASK 'h00000004 -#define LSR_PE_GET(x) (((x) & LSR_PE_MASK) >> LSR_PE_LSB) -#define LSR_PE_SET(x) (((32'd0 | (x)) << LSR_PE_LSB) & LSR_PE_MASK) -#define LSR_PE_RESET 1'h0 -#define LSR_OE_MSB 1 -#define LSR_OE_LSB 1 -#define LSR_OE_MASK 'h00000002 -#define LSR_OE_GET(x) (((x) & LSR_OE_MASK) >> LSR_OE_LSB) -#define LSR_OE_SET(x) (((32'd0 | (x)) << LSR_OE_LSB) & LSR_OE_MASK) -#define LSR_OE_RESET 1'h0 -#define LSR_DR_MSB 0 -#define LSR_DR_LSB 0 -#define LSR_DR_MASK 'h00000001 -#define LSR_DR_GET(x) (((x) & LSR_DR_MASK) >> LSR_DR_LSB) -#define LSR_DR_SET(x) (((32'd0 | (x)) << LSR_DR_LSB) & LSR_DR_MASK) -#define LSR_DR_RESET 1'h0 -#define LSR_RESET (32'h0 | \ - LSR_FERR_SET(LSR_FERR_RESET) | \ - LSR_TEMT_SET(LSR_TEMT_RESET) | \ - LSR_THRE_SET(LSR_THRE_RESET) | \ - LSR_BI_SET(LSR_BI_RESET) | \ - LSR_FE_SET(LSR_FE_RESET) | \ - LSR_PE_SET(LSR_PE_RESET) | \ - LSR_OE_SET(LSR_OE_RESET) | \ - LSR_DR_SET(LSR_DR_RESET)) -#define LSR_HW_MASK (32'h0) -#define LSR_SW_MASK (32'h0 | \ - LSR_FERR_MASK | \ - LSR_TEMT_MASK | \ - LSR_THRE_MASK | \ - LSR_BI_MASK | \ - LSR_FE_MASK | \ - LSR_PE_MASK | \ - LSR_OE_MASK | \ - LSR_DR_MASK) - -#define MSR_ADDRESS 'h00000018 -#define MSR_DCD_MSB 7 -#define MSR_DCD_LSB 7 -#define MSR_DCD_MASK 'h00000080 -#define MSR_DCD_GET(x) (((x) & MSR_DCD_MASK) >> MSR_DCD_LSB) -#define MSR_DCD_SET(x) (((32'd0 | (x)) << MSR_DCD_LSB) & MSR_DCD_MASK) -#define MSR_DCD_RESET 1'h0 -#define MSR_RI_MSB 6 -#define MSR_RI_LSB 6 -#define MSR_RI_MASK 'h00000040 -#define MSR_RI_GET(x) (((x) & MSR_RI_MASK) >> MSR_RI_LSB) -#define MSR_RI_SET(x) (((32'd0 | (x)) << MSR_RI_LSB) & MSR_RI_MASK) -#define MSR_RI_RESET 1'h0 -#define MSR_DSR_MSB 5 -#define MSR_DSR_LSB 5 -#define MSR_DSR_MASK 'h00000020 -#define MSR_DSR_GET(x) (((x) & MSR_DSR_MASK) >> MSR_DSR_LSB) -#define MSR_DSR_SET(x) (((32'd0 | (x)) << MSR_DSR_LSB) & MSR_DSR_MASK) -#define MSR_DSR_RESET 1'h0 -#define MSR_CTS_MSB 4 -#define MSR_CTS_LSB 4 -#define MSR_CTS_MASK 'h00000010 -#define MSR_CTS_GET(x) (((x) & MSR_CTS_MASK) >> MSR_CTS_LSB) -#define MSR_CTS_SET(x) (((32'd0 | (x)) << MSR_CTS_LSB) & MSR_CTS_MASK) -#define MSR_CTS_RESET 1'h0 -#define MSR_DDCD_MSB 3 -#define MSR_DDCD_LSB 3 -#define MSR_DDCD_MASK 'h00000008 -#define MSR_DDCD_GET(x) (((x) & MSR_DDCD_MASK) >> MSR_DDCD_LSB) -#define MSR_DDCD_SET(x) (((32'd0 | (x)) << MSR_DDCD_LSB) & MSR_DDCD_MASK) -#define MSR_DDCD_RESET 1'h0 -#define MSR_TERI_MSB 2 -#define MSR_TERI_LSB 2 -#define MSR_TERI_MASK 'h00000004 -#define MSR_TERI_GET(x) (((x) & MSR_TERI_MASK) >> MSR_TERI_LSB) -#define MSR_TERI_SET(x) (((32'd0 | (x)) << MSR_TERI_LSB) & MSR_TERI_MASK) -#define MSR_TERI_RESET 1'h0 -#define MSR_DDSR_MSB 1 -#define MSR_DDSR_LSB 1 -#define MSR_DDSR_MASK 'h00000002 -#define MSR_DDSR_GET(x) (((x) & MSR_DDSR_MASK) >> MSR_DDSR_LSB) -#define MSR_DDSR_SET(x) (((32'd0 | (x)) << MSR_DDSR_LSB) & MSR_DDSR_MASK) -#define MSR_DDSR_RESET 1'h0 -#define MSR_DCTS_MSB 0 -#define MSR_DCTS_LSB 0 -#define MSR_DCTS_MASK 'h00000001 -#define MSR_DCTS_GET(x) (((x) & MSR_DCTS_MASK) >> MSR_DCTS_LSB) -#define MSR_DCTS_SET(x) (((32'd0 | (x)) << MSR_DCTS_LSB) & MSR_DCTS_MASK) -#define MSR_DCTS_RESET 1'h0 -#define MSR_RESET (32'h0 | \ - MSR_DCD_SET(MSR_DCD_RESET) | \ - MSR_RI_SET(MSR_RI_RESET) | \ - MSR_DSR_SET(MSR_DSR_RESET) | \ - MSR_CTS_SET(MSR_CTS_RESET) | \ - MSR_DDCD_SET(MSR_DDCD_RESET) | \ - MSR_TERI_SET(MSR_TERI_RESET) | \ - MSR_DDSR_SET(MSR_DDSR_RESET) | \ - MSR_DCTS_SET(MSR_DCTS_RESET)) -#define MSR_HW_MASK (32'h0) -#define MSR_SW_MASK (32'h0 | \ - MSR_DCD_MASK | \ - MSR_RI_MASK | \ - MSR_DSR_MASK | \ - MSR_CTS_MASK | \ - MSR_DDCD_MASK | \ - MSR_TERI_MASK | \ - MSR_DDSR_MASK | \ - MSR_DCTS_MASK) - -#define SCR_ADDRESS 'h0000001c -#define SCR_SCR_MSB 7 -#define SCR_SCR_LSB 0 -#define SCR_SCR_MASK 'h000000ff -#define SCR_SCR_GET(x) (((x) & SCR_SCR_MASK) >> SCR_SCR_LSB) -#define SCR_SCR_SET(x) (((32'd0 | (x)) << SCR_SCR_LSB) & SCR_SCR_MASK) -#define SCR_SCR_RESET 8'h0 -#define SCR_RESET (32'h0 | \ - SCR_SCR_SET(SCR_SCR_RESET)) -#define SCR_HW_MASK (32'h0) -#define SCR_SW_MASK (32'h0 | \ - SCR_SCR_MASK) - -#define SRBR_ADDRESS 'h00000020 -#define SRBR_SRBR_MSB 7 -#define SRBR_SRBR_LSB 0 -#define SRBR_SRBR_MASK 'h000000ff -#define SRBR_SRBR_GET(x) (((x) & SRBR_SRBR_MASK) >> SRBR_SRBR_LSB) -#define SRBR_SRBR_SET(x) (((32'd0 | (x)) << SRBR_SRBR_LSB) & SRBR_SRBR_MASK) -#define SRBR_SRBR_RESET 8'h0 -#define SRBR_RESET (32'h0 | \ - SRBR_SRBR_SET(SRBR_SRBR_RESET)) -#define SRBR_HW_MASK (32'h0) -#define SRBR_SW_MASK (32'h0 | \ - SRBR_SRBR_MASK) - -#define SIIR_ADDRESS 'h00000028 -#define SIIR_SIIR_MSB 7 -#define SIIR_SIIR_LSB 0 -#define SIIR_SIIR_MASK 'h000000ff -#define SIIR_SIIR_GET(x) (((x) & SIIR_SIIR_MASK) >> SIIR_SIIR_LSB) -#define SIIR_SIIR_SET(x) (((32'd0 | (x)) << SIIR_SIIR_LSB) & SIIR_SIIR_MASK) -#define SIIR_SIIR_RESET 8'h0 -#define SIIR_RESET (32'h0 | \ - SIIR_SIIR_SET(SIIR_SIIR_RESET)) -#define SIIR_HW_MASK (32'h0) -#define SIIR_SW_MASK (32'h0 | \ - SIIR_SIIR_MASK) - -#define MWR_ADDRESS 'h0000002c -#define MWR_MWR_MSB 31 -#define MWR_MWR_LSB 0 -#define MWR_MWR_MASK 'hffffffff -#define MWR_MWR_GET(x) (((x) & MWR_MWR_MASK) >> MWR_MWR_LSB) -#define MWR_MWR_SET(x) (((32'd0 | (x)) << MWR_MWR_LSB) & MWR_MWR_MASK) -#define MWR_MWR_RESET 32'h0 -#define MWR_RESET (32'h0 | \ - MWR_MWR_SET(MWR_MWR_RESET)) -#define MWR_HW_MASK (32'h0) -#define MWR_SW_MASK (32'h0 | \ - MWR_MWR_MASK) - -#define SLSR_ADDRESS 'h00000034 -#define SLSR_SLSR_MSB 7 -#define SLSR_SLSR_LSB 0 -#define SLSR_SLSR_MASK 'h000000ff -#define SLSR_SLSR_GET(x) (((x) & SLSR_SLSR_MASK) >> SLSR_SLSR_LSB) -#define SLSR_SLSR_SET(x) (((32'd0 | (x)) << SLSR_SLSR_LSB) & SLSR_SLSR_MASK) -#define SLSR_SLSR_RESET 8'h0 -#define SLSR_RESET (32'h0 | \ - SLSR_SLSR_SET(SLSR_SLSR_RESET)) -#define SLSR_HW_MASK (32'h0) -#define SLSR_SW_MASK (32'h0 | \ - SLSR_SLSR_MASK) - -#define SMSR_ADDRESS 'h00000038 -#define SMSR_SMSR_MSB 7 -#define SMSR_SMSR_LSB 0 -#define SMSR_SMSR_MASK 'h000000ff -#define SMSR_SMSR_GET(x) (((x) & SMSR_SMSR_MASK) >> SMSR_SMSR_LSB) -#define SMSR_SMSR_SET(x) (((32'd0 | (x)) << SMSR_SMSR_LSB) & SMSR_SMSR_MASK) -#define SMSR_SMSR_RESET 8'h0 -#define SMSR_RESET (32'h0 | \ - SMSR_SMSR_SET(SMSR_SMSR_RESET)) -#define SMSR_HW_MASK (32'h0) -#define SMSR_SW_MASK (32'h0 | \ - SMSR_SMSR_MASK) - -#define MRR_ADDRESS 'h0000003c -#define MRR_MRR_MSB 31 -#define MRR_MRR_LSB 0 -#define MRR_MRR_MASK 'hffffffff -#define MRR_MRR_GET(x) (((x) & MRR_MRR_MASK) >> MRR_MRR_LSB) -#define MRR_MRR_SET(x) (((32'd0 | (x)) << MRR_MRR_LSB) & MRR_MRR_MASK) -#define MRR_MRR_RESET 32'h0 -#define MRR_RESET (32'h0 | \ - MRR_MRR_SET(MRR_MRR_RESET)) -#define MRR_HW_MASK (32'h0) -#define MRR_SW_MASK (32'h0 | \ - MRR_MRR_MASK) - -#define UART_REG_ADDRESS_MSB 5 - -#endif /* _UART_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/vmc_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw/vmc_reg.h deleted file mode 100644 index 932ec510d26b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/vmc_reg.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef _VMC_REG_REG_H_ -#define _VMC_REG_REG_H_ - -#define MC_TCAM_VALID_ADDRESS 0x00000000 -#define MC_TCAM_VALID_OFFSET 0x00000000 -#define MC_TCAM_VALID_BIT_MSB 0 -#define MC_TCAM_VALID_BIT_LSB 0 -#define MC_TCAM_VALID_BIT_MASK 0x00000001 -#define MC_TCAM_VALID_BIT_GET(x) (((x) & MC_TCAM_VALID_BIT_MASK) >> MC_TCAM_VALID_BIT_LSB) -#define MC_TCAM_VALID_BIT_SET(x) (((x) << MC_TCAM_VALID_BIT_LSB) & MC_TCAM_VALID_BIT_MASK) - -#define MC_TCAM_MASK_ADDRESS 0x00000080 -#define MC_TCAM_MASK_OFFSET 0x00000080 -#define MC_TCAM_MASK_SIZE_MSB 2 -#define MC_TCAM_MASK_SIZE_LSB 0 -#define MC_TCAM_MASK_SIZE_MASK 0x00000007 -#define MC_TCAM_MASK_SIZE_GET(x) (((x) & MC_TCAM_MASK_SIZE_MASK) >> MC_TCAM_MASK_SIZE_LSB) -#define MC_TCAM_MASK_SIZE_SET(x) (((x) << MC_TCAM_MASK_SIZE_LSB) & MC_TCAM_MASK_SIZE_MASK) - -#define MC_TCAM_COMPARE_ADDRESS 0x00000100 -#define MC_TCAM_COMPARE_OFFSET 0x00000100 -#define MC_TCAM_COMPARE_KEY_MSB 21 -#define MC_TCAM_COMPARE_KEY_LSB 5 -#define MC_TCAM_COMPARE_KEY_MASK 0x003fffe0 -#define MC_TCAM_COMPARE_KEY_GET(x) (((x) & MC_TCAM_COMPARE_KEY_MASK) >> MC_TCAM_COMPARE_KEY_LSB) -#define MC_TCAM_COMPARE_KEY_SET(x) (((x) << MC_TCAM_COMPARE_KEY_LSB) & MC_TCAM_COMPARE_KEY_MASK) - -#define MC_TCAM_TARGET_ADDRESS 0x00000180 -#define MC_TCAM_TARGET_OFFSET 0x00000180 -#define MC_TCAM_TARGET_ADDR_MSB 21 -#define MC_TCAM_TARGET_ADDR_LSB 5 -#define MC_TCAM_TARGET_ADDR_MASK 0x003fffe0 -#define MC_TCAM_TARGET_ADDR_GET(x) (((x) & MC_TCAM_TARGET_ADDR_MASK) >> MC_TCAM_TARGET_ADDR_LSB) -#define MC_TCAM_TARGET_ADDR_SET(x) (((x) << MC_TCAM_TARGET_ADDR_LSB) & MC_TCAM_TARGET_ADDR_MASK) - -#define ADDR_ERROR_CONTROL_ADDRESS 0x00000200 -#define ADDR_ERROR_CONTROL_OFFSET 0x00000200 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_MSB 1 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB 1 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK 0x00000002 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_GET(x) (((x) & ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK) >> ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB) -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_SET(x) (((x) << ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB) & ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK) -#define ADDR_ERROR_CONTROL_ENABLE_MSB 0 -#define ADDR_ERROR_CONTROL_ENABLE_LSB 0 -#define ADDR_ERROR_CONTROL_ENABLE_MASK 0x00000001 -#define ADDR_ERROR_CONTROL_ENABLE_GET(x) (((x) & ADDR_ERROR_CONTROL_ENABLE_MASK) >> ADDR_ERROR_CONTROL_ENABLE_LSB) -#define ADDR_ERROR_CONTROL_ENABLE_SET(x) (((x) << ADDR_ERROR_CONTROL_ENABLE_LSB) & ADDR_ERROR_CONTROL_ENABLE_MASK) - -#define ADDR_ERROR_STATUS_ADDRESS 0x00000204 -#define ADDR_ERROR_STATUS_OFFSET 0x00000204 -#define ADDR_ERROR_STATUS_WRITE_MSB 25 -#define ADDR_ERROR_STATUS_WRITE_LSB 25 -#define ADDR_ERROR_STATUS_WRITE_MASK 0x02000000 -#define ADDR_ERROR_STATUS_WRITE_GET(x) (((x) & ADDR_ERROR_STATUS_WRITE_MASK) >> ADDR_ERROR_STATUS_WRITE_LSB) -#define ADDR_ERROR_STATUS_WRITE_SET(x) (((x) << ADDR_ERROR_STATUS_WRITE_LSB) & ADDR_ERROR_STATUS_WRITE_MASK) -#define ADDR_ERROR_STATUS_ADDRESS_MSB 24 -#define ADDR_ERROR_STATUS_ADDRESS_LSB 0 -#define ADDR_ERROR_STATUS_ADDRESS_MASK 0x01ffffff -#define ADDR_ERROR_STATUS_ADDRESS_GET(x) (((x) & ADDR_ERROR_STATUS_ADDRESS_MASK) >> ADDR_ERROR_STATUS_ADDRESS_LSB) -#define ADDR_ERROR_STATUS_ADDRESS_SET(x) (((x) << ADDR_ERROR_STATUS_ADDRESS_LSB) & ADDR_ERROR_STATUS_ADDRESS_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct vmc_reg_reg_s { - volatile unsigned int mc_tcam_valid[32]; - volatile unsigned int mc_tcam_mask[32]; - volatile unsigned int mc_tcam_compare[32]; - volatile unsigned int mc_tcam_target[32]; - volatile unsigned int addr_error_control; - volatile unsigned int addr_error_status; -} vmc_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _VMC_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw/vmc_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw/vmc_reg.vrh deleted file mode 100644 index cd9b7e599390..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw/vmc_reg.vrh +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef _VMC_REG_VRH_ -#define _VMC_REG_VRH_ - -#define MC_TCAM_VALID_ADDRESS 'h00000000 -#define MC_TCAM_VALID_BIT_MSB 0 -#define MC_TCAM_VALID_BIT_LSB 0 -#define MC_TCAM_VALID_BIT_MASK 'h00000001 -#define MC_TCAM_VALID_BIT_GET(x) (((x) & MC_TCAM_VALID_BIT_MASK) >> MC_TCAM_VALID_BIT_LSB) -#define MC_TCAM_VALID_BIT_SET(x) (((32'd0 | (x)) << MC_TCAM_VALID_BIT_LSB) & MC_TCAM_VALID_BIT_MASK) -#define MC_TCAM_VALID_BIT_RESET 1'h0 -#define MC_TCAM_VALID_RESET (32'h0 | \ - MC_TCAM_VALID_BIT_SET(MC_TCAM_VALID_BIT_RESET)) -#define MC_TCAM_VALID_HW_MASK (32'h0) -#define MC_TCAM_VALID_SW_MASK (32'h0 | \ - MC_TCAM_VALID_BIT_MASK) - -#define MC_TCAM_MASK_ADDRESS 'h00000080 -#define MC_TCAM_MASK_SIZE_MSB 2 -#define MC_TCAM_MASK_SIZE_LSB 0 -#define MC_TCAM_MASK_SIZE_MASK 'h00000007 -#define MC_TCAM_MASK_SIZE_GET(x) (((x) & MC_TCAM_MASK_SIZE_MASK) >> MC_TCAM_MASK_SIZE_LSB) -#define MC_TCAM_MASK_SIZE_SET(x) (((32'd0 | (x)) << MC_TCAM_MASK_SIZE_LSB) & MC_TCAM_MASK_SIZE_MASK) -#define MC_TCAM_MASK_SIZE_RESET 3'h0 -#define MC_TCAM_MASK_RESET (32'h0 | \ - MC_TCAM_MASK_SIZE_SET(MC_TCAM_MASK_SIZE_RESET)) -#define MC_TCAM_MASK_HW_MASK (32'h0) -#define MC_TCAM_MASK_SW_MASK (32'h0 | \ - MC_TCAM_MASK_SIZE_MASK) - -#define MC_TCAM_COMPARE_ADDRESS 'h00000100 -#define MC_TCAM_COMPARE_KEY_MSB 21 -#define MC_TCAM_COMPARE_KEY_LSB 5 -#define MC_TCAM_COMPARE_KEY_MASK 'h003fffe0 -#define MC_TCAM_COMPARE_KEY_GET(x) (((x) & MC_TCAM_COMPARE_KEY_MASK) >> MC_TCAM_COMPARE_KEY_LSB) -#define MC_TCAM_COMPARE_KEY_SET(x) (((32'd0 | (x)) << MC_TCAM_COMPARE_KEY_LSB) & MC_TCAM_COMPARE_KEY_MASK) -#define MC_TCAM_COMPARE_KEY_RESET 17'h0 -#define MC_TCAM_COMPARE_RESET (32'h0 | \ - MC_TCAM_COMPARE_KEY_SET(MC_TCAM_COMPARE_KEY_RESET)) -#define MC_TCAM_COMPARE_HW_MASK (32'h0) -#define MC_TCAM_COMPARE_SW_MASK (32'h0 | \ - MC_TCAM_COMPARE_KEY_MASK) - -#define MC_TCAM_TARGET_ADDRESS 'h00000180 -#define MC_TCAM_TARGET_ADDR_MSB 21 -#define MC_TCAM_TARGET_ADDR_LSB 5 -#define MC_TCAM_TARGET_ADDR_MASK 'h003fffe0 -#define MC_TCAM_TARGET_ADDR_GET(x) (((x) & MC_TCAM_TARGET_ADDR_MASK) >> MC_TCAM_TARGET_ADDR_LSB) -#define MC_TCAM_TARGET_ADDR_SET(x) (((32'd0 | (x)) << MC_TCAM_TARGET_ADDR_LSB) & MC_TCAM_TARGET_ADDR_MASK) -#define MC_TCAM_TARGET_ADDR_RESET 17'h0 -#define MC_TCAM_TARGET_RESET (32'h0 | \ - MC_TCAM_TARGET_ADDR_SET(MC_TCAM_TARGET_ADDR_RESET)) -#define MC_TCAM_TARGET_HW_MASK (32'h0) -#define MC_TCAM_TARGET_SW_MASK (32'h0 | \ - MC_TCAM_TARGET_ADDR_MASK) - -#define ADDR_ERROR_CONTROL_ADDRESS 'h00000200 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_MSB 1 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB 1 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK 'h00000002 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_GET(x) (((x) & ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK) >> ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB) -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_SET(x) (((32'd0 | (x)) << ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB) & ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK) -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_RESET 1'h0 -#define ADDR_ERROR_CONTROL_ENABLE_MSB 0 -#define ADDR_ERROR_CONTROL_ENABLE_LSB 0 -#define ADDR_ERROR_CONTROL_ENABLE_MASK 'h00000001 -#define ADDR_ERROR_CONTROL_ENABLE_GET(x) (((x) & ADDR_ERROR_CONTROL_ENABLE_MASK) >> ADDR_ERROR_CONTROL_ENABLE_LSB) -#define ADDR_ERROR_CONTROL_ENABLE_SET(x) (((32'd0 | (x)) << ADDR_ERROR_CONTROL_ENABLE_LSB) & ADDR_ERROR_CONTROL_ENABLE_MASK) -#define ADDR_ERROR_CONTROL_ENABLE_RESET 1'h0 -#define ADDR_ERROR_CONTROL_RESET (32'h0 | \ - ADDR_ERROR_CONTROL_QUAL_ENABLE_SET(ADDR_ERROR_CONTROL_QUAL_ENABLE_RESET) | \ - ADDR_ERROR_CONTROL_ENABLE_SET(ADDR_ERROR_CONTROL_ENABLE_RESET)) -#define ADDR_ERROR_CONTROL_HW_MASK (32'h0) -#define ADDR_ERROR_CONTROL_SW_MASK (32'h0 | \ - ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK | \ - ADDR_ERROR_CONTROL_ENABLE_MASK) - -#define ADDR_ERROR_STATUS_ADDRESS 'h00000204 -#define ADDR_ERROR_STATUS_WRITE_MSB 25 -#define ADDR_ERROR_STATUS_WRITE_LSB 25 -#define ADDR_ERROR_STATUS_WRITE_MASK 'h02000000 -#define ADDR_ERROR_STATUS_WRITE_GET(x) (((x) & ADDR_ERROR_STATUS_WRITE_MASK) >> ADDR_ERROR_STATUS_WRITE_LSB) -#define ADDR_ERROR_STATUS_WRITE_SET(x) (((32'd0 | (x)) << ADDR_ERROR_STATUS_WRITE_LSB) & ADDR_ERROR_STATUS_WRITE_MASK) -#define ADDR_ERROR_STATUS_WRITE_RESET 1'h0 -#define ADDR_ERROR_STATUS_ADDRESS_MSB 24 -#define ADDR_ERROR_STATUS_ADDRESS_LSB 0 -#define ADDR_ERROR_STATUS_ADDRESS_MASK 'h01ffffff -#define ADDR_ERROR_STATUS_ADDRESS_GET(x) (((x) & ADDR_ERROR_STATUS_ADDRESS_MASK) >> ADDR_ERROR_STATUS_ADDRESS_LSB) -#define ADDR_ERROR_STATUS_ADDRESS_SET(x) (((32'd0 | (x)) << ADDR_ERROR_STATUS_ADDRESS_LSB) & ADDR_ERROR_STATUS_ADDRESS_MASK) -#define ADDR_ERROR_STATUS_ADDRESS_RESET 25'h0 -#define ADDR_ERROR_STATUS_RESET (32'h0 | \ - ADDR_ERROR_STATUS_WRITE_SET(ADDR_ERROR_STATUS_WRITE_RESET) | \ - ADDR_ERROR_STATUS_ADDRESS_SET(ADDR_ERROR_STATUS_ADDRESS_RESET)) -#define ADDR_ERROR_STATUS_HW_MASK (32'h0 | \ - ADDR_ERROR_STATUS_WRITE_MASK | \ - ADDR_ERROR_STATUS_ADDRESS_MASK) -#define ADDR_ERROR_STATUS_SW_MASK (32'h0) - -#define VMC_REG_ADDRESS_MSB 9 - -#endif /* _VMC_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsEnv.vr b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsEnv.vr deleted file mode 100644 index aa95b3672da0..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsEnv.vr +++ /dev/null @@ -1,58 +0,0 @@ -#include -#include -#include "AveStdLib.vri" - -#ifndef SYNOPSYS_NTB - #include "MercuryEnv.vrh" - #include "LegacyRegsEnvConfig.vrh" - #include "LegacyRegsTop.vrh" -#endif - -class LegacyRegsEnv extends MercuryEnv { - LegacyRegsEnvConfig envConfig; - LegacyRegsTop regsTop; - - task new(string name = "LegacyRegsEnv", LegacyRegsEnvConfig envConfig = null); - virtual function AveEnvConfig GetEnvConfig(); - virtual task build(); - virtual task directed_test_t(); -} - - -task LegacyRegsEnv::new(string name = "LegacyRegsEnv", LegacyRegsEnvConfig envConfig = null) { - MercuryTopConfig mercuryTopConfig; - LegacyRegsTopConfig legacyRegsTopConfig; - - super.new(); - this.envConfig = envConfig; - if (this.envConfig == null) this.envConfig = new(); - cast_assign(mercuryTopConfig, this.envConfig.GetTopConfig()); - - // build and register LegacyRegsTopConfig - legacyRegsTopConfig = new(*, *, "legacyRegsTopConfig"); - mercuryTopConfig.RegisterConfig(legacyRegsTopConfig); -} - -function AveEnvConfig LegacyRegsEnv::GetEnvConfig() { - GetEnvConfig = this.envConfig; -} - -task LegacyRegsEnv::build() { - MercuryTopConfig mercuryTopConfig; - LegacyRegsTopConfig legacyRegsTopConfig; - super.build(); - - // build and register MercuryTop - cast_assign(mercuryTopConfig, this.envConfig.GetTopConfig()); - this.mercuryTop = new(mercuryTopConfig); - this.RegisterTop(this.mercuryTop); - - // build and register LegacyRegsTop. - cast_assign(legacyRegsTopConfig, mercuryTopConfig.GetConfigInstanceByName("legacyRegsTopConfig")); - this.regsTop = new("LegacyRegsTop", "regsTop", 0, legacyRegsTopConfig); - void = this.mercuryTop.RegisterXactor(this.regsTop, AVE_TOP_NO_WAIT_FOR_DONE); -} - -task LegacyRegsEnv::directed_test_t() { -} - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsEnvConfig.vr b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsEnvConfig.vr deleted file mode 100644 index ed706ac02fa2..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsEnvConfig.vr +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include "AveStdLib.vri" - -#ifndef SYNOPSYS_NTB - #include "MercuryEnvConfig.vrh" -#endif - -class LegacyRegsEnvConfig extends MercuryEnvConfig { - static local rvm_log log = new("LegacyRegsEnvConfig", "class"); - - constraint LegacyRegsEnvConfigConstraint { - numRuns == 1; - } - - constraint LegacyRegsEnvConfigTest; - - task new(rvm_log log = null); - virtual function rvm_data allocate(); - virtual function AveTopConfig GetTopConfig(); - virtual task SetTopConfig(AveTopConfig topConfig); -} - -task LegacyRegsEnvConfig::new(rvm_log log = null) { - super.new((log != null) ? log : this.log); - if (log != null) this.log = log; -} - -function rvm_data LegacyRegsEnvConfig::allocate() { - LegacyRegsEnvConfig envConfig = new(); - allocate = envConfig; -} - -function AveTopConfig LegacyRegsEnvConfig::GetTopConfig() { - GetTopConfig = this.topConfig; -} - -task LegacyRegsEnvConfig::SetTopConfig(AveTopConfig topConfig) { - if (!cast_assign(this.topConfig, topConfig, CHECK)) { - rvm_fatal(log, "Cannot set topConfig to non-LegacyRegsTopConfig instance"); - } -} - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsTop.vr b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsTop.vr deleted file mode 100644 index 17e9c626383b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsTop.vr +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include - -#ifndef SYNOPSYS_NTB - #include "AveTop.vrh" - #include "LegacyRegsTopConfig.vrh" -#endif - -class LegacyRegsTop extends AveTop { - LegacyRegsTopConfig topConfig; - - task new(string name, string instance, integer stream_id, LegacyRegsTopConfig topConfig); - virtual task reset_dut_t(); - virtual task start_xactor(); - virtual task stop_xactor(); - virtual task reset_xactor(integer rstType); -} - -task LegacyRegsTop::new(string name, string instance, integer stream_id, LegacyRegsTopConfig topConfig) { - super.new(name, instance, stream_id, topConfig); - this.topConfig = topConfig; -} - -task LegacyRegsTop::reset_dut_t() { - super.reset_dut_t(); -} - -task LegacyRegsTop::start_xactor() { - super.start_xactor(); -} - -task LegacyRegsTop::stop_xactor() { - super.stop_xactor(); -} - -task LegacyRegsTop::reset_xactor(integer rstType) { - super.reset_xactor(rstType); -} - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsTopConfig.vr b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsTopConfig.vr deleted file mode 100644 index 162195e5760f..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/LegacyRegsTopConfig.vr +++ /dev/null @@ -1,46 +0,0 @@ -#include - -#ifndef SYNOPSYS_NTB - #include "AveTopConfig.vr" -#endif - -class LegacyRegsTopConfig extends AveTopConfig { - local rvm_log log = new("LegacyRegsTopConfig", "class"); - - task new(rvm_log log = null, string name="LegacyRegsTopConfig", string instance="class"); - virtual function rvm_data allocate(); - virtual function rvm_data copy(rvm_data cpy = null); - virtual function AveData GetDutConfig(); - virtual task SetDutConfig(AveData dutConfig); -} - -task LegacyRegsTopConfig::new(rvm_log log = null, string name="LegacyRegsTopConfig", string instance="class") { - super.new(((log != null) ? log : this.log), name, instance); - if (log != null) this.log = log; -} - -function rvm_data LegacyRegsTopConfig::allocate() { - LegacyRegsTopConfig c = new(); - allocate = c; -} - -function rvm_data LegacyRegsTopConfig::copy(rvm_data cpy = null) { - LegacyRegsTopConfig to; - if (cpy == null) { - cast_assign(to, this.allocate()); - } - else { - if(!cast_assign(to, cpy, CHECK)) - rvm_error(this.log, "PROBLEM"); - } - void = super.copy(to); - copy = to; -} - -function AveData LegacyRegsTopConfig::GetDutConfig() { - GetDutConfig = null; -} - -task LegacyRegsTopConfig::SetDutConfig(AveData dutConfig) { -} - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/Makefile.child b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/Makefile.child deleted file mode 100644 index bff4ba902e61..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/Makefile.child +++ /dev/null @@ -1,10 +0,0 @@ -################################################################################ -# $Id: //depot/chips/mercury/2.1/dv/soc/src/ave/regs/Makefile.child#1 $ -################################################################################ - -NTB_SRCS += $(ROOT)/regs/LegacyRegsTopConfig.vr \ - $(ROOT)/regs/LegacyRegsTop.vr \ - $(ROOT)/regs/LegacyRegsEnvConfig.vr \ - $(ROOT)/regs/LegacyRegsEnv.vr \ - -NTB_INC_DIRS += $(ROOT)/regs diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/Makefile.reg b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/Makefile.reg deleted file mode 100644 index 946d31e9a986..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/Makefile.reg +++ /dev/null @@ -1,28 +0,0 @@ - - -GEN_VRH = reg -vrh -P4_EDIT = p4 edit -P4_SUBMIT = p4 submit - -REG_RTL_DIR = ../../../../../rtl -REG_SRCS = $(shell find $(REG_RTL_DIR) -name '*.reg'); -REG_VRH_TGTS = $(wildcard *_reg.vrh) - -REDO_ALL_REG_VRH = $(foreach var, $(REG_VRH_TGTS), $(GEN_VRH) $(filter %$(patsubst %vrh,%reg,$(var)), $(REG_SRCS));) - -VPATH = $(dir $(REG_SRCS)) - -all: $(REG_VRH_TGTS) - -refresh_all_reg_vrh: - $(P4_EDIT) $(REG_VRH_TGTS) - $(REDO_ALL_REG_VRH) - $(P4_SUBMIT) ... - -%_reg.vrh : %_reg.reg - $(P4_EDIT) $@ - $(GEN_VRH) $< - $(P4_SUBMIT) ... - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/addac.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/addac.h deleted file mode 100644 index 0c58cc04adad..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/addac.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef _ADDAC_REG_H_ -#define _ADDAC_REG_H_ - -#define ADDAC_ADDAC1_ADDRESS 0x00000000 -#define ADDAC_ADDAC1_OFFSET 0x00000000 -#define ADDAC_ADDAC1_PLL_SVREG_MSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_LSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_MASK 0x80000000 -#define ADDAC_ADDAC1_PLL_SVREG_GET(x) (((x) & ADDAC_ADDAC1_PLL_SVREG_MASK) >> ADDAC_ADDAC1_PLL_SVREG_LSB) -#define ADDAC_ADDAC1_PLL_SVREG_SET(x) (((x) << ADDAC_ADDAC1_PLL_SVREG_LSB) & ADDAC_ADDAC1_PLL_SVREG_MASK) -#define ADDAC_ADDAC1_PLL_SCLAMP_MSB 30 -#define ADDAC_ADDAC1_PLL_SCLAMP_LSB 28 -#define ADDAC_ADDAC1_PLL_SCLAMP_MASK 0x70000000 -#define ADDAC_ADDAC1_PLL_SCLAMP_GET(x) (((x) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) >> ADDAC_ADDAC1_PLL_SCLAMP_LSB) -#define ADDAC_ADDAC1_PLL_SCLAMP_SET(x) (((x) << ADDAC_ADDAC1_PLL_SCLAMP_LSB) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) -#define ADDAC_ADDAC1_PLL_ATB_MSB 27 -#define ADDAC_ADDAC1_PLL_ATB_LSB 26 -#define ADDAC_ADDAC1_PLL_ATB_MASK 0x0c000000 -#define ADDAC_ADDAC1_PLL_ATB_GET(x) (((x) & ADDAC_ADDAC1_PLL_ATB_MASK) >> ADDAC_ADDAC1_PLL_ATB_LSB) -#define ADDAC_ADDAC1_PLL_ATB_SET(x) (((x) << ADDAC_ADDAC1_PLL_ATB_LSB) & ADDAC_ADDAC1_PLL_ATB_MASK) -#define ADDAC_ADDAC1_PLL_ICP_MSB 25 -#define ADDAC_ADDAC1_PLL_ICP_LSB 23 -#define ADDAC_ADDAC1_PLL_ICP_MASK 0x03800000 -#define ADDAC_ADDAC1_PLL_ICP_GET(x) (((x) & ADDAC_ADDAC1_PLL_ICP_MASK) >> ADDAC_ADDAC1_PLL_ICP_LSB) -#define ADDAC_ADDAC1_PLL_ICP_SET(x) (((x) << ADDAC_ADDAC1_PLL_ICP_LSB) & ADDAC_ADDAC1_PLL_ICP_MASK) -#define ADDAC_ADDAC1_PLL_FILTER_MSB 22 -#define ADDAC_ADDAC1_PLL_FILTER_LSB 15 -#define ADDAC_ADDAC1_PLL_FILTER_MASK 0x007f8000 -#define ADDAC_ADDAC1_PLL_FILTER_GET(x) (((x) & ADDAC_ADDAC1_PLL_FILTER_MASK) >> ADDAC_ADDAC1_PLL_FILTER_LSB) -#define ADDAC_ADDAC1_PLL_FILTER_SET(x) (((x) << ADDAC_ADDAC1_PLL_FILTER_LSB) & ADDAC_ADDAC1_PLL_FILTER_MASK) -#define ADDAC_ADDAC1_PWDPLL_MSB 14 -#define ADDAC_ADDAC1_PWDPLL_LSB 14 -#define ADDAC_ADDAC1_PWDPLL_MASK 0x00004000 -#define ADDAC_ADDAC1_PWDPLL_GET(x) (((x) & ADDAC_ADDAC1_PWDPLL_MASK) >> ADDAC_ADDAC1_PWDPLL_LSB) -#define ADDAC_ADDAC1_PWDPLL_SET(x) (((x) << ADDAC_ADDAC1_PWDPLL_LSB) & ADDAC_ADDAC1_PWDPLL_MASK) -#define ADDAC_ADDAC1_PWDADC_MSB 13 -#define ADDAC_ADDAC1_PWDADC_LSB 13 -#define ADDAC_ADDAC1_PWDADC_MASK 0x00002000 -#define ADDAC_ADDAC1_PWDADC_GET(x) (((x) & ADDAC_ADDAC1_PWDADC_MASK) >> ADDAC_ADDAC1_PWDADC_LSB) -#define ADDAC_ADDAC1_PWDADC_SET(x) (((x) << ADDAC_ADDAC1_PWDADC_LSB) & ADDAC_ADDAC1_PWDADC_MASK) -#define ADDAC_ADDAC1_PWDDAC_MSB 12 -#define ADDAC_ADDAC1_PWDDAC_LSB 12 -#define ADDAC_ADDAC1_PWDDAC_MASK 0x00001000 -#define ADDAC_ADDAC1_PWDDAC_GET(x) (((x) & ADDAC_ADDAC1_PWDDAC_MASK) >> ADDAC_ADDAC1_PWDDAC_LSB) -#define ADDAC_ADDAC1_PWDDAC_SET(x) (((x) << ADDAC_ADDAC1_PWDDAC_LSB) & ADDAC_ADDAC1_PWDDAC_MASK) -#define ADDAC_ADDAC1_FORCEMSBLOW_MSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_LSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_MASK 0x00000800 -#define ADDAC_ADDAC1_FORCEMSBLOW_GET(x) (((x) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) >> ADDAC_ADDAC1_FORCEMSBLOW_LSB) -#define ADDAC_ADDAC1_FORCEMSBLOW_SET(x) (((x) << ADDAC_ADDAC1_FORCEMSBLOW_LSB) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) -#define ADDAC_ADDAC1_SELMANPWDS_MSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_LSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_MASK 0x00000400 -#define ADDAC_ADDAC1_SELMANPWDS_GET(x) (((x) & ADDAC_ADDAC1_SELMANPWDS_MASK) >> ADDAC_ADDAC1_SELMANPWDS_LSB) -#define ADDAC_ADDAC1_SELMANPWDS_SET(x) (((x) << ADDAC_ADDAC1_SELMANPWDS_LSB) & ADDAC_ADDAC1_SELMANPWDS_MASK) -#define ADDAC_ADDAC1_INV_CLK160_ADC_MSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_LSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_MASK 0x00000200 -#define ADDAC_ADDAC1_INV_CLK160_ADC_GET(x) (((x) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) >> ADDAC_ADDAC1_INV_CLK160_ADC_LSB) -#define ADDAC_ADDAC1_INV_CLK160_ADC_SET(x) (((x) << ADDAC_ADDAC1_INV_CLK160_ADC_LSB) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) -#define ADDAC_ADDAC1_CM_SEL_MSB 8 -#define ADDAC_ADDAC1_CM_SEL_LSB 7 -#define ADDAC_ADDAC1_CM_SEL_MASK 0x00000180 -#define ADDAC_ADDAC1_CM_SEL_GET(x) (((x) & ADDAC_ADDAC1_CM_SEL_MASK) >> ADDAC_ADDAC1_CM_SEL_LSB) -#define ADDAC_ADDAC1_CM_SEL_SET(x) (((x) << ADDAC_ADDAC1_CM_SEL_LSB) & ADDAC_ADDAC1_CM_SEL_MASK) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_LSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MASK 0x00000040 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_GET(x) (((x) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) >> ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_SET(x) (((x) << ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) -#define ADDAC_ADDAC1_SPARE_MSB 5 -#define ADDAC_ADDAC1_SPARE_LSB 0 -#define ADDAC_ADDAC1_SPARE_MASK 0x0000003f -#define ADDAC_ADDAC1_SPARE_GET(x) (((x) & ADDAC_ADDAC1_SPARE_MASK) >> ADDAC_ADDAC1_SPARE_LSB) -#define ADDAC_ADDAC1_SPARE_SET(x) (((x) << ADDAC_ADDAC1_SPARE_LSB) & ADDAC_ADDAC1_SPARE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct addac_reg_s { - volatile unsigned int addac_addac1; -} addac_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _ADDAC_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/addac.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/addac.vrh deleted file mode 100644 index caa44243dcc3..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/addac.vrh +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef _ADDAC_VRH_ -#define _ADDAC_VRH_ - -#define ADDAC_ADDAC1_ADDRESS 'h00000000 -#define ADDAC_ADDAC1_PLL_SVREG_MSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_LSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_MASK 'h80000000 -#define ADDAC_ADDAC1_PLL_SVREG_GET(x) (((x) & ADDAC_ADDAC1_PLL_SVREG_MASK) >> ADDAC_ADDAC1_PLL_SVREG_LSB) -#define ADDAC_ADDAC1_PLL_SVREG_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_SVREG_LSB) & ADDAC_ADDAC1_PLL_SVREG_MASK) -#define ADDAC_ADDAC1_PLL_SVREG_RESET 1'h1 -#define ADDAC_ADDAC1_PLL_SCLAMP_MSB 30 -#define ADDAC_ADDAC1_PLL_SCLAMP_LSB 28 -#define ADDAC_ADDAC1_PLL_SCLAMP_MASK 'h70000000 -#define ADDAC_ADDAC1_PLL_SCLAMP_GET(x) (((x) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) >> ADDAC_ADDAC1_PLL_SCLAMP_LSB) -#define ADDAC_ADDAC1_PLL_SCLAMP_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_SCLAMP_LSB) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) -#define ADDAC_ADDAC1_PLL_SCLAMP_RESET 3'h5 -#define ADDAC_ADDAC1_PLL_ATB_MSB 27 -#define ADDAC_ADDAC1_PLL_ATB_LSB 26 -#define ADDAC_ADDAC1_PLL_ATB_MASK 'h0c000000 -#define ADDAC_ADDAC1_PLL_ATB_GET(x) (((x) & ADDAC_ADDAC1_PLL_ATB_MASK) >> ADDAC_ADDAC1_PLL_ATB_LSB) -#define ADDAC_ADDAC1_PLL_ATB_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_ATB_LSB) & ADDAC_ADDAC1_PLL_ATB_MASK) -#define ADDAC_ADDAC1_PLL_ATB_RESET 2'h0 -#define ADDAC_ADDAC1_PLL_ICP_MSB 25 -#define ADDAC_ADDAC1_PLL_ICP_LSB 23 -#define ADDAC_ADDAC1_PLL_ICP_MASK 'h03800000 -#define ADDAC_ADDAC1_PLL_ICP_GET(x) (((x) & ADDAC_ADDAC1_PLL_ICP_MASK) >> ADDAC_ADDAC1_PLL_ICP_LSB) -#define ADDAC_ADDAC1_PLL_ICP_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_ICP_LSB) & ADDAC_ADDAC1_PLL_ICP_MASK) -#define ADDAC_ADDAC1_PLL_ICP_RESET 3'h0 -#define ADDAC_ADDAC1_PLL_FILTER_MSB 22 -#define ADDAC_ADDAC1_PLL_FILTER_LSB 15 -#define ADDAC_ADDAC1_PLL_FILTER_MASK 'h007f8000 -#define ADDAC_ADDAC1_PLL_FILTER_GET(x) (((x) & ADDAC_ADDAC1_PLL_FILTER_MASK) >> ADDAC_ADDAC1_PLL_FILTER_LSB) -#define ADDAC_ADDAC1_PLL_FILTER_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_FILTER_LSB) & ADDAC_ADDAC1_PLL_FILTER_MASK) -#define ADDAC_ADDAC1_PLL_FILTER_RESET 8'h35 -#define ADDAC_ADDAC1_PWDPLL_MSB 14 -#define ADDAC_ADDAC1_PWDPLL_LSB 14 -#define ADDAC_ADDAC1_PWDPLL_MASK 'h00004000 -#define ADDAC_ADDAC1_PWDPLL_GET(x) (((x) & ADDAC_ADDAC1_PWDPLL_MASK) >> ADDAC_ADDAC1_PWDPLL_LSB) -#define ADDAC_ADDAC1_PWDPLL_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PWDPLL_LSB) & ADDAC_ADDAC1_PWDPLL_MASK) -#define ADDAC_ADDAC1_PWDPLL_RESET 1'h0 -#define ADDAC_ADDAC1_PWDADC_MSB 13 -#define ADDAC_ADDAC1_PWDADC_LSB 13 -#define ADDAC_ADDAC1_PWDADC_MASK 'h00002000 -#define ADDAC_ADDAC1_PWDADC_GET(x) (((x) & ADDAC_ADDAC1_PWDADC_MASK) >> ADDAC_ADDAC1_PWDADC_LSB) -#define ADDAC_ADDAC1_PWDADC_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PWDADC_LSB) & ADDAC_ADDAC1_PWDADC_MASK) -#define ADDAC_ADDAC1_PWDADC_RESET 1'h0 -#define ADDAC_ADDAC1_PWDDAC_MSB 12 -#define ADDAC_ADDAC1_PWDDAC_LSB 12 -#define ADDAC_ADDAC1_PWDDAC_MASK 'h00001000 -#define ADDAC_ADDAC1_PWDDAC_GET(x) (((x) & ADDAC_ADDAC1_PWDDAC_MASK) >> ADDAC_ADDAC1_PWDDAC_LSB) -#define ADDAC_ADDAC1_PWDDAC_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PWDDAC_LSB) & ADDAC_ADDAC1_PWDDAC_MASK) -#define ADDAC_ADDAC1_PWDDAC_RESET 1'h0 -#define ADDAC_ADDAC1_FORCEMSBLOW_MSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_LSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_MASK 'h00000800 -#define ADDAC_ADDAC1_FORCEMSBLOW_GET(x) (((x) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) >> ADDAC_ADDAC1_FORCEMSBLOW_LSB) -#define ADDAC_ADDAC1_FORCEMSBLOW_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_FORCEMSBLOW_LSB) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) -#define ADDAC_ADDAC1_FORCEMSBLOW_RESET 1'h0 -#define ADDAC_ADDAC1_SELMANPWDS_MSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_LSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_MASK 'h00000400 -#define ADDAC_ADDAC1_SELMANPWDS_GET(x) (((x) & ADDAC_ADDAC1_SELMANPWDS_MASK) >> ADDAC_ADDAC1_SELMANPWDS_LSB) -#define ADDAC_ADDAC1_SELMANPWDS_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_SELMANPWDS_LSB) & ADDAC_ADDAC1_SELMANPWDS_MASK) -#define ADDAC_ADDAC1_SELMANPWDS_RESET 1'h0 -#define ADDAC_ADDAC1_INV_CLK160_ADC_MSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_LSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_MASK 'h00000200 -#define ADDAC_ADDAC1_INV_CLK160_ADC_GET(x) (((x) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) >> ADDAC_ADDAC1_INV_CLK160_ADC_LSB) -#define ADDAC_ADDAC1_INV_CLK160_ADC_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_INV_CLK160_ADC_LSB) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) -#define ADDAC_ADDAC1_INV_CLK160_ADC_RESET 1'h0 -#define ADDAC_ADDAC1_CM_SEL_MSB 8 -#define ADDAC_ADDAC1_CM_SEL_LSB 7 -#define ADDAC_ADDAC1_CM_SEL_MASK 'h00000180 -#define ADDAC_ADDAC1_CM_SEL_GET(x) (((x) & ADDAC_ADDAC1_CM_SEL_MASK) >> ADDAC_ADDAC1_CM_SEL_LSB) -#define ADDAC_ADDAC1_CM_SEL_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_CM_SEL_LSB) & ADDAC_ADDAC1_CM_SEL_MASK) -#define ADDAC_ADDAC1_CM_SEL_RESET 2'h1 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_LSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MASK 'h00000040 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_GET(x) (((x) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) >> ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_RESET 1'h0 -#define ADDAC_ADDAC1_SPARE_MSB 5 -#define ADDAC_ADDAC1_SPARE_LSB 0 -#define ADDAC_ADDAC1_SPARE_MASK 'h0000003f -#define ADDAC_ADDAC1_SPARE_GET(x) (((x) & ADDAC_ADDAC1_SPARE_MASK) >> ADDAC_ADDAC1_SPARE_LSB) -#define ADDAC_ADDAC1_SPARE_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_SPARE_LSB) & ADDAC_ADDAC1_SPARE_MASK) -#define ADDAC_ADDAC1_SPARE_RESET 6'h0 -#define ADDAC_ADDAC1_RESET (32'h0 | \ - ADDAC_ADDAC1_PLL_SVREG_SET(ADDAC_ADDAC1_PLL_SVREG_RESET) | \ - ADDAC_ADDAC1_PLL_SCLAMP_SET(ADDAC_ADDAC1_PLL_SCLAMP_RESET) | \ - ADDAC_ADDAC1_PLL_ATB_SET(ADDAC_ADDAC1_PLL_ATB_RESET) | \ - ADDAC_ADDAC1_PLL_ICP_SET(ADDAC_ADDAC1_PLL_ICP_RESET) | \ - ADDAC_ADDAC1_PLL_FILTER_SET(ADDAC_ADDAC1_PLL_FILTER_RESET) | \ - ADDAC_ADDAC1_PWDPLL_SET(ADDAC_ADDAC1_PWDPLL_RESET) | \ - ADDAC_ADDAC1_PWDADC_SET(ADDAC_ADDAC1_PWDADC_RESET) | \ - ADDAC_ADDAC1_PWDDAC_SET(ADDAC_ADDAC1_PWDDAC_RESET) | \ - ADDAC_ADDAC1_FORCEMSBLOW_SET(ADDAC_ADDAC1_FORCEMSBLOW_RESET) | \ - ADDAC_ADDAC1_SELMANPWDS_SET(ADDAC_ADDAC1_SELMANPWDS_RESET) | \ - ADDAC_ADDAC1_INV_CLK160_ADC_SET(ADDAC_ADDAC1_INV_CLK160_ADC_RESET) | \ - ADDAC_ADDAC1_CM_SEL_SET(ADDAC_ADDAC1_CM_SEL_RESET) | \ - ADDAC_ADDAC1_DISABLE_DAC_REG_SET(ADDAC_ADDAC1_DISABLE_DAC_REG_RESET) | \ - ADDAC_ADDAC1_SPARE_SET(ADDAC_ADDAC1_SPARE_RESET)) -#define ADDAC_ADDAC1_HW_MASK (32'h0) -#define ADDAC_ADDAC1_SW_MASK (32'h0 | \ - ADDAC_ADDAC1_PLL_SVREG_MASK | \ - ADDAC_ADDAC1_PLL_SCLAMP_MASK | \ - ADDAC_ADDAC1_PLL_ATB_MASK | \ - ADDAC_ADDAC1_PLL_ICP_MASK | \ - ADDAC_ADDAC1_PLL_FILTER_MASK | \ - ADDAC_ADDAC1_PWDPLL_MASK | \ - ADDAC_ADDAC1_PWDADC_MASK | \ - ADDAC_ADDAC1_PWDDAC_MASK | \ - ADDAC_ADDAC1_FORCEMSBLOW_MASK | \ - ADDAC_ADDAC1_SELMANPWDS_MASK | \ - ADDAC_ADDAC1_INV_CLK160_ADC_MASK | \ - ADDAC_ADDAC1_CM_SEL_MASK | \ - ADDAC_ADDAC1_DISABLE_DAC_REG_MASK | \ - ADDAC_ADDAC1_SPARE_MASK) - -#define ADDAC_ADDRESS_MSB 1 - -#endif /* _ADDAC_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_intf_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_intf_reg.h deleted file mode 100644 index 9c82767b6efb..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_intf_reg.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef _ANALOG_INTF_REG_REG_H_ -#define _ANALOG_INTF_REG_REG_H_ - -#define SW_OVERRIDE_ADDRESS 0x00000080 -#define SW_OVERRIDE_OFFSET 0x00000080 -#define SW_OVERRIDE_SUPDATE_DELAY_MSB 1 -#define SW_OVERRIDE_SUPDATE_DELAY_LSB 1 -#define SW_OVERRIDE_SUPDATE_DELAY_MASK 0x00000002 -#define SW_OVERRIDE_SUPDATE_DELAY_GET(x) (((x) & SW_OVERRIDE_SUPDATE_DELAY_MASK) >> SW_OVERRIDE_SUPDATE_DELAY_LSB) -#define SW_OVERRIDE_SUPDATE_DELAY_SET(x) (((x) << SW_OVERRIDE_SUPDATE_DELAY_LSB) & SW_OVERRIDE_SUPDATE_DELAY_MASK) -#define SW_OVERRIDE_ENABLE_MSB 0 -#define SW_OVERRIDE_ENABLE_LSB 0 -#define SW_OVERRIDE_ENABLE_MASK 0x00000001 -#define SW_OVERRIDE_ENABLE_GET(x) (((x) & SW_OVERRIDE_ENABLE_MASK) >> SW_OVERRIDE_ENABLE_LSB) -#define SW_OVERRIDE_ENABLE_SET(x) (((x) << SW_OVERRIDE_ENABLE_LSB) & SW_OVERRIDE_ENABLE_MASK) - -#define SIN_VAL_ADDRESS 0x00000084 -#define SIN_VAL_OFFSET 0x00000084 -#define SIN_VAL_SIN_MSB 0 -#define SIN_VAL_SIN_LSB 0 -#define SIN_VAL_SIN_MASK 0x00000001 -#define SIN_VAL_SIN_GET(x) (((x) & SIN_VAL_SIN_MASK) >> SIN_VAL_SIN_LSB) -#define SIN_VAL_SIN_SET(x) (((x) << SIN_VAL_SIN_LSB) & SIN_VAL_SIN_MASK) - -#define SW_SCLK_ADDRESS 0x00000088 -#define SW_SCLK_OFFSET 0x00000088 -#define SW_SCLK_SW_SCLK_MSB 0 -#define SW_SCLK_SW_SCLK_LSB 0 -#define SW_SCLK_SW_SCLK_MASK 0x00000001 -#define SW_SCLK_SW_SCLK_GET(x) (((x) & SW_SCLK_SW_SCLK_MASK) >> SW_SCLK_SW_SCLK_LSB) -#define SW_SCLK_SW_SCLK_SET(x) (((x) << SW_SCLK_SW_SCLK_LSB) & SW_SCLK_SW_SCLK_MASK) - -#define SW_CNTL_ADDRESS 0x0000008c -#define SW_CNTL_OFFSET 0x0000008c -#define SW_CNTL_SW_SCAPTURE_MSB 2 -#define SW_CNTL_SW_SCAPTURE_LSB 2 -#define SW_CNTL_SW_SCAPTURE_MASK 0x00000004 -#define SW_CNTL_SW_SCAPTURE_GET(x) (((x) & SW_CNTL_SW_SCAPTURE_MASK) >> SW_CNTL_SW_SCAPTURE_LSB) -#define SW_CNTL_SW_SCAPTURE_SET(x) (((x) << SW_CNTL_SW_SCAPTURE_LSB) & SW_CNTL_SW_SCAPTURE_MASK) -#define SW_CNTL_SW_SUPDATE_MSB 1 -#define SW_CNTL_SW_SUPDATE_LSB 1 -#define SW_CNTL_SW_SUPDATE_MASK 0x00000002 -#define SW_CNTL_SW_SUPDATE_GET(x) (((x) & SW_CNTL_SW_SUPDATE_MASK) >> SW_CNTL_SW_SUPDATE_LSB) -#define SW_CNTL_SW_SUPDATE_SET(x) (((x) << SW_CNTL_SW_SUPDATE_LSB) & SW_CNTL_SW_SUPDATE_MASK) -#define SW_CNTL_SW_SOUT_MSB 0 -#define SW_CNTL_SW_SOUT_LSB 0 -#define SW_CNTL_SW_SOUT_MASK 0x00000001 -#define SW_CNTL_SW_SOUT_GET(x) (((x) & SW_CNTL_SW_SOUT_MASK) >> SW_CNTL_SW_SOUT_LSB) -#define SW_CNTL_SW_SOUT_SET(x) (((x) << SW_CNTL_SW_SOUT_LSB) & SW_CNTL_SW_SOUT_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct analog_intf_reg_reg_s { - unsigned char pad0[128]; /* pad to 0x80 */ - volatile unsigned int sw_override; - volatile unsigned int sin_val; - volatile unsigned int sw_sclk; - volatile unsigned int sw_cntl; -} analog_intf_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _ANALOG_INTF_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_intf_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_intf_reg.vrh deleted file mode 100644 index ade586e92eec..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_intf_reg.vrh +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef _ANALOG_INTF_REG_VRH_ -#define _ANALOG_INTF_REG_VRH_ - -#define SW_OVERRIDE_ADDRESS 'h00000080 -#define SW_OVERRIDE_SUPDATE_DELAY_MSB 1 -#define SW_OVERRIDE_SUPDATE_DELAY_LSB 1 -#define SW_OVERRIDE_SUPDATE_DELAY_MASK 'h00000002 -#define SW_OVERRIDE_SUPDATE_DELAY_GET(x) (((x) & SW_OVERRIDE_SUPDATE_DELAY_MASK) >> SW_OVERRIDE_SUPDATE_DELAY_LSB) -#define SW_OVERRIDE_SUPDATE_DELAY_SET(x) (((32'd0 | (x)) << SW_OVERRIDE_SUPDATE_DELAY_LSB) & SW_OVERRIDE_SUPDATE_DELAY_MASK) -#define SW_OVERRIDE_SUPDATE_DELAY_RESET 1'h0 -#define SW_OVERRIDE_ENABLE_MSB 0 -#define SW_OVERRIDE_ENABLE_LSB 0 -#define SW_OVERRIDE_ENABLE_MASK 'h00000001 -#define SW_OVERRIDE_ENABLE_GET(x) (((x) & SW_OVERRIDE_ENABLE_MASK) >> SW_OVERRIDE_ENABLE_LSB) -#define SW_OVERRIDE_ENABLE_SET(x) (((32'd0 | (x)) << SW_OVERRIDE_ENABLE_LSB) & SW_OVERRIDE_ENABLE_MASK) -#define SW_OVERRIDE_ENABLE_RESET 1'h0 -#define SW_OVERRIDE_RESET (32'h0 | \ - SW_OVERRIDE_SUPDATE_DELAY_SET(SW_OVERRIDE_SUPDATE_DELAY_RESET) | \ - SW_OVERRIDE_ENABLE_SET(SW_OVERRIDE_ENABLE_RESET)) -#define SW_OVERRIDE_HW_MASK (32'h0) -#define SW_OVERRIDE_SW_MASK (32'h0 | \ - SW_OVERRIDE_SUPDATE_DELAY_MASK | \ - SW_OVERRIDE_ENABLE_MASK) - -#define SIN_VAL_ADDRESS 'h00000084 -#define SIN_VAL_SIN_MSB 0 -#define SIN_VAL_SIN_LSB 0 -#define SIN_VAL_SIN_MASK 'h00000001 -#define SIN_VAL_SIN_GET(x) (((x) & SIN_VAL_SIN_MASK) >> SIN_VAL_SIN_LSB) -#define SIN_VAL_SIN_SET(x) (((32'd0 | (x)) << SIN_VAL_SIN_LSB) & SIN_VAL_SIN_MASK) -#define SIN_VAL_SIN_RESET 1'h0 -#define SIN_VAL_RESET (32'h0 | \ - SIN_VAL_SIN_SET(SIN_VAL_SIN_RESET)) -#define SIN_VAL_HW_MASK (32'h0 | \ - SIN_VAL_SIN_MASK) -#define SIN_VAL_SW_MASK (32'h0) - -#define SW_SCLK_ADDRESS 'h00000088 -#define SW_SCLK_SW_SCLK_MSB 0 -#define SW_SCLK_SW_SCLK_LSB 0 -#define SW_SCLK_SW_SCLK_MASK 'h00000001 -#define SW_SCLK_SW_SCLK_GET(x) (((x) & SW_SCLK_SW_SCLK_MASK) >> SW_SCLK_SW_SCLK_LSB) -#define SW_SCLK_SW_SCLK_SET(x) (((32'd0 | (x)) << SW_SCLK_SW_SCLK_LSB) & SW_SCLK_SW_SCLK_MASK) -#define SW_SCLK_SW_SCLK_RESET 1'h0 -#define SW_SCLK_RESET (32'h0 | \ - SW_SCLK_SW_SCLK_SET(SW_SCLK_SW_SCLK_RESET)) -#define SW_SCLK_HW_MASK (32'h0) -#define SW_SCLK_SW_MASK (32'h0 | \ - SW_SCLK_SW_SCLK_MASK) - -#define SW_CNTL_ADDRESS 'h0000008c -#define SW_CNTL_SW_SCAPTURE_MSB 2 -#define SW_CNTL_SW_SCAPTURE_LSB 2 -#define SW_CNTL_SW_SCAPTURE_MASK 'h00000004 -#define SW_CNTL_SW_SCAPTURE_GET(x) (((x) & SW_CNTL_SW_SCAPTURE_MASK) >> SW_CNTL_SW_SCAPTURE_LSB) -#define SW_CNTL_SW_SCAPTURE_SET(x) (((32'd0 | (x)) << SW_CNTL_SW_SCAPTURE_LSB) & SW_CNTL_SW_SCAPTURE_MASK) -#define SW_CNTL_SW_SCAPTURE_RESET 1'h0 -#define SW_CNTL_SW_SUPDATE_MSB 1 -#define SW_CNTL_SW_SUPDATE_LSB 1 -#define SW_CNTL_SW_SUPDATE_MASK 'h00000002 -#define SW_CNTL_SW_SUPDATE_GET(x) (((x) & SW_CNTL_SW_SUPDATE_MASK) >> SW_CNTL_SW_SUPDATE_LSB) -#define SW_CNTL_SW_SUPDATE_SET(x) (((32'd0 | (x)) << SW_CNTL_SW_SUPDATE_LSB) & SW_CNTL_SW_SUPDATE_MASK) -#define SW_CNTL_SW_SUPDATE_RESET 1'h0 -#define SW_CNTL_SW_SOUT_MSB 0 -#define SW_CNTL_SW_SOUT_LSB 0 -#define SW_CNTL_SW_SOUT_MASK 'h00000001 -#define SW_CNTL_SW_SOUT_GET(x) (((x) & SW_CNTL_SW_SOUT_MASK) >> SW_CNTL_SW_SOUT_LSB) -#define SW_CNTL_SW_SOUT_SET(x) (((32'd0 | (x)) << SW_CNTL_SW_SOUT_LSB) & SW_CNTL_SW_SOUT_MASK) -#define SW_CNTL_SW_SOUT_RESET 1'h0 -#define SW_CNTL_RESET (32'h0 | \ - SW_CNTL_SW_SCAPTURE_SET(SW_CNTL_SW_SCAPTURE_RESET) | \ - SW_CNTL_SW_SUPDATE_SET(SW_CNTL_SW_SUPDATE_RESET) | \ - SW_CNTL_SW_SOUT_SET(SW_CNTL_SW_SOUT_RESET)) -#define SW_CNTL_HW_MASK (32'h0) -#define SW_CNTL_SW_MASK (32'h0 | \ - SW_CNTL_SW_SCAPTURE_MASK | \ - SW_CNTL_SW_SUPDATE_MASK | \ - SW_CNTL_SW_SOUT_MASK) - -#define ANALOG_INTF_REG_ADDRESS_MSB 7 - -#endif /* _ANALOG_INTF_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_reg.h deleted file mode 100644 index cf562b86f655..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_reg.h +++ /dev/null @@ -1,1932 +0,0 @@ -#ifndef _ANALOG_REG_REG_H_ -#define _ANALOG_REG_REG_H_ - -#define SYNTH_SYNTH1_ADDRESS 0x00000000 -#define SYNTH_SYNTH1_OFFSET 0x00000000 -#define SYNTH_SYNTH1_PWD_BIAS_MSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_LSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_MASK 0x80000000 -#define SYNTH_SYNTH1_PWD_BIAS_GET(x) (((x) & SYNTH_SYNTH1_PWD_BIAS_MASK) >> SYNTH_SYNTH1_PWD_BIAS_LSB) -#define SYNTH_SYNTH1_PWD_BIAS_SET(x) (((x) << SYNTH_SYNTH1_PWD_BIAS_LSB) & SYNTH_SYNTH1_PWD_BIAS_MASK) -#define SYNTH_SYNTH1_PWD_CP_MSB 30 -#define SYNTH_SYNTH1_PWD_CP_LSB 30 -#define SYNTH_SYNTH1_PWD_CP_MASK 0x40000000 -#define SYNTH_SYNTH1_PWD_CP_GET(x) (((x) & SYNTH_SYNTH1_PWD_CP_MASK) >> SYNTH_SYNTH1_PWD_CP_LSB) -#define SYNTH_SYNTH1_PWD_CP_SET(x) (((x) << SYNTH_SYNTH1_PWD_CP_LSB) & SYNTH_SYNTH1_PWD_CP_MASK) -#define SYNTH_SYNTH1_PWD_VCMON_MSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_LSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_MASK 0x20000000 -#define SYNTH_SYNTH1_PWD_VCMON_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCMON_MASK) >> SYNTH_SYNTH1_PWD_VCMON_LSB) -#define SYNTH_SYNTH1_PWD_VCMON_SET(x) (((x) << SYNTH_SYNTH1_PWD_VCMON_LSB) & SYNTH_SYNTH1_PWD_VCMON_MASK) -#define SYNTH_SYNTH1_PWD_VCO_MSB 28 -#define SYNTH_SYNTH1_PWD_VCO_LSB 28 -#define SYNTH_SYNTH1_PWD_VCO_MASK 0x10000000 -#define SYNTH_SYNTH1_PWD_VCO_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCO_MASK) >> SYNTH_SYNTH1_PWD_VCO_LSB) -#define SYNTH_SYNTH1_PWD_VCO_SET(x) (((x) << SYNTH_SYNTH1_PWD_VCO_LSB) & SYNTH_SYNTH1_PWD_VCO_MASK) -#define SYNTH_SYNTH1_PWD_PRESC_MSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_LSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_MASK 0x08000000 -#define SYNTH_SYNTH1_PWD_PRESC_GET(x) (((x) & SYNTH_SYNTH1_PWD_PRESC_MASK) >> SYNTH_SYNTH1_PWD_PRESC_LSB) -#define SYNTH_SYNTH1_PWD_PRESC_SET(x) (((x) << SYNTH_SYNTH1_PWD_PRESC_LSB) & SYNTH_SYNTH1_PWD_PRESC_MASK) -#define SYNTH_SYNTH1_PWD_LODIV_MSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_LSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_MASK 0x04000000 -#define SYNTH_SYNTH1_PWD_LODIV_GET(x) (((x) & SYNTH_SYNTH1_PWD_LODIV_MASK) >> SYNTH_SYNTH1_PWD_LODIV_LSB) -#define SYNTH_SYNTH1_PWD_LODIV_SET(x) (((x) << SYNTH_SYNTH1_PWD_LODIV_LSB) & SYNTH_SYNTH1_PWD_LODIV_MASK) -#define SYNTH_SYNTH1_PWD_LOMIX_MSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_LSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_MASK 0x02000000 -#define SYNTH_SYNTH1_PWD_LOMIX_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOMIX_MASK) >> SYNTH_SYNTH1_PWD_LOMIX_LSB) -#define SYNTH_SYNTH1_PWD_LOMIX_SET(x) (((x) << SYNTH_SYNTH1_PWD_LOMIX_LSB) & SYNTH_SYNTH1_PWD_LOMIX_MASK) -#define SYNTH_SYNTH1_FORCE_LO_ON_MSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_LSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_MASK 0x01000000 -#define SYNTH_SYNTH1_FORCE_LO_ON_GET(x) (((x) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) >> SYNTH_SYNTH1_FORCE_LO_ON_LSB) -#define SYNTH_SYNTH1_FORCE_LO_ON_SET(x) (((x) << SYNTH_SYNTH1_FORCE_LO_ON_LSB) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) -#define SYNTH_SYNTH1_PWD_LOBUF5G_MSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_LSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_MASK 0x00800000 -#define SYNTH_SYNTH1_PWD_LOBUF5G_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) >> SYNTH_SYNTH1_PWD_LOBUF5G_LSB) -#define SYNTH_SYNTH1_PWD_LOBUF5G_SET(x) (((x) << SYNTH_SYNTH1_PWD_LOBUF5G_LSB) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) -#define SYNTH_SYNTH1_VCOREGBYPASS_MSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_LSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_MASK 0x00400000 -#define SYNTH_SYNTH1_VCOREGBYPASS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) >> SYNTH_SYNTH1_VCOREGBYPASS_LSB) -#define SYNTH_SYNTH1_VCOREGBYPASS_SET(x) (((x) << SYNTH_SYNTH1_VCOREGBYPASS_LSB) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) -#define SYNTH_SYNTH1_VCOREGLEVEL_MSB 21 -#define SYNTH_SYNTH1_VCOREGLEVEL_LSB 20 -#define SYNTH_SYNTH1_VCOREGLEVEL_MASK 0x00300000 -#define SYNTH_SYNTH1_VCOREGLEVEL_GET(x) (((x) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) >> SYNTH_SYNTH1_VCOREGLEVEL_LSB) -#define SYNTH_SYNTH1_VCOREGLEVEL_SET(x) (((x) << SYNTH_SYNTH1_VCOREGLEVEL_LSB) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) -#define SYNTH_SYNTH1_VCOREGBIAS_MSB 19 -#define SYNTH_SYNTH1_VCOREGBIAS_LSB 18 -#define SYNTH_SYNTH1_VCOREGBIAS_MASK 0x000c0000 -#define SYNTH_SYNTH1_VCOREGBIAS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBIAS_MASK) >> SYNTH_SYNTH1_VCOREGBIAS_LSB) -#define SYNTH_SYNTH1_VCOREGBIAS_SET(x) (((x) << SYNTH_SYNTH1_VCOREGBIAS_LSB) & SYNTH_SYNTH1_VCOREGBIAS_MASK) -#define SYNTH_SYNTH1_SLIDINGIF_MSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_LSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_MASK 0x00020000 -#define SYNTH_SYNTH1_SLIDINGIF_GET(x) (((x) & SYNTH_SYNTH1_SLIDINGIF_MASK) >> SYNTH_SYNTH1_SLIDINGIF_LSB) -#define SYNTH_SYNTH1_SLIDINGIF_SET(x) (((x) << SYNTH_SYNTH1_SLIDINGIF_LSB) & SYNTH_SYNTH1_SLIDINGIF_MASK) -#define SYNTH_SYNTH1_SPARE_PWD_MSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_LSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_MASK 0x00010000 -#define SYNTH_SYNTH1_SPARE_PWD_GET(x) (((x) & SYNTH_SYNTH1_SPARE_PWD_MASK) >> SYNTH_SYNTH1_SPARE_PWD_LSB) -#define SYNTH_SYNTH1_SPARE_PWD_SET(x) (((x) << SYNTH_SYNTH1_SPARE_PWD_LSB) & SYNTH_SYNTH1_SPARE_PWD_MASK) -#define SYNTH_SYNTH1_CON_VDDVCOREG_MSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_LSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_MASK 0x00008000 -#define SYNTH_SYNTH1_CON_VDDVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) >> SYNTH_SYNTH1_CON_VDDVCOREG_LSB) -#define SYNTH_SYNTH1_CON_VDDVCOREG_SET(x) (((x) << SYNTH_SYNTH1_CON_VDDVCOREG_LSB) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) -#define SYNTH_SYNTH1_CON_IVCOREG_MSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_LSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_MASK 0x00004000 -#define SYNTH_SYNTH1_CON_IVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOREG_MASK) >> SYNTH_SYNTH1_CON_IVCOREG_LSB) -#define SYNTH_SYNTH1_CON_IVCOREG_SET(x) (((x) << SYNTH_SYNTH1_CON_IVCOREG_LSB) & SYNTH_SYNTH1_CON_IVCOREG_MASK) -#define SYNTH_SYNTH1_CON_IVCOBUF_MSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_LSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_MASK 0x00002000 -#define SYNTH_SYNTH1_CON_IVCOBUF_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) >> SYNTH_SYNTH1_CON_IVCOBUF_LSB) -#define SYNTH_SYNTH1_CON_IVCOBUF_SET(x) (((x) << SYNTH_SYNTH1_CON_IVCOBUF_LSB) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) -#define SYNTH_SYNTH1_SEL_VCMONABUS_MSB 12 -#define SYNTH_SYNTH1_SEL_VCMONABUS_LSB 10 -#define SYNTH_SYNTH1_SEL_VCMONABUS_MASK 0x00001c00 -#define SYNTH_SYNTH1_SEL_VCMONABUS_GET(x) (((x) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) >> SYNTH_SYNTH1_SEL_VCMONABUS_LSB) -#define SYNTH_SYNTH1_SEL_VCMONABUS_SET(x) (((x) << SYNTH_SYNTH1_SEL_VCMONABUS_LSB) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK 0x00000200 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) >> SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_LSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MASK 0x00000100 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) >> SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK 0x00000080 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK 0x00000040 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_MSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_LSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_MASK 0x00000020 -#define SYNTH_SYNTH1_MONITOR_FB_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_MASK) >> SYNTH_SYNTH1_MONITOR_FB_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_FB_LSB) & SYNTH_SYNTH1_MONITOR_FB_MASK) -#define SYNTH_SYNTH1_MONITOR_REF_MSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_LSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_MASK 0x00000010 -#define SYNTH_SYNTH1_MONITOR_REF_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_REF_MASK) >> SYNTH_SYNTH1_MONITOR_REF_LSB) -#define SYNTH_SYNTH1_MONITOR_REF_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_REF_LSB) & SYNTH_SYNTH1_MONITOR_REF_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK 0x00000008 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) >> SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK 0x00000004 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) >> SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_LSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MASK 0x00000002 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) >> SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK 0x00000001 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) >> SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) - -#define SYNTH_SYNTH2_ADDRESS 0x00000004 -#define SYNTH_SYNTH2_OFFSET 0x00000004 -#define SYNTH_SYNTH2_VC_CAL_REF_MSB 31 -#define SYNTH_SYNTH2_VC_CAL_REF_LSB 29 -#define SYNTH_SYNTH2_VC_CAL_REF_MASK 0xe0000000 -#define SYNTH_SYNTH2_VC_CAL_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_CAL_REF_MASK) >> SYNTH_SYNTH2_VC_CAL_REF_LSB) -#define SYNTH_SYNTH2_VC_CAL_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_CAL_REF_LSB) & SYNTH_SYNTH2_VC_CAL_REF_MASK) -#define SYNTH_SYNTH2_VC_HI_REF_MSB 28 -#define SYNTH_SYNTH2_VC_HI_REF_LSB 26 -#define SYNTH_SYNTH2_VC_HI_REF_MASK 0x1c000000 -#define SYNTH_SYNTH2_VC_HI_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_HI_REF_MASK) >> SYNTH_SYNTH2_VC_HI_REF_LSB) -#define SYNTH_SYNTH2_VC_HI_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_HI_REF_LSB) & SYNTH_SYNTH2_VC_HI_REF_MASK) -#define SYNTH_SYNTH2_VC_MID_REF_MSB 25 -#define SYNTH_SYNTH2_VC_MID_REF_LSB 23 -#define SYNTH_SYNTH2_VC_MID_REF_MASK 0x03800000 -#define SYNTH_SYNTH2_VC_MID_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_MID_REF_MASK) >> SYNTH_SYNTH2_VC_MID_REF_LSB) -#define SYNTH_SYNTH2_VC_MID_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_MID_REF_LSB) & SYNTH_SYNTH2_VC_MID_REF_MASK) -#define SYNTH_SYNTH2_VC_LOW_REF_MSB 22 -#define SYNTH_SYNTH2_VC_LOW_REF_LSB 20 -#define SYNTH_SYNTH2_VC_LOW_REF_MASK 0x00700000 -#define SYNTH_SYNTH2_VC_LOW_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_LOW_REF_MASK) >> SYNTH_SYNTH2_VC_LOW_REF_LSB) -#define SYNTH_SYNTH2_VC_LOW_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_LOW_REF_LSB) & SYNTH_SYNTH2_VC_LOW_REF_MASK) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MSB 19 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB 15 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK 0x000f8000 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_GET(x) (((x) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) >> SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_SET(x) (((x) << SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) -#define SYNTH_SYNTH2_LOOP_CP_MSB 14 -#define SYNTH_SYNTH2_LOOP_CP_LSB 10 -#define SYNTH_SYNTH2_LOOP_CP_MASK 0x00007c00 -#define SYNTH_SYNTH2_LOOP_CP_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CP_MASK) >> SYNTH_SYNTH2_LOOP_CP_LSB) -#define SYNTH_SYNTH2_LOOP_CP_SET(x) (((x) << SYNTH_SYNTH2_LOOP_CP_LSB) & SYNTH_SYNTH2_LOOP_CP_MASK) -#define SYNTH_SYNTH2_LOOP_RS_MSB 9 -#define SYNTH_SYNTH2_LOOP_RS_LSB 5 -#define SYNTH_SYNTH2_LOOP_RS_MASK 0x000003e0 -#define SYNTH_SYNTH2_LOOP_RS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_RS_MASK) >> SYNTH_SYNTH2_LOOP_RS_LSB) -#define SYNTH_SYNTH2_LOOP_RS_SET(x) (((x) << SYNTH_SYNTH2_LOOP_RS_LSB) & SYNTH_SYNTH2_LOOP_RS_MASK) -#define SYNTH_SYNTH2_LOOP_CS_MSB 4 -#define SYNTH_SYNTH2_LOOP_CS_LSB 3 -#define SYNTH_SYNTH2_LOOP_CS_MASK 0x00000018 -#define SYNTH_SYNTH2_LOOP_CS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CS_MASK) >> SYNTH_SYNTH2_LOOP_CS_LSB) -#define SYNTH_SYNTH2_LOOP_CS_SET(x) (((x) << SYNTH_SYNTH2_LOOP_CS_LSB) & SYNTH_SYNTH2_LOOP_CS_MASK) -#define SYNTH_SYNTH2_SPARE_BITS_MSB 2 -#define SYNTH_SYNTH2_SPARE_BITS_LSB 0 -#define SYNTH_SYNTH2_SPARE_BITS_MASK 0x00000007 -#define SYNTH_SYNTH2_SPARE_BITS_GET(x) (((x) & SYNTH_SYNTH2_SPARE_BITS_MASK) >> SYNTH_SYNTH2_SPARE_BITS_LSB) -#define SYNTH_SYNTH2_SPARE_BITS_SET(x) (((x) << SYNTH_SYNTH2_SPARE_BITS_LSB) & SYNTH_SYNTH2_SPARE_BITS_MASK) - -#define SYNTH_SYNTH3_ADDRESS 0x00000008 -#define SYNTH_SYNTH3_OFFSET 0x00000008 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_LSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MASK 0x80000000 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_GET(x) (((x) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) >> SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) -#define SYNTH_SYNTH3_DIS_CLK_XTAL_SET(x) (((x) << SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_LSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MASK 0x40000000 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_GET(x) (((x) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) >> SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_SET(x) (((x) << SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MSB 29 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB 24 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK 0x3f000000 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_SET(x) (((x) << SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_PWRUP_MSB 23 -#define SYNTH_SYNTH3_WAIT_PWRUP_LSB 18 -#define SYNTH_SYNTH3_WAIT_PWRUP_MASK 0x00fc0000 -#define SYNTH_SYNTH3_WAIT_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_PWRUP_SET(x) (((x) << SYNTH_SYNTH3_WAIT_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MSB 17 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_LSB 12 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MASK 0x0003f000 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_SET(x) (((x) << SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MSB 11 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_LSB 6 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MASK 0x00000fc0 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_SET(x) (((x) << SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MSB 5 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_LSB 0 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MASK 0x0000003f -#define SYNTH_SYNTH3_WAIT_VC_CHECK_GET(x) (((x) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) >> SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_SET(x) (((x) << SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) - -#define SYNTH_SYNTH4_ADDRESS 0x0000000c -#define SYNTH_SYNTH4_OFFSET 0x0000000c -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK 0x80000000 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_GET(x) (((x) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) >> SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_SET(x) (((x) << SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) -#define SYNTH_SYNTH4_DIS_LOSTVC_MSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_LSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_MASK 0x40000000 -#define SYNTH_SYNTH4_DIS_LOSTVC_GET(x) (((x) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) >> SYNTH_SYNTH4_DIS_LOSTVC_LSB) -#define SYNTH_SYNTH4_DIS_LOSTVC_SET(x) (((x) << SYNTH_SYNTH4_DIS_LOSTVC_LSB) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_LSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MASK 0x20000000 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_GET(x) (((x) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) >> SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_SET(x) (((x) << SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK 0x10000000 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_GET(x) (((x) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) >> SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_SET(x) (((x) << SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) -#define SYNTH_SYNTH4_FORCE_PINVC_MSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_LSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_MASK 0x08000000 -#define SYNTH_SYNTH4_FORCE_PINVC_GET(x) (((x) & SYNTH_SYNTH4_FORCE_PINVC_MASK) >> SYNTH_SYNTH4_FORCE_PINVC_LSB) -#define SYNTH_SYNTH4_FORCE_PINVC_SET(x) (((x) << SYNTH_SYNTH4_FORCE_PINVC_LSB) & SYNTH_SYNTH4_FORCE_PINVC_MASK) -#define SYNTH_SYNTH4_FORCE_VCOCAP_MSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_LSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_MASK 0x04000000 -#define SYNTH_SYNTH4_FORCE_VCOCAP_GET(x) (((x) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) >> SYNTH_SYNTH4_FORCE_VCOCAP_LSB) -#define SYNTH_SYNTH4_FORCE_VCOCAP_SET(x) (((x) << SYNTH_SYNTH4_FORCE_VCOCAP_LSB) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) -#define SYNTH_SYNTH4_VCOCAP_OVR_MSB 25 -#define SYNTH_SYNTH4_VCOCAP_OVR_LSB 18 -#define SYNTH_SYNTH4_VCOCAP_OVR_MASK 0x03fc0000 -#define SYNTH_SYNTH4_VCOCAP_OVR_GET(x) (((x) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) >> SYNTH_SYNTH4_VCOCAP_OVR_LSB) -#define SYNTH_SYNTH4_VCOCAP_OVR_SET(x) (((x) << SYNTH_SYNTH4_VCOCAP_OVR_LSB) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) -#define SYNTH_SYNTH4_VCOCAPPULLUP_MSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_LSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_MASK 0x00020000 -#define SYNTH_SYNTH4_VCOCAPPULLUP_GET(x) (((x) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) >> SYNTH_SYNTH4_VCOCAPPULLUP_LSB) -#define SYNTH_SYNTH4_VCOCAPPULLUP_SET(x) (((x) << SYNTH_SYNTH4_VCOCAPPULLUP_LSB) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) -#define SYNTH_SYNTH4_REFDIVSEL_MSB 16 -#define SYNTH_SYNTH4_REFDIVSEL_LSB 15 -#define SYNTH_SYNTH4_REFDIVSEL_MASK 0x00018000 -#define SYNTH_SYNTH4_REFDIVSEL_GET(x) (((x) & SYNTH_SYNTH4_REFDIVSEL_MASK) >> SYNTH_SYNTH4_REFDIVSEL_LSB) -#define SYNTH_SYNTH4_REFDIVSEL_SET(x) (((x) << SYNTH_SYNTH4_REFDIVSEL_LSB) & SYNTH_SYNTH4_REFDIVSEL_MASK) -#define SYNTH_SYNTH4_PFDDELAY_MSB 14 -#define SYNTH_SYNTH4_PFDDELAY_LSB 14 -#define SYNTH_SYNTH4_PFDDELAY_MASK 0x00004000 -#define SYNTH_SYNTH4_PFDDELAY_GET(x) (((x) & SYNTH_SYNTH4_PFDDELAY_MASK) >> SYNTH_SYNTH4_PFDDELAY_LSB) -#define SYNTH_SYNTH4_PFDDELAY_SET(x) (((x) << SYNTH_SYNTH4_PFDDELAY_LSB) & SYNTH_SYNTH4_PFDDELAY_MASK) -#define SYNTH_SYNTH4_PFD_DISABLE_MSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_LSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_MASK 0x00002000 -#define SYNTH_SYNTH4_PFD_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_PFD_DISABLE_MASK) >> SYNTH_SYNTH4_PFD_DISABLE_LSB) -#define SYNTH_SYNTH4_PFD_DISABLE_SET(x) (((x) << SYNTH_SYNTH4_PFD_DISABLE_LSB) & SYNTH_SYNTH4_PFD_DISABLE_MASK) -#define SYNTH_SYNTH4_PRESCSEL_MSB 12 -#define SYNTH_SYNTH4_PRESCSEL_LSB 11 -#define SYNTH_SYNTH4_PRESCSEL_MASK 0x00001800 -#define SYNTH_SYNTH4_PRESCSEL_GET(x) (((x) & SYNTH_SYNTH4_PRESCSEL_MASK) >> SYNTH_SYNTH4_PRESCSEL_LSB) -#define SYNTH_SYNTH4_PRESCSEL_SET(x) (((x) << SYNTH_SYNTH4_PRESCSEL_LSB) & SYNTH_SYNTH4_PRESCSEL_MASK) -#define SYNTH_SYNTH4_RESET_PRESC_MSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_LSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_MASK 0x00000400 -#define SYNTH_SYNTH4_RESET_PRESC_GET(x) (((x) & SYNTH_SYNTH4_RESET_PRESC_MASK) >> SYNTH_SYNTH4_RESET_PRESC_LSB) -#define SYNTH_SYNTH4_RESET_PRESC_SET(x) (((x) << SYNTH_SYNTH4_RESET_PRESC_LSB) & SYNTH_SYNTH4_RESET_PRESC_MASK) -#define SYNTH_SYNTH4_SDM_DISABLE_MSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_LSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_MASK 0x00000200 -#define SYNTH_SYNTH4_SDM_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_SDM_DISABLE_MASK) >> SYNTH_SYNTH4_SDM_DISABLE_LSB) -#define SYNTH_SYNTH4_SDM_DISABLE_SET(x) (((x) << SYNTH_SYNTH4_SDM_DISABLE_LSB) & SYNTH_SYNTH4_SDM_DISABLE_MASK) -#define SYNTH_SYNTH4_SDM_MODE_MSB 8 -#define SYNTH_SYNTH4_SDM_MODE_LSB 8 -#define SYNTH_SYNTH4_SDM_MODE_MASK 0x00000100 -#define SYNTH_SYNTH4_SDM_MODE_GET(x) (((x) & SYNTH_SYNTH4_SDM_MODE_MASK) >> SYNTH_SYNTH4_SDM_MODE_LSB) -#define SYNTH_SYNTH4_SDM_MODE_SET(x) (((x) << SYNTH_SYNTH4_SDM_MODE_LSB) & SYNTH_SYNTH4_SDM_MODE_MASK) -#define SYNTH_SYNTH4_SDM_DITHER_MSB 7 -#define SYNTH_SYNTH4_SDM_DITHER_LSB 6 -#define SYNTH_SYNTH4_SDM_DITHER_MASK 0x000000c0 -#define SYNTH_SYNTH4_SDM_DITHER_GET(x) (((x) & SYNTH_SYNTH4_SDM_DITHER_MASK) >> SYNTH_SYNTH4_SDM_DITHER_LSB) -#define SYNTH_SYNTH4_SDM_DITHER_SET(x) (((x) << SYNTH_SYNTH4_SDM_DITHER_LSB) & SYNTH_SYNTH4_SDM_DITHER_MASK) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK 0x00000020 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_GET(x) (((x) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) >> SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_SET(x) (((x) << SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK 0x00000010 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_GET(x) (((x) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) >> SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_SET(x) (((x) << SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) -#define SYNTH_SYNTH4_SPARE_MISC_MSB 3 -#define SYNTH_SYNTH4_SPARE_MISC_LSB 2 -#define SYNTH_SYNTH4_SPARE_MISC_MASK 0x0000000c -#define SYNTH_SYNTH4_SPARE_MISC_GET(x) (((x) & SYNTH_SYNTH4_SPARE_MISC_MASK) >> SYNTH_SYNTH4_SPARE_MISC_LSB) -#define SYNTH_SYNTH4_SPARE_MISC_SET(x) (((x) << SYNTH_SYNTH4_SPARE_MISC_LSB) & SYNTH_SYNTH4_SPARE_MISC_MASK) -#define SYNTH_SYNTH4_LONGSHIFTSEL_MSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_LSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_MASK 0x00000002 -#define SYNTH_SYNTH4_LONGSHIFTSEL_GET(x) (((x) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) >> SYNTH_SYNTH4_LONGSHIFTSEL_LSB) -#define SYNTH_SYNTH4_LONGSHIFTSEL_SET(x) (((x) << SYNTH_SYNTH4_LONGSHIFTSEL_LSB) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_LSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MASK 0x00000001 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_GET(x) (((x) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) >> SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_SET(x) (((x) << SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) - -#define SYNTH_SYNTH5_ADDRESS 0x00000010 -#define SYNTH_SYNTH5_OFFSET 0x00000010 -#define SYNTH_SYNTH5_LOOP_IP0_MSB 31 -#define SYNTH_SYNTH5_LOOP_IP0_LSB 28 -#define SYNTH_SYNTH5_LOOP_IP0_MASK 0xf0000000 -#define SYNTH_SYNTH5_LOOP_IP0_GET(x) (((x) & SYNTH_SYNTH5_LOOP_IP0_MASK) >> SYNTH_SYNTH5_LOOP_IP0_LSB) -#define SYNTH_SYNTH5_LOOP_IP0_SET(x) (((x) << SYNTH_SYNTH5_LOOP_IP0_LSB) & SYNTH_SYNTH5_LOOP_IP0_MASK) -#define SYNTH_SYNTH5_SLOPE_IP_MSB 27 -#define SYNTH_SYNTH5_SLOPE_IP_LSB 25 -#define SYNTH_SYNTH5_SLOPE_IP_MASK 0x0e000000 -#define SYNTH_SYNTH5_SLOPE_IP_GET(x) (((x) & SYNTH_SYNTH5_SLOPE_IP_MASK) >> SYNTH_SYNTH5_SLOPE_IP_LSB) -#define SYNTH_SYNTH5_SLOPE_IP_SET(x) (((x) << SYNTH_SYNTH5_SLOPE_IP_LSB) & SYNTH_SYNTH5_SLOPE_IP_MASK) -#define SYNTH_SYNTH5_CPBIAS_MSB 24 -#define SYNTH_SYNTH5_CPBIAS_LSB 23 -#define SYNTH_SYNTH5_CPBIAS_MASK 0x01800000 -#define SYNTH_SYNTH5_CPBIAS_GET(x) (((x) & SYNTH_SYNTH5_CPBIAS_MASK) >> SYNTH_SYNTH5_CPBIAS_LSB) -#define SYNTH_SYNTH5_CPBIAS_SET(x) (((x) << SYNTH_SYNTH5_CPBIAS_LSB) & SYNTH_SYNTH5_CPBIAS_MASK) -#define SYNTH_SYNTH5_CPSTEERING_EN_MSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_LSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_MASK 0x00400000 -#define SYNTH_SYNTH5_CPSTEERING_EN_GET(x) (((x) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) >> SYNTH_SYNTH5_CPSTEERING_EN_LSB) -#define SYNTH_SYNTH5_CPSTEERING_EN_SET(x) (((x) << SYNTH_SYNTH5_CPSTEERING_EN_LSB) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) -#define SYNTH_SYNTH5_CPLOWLK_MSB 21 -#define SYNTH_SYNTH5_CPLOWLK_LSB 21 -#define SYNTH_SYNTH5_CPLOWLK_MASK 0x00200000 -#define SYNTH_SYNTH5_CPLOWLK_GET(x) (((x) & SYNTH_SYNTH5_CPLOWLK_MASK) >> SYNTH_SYNTH5_CPLOWLK_LSB) -#define SYNTH_SYNTH5_CPLOWLK_SET(x) (((x) << SYNTH_SYNTH5_CPLOWLK_LSB) & SYNTH_SYNTH5_CPLOWLK_MASK) -#define SYNTH_SYNTH5_LOOPLEAKCUR_MSB 20 -#define SYNTH_SYNTH5_LOOPLEAKCUR_LSB 17 -#define SYNTH_SYNTH5_LOOPLEAKCUR_MASK 0x001e0000 -#define SYNTH_SYNTH5_LOOPLEAKCUR_GET(x) (((x) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) >> SYNTH_SYNTH5_LOOPLEAKCUR_LSB) -#define SYNTH_SYNTH5_LOOPLEAKCUR_SET(x) (((x) << SYNTH_SYNTH5_LOOPLEAKCUR_LSB) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) -#define SYNTH_SYNTH5_CAPRANGE1_MSB 16 -#define SYNTH_SYNTH5_CAPRANGE1_LSB 13 -#define SYNTH_SYNTH5_CAPRANGE1_MASK 0x0001e000 -#define SYNTH_SYNTH5_CAPRANGE1_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE1_MASK) >> SYNTH_SYNTH5_CAPRANGE1_LSB) -#define SYNTH_SYNTH5_CAPRANGE1_SET(x) (((x) << SYNTH_SYNTH5_CAPRANGE1_LSB) & SYNTH_SYNTH5_CAPRANGE1_MASK) -#define SYNTH_SYNTH5_CAPRANGE2_MSB 12 -#define SYNTH_SYNTH5_CAPRANGE2_LSB 9 -#define SYNTH_SYNTH5_CAPRANGE2_MASK 0x00001e00 -#define SYNTH_SYNTH5_CAPRANGE2_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE2_MASK) >> SYNTH_SYNTH5_CAPRANGE2_LSB) -#define SYNTH_SYNTH5_CAPRANGE2_SET(x) (((x) << SYNTH_SYNTH5_CAPRANGE2_LSB) & SYNTH_SYNTH5_CAPRANGE2_MASK) -#define SYNTH_SYNTH5_CAPRANGE3_MSB 8 -#define SYNTH_SYNTH5_CAPRANGE3_LSB 5 -#define SYNTH_SYNTH5_CAPRANGE3_MASK 0x000001e0 -#define SYNTH_SYNTH5_CAPRANGE3_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE3_MASK) >> SYNTH_SYNTH5_CAPRANGE3_LSB) -#define SYNTH_SYNTH5_CAPRANGE3_SET(x) (((x) << SYNTH_SYNTH5_CAPRANGE3_LSB) & SYNTH_SYNTH5_CAPRANGE3_MASK) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK 0x00000010 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_SET(x) (((x) << SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MSB 3 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB 2 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK 0x0000000c -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_GET(x) (((x) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) >> SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_SET(x) (((x) << SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) -#define SYNTH_SYNTH5_SPARE_MSB 1 -#define SYNTH_SYNTH5_SPARE_LSB 0 -#define SYNTH_SYNTH5_SPARE_MASK 0x00000003 -#define SYNTH_SYNTH5_SPARE_GET(x) (((x) & SYNTH_SYNTH5_SPARE_MASK) >> SYNTH_SYNTH5_SPARE_LSB) -#define SYNTH_SYNTH5_SPARE_SET(x) (((x) << SYNTH_SYNTH5_SPARE_LSB) & SYNTH_SYNTH5_SPARE_MASK) - -#define SYNTH_SYNTH6_ADDRESS 0x00000014 -#define SYNTH_SYNTH6_OFFSET 0x00000014 -#define SYNTH_SYNTH6_IRCP_MSB 31 -#define SYNTH_SYNTH6_IRCP_LSB 29 -#define SYNTH_SYNTH6_IRCP_MASK 0xe0000000 -#define SYNTH_SYNTH6_IRCP_GET(x) (((x) & SYNTH_SYNTH6_IRCP_MASK) >> SYNTH_SYNTH6_IRCP_LSB) -#define SYNTH_SYNTH6_IRCP_SET(x) (((x) << SYNTH_SYNTH6_IRCP_LSB) & SYNTH_SYNTH6_IRCP_MASK) -#define SYNTH_SYNTH6_IRVCMON_MSB 28 -#define SYNTH_SYNTH6_IRVCMON_LSB 26 -#define SYNTH_SYNTH6_IRVCMON_MASK 0x1c000000 -#define SYNTH_SYNTH6_IRVCMON_GET(x) (((x) & SYNTH_SYNTH6_IRVCMON_MASK) >> SYNTH_SYNTH6_IRVCMON_LSB) -#define SYNTH_SYNTH6_IRVCMON_SET(x) (((x) << SYNTH_SYNTH6_IRVCMON_LSB) & SYNTH_SYNTH6_IRVCMON_MASK) -#define SYNTH_SYNTH6_IRSPARE_MSB 25 -#define SYNTH_SYNTH6_IRSPARE_LSB 23 -#define SYNTH_SYNTH6_IRSPARE_MASK 0x03800000 -#define SYNTH_SYNTH6_IRSPARE_GET(x) (((x) & SYNTH_SYNTH6_IRSPARE_MASK) >> SYNTH_SYNTH6_IRSPARE_LSB) -#define SYNTH_SYNTH6_IRSPARE_SET(x) (((x) << SYNTH_SYNTH6_IRSPARE_LSB) & SYNTH_SYNTH6_IRSPARE_MASK) -#define SYNTH_SYNTH6_ICPRESC_MSB 22 -#define SYNTH_SYNTH6_ICPRESC_LSB 20 -#define SYNTH_SYNTH6_ICPRESC_MASK 0x00700000 -#define SYNTH_SYNTH6_ICPRESC_GET(x) (((x) & SYNTH_SYNTH6_ICPRESC_MASK) >> SYNTH_SYNTH6_ICPRESC_LSB) -#define SYNTH_SYNTH6_ICPRESC_SET(x) (((x) << SYNTH_SYNTH6_ICPRESC_LSB) & SYNTH_SYNTH6_ICPRESC_MASK) -#define SYNTH_SYNTH6_ICLODIV_MSB 19 -#define SYNTH_SYNTH6_ICLODIV_LSB 17 -#define SYNTH_SYNTH6_ICLODIV_MASK 0x000e0000 -#define SYNTH_SYNTH6_ICLODIV_GET(x) (((x) & SYNTH_SYNTH6_ICLODIV_MASK) >> SYNTH_SYNTH6_ICLODIV_LSB) -#define SYNTH_SYNTH6_ICLODIV_SET(x) (((x) << SYNTH_SYNTH6_ICLODIV_LSB) & SYNTH_SYNTH6_ICLODIV_MASK) -#define SYNTH_SYNTH6_ICLOMIX_MSB 16 -#define SYNTH_SYNTH6_ICLOMIX_LSB 14 -#define SYNTH_SYNTH6_ICLOMIX_MASK 0x0001c000 -#define SYNTH_SYNTH6_ICLOMIX_GET(x) (((x) & SYNTH_SYNTH6_ICLOMIX_MASK) >> SYNTH_SYNTH6_ICLOMIX_LSB) -#define SYNTH_SYNTH6_ICLOMIX_SET(x) (((x) << SYNTH_SYNTH6_ICLOMIX_LSB) & SYNTH_SYNTH6_ICLOMIX_MASK) -#define SYNTH_SYNTH6_ICSPAREA_MSB 13 -#define SYNTH_SYNTH6_ICSPAREA_LSB 11 -#define SYNTH_SYNTH6_ICSPAREA_MASK 0x00003800 -#define SYNTH_SYNTH6_ICSPAREA_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREA_MASK) >> SYNTH_SYNTH6_ICSPAREA_LSB) -#define SYNTH_SYNTH6_ICSPAREA_SET(x) (((x) << SYNTH_SYNTH6_ICSPAREA_LSB) & SYNTH_SYNTH6_ICSPAREA_MASK) -#define SYNTH_SYNTH6_ICSPAREB_MSB 10 -#define SYNTH_SYNTH6_ICSPAREB_LSB 8 -#define SYNTH_SYNTH6_ICSPAREB_MASK 0x00000700 -#define SYNTH_SYNTH6_ICSPAREB_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREB_MASK) >> SYNTH_SYNTH6_ICSPAREB_LSB) -#define SYNTH_SYNTH6_ICSPAREB_SET(x) (((x) << SYNTH_SYNTH6_ICSPAREB_LSB) & SYNTH_SYNTH6_ICSPAREB_MASK) -#define SYNTH_SYNTH6_ICVCO_MSB 7 -#define SYNTH_SYNTH6_ICVCO_LSB 5 -#define SYNTH_SYNTH6_ICVCO_MASK 0x000000e0 -#define SYNTH_SYNTH6_ICVCO_GET(x) (((x) & SYNTH_SYNTH6_ICVCO_MASK) >> SYNTH_SYNTH6_ICVCO_LSB) -#define SYNTH_SYNTH6_ICVCO_SET(x) (((x) << SYNTH_SYNTH6_ICVCO_LSB) & SYNTH_SYNTH6_ICVCO_MASK) -#define SYNTH_SYNTH6_VCOBUFBIAS_MSB 4 -#define SYNTH_SYNTH6_VCOBUFBIAS_LSB 3 -#define SYNTH_SYNTH6_VCOBUFBIAS_MASK 0x00000018 -#define SYNTH_SYNTH6_VCOBUFBIAS_GET(x) (((x) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) >> SYNTH_SYNTH6_VCOBUFBIAS_LSB) -#define SYNTH_SYNTH6_VCOBUFBIAS_SET(x) (((x) << SYNTH_SYNTH6_VCOBUFBIAS_LSB) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) -#define SYNTH_SYNTH6_SPARE_BIAS_MSB 2 -#define SYNTH_SYNTH6_SPARE_BIAS_LSB 0 -#define SYNTH_SYNTH6_SPARE_BIAS_MASK 0x00000007 -#define SYNTH_SYNTH6_SPARE_BIAS_GET(x) (((x) & SYNTH_SYNTH6_SPARE_BIAS_MASK) >> SYNTH_SYNTH6_SPARE_BIAS_LSB) -#define SYNTH_SYNTH6_SPARE_BIAS_SET(x) (((x) << SYNTH_SYNTH6_SPARE_BIAS_LSB) & SYNTH_SYNTH6_SPARE_BIAS_MASK) - -#define SYNTH_SYNTH7_ADDRESS 0x00000018 -#define SYNTH_SYNTH7_OFFSET 0x00000018 -#define SYNTH_SYNTH7_SYNTH_ON_MSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_LSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_MASK 0x80000000 -#define SYNTH_SYNTH7_SYNTH_ON_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_ON_MASK) >> SYNTH_SYNTH7_SYNTH_ON_LSB) -#define SYNTH_SYNTH7_SYNTH_ON_SET(x) (((x) << SYNTH_SYNTH7_SYNTH_ON_LSB) & SYNTH_SYNTH7_SYNTH_ON_MASK) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MSB 30 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_LSB 27 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MASK 0x78000000 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) >> SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_SET(x) (((x) << SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) -#define SYNTH_SYNTH7_CAP_SEARCH_MSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_LSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_MASK 0x04000000 -#define SYNTH_SYNTH7_CAP_SEARCH_GET(x) (((x) & SYNTH_SYNTH7_CAP_SEARCH_MASK) >> SYNTH_SYNTH7_CAP_SEARCH_LSB) -#define SYNTH_SYNTH7_CAP_SEARCH_SET(x) (((x) << SYNTH_SYNTH7_CAP_SEARCH_LSB) & SYNTH_SYNTH7_CAP_SEARCH_MASK) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK 0x02000000 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) >> SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_SET(x) (((x) << SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) -#define SYNTH_SYNTH7_PIN_VC_MSB 24 -#define SYNTH_SYNTH7_PIN_VC_LSB 24 -#define SYNTH_SYNTH7_PIN_VC_MASK 0x01000000 -#define SYNTH_SYNTH7_PIN_VC_GET(x) (((x) & SYNTH_SYNTH7_PIN_VC_MASK) >> SYNTH_SYNTH7_PIN_VC_LSB) -#define SYNTH_SYNTH7_PIN_VC_SET(x) (((x) << SYNTH_SYNTH7_PIN_VC_LSB) & SYNTH_SYNTH7_PIN_VC_MASK) -#define SYNTH_SYNTH7_VCO_CAP_ST_MSB 23 -#define SYNTH_SYNTH7_VCO_CAP_ST_LSB 16 -#define SYNTH_SYNTH7_VCO_CAP_ST_MASK 0x00ff0000 -#define SYNTH_SYNTH7_VCO_CAP_ST_GET(x) (((x) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) >> SYNTH_SYNTH7_VCO_CAP_ST_LSB) -#define SYNTH_SYNTH7_VCO_CAP_ST_SET(x) (((x) << SYNTH_SYNTH7_VCO_CAP_ST_LSB) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) -#define SYNTH_SYNTH7_SHORT_R_MSB 15 -#define SYNTH_SYNTH7_SHORT_R_LSB 15 -#define SYNTH_SYNTH7_SHORT_R_MASK 0x00008000 -#define SYNTH_SYNTH7_SHORT_R_GET(x) (((x) & SYNTH_SYNTH7_SHORT_R_MASK) >> SYNTH_SYNTH7_SHORT_R_LSB) -#define SYNTH_SYNTH7_SHORT_R_SET(x) (((x) << SYNTH_SYNTH7_SHORT_R_LSB) & SYNTH_SYNTH7_SHORT_R_MASK) -#define SYNTH_SYNTH7_RESET_RFD_MSB 14 -#define SYNTH_SYNTH7_RESET_RFD_LSB 14 -#define SYNTH_SYNTH7_RESET_RFD_MASK 0x00004000 -#define SYNTH_SYNTH7_RESET_RFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_RFD_MASK) >> SYNTH_SYNTH7_RESET_RFD_LSB) -#define SYNTH_SYNTH7_RESET_RFD_SET(x) (((x) << SYNTH_SYNTH7_RESET_RFD_LSB) & SYNTH_SYNTH7_RESET_RFD_MASK) -#define SYNTH_SYNTH7_RESET_PFD_MSB 13 -#define SYNTH_SYNTH7_RESET_PFD_LSB 13 -#define SYNTH_SYNTH7_RESET_PFD_MASK 0x00002000 -#define SYNTH_SYNTH7_RESET_PFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_PFD_MASK) >> SYNTH_SYNTH7_RESET_PFD_LSB) -#define SYNTH_SYNTH7_RESET_PFD_SET(x) (((x) << SYNTH_SYNTH7_RESET_PFD_LSB) & SYNTH_SYNTH7_RESET_PFD_MASK) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK 0x00001000 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_GET(x) (((x) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) >> SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_SET(x) (((x) << SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) -#define SYNTH_SYNTH7_RESET_SDM_B_MSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_LSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_MASK 0x00000800 -#define SYNTH_SYNTH7_RESET_SDM_B_GET(x) (((x) & SYNTH_SYNTH7_RESET_SDM_B_MASK) >> SYNTH_SYNTH7_RESET_SDM_B_LSB) -#define SYNTH_SYNTH7_RESET_SDM_B_SET(x) (((x) << SYNTH_SYNTH7_RESET_SDM_B_LSB) & SYNTH_SYNTH7_RESET_SDM_B_MASK) -#define SYNTH_SYNTH7_VC2HIGH_MSB 10 -#define SYNTH_SYNTH7_VC2HIGH_LSB 10 -#define SYNTH_SYNTH7_VC2HIGH_MASK 0x00000400 -#define SYNTH_SYNTH7_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH7_VC2HIGH_MASK) >> SYNTH_SYNTH7_VC2HIGH_LSB) -#define SYNTH_SYNTH7_VC2HIGH_SET(x) (((x) << SYNTH_SYNTH7_VC2HIGH_LSB) & SYNTH_SYNTH7_VC2HIGH_MASK) -#define SYNTH_SYNTH7_VC2LOW_MSB 9 -#define SYNTH_SYNTH7_VC2LOW_LSB 9 -#define SYNTH_SYNTH7_VC2LOW_MASK 0x00000200 -#define SYNTH_SYNTH7_VC2LOW_GET(x) (((x) & SYNTH_SYNTH7_VC2LOW_MASK) >> SYNTH_SYNTH7_VC2LOW_LSB) -#define SYNTH_SYNTH7_VC2LOW_SET(x) (((x) << SYNTH_SYNTH7_VC2LOW_LSB) & SYNTH_SYNTH7_VC2LOW_MASK) -#define SYNTH_SYNTH7_LOOP_IP_MSB 8 -#define SYNTH_SYNTH7_LOOP_IP_LSB 5 -#define SYNTH_SYNTH7_LOOP_IP_MASK 0x000001e0 -#define SYNTH_SYNTH7_LOOP_IP_GET(x) (((x) & SYNTH_SYNTH7_LOOP_IP_MASK) >> SYNTH_SYNTH7_LOOP_IP_LSB) -#define SYNTH_SYNTH7_LOOP_IP_SET(x) (((x) << SYNTH_SYNTH7_LOOP_IP_LSB) & SYNTH_SYNTH7_LOOP_IP_MASK) -#define SYNTH_SYNTH7_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH7_LOBUF5GTUNE_LSB 3 -#define SYNTH_SYNTH7_LOBUF5GTUNE_MASK 0x00000018 -#define SYNTH_SYNTH7_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH7_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH7_LOBUF5GTUNE_SET(x) (((x) << SYNTH_SYNTH7_LOBUF5GTUNE_LSB) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH7_SPARE_READ_MSB 2 -#define SYNTH_SYNTH7_SPARE_READ_LSB 0 -#define SYNTH_SYNTH7_SPARE_READ_MASK 0x00000007 -#define SYNTH_SYNTH7_SPARE_READ_GET(x) (((x) & SYNTH_SYNTH7_SPARE_READ_MASK) >> SYNTH_SYNTH7_SPARE_READ_LSB) -#define SYNTH_SYNTH7_SPARE_READ_SET(x) (((x) << SYNTH_SYNTH7_SPARE_READ_LSB) & SYNTH_SYNTH7_SPARE_READ_MASK) - -#define SYNTH_SYNTH8_ADDRESS 0x0000001c -#define SYNTH_SYNTH8_OFFSET 0x0000001c -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK 0x80000000 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_GET(x) (((x) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) >> SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_SET(x) (((x) << SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) -#define SYNTH_SYNTH8_FRACMODE_MSB 30 -#define SYNTH_SYNTH8_FRACMODE_LSB 30 -#define SYNTH_SYNTH8_FRACMODE_MASK 0x40000000 -#define SYNTH_SYNTH8_FRACMODE_GET(x) (((x) & SYNTH_SYNTH8_FRACMODE_MASK) >> SYNTH_SYNTH8_FRACMODE_LSB) -#define SYNTH_SYNTH8_FRACMODE_SET(x) (((x) << SYNTH_SYNTH8_FRACMODE_LSB) & SYNTH_SYNTH8_FRACMODE_MASK) -#define SYNTH_SYNTH8_AMODEREFSEL_MSB 29 -#define SYNTH_SYNTH8_AMODEREFSEL_LSB 28 -#define SYNTH_SYNTH8_AMODEREFSEL_MASK 0x30000000 -#define SYNTH_SYNTH8_AMODEREFSEL_GET(x) (((x) & SYNTH_SYNTH8_AMODEREFSEL_MASK) >> SYNTH_SYNTH8_AMODEREFSEL_LSB) -#define SYNTH_SYNTH8_AMODEREFSEL_SET(x) (((x) << SYNTH_SYNTH8_AMODEREFSEL_LSB) & SYNTH_SYNTH8_AMODEREFSEL_MASK) -#define SYNTH_SYNTH8_SPARE_MSB 27 -#define SYNTH_SYNTH8_SPARE_LSB 27 -#define SYNTH_SYNTH8_SPARE_MASK 0x08000000 -#define SYNTH_SYNTH8_SPARE_GET(x) (((x) & SYNTH_SYNTH8_SPARE_MASK) >> SYNTH_SYNTH8_SPARE_LSB) -#define SYNTH_SYNTH8_SPARE_SET(x) (((x) << SYNTH_SYNTH8_SPARE_LSB) & SYNTH_SYNTH8_SPARE_MASK) -#define SYNTH_SYNTH8_CHANSEL_MSB 26 -#define SYNTH_SYNTH8_CHANSEL_LSB 18 -#define SYNTH_SYNTH8_CHANSEL_MASK 0x07fc0000 -#define SYNTH_SYNTH8_CHANSEL_GET(x) (((x) & SYNTH_SYNTH8_CHANSEL_MASK) >> SYNTH_SYNTH8_CHANSEL_LSB) -#define SYNTH_SYNTH8_CHANSEL_SET(x) (((x) << SYNTH_SYNTH8_CHANSEL_LSB) & SYNTH_SYNTH8_CHANSEL_MASK) -#define SYNTH_SYNTH8_CHANFRAC_MSB 17 -#define SYNTH_SYNTH8_CHANFRAC_LSB 1 -#define SYNTH_SYNTH8_CHANFRAC_MASK 0x0003fffe -#define SYNTH_SYNTH8_CHANFRAC_GET(x) (((x) & SYNTH_SYNTH8_CHANFRAC_MASK) >> SYNTH_SYNTH8_CHANFRAC_LSB) -#define SYNTH_SYNTH8_CHANFRAC_SET(x) (((x) << SYNTH_SYNTH8_CHANFRAC_LSB) & SYNTH_SYNTH8_CHANFRAC_MASK) -#define SYNTH_SYNTH8_FORCE_FRACLSB_MSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_LSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_MASK 0x00000001 -#define SYNTH_SYNTH8_FORCE_FRACLSB_GET(x) (((x) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) >> SYNTH_SYNTH8_FORCE_FRACLSB_LSB) -#define SYNTH_SYNTH8_FORCE_FRACLSB_SET(x) (((x) << SYNTH_SYNTH8_FORCE_FRACLSB_LSB) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) - -#define RF5G_RF5G1_ADDRESS 0x00000020 -#define RF5G_RF5G1_OFFSET 0x00000020 -#define RF5G_RF5G1_PDTXLO5_MSB 31 -#define RF5G_RF5G1_PDTXLO5_LSB 31 -#define RF5G_RF5G1_PDTXLO5_MASK 0x80000000 -#define RF5G_RF5G1_PDTXLO5_GET(x) (((x) & RF5G_RF5G1_PDTXLO5_MASK) >> RF5G_RF5G1_PDTXLO5_LSB) -#define RF5G_RF5G1_PDTXLO5_SET(x) (((x) << RF5G_RF5G1_PDTXLO5_LSB) & RF5G_RF5G1_PDTXLO5_MASK) -#define RF5G_RF5G1_PDTXMIX5_MSB 30 -#define RF5G_RF5G1_PDTXMIX5_LSB 30 -#define RF5G_RF5G1_PDTXMIX5_MASK 0x40000000 -#define RF5G_RF5G1_PDTXMIX5_GET(x) (((x) & RF5G_RF5G1_PDTXMIX5_MASK) >> RF5G_RF5G1_PDTXMIX5_LSB) -#define RF5G_RF5G1_PDTXMIX5_SET(x) (((x) << RF5G_RF5G1_PDTXMIX5_LSB) & RF5G_RF5G1_PDTXMIX5_MASK) -#define RF5G_RF5G1_PDTXBUF5_MSB 29 -#define RF5G_RF5G1_PDTXBUF5_LSB 29 -#define RF5G_RF5G1_PDTXBUF5_MASK 0x20000000 -#define RF5G_RF5G1_PDTXBUF5_GET(x) (((x) & RF5G_RF5G1_PDTXBUF5_MASK) >> RF5G_RF5G1_PDTXBUF5_LSB) -#define RF5G_RF5G1_PDTXBUF5_SET(x) (((x) << RF5G_RF5G1_PDTXBUF5_LSB) & RF5G_RF5G1_PDTXBUF5_MASK) -#define RF5G_RF5G1_PDPADRV5_MSB 28 -#define RF5G_RF5G1_PDPADRV5_LSB 28 -#define RF5G_RF5G1_PDPADRV5_MASK 0x10000000 -#define RF5G_RF5G1_PDPADRV5_GET(x) (((x) & RF5G_RF5G1_PDPADRV5_MASK) >> RF5G_RF5G1_PDPADRV5_LSB) -#define RF5G_RF5G1_PDPADRV5_SET(x) (((x) << RF5G_RF5G1_PDPADRV5_LSB) & RF5G_RF5G1_PDPADRV5_MASK) -#define RF5G_RF5G1_PDPAOUT5_MSB 27 -#define RF5G_RF5G1_PDPAOUT5_LSB 27 -#define RF5G_RF5G1_PDPAOUT5_MASK 0x08000000 -#define RF5G_RF5G1_PDPAOUT5_GET(x) (((x) & RF5G_RF5G1_PDPAOUT5_MASK) >> RF5G_RF5G1_PDPAOUT5_LSB) -#define RF5G_RF5G1_PDPAOUT5_SET(x) (((x) << RF5G_RF5G1_PDPAOUT5_LSB) & RF5G_RF5G1_PDPAOUT5_MASK) -#define RF5G_RF5G1_TUNE_PADRV5_MSB 26 -#define RF5G_RF5G1_TUNE_PADRV5_LSB 24 -#define RF5G_RF5G1_TUNE_PADRV5_MASK 0x07000000 -#define RF5G_RF5G1_TUNE_PADRV5_GET(x) (((x) & RF5G_RF5G1_TUNE_PADRV5_MASK) >> RF5G_RF5G1_TUNE_PADRV5_LSB) -#define RF5G_RF5G1_TUNE_PADRV5_SET(x) (((x) << RF5G_RF5G1_TUNE_PADRV5_LSB) & RF5G_RF5G1_TUNE_PADRV5_MASK) -#define RF5G_RF5G1_PWDTXPKD_MSB 23 -#define RF5G_RF5G1_PWDTXPKD_LSB 21 -#define RF5G_RF5G1_PWDTXPKD_MASK 0x00e00000 -#define RF5G_RF5G1_PWDTXPKD_GET(x) (((x) & RF5G_RF5G1_PWDTXPKD_MASK) >> RF5G_RF5G1_PWDTXPKD_LSB) -#define RF5G_RF5G1_PWDTXPKD_SET(x) (((x) << RF5G_RF5G1_PWDTXPKD_LSB) & RF5G_RF5G1_PWDTXPKD_MASK) -#define RF5G_RF5G1_DB5_MSB 20 -#define RF5G_RF5G1_DB5_LSB 18 -#define RF5G_RF5G1_DB5_MASK 0x001c0000 -#define RF5G_RF5G1_DB5_GET(x) (((x) & RF5G_RF5G1_DB5_MASK) >> RF5G_RF5G1_DB5_LSB) -#define RF5G_RF5G1_DB5_SET(x) (((x) << RF5G_RF5G1_DB5_LSB) & RF5G_RF5G1_DB5_MASK) -#define RF5G_RF5G1_OB5_MSB 17 -#define RF5G_RF5G1_OB5_LSB 15 -#define RF5G_RF5G1_OB5_MASK 0x00038000 -#define RF5G_RF5G1_OB5_GET(x) (((x) & RF5G_RF5G1_OB5_MASK) >> RF5G_RF5G1_OB5_LSB) -#define RF5G_RF5G1_OB5_SET(x) (((x) << RF5G_RF5G1_OB5_LSB) & RF5G_RF5G1_OB5_MASK) -#define RF5G_RF5G1_TX5_ATB_SEL_MSB 14 -#define RF5G_RF5G1_TX5_ATB_SEL_LSB 12 -#define RF5G_RF5G1_TX5_ATB_SEL_MASK 0x00007000 -#define RF5G_RF5G1_TX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_TX5_ATB_SEL_MASK) >> RF5G_RF5G1_TX5_ATB_SEL_LSB) -#define RF5G_RF5G1_TX5_ATB_SEL_SET(x) (((x) << RF5G_RF5G1_TX5_ATB_SEL_LSB) & RF5G_RF5G1_TX5_ATB_SEL_MASK) -#define RF5G_RF5G1_PDLO5DIV_MSB 11 -#define RF5G_RF5G1_PDLO5DIV_LSB 11 -#define RF5G_RF5G1_PDLO5DIV_MASK 0x00000800 -#define RF5G_RF5G1_PDLO5DIV_GET(x) (((x) & RF5G_RF5G1_PDLO5DIV_MASK) >> RF5G_RF5G1_PDLO5DIV_LSB) -#define RF5G_RF5G1_PDLO5DIV_SET(x) (((x) << RF5G_RF5G1_PDLO5DIV_LSB) & RF5G_RF5G1_PDLO5DIV_MASK) -#define RF5G_RF5G1_PDLO5MIX_MSB 10 -#define RF5G_RF5G1_PDLO5MIX_LSB 10 -#define RF5G_RF5G1_PDLO5MIX_MASK 0x00000400 -#define RF5G_RF5G1_PDLO5MIX_GET(x) (((x) & RF5G_RF5G1_PDLO5MIX_MASK) >> RF5G_RF5G1_PDLO5MIX_LSB) -#define RF5G_RF5G1_PDLO5MIX_SET(x) (((x) << RF5G_RF5G1_PDLO5MIX_LSB) & RF5G_RF5G1_PDLO5MIX_MASK) -#define RF5G_RF5G1_PDQBUF5_MSB 9 -#define RF5G_RF5G1_PDQBUF5_LSB 9 -#define RF5G_RF5G1_PDQBUF5_MASK 0x00000200 -#define RF5G_RF5G1_PDQBUF5_GET(x) (((x) & RF5G_RF5G1_PDQBUF5_MASK) >> RF5G_RF5G1_PDQBUF5_LSB) -#define RF5G_RF5G1_PDQBUF5_SET(x) (((x) << RF5G_RF5G1_PDQBUF5_LSB) & RF5G_RF5G1_PDQBUF5_MASK) -#define RF5G_RF5G1_PDLO5AGC_MSB 8 -#define RF5G_RF5G1_PDLO5AGC_LSB 8 -#define RF5G_RF5G1_PDLO5AGC_MASK 0x00000100 -#define RF5G_RF5G1_PDLO5AGC_GET(x) (((x) & RF5G_RF5G1_PDLO5AGC_MASK) >> RF5G_RF5G1_PDLO5AGC_LSB) -#define RF5G_RF5G1_PDLO5AGC_SET(x) (((x) << RF5G_RF5G1_PDLO5AGC_LSB) & RF5G_RF5G1_PDLO5AGC_MASK) -#define RF5G_RF5G1_PDREGLO5_MSB 7 -#define RF5G_RF5G1_PDREGLO5_LSB 7 -#define RF5G_RF5G1_PDREGLO5_MASK 0x00000080 -#define RF5G_RF5G1_PDREGLO5_GET(x) (((x) & RF5G_RF5G1_PDREGLO5_MASK) >> RF5G_RF5G1_PDREGLO5_LSB) -#define RF5G_RF5G1_PDREGLO5_SET(x) (((x) << RF5G_RF5G1_PDREGLO5_LSB) & RF5G_RF5G1_PDREGLO5_MASK) -#define RF5G_RF5G1_LO5_ATB_SEL_MSB 6 -#define RF5G_RF5G1_LO5_ATB_SEL_LSB 4 -#define RF5G_RF5G1_LO5_ATB_SEL_MASK 0x00000070 -#define RF5G_RF5G1_LO5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_LO5_ATB_SEL_MASK) >> RF5G_RF5G1_LO5_ATB_SEL_LSB) -#define RF5G_RF5G1_LO5_ATB_SEL_SET(x) (((x) << RF5G_RF5G1_LO5_ATB_SEL_LSB) & RF5G_RF5G1_LO5_ATB_SEL_MASK) -#define RF5G_RF5G1_LO5CONTROL_MSB 3 -#define RF5G_RF5G1_LO5CONTROL_LSB 3 -#define RF5G_RF5G1_LO5CONTROL_MASK 0x00000008 -#define RF5G_RF5G1_LO5CONTROL_GET(x) (((x) & RF5G_RF5G1_LO5CONTROL_MASK) >> RF5G_RF5G1_LO5CONTROL_LSB) -#define RF5G_RF5G1_LO5CONTROL_SET(x) (((x) << RF5G_RF5G1_LO5CONTROL_LSB) & RF5G_RF5G1_LO5CONTROL_MASK) -#define RF5G_RF5G1_REGLO_BYPASS5_MSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_LSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_MASK 0x00000004 -#define RF5G_RF5G1_REGLO_BYPASS5_GET(x) (((x) & RF5G_RF5G1_REGLO_BYPASS5_MASK) >> RF5G_RF5G1_REGLO_BYPASS5_LSB) -#define RF5G_RF5G1_REGLO_BYPASS5_SET(x) (((x) << RF5G_RF5G1_REGLO_BYPASS5_LSB) & RF5G_RF5G1_REGLO_BYPASS5_MASK) -#define RF5G_RF5G1_SPARE_MSB 1 -#define RF5G_RF5G1_SPARE_LSB 0 -#define RF5G_RF5G1_SPARE_MASK 0x00000003 -#define RF5G_RF5G1_SPARE_GET(x) (((x) & RF5G_RF5G1_SPARE_MASK) >> RF5G_RF5G1_SPARE_LSB) -#define RF5G_RF5G1_SPARE_SET(x) (((x) << RF5G_RF5G1_SPARE_LSB) & RF5G_RF5G1_SPARE_MASK) - -#define RF5G_RF5G2_ADDRESS 0x00000024 -#define RF5G_RF5G2_OFFSET 0x00000024 -#define RF5G_RF5G2_AGCLO_B_MSB 31 -#define RF5G_RF5G2_AGCLO_B_LSB 29 -#define RF5G_RF5G2_AGCLO_B_MASK 0xe0000000 -#define RF5G_RF5G2_AGCLO_B_GET(x) (((x) & RF5G_RF5G2_AGCLO_B_MASK) >> RF5G_RF5G2_AGCLO_B_LSB) -#define RF5G_RF5G2_AGCLO_B_SET(x) (((x) << RF5G_RF5G2_AGCLO_B_LSB) & RF5G_RF5G2_AGCLO_B_MASK) -#define RF5G_RF5G2_RX5_ATB_SEL_MSB 28 -#define RF5G_RF5G2_RX5_ATB_SEL_LSB 26 -#define RF5G_RF5G2_RX5_ATB_SEL_MASK 0x1c000000 -#define RF5G_RF5G2_RX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G2_RX5_ATB_SEL_MASK) >> RF5G_RF5G2_RX5_ATB_SEL_LSB) -#define RF5G_RF5G2_RX5_ATB_SEL_SET(x) (((x) << RF5G_RF5G2_RX5_ATB_SEL_LSB) & RF5G_RF5G2_RX5_ATB_SEL_MASK) -#define RF5G_RF5G2_PDCMOSLO5_MSB 25 -#define RF5G_RF5G2_PDCMOSLO5_LSB 25 -#define RF5G_RF5G2_PDCMOSLO5_MASK 0x02000000 -#define RF5G_RF5G2_PDCMOSLO5_GET(x) (((x) & RF5G_RF5G2_PDCMOSLO5_MASK) >> RF5G_RF5G2_PDCMOSLO5_LSB) -#define RF5G_RF5G2_PDCMOSLO5_SET(x) (((x) << RF5G_RF5G2_PDCMOSLO5_LSB) & RF5G_RF5G2_PDCMOSLO5_MASK) -#define RF5G_RF5G2_PDVGM5_MSB 24 -#define RF5G_RF5G2_PDVGM5_LSB 24 -#define RF5G_RF5G2_PDVGM5_MASK 0x01000000 -#define RF5G_RF5G2_PDVGM5_GET(x) (((x) & RF5G_RF5G2_PDVGM5_MASK) >> RF5G_RF5G2_PDVGM5_LSB) -#define RF5G_RF5G2_PDVGM5_SET(x) (((x) << RF5G_RF5G2_PDVGM5_LSB) & RF5G_RF5G2_PDVGM5_MASK) -#define RF5G_RF5G2_PDCSLNA5_MSB 23 -#define RF5G_RF5G2_PDCSLNA5_LSB 23 -#define RF5G_RF5G2_PDCSLNA5_MASK 0x00800000 -#define RF5G_RF5G2_PDCSLNA5_GET(x) (((x) & RF5G_RF5G2_PDCSLNA5_MASK) >> RF5G_RF5G2_PDCSLNA5_LSB) -#define RF5G_RF5G2_PDCSLNA5_SET(x) (((x) << RF5G_RF5G2_PDCSLNA5_LSB) & RF5G_RF5G2_PDCSLNA5_MASK) -#define RF5G_RF5G2_PDRFVGA5_MSB 22 -#define RF5G_RF5G2_PDRFVGA5_LSB 22 -#define RF5G_RF5G2_PDRFVGA5_MASK 0x00400000 -#define RF5G_RF5G2_PDRFVGA5_GET(x) (((x) & RF5G_RF5G2_PDRFVGA5_MASK) >> RF5G_RF5G2_PDRFVGA5_LSB) -#define RF5G_RF5G2_PDRFVGA5_SET(x) (((x) << RF5G_RF5G2_PDRFVGA5_LSB) & RF5G_RF5G2_PDRFVGA5_MASK) -#define RF5G_RF5G2_PDREGFE5_MSB 21 -#define RF5G_RF5G2_PDREGFE5_LSB 21 -#define RF5G_RF5G2_PDREGFE5_MASK 0x00200000 -#define RF5G_RF5G2_PDREGFE5_GET(x) (((x) & RF5G_RF5G2_PDREGFE5_MASK) >> RF5G_RF5G2_PDREGFE5_LSB) -#define RF5G_RF5G2_PDREGFE5_SET(x) (((x) << RF5G_RF5G2_PDREGFE5_LSB) & RF5G_RF5G2_PDREGFE5_MASK) -#define RF5G_RF5G2_TUNE_RFVGA5_MSB 20 -#define RF5G_RF5G2_TUNE_RFVGA5_LSB 18 -#define RF5G_RF5G2_TUNE_RFVGA5_MASK 0x001c0000 -#define RF5G_RF5G2_TUNE_RFVGA5_GET(x) (((x) & RF5G_RF5G2_TUNE_RFVGA5_MASK) >> RF5G_RF5G2_TUNE_RFVGA5_LSB) -#define RF5G_RF5G2_TUNE_RFVGA5_SET(x) (((x) << RF5G_RF5G2_TUNE_RFVGA5_LSB) & RF5G_RF5G2_TUNE_RFVGA5_MASK) -#define RF5G_RF5G2_BRFVGA5_MSB 17 -#define RF5G_RF5G2_BRFVGA5_LSB 15 -#define RF5G_RF5G2_BRFVGA5_MASK 0x00038000 -#define RF5G_RF5G2_BRFVGA5_GET(x) (((x) & RF5G_RF5G2_BRFVGA5_MASK) >> RF5G_RF5G2_BRFVGA5_LSB) -#define RF5G_RF5G2_BRFVGA5_SET(x) (((x) << RF5G_RF5G2_BRFVGA5_LSB) & RF5G_RF5G2_BRFVGA5_MASK) -#define RF5G_RF5G2_BCSLNA5_MSB 14 -#define RF5G_RF5G2_BCSLNA5_LSB 12 -#define RF5G_RF5G2_BCSLNA5_MASK 0x00007000 -#define RF5G_RF5G2_BCSLNA5_GET(x) (((x) & RF5G_RF5G2_BCSLNA5_MASK) >> RF5G_RF5G2_BCSLNA5_LSB) -#define RF5G_RF5G2_BCSLNA5_SET(x) (((x) << RF5G_RF5G2_BCSLNA5_LSB) & RF5G_RF5G2_BCSLNA5_MASK) -#define RF5G_RF5G2_BVGM5_MSB 11 -#define RF5G_RF5G2_BVGM5_LSB 9 -#define RF5G_RF5G2_BVGM5_MASK 0x00000e00 -#define RF5G_RF5G2_BVGM5_GET(x) (((x) & RF5G_RF5G2_BVGM5_MASK) >> RF5G_RF5G2_BVGM5_LSB) -#define RF5G_RF5G2_BVGM5_SET(x) (((x) << RF5G_RF5G2_BVGM5_LSB) & RF5G_RF5G2_BVGM5_MASK) -#define RF5G_RF5G2_REGFE_BYPASS5_MSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_LSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_MASK 0x00000100 -#define RF5G_RF5G2_REGFE_BYPASS5_GET(x) (((x) & RF5G_RF5G2_REGFE_BYPASS5_MASK) >> RF5G_RF5G2_REGFE_BYPASS5_LSB) -#define RF5G_RF5G2_REGFE_BYPASS5_SET(x) (((x) << RF5G_RF5G2_REGFE_BYPASS5_LSB) & RF5G_RF5G2_REGFE_BYPASS5_MASK) -#define RF5G_RF5G2_LNA5_ATTENMODE_MSB 7 -#define RF5G_RF5G2_LNA5_ATTENMODE_LSB 6 -#define RF5G_RF5G2_LNA5_ATTENMODE_MASK 0x000000c0 -#define RF5G_RF5G2_LNA5_ATTENMODE_GET(x) (((x) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) >> RF5G_RF5G2_LNA5_ATTENMODE_LSB) -#define RF5G_RF5G2_LNA5_ATTENMODE_SET(x) (((x) << RF5G_RF5G2_LNA5_ATTENMODE_LSB) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) -#define RF5G_RF5G2_ENABLE_PCA_MSB 5 -#define RF5G_RF5G2_ENABLE_PCA_LSB 5 -#define RF5G_RF5G2_ENABLE_PCA_MASK 0x00000020 -#define RF5G_RF5G2_ENABLE_PCA_GET(x) (((x) & RF5G_RF5G2_ENABLE_PCA_MASK) >> RF5G_RF5G2_ENABLE_PCA_LSB) -#define RF5G_RF5G2_ENABLE_PCA_SET(x) (((x) << RF5G_RF5G2_ENABLE_PCA_LSB) & RF5G_RF5G2_ENABLE_PCA_MASK) -#define RF5G_RF5G2_TUNE_LO_MSB 4 -#define RF5G_RF5G2_TUNE_LO_LSB 2 -#define RF5G_RF5G2_TUNE_LO_MASK 0x0000001c -#define RF5G_RF5G2_TUNE_LO_GET(x) (((x) & RF5G_RF5G2_TUNE_LO_MASK) >> RF5G_RF5G2_TUNE_LO_LSB) -#define RF5G_RF5G2_TUNE_LO_SET(x) (((x) << RF5G_RF5G2_TUNE_LO_LSB) & RF5G_RF5G2_TUNE_LO_MASK) -#define RF5G_RF5G2_SPARE_MSB 1 -#define RF5G_RF5G2_SPARE_LSB 0 -#define RF5G_RF5G2_SPARE_MASK 0x00000003 -#define RF5G_RF5G2_SPARE_GET(x) (((x) & RF5G_RF5G2_SPARE_MASK) >> RF5G_RF5G2_SPARE_LSB) -#define RF5G_RF5G2_SPARE_SET(x) (((x) << RF5G_RF5G2_SPARE_LSB) & RF5G_RF5G2_SPARE_MASK) - -#define RF2G_RF2G1_ADDRESS 0x00000028 -#define RF2G_RF2G1_OFFSET 0x00000028 -#define RF2G_RF2G1_BLNA1_MSB 31 -#define RF2G_RF2G1_BLNA1_LSB 29 -#define RF2G_RF2G1_BLNA1_MASK 0xe0000000 -#define RF2G_RF2G1_BLNA1_GET(x) (((x) & RF2G_RF2G1_BLNA1_MASK) >> RF2G_RF2G1_BLNA1_LSB) -#define RF2G_RF2G1_BLNA1_SET(x) (((x) << RF2G_RF2G1_BLNA1_LSB) & RF2G_RF2G1_BLNA1_MASK) -#define RF2G_RF2G1_BLNA1F_MSB 28 -#define RF2G_RF2G1_BLNA1F_LSB 26 -#define RF2G_RF2G1_BLNA1F_MASK 0x1c000000 -#define RF2G_RF2G1_BLNA1F_GET(x) (((x) & RF2G_RF2G1_BLNA1F_MASK) >> RF2G_RF2G1_BLNA1F_LSB) -#define RF2G_RF2G1_BLNA1F_SET(x) (((x) << RF2G_RF2G1_BLNA1F_LSB) & RF2G_RF2G1_BLNA1F_MASK) -#define RF2G_RF2G1_BLNA1BUF_MSB 25 -#define RF2G_RF2G1_BLNA1BUF_LSB 23 -#define RF2G_RF2G1_BLNA1BUF_MASK 0x03800000 -#define RF2G_RF2G1_BLNA1BUF_GET(x) (((x) & RF2G_RF2G1_BLNA1BUF_MASK) >> RF2G_RF2G1_BLNA1BUF_LSB) -#define RF2G_RF2G1_BLNA1BUF_SET(x) (((x) << RF2G_RF2G1_BLNA1BUF_LSB) & RF2G_RF2G1_BLNA1BUF_MASK) -#define RF2G_RF2G1_BLNA2_MSB 22 -#define RF2G_RF2G1_BLNA2_LSB 20 -#define RF2G_RF2G1_BLNA2_MASK 0x00700000 -#define RF2G_RF2G1_BLNA2_GET(x) (((x) & RF2G_RF2G1_BLNA2_MASK) >> RF2G_RF2G1_BLNA2_LSB) -#define RF2G_RF2G1_BLNA2_SET(x) (((x) << RF2G_RF2G1_BLNA2_LSB) & RF2G_RF2G1_BLNA2_MASK) -#define RF2G_RF2G1_DB_MSB 19 -#define RF2G_RF2G1_DB_LSB 17 -#define RF2G_RF2G1_DB_MASK 0x000e0000 -#define RF2G_RF2G1_DB_GET(x) (((x) & RF2G_RF2G1_DB_MASK) >> RF2G_RF2G1_DB_LSB) -#define RF2G_RF2G1_DB_SET(x) (((x) << RF2G_RF2G1_DB_LSB) & RF2G_RF2G1_DB_MASK) -#define RF2G_RF2G1_OB_MSB 16 -#define RF2G_RF2G1_OB_LSB 14 -#define RF2G_RF2G1_OB_MASK 0x0001c000 -#define RF2G_RF2G1_OB_GET(x) (((x) & RF2G_RF2G1_OB_MASK) >> RF2G_RF2G1_OB_LSB) -#define RF2G_RF2G1_OB_SET(x) (((x) << RF2G_RF2G1_OB_LSB) & RF2G_RF2G1_OB_MASK) -#define RF2G_RF2G1_FE_ATB_SEL_MSB 13 -#define RF2G_RF2G1_FE_ATB_SEL_LSB 11 -#define RF2G_RF2G1_FE_ATB_SEL_MASK 0x00003800 -#define RF2G_RF2G1_FE_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_FE_ATB_SEL_MASK) >> RF2G_RF2G1_FE_ATB_SEL_LSB) -#define RF2G_RF2G1_FE_ATB_SEL_SET(x) (((x) << RF2G_RF2G1_FE_ATB_SEL_LSB) & RF2G_RF2G1_FE_ATB_SEL_MASK) -#define RF2G_RF2G1_RF_ATB_SEL_MSB 10 -#define RF2G_RF2G1_RF_ATB_SEL_LSB 8 -#define RF2G_RF2G1_RF_ATB_SEL_MASK 0x00000700 -#define RF2G_RF2G1_RF_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_RF_ATB_SEL_MASK) >> RF2G_RF2G1_RF_ATB_SEL_LSB) -#define RF2G_RF2G1_RF_ATB_SEL_SET(x) (((x) << RF2G_RF2G1_RF_ATB_SEL_LSB) & RF2G_RF2G1_RF_ATB_SEL_MASK) -#define RF2G_RF2G1_SELLNA_MSB 7 -#define RF2G_RF2G1_SELLNA_LSB 7 -#define RF2G_RF2G1_SELLNA_MASK 0x00000080 -#define RF2G_RF2G1_SELLNA_GET(x) (((x) & RF2G_RF2G1_SELLNA_MASK) >> RF2G_RF2G1_SELLNA_LSB) -#define RF2G_RF2G1_SELLNA_SET(x) (((x) << RF2G_RF2G1_SELLNA_LSB) & RF2G_RF2G1_SELLNA_MASK) -#define RF2G_RF2G1_LOCONTROL_MSB 6 -#define RF2G_RF2G1_LOCONTROL_LSB 6 -#define RF2G_RF2G1_LOCONTROL_MASK 0x00000040 -#define RF2G_RF2G1_LOCONTROL_GET(x) (((x) & RF2G_RF2G1_LOCONTROL_MASK) >> RF2G_RF2G1_LOCONTROL_LSB) -#define RF2G_RF2G1_LOCONTROL_SET(x) (((x) << RF2G_RF2G1_LOCONTROL_LSB) & RF2G_RF2G1_LOCONTROL_MASK) -#define RF2G_RF2G1_SHORTLNA2_MSB 5 -#define RF2G_RF2G1_SHORTLNA2_LSB 5 -#define RF2G_RF2G1_SHORTLNA2_MASK 0x00000020 -#define RF2G_RF2G1_SHORTLNA2_GET(x) (((x) & RF2G_RF2G1_SHORTLNA2_MASK) >> RF2G_RF2G1_SHORTLNA2_LSB) -#define RF2G_RF2G1_SHORTLNA2_SET(x) (((x) << RF2G_RF2G1_SHORTLNA2_LSB) & RF2G_RF2G1_SHORTLNA2_MASK) -#define RF2G_RF2G1_SPARE_MSB 4 -#define RF2G_RF2G1_SPARE_LSB 0 -#define RF2G_RF2G1_SPARE_MASK 0x0000001f -#define RF2G_RF2G1_SPARE_GET(x) (((x) & RF2G_RF2G1_SPARE_MASK) >> RF2G_RF2G1_SPARE_LSB) -#define RF2G_RF2G1_SPARE_SET(x) (((x) << RF2G_RF2G1_SPARE_LSB) & RF2G_RF2G1_SPARE_MASK) - -#define RF2G_RF2G2_ADDRESS 0x0000002c -#define RF2G_RF2G2_OFFSET 0x0000002c -#define RF2G_RF2G2_PDCGLNA_MSB 31 -#define RF2G_RF2G2_PDCGLNA_LSB 31 -#define RF2G_RF2G2_PDCGLNA_MASK 0x80000000 -#define RF2G_RF2G2_PDCGLNA_GET(x) (((x) & RF2G_RF2G2_PDCGLNA_MASK) >> RF2G_RF2G2_PDCGLNA_LSB) -#define RF2G_RF2G2_PDCGLNA_SET(x) (((x) << RF2G_RF2G2_PDCGLNA_LSB) & RF2G_RF2G2_PDCGLNA_MASK) -#define RF2G_RF2G2_PDCGLNABUF_MSB 30 -#define RF2G_RF2G2_PDCGLNABUF_LSB 30 -#define RF2G_RF2G2_PDCGLNABUF_MASK 0x40000000 -#define RF2G_RF2G2_PDCGLNABUF_GET(x) (((x) & RF2G_RF2G2_PDCGLNABUF_MASK) >> RF2G_RF2G2_PDCGLNABUF_LSB) -#define RF2G_RF2G2_PDCGLNABUF_SET(x) (((x) << RF2G_RF2G2_PDCGLNABUF_LSB) & RF2G_RF2G2_PDCGLNABUF_MASK) -#define RF2G_RF2G2_PDCSLNA_MSB 29 -#define RF2G_RF2G2_PDCSLNA_LSB 29 -#define RF2G_RF2G2_PDCSLNA_MASK 0x20000000 -#define RF2G_RF2G2_PDCSLNA_GET(x) (((x) & RF2G_RF2G2_PDCSLNA_MASK) >> RF2G_RF2G2_PDCSLNA_LSB) -#define RF2G_RF2G2_PDCSLNA_SET(x) (((x) << RF2G_RF2G2_PDCSLNA_LSB) & RF2G_RF2G2_PDCSLNA_MASK) -#define RF2G_RF2G2_PDDIV_MSB 28 -#define RF2G_RF2G2_PDDIV_LSB 28 -#define RF2G_RF2G2_PDDIV_MASK 0x10000000 -#define RF2G_RF2G2_PDDIV_GET(x) (((x) & RF2G_RF2G2_PDDIV_MASK) >> RF2G_RF2G2_PDDIV_LSB) -#define RF2G_RF2G2_PDDIV_SET(x) (((x) << RF2G_RF2G2_PDDIV_LSB) & RF2G_RF2G2_PDDIV_MASK) -#define RF2G_RF2G2_PDPADRV_MSB 27 -#define RF2G_RF2G2_PDPADRV_LSB 27 -#define RF2G_RF2G2_PDPADRV_MASK 0x08000000 -#define RF2G_RF2G2_PDPADRV_GET(x) (((x) & RF2G_RF2G2_PDPADRV_MASK) >> RF2G_RF2G2_PDPADRV_LSB) -#define RF2G_RF2G2_PDPADRV_SET(x) (((x) << RF2G_RF2G2_PDPADRV_LSB) & RF2G_RF2G2_PDPADRV_MASK) -#define RF2G_RF2G2_PDPAOUT_MSB 26 -#define RF2G_RF2G2_PDPAOUT_LSB 26 -#define RF2G_RF2G2_PDPAOUT_MASK 0x04000000 -#define RF2G_RF2G2_PDPAOUT_GET(x) (((x) & RF2G_RF2G2_PDPAOUT_MASK) >> RF2G_RF2G2_PDPAOUT_LSB) -#define RF2G_RF2G2_PDPAOUT_SET(x) (((x) << RF2G_RF2G2_PDPAOUT_LSB) & RF2G_RF2G2_PDPAOUT_MASK) -#define RF2G_RF2G2_PDREGLNA_MSB 25 -#define RF2G_RF2G2_PDREGLNA_LSB 25 -#define RF2G_RF2G2_PDREGLNA_MASK 0x02000000 -#define RF2G_RF2G2_PDREGLNA_GET(x) (((x) & RF2G_RF2G2_PDREGLNA_MASK) >> RF2G_RF2G2_PDREGLNA_LSB) -#define RF2G_RF2G2_PDREGLNA_SET(x) (((x) << RF2G_RF2G2_PDREGLNA_LSB) & RF2G_RF2G2_PDREGLNA_MASK) -#define RF2G_RF2G2_PDREGLO_MSB 24 -#define RF2G_RF2G2_PDREGLO_LSB 24 -#define RF2G_RF2G2_PDREGLO_MASK 0x01000000 -#define RF2G_RF2G2_PDREGLO_GET(x) (((x) & RF2G_RF2G2_PDREGLO_MASK) >> RF2G_RF2G2_PDREGLO_LSB) -#define RF2G_RF2G2_PDREGLO_SET(x) (((x) << RF2G_RF2G2_PDREGLO_LSB) & RF2G_RF2G2_PDREGLO_MASK) -#define RF2G_RF2G2_PDRFGM_MSB 23 -#define RF2G_RF2G2_PDRFGM_LSB 23 -#define RF2G_RF2G2_PDRFGM_MASK 0x00800000 -#define RF2G_RF2G2_PDRFGM_GET(x) (((x) & RF2G_RF2G2_PDRFGM_MASK) >> RF2G_RF2G2_PDRFGM_LSB) -#define RF2G_RF2G2_PDRFGM_SET(x) (((x) << RF2G_RF2G2_PDRFGM_LSB) & RF2G_RF2G2_PDRFGM_MASK) -#define RF2G_RF2G2_PDRXLO_MSB 22 -#define RF2G_RF2G2_PDRXLO_LSB 22 -#define RF2G_RF2G2_PDRXLO_MASK 0x00400000 -#define RF2G_RF2G2_PDRXLO_GET(x) (((x) & RF2G_RF2G2_PDRXLO_MASK) >> RF2G_RF2G2_PDRXLO_LSB) -#define RF2G_RF2G2_PDRXLO_SET(x) (((x) << RF2G_RF2G2_PDRXLO_LSB) & RF2G_RF2G2_PDRXLO_MASK) -#define RF2G_RF2G2_PDTXLO_MSB 21 -#define RF2G_RF2G2_PDTXLO_LSB 21 -#define RF2G_RF2G2_PDTXLO_MASK 0x00200000 -#define RF2G_RF2G2_PDTXLO_GET(x) (((x) & RF2G_RF2G2_PDTXLO_MASK) >> RF2G_RF2G2_PDTXLO_LSB) -#define RF2G_RF2G2_PDTXLO_SET(x) (((x) << RF2G_RF2G2_PDTXLO_LSB) & RF2G_RF2G2_PDTXLO_MASK) -#define RF2G_RF2G2_PDTXMIX_MSB 20 -#define RF2G_RF2G2_PDTXMIX_LSB 20 -#define RF2G_RF2G2_PDTXMIX_MASK 0x00100000 -#define RF2G_RF2G2_PDTXMIX_GET(x) (((x) & RF2G_RF2G2_PDTXMIX_MASK) >> RF2G_RF2G2_PDTXMIX_LSB) -#define RF2G_RF2G2_PDTXMIX_SET(x) (((x) << RF2G_RF2G2_PDTXMIX_LSB) & RF2G_RF2G2_PDTXMIX_MASK) -#define RF2G_RF2G2_REGLNA_BYPASS_MSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_LSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_MASK 0x00080000 -#define RF2G_RF2G2_REGLNA_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLNA_BYPASS_MASK) >> RF2G_RF2G2_REGLNA_BYPASS_LSB) -#define RF2G_RF2G2_REGLNA_BYPASS_SET(x) (((x) << RF2G_RF2G2_REGLNA_BYPASS_LSB) & RF2G_RF2G2_REGLNA_BYPASS_MASK) -#define RF2G_RF2G2_REGLO_BYPASS_MSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_LSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_MASK 0x00040000 -#define RF2G_RF2G2_REGLO_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLO_BYPASS_MASK) >> RF2G_RF2G2_REGLO_BYPASS_LSB) -#define RF2G_RF2G2_REGLO_BYPASS_SET(x) (((x) << RF2G_RF2G2_REGLO_BYPASS_LSB) & RF2G_RF2G2_REGLO_BYPASS_MASK) -#define RF2G_RF2G2_ENABLE_PCB_MSB 17 -#define RF2G_RF2G2_ENABLE_PCB_LSB 17 -#define RF2G_RF2G2_ENABLE_PCB_MASK 0x00020000 -#define RF2G_RF2G2_ENABLE_PCB_GET(x) (((x) & RF2G_RF2G2_ENABLE_PCB_MASK) >> RF2G_RF2G2_ENABLE_PCB_LSB) -#define RF2G_RF2G2_ENABLE_PCB_SET(x) (((x) << RF2G_RF2G2_ENABLE_PCB_LSB) & RF2G_RF2G2_ENABLE_PCB_MASK) -#define RF2G_RF2G2_SPARE_MSB 16 -#define RF2G_RF2G2_SPARE_LSB 0 -#define RF2G_RF2G2_SPARE_MASK 0x0001ffff -#define RF2G_RF2G2_SPARE_GET(x) (((x) & RF2G_RF2G2_SPARE_MASK) >> RF2G_RF2G2_SPARE_LSB) -#define RF2G_RF2G2_SPARE_SET(x) (((x) << RF2G_RF2G2_SPARE_LSB) & RF2G_RF2G2_SPARE_MASK) - -#define TOP_GAIN_ADDRESS 0x00000030 -#define TOP_GAIN_OFFSET 0x00000030 -#define TOP_GAIN_TX6DBLOQGAIN_MSB 31 -#define TOP_GAIN_TX6DBLOQGAIN_LSB 30 -#define TOP_GAIN_TX6DBLOQGAIN_MASK 0xc0000000 -#define TOP_GAIN_TX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX6DBLOQGAIN_MASK) >> TOP_GAIN_TX6DBLOQGAIN_LSB) -#define TOP_GAIN_TX6DBLOQGAIN_SET(x) (((x) << TOP_GAIN_TX6DBLOQGAIN_LSB) & TOP_GAIN_TX6DBLOQGAIN_MASK) -#define TOP_GAIN_TX1DBLOQGAIN_MSB 29 -#define TOP_GAIN_TX1DBLOQGAIN_LSB 27 -#define TOP_GAIN_TX1DBLOQGAIN_MASK 0x38000000 -#define TOP_GAIN_TX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX1DBLOQGAIN_MASK) >> TOP_GAIN_TX1DBLOQGAIN_LSB) -#define TOP_GAIN_TX1DBLOQGAIN_SET(x) (((x) << TOP_GAIN_TX1DBLOQGAIN_LSB) & TOP_GAIN_TX1DBLOQGAIN_MASK) -#define TOP_GAIN_TXV2IGAIN_MSB 26 -#define TOP_GAIN_TXV2IGAIN_LSB 25 -#define TOP_GAIN_TXV2IGAIN_MASK 0x06000000 -#define TOP_GAIN_TXV2IGAIN_GET(x) (((x) & TOP_GAIN_TXV2IGAIN_MASK) >> TOP_GAIN_TXV2IGAIN_LSB) -#define TOP_GAIN_TXV2IGAIN_SET(x) (((x) << TOP_GAIN_TXV2IGAIN_LSB) & TOP_GAIN_TXV2IGAIN_MASK) -#define TOP_GAIN_PABUF5GN_MSB 24 -#define TOP_GAIN_PABUF5GN_LSB 24 -#define TOP_GAIN_PABUF5GN_MASK 0x01000000 -#define TOP_GAIN_PABUF5GN_GET(x) (((x) & TOP_GAIN_PABUF5GN_MASK) >> TOP_GAIN_PABUF5GN_LSB) -#define TOP_GAIN_PABUF5GN_SET(x) (((x) << TOP_GAIN_PABUF5GN_LSB) & TOP_GAIN_PABUF5GN_MASK) -#define TOP_GAIN_PADRVGN_MSB 23 -#define TOP_GAIN_PADRVGN_LSB 21 -#define TOP_GAIN_PADRVGN_MASK 0x00e00000 -#define TOP_GAIN_PADRVGN_GET(x) (((x) & TOP_GAIN_PADRVGN_MASK) >> TOP_GAIN_PADRVGN_LSB) -#define TOP_GAIN_PADRVGN_SET(x) (((x) << TOP_GAIN_PADRVGN_LSB) & TOP_GAIN_PADRVGN_MASK) -#define TOP_GAIN_PAOUT2GN_MSB 20 -#define TOP_GAIN_PAOUT2GN_LSB 18 -#define TOP_GAIN_PAOUT2GN_MASK 0x001c0000 -#define TOP_GAIN_PAOUT2GN_GET(x) (((x) & TOP_GAIN_PAOUT2GN_MASK) >> TOP_GAIN_PAOUT2GN_LSB) -#define TOP_GAIN_PAOUT2GN_SET(x) (((x) << TOP_GAIN_PAOUT2GN_LSB) & TOP_GAIN_PAOUT2GN_MASK) -#define TOP_GAIN_LNAON_MSB 17 -#define TOP_GAIN_LNAON_LSB 17 -#define TOP_GAIN_LNAON_MASK 0x00020000 -#define TOP_GAIN_LNAON_GET(x) (((x) & TOP_GAIN_LNAON_MASK) >> TOP_GAIN_LNAON_LSB) -#define TOP_GAIN_LNAON_SET(x) (((x) << TOP_GAIN_LNAON_LSB) & TOP_GAIN_LNAON_MASK) -#define TOP_GAIN_LNAGAIN_MSB 16 -#define TOP_GAIN_LNAGAIN_LSB 13 -#define TOP_GAIN_LNAGAIN_MASK 0x0001e000 -#define TOP_GAIN_LNAGAIN_GET(x) (((x) & TOP_GAIN_LNAGAIN_MASK) >> TOP_GAIN_LNAGAIN_LSB) -#define TOP_GAIN_LNAGAIN_SET(x) (((x) << TOP_GAIN_LNAGAIN_LSB) & TOP_GAIN_LNAGAIN_MASK) -#define TOP_GAIN_RFVGA5GAIN_MSB 12 -#define TOP_GAIN_RFVGA5GAIN_LSB 11 -#define TOP_GAIN_RFVGA5GAIN_MASK 0x00001800 -#define TOP_GAIN_RFVGA5GAIN_GET(x) (((x) & TOP_GAIN_RFVGA5GAIN_MASK) >> TOP_GAIN_RFVGA5GAIN_LSB) -#define TOP_GAIN_RFVGA5GAIN_SET(x) (((x) << TOP_GAIN_RFVGA5GAIN_LSB) & TOP_GAIN_RFVGA5GAIN_MASK) -#define TOP_GAIN_RFGMGN_MSB 10 -#define TOP_GAIN_RFGMGN_LSB 8 -#define TOP_GAIN_RFGMGN_MASK 0x00000700 -#define TOP_GAIN_RFGMGN_GET(x) (((x) & TOP_GAIN_RFGMGN_MASK) >> TOP_GAIN_RFGMGN_LSB) -#define TOP_GAIN_RFGMGN_SET(x) (((x) << TOP_GAIN_RFGMGN_LSB) & TOP_GAIN_RFGMGN_MASK) -#define TOP_GAIN_RX6DBLOQGAIN_MSB 7 -#define TOP_GAIN_RX6DBLOQGAIN_LSB 6 -#define TOP_GAIN_RX6DBLOQGAIN_MASK 0x000000c0 -#define TOP_GAIN_RX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBLOQGAIN_MASK) >> TOP_GAIN_RX6DBLOQGAIN_LSB) -#define TOP_GAIN_RX6DBLOQGAIN_SET(x) (((x) << TOP_GAIN_RX6DBLOQGAIN_LSB) & TOP_GAIN_RX6DBLOQGAIN_MASK) -#define TOP_GAIN_RX1DBLOQGAIN_MSB 5 -#define TOP_GAIN_RX1DBLOQGAIN_LSB 3 -#define TOP_GAIN_RX1DBLOQGAIN_MASK 0x00000038 -#define TOP_GAIN_RX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX1DBLOQGAIN_MASK) >> TOP_GAIN_RX1DBLOQGAIN_LSB) -#define TOP_GAIN_RX1DBLOQGAIN_SET(x) (((x) << TOP_GAIN_RX1DBLOQGAIN_LSB) & TOP_GAIN_RX1DBLOQGAIN_MASK) -#define TOP_GAIN_RX6DBHIQGAIN_MSB 2 -#define TOP_GAIN_RX6DBHIQGAIN_LSB 1 -#define TOP_GAIN_RX6DBHIQGAIN_MASK 0x00000006 -#define TOP_GAIN_RX6DBHIQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBHIQGAIN_MASK) >> TOP_GAIN_RX6DBHIQGAIN_LSB) -#define TOP_GAIN_RX6DBHIQGAIN_SET(x) (((x) << TOP_GAIN_RX6DBHIQGAIN_LSB) & TOP_GAIN_RX6DBHIQGAIN_MASK) -#define TOP_GAIN_SPARE_MSB 0 -#define TOP_GAIN_SPARE_LSB 0 -#define TOP_GAIN_SPARE_MASK 0x00000001 -#define TOP_GAIN_SPARE_GET(x) (((x) & TOP_GAIN_SPARE_MASK) >> TOP_GAIN_SPARE_LSB) -#define TOP_GAIN_SPARE_SET(x) (((x) << TOP_GAIN_SPARE_LSB) & TOP_GAIN_SPARE_MASK) - -#define TOP_TOP_ADDRESS 0x00000034 -#define TOP_TOP_OFFSET 0x00000034 -#define TOP_TOP_LOCALTXGAIN_MSB 31 -#define TOP_TOP_LOCALTXGAIN_LSB 31 -#define TOP_TOP_LOCALTXGAIN_MASK 0x80000000 -#define TOP_TOP_LOCALTXGAIN_GET(x) (((x) & TOP_TOP_LOCALTXGAIN_MASK) >> TOP_TOP_LOCALTXGAIN_LSB) -#define TOP_TOP_LOCALTXGAIN_SET(x) (((x) << TOP_TOP_LOCALTXGAIN_LSB) & TOP_TOP_LOCALTXGAIN_MASK) -#define TOP_TOP_LOCALRXGAIN_MSB 30 -#define TOP_TOP_LOCALRXGAIN_LSB 30 -#define TOP_TOP_LOCALRXGAIN_MASK 0x40000000 -#define TOP_TOP_LOCALRXGAIN_GET(x) (((x) & TOP_TOP_LOCALRXGAIN_MASK) >> TOP_TOP_LOCALRXGAIN_LSB) -#define TOP_TOP_LOCALRXGAIN_SET(x) (((x) << TOP_TOP_LOCALRXGAIN_LSB) & TOP_TOP_LOCALRXGAIN_MASK) -#define TOP_TOP_LOCALMODE_MSB 29 -#define TOP_TOP_LOCALMODE_LSB 29 -#define TOP_TOP_LOCALMODE_MASK 0x20000000 -#define TOP_TOP_LOCALMODE_GET(x) (((x) & TOP_TOP_LOCALMODE_MASK) >> TOP_TOP_LOCALMODE_LSB) -#define TOP_TOP_LOCALMODE_SET(x) (((x) << TOP_TOP_LOCALMODE_LSB) & TOP_TOP_LOCALMODE_MASK) -#define TOP_TOP_CALFC_MSB 28 -#define TOP_TOP_CALFC_LSB 28 -#define TOP_TOP_CALFC_MASK 0x10000000 -#define TOP_TOP_CALFC_GET(x) (((x) & TOP_TOP_CALFC_MASK) >> TOP_TOP_CALFC_LSB) -#define TOP_TOP_CALFC_SET(x) (((x) << TOP_TOP_CALFC_LSB) & TOP_TOP_CALFC_MASK) -#define TOP_TOP_CALDC_MSB 27 -#define TOP_TOP_CALDC_LSB 27 -#define TOP_TOP_CALDC_MASK 0x08000000 -#define TOP_TOP_CALDC_GET(x) (((x) & TOP_TOP_CALDC_MASK) >> TOP_TOP_CALDC_LSB) -#define TOP_TOP_CALDC_SET(x) (((x) << TOP_TOP_CALDC_LSB) & TOP_TOP_CALDC_MASK) -#define TOP_TOP_CAL_RESIDUE_MSB 26 -#define TOP_TOP_CAL_RESIDUE_LSB 26 -#define TOP_TOP_CAL_RESIDUE_MASK 0x04000000 -#define TOP_TOP_CAL_RESIDUE_GET(x) (((x) & TOP_TOP_CAL_RESIDUE_MASK) >> TOP_TOP_CAL_RESIDUE_LSB) -#define TOP_TOP_CAL_RESIDUE_SET(x) (((x) << TOP_TOP_CAL_RESIDUE_LSB) & TOP_TOP_CAL_RESIDUE_MASK) -#define TOP_TOP_BMODE_MSB 25 -#define TOP_TOP_BMODE_LSB 25 -#define TOP_TOP_BMODE_MASK 0x02000000 -#define TOP_TOP_BMODE_GET(x) (((x) & TOP_TOP_BMODE_MASK) >> TOP_TOP_BMODE_LSB) -#define TOP_TOP_BMODE_SET(x) (((x) << TOP_TOP_BMODE_LSB) & TOP_TOP_BMODE_MASK) -#define TOP_TOP_SYNTHON_MSB 24 -#define TOP_TOP_SYNTHON_LSB 24 -#define TOP_TOP_SYNTHON_MASK 0x01000000 -#define TOP_TOP_SYNTHON_GET(x) (((x) & TOP_TOP_SYNTHON_MASK) >> TOP_TOP_SYNTHON_LSB) -#define TOP_TOP_SYNTHON_SET(x) (((x) << TOP_TOP_SYNTHON_LSB) & TOP_TOP_SYNTHON_MASK) -#define TOP_TOP_RXON_MSB 23 -#define TOP_TOP_RXON_LSB 23 -#define TOP_TOP_RXON_MASK 0x00800000 -#define TOP_TOP_RXON_GET(x) (((x) & TOP_TOP_RXON_MASK) >> TOP_TOP_RXON_LSB) -#define TOP_TOP_RXON_SET(x) (((x) << TOP_TOP_RXON_LSB) & TOP_TOP_RXON_MASK) -#define TOP_TOP_TXON_MSB 22 -#define TOP_TOP_TXON_LSB 22 -#define TOP_TOP_TXON_MASK 0x00400000 -#define TOP_TOP_TXON_GET(x) (((x) & TOP_TOP_TXON_MASK) >> TOP_TOP_TXON_LSB) -#define TOP_TOP_TXON_SET(x) (((x) << TOP_TOP_TXON_LSB) & TOP_TOP_TXON_MASK) -#define TOP_TOP_PAON_MSB 21 -#define TOP_TOP_PAON_LSB 21 -#define TOP_TOP_PAON_MASK 0x00200000 -#define TOP_TOP_PAON_GET(x) (((x) & TOP_TOP_PAON_MASK) >> TOP_TOP_PAON_LSB) -#define TOP_TOP_PAON_SET(x) (((x) << TOP_TOP_PAON_LSB) & TOP_TOP_PAON_MASK) -#define TOP_TOP_CALTX_MSB 20 -#define TOP_TOP_CALTX_LSB 20 -#define TOP_TOP_CALTX_MASK 0x00100000 -#define TOP_TOP_CALTX_GET(x) (((x) & TOP_TOP_CALTX_MASK) >> TOP_TOP_CALTX_LSB) -#define TOP_TOP_CALTX_SET(x) (((x) << TOP_TOP_CALTX_LSB) & TOP_TOP_CALTX_MASK) -#define TOP_TOP_LOCALADDAC_MSB 19 -#define TOP_TOP_LOCALADDAC_LSB 19 -#define TOP_TOP_LOCALADDAC_MASK 0x00080000 -#define TOP_TOP_LOCALADDAC_GET(x) (((x) & TOP_TOP_LOCALADDAC_MASK) >> TOP_TOP_LOCALADDAC_LSB) -#define TOP_TOP_LOCALADDAC_SET(x) (((x) << TOP_TOP_LOCALADDAC_LSB) & TOP_TOP_LOCALADDAC_MASK) -#define TOP_TOP_PWDPLL_MSB 18 -#define TOP_TOP_PWDPLL_LSB 18 -#define TOP_TOP_PWDPLL_MASK 0x00040000 -#define TOP_TOP_PWDPLL_GET(x) (((x) & TOP_TOP_PWDPLL_MASK) >> TOP_TOP_PWDPLL_LSB) -#define TOP_TOP_PWDPLL_SET(x) (((x) << TOP_TOP_PWDPLL_LSB) & TOP_TOP_PWDPLL_MASK) -#define TOP_TOP_PWDADC_MSB 17 -#define TOP_TOP_PWDADC_LSB 17 -#define TOP_TOP_PWDADC_MASK 0x00020000 -#define TOP_TOP_PWDADC_GET(x) (((x) & TOP_TOP_PWDADC_MASK) >> TOP_TOP_PWDADC_LSB) -#define TOP_TOP_PWDADC_SET(x) (((x) << TOP_TOP_PWDADC_LSB) & TOP_TOP_PWDADC_MASK) -#define TOP_TOP_PWDDAC_MSB 16 -#define TOP_TOP_PWDDAC_LSB 16 -#define TOP_TOP_PWDDAC_MASK 0x00010000 -#define TOP_TOP_PWDDAC_GET(x) (((x) & TOP_TOP_PWDDAC_MASK) >> TOP_TOP_PWDDAC_LSB) -#define TOP_TOP_PWDDAC_SET(x) (((x) << TOP_TOP_PWDDAC_LSB) & TOP_TOP_PWDDAC_MASK) -#define TOP_TOP_LOCALXTAL_MSB 15 -#define TOP_TOP_LOCALXTAL_LSB 15 -#define TOP_TOP_LOCALXTAL_MASK 0x00008000 -#define TOP_TOP_LOCALXTAL_GET(x) (((x) & TOP_TOP_LOCALXTAL_MASK) >> TOP_TOP_LOCALXTAL_LSB) -#define TOP_TOP_LOCALXTAL_SET(x) (((x) << TOP_TOP_LOCALXTAL_LSB) & TOP_TOP_LOCALXTAL_MASK) -#define TOP_TOP_PWDCLKIN_MSB 14 -#define TOP_TOP_PWDCLKIN_LSB 14 -#define TOP_TOP_PWDCLKIN_MASK 0x00004000 -#define TOP_TOP_PWDCLKIN_GET(x) (((x) & TOP_TOP_PWDCLKIN_MASK) >> TOP_TOP_PWDCLKIN_LSB) -#define TOP_TOP_PWDCLKIN_SET(x) (((x) << TOP_TOP_PWDCLKIN_LSB) & TOP_TOP_PWDCLKIN_MASK) -#define TOP_TOP_OSCON_MSB 13 -#define TOP_TOP_OSCON_LSB 13 -#define TOP_TOP_OSCON_MASK 0x00002000 -#define TOP_TOP_OSCON_GET(x) (((x) & TOP_TOP_OSCON_MASK) >> TOP_TOP_OSCON_LSB) -#define TOP_TOP_OSCON_SET(x) (((x) << TOP_TOP_OSCON_LSB) & TOP_TOP_OSCON_MASK) -#define TOP_TOP_SCLKEN_FORCE_MSB 12 -#define TOP_TOP_SCLKEN_FORCE_LSB 12 -#define TOP_TOP_SCLKEN_FORCE_MASK 0x00001000 -#define TOP_TOP_SCLKEN_FORCE_GET(x) (((x) & TOP_TOP_SCLKEN_FORCE_MASK) >> TOP_TOP_SCLKEN_FORCE_LSB) -#define TOP_TOP_SCLKEN_FORCE_SET(x) (((x) << TOP_TOP_SCLKEN_FORCE_LSB) & TOP_TOP_SCLKEN_FORCE_MASK) -#define TOP_TOP_SYNTHON_FORCE_MSB 11 -#define TOP_TOP_SYNTHON_FORCE_LSB 11 -#define TOP_TOP_SYNTHON_FORCE_MASK 0x00000800 -#define TOP_TOP_SYNTHON_FORCE_GET(x) (((x) & TOP_TOP_SYNTHON_FORCE_MASK) >> TOP_TOP_SYNTHON_FORCE_LSB) -#define TOP_TOP_SYNTHON_FORCE_SET(x) (((x) << TOP_TOP_SYNTHON_FORCE_LSB) & TOP_TOP_SYNTHON_FORCE_MASK) -#define TOP_TOP_PDBIAS_MSB 10 -#define TOP_TOP_PDBIAS_LSB 10 -#define TOP_TOP_PDBIAS_MASK 0x00000400 -#define TOP_TOP_PDBIAS_GET(x) (((x) & TOP_TOP_PDBIAS_MASK) >> TOP_TOP_PDBIAS_LSB) -#define TOP_TOP_PDBIAS_SET(x) (((x) << TOP_TOP_PDBIAS_LSB) & TOP_TOP_PDBIAS_MASK) -#define TOP_TOP_DATAOUTSEL_MSB 9 -#define TOP_TOP_DATAOUTSEL_LSB 8 -#define TOP_TOP_DATAOUTSEL_MASK 0x00000300 -#define TOP_TOP_DATAOUTSEL_GET(x) (((x) & TOP_TOP_DATAOUTSEL_MASK) >> TOP_TOP_DATAOUTSEL_LSB) -#define TOP_TOP_DATAOUTSEL_SET(x) (((x) << TOP_TOP_DATAOUTSEL_LSB) & TOP_TOP_DATAOUTSEL_MASK) -#define TOP_TOP_REVID_MSB 7 -#define TOP_TOP_REVID_LSB 5 -#define TOP_TOP_REVID_MASK 0x000000e0 -#define TOP_TOP_REVID_GET(x) (((x) & TOP_TOP_REVID_MASK) >> TOP_TOP_REVID_LSB) -#define TOP_TOP_REVID_SET(x) (((x) << TOP_TOP_REVID_LSB) & TOP_TOP_REVID_MASK) -#define TOP_TOP_INT2PAD_MSB 4 -#define TOP_TOP_INT2PAD_LSB 4 -#define TOP_TOP_INT2PAD_MASK 0x00000010 -#define TOP_TOP_INT2PAD_GET(x) (((x) & TOP_TOP_INT2PAD_MASK) >> TOP_TOP_INT2PAD_LSB) -#define TOP_TOP_INT2PAD_SET(x) (((x) << TOP_TOP_INT2PAD_LSB) & TOP_TOP_INT2PAD_MASK) -#define TOP_TOP_INTH2PAD_MSB 3 -#define TOP_TOP_INTH2PAD_LSB 3 -#define TOP_TOP_INTH2PAD_MASK 0x00000008 -#define TOP_TOP_INTH2PAD_GET(x) (((x) & TOP_TOP_INTH2PAD_MASK) >> TOP_TOP_INTH2PAD_LSB) -#define TOP_TOP_INTH2PAD_SET(x) (((x) << TOP_TOP_INTH2PAD_LSB) & TOP_TOP_INTH2PAD_MASK) -#define TOP_TOP_PAD2GND_MSB 2 -#define TOP_TOP_PAD2GND_LSB 2 -#define TOP_TOP_PAD2GND_MASK 0x00000004 -#define TOP_TOP_PAD2GND_GET(x) (((x) & TOP_TOP_PAD2GND_MASK) >> TOP_TOP_PAD2GND_LSB) -#define TOP_TOP_PAD2GND_SET(x) (((x) << TOP_TOP_PAD2GND_LSB) & TOP_TOP_PAD2GND_MASK) -#define TOP_TOP_INT2GND_MSB 1 -#define TOP_TOP_INT2GND_LSB 1 -#define TOP_TOP_INT2GND_MASK 0x00000002 -#define TOP_TOP_INT2GND_GET(x) (((x) & TOP_TOP_INT2GND_MASK) >> TOP_TOP_INT2GND_LSB) -#define TOP_TOP_INT2GND_SET(x) (((x) << TOP_TOP_INT2GND_LSB) & TOP_TOP_INT2GND_MASK) -#define TOP_TOP_FORCE_XPAON_MSB 0 -#define TOP_TOP_FORCE_XPAON_LSB 0 -#define TOP_TOP_FORCE_XPAON_MASK 0x00000001 -#define TOP_TOP_FORCE_XPAON_GET(x) (((x) & TOP_TOP_FORCE_XPAON_MASK) >> TOP_TOP_FORCE_XPAON_LSB) -#define TOP_TOP_FORCE_XPAON_SET(x) (((x) << TOP_TOP_FORCE_XPAON_LSB) & TOP_TOP_FORCE_XPAON_MASK) - -#define BIAS_BIAS_SEL_ADDRESS 0x00000038 -#define BIAS_BIAS_SEL_OFFSET 0x00000038 -#define BIAS_BIAS_SEL_PADON_MSB 31 -#define BIAS_BIAS_SEL_PADON_LSB 31 -#define BIAS_BIAS_SEL_PADON_MASK 0x80000000 -#define BIAS_BIAS_SEL_PADON_GET(x) (((x) & BIAS_BIAS_SEL_PADON_MASK) >> BIAS_BIAS_SEL_PADON_LSB) -#define BIAS_BIAS_SEL_PADON_SET(x) (((x) << BIAS_BIAS_SEL_PADON_LSB) & BIAS_BIAS_SEL_PADON_MASK) -#define BIAS_BIAS_SEL_SEL_BIAS_MSB 30 -#define BIAS_BIAS_SEL_SEL_BIAS_LSB 25 -#define BIAS_BIAS_SEL_SEL_BIAS_MASK 0x7e000000 -#define BIAS_BIAS_SEL_SEL_BIAS_GET(x) (((x) & BIAS_BIAS_SEL_SEL_BIAS_MASK) >> BIAS_BIAS_SEL_SEL_BIAS_LSB) -#define BIAS_BIAS_SEL_SEL_BIAS_SET(x) (((x) << BIAS_BIAS_SEL_SEL_BIAS_LSB) & BIAS_BIAS_SEL_SEL_BIAS_MASK) -#define BIAS_BIAS_SEL_SEL_SPARE_MSB 24 -#define BIAS_BIAS_SEL_SEL_SPARE_LSB 21 -#define BIAS_BIAS_SEL_SEL_SPARE_MASK 0x01e00000 -#define BIAS_BIAS_SEL_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SEL_SPARE_SET(x) (((x) << BIAS_BIAS_SEL_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_SPARE_MSB 20 -#define BIAS_BIAS_SEL_SPARE_LSB 20 -#define BIAS_BIAS_SEL_SPARE_MASK 0x00100000 -#define BIAS_BIAS_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SPARE_SET(x) (((x) << BIAS_BIAS_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MSB 19 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB 17 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK 0x000e0000 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK 0x00010000 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_SET(x) (((x) << BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK 0x00008000 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_SET(x) (((x) << BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK 0x00004000 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_LSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MASK 0x00002000 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) >> BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MSB 12 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB 10 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK 0x00001c00 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MSB 9 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_LSB 7 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MASK 0x00000380 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) >> BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MSB 6 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_LSB 4 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MASK 0x00000070 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) >> BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MSB 3 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_LSB 1 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MASK 0x0000000e -#define BIAS_BIAS_SEL_PWD_ICTXPC25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) >> BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) -#define BIAS_BIAS_SEL_PWD_ICLDO25_MSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_LSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_MASK 0x00000001 -#define BIAS_BIAS_SEL_PWD_ICLDO25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) >> BIAS_BIAS_SEL_PWD_ICLDO25_LSB) -#define BIAS_BIAS_SEL_PWD_ICLDO25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICLDO25_LSB) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) - -#define BIAS_BIAS1_ADDRESS 0x0000003c -#define BIAS_BIAS1_OFFSET 0x0000003c -#define BIAS_BIAS1_PWD_ICDAC2BB25_MSB 31 -#define BIAS_BIAS1_PWD_ICDAC2BB25_LSB 29 -#define BIAS_BIAS1_PWD_ICDAC2BB25_MASK 0xe0000000 -#define BIAS_BIAS1_PWD_ICDAC2BB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) >> BIAS_BIAS1_PWD_ICDAC2BB25_LSB) -#define BIAS_BIAS1_PWD_ICDAC2BB25_SET(x) (((x) << BIAS_BIAS1_PWD_ICDAC2BB25_LSB) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) -#define BIAS_BIAS1_PWD_IC2GVGM25_MSB 28 -#define BIAS_BIAS1_PWD_IC2GVGM25_LSB 26 -#define BIAS_BIAS1_PWD_IC2GVGM25_MASK 0x1c000000 -#define BIAS_BIAS1_PWD_IC2GVGM25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) >> BIAS_BIAS1_PWD_IC2GVGM25_LSB) -#define BIAS_BIAS1_PWD_IC2GVGM25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GVGM25_LSB) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) -#define BIAS_BIAS1_PWD_IC2GRFFE25_MSB 25 -#define BIAS_BIAS1_PWD_IC2GRFFE25_LSB 23 -#define BIAS_BIAS1_PWD_IC2GRFFE25_MASK 0x03800000 -#define BIAS_BIAS1_PWD_IC2GRFFE25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) >> BIAS_BIAS1_PWD_IC2GRFFE25_LSB) -#define BIAS_BIAS1_PWD_IC2GRFFE25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GRFFE25_LSB) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) -#define BIAS_BIAS1_PWD_IC2GLOREG25_MSB 22 -#define BIAS_BIAS1_PWD_IC2GLOREG25_LSB 20 -#define BIAS_BIAS1_PWD_IC2GLOREG25_MASK 0x00700000 -#define BIAS_BIAS1_PWD_IC2GLOREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLOREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLOREG25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GLOREG25_LSB) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MSB 19 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_LSB 17 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MASK 0x000e0000 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORB25_MSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_LSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_MASK 0x00010000 -#define BIAS_BIAS1_PWD_ICDETECTORB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORB25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORB25_SET(x) (((x) << BIAS_BIAS1_PWD_ICDETECTORB25_LSB) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORA25_MSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_LSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_MASK 0x00008000 -#define BIAS_BIAS1_PWD_ICDETECTORA25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORA25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORA25_SET(x) (((x) << BIAS_BIAS1_PWD_ICDETECTORA25_LSB) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) -#define BIAS_BIAS1_PWD_IC5GRXRF25_MSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_LSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_MASK 0x00004000 -#define BIAS_BIAS1_PWD_IC5GRXRF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) >> BIAS_BIAS1_PWD_IC5GRXRF25_LSB) -#define BIAS_BIAS1_PWD_IC5GRXRF25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GRXRF25_LSB) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXPA25_MSB 13 -#define BIAS_BIAS1_PWD_IC5GTXPA25_LSB 11 -#define BIAS_BIAS1_PWD_IC5GTXPA25_MASK 0x00003800 -#define BIAS_BIAS1_PWD_IC5GTXPA25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) >> BIAS_BIAS1_PWD_IC5GTXPA25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXPA25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GTXPA25_LSB) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MSB 10 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_LSB 8 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MASK 0x00000700 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) >> BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) -#define BIAS_BIAS1_PWD_IC5GQB25_MSB 7 -#define BIAS_BIAS1_PWD_IC5GQB25_LSB 5 -#define BIAS_BIAS1_PWD_IC5GQB25_MASK 0x000000e0 -#define BIAS_BIAS1_PWD_IC5GQB25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GQB25_MASK) >> BIAS_BIAS1_PWD_IC5GQB25_LSB) -#define BIAS_BIAS1_PWD_IC5GQB25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GQB25_LSB) & BIAS_BIAS1_PWD_IC5GQB25_MASK) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MSB 4 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_LSB 2 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MASK 0x0000001c -#define BIAS_BIAS1_PWD_IC5GMIXQ25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) >> BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) -#define BIAS_BIAS1_SPARE_MSB 1 -#define BIAS_BIAS1_SPARE_LSB 0 -#define BIAS_BIAS1_SPARE_MASK 0x00000003 -#define BIAS_BIAS1_SPARE_GET(x) (((x) & BIAS_BIAS1_SPARE_MASK) >> BIAS_BIAS1_SPARE_LSB) -#define BIAS_BIAS1_SPARE_SET(x) (((x) << BIAS_BIAS1_SPARE_LSB) & BIAS_BIAS1_SPARE_MASK) - -#define BIAS_BIAS2_ADDRESS 0x00000040 -#define BIAS_BIAS2_OFFSET 0x00000040 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MSB 31 -#define BIAS_BIAS2_PWD_IC5GMIXI25_LSB 29 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MASK 0xe0000000 -#define BIAS_BIAS2_PWD_IC5GMIXI25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) >> BIAS_BIAS2_PWD_IC5GMIXI25_LSB) -#define BIAS_BIAS2_PWD_IC5GMIXI25_SET(x) (((x) << BIAS_BIAS2_PWD_IC5GMIXI25_LSB) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) -#define BIAS_BIAS2_PWD_IC5GDIV25_MSB 28 -#define BIAS_BIAS2_PWD_IC5GDIV25_LSB 26 -#define BIAS_BIAS2_PWD_IC5GDIV25_MASK 0x1c000000 -#define BIAS_BIAS2_PWD_IC5GDIV25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) >> BIAS_BIAS2_PWD_IC5GDIV25_LSB) -#define BIAS_BIAS2_PWD_IC5GDIV25_SET(x) (((x) << BIAS_BIAS2_PWD_IC5GDIV25_LSB) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) -#define BIAS_BIAS2_PWD_IC5GLOREG25_MSB 25 -#define BIAS_BIAS2_PWD_IC5GLOREG25_LSB 23 -#define BIAS_BIAS2_PWD_IC5GLOREG25_MASK 0x03800000 -#define BIAS_BIAS2_PWD_IC5GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) >> BIAS_BIAS2_PWD_IC5GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IC5GLOREG25_SET(x) (((x) << BIAS_BIAS2_PWD_IC5GLOREG25_LSB) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IRPLL25_MSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_LSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_MASK 0x00400000 -#define BIAS_BIAS2_PWD_IRPLL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRPLL25_MASK) >> BIAS_BIAS2_PWD_IRPLL25_LSB) -#define BIAS_BIAS2_PWD_IRPLL25_SET(x) (((x) << BIAS_BIAS2_PWD_IRPLL25_LSB) & BIAS_BIAS2_PWD_IRPLL25_MASK) -#define BIAS_BIAS2_PWD_IRXTAL25_MSB 21 -#define BIAS_BIAS2_PWD_IRXTAL25_LSB 19 -#define BIAS_BIAS2_PWD_IRXTAL25_MASK 0x00380000 -#define BIAS_BIAS2_PWD_IRXTAL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRXTAL25_MASK) >> BIAS_BIAS2_PWD_IRXTAL25_LSB) -#define BIAS_BIAS2_PWD_IRXTAL25_SET(x) (((x) << BIAS_BIAS2_PWD_IRXTAL25_LSB) & BIAS_BIAS2_PWD_IRXTAL25_MASK) -#define BIAS_BIAS2_PWD_IRTSENS25_MSB 18 -#define BIAS_BIAS2_PWD_IRTSENS25_LSB 16 -#define BIAS_BIAS2_PWD_IRTSENS25_MASK 0x00070000 -#define BIAS_BIAS2_PWD_IRTSENS25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTSENS25_MASK) >> BIAS_BIAS2_PWD_IRTSENS25_LSB) -#define BIAS_BIAS2_PWD_IRTSENS25_SET(x) (((x) << BIAS_BIAS2_PWD_IRTSENS25_LSB) & BIAS_BIAS2_PWD_IRTSENS25_MASK) -#define BIAS_BIAS2_PWD_IRTXPC25_MSB 15 -#define BIAS_BIAS2_PWD_IRTXPC25_LSB 13 -#define BIAS_BIAS2_PWD_IRTXPC25_MASK 0x0000e000 -#define BIAS_BIAS2_PWD_IRTXPC25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTXPC25_MASK) >> BIAS_BIAS2_PWD_IRTXPC25_LSB) -#define BIAS_BIAS2_PWD_IRTXPC25_SET(x) (((x) << BIAS_BIAS2_PWD_IRTXPC25_LSB) & BIAS_BIAS2_PWD_IRTXPC25_MASK) -#define BIAS_BIAS2_PWD_IRLDO25_MSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_LSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_MASK 0x00001000 -#define BIAS_BIAS2_PWD_IRLDO25_GET(x) (((x) & BIAS_BIAS2_PWD_IRLDO25_MASK) >> BIAS_BIAS2_PWD_IRLDO25_LSB) -#define BIAS_BIAS2_PWD_IRLDO25_SET(x) (((x) << BIAS_BIAS2_PWD_IRLDO25_LSB) & BIAS_BIAS2_PWD_IRLDO25_MASK) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MSB 11 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_LSB 9 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MASK 0x00000e00 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) >> BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_SET(x) (((x) << BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) -#define BIAS_BIAS2_PWD_IR2GLOREG25_MSB 8 -#define BIAS_BIAS2_PWD_IR2GLOREG25_LSB 6 -#define BIAS_BIAS2_PWD_IR2GLOREG25_MASK 0x000001c0 -#define BIAS_BIAS2_PWD_IR2GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLOREG25_SET(x) (((x) << BIAS_BIAS2_PWD_IR2GLOREG25_LSB) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MSB 5 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_LSB 3 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MASK 0x00000038 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_SET(x) (((x) << BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MSB 2 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB 0 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK 0x00000007 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_GET(x) (((x) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) >> BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_SET(x) (((x) << BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) - -#define BIAS_BIAS3_ADDRESS 0x00000044 -#define BIAS_BIAS3_OFFSET 0x00000044 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MSB 31 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_LSB 29 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MASK 0xe0000000 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) >> BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) -#define BIAS_BIAS3_PWD_IR5GTXMIX25_SET(x) (((x) << BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) -#define BIAS_BIAS3_PWD_IR5GAGC25_MSB 28 -#define BIAS_BIAS3_PWD_IR5GAGC25_LSB 26 -#define BIAS_BIAS3_PWD_IR5GAGC25_MASK 0x1c000000 -#define BIAS_BIAS3_PWD_IR5GAGC25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) >> BIAS_BIAS3_PWD_IR5GAGC25_LSB) -#define BIAS_BIAS3_PWD_IR5GAGC25_SET(x) (((x) << BIAS_BIAS3_PWD_IR5GAGC25_LSB) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) -#define BIAS_BIAS3_PWD_ICDAC50_MSB 25 -#define BIAS_BIAS3_PWD_ICDAC50_LSB 23 -#define BIAS_BIAS3_PWD_ICDAC50_MASK 0x03800000 -#define BIAS_BIAS3_PWD_ICDAC50_GET(x) (((x) & BIAS_BIAS3_PWD_ICDAC50_MASK) >> BIAS_BIAS3_PWD_ICDAC50_LSB) -#define BIAS_BIAS3_PWD_ICDAC50_SET(x) (((x) << BIAS_BIAS3_PWD_ICDAC50_LSB) & BIAS_BIAS3_PWD_ICDAC50_MASK) -#define BIAS_BIAS3_PWD_ICSYNTH50_MSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_LSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_MASK 0x00400000 -#define BIAS_BIAS3_PWD_ICSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) >> BIAS_BIAS3_PWD_ICSYNTH50_LSB) -#define BIAS_BIAS3_PWD_ICSYNTH50_SET(x) (((x) << BIAS_BIAS3_PWD_ICSYNTH50_LSB) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) -#define BIAS_BIAS3_PWD_ICBB50_MSB 21 -#define BIAS_BIAS3_PWD_ICBB50_LSB 21 -#define BIAS_BIAS3_PWD_ICBB50_MASK 0x00200000 -#define BIAS_BIAS3_PWD_ICBB50_GET(x) (((x) & BIAS_BIAS3_PWD_ICBB50_MASK) >> BIAS_BIAS3_PWD_ICBB50_LSB) -#define BIAS_BIAS3_PWD_ICBB50_SET(x) (((x) << BIAS_BIAS3_PWD_ICBB50_LSB) & BIAS_BIAS3_PWD_ICBB50_MASK) -#define BIAS_BIAS3_PWD_IC2GDIV50_MSB 20 -#define BIAS_BIAS3_PWD_IC2GDIV50_LSB 18 -#define BIAS_BIAS3_PWD_IC2GDIV50_MASK 0x001c0000 -#define BIAS_BIAS3_PWD_IC2GDIV50_GET(x) (((x) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) >> BIAS_BIAS3_PWD_IC2GDIV50_LSB) -#define BIAS_BIAS3_PWD_IC2GDIV50_SET(x) (((x) << BIAS_BIAS3_PWD_IC2GDIV50_LSB) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) -#define BIAS_BIAS3_PWD_IRSYNTH50_MSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_LSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_MASK 0x00020000 -#define BIAS_BIAS3_PWD_IRSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) >> BIAS_BIAS3_PWD_IRSYNTH50_LSB) -#define BIAS_BIAS3_PWD_IRSYNTH50_SET(x) (((x) << BIAS_BIAS3_PWD_IRSYNTH50_LSB) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) -#define BIAS_BIAS3_PWD_IRBB50_MSB 16 -#define BIAS_BIAS3_PWD_IRBB50_LSB 16 -#define BIAS_BIAS3_PWD_IRBB50_MASK 0x00010000 -#define BIAS_BIAS3_PWD_IRBB50_GET(x) (((x) & BIAS_BIAS3_PWD_IRBB50_MASK) >> BIAS_BIAS3_PWD_IRBB50_LSB) -#define BIAS_BIAS3_PWD_IRBB50_SET(x) (((x) << BIAS_BIAS3_PWD_IRBB50_LSB) & BIAS_BIAS3_PWD_IRBB50_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE1_MSB 15 -#define BIAS_BIAS3_PWD_IC25SPARE1_LSB 13 -#define BIAS_BIAS3_PWD_IC25SPARE1_MASK 0x0000e000 -#define BIAS_BIAS3_PWD_IC25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) >> BIAS_BIAS3_PWD_IC25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE1_SET(x) (((x) << BIAS_BIAS3_PWD_IC25SPARE1_LSB) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE2_MSB 12 -#define BIAS_BIAS3_PWD_IC25SPARE2_LSB 10 -#define BIAS_BIAS3_PWD_IC25SPARE2_MASK 0x00001c00 -#define BIAS_BIAS3_PWD_IC25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) >> BIAS_BIAS3_PWD_IC25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE2_SET(x) (((x) << BIAS_BIAS3_PWD_IC25SPARE2_LSB) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE1_MSB 9 -#define BIAS_BIAS3_PWD_IR25SPARE1_LSB 7 -#define BIAS_BIAS3_PWD_IR25SPARE1_MASK 0x00000380 -#define BIAS_BIAS3_PWD_IR25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) >> BIAS_BIAS3_PWD_IR25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE1_SET(x) (((x) << BIAS_BIAS3_PWD_IR25SPARE1_LSB) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE2_MSB 6 -#define BIAS_BIAS3_PWD_IR25SPARE2_LSB 4 -#define BIAS_BIAS3_PWD_IR25SPARE2_MASK 0x00000070 -#define BIAS_BIAS3_PWD_IR25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) >> BIAS_BIAS3_PWD_IR25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE2_SET(x) (((x) << BIAS_BIAS3_PWD_IR25SPARE2_LSB) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) -#define BIAS_BIAS3_PWD_ICDACREG12P5_MSB 3 -#define BIAS_BIAS3_PWD_ICDACREG12P5_LSB 1 -#define BIAS_BIAS3_PWD_ICDACREG12P5_MASK 0x0000000e -#define BIAS_BIAS3_PWD_ICDACREG12P5_GET(x) (((x) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) >> BIAS_BIAS3_PWD_ICDACREG12P5_LSB) -#define BIAS_BIAS3_PWD_ICDACREG12P5_SET(x) (((x) << BIAS_BIAS3_PWD_ICDACREG12P5_LSB) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) -#define BIAS_BIAS3_SPARE_MSB 0 -#define BIAS_BIAS3_SPARE_LSB 0 -#define BIAS_BIAS3_SPARE_MASK 0x00000001 -#define BIAS_BIAS3_SPARE_GET(x) (((x) & BIAS_BIAS3_SPARE_MASK) >> BIAS_BIAS3_SPARE_LSB) -#define BIAS_BIAS3_SPARE_SET(x) (((x) << BIAS_BIAS3_SPARE_LSB) & BIAS_BIAS3_SPARE_MASK) - -#define TXPC_TXPC_ADDRESS 0x00000048 -#define TXPC_TXPC_OFFSET 0x00000048 -#define TXPC_TXPC_SELINTPD_MSB 31 -#define TXPC_TXPC_SELINTPD_LSB 31 -#define TXPC_TXPC_SELINTPD_MASK 0x80000000 -#define TXPC_TXPC_SELINTPD_GET(x) (((x) & TXPC_TXPC_SELINTPD_MASK) >> TXPC_TXPC_SELINTPD_LSB) -#define TXPC_TXPC_SELINTPD_SET(x) (((x) << TXPC_TXPC_SELINTPD_LSB) & TXPC_TXPC_SELINTPD_MASK) -#define TXPC_TXPC_TEST_MSB 30 -#define TXPC_TXPC_TEST_LSB 30 -#define TXPC_TXPC_TEST_MASK 0x40000000 -#define TXPC_TXPC_TEST_GET(x) (((x) & TXPC_TXPC_TEST_MASK) >> TXPC_TXPC_TEST_LSB) -#define TXPC_TXPC_TEST_SET(x) (((x) << TXPC_TXPC_TEST_LSB) & TXPC_TXPC_TEST_MASK) -#define TXPC_TXPC_TESTGAIN_MSB 29 -#define TXPC_TXPC_TESTGAIN_LSB 28 -#define TXPC_TXPC_TESTGAIN_MASK 0x30000000 -#define TXPC_TXPC_TESTGAIN_GET(x) (((x) & TXPC_TXPC_TESTGAIN_MASK) >> TXPC_TXPC_TESTGAIN_LSB) -#define TXPC_TXPC_TESTGAIN_SET(x) (((x) << TXPC_TXPC_TESTGAIN_LSB) & TXPC_TXPC_TESTGAIN_MASK) -#define TXPC_TXPC_TESTDAC_MSB 27 -#define TXPC_TXPC_TESTDAC_LSB 22 -#define TXPC_TXPC_TESTDAC_MASK 0x0fc00000 -#define TXPC_TXPC_TESTDAC_GET(x) (((x) & TXPC_TXPC_TESTDAC_MASK) >> TXPC_TXPC_TESTDAC_LSB) -#define TXPC_TXPC_TESTDAC_SET(x) (((x) << TXPC_TXPC_TESTDAC_LSB) & TXPC_TXPC_TESTDAC_MASK) -#define TXPC_TXPC_TESTPWDPC_MSB 21 -#define TXPC_TXPC_TESTPWDPC_LSB 21 -#define TXPC_TXPC_TESTPWDPC_MASK 0x00200000 -#define TXPC_TXPC_TESTPWDPC_GET(x) (((x) & TXPC_TXPC_TESTPWDPC_MASK) >> TXPC_TXPC_TESTPWDPC_LSB) -#define TXPC_TXPC_TESTPWDPC_SET(x) (((x) << TXPC_TXPC_TESTPWDPC_LSB) & TXPC_TXPC_TESTPWDPC_MASK) -#define TXPC_TXPC_CURHALF_MSB 20 -#define TXPC_TXPC_CURHALF_LSB 20 -#define TXPC_TXPC_CURHALF_MASK 0x00100000 -#define TXPC_TXPC_CURHALF_GET(x) (((x) & TXPC_TXPC_CURHALF_MASK) >> TXPC_TXPC_CURHALF_LSB) -#define TXPC_TXPC_CURHALF_SET(x) (((x) << TXPC_TXPC_CURHALF_LSB) & TXPC_TXPC_CURHALF_MASK) -#define TXPC_TXPC_NEGOUT_MSB 19 -#define TXPC_TXPC_NEGOUT_LSB 19 -#define TXPC_TXPC_NEGOUT_MASK 0x00080000 -#define TXPC_TXPC_NEGOUT_GET(x) (((x) & TXPC_TXPC_NEGOUT_MASK) >> TXPC_TXPC_NEGOUT_LSB) -#define TXPC_TXPC_NEGOUT_SET(x) (((x) << TXPC_TXPC_NEGOUT_LSB) & TXPC_TXPC_NEGOUT_MASK) -#define TXPC_TXPC_CLKDELAY_MSB 18 -#define TXPC_TXPC_CLKDELAY_LSB 18 -#define TXPC_TXPC_CLKDELAY_MASK 0x00040000 -#define TXPC_TXPC_CLKDELAY_GET(x) (((x) & TXPC_TXPC_CLKDELAY_MASK) >> TXPC_TXPC_CLKDELAY_LSB) -#define TXPC_TXPC_CLKDELAY_SET(x) (((x) << TXPC_TXPC_CLKDELAY_LSB) & TXPC_TXPC_CLKDELAY_MASK) -#define TXPC_TXPC_SELMODREF_MSB 17 -#define TXPC_TXPC_SELMODREF_LSB 17 -#define TXPC_TXPC_SELMODREF_MASK 0x00020000 -#define TXPC_TXPC_SELMODREF_GET(x) (((x) & TXPC_TXPC_SELMODREF_MASK) >> TXPC_TXPC_SELMODREF_LSB) -#define TXPC_TXPC_SELMODREF_SET(x) (((x) << TXPC_TXPC_SELMODREF_LSB) & TXPC_TXPC_SELMODREF_MASK) -#define TXPC_TXPC_SELCMOUT_MSB 16 -#define TXPC_TXPC_SELCMOUT_LSB 16 -#define TXPC_TXPC_SELCMOUT_MASK 0x00010000 -#define TXPC_TXPC_SELCMOUT_GET(x) (((x) & TXPC_TXPC_SELCMOUT_MASK) >> TXPC_TXPC_SELCMOUT_LSB) -#define TXPC_TXPC_SELCMOUT_SET(x) (((x) << TXPC_TXPC_SELCMOUT_LSB) & TXPC_TXPC_SELCMOUT_MASK) -#define TXPC_TXPC_TSMODE_MSB 15 -#define TXPC_TXPC_TSMODE_LSB 14 -#define TXPC_TXPC_TSMODE_MASK 0x0000c000 -#define TXPC_TXPC_TSMODE_GET(x) (((x) & TXPC_TXPC_TSMODE_MASK) >> TXPC_TXPC_TSMODE_LSB) -#define TXPC_TXPC_TSMODE_SET(x) (((x) << TXPC_TXPC_TSMODE_LSB) & TXPC_TXPC_TSMODE_MASK) -#define TXPC_TXPC_N_MSB 13 -#define TXPC_TXPC_N_LSB 6 -#define TXPC_TXPC_N_MASK 0x00003fc0 -#define TXPC_TXPC_N_GET(x) (((x) & TXPC_TXPC_N_MASK) >> TXPC_TXPC_N_LSB) -#define TXPC_TXPC_N_SET(x) (((x) << TXPC_TXPC_N_LSB) & TXPC_TXPC_N_MASK) -#define TXPC_TXPC_ON1STSYNTHON_MSB 5 -#define TXPC_TXPC_ON1STSYNTHON_LSB 5 -#define TXPC_TXPC_ON1STSYNTHON_MASK 0x00000020 -#define TXPC_TXPC_ON1STSYNTHON_GET(x) (((x) & TXPC_TXPC_ON1STSYNTHON_MASK) >> TXPC_TXPC_ON1STSYNTHON_LSB) -#define TXPC_TXPC_ON1STSYNTHON_SET(x) (((x) << TXPC_TXPC_ON1STSYNTHON_LSB) & TXPC_TXPC_ON1STSYNTHON_MASK) -#define TXPC_TXPC_SELINIT_MSB 4 -#define TXPC_TXPC_SELINIT_LSB 3 -#define TXPC_TXPC_SELINIT_MASK 0x00000018 -#define TXPC_TXPC_SELINIT_GET(x) (((x) & TXPC_TXPC_SELINIT_MASK) >> TXPC_TXPC_SELINIT_LSB) -#define TXPC_TXPC_SELINIT_SET(x) (((x) << TXPC_TXPC_SELINIT_LSB) & TXPC_TXPC_SELINIT_MASK) -#define TXPC_TXPC_SELCOUNT_MSB 2 -#define TXPC_TXPC_SELCOUNT_LSB 2 -#define TXPC_TXPC_SELCOUNT_MASK 0x00000004 -#define TXPC_TXPC_SELCOUNT_GET(x) (((x) & TXPC_TXPC_SELCOUNT_MASK) >> TXPC_TXPC_SELCOUNT_LSB) -#define TXPC_TXPC_SELCOUNT_SET(x) (((x) << TXPC_TXPC_SELCOUNT_LSB) & TXPC_TXPC_SELCOUNT_MASK) -#define TXPC_TXPC_ATBSEL_MSB 1 -#define TXPC_TXPC_ATBSEL_LSB 0 -#define TXPC_TXPC_ATBSEL_MASK 0x00000003 -#define TXPC_TXPC_ATBSEL_GET(x) (((x) & TXPC_TXPC_ATBSEL_MASK) >> TXPC_TXPC_ATBSEL_LSB) -#define TXPC_TXPC_ATBSEL_SET(x) (((x) << TXPC_TXPC_ATBSEL_LSB) & TXPC_TXPC_ATBSEL_MASK) - -#define TXPC_MISC_ADDRESS 0x0000004c -#define TXPC_MISC_OFFSET 0x0000004c -#define TXPC_MISC_FLIPBMODE_MSB 31 -#define TXPC_MISC_FLIPBMODE_LSB 31 -#define TXPC_MISC_FLIPBMODE_MASK 0x80000000 -#define TXPC_MISC_FLIPBMODE_GET(x) (((x) & TXPC_MISC_FLIPBMODE_MASK) >> TXPC_MISC_FLIPBMODE_LSB) -#define TXPC_MISC_FLIPBMODE_SET(x) (((x) << TXPC_MISC_FLIPBMODE_LSB) & TXPC_MISC_FLIPBMODE_MASK) -#define TXPC_MISC_LEVEL_MSB 30 -#define TXPC_MISC_LEVEL_LSB 29 -#define TXPC_MISC_LEVEL_MASK 0x60000000 -#define TXPC_MISC_LEVEL_GET(x) (((x) & TXPC_MISC_LEVEL_MASK) >> TXPC_MISC_LEVEL_LSB) -#define TXPC_MISC_LEVEL_SET(x) (((x) << TXPC_MISC_LEVEL_LSB) & TXPC_MISC_LEVEL_MASK) -#define TXPC_MISC_LDO_TEST_MODE_MSB 28 -#define TXPC_MISC_LDO_TEST_MODE_LSB 28 -#define TXPC_MISC_LDO_TEST_MODE_MASK 0x10000000 -#define TXPC_MISC_LDO_TEST_MODE_GET(x) (((x) & TXPC_MISC_LDO_TEST_MODE_MASK) >> TXPC_MISC_LDO_TEST_MODE_LSB) -#define TXPC_MISC_LDO_TEST_MODE_SET(x) (((x) << TXPC_MISC_LDO_TEST_MODE_LSB) & TXPC_MISC_LDO_TEST_MODE_MASK) -#define TXPC_MISC_NOTCXODET_MSB 27 -#define TXPC_MISC_NOTCXODET_LSB 27 -#define TXPC_MISC_NOTCXODET_MASK 0x08000000 -#define TXPC_MISC_NOTCXODET_GET(x) (((x) & TXPC_MISC_NOTCXODET_MASK) >> TXPC_MISC_NOTCXODET_LSB) -#define TXPC_MISC_NOTCXODET_SET(x) (((x) << TXPC_MISC_NOTCXODET_LSB) & TXPC_MISC_NOTCXODET_MASK) -#define TXPC_MISC_PWDCLKIND_MSB 26 -#define TXPC_MISC_PWDCLKIND_LSB 26 -#define TXPC_MISC_PWDCLKIND_MASK 0x04000000 -#define TXPC_MISC_PWDCLKIND_GET(x) (((x) & TXPC_MISC_PWDCLKIND_MASK) >> TXPC_MISC_PWDCLKIND_LSB) -#define TXPC_MISC_PWDCLKIND_SET(x) (((x) << TXPC_MISC_PWDCLKIND_LSB) & TXPC_MISC_PWDCLKIND_MASK) -#define TXPC_MISC_PWDXINPAD_MSB 25 -#define TXPC_MISC_PWDXINPAD_LSB 25 -#define TXPC_MISC_PWDXINPAD_MASK 0x02000000 -#define TXPC_MISC_PWDXINPAD_GET(x) (((x) & TXPC_MISC_PWDXINPAD_MASK) >> TXPC_MISC_PWDXINPAD_LSB) -#define TXPC_MISC_PWDXINPAD_SET(x) (((x) << TXPC_MISC_PWDXINPAD_LSB) & TXPC_MISC_PWDXINPAD_MASK) -#define TXPC_MISC_LOCALBIAS_MSB 24 -#define TXPC_MISC_LOCALBIAS_LSB 24 -#define TXPC_MISC_LOCALBIAS_MASK 0x01000000 -#define TXPC_MISC_LOCALBIAS_GET(x) (((x) & TXPC_MISC_LOCALBIAS_MASK) >> TXPC_MISC_LOCALBIAS_LSB) -#define TXPC_MISC_LOCALBIAS_SET(x) (((x) << TXPC_MISC_LOCALBIAS_LSB) & TXPC_MISC_LOCALBIAS_MASK) -#define TXPC_MISC_LOCALBIAS2X_MSB 23 -#define TXPC_MISC_LOCALBIAS2X_LSB 23 -#define TXPC_MISC_LOCALBIAS2X_MASK 0x00800000 -#define TXPC_MISC_LOCALBIAS2X_GET(x) (((x) & TXPC_MISC_LOCALBIAS2X_MASK) >> TXPC_MISC_LOCALBIAS2X_LSB) -#define TXPC_MISC_LOCALBIAS2X_SET(x) (((x) << TXPC_MISC_LOCALBIAS2X_LSB) & TXPC_MISC_LOCALBIAS2X_MASK) -#define TXPC_MISC_SELTSP_MSB 22 -#define TXPC_MISC_SELTSP_LSB 22 -#define TXPC_MISC_SELTSP_MASK 0x00400000 -#define TXPC_MISC_SELTSP_GET(x) (((x) & TXPC_MISC_SELTSP_MASK) >> TXPC_MISC_SELTSP_LSB) -#define TXPC_MISC_SELTSP_SET(x) (((x) << TXPC_MISC_SELTSP_LSB) & TXPC_MISC_SELTSP_MASK) -#define TXPC_MISC_SELTSN_MSB 21 -#define TXPC_MISC_SELTSN_LSB 21 -#define TXPC_MISC_SELTSN_MASK 0x00200000 -#define TXPC_MISC_SELTSN_GET(x) (((x) & TXPC_MISC_SELTSN_MASK) >> TXPC_MISC_SELTSN_LSB) -#define TXPC_MISC_SELTSN_SET(x) (((x) << TXPC_MISC_SELTSN_LSB) & TXPC_MISC_SELTSN_MASK) -#define TXPC_MISC_SPARE_A_MSB 20 -#define TXPC_MISC_SPARE_A_LSB 18 -#define TXPC_MISC_SPARE_A_MASK 0x001c0000 -#define TXPC_MISC_SPARE_A_GET(x) (((x) & TXPC_MISC_SPARE_A_MASK) >> TXPC_MISC_SPARE_A_LSB) -#define TXPC_MISC_SPARE_A_SET(x) (((x) << TXPC_MISC_SPARE_A_LSB) & TXPC_MISC_SPARE_A_MASK) -#define TXPC_MISC_DECOUT_MSB 17 -#define TXPC_MISC_DECOUT_LSB 8 -#define TXPC_MISC_DECOUT_MASK 0x0003ff00 -#define TXPC_MISC_DECOUT_GET(x) (((x) & TXPC_MISC_DECOUT_MASK) >> TXPC_MISC_DECOUT_LSB) -#define TXPC_MISC_DECOUT_SET(x) (((x) << TXPC_MISC_DECOUT_LSB) & TXPC_MISC_DECOUT_MASK) -#define TXPC_MISC_XTALDIV_MSB 7 -#define TXPC_MISC_XTALDIV_LSB 6 -#define TXPC_MISC_XTALDIV_MASK 0x000000c0 -#define TXPC_MISC_XTALDIV_GET(x) (((x) & TXPC_MISC_XTALDIV_MASK) >> TXPC_MISC_XTALDIV_LSB) -#define TXPC_MISC_XTALDIV_SET(x) (((x) << TXPC_MISC_XTALDIV_LSB) & TXPC_MISC_XTALDIV_MASK) -#define TXPC_MISC_SPARE_MSB 5 -#define TXPC_MISC_SPARE_LSB 0 -#define TXPC_MISC_SPARE_MASK 0x0000003f -#define TXPC_MISC_SPARE_GET(x) (((x) & TXPC_MISC_SPARE_MASK) >> TXPC_MISC_SPARE_LSB) -#define TXPC_MISC_SPARE_SET(x) (((x) << TXPC_MISC_SPARE_LSB) & TXPC_MISC_SPARE_MASK) - -#define RXTXBB_RXTXBB1_ADDRESS 0x00000050 -#define RXTXBB_RXTXBB1_OFFSET 0x00000050 -#define RXTXBB_RXTXBB1_SPARE_MSB 31 -#define RXTXBB_RXTXBB1_SPARE_LSB 19 -#define RXTXBB_RXTXBB1_SPARE_MASK 0xfff80000 -#define RXTXBB_RXTXBB1_SPARE_GET(x) (((x) & RXTXBB_RXTXBB1_SPARE_MASK) >> RXTXBB_RXTXBB1_SPARE_LSB) -#define RXTXBB_RXTXBB1_SPARE_SET(x) (((x) << RXTXBB_RXTXBB1_SPARE_LSB) & RXTXBB_RXTXBB1_SPARE_MASK) -#define RXTXBB_RXTXBB1_FNOTCH_MSB 18 -#define RXTXBB_RXTXBB1_FNOTCH_LSB 17 -#define RXTXBB_RXTXBB1_FNOTCH_MASK 0x00060000 -#define RXTXBB_RXTXBB1_FNOTCH_GET(x) (((x) & RXTXBB_RXTXBB1_FNOTCH_MASK) >> RXTXBB_RXTXBB1_FNOTCH_LSB) -#define RXTXBB_RXTXBB1_FNOTCH_SET(x) (((x) << RXTXBB_RXTXBB1_FNOTCH_LSB) & RXTXBB_RXTXBB1_FNOTCH_MASK) -#define RXTXBB_RXTXBB1_SEL_ATB_MSB 16 -#define RXTXBB_RXTXBB1_SEL_ATB_LSB 9 -#define RXTXBB_RXTXBB1_SEL_ATB_MASK 0x0001fe00 -#define RXTXBB_RXTXBB1_SEL_ATB_GET(x) (((x) & RXTXBB_RXTXBB1_SEL_ATB_MASK) >> RXTXBB_RXTXBB1_SEL_ATB_LSB) -#define RXTXBB_RXTXBB1_SEL_ATB_SET(x) (((x) << RXTXBB_RXTXBB1_SEL_ATB_LSB) & RXTXBB_RXTXBB1_SEL_ATB_MASK) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_LSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MASK 0x00000100 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_GET(x) (((x) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) >> RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_SET(x) (((x) << RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) -#define RXTXBB_RXTXBB1_PDV2I_MSB 7 -#define RXTXBB_RXTXBB1_PDV2I_LSB 7 -#define RXTXBB_RXTXBB1_PDV2I_MASK 0x00000080 -#define RXTXBB_RXTXBB1_PDV2I_GET(x) (((x) & RXTXBB_RXTXBB1_PDV2I_MASK) >> RXTXBB_RXTXBB1_PDV2I_LSB) -#define RXTXBB_RXTXBB1_PDV2I_SET(x) (((x) << RXTXBB_RXTXBB1_PDV2I_LSB) & RXTXBB_RXTXBB1_PDV2I_MASK) -#define RXTXBB_RXTXBB1_PDI2V_MSB 6 -#define RXTXBB_RXTXBB1_PDI2V_LSB 6 -#define RXTXBB_RXTXBB1_PDI2V_MASK 0x00000040 -#define RXTXBB_RXTXBB1_PDI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDI2V_MASK) >> RXTXBB_RXTXBB1_PDI2V_LSB) -#define RXTXBB_RXTXBB1_PDI2V_SET(x) (((x) << RXTXBB_RXTXBB1_PDI2V_LSB) & RXTXBB_RXTXBB1_PDI2V_MASK) -#define RXTXBB_RXTXBB1_PDRXTXBB_MSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_LSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_MASK 0x00000020 -#define RXTXBB_RXTXBB1_PDRXTXBB_GET(x) (((x) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) >> RXTXBB_RXTXBB1_PDRXTXBB_LSB) -#define RXTXBB_RXTXBB1_PDRXTXBB_SET(x) (((x) << RXTXBB_RXTXBB1_PDRXTXBB_LSB) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK 0x00000010 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK 0x00000008 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_LSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MASK 0x00000004 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) >> RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_SET(x) (((x) << RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) -#define RXTXBB_RXTXBB1_PDLOQ_MSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_LSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_MASK 0x00000002 -#define RXTXBB_RXTXBB1_PDLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDLOQ_MASK) >> RXTXBB_RXTXBB1_PDLOQ_LSB) -#define RXTXBB_RXTXBB1_PDLOQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDLOQ_LSB) & RXTXBB_RXTXBB1_PDLOQ_MASK) -#define RXTXBB_RXTXBB1_PDHIQ_MSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_LSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_MASK 0x00000001 -#define RXTXBB_RXTXBB1_PDHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDHIQ_MASK) >> RXTXBB_RXTXBB1_PDHIQ_LSB) -#define RXTXBB_RXTXBB1_PDHIQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDHIQ_LSB) & RXTXBB_RXTXBB1_PDHIQ_MASK) - -#define RXTXBB_RXTXBB2_ADDRESS 0x00000054 -#define RXTXBB_RXTXBB2_OFFSET 0x00000054 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MSB 31 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB 29 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK 0xe0000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_SET(x) (((x) << RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MSB 28 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB 26 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK 0x1c000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_SET(x) (((x) << RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MSB 25 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB 23 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK 0x03800000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_SET(x) (((x) << RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) -#define RXTXBB_RXTXBB2_SPARE_MSB 22 -#define RXTXBB_RXTXBB2_SPARE_LSB 21 -#define RXTXBB_RXTXBB2_SPARE_MASK 0x00600000 -#define RXTXBB_RXTXBB2_SPARE_GET(x) (((x) & RXTXBB_RXTXBB2_SPARE_MASK) >> RXTXBB_RXTXBB2_SPARE_LSB) -#define RXTXBB_RXTXBB2_SPARE_SET(x) (((x) << RXTXBB_RXTXBB2_SPARE_LSB) & RXTXBB_RXTXBB2_SPARE_MASK) -#define RXTXBB_RXTXBB2_SHORTBUFFER_MSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_LSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_MASK 0x00100000 -#define RXTXBB_RXTXBB2_SHORTBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) >> RXTXBB_RXTXBB2_SHORTBUFFER_LSB) -#define RXTXBB_RXTXBB2_SHORTBUFFER_SET(x) (((x) << RXTXBB_RXTXBB2_SHORTBUFFER_LSB) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) -#define RXTXBB_RXTXBB2_SELBUFFER_MSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_LSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_MASK 0x00080000 -#define RXTXBB_RXTXBB2_SELBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SELBUFFER_MASK) >> RXTXBB_RXTXBB2_SELBUFFER_LSB) -#define RXTXBB_RXTXBB2_SELBUFFER_SET(x) (((x) << RXTXBB_RXTXBB2_SELBUFFER_LSB) & RXTXBB_RXTXBB2_SELBUFFER_MASK) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK 0x00040000 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK 0x00020000 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK 0x00010000 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK 0x00008000 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) -#define RXTXBB_RXTXBB2_CMSEL_MSB 14 -#define RXTXBB_RXTXBB2_CMSEL_LSB 13 -#define RXTXBB_RXTXBB2_CMSEL_MASK 0x00006000 -#define RXTXBB_RXTXBB2_CMSEL_GET(x) (((x) & RXTXBB_RXTXBB2_CMSEL_MASK) >> RXTXBB_RXTXBB2_CMSEL_LSB) -#define RXTXBB_RXTXBB2_CMSEL_SET(x) (((x) << RXTXBB_RXTXBB2_CMSEL_LSB) & RXTXBB_RXTXBB2_CMSEL_MASK) -#define RXTXBB_RXTXBB2_FILTERFC_MSB 12 -#define RXTXBB_RXTXBB2_FILTERFC_LSB 8 -#define RXTXBB_RXTXBB2_FILTERFC_MASK 0x00001f00 -#define RXTXBB_RXTXBB2_FILTERFC_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERFC_MASK) >> RXTXBB_RXTXBB2_FILTERFC_LSB) -#define RXTXBB_RXTXBB2_FILTERFC_SET(x) (((x) << RXTXBB_RXTXBB2_FILTERFC_LSB) & RXTXBB_RXTXBB2_FILTERFC_MASK) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK 0x00000080 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_GET(x) (((x) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) >> RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_SET(x) (((x) << RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK 0x00000040 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) >> RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_SET(x) (((x) << RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK 0x00000020 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK 0x00000010 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK 0x00000008 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK 0x00000004 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK 0x00000002 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK 0x00000001 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_GET(x) (((x) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) >> RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_SET(x) (((x) << RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) - -#define RXTXBB_RXTXBB3_ADDRESS 0x00000058 -#define RXTXBB_RXTXBB3_OFFSET 0x00000058 -#define RXTXBB_RXTXBB3_SPARE_MSB 31 -#define RXTXBB_RXTXBB3_SPARE_LSB 27 -#define RXTXBB_RXTXBB3_SPARE_MASK 0xf8000000 -#define RXTXBB_RXTXBB3_SPARE_GET(x) (((x) & RXTXBB_RXTXBB3_SPARE_MASK) >> RXTXBB_RXTXBB3_SPARE_LSB) -#define RXTXBB_RXTXBB3_SPARE_SET(x) (((x) << RXTXBB_RXTXBB3_SPARE_LSB) & RXTXBB_RXTXBB3_SPARE_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MSB 26 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB 24 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK 0x07000000 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MSB 23 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB 21 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK 0x00e00000 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MSB 20 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB 18 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK 0x001c0000 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MSB 17 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB 15 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK 0x00038000 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MSB 14 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB 12 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK 0x00007000 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MSB 11 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB 9 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK 0x00000e00 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MSB 8 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB 6 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK 0x000001c0 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MSB 5 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB 3 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK 0x00000038 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) >> RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MSB 2 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB 0 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK 0x00000007 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) - -#define RXTXBB_RXTXBB4_ADDRESS 0x0000005c -#define RXTXBB_RXTXBB4_OFFSET 0x0000005c -#define RXTXBB_RXTXBB4_SPARE_MSB 31 -#define RXTXBB_RXTXBB4_SPARE_LSB 31 -#define RXTXBB_RXTXBB4_SPARE_MASK 0x80000000 -#define RXTXBB_RXTXBB4_SPARE_GET(x) (((x) & RXTXBB_RXTXBB4_SPARE_MASK) >> RXTXBB_RXTXBB4_SPARE_LSB) -#define RXTXBB_RXTXBB4_SPARE_SET(x) (((x) << RXTXBB_RXTXBB4_SPARE_LSB) & RXTXBB_RXTXBB4_SPARE_MASK) -#define RXTXBB_RXTXBB4_LOCALOFFSET_MSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_LSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_MASK 0x40000000 -#define RXTXBB_RXTXBB4_LOCALOFFSET_GET(x) (((x) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) >> RXTXBB_RXTXBB4_LOCALOFFSET_LSB) -#define RXTXBB_RXTXBB4_LOCALOFFSET_SET(x) (((x) << RXTXBB_RXTXBB4_LOCALOFFSET_LSB) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHII_MSB 29 -#define RXTXBB_RXTXBB4_OFSTCORRHII_LSB 25 -#define RXTXBB_RXTXBB4_OFSTCORRHII_MASK 0x3e000000 -#define RXTXBB_RXTXBB4_OFSTCORRHII_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHII_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHII_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRHII_LSB) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MSB 24 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB 20 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK 0x01f00000 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MSB 19 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_LSB 15 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MASK 0x000f8000 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MSB 14 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB 10 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK 0x00007c00 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MSB 9 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB 5 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK 0x000003e0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MSB 4 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB 0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK 0x0000001f -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) - -#define ADDAC_ADDAC1_ADDRESS 0x00000060 -#define ADDAC_ADDAC1_OFFSET 0x00000060 -#define ADDAC_ADDAC1_PLL_SVREG_MSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_LSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_MASK 0x80000000 -#define ADDAC_ADDAC1_PLL_SVREG_GET(x) (((x) & ADDAC_ADDAC1_PLL_SVREG_MASK) >> ADDAC_ADDAC1_PLL_SVREG_LSB) -#define ADDAC_ADDAC1_PLL_SVREG_SET(x) (((x) << ADDAC_ADDAC1_PLL_SVREG_LSB) & ADDAC_ADDAC1_PLL_SVREG_MASK) -#define ADDAC_ADDAC1_PLL_SCLAMP_MSB 30 -#define ADDAC_ADDAC1_PLL_SCLAMP_LSB 28 -#define ADDAC_ADDAC1_PLL_SCLAMP_MASK 0x70000000 -#define ADDAC_ADDAC1_PLL_SCLAMP_GET(x) (((x) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) >> ADDAC_ADDAC1_PLL_SCLAMP_LSB) -#define ADDAC_ADDAC1_PLL_SCLAMP_SET(x) (((x) << ADDAC_ADDAC1_PLL_SCLAMP_LSB) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) -#define ADDAC_ADDAC1_PLL_ATB_MSB 27 -#define ADDAC_ADDAC1_PLL_ATB_LSB 26 -#define ADDAC_ADDAC1_PLL_ATB_MASK 0x0c000000 -#define ADDAC_ADDAC1_PLL_ATB_GET(x) (((x) & ADDAC_ADDAC1_PLL_ATB_MASK) >> ADDAC_ADDAC1_PLL_ATB_LSB) -#define ADDAC_ADDAC1_PLL_ATB_SET(x) (((x) << ADDAC_ADDAC1_PLL_ATB_LSB) & ADDAC_ADDAC1_PLL_ATB_MASK) -#define ADDAC_ADDAC1_PLL_ICP_MSB 25 -#define ADDAC_ADDAC1_PLL_ICP_LSB 23 -#define ADDAC_ADDAC1_PLL_ICP_MASK 0x03800000 -#define ADDAC_ADDAC1_PLL_ICP_GET(x) (((x) & ADDAC_ADDAC1_PLL_ICP_MASK) >> ADDAC_ADDAC1_PLL_ICP_LSB) -#define ADDAC_ADDAC1_PLL_ICP_SET(x) (((x) << ADDAC_ADDAC1_PLL_ICP_LSB) & ADDAC_ADDAC1_PLL_ICP_MASK) -#define ADDAC_ADDAC1_PLL_FILTER_MSB 22 -#define ADDAC_ADDAC1_PLL_FILTER_LSB 15 -#define ADDAC_ADDAC1_PLL_FILTER_MASK 0x007f8000 -#define ADDAC_ADDAC1_PLL_FILTER_GET(x) (((x) & ADDAC_ADDAC1_PLL_FILTER_MASK) >> ADDAC_ADDAC1_PLL_FILTER_LSB) -#define ADDAC_ADDAC1_PLL_FILTER_SET(x) (((x) << ADDAC_ADDAC1_PLL_FILTER_LSB) & ADDAC_ADDAC1_PLL_FILTER_MASK) -#define ADDAC_ADDAC1_PWDPLL_MSB 14 -#define ADDAC_ADDAC1_PWDPLL_LSB 14 -#define ADDAC_ADDAC1_PWDPLL_MASK 0x00004000 -#define ADDAC_ADDAC1_PWDPLL_GET(x) (((x) & ADDAC_ADDAC1_PWDPLL_MASK) >> ADDAC_ADDAC1_PWDPLL_LSB) -#define ADDAC_ADDAC1_PWDPLL_SET(x) (((x) << ADDAC_ADDAC1_PWDPLL_LSB) & ADDAC_ADDAC1_PWDPLL_MASK) -#define ADDAC_ADDAC1_PWDADC_MSB 13 -#define ADDAC_ADDAC1_PWDADC_LSB 13 -#define ADDAC_ADDAC1_PWDADC_MASK 0x00002000 -#define ADDAC_ADDAC1_PWDADC_GET(x) (((x) & ADDAC_ADDAC1_PWDADC_MASK) >> ADDAC_ADDAC1_PWDADC_LSB) -#define ADDAC_ADDAC1_PWDADC_SET(x) (((x) << ADDAC_ADDAC1_PWDADC_LSB) & ADDAC_ADDAC1_PWDADC_MASK) -#define ADDAC_ADDAC1_PWDDAC_MSB 12 -#define ADDAC_ADDAC1_PWDDAC_LSB 12 -#define ADDAC_ADDAC1_PWDDAC_MASK 0x00001000 -#define ADDAC_ADDAC1_PWDDAC_GET(x) (((x) & ADDAC_ADDAC1_PWDDAC_MASK) >> ADDAC_ADDAC1_PWDDAC_LSB) -#define ADDAC_ADDAC1_PWDDAC_SET(x) (((x) << ADDAC_ADDAC1_PWDDAC_LSB) & ADDAC_ADDAC1_PWDDAC_MASK) -#define ADDAC_ADDAC1_FORCEMSBLOW_MSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_LSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_MASK 0x00000800 -#define ADDAC_ADDAC1_FORCEMSBLOW_GET(x) (((x) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) >> ADDAC_ADDAC1_FORCEMSBLOW_LSB) -#define ADDAC_ADDAC1_FORCEMSBLOW_SET(x) (((x) << ADDAC_ADDAC1_FORCEMSBLOW_LSB) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) -#define ADDAC_ADDAC1_SELMANPWDS_MSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_LSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_MASK 0x00000400 -#define ADDAC_ADDAC1_SELMANPWDS_GET(x) (((x) & ADDAC_ADDAC1_SELMANPWDS_MASK) >> ADDAC_ADDAC1_SELMANPWDS_LSB) -#define ADDAC_ADDAC1_SELMANPWDS_SET(x) (((x) << ADDAC_ADDAC1_SELMANPWDS_LSB) & ADDAC_ADDAC1_SELMANPWDS_MASK) -#define ADDAC_ADDAC1_INV_CLK160_ADC_MSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_LSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_MASK 0x00000200 -#define ADDAC_ADDAC1_INV_CLK160_ADC_GET(x) (((x) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) >> ADDAC_ADDAC1_INV_CLK160_ADC_LSB) -#define ADDAC_ADDAC1_INV_CLK160_ADC_SET(x) (((x) << ADDAC_ADDAC1_INV_CLK160_ADC_LSB) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) -#define ADDAC_ADDAC1_CM_SEL_MSB 8 -#define ADDAC_ADDAC1_CM_SEL_LSB 7 -#define ADDAC_ADDAC1_CM_SEL_MASK 0x00000180 -#define ADDAC_ADDAC1_CM_SEL_GET(x) (((x) & ADDAC_ADDAC1_CM_SEL_MASK) >> ADDAC_ADDAC1_CM_SEL_LSB) -#define ADDAC_ADDAC1_CM_SEL_SET(x) (((x) << ADDAC_ADDAC1_CM_SEL_LSB) & ADDAC_ADDAC1_CM_SEL_MASK) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_LSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MASK 0x00000040 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_GET(x) (((x) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) >> ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_SET(x) (((x) << ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) -#define ADDAC_ADDAC1_SPARE_MSB 5 -#define ADDAC_ADDAC1_SPARE_LSB 0 -#define ADDAC_ADDAC1_SPARE_MASK 0x0000003f -#define ADDAC_ADDAC1_SPARE_GET(x) (((x) & ADDAC_ADDAC1_SPARE_MASK) >> ADDAC_ADDAC1_SPARE_LSB) -#define ADDAC_ADDAC1_SPARE_SET(x) (((x) << ADDAC_ADDAC1_SPARE_LSB) & ADDAC_ADDAC1_SPARE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct analog_reg_reg_s { - volatile unsigned int synth_synth1; - volatile unsigned int synth_synth2; - volatile unsigned int synth_synth3; - volatile unsigned int synth_synth4; - volatile unsigned int synth_synth5; - volatile unsigned int synth_synth6; - volatile unsigned int synth_synth7; - volatile unsigned int synth_synth8; - volatile unsigned int rf5g_rf5g1; - volatile unsigned int rf5g_rf5g2; - volatile unsigned int rf2g_rf2g1; - volatile unsigned int rf2g_rf2g2; - volatile unsigned int top_gain; - volatile unsigned int top_top; - volatile unsigned int bias_bias_sel; - volatile unsigned int bias_bias1; - volatile unsigned int bias_bias2; - volatile unsigned int bias_bias3; - volatile unsigned int txpc_txpc; - volatile unsigned int txpc_misc; - volatile unsigned int rxtxbb_rxtxbb1; - volatile unsigned int rxtxbb_rxtxbb2; - volatile unsigned int rxtxbb_rxtxbb3; - volatile unsigned int rxtxbb_rxtxbb4; - volatile unsigned int addac_addac1; -} analog_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _ANALOG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_reg.vrh deleted file mode 100644 index 9fd2269c3b6a..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/analog_reg.vrh +++ /dev/null @@ -1,3084 +0,0 @@ -#ifndef _ANALOG_REG_VRH_ -#define _ANALOG_REG_VRH_ - -#define SYNTH_SYNTH1_ADDRESS 'h00000000 -#define SYNTH_SYNTH1_PWD_BIAS_MSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_LSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_MASK 'h80000000 -#define SYNTH_SYNTH1_PWD_BIAS_GET(x) (((x) & SYNTH_SYNTH1_PWD_BIAS_MASK) >> SYNTH_SYNTH1_PWD_BIAS_LSB) -#define SYNTH_SYNTH1_PWD_BIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_BIAS_LSB) & SYNTH_SYNTH1_PWD_BIAS_MASK) -#define SYNTH_SYNTH1_PWD_BIAS_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_CP_MSB 30 -#define SYNTH_SYNTH1_PWD_CP_LSB 30 -#define SYNTH_SYNTH1_PWD_CP_MASK 'h40000000 -#define SYNTH_SYNTH1_PWD_CP_GET(x) (((x) & SYNTH_SYNTH1_PWD_CP_MASK) >> SYNTH_SYNTH1_PWD_CP_LSB) -#define SYNTH_SYNTH1_PWD_CP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_CP_LSB) & SYNTH_SYNTH1_PWD_CP_MASK) -#define SYNTH_SYNTH1_PWD_CP_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_VCMON_MSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_LSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_MASK 'h20000000 -#define SYNTH_SYNTH1_PWD_VCMON_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCMON_MASK) >> SYNTH_SYNTH1_PWD_VCMON_LSB) -#define SYNTH_SYNTH1_PWD_VCMON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_VCMON_LSB) & SYNTH_SYNTH1_PWD_VCMON_MASK) -#define SYNTH_SYNTH1_PWD_VCMON_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_VCO_MSB 28 -#define SYNTH_SYNTH1_PWD_VCO_LSB 28 -#define SYNTH_SYNTH1_PWD_VCO_MASK 'h10000000 -#define SYNTH_SYNTH1_PWD_VCO_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCO_MASK) >> SYNTH_SYNTH1_PWD_VCO_LSB) -#define SYNTH_SYNTH1_PWD_VCO_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_VCO_LSB) & SYNTH_SYNTH1_PWD_VCO_MASK) -#define SYNTH_SYNTH1_PWD_VCO_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_PRESC_MSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_LSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_MASK 'h08000000 -#define SYNTH_SYNTH1_PWD_PRESC_GET(x) (((x) & SYNTH_SYNTH1_PWD_PRESC_MASK) >> SYNTH_SYNTH1_PWD_PRESC_LSB) -#define SYNTH_SYNTH1_PWD_PRESC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_PRESC_LSB) & SYNTH_SYNTH1_PWD_PRESC_MASK) -#define SYNTH_SYNTH1_PWD_PRESC_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_LODIV_MSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_LSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_MASK 'h04000000 -#define SYNTH_SYNTH1_PWD_LODIV_GET(x) (((x) & SYNTH_SYNTH1_PWD_LODIV_MASK) >> SYNTH_SYNTH1_PWD_LODIV_LSB) -#define SYNTH_SYNTH1_PWD_LODIV_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_LODIV_LSB) & SYNTH_SYNTH1_PWD_LODIV_MASK) -#define SYNTH_SYNTH1_PWD_LODIV_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_LOMIX_MSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_LSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_MASK 'h02000000 -#define SYNTH_SYNTH1_PWD_LOMIX_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOMIX_MASK) >> SYNTH_SYNTH1_PWD_LOMIX_LSB) -#define SYNTH_SYNTH1_PWD_LOMIX_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_LOMIX_LSB) & SYNTH_SYNTH1_PWD_LOMIX_MASK) -#define SYNTH_SYNTH1_PWD_LOMIX_RESET 1'h0 -#define SYNTH_SYNTH1_FORCE_LO_ON_MSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_LSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_MASK 'h01000000 -#define SYNTH_SYNTH1_FORCE_LO_ON_GET(x) (((x) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) >> SYNTH_SYNTH1_FORCE_LO_ON_LSB) -#define SYNTH_SYNTH1_FORCE_LO_ON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_FORCE_LO_ON_LSB) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) -#define SYNTH_SYNTH1_FORCE_LO_ON_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_LOBUF5G_MSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_LSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_MASK 'h00800000 -#define SYNTH_SYNTH1_PWD_LOBUF5G_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) >> SYNTH_SYNTH1_PWD_LOBUF5G_LSB) -#define SYNTH_SYNTH1_PWD_LOBUF5G_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_LOBUF5G_LSB) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) -#define SYNTH_SYNTH1_PWD_LOBUF5G_RESET 1'h0 -#define SYNTH_SYNTH1_VCOREGBYPASS_MSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_LSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_MASK 'h00400000 -#define SYNTH_SYNTH1_VCOREGBYPASS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) >> SYNTH_SYNTH1_VCOREGBYPASS_LSB) -#define SYNTH_SYNTH1_VCOREGBYPASS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_VCOREGBYPASS_LSB) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) -#define SYNTH_SYNTH1_VCOREGBYPASS_RESET 1'h1 -#define SYNTH_SYNTH1_VCOREGLEVEL_MSB 21 -#define SYNTH_SYNTH1_VCOREGLEVEL_LSB 20 -#define SYNTH_SYNTH1_VCOREGLEVEL_MASK 'h00300000 -#define SYNTH_SYNTH1_VCOREGLEVEL_GET(x) (((x) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) >> SYNTH_SYNTH1_VCOREGLEVEL_LSB) -#define SYNTH_SYNTH1_VCOREGLEVEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_VCOREGLEVEL_LSB) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) -#define SYNTH_SYNTH1_VCOREGLEVEL_RESET 2'h1 -#define SYNTH_SYNTH1_VCOREGBIAS_MSB 19 -#define SYNTH_SYNTH1_VCOREGBIAS_LSB 18 -#define SYNTH_SYNTH1_VCOREGBIAS_MASK 'h000c0000 -#define SYNTH_SYNTH1_VCOREGBIAS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBIAS_MASK) >> SYNTH_SYNTH1_VCOREGBIAS_LSB) -#define SYNTH_SYNTH1_VCOREGBIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_VCOREGBIAS_LSB) & SYNTH_SYNTH1_VCOREGBIAS_MASK) -#define SYNTH_SYNTH1_VCOREGBIAS_RESET 2'h1 -#define SYNTH_SYNTH1_SLIDINGIF_MSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_LSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_MASK 'h00020000 -#define SYNTH_SYNTH1_SLIDINGIF_GET(x) (((x) & SYNTH_SYNTH1_SLIDINGIF_MASK) >> SYNTH_SYNTH1_SLIDINGIF_LSB) -#define SYNTH_SYNTH1_SLIDINGIF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_SLIDINGIF_LSB) & SYNTH_SYNTH1_SLIDINGIF_MASK) -#define SYNTH_SYNTH1_SLIDINGIF_RESET 1'h0 -#define SYNTH_SYNTH1_SPARE_PWD_MSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_LSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_MASK 'h00010000 -#define SYNTH_SYNTH1_SPARE_PWD_GET(x) (((x) & SYNTH_SYNTH1_SPARE_PWD_MASK) >> SYNTH_SYNTH1_SPARE_PWD_LSB) -#define SYNTH_SYNTH1_SPARE_PWD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_SPARE_PWD_LSB) & SYNTH_SYNTH1_SPARE_PWD_MASK) -#define SYNTH_SYNTH1_SPARE_PWD_RESET 1'h0 -#define SYNTH_SYNTH1_CON_VDDVCOREG_MSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_LSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_MASK 'h00008000 -#define SYNTH_SYNTH1_CON_VDDVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) >> SYNTH_SYNTH1_CON_VDDVCOREG_LSB) -#define SYNTH_SYNTH1_CON_VDDVCOREG_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_CON_VDDVCOREG_LSB) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) -#define SYNTH_SYNTH1_CON_VDDVCOREG_RESET 1'h0 -#define SYNTH_SYNTH1_CON_IVCOREG_MSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_LSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_MASK 'h00004000 -#define SYNTH_SYNTH1_CON_IVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOREG_MASK) >> SYNTH_SYNTH1_CON_IVCOREG_LSB) -#define SYNTH_SYNTH1_CON_IVCOREG_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_CON_IVCOREG_LSB) & SYNTH_SYNTH1_CON_IVCOREG_MASK) -#define SYNTH_SYNTH1_CON_IVCOREG_RESET 1'h0 -#define SYNTH_SYNTH1_CON_IVCOBUF_MSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_LSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_MASK 'h00002000 -#define SYNTH_SYNTH1_CON_IVCOBUF_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) >> SYNTH_SYNTH1_CON_IVCOBUF_LSB) -#define SYNTH_SYNTH1_CON_IVCOBUF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_CON_IVCOBUF_LSB) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) -#define SYNTH_SYNTH1_CON_IVCOBUF_RESET 1'h0 -#define SYNTH_SYNTH1_SEL_VCMONABUS_MSB 12 -#define SYNTH_SYNTH1_SEL_VCMONABUS_LSB 10 -#define SYNTH_SYNTH1_SEL_VCMONABUS_MASK 'h00001c00 -#define SYNTH_SYNTH1_SEL_VCMONABUS_GET(x) (((x) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) >> SYNTH_SYNTH1_SEL_VCMONABUS_LSB) -#define SYNTH_SYNTH1_SEL_VCMONABUS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_SEL_VCMONABUS_LSB) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) -#define SYNTH_SYNTH1_SEL_VCMONABUS_RESET 3'h0 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK 'h00000200 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) >> SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_RESET 1'h0 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_LSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MASK 'h00000100 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) >> SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_RESET 1'h0 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK 'h00000080 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_RESET 1'h0 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK 'h00000040 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_FB_MSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_LSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_MASK 'h00000020 -#define SYNTH_SYNTH1_MONITOR_FB_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_MASK) >> SYNTH_SYNTH1_MONITOR_FB_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_FB_LSB) & SYNTH_SYNTH1_MONITOR_FB_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_REF_MSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_LSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_MASK 'h00000010 -#define SYNTH_SYNTH1_MONITOR_REF_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_REF_MASK) >> SYNTH_SYNTH1_MONITOR_REF_LSB) -#define SYNTH_SYNTH1_MONITOR_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_REF_LSB) & SYNTH_SYNTH1_MONITOR_REF_MASK) -#define SYNTH_SYNTH1_MONITOR_REF_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK 'h00000008 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) >> SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK 'h00000004 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) >> SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_LSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MASK 'h00000002 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) >> SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK 'h00000001 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) >> SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_RESET 1'h0 -#define SYNTH_SYNTH1_RESET (32'h0 | \ - SYNTH_SYNTH1_PWD_BIAS_SET(SYNTH_SYNTH1_PWD_BIAS_RESET) | \ - SYNTH_SYNTH1_PWD_CP_SET(SYNTH_SYNTH1_PWD_CP_RESET) | \ - SYNTH_SYNTH1_PWD_VCMON_SET(SYNTH_SYNTH1_PWD_VCMON_RESET) | \ - SYNTH_SYNTH1_PWD_VCO_SET(SYNTH_SYNTH1_PWD_VCO_RESET) | \ - SYNTH_SYNTH1_PWD_PRESC_SET(SYNTH_SYNTH1_PWD_PRESC_RESET) | \ - SYNTH_SYNTH1_PWD_LODIV_SET(SYNTH_SYNTH1_PWD_LODIV_RESET) | \ - SYNTH_SYNTH1_PWD_LOMIX_SET(SYNTH_SYNTH1_PWD_LOMIX_RESET) | \ - SYNTH_SYNTH1_FORCE_LO_ON_SET(SYNTH_SYNTH1_FORCE_LO_ON_RESET) | \ - SYNTH_SYNTH1_PWD_LOBUF5G_SET(SYNTH_SYNTH1_PWD_LOBUF5G_RESET) | \ - SYNTH_SYNTH1_VCOREGBYPASS_SET(SYNTH_SYNTH1_VCOREGBYPASS_RESET) | \ - SYNTH_SYNTH1_VCOREGLEVEL_SET(SYNTH_SYNTH1_VCOREGLEVEL_RESET) | \ - SYNTH_SYNTH1_VCOREGBIAS_SET(SYNTH_SYNTH1_VCOREGBIAS_RESET) | \ - SYNTH_SYNTH1_SLIDINGIF_SET(SYNTH_SYNTH1_SLIDINGIF_RESET) | \ - SYNTH_SYNTH1_SPARE_PWD_SET(SYNTH_SYNTH1_SPARE_PWD_RESET) | \ - SYNTH_SYNTH1_CON_VDDVCOREG_SET(SYNTH_SYNTH1_CON_VDDVCOREG_RESET) | \ - SYNTH_SYNTH1_CON_IVCOREG_SET(SYNTH_SYNTH1_CON_IVCOREG_RESET) | \ - SYNTH_SYNTH1_CON_IVCOBUF_SET(SYNTH_SYNTH1_CON_IVCOBUF_RESET) | \ - SYNTH_SYNTH1_SEL_VCMONABUS_SET(SYNTH_SYNTH1_SEL_VCMONABUS_RESET) | \ - SYNTH_SYNTH1_PWUP_VCOBUF_PD_SET(SYNTH_SYNTH1_PWUP_VCOBUF_PD_RESET) | \ - SYNTH_SYNTH1_PWUP_LODIV_PD_SET(SYNTH_SYNTH1_PWUP_LODIV_PD_RESET) | \ - SYNTH_SYNTH1_PWUP_LOMIX_PD_SET(SYNTH_SYNTH1_PWUP_LOMIX_PD_RESET) | \ - SYNTH_SYNTH1_PWUP_LOBUF5G_PD_SET(SYNTH_SYNTH1_PWUP_LOBUF5G_PD_RESET) | \ - SYNTH_SYNTH1_MONITOR_FB_SET(SYNTH_SYNTH1_MONITOR_FB_RESET) | \ - SYNTH_SYNTH1_MONITOR_REF_SET(SYNTH_SYNTH1_MONITOR_REF_RESET) | \ - SYNTH_SYNTH1_MONITOR_FB_DIV2_SET(SYNTH_SYNTH1_MONITOR_FB_DIV2_RESET) | \ - SYNTH_SYNTH1_MONITOR_VC2HIGH_SET(SYNTH_SYNTH1_MONITOR_VC2HIGH_RESET) | \ - SYNTH_SYNTH1_MONITOR_VC2LOW_SET(SYNTH_SYNTH1_MONITOR_VC2LOW_RESET) | \ - SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_RESET)) -#define SYNTH_SYNTH1_HW_MASK (32'h0) -#define SYNTH_SYNTH1_SW_MASK (32'h0 | \ - SYNTH_SYNTH1_PWD_BIAS_MASK | \ - SYNTH_SYNTH1_PWD_CP_MASK | \ - SYNTH_SYNTH1_PWD_VCMON_MASK | \ - SYNTH_SYNTH1_PWD_VCO_MASK | \ - SYNTH_SYNTH1_PWD_PRESC_MASK | \ - SYNTH_SYNTH1_PWD_LODIV_MASK | \ - SYNTH_SYNTH1_PWD_LOMIX_MASK | \ - SYNTH_SYNTH1_FORCE_LO_ON_MASK | \ - SYNTH_SYNTH1_PWD_LOBUF5G_MASK | \ - SYNTH_SYNTH1_VCOREGBYPASS_MASK | \ - SYNTH_SYNTH1_VCOREGLEVEL_MASK | \ - SYNTH_SYNTH1_VCOREGBIAS_MASK | \ - SYNTH_SYNTH1_SLIDINGIF_MASK | \ - SYNTH_SYNTH1_SPARE_PWD_MASK | \ - SYNTH_SYNTH1_CON_VDDVCOREG_MASK | \ - SYNTH_SYNTH1_CON_IVCOREG_MASK | \ - SYNTH_SYNTH1_CON_IVCOBUF_MASK | \ - SYNTH_SYNTH1_SEL_VCMONABUS_MASK | \ - SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK | \ - SYNTH_SYNTH1_PWUP_LODIV_PD_MASK | \ - SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK | \ - SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK | \ - SYNTH_SYNTH1_MONITOR_FB_MASK | \ - SYNTH_SYNTH1_MONITOR_REF_MASK | \ - SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK | \ - SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK | \ - SYNTH_SYNTH1_MONITOR_VC2LOW_MASK | \ - SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) - -#define SYNTH_SYNTH2_ADDRESS 'h00000004 -#define SYNTH_SYNTH2_VC_CAL_REF_MSB 31 -#define SYNTH_SYNTH2_VC_CAL_REF_LSB 29 -#define SYNTH_SYNTH2_VC_CAL_REF_MASK 'he0000000 -#define SYNTH_SYNTH2_VC_CAL_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_CAL_REF_MASK) >> SYNTH_SYNTH2_VC_CAL_REF_LSB) -#define SYNTH_SYNTH2_VC_CAL_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_CAL_REF_LSB) & SYNTH_SYNTH2_VC_CAL_REF_MASK) -#define SYNTH_SYNTH2_VC_CAL_REF_RESET 3'h0 -#define SYNTH_SYNTH2_VC_HI_REF_MSB 28 -#define SYNTH_SYNTH2_VC_HI_REF_LSB 26 -#define SYNTH_SYNTH2_VC_HI_REF_MASK 'h1c000000 -#define SYNTH_SYNTH2_VC_HI_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_HI_REF_MASK) >> SYNTH_SYNTH2_VC_HI_REF_LSB) -#define SYNTH_SYNTH2_VC_HI_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_HI_REF_LSB) & SYNTH_SYNTH2_VC_HI_REF_MASK) -#define SYNTH_SYNTH2_VC_HI_REF_RESET 3'h3 -#define SYNTH_SYNTH2_VC_MID_REF_MSB 25 -#define SYNTH_SYNTH2_VC_MID_REF_LSB 23 -#define SYNTH_SYNTH2_VC_MID_REF_MASK 'h03800000 -#define SYNTH_SYNTH2_VC_MID_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_MID_REF_MASK) >> SYNTH_SYNTH2_VC_MID_REF_LSB) -#define SYNTH_SYNTH2_VC_MID_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_MID_REF_LSB) & SYNTH_SYNTH2_VC_MID_REF_MASK) -#define SYNTH_SYNTH2_VC_MID_REF_RESET 3'h4 -#define SYNTH_SYNTH2_VC_LOW_REF_MSB 22 -#define SYNTH_SYNTH2_VC_LOW_REF_LSB 20 -#define SYNTH_SYNTH2_VC_LOW_REF_MASK 'h00700000 -#define SYNTH_SYNTH2_VC_LOW_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_LOW_REF_MASK) >> SYNTH_SYNTH2_VC_LOW_REF_LSB) -#define SYNTH_SYNTH2_VC_LOW_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_LOW_REF_LSB) & SYNTH_SYNTH2_VC_LOW_REF_MASK) -#define SYNTH_SYNTH2_VC_LOW_REF_RESET 3'h4 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MSB 19 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB 15 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK 'h000f8000 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_GET(x) (((x) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) >> SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_RESET 5'h8 -#define SYNTH_SYNTH2_LOOP_CP_MSB 14 -#define SYNTH_SYNTH2_LOOP_CP_LSB 10 -#define SYNTH_SYNTH2_LOOP_CP_MASK 'h00007c00 -#define SYNTH_SYNTH2_LOOP_CP_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CP_MASK) >> SYNTH_SYNTH2_LOOP_CP_LSB) -#define SYNTH_SYNTH2_LOOP_CP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_CP_LSB) & SYNTH_SYNTH2_LOOP_CP_MASK) -#define SYNTH_SYNTH2_LOOP_CP_RESET 5'h8 -#define SYNTH_SYNTH2_LOOP_RS_MSB 9 -#define SYNTH_SYNTH2_LOOP_RS_LSB 5 -#define SYNTH_SYNTH2_LOOP_RS_MASK 'h000003e0 -#define SYNTH_SYNTH2_LOOP_RS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_RS_MASK) >> SYNTH_SYNTH2_LOOP_RS_LSB) -#define SYNTH_SYNTH2_LOOP_RS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_RS_LSB) & SYNTH_SYNTH2_LOOP_RS_MASK) -#define SYNTH_SYNTH2_LOOP_RS_RESET 5'h5 -#define SYNTH_SYNTH2_LOOP_CS_MSB 4 -#define SYNTH_SYNTH2_LOOP_CS_LSB 3 -#define SYNTH_SYNTH2_LOOP_CS_MASK 'h00000018 -#define SYNTH_SYNTH2_LOOP_CS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CS_MASK) >> SYNTH_SYNTH2_LOOP_CS_LSB) -#define SYNTH_SYNTH2_LOOP_CS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_CS_LSB) & SYNTH_SYNTH2_LOOP_CS_MASK) -#define SYNTH_SYNTH2_LOOP_CS_RESET 2'h3 -#define SYNTH_SYNTH2_SPARE_BITS_MSB 2 -#define SYNTH_SYNTH2_SPARE_BITS_LSB 0 -#define SYNTH_SYNTH2_SPARE_BITS_MASK 'h00000007 -#define SYNTH_SYNTH2_SPARE_BITS_GET(x) (((x) & SYNTH_SYNTH2_SPARE_BITS_MASK) >> SYNTH_SYNTH2_SPARE_BITS_LSB) -#define SYNTH_SYNTH2_SPARE_BITS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_SPARE_BITS_LSB) & SYNTH_SYNTH2_SPARE_BITS_MASK) -#define SYNTH_SYNTH2_SPARE_BITS_RESET 3'h0 -#define SYNTH_SYNTH2_RESET (32'h0 | \ - SYNTH_SYNTH2_VC_CAL_REF_SET(SYNTH_SYNTH2_VC_CAL_REF_RESET) | \ - SYNTH_SYNTH2_VC_HI_REF_SET(SYNTH_SYNTH2_VC_HI_REF_RESET) | \ - SYNTH_SYNTH2_VC_MID_REF_SET(SYNTH_SYNTH2_VC_MID_REF_RESET) | \ - SYNTH_SYNTH2_VC_LOW_REF_SET(SYNTH_SYNTH2_VC_LOW_REF_RESET) | \ - SYNTH_SYNTH2_LOOP_3RD_ORDER_R_SET(SYNTH_SYNTH2_LOOP_3RD_ORDER_R_RESET) | \ - SYNTH_SYNTH2_LOOP_CP_SET(SYNTH_SYNTH2_LOOP_CP_RESET) | \ - SYNTH_SYNTH2_LOOP_RS_SET(SYNTH_SYNTH2_LOOP_RS_RESET) | \ - SYNTH_SYNTH2_LOOP_CS_SET(SYNTH_SYNTH2_LOOP_CS_RESET) | \ - SYNTH_SYNTH2_SPARE_BITS_SET(SYNTH_SYNTH2_SPARE_BITS_RESET)) -#define SYNTH_SYNTH2_HW_MASK (32'h0) -#define SYNTH_SYNTH2_SW_MASK (32'h0 | \ - SYNTH_SYNTH2_VC_CAL_REF_MASK | \ - SYNTH_SYNTH2_VC_HI_REF_MASK | \ - SYNTH_SYNTH2_VC_MID_REF_MASK | \ - SYNTH_SYNTH2_VC_LOW_REF_MASK | \ - SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK | \ - SYNTH_SYNTH2_LOOP_CP_MASK | \ - SYNTH_SYNTH2_LOOP_RS_MASK | \ - SYNTH_SYNTH2_LOOP_CS_MASK | \ - SYNTH_SYNTH2_SPARE_BITS_MASK) - -#define SYNTH_SYNTH3_ADDRESS 'h00000008 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_LSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MASK 'h80000000 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_GET(x) (((x) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) >> SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) -#define SYNTH_SYNTH3_DIS_CLK_XTAL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) -#define SYNTH_SYNTH3_DIS_CLK_XTAL_RESET 1'h0 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_LSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MASK 'h40000000 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_GET(x) (((x) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) >> SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_RESET 1'h1 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MSB 29 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB 24 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK 'h3f000000 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_RESET 6'h14 -#define SYNTH_SYNTH3_WAIT_PWRUP_MSB 23 -#define SYNTH_SYNTH3_WAIT_PWRUP_LSB 18 -#define SYNTH_SYNTH3_WAIT_PWRUP_MASK 'h00fc0000 -#define SYNTH_SYNTH3_WAIT_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_PWRUP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_PWRUP_RESET 6'h8 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MSB 17 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_LSB 12 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MASK 'h0003f000 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_RESET 6'h14 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MSB 11 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_LSB 6 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MASK 'h00000fc0 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_RESET 6'h14 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MSB 5 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_LSB 0 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MASK 'h0000003f -#define SYNTH_SYNTH3_WAIT_VC_CHECK_GET(x) (((x) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) >> SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_RESET 6'h14 -#define SYNTH_SYNTH3_RESET (32'h0 | \ - SYNTH_SYNTH3_DIS_CLK_XTAL_SET(SYNTH_SYNTH3_DIS_CLK_XTAL_RESET) | \ - SYNTH_SYNTH3_SEL_CLK_DIV2_SET(SYNTH_SYNTH3_SEL_CLK_DIV2_RESET) | \ - SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_SET(SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_RESET) | \ - SYNTH_SYNTH3_WAIT_PWRUP_SET(SYNTH_SYNTH3_WAIT_PWRUP_RESET) | \ - SYNTH_SYNTH3_WAIT_CAL_BIN_SET(SYNTH_SYNTH3_WAIT_CAL_BIN_RESET) | \ - SYNTH_SYNTH3_WAIT_CAL_LIN_SET(SYNTH_SYNTH3_WAIT_CAL_LIN_RESET) | \ - SYNTH_SYNTH3_WAIT_VC_CHECK_SET(SYNTH_SYNTH3_WAIT_VC_CHECK_RESET)) -#define SYNTH_SYNTH3_HW_MASK (32'h0) -#define SYNTH_SYNTH3_SW_MASK (32'h0 | \ - SYNTH_SYNTH3_DIS_CLK_XTAL_MASK | \ - SYNTH_SYNTH3_SEL_CLK_DIV2_MASK | \ - SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK | \ - SYNTH_SYNTH3_WAIT_PWRUP_MASK | \ - SYNTH_SYNTH3_WAIT_CAL_BIN_MASK | \ - SYNTH_SYNTH3_WAIT_CAL_LIN_MASK | \ - SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) - -#define SYNTH_SYNTH4_ADDRESS 'h0000000c -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK 'h80000000 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_GET(x) (((x) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) >> SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_RESET 1'h0 -#define SYNTH_SYNTH4_DIS_LOSTVC_MSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_LSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_MASK 'h40000000 -#define SYNTH_SYNTH4_DIS_LOSTVC_GET(x) (((x) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) >> SYNTH_SYNTH4_DIS_LOSTVC_LSB) -#define SYNTH_SYNTH4_DIS_LOSTVC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_DIS_LOSTVC_LSB) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) -#define SYNTH_SYNTH4_DIS_LOSTVC_RESET 1'h0 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_LSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MASK 'h20000000 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_GET(x) (((x) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) >> SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_RESET 1'h0 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK 'h10000000 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_GET(x) (((x) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) >> SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_RESET 1'h1 -#define SYNTH_SYNTH4_FORCE_PINVC_MSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_LSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_MASK 'h08000000 -#define SYNTH_SYNTH4_FORCE_PINVC_GET(x) (((x) & SYNTH_SYNTH4_FORCE_PINVC_MASK) >> SYNTH_SYNTH4_FORCE_PINVC_LSB) -#define SYNTH_SYNTH4_FORCE_PINVC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_FORCE_PINVC_LSB) & SYNTH_SYNTH4_FORCE_PINVC_MASK) -#define SYNTH_SYNTH4_FORCE_PINVC_RESET 1'h0 -#define SYNTH_SYNTH4_FORCE_VCOCAP_MSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_LSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_MASK 'h04000000 -#define SYNTH_SYNTH4_FORCE_VCOCAP_GET(x) (((x) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) >> SYNTH_SYNTH4_FORCE_VCOCAP_LSB) -#define SYNTH_SYNTH4_FORCE_VCOCAP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_FORCE_VCOCAP_LSB) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) -#define SYNTH_SYNTH4_FORCE_VCOCAP_RESET 1'h0 -#define SYNTH_SYNTH4_VCOCAP_OVR_MSB 25 -#define SYNTH_SYNTH4_VCOCAP_OVR_LSB 18 -#define SYNTH_SYNTH4_VCOCAP_OVR_MASK 'h03fc0000 -#define SYNTH_SYNTH4_VCOCAP_OVR_GET(x) (((x) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) >> SYNTH_SYNTH4_VCOCAP_OVR_LSB) -#define SYNTH_SYNTH4_VCOCAP_OVR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_VCOCAP_OVR_LSB) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) -#define SYNTH_SYNTH4_VCOCAP_OVR_RESET 8'h80 -#define SYNTH_SYNTH4_VCOCAPPULLUP_MSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_LSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_MASK 'h00020000 -#define SYNTH_SYNTH4_VCOCAPPULLUP_GET(x) (((x) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) >> SYNTH_SYNTH4_VCOCAPPULLUP_LSB) -#define SYNTH_SYNTH4_VCOCAPPULLUP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_VCOCAPPULLUP_LSB) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) -#define SYNTH_SYNTH4_VCOCAPPULLUP_RESET 1'h1 -#define SYNTH_SYNTH4_REFDIVSEL_MSB 16 -#define SYNTH_SYNTH4_REFDIVSEL_LSB 15 -#define SYNTH_SYNTH4_REFDIVSEL_MASK 'h00018000 -#define SYNTH_SYNTH4_REFDIVSEL_GET(x) (((x) & SYNTH_SYNTH4_REFDIVSEL_MASK) >> SYNTH_SYNTH4_REFDIVSEL_LSB) -#define SYNTH_SYNTH4_REFDIVSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_REFDIVSEL_LSB) & SYNTH_SYNTH4_REFDIVSEL_MASK) -#define SYNTH_SYNTH4_REFDIVSEL_RESET 2'h0 -#define SYNTH_SYNTH4_PFDDELAY_MSB 14 -#define SYNTH_SYNTH4_PFDDELAY_LSB 14 -#define SYNTH_SYNTH4_PFDDELAY_MASK 'h00004000 -#define SYNTH_SYNTH4_PFDDELAY_GET(x) (((x) & SYNTH_SYNTH4_PFDDELAY_MASK) >> SYNTH_SYNTH4_PFDDELAY_LSB) -#define SYNTH_SYNTH4_PFDDELAY_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PFDDELAY_LSB) & SYNTH_SYNTH4_PFDDELAY_MASK) -#define SYNTH_SYNTH4_PFDDELAY_RESET 1'h1 -#define SYNTH_SYNTH4_PFD_DISABLE_MSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_LSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_MASK 'h00002000 -#define SYNTH_SYNTH4_PFD_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_PFD_DISABLE_MASK) >> SYNTH_SYNTH4_PFD_DISABLE_LSB) -#define SYNTH_SYNTH4_PFD_DISABLE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PFD_DISABLE_LSB) & SYNTH_SYNTH4_PFD_DISABLE_MASK) -#define SYNTH_SYNTH4_PFD_DISABLE_RESET 1'h0 -#define SYNTH_SYNTH4_PRESCSEL_MSB 12 -#define SYNTH_SYNTH4_PRESCSEL_LSB 11 -#define SYNTH_SYNTH4_PRESCSEL_MASK 'h00001800 -#define SYNTH_SYNTH4_PRESCSEL_GET(x) (((x) & SYNTH_SYNTH4_PRESCSEL_MASK) >> SYNTH_SYNTH4_PRESCSEL_LSB) -#define SYNTH_SYNTH4_PRESCSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PRESCSEL_LSB) & SYNTH_SYNTH4_PRESCSEL_MASK) -#define SYNTH_SYNTH4_PRESCSEL_RESET 2'h3 -#define SYNTH_SYNTH4_RESET_PRESC_MSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_LSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_MASK 'h00000400 -#define SYNTH_SYNTH4_RESET_PRESC_GET(x) (((x) & SYNTH_SYNTH4_RESET_PRESC_MASK) >> SYNTH_SYNTH4_RESET_PRESC_LSB) -#define SYNTH_SYNTH4_RESET_PRESC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_RESET_PRESC_LSB) & SYNTH_SYNTH4_RESET_PRESC_MASK) -#define SYNTH_SYNTH4_RESET_PRESC_RESET 1'h0 -#define SYNTH_SYNTH4_SDM_DISABLE_MSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_LSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_MASK 'h00000200 -#define SYNTH_SYNTH4_SDM_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_SDM_DISABLE_MASK) >> SYNTH_SYNTH4_SDM_DISABLE_LSB) -#define SYNTH_SYNTH4_SDM_DISABLE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SDM_DISABLE_LSB) & SYNTH_SYNTH4_SDM_DISABLE_MASK) -#define SYNTH_SYNTH4_SDM_DISABLE_RESET 1'h0 -#define SYNTH_SYNTH4_SDM_MODE_MSB 8 -#define SYNTH_SYNTH4_SDM_MODE_LSB 8 -#define SYNTH_SYNTH4_SDM_MODE_MASK 'h00000100 -#define SYNTH_SYNTH4_SDM_MODE_GET(x) (((x) & SYNTH_SYNTH4_SDM_MODE_MASK) >> SYNTH_SYNTH4_SDM_MODE_LSB) -#define SYNTH_SYNTH4_SDM_MODE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SDM_MODE_LSB) & SYNTH_SYNTH4_SDM_MODE_MASK) -#define SYNTH_SYNTH4_SDM_MODE_RESET 1'h0 -#define SYNTH_SYNTH4_SDM_DITHER_MSB 7 -#define SYNTH_SYNTH4_SDM_DITHER_LSB 6 -#define SYNTH_SYNTH4_SDM_DITHER_MASK 'h000000c0 -#define SYNTH_SYNTH4_SDM_DITHER_GET(x) (((x) & SYNTH_SYNTH4_SDM_DITHER_MASK) >> SYNTH_SYNTH4_SDM_DITHER_LSB) -#define SYNTH_SYNTH4_SDM_DITHER_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SDM_DITHER_LSB) & SYNTH_SYNTH4_SDM_DITHER_MASK) -#define SYNTH_SYNTH4_SDM_DITHER_RESET 2'h0 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK 'h00000020 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_GET(x) (((x) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) >> SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_RESET 1'h0 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK 'h00000010 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_GET(x) (((x) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) >> SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_RESET 1'h0 -#define SYNTH_SYNTH4_SPARE_MISC_MSB 3 -#define SYNTH_SYNTH4_SPARE_MISC_LSB 2 -#define SYNTH_SYNTH4_SPARE_MISC_MASK 'h0000000c -#define SYNTH_SYNTH4_SPARE_MISC_GET(x) (((x) & SYNTH_SYNTH4_SPARE_MISC_MASK) >> SYNTH_SYNTH4_SPARE_MISC_LSB) -#define SYNTH_SYNTH4_SPARE_MISC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SPARE_MISC_LSB) & SYNTH_SYNTH4_SPARE_MISC_MASK) -#define SYNTH_SYNTH4_SPARE_MISC_RESET 2'h0 -#define SYNTH_SYNTH4_LONGSHIFTSEL_MSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_LSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_MASK 'h00000002 -#define SYNTH_SYNTH4_LONGSHIFTSEL_GET(x) (((x) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) >> SYNTH_SYNTH4_LONGSHIFTSEL_LSB) -#define SYNTH_SYNTH4_LONGSHIFTSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_LONGSHIFTSEL_LSB) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) -#define SYNTH_SYNTH4_LONGSHIFTSEL_RESET 1'h0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_LSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MASK 'h00000001 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_GET(x) (((x) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) >> SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_RESET 1'h0 -#define SYNTH_SYNTH4_RESET (32'h0 | \ - SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_SET(SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_RESET) | \ - SYNTH_SYNTH4_DIS_LOSTVC_SET(SYNTH_SYNTH4_DIS_LOSTVC_RESET) | \ - SYNTH_SYNTH4_ALWAYS_SHORTR_SET(SYNTH_SYNTH4_ALWAYS_SHORTR_RESET) | \ - SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_SET(SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_RESET) | \ - SYNTH_SYNTH4_FORCE_PINVC_SET(SYNTH_SYNTH4_FORCE_PINVC_RESET) | \ - SYNTH_SYNTH4_FORCE_VCOCAP_SET(SYNTH_SYNTH4_FORCE_VCOCAP_RESET) | \ - SYNTH_SYNTH4_VCOCAP_OVR_SET(SYNTH_SYNTH4_VCOCAP_OVR_RESET) | \ - SYNTH_SYNTH4_VCOCAPPULLUP_SET(SYNTH_SYNTH4_VCOCAPPULLUP_RESET) | \ - SYNTH_SYNTH4_REFDIVSEL_SET(SYNTH_SYNTH4_REFDIVSEL_RESET) | \ - SYNTH_SYNTH4_PFDDELAY_SET(SYNTH_SYNTH4_PFDDELAY_RESET) | \ - SYNTH_SYNTH4_PFD_DISABLE_SET(SYNTH_SYNTH4_PFD_DISABLE_RESET) | \ - SYNTH_SYNTH4_PRESCSEL_SET(SYNTH_SYNTH4_PRESCSEL_RESET) | \ - SYNTH_SYNTH4_RESET_PRESC_SET(SYNTH_SYNTH4_RESET_PRESC_RESET) | \ - SYNTH_SYNTH4_SDM_DISABLE_SET(SYNTH_SYNTH4_SDM_DISABLE_RESET) | \ - SYNTH_SYNTH4_SDM_MODE_SET(SYNTH_SYNTH4_SDM_MODE_RESET) | \ - SYNTH_SYNTH4_SDM_DITHER_SET(SYNTH_SYNTH4_SDM_DITHER_RESET) | \ - SYNTH_SYNTH4_PSCOUNT_FBSEL_SET(SYNTH_SYNTH4_PSCOUNT_FBSEL_RESET) | \ - SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_SET(SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_RESET) | \ - SYNTH_SYNTH4_SPARE_MISC_SET(SYNTH_SYNTH4_SPARE_MISC_RESET) | \ - SYNTH_SYNTH4_LONGSHIFTSEL_SET(SYNTH_SYNTH4_LONGSHIFTSEL_RESET) | \ - SYNTH_SYNTH4_FORCE_SHIFTREG_SET(SYNTH_SYNTH4_FORCE_SHIFTREG_RESET)) -#define SYNTH_SYNTH4_HW_MASK (32'h0) -#define SYNTH_SYNTH4_SW_MASK (32'h0 | \ - SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK | \ - SYNTH_SYNTH4_DIS_LOSTVC_MASK | \ - SYNTH_SYNTH4_ALWAYS_SHORTR_MASK | \ - SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK | \ - SYNTH_SYNTH4_FORCE_PINVC_MASK | \ - SYNTH_SYNTH4_FORCE_VCOCAP_MASK | \ - SYNTH_SYNTH4_VCOCAP_OVR_MASK | \ - SYNTH_SYNTH4_VCOCAPPULLUP_MASK | \ - SYNTH_SYNTH4_REFDIVSEL_MASK | \ - SYNTH_SYNTH4_PFDDELAY_MASK | \ - SYNTH_SYNTH4_PFD_DISABLE_MASK | \ - SYNTH_SYNTH4_PRESCSEL_MASK | \ - SYNTH_SYNTH4_RESET_PRESC_MASK | \ - SYNTH_SYNTH4_SDM_DISABLE_MASK | \ - SYNTH_SYNTH4_SDM_MODE_MASK | \ - SYNTH_SYNTH4_SDM_DITHER_MASK | \ - SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK | \ - SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK | \ - SYNTH_SYNTH4_SPARE_MISC_MASK | \ - SYNTH_SYNTH4_LONGSHIFTSEL_MASK | \ - SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) - -#define SYNTH_SYNTH5_ADDRESS 'h00000010 -#define SYNTH_SYNTH5_LOOP_IP0_MSB 31 -#define SYNTH_SYNTH5_LOOP_IP0_LSB 28 -#define SYNTH_SYNTH5_LOOP_IP0_MASK 'hf0000000 -#define SYNTH_SYNTH5_LOOP_IP0_GET(x) (((x) & SYNTH_SYNTH5_LOOP_IP0_MASK) >> SYNTH_SYNTH5_LOOP_IP0_LSB) -#define SYNTH_SYNTH5_LOOP_IP0_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_LOOP_IP0_LSB) & SYNTH_SYNTH5_LOOP_IP0_MASK) -#define SYNTH_SYNTH5_LOOP_IP0_RESET 4'hd -#define SYNTH_SYNTH5_SLOPE_IP_MSB 27 -#define SYNTH_SYNTH5_SLOPE_IP_LSB 25 -#define SYNTH_SYNTH5_SLOPE_IP_MASK 'h0e000000 -#define SYNTH_SYNTH5_SLOPE_IP_GET(x) (((x) & SYNTH_SYNTH5_SLOPE_IP_MASK) >> SYNTH_SYNTH5_SLOPE_IP_LSB) -#define SYNTH_SYNTH5_SLOPE_IP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_SLOPE_IP_LSB) & SYNTH_SYNTH5_SLOPE_IP_MASK) -#define SYNTH_SYNTH5_SLOPE_IP_RESET 3'h0 -#define SYNTH_SYNTH5_CPBIAS_MSB 24 -#define SYNTH_SYNTH5_CPBIAS_LSB 23 -#define SYNTH_SYNTH5_CPBIAS_MASK 'h01800000 -#define SYNTH_SYNTH5_CPBIAS_GET(x) (((x) & SYNTH_SYNTH5_CPBIAS_MASK) >> SYNTH_SYNTH5_CPBIAS_LSB) -#define SYNTH_SYNTH5_CPBIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CPBIAS_LSB) & SYNTH_SYNTH5_CPBIAS_MASK) -#define SYNTH_SYNTH5_CPBIAS_RESET 2'h1 -#define SYNTH_SYNTH5_CPSTEERING_EN_MSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_LSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_MASK 'h00400000 -#define SYNTH_SYNTH5_CPSTEERING_EN_GET(x) (((x) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) >> SYNTH_SYNTH5_CPSTEERING_EN_LSB) -#define SYNTH_SYNTH5_CPSTEERING_EN_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CPSTEERING_EN_LSB) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) -#define SYNTH_SYNTH5_CPSTEERING_EN_RESET 1'h0 -#define SYNTH_SYNTH5_CPLOWLK_MSB 21 -#define SYNTH_SYNTH5_CPLOWLK_LSB 21 -#define SYNTH_SYNTH5_CPLOWLK_MASK 'h00200000 -#define SYNTH_SYNTH5_CPLOWLK_GET(x) (((x) & SYNTH_SYNTH5_CPLOWLK_MASK) >> SYNTH_SYNTH5_CPLOWLK_LSB) -#define SYNTH_SYNTH5_CPLOWLK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CPLOWLK_LSB) & SYNTH_SYNTH5_CPLOWLK_MASK) -#define SYNTH_SYNTH5_CPLOWLK_RESET 1'h0 -#define SYNTH_SYNTH5_LOOPLEAKCUR_MSB 20 -#define SYNTH_SYNTH5_LOOPLEAKCUR_LSB 17 -#define SYNTH_SYNTH5_LOOPLEAKCUR_MASK 'h001e0000 -#define SYNTH_SYNTH5_LOOPLEAKCUR_GET(x) (((x) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) >> SYNTH_SYNTH5_LOOPLEAKCUR_LSB) -#define SYNTH_SYNTH5_LOOPLEAKCUR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_LOOPLEAKCUR_LSB) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) -#define SYNTH_SYNTH5_LOOPLEAKCUR_RESET 4'h0 -#define SYNTH_SYNTH5_CAPRANGE1_MSB 16 -#define SYNTH_SYNTH5_CAPRANGE1_LSB 13 -#define SYNTH_SYNTH5_CAPRANGE1_MASK 'h0001e000 -#define SYNTH_SYNTH5_CAPRANGE1_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE1_MASK) >> SYNTH_SYNTH5_CAPRANGE1_LSB) -#define SYNTH_SYNTH5_CAPRANGE1_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CAPRANGE1_LSB) & SYNTH_SYNTH5_CAPRANGE1_MASK) -#define SYNTH_SYNTH5_CAPRANGE1_RESET 4'h4 -#define SYNTH_SYNTH5_CAPRANGE2_MSB 12 -#define SYNTH_SYNTH5_CAPRANGE2_LSB 9 -#define SYNTH_SYNTH5_CAPRANGE2_MASK 'h00001e00 -#define SYNTH_SYNTH5_CAPRANGE2_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE2_MASK) >> SYNTH_SYNTH5_CAPRANGE2_LSB) -#define SYNTH_SYNTH5_CAPRANGE2_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CAPRANGE2_LSB) & SYNTH_SYNTH5_CAPRANGE2_MASK) -#define SYNTH_SYNTH5_CAPRANGE2_RESET 4'h8 -#define SYNTH_SYNTH5_CAPRANGE3_MSB 8 -#define SYNTH_SYNTH5_CAPRANGE3_LSB 5 -#define SYNTH_SYNTH5_CAPRANGE3_MASK 'h000001e0 -#define SYNTH_SYNTH5_CAPRANGE3_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE3_MASK) >> SYNTH_SYNTH5_CAPRANGE3_LSB) -#define SYNTH_SYNTH5_CAPRANGE3_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CAPRANGE3_LSB) & SYNTH_SYNTH5_CAPRANGE3_MASK) -#define SYNTH_SYNTH5_CAPRANGE3_RESET 4'hc -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK 'h00000010 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_RESET 1'h0 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MSB 3 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB 2 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK 'h0000000c -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_GET(x) (((x) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) >> SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_RESET 2'h2 -#define SYNTH_SYNTH5_SPARE_MSB 1 -#define SYNTH_SYNTH5_SPARE_LSB 0 -#define SYNTH_SYNTH5_SPARE_MASK 'h00000003 -#define SYNTH_SYNTH5_SPARE_GET(x) (((x) & SYNTH_SYNTH5_SPARE_MASK) >> SYNTH_SYNTH5_SPARE_LSB) -#define SYNTH_SYNTH5_SPARE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_SPARE_LSB) & SYNTH_SYNTH5_SPARE_MASK) -#define SYNTH_SYNTH5_SPARE_RESET 2'h0 -#define SYNTH_SYNTH5_RESET (32'h0 | \ - SYNTH_SYNTH5_LOOP_IP0_SET(SYNTH_SYNTH5_LOOP_IP0_RESET) | \ - SYNTH_SYNTH5_SLOPE_IP_SET(SYNTH_SYNTH5_SLOPE_IP_RESET) | \ - SYNTH_SYNTH5_CPBIAS_SET(SYNTH_SYNTH5_CPBIAS_RESET) | \ - SYNTH_SYNTH5_CPSTEERING_EN_SET(SYNTH_SYNTH5_CPSTEERING_EN_RESET) | \ - SYNTH_SYNTH5_CPLOWLK_SET(SYNTH_SYNTH5_CPLOWLK_RESET) | \ - SYNTH_SYNTH5_LOOPLEAKCUR_SET(SYNTH_SYNTH5_LOOPLEAKCUR_RESET) | \ - SYNTH_SYNTH5_CAPRANGE1_SET(SYNTH_SYNTH5_CAPRANGE1_RESET) | \ - SYNTH_SYNTH5_CAPRANGE2_SET(SYNTH_SYNTH5_CAPRANGE2_RESET) | \ - SYNTH_SYNTH5_CAPRANGE3_SET(SYNTH_SYNTH5_CAPRANGE3_RESET) | \ - SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_SET(SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_RESET) | \ - SYNTH_SYNTH5_LOBUF5GTUNE_OVR_SET(SYNTH_SYNTH5_LOBUF5GTUNE_OVR_RESET) | \ - SYNTH_SYNTH5_SPARE_SET(SYNTH_SYNTH5_SPARE_RESET)) -#define SYNTH_SYNTH5_HW_MASK (32'h0) -#define SYNTH_SYNTH5_SW_MASK (32'h0 | \ - SYNTH_SYNTH5_LOOP_IP0_MASK | \ - SYNTH_SYNTH5_SLOPE_IP_MASK | \ - SYNTH_SYNTH5_CPBIAS_MASK | \ - SYNTH_SYNTH5_CPSTEERING_EN_MASK | \ - SYNTH_SYNTH5_CPLOWLK_MASK | \ - SYNTH_SYNTH5_LOOPLEAKCUR_MASK | \ - SYNTH_SYNTH5_CAPRANGE1_MASK | \ - SYNTH_SYNTH5_CAPRANGE2_MASK | \ - SYNTH_SYNTH5_CAPRANGE3_MASK | \ - SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK | \ - SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK | \ - SYNTH_SYNTH5_SPARE_MASK) - -#define SYNTH_SYNTH6_ADDRESS 'h00000014 -#define SYNTH_SYNTH6_IRCP_MSB 31 -#define SYNTH_SYNTH6_IRCP_LSB 29 -#define SYNTH_SYNTH6_IRCP_MASK 'he0000000 -#define SYNTH_SYNTH6_IRCP_GET(x) (((x) & SYNTH_SYNTH6_IRCP_MASK) >> SYNTH_SYNTH6_IRCP_LSB) -#define SYNTH_SYNTH6_IRCP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_IRCP_LSB) & SYNTH_SYNTH6_IRCP_MASK) -#define SYNTH_SYNTH6_IRCP_RESET 3'h4 -#define SYNTH_SYNTH6_IRVCMON_MSB 28 -#define SYNTH_SYNTH6_IRVCMON_LSB 26 -#define SYNTH_SYNTH6_IRVCMON_MASK 'h1c000000 -#define SYNTH_SYNTH6_IRVCMON_GET(x) (((x) & SYNTH_SYNTH6_IRVCMON_MASK) >> SYNTH_SYNTH6_IRVCMON_LSB) -#define SYNTH_SYNTH6_IRVCMON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_IRVCMON_LSB) & SYNTH_SYNTH6_IRVCMON_MASK) -#define SYNTH_SYNTH6_IRVCMON_RESET 3'h4 -#define SYNTH_SYNTH6_IRSPARE_MSB 25 -#define SYNTH_SYNTH6_IRSPARE_LSB 23 -#define SYNTH_SYNTH6_IRSPARE_MASK 'h03800000 -#define SYNTH_SYNTH6_IRSPARE_GET(x) (((x) & SYNTH_SYNTH6_IRSPARE_MASK) >> SYNTH_SYNTH6_IRSPARE_LSB) -#define SYNTH_SYNTH6_IRSPARE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_IRSPARE_LSB) & SYNTH_SYNTH6_IRSPARE_MASK) -#define SYNTH_SYNTH6_IRSPARE_RESET 3'h4 -#define SYNTH_SYNTH6_ICPRESC_MSB 22 -#define SYNTH_SYNTH6_ICPRESC_LSB 20 -#define SYNTH_SYNTH6_ICPRESC_MASK 'h00700000 -#define SYNTH_SYNTH6_ICPRESC_GET(x) (((x) & SYNTH_SYNTH6_ICPRESC_MASK) >> SYNTH_SYNTH6_ICPRESC_LSB) -#define SYNTH_SYNTH6_ICPRESC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICPRESC_LSB) & SYNTH_SYNTH6_ICPRESC_MASK) -#define SYNTH_SYNTH6_ICPRESC_RESET 3'h4 -#define SYNTH_SYNTH6_ICLODIV_MSB 19 -#define SYNTH_SYNTH6_ICLODIV_LSB 17 -#define SYNTH_SYNTH6_ICLODIV_MASK 'h000e0000 -#define SYNTH_SYNTH6_ICLODIV_GET(x) (((x) & SYNTH_SYNTH6_ICLODIV_MASK) >> SYNTH_SYNTH6_ICLODIV_LSB) -#define SYNTH_SYNTH6_ICLODIV_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICLODIV_LSB) & SYNTH_SYNTH6_ICLODIV_MASK) -#define SYNTH_SYNTH6_ICLODIV_RESET 3'h4 -#define SYNTH_SYNTH6_ICLOMIX_MSB 16 -#define SYNTH_SYNTH6_ICLOMIX_LSB 14 -#define SYNTH_SYNTH6_ICLOMIX_MASK 'h0001c000 -#define SYNTH_SYNTH6_ICLOMIX_GET(x) (((x) & SYNTH_SYNTH6_ICLOMIX_MASK) >> SYNTH_SYNTH6_ICLOMIX_LSB) -#define SYNTH_SYNTH6_ICLOMIX_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICLOMIX_LSB) & SYNTH_SYNTH6_ICLOMIX_MASK) -#define SYNTH_SYNTH6_ICLOMIX_RESET 3'h4 -#define SYNTH_SYNTH6_ICSPAREA_MSB 13 -#define SYNTH_SYNTH6_ICSPAREA_LSB 11 -#define SYNTH_SYNTH6_ICSPAREA_MASK 'h00003800 -#define SYNTH_SYNTH6_ICSPAREA_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREA_MASK) >> SYNTH_SYNTH6_ICSPAREA_LSB) -#define SYNTH_SYNTH6_ICSPAREA_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICSPAREA_LSB) & SYNTH_SYNTH6_ICSPAREA_MASK) -#define SYNTH_SYNTH6_ICSPAREA_RESET 3'h4 -#define SYNTH_SYNTH6_ICSPAREB_MSB 10 -#define SYNTH_SYNTH6_ICSPAREB_LSB 8 -#define SYNTH_SYNTH6_ICSPAREB_MASK 'h00000700 -#define SYNTH_SYNTH6_ICSPAREB_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREB_MASK) >> SYNTH_SYNTH6_ICSPAREB_LSB) -#define SYNTH_SYNTH6_ICSPAREB_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICSPAREB_LSB) & SYNTH_SYNTH6_ICSPAREB_MASK) -#define SYNTH_SYNTH6_ICSPAREB_RESET 3'h4 -#define SYNTH_SYNTH6_ICVCO_MSB 7 -#define SYNTH_SYNTH6_ICVCO_LSB 5 -#define SYNTH_SYNTH6_ICVCO_MASK 'h000000e0 -#define SYNTH_SYNTH6_ICVCO_GET(x) (((x) & SYNTH_SYNTH6_ICVCO_MASK) >> SYNTH_SYNTH6_ICVCO_LSB) -#define SYNTH_SYNTH6_ICVCO_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICVCO_LSB) & SYNTH_SYNTH6_ICVCO_MASK) -#define SYNTH_SYNTH6_ICVCO_RESET 3'h4 -#define SYNTH_SYNTH6_VCOBUFBIAS_MSB 4 -#define SYNTH_SYNTH6_VCOBUFBIAS_LSB 3 -#define SYNTH_SYNTH6_VCOBUFBIAS_MASK 'h00000018 -#define SYNTH_SYNTH6_VCOBUFBIAS_GET(x) (((x) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) >> SYNTH_SYNTH6_VCOBUFBIAS_LSB) -#define SYNTH_SYNTH6_VCOBUFBIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_VCOBUFBIAS_LSB) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) -#define SYNTH_SYNTH6_VCOBUFBIAS_RESET 2'h2 -#define SYNTH_SYNTH6_SPARE_BIAS_MSB 2 -#define SYNTH_SYNTH6_SPARE_BIAS_LSB 0 -#define SYNTH_SYNTH6_SPARE_BIAS_MASK 'h00000007 -#define SYNTH_SYNTH6_SPARE_BIAS_GET(x) (((x) & SYNTH_SYNTH6_SPARE_BIAS_MASK) >> SYNTH_SYNTH6_SPARE_BIAS_LSB) -#define SYNTH_SYNTH6_SPARE_BIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_SPARE_BIAS_LSB) & SYNTH_SYNTH6_SPARE_BIAS_MASK) -#define SYNTH_SYNTH6_SPARE_BIAS_RESET 3'h0 -#define SYNTH_SYNTH6_RESET (32'h0 | \ - SYNTH_SYNTH6_IRCP_SET(SYNTH_SYNTH6_IRCP_RESET) | \ - SYNTH_SYNTH6_IRVCMON_SET(SYNTH_SYNTH6_IRVCMON_RESET) | \ - SYNTH_SYNTH6_IRSPARE_SET(SYNTH_SYNTH6_IRSPARE_RESET) | \ - SYNTH_SYNTH6_ICPRESC_SET(SYNTH_SYNTH6_ICPRESC_RESET) | \ - SYNTH_SYNTH6_ICLODIV_SET(SYNTH_SYNTH6_ICLODIV_RESET) | \ - SYNTH_SYNTH6_ICLOMIX_SET(SYNTH_SYNTH6_ICLOMIX_RESET) | \ - SYNTH_SYNTH6_ICSPAREA_SET(SYNTH_SYNTH6_ICSPAREA_RESET) | \ - SYNTH_SYNTH6_ICSPAREB_SET(SYNTH_SYNTH6_ICSPAREB_RESET) | \ - SYNTH_SYNTH6_ICVCO_SET(SYNTH_SYNTH6_ICVCO_RESET) | \ - SYNTH_SYNTH6_VCOBUFBIAS_SET(SYNTH_SYNTH6_VCOBUFBIAS_RESET) | \ - SYNTH_SYNTH6_SPARE_BIAS_SET(SYNTH_SYNTH6_SPARE_BIAS_RESET)) -#define SYNTH_SYNTH6_HW_MASK (32'h0) -#define SYNTH_SYNTH6_SW_MASK (32'h0 | \ - SYNTH_SYNTH6_IRCP_MASK | \ - SYNTH_SYNTH6_IRVCMON_MASK | \ - SYNTH_SYNTH6_IRSPARE_MASK | \ - SYNTH_SYNTH6_ICPRESC_MASK | \ - SYNTH_SYNTH6_ICLODIV_MASK | \ - SYNTH_SYNTH6_ICLOMIX_MASK | \ - SYNTH_SYNTH6_ICSPAREA_MASK | \ - SYNTH_SYNTH6_ICSPAREB_MASK | \ - SYNTH_SYNTH6_ICVCO_MASK | \ - SYNTH_SYNTH6_VCOBUFBIAS_MASK | \ - SYNTH_SYNTH6_SPARE_BIAS_MASK) - -#define SYNTH_SYNTH7_ADDRESS 'h00000018 -#define SYNTH_SYNTH7_SYNTH_ON_MSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_LSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_MASK 'h80000000 -#define SYNTH_SYNTH7_SYNTH_ON_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_ON_MASK) >> SYNTH_SYNTH7_SYNTH_ON_LSB) -#define SYNTH_SYNTH7_SYNTH_ON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SYNTH_ON_LSB) & SYNTH_SYNTH7_SYNTH_ON_MASK) -#define SYNTH_SYNTH7_SYNTH_ON_RESET 1'h0 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MSB 30 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_LSB 27 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MASK 'h78000000 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) >> SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_RESET 4'h0 -#define SYNTH_SYNTH7_CAP_SEARCH_MSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_LSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_MASK 'h04000000 -#define SYNTH_SYNTH7_CAP_SEARCH_GET(x) (((x) & SYNTH_SYNTH7_CAP_SEARCH_MASK) >> SYNTH_SYNTH7_CAP_SEARCH_LSB) -#define SYNTH_SYNTH7_CAP_SEARCH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_CAP_SEARCH_LSB) & SYNTH_SYNTH7_CAP_SEARCH_MASK) -#define SYNTH_SYNTH7_CAP_SEARCH_RESET 1'h0 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK 'h02000000 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) >> SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_RESET 1'h0 -#define SYNTH_SYNTH7_PIN_VC_MSB 24 -#define SYNTH_SYNTH7_PIN_VC_LSB 24 -#define SYNTH_SYNTH7_PIN_VC_MASK 'h01000000 -#define SYNTH_SYNTH7_PIN_VC_GET(x) (((x) & SYNTH_SYNTH7_PIN_VC_MASK) >> SYNTH_SYNTH7_PIN_VC_LSB) -#define SYNTH_SYNTH7_PIN_VC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_PIN_VC_LSB) & SYNTH_SYNTH7_PIN_VC_MASK) -#define SYNTH_SYNTH7_PIN_VC_RESET 1'h0 -#define SYNTH_SYNTH7_VCO_CAP_ST_MSB 23 -#define SYNTH_SYNTH7_VCO_CAP_ST_LSB 16 -#define SYNTH_SYNTH7_VCO_CAP_ST_MASK 'h00ff0000 -#define SYNTH_SYNTH7_VCO_CAP_ST_GET(x) (((x) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) >> SYNTH_SYNTH7_VCO_CAP_ST_LSB) -#define SYNTH_SYNTH7_VCO_CAP_ST_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_VCO_CAP_ST_LSB) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) -#define SYNTH_SYNTH7_VCO_CAP_ST_RESET 8'h0 -#define SYNTH_SYNTH7_SHORT_R_MSB 15 -#define SYNTH_SYNTH7_SHORT_R_LSB 15 -#define SYNTH_SYNTH7_SHORT_R_MASK 'h00008000 -#define SYNTH_SYNTH7_SHORT_R_GET(x) (((x) & SYNTH_SYNTH7_SHORT_R_MASK) >> SYNTH_SYNTH7_SHORT_R_LSB) -#define SYNTH_SYNTH7_SHORT_R_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SHORT_R_LSB) & SYNTH_SYNTH7_SHORT_R_MASK) -#define SYNTH_SYNTH7_SHORT_R_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_RFD_MSB 14 -#define SYNTH_SYNTH7_RESET_RFD_LSB 14 -#define SYNTH_SYNTH7_RESET_RFD_MASK 'h00004000 -#define SYNTH_SYNTH7_RESET_RFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_RFD_MASK) >> SYNTH_SYNTH7_RESET_RFD_LSB) -#define SYNTH_SYNTH7_RESET_RFD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_RFD_LSB) & SYNTH_SYNTH7_RESET_RFD_MASK) -#define SYNTH_SYNTH7_RESET_RFD_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_PFD_MSB 13 -#define SYNTH_SYNTH7_RESET_PFD_LSB 13 -#define SYNTH_SYNTH7_RESET_PFD_MASK 'h00002000 -#define SYNTH_SYNTH7_RESET_PFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_PFD_MASK) >> SYNTH_SYNTH7_RESET_PFD_LSB) -#define SYNTH_SYNTH7_RESET_PFD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_PFD_LSB) & SYNTH_SYNTH7_RESET_PFD_MASK) -#define SYNTH_SYNTH7_RESET_PFD_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK 'h00001000 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_GET(x) (((x) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) >> SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_SDM_B_MSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_LSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_MASK 'h00000800 -#define SYNTH_SYNTH7_RESET_SDM_B_GET(x) (((x) & SYNTH_SYNTH7_RESET_SDM_B_MASK) >> SYNTH_SYNTH7_RESET_SDM_B_LSB) -#define SYNTH_SYNTH7_RESET_SDM_B_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_SDM_B_LSB) & SYNTH_SYNTH7_RESET_SDM_B_MASK) -#define SYNTH_SYNTH7_RESET_SDM_B_RESET 1'h0 -#define SYNTH_SYNTH7_VC2HIGH_MSB 10 -#define SYNTH_SYNTH7_VC2HIGH_LSB 10 -#define SYNTH_SYNTH7_VC2HIGH_MASK 'h00000400 -#define SYNTH_SYNTH7_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH7_VC2HIGH_MASK) >> SYNTH_SYNTH7_VC2HIGH_LSB) -#define SYNTH_SYNTH7_VC2HIGH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_VC2HIGH_LSB) & SYNTH_SYNTH7_VC2HIGH_MASK) -#define SYNTH_SYNTH7_VC2HIGH_RESET 1'h0 -#define SYNTH_SYNTH7_VC2LOW_MSB 9 -#define SYNTH_SYNTH7_VC2LOW_LSB 9 -#define SYNTH_SYNTH7_VC2LOW_MASK 'h00000200 -#define SYNTH_SYNTH7_VC2LOW_GET(x) (((x) & SYNTH_SYNTH7_VC2LOW_MASK) >> SYNTH_SYNTH7_VC2LOW_LSB) -#define SYNTH_SYNTH7_VC2LOW_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_VC2LOW_LSB) & SYNTH_SYNTH7_VC2LOW_MASK) -#define SYNTH_SYNTH7_VC2LOW_RESET 1'h0 -#define SYNTH_SYNTH7_LOOP_IP_MSB 8 -#define SYNTH_SYNTH7_LOOP_IP_LSB 5 -#define SYNTH_SYNTH7_LOOP_IP_MASK 'h000001e0 -#define SYNTH_SYNTH7_LOOP_IP_GET(x) (((x) & SYNTH_SYNTH7_LOOP_IP_MASK) >> SYNTH_SYNTH7_LOOP_IP_LSB) -#define SYNTH_SYNTH7_LOOP_IP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_LOOP_IP_LSB) & SYNTH_SYNTH7_LOOP_IP_MASK) -#define SYNTH_SYNTH7_LOOP_IP_RESET 4'h0 -#define SYNTH_SYNTH7_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH7_LOBUF5GTUNE_LSB 3 -#define SYNTH_SYNTH7_LOBUF5GTUNE_MASK 'h00000018 -#define SYNTH_SYNTH7_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH7_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH7_LOBUF5GTUNE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_LOBUF5GTUNE_LSB) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH7_LOBUF5GTUNE_RESET 2'h0 -#define SYNTH_SYNTH7_SPARE_READ_MSB 2 -#define SYNTH_SYNTH7_SPARE_READ_LSB 0 -#define SYNTH_SYNTH7_SPARE_READ_MASK 'h00000007 -#define SYNTH_SYNTH7_SPARE_READ_GET(x) (((x) & SYNTH_SYNTH7_SPARE_READ_MASK) >> SYNTH_SYNTH7_SPARE_READ_LSB) -#define SYNTH_SYNTH7_SPARE_READ_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SPARE_READ_LSB) & SYNTH_SYNTH7_SPARE_READ_MASK) -#define SYNTH_SYNTH7_SPARE_READ_RESET 3'h0 -#define SYNTH_SYNTH7_RESET (32'h0 | \ - SYNTH_SYNTH7_SYNTH_ON_SET(SYNTH_SYNTH7_SYNTH_ON_RESET) | \ - SYNTH_SYNTH7_SYNTH_SM_STATE_SET(SYNTH_SYNTH7_SYNTH_SM_STATE_RESET) | \ - SYNTH_SYNTH7_CAP_SEARCH_SET(SYNTH_SYNTH7_CAP_SEARCH_RESET) | \ - SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_SET(SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_RESET) | \ - SYNTH_SYNTH7_PIN_VC_SET(SYNTH_SYNTH7_PIN_VC_RESET) | \ - SYNTH_SYNTH7_VCO_CAP_ST_SET(SYNTH_SYNTH7_VCO_CAP_ST_RESET) | \ - SYNTH_SYNTH7_SHORT_R_SET(SYNTH_SYNTH7_SHORT_R_RESET) | \ - SYNTH_SYNTH7_RESET_RFD_SET(SYNTH_SYNTH7_RESET_RFD_RESET) | \ - SYNTH_SYNTH7_RESET_PFD_SET(SYNTH_SYNTH7_RESET_PFD_RESET) | \ - SYNTH_SYNTH7_RESET_PSCOUNTERS_SET(SYNTH_SYNTH7_RESET_PSCOUNTERS_RESET) | \ - SYNTH_SYNTH7_RESET_SDM_B_SET(SYNTH_SYNTH7_RESET_SDM_B_RESET) | \ - SYNTH_SYNTH7_VC2HIGH_SET(SYNTH_SYNTH7_VC2HIGH_RESET) | \ - SYNTH_SYNTH7_VC2LOW_SET(SYNTH_SYNTH7_VC2LOW_RESET) | \ - SYNTH_SYNTH7_LOOP_IP_SET(SYNTH_SYNTH7_LOOP_IP_RESET) | \ - SYNTH_SYNTH7_LOBUF5GTUNE_SET(SYNTH_SYNTH7_LOBUF5GTUNE_RESET) | \ - SYNTH_SYNTH7_SPARE_READ_SET(SYNTH_SYNTH7_SPARE_READ_RESET)) -#define SYNTH_SYNTH7_HW_MASK (32'h0 | \ - SYNTH_SYNTH7_SYNTH_ON_MASK | \ - SYNTH_SYNTH7_SYNTH_SM_STATE_MASK | \ - SYNTH_SYNTH7_CAP_SEARCH_MASK | \ - SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK | \ - SYNTH_SYNTH7_PIN_VC_MASK | \ - SYNTH_SYNTH7_VCO_CAP_ST_MASK | \ - SYNTH_SYNTH7_SHORT_R_MASK | \ - SYNTH_SYNTH7_RESET_RFD_MASK | \ - SYNTH_SYNTH7_RESET_PFD_MASK | \ - SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK | \ - SYNTH_SYNTH7_RESET_SDM_B_MASK | \ - SYNTH_SYNTH7_VC2HIGH_MASK | \ - SYNTH_SYNTH7_VC2LOW_MASK | \ - SYNTH_SYNTH7_LOOP_IP_MASK | \ - SYNTH_SYNTH7_LOBUF5GTUNE_MASK | \ - SYNTH_SYNTH7_SPARE_READ_MASK) -#define SYNTH_SYNTH7_SW_MASK (32'h0) - -#define SYNTH_SYNTH8_ADDRESS 'h0000001c -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK 'h80000000 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_GET(x) (((x) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) >> SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_RESET 1'h0 -#define SYNTH_SYNTH8_FRACMODE_MSB 30 -#define SYNTH_SYNTH8_FRACMODE_LSB 30 -#define SYNTH_SYNTH8_FRACMODE_MASK 'h40000000 -#define SYNTH_SYNTH8_FRACMODE_GET(x) (((x) & SYNTH_SYNTH8_FRACMODE_MASK) >> SYNTH_SYNTH8_FRACMODE_LSB) -#define SYNTH_SYNTH8_FRACMODE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_FRACMODE_LSB) & SYNTH_SYNTH8_FRACMODE_MASK) -#define SYNTH_SYNTH8_FRACMODE_RESET 1'h0 -#define SYNTH_SYNTH8_AMODEREFSEL_MSB 29 -#define SYNTH_SYNTH8_AMODEREFSEL_LSB 28 -#define SYNTH_SYNTH8_AMODEREFSEL_MASK 'h30000000 -#define SYNTH_SYNTH8_AMODEREFSEL_GET(x) (((x) & SYNTH_SYNTH8_AMODEREFSEL_MASK) >> SYNTH_SYNTH8_AMODEREFSEL_LSB) -#define SYNTH_SYNTH8_AMODEREFSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_AMODEREFSEL_LSB) & SYNTH_SYNTH8_AMODEREFSEL_MASK) -#define SYNTH_SYNTH8_AMODEREFSEL_RESET 2'h0 -#define SYNTH_SYNTH8_SPARE_MSB 27 -#define SYNTH_SYNTH8_SPARE_LSB 27 -#define SYNTH_SYNTH8_SPARE_MASK 'h08000000 -#define SYNTH_SYNTH8_SPARE_GET(x) (((x) & SYNTH_SYNTH8_SPARE_MASK) >> SYNTH_SYNTH8_SPARE_LSB) -#define SYNTH_SYNTH8_SPARE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_SPARE_LSB) & SYNTH_SYNTH8_SPARE_MASK) -#define SYNTH_SYNTH8_SPARE_RESET 1'h0 -#define SYNTH_SYNTH8_CHANSEL_MSB 26 -#define SYNTH_SYNTH8_CHANSEL_LSB 18 -#define SYNTH_SYNTH8_CHANSEL_MASK 'h07fc0000 -#define SYNTH_SYNTH8_CHANSEL_GET(x) (((x) & SYNTH_SYNTH8_CHANSEL_MASK) >> SYNTH_SYNTH8_CHANSEL_LSB) -#define SYNTH_SYNTH8_CHANSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_CHANSEL_LSB) & SYNTH_SYNTH8_CHANSEL_MASK) -#define SYNTH_SYNTH8_CHANSEL_RESET 9'h0 -#define SYNTH_SYNTH8_CHANFRAC_MSB 17 -#define SYNTH_SYNTH8_CHANFRAC_LSB 1 -#define SYNTH_SYNTH8_CHANFRAC_MASK 'h0003fffe -#define SYNTH_SYNTH8_CHANFRAC_GET(x) (((x) & SYNTH_SYNTH8_CHANFRAC_MASK) >> SYNTH_SYNTH8_CHANFRAC_LSB) -#define SYNTH_SYNTH8_CHANFRAC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_CHANFRAC_LSB) & SYNTH_SYNTH8_CHANFRAC_MASK) -#define SYNTH_SYNTH8_CHANFRAC_RESET 17'h0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_MSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_LSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_MASK 'h00000001 -#define SYNTH_SYNTH8_FORCE_FRACLSB_GET(x) (((x) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) >> SYNTH_SYNTH8_FORCE_FRACLSB_LSB) -#define SYNTH_SYNTH8_FORCE_FRACLSB_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_FORCE_FRACLSB_LSB) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) -#define SYNTH_SYNTH8_FORCE_FRACLSB_RESET 1'h0 -#define SYNTH_SYNTH8_RESET (32'h0 | \ - SYNTH_SYNTH8_LOADSYNTHCHANNEL_SET(SYNTH_SYNTH8_LOADSYNTHCHANNEL_RESET) | \ - SYNTH_SYNTH8_FRACMODE_SET(SYNTH_SYNTH8_FRACMODE_RESET) | \ - SYNTH_SYNTH8_AMODEREFSEL_SET(SYNTH_SYNTH8_AMODEREFSEL_RESET) | \ - SYNTH_SYNTH8_SPARE_SET(SYNTH_SYNTH8_SPARE_RESET) | \ - SYNTH_SYNTH8_CHANSEL_SET(SYNTH_SYNTH8_CHANSEL_RESET) | \ - SYNTH_SYNTH8_CHANFRAC_SET(SYNTH_SYNTH8_CHANFRAC_RESET) | \ - SYNTH_SYNTH8_FORCE_FRACLSB_SET(SYNTH_SYNTH8_FORCE_FRACLSB_RESET)) -#define SYNTH_SYNTH8_HW_MASK (32'h0 | \ - SYNTH_SYNTH8_FRACMODE_MASK | \ - SYNTH_SYNTH8_AMODEREFSEL_MASK | \ - SYNTH_SYNTH8_SPARE_MASK | \ - SYNTH_SYNTH8_CHANSEL_MASK | \ - SYNTH_SYNTH8_CHANFRAC_MASK) -#define SYNTH_SYNTH8_SW_MASK (32'h0 | \ - SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK | \ - SYNTH_SYNTH8_FRACMODE_MASK | \ - SYNTH_SYNTH8_AMODEREFSEL_MASK | \ - SYNTH_SYNTH8_SPARE_MASK | \ - SYNTH_SYNTH8_CHANSEL_MASK | \ - SYNTH_SYNTH8_CHANFRAC_MASK | \ - SYNTH_SYNTH8_FORCE_FRACLSB_MASK) - -#define RF5G_RF5G1_ADDRESS 'h00000020 -#define RF5G_RF5G1_PDTXLO5_MSB 31 -#define RF5G_RF5G1_PDTXLO5_LSB 31 -#define RF5G_RF5G1_PDTXLO5_MASK 'h80000000 -#define RF5G_RF5G1_PDTXLO5_GET(x) (((x) & RF5G_RF5G1_PDTXLO5_MASK) >> RF5G_RF5G1_PDTXLO5_LSB) -#define RF5G_RF5G1_PDTXLO5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDTXLO5_LSB) & RF5G_RF5G1_PDTXLO5_MASK) -#define RF5G_RF5G1_PDTXLO5_RESET 1'h0 -#define RF5G_RF5G1_PDTXMIX5_MSB 30 -#define RF5G_RF5G1_PDTXMIX5_LSB 30 -#define RF5G_RF5G1_PDTXMIX5_MASK 'h40000000 -#define RF5G_RF5G1_PDTXMIX5_GET(x) (((x) & RF5G_RF5G1_PDTXMIX5_MASK) >> RF5G_RF5G1_PDTXMIX5_LSB) -#define RF5G_RF5G1_PDTXMIX5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDTXMIX5_LSB) & RF5G_RF5G1_PDTXMIX5_MASK) -#define RF5G_RF5G1_PDTXMIX5_RESET 1'h0 -#define RF5G_RF5G1_PDTXBUF5_MSB 29 -#define RF5G_RF5G1_PDTXBUF5_LSB 29 -#define RF5G_RF5G1_PDTXBUF5_MASK 'h20000000 -#define RF5G_RF5G1_PDTXBUF5_GET(x) (((x) & RF5G_RF5G1_PDTXBUF5_MASK) >> RF5G_RF5G1_PDTXBUF5_LSB) -#define RF5G_RF5G1_PDTXBUF5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDTXBUF5_LSB) & RF5G_RF5G1_PDTXBUF5_MASK) -#define RF5G_RF5G1_PDTXBUF5_RESET 1'h0 -#define RF5G_RF5G1_PDPADRV5_MSB 28 -#define RF5G_RF5G1_PDPADRV5_LSB 28 -#define RF5G_RF5G1_PDPADRV5_MASK 'h10000000 -#define RF5G_RF5G1_PDPADRV5_GET(x) (((x) & RF5G_RF5G1_PDPADRV5_MASK) >> RF5G_RF5G1_PDPADRV5_LSB) -#define RF5G_RF5G1_PDPADRV5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDPADRV5_LSB) & RF5G_RF5G1_PDPADRV5_MASK) -#define RF5G_RF5G1_PDPADRV5_RESET 1'h0 -#define RF5G_RF5G1_PDPAOUT5_MSB 27 -#define RF5G_RF5G1_PDPAOUT5_LSB 27 -#define RF5G_RF5G1_PDPAOUT5_MASK 'h08000000 -#define RF5G_RF5G1_PDPAOUT5_GET(x) (((x) & RF5G_RF5G1_PDPAOUT5_MASK) >> RF5G_RF5G1_PDPAOUT5_LSB) -#define RF5G_RF5G1_PDPAOUT5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDPAOUT5_LSB) & RF5G_RF5G1_PDPAOUT5_MASK) -#define RF5G_RF5G1_PDPAOUT5_RESET 1'h0 -#define RF5G_RF5G1_TUNE_PADRV5_MSB 26 -#define RF5G_RF5G1_TUNE_PADRV5_LSB 24 -#define RF5G_RF5G1_TUNE_PADRV5_MASK 'h07000000 -#define RF5G_RF5G1_TUNE_PADRV5_GET(x) (((x) & RF5G_RF5G1_TUNE_PADRV5_MASK) >> RF5G_RF5G1_TUNE_PADRV5_LSB) -#define RF5G_RF5G1_TUNE_PADRV5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_TUNE_PADRV5_LSB) & RF5G_RF5G1_TUNE_PADRV5_MASK) -#define RF5G_RF5G1_TUNE_PADRV5_RESET 3'h0 -#define RF5G_RF5G1_PWDTXPKD_MSB 23 -#define RF5G_RF5G1_PWDTXPKD_LSB 21 -#define RF5G_RF5G1_PWDTXPKD_MASK 'h00e00000 -#define RF5G_RF5G1_PWDTXPKD_GET(x) (((x) & RF5G_RF5G1_PWDTXPKD_MASK) >> RF5G_RF5G1_PWDTXPKD_LSB) -#define RF5G_RF5G1_PWDTXPKD_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PWDTXPKD_LSB) & RF5G_RF5G1_PWDTXPKD_MASK) -#define RF5G_RF5G1_PWDTXPKD_RESET 3'h7 -#define RF5G_RF5G1_DB5_MSB 20 -#define RF5G_RF5G1_DB5_LSB 18 -#define RF5G_RF5G1_DB5_MASK 'h001c0000 -#define RF5G_RF5G1_DB5_GET(x) (((x) & RF5G_RF5G1_DB5_MASK) >> RF5G_RF5G1_DB5_LSB) -#define RF5G_RF5G1_DB5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_DB5_LSB) & RF5G_RF5G1_DB5_MASK) -#define RF5G_RF5G1_DB5_RESET 3'h4 -#define RF5G_RF5G1_OB5_MSB 17 -#define RF5G_RF5G1_OB5_LSB 15 -#define RF5G_RF5G1_OB5_MASK 'h00038000 -#define RF5G_RF5G1_OB5_GET(x) (((x) & RF5G_RF5G1_OB5_MASK) >> RF5G_RF5G1_OB5_LSB) -#define RF5G_RF5G1_OB5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_OB5_LSB) & RF5G_RF5G1_OB5_MASK) -#define RF5G_RF5G1_OB5_RESET 3'h4 -#define RF5G_RF5G1_TX5_ATB_SEL_MSB 14 -#define RF5G_RF5G1_TX5_ATB_SEL_LSB 12 -#define RF5G_RF5G1_TX5_ATB_SEL_MASK 'h00007000 -#define RF5G_RF5G1_TX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_TX5_ATB_SEL_MASK) >> RF5G_RF5G1_TX5_ATB_SEL_LSB) -#define RF5G_RF5G1_TX5_ATB_SEL_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_TX5_ATB_SEL_LSB) & RF5G_RF5G1_TX5_ATB_SEL_MASK) -#define RF5G_RF5G1_TX5_ATB_SEL_RESET 3'h0 -#define RF5G_RF5G1_PDLO5DIV_MSB 11 -#define RF5G_RF5G1_PDLO5DIV_LSB 11 -#define RF5G_RF5G1_PDLO5DIV_MASK 'h00000800 -#define RF5G_RF5G1_PDLO5DIV_GET(x) (((x) & RF5G_RF5G1_PDLO5DIV_MASK) >> RF5G_RF5G1_PDLO5DIV_LSB) -#define RF5G_RF5G1_PDLO5DIV_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDLO5DIV_LSB) & RF5G_RF5G1_PDLO5DIV_MASK) -#define RF5G_RF5G1_PDLO5DIV_RESET 1'h0 -#define RF5G_RF5G1_PDLO5MIX_MSB 10 -#define RF5G_RF5G1_PDLO5MIX_LSB 10 -#define RF5G_RF5G1_PDLO5MIX_MASK 'h00000400 -#define RF5G_RF5G1_PDLO5MIX_GET(x) (((x) & RF5G_RF5G1_PDLO5MIX_MASK) >> RF5G_RF5G1_PDLO5MIX_LSB) -#define RF5G_RF5G1_PDLO5MIX_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDLO5MIX_LSB) & RF5G_RF5G1_PDLO5MIX_MASK) -#define RF5G_RF5G1_PDLO5MIX_RESET 1'h0 -#define RF5G_RF5G1_PDQBUF5_MSB 9 -#define RF5G_RF5G1_PDQBUF5_LSB 9 -#define RF5G_RF5G1_PDQBUF5_MASK 'h00000200 -#define RF5G_RF5G1_PDQBUF5_GET(x) (((x) & RF5G_RF5G1_PDQBUF5_MASK) >> RF5G_RF5G1_PDQBUF5_LSB) -#define RF5G_RF5G1_PDQBUF5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDQBUF5_LSB) & RF5G_RF5G1_PDQBUF5_MASK) -#define RF5G_RF5G1_PDQBUF5_RESET 1'h0 -#define RF5G_RF5G1_PDLO5AGC_MSB 8 -#define RF5G_RF5G1_PDLO5AGC_LSB 8 -#define RF5G_RF5G1_PDLO5AGC_MASK 'h00000100 -#define RF5G_RF5G1_PDLO5AGC_GET(x) (((x) & RF5G_RF5G1_PDLO5AGC_MASK) >> RF5G_RF5G1_PDLO5AGC_LSB) -#define RF5G_RF5G1_PDLO5AGC_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDLO5AGC_LSB) & RF5G_RF5G1_PDLO5AGC_MASK) -#define RF5G_RF5G1_PDLO5AGC_RESET 1'h0 -#define RF5G_RF5G1_PDREGLO5_MSB 7 -#define RF5G_RF5G1_PDREGLO5_LSB 7 -#define RF5G_RF5G1_PDREGLO5_MASK 'h00000080 -#define RF5G_RF5G1_PDREGLO5_GET(x) (((x) & RF5G_RF5G1_PDREGLO5_MASK) >> RF5G_RF5G1_PDREGLO5_LSB) -#define RF5G_RF5G1_PDREGLO5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDREGLO5_LSB) & RF5G_RF5G1_PDREGLO5_MASK) -#define RF5G_RF5G1_PDREGLO5_RESET 1'h0 -#define RF5G_RF5G1_LO5_ATB_SEL_MSB 6 -#define RF5G_RF5G1_LO5_ATB_SEL_LSB 4 -#define RF5G_RF5G1_LO5_ATB_SEL_MASK 'h00000070 -#define RF5G_RF5G1_LO5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_LO5_ATB_SEL_MASK) >> RF5G_RF5G1_LO5_ATB_SEL_LSB) -#define RF5G_RF5G1_LO5_ATB_SEL_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_LO5_ATB_SEL_LSB) & RF5G_RF5G1_LO5_ATB_SEL_MASK) -#define RF5G_RF5G1_LO5_ATB_SEL_RESET 3'h0 -#define RF5G_RF5G1_LO5CONTROL_MSB 3 -#define RF5G_RF5G1_LO5CONTROL_LSB 3 -#define RF5G_RF5G1_LO5CONTROL_MASK 'h00000008 -#define RF5G_RF5G1_LO5CONTROL_GET(x) (((x) & RF5G_RF5G1_LO5CONTROL_MASK) >> RF5G_RF5G1_LO5CONTROL_LSB) -#define RF5G_RF5G1_LO5CONTROL_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_LO5CONTROL_LSB) & RF5G_RF5G1_LO5CONTROL_MASK) -#define RF5G_RF5G1_LO5CONTROL_RESET 1'h0 -#define RF5G_RF5G1_REGLO_BYPASS5_MSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_LSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_MASK 'h00000004 -#define RF5G_RF5G1_REGLO_BYPASS5_GET(x) (((x) & RF5G_RF5G1_REGLO_BYPASS5_MASK) >> RF5G_RF5G1_REGLO_BYPASS5_LSB) -#define RF5G_RF5G1_REGLO_BYPASS5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_REGLO_BYPASS5_LSB) & RF5G_RF5G1_REGLO_BYPASS5_MASK) -#define RF5G_RF5G1_REGLO_BYPASS5_RESET 1'h0 -#define RF5G_RF5G1_SPARE_MSB 1 -#define RF5G_RF5G1_SPARE_LSB 0 -#define RF5G_RF5G1_SPARE_MASK 'h00000003 -#define RF5G_RF5G1_SPARE_GET(x) (((x) & RF5G_RF5G1_SPARE_MASK) >> RF5G_RF5G1_SPARE_LSB) -#define RF5G_RF5G1_SPARE_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_SPARE_LSB) & RF5G_RF5G1_SPARE_MASK) -#define RF5G_RF5G1_SPARE_RESET 2'h0 -#define RF5G_RF5G1_RESET (32'h0 | \ - RF5G_RF5G1_PDTXLO5_SET(RF5G_RF5G1_PDTXLO5_RESET) | \ - RF5G_RF5G1_PDTXMIX5_SET(RF5G_RF5G1_PDTXMIX5_RESET) | \ - RF5G_RF5G1_PDTXBUF5_SET(RF5G_RF5G1_PDTXBUF5_RESET) | \ - RF5G_RF5G1_PDPADRV5_SET(RF5G_RF5G1_PDPADRV5_RESET) | \ - RF5G_RF5G1_PDPAOUT5_SET(RF5G_RF5G1_PDPAOUT5_RESET) | \ - RF5G_RF5G1_TUNE_PADRV5_SET(RF5G_RF5G1_TUNE_PADRV5_RESET) | \ - RF5G_RF5G1_PWDTXPKD_SET(RF5G_RF5G1_PWDTXPKD_RESET) | \ - RF5G_RF5G1_DB5_SET(RF5G_RF5G1_DB5_RESET) | \ - RF5G_RF5G1_OB5_SET(RF5G_RF5G1_OB5_RESET) | \ - RF5G_RF5G1_TX5_ATB_SEL_SET(RF5G_RF5G1_TX5_ATB_SEL_RESET) | \ - RF5G_RF5G1_PDLO5DIV_SET(RF5G_RF5G1_PDLO5DIV_RESET) | \ - RF5G_RF5G1_PDLO5MIX_SET(RF5G_RF5G1_PDLO5MIX_RESET) | \ - RF5G_RF5G1_PDQBUF5_SET(RF5G_RF5G1_PDQBUF5_RESET) | \ - RF5G_RF5G1_PDLO5AGC_SET(RF5G_RF5G1_PDLO5AGC_RESET) | \ - RF5G_RF5G1_PDREGLO5_SET(RF5G_RF5G1_PDREGLO5_RESET) | \ - RF5G_RF5G1_LO5_ATB_SEL_SET(RF5G_RF5G1_LO5_ATB_SEL_RESET) | \ - RF5G_RF5G1_LO5CONTROL_SET(RF5G_RF5G1_LO5CONTROL_RESET) | \ - RF5G_RF5G1_REGLO_BYPASS5_SET(RF5G_RF5G1_REGLO_BYPASS5_RESET) | \ - RF5G_RF5G1_SPARE_SET(RF5G_RF5G1_SPARE_RESET)) -#define RF5G_RF5G1_HW_MASK (32'h0) -#define RF5G_RF5G1_SW_MASK (32'h0 | \ - RF5G_RF5G1_PDTXLO5_MASK | \ - RF5G_RF5G1_PDTXMIX5_MASK | \ - RF5G_RF5G1_PDTXBUF5_MASK | \ - RF5G_RF5G1_PDPADRV5_MASK | \ - RF5G_RF5G1_PDPAOUT5_MASK | \ - RF5G_RF5G1_TUNE_PADRV5_MASK | \ - RF5G_RF5G1_PWDTXPKD_MASK | \ - RF5G_RF5G1_DB5_MASK | \ - RF5G_RF5G1_OB5_MASK | \ - RF5G_RF5G1_TX5_ATB_SEL_MASK | \ - RF5G_RF5G1_PDLO5DIV_MASK | \ - RF5G_RF5G1_PDLO5MIX_MASK | \ - RF5G_RF5G1_PDQBUF5_MASK | \ - RF5G_RF5G1_PDLO5AGC_MASK | \ - RF5G_RF5G1_PDREGLO5_MASK | \ - RF5G_RF5G1_LO5_ATB_SEL_MASK | \ - RF5G_RF5G1_LO5CONTROL_MASK | \ - RF5G_RF5G1_REGLO_BYPASS5_MASK | \ - RF5G_RF5G1_SPARE_MASK) - -#define RF5G_RF5G2_ADDRESS 'h00000024 -#define RF5G_RF5G2_AGCLO_B_MSB 31 -#define RF5G_RF5G2_AGCLO_B_LSB 29 -#define RF5G_RF5G2_AGCLO_B_MASK 'he0000000 -#define RF5G_RF5G2_AGCLO_B_GET(x) (((x) & RF5G_RF5G2_AGCLO_B_MASK) >> RF5G_RF5G2_AGCLO_B_LSB) -#define RF5G_RF5G2_AGCLO_B_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_AGCLO_B_LSB) & RF5G_RF5G2_AGCLO_B_MASK) -#define RF5G_RF5G2_AGCLO_B_RESET 3'h4 -#define RF5G_RF5G2_RX5_ATB_SEL_MSB 28 -#define RF5G_RF5G2_RX5_ATB_SEL_LSB 26 -#define RF5G_RF5G2_RX5_ATB_SEL_MASK 'h1c000000 -#define RF5G_RF5G2_RX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G2_RX5_ATB_SEL_MASK) >> RF5G_RF5G2_RX5_ATB_SEL_LSB) -#define RF5G_RF5G2_RX5_ATB_SEL_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_RX5_ATB_SEL_LSB) & RF5G_RF5G2_RX5_ATB_SEL_MASK) -#define RF5G_RF5G2_RX5_ATB_SEL_RESET 3'h0 -#define RF5G_RF5G2_PDCMOSLO5_MSB 25 -#define RF5G_RF5G2_PDCMOSLO5_LSB 25 -#define RF5G_RF5G2_PDCMOSLO5_MASK 'h02000000 -#define RF5G_RF5G2_PDCMOSLO5_GET(x) (((x) & RF5G_RF5G2_PDCMOSLO5_MASK) >> RF5G_RF5G2_PDCMOSLO5_LSB) -#define RF5G_RF5G2_PDCMOSLO5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDCMOSLO5_LSB) & RF5G_RF5G2_PDCMOSLO5_MASK) -#define RF5G_RF5G2_PDCMOSLO5_RESET 1'h0 -#define RF5G_RF5G2_PDVGM5_MSB 24 -#define RF5G_RF5G2_PDVGM5_LSB 24 -#define RF5G_RF5G2_PDVGM5_MASK 'h01000000 -#define RF5G_RF5G2_PDVGM5_GET(x) (((x) & RF5G_RF5G2_PDVGM5_MASK) >> RF5G_RF5G2_PDVGM5_LSB) -#define RF5G_RF5G2_PDVGM5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDVGM5_LSB) & RF5G_RF5G2_PDVGM5_MASK) -#define RF5G_RF5G2_PDVGM5_RESET 1'h0 -#define RF5G_RF5G2_PDCSLNA5_MSB 23 -#define RF5G_RF5G2_PDCSLNA5_LSB 23 -#define RF5G_RF5G2_PDCSLNA5_MASK 'h00800000 -#define RF5G_RF5G2_PDCSLNA5_GET(x) (((x) & RF5G_RF5G2_PDCSLNA5_MASK) >> RF5G_RF5G2_PDCSLNA5_LSB) -#define RF5G_RF5G2_PDCSLNA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDCSLNA5_LSB) & RF5G_RF5G2_PDCSLNA5_MASK) -#define RF5G_RF5G2_PDCSLNA5_RESET 1'h0 -#define RF5G_RF5G2_PDRFVGA5_MSB 22 -#define RF5G_RF5G2_PDRFVGA5_LSB 22 -#define RF5G_RF5G2_PDRFVGA5_MASK 'h00400000 -#define RF5G_RF5G2_PDRFVGA5_GET(x) (((x) & RF5G_RF5G2_PDRFVGA5_MASK) >> RF5G_RF5G2_PDRFVGA5_LSB) -#define RF5G_RF5G2_PDRFVGA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDRFVGA5_LSB) & RF5G_RF5G2_PDRFVGA5_MASK) -#define RF5G_RF5G2_PDRFVGA5_RESET 1'h0 -#define RF5G_RF5G2_PDREGFE5_MSB 21 -#define RF5G_RF5G2_PDREGFE5_LSB 21 -#define RF5G_RF5G2_PDREGFE5_MASK 'h00200000 -#define RF5G_RF5G2_PDREGFE5_GET(x) (((x) & RF5G_RF5G2_PDREGFE5_MASK) >> RF5G_RF5G2_PDREGFE5_LSB) -#define RF5G_RF5G2_PDREGFE5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDREGFE5_LSB) & RF5G_RF5G2_PDREGFE5_MASK) -#define RF5G_RF5G2_PDREGFE5_RESET 1'h0 -#define RF5G_RF5G2_TUNE_RFVGA5_MSB 20 -#define RF5G_RF5G2_TUNE_RFVGA5_LSB 18 -#define RF5G_RF5G2_TUNE_RFVGA5_MASK 'h001c0000 -#define RF5G_RF5G2_TUNE_RFVGA5_GET(x) (((x) & RF5G_RF5G2_TUNE_RFVGA5_MASK) >> RF5G_RF5G2_TUNE_RFVGA5_LSB) -#define RF5G_RF5G2_TUNE_RFVGA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_TUNE_RFVGA5_LSB) & RF5G_RF5G2_TUNE_RFVGA5_MASK) -#define RF5G_RF5G2_TUNE_RFVGA5_RESET 3'h0 -#define RF5G_RF5G2_BRFVGA5_MSB 17 -#define RF5G_RF5G2_BRFVGA5_LSB 15 -#define RF5G_RF5G2_BRFVGA5_MASK 'h00038000 -#define RF5G_RF5G2_BRFVGA5_GET(x) (((x) & RF5G_RF5G2_BRFVGA5_MASK) >> RF5G_RF5G2_BRFVGA5_LSB) -#define RF5G_RF5G2_BRFVGA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_BRFVGA5_LSB) & RF5G_RF5G2_BRFVGA5_MASK) -#define RF5G_RF5G2_BRFVGA5_RESET 3'h5 -#define RF5G_RF5G2_BCSLNA5_MSB 14 -#define RF5G_RF5G2_BCSLNA5_LSB 12 -#define RF5G_RF5G2_BCSLNA5_MASK 'h00007000 -#define RF5G_RF5G2_BCSLNA5_GET(x) (((x) & RF5G_RF5G2_BCSLNA5_MASK) >> RF5G_RF5G2_BCSLNA5_LSB) -#define RF5G_RF5G2_BCSLNA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_BCSLNA5_LSB) & RF5G_RF5G2_BCSLNA5_MASK) -#define RF5G_RF5G2_BCSLNA5_RESET 3'h3 -#define RF5G_RF5G2_BVGM5_MSB 11 -#define RF5G_RF5G2_BVGM5_LSB 9 -#define RF5G_RF5G2_BVGM5_MASK 'h00000e00 -#define RF5G_RF5G2_BVGM5_GET(x) (((x) & RF5G_RF5G2_BVGM5_MASK) >> RF5G_RF5G2_BVGM5_LSB) -#define RF5G_RF5G2_BVGM5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_BVGM5_LSB) & RF5G_RF5G2_BVGM5_MASK) -#define RF5G_RF5G2_BVGM5_RESET 3'h1 -#define RF5G_RF5G2_REGFE_BYPASS5_MSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_LSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_MASK 'h00000100 -#define RF5G_RF5G2_REGFE_BYPASS5_GET(x) (((x) & RF5G_RF5G2_REGFE_BYPASS5_MASK) >> RF5G_RF5G2_REGFE_BYPASS5_LSB) -#define RF5G_RF5G2_REGFE_BYPASS5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_REGFE_BYPASS5_LSB) & RF5G_RF5G2_REGFE_BYPASS5_MASK) -#define RF5G_RF5G2_REGFE_BYPASS5_RESET 1'h0 -#define RF5G_RF5G2_LNA5_ATTENMODE_MSB 7 -#define RF5G_RF5G2_LNA5_ATTENMODE_LSB 6 -#define RF5G_RF5G2_LNA5_ATTENMODE_MASK 'h000000c0 -#define RF5G_RF5G2_LNA5_ATTENMODE_GET(x) (((x) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) >> RF5G_RF5G2_LNA5_ATTENMODE_LSB) -#define RF5G_RF5G2_LNA5_ATTENMODE_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_LNA5_ATTENMODE_LSB) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) -#define RF5G_RF5G2_LNA5_ATTENMODE_RESET 2'h0 -#define RF5G_RF5G2_ENABLE_PCA_MSB 5 -#define RF5G_RF5G2_ENABLE_PCA_LSB 5 -#define RF5G_RF5G2_ENABLE_PCA_MASK 'h00000020 -#define RF5G_RF5G2_ENABLE_PCA_GET(x) (((x) & RF5G_RF5G2_ENABLE_PCA_MASK) >> RF5G_RF5G2_ENABLE_PCA_LSB) -#define RF5G_RF5G2_ENABLE_PCA_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_ENABLE_PCA_LSB) & RF5G_RF5G2_ENABLE_PCA_MASK) -#define RF5G_RF5G2_ENABLE_PCA_RESET 1'h0 -#define RF5G_RF5G2_TUNE_LO_MSB 4 -#define RF5G_RF5G2_TUNE_LO_LSB 2 -#define RF5G_RF5G2_TUNE_LO_MASK 'h0000001c -#define RF5G_RF5G2_TUNE_LO_GET(x) (((x) & RF5G_RF5G2_TUNE_LO_MASK) >> RF5G_RF5G2_TUNE_LO_LSB) -#define RF5G_RF5G2_TUNE_LO_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_TUNE_LO_LSB) & RF5G_RF5G2_TUNE_LO_MASK) -#define RF5G_RF5G2_TUNE_LO_RESET 3'h0 -#define RF5G_RF5G2_SPARE_MSB 1 -#define RF5G_RF5G2_SPARE_LSB 0 -#define RF5G_RF5G2_SPARE_MASK 'h00000003 -#define RF5G_RF5G2_SPARE_GET(x) (((x) & RF5G_RF5G2_SPARE_MASK) >> RF5G_RF5G2_SPARE_LSB) -#define RF5G_RF5G2_SPARE_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_SPARE_LSB) & RF5G_RF5G2_SPARE_MASK) -#define RF5G_RF5G2_SPARE_RESET 2'h0 -#define RF5G_RF5G2_RESET (32'h0 | \ - RF5G_RF5G2_AGCLO_B_SET(RF5G_RF5G2_AGCLO_B_RESET) | \ - RF5G_RF5G2_RX5_ATB_SEL_SET(RF5G_RF5G2_RX5_ATB_SEL_RESET) | \ - RF5G_RF5G2_PDCMOSLO5_SET(RF5G_RF5G2_PDCMOSLO5_RESET) | \ - RF5G_RF5G2_PDVGM5_SET(RF5G_RF5G2_PDVGM5_RESET) | \ - RF5G_RF5G2_PDCSLNA5_SET(RF5G_RF5G2_PDCSLNA5_RESET) | \ - RF5G_RF5G2_PDRFVGA5_SET(RF5G_RF5G2_PDRFVGA5_RESET) | \ - RF5G_RF5G2_PDREGFE5_SET(RF5G_RF5G2_PDREGFE5_RESET) | \ - RF5G_RF5G2_TUNE_RFVGA5_SET(RF5G_RF5G2_TUNE_RFVGA5_RESET) | \ - RF5G_RF5G2_BRFVGA5_SET(RF5G_RF5G2_BRFVGA5_RESET) | \ - RF5G_RF5G2_BCSLNA5_SET(RF5G_RF5G2_BCSLNA5_RESET) | \ - RF5G_RF5G2_BVGM5_SET(RF5G_RF5G2_BVGM5_RESET) | \ - RF5G_RF5G2_REGFE_BYPASS5_SET(RF5G_RF5G2_REGFE_BYPASS5_RESET) | \ - RF5G_RF5G2_LNA5_ATTENMODE_SET(RF5G_RF5G2_LNA5_ATTENMODE_RESET) | \ - RF5G_RF5G2_ENABLE_PCA_SET(RF5G_RF5G2_ENABLE_PCA_RESET) | \ - RF5G_RF5G2_TUNE_LO_SET(RF5G_RF5G2_TUNE_LO_RESET) | \ - RF5G_RF5G2_SPARE_SET(RF5G_RF5G2_SPARE_RESET)) -#define RF5G_RF5G2_HW_MASK (32'h0) -#define RF5G_RF5G2_SW_MASK (32'h0 | \ - RF5G_RF5G2_AGCLO_B_MASK | \ - RF5G_RF5G2_RX5_ATB_SEL_MASK | \ - RF5G_RF5G2_PDCMOSLO5_MASK | \ - RF5G_RF5G2_PDVGM5_MASK | \ - RF5G_RF5G2_PDCSLNA5_MASK | \ - RF5G_RF5G2_PDRFVGA5_MASK | \ - RF5G_RF5G2_PDREGFE5_MASK | \ - RF5G_RF5G2_TUNE_RFVGA5_MASK | \ - RF5G_RF5G2_BRFVGA5_MASK | \ - RF5G_RF5G2_BCSLNA5_MASK | \ - RF5G_RF5G2_BVGM5_MASK | \ - RF5G_RF5G2_REGFE_BYPASS5_MASK | \ - RF5G_RF5G2_LNA5_ATTENMODE_MASK | \ - RF5G_RF5G2_ENABLE_PCA_MASK | \ - RF5G_RF5G2_TUNE_LO_MASK | \ - RF5G_RF5G2_SPARE_MASK) - -#define RF2G_RF2G1_ADDRESS 'h00000028 -#define RF2G_RF2G1_BLNA1_MSB 31 -#define RF2G_RF2G1_BLNA1_LSB 29 -#define RF2G_RF2G1_BLNA1_MASK 'he0000000 -#define RF2G_RF2G1_BLNA1_GET(x) (((x) & RF2G_RF2G1_BLNA1_MASK) >> RF2G_RF2G1_BLNA1_LSB) -#define RF2G_RF2G1_BLNA1_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA1_LSB) & RF2G_RF2G1_BLNA1_MASK) -#define RF2G_RF2G1_BLNA1_RESET 3'h3 -#define RF2G_RF2G1_BLNA1F_MSB 28 -#define RF2G_RF2G1_BLNA1F_LSB 26 -#define RF2G_RF2G1_BLNA1F_MASK 'h1c000000 -#define RF2G_RF2G1_BLNA1F_GET(x) (((x) & RF2G_RF2G1_BLNA1F_MASK) >> RF2G_RF2G1_BLNA1F_LSB) -#define RF2G_RF2G1_BLNA1F_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA1F_LSB) & RF2G_RF2G1_BLNA1F_MASK) -#define RF2G_RF2G1_BLNA1F_RESET 3'h0 -#define RF2G_RF2G1_BLNA1BUF_MSB 25 -#define RF2G_RF2G1_BLNA1BUF_LSB 23 -#define RF2G_RF2G1_BLNA1BUF_MASK 'h03800000 -#define RF2G_RF2G1_BLNA1BUF_GET(x) (((x) & RF2G_RF2G1_BLNA1BUF_MASK) >> RF2G_RF2G1_BLNA1BUF_LSB) -#define RF2G_RF2G1_BLNA1BUF_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA1BUF_LSB) & RF2G_RF2G1_BLNA1BUF_MASK) -#define RF2G_RF2G1_BLNA1BUF_RESET 3'h3 -#define RF2G_RF2G1_BLNA2_MSB 22 -#define RF2G_RF2G1_BLNA2_LSB 20 -#define RF2G_RF2G1_BLNA2_MASK 'h00700000 -#define RF2G_RF2G1_BLNA2_GET(x) (((x) & RF2G_RF2G1_BLNA2_MASK) >> RF2G_RF2G1_BLNA2_LSB) -#define RF2G_RF2G1_BLNA2_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA2_LSB) & RF2G_RF2G1_BLNA2_MASK) -#define RF2G_RF2G1_BLNA2_RESET 3'h3 -#define RF2G_RF2G1_DB_MSB 19 -#define RF2G_RF2G1_DB_LSB 17 -#define RF2G_RF2G1_DB_MASK 'h000e0000 -#define RF2G_RF2G1_DB_GET(x) (((x) & RF2G_RF2G1_DB_MASK) >> RF2G_RF2G1_DB_LSB) -#define RF2G_RF2G1_DB_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_DB_LSB) & RF2G_RF2G1_DB_MASK) -#define RF2G_RF2G1_DB_RESET 3'h3 -#define RF2G_RF2G1_OB_MSB 16 -#define RF2G_RF2G1_OB_LSB 14 -#define RF2G_RF2G1_OB_MASK 'h0001c000 -#define RF2G_RF2G1_OB_GET(x) (((x) & RF2G_RF2G1_OB_MASK) >> RF2G_RF2G1_OB_LSB) -#define RF2G_RF2G1_OB_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_OB_LSB) & RF2G_RF2G1_OB_MASK) -#define RF2G_RF2G1_OB_RESET 3'h3 -#define RF2G_RF2G1_FE_ATB_SEL_MSB 13 -#define RF2G_RF2G1_FE_ATB_SEL_LSB 11 -#define RF2G_RF2G1_FE_ATB_SEL_MASK 'h00003800 -#define RF2G_RF2G1_FE_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_FE_ATB_SEL_MASK) >> RF2G_RF2G1_FE_ATB_SEL_LSB) -#define RF2G_RF2G1_FE_ATB_SEL_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_FE_ATB_SEL_LSB) & RF2G_RF2G1_FE_ATB_SEL_MASK) -#define RF2G_RF2G1_FE_ATB_SEL_RESET 3'h0 -#define RF2G_RF2G1_RF_ATB_SEL_MSB 10 -#define RF2G_RF2G1_RF_ATB_SEL_LSB 8 -#define RF2G_RF2G1_RF_ATB_SEL_MASK 'h00000700 -#define RF2G_RF2G1_RF_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_RF_ATB_SEL_MASK) >> RF2G_RF2G1_RF_ATB_SEL_LSB) -#define RF2G_RF2G1_RF_ATB_SEL_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_RF_ATB_SEL_LSB) & RF2G_RF2G1_RF_ATB_SEL_MASK) -#define RF2G_RF2G1_RF_ATB_SEL_RESET 3'h0 -#define RF2G_RF2G1_SELLNA_MSB 7 -#define RF2G_RF2G1_SELLNA_LSB 7 -#define RF2G_RF2G1_SELLNA_MASK 'h00000080 -#define RF2G_RF2G1_SELLNA_GET(x) (((x) & RF2G_RF2G1_SELLNA_MASK) >> RF2G_RF2G1_SELLNA_LSB) -#define RF2G_RF2G1_SELLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_SELLNA_LSB) & RF2G_RF2G1_SELLNA_MASK) -#define RF2G_RF2G1_SELLNA_RESET 1'h1 -#define RF2G_RF2G1_LOCONTROL_MSB 6 -#define RF2G_RF2G1_LOCONTROL_LSB 6 -#define RF2G_RF2G1_LOCONTROL_MASK 'h00000040 -#define RF2G_RF2G1_LOCONTROL_GET(x) (((x) & RF2G_RF2G1_LOCONTROL_MASK) >> RF2G_RF2G1_LOCONTROL_LSB) -#define RF2G_RF2G1_LOCONTROL_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_LOCONTROL_LSB) & RF2G_RF2G1_LOCONTROL_MASK) -#define RF2G_RF2G1_LOCONTROL_RESET 1'h0 -#define RF2G_RF2G1_SHORTLNA2_MSB 5 -#define RF2G_RF2G1_SHORTLNA2_LSB 5 -#define RF2G_RF2G1_SHORTLNA2_MASK 'h00000020 -#define RF2G_RF2G1_SHORTLNA2_GET(x) (((x) & RF2G_RF2G1_SHORTLNA2_MASK) >> RF2G_RF2G1_SHORTLNA2_LSB) -#define RF2G_RF2G1_SHORTLNA2_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_SHORTLNA2_LSB) & RF2G_RF2G1_SHORTLNA2_MASK) -#define RF2G_RF2G1_SHORTLNA2_RESET 1'h0 -#define RF2G_RF2G1_SPARE_MSB 4 -#define RF2G_RF2G1_SPARE_LSB 0 -#define RF2G_RF2G1_SPARE_MASK 'h0000001f -#define RF2G_RF2G1_SPARE_GET(x) (((x) & RF2G_RF2G1_SPARE_MASK) >> RF2G_RF2G1_SPARE_LSB) -#define RF2G_RF2G1_SPARE_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_SPARE_LSB) & RF2G_RF2G1_SPARE_MASK) -#define RF2G_RF2G1_SPARE_RESET 5'h0 -#define RF2G_RF2G1_RESET (32'h0 | \ - RF2G_RF2G1_BLNA1_SET(RF2G_RF2G1_BLNA1_RESET) | \ - RF2G_RF2G1_BLNA1F_SET(RF2G_RF2G1_BLNA1F_RESET) | \ - RF2G_RF2G1_BLNA1BUF_SET(RF2G_RF2G1_BLNA1BUF_RESET) | \ - RF2G_RF2G1_BLNA2_SET(RF2G_RF2G1_BLNA2_RESET) | \ - RF2G_RF2G1_DB_SET(RF2G_RF2G1_DB_RESET) | \ - RF2G_RF2G1_OB_SET(RF2G_RF2G1_OB_RESET) | \ - RF2G_RF2G1_FE_ATB_SEL_SET(RF2G_RF2G1_FE_ATB_SEL_RESET) | \ - RF2G_RF2G1_RF_ATB_SEL_SET(RF2G_RF2G1_RF_ATB_SEL_RESET) | \ - RF2G_RF2G1_SELLNA_SET(RF2G_RF2G1_SELLNA_RESET) | \ - RF2G_RF2G1_LOCONTROL_SET(RF2G_RF2G1_LOCONTROL_RESET) | \ - RF2G_RF2G1_SHORTLNA2_SET(RF2G_RF2G1_SHORTLNA2_RESET) | \ - RF2G_RF2G1_SPARE_SET(RF2G_RF2G1_SPARE_RESET)) -#define RF2G_RF2G1_HW_MASK (32'h0) -#define RF2G_RF2G1_SW_MASK (32'h0 | \ - RF2G_RF2G1_BLNA1_MASK | \ - RF2G_RF2G1_BLNA1F_MASK | \ - RF2G_RF2G1_BLNA1BUF_MASK | \ - RF2G_RF2G1_BLNA2_MASK | \ - RF2G_RF2G1_DB_MASK | \ - RF2G_RF2G1_OB_MASK | \ - RF2G_RF2G1_FE_ATB_SEL_MASK | \ - RF2G_RF2G1_RF_ATB_SEL_MASK | \ - RF2G_RF2G1_SELLNA_MASK | \ - RF2G_RF2G1_LOCONTROL_MASK | \ - RF2G_RF2G1_SHORTLNA2_MASK | \ - RF2G_RF2G1_SPARE_MASK) - -#define RF2G_RF2G2_ADDRESS 'h0000002c -#define RF2G_RF2G2_PDCGLNA_MSB 31 -#define RF2G_RF2G2_PDCGLNA_LSB 31 -#define RF2G_RF2G2_PDCGLNA_MASK 'h80000000 -#define RF2G_RF2G2_PDCGLNA_GET(x) (((x) & RF2G_RF2G2_PDCGLNA_MASK) >> RF2G_RF2G2_PDCGLNA_LSB) -#define RF2G_RF2G2_PDCGLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDCGLNA_LSB) & RF2G_RF2G2_PDCGLNA_MASK) -#define RF2G_RF2G2_PDCGLNA_RESET 1'h0 -#define RF2G_RF2G2_PDCGLNABUF_MSB 30 -#define RF2G_RF2G2_PDCGLNABUF_LSB 30 -#define RF2G_RF2G2_PDCGLNABUF_MASK 'h40000000 -#define RF2G_RF2G2_PDCGLNABUF_GET(x) (((x) & RF2G_RF2G2_PDCGLNABUF_MASK) >> RF2G_RF2G2_PDCGLNABUF_LSB) -#define RF2G_RF2G2_PDCGLNABUF_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDCGLNABUF_LSB) & RF2G_RF2G2_PDCGLNABUF_MASK) -#define RF2G_RF2G2_PDCGLNABUF_RESET 1'h0 -#define RF2G_RF2G2_PDCSLNA_MSB 29 -#define RF2G_RF2G2_PDCSLNA_LSB 29 -#define RF2G_RF2G2_PDCSLNA_MASK 'h20000000 -#define RF2G_RF2G2_PDCSLNA_GET(x) (((x) & RF2G_RF2G2_PDCSLNA_MASK) >> RF2G_RF2G2_PDCSLNA_LSB) -#define RF2G_RF2G2_PDCSLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDCSLNA_LSB) & RF2G_RF2G2_PDCSLNA_MASK) -#define RF2G_RF2G2_PDCSLNA_RESET 1'h0 -#define RF2G_RF2G2_PDDIV_MSB 28 -#define RF2G_RF2G2_PDDIV_LSB 28 -#define RF2G_RF2G2_PDDIV_MASK 'h10000000 -#define RF2G_RF2G2_PDDIV_GET(x) (((x) & RF2G_RF2G2_PDDIV_MASK) >> RF2G_RF2G2_PDDIV_LSB) -#define RF2G_RF2G2_PDDIV_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDDIV_LSB) & RF2G_RF2G2_PDDIV_MASK) -#define RF2G_RF2G2_PDDIV_RESET 1'h0 -#define RF2G_RF2G2_PDPADRV_MSB 27 -#define RF2G_RF2G2_PDPADRV_LSB 27 -#define RF2G_RF2G2_PDPADRV_MASK 'h08000000 -#define RF2G_RF2G2_PDPADRV_GET(x) (((x) & RF2G_RF2G2_PDPADRV_MASK) >> RF2G_RF2G2_PDPADRV_LSB) -#define RF2G_RF2G2_PDPADRV_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDPADRV_LSB) & RF2G_RF2G2_PDPADRV_MASK) -#define RF2G_RF2G2_PDPADRV_RESET 1'h0 -#define RF2G_RF2G2_PDPAOUT_MSB 26 -#define RF2G_RF2G2_PDPAOUT_LSB 26 -#define RF2G_RF2G2_PDPAOUT_MASK 'h04000000 -#define RF2G_RF2G2_PDPAOUT_GET(x) (((x) & RF2G_RF2G2_PDPAOUT_MASK) >> RF2G_RF2G2_PDPAOUT_LSB) -#define RF2G_RF2G2_PDPAOUT_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDPAOUT_LSB) & RF2G_RF2G2_PDPAOUT_MASK) -#define RF2G_RF2G2_PDPAOUT_RESET 1'h0 -#define RF2G_RF2G2_PDREGLNA_MSB 25 -#define RF2G_RF2G2_PDREGLNA_LSB 25 -#define RF2G_RF2G2_PDREGLNA_MASK 'h02000000 -#define RF2G_RF2G2_PDREGLNA_GET(x) (((x) & RF2G_RF2G2_PDREGLNA_MASK) >> RF2G_RF2G2_PDREGLNA_LSB) -#define RF2G_RF2G2_PDREGLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDREGLNA_LSB) & RF2G_RF2G2_PDREGLNA_MASK) -#define RF2G_RF2G2_PDREGLNA_RESET 1'h0 -#define RF2G_RF2G2_PDREGLO_MSB 24 -#define RF2G_RF2G2_PDREGLO_LSB 24 -#define RF2G_RF2G2_PDREGLO_MASK 'h01000000 -#define RF2G_RF2G2_PDREGLO_GET(x) (((x) & RF2G_RF2G2_PDREGLO_MASK) >> RF2G_RF2G2_PDREGLO_LSB) -#define RF2G_RF2G2_PDREGLO_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDREGLO_LSB) & RF2G_RF2G2_PDREGLO_MASK) -#define RF2G_RF2G2_PDREGLO_RESET 1'h0 -#define RF2G_RF2G2_PDRFGM_MSB 23 -#define RF2G_RF2G2_PDRFGM_LSB 23 -#define RF2G_RF2G2_PDRFGM_MASK 'h00800000 -#define RF2G_RF2G2_PDRFGM_GET(x) (((x) & RF2G_RF2G2_PDRFGM_MASK) >> RF2G_RF2G2_PDRFGM_LSB) -#define RF2G_RF2G2_PDRFGM_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDRFGM_LSB) & RF2G_RF2G2_PDRFGM_MASK) -#define RF2G_RF2G2_PDRFGM_RESET 1'h0 -#define RF2G_RF2G2_PDRXLO_MSB 22 -#define RF2G_RF2G2_PDRXLO_LSB 22 -#define RF2G_RF2G2_PDRXLO_MASK 'h00400000 -#define RF2G_RF2G2_PDRXLO_GET(x) (((x) & RF2G_RF2G2_PDRXLO_MASK) >> RF2G_RF2G2_PDRXLO_LSB) -#define RF2G_RF2G2_PDRXLO_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDRXLO_LSB) & RF2G_RF2G2_PDRXLO_MASK) -#define RF2G_RF2G2_PDRXLO_RESET 1'h0 -#define RF2G_RF2G2_PDTXLO_MSB 21 -#define RF2G_RF2G2_PDTXLO_LSB 21 -#define RF2G_RF2G2_PDTXLO_MASK 'h00200000 -#define RF2G_RF2G2_PDTXLO_GET(x) (((x) & RF2G_RF2G2_PDTXLO_MASK) >> RF2G_RF2G2_PDTXLO_LSB) -#define RF2G_RF2G2_PDTXLO_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDTXLO_LSB) & RF2G_RF2G2_PDTXLO_MASK) -#define RF2G_RF2G2_PDTXLO_RESET 1'h0 -#define RF2G_RF2G2_PDTXMIX_MSB 20 -#define RF2G_RF2G2_PDTXMIX_LSB 20 -#define RF2G_RF2G2_PDTXMIX_MASK 'h00100000 -#define RF2G_RF2G2_PDTXMIX_GET(x) (((x) & RF2G_RF2G2_PDTXMIX_MASK) >> RF2G_RF2G2_PDTXMIX_LSB) -#define RF2G_RF2G2_PDTXMIX_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDTXMIX_LSB) & RF2G_RF2G2_PDTXMIX_MASK) -#define RF2G_RF2G2_PDTXMIX_RESET 1'h0 -#define RF2G_RF2G2_REGLNA_BYPASS_MSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_LSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_MASK 'h00080000 -#define RF2G_RF2G2_REGLNA_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLNA_BYPASS_MASK) >> RF2G_RF2G2_REGLNA_BYPASS_LSB) -#define RF2G_RF2G2_REGLNA_BYPASS_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_REGLNA_BYPASS_LSB) & RF2G_RF2G2_REGLNA_BYPASS_MASK) -#define RF2G_RF2G2_REGLNA_BYPASS_RESET 1'h0 -#define RF2G_RF2G2_REGLO_BYPASS_MSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_LSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_MASK 'h00040000 -#define RF2G_RF2G2_REGLO_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLO_BYPASS_MASK) >> RF2G_RF2G2_REGLO_BYPASS_LSB) -#define RF2G_RF2G2_REGLO_BYPASS_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_REGLO_BYPASS_LSB) & RF2G_RF2G2_REGLO_BYPASS_MASK) -#define RF2G_RF2G2_REGLO_BYPASS_RESET 1'h0 -#define RF2G_RF2G2_ENABLE_PCB_MSB 17 -#define RF2G_RF2G2_ENABLE_PCB_LSB 17 -#define RF2G_RF2G2_ENABLE_PCB_MASK 'h00020000 -#define RF2G_RF2G2_ENABLE_PCB_GET(x) (((x) & RF2G_RF2G2_ENABLE_PCB_MASK) >> RF2G_RF2G2_ENABLE_PCB_LSB) -#define RF2G_RF2G2_ENABLE_PCB_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_ENABLE_PCB_LSB) & RF2G_RF2G2_ENABLE_PCB_MASK) -#define RF2G_RF2G2_ENABLE_PCB_RESET 1'h0 -#define RF2G_RF2G2_SPARE_MSB 16 -#define RF2G_RF2G2_SPARE_LSB 0 -#define RF2G_RF2G2_SPARE_MASK 'h0001ffff -#define RF2G_RF2G2_SPARE_GET(x) (((x) & RF2G_RF2G2_SPARE_MASK) >> RF2G_RF2G2_SPARE_LSB) -#define RF2G_RF2G2_SPARE_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_SPARE_LSB) & RF2G_RF2G2_SPARE_MASK) -#define RF2G_RF2G2_SPARE_RESET 17'h0 -#define RF2G_RF2G2_RESET (32'h0 | \ - RF2G_RF2G2_PDCGLNA_SET(RF2G_RF2G2_PDCGLNA_RESET) | \ - RF2G_RF2G2_PDCGLNABUF_SET(RF2G_RF2G2_PDCGLNABUF_RESET) | \ - RF2G_RF2G2_PDCSLNA_SET(RF2G_RF2G2_PDCSLNA_RESET) | \ - RF2G_RF2G2_PDDIV_SET(RF2G_RF2G2_PDDIV_RESET) | \ - RF2G_RF2G2_PDPADRV_SET(RF2G_RF2G2_PDPADRV_RESET) | \ - RF2G_RF2G2_PDPAOUT_SET(RF2G_RF2G2_PDPAOUT_RESET) | \ - RF2G_RF2G2_PDREGLNA_SET(RF2G_RF2G2_PDREGLNA_RESET) | \ - RF2G_RF2G2_PDREGLO_SET(RF2G_RF2G2_PDREGLO_RESET) | \ - RF2G_RF2G2_PDRFGM_SET(RF2G_RF2G2_PDRFGM_RESET) | \ - RF2G_RF2G2_PDRXLO_SET(RF2G_RF2G2_PDRXLO_RESET) | \ - RF2G_RF2G2_PDTXLO_SET(RF2G_RF2G2_PDTXLO_RESET) | \ - RF2G_RF2G2_PDTXMIX_SET(RF2G_RF2G2_PDTXMIX_RESET) | \ - RF2G_RF2G2_REGLNA_BYPASS_SET(RF2G_RF2G2_REGLNA_BYPASS_RESET) | \ - RF2G_RF2G2_REGLO_BYPASS_SET(RF2G_RF2G2_REGLO_BYPASS_RESET) | \ - RF2G_RF2G2_ENABLE_PCB_SET(RF2G_RF2G2_ENABLE_PCB_RESET) | \ - RF2G_RF2G2_SPARE_SET(RF2G_RF2G2_SPARE_RESET)) -#define RF2G_RF2G2_HW_MASK (32'h0) -#define RF2G_RF2G2_SW_MASK (32'h0 | \ - RF2G_RF2G2_PDCGLNA_MASK | \ - RF2G_RF2G2_PDCGLNABUF_MASK | \ - RF2G_RF2G2_PDCSLNA_MASK | \ - RF2G_RF2G2_PDDIV_MASK | \ - RF2G_RF2G2_PDPADRV_MASK | \ - RF2G_RF2G2_PDPAOUT_MASK | \ - RF2G_RF2G2_PDREGLNA_MASK | \ - RF2G_RF2G2_PDREGLO_MASK | \ - RF2G_RF2G2_PDRFGM_MASK | \ - RF2G_RF2G2_PDRXLO_MASK | \ - RF2G_RF2G2_PDTXLO_MASK | \ - RF2G_RF2G2_PDTXMIX_MASK | \ - RF2G_RF2G2_REGLNA_BYPASS_MASK | \ - RF2G_RF2G2_REGLO_BYPASS_MASK | \ - RF2G_RF2G2_ENABLE_PCB_MASK | \ - RF2G_RF2G2_SPARE_MASK) - -#define TOP_GAIN_ADDRESS 'h00000030 -#define TOP_GAIN_TX6DBLOQGAIN_MSB 31 -#define TOP_GAIN_TX6DBLOQGAIN_LSB 30 -#define TOP_GAIN_TX6DBLOQGAIN_MASK 'hc0000000 -#define TOP_GAIN_TX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX6DBLOQGAIN_MASK) >> TOP_GAIN_TX6DBLOQGAIN_LSB) -#define TOP_GAIN_TX6DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_TX6DBLOQGAIN_LSB) & TOP_GAIN_TX6DBLOQGAIN_MASK) -#define TOP_GAIN_TX6DBLOQGAIN_RESET 2'h3 -#define TOP_GAIN_TX1DBLOQGAIN_MSB 29 -#define TOP_GAIN_TX1DBLOQGAIN_LSB 27 -#define TOP_GAIN_TX1DBLOQGAIN_MASK 'h38000000 -#define TOP_GAIN_TX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX1DBLOQGAIN_MASK) >> TOP_GAIN_TX1DBLOQGAIN_LSB) -#define TOP_GAIN_TX1DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_TX1DBLOQGAIN_LSB) & TOP_GAIN_TX1DBLOQGAIN_MASK) -#define TOP_GAIN_TX1DBLOQGAIN_RESET 3'h6 -#define TOP_GAIN_TXV2IGAIN_MSB 26 -#define TOP_GAIN_TXV2IGAIN_LSB 25 -#define TOP_GAIN_TXV2IGAIN_MASK 'h06000000 -#define TOP_GAIN_TXV2IGAIN_GET(x) (((x) & TOP_GAIN_TXV2IGAIN_MASK) >> TOP_GAIN_TXV2IGAIN_LSB) -#define TOP_GAIN_TXV2IGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_TXV2IGAIN_LSB) & TOP_GAIN_TXV2IGAIN_MASK) -#define TOP_GAIN_TXV2IGAIN_RESET 2'h3 -#define TOP_GAIN_PABUF5GN_MSB 24 -#define TOP_GAIN_PABUF5GN_LSB 24 -#define TOP_GAIN_PABUF5GN_MASK 'h01000000 -#define TOP_GAIN_PABUF5GN_GET(x) (((x) & TOP_GAIN_PABUF5GN_MASK) >> TOP_GAIN_PABUF5GN_LSB) -#define TOP_GAIN_PABUF5GN_SET(x) (((32'd0 | (x)) << TOP_GAIN_PABUF5GN_LSB) & TOP_GAIN_PABUF5GN_MASK) -#define TOP_GAIN_PABUF5GN_RESET 1'h1 -#define TOP_GAIN_PADRVGN_MSB 23 -#define TOP_GAIN_PADRVGN_LSB 21 -#define TOP_GAIN_PADRVGN_MASK 'h00e00000 -#define TOP_GAIN_PADRVGN_GET(x) (((x) & TOP_GAIN_PADRVGN_MASK) >> TOP_GAIN_PADRVGN_LSB) -#define TOP_GAIN_PADRVGN_SET(x) (((32'd0 | (x)) << TOP_GAIN_PADRVGN_LSB) & TOP_GAIN_PADRVGN_MASK) -#define TOP_GAIN_PADRVGN_RESET 3'h7 -#define TOP_GAIN_PAOUT2GN_MSB 20 -#define TOP_GAIN_PAOUT2GN_LSB 18 -#define TOP_GAIN_PAOUT2GN_MASK 'h001c0000 -#define TOP_GAIN_PAOUT2GN_GET(x) (((x) & TOP_GAIN_PAOUT2GN_MASK) >> TOP_GAIN_PAOUT2GN_LSB) -#define TOP_GAIN_PAOUT2GN_SET(x) (((32'd0 | (x)) << TOP_GAIN_PAOUT2GN_LSB) & TOP_GAIN_PAOUT2GN_MASK) -#define TOP_GAIN_PAOUT2GN_RESET 3'h7 -#define TOP_GAIN_LNAON_MSB 17 -#define TOP_GAIN_LNAON_LSB 17 -#define TOP_GAIN_LNAON_MASK 'h00020000 -#define TOP_GAIN_LNAON_GET(x) (((x) & TOP_GAIN_LNAON_MASK) >> TOP_GAIN_LNAON_LSB) -#define TOP_GAIN_LNAON_SET(x) (((32'd0 | (x)) << TOP_GAIN_LNAON_LSB) & TOP_GAIN_LNAON_MASK) -#define TOP_GAIN_LNAON_RESET 1'h1 -#define TOP_GAIN_LNAGAIN_MSB 16 -#define TOP_GAIN_LNAGAIN_LSB 13 -#define TOP_GAIN_LNAGAIN_MASK 'h0001e000 -#define TOP_GAIN_LNAGAIN_GET(x) (((x) & TOP_GAIN_LNAGAIN_MASK) >> TOP_GAIN_LNAGAIN_LSB) -#define TOP_GAIN_LNAGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_LNAGAIN_LSB) & TOP_GAIN_LNAGAIN_MASK) -#define TOP_GAIN_LNAGAIN_RESET 4'hf -#define TOP_GAIN_RFVGA5GAIN_MSB 12 -#define TOP_GAIN_RFVGA5GAIN_LSB 11 -#define TOP_GAIN_RFVGA5GAIN_MASK 'h00001800 -#define TOP_GAIN_RFVGA5GAIN_GET(x) (((x) & TOP_GAIN_RFVGA5GAIN_MASK) >> TOP_GAIN_RFVGA5GAIN_LSB) -#define TOP_GAIN_RFVGA5GAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RFVGA5GAIN_LSB) & TOP_GAIN_RFVGA5GAIN_MASK) -#define TOP_GAIN_RFVGA5GAIN_RESET 2'h3 -#define TOP_GAIN_RFGMGN_MSB 10 -#define TOP_GAIN_RFGMGN_LSB 8 -#define TOP_GAIN_RFGMGN_MASK 'h00000700 -#define TOP_GAIN_RFGMGN_GET(x) (((x) & TOP_GAIN_RFGMGN_MASK) >> TOP_GAIN_RFGMGN_LSB) -#define TOP_GAIN_RFGMGN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RFGMGN_LSB) & TOP_GAIN_RFGMGN_MASK) -#define TOP_GAIN_RFGMGN_RESET 3'h7 -#define TOP_GAIN_RX6DBLOQGAIN_MSB 7 -#define TOP_GAIN_RX6DBLOQGAIN_LSB 6 -#define TOP_GAIN_RX6DBLOQGAIN_MASK 'h000000c0 -#define TOP_GAIN_RX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBLOQGAIN_MASK) >> TOP_GAIN_RX6DBLOQGAIN_LSB) -#define TOP_GAIN_RX6DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RX6DBLOQGAIN_LSB) & TOP_GAIN_RX6DBLOQGAIN_MASK) -#define TOP_GAIN_RX6DBLOQGAIN_RESET 2'h3 -#define TOP_GAIN_RX1DBLOQGAIN_MSB 5 -#define TOP_GAIN_RX1DBLOQGAIN_LSB 3 -#define TOP_GAIN_RX1DBLOQGAIN_MASK 'h00000038 -#define TOP_GAIN_RX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX1DBLOQGAIN_MASK) >> TOP_GAIN_RX1DBLOQGAIN_LSB) -#define TOP_GAIN_RX1DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RX1DBLOQGAIN_LSB) & TOP_GAIN_RX1DBLOQGAIN_MASK) -#define TOP_GAIN_RX1DBLOQGAIN_RESET 3'h6 -#define TOP_GAIN_RX6DBHIQGAIN_MSB 2 -#define TOP_GAIN_RX6DBHIQGAIN_LSB 1 -#define TOP_GAIN_RX6DBHIQGAIN_MASK 'h00000006 -#define TOP_GAIN_RX6DBHIQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBHIQGAIN_MASK) >> TOP_GAIN_RX6DBHIQGAIN_LSB) -#define TOP_GAIN_RX6DBHIQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RX6DBHIQGAIN_LSB) & TOP_GAIN_RX6DBHIQGAIN_MASK) -#define TOP_GAIN_RX6DBHIQGAIN_RESET 2'h3 -#define TOP_GAIN_SPARE_MSB 0 -#define TOP_GAIN_SPARE_LSB 0 -#define TOP_GAIN_SPARE_MASK 'h00000001 -#define TOP_GAIN_SPARE_GET(x) (((x) & TOP_GAIN_SPARE_MASK) >> TOP_GAIN_SPARE_LSB) -#define TOP_GAIN_SPARE_SET(x) (((32'd0 | (x)) << TOP_GAIN_SPARE_LSB) & TOP_GAIN_SPARE_MASK) -#define TOP_GAIN_SPARE_RESET 1'h0 -#define TOP_GAIN_RESET (32'h0 | \ - TOP_GAIN_TX6DBLOQGAIN_SET(TOP_GAIN_TX6DBLOQGAIN_RESET) | \ - TOP_GAIN_TX1DBLOQGAIN_SET(TOP_GAIN_TX1DBLOQGAIN_RESET) | \ - TOP_GAIN_TXV2IGAIN_SET(TOP_GAIN_TXV2IGAIN_RESET) | \ - TOP_GAIN_PABUF5GN_SET(TOP_GAIN_PABUF5GN_RESET) | \ - TOP_GAIN_PADRVGN_SET(TOP_GAIN_PADRVGN_RESET) | \ - TOP_GAIN_PAOUT2GN_SET(TOP_GAIN_PAOUT2GN_RESET) | \ - TOP_GAIN_LNAON_SET(TOP_GAIN_LNAON_RESET) | \ - TOP_GAIN_LNAGAIN_SET(TOP_GAIN_LNAGAIN_RESET) | \ - TOP_GAIN_RFVGA5GAIN_SET(TOP_GAIN_RFVGA5GAIN_RESET) | \ - TOP_GAIN_RFGMGN_SET(TOP_GAIN_RFGMGN_RESET) | \ - TOP_GAIN_RX6DBLOQGAIN_SET(TOP_GAIN_RX6DBLOQGAIN_RESET) | \ - TOP_GAIN_RX1DBLOQGAIN_SET(TOP_GAIN_RX1DBLOQGAIN_RESET) | \ - TOP_GAIN_RX6DBHIQGAIN_SET(TOP_GAIN_RX6DBHIQGAIN_RESET) | \ - TOP_GAIN_SPARE_SET(TOP_GAIN_SPARE_RESET)) -#define TOP_GAIN_HW_MASK (32'h0 | \ - TOP_GAIN_TX6DBLOQGAIN_MASK | \ - TOP_GAIN_TX1DBLOQGAIN_MASK | \ - TOP_GAIN_TXV2IGAIN_MASK | \ - TOP_GAIN_PABUF5GN_MASK | \ - TOP_GAIN_PADRVGN_MASK | \ - TOP_GAIN_PAOUT2GN_MASK | \ - TOP_GAIN_LNAON_MASK | \ - TOP_GAIN_LNAGAIN_MASK | \ - TOP_GAIN_RFVGA5GAIN_MASK | \ - TOP_GAIN_RFGMGN_MASK | \ - TOP_GAIN_RX6DBLOQGAIN_MASK | \ - TOP_GAIN_RX1DBLOQGAIN_MASK | \ - TOP_GAIN_RX6DBHIQGAIN_MASK | \ - TOP_GAIN_SPARE_MASK) -#define TOP_GAIN_SW_MASK (32'h0 | \ - TOP_GAIN_TX6DBLOQGAIN_MASK | \ - TOP_GAIN_TX1DBLOQGAIN_MASK | \ - TOP_GAIN_TXV2IGAIN_MASK | \ - TOP_GAIN_PABUF5GN_MASK | \ - TOP_GAIN_PADRVGN_MASK | \ - TOP_GAIN_PAOUT2GN_MASK | \ - TOP_GAIN_LNAON_MASK | \ - TOP_GAIN_LNAGAIN_MASK | \ - TOP_GAIN_RFVGA5GAIN_MASK | \ - TOP_GAIN_RFGMGN_MASK | \ - TOP_GAIN_RX6DBLOQGAIN_MASK | \ - TOP_GAIN_RX1DBLOQGAIN_MASK | \ - TOP_GAIN_RX6DBHIQGAIN_MASK | \ - TOP_GAIN_SPARE_MASK) - -#define TOP_TOP_ADDRESS 'h00000034 -#define TOP_TOP_LOCALTXGAIN_MSB 31 -#define TOP_TOP_LOCALTXGAIN_LSB 31 -#define TOP_TOP_LOCALTXGAIN_MASK 'h80000000 -#define TOP_TOP_LOCALTXGAIN_GET(x) (((x) & TOP_TOP_LOCALTXGAIN_MASK) >> TOP_TOP_LOCALTXGAIN_LSB) -#define TOP_TOP_LOCALTXGAIN_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALTXGAIN_LSB) & TOP_TOP_LOCALTXGAIN_MASK) -#define TOP_TOP_LOCALTXGAIN_RESET 1'h0 -#define TOP_TOP_LOCALRXGAIN_MSB 30 -#define TOP_TOP_LOCALRXGAIN_LSB 30 -#define TOP_TOP_LOCALRXGAIN_MASK 'h40000000 -#define TOP_TOP_LOCALRXGAIN_GET(x) (((x) & TOP_TOP_LOCALRXGAIN_MASK) >> TOP_TOP_LOCALRXGAIN_LSB) -#define TOP_TOP_LOCALRXGAIN_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALRXGAIN_LSB) & TOP_TOP_LOCALRXGAIN_MASK) -#define TOP_TOP_LOCALRXGAIN_RESET 1'h0 -#define TOP_TOP_LOCALMODE_MSB 29 -#define TOP_TOP_LOCALMODE_LSB 29 -#define TOP_TOP_LOCALMODE_MASK 'h20000000 -#define TOP_TOP_LOCALMODE_GET(x) (((x) & TOP_TOP_LOCALMODE_MASK) >> TOP_TOP_LOCALMODE_LSB) -#define TOP_TOP_LOCALMODE_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALMODE_LSB) & TOP_TOP_LOCALMODE_MASK) -#define TOP_TOP_LOCALMODE_RESET 1'h0 -#define TOP_TOP_CALFC_MSB 28 -#define TOP_TOP_CALFC_LSB 28 -#define TOP_TOP_CALFC_MASK 'h10000000 -#define TOP_TOP_CALFC_GET(x) (((x) & TOP_TOP_CALFC_MASK) >> TOP_TOP_CALFC_LSB) -#define TOP_TOP_CALFC_SET(x) (((32'd0 | (x)) << TOP_TOP_CALFC_LSB) & TOP_TOP_CALFC_MASK) -#define TOP_TOP_CALFC_RESET 1'h0 -#define TOP_TOP_CALDC_MSB 27 -#define TOP_TOP_CALDC_LSB 27 -#define TOP_TOP_CALDC_MASK 'h08000000 -#define TOP_TOP_CALDC_GET(x) (((x) & TOP_TOP_CALDC_MASK) >> TOP_TOP_CALDC_LSB) -#define TOP_TOP_CALDC_SET(x) (((32'd0 | (x)) << TOP_TOP_CALDC_LSB) & TOP_TOP_CALDC_MASK) -#define TOP_TOP_CALDC_RESET 1'h0 -#define TOP_TOP_CAL_RESIDUE_MSB 26 -#define TOP_TOP_CAL_RESIDUE_LSB 26 -#define TOP_TOP_CAL_RESIDUE_MASK 'h04000000 -#define TOP_TOP_CAL_RESIDUE_GET(x) (((x) & TOP_TOP_CAL_RESIDUE_MASK) >> TOP_TOP_CAL_RESIDUE_LSB) -#define TOP_TOP_CAL_RESIDUE_SET(x) (((32'd0 | (x)) << TOP_TOP_CAL_RESIDUE_LSB) & TOP_TOP_CAL_RESIDUE_MASK) -#define TOP_TOP_CAL_RESIDUE_RESET 1'h0 -#define TOP_TOP_BMODE_MSB 25 -#define TOP_TOP_BMODE_LSB 25 -#define TOP_TOP_BMODE_MASK 'h02000000 -#define TOP_TOP_BMODE_GET(x) (((x) & TOP_TOP_BMODE_MASK) >> TOP_TOP_BMODE_LSB) -#define TOP_TOP_BMODE_SET(x) (((32'd0 | (x)) << TOP_TOP_BMODE_LSB) & TOP_TOP_BMODE_MASK) -#define TOP_TOP_BMODE_RESET 1'h1 -#define TOP_TOP_SYNTHON_MSB 24 -#define TOP_TOP_SYNTHON_LSB 24 -#define TOP_TOP_SYNTHON_MASK 'h01000000 -#define TOP_TOP_SYNTHON_GET(x) (((x) & TOP_TOP_SYNTHON_MASK) >> TOP_TOP_SYNTHON_LSB) -#define TOP_TOP_SYNTHON_SET(x) (((32'd0 | (x)) << TOP_TOP_SYNTHON_LSB) & TOP_TOP_SYNTHON_MASK) -#define TOP_TOP_SYNTHON_RESET 1'h0 -#define TOP_TOP_RXON_MSB 23 -#define TOP_TOP_RXON_LSB 23 -#define TOP_TOP_RXON_MASK 'h00800000 -#define TOP_TOP_RXON_GET(x) (((x) & TOP_TOP_RXON_MASK) >> TOP_TOP_RXON_LSB) -#define TOP_TOP_RXON_SET(x) (((32'd0 | (x)) << TOP_TOP_RXON_LSB) & TOP_TOP_RXON_MASK) -#define TOP_TOP_RXON_RESET 1'h0 -#define TOP_TOP_TXON_MSB 22 -#define TOP_TOP_TXON_LSB 22 -#define TOP_TOP_TXON_MASK 'h00400000 -#define TOP_TOP_TXON_GET(x) (((x) & TOP_TOP_TXON_MASK) >> TOP_TOP_TXON_LSB) -#define TOP_TOP_TXON_SET(x) (((32'd0 | (x)) << TOP_TOP_TXON_LSB) & TOP_TOP_TXON_MASK) -#define TOP_TOP_TXON_RESET 1'h0 -#define TOP_TOP_PAON_MSB 21 -#define TOP_TOP_PAON_LSB 21 -#define TOP_TOP_PAON_MASK 'h00200000 -#define TOP_TOP_PAON_GET(x) (((x) & TOP_TOP_PAON_MASK) >> TOP_TOP_PAON_LSB) -#define TOP_TOP_PAON_SET(x) (((32'd0 | (x)) << TOP_TOP_PAON_LSB) & TOP_TOP_PAON_MASK) -#define TOP_TOP_PAON_RESET 1'h0 -#define TOP_TOP_CALTX_MSB 20 -#define TOP_TOP_CALTX_LSB 20 -#define TOP_TOP_CALTX_MASK 'h00100000 -#define TOP_TOP_CALTX_GET(x) (((x) & TOP_TOP_CALTX_MASK) >> TOP_TOP_CALTX_LSB) -#define TOP_TOP_CALTX_SET(x) (((32'd0 | (x)) << TOP_TOP_CALTX_LSB) & TOP_TOP_CALTX_MASK) -#define TOP_TOP_CALTX_RESET 1'h0 -#define TOP_TOP_LOCALADDAC_MSB 19 -#define TOP_TOP_LOCALADDAC_LSB 19 -#define TOP_TOP_LOCALADDAC_MASK 'h00080000 -#define TOP_TOP_LOCALADDAC_GET(x) (((x) & TOP_TOP_LOCALADDAC_MASK) >> TOP_TOP_LOCALADDAC_LSB) -#define TOP_TOP_LOCALADDAC_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALADDAC_LSB) & TOP_TOP_LOCALADDAC_MASK) -#define TOP_TOP_LOCALADDAC_RESET 1'h0 -#define TOP_TOP_PWDPLL_MSB 18 -#define TOP_TOP_PWDPLL_LSB 18 -#define TOP_TOP_PWDPLL_MASK 'h00040000 -#define TOP_TOP_PWDPLL_GET(x) (((x) & TOP_TOP_PWDPLL_MASK) >> TOP_TOP_PWDPLL_LSB) -#define TOP_TOP_PWDPLL_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDPLL_LSB) & TOP_TOP_PWDPLL_MASK) -#define TOP_TOP_PWDPLL_RESET 1'h0 -#define TOP_TOP_PWDADC_MSB 17 -#define TOP_TOP_PWDADC_LSB 17 -#define TOP_TOP_PWDADC_MASK 'h00020000 -#define TOP_TOP_PWDADC_GET(x) (((x) & TOP_TOP_PWDADC_MASK) >> TOP_TOP_PWDADC_LSB) -#define TOP_TOP_PWDADC_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDADC_LSB) & TOP_TOP_PWDADC_MASK) -#define TOP_TOP_PWDADC_RESET 1'h0 -#define TOP_TOP_PWDDAC_MSB 16 -#define TOP_TOP_PWDDAC_LSB 16 -#define TOP_TOP_PWDDAC_MASK 'h00010000 -#define TOP_TOP_PWDDAC_GET(x) (((x) & TOP_TOP_PWDDAC_MASK) >> TOP_TOP_PWDDAC_LSB) -#define TOP_TOP_PWDDAC_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDDAC_LSB) & TOP_TOP_PWDDAC_MASK) -#define TOP_TOP_PWDDAC_RESET 1'h0 -#define TOP_TOP_LOCALXTAL_MSB 15 -#define TOP_TOP_LOCALXTAL_LSB 15 -#define TOP_TOP_LOCALXTAL_MASK 'h00008000 -#define TOP_TOP_LOCALXTAL_GET(x) (((x) & TOP_TOP_LOCALXTAL_MASK) >> TOP_TOP_LOCALXTAL_LSB) -#define TOP_TOP_LOCALXTAL_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALXTAL_LSB) & TOP_TOP_LOCALXTAL_MASK) -#define TOP_TOP_LOCALXTAL_RESET 1'h0 -#define TOP_TOP_PWDCLKIN_MSB 14 -#define TOP_TOP_PWDCLKIN_LSB 14 -#define TOP_TOP_PWDCLKIN_MASK 'h00004000 -#define TOP_TOP_PWDCLKIN_GET(x) (((x) & TOP_TOP_PWDCLKIN_MASK) >> TOP_TOP_PWDCLKIN_LSB) -#define TOP_TOP_PWDCLKIN_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDCLKIN_LSB) & TOP_TOP_PWDCLKIN_MASK) -#define TOP_TOP_PWDCLKIN_RESET 1'h0 -#define TOP_TOP_OSCON_MSB 13 -#define TOP_TOP_OSCON_LSB 13 -#define TOP_TOP_OSCON_MASK 'h00002000 -#define TOP_TOP_OSCON_GET(x) (((x) & TOP_TOP_OSCON_MASK) >> TOP_TOP_OSCON_LSB) -#define TOP_TOP_OSCON_SET(x) (((32'd0 | (x)) << TOP_TOP_OSCON_LSB) & TOP_TOP_OSCON_MASK) -#define TOP_TOP_OSCON_RESET 1'h1 -#define TOP_TOP_SCLKEN_FORCE_MSB 12 -#define TOP_TOP_SCLKEN_FORCE_LSB 12 -#define TOP_TOP_SCLKEN_FORCE_MASK 'h00001000 -#define TOP_TOP_SCLKEN_FORCE_GET(x) (((x) & TOP_TOP_SCLKEN_FORCE_MASK) >> TOP_TOP_SCLKEN_FORCE_LSB) -#define TOP_TOP_SCLKEN_FORCE_SET(x) (((32'd0 | (x)) << TOP_TOP_SCLKEN_FORCE_LSB) & TOP_TOP_SCLKEN_FORCE_MASK) -#define TOP_TOP_SCLKEN_FORCE_RESET 1'h0 -#define TOP_TOP_SYNTHON_FORCE_MSB 11 -#define TOP_TOP_SYNTHON_FORCE_LSB 11 -#define TOP_TOP_SYNTHON_FORCE_MASK 'h00000800 -#define TOP_TOP_SYNTHON_FORCE_GET(x) (((x) & TOP_TOP_SYNTHON_FORCE_MASK) >> TOP_TOP_SYNTHON_FORCE_LSB) -#define TOP_TOP_SYNTHON_FORCE_SET(x) (((32'd0 | (x)) << TOP_TOP_SYNTHON_FORCE_LSB) & TOP_TOP_SYNTHON_FORCE_MASK) -#define TOP_TOP_SYNTHON_FORCE_RESET 1'h0 -#define TOP_TOP_PDBIAS_MSB 10 -#define TOP_TOP_PDBIAS_LSB 10 -#define TOP_TOP_PDBIAS_MASK 'h00000400 -#define TOP_TOP_PDBIAS_GET(x) (((x) & TOP_TOP_PDBIAS_MASK) >> TOP_TOP_PDBIAS_LSB) -#define TOP_TOP_PDBIAS_SET(x) (((32'd0 | (x)) << TOP_TOP_PDBIAS_LSB) & TOP_TOP_PDBIAS_MASK) -#define TOP_TOP_PDBIAS_RESET 1'h0 -#define TOP_TOP_DATAOUTSEL_MSB 9 -#define TOP_TOP_DATAOUTSEL_LSB 8 -#define TOP_TOP_DATAOUTSEL_MASK 'h00000300 -#define TOP_TOP_DATAOUTSEL_GET(x) (((x) & TOP_TOP_DATAOUTSEL_MASK) >> TOP_TOP_DATAOUTSEL_LSB) -#define TOP_TOP_DATAOUTSEL_SET(x) (((32'd0 | (x)) << TOP_TOP_DATAOUTSEL_LSB) & TOP_TOP_DATAOUTSEL_MASK) -#define TOP_TOP_DATAOUTSEL_RESET 2'h3 -#define TOP_TOP_REVID_MSB 7 -#define TOP_TOP_REVID_LSB 5 -#define TOP_TOP_REVID_MASK 'h000000e0 -#define TOP_TOP_REVID_GET(x) (((x) & TOP_TOP_REVID_MASK) >> TOP_TOP_REVID_LSB) -#define TOP_TOP_REVID_SET(x) (((32'd0 | (x)) << TOP_TOP_REVID_LSB) & TOP_TOP_REVID_MASK) -#define TOP_TOP_REVID_RESET 3'h0 -#define TOP_TOP_INT2PAD_MSB 4 -#define TOP_TOP_INT2PAD_LSB 4 -#define TOP_TOP_INT2PAD_MASK 'h00000010 -#define TOP_TOP_INT2PAD_GET(x) (((x) & TOP_TOP_INT2PAD_MASK) >> TOP_TOP_INT2PAD_LSB) -#define TOP_TOP_INT2PAD_SET(x) (((32'd0 | (x)) << TOP_TOP_INT2PAD_LSB) & TOP_TOP_INT2PAD_MASK) -#define TOP_TOP_INT2PAD_RESET 1'h0 -#define TOP_TOP_INTH2PAD_MSB 3 -#define TOP_TOP_INTH2PAD_LSB 3 -#define TOP_TOP_INTH2PAD_MASK 'h00000008 -#define TOP_TOP_INTH2PAD_GET(x) (((x) & TOP_TOP_INTH2PAD_MASK) >> TOP_TOP_INTH2PAD_LSB) -#define TOP_TOP_INTH2PAD_SET(x) (((32'd0 | (x)) << TOP_TOP_INTH2PAD_LSB) & TOP_TOP_INTH2PAD_MASK) -#define TOP_TOP_INTH2PAD_RESET 1'h0 -#define TOP_TOP_PAD2GND_MSB 2 -#define TOP_TOP_PAD2GND_LSB 2 -#define TOP_TOP_PAD2GND_MASK 'h00000004 -#define TOP_TOP_PAD2GND_GET(x) (((x) & TOP_TOP_PAD2GND_MASK) >> TOP_TOP_PAD2GND_LSB) -#define TOP_TOP_PAD2GND_SET(x) (((32'd0 | (x)) << TOP_TOP_PAD2GND_LSB) & TOP_TOP_PAD2GND_MASK) -#define TOP_TOP_PAD2GND_RESET 1'h0 -#define TOP_TOP_INT2GND_MSB 1 -#define TOP_TOP_INT2GND_LSB 1 -#define TOP_TOP_INT2GND_MASK 'h00000002 -#define TOP_TOP_INT2GND_GET(x) (((x) & TOP_TOP_INT2GND_MASK) >> TOP_TOP_INT2GND_LSB) -#define TOP_TOP_INT2GND_SET(x) (((32'd0 | (x)) << TOP_TOP_INT2GND_LSB) & TOP_TOP_INT2GND_MASK) -#define TOP_TOP_INT2GND_RESET 1'h0 -#define TOP_TOP_FORCE_XPAON_MSB 0 -#define TOP_TOP_FORCE_XPAON_LSB 0 -#define TOP_TOP_FORCE_XPAON_MASK 'h00000001 -#define TOP_TOP_FORCE_XPAON_GET(x) (((x) & TOP_TOP_FORCE_XPAON_MASK) >> TOP_TOP_FORCE_XPAON_LSB) -#define TOP_TOP_FORCE_XPAON_SET(x) (((32'd0 | (x)) << TOP_TOP_FORCE_XPAON_LSB) & TOP_TOP_FORCE_XPAON_MASK) -#define TOP_TOP_FORCE_XPAON_RESET 1'h0 -#define TOP_TOP_RESET (32'h0 | \ - TOP_TOP_LOCALTXGAIN_SET(TOP_TOP_LOCALTXGAIN_RESET) | \ - TOP_TOP_LOCALRXGAIN_SET(TOP_TOP_LOCALRXGAIN_RESET) | \ - TOP_TOP_LOCALMODE_SET(TOP_TOP_LOCALMODE_RESET) | \ - TOP_TOP_CALFC_SET(TOP_TOP_CALFC_RESET) | \ - TOP_TOP_CALDC_SET(TOP_TOP_CALDC_RESET) | \ - TOP_TOP_CAL_RESIDUE_SET(TOP_TOP_CAL_RESIDUE_RESET) | \ - TOP_TOP_BMODE_SET(TOP_TOP_BMODE_RESET) | \ - TOP_TOP_SYNTHON_SET(TOP_TOP_SYNTHON_RESET) | \ - TOP_TOP_RXON_SET(TOP_TOP_RXON_RESET) | \ - TOP_TOP_TXON_SET(TOP_TOP_TXON_RESET) | \ - TOP_TOP_PAON_SET(TOP_TOP_PAON_RESET) | \ - TOP_TOP_CALTX_SET(TOP_TOP_CALTX_RESET) | \ - TOP_TOP_LOCALADDAC_SET(TOP_TOP_LOCALADDAC_RESET) | \ - TOP_TOP_PWDPLL_SET(TOP_TOP_PWDPLL_RESET) | \ - TOP_TOP_PWDADC_SET(TOP_TOP_PWDADC_RESET) | \ - TOP_TOP_PWDDAC_SET(TOP_TOP_PWDDAC_RESET) | \ - TOP_TOP_LOCALXTAL_SET(TOP_TOP_LOCALXTAL_RESET) | \ - TOP_TOP_PWDCLKIN_SET(TOP_TOP_PWDCLKIN_RESET) | \ - TOP_TOP_OSCON_SET(TOP_TOP_OSCON_RESET) | \ - TOP_TOP_SCLKEN_FORCE_SET(TOP_TOP_SCLKEN_FORCE_RESET) | \ - TOP_TOP_SYNTHON_FORCE_SET(TOP_TOP_SYNTHON_FORCE_RESET) | \ - TOP_TOP_PDBIAS_SET(TOP_TOP_PDBIAS_RESET) | \ - TOP_TOP_DATAOUTSEL_SET(TOP_TOP_DATAOUTSEL_RESET) | \ - TOP_TOP_REVID_SET(TOP_TOP_REVID_RESET) | \ - TOP_TOP_INT2PAD_SET(TOP_TOP_INT2PAD_RESET) | \ - TOP_TOP_INTH2PAD_SET(TOP_TOP_INTH2PAD_RESET) | \ - TOP_TOP_PAD2GND_SET(TOP_TOP_PAD2GND_RESET) | \ - TOP_TOP_INT2GND_SET(TOP_TOP_INT2GND_RESET) | \ - TOP_TOP_FORCE_XPAON_SET(TOP_TOP_FORCE_XPAON_RESET)) -#define TOP_TOP_HW_MASK (32'h0 | \ - TOP_TOP_CALFC_MASK | \ - TOP_TOP_CALDC_MASK | \ - TOP_TOP_CAL_RESIDUE_MASK | \ - TOP_TOP_BMODE_MASK | \ - TOP_TOP_SYNTHON_MASK | \ - TOP_TOP_RXON_MASK | \ - TOP_TOP_TXON_MASK | \ - TOP_TOP_PAON_MASK | \ - TOP_TOP_CALTX_MASK | \ - TOP_TOP_PWDPLL_MASK | \ - TOP_TOP_PWDADC_MASK | \ - TOP_TOP_PWDDAC_MASK | \ - TOP_TOP_PWDCLKIN_MASK | \ - TOP_TOP_OSCON_MASK | \ - TOP_TOP_REVID_MASK) -#define TOP_TOP_SW_MASK (32'h0 | \ - TOP_TOP_LOCALTXGAIN_MASK | \ - TOP_TOP_LOCALRXGAIN_MASK | \ - TOP_TOP_LOCALMODE_MASK | \ - TOP_TOP_CALFC_MASK | \ - TOP_TOP_CALDC_MASK | \ - TOP_TOP_CAL_RESIDUE_MASK | \ - TOP_TOP_BMODE_MASK | \ - TOP_TOP_SYNTHON_MASK | \ - TOP_TOP_RXON_MASK | \ - TOP_TOP_TXON_MASK | \ - TOP_TOP_PAON_MASK | \ - TOP_TOP_CALTX_MASK | \ - TOP_TOP_LOCALADDAC_MASK | \ - TOP_TOP_PWDPLL_MASK | \ - TOP_TOP_PWDADC_MASK | \ - TOP_TOP_PWDDAC_MASK | \ - TOP_TOP_LOCALXTAL_MASK | \ - TOP_TOP_PWDCLKIN_MASK | \ - TOP_TOP_OSCON_MASK | \ - TOP_TOP_SCLKEN_FORCE_MASK | \ - TOP_TOP_SYNTHON_FORCE_MASK | \ - TOP_TOP_PDBIAS_MASK | \ - TOP_TOP_DATAOUTSEL_MASK | \ - TOP_TOP_INT2PAD_MASK | \ - TOP_TOP_INTH2PAD_MASK | \ - TOP_TOP_PAD2GND_MASK | \ - TOP_TOP_INT2GND_MASK | \ - TOP_TOP_FORCE_XPAON_MASK) - -#define BIAS_BIAS_SEL_ADDRESS 'h00000038 -#define BIAS_BIAS_SEL_PADON_MSB 31 -#define BIAS_BIAS_SEL_PADON_LSB 31 -#define BIAS_BIAS_SEL_PADON_MASK 'h80000000 -#define BIAS_BIAS_SEL_PADON_GET(x) (((x) & BIAS_BIAS_SEL_PADON_MASK) >> BIAS_BIAS_SEL_PADON_LSB) -#define BIAS_BIAS_SEL_PADON_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PADON_LSB) & BIAS_BIAS_SEL_PADON_MASK) -#define BIAS_BIAS_SEL_PADON_RESET 1'h0 -#define BIAS_BIAS_SEL_SEL_BIAS_MSB 30 -#define BIAS_BIAS_SEL_SEL_BIAS_LSB 25 -#define BIAS_BIAS_SEL_SEL_BIAS_MASK 'h7e000000 -#define BIAS_BIAS_SEL_SEL_BIAS_GET(x) (((x) & BIAS_BIAS_SEL_SEL_BIAS_MASK) >> BIAS_BIAS_SEL_SEL_BIAS_LSB) -#define BIAS_BIAS_SEL_SEL_BIAS_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_SEL_BIAS_LSB) & BIAS_BIAS_SEL_SEL_BIAS_MASK) -#define BIAS_BIAS_SEL_SEL_BIAS_RESET 6'h0 -#define BIAS_BIAS_SEL_SEL_SPARE_MSB 24 -#define BIAS_BIAS_SEL_SEL_SPARE_LSB 21 -#define BIAS_BIAS_SEL_SEL_SPARE_MASK 'h01e00000 -#define BIAS_BIAS_SEL_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SEL_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_SEL_SPARE_RESET 4'h0 -#define BIAS_BIAS_SEL_SPARE_MSB 20 -#define BIAS_BIAS_SEL_SPARE_LSB 20 -#define BIAS_BIAS_SEL_SPARE_MASK 'h00100000 -#define BIAS_BIAS_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_SPARE_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MSB 19 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB 17 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK 'h000e0000 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_RESET 3'h6 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK 'h00010000 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK 'h00008000 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK 'h00004000 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_LSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MASK 'h00002000 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) >> BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MSB 12 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB 10 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK 'h00001c00 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MSB 9 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_LSB 7 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MASK 'h00000380 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) >> BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MSB 6 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_LSB 4 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MASK 'h00000070 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) >> BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MSB 3 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_LSB 1 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MASK 'h0000000e -#define BIAS_BIAS_SEL_PWD_ICTXPC25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) >> BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICLDO25_MSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_LSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_MASK 'h00000001 -#define BIAS_BIAS_SEL_PWD_ICLDO25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) >> BIAS_BIAS_SEL_PWD_ICLDO25_LSB) -#define BIAS_BIAS_SEL_PWD_ICLDO25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICLDO25_LSB) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) -#define BIAS_BIAS_SEL_PWD_ICLDO25_RESET 1'h0 -#define BIAS_BIAS_SEL_RESET (32'h0 | \ - BIAS_BIAS_SEL_PADON_SET(BIAS_BIAS_SEL_PADON_RESET) | \ - BIAS_BIAS_SEL_SEL_BIAS_SET(BIAS_BIAS_SEL_SEL_BIAS_RESET) | \ - BIAS_BIAS_SEL_SEL_SPARE_SET(BIAS_BIAS_SEL_SEL_SPARE_RESET) | \ - BIAS_BIAS_SEL_SPARE_SET(BIAS_BIAS_SEL_SPARE_RESET) | \ - BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_SET(BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_RESET) | \ - BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_SET(BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_RESET) | \ - BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_SET(BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_RESET) | \ - BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_SET(BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICCPLL25_SET(BIAS_BIAS_SEL_PWD_ICCPLL25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_SET(BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICXTAL25_SET(BIAS_BIAS_SEL_PWD_ICXTAL25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICTSENS25_SET(BIAS_BIAS_SEL_PWD_ICTSENS25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICTXPC25_SET(BIAS_BIAS_SEL_PWD_ICTXPC25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICLDO25_SET(BIAS_BIAS_SEL_PWD_ICLDO25_RESET)) -#define BIAS_BIAS_SEL_HW_MASK (32'h0) -#define BIAS_BIAS_SEL_SW_MASK (32'h0 | \ - BIAS_BIAS_SEL_PADON_MASK | \ - BIAS_BIAS_SEL_SEL_BIAS_MASK | \ - BIAS_BIAS_SEL_SEL_SPARE_MASK | \ - BIAS_BIAS_SEL_SPARE_MASK | \ - BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK | \ - BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK | \ - BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK | \ - BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK | \ - BIAS_BIAS_SEL_PWD_ICCPLL25_MASK | \ - BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK | \ - BIAS_BIAS_SEL_PWD_ICXTAL25_MASK | \ - BIAS_BIAS_SEL_PWD_ICTSENS25_MASK | \ - BIAS_BIAS_SEL_PWD_ICTXPC25_MASK | \ - BIAS_BIAS_SEL_PWD_ICLDO25_MASK) - -#define BIAS_BIAS1_ADDRESS 'h0000003c -#define BIAS_BIAS1_PWD_ICDAC2BB25_MSB 31 -#define BIAS_BIAS1_PWD_ICDAC2BB25_LSB 29 -#define BIAS_BIAS1_PWD_ICDAC2BB25_MASK 'he0000000 -#define BIAS_BIAS1_PWD_ICDAC2BB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) >> BIAS_BIAS1_PWD_ICDAC2BB25_LSB) -#define BIAS_BIAS1_PWD_ICDAC2BB25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_ICDAC2BB25_LSB) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) -#define BIAS_BIAS1_PWD_ICDAC2BB25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GVGM25_MSB 28 -#define BIAS_BIAS1_PWD_IC2GVGM25_LSB 26 -#define BIAS_BIAS1_PWD_IC2GVGM25_MASK 'h1c000000 -#define BIAS_BIAS1_PWD_IC2GVGM25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) >> BIAS_BIAS1_PWD_IC2GVGM25_LSB) -#define BIAS_BIAS1_PWD_IC2GVGM25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GVGM25_LSB) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) -#define BIAS_BIAS1_PWD_IC2GVGM25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GRFFE25_MSB 25 -#define BIAS_BIAS1_PWD_IC2GRFFE25_LSB 23 -#define BIAS_BIAS1_PWD_IC2GRFFE25_MASK 'h03800000 -#define BIAS_BIAS1_PWD_IC2GRFFE25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) >> BIAS_BIAS1_PWD_IC2GRFFE25_LSB) -#define BIAS_BIAS1_PWD_IC2GRFFE25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GRFFE25_LSB) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) -#define BIAS_BIAS1_PWD_IC2GRFFE25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GLOREG25_MSB 22 -#define BIAS_BIAS1_PWD_IC2GLOREG25_LSB 20 -#define BIAS_BIAS1_PWD_IC2GLOREG25_MASK 'h00700000 -#define BIAS_BIAS1_PWD_IC2GLOREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLOREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLOREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GLOREG25_LSB) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) -#define BIAS_BIAS1_PWD_IC2GLOREG25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MSB 19 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_LSB 17 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MASK 'h000e0000 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_RESET 3'h3 -#define BIAS_BIAS1_PWD_ICDETECTORB25_MSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_LSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_MASK 'h00010000 -#define BIAS_BIAS1_PWD_ICDETECTORB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORB25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORB25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_ICDETECTORB25_LSB) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORB25_RESET 1'h0 -#define BIAS_BIAS1_PWD_ICDETECTORA25_MSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_LSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_MASK 'h00008000 -#define BIAS_BIAS1_PWD_ICDETECTORA25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORA25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORA25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_ICDETECTORA25_LSB) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORA25_RESET 1'h0 -#define BIAS_BIAS1_PWD_IC5GRXRF25_MSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_LSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_MASK 'h00004000 -#define BIAS_BIAS1_PWD_IC5GRXRF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) >> BIAS_BIAS1_PWD_IC5GRXRF25_LSB) -#define BIAS_BIAS1_PWD_IC5GRXRF25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GRXRF25_LSB) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) -#define BIAS_BIAS1_PWD_IC5GRXRF25_RESET 1'h0 -#define BIAS_BIAS1_PWD_IC5GTXPA25_MSB 13 -#define BIAS_BIAS1_PWD_IC5GTXPA25_LSB 11 -#define BIAS_BIAS1_PWD_IC5GTXPA25_MASK 'h00003800 -#define BIAS_BIAS1_PWD_IC5GTXPA25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) >> BIAS_BIAS1_PWD_IC5GTXPA25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXPA25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GTXPA25_LSB) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXPA25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MSB 10 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_LSB 8 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MASK 'h00000700 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) >> BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC5GQB25_MSB 7 -#define BIAS_BIAS1_PWD_IC5GQB25_LSB 5 -#define BIAS_BIAS1_PWD_IC5GQB25_MASK 'h000000e0 -#define BIAS_BIAS1_PWD_IC5GQB25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GQB25_MASK) >> BIAS_BIAS1_PWD_IC5GQB25_LSB) -#define BIAS_BIAS1_PWD_IC5GQB25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GQB25_LSB) & BIAS_BIAS1_PWD_IC5GQB25_MASK) -#define BIAS_BIAS1_PWD_IC5GQB25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MSB 4 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_LSB 2 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MASK 'h0000001c -#define BIAS_BIAS1_PWD_IC5GMIXQ25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) >> BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_RESET 3'h3 -#define BIAS_BIAS1_SPARE_MSB 1 -#define BIAS_BIAS1_SPARE_LSB 0 -#define BIAS_BIAS1_SPARE_MASK 'h00000003 -#define BIAS_BIAS1_SPARE_GET(x) (((x) & BIAS_BIAS1_SPARE_MASK) >> BIAS_BIAS1_SPARE_LSB) -#define BIAS_BIAS1_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_SPARE_LSB) & BIAS_BIAS1_SPARE_MASK) -#define BIAS_BIAS1_SPARE_RESET 2'h3 -#define BIAS_BIAS1_RESET (32'h0 | \ - BIAS_BIAS1_PWD_ICDAC2BB25_SET(BIAS_BIAS1_PWD_ICDAC2BB25_RESET) | \ - BIAS_BIAS1_PWD_IC2GVGM25_SET(BIAS_BIAS1_PWD_IC2GVGM25_RESET) | \ - BIAS_BIAS1_PWD_IC2GRFFE25_SET(BIAS_BIAS1_PWD_IC2GRFFE25_RESET) | \ - BIAS_BIAS1_PWD_IC2GLOREG25_SET(BIAS_BIAS1_PWD_IC2GLOREG25_RESET) | \ - BIAS_BIAS1_PWD_IC2GLNAREG25_SET(BIAS_BIAS1_PWD_IC2GLNAREG25_RESET) | \ - BIAS_BIAS1_PWD_ICDETECTORB25_SET(BIAS_BIAS1_PWD_ICDETECTORB25_RESET) | \ - BIAS_BIAS1_PWD_ICDETECTORA25_SET(BIAS_BIAS1_PWD_ICDETECTORA25_RESET) | \ - BIAS_BIAS1_PWD_IC5GRXRF25_SET(BIAS_BIAS1_PWD_IC5GRXRF25_RESET) | \ - BIAS_BIAS1_PWD_IC5GTXPA25_SET(BIAS_BIAS1_PWD_IC5GTXPA25_RESET) | \ - BIAS_BIAS1_PWD_IC5GTXBUF25_SET(BIAS_BIAS1_PWD_IC5GTXBUF25_RESET) | \ - BIAS_BIAS1_PWD_IC5GQB25_SET(BIAS_BIAS1_PWD_IC5GQB25_RESET) | \ - BIAS_BIAS1_PWD_IC5GMIXQ25_SET(BIAS_BIAS1_PWD_IC5GMIXQ25_RESET) | \ - BIAS_BIAS1_SPARE_SET(BIAS_BIAS1_SPARE_RESET)) -#define BIAS_BIAS1_HW_MASK (32'h0) -#define BIAS_BIAS1_SW_MASK (32'h0 | \ - BIAS_BIAS1_PWD_ICDAC2BB25_MASK | \ - BIAS_BIAS1_PWD_IC2GVGM25_MASK | \ - BIAS_BIAS1_PWD_IC2GRFFE25_MASK | \ - BIAS_BIAS1_PWD_IC2GLOREG25_MASK | \ - BIAS_BIAS1_PWD_IC2GLNAREG25_MASK | \ - BIAS_BIAS1_PWD_ICDETECTORB25_MASK | \ - BIAS_BIAS1_PWD_ICDETECTORA25_MASK | \ - BIAS_BIAS1_PWD_IC5GRXRF25_MASK | \ - BIAS_BIAS1_PWD_IC5GTXPA25_MASK | \ - BIAS_BIAS1_PWD_IC5GTXBUF25_MASK | \ - BIAS_BIAS1_PWD_IC5GQB25_MASK | \ - BIAS_BIAS1_PWD_IC5GMIXQ25_MASK | \ - BIAS_BIAS1_SPARE_MASK) - -#define BIAS_BIAS2_ADDRESS 'h00000040 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MSB 31 -#define BIAS_BIAS2_PWD_IC5GMIXI25_LSB 29 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MASK 'he0000000 -#define BIAS_BIAS2_PWD_IC5GMIXI25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) >> BIAS_BIAS2_PWD_IC5GMIXI25_LSB) -#define BIAS_BIAS2_PWD_IC5GMIXI25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IC5GMIXI25_LSB) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) -#define BIAS_BIAS2_PWD_IC5GMIXI25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IC5GDIV25_MSB 28 -#define BIAS_BIAS2_PWD_IC5GDIV25_LSB 26 -#define BIAS_BIAS2_PWD_IC5GDIV25_MASK 'h1c000000 -#define BIAS_BIAS2_PWD_IC5GDIV25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) >> BIAS_BIAS2_PWD_IC5GDIV25_LSB) -#define BIAS_BIAS2_PWD_IC5GDIV25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IC5GDIV25_LSB) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) -#define BIAS_BIAS2_PWD_IC5GDIV25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IC5GLOREG25_MSB 25 -#define BIAS_BIAS2_PWD_IC5GLOREG25_LSB 23 -#define BIAS_BIAS2_PWD_IC5GLOREG25_MASK 'h03800000 -#define BIAS_BIAS2_PWD_IC5GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) >> BIAS_BIAS2_PWD_IC5GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IC5GLOREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IC5GLOREG25_LSB) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IC5GLOREG25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRPLL25_MSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_LSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_MASK 'h00400000 -#define BIAS_BIAS2_PWD_IRPLL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRPLL25_MASK) >> BIAS_BIAS2_PWD_IRPLL25_LSB) -#define BIAS_BIAS2_PWD_IRPLL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRPLL25_LSB) & BIAS_BIAS2_PWD_IRPLL25_MASK) -#define BIAS_BIAS2_PWD_IRPLL25_RESET 1'h0 -#define BIAS_BIAS2_PWD_IRXTAL25_MSB 21 -#define BIAS_BIAS2_PWD_IRXTAL25_LSB 19 -#define BIAS_BIAS2_PWD_IRXTAL25_MASK 'h00380000 -#define BIAS_BIAS2_PWD_IRXTAL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRXTAL25_MASK) >> BIAS_BIAS2_PWD_IRXTAL25_LSB) -#define BIAS_BIAS2_PWD_IRXTAL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRXTAL25_LSB) & BIAS_BIAS2_PWD_IRXTAL25_MASK) -#define BIAS_BIAS2_PWD_IRXTAL25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRTSENS25_MSB 18 -#define BIAS_BIAS2_PWD_IRTSENS25_LSB 16 -#define BIAS_BIAS2_PWD_IRTSENS25_MASK 'h00070000 -#define BIAS_BIAS2_PWD_IRTSENS25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTSENS25_MASK) >> BIAS_BIAS2_PWD_IRTSENS25_LSB) -#define BIAS_BIAS2_PWD_IRTSENS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRTSENS25_LSB) & BIAS_BIAS2_PWD_IRTSENS25_MASK) -#define BIAS_BIAS2_PWD_IRTSENS25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRTXPC25_MSB 15 -#define BIAS_BIAS2_PWD_IRTXPC25_LSB 13 -#define BIAS_BIAS2_PWD_IRTXPC25_MASK 'h0000e000 -#define BIAS_BIAS2_PWD_IRTXPC25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTXPC25_MASK) >> BIAS_BIAS2_PWD_IRTXPC25_LSB) -#define BIAS_BIAS2_PWD_IRTXPC25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRTXPC25_LSB) & BIAS_BIAS2_PWD_IRTXPC25_MASK) -#define BIAS_BIAS2_PWD_IRTXPC25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRLDO25_MSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_LSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_MASK 'h00001000 -#define BIAS_BIAS2_PWD_IRLDO25_GET(x) (((x) & BIAS_BIAS2_PWD_IRLDO25_MASK) >> BIAS_BIAS2_PWD_IRLDO25_LSB) -#define BIAS_BIAS2_PWD_IRLDO25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRLDO25_LSB) & BIAS_BIAS2_PWD_IRLDO25_MASK) -#define BIAS_BIAS2_PWD_IRLDO25_RESET 1'h0 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MSB 11 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_LSB 9 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MASK 'h00000e00 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) >> BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IR2GLOREG25_MSB 8 -#define BIAS_BIAS2_PWD_IR2GLOREG25_LSB 6 -#define BIAS_BIAS2_PWD_IR2GLOREG25_MASK 'h000001c0 -#define BIAS_BIAS2_PWD_IR2GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLOREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR2GLOREG25_LSB) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IR2GLOREG25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MSB 5 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_LSB 3 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MASK 'h00000038 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MSB 2 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB 0 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK 'h00000007 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_GET(x) (((x) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) >> BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_RESET 3'h3 -#define BIAS_BIAS2_RESET (32'h0 | \ - BIAS_BIAS2_PWD_IC5GMIXI25_SET(BIAS_BIAS2_PWD_IC5GMIXI25_RESET) | \ - BIAS_BIAS2_PWD_IC5GDIV25_SET(BIAS_BIAS2_PWD_IC5GDIV25_RESET) | \ - BIAS_BIAS2_PWD_IC5GLOREG25_SET(BIAS_BIAS2_PWD_IC5GLOREG25_RESET) | \ - BIAS_BIAS2_PWD_IRPLL25_SET(BIAS_BIAS2_PWD_IRPLL25_RESET) | \ - BIAS_BIAS2_PWD_IRXTAL25_SET(BIAS_BIAS2_PWD_IRXTAL25_RESET) | \ - BIAS_BIAS2_PWD_IRTSENS25_SET(BIAS_BIAS2_PWD_IRTSENS25_RESET) | \ - BIAS_BIAS2_PWD_IRTXPC25_SET(BIAS_BIAS2_PWD_IRTXPC25_RESET) | \ - BIAS_BIAS2_PWD_IRLDO25_SET(BIAS_BIAS2_PWD_IRLDO25_RESET) | \ - BIAS_BIAS2_PWD_IR2GTXMIX25_SET(BIAS_BIAS2_PWD_IR2GTXMIX25_RESET) | \ - BIAS_BIAS2_PWD_IR2GLOREG25_SET(BIAS_BIAS2_PWD_IR2GLOREG25_RESET) | \ - BIAS_BIAS2_PWD_IR2GLNAREG25_SET(BIAS_BIAS2_PWD_IR2GLNAREG25_RESET) | \ - BIAS_BIAS2_PWD_IR5GRFVREF2525_SET(BIAS_BIAS2_PWD_IR5GRFVREF2525_RESET)) -#define BIAS_BIAS2_HW_MASK (32'h0) -#define BIAS_BIAS2_SW_MASK (32'h0 | \ - BIAS_BIAS2_PWD_IC5GMIXI25_MASK | \ - BIAS_BIAS2_PWD_IC5GDIV25_MASK | \ - BIAS_BIAS2_PWD_IC5GLOREG25_MASK | \ - BIAS_BIAS2_PWD_IRPLL25_MASK | \ - BIAS_BIAS2_PWD_IRXTAL25_MASK | \ - BIAS_BIAS2_PWD_IRTSENS25_MASK | \ - BIAS_BIAS2_PWD_IRTXPC25_MASK | \ - BIAS_BIAS2_PWD_IRLDO25_MASK | \ - BIAS_BIAS2_PWD_IR2GTXMIX25_MASK | \ - BIAS_BIAS2_PWD_IR2GLOREG25_MASK | \ - BIAS_BIAS2_PWD_IR2GLNAREG25_MASK | \ - BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) - -#define BIAS_BIAS3_ADDRESS 'h00000044 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MSB 31 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_LSB 29 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MASK 'he0000000 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) >> BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) -#define BIAS_BIAS3_PWD_IR5GTXMIX25_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) -#define BIAS_BIAS3_PWD_IR5GTXMIX25_RESET 3'h3 -#define BIAS_BIAS3_PWD_IR5GAGC25_MSB 28 -#define BIAS_BIAS3_PWD_IR5GAGC25_LSB 26 -#define BIAS_BIAS3_PWD_IR5GAGC25_MASK 'h1c000000 -#define BIAS_BIAS3_PWD_IR5GAGC25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) >> BIAS_BIAS3_PWD_IR5GAGC25_LSB) -#define BIAS_BIAS3_PWD_IR5GAGC25_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR5GAGC25_LSB) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) -#define BIAS_BIAS3_PWD_IR5GAGC25_RESET 3'h3 -#define BIAS_BIAS3_PWD_ICDAC50_MSB 25 -#define BIAS_BIAS3_PWD_ICDAC50_LSB 23 -#define BIAS_BIAS3_PWD_ICDAC50_MASK 'h03800000 -#define BIAS_BIAS3_PWD_ICDAC50_GET(x) (((x) & BIAS_BIAS3_PWD_ICDAC50_MASK) >> BIAS_BIAS3_PWD_ICDAC50_LSB) -#define BIAS_BIAS3_PWD_ICDAC50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICDAC50_LSB) & BIAS_BIAS3_PWD_ICDAC50_MASK) -#define BIAS_BIAS3_PWD_ICDAC50_RESET 3'h3 -#define BIAS_BIAS3_PWD_ICSYNTH50_MSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_LSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_MASK 'h00400000 -#define BIAS_BIAS3_PWD_ICSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) >> BIAS_BIAS3_PWD_ICSYNTH50_LSB) -#define BIAS_BIAS3_PWD_ICSYNTH50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICSYNTH50_LSB) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) -#define BIAS_BIAS3_PWD_ICSYNTH50_RESET 1'h0 -#define BIAS_BIAS3_PWD_ICBB50_MSB 21 -#define BIAS_BIAS3_PWD_ICBB50_LSB 21 -#define BIAS_BIAS3_PWD_ICBB50_MASK 'h00200000 -#define BIAS_BIAS3_PWD_ICBB50_GET(x) (((x) & BIAS_BIAS3_PWD_ICBB50_MASK) >> BIAS_BIAS3_PWD_ICBB50_LSB) -#define BIAS_BIAS3_PWD_ICBB50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICBB50_LSB) & BIAS_BIAS3_PWD_ICBB50_MASK) -#define BIAS_BIAS3_PWD_ICBB50_RESET 1'h0 -#define BIAS_BIAS3_PWD_IC2GDIV50_MSB 20 -#define BIAS_BIAS3_PWD_IC2GDIV50_LSB 18 -#define BIAS_BIAS3_PWD_IC2GDIV50_MASK 'h001c0000 -#define BIAS_BIAS3_PWD_IC2GDIV50_GET(x) (((x) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) >> BIAS_BIAS3_PWD_IC2GDIV50_LSB) -#define BIAS_BIAS3_PWD_IC2GDIV50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IC2GDIV50_LSB) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) -#define BIAS_BIAS3_PWD_IC2GDIV50_RESET 3'h3 -#define BIAS_BIAS3_PWD_IRSYNTH50_MSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_LSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_MASK 'h00020000 -#define BIAS_BIAS3_PWD_IRSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) >> BIAS_BIAS3_PWD_IRSYNTH50_LSB) -#define BIAS_BIAS3_PWD_IRSYNTH50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IRSYNTH50_LSB) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) -#define BIAS_BIAS3_PWD_IRSYNTH50_RESET 1'h0 -#define BIAS_BIAS3_PWD_IRBB50_MSB 16 -#define BIAS_BIAS3_PWD_IRBB50_LSB 16 -#define BIAS_BIAS3_PWD_IRBB50_MASK 'h00010000 -#define BIAS_BIAS3_PWD_IRBB50_GET(x) (((x) & BIAS_BIAS3_PWD_IRBB50_MASK) >> BIAS_BIAS3_PWD_IRBB50_LSB) -#define BIAS_BIAS3_PWD_IRBB50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IRBB50_LSB) & BIAS_BIAS3_PWD_IRBB50_MASK) -#define BIAS_BIAS3_PWD_IRBB50_RESET 1'h0 -#define BIAS_BIAS3_PWD_IC25SPARE1_MSB 15 -#define BIAS_BIAS3_PWD_IC25SPARE1_LSB 13 -#define BIAS_BIAS3_PWD_IC25SPARE1_MASK 'h0000e000 -#define BIAS_BIAS3_PWD_IC25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) >> BIAS_BIAS3_PWD_IC25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE1_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IC25SPARE1_LSB) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE1_RESET 3'h3 -#define BIAS_BIAS3_PWD_IC25SPARE2_MSB 12 -#define BIAS_BIAS3_PWD_IC25SPARE2_LSB 10 -#define BIAS_BIAS3_PWD_IC25SPARE2_MASK 'h00001c00 -#define BIAS_BIAS3_PWD_IC25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) >> BIAS_BIAS3_PWD_IC25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE2_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IC25SPARE2_LSB) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE2_RESET 3'h3 -#define BIAS_BIAS3_PWD_IR25SPARE1_MSB 9 -#define BIAS_BIAS3_PWD_IR25SPARE1_LSB 7 -#define BIAS_BIAS3_PWD_IR25SPARE1_MASK 'h00000380 -#define BIAS_BIAS3_PWD_IR25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) >> BIAS_BIAS3_PWD_IR25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE1_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR25SPARE1_LSB) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE1_RESET 3'h3 -#define BIAS_BIAS3_PWD_IR25SPARE2_MSB 6 -#define BIAS_BIAS3_PWD_IR25SPARE2_LSB 4 -#define BIAS_BIAS3_PWD_IR25SPARE2_MASK 'h00000070 -#define BIAS_BIAS3_PWD_IR25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) >> BIAS_BIAS3_PWD_IR25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE2_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR25SPARE2_LSB) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE2_RESET 3'h3 -#define BIAS_BIAS3_PWD_ICDACREG12P5_MSB 3 -#define BIAS_BIAS3_PWD_ICDACREG12P5_LSB 1 -#define BIAS_BIAS3_PWD_ICDACREG12P5_MASK 'h0000000e -#define BIAS_BIAS3_PWD_ICDACREG12P5_GET(x) (((x) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) >> BIAS_BIAS3_PWD_ICDACREG12P5_LSB) -#define BIAS_BIAS3_PWD_ICDACREG12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICDACREG12P5_LSB) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) -#define BIAS_BIAS3_PWD_ICDACREG12P5_RESET 3'h5 -#define BIAS_BIAS3_SPARE_MSB 0 -#define BIAS_BIAS3_SPARE_LSB 0 -#define BIAS_BIAS3_SPARE_MASK 'h00000001 -#define BIAS_BIAS3_SPARE_GET(x) (((x) & BIAS_BIAS3_SPARE_MASK) >> BIAS_BIAS3_SPARE_LSB) -#define BIAS_BIAS3_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_SPARE_LSB) & BIAS_BIAS3_SPARE_MASK) -#define BIAS_BIAS3_SPARE_RESET 1'h0 -#define BIAS_BIAS3_RESET (32'h0 | \ - BIAS_BIAS3_PWD_IR5GTXMIX25_SET(BIAS_BIAS3_PWD_IR5GTXMIX25_RESET) | \ - BIAS_BIAS3_PWD_IR5GAGC25_SET(BIAS_BIAS3_PWD_IR5GAGC25_RESET) | \ - BIAS_BIAS3_PWD_ICDAC50_SET(BIAS_BIAS3_PWD_ICDAC50_RESET) | \ - BIAS_BIAS3_PWD_ICSYNTH50_SET(BIAS_BIAS3_PWD_ICSYNTH50_RESET) | \ - BIAS_BIAS3_PWD_ICBB50_SET(BIAS_BIAS3_PWD_ICBB50_RESET) | \ - BIAS_BIAS3_PWD_IC2GDIV50_SET(BIAS_BIAS3_PWD_IC2GDIV50_RESET) | \ - BIAS_BIAS3_PWD_IRSYNTH50_SET(BIAS_BIAS3_PWD_IRSYNTH50_RESET) | \ - BIAS_BIAS3_PWD_IRBB50_SET(BIAS_BIAS3_PWD_IRBB50_RESET) | \ - BIAS_BIAS3_PWD_IC25SPARE1_SET(BIAS_BIAS3_PWD_IC25SPARE1_RESET) | \ - BIAS_BIAS3_PWD_IC25SPARE2_SET(BIAS_BIAS3_PWD_IC25SPARE2_RESET) | \ - BIAS_BIAS3_PWD_IR25SPARE1_SET(BIAS_BIAS3_PWD_IR25SPARE1_RESET) | \ - BIAS_BIAS3_PWD_IR25SPARE2_SET(BIAS_BIAS3_PWD_IR25SPARE2_RESET) | \ - BIAS_BIAS3_PWD_ICDACREG12P5_SET(BIAS_BIAS3_PWD_ICDACREG12P5_RESET) | \ - BIAS_BIAS3_SPARE_SET(BIAS_BIAS3_SPARE_RESET)) -#define BIAS_BIAS3_HW_MASK (32'h0) -#define BIAS_BIAS3_SW_MASK (32'h0 | \ - BIAS_BIAS3_PWD_IR5GTXMIX25_MASK | \ - BIAS_BIAS3_PWD_IR5GAGC25_MASK | \ - BIAS_BIAS3_PWD_ICDAC50_MASK | \ - BIAS_BIAS3_PWD_ICSYNTH50_MASK | \ - BIAS_BIAS3_PWD_ICBB50_MASK | \ - BIAS_BIAS3_PWD_IC2GDIV50_MASK | \ - BIAS_BIAS3_PWD_IRSYNTH50_MASK | \ - BIAS_BIAS3_PWD_IRBB50_MASK | \ - BIAS_BIAS3_PWD_IC25SPARE1_MASK | \ - BIAS_BIAS3_PWD_IC25SPARE2_MASK | \ - BIAS_BIAS3_PWD_IR25SPARE1_MASK | \ - BIAS_BIAS3_PWD_IR25SPARE2_MASK | \ - BIAS_BIAS3_PWD_ICDACREG12P5_MASK | \ - BIAS_BIAS3_SPARE_MASK) - -#define TXPC_TXPC_ADDRESS 'h00000048 -#define TXPC_TXPC_SELINTPD_MSB 31 -#define TXPC_TXPC_SELINTPD_LSB 31 -#define TXPC_TXPC_SELINTPD_MASK 'h80000000 -#define TXPC_TXPC_SELINTPD_GET(x) (((x) & TXPC_TXPC_SELINTPD_MASK) >> TXPC_TXPC_SELINTPD_LSB) -#define TXPC_TXPC_SELINTPD_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELINTPD_LSB) & TXPC_TXPC_SELINTPD_MASK) -#define TXPC_TXPC_SELINTPD_RESET 1'h0 -#define TXPC_TXPC_TEST_MSB 30 -#define TXPC_TXPC_TEST_LSB 30 -#define TXPC_TXPC_TEST_MASK 'h40000000 -#define TXPC_TXPC_TEST_GET(x) (((x) & TXPC_TXPC_TEST_MASK) >> TXPC_TXPC_TEST_LSB) -#define TXPC_TXPC_TEST_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TEST_LSB) & TXPC_TXPC_TEST_MASK) -#define TXPC_TXPC_TEST_RESET 1'h0 -#define TXPC_TXPC_TESTGAIN_MSB 29 -#define TXPC_TXPC_TESTGAIN_LSB 28 -#define TXPC_TXPC_TESTGAIN_MASK 'h30000000 -#define TXPC_TXPC_TESTGAIN_GET(x) (((x) & TXPC_TXPC_TESTGAIN_MASK) >> TXPC_TXPC_TESTGAIN_LSB) -#define TXPC_TXPC_TESTGAIN_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TESTGAIN_LSB) & TXPC_TXPC_TESTGAIN_MASK) -#define TXPC_TXPC_TESTGAIN_RESET 2'h0 -#define TXPC_TXPC_TESTDAC_MSB 27 -#define TXPC_TXPC_TESTDAC_LSB 22 -#define TXPC_TXPC_TESTDAC_MASK 'h0fc00000 -#define TXPC_TXPC_TESTDAC_GET(x) (((x) & TXPC_TXPC_TESTDAC_MASK) >> TXPC_TXPC_TESTDAC_LSB) -#define TXPC_TXPC_TESTDAC_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TESTDAC_LSB) & TXPC_TXPC_TESTDAC_MASK) -#define TXPC_TXPC_TESTDAC_RESET 6'h20 -#define TXPC_TXPC_TESTPWDPC_MSB 21 -#define TXPC_TXPC_TESTPWDPC_LSB 21 -#define TXPC_TXPC_TESTPWDPC_MASK 'h00200000 -#define TXPC_TXPC_TESTPWDPC_GET(x) (((x) & TXPC_TXPC_TESTPWDPC_MASK) >> TXPC_TXPC_TESTPWDPC_LSB) -#define TXPC_TXPC_TESTPWDPC_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TESTPWDPC_LSB) & TXPC_TXPC_TESTPWDPC_MASK) -#define TXPC_TXPC_TESTPWDPC_RESET 1'h0 -#define TXPC_TXPC_CURHALF_MSB 20 -#define TXPC_TXPC_CURHALF_LSB 20 -#define TXPC_TXPC_CURHALF_MASK 'h00100000 -#define TXPC_TXPC_CURHALF_GET(x) (((x) & TXPC_TXPC_CURHALF_MASK) >> TXPC_TXPC_CURHALF_LSB) -#define TXPC_TXPC_CURHALF_SET(x) (((32'd0 | (x)) << TXPC_TXPC_CURHALF_LSB) & TXPC_TXPC_CURHALF_MASK) -#define TXPC_TXPC_CURHALF_RESET 1'h1 -#define TXPC_TXPC_NEGOUT_MSB 19 -#define TXPC_TXPC_NEGOUT_LSB 19 -#define TXPC_TXPC_NEGOUT_MASK 'h00080000 -#define TXPC_TXPC_NEGOUT_GET(x) (((x) & TXPC_TXPC_NEGOUT_MASK) >> TXPC_TXPC_NEGOUT_LSB) -#define TXPC_TXPC_NEGOUT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_NEGOUT_LSB) & TXPC_TXPC_NEGOUT_MASK) -#define TXPC_TXPC_NEGOUT_RESET 1'h0 -#define TXPC_TXPC_CLKDELAY_MSB 18 -#define TXPC_TXPC_CLKDELAY_LSB 18 -#define TXPC_TXPC_CLKDELAY_MASK 'h00040000 -#define TXPC_TXPC_CLKDELAY_GET(x) (((x) & TXPC_TXPC_CLKDELAY_MASK) >> TXPC_TXPC_CLKDELAY_LSB) -#define TXPC_TXPC_CLKDELAY_SET(x) (((32'd0 | (x)) << TXPC_TXPC_CLKDELAY_LSB) & TXPC_TXPC_CLKDELAY_MASK) -#define TXPC_TXPC_CLKDELAY_RESET 1'h0 -#define TXPC_TXPC_SELMODREF_MSB 17 -#define TXPC_TXPC_SELMODREF_LSB 17 -#define TXPC_TXPC_SELMODREF_MASK 'h00020000 -#define TXPC_TXPC_SELMODREF_GET(x) (((x) & TXPC_TXPC_SELMODREF_MASK) >> TXPC_TXPC_SELMODREF_LSB) -#define TXPC_TXPC_SELMODREF_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELMODREF_LSB) & TXPC_TXPC_SELMODREF_MASK) -#define TXPC_TXPC_SELMODREF_RESET 1'h0 -#define TXPC_TXPC_SELCMOUT_MSB 16 -#define TXPC_TXPC_SELCMOUT_LSB 16 -#define TXPC_TXPC_SELCMOUT_MASK 'h00010000 -#define TXPC_TXPC_SELCMOUT_GET(x) (((x) & TXPC_TXPC_SELCMOUT_MASK) >> TXPC_TXPC_SELCMOUT_LSB) -#define TXPC_TXPC_SELCMOUT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELCMOUT_LSB) & TXPC_TXPC_SELCMOUT_MASK) -#define TXPC_TXPC_SELCMOUT_RESET 1'h0 -#define TXPC_TXPC_TSMODE_MSB 15 -#define TXPC_TXPC_TSMODE_LSB 14 -#define TXPC_TXPC_TSMODE_MASK 'h0000c000 -#define TXPC_TXPC_TSMODE_GET(x) (((x) & TXPC_TXPC_TSMODE_MASK) >> TXPC_TXPC_TSMODE_LSB) -#define TXPC_TXPC_TSMODE_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TSMODE_LSB) & TXPC_TXPC_TSMODE_MASK) -#define TXPC_TXPC_TSMODE_RESET 2'h0 -#define TXPC_TXPC_N_MSB 13 -#define TXPC_TXPC_N_LSB 6 -#define TXPC_TXPC_N_MASK 'h00003fc0 -#define TXPC_TXPC_N_GET(x) (((x) & TXPC_TXPC_N_MASK) >> TXPC_TXPC_N_LSB) -#define TXPC_TXPC_N_SET(x) (((32'd0 | (x)) << TXPC_TXPC_N_LSB) & TXPC_TXPC_N_MASK) -#define TXPC_TXPC_N_RESET 8'h80 -#define TXPC_TXPC_ON1STSYNTHON_MSB 5 -#define TXPC_TXPC_ON1STSYNTHON_LSB 5 -#define TXPC_TXPC_ON1STSYNTHON_MASK 'h00000020 -#define TXPC_TXPC_ON1STSYNTHON_GET(x) (((x) & TXPC_TXPC_ON1STSYNTHON_MASK) >> TXPC_TXPC_ON1STSYNTHON_LSB) -#define TXPC_TXPC_ON1STSYNTHON_SET(x) (((32'd0 | (x)) << TXPC_TXPC_ON1STSYNTHON_LSB) & TXPC_TXPC_ON1STSYNTHON_MASK) -#define TXPC_TXPC_ON1STSYNTHON_RESET 1'h1 -#define TXPC_TXPC_SELINIT_MSB 4 -#define TXPC_TXPC_SELINIT_LSB 3 -#define TXPC_TXPC_SELINIT_MASK 'h00000018 -#define TXPC_TXPC_SELINIT_GET(x) (((x) & TXPC_TXPC_SELINIT_MASK) >> TXPC_TXPC_SELINIT_LSB) -#define TXPC_TXPC_SELINIT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELINIT_LSB) & TXPC_TXPC_SELINIT_MASK) -#define TXPC_TXPC_SELINIT_RESET 2'h3 -#define TXPC_TXPC_SELCOUNT_MSB 2 -#define TXPC_TXPC_SELCOUNT_LSB 2 -#define TXPC_TXPC_SELCOUNT_MASK 'h00000004 -#define TXPC_TXPC_SELCOUNT_GET(x) (((x) & TXPC_TXPC_SELCOUNT_MASK) >> TXPC_TXPC_SELCOUNT_LSB) -#define TXPC_TXPC_SELCOUNT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELCOUNT_LSB) & TXPC_TXPC_SELCOUNT_MASK) -#define TXPC_TXPC_SELCOUNT_RESET 1'h1 -#define TXPC_TXPC_ATBSEL_MSB 1 -#define TXPC_TXPC_ATBSEL_LSB 0 -#define TXPC_TXPC_ATBSEL_MASK 'h00000003 -#define TXPC_TXPC_ATBSEL_GET(x) (((x) & TXPC_TXPC_ATBSEL_MASK) >> TXPC_TXPC_ATBSEL_LSB) -#define TXPC_TXPC_ATBSEL_SET(x) (((32'd0 | (x)) << TXPC_TXPC_ATBSEL_LSB) & TXPC_TXPC_ATBSEL_MASK) -#define TXPC_TXPC_ATBSEL_RESET 2'h0 -#define TXPC_TXPC_RESET (32'h0 | \ - TXPC_TXPC_SELINTPD_SET(TXPC_TXPC_SELINTPD_RESET) | \ - TXPC_TXPC_TEST_SET(TXPC_TXPC_TEST_RESET) | \ - TXPC_TXPC_TESTGAIN_SET(TXPC_TXPC_TESTGAIN_RESET) | \ - TXPC_TXPC_TESTDAC_SET(TXPC_TXPC_TESTDAC_RESET) | \ - TXPC_TXPC_TESTPWDPC_SET(TXPC_TXPC_TESTPWDPC_RESET) | \ - TXPC_TXPC_CURHALF_SET(TXPC_TXPC_CURHALF_RESET) | \ - TXPC_TXPC_NEGOUT_SET(TXPC_TXPC_NEGOUT_RESET) | \ - TXPC_TXPC_CLKDELAY_SET(TXPC_TXPC_CLKDELAY_RESET) | \ - TXPC_TXPC_SELMODREF_SET(TXPC_TXPC_SELMODREF_RESET) | \ - TXPC_TXPC_SELCMOUT_SET(TXPC_TXPC_SELCMOUT_RESET) | \ - TXPC_TXPC_TSMODE_SET(TXPC_TXPC_TSMODE_RESET) | \ - TXPC_TXPC_N_SET(TXPC_TXPC_N_RESET) | \ - TXPC_TXPC_ON1STSYNTHON_SET(TXPC_TXPC_ON1STSYNTHON_RESET) | \ - TXPC_TXPC_SELINIT_SET(TXPC_TXPC_SELINIT_RESET) | \ - TXPC_TXPC_SELCOUNT_SET(TXPC_TXPC_SELCOUNT_RESET) | \ - TXPC_TXPC_ATBSEL_SET(TXPC_TXPC_ATBSEL_RESET)) -#define TXPC_TXPC_HW_MASK (32'h0) -#define TXPC_TXPC_SW_MASK (32'h0 | \ - TXPC_TXPC_SELINTPD_MASK | \ - TXPC_TXPC_TEST_MASK | \ - TXPC_TXPC_TESTGAIN_MASK | \ - TXPC_TXPC_TESTDAC_MASK | \ - TXPC_TXPC_TESTPWDPC_MASK | \ - TXPC_TXPC_CURHALF_MASK | \ - TXPC_TXPC_NEGOUT_MASK | \ - TXPC_TXPC_CLKDELAY_MASK | \ - TXPC_TXPC_SELMODREF_MASK | \ - TXPC_TXPC_SELCMOUT_MASK | \ - TXPC_TXPC_TSMODE_MASK | \ - TXPC_TXPC_N_MASK | \ - TXPC_TXPC_ON1STSYNTHON_MASK | \ - TXPC_TXPC_SELINIT_MASK | \ - TXPC_TXPC_SELCOUNT_MASK | \ - TXPC_TXPC_ATBSEL_MASK) - -#define TXPC_MISC_ADDRESS 'h0000004c -#define TXPC_MISC_FLIPBMODE_MSB 31 -#define TXPC_MISC_FLIPBMODE_LSB 31 -#define TXPC_MISC_FLIPBMODE_MASK 'h80000000 -#define TXPC_MISC_FLIPBMODE_GET(x) (((x) & TXPC_MISC_FLIPBMODE_MASK) >> TXPC_MISC_FLIPBMODE_LSB) -#define TXPC_MISC_FLIPBMODE_SET(x) (((32'd0 | (x)) << TXPC_MISC_FLIPBMODE_LSB) & TXPC_MISC_FLIPBMODE_MASK) -#define TXPC_MISC_FLIPBMODE_RESET 1'h0 -#define TXPC_MISC_LEVEL_MSB 30 -#define TXPC_MISC_LEVEL_LSB 29 -#define TXPC_MISC_LEVEL_MASK 'h60000000 -#define TXPC_MISC_LEVEL_GET(x) (((x) & TXPC_MISC_LEVEL_MASK) >> TXPC_MISC_LEVEL_LSB) -#define TXPC_MISC_LEVEL_SET(x) (((32'd0 | (x)) << TXPC_MISC_LEVEL_LSB) & TXPC_MISC_LEVEL_MASK) -#define TXPC_MISC_LEVEL_RESET 2'h0 -#define TXPC_MISC_LDO_TEST_MODE_MSB 28 -#define TXPC_MISC_LDO_TEST_MODE_LSB 28 -#define TXPC_MISC_LDO_TEST_MODE_MASK 'h10000000 -#define TXPC_MISC_LDO_TEST_MODE_GET(x) (((x) & TXPC_MISC_LDO_TEST_MODE_MASK) >> TXPC_MISC_LDO_TEST_MODE_LSB) -#define TXPC_MISC_LDO_TEST_MODE_SET(x) (((32'd0 | (x)) << TXPC_MISC_LDO_TEST_MODE_LSB) & TXPC_MISC_LDO_TEST_MODE_MASK) -#define TXPC_MISC_LDO_TEST_MODE_RESET 1'h0 -#define TXPC_MISC_NOTCXODET_MSB 27 -#define TXPC_MISC_NOTCXODET_LSB 27 -#define TXPC_MISC_NOTCXODET_MASK 'h08000000 -#define TXPC_MISC_NOTCXODET_GET(x) (((x) & TXPC_MISC_NOTCXODET_MASK) >> TXPC_MISC_NOTCXODET_LSB) -#define TXPC_MISC_NOTCXODET_SET(x) (((32'd0 | (x)) << TXPC_MISC_NOTCXODET_LSB) & TXPC_MISC_NOTCXODET_MASK) -#define TXPC_MISC_NOTCXODET_RESET 1'h0 -#define TXPC_MISC_PWDCLKIND_MSB 26 -#define TXPC_MISC_PWDCLKIND_LSB 26 -#define TXPC_MISC_PWDCLKIND_MASK 'h04000000 -#define TXPC_MISC_PWDCLKIND_GET(x) (((x) & TXPC_MISC_PWDCLKIND_MASK) >> TXPC_MISC_PWDCLKIND_LSB) -#define TXPC_MISC_PWDCLKIND_SET(x) (((32'd0 | (x)) << TXPC_MISC_PWDCLKIND_LSB) & TXPC_MISC_PWDCLKIND_MASK) -#define TXPC_MISC_PWDCLKIND_RESET 1'h0 -#define TXPC_MISC_PWDXINPAD_MSB 25 -#define TXPC_MISC_PWDXINPAD_LSB 25 -#define TXPC_MISC_PWDXINPAD_MASK 'h02000000 -#define TXPC_MISC_PWDXINPAD_GET(x) (((x) & TXPC_MISC_PWDXINPAD_MASK) >> TXPC_MISC_PWDXINPAD_LSB) -#define TXPC_MISC_PWDXINPAD_SET(x) (((32'd0 | (x)) << TXPC_MISC_PWDXINPAD_LSB) & TXPC_MISC_PWDXINPAD_MASK) -#define TXPC_MISC_PWDXINPAD_RESET 1'h0 -#define TXPC_MISC_LOCALBIAS_MSB 24 -#define TXPC_MISC_LOCALBIAS_LSB 24 -#define TXPC_MISC_LOCALBIAS_MASK 'h01000000 -#define TXPC_MISC_LOCALBIAS_GET(x) (((x) & TXPC_MISC_LOCALBIAS_MASK) >> TXPC_MISC_LOCALBIAS_LSB) -#define TXPC_MISC_LOCALBIAS_SET(x) (((32'd0 | (x)) << TXPC_MISC_LOCALBIAS_LSB) & TXPC_MISC_LOCALBIAS_MASK) -#define TXPC_MISC_LOCALBIAS_RESET 1'h1 -#define TXPC_MISC_LOCALBIAS2X_MSB 23 -#define TXPC_MISC_LOCALBIAS2X_LSB 23 -#define TXPC_MISC_LOCALBIAS2X_MASK 'h00800000 -#define TXPC_MISC_LOCALBIAS2X_GET(x) (((x) & TXPC_MISC_LOCALBIAS2X_MASK) >> TXPC_MISC_LOCALBIAS2X_LSB) -#define TXPC_MISC_LOCALBIAS2X_SET(x) (((32'd0 | (x)) << TXPC_MISC_LOCALBIAS2X_LSB) & TXPC_MISC_LOCALBIAS2X_MASK) -#define TXPC_MISC_LOCALBIAS2X_RESET 1'h0 -#define TXPC_MISC_SELTSP_MSB 22 -#define TXPC_MISC_SELTSP_LSB 22 -#define TXPC_MISC_SELTSP_MASK 'h00400000 -#define TXPC_MISC_SELTSP_GET(x) (((x) & TXPC_MISC_SELTSP_MASK) >> TXPC_MISC_SELTSP_LSB) -#define TXPC_MISC_SELTSP_SET(x) (((32'd0 | (x)) << TXPC_MISC_SELTSP_LSB) & TXPC_MISC_SELTSP_MASK) -#define TXPC_MISC_SELTSP_RESET 1'h0 -#define TXPC_MISC_SELTSN_MSB 21 -#define TXPC_MISC_SELTSN_LSB 21 -#define TXPC_MISC_SELTSN_MASK 'h00200000 -#define TXPC_MISC_SELTSN_GET(x) (((x) & TXPC_MISC_SELTSN_MASK) >> TXPC_MISC_SELTSN_LSB) -#define TXPC_MISC_SELTSN_SET(x) (((32'd0 | (x)) << TXPC_MISC_SELTSN_LSB) & TXPC_MISC_SELTSN_MASK) -#define TXPC_MISC_SELTSN_RESET 1'h0 -#define TXPC_MISC_SPARE_A_MSB 20 -#define TXPC_MISC_SPARE_A_LSB 18 -#define TXPC_MISC_SPARE_A_MASK 'h001c0000 -#define TXPC_MISC_SPARE_A_GET(x) (((x) & TXPC_MISC_SPARE_A_MASK) >> TXPC_MISC_SPARE_A_LSB) -#define TXPC_MISC_SPARE_A_SET(x) (((32'd0 | (x)) << TXPC_MISC_SPARE_A_LSB) & TXPC_MISC_SPARE_A_MASK) -#define TXPC_MISC_SPARE_A_RESET 3'h0 -#define TXPC_MISC_DECOUT_MSB 17 -#define TXPC_MISC_DECOUT_LSB 8 -#define TXPC_MISC_DECOUT_MASK 'h0003ff00 -#define TXPC_MISC_DECOUT_GET(x) (((x) & TXPC_MISC_DECOUT_MASK) >> TXPC_MISC_DECOUT_LSB) -#define TXPC_MISC_DECOUT_SET(x) (((32'd0 | (x)) << TXPC_MISC_DECOUT_LSB) & TXPC_MISC_DECOUT_MASK) -#define TXPC_MISC_DECOUT_RESET 10'h0 -#define TXPC_MISC_XTALDIV_MSB 7 -#define TXPC_MISC_XTALDIV_LSB 6 -#define TXPC_MISC_XTALDIV_MASK 'h000000c0 -#define TXPC_MISC_XTALDIV_GET(x) (((x) & TXPC_MISC_XTALDIV_MASK) >> TXPC_MISC_XTALDIV_LSB) -#define TXPC_MISC_XTALDIV_SET(x) (((32'd0 | (x)) << TXPC_MISC_XTALDIV_LSB) & TXPC_MISC_XTALDIV_MASK) -#define TXPC_MISC_XTALDIV_RESET 2'h0 -#define TXPC_MISC_SPARE_MSB 5 -#define TXPC_MISC_SPARE_LSB 0 -#define TXPC_MISC_SPARE_MASK 'h0000003f -#define TXPC_MISC_SPARE_GET(x) (((x) & TXPC_MISC_SPARE_MASK) >> TXPC_MISC_SPARE_LSB) -#define TXPC_MISC_SPARE_SET(x) (((32'd0 | (x)) << TXPC_MISC_SPARE_LSB) & TXPC_MISC_SPARE_MASK) -#define TXPC_MISC_SPARE_RESET 6'h0 -#define TXPC_MISC_RESET (32'h0 | \ - TXPC_MISC_FLIPBMODE_SET(TXPC_MISC_FLIPBMODE_RESET) | \ - TXPC_MISC_LEVEL_SET(TXPC_MISC_LEVEL_RESET) | \ - TXPC_MISC_LDO_TEST_MODE_SET(TXPC_MISC_LDO_TEST_MODE_RESET) | \ - TXPC_MISC_NOTCXODET_SET(TXPC_MISC_NOTCXODET_RESET) | \ - TXPC_MISC_PWDCLKIND_SET(TXPC_MISC_PWDCLKIND_RESET) | \ - TXPC_MISC_PWDXINPAD_SET(TXPC_MISC_PWDXINPAD_RESET) | \ - TXPC_MISC_LOCALBIAS_SET(TXPC_MISC_LOCALBIAS_RESET) | \ - TXPC_MISC_LOCALBIAS2X_SET(TXPC_MISC_LOCALBIAS2X_RESET) | \ - TXPC_MISC_SELTSP_SET(TXPC_MISC_SELTSP_RESET) | \ - TXPC_MISC_SELTSN_SET(TXPC_MISC_SELTSN_RESET) | \ - TXPC_MISC_SPARE_A_SET(TXPC_MISC_SPARE_A_RESET) | \ - TXPC_MISC_DECOUT_SET(TXPC_MISC_DECOUT_RESET) | \ - TXPC_MISC_XTALDIV_SET(TXPC_MISC_XTALDIV_RESET) | \ - TXPC_MISC_SPARE_SET(TXPC_MISC_SPARE_RESET)) -#define TXPC_MISC_HW_MASK (32'h0 | \ - TXPC_MISC_DECOUT_MASK) -#define TXPC_MISC_SW_MASK (32'h0 | \ - TXPC_MISC_FLIPBMODE_MASK | \ - TXPC_MISC_LEVEL_MASK | \ - TXPC_MISC_LDO_TEST_MODE_MASK | \ - TXPC_MISC_NOTCXODET_MASK | \ - TXPC_MISC_PWDCLKIND_MASK | \ - TXPC_MISC_PWDXINPAD_MASK | \ - TXPC_MISC_LOCALBIAS_MASK | \ - TXPC_MISC_LOCALBIAS2X_MASK | \ - TXPC_MISC_SELTSP_MASK | \ - TXPC_MISC_SELTSN_MASK | \ - TXPC_MISC_SPARE_A_MASK | \ - TXPC_MISC_DECOUT_MASK | \ - TXPC_MISC_XTALDIV_MASK | \ - TXPC_MISC_SPARE_MASK) - -#define RXTXBB_RXTXBB1_ADDRESS 'h00000050 -#define RXTXBB_RXTXBB1_SPARE_MSB 31 -#define RXTXBB_RXTXBB1_SPARE_LSB 19 -#define RXTXBB_RXTXBB1_SPARE_MASK 'hfff80000 -#define RXTXBB_RXTXBB1_SPARE_GET(x) (((x) & RXTXBB_RXTXBB1_SPARE_MASK) >> RXTXBB_RXTXBB1_SPARE_LSB) -#define RXTXBB_RXTXBB1_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_SPARE_LSB) & RXTXBB_RXTXBB1_SPARE_MASK) -#define RXTXBB_RXTXBB1_SPARE_RESET 13'h0 -#define RXTXBB_RXTXBB1_FNOTCH_MSB 18 -#define RXTXBB_RXTXBB1_FNOTCH_LSB 17 -#define RXTXBB_RXTXBB1_FNOTCH_MASK 'h00060000 -#define RXTXBB_RXTXBB1_FNOTCH_GET(x) (((x) & RXTXBB_RXTXBB1_FNOTCH_MASK) >> RXTXBB_RXTXBB1_FNOTCH_LSB) -#define RXTXBB_RXTXBB1_FNOTCH_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_FNOTCH_LSB) & RXTXBB_RXTXBB1_FNOTCH_MASK) -#define RXTXBB_RXTXBB1_FNOTCH_RESET 2'h0 -#define RXTXBB_RXTXBB1_SEL_ATB_MSB 16 -#define RXTXBB_RXTXBB1_SEL_ATB_LSB 9 -#define RXTXBB_RXTXBB1_SEL_ATB_MASK 'h0001fe00 -#define RXTXBB_RXTXBB1_SEL_ATB_GET(x) (((x) & RXTXBB_RXTXBB1_SEL_ATB_MASK) >> RXTXBB_RXTXBB1_SEL_ATB_LSB) -#define RXTXBB_RXTXBB1_SEL_ATB_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_SEL_ATB_LSB) & RXTXBB_RXTXBB1_SEL_ATB_MASK) -#define RXTXBB_RXTXBB1_SEL_ATB_RESET 8'h0 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_LSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MASK 'h00000100 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_GET(x) (((x) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) >> RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDV2I_MSB 7 -#define RXTXBB_RXTXBB1_PDV2I_LSB 7 -#define RXTXBB_RXTXBB1_PDV2I_MASK 'h00000080 -#define RXTXBB_RXTXBB1_PDV2I_GET(x) (((x) & RXTXBB_RXTXBB1_PDV2I_MASK) >> RXTXBB_RXTXBB1_PDV2I_LSB) -#define RXTXBB_RXTXBB1_PDV2I_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDV2I_LSB) & RXTXBB_RXTXBB1_PDV2I_MASK) -#define RXTXBB_RXTXBB1_PDV2I_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDI2V_MSB 6 -#define RXTXBB_RXTXBB1_PDI2V_LSB 6 -#define RXTXBB_RXTXBB1_PDI2V_MASK 'h00000040 -#define RXTXBB_RXTXBB1_PDI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDI2V_MASK) >> RXTXBB_RXTXBB1_PDI2V_LSB) -#define RXTXBB_RXTXBB1_PDI2V_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDI2V_LSB) & RXTXBB_RXTXBB1_PDI2V_MASK) -#define RXTXBB_RXTXBB1_PDI2V_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDRXTXBB_MSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_LSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_MASK 'h00000020 -#define RXTXBB_RXTXBB1_PDRXTXBB_GET(x) (((x) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) >> RXTXBB_RXTXBB1_PDRXTXBB_LSB) -#define RXTXBB_RXTXBB1_PDRXTXBB_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDRXTXBB_LSB) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) -#define RXTXBB_RXTXBB1_PDRXTXBB_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK 'h00000010 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK 'h00000008 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_LSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MASK 'h00000004 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) >> RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDLOQ_MSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_LSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_MASK 'h00000002 -#define RXTXBB_RXTXBB1_PDLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDLOQ_MASK) >> RXTXBB_RXTXBB1_PDLOQ_LSB) -#define RXTXBB_RXTXBB1_PDLOQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDLOQ_LSB) & RXTXBB_RXTXBB1_PDLOQ_MASK) -#define RXTXBB_RXTXBB1_PDLOQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDHIQ_MSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_LSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_MASK 'h00000001 -#define RXTXBB_RXTXBB1_PDHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDHIQ_MASK) >> RXTXBB_RXTXBB1_PDHIQ_LSB) -#define RXTXBB_RXTXBB1_PDHIQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDHIQ_LSB) & RXTXBB_RXTXBB1_PDHIQ_MASK) -#define RXTXBB_RXTXBB1_PDHIQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_RESET (32'h0 | \ - RXTXBB_RXTXBB1_SPARE_SET(RXTXBB_RXTXBB1_SPARE_RESET) | \ - RXTXBB_RXTXBB1_FNOTCH_SET(RXTXBB_RXTXBB1_FNOTCH_RESET) | \ - RXTXBB_RXTXBB1_SEL_ATB_SET(RXTXBB_RXTXBB1_SEL_ATB_RESET) | \ - RXTXBB_RXTXBB1_PDDACINTERFACE_SET(RXTXBB_RXTXBB1_PDDACINTERFACE_RESET) | \ - RXTXBB_RXTXBB1_PDV2I_SET(RXTXBB_RXTXBB1_PDV2I_RESET) | \ - RXTXBB_RXTXBB1_PDI2V_SET(RXTXBB_RXTXBB1_PDI2V_RESET) | \ - RXTXBB_RXTXBB1_PDRXTXBB_SET(RXTXBB_RXTXBB1_PDRXTXBB_RESET) | \ - RXTXBB_RXTXBB1_PDOFFSETLOQ_SET(RXTXBB_RXTXBB1_PDOFFSETLOQ_RESET) | \ - RXTXBB_RXTXBB1_PDOFFSETHIQ_SET(RXTXBB_RXTXBB1_PDOFFSETHIQ_RESET) | \ - RXTXBB_RXTXBB1_PDOFFSETI2V_SET(RXTXBB_RXTXBB1_PDOFFSETI2V_RESET) | \ - RXTXBB_RXTXBB1_PDLOQ_SET(RXTXBB_RXTXBB1_PDLOQ_RESET) | \ - RXTXBB_RXTXBB1_PDHIQ_SET(RXTXBB_RXTXBB1_PDHIQ_RESET)) -#define RXTXBB_RXTXBB1_HW_MASK (32'h0) -#define RXTXBB_RXTXBB1_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB1_SPARE_MASK | \ - RXTXBB_RXTXBB1_FNOTCH_MASK | \ - RXTXBB_RXTXBB1_SEL_ATB_MASK | \ - RXTXBB_RXTXBB1_PDDACINTERFACE_MASK | \ - RXTXBB_RXTXBB1_PDV2I_MASK | \ - RXTXBB_RXTXBB1_PDI2V_MASK | \ - RXTXBB_RXTXBB1_PDRXTXBB_MASK | \ - RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK | \ - RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK | \ - RXTXBB_RXTXBB1_PDOFFSETI2V_MASK | \ - RXTXBB_RXTXBB1_PDLOQ_MASK | \ - RXTXBB_RXTXBB1_PDHIQ_MASK) - -#define RXTXBB_RXTXBB2_ADDRESS 'h00000054 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MSB 31 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB 29 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK 'he0000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_RESET 3'h6 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MSB 28 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB 26 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK 'h1c000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_RESET 3'h6 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MSB 25 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB 23 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK 'h03800000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_RESET 3'h6 -#define RXTXBB_RXTXBB2_SPARE_MSB 22 -#define RXTXBB_RXTXBB2_SPARE_LSB 21 -#define RXTXBB_RXTXBB2_SPARE_MASK 'h00600000 -#define RXTXBB_RXTXBB2_SPARE_GET(x) (((x) & RXTXBB_RXTXBB2_SPARE_MASK) >> RXTXBB_RXTXBB2_SPARE_LSB) -#define RXTXBB_RXTXBB2_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SPARE_LSB) & RXTXBB_RXTXBB2_SPARE_MASK) -#define RXTXBB_RXTXBB2_SPARE_RESET 2'h0 -#define RXTXBB_RXTXBB2_SHORTBUFFER_MSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_LSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_MASK 'h00100000 -#define RXTXBB_RXTXBB2_SHORTBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) >> RXTXBB_RXTXBB2_SHORTBUFFER_LSB) -#define RXTXBB_RXTXBB2_SHORTBUFFER_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SHORTBUFFER_LSB) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) -#define RXTXBB_RXTXBB2_SHORTBUFFER_RESET 1'h0 -#define RXTXBB_RXTXBB2_SELBUFFER_MSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_LSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_MASK 'h00080000 -#define RXTXBB_RXTXBB2_SELBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SELBUFFER_MASK) >> RXTXBB_RXTXBB2_SELBUFFER_LSB) -#define RXTXBB_RXTXBB2_SELBUFFER_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SELBUFFER_LSB) & RXTXBB_RXTXBB2_SELBUFFER_MASK) -#define RXTXBB_RXTXBB2_SELBUFFER_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK 'h00040000 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK 'h00020000 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK 'h00010000 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK 'h00008000 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_CMSEL_MSB 14 -#define RXTXBB_RXTXBB2_CMSEL_LSB 13 -#define RXTXBB_RXTXBB2_CMSEL_MASK 'h00006000 -#define RXTXBB_RXTXBB2_CMSEL_GET(x) (((x) & RXTXBB_RXTXBB2_CMSEL_MASK) >> RXTXBB_RXTXBB2_CMSEL_LSB) -#define RXTXBB_RXTXBB2_CMSEL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_CMSEL_LSB) & RXTXBB_RXTXBB2_CMSEL_MASK) -#define RXTXBB_RXTXBB2_CMSEL_RESET 2'h1 -#define RXTXBB_RXTXBB2_FILTERFC_MSB 12 -#define RXTXBB_RXTXBB2_FILTERFC_LSB 8 -#define RXTXBB_RXTXBB2_FILTERFC_MASK 'h00001f00 -#define RXTXBB_RXTXBB2_FILTERFC_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERFC_MASK) >> RXTXBB_RXTXBB2_FILTERFC_LSB) -#define RXTXBB_RXTXBB2_FILTERFC_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_FILTERFC_LSB) & RXTXBB_RXTXBB2_FILTERFC_MASK) -#define RXTXBB_RXTXBB2_FILTERFC_RESET 5'h10 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK 'h00000080 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_GET(x) (((x) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) >> RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_RESET 1'h0 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK 'h00000040 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) >> RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK 'h00000020 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK 'h00000010 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_RESET 1'h1 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK 'h00000008 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK 'h00000004 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK 'h00000002 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_RESET 1'h1 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK 'h00000001 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_GET(x) (((x) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) >> RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_RESET 1'h0 -#define RXTXBB_RXTXBB2_RESET (32'h0 | \ - RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_SET(RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_RESET) | \ - RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_SET(RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_RESET) | \ - RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_SET(RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_RESET) | \ - RXTXBB_RXTXBB2_SPARE_SET(RXTXBB_RXTXBB2_SPARE_RESET) | \ - RXTXBB_RXTXBB2_SHORTBUFFER_SET(RXTXBB_RXTXBB2_SHORTBUFFER_RESET) | \ - RXTXBB_RXTXBB2_SELBUFFER_SET(RXTXBB_RXTXBB2_SELBUFFER_RESET) | \ - RXTXBB_RXTXBB2_SEL_DAC_TEST_SET(RXTXBB_RXTXBB2_SEL_DAC_TEST_RESET) | \ - RXTXBB_RXTXBB2_SEL_LOQ_TEST_SET(RXTXBB_RXTXBB2_SEL_LOQ_TEST_RESET) | \ - RXTXBB_RXTXBB2_SEL_HIQ_TEST_SET(RXTXBB_RXTXBB2_SEL_HIQ_TEST_RESET) | \ - RXTXBB_RXTXBB2_SEL_I2V_TEST_SET(RXTXBB_RXTXBB2_SEL_I2V_TEST_RESET) | \ - RXTXBB_RXTXBB2_CMSEL_SET(RXTXBB_RXTXBB2_CMSEL_RESET) | \ - RXTXBB_RXTXBB2_FILTERFC_SET(RXTXBB_RXTXBB2_FILTERFC_RESET) | \ - RXTXBB_RXTXBB2_LOCALFILTERTUNING_SET(RXTXBB_RXTXBB2_LOCALFILTERTUNING_RESET) | \ - RXTXBB_RXTXBB2_FILTERDOUBLEBW_SET(RXTXBB_RXTXBB2_FILTERDOUBLEBW_RESET) | \ - RXTXBB_RXTXBB2_PATH2HIQ_EN_SET(RXTXBB_RXTXBB2_PATH2HIQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH1HIQ_EN_SET(RXTXBB_RXTXBB2_PATH1HIQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH3LOQ_EN_SET(RXTXBB_RXTXBB2_PATH3LOQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH2LOQ_EN_SET(RXTXBB_RXTXBB2_PATH2LOQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH1LOQ_EN_SET(RXTXBB_RXTXBB2_PATH1LOQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH_OVERRIDE_SET(RXTXBB_RXTXBB2_PATH_OVERRIDE_RESET)) -#define RXTXBB_RXTXBB2_HW_MASK (32'h0 | \ - RXTXBB_RXTXBB2_FILTERFC_MASK) -#define RXTXBB_RXTXBB2_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK | \ - RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK | \ - RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK | \ - RXTXBB_RXTXBB2_SPARE_MASK | \ - RXTXBB_RXTXBB2_SHORTBUFFER_MASK | \ - RXTXBB_RXTXBB2_SELBUFFER_MASK | \ - RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK | \ - RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK | \ - RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK | \ - RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK | \ - RXTXBB_RXTXBB2_CMSEL_MASK | \ - RXTXBB_RXTXBB2_FILTERFC_MASK | \ - RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK | \ - RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK | \ - RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) - -#define RXTXBB_RXTXBB3_ADDRESS 'h00000058 -#define RXTXBB_RXTXBB3_SPARE_MSB 31 -#define RXTXBB_RXTXBB3_SPARE_LSB 27 -#define RXTXBB_RXTXBB3_SPARE_MASK 'hf8000000 -#define RXTXBB_RXTXBB3_SPARE_GET(x) (((x) & RXTXBB_RXTXBB3_SPARE_MASK) >> RXTXBB_RXTXBB3_SPARE_LSB) -#define RXTXBB_RXTXBB3_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_SPARE_LSB) & RXTXBB_RXTXBB3_SPARE_MASK) -#define RXTXBB_RXTXBB3_SPARE_RESET 5'h0 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MSB 26 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB 24 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK 'h07000000 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MSB 23 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB 21 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK 'h00e00000 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MSB 20 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB 18 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK 'h001c0000 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MSB 17 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB 15 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK 'h00038000 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MSB 14 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB 12 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK 'h00007000 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MSB 11 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB 9 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK 'h00000e00 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MSB 8 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB 6 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK 'h000001c0 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MSB 5 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB 3 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK 'h00000038 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) >> RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_RESET 3'h2 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MSB 2 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB 0 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK 'h00000007 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_RESET (32'h0 | \ - RXTXBB_RXTXBB3_SPARE_SET(RXTXBB_RXTXBB3_SPARE_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_SET(RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_SET(RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_RESET)) -#define RXTXBB_RXTXBB3_HW_MASK (32'h0) -#define RXTXBB_RXTXBB3_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB3_SPARE_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) - -#define RXTXBB_RXTXBB4_ADDRESS 'h0000005c -#define RXTXBB_RXTXBB4_SPARE_MSB 31 -#define RXTXBB_RXTXBB4_SPARE_LSB 31 -#define RXTXBB_RXTXBB4_SPARE_MASK 'h80000000 -#define RXTXBB_RXTXBB4_SPARE_GET(x) (((x) & RXTXBB_RXTXBB4_SPARE_MASK) >> RXTXBB_RXTXBB4_SPARE_LSB) -#define RXTXBB_RXTXBB4_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_SPARE_LSB) & RXTXBB_RXTXBB4_SPARE_MASK) -#define RXTXBB_RXTXBB4_SPARE_RESET 1'h0 -#define RXTXBB_RXTXBB4_LOCALOFFSET_MSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_LSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_MASK 'h40000000 -#define RXTXBB_RXTXBB4_LOCALOFFSET_GET(x) (((x) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) >> RXTXBB_RXTXBB4_LOCALOFFSET_LSB) -#define RXTXBB_RXTXBB4_LOCALOFFSET_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_LOCALOFFSET_LSB) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) -#define RXTXBB_RXTXBB4_LOCALOFFSET_RESET 1'h0 -#define RXTXBB_RXTXBB4_OFSTCORRHII_MSB 29 -#define RXTXBB_RXTXBB4_OFSTCORRHII_LSB 25 -#define RXTXBB_RXTXBB4_OFSTCORRHII_MASK 'h3e000000 -#define RXTXBB_RXTXBB4_OFSTCORRHII_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHII_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHII_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRHII_LSB) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHII_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MSB 24 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB 20 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK 'h01f00000 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MSB 19 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_LSB 15 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MASK 'h000f8000 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MSB 14 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB 10 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK 'h00007c00 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MSB 9 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB 5 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK 'h000003e0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MSB 4 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB 0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK 'h0000001f -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_RESET 5'h10 -#define RXTXBB_RXTXBB4_RESET (32'h0 | \ - RXTXBB_RXTXBB4_SPARE_SET(RXTXBB_RXTXBB4_SPARE_RESET) | \ - RXTXBB_RXTXBB4_LOCALOFFSET_SET(RXTXBB_RXTXBB4_LOCALOFFSET_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRHII_SET(RXTXBB_RXTXBB4_OFSTCORRHII_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRHIQ_SET(RXTXBB_RXTXBB4_OFSTCORRHIQ_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRLOI_SET(RXTXBB_RXTXBB4_OFSTCORRLOI_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRLOQ_SET(RXTXBB_RXTXBB4_OFSTCORRLOQ_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRI2VI_SET(RXTXBB_RXTXBB4_OFSTCORRI2VI_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRI2VQ_SET(RXTXBB_RXTXBB4_OFSTCORRI2VQ_RESET)) -#define RXTXBB_RXTXBB4_HW_MASK (32'h0 | \ - RXTXBB_RXTXBB4_OFSTCORRHII_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) -#define RXTXBB_RXTXBB4_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB4_SPARE_MASK | \ - RXTXBB_RXTXBB4_LOCALOFFSET_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRHII_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) - -#define ADDAC_ADDAC1_ADDRESS 'h00000060 -#define ADDAC_ADDAC1_PLL_SVREG_MSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_LSB 31 -#define ADDAC_ADDAC1_PLL_SVREG_MASK 'h80000000 -#define ADDAC_ADDAC1_PLL_SVREG_GET(x) (((x) & ADDAC_ADDAC1_PLL_SVREG_MASK) >> ADDAC_ADDAC1_PLL_SVREG_LSB) -#define ADDAC_ADDAC1_PLL_SVREG_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_SVREG_LSB) & ADDAC_ADDAC1_PLL_SVREG_MASK) -#define ADDAC_ADDAC1_PLL_SVREG_RESET 1'h1 -#define ADDAC_ADDAC1_PLL_SCLAMP_MSB 30 -#define ADDAC_ADDAC1_PLL_SCLAMP_LSB 28 -#define ADDAC_ADDAC1_PLL_SCLAMP_MASK 'h70000000 -#define ADDAC_ADDAC1_PLL_SCLAMP_GET(x) (((x) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) >> ADDAC_ADDAC1_PLL_SCLAMP_LSB) -#define ADDAC_ADDAC1_PLL_SCLAMP_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_SCLAMP_LSB) & ADDAC_ADDAC1_PLL_SCLAMP_MASK) -#define ADDAC_ADDAC1_PLL_SCLAMP_RESET 3'h5 -#define ADDAC_ADDAC1_PLL_ATB_MSB 27 -#define ADDAC_ADDAC1_PLL_ATB_LSB 26 -#define ADDAC_ADDAC1_PLL_ATB_MASK 'h0c000000 -#define ADDAC_ADDAC1_PLL_ATB_GET(x) (((x) & ADDAC_ADDAC1_PLL_ATB_MASK) >> ADDAC_ADDAC1_PLL_ATB_LSB) -#define ADDAC_ADDAC1_PLL_ATB_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_ATB_LSB) & ADDAC_ADDAC1_PLL_ATB_MASK) -#define ADDAC_ADDAC1_PLL_ATB_RESET 2'h0 -#define ADDAC_ADDAC1_PLL_ICP_MSB 25 -#define ADDAC_ADDAC1_PLL_ICP_LSB 23 -#define ADDAC_ADDAC1_PLL_ICP_MASK 'h03800000 -#define ADDAC_ADDAC1_PLL_ICP_GET(x) (((x) & ADDAC_ADDAC1_PLL_ICP_MASK) >> ADDAC_ADDAC1_PLL_ICP_LSB) -#define ADDAC_ADDAC1_PLL_ICP_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_ICP_LSB) & ADDAC_ADDAC1_PLL_ICP_MASK) -#define ADDAC_ADDAC1_PLL_ICP_RESET 3'h0 -#define ADDAC_ADDAC1_PLL_FILTER_MSB 22 -#define ADDAC_ADDAC1_PLL_FILTER_LSB 15 -#define ADDAC_ADDAC1_PLL_FILTER_MASK 'h007f8000 -#define ADDAC_ADDAC1_PLL_FILTER_GET(x) (((x) & ADDAC_ADDAC1_PLL_FILTER_MASK) >> ADDAC_ADDAC1_PLL_FILTER_LSB) -#define ADDAC_ADDAC1_PLL_FILTER_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PLL_FILTER_LSB) & ADDAC_ADDAC1_PLL_FILTER_MASK) -#define ADDAC_ADDAC1_PLL_FILTER_RESET 8'h35 -#define ADDAC_ADDAC1_PWDPLL_MSB 14 -#define ADDAC_ADDAC1_PWDPLL_LSB 14 -#define ADDAC_ADDAC1_PWDPLL_MASK 'h00004000 -#define ADDAC_ADDAC1_PWDPLL_GET(x) (((x) & ADDAC_ADDAC1_PWDPLL_MASK) >> ADDAC_ADDAC1_PWDPLL_LSB) -#define ADDAC_ADDAC1_PWDPLL_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PWDPLL_LSB) & ADDAC_ADDAC1_PWDPLL_MASK) -#define ADDAC_ADDAC1_PWDPLL_RESET 1'h0 -#define ADDAC_ADDAC1_PWDADC_MSB 13 -#define ADDAC_ADDAC1_PWDADC_LSB 13 -#define ADDAC_ADDAC1_PWDADC_MASK 'h00002000 -#define ADDAC_ADDAC1_PWDADC_GET(x) (((x) & ADDAC_ADDAC1_PWDADC_MASK) >> ADDAC_ADDAC1_PWDADC_LSB) -#define ADDAC_ADDAC1_PWDADC_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PWDADC_LSB) & ADDAC_ADDAC1_PWDADC_MASK) -#define ADDAC_ADDAC1_PWDADC_RESET 1'h0 -#define ADDAC_ADDAC1_PWDDAC_MSB 12 -#define ADDAC_ADDAC1_PWDDAC_LSB 12 -#define ADDAC_ADDAC1_PWDDAC_MASK 'h00001000 -#define ADDAC_ADDAC1_PWDDAC_GET(x) (((x) & ADDAC_ADDAC1_PWDDAC_MASK) >> ADDAC_ADDAC1_PWDDAC_LSB) -#define ADDAC_ADDAC1_PWDDAC_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_PWDDAC_LSB) & ADDAC_ADDAC1_PWDDAC_MASK) -#define ADDAC_ADDAC1_PWDDAC_RESET 1'h0 -#define ADDAC_ADDAC1_FORCEMSBLOW_MSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_LSB 11 -#define ADDAC_ADDAC1_FORCEMSBLOW_MASK 'h00000800 -#define ADDAC_ADDAC1_FORCEMSBLOW_GET(x) (((x) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) >> ADDAC_ADDAC1_FORCEMSBLOW_LSB) -#define ADDAC_ADDAC1_FORCEMSBLOW_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_FORCEMSBLOW_LSB) & ADDAC_ADDAC1_FORCEMSBLOW_MASK) -#define ADDAC_ADDAC1_FORCEMSBLOW_RESET 1'h0 -#define ADDAC_ADDAC1_SELMANPWDS_MSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_LSB 10 -#define ADDAC_ADDAC1_SELMANPWDS_MASK 'h00000400 -#define ADDAC_ADDAC1_SELMANPWDS_GET(x) (((x) & ADDAC_ADDAC1_SELMANPWDS_MASK) >> ADDAC_ADDAC1_SELMANPWDS_LSB) -#define ADDAC_ADDAC1_SELMANPWDS_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_SELMANPWDS_LSB) & ADDAC_ADDAC1_SELMANPWDS_MASK) -#define ADDAC_ADDAC1_SELMANPWDS_RESET 1'h0 -#define ADDAC_ADDAC1_INV_CLK160_ADC_MSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_LSB 9 -#define ADDAC_ADDAC1_INV_CLK160_ADC_MASK 'h00000200 -#define ADDAC_ADDAC1_INV_CLK160_ADC_GET(x) (((x) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) >> ADDAC_ADDAC1_INV_CLK160_ADC_LSB) -#define ADDAC_ADDAC1_INV_CLK160_ADC_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_INV_CLK160_ADC_LSB) & ADDAC_ADDAC1_INV_CLK160_ADC_MASK) -#define ADDAC_ADDAC1_INV_CLK160_ADC_RESET 1'h0 -#define ADDAC_ADDAC1_CM_SEL_MSB 8 -#define ADDAC_ADDAC1_CM_SEL_LSB 7 -#define ADDAC_ADDAC1_CM_SEL_MASK 'h00000180 -#define ADDAC_ADDAC1_CM_SEL_GET(x) (((x) & ADDAC_ADDAC1_CM_SEL_MASK) >> ADDAC_ADDAC1_CM_SEL_LSB) -#define ADDAC_ADDAC1_CM_SEL_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_CM_SEL_LSB) & ADDAC_ADDAC1_CM_SEL_MASK) -#define ADDAC_ADDAC1_CM_SEL_RESET 2'h1 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_LSB 6 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_MASK 'h00000040 -#define ADDAC_ADDAC1_DISABLE_DAC_REG_GET(x) (((x) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) >> ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_DISABLE_DAC_REG_LSB) & ADDAC_ADDAC1_DISABLE_DAC_REG_MASK) -#define ADDAC_ADDAC1_DISABLE_DAC_REG_RESET 1'h0 -#define ADDAC_ADDAC1_SPARE_MSB 5 -#define ADDAC_ADDAC1_SPARE_LSB 0 -#define ADDAC_ADDAC1_SPARE_MASK 'h0000003f -#define ADDAC_ADDAC1_SPARE_GET(x) (((x) & ADDAC_ADDAC1_SPARE_MASK) >> ADDAC_ADDAC1_SPARE_LSB) -#define ADDAC_ADDAC1_SPARE_SET(x) (((32'd0 | (x)) << ADDAC_ADDAC1_SPARE_LSB) & ADDAC_ADDAC1_SPARE_MASK) -#define ADDAC_ADDAC1_SPARE_RESET 6'h0 -#define ADDAC_ADDAC1_RESET (32'h0 | \ - ADDAC_ADDAC1_PLL_SVREG_SET(ADDAC_ADDAC1_PLL_SVREG_RESET) | \ - ADDAC_ADDAC1_PLL_SCLAMP_SET(ADDAC_ADDAC1_PLL_SCLAMP_RESET) | \ - ADDAC_ADDAC1_PLL_ATB_SET(ADDAC_ADDAC1_PLL_ATB_RESET) | \ - ADDAC_ADDAC1_PLL_ICP_SET(ADDAC_ADDAC1_PLL_ICP_RESET) | \ - ADDAC_ADDAC1_PLL_FILTER_SET(ADDAC_ADDAC1_PLL_FILTER_RESET) | \ - ADDAC_ADDAC1_PWDPLL_SET(ADDAC_ADDAC1_PWDPLL_RESET) | \ - ADDAC_ADDAC1_PWDADC_SET(ADDAC_ADDAC1_PWDADC_RESET) | \ - ADDAC_ADDAC1_PWDDAC_SET(ADDAC_ADDAC1_PWDDAC_RESET) | \ - ADDAC_ADDAC1_FORCEMSBLOW_SET(ADDAC_ADDAC1_FORCEMSBLOW_RESET) | \ - ADDAC_ADDAC1_SELMANPWDS_SET(ADDAC_ADDAC1_SELMANPWDS_RESET) | \ - ADDAC_ADDAC1_INV_CLK160_ADC_SET(ADDAC_ADDAC1_INV_CLK160_ADC_RESET) | \ - ADDAC_ADDAC1_CM_SEL_SET(ADDAC_ADDAC1_CM_SEL_RESET) | \ - ADDAC_ADDAC1_DISABLE_DAC_REG_SET(ADDAC_ADDAC1_DISABLE_DAC_REG_RESET) | \ - ADDAC_ADDAC1_SPARE_SET(ADDAC_ADDAC1_SPARE_RESET)) -#define ADDAC_ADDAC1_HW_MASK (32'h0) -#define ADDAC_ADDAC1_SW_MASK (32'h0 | \ - ADDAC_ADDAC1_PLL_SVREG_MASK | \ - ADDAC_ADDAC1_PLL_SCLAMP_MASK | \ - ADDAC_ADDAC1_PLL_ATB_MASK | \ - ADDAC_ADDAC1_PLL_ICP_MASK | \ - ADDAC_ADDAC1_PLL_FILTER_MASK | \ - ADDAC_ADDAC1_PWDPLL_MASK | \ - ADDAC_ADDAC1_PWDADC_MASK | \ - ADDAC_ADDAC1_PWDDAC_MASK | \ - ADDAC_ADDAC1_FORCEMSBLOW_MASK | \ - ADDAC_ADDAC1_SELMANPWDS_MASK | \ - ADDAC_ADDAC1_INV_CLK160_ADC_MASK | \ - ADDAC_ADDAC1_CM_SEL_MASK | \ - ADDAC_ADDAC1_DISABLE_DAC_REG_MASK | \ - ADDAC_ADDAC1_SPARE_MASK) - -#define ANALOG_REG_ADDRESS_MSB 6 - -#endif /* _ANALOG_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/apb_map.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/apb_map.h deleted file mode 100644 index f3bf6d6cc82b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/apb_map.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _APB_MAP_H_ -#define _APB_MAP_H_ - -#define RTC_BASE_ADDRESS 0x00004000 -#define VMC_BASE_ADDRESS 0x00008000 -#define UART_BASE_ADDRESS 0x0000c000 -#define SI_BASE_ADDRESS 0x00010000 -#define GPIO_BASE_ADDRESS 0x00014000 -#define MBOX_BASE_ADDRESS 0x00018000 -#define ANALOG_INTF_BASE_ADDRESS 0x0001c000 -#define MAC_BASE_ADDRESS 0x00020000 - -#endif /* _APB_MAP_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/apb_map.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/apb_map.vrh deleted file mode 100644 index 078e022f9d74..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/apb_map.vrh +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _APB_MAP_VRH_ -#define _APB_MAP_VRH_ - -#define RTC_BASE_ADDRESS 'h00004000 -#define RTC_END_ADDRESS 'h000041ff -#define VMC_BASE_ADDRESS 'h00008000 -#define VMC_END_ADDRESS 'h000083ff -#define UART_BASE_ADDRESS 'h0000c000 -#define UART_END_ADDRESS 'h0000c03f -#define SI_BASE_ADDRESS 'h00010000 -#define SI_END_ADDRESS 'h0001001f -#define GPIO_BASE_ADDRESS 'h00014000 -#define GPIO_END_ADDRESS 'h000140ff -#define MBOX_BASE_ADDRESS 'h00018000 -#define MBOX_END_ADDRESS 'h0001bfff -#define ANALOG_INTF_BASE_ADDRESS 'h0001c000 -#define ANALOG_INTF_END_ADDRESS 'h0001c0ff -#define MAC_BASE_ADDRESS 'h00020000 -#define MAC_END_ADDRESS 'h0002ffff - -#endif /* _APB_MAP_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/bias_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/bias_reg.h deleted file mode 100644 index f8ca13152959..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/bias_reg.h +++ /dev/null @@ -1,293 +0,0 @@ -#ifndef _BIAS_REG_REG_H_ -#define _BIAS_REG_REG_H_ - -#define BIAS_BIAS_SEL_ADDRESS 0x00000000 -#define BIAS_BIAS_SEL_OFFSET 0x00000000 -#define BIAS_BIAS_SEL_PADON_MSB 31 -#define BIAS_BIAS_SEL_PADON_LSB 31 -#define BIAS_BIAS_SEL_PADON_MASK 0x80000000 -#define BIAS_BIAS_SEL_PADON_GET(x) (((x) & BIAS_BIAS_SEL_PADON_MASK) >> BIAS_BIAS_SEL_PADON_LSB) -#define BIAS_BIAS_SEL_PADON_SET(x) (((x) << BIAS_BIAS_SEL_PADON_LSB) & BIAS_BIAS_SEL_PADON_MASK) -#define BIAS_BIAS_SEL_SEL_BIAS_MSB 30 -#define BIAS_BIAS_SEL_SEL_BIAS_LSB 25 -#define BIAS_BIAS_SEL_SEL_BIAS_MASK 0x7e000000 -#define BIAS_BIAS_SEL_SEL_BIAS_GET(x) (((x) & BIAS_BIAS_SEL_SEL_BIAS_MASK) >> BIAS_BIAS_SEL_SEL_BIAS_LSB) -#define BIAS_BIAS_SEL_SEL_BIAS_SET(x) (((x) << BIAS_BIAS_SEL_SEL_BIAS_LSB) & BIAS_BIAS_SEL_SEL_BIAS_MASK) -#define BIAS_BIAS_SEL_SEL_SPARE_MSB 24 -#define BIAS_BIAS_SEL_SEL_SPARE_LSB 21 -#define BIAS_BIAS_SEL_SEL_SPARE_MASK 0x01e00000 -#define BIAS_BIAS_SEL_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SEL_SPARE_SET(x) (((x) << BIAS_BIAS_SEL_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_SPARE_MSB 20 -#define BIAS_BIAS_SEL_SPARE_LSB 20 -#define BIAS_BIAS_SEL_SPARE_MASK 0x00100000 -#define BIAS_BIAS_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SPARE_SET(x) (((x) << BIAS_BIAS_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MSB 19 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB 17 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK 0x000e0000 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK 0x00010000 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_SET(x) (((x) << BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK 0x00008000 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_SET(x) (((x) << BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK 0x00004000 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_LSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MASK 0x00002000 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) >> BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MSB 12 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB 10 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK 0x00001c00 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MSB 9 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_LSB 7 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MASK 0x00000380 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) >> BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MSB 6 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_LSB 4 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MASK 0x00000070 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) >> BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MSB 3 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_LSB 1 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MASK 0x0000000e -#define BIAS_BIAS_SEL_PWD_ICTXPC25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) >> BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) -#define BIAS_BIAS_SEL_PWD_ICLDO25_MSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_LSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_MASK 0x00000001 -#define BIAS_BIAS_SEL_PWD_ICLDO25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) >> BIAS_BIAS_SEL_PWD_ICLDO25_LSB) -#define BIAS_BIAS_SEL_PWD_ICLDO25_SET(x) (((x) << BIAS_BIAS_SEL_PWD_ICLDO25_LSB) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) - -#define BIAS_BIAS1_ADDRESS 0x00000004 -#define BIAS_BIAS1_OFFSET 0x00000004 -#define BIAS_BIAS1_PWD_ICDAC2BB25_MSB 31 -#define BIAS_BIAS1_PWD_ICDAC2BB25_LSB 29 -#define BIAS_BIAS1_PWD_ICDAC2BB25_MASK 0xe0000000 -#define BIAS_BIAS1_PWD_ICDAC2BB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) >> BIAS_BIAS1_PWD_ICDAC2BB25_LSB) -#define BIAS_BIAS1_PWD_ICDAC2BB25_SET(x) (((x) << BIAS_BIAS1_PWD_ICDAC2BB25_LSB) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) -#define BIAS_BIAS1_PWD_IC2GVGM25_MSB 28 -#define BIAS_BIAS1_PWD_IC2GVGM25_LSB 26 -#define BIAS_BIAS1_PWD_IC2GVGM25_MASK 0x1c000000 -#define BIAS_BIAS1_PWD_IC2GVGM25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) >> BIAS_BIAS1_PWD_IC2GVGM25_LSB) -#define BIAS_BIAS1_PWD_IC2GVGM25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GVGM25_LSB) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) -#define BIAS_BIAS1_PWD_IC2GRFFE25_MSB 25 -#define BIAS_BIAS1_PWD_IC2GRFFE25_LSB 23 -#define BIAS_BIAS1_PWD_IC2GRFFE25_MASK 0x03800000 -#define BIAS_BIAS1_PWD_IC2GRFFE25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) >> BIAS_BIAS1_PWD_IC2GRFFE25_LSB) -#define BIAS_BIAS1_PWD_IC2GRFFE25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GRFFE25_LSB) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) -#define BIAS_BIAS1_PWD_IC2GLOREG25_MSB 22 -#define BIAS_BIAS1_PWD_IC2GLOREG25_LSB 20 -#define BIAS_BIAS1_PWD_IC2GLOREG25_MASK 0x00700000 -#define BIAS_BIAS1_PWD_IC2GLOREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLOREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLOREG25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GLOREG25_LSB) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MSB 19 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_LSB 17 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MASK 0x000e0000 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_SET(x) (((x) << BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORB25_MSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_LSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_MASK 0x00010000 -#define BIAS_BIAS1_PWD_ICDETECTORB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORB25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORB25_SET(x) (((x) << BIAS_BIAS1_PWD_ICDETECTORB25_LSB) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORA25_MSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_LSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_MASK 0x00008000 -#define BIAS_BIAS1_PWD_ICDETECTORA25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORA25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORA25_SET(x) (((x) << BIAS_BIAS1_PWD_ICDETECTORA25_LSB) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) -#define BIAS_BIAS1_PWD_IC5GRXRF25_MSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_LSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_MASK 0x00004000 -#define BIAS_BIAS1_PWD_IC5GRXRF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) >> BIAS_BIAS1_PWD_IC5GRXRF25_LSB) -#define BIAS_BIAS1_PWD_IC5GRXRF25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GRXRF25_LSB) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXPA25_MSB 13 -#define BIAS_BIAS1_PWD_IC5GTXPA25_LSB 11 -#define BIAS_BIAS1_PWD_IC5GTXPA25_MASK 0x00003800 -#define BIAS_BIAS1_PWD_IC5GTXPA25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) >> BIAS_BIAS1_PWD_IC5GTXPA25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXPA25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GTXPA25_LSB) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MSB 10 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_LSB 8 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MASK 0x00000700 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) >> BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) -#define BIAS_BIAS1_PWD_IC5GQB25_MSB 7 -#define BIAS_BIAS1_PWD_IC5GQB25_LSB 5 -#define BIAS_BIAS1_PWD_IC5GQB25_MASK 0x000000e0 -#define BIAS_BIAS1_PWD_IC5GQB25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GQB25_MASK) >> BIAS_BIAS1_PWD_IC5GQB25_LSB) -#define BIAS_BIAS1_PWD_IC5GQB25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GQB25_LSB) & BIAS_BIAS1_PWD_IC5GQB25_MASK) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MSB 4 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_LSB 2 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MASK 0x0000001c -#define BIAS_BIAS1_PWD_IC5GMIXQ25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) >> BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_SET(x) (((x) << BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) -#define BIAS_BIAS1_SPARE_MSB 1 -#define BIAS_BIAS1_SPARE_LSB 0 -#define BIAS_BIAS1_SPARE_MASK 0x00000003 -#define BIAS_BIAS1_SPARE_GET(x) (((x) & BIAS_BIAS1_SPARE_MASK) >> BIAS_BIAS1_SPARE_LSB) -#define BIAS_BIAS1_SPARE_SET(x) (((x) << BIAS_BIAS1_SPARE_LSB) & BIAS_BIAS1_SPARE_MASK) - -#define BIAS_BIAS2_ADDRESS 0x00000008 -#define BIAS_BIAS2_OFFSET 0x00000008 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MSB 31 -#define BIAS_BIAS2_PWD_IC5GMIXI25_LSB 29 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MASK 0xe0000000 -#define BIAS_BIAS2_PWD_IC5GMIXI25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) >> BIAS_BIAS2_PWD_IC5GMIXI25_LSB) -#define BIAS_BIAS2_PWD_IC5GMIXI25_SET(x) (((x) << BIAS_BIAS2_PWD_IC5GMIXI25_LSB) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) -#define BIAS_BIAS2_PWD_IC5GDIV25_MSB 28 -#define BIAS_BIAS2_PWD_IC5GDIV25_LSB 26 -#define BIAS_BIAS2_PWD_IC5GDIV25_MASK 0x1c000000 -#define BIAS_BIAS2_PWD_IC5GDIV25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) >> BIAS_BIAS2_PWD_IC5GDIV25_LSB) -#define BIAS_BIAS2_PWD_IC5GDIV25_SET(x) (((x) << BIAS_BIAS2_PWD_IC5GDIV25_LSB) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) -#define BIAS_BIAS2_PWD_IC5GLOREG25_MSB 25 -#define BIAS_BIAS2_PWD_IC5GLOREG25_LSB 23 -#define BIAS_BIAS2_PWD_IC5GLOREG25_MASK 0x03800000 -#define BIAS_BIAS2_PWD_IC5GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) >> BIAS_BIAS2_PWD_IC5GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IC5GLOREG25_SET(x) (((x) << BIAS_BIAS2_PWD_IC5GLOREG25_LSB) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IRPLL25_MSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_LSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_MASK 0x00400000 -#define BIAS_BIAS2_PWD_IRPLL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRPLL25_MASK) >> BIAS_BIAS2_PWD_IRPLL25_LSB) -#define BIAS_BIAS2_PWD_IRPLL25_SET(x) (((x) << BIAS_BIAS2_PWD_IRPLL25_LSB) & BIAS_BIAS2_PWD_IRPLL25_MASK) -#define BIAS_BIAS2_PWD_IRXTAL25_MSB 21 -#define BIAS_BIAS2_PWD_IRXTAL25_LSB 19 -#define BIAS_BIAS2_PWD_IRXTAL25_MASK 0x00380000 -#define BIAS_BIAS2_PWD_IRXTAL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRXTAL25_MASK) >> BIAS_BIAS2_PWD_IRXTAL25_LSB) -#define BIAS_BIAS2_PWD_IRXTAL25_SET(x) (((x) << BIAS_BIAS2_PWD_IRXTAL25_LSB) & BIAS_BIAS2_PWD_IRXTAL25_MASK) -#define BIAS_BIAS2_PWD_IRTSENS25_MSB 18 -#define BIAS_BIAS2_PWD_IRTSENS25_LSB 16 -#define BIAS_BIAS2_PWD_IRTSENS25_MASK 0x00070000 -#define BIAS_BIAS2_PWD_IRTSENS25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTSENS25_MASK) >> BIAS_BIAS2_PWD_IRTSENS25_LSB) -#define BIAS_BIAS2_PWD_IRTSENS25_SET(x) (((x) << BIAS_BIAS2_PWD_IRTSENS25_LSB) & BIAS_BIAS2_PWD_IRTSENS25_MASK) -#define BIAS_BIAS2_PWD_IRTXPC25_MSB 15 -#define BIAS_BIAS2_PWD_IRTXPC25_LSB 13 -#define BIAS_BIAS2_PWD_IRTXPC25_MASK 0x0000e000 -#define BIAS_BIAS2_PWD_IRTXPC25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTXPC25_MASK) >> BIAS_BIAS2_PWD_IRTXPC25_LSB) -#define BIAS_BIAS2_PWD_IRTXPC25_SET(x) (((x) << BIAS_BIAS2_PWD_IRTXPC25_LSB) & BIAS_BIAS2_PWD_IRTXPC25_MASK) -#define BIAS_BIAS2_PWD_IRLDO25_MSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_LSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_MASK 0x00001000 -#define BIAS_BIAS2_PWD_IRLDO25_GET(x) (((x) & BIAS_BIAS2_PWD_IRLDO25_MASK) >> BIAS_BIAS2_PWD_IRLDO25_LSB) -#define BIAS_BIAS2_PWD_IRLDO25_SET(x) (((x) << BIAS_BIAS2_PWD_IRLDO25_LSB) & BIAS_BIAS2_PWD_IRLDO25_MASK) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MSB 11 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_LSB 9 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MASK 0x00000e00 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) >> BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_SET(x) (((x) << BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) -#define BIAS_BIAS2_PWD_IR2GLOREG25_MSB 8 -#define BIAS_BIAS2_PWD_IR2GLOREG25_LSB 6 -#define BIAS_BIAS2_PWD_IR2GLOREG25_MASK 0x000001c0 -#define BIAS_BIAS2_PWD_IR2GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLOREG25_SET(x) (((x) << BIAS_BIAS2_PWD_IR2GLOREG25_LSB) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MSB 5 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_LSB 3 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MASK 0x00000038 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_SET(x) (((x) << BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MSB 2 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB 0 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK 0x00000007 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_GET(x) (((x) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) >> BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_SET(x) (((x) << BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) - -#define BIAS_BIAS3_ADDRESS 0x0000000c -#define BIAS_BIAS3_OFFSET 0x0000000c -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MSB 31 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_LSB 29 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MASK 0xe0000000 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) >> BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) -#define BIAS_BIAS3_PWD_IR5GTXMIX25_SET(x) (((x) << BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) -#define BIAS_BIAS3_PWD_IR5GAGC25_MSB 28 -#define BIAS_BIAS3_PWD_IR5GAGC25_LSB 26 -#define BIAS_BIAS3_PWD_IR5GAGC25_MASK 0x1c000000 -#define BIAS_BIAS3_PWD_IR5GAGC25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) >> BIAS_BIAS3_PWD_IR5GAGC25_LSB) -#define BIAS_BIAS3_PWD_IR5GAGC25_SET(x) (((x) << BIAS_BIAS3_PWD_IR5GAGC25_LSB) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) -#define BIAS_BIAS3_PWD_ICDAC50_MSB 25 -#define BIAS_BIAS3_PWD_ICDAC50_LSB 23 -#define BIAS_BIAS3_PWD_ICDAC50_MASK 0x03800000 -#define BIAS_BIAS3_PWD_ICDAC50_GET(x) (((x) & BIAS_BIAS3_PWD_ICDAC50_MASK) >> BIAS_BIAS3_PWD_ICDAC50_LSB) -#define BIAS_BIAS3_PWD_ICDAC50_SET(x) (((x) << BIAS_BIAS3_PWD_ICDAC50_LSB) & BIAS_BIAS3_PWD_ICDAC50_MASK) -#define BIAS_BIAS3_PWD_ICSYNTH50_MSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_LSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_MASK 0x00400000 -#define BIAS_BIAS3_PWD_ICSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) >> BIAS_BIAS3_PWD_ICSYNTH50_LSB) -#define BIAS_BIAS3_PWD_ICSYNTH50_SET(x) (((x) << BIAS_BIAS3_PWD_ICSYNTH50_LSB) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) -#define BIAS_BIAS3_PWD_ICBB50_MSB 21 -#define BIAS_BIAS3_PWD_ICBB50_LSB 21 -#define BIAS_BIAS3_PWD_ICBB50_MASK 0x00200000 -#define BIAS_BIAS3_PWD_ICBB50_GET(x) (((x) & BIAS_BIAS3_PWD_ICBB50_MASK) >> BIAS_BIAS3_PWD_ICBB50_LSB) -#define BIAS_BIAS3_PWD_ICBB50_SET(x) (((x) << BIAS_BIAS3_PWD_ICBB50_LSB) & BIAS_BIAS3_PWD_ICBB50_MASK) -#define BIAS_BIAS3_PWD_IC2GDIV50_MSB 20 -#define BIAS_BIAS3_PWD_IC2GDIV50_LSB 18 -#define BIAS_BIAS3_PWD_IC2GDIV50_MASK 0x001c0000 -#define BIAS_BIAS3_PWD_IC2GDIV50_GET(x) (((x) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) >> BIAS_BIAS3_PWD_IC2GDIV50_LSB) -#define BIAS_BIAS3_PWD_IC2GDIV50_SET(x) (((x) << BIAS_BIAS3_PWD_IC2GDIV50_LSB) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) -#define BIAS_BIAS3_PWD_IRSYNTH50_MSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_LSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_MASK 0x00020000 -#define BIAS_BIAS3_PWD_IRSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) >> BIAS_BIAS3_PWD_IRSYNTH50_LSB) -#define BIAS_BIAS3_PWD_IRSYNTH50_SET(x) (((x) << BIAS_BIAS3_PWD_IRSYNTH50_LSB) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) -#define BIAS_BIAS3_PWD_IRBB50_MSB 16 -#define BIAS_BIAS3_PWD_IRBB50_LSB 16 -#define BIAS_BIAS3_PWD_IRBB50_MASK 0x00010000 -#define BIAS_BIAS3_PWD_IRBB50_GET(x) (((x) & BIAS_BIAS3_PWD_IRBB50_MASK) >> BIAS_BIAS3_PWD_IRBB50_LSB) -#define BIAS_BIAS3_PWD_IRBB50_SET(x) (((x) << BIAS_BIAS3_PWD_IRBB50_LSB) & BIAS_BIAS3_PWD_IRBB50_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE1_MSB 15 -#define BIAS_BIAS3_PWD_IC25SPARE1_LSB 13 -#define BIAS_BIAS3_PWD_IC25SPARE1_MASK 0x0000e000 -#define BIAS_BIAS3_PWD_IC25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) >> BIAS_BIAS3_PWD_IC25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE1_SET(x) (((x) << BIAS_BIAS3_PWD_IC25SPARE1_LSB) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE2_MSB 12 -#define BIAS_BIAS3_PWD_IC25SPARE2_LSB 10 -#define BIAS_BIAS3_PWD_IC25SPARE2_MASK 0x00001c00 -#define BIAS_BIAS3_PWD_IC25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) >> BIAS_BIAS3_PWD_IC25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE2_SET(x) (((x) << BIAS_BIAS3_PWD_IC25SPARE2_LSB) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE1_MSB 9 -#define BIAS_BIAS3_PWD_IR25SPARE1_LSB 7 -#define BIAS_BIAS3_PWD_IR25SPARE1_MASK 0x00000380 -#define BIAS_BIAS3_PWD_IR25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) >> BIAS_BIAS3_PWD_IR25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE1_SET(x) (((x) << BIAS_BIAS3_PWD_IR25SPARE1_LSB) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE2_MSB 6 -#define BIAS_BIAS3_PWD_IR25SPARE2_LSB 4 -#define BIAS_BIAS3_PWD_IR25SPARE2_MASK 0x00000070 -#define BIAS_BIAS3_PWD_IR25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) >> BIAS_BIAS3_PWD_IR25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE2_SET(x) (((x) << BIAS_BIAS3_PWD_IR25SPARE2_LSB) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) -#define BIAS_BIAS3_PWD_ICDACREG12P5_MSB 3 -#define BIAS_BIAS3_PWD_ICDACREG12P5_LSB 1 -#define BIAS_BIAS3_PWD_ICDACREG12P5_MASK 0x0000000e -#define BIAS_BIAS3_PWD_ICDACREG12P5_GET(x) (((x) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) >> BIAS_BIAS3_PWD_ICDACREG12P5_LSB) -#define BIAS_BIAS3_PWD_ICDACREG12P5_SET(x) (((x) << BIAS_BIAS3_PWD_ICDACREG12P5_LSB) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) -#define BIAS_BIAS3_SPARE_MSB 0 -#define BIAS_BIAS3_SPARE_LSB 0 -#define BIAS_BIAS3_SPARE_MASK 0x00000001 -#define BIAS_BIAS3_SPARE_GET(x) (((x) & BIAS_BIAS3_SPARE_MASK) >> BIAS_BIAS3_SPARE_LSB) -#define BIAS_BIAS3_SPARE_SET(x) (((x) << BIAS_BIAS3_SPARE_LSB) & BIAS_BIAS3_SPARE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct bias_reg_reg_s { - volatile unsigned int bias_bias_sel; - volatile unsigned int bias_bias1; - volatile unsigned int bias_bias2; - volatile unsigned int bias_bias3; -} bias_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _BIAS_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/bias_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/bias_reg.vrh deleted file mode 100644 index c5cc4fe95445..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/bias_reg.vrh +++ /dev/null @@ -1,450 +0,0 @@ -#ifndef _BIAS_REG_VRH_ -#define _BIAS_REG_VRH_ - -#define BIAS_BIAS_SEL_ADDRESS 'h00000000 -#define BIAS_BIAS_SEL_PADON_MSB 31 -#define BIAS_BIAS_SEL_PADON_LSB 31 -#define BIAS_BIAS_SEL_PADON_MASK 'h80000000 -#define BIAS_BIAS_SEL_PADON_GET(x) (((x) & BIAS_BIAS_SEL_PADON_MASK) >> BIAS_BIAS_SEL_PADON_LSB) -#define BIAS_BIAS_SEL_PADON_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PADON_LSB) & BIAS_BIAS_SEL_PADON_MASK) -#define BIAS_BIAS_SEL_PADON_RESET 1'h0 -#define BIAS_BIAS_SEL_SEL_BIAS_MSB 30 -#define BIAS_BIAS_SEL_SEL_BIAS_LSB 25 -#define BIAS_BIAS_SEL_SEL_BIAS_MASK 'h7e000000 -#define BIAS_BIAS_SEL_SEL_BIAS_GET(x) (((x) & BIAS_BIAS_SEL_SEL_BIAS_MASK) >> BIAS_BIAS_SEL_SEL_BIAS_LSB) -#define BIAS_BIAS_SEL_SEL_BIAS_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_SEL_BIAS_LSB) & BIAS_BIAS_SEL_SEL_BIAS_MASK) -#define BIAS_BIAS_SEL_SEL_BIAS_RESET 6'h0 -#define BIAS_BIAS_SEL_SEL_SPARE_MSB 24 -#define BIAS_BIAS_SEL_SEL_SPARE_LSB 21 -#define BIAS_BIAS_SEL_SEL_SPARE_MASK 'h01e00000 -#define BIAS_BIAS_SEL_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SEL_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_SEL_SPARE_RESET 4'h0 -#define BIAS_BIAS_SEL_SPARE_MSB 20 -#define BIAS_BIAS_SEL_SPARE_LSB 20 -#define BIAS_BIAS_SEL_SPARE_MASK 'h00100000 -#define BIAS_BIAS_SEL_SPARE_GET(x) (((x) & BIAS_BIAS_SEL_SPARE_MASK) >> BIAS_BIAS_SEL_SPARE_LSB) -#define BIAS_BIAS_SEL_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_SPARE_LSB) & BIAS_BIAS_SEL_SPARE_MASK) -#define BIAS_BIAS_SEL_SPARE_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MSB 19 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB 17 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK 'h000e0000 -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_RESET 3'h6 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB 16 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK 'h00010000 -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_LSB) & BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB 15 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK 'h00008000 -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_GET(x) (((x) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) >> BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_LSB) & BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK) -#define BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB 14 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK 'h00004000 -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_LSB 13 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_MASK 'h00002000 -#define BIAS_BIAS_SEL_PWD_ICCPLL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) >> BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICCPLL25_LSB) & BIAS_BIAS_SEL_PWD_ICCPLL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCPLL25_RESET 1'h0 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MSB 12 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB 10 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK 'h00001c00 -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) >> BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_LSB) & BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MSB 9 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_LSB 7 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_MASK 'h00000380 -#define BIAS_BIAS_SEL_PWD_ICXTAL25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) >> BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICXTAL25_LSB) & BIAS_BIAS_SEL_PWD_ICXTAL25_MASK) -#define BIAS_BIAS_SEL_PWD_ICXTAL25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MSB 6 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_LSB 4 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_MASK 'h00000070 -#define BIAS_BIAS_SEL_PWD_ICTSENS25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) >> BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICTSENS25_LSB) & BIAS_BIAS_SEL_PWD_ICTSENS25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTSENS25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MSB 3 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_LSB 1 -#define BIAS_BIAS_SEL_PWD_ICTXPC25_MASK 'h0000000e -#define BIAS_BIAS_SEL_PWD_ICTXPC25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) >> BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICTXPC25_LSB) & BIAS_BIAS_SEL_PWD_ICTXPC25_MASK) -#define BIAS_BIAS_SEL_PWD_ICTXPC25_RESET 3'h3 -#define BIAS_BIAS_SEL_PWD_ICLDO25_MSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_LSB 0 -#define BIAS_BIAS_SEL_PWD_ICLDO25_MASK 'h00000001 -#define BIAS_BIAS_SEL_PWD_ICLDO25_GET(x) (((x) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) >> BIAS_BIAS_SEL_PWD_ICLDO25_LSB) -#define BIAS_BIAS_SEL_PWD_ICLDO25_SET(x) (((32'd0 | (x)) << BIAS_BIAS_SEL_PWD_ICLDO25_LSB) & BIAS_BIAS_SEL_PWD_ICLDO25_MASK) -#define BIAS_BIAS_SEL_PWD_ICLDO25_RESET 1'h0 -#define BIAS_BIAS_SEL_RESET (32'h0 | \ - BIAS_BIAS_SEL_PADON_SET(BIAS_BIAS_SEL_PADON_RESET) | \ - BIAS_BIAS_SEL_SEL_BIAS_SET(BIAS_BIAS_SEL_SEL_BIAS_RESET) | \ - BIAS_BIAS_SEL_SEL_SPARE_SET(BIAS_BIAS_SEL_SEL_SPARE_RESET) | \ - BIAS_BIAS_SEL_SPARE_SET(BIAS_BIAS_SEL_SPARE_RESET) | \ - BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_SET(BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_RESET) | \ - BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_SET(BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_RESET) | \ - BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_SET(BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_RESET) | \ - BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_SET(BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICCPLL25_SET(BIAS_BIAS_SEL_PWD_ICCPLL25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_SET(BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICXTAL25_SET(BIAS_BIAS_SEL_PWD_ICXTAL25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICTSENS25_SET(BIAS_BIAS_SEL_PWD_ICTSENS25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICTXPC25_SET(BIAS_BIAS_SEL_PWD_ICTXPC25_RESET) | \ - BIAS_BIAS_SEL_PWD_ICLDO25_SET(BIAS_BIAS_SEL_PWD_ICLDO25_RESET)) -#define BIAS_BIAS_SEL_HW_MASK (32'h0) -#define BIAS_BIAS_SEL_SW_MASK (32'h0 | \ - BIAS_BIAS_SEL_PADON_MASK | \ - BIAS_BIAS_SEL_SEL_BIAS_MASK | \ - BIAS_BIAS_SEL_SEL_SPARE_MASK | \ - BIAS_BIAS_SEL_SPARE_MASK | \ - BIAS_BIAS_SEL_PWD_ICREFBUFBIAS12P5_MASK | \ - BIAS_BIAS_SEL_PWD_IRDACREGREF12P5_MASK | \ - BIAS_BIAS_SEL_PWD_IRREFMASTERBIAS12P5_MASK | \ - BIAS_BIAS_SEL_PWD_ICREFOPAMPBIAS25_MASK | \ - BIAS_BIAS_SEL_PWD_ICCPLL25_MASK | \ - BIAS_BIAS_SEL_PWD_ICCOMPBIAS25_MASK | \ - BIAS_BIAS_SEL_PWD_ICXTAL25_MASK | \ - BIAS_BIAS_SEL_PWD_ICTSENS25_MASK | \ - BIAS_BIAS_SEL_PWD_ICTXPC25_MASK | \ - BIAS_BIAS_SEL_PWD_ICLDO25_MASK) - -#define BIAS_BIAS1_ADDRESS 'h00000004 -#define BIAS_BIAS1_PWD_ICDAC2BB25_MSB 31 -#define BIAS_BIAS1_PWD_ICDAC2BB25_LSB 29 -#define BIAS_BIAS1_PWD_ICDAC2BB25_MASK 'he0000000 -#define BIAS_BIAS1_PWD_ICDAC2BB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) >> BIAS_BIAS1_PWD_ICDAC2BB25_LSB) -#define BIAS_BIAS1_PWD_ICDAC2BB25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_ICDAC2BB25_LSB) & BIAS_BIAS1_PWD_ICDAC2BB25_MASK) -#define BIAS_BIAS1_PWD_ICDAC2BB25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GVGM25_MSB 28 -#define BIAS_BIAS1_PWD_IC2GVGM25_LSB 26 -#define BIAS_BIAS1_PWD_IC2GVGM25_MASK 'h1c000000 -#define BIAS_BIAS1_PWD_IC2GVGM25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) >> BIAS_BIAS1_PWD_IC2GVGM25_LSB) -#define BIAS_BIAS1_PWD_IC2GVGM25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GVGM25_LSB) & BIAS_BIAS1_PWD_IC2GVGM25_MASK) -#define BIAS_BIAS1_PWD_IC2GVGM25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GRFFE25_MSB 25 -#define BIAS_BIAS1_PWD_IC2GRFFE25_LSB 23 -#define BIAS_BIAS1_PWD_IC2GRFFE25_MASK 'h03800000 -#define BIAS_BIAS1_PWD_IC2GRFFE25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) >> BIAS_BIAS1_PWD_IC2GRFFE25_LSB) -#define BIAS_BIAS1_PWD_IC2GRFFE25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GRFFE25_LSB) & BIAS_BIAS1_PWD_IC2GRFFE25_MASK) -#define BIAS_BIAS1_PWD_IC2GRFFE25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GLOREG25_MSB 22 -#define BIAS_BIAS1_PWD_IC2GLOREG25_LSB 20 -#define BIAS_BIAS1_PWD_IC2GLOREG25_MASK 'h00700000 -#define BIAS_BIAS1_PWD_IC2GLOREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLOREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLOREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GLOREG25_LSB) & BIAS_BIAS1_PWD_IC2GLOREG25_MASK) -#define BIAS_BIAS1_PWD_IC2GLOREG25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MSB 19 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_LSB 17 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_MASK 'h000e0000 -#define BIAS_BIAS1_PWD_IC2GLNAREG25_GET(x) (((x) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) >> BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC2GLNAREG25_LSB) & BIAS_BIAS1_PWD_IC2GLNAREG25_MASK) -#define BIAS_BIAS1_PWD_IC2GLNAREG25_RESET 3'h3 -#define BIAS_BIAS1_PWD_ICDETECTORB25_MSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_LSB 16 -#define BIAS_BIAS1_PWD_ICDETECTORB25_MASK 'h00010000 -#define BIAS_BIAS1_PWD_ICDETECTORB25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORB25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORB25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_ICDETECTORB25_LSB) & BIAS_BIAS1_PWD_ICDETECTORB25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORB25_RESET 1'h0 -#define BIAS_BIAS1_PWD_ICDETECTORA25_MSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_LSB 15 -#define BIAS_BIAS1_PWD_ICDETECTORA25_MASK 'h00008000 -#define BIAS_BIAS1_PWD_ICDETECTORA25_GET(x) (((x) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) >> BIAS_BIAS1_PWD_ICDETECTORA25_LSB) -#define BIAS_BIAS1_PWD_ICDETECTORA25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_ICDETECTORA25_LSB) & BIAS_BIAS1_PWD_ICDETECTORA25_MASK) -#define BIAS_BIAS1_PWD_ICDETECTORA25_RESET 1'h0 -#define BIAS_BIAS1_PWD_IC5GRXRF25_MSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_LSB 14 -#define BIAS_BIAS1_PWD_IC5GRXRF25_MASK 'h00004000 -#define BIAS_BIAS1_PWD_IC5GRXRF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) >> BIAS_BIAS1_PWD_IC5GRXRF25_LSB) -#define BIAS_BIAS1_PWD_IC5GRXRF25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GRXRF25_LSB) & BIAS_BIAS1_PWD_IC5GRXRF25_MASK) -#define BIAS_BIAS1_PWD_IC5GRXRF25_RESET 1'h0 -#define BIAS_BIAS1_PWD_IC5GTXPA25_MSB 13 -#define BIAS_BIAS1_PWD_IC5GTXPA25_LSB 11 -#define BIAS_BIAS1_PWD_IC5GTXPA25_MASK 'h00003800 -#define BIAS_BIAS1_PWD_IC5GTXPA25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) >> BIAS_BIAS1_PWD_IC5GTXPA25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXPA25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GTXPA25_LSB) & BIAS_BIAS1_PWD_IC5GTXPA25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXPA25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MSB 10 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_LSB 8 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_MASK 'h00000700 -#define BIAS_BIAS1_PWD_IC5GTXBUF25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) >> BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GTXBUF25_LSB) & BIAS_BIAS1_PWD_IC5GTXBUF25_MASK) -#define BIAS_BIAS1_PWD_IC5GTXBUF25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC5GQB25_MSB 7 -#define BIAS_BIAS1_PWD_IC5GQB25_LSB 5 -#define BIAS_BIAS1_PWD_IC5GQB25_MASK 'h000000e0 -#define BIAS_BIAS1_PWD_IC5GQB25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GQB25_MASK) >> BIAS_BIAS1_PWD_IC5GQB25_LSB) -#define BIAS_BIAS1_PWD_IC5GQB25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GQB25_LSB) & BIAS_BIAS1_PWD_IC5GQB25_MASK) -#define BIAS_BIAS1_PWD_IC5GQB25_RESET 3'h3 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MSB 4 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_LSB 2 -#define BIAS_BIAS1_PWD_IC5GMIXQ25_MASK 'h0000001c -#define BIAS_BIAS1_PWD_IC5GMIXQ25_GET(x) (((x) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) >> BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_PWD_IC5GMIXQ25_LSB) & BIAS_BIAS1_PWD_IC5GMIXQ25_MASK) -#define BIAS_BIAS1_PWD_IC5GMIXQ25_RESET 3'h3 -#define BIAS_BIAS1_SPARE_MSB 1 -#define BIAS_BIAS1_SPARE_LSB 0 -#define BIAS_BIAS1_SPARE_MASK 'h00000003 -#define BIAS_BIAS1_SPARE_GET(x) (((x) & BIAS_BIAS1_SPARE_MASK) >> BIAS_BIAS1_SPARE_LSB) -#define BIAS_BIAS1_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS1_SPARE_LSB) & BIAS_BIAS1_SPARE_MASK) -#define BIAS_BIAS1_SPARE_RESET 2'h3 -#define BIAS_BIAS1_RESET (32'h0 | \ - BIAS_BIAS1_PWD_ICDAC2BB25_SET(BIAS_BIAS1_PWD_ICDAC2BB25_RESET) | \ - BIAS_BIAS1_PWD_IC2GVGM25_SET(BIAS_BIAS1_PWD_IC2GVGM25_RESET) | \ - BIAS_BIAS1_PWD_IC2GRFFE25_SET(BIAS_BIAS1_PWD_IC2GRFFE25_RESET) | \ - BIAS_BIAS1_PWD_IC2GLOREG25_SET(BIAS_BIAS1_PWD_IC2GLOREG25_RESET) | \ - BIAS_BIAS1_PWD_IC2GLNAREG25_SET(BIAS_BIAS1_PWD_IC2GLNAREG25_RESET) | \ - BIAS_BIAS1_PWD_ICDETECTORB25_SET(BIAS_BIAS1_PWD_ICDETECTORB25_RESET) | \ - BIAS_BIAS1_PWD_ICDETECTORA25_SET(BIAS_BIAS1_PWD_ICDETECTORA25_RESET) | \ - BIAS_BIAS1_PWD_IC5GRXRF25_SET(BIAS_BIAS1_PWD_IC5GRXRF25_RESET) | \ - BIAS_BIAS1_PWD_IC5GTXPA25_SET(BIAS_BIAS1_PWD_IC5GTXPA25_RESET) | \ - BIAS_BIAS1_PWD_IC5GTXBUF25_SET(BIAS_BIAS1_PWD_IC5GTXBUF25_RESET) | \ - BIAS_BIAS1_PWD_IC5GQB25_SET(BIAS_BIAS1_PWD_IC5GQB25_RESET) | \ - BIAS_BIAS1_PWD_IC5GMIXQ25_SET(BIAS_BIAS1_PWD_IC5GMIXQ25_RESET) | \ - BIAS_BIAS1_SPARE_SET(BIAS_BIAS1_SPARE_RESET)) -#define BIAS_BIAS1_HW_MASK (32'h0) -#define BIAS_BIAS1_SW_MASK (32'h0 | \ - BIAS_BIAS1_PWD_ICDAC2BB25_MASK | \ - BIAS_BIAS1_PWD_IC2GVGM25_MASK | \ - BIAS_BIAS1_PWD_IC2GRFFE25_MASK | \ - BIAS_BIAS1_PWD_IC2GLOREG25_MASK | \ - BIAS_BIAS1_PWD_IC2GLNAREG25_MASK | \ - BIAS_BIAS1_PWD_ICDETECTORB25_MASK | \ - BIAS_BIAS1_PWD_ICDETECTORA25_MASK | \ - BIAS_BIAS1_PWD_IC5GRXRF25_MASK | \ - BIAS_BIAS1_PWD_IC5GTXPA25_MASK | \ - BIAS_BIAS1_PWD_IC5GTXBUF25_MASK | \ - BIAS_BIAS1_PWD_IC5GQB25_MASK | \ - BIAS_BIAS1_PWD_IC5GMIXQ25_MASK | \ - BIAS_BIAS1_SPARE_MASK) - -#define BIAS_BIAS2_ADDRESS 'h00000008 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MSB 31 -#define BIAS_BIAS2_PWD_IC5GMIXI25_LSB 29 -#define BIAS_BIAS2_PWD_IC5GMIXI25_MASK 'he0000000 -#define BIAS_BIAS2_PWD_IC5GMIXI25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) >> BIAS_BIAS2_PWD_IC5GMIXI25_LSB) -#define BIAS_BIAS2_PWD_IC5GMIXI25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IC5GMIXI25_LSB) & BIAS_BIAS2_PWD_IC5GMIXI25_MASK) -#define BIAS_BIAS2_PWD_IC5GMIXI25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IC5GDIV25_MSB 28 -#define BIAS_BIAS2_PWD_IC5GDIV25_LSB 26 -#define BIAS_BIAS2_PWD_IC5GDIV25_MASK 'h1c000000 -#define BIAS_BIAS2_PWD_IC5GDIV25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) >> BIAS_BIAS2_PWD_IC5GDIV25_LSB) -#define BIAS_BIAS2_PWD_IC5GDIV25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IC5GDIV25_LSB) & BIAS_BIAS2_PWD_IC5GDIV25_MASK) -#define BIAS_BIAS2_PWD_IC5GDIV25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IC5GLOREG25_MSB 25 -#define BIAS_BIAS2_PWD_IC5GLOREG25_LSB 23 -#define BIAS_BIAS2_PWD_IC5GLOREG25_MASK 'h03800000 -#define BIAS_BIAS2_PWD_IC5GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) >> BIAS_BIAS2_PWD_IC5GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IC5GLOREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IC5GLOREG25_LSB) & BIAS_BIAS2_PWD_IC5GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IC5GLOREG25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRPLL25_MSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_LSB 22 -#define BIAS_BIAS2_PWD_IRPLL25_MASK 'h00400000 -#define BIAS_BIAS2_PWD_IRPLL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRPLL25_MASK) >> BIAS_BIAS2_PWD_IRPLL25_LSB) -#define BIAS_BIAS2_PWD_IRPLL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRPLL25_LSB) & BIAS_BIAS2_PWD_IRPLL25_MASK) -#define BIAS_BIAS2_PWD_IRPLL25_RESET 1'h0 -#define BIAS_BIAS2_PWD_IRXTAL25_MSB 21 -#define BIAS_BIAS2_PWD_IRXTAL25_LSB 19 -#define BIAS_BIAS2_PWD_IRXTAL25_MASK 'h00380000 -#define BIAS_BIAS2_PWD_IRXTAL25_GET(x) (((x) & BIAS_BIAS2_PWD_IRXTAL25_MASK) >> BIAS_BIAS2_PWD_IRXTAL25_LSB) -#define BIAS_BIAS2_PWD_IRXTAL25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRXTAL25_LSB) & BIAS_BIAS2_PWD_IRXTAL25_MASK) -#define BIAS_BIAS2_PWD_IRXTAL25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRTSENS25_MSB 18 -#define BIAS_BIAS2_PWD_IRTSENS25_LSB 16 -#define BIAS_BIAS2_PWD_IRTSENS25_MASK 'h00070000 -#define BIAS_BIAS2_PWD_IRTSENS25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTSENS25_MASK) >> BIAS_BIAS2_PWD_IRTSENS25_LSB) -#define BIAS_BIAS2_PWD_IRTSENS25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRTSENS25_LSB) & BIAS_BIAS2_PWD_IRTSENS25_MASK) -#define BIAS_BIAS2_PWD_IRTSENS25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRTXPC25_MSB 15 -#define BIAS_BIAS2_PWD_IRTXPC25_LSB 13 -#define BIAS_BIAS2_PWD_IRTXPC25_MASK 'h0000e000 -#define BIAS_BIAS2_PWD_IRTXPC25_GET(x) (((x) & BIAS_BIAS2_PWD_IRTXPC25_MASK) >> BIAS_BIAS2_PWD_IRTXPC25_LSB) -#define BIAS_BIAS2_PWD_IRTXPC25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRTXPC25_LSB) & BIAS_BIAS2_PWD_IRTXPC25_MASK) -#define BIAS_BIAS2_PWD_IRTXPC25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IRLDO25_MSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_LSB 12 -#define BIAS_BIAS2_PWD_IRLDO25_MASK 'h00001000 -#define BIAS_BIAS2_PWD_IRLDO25_GET(x) (((x) & BIAS_BIAS2_PWD_IRLDO25_MASK) >> BIAS_BIAS2_PWD_IRLDO25_LSB) -#define BIAS_BIAS2_PWD_IRLDO25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IRLDO25_LSB) & BIAS_BIAS2_PWD_IRLDO25_MASK) -#define BIAS_BIAS2_PWD_IRLDO25_RESET 1'h0 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MSB 11 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_LSB 9 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_MASK 'h00000e00 -#define BIAS_BIAS2_PWD_IR2GTXMIX25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) >> BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR2GTXMIX25_LSB) & BIAS_BIAS2_PWD_IR2GTXMIX25_MASK) -#define BIAS_BIAS2_PWD_IR2GTXMIX25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IR2GLOREG25_MSB 8 -#define BIAS_BIAS2_PWD_IR2GLOREG25_LSB 6 -#define BIAS_BIAS2_PWD_IR2GLOREG25_MASK 'h000001c0 -#define BIAS_BIAS2_PWD_IR2GLOREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLOREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLOREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR2GLOREG25_LSB) & BIAS_BIAS2_PWD_IR2GLOREG25_MASK) -#define BIAS_BIAS2_PWD_IR2GLOREG25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MSB 5 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_LSB 3 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_MASK 'h00000038 -#define BIAS_BIAS2_PWD_IR2GLNAREG25_GET(x) (((x) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) >> BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR2GLNAREG25_LSB) & BIAS_BIAS2_PWD_IR2GLNAREG25_MASK) -#define BIAS_BIAS2_PWD_IR2GLNAREG25_RESET 3'h3 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MSB 2 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB 0 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK 'h00000007 -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_GET(x) (((x) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) >> BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_SET(x) (((32'd0 | (x)) << BIAS_BIAS2_PWD_IR5GRFVREF2525_LSB) & BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) -#define BIAS_BIAS2_PWD_IR5GRFVREF2525_RESET 3'h3 -#define BIAS_BIAS2_RESET (32'h0 | \ - BIAS_BIAS2_PWD_IC5GMIXI25_SET(BIAS_BIAS2_PWD_IC5GMIXI25_RESET) | \ - BIAS_BIAS2_PWD_IC5GDIV25_SET(BIAS_BIAS2_PWD_IC5GDIV25_RESET) | \ - BIAS_BIAS2_PWD_IC5GLOREG25_SET(BIAS_BIAS2_PWD_IC5GLOREG25_RESET) | \ - BIAS_BIAS2_PWD_IRPLL25_SET(BIAS_BIAS2_PWD_IRPLL25_RESET) | \ - BIAS_BIAS2_PWD_IRXTAL25_SET(BIAS_BIAS2_PWD_IRXTAL25_RESET) | \ - BIAS_BIAS2_PWD_IRTSENS25_SET(BIAS_BIAS2_PWD_IRTSENS25_RESET) | \ - BIAS_BIAS2_PWD_IRTXPC25_SET(BIAS_BIAS2_PWD_IRTXPC25_RESET) | \ - BIAS_BIAS2_PWD_IRLDO25_SET(BIAS_BIAS2_PWD_IRLDO25_RESET) | \ - BIAS_BIAS2_PWD_IR2GTXMIX25_SET(BIAS_BIAS2_PWD_IR2GTXMIX25_RESET) | \ - BIAS_BIAS2_PWD_IR2GLOREG25_SET(BIAS_BIAS2_PWD_IR2GLOREG25_RESET) | \ - BIAS_BIAS2_PWD_IR2GLNAREG25_SET(BIAS_BIAS2_PWD_IR2GLNAREG25_RESET) | \ - BIAS_BIAS2_PWD_IR5GRFVREF2525_SET(BIAS_BIAS2_PWD_IR5GRFVREF2525_RESET)) -#define BIAS_BIAS2_HW_MASK (32'h0) -#define BIAS_BIAS2_SW_MASK (32'h0 | \ - BIAS_BIAS2_PWD_IC5GMIXI25_MASK | \ - BIAS_BIAS2_PWD_IC5GDIV25_MASK | \ - BIAS_BIAS2_PWD_IC5GLOREG25_MASK | \ - BIAS_BIAS2_PWD_IRPLL25_MASK | \ - BIAS_BIAS2_PWD_IRXTAL25_MASK | \ - BIAS_BIAS2_PWD_IRTSENS25_MASK | \ - BIAS_BIAS2_PWD_IRTXPC25_MASK | \ - BIAS_BIAS2_PWD_IRLDO25_MASK | \ - BIAS_BIAS2_PWD_IR2GTXMIX25_MASK | \ - BIAS_BIAS2_PWD_IR2GLOREG25_MASK | \ - BIAS_BIAS2_PWD_IR2GLNAREG25_MASK | \ - BIAS_BIAS2_PWD_IR5GRFVREF2525_MASK) - -#define BIAS_BIAS3_ADDRESS 'h0000000c -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MSB 31 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_LSB 29 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_MASK 'he0000000 -#define BIAS_BIAS3_PWD_IR5GTXMIX25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) >> BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) -#define BIAS_BIAS3_PWD_IR5GTXMIX25_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR5GTXMIX25_LSB) & BIAS_BIAS3_PWD_IR5GTXMIX25_MASK) -#define BIAS_BIAS3_PWD_IR5GTXMIX25_RESET 3'h3 -#define BIAS_BIAS3_PWD_IR5GAGC25_MSB 28 -#define BIAS_BIAS3_PWD_IR5GAGC25_LSB 26 -#define BIAS_BIAS3_PWD_IR5GAGC25_MASK 'h1c000000 -#define BIAS_BIAS3_PWD_IR5GAGC25_GET(x) (((x) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) >> BIAS_BIAS3_PWD_IR5GAGC25_LSB) -#define BIAS_BIAS3_PWD_IR5GAGC25_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR5GAGC25_LSB) & BIAS_BIAS3_PWD_IR5GAGC25_MASK) -#define BIAS_BIAS3_PWD_IR5GAGC25_RESET 3'h3 -#define BIAS_BIAS3_PWD_ICDAC50_MSB 25 -#define BIAS_BIAS3_PWD_ICDAC50_LSB 23 -#define BIAS_BIAS3_PWD_ICDAC50_MASK 'h03800000 -#define BIAS_BIAS3_PWD_ICDAC50_GET(x) (((x) & BIAS_BIAS3_PWD_ICDAC50_MASK) >> BIAS_BIAS3_PWD_ICDAC50_LSB) -#define BIAS_BIAS3_PWD_ICDAC50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICDAC50_LSB) & BIAS_BIAS3_PWD_ICDAC50_MASK) -#define BIAS_BIAS3_PWD_ICDAC50_RESET 3'h3 -#define BIAS_BIAS3_PWD_ICSYNTH50_MSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_LSB 22 -#define BIAS_BIAS3_PWD_ICSYNTH50_MASK 'h00400000 -#define BIAS_BIAS3_PWD_ICSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) >> BIAS_BIAS3_PWD_ICSYNTH50_LSB) -#define BIAS_BIAS3_PWD_ICSYNTH50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICSYNTH50_LSB) & BIAS_BIAS3_PWD_ICSYNTH50_MASK) -#define BIAS_BIAS3_PWD_ICSYNTH50_RESET 1'h0 -#define BIAS_BIAS3_PWD_ICBB50_MSB 21 -#define BIAS_BIAS3_PWD_ICBB50_LSB 21 -#define BIAS_BIAS3_PWD_ICBB50_MASK 'h00200000 -#define BIAS_BIAS3_PWD_ICBB50_GET(x) (((x) & BIAS_BIAS3_PWD_ICBB50_MASK) >> BIAS_BIAS3_PWD_ICBB50_LSB) -#define BIAS_BIAS3_PWD_ICBB50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICBB50_LSB) & BIAS_BIAS3_PWD_ICBB50_MASK) -#define BIAS_BIAS3_PWD_ICBB50_RESET 1'h0 -#define BIAS_BIAS3_PWD_IC2GDIV50_MSB 20 -#define BIAS_BIAS3_PWD_IC2GDIV50_LSB 18 -#define BIAS_BIAS3_PWD_IC2GDIV50_MASK 'h001c0000 -#define BIAS_BIAS3_PWD_IC2GDIV50_GET(x) (((x) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) >> BIAS_BIAS3_PWD_IC2GDIV50_LSB) -#define BIAS_BIAS3_PWD_IC2GDIV50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IC2GDIV50_LSB) & BIAS_BIAS3_PWD_IC2GDIV50_MASK) -#define BIAS_BIAS3_PWD_IC2GDIV50_RESET 3'h3 -#define BIAS_BIAS3_PWD_IRSYNTH50_MSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_LSB 17 -#define BIAS_BIAS3_PWD_IRSYNTH50_MASK 'h00020000 -#define BIAS_BIAS3_PWD_IRSYNTH50_GET(x) (((x) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) >> BIAS_BIAS3_PWD_IRSYNTH50_LSB) -#define BIAS_BIAS3_PWD_IRSYNTH50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IRSYNTH50_LSB) & BIAS_BIAS3_PWD_IRSYNTH50_MASK) -#define BIAS_BIAS3_PWD_IRSYNTH50_RESET 1'h0 -#define BIAS_BIAS3_PWD_IRBB50_MSB 16 -#define BIAS_BIAS3_PWD_IRBB50_LSB 16 -#define BIAS_BIAS3_PWD_IRBB50_MASK 'h00010000 -#define BIAS_BIAS3_PWD_IRBB50_GET(x) (((x) & BIAS_BIAS3_PWD_IRBB50_MASK) >> BIAS_BIAS3_PWD_IRBB50_LSB) -#define BIAS_BIAS3_PWD_IRBB50_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IRBB50_LSB) & BIAS_BIAS3_PWD_IRBB50_MASK) -#define BIAS_BIAS3_PWD_IRBB50_RESET 1'h0 -#define BIAS_BIAS3_PWD_IC25SPARE1_MSB 15 -#define BIAS_BIAS3_PWD_IC25SPARE1_LSB 13 -#define BIAS_BIAS3_PWD_IC25SPARE1_MASK 'h0000e000 -#define BIAS_BIAS3_PWD_IC25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) >> BIAS_BIAS3_PWD_IC25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE1_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IC25SPARE1_LSB) & BIAS_BIAS3_PWD_IC25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE1_RESET 3'h3 -#define BIAS_BIAS3_PWD_IC25SPARE2_MSB 12 -#define BIAS_BIAS3_PWD_IC25SPARE2_LSB 10 -#define BIAS_BIAS3_PWD_IC25SPARE2_MASK 'h00001c00 -#define BIAS_BIAS3_PWD_IC25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) >> BIAS_BIAS3_PWD_IC25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IC25SPARE2_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IC25SPARE2_LSB) & BIAS_BIAS3_PWD_IC25SPARE2_MASK) -#define BIAS_BIAS3_PWD_IC25SPARE2_RESET 3'h3 -#define BIAS_BIAS3_PWD_IR25SPARE1_MSB 9 -#define BIAS_BIAS3_PWD_IR25SPARE1_LSB 7 -#define BIAS_BIAS3_PWD_IR25SPARE1_MASK 'h00000380 -#define BIAS_BIAS3_PWD_IR25SPARE1_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) >> BIAS_BIAS3_PWD_IR25SPARE1_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE1_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR25SPARE1_LSB) & BIAS_BIAS3_PWD_IR25SPARE1_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE1_RESET 3'h3 -#define BIAS_BIAS3_PWD_IR25SPARE2_MSB 6 -#define BIAS_BIAS3_PWD_IR25SPARE2_LSB 4 -#define BIAS_BIAS3_PWD_IR25SPARE2_MASK 'h00000070 -#define BIAS_BIAS3_PWD_IR25SPARE2_GET(x) (((x) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) >> BIAS_BIAS3_PWD_IR25SPARE2_LSB) -#define BIAS_BIAS3_PWD_IR25SPARE2_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_IR25SPARE2_LSB) & BIAS_BIAS3_PWD_IR25SPARE2_MASK) -#define BIAS_BIAS3_PWD_IR25SPARE2_RESET 3'h3 -#define BIAS_BIAS3_PWD_ICDACREG12P5_MSB 3 -#define BIAS_BIAS3_PWD_ICDACREG12P5_LSB 1 -#define BIAS_BIAS3_PWD_ICDACREG12P5_MASK 'h0000000e -#define BIAS_BIAS3_PWD_ICDACREG12P5_GET(x) (((x) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) >> BIAS_BIAS3_PWD_ICDACREG12P5_LSB) -#define BIAS_BIAS3_PWD_ICDACREG12P5_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_PWD_ICDACREG12P5_LSB) & BIAS_BIAS3_PWD_ICDACREG12P5_MASK) -#define BIAS_BIAS3_PWD_ICDACREG12P5_RESET 3'h5 -#define BIAS_BIAS3_SPARE_MSB 0 -#define BIAS_BIAS3_SPARE_LSB 0 -#define BIAS_BIAS3_SPARE_MASK 'h00000001 -#define BIAS_BIAS3_SPARE_GET(x) (((x) & BIAS_BIAS3_SPARE_MASK) >> BIAS_BIAS3_SPARE_LSB) -#define BIAS_BIAS3_SPARE_SET(x) (((32'd0 | (x)) << BIAS_BIAS3_SPARE_LSB) & BIAS_BIAS3_SPARE_MASK) -#define BIAS_BIAS3_SPARE_RESET 1'h0 -#define BIAS_BIAS3_RESET (32'h0 | \ - BIAS_BIAS3_PWD_IR5GTXMIX25_SET(BIAS_BIAS3_PWD_IR5GTXMIX25_RESET) | \ - BIAS_BIAS3_PWD_IR5GAGC25_SET(BIAS_BIAS3_PWD_IR5GAGC25_RESET) | \ - BIAS_BIAS3_PWD_ICDAC50_SET(BIAS_BIAS3_PWD_ICDAC50_RESET) | \ - BIAS_BIAS3_PWD_ICSYNTH50_SET(BIAS_BIAS3_PWD_ICSYNTH50_RESET) | \ - BIAS_BIAS3_PWD_ICBB50_SET(BIAS_BIAS3_PWD_ICBB50_RESET) | \ - BIAS_BIAS3_PWD_IC2GDIV50_SET(BIAS_BIAS3_PWD_IC2GDIV50_RESET) | \ - BIAS_BIAS3_PWD_IRSYNTH50_SET(BIAS_BIAS3_PWD_IRSYNTH50_RESET) | \ - BIAS_BIAS3_PWD_IRBB50_SET(BIAS_BIAS3_PWD_IRBB50_RESET) | \ - BIAS_BIAS3_PWD_IC25SPARE1_SET(BIAS_BIAS3_PWD_IC25SPARE1_RESET) | \ - BIAS_BIAS3_PWD_IC25SPARE2_SET(BIAS_BIAS3_PWD_IC25SPARE2_RESET) | \ - BIAS_BIAS3_PWD_IR25SPARE1_SET(BIAS_BIAS3_PWD_IR25SPARE1_RESET) | \ - BIAS_BIAS3_PWD_IR25SPARE2_SET(BIAS_BIAS3_PWD_IR25SPARE2_RESET) | \ - BIAS_BIAS3_PWD_ICDACREG12P5_SET(BIAS_BIAS3_PWD_ICDACREG12P5_RESET) | \ - BIAS_BIAS3_SPARE_SET(BIAS_BIAS3_SPARE_RESET)) -#define BIAS_BIAS3_HW_MASK (32'h0) -#define BIAS_BIAS3_SW_MASK (32'h0 | \ - BIAS_BIAS3_PWD_IR5GTXMIX25_MASK | \ - BIAS_BIAS3_PWD_IR5GAGC25_MASK | \ - BIAS_BIAS3_PWD_ICDAC50_MASK | \ - BIAS_BIAS3_PWD_ICSYNTH50_MASK | \ - BIAS_BIAS3_PWD_ICBB50_MASK | \ - BIAS_BIAS3_PWD_IC2GDIV50_MASK | \ - BIAS_BIAS3_PWD_IRSYNTH50_MASK | \ - BIAS_BIAS3_PWD_IRBB50_MASK | \ - BIAS_BIAS3_PWD_IC25SPARE1_MASK | \ - BIAS_BIAS3_PWD_IC25SPARE2_MASK | \ - BIAS_BIAS3_PWD_IR25SPARE1_MASK | \ - BIAS_BIAS3_PWD_IR25SPARE2_MASK | \ - BIAS_BIAS3_PWD_ICDACREG12P5_MASK | \ - BIAS_BIAS3_SPARE_MASK) - -#define BIAS_REG_ADDRESS_MSB 3 - -#endif /* _BIAS_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/gpio_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/gpio_reg.h deleted file mode 100644 index 4f2b964b7df3..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/gpio_reg.h +++ /dev/null @@ -1,977 +0,0 @@ -#ifndef _GPIO_REG_REG_H_ -#define _GPIO_REG_REG_H_ - -#define GPIO_OUT_ADDRESS 0x00000000 -#define GPIO_OUT_OFFSET 0x00000000 -#define GPIO_OUT_DATA_MSB 17 -#define GPIO_OUT_DATA_LSB 0 -#define GPIO_OUT_DATA_MASK 0x0003ffff -#define GPIO_OUT_DATA_GET(x) (((x) & GPIO_OUT_DATA_MASK) >> GPIO_OUT_DATA_LSB) -#define GPIO_OUT_DATA_SET(x) (((x) << GPIO_OUT_DATA_LSB) & GPIO_OUT_DATA_MASK) - -#define GPIO_OUT_W1TS_ADDRESS 0x00000004 -#define GPIO_OUT_W1TS_OFFSET 0x00000004 -#define GPIO_OUT_W1TS_DATA_MSB 17 -#define GPIO_OUT_W1TS_DATA_LSB 0 -#define GPIO_OUT_W1TS_DATA_MASK 0x0003ffff -#define GPIO_OUT_W1TS_DATA_GET(x) (((x) & GPIO_OUT_W1TS_DATA_MASK) >> GPIO_OUT_W1TS_DATA_LSB) -#define GPIO_OUT_W1TS_DATA_SET(x) (((x) << GPIO_OUT_W1TS_DATA_LSB) & GPIO_OUT_W1TS_DATA_MASK) - -#define GPIO_OUT_W1TC_ADDRESS 0x00000008 -#define GPIO_OUT_W1TC_OFFSET 0x00000008 -#define GPIO_OUT_W1TC_DATA_MSB 17 -#define GPIO_OUT_W1TC_DATA_LSB 0 -#define GPIO_OUT_W1TC_DATA_MASK 0x0003ffff -#define GPIO_OUT_W1TC_DATA_GET(x) (((x) & GPIO_OUT_W1TC_DATA_MASK) >> GPIO_OUT_W1TC_DATA_LSB) -#define GPIO_OUT_W1TC_DATA_SET(x) (((x) << GPIO_OUT_W1TC_DATA_LSB) & GPIO_OUT_W1TC_DATA_MASK) - -#define GPIO_ENABLE_ADDRESS 0x0000000c -#define GPIO_ENABLE_OFFSET 0x0000000c -#define GPIO_ENABLE_DATA_MSB 17 -#define GPIO_ENABLE_DATA_LSB 0 -#define GPIO_ENABLE_DATA_MASK 0x0003ffff -#define GPIO_ENABLE_DATA_GET(x) (((x) & GPIO_ENABLE_DATA_MASK) >> GPIO_ENABLE_DATA_LSB) -#define GPIO_ENABLE_DATA_SET(x) (((x) << GPIO_ENABLE_DATA_LSB) & GPIO_ENABLE_DATA_MASK) - -#define GPIO_ENABLE_W1TS_ADDRESS 0x00000010 -#define GPIO_ENABLE_W1TS_OFFSET 0x00000010 -#define GPIO_ENABLE_W1TS_DATA_MSB 17 -#define GPIO_ENABLE_W1TS_DATA_LSB 0 -#define GPIO_ENABLE_W1TS_DATA_MASK 0x0003ffff -#define GPIO_ENABLE_W1TS_DATA_GET(x) (((x) & GPIO_ENABLE_W1TS_DATA_MASK) >> GPIO_ENABLE_W1TS_DATA_LSB) -#define GPIO_ENABLE_W1TS_DATA_SET(x) (((x) << GPIO_ENABLE_W1TS_DATA_LSB) & GPIO_ENABLE_W1TS_DATA_MASK) - -#define GPIO_ENABLE_W1TC_ADDRESS 0x00000014 -#define GPIO_ENABLE_W1TC_OFFSET 0x00000014 -#define GPIO_ENABLE_W1TC_DATA_MSB 17 -#define GPIO_ENABLE_W1TC_DATA_LSB 0 -#define GPIO_ENABLE_W1TC_DATA_MASK 0x0003ffff -#define GPIO_ENABLE_W1TC_DATA_GET(x) (((x) & GPIO_ENABLE_W1TC_DATA_MASK) >> GPIO_ENABLE_W1TC_DATA_LSB) -#define GPIO_ENABLE_W1TC_DATA_SET(x) (((x) << GPIO_ENABLE_W1TC_DATA_LSB) & GPIO_ENABLE_W1TC_DATA_MASK) - -#define GPIO_IN_ADDRESS 0x00000018 -#define GPIO_IN_OFFSET 0x00000018 -#define GPIO_IN_DATA_MSB 17 -#define GPIO_IN_DATA_LSB 0 -#define GPIO_IN_DATA_MASK 0x0003ffff -#define GPIO_IN_DATA_GET(x) (((x) & GPIO_IN_DATA_MASK) >> GPIO_IN_DATA_LSB) -#define GPIO_IN_DATA_SET(x) (((x) << GPIO_IN_DATA_LSB) & GPIO_IN_DATA_MASK) - -#define GPIO_STATUS_ADDRESS 0x0000001c -#define GPIO_STATUS_OFFSET 0x0000001c -#define GPIO_STATUS_INTERRUPT_MSB 17 -#define GPIO_STATUS_INTERRUPT_LSB 0 -#define GPIO_STATUS_INTERRUPT_MASK 0x0003ffff -#define GPIO_STATUS_INTERRUPT_GET(x) (((x) & GPIO_STATUS_INTERRUPT_MASK) >> GPIO_STATUS_INTERRUPT_LSB) -#define GPIO_STATUS_INTERRUPT_SET(x) (((x) << GPIO_STATUS_INTERRUPT_LSB) & GPIO_STATUS_INTERRUPT_MASK) - -#define GPIO_STATUS_W1TS_ADDRESS 0x00000020 -#define GPIO_STATUS_W1TS_OFFSET 0x00000020 -#define GPIO_STATUS_W1TS_INTERRUPT_MSB 17 -#define GPIO_STATUS_W1TS_INTERRUPT_LSB 0 -#define GPIO_STATUS_W1TS_INTERRUPT_MASK 0x0003ffff -#define GPIO_STATUS_W1TS_INTERRUPT_GET(x) (((x) & GPIO_STATUS_W1TS_INTERRUPT_MASK) >> GPIO_STATUS_W1TS_INTERRUPT_LSB) -#define GPIO_STATUS_W1TS_INTERRUPT_SET(x) (((x) << GPIO_STATUS_W1TS_INTERRUPT_LSB) & GPIO_STATUS_W1TS_INTERRUPT_MASK) - -#define GPIO_STATUS_W1TC_ADDRESS 0x00000024 -#define GPIO_STATUS_W1TC_OFFSET 0x00000024 -#define GPIO_STATUS_W1TC_INTERRUPT_MSB 17 -#define GPIO_STATUS_W1TC_INTERRUPT_LSB 0 -#define GPIO_STATUS_W1TC_INTERRUPT_MASK 0x0003ffff -#define GPIO_STATUS_W1TC_INTERRUPT_GET(x) (((x) & GPIO_STATUS_W1TC_INTERRUPT_MASK) >> GPIO_STATUS_W1TC_INTERRUPT_LSB) -#define GPIO_STATUS_W1TC_INTERRUPT_SET(x) (((x) << GPIO_STATUS_W1TC_INTERRUPT_LSB) & GPIO_STATUS_W1TC_INTERRUPT_MASK) - -#define GPIO_PIN0_ADDRESS 0x00000028 -#define GPIO_PIN0_OFFSET 0x00000028 -#define GPIO_PIN0_CONFIG_MSB 12 -#define GPIO_PIN0_CONFIG_LSB 11 -#define GPIO_PIN0_CONFIG_MASK 0x00001800 -#define GPIO_PIN0_CONFIG_GET(x) (((x) & GPIO_PIN0_CONFIG_MASK) >> GPIO_PIN0_CONFIG_LSB) -#define GPIO_PIN0_CONFIG_SET(x) (((x) << GPIO_PIN0_CONFIG_LSB) & GPIO_PIN0_CONFIG_MASK) -#define GPIO_PIN0_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN0_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN0_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN0_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN0_WAKEUP_ENABLE_MASK) >> GPIO_PIN0_WAKEUP_ENABLE_LSB) -#define GPIO_PIN0_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN0_WAKEUP_ENABLE_LSB) & GPIO_PIN0_WAKEUP_ENABLE_MASK) -#define GPIO_PIN0_INT_TYPE_MSB 9 -#define GPIO_PIN0_INT_TYPE_LSB 7 -#define GPIO_PIN0_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN0_INT_TYPE_GET(x) (((x) & GPIO_PIN0_INT_TYPE_MASK) >> GPIO_PIN0_INT_TYPE_LSB) -#define GPIO_PIN0_INT_TYPE_SET(x) (((x) << GPIO_PIN0_INT_TYPE_LSB) & GPIO_PIN0_INT_TYPE_MASK) -#define GPIO_PIN0_PAD_DRIVER_MSB 2 -#define GPIO_PIN0_PAD_DRIVER_LSB 2 -#define GPIO_PIN0_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN0_PAD_DRIVER_GET(x) (((x) & GPIO_PIN0_PAD_DRIVER_MASK) >> GPIO_PIN0_PAD_DRIVER_LSB) -#define GPIO_PIN0_PAD_DRIVER_SET(x) (((x) << GPIO_PIN0_PAD_DRIVER_LSB) & GPIO_PIN0_PAD_DRIVER_MASK) -#define GPIO_PIN0_SOURCE_MSB 0 -#define GPIO_PIN0_SOURCE_LSB 0 -#define GPIO_PIN0_SOURCE_MASK 0x00000001 -#define GPIO_PIN0_SOURCE_GET(x) (((x) & GPIO_PIN0_SOURCE_MASK) >> GPIO_PIN0_SOURCE_LSB) -#define GPIO_PIN0_SOURCE_SET(x) (((x) << GPIO_PIN0_SOURCE_LSB) & GPIO_PIN0_SOURCE_MASK) - -#define GPIO_PIN1_ADDRESS 0x0000002c -#define GPIO_PIN1_OFFSET 0x0000002c -#define GPIO_PIN1_CONFIG_MSB 12 -#define GPIO_PIN1_CONFIG_LSB 11 -#define GPIO_PIN1_CONFIG_MASK 0x00001800 -#define GPIO_PIN1_CONFIG_GET(x) (((x) & GPIO_PIN1_CONFIG_MASK) >> GPIO_PIN1_CONFIG_LSB) -#define GPIO_PIN1_CONFIG_SET(x) (((x) << GPIO_PIN1_CONFIG_LSB) & GPIO_PIN1_CONFIG_MASK) -#define GPIO_PIN1_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN1_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN1_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN1_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN1_WAKEUP_ENABLE_MASK) >> GPIO_PIN1_WAKEUP_ENABLE_LSB) -#define GPIO_PIN1_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN1_WAKEUP_ENABLE_LSB) & GPIO_PIN1_WAKEUP_ENABLE_MASK) -#define GPIO_PIN1_INT_TYPE_MSB 9 -#define GPIO_PIN1_INT_TYPE_LSB 7 -#define GPIO_PIN1_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN1_INT_TYPE_GET(x) (((x) & GPIO_PIN1_INT_TYPE_MASK) >> GPIO_PIN1_INT_TYPE_LSB) -#define GPIO_PIN1_INT_TYPE_SET(x) (((x) << GPIO_PIN1_INT_TYPE_LSB) & GPIO_PIN1_INT_TYPE_MASK) -#define GPIO_PIN1_PAD_DRIVER_MSB 2 -#define GPIO_PIN1_PAD_DRIVER_LSB 2 -#define GPIO_PIN1_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN1_PAD_DRIVER_GET(x) (((x) & GPIO_PIN1_PAD_DRIVER_MASK) >> GPIO_PIN1_PAD_DRIVER_LSB) -#define GPIO_PIN1_PAD_DRIVER_SET(x) (((x) << GPIO_PIN1_PAD_DRIVER_LSB) & GPIO_PIN1_PAD_DRIVER_MASK) -#define GPIO_PIN1_SOURCE_MSB 0 -#define GPIO_PIN1_SOURCE_LSB 0 -#define GPIO_PIN1_SOURCE_MASK 0x00000001 -#define GPIO_PIN1_SOURCE_GET(x) (((x) & GPIO_PIN1_SOURCE_MASK) >> GPIO_PIN1_SOURCE_LSB) -#define GPIO_PIN1_SOURCE_SET(x) (((x) << GPIO_PIN1_SOURCE_LSB) & GPIO_PIN1_SOURCE_MASK) - -#define GPIO_PIN2_ADDRESS 0x00000030 -#define GPIO_PIN2_OFFSET 0x00000030 -#define GPIO_PIN2_CONFIG_MSB 12 -#define GPIO_PIN2_CONFIG_LSB 11 -#define GPIO_PIN2_CONFIG_MASK 0x00001800 -#define GPIO_PIN2_CONFIG_GET(x) (((x) & GPIO_PIN2_CONFIG_MASK) >> GPIO_PIN2_CONFIG_LSB) -#define GPIO_PIN2_CONFIG_SET(x) (((x) << GPIO_PIN2_CONFIG_LSB) & GPIO_PIN2_CONFIG_MASK) -#define GPIO_PIN2_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN2_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN2_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN2_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN2_WAKEUP_ENABLE_MASK) >> GPIO_PIN2_WAKEUP_ENABLE_LSB) -#define GPIO_PIN2_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN2_WAKEUP_ENABLE_LSB) & GPIO_PIN2_WAKEUP_ENABLE_MASK) -#define GPIO_PIN2_INT_TYPE_MSB 9 -#define GPIO_PIN2_INT_TYPE_LSB 7 -#define GPIO_PIN2_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN2_INT_TYPE_GET(x) (((x) & GPIO_PIN2_INT_TYPE_MASK) >> GPIO_PIN2_INT_TYPE_LSB) -#define GPIO_PIN2_INT_TYPE_SET(x) (((x) << GPIO_PIN2_INT_TYPE_LSB) & GPIO_PIN2_INT_TYPE_MASK) -#define GPIO_PIN2_PAD_DRIVER_MSB 2 -#define GPIO_PIN2_PAD_DRIVER_LSB 2 -#define GPIO_PIN2_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN2_PAD_DRIVER_GET(x) (((x) & GPIO_PIN2_PAD_DRIVER_MASK) >> GPIO_PIN2_PAD_DRIVER_LSB) -#define GPIO_PIN2_PAD_DRIVER_SET(x) (((x) << GPIO_PIN2_PAD_DRIVER_LSB) & GPIO_PIN2_PAD_DRIVER_MASK) -#define GPIO_PIN2_SOURCE_MSB 0 -#define GPIO_PIN2_SOURCE_LSB 0 -#define GPIO_PIN2_SOURCE_MASK 0x00000001 -#define GPIO_PIN2_SOURCE_GET(x) (((x) & GPIO_PIN2_SOURCE_MASK) >> GPIO_PIN2_SOURCE_LSB) -#define GPIO_PIN2_SOURCE_SET(x) (((x) << GPIO_PIN2_SOURCE_LSB) & GPIO_PIN2_SOURCE_MASK) - -#define GPIO_PIN3_ADDRESS 0x00000034 -#define GPIO_PIN3_OFFSET 0x00000034 -#define GPIO_PIN3_CONFIG_MSB 12 -#define GPIO_PIN3_CONFIG_LSB 11 -#define GPIO_PIN3_CONFIG_MASK 0x00001800 -#define GPIO_PIN3_CONFIG_GET(x) (((x) & GPIO_PIN3_CONFIG_MASK) >> GPIO_PIN3_CONFIG_LSB) -#define GPIO_PIN3_CONFIG_SET(x) (((x) << GPIO_PIN3_CONFIG_LSB) & GPIO_PIN3_CONFIG_MASK) -#define GPIO_PIN3_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN3_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN3_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN3_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN3_WAKEUP_ENABLE_MASK) >> GPIO_PIN3_WAKEUP_ENABLE_LSB) -#define GPIO_PIN3_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN3_WAKEUP_ENABLE_LSB) & GPIO_PIN3_WAKEUP_ENABLE_MASK) -#define GPIO_PIN3_INT_TYPE_MSB 9 -#define GPIO_PIN3_INT_TYPE_LSB 7 -#define GPIO_PIN3_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN3_INT_TYPE_GET(x) (((x) & GPIO_PIN3_INT_TYPE_MASK) >> GPIO_PIN3_INT_TYPE_LSB) -#define GPIO_PIN3_INT_TYPE_SET(x) (((x) << GPIO_PIN3_INT_TYPE_LSB) & GPIO_PIN3_INT_TYPE_MASK) -#define GPIO_PIN3_PAD_DRIVER_MSB 2 -#define GPIO_PIN3_PAD_DRIVER_LSB 2 -#define GPIO_PIN3_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN3_PAD_DRIVER_GET(x) (((x) & GPIO_PIN3_PAD_DRIVER_MASK) >> GPIO_PIN3_PAD_DRIVER_LSB) -#define GPIO_PIN3_PAD_DRIVER_SET(x) (((x) << GPIO_PIN3_PAD_DRIVER_LSB) & GPIO_PIN3_PAD_DRIVER_MASK) -#define GPIO_PIN3_SOURCE_MSB 0 -#define GPIO_PIN3_SOURCE_LSB 0 -#define GPIO_PIN3_SOURCE_MASK 0x00000001 -#define GPIO_PIN3_SOURCE_GET(x) (((x) & GPIO_PIN3_SOURCE_MASK) >> GPIO_PIN3_SOURCE_LSB) -#define GPIO_PIN3_SOURCE_SET(x) (((x) << GPIO_PIN3_SOURCE_LSB) & GPIO_PIN3_SOURCE_MASK) - -#define GPIO_PIN4_ADDRESS 0x00000038 -#define GPIO_PIN4_OFFSET 0x00000038 -#define GPIO_PIN4_CONFIG_MSB 12 -#define GPIO_PIN4_CONFIG_LSB 11 -#define GPIO_PIN4_CONFIG_MASK 0x00001800 -#define GPIO_PIN4_CONFIG_GET(x) (((x) & GPIO_PIN4_CONFIG_MASK) >> GPIO_PIN4_CONFIG_LSB) -#define GPIO_PIN4_CONFIG_SET(x) (((x) << GPIO_PIN4_CONFIG_LSB) & GPIO_PIN4_CONFIG_MASK) -#define GPIO_PIN4_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN4_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN4_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN4_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN4_WAKEUP_ENABLE_MASK) >> GPIO_PIN4_WAKEUP_ENABLE_LSB) -#define GPIO_PIN4_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN4_WAKEUP_ENABLE_LSB) & GPIO_PIN4_WAKEUP_ENABLE_MASK) -#define GPIO_PIN4_INT_TYPE_MSB 9 -#define GPIO_PIN4_INT_TYPE_LSB 7 -#define GPIO_PIN4_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN4_INT_TYPE_GET(x) (((x) & GPIO_PIN4_INT_TYPE_MASK) >> GPIO_PIN4_INT_TYPE_LSB) -#define GPIO_PIN4_INT_TYPE_SET(x) (((x) << GPIO_PIN4_INT_TYPE_LSB) & GPIO_PIN4_INT_TYPE_MASK) -#define GPIO_PIN4_PAD_DRIVER_MSB 2 -#define GPIO_PIN4_PAD_DRIVER_LSB 2 -#define GPIO_PIN4_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN4_PAD_DRIVER_GET(x) (((x) & GPIO_PIN4_PAD_DRIVER_MASK) >> GPIO_PIN4_PAD_DRIVER_LSB) -#define GPIO_PIN4_PAD_DRIVER_SET(x) (((x) << GPIO_PIN4_PAD_DRIVER_LSB) & GPIO_PIN4_PAD_DRIVER_MASK) -#define GPIO_PIN4_SOURCE_MSB 0 -#define GPIO_PIN4_SOURCE_LSB 0 -#define GPIO_PIN4_SOURCE_MASK 0x00000001 -#define GPIO_PIN4_SOURCE_GET(x) (((x) & GPIO_PIN4_SOURCE_MASK) >> GPIO_PIN4_SOURCE_LSB) -#define GPIO_PIN4_SOURCE_SET(x) (((x) << GPIO_PIN4_SOURCE_LSB) & GPIO_PIN4_SOURCE_MASK) - -#define GPIO_PIN5_ADDRESS 0x0000003c -#define GPIO_PIN5_OFFSET 0x0000003c -#define GPIO_PIN5_CONFIG_MSB 12 -#define GPIO_PIN5_CONFIG_LSB 11 -#define GPIO_PIN5_CONFIG_MASK 0x00001800 -#define GPIO_PIN5_CONFIG_GET(x) (((x) & GPIO_PIN5_CONFIG_MASK) >> GPIO_PIN5_CONFIG_LSB) -#define GPIO_PIN5_CONFIG_SET(x) (((x) << GPIO_PIN5_CONFIG_LSB) & GPIO_PIN5_CONFIG_MASK) -#define GPIO_PIN5_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN5_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN5_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN5_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN5_WAKEUP_ENABLE_MASK) >> GPIO_PIN5_WAKEUP_ENABLE_LSB) -#define GPIO_PIN5_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN5_WAKEUP_ENABLE_LSB) & GPIO_PIN5_WAKEUP_ENABLE_MASK) -#define GPIO_PIN5_INT_TYPE_MSB 9 -#define GPIO_PIN5_INT_TYPE_LSB 7 -#define GPIO_PIN5_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN5_INT_TYPE_GET(x) (((x) & GPIO_PIN5_INT_TYPE_MASK) >> GPIO_PIN5_INT_TYPE_LSB) -#define GPIO_PIN5_INT_TYPE_SET(x) (((x) << GPIO_PIN5_INT_TYPE_LSB) & GPIO_PIN5_INT_TYPE_MASK) -#define GPIO_PIN5_PAD_DRIVER_MSB 2 -#define GPIO_PIN5_PAD_DRIVER_LSB 2 -#define GPIO_PIN5_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN5_PAD_DRIVER_GET(x) (((x) & GPIO_PIN5_PAD_DRIVER_MASK) >> GPIO_PIN5_PAD_DRIVER_LSB) -#define GPIO_PIN5_PAD_DRIVER_SET(x) (((x) << GPIO_PIN5_PAD_DRIVER_LSB) & GPIO_PIN5_PAD_DRIVER_MASK) -#define GPIO_PIN5_SOURCE_MSB 0 -#define GPIO_PIN5_SOURCE_LSB 0 -#define GPIO_PIN5_SOURCE_MASK 0x00000001 -#define GPIO_PIN5_SOURCE_GET(x) (((x) & GPIO_PIN5_SOURCE_MASK) >> GPIO_PIN5_SOURCE_LSB) -#define GPIO_PIN5_SOURCE_SET(x) (((x) << GPIO_PIN5_SOURCE_LSB) & GPIO_PIN5_SOURCE_MASK) - -#define GPIO_PIN6_ADDRESS 0x00000040 -#define GPIO_PIN6_OFFSET 0x00000040 -#define GPIO_PIN6_CONFIG_MSB 12 -#define GPIO_PIN6_CONFIG_LSB 11 -#define GPIO_PIN6_CONFIG_MASK 0x00001800 -#define GPIO_PIN6_CONFIG_GET(x) (((x) & GPIO_PIN6_CONFIG_MASK) >> GPIO_PIN6_CONFIG_LSB) -#define GPIO_PIN6_CONFIG_SET(x) (((x) << GPIO_PIN6_CONFIG_LSB) & GPIO_PIN6_CONFIG_MASK) -#define GPIO_PIN6_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN6_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN6_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN6_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN6_WAKEUP_ENABLE_MASK) >> GPIO_PIN6_WAKEUP_ENABLE_LSB) -#define GPIO_PIN6_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN6_WAKEUP_ENABLE_LSB) & GPIO_PIN6_WAKEUP_ENABLE_MASK) -#define GPIO_PIN6_INT_TYPE_MSB 9 -#define GPIO_PIN6_INT_TYPE_LSB 7 -#define GPIO_PIN6_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN6_INT_TYPE_GET(x) (((x) & GPIO_PIN6_INT_TYPE_MASK) >> GPIO_PIN6_INT_TYPE_LSB) -#define GPIO_PIN6_INT_TYPE_SET(x) (((x) << GPIO_PIN6_INT_TYPE_LSB) & GPIO_PIN6_INT_TYPE_MASK) -#define GPIO_PIN6_PAD_DRIVER_MSB 2 -#define GPIO_PIN6_PAD_DRIVER_LSB 2 -#define GPIO_PIN6_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN6_PAD_DRIVER_GET(x) (((x) & GPIO_PIN6_PAD_DRIVER_MASK) >> GPIO_PIN6_PAD_DRIVER_LSB) -#define GPIO_PIN6_PAD_DRIVER_SET(x) (((x) << GPIO_PIN6_PAD_DRIVER_LSB) & GPIO_PIN6_PAD_DRIVER_MASK) -#define GPIO_PIN6_SOURCE_MSB 0 -#define GPIO_PIN6_SOURCE_LSB 0 -#define GPIO_PIN6_SOURCE_MASK 0x00000001 -#define GPIO_PIN6_SOURCE_GET(x) (((x) & GPIO_PIN6_SOURCE_MASK) >> GPIO_PIN6_SOURCE_LSB) -#define GPIO_PIN6_SOURCE_SET(x) (((x) << GPIO_PIN6_SOURCE_LSB) & GPIO_PIN6_SOURCE_MASK) - -#define GPIO_PIN7_ADDRESS 0x00000044 -#define GPIO_PIN7_OFFSET 0x00000044 -#define GPIO_PIN7_CONFIG_MSB 12 -#define GPIO_PIN7_CONFIG_LSB 11 -#define GPIO_PIN7_CONFIG_MASK 0x00001800 -#define GPIO_PIN7_CONFIG_GET(x) (((x) & GPIO_PIN7_CONFIG_MASK) >> GPIO_PIN7_CONFIG_LSB) -#define GPIO_PIN7_CONFIG_SET(x) (((x) << GPIO_PIN7_CONFIG_LSB) & GPIO_PIN7_CONFIG_MASK) -#define GPIO_PIN7_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN7_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN7_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN7_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN7_WAKEUP_ENABLE_MASK) >> GPIO_PIN7_WAKEUP_ENABLE_LSB) -#define GPIO_PIN7_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN7_WAKEUP_ENABLE_LSB) & GPIO_PIN7_WAKEUP_ENABLE_MASK) -#define GPIO_PIN7_INT_TYPE_MSB 9 -#define GPIO_PIN7_INT_TYPE_LSB 7 -#define GPIO_PIN7_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN7_INT_TYPE_GET(x) (((x) & GPIO_PIN7_INT_TYPE_MASK) >> GPIO_PIN7_INT_TYPE_LSB) -#define GPIO_PIN7_INT_TYPE_SET(x) (((x) << GPIO_PIN7_INT_TYPE_LSB) & GPIO_PIN7_INT_TYPE_MASK) -#define GPIO_PIN7_PAD_DRIVER_MSB 2 -#define GPIO_PIN7_PAD_DRIVER_LSB 2 -#define GPIO_PIN7_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN7_PAD_DRIVER_GET(x) (((x) & GPIO_PIN7_PAD_DRIVER_MASK) >> GPIO_PIN7_PAD_DRIVER_LSB) -#define GPIO_PIN7_PAD_DRIVER_SET(x) (((x) << GPIO_PIN7_PAD_DRIVER_LSB) & GPIO_PIN7_PAD_DRIVER_MASK) -#define GPIO_PIN7_SOURCE_MSB 0 -#define GPIO_PIN7_SOURCE_LSB 0 -#define GPIO_PIN7_SOURCE_MASK 0x00000001 -#define GPIO_PIN7_SOURCE_GET(x) (((x) & GPIO_PIN7_SOURCE_MASK) >> GPIO_PIN7_SOURCE_LSB) -#define GPIO_PIN7_SOURCE_SET(x) (((x) << GPIO_PIN7_SOURCE_LSB) & GPIO_PIN7_SOURCE_MASK) - -#define GPIO_PIN8_ADDRESS 0x00000048 -#define GPIO_PIN8_OFFSET 0x00000048 -#define GPIO_PIN8_CONFIG_MSB 12 -#define GPIO_PIN8_CONFIG_LSB 11 -#define GPIO_PIN8_CONFIG_MASK 0x00001800 -#define GPIO_PIN8_CONFIG_GET(x) (((x) & GPIO_PIN8_CONFIG_MASK) >> GPIO_PIN8_CONFIG_LSB) -#define GPIO_PIN8_CONFIG_SET(x) (((x) << GPIO_PIN8_CONFIG_LSB) & GPIO_PIN8_CONFIG_MASK) -#define GPIO_PIN8_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN8_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN8_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN8_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN8_WAKEUP_ENABLE_MASK) >> GPIO_PIN8_WAKEUP_ENABLE_LSB) -#define GPIO_PIN8_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN8_WAKEUP_ENABLE_LSB) & GPIO_PIN8_WAKEUP_ENABLE_MASK) -#define GPIO_PIN8_INT_TYPE_MSB 9 -#define GPIO_PIN8_INT_TYPE_LSB 7 -#define GPIO_PIN8_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN8_INT_TYPE_GET(x) (((x) & GPIO_PIN8_INT_TYPE_MASK) >> GPIO_PIN8_INT_TYPE_LSB) -#define GPIO_PIN8_INT_TYPE_SET(x) (((x) << GPIO_PIN8_INT_TYPE_LSB) & GPIO_PIN8_INT_TYPE_MASK) -#define GPIO_PIN8_PAD_DRIVER_MSB 2 -#define GPIO_PIN8_PAD_DRIVER_LSB 2 -#define GPIO_PIN8_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN8_PAD_DRIVER_GET(x) (((x) & GPIO_PIN8_PAD_DRIVER_MASK) >> GPIO_PIN8_PAD_DRIVER_LSB) -#define GPIO_PIN8_PAD_DRIVER_SET(x) (((x) << GPIO_PIN8_PAD_DRIVER_LSB) & GPIO_PIN8_PAD_DRIVER_MASK) -#define GPIO_PIN8_SOURCE_MSB 0 -#define GPIO_PIN8_SOURCE_LSB 0 -#define GPIO_PIN8_SOURCE_MASK 0x00000001 -#define GPIO_PIN8_SOURCE_GET(x) (((x) & GPIO_PIN8_SOURCE_MASK) >> GPIO_PIN8_SOURCE_LSB) -#define GPIO_PIN8_SOURCE_SET(x) (((x) << GPIO_PIN8_SOURCE_LSB) & GPIO_PIN8_SOURCE_MASK) - -#define GPIO_PIN9_ADDRESS 0x0000004c -#define GPIO_PIN9_OFFSET 0x0000004c -#define GPIO_PIN9_CONFIG_MSB 12 -#define GPIO_PIN9_CONFIG_LSB 11 -#define GPIO_PIN9_CONFIG_MASK 0x00001800 -#define GPIO_PIN9_CONFIG_GET(x) (((x) & GPIO_PIN9_CONFIG_MASK) >> GPIO_PIN9_CONFIG_LSB) -#define GPIO_PIN9_CONFIG_SET(x) (((x) << GPIO_PIN9_CONFIG_LSB) & GPIO_PIN9_CONFIG_MASK) -#define GPIO_PIN9_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN9_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN9_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN9_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN9_WAKEUP_ENABLE_MASK) >> GPIO_PIN9_WAKEUP_ENABLE_LSB) -#define GPIO_PIN9_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN9_WAKEUP_ENABLE_LSB) & GPIO_PIN9_WAKEUP_ENABLE_MASK) -#define GPIO_PIN9_INT_TYPE_MSB 9 -#define GPIO_PIN9_INT_TYPE_LSB 7 -#define GPIO_PIN9_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN9_INT_TYPE_GET(x) (((x) & GPIO_PIN9_INT_TYPE_MASK) >> GPIO_PIN9_INT_TYPE_LSB) -#define GPIO_PIN9_INT_TYPE_SET(x) (((x) << GPIO_PIN9_INT_TYPE_LSB) & GPIO_PIN9_INT_TYPE_MASK) -#define GPIO_PIN9_PAD_DRIVER_MSB 2 -#define GPIO_PIN9_PAD_DRIVER_LSB 2 -#define GPIO_PIN9_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN9_PAD_DRIVER_GET(x) (((x) & GPIO_PIN9_PAD_DRIVER_MASK) >> GPIO_PIN9_PAD_DRIVER_LSB) -#define GPIO_PIN9_PAD_DRIVER_SET(x) (((x) << GPIO_PIN9_PAD_DRIVER_LSB) & GPIO_PIN9_PAD_DRIVER_MASK) -#define GPIO_PIN9_SOURCE_MSB 0 -#define GPIO_PIN9_SOURCE_LSB 0 -#define GPIO_PIN9_SOURCE_MASK 0x00000001 -#define GPIO_PIN9_SOURCE_GET(x) (((x) & GPIO_PIN9_SOURCE_MASK) >> GPIO_PIN9_SOURCE_LSB) -#define GPIO_PIN9_SOURCE_SET(x) (((x) << GPIO_PIN9_SOURCE_LSB) & GPIO_PIN9_SOURCE_MASK) - -#define GPIO_PIN10_ADDRESS 0x00000050 -#define GPIO_PIN10_OFFSET 0x00000050 -#define GPIO_PIN10_CONFIG_MSB 12 -#define GPIO_PIN10_CONFIG_LSB 11 -#define GPIO_PIN10_CONFIG_MASK 0x00001800 -#define GPIO_PIN10_CONFIG_GET(x) (((x) & GPIO_PIN10_CONFIG_MASK) >> GPIO_PIN10_CONFIG_LSB) -#define GPIO_PIN10_CONFIG_SET(x) (((x) << GPIO_PIN10_CONFIG_LSB) & GPIO_PIN10_CONFIG_MASK) -#define GPIO_PIN10_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN10_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN10_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN10_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN10_WAKEUP_ENABLE_MASK) >> GPIO_PIN10_WAKEUP_ENABLE_LSB) -#define GPIO_PIN10_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN10_WAKEUP_ENABLE_LSB) & GPIO_PIN10_WAKEUP_ENABLE_MASK) -#define GPIO_PIN10_INT_TYPE_MSB 9 -#define GPIO_PIN10_INT_TYPE_LSB 7 -#define GPIO_PIN10_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN10_INT_TYPE_GET(x) (((x) & GPIO_PIN10_INT_TYPE_MASK) >> GPIO_PIN10_INT_TYPE_LSB) -#define GPIO_PIN10_INT_TYPE_SET(x) (((x) << GPIO_PIN10_INT_TYPE_LSB) & GPIO_PIN10_INT_TYPE_MASK) -#define GPIO_PIN10_PAD_DRIVER_MSB 2 -#define GPIO_PIN10_PAD_DRIVER_LSB 2 -#define GPIO_PIN10_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN10_PAD_DRIVER_GET(x) (((x) & GPIO_PIN10_PAD_DRIVER_MASK) >> GPIO_PIN10_PAD_DRIVER_LSB) -#define GPIO_PIN10_PAD_DRIVER_SET(x) (((x) << GPIO_PIN10_PAD_DRIVER_LSB) & GPIO_PIN10_PAD_DRIVER_MASK) -#define GPIO_PIN10_SOURCE_MSB 0 -#define GPIO_PIN10_SOURCE_LSB 0 -#define GPIO_PIN10_SOURCE_MASK 0x00000001 -#define GPIO_PIN10_SOURCE_GET(x) (((x) & GPIO_PIN10_SOURCE_MASK) >> GPIO_PIN10_SOURCE_LSB) -#define GPIO_PIN10_SOURCE_SET(x) (((x) << GPIO_PIN10_SOURCE_LSB) & GPIO_PIN10_SOURCE_MASK) - -#define GPIO_PIN11_ADDRESS 0x00000054 -#define GPIO_PIN11_OFFSET 0x00000054 -#define GPIO_PIN11_CONFIG_MSB 12 -#define GPIO_PIN11_CONFIG_LSB 11 -#define GPIO_PIN11_CONFIG_MASK 0x00001800 -#define GPIO_PIN11_CONFIG_GET(x) (((x) & GPIO_PIN11_CONFIG_MASK) >> GPIO_PIN11_CONFIG_LSB) -#define GPIO_PIN11_CONFIG_SET(x) (((x) << GPIO_PIN11_CONFIG_LSB) & GPIO_PIN11_CONFIG_MASK) -#define GPIO_PIN11_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN11_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN11_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN11_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN11_WAKEUP_ENABLE_MASK) >> GPIO_PIN11_WAKEUP_ENABLE_LSB) -#define GPIO_PIN11_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN11_WAKEUP_ENABLE_LSB) & GPIO_PIN11_WAKEUP_ENABLE_MASK) -#define GPIO_PIN11_INT_TYPE_MSB 9 -#define GPIO_PIN11_INT_TYPE_LSB 7 -#define GPIO_PIN11_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN11_INT_TYPE_GET(x) (((x) & GPIO_PIN11_INT_TYPE_MASK) >> GPIO_PIN11_INT_TYPE_LSB) -#define GPIO_PIN11_INT_TYPE_SET(x) (((x) << GPIO_PIN11_INT_TYPE_LSB) & GPIO_PIN11_INT_TYPE_MASK) -#define GPIO_PIN11_PAD_DRIVER_MSB 2 -#define GPIO_PIN11_PAD_DRIVER_LSB 2 -#define GPIO_PIN11_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN11_PAD_DRIVER_GET(x) (((x) & GPIO_PIN11_PAD_DRIVER_MASK) >> GPIO_PIN11_PAD_DRIVER_LSB) -#define GPIO_PIN11_PAD_DRIVER_SET(x) (((x) << GPIO_PIN11_PAD_DRIVER_LSB) & GPIO_PIN11_PAD_DRIVER_MASK) -#define GPIO_PIN11_SOURCE_MSB 0 -#define GPIO_PIN11_SOURCE_LSB 0 -#define GPIO_PIN11_SOURCE_MASK 0x00000001 -#define GPIO_PIN11_SOURCE_GET(x) (((x) & GPIO_PIN11_SOURCE_MASK) >> GPIO_PIN11_SOURCE_LSB) -#define GPIO_PIN11_SOURCE_SET(x) (((x) << GPIO_PIN11_SOURCE_LSB) & GPIO_PIN11_SOURCE_MASK) - -#define GPIO_PIN12_ADDRESS 0x00000058 -#define GPIO_PIN12_OFFSET 0x00000058 -#define GPIO_PIN12_CONFIG_MSB 12 -#define GPIO_PIN12_CONFIG_LSB 11 -#define GPIO_PIN12_CONFIG_MASK 0x00001800 -#define GPIO_PIN12_CONFIG_GET(x) (((x) & GPIO_PIN12_CONFIG_MASK) >> GPIO_PIN12_CONFIG_LSB) -#define GPIO_PIN12_CONFIG_SET(x) (((x) << GPIO_PIN12_CONFIG_LSB) & GPIO_PIN12_CONFIG_MASK) -#define GPIO_PIN12_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN12_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN12_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN12_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN12_WAKEUP_ENABLE_MASK) >> GPIO_PIN12_WAKEUP_ENABLE_LSB) -#define GPIO_PIN12_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN12_WAKEUP_ENABLE_LSB) & GPIO_PIN12_WAKEUP_ENABLE_MASK) -#define GPIO_PIN12_INT_TYPE_MSB 9 -#define GPIO_PIN12_INT_TYPE_LSB 7 -#define GPIO_PIN12_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN12_INT_TYPE_GET(x) (((x) & GPIO_PIN12_INT_TYPE_MASK) >> GPIO_PIN12_INT_TYPE_LSB) -#define GPIO_PIN12_INT_TYPE_SET(x) (((x) << GPIO_PIN12_INT_TYPE_LSB) & GPIO_PIN12_INT_TYPE_MASK) -#define GPIO_PIN12_PAD_DRIVER_MSB 2 -#define GPIO_PIN12_PAD_DRIVER_LSB 2 -#define GPIO_PIN12_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN12_PAD_DRIVER_GET(x) (((x) & GPIO_PIN12_PAD_DRIVER_MASK) >> GPIO_PIN12_PAD_DRIVER_LSB) -#define GPIO_PIN12_PAD_DRIVER_SET(x) (((x) << GPIO_PIN12_PAD_DRIVER_LSB) & GPIO_PIN12_PAD_DRIVER_MASK) -#define GPIO_PIN12_SOURCE_MSB 0 -#define GPIO_PIN12_SOURCE_LSB 0 -#define GPIO_PIN12_SOURCE_MASK 0x00000001 -#define GPIO_PIN12_SOURCE_GET(x) (((x) & GPIO_PIN12_SOURCE_MASK) >> GPIO_PIN12_SOURCE_LSB) -#define GPIO_PIN12_SOURCE_SET(x) (((x) << GPIO_PIN12_SOURCE_LSB) & GPIO_PIN12_SOURCE_MASK) - -#define GPIO_PIN13_ADDRESS 0x0000005c -#define GPIO_PIN13_OFFSET 0x0000005c -#define GPIO_PIN13_CONFIG_MSB 12 -#define GPIO_PIN13_CONFIG_LSB 11 -#define GPIO_PIN13_CONFIG_MASK 0x00001800 -#define GPIO_PIN13_CONFIG_GET(x) (((x) & GPIO_PIN13_CONFIG_MASK) >> GPIO_PIN13_CONFIG_LSB) -#define GPIO_PIN13_CONFIG_SET(x) (((x) << GPIO_PIN13_CONFIG_LSB) & GPIO_PIN13_CONFIG_MASK) -#define GPIO_PIN13_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN13_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN13_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN13_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN13_WAKEUP_ENABLE_MASK) >> GPIO_PIN13_WAKEUP_ENABLE_LSB) -#define GPIO_PIN13_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN13_WAKEUP_ENABLE_LSB) & GPIO_PIN13_WAKEUP_ENABLE_MASK) -#define GPIO_PIN13_INT_TYPE_MSB 9 -#define GPIO_PIN13_INT_TYPE_LSB 7 -#define GPIO_PIN13_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN13_INT_TYPE_GET(x) (((x) & GPIO_PIN13_INT_TYPE_MASK) >> GPIO_PIN13_INT_TYPE_LSB) -#define GPIO_PIN13_INT_TYPE_SET(x) (((x) << GPIO_PIN13_INT_TYPE_LSB) & GPIO_PIN13_INT_TYPE_MASK) -#define GPIO_PIN13_PAD_DRIVER_MSB 2 -#define GPIO_PIN13_PAD_DRIVER_LSB 2 -#define GPIO_PIN13_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN13_PAD_DRIVER_GET(x) (((x) & GPIO_PIN13_PAD_DRIVER_MASK) >> GPIO_PIN13_PAD_DRIVER_LSB) -#define GPIO_PIN13_PAD_DRIVER_SET(x) (((x) << GPIO_PIN13_PAD_DRIVER_LSB) & GPIO_PIN13_PAD_DRIVER_MASK) -#define GPIO_PIN13_SOURCE_MSB 0 -#define GPIO_PIN13_SOURCE_LSB 0 -#define GPIO_PIN13_SOURCE_MASK 0x00000001 -#define GPIO_PIN13_SOURCE_GET(x) (((x) & GPIO_PIN13_SOURCE_MASK) >> GPIO_PIN13_SOURCE_LSB) -#define GPIO_PIN13_SOURCE_SET(x) (((x) << GPIO_PIN13_SOURCE_LSB) & GPIO_PIN13_SOURCE_MASK) - -#define GPIO_PIN14_ADDRESS 0x00000060 -#define GPIO_PIN14_OFFSET 0x00000060 -#define GPIO_PIN14_CONFIG_MSB 12 -#define GPIO_PIN14_CONFIG_LSB 11 -#define GPIO_PIN14_CONFIG_MASK 0x00001800 -#define GPIO_PIN14_CONFIG_GET(x) (((x) & GPIO_PIN14_CONFIG_MASK) >> GPIO_PIN14_CONFIG_LSB) -#define GPIO_PIN14_CONFIG_SET(x) (((x) << GPIO_PIN14_CONFIG_LSB) & GPIO_PIN14_CONFIG_MASK) -#define GPIO_PIN14_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN14_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN14_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN14_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN14_WAKEUP_ENABLE_MASK) >> GPIO_PIN14_WAKEUP_ENABLE_LSB) -#define GPIO_PIN14_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN14_WAKEUP_ENABLE_LSB) & GPIO_PIN14_WAKEUP_ENABLE_MASK) -#define GPIO_PIN14_INT_TYPE_MSB 9 -#define GPIO_PIN14_INT_TYPE_LSB 7 -#define GPIO_PIN14_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN14_INT_TYPE_GET(x) (((x) & GPIO_PIN14_INT_TYPE_MASK) >> GPIO_PIN14_INT_TYPE_LSB) -#define GPIO_PIN14_INT_TYPE_SET(x) (((x) << GPIO_PIN14_INT_TYPE_LSB) & GPIO_PIN14_INT_TYPE_MASK) -#define GPIO_PIN14_PAD_DRIVER_MSB 2 -#define GPIO_PIN14_PAD_DRIVER_LSB 2 -#define GPIO_PIN14_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN14_PAD_DRIVER_GET(x) (((x) & GPIO_PIN14_PAD_DRIVER_MASK) >> GPIO_PIN14_PAD_DRIVER_LSB) -#define GPIO_PIN14_PAD_DRIVER_SET(x) (((x) << GPIO_PIN14_PAD_DRIVER_LSB) & GPIO_PIN14_PAD_DRIVER_MASK) -#define GPIO_PIN14_SOURCE_MSB 0 -#define GPIO_PIN14_SOURCE_LSB 0 -#define GPIO_PIN14_SOURCE_MASK 0x00000001 -#define GPIO_PIN14_SOURCE_GET(x) (((x) & GPIO_PIN14_SOURCE_MASK) >> GPIO_PIN14_SOURCE_LSB) -#define GPIO_PIN14_SOURCE_SET(x) (((x) << GPIO_PIN14_SOURCE_LSB) & GPIO_PIN14_SOURCE_MASK) - -#define GPIO_PIN15_ADDRESS 0x00000064 -#define GPIO_PIN15_OFFSET 0x00000064 -#define GPIO_PIN15_CONFIG_MSB 12 -#define GPIO_PIN15_CONFIG_LSB 11 -#define GPIO_PIN15_CONFIG_MASK 0x00001800 -#define GPIO_PIN15_CONFIG_GET(x) (((x) & GPIO_PIN15_CONFIG_MASK) >> GPIO_PIN15_CONFIG_LSB) -#define GPIO_PIN15_CONFIG_SET(x) (((x) << GPIO_PIN15_CONFIG_LSB) & GPIO_PIN15_CONFIG_MASK) -#define GPIO_PIN15_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN15_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN15_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN15_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN15_WAKEUP_ENABLE_MASK) >> GPIO_PIN15_WAKEUP_ENABLE_LSB) -#define GPIO_PIN15_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN15_WAKEUP_ENABLE_LSB) & GPIO_PIN15_WAKEUP_ENABLE_MASK) -#define GPIO_PIN15_INT_TYPE_MSB 9 -#define GPIO_PIN15_INT_TYPE_LSB 7 -#define GPIO_PIN15_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN15_INT_TYPE_GET(x) (((x) & GPIO_PIN15_INT_TYPE_MASK) >> GPIO_PIN15_INT_TYPE_LSB) -#define GPIO_PIN15_INT_TYPE_SET(x) (((x) << GPIO_PIN15_INT_TYPE_LSB) & GPIO_PIN15_INT_TYPE_MASK) -#define GPIO_PIN15_PAD_DRIVER_MSB 2 -#define GPIO_PIN15_PAD_DRIVER_LSB 2 -#define GPIO_PIN15_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN15_PAD_DRIVER_GET(x) (((x) & GPIO_PIN15_PAD_DRIVER_MASK) >> GPIO_PIN15_PAD_DRIVER_LSB) -#define GPIO_PIN15_PAD_DRIVER_SET(x) (((x) << GPIO_PIN15_PAD_DRIVER_LSB) & GPIO_PIN15_PAD_DRIVER_MASK) -#define GPIO_PIN15_SOURCE_MSB 0 -#define GPIO_PIN15_SOURCE_LSB 0 -#define GPIO_PIN15_SOURCE_MASK 0x00000001 -#define GPIO_PIN15_SOURCE_GET(x) (((x) & GPIO_PIN15_SOURCE_MASK) >> GPIO_PIN15_SOURCE_LSB) -#define GPIO_PIN15_SOURCE_SET(x) (((x) << GPIO_PIN15_SOURCE_LSB) & GPIO_PIN15_SOURCE_MASK) - -#define GPIO_PIN16_ADDRESS 0x00000068 -#define GPIO_PIN16_OFFSET 0x00000068 -#define GPIO_PIN16_CONFIG_MSB 12 -#define GPIO_PIN16_CONFIG_LSB 11 -#define GPIO_PIN16_CONFIG_MASK 0x00001800 -#define GPIO_PIN16_CONFIG_GET(x) (((x) & GPIO_PIN16_CONFIG_MASK) >> GPIO_PIN16_CONFIG_LSB) -#define GPIO_PIN16_CONFIG_SET(x) (((x) << GPIO_PIN16_CONFIG_LSB) & GPIO_PIN16_CONFIG_MASK) -#define GPIO_PIN16_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN16_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN16_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN16_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN16_WAKEUP_ENABLE_MASK) >> GPIO_PIN16_WAKEUP_ENABLE_LSB) -#define GPIO_PIN16_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN16_WAKEUP_ENABLE_LSB) & GPIO_PIN16_WAKEUP_ENABLE_MASK) -#define GPIO_PIN16_INT_TYPE_MSB 9 -#define GPIO_PIN16_INT_TYPE_LSB 7 -#define GPIO_PIN16_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN16_INT_TYPE_GET(x) (((x) & GPIO_PIN16_INT_TYPE_MASK) >> GPIO_PIN16_INT_TYPE_LSB) -#define GPIO_PIN16_INT_TYPE_SET(x) (((x) << GPIO_PIN16_INT_TYPE_LSB) & GPIO_PIN16_INT_TYPE_MASK) -#define GPIO_PIN16_PAD_DRIVER_MSB 2 -#define GPIO_PIN16_PAD_DRIVER_LSB 2 -#define GPIO_PIN16_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN16_PAD_DRIVER_GET(x) (((x) & GPIO_PIN16_PAD_DRIVER_MASK) >> GPIO_PIN16_PAD_DRIVER_LSB) -#define GPIO_PIN16_PAD_DRIVER_SET(x) (((x) << GPIO_PIN16_PAD_DRIVER_LSB) & GPIO_PIN16_PAD_DRIVER_MASK) -#define GPIO_PIN16_SOURCE_MSB 0 -#define GPIO_PIN16_SOURCE_LSB 0 -#define GPIO_PIN16_SOURCE_MASK 0x00000001 -#define GPIO_PIN16_SOURCE_GET(x) (((x) & GPIO_PIN16_SOURCE_MASK) >> GPIO_PIN16_SOURCE_LSB) -#define GPIO_PIN16_SOURCE_SET(x) (((x) << GPIO_PIN16_SOURCE_LSB) & GPIO_PIN16_SOURCE_MASK) - -#define GPIO_PIN17_ADDRESS 0x0000006c -#define GPIO_PIN17_OFFSET 0x0000006c -#define GPIO_PIN17_CONFIG_MSB 12 -#define GPIO_PIN17_CONFIG_LSB 11 -#define GPIO_PIN17_CONFIG_MASK 0x00001800 -#define GPIO_PIN17_CONFIG_GET(x) (((x) & GPIO_PIN17_CONFIG_MASK) >> GPIO_PIN17_CONFIG_LSB) -#define GPIO_PIN17_CONFIG_SET(x) (((x) << GPIO_PIN17_CONFIG_LSB) & GPIO_PIN17_CONFIG_MASK) -#define GPIO_PIN17_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN17_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN17_WAKEUP_ENABLE_MASK 0x00000400 -#define GPIO_PIN17_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN17_WAKEUP_ENABLE_MASK) >> GPIO_PIN17_WAKEUP_ENABLE_LSB) -#define GPIO_PIN17_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN17_WAKEUP_ENABLE_LSB) & GPIO_PIN17_WAKEUP_ENABLE_MASK) -#define GPIO_PIN17_INT_TYPE_MSB 9 -#define GPIO_PIN17_INT_TYPE_LSB 7 -#define GPIO_PIN17_INT_TYPE_MASK 0x00000380 -#define GPIO_PIN17_INT_TYPE_GET(x) (((x) & GPIO_PIN17_INT_TYPE_MASK) >> GPIO_PIN17_INT_TYPE_LSB) -#define GPIO_PIN17_INT_TYPE_SET(x) (((x) << GPIO_PIN17_INT_TYPE_LSB) & GPIO_PIN17_INT_TYPE_MASK) -#define GPIO_PIN17_PAD_DRIVER_MSB 2 -#define GPIO_PIN17_PAD_DRIVER_LSB 2 -#define GPIO_PIN17_PAD_DRIVER_MASK 0x00000004 -#define GPIO_PIN17_PAD_DRIVER_GET(x) (((x) & GPIO_PIN17_PAD_DRIVER_MASK) >> GPIO_PIN17_PAD_DRIVER_LSB) -#define GPIO_PIN17_PAD_DRIVER_SET(x) (((x) << GPIO_PIN17_PAD_DRIVER_LSB) & GPIO_PIN17_PAD_DRIVER_MASK) -#define GPIO_PIN17_SOURCE_MSB 0 -#define GPIO_PIN17_SOURCE_LSB 0 -#define GPIO_PIN17_SOURCE_MASK 0x00000001 -#define GPIO_PIN17_SOURCE_GET(x) (((x) & GPIO_PIN17_SOURCE_MASK) >> GPIO_PIN17_SOURCE_LSB) -#define GPIO_PIN17_SOURCE_SET(x) (((x) << GPIO_PIN17_SOURCE_LSB) & GPIO_PIN17_SOURCE_MASK) - -#define SDIO_PIN_ADDRESS 0x00000070 -#define SDIO_PIN_OFFSET 0x00000070 -#define SDIO_PIN_PAD_PULL_MSB 3 -#define SDIO_PIN_PAD_PULL_LSB 2 -#define SDIO_PIN_PAD_PULL_MASK 0x0000000c -#define SDIO_PIN_PAD_PULL_GET(x) (((x) & SDIO_PIN_PAD_PULL_MASK) >> SDIO_PIN_PAD_PULL_LSB) -#define SDIO_PIN_PAD_PULL_SET(x) (((x) << SDIO_PIN_PAD_PULL_LSB) & SDIO_PIN_PAD_PULL_MASK) -#define SDIO_PIN_PAD_STRENGTH_MSB 1 -#define SDIO_PIN_PAD_STRENGTH_LSB 0 -#define SDIO_PIN_PAD_STRENGTH_MASK 0x00000003 -#define SDIO_PIN_PAD_STRENGTH_GET(x) (((x) & SDIO_PIN_PAD_STRENGTH_MASK) >> SDIO_PIN_PAD_STRENGTH_LSB) -#define SDIO_PIN_PAD_STRENGTH_SET(x) (((x) << SDIO_PIN_PAD_STRENGTH_LSB) & SDIO_PIN_PAD_STRENGTH_MASK) - -#define CLK_REQ_PIN_ADDRESS 0x00000074 -#define CLK_REQ_PIN_OFFSET 0x00000074 -#define CLK_REQ_PIN_ATE_OE_L_MSB 4 -#define CLK_REQ_PIN_ATE_OE_L_LSB 4 -#define CLK_REQ_PIN_ATE_OE_L_MASK 0x00000010 -#define CLK_REQ_PIN_ATE_OE_L_GET(x) (((x) & CLK_REQ_PIN_ATE_OE_L_MASK) >> CLK_REQ_PIN_ATE_OE_L_LSB) -#define CLK_REQ_PIN_ATE_OE_L_SET(x) (((x) << CLK_REQ_PIN_ATE_OE_L_LSB) & CLK_REQ_PIN_ATE_OE_L_MASK) -#define CLK_REQ_PIN_PAD_PULL_MSB 3 -#define CLK_REQ_PIN_PAD_PULL_LSB 2 -#define CLK_REQ_PIN_PAD_PULL_MASK 0x0000000c -#define CLK_REQ_PIN_PAD_PULL_GET(x) (((x) & CLK_REQ_PIN_PAD_PULL_MASK) >> CLK_REQ_PIN_PAD_PULL_LSB) -#define CLK_REQ_PIN_PAD_PULL_SET(x) (((x) << CLK_REQ_PIN_PAD_PULL_LSB) & CLK_REQ_PIN_PAD_PULL_MASK) -#define CLK_REQ_PIN_PAD_STRENGTH_MSB 1 -#define CLK_REQ_PIN_PAD_STRENGTH_LSB 0 -#define CLK_REQ_PIN_PAD_STRENGTH_MASK 0x00000003 -#define CLK_REQ_PIN_PAD_STRENGTH_GET(x) (((x) & CLK_REQ_PIN_PAD_STRENGTH_MASK) >> CLK_REQ_PIN_PAD_STRENGTH_LSB) -#define CLK_REQ_PIN_PAD_STRENGTH_SET(x) (((x) << CLK_REQ_PIN_PAD_STRENGTH_LSB) & CLK_REQ_PIN_PAD_STRENGTH_MASK) - -#define SIGMA_DELTA_ADDRESS 0x00000078 -#define SIGMA_DELTA_OFFSET 0x00000078 -#define SIGMA_DELTA_ENABLE_MSB 16 -#define SIGMA_DELTA_ENABLE_LSB 16 -#define SIGMA_DELTA_ENABLE_MASK 0x00010000 -#define SIGMA_DELTA_ENABLE_GET(x) (((x) & SIGMA_DELTA_ENABLE_MASK) >> SIGMA_DELTA_ENABLE_LSB) -#define SIGMA_DELTA_ENABLE_SET(x) (((x) << SIGMA_DELTA_ENABLE_LSB) & SIGMA_DELTA_ENABLE_MASK) -#define SIGMA_DELTA_PRESCALAR_MSB 15 -#define SIGMA_DELTA_PRESCALAR_LSB 8 -#define SIGMA_DELTA_PRESCALAR_MASK 0x0000ff00 -#define SIGMA_DELTA_PRESCALAR_GET(x) (((x) & SIGMA_DELTA_PRESCALAR_MASK) >> SIGMA_DELTA_PRESCALAR_LSB) -#define SIGMA_DELTA_PRESCALAR_SET(x) (((x) << SIGMA_DELTA_PRESCALAR_LSB) & SIGMA_DELTA_PRESCALAR_MASK) -#define SIGMA_DELTA_TARGET_MSB 7 -#define SIGMA_DELTA_TARGET_LSB 0 -#define SIGMA_DELTA_TARGET_MASK 0x000000ff -#define SIGMA_DELTA_TARGET_GET(x) (((x) & SIGMA_DELTA_TARGET_MASK) >> SIGMA_DELTA_TARGET_LSB) -#define SIGMA_DELTA_TARGET_SET(x) (((x) << SIGMA_DELTA_TARGET_LSB) & SIGMA_DELTA_TARGET_MASK) - -#define DEBUG_CONTROL_ADDRESS 0x0000007c -#define DEBUG_CONTROL_OFFSET 0x0000007c -#define DEBUG_CONTROL_OBS_OE_L_MSB 1 -#define DEBUG_CONTROL_OBS_OE_L_LSB 1 -#define DEBUG_CONTROL_OBS_OE_L_MASK 0x00000002 -#define DEBUG_CONTROL_OBS_OE_L_GET(x) (((x) & DEBUG_CONTROL_OBS_OE_L_MASK) >> DEBUG_CONTROL_OBS_OE_L_LSB) -#define DEBUG_CONTROL_OBS_OE_L_SET(x) (((x) << DEBUG_CONTROL_OBS_OE_L_LSB) & DEBUG_CONTROL_OBS_OE_L_MASK) -#define DEBUG_CONTROL_ENABLE_MSB 0 -#define DEBUG_CONTROL_ENABLE_LSB 0 -#define DEBUG_CONTROL_ENABLE_MASK 0x00000001 -#define DEBUG_CONTROL_ENABLE_GET(x) (((x) & DEBUG_CONTROL_ENABLE_MASK) >> DEBUG_CONTROL_ENABLE_LSB) -#define DEBUG_CONTROL_ENABLE_SET(x) (((x) << DEBUG_CONTROL_ENABLE_LSB) & DEBUG_CONTROL_ENABLE_MASK) - -#define DEBUG_INPUT_SEL_ADDRESS 0x00000080 -#define DEBUG_INPUT_SEL_OFFSET 0x00000080 -#define DEBUG_INPUT_SEL_SRC_MSB 3 -#define DEBUG_INPUT_SEL_SRC_LSB 0 -#define DEBUG_INPUT_SEL_SRC_MASK 0x0000000f -#define DEBUG_INPUT_SEL_SRC_GET(x) (((x) & DEBUG_INPUT_SEL_SRC_MASK) >> DEBUG_INPUT_SEL_SRC_LSB) -#define DEBUG_INPUT_SEL_SRC_SET(x) (((x) << DEBUG_INPUT_SEL_SRC_LSB) & DEBUG_INPUT_SEL_SRC_MASK) - -#define DEBUG_OUT_ADDRESS 0x00000084 -#define DEBUG_OUT_OFFSET 0x00000084 -#define DEBUG_OUT_DATA_MSB 17 -#define DEBUG_OUT_DATA_LSB 0 -#define DEBUG_OUT_DATA_MASK 0x0003ffff -#define DEBUG_OUT_DATA_GET(x) (((x) & DEBUG_OUT_DATA_MASK) >> DEBUG_OUT_DATA_LSB) -#define DEBUG_OUT_DATA_SET(x) (((x) << DEBUG_OUT_DATA_LSB) & DEBUG_OUT_DATA_MASK) - -#define LA_CONTROL_ADDRESS 0x00000088 -#define LA_CONTROL_OFFSET 0x00000088 -#define LA_CONTROL_RUN_MSB 1 -#define LA_CONTROL_RUN_LSB 1 -#define LA_CONTROL_RUN_MASK 0x00000002 -#define LA_CONTROL_RUN_GET(x) (((x) & LA_CONTROL_RUN_MASK) >> LA_CONTROL_RUN_LSB) -#define LA_CONTROL_RUN_SET(x) (((x) << LA_CONTROL_RUN_LSB) & LA_CONTROL_RUN_MASK) -#define LA_CONTROL_TRIGGERED_MSB 0 -#define LA_CONTROL_TRIGGERED_LSB 0 -#define LA_CONTROL_TRIGGERED_MASK 0x00000001 -#define LA_CONTROL_TRIGGERED_GET(x) (((x) & LA_CONTROL_TRIGGERED_MASK) >> LA_CONTROL_TRIGGERED_LSB) -#define LA_CONTROL_TRIGGERED_SET(x) (((x) << LA_CONTROL_TRIGGERED_LSB) & LA_CONTROL_TRIGGERED_MASK) - -#define LA_CLOCK_ADDRESS 0x0000008c -#define LA_CLOCK_OFFSET 0x0000008c -#define LA_CLOCK_DIV_MSB 7 -#define LA_CLOCK_DIV_LSB 0 -#define LA_CLOCK_DIV_MASK 0x000000ff -#define LA_CLOCK_DIV_GET(x) (((x) & LA_CLOCK_DIV_MASK) >> LA_CLOCK_DIV_LSB) -#define LA_CLOCK_DIV_SET(x) (((x) << LA_CLOCK_DIV_LSB) & LA_CLOCK_DIV_MASK) - -#define LA_STATUS_ADDRESS 0x00000090 -#define LA_STATUS_OFFSET 0x00000090 -#define LA_STATUS_INTERRUPT_MSB 0 -#define LA_STATUS_INTERRUPT_LSB 0 -#define LA_STATUS_INTERRUPT_MASK 0x00000001 -#define LA_STATUS_INTERRUPT_GET(x) (((x) & LA_STATUS_INTERRUPT_MASK) >> LA_STATUS_INTERRUPT_LSB) -#define LA_STATUS_INTERRUPT_SET(x) (((x) << LA_STATUS_INTERRUPT_LSB) & LA_STATUS_INTERRUPT_MASK) - -#define LA_TRIGGER_SAMPLE_ADDRESS 0x00000094 -#define LA_TRIGGER_SAMPLE_OFFSET 0x00000094 -#define LA_TRIGGER_SAMPLE_COUNT_MSB 15 -#define LA_TRIGGER_SAMPLE_COUNT_LSB 0 -#define LA_TRIGGER_SAMPLE_COUNT_MASK 0x0000ffff -#define LA_TRIGGER_SAMPLE_COUNT_GET(x) (((x) & LA_TRIGGER_SAMPLE_COUNT_MASK) >> LA_TRIGGER_SAMPLE_COUNT_LSB) -#define LA_TRIGGER_SAMPLE_COUNT_SET(x) (((x) << LA_TRIGGER_SAMPLE_COUNT_LSB) & LA_TRIGGER_SAMPLE_COUNT_MASK) - -#define LA_TRIGGER_POSITION_ADDRESS 0x00000098 -#define LA_TRIGGER_POSITION_OFFSET 0x00000098 -#define LA_TRIGGER_POSITION_VALUE_MSB 15 -#define LA_TRIGGER_POSITION_VALUE_LSB 0 -#define LA_TRIGGER_POSITION_VALUE_MASK 0x0000ffff -#define LA_TRIGGER_POSITION_VALUE_GET(x) (((x) & LA_TRIGGER_POSITION_VALUE_MASK) >> LA_TRIGGER_POSITION_VALUE_LSB) -#define LA_TRIGGER_POSITION_VALUE_SET(x) (((x) << LA_TRIGGER_POSITION_VALUE_LSB) & LA_TRIGGER_POSITION_VALUE_MASK) - -#define LA_PRE_TRIGGER_ADDRESS 0x0000009c -#define LA_PRE_TRIGGER_OFFSET 0x0000009c -#define LA_PRE_TRIGGER_COUNT_MSB 15 -#define LA_PRE_TRIGGER_COUNT_LSB 0 -#define LA_PRE_TRIGGER_COUNT_MASK 0x0000ffff -#define LA_PRE_TRIGGER_COUNT_GET(x) (((x) & LA_PRE_TRIGGER_COUNT_MASK) >> LA_PRE_TRIGGER_COUNT_LSB) -#define LA_PRE_TRIGGER_COUNT_SET(x) (((x) << LA_PRE_TRIGGER_COUNT_LSB) & LA_PRE_TRIGGER_COUNT_MASK) - -#define LA_POST_TRIGGER_ADDRESS 0x000000a0 -#define LA_POST_TRIGGER_OFFSET 0x000000a0 -#define LA_POST_TRIGGER_COUNT_MSB 15 -#define LA_POST_TRIGGER_COUNT_LSB 0 -#define LA_POST_TRIGGER_COUNT_MASK 0x0000ffff -#define LA_POST_TRIGGER_COUNT_GET(x) (((x) & LA_POST_TRIGGER_COUNT_MASK) >> LA_POST_TRIGGER_COUNT_LSB) -#define LA_POST_TRIGGER_COUNT_SET(x) (((x) << LA_POST_TRIGGER_COUNT_LSB) & LA_POST_TRIGGER_COUNT_MASK) - -#define LA_FILTER_CONTROL_ADDRESS 0x000000a4 -#define LA_FILTER_CONTROL_OFFSET 0x000000a4 -#define LA_FILTER_CONTROL_DELTA_MSB 0 -#define LA_FILTER_CONTROL_DELTA_LSB 0 -#define LA_FILTER_CONTROL_DELTA_MASK 0x00000001 -#define LA_FILTER_CONTROL_DELTA_GET(x) (((x) & LA_FILTER_CONTROL_DELTA_MASK) >> LA_FILTER_CONTROL_DELTA_LSB) -#define LA_FILTER_CONTROL_DELTA_SET(x) (((x) << LA_FILTER_CONTROL_DELTA_LSB) & LA_FILTER_CONTROL_DELTA_MASK) - -#define LA_FILTER_DATA_ADDRESS 0x000000a8 -#define LA_FILTER_DATA_OFFSET 0x000000a8 -#define LA_FILTER_DATA_MATCH_MSB 17 -#define LA_FILTER_DATA_MATCH_LSB 0 -#define LA_FILTER_DATA_MATCH_MASK 0x0003ffff -#define LA_FILTER_DATA_MATCH_GET(x) (((x) & LA_FILTER_DATA_MATCH_MASK) >> LA_FILTER_DATA_MATCH_LSB) -#define LA_FILTER_DATA_MATCH_SET(x) (((x) << LA_FILTER_DATA_MATCH_LSB) & LA_FILTER_DATA_MATCH_MASK) - -#define LA_FILTER_WILDCARD_ADDRESS 0x000000ac -#define LA_FILTER_WILDCARD_OFFSET 0x000000ac -#define LA_FILTER_WILDCARD_MATCH_MSB 17 -#define LA_FILTER_WILDCARD_MATCH_LSB 0 -#define LA_FILTER_WILDCARD_MATCH_MASK 0x0003ffff -#define LA_FILTER_WILDCARD_MATCH_GET(x) (((x) & LA_FILTER_WILDCARD_MATCH_MASK) >> LA_FILTER_WILDCARD_MATCH_LSB) -#define LA_FILTER_WILDCARD_MATCH_SET(x) (((x) << LA_FILTER_WILDCARD_MATCH_LSB) & LA_FILTER_WILDCARD_MATCH_MASK) - -#define LA_TRIGGERA_DATA_ADDRESS 0x000000b0 -#define LA_TRIGGERA_DATA_OFFSET 0x000000b0 -#define LA_TRIGGERA_DATA_MATCH_MSB 17 -#define LA_TRIGGERA_DATA_MATCH_LSB 0 -#define LA_TRIGGERA_DATA_MATCH_MASK 0x0003ffff -#define LA_TRIGGERA_DATA_MATCH_GET(x) (((x) & LA_TRIGGERA_DATA_MATCH_MASK) >> LA_TRIGGERA_DATA_MATCH_LSB) -#define LA_TRIGGERA_DATA_MATCH_SET(x) (((x) << LA_TRIGGERA_DATA_MATCH_LSB) & LA_TRIGGERA_DATA_MATCH_MASK) - -#define LA_TRIGGERA_WILDCARD_ADDRESS 0x000000b4 -#define LA_TRIGGERA_WILDCARD_OFFSET 0x000000b4 -#define LA_TRIGGERA_WILDCARD_MATCH_MSB 17 -#define LA_TRIGGERA_WILDCARD_MATCH_LSB 0 -#define LA_TRIGGERA_WILDCARD_MATCH_MASK 0x0003ffff -#define LA_TRIGGERA_WILDCARD_MATCH_GET(x) (((x) & LA_TRIGGERA_WILDCARD_MATCH_MASK) >> LA_TRIGGERA_WILDCARD_MATCH_LSB) -#define LA_TRIGGERA_WILDCARD_MATCH_SET(x) (((x) << LA_TRIGGERA_WILDCARD_MATCH_LSB) & LA_TRIGGERA_WILDCARD_MATCH_MASK) - -#define LA_TRIGGERB_DATA_ADDRESS 0x000000b8 -#define LA_TRIGGERB_DATA_OFFSET 0x000000b8 -#define LA_TRIGGERB_DATA_MATCH_MSB 17 -#define LA_TRIGGERB_DATA_MATCH_LSB 0 -#define LA_TRIGGERB_DATA_MATCH_MASK 0x0003ffff -#define LA_TRIGGERB_DATA_MATCH_GET(x) (((x) & LA_TRIGGERB_DATA_MATCH_MASK) >> LA_TRIGGERB_DATA_MATCH_LSB) -#define LA_TRIGGERB_DATA_MATCH_SET(x) (((x) << LA_TRIGGERB_DATA_MATCH_LSB) & LA_TRIGGERB_DATA_MATCH_MASK) - -#define LA_TRIGGERB_WILDCARD_ADDRESS 0x000000bc -#define LA_TRIGGERB_WILDCARD_OFFSET 0x000000bc -#define LA_TRIGGERB_WILDCARD_MATCH_MSB 17 -#define LA_TRIGGERB_WILDCARD_MATCH_LSB 0 -#define LA_TRIGGERB_WILDCARD_MATCH_MASK 0x0003ffff -#define LA_TRIGGERB_WILDCARD_MATCH_GET(x) (((x) & LA_TRIGGERB_WILDCARD_MATCH_MASK) >> LA_TRIGGERB_WILDCARD_MATCH_LSB) -#define LA_TRIGGERB_WILDCARD_MATCH_SET(x) (((x) << LA_TRIGGERB_WILDCARD_MATCH_LSB) & LA_TRIGGERB_WILDCARD_MATCH_MASK) - -#define LA_TRIGGER_ADDRESS 0x000000c0 -#define LA_TRIGGER_OFFSET 0x000000c0 -#define LA_TRIGGER_EVENT_MSB 2 -#define LA_TRIGGER_EVENT_LSB 0 -#define LA_TRIGGER_EVENT_MASK 0x00000007 -#define LA_TRIGGER_EVENT_GET(x) (((x) & LA_TRIGGER_EVENT_MASK) >> LA_TRIGGER_EVENT_LSB) -#define LA_TRIGGER_EVENT_SET(x) (((x) << LA_TRIGGER_EVENT_LSB) & LA_TRIGGER_EVENT_MASK) - -#define LA_FIFO_ADDRESS 0x000000c4 -#define LA_FIFO_OFFSET 0x000000c4 -#define LA_FIFO_FULL_MSB 1 -#define LA_FIFO_FULL_LSB 1 -#define LA_FIFO_FULL_MASK 0x00000002 -#define LA_FIFO_FULL_GET(x) (((x) & LA_FIFO_FULL_MASK) >> LA_FIFO_FULL_LSB) -#define LA_FIFO_FULL_SET(x) (((x) << LA_FIFO_FULL_LSB) & LA_FIFO_FULL_MASK) -#define LA_FIFO_EMPTY_MSB 0 -#define LA_FIFO_EMPTY_LSB 0 -#define LA_FIFO_EMPTY_MASK 0x00000001 -#define LA_FIFO_EMPTY_GET(x) (((x) & LA_FIFO_EMPTY_MASK) >> LA_FIFO_EMPTY_LSB) -#define LA_FIFO_EMPTY_SET(x) (((x) << LA_FIFO_EMPTY_LSB) & LA_FIFO_EMPTY_MASK) - -#define LA_ADDRESS 0x000000c8 -#define LA_OFFSET 0x000000c8 -#define LA_DATA_MSB 17 -#define LA_DATA_LSB 0 -#define LA_DATA_MASK 0x0003ffff -#define LA_DATA_GET(x) (((x) & LA_DATA_MASK) >> LA_DATA_LSB) -#define LA_DATA_SET(x) (((x) << LA_DATA_LSB) & LA_DATA_MASK) - -#define ANT_PIN_ADDRESS 0x000000d0 -#define ANT_PIN_OFFSET 0x000000d0 -#define ANT_PIN_PAD_PULL_MSB 3 -#define ANT_PIN_PAD_PULL_LSB 2 -#define ANT_PIN_PAD_PULL_MASK 0x0000000c -#define ANT_PIN_PAD_PULL_GET(x) (((x) & ANT_PIN_PAD_PULL_MASK) >> ANT_PIN_PAD_PULL_LSB) -#define ANT_PIN_PAD_PULL_SET(x) (((x) << ANT_PIN_PAD_PULL_LSB) & ANT_PIN_PAD_PULL_MASK) -#define ANT_PIN_PAD_STRENGTH_MSB 1 -#define ANT_PIN_PAD_STRENGTH_LSB 0 -#define ANT_PIN_PAD_STRENGTH_MASK 0x00000003 -#define ANT_PIN_PAD_STRENGTH_GET(x) (((x) & ANT_PIN_PAD_STRENGTH_MASK) >> ANT_PIN_PAD_STRENGTH_LSB) -#define ANT_PIN_PAD_STRENGTH_SET(x) (((x) << ANT_PIN_PAD_STRENGTH_LSB) & ANT_PIN_PAD_STRENGTH_MASK) - -#define ANTD_PIN_ADDRESS 0x000000d4 -#define ANTD_PIN_OFFSET 0x000000d4 -#define ANTD_PIN_PAD_PULL_MSB 1 -#define ANTD_PIN_PAD_PULL_LSB 0 -#define ANTD_PIN_PAD_PULL_MASK 0x00000003 -#define ANTD_PIN_PAD_PULL_GET(x) (((x) & ANTD_PIN_PAD_PULL_MASK) >> ANTD_PIN_PAD_PULL_LSB) -#define ANTD_PIN_PAD_PULL_SET(x) (((x) << ANTD_PIN_PAD_PULL_LSB) & ANTD_PIN_PAD_PULL_MASK) - -#define GPIO_PIN_ADDRESS 0x000000d8 -#define GPIO_PIN_OFFSET 0x000000d8 -#define GPIO_PIN_PAD_PULL_MSB 3 -#define GPIO_PIN_PAD_PULL_LSB 2 -#define GPIO_PIN_PAD_PULL_MASK 0x0000000c -#define GPIO_PIN_PAD_PULL_GET(x) (((x) & GPIO_PIN_PAD_PULL_MASK) >> GPIO_PIN_PAD_PULL_LSB) -#define GPIO_PIN_PAD_PULL_SET(x) (((x) << GPIO_PIN_PAD_PULL_LSB) & GPIO_PIN_PAD_PULL_MASK) -#define GPIO_PIN_PAD_STRENGTH_MSB 1 -#define GPIO_PIN_PAD_STRENGTH_LSB 0 -#define GPIO_PIN_PAD_STRENGTH_MASK 0x00000003 -#define GPIO_PIN_PAD_STRENGTH_GET(x) (((x) & GPIO_PIN_PAD_STRENGTH_MASK) >> GPIO_PIN_PAD_STRENGTH_LSB) -#define GPIO_PIN_PAD_STRENGTH_SET(x) (((x) << GPIO_PIN_PAD_STRENGTH_LSB) & GPIO_PIN_PAD_STRENGTH_MASK) - -#define GPIO_H_PIN_ADDRESS 0x000000dc -#define GPIO_H_PIN_OFFSET 0x000000dc -#define GPIO_H_PIN_PAD_PULL_MSB 1 -#define GPIO_H_PIN_PAD_PULL_LSB 0 -#define GPIO_H_PIN_PAD_PULL_MASK 0x00000003 -#define GPIO_H_PIN_PAD_PULL_GET(x) (((x) & GPIO_H_PIN_PAD_PULL_MASK) >> GPIO_H_PIN_PAD_PULL_LSB) -#define GPIO_H_PIN_PAD_PULL_SET(x) (((x) << GPIO_H_PIN_PAD_PULL_LSB) & GPIO_H_PIN_PAD_PULL_MASK) - -#define BT_PIN_ADDRESS 0x000000e0 -#define BT_PIN_OFFSET 0x000000e0 -#define BT_PIN_PAD_PULL_MSB 3 -#define BT_PIN_PAD_PULL_LSB 2 -#define BT_PIN_PAD_PULL_MASK 0x0000000c -#define BT_PIN_PAD_PULL_GET(x) (((x) & BT_PIN_PAD_PULL_MASK) >> BT_PIN_PAD_PULL_LSB) -#define BT_PIN_PAD_PULL_SET(x) (((x) << BT_PIN_PAD_PULL_LSB) & BT_PIN_PAD_PULL_MASK) -#define BT_PIN_PAD_STRENGTH_MSB 1 -#define BT_PIN_PAD_STRENGTH_LSB 0 -#define BT_PIN_PAD_STRENGTH_MASK 0x00000003 -#define BT_PIN_PAD_STRENGTH_GET(x) (((x) & BT_PIN_PAD_STRENGTH_MASK) >> BT_PIN_PAD_STRENGTH_LSB) -#define BT_PIN_PAD_STRENGTH_SET(x) (((x) << BT_PIN_PAD_STRENGTH_LSB) & BT_PIN_PAD_STRENGTH_MASK) - -#define BT_WLAN_PIN_ADDRESS 0x000000e4 -#define BT_WLAN_PIN_OFFSET 0x000000e4 -#define BT_WLAN_PIN_PAD_PULL_MSB 1 -#define BT_WLAN_PIN_PAD_PULL_LSB 0 -#define BT_WLAN_PIN_PAD_PULL_MASK 0x00000003 -#define BT_WLAN_PIN_PAD_PULL_GET(x) (((x) & BT_WLAN_PIN_PAD_PULL_MASK) >> BT_WLAN_PIN_PAD_PULL_LSB) -#define BT_WLAN_PIN_PAD_PULL_SET(x) (((x) << BT_WLAN_PIN_PAD_PULL_LSB) & BT_WLAN_PIN_PAD_PULL_MASK) - -#define SI_UART_PIN_ADDRESS 0x000000e8 -#define SI_UART_PIN_OFFSET 0x000000e8 -#define SI_UART_PIN_PAD_PULL_MSB 3 -#define SI_UART_PIN_PAD_PULL_LSB 2 -#define SI_UART_PIN_PAD_PULL_MASK 0x0000000c -#define SI_UART_PIN_PAD_PULL_GET(x) (((x) & SI_UART_PIN_PAD_PULL_MASK) >> SI_UART_PIN_PAD_PULL_LSB) -#define SI_UART_PIN_PAD_PULL_SET(x) (((x) << SI_UART_PIN_PAD_PULL_LSB) & SI_UART_PIN_PAD_PULL_MASK) -#define SI_UART_PIN_PAD_STRENGTH_MSB 1 -#define SI_UART_PIN_PAD_STRENGTH_LSB 0 -#define SI_UART_PIN_PAD_STRENGTH_MASK 0x00000003 -#define SI_UART_PIN_PAD_STRENGTH_GET(x) (((x) & SI_UART_PIN_PAD_STRENGTH_MASK) >> SI_UART_PIN_PAD_STRENGTH_LSB) -#define SI_UART_PIN_PAD_STRENGTH_SET(x) (((x) << SI_UART_PIN_PAD_STRENGTH_LSB) & SI_UART_PIN_PAD_STRENGTH_MASK) - -#define CLK32K_PIN_ADDRESS 0x000000ec -#define CLK32K_PIN_OFFSET 0x000000ec -#define CLK32K_PIN_PAD_PULL_MSB 1 -#define CLK32K_PIN_PAD_PULL_LSB 0 -#define CLK32K_PIN_PAD_PULL_MASK 0x00000003 -#define CLK32K_PIN_PAD_PULL_GET(x) (((x) & CLK32K_PIN_PAD_PULL_MASK) >> CLK32K_PIN_PAD_PULL_LSB) -#define CLK32K_PIN_PAD_PULL_SET(x) (((x) << CLK32K_PIN_PAD_PULL_LSB) & CLK32K_PIN_PAD_PULL_MASK) - -#define RESET_TUPLE_STATUS_ADDRESS 0x000000f0 -#define RESET_TUPLE_STATUS_OFFSET 0x000000f0 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MSB 11 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB 8 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK 0x00000f00 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_GET(x) (((x) & RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK) >> RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB) -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_SET(x) (((x) << RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB) & RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK) -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MSB 7 -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB 0 -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK 0x000000ff -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_GET(x) (((x) & RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK) >> RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB) -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_SET(x) (((x) << RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB) & RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct gpio_reg_reg_s { - volatile unsigned int gpio_out; - volatile unsigned int gpio_out_w1ts; - volatile unsigned int gpio_out_w1tc; - volatile unsigned int gpio_enable; - volatile unsigned int gpio_enable_w1ts; - volatile unsigned int gpio_enable_w1tc; - volatile unsigned int gpio_in; - volatile unsigned int gpio_status; - volatile unsigned int gpio_status_w1ts; - volatile unsigned int gpio_status_w1tc; - volatile unsigned int gpio_pin0; - volatile unsigned int gpio_pin1; - volatile unsigned int gpio_pin2; - volatile unsigned int gpio_pin3; - volatile unsigned int gpio_pin4; - volatile unsigned int gpio_pin5; - volatile unsigned int gpio_pin6; - volatile unsigned int gpio_pin7; - volatile unsigned int gpio_pin8; - volatile unsigned int gpio_pin9; - volatile unsigned int gpio_pin10; - volatile unsigned int gpio_pin11; - volatile unsigned int gpio_pin12; - volatile unsigned int gpio_pin13; - volatile unsigned int gpio_pin14; - volatile unsigned int gpio_pin15; - volatile unsigned int gpio_pin16; - volatile unsigned int gpio_pin17; - volatile unsigned int sdio_pin; - volatile unsigned int clk_req_pin; - volatile unsigned int sigma_delta; - volatile unsigned int debug_control; - volatile unsigned int debug_input_sel; - volatile unsigned int debug_out; - volatile unsigned int la_control; - volatile unsigned int la_clock; - volatile unsigned int la_status; - volatile unsigned int la_trigger_sample; - volatile unsigned int la_trigger_position; - volatile unsigned int la_pre_trigger; - volatile unsigned int la_post_trigger; - volatile unsigned int la_filter_control; - volatile unsigned int la_filter_data; - volatile unsigned int la_filter_wildcard; - volatile unsigned int la_triggera_data; - volatile unsigned int la_triggera_wildcard; - volatile unsigned int la_triggerb_data; - volatile unsigned int la_triggerb_wildcard; - volatile unsigned int la_trigger; - volatile unsigned int la_fifo; - volatile unsigned int la[2]; - volatile unsigned int ant_pin; - volatile unsigned int antd_pin; - volatile unsigned int gpio_pin; - volatile unsigned int gpio_h_pin; - volatile unsigned int bt_pin; - volatile unsigned int bt_wlan_pin; - volatile unsigned int si_uart_pin; - volatile unsigned int clk32k_pin; - volatile unsigned int reset_tuple_status; -} gpio_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _GPIO_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/gpio_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/gpio_reg.vrh deleted file mode 100644 index 82a4f9a9ca00..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/gpio_reg.vrh +++ /dev/null @@ -1,1471 +0,0 @@ -#ifndef _GPIO_REG_VRH_ -#define _GPIO_REG_VRH_ - -#define GPIO_OUT_ADDRESS 'h00000000 -#define GPIO_OUT_DATA_MSB 17 -#define GPIO_OUT_DATA_LSB 0 -#define GPIO_OUT_DATA_MASK 'h0003ffff -#define GPIO_OUT_DATA_GET(x) (((x) & GPIO_OUT_DATA_MASK) >> GPIO_OUT_DATA_LSB) -#define GPIO_OUT_DATA_SET(x) (((32'd0 | (x)) << GPIO_OUT_DATA_LSB) & GPIO_OUT_DATA_MASK) -#define GPIO_OUT_DATA_RESET 18'h0 -#define GPIO_OUT_RESET (32'h0 | \ - GPIO_OUT_DATA_SET(GPIO_OUT_DATA_RESET)) -#define GPIO_OUT_HW_MASK (32'h0) -#define GPIO_OUT_SW_MASK (32'h0 | \ - GPIO_OUT_DATA_MASK) - -#define GPIO_OUT_W1TS_ADDRESS 'h00000004 -#define GPIO_OUT_W1TS_DATA_MSB 17 -#define GPIO_OUT_W1TS_DATA_LSB 0 -#define GPIO_OUT_W1TS_DATA_MASK 'h0003ffff -#define GPIO_OUT_W1TS_DATA_GET(x) (((x) & GPIO_OUT_W1TS_DATA_MASK) >> GPIO_OUT_W1TS_DATA_LSB) -#define GPIO_OUT_W1TS_DATA_SET(x) (((32'd0 | (x)) << GPIO_OUT_W1TS_DATA_LSB) & GPIO_OUT_W1TS_DATA_MASK) -#define GPIO_OUT_W1TS_DATA_RESET 18'h0 -#define GPIO_OUT_W1TS_RESET (32'h0 | \ - GPIO_OUT_W1TS_DATA_SET(GPIO_OUT_W1TS_DATA_RESET)) -#define GPIO_OUT_W1TS_HW_MASK (32'h0) -#define GPIO_OUT_W1TS_SW_MASK (32'h0 | \ - GPIO_OUT_W1TS_DATA_MASK) - -#define GPIO_OUT_W1TC_ADDRESS 'h00000008 -#define GPIO_OUT_W1TC_DATA_MSB 17 -#define GPIO_OUT_W1TC_DATA_LSB 0 -#define GPIO_OUT_W1TC_DATA_MASK 'h0003ffff -#define GPIO_OUT_W1TC_DATA_GET(x) (((x) & GPIO_OUT_W1TC_DATA_MASK) >> GPIO_OUT_W1TC_DATA_LSB) -#define GPIO_OUT_W1TC_DATA_SET(x) (((32'd0 | (x)) << GPIO_OUT_W1TC_DATA_LSB) & GPIO_OUT_W1TC_DATA_MASK) -#define GPIO_OUT_W1TC_DATA_RESET 18'h0 -#define GPIO_OUT_W1TC_RESET (32'h0 | \ - GPIO_OUT_W1TC_DATA_SET(GPIO_OUT_W1TC_DATA_RESET)) -#define GPIO_OUT_W1TC_HW_MASK (32'h0) -#define GPIO_OUT_W1TC_SW_MASK (32'h0 | \ - GPIO_OUT_W1TC_DATA_MASK) - -#define GPIO_ENABLE_ADDRESS 'h0000000c -#define GPIO_ENABLE_DATA_MSB 17 -#define GPIO_ENABLE_DATA_LSB 0 -#define GPIO_ENABLE_DATA_MASK 'h0003ffff -#define GPIO_ENABLE_DATA_GET(x) (((x) & GPIO_ENABLE_DATA_MASK) >> GPIO_ENABLE_DATA_LSB) -#define GPIO_ENABLE_DATA_SET(x) (((32'd0 | (x)) << GPIO_ENABLE_DATA_LSB) & GPIO_ENABLE_DATA_MASK) -#define GPIO_ENABLE_DATA_RESET 18'h0 -#define GPIO_ENABLE_RESET (32'h0 | \ - GPIO_ENABLE_DATA_SET(GPIO_ENABLE_DATA_RESET)) -#define GPIO_ENABLE_HW_MASK (32'h0) -#define GPIO_ENABLE_SW_MASK (32'h0 | \ - GPIO_ENABLE_DATA_MASK) - -#define GPIO_ENABLE_W1TS_ADDRESS 'h00000010 -#define GPIO_ENABLE_W1TS_DATA_MSB 17 -#define GPIO_ENABLE_W1TS_DATA_LSB 0 -#define GPIO_ENABLE_W1TS_DATA_MASK 'h0003ffff -#define GPIO_ENABLE_W1TS_DATA_GET(x) (((x) & GPIO_ENABLE_W1TS_DATA_MASK) >> GPIO_ENABLE_W1TS_DATA_LSB) -#define GPIO_ENABLE_W1TS_DATA_SET(x) (((32'd0 | (x)) << GPIO_ENABLE_W1TS_DATA_LSB) & GPIO_ENABLE_W1TS_DATA_MASK) -#define GPIO_ENABLE_W1TS_DATA_RESET 18'h0 -#define GPIO_ENABLE_W1TS_RESET (32'h0 | \ - GPIO_ENABLE_W1TS_DATA_SET(GPIO_ENABLE_W1TS_DATA_RESET)) -#define GPIO_ENABLE_W1TS_HW_MASK (32'h0) -#define GPIO_ENABLE_W1TS_SW_MASK (32'h0 | \ - GPIO_ENABLE_W1TS_DATA_MASK) - -#define GPIO_ENABLE_W1TC_ADDRESS 'h00000014 -#define GPIO_ENABLE_W1TC_DATA_MSB 17 -#define GPIO_ENABLE_W1TC_DATA_LSB 0 -#define GPIO_ENABLE_W1TC_DATA_MASK 'h0003ffff -#define GPIO_ENABLE_W1TC_DATA_GET(x) (((x) & GPIO_ENABLE_W1TC_DATA_MASK) >> GPIO_ENABLE_W1TC_DATA_LSB) -#define GPIO_ENABLE_W1TC_DATA_SET(x) (((32'd0 | (x)) << GPIO_ENABLE_W1TC_DATA_LSB) & GPIO_ENABLE_W1TC_DATA_MASK) -#define GPIO_ENABLE_W1TC_DATA_RESET 18'h0 -#define GPIO_ENABLE_W1TC_RESET (32'h0 | \ - GPIO_ENABLE_W1TC_DATA_SET(GPIO_ENABLE_W1TC_DATA_RESET)) -#define GPIO_ENABLE_W1TC_HW_MASK (32'h0) -#define GPIO_ENABLE_W1TC_SW_MASK (32'h0 | \ - GPIO_ENABLE_W1TC_DATA_MASK) - -#define GPIO_IN_ADDRESS 'h00000018 -#define GPIO_IN_DATA_MSB 17 -#define GPIO_IN_DATA_LSB 0 -#define GPIO_IN_DATA_MASK 'h0003ffff -#define GPIO_IN_DATA_GET(x) (((x) & GPIO_IN_DATA_MASK) >> GPIO_IN_DATA_LSB) -#define GPIO_IN_DATA_SET(x) (((32'd0 | (x)) << GPIO_IN_DATA_LSB) & GPIO_IN_DATA_MASK) -#define GPIO_IN_DATA_RESET 18'h0 -#define GPIO_IN_RESET (32'h0 | \ - GPIO_IN_DATA_SET(GPIO_IN_DATA_RESET)) -#define GPIO_IN_HW_MASK (32'h0 | \ - GPIO_IN_DATA_MASK) -#define GPIO_IN_SW_MASK (32'h0) - -#define GPIO_STATUS_ADDRESS 'h0000001c -#define GPIO_STATUS_INTERRUPT_MSB 17 -#define GPIO_STATUS_INTERRUPT_LSB 0 -#define GPIO_STATUS_INTERRUPT_MASK 'h0003ffff -#define GPIO_STATUS_INTERRUPT_GET(x) (((x) & GPIO_STATUS_INTERRUPT_MASK) >> GPIO_STATUS_INTERRUPT_LSB) -#define GPIO_STATUS_INTERRUPT_SET(x) (((32'd0 | (x)) << GPIO_STATUS_INTERRUPT_LSB) & GPIO_STATUS_INTERRUPT_MASK) -#define GPIO_STATUS_INTERRUPT_RESET 18'h0 -#define GPIO_STATUS_RESET (32'h0 | \ - GPIO_STATUS_INTERRUPT_SET(GPIO_STATUS_INTERRUPT_RESET)) -#define GPIO_STATUS_HW_MASK (32'h0 | \ - GPIO_STATUS_INTERRUPT_MASK) -#define GPIO_STATUS_SW_MASK (32'h0 | \ - GPIO_STATUS_INTERRUPT_MASK) - -#define GPIO_STATUS_W1TS_ADDRESS 'h00000020 -#define GPIO_STATUS_W1TS_INTERRUPT_MSB 17 -#define GPIO_STATUS_W1TS_INTERRUPT_LSB 0 -#define GPIO_STATUS_W1TS_INTERRUPT_MASK 'h0003ffff -#define GPIO_STATUS_W1TS_INTERRUPT_GET(x) (((x) & GPIO_STATUS_W1TS_INTERRUPT_MASK) >> GPIO_STATUS_W1TS_INTERRUPT_LSB) -#define GPIO_STATUS_W1TS_INTERRUPT_SET(x) (((32'd0 | (x)) << GPIO_STATUS_W1TS_INTERRUPT_LSB) & GPIO_STATUS_W1TS_INTERRUPT_MASK) -#define GPIO_STATUS_W1TS_INTERRUPT_RESET 18'h0 -#define GPIO_STATUS_W1TS_RESET (32'h0 | \ - GPIO_STATUS_W1TS_INTERRUPT_SET(GPIO_STATUS_W1TS_INTERRUPT_RESET)) -#define GPIO_STATUS_W1TS_HW_MASK (32'h0) -#define GPIO_STATUS_W1TS_SW_MASK (32'h0 | \ - GPIO_STATUS_W1TS_INTERRUPT_MASK) - -#define GPIO_STATUS_W1TC_ADDRESS 'h00000024 -#define GPIO_STATUS_W1TC_INTERRUPT_MSB 17 -#define GPIO_STATUS_W1TC_INTERRUPT_LSB 0 -#define GPIO_STATUS_W1TC_INTERRUPT_MASK 'h0003ffff -#define GPIO_STATUS_W1TC_INTERRUPT_GET(x) (((x) & GPIO_STATUS_W1TC_INTERRUPT_MASK) >> GPIO_STATUS_W1TC_INTERRUPT_LSB) -#define GPIO_STATUS_W1TC_INTERRUPT_SET(x) (((32'd0 | (x)) << GPIO_STATUS_W1TC_INTERRUPT_LSB) & GPIO_STATUS_W1TC_INTERRUPT_MASK) -#define GPIO_STATUS_W1TC_INTERRUPT_RESET 18'h0 -#define GPIO_STATUS_W1TC_RESET (32'h0 | \ - GPIO_STATUS_W1TC_INTERRUPT_SET(GPIO_STATUS_W1TC_INTERRUPT_RESET)) -#define GPIO_STATUS_W1TC_HW_MASK (32'h0) -#define GPIO_STATUS_W1TC_SW_MASK (32'h0 | \ - GPIO_STATUS_W1TC_INTERRUPT_MASK) - -#define GPIO_PIN0_ADDRESS 'h00000028 -#define GPIO_PIN0_CONFIG_MSB 12 -#define GPIO_PIN0_CONFIG_LSB 11 -#define GPIO_PIN0_CONFIG_MASK 'h00001800 -#define GPIO_PIN0_CONFIG_GET(x) (((x) & GPIO_PIN0_CONFIG_MASK) >> GPIO_PIN0_CONFIG_LSB) -#define GPIO_PIN0_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN0_CONFIG_LSB) & GPIO_PIN0_CONFIG_MASK) -#define GPIO_PIN0_CONFIG_RESET 2'h0 -#define GPIO_PIN0_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN0_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN0_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN0_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN0_WAKEUP_ENABLE_MASK) >> GPIO_PIN0_WAKEUP_ENABLE_LSB) -#define GPIO_PIN0_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN0_WAKEUP_ENABLE_LSB) & GPIO_PIN0_WAKEUP_ENABLE_MASK) -#define GPIO_PIN0_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN0_INT_TYPE_MSB 9 -#define GPIO_PIN0_INT_TYPE_LSB 7 -#define GPIO_PIN0_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN0_INT_TYPE_GET(x) (((x) & GPIO_PIN0_INT_TYPE_MASK) >> GPIO_PIN0_INT_TYPE_LSB) -#define GPIO_PIN0_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN0_INT_TYPE_LSB) & GPIO_PIN0_INT_TYPE_MASK) -#define GPIO_PIN0_INT_TYPE_RESET 3'h0 -#define GPIO_PIN0_PAD_DRIVER_MSB 2 -#define GPIO_PIN0_PAD_DRIVER_LSB 2 -#define GPIO_PIN0_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN0_PAD_DRIVER_GET(x) (((x) & GPIO_PIN0_PAD_DRIVER_MASK) >> GPIO_PIN0_PAD_DRIVER_LSB) -#define GPIO_PIN0_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN0_PAD_DRIVER_LSB) & GPIO_PIN0_PAD_DRIVER_MASK) -#define GPIO_PIN0_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN0_SOURCE_MSB 0 -#define GPIO_PIN0_SOURCE_LSB 0 -#define GPIO_PIN0_SOURCE_MASK 'h00000001 -#define GPIO_PIN0_SOURCE_GET(x) (((x) & GPIO_PIN0_SOURCE_MASK) >> GPIO_PIN0_SOURCE_LSB) -#define GPIO_PIN0_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN0_SOURCE_LSB) & GPIO_PIN0_SOURCE_MASK) -#define GPIO_PIN0_SOURCE_RESET 1'h0 -#define GPIO_PIN0_RESET (32'h0 | \ - GPIO_PIN0_CONFIG_SET(GPIO_PIN0_CONFIG_RESET) | \ - GPIO_PIN0_WAKEUP_ENABLE_SET(GPIO_PIN0_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN0_INT_TYPE_SET(GPIO_PIN0_INT_TYPE_RESET) | \ - GPIO_PIN0_PAD_DRIVER_SET(GPIO_PIN0_PAD_DRIVER_RESET) | \ - GPIO_PIN0_SOURCE_SET(GPIO_PIN0_SOURCE_RESET)) -#define GPIO_PIN0_HW_MASK (32'h0) -#define GPIO_PIN0_SW_MASK (32'h0 | \ - GPIO_PIN0_CONFIG_MASK | \ - GPIO_PIN0_WAKEUP_ENABLE_MASK | \ - GPIO_PIN0_INT_TYPE_MASK | \ - GPIO_PIN0_PAD_DRIVER_MASK | \ - GPIO_PIN0_SOURCE_MASK) - -#define GPIO_PIN1_ADDRESS 'h0000002c -#define GPIO_PIN1_CONFIG_MSB 12 -#define GPIO_PIN1_CONFIG_LSB 11 -#define GPIO_PIN1_CONFIG_MASK 'h00001800 -#define GPIO_PIN1_CONFIG_GET(x) (((x) & GPIO_PIN1_CONFIG_MASK) >> GPIO_PIN1_CONFIG_LSB) -#define GPIO_PIN1_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN1_CONFIG_LSB) & GPIO_PIN1_CONFIG_MASK) -#define GPIO_PIN1_CONFIG_RESET 2'h0 -#define GPIO_PIN1_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN1_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN1_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN1_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN1_WAKEUP_ENABLE_MASK) >> GPIO_PIN1_WAKEUP_ENABLE_LSB) -#define GPIO_PIN1_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN1_WAKEUP_ENABLE_LSB) & GPIO_PIN1_WAKEUP_ENABLE_MASK) -#define GPIO_PIN1_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN1_INT_TYPE_MSB 9 -#define GPIO_PIN1_INT_TYPE_LSB 7 -#define GPIO_PIN1_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN1_INT_TYPE_GET(x) (((x) & GPIO_PIN1_INT_TYPE_MASK) >> GPIO_PIN1_INT_TYPE_LSB) -#define GPIO_PIN1_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN1_INT_TYPE_LSB) & GPIO_PIN1_INT_TYPE_MASK) -#define GPIO_PIN1_INT_TYPE_RESET 3'h0 -#define GPIO_PIN1_PAD_DRIVER_MSB 2 -#define GPIO_PIN1_PAD_DRIVER_LSB 2 -#define GPIO_PIN1_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN1_PAD_DRIVER_GET(x) (((x) & GPIO_PIN1_PAD_DRIVER_MASK) >> GPIO_PIN1_PAD_DRIVER_LSB) -#define GPIO_PIN1_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN1_PAD_DRIVER_LSB) & GPIO_PIN1_PAD_DRIVER_MASK) -#define GPIO_PIN1_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN1_SOURCE_MSB 0 -#define GPIO_PIN1_SOURCE_LSB 0 -#define GPIO_PIN1_SOURCE_MASK 'h00000001 -#define GPIO_PIN1_SOURCE_GET(x) (((x) & GPIO_PIN1_SOURCE_MASK) >> GPIO_PIN1_SOURCE_LSB) -#define GPIO_PIN1_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN1_SOURCE_LSB) & GPIO_PIN1_SOURCE_MASK) -#define GPIO_PIN1_SOURCE_RESET 1'h0 -#define GPIO_PIN1_RESET (32'h0 | \ - GPIO_PIN1_CONFIG_SET(GPIO_PIN1_CONFIG_RESET) | \ - GPIO_PIN1_WAKEUP_ENABLE_SET(GPIO_PIN1_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN1_INT_TYPE_SET(GPIO_PIN1_INT_TYPE_RESET) | \ - GPIO_PIN1_PAD_DRIVER_SET(GPIO_PIN1_PAD_DRIVER_RESET) | \ - GPIO_PIN1_SOURCE_SET(GPIO_PIN1_SOURCE_RESET)) -#define GPIO_PIN1_HW_MASK (32'h0) -#define GPIO_PIN1_SW_MASK (32'h0 | \ - GPIO_PIN1_CONFIG_MASK | \ - GPIO_PIN1_WAKEUP_ENABLE_MASK | \ - GPIO_PIN1_INT_TYPE_MASK | \ - GPIO_PIN1_PAD_DRIVER_MASK | \ - GPIO_PIN1_SOURCE_MASK) - -#define GPIO_PIN2_ADDRESS 'h00000030 -#define GPIO_PIN2_CONFIG_MSB 12 -#define GPIO_PIN2_CONFIG_LSB 11 -#define GPIO_PIN2_CONFIG_MASK 'h00001800 -#define GPIO_PIN2_CONFIG_GET(x) (((x) & GPIO_PIN2_CONFIG_MASK) >> GPIO_PIN2_CONFIG_LSB) -#define GPIO_PIN2_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN2_CONFIG_LSB) & GPIO_PIN2_CONFIG_MASK) -#define GPIO_PIN2_CONFIG_RESET 2'h0 -#define GPIO_PIN2_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN2_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN2_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN2_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN2_WAKEUP_ENABLE_MASK) >> GPIO_PIN2_WAKEUP_ENABLE_LSB) -#define GPIO_PIN2_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN2_WAKEUP_ENABLE_LSB) & GPIO_PIN2_WAKEUP_ENABLE_MASK) -#define GPIO_PIN2_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN2_INT_TYPE_MSB 9 -#define GPIO_PIN2_INT_TYPE_LSB 7 -#define GPIO_PIN2_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN2_INT_TYPE_GET(x) (((x) & GPIO_PIN2_INT_TYPE_MASK) >> GPIO_PIN2_INT_TYPE_LSB) -#define GPIO_PIN2_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN2_INT_TYPE_LSB) & GPIO_PIN2_INT_TYPE_MASK) -#define GPIO_PIN2_INT_TYPE_RESET 3'h0 -#define GPIO_PIN2_PAD_DRIVER_MSB 2 -#define GPIO_PIN2_PAD_DRIVER_LSB 2 -#define GPIO_PIN2_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN2_PAD_DRIVER_GET(x) (((x) & GPIO_PIN2_PAD_DRIVER_MASK) >> GPIO_PIN2_PAD_DRIVER_LSB) -#define GPIO_PIN2_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN2_PAD_DRIVER_LSB) & GPIO_PIN2_PAD_DRIVER_MASK) -#define GPIO_PIN2_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN2_SOURCE_MSB 0 -#define GPIO_PIN2_SOURCE_LSB 0 -#define GPIO_PIN2_SOURCE_MASK 'h00000001 -#define GPIO_PIN2_SOURCE_GET(x) (((x) & GPIO_PIN2_SOURCE_MASK) >> GPIO_PIN2_SOURCE_LSB) -#define GPIO_PIN2_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN2_SOURCE_LSB) & GPIO_PIN2_SOURCE_MASK) -#define GPIO_PIN2_SOURCE_RESET 1'h0 -#define GPIO_PIN2_RESET (32'h0 | \ - GPIO_PIN2_CONFIG_SET(GPIO_PIN2_CONFIG_RESET) | \ - GPIO_PIN2_WAKEUP_ENABLE_SET(GPIO_PIN2_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN2_INT_TYPE_SET(GPIO_PIN2_INT_TYPE_RESET) | \ - GPIO_PIN2_PAD_DRIVER_SET(GPIO_PIN2_PAD_DRIVER_RESET) | \ - GPIO_PIN2_SOURCE_SET(GPIO_PIN2_SOURCE_RESET)) -#define GPIO_PIN2_HW_MASK (32'h0) -#define GPIO_PIN2_SW_MASK (32'h0 | \ - GPIO_PIN2_CONFIG_MASK | \ - GPIO_PIN2_WAKEUP_ENABLE_MASK | \ - GPIO_PIN2_INT_TYPE_MASK | \ - GPIO_PIN2_PAD_DRIVER_MASK | \ - GPIO_PIN2_SOURCE_MASK) - -#define GPIO_PIN3_ADDRESS 'h00000034 -#define GPIO_PIN3_CONFIG_MSB 12 -#define GPIO_PIN3_CONFIG_LSB 11 -#define GPIO_PIN3_CONFIG_MASK 'h00001800 -#define GPIO_PIN3_CONFIG_GET(x) (((x) & GPIO_PIN3_CONFIG_MASK) >> GPIO_PIN3_CONFIG_LSB) -#define GPIO_PIN3_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN3_CONFIG_LSB) & GPIO_PIN3_CONFIG_MASK) -#define GPIO_PIN3_CONFIG_RESET 2'h0 -#define GPIO_PIN3_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN3_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN3_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN3_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN3_WAKEUP_ENABLE_MASK) >> GPIO_PIN3_WAKEUP_ENABLE_LSB) -#define GPIO_PIN3_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN3_WAKEUP_ENABLE_LSB) & GPIO_PIN3_WAKEUP_ENABLE_MASK) -#define GPIO_PIN3_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN3_INT_TYPE_MSB 9 -#define GPIO_PIN3_INT_TYPE_LSB 7 -#define GPIO_PIN3_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN3_INT_TYPE_GET(x) (((x) & GPIO_PIN3_INT_TYPE_MASK) >> GPIO_PIN3_INT_TYPE_LSB) -#define GPIO_PIN3_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN3_INT_TYPE_LSB) & GPIO_PIN3_INT_TYPE_MASK) -#define GPIO_PIN3_INT_TYPE_RESET 3'h0 -#define GPIO_PIN3_PAD_DRIVER_MSB 2 -#define GPIO_PIN3_PAD_DRIVER_LSB 2 -#define GPIO_PIN3_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN3_PAD_DRIVER_GET(x) (((x) & GPIO_PIN3_PAD_DRIVER_MASK) >> GPIO_PIN3_PAD_DRIVER_LSB) -#define GPIO_PIN3_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN3_PAD_DRIVER_LSB) & GPIO_PIN3_PAD_DRIVER_MASK) -#define GPIO_PIN3_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN3_SOURCE_MSB 0 -#define GPIO_PIN3_SOURCE_LSB 0 -#define GPIO_PIN3_SOURCE_MASK 'h00000001 -#define GPIO_PIN3_SOURCE_GET(x) (((x) & GPIO_PIN3_SOURCE_MASK) >> GPIO_PIN3_SOURCE_LSB) -#define GPIO_PIN3_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN3_SOURCE_LSB) & GPIO_PIN3_SOURCE_MASK) -#define GPIO_PIN3_SOURCE_RESET 1'h0 -#define GPIO_PIN3_RESET (32'h0 | \ - GPIO_PIN3_CONFIG_SET(GPIO_PIN3_CONFIG_RESET) | \ - GPIO_PIN3_WAKEUP_ENABLE_SET(GPIO_PIN3_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN3_INT_TYPE_SET(GPIO_PIN3_INT_TYPE_RESET) | \ - GPIO_PIN3_PAD_DRIVER_SET(GPIO_PIN3_PAD_DRIVER_RESET) | \ - GPIO_PIN3_SOURCE_SET(GPIO_PIN3_SOURCE_RESET)) -#define GPIO_PIN3_HW_MASK (32'h0) -#define GPIO_PIN3_SW_MASK (32'h0 | \ - GPIO_PIN3_CONFIG_MASK | \ - GPIO_PIN3_WAKEUP_ENABLE_MASK | \ - GPIO_PIN3_INT_TYPE_MASK | \ - GPIO_PIN3_PAD_DRIVER_MASK | \ - GPIO_PIN3_SOURCE_MASK) - -#define GPIO_PIN4_ADDRESS 'h00000038 -#define GPIO_PIN4_CONFIG_MSB 12 -#define GPIO_PIN4_CONFIG_LSB 11 -#define GPIO_PIN4_CONFIG_MASK 'h00001800 -#define GPIO_PIN4_CONFIG_GET(x) (((x) & GPIO_PIN4_CONFIG_MASK) >> GPIO_PIN4_CONFIG_LSB) -#define GPIO_PIN4_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN4_CONFIG_LSB) & GPIO_PIN4_CONFIG_MASK) -#define GPIO_PIN4_CONFIG_RESET 2'h0 -#define GPIO_PIN4_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN4_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN4_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN4_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN4_WAKEUP_ENABLE_MASK) >> GPIO_PIN4_WAKEUP_ENABLE_LSB) -#define GPIO_PIN4_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN4_WAKEUP_ENABLE_LSB) & GPIO_PIN4_WAKEUP_ENABLE_MASK) -#define GPIO_PIN4_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN4_INT_TYPE_MSB 9 -#define GPIO_PIN4_INT_TYPE_LSB 7 -#define GPIO_PIN4_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN4_INT_TYPE_GET(x) (((x) & GPIO_PIN4_INT_TYPE_MASK) >> GPIO_PIN4_INT_TYPE_LSB) -#define GPIO_PIN4_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN4_INT_TYPE_LSB) & GPIO_PIN4_INT_TYPE_MASK) -#define GPIO_PIN4_INT_TYPE_RESET 3'h0 -#define GPIO_PIN4_PAD_DRIVER_MSB 2 -#define GPIO_PIN4_PAD_DRIVER_LSB 2 -#define GPIO_PIN4_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN4_PAD_DRIVER_GET(x) (((x) & GPIO_PIN4_PAD_DRIVER_MASK) >> GPIO_PIN4_PAD_DRIVER_LSB) -#define GPIO_PIN4_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN4_PAD_DRIVER_LSB) & GPIO_PIN4_PAD_DRIVER_MASK) -#define GPIO_PIN4_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN4_SOURCE_MSB 0 -#define GPIO_PIN4_SOURCE_LSB 0 -#define GPIO_PIN4_SOURCE_MASK 'h00000001 -#define GPIO_PIN4_SOURCE_GET(x) (((x) & GPIO_PIN4_SOURCE_MASK) >> GPIO_PIN4_SOURCE_LSB) -#define GPIO_PIN4_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN4_SOURCE_LSB) & GPIO_PIN4_SOURCE_MASK) -#define GPIO_PIN4_SOURCE_RESET 1'h0 -#define GPIO_PIN4_RESET (32'h0 | \ - GPIO_PIN4_CONFIG_SET(GPIO_PIN4_CONFIG_RESET) | \ - GPIO_PIN4_WAKEUP_ENABLE_SET(GPIO_PIN4_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN4_INT_TYPE_SET(GPIO_PIN4_INT_TYPE_RESET) | \ - GPIO_PIN4_PAD_DRIVER_SET(GPIO_PIN4_PAD_DRIVER_RESET) | \ - GPIO_PIN4_SOURCE_SET(GPIO_PIN4_SOURCE_RESET)) -#define GPIO_PIN4_HW_MASK (32'h0) -#define GPIO_PIN4_SW_MASK (32'h0 | \ - GPIO_PIN4_CONFIG_MASK | \ - GPIO_PIN4_WAKEUP_ENABLE_MASK | \ - GPIO_PIN4_INT_TYPE_MASK | \ - GPIO_PIN4_PAD_DRIVER_MASK | \ - GPIO_PIN4_SOURCE_MASK) - -#define GPIO_PIN5_ADDRESS 'h0000003c -#define GPIO_PIN5_CONFIG_MSB 12 -#define GPIO_PIN5_CONFIG_LSB 11 -#define GPIO_PIN5_CONFIG_MASK 'h00001800 -#define GPIO_PIN5_CONFIG_GET(x) (((x) & GPIO_PIN5_CONFIG_MASK) >> GPIO_PIN5_CONFIG_LSB) -#define GPIO_PIN5_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN5_CONFIG_LSB) & GPIO_PIN5_CONFIG_MASK) -#define GPIO_PIN5_CONFIG_RESET 2'h0 -#define GPIO_PIN5_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN5_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN5_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN5_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN5_WAKEUP_ENABLE_MASK) >> GPIO_PIN5_WAKEUP_ENABLE_LSB) -#define GPIO_PIN5_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN5_WAKEUP_ENABLE_LSB) & GPIO_PIN5_WAKEUP_ENABLE_MASK) -#define GPIO_PIN5_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN5_INT_TYPE_MSB 9 -#define GPIO_PIN5_INT_TYPE_LSB 7 -#define GPIO_PIN5_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN5_INT_TYPE_GET(x) (((x) & GPIO_PIN5_INT_TYPE_MASK) >> GPIO_PIN5_INT_TYPE_LSB) -#define GPIO_PIN5_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN5_INT_TYPE_LSB) & GPIO_PIN5_INT_TYPE_MASK) -#define GPIO_PIN5_INT_TYPE_RESET 3'h0 -#define GPIO_PIN5_PAD_DRIVER_MSB 2 -#define GPIO_PIN5_PAD_DRIVER_LSB 2 -#define GPIO_PIN5_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN5_PAD_DRIVER_GET(x) (((x) & GPIO_PIN5_PAD_DRIVER_MASK) >> GPIO_PIN5_PAD_DRIVER_LSB) -#define GPIO_PIN5_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN5_PAD_DRIVER_LSB) & GPIO_PIN5_PAD_DRIVER_MASK) -#define GPIO_PIN5_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN5_SOURCE_MSB 0 -#define GPIO_PIN5_SOURCE_LSB 0 -#define GPIO_PIN5_SOURCE_MASK 'h00000001 -#define GPIO_PIN5_SOURCE_GET(x) (((x) & GPIO_PIN5_SOURCE_MASK) >> GPIO_PIN5_SOURCE_LSB) -#define GPIO_PIN5_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN5_SOURCE_LSB) & GPIO_PIN5_SOURCE_MASK) -#define GPIO_PIN5_SOURCE_RESET 1'h0 -#define GPIO_PIN5_RESET (32'h0 | \ - GPIO_PIN5_CONFIG_SET(GPIO_PIN5_CONFIG_RESET) | \ - GPIO_PIN5_WAKEUP_ENABLE_SET(GPIO_PIN5_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN5_INT_TYPE_SET(GPIO_PIN5_INT_TYPE_RESET) | \ - GPIO_PIN5_PAD_DRIVER_SET(GPIO_PIN5_PAD_DRIVER_RESET) | \ - GPIO_PIN5_SOURCE_SET(GPIO_PIN5_SOURCE_RESET)) -#define GPIO_PIN5_HW_MASK (32'h0) -#define GPIO_PIN5_SW_MASK (32'h0 | \ - GPIO_PIN5_CONFIG_MASK | \ - GPIO_PIN5_WAKEUP_ENABLE_MASK | \ - GPIO_PIN5_INT_TYPE_MASK | \ - GPIO_PIN5_PAD_DRIVER_MASK | \ - GPIO_PIN5_SOURCE_MASK) - -#define GPIO_PIN6_ADDRESS 'h00000040 -#define GPIO_PIN6_CONFIG_MSB 12 -#define GPIO_PIN6_CONFIG_LSB 11 -#define GPIO_PIN6_CONFIG_MASK 'h00001800 -#define GPIO_PIN6_CONFIG_GET(x) (((x) & GPIO_PIN6_CONFIG_MASK) >> GPIO_PIN6_CONFIG_LSB) -#define GPIO_PIN6_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN6_CONFIG_LSB) & GPIO_PIN6_CONFIG_MASK) -#define GPIO_PIN6_CONFIG_RESET 2'h0 -#define GPIO_PIN6_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN6_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN6_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN6_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN6_WAKEUP_ENABLE_MASK) >> GPIO_PIN6_WAKEUP_ENABLE_LSB) -#define GPIO_PIN6_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN6_WAKEUP_ENABLE_LSB) & GPIO_PIN6_WAKEUP_ENABLE_MASK) -#define GPIO_PIN6_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN6_INT_TYPE_MSB 9 -#define GPIO_PIN6_INT_TYPE_LSB 7 -#define GPIO_PIN6_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN6_INT_TYPE_GET(x) (((x) & GPIO_PIN6_INT_TYPE_MASK) >> GPIO_PIN6_INT_TYPE_LSB) -#define GPIO_PIN6_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN6_INT_TYPE_LSB) & GPIO_PIN6_INT_TYPE_MASK) -#define GPIO_PIN6_INT_TYPE_RESET 3'h0 -#define GPIO_PIN6_PAD_DRIVER_MSB 2 -#define GPIO_PIN6_PAD_DRIVER_LSB 2 -#define GPIO_PIN6_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN6_PAD_DRIVER_GET(x) (((x) & GPIO_PIN6_PAD_DRIVER_MASK) >> GPIO_PIN6_PAD_DRIVER_LSB) -#define GPIO_PIN6_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN6_PAD_DRIVER_LSB) & GPIO_PIN6_PAD_DRIVER_MASK) -#define GPIO_PIN6_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN6_SOURCE_MSB 0 -#define GPIO_PIN6_SOURCE_LSB 0 -#define GPIO_PIN6_SOURCE_MASK 'h00000001 -#define GPIO_PIN6_SOURCE_GET(x) (((x) & GPIO_PIN6_SOURCE_MASK) >> GPIO_PIN6_SOURCE_LSB) -#define GPIO_PIN6_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN6_SOURCE_LSB) & GPIO_PIN6_SOURCE_MASK) -#define GPIO_PIN6_SOURCE_RESET 1'h0 -#define GPIO_PIN6_RESET (32'h0 | \ - GPIO_PIN6_CONFIG_SET(GPIO_PIN6_CONFIG_RESET) | \ - GPIO_PIN6_WAKEUP_ENABLE_SET(GPIO_PIN6_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN6_INT_TYPE_SET(GPIO_PIN6_INT_TYPE_RESET) | \ - GPIO_PIN6_PAD_DRIVER_SET(GPIO_PIN6_PAD_DRIVER_RESET) | \ - GPIO_PIN6_SOURCE_SET(GPIO_PIN6_SOURCE_RESET)) -#define GPIO_PIN6_HW_MASK (32'h0) -#define GPIO_PIN6_SW_MASK (32'h0 | \ - GPIO_PIN6_CONFIG_MASK | \ - GPIO_PIN6_WAKEUP_ENABLE_MASK | \ - GPIO_PIN6_INT_TYPE_MASK | \ - GPIO_PIN6_PAD_DRIVER_MASK | \ - GPIO_PIN6_SOURCE_MASK) - -#define GPIO_PIN7_ADDRESS 'h00000044 -#define GPIO_PIN7_CONFIG_MSB 12 -#define GPIO_PIN7_CONFIG_LSB 11 -#define GPIO_PIN7_CONFIG_MASK 'h00001800 -#define GPIO_PIN7_CONFIG_GET(x) (((x) & GPIO_PIN7_CONFIG_MASK) >> GPIO_PIN7_CONFIG_LSB) -#define GPIO_PIN7_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN7_CONFIG_LSB) & GPIO_PIN7_CONFIG_MASK) -#define GPIO_PIN7_CONFIG_RESET 2'h0 -#define GPIO_PIN7_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN7_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN7_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN7_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN7_WAKEUP_ENABLE_MASK) >> GPIO_PIN7_WAKEUP_ENABLE_LSB) -#define GPIO_PIN7_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN7_WAKEUP_ENABLE_LSB) & GPIO_PIN7_WAKEUP_ENABLE_MASK) -#define GPIO_PIN7_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN7_INT_TYPE_MSB 9 -#define GPIO_PIN7_INT_TYPE_LSB 7 -#define GPIO_PIN7_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN7_INT_TYPE_GET(x) (((x) & GPIO_PIN7_INT_TYPE_MASK) >> GPIO_PIN7_INT_TYPE_LSB) -#define GPIO_PIN7_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN7_INT_TYPE_LSB) & GPIO_PIN7_INT_TYPE_MASK) -#define GPIO_PIN7_INT_TYPE_RESET 3'h0 -#define GPIO_PIN7_PAD_DRIVER_MSB 2 -#define GPIO_PIN7_PAD_DRIVER_LSB 2 -#define GPIO_PIN7_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN7_PAD_DRIVER_GET(x) (((x) & GPIO_PIN7_PAD_DRIVER_MASK) >> GPIO_PIN7_PAD_DRIVER_LSB) -#define GPIO_PIN7_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN7_PAD_DRIVER_LSB) & GPIO_PIN7_PAD_DRIVER_MASK) -#define GPIO_PIN7_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN7_SOURCE_MSB 0 -#define GPIO_PIN7_SOURCE_LSB 0 -#define GPIO_PIN7_SOURCE_MASK 'h00000001 -#define GPIO_PIN7_SOURCE_GET(x) (((x) & GPIO_PIN7_SOURCE_MASK) >> GPIO_PIN7_SOURCE_LSB) -#define GPIO_PIN7_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN7_SOURCE_LSB) & GPIO_PIN7_SOURCE_MASK) -#define GPIO_PIN7_SOURCE_RESET 1'h0 -#define GPIO_PIN7_RESET (32'h0 | \ - GPIO_PIN7_CONFIG_SET(GPIO_PIN7_CONFIG_RESET) | \ - GPIO_PIN7_WAKEUP_ENABLE_SET(GPIO_PIN7_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN7_INT_TYPE_SET(GPIO_PIN7_INT_TYPE_RESET) | \ - GPIO_PIN7_PAD_DRIVER_SET(GPIO_PIN7_PAD_DRIVER_RESET) | \ - GPIO_PIN7_SOURCE_SET(GPIO_PIN7_SOURCE_RESET)) -#define GPIO_PIN7_HW_MASK (32'h0) -#define GPIO_PIN7_SW_MASK (32'h0 | \ - GPIO_PIN7_CONFIG_MASK | \ - GPIO_PIN7_WAKEUP_ENABLE_MASK | \ - GPIO_PIN7_INT_TYPE_MASK | \ - GPIO_PIN7_PAD_DRIVER_MASK | \ - GPIO_PIN7_SOURCE_MASK) - -#define GPIO_PIN8_ADDRESS 'h00000048 -#define GPIO_PIN8_CONFIG_MSB 12 -#define GPIO_PIN8_CONFIG_LSB 11 -#define GPIO_PIN8_CONFIG_MASK 'h00001800 -#define GPIO_PIN8_CONFIG_GET(x) (((x) & GPIO_PIN8_CONFIG_MASK) >> GPIO_PIN8_CONFIG_LSB) -#define GPIO_PIN8_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN8_CONFIG_LSB) & GPIO_PIN8_CONFIG_MASK) -#define GPIO_PIN8_CONFIG_RESET 2'h0 -#define GPIO_PIN8_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN8_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN8_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN8_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN8_WAKEUP_ENABLE_MASK) >> GPIO_PIN8_WAKEUP_ENABLE_LSB) -#define GPIO_PIN8_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN8_WAKEUP_ENABLE_LSB) & GPIO_PIN8_WAKEUP_ENABLE_MASK) -#define GPIO_PIN8_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN8_INT_TYPE_MSB 9 -#define GPIO_PIN8_INT_TYPE_LSB 7 -#define GPIO_PIN8_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN8_INT_TYPE_GET(x) (((x) & GPIO_PIN8_INT_TYPE_MASK) >> GPIO_PIN8_INT_TYPE_LSB) -#define GPIO_PIN8_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN8_INT_TYPE_LSB) & GPIO_PIN8_INT_TYPE_MASK) -#define GPIO_PIN8_INT_TYPE_RESET 3'h0 -#define GPIO_PIN8_PAD_DRIVER_MSB 2 -#define GPIO_PIN8_PAD_DRIVER_LSB 2 -#define GPIO_PIN8_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN8_PAD_DRIVER_GET(x) (((x) & GPIO_PIN8_PAD_DRIVER_MASK) >> GPIO_PIN8_PAD_DRIVER_LSB) -#define GPIO_PIN8_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN8_PAD_DRIVER_LSB) & GPIO_PIN8_PAD_DRIVER_MASK) -#define GPIO_PIN8_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN8_SOURCE_MSB 0 -#define GPIO_PIN8_SOURCE_LSB 0 -#define GPIO_PIN8_SOURCE_MASK 'h00000001 -#define GPIO_PIN8_SOURCE_GET(x) (((x) & GPIO_PIN8_SOURCE_MASK) >> GPIO_PIN8_SOURCE_LSB) -#define GPIO_PIN8_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN8_SOURCE_LSB) & GPIO_PIN8_SOURCE_MASK) -#define GPIO_PIN8_SOURCE_RESET 1'h0 -#define GPIO_PIN8_RESET (32'h0 | \ - GPIO_PIN8_CONFIG_SET(GPIO_PIN8_CONFIG_RESET) | \ - GPIO_PIN8_WAKEUP_ENABLE_SET(GPIO_PIN8_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN8_INT_TYPE_SET(GPIO_PIN8_INT_TYPE_RESET) | \ - GPIO_PIN8_PAD_DRIVER_SET(GPIO_PIN8_PAD_DRIVER_RESET) | \ - GPIO_PIN8_SOURCE_SET(GPIO_PIN8_SOURCE_RESET)) -#define GPIO_PIN8_HW_MASK (32'h0) -#define GPIO_PIN8_SW_MASK (32'h0 | \ - GPIO_PIN8_CONFIG_MASK | \ - GPIO_PIN8_WAKEUP_ENABLE_MASK | \ - GPIO_PIN8_INT_TYPE_MASK | \ - GPIO_PIN8_PAD_DRIVER_MASK | \ - GPIO_PIN8_SOURCE_MASK) - -#define GPIO_PIN9_ADDRESS 'h0000004c -#define GPIO_PIN9_CONFIG_MSB 12 -#define GPIO_PIN9_CONFIG_LSB 11 -#define GPIO_PIN9_CONFIG_MASK 'h00001800 -#define GPIO_PIN9_CONFIG_GET(x) (((x) & GPIO_PIN9_CONFIG_MASK) >> GPIO_PIN9_CONFIG_LSB) -#define GPIO_PIN9_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN9_CONFIG_LSB) & GPIO_PIN9_CONFIG_MASK) -#define GPIO_PIN9_CONFIG_RESET 2'h0 -#define GPIO_PIN9_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN9_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN9_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN9_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN9_WAKEUP_ENABLE_MASK) >> GPIO_PIN9_WAKEUP_ENABLE_LSB) -#define GPIO_PIN9_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN9_WAKEUP_ENABLE_LSB) & GPIO_PIN9_WAKEUP_ENABLE_MASK) -#define GPIO_PIN9_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN9_INT_TYPE_MSB 9 -#define GPIO_PIN9_INT_TYPE_LSB 7 -#define GPIO_PIN9_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN9_INT_TYPE_GET(x) (((x) & GPIO_PIN9_INT_TYPE_MASK) >> GPIO_PIN9_INT_TYPE_LSB) -#define GPIO_PIN9_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN9_INT_TYPE_LSB) & GPIO_PIN9_INT_TYPE_MASK) -#define GPIO_PIN9_INT_TYPE_RESET 3'h0 -#define GPIO_PIN9_PAD_DRIVER_MSB 2 -#define GPIO_PIN9_PAD_DRIVER_LSB 2 -#define GPIO_PIN9_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN9_PAD_DRIVER_GET(x) (((x) & GPIO_PIN9_PAD_DRIVER_MASK) >> GPIO_PIN9_PAD_DRIVER_LSB) -#define GPIO_PIN9_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN9_PAD_DRIVER_LSB) & GPIO_PIN9_PAD_DRIVER_MASK) -#define GPIO_PIN9_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN9_SOURCE_MSB 0 -#define GPIO_PIN9_SOURCE_LSB 0 -#define GPIO_PIN9_SOURCE_MASK 'h00000001 -#define GPIO_PIN9_SOURCE_GET(x) (((x) & GPIO_PIN9_SOURCE_MASK) >> GPIO_PIN9_SOURCE_LSB) -#define GPIO_PIN9_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN9_SOURCE_LSB) & GPIO_PIN9_SOURCE_MASK) -#define GPIO_PIN9_SOURCE_RESET 1'h0 -#define GPIO_PIN9_RESET (32'h0 | \ - GPIO_PIN9_CONFIG_SET(GPIO_PIN9_CONFIG_RESET) | \ - GPIO_PIN9_WAKEUP_ENABLE_SET(GPIO_PIN9_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN9_INT_TYPE_SET(GPIO_PIN9_INT_TYPE_RESET) | \ - GPIO_PIN9_PAD_DRIVER_SET(GPIO_PIN9_PAD_DRIVER_RESET) | \ - GPIO_PIN9_SOURCE_SET(GPIO_PIN9_SOURCE_RESET)) -#define GPIO_PIN9_HW_MASK (32'h0) -#define GPIO_PIN9_SW_MASK (32'h0 | \ - GPIO_PIN9_CONFIG_MASK | \ - GPIO_PIN9_WAKEUP_ENABLE_MASK | \ - GPIO_PIN9_INT_TYPE_MASK | \ - GPIO_PIN9_PAD_DRIVER_MASK | \ - GPIO_PIN9_SOURCE_MASK) - -#define GPIO_PIN10_ADDRESS 'h00000050 -#define GPIO_PIN10_CONFIG_MSB 12 -#define GPIO_PIN10_CONFIG_LSB 11 -#define GPIO_PIN10_CONFIG_MASK 'h00001800 -#define GPIO_PIN10_CONFIG_GET(x) (((x) & GPIO_PIN10_CONFIG_MASK) >> GPIO_PIN10_CONFIG_LSB) -#define GPIO_PIN10_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN10_CONFIG_LSB) & GPIO_PIN10_CONFIG_MASK) -#define GPIO_PIN10_CONFIG_RESET 2'h0 -#define GPIO_PIN10_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN10_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN10_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN10_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN10_WAKEUP_ENABLE_MASK) >> GPIO_PIN10_WAKEUP_ENABLE_LSB) -#define GPIO_PIN10_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN10_WAKEUP_ENABLE_LSB) & GPIO_PIN10_WAKEUP_ENABLE_MASK) -#define GPIO_PIN10_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN10_INT_TYPE_MSB 9 -#define GPIO_PIN10_INT_TYPE_LSB 7 -#define GPIO_PIN10_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN10_INT_TYPE_GET(x) (((x) & GPIO_PIN10_INT_TYPE_MASK) >> GPIO_PIN10_INT_TYPE_LSB) -#define GPIO_PIN10_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN10_INT_TYPE_LSB) & GPIO_PIN10_INT_TYPE_MASK) -#define GPIO_PIN10_INT_TYPE_RESET 3'h0 -#define GPIO_PIN10_PAD_DRIVER_MSB 2 -#define GPIO_PIN10_PAD_DRIVER_LSB 2 -#define GPIO_PIN10_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN10_PAD_DRIVER_GET(x) (((x) & GPIO_PIN10_PAD_DRIVER_MASK) >> GPIO_PIN10_PAD_DRIVER_LSB) -#define GPIO_PIN10_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN10_PAD_DRIVER_LSB) & GPIO_PIN10_PAD_DRIVER_MASK) -#define GPIO_PIN10_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN10_SOURCE_MSB 0 -#define GPIO_PIN10_SOURCE_LSB 0 -#define GPIO_PIN10_SOURCE_MASK 'h00000001 -#define GPIO_PIN10_SOURCE_GET(x) (((x) & GPIO_PIN10_SOURCE_MASK) >> GPIO_PIN10_SOURCE_LSB) -#define GPIO_PIN10_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN10_SOURCE_LSB) & GPIO_PIN10_SOURCE_MASK) -#define GPIO_PIN10_SOURCE_RESET 1'h0 -#define GPIO_PIN10_RESET (32'h0 | \ - GPIO_PIN10_CONFIG_SET(GPIO_PIN10_CONFIG_RESET) | \ - GPIO_PIN10_WAKEUP_ENABLE_SET(GPIO_PIN10_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN10_INT_TYPE_SET(GPIO_PIN10_INT_TYPE_RESET) | \ - GPIO_PIN10_PAD_DRIVER_SET(GPIO_PIN10_PAD_DRIVER_RESET) | \ - GPIO_PIN10_SOURCE_SET(GPIO_PIN10_SOURCE_RESET)) -#define GPIO_PIN10_HW_MASK (32'h0) -#define GPIO_PIN10_SW_MASK (32'h0 | \ - GPIO_PIN10_CONFIG_MASK | \ - GPIO_PIN10_WAKEUP_ENABLE_MASK | \ - GPIO_PIN10_INT_TYPE_MASK | \ - GPIO_PIN10_PAD_DRIVER_MASK | \ - GPIO_PIN10_SOURCE_MASK) - -#define GPIO_PIN11_ADDRESS 'h00000054 -#define GPIO_PIN11_CONFIG_MSB 12 -#define GPIO_PIN11_CONFIG_LSB 11 -#define GPIO_PIN11_CONFIG_MASK 'h00001800 -#define GPIO_PIN11_CONFIG_GET(x) (((x) & GPIO_PIN11_CONFIG_MASK) >> GPIO_PIN11_CONFIG_LSB) -#define GPIO_PIN11_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN11_CONFIG_LSB) & GPIO_PIN11_CONFIG_MASK) -#define GPIO_PIN11_CONFIG_RESET 2'h0 -#define GPIO_PIN11_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN11_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN11_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN11_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN11_WAKEUP_ENABLE_MASK) >> GPIO_PIN11_WAKEUP_ENABLE_LSB) -#define GPIO_PIN11_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN11_WAKEUP_ENABLE_LSB) & GPIO_PIN11_WAKEUP_ENABLE_MASK) -#define GPIO_PIN11_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN11_INT_TYPE_MSB 9 -#define GPIO_PIN11_INT_TYPE_LSB 7 -#define GPIO_PIN11_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN11_INT_TYPE_GET(x) (((x) & GPIO_PIN11_INT_TYPE_MASK) >> GPIO_PIN11_INT_TYPE_LSB) -#define GPIO_PIN11_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN11_INT_TYPE_LSB) & GPIO_PIN11_INT_TYPE_MASK) -#define GPIO_PIN11_INT_TYPE_RESET 3'h0 -#define GPIO_PIN11_PAD_DRIVER_MSB 2 -#define GPIO_PIN11_PAD_DRIVER_LSB 2 -#define GPIO_PIN11_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN11_PAD_DRIVER_GET(x) (((x) & GPIO_PIN11_PAD_DRIVER_MASK) >> GPIO_PIN11_PAD_DRIVER_LSB) -#define GPIO_PIN11_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN11_PAD_DRIVER_LSB) & GPIO_PIN11_PAD_DRIVER_MASK) -#define GPIO_PIN11_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN11_SOURCE_MSB 0 -#define GPIO_PIN11_SOURCE_LSB 0 -#define GPIO_PIN11_SOURCE_MASK 'h00000001 -#define GPIO_PIN11_SOURCE_GET(x) (((x) & GPIO_PIN11_SOURCE_MASK) >> GPIO_PIN11_SOURCE_LSB) -#define GPIO_PIN11_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN11_SOURCE_LSB) & GPIO_PIN11_SOURCE_MASK) -#define GPIO_PIN11_SOURCE_RESET 1'h0 -#define GPIO_PIN11_RESET (32'h0 | \ - GPIO_PIN11_CONFIG_SET(GPIO_PIN11_CONFIG_RESET) | \ - GPIO_PIN11_WAKEUP_ENABLE_SET(GPIO_PIN11_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN11_INT_TYPE_SET(GPIO_PIN11_INT_TYPE_RESET) | \ - GPIO_PIN11_PAD_DRIVER_SET(GPIO_PIN11_PAD_DRIVER_RESET) | \ - GPIO_PIN11_SOURCE_SET(GPIO_PIN11_SOURCE_RESET)) -#define GPIO_PIN11_HW_MASK (32'h0) -#define GPIO_PIN11_SW_MASK (32'h0 | \ - GPIO_PIN11_CONFIG_MASK | \ - GPIO_PIN11_WAKEUP_ENABLE_MASK | \ - GPIO_PIN11_INT_TYPE_MASK | \ - GPIO_PIN11_PAD_DRIVER_MASK | \ - GPIO_PIN11_SOURCE_MASK) - -#define GPIO_PIN12_ADDRESS 'h00000058 -#define GPIO_PIN12_CONFIG_MSB 12 -#define GPIO_PIN12_CONFIG_LSB 11 -#define GPIO_PIN12_CONFIG_MASK 'h00001800 -#define GPIO_PIN12_CONFIG_GET(x) (((x) & GPIO_PIN12_CONFIG_MASK) >> GPIO_PIN12_CONFIG_LSB) -#define GPIO_PIN12_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN12_CONFIG_LSB) & GPIO_PIN12_CONFIG_MASK) -#define GPIO_PIN12_CONFIG_RESET 2'h0 -#define GPIO_PIN12_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN12_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN12_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN12_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN12_WAKEUP_ENABLE_MASK) >> GPIO_PIN12_WAKEUP_ENABLE_LSB) -#define GPIO_PIN12_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN12_WAKEUP_ENABLE_LSB) & GPIO_PIN12_WAKEUP_ENABLE_MASK) -#define GPIO_PIN12_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN12_INT_TYPE_MSB 9 -#define GPIO_PIN12_INT_TYPE_LSB 7 -#define GPIO_PIN12_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN12_INT_TYPE_GET(x) (((x) & GPIO_PIN12_INT_TYPE_MASK) >> GPIO_PIN12_INT_TYPE_LSB) -#define GPIO_PIN12_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN12_INT_TYPE_LSB) & GPIO_PIN12_INT_TYPE_MASK) -#define GPIO_PIN12_INT_TYPE_RESET 3'h0 -#define GPIO_PIN12_PAD_DRIVER_MSB 2 -#define GPIO_PIN12_PAD_DRIVER_LSB 2 -#define GPIO_PIN12_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN12_PAD_DRIVER_GET(x) (((x) & GPIO_PIN12_PAD_DRIVER_MASK) >> GPIO_PIN12_PAD_DRIVER_LSB) -#define GPIO_PIN12_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN12_PAD_DRIVER_LSB) & GPIO_PIN12_PAD_DRIVER_MASK) -#define GPIO_PIN12_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN12_SOURCE_MSB 0 -#define GPIO_PIN12_SOURCE_LSB 0 -#define GPIO_PIN12_SOURCE_MASK 'h00000001 -#define GPIO_PIN12_SOURCE_GET(x) (((x) & GPIO_PIN12_SOURCE_MASK) >> GPIO_PIN12_SOURCE_LSB) -#define GPIO_PIN12_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN12_SOURCE_LSB) & GPIO_PIN12_SOURCE_MASK) -#define GPIO_PIN12_SOURCE_RESET 1'h0 -#define GPIO_PIN12_RESET (32'h0 | \ - GPIO_PIN12_CONFIG_SET(GPIO_PIN12_CONFIG_RESET) | \ - GPIO_PIN12_WAKEUP_ENABLE_SET(GPIO_PIN12_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN12_INT_TYPE_SET(GPIO_PIN12_INT_TYPE_RESET) | \ - GPIO_PIN12_PAD_DRIVER_SET(GPIO_PIN12_PAD_DRIVER_RESET) | \ - GPIO_PIN12_SOURCE_SET(GPIO_PIN12_SOURCE_RESET)) -#define GPIO_PIN12_HW_MASK (32'h0) -#define GPIO_PIN12_SW_MASK (32'h0 | \ - GPIO_PIN12_CONFIG_MASK | \ - GPIO_PIN12_WAKEUP_ENABLE_MASK | \ - GPIO_PIN12_INT_TYPE_MASK | \ - GPIO_PIN12_PAD_DRIVER_MASK | \ - GPIO_PIN12_SOURCE_MASK) - -#define GPIO_PIN13_ADDRESS 'h0000005c -#define GPIO_PIN13_CONFIG_MSB 12 -#define GPIO_PIN13_CONFIG_LSB 11 -#define GPIO_PIN13_CONFIG_MASK 'h00001800 -#define GPIO_PIN13_CONFIG_GET(x) (((x) & GPIO_PIN13_CONFIG_MASK) >> GPIO_PIN13_CONFIG_LSB) -#define GPIO_PIN13_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN13_CONFIG_LSB) & GPIO_PIN13_CONFIG_MASK) -#define GPIO_PIN13_CONFIG_RESET 2'h0 -#define GPIO_PIN13_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN13_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN13_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN13_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN13_WAKEUP_ENABLE_MASK) >> GPIO_PIN13_WAKEUP_ENABLE_LSB) -#define GPIO_PIN13_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN13_WAKEUP_ENABLE_LSB) & GPIO_PIN13_WAKEUP_ENABLE_MASK) -#define GPIO_PIN13_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN13_INT_TYPE_MSB 9 -#define GPIO_PIN13_INT_TYPE_LSB 7 -#define GPIO_PIN13_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN13_INT_TYPE_GET(x) (((x) & GPIO_PIN13_INT_TYPE_MASK) >> GPIO_PIN13_INT_TYPE_LSB) -#define GPIO_PIN13_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN13_INT_TYPE_LSB) & GPIO_PIN13_INT_TYPE_MASK) -#define GPIO_PIN13_INT_TYPE_RESET 3'h0 -#define GPIO_PIN13_PAD_DRIVER_MSB 2 -#define GPIO_PIN13_PAD_DRIVER_LSB 2 -#define GPIO_PIN13_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN13_PAD_DRIVER_GET(x) (((x) & GPIO_PIN13_PAD_DRIVER_MASK) >> GPIO_PIN13_PAD_DRIVER_LSB) -#define GPIO_PIN13_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN13_PAD_DRIVER_LSB) & GPIO_PIN13_PAD_DRIVER_MASK) -#define GPIO_PIN13_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN13_SOURCE_MSB 0 -#define GPIO_PIN13_SOURCE_LSB 0 -#define GPIO_PIN13_SOURCE_MASK 'h00000001 -#define GPIO_PIN13_SOURCE_GET(x) (((x) & GPIO_PIN13_SOURCE_MASK) >> GPIO_PIN13_SOURCE_LSB) -#define GPIO_PIN13_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN13_SOURCE_LSB) & GPIO_PIN13_SOURCE_MASK) -#define GPIO_PIN13_SOURCE_RESET 1'h0 -#define GPIO_PIN13_RESET (32'h0 | \ - GPIO_PIN13_CONFIG_SET(GPIO_PIN13_CONFIG_RESET) | \ - GPIO_PIN13_WAKEUP_ENABLE_SET(GPIO_PIN13_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN13_INT_TYPE_SET(GPIO_PIN13_INT_TYPE_RESET) | \ - GPIO_PIN13_PAD_DRIVER_SET(GPIO_PIN13_PAD_DRIVER_RESET) | \ - GPIO_PIN13_SOURCE_SET(GPIO_PIN13_SOURCE_RESET)) -#define GPIO_PIN13_HW_MASK (32'h0) -#define GPIO_PIN13_SW_MASK (32'h0 | \ - GPIO_PIN13_CONFIG_MASK | \ - GPIO_PIN13_WAKEUP_ENABLE_MASK | \ - GPIO_PIN13_INT_TYPE_MASK | \ - GPIO_PIN13_PAD_DRIVER_MASK | \ - GPIO_PIN13_SOURCE_MASK) - -#define GPIO_PIN14_ADDRESS 'h00000060 -#define GPIO_PIN14_CONFIG_MSB 12 -#define GPIO_PIN14_CONFIG_LSB 11 -#define GPIO_PIN14_CONFIG_MASK 'h00001800 -#define GPIO_PIN14_CONFIG_GET(x) (((x) & GPIO_PIN14_CONFIG_MASK) >> GPIO_PIN14_CONFIG_LSB) -#define GPIO_PIN14_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN14_CONFIG_LSB) & GPIO_PIN14_CONFIG_MASK) -#define GPIO_PIN14_CONFIG_RESET 2'h0 -#define GPIO_PIN14_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN14_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN14_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN14_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN14_WAKEUP_ENABLE_MASK) >> GPIO_PIN14_WAKEUP_ENABLE_LSB) -#define GPIO_PIN14_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN14_WAKEUP_ENABLE_LSB) & GPIO_PIN14_WAKEUP_ENABLE_MASK) -#define GPIO_PIN14_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN14_INT_TYPE_MSB 9 -#define GPIO_PIN14_INT_TYPE_LSB 7 -#define GPIO_PIN14_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN14_INT_TYPE_GET(x) (((x) & GPIO_PIN14_INT_TYPE_MASK) >> GPIO_PIN14_INT_TYPE_LSB) -#define GPIO_PIN14_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN14_INT_TYPE_LSB) & GPIO_PIN14_INT_TYPE_MASK) -#define GPIO_PIN14_INT_TYPE_RESET 3'h0 -#define GPIO_PIN14_PAD_DRIVER_MSB 2 -#define GPIO_PIN14_PAD_DRIVER_LSB 2 -#define GPIO_PIN14_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN14_PAD_DRIVER_GET(x) (((x) & GPIO_PIN14_PAD_DRIVER_MASK) >> GPIO_PIN14_PAD_DRIVER_LSB) -#define GPIO_PIN14_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN14_PAD_DRIVER_LSB) & GPIO_PIN14_PAD_DRIVER_MASK) -#define GPIO_PIN14_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN14_SOURCE_MSB 0 -#define GPIO_PIN14_SOURCE_LSB 0 -#define GPIO_PIN14_SOURCE_MASK 'h00000001 -#define GPIO_PIN14_SOURCE_GET(x) (((x) & GPIO_PIN14_SOURCE_MASK) >> GPIO_PIN14_SOURCE_LSB) -#define GPIO_PIN14_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN14_SOURCE_LSB) & GPIO_PIN14_SOURCE_MASK) -#define GPIO_PIN14_SOURCE_RESET 1'h0 -#define GPIO_PIN14_RESET (32'h0 | \ - GPIO_PIN14_CONFIG_SET(GPIO_PIN14_CONFIG_RESET) | \ - GPIO_PIN14_WAKEUP_ENABLE_SET(GPIO_PIN14_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN14_INT_TYPE_SET(GPIO_PIN14_INT_TYPE_RESET) | \ - GPIO_PIN14_PAD_DRIVER_SET(GPIO_PIN14_PAD_DRIVER_RESET) | \ - GPIO_PIN14_SOURCE_SET(GPIO_PIN14_SOURCE_RESET)) -#define GPIO_PIN14_HW_MASK (32'h0) -#define GPIO_PIN14_SW_MASK (32'h0 | \ - GPIO_PIN14_CONFIG_MASK | \ - GPIO_PIN14_WAKEUP_ENABLE_MASK | \ - GPIO_PIN14_INT_TYPE_MASK | \ - GPIO_PIN14_PAD_DRIVER_MASK | \ - GPIO_PIN14_SOURCE_MASK) - -#define GPIO_PIN15_ADDRESS 'h00000064 -#define GPIO_PIN15_CONFIG_MSB 12 -#define GPIO_PIN15_CONFIG_LSB 11 -#define GPIO_PIN15_CONFIG_MASK 'h00001800 -#define GPIO_PIN15_CONFIG_GET(x) (((x) & GPIO_PIN15_CONFIG_MASK) >> GPIO_PIN15_CONFIG_LSB) -#define GPIO_PIN15_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN15_CONFIG_LSB) & GPIO_PIN15_CONFIG_MASK) -#define GPIO_PIN15_CONFIG_RESET 2'h0 -#define GPIO_PIN15_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN15_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN15_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN15_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN15_WAKEUP_ENABLE_MASK) >> GPIO_PIN15_WAKEUP_ENABLE_LSB) -#define GPIO_PIN15_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN15_WAKEUP_ENABLE_LSB) & GPIO_PIN15_WAKEUP_ENABLE_MASK) -#define GPIO_PIN15_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN15_INT_TYPE_MSB 9 -#define GPIO_PIN15_INT_TYPE_LSB 7 -#define GPIO_PIN15_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN15_INT_TYPE_GET(x) (((x) & GPIO_PIN15_INT_TYPE_MASK) >> GPIO_PIN15_INT_TYPE_LSB) -#define GPIO_PIN15_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN15_INT_TYPE_LSB) & GPIO_PIN15_INT_TYPE_MASK) -#define GPIO_PIN15_INT_TYPE_RESET 3'h0 -#define GPIO_PIN15_PAD_DRIVER_MSB 2 -#define GPIO_PIN15_PAD_DRIVER_LSB 2 -#define GPIO_PIN15_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN15_PAD_DRIVER_GET(x) (((x) & GPIO_PIN15_PAD_DRIVER_MASK) >> GPIO_PIN15_PAD_DRIVER_LSB) -#define GPIO_PIN15_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN15_PAD_DRIVER_LSB) & GPIO_PIN15_PAD_DRIVER_MASK) -#define GPIO_PIN15_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN15_SOURCE_MSB 0 -#define GPIO_PIN15_SOURCE_LSB 0 -#define GPIO_PIN15_SOURCE_MASK 'h00000001 -#define GPIO_PIN15_SOURCE_GET(x) (((x) & GPIO_PIN15_SOURCE_MASK) >> GPIO_PIN15_SOURCE_LSB) -#define GPIO_PIN15_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN15_SOURCE_LSB) & GPIO_PIN15_SOURCE_MASK) -#define GPIO_PIN15_SOURCE_RESET 1'h0 -#define GPIO_PIN15_RESET (32'h0 | \ - GPIO_PIN15_CONFIG_SET(GPIO_PIN15_CONFIG_RESET) | \ - GPIO_PIN15_WAKEUP_ENABLE_SET(GPIO_PIN15_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN15_INT_TYPE_SET(GPIO_PIN15_INT_TYPE_RESET) | \ - GPIO_PIN15_PAD_DRIVER_SET(GPIO_PIN15_PAD_DRIVER_RESET) | \ - GPIO_PIN15_SOURCE_SET(GPIO_PIN15_SOURCE_RESET)) -#define GPIO_PIN15_HW_MASK (32'h0) -#define GPIO_PIN15_SW_MASK (32'h0 | \ - GPIO_PIN15_CONFIG_MASK | \ - GPIO_PIN15_WAKEUP_ENABLE_MASK | \ - GPIO_PIN15_INT_TYPE_MASK | \ - GPIO_PIN15_PAD_DRIVER_MASK | \ - GPIO_PIN15_SOURCE_MASK) - -#define GPIO_PIN16_ADDRESS 'h00000068 -#define GPIO_PIN16_CONFIG_MSB 12 -#define GPIO_PIN16_CONFIG_LSB 11 -#define GPIO_PIN16_CONFIG_MASK 'h00001800 -#define GPIO_PIN16_CONFIG_GET(x) (((x) & GPIO_PIN16_CONFIG_MASK) >> GPIO_PIN16_CONFIG_LSB) -#define GPIO_PIN16_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN16_CONFIG_LSB) & GPIO_PIN16_CONFIG_MASK) -#define GPIO_PIN16_CONFIG_RESET 2'h0 -#define GPIO_PIN16_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN16_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN16_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN16_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN16_WAKEUP_ENABLE_MASK) >> GPIO_PIN16_WAKEUP_ENABLE_LSB) -#define GPIO_PIN16_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN16_WAKEUP_ENABLE_LSB) & GPIO_PIN16_WAKEUP_ENABLE_MASK) -#define GPIO_PIN16_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN16_INT_TYPE_MSB 9 -#define GPIO_PIN16_INT_TYPE_LSB 7 -#define GPIO_PIN16_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN16_INT_TYPE_GET(x) (((x) & GPIO_PIN16_INT_TYPE_MASK) >> GPIO_PIN16_INT_TYPE_LSB) -#define GPIO_PIN16_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN16_INT_TYPE_LSB) & GPIO_PIN16_INT_TYPE_MASK) -#define GPIO_PIN16_INT_TYPE_RESET 3'h0 -#define GPIO_PIN16_PAD_DRIVER_MSB 2 -#define GPIO_PIN16_PAD_DRIVER_LSB 2 -#define GPIO_PIN16_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN16_PAD_DRIVER_GET(x) (((x) & GPIO_PIN16_PAD_DRIVER_MASK) >> GPIO_PIN16_PAD_DRIVER_LSB) -#define GPIO_PIN16_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN16_PAD_DRIVER_LSB) & GPIO_PIN16_PAD_DRIVER_MASK) -#define GPIO_PIN16_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN16_SOURCE_MSB 0 -#define GPIO_PIN16_SOURCE_LSB 0 -#define GPIO_PIN16_SOURCE_MASK 'h00000001 -#define GPIO_PIN16_SOURCE_GET(x) (((x) & GPIO_PIN16_SOURCE_MASK) >> GPIO_PIN16_SOURCE_LSB) -#define GPIO_PIN16_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN16_SOURCE_LSB) & GPIO_PIN16_SOURCE_MASK) -#define GPIO_PIN16_SOURCE_RESET 1'h0 -#define GPIO_PIN16_RESET (32'h0 | \ - GPIO_PIN16_CONFIG_SET(GPIO_PIN16_CONFIG_RESET) | \ - GPIO_PIN16_WAKEUP_ENABLE_SET(GPIO_PIN16_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN16_INT_TYPE_SET(GPIO_PIN16_INT_TYPE_RESET) | \ - GPIO_PIN16_PAD_DRIVER_SET(GPIO_PIN16_PAD_DRIVER_RESET) | \ - GPIO_PIN16_SOURCE_SET(GPIO_PIN16_SOURCE_RESET)) -#define GPIO_PIN16_HW_MASK (32'h0) -#define GPIO_PIN16_SW_MASK (32'h0 | \ - GPIO_PIN16_CONFIG_MASK | \ - GPIO_PIN16_WAKEUP_ENABLE_MASK | \ - GPIO_PIN16_INT_TYPE_MASK | \ - GPIO_PIN16_PAD_DRIVER_MASK | \ - GPIO_PIN16_SOURCE_MASK) - -#define GPIO_PIN17_ADDRESS 'h0000006c -#define GPIO_PIN17_CONFIG_MSB 12 -#define GPIO_PIN17_CONFIG_LSB 11 -#define GPIO_PIN17_CONFIG_MASK 'h00001800 -#define GPIO_PIN17_CONFIG_GET(x) (((x) & GPIO_PIN17_CONFIG_MASK) >> GPIO_PIN17_CONFIG_LSB) -#define GPIO_PIN17_CONFIG_SET(x) (((32'd0 | (x)) << GPIO_PIN17_CONFIG_LSB) & GPIO_PIN17_CONFIG_MASK) -#define GPIO_PIN17_CONFIG_RESET 2'h0 -#define GPIO_PIN17_WAKEUP_ENABLE_MSB 10 -#define GPIO_PIN17_WAKEUP_ENABLE_LSB 10 -#define GPIO_PIN17_WAKEUP_ENABLE_MASK 'h00000400 -#define GPIO_PIN17_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN17_WAKEUP_ENABLE_MASK) >> GPIO_PIN17_WAKEUP_ENABLE_LSB) -#define GPIO_PIN17_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_PIN17_WAKEUP_ENABLE_LSB) & GPIO_PIN17_WAKEUP_ENABLE_MASK) -#define GPIO_PIN17_WAKEUP_ENABLE_RESET 1'h0 -#define GPIO_PIN17_INT_TYPE_MSB 9 -#define GPIO_PIN17_INT_TYPE_LSB 7 -#define GPIO_PIN17_INT_TYPE_MASK 'h00000380 -#define GPIO_PIN17_INT_TYPE_GET(x) (((x) & GPIO_PIN17_INT_TYPE_MASK) >> GPIO_PIN17_INT_TYPE_LSB) -#define GPIO_PIN17_INT_TYPE_SET(x) (((32'd0 | (x)) << GPIO_PIN17_INT_TYPE_LSB) & GPIO_PIN17_INT_TYPE_MASK) -#define GPIO_PIN17_INT_TYPE_RESET 3'h0 -#define GPIO_PIN17_PAD_DRIVER_MSB 2 -#define GPIO_PIN17_PAD_DRIVER_LSB 2 -#define GPIO_PIN17_PAD_DRIVER_MASK 'h00000004 -#define GPIO_PIN17_PAD_DRIVER_GET(x) (((x) & GPIO_PIN17_PAD_DRIVER_MASK) >> GPIO_PIN17_PAD_DRIVER_LSB) -#define GPIO_PIN17_PAD_DRIVER_SET(x) (((32'd0 | (x)) << GPIO_PIN17_PAD_DRIVER_LSB) & GPIO_PIN17_PAD_DRIVER_MASK) -#define GPIO_PIN17_PAD_DRIVER_RESET 1'h0 -#define GPIO_PIN17_SOURCE_MSB 0 -#define GPIO_PIN17_SOURCE_LSB 0 -#define GPIO_PIN17_SOURCE_MASK 'h00000001 -#define GPIO_PIN17_SOURCE_GET(x) (((x) & GPIO_PIN17_SOURCE_MASK) >> GPIO_PIN17_SOURCE_LSB) -#define GPIO_PIN17_SOURCE_SET(x) (((32'd0 | (x)) << GPIO_PIN17_SOURCE_LSB) & GPIO_PIN17_SOURCE_MASK) -#define GPIO_PIN17_SOURCE_RESET 1'h0 -#define GPIO_PIN17_RESET (32'h0 | \ - GPIO_PIN17_CONFIG_SET(GPIO_PIN17_CONFIG_RESET) | \ - GPIO_PIN17_WAKEUP_ENABLE_SET(GPIO_PIN17_WAKEUP_ENABLE_RESET) | \ - GPIO_PIN17_INT_TYPE_SET(GPIO_PIN17_INT_TYPE_RESET) | \ - GPIO_PIN17_PAD_DRIVER_SET(GPIO_PIN17_PAD_DRIVER_RESET) | \ - GPIO_PIN17_SOURCE_SET(GPIO_PIN17_SOURCE_RESET)) -#define GPIO_PIN17_HW_MASK (32'h0) -#define GPIO_PIN17_SW_MASK (32'h0 | \ - GPIO_PIN17_CONFIG_MASK | \ - GPIO_PIN17_WAKEUP_ENABLE_MASK | \ - GPIO_PIN17_INT_TYPE_MASK | \ - GPIO_PIN17_PAD_DRIVER_MASK | \ - GPIO_PIN17_SOURCE_MASK) - -#define SDIO_PIN_ADDRESS 'h00000070 -#define SDIO_PIN_PAD_PULL_MSB 3 -#define SDIO_PIN_PAD_PULL_LSB 2 -#define SDIO_PIN_PAD_PULL_MASK 'h0000000c -#define SDIO_PIN_PAD_PULL_GET(x) (((x) & SDIO_PIN_PAD_PULL_MASK) >> SDIO_PIN_PAD_PULL_LSB) -#define SDIO_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << SDIO_PIN_PAD_PULL_LSB) & SDIO_PIN_PAD_PULL_MASK) -#define SDIO_PIN_PAD_PULL_RESET 2'h1 -#define SDIO_PIN_PAD_STRENGTH_MSB 1 -#define SDIO_PIN_PAD_STRENGTH_LSB 0 -#define SDIO_PIN_PAD_STRENGTH_MASK 'h00000003 -#define SDIO_PIN_PAD_STRENGTH_GET(x) (((x) & SDIO_PIN_PAD_STRENGTH_MASK) >> SDIO_PIN_PAD_STRENGTH_LSB) -#define SDIO_PIN_PAD_STRENGTH_SET(x) (((32'd0 | (x)) << SDIO_PIN_PAD_STRENGTH_LSB) & SDIO_PIN_PAD_STRENGTH_MASK) -#define SDIO_PIN_PAD_STRENGTH_RESET 2'h1 -#define SDIO_PIN_RESET (32'h0 | \ - SDIO_PIN_PAD_PULL_SET(SDIO_PIN_PAD_PULL_RESET) | \ - SDIO_PIN_PAD_STRENGTH_SET(SDIO_PIN_PAD_STRENGTH_RESET)) -#define SDIO_PIN_HW_MASK (32'h0) -#define SDIO_PIN_SW_MASK (32'h0 | \ - SDIO_PIN_PAD_PULL_MASK | \ - SDIO_PIN_PAD_STRENGTH_MASK) - -#define CLK_REQ_PIN_ADDRESS 'h00000074 -#define CLK_REQ_PIN_ATE_OE_L_MSB 4 -#define CLK_REQ_PIN_ATE_OE_L_LSB 4 -#define CLK_REQ_PIN_ATE_OE_L_MASK 'h00000010 -#define CLK_REQ_PIN_ATE_OE_L_GET(x) (((x) & CLK_REQ_PIN_ATE_OE_L_MASK) >> CLK_REQ_PIN_ATE_OE_L_LSB) -#define CLK_REQ_PIN_ATE_OE_L_SET(x) (((32'd0 | (x)) << CLK_REQ_PIN_ATE_OE_L_LSB) & CLK_REQ_PIN_ATE_OE_L_MASK) -#define CLK_REQ_PIN_ATE_OE_L_RESET 1'h0 -#define CLK_REQ_PIN_PAD_PULL_MSB 3 -#define CLK_REQ_PIN_PAD_PULL_LSB 2 -#define CLK_REQ_PIN_PAD_PULL_MASK 'h0000000c -#define CLK_REQ_PIN_PAD_PULL_GET(x) (((x) & CLK_REQ_PIN_PAD_PULL_MASK) >> CLK_REQ_PIN_PAD_PULL_LSB) -#define CLK_REQ_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << CLK_REQ_PIN_PAD_PULL_LSB) & CLK_REQ_PIN_PAD_PULL_MASK) -#define CLK_REQ_PIN_PAD_PULL_RESET 2'h2 -#define CLK_REQ_PIN_PAD_STRENGTH_MSB 1 -#define CLK_REQ_PIN_PAD_STRENGTH_LSB 0 -#define CLK_REQ_PIN_PAD_STRENGTH_MASK 'h00000003 -#define CLK_REQ_PIN_PAD_STRENGTH_GET(x) (((x) & CLK_REQ_PIN_PAD_STRENGTH_MASK) >> CLK_REQ_PIN_PAD_STRENGTH_LSB) -#define CLK_REQ_PIN_PAD_STRENGTH_SET(x) (((32'd0 | (x)) << CLK_REQ_PIN_PAD_STRENGTH_LSB) & CLK_REQ_PIN_PAD_STRENGTH_MASK) -#define CLK_REQ_PIN_PAD_STRENGTH_RESET 2'h1 -#define CLK_REQ_PIN_RESET (32'h0 | \ - CLK_REQ_PIN_ATE_OE_L_SET(CLK_REQ_PIN_ATE_OE_L_RESET) | \ - CLK_REQ_PIN_PAD_PULL_SET(CLK_REQ_PIN_PAD_PULL_RESET) | \ - CLK_REQ_PIN_PAD_STRENGTH_SET(CLK_REQ_PIN_PAD_STRENGTH_RESET)) -#define CLK_REQ_PIN_HW_MASK (32'h0) -#define CLK_REQ_PIN_SW_MASK (32'h0 | \ - CLK_REQ_PIN_ATE_OE_L_MASK | \ - CLK_REQ_PIN_PAD_PULL_MASK | \ - CLK_REQ_PIN_PAD_STRENGTH_MASK) - -#define SIGMA_DELTA_ADDRESS 'h00000078 -#define SIGMA_DELTA_ENABLE_MSB 16 -#define SIGMA_DELTA_ENABLE_LSB 16 -#define SIGMA_DELTA_ENABLE_MASK 'h00010000 -#define SIGMA_DELTA_ENABLE_GET(x) (((x) & SIGMA_DELTA_ENABLE_MASK) >> SIGMA_DELTA_ENABLE_LSB) -#define SIGMA_DELTA_ENABLE_SET(x) (((32'd0 | (x)) << SIGMA_DELTA_ENABLE_LSB) & SIGMA_DELTA_ENABLE_MASK) -#define SIGMA_DELTA_ENABLE_RESET 1'h0 -#define SIGMA_DELTA_PRESCALAR_MSB 15 -#define SIGMA_DELTA_PRESCALAR_LSB 8 -#define SIGMA_DELTA_PRESCALAR_MASK 'h0000ff00 -#define SIGMA_DELTA_PRESCALAR_GET(x) (((x) & SIGMA_DELTA_PRESCALAR_MASK) >> SIGMA_DELTA_PRESCALAR_LSB) -#define SIGMA_DELTA_PRESCALAR_SET(x) (((32'd0 | (x)) << SIGMA_DELTA_PRESCALAR_LSB) & SIGMA_DELTA_PRESCALAR_MASK) -#define SIGMA_DELTA_PRESCALAR_RESET 8'h0 -#define SIGMA_DELTA_TARGET_MSB 7 -#define SIGMA_DELTA_TARGET_LSB 0 -#define SIGMA_DELTA_TARGET_MASK 'h000000ff -#define SIGMA_DELTA_TARGET_GET(x) (((x) & SIGMA_DELTA_TARGET_MASK) >> SIGMA_DELTA_TARGET_LSB) -#define SIGMA_DELTA_TARGET_SET(x) (((32'd0 | (x)) << SIGMA_DELTA_TARGET_LSB) & SIGMA_DELTA_TARGET_MASK) -#define SIGMA_DELTA_TARGET_RESET 8'h0 -#define SIGMA_DELTA_RESET (32'h0 | \ - SIGMA_DELTA_ENABLE_SET(SIGMA_DELTA_ENABLE_RESET) | \ - SIGMA_DELTA_PRESCALAR_SET(SIGMA_DELTA_PRESCALAR_RESET) | \ - SIGMA_DELTA_TARGET_SET(SIGMA_DELTA_TARGET_RESET)) -#define SIGMA_DELTA_HW_MASK (32'h0) -#define SIGMA_DELTA_SW_MASK (32'h0 | \ - SIGMA_DELTA_ENABLE_MASK | \ - SIGMA_DELTA_PRESCALAR_MASK | \ - SIGMA_DELTA_TARGET_MASK) - -#define DEBUG_CONTROL_ADDRESS 'h0000007c -#define DEBUG_CONTROL_OBS_OE_L_MSB 1 -#define DEBUG_CONTROL_OBS_OE_L_LSB 1 -#define DEBUG_CONTROL_OBS_OE_L_MASK 'h00000002 -#define DEBUG_CONTROL_OBS_OE_L_GET(x) (((x) & DEBUG_CONTROL_OBS_OE_L_MASK) >> DEBUG_CONTROL_OBS_OE_L_LSB) -#define DEBUG_CONTROL_OBS_OE_L_SET(x) (((32'd0 | (x)) << DEBUG_CONTROL_OBS_OE_L_LSB) & DEBUG_CONTROL_OBS_OE_L_MASK) -#define DEBUG_CONTROL_OBS_OE_L_RESET 1'h1 -#define DEBUG_CONTROL_ENABLE_MSB 0 -#define DEBUG_CONTROL_ENABLE_LSB 0 -#define DEBUG_CONTROL_ENABLE_MASK 'h00000001 -#define DEBUG_CONTROL_ENABLE_GET(x) (((x) & DEBUG_CONTROL_ENABLE_MASK) >> DEBUG_CONTROL_ENABLE_LSB) -#define DEBUG_CONTROL_ENABLE_SET(x) (((32'd0 | (x)) << DEBUG_CONTROL_ENABLE_LSB) & DEBUG_CONTROL_ENABLE_MASK) -#define DEBUG_CONTROL_ENABLE_RESET 1'h0 -#define DEBUG_CONTROL_RESET (32'h0 | \ - DEBUG_CONTROL_OBS_OE_L_SET(DEBUG_CONTROL_OBS_OE_L_RESET) | \ - DEBUG_CONTROL_ENABLE_SET(DEBUG_CONTROL_ENABLE_RESET)) -#define DEBUG_CONTROL_HW_MASK (32'h0) -#define DEBUG_CONTROL_SW_MASK (32'h0 | \ - DEBUG_CONTROL_OBS_OE_L_MASK | \ - DEBUG_CONTROL_ENABLE_MASK) - -#define DEBUG_INPUT_SEL_ADDRESS 'h00000080 -#define DEBUG_INPUT_SEL_SRC_MSB 3 -#define DEBUG_INPUT_SEL_SRC_LSB 0 -#define DEBUG_INPUT_SEL_SRC_MASK 'h0000000f -#define DEBUG_INPUT_SEL_SRC_GET(x) (((x) & DEBUG_INPUT_SEL_SRC_MASK) >> DEBUG_INPUT_SEL_SRC_LSB) -#define DEBUG_INPUT_SEL_SRC_SET(x) (((32'd0 | (x)) << DEBUG_INPUT_SEL_SRC_LSB) & DEBUG_INPUT_SEL_SRC_MASK) -#define DEBUG_INPUT_SEL_SRC_RESET 4'h0 -#define DEBUG_INPUT_SEL_RESET (32'h0 | \ - DEBUG_INPUT_SEL_SRC_SET(DEBUG_INPUT_SEL_SRC_RESET)) -#define DEBUG_INPUT_SEL_HW_MASK (32'h0) -#define DEBUG_INPUT_SEL_SW_MASK (32'h0 | \ - DEBUG_INPUT_SEL_SRC_MASK) - -#define DEBUG_OUT_ADDRESS 'h00000084 -#define DEBUG_OUT_DATA_MSB 17 -#define DEBUG_OUT_DATA_LSB 0 -#define DEBUG_OUT_DATA_MASK 'h0003ffff -#define DEBUG_OUT_DATA_GET(x) (((x) & DEBUG_OUT_DATA_MASK) >> DEBUG_OUT_DATA_LSB) -#define DEBUG_OUT_DATA_SET(x) (((32'd0 | (x)) << DEBUG_OUT_DATA_LSB) & DEBUG_OUT_DATA_MASK) -#define DEBUG_OUT_DATA_RESET 18'h0 -#define DEBUG_OUT_RESET (32'h0 | \ - DEBUG_OUT_DATA_SET(DEBUG_OUT_DATA_RESET)) -#define DEBUG_OUT_HW_MASK (32'h0 | \ - DEBUG_OUT_DATA_MASK) -#define DEBUG_OUT_SW_MASK (32'h0) - -#define LA_CONTROL_ADDRESS 'h00000088 -#define LA_CONTROL_RUN_MSB 1 -#define LA_CONTROL_RUN_LSB 1 -#define LA_CONTROL_RUN_MASK 'h00000002 -#define LA_CONTROL_RUN_GET(x) (((x) & LA_CONTROL_RUN_MASK) >> LA_CONTROL_RUN_LSB) -#define LA_CONTROL_RUN_SET(x) (((32'd0 | (x)) << LA_CONTROL_RUN_LSB) & LA_CONTROL_RUN_MASK) -#define LA_CONTROL_RUN_RESET 1'h0 -#define LA_CONTROL_TRIGGERED_MSB 0 -#define LA_CONTROL_TRIGGERED_LSB 0 -#define LA_CONTROL_TRIGGERED_MASK 'h00000001 -#define LA_CONTROL_TRIGGERED_GET(x) (((x) & LA_CONTROL_TRIGGERED_MASK) >> LA_CONTROL_TRIGGERED_LSB) -#define LA_CONTROL_TRIGGERED_SET(x) (((32'd0 | (x)) << LA_CONTROL_TRIGGERED_LSB) & LA_CONTROL_TRIGGERED_MASK) -#define LA_CONTROL_TRIGGERED_RESET 1'h0 -#define LA_CONTROL_RESET (32'h0 | \ - LA_CONTROL_RUN_SET(LA_CONTROL_RUN_RESET) | \ - LA_CONTROL_TRIGGERED_SET(LA_CONTROL_TRIGGERED_RESET)) -#define LA_CONTROL_HW_MASK (32'h0 | \ - LA_CONTROL_RUN_MASK | \ - LA_CONTROL_TRIGGERED_MASK) -#define LA_CONTROL_SW_MASK (32'h0 | \ - LA_CONTROL_RUN_MASK) - -#define LA_CLOCK_ADDRESS 'h0000008c -#define LA_CLOCK_DIV_MSB 7 -#define LA_CLOCK_DIV_LSB 0 -#define LA_CLOCK_DIV_MASK 'h000000ff -#define LA_CLOCK_DIV_GET(x) (((x) & LA_CLOCK_DIV_MASK) >> LA_CLOCK_DIV_LSB) -#define LA_CLOCK_DIV_SET(x) (((32'd0 | (x)) << LA_CLOCK_DIV_LSB) & LA_CLOCK_DIV_MASK) -#define LA_CLOCK_DIV_RESET 8'h0 -#define LA_CLOCK_RESET (32'h0 | \ - LA_CLOCK_DIV_SET(LA_CLOCK_DIV_RESET)) -#define LA_CLOCK_HW_MASK (32'h0) -#define LA_CLOCK_SW_MASK (32'h0 | \ - LA_CLOCK_DIV_MASK) - -#define LA_STATUS_ADDRESS 'h00000090 -#define LA_STATUS_INTERRUPT_MSB 0 -#define LA_STATUS_INTERRUPT_LSB 0 -#define LA_STATUS_INTERRUPT_MASK 'h00000001 -#define LA_STATUS_INTERRUPT_GET(x) (((x) & LA_STATUS_INTERRUPT_MASK) >> LA_STATUS_INTERRUPT_LSB) -#define LA_STATUS_INTERRUPT_SET(x) (((32'd0 | (x)) << LA_STATUS_INTERRUPT_LSB) & LA_STATUS_INTERRUPT_MASK) -#define LA_STATUS_INTERRUPT_RESET 1'h0 -#define LA_STATUS_RESET (32'h0 | \ - LA_STATUS_INTERRUPT_SET(LA_STATUS_INTERRUPT_RESET)) -#define LA_STATUS_HW_MASK (32'h0 | \ - LA_STATUS_INTERRUPT_MASK) -#define LA_STATUS_SW_MASK (32'h0 | \ - LA_STATUS_INTERRUPT_MASK) - -#define LA_TRIGGER_SAMPLE_ADDRESS 'h00000094 -#define LA_TRIGGER_SAMPLE_COUNT_MSB 15 -#define LA_TRIGGER_SAMPLE_COUNT_LSB 0 -#define LA_TRIGGER_SAMPLE_COUNT_MASK 'h0000ffff -#define LA_TRIGGER_SAMPLE_COUNT_GET(x) (((x) & LA_TRIGGER_SAMPLE_COUNT_MASK) >> LA_TRIGGER_SAMPLE_COUNT_LSB) -#define LA_TRIGGER_SAMPLE_COUNT_SET(x) (((32'd0 | (x)) << LA_TRIGGER_SAMPLE_COUNT_LSB) & LA_TRIGGER_SAMPLE_COUNT_MASK) -#define LA_TRIGGER_SAMPLE_COUNT_RESET 16'h0 -#define LA_TRIGGER_SAMPLE_RESET (32'h0 | \ - LA_TRIGGER_SAMPLE_COUNT_SET(LA_TRIGGER_SAMPLE_COUNT_RESET)) -#define LA_TRIGGER_SAMPLE_HW_MASK (32'h0) -#define LA_TRIGGER_SAMPLE_SW_MASK (32'h0 | \ - LA_TRIGGER_SAMPLE_COUNT_MASK) - -#define LA_TRIGGER_POSITION_ADDRESS 'h00000098 -#define LA_TRIGGER_POSITION_VALUE_MSB 15 -#define LA_TRIGGER_POSITION_VALUE_LSB 0 -#define LA_TRIGGER_POSITION_VALUE_MASK 'h0000ffff -#define LA_TRIGGER_POSITION_VALUE_GET(x) (((x) & LA_TRIGGER_POSITION_VALUE_MASK) >> LA_TRIGGER_POSITION_VALUE_LSB) -#define LA_TRIGGER_POSITION_VALUE_SET(x) (((32'd0 | (x)) << LA_TRIGGER_POSITION_VALUE_LSB) & LA_TRIGGER_POSITION_VALUE_MASK) -#define LA_TRIGGER_POSITION_VALUE_RESET 16'h1 -#define LA_TRIGGER_POSITION_RESET (32'h0 | \ - LA_TRIGGER_POSITION_VALUE_SET(LA_TRIGGER_POSITION_VALUE_RESET)) -#define LA_TRIGGER_POSITION_HW_MASK (32'h0) -#define LA_TRIGGER_POSITION_SW_MASK (32'h0 | \ - LA_TRIGGER_POSITION_VALUE_MASK) - -#define LA_PRE_TRIGGER_ADDRESS 'h0000009c -#define LA_PRE_TRIGGER_COUNT_MSB 15 -#define LA_PRE_TRIGGER_COUNT_LSB 0 -#define LA_PRE_TRIGGER_COUNT_MASK 'h0000ffff -#define LA_PRE_TRIGGER_COUNT_GET(x) (((x) & LA_PRE_TRIGGER_COUNT_MASK) >> LA_PRE_TRIGGER_COUNT_LSB) -#define LA_PRE_TRIGGER_COUNT_SET(x) (((32'd0 | (x)) << LA_PRE_TRIGGER_COUNT_LSB) & LA_PRE_TRIGGER_COUNT_MASK) -#define LA_PRE_TRIGGER_COUNT_RESET 16'h0 -#define LA_PRE_TRIGGER_RESET (32'h0 | \ - LA_PRE_TRIGGER_COUNT_SET(LA_PRE_TRIGGER_COUNT_RESET)) -#define LA_PRE_TRIGGER_HW_MASK (32'h0 | \ - LA_PRE_TRIGGER_COUNT_MASK) -#define LA_PRE_TRIGGER_SW_MASK (32'h0 | \ - LA_PRE_TRIGGER_COUNT_MASK) - -#define LA_POST_TRIGGER_ADDRESS 'h000000a0 -#define LA_POST_TRIGGER_COUNT_MSB 15 -#define LA_POST_TRIGGER_COUNT_LSB 0 -#define LA_POST_TRIGGER_COUNT_MASK 'h0000ffff -#define LA_POST_TRIGGER_COUNT_GET(x) (((x) & LA_POST_TRIGGER_COUNT_MASK) >> LA_POST_TRIGGER_COUNT_LSB) -#define LA_POST_TRIGGER_COUNT_SET(x) (((32'd0 | (x)) << LA_POST_TRIGGER_COUNT_LSB) & LA_POST_TRIGGER_COUNT_MASK) -#define LA_POST_TRIGGER_COUNT_RESET 16'h0 -#define LA_POST_TRIGGER_RESET (32'h0 | \ - LA_POST_TRIGGER_COUNT_SET(LA_POST_TRIGGER_COUNT_RESET)) -#define LA_POST_TRIGGER_HW_MASK (32'h0 | \ - LA_POST_TRIGGER_COUNT_MASK) -#define LA_POST_TRIGGER_SW_MASK (32'h0 | \ - LA_POST_TRIGGER_COUNT_MASK) - -#define LA_FILTER_CONTROL_ADDRESS 'h000000a4 -#define LA_FILTER_CONTROL_DELTA_MSB 0 -#define LA_FILTER_CONTROL_DELTA_LSB 0 -#define LA_FILTER_CONTROL_DELTA_MASK 'h00000001 -#define LA_FILTER_CONTROL_DELTA_GET(x) (((x) & LA_FILTER_CONTROL_DELTA_MASK) >> LA_FILTER_CONTROL_DELTA_LSB) -#define LA_FILTER_CONTROL_DELTA_SET(x) (((32'd0 | (x)) << LA_FILTER_CONTROL_DELTA_LSB) & LA_FILTER_CONTROL_DELTA_MASK) -#define LA_FILTER_CONTROL_DELTA_RESET 1'h0 -#define LA_FILTER_CONTROL_RESET (32'h0 | \ - LA_FILTER_CONTROL_DELTA_SET(LA_FILTER_CONTROL_DELTA_RESET)) -#define LA_FILTER_CONTROL_HW_MASK (32'h0) -#define LA_FILTER_CONTROL_SW_MASK (32'h0 | \ - LA_FILTER_CONTROL_DELTA_MASK) - -#define LA_FILTER_DATA_ADDRESS 'h000000a8 -#define LA_FILTER_DATA_MATCH_MSB 17 -#define LA_FILTER_DATA_MATCH_LSB 0 -#define LA_FILTER_DATA_MATCH_MASK 'h0003ffff -#define LA_FILTER_DATA_MATCH_GET(x) (((x) & LA_FILTER_DATA_MATCH_MASK) >> LA_FILTER_DATA_MATCH_LSB) -#define LA_FILTER_DATA_MATCH_SET(x) (((32'd0 | (x)) << LA_FILTER_DATA_MATCH_LSB) & LA_FILTER_DATA_MATCH_MASK) -#define LA_FILTER_DATA_MATCH_RESET 18'h0 -#define LA_FILTER_DATA_RESET (32'h0 | \ - LA_FILTER_DATA_MATCH_SET(LA_FILTER_DATA_MATCH_RESET)) -#define LA_FILTER_DATA_HW_MASK (32'h0) -#define LA_FILTER_DATA_SW_MASK (32'h0 | \ - LA_FILTER_DATA_MATCH_MASK) - -#define LA_FILTER_WILDCARD_ADDRESS 'h000000ac -#define LA_FILTER_WILDCARD_MATCH_MSB 17 -#define LA_FILTER_WILDCARD_MATCH_LSB 0 -#define LA_FILTER_WILDCARD_MATCH_MASK 'h0003ffff -#define LA_FILTER_WILDCARD_MATCH_GET(x) (((x) & LA_FILTER_WILDCARD_MATCH_MASK) >> LA_FILTER_WILDCARD_MATCH_LSB) -#define LA_FILTER_WILDCARD_MATCH_SET(x) (((32'd0 | (x)) << LA_FILTER_WILDCARD_MATCH_LSB) & LA_FILTER_WILDCARD_MATCH_MASK) -#define LA_FILTER_WILDCARD_MATCH_RESET 18'h0 -#define LA_FILTER_WILDCARD_RESET (32'h0 | \ - LA_FILTER_WILDCARD_MATCH_SET(LA_FILTER_WILDCARD_MATCH_RESET)) -#define LA_FILTER_WILDCARD_HW_MASK (32'h0) -#define LA_FILTER_WILDCARD_SW_MASK (32'h0 | \ - LA_FILTER_WILDCARD_MATCH_MASK) - -#define LA_TRIGGERA_DATA_ADDRESS 'h000000b0 -#define LA_TRIGGERA_DATA_MATCH_MSB 17 -#define LA_TRIGGERA_DATA_MATCH_LSB 0 -#define LA_TRIGGERA_DATA_MATCH_MASK 'h0003ffff -#define LA_TRIGGERA_DATA_MATCH_GET(x) (((x) & LA_TRIGGERA_DATA_MATCH_MASK) >> LA_TRIGGERA_DATA_MATCH_LSB) -#define LA_TRIGGERA_DATA_MATCH_SET(x) (((32'd0 | (x)) << LA_TRIGGERA_DATA_MATCH_LSB) & LA_TRIGGERA_DATA_MATCH_MASK) -#define LA_TRIGGERA_DATA_MATCH_RESET 18'h0 -#define LA_TRIGGERA_DATA_RESET (32'h0 | \ - LA_TRIGGERA_DATA_MATCH_SET(LA_TRIGGERA_DATA_MATCH_RESET)) -#define LA_TRIGGERA_DATA_HW_MASK (32'h0) -#define LA_TRIGGERA_DATA_SW_MASK (32'h0 | \ - LA_TRIGGERA_DATA_MATCH_MASK) - -#define LA_TRIGGERA_WILDCARD_ADDRESS 'h000000b4 -#define LA_TRIGGERA_WILDCARD_MATCH_MSB 17 -#define LA_TRIGGERA_WILDCARD_MATCH_LSB 0 -#define LA_TRIGGERA_WILDCARD_MATCH_MASK 'h0003ffff -#define LA_TRIGGERA_WILDCARD_MATCH_GET(x) (((x) & LA_TRIGGERA_WILDCARD_MATCH_MASK) >> LA_TRIGGERA_WILDCARD_MATCH_LSB) -#define LA_TRIGGERA_WILDCARD_MATCH_SET(x) (((32'd0 | (x)) << LA_TRIGGERA_WILDCARD_MATCH_LSB) & LA_TRIGGERA_WILDCARD_MATCH_MASK) -#define LA_TRIGGERA_WILDCARD_MATCH_RESET 18'h0 -#define LA_TRIGGERA_WILDCARD_RESET (32'h0 | \ - LA_TRIGGERA_WILDCARD_MATCH_SET(LA_TRIGGERA_WILDCARD_MATCH_RESET)) -#define LA_TRIGGERA_WILDCARD_HW_MASK (32'h0) -#define LA_TRIGGERA_WILDCARD_SW_MASK (32'h0 | \ - LA_TRIGGERA_WILDCARD_MATCH_MASK) - -#define LA_TRIGGERB_DATA_ADDRESS 'h000000b8 -#define LA_TRIGGERB_DATA_MATCH_MSB 17 -#define LA_TRIGGERB_DATA_MATCH_LSB 0 -#define LA_TRIGGERB_DATA_MATCH_MASK 'h0003ffff -#define LA_TRIGGERB_DATA_MATCH_GET(x) (((x) & LA_TRIGGERB_DATA_MATCH_MASK) >> LA_TRIGGERB_DATA_MATCH_LSB) -#define LA_TRIGGERB_DATA_MATCH_SET(x) (((32'd0 | (x)) << LA_TRIGGERB_DATA_MATCH_LSB) & LA_TRIGGERB_DATA_MATCH_MASK) -#define LA_TRIGGERB_DATA_MATCH_RESET 18'h0 -#define LA_TRIGGERB_DATA_RESET (32'h0 | \ - LA_TRIGGERB_DATA_MATCH_SET(LA_TRIGGERB_DATA_MATCH_RESET)) -#define LA_TRIGGERB_DATA_HW_MASK (32'h0) -#define LA_TRIGGERB_DATA_SW_MASK (32'h0 | \ - LA_TRIGGERB_DATA_MATCH_MASK) - -#define LA_TRIGGERB_WILDCARD_ADDRESS 'h000000bc -#define LA_TRIGGERB_WILDCARD_MATCH_MSB 17 -#define LA_TRIGGERB_WILDCARD_MATCH_LSB 0 -#define LA_TRIGGERB_WILDCARD_MATCH_MASK 'h0003ffff -#define LA_TRIGGERB_WILDCARD_MATCH_GET(x) (((x) & LA_TRIGGERB_WILDCARD_MATCH_MASK) >> LA_TRIGGERB_WILDCARD_MATCH_LSB) -#define LA_TRIGGERB_WILDCARD_MATCH_SET(x) (((32'd0 | (x)) << LA_TRIGGERB_WILDCARD_MATCH_LSB) & LA_TRIGGERB_WILDCARD_MATCH_MASK) -#define LA_TRIGGERB_WILDCARD_MATCH_RESET 18'h0 -#define LA_TRIGGERB_WILDCARD_RESET (32'h0 | \ - LA_TRIGGERB_WILDCARD_MATCH_SET(LA_TRIGGERB_WILDCARD_MATCH_RESET)) -#define LA_TRIGGERB_WILDCARD_HW_MASK (32'h0) -#define LA_TRIGGERB_WILDCARD_SW_MASK (32'h0 | \ - LA_TRIGGERB_WILDCARD_MATCH_MASK) - -#define LA_TRIGGER_ADDRESS 'h000000c0 -#define LA_TRIGGER_EVENT_MSB 2 -#define LA_TRIGGER_EVENT_LSB 0 -#define LA_TRIGGER_EVENT_MASK 'h00000007 -#define LA_TRIGGER_EVENT_GET(x) (((x) & LA_TRIGGER_EVENT_MASK) >> LA_TRIGGER_EVENT_LSB) -#define LA_TRIGGER_EVENT_SET(x) (((32'd0 | (x)) << LA_TRIGGER_EVENT_LSB) & LA_TRIGGER_EVENT_MASK) -#define LA_TRIGGER_EVENT_RESET 3'h0 -#define LA_TRIGGER_RESET (32'h0 | \ - LA_TRIGGER_EVENT_SET(LA_TRIGGER_EVENT_RESET)) -#define LA_TRIGGER_HW_MASK (32'h0) -#define LA_TRIGGER_SW_MASK (32'h0 | \ - LA_TRIGGER_EVENT_MASK) - -#define LA_FIFO_ADDRESS 'h000000c4 -#define LA_FIFO_FULL_MSB 1 -#define LA_FIFO_FULL_LSB 1 -#define LA_FIFO_FULL_MASK 'h00000002 -#define LA_FIFO_FULL_GET(x) (((x) & LA_FIFO_FULL_MASK) >> LA_FIFO_FULL_LSB) -#define LA_FIFO_FULL_SET(x) (((32'd0 | (x)) << LA_FIFO_FULL_LSB) & LA_FIFO_FULL_MASK) -#define LA_FIFO_FULL_RESET 1'h0 -#define LA_FIFO_EMPTY_MSB 0 -#define LA_FIFO_EMPTY_LSB 0 -#define LA_FIFO_EMPTY_MASK 'h00000001 -#define LA_FIFO_EMPTY_GET(x) (((x) & LA_FIFO_EMPTY_MASK) >> LA_FIFO_EMPTY_LSB) -#define LA_FIFO_EMPTY_SET(x) (((32'd0 | (x)) << LA_FIFO_EMPTY_LSB) & LA_FIFO_EMPTY_MASK) -#define LA_FIFO_EMPTY_RESET 1'h0 -#define LA_FIFO_RESET (32'h0 | \ - LA_FIFO_FULL_SET(LA_FIFO_FULL_RESET) | \ - LA_FIFO_EMPTY_SET(LA_FIFO_EMPTY_RESET)) -#define LA_FIFO_HW_MASK (32'h0 | \ - LA_FIFO_FULL_MASK | \ - LA_FIFO_EMPTY_MASK) -#define LA_FIFO_SW_MASK (32'h0) - -#define LA_ADDRESS 'h000000c8 -#define LA_DATA_MSB 17 -#define LA_DATA_LSB 0 -#define LA_DATA_MASK 'h0003ffff -#define LA_DATA_GET(x) (((x) & LA_DATA_MASK) >> LA_DATA_LSB) -#define LA_DATA_SET(x) (((32'd0 | (x)) << LA_DATA_LSB) & LA_DATA_MASK) -#define LA_DATA_RESET 18'h0 -#define LA_RESET (32'h0 | \ - LA_DATA_SET(LA_DATA_RESET)) -#define LA_HW_MASK (32'h0 | \ - LA_DATA_MASK) -#define LA_SW_MASK (32'h0) - -#define ANT_PIN_ADDRESS 'h000000d0 -#define ANT_PIN_PAD_PULL_MSB 3 -#define ANT_PIN_PAD_PULL_LSB 2 -#define ANT_PIN_PAD_PULL_MASK 'h0000000c -#define ANT_PIN_PAD_PULL_GET(x) (((x) & ANT_PIN_PAD_PULL_MASK) >> ANT_PIN_PAD_PULL_LSB) -#define ANT_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << ANT_PIN_PAD_PULL_LSB) & ANT_PIN_PAD_PULL_MASK) -#define ANT_PIN_PAD_PULL_RESET 2'h2 -#define ANT_PIN_PAD_STRENGTH_MSB 1 -#define ANT_PIN_PAD_STRENGTH_LSB 0 -#define ANT_PIN_PAD_STRENGTH_MASK 'h00000003 -#define ANT_PIN_PAD_STRENGTH_GET(x) (((x) & ANT_PIN_PAD_STRENGTH_MASK) >> ANT_PIN_PAD_STRENGTH_LSB) -#define ANT_PIN_PAD_STRENGTH_SET(x) (((32'd0 | (x)) << ANT_PIN_PAD_STRENGTH_LSB) & ANT_PIN_PAD_STRENGTH_MASK) -#define ANT_PIN_PAD_STRENGTH_RESET 2'h1 -#define ANT_PIN_RESET (32'h0 | \ - ANT_PIN_PAD_PULL_SET(ANT_PIN_PAD_PULL_RESET) | \ - ANT_PIN_PAD_STRENGTH_SET(ANT_PIN_PAD_STRENGTH_RESET)) -#define ANT_PIN_HW_MASK (32'h0) -#define ANT_PIN_SW_MASK (32'h0 | \ - ANT_PIN_PAD_PULL_MASK | \ - ANT_PIN_PAD_STRENGTH_MASK) - -#define ANTD_PIN_ADDRESS 'h000000d4 -#define ANTD_PIN_PAD_PULL_MSB 1 -#define ANTD_PIN_PAD_PULL_LSB 0 -#define ANTD_PIN_PAD_PULL_MASK 'h00000003 -#define ANTD_PIN_PAD_PULL_GET(x) (((x) & ANTD_PIN_PAD_PULL_MASK) >> ANTD_PIN_PAD_PULL_LSB) -#define ANTD_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << ANTD_PIN_PAD_PULL_LSB) & ANTD_PIN_PAD_PULL_MASK) -#define ANTD_PIN_PAD_PULL_RESET 2'h1 -#define ANTD_PIN_RESET (32'h0 | \ - ANTD_PIN_PAD_PULL_SET(ANTD_PIN_PAD_PULL_RESET)) -#define ANTD_PIN_HW_MASK (32'h0) -#define ANTD_PIN_SW_MASK (32'h0 | \ - ANTD_PIN_PAD_PULL_MASK) - -#define GPIO_PIN_ADDRESS 'h000000d8 -#define GPIO_PIN_PAD_PULL_MSB 3 -#define GPIO_PIN_PAD_PULL_LSB 2 -#define GPIO_PIN_PAD_PULL_MASK 'h0000000c -#define GPIO_PIN_PAD_PULL_GET(x) (((x) & GPIO_PIN_PAD_PULL_MASK) >> GPIO_PIN_PAD_PULL_LSB) -#define GPIO_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << GPIO_PIN_PAD_PULL_LSB) & GPIO_PIN_PAD_PULL_MASK) -#define GPIO_PIN_PAD_PULL_RESET 2'h2 -#define GPIO_PIN_PAD_STRENGTH_MSB 1 -#define GPIO_PIN_PAD_STRENGTH_LSB 0 -#define GPIO_PIN_PAD_STRENGTH_MASK 'h00000003 -#define GPIO_PIN_PAD_STRENGTH_GET(x) (((x) & GPIO_PIN_PAD_STRENGTH_MASK) >> GPIO_PIN_PAD_STRENGTH_LSB) -#define GPIO_PIN_PAD_STRENGTH_SET(x) (((32'd0 | (x)) << GPIO_PIN_PAD_STRENGTH_LSB) & GPIO_PIN_PAD_STRENGTH_MASK) -#define GPIO_PIN_PAD_STRENGTH_RESET 2'h1 -#define GPIO_PIN_RESET (32'h0 | \ - GPIO_PIN_PAD_PULL_SET(GPIO_PIN_PAD_PULL_RESET) | \ - GPIO_PIN_PAD_STRENGTH_SET(GPIO_PIN_PAD_STRENGTH_RESET)) -#define GPIO_PIN_HW_MASK (32'h0) -#define GPIO_PIN_SW_MASK (32'h0 | \ - GPIO_PIN_PAD_PULL_MASK | \ - GPIO_PIN_PAD_STRENGTH_MASK) - -#define GPIO_H_PIN_ADDRESS 'h000000dc -#define GPIO_H_PIN_PAD_PULL_MSB 1 -#define GPIO_H_PIN_PAD_PULL_LSB 0 -#define GPIO_H_PIN_PAD_PULL_MASK 'h00000003 -#define GPIO_H_PIN_PAD_PULL_GET(x) (((x) & GPIO_H_PIN_PAD_PULL_MASK) >> GPIO_H_PIN_PAD_PULL_LSB) -#define GPIO_H_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << GPIO_H_PIN_PAD_PULL_LSB) & GPIO_H_PIN_PAD_PULL_MASK) -#define GPIO_H_PIN_PAD_PULL_RESET 2'h0 -#define GPIO_H_PIN_RESET (32'h0 | \ - GPIO_H_PIN_PAD_PULL_SET(GPIO_H_PIN_PAD_PULL_RESET)) -#define GPIO_H_PIN_HW_MASK (32'h0) -#define GPIO_H_PIN_SW_MASK (32'h0 | \ - GPIO_H_PIN_PAD_PULL_MASK) - -#define BT_PIN_ADDRESS 'h000000e0 -#define BT_PIN_PAD_PULL_MSB 3 -#define BT_PIN_PAD_PULL_LSB 2 -#define BT_PIN_PAD_PULL_MASK 'h0000000c -#define BT_PIN_PAD_PULL_GET(x) (((x) & BT_PIN_PAD_PULL_MASK) >> BT_PIN_PAD_PULL_LSB) -#define BT_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << BT_PIN_PAD_PULL_LSB) & BT_PIN_PAD_PULL_MASK) -#define BT_PIN_PAD_PULL_RESET 2'h0 -#define BT_PIN_PAD_STRENGTH_MSB 1 -#define BT_PIN_PAD_STRENGTH_LSB 0 -#define BT_PIN_PAD_STRENGTH_MASK 'h00000003 -#define BT_PIN_PAD_STRENGTH_GET(x) (((x) & BT_PIN_PAD_STRENGTH_MASK) >> BT_PIN_PAD_STRENGTH_LSB) -#define BT_PIN_PAD_STRENGTH_SET(x) (((32'd0 | (x)) << BT_PIN_PAD_STRENGTH_LSB) & BT_PIN_PAD_STRENGTH_MASK) -#define BT_PIN_PAD_STRENGTH_RESET 2'h1 -#define BT_PIN_RESET (32'h0 | \ - BT_PIN_PAD_PULL_SET(BT_PIN_PAD_PULL_RESET) | \ - BT_PIN_PAD_STRENGTH_SET(BT_PIN_PAD_STRENGTH_RESET)) -#define BT_PIN_HW_MASK (32'h0) -#define BT_PIN_SW_MASK (32'h0 | \ - BT_PIN_PAD_PULL_MASK | \ - BT_PIN_PAD_STRENGTH_MASK) - -#define BT_WLAN_PIN_ADDRESS 'h000000e4 -#define BT_WLAN_PIN_PAD_PULL_MSB 1 -#define BT_WLAN_PIN_PAD_PULL_LSB 0 -#define BT_WLAN_PIN_PAD_PULL_MASK 'h00000003 -#define BT_WLAN_PIN_PAD_PULL_GET(x) (((x) & BT_WLAN_PIN_PAD_PULL_MASK) >> BT_WLAN_PIN_PAD_PULL_LSB) -#define BT_WLAN_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << BT_WLAN_PIN_PAD_PULL_LSB) & BT_WLAN_PIN_PAD_PULL_MASK) -#define BT_WLAN_PIN_PAD_PULL_RESET 2'h2 -#define BT_WLAN_PIN_RESET (32'h0 | \ - BT_WLAN_PIN_PAD_PULL_SET(BT_WLAN_PIN_PAD_PULL_RESET)) -#define BT_WLAN_PIN_HW_MASK (32'h0) -#define BT_WLAN_PIN_SW_MASK (32'h0 | \ - BT_WLAN_PIN_PAD_PULL_MASK) - -#define SI_UART_PIN_ADDRESS 'h000000e8 -#define SI_UART_PIN_PAD_PULL_MSB 3 -#define SI_UART_PIN_PAD_PULL_LSB 2 -#define SI_UART_PIN_PAD_PULL_MASK 'h0000000c -#define SI_UART_PIN_PAD_PULL_GET(x) (((x) & SI_UART_PIN_PAD_PULL_MASK) >> SI_UART_PIN_PAD_PULL_LSB) -#define SI_UART_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << SI_UART_PIN_PAD_PULL_LSB) & SI_UART_PIN_PAD_PULL_MASK) -#define SI_UART_PIN_PAD_PULL_RESET 2'h1 -#define SI_UART_PIN_PAD_STRENGTH_MSB 1 -#define SI_UART_PIN_PAD_STRENGTH_LSB 0 -#define SI_UART_PIN_PAD_STRENGTH_MASK 'h00000003 -#define SI_UART_PIN_PAD_STRENGTH_GET(x) (((x) & SI_UART_PIN_PAD_STRENGTH_MASK) >> SI_UART_PIN_PAD_STRENGTH_LSB) -#define SI_UART_PIN_PAD_STRENGTH_SET(x) (((32'd0 | (x)) << SI_UART_PIN_PAD_STRENGTH_LSB) & SI_UART_PIN_PAD_STRENGTH_MASK) -#define SI_UART_PIN_PAD_STRENGTH_RESET 2'h1 -#define SI_UART_PIN_RESET (32'h0 | \ - SI_UART_PIN_PAD_PULL_SET(SI_UART_PIN_PAD_PULL_RESET) | \ - SI_UART_PIN_PAD_STRENGTH_SET(SI_UART_PIN_PAD_STRENGTH_RESET)) -#define SI_UART_PIN_HW_MASK (32'h0) -#define SI_UART_PIN_SW_MASK (32'h0 | \ - SI_UART_PIN_PAD_PULL_MASK | \ - SI_UART_PIN_PAD_STRENGTH_MASK) - -#define CLK32K_PIN_ADDRESS 'h000000ec -#define CLK32K_PIN_PAD_PULL_MSB 1 -#define CLK32K_PIN_PAD_PULL_LSB 0 -#define CLK32K_PIN_PAD_PULL_MASK 'h00000003 -#define CLK32K_PIN_PAD_PULL_GET(x) (((x) & CLK32K_PIN_PAD_PULL_MASK) >> CLK32K_PIN_PAD_PULL_LSB) -#define CLK32K_PIN_PAD_PULL_SET(x) (((32'd0 | (x)) << CLK32K_PIN_PAD_PULL_LSB) & CLK32K_PIN_PAD_PULL_MASK) -#define CLK32K_PIN_PAD_PULL_RESET 2'h0 -#define CLK32K_PIN_RESET (32'h0 | \ - CLK32K_PIN_PAD_PULL_SET(CLK32K_PIN_PAD_PULL_RESET)) -#define CLK32K_PIN_HW_MASK (32'h0) -#define CLK32K_PIN_SW_MASK (32'h0 | \ - CLK32K_PIN_PAD_PULL_MASK) - -#define RESET_TUPLE_STATUS_ADDRESS 'h000000f0 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MSB 11 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB 8 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK 'h00000f00 -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_GET(x) (((x) & RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK) >> RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB) -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_SET(x) (((32'd0 | (x)) << RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB) & RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK) -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_RESET 4'h0 -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MSB 7 -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB 0 -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK 'h000000ff -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_GET(x) (((x) & RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK) >> RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB) -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_SET(x) (((32'd0 | (x)) << RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB) & RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK) -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_RESET 8'h0 -#define RESET_TUPLE_STATUS_RESET (32'h0 | \ - RESET_TUPLE_STATUS_TEST_RESET_TUPLE_SET(RESET_TUPLE_STATUS_TEST_RESET_TUPLE_RESET) | \ - RESET_TUPLE_STATUS_PIN_RESET_TUPLE_SET(RESET_TUPLE_STATUS_PIN_RESET_TUPLE_RESET)) -#define RESET_TUPLE_STATUS_HW_MASK (32'h0 | \ - RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK | \ - RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK) -#define RESET_TUPLE_STATUS_SW_MASK (32'h0) - -#define GPIO_REG_ADDRESS_MSB 7 - -#endif /* _GPIO_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mac_pcu.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mac_pcu.h deleted file mode 100644 index 6a07583b91b8..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mac_pcu.h +++ /dev/null @@ -1,980 +0,0 @@ -#ifndef _MAC_PCU_H -#define _MAC_PCU_H - -#define FIFO_BOUND 1024 - -#define CLK32_TIMER0 0 -#define CLK32_TIMER1 1 -#define CLK32_TIMER2 2 -#define CLK32_TIMER3 3 -#define CLK32_TSF_L32 4 -#define CLK32_TSF_U32 5 -#define CLK32_SLP1 6 -#define CLK32_SLP2 7 -#define CLK32_SLP3 8 -#define CLK32_QT1 9 -#define CLK32_QT2 10 -//#define CLK32_TSFCAL 11 - -//#define CLK_S_SYNC1 0 -//#define CLK_S_SYNC6 1 -//#define CLK_S_SYNC7 2 -//#define CLK_S_SYNC8 3 - -#define KTYPE_40 0 -#define KTYPE_104 1 -#define KTYPE_TKIP_NO_MIC 2 -#define KTYPE_128 3 -#define KTYPE_TKIP 4 -//#define KTYPE_AES_OCB 5 -#define KTYPE_WAPI 5 -#define KTYPE_AES_CCM 6 -#define KTYPE_NOTHING 7 - -//Frame Type in Descriptor -#define TXDESC_FT_NORMAL 0 -#define TXDESC_FT_ATIM 1 -#define TXDESC_FT_PS_POLL 2 -#define TXDESC_FT_BEACON 3 -#define TXDESC_FT_PROBE_RESP 4 -#define TXDESC_FT_CHIRP 5 -#define TXDESC_FT_GROUP_POLL 6 -#define TXDESC_FT_DIRECT_POLL 7 -//#define TXDESC_FT_SYNC 8 -#define TXDESC_FT_BEACON_NO_TSF_UPDATE 9 - -//Frame Type: Management -#define FTYPE_ASSOCIATION_REQ 0x00 -#define FTYPE_ASSOCIATION_RES 0x04 -#define FTYPE_REASSOCIATION_REQ 0x08 -#define FTYPE_REASSOCIATION_RES 0x0c -#define FTYPE_PBREQ 0x10 // change to TYPE_PROBE_REQ TBD -#define FTYPE_PBRES 0x14 // change to TYPE_PROBE_RES TBD -#define FTYPE_BEACON 0x20 -#define FTYPE_ATIM 0x24 -#define FTYPE_DISASSOCIATE 0x28 -#define FTYPE_AUTHENICATE 0x2c -#define FTYPE_DEAUTHENICATE 0x30 - -//Frame Type: Control -#define FTYPE_PSPOLL 0x29 -#define FTYPE_RTS 0x2d -#define FTYPE_CTS 0x31 -#define FTYPE_ACK 0x35 -#define FTYPE_CFEND 0x39 -#define FTYPE_CFEND_ACK 0x3d // change to FTYPE_CFEND_ACK TBD - -//Frame Type: Data -#define FTYPE_DATA 0x02 -#define FTYPE_DATA_CFACK 0x06 -#define FTYPE_DATA_CFPOLL 0x0a -#define FTYPE_DATA_CFACK_CFPOLL 0x0e -#define FTYPE_NULL 0x12 -#define FTYPE_CFACK 0x16 -#define FTYPE_CFPOLL 0x1a -#define FTYPE_CFACK_CFPOLL 0x1e - -//Frame Control Fields -#define FCTL_TO_DS 8 -#define FCTL_FROM_DS 9 -#define FCTL_MORE_FRAG 10 -#define FCTL_RETRY 11 -#define FCTL_POWER_MGNT 12 -#define FCTL_MORE_DATA 13 -#define FCTL_WEP 14 -#define FCTL_TYPE 3:2 - -//Rate -#define OFDM_RATE_6Mb 0x0b -#define OFDM_RATE_9Mb 0x0f -#define OFDM_RATE_12Mb 0x0a -#define OFDM_RATE_18Mb 0x0e -#define OFDM_RATE_24Mb 0x09 -#define OFDM_RATE_36Mb 0x0d -#define OFDM_RATE_48Mb 0x08 -#define OFDM_RATE_54Mb 0x0c -#define CCK_RATE_1Mb_L 0x1b -#define CCK_RATE_2Mb_L 0x1a -#define CCK_RATE_2Mb_S 0x1e -#define CCK_RATE_5_5Mb_L 0x19 -#define CCK_RATE_5_5Mb_S 0x1d -#define CCK_RATE_11Mb_L 0x18 - -#define CCK_RATE_11Mb_S 0x1c -#define XR_RATE_0_25Mb 0x03 -#define XR_RATE_0_5Mb 0x07 -#define XR_RATE_1Mb 0x02 -#define XR_RATE_2Mb 0x06 -#define XR_RATE_3Mb 0x01 - -//Registers -#define PCU_REG 0x0 -#define KEY_REG 0x1 -#define D2A2_REG 0x3 - -#define REG_STA_ID0 0x0 -#define STA_ADDR_L32 31:0 - -#define REG_STA_ID1 0x1 -#define STA_ADDR_U16 15:0 -#define AP 16 -#define ADHOC 17 -#define PWR_SV 18 -#define NO_KEYSRCH 19 -#define PCF 20 -#define USE_DEF_ANT 21 -#define DEF_ANT_UPDATE 22 -#define RTS_DEF_ANT 23 -#define ACKCTS_6MB 24 -#define RATE_11B 25 -#define SECTOR_SELF_GEN 26 -#define CRPT_MIC_ENABLE 27 -#define KSRCH_MODE 28 -#define PRESERVE_SEQNUM 29 -#define CBCIV_ENDIAN 30 -#define ADHOC_MCAST_SEARCH 31 - -#define REG_BSS_ID0 0x2 -#define BSSID_L32 31:0 - -#define REG_BSS_ID1 0x3 -#define BSSID_U16 15:0 -#define AID 31:16 - -#define MAC_PCU_REG_BCNRSSI_OFFSET 0x4 -#define MAC_PCU_REG_BCNRSSI_BCN_RSSI_AVE_FIELD 11:0 -#define MAC_PCU_REG_BCNRSSI_BCN_RSSI_AVE_RESET 0x800 - -#define REG_TIME_OUT 0x5 -#define ACK_TIME_OUT 15:0 -#define CTS_TIME_OUT 31:16 - -#define MAC_PCU_REG_BCNSIG_OFFSET 0x6 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_LO_THR_FIELD 7:0 -#define MAC_PCU_REG_BCNSIG_BCN_MISS_THR_FIELD 15:8 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_HI_THR_FIELD 23:16 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_WEIGHT_FIELD 28:24 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_RESET_FIELD 29 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_LO_THR_RESET 0 -#define MAC_PCU_REG_BCNSIG_BCN_MISS_THR_RESET 0xFF -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_HI_THR_RESET 0x7F -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_WEIGHT_RESET 0 - -#define REG_USEC 0x7 -#define USEC 6:0 -#define USEC32 13:7 -#define TX_DELAY 18:14 -#define RX_DELAY 24:19 - -#define REG_BEACON 0x8 -#define BEACON_PERIOD 15:0 -#define TIM_OFFSET 22:16 -#define RESET_TSF 24 - -#define REG_CFP_PERIOD 0x9 - -#define REG_TIMER0 0xa - -#define REG_TIMER1 0xb - -#define REG_TIMER2 0xc - -#define REG_TIMER3 0xd - -#define REG_CFP_DUR 0xe - -#define REG_RX_FILTER 0xf -#define UNICAST 0 -#define MULTICAST 1 -#define BROADCAST 2 -#define CONTROL 3 -#define BEACON 4 -#define PROMISCUOUS 5 -#define XR_POLL 6 -#define PROBE_REQ 7 -//#define SYNC 8 -#define MY_BEACON 9 - -#define REG_MCAST_FIL0 0x10 - -#define REG_MCAST_FIL1 0x11 - -#define MAC_PCU_REG_DIAGSW_OFFSET 0x12 -#define MAC_PCU_REG_DIAGSW_DIS_WEP_ACK_FIELD 0 -#define MAC_PCU_REG_DIAGSW_DIS_ACK_FIELD 1 -#define MAC_PCU_REG_DIAGSW_DIS_CTS_FIELD 2 -#define MAC_PCU_REG_DIAGSW_DIS_ENC_FIELD 3 -#define MAC_PCU_REG_DIAGSW_DIS_DEC_FIELD 4 -#define MAC_PCU_REG_DIAGSW_DIS_RX_FIELD 5 -#define MAC_PCU_REG_DIAGSW_LOOP_BACK_FIELD 6 -#define MAC_PCU_REG_DIAGSW_CORR_FCS_FIELD 7 -#define MAC_PCU_REG_DIAGSW_CHAN_INFO_FIELD 8 -#define MAC_PCU_REG_DIAGSW_RESERVED_FIELD 16:9 -#define MAC_PCU_REG_DIAGSW_ACCEPT_NONV0_FIELD 17 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_0_1_FIELD 19:18 -#define MAC_PCU_REG_DIAGSW_RXCLR_HIGH_FIELD 20 -#define MAC_PCU_REG_DIAGSW_IGNORE_NAV_FIELD 21 -#define MAC_PCU_REG_DIAGSW_CHANIDLE_HIGH_FIELD 22 -#define MAC_PCU_REG_DIAGSW_PHYERR_ENABLE_NEW_FIELD 23 -#define MAC_PCU_REG_DIAGSW_DUAL_CHAIN_CHAN_INFO_FIELD 24 -#define MAC_PCU_REG_DIAGSW_FORCE_RX_ABORT_FIELD 25 -#define MAC_PCU_REG_DIAGSW_SATURATE_CYCLE_CNT_FIELD 26 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_2_FIELD 27 -#define MAC_PCU_REG_DIAGSW_DIS_WEP_ACK_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_ACK_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_CTS_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_ENC_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_DEC_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_RX_RESET 0 -#define MAC_PCU_REG_DIAGSW_LOOP_BACK_RESET 0 -#define MAC_PCU_REG_DIAGSW_CORR_FCS_RESET 0 -#define MAC_PCU_REG_DIAGSW_CHAN_INFO_RESET 0 -#define MAC_PCU_REG_DIAGSW_RESERVED_RESET 0 -#define MAC_PCU_REG_DIAGSW_ACCEPT_NONV0_RESET 0 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_0_1_RESET 0 -#define MAC_PCU_REG_DIAGSW_RXCLR_HIGH_RESET 0 -#define MAC_PCU_REG_DIAGSW_IGNORE_NAV_RESET 0 -#define MAC_PCU_REG_DIAGSW_CHANIDLE_HIGH_RESET 0 -#define MAC_PCU_REG_DIAGSW_PHYERR_ENABLE_NEW_RESET 0 -#define MAC_PCU_REG_DIAGSW_DUAL_CHAIN_CHAN_INFO_RESET 0 -#define MAC_PCU_REG_DIAGSW_FORCE_RX_ABORT_RESET 0 -#define MAC_PCU_REG_DIAGSW_SATURATE_CYCLE_CNT_RESET 0 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_2_RESET 0 - -#define REG_TSF_L32 0x13 - -#define REG_TSF_U32 0x14 - -#define REG_TST_ADDAC 0x15 -#define TEST_MODE 0 -#define TEST_LOOP 1 -#define LOOP_LEN 12:2 -#define TEST_UPPER_8B 13 -#define TEST_MSB 14 -#define TEST_CAPTURE 15 - -#define REG_DEF_ANT 0x16 - -#define MAC_PCU_REG_MUTE_MASKS0_OFFSET 0x17 -#define MAC_PCU_REG_MUTE_MASKS0_FC_FIELD 15:0 -#define MAC_PCU_REG_MUTE_MASKS0_QOS_FIELD 31:16 -#define MAC_PCU_REG_MUTE_MASKS0_FC_RESET 0xC7FF -#define MAC_PCU_REG_MUTE_MASKS0_QOS_RESET 0xFFFF - -#define MAC_PCU_REG_MUTE_MASKS1_OFFSET 0x18 -#define MAC_PCU_REG_MUTE_MASKS1_SEQ_FIELD 15:0 -#define MAC_PCU_REG_MUTE_MASKS1_FC_MGMT_FIELD 31:16 -#define MAC_PCU_REG_MUTE_MASKS1_SEQ_RESET 0x000F -#define MAC_PCU_REG_MUTE_MASKS1_FC_MGMT_RESET 0xE7FF - -#define MAC_PCU_REG_GATED_CLKS_OFFSET 0x19 -//#define MAC_PCU_REG_GATED_SYNC_FIELD 0 -#define MAC_PCU_REG_GATED_TX_FIELD 1 -#define MAC_PCU_REG_GATED_RX_FIELD 2 -#define MAC_PCU_REG_GATED_REG_FIELD 3 -//#define MAC_PCU_REG_GATED_SYNC_RESET 0x1 -#define MAC_PCU_REG_GATED_TX_RESET 0x0 -#define MAC_PCU_REG_GATED_RX_RESET 0x0 -#define MAC_PCU_REG_GATED_REG_RESET 0x0 - -#define MAC_PCU_REG_OBS2_OFFSET 0x1a -#define MAC_PCU_REG_OBS2_OBS_BUS_FIELD 17:0 - -#define MAC_PCU_REG_OBS1_OFFSET 0x1b -#define MAC_PCU_REG_OBS1_TX_STATE_FIELD 28:24 -#define MAC_PCU_REG_OBS1_RX_STATE_FIELD 23:20 -#define MAC_PCU_REG_OBS1_WEP_STATE_FIELD 17:12 -#define MAC_PCU_REG_OBS1_RX_CLEAR_FIELD 11 -#define MAC_PCU_REG_OBS1_RX_FRAME_FIELD 10 -#define MAC_PCU_REG_OBS1_TX_FRAME_FIELD 9 -#define MAC_PCU_REG_OBS1_TX_HOLD_FIELD 8 -#define MAC_PCU_REG_OBS1_CHAN_IDLE_FIELD 7 -#define MAC_PCU_REG_OBS1_QUIET_TIME_FIELD 6 -#define MAC_PCU_REG_OBS1_TX_HCF_FIELD 5 -#define MAC_PCU_REG_OBS1_FILTER_PASS_FIELD 4 -#define MAC_PCU_REG_OBS1_RX_MY_BEACON_FIELD 3 -#define MAC_PCU_REG_OBS1_RX_WEP_FIELD 2 -#define MAC_PCU_REG_OBS1_PCU_RX_END_FIELD 1 -#define MAC_PCU_REG_OBS1_PCU_DIRECTED_FIELD 0 - -#define REG_LAST_TSTP 0x20 - -#define REG_NAV 0x21 - -#define REG_RTS_OK 0x22 - -#define REG_RTS_FAIL 0x23 - -#define REG_ACK_FAIL 0x24 - -#define REG_FCS_FAIL 0x25 - -#define REG_BEACON_CNT 0x26 - -#define MAC_PCU_REG_XRMODE_OFFSET 0x30 -#define MAC_PCU_REG_XRMODE_XR_POLL_TYPE_FIELD 5:0 -#define MAC_PCU_REG_XRMODE_XR_WAIT_FOR_POLL_FIELD 7 -#define MAC_PCU_REG_XRMODE_XR_FRAME_HOLD_FIELD 31:20 -#define MAC_PCU_REG_XRMODE_XR_POLL_TYPE_RESET 0x1A -#define MAC_PCU_REG_XRMODE_XR_WAIT_FOR_POLL_RESET 0x0 -#define MAC_PCU_REG_XRMODE_XR_FRAME_HOLD_RESET 680 - -#define MAC_PCU_REG_XRDEL_OFFSET 0x31 -#define MAC_PCU_REG_XRDEL_XR_SLOT_DELAY_FIELD 15:0 -#define MAC_PCU_REG_XRDEL_XR_CHIRP_DATA_DELAY_FIELD 31:16 -#define MAC_PCU_REG_XRDEL_XR_SLOT_DELAY_RESET 360 -#define MAC_PCU_REG_XRDEL_XR_CHIRP_DATA_DELAY_RESET 1680 - -#define MAC_PCU_REG_XRTO_OFFSET 0x32 -#define MAC_PCU_REG_XRTO_XR_CHIRP_TIMEOUT_FIELD 15:0 -#define MAC_PCU_REG_XRTO_XR_POLL_TIMEOUT_FIELD 31:16 -#define MAC_PCU_REG_XRTO_XR_CHIRP_TIMEOUT_RESET 7200 -#define MAC_PCU_REG_XRTO_XR_POLL_TIMEOUT_RESET 5000 - -#define MAC_PCU_REG_XRCRP_OFFSET 0x33 -#define MAC_PCU_REG_XRCRP_XR_SEND_CHIRP_FIELD 0 -#define MAC_PCU_REG_XRCRP_XR_CHIRP_GAP_FIELD 31:16 -#define MAC_PCU_REG_XRCRP_XR_SEND_CHIRP_RESET 0x0 -#define MAC_PCU_REG_XRCRP_XR_CHIRP_GAP_RESET 500 - -#define MAC_PCU_REG_XRSTMP_OFFSET 0x34 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_FIELD 0 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_BSSID_FIELD 1 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_FIELD 2 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_BSSID_FIELD 3 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_DATA_FIELD 4 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_DATA_FIELD 5 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_THRESH_FIELD 15:8 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_THRESH_FIELD 23:16 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_RESET 0x0 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_BSSID_RESET 0x0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_RESET 0x0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_BSSID_RESET 0x0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_DATA_RESET 0x0 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_DATA_RESET 0x0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_THRESH_RESET 0x25 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_THRESH_RESET 0x25 - -#define MAC_PCU_REG_SLP1_OFFSET 0x35 -//#define MAC_PCU_REG_SLP1_NEXT_DTIM_FIELD 18:0 -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_EXT_FIELD 4:0 -#define MAC_PCU_REG_SLP1_ASSUME_DTIM_FIELD 19 -//#define MAC_PCU_REG_SLP1_ENH_SLEEP_ENABLE_FIELD 20 -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_FIELD 31:21 -// #define MAC_PCU_REG_SLP1_NEXT_DTIM_RESET 0x2aaaa -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_EXT_RESET 0x0 -#define MAC_PCU_REG_SLP1_ASSUME_DTIM_RESET 0x0 -//#define MAC_PCU_REG_SLP1_ENH_SLEEP_ENABLE_RESET 0x1 -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_RESET 5 - -#define MAC_PCU_REG_SLP2_OFFSET 0x36 -//#define MAC_PCU_REG_SLP2_NEXT_TIM_FIELD 18:0 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_EXT_FIELD 4:0 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_FIELD 31:21 -//#define MAC_PCU_REG_SLP2_NEXT_TIM_RESET 0x55555 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_EXT_RESET 0x0 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_RESET 2 - -//#define MAC_PCU_REG_SLP3_OFFSET 0x37 -//#define MAC_PCU_REG_SLP3_TIM_PERIOD_FIELD 15:0 -//#define MAC_PCU_REG_SLP3_DTIM_PERIOD_FIELD 31:16 -//#define MAC_PCU_REG_SLP3_TIM_PERIOD_RESET 2 -//#define MAC_PCU_REG_SLP3_DTIM_PERIOD_RESET 3 - -#define MAC_PCU_REG_BSSMSKL_OFFSET 0x38 -#define MAC_PCU_REG_BSSMSKL_BSSID_MASK_L_FIELD 31:0 -#define MAC_PCU_REG_BSSMSKL_BSSID_MASK_L_RESET 0xFFFFFFFF - -#define MAC_PCU_REG_BSSMSKH_OFFSET 0x39 -#define MAC_PCU_REG_BSSMSKH_BSSID_MASK_H_FIELD 15:0 -#define MAC_PCU_REG_BSSMSKH_BSSID_MASK_H_RESET 0xFFFF - -#define MAC_PCU_REG_TPC_OFFSET 0x3A -#define MAC_PCU_REG_TPC_ACK_PWR_FIELD 5:0 -#define MAC_PCU_REG_TPC_CTS_PWR_FIELD 13:8 -#define MAC_PCU_REG_TPC_CHIRP_PWR_FIELD 21:16 -#define MAC_PCU_REG_TPC_ACK_PWR_RESET 0x3f -#define MAC_PCU_REG_TPC_CTS_PWR_RESET 0x3f -#define MAC_PCU_REG_TPC_CHIRP_PWR_RESET 0x3f - -#define MAC_PCU_REG_TFC_OFFSET 0x3B -#define MAC_PCU_REG_TFC_TX_FRAME_CNT_FIELD 31:0 -#define MAC_PCU_REG_TFC_TX_FRAME_CNT_RESET 0 - -#define MAC_PCU_REG_RFC_OFFSET 0x3C -#define MAC_PCU_REG_RFC_RX_FRAME_CNT_FIELD 31:0 -#define MAC_PCU_REG_RFC_RX_FRAME_CNT_RESET 0 - -#define MAC_PCU_REG_RCC_OFFSET 0x3D -#define MAC_PCU_REG_RCC_RX_CLEAR_CNT_FIELD 31:0 -#define MAC_PCU_REG_RCC_RX_CLEAR_CNT_RESET 0 - -#define MAC_PCU_REG_CC_OFFSET 0x3E -#define MAC_PCU_REG_CC_CYCLE_CNT_FIELD 31:0 -#define MAC_PCU_REG_CC_CYCLE_CNT_RESET 0 - -#define MAC_PCU_REG_QT1_OFFSET 0x3F -#define MAC_PCU_REG_QT1_NEXT_QUIET_FIELD 15:0 -#define MAC_PCU_REG_QT1_QUIET_ENABLE_FIELD 16 -#define MAC_PCU_REG_QT1_QUIET_ACK_CTS_ENABLE_FIELD 17 -#define MAC_PCU_REG_QT1_NEXT_QUIET_RESET 0 -#define MAC_PCU_REG_QT1_QUIET_ENABLE_RESET 0x0 -#define MAC_PCU_REG_QT1_QUIET_ACK_CTS_ENABLE_RESET 0x1 - -#define MAC_PCU_REG_QT2_OFFSET 0x40 -#define MAC_PCU_REG_QT2_QUIET_PERIOD_FIELD 15:0 -#define MAC_PCU_REG_QT2_QUIET_DURATION_FIELD 31:16 -#define MAC_PCU_REG_QT2_QUIET_PERIOD_RESET 0002 -#define MAC_PCU_REG_QT2_QUIET_DURATION_RESET 0001 - -#define MAC_PCU_REG_TSF_OFFSET 0x41 -#define MAC_PCU_REG_TSF_INCREMENT_FIELD 7:0 -#define MAC_PCU_REG_TSF_INCREMENT_RESET 0x01 - -#define MAC_PCU_REG_NOACK_OFFSET 0x42 -#define MAC_PCU_REG_NOACK_2_BIT_VALUES_FIELD 3:0 -#define MAC_PCU_REG_NOACK_BIT_OFFSET_FIELD 6:4 -#define MAC_PCU_REG_NOACK_BYTE_OFFSET_FIELD 8:7 -#define MAC_PCU_REG_NOACK_2_BIT_VALUES_RESET 0x2 -#define MAC_PCU_REG_NOACK_BIT_OFFSET_RESET 0x5 -#define MAC_PCU_REG_NOACK_BYTE_OFFSET_RESET 0x0 - -#define MAC_PCU_REG_PHYERR_OFFSET 0x43 -#define MAC_PCU_REG_PHYERR_MASK_FIELD 31:0 -#define MAC_PCU_REG_PHYERR_MASK_RESET 0x0 - -#define MAC_PCU_REG_XRLAT_OFFSET 0x44 -#define MAC_PCU_REG_XRLAT_XR_TX_DELAY_FIELD 11:0 -#define MAC_PCU_REG_XRLAT_XR_TX_DELAY_RESET 0x168 - -#define MAC_PCU_REG_ACKSIFS_OFFSET_RESERVED 0x45 -#define MAC_PCU_REG_ACKSIFS_INCREMENT_FIELD_RESERVED 7:0 -#define MAC_PCU_REG_ACKSIFS_INCREMENT_RESET_RESERVED 0x0 - -#define MAC_PCU_REG_MICQOSCTL_OFFSET 0x46 -#define MAC_PCU_REG_MICQOSCTL_FIELD 15:0 -#define MAC_PCU_REG_MICQOSCTL_ENABLE_FIELD 16 -#define MAC_PCU_REG_MICQOSCTL_RESET 0x00aa -#define MAC_PCU_REG_MICQOSCTL_ENABLE_RESET 0x1 - -#define MAC_PCU_REG_MICQOSSEL_OFFSET 0x47 -#define MAC_PCU_REG_MICQOSSEL_FIELD 31:0 -#define MAC_PCU_REG_MICQOSSEL_RESET 0x00003210 - -#define MAC_PCU_REG_MISCMODE_OFFSET 0x48 -#define MAC_PCU_REG_MISCMODE_BSSID_MATCH_FORCE_FIELD 0 -#define MAC_PCU_REG_MISCMODE_ACKSIFS_MEMORY_FIELD_RESERVED 1 -#define MAC_PCU_REG_MISCMODE_MIC_NEW_LOCATION_FIELD 2 -#define MAC_PCU_REG_MISCMODE_TX_ADD_TSF_FIELD 3 -#define MAC_PCU_REG_MISCMODE_CCK_SIFS_MODE_FIELD 4 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MODE_FIELD_RESERVED 5 -#define MAC_PCU_REG_MISCMODE_BFCOEF_ENABLE_FIELD 6 -#define MAC_PCU_REG_MISCMODE_BFCOEF_UPDATE_SELF_GEN_FIELD 7 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MCAST_FIELD 8 -#define MAC_PCU_REG_MISCMODE_DUAL_CHAIN_ANT_MODE_FIELD 9 -#define MAC_PCU_REG_MISCMODE_FALCON_DESC_MODE_FIELD 10 -#define MAC_PCU_REG_MISCMODE_KC_RX_ANT_UPDATE_FIELD 11 -#define MAC_PCU_REG_MISCMODE_TXOP_TBTT_LIMIT_FIELD 12 -#define MAC_PCU_REG_MISCMODE_FALCON_BB_INTERFACE_FIELD 13 -#define MAC_PCU_REG_MISCMODE_MISS_BEACON_IN_SLEEP_FIELD 14 -#define MAC_PCU_REG_MISCMODE_BUG_12306_FIX_ENABLE_FIELD 17 -#define MAC_PCU_REG_MISCMODE_FORCE_QUIET_COLLISION_FIELD 18 -#define MAC_PCU_REG_MISCMODE_BUG_12549_FORCE_TXBF_FIELD 19 -#define MAC_PCU_REG_MISCMODE_BT_ANT_PREVENTS_RX_FIELD 20 -#define MAC_PCU_REG_MISCMODE_TBTT_PROTECT_FIELD 21 -#define MAC_PCU_REG_MISCMODE_HCF_POLL_CANCELS_NAV_FIELD 22 -#define MAC_PCU_REG_MISCMODE_RX_HCF_POLL_ENABLE_FIELD 23 -#define MAC_PCU_REG_MISCMODE_CLEAR_VMF_FIELD 24 -#define MAC_PCU_REG_MISCMODE_CLEAR_FIRST_HCF_FIELD 25 -#define MAC_PCU_REG_MISCMODE_ADHOC_MCAST_KEYID_ENABLE_FIELD 26 -#define MAC_PCU_REG_MISCMODE_ALLOW_RAC_FIELD 27 -#define MAC_PCU_REG_MISCMODE_BSSID_MATCH_FORCE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_ACKSIFS_MEMORY_RESET_RESERVED 0x0 -#define MAC_PCU_REG_MISCMODE_MIC_NEW_LOCATION_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_TX_ADD_TSF_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_CCK_SIFS_MODE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MODE_RESET_RESERVED 0x0 -#define MAC_PCU_REG_MISCMODE_BFCOEF_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_BFCOEF_UPDATE_SELF_GEN_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MCAST_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_DUAL_CHAIN_ANT_MODE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_FALCON_DESC_MODE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_KC_RX_ANT_UPDATE_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_TXOP_TBTT_LIMIT_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_FALCON_BB_INTERFACE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_MISS_BEACON_IN_SLEEP_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_BUG_12306_FIX_ENABLE_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_FORCE_QUIET_COLLISION_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_BUG_12549_FORCE_TXBF_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_BT_ANT_PREVENTS_RX_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_TBTT_PROTECT_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_HCF_POLL_CANCELS_NAV_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_RX_HCF_POLL_ENABLE_RESET 0x1 -#define MAC_PCU_REG_MISCMODE_CLEAR_VMF_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_CLEAR_FIRST_HCF_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_ADHOC_MCAST_KEYID_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE_ALLOW_RAC_RESET 0x0 - -#define MAC_PCU_REG_FILTOFDM_OFFSET 0x49 -#define MAC_PCU_REG_FILTOFDM_CNT_FIELD 23:0 -#define MAC_PCU_REG_FILTOFDM_CNT_RESET 0x0 - -#define MAC_PCU_REG_FILTCCK_OFFSET 0x4A -#define MAC_PCU_REG_FILTCCK_CNT_FIELD 23:0 -#define MAC_PCU_REG_FILTCCK_CNT_RESET 0x0 - -#define MAC_PCU_REG_PHYCNT1_OFFSET 0x4B -#define MAC_PCU_REG_PHYCNT1_FIELD 23:0 -#define MAC_PCU_REG_PHYCNT1_RESET 0x0 - -#define MAC_PCU_REG_PHYCNTMASK1_OFFSET 0x4C -#define MAC_PCU_REG_PHYCNTMASK1_FIELD 31:0 -#define MAC_PCU_REG_PHYCNTMASK1_RESET 0x0 - -#define MAC_PCU_REG_PHYCNT2_OFFSET 0x4D -#define MAC_PCU_REG_PHYCNT2_FIELD 23:0 -#define MAC_PCU_REG_PHYCNT2_RESET 0x0 - -#define MAC_PCU_REG_PHYCNTMASK2_OFFSET 0x4E -#define MAC_PCU_REG_PHYCNTMASK2_FIELD 31:0 -#define MAC_PCU_REG_PHYCNTMASK2_RESET 0x0 - -#define MAC_PCU_REG_TSFTHRESH_OFFSET 0x4F -#define MAC_PCU_REG_TSFTHRESH_FIELD 15:0 -#define MAC_PCU_REG_TSFTHRESH_RESET 0xFFFF - -//#define MAC_PCU_REG_TSFCAL_OFFSET 0x50 -//#define MAC_PCU_REG_TSFCAL_COUNT_FIELD 3:0 -//#define MAC_PCU_REG_TSFCAL_INTERVAL_FIELD 7:4 -//#define MAC_PCU_REG_TSFCAL_ENABLE_FIELD 8 -//#define MAC_PCU_REG_TSFCAL_AUTO_CAL_FIELD 9 -//#define MAC_PCU_REG_TSFCAL_VALUE_WE_FIELD 10 -//#define MAC_PCU_REG_TSFCAL_VALUE_FIELD 31:16 -//#define MAC_PCU_REG_TSFCAL_COUNT_RESET 0x8 -//#define MAC_PCU_REG_TSFCAL_INTERVAL_RESET 0xa -//#define MAC_PCU_REG_TSFCAL_ENABLE_RESET 0x1 -//#define MAC_PCU_REG_TSFCAL_AUTO_CAL_RESET 0x1 -//#define MAC_PCU_REG_TSFCAL_VALUE_WE_RESET 0x0 -//#define MAC_PCU_REG_TSFCAL_VALUE_RESET 0x8000 - -#define MAC_PCU_REG_PHYERR_EIFS_OFFSET 0x51 -#define MAC_PCU_REG_PHYERR_EIFS_MASK_FIELD 31:0 -#define MAC_PCU_REG_PHYERR_EIFS_MASK_RESET 0x0 - -//#define MAC_PCU_REG_SYNC1_OFFSET 0x52 -//#define MAC_PCU_REG_SYNC1_TIME_FIELD 30:0 -//#define MAC_PCU_REG_SYNC1_TIME_RESET 0x0 - -//#define MAC_PCU_REG_SYNC2_OFFSET 0x53 -//#define MAC_PCU_REG_SYNC2_TIME_OFFSET_FIELD 7:0 -//#define MAC_PCU_REG_SYNC2_MASTER_FIELD 8 -//#define MAC_PCU_REG_SYNC2_REPLACE_FIELD 9 -//#define MAC_PCU_REG_SYNC2_TUNE_FIELD 10 -//#define MAC_PCU_REG_SYNC2_CLEAR_FIELD 11 -//#define MAC_PCU_REG_SYNC2_INTR_THRESH_FIELD 31:16 -//#define MAC_PCU_REG_SYNC2_TIME_OFFSET_RESET 0x0 -//#define MAC_PCU_REG_SYNC2_MASTER_RESET 0x0 -//#define MAC_PCU_REG_SYNC2_REPLACE_RESET 0x0 -//#define MAC_PCU_REG_SYNC2_TUNE_RESET 0x0 -//#define MAC_PCU_REG_SYNC2_CLEAR_RESET 0x0 -//#define MAC_PCU_REG_SYNC2_INTR_THRESH_RESET 0xFFFF - -//#define MAC_PCU_REG_SYNC3_OFFSET 0x54 -//#define MAC_PCU_REG_SYNC3_MCAST_ADDR_L_FIELD 31:0 -//#define MAC_PCU_REG_SYNC3_MCAST_ADDR_L_RESET 0x0 - -//#define MAC_PCU_REG_SYNC4_OFFSET 0x55 -//#define MAC_PCU_REG_SYNC4_MCAST_ADDR_U_FIELD 15:0 -//#define MAC_PCU_REG_SYNC4_MCAST_ADDR_U_RESET 0x0 - -//#define MAC_PCU_REG_SYNC5_OFFSET 0x56 -//#define MAC_PCU_REG_SYNC5_RX_TIME_FIELD 30:0 - -//#define MAC_PCU_REG_SYNC6_OFFSET 0x57 -//#define MAC_PCU_REG_SYNC6_INC_FIELD 31:0 - -//#define MAC_PCU_REG_SYNC7_OFFSET 0x58 -//#define MAC_PCU_REG_SYNC7_LAST_TIME_FIELD 30:0 - -//#define MAC_PCU_REG_SYNC8_OFFSET 0x59 -//#define MAC_PCU_REG_SYNC8_UPDATED_TIME_FIELD 30:0 - -#define MAC_PCU_REG_PHYCNT3_OFFSET 0x5A -#define MAC_PCU_REG_PHYCNT3_FIELD 23:0 -#define MAC_PCU_REG_PHYCNT3_RESET 0x0 - -#define MAC_PCU_REG_PHYCNTMASK3_OFFSET 0x5B -#define MAC_PCU_REG_PHYCNTMASK3_FIELD 31:0 -#define MAC_PCU_REG_PHYCNTMASK3_RESET 0x0 - -#define MAC_PCU_REG_BTMODE_OFFSET 0x5C -#define MAC_PCU_REG_BTMODE_TIME_EXTEND_FIELD 7:0 -#define MAC_PCU_REG_BTMODE_TXSTATE_EXTEND_FIELD 8 -#define MAC_PCU_REG_BTMODE_TX_FRAME_EXTEND_FIELD 9 -#define MAC_PCU_REG_BTMODE_MODE_FIELD 11:10 -#define MAC_PCU_REG_BTMODE_QUIET_FIELD 12 -#define MAC_PCU_REG_BTMODE_QCU_THRESH_FIELD 16:13 -#define MAC_PCU_REG_BTMODE_RX_CLEAR_POLARITY_FIELD 17 -#define MAC_PCU_REG_BTMODE_PRIORITY_TIME_FIELD 23:18 -#define MAC_PCU_REG_BTMODE_FIRST_SLOT_TIME_FIELD 31:24 -#define MAC_PCU_REG_BTMODE_TIME_EXTEND_RESET 0x20 -#define MAC_PCU_REG_BTMODE_TXSTATE_EXTEND_RESET 0x1 -#define MAC_PCU_REG_BTMODE_TX_FRAME_EXTEND_RESET 0x1 -#define MAC_PCU_REG_BTMODE_MODE_RESET 0x3 -#define MAC_PCU_REG_BTMODE_QUIET_RESET 0x1 -#define MAC_PCU_REG_BTMODE_QCU_THRESH_RESET 0x1 -#define MAC_PCU_REG_BTMODE_RX_CLEAR_POLARITY_RESET 0x0 -#define MAC_PCU_REG_BTMODE_PRIORITY_TIME_RESET 0x05 -#define MAC_PCU_REG_BTMODE_FIRST_SLOT_TIME_RESET 0x9B - -#define MAC_PCU_REG_BTWEIGHT_OFFSET 0x5D -#define MAC_PCU_REG_BTWEIGHT_BT_WEIGHT_FIELD 15:0 -#define MAC_PCU_REG_BTWEIGHT_WL_WEIGHT_FIELD 31:16 -#define MAC_PCU_REG_BTWEIGHT_BT_WEIGHT_RESET 0xFA50 -#define MAC_PCU_REG_BTWEIGHT_WL_WEIGHT_RESET 0xFAA4 - -#define MAC_PCU_REG_HCF_OFFSET 0x5E -#define MAC_PCU_REG_HCF_TIMEOUT_FIELD 15:0 -#define MAC_PCU_REG_HCF_TIMEOUT_RESET 0x100 - -#define MAC_PCU_REG_BTMODE2_OFFSET 0x5F -#define MAC_PCU_REG_BTMODE2_BT_BCN_MISS_THRESH_FIELD 7:0 -#define MAC_PCU_REG_BTMODE2_BCN_MISS_CNT_FIELD 15:8 -#define MAC_PCU_REG_BTMODE2_BT_HOLD_RX_CLEAR_FIELD 16 -#define MAC_PCU_REG_BTMODE2_WL_CONTROL_ANT_FIELD 17 -#define MAC_PCU_REG_BTMODE2_RESPOND_TO_BT_ACTIVE_FIELD 18 -#define MAC_PCU_REG_BTMODE2_PROTECT_BT_AFTER_WAKEUP_FIELD 19 -#define MAC_PCU_REG_BTMODE2_DISABLE_BT_ANT_FIELD 20 -#define MAC_PCU_REG_BTMODE2_BT_BCN_MISS_THRESH_RESET 0 -#define MAC_PCU_REG_BTMODE2_BT_HOLD_RX_CLEAR_RESET 0 -#define MAC_PCU_REG_BTMODE2_WL_CONTROL_ANT_RESET 0x0 -#define MAC_PCU_REG_BTMODE2_RESPOND_TO_BT_ACTIVE_RESET 0x0 -#define MAC_PCU_REG_BTMODE2_PROTECT_BT_AFTER_WAKEUP_RESET 0x0 -#define MAC_PCU_REG_BTMODE2_DISABLE_BT_ANT_RESET 0x0 - -#define MAC_PCU_REG_BFCOEF1_OFFSET 0x60 -#define MAC_PCU_REG_BFCOEF1_UPPER_OFFSET 0x67 -#define MAC_PCU_REG_BFCOEF1_KEY_VALID_FIELD 31 -#define MAC_PCU_REG_BFCOEF1_KEYIDX_FIELD 30:24 -#define MAC_PCU_REG_BFCOEF1_TSF_FIELD 23:0 -#define MAC_PCU_REG_BFCOEF1_KEY_VALID_RESET 0x0 - -#define MAC_PCU_REG_BFCOEF2_OFFSET 0x70 -#define MAC_PCU_REG_BFCOEF2_THRESH_FIELD 22:0 -#define MAC_PCU_REG_BFCOEF2_LOCK_FIELD 31:24 -#define MAC_PCU_REG_BFCOEF2_THRESH_RESET 0x0 -#define MAC_PCU_REG_BFCOEF2_LOCK_RESET 0x0 - -#define MAC_PCU_REG_KCMASK_OFFSET 0x71 -#define MAC_PCU_REG_KCMASK_47_32_FIELD 15:0 -#define MAC_PCU_REG_KCMASK_47_32_RESET 0 -#define MAC_PCU_REG_KCMASK_31_0_FIELD 16 -#define MAC_PCU_REG_KCMASK_31_0_RESET 0 - -#define MAC_PCU_REG_TXSIFS_OFFSET 0x74 -#define MAC_PCU_REG_TXSIFS_SIFS_TIME_FIELD 7:0 -#define MAC_PCU_REG_TXSIFS_TX_LATENCY_FIELD 11:8 -#define MAC_PCU_REG_TXSIFS_ACK_SHIFT_FIELD 14:12 -#define MAC_PCU_REG_TXSIFS_SIFS_TIME_RESET 16 -#define MAC_PCU_REG_TXSIFS_TX_LATENCY_RESET 2 -#define MAC_PCU_REG_TXSIFS_ACK_SHIFT_RESET 3 - -#define MAC_PCU_REG_TXOP_X_OFFSET 0x7b -#define MAC_PCU_REG_TXOP_X_FIELD 7:0 -#define MAC_PCU_REG_TXOP_X_RESET 0 - -#define MAC_PCU_REG_TXOP_0_3_OFFSET 0x7c -#define MAC_PCU_REG_TXOP_0_FIELD 7:0 -#define MAC_PCU_REG_TXOP_1_FIELD 15:8 -#define MAC_PCU_REG_TXOP_2_FIELD 23:16 -#define MAC_PCU_REG_TXOP_3_FIELD 31:24 -#define MAC_PCU_REG_TXOP_0_RESET 0 -#define MAC_PCU_REG_TXOP_1_RESET 0 -#define MAC_PCU_REG_TXOP_2_RESET 0 -#define MAC_PCU_REG_TXOP_3_RESET 0 - -#define MAC_PCU_REG_TXOP_4_7_OFFSET 0x7d -#define MAC_PCU_REG_TXOP_4_FIELD 7:0 -#define MAC_PCU_REG_TXOP_5_FIELD 15:8 -#define MAC_PCU_REG_TXOP_6_FIELD 23:16 -#define MAC_PCU_REG_TXOP_7_FIELD 31:24 -#define MAC_PCU_REG_TXOP_4_RESET 0 -#define MAC_PCU_REG_TXOP_5_RESET 0 -#define MAC_PCU_REG_TXOP_6_RESET 0 -#define MAC_PCU_REG_TXOP_7_RESET 0 - -#define MAC_PCU_REG_TXOP_8_11_OFFSET 0x7e -#define MAC_PCU_REG_TXOP_8_FIELD 7:0 -#define MAC_PCU_REG_TXOP_9_FIELD 15:8 -#define MAC_PCU_REG_TXOP_10_FIELD 23:16 -#define MAC_PCU_REG_TXOP_11_FIELD 31:24 -#define MAC_PCU_REG_TXOP_8_RESET 0 -#define MAC_PCU_REG_TXOP_9_RESET 0 -#define MAC_PCU_REG_TXOP_10_RESET 0 -#define MAC_PCU_REG_TXOP_11_RESET 0 - -#define MAC_PCU_REG_TXOP_12_15_OFFSET 0x7f -#define MAC_PCU_REG_TXOP_12_FIELD 7:0 -#define MAC_PCU_REG_TXOP_13_FIELD 15:8 -#define MAC_PCU_REG_TXOP_14_FIELD 23:16 -#define MAC_PCU_REG_TXOP_15_FIELD 31:24 -#define MAC_PCU_REG_TXOP_12_RESET 0 -#define MAC_PCU_REG_TXOP_13_RESET 0 -#define MAC_PCU_REG_TXOP_14_RESET 0 -#define MAC_PCU_REG_TXOP_15_RESET 0 - -#define MAC_PCU_REG_GNRCTMR_N_OFFSET 0x80 -#define MAC_PCU_REG_GNRCTMR_N_UPPER_OFFSET 0x87 -#define MAC_PCU_REG_GNRCTMR_N_FIELD 31:0 - -#define MAC_PCU_REG_GNRCTMR_P_OFFSET 0x88 -#define MAC_PCU_REG_GNRCTMR_P_UPPER_OFFSET 0x8F -#define MAC_PCU_REG_GNRCTMR_P_FIELD 27:0 - -#define MAC_PCU_REG_GNRCTMR_M_OFFSET 0x90 -#define MAC_PCU_REG_GNRCTMR_M_ENABLE_FIELD 7:0 -#define MAC_PCU_REG_GNRCTMR_M_OVERFLOW_INDEX_FIELD 10:8 -#define MAC_PCU_REG_GNRCTMR_M_THRESH_FIELD 31:12 -#define MAC_PCU_REG_GNRCTMR_M_ENABLE_RESET 0x0 -#define MAC_PCU_REG_GNRCTMR_M_THRESH_RESET 0x00100 - -#define MAC_PCU_REG_SLP32_MODE_OFFSET 0x91 -#define MAC_PCU_REG_SLP32_MODE_HALF_CLK_LATENCY_FIELD 19:0 -#define MAC_PCU_REG_SLP32_MODE_ENABLE_FIELD 20 -#define MAC_PCU_REG_SLP32_MODE_TSF_WRITE_STAT_FIELD 21 -#define MAC_PCU_REG_SLP32_MODE_HALF_CLK_LATENCY_RESET 0x0F424 -#define MAC_PCU_REG_SLP32_MODE_ENABLE_RESET 0x1 - -#define MAC_PCU_REG_SLP32_WAKE_OFFSET 0x92 -#define MAC_PCU_REG_SLP32_WAKE_XTL_TIME_FIELD 15:0 -#define MAC_PCU_REG_SLP32_WAKE_XTL_TIME_RESET 0x07EF - -#define MAC_PCU_REG_SLP32_TSF_INC_OFFSET 0x93 -#define MAC_PCU_REG_SLP32_TSF_INC_FIELD 19:0 -#define MAC_PCU_REG_SLP32_TSF_INC_RESET 0x1E848 - -#define MAC_PCU_REG_SLPMIB1_OFFSET 0x94 -#define MAC_PCU_REG_SLPMIB1_SLEEP_CNT_FIELD 31:0 - -#define MAC_PCU_REG_SLPMIB2_OFFSET 0x95 -#define MAC_PCU_REG_SLPMIB2_CYCLE_CNT_FIELD 31:0 - -#define MAC_PCU_REG_SLPMIB3_OFFSET 0x96 -#define MAC_PCU_REG_SLPMIB3_CLR_CNT_FIELD 0 -#define MAC_PCU_REG_SLPMIB3_PEND_FIELD 1 - -#define MAC_PCU_REG_MISCMODE2_OFFSET 0x97 -#define MAC_PCU_REG_MISCMODE2_MGMT_CRYPTO_ENABLE_FIELD 0 -#define MAC_PCU_REG_MISCMODE2_NO_CRYPTO_FOR_NON_DATA_PKT_FIELD 1 -#define MAC_PCU_REG_MISCMODE2_MGMT_QOS_FIELD 15:8 -#define MAC_PCU_REG_MISCMODE2_BC_MC_WAPI_MODE_FIELD 16 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_FOR_1ST_PKT_FIELD 17 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_IF_ZERO_FIELD 18 -#define MAC_PCU_REG_MISCMODE2_MGMT_CRYPTO_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE2_NO_CRYPTO_FOR_NON_DATA_PKT_RESET 0x0 -#define MAC_PCU_REG_MISCMODE2_MGMT_QOS_RESET 0x10 -#define MAC_PCU_REG_MISCMODE2_BC_MC_WAPI_MODE_RESET 0x0 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_FOR_1ST_PKT_RESET 0x0 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_IF_ZERO_RESET 0x0 - -#define MAC_PCU_REG_SLP4_OFFSET 0x98 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_DUR_FIELD 15:0 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_ENABLE_FIELD 16 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_DUR_RESET 0x5 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_ENABLE_RESET 0x0 - -#define MAC_PCU_REG_SLP5_OFFSET 0x99 -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_FIELD 23:0 -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_ENABLE_FIELD 24 -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_RESET 0xff_ffff -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_ENABLE_RESET 0x0 - -#define MAC_PCU_REG_MCICTL_OFFSET 0x9a -#define MAC_PCU_REG_MCICTL_MCI_ENABLE_FIELD 0 -#define MAC_PCU_REG_MCICTL_OLA_ENABLE_FIELD 1 -#define MAC_PCU_REG_MCICTL_PREEMPT_ENABLE_FIELD 2 -#define MAC_PCU_REG_MCICTL_CHANNEL_BUSY_ENABLE_FIELD 3 -#define MAC_PCU_REG_MCICTL_EARLY_NOTIFY_DELAY_FIELD 9:4 -#define MAC_PCU_REG_MCICTL_BMISS_FORCE_WL_FIELD 10 -#define MAC_PCU_REG_MCICTL_SLEEP_FORCE_BT_FIELD 11 -#define MAC_PCU_REG_MCICTL_HP_QCU_STOMP_BT_FIELD 12 -#define MAC_PCU_REG_MCICTL_MCI_BUSY_FIELD 31 -#define MAC_PCU_REG_MCICTL_MCI_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MCICTL_OLA_ENABLE_RESET 0x1 -#define MAC_PCU_REG_MCICTL_PREEMPT_ENABLE_RESET 0x1 -#define MAC_PCU_REG_MCICTL_CHANNEL_BUSY_ENABLE_RESET 0x1 -#define MAC_PCU_REG_MCICTL_EARLY_NOTIFY_DELAY_RESET 0x5 -#define MAC_PCU_REG_MCICTL_BMISS_FORCE_WL_RESET 0x0 -#define MAC_PCU_REG_MCICTL_SLEEP_FORCE_BT_RESET 0x1 -#define MAC_PCU_REG_MCICTL_HP_QCU_STOMP_BT_RESET 0x0 - -#define MAC_PCU_REG_MCIISR_OFFSET 0x9b -#define MAC_PCU_REG_MCIISR_ACT_RPT_RCV_INT_FIELD 0 -#define MAC_PCU_REG_MCIISR_ACT_DEN_RCV_INT_FIELD 1 -#define MAC_PCU_REG_MCIISR_FRQ_RPT_RCV_INT_FIELD 2 -#define MAC_PCU_REG_MCIISR_QOS_RPT_RCV_INT_FIELD 3 -#define MAC_PCU_REG_MCIISR_GEN_RPT_RCV_INT_FIELD 4 -#define MAC_PCU_REG_MCIISR_ACT_RPT_RCV_INT_RESET 0x0 -#define MAC_PCU_REG_MCIISR_ACT_DEN_RCV_INT_RESET 0x0 -#define MAC_PCU_REG_MCIISR_FRQ_RPT_RCV_INT_RESET 0x0 -#define MAC_PCU_REG_MCIISR_QOS_RPT_RCV_INT_RESET 0x0 -#define MAC_PCU_REG_MCIISR_GEN_RPT_RCV_INT_RESET 0x0 - -#define MAC_PCU_REG_MCIIER_OFFSET 0x9c -#define MAC_PCU_REG_MCIIER_ACT_RPT_RCV_INT_ENABLE_FIELD 0 -#define MAC_PCU_REG_MCIIER_ACT_DEN_RCV_INT_ENABLE_FIELD 1 -#define MAC_PCU_REG_MCIIER_FRQ_RPT_RCV_INT_ENABLE_FIELD 2 -#define MAC_PCU_REG_MCIIER_QOS_RPT_RCV_INT_ENABLE_FIELD 3 -#define MAC_PCU_REG_MCIIER_GEN_RPT_RCV_INT_ENABLE_FIELD 4 -#define MAC_PCU_REG_MCIIER_ACT_RPT_RCV_INT_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MCIIER_ACT_DEN_RCV_INT_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MCIIER_FRQ_RPT_RCV_INT_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MCIIER_QOS_RPT_RCV_INT_ENABLE_RESET 0x0 -#define MAC_PCU_REG_MCIIER_GEN_RPT_RCV_INT_ENABLE_RESET 0x0 - -#define MAC_PCU_REG_MCIWLP_OFFSET 0x9d -#define MAC_PCU_REG_MCIWLP_RESET 0x0 - -#define MAC_PCU_REG_MCIARW_OFFSET 0x9e -#define MAC_PCU_REG_MCIARW_RESET 0x0 - -#define MAC_PCU_REG_MCIARR_OFFSET 0x9f - -#define MAC_PCU_REG_MCIADW_OFFSET 0xa0 -#define MAC_PCU_REG_MCIADW_RESET 0x0 - -#define MAC_PCU_REG_MCIADR_OFFSET 0xa1 - -#define MAC_PCU_REG_MCIFRW_OFFSET 0xa2 -#define MAC_PCU_REG_MCIFRW_RESET 0x0 - -#define MAC_PCU_REG_MCIFRR_OFFSET 0xa3 - -#define MAC_PCU_REG_MCIQRW_OFFSET 0xa4 -#define MAC_PCU_REG_MCIQRW_RESET 0x0 - -#define MAC_PCU_REG_MCIQRR_OFFSET 0xa5 - -#define MAC_PCU_REG_MCIGRW_OFFSET 0xa6 -#define MAC_PCU_REG_MCIGRW_RESET 0x0 - -#define MAC_PCU_REG_MCIGRR_OFFSET 0xa7 - -#define MAC_PCU_REG_MCISTAT_OFFSET 0xa8 -#define MAC_PCU_REG_MCISTAT_ACT_RPT_RCV_CNT_FIELD 7:0 -#define MAC_PCU_REG_MCISTAT_QC_CNT_FIELD 15:8 -#define MAC_PCU_REG_MCISTAT_OLA_CNT_FIELD 23:16 -#define MAC_PCU_REG_MCISTAT_PREEMPT_CNT_FIELD 31:24 -#define MAC_PCU_REG_MCISTAT_ACT_RPT_RCV_CNT_RESET 0x0 -#define MAC_PCU_REG_MCISTAT_QC_CNT_RESET 0x0 -#define MAC_PCU_REG_MCISTAT_OLA_CNT_RESET 0x0 -#define MAC_PCU_REG_MCISTAT_PREEMPT_CNT_RESET 0x0 - -#define MAC_PCU_REG_BASIC_RATE_SET0_OFFSET 0xa9 -#define MAC_PCU_REG_BRATE_1MB_L_FIELD 4:0 -#define MAC_PCU_REG_BRATE_2MB_L_FIELD 9:5 -#define MAC_PCU_REG_BRATE_2MB_S_FIELD 14:10 -#define MAC_PCU_REG_BRATE_5_5MB_L_FIELD 19:15 -#define MAC_PCU_REG_BRATE_5_5MB_S_FIELD 24:20 -#define MAC_PCU_REG_BRATE_11MB_L_FIELD 29:25 -#define MAC_PCU_REG_BRATE_1MB_L_RESET #CCK_RATE_1Mb_L -#define MAC_PCU_REG_BRATE_2MB_L_RESET #CCK_RATE_2Mb_L -#define MAC_PCU_REG_BRATE_2MB_S_RESET #CCK_RATE_2Mb_S -#define MAC_PCU_REG_BRATE_5_5MB_L_RESET #CCK_RATE_5_5Mb_L -#define MAC_PCU_REG_BRATE_5_5MB_S_RESET #CCK_RATE_5_5Mb_S -#define MAC_PCU_REG_BRATE_11MB_L_RESET #CCK_RATE_11Mb_L - -#define MAC_PCU_REG_BASIC_RATE_SET1_OFFSET 0xaa -#define MAC_PCU_REG_BRATE_11MB_S_FIELD 4:0 -#define MAC_PCU_REG_BRATE_6MB_FIELD 9:5 -#define MAC_PCU_REG_BRATE_9MB_FIELD 14:10 -#define MAC_PCU_REG_BRATE_12MB_FIELD 19:15 -#define MAC_PCU_REG_BRATE_18MB_FIELD 24:20 -#define MAC_PCU_REG_BRATE_24MB_FIELD 29:25 -#define MAC_PCU_REG_BRATE_11MB_S_RESET #CCK_RATE_11Mb_S -#define MAC_PCU_REG_BRATE_6MB_RESET #OFDM_RATE_6Mb -#define MAC_PCU_REG_BRATE_9MB_RESET #OFDM_RATE_6Mb -#define MAC_PCU_REG_BRATE_12MB_RESET #OFDM_RATE_12Mb -#define MAC_PCU_REG_BRATE_18MB_RESET #OFDM_RATE_12Mb -#define MAC_PCU_REG_BRATE_24MB_RESET #OFDM_RATE_24Mb - -#define MAC_PCU_REG_BASIC_RATE_SET2_OFFSET 0xab -#define MAC_PCU_REG_BRATE_36MB_FIELD 4:0 -#define MAC_PCU_REG_BRATE_48MB_FIELD 9:5 -#define MAC_PCU_REG_BRATE_54MB_FIELD 14:10 -#define MAC_PCU_REG_BRATE_36MB_RESET #OFDM_RATE_24Mb -#define MAC_PCU_REG_BRATE_48MB_RESET #OFDM_RATE_24Mb -#define MAC_PCU_REG_BRATE_54MB_RESET #OFDM_RATE_24Mb - -#define MAC_PCU_REG_SEC_BSSID_L32_OFFSET 0xac -#define MAC_PCU_REG_SEC_BSSID_L32_FIELD 31:0 -#define MAC_PCU_REG_SEC_BSSID_L32_RESET 0x0 - -#define MAC_PCU_REG_SEC_BSSID_U16_OFFSET 0xad -#define MAC_PCU_REG_SEC_BSSID_U16_FIELD 15:0 -#define MAC_PCU_REG_SEC_BSSID_ENABLE_FIELD 16 -#define MAC_PCU_REG_SEC_BSSID_U16_RESET 0x0 -#define MAC_PCU_REG_SEC_BSSID_ENABLE_RESET 0x0 - -#define MAC_PCU_REG_FTYPE_OFFSET 0x140 -#define MAC_PCU_REG_FTYPE_UPPER_OFFSET 0x17F -#define MAC_PCU_REG_FTYPE_BFCOEF_RX_UPDATE_NORMAL_FIELD 0 -#define MAC_PCU_REG_FTYPE_BFCOEF_RX_UPDATE_SELF_GEN_FIELD 1 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_NORMAL_FIELD 2 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_SELF_GEN_FIELD 3 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_GEN_FIELD 4 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_MCAST_FIELD 5 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_ALL_FIELD 6 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_DIRECTED_FIELD 7 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_MCAST_FIELD 8 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_BCAST_FIELD 9 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_MC_BC_BSSID_FIELD 10 - -#define MAC_PCU_REG_ACKSIFSMEM_OFFSET_RESERVED 0x1A0 -#define MAC_PCU_REG_ACKSIFSMEM_UPPER_OFFSET_RESERVED 0x1BF -#define MAC_PCU_REG_ACKSIFSMEM_NORMAL_FIELD_RESERVED 9:0 -#define MAC_PCU_REG_ACKSIFSMEM_TURBO_FIELD_RESERVED 19:10 - -#define MAC_PCU_REG_DUR_OFFSET 0x1C0 -#define MAC_PCU_REG_DUR_UPPER_OFFSET 0x1DF -#define MAC_PCU_REG_DUR_RATE_TO_DURATION_FIELD 15:0 - -#define MAC_PCU_REG_RTD_OFFSET 0x1F0 -#define MAC_PCU_REG_RTD_UPPER_OFFSET 0x1F7 -#define MAC_PCU_REG_RTD_RATE_TO_DB_0_FIELD 4:0 -#define MAC_PCU_REG_RTD_RATE_TO_DB_1_FIELD 12:8 -#define MAC_PCU_REG_RTD_RATE_TO_DB_2_FIELD 20:16 -#define MAC_PCU_REG_RTD_RATE_TO_DB_3_FIELD 28:24 - -#define MAC_PCU_REG_DTR_OFFSET 0x1F8 -#define MAC_PCU_REG_DTR_UPPER_OFFSET 0x1FF -#define MAC_PCU_REG_DTR_DB_TO_RATE_0_FIELD 4:0 -#define MAC_PCU_REG_DTR_DB_TO_RATE_1_FIELD 12:8 -#define MAC_PCU_REG_DTR_DB_TO_RATE_2_FIELD 20:16 -#define MAC_PCU_REG_DTR_DB_TO_RATE_3_FIELD 28:24 - -#define MAC_PCU_REG_KC_OFFSET 0x200 -#define MAC_PCU_REG_KC_UPPER_OFFSET 0x5FF -#define MAC_PCU_REG_KC_KEY_31_0_FIELD 31:0 -#define MAC_PCU_REG_KC_KEY_47_32_FIELD 15:0 -#define MAC_PCU_REG_KC_KEY_79_48_FIELD 31:0 -#define MAC_PCU_REG_KC_KEY_95_80_FIELD 15:0 -#define MAC_PCU_REG_KC_KEY_127_96_FIELD 31:0 -#define MAC_PCU_REG_KC_KEY_TYPE_FIELD 2:0 -#define MAC_PCU_REG_KC_LAST_ANTENNA_FIELD 3 -#define MAC_PCU_REG_KC_ASYNC_ACK_OFFSET_FIELD 8:4 -#define MAC_PCU_REG_KC_UPDATE_BEAM_FORMING_FIELD 9 -#define MAC_PCU_REG_KC_RX_CHAIN_0_ACK_ANT_FIELD 10 -#define MAC_PCU_REG_KC_RX_CHAIN_1_ACK_ANT_FIELD 11 -#define MAC_PCU_REG_KC_TX_CHAIN_0_ANT_SEL_FIELD 12 -#define MAC_PCU_REG_KC_TX_CHAIN_1_ANT_SEL_FIELD 13 -#define MAC_PCU_REG_KC_TX_CHAIN_SEL_FIELD 14 -#define MAC_PCU_REG_KC_ADDR_32_1_FIELD 31:0 -#define MAC_PCU_REG_KC_ADDR_47_33_FIELD 14:0 -#define MAC_PCU_REG_KC_VALID_FIELD 1 - -//Misc -#define ELEM_START 36 -#define CFP_ELEM 4 - -#endif diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mac_pcu.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mac_pcu.vrh deleted file mode 100644 index 0ed8ff6737d0..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mac_pcu.vrh +++ /dev/null @@ -1,979 +0,0 @@ - -#define _MAC_PCU_H - -#define FIFO_BOUND 1024 - -#define CLK32_TIMER0 0 -#define CLK32_TIMER1 1 -#define CLK32_TIMER2 2 -#define CLK32_TIMER3 3 -#define CLK32_TSF_L32 4 -#define CLK32_TSF_U32 5 -#define CLK32_SLP1 6 -#define CLK32_SLP2 7 -#define CLK32_SLP3 8 -#define CLK32_QT1 9 -#define CLK32_QT2 10 -//#define CLK32_TSFCAL 11 - -//#define CLK_S_SYNC1 0 -//#define CLK_S_SYNC6 1 -//#define CLK_S_SYNC7 2 -//#define CLK_S_SYNC8 3 - -#define KTYPE_40 0 -#define KTYPE_104 1 -#define KTYPE_TKIP_NO_MIC 2 -#define KTYPE_128 3 -#define KTYPE_TKIP 4 -//#define KTYPE_AES_OCB 5 -#define KTYPE_WAPI 5 -#define KTYPE_AES_CCM 6 -#define KTYPE_NOTHING 7 - -//Frame Type in Descriptor -#define TXDESC_FT_NORMAL 0 -#define TXDESC_FT_ATIM 1 -#define TXDESC_FT_PS_POLL 2 -#define TXDESC_FT_BEACON 3 -#define TXDESC_FT_PROBE_RESP 4 -#define TXDESC_FT_CHIRP 5 -#define TXDESC_FT_GROUP_POLL 6 -#define TXDESC_FT_DIRECT_POLL 7 -//#define TXDESC_FT_SYNC 8 -#define TXDESC_FT_BEACON_NO_TSF_UPDATE 9 - -//Frame Type: Management -#define FTYPE_ASSOCIATION_REQ 6'b000000 -#define FTYPE_ASSOCIATION_RES 6'b000100 -#define FTYPE_REASSOCIATION_REQ 6'b001000 -#define FTYPE_REASSOCIATION_RES 6'b001100 -#define FTYPE_PBREQ 6'b010000 // change to TYPE_PROBE_REQ TBD -#define FTYPE_PBRES 6'b010100 // change to TYPE_PROBE_RES TBD -#define FTYPE_BEACON 6'b100000 -#define FTYPE_ATIM 6'b100100 -#define FTYPE_DISASSOCIATE 6'b101000 -#define FTYPE_AUTHENICATE 6'b101100 -#define FTYPE_DEAUTHENICATE 6'b110000 - -//Frame Type: Control -#define FTYPE_PSPOLL 6'b101001 -#define FTYPE_RTS 6'b101101 -#define FTYPE_CTS 6'b110001 -#define FTYPE_ACK 6'b110101 -#define FTYPE_CFEND 6'b111001 -#define FTYPE_CFEND_ACK 6'b111101 // change to FTYPE_CFEND_ACK TBD - -//Frame Type: Data -#define FTYPE_DATA 6'b000010 -#define FTYPE_DATA_CFACK 6'b000110 -#define FTYPE_DATA_CFPOLL 6'b001010 -#define FTYPE_DATA_CFACK_CFPOLL 6'b001110 -#define FTYPE_NULL 6'b010010 -#define FTYPE_CFACK 6'b010110 -#define FTYPE_CFPOLL 6'b011010 -#define FTYPE_CFACK_CFPOLL 6'b011110 - -//Frame Control Fields -#define FCTL_TO_DS 8 -#define FCTL_FROM_DS 9 -#define FCTL_MORE_FRAG 10 -#define FCTL_RETRY 11 -#define FCTL_POWER_MGNT 12 -#define FCTL_MORE_DATA 13 -#define FCTL_WEP 14 -#define FCTL_TYPE 3:2 - -//Rate -#define OFDM_RATE_6Mb 5'h0b -#define OFDM_RATE_9Mb 5'h0f -#define OFDM_RATE_12Mb 5'h0a -#define OFDM_RATE_18Mb 5'h0e -#define OFDM_RATE_24Mb 5'h09 -#define OFDM_RATE_36Mb 5'h0d -#define OFDM_RATE_48Mb 5'h08 -#define OFDM_RATE_54Mb 5'h0c -#define CCK_RATE_1Mb_L 5'h1b -#define CCK_RATE_2Mb_L 5'h1a -#define CCK_RATE_2Mb_S 5'h1e -#define CCK_RATE_5_5Mb_L 5'h19 -#define CCK_RATE_5_5Mb_S 5'h1d -#define CCK_RATE_11Mb_L 5'h18 - -#define CCK_RATE_11Mb_S 5'h1c -#define XR_RATE_0_25Mb 5'h03 -#define XR_RATE_0_5Mb 5'h07 -#define XR_RATE_1Mb 5'h02 -#define XR_RATE_2Mb 5'h06 -#define XR_RATE_3Mb 5'h01 - -//Registers -#define PCU_REG 'h0 -#define KEY_REG 'h1 -#define D2A2_REG 'h3 - -#define REG_STA_ID0 'h0 -#define STA_ADDR_L32 31:0 - -#define REG_STA_ID1 'h1 -#define STA_ADDR_U16 15:0 -#define AP 16 -#define ADHOC 17 -#define PWR_SV 18 -#define NO_KEYSRCH 19 -#define PCF 20 -#define USE_DEF_ANT 21 -#define DEF_ANT_UPDATE 22 -#define RTS_DEF_ANT 23 -#define ACKCTS_6MB 24 -#define RATE_11B 25 -#define SECTOR_SELF_GEN 26 -#define CRPT_MIC_ENABLE 27 -#define KSRCH_MODE 28 -#define PRESERVE_SEQNUM 29 -#define CBCIV_ENDIAN 30 -#define ADHOC_MCAST_SEARCH 31 - -#define REG_BSS_ID0 'h2 -#define BSSID_L32 31:0 - -#define REG_BSS_ID1 'h3 -#define BSSID_U16 15:0 -#define AID 31:16 - -#define MAC_PCU_REG_BCNRSSI_OFFSET 'h4 -#define MAC_PCU_REG_BCNRSSI_BCN_RSSI_AVE_FIELD 11:0 -#define MAC_PCU_REG_BCNRSSI_BCN_RSSI_AVE_RESET 12'h800 - -#define REG_TIME_OUT 'h5 -#define ACK_TIME_OUT 15:0 -#define CTS_TIME_OUT 31:16 - -#define MAC_PCU_REG_BCNSIG_OFFSET 'h6 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_LO_THR_FIELD 7:0 -#define MAC_PCU_REG_BCNSIG_BCN_MISS_THR_FIELD 15:8 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_HI_THR_FIELD 23:16 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_WEIGHT_FIELD 28:24 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_RESET_FIELD 29 -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_LO_THR_RESET 0 -#define MAC_PCU_REG_BCNSIG_BCN_MISS_THR_RESET 8'hFF -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_HI_THR_RESET 8'h7F -#define MAC_PCU_REG_BCNSIG_BCN_RSSI_WEIGHT_RESET 0 - -#define REG_USEC 'h7 -#define USEC 6:0 -#define USEC32 13:7 -#define TX_DELAY 18:14 -#define RX_DELAY 24:19 - -#define REG_BEACON 'h8 -#define BEACON_PERIOD 15:0 -#define TIM_OFFSET 22:16 -#define RESET_TSF 24 - -#define REG_CFP_PERIOD 'h9 - -#define REG_TIMER0 'ha - -#define REG_TIMER1 'hb - -#define REG_TIMER2 'hc - -#define REG_TIMER3 'hd - -#define REG_CFP_DUR 'he - -#define REG_RX_FILTER 'hf -#define UNICAST 0 -#define MULTICAST 1 -#define BROADCAST 2 -#define CONTROL 3 -#define BEACON 4 -#define PROMISCUOUS 5 -#define XR_POLL 6 -#define PROBE_REQ 7 -//#define SYNC 8 -#define MY_BEACON 9 - -#define REG_MCAST_FIL0 'h10 - -#define REG_MCAST_FIL1 'h11 - -#define MAC_PCU_REG_DIAGSW_OFFSET 'h12 -#define MAC_PCU_REG_DIAGSW_DIS_WEP_ACK_FIELD 0 -#define MAC_PCU_REG_DIAGSW_DIS_ACK_FIELD 1 -#define MAC_PCU_REG_DIAGSW_DIS_CTS_FIELD 2 -#define MAC_PCU_REG_DIAGSW_DIS_ENC_FIELD 3 -#define MAC_PCU_REG_DIAGSW_DIS_DEC_FIELD 4 -#define MAC_PCU_REG_DIAGSW_DIS_RX_FIELD 5 -#define MAC_PCU_REG_DIAGSW_LOOP_BACK_FIELD 6 -#define MAC_PCU_REG_DIAGSW_CORR_FCS_FIELD 7 -#define MAC_PCU_REG_DIAGSW_CHAN_INFO_FIELD 8 -#define MAC_PCU_REG_DIAGSW_RESERVED_FIELD 16:9 -#define MAC_PCU_REG_DIAGSW_ACCEPT_NONV0_FIELD 17 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_0_1_FIELD 19:18 -#define MAC_PCU_REG_DIAGSW_RXCLR_HIGH_FIELD 20 -#define MAC_PCU_REG_DIAGSW_IGNORE_NAV_FIELD 21 -#define MAC_PCU_REG_DIAGSW_CHANIDLE_HIGH_FIELD 22 -#define MAC_PCU_REG_DIAGSW_PHYERR_ENABLE_NEW_FIELD 23 -#define MAC_PCU_REG_DIAGSW_DUAL_CHAIN_CHAN_INFO_FIELD 24 -#define MAC_PCU_REG_DIAGSW_FORCE_RX_ABORT_FIELD 25 -#define MAC_PCU_REG_DIAGSW_SATURATE_CYCLE_CNT_FIELD 26 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_2_FIELD 27 -#define MAC_PCU_REG_DIAGSW_DIS_WEP_ACK_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_ACK_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_CTS_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_ENC_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_DEC_RESET 0 -#define MAC_PCU_REG_DIAGSW_DIS_RX_RESET 0 -#define MAC_PCU_REG_DIAGSW_LOOP_BACK_RESET 0 -#define MAC_PCU_REG_DIAGSW_CORR_FCS_RESET 0 -#define MAC_PCU_REG_DIAGSW_CHAN_INFO_RESET 0 -#define MAC_PCU_REG_DIAGSW_RESERVED_RESET 0 -#define MAC_PCU_REG_DIAGSW_ACCEPT_NONV0_RESET 0 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_0_1_RESET 0 -#define MAC_PCU_REG_DIAGSW_RXCLR_HIGH_RESET 0 -#define MAC_PCU_REG_DIAGSW_IGNORE_NAV_RESET 0 -#define MAC_PCU_REG_DIAGSW_CHANIDLE_HIGH_RESET 0 -#define MAC_PCU_REG_DIAGSW_PHYERR_ENABLE_NEW_RESET 0 -#define MAC_PCU_REG_DIAGSW_DUAL_CHAIN_CHAN_INFO_RESET 0 -#define MAC_PCU_REG_DIAGSW_FORCE_RX_ABORT_RESET 0 -#define MAC_PCU_REG_DIAGSW_SATURATE_CYCLE_CNT_RESET 0 -#define MAC_PCU_REG_DIAGSW_OBS_SEL_2_RESET 0 - -#define REG_TSF_L32 'h13 - -#define REG_TSF_U32 'h14 - -#define REG_TST_ADDAC 'h15 -#define TEST_MODE 0 -#define TEST_LOOP 1 -#define LOOP_LEN 12:2 -#define TEST_UPPER_8B 13 -#define TEST_MSB 14 -#define TEST_CAPTURE 15 - -#define REG_DEF_ANT 'h16 - -#define MAC_PCU_REG_MUTE_MASKS0_OFFSET 'h17 -#define MAC_PCU_REG_MUTE_MASKS0_FC_FIELD 15:0 -#define MAC_PCU_REG_MUTE_MASKS0_QOS_FIELD 31:16 -#define MAC_PCU_REG_MUTE_MASKS0_FC_RESET 16'hC7FF -#define MAC_PCU_REG_MUTE_MASKS0_QOS_RESET 16'hFFFF - -#define MAC_PCU_REG_MUTE_MASKS1_OFFSET 'h18 -#define MAC_PCU_REG_MUTE_MASKS1_SEQ_FIELD 15:0 -#define MAC_PCU_REG_MUTE_MASKS1_FC_MGMT_FIELD 31:16 -#define MAC_PCU_REG_MUTE_MASKS1_SEQ_RESET 16'h000F -#define MAC_PCU_REG_MUTE_MASKS1_FC_MGMT_RESET 16'hE7FF - -#define MAC_PCU_REG_GATED_CLKS_OFFSET 'h19 -//#define MAC_PCU_REG_GATED_SYNC_FIELD 0 -#define MAC_PCU_REG_GATED_TX_FIELD 1 -#define MAC_PCU_REG_GATED_RX_FIELD 2 -#define MAC_PCU_REG_GATED_REG_FIELD 3 -//#define MAC_PCU_REG_GATED_SYNC_RESET 1'b1 -#define MAC_PCU_REG_GATED_TX_RESET 1'b0 -#define MAC_PCU_REG_GATED_RX_RESET 1'b0 -#define MAC_PCU_REG_GATED_REG_RESET 1'b0 - -#define MAC_PCU_REG_OBS2_OFFSET 'h1a -#define MAC_PCU_REG_OBS2_OBS_BUS_FIELD 17:0 - -#define MAC_PCU_REG_OBS1_OFFSET 'h1b -#define MAC_PCU_REG_OBS1_TX_STATE_FIELD 28:24 -#define MAC_PCU_REG_OBS1_RX_STATE_FIELD 23:20 -#define MAC_PCU_REG_OBS1_WEP_STATE_FIELD 17:12 -#define MAC_PCU_REG_OBS1_RX_CLEAR_FIELD 11 -#define MAC_PCU_REG_OBS1_RX_FRAME_FIELD 10 -#define MAC_PCU_REG_OBS1_TX_FRAME_FIELD 9 -#define MAC_PCU_REG_OBS1_TX_HOLD_FIELD 8 -#define MAC_PCU_REG_OBS1_CHAN_IDLE_FIELD 7 -#define MAC_PCU_REG_OBS1_QUIET_TIME_FIELD 6 -#define MAC_PCU_REG_OBS1_TX_HCF_FIELD 5 -#define MAC_PCU_REG_OBS1_FILTER_PASS_FIELD 4 -#define MAC_PCU_REG_OBS1_RX_MY_BEACON_FIELD 3 -#define MAC_PCU_REG_OBS1_RX_WEP_FIELD 2 -#define MAC_PCU_REG_OBS1_PCU_RX_END_FIELD 1 -#define MAC_PCU_REG_OBS1_PCU_DIRECTED_FIELD 0 - -#define REG_LAST_TSTP 'h20 - -#define REG_NAV 'h21 - -#define REG_RTS_OK 'h22 - -#define REG_RTS_FAIL 'h23 - -#define REG_ACK_FAIL 'h24 - -#define REG_FCS_FAIL 'h25 - -#define REG_BEACON_CNT 'h26 - -#define MAC_PCU_REG_XRMODE_OFFSET 'h30 -#define MAC_PCU_REG_XRMODE_XR_POLL_TYPE_FIELD 5:0 -#define MAC_PCU_REG_XRMODE_XR_WAIT_FOR_POLL_FIELD 7 -#define MAC_PCU_REG_XRMODE_XR_FRAME_HOLD_FIELD 31:20 -#define MAC_PCU_REG_XRMODE_XR_POLL_TYPE_RESET 6'h1A -#define MAC_PCU_REG_XRMODE_XR_WAIT_FOR_POLL_RESET 1'b0 -#define MAC_PCU_REG_XRMODE_XR_FRAME_HOLD_RESET 12'd680 - -#define MAC_PCU_REG_XRDEL_OFFSET 'h31 -#define MAC_PCU_REG_XRDEL_XR_SLOT_DELAY_FIELD 15:0 -#define MAC_PCU_REG_XRDEL_XR_CHIRP_DATA_DELAY_FIELD 31:16 -#define MAC_PCU_REG_XRDEL_XR_SLOT_DELAY_RESET 16'd360 -#define MAC_PCU_REG_XRDEL_XR_CHIRP_DATA_DELAY_RESET 16'd1680 - -#define MAC_PCU_REG_XRTO_OFFSET 'h32 -#define MAC_PCU_REG_XRTO_XR_CHIRP_TIMEOUT_FIELD 15:0 -#define MAC_PCU_REG_XRTO_XR_POLL_TIMEOUT_FIELD 31:16 -#define MAC_PCU_REG_XRTO_XR_CHIRP_TIMEOUT_RESET 16'd7200 -#define MAC_PCU_REG_XRTO_XR_POLL_TIMEOUT_RESET 16'd5000 - -#define MAC_PCU_REG_XRCRP_OFFSET 'h33 -#define MAC_PCU_REG_XRCRP_XR_SEND_CHIRP_FIELD 0 -#define MAC_PCU_REG_XRCRP_XR_CHIRP_GAP_FIELD 31:16 -#define MAC_PCU_REG_XRCRP_XR_SEND_CHIRP_RESET 1'b0 -#define MAC_PCU_REG_XRCRP_XR_CHIRP_GAP_RESET 16'd500 - -#define MAC_PCU_REG_XRSTMP_OFFSET 'h34 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_FIELD 0 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_BSSID_FIELD 1 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_FIELD 2 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_BSSID_FIELD 3 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_DATA_FIELD 4 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_DATA_FIELD 5 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_THRESH_FIELD 15:8 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_THRESH_FIELD 23:16 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_RESET 1'b0 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_BSSID_RESET 1'b0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_RESET 1'b0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_BSSID_RESET 1'b0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_DATA_RESET 1'b0 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_DATA_RESET 1'b0 -#define MAC_PCU_REG_XRSTMP_TX_STOMP_RSSI_THRESH_RESET 8'h25 -#define MAC_PCU_REG_XRSTMP_RX_ABORT_RSSI_THRESH_RESET 8'h25 - -#define MAC_PCU_REG_SLP1_OFFSET 'h35 -//#define MAC_PCU_REG_SLP1_NEXT_DTIM_FIELD 18:0 -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_EXT_FIELD 4:0 -#define MAC_PCU_REG_SLP1_ASSUME_DTIM_FIELD 19 -//#define MAC_PCU_REG_SLP1_ENH_SLEEP_ENABLE_FIELD 20 -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_FIELD 31:21 -// #define MAC_PCU_REG_SLP1_NEXT_DTIM_RESET 19'h2aaaa -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_EXT_RESET 5'h0 -#define MAC_PCU_REG_SLP1_ASSUME_DTIM_RESET 1'b0 -//#define MAC_PCU_REG_SLP1_ENH_SLEEP_ENABLE_RESET 1'b1 -#define MAC_PCU_REG_SLP1_CAB_TIMEOUT_RESET 11'd5 - -#define MAC_PCU_REG_SLP2_OFFSET 'h36 -//#define MAC_PCU_REG_SLP2_NEXT_TIM_FIELD 18:0 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_EXT_FIELD 4:0 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_FIELD 31:21 -//#define MAC_PCU_REG_SLP2_NEXT_TIM_RESET 19'h55555 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_EXT_RESET 5'h0 -#define MAC_PCU_REG_SLP2_BEACON_TIMEOUT_RESET 11'd2 - -//#define MAC_PCU_REG_SLP3_OFFSET 'h37 -//#define MAC_PCU_REG_SLP3_TIM_PERIOD_FIELD 15:0 -//#define MAC_PCU_REG_SLP3_DTIM_PERIOD_FIELD 31:16 -//#define MAC_PCU_REG_SLP3_TIM_PERIOD_RESET 16'd2 -//#define MAC_PCU_REG_SLP3_DTIM_PERIOD_RESET 16'd3 - -#define MAC_PCU_REG_BSSMSKL_OFFSET 'h38 -#define MAC_PCU_REG_BSSMSKL_BSSID_MASK_L_FIELD 31:0 -#define MAC_PCU_REG_BSSMSKL_BSSID_MASK_L_RESET 32'hFFFFFFFF - -#define MAC_PCU_REG_BSSMSKH_OFFSET 'h39 -#define MAC_PCU_REG_BSSMSKH_BSSID_MASK_H_FIELD 15:0 -#define MAC_PCU_REG_BSSMSKH_BSSID_MASK_H_RESET 16'hFFFF - -#define MAC_PCU_REG_TPC_OFFSET 'h3A -#define MAC_PCU_REG_TPC_ACK_PWR_FIELD 5:0 -#define MAC_PCU_REG_TPC_CTS_PWR_FIELD 13:8 -#define MAC_PCU_REG_TPC_CHIRP_PWR_FIELD 21:16 -#define MAC_PCU_REG_TPC_ACK_PWR_RESET 6'h3f -#define MAC_PCU_REG_TPC_CTS_PWR_RESET 6'h3f -#define MAC_PCU_REG_TPC_CHIRP_PWR_RESET 6'h3f - -#define MAC_PCU_REG_TFC_OFFSET 'h3B -#define MAC_PCU_REG_TFC_TX_FRAME_CNT_FIELD 31:0 -#define MAC_PCU_REG_TFC_TX_FRAME_CNT_RESET 0 - -#define MAC_PCU_REG_RFC_OFFSET 'h3C -#define MAC_PCU_REG_RFC_RX_FRAME_CNT_FIELD 31:0 -#define MAC_PCU_REG_RFC_RX_FRAME_CNT_RESET 0 - -#define MAC_PCU_REG_RCC_OFFSET 'h3D -#define MAC_PCU_REG_RCC_RX_CLEAR_CNT_FIELD 31:0 -#define MAC_PCU_REG_RCC_RX_CLEAR_CNT_RESET 0 - -#define MAC_PCU_REG_CC_OFFSET 'h3E -#define MAC_PCU_REG_CC_CYCLE_CNT_FIELD 31:0 -#define MAC_PCU_REG_CC_CYCLE_CNT_RESET 0 - -#define MAC_PCU_REG_QT1_OFFSET 'h3F -#define MAC_PCU_REG_QT1_NEXT_QUIET_FIELD 15:0 -#define MAC_PCU_REG_QT1_QUIET_ENABLE_FIELD 16 -#define MAC_PCU_REG_QT1_QUIET_ACK_CTS_ENABLE_FIELD 17 -#define MAC_PCU_REG_QT1_NEXT_QUIET_RESET 16'd0 -#define MAC_PCU_REG_QT1_QUIET_ENABLE_RESET 1'b0 -#define MAC_PCU_REG_QT1_QUIET_ACK_CTS_ENABLE_RESET 1'b1 - -#define MAC_PCU_REG_QT2_OFFSET 'h40 -#define MAC_PCU_REG_QT2_QUIET_PERIOD_FIELD 15:0 -#define MAC_PCU_REG_QT2_QUIET_DURATION_FIELD 31:16 -#define MAC_PCU_REG_QT2_QUIET_PERIOD_RESET 16'd0002 -#define MAC_PCU_REG_QT2_QUIET_DURATION_RESET 16'd0001 - -#define MAC_PCU_REG_TSF_OFFSET 'h41 -#define MAC_PCU_REG_TSF_INCREMENT_FIELD 7:0 -#define MAC_PCU_REG_TSF_INCREMENT_RESET 8'h01 - -#define MAC_PCU_REG_NOACK_OFFSET 'h42 -#define MAC_PCU_REG_NOACK_2_BIT_VALUES_FIELD 3:0 -#define MAC_PCU_REG_NOACK_BIT_OFFSET_FIELD 6:4 -#define MAC_PCU_REG_NOACK_BYTE_OFFSET_FIELD 8:7 -#define MAC_PCU_REG_NOACK_2_BIT_VALUES_RESET 4'h2 -#define MAC_PCU_REG_NOACK_BIT_OFFSET_RESET 3'h5 -#define MAC_PCU_REG_NOACK_BYTE_OFFSET_RESET 2'h0 - -#define MAC_PCU_REG_PHYERR_OFFSET 'h43 -#define MAC_PCU_REG_PHYERR_MASK_FIELD 31:0 -#define MAC_PCU_REG_PHYERR_MASK_RESET 32'h0 - -#define MAC_PCU_REG_XRLAT_OFFSET 'h44 -#define MAC_PCU_REG_XRLAT_XR_TX_DELAY_FIELD 11:0 -#define MAC_PCU_REG_XRLAT_XR_TX_DELAY_RESET 12'h168 - -#define MAC_PCU_REG_ACKSIFS_OFFSET_RESERVED 'h45 -#define MAC_PCU_REG_ACKSIFS_INCREMENT_FIELD_RESERVED 7:0 -#define MAC_PCU_REG_ACKSIFS_INCREMENT_RESET_RESERVED 8'h0 - -#define MAC_PCU_REG_MICQOSCTL_OFFSET 'h46 -#define MAC_PCU_REG_MICQOSCTL_FIELD 15:0 -#define MAC_PCU_REG_MICQOSCTL_ENABLE_FIELD 16 -#define MAC_PCU_REG_MICQOSCTL_RESET 16'h00aa -#define MAC_PCU_REG_MICQOSCTL_ENABLE_RESET 1'h1 - -#define MAC_PCU_REG_MICQOSSEL_OFFSET 'h47 -#define MAC_PCU_REG_MICQOSSEL_FIELD 31:0 -#define MAC_PCU_REG_MICQOSSEL_RESET 32'h00003210 - -#define MAC_PCU_REG_MISCMODE_OFFSET 'h48 -#define MAC_PCU_REG_MISCMODE_BSSID_MATCH_FORCE_FIELD 0 -#define MAC_PCU_REG_MISCMODE_ACKSIFS_MEMORY_FIELD_RESERVED 1 -#define MAC_PCU_REG_MISCMODE_MIC_NEW_LOCATION_FIELD 2 -#define MAC_PCU_REG_MISCMODE_TX_ADD_TSF_FIELD 3 -#define MAC_PCU_REG_MISCMODE_CCK_SIFS_MODE_FIELD 4 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MODE_FIELD_RESERVED 5 -#define MAC_PCU_REG_MISCMODE_BFCOEF_ENABLE_FIELD 6 -#define MAC_PCU_REG_MISCMODE_BFCOEF_UPDATE_SELF_GEN_FIELD 7 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MCAST_FIELD 8 -#define MAC_PCU_REG_MISCMODE_DUAL_CHAIN_ANT_MODE_FIELD 9 -#define MAC_PCU_REG_MISCMODE_FALCON_DESC_MODE_FIELD 10 -#define MAC_PCU_REG_MISCMODE_KC_RX_ANT_UPDATE_FIELD 11 -#define MAC_PCU_REG_MISCMODE_TXOP_TBTT_LIMIT_FIELD 12 -#define MAC_PCU_REG_MISCMODE_FALCON_BB_INTERFACE_FIELD 13 -#define MAC_PCU_REG_MISCMODE_MISS_BEACON_IN_SLEEP_FIELD 14 -#define MAC_PCU_REG_MISCMODE_BUG_12306_FIX_ENABLE_FIELD 17 -#define MAC_PCU_REG_MISCMODE_FORCE_QUIET_COLLISION_FIELD 18 -#define MAC_PCU_REG_MISCMODE_BUG_12549_FORCE_TXBF_FIELD 19 -#define MAC_PCU_REG_MISCMODE_BT_ANT_PREVENTS_RX_FIELD 20 -#define MAC_PCU_REG_MISCMODE_TBTT_PROTECT_FIELD 21 -#define MAC_PCU_REG_MISCMODE_HCF_POLL_CANCELS_NAV_FIELD 22 -#define MAC_PCU_REG_MISCMODE_RX_HCF_POLL_ENABLE_FIELD 23 -#define MAC_PCU_REG_MISCMODE_CLEAR_VMF_FIELD 24 -#define MAC_PCU_REG_MISCMODE_CLEAR_FIRST_HCF_FIELD 25 -#define MAC_PCU_REG_MISCMODE_ADHOC_MCAST_KEYID_ENABLE_FIELD 26 -#define MAC_PCU_REG_MISCMODE_ALLOW_RAC_FIELD 27 -#define MAC_PCU_REG_MISCMODE_BSSID_MATCH_FORCE_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_ACKSIFS_MEMORY_RESET_RESERVED 1'h0 -#define MAC_PCU_REG_MISCMODE_MIC_NEW_LOCATION_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_TX_ADD_TSF_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_CCK_SIFS_MODE_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MODE_RESET_RESERVED 1'h0 -#define MAC_PCU_REG_MISCMODE_BFCOEF_ENABLE_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_BFCOEF_UPDATE_SELF_GEN_RESET 1'h1 -#define MAC_PCU_REG_MISCMODE_BFCOEF_MCAST_RESET 1'h1 -#define MAC_PCU_REG_MISCMODE_DUAL_CHAIN_ANT_MODE_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_FALCON_DESC_MODE_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_KC_RX_ANT_UPDATE_RESET 1'h1 -#define MAC_PCU_REG_MISCMODE_TXOP_TBTT_LIMIT_RESET 1'b0 -#define MAC_PCU_REG_MISCMODE_FALCON_BB_INTERFACE_RESET 1'b0 -#define MAC_PCU_REG_MISCMODE_MISS_BEACON_IN_SLEEP_RESET 1'h1 -#define MAC_PCU_REG_MISCMODE_BUG_12306_FIX_ENABLE_RESET 1'h1 -#define MAC_PCU_REG_MISCMODE_FORCE_QUIET_COLLISION_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE_BUG_12549_FORCE_TXBF_RESET 1'b0 -#define MAC_PCU_REG_MISCMODE_BT_ANT_PREVENTS_RX_RESET 1'b1 -#define MAC_PCU_REG_MISCMODE_TBTT_PROTECT_RESET 1'b1 -#define MAC_PCU_REG_MISCMODE_HCF_POLL_CANCELS_NAV_RESET 1'b1 -#define MAC_PCU_REG_MISCMODE_RX_HCF_POLL_ENABLE_RESET 1'b1 -#define MAC_PCU_REG_MISCMODE_CLEAR_VMF_RESET 1'b0 -#define MAC_PCU_REG_MISCMODE_CLEAR_FIRST_HCF_RESET 1'b0 -#define MAC_PCU_REG_MISCMODE_ADHOC_MCAST_KEYID_ENABLE_RESET 1'b0 -#define MAC_PCU_REG_MISCMODE_ALLOW_RAC_RESET 1'b0 - -#define MAC_PCU_REG_FILTOFDM_OFFSET 'h49 -#define MAC_PCU_REG_FILTOFDM_CNT_FIELD 23:0 -#define MAC_PCU_REG_FILTOFDM_CNT_RESET 24'h0 - -#define MAC_PCU_REG_FILTCCK_OFFSET 'h4A -#define MAC_PCU_REG_FILTCCK_CNT_FIELD 23:0 -#define MAC_PCU_REG_FILTCCK_CNT_RESET 24'h0 - -#define MAC_PCU_REG_PHYCNT1_OFFSET 'h4B -#define MAC_PCU_REG_PHYCNT1_FIELD 23:0 -#define MAC_PCU_REG_PHYCNT1_RESET 24'h0 - -#define MAC_PCU_REG_PHYCNTMASK1_OFFSET 'h4C -#define MAC_PCU_REG_PHYCNTMASK1_FIELD 31:0 -#define MAC_PCU_REG_PHYCNTMASK1_RESET 32'h0 - -#define MAC_PCU_REG_PHYCNT2_OFFSET 'h4D -#define MAC_PCU_REG_PHYCNT2_FIELD 23:0 -#define MAC_PCU_REG_PHYCNT2_RESET 24'h0 - -#define MAC_PCU_REG_PHYCNTMASK2_OFFSET 'h4E -#define MAC_PCU_REG_PHYCNTMASK2_FIELD 31:0 -#define MAC_PCU_REG_PHYCNTMASK2_RESET 32'h0 - -#define MAC_PCU_REG_TSFTHRESH_OFFSET 'h4F -#define MAC_PCU_REG_TSFTHRESH_FIELD 15:0 -#define MAC_PCU_REG_TSFTHRESH_RESET 16'hFFFF - -//#define MAC_PCU_REG_TSFCAL_OFFSET 'h50 -//#define MAC_PCU_REG_TSFCAL_COUNT_FIELD 3:0 -//#define MAC_PCU_REG_TSFCAL_INTERVAL_FIELD 7:4 -//#define MAC_PCU_REG_TSFCAL_ENABLE_FIELD 8 -//#define MAC_PCU_REG_TSFCAL_AUTO_CAL_FIELD 9 -//#define MAC_PCU_REG_TSFCAL_VALUE_WE_FIELD 10 -//#define MAC_PCU_REG_TSFCAL_VALUE_FIELD 31:16 -//#define MAC_PCU_REG_TSFCAL_COUNT_RESET 'h8 -//#define MAC_PCU_REG_TSFCAL_INTERVAL_RESET 'ha -//#define MAC_PCU_REG_TSFCAL_ENABLE_RESET 'h1 -//#define MAC_PCU_REG_TSFCAL_AUTO_CAL_RESET 'h1 -//#define MAC_PCU_REG_TSFCAL_VALUE_WE_RESET 'h0 -//#define MAC_PCU_REG_TSFCAL_VALUE_RESET 'h8000 - -#define MAC_PCU_REG_PHYERR_EIFS_OFFSET 'h51 -#define MAC_PCU_REG_PHYERR_EIFS_MASK_FIELD 31:0 -#define MAC_PCU_REG_PHYERR_EIFS_MASK_RESET 'h0 - -//#define MAC_PCU_REG_SYNC1_OFFSET 'h52 -//#define MAC_PCU_REG_SYNC1_TIME_FIELD 30:0 -//#define MAC_PCU_REG_SYNC1_TIME_RESET 32'h0 - -//#define MAC_PCU_REG_SYNC2_OFFSET 'h53 -//#define MAC_PCU_REG_SYNC2_TIME_OFFSET_FIELD 7:0 -//#define MAC_PCU_REG_SYNC2_MASTER_FIELD 8 -//#define MAC_PCU_REG_SYNC2_REPLACE_FIELD 9 -//#define MAC_PCU_REG_SYNC2_TUNE_FIELD 10 -//#define MAC_PCU_REG_SYNC2_CLEAR_FIELD 11 -//#define MAC_PCU_REG_SYNC2_INTR_THRESH_FIELD 31:16 -//#define MAC_PCU_REG_SYNC2_TIME_OFFSET_RESET 8'h0 -//#define MAC_PCU_REG_SYNC2_MASTER_RESET 1'h0 -//#define MAC_PCU_REG_SYNC2_REPLACE_RESET 1'h0 -//#define MAC_PCU_REG_SYNC2_TUNE_RESET 1'h0 -//#define MAC_PCU_REG_SYNC2_CLEAR_RESET 1'h0 -//#define MAC_PCU_REG_SYNC2_INTR_THRESH_RESET 16'hFFFF - -//#define MAC_PCU_REG_SYNC3_OFFSET 'h54 -//#define MAC_PCU_REG_SYNC3_MCAST_ADDR_L_FIELD 31:0 -//#define MAC_PCU_REG_SYNC3_MCAST_ADDR_L_RESET 32'h0 - -//#define MAC_PCU_REG_SYNC4_OFFSET 'h55 -//#define MAC_PCU_REG_SYNC4_MCAST_ADDR_U_FIELD 15:0 -//#define MAC_PCU_REG_SYNC4_MCAST_ADDR_U_RESET 16'h0 - -//#define MAC_PCU_REG_SYNC5_OFFSET 'h56 -//#define MAC_PCU_REG_SYNC5_RX_TIME_FIELD 30:0 - -//#define MAC_PCU_REG_SYNC6_OFFSET 'h57 -//#define MAC_PCU_REG_SYNC6_INC_FIELD 31:0 - -//#define MAC_PCU_REG_SYNC7_OFFSET 'h58 -//#define MAC_PCU_REG_SYNC7_LAST_TIME_FIELD 30:0 - -//#define MAC_PCU_REG_SYNC8_OFFSET 'h59 -//#define MAC_PCU_REG_SYNC8_UPDATED_TIME_FIELD 30:0 - -#define MAC_PCU_REG_PHYCNT3_OFFSET 'h5A -#define MAC_PCU_REG_PHYCNT3_FIELD 23:0 -#define MAC_PCU_REG_PHYCNT3_RESET 24'h0 - -#define MAC_PCU_REG_PHYCNTMASK3_OFFSET 'h5B -#define MAC_PCU_REG_PHYCNTMASK3_FIELD 31:0 -#define MAC_PCU_REG_PHYCNTMASK3_RESET 32'h0 - -#define MAC_PCU_REG_BTMODE_OFFSET 'h5C -#define MAC_PCU_REG_BTMODE_TIME_EXTEND_FIELD 7:0 -#define MAC_PCU_REG_BTMODE_TXSTATE_EXTEND_FIELD 8 -#define MAC_PCU_REG_BTMODE_TX_FRAME_EXTEND_FIELD 9 -#define MAC_PCU_REG_BTMODE_MODE_FIELD 11:10 -#define MAC_PCU_REG_BTMODE_QUIET_FIELD 12 -#define MAC_PCU_REG_BTMODE_QCU_THRESH_FIELD 16:13 -#define MAC_PCU_REG_BTMODE_RX_CLEAR_POLARITY_FIELD 17 -#define MAC_PCU_REG_BTMODE_PRIORITY_TIME_FIELD 23:18 -#define MAC_PCU_REG_BTMODE_FIRST_SLOT_TIME_FIELD 31:24 -#define MAC_PCU_REG_BTMODE_TIME_EXTEND_RESET 8'h20 -#define MAC_PCU_REG_BTMODE_TXSTATE_EXTEND_RESET 1'b1 -#define MAC_PCU_REG_BTMODE_TX_FRAME_EXTEND_RESET 1'b1 -#define MAC_PCU_REG_BTMODE_MODE_RESET 2'h3 -#define MAC_PCU_REG_BTMODE_QUIET_RESET 1'b1 -#define MAC_PCU_REG_BTMODE_QCU_THRESH_RESET 4'b0001 -#define MAC_PCU_REG_BTMODE_RX_CLEAR_POLARITY_RESET 1'b0 -#define MAC_PCU_REG_BTMODE_PRIORITY_TIME_RESET 6'h05 -#define MAC_PCU_REG_BTMODE_FIRST_SLOT_TIME_RESET 8'h9B - -#define MAC_PCU_REG_BTWEIGHT_OFFSET 'h5D -#define MAC_PCU_REG_BTWEIGHT_BT_WEIGHT_FIELD 15:0 -#define MAC_PCU_REG_BTWEIGHT_WL_WEIGHT_FIELD 31:16 -#define MAC_PCU_REG_BTWEIGHT_BT_WEIGHT_RESET 16'b11_11_10_10_01_01_00_00 -#define MAC_PCU_REG_BTWEIGHT_WL_WEIGHT_RESET 16'b11_11_10_10_10_10_01_00 - -#define MAC_PCU_REG_HCF_OFFSET 'h5E -#define MAC_PCU_REG_HCF_TIMEOUT_FIELD 15:0 -#define MAC_PCU_REG_HCF_TIMEOUT_RESET 'h100 - -#define MAC_PCU_REG_BTMODE2_OFFSET 'h5F -#define MAC_PCU_REG_BTMODE2_BT_BCN_MISS_THRESH_FIELD 7:0 -#define MAC_PCU_REG_BTMODE2_BCN_MISS_CNT_FIELD 15:8 -#define MAC_PCU_REG_BTMODE2_BT_HOLD_RX_CLEAR_FIELD 16 -#define MAC_PCU_REG_BTMODE2_WL_CONTROL_ANT_FIELD 17 -#define MAC_PCU_REG_BTMODE2_RESPOND_TO_BT_ACTIVE_FIELD 18 -#define MAC_PCU_REG_BTMODE2_PROTECT_BT_AFTER_WAKEUP_FIELD 19 -#define MAC_PCU_REG_BTMODE2_DISABLE_BT_ANT_FIELD 20 -#define MAC_PCU_REG_BTMODE2_BT_BCN_MISS_THRESH_RESET 0 -#define MAC_PCU_REG_BTMODE2_BT_HOLD_RX_CLEAR_RESET 0 -#define MAC_PCU_REG_BTMODE2_WL_CONTROL_ANT_RESET 1'h0 -#define MAC_PCU_REG_BTMODE2_RESPOND_TO_BT_ACTIVE_RESET 1'h0 -#define MAC_PCU_REG_BTMODE2_PROTECT_BT_AFTER_WAKEUP_RESET 1'h0 -#define MAC_PCU_REG_BTMODE2_DISABLE_BT_ANT_RESET 1'h0 - -#define MAC_PCU_REG_BFCOEF1_OFFSET 'h60 -#define MAC_PCU_REG_BFCOEF1_UPPER_OFFSET 'h67 -#define MAC_PCU_REG_BFCOEF1_KEY_VALID_FIELD 31 -#define MAC_PCU_REG_BFCOEF1_KEYIDX_FIELD 30:24 -#define MAC_PCU_REG_BFCOEF1_TSF_FIELD 23:0 -#define MAC_PCU_REG_BFCOEF1_KEY_VALID_RESET 1'b0 - -#define MAC_PCU_REG_BFCOEF2_OFFSET 'h70 -#define MAC_PCU_REG_BFCOEF2_THRESH_FIELD 22:0 -#define MAC_PCU_REG_BFCOEF2_LOCK_FIELD 31:24 -#define MAC_PCU_REG_BFCOEF2_THRESH_RESET 23'b0 -#define MAC_PCU_REG_BFCOEF2_LOCK_RESET 8'b0 - -#define MAC_PCU_REG_KCMASK_OFFSET 'h71 -#define MAC_PCU_REG_KCMASK_47_32_FIELD 15:0 -#define MAC_PCU_REG_KCMASK_47_32_RESET 0 -#define MAC_PCU_REG_KCMASK_31_0_FIELD 16 -#define MAC_PCU_REG_KCMASK_31_0_RESET 0 - -#define MAC_PCU_REG_TXSIFS_OFFSET 'h74 -#define MAC_PCU_REG_TXSIFS_SIFS_TIME_FIELD 7:0 -#define MAC_PCU_REG_TXSIFS_TX_LATENCY_FIELD 11:8 -#define MAC_PCU_REG_TXSIFS_ACK_SHIFT_FIELD 14:12 -#define MAC_PCU_REG_TXSIFS_SIFS_TIME_RESET 16 -#define MAC_PCU_REG_TXSIFS_TX_LATENCY_RESET 2 -#define MAC_PCU_REG_TXSIFS_ACK_SHIFT_RESET 3 - -#define MAC_PCU_REG_TXOP_X_OFFSET 'h7b -#define MAC_PCU_REG_TXOP_X_FIELD 7:0 -#define MAC_PCU_REG_TXOP_X_RESET 0 - -#define MAC_PCU_REG_TXOP_0_3_OFFSET 'h7c -#define MAC_PCU_REG_TXOP_0_FIELD 7:0 -#define MAC_PCU_REG_TXOP_1_FIELD 15:8 -#define MAC_PCU_REG_TXOP_2_FIELD 23:16 -#define MAC_PCU_REG_TXOP_3_FIELD 31:24 -#define MAC_PCU_REG_TXOP_0_RESET 0 -#define MAC_PCU_REG_TXOP_1_RESET 0 -#define MAC_PCU_REG_TXOP_2_RESET 0 -#define MAC_PCU_REG_TXOP_3_RESET 0 - -#define MAC_PCU_REG_TXOP_4_7_OFFSET 'h7d -#define MAC_PCU_REG_TXOP_4_FIELD 7:0 -#define MAC_PCU_REG_TXOP_5_FIELD 15:8 -#define MAC_PCU_REG_TXOP_6_FIELD 23:16 -#define MAC_PCU_REG_TXOP_7_FIELD 31:24 -#define MAC_PCU_REG_TXOP_4_RESET 0 -#define MAC_PCU_REG_TXOP_5_RESET 0 -#define MAC_PCU_REG_TXOP_6_RESET 0 -#define MAC_PCU_REG_TXOP_7_RESET 0 - -#define MAC_PCU_REG_TXOP_8_11_OFFSET 'h7e -#define MAC_PCU_REG_TXOP_8_FIELD 7:0 -#define MAC_PCU_REG_TXOP_9_FIELD 15:8 -#define MAC_PCU_REG_TXOP_10_FIELD 23:16 -#define MAC_PCU_REG_TXOP_11_FIELD 31:24 -#define MAC_PCU_REG_TXOP_8_RESET 0 -#define MAC_PCU_REG_TXOP_9_RESET 0 -#define MAC_PCU_REG_TXOP_10_RESET 0 -#define MAC_PCU_REG_TXOP_11_RESET 0 - -#define MAC_PCU_REG_TXOP_12_15_OFFSET 'h7f -#define MAC_PCU_REG_TXOP_12_FIELD 7:0 -#define MAC_PCU_REG_TXOP_13_FIELD 15:8 -#define MAC_PCU_REG_TXOP_14_FIELD 23:16 -#define MAC_PCU_REG_TXOP_15_FIELD 31:24 -#define MAC_PCU_REG_TXOP_12_RESET 0 -#define MAC_PCU_REG_TXOP_13_RESET 0 -#define MAC_PCU_REG_TXOP_14_RESET 0 -#define MAC_PCU_REG_TXOP_15_RESET 0 - -#define MAC_PCU_REG_GNRCTMR_N_OFFSET 'h80 -#define MAC_PCU_REG_GNRCTMR_N_UPPER_OFFSET 'h87 -#define MAC_PCU_REG_GNRCTMR_N_FIELD 31:0 - -#define MAC_PCU_REG_GNRCTMR_P_OFFSET 'h88 -#define MAC_PCU_REG_GNRCTMR_P_UPPER_OFFSET 'h8F -#define MAC_PCU_REG_GNRCTMR_P_FIELD 27:0 - -#define MAC_PCU_REG_GNRCTMR_M_OFFSET 'h90 -#define MAC_PCU_REG_GNRCTMR_M_ENABLE_FIELD 7:0 -#define MAC_PCU_REG_GNRCTMR_M_OVERFLOW_INDEX_FIELD 10:8 -#define MAC_PCU_REG_GNRCTMR_M_THRESH_FIELD 31:12 -#define MAC_PCU_REG_GNRCTMR_M_ENABLE_RESET 8'h0 -#define MAC_PCU_REG_GNRCTMR_M_THRESH_RESET 20'h00100 - -#define MAC_PCU_REG_SLP32_MODE_OFFSET 'h91 -#define MAC_PCU_REG_SLP32_MODE_HALF_CLK_LATENCY_FIELD 19:0 -#define MAC_PCU_REG_SLP32_MODE_ENABLE_FIELD 20 -#define MAC_PCU_REG_SLP32_MODE_TSF_WRITE_STAT_FIELD 21 -#define MAC_PCU_REG_SLP32_MODE_HALF_CLK_LATENCY_RESET 20'h0F424 -#define MAC_PCU_REG_SLP32_MODE_ENABLE_RESET 1'b1 - -#define MAC_PCU_REG_SLP32_WAKE_OFFSET 'h92 -#define MAC_PCU_REG_SLP32_WAKE_XTL_TIME_FIELD 15:0 -#define MAC_PCU_REG_SLP32_WAKE_XTL_TIME_RESET 16'h07EF - -#define MAC_PCU_REG_SLP32_TSF_INC_OFFSET 'h93 -#define MAC_PCU_REG_SLP32_TSF_INC_FIELD 19:0 -#define MAC_PCU_REG_SLP32_TSF_INC_RESET 20'h1E848 - -#define MAC_PCU_REG_SLPMIB1_OFFSET 'h94 -#define MAC_PCU_REG_SLPMIB1_SLEEP_CNT_FIELD 31:0 - -#define MAC_PCU_REG_SLPMIB2_OFFSET 'h95 -#define MAC_PCU_REG_SLPMIB2_CYCLE_CNT_FIELD 31:0 - -#define MAC_PCU_REG_SLPMIB3_OFFSET 'h96 -#define MAC_PCU_REG_SLPMIB3_CLR_CNT_FIELD 0 -#define MAC_PCU_REG_SLPMIB3_PEND_FIELD 1 - -#define MAC_PCU_REG_MISCMODE2_OFFSET 'h97 -#define MAC_PCU_REG_MISCMODE2_MGMT_CRYPTO_ENABLE_FIELD 0 -#define MAC_PCU_REG_MISCMODE2_NO_CRYPTO_FOR_NON_DATA_PKT_FIELD 1 -#define MAC_PCU_REG_MISCMODE2_MGMT_QOS_FIELD 15:8 -#define MAC_PCU_REG_MISCMODE2_BC_MC_WAPI_MODE_FIELD 16 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_FOR_1ST_PKT_FIELD 17 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_IF_ZERO_FIELD 18 -#define MAC_PCU_REG_MISCMODE2_MGMT_CRYPTO_ENABLE_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE2_NO_CRYPTO_FOR_NON_DATA_PKT_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE2_MGMT_QOS_RESET 8'h10 -#define MAC_PCU_REG_MISCMODE2_BC_MC_WAPI_MODE_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_FOR_1ST_PKT_RESET 1'h0 -#define MAC_PCU_REG_MISCMODE2_IGNORE_TXOP_IF_ZERO_RESET 1'h0 - -#define MAC_PCU_REG_SLP4_OFFSET 'h98 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_DUR_FIELD 15:0 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_ENABLE_FIELD 16 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_DUR_RESET 16'h5 -#define MAC_PCU_REG_SLP4_CAB_AWAKE_ENABLE_RESET 1'h0 - -#define MAC_PCU_REG_SLP5_OFFSET 'h99 -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_FIELD 23:0 -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_ENABLE_FIELD 24 -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_RESET 24'hff_ffff -#define MAC_PCU_REG_SLP5_BMISS_TIMEOUT_ENABLE_RESET 1'h0 - -#define MAC_PCU_REG_MCICTL_OFFSET 'h9a -#define MAC_PCU_REG_MCICTL_MCI_ENABLE_FIELD 0 -#define MAC_PCU_REG_MCICTL_OLA_ENABLE_FIELD 1 -#define MAC_PCU_REG_MCICTL_PREEMPT_ENABLE_FIELD 2 -#define MAC_PCU_REG_MCICTL_CHANNEL_BUSY_ENABLE_FIELD 3 -#define MAC_PCU_REG_MCICTL_EARLY_NOTIFY_DELAY_FIELD 9:4 -#define MAC_PCU_REG_MCICTL_BMISS_FORCE_WL_FIELD 10 -#define MAC_PCU_REG_MCICTL_SLEEP_FORCE_BT_FIELD 11 -#define MAC_PCU_REG_MCICTL_HP_QCU_STOMP_BT_FIELD 12 -#define MAC_PCU_REG_MCICTL_MCI_BUSY_FIELD 31 -#define MAC_PCU_REG_MCICTL_MCI_ENABLE_RESET 1'h0 -#define MAC_PCU_REG_MCICTL_OLA_ENABLE_RESET 1'h1 -#define MAC_PCU_REG_MCICTL_PREEMPT_ENABLE_RESET 1'h1 -#define MAC_PCU_REG_MCICTL_CHANNEL_BUSY_ENABLE_RESET 1'h1 -#define MAC_PCU_REG_MCICTL_EARLY_NOTIFY_DELAY_RESET 6'h5 -#define MAC_PCU_REG_MCICTL_BMISS_FORCE_WL_RESET 1'b0 -#define MAC_PCU_REG_MCICTL_SLEEP_FORCE_BT_RESET 1'b1 -#define MAC_PCU_REG_MCICTL_HP_QCU_STOMP_BT_RESET 1'b0 - -#define MAC_PCU_REG_MCIISR_OFFSET 'h9b -#define MAC_PCU_REG_MCIISR_ACT_RPT_RCV_INT_FIELD 0 -#define MAC_PCU_REG_MCIISR_ACT_DEN_RCV_INT_FIELD 1 -#define MAC_PCU_REG_MCIISR_FRQ_RPT_RCV_INT_FIELD 2 -#define MAC_PCU_REG_MCIISR_QOS_RPT_RCV_INT_FIELD 3 -#define MAC_PCU_REG_MCIISR_GEN_RPT_RCV_INT_FIELD 4 -#define MAC_PCU_REG_MCIISR_ACT_RPT_RCV_INT_RESET 1'b0 -#define MAC_PCU_REG_MCIISR_ACT_DEN_RCV_INT_RESET 1'b0 -#define MAC_PCU_REG_MCIISR_FRQ_RPT_RCV_INT_RESET 1'b0 -#define MAC_PCU_REG_MCIISR_QOS_RPT_RCV_INT_RESET 1'b0 -#define MAC_PCU_REG_MCIISR_GEN_RPT_RCV_INT_RESET 1'b0 - -#define MAC_PCU_REG_MCIIER_OFFSET 'h9c -#define MAC_PCU_REG_MCIIER_ACT_RPT_RCV_INT_ENABLE_FIELD 0 -#define MAC_PCU_REG_MCIIER_ACT_DEN_RCV_INT_ENABLE_FIELD 1 -#define MAC_PCU_REG_MCIIER_FRQ_RPT_RCV_INT_ENABLE_FIELD 2 -#define MAC_PCU_REG_MCIIER_QOS_RPT_RCV_INT_ENABLE_FIELD 3 -#define MAC_PCU_REG_MCIIER_GEN_RPT_RCV_INT_ENABLE_FIELD 4 -#define MAC_PCU_REG_MCIIER_ACT_RPT_RCV_INT_ENABLE_RESET 1'b0 -#define MAC_PCU_REG_MCIIER_ACT_DEN_RCV_INT_ENABLE_RESET 1'b0 -#define MAC_PCU_REG_MCIIER_FRQ_RPT_RCV_INT_ENABLE_RESET 1'b0 -#define MAC_PCU_REG_MCIIER_QOS_RPT_RCV_INT_ENABLE_RESET 1'b0 -#define MAC_PCU_REG_MCIIER_GEN_RPT_RCV_INT_ENABLE_RESET 1'b0 - -#define MAC_PCU_REG_MCIWLP_OFFSET 'h9d -#define MAC_PCU_REG_MCIWLP_RESET 30'h0 - -#define MAC_PCU_REG_MCIARW_OFFSET 'h9e -#define MAC_PCU_REG_MCIARW_RESET 32'h0 - -#define MAC_PCU_REG_MCIARR_OFFSET 'h9f - -#define MAC_PCU_REG_MCIADW_OFFSET 'ha0 -#define MAC_PCU_REG_MCIADW_RESET 32'h0 - -#define MAC_PCU_REG_MCIADR_OFFSET 'ha1 - -#define MAC_PCU_REG_MCIFRW_OFFSET 'ha2 -#define MAC_PCU_REG_MCIFRW_RESET 32'h0 - -#define MAC_PCU_REG_MCIFRR_OFFSET 'ha3 - -#define MAC_PCU_REG_MCIQRW_OFFSET 'ha4 -#define MAC_PCU_REG_MCIQRW_RESET 32'h0 - -#define MAC_PCU_REG_MCIQRR_OFFSET 'ha5 - -#define MAC_PCU_REG_MCIGRW_OFFSET 'ha6 -#define MAC_PCU_REG_MCIGRW_RESET 32'h0 - -#define MAC_PCU_REG_MCIGRR_OFFSET 'ha7 - -#define MAC_PCU_REG_MCISTAT_OFFSET 'ha8 -#define MAC_PCU_REG_MCISTAT_ACT_RPT_RCV_CNT_FIELD 7:0 -#define MAC_PCU_REG_MCISTAT_QC_CNT_FIELD 15:8 -#define MAC_PCU_REG_MCISTAT_OLA_CNT_FIELD 23:16 -#define MAC_PCU_REG_MCISTAT_PREEMPT_CNT_FIELD 31:24 -#define MAC_PCU_REG_MCISTAT_ACT_RPT_RCV_CNT_RESET 8'h0 -#define MAC_PCU_REG_MCISTAT_QC_CNT_RESET 8'h0 -#define MAC_PCU_REG_MCISTAT_OLA_CNT_RESET 8'h0 -#define MAC_PCU_REG_MCISTAT_PREEMPT_CNT_RESET 8'h0 - -#define MAC_PCU_REG_BASIC_RATE_SET0_OFFSET 'ha9 -#define MAC_PCU_REG_BRATE_1MB_L_FIELD 4:0 -#define MAC_PCU_REG_BRATE_2MB_L_FIELD 9:5 -#define MAC_PCU_REG_BRATE_2MB_S_FIELD 14:10 -#define MAC_PCU_REG_BRATE_5_5MB_L_FIELD 19:15 -#define MAC_PCU_REG_BRATE_5_5MB_S_FIELD 24:20 -#define MAC_PCU_REG_BRATE_11MB_L_FIELD 29:25 -#define MAC_PCU_REG_BRATE_1MB_L_RESET #CCK_RATE_1Mb_L -#define MAC_PCU_REG_BRATE_2MB_L_RESET #CCK_RATE_2Mb_L -#define MAC_PCU_REG_BRATE_2MB_S_RESET #CCK_RATE_2Mb_S -#define MAC_PCU_REG_BRATE_5_5MB_L_RESET #CCK_RATE_5_5Mb_L -#define MAC_PCU_REG_BRATE_5_5MB_S_RESET #CCK_RATE_5_5Mb_S -#define MAC_PCU_REG_BRATE_11MB_L_RESET #CCK_RATE_11Mb_L - -#define MAC_PCU_REG_BASIC_RATE_SET1_OFFSET 'haa -#define MAC_PCU_REG_BRATE_11MB_S_FIELD 4:0 -#define MAC_PCU_REG_BRATE_6MB_FIELD 9:5 -#define MAC_PCU_REG_BRATE_9MB_FIELD 14:10 -#define MAC_PCU_REG_BRATE_12MB_FIELD 19:15 -#define MAC_PCU_REG_BRATE_18MB_FIELD 24:20 -#define MAC_PCU_REG_BRATE_24MB_FIELD 29:25 -#define MAC_PCU_REG_BRATE_11MB_S_RESET #CCK_RATE_11Mb_S -#define MAC_PCU_REG_BRATE_6MB_RESET #OFDM_RATE_6Mb -#define MAC_PCU_REG_BRATE_9MB_RESET #OFDM_RATE_6Mb -#define MAC_PCU_REG_BRATE_12MB_RESET #OFDM_RATE_12Mb -#define MAC_PCU_REG_BRATE_18MB_RESET #OFDM_RATE_12Mb -#define MAC_PCU_REG_BRATE_24MB_RESET #OFDM_RATE_24Mb - -#define MAC_PCU_REG_BASIC_RATE_SET2_OFFSET 'hab -#define MAC_PCU_REG_BRATE_36MB_FIELD 4:0 -#define MAC_PCU_REG_BRATE_48MB_FIELD 9:5 -#define MAC_PCU_REG_BRATE_54MB_FIELD 14:10 -#define MAC_PCU_REG_BRATE_36MB_RESET #OFDM_RATE_24Mb -#define MAC_PCU_REG_BRATE_48MB_RESET #OFDM_RATE_24Mb -#define MAC_PCU_REG_BRATE_54MB_RESET #OFDM_RATE_24Mb - -#define MAC_PCU_REG_SEC_BSSID_L32_OFFSET 'hac -#define MAC_PCU_REG_SEC_BSSID_L32_FIELD 31:0 -#define MAC_PCU_REG_SEC_BSSID_L32_RESET 32'h0 - -#define MAC_PCU_REG_SEC_BSSID_U16_OFFSET 'had -#define MAC_PCU_REG_SEC_BSSID_U16_FIELD 15:0 -#define MAC_PCU_REG_SEC_BSSID_ENABLE_FIELD 16 -#define MAC_PCU_REG_SEC_BSSID_U16_RESET 16'h0 -#define MAC_PCU_REG_SEC_BSSID_ENABLE_RESET 1'b0 - -#define MAC_PCU_REG_FTYPE_OFFSET 'h140 -#define MAC_PCU_REG_FTYPE_UPPER_OFFSET 'h17F -#define MAC_PCU_REG_FTYPE_BFCOEF_RX_UPDATE_NORMAL_FIELD 0 -#define MAC_PCU_REG_FTYPE_BFCOEF_RX_UPDATE_SELF_GEN_FIELD 1 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_NORMAL_FIELD 2 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_SELF_GEN_FIELD 3 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_GEN_FIELD 4 -#define MAC_PCU_REG_FTYPE_BFCOEF_TX_ENABLE_MCAST_FIELD 5 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_ALL_FIELD 6 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_DIRECTED_FIELD 7 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_MCAST_FIELD 8 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_IF_BCAST_FIELD 9 -#define MAC_PCU_REG_FTYPE_FILTER_PASS_MC_BC_BSSID_FIELD 10 - -#define MAC_PCU_REG_ACKSIFSMEM_OFFSET_RESERVED 'h1A0 -#define MAC_PCU_REG_ACKSIFSMEM_UPPER_OFFSET_RESERVED 'h1BF -#define MAC_PCU_REG_ACKSIFSMEM_NORMAL_FIELD_RESERVED 9:0 -#define MAC_PCU_REG_ACKSIFSMEM_TURBO_FIELD_RESERVED 19:10 - -#define MAC_PCU_REG_DUR_OFFSET 'h1C0 -#define MAC_PCU_REG_DUR_UPPER_OFFSET 'h1DF -#define MAC_PCU_REG_DUR_RATE_TO_DURATION_FIELD 15:0 - -#define MAC_PCU_REG_RTD_OFFSET 'h1F0 -#define MAC_PCU_REG_RTD_UPPER_OFFSET 'h1F7 -#define MAC_PCU_REG_RTD_RATE_TO_DB_0_FIELD 4:0 -#define MAC_PCU_REG_RTD_RATE_TO_DB_1_FIELD 12:8 -#define MAC_PCU_REG_RTD_RATE_TO_DB_2_FIELD 20:16 -#define MAC_PCU_REG_RTD_RATE_TO_DB_3_FIELD 28:24 - -#define MAC_PCU_REG_DTR_OFFSET 'h1F8 -#define MAC_PCU_REG_DTR_UPPER_OFFSET 'h1FF -#define MAC_PCU_REG_DTR_DB_TO_RATE_0_FIELD 4:0 -#define MAC_PCU_REG_DTR_DB_TO_RATE_1_FIELD 12:8 -#define MAC_PCU_REG_DTR_DB_TO_RATE_2_FIELD 20:16 -#define MAC_PCU_REG_DTR_DB_TO_RATE_3_FIELD 28:24 - -#define MAC_PCU_REG_KC_OFFSET 'h200 -#define MAC_PCU_REG_KC_UPPER_OFFSET 'h5FF -#define MAC_PCU_REG_KC_KEY_31_0_FIELD 31:0 -#define MAC_PCU_REG_KC_KEY_47_32_FIELD 15:0 -#define MAC_PCU_REG_KC_KEY_79_48_FIELD 31:0 -#define MAC_PCU_REG_KC_KEY_95_80_FIELD 15:0 -#define MAC_PCU_REG_KC_KEY_127_96_FIELD 31:0 -#define MAC_PCU_REG_KC_KEY_TYPE_FIELD 2:0 -#define MAC_PCU_REG_KC_LAST_ANTENNA_FIELD 3 -#define MAC_PCU_REG_KC_ASYNC_ACK_OFFSET_FIELD 8:4 -#define MAC_PCU_REG_KC_UPDATE_BEAM_FORMING_FIELD 9 -#define MAC_PCU_REG_KC_RX_CHAIN_0_ACK_ANT_FIELD 10 -#define MAC_PCU_REG_KC_RX_CHAIN_1_ACK_ANT_FIELD 11 -#define MAC_PCU_REG_KC_TX_CHAIN_0_ANT_SEL_FIELD 12 -#define MAC_PCU_REG_KC_TX_CHAIN_1_ANT_SEL_FIELD 13 -#define MAC_PCU_REG_KC_TX_CHAIN_SEL_FIELD 14 -#define MAC_PCU_REG_KC_ADDR_32_1_FIELD 31:0 -#define MAC_PCU_REG_KC_ADDR_47_33_FIELD 14:0 -#define MAC_PCU_REG_KC_VALID_FIELD 1 - -//Misc -#define ELEM_START 36 -#define CFP_ELEM 4 - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_host_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_host_reg.h deleted file mode 100644 index f836ae47a303..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_host_reg.h +++ /dev/null @@ -1,386 +0,0 @@ -#ifndef _MBOX_HOST_REG_REG_H_ -#define _MBOX_HOST_REG_REG_H_ - -#define HOST_INT_STATUS_ADDRESS 0x00000400 -#define HOST_INT_STATUS_OFFSET 0x00000400 -#define HOST_INT_STATUS_ERROR_MSB 7 -#define HOST_INT_STATUS_ERROR_LSB 7 -#define HOST_INT_STATUS_ERROR_MASK 0x00000080 -#define HOST_INT_STATUS_ERROR_GET(x) (((x) & HOST_INT_STATUS_ERROR_MASK) >> HOST_INT_STATUS_ERROR_LSB) -#define HOST_INT_STATUS_ERROR_SET(x) (((x) << HOST_INT_STATUS_ERROR_LSB) & HOST_INT_STATUS_ERROR_MASK) -#define HOST_INT_STATUS_CPU_MSB 6 -#define HOST_INT_STATUS_CPU_LSB 6 -#define HOST_INT_STATUS_CPU_MASK 0x00000040 -#define HOST_INT_STATUS_CPU_GET(x) (((x) & HOST_INT_STATUS_CPU_MASK) >> HOST_INT_STATUS_CPU_LSB) -#define HOST_INT_STATUS_CPU_SET(x) (((x) << HOST_INT_STATUS_CPU_LSB) & HOST_INT_STATUS_CPU_MASK) -#define HOST_INT_STATUS_DRAGON_INT_MSB 5 -#define HOST_INT_STATUS_DRAGON_INT_LSB 5 -#define HOST_INT_STATUS_DRAGON_INT_MASK 0x00000020 -#define HOST_INT_STATUS_DRAGON_INT_GET(x) (((x) & HOST_INT_STATUS_DRAGON_INT_MASK) >> HOST_INT_STATUS_DRAGON_INT_LSB) -#define HOST_INT_STATUS_DRAGON_INT_SET(x) (((x) << HOST_INT_STATUS_DRAGON_INT_LSB) & HOST_INT_STATUS_DRAGON_INT_MASK) -#define HOST_INT_STATUS_COUNTER_MSB 4 -#define HOST_INT_STATUS_COUNTER_LSB 4 -#define HOST_INT_STATUS_COUNTER_MASK 0x00000010 -#define HOST_INT_STATUS_COUNTER_GET(x) (((x) & HOST_INT_STATUS_COUNTER_MASK) >> HOST_INT_STATUS_COUNTER_LSB) -#define HOST_INT_STATUS_COUNTER_SET(x) (((x) << HOST_INT_STATUS_COUNTER_LSB) & HOST_INT_STATUS_COUNTER_MASK) -#define HOST_INT_STATUS_MBOX_DATA_MSB 3 -#define HOST_INT_STATUS_MBOX_DATA_LSB 0 -#define HOST_INT_STATUS_MBOX_DATA_MASK 0x0000000f -#define HOST_INT_STATUS_MBOX_DATA_GET(x) (((x) & HOST_INT_STATUS_MBOX_DATA_MASK) >> HOST_INT_STATUS_MBOX_DATA_LSB) -#define HOST_INT_STATUS_MBOX_DATA_SET(x) (((x) << HOST_INT_STATUS_MBOX_DATA_LSB) & HOST_INT_STATUS_MBOX_DATA_MASK) - -#define CPU_INT_STATUS_ADDRESS 0x00000401 -#define CPU_INT_STATUS_OFFSET 0x00000401 -#define CPU_INT_STATUS_BIT_MSB 7 -#define CPU_INT_STATUS_BIT_LSB 0 -#define CPU_INT_STATUS_BIT_MASK 0x000000ff -#define CPU_INT_STATUS_BIT_GET(x) (((x) & CPU_INT_STATUS_BIT_MASK) >> CPU_INT_STATUS_BIT_LSB) -#define CPU_INT_STATUS_BIT_SET(x) (((x) << CPU_INT_STATUS_BIT_LSB) & CPU_INT_STATUS_BIT_MASK) - -#define ERROR_INT_STATUS_ADDRESS 0x00000402 -#define ERROR_INT_STATUS_OFFSET 0x00000402 -#define ERROR_INT_STATUS_SPI_MSB 3 -#define ERROR_INT_STATUS_SPI_LSB 3 -#define ERROR_INT_STATUS_SPI_MASK 0x00000008 -#define ERROR_INT_STATUS_SPI_GET(x) (((x) & ERROR_INT_STATUS_SPI_MASK) >> ERROR_INT_STATUS_SPI_LSB) -#define ERROR_INT_STATUS_SPI_SET(x) (((x) << ERROR_INT_STATUS_SPI_LSB) & ERROR_INT_STATUS_SPI_MASK) -#define ERROR_INT_STATUS_WAKEUP_MSB 2 -#define ERROR_INT_STATUS_WAKEUP_LSB 2 -#define ERROR_INT_STATUS_WAKEUP_MASK 0x00000004 -#define ERROR_INT_STATUS_WAKEUP_GET(x) (((x) & ERROR_INT_STATUS_WAKEUP_MASK) >> ERROR_INT_STATUS_WAKEUP_LSB) -#define ERROR_INT_STATUS_WAKEUP_SET(x) (((x) << ERROR_INT_STATUS_WAKEUP_LSB) & ERROR_INT_STATUS_WAKEUP_MASK) -#define ERROR_INT_STATUS_RX_UNDERFLOW_MSB 1 -#define ERROR_INT_STATUS_RX_UNDERFLOW_LSB 1 -#define ERROR_INT_STATUS_RX_UNDERFLOW_MASK 0x00000002 -#define ERROR_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & ERROR_INT_STATUS_RX_UNDERFLOW_MASK) >> ERROR_INT_STATUS_RX_UNDERFLOW_LSB) -#define ERROR_INT_STATUS_RX_UNDERFLOW_SET(x) (((x) << ERROR_INT_STATUS_RX_UNDERFLOW_LSB) & ERROR_INT_STATUS_RX_UNDERFLOW_MASK) -#define ERROR_INT_STATUS_TX_OVERFLOW_MSB 0 -#define ERROR_INT_STATUS_TX_OVERFLOW_LSB 0 -#define ERROR_INT_STATUS_TX_OVERFLOW_MASK 0x00000001 -#define ERROR_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & ERROR_INT_STATUS_TX_OVERFLOW_MASK) >> ERROR_INT_STATUS_TX_OVERFLOW_LSB) -#define ERROR_INT_STATUS_TX_OVERFLOW_SET(x) (((x) << ERROR_INT_STATUS_TX_OVERFLOW_LSB) & ERROR_INT_STATUS_TX_OVERFLOW_MASK) - -#define COUNTER_INT_STATUS_ADDRESS 0x00000403 -#define COUNTER_INT_STATUS_OFFSET 0x00000403 -#define COUNTER_INT_STATUS_COUNTER_MSB 7 -#define COUNTER_INT_STATUS_COUNTER_LSB 0 -#define COUNTER_INT_STATUS_COUNTER_MASK 0x000000ff -#define COUNTER_INT_STATUS_COUNTER_GET(x) (((x) & COUNTER_INT_STATUS_COUNTER_MASK) >> COUNTER_INT_STATUS_COUNTER_LSB) -#define COUNTER_INT_STATUS_COUNTER_SET(x) (((x) << COUNTER_INT_STATUS_COUNTER_LSB) & COUNTER_INT_STATUS_COUNTER_MASK) - -#define MBOX_FRAME_ADDRESS 0x00000404 -#define MBOX_FRAME_OFFSET 0x00000404 -#define MBOX_FRAME_RX_EOM_MSB 7 -#define MBOX_FRAME_RX_EOM_LSB 4 -#define MBOX_FRAME_RX_EOM_MASK 0x000000f0 -#define MBOX_FRAME_RX_EOM_GET(x) (((x) & MBOX_FRAME_RX_EOM_MASK) >> MBOX_FRAME_RX_EOM_LSB) -#define MBOX_FRAME_RX_EOM_SET(x) (((x) << MBOX_FRAME_RX_EOM_LSB) & MBOX_FRAME_RX_EOM_MASK) -#define MBOX_FRAME_RX_SOM_MSB 3 -#define MBOX_FRAME_RX_SOM_LSB 0 -#define MBOX_FRAME_RX_SOM_MASK 0x0000000f -#define MBOX_FRAME_RX_SOM_GET(x) (((x) & MBOX_FRAME_RX_SOM_MASK) >> MBOX_FRAME_RX_SOM_LSB) -#define MBOX_FRAME_RX_SOM_SET(x) (((x) << MBOX_FRAME_RX_SOM_LSB) & MBOX_FRAME_RX_SOM_MASK) - -#define RX_LOOKAHEAD_VALID_ADDRESS 0x00000405 -#define RX_LOOKAHEAD_VALID_OFFSET 0x00000405 -#define RX_LOOKAHEAD_VALID_MBOX_MSB 3 -#define RX_LOOKAHEAD_VALID_MBOX_LSB 0 -#define RX_LOOKAHEAD_VALID_MBOX_MASK 0x0000000f -#define RX_LOOKAHEAD_VALID_MBOX_GET(x) (((x) & RX_LOOKAHEAD_VALID_MBOX_MASK) >> RX_LOOKAHEAD_VALID_MBOX_LSB) -#define RX_LOOKAHEAD_VALID_MBOX_SET(x) (((x) << RX_LOOKAHEAD_VALID_MBOX_LSB) & RX_LOOKAHEAD_VALID_MBOX_MASK) - -#define RX_LOOKAHEAD0_ADDRESS 0x00000408 -#define RX_LOOKAHEAD0_OFFSET 0x00000408 -#define RX_LOOKAHEAD0_DATA_MSB 7 -#define RX_LOOKAHEAD0_DATA_LSB 0 -#define RX_LOOKAHEAD0_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD0_DATA_GET(x) (((x) & RX_LOOKAHEAD0_DATA_MASK) >> RX_LOOKAHEAD0_DATA_LSB) -#define RX_LOOKAHEAD0_DATA_SET(x) (((x) << RX_LOOKAHEAD0_DATA_LSB) & RX_LOOKAHEAD0_DATA_MASK) - -#define RX_LOOKAHEAD1_ADDRESS 0x0000040c -#define RX_LOOKAHEAD1_OFFSET 0x0000040c -#define RX_LOOKAHEAD1_DATA_MSB 7 -#define RX_LOOKAHEAD1_DATA_LSB 0 -#define RX_LOOKAHEAD1_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD1_DATA_GET(x) (((x) & RX_LOOKAHEAD1_DATA_MASK) >> RX_LOOKAHEAD1_DATA_LSB) -#define RX_LOOKAHEAD1_DATA_SET(x) (((x) << RX_LOOKAHEAD1_DATA_LSB) & RX_LOOKAHEAD1_DATA_MASK) - -#define RX_LOOKAHEAD2_ADDRESS 0x00000410 -#define RX_LOOKAHEAD2_OFFSET 0x00000410 -#define RX_LOOKAHEAD2_DATA_MSB 7 -#define RX_LOOKAHEAD2_DATA_LSB 0 -#define RX_LOOKAHEAD2_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD2_DATA_GET(x) (((x) & RX_LOOKAHEAD2_DATA_MASK) >> RX_LOOKAHEAD2_DATA_LSB) -#define RX_LOOKAHEAD2_DATA_SET(x) (((x) << RX_LOOKAHEAD2_DATA_LSB) & RX_LOOKAHEAD2_DATA_MASK) - -#define RX_LOOKAHEAD3_ADDRESS 0x00000414 -#define RX_LOOKAHEAD3_OFFSET 0x00000414 -#define RX_LOOKAHEAD3_DATA_MSB 7 -#define RX_LOOKAHEAD3_DATA_LSB 0 -#define RX_LOOKAHEAD3_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD3_DATA_GET(x) (((x) & RX_LOOKAHEAD3_DATA_MASK) >> RX_LOOKAHEAD3_DATA_LSB) -#define RX_LOOKAHEAD3_DATA_SET(x) (((x) << RX_LOOKAHEAD3_DATA_LSB) & RX_LOOKAHEAD3_DATA_MASK) - -#define INT_STATUS_ENABLE_ADDRESS 0x00000418 -#define INT_STATUS_ENABLE_OFFSET 0x00000418 -#define INT_STATUS_ENABLE_ERROR_MSB 7 -#define INT_STATUS_ENABLE_ERROR_LSB 7 -#define INT_STATUS_ENABLE_ERROR_MASK 0x00000080 -#define INT_STATUS_ENABLE_ERROR_GET(x) (((x) & INT_STATUS_ENABLE_ERROR_MASK) >> INT_STATUS_ENABLE_ERROR_LSB) -#define INT_STATUS_ENABLE_ERROR_SET(x) (((x) << INT_STATUS_ENABLE_ERROR_LSB) & INT_STATUS_ENABLE_ERROR_MASK) -#define INT_STATUS_ENABLE_CPU_MSB 6 -#define INT_STATUS_ENABLE_CPU_LSB 6 -#define INT_STATUS_ENABLE_CPU_MASK 0x00000040 -#define INT_STATUS_ENABLE_CPU_GET(x) (((x) & INT_STATUS_ENABLE_CPU_MASK) >> INT_STATUS_ENABLE_CPU_LSB) -#define INT_STATUS_ENABLE_CPU_SET(x) (((x) << INT_STATUS_ENABLE_CPU_LSB) & INT_STATUS_ENABLE_CPU_MASK) -#define INT_STATUS_ENABLE_DRAGON_INT_MSB 5 -#define INT_STATUS_ENABLE_DRAGON_INT_LSB 5 -#define INT_STATUS_ENABLE_DRAGON_INT_MASK 0x00000020 -#define INT_STATUS_ENABLE_DRAGON_INT_GET(x) (((x) & INT_STATUS_ENABLE_DRAGON_INT_MASK) >> INT_STATUS_ENABLE_DRAGON_INT_LSB) -#define INT_STATUS_ENABLE_DRAGON_INT_SET(x) (((x) << INT_STATUS_ENABLE_DRAGON_INT_LSB) & INT_STATUS_ENABLE_DRAGON_INT_MASK) -#define INT_STATUS_ENABLE_COUNTER_MSB 4 -#define INT_STATUS_ENABLE_COUNTER_LSB 4 -#define INT_STATUS_ENABLE_COUNTER_MASK 0x00000010 -#define INT_STATUS_ENABLE_COUNTER_GET(x) (((x) & INT_STATUS_ENABLE_COUNTER_MASK) >> INT_STATUS_ENABLE_COUNTER_LSB) -#define INT_STATUS_ENABLE_COUNTER_SET(x) (((x) << INT_STATUS_ENABLE_COUNTER_LSB) & INT_STATUS_ENABLE_COUNTER_MASK) -#define INT_STATUS_ENABLE_MBOX_DATA_MSB 3 -#define INT_STATUS_ENABLE_MBOX_DATA_LSB 0 -#define INT_STATUS_ENABLE_MBOX_DATA_MASK 0x0000000f -#define INT_STATUS_ENABLE_MBOX_DATA_GET(x) (((x) & INT_STATUS_ENABLE_MBOX_DATA_MASK) >> INT_STATUS_ENABLE_MBOX_DATA_LSB) -#define INT_STATUS_ENABLE_MBOX_DATA_SET(x) (((x) << INT_STATUS_ENABLE_MBOX_DATA_LSB) & INT_STATUS_ENABLE_MBOX_DATA_MASK) - -#define CPU_INT_STATUS_ENABLE_ADDRESS 0x00000419 -#define CPU_INT_STATUS_ENABLE_OFFSET 0x00000419 -#define CPU_INT_STATUS_ENABLE_BIT_MSB 7 -#define CPU_INT_STATUS_ENABLE_BIT_LSB 0 -#define CPU_INT_STATUS_ENABLE_BIT_MASK 0x000000ff -#define CPU_INT_STATUS_ENABLE_BIT_GET(x) (((x) & CPU_INT_STATUS_ENABLE_BIT_MASK) >> CPU_INT_STATUS_ENABLE_BIT_LSB) -#define CPU_INT_STATUS_ENABLE_BIT_SET(x) (((x) << CPU_INT_STATUS_ENABLE_BIT_LSB) & CPU_INT_STATUS_ENABLE_BIT_MASK) - -#define ERROR_STATUS_ENABLE_ADDRESS 0x0000041a -#define ERROR_STATUS_ENABLE_OFFSET 0x0000041a -#define ERROR_STATUS_ENABLE_WAKEUP_MSB 2 -#define ERROR_STATUS_ENABLE_WAKEUP_LSB 2 -#define ERROR_STATUS_ENABLE_WAKEUP_MASK 0x00000004 -#define ERROR_STATUS_ENABLE_WAKEUP_GET(x) (((x) & ERROR_STATUS_ENABLE_WAKEUP_MASK) >> ERROR_STATUS_ENABLE_WAKEUP_LSB) -#define ERROR_STATUS_ENABLE_WAKEUP_SET(x) (((x) << ERROR_STATUS_ENABLE_WAKEUP_LSB) & ERROR_STATUS_ENABLE_WAKEUP_MASK) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MSB 1 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB 1 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 0x00000002 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK) >> ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_SET(x) (((x) << ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) & ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_MSB 0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB 0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK 0x00000001 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) >> ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_SET(x) (((x) << ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) & ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) - -#define COUNTER_INT_STATUS_ENABLE_ADDRESS 0x0000041b -#define COUNTER_INT_STATUS_ENABLE_OFFSET 0x0000041b -#define COUNTER_INT_STATUS_ENABLE_BIT_MSB 7 -#define COUNTER_INT_STATUS_ENABLE_BIT_LSB 0 -#define COUNTER_INT_STATUS_ENABLE_BIT_MASK 0x000000ff -#define COUNTER_INT_STATUS_ENABLE_BIT_GET(x) (((x) & COUNTER_INT_STATUS_ENABLE_BIT_MASK) >> COUNTER_INT_STATUS_ENABLE_BIT_LSB) -#define COUNTER_INT_STATUS_ENABLE_BIT_SET(x) (((x) << COUNTER_INT_STATUS_ENABLE_BIT_LSB) & COUNTER_INT_STATUS_ENABLE_BIT_MASK) - -#define COUNT_ADDRESS 0x00000420 -#define COUNT_OFFSET 0x00000420 -#define COUNT_VALUE_MSB 7 -#define COUNT_VALUE_LSB 0 -#define COUNT_VALUE_MASK 0x000000ff -#define COUNT_VALUE_GET(x) (((x) & COUNT_VALUE_MASK) >> COUNT_VALUE_LSB) -#define COUNT_VALUE_SET(x) (((x) << COUNT_VALUE_LSB) & COUNT_VALUE_MASK) - -#define COUNT_DEC_ADDRESS 0x00000440 -#define COUNT_DEC_OFFSET 0x00000440 -#define COUNT_DEC_VALUE_MSB 7 -#define COUNT_DEC_VALUE_LSB 0 -#define COUNT_DEC_VALUE_MASK 0x000000ff -#define COUNT_DEC_VALUE_GET(x) (((x) & COUNT_DEC_VALUE_MASK) >> COUNT_DEC_VALUE_LSB) -#define COUNT_DEC_VALUE_SET(x) (((x) << COUNT_DEC_VALUE_LSB) & COUNT_DEC_VALUE_MASK) - -#define SCRATCH_ADDRESS 0x00000460 -#define SCRATCH_OFFSET 0x00000460 -#define SCRATCH_VALUE_MSB 7 -#define SCRATCH_VALUE_LSB 0 -#define SCRATCH_VALUE_MASK 0x000000ff -#define SCRATCH_VALUE_GET(x) (((x) & SCRATCH_VALUE_MASK) >> SCRATCH_VALUE_LSB) -#define SCRATCH_VALUE_SET(x) (((x) << SCRATCH_VALUE_LSB) & SCRATCH_VALUE_MASK) - -#define FIFO_TIMEOUT_ADDRESS 0x00000468 -#define FIFO_TIMEOUT_OFFSET 0x00000468 -#define FIFO_TIMEOUT_VALUE_MSB 7 -#define FIFO_TIMEOUT_VALUE_LSB 0 -#define FIFO_TIMEOUT_VALUE_MASK 0x000000ff -#define FIFO_TIMEOUT_VALUE_GET(x) (((x) & FIFO_TIMEOUT_VALUE_MASK) >> FIFO_TIMEOUT_VALUE_LSB) -#define FIFO_TIMEOUT_VALUE_SET(x) (((x) << FIFO_TIMEOUT_VALUE_LSB) & FIFO_TIMEOUT_VALUE_MASK) - -#define FIFO_TIMEOUT_ENABLE_ADDRESS 0x00000469 -#define FIFO_TIMEOUT_ENABLE_OFFSET 0x00000469 -#define FIFO_TIMEOUT_ENABLE_SET_MSB 0 -#define FIFO_TIMEOUT_ENABLE_SET_LSB 0 -#define FIFO_TIMEOUT_ENABLE_SET_MASK 0x00000001 -#define FIFO_TIMEOUT_ENABLE_SET_GET(x) (((x) & FIFO_TIMEOUT_ENABLE_SET_MASK) >> FIFO_TIMEOUT_ENABLE_SET_LSB) -#define FIFO_TIMEOUT_ENABLE_SET_SET(x) (((x) << FIFO_TIMEOUT_ENABLE_SET_LSB) & FIFO_TIMEOUT_ENABLE_SET_MASK) - -#define DISABLE_SLEEP_ADDRESS 0x0000046a -#define DISABLE_SLEEP_OFFSET 0x0000046a -#define DISABLE_SLEEP_FOR_INT_MSB 1 -#define DISABLE_SLEEP_FOR_INT_LSB 1 -#define DISABLE_SLEEP_FOR_INT_MASK 0x00000002 -#define DISABLE_SLEEP_FOR_INT_GET(x) (((x) & DISABLE_SLEEP_FOR_INT_MASK) >> DISABLE_SLEEP_FOR_INT_LSB) -#define DISABLE_SLEEP_FOR_INT_SET(x) (((x) << DISABLE_SLEEP_FOR_INT_LSB) & DISABLE_SLEEP_FOR_INT_MASK) -#define DISABLE_SLEEP_ON_MSB 0 -#define DISABLE_SLEEP_ON_LSB 0 -#define DISABLE_SLEEP_ON_MASK 0x00000001 -#define DISABLE_SLEEP_ON_GET(x) (((x) & DISABLE_SLEEP_ON_MASK) >> DISABLE_SLEEP_ON_LSB) -#define DISABLE_SLEEP_ON_SET(x) (((x) << DISABLE_SLEEP_ON_LSB) & DISABLE_SLEEP_ON_MASK) - -#define LOCAL_BUS_ADDRESS 0x00000470 -#define LOCAL_BUS_OFFSET 0x00000470 -#define LOCAL_BUS_STATE_MSB 1 -#define LOCAL_BUS_STATE_LSB 0 -#define LOCAL_BUS_STATE_MASK 0x00000003 -#define LOCAL_BUS_STATE_GET(x) (((x) & LOCAL_BUS_STATE_MASK) >> LOCAL_BUS_STATE_LSB) -#define LOCAL_BUS_STATE_SET(x) (((x) << LOCAL_BUS_STATE_LSB) & LOCAL_BUS_STATE_MASK) - -#define INT_WLAN_ADDRESS 0x00000472 -#define INT_WLAN_OFFSET 0x00000472 -#define INT_WLAN_VECTOR_MSB 7 -#define INT_WLAN_VECTOR_LSB 0 -#define INT_WLAN_VECTOR_MASK 0x000000ff -#define INT_WLAN_VECTOR_GET(x) (((x) & INT_WLAN_VECTOR_MASK) >> INT_WLAN_VECTOR_LSB) -#define INT_WLAN_VECTOR_SET(x) (((x) << INT_WLAN_VECTOR_LSB) & INT_WLAN_VECTOR_MASK) - -#define WINDOW_DATA_ADDRESS 0x00000474 -#define WINDOW_DATA_OFFSET 0x00000474 -#define WINDOW_DATA_DATA_MSB 7 -#define WINDOW_DATA_DATA_LSB 0 -#define WINDOW_DATA_DATA_MASK 0x000000ff -#define WINDOW_DATA_DATA_GET(x) (((x) & WINDOW_DATA_DATA_MASK) >> WINDOW_DATA_DATA_LSB) -#define WINDOW_DATA_DATA_SET(x) (((x) << WINDOW_DATA_DATA_LSB) & WINDOW_DATA_DATA_MASK) - -#define WINDOW_WRITE_ADDR_ADDRESS 0x00000478 -#define WINDOW_WRITE_ADDR_OFFSET 0x00000478 -#define WINDOW_WRITE_ADDR_ADDR_MSB 7 -#define WINDOW_WRITE_ADDR_ADDR_LSB 0 -#define WINDOW_WRITE_ADDR_ADDR_MASK 0x000000ff -#define WINDOW_WRITE_ADDR_ADDR_GET(x) (((x) & WINDOW_WRITE_ADDR_ADDR_MASK) >> WINDOW_WRITE_ADDR_ADDR_LSB) -#define WINDOW_WRITE_ADDR_ADDR_SET(x) (((x) << WINDOW_WRITE_ADDR_ADDR_LSB) & WINDOW_WRITE_ADDR_ADDR_MASK) - -#define WINDOW_READ_ADDR_ADDRESS 0x0000047c -#define WINDOW_READ_ADDR_OFFSET 0x0000047c -#define WINDOW_READ_ADDR_ADDR_MSB 7 -#define WINDOW_READ_ADDR_ADDR_LSB 0 -#define WINDOW_READ_ADDR_ADDR_MASK 0x000000ff -#define WINDOW_READ_ADDR_ADDR_GET(x) (((x) & WINDOW_READ_ADDR_ADDR_MASK) >> WINDOW_READ_ADDR_ADDR_LSB) -#define WINDOW_READ_ADDR_ADDR_SET(x) (((x) << WINDOW_READ_ADDR_ADDR_LSB) & WINDOW_READ_ADDR_ADDR_MASK) - -#define SPI_CONFIG_ADDRESS 0x00000480 -#define SPI_CONFIG_OFFSET 0x00000480 -#define SPI_CONFIG_SPI_RESET_MSB 4 -#define SPI_CONFIG_SPI_RESET_LSB 4 -#define SPI_CONFIG_SPI_RESET_MASK 0x00000010 -#define SPI_CONFIG_SPI_RESET_GET(x) (((x) & SPI_CONFIG_SPI_RESET_MASK) >> SPI_CONFIG_SPI_RESET_LSB) -#define SPI_CONFIG_SPI_RESET_SET(x) (((x) << SPI_CONFIG_SPI_RESET_LSB) & SPI_CONFIG_SPI_RESET_MASK) -#define SPI_CONFIG_INTERRUPT_ENABLE_MSB 3 -#define SPI_CONFIG_INTERRUPT_ENABLE_LSB 3 -#define SPI_CONFIG_INTERRUPT_ENABLE_MASK 0x00000008 -#define SPI_CONFIG_INTERRUPT_ENABLE_GET(x) (((x) & SPI_CONFIG_INTERRUPT_ENABLE_MASK) >> SPI_CONFIG_INTERRUPT_ENABLE_LSB) -#define SPI_CONFIG_INTERRUPT_ENABLE_SET(x) (((x) << SPI_CONFIG_INTERRUPT_ENABLE_LSB) & SPI_CONFIG_INTERRUPT_ENABLE_MASK) -#define SPI_CONFIG_TEST_MODE_MSB 2 -#define SPI_CONFIG_TEST_MODE_LSB 2 -#define SPI_CONFIG_TEST_MODE_MASK 0x00000004 -#define SPI_CONFIG_TEST_MODE_GET(x) (((x) & SPI_CONFIG_TEST_MODE_MASK) >> SPI_CONFIG_TEST_MODE_LSB) -#define SPI_CONFIG_TEST_MODE_SET(x) (((x) << SPI_CONFIG_TEST_MODE_LSB) & SPI_CONFIG_TEST_MODE_MASK) -#define SPI_CONFIG_DATA_SIZE_MSB 1 -#define SPI_CONFIG_DATA_SIZE_LSB 0 -#define SPI_CONFIG_DATA_SIZE_MASK 0x00000003 -#define SPI_CONFIG_DATA_SIZE_GET(x) (((x) & SPI_CONFIG_DATA_SIZE_MASK) >> SPI_CONFIG_DATA_SIZE_LSB) -#define SPI_CONFIG_DATA_SIZE_SET(x) (((x) << SPI_CONFIG_DATA_SIZE_LSB) & SPI_CONFIG_DATA_SIZE_MASK) - -#define SPI_STATUS_ADDRESS 0x00000481 -#define SPI_STATUS_OFFSET 0x00000481 -#define SPI_STATUS_ADDR_ERR_MSB 3 -#define SPI_STATUS_ADDR_ERR_LSB 3 -#define SPI_STATUS_ADDR_ERR_MASK 0x00000008 -#define SPI_STATUS_ADDR_ERR_GET(x) (((x) & SPI_STATUS_ADDR_ERR_MASK) >> SPI_STATUS_ADDR_ERR_LSB) -#define SPI_STATUS_ADDR_ERR_SET(x) (((x) << SPI_STATUS_ADDR_ERR_LSB) & SPI_STATUS_ADDR_ERR_MASK) -#define SPI_STATUS_RD_ERR_MSB 2 -#define SPI_STATUS_RD_ERR_LSB 2 -#define SPI_STATUS_RD_ERR_MASK 0x00000004 -#define SPI_STATUS_RD_ERR_GET(x) (((x) & SPI_STATUS_RD_ERR_MASK) >> SPI_STATUS_RD_ERR_LSB) -#define SPI_STATUS_RD_ERR_SET(x) (((x) << SPI_STATUS_RD_ERR_LSB) & SPI_STATUS_RD_ERR_MASK) -#define SPI_STATUS_WR_ERR_MSB 1 -#define SPI_STATUS_WR_ERR_LSB 1 -#define SPI_STATUS_WR_ERR_MASK 0x00000002 -#define SPI_STATUS_WR_ERR_GET(x) (((x) & SPI_STATUS_WR_ERR_MASK) >> SPI_STATUS_WR_ERR_LSB) -#define SPI_STATUS_WR_ERR_SET(x) (((x) << SPI_STATUS_WR_ERR_LSB) & SPI_STATUS_WR_ERR_MASK) -#define SPI_STATUS_READY_MSB 0 -#define SPI_STATUS_READY_LSB 0 -#define SPI_STATUS_READY_MASK 0x00000001 -#define SPI_STATUS_READY_GET(x) (((x) & SPI_STATUS_READY_MASK) >> SPI_STATUS_READY_LSB) -#define SPI_STATUS_READY_SET(x) (((x) << SPI_STATUS_READY_LSB) & SPI_STATUS_READY_MASK) - -#define NON_ASSOC_SLEEP_EN_ADDRESS 0x00000482 -#define NON_ASSOC_SLEEP_EN_OFFSET 0x00000482 -#define NON_ASSOC_SLEEP_EN_BIT_MSB 0 -#define NON_ASSOC_SLEEP_EN_BIT_LSB 0 -#define NON_ASSOC_SLEEP_EN_BIT_MASK 0x00000001 -#define NON_ASSOC_SLEEP_EN_BIT_GET(x) (((x) & NON_ASSOC_SLEEP_EN_BIT_MASK) >> NON_ASSOC_SLEEP_EN_BIT_LSB) -#define NON_ASSOC_SLEEP_EN_BIT_SET(x) (((x) << NON_ASSOC_SLEEP_EN_BIT_LSB) & NON_ASSOC_SLEEP_EN_BIT_MASK) - -#define CIS_WINDOW_ADDRESS 0x00000600 -#define CIS_WINDOW_OFFSET 0x00000600 -#define CIS_WINDOW_DATA_MSB 7 -#define CIS_WINDOW_DATA_LSB 0 -#define CIS_WINDOW_DATA_MASK 0x000000ff -#define CIS_WINDOW_DATA_GET(x) (((x) & CIS_WINDOW_DATA_MASK) >> CIS_WINDOW_DATA_LSB) -#define CIS_WINDOW_DATA_SET(x) (((x) << CIS_WINDOW_DATA_LSB) & CIS_WINDOW_DATA_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct mbox_host_reg_reg_s { - unsigned char pad0[1024]; /* pad to 0x400 */ - volatile unsigned char host_int_status; - volatile unsigned char cpu_int_status; - volatile unsigned char error_int_status; - volatile unsigned char counter_int_status; - volatile unsigned char mbox_frame; - volatile unsigned char rx_lookahead_valid; - unsigned char pad1[2]; /* pad to 0x408 */ - volatile unsigned char rx_lookahead0[4]; - volatile unsigned char rx_lookahead1[4]; - volatile unsigned char rx_lookahead2[4]; - volatile unsigned char rx_lookahead3[4]; - volatile unsigned char int_status_enable; - volatile unsigned char cpu_int_status_enable; - volatile unsigned char error_status_enable; - volatile unsigned char counter_int_status_enable; - unsigned char pad2[4]; /* pad to 0x420 */ - volatile unsigned char count[8]; - unsigned char pad3[24]; /* pad to 0x440 */ - volatile unsigned char count_dec[32]; - volatile unsigned char scratch[8]; - volatile unsigned char fifo_timeout; - volatile unsigned char fifo_timeout_enable; - volatile unsigned char disable_sleep; - unsigned char pad4[5]; /* pad to 0x470 */ - volatile unsigned char local_bus; - unsigned char pad5[1]; /* pad to 0x472 */ - volatile unsigned char int_wlan; - unsigned char pad6[1]; /* pad to 0x474 */ - volatile unsigned char window_data[4]; - volatile unsigned char window_write_addr[4]; - volatile unsigned char window_read_addr[4]; - volatile unsigned char spi_config; - volatile unsigned char spi_status; - volatile unsigned char non_assoc_sleep_en; - unsigned char pad7[381]; /* pad to 0x600 */ - volatile unsigned char cis_window[512]; -} mbox_host_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _MBOX_HOST_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_host_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_host_reg.vrh deleted file mode 100644 index 3cf45eaa0cee..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_host_reg.vrh +++ /dev/null @@ -1,563 +0,0 @@ -#ifndef _MBOX_HOST_REG_VRH_ -#define _MBOX_HOST_REG_VRH_ - -#define HOST_INT_STATUS_ADDRESS 'h00000400 -#define HOST_INT_STATUS_ERROR_MSB 7 -#define HOST_INT_STATUS_ERROR_LSB 7 -#define HOST_INT_STATUS_ERROR_MASK 'h00000080 -#define HOST_INT_STATUS_ERROR_GET(x) (((x) & HOST_INT_STATUS_ERROR_MASK) >> HOST_INT_STATUS_ERROR_LSB) -#define HOST_INT_STATUS_ERROR_SET(x) (((8'd0 | (x)) << HOST_INT_STATUS_ERROR_LSB) & HOST_INT_STATUS_ERROR_MASK) -#define HOST_INT_STATUS_ERROR_RESET 1'h0 -#define HOST_INT_STATUS_CPU_MSB 6 -#define HOST_INT_STATUS_CPU_LSB 6 -#define HOST_INT_STATUS_CPU_MASK 'h00000040 -#define HOST_INT_STATUS_CPU_GET(x) (((x) & HOST_INT_STATUS_CPU_MASK) >> HOST_INT_STATUS_CPU_LSB) -#define HOST_INT_STATUS_CPU_SET(x) (((8'd0 | (x)) << HOST_INT_STATUS_CPU_LSB) & HOST_INT_STATUS_CPU_MASK) -#define HOST_INT_STATUS_CPU_RESET 1'h0 -#define HOST_INT_STATUS_DRAGON_INT_MSB 5 -#define HOST_INT_STATUS_DRAGON_INT_LSB 5 -#define HOST_INT_STATUS_DRAGON_INT_MASK 'h00000020 -#define HOST_INT_STATUS_DRAGON_INT_GET(x) (((x) & HOST_INT_STATUS_DRAGON_INT_MASK) >> HOST_INT_STATUS_DRAGON_INT_LSB) -#define HOST_INT_STATUS_DRAGON_INT_SET(x) (((8'd0 | (x)) << HOST_INT_STATUS_DRAGON_INT_LSB) & HOST_INT_STATUS_DRAGON_INT_MASK) -#define HOST_INT_STATUS_DRAGON_INT_RESET 1'h0 -#define HOST_INT_STATUS_COUNTER_MSB 4 -#define HOST_INT_STATUS_COUNTER_LSB 4 -#define HOST_INT_STATUS_COUNTER_MASK 'h00000010 -#define HOST_INT_STATUS_COUNTER_GET(x) (((x) & HOST_INT_STATUS_COUNTER_MASK) >> HOST_INT_STATUS_COUNTER_LSB) -#define HOST_INT_STATUS_COUNTER_SET(x) (((8'd0 | (x)) << HOST_INT_STATUS_COUNTER_LSB) & HOST_INT_STATUS_COUNTER_MASK) -#define HOST_INT_STATUS_COUNTER_RESET 1'h0 -#define HOST_INT_STATUS_MBOX_DATA_MSB 3 -#define HOST_INT_STATUS_MBOX_DATA_LSB 0 -#define HOST_INT_STATUS_MBOX_DATA_MASK 'h0000000f -#define HOST_INT_STATUS_MBOX_DATA_GET(x) (((x) & HOST_INT_STATUS_MBOX_DATA_MASK) >> HOST_INT_STATUS_MBOX_DATA_LSB) -#define HOST_INT_STATUS_MBOX_DATA_SET(x) (((8'd0 | (x)) << HOST_INT_STATUS_MBOX_DATA_LSB) & HOST_INT_STATUS_MBOX_DATA_MASK) -#define HOST_INT_STATUS_MBOX_DATA_RESET 4'h0 -#define HOST_INT_STATUS_RESET (8'h0 | \ - HOST_INT_STATUS_ERROR_SET(HOST_INT_STATUS_ERROR_RESET) | \ - HOST_INT_STATUS_CPU_SET(HOST_INT_STATUS_CPU_RESET) | \ - HOST_INT_STATUS_DRAGON_INT_SET(HOST_INT_STATUS_DRAGON_INT_RESET) | \ - HOST_INT_STATUS_COUNTER_SET(HOST_INT_STATUS_COUNTER_RESET) | \ - HOST_INT_STATUS_MBOX_DATA_SET(HOST_INT_STATUS_MBOX_DATA_RESET)) -#define HOST_INT_STATUS_HW_MASK (8'h0 | \ - HOST_INT_STATUS_ERROR_MASK | \ - HOST_INT_STATUS_CPU_MASK | \ - HOST_INT_STATUS_DRAGON_INT_MASK | \ - HOST_INT_STATUS_COUNTER_MASK | \ - HOST_INT_STATUS_MBOX_DATA_MASK) -#define HOST_INT_STATUS_SW_MASK (8'h0) - -#define CPU_INT_STATUS_ADDRESS 'h00000401 -#define CPU_INT_STATUS_BIT_MSB 7 -#define CPU_INT_STATUS_BIT_LSB 0 -#define CPU_INT_STATUS_BIT_MASK 'h000000ff -#define CPU_INT_STATUS_BIT_GET(x) (((x) & CPU_INT_STATUS_BIT_MASK) >> CPU_INT_STATUS_BIT_LSB) -#define CPU_INT_STATUS_BIT_SET(x) (((8'd0 | (x)) << CPU_INT_STATUS_BIT_LSB) & CPU_INT_STATUS_BIT_MASK) -#define CPU_INT_STATUS_BIT_RESET 8'h0 -#define CPU_INT_STATUS_RESET (8'h0 | \ - CPU_INT_STATUS_BIT_SET(CPU_INT_STATUS_BIT_RESET)) -#define CPU_INT_STATUS_HW_MASK (8'h0 | \ - CPU_INT_STATUS_BIT_MASK) -#define CPU_INT_STATUS_SW_MASK (8'h0 | \ - CPU_INT_STATUS_BIT_MASK) - -#define ERROR_INT_STATUS_ADDRESS 'h00000402 -#define ERROR_INT_STATUS_SPI_MSB 3 -#define ERROR_INT_STATUS_SPI_LSB 3 -#define ERROR_INT_STATUS_SPI_MASK 'h00000008 -#define ERROR_INT_STATUS_SPI_GET(x) (((x) & ERROR_INT_STATUS_SPI_MASK) >> ERROR_INT_STATUS_SPI_LSB) -#define ERROR_INT_STATUS_SPI_SET(x) (((8'd0 | (x)) << ERROR_INT_STATUS_SPI_LSB) & ERROR_INT_STATUS_SPI_MASK) -#define ERROR_INT_STATUS_SPI_RESET 1'h0 -#define ERROR_INT_STATUS_WAKEUP_MSB 2 -#define ERROR_INT_STATUS_WAKEUP_LSB 2 -#define ERROR_INT_STATUS_WAKEUP_MASK 'h00000004 -#define ERROR_INT_STATUS_WAKEUP_GET(x) (((x) & ERROR_INT_STATUS_WAKEUP_MASK) >> ERROR_INT_STATUS_WAKEUP_LSB) -#define ERROR_INT_STATUS_WAKEUP_SET(x) (((8'd0 | (x)) << ERROR_INT_STATUS_WAKEUP_LSB) & ERROR_INT_STATUS_WAKEUP_MASK) -#define ERROR_INT_STATUS_WAKEUP_RESET 1'h0 -#define ERROR_INT_STATUS_RX_UNDERFLOW_MSB 1 -#define ERROR_INT_STATUS_RX_UNDERFLOW_LSB 1 -#define ERROR_INT_STATUS_RX_UNDERFLOW_MASK 'h00000002 -#define ERROR_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & ERROR_INT_STATUS_RX_UNDERFLOW_MASK) >> ERROR_INT_STATUS_RX_UNDERFLOW_LSB) -#define ERROR_INT_STATUS_RX_UNDERFLOW_SET(x) (((8'd0 | (x)) << ERROR_INT_STATUS_RX_UNDERFLOW_LSB) & ERROR_INT_STATUS_RX_UNDERFLOW_MASK) -#define ERROR_INT_STATUS_RX_UNDERFLOW_RESET 1'h0 -#define ERROR_INT_STATUS_TX_OVERFLOW_MSB 0 -#define ERROR_INT_STATUS_TX_OVERFLOW_LSB 0 -#define ERROR_INT_STATUS_TX_OVERFLOW_MASK 'h00000001 -#define ERROR_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & ERROR_INT_STATUS_TX_OVERFLOW_MASK) >> ERROR_INT_STATUS_TX_OVERFLOW_LSB) -#define ERROR_INT_STATUS_TX_OVERFLOW_SET(x) (((8'd0 | (x)) << ERROR_INT_STATUS_TX_OVERFLOW_LSB) & ERROR_INT_STATUS_TX_OVERFLOW_MASK) -#define ERROR_INT_STATUS_TX_OVERFLOW_RESET 1'h0 -#define ERROR_INT_STATUS_RESET (8'h0 | \ - ERROR_INT_STATUS_SPI_SET(ERROR_INT_STATUS_SPI_RESET) | \ - ERROR_INT_STATUS_WAKEUP_SET(ERROR_INT_STATUS_WAKEUP_RESET) | \ - ERROR_INT_STATUS_RX_UNDERFLOW_SET(ERROR_INT_STATUS_RX_UNDERFLOW_RESET) | \ - ERROR_INT_STATUS_TX_OVERFLOW_SET(ERROR_INT_STATUS_TX_OVERFLOW_RESET)) -#define ERROR_INT_STATUS_HW_MASK (8'h0 | \ - ERROR_INT_STATUS_SPI_MASK | \ - ERROR_INT_STATUS_WAKEUP_MASK | \ - ERROR_INT_STATUS_RX_UNDERFLOW_MASK | \ - ERROR_INT_STATUS_TX_OVERFLOW_MASK) -#define ERROR_INT_STATUS_SW_MASK (8'h0 | \ - ERROR_INT_STATUS_WAKEUP_MASK | \ - ERROR_INT_STATUS_RX_UNDERFLOW_MASK | \ - ERROR_INT_STATUS_TX_OVERFLOW_MASK) - -#define COUNTER_INT_STATUS_ADDRESS 'h00000403 -#define COUNTER_INT_STATUS_COUNTER_MSB 7 -#define COUNTER_INT_STATUS_COUNTER_LSB 0 -#define COUNTER_INT_STATUS_COUNTER_MASK 'h000000ff -#define COUNTER_INT_STATUS_COUNTER_GET(x) (((x) & COUNTER_INT_STATUS_COUNTER_MASK) >> COUNTER_INT_STATUS_COUNTER_LSB) -#define COUNTER_INT_STATUS_COUNTER_SET(x) (((8'd0 | (x)) << COUNTER_INT_STATUS_COUNTER_LSB) & COUNTER_INT_STATUS_COUNTER_MASK) -#define COUNTER_INT_STATUS_COUNTER_RESET 8'h0 -#define COUNTER_INT_STATUS_RESET (8'h0 | \ - COUNTER_INT_STATUS_COUNTER_SET(COUNTER_INT_STATUS_COUNTER_RESET)) -#define COUNTER_INT_STATUS_HW_MASK (8'h0 | \ - COUNTER_INT_STATUS_COUNTER_MASK) -#define COUNTER_INT_STATUS_SW_MASK (8'h0) - -#define MBOX_FRAME_ADDRESS 'h00000404 -#define MBOX_FRAME_RX_EOM_MSB 7 -#define MBOX_FRAME_RX_EOM_LSB 4 -#define MBOX_FRAME_RX_EOM_MASK 'h000000f0 -#define MBOX_FRAME_RX_EOM_GET(x) (((x) & MBOX_FRAME_RX_EOM_MASK) >> MBOX_FRAME_RX_EOM_LSB) -#define MBOX_FRAME_RX_EOM_SET(x) (((8'd0 | (x)) << MBOX_FRAME_RX_EOM_LSB) & MBOX_FRAME_RX_EOM_MASK) -#define MBOX_FRAME_RX_EOM_RESET 4'h0 -#define MBOX_FRAME_RX_SOM_MSB 3 -#define MBOX_FRAME_RX_SOM_LSB 0 -#define MBOX_FRAME_RX_SOM_MASK 'h0000000f -#define MBOX_FRAME_RX_SOM_GET(x) (((x) & MBOX_FRAME_RX_SOM_MASK) >> MBOX_FRAME_RX_SOM_LSB) -#define MBOX_FRAME_RX_SOM_SET(x) (((8'd0 | (x)) << MBOX_FRAME_RX_SOM_LSB) & MBOX_FRAME_RX_SOM_MASK) -#define MBOX_FRAME_RX_SOM_RESET 4'hf -#define MBOX_FRAME_RESET (8'h0 | \ - MBOX_FRAME_RX_EOM_SET(MBOX_FRAME_RX_EOM_RESET) | \ - MBOX_FRAME_RX_SOM_SET(MBOX_FRAME_RX_SOM_RESET)) -#define MBOX_FRAME_HW_MASK (8'h0 | \ - MBOX_FRAME_RX_EOM_MASK | \ - MBOX_FRAME_RX_SOM_MASK) -#define MBOX_FRAME_SW_MASK (8'h0) - -#define RX_LOOKAHEAD_VALID_ADDRESS 'h00000405 -#define RX_LOOKAHEAD_VALID_MBOX_MSB 3 -#define RX_LOOKAHEAD_VALID_MBOX_LSB 0 -#define RX_LOOKAHEAD_VALID_MBOX_MASK 'h0000000f -#define RX_LOOKAHEAD_VALID_MBOX_GET(x) (((x) & RX_LOOKAHEAD_VALID_MBOX_MASK) >> RX_LOOKAHEAD_VALID_MBOX_LSB) -#define RX_LOOKAHEAD_VALID_MBOX_SET(x) (((8'd0 | (x)) << RX_LOOKAHEAD_VALID_MBOX_LSB) & RX_LOOKAHEAD_VALID_MBOX_MASK) -#define RX_LOOKAHEAD_VALID_MBOX_RESET 4'h0 -#define RX_LOOKAHEAD_VALID_RESET (8'h0 | \ - RX_LOOKAHEAD_VALID_MBOX_SET(RX_LOOKAHEAD_VALID_MBOX_RESET)) -#define RX_LOOKAHEAD_VALID_HW_MASK (8'h0 | \ - RX_LOOKAHEAD_VALID_MBOX_MASK) -#define RX_LOOKAHEAD_VALID_SW_MASK (8'h0) - -#define RX_LOOKAHEAD0_ADDRESS 'h00000408 -#define RX_LOOKAHEAD0_DATA_MSB 7 -#define RX_LOOKAHEAD0_DATA_LSB 0 -#define RX_LOOKAHEAD0_DATA_MASK 'h000000ff -#define RX_LOOKAHEAD0_DATA_GET(x) (((x) & RX_LOOKAHEAD0_DATA_MASK) >> RX_LOOKAHEAD0_DATA_LSB) -#define RX_LOOKAHEAD0_DATA_SET(x) (((8'd0 | (x)) << RX_LOOKAHEAD0_DATA_LSB) & RX_LOOKAHEAD0_DATA_MASK) -#define RX_LOOKAHEAD0_DATA_RESET 8'h0 -#define RX_LOOKAHEAD0_RESET (8'h0 | \ - RX_LOOKAHEAD0_DATA_SET(RX_LOOKAHEAD0_DATA_RESET)) -#define RX_LOOKAHEAD0_HW_MASK (8'h0 | \ - RX_LOOKAHEAD0_DATA_MASK) -#define RX_LOOKAHEAD0_SW_MASK (8'h0) - -#define RX_LOOKAHEAD1_ADDRESS 'h0000040c -#define RX_LOOKAHEAD1_DATA_MSB 7 -#define RX_LOOKAHEAD1_DATA_LSB 0 -#define RX_LOOKAHEAD1_DATA_MASK 'h000000ff -#define RX_LOOKAHEAD1_DATA_GET(x) (((x) & RX_LOOKAHEAD1_DATA_MASK) >> RX_LOOKAHEAD1_DATA_LSB) -#define RX_LOOKAHEAD1_DATA_SET(x) (((8'd0 | (x)) << RX_LOOKAHEAD1_DATA_LSB) & RX_LOOKAHEAD1_DATA_MASK) -#define RX_LOOKAHEAD1_DATA_RESET 8'h0 -#define RX_LOOKAHEAD1_RESET (8'h0 | \ - RX_LOOKAHEAD1_DATA_SET(RX_LOOKAHEAD1_DATA_RESET)) -#define RX_LOOKAHEAD1_HW_MASK (8'h0 | \ - RX_LOOKAHEAD1_DATA_MASK) -#define RX_LOOKAHEAD1_SW_MASK (8'h0) - -#define RX_LOOKAHEAD2_ADDRESS 'h00000410 -#define RX_LOOKAHEAD2_DATA_MSB 7 -#define RX_LOOKAHEAD2_DATA_LSB 0 -#define RX_LOOKAHEAD2_DATA_MASK 'h000000ff -#define RX_LOOKAHEAD2_DATA_GET(x) (((x) & RX_LOOKAHEAD2_DATA_MASK) >> RX_LOOKAHEAD2_DATA_LSB) -#define RX_LOOKAHEAD2_DATA_SET(x) (((8'd0 | (x)) << RX_LOOKAHEAD2_DATA_LSB) & RX_LOOKAHEAD2_DATA_MASK) -#define RX_LOOKAHEAD2_DATA_RESET 8'h0 -#define RX_LOOKAHEAD2_RESET (8'h0 | \ - RX_LOOKAHEAD2_DATA_SET(RX_LOOKAHEAD2_DATA_RESET)) -#define RX_LOOKAHEAD2_HW_MASK (8'h0 | \ - RX_LOOKAHEAD2_DATA_MASK) -#define RX_LOOKAHEAD2_SW_MASK (8'h0) - -#define RX_LOOKAHEAD3_ADDRESS 'h00000414 -#define RX_LOOKAHEAD3_DATA_MSB 7 -#define RX_LOOKAHEAD3_DATA_LSB 0 -#define RX_LOOKAHEAD3_DATA_MASK 'h000000ff -#define RX_LOOKAHEAD3_DATA_GET(x) (((x) & RX_LOOKAHEAD3_DATA_MASK) >> RX_LOOKAHEAD3_DATA_LSB) -#define RX_LOOKAHEAD3_DATA_SET(x) (((8'd0 | (x)) << RX_LOOKAHEAD3_DATA_LSB) & RX_LOOKAHEAD3_DATA_MASK) -#define RX_LOOKAHEAD3_DATA_RESET 8'h0 -#define RX_LOOKAHEAD3_RESET (8'h0 | \ - RX_LOOKAHEAD3_DATA_SET(RX_LOOKAHEAD3_DATA_RESET)) -#define RX_LOOKAHEAD3_HW_MASK (8'h0 | \ - RX_LOOKAHEAD3_DATA_MASK) -#define RX_LOOKAHEAD3_SW_MASK (8'h0) - -#define INT_STATUS_ENABLE_ADDRESS 'h00000418 -#define INT_STATUS_ENABLE_ERROR_MSB 7 -#define INT_STATUS_ENABLE_ERROR_LSB 7 -#define INT_STATUS_ENABLE_ERROR_MASK 'h00000080 -#define INT_STATUS_ENABLE_ERROR_GET(x) (((x) & INT_STATUS_ENABLE_ERROR_MASK) >> INT_STATUS_ENABLE_ERROR_LSB) -#define INT_STATUS_ENABLE_ERROR_SET(x) (((8'd0 | (x)) << INT_STATUS_ENABLE_ERROR_LSB) & INT_STATUS_ENABLE_ERROR_MASK) -#define INT_STATUS_ENABLE_ERROR_RESET 1'h1 -#define INT_STATUS_ENABLE_CPU_MSB 6 -#define INT_STATUS_ENABLE_CPU_LSB 6 -#define INT_STATUS_ENABLE_CPU_MASK 'h00000040 -#define INT_STATUS_ENABLE_CPU_GET(x) (((x) & INT_STATUS_ENABLE_CPU_MASK) >> INT_STATUS_ENABLE_CPU_LSB) -#define INT_STATUS_ENABLE_CPU_SET(x) (((8'd0 | (x)) << INT_STATUS_ENABLE_CPU_LSB) & INT_STATUS_ENABLE_CPU_MASK) -#define INT_STATUS_ENABLE_CPU_RESET 1'h1 -#define INT_STATUS_ENABLE_DRAGON_INT_MSB 5 -#define INT_STATUS_ENABLE_DRAGON_INT_LSB 5 -#define INT_STATUS_ENABLE_DRAGON_INT_MASK 'h00000020 -#define INT_STATUS_ENABLE_DRAGON_INT_GET(x) (((x) & INT_STATUS_ENABLE_DRAGON_INT_MASK) >> INT_STATUS_ENABLE_DRAGON_INT_LSB) -#define INT_STATUS_ENABLE_DRAGON_INT_SET(x) (((8'd0 | (x)) << INT_STATUS_ENABLE_DRAGON_INT_LSB) & INT_STATUS_ENABLE_DRAGON_INT_MASK) -#define INT_STATUS_ENABLE_DRAGON_INT_RESET 1'h0 -#define INT_STATUS_ENABLE_COUNTER_MSB 4 -#define INT_STATUS_ENABLE_COUNTER_LSB 4 -#define INT_STATUS_ENABLE_COUNTER_MASK 'h00000010 -#define INT_STATUS_ENABLE_COUNTER_GET(x) (((x) & INT_STATUS_ENABLE_COUNTER_MASK) >> INT_STATUS_ENABLE_COUNTER_LSB) -#define INT_STATUS_ENABLE_COUNTER_SET(x) (((8'd0 | (x)) << INT_STATUS_ENABLE_COUNTER_LSB) & INT_STATUS_ENABLE_COUNTER_MASK) -#define INT_STATUS_ENABLE_COUNTER_RESET 1'h0 -#define INT_STATUS_ENABLE_MBOX_DATA_MSB 3 -#define INT_STATUS_ENABLE_MBOX_DATA_LSB 0 -#define INT_STATUS_ENABLE_MBOX_DATA_MASK 'h0000000f -#define INT_STATUS_ENABLE_MBOX_DATA_GET(x) (((x) & INT_STATUS_ENABLE_MBOX_DATA_MASK) >> INT_STATUS_ENABLE_MBOX_DATA_LSB) -#define INT_STATUS_ENABLE_MBOX_DATA_SET(x) (((8'd0 | (x)) << INT_STATUS_ENABLE_MBOX_DATA_LSB) & INT_STATUS_ENABLE_MBOX_DATA_MASK) -#define INT_STATUS_ENABLE_MBOX_DATA_RESET 4'hf -#define INT_STATUS_ENABLE_RESET (8'h0 | \ - INT_STATUS_ENABLE_ERROR_SET(INT_STATUS_ENABLE_ERROR_RESET) | \ - INT_STATUS_ENABLE_CPU_SET(INT_STATUS_ENABLE_CPU_RESET) | \ - INT_STATUS_ENABLE_DRAGON_INT_SET(INT_STATUS_ENABLE_DRAGON_INT_RESET) | \ - INT_STATUS_ENABLE_COUNTER_SET(INT_STATUS_ENABLE_COUNTER_RESET) | \ - INT_STATUS_ENABLE_MBOX_DATA_SET(INT_STATUS_ENABLE_MBOX_DATA_RESET)) -#define INT_STATUS_ENABLE_HW_MASK (8'h0) -#define INT_STATUS_ENABLE_SW_MASK (8'h0 | \ - INT_STATUS_ENABLE_ERROR_MASK | \ - INT_STATUS_ENABLE_CPU_MASK | \ - INT_STATUS_ENABLE_DRAGON_INT_MASK | \ - INT_STATUS_ENABLE_COUNTER_MASK | \ - INT_STATUS_ENABLE_MBOX_DATA_MASK) - -#define CPU_INT_STATUS_ENABLE_ADDRESS 'h00000419 -#define CPU_INT_STATUS_ENABLE_BIT_MSB 7 -#define CPU_INT_STATUS_ENABLE_BIT_LSB 0 -#define CPU_INT_STATUS_ENABLE_BIT_MASK 'h000000ff -#define CPU_INT_STATUS_ENABLE_BIT_GET(x) (((x) & CPU_INT_STATUS_ENABLE_BIT_MASK) >> CPU_INT_STATUS_ENABLE_BIT_LSB) -#define CPU_INT_STATUS_ENABLE_BIT_SET(x) (((8'd0 | (x)) << CPU_INT_STATUS_ENABLE_BIT_LSB) & CPU_INT_STATUS_ENABLE_BIT_MASK) -#define CPU_INT_STATUS_ENABLE_BIT_RESET 8'hff -#define CPU_INT_STATUS_ENABLE_RESET (8'h0 | \ - CPU_INT_STATUS_ENABLE_BIT_SET(CPU_INT_STATUS_ENABLE_BIT_RESET)) -#define CPU_INT_STATUS_ENABLE_HW_MASK (8'h0) -#define CPU_INT_STATUS_ENABLE_SW_MASK (8'h0 | \ - CPU_INT_STATUS_ENABLE_BIT_MASK) - -#define ERROR_STATUS_ENABLE_ADDRESS 'h0000041a -#define ERROR_STATUS_ENABLE_WAKEUP_MSB 2 -#define ERROR_STATUS_ENABLE_WAKEUP_LSB 2 -#define ERROR_STATUS_ENABLE_WAKEUP_MASK 'h00000004 -#define ERROR_STATUS_ENABLE_WAKEUP_GET(x) (((x) & ERROR_STATUS_ENABLE_WAKEUP_MASK) >> ERROR_STATUS_ENABLE_WAKEUP_LSB) -#define ERROR_STATUS_ENABLE_WAKEUP_SET(x) (((8'd0 | (x)) << ERROR_STATUS_ENABLE_WAKEUP_LSB) & ERROR_STATUS_ENABLE_WAKEUP_MASK) -#define ERROR_STATUS_ENABLE_WAKEUP_RESET 1'h0 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MSB 1 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB 1 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 'h00000002 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK) >> ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_SET(x) (((8'd0 | (x)) << ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) & ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_RESET 1'h0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_MSB 0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB 0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK 'h00000001 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) >> ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_SET(x) (((8'd0 | (x)) << ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) & ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_RESET 1'h0 -#define ERROR_STATUS_ENABLE_RESET (8'h0 | \ - ERROR_STATUS_ENABLE_WAKEUP_SET(ERROR_STATUS_ENABLE_WAKEUP_RESET) | \ - ERROR_STATUS_ENABLE_RX_UNDERFLOW_SET(ERROR_STATUS_ENABLE_RX_UNDERFLOW_RESET) | \ - ERROR_STATUS_ENABLE_TX_OVERFLOW_SET(ERROR_STATUS_ENABLE_TX_OVERFLOW_RESET)) -#define ERROR_STATUS_ENABLE_HW_MASK (8'h0) -#define ERROR_STATUS_ENABLE_SW_MASK (8'h0 | \ - ERROR_STATUS_ENABLE_WAKEUP_MASK | \ - ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK | \ - ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) - -#define COUNTER_INT_STATUS_ENABLE_ADDRESS 'h0000041b -#define COUNTER_INT_STATUS_ENABLE_BIT_MSB 7 -#define COUNTER_INT_STATUS_ENABLE_BIT_LSB 0 -#define COUNTER_INT_STATUS_ENABLE_BIT_MASK 'h000000ff -#define COUNTER_INT_STATUS_ENABLE_BIT_GET(x) (((x) & COUNTER_INT_STATUS_ENABLE_BIT_MASK) >> COUNTER_INT_STATUS_ENABLE_BIT_LSB) -#define COUNTER_INT_STATUS_ENABLE_BIT_SET(x) (((8'd0 | (x)) << COUNTER_INT_STATUS_ENABLE_BIT_LSB) & COUNTER_INT_STATUS_ENABLE_BIT_MASK) -#define COUNTER_INT_STATUS_ENABLE_BIT_RESET 8'hff -#define COUNTER_INT_STATUS_ENABLE_RESET (8'h0 | \ - COUNTER_INT_STATUS_ENABLE_BIT_SET(COUNTER_INT_STATUS_ENABLE_BIT_RESET)) -#define COUNTER_INT_STATUS_ENABLE_HW_MASK (8'h0) -#define COUNTER_INT_STATUS_ENABLE_SW_MASK (8'h0 | \ - COUNTER_INT_STATUS_ENABLE_BIT_MASK) - -#define COUNT_ADDRESS 'h00000420 -#define COUNT_VALUE_MSB 7 -#define COUNT_VALUE_LSB 0 -#define COUNT_VALUE_MASK 'h000000ff -#define COUNT_VALUE_GET(x) (((x) & COUNT_VALUE_MASK) >> COUNT_VALUE_LSB) -#define COUNT_VALUE_SET(x) (((8'd0 | (x)) << COUNT_VALUE_LSB) & COUNT_VALUE_MASK) -#define COUNT_VALUE_RESET 8'h0 -#define COUNT_RESET (8'h0 | \ - COUNT_VALUE_SET(COUNT_VALUE_RESET)) -#define COUNT_HW_MASK (8'h0 | \ - COUNT_VALUE_MASK) -#define COUNT_SW_MASK (8'h0 | \ - COUNT_VALUE_MASK) - -#define COUNT_DEC_ADDRESS 'h00000440 -#define COUNT_DEC_VALUE_MSB 7 -#define COUNT_DEC_VALUE_LSB 0 -#define COUNT_DEC_VALUE_MASK 'h000000ff -#define COUNT_DEC_VALUE_GET(x) (((x) & COUNT_DEC_VALUE_MASK) >> COUNT_DEC_VALUE_LSB) -#define COUNT_DEC_VALUE_SET(x) (((8'd0 | (x)) << COUNT_DEC_VALUE_LSB) & COUNT_DEC_VALUE_MASK) -#define COUNT_DEC_VALUE_RESET 8'h0 -#define COUNT_DEC_RESET (8'h0 | \ - COUNT_DEC_VALUE_SET(COUNT_DEC_VALUE_RESET)) -#define COUNT_DEC_HW_MASK (8'h0 | \ - COUNT_DEC_VALUE_MASK) -#define COUNT_DEC_SW_MASK (8'h0 | \ - COUNT_DEC_VALUE_MASK) - -#define SCRATCH_ADDRESS 'h00000460 -#define SCRATCH_VALUE_MSB 7 -#define SCRATCH_VALUE_LSB 0 -#define SCRATCH_VALUE_MASK 'h000000ff -#define SCRATCH_VALUE_GET(x) (((x) & SCRATCH_VALUE_MASK) >> SCRATCH_VALUE_LSB) -#define SCRATCH_VALUE_SET(x) (((8'd0 | (x)) << SCRATCH_VALUE_LSB) & SCRATCH_VALUE_MASK) -#define SCRATCH_VALUE_RESET 8'h0 -#define SCRATCH_RESET (8'h0 | \ - SCRATCH_VALUE_SET(SCRATCH_VALUE_RESET)) -#define SCRATCH_HW_MASK (8'h0 | \ - SCRATCH_VALUE_MASK) -#define SCRATCH_SW_MASK (8'h0 | \ - SCRATCH_VALUE_MASK) - -#define FIFO_TIMEOUT_ADDRESS 'h00000468 -#define FIFO_TIMEOUT_VALUE_MSB 7 -#define FIFO_TIMEOUT_VALUE_LSB 0 -#define FIFO_TIMEOUT_VALUE_MASK 'h000000ff -#define FIFO_TIMEOUT_VALUE_GET(x) (((x) & FIFO_TIMEOUT_VALUE_MASK) >> FIFO_TIMEOUT_VALUE_LSB) -#define FIFO_TIMEOUT_VALUE_SET(x) (((8'd0 | (x)) << FIFO_TIMEOUT_VALUE_LSB) & FIFO_TIMEOUT_VALUE_MASK) -#define FIFO_TIMEOUT_VALUE_RESET 8'hff -#define FIFO_TIMEOUT_RESET (8'h0 | \ - FIFO_TIMEOUT_VALUE_SET(FIFO_TIMEOUT_VALUE_RESET)) -#define FIFO_TIMEOUT_HW_MASK (8'h0) -#define FIFO_TIMEOUT_SW_MASK (8'h0 | \ - FIFO_TIMEOUT_VALUE_MASK) - -#define FIFO_TIMEOUT_ENABLE_ADDRESS 'h00000469 -#define FIFO_TIMEOUT_ENABLE_SET_MSB 0 -#define FIFO_TIMEOUT_ENABLE_SET_LSB 0 -#define FIFO_TIMEOUT_ENABLE_SET_MASK 'h00000001 -#define FIFO_TIMEOUT_ENABLE_SET_GET(x) (((x) & FIFO_TIMEOUT_ENABLE_SET_MASK) >> FIFO_TIMEOUT_ENABLE_SET_LSB) -#define FIFO_TIMEOUT_ENABLE_SET_SET(x) (((8'd0 | (x)) << FIFO_TIMEOUT_ENABLE_SET_LSB) & FIFO_TIMEOUT_ENABLE_SET_MASK) -#define FIFO_TIMEOUT_ENABLE_SET_RESET 1'h1 -#define FIFO_TIMEOUT_ENABLE_RESET (8'h0 | \ - FIFO_TIMEOUT_ENABLE_SET_SET(FIFO_TIMEOUT_ENABLE_SET_RESET)) -#define FIFO_TIMEOUT_ENABLE_HW_MASK (8'h0) -#define FIFO_TIMEOUT_ENABLE_SW_MASK (8'h0 | \ - FIFO_TIMEOUT_ENABLE_SET_MASK) - -#define DISABLE_SLEEP_ADDRESS 'h0000046a -#define DISABLE_SLEEP_FOR_INT_MSB 1 -#define DISABLE_SLEEP_FOR_INT_LSB 1 -#define DISABLE_SLEEP_FOR_INT_MASK 'h00000002 -#define DISABLE_SLEEP_FOR_INT_GET(x) (((x) & DISABLE_SLEEP_FOR_INT_MASK) >> DISABLE_SLEEP_FOR_INT_LSB) -#define DISABLE_SLEEP_FOR_INT_SET(x) (((8'd0 | (x)) << DISABLE_SLEEP_FOR_INT_LSB) & DISABLE_SLEEP_FOR_INT_MASK) -#define DISABLE_SLEEP_FOR_INT_RESET 1'h0 -#define DISABLE_SLEEP_ON_MSB 0 -#define DISABLE_SLEEP_ON_LSB 0 -#define DISABLE_SLEEP_ON_MASK 'h00000001 -#define DISABLE_SLEEP_ON_GET(x) (((x) & DISABLE_SLEEP_ON_MASK) >> DISABLE_SLEEP_ON_LSB) -#define DISABLE_SLEEP_ON_SET(x) (((8'd0 | (x)) << DISABLE_SLEEP_ON_LSB) & DISABLE_SLEEP_ON_MASK) -#define DISABLE_SLEEP_ON_RESET 1'h0 -#define DISABLE_SLEEP_RESET (8'h0 | \ - DISABLE_SLEEP_FOR_INT_SET(DISABLE_SLEEP_FOR_INT_RESET) | \ - DISABLE_SLEEP_ON_SET(DISABLE_SLEEP_ON_RESET)) -#define DISABLE_SLEEP_HW_MASK (8'h0) -#define DISABLE_SLEEP_SW_MASK (8'h0 | \ - DISABLE_SLEEP_FOR_INT_MASK | \ - DISABLE_SLEEP_ON_MASK) - -#define LOCAL_BUS_ADDRESS 'h00000470 -#define LOCAL_BUS_STATE_MSB 1 -#define LOCAL_BUS_STATE_LSB 0 -#define LOCAL_BUS_STATE_MASK 'h00000003 -#define LOCAL_BUS_STATE_GET(x) (((x) & LOCAL_BUS_STATE_MASK) >> LOCAL_BUS_STATE_LSB) -#define LOCAL_BUS_STATE_SET(x) (((8'd0 | (x)) << LOCAL_BUS_STATE_LSB) & LOCAL_BUS_STATE_MASK) -#define LOCAL_BUS_STATE_RESET 2'h0 -#define LOCAL_BUS_RESET (8'h0 | \ - LOCAL_BUS_STATE_SET(LOCAL_BUS_STATE_RESET)) -#define LOCAL_BUS_HW_MASK (8'h0 | \ - LOCAL_BUS_STATE_MASK) -#define LOCAL_BUS_SW_MASK (8'h0) - -#define INT_WLAN_ADDRESS 'h00000472 -#define INT_WLAN_VECTOR_MSB 7 -#define INT_WLAN_VECTOR_LSB 0 -#define INT_WLAN_VECTOR_MASK 'h000000ff -#define INT_WLAN_VECTOR_GET(x) (((x) & INT_WLAN_VECTOR_MASK) >> INT_WLAN_VECTOR_LSB) -#define INT_WLAN_VECTOR_SET(x) (((8'd0 | (x)) << INT_WLAN_VECTOR_LSB) & INT_WLAN_VECTOR_MASK) -#define INT_WLAN_VECTOR_RESET 8'h0 -#define INT_WLAN_RESET (8'h0 | \ - INT_WLAN_VECTOR_SET(INT_WLAN_VECTOR_RESET)) -#define INT_WLAN_HW_MASK (8'h0 | \ - INT_WLAN_VECTOR_MASK) -#define INT_WLAN_SW_MASK (8'h0 | \ - INT_WLAN_VECTOR_MASK) - -#define WINDOW_DATA_ADDRESS 'h00000474 -#define WINDOW_DATA_DATA_MSB 7 -#define WINDOW_DATA_DATA_LSB 0 -#define WINDOW_DATA_DATA_MASK 'h000000ff -#define WINDOW_DATA_DATA_GET(x) (((x) & WINDOW_DATA_DATA_MASK) >> WINDOW_DATA_DATA_LSB) -#define WINDOW_DATA_DATA_SET(x) (((8'd0 | (x)) << WINDOW_DATA_DATA_LSB) & WINDOW_DATA_DATA_MASK) -#define WINDOW_DATA_DATA_RESET 8'h0 -#define WINDOW_DATA_RESET (8'h0 | \ - WINDOW_DATA_DATA_SET(WINDOW_DATA_DATA_RESET)) -#define WINDOW_DATA_HW_MASK (8'h0 | \ - WINDOW_DATA_DATA_MASK) -#define WINDOW_DATA_SW_MASK (8'h0 | \ - WINDOW_DATA_DATA_MASK) - -#define WINDOW_WRITE_ADDR_ADDRESS 'h00000478 -#define WINDOW_WRITE_ADDR_ADDR_MSB 7 -#define WINDOW_WRITE_ADDR_ADDR_LSB 0 -#define WINDOW_WRITE_ADDR_ADDR_MASK 'h000000ff -#define WINDOW_WRITE_ADDR_ADDR_GET(x) (((x) & WINDOW_WRITE_ADDR_ADDR_MASK) >> WINDOW_WRITE_ADDR_ADDR_LSB) -#define WINDOW_WRITE_ADDR_ADDR_SET(x) (((8'd0 | (x)) << WINDOW_WRITE_ADDR_ADDR_LSB) & WINDOW_WRITE_ADDR_ADDR_MASK) -#define WINDOW_WRITE_ADDR_ADDR_RESET 8'h0 -#define WINDOW_WRITE_ADDR_RESET (8'h0 | \ - WINDOW_WRITE_ADDR_ADDR_SET(WINDOW_WRITE_ADDR_ADDR_RESET)) -#define WINDOW_WRITE_ADDR_HW_MASK (8'h0) -#define WINDOW_WRITE_ADDR_SW_MASK (8'h0 | \ - WINDOW_WRITE_ADDR_ADDR_MASK) - -#define WINDOW_READ_ADDR_ADDRESS 'h0000047c -#define WINDOW_READ_ADDR_ADDR_MSB 7 -#define WINDOW_READ_ADDR_ADDR_LSB 0 -#define WINDOW_READ_ADDR_ADDR_MASK 'h000000ff -#define WINDOW_READ_ADDR_ADDR_GET(x) (((x) & WINDOW_READ_ADDR_ADDR_MASK) >> WINDOW_READ_ADDR_ADDR_LSB) -#define WINDOW_READ_ADDR_ADDR_SET(x) (((8'd0 | (x)) << WINDOW_READ_ADDR_ADDR_LSB) & WINDOW_READ_ADDR_ADDR_MASK) -#define WINDOW_READ_ADDR_ADDR_RESET 8'h0 -#define WINDOW_READ_ADDR_RESET (8'h0 | \ - WINDOW_READ_ADDR_ADDR_SET(WINDOW_READ_ADDR_ADDR_RESET)) -#define WINDOW_READ_ADDR_HW_MASK (8'h0) -#define WINDOW_READ_ADDR_SW_MASK (8'h0 | \ - WINDOW_READ_ADDR_ADDR_MASK) - -#define SPI_CONFIG_ADDRESS 'h00000480 -#define SPI_CONFIG_SPI_RESET_MSB 4 -#define SPI_CONFIG_SPI_RESET_LSB 4 -#define SPI_CONFIG_SPI_RESET_MASK 'h00000010 -#define SPI_CONFIG_SPI_RESET_GET(x) (((x) & SPI_CONFIG_SPI_RESET_MASK) >> SPI_CONFIG_SPI_RESET_LSB) -#define SPI_CONFIG_SPI_RESET_SET(x) (((8'd0 | (x)) << SPI_CONFIG_SPI_RESET_LSB) & SPI_CONFIG_SPI_RESET_MASK) -#define SPI_CONFIG_SPI_RESET_RESET 1'h0 -#define SPI_CONFIG_INTERRUPT_ENABLE_MSB 3 -#define SPI_CONFIG_INTERRUPT_ENABLE_LSB 3 -#define SPI_CONFIG_INTERRUPT_ENABLE_MASK 'h00000008 -#define SPI_CONFIG_INTERRUPT_ENABLE_GET(x) (((x) & SPI_CONFIG_INTERRUPT_ENABLE_MASK) >> SPI_CONFIG_INTERRUPT_ENABLE_LSB) -#define SPI_CONFIG_INTERRUPT_ENABLE_SET(x) (((8'd0 | (x)) << SPI_CONFIG_INTERRUPT_ENABLE_LSB) & SPI_CONFIG_INTERRUPT_ENABLE_MASK) -#define SPI_CONFIG_INTERRUPT_ENABLE_RESET 1'h0 -#define SPI_CONFIG_TEST_MODE_MSB 2 -#define SPI_CONFIG_TEST_MODE_LSB 2 -#define SPI_CONFIG_TEST_MODE_MASK 'h00000004 -#define SPI_CONFIG_TEST_MODE_GET(x) (((x) & SPI_CONFIG_TEST_MODE_MASK) >> SPI_CONFIG_TEST_MODE_LSB) -#define SPI_CONFIG_TEST_MODE_SET(x) (((8'd0 | (x)) << SPI_CONFIG_TEST_MODE_LSB) & SPI_CONFIG_TEST_MODE_MASK) -#define SPI_CONFIG_TEST_MODE_RESET 1'h0 -#define SPI_CONFIG_DATA_SIZE_MSB 1 -#define SPI_CONFIG_DATA_SIZE_LSB 0 -#define SPI_CONFIG_DATA_SIZE_MASK 'h00000003 -#define SPI_CONFIG_DATA_SIZE_GET(x) (((x) & SPI_CONFIG_DATA_SIZE_MASK) >> SPI_CONFIG_DATA_SIZE_LSB) -#define SPI_CONFIG_DATA_SIZE_SET(x) (((8'd0 | (x)) << SPI_CONFIG_DATA_SIZE_LSB) & SPI_CONFIG_DATA_SIZE_MASK) -#define SPI_CONFIG_DATA_SIZE_RESET 2'h2 -#define SPI_CONFIG_RESET (8'h0 | \ - SPI_CONFIG_SPI_RESET_SET(SPI_CONFIG_SPI_RESET_RESET) | \ - SPI_CONFIG_INTERRUPT_ENABLE_SET(SPI_CONFIG_INTERRUPT_ENABLE_RESET) | \ - SPI_CONFIG_TEST_MODE_SET(SPI_CONFIG_TEST_MODE_RESET) | \ - SPI_CONFIG_DATA_SIZE_SET(SPI_CONFIG_DATA_SIZE_RESET)) -#define SPI_CONFIG_HW_MASK (8'h0) -#define SPI_CONFIG_SW_MASK (8'h0 | \ - SPI_CONFIG_SPI_RESET_MASK | \ - SPI_CONFIG_INTERRUPT_ENABLE_MASK | \ - SPI_CONFIG_TEST_MODE_MASK | \ - SPI_CONFIG_DATA_SIZE_MASK) - -#define SPI_STATUS_ADDRESS 'h00000481 -#define SPI_STATUS_ADDR_ERR_MSB 3 -#define SPI_STATUS_ADDR_ERR_LSB 3 -#define SPI_STATUS_ADDR_ERR_MASK 'h00000008 -#define SPI_STATUS_ADDR_ERR_GET(x) (((x) & SPI_STATUS_ADDR_ERR_MASK) >> SPI_STATUS_ADDR_ERR_LSB) -#define SPI_STATUS_ADDR_ERR_SET(x) (((8'd0 | (x)) << SPI_STATUS_ADDR_ERR_LSB) & SPI_STATUS_ADDR_ERR_MASK) -#define SPI_STATUS_ADDR_ERR_RESET 1'h0 -#define SPI_STATUS_RD_ERR_MSB 2 -#define SPI_STATUS_RD_ERR_LSB 2 -#define SPI_STATUS_RD_ERR_MASK 'h00000004 -#define SPI_STATUS_RD_ERR_GET(x) (((x) & SPI_STATUS_RD_ERR_MASK) >> SPI_STATUS_RD_ERR_LSB) -#define SPI_STATUS_RD_ERR_SET(x) (((8'd0 | (x)) << SPI_STATUS_RD_ERR_LSB) & SPI_STATUS_RD_ERR_MASK) -#define SPI_STATUS_RD_ERR_RESET 1'h0 -#define SPI_STATUS_WR_ERR_MSB 1 -#define SPI_STATUS_WR_ERR_LSB 1 -#define SPI_STATUS_WR_ERR_MASK 'h00000002 -#define SPI_STATUS_WR_ERR_GET(x) (((x) & SPI_STATUS_WR_ERR_MASK) >> SPI_STATUS_WR_ERR_LSB) -#define SPI_STATUS_WR_ERR_SET(x) (((8'd0 | (x)) << SPI_STATUS_WR_ERR_LSB) & SPI_STATUS_WR_ERR_MASK) -#define SPI_STATUS_WR_ERR_RESET 1'h0 -#define SPI_STATUS_READY_MSB 0 -#define SPI_STATUS_READY_LSB 0 -#define SPI_STATUS_READY_MASK 'h00000001 -#define SPI_STATUS_READY_GET(x) (((x) & SPI_STATUS_READY_MASK) >> SPI_STATUS_READY_LSB) -#define SPI_STATUS_READY_SET(x) (((8'd0 | (x)) << SPI_STATUS_READY_LSB) & SPI_STATUS_READY_MASK) -#define SPI_STATUS_READY_RESET 1'h1 -#define SPI_STATUS_RESET (8'h0 | \ - SPI_STATUS_ADDR_ERR_SET(SPI_STATUS_ADDR_ERR_RESET) | \ - SPI_STATUS_RD_ERR_SET(SPI_STATUS_RD_ERR_RESET) | \ - SPI_STATUS_WR_ERR_SET(SPI_STATUS_WR_ERR_RESET) | \ - SPI_STATUS_READY_SET(SPI_STATUS_READY_RESET)) -#define SPI_STATUS_HW_MASK (8'h0 | \ - SPI_STATUS_ADDR_ERR_MASK | \ - SPI_STATUS_RD_ERR_MASK | \ - SPI_STATUS_WR_ERR_MASK | \ - SPI_STATUS_READY_MASK) -#define SPI_STATUS_SW_MASK (8'h0 | \ - SPI_STATUS_ADDR_ERR_MASK | \ - SPI_STATUS_RD_ERR_MASK | \ - SPI_STATUS_WR_ERR_MASK) - -#define NON_ASSOC_SLEEP_EN_ADDRESS 'h00000482 -#define NON_ASSOC_SLEEP_EN_BIT_MSB 0 -#define NON_ASSOC_SLEEP_EN_BIT_LSB 0 -#define NON_ASSOC_SLEEP_EN_BIT_MASK 'h00000001 -#define NON_ASSOC_SLEEP_EN_BIT_GET(x) (((x) & NON_ASSOC_SLEEP_EN_BIT_MASK) >> NON_ASSOC_SLEEP_EN_BIT_LSB) -#define NON_ASSOC_SLEEP_EN_BIT_SET(x) (((8'd0 | (x)) << NON_ASSOC_SLEEP_EN_BIT_LSB) & NON_ASSOC_SLEEP_EN_BIT_MASK) -#define NON_ASSOC_SLEEP_EN_BIT_RESET 1'h0 -#define NON_ASSOC_SLEEP_EN_RESET (8'h0 | \ - NON_ASSOC_SLEEP_EN_BIT_SET(NON_ASSOC_SLEEP_EN_BIT_RESET)) -#define NON_ASSOC_SLEEP_EN_HW_MASK (8'h0) -#define NON_ASSOC_SLEEP_EN_SW_MASK (8'h0 | \ - NON_ASSOC_SLEEP_EN_BIT_MASK) - -#define CIS_WINDOW_ADDRESS 'h00000600 -#define CIS_WINDOW_DATA_MSB 7 -#define CIS_WINDOW_DATA_LSB 0 -#define CIS_WINDOW_DATA_MASK 'h000000ff -#define CIS_WINDOW_DATA_GET(x) (((x) & CIS_WINDOW_DATA_MASK) >> CIS_WINDOW_DATA_LSB) -#define CIS_WINDOW_DATA_SET(x) (((8'd0 | (x)) << CIS_WINDOW_DATA_LSB) & CIS_WINDOW_DATA_MASK) -#define CIS_WINDOW_DATA_RESET 8'h0 -#define CIS_WINDOW_RESET (8'h0 | \ - CIS_WINDOW_DATA_SET(CIS_WINDOW_DATA_RESET)) -#define CIS_WINDOW_HW_MASK (8'h0) -#define CIS_WINDOW_SW_MASK (8'h0 | \ - CIS_WINDOW_DATA_MASK) - -#define MBOX_HOST_REG_ADDRESS_MSB 10 - -#endif /* _MBOX_HOST_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_reg.h deleted file mode 100644 index 4e07d2286107..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_reg.h +++ /dev/null @@ -1,481 +0,0 @@ -#ifndef _MBOX_REG_REG_H_ -#define _MBOX_REG_REG_H_ - -#define MBOX_FIFO_ADDRESS 0x00000000 -#define MBOX_FIFO_OFFSET 0x00000000 -#define MBOX_FIFO_DATA_MSB 19 -#define MBOX_FIFO_DATA_LSB 0 -#define MBOX_FIFO_DATA_MASK 0x000fffff -#define MBOX_FIFO_DATA_GET(x) (((x) & MBOX_FIFO_DATA_MASK) >> MBOX_FIFO_DATA_LSB) -#define MBOX_FIFO_DATA_SET(x) (((x) << MBOX_FIFO_DATA_LSB) & MBOX_FIFO_DATA_MASK) - -#define MBOX_FIFO_STATUS_ADDRESS 0x00000010 -#define MBOX_FIFO_STATUS_OFFSET 0x00000010 -#define MBOX_FIFO_STATUS_EMPTY_MSB 19 -#define MBOX_FIFO_STATUS_EMPTY_LSB 16 -#define MBOX_FIFO_STATUS_EMPTY_MASK 0x000f0000 -#define MBOX_FIFO_STATUS_EMPTY_GET(x) (((x) & MBOX_FIFO_STATUS_EMPTY_MASK) >> MBOX_FIFO_STATUS_EMPTY_LSB) -#define MBOX_FIFO_STATUS_EMPTY_SET(x) (((x) << MBOX_FIFO_STATUS_EMPTY_LSB) & MBOX_FIFO_STATUS_EMPTY_MASK) -#define MBOX_FIFO_STATUS_FULL_MSB 15 -#define MBOX_FIFO_STATUS_FULL_LSB 12 -#define MBOX_FIFO_STATUS_FULL_MASK 0x0000f000 -#define MBOX_FIFO_STATUS_FULL_GET(x) (((x) & MBOX_FIFO_STATUS_FULL_MASK) >> MBOX_FIFO_STATUS_FULL_LSB) -#define MBOX_FIFO_STATUS_FULL_SET(x) (((x) << MBOX_FIFO_STATUS_FULL_LSB) & MBOX_FIFO_STATUS_FULL_MASK) - -#define MBOX_DMA_POLICY_ADDRESS 0x00000014 -#define MBOX_DMA_POLICY_OFFSET 0x00000014 -#define MBOX_DMA_POLICY_TX_QUANTUM_MSB 3 -#define MBOX_DMA_POLICY_TX_QUANTUM_LSB 3 -#define MBOX_DMA_POLICY_TX_QUANTUM_MASK 0x00000008 -#define MBOX_DMA_POLICY_TX_QUANTUM_GET(x) (((x) & MBOX_DMA_POLICY_TX_QUANTUM_MASK) >> MBOX_DMA_POLICY_TX_QUANTUM_LSB) -#define MBOX_DMA_POLICY_TX_QUANTUM_SET(x) (((x) << MBOX_DMA_POLICY_TX_QUANTUM_LSB) & MBOX_DMA_POLICY_TX_QUANTUM_MASK) -#define MBOX_DMA_POLICY_TX_ORDER_MSB 2 -#define MBOX_DMA_POLICY_TX_ORDER_LSB 2 -#define MBOX_DMA_POLICY_TX_ORDER_MASK 0x00000004 -#define MBOX_DMA_POLICY_TX_ORDER_GET(x) (((x) & MBOX_DMA_POLICY_TX_ORDER_MASK) >> MBOX_DMA_POLICY_TX_ORDER_LSB) -#define MBOX_DMA_POLICY_TX_ORDER_SET(x) (((x) << MBOX_DMA_POLICY_TX_ORDER_LSB) & MBOX_DMA_POLICY_TX_ORDER_MASK) -#define MBOX_DMA_POLICY_RX_QUANTUM_MSB 1 -#define MBOX_DMA_POLICY_RX_QUANTUM_LSB 1 -#define MBOX_DMA_POLICY_RX_QUANTUM_MASK 0x00000002 -#define MBOX_DMA_POLICY_RX_QUANTUM_GET(x) (((x) & MBOX_DMA_POLICY_RX_QUANTUM_MASK) >> MBOX_DMA_POLICY_RX_QUANTUM_LSB) -#define MBOX_DMA_POLICY_RX_QUANTUM_SET(x) (((x) << MBOX_DMA_POLICY_RX_QUANTUM_LSB) & MBOX_DMA_POLICY_RX_QUANTUM_MASK) -#define MBOX_DMA_POLICY_RX_ORDER_MSB 0 -#define MBOX_DMA_POLICY_RX_ORDER_LSB 0 -#define MBOX_DMA_POLICY_RX_ORDER_MASK 0x00000001 -#define MBOX_DMA_POLICY_RX_ORDER_GET(x) (((x) & MBOX_DMA_POLICY_RX_ORDER_MASK) >> MBOX_DMA_POLICY_RX_ORDER_LSB) -#define MBOX_DMA_POLICY_RX_ORDER_SET(x) (((x) << MBOX_DMA_POLICY_RX_ORDER_LSB) & MBOX_DMA_POLICY_RX_ORDER_MASK) - -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000018 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000018 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX0_DMA_RX_CONTROL_ADDRESS 0x0000001c -#define MBOX0_DMA_RX_CONTROL_OFFSET 0x0000001c -#define MBOX0_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX0_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX0_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX0_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_RESUME_MASK) >> MBOX0_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX0_DMA_RX_CONTROL_RESUME_SET(x) (((x) << MBOX0_DMA_RX_CONTROL_RESUME_LSB) & MBOX0_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX0_DMA_RX_CONTROL_START_MSB 1 -#define MBOX0_DMA_RX_CONTROL_START_LSB 1 -#define MBOX0_DMA_RX_CONTROL_START_MASK 0x00000002 -#define MBOX0_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_START_MASK) >> MBOX0_DMA_RX_CONTROL_START_LSB) -#define MBOX0_DMA_RX_CONTROL_START_SET(x) (((x) << MBOX0_DMA_RX_CONTROL_START_LSB) & MBOX0_DMA_RX_CONTROL_START_MASK) -#define MBOX0_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX0_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX0_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define MBOX0_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_STOP_MASK) >> MBOX0_DMA_RX_CONTROL_STOP_LSB) -#define MBOX0_DMA_RX_CONTROL_STOP_SET(x) (((x) << MBOX0_DMA_RX_CONTROL_STOP_LSB) & MBOX0_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000020 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000020 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX0_DMA_TX_CONTROL_ADDRESS 0x00000024 -#define MBOX0_DMA_TX_CONTROL_OFFSET 0x00000024 -#define MBOX0_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX0_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX0_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX0_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_RESUME_MASK) >> MBOX0_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX0_DMA_TX_CONTROL_RESUME_SET(x) (((x) << MBOX0_DMA_TX_CONTROL_RESUME_LSB) & MBOX0_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX0_DMA_TX_CONTROL_START_MSB 1 -#define MBOX0_DMA_TX_CONTROL_START_LSB 1 -#define MBOX0_DMA_TX_CONTROL_START_MASK 0x00000002 -#define MBOX0_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_START_MASK) >> MBOX0_DMA_TX_CONTROL_START_LSB) -#define MBOX0_DMA_TX_CONTROL_START_SET(x) (((x) << MBOX0_DMA_TX_CONTROL_START_LSB) & MBOX0_DMA_TX_CONTROL_START_MASK) -#define MBOX0_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX0_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX0_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define MBOX0_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_STOP_MASK) >> MBOX0_DMA_TX_CONTROL_STOP_LSB) -#define MBOX0_DMA_TX_CONTROL_STOP_SET(x) (((x) << MBOX0_DMA_TX_CONTROL_STOP_LSB) & MBOX0_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000028 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000028 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX1_DMA_RX_CONTROL_ADDRESS 0x0000002c -#define MBOX1_DMA_RX_CONTROL_OFFSET 0x0000002c -#define MBOX1_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX1_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX1_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX1_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX1_DMA_RX_CONTROL_RESUME_MASK) >> MBOX1_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX1_DMA_RX_CONTROL_RESUME_SET(x) (((x) << MBOX1_DMA_RX_CONTROL_RESUME_LSB) & MBOX1_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX1_DMA_RX_CONTROL_START_MSB 1 -#define MBOX1_DMA_RX_CONTROL_START_LSB 1 -#define MBOX1_DMA_RX_CONTROL_START_MASK 0x00000002 -#define MBOX1_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX1_DMA_RX_CONTROL_START_MASK) >> MBOX1_DMA_RX_CONTROL_START_LSB) -#define MBOX1_DMA_RX_CONTROL_START_SET(x) (((x) << MBOX1_DMA_RX_CONTROL_START_LSB) & MBOX1_DMA_RX_CONTROL_START_MASK) -#define MBOX1_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX1_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX1_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define MBOX1_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX1_DMA_RX_CONTROL_STOP_MASK) >> MBOX1_DMA_RX_CONTROL_STOP_LSB) -#define MBOX1_DMA_RX_CONTROL_STOP_SET(x) (((x) << MBOX1_DMA_RX_CONTROL_STOP_LSB) & MBOX1_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000030 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000030 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX1_DMA_TX_CONTROL_ADDRESS 0x00000034 -#define MBOX1_DMA_TX_CONTROL_OFFSET 0x00000034 -#define MBOX1_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX1_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX1_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX1_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX1_DMA_TX_CONTROL_RESUME_MASK) >> MBOX1_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX1_DMA_TX_CONTROL_RESUME_SET(x) (((x) << MBOX1_DMA_TX_CONTROL_RESUME_LSB) & MBOX1_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX1_DMA_TX_CONTROL_START_MSB 1 -#define MBOX1_DMA_TX_CONTROL_START_LSB 1 -#define MBOX1_DMA_TX_CONTROL_START_MASK 0x00000002 -#define MBOX1_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX1_DMA_TX_CONTROL_START_MASK) >> MBOX1_DMA_TX_CONTROL_START_LSB) -#define MBOX1_DMA_TX_CONTROL_START_SET(x) (((x) << MBOX1_DMA_TX_CONTROL_START_LSB) & MBOX1_DMA_TX_CONTROL_START_MASK) -#define MBOX1_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX1_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX1_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define MBOX1_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX1_DMA_TX_CONTROL_STOP_MASK) >> MBOX1_DMA_TX_CONTROL_STOP_LSB) -#define MBOX1_DMA_TX_CONTROL_STOP_SET(x) (((x) << MBOX1_DMA_TX_CONTROL_STOP_LSB) & MBOX1_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000038 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000038 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX2_DMA_RX_CONTROL_ADDRESS 0x0000003c -#define MBOX2_DMA_RX_CONTROL_OFFSET 0x0000003c -#define MBOX2_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX2_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX2_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX2_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX2_DMA_RX_CONTROL_RESUME_MASK) >> MBOX2_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX2_DMA_RX_CONTROL_RESUME_SET(x) (((x) << MBOX2_DMA_RX_CONTROL_RESUME_LSB) & MBOX2_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX2_DMA_RX_CONTROL_START_MSB 1 -#define MBOX2_DMA_RX_CONTROL_START_LSB 1 -#define MBOX2_DMA_RX_CONTROL_START_MASK 0x00000002 -#define MBOX2_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX2_DMA_RX_CONTROL_START_MASK) >> MBOX2_DMA_RX_CONTROL_START_LSB) -#define MBOX2_DMA_RX_CONTROL_START_SET(x) (((x) << MBOX2_DMA_RX_CONTROL_START_LSB) & MBOX2_DMA_RX_CONTROL_START_MASK) -#define MBOX2_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX2_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX2_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define MBOX2_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX2_DMA_RX_CONTROL_STOP_MASK) >> MBOX2_DMA_RX_CONTROL_STOP_LSB) -#define MBOX2_DMA_RX_CONTROL_STOP_SET(x) (((x) << MBOX2_DMA_RX_CONTROL_STOP_LSB) & MBOX2_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000040 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000040 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX2_DMA_TX_CONTROL_ADDRESS 0x00000044 -#define MBOX2_DMA_TX_CONTROL_OFFSET 0x00000044 -#define MBOX2_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX2_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX2_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX2_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX2_DMA_TX_CONTROL_RESUME_MASK) >> MBOX2_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX2_DMA_TX_CONTROL_RESUME_SET(x) (((x) << MBOX2_DMA_TX_CONTROL_RESUME_LSB) & MBOX2_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX2_DMA_TX_CONTROL_START_MSB 1 -#define MBOX2_DMA_TX_CONTROL_START_LSB 1 -#define MBOX2_DMA_TX_CONTROL_START_MASK 0x00000002 -#define MBOX2_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX2_DMA_TX_CONTROL_START_MASK) >> MBOX2_DMA_TX_CONTROL_START_LSB) -#define MBOX2_DMA_TX_CONTROL_START_SET(x) (((x) << MBOX2_DMA_TX_CONTROL_START_LSB) & MBOX2_DMA_TX_CONTROL_START_MASK) -#define MBOX2_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX2_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX2_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define MBOX2_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX2_DMA_TX_CONTROL_STOP_MASK) >> MBOX2_DMA_TX_CONTROL_STOP_LSB) -#define MBOX2_DMA_TX_CONTROL_STOP_SET(x) (((x) << MBOX2_DMA_TX_CONTROL_STOP_LSB) & MBOX2_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000048 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000048 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX3_DMA_RX_CONTROL_ADDRESS 0x0000004c -#define MBOX3_DMA_RX_CONTROL_OFFSET 0x0000004c -#define MBOX3_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX3_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX3_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX3_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX3_DMA_RX_CONTROL_RESUME_MASK) >> MBOX3_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX3_DMA_RX_CONTROL_RESUME_SET(x) (((x) << MBOX3_DMA_RX_CONTROL_RESUME_LSB) & MBOX3_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX3_DMA_RX_CONTROL_START_MSB 1 -#define MBOX3_DMA_RX_CONTROL_START_LSB 1 -#define MBOX3_DMA_RX_CONTROL_START_MASK 0x00000002 -#define MBOX3_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX3_DMA_RX_CONTROL_START_MASK) >> MBOX3_DMA_RX_CONTROL_START_LSB) -#define MBOX3_DMA_RX_CONTROL_START_SET(x) (((x) << MBOX3_DMA_RX_CONTROL_START_LSB) & MBOX3_DMA_RX_CONTROL_START_MASK) -#define MBOX3_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX3_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX3_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define MBOX3_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX3_DMA_RX_CONTROL_STOP_MASK) >> MBOX3_DMA_RX_CONTROL_STOP_LSB) -#define MBOX3_DMA_RX_CONTROL_STOP_SET(x) (((x) << MBOX3_DMA_RX_CONTROL_STOP_LSB) & MBOX3_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000050 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000050 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX3_DMA_TX_CONTROL_ADDRESS 0x00000054 -#define MBOX3_DMA_TX_CONTROL_OFFSET 0x00000054 -#define MBOX3_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX3_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX3_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX3_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX3_DMA_TX_CONTROL_RESUME_MASK) >> MBOX3_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX3_DMA_TX_CONTROL_RESUME_SET(x) (((x) << MBOX3_DMA_TX_CONTROL_RESUME_LSB) & MBOX3_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX3_DMA_TX_CONTROL_START_MSB 1 -#define MBOX3_DMA_TX_CONTROL_START_LSB 1 -#define MBOX3_DMA_TX_CONTROL_START_MASK 0x00000002 -#define MBOX3_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX3_DMA_TX_CONTROL_START_MASK) >> MBOX3_DMA_TX_CONTROL_START_LSB) -#define MBOX3_DMA_TX_CONTROL_START_SET(x) (((x) << MBOX3_DMA_TX_CONTROL_START_LSB) & MBOX3_DMA_TX_CONTROL_START_MASK) -#define MBOX3_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX3_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX3_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define MBOX3_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX3_DMA_TX_CONTROL_STOP_MASK) >> MBOX3_DMA_TX_CONTROL_STOP_LSB) -#define MBOX3_DMA_TX_CONTROL_STOP_SET(x) (((x) << MBOX3_DMA_TX_CONTROL_STOP_LSB) & MBOX3_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX_INT_STATUS_ADDRESS 0x00000058 -#define MBOX_INT_STATUS_OFFSET 0x00000058 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_MSB 31 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB 28 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK 0xf0000000 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) >> MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) (((x) << MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) & MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB 27 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB 24 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK 0x0f000000 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) >> MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) (((x) << MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) & MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_MSB 23 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB 20 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK 0x00f00000 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) >> MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) (((x) << MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) & MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) -#define MBOX_INT_STATUS_TX_OVERFLOW_MSB 17 -#define MBOX_INT_STATUS_TX_OVERFLOW_LSB 17 -#define MBOX_INT_STATUS_TX_OVERFLOW_MASK 0x00020000 -#define MBOX_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & MBOX_INT_STATUS_TX_OVERFLOW_MASK) >> MBOX_INT_STATUS_TX_OVERFLOW_LSB) -#define MBOX_INT_STATUS_TX_OVERFLOW_SET(x) (((x) << MBOX_INT_STATUS_TX_OVERFLOW_LSB) & MBOX_INT_STATUS_TX_OVERFLOW_MASK) -#define MBOX_INT_STATUS_RX_UNDERFLOW_MSB 16 -#define MBOX_INT_STATUS_RX_UNDERFLOW_LSB 16 -#define MBOX_INT_STATUS_RX_UNDERFLOW_MASK 0x00010000 -#define MBOX_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & MBOX_INT_STATUS_RX_UNDERFLOW_MASK) >> MBOX_INT_STATUS_RX_UNDERFLOW_LSB) -#define MBOX_INT_STATUS_RX_UNDERFLOW_SET(x) (((x) << MBOX_INT_STATUS_RX_UNDERFLOW_LSB) & MBOX_INT_STATUS_RX_UNDERFLOW_MASK) -#define MBOX_INT_STATUS_TX_NOT_EMPTY_MSB 15 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_LSB 12 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_MASK 0x0000f000 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) (((x) & MBOX_INT_STATUS_TX_NOT_EMPTY_MASK) >> MBOX_INT_STATUS_TX_NOT_EMPTY_LSB) -#define MBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) (((x) << MBOX_INT_STATUS_TX_NOT_EMPTY_LSB) & MBOX_INT_STATUS_TX_NOT_EMPTY_MASK) -#define MBOX_INT_STATUS_RX_NOT_FULL_MSB 11 -#define MBOX_INT_STATUS_RX_NOT_FULL_LSB 8 -#define MBOX_INT_STATUS_RX_NOT_FULL_MASK 0x00000f00 -#define MBOX_INT_STATUS_RX_NOT_FULL_GET(x) (((x) & MBOX_INT_STATUS_RX_NOT_FULL_MASK) >> MBOX_INT_STATUS_RX_NOT_FULL_LSB) -#define MBOX_INT_STATUS_RX_NOT_FULL_SET(x) (((x) << MBOX_INT_STATUS_RX_NOT_FULL_LSB) & MBOX_INT_STATUS_RX_NOT_FULL_MASK) -#define MBOX_INT_STATUS_HOST_MSB 7 -#define MBOX_INT_STATUS_HOST_LSB 0 -#define MBOX_INT_STATUS_HOST_MASK 0x000000ff -#define MBOX_INT_STATUS_HOST_GET(x) (((x) & MBOX_INT_STATUS_HOST_MASK) >> MBOX_INT_STATUS_HOST_LSB) -#define MBOX_INT_STATUS_HOST_SET(x) (((x) << MBOX_INT_STATUS_HOST_LSB) & MBOX_INT_STATUS_HOST_MASK) - -#define MBOX_INT_ENABLE_ADDRESS 0x0000005c -#define MBOX_INT_ENABLE_OFFSET 0x0000005c -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB 31 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB 28 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK 0xf0000000 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) >> MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) (((x) << MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) & MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB 27 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB 24 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK 0x0f000000 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) >> MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) (((x) << MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) & MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB 23 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB 20 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK 0x00f00000 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) >> MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) (((x) << MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) & MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) -#define MBOX_INT_ENABLE_TX_OVERFLOW_MSB 17 -#define MBOX_INT_ENABLE_TX_OVERFLOW_LSB 17 -#define MBOX_INT_ENABLE_TX_OVERFLOW_MASK 0x00020000 -#define MBOX_INT_ENABLE_TX_OVERFLOW_GET(x) (((x) & MBOX_INT_ENABLE_TX_OVERFLOW_MASK) >> MBOX_INT_ENABLE_TX_OVERFLOW_LSB) -#define MBOX_INT_ENABLE_TX_OVERFLOW_SET(x) (((x) << MBOX_INT_ENABLE_TX_OVERFLOW_LSB) & MBOX_INT_ENABLE_TX_OVERFLOW_MASK) -#define MBOX_INT_ENABLE_RX_UNDERFLOW_MSB 16 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_LSB 16 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_MASK 0x00010000 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) (((x) & MBOX_INT_ENABLE_RX_UNDERFLOW_MASK) >> MBOX_INT_ENABLE_RX_UNDERFLOW_LSB) -#define MBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) (((x) << MBOX_INT_ENABLE_RX_UNDERFLOW_LSB) & MBOX_INT_ENABLE_RX_UNDERFLOW_MASK) -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_MSB 15 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB 12 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK 0x0000f000 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) (((x) & MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) >> MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) (((x) << MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) & MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) -#define MBOX_INT_ENABLE_RX_NOT_FULL_MSB 11 -#define MBOX_INT_ENABLE_RX_NOT_FULL_LSB 8 -#define MBOX_INT_ENABLE_RX_NOT_FULL_MASK 0x00000f00 -#define MBOX_INT_ENABLE_RX_NOT_FULL_GET(x) (((x) & MBOX_INT_ENABLE_RX_NOT_FULL_MASK) >> MBOX_INT_ENABLE_RX_NOT_FULL_LSB) -#define MBOX_INT_ENABLE_RX_NOT_FULL_SET(x) (((x) << MBOX_INT_ENABLE_RX_NOT_FULL_LSB) & MBOX_INT_ENABLE_RX_NOT_FULL_MASK) -#define MBOX_INT_ENABLE_HOST_MSB 7 -#define MBOX_INT_ENABLE_HOST_LSB 0 -#define MBOX_INT_ENABLE_HOST_MASK 0x000000ff -#define MBOX_INT_ENABLE_HOST_GET(x) (((x) & MBOX_INT_ENABLE_HOST_MASK) >> MBOX_INT_ENABLE_HOST_LSB) -#define MBOX_INT_ENABLE_HOST_SET(x) (((x) << MBOX_INT_ENABLE_HOST_LSB) & MBOX_INT_ENABLE_HOST_MASK) - -#define INT_HOST_ADDRESS 0x00000060 -#define INT_HOST_OFFSET 0x00000060 -#define INT_HOST_VECTOR_MSB 7 -#define INT_HOST_VECTOR_LSB 0 -#define INT_HOST_VECTOR_MASK 0x000000ff -#define INT_HOST_VECTOR_GET(x) (((x) & INT_HOST_VECTOR_MASK) >> INT_HOST_VECTOR_LSB) -#define INT_HOST_VECTOR_SET(x) (((x) << INT_HOST_VECTOR_LSB) & INT_HOST_VECTOR_MASK) - -#define LOCAL_COUNT_ADDRESS 0x00000080 -#define LOCAL_COUNT_OFFSET 0x00000080 -#define LOCAL_COUNT_VALUE_MSB 7 -#define LOCAL_COUNT_VALUE_LSB 0 -#define LOCAL_COUNT_VALUE_MASK 0x000000ff -#define LOCAL_COUNT_VALUE_GET(x) (((x) & LOCAL_COUNT_VALUE_MASK) >> LOCAL_COUNT_VALUE_LSB) -#define LOCAL_COUNT_VALUE_SET(x) (((x) << LOCAL_COUNT_VALUE_LSB) & LOCAL_COUNT_VALUE_MASK) - -#define COUNT_INC_ADDRESS 0x000000a0 -#define COUNT_INC_OFFSET 0x000000a0 -#define COUNT_INC_VALUE_MSB 7 -#define COUNT_INC_VALUE_LSB 0 -#define COUNT_INC_VALUE_MASK 0x000000ff -#define COUNT_INC_VALUE_GET(x) (((x) & COUNT_INC_VALUE_MASK) >> COUNT_INC_VALUE_LSB) -#define COUNT_INC_VALUE_SET(x) (((x) << COUNT_INC_VALUE_LSB) & COUNT_INC_VALUE_MASK) - -#define LOCAL_SCRATCH_ADDRESS 0x000000c0 -#define LOCAL_SCRATCH_OFFSET 0x000000c0 -#define LOCAL_SCRATCH_VALUE_MSB 7 -#define LOCAL_SCRATCH_VALUE_LSB 0 -#define LOCAL_SCRATCH_VALUE_MASK 0x000000ff -#define LOCAL_SCRATCH_VALUE_GET(x) (((x) & LOCAL_SCRATCH_VALUE_MASK) >> LOCAL_SCRATCH_VALUE_LSB) -#define LOCAL_SCRATCH_VALUE_SET(x) (((x) << LOCAL_SCRATCH_VALUE_LSB) & LOCAL_SCRATCH_VALUE_MASK) - -#define USE_LOCAL_BUS_ADDRESS 0x000000e0 -#define USE_LOCAL_BUS_OFFSET 0x000000e0 -#define USE_LOCAL_BUS_PIN_INIT_MSB 0 -#define USE_LOCAL_BUS_PIN_INIT_LSB 0 -#define USE_LOCAL_BUS_PIN_INIT_MASK 0x00000001 -#define USE_LOCAL_BUS_PIN_INIT_GET(x) (((x) & USE_LOCAL_BUS_PIN_INIT_MASK) >> USE_LOCAL_BUS_PIN_INIT_LSB) -#define USE_LOCAL_BUS_PIN_INIT_SET(x) (((x) << USE_LOCAL_BUS_PIN_INIT_LSB) & USE_LOCAL_BUS_PIN_INIT_MASK) - -#define SDIO_CONFIG_ADDRESS 0x000000e4 -#define SDIO_CONFIG_OFFSET 0x000000e4 -#define SDIO_CONFIG_CCCR_IOR1_MSB 0 -#define SDIO_CONFIG_CCCR_IOR1_LSB 0 -#define SDIO_CONFIG_CCCR_IOR1_MASK 0x00000001 -#define SDIO_CONFIG_CCCR_IOR1_GET(x) (((x) & SDIO_CONFIG_CCCR_IOR1_MASK) >> SDIO_CONFIG_CCCR_IOR1_LSB) -#define SDIO_CONFIG_CCCR_IOR1_SET(x) (((x) << SDIO_CONFIG_CCCR_IOR1_LSB) & SDIO_CONFIG_CCCR_IOR1_MASK) - -#define MBOX_DEBUG_ADDRESS 0x000000e8 -#define MBOX_DEBUG_OFFSET 0x000000e8 -#define MBOX_DEBUG_SEL_MSB 2 -#define MBOX_DEBUG_SEL_LSB 0 -#define MBOX_DEBUG_SEL_MASK 0x00000007 -#define MBOX_DEBUG_SEL_GET(x) (((x) & MBOX_DEBUG_SEL_MASK) >> MBOX_DEBUG_SEL_LSB) -#define MBOX_DEBUG_SEL_SET(x) (((x) << MBOX_DEBUG_SEL_LSB) & MBOX_DEBUG_SEL_MASK) - -#define MBOX_FIFO_RESET_ADDRESS 0x000000ec -#define MBOX_FIFO_RESET_OFFSET 0x000000ec -#define MBOX_FIFO_RESET_INIT_MSB 0 -#define MBOX_FIFO_RESET_INIT_LSB 0 -#define MBOX_FIFO_RESET_INIT_MASK 0x00000001 -#define MBOX_FIFO_RESET_INIT_GET(x) (((x) & MBOX_FIFO_RESET_INIT_MASK) >> MBOX_FIFO_RESET_INIT_LSB) -#define MBOX_FIFO_RESET_INIT_SET(x) (((x) << MBOX_FIFO_RESET_INIT_LSB) & MBOX_FIFO_RESET_INIT_MASK) - -#define MBOX_TXFIFO_POP_ADDRESS 0x000000f0 -#define MBOX_TXFIFO_POP_OFFSET 0x000000f0 -#define MBOX_TXFIFO_POP_DATA_MSB 0 -#define MBOX_TXFIFO_POP_DATA_LSB 0 -#define MBOX_TXFIFO_POP_DATA_MASK 0x00000001 -#define MBOX_TXFIFO_POP_DATA_GET(x) (((x) & MBOX_TXFIFO_POP_DATA_MASK) >> MBOX_TXFIFO_POP_DATA_LSB) -#define MBOX_TXFIFO_POP_DATA_SET(x) (((x) << MBOX_TXFIFO_POP_DATA_LSB) & MBOX_TXFIFO_POP_DATA_MASK) - -#define MBOX_RXFIFO_POP_ADDRESS 0x00000100 -#define MBOX_RXFIFO_POP_OFFSET 0x00000100 -#define MBOX_RXFIFO_POP_DATA_MSB 0 -#define MBOX_RXFIFO_POP_DATA_LSB 0 -#define MBOX_RXFIFO_POP_DATA_MASK 0x00000001 -#define MBOX_RXFIFO_POP_DATA_GET(x) (((x) & MBOX_RXFIFO_POP_DATA_MASK) >> MBOX_RXFIFO_POP_DATA_LSB) -#define MBOX_RXFIFO_POP_DATA_SET(x) (((x) << MBOX_RXFIFO_POP_DATA_LSB) & MBOX_RXFIFO_POP_DATA_MASK) - -#define SDIO_DEBUG_ADDRESS 0x00000110 -#define SDIO_DEBUG_OFFSET 0x00000110 -#define SDIO_DEBUG_SEL_MSB 3 -#define SDIO_DEBUG_SEL_LSB 0 -#define SDIO_DEBUG_SEL_MASK 0x0000000f -#define SDIO_DEBUG_SEL_GET(x) (((x) & SDIO_DEBUG_SEL_MASK) >> SDIO_DEBUG_SEL_LSB) -#define SDIO_DEBUG_SEL_SET(x) (((x) << SDIO_DEBUG_SEL_LSB) & SDIO_DEBUG_SEL_MASK) - -#define HOST_IF_WINDOW_ADDRESS 0x00002000 -#define HOST_IF_WINDOW_OFFSET 0x00002000 -#define HOST_IF_WINDOW_DATA_MSB 7 -#define HOST_IF_WINDOW_DATA_LSB 0 -#define HOST_IF_WINDOW_DATA_MASK 0x000000ff -#define HOST_IF_WINDOW_DATA_GET(x) (((x) & HOST_IF_WINDOW_DATA_MASK) >> HOST_IF_WINDOW_DATA_LSB) -#define HOST_IF_WINDOW_DATA_SET(x) (((x) << HOST_IF_WINDOW_DATA_LSB) & HOST_IF_WINDOW_DATA_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct mbox_reg_reg_s { - volatile unsigned int mbox_fifo[4]; - volatile unsigned int mbox_fifo_status; - volatile unsigned int mbox_dma_policy; - volatile unsigned int mbox0_dma_rx_descriptor_base; - volatile unsigned int mbox0_dma_rx_control; - volatile unsigned int mbox0_dma_tx_descriptor_base; - volatile unsigned int mbox0_dma_tx_control; - volatile unsigned int mbox1_dma_rx_descriptor_base; - volatile unsigned int mbox1_dma_rx_control; - volatile unsigned int mbox1_dma_tx_descriptor_base; - volatile unsigned int mbox1_dma_tx_control; - volatile unsigned int mbox2_dma_rx_descriptor_base; - volatile unsigned int mbox2_dma_rx_control; - volatile unsigned int mbox2_dma_tx_descriptor_base; - volatile unsigned int mbox2_dma_tx_control; - volatile unsigned int mbox3_dma_rx_descriptor_base; - volatile unsigned int mbox3_dma_rx_control; - volatile unsigned int mbox3_dma_tx_descriptor_base; - volatile unsigned int mbox3_dma_tx_control; - volatile unsigned int mbox_int_status; - volatile unsigned int mbox_int_enable; - volatile unsigned int int_host; - unsigned char pad0[28]; /* pad to 0x80 */ - volatile unsigned int local_count[8]; - volatile unsigned int count_inc[8]; - volatile unsigned int local_scratch[8]; - volatile unsigned int use_local_bus; - volatile unsigned int sdio_config; - volatile unsigned int mbox_debug; - volatile unsigned int mbox_fifo_reset; - volatile unsigned int mbox_txfifo_pop[4]; - volatile unsigned int mbox_rxfifo_pop[4]; - volatile unsigned int sdio_debug; - unsigned char pad1[7916]; /* pad to 0x2000 */ - volatile unsigned int host_if_window[2048]; -} mbox_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _MBOX_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_reg.vrh deleted file mode 100644 index a6d23e84b9a4..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/mbox_reg.vrh +++ /dev/null @@ -1,746 +0,0 @@ -#ifndef _MBOX_REG_VRH_ -#define _MBOX_REG_VRH_ - -#define MBOX_FIFO_ADDRESS 'h00000000 -#define MBOX_FIFO_DATA_MSB 19 -#define MBOX_FIFO_DATA_LSB 0 -#define MBOX_FIFO_DATA_MASK 'h000fffff -#define MBOX_FIFO_DATA_GET(x) (((x) & MBOX_FIFO_DATA_MASK) >> MBOX_FIFO_DATA_LSB) -#define MBOX_FIFO_DATA_SET(x) (((32'd0 | (x)) << MBOX_FIFO_DATA_LSB) & MBOX_FIFO_DATA_MASK) -#define MBOX_FIFO_DATA_RESET 20'h0 -#define MBOX_FIFO_RESET (32'h0 | \ - MBOX_FIFO_DATA_SET(MBOX_FIFO_DATA_RESET)) -#define MBOX_FIFO_HW_MASK (32'h0 | \ - MBOX_FIFO_DATA_MASK) -#define MBOX_FIFO_SW_MASK (32'h0 | \ - MBOX_FIFO_DATA_MASK) - -#define MBOX_FIFO_STATUS_ADDRESS 'h00000010 -#define MBOX_FIFO_STATUS_EMPTY_MSB 19 -#define MBOX_FIFO_STATUS_EMPTY_LSB 16 -#define MBOX_FIFO_STATUS_EMPTY_MASK 'h000f0000 -#define MBOX_FIFO_STATUS_EMPTY_GET(x) (((x) & MBOX_FIFO_STATUS_EMPTY_MASK) >> MBOX_FIFO_STATUS_EMPTY_LSB) -#define MBOX_FIFO_STATUS_EMPTY_SET(x) (((32'd0 | (x)) << MBOX_FIFO_STATUS_EMPTY_LSB) & MBOX_FIFO_STATUS_EMPTY_MASK) -#define MBOX_FIFO_STATUS_EMPTY_RESET 4'hf -#define MBOX_FIFO_STATUS_FULL_MSB 15 -#define MBOX_FIFO_STATUS_FULL_LSB 12 -#define MBOX_FIFO_STATUS_FULL_MASK 'h0000f000 -#define MBOX_FIFO_STATUS_FULL_GET(x) (((x) & MBOX_FIFO_STATUS_FULL_MASK) >> MBOX_FIFO_STATUS_FULL_LSB) -#define MBOX_FIFO_STATUS_FULL_SET(x) (((32'd0 | (x)) << MBOX_FIFO_STATUS_FULL_LSB) & MBOX_FIFO_STATUS_FULL_MASK) -#define MBOX_FIFO_STATUS_FULL_RESET 4'h0 -#define MBOX_FIFO_STATUS_RESET (32'h0 | \ - MBOX_FIFO_STATUS_EMPTY_SET(MBOX_FIFO_STATUS_EMPTY_RESET) | \ - MBOX_FIFO_STATUS_FULL_SET(MBOX_FIFO_STATUS_FULL_RESET)) -#define MBOX_FIFO_STATUS_HW_MASK (32'h0 | \ - MBOX_FIFO_STATUS_EMPTY_MASK | \ - MBOX_FIFO_STATUS_FULL_MASK) -#define MBOX_FIFO_STATUS_SW_MASK (32'h0) - -#define MBOX_DMA_POLICY_ADDRESS 'h00000014 -#define MBOX_DMA_POLICY_TX_QUANTUM_MSB 3 -#define MBOX_DMA_POLICY_TX_QUANTUM_LSB 3 -#define MBOX_DMA_POLICY_TX_QUANTUM_MASK 'h00000008 -#define MBOX_DMA_POLICY_TX_QUANTUM_GET(x) (((x) & MBOX_DMA_POLICY_TX_QUANTUM_MASK) >> MBOX_DMA_POLICY_TX_QUANTUM_LSB) -#define MBOX_DMA_POLICY_TX_QUANTUM_SET(x) (((32'd0 | (x)) << MBOX_DMA_POLICY_TX_QUANTUM_LSB) & MBOX_DMA_POLICY_TX_QUANTUM_MASK) -#define MBOX_DMA_POLICY_TX_QUANTUM_RESET 1'h0 -#define MBOX_DMA_POLICY_TX_ORDER_MSB 2 -#define MBOX_DMA_POLICY_TX_ORDER_LSB 2 -#define MBOX_DMA_POLICY_TX_ORDER_MASK 'h00000004 -#define MBOX_DMA_POLICY_TX_ORDER_GET(x) (((x) & MBOX_DMA_POLICY_TX_ORDER_MASK) >> MBOX_DMA_POLICY_TX_ORDER_LSB) -#define MBOX_DMA_POLICY_TX_ORDER_SET(x) (((32'd0 | (x)) << MBOX_DMA_POLICY_TX_ORDER_LSB) & MBOX_DMA_POLICY_TX_ORDER_MASK) -#define MBOX_DMA_POLICY_TX_ORDER_RESET 1'h0 -#define MBOX_DMA_POLICY_RX_QUANTUM_MSB 1 -#define MBOX_DMA_POLICY_RX_QUANTUM_LSB 1 -#define MBOX_DMA_POLICY_RX_QUANTUM_MASK 'h00000002 -#define MBOX_DMA_POLICY_RX_QUANTUM_GET(x) (((x) & MBOX_DMA_POLICY_RX_QUANTUM_MASK) >> MBOX_DMA_POLICY_RX_QUANTUM_LSB) -#define MBOX_DMA_POLICY_RX_QUANTUM_SET(x) (((32'd0 | (x)) << MBOX_DMA_POLICY_RX_QUANTUM_LSB) & MBOX_DMA_POLICY_RX_QUANTUM_MASK) -#define MBOX_DMA_POLICY_RX_QUANTUM_RESET 1'h0 -#define MBOX_DMA_POLICY_RX_ORDER_MSB 0 -#define MBOX_DMA_POLICY_RX_ORDER_LSB 0 -#define MBOX_DMA_POLICY_RX_ORDER_MASK 'h00000001 -#define MBOX_DMA_POLICY_RX_ORDER_GET(x) (((x) & MBOX_DMA_POLICY_RX_ORDER_MASK) >> MBOX_DMA_POLICY_RX_ORDER_LSB) -#define MBOX_DMA_POLICY_RX_ORDER_SET(x) (((32'd0 | (x)) << MBOX_DMA_POLICY_RX_ORDER_LSB) & MBOX_DMA_POLICY_RX_ORDER_MASK) -#define MBOX_DMA_POLICY_RX_ORDER_RESET 1'h0 -#define MBOX_DMA_POLICY_RESET (32'h0 | \ - MBOX_DMA_POLICY_TX_QUANTUM_SET(MBOX_DMA_POLICY_TX_QUANTUM_RESET) | \ - MBOX_DMA_POLICY_TX_ORDER_SET(MBOX_DMA_POLICY_TX_ORDER_RESET) | \ - MBOX_DMA_POLICY_RX_QUANTUM_SET(MBOX_DMA_POLICY_RX_QUANTUM_RESET) | \ - MBOX_DMA_POLICY_RX_ORDER_SET(MBOX_DMA_POLICY_RX_ORDER_RESET)) -#define MBOX_DMA_POLICY_HW_MASK (32'h0) -#define MBOX_DMA_POLICY_SW_MASK (32'h0 | \ - MBOX_DMA_POLICY_TX_QUANTUM_MASK | \ - MBOX_DMA_POLICY_TX_ORDER_MASK | \ - MBOX_DMA_POLICY_RX_QUANTUM_MASK | \ - MBOX_DMA_POLICY_RX_ORDER_MASK) - -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS 'h00000018 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX0_DMA_RX_CONTROL_ADDRESS 'h0000001c -#define MBOX0_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX0_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX0_DMA_RX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX0_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_RESUME_MASK) >> MBOX0_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX0_DMA_RX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX0_DMA_RX_CONTROL_RESUME_LSB) & MBOX0_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX0_DMA_RX_CONTROL_RESUME_RESET 1'h0 -#define MBOX0_DMA_RX_CONTROL_START_MSB 1 -#define MBOX0_DMA_RX_CONTROL_START_LSB 1 -#define MBOX0_DMA_RX_CONTROL_START_MASK 'h00000002 -#define MBOX0_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_START_MASK) >> MBOX0_DMA_RX_CONTROL_START_LSB) -#define MBOX0_DMA_RX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX0_DMA_RX_CONTROL_START_LSB) & MBOX0_DMA_RX_CONTROL_START_MASK) -#define MBOX0_DMA_RX_CONTROL_START_RESET 1'h0 -#define MBOX0_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX0_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX0_DMA_RX_CONTROL_STOP_MASK 'h00000001 -#define MBOX0_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_STOP_MASK) >> MBOX0_DMA_RX_CONTROL_STOP_LSB) -#define MBOX0_DMA_RX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX0_DMA_RX_CONTROL_STOP_LSB) & MBOX0_DMA_RX_CONTROL_STOP_MASK) -#define MBOX0_DMA_RX_CONTROL_STOP_RESET 1'h0 -#define MBOX0_DMA_RX_CONTROL_RESET (32'h0 | \ - MBOX0_DMA_RX_CONTROL_RESUME_SET(MBOX0_DMA_RX_CONTROL_RESUME_RESET) | \ - MBOX0_DMA_RX_CONTROL_START_SET(MBOX0_DMA_RX_CONTROL_START_RESET) | \ - MBOX0_DMA_RX_CONTROL_STOP_SET(MBOX0_DMA_RX_CONTROL_STOP_RESET)) -#define MBOX0_DMA_RX_CONTROL_HW_MASK (32'h0 | \ - MBOX0_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX0_DMA_RX_CONTROL_START_MASK | \ - MBOX0_DMA_RX_CONTROL_STOP_MASK) -#define MBOX0_DMA_RX_CONTROL_SW_MASK (32'h0 | \ - MBOX0_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX0_DMA_RX_CONTROL_START_MASK | \ - MBOX0_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS 'h00000020 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX0_DMA_TX_CONTROL_ADDRESS 'h00000024 -#define MBOX0_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX0_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX0_DMA_TX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX0_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_RESUME_MASK) >> MBOX0_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX0_DMA_TX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX0_DMA_TX_CONTROL_RESUME_LSB) & MBOX0_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX0_DMA_TX_CONTROL_RESUME_RESET 1'h0 -#define MBOX0_DMA_TX_CONTROL_START_MSB 1 -#define MBOX0_DMA_TX_CONTROL_START_LSB 1 -#define MBOX0_DMA_TX_CONTROL_START_MASK 'h00000002 -#define MBOX0_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_START_MASK) >> MBOX0_DMA_TX_CONTROL_START_LSB) -#define MBOX0_DMA_TX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX0_DMA_TX_CONTROL_START_LSB) & MBOX0_DMA_TX_CONTROL_START_MASK) -#define MBOX0_DMA_TX_CONTROL_START_RESET 1'h0 -#define MBOX0_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX0_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX0_DMA_TX_CONTROL_STOP_MASK 'h00000001 -#define MBOX0_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_STOP_MASK) >> MBOX0_DMA_TX_CONTROL_STOP_LSB) -#define MBOX0_DMA_TX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX0_DMA_TX_CONTROL_STOP_LSB) & MBOX0_DMA_TX_CONTROL_STOP_MASK) -#define MBOX0_DMA_TX_CONTROL_STOP_RESET 1'h0 -#define MBOX0_DMA_TX_CONTROL_RESET (32'h0 | \ - MBOX0_DMA_TX_CONTROL_RESUME_SET(MBOX0_DMA_TX_CONTROL_RESUME_RESET) | \ - MBOX0_DMA_TX_CONTROL_START_SET(MBOX0_DMA_TX_CONTROL_START_RESET) | \ - MBOX0_DMA_TX_CONTROL_STOP_SET(MBOX0_DMA_TX_CONTROL_STOP_RESET)) -#define MBOX0_DMA_TX_CONTROL_HW_MASK (32'h0 | \ - MBOX0_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX0_DMA_TX_CONTROL_START_MASK | \ - MBOX0_DMA_TX_CONTROL_STOP_MASK) -#define MBOX0_DMA_TX_CONTROL_SW_MASK (32'h0 | \ - MBOX0_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX0_DMA_TX_CONTROL_START_MASK | \ - MBOX0_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS 'h00000028 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX1_DMA_RX_CONTROL_ADDRESS 'h0000002c -#define MBOX1_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX1_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX1_DMA_RX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX1_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX1_DMA_RX_CONTROL_RESUME_MASK) >> MBOX1_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX1_DMA_RX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX1_DMA_RX_CONTROL_RESUME_LSB) & MBOX1_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX1_DMA_RX_CONTROL_RESUME_RESET 1'h0 -#define MBOX1_DMA_RX_CONTROL_START_MSB 1 -#define MBOX1_DMA_RX_CONTROL_START_LSB 1 -#define MBOX1_DMA_RX_CONTROL_START_MASK 'h00000002 -#define MBOX1_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX1_DMA_RX_CONTROL_START_MASK) >> MBOX1_DMA_RX_CONTROL_START_LSB) -#define MBOX1_DMA_RX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX1_DMA_RX_CONTROL_START_LSB) & MBOX1_DMA_RX_CONTROL_START_MASK) -#define MBOX1_DMA_RX_CONTROL_START_RESET 1'h0 -#define MBOX1_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX1_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX1_DMA_RX_CONTROL_STOP_MASK 'h00000001 -#define MBOX1_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX1_DMA_RX_CONTROL_STOP_MASK) >> MBOX1_DMA_RX_CONTROL_STOP_LSB) -#define MBOX1_DMA_RX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX1_DMA_RX_CONTROL_STOP_LSB) & MBOX1_DMA_RX_CONTROL_STOP_MASK) -#define MBOX1_DMA_RX_CONTROL_STOP_RESET 1'h0 -#define MBOX1_DMA_RX_CONTROL_RESET (32'h0 | \ - MBOX1_DMA_RX_CONTROL_RESUME_SET(MBOX1_DMA_RX_CONTROL_RESUME_RESET) | \ - MBOX1_DMA_RX_CONTROL_START_SET(MBOX1_DMA_RX_CONTROL_START_RESET) | \ - MBOX1_DMA_RX_CONTROL_STOP_SET(MBOX1_DMA_RX_CONTROL_STOP_RESET)) -#define MBOX1_DMA_RX_CONTROL_HW_MASK (32'h0 | \ - MBOX1_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX1_DMA_RX_CONTROL_START_MASK | \ - MBOX1_DMA_RX_CONTROL_STOP_MASK) -#define MBOX1_DMA_RX_CONTROL_SW_MASK (32'h0 | \ - MBOX1_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX1_DMA_RX_CONTROL_START_MASK | \ - MBOX1_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS 'h00000030 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX1_DMA_TX_CONTROL_ADDRESS 'h00000034 -#define MBOX1_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX1_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX1_DMA_TX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX1_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX1_DMA_TX_CONTROL_RESUME_MASK) >> MBOX1_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX1_DMA_TX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX1_DMA_TX_CONTROL_RESUME_LSB) & MBOX1_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX1_DMA_TX_CONTROL_RESUME_RESET 1'h0 -#define MBOX1_DMA_TX_CONTROL_START_MSB 1 -#define MBOX1_DMA_TX_CONTROL_START_LSB 1 -#define MBOX1_DMA_TX_CONTROL_START_MASK 'h00000002 -#define MBOX1_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX1_DMA_TX_CONTROL_START_MASK) >> MBOX1_DMA_TX_CONTROL_START_LSB) -#define MBOX1_DMA_TX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX1_DMA_TX_CONTROL_START_LSB) & MBOX1_DMA_TX_CONTROL_START_MASK) -#define MBOX1_DMA_TX_CONTROL_START_RESET 1'h0 -#define MBOX1_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX1_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX1_DMA_TX_CONTROL_STOP_MASK 'h00000001 -#define MBOX1_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX1_DMA_TX_CONTROL_STOP_MASK) >> MBOX1_DMA_TX_CONTROL_STOP_LSB) -#define MBOX1_DMA_TX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX1_DMA_TX_CONTROL_STOP_LSB) & MBOX1_DMA_TX_CONTROL_STOP_MASK) -#define MBOX1_DMA_TX_CONTROL_STOP_RESET 1'h0 -#define MBOX1_DMA_TX_CONTROL_RESET (32'h0 | \ - MBOX1_DMA_TX_CONTROL_RESUME_SET(MBOX1_DMA_TX_CONTROL_RESUME_RESET) | \ - MBOX1_DMA_TX_CONTROL_START_SET(MBOX1_DMA_TX_CONTROL_START_RESET) | \ - MBOX1_DMA_TX_CONTROL_STOP_SET(MBOX1_DMA_TX_CONTROL_STOP_RESET)) -#define MBOX1_DMA_TX_CONTROL_HW_MASK (32'h0 | \ - MBOX1_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX1_DMA_TX_CONTROL_START_MASK | \ - MBOX1_DMA_TX_CONTROL_STOP_MASK) -#define MBOX1_DMA_TX_CONTROL_SW_MASK (32'h0 | \ - MBOX1_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX1_DMA_TX_CONTROL_START_MASK | \ - MBOX1_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS 'h00000038 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX2_DMA_RX_CONTROL_ADDRESS 'h0000003c -#define MBOX2_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX2_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX2_DMA_RX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX2_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX2_DMA_RX_CONTROL_RESUME_MASK) >> MBOX2_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX2_DMA_RX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX2_DMA_RX_CONTROL_RESUME_LSB) & MBOX2_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX2_DMA_RX_CONTROL_RESUME_RESET 1'h0 -#define MBOX2_DMA_RX_CONTROL_START_MSB 1 -#define MBOX2_DMA_RX_CONTROL_START_LSB 1 -#define MBOX2_DMA_RX_CONTROL_START_MASK 'h00000002 -#define MBOX2_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX2_DMA_RX_CONTROL_START_MASK) >> MBOX2_DMA_RX_CONTROL_START_LSB) -#define MBOX2_DMA_RX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX2_DMA_RX_CONTROL_START_LSB) & MBOX2_DMA_RX_CONTROL_START_MASK) -#define MBOX2_DMA_RX_CONTROL_START_RESET 1'h0 -#define MBOX2_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX2_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX2_DMA_RX_CONTROL_STOP_MASK 'h00000001 -#define MBOX2_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX2_DMA_RX_CONTROL_STOP_MASK) >> MBOX2_DMA_RX_CONTROL_STOP_LSB) -#define MBOX2_DMA_RX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX2_DMA_RX_CONTROL_STOP_LSB) & MBOX2_DMA_RX_CONTROL_STOP_MASK) -#define MBOX2_DMA_RX_CONTROL_STOP_RESET 1'h0 -#define MBOX2_DMA_RX_CONTROL_RESET (32'h0 | \ - MBOX2_DMA_RX_CONTROL_RESUME_SET(MBOX2_DMA_RX_CONTROL_RESUME_RESET) | \ - MBOX2_DMA_RX_CONTROL_START_SET(MBOX2_DMA_RX_CONTROL_START_RESET) | \ - MBOX2_DMA_RX_CONTROL_STOP_SET(MBOX2_DMA_RX_CONTROL_STOP_RESET)) -#define MBOX2_DMA_RX_CONTROL_HW_MASK (32'h0 | \ - MBOX2_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX2_DMA_RX_CONTROL_START_MASK | \ - MBOX2_DMA_RX_CONTROL_STOP_MASK) -#define MBOX2_DMA_RX_CONTROL_SW_MASK (32'h0 | \ - MBOX2_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX2_DMA_RX_CONTROL_START_MASK | \ - MBOX2_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS 'h00000040 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX2_DMA_TX_CONTROL_ADDRESS 'h00000044 -#define MBOX2_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX2_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX2_DMA_TX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX2_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX2_DMA_TX_CONTROL_RESUME_MASK) >> MBOX2_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX2_DMA_TX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX2_DMA_TX_CONTROL_RESUME_LSB) & MBOX2_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX2_DMA_TX_CONTROL_RESUME_RESET 1'h0 -#define MBOX2_DMA_TX_CONTROL_START_MSB 1 -#define MBOX2_DMA_TX_CONTROL_START_LSB 1 -#define MBOX2_DMA_TX_CONTROL_START_MASK 'h00000002 -#define MBOX2_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX2_DMA_TX_CONTROL_START_MASK) >> MBOX2_DMA_TX_CONTROL_START_LSB) -#define MBOX2_DMA_TX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX2_DMA_TX_CONTROL_START_LSB) & MBOX2_DMA_TX_CONTROL_START_MASK) -#define MBOX2_DMA_TX_CONTROL_START_RESET 1'h0 -#define MBOX2_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX2_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX2_DMA_TX_CONTROL_STOP_MASK 'h00000001 -#define MBOX2_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX2_DMA_TX_CONTROL_STOP_MASK) >> MBOX2_DMA_TX_CONTROL_STOP_LSB) -#define MBOX2_DMA_TX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX2_DMA_TX_CONTROL_STOP_LSB) & MBOX2_DMA_TX_CONTROL_STOP_MASK) -#define MBOX2_DMA_TX_CONTROL_STOP_RESET 1'h0 -#define MBOX2_DMA_TX_CONTROL_RESET (32'h0 | \ - MBOX2_DMA_TX_CONTROL_RESUME_SET(MBOX2_DMA_TX_CONTROL_RESUME_RESET) | \ - MBOX2_DMA_TX_CONTROL_START_SET(MBOX2_DMA_TX_CONTROL_START_RESET) | \ - MBOX2_DMA_TX_CONTROL_STOP_SET(MBOX2_DMA_TX_CONTROL_STOP_RESET)) -#define MBOX2_DMA_TX_CONTROL_HW_MASK (32'h0 | \ - MBOX2_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX2_DMA_TX_CONTROL_START_MASK | \ - MBOX2_DMA_TX_CONTROL_STOP_MASK) -#define MBOX2_DMA_TX_CONTROL_SW_MASK (32'h0 | \ - MBOX2_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX2_DMA_TX_CONTROL_START_MASK | \ - MBOX2_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS 'h00000048 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX3_DMA_RX_CONTROL_ADDRESS 'h0000004c -#define MBOX3_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX3_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX3_DMA_RX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX3_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX3_DMA_RX_CONTROL_RESUME_MASK) >> MBOX3_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX3_DMA_RX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX3_DMA_RX_CONTROL_RESUME_LSB) & MBOX3_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX3_DMA_RX_CONTROL_RESUME_RESET 1'h0 -#define MBOX3_DMA_RX_CONTROL_START_MSB 1 -#define MBOX3_DMA_RX_CONTROL_START_LSB 1 -#define MBOX3_DMA_RX_CONTROL_START_MASK 'h00000002 -#define MBOX3_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX3_DMA_RX_CONTROL_START_MASK) >> MBOX3_DMA_RX_CONTROL_START_LSB) -#define MBOX3_DMA_RX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX3_DMA_RX_CONTROL_START_LSB) & MBOX3_DMA_RX_CONTROL_START_MASK) -#define MBOX3_DMA_RX_CONTROL_START_RESET 1'h0 -#define MBOX3_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX3_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX3_DMA_RX_CONTROL_STOP_MASK 'h00000001 -#define MBOX3_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX3_DMA_RX_CONTROL_STOP_MASK) >> MBOX3_DMA_RX_CONTROL_STOP_LSB) -#define MBOX3_DMA_RX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX3_DMA_RX_CONTROL_STOP_LSB) & MBOX3_DMA_RX_CONTROL_STOP_MASK) -#define MBOX3_DMA_RX_CONTROL_STOP_RESET 1'h0 -#define MBOX3_DMA_RX_CONTROL_RESET (32'h0 | \ - MBOX3_DMA_RX_CONTROL_RESUME_SET(MBOX3_DMA_RX_CONTROL_RESUME_RESET) | \ - MBOX3_DMA_RX_CONTROL_START_SET(MBOX3_DMA_RX_CONTROL_START_RESET) | \ - MBOX3_DMA_RX_CONTROL_STOP_SET(MBOX3_DMA_RX_CONTROL_STOP_RESET)) -#define MBOX3_DMA_RX_CONTROL_HW_MASK (32'h0 | \ - MBOX3_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX3_DMA_RX_CONTROL_START_MASK | \ - MBOX3_DMA_RX_CONTROL_STOP_MASK) -#define MBOX3_DMA_RX_CONTROL_SW_MASK (32'h0 | \ - MBOX3_DMA_RX_CONTROL_RESUME_MASK | \ - MBOX3_DMA_RX_CONTROL_START_MASK | \ - MBOX3_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS 'h00000050 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 'h0ffffffc -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((32'd0 | (x)) << MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET 26'h0 -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_RESET (32'h0 | \ - MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_RESET)) -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_HW_MASK (32'h0) -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_SW_MASK (32'h0 | \ - MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX3_DMA_TX_CONTROL_ADDRESS 'h00000054 -#define MBOX3_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX3_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX3_DMA_TX_CONTROL_RESUME_MASK 'h00000004 -#define MBOX3_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX3_DMA_TX_CONTROL_RESUME_MASK) >> MBOX3_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX3_DMA_TX_CONTROL_RESUME_SET(x) (((32'd0 | (x)) << MBOX3_DMA_TX_CONTROL_RESUME_LSB) & MBOX3_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX3_DMA_TX_CONTROL_RESUME_RESET 1'h0 -#define MBOX3_DMA_TX_CONTROL_START_MSB 1 -#define MBOX3_DMA_TX_CONTROL_START_LSB 1 -#define MBOX3_DMA_TX_CONTROL_START_MASK 'h00000002 -#define MBOX3_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX3_DMA_TX_CONTROL_START_MASK) >> MBOX3_DMA_TX_CONTROL_START_LSB) -#define MBOX3_DMA_TX_CONTROL_START_SET(x) (((32'd0 | (x)) << MBOX3_DMA_TX_CONTROL_START_LSB) & MBOX3_DMA_TX_CONTROL_START_MASK) -#define MBOX3_DMA_TX_CONTROL_START_RESET 1'h0 -#define MBOX3_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX3_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX3_DMA_TX_CONTROL_STOP_MASK 'h00000001 -#define MBOX3_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX3_DMA_TX_CONTROL_STOP_MASK) >> MBOX3_DMA_TX_CONTROL_STOP_LSB) -#define MBOX3_DMA_TX_CONTROL_STOP_SET(x) (((32'd0 | (x)) << MBOX3_DMA_TX_CONTROL_STOP_LSB) & MBOX3_DMA_TX_CONTROL_STOP_MASK) -#define MBOX3_DMA_TX_CONTROL_STOP_RESET 1'h0 -#define MBOX3_DMA_TX_CONTROL_RESET (32'h0 | \ - MBOX3_DMA_TX_CONTROL_RESUME_SET(MBOX3_DMA_TX_CONTROL_RESUME_RESET) | \ - MBOX3_DMA_TX_CONTROL_START_SET(MBOX3_DMA_TX_CONTROL_START_RESET) | \ - MBOX3_DMA_TX_CONTROL_STOP_SET(MBOX3_DMA_TX_CONTROL_STOP_RESET)) -#define MBOX3_DMA_TX_CONTROL_HW_MASK (32'h0 | \ - MBOX3_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX3_DMA_TX_CONTROL_START_MASK | \ - MBOX3_DMA_TX_CONTROL_STOP_MASK) -#define MBOX3_DMA_TX_CONTROL_SW_MASK (32'h0 | \ - MBOX3_DMA_TX_CONTROL_RESUME_MASK | \ - MBOX3_DMA_TX_CONTROL_START_MASK | \ - MBOX3_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX_INT_STATUS_ADDRESS 'h00000058 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_MSB 31 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB 28 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK 'hf0000000 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) >> MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) & MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_RESET 4'h0 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB 27 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB 24 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK 'h0f000000 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) >> MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) & MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_RESET 4'h0 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_MSB 23 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB 20 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK 'h00f00000 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) >> MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) & MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_RESET 4'h0 -#define MBOX_INT_STATUS_TX_OVERFLOW_MSB 17 -#define MBOX_INT_STATUS_TX_OVERFLOW_LSB 17 -#define MBOX_INT_STATUS_TX_OVERFLOW_MASK 'h00020000 -#define MBOX_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & MBOX_INT_STATUS_TX_OVERFLOW_MASK) >> MBOX_INT_STATUS_TX_OVERFLOW_LSB) -#define MBOX_INT_STATUS_TX_OVERFLOW_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_TX_OVERFLOW_LSB) & MBOX_INT_STATUS_TX_OVERFLOW_MASK) -#define MBOX_INT_STATUS_TX_OVERFLOW_RESET 1'h0 -#define MBOX_INT_STATUS_RX_UNDERFLOW_MSB 16 -#define MBOX_INT_STATUS_RX_UNDERFLOW_LSB 16 -#define MBOX_INT_STATUS_RX_UNDERFLOW_MASK 'h00010000 -#define MBOX_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & MBOX_INT_STATUS_RX_UNDERFLOW_MASK) >> MBOX_INT_STATUS_RX_UNDERFLOW_LSB) -#define MBOX_INT_STATUS_RX_UNDERFLOW_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_RX_UNDERFLOW_LSB) & MBOX_INT_STATUS_RX_UNDERFLOW_MASK) -#define MBOX_INT_STATUS_RX_UNDERFLOW_RESET 1'h0 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_MSB 15 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_LSB 12 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_MASK 'h0000f000 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) (((x) & MBOX_INT_STATUS_TX_NOT_EMPTY_MASK) >> MBOX_INT_STATUS_TX_NOT_EMPTY_LSB) -#define MBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_TX_NOT_EMPTY_LSB) & MBOX_INT_STATUS_TX_NOT_EMPTY_MASK) -#define MBOX_INT_STATUS_TX_NOT_EMPTY_RESET 4'h0 -#define MBOX_INT_STATUS_RX_NOT_FULL_MSB 11 -#define MBOX_INT_STATUS_RX_NOT_FULL_LSB 8 -#define MBOX_INT_STATUS_RX_NOT_FULL_MASK 'h00000f00 -#define MBOX_INT_STATUS_RX_NOT_FULL_GET(x) (((x) & MBOX_INT_STATUS_RX_NOT_FULL_MASK) >> MBOX_INT_STATUS_RX_NOT_FULL_LSB) -#define MBOX_INT_STATUS_RX_NOT_FULL_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_RX_NOT_FULL_LSB) & MBOX_INT_STATUS_RX_NOT_FULL_MASK) -#define MBOX_INT_STATUS_RX_NOT_FULL_RESET 4'h0 -#define MBOX_INT_STATUS_HOST_MSB 7 -#define MBOX_INT_STATUS_HOST_LSB 0 -#define MBOX_INT_STATUS_HOST_MASK 'h000000ff -#define MBOX_INT_STATUS_HOST_GET(x) (((x) & MBOX_INT_STATUS_HOST_MASK) >> MBOX_INT_STATUS_HOST_LSB) -#define MBOX_INT_STATUS_HOST_SET(x) (((32'd0 | (x)) << MBOX_INT_STATUS_HOST_LSB) & MBOX_INT_STATUS_HOST_MASK) -#define MBOX_INT_STATUS_HOST_RESET 8'h0 -#define MBOX_INT_STATUS_RESET (32'h0 | \ - MBOX_INT_STATUS_RX_DMA_COMPLETE_SET(MBOX_INT_STATUS_RX_DMA_COMPLETE_RESET) | \ - MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_RESET) | \ - MBOX_INT_STATUS_TX_DMA_COMPLETE_SET(MBOX_INT_STATUS_TX_DMA_COMPLETE_RESET) | \ - MBOX_INT_STATUS_TX_OVERFLOW_SET(MBOX_INT_STATUS_TX_OVERFLOW_RESET) | \ - MBOX_INT_STATUS_RX_UNDERFLOW_SET(MBOX_INT_STATUS_RX_UNDERFLOW_RESET) | \ - MBOX_INT_STATUS_TX_NOT_EMPTY_SET(MBOX_INT_STATUS_TX_NOT_EMPTY_RESET) | \ - MBOX_INT_STATUS_RX_NOT_FULL_SET(MBOX_INT_STATUS_RX_NOT_FULL_RESET) | \ - MBOX_INT_STATUS_HOST_SET(MBOX_INT_STATUS_HOST_RESET)) -#define MBOX_INT_STATUS_HW_MASK (32'h0 | \ - MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK | \ - MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK | \ - MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK | \ - MBOX_INT_STATUS_TX_OVERFLOW_MASK | \ - MBOX_INT_STATUS_RX_UNDERFLOW_MASK | \ - MBOX_INT_STATUS_TX_NOT_EMPTY_MASK | \ - MBOX_INT_STATUS_RX_NOT_FULL_MASK | \ - MBOX_INT_STATUS_HOST_MASK) -#define MBOX_INT_STATUS_SW_MASK (32'h0 | \ - MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK | \ - MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK | \ - MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK | \ - MBOX_INT_STATUS_TX_OVERFLOW_MASK | \ - MBOX_INT_STATUS_RX_UNDERFLOW_MASK | \ - MBOX_INT_STATUS_TX_NOT_EMPTY_MASK | \ - MBOX_INT_STATUS_RX_NOT_FULL_MASK | \ - MBOX_INT_STATUS_HOST_MASK) - -#define MBOX_INT_ENABLE_ADDRESS 'h0000005c -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB 31 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB 28 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK 'hf0000000 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) >> MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) & MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_RESET 4'h0 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB 27 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB 24 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK 'h0f000000 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) >> MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) & MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_RESET 4'h0 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB 23 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB 20 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK 'h00f00000 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) >> MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) & MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_RESET 4'h0 -#define MBOX_INT_ENABLE_TX_OVERFLOW_MSB 17 -#define MBOX_INT_ENABLE_TX_OVERFLOW_LSB 17 -#define MBOX_INT_ENABLE_TX_OVERFLOW_MASK 'h00020000 -#define MBOX_INT_ENABLE_TX_OVERFLOW_GET(x) (((x) & MBOX_INT_ENABLE_TX_OVERFLOW_MASK) >> MBOX_INT_ENABLE_TX_OVERFLOW_LSB) -#define MBOX_INT_ENABLE_TX_OVERFLOW_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_TX_OVERFLOW_LSB) & MBOX_INT_ENABLE_TX_OVERFLOW_MASK) -#define MBOX_INT_ENABLE_TX_OVERFLOW_RESET 1'h0 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_MSB 16 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_LSB 16 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_MASK 'h00010000 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) (((x) & MBOX_INT_ENABLE_RX_UNDERFLOW_MASK) >> MBOX_INT_ENABLE_RX_UNDERFLOW_LSB) -#define MBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_RX_UNDERFLOW_LSB) & MBOX_INT_ENABLE_RX_UNDERFLOW_MASK) -#define MBOX_INT_ENABLE_RX_UNDERFLOW_RESET 1'h0 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_MSB 15 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB 12 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK 'h0000f000 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) (((x) & MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) >> MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) & MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_RESET 4'h0 -#define MBOX_INT_ENABLE_RX_NOT_FULL_MSB 11 -#define MBOX_INT_ENABLE_RX_NOT_FULL_LSB 8 -#define MBOX_INT_ENABLE_RX_NOT_FULL_MASK 'h00000f00 -#define MBOX_INT_ENABLE_RX_NOT_FULL_GET(x) (((x) & MBOX_INT_ENABLE_RX_NOT_FULL_MASK) >> MBOX_INT_ENABLE_RX_NOT_FULL_LSB) -#define MBOX_INT_ENABLE_RX_NOT_FULL_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_RX_NOT_FULL_LSB) & MBOX_INT_ENABLE_RX_NOT_FULL_MASK) -#define MBOX_INT_ENABLE_RX_NOT_FULL_RESET 4'h0 -#define MBOX_INT_ENABLE_HOST_MSB 7 -#define MBOX_INT_ENABLE_HOST_LSB 0 -#define MBOX_INT_ENABLE_HOST_MASK 'h000000ff -#define MBOX_INT_ENABLE_HOST_GET(x) (((x) & MBOX_INT_ENABLE_HOST_MASK) >> MBOX_INT_ENABLE_HOST_LSB) -#define MBOX_INT_ENABLE_HOST_SET(x) (((32'd0 | (x)) << MBOX_INT_ENABLE_HOST_LSB) & MBOX_INT_ENABLE_HOST_MASK) -#define MBOX_INT_ENABLE_HOST_RESET 8'hff -#define MBOX_INT_ENABLE_RESET (32'h0 | \ - MBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(MBOX_INT_ENABLE_RX_DMA_COMPLETE_RESET) | \ - MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_RESET) | \ - MBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(MBOX_INT_ENABLE_TX_DMA_COMPLETE_RESET) | \ - MBOX_INT_ENABLE_TX_OVERFLOW_SET(MBOX_INT_ENABLE_TX_OVERFLOW_RESET) | \ - MBOX_INT_ENABLE_RX_UNDERFLOW_SET(MBOX_INT_ENABLE_RX_UNDERFLOW_RESET) | \ - MBOX_INT_ENABLE_TX_NOT_EMPTY_SET(MBOX_INT_ENABLE_TX_NOT_EMPTY_RESET) | \ - MBOX_INT_ENABLE_RX_NOT_FULL_SET(MBOX_INT_ENABLE_RX_NOT_FULL_RESET) | \ - MBOX_INT_ENABLE_HOST_SET(MBOX_INT_ENABLE_HOST_RESET)) -#define MBOX_INT_ENABLE_HW_MASK (32'h0) -#define MBOX_INT_ENABLE_SW_MASK (32'h0 | \ - MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK | \ - MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK | \ - MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK | \ - MBOX_INT_ENABLE_TX_OVERFLOW_MASK | \ - MBOX_INT_ENABLE_RX_UNDERFLOW_MASK | \ - MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK | \ - MBOX_INT_ENABLE_RX_NOT_FULL_MASK | \ - MBOX_INT_ENABLE_HOST_MASK) - -#define INT_HOST_ADDRESS 'h00000060 -#define INT_HOST_VECTOR_MSB 7 -#define INT_HOST_VECTOR_LSB 0 -#define INT_HOST_VECTOR_MASK 'h000000ff -#define INT_HOST_VECTOR_GET(x) (((x) & INT_HOST_VECTOR_MASK) >> INT_HOST_VECTOR_LSB) -#define INT_HOST_VECTOR_SET(x) (((32'd0 | (x)) << INT_HOST_VECTOR_LSB) & INT_HOST_VECTOR_MASK) -#define INT_HOST_VECTOR_RESET 8'h0 -#define INT_HOST_RESET (32'h0 | \ - INT_HOST_VECTOR_SET(INT_HOST_VECTOR_RESET)) -#define INT_HOST_HW_MASK (32'h0 | \ - INT_HOST_VECTOR_MASK) -#define INT_HOST_SW_MASK (32'h0 | \ - INT_HOST_VECTOR_MASK) - -#define LOCAL_COUNT_ADDRESS 'h00000080 -#define LOCAL_COUNT_VALUE_MSB 7 -#define LOCAL_COUNT_VALUE_LSB 0 -#define LOCAL_COUNT_VALUE_MASK 'h000000ff -#define LOCAL_COUNT_VALUE_GET(x) (((x) & LOCAL_COUNT_VALUE_MASK) >> LOCAL_COUNT_VALUE_LSB) -#define LOCAL_COUNT_VALUE_SET(x) (((32'd0 | (x)) << LOCAL_COUNT_VALUE_LSB) & LOCAL_COUNT_VALUE_MASK) -#define LOCAL_COUNT_VALUE_RESET 8'h0 -#define LOCAL_COUNT_RESET (32'h0 | \ - LOCAL_COUNT_VALUE_SET(LOCAL_COUNT_VALUE_RESET)) -#define LOCAL_COUNT_HW_MASK (32'h0 | \ - LOCAL_COUNT_VALUE_MASK) -#define LOCAL_COUNT_SW_MASK (32'h0 | \ - LOCAL_COUNT_VALUE_MASK) - -#define COUNT_INC_ADDRESS 'h000000a0 -#define COUNT_INC_VALUE_MSB 7 -#define COUNT_INC_VALUE_LSB 0 -#define COUNT_INC_VALUE_MASK 'h000000ff -#define COUNT_INC_VALUE_GET(x) (((x) & COUNT_INC_VALUE_MASK) >> COUNT_INC_VALUE_LSB) -#define COUNT_INC_VALUE_SET(x) (((32'd0 | (x)) << COUNT_INC_VALUE_LSB) & COUNT_INC_VALUE_MASK) -#define COUNT_INC_VALUE_RESET 8'h0 -#define COUNT_INC_RESET (32'h0 | \ - COUNT_INC_VALUE_SET(COUNT_INC_VALUE_RESET)) -#define COUNT_INC_HW_MASK (32'h0 | \ - COUNT_INC_VALUE_MASK) -#define COUNT_INC_SW_MASK (32'h0 | \ - COUNT_INC_VALUE_MASK) - -#define LOCAL_SCRATCH_ADDRESS 'h000000c0 -#define LOCAL_SCRATCH_VALUE_MSB 7 -#define LOCAL_SCRATCH_VALUE_LSB 0 -#define LOCAL_SCRATCH_VALUE_MASK 'h000000ff -#define LOCAL_SCRATCH_VALUE_GET(x) (((x) & LOCAL_SCRATCH_VALUE_MASK) >> LOCAL_SCRATCH_VALUE_LSB) -#define LOCAL_SCRATCH_VALUE_SET(x) (((32'd0 | (x)) << LOCAL_SCRATCH_VALUE_LSB) & LOCAL_SCRATCH_VALUE_MASK) -#define LOCAL_SCRATCH_VALUE_RESET 8'h0 -#define LOCAL_SCRATCH_RESET (32'h0 | \ - LOCAL_SCRATCH_VALUE_SET(LOCAL_SCRATCH_VALUE_RESET)) -#define LOCAL_SCRATCH_HW_MASK (32'h0 | \ - LOCAL_SCRATCH_VALUE_MASK) -#define LOCAL_SCRATCH_SW_MASK (32'h0 | \ - LOCAL_SCRATCH_VALUE_MASK) - -#define USE_LOCAL_BUS_ADDRESS 'h000000e0 -#define USE_LOCAL_BUS_PIN_INIT_MSB 0 -#define USE_LOCAL_BUS_PIN_INIT_LSB 0 -#define USE_LOCAL_BUS_PIN_INIT_MASK 'h00000001 -#define USE_LOCAL_BUS_PIN_INIT_GET(x) (((x) & USE_LOCAL_BUS_PIN_INIT_MASK) >> USE_LOCAL_BUS_PIN_INIT_LSB) -#define USE_LOCAL_BUS_PIN_INIT_SET(x) (((32'd0 | (x)) << USE_LOCAL_BUS_PIN_INIT_LSB) & USE_LOCAL_BUS_PIN_INIT_MASK) -#define USE_LOCAL_BUS_PIN_INIT_RESET 1'h0 -#define USE_LOCAL_BUS_RESET (32'h0 | \ - USE_LOCAL_BUS_PIN_INIT_SET(USE_LOCAL_BUS_PIN_INIT_RESET)) -#define USE_LOCAL_BUS_HW_MASK (32'h0 | \ - USE_LOCAL_BUS_PIN_INIT_MASK) -#define USE_LOCAL_BUS_SW_MASK (32'h0) - -#define SDIO_CONFIG_ADDRESS 'h000000e4 -#define SDIO_CONFIG_CCCR_IOR1_MSB 0 -#define SDIO_CONFIG_CCCR_IOR1_LSB 0 -#define SDIO_CONFIG_CCCR_IOR1_MASK 'h00000001 -#define SDIO_CONFIG_CCCR_IOR1_GET(x) (((x) & SDIO_CONFIG_CCCR_IOR1_MASK) >> SDIO_CONFIG_CCCR_IOR1_LSB) -#define SDIO_CONFIG_CCCR_IOR1_SET(x) (((32'd0 | (x)) << SDIO_CONFIG_CCCR_IOR1_LSB) & SDIO_CONFIG_CCCR_IOR1_MASK) -#define SDIO_CONFIG_CCCR_IOR1_RESET 1'h0 -#define SDIO_CONFIG_RESET (32'h0 | \ - SDIO_CONFIG_CCCR_IOR1_SET(SDIO_CONFIG_CCCR_IOR1_RESET)) -#define SDIO_CONFIG_HW_MASK (32'h0) -#define SDIO_CONFIG_SW_MASK (32'h0 | \ - SDIO_CONFIG_CCCR_IOR1_MASK) - -#define MBOX_DEBUG_ADDRESS 'h000000e8 -#define MBOX_DEBUG_SEL_MSB 2 -#define MBOX_DEBUG_SEL_LSB 0 -#define MBOX_DEBUG_SEL_MASK 'h00000007 -#define MBOX_DEBUG_SEL_GET(x) (((x) & MBOX_DEBUG_SEL_MASK) >> MBOX_DEBUG_SEL_LSB) -#define MBOX_DEBUG_SEL_SET(x) (((32'd0 | (x)) << MBOX_DEBUG_SEL_LSB) & MBOX_DEBUG_SEL_MASK) -#define MBOX_DEBUG_SEL_RESET 3'h0 -#define MBOX_DEBUG_RESET (32'h0 | \ - MBOX_DEBUG_SEL_SET(MBOX_DEBUG_SEL_RESET)) -#define MBOX_DEBUG_HW_MASK (32'h0) -#define MBOX_DEBUG_SW_MASK (32'h0 | \ - MBOX_DEBUG_SEL_MASK) - -#define MBOX_FIFO_RESET_ADDRESS 'h000000ec -#define MBOX_FIFO_RESET_INIT_MSB 0 -#define MBOX_FIFO_RESET_INIT_LSB 0 -#define MBOX_FIFO_RESET_INIT_MASK 'h00000001 -#define MBOX_FIFO_RESET_INIT_GET(x) (((x) & MBOX_FIFO_RESET_INIT_MASK) >> MBOX_FIFO_RESET_INIT_LSB) -#define MBOX_FIFO_RESET_INIT_SET(x) (((32'd0 | (x)) << MBOX_FIFO_RESET_INIT_LSB) & MBOX_FIFO_RESET_INIT_MASK) -#define MBOX_FIFO_RESET_INIT_RESET 1'h0 -#define MBOX_FIFO_RESET_RESET (32'h0 | \ - MBOX_FIFO_RESET_INIT_SET(MBOX_FIFO_RESET_INIT_RESET)) -#define MBOX_FIFO_RESET_HW_MASK (32'h0 | \ - MBOX_FIFO_RESET_INIT_MASK) -#define MBOX_FIFO_RESET_SW_MASK (32'h0 | \ - MBOX_FIFO_RESET_INIT_MASK) - -#define MBOX_TXFIFO_POP_ADDRESS 'h000000f0 -#define MBOX_TXFIFO_POP_DATA_MSB 0 -#define MBOX_TXFIFO_POP_DATA_LSB 0 -#define MBOX_TXFIFO_POP_DATA_MASK 'h00000001 -#define MBOX_TXFIFO_POP_DATA_GET(x) (((x) & MBOX_TXFIFO_POP_DATA_MASK) >> MBOX_TXFIFO_POP_DATA_LSB) -#define MBOX_TXFIFO_POP_DATA_SET(x) (((32'd0 | (x)) << MBOX_TXFIFO_POP_DATA_LSB) & MBOX_TXFIFO_POP_DATA_MASK) -#define MBOX_TXFIFO_POP_DATA_RESET 1'h0 -#define MBOX_TXFIFO_POP_RESET (32'h0 | \ - MBOX_TXFIFO_POP_DATA_SET(MBOX_TXFIFO_POP_DATA_RESET)) -#define MBOX_TXFIFO_POP_HW_MASK (32'h0) -#define MBOX_TXFIFO_POP_SW_MASK (32'h0 | \ - MBOX_TXFIFO_POP_DATA_MASK) - -#define MBOX_RXFIFO_POP_ADDRESS 'h00000100 -#define MBOX_RXFIFO_POP_DATA_MSB 0 -#define MBOX_RXFIFO_POP_DATA_LSB 0 -#define MBOX_RXFIFO_POP_DATA_MASK 'h00000001 -#define MBOX_RXFIFO_POP_DATA_GET(x) (((x) & MBOX_RXFIFO_POP_DATA_MASK) >> MBOX_RXFIFO_POP_DATA_LSB) -#define MBOX_RXFIFO_POP_DATA_SET(x) (((32'd0 | (x)) << MBOX_RXFIFO_POP_DATA_LSB) & MBOX_RXFIFO_POP_DATA_MASK) -#define MBOX_RXFIFO_POP_DATA_RESET 1'h0 -#define MBOX_RXFIFO_POP_RESET (32'h0 | \ - MBOX_RXFIFO_POP_DATA_SET(MBOX_RXFIFO_POP_DATA_RESET)) -#define MBOX_RXFIFO_POP_HW_MASK (32'h0) -#define MBOX_RXFIFO_POP_SW_MASK (32'h0 | \ - MBOX_RXFIFO_POP_DATA_MASK) - -#define SDIO_DEBUG_ADDRESS 'h00000110 -#define SDIO_DEBUG_SEL_MSB 3 -#define SDIO_DEBUG_SEL_LSB 0 -#define SDIO_DEBUG_SEL_MASK 'h0000000f -#define SDIO_DEBUG_SEL_GET(x) (((x) & SDIO_DEBUG_SEL_MASK) >> SDIO_DEBUG_SEL_LSB) -#define SDIO_DEBUG_SEL_SET(x) (((32'd0 | (x)) << SDIO_DEBUG_SEL_LSB) & SDIO_DEBUG_SEL_MASK) -#define SDIO_DEBUG_SEL_RESET 4'h0 -#define SDIO_DEBUG_RESET (32'h0 | \ - SDIO_DEBUG_SEL_SET(SDIO_DEBUG_SEL_RESET)) -#define SDIO_DEBUG_HW_MASK (32'h0) -#define SDIO_DEBUG_SW_MASK (32'h0 | \ - SDIO_DEBUG_SEL_MASK) - -#define HOST_IF_WINDOW_ADDRESS 'h00002000 -#define HOST_IF_WINDOW_DATA_MSB 7 -#define HOST_IF_WINDOW_DATA_LSB 0 -#define HOST_IF_WINDOW_DATA_MASK 'h000000ff -#define HOST_IF_WINDOW_DATA_GET(x) (((x) & HOST_IF_WINDOW_DATA_MASK) >> HOST_IF_WINDOW_DATA_LSB) -#define HOST_IF_WINDOW_DATA_SET(x) (((32'd0 | (x)) << HOST_IF_WINDOW_DATA_LSB) & HOST_IF_WINDOW_DATA_MASK) -#define HOST_IF_WINDOW_DATA_RESET 8'h0 -#define HOST_IF_WINDOW_RESET (32'h0 | \ - HOST_IF_WINDOW_DATA_SET(HOST_IF_WINDOW_DATA_RESET)) -#define HOST_IF_WINDOW_HW_MASK (32'h0 | \ - HOST_IF_WINDOW_DATA_MASK) -#define HOST_IF_WINDOW_SW_MASK (32'h0 | \ - HOST_IF_WINDOW_DATA_MASK) - -#define MBOX_REG_ADDRESS_MSB 13 - -#endif /* _MBOX_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf2G_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf2G_reg.h deleted file mode 100644 index f214c9c101c3..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf2G_reg.h +++ /dev/null @@ -1,160 +0,0 @@ -#ifndef _RF2G_REG_REG_H_ -#define _RF2G_REG_REG_H_ - -#define RF2G_RF2G1_ADDRESS 0x00000000 -#define RF2G_RF2G1_OFFSET 0x00000000 -#define RF2G_RF2G1_BLNA1_MSB 31 -#define RF2G_RF2G1_BLNA1_LSB 29 -#define RF2G_RF2G1_BLNA1_MASK 0xe0000000 -#define RF2G_RF2G1_BLNA1_GET(x) (((x) & RF2G_RF2G1_BLNA1_MASK) >> RF2G_RF2G1_BLNA1_LSB) -#define RF2G_RF2G1_BLNA1_SET(x) (((x) << RF2G_RF2G1_BLNA1_LSB) & RF2G_RF2G1_BLNA1_MASK) -#define RF2G_RF2G1_BLNA1F_MSB 28 -#define RF2G_RF2G1_BLNA1F_LSB 26 -#define RF2G_RF2G1_BLNA1F_MASK 0x1c000000 -#define RF2G_RF2G1_BLNA1F_GET(x) (((x) & RF2G_RF2G1_BLNA1F_MASK) >> RF2G_RF2G1_BLNA1F_LSB) -#define RF2G_RF2G1_BLNA1F_SET(x) (((x) << RF2G_RF2G1_BLNA1F_LSB) & RF2G_RF2G1_BLNA1F_MASK) -#define RF2G_RF2G1_BLNA1BUF_MSB 25 -#define RF2G_RF2G1_BLNA1BUF_LSB 23 -#define RF2G_RF2G1_BLNA1BUF_MASK 0x03800000 -#define RF2G_RF2G1_BLNA1BUF_GET(x) (((x) & RF2G_RF2G1_BLNA1BUF_MASK) >> RF2G_RF2G1_BLNA1BUF_LSB) -#define RF2G_RF2G1_BLNA1BUF_SET(x) (((x) << RF2G_RF2G1_BLNA1BUF_LSB) & RF2G_RF2G1_BLNA1BUF_MASK) -#define RF2G_RF2G1_BLNA2_MSB 22 -#define RF2G_RF2G1_BLNA2_LSB 20 -#define RF2G_RF2G1_BLNA2_MASK 0x00700000 -#define RF2G_RF2G1_BLNA2_GET(x) (((x) & RF2G_RF2G1_BLNA2_MASK) >> RF2G_RF2G1_BLNA2_LSB) -#define RF2G_RF2G1_BLNA2_SET(x) (((x) << RF2G_RF2G1_BLNA2_LSB) & RF2G_RF2G1_BLNA2_MASK) -#define RF2G_RF2G1_DB_MSB 19 -#define RF2G_RF2G1_DB_LSB 17 -#define RF2G_RF2G1_DB_MASK 0x000e0000 -#define RF2G_RF2G1_DB_GET(x) (((x) & RF2G_RF2G1_DB_MASK) >> RF2G_RF2G1_DB_LSB) -#define RF2G_RF2G1_DB_SET(x) (((x) << RF2G_RF2G1_DB_LSB) & RF2G_RF2G1_DB_MASK) -#define RF2G_RF2G1_OB_MSB 16 -#define RF2G_RF2G1_OB_LSB 14 -#define RF2G_RF2G1_OB_MASK 0x0001c000 -#define RF2G_RF2G1_OB_GET(x) (((x) & RF2G_RF2G1_OB_MASK) >> RF2G_RF2G1_OB_LSB) -#define RF2G_RF2G1_OB_SET(x) (((x) << RF2G_RF2G1_OB_LSB) & RF2G_RF2G1_OB_MASK) -#define RF2G_RF2G1_FE_ATB_SEL_MSB 13 -#define RF2G_RF2G1_FE_ATB_SEL_LSB 11 -#define RF2G_RF2G1_FE_ATB_SEL_MASK 0x00003800 -#define RF2G_RF2G1_FE_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_FE_ATB_SEL_MASK) >> RF2G_RF2G1_FE_ATB_SEL_LSB) -#define RF2G_RF2G1_FE_ATB_SEL_SET(x) (((x) << RF2G_RF2G1_FE_ATB_SEL_LSB) & RF2G_RF2G1_FE_ATB_SEL_MASK) -#define RF2G_RF2G1_RF_ATB_SEL_MSB 10 -#define RF2G_RF2G1_RF_ATB_SEL_LSB 8 -#define RF2G_RF2G1_RF_ATB_SEL_MASK 0x00000700 -#define RF2G_RF2G1_RF_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_RF_ATB_SEL_MASK) >> RF2G_RF2G1_RF_ATB_SEL_LSB) -#define RF2G_RF2G1_RF_ATB_SEL_SET(x) (((x) << RF2G_RF2G1_RF_ATB_SEL_LSB) & RF2G_RF2G1_RF_ATB_SEL_MASK) -#define RF2G_RF2G1_SELLNA_MSB 7 -#define RF2G_RF2G1_SELLNA_LSB 7 -#define RF2G_RF2G1_SELLNA_MASK 0x00000080 -#define RF2G_RF2G1_SELLNA_GET(x) (((x) & RF2G_RF2G1_SELLNA_MASK) >> RF2G_RF2G1_SELLNA_LSB) -#define RF2G_RF2G1_SELLNA_SET(x) (((x) << RF2G_RF2G1_SELLNA_LSB) & RF2G_RF2G1_SELLNA_MASK) -#define RF2G_RF2G1_LOCONTROL_MSB 6 -#define RF2G_RF2G1_LOCONTROL_LSB 6 -#define RF2G_RF2G1_LOCONTROL_MASK 0x00000040 -#define RF2G_RF2G1_LOCONTROL_GET(x) (((x) & RF2G_RF2G1_LOCONTROL_MASK) >> RF2G_RF2G1_LOCONTROL_LSB) -#define RF2G_RF2G1_LOCONTROL_SET(x) (((x) << RF2G_RF2G1_LOCONTROL_LSB) & RF2G_RF2G1_LOCONTROL_MASK) -#define RF2G_RF2G1_SHORTLNA2_MSB 5 -#define RF2G_RF2G1_SHORTLNA2_LSB 5 -#define RF2G_RF2G1_SHORTLNA2_MASK 0x00000020 -#define RF2G_RF2G1_SHORTLNA2_GET(x) (((x) & RF2G_RF2G1_SHORTLNA2_MASK) >> RF2G_RF2G1_SHORTLNA2_LSB) -#define RF2G_RF2G1_SHORTLNA2_SET(x) (((x) << RF2G_RF2G1_SHORTLNA2_LSB) & RF2G_RF2G1_SHORTLNA2_MASK) -#define RF2G_RF2G1_SPARE_MSB 4 -#define RF2G_RF2G1_SPARE_LSB 0 -#define RF2G_RF2G1_SPARE_MASK 0x0000001f -#define RF2G_RF2G1_SPARE_GET(x) (((x) & RF2G_RF2G1_SPARE_MASK) >> RF2G_RF2G1_SPARE_LSB) -#define RF2G_RF2G1_SPARE_SET(x) (((x) << RF2G_RF2G1_SPARE_LSB) & RF2G_RF2G1_SPARE_MASK) - -#define RF2G_RF2G2_ADDRESS 0x00000004 -#define RF2G_RF2G2_OFFSET 0x00000004 -#define RF2G_RF2G2_PDCGLNA_MSB 31 -#define RF2G_RF2G2_PDCGLNA_LSB 31 -#define RF2G_RF2G2_PDCGLNA_MASK 0x80000000 -#define RF2G_RF2G2_PDCGLNA_GET(x) (((x) & RF2G_RF2G2_PDCGLNA_MASK) >> RF2G_RF2G2_PDCGLNA_LSB) -#define RF2G_RF2G2_PDCGLNA_SET(x) (((x) << RF2G_RF2G2_PDCGLNA_LSB) & RF2G_RF2G2_PDCGLNA_MASK) -#define RF2G_RF2G2_PDCGLNABUF_MSB 30 -#define RF2G_RF2G2_PDCGLNABUF_LSB 30 -#define RF2G_RF2G2_PDCGLNABUF_MASK 0x40000000 -#define RF2G_RF2G2_PDCGLNABUF_GET(x) (((x) & RF2G_RF2G2_PDCGLNABUF_MASK) >> RF2G_RF2G2_PDCGLNABUF_LSB) -#define RF2G_RF2G2_PDCGLNABUF_SET(x) (((x) << RF2G_RF2G2_PDCGLNABUF_LSB) & RF2G_RF2G2_PDCGLNABUF_MASK) -#define RF2G_RF2G2_PDCSLNA_MSB 29 -#define RF2G_RF2G2_PDCSLNA_LSB 29 -#define RF2G_RF2G2_PDCSLNA_MASK 0x20000000 -#define RF2G_RF2G2_PDCSLNA_GET(x) (((x) & RF2G_RF2G2_PDCSLNA_MASK) >> RF2G_RF2G2_PDCSLNA_LSB) -#define RF2G_RF2G2_PDCSLNA_SET(x) (((x) << RF2G_RF2G2_PDCSLNA_LSB) & RF2G_RF2G2_PDCSLNA_MASK) -#define RF2G_RF2G2_PDDIV_MSB 28 -#define RF2G_RF2G2_PDDIV_LSB 28 -#define RF2G_RF2G2_PDDIV_MASK 0x10000000 -#define RF2G_RF2G2_PDDIV_GET(x) (((x) & RF2G_RF2G2_PDDIV_MASK) >> RF2G_RF2G2_PDDIV_LSB) -#define RF2G_RF2G2_PDDIV_SET(x) (((x) << RF2G_RF2G2_PDDIV_LSB) & RF2G_RF2G2_PDDIV_MASK) -#define RF2G_RF2G2_PDPADRV_MSB 27 -#define RF2G_RF2G2_PDPADRV_LSB 27 -#define RF2G_RF2G2_PDPADRV_MASK 0x08000000 -#define RF2G_RF2G2_PDPADRV_GET(x) (((x) & RF2G_RF2G2_PDPADRV_MASK) >> RF2G_RF2G2_PDPADRV_LSB) -#define RF2G_RF2G2_PDPADRV_SET(x) (((x) << RF2G_RF2G2_PDPADRV_LSB) & RF2G_RF2G2_PDPADRV_MASK) -#define RF2G_RF2G2_PDPAOUT_MSB 26 -#define RF2G_RF2G2_PDPAOUT_LSB 26 -#define RF2G_RF2G2_PDPAOUT_MASK 0x04000000 -#define RF2G_RF2G2_PDPAOUT_GET(x) (((x) & RF2G_RF2G2_PDPAOUT_MASK) >> RF2G_RF2G2_PDPAOUT_LSB) -#define RF2G_RF2G2_PDPAOUT_SET(x) (((x) << RF2G_RF2G2_PDPAOUT_LSB) & RF2G_RF2G2_PDPAOUT_MASK) -#define RF2G_RF2G2_PDREGLNA_MSB 25 -#define RF2G_RF2G2_PDREGLNA_LSB 25 -#define RF2G_RF2G2_PDREGLNA_MASK 0x02000000 -#define RF2G_RF2G2_PDREGLNA_GET(x) (((x) & RF2G_RF2G2_PDREGLNA_MASK) >> RF2G_RF2G2_PDREGLNA_LSB) -#define RF2G_RF2G2_PDREGLNA_SET(x) (((x) << RF2G_RF2G2_PDREGLNA_LSB) & RF2G_RF2G2_PDREGLNA_MASK) -#define RF2G_RF2G2_PDREGLO_MSB 24 -#define RF2G_RF2G2_PDREGLO_LSB 24 -#define RF2G_RF2G2_PDREGLO_MASK 0x01000000 -#define RF2G_RF2G2_PDREGLO_GET(x) (((x) & RF2G_RF2G2_PDREGLO_MASK) >> RF2G_RF2G2_PDREGLO_LSB) -#define RF2G_RF2G2_PDREGLO_SET(x) (((x) << RF2G_RF2G2_PDREGLO_LSB) & RF2G_RF2G2_PDREGLO_MASK) -#define RF2G_RF2G2_PDRFGM_MSB 23 -#define RF2G_RF2G2_PDRFGM_LSB 23 -#define RF2G_RF2G2_PDRFGM_MASK 0x00800000 -#define RF2G_RF2G2_PDRFGM_GET(x) (((x) & RF2G_RF2G2_PDRFGM_MASK) >> RF2G_RF2G2_PDRFGM_LSB) -#define RF2G_RF2G2_PDRFGM_SET(x) (((x) << RF2G_RF2G2_PDRFGM_LSB) & RF2G_RF2G2_PDRFGM_MASK) -#define RF2G_RF2G2_PDRXLO_MSB 22 -#define RF2G_RF2G2_PDRXLO_LSB 22 -#define RF2G_RF2G2_PDRXLO_MASK 0x00400000 -#define RF2G_RF2G2_PDRXLO_GET(x) (((x) & RF2G_RF2G2_PDRXLO_MASK) >> RF2G_RF2G2_PDRXLO_LSB) -#define RF2G_RF2G2_PDRXLO_SET(x) (((x) << RF2G_RF2G2_PDRXLO_LSB) & RF2G_RF2G2_PDRXLO_MASK) -#define RF2G_RF2G2_PDTXLO_MSB 21 -#define RF2G_RF2G2_PDTXLO_LSB 21 -#define RF2G_RF2G2_PDTXLO_MASK 0x00200000 -#define RF2G_RF2G2_PDTXLO_GET(x) (((x) & RF2G_RF2G2_PDTXLO_MASK) >> RF2G_RF2G2_PDTXLO_LSB) -#define RF2G_RF2G2_PDTXLO_SET(x) (((x) << RF2G_RF2G2_PDTXLO_LSB) & RF2G_RF2G2_PDTXLO_MASK) -#define RF2G_RF2G2_PDTXMIX_MSB 20 -#define RF2G_RF2G2_PDTXMIX_LSB 20 -#define RF2G_RF2G2_PDTXMIX_MASK 0x00100000 -#define RF2G_RF2G2_PDTXMIX_GET(x) (((x) & RF2G_RF2G2_PDTXMIX_MASK) >> RF2G_RF2G2_PDTXMIX_LSB) -#define RF2G_RF2G2_PDTXMIX_SET(x) (((x) << RF2G_RF2G2_PDTXMIX_LSB) & RF2G_RF2G2_PDTXMIX_MASK) -#define RF2G_RF2G2_REGLNA_BYPASS_MSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_LSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_MASK 0x00080000 -#define RF2G_RF2G2_REGLNA_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLNA_BYPASS_MASK) >> RF2G_RF2G2_REGLNA_BYPASS_LSB) -#define RF2G_RF2G2_REGLNA_BYPASS_SET(x) (((x) << RF2G_RF2G2_REGLNA_BYPASS_LSB) & RF2G_RF2G2_REGLNA_BYPASS_MASK) -#define RF2G_RF2G2_REGLO_BYPASS_MSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_LSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_MASK 0x00040000 -#define RF2G_RF2G2_REGLO_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLO_BYPASS_MASK) >> RF2G_RF2G2_REGLO_BYPASS_LSB) -#define RF2G_RF2G2_REGLO_BYPASS_SET(x) (((x) << RF2G_RF2G2_REGLO_BYPASS_LSB) & RF2G_RF2G2_REGLO_BYPASS_MASK) -#define RF2G_RF2G2_ENABLE_PCB_MSB 17 -#define RF2G_RF2G2_ENABLE_PCB_LSB 17 -#define RF2G_RF2G2_ENABLE_PCB_MASK 0x00020000 -#define RF2G_RF2G2_ENABLE_PCB_GET(x) (((x) & RF2G_RF2G2_ENABLE_PCB_MASK) >> RF2G_RF2G2_ENABLE_PCB_LSB) -#define RF2G_RF2G2_ENABLE_PCB_SET(x) (((x) << RF2G_RF2G2_ENABLE_PCB_LSB) & RF2G_RF2G2_ENABLE_PCB_MASK) -#define RF2G_RF2G2_SPARE_MSB 16 -#define RF2G_RF2G2_SPARE_LSB 0 -#define RF2G_RF2G2_SPARE_MASK 0x0001ffff -#define RF2G_RF2G2_SPARE_GET(x) (((x) & RF2G_RF2G2_SPARE_MASK) >> RF2G_RF2G2_SPARE_LSB) -#define RF2G_RF2G2_SPARE_SET(x) (((x) << RF2G_RF2G2_SPARE_LSB) & RF2G_RF2G2_SPARE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct rf2g_reg_reg_s { - volatile unsigned int rf2g_rf2g1; - volatile unsigned int rf2g_rf2g2; -} rf2g_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _RF2G_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf2G_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf2G_reg.vrh deleted file mode 100644 index abcf5f12caf0..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf2G_reg.vrh +++ /dev/null @@ -1,240 +0,0 @@ -#ifndef _RF2G_REG_VRH_ -#define _RF2G_REG_VRH_ - -#define RF2G_RF2G1_ADDRESS 'h00000000 -#define RF2G_RF2G1_BLNA1_MSB 31 -#define RF2G_RF2G1_BLNA1_LSB 29 -#define RF2G_RF2G1_BLNA1_MASK 'he0000000 -#define RF2G_RF2G1_BLNA1_GET(x) (((x) & RF2G_RF2G1_BLNA1_MASK) >> RF2G_RF2G1_BLNA1_LSB) -#define RF2G_RF2G1_BLNA1_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA1_LSB) & RF2G_RF2G1_BLNA1_MASK) -#define RF2G_RF2G1_BLNA1_RESET 3'h3 -#define RF2G_RF2G1_BLNA1F_MSB 28 -#define RF2G_RF2G1_BLNA1F_LSB 26 -#define RF2G_RF2G1_BLNA1F_MASK 'h1c000000 -#define RF2G_RF2G1_BLNA1F_GET(x) (((x) & RF2G_RF2G1_BLNA1F_MASK) >> RF2G_RF2G1_BLNA1F_LSB) -#define RF2G_RF2G1_BLNA1F_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA1F_LSB) & RF2G_RF2G1_BLNA1F_MASK) -#define RF2G_RF2G1_BLNA1F_RESET 3'h0 -#define RF2G_RF2G1_BLNA1BUF_MSB 25 -#define RF2G_RF2G1_BLNA1BUF_LSB 23 -#define RF2G_RF2G1_BLNA1BUF_MASK 'h03800000 -#define RF2G_RF2G1_BLNA1BUF_GET(x) (((x) & RF2G_RF2G1_BLNA1BUF_MASK) >> RF2G_RF2G1_BLNA1BUF_LSB) -#define RF2G_RF2G1_BLNA1BUF_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA1BUF_LSB) & RF2G_RF2G1_BLNA1BUF_MASK) -#define RF2G_RF2G1_BLNA1BUF_RESET 3'h3 -#define RF2G_RF2G1_BLNA2_MSB 22 -#define RF2G_RF2G1_BLNA2_LSB 20 -#define RF2G_RF2G1_BLNA2_MASK 'h00700000 -#define RF2G_RF2G1_BLNA2_GET(x) (((x) & RF2G_RF2G1_BLNA2_MASK) >> RF2G_RF2G1_BLNA2_LSB) -#define RF2G_RF2G1_BLNA2_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_BLNA2_LSB) & RF2G_RF2G1_BLNA2_MASK) -#define RF2G_RF2G1_BLNA2_RESET 3'h3 -#define RF2G_RF2G1_DB_MSB 19 -#define RF2G_RF2G1_DB_LSB 17 -#define RF2G_RF2G1_DB_MASK 'h000e0000 -#define RF2G_RF2G1_DB_GET(x) (((x) & RF2G_RF2G1_DB_MASK) >> RF2G_RF2G1_DB_LSB) -#define RF2G_RF2G1_DB_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_DB_LSB) & RF2G_RF2G1_DB_MASK) -#define RF2G_RF2G1_DB_RESET 3'h3 -#define RF2G_RF2G1_OB_MSB 16 -#define RF2G_RF2G1_OB_LSB 14 -#define RF2G_RF2G1_OB_MASK 'h0001c000 -#define RF2G_RF2G1_OB_GET(x) (((x) & RF2G_RF2G1_OB_MASK) >> RF2G_RF2G1_OB_LSB) -#define RF2G_RF2G1_OB_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_OB_LSB) & RF2G_RF2G1_OB_MASK) -#define RF2G_RF2G1_OB_RESET 3'h3 -#define RF2G_RF2G1_FE_ATB_SEL_MSB 13 -#define RF2G_RF2G1_FE_ATB_SEL_LSB 11 -#define RF2G_RF2G1_FE_ATB_SEL_MASK 'h00003800 -#define RF2G_RF2G1_FE_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_FE_ATB_SEL_MASK) >> RF2G_RF2G1_FE_ATB_SEL_LSB) -#define RF2G_RF2G1_FE_ATB_SEL_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_FE_ATB_SEL_LSB) & RF2G_RF2G1_FE_ATB_SEL_MASK) -#define RF2G_RF2G1_FE_ATB_SEL_RESET 3'h0 -#define RF2G_RF2G1_RF_ATB_SEL_MSB 10 -#define RF2G_RF2G1_RF_ATB_SEL_LSB 8 -#define RF2G_RF2G1_RF_ATB_SEL_MASK 'h00000700 -#define RF2G_RF2G1_RF_ATB_SEL_GET(x) (((x) & RF2G_RF2G1_RF_ATB_SEL_MASK) >> RF2G_RF2G1_RF_ATB_SEL_LSB) -#define RF2G_RF2G1_RF_ATB_SEL_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_RF_ATB_SEL_LSB) & RF2G_RF2G1_RF_ATB_SEL_MASK) -#define RF2G_RF2G1_RF_ATB_SEL_RESET 3'h0 -#define RF2G_RF2G1_SELLNA_MSB 7 -#define RF2G_RF2G1_SELLNA_LSB 7 -#define RF2G_RF2G1_SELLNA_MASK 'h00000080 -#define RF2G_RF2G1_SELLNA_GET(x) (((x) & RF2G_RF2G1_SELLNA_MASK) >> RF2G_RF2G1_SELLNA_LSB) -#define RF2G_RF2G1_SELLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_SELLNA_LSB) & RF2G_RF2G1_SELLNA_MASK) -#define RF2G_RF2G1_SELLNA_RESET 1'h1 -#define RF2G_RF2G1_LOCONTROL_MSB 6 -#define RF2G_RF2G1_LOCONTROL_LSB 6 -#define RF2G_RF2G1_LOCONTROL_MASK 'h00000040 -#define RF2G_RF2G1_LOCONTROL_GET(x) (((x) & RF2G_RF2G1_LOCONTROL_MASK) >> RF2G_RF2G1_LOCONTROL_LSB) -#define RF2G_RF2G1_LOCONTROL_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_LOCONTROL_LSB) & RF2G_RF2G1_LOCONTROL_MASK) -#define RF2G_RF2G1_LOCONTROL_RESET 1'h0 -#define RF2G_RF2G1_SHORTLNA2_MSB 5 -#define RF2G_RF2G1_SHORTLNA2_LSB 5 -#define RF2G_RF2G1_SHORTLNA2_MASK 'h00000020 -#define RF2G_RF2G1_SHORTLNA2_GET(x) (((x) & RF2G_RF2G1_SHORTLNA2_MASK) >> RF2G_RF2G1_SHORTLNA2_LSB) -#define RF2G_RF2G1_SHORTLNA2_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_SHORTLNA2_LSB) & RF2G_RF2G1_SHORTLNA2_MASK) -#define RF2G_RF2G1_SHORTLNA2_RESET 1'h0 -#define RF2G_RF2G1_SPARE_MSB 4 -#define RF2G_RF2G1_SPARE_LSB 0 -#define RF2G_RF2G1_SPARE_MASK 'h0000001f -#define RF2G_RF2G1_SPARE_GET(x) (((x) & RF2G_RF2G1_SPARE_MASK) >> RF2G_RF2G1_SPARE_LSB) -#define RF2G_RF2G1_SPARE_SET(x) (((32'd0 | (x)) << RF2G_RF2G1_SPARE_LSB) & RF2G_RF2G1_SPARE_MASK) -#define RF2G_RF2G1_SPARE_RESET 5'h0 -#define RF2G_RF2G1_RESET (32'h0 | \ - RF2G_RF2G1_BLNA1_SET(RF2G_RF2G1_BLNA1_RESET) | \ - RF2G_RF2G1_BLNA1F_SET(RF2G_RF2G1_BLNA1F_RESET) | \ - RF2G_RF2G1_BLNA1BUF_SET(RF2G_RF2G1_BLNA1BUF_RESET) | \ - RF2G_RF2G1_BLNA2_SET(RF2G_RF2G1_BLNA2_RESET) | \ - RF2G_RF2G1_DB_SET(RF2G_RF2G1_DB_RESET) | \ - RF2G_RF2G1_OB_SET(RF2G_RF2G1_OB_RESET) | \ - RF2G_RF2G1_FE_ATB_SEL_SET(RF2G_RF2G1_FE_ATB_SEL_RESET) | \ - RF2G_RF2G1_RF_ATB_SEL_SET(RF2G_RF2G1_RF_ATB_SEL_RESET) | \ - RF2G_RF2G1_SELLNA_SET(RF2G_RF2G1_SELLNA_RESET) | \ - RF2G_RF2G1_LOCONTROL_SET(RF2G_RF2G1_LOCONTROL_RESET) | \ - RF2G_RF2G1_SHORTLNA2_SET(RF2G_RF2G1_SHORTLNA2_RESET) | \ - RF2G_RF2G1_SPARE_SET(RF2G_RF2G1_SPARE_RESET)) -#define RF2G_RF2G1_HW_MASK (32'h0) -#define RF2G_RF2G1_SW_MASK (32'h0 | \ - RF2G_RF2G1_BLNA1_MASK | \ - RF2G_RF2G1_BLNA1F_MASK | \ - RF2G_RF2G1_BLNA1BUF_MASK | \ - RF2G_RF2G1_BLNA2_MASK | \ - RF2G_RF2G1_DB_MASK | \ - RF2G_RF2G1_OB_MASK | \ - RF2G_RF2G1_FE_ATB_SEL_MASK | \ - RF2G_RF2G1_RF_ATB_SEL_MASK | \ - RF2G_RF2G1_SELLNA_MASK | \ - RF2G_RF2G1_LOCONTROL_MASK | \ - RF2G_RF2G1_SHORTLNA2_MASK | \ - RF2G_RF2G1_SPARE_MASK) - -#define RF2G_RF2G2_ADDRESS 'h00000004 -#define RF2G_RF2G2_PDCGLNA_MSB 31 -#define RF2G_RF2G2_PDCGLNA_LSB 31 -#define RF2G_RF2G2_PDCGLNA_MASK 'h80000000 -#define RF2G_RF2G2_PDCGLNA_GET(x) (((x) & RF2G_RF2G2_PDCGLNA_MASK) >> RF2G_RF2G2_PDCGLNA_LSB) -#define RF2G_RF2G2_PDCGLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDCGLNA_LSB) & RF2G_RF2G2_PDCGLNA_MASK) -#define RF2G_RF2G2_PDCGLNA_RESET 1'h0 -#define RF2G_RF2G2_PDCGLNABUF_MSB 30 -#define RF2G_RF2G2_PDCGLNABUF_LSB 30 -#define RF2G_RF2G2_PDCGLNABUF_MASK 'h40000000 -#define RF2G_RF2G2_PDCGLNABUF_GET(x) (((x) & RF2G_RF2G2_PDCGLNABUF_MASK) >> RF2G_RF2G2_PDCGLNABUF_LSB) -#define RF2G_RF2G2_PDCGLNABUF_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDCGLNABUF_LSB) & RF2G_RF2G2_PDCGLNABUF_MASK) -#define RF2G_RF2G2_PDCGLNABUF_RESET 1'h0 -#define RF2G_RF2G2_PDCSLNA_MSB 29 -#define RF2G_RF2G2_PDCSLNA_LSB 29 -#define RF2G_RF2G2_PDCSLNA_MASK 'h20000000 -#define RF2G_RF2G2_PDCSLNA_GET(x) (((x) & RF2G_RF2G2_PDCSLNA_MASK) >> RF2G_RF2G2_PDCSLNA_LSB) -#define RF2G_RF2G2_PDCSLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDCSLNA_LSB) & RF2G_RF2G2_PDCSLNA_MASK) -#define RF2G_RF2G2_PDCSLNA_RESET 1'h0 -#define RF2G_RF2G2_PDDIV_MSB 28 -#define RF2G_RF2G2_PDDIV_LSB 28 -#define RF2G_RF2G2_PDDIV_MASK 'h10000000 -#define RF2G_RF2G2_PDDIV_GET(x) (((x) & RF2G_RF2G2_PDDIV_MASK) >> RF2G_RF2G2_PDDIV_LSB) -#define RF2G_RF2G2_PDDIV_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDDIV_LSB) & RF2G_RF2G2_PDDIV_MASK) -#define RF2G_RF2G2_PDDIV_RESET 1'h0 -#define RF2G_RF2G2_PDPADRV_MSB 27 -#define RF2G_RF2G2_PDPADRV_LSB 27 -#define RF2G_RF2G2_PDPADRV_MASK 'h08000000 -#define RF2G_RF2G2_PDPADRV_GET(x) (((x) & RF2G_RF2G2_PDPADRV_MASK) >> RF2G_RF2G2_PDPADRV_LSB) -#define RF2G_RF2G2_PDPADRV_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDPADRV_LSB) & RF2G_RF2G2_PDPADRV_MASK) -#define RF2G_RF2G2_PDPADRV_RESET 1'h0 -#define RF2G_RF2G2_PDPAOUT_MSB 26 -#define RF2G_RF2G2_PDPAOUT_LSB 26 -#define RF2G_RF2G2_PDPAOUT_MASK 'h04000000 -#define RF2G_RF2G2_PDPAOUT_GET(x) (((x) & RF2G_RF2G2_PDPAOUT_MASK) >> RF2G_RF2G2_PDPAOUT_LSB) -#define RF2G_RF2G2_PDPAOUT_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDPAOUT_LSB) & RF2G_RF2G2_PDPAOUT_MASK) -#define RF2G_RF2G2_PDPAOUT_RESET 1'h0 -#define RF2G_RF2G2_PDREGLNA_MSB 25 -#define RF2G_RF2G2_PDREGLNA_LSB 25 -#define RF2G_RF2G2_PDREGLNA_MASK 'h02000000 -#define RF2G_RF2G2_PDREGLNA_GET(x) (((x) & RF2G_RF2G2_PDREGLNA_MASK) >> RF2G_RF2G2_PDREGLNA_LSB) -#define RF2G_RF2G2_PDREGLNA_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDREGLNA_LSB) & RF2G_RF2G2_PDREGLNA_MASK) -#define RF2G_RF2G2_PDREGLNA_RESET 1'h0 -#define RF2G_RF2G2_PDREGLO_MSB 24 -#define RF2G_RF2G2_PDREGLO_LSB 24 -#define RF2G_RF2G2_PDREGLO_MASK 'h01000000 -#define RF2G_RF2G2_PDREGLO_GET(x) (((x) & RF2G_RF2G2_PDREGLO_MASK) >> RF2G_RF2G2_PDREGLO_LSB) -#define RF2G_RF2G2_PDREGLO_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDREGLO_LSB) & RF2G_RF2G2_PDREGLO_MASK) -#define RF2G_RF2G2_PDREGLO_RESET 1'h0 -#define RF2G_RF2G2_PDRFGM_MSB 23 -#define RF2G_RF2G2_PDRFGM_LSB 23 -#define RF2G_RF2G2_PDRFGM_MASK 'h00800000 -#define RF2G_RF2G2_PDRFGM_GET(x) (((x) & RF2G_RF2G2_PDRFGM_MASK) >> RF2G_RF2G2_PDRFGM_LSB) -#define RF2G_RF2G2_PDRFGM_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDRFGM_LSB) & RF2G_RF2G2_PDRFGM_MASK) -#define RF2G_RF2G2_PDRFGM_RESET 1'h0 -#define RF2G_RF2G2_PDRXLO_MSB 22 -#define RF2G_RF2G2_PDRXLO_LSB 22 -#define RF2G_RF2G2_PDRXLO_MASK 'h00400000 -#define RF2G_RF2G2_PDRXLO_GET(x) (((x) & RF2G_RF2G2_PDRXLO_MASK) >> RF2G_RF2G2_PDRXLO_LSB) -#define RF2G_RF2G2_PDRXLO_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDRXLO_LSB) & RF2G_RF2G2_PDRXLO_MASK) -#define RF2G_RF2G2_PDRXLO_RESET 1'h0 -#define RF2G_RF2G2_PDTXLO_MSB 21 -#define RF2G_RF2G2_PDTXLO_LSB 21 -#define RF2G_RF2G2_PDTXLO_MASK 'h00200000 -#define RF2G_RF2G2_PDTXLO_GET(x) (((x) & RF2G_RF2G2_PDTXLO_MASK) >> RF2G_RF2G2_PDTXLO_LSB) -#define RF2G_RF2G2_PDTXLO_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDTXLO_LSB) & RF2G_RF2G2_PDTXLO_MASK) -#define RF2G_RF2G2_PDTXLO_RESET 1'h0 -#define RF2G_RF2G2_PDTXMIX_MSB 20 -#define RF2G_RF2G2_PDTXMIX_LSB 20 -#define RF2G_RF2G2_PDTXMIX_MASK 'h00100000 -#define RF2G_RF2G2_PDTXMIX_GET(x) (((x) & RF2G_RF2G2_PDTXMIX_MASK) >> RF2G_RF2G2_PDTXMIX_LSB) -#define RF2G_RF2G2_PDTXMIX_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_PDTXMIX_LSB) & RF2G_RF2G2_PDTXMIX_MASK) -#define RF2G_RF2G2_PDTXMIX_RESET 1'h0 -#define RF2G_RF2G2_REGLNA_BYPASS_MSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_LSB 19 -#define RF2G_RF2G2_REGLNA_BYPASS_MASK 'h00080000 -#define RF2G_RF2G2_REGLNA_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLNA_BYPASS_MASK) >> RF2G_RF2G2_REGLNA_BYPASS_LSB) -#define RF2G_RF2G2_REGLNA_BYPASS_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_REGLNA_BYPASS_LSB) & RF2G_RF2G2_REGLNA_BYPASS_MASK) -#define RF2G_RF2G2_REGLNA_BYPASS_RESET 1'h0 -#define RF2G_RF2G2_REGLO_BYPASS_MSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_LSB 18 -#define RF2G_RF2G2_REGLO_BYPASS_MASK 'h00040000 -#define RF2G_RF2G2_REGLO_BYPASS_GET(x) (((x) & RF2G_RF2G2_REGLO_BYPASS_MASK) >> RF2G_RF2G2_REGLO_BYPASS_LSB) -#define RF2G_RF2G2_REGLO_BYPASS_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_REGLO_BYPASS_LSB) & RF2G_RF2G2_REGLO_BYPASS_MASK) -#define RF2G_RF2G2_REGLO_BYPASS_RESET 1'h0 -#define RF2G_RF2G2_ENABLE_PCB_MSB 17 -#define RF2G_RF2G2_ENABLE_PCB_LSB 17 -#define RF2G_RF2G2_ENABLE_PCB_MASK 'h00020000 -#define RF2G_RF2G2_ENABLE_PCB_GET(x) (((x) & RF2G_RF2G2_ENABLE_PCB_MASK) >> RF2G_RF2G2_ENABLE_PCB_LSB) -#define RF2G_RF2G2_ENABLE_PCB_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_ENABLE_PCB_LSB) & RF2G_RF2G2_ENABLE_PCB_MASK) -#define RF2G_RF2G2_ENABLE_PCB_RESET 1'h0 -#define RF2G_RF2G2_SPARE_MSB 16 -#define RF2G_RF2G2_SPARE_LSB 0 -#define RF2G_RF2G2_SPARE_MASK 'h0001ffff -#define RF2G_RF2G2_SPARE_GET(x) (((x) & RF2G_RF2G2_SPARE_MASK) >> RF2G_RF2G2_SPARE_LSB) -#define RF2G_RF2G2_SPARE_SET(x) (((32'd0 | (x)) << RF2G_RF2G2_SPARE_LSB) & RF2G_RF2G2_SPARE_MASK) -#define RF2G_RF2G2_SPARE_RESET 17'h0 -#define RF2G_RF2G2_RESET (32'h0 | \ - RF2G_RF2G2_PDCGLNA_SET(RF2G_RF2G2_PDCGLNA_RESET) | \ - RF2G_RF2G2_PDCGLNABUF_SET(RF2G_RF2G2_PDCGLNABUF_RESET) | \ - RF2G_RF2G2_PDCSLNA_SET(RF2G_RF2G2_PDCSLNA_RESET) | \ - RF2G_RF2G2_PDDIV_SET(RF2G_RF2G2_PDDIV_RESET) | \ - RF2G_RF2G2_PDPADRV_SET(RF2G_RF2G2_PDPADRV_RESET) | \ - RF2G_RF2G2_PDPAOUT_SET(RF2G_RF2G2_PDPAOUT_RESET) | \ - RF2G_RF2G2_PDREGLNA_SET(RF2G_RF2G2_PDREGLNA_RESET) | \ - RF2G_RF2G2_PDREGLO_SET(RF2G_RF2G2_PDREGLO_RESET) | \ - RF2G_RF2G2_PDRFGM_SET(RF2G_RF2G2_PDRFGM_RESET) | \ - RF2G_RF2G2_PDRXLO_SET(RF2G_RF2G2_PDRXLO_RESET) | \ - RF2G_RF2G2_PDTXLO_SET(RF2G_RF2G2_PDTXLO_RESET) | \ - RF2G_RF2G2_PDTXMIX_SET(RF2G_RF2G2_PDTXMIX_RESET) | \ - RF2G_RF2G2_REGLNA_BYPASS_SET(RF2G_RF2G2_REGLNA_BYPASS_RESET) | \ - RF2G_RF2G2_REGLO_BYPASS_SET(RF2G_RF2G2_REGLO_BYPASS_RESET) | \ - RF2G_RF2G2_ENABLE_PCB_SET(RF2G_RF2G2_ENABLE_PCB_RESET) | \ - RF2G_RF2G2_SPARE_SET(RF2G_RF2G2_SPARE_RESET)) -#define RF2G_RF2G2_HW_MASK (32'h0) -#define RF2G_RF2G2_SW_MASK (32'h0 | \ - RF2G_RF2G2_PDCGLNA_MASK | \ - RF2G_RF2G2_PDCGLNABUF_MASK | \ - RF2G_RF2G2_PDCSLNA_MASK | \ - RF2G_RF2G2_PDDIV_MASK | \ - RF2G_RF2G2_PDPADRV_MASK | \ - RF2G_RF2G2_PDPAOUT_MASK | \ - RF2G_RF2G2_PDREGLNA_MASK | \ - RF2G_RF2G2_PDREGLO_MASK | \ - RF2G_RF2G2_PDRFGM_MASK | \ - RF2G_RF2G2_PDRXLO_MASK | \ - RF2G_RF2G2_PDTXLO_MASK | \ - RF2G_RF2G2_PDTXMIX_MASK | \ - RF2G_RF2G2_REGLNA_BYPASS_MASK | \ - RF2G_RF2G2_REGLO_BYPASS_MASK | \ - RF2G_RF2G2_ENABLE_PCB_MASK | \ - RF2G_RF2G2_SPARE_MASK) - -#define RF2G_REG_ADDRESS_MSB 2 - -#endif /* _RF2G_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf5G_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf5G_reg.h deleted file mode 100644 index 463529e9b62b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf5G_reg.h +++ /dev/null @@ -1,195 +0,0 @@ -#ifndef _RF5G_REG_REG_H_ -#define _RF5G_REG_REG_H_ - -#define RF5G_RF5G1_ADDRESS 0x00000000 -#define RF5G_RF5G1_OFFSET 0x00000000 -#define RF5G_RF5G1_PDTXLO5_MSB 31 -#define RF5G_RF5G1_PDTXLO5_LSB 31 -#define RF5G_RF5G1_PDTXLO5_MASK 0x80000000 -#define RF5G_RF5G1_PDTXLO5_GET(x) (((x) & RF5G_RF5G1_PDTXLO5_MASK) >> RF5G_RF5G1_PDTXLO5_LSB) -#define RF5G_RF5G1_PDTXLO5_SET(x) (((x) << RF5G_RF5G1_PDTXLO5_LSB) & RF5G_RF5G1_PDTXLO5_MASK) -#define RF5G_RF5G1_PDTXMIX5_MSB 30 -#define RF5G_RF5G1_PDTXMIX5_LSB 30 -#define RF5G_RF5G1_PDTXMIX5_MASK 0x40000000 -#define RF5G_RF5G1_PDTXMIX5_GET(x) (((x) & RF5G_RF5G1_PDTXMIX5_MASK) >> RF5G_RF5G1_PDTXMIX5_LSB) -#define RF5G_RF5G1_PDTXMIX5_SET(x) (((x) << RF5G_RF5G1_PDTXMIX5_LSB) & RF5G_RF5G1_PDTXMIX5_MASK) -#define RF5G_RF5G1_PDTXBUF5_MSB 29 -#define RF5G_RF5G1_PDTXBUF5_LSB 29 -#define RF5G_RF5G1_PDTXBUF5_MASK 0x20000000 -#define RF5G_RF5G1_PDTXBUF5_GET(x) (((x) & RF5G_RF5G1_PDTXBUF5_MASK) >> RF5G_RF5G1_PDTXBUF5_LSB) -#define RF5G_RF5G1_PDTXBUF5_SET(x) (((x) << RF5G_RF5G1_PDTXBUF5_LSB) & RF5G_RF5G1_PDTXBUF5_MASK) -#define RF5G_RF5G1_PDPADRV5_MSB 28 -#define RF5G_RF5G1_PDPADRV5_LSB 28 -#define RF5G_RF5G1_PDPADRV5_MASK 0x10000000 -#define RF5G_RF5G1_PDPADRV5_GET(x) (((x) & RF5G_RF5G1_PDPADRV5_MASK) >> RF5G_RF5G1_PDPADRV5_LSB) -#define RF5G_RF5G1_PDPADRV5_SET(x) (((x) << RF5G_RF5G1_PDPADRV5_LSB) & RF5G_RF5G1_PDPADRV5_MASK) -#define RF5G_RF5G1_PDPAOUT5_MSB 27 -#define RF5G_RF5G1_PDPAOUT5_LSB 27 -#define RF5G_RF5G1_PDPAOUT5_MASK 0x08000000 -#define RF5G_RF5G1_PDPAOUT5_GET(x) (((x) & RF5G_RF5G1_PDPAOUT5_MASK) >> RF5G_RF5G1_PDPAOUT5_LSB) -#define RF5G_RF5G1_PDPAOUT5_SET(x) (((x) << RF5G_RF5G1_PDPAOUT5_LSB) & RF5G_RF5G1_PDPAOUT5_MASK) -#define RF5G_RF5G1_TUNE_PADRV5_MSB 26 -#define RF5G_RF5G1_TUNE_PADRV5_LSB 24 -#define RF5G_RF5G1_TUNE_PADRV5_MASK 0x07000000 -#define RF5G_RF5G1_TUNE_PADRV5_GET(x) (((x) & RF5G_RF5G1_TUNE_PADRV5_MASK) >> RF5G_RF5G1_TUNE_PADRV5_LSB) -#define RF5G_RF5G1_TUNE_PADRV5_SET(x) (((x) << RF5G_RF5G1_TUNE_PADRV5_LSB) & RF5G_RF5G1_TUNE_PADRV5_MASK) -#define RF5G_RF5G1_PWDTXPKD_MSB 23 -#define RF5G_RF5G1_PWDTXPKD_LSB 21 -#define RF5G_RF5G1_PWDTXPKD_MASK 0x00e00000 -#define RF5G_RF5G1_PWDTXPKD_GET(x) (((x) & RF5G_RF5G1_PWDTXPKD_MASK) >> RF5G_RF5G1_PWDTXPKD_LSB) -#define RF5G_RF5G1_PWDTXPKD_SET(x) (((x) << RF5G_RF5G1_PWDTXPKD_LSB) & RF5G_RF5G1_PWDTXPKD_MASK) -#define RF5G_RF5G1_DB5_MSB 20 -#define RF5G_RF5G1_DB5_LSB 18 -#define RF5G_RF5G1_DB5_MASK 0x001c0000 -#define RF5G_RF5G1_DB5_GET(x) (((x) & RF5G_RF5G1_DB5_MASK) >> RF5G_RF5G1_DB5_LSB) -#define RF5G_RF5G1_DB5_SET(x) (((x) << RF5G_RF5G1_DB5_LSB) & RF5G_RF5G1_DB5_MASK) -#define RF5G_RF5G1_OB5_MSB 17 -#define RF5G_RF5G1_OB5_LSB 15 -#define RF5G_RF5G1_OB5_MASK 0x00038000 -#define RF5G_RF5G1_OB5_GET(x) (((x) & RF5G_RF5G1_OB5_MASK) >> RF5G_RF5G1_OB5_LSB) -#define RF5G_RF5G1_OB5_SET(x) (((x) << RF5G_RF5G1_OB5_LSB) & RF5G_RF5G1_OB5_MASK) -#define RF5G_RF5G1_TX5_ATB_SEL_MSB 14 -#define RF5G_RF5G1_TX5_ATB_SEL_LSB 12 -#define RF5G_RF5G1_TX5_ATB_SEL_MASK 0x00007000 -#define RF5G_RF5G1_TX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_TX5_ATB_SEL_MASK) >> RF5G_RF5G1_TX5_ATB_SEL_LSB) -#define RF5G_RF5G1_TX5_ATB_SEL_SET(x) (((x) << RF5G_RF5G1_TX5_ATB_SEL_LSB) & RF5G_RF5G1_TX5_ATB_SEL_MASK) -#define RF5G_RF5G1_PDLO5DIV_MSB 11 -#define RF5G_RF5G1_PDLO5DIV_LSB 11 -#define RF5G_RF5G1_PDLO5DIV_MASK 0x00000800 -#define RF5G_RF5G1_PDLO5DIV_GET(x) (((x) & RF5G_RF5G1_PDLO5DIV_MASK) >> RF5G_RF5G1_PDLO5DIV_LSB) -#define RF5G_RF5G1_PDLO5DIV_SET(x) (((x) << RF5G_RF5G1_PDLO5DIV_LSB) & RF5G_RF5G1_PDLO5DIV_MASK) -#define RF5G_RF5G1_PDLO5MIX_MSB 10 -#define RF5G_RF5G1_PDLO5MIX_LSB 10 -#define RF5G_RF5G1_PDLO5MIX_MASK 0x00000400 -#define RF5G_RF5G1_PDLO5MIX_GET(x) (((x) & RF5G_RF5G1_PDLO5MIX_MASK) >> RF5G_RF5G1_PDLO5MIX_LSB) -#define RF5G_RF5G1_PDLO5MIX_SET(x) (((x) << RF5G_RF5G1_PDLO5MIX_LSB) & RF5G_RF5G1_PDLO5MIX_MASK) -#define RF5G_RF5G1_PDQBUF5_MSB 9 -#define RF5G_RF5G1_PDQBUF5_LSB 9 -#define RF5G_RF5G1_PDQBUF5_MASK 0x00000200 -#define RF5G_RF5G1_PDQBUF5_GET(x) (((x) & RF5G_RF5G1_PDQBUF5_MASK) >> RF5G_RF5G1_PDQBUF5_LSB) -#define RF5G_RF5G1_PDQBUF5_SET(x) (((x) << RF5G_RF5G1_PDQBUF5_LSB) & RF5G_RF5G1_PDQBUF5_MASK) -#define RF5G_RF5G1_PDLO5AGC_MSB 8 -#define RF5G_RF5G1_PDLO5AGC_LSB 8 -#define RF5G_RF5G1_PDLO5AGC_MASK 0x00000100 -#define RF5G_RF5G1_PDLO5AGC_GET(x) (((x) & RF5G_RF5G1_PDLO5AGC_MASK) >> RF5G_RF5G1_PDLO5AGC_LSB) -#define RF5G_RF5G1_PDLO5AGC_SET(x) (((x) << RF5G_RF5G1_PDLO5AGC_LSB) & RF5G_RF5G1_PDLO5AGC_MASK) -#define RF5G_RF5G1_PDREGLO5_MSB 7 -#define RF5G_RF5G1_PDREGLO5_LSB 7 -#define RF5G_RF5G1_PDREGLO5_MASK 0x00000080 -#define RF5G_RF5G1_PDREGLO5_GET(x) (((x) & RF5G_RF5G1_PDREGLO5_MASK) >> RF5G_RF5G1_PDREGLO5_LSB) -#define RF5G_RF5G1_PDREGLO5_SET(x) (((x) << RF5G_RF5G1_PDREGLO5_LSB) & RF5G_RF5G1_PDREGLO5_MASK) -#define RF5G_RF5G1_LO5_ATB_SEL_MSB 6 -#define RF5G_RF5G1_LO5_ATB_SEL_LSB 4 -#define RF5G_RF5G1_LO5_ATB_SEL_MASK 0x00000070 -#define RF5G_RF5G1_LO5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_LO5_ATB_SEL_MASK) >> RF5G_RF5G1_LO5_ATB_SEL_LSB) -#define RF5G_RF5G1_LO5_ATB_SEL_SET(x) (((x) << RF5G_RF5G1_LO5_ATB_SEL_LSB) & RF5G_RF5G1_LO5_ATB_SEL_MASK) -#define RF5G_RF5G1_LO5CONTROL_MSB 3 -#define RF5G_RF5G1_LO5CONTROL_LSB 3 -#define RF5G_RF5G1_LO5CONTROL_MASK 0x00000008 -#define RF5G_RF5G1_LO5CONTROL_GET(x) (((x) & RF5G_RF5G1_LO5CONTROL_MASK) >> RF5G_RF5G1_LO5CONTROL_LSB) -#define RF5G_RF5G1_LO5CONTROL_SET(x) (((x) << RF5G_RF5G1_LO5CONTROL_LSB) & RF5G_RF5G1_LO5CONTROL_MASK) -#define RF5G_RF5G1_REGLO_BYPASS5_MSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_LSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_MASK 0x00000004 -#define RF5G_RF5G1_REGLO_BYPASS5_GET(x) (((x) & RF5G_RF5G1_REGLO_BYPASS5_MASK) >> RF5G_RF5G1_REGLO_BYPASS5_LSB) -#define RF5G_RF5G1_REGLO_BYPASS5_SET(x) (((x) << RF5G_RF5G1_REGLO_BYPASS5_LSB) & RF5G_RF5G1_REGLO_BYPASS5_MASK) -#define RF5G_RF5G1_SPARE_MSB 1 -#define RF5G_RF5G1_SPARE_LSB 0 -#define RF5G_RF5G1_SPARE_MASK 0x00000003 -#define RF5G_RF5G1_SPARE_GET(x) (((x) & RF5G_RF5G1_SPARE_MASK) >> RF5G_RF5G1_SPARE_LSB) -#define RF5G_RF5G1_SPARE_SET(x) (((x) << RF5G_RF5G1_SPARE_LSB) & RF5G_RF5G1_SPARE_MASK) - -#define RF5G_RF5G2_ADDRESS 0x00000004 -#define RF5G_RF5G2_OFFSET 0x00000004 -#define RF5G_RF5G2_AGCLO_B_MSB 31 -#define RF5G_RF5G2_AGCLO_B_LSB 29 -#define RF5G_RF5G2_AGCLO_B_MASK 0xe0000000 -#define RF5G_RF5G2_AGCLO_B_GET(x) (((x) & RF5G_RF5G2_AGCLO_B_MASK) >> RF5G_RF5G2_AGCLO_B_LSB) -#define RF5G_RF5G2_AGCLO_B_SET(x) (((x) << RF5G_RF5G2_AGCLO_B_LSB) & RF5G_RF5G2_AGCLO_B_MASK) -#define RF5G_RF5G2_RX5_ATB_SEL_MSB 28 -#define RF5G_RF5G2_RX5_ATB_SEL_LSB 26 -#define RF5G_RF5G2_RX5_ATB_SEL_MASK 0x1c000000 -#define RF5G_RF5G2_RX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G2_RX5_ATB_SEL_MASK) >> RF5G_RF5G2_RX5_ATB_SEL_LSB) -#define RF5G_RF5G2_RX5_ATB_SEL_SET(x) (((x) << RF5G_RF5G2_RX5_ATB_SEL_LSB) & RF5G_RF5G2_RX5_ATB_SEL_MASK) -#define RF5G_RF5G2_PDCMOSLO5_MSB 25 -#define RF5G_RF5G2_PDCMOSLO5_LSB 25 -#define RF5G_RF5G2_PDCMOSLO5_MASK 0x02000000 -#define RF5G_RF5G2_PDCMOSLO5_GET(x) (((x) & RF5G_RF5G2_PDCMOSLO5_MASK) >> RF5G_RF5G2_PDCMOSLO5_LSB) -#define RF5G_RF5G2_PDCMOSLO5_SET(x) (((x) << RF5G_RF5G2_PDCMOSLO5_LSB) & RF5G_RF5G2_PDCMOSLO5_MASK) -#define RF5G_RF5G2_PDVGM5_MSB 24 -#define RF5G_RF5G2_PDVGM5_LSB 24 -#define RF5G_RF5G2_PDVGM5_MASK 0x01000000 -#define RF5G_RF5G2_PDVGM5_GET(x) (((x) & RF5G_RF5G2_PDVGM5_MASK) >> RF5G_RF5G2_PDVGM5_LSB) -#define RF5G_RF5G2_PDVGM5_SET(x) (((x) << RF5G_RF5G2_PDVGM5_LSB) & RF5G_RF5G2_PDVGM5_MASK) -#define RF5G_RF5G2_PDCSLNA5_MSB 23 -#define RF5G_RF5G2_PDCSLNA5_LSB 23 -#define RF5G_RF5G2_PDCSLNA5_MASK 0x00800000 -#define RF5G_RF5G2_PDCSLNA5_GET(x) (((x) & RF5G_RF5G2_PDCSLNA5_MASK) >> RF5G_RF5G2_PDCSLNA5_LSB) -#define RF5G_RF5G2_PDCSLNA5_SET(x) (((x) << RF5G_RF5G2_PDCSLNA5_LSB) & RF5G_RF5G2_PDCSLNA5_MASK) -#define RF5G_RF5G2_PDRFVGA5_MSB 22 -#define RF5G_RF5G2_PDRFVGA5_LSB 22 -#define RF5G_RF5G2_PDRFVGA5_MASK 0x00400000 -#define RF5G_RF5G2_PDRFVGA5_GET(x) (((x) & RF5G_RF5G2_PDRFVGA5_MASK) >> RF5G_RF5G2_PDRFVGA5_LSB) -#define RF5G_RF5G2_PDRFVGA5_SET(x) (((x) << RF5G_RF5G2_PDRFVGA5_LSB) & RF5G_RF5G2_PDRFVGA5_MASK) -#define RF5G_RF5G2_PDREGFE5_MSB 21 -#define RF5G_RF5G2_PDREGFE5_LSB 21 -#define RF5G_RF5G2_PDREGFE5_MASK 0x00200000 -#define RF5G_RF5G2_PDREGFE5_GET(x) (((x) & RF5G_RF5G2_PDREGFE5_MASK) >> RF5G_RF5G2_PDREGFE5_LSB) -#define RF5G_RF5G2_PDREGFE5_SET(x) (((x) << RF5G_RF5G2_PDREGFE5_LSB) & RF5G_RF5G2_PDREGFE5_MASK) -#define RF5G_RF5G2_TUNE_RFVGA5_MSB 20 -#define RF5G_RF5G2_TUNE_RFVGA5_LSB 18 -#define RF5G_RF5G2_TUNE_RFVGA5_MASK 0x001c0000 -#define RF5G_RF5G2_TUNE_RFVGA5_GET(x) (((x) & RF5G_RF5G2_TUNE_RFVGA5_MASK) >> RF5G_RF5G2_TUNE_RFVGA5_LSB) -#define RF5G_RF5G2_TUNE_RFVGA5_SET(x) (((x) << RF5G_RF5G2_TUNE_RFVGA5_LSB) & RF5G_RF5G2_TUNE_RFVGA5_MASK) -#define RF5G_RF5G2_BRFVGA5_MSB 17 -#define RF5G_RF5G2_BRFVGA5_LSB 15 -#define RF5G_RF5G2_BRFVGA5_MASK 0x00038000 -#define RF5G_RF5G2_BRFVGA5_GET(x) (((x) & RF5G_RF5G2_BRFVGA5_MASK) >> RF5G_RF5G2_BRFVGA5_LSB) -#define RF5G_RF5G2_BRFVGA5_SET(x) (((x) << RF5G_RF5G2_BRFVGA5_LSB) & RF5G_RF5G2_BRFVGA5_MASK) -#define RF5G_RF5G2_BCSLNA5_MSB 14 -#define RF5G_RF5G2_BCSLNA5_LSB 12 -#define RF5G_RF5G2_BCSLNA5_MASK 0x00007000 -#define RF5G_RF5G2_BCSLNA5_GET(x) (((x) & RF5G_RF5G2_BCSLNA5_MASK) >> RF5G_RF5G2_BCSLNA5_LSB) -#define RF5G_RF5G2_BCSLNA5_SET(x) (((x) << RF5G_RF5G2_BCSLNA5_LSB) & RF5G_RF5G2_BCSLNA5_MASK) -#define RF5G_RF5G2_BVGM5_MSB 11 -#define RF5G_RF5G2_BVGM5_LSB 9 -#define RF5G_RF5G2_BVGM5_MASK 0x00000e00 -#define RF5G_RF5G2_BVGM5_GET(x) (((x) & RF5G_RF5G2_BVGM5_MASK) >> RF5G_RF5G2_BVGM5_LSB) -#define RF5G_RF5G2_BVGM5_SET(x) (((x) << RF5G_RF5G2_BVGM5_LSB) & RF5G_RF5G2_BVGM5_MASK) -#define RF5G_RF5G2_REGFE_BYPASS5_MSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_LSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_MASK 0x00000100 -#define RF5G_RF5G2_REGFE_BYPASS5_GET(x) (((x) & RF5G_RF5G2_REGFE_BYPASS5_MASK) >> RF5G_RF5G2_REGFE_BYPASS5_LSB) -#define RF5G_RF5G2_REGFE_BYPASS5_SET(x) (((x) << RF5G_RF5G2_REGFE_BYPASS5_LSB) & RF5G_RF5G2_REGFE_BYPASS5_MASK) -#define RF5G_RF5G2_LNA5_ATTENMODE_MSB 7 -#define RF5G_RF5G2_LNA5_ATTENMODE_LSB 6 -#define RF5G_RF5G2_LNA5_ATTENMODE_MASK 0x000000c0 -#define RF5G_RF5G2_LNA5_ATTENMODE_GET(x) (((x) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) >> RF5G_RF5G2_LNA5_ATTENMODE_LSB) -#define RF5G_RF5G2_LNA5_ATTENMODE_SET(x) (((x) << RF5G_RF5G2_LNA5_ATTENMODE_LSB) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) -#define RF5G_RF5G2_ENABLE_PCA_MSB 5 -#define RF5G_RF5G2_ENABLE_PCA_LSB 5 -#define RF5G_RF5G2_ENABLE_PCA_MASK 0x00000020 -#define RF5G_RF5G2_ENABLE_PCA_GET(x) (((x) & RF5G_RF5G2_ENABLE_PCA_MASK) >> RF5G_RF5G2_ENABLE_PCA_LSB) -#define RF5G_RF5G2_ENABLE_PCA_SET(x) (((x) << RF5G_RF5G2_ENABLE_PCA_LSB) & RF5G_RF5G2_ENABLE_PCA_MASK) -#define RF5G_RF5G2_TUNE_LO_MSB 4 -#define RF5G_RF5G2_TUNE_LO_LSB 2 -#define RF5G_RF5G2_TUNE_LO_MASK 0x0000001c -#define RF5G_RF5G2_TUNE_LO_GET(x) (((x) & RF5G_RF5G2_TUNE_LO_MASK) >> RF5G_RF5G2_TUNE_LO_LSB) -#define RF5G_RF5G2_TUNE_LO_SET(x) (((x) << RF5G_RF5G2_TUNE_LO_LSB) & RF5G_RF5G2_TUNE_LO_MASK) -#define RF5G_RF5G2_SPARE_MSB 1 -#define RF5G_RF5G2_SPARE_LSB 0 -#define RF5G_RF5G2_SPARE_MASK 0x00000003 -#define RF5G_RF5G2_SPARE_GET(x) (((x) & RF5G_RF5G2_SPARE_MASK) >> RF5G_RF5G2_SPARE_LSB) -#define RF5G_RF5G2_SPARE_SET(x) (((x) << RF5G_RF5G2_SPARE_LSB) & RF5G_RF5G2_SPARE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct rf5g_reg_reg_s { - volatile unsigned int rf5g_rf5g1; - volatile unsigned int rf5g_rf5g2; -} rf5g_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _RF5G_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf5G_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf5G_reg.vrh deleted file mode 100644 index 6627936f3063..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rf5G_reg.vrh +++ /dev/null @@ -1,296 +0,0 @@ -#ifndef _RF5G_REG_VRH_ -#define _RF5G_REG_VRH_ - -#define RF5G_RF5G1_ADDRESS 'h00000000 -#define RF5G_RF5G1_PDTXLO5_MSB 31 -#define RF5G_RF5G1_PDTXLO5_LSB 31 -#define RF5G_RF5G1_PDTXLO5_MASK 'h80000000 -#define RF5G_RF5G1_PDTXLO5_GET(x) (((x) & RF5G_RF5G1_PDTXLO5_MASK) >> RF5G_RF5G1_PDTXLO5_LSB) -#define RF5G_RF5G1_PDTXLO5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDTXLO5_LSB) & RF5G_RF5G1_PDTXLO5_MASK) -#define RF5G_RF5G1_PDTXLO5_RESET 1'h0 -#define RF5G_RF5G1_PDTXMIX5_MSB 30 -#define RF5G_RF5G1_PDTXMIX5_LSB 30 -#define RF5G_RF5G1_PDTXMIX5_MASK 'h40000000 -#define RF5G_RF5G1_PDTXMIX5_GET(x) (((x) & RF5G_RF5G1_PDTXMIX5_MASK) >> RF5G_RF5G1_PDTXMIX5_LSB) -#define RF5G_RF5G1_PDTXMIX5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDTXMIX5_LSB) & RF5G_RF5G1_PDTXMIX5_MASK) -#define RF5G_RF5G1_PDTXMIX5_RESET 1'h0 -#define RF5G_RF5G1_PDTXBUF5_MSB 29 -#define RF5G_RF5G1_PDTXBUF5_LSB 29 -#define RF5G_RF5G1_PDTXBUF5_MASK 'h20000000 -#define RF5G_RF5G1_PDTXBUF5_GET(x) (((x) & RF5G_RF5G1_PDTXBUF5_MASK) >> RF5G_RF5G1_PDTXBUF5_LSB) -#define RF5G_RF5G1_PDTXBUF5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDTXBUF5_LSB) & RF5G_RF5G1_PDTXBUF5_MASK) -#define RF5G_RF5G1_PDTXBUF5_RESET 1'h0 -#define RF5G_RF5G1_PDPADRV5_MSB 28 -#define RF5G_RF5G1_PDPADRV5_LSB 28 -#define RF5G_RF5G1_PDPADRV5_MASK 'h10000000 -#define RF5G_RF5G1_PDPADRV5_GET(x) (((x) & RF5G_RF5G1_PDPADRV5_MASK) >> RF5G_RF5G1_PDPADRV5_LSB) -#define RF5G_RF5G1_PDPADRV5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDPADRV5_LSB) & RF5G_RF5G1_PDPADRV5_MASK) -#define RF5G_RF5G1_PDPADRV5_RESET 1'h0 -#define RF5G_RF5G1_PDPAOUT5_MSB 27 -#define RF5G_RF5G1_PDPAOUT5_LSB 27 -#define RF5G_RF5G1_PDPAOUT5_MASK 'h08000000 -#define RF5G_RF5G1_PDPAOUT5_GET(x) (((x) & RF5G_RF5G1_PDPAOUT5_MASK) >> RF5G_RF5G1_PDPAOUT5_LSB) -#define RF5G_RF5G1_PDPAOUT5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDPAOUT5_LSB) & RF5G_RF5G1_PDPAOUT5_MASK) -#define RF5G_RF5G1_PDPAOUT5_RESET 1'h0 -#define RF5G_RF5G1_TUNE_PADRV5_MSB 26 -#define RF5G_RF5G1_TUNE_PADRV5_LSB 24 -#define RF5G_RF5G1_TUNE_PADRV5_MASK 'h07000000 -#define RF5G_RF5G1_TUNE_PADRV5_GET(x) (((x) & RF5G_RF5G1_TUNE_PADRV5_MASK) >> RF5G_RF5G1_TUNE_PADRV5_LSB) -#define RF5G_RF5G1_TUNE_PADRV5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_TUNE_PADRV5_LSB) & RF5G_RF5G1_TUNE_PADRV5_MASK) -#define RF5G_RF5G1_TUNE_PADRV5_RESET 3'h0 -#define RF5G_RF5G1_PWDTXPKD_MSB 23 -#define RF5G_RF5G1_PWDTXPKD_LSB 21 -#define RF5G_RF5G1_PWDTXPKD_MASK 'h00e00000 -#define RF5G_RF5G1_PWDTXPKD_GET(x) (((x) & RF5G_RF5G1_PWDTXPKD_MASK) >> RF5G_RF5G1_PWDTXPKD_LSB) -#define RF5G_RF5G1_PWDTXPKD_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PWDTXPKD_LSB) & RF5G_RF5G1_PWDTXPKD_MASK) -#define RF5G_RF5G1_PWDTXPKD_RESET 3'h7 -#define RF5G_RF5G1_DB5_MSB 20 -#define RF5G_RF5G1_DB5_LSB 18 -#define RF5G_RF5G1_DB5_MASK 'h001c0000 -#define RF5G_RF5G1_DB5_GET(x) (((x) & RF5G_RF5G1_DB5_MASK) >> RF5G_RF5G1_DB5_LSB) -#define RF5G_RF5G1_DB5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_DB5_LSB) & RF5G_RF5G1_DB5_MASK) -#define RF5G_RF5G1_DB5_RESET 3'h4 -#define RF5G_RF5G1_OB5_MSB 17 -#define RF5G_RF5G1_OB5_LSB 15 -#define RF5G_RF5G1_OB5_MASK 'h00038000 -#define RF5G_RF5G1_OB5_GET(x) (((x) & RF5G_RF5G1_OB5_MASK) >> RF5G_RF5G1_OB5_LSB) -#define RF5G_RF5G1_OB5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_OB5_LSB) & RF5G_RF5G1_OB5_MASK) -#define RF5G_RF5G1_OB5_RESET 3'h4 -#define RF5G_RF5G1_TX5_ATB_SEL_MSB 14 -#define RF5G_RF5G1_TX5_ATB_SEL_LSB 12 -#define RF5G_RF5G1_TX5_ATB_SEL_MASK 'h00007000 -#define RF5G_RF5G1_TX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_TX5_ATB_SEL_MASK) >> RF5G_RF5G1_TX5_ATB_SEL_LSB) -#define RF5G_RF5G1_TX5_ATB_SEL_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_TX5_ATB_SEL_LSB) & RF5G_RF5G1_TX5_ATB_SEL_MASK) -#define RF5G_RF5G1_TX5_ATB_SEL_RESET 3'h0 -#define RF5G_RF5G1_PDLO5DIV_MSB 11 -#define RF5G_RF5G1_PDLO5DIV_LSB 11 -#define RF5G_RF5G1_PDLO5DIV_MASK 'h00000800 -#define RF5G_RF5G1_PDLO5DIV_GET(x) (((x) & RF5G_RF5G1_PDLO5DIV_MASK) >> RF5G_RF5G1_PDLO5DIV_LSB) -#define RF5G_RF5G1_PDLO5DIV_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDLO5DIV_LSB) & RF5G_RF5G1_PDLO5DIV_MASK) -#define RF5G_RF5G1_PDLO5DIV_RESET 1'h0 -#define RF5G_RF5G1_PDLO5MIX_MSB 10 -#define RF5G_RF5G1_PDLO5MIX_LSB 10 -#define RF5G_RF5G1_PDLO5MIX_MASK 'h00000400 -#define RF5G_RF5G1_PDLO5MIX_GET(x) (((x) & RF5G_RF5G1_PDLO5MIX_MASK) >> RF5G_RF5G1_PDLO5MIX_LSB) -#define RF5G_RF5G1_PDLO5MIX_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDLO5MIX_LSB) & RF5G_RF5G1_PDLO5MIX_MASK) -#define RF5G_RF5G1_PDLO5MIX_RESET 1'h0 -#define RF5G_RF5G1_PDQBUF5_MSB 9 -#define RF5G_RF5G1_PDQBUF5_LSB 9 -#define RF5G_RF5G1_PDQBUF5_MASK 'h00000200 -#define RF5G_RF5G1_PDQBUF5_GET(x) (((x) & RF5G_RF5G1_PDQBUF5_MASK) >> RF5G_RF5G1_PDQBUF5_LSB) -#define RF5G_RF5G1_PDQBUF5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDQBUF5_LSB) & RF5G_RF5G1_PDQBUF5_MASK) -#define RF5G_RF5G1_PDQBUF5_RESET 1'h0 -#define RF5G_RF5G1_PDLO5AGC_MSB 8 -#define RF5G_RF5G1_PDLO5AGC_LSB 8 -#define RF5G_RF5G1_PDLO5AGC_MASK 'h00000100 -#define RF5G_RF5G1_PDLO5AGC_GET(x) (((x) & RF5G_RF5G1_PDLO5AGC_MASK) >> RF5G_RF5G1_PDLO5AGC_LSB) -#define RF5G_RF5G1_PDLO5AGC_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDLO5AGC_LSB) & RF5G_RF5G1_PDLO5AGC_MASK) -#define RF5G_RF5G1_PDLO5AGC_RESET 1'h0 -#define RF5G_RF5G1_PDREGLO5_MSB 7 -#define RF5G_RF5G1_PDREGLO5_LSB 7 -#define RF5G_RF5G1_PDREGLO5_MASK 'h00000080 -#define RF5G_RF5G1_PDREGLO5_GET(x) (((x) & RF5G_RF5G1_PDREGLO5_MASK) >> RF5G_RF5G1_PDREGLO5_LSB) -#define RF5G_RF5G1_PDREGLO5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_PDREGLO5_LSB) & RF5G_RF5G1_PDREGLO5_MASK) -#define RF5G_RF5G1_PDREGLO5_RESET 1'h0 -#define RF5G_RF5G1_LO5_ATB_SEL_MSB 6 -#define RF5G_RF5G1_LO5_ATB_SEL_LSB 4 -#define RF5G_RF5G1_LO5_ATB_SEL_MASK 'h00000070 -#define RF5G_RF5G1_LO5_ATB_SEL_GET(x) (((x) & RF5G_RF5G1_LO5_ATB_SEL_MASK) >> RF5G_RF5G1_LO5_ATB_SEL_LSB) -#define RF5G_RF5G1_LO5_ATB_SEL_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_LO5_ATB_SEL_LSB) & RF5G_RF5G1_LO5_ATB_SEL_MASK) -#define RF5G_RF5G1_LO5_ATB_SEL_RESET 3'h0 -#define RF5G_RF5G1_LO5CONTROL_MSB 3 -#define RF5G_RF5G1_LO5CONTROL_LSB 3 -#define RF5G_RF5G1_LO5CONTROL_MASK 'h00000008 -#define RF5G_RF5G1_LO5CONTROL_GET(x) (((x) & RF5G_RF5G1_LO5CONTROL_MASK) >> RF5G_RF5G1_LO5CONTROL_LSB) -#define RF5G_RF5G1_LO5CONTROL_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_LO5CONTROL_LSB) & RF5G_RF5G1_LO5CONTROL_MASK) -#define RF5G_RF5G1_LO5CONTROL_RESET 1'h0 -#define RF5G_RF5G1_REGLO_BYPASS5_MSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_LSB 2 -#define RF5G_RF5G1_REGLO_BYPASS5_MASK 'h00000004 -#define RF5G_RF5G1_REGLO_BYPASS5_GET(x) (((x) & RF5G_RF5G1_REGLO_BYPASS5_MASK) >> RF5G_RF5G1_REGLO_BYPASS5_LSB) -#define RF5G_RF5G1_REGLO_BYPASS5_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_REGLO_BYPASS5_LSB) & RF5G_RF5G1_REGLO_BYPASS5_MASK) -#define RF5G_RF5G1_REGLO_BYPASS5_RESET 1'h0 -#define RF5G_RF5G1_SPARE_MSB 1 -#define RF5G_RF5G1_SPARE_LSB 0 -#define RF5G_RF5G1_SPARE_MASK 'h00000003 -#define RF5G_RF5G1_SPARE_GET(x) (((x) & RF5G_RF5G1_SPARE_MASK) >> RF5G_RF5G1_SPARE_LSB) -#define RF5G_RF5G1_SPARE_SET(x) (((32'd0 | (x)) << RF5G_RF5G1_SPARE_LSB) & RF5G_RF5G1_SPARE_MASK) -#define RF5G_RF5G1_SPARE_RESET 2'h0 -#define RF5G_RF5G1_RESET (32'h0 | \ - RF5G_RF5G1_PDTXLO5_SET(RF5G_RF5G1_PDTXLO5_RESET) | \ - RF5G_RF5G1_PDTXMIX5_SET(RF5G_RF5G1_PDTXMIX5_RESET) | \ - RF5G_RF5G1_PDTXBUF5_SET(RF5G_RF5G1_PDTXBUF5_RESET) | \ - RF5G_RF5G1_PDPADRV5_SET(RF5G_RF5G1_PDPADRV5_RESET) | \ - RF5G_RF5G1_PDPAOUT5_SET(RF5G_RF5G1_PDPAOUT5_RESET) | \ - RF5G_RF5G1_TUNE_PADRV5_SET(RF5G_RF5G1_TUNE_PADRV5_RESET) | \ - RF5G_RF5G1_PWDTXPKD_SET(RF5G_RF5G1_PWDTXPKD_RESET) | \ - RF5G_RF5G1_DB5_SET(RF5G_RF5G1_DB5_RESET) | \ - RF5G_RF5G1_OB5_SET(RF5G_RF5G1_OB5_RESET) | \ - RF5G_RF5G1_TX5_ATB_SEL_SET(RF5G_RF5G1_TX5_ATB_SEL_RESET) | \ - RF5G_RF5G1_PDLO5DIV_SET(RF5G_RF5G1_PDLO5DIV_RESET) | \ - RF5G_RF5G1_PDLO5MIX_SET(RF5G_RF5G1_PDLO5MIX_RESET) | \ - RF5G_RF5G1_PDQBUF5_SET(RF5G_RF5G1_PDQBUF5_RESET) | \ - RF5G_RF5G1_PDLO5AGC_SET(RF5G_RF5G1_PDLO5AGC_RESET) | \ - RF5G_RF5G1_PDREGLO5_SET(RF5G_RF5G1_PDREGLO5_RESET) | \ - RF5G_RF5G1_LO5_ATB_SEL_SET(RF5G_RF5G1_LO5_ATB_SEL_RESET) | \ - RF5G_RF5G1_LO5CONTROL_SET(RF5G_RF5G1_LO5CONTROL_RESET) | \ - RF5G_RF5G1_REGLO_BYPASS5_SET(RF5G_RF5G1_REGLO_BYPASS5_RESET) | \ - RF5G_RF5G1_SPARE_SET(RF5G_RF5G1_SPARE_RESET)) -#define RF5G_RF5G1_HW_MASK (32'h0) -#define RF5G_RF5G1_SW_MASK (32'h0 | \ - RF5G_RF5G1_PDTXLO5_MASK | \ - RF5G_RF5G1_PDTXMIX5_MASK | \ - RF5G_RF5G1_PDTXBUF5_MASK | \ - RF5G_RF5G1_PDPADRV5_MASK | \ - RF5G_RF5G1_PDPAOUT5_MASK | \ - RF5G_RF5G1_TUNE_PADRV5_MASK | \ - RF5G_RF5G1_PWDTXPKD_MASK | \ - RF5G_RF5G1_DB5_MASK | \ - RF5G_RF5G1_OB5_MASK | \ - RF5G_RF5G1_TX5_ATB_SEL_MASK | \ - RF5G_RF5G1_PDLO5DIV_MASK | \ - RF5G_RF5G1_PDLO5MIX_MASK | \ - RF5G_RF5G1_PDQBUF5_MASK | \ - RF5G_RF5G1_PDLO5AGC_MASK | \ - RF5G_RF5G1_PDREGLO5_MASK | \ - RF5G_RF5G1_LO5_ATB_SEL_MASK | \ - RF5G_RF5G1_LO5CONTROL_MASK | \ - RF5G_RF5G1_REGLO_BYPASS5_MASK | \ - RF5G_RF5G1_SPARE_MASK) - -#define RF5G_RF5G2_ADDRESS 'h00000004 -#define RF5G_RF5G2_AGCLO_B_MSB 31 -#define RF5G_RF5G2_AGCLO_B_LSB 29 -#define RF5G_RF5G2_AGCLO_B_MASK 'he0000000 -#define RF5G_RF5G2_AGCLO_B_GET(x) (((x) & RF5G_RF5G2_AGCLO_B_MASK) >> RF5G_RF5G2_AGCLO_B_LSB) -#define RF5G_RF5G2_AGCLO_B_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_AGCLO_B_LSB) & RF5G_RF5G2_AGCLO_B_MASK) -#define RF5G_RF5G2_AGCLO_B_RESET 3'h4 -#define RF5G_RF5G2_RX5_ATB_SEL_MSB 28 -#define RF5G_RF5G2_RX5_ATB_SEL_LSB 26 -#define RF5G_RF5G2_RX5_ATB_SEL_MASK 'h1c000000 -#define RF5G_RF5G2_RX5_ATB_SEL_GET(x) (((x) & RF5G_RF5G2_RX5_ATB_SEL_MASK) >> RF5G_RF5G2_RX5_ATB_SEL_LSB) -#define RF5G_RF5G2_RX5_ATB_SEL_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_RX5_ATB_SEL_LSB) & RF5G_RF5G2_RX5_ATB_SEL_MASK) -#define RF5G_RF5G2_RX5_ATB_SEL_RESET 3'h0 -#define RF5G_RF5G2_PDCMOSLO5_MSB 25 -#define RF5G_RF5G2_PDCMOSLO5_LSB 25 -#define RF5G_RF5G2_PDCMOSLO5_MASK 'h02000000 -#define RF5G_RF5G2_PDCMOSLO5_GET(x) (((x) & RF5G_RF5G2_PDCMOSLO5_MASK) >> RF5G_RF5G2_PDCMOSLO5_LSB) -#define RF5G_RF5G2_PDCMOSLO5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDCMOSLO5_LSB) & RF5G_RF5G2_PDCMOSLO5_MASK) -#define RF5G_RF5G2_PDCMOSLO5_RESET 1'h0 -#define RF5G_RF5G2_PDVGM5_MSB 24 -#define RF5G_RF5G2_PDVGM5_LSB 24 -#define RF5G_RF5G2_PDVGM5_MASK 'h01000000 -#define RF5G_RF5G2_PDVGM5_GET(x) (((x) & RF5G_RF5G2_PDVGM5_MASK) >> RF5G_RF5G2_PDVGM5_LSB) -#define RF5G_RF5G2_PDVGM5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDVGM5_LSB) & RF5G_RF5G2_PDVGM5_MASK) -#define RF5G_RF5G2_PDVGM5_RESET 1'h0 -#define RF5G_RF5G2_PDCSLNA5_MSB 23 -#define RF5G_RF5G2_PDCSLNA5_LSB 23 -#define RF5G_RF5G2_PDCSLNA5_MASK 'h00800000 -#define RF5G_RF5G2_PDCSLNA5_GET(x) (((x) & RF5G_RF5G2_PDCSLNA5_MASK) >> RF5G_RF5G2_PDCSLNA5_LSB) -#define RF5G_RF5G2_PDCSLNA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDCSLNA5_LSB) & RF5G_RF5G2_PDCSLNA5_MASK) -#define RF5G_RF5G2_PDCSLNA5_RESET 1'h0 -#define RF5G_RF5G2_PDRFVGA5_MSB 22 -#define RF5G_RF5G2_PDRFVGA5_LSB 22 -#define RF5G_RF5G2_PDRFVGA5_MASK 'h00400000 -#define RF5G_RF5G2_PDRFVGA5_GET(x) (((x) & RF5G_RF5G2_PDRFVGA5_MASK) >> RF5G_RF5G2_PDRFVGA5_LSB) -#define RF5G_RF5G2_PDRFVGA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDRFVGA5_LSB) & RF5G_RF5G2_PDRFVGA5_MASK) -#define RF5G_RF5G2_PDRFVGA5_RESET 1'h0 -#define RF5G_RF5G2_PDREGFE5_MSB 21 -#define RF5G_RF5G2_PDREGFE5_LSB 21 -#define RF5G_RF5G2_PDREGFE5_MASK 'h00200000 -#define RF5G_RF5G2_PDREGFE5_GET(x) (((x) & RF5G_RF5G2_PDREGFE5_MASK) >> RF5G_RF5G2_PDREGFE5_LSB) -#define RF5G_RF5G2_PDREGFE5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_PDREGFE5_LSB) & RF5G_RF5G2_PDREGFE5_MASK) -#define RF5G_RF5G2_PDREGFE5_RESET 1'h0 -#define RF5G_RF5G2_TUNE_RFVGA5_MSB 20 -#define RF5G_RF5G2_TUNE_RFVGA5_LSB 18 -#define RF5G_RF5G2_TUNE_RFVGA5_MASK 'h001c0000 -#define RF5G_RF5G2_TUNE_RFVGA5_GET(x) (((x) & RF5G_RF5G2_TUNE_RFVGA5_MASK) >> RF5G_RF5G2_TUNE_RFVGA5_LSB) -#define RF5G_RF5G2_TUNE_RFVGA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_TUNE_RFVGA5_LSB) & RF5G_RF5G2_TUNE_RFVGA5_MASK) -#define RF5G_RF5G2_TUNE_RFVGA5_RESET 3'h0 -#define RF5G_RF5G2_BRFVGA5_MSB 17 -#define RF5G_RF5G2_BRFVGA5_LSB 15 -#define RF5G_RF5G2_BRFVGA5_MASK 'h00038000 -#define RF5G_RF5G2_BRFVGA5_GET(x) (((x) & RF5G_RF5G2_BRFVGA5_MASK) >> RF5G_RF5G2_BRFVGA5_LSB) -#define RF5G_RF5G2_BRFVGA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_BRFVGA5_LSB) & RF5G_RF5G2_BRFVGA5_MASK) -#define RF5G_RF5G2_BRFVGA5_RESET 3'h5 -#define RF5G_RF5G2_BCSLNA5_MSB 14 -#define RF5G_RF5G2_BCSLNA5_LSB 12 -#define RF5G_RF5G2_BCSLNA5_MASK 'h00007000 -#define RF5G_RF5G2_BCSLNA5_GET(x) (((x) & RF5G_RF5G2_BCSLNA5_MASK) >> RF5G_RF5G2_BCSLNA5_LSB) -#define RF5G_RF5G2_BCSLNA5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_BCSLNA5_LSB) & RF5G_RF5G2_BCSLNA5_MASK) -#define RF5G_RF5G2_BCSLNA5_RESET 3'h3 -#define RF5G_RF5G2_BVGM5_MSB 11 -#define RF5G_RF5G2_BVGM5_LSB 9 -#define RF5G_RF5G2_BVGM5_MASK 'h00000e00 -#define RF5G_RF5G2_BVGM5_GET(x) (((x) & RF5G_RF5G2_BVGM5_MASK) >> RF5G_RF5G2_BVGM5_LSB) -#define RF5G_RF5G2_BVGM5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_BVGM5_LSB) & RF5G_RF5G2_BVGM5_MASK) -#define RF5G_RF5G2_BVGM5_RESET 3'h1 -#define RF5G_RF5G2_REGFE_BYPASS5_MSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_LSB 8 -#define RF5G_RF5G2_REGFE_BYPASS5_MASK 'h00000100 -#define RF5G_RF5G2_REGFE_BYPASS5_GET(x) (((x) & RF5G_RF5G2_REGFE_BYPASS5_MASK) >> RF5G_RF5G2_REGFE_BYPASS5_LSB) -#define RF5G_RF5G2_REGFE_BYPASS5_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_REGFE_BYPASS5_LSB) & RF5G_RF5G2_REGFE_BYPASS5_MASK) -#define RF5G_RF5G2_REGFE_BYPASS5_RESET 1'h0 -#define RF5G_RF5G2_LNA5_ATTENMODE_MSB 7 -#define RF5G_RF5G2_LNA5_ATTENMODE_LSB 6 -#define RF5G_RF5G2_LNA5_ATTENMODE_MASK 'h000000c0 -#define RF5G_RF5G2_LNA5_ATTENMODE_GET(x) (((x) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) >> RF5G_RF5G2_LNA5_ATTENMODE_LSB) -#define RF5G_RF5G2_LNA5_ATTENMODE_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_LNA5_ATTENMODE_LSB) & RF5G_RF5G2_LNA5_ATTENMODE_MASK) -#define RF5G_RF5G2_LNA5_ATTENMODE_RESET 2'h0 -#define RF5G_RF5G2_ENABLE_PCA_MSB 5 -#define RF5G_RF5G2_ENABLE_PCA_LSB 5 -#define RF5G_RF5G2_ENABLE_PCA_MASK 'h00000020 -#define RF5G_RF5G2_ENABLE_PCA_GET(x) (((x) & RF5G_RF5G2_ENABLE_PCA_MASK) >> RF5G_RF5G2_ENABLE_PCA_LSB) -#define RF5G_RF5G2_ENABLE_PCA_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_ENABLE_PCA_LSB) & RF5G_RF5G2_ENABLE_PCA_MASK) -#define RF5G_RF5G2_ENABLE_PCA_RESET 1'h0 -#define RF5G_RF5G2_TUNE_LO_MSB 4 -#define RF5G_RF5G2_TUNE_LO_LSB 2 -#define RF5G_RF5G2_TUNE_LO_MASK 'h0000001c -#define RF5G_RF5G2_TUNE_LO_GET(x) (((x) & RF5G_RF5G2_TUNE_LO_MASK) >> RF5G_RF5G2_TUNE_LO_LSB) -#define RF5G_RF5G2_TUNE_LO_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_TUNE_LO_LSB) & RF5G_RF5G2_TUNE_LO_MASK) -#define RF5G_RF5G2_TUNE_LO_RESET 3'h0 -#define RF5G_RF5G2_SPARE_MSB 1 -#define RF5G_RF5G2_SPARE_LSB 0 -#define RF5G_RF5G2_SPARE_MASK 'h00000003 -#define RF5G_RF5G2_SPARE_GET(x) (((x) & RF5G_RF5G2_SPARE_MASK) >> RF5G_RF5G2_SPARE_LSB) -#define RF5G_RF5G2_SPARE_SET(x) (((32'd0 | (x)) << RF5G_RF5G2_SPARE_LSB) & RF5G_RF5G2_SPARE_MASK) -#define RF5G_RF5G2_SPARE_RESET 2'h0 -#define RF5G_RF5G2_RESET (32'h0 | \ - RF5G_RF5G2_AGCLO_B_SET(RF5G_RF5G2_AGCLO_B_RESET) | \ - RF5G_RF5G2_RX5_ATB_SEL_SET(RF5G_RF5G2_RX5_ATB_SEL_RESET) | \ - RF5G_RF5G2_PDCMOSLO5_SET(RF5G_RF5G2_PDCMOSLO5_RESET) | \ - RF5G_RF5G2_PDVGM5_SET(RF5G_RF5G2_PDVGM5_RESET) | \ - RF5G_RF5G2_PDCSLNA5_SET(RF5G_RF5G2_PDCSLNA5_RESET) | \ - RF5G_RF5G2_PDRFVGA5_SET(RF5G_RF5G2_PDRFVGA5_RESET) | \ - RF5G_RF5G2_PDREGFE5_SET(RF5G_RF5G2_PDREGFE5_RESET) | \ - RF5G_RF5G2_TUNE_RFVGA5_SET(RF5G_RF5G2_TUNE_RFVGA5_RESET) | \ - RF5G_RF5G2_BRFVGA5_SET(RF5G_RF5G2_BRFVGA5_RESET) | \ - RF5G_RF5G2_BCSLNA5_SET(RF5G_RF5G2_BCSLNA5_RESET) | \ - RF5G_RF5G2_BVGM5_SET(RF5G_RF5G2_BVGM5_RESET) | \ - RF5G_RF5G2_REGFE_BYPASS5_SET(RF5G_RF5G2_REGFE_BYPASS5_RESET) | \ - RF5G_RF5G2_LNA5_ATTENMODE_SET(RF5G_RF5G2_LNA5_ATTENMODE_RESET) | \ - RF5G_RF5G2_ENABLE_PCA_SET(RF5G_RF5G2_ENABLE_PCA_RESET) | \ - RF5G_RF5G2_TUNE_LO_SET(RF5G_RF5G2_TUNE_LO_RESET) | \ - RF5G_RF5G2_SPARE_SET(RF5G_RF5G2_SPARE_RESET)) -#define RF5G_RF5G2_HW_MASK (32'h0) -#define RF5G_RF5G2_SW_MASK (32'h0 | \ - RF5G_RF5G2_AGCLO_B_MASK | \ - RF5G_RF5G2_RX5_ATB_SEL_MASK | \ - RF5G_RF5G2_PDCMOSLO5_MASK | \ - RF5G_RF5G2_PDVGM5_MASK | \ - RF5G_RF5G2_PDCSLNA5_MASK | \ - RF5G_RF5G2_PDRFVGA5_MASK | \ - RF5G_RF5G2_PDREGFE5_MASK | \ - RF5G_RF5G2_TUNE_RFVGA5_MASK | \ - RF5G_RF5G2_BRFVGA5_MASK | \ - RF5G_RF5G2_BCSLNA5_MASK | \ - RF5G_RF5G2_BVGM5_MASK | \ - RF5G_RF5G2_REGFE_BYPASS5_MASK | \ - RF5G_RF5G2_LNA5_ATTENMODE_MASK | \ - RF5G_RF5G2_ENABLE_PCA_MASK | \ - RF5G_RF5G2_TUNE_LO_MASK | \ - RF5G_RF5G2_SPARE_MASK) - -#define RF5G_REG_ADDRESS_MSB 2 - -#endif /* _RF5G_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rtc_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rtc_reg.h deleted file mode 100644 index 8b3980afb643..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rtc_reg.h +++ /dev/null @@ -1,1163 +0,0 @@ -#ifndef _RTC_REG_REG_H_ -#define _RTC_REG_REG_H_ - -#define RESET_CONTROL_ADDRESS 0x00000000 -#define RESET_CONTROL_OFFSET 0x00000000 -#define RESET_CONTROL_CPU_INIT_RESET_MSB 11 -#define RESET_CONTROL_CPU_INIT_RESET_LSB 11 -#define RESET_CONTROL_CPU_INIT_RESET_MASK 0x00000800 -#define RESET_CONTROL_CPU_INIT_RESET_GET(x) (((x) & RESET_CONTROL_CPU_INIT_RESET_MASK) >> RESET_CONTROL_CPU_INIT_RESET_LSB) -#define RESET_CONTROL_CPU_INIT_RESET_SET(x) (((x) << RESET_CONTROL_CPU_INIT_RESET_LSB) & RESET_CONTROL_CPU_INIT_RESET_MASK) -#define RESET_CONTROL_VMC_REMAP_RESET_MSB 10 -#define RESET_CONTROL_VMC_REMAP_RESET_LSB 10 -#define RESET_CONTROL_VMC_REMAP_RESET_MASK 0x00000400 -#define RESET_CONTROL_VMC_REMAP_RESET_GET(x) (((x) & RESET_CONTROL_VMC_REMAP_RESET_MASK) >> RESET_CONTROL_VMC_REMAP_RESET_LSB) -#define RESET_CONTROL_VMC_REMAP_RESET_SET(x) (((x) << RESET_CONTROL_VMC_REMAP_RESET_LSB) & RESET_CONTROL_VMC_REMAP_RESET_MASK) -#define RESET_CONTROL_RST_OUT_MSB 9 -#define RESET_CONTROL_RST_OUT_LSB 9 -#define RESET_CONTROL_RST_OUT_MASK 0x00000200 -#define RESET_CONTROL_RST_OUT_GET(x) (((x) & RESET_CONTROL_RST_OUT_MASK) >> RESET_CONTROL_RST_OUT_LSB) -#define RESET_CONTROL_RST_OUT_SET(x) (((x) << RESET_CONTROL_RST_OUT_LSB) & RESET_CONTROL_RST_OUT_MASK) -#define RESET_CONTROL_COLD_RST_MSB 8 -#define RESET_CONTROL_COLD_RST_LSB 8 -#define RESET_CONTROL_COLD_RST_MASK 0x00000100 -#define RESET_CONTROL_COLD_RST_GET(x) (((x) & RESET_CONTROL_COLD_RST_MASK) >> RESET_CONTROL_COLD_RST_LSB) -#define RESET_CONTROL_COLD_RST_SET(x) (((x) << RESET_CONTROL_COLD_RST_LSB) & RESET_CONTROL_COLD_RST_MASK) -#define RESET_CONTROL_WARM_RST_MSB 7 -#define RESET_CONTROL_WARM_RST_LSB 7 -#define RESET_CONTROL_WARM_RST_MASK 0x00000080 -#define RESET_CONTROL_WARM_RST_GET(x) (((x) & RESET_CONTROL_WARM_RST_MASK) >> RESET_CONTROL_WARM_RST_LSB) -#define RESET_CONTROL_WARM_RST_SET(x) (((x) << RESET_CONTROL_WARM_RST_LSB) & RESET_CONTROL_WARM_RST_MASK) -#define RESET_CONTROL_CPU_WARM_RST_MSB 6 -#define RESET_CONTROL_CPU_WARM_RST_LSB 6 -#define RESET_CONTROL_CPU_WARM_RST_MASK 0x00000040 -#define RESET_CONTROL_CPU_WARM_RST_GET(x) (((x) & RESET_CONTROL_CPU_WARM_RST_MASK) >> RESET_CONTROL_CPU_WARM_RST_LSB) -#define RESET_CONTROL_CPU_WARM_RST_SET(x) (((x) << RESET_CONTROL_CPU_WARM_RST_LSB) & RESET_CONTROL_CPU_WARM_RST_MASK) -#define RESET_CONTROL_MAC_COLD_RST_MSB 5 -#define RESET_CONTROL_MAC_COLD_RST_LSB 5 -#define RESET_CONTROL_MAC_COLD_RST_MASK 0x00000020 -#define RESET_CONTROL_MAC_COLD_RST_GET(x) (((x) & RESET_CONTROL_MAC_COLD_RST_MASK) >> RESET_CONTROL_MAC_COLD_RST_LSB) -#define RESET_CONTROL_MAC_COLD_RST_SET(x) (((x) << RESET_CONTROL_MAC_COLD_RST_LSB) & RESET_CONTROL_MAC_COLD_RST_MASK) -#define RESET_CONTROL_MAC_WARM_RST_MSB 4 -#define RESET_CONTROL_MAC_WARM_RST_LSB 4 -#define RESET_CONTROL_MAC_WARM_RST_MASK 0x00000010 -#define RESET_CONTROL_MAC_WARM_RST_GET(x) (((x) & RESET_CONTROL_MAC_WARM_RST_MASK) >> RESET_CONTROL_MAC_WARM_RST_LSB) -#define RESET_CONTROL_MAC_WARM_RST_SET(x) (((x) << RESET_CONTROL_MAC_WARM_RST_LSB) & RESET_CONTROL_MAC_WARM_RST_MASK) -#define RESET_CONTROL_MBOX_RST_MSB 2 -#define RESET_CONTROL_MBOX_RST_LSB 2 -#define RESET_CONTROL_MBOX_RST_MASK 0x00000004 -#define RESET_CONTROL_MBOX_RST_GET(x) (((x) & RESET_CONTROL_MBOX_RST_MASK) >> RESET_CONTROL_MBOX_RST_LSB) -#define RESET_CONTROL_MBOX_RST_SET(x) (((x) << RESET_CONTROL_MBOX_RST_LSB) & RESET_CONTROL_MBOX_RST_MASK) -#define RESET_CONTROL_UART_RST_MSB 1 -#define RESET_CONTROL_UART_RST_LSB 1 -#define RESET_CONTROL_UART_RST_MASK 0x00000002 -#define RESET_CONTROL_UART_RST_GET(x) (((x) & RESET_CONTROL_UART_RST_MASK) >> RESET_CONTROL_UART_RST_LSB) -#define RESET_CONTROL_UART_RST_SET(x) (((x) << RESET_CONTROL_UART_RST_LSB) & RESET_CONTROL_UART_RST_MASK) -#define RESET_CONTROL_SI0_RST_MSB 0 -#define RESET_CONTROL_SI0_RST_LSB 0 -#define RESET_CONTROL_SI0_RST_MASK 0x00000001 -#define RESET_CONTROL_SI0_RST_GET(x) (((x) & RESET_CONTROL_SI0_RST_MASK) >> RESET_CONTROL_SI0_RST_LSB) -#define RESET_CONTROL_SI0_RST_SET(x) (((x) << RESET_CONTROL_SI0_RST_LSB) & RESET_CONTROL_SI0_RST_MASK) - -#define XTAL_CONTROL_ADDRESS 0x00000004 -#define XTAL_CONTROL_OFFSET 0x00000004 -#define XTAL_CONTROL_TCXO_MSB 0 -#define XTAL_CONTROL_TCXO_LSB 0 -#define XTAL_CONTROL_TCXO_MASK 0x00000001 -#define XTAL_CONTROL_TCXO_GET(x) (((x) & XTAL_CONTROL_TCXO_MASK) >> XTAL_CONTROL_TCXO_LSB) -#define XTAL_CONTROL_TCXO_SET(x) (((x) << XTAL_CONTROL_TCXO_LSB) & XTAL_CONTROL_TCXO_MASK) - -#define TCXO_DETECT_ADDRESS 0x00000008 -#define TCXO_DETECT_OFFSET 0x00000008 -#define TCXO_DETECT_PRESENT_MSB 0 -#define TCXO_DETECT_PRESENT_LSB 0 -#define TCXO_DETECT_PRESENT_MASK 0x00000001 -#define TCXO_DETECT_PRESENT_GET(x) (((x) & TCXO_DETECT_PRESENT_MASK) >> TCXO_DETECT_PRESENT_LSB) -#define TCXO_DETECT_PRESENT_SET(x) (((x) << TCXO_DETECT_PRESENT_LSB) & TCXO_DETECT_PRESENT_MASK) - -#define XTAL_TEST_ADDRESS 0x0000000c -#define XTAL_TEST_OFFSET 0x0000000c -#define XTAL_TEST_NOTCXODET_MSB 0 -#define XTAL_TEST_NOTCXODET_LSB 0 -#define XTAL_TEST_NOTCXODET_MASK 0x00000001 -#define XTAL_TEST_NOTCXODET_GET(x) (((x) & XTAL_TEST_NOTCXODET_MASK) >> XTAL_TEST_NOTCXODET_LSB) -#define XTAL_TEST_NOTCXODET_SET(x) (((x) << XTAL_TEST_NOTCXODET_LSB) & XTAL_TEST_NOTCXODET_MASK) - -#define QUADRATURE_ADDRESS 0x00000010 -#define QUADRATURE_OFFSET 0x00000010 -#define QUADRATURE_ADC_MSB 5 -#define QUADRATURE_ADC_LSB 4 -#define QUADRATURE_ADC_MASK 0x00000030 -#define QUADRATURE_ADC_GET(x) (((x) & QUADRATURE_ADC_MASK) >> QUADRATURE_ADC_LSB) -#define QUADRATURE_ADC_SET(x) (((x) << QUADRATURE_ADC_LSB) & QUADRATURE_ADC_MASK) -#define QUADRATURE_SEL_MSB 2 -#define QUADRATURE_SEL_LSB 2 -#define QUADRATURE_SEL_MASK 0x00000004 -#define QUADRATURE_SEL_GET(x) (((x) & QUADRATURE_SEL_MASK) >> QUADRATURE_SEL_LSB) -#define QUADRATURE_SEL_SET(x) (((x) << QUADRATURE_SEL_LSB) & QUADRATURE_SEL_MASK) -#define QUADRATURE_DAC_MSB 1 -#define QUADRATURE_DAC_LSB 0 -#define QUADRATURE_DAC_MASK 0x00000003 -#define QUADRATURE_DAC_GET(x) (((x) & QUADRATURE_DAC_MASK) >> QUADRATURE_DAC_LSB) -#define QUADRATURE_DAC_SET(x) (((x) << QUADRATURE_DAC_LSB) & QUADRATURE_DAC_MASK) - -#define PLL_CONTROL_ADDRESS 0x00000014 -#define PLL_CONTROL_OFFSET 0x00000014 -#define PLL_CONTROL_DIG_TEST_CLK_MSB 20 -#define PLL_CONTROL_DIG_TEST_CLK_LSB 20 -#define PLL_CONTROL_DIG_TEST_CLK_MASK 0x00100000 -#define PLL_CONTROL_DIG_TEST_CLK_GET(x) (((x) & PLL_CONTROL_DIG_TEST_CLK_MASK) >> PLL_CONTROL_DIG_TEST_CLK_LSB) -#define PLL_CONTROL_DIG_TEST_CLK_SET(x) (((x) << PLL_CONTROL_DIG_TEST_CLK_LSB) & PLL_CONTROL_DIG_TEST_CLK_MASK) -#define PLL_CONTROL_MAC_OVERRIDE_MSB 19 -#define PLL_CONTROL_MAC_OVERRIDE_LSB 19 -#define PLL_CONTROL_MAC_OVERRIDE_MASK 0x00080000 -#define PLL_CONTROL_MAC_OVERRIDE_GET(x) (((x) & PLL_CONTROL_MAC_OVERRIDE_MASK) >> PLL_CONTROL_MAC_OVERRIDE_LSB) -#define PLL_CONTROL_MAC_OVERRIDE_SET(x) (((x) << PLL_CONTROL_MAC_OVERRIDE_LSB) & PLL_CONTROL_MAC_OVERRIDE_MASK) -#define PLL_CONTROL_NOPWD_MSB 18 -#define PLL_CONTROL_NOPWD_LSB 18 -#define PLL_CONTROL_NOPWD_MASK 0x00040000 -#define PLL_CONTROL_NOPWD_GET(x) (((x) & PLL_CONTROL_NOPWD_MASK) >> PLL_CONTROL_NOPWD_LSB) -#define PLL_CONTROL_NOPWD_SET(x) (((x) << PLL_CONTROL_NOPWD_LSB) & PLL_CONTROL_NOPWD_MASK) -#define PLL_CONTROL_UPDATING_MSB 17 -#define PLL_CONTROL_UPDATING_LSB 17 -#define PLL_CONTROL_UPDATING_MASK 0x00020000 -#define PLL_CONTROL_UPDATING_GET(x) (((x) & PLL_CONTROL_UPDATING_MASK) >> PLL_CONTROL_UPDATING_LSB) -#define PLL_CONTROL_UPDATING_SET(x) (((x) << PLL_CONTROL_UPDATING_LSB) & PLL_CONTROL_UPDATING_MASK) -#define PLL_CONTROL_BYPASS_MSB 16 -#define PLL_CONTROL_BYPASS_LSB 16 -#define PLL_CONTROL_BYPASS_MASK 0x00010000 -#define PLL_CONTROL_BYPASS_GET(x) (((x) & PLL_CONTROL_BYPASS_MASK) >> PLL_CONTROL_BYPASS_LSB) -#define PLL_CONTROL_BYPASS_SET(x) (((x) << PLL_CONTROL_BYPASS_LSB) & PLL_CONTROL_BYPASS_MASK) -#define PLL_CONTROL_REFDIV_MSB 15 -#define PLL_CONTROL_REFDIV_LSB 12 -#define PLL_CONTROL_REFDIV_MASK 0x0000f000 -#define PLL_CONTROL_REFDIV_GET(x) (((x) & PLL_CONTROL_REFDIV_MASK) >> PLL_CONTROL_REFDIV_LSB) -#define PLL_CONTROL_REFDIV_SET(x) (((x) << PLL_CONTROL_REFDIV_LSB) & PLL_CONTROL_REFDIV_MASK) -#define PLL_CONTROL_DIV_MSB 9 -#define PLL_CONTROL_DIV_LSB 0 -#define PLL_CONTROL_DIV_MASK 0x000003ff -#define PLL_CONTROL_DIV_GET(x) (((x) & PLL_CONTROL_DIV_MASK) >> PLL_CONTROL_DIV_LSB) -#define PLL_CONTROL_DIV_SET(x) (((x) << PLL_CONTROL_DIV_LSB) & PLL_CONTROL_DIV_MASK) - -#define PLL_SETTLE_ADDRESS 0x00000018 -#define PLL_SETTLE_OFFSET 0x00000018 -#define PLL_SETTLE_TIME_MSB 11 -#define PLL_SETTLE_TIME_LSB 0 -#define PLL_SETTLE_TIME_MASK 0x00000fff -#define PLL_SETTLE_TIME_GET(x) (((x) & PLL_SETTLE_TIME_MASK) >> PLL_SETTLE_TIME_LSB) -#define PLL_SETTLE_TIME_SET(x) (((x) << PLL_SETTLE_TIME_LSB) & PLL_SETTLE_TIME_MASK) - -#define XTAL_SETTLE_ADDRESS 0x0000001c -#define XTAL_SETTLE_OFFSET 0x0000001c -#define XTAL_SETTLE_TIME_MSB 7 -#define XTAL_SETTLE_TIME_LSB 0 -#define XTAL_SETTLE_TIME_MASK 0x000000ff -#define XTAL_SETTLE_TIME_GET(x) (((x) & XTAL_SETTLE_TIME_MASK) >> XTAL_SETTLE_TIME_LSB) -#define XTAL_SETTLE_TIME_SET(x) (((x) << XTAL_SETTLE_TIME_LSB) & XTAL_SETTLE_TIME_MASK) - -#define CPU_CLOCK_ADDRESS 0x00000020 -#define CPU_CLOCK_OFFSET 0x00000020 -#define CPU_CLOCK_STANDARD_MSB 1 -#define CPU_CLOCK_STANDARD_LSB 0 -#define CPU_CLOCK_STANDARD_MASK 0x00000003 -#define CPU_CLOCK_STANDARD_GET(x) (((x) & CPU_CLOCK_STANDARD_MASK) >> CPU_CLOCK_STANDARD_LSB) -#define CPU_CLOCK_STANDARD_SET(x) (((x) << CPU_CLOCK_STANDARD_LSB) & CPU_CLOCK_STANDARD_MASK) - -#define CLOCK_OUT_ADDRESS 0x00000024 -#define CLOCK_OUT_OFFSET 0x00000024 -#define CLOCK_OUT_SELECT_MSB 3 -#define CLOCK_OUT_SELECT_LSB 0 -#define CLOCK_OUT_SELECT_MASK 0x0000000f -#define CLOCK_OUT_SELECT_GET(x) (((x) & CLOCK_OUT_SELECT_MASK) >> CLOCK_OUT_SELECT_LSB) -#define CLOCK_OUT_SELECT_SET(x) (((x) << CLOCK_OUT_SELECT_LSB) & CLOCK_OUT_SELECT_MASK) - -#define CLOCK_CONTROL_ADDRESS 0x00000028 -#define CLOCK_CONTROL_OFFSET 0x00000028 -#define CLOCK_CONTROL_LF_CLK32_MSB 2 -#define CLOCK_CONTROL_LF_CLK32_LSB 2 -#define CLOCK_CONTROL_LF_CLK32_MASK 0x00000004 -#define CLOCK_CONTROL_LF_CLK32_GET(x) (((x) & CLOCK_CONTROL_LF_CLK32_MASK) >> CLOCK_CONTROL_LF_CLK32_LSB) -#define CLOCK_CONTROL_LF_CLK32_SET(x) (((x) << CLOCK_CONTROL_LF_CLK32_LSB) & CLOCK_CONTROL_LF_CLK32_MASK) -#define CLOCK_CONTROL_UART_CLK_MSB 1 -#define CLOCK_CONTROL_UART_CLK_LSB 1 -#define CLOCK_CONTROL_UART_CLK_MASK 0x00000002 -#define CLOCK_CONTROL_UART_CLK_GET(x) (((x) & CLOCK_CONTROL_UART_CLK_MASK) >> CLOCK_CONTROL_UART_CLK_LSB) -#define CLOCK_CONTROL_UART_CLK_SET(x) (((x) << CLOCK_CONTROL_UART_CLK_LSB) & CLOCK_CONTROL_UART_CLK_MASK) -#define CLOCK_CONTROL_SI0_CLK_MSB 0 -#define CLOCK_CONTROL_SI0_CLK_LSB 0 -#define CLOCK_CONTROL_SI0_CLK_MASK 0x00000001 -#define CLOCK_CONTROL_SI0_CLK_GET(x) (((x) & CLOCK_CONTROL_SI0_CLK_MASK) >> CLOCK_CONTROL_SI0_CLK_LSB) -#define CLOCK_CONTROL_SI0_CLK_SET(x) (((x) << CLOCK_CONTROL_SI0_CLK_LSB) & CLOCK_CONTROL_SI0_CLK_MASK) - -#define BIAS_OVERRIDE_ADDRESS 0x0000002c -#define BIAS_OVERRIDE_OFFSET 0x0000002c -#define BIAS_OVERRIDE_ON_MSB 0 -#define BIAS_OVERRIDE_ON_LSB 0 -#define BIAS_OVERRIDE_ON_MASK 0x00000001 -#define BIAS_OVERRIDE_ON_GET(x) (((x) & BIAS_OVERRIDE_ON_MASK) >> BIAS_OVERRIDE_ON_LSB) -#define BIAS_OVERRIDE_ON_SET(x) (((x) << BIAS_OVERRIDE_ON_LSB) & BIAS_OVERRIDE_ON_MASK) - -#define WDT_CONTROL_ADDRESS 0x00000030 -#define WDT_CONTROL_OFFSET 0x00000030 -#define WDT_CONTROL_ACTION_MSB 2 -#define WDT_CONTROL_ACTION_LSB 0 -#define WDT_CONTROL_ACTION_MASK 0x00000007 -#define WDT_CONTROL_ACTION_GET(x) (((x) & WDT_CONTROL_ACTION_MASK) >> WDT_CONTROL_ACTION_LSB) -#define WDT_CONTROL_ACTION_SET(x) (((x) << WDT_CONTROL_ACTION_LSB) & WDT_CONTROL_ACTION_MASK) - -#define WDT_STATUS_ADDRESS 0x00000034 -#define WDT_STATUS_OFFSET 0x00000034 -#define WDT_STATUS_INTERRUPT_MSB 0 -#define WDT_STATUS_INTERRUPT_LSB 0 -#define WDT_STATUS_INTERRUPT_MASK 0x00000001 -#define WDT_STATUS_INTERRUPT_GET(x) (((x) & WDT_STATUS_INTERRUPT_MASK) >> WDT_STATUS_INTERRUPT_LSB) -#define WDT_STATUS_INTERRUPT_SET(x) (((x) << WDT_STATUS_INTERRUPT_LSB) & WDT_STATUS_INTERRUPT_MASK) - -#define WDT_ADDRESS 0x00000038 -#define WDT_OFFSET 0x00000038 -#define WDT_TARGET_MSB 21 -#define WDT_TARGET_LSB 0 -#define WDT_TARGET_MASK 0x003fffff -#define WDT_TARGET_GET(x) (((x) & WDT_TARGET_MASK) >> WDT_TARGET_LSB) -#define WDT_TARGET_SET(x) (((x) << WDT_TARGET_LSB) & WDT_TARGET_MASK) - -#define WDT_COUNT_ADDRESS 0x0000003c -#define WDT_COUNT_OFFSET 0x0000003c -#define WDT_COUNT_VALUE_MSB 21 -#define WDT_COUNT_VALUE_LSB 0 -#define WDT_COUNT_VALUE_MASK 0x003fffff -#define WDT_COUNT_VALUE_GET(x) (((x) & WDT_COUNT_VALUE_MASK) >> WDT_COUNT_VALUE_LSB) -#define WDT_COUNT_VALUE_SET(x) (((x) << WDT_COUNT_VALUE_LSB) & WDT_COUNT_VALUE_MASK) - -#define WDT_RESET_ADDRESS 0x00000040 -#define WDT_RESET_OFFSET 0x00000040 -#define WDT_RESET_VALUE_MSB 0 -#define WDT_RESET_VALUE_LSB 0 -#define WDT_RESET_VALUE_MASK 0x00000001 -#define WDT_RESET_VALUE_GET(x) (((x) & WDT_RESET_VALUE_MASK) >> WDT_RESET_VALUE_LSB) -#define WDT_RESET_VALUE_SET(x) (((x) << WDT_RESET_VALUE_LSB) & WDT_RESET_VALUE_MASK) - -#define INT_STATUS_ADDRESS 0x00000044 -#define INT_STATUS_OFFSET 0x00000044 -#define INT_STATUS_RTC_POWER_MSB 14 -#define INT_STATUS_RTC_POWER_LSB 14 -#define INT_STATUS_RTC_POWER_MASK 0x00004000 -#define INT_STATUS_RTC_POWER_GET(x) (((x) & INT_STATUS_RTC_POWER_MASK) >> INT_STATUS_RTC_POWER_LSB) -#define INT_STATUS_RTC_POWER_SET(x) (((x) << INT_STATUS_RTC_POWER_LSB) & INT_STATUS_RTC_POWER_MASK) -#define INT_STATUS_MAC_MSB 13 -#define INT_STATUS_MAC_LSB 13 -#define INT_STATUS_MAC_MASK 0x00002000 -#define INT_STATUS_MAC_GET(x) (((x) & INT_STATUS_MAC_MASK) >> INT_STATUS_MAC_LSB) -#define INT_STATUS_MAC_SET(x) (((x) << INT_STATUS_MAC_LSB) & INT_STATUS_MAC_MASK) -#define INT_STATUS_MAILBOX_MSB 12 -#define INT_STATUS_MAILBOX_LSB 12 -#define INT_STATUS_MAILBOX_MASK 0x00001000 -#define INT_STATUS_MAILBOX_GET(x) (((x) & INT_STATUS_MAILBOX_MASK) >> INT_STATUS_MAILBOX_LSB) -#define INT_STATUS_MAILBOX_SET(x) (((x) << INT_STATUS_MAILBOX_LSB) & INT_STATUS_MAILBOX_MASK) -#define INT_STATUS_RTC_ALARM_MSB 11 -#define INT_STATUS_RTC_ALARM_LSB 11 -#define INT_STATUS_RTC_ALARM_MASK 0x00000800 -#define INT_STATUS_RTC_ALARM_GET(x) (((x) & INT_STATUS_RTC_ALARM_MASK) >> INT_STATUS_RTC_ALARM_LSB) -#define INT_STATUS_RTC_ALARM_SET(x) (((x) << INT_STATUS_RTC_ALARM_LSB) & INT_STATUS_RTC_ALARM_MASK) -#define INT_STATUS_HF_TIMER_MSB 10 -#define INT_STATUS_HF_TIMER_LSB 10 -#define INT_STATUS_HF_TIMER_MASK 0x00000400 -#define INT_STATUS_HF_TIMER_GET(x) (((x) & INT_STATUS_HF_TIMER_MASK) >> INT_STATUS_HF_TIMER_LSB) -#define INT_STATUS_HF_TIMER_SET(x) (((x) << INT_STATUS_HF_TIMER_LSB) & INT_STATUS_HF_TIMER_MASK) -#define INT_STATUS_LF_TIMER3_MSB 9 -#define INT_STATUS_LF_TIMER3_LSB 9 -#define INT_STATUS_LF_TIMER3_MASK 0x00000200 -#define INT_STATUS_LF_TIMER3_GET(x) (((x) & INT_STATUS_LF_TIMER3_MASK) >> INT_STATUS_LF_TIMER3_LSB) -#define INT_STATUS_LF_TIMER3_SET(x) (((x) << INT_STATUS_LF_TIMER3_LSB) & INT_STATUS_LF_TIMER3_MASK) -#define INT_STATUS_LF_TIMER2_MSB 8 -#define INT_STATUS_LF_TIMER2_LSB 8 -#define INT_STATUS_LF_TIMER2_MASK 0x00000100 -#define INT_STATUS_LF_TIMER2_GET(x) (((x) & INT_STATUS_LF_TIMER2_MASK) >> INT_STATUS_LF_TIMER2_LSB) -#define INT_STATUS_LF_TIMER2_SET(x) (((x) << INT_STATUS_LF_TIMER2_LSB) & INT_STATUS_LF_TIMER2_MASK) -#define INT_STATUS_LF_TIMER1_MSB 7 -#define INT_STATUS_LF_TIMER1_LSB 7 -#define INT_STATUS_LF_TIMER1_MASK 0x00000080 -#define INT_STATUS_LF_TIMER1_GET(x) (((x) & INT_STATUS_LF_TIMER1_MASK) >> INT_STATUS_LF_TIMER1_LSB) -#define INT_STATUS_LF_TIMER1_SET(x) (((x) << INT_STATUS_LF_TIMER1_LSB) & INT_STATUS_LF_TIMER1_MASK) -#define INT_STATUS_LF_TIMER0_MSB 6 -#define INT_STATUS_LF_TIMER0_LSB 6 -#define INT_STATUS_LF_TIMER0_MASK 0x00000040 -#define INT_STATUS_LF_TIMER0_GET(x) (((x) & INT_STATUS_LF_TIMER0_MASK) >> INT_STATUS_LF_TIMER0_LSB) -#define INT_STATUS_LF_TIMER0_SET(x) (((x) << INT_STATUS_LF_TIMER0_LSB) & INT_STATUS_LF_TIMER0_MASK) -#define INT_STATUS_KEYPAD_MSB 5 -#define INT_STATUS_KEYPAD_LSB 5 -#define INT_STATUS_KEYPAD_MASK 0x00000020 -#define INT_STATUS_KEYPAD_GET(x) (((x) & INT_STATUS_KEYPAD_MASK) >> INT_STATUS_KEYPAD_LSB) -#define INT_STATUS_KEYPAD_SET(x) (((x) << INT_STATUS_KEYPAD_LSB) & INT_STATUS_KEYPAD_MASK) -#define INT_STATUS_SI_MSB 4 -#define INT_STATUS_SI_LSB 4 -#define INT_STATUS_SI_MASK 0x00000010 -#define INT_STATUS_SI_GET(x) (((x) & INT_STATUS_SI_MASK) >> INT_STATUS_SI_LSB) -#define INT_STATUS_SI_SET(x) (((x) << INT_STATUS_SI_LSB) & INT_STATUS_SI_MASK) -#define INT_STATUS_GPIO_MSB 3 -#define INT_STATUS_GPIO_LSB 3 -#define INT_STATUS_GPIO_MASK 0x00000008 -#define INT_STATUS_GPIO_GET(x) (((x) & INT_STATUS_GPIO_MASK) >> INT_STATUS_GPIO_LSB) -#define INT_STATUS_GPIO_SET(x) (((x) << INT_STATUS_GPIO_LSB) & INT_STATUS_GPIO_MASK) -#define INT_STATUS_UART_MSB 2 -#define INT_STATUS_UART_LSB 2 -#define INT_STATUS_UART_MASK 0x00000004 -#define INT_STATUS_UART_GET(x) (((x) & INT_STATUS_UART_MASK) >> INT_STATUS_UART_LSB) -#define INT_STATUS_UART_SET(x) (((x) << INT_STATUS_UART_LSB) & INT_STATUS_UART_MASK) -#define INT_STATUS_ERROR_MSB 1 -#define INT_STATUS_ERROR_LSB 1 -#define INT_STATUS_ERROR_MASK 0x00000002 -#define INT_STATUS_ERROR_GET(x) (((x) & INT_STATUS_ERROR_MASK) >> INT_STATUS_ERROR_LSB) -#define INT_STATUS_ERROR_SET(x) (((x) << INT_STATUS_ERROR_LSB) & INT_STATUS_ERROR_MASK) -#define INT_STATUS_WDT_INT_MSB 0 -#define INT_STATUS_WDT_INT_LSB 0 -#define INT_STATUS_WDT_INT_MASK 0x00000001 -#define INT_STATUS_WDT_INT_GET(x) (((x) & INT_STATUS_WDT_INT_MASK) >> INT_STATUS_WDT_INT_LSB) -#define INT_STATUS_WDT_INT_SET(x) (((x) << INT_STATUS_WDT_INT_LSB) & INT_STATUS_WDT_INT_MASK) - -#define LF_TIMER0_ADDRESS 0x00000048 -#define LF_TIMER0_OFFSET 0x00000048 -#define LF_TIMER0_TARGET_MSB 31 -#define LF_TIMER0_TARGET_LSB 0 -#define LF_TIMER0_TARGET_MASK 0xffffffff -#define LF_TIMER0_TARGET_GET(x) (((x) & LF_TIMER0_TARGET_MASK) >> LF_TIMER0_TARGET_LSB) -#define LF_TIMER0_TARGET_SET(x) (((x) << LF_TIMER0_TARGET_LSB) & LF_TIMER0_TARGET_MASK) - -#define LF_TIMER_COUNT0_ADDRESS 0x0000004c -#define LF_TIMER_COUNT0_OFFSET 0x0000004c -#define LF_TIMER_COUNT0_VALUE_MSB 31 -#define LF_TIMER_COUNT0_VALUE_LSB 0 -#define LF_TIMER_COUNT0_VALUE_MASK 0xffffffff -#define LF_TIMER_COUNT0_VALUE_GET(x) (((x) & LF_TIMER_COUNT0_VALUE_MASK) >> LF_TIMER_COUNT0_VALUE_LSB) -#define LF_TIMER_COUNT0_VALUE_SET(x) (((x) << LF_TIMER_COUNT0_VALUE_LSB) & LF_TIMER_COUNT0_VALUE_MASK) - -#define LF_TIMER_CONTROL0_ADDRESS 0x00000050 -#define LF_TIMER_CONTROL0_OFFSET 0x00000050 -#define LF_TIMER_CONTROL0_ENABLE_MSB 2 -#define LF_TIMER_CONTROL0_ENABLE_LSB 2 -#define LF_TIMER_CONTROL0_ENABLE_MASK 0x00000004 -#define LF_TIMER_CONTROL0_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL0_ENABLE_MASK) >> LF_TIMER_CONTROL0_ENABLE_LSB) -#define LF_TIMER_CONTROL0_ENABLE_SET(x) (((x) << LF_TIMER_CONTROL0_ENABLE_LSB) & LF_TIMER_CONTROL0_ENABLE_MASK) -#define LF_TIMER_CONTROL0_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL0_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL0_AUTO_RESTART_MASK 0x00000002 -#define LF_TIMER_CONTROL0_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL0_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL0_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL0_AUTO_RESTART_SET(x) (((x) << LF_TIMER_CONTROL0_AUTO_RESTART_LSB) & LF_TIMER_CONTROL0_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL0_RESET_MSB 0 -#define LF_TIMER_CONTROL0_RESET_LSB 0 -#define LF_TIMER_CONTROL0_RESET_MASK 0x00000001 -#define LF_TIMER_CONTROL0_RESET_GET(x) (((x) & LF_TIMER_CONTROL0_RESET_MASK) >> LF_TIMER_CONTROL0_RESET_LSB) -#define LF_TIMER_CONTROL0_RESET_SET(x) (((x) << LF_TIMER_CONTROL0_RESET_LSB) & LF_TIMER_CONTROL0_RESET_MASK) - -#define LF_TIMER_STATUS0_ADDRESS 0x00000054 -#define LF_TIMER_STATUS0_OFFSET 0x00000054 -#define LF_TIMER_STATUS0_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS0_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS0_INTERRUPT_MASK 0x00000001 -#define LF_TIMER_STATUS0_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS0_INTERRUPT_MASK) >> LF_TIMER_STATUS0_INTERRUPT_LSB) -#define LF_TIMER_STATUS0_INTERRUPT_SET(x) (((x) << LF_TIMER_STATUS0_INTERRUPT_LSB) & LF_TIMER_STATUS0_INTERRUPT_MASK) - -#define LF_TIMER1_ADDRESS 0x00000058 -#define LF_TIMER1_OFFSET 0x00000058 -#define LF_TIMER1_TARGET_MSB 31 -#define LF_TIMER1_TARGET_LSB 0 -#define LF_TIMER1_TARGET_MASK 0xffffffff -#define LF_TIMER1_TARGET_GET(x) (((x) & LF_TIMER1_TARGET_MASK) >> LF_TIMER1_TARGET_LSB) -#define LF_TIMER1_TARGET_SET(x) (((x) << LF_TIMER1_TARGET_LSB) & LF_TIMER1_TARGET_MASK) - -#define LF_TIMER_COUNT1_ADDRESS 0x0000005c -#define LF_TIMER_COUNT1_OFFSET 0x0000005c -#define LF_TIMER_COUNT1_VALUE_MSB 31 -#define LF_TIMER_COUNT1_VALUE_LSB 0 -#define LF_TIMER_COUNT1_VALUE_MASK 0xffffffff -#define LF_TIMER_COUNT1_VALUE_GET(x) (((x) & LF_TIMER_COUNT1_VALUE_MASK) >> LF_TIMER_COUNT1_VALUE_LSB) -#define LF_TIMER_COUNT1_VALUE_SET(x) (((x) << LF_TIMER_COUNT1_VALUE_LSB) & LF_TIMER_COUNT1_VALUE_MASK) - -#define LF_TIMER_CONTROL1_ADDRESS 0x00000060 -#define LF_TIMER_CONTROL1_OFFSET 0x00000060 -#define LF_TIMER_CONTROL1_ENABLE_MSB 2 -#define LF_TIMER_CONTROL1_ENABLE_LSB 2 -#define LF_TIMER_CONTROL1_ENABLE_MASK 0x00000004 -#define LF_TIMER_CONTROL1_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL1_ENABLE_MASK) >> LF_TIMER_CONTROL1_ENABLE_LSB) -#define LF_TIMER_CONTROL1_ENABLE_SET(x) (((x) << LF_TIMER_CONTROL1_ENABLE_LSB) & LF_TIMER_CONTROL1_ENABLE_MASK) -#define LF_TIMER_CONTROL1_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL1_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL1_AUTO_RESTART_MASK 0x00000002 -#define LF_TIMER_CONTROL1_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL1_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL1_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL1_AUTO_RESTART_SET(x) (((x) << LF_TIMER_CONTROL1_AUTO_RESTART_LSB) & LF_TIMER_CONTROL1_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL1_RESET_MSB 0 -#define LF_TIMER_CONTROL1_RESET_LSB 0 -#define LF_TIMER_CONTROL1_RESET_MASK 0x00000001 -#define LF_TIMER_CONTROL1_RESET_GET(x) (((x) & LF_TIMER_CONTROL1_RESET_MASK) >> LF_TIMER_CONTROL1_RESET_LSB) -#define LF_TIMER_CONTROL1_RESET_SET(x) (((x) << LF_TIMER_CONTROL1_RESET_LSB) & LF_TIMER_CONTROL1_RESET_MASK) - -#define LF_TIMER_STATUS1_ADDRESS 0x00000064 -#define LF_TIMER_STATUS1_OFFSET 0x00000064 -#define LF_TIMER_STATUS1_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS1_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS1_INTERRUPT_MASK 0x00000001 -#define LF_TIMER_STATUS1_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS1_INTERRUPT_MASK) >> LF_TIMER_STATUS1_INTERRUPT_LSB) -#define LF_TIMER_STATUS1_INTERRUPT_SET(x) (((x) << LF_TIMER_STATUS1_INTERRUPT_LSB) & LF_TIMER_STATUS1_INTERRUPT_MASK) - -#define LF_TIMER2_ADDRESS 0x00000068 -#define LF_TIMER2_OFFSET 0x00000068 -#define LF_TIMER2_TARGET_MSB 31 -#define LF_TIMER2_TARGET_LSB 0 -#define LF_TIMER2_TARGET_MASK 0xffffffff -#define LF_TIMER2_TARGET_GET(x) (((x) & LF_TIMER2_TARGET_MASK) >> LF_TIMER2_TARGET_LSB) -#define LF_TIMER2_TARGET_SET(x) (((x) << LF_TIMER2_TARGET_LSB) & LF_TIMER2_TARGET_MASK) - -#define LF_TIMER_COUNT2_ADDRESS 0x0000006c -#define LF_TIMER_COUNT2_OFFSET 0x0000006c -#define LF_TIMER_COUNT2_VALUE_MSB 31 -#define LF_TIMER_COUNT2_VALUE_LSB 0 -#define LF_TIMER_COUNT2_VALUE_MASK 0xffffffff -#define LF_TIMER_COUNT2_VALUE_GET(x) (((x) & LF_TIMER_COUNT2_VALUE_MASK) >> LF_TIMER_COUNT2_VALUE_LSB) -#define LF_TIMER_COUNT2_VALUE_SET(x) (((x) << LF_TIMER_COUNT2_VALUE_LSB) & LF_TIMER_COUNT2_VALUE_MASK) - -#define LF_TIMER_CONTROL2_ADDRESS 0x00000070 -#define LF_TIMER_CONTROL2_OFFSET 0x00000070 -#define LF_TIMER_CONTROL2_ENABLE_MSB 2 -#define LF_TIMER_CONTROL2_ENABLE_LSB 2 -#define LF_TIMER_CONTROL2_ENABLE_MASK 0x00000004 -#define LF_TIMER_CONTROL2_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL2_ENABLE_MASK) >> LF_TIMER_CONTROL2_ENABLE_LSB) -#define LF_TIMER_CONTROL2_ENABLE_SET(x) (((x) << LF_TIMER_CONTROL2_ENABLE_LSB) & LF_TIMER_CONTROL2_ENABLE_MASK) -#define LF_TIMER_CONTROL2_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL2_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL2_AUTO_RESTART_MASK 0x00000002 -#define LF_TIMER_CONTROL2_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL2_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL2_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL2_AUTO_RESTART_SET(x) (((x) << LF_TIMER_CONTROL2_AUTO_RESTART_LSB) & LF_TIMER_CONTROL2_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL2_RESET_MSB 0 -#define LF_TIMER_CONTROL2_RESET_LSB 0 -#define LF_TIMER_CONTROL2_RESET_MASK 0x00000001 -#define LF_TIMER_CONTROL2_RESET_GET(x) (((x) & LF_TIMER_CONTROL2_RESET_MASK) >> LF_TIMER_CONTROL2_RESET_LSB) -#define LF_TIMER_CONTROL2_RESET_SET(x) (((x) << LF_TIMER_CONTROL2_RESET_LSB) & LF_TIMER_CONTROL2_RESET_MASK) - -#define LF_TIMER_STATUS2_ADDRESS 0x00000074 -#define LF_TIMER_STATUS2_OFFSET 0x00000074 -#define LF_TIMER_STATUS2_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS2_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS2_INTERRUPT_MASK 0x00000001 -#define LF_TIMER_STATUS2_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS2_INTERRUPT_MASK) >> LF_TIMER_STATUS2_INTERRUPT_LSB) -#define LF_TIMER_STATUS2_INTERRUPT_SET(x) (((x) << LF_TIMER_STATUS2_INTERRUPT_LSB) & LF_TIMER_STATUS2_INTERRUPT_MASK) - -#define LF_TIMER3_ADDRESS 0x00000078 -#define LF_TIMER3_OFFSET 0x00000078 -#define LF_TIMER3_TARGET_MSB 31 -#define LF_TIMER3_TARGET_LSB 0 -#define LF_TIMER3_TARGET_MASK 0xffffffff -#define LF_TIMER3_TARGET_GET(x) (((x) & LF_TIMER3_TARGET_MASK) >> LF_TIMER3_TARGET_LSB) -#define LF_TIMER3_TARGET_SET(x) (((x) << LF_TIMER3_TARGET_LSB) & LF_TIMER3_TARGET_MASK) - -#define LF_TIMER_COUNT3_ADDRESS 0x0000007c -#define LF_TIMER_COUNT3_OFFSET 0x0000007c -#define LF_TIMER_COUNT3_VALUE_MSB 31 -#define LF_TIMER_COUNT3_VALUE_LSB 0 -#define LF_TIMER_COUNT3_VALUE_MASK 0xffffffff -#define LF_TIMER_COUNT3_VALUE_GET(x) (((x) & LF_TIMER_COUNT3_VALUE_MASK) >> LF_TIMER_COUNT3_VALUE_LSB) -#define LF_TIMER_COUNT3_VALUE_SET(x) (((x) << LF_TIMER_COUNT3_VALUE_LSB) & LF_TIMER_COUNT3_VALUE_MASK) - -#define LF_TIMER_CONTROL3_ADDRESS 0x00000080 -#define LF_TIMER_CONTROL3_OFFSET 0x00000080 -#define LF_TIMER_CONTROL3_ENABLE_MSB 2 -#define LF_TIMER_CONTROL3_ENABLE_LSB 2 -#define LF_TIMER_CONTROL3_ENABLE_MASK 0x00000004 -#define LF_TIMER_CONTROL3_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL3_ENABLE_MASK) >> LF_TIMER_CONTROL3_ENABLE_LSB) -#define LF_TIMER_CONTROL3_ENABLE_SET(x) (((x) << LF_TIMER_CONTROL3_ENABLE_LSB) & LF_TIMER_CONTROL3_ENABLE_MASK) -#define LF_TIMER_CONTROL3_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL3_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL3_AUTO_RESTART_MASK 0x00000002 -#define LF_TIMER_CONTROL3_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL3_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL3_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL3_AUTO_RESTART_SET(x) (((x) << LF_TIMER_CONTROL3_AUTO_RESTART_LSB) & LF_TIMER_CONTROL3_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL3_RESET_MSB 0 -#define LF_TIMER_CONTROL3_RESET_LSB 0 -#define LF_TIMER_CONTROL3_RESET_MASK 0x00000001 -#define LF_TIMER_CONTROL3_RESET_GET(x) (((x) & LF_TIMER_CONTROL3_RESET_MASK) >> LF_TIMER_CONTROL3_RESET_LSB) -#define LF_TIMER_CONTROL3_RESET_SET(x) (((x) << LF_TIMER_CONTROL3_RESET_LSB) & LF_TIMER_CONTROL3_RESET_MASK) - -#define LF_TIMER_STATUS3_ADDRESS 0x00000084 -#define LF_TIMER_STATUS3_OFFSET 0x00000084 -#define LF_TIMER_STATUS3_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS3_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS3_INTERRUPT_MASK 0x00000001 -#define LF_TIMER_STATUS3_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS3_INTERRUPT_MASK) >> LF_TIMER_STATUS3_INTERRUPT_LSB) -#define LF_TIMER_STATUS3_INTERRUPT_SET(x) (((x) << LF_TIMER_STATUS3_INTERRUPT_LSB) & LF_TIMER_STATUS3_INTERRUPT_MASK) - -#define HF_TIMER_ADDRESS 0x00000088 -#define HF_TIMER_OFFSET 0x00000088 -#define HF_TIMER_TARGET_MSB 31 -#define HF_TIMER_TARGET_LSB 12 -#define HF_TIMER_TARGET_MASK 0xfffff000 -#define HF_TIMER_TARGET_GET(x) (((x) & HF_TIMER_TARGET_MASK) >> HF_TIMER_TARGET_LSB) -#define HF_TIMER_TARGET_SET(x) (((x) << HF_TIMER_TARGET_LSB) & HF_TIMER_TARGET_MASK) - -#define HF_TIMER_COUNT_ADDRESS 0x0000008c -#define HF_TIMER_COUNT_OFFSET 0x0000008c -#define HF_TIMER_COUNT_VALUE_MSB 31 -#define HF_TIMER_COUNT_VALUE_LSB 12 -#define HF_TIMER_COUNT_VALUE_MASK 0xfffff000 -#define HF_TIMER_COUNT_VALUE_GET(x) (((x) & HF_TIMER_COUNT_VALUE_MASK) >> HF_TIMER_COUNT_VALUE_LSB) -#define HF_TIMER_COUNT_VALUE_SET(x) (((x) << HF_TIMER_COUNT_VALUE_LSB) & HF_TIMER_COUNT_VALUE_MASK) - -#define HF_LF_COUNT_ADDRESS 0x00000090 -#define HF_LF_COUNT_OFFSET 0x00000090 -#define HF_LF_COUNT_VALUE_MSB 31 -#define HF_LF_COUNT_VALUE_LSB 0 -#define HF_LF_COUNT_VALUE_MASK 0xffffffff -#define HF_LF_COUNT_VALUE_GET(x) (((x) & HF_LF_COUNT_VALUE_MASK) >> HF_LF_COUNT_VALUE_LSB) -#define HF_LF_COUNT_VALUE_SET(x) (((x) << HF_LF_COUNT_VALUE_LSB) & HF_LF_COUNT_VALUE_MASK) - -#define HF_TIMER_CONTROL_ADDRESS 0x00000094 -#define HF_TIMER_CONTROL_OFFSET 0x00000094 -#define HF_TIMER_CONTROL_ENABLE_MSB 3 -#define HF_TIMER_CONTROL_ENABLE_LSB 3 -#define HF_TIMER_CONTROL_ENABLE_MASK 0x00000008 -#define HF_TIMER_CONTROL_ENABLE_GET(x) (((x) & HF_TIMER_CONTROL_ENABLE_MASK) >> HF_TIMER_CONTROL_ENABLE_LSB) -#define HF_TIMER_CONTROL_ENABLE_SET(x) (((x) << HF_TIMER_CONTROL_ENABLE_LSB) & HF_TIMER_CONTROL_ENABLE_MASK) -#define HF_TIMER_CONTROL_ON_MSB 2 -#define HF_TIMER_CONTROL_ON_LSB 2 -#define HF_TIMER_CONTROL_ON_MASK 0x00000004 -#define HF_TIMER_CONTROL_ON_GET(x) (((x) & HF_TIMER_CONTROL_ON_MASK) >> HF_TIMER_CONTROL_ON_LSB) -#define HF_TIMER_CONTROL_ON_SET(x) (((x) << HF_TIMER_CONTROL_ON_LSB) & HF_TIMER_CONTROL_ON_MASK) -#define HF_TIMER_CONTROL_AUTO_RESTART_MSB 1 -#define HF_TIMER_CONTROL_AUTO_RESTART_LSB 1 -#define HF_TIMER_CONTROL_AUTO_RESTART_MASK 0x00000002 -#define HF_TIMER_CONTROL_AUTO_RESTART_GET(x) (((x) & HF_TIMER_CONTROL_AUTO_RESTART_MASK) >> HF_TIMER_CONTROL_AUTO_RESTART_LSB) -#define HF_TIMER_CONTROL_AUTO_RESTART_SET(x) (((x) << HF_TIMER_CONTROL_AUTO_RESTART_LSB) & HF_TIMER_CONTROL_AUTO_RESTART_MASK) -#define HF_TIMER_CONTROL_RESET_MSB 0 -#define HF_TIMER_CONTROL_RESET_LSB 0 -#define HF_TIMER_CONTROL_RESET_MASK 0x00000001 -#define HF_TIMER_CONTROL_RESET_GET(x) (((x) & HF_TIMER_CONTROL_RESET_MASK) >> HF_TIMER_CONTROL_RESET_LSB) -#define HF_TIMER_CONTROL_RESET_SET(x) (((x) << HF_TIMER_CONTROL_RESET_LSB) & HF_TIMER_CONTROL_RESET_MASK) - -#define HF_TIMER_STATUS_ADDRESS 0x00000098 -#define HF_TIMER_STATUS_OFFSET 0x00000098 -#define HF_TIMER_STATUS_INTERRUPT_MSB 0 -#define HF_TIMER_STATUS_INTERRUPT_LSB 0 -#define HF_TIMER_STATUS_INTERRUPT_MASK 0x00000001 -#define HF_TIMER_STATUS_INTERRUPT_GET(x) (((x) & HF_TIMER_STATUS_INTERRUPT_MASK) >> HF_TIMER_STATUS_INTERRUPT_LSB) -#define HF_TIMER_STATUS_INTERRUPT_SET(x) (((x) << HF_TIMER_STATUS_INTERRUPT_LSB) & HF_TIMER_STATUS_INTERRUPT_MASK) - -#define RTC_CONTROL_ADDRESS 0x0000009c -#define RTC_CONTROL_OFFSET 0x0000009c -#define RTC_CONTROL_ENABLE_MSB 2 -#define RTC_CONTROL_ENABLE_LSB 2 -#define RTC_CONTROL_ENABLE_MASK 0x00000004 -#define RTC_CONTROL_ENABLE_GET(x) (((x) & RTC_CONTROL_ENABLE_MASK) >> RTC_CONTROL_ENABLE_LSB) -#define RTC_CONTROL_ENABLE_SET(x) (((x) << RTC_CONTROL_ENABLE_LSB) & RTC_CONTROL_ENABLE_MASK) -#define RTC_CONTROL_LOAD_RTC_MSB 1 -#define RTC_CONTROL_LOAD_RTC_LSB 1 -#define RTC_CONTROL_LOAD_RTC_MASK 0x00000002 -#define RTC_CONTROL_LOAD_RTC_GET(x) (((x) & RTC_CONTROL_LOAD_RTC_MASK) >> RTC_CONTROL_LOAD_RTC_LSB) -#define RTC_CONTROL_LOAD_RTC_SET(x) (((x) << RTC_CONTROL_LOAD_RTC_LSB) & RTC_CONTROL_LOAD_RTC_MASK) -#define RTC_CONTROL_LOAD_ALARM_MSB 0 -#define RTC_CONTROL_LOAD_ALARM_LSB 0 -#define RTC_CONTROL_LOAD_ALARM_MASK 0x00000001 -#define RTC_CONTROL_LOAD_ALARM_GET(x) (((x) & RTC_CONTROL_LOAD_ALARM_MASK) >> RTC_CONTROL_LOAD_ALARM_LSB) -#define RTC_CONTROL_LOAD_ALARM_SET(x) (((x) << RTC_CONTROL_LOAD_ALARM_LSB) & RTC_CONTROL_LOAD_ALARM_MASK) - -#define RTC_TIME_ADDRESS 0x000000a0 -#define RTC_TIME_OFFSET 0x000000a0 -#define RTC_TIME_WEEK_DAY_MSB 26 -#define RTC_TIME_WEEK_DAY_LSB 24 -#define RTC_TIME_WEEK_DAY_MASK 0x07000000 -#define RTC_TIME_WEEK_DAY_GET(x) (((x) & RTC_TIME_WEEK_DAY_MASK) >> RTC_TIME_WEEK_DAY_LSB) -#define RTC_TIME_WEEK_DAY_SET(x) (((x) << RTC_TIME_WEEK_DAY_LSB) & RTC_TIME_WEEK_DAY_MASK) -#define RTC_TIME_HOUR_MSB 21 -#define RTC_TIME_HOUR_LSB 16 -#define RTC_TIME_HOUR_MASK 0x003f0000 -#define RTC_TIME_HOUR_GET(x) (((x) & RTC_TIME_HOUR_MASK) >> RTC_TIME_HOUR_LSB) -#define RTC_TIME_HOUR_SET(x) (((x) << RTC_TIME_HOUR_LSB) & RTC_TIME_HOUR_MASK) -#define RTC_TIME_MINUTE_MSB 14 -#define RTC_TIME_MINUTE_LSB 8 -#define RTC_TIME_MINUTE_MASK 0x00007f00 -#define RTC_TIME_MINUTE_GET(x) (((x) & RTC_TIME_MINUTE_MASK) >> RTC_TIME_MINUTE_LSB) -#define RTC_TIME_MINUTE_SET(x) (((x) << RTC_TIME_MINUTE_LSB) & RTC_TIME_MINUTE_MASK) -#define RTC_TIME_SECOND_MSB 6 -#define RTC_TIME_SECOND_LSB 0 -#define RTC_TIME_SECOND_MASK 0x0000007f -#define RTC_TIME_SECOND_GET(x) (((x) & RTC_TIME_SECOND_MASK) >> RTC_TIME_SECOND_LSB) -#define RTC_TIME_SECOND_SET(x) (((x) << RTC_TIME_SECOND_LSB) & RTC_TIME_SECOND_MASK) - -#define RTC_DATE_ADDRESS 0x000000a4 -#define RTC_DATE_OFFSET 0x000000a4 -#define RTC_DATE_YEAR_MSB 23 -#define RTC_DATE_YEAR_LSB 16 -#define RTC_DATE_YEAR_MASK 0x00ff0000 -#define RTC_DATE_YEAR_GET(x) (((x) & RTC_DATE_YEAR_MASK) >> RTC_DATE_YEAR_LSB) -#define RTC_DATE_YEAR_SET(x) (((x) << RTC_DATE_YEAR_LSB) & RTC_DATE_YEAR_MASK) -#define RTC_DATE_MONTH_MSB 12 -#define RTC_DATE_MONTH_LSB 8 -#define RTC_DATE_MONTH_MASK 0x00001f00 -#define RTC_DATE_MONTH_GET(x) (((x) & RTC_DATE_MONTH_MASK) >> RTC_DATE_MONTH_LSB) -#define RTC_DATE_MONTH_SET(x) (((x) << RTC_DATE_MONTH_LSB) & RTC_DATE_MONTH_MASK) -#define RTC_DATE_MONTH_DAY_MSB 5 -#define RTC_DATE_MONTH_DAY_LSB 0 -#define RTC_DATE_MONTH_DAY_MASK 0x0000003f -#define RTC_DATE_MONTH_DAY_GET(x) (((x) & RTC_DATE_MONTH_DAY_MASK) >> RTC_DATE_MONTH_DAY_LSB) -#define RTC_DATE_MONTH_DAY_SET(x) (((x) << RTC_DATE_MONTH_DAY_LSB) & RTC_DATE_MONTH_DAY_MASK) - -#define RTC_SET_TIME_ADDRESS 0x000000a8 -#define RTC_SET_TIME_OFFSET 0x000000a8 -#define RTC_SET_TIME_WEEK_DAY_MSB 26 -#define RTC_SET_TIME_WEEK_DAY_LSB 24 -#define RTC_SET_TIME_WEEK_DAY_MASK 0x07000000 -#define RTC_SET_TIME_WEEK_DAY_GET(x) (((x) & RTC_SET_TIME_WEEK_DAY_MASK) >> RTC_SET_TIME_WEEK_DAY_LSB) -#define RTC_SET_TIME_WEEK_DAY_SET(x) (((x) << RTC_SET_TIME_WEEK_DAY_LSB) & RTC_SET_TIME_WEEK_DAY_MASK) -#define RTC_SET_TIME_HOUR_MSB 21 -#define RTC_SET_TIME_HOUR_LSB 16 -#define RTC_SET_TIME_HOUR_MASK 0x003f0000 -#define RTC_SET_TIME_HOUR_GET(x) (((x) & RTC_SET_TIME_HOUR_MASK) >> RTC_SET_TIME_HOUR_LSB) -#define RTC_SET_TIME_HOUR_SET(x) (((x) << RTC_SET_TIME_HOUR_LSB) & RTC_SET_TIME_HOUR_MASK) -#define RTC_SET_TIME_MINUTE_MSB 14 -#define RTC_SET_TIME_MINUTE_LSB 8 -#define RTC_SET_TIME_MINUTE_MASK 0x00007f00 -#define RTC_SET_TIME_MINUTE_GET(x) (((x) & RTC_SET_TIME_MINUTE_MASK) >> RTC_SET_TIME_MINUTE_LSB) -#define RTC_SET_TIME_MINUTE_SET(x) (((x) << RTC_SET_TIME_MINUTE_LSB) & RTC_SET_TIME_MINUTE_MASK) -#define RTC_SET_TIME_SECOND_MSB 6 -#define RTC_SET_TIME_SECOND_LSB 0 -#define RTC_SET_TIME_SECOND_MASK 0x0000007f -#define RTC_SET_TIME_SECOND_GET(x) (((x) & RTC_SET_TIME_SECOND_MASK) >> RTC_SET_TIME_SECOND_LSB) -#define RTC_SET_TIME_SECOND_SET(x) (((x) << RTC_SET_TIME_SECOND_LSB) & RTC_SET_TIME_SECOND_MASK) - -#define RTC_SET_DATE_ADDRESS 0x000000ac -#define RTC_SET_DATE_OFFSET 0x000000ac -#define RTC_SET_DATE_YEAR_MSB 23 -#define RTC_SET_DATE_YEAR_LSB 16 -#define RTC_SET_DATE_YEAR_MASK 0x00ff0000 -#define RTC_SET_DATE_YEAR_GET(x) (((x) & RTC_SET_DATE_YEAR_MASK) >> RTC_SET_DATE_YEAR_LSB) -#define RTC_SET_DATE_YEAR_SET(x) (((x) << RTC_SET_DATE_YEAR_LSB) & RTC_SET_DATE_YEAR_MASK) -#define RTC_SET_DATE_MONTH_MSB 12 -#define RTC_SET_DATE_MONTH_LSB 8 -#define RTC_SET_DATE_MONTH_MASK 0x00001f00 -#define RTC_SET_DATE_MONTH_GET(x) (((x) & RTC_SET_DATE_MONTH_MASK) >> RTC_SET_DATE_MONTH_LSB) -#define RTC_SET_DATE_MONTH_SET(x) (((x) << RTC_SET_DATE_MONTH_LSB) & RTC_SET_DATE_MONTH_MASK) -#define RTC_SET_DATE_MONTH_DAY_MSB 5 -#define RTC_SET_DATE_MONTH_DAY_LSB 0 -#define RTC_SET_DATE_MONTH_DAY_MASK 0x0000003f -#define RTC_SET_DATE_MONTH_DAY_GET(x) (((x) & RTC_SET_DATE_MONTH_DAY_MASK) >> RTC_SET_DATE_MONTH_DAY_LSB) -#define RTC_SET_DATE_MONTH_DAY_SET(x) (((x) << RTC_SET_DATE_MONTH_DAY_LSB) & RTC_SET_DATE_MONTH_DAY_MASK) - -#define RTC_SET_ALARM_ADDRESS 0x000000b0 -#define RTC_SET_ALARM_OFFSET 0x000000b0 -#define RTC_SET_ALARM_HOUR_MSB 21 -#define RTC_SET_ALARM_HOUR_LSB 16 -#define RTC_SET_ALARM_HOUR_MASK 0x003f0000 -#define RTC_SET_ALARM_HOUR_GET(x) (((x) & RTC_SET_ALARM_HOUR_MASK) >> RTC_SET_ALARM_HOUR_LSB) -#define RTC_SET_ALARM_HOUR_SET(x) (((x) << RTC_SET_ALARM_HOUR_LSB) & RTC_SET_ALARM_HOUR_MASK) -#define RTC_SET_ALARM_MINUTE_MSB 14 -#define RTC_SET_ALARM_MINUTE_LSB 8 -#define RTC_SET_ALARM_MINUTE_MASK 0x00007f00 -#define RTC_SET_ALARM_MINUTE_GET(x) (((x) & RTC_SET_ALARM_MINUTE_MASK) >> RTC_SET_ALARM_MINUTE_LSB) -#define RTC_SET_ALARM_MINUTE_SET(x) (((x) << RTC_SET_ALARM_MINUTE_LSB) & RTC_SET_ALARM_MINUTE_MASK) -#define RTC_SET_ALARM_SECOND_MSB 6 -#define RTC_SET_ALARM_SECOND_LSB 0 -#define RTC_SET_ALARM_SECOND_MASK 0x0000007f -#define RTC_SET_ALARM_SECOND_GET(x) (((x) & RTC_SET_ALARM_SECOND_MASK) >> RTC_SET_ALARM_SECOND_LSB) -#define RTC_SET_ALARM_SECOND_SET(x) (((x) << RTC_SET_ALARM_SECOND_LSB) & RTC_SET_ALARM_SECOND_MASK) - -#define RTC_CONFIG_ADDRESS 0x000000b4 -#define RTC_CONFIG_OFFSET 0x000000b4 -#define RTC_CONFIG_BCD_MSB 2 -#define RTC_CONFIG_BCD_LSB 2 -#define RTC_CONFIG_BCD_MASK 0x00000004 -#define RTC_CONFIG_BCD_GET(x) (((x) & RTC_CONFIG_BCD_MASK) >> RTC_CONFIG_BCD_LSB) -#define RTC_CONFIG_BCD_SET(x) (((x) << RTC_CONFIG_BCD_LSB) & RTC_CONFIG_BCD_MASK) -#define RTC_CONFIG_TWELVE_HOUR_MSB 1 -#define RTC_CONFIG_TWELVE_HOUR_LSB 1 -#define RTC_CONFIG_TWELVE_HOUR_MASK 0x00000002 -#define RTC_CONFIG_TWELVE_HOUR_GET(x) (((x) & RTC_CONFIG_TWELVE_HOUR_MASK) >> RTC_CONFIG_TWELVE_HOUR_LSB) -#define RTC_CONFIG_TWELVE_HOUR_SET(x) (((x) << RTC_CONFIG_TWELVE_HOUR_LSB) & RTC_CONFIG_TWELVE_HOUR_MASK) -#define RTC_CONFIG_DSE_MSB 0 -#define RTC_CONFIG_DSE_LSB 0 -#define RTC_CONFIG_DSE_MASK 0x00000001 -#define RTC_CONFIG_DSE_GET(x) (((x) & RTC_CONFIG_DSE_MASK) >> RTC_CONFIG_DSE_LSB) -#define RTC_CONFIG_DSE_SET(x) (((x) << RTC_CONFIG_DSE_LSB) & RTC_CONFIG_DSE_MASK) - -#define RTC_ALARM_STATUS_ADDRESS 0x000000b8 -#define RTC_ALARM_STATUS_OFFSET 0x000000b8 -#define RTC_ALARM_STATUS_ENABLE_MSB 1 -#define RTC_ALARM_STATUS_ENABLE_LSB 1 -#define RTC_ALARM_STATUS_ENABLE_MASK 0x00000002 -#define RTC_ALARM_STATUS_ENABLE_GET(x) (((x) & RTC_ALARM_STATUS_ENABLE_MASK) >> RTC_ALARM_STATUS_ENABLE_LSB) -#define RTC_ALARM_STATUS_ENABLE_SET(x) (((x) << RTC_ALARM_STATUS_ENABLE_LSB) & RTC_ALARM_STATUS_ENABLE_MASK) -#define RTC_ALARM_STATUS_INTERRUPT_MSB 0 -#define RTC_ALARM_STATUS_INTERRUPT_LSB 0 -#define RTC_ALARM_STATUS_INTERRUPT_MASK 0x00000001 -#define RTC_ALARM_STATUS_INTERRUPT_GET(x) (((x) & RTC_ALARM_STATUS_INTERRUPT_MASK) >> RTC_ALARM_STATUS_INTERRUPT_LSB) -#define RTC_ALARM_STATUS_INTERRUPT_SET(x) (((x) << RTC_ALARM_STATUS_INTERRUPT_LSB) & RTC_ALARM_STATUS_INTERRUPT_MASK) - -#define UART_WAKEUP_ADDRESS 0x000000bc -#define UART_WAKEUP_OFFSET 0x000000bc -#define UART_WAKEUP_ENABLE_MSB 0 -#define UART_WAKEUP_ENABLE_LSB 0 -#define UART_WAKEUP_ENABLE_MASK 0x00000001 -#define UART_WAKEUP_ENABLE_GET(x) (((x) & UART_WAKEUP_ENABLE_MASK) >> UART_WAKEUP_ENABLE_LSB) -#define UART_WAKEUP_ENABLE_SET(x) (((x) << UART_WAKEUP_ENABLE_LSB) & UART_WAKEUP_ENABLE_MASK) - -#define RESET_CAUSE_ADDRESS 0x000000c0 -#define RESET_CAUSE_OFFSET 0x000000c0 -#define RESET_CAUSE_LAST_MSB 2 -#define RESET_CAUSE_LAST_LSB 0 -#define RESET_CAUSE_LAST_MASK 0x00000007 -#define RESET_CAUSE_LAST_GET(x) (((x) & RESET_CAUSE_LAST_MASK) >> RESET_CAUSE_LAST_LSB) -#define RESET_CAUSE_LAST_SET(x) (((x) << RESET_CAUSE_LAST_LSB) & RESET_CAUSE_LAST_MASK) - -#define SYSTEM_SLEEP_ADDRESS 0x000000c4 -#define SYSTEM_SLEEP_OFFSET 0x000000c4 -#define SYSTEM_SLEEP_HOST_IF_MSB 4 -#define SYSTEM_SLEEP_HOST_IF_LSB 4 -#define SYSTEM_SLEEP_HOST_IF_MASK 0x00000010 -#define SYSTEM_SLEEP_HOST_IF_GET(x) (((x) & SYSTEM_SLEEP_HOST_IF_MASK) >> SYSTEM_SLEEP_HOST_IF_LSB) -#define SYSTEM_SLEEP_HOST_IF_SET(x) (((x) << SYSTEM_SLEEP_HOST_IF_LSB) & SYSTEM_SLEEP_HOST_IF_MASK) -#define SYSTEM_SLEEP_MBOX_MSB 3 -#define SYSTEM_SLEEP_MBOX_LSB 3 -#define SYSTEM_SLEEP_MBOX_MASK 0x00000008 -#define SYSTEM_SLEEP_MBOX_GET(x) (((x) & SYSTEM_SLEEP_MBOX_MASK) >> SYSTEM_SLEEP_MBOX_LSB) -#define SYSTEM_SLEEP_MBOX_SET(x) (((x) << SYSTEM_SLEEP_MBOX_LSB) & SYSTEM_SLEEP_MBOX_MASK) -#define SYSTEM_SLEEP_MAC_IF_MSB 2 -#define SYSTEM_SLEEP_MAC_IF_LSB 2 -#define SYSTEM_SLEEP_MAC_IF_MASK 0x00000004 -#define SYSTEM_SLEEP_MAC_IF_GET(x) (((x) & SYSTEM_SLEEP_MAC_IF_MASK) >> SYSTEM_SLEEP_MAC_IF_LSB) -#define SYSTEM_SLEEP_MAC_IF_SET(x) (((x) << SYSTEM_SLEEP_MAC_IF_LSB) & SYSTEM_SLEEP_MAC_IF_MASK) -#define SYSTEM_SLEEP_LIGHT_MSB 1 -#define SYSTEM_SLEEP_LIGHT_LSB 1 -#define SYSTEM_SLEEP_LIGHT_MASK 0x00000002 -#define SYSTEM_SLEEP_LIGHT_GET(x) (((x) & SYSTEM_SLEEP_LIGHT_MASK) >> SYSTEM_SLEEP_LIGHT_LSB) -#define SYSTEM_SLEEP_LIGHT_SET(x) (((x) << SYSTEM_SLEEP_LIGHT_LSB) & SYSTEM_SLEEP_LIGHT_MASK) -#define SYSTEM_SLEEP_DISABLE_MSB 0 -#define SYSTEM_SLEEP_DISABLE_LSB 0 -#define SYSTEM_SLEEP_DISABLE_MASK 0x00000001 -#define SYSTEM_SLEEP_DISABLE_GET(x) (((x) & SYSTEM_SLEEP_DISABLE_MASK) >> SYSTEM_SLEEP_DISABLE_LSB) -#define SYSTEM_SLEEP_DISABLE_SET(x) (((x) << SYSTEM_SLEEP_DISABLE_LSB) & SYSTEM_SLEEP_DISABLE_MASK) - -#define SDIO_WRAPPER_ADDRESS 0x000000c8 -#define SDIO_WRAPPER_OFFSET 0x000000c8 -#define SDIO_WRAPPER_SLEEP_MSB 3 -#define SDIO_WRAPPER_SLEEP_LSB 3 -#define SDIO_WRAPPER_SLEEP_MASK 0x00000008 -#define SDIO_WRAPPER_SLEEP_GET(x) (((x) & SDIO_WRAPPER_SLEEP_MASK) >> SDIO_WRAPPER_SLEEP_LSB) -#define SDIO_WRAPPER_SLEEP_SET(x) (((x) << SDIO_WRAPPER_SLEEP_LSB) & SDIO_WRAPPER_SLEEP_MASK) -#define SDIO_WRAPPER_WAKEUP_MSB 2 -#define SDIO_WRAPPER_WAKEUP_LSB 2 -#define SDIO_WRAPPER_WAKEUP_MASK 0x00000004 -#define SDIO_WRAPPER_WAKEUP_GET(x) (((x) & SDIO_WRAPPER_WAKEUP_MASK) >> SDIO_WRAPPER_WAKEUP_LSB) -#define SDIO_WRAPPER_WAKEUP_SET(x) (((x) << SDIO_WRAPPER_WAKEUP_LSB) & SDIO_WRAPPER_WAKEUP_MASK) -#define SDIO_WRAPPER_SOC_ON_MSB 1 -#define SDIO_WRAPPER_SOC_ON_LSB 1 -#define SDIO_WRAPPER_SOC_ON_MASK 0x00000002 -#define SDIO_WRAPPER_SOC_ON_GET(x) (((x) & SDIO_WRAPPER_SOC_ON_MASK) >> SDIO_WRAPPER_SOC_ON_LSB) -#define SDIO_WRAPPER_SOC_ON_SET(x) (((x) << SDIO_WRAPPER_SOC_ON_LSB) & SDIO_WRAPPER_SOC_ON_MASK) -#define SDIO_WRAPPER_ON_MSB 0 -#define SDIO_WRAPPER_ON_LSB 0 -#define SDIO_WRAPPER_ON_MASK 0x00000001 -#define SDIO_WRAPPER_ON_GET(x) (((x) & SDIO_WRAPPER_ON_MASK) >> SDIO_WRAPPER_ON_LSB) -#define SDIO_WRAPPER_ON_SET(x) (((x) << SDIO_WRAPPER_ON_LSB) & SDIO_WRAPPER_ON_MASK) - -#define MAC_SLEEP_CONTROL_ADDRESS 0x000000cc -#define MAC_SLEEP_CONTROL_OFFSET 0x000000cc -#define MAC_SLEEP_CONTROL_ENABLE_MSB 1 -#define MAC_SLEEP_CONTROL_ENABLE_LSB 0 -#define MAC_SLEEP_CONTROL_ENABLE_MASK 0x00000003 -#define MAC_SLEEP_CONTROL_ENABLE_GET(x) (((x) & MAC_SLEEP_CONTROL_ENABLE_MASK) >> MAC_SLEEP_CONTROL_ENABLE_LSB) -#define MAC_SLEEP_CONTROL_ENABLE_SET(x) (((x) << MAC_SLEEP_CONTROL_ENABLE_LSB) & MAC_SLEEP_CONTROL_ENABLE_MASK) - -#define KEEP_AWAKE_ADDRESS 0x000000d0 -#define KEEP_AWAKE_OFFSET 0x000000d0 -#define KEEP_AWAKE_COUNT_MSB 7 -#define KEEP_AWAKE_COUNT_LSB 0 -#define KEEP_AWAKE_COUNT_MASK 0x000000ff -#define KEEP_AWAKE_COUNT_GET(x) (((x) & KEEP_AWAKE_COUNT_MASK) >> KEEP_AWAKE_COUNT_LSB) -#define KEEP_AWAKE_COUNT_SET(x) (((x) << KEEP_AWAKE_COUNT_LSB) & KEEP_AWAKE_COUNT_MASK) - -#define LPO_CAL_TIME_ADDRESS 0x000000d4 -#define LPO_CAL_TIME_OFFSET 0x000000d4 -#define LPO_CAL_TIME_LENGTH_MSB 13 -#define LPO_CAL_TIME_LENGTH_LSB 0 -#define LPO_CAL_TIME_LENGTH_MASK 0x00003fff -#define LPO_CAL_TIME_LENGTH_GET(x) (((x) & LPO_CAL_TIME_LENGTH_MASK) >> LPO_CAL_TIME_LENGTH_LSB) -#define LPO_CAL_TIME_LENGTH_SET(x) (((x) << LPO_CAL_TIME_LENGTH_LSB) & LPO_CAL_TIME_LENGTH_MASK) - -#define LPO_INIT_DIVIDEND_INT_ADDRESS 0x000000d8 -#define LPO_INIT_DIVIDEND_INT_OFFSET 0x000000d8 -#define LPO_INIT_DIVIDEND_INT_VALUE_MSB 23 -#define LPO_INIT_DIVIDEND_INT_VALUE_LSB 0 -#define LPO_INIT_DIVIDEND_INT_VALUE_MASK 0x00ffffff -#define LPO_INIT_DIVIDEND_INT_VALUE_GET(x) (((x) & LPO_INIT_DIVIDEND_INT_VALUE_MASK) >> LPO_INIT_DIVIDEND_INT_VALUE_LSB) -#define LPO_INIT_DIVIDEND_INT_VALUE_SET(x) (((x) << LPO_INIT_DIVIDEND_INT_VALUE_LSB) & LPO_INIT_DIVIDEND_INT_VALUE_MASK) - -#define LPO_INIT_DIVIDEND_FRACTION_ADDRESS 0x000000dc -#define LPO_INIT_DIVIDEND_FRACTION_OFFSET 0x000000dc -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_MSB 10 -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB 0 -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK 0x000007ff -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_GET(x) (((x) & LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK) >> LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB) -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_SET(x) (((x) << LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB) & LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK) - -#define LPO_CAL_ADDRESS 0x000000e0 -#define LPO_CAL_OFFSET 0x000000e0 -#define LPO_CAL_ENABLE_MSB 20 -#define LPO_CAL_ENABLE_LSB 20 -#define LPO_CAL_ENABLE_MASK 0x00100000 -#define LPO_CAL_ENABLE_GET(x) (((x) & LPO_CAL_ENABLE_MASK) >> LPO_CAL_ENABLE_LSB) -#define LPO_CAL_ENABLE_SET(x) (((x) << LPO_CAL_ENABLE_LSB) & LPO_CAL_ENABLE_MASK) -#define LPO_CAL_COUNT_MSB 19 -#define LPO_CAL_COUNT_LSB 0 -#define LPO_CAL_COUNT_MASK 0x000fffff -#define LPO_CAL_COUNT_GET(x) (((x) & LPO_CAL_COUNT_MASK) >> LPO_CAL_COUNT_LSB) -#define LPO_CAL_COUNT_SET(x) (((x) << LPO_CAL_COUNT_LSB) & LPO_CAL_COUNT_MASK) - -#define LPO_CAL_TEST_CONTROL_ADDRESS 0x000000e4 -#define LPO_CAL_TEST_CONTROL_OFFSET 0x000000e4 -#define LPO_CAL_TEST_CONTROL_ENABLE_MSB 5 -#define LPO_CAL_TEST_CONTROL_ENABLE_LSB 5 -#define LPO_CAL_TEST_CONTROL_ENABLE_MASK 0x00000020 -#define LPO_CAL_TEST_CONTROL_ENABLE_GET(x) (((x) & LPO_CAL_TEST_CONTROL_ENABLE_MASK) >> LPO_CAL_TEST_CONTROL_ENABLE_LSB) -#define LPO_CAL_TEST_CONTROL_ENABLE_SET(x) (((x) << LPO_CAL_TEST_CONTROL_ENABLE_LSB) & LPO_CAL_TEST_CONTROL_ENABLE_MASK) -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_MSB 4 -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB 0 -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK 0x0000001f -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_GET(x) (((x) & LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK) >> LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB) -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_SET(x) (((x) << LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB) & LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK) - -#define LPO_CAL_TEST_STATUS_ADDRESS 0x000000e8 -#define LPO_CAL_TEST_STATUS_OFFSET 0x000000e8 -#define LPO_CAL_TEST_STATUS_READY_MSB 16 -#define LPO_CAL_TEST_STATUS_READY_LSB 16 -#define LPO_CAL_TEST_STATUS_READY_MASK 0x00010000 -#define LPO_CAL_TEST_STATUS_READY_GET(x) (((x) & LPO_CAL_TEST_STATUS_READY_MASK) >> LPO_CAL_TEST_STATUS_READY_LSB) -#define LPO_CAL_TEST_STATUS_READY_SET(x) (((x) << LPO_CAL_TEST_STATUS_READY_LSB) & LPO_CAL_TEST_STATUS_READY_MASK) -#define LPO_CAL_TEST_STATUS_COUNT_MSB 15 -#define LPO_CAL_TEST_STATUS_COUNT_LSB 0 -#define LPO_CAL_TEST_STATUS_COUNT_MASK 0x0000ffff -#define LPO_CAL_TEST_STATUS_COUNT_GET(x) (((x) & LPO_CAL_TEST_STATUS_COUNT_MASK) >> LPO_CAL_TEST_STATUS_COUNT_LSB) -#define LPO_CAL_TEST_STATUS_COUNT_SET(x) (((x) << LPO_CAL_TEST_STATUS_COUNT_LSB) & LPO_CAL_TEST_STATUS_COUNT_MASK) - -#define CHIP_ID_ADDRESS 0x000000ec -#define CHIP_ID_OFFSET 0x000000ec -#define CHIP_ID_DEVICE_ID_MSB 31 -#define CHIP_ID_DEVICE_ID_LSB 16 -#define CHIP_ID_DEVICE_ID_MASK 0xffff0000 -#define CHIP_ID_DEVICE_ID_GET(x) (((x) & CHIP_ID_DEVICE_ID_MASK) >> CHIP_ID_DEVICE_ID_LSB) -#define CHIP_ID_DEVICE_ID_SET(x) (((x) << CHIP_ID_DEVICE_ID_LSB) & CHIP_ID_DEVICE_ID_MASK) -#define CHIP_ID_CONFIG_ID_MSB 15 -#define CHIP_ID_CONFIG_ID_LSB 4 -#define CHIP_ID_CONFIG_ID_MASK 0x0000fff0 -#define CHIP_ID_CONFIG_ID_GET(x) (((x) & CHIP_ID_CONFIG_ID_MASK) >> CHIP_ID_CONFIG_ID_LSB) -#define CHIP_ID_CONFIG_ID_SET(x) (((x) << CHIP_ID_CONFIG_ID_LSB) & CHIP_ID_CONFIG_ID_MASK) -#define CHIP_ID_VERSION_ID_MSB 3 -#define CHIP_ID_VERSION_ID_LSB 0 -#define CHIP_ID_VERSION_ID_MASK 0x0000000f -#define CHIP_ID_VERSION_ID_GET(x) (((x) & CHIP_ID_VERSION_ID_MASK) >> CHIP_ID_VERSION_ID_LSB) -#define CHIP_ID_VERSION_ID_SET(x) (((x) << CHIP_ID_VERSION_ID_LSB) & CHIP_ID_VERSION_ID_MASK) - -#define DERIVED_RTC_CLK_ADDRESS 0x000000f0 -#define DERIVED_RTC_CLK_OFFSET 0x000000f0 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MSB 20 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB 20 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK 0x00100000 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_GET(x) (((x) & DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK) >> DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_SET(x) (((x) << DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB) & DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_MSB 18 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB 18 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK 0x00040000 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_GET(x) (((x) & DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK) >> DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_SET(x) (((x) << DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB) & DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK) -#define DERIVED_RTC_CLK_FORCE_MSB 17 -#define DERIVED_RTC_CLK_FORCE_LSB 16 -#define DERIVED_RTC_CLK_FORCE_MASK 0x00030000 -#define DERIVED_RTC_CLK_FORCE_GET(x) (((x) & DERIVED_RTC_CLK_FORCE_MASK) >> DERIVED_RTC_CLK_FORCE_LSB) -#define DERIVED_RTC_CLK_FORCE_SET(x) (((x) << DERIVED_RTC_CLK_FORCE_LSB) & DERIVED_RTC_CLK_FORCE_MASK) -#define DERIVED_RTC_CLK_PERIOD_MSB 15 -#define DERIVED_RTC_CLK_PERIOD_LSB 1 -#define DERIVED_RTC_CLK_PERIOD_MASK 0x0000fffe -#define DERIVED_RTC_CLK_PERIOD_GET(x) (((x) & DERIVED_RTC_CLK_PERIOD_MASK) >> DERIVED_RTC_CLK_PERIOD_LSB) -#define DERIVED_RTC_CLK_PERIOD_SET(x) (((x) << DERIVED_RTC_CLK_PERIOD_LSB) & DERIVED_RTC_CLK_PERIOD_MASK) - -#define MAC_PCU_SLP32_MODE_ADDRESS 0x000000f4 -#define MAC_PCU_SLP32_MODE_OFFSET 0x000000f4 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MSB 21 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_LSB 21 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MASK 0x00200000 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_GET(x) (((x) & MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MASK) >> MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_LSB) -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_SET(x) (((x) << MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_LSB) & MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MASK) -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MSB 19 -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB 0 -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK 0x000fffff -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_GET(x) (((x) & MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK) >> MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB) -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_SET(x) (((x) << MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB) & MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK) - -#define MAC_PCU_SLP32_WAKE_ADDRESS 0x000000f8 -#define MAC_PCU_SLP32_WAKE_OFFSET 0x000000f8 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_MSB 15 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_LSB 0 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_MASK 0x0000ffff -#define MAC_PCU_SLP32_WAKE_XTL_TIME_GET(x) (((x) & MAC_PCU_SLP32_WAKE_XTL_TIME_MASK) >> MAC_PCU_SLP32_WAKE_XTL_TIME_LSB) -#define MAC_PCU_SLP32_WAKE_XTL_TIME_SET(x) (((x) << MAC_PCU_SLP32_WAKE_XTL_TIME_LSB) & MAC_PCU_SLP32_WAKE_XTL_TIME_MASK) - -#define MAC_PCU_SLP32_INC_ADDRESS 0x000000fc -#define MAC_PCU_SLP32_INC_OFFSET 0x000000fc -#define MAC_PCU_SLP32_INC_TSF_INC_MSB 19 -#define MAC_PCU_SLP32_INC_TSF_INC_LSB 0 -#define MAC_PCU_SLP32_INC_TSF_INC_MASK 0x000fffff -#define MAC_PCU_SLP32_INC_TSF_INC_GET(x) (((x) & MAC_PCU_SLP32_INC_TSF_INC_MASK) >> MAC_PCU_SLP32_INC_TSF_INC_LSB) -#define MAC_PCU_SLP32_INC_TSF_INC_SET(x) (((x) << MAC_PCU_SLP32_INC_TSF_INC_LSB) & MAC_PCU_SLP32_INC_TSF_INC_MASK) - -#define MAC_PCU_SLP_MIB1_ADDRESS 0x00000100 -#define MAC_PCU_SLP_MIB1_OFFSET 0x00000100 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_MSB 31 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB 0 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK 0xffffffff -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK) >> MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB) -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_SET(x) (((x) << MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB) & MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK) - -#define MAC_PCU_SLP_MIB2_ADDRESS 0x00000104 -#define MAC_PCU_SLP_MIB2_OFFSET 0x00000104 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_MSB 31 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB 0 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK 0xffffffff -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK) >> MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB) -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_SET(x) (((x) << MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB) & MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK) - -#define MAC_PCU_SLP_MIB3_ADDRESS 0x00000108 -#define MAC_PCU_SLP_MIB3_OFFSET 0x00000108 -#define MAC_PCU_SLP_MIB3_PENDING_MSB 1 -#define MAC_PCU_SLP_MIB3_PENDING_LSB 1 -#define MAC_PCU_SLP_MIB3_PENDING_MASK 0x00000002 -#define MAC_PCU_SLP_MIB3_PENDING_GET(x) (((x) & MAC_PCU_SLP_MIB3_PENDING_MASK) >> MAC_PCU_SLP_MIB3_PENDING_LSB) -#define MAC_PCU_SLP_MIB3_PENDING_SET(x) (((x) << MAC_PCU_SLP_MIB3_PENDING_LSB) & MAC_PCU_SLP_MIB3_PENDING_MASK) -#define MAC_PCU_SLP_MIB3_CLR_CNT_MSB 0 -#define MAC_PCU_SLP_MIB3_CLR_CNT_LSB 0 -#define MAC_PCU_SLP_MIB3_CLR_CNT_MASK 0x00000001 -#define MAC_PCU_SLP_MIB3_CLR_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB3_CLR_CNT_MASK) >> MAC_PCU_SLP_MIB3_CLR_CNT_LSB) -#define MAC_PCU_SLP_MIB3_CLR_CNT_SET(x) (((x) << MAC_PCU_SLP_MIB3_CLR_CNT_LSB) & MAC_PCU_SLP_MIB3_CLR_CNT_MASK) - -#define MAC_PCU_SLP_BEACON_ADDRESS 0x0000010c -#define MAC_PCU_SLP_BEACON_OFFSET 0x0000010c -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MSB 24 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_LSB 24 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MASK 0x01000000 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_GET(x) (((x) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MASK) >> MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_LSB) -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_SET(x) (((x) << MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_LSB) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MASK) -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MSB 23 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_LSB 0 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MASK 0x00ffffff -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_GET(x) (((x) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MASK) >> MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_LSB) -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_SET(x) (((x) << MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_LSB) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MASK) - -#define POWER_REG_ADDRESS 0x00000110 -#define POWER_REG_OFFSET 0x00000110 -#define POWER_REG_VLVL_MSB 11 -#define POWER_REG_VLVL_LSB 8 -#define POWER_REG_VLVL_MASK 0x00000f00 -#define POWER_REG_VLVL_GET(x) (((x) & POWER_REG_VLVL_MASK) >> POWER_REG_VLVL_LSB) -#define POWER_REG_VLVL_SET(x) (((x) << POWER_REG_VLVL_LSB) & POWER_REG_VLVL_MASK) -#define POWER_REG_CPU_INT_ENABLE_MSB 7 -#define POWER_REG_CPU_INT_ENABLE_LSB 7 -#define POWER_REG_CPU_INT_ENABLE_MASK 0x00000080 -#define POWER_REG_CPU_INT_ENABLE_GET(x) (((x) & POWER_REG_CPU_INT_ENABLE_MASK) >> POWER_REG_CPU_INT_ENABLE_LSB) -#define POWER_REG_CPU_INT_ENABLE_SET(x) (((x) << POWER_REG_CPU_INT_ENABLE_LSB) & POWER_REG_CPU_INT_ENABLE_MASK) -#define POWER_REG_WLAN_ISO_DIS_MSB 6 -#define POWER_REG_WLAN_ISO_DIS_LSB 6 -#define POWER_REG_WLAN_ISO_DIS_MASK 0x00000040 -#define POWER_REG_WLAN_ISO_DIS_GET(x) (((x) & POWER_REG_WLAN_ISO_DIS_MASK) >> POWER_REG_WLAN_ISO_DIS_LSB) -#define POWER_REG_WLAN_ISO_DIS_SET(x) (((x) << POWER_REG_WLAN_ISO_DIS_LSB) & POWER_REG_WLAN_ISO_DIS_MASK) -#define POWER_REG_WLAN_ISO_CNTL_MSB 5 -#define POWER_REG_WLAN_ISO_CNTL_LSB 5 -#define POWER_REG_WLAN_ISO_CNTL_MASK 0x00000020 -#define POWER_REG_WLAN_ISO_CNTL_GET(x) (((x) & POWER_REG_WLAN_ISO_CNTL_MASK) >> POWER_REG_WLAN_ISO_CNTL_LSB) -#define POWER_REG_WLAN_ISO_CNTL_SET(x) (((x) << POWER_REG_WLAN_ISO_CNTL_LSB) & POWER_REG_WLAN_ISO_CNTL_MASK) -#define POWER_REG_RADIO_PWD_EN_MSB 4 -#define POWER_REG_RADIO_PWD_EN_LSB 4 -#define POWER_REG_RADIO_PWD_EN_MASK 0x00000010 -#define POWER_REG_RADIO_PWD_EN_GET(x) (((x) & POWER_REG_RADIO_PWD_EN_MASK) >> POWER_REG_RADIO_PWD_EN_LSB) -#define POWER_REG_RADIO_PWD_EN_SET(x) (((x) << POWER_REG_RADIO_PWD_EN_LSB) & POWER_REG_RADIO_PWD_EN_MASK) -#define POWER_REG_SOC_SCALE_EN_MSB 3 -#define POWER_REG_SOC_SCALE_EN_LSB 3 -#define POWER_REG_SOC_SCALE_EN_MASK 0x00000008 -#define POWER_REG_SOC_SCALE_EN_GET(x) (((x) & POWER_REG_SOC_SCALE_EN_MASK) >> POWER_REG_SOC_SCALE_EN_LSB) -#define POWER_REG_SOC_SCALE_EN_SET(x) (((x) << POWER_REG_SOC_SCALE_EN_LSB) & POWER_REG_SOC_SCALE_EN_MASK) -#define POWER_REG_WLAN_SCALE_EN_MSB 2 -#define POWER_REG_WLAN_SCALE_EN_LSB 2 -#define POWER_REG_WLAN_SCALE_EN_MASK 0x00000004 -#define POWER_REG_WLAN_SCALE_EN_GET(x) (((x) & POWER_REG_WLAN_SCALE_EN_MASK) >> POWER_REG_WLAN_SCALE_EN_LSB) -#define POWER_REG_WLAN_SCALE_EN_SET(x) (((x) << POWER_REG_WLAN_SCALE_EN_LSB) & POWER_REG_WLAN_SCALE_EN_MASK) -#define POWER_REG_WLAN_PWD_EN_MSB 1 -#define POWER_REG_WLAN_PWD_EN_LSB 1 -#define POWER_REG_WLAN_PWD_EN_MASK 0x00000002 -#define POWER_REG_WLAN_PWD_EN_GET(x) (((x) & POWER_REG_WLAN_PWD_EN_MASK) >> POWER_REG_WLAN_PWD_EN_LSB) -#define POWER_REG_WLAN_PWD_EN_SET(x) (((x) << POWER_REG_WLAN_PWD_EN_LSB) & POWER_REG_WLAN_PWD_EN_MASK) -#define POWER_REG_POWER_EN_MSB 0 -#define POWER_REG_POWER_EN_LSB 0 -#define POWER_REG_POWER_EN_MASK 0x00000001 -#define POWER_REG_POWER_EN_GET(x) (((x) & POWER_REG_POWER_EN_MASK) >> POWER_REG_POWER_EN_LSB) -#define POWER_REG_POWER_EN_SET(x) (((x) << POWER_REG_POWER_EN_LSB) & POWER_REG_POWER_EN_MASK) - -#define CORE_CLK_CTRL_ADDRESS 0x00000114 -#define CORE_CLK_CTRL_OFFSET 0x00000114 -#define CORE_CLK_CTRL_DIV_MSB 2 -#define CORE_CLK_CTRL_DIV_LSB 0 -#define CORE_CLK_CTRL_DIV_MASK 0x00000007 -#define CORE_CLK_CTRL_DIV_GET(x) (((x) & CORE_CLK_CTRL_DIV_MASK) >> CORE_CLK_CTRL_DIV_LSB) -#define CORE_CLK_CTRL_DIV_SET(x) (((x) << CORE_CLK_CTRL_DIV_LSB) & CORE_CLK_CTRL_DIV_MASK) - -#define SDIO_SETUP_CIRCUIT_ADDRESS 0x00000120 -#define SDIO_SETUP_CIRCUIT_OFFSET 0x00000120 -#define SDIO_SETUP_CIRCUIT_VECTOR_MSB 7 -#define SDIO_SETUP_CIRCUIT_VECTOR_LSB 0 -#define SDIO_SETUP_CIRCUIT_VECTOR_MASK 0x000000ff -#define SDIO_SETUP_CIRCUIT_VECTOR_GET(x) (((x) & SDIO_SETUP_CIRCUIT_VECTOR_MASK) >> SDIO_SETUP_CIRCUIT_VECTOR_LSB) -#define SDIO_SETUP_CIRCUIT_VECTOR_SET(x) (((x) << SDIO_SETUP_CIRCUIT_VECTOR_LSB) & SDIO_SETUP_CIRCUIT_VECTOR_MASK) - -#define SDIO_SETUP_CONFIG_ADDRESS 0x00000140 -#define SDIO_SETUP_CONFIG_OFFSET 0x00000140 -#define SDIO_SETUP_CONFIG_ENABLE_MSB 1 -#define SDIO_SETUP_CONFIG_ENABLE_LSB 1 -#define SDIO_SETUP_CONFIG_ENABLE_MASK 0x00000002 -#define SDIO_SETUP_CONFIG_ENABLE_GET(x) (((x) & SDIO_SETUP_CONFIG_ENABLE_MASK) >> SDIO_SETUP_CONFIG_ENABLE_LSB) -#define SDIO_SETUP_CONFIG_ENABLE_SET(x) (((x) << SDIO_SETUP_CONFIG_ENABLE_LSB) & SDIO_SETUP_CONFIG_ENABLE_MASK) -#define SDIO_SETUP_CONFIG_CLEAR_MSB 0 -#define SDIO_SETUP_CONFIG_CLEAR_LSB 0 -#define SDIO_SETUP_CONFIG_CLEAR_MASK 0x00000001 -#define SDIO_SETUP_CONFIG_CLEAR_GET(x) (((x) & SDIO_SETUP_CONFIG_CLEAR_MASK) >> SDIO_SETUP_CONFIG_CLEAR_LSB) -#define SDIO_SETUP_CONFIG_CLEAR_SET(x) (((x) << SDIO_SETUP_CONFIG_CLEAR_LSB) & SDIO_SETUP_CONFIG_CLEAR_MASK) - -#define CPU_SETUP_CONFIG_ADDRESS 0x00000144 -#define CPU_SETUP_CONFIG_OFFSET 0x00000144 -#define CPU_SETUP_CONFIG_ENABLE_MSB 1 -#define CPU_SETUP_CONFIG_ENABLE_LSB 1 -#define CPU_SETUP_CONFIG_ENABLE_MASK 0x00000002 -#define CPU_SETUP_CONFIG_ENABLE_GET(x) (((x) & CPU_SETUP_CONFIG_ENABLE_MASK) >> CPU_SETUP_CONFIG_ENABLE_LSB) -#define CPU_SETUP_CONFIG_ENABLE_SET(x) (((x) << CPU_SETUP_CONFIG_ENABLE_LSB) & CPU_SETUP_CONFIG_ENABLE_MASK) -#define CPU_SETUP_CONFIG_CLEAR_MSB 0 -#define CPU_SETUP_CONFIG_CLEAR_LSB 0 -#define CPU_SETUP_CONFIG_CLEAR_MASK 0x00000001 -#define CPU_SETUP_CONFIG_CLEAR_GET(x) (((x) & CPU_SETUP_CONFIG_CLEAR_MASK) >> CPU_SETUP_CONFIG_CLEAR_LSB) -#define CPU_SETUP_CONFIG_CLEAR_SET(x) (((x) << CPU_SETUP_CONFIG_CLEAR_LSB) & CPU_SETUP_CONFIG_CLEAR_MASK) - -#define CPU_SETUP_CIRCUIT_ADDRESS 0x00000160 -#define CPU_SETUP_CIRCUIT_OFFSET 0x00000160 -#define CPU_SETUP_CIRCUIT_VECTOR_MSB 7 -#define CPU_SETUP_CIRCUIT_VECTOR_LSB 0 -#define CPU_SETUP_CIRCUIT_VECTOR_MASK 0x000000ff -#define CPU_SETUP_CIRCUIT_VECTOR_GET(x) (((x) & CPU_SETUP_CIRCUIT_VECTOR_MASK) >> CPU_SETUP_CIRCUIT_VECTOR_LSB) -#define CPU_SETUP_CIRCUIT_VECTOR_SET(x) (((x) << CPU_SETUP_CIRCUIT_VECTOR_LSB) & CPU_SETUP_CIRCUIT_VECTOR_MASK) - -#define BB_SETUP_CONFIG_ADDRESS 0x00000180 -#define BB_SETUP_CONFIG_OFFSET 0x00000180 -#define BB_SETUP_CONFIG_ENABLE_MSB 1 -#define BB_SETUP_CONFIG_ENABLE_LSB 1 -#define BB_SETUP_CONFIG_ENABLE_MASK 0x00000002 -#define BB_SETUP_CONFIG_ENABLE_GET(x) (((x) & BB_SETUP_CONFIG_ENABLE_MASK) >> BB_SETUP_CONFIG_ENABLE_LSB) -#define BB_SETUP_CONFIG_ENABLE_SET(x) (((x) << BB_SETUP_CONFIG_ENABLE_LSB) & BB_SETUP_CONFIG_ENABLE_MASK) -#define BB_SETUP_CONFIG_CLEAR_MSB 0 -#define BB_SETUP_CONFIG_CLEAR_LSB 0 -#define BB_SETUP_CONFIG_CLEAR_MASK 0x00000001 -#define BB_SETUP_CONFIG_CLEAR_GET(x) (((x) & BB_SETUP_CONFIG_CLEAR_MASK) >> BB_SETUP_CONFIG_CLEAR_LSB) -#define BB_SETUP_CONFIG_CLEAR_SET(x) (((x) << BB_SETUP_CONFIG_CLEAR_LSB) & BB_SETUP_CONFIG_CLEAR_MASK) - -#define BB_SETUP_CIRCUIT_ADDRESS 0x000001a0 -#define BB_SETUP_CIRCUIT_OFFSET 0x000001a0 -#define BB_SETUP_CIRCUIT_VECTOR_MSB 7 -#define BB_SETUP_CIRCUIT_VECTOR_LSB 0 -#define BB_SETUP_CIRCUIT_VECTOR_MASK 0x000000ff -#define BB_SETUP_CIRCUIT_VECTOR_GET(x) (((x) & BB_SETUP_CIRCUIT_VECTOR_MASK) >> BB_SETUP_CIRCUIT_VECTOR_LSB) -#define BB_SETUP_CIRCUIT_VECTOR_SET(x) (((x) << BB_SETUP_CIRCUIT_VECTOR_LSB) & BB_SETUP_CIRCUIT_VECTOR_MASK) - -#define GPIO_WAKEUP_CONTROL_ADDRESS 0x000001c0 -#define GPIO_WAKEUP_CONTROL_OFFSET 0x000001c0 -#define GPIO_WAKEUP_CONTROL_ENABLE_MSB 0 -#define GPIO_WAKEUP_CONTROL_ENABLE_LSB 0 -#define GPIO_WAKEUP_CONTROL_ENABLE_MASK 0x00000001 -#define GPIO_WAKEUP_CONTROL_ENABLE_GET(x) (((x) & GPIO_WAKEUP_CONTROL_ENABLE_MASK) >> GPIO_WAKEUP_CONTROL_ENABLE_LSB) -#define GPIO_WAKEUP_CONTROL_ENABLE_SET(x) (((x) << GPIO_WAKEUP_CONTROL_ENABLE_LSB) & GPIO_WAKEUP_CONTROL_ENABLE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct rtc_reg_reg_s { - volatile unsigned int reset_control; - volatile unsigned int xtal_control; - volatile unsigned int tcxo_detect; - volatile unsigned int xtal_test; - volatile unsigned int quadrature; - volatile unsigned int pll_control; - volatile unsigned int pll_settle; - volatile unsigned int xtal_settle; - volatile unsigned int cpu_clock; - volatile unsigned int clock_out; - volatile unsigned int clock_control; - volatile unsigned int bias_override; - volatile unsigned int wdt_control; - volatile unsigned int wdt_status; - volatile unsigned int wdt; - volatile unsigned int wdt_count; - volatile unsigned int wdt_reset; - volatile unsigned int int_status; - volatile unsigned int lf_timer0; - volatile unsigned int lf_timer_count0; - volatile unsigned int lf_timer_control0; - volatile unsigned int lf_timer_status0; - volatile unsigned int lf_timer1; - volatile unsigned int lf_timer_count1; - volatile unsigned int lf_timer_control1; - volatile unsigned int lf_timer_status1; - volatile unsigned int lf_timer2; - volatile unsigned int lf_timer_count2; - volatile unsigned int lf_timer_control2; - volatile unsigned int lf_timer_status2; - volatile unsigned int lf_timer3; - volatile unsigned int lf_timer_count3; - volatile unsigned int lf_timer_control3; - volatile unsigned int lf_timer_status3; - volatile unsigned int hf_timer; - volatile unsigned int hf_timer_count; - volatile unsigned int hf_lf_count; - volatile unsigned int hf_timer_control; - volatile unsigned int hf_timer_status; - volatile unsigned int rtc_control; - volatile unsigned int rtc_time; - volatile unsigned int rtc_date; - volatile unsigned int rtc_set_time; - volatile unsigned int rtc_set_date; - volatile unsigned int rtc_set_alarm; - volatile unsigned int rtc_config; - volatile unsigned int rtc_alarm_status; - volatile unsigned int uart_wakeup; - volatile unsigned int reset_cause; - volatile unsigned int system_sleep; - volatile unsigned int sdio_wrapper; - volatile unsigned int mac_sleep_control; - volatile unsigned int keep_awake; - volatile unsigned int lpo_cal_time; - volatile unsigned int lpo_init_dividend_int; - volatile unsigned int lpo_init_dividend_fraction; - volatile unsigned int lpo_cal; - volatile unsigned int lpo_cal_test_control; - volatile unsigned int lpo_cal_test_status; - volatile unsigned int chip_id; - volatile unsigned int derived_rtc_clk; - volatile unsigned int mac_pcu_slp32_mode; - volatile unsigned int mac_pcu_slp32_wake; - volatile unsigned int mac_pcu_slp32_inc; - volatile unsigned int mac_pcu_slp_mib1; - volatile unsigned int mac_pcu_slp_mib2; - volatile unsigned int mac_pcu_slp_mib3; - volatile unsigned int mac_pcu_slp_beacon; - volatile unsigned int power_reg; - volatile unsigned int core_clk_ctrl; - unsigned char pad0[8]; /* pad to 0x120 */ - volatile unsigned int sdio_setup_circuit[8]; - volatile unsigned int sdio_setup_config; - volatile unsigned int cpu_setup_config; - unsigned char pad1[24]; /* pad to 0x160 */ - volatile unsigned int cpu_setup_circuit[8]; - volatile unsigned int bb_setup_config; - unsigned char pad2[28]; /* pad to 0x1a0 */ - volatile unsigned int bb_setup_circuit[8]; - volatile unsigned int gpio_wakeup_control; -} rtc_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _RTC_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rtc_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rtc_reg.vrh deleted file mode 100644 index a95f3422d38b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rtc_reg.vrh +++ /dev/null @@ -1,1758 +0,0 @@ -#ifndef _RTC_REG_VRH_ -#define _RTC_REG_VRH_ - -#define RESET_CONTROL_ADDRESS 'h00000000 -#define RESET_CONTROL_CPU_INIT_RESET_MSB 11 -#define RESET_CONTROL_CPU_INIT_RESET_LSB 11 -#define RESET_CONTROL_CPU_INIT_RESET_MASK 'h00000800 -#define RESET_CONTROL_CPU_INIT_RESET_GET(x) (((x) & RESET_CONTROL_CPU_INIT_RESET_MASK) >> RESET_CONTROL_CPU_INIT_RESET_LSB) -#define RESET_CONTROL_CPU_INIT_RESET_SET(x) (((32'd0 | (x)) << RESET_CONTROL_CPU_INIT_RESET_LSB) & RESET_CONTROL_CPU_INIT_RESET_MASK) -#define RESET_CONTROL_CPU_INIT_RESET_RESET 1'h1 -#define RESET_CONTROL_VMC_REMAP_RESET_MSB 10 -#define RESET_CONTROL_VMC_REMAP_RESET_LSB 10 -#define RESET_CONTROL_VMC_REMAP_RESET_MASK 'h00000400 -#define RESET_CONTROL_VMC_REMAP_RESET_GET(x) (((x) & RESET_CONTROL_VMC_REMAP_RESET_MASK) >> RESET_CONTROL_VMC_REMAP_RESET_LSB) -#define RESET_CONTROL_VMC_REMAP_RESET_SET(x) (((32'd0 | (x)) << RESET_CONTROL_VMC_REMAP_RESET_LSB) & RESET_CONTROL_VMC_REMAP_RESET_MASK) -#define RESET_CONTROL_VMC_REMAP_RESET_RESET 1'h0 -#define RESET_CONTROL_RST_OUT_MSB 9 -#define RESET_CONTROL_RST_OUT_LSB 9 -#define RESET_CONTROL_RST_OUT_MASK 'h00000200 -#define RESET_CONTROL_RST_OUT_GET(x) (((x) & RESET_CONTROL_RST_OUT_MASK) >> RESET_CONTROL_RST_OUT_LSB) -#define RESET_CONTROL_RST_OUT_SET(x) (((32'd0 | (x)) << RESET_CONTROL_RST_OUT_LSB) & RESET_CONTROL_RST_OUT_MASK) -#define RESET_CONTROL_RST_OUT_RESET 1'h0 -#define RESET_CONTROL_COLD_RST_MSB 8 -#define RESET_CONTROL_COLD_RST_LSB 8 -#define RESET_CONTROL_COLD_RST_MASK 'h00000100 -#define RESET_CONTROL_COLD_RST_GET(x) (((x) & RESET_CONTROL_COLD_RST_MASK) >> RESET_CONTROL_COLD_RST_LSB) -#define RESET_CONTROL_COLD_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_COLD_RST_LSB) & RESET_CONTROL_COLD_RST_MASK) -#define RESET_CONTROL_COLD_RST_RESET 1'h0 -#define RESET_CONTROL_WARM_RST_MSB 7 -#define RESET_CONTROL_WARM_RST_LSB 7 -#define RESET_CONTROL_WARM_RST_MASK 'h00000080 -#define RESET_CONTROL_WARM_RST_GET(x) (((x) & RESET_CONTROL_WARM_RST_MASK) >> RESET_CONTROL_WARM_RST_LSB) -#define RESET_CONTROL_WARM_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_WARM_RST_LSB) & RESET_CONTROL_WARM_RST_MASK) -#define RESET_CONTROL_WARM_RST_RESET 1'h0 -#define RESET_CONTROL_CPU_WARM_RST_MSB 6 -#define RESET_CONTROL_CPU_WARM_RST_LSB 6 -#define RESET_CONTROL_CPU_WARM_RST_MASK 'h00000040 -#define RESET_CONTROL_CPU_WARM_RST_GET(x) (((x) & RESET_CONTROL_CPU_WARM_RST_MASK) >> RESET_CONTROL_CPU_WARM_RST_LSB) -#define RESET_CONTROL_CPU_WARM_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_CPU_WARM_RST_LSB) & RESET_CONTROL_CPU_WARM_RST_MASK) -#define RESET_CONTROL_CPU_WARM_RST_RESET 1'h0 -#define RESET_CONTROL_MAC_COLD_RST_MSB 5 -#define RESET_CONTROL_MAC_COLD_RST_LSB 5 -#define RESET_CONTROL_MAC_COLD_RST_MASK 'h00000020 -#define RESET_CONTROL_MAC_COLD_RST_GET(x) (((x) & RESET_CONTROL_MAC_COLD_RST_MASK) >> RESET_CONTROL_MAC_COLD_RST_LSB) -#define RESET_CONTROL_MAC_COLD_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_MAC_COLD_RST_LSB) & RESET_CONTROL_MAC_COLD_RST_MASK) -#define RESET_CONTROL_MAC_COLD_RST_RESET 1'h1 -#define RESET_CONTROL_MAC_WARM_RST_MSB 4 -#define RESET_CONTROL_MAC_WARM_RST_LSB 4 -#define RESET_CONTROL_MAC_WARM_RST_MASK 'h00000010 -#define RESET_CONTROL_MAC_WARM_RST_GET(x) (((x) & RESET_CONTROL_MAC_WARM_RST_MASK) >> RESET_CONTROL_MAC_WARM_RST_LSB) -#define RESET_CONTROL_MAC_WARM_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_MAC_WARM_RST_LSB) & RESET_CONTROL_MAC_WARM_RST_MASK) -#define RESET_CONTROL_MAC_WARM_RST_RESET 1'h1 -#define RESET_CONTROL_MBOX_RST_MSB 2 -#define RESET_CONTROL_MBOX_RST_LSB 2 -#define RESET_CONTROL_MBOX_RST_MASK 'h00000004 -#define RESET_CONTROL_MBOX_RST_GET(x) (((x) & RESET_CONTROL_MBOX_RST_MASK) >> RESET_CONTROL_MBOX_RST_LSB) -#define RESET_CONTROL_MBOX_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_MBOX_RST_LSB) & RESET_CONTROL_MBOX_RST_MASK) -#define RESET_CONTROL_MBOX_RST_RESET 1'h0 -#define RESET_CONTROL_UART_RST_MSB 1 -#define RESET_CONTROL_UART_RST_LSB 1 -#define RESET_CONTROL_UART_RST_MASK 'h00000002 -#define RESET_CONTROL_UART_RST_GET(x) (((x) & RESET_CONTROL_UART_RST_MASK) >> RESET_CONTROL_UART_RST_LSB) -#define RESET_CONTROL_UART_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_UART_RST_LSB) & RESET_CONTROL_UART_RST_MASK) -#define RESET_CONTROL_UART_RST_RESET 1'h0 -#define RESET_CONTROL_SI0_RST_MSB 0 -#define RESET_CONTROL_SI0_RST_LSB 0 -#define RESET_CONTROL_SI0_RST_MASK 'h00000001 -#define RESET_CONTROL_SI0_RST_GET(x) (((x) & RESET_CONTROL_SI0_RST_MASK) >> RESET_CONTROL_SI0_RST_LSB) -#define RESET_CONTROL_SI0_RST_SET(x) (((32'd0 | (x)) << RESET_CONTROL_SI0_RST_LSB) & RESET_CONTROL_SI0_RST_MASK) -#define RESET_CONTROL_SI0_RST_RESET 1'h0 -#define RESET_CONTROL_RESET (32'h0 | \ - RESET_CONTROL_CPU_INIT_RESET_SET(RESET_CONTROL_CPU_INIT_RESET_RESET) | \ - RESET_CONTROL_VMC_REMAP_RESET_SET(RESET_CONTROL_VMC_REMAP_RESET_RESET) | \ - RESET_CONTROL_RST_OUT_SET(RESET_CONTROL_RST_OUT_RESET) | \ - RESET_CONTROL_COLD_RST_SET(RESET_CONTROL_COLD_RST_RESET) | \ - RESET_CONTROL_WARM_RST_SET(RESET_CONTROL_WARM_RST_RESET) | \ - RESET_CONTROL_CPU_WARM_RST_SET(RESET_CONTROL_CPU_WARM_RST_RESET) | \ - RESET_CONTROL_MAC_COLD_RST_SET(RESET_CONTROL_MAC_COLD_RST_RESET) | \ - RESET_CONTROL_MAC_WARM_RST_SET(RESET_CONTROL_MAC_WARM_RST_RESET) | \ - RESET_CONTROL_MBOX_RST_SET(RESET_CONTROL_MBOX_RST_RESET) | \ - RESET_CONTROL_UART_RST_SET(RESET_CONTROL_UART_RST_RESET) | \ - RESET_CONTROL_SI0_RST_SET(RESET_CONTROL_SI0_RST_RESET)) -#define RESET_CONTROL_HW_MASK (32'h0 | \ - RESET_CONTROL_WARM_RST_MASK | \ - RESET_CONTROL_CPU_WARM_RST_MASK | \ - RESET_CONTROL_MAC_COLD_RST_MASK | \ - RESET_CONTROL_MAC_WARM_RST_MASK) -#define RESET_CONTROL_SW_MASK (32'h0 | \ - RESET_CONTROL_CPU_INIT_RESET_MASK | \ - RESET_CONTROL_VMC_REMAP_RESET_MASK | \ - RESET_CONTROL_RST_OUT_MASK | \ - RESET_CONTROL_COLD_RST_MASK | \ - RESET_CONTROL_WARM_RST_MASK | \ - RESET_CONTROL_CPU_WARM_RST_MASK | \ - RESET_CONTROL_MAC_COLD_RST_MASK | \ - RESET_CONTROL_MAC_WARM_RST_MASK | \ - RESET_CONTROL_MBOX_RST_MASK | \ - RESET_CONTROL_UART_RST_MASK | \ - RESET_CONTROL_SI0_RST_MASK) - -#define XTAL_CONTROL_ADDRESS 'h00000004 -#define XTAL_CONTROL_TCXO_MSB 0 -#define XTAL_CONTROL_TCXO_LSB 0 -#define XTAL_CONTROL_TCXO_MASK 'h00000001 -#define XTAL_CONTROL_TCXO_GET(x) (((x) & XTAL_CONTROL_TCXO_MASK) >> XTAL_CONTROL_TCXO_LSB) -#define XTAL_CONTROL_TCXO_SET(x) (((32'd0 | (x)) << XTAL_CONTROL_TCXO_LSB) & XTAL_CONTROL_TCXO_MASK) -#define XTAL_CONTROL_TCXO_RESET 1'h0 -#define XTAL_CONTROL_RESET (32'h0 | \ - XTAL_CONTROL_TCXO_SET(XTAL_CONTROL_TCXO_RESET)) -#define XTAL_CONTROL_HW_MASK (32'h0) -#define XTAL_CONTROL_SW_MASK (32'h0 | \ - XTAL_CONTROL_TCXO_MASK) - -#define TCXO_DETECT_ADDRESS 'h00000008 -#define TCXO_DETECT_PRESENT_MSB 0 -#define TCXO_DETECT_PRESENT_LSB 0 -#define TCXO_DETECT_PRESENT_MASK 'h00000001 -#define TCXO_DETECT_PRESENT_GET(x) (((x) & TCXO_DETECT_PRESENT_MASK) >> TCXO_DETECT_PRESENT_LSB) -#define TCXO_DETECT_PRESENT_SET(x) (((32'd0 | (x)) << TCXO_DETECT_PRESENT_LSB) & TCXO_DETECT_PRESENT_MASK) -#define TCXO_DETECT_PRESENT_RESET 1'h0 -#define TCXO_DETECT_RESET (32'h0 | \ - TCXO_DETECT_PRESENT_SET(TCXO_DETECT_PRESENT_RESET)) -#define TCXO_DETECT_HW_MASK (32'h0 | \ - TCXO_DETECT_PRESENT_MASK) -#define TCXO_DETECT_SW_MASK (32'h0) - -#define XTAL_TEST_ADDRESS 'h0000000c -#define XTAL_TEST_NOTCXODET_MSB 0 -#define XTAL_TEST_NOTCXODET_LSB 0 -#define XTAL_TEST_NOTCXODET_MASK 'h00000001 -#define XTAL_TEST_NOTCXODET_GET(x) (((x) & XTAL_TEST_NOTCXODET_MASK) >> XTAL_TEST_NOTCXODET_LSB) -#define XTAL_TEST_NOTCXODET_SET(x) (((32'd0 | (x)) << XTAL_TEST_NOTCXODET_LSB) & XTAL_TEST_NOTCXODET_MASK) -#define XTAL_TEST_NOTCXODET_RESET 1'h0 -#define XTAL_TEST_RESET (32'h0 | \ - XTAL_TEST_NOTCXODET_SET(XTAL_TEST_NOTCXODET_RESET)) -#define XTAL_TEST_HW_MASK (32'h0) -#define XTAL_TEST_SW_MASK (32'h0 | \ - XTAL_TEST_NOTCXODET_MASK) - -#define QUADRATURE_ADDRESS 'h00000010 -#define QUADRATURE_ADC_MSB 5 -#define QUADRATURE_ADC_LSB 4 -#define QUADRATURE_ADC_MASK 'h00000030 -#define QUADRATURE_ADC_GET(x) (((x) & QUADRATURE_ADC_MASK) >> QUADRATURE_ADC_LSB) -#define QUADRATURE_ADC_SET(x) (((32'd0 | (x)) << QUADRATURE_ADC_LSB) & QUADRATURE_ADC_MASK) -#define QUADRATURE_ADC_RESET 2'h0 -#define QUADRATURE_SEL_MSB 2 -#define QUADRATURE_SEL_LSB 2 -#define QUADRATURE_SEL_MASK 'h00000004 -#define QUADRATURE_SEL_GET(x) (((x) & QUADRATURE_SEL_MASK) >> QUADRATURE_SEL_LSB) -#define QUADRATURE_SEL_SET(x) (((32'd0 | (x)) << QUADRATURE_SEL_LSB) & QUADRATURE_SEL_MASK) -#define QUADRATURE_SEL_RESET 1'h0 -#define QUADRATURE_DAC_MSB 1 -#define QUADRATURE_DAC_LSB 0 -#define QUADRATURE_DAC_MASK 'h00000003 -#define QUADRATURE_DAC_GET(x) (((x) & QUADRATURE_DAC_MASK) >> QUADRATURE_DAC_LSB) -#define QUADRATURE_DAC_SET(x) (((32'd0 | (x)) << QUADRATURE_DAC_LSB) & QUADRATURE_DAC_MASK) -#define QUADRATURE_DAC_RESET 2'h2 -#define QUADRATURE_RESET (32'h0 | \ - QUADRATURE_ADC_SET(QUADRATURE_ADC_RESET) | \ - QUADRATURE_SEL_SET(QUADRATURE_SEL_RESET) | \ - QUADRATURE_DAC_SET(QUADRATURE_DAC_RESET)) -#define QUADRATURE_HW_MASK (32'h0) -#define QUADRATURE_SW_MASK (32'h0 | \ - QUADRATURE_ADC_MASK | \ - QUADRATURE_SEL_MASK | \ - QUADRATURE_DAC_MASK) - -#define PLL_CONTROL_ADDRESS 'h00000014 -#define PLL_CONTROL_DIG_TEST_CLK_MSB 20 -#define PLL_CONTROL_DIG_TEST_CLK_LSB 20 -#define PLL_CONTROL_DIG_TEST_CLK_MASK 'h00100000 -#define PLL_CONTROL_DIG_TEST_CLK_GET(x) (((x) & PLL_CONTROL_DIG_TEST_CLK_MASK) >> PLL_CONTROL_DIG_TEST_CLK_LSB) -#define PLL_CONTROL_DIG_TEST_CLK_SET(x) (((32'd0 | (x)) << PLL_CONTROL_DIG_TEST_CLK_LSB) & PLL_CONTROL_DIG_TEST_CLK_MASK) -#define PLL_CONTROL_DIG_TEST_CLK_RESET 1'h0 -#define PLL_CONTROL_MAC_OVERRIDE_MSB 19 -#define PLL_CONTROL_MAC_OVERRIDE_LSB 19 -#define PLL_CONTROL_MAC_OVERRIDE_MASK 'h00080000 -#define PLL_CONTROL_MAC_OVERRIDE_GET(x) (((x) & PLL_CONTROL_MAC_OVERRIDE_MASK) >> PLL_CONTROL_MAC_OVERRIDE_LSB) -#define PLL_CONTROL_MAC_OVERRIDE_SET(x) (((32'd0 | (x)) << PLL_CONTROL_MAC_OVERRIDE_LSB) & PLL_CONTROL_MAC_OVERRIDE_MASK) -#define PLL_CONTROL_MAC_OVERRIDE_RESET 1'h0 -#define PLL_CONTROL_NOPWD_MSB 18 -#define PLL_CONTROL_NOPWD_LSB 18 -#define PLL_CONTROL_NOPWD_MASK 'h00040000 -#define PLL_CONTROL_NOPWD_GET(x) (((x) & PLL_CONTROL_NOPWD_MASK) >> PLL_CONTROL_NOPWD_LSB) -#define PLL_CONTROL_NOPWD_SET(x) (((32'd0 | (x)) << PLL_CONTROL_NOPWD_LSB) & PLL_CONTROL_NOPWD_MASK) -#define PLL_CONTROL_NOPWD_RESET 1'h0 -#define PLL_CONTROL_UPDATING_MSB 17 -#define PLL_CONTROL_UPDATING_LSB 17 -#define PLL_CONTROL_UPDATING_MASK 'h00020000 -#define PLL_CONTROL_UPDATING_GET(x) (((x) & PLL_CONTROL_UPDATING_MASK) >> PLL_CONTROL_UPDATING_LSB) -#define PLL_CONTROL_UPDATING_SET(x) (((32'd0 | (x)) << PLL_CONTROL_UPDATING_LSB) & PLL_CONTROL_UPDATING_MASK) -#define PLL_CONTROL_UPDATING_RESET 1'h0 -#define PLL_CONTROL_BYPASS_MSB 16 -#define PLL_CONTROL_BYPASS_LSB 16 -#define PLL_CONTROL_BYPASS_MASK 'h00010000 -#define PLL_CONTROL_BYPASS_GET(x) (((x) & PLL_CONTROL_BYPASS_MASK) >> PLL_CONTROL_BYPASS_LSB) -#define PLL_CONTROL_BYPASS_SET(x) (((32'd0 | (x)) << PLL_CONTROL_BYPASS_LSB) & PLL_CONTROL_BYPASS_MASK) -#define PLL_CONTROL_BYPASS_RESET 1'h1 -#define PLL_CONTROL_REFDIV_MSB 15 -#define PLL_CONTROL_REFDIV_LSB 12 -#define PLL_CONTROL_REFDIV_MASK 'h0000f000 -#define PLL_CONTROL_REFDIV_GET(x) (((x) & PLL_CONTROL_REFDIV_MASK) >> PLL_CONTROL_REFDIV_LSB) -#define PLL_CONTROL_REFDIV_SET(x) (((32'd0 | (x)) << PLL_CONTROL_REFDIV_LSB) & PLL_CONTROL_REFDIV_MASK) -#define PLL_CONTROL_REFDIV_RESET 4'h5 -#define PLL_CONTROL_DIV_MSB 9 -#define PLL_CONTROL_DIV_LSB 0 -#define PLL_CONTROL_DIV_MASK 'h000003ff -#define PLL_CONTROL_DIV_GET(x) (((x) & PLL_CONTROL_DIV_MASK) >> PLL_CONTROL_DIV_LSB) -#define PLL_CONTROL_DIV_SET(x) (((32'd0 | (x)) << PLL_CONTROL_DIV_LSB) & PLL_CONTROL_DIV_MASK) -#define PLL_CONTROL_DIV_RESET 10'h28 -#define PLL_CONTROL_RESET (32'h0 | \ - PLL_CONTROL_DIG_TEST_CLK_SET(PLL_CONTROL_DIG_TEST_CLK_RESET) | \ - PLL_CONTROL_MAC_OVERRIDE_SET(PLL_CONTROL_MAC_OVERRIDE_RESET) | \ - PLL_CONTROL_NOPWD_SET(PLL_CONTROL_NOPWD_RESET) | \ - PLL_CONTROL_UPDATING_SET(PLL_CONTROL_UPDATING_RESET) | \ - PLL_CONTROL_BYPASS_SET(PLL_CONTROL_BYPASS_RESET) | \ - PLL_CONTROL_REFDIV_SET(PLL_CONTROL_REFDIV_RESET) | \ - PLL_CONTROL_DIV_SET(PLL_CONTROL_DIV_RESET)) -#define PLL_CONTROL_HW_MASK (32'h0 | \ - PLL_CONTROL_UPDATING_MASK) -#define PLL_CONTROL_SW_MASK (32'h0 | \ - PLL_CONTROL_DIG_TEST_CLK_MASK | \ - PLL_CONTROL_MAC_OVERRIDE_MASK | \ - PLL_CONTROL_NOPWD_MASK | \ - PLL_CONTROL_BYPASS_MASK | \ - PLL_CONTROL_REFDIV_MASK | \ - PLL_CONTROL_DIV_MASK) - -#define PLL_SETTLE_ADDRESS 'h00000018 -#define PLL_SETTLE_TIME_MSB 11 -#define PLL_SETTLE_TIME_LSB 0 -#define PLL_SETTLE_TIME_MASK 'h00000fff -#define PLL_SETTLE_TIME_GET(x) (((x) & PLL_SETTLE_TIME_MASK) >> PLL_SETTLE_TIME_LSB) -#define PLL_SETTLE_TIME_SET(x) (((32'd0 | (x)) << PLL_SETTLE_TIME_LSB) & PLL_SETTLE_TIME_MASK) -#define PLL_SETTLE_TIME_RESET 12'h400 -#define PLL_SETTLE_RESET (32'h0 | \ - PLL_SETTLE_TIME_SET(PLL_SETTLE_TIME_RESET)) -#define PLL_SETTLE_HW_MASK (32'h0) -#define PLL_SETTLE_SW_MASK (32'h0 | \ - PLL_SETTLE_TIME_MASK) - -#define XTAL_SETTLE_ADDRESS 'h0000001c -#define XTAL_SETTLE_TIME_MSB 7 -#define XTAL_SETTLE_TIME_LSB 0 -#define XTAL_SETTLE_TIME_MASK 'h000000ff -#define XTAL_SETTLE_TIME_GET(x) (((x) & XTAL_SETTLE_TIME_MASK) >> XTAL_SETTLE_TIME_LSB) -#define XTAL_SETTLE_TIME_SET(x) (((32'd0 | (x)) << XTAL_SETTLE_TIME_LSB) & XTAL_SETTLE_TIME_MASK) -#define XTAL_SETTLE_TIME_RESET 8'h7f -#define XTAL_SETTLE_RESET (32'h0 | \ - XTAL_SETTLE_TIME_SET(XTAL_SETTLE_TIME_RESET)) -#define XTAL_SETTLE_HW_MASK (32'h0 | \ - XTAL_SETTLE_TIME_MASK) -#define XTAL_SETTLE_SW_MASK (32'h0 | \ - XTAL_SETTLE_TIME_MASK) - -#define CPU_CLOCK_ADDRESS 'h00000020 -#define CPU_CLOCK_STANDARD_MSB 1 -#define CPU_CLOCK_STANDARD_LSB 0 -#define CPU_CLOCK_STANDARD_MASK 'h00000003 -#define CPU_CLOCK_STANDARD_GET(x) (((x) & CPU_CLOCK_STANDARD_MASK) >> CPU_CLOCK_STANDARD_LSB) -#define CPU_CLOCK_STANDARD_SET(x) (((32'd0 | (x)) << CPU_CLOCK_STANDARD_LSB) & CPU_CLOCK_STANDARD_MASK) -#define CPU_CLOCK_STANDARD_RESET 2'h3 -#define CPU_CLOCK_RESET (32'h0 | \ - CPU_CLOCK_STANDARD_SET(CPU_CLOCK_STANDARD_RESET)) -#define CPU_CLOCK_HW_MASK (32'h0) -#define CPU_CLOCK_SW_MASK (32'h0 | \ - CPU_CLOCK_STANDARD_MASK) - -#define CLOCK_OUT_ADDRESS 'h00000024 -#define CLOCK_OUT_SELECT_MSB 3 -#define CLOCK_OUT_SELECT_LSB 0 -#define CLOCK_OUT_SELECT_MASK 'h0000000f -#define CLOCK_OUT_SELECT_GET(x) (((x) & CLOCK_OUT_SELECT_MASK) >> CLOCK_OUT_SELECT_LSB) -#define CLOCK_OUT_SELECT_SET(x) (((32'd0 | (x)) << CLOCK_OUT_SELECT_LSB) & CLOCK_OUT_SELECT_MASK) -#define CLOCK_OUT_SELECT_RESET 4'hf -#define CLOCK_OUT_RESET (32'h0 | \ - CLOCK_OUT_SELECT_SET(CLOCK_OUT_SELECT_RESET)) -#define CLOCK_OUT_HW_MASK (32'h0) -#define CLOCK_OUT_SW_MASK (32'h0 | \ - CLOCK_OUT_SELECT_MASK) - -#define CLOCK_CONTROL_ADDRESS 'h00000028 -#define CLOCK_CONTROL_LF_CLK32_MSB 2 -#define CLOCK_CONTROL_LF_CLK32_LSB 2 -#define CLOCK_CONTROL_LF_CLK32_MASK 'h00000004 -#define CLOCK_CONTROL_LF_CLK32_GET(x) (((x) & CLOCK_CONTROL_LF_CLK32_MASK) >> CLOCK_CONTROL_LF_CLK32_LSB) -#define CLOCK_CONTROL_LF_CLK32_SET(x) (((32'd0 | (x)) << CLOCK_CONTROL_LF_CLK32_LSB) & CLOCK_CONTROL_LF_CLK32_MASK) -#define CLOCK_CONTROL_LF_CLK32_RESET 1'h0 -#define CLOCK_CONTROL_UART_CLK_MSB 1 -#define CLOCK_CONTROL_UART_CLK_LSB 1 -#define CLOCK_CONTROL_UART_CLK_MASK 'h00000002 -#define CLOCK_CONTROL_UART_CLK_GET(x) (((x) & CLOCK_CONTROL_UART_CLK_MASK) >> CLOCK_CONTROL_UART_CLK_LSB) -#define CLOCK_CONTROL_UART_CLK_SET(x) (((32'd0 | (x)) << CLOCK_CONTROL_UART_CLK_LSB) & CLOCK_CONTROL_UART_CLK_MASK) -#define CLOCK_CONTROL_UART_CLK_RESET 1'h0 -#define CLOCK_CONTROL_SI0_CLK_MSB 0 -#define CLOCK_CONTROL_SI0_CLK_LSB 0 -#define CLOCK_CONTROL_SI0_CLK_MASK 'h00000001 -#define CLOCK_CONTROL_SI0_CLK_GET(x) (((x) & CLOCK_CONTROL_SI0_CLK_MASK) >> CLOCK_CONTROL_SI0_CLK_LSB) -#define CLOCK_CONTROL_SI0_CLK_SET(x) (((32'd0 | (x)) << CLOCK_CONTROL_SI0_CLK_LSB) & CLOCK_CONTROL_SI0_CLK_MASK) -#define CLOCK_CONTROL_SI0_CLK_RESET 1'h1 -#define CLOCK_CONTROL_RESET (32'h0 | \ - CLOCK_CONTROL_LF_CLK32_SET(CLOCK_CONTROL_LF_CLK32_RESET) | \ - CLOCK_CONTROL_UART_CLK_SET(CLOCK_CONTROL_UART_CLK_RESET) | \ - CLOCK_CONTROL_SI0_CLK_SET(CLOCK_CONTROL_SI0_CLK_RESET)) -#define CLOCK_CONTROL_HW_MASK (32'h0) -#define CLOCK_CONTROL_SW_MASK (32'h0 | \ - CLOCK_CONTROL_LF_CLK32_MASK | \ - CLOCK_CONTROL_UART_CLK_MASK | \ - CLOCK_CONTROL_SI0_CLK_MASK) - -#define BIAS_OVERRIDE_ADDRESS 'h0000002c -#define BIAS_OVERRIDE_ON_MSB 0 -#define BIAS_OVERRIDE_ON_LSB 0 -#define BIAS_OVERRIDE_ON_MASK 'h00000001 -#define BIAS_OVERRIDE_ON_GET(x) (((x) & BIAS_OVERRIDE_ON_MASK) >> BIAS_OVERRIDE_ON_LSB) -#define BIAS_OVERRIDE_ON_SET(x) (((32'd0 | (x)) << BIAS_OVERRIDE_ON_LSB) & BIAS_OVERRIDE_ON_MASK) -#define BIAS_OVERRIDE_ON_RESET 1'h0 -#define BIAS_OVERRIDE_RESET (32'h0 | \ - BIAS_OVERRIDE_ON_SET(BIAS_OVERRIDE_ON_RESET)) -#define BIAS_OVERRIDE_HW_MASK (32'h0) -#define BIAS_OVERRIDE_SW_MASK (32'h0 | \ - BIAS_OVERRIDE_ON_MASK) - -#define WDT_CONTROL_ADDRESS 'h00000030 -#define WDT_CONTROL_ACTION_MSB 2 -#define WDT_CONTROL_ACTION_LSB 0 -#define WDT_CONTROL_ACTION_MASK 'h00000007 -#define WDT_CONTROL_ACTION_GET(x) (((x) & WDT_CONTROL_ACTION_MASK) >> WDT_CONTROL_ACTION_LSB) -#define WDT_CONTROL_ACTION_SET(x) (((32'd0 | (x)) << WDT_CONTROL_ACTION_LSB) & WDT_CONTROL_ACTION_MASK) -#define WDT_CONTROL_ACTION_RESET 3'h2 -#define WDT_CONTROL_RESET (32'h0 | \ - WDT_CONTROL_ACTION_SET(WDT_CONTROL_ACTION_RESET)) -#define WDT_CONTROL_HW_MASK (32'h0) -#define WDT_CONTROL_SW_MASK (32'h0 | \ - WDT_CONTROL_ACTION_MASK) - -#define WDT_STATUS_ADDRESS 'h00000034 -#define WDT_STATUS_INTERRUPT_MSB 0 -#define WDT_STATUS_INTERRUPT_LSB 0 -#define WDT_STATUS_INTERRUPT_MASK 'h00000001 -#define WDT_STATUS_INTERRUPT_GET(x) (((x) & WDT_STATUS_INTERRUPT_MASK) >> WDT_STATUS_INTERRUPT_LSB) -#define WDT_STATUS_INTERRUPT_SET(x) (((32'd0 | (x)) << WDT_STATUS_INTERRUPT_LSB) & WDT_STATUS_INTERRUPT_MASK) -#define WDT_STATUS_INTERRUPT_RESET 1'h0 -#define WDT_STATUS_RESET (32'h0 | \ - WDT_STATUS_INTERRUPT_SET(WDT_STATUS_INTERRUPT_RESET)) -#define WDT_STATUS_HW_MASK (32'h0 | \ - WDT_STATUS_INTERRUPT_MASK) -#define WDT_STATUS_SW_MASK (32'h0 | \ - WDT_STATUS_INTERRUPT_MASK) - -#define WDT_ADDRESS 'h00000038 -#define WDT_TARGET_MSB 21 -#define WDT_TARGET_LSB 0 -#define WDT_TARGET_MASK 'h003fffff -#define WDT_TARGET_GET(x) (((x) & WDT_TARGET_MASK) >> WDT_TARGET_LSB) -#define WDT_TARGET_SET(x) (((32'd0 | (x)) << WDT_TARGET_LSB) & WDT_TARGET_MASK) -#define WDT_TARGET_RESET 22'h3fffff -#define WDT_RESET (32'h0 | \ - WDT_TARGET_SET(WDT_TARGET_RESET)) -#define WDT_HW_MASK (32'h0) -#define WDT_SW_MASK (32'h0 | \ - WDT_TARGET_MASK) - -#define WDT_COUNT_ADDRESS 'h0000003c -#define WDT_COUNT_VALUE_MSB 21 -#define WDT_COUNT_VALUE_LSB 0 -#define WDT_COUNT_VALUE_MASK 'h003fffff -#define WDT_COUNT_VALUE_GET(x) (((x) & WDT_COUNT_VALUE_MASK) >> WDT_COUNT_VALUE_LSB) -#define WDT_COUNT_VALUE_SET(x) (((32'd0 | (x)) << WDT_COUNT_VALUE_LSB) & WDT_COUNT_VALUE_MASK) -#define WDT_COUNT_VALUE_RESET 22'h0 -#define WDT_COUNT_RESET (32'h0 | \ - WDT_COUNT_VALUE_SET(WDT_COUNT_VALUE_RESET)) -#define WDT_COUNT_HW_MASK (32'h0 | \ - WDT_COUNT_VALUE_MASK) -#define WDT_COUNT_SW_MASK (32'h0) - -#define WDT_RESET_ADDRESS 'h00000040 -#define WDT_RESET_VALUE_MSB 0 -#define WDT_RESET_VALUE_LSB 0 -#define WDT_RESET_VALUE_MASK 'h00000001 -#define WDT_RESET_VALUE_GET(x) (((x) & WDT_RESET_VALUE_MASK) >> WDT_RESET_VALUE_LSB) -#define WDT_RESET_VALUE_SET(x) (((32'd0 | (x)) << WDT_RESET_VALUE_LSB) & WDT_RESET_VALUE_MASK) -#define WDT_RESET_VALUE_RESET 1'h0 -#define WDT_RESET_RESET (32'h0 | \ - WDT_RESET_VALUE_SET(WDT_RESET_VALUE_RESET)) -#define WDT_RESET_HW_MASK (32'h0 | \ - WDT_RESET_VALUE_MASK) -#define WDT_RESET_SW_MASK (32'h0 | \ - WDT_RESET_VALUE_MASK) - -#define INT_STATUS_ADDRESS 'h00000044 -#define INT_STATUS_RTC_POWER_MSB 14 -#define INT_STATUS_RTC_POWER_LSB 14 -#define INT_STATUS_RTC_POWER_MASK 'h00004000 -#define INT_STATUS_RTC_POWER_GET(x) (((x) & INT_STATUS_RTC_POWER_MASK) >> INT_STATUS_RTC_POWER_LSB) -#define INT_STATUS_RTC_POWER_SET(x) (((32'd0 | (x)) << INT_STATUS_RTC_POWER_LSB) & INT_STATUS_RTC_POWER_MASK) -#define INT_STATUS_RTC_POWER_RESET 1'h0 -#define INT_STATUS_MAC_MSB 13 -#define INT_STATUS_MAC_LSB 13 -#define INT_STATUS_MAC_MASK 'h00002000 -#define INT_STATUS_MAC_GET(x) (((x) & INT_STATUS_MAC_MASK) >> INT_STATUS_MAC_LSB) -#define INT_STATUS_MAC_SET(x) (((32'd0 | (x)) << INT_STATUS_MAC_LSB) & INT_STATUS_MAC_MASK) -#define INT_STATUS_MAC_RESET 1'h0 -#define INT_STATUS_MAILBOX_MSB 12 -#define INT_STATUS_MAILBOX_LSB 12 -#define INT_STATUS_MAILBOX_MASK 'h00001000 -#define INT_STATUS_MAILBOX_GET(x) (((x) & INT_STATUS_MAILBOX_MASK) >> INT_STATUS_MAILBOX_LSB) -#define INT_STATUS_MAILBOX_SET(x) (((32'd0 | (x)) << INT_STATUS_MAILBOX_LSB) & INT_STATUS_MAILBOX_MASK) -#define INT_STATUS_MAILBOX_RESET 1'h0 -#define INT_STATUS_RTC_ALARM_MSB 11 -#define INT_STATUS_RTC_ALARM_LSB 11 -#define INT_STATUS_RTC_ALARM_MASK 'h00000800 -#define INT_STATUS_RTC_ALARM_GET(x) (((x) & INT_STATUS_RTC_ALARM_MASK) >> INT_STATUS_RTC_ALARM_LSB) -#define INT_STATUS_RTC_ALARM_SET(x) (((32'd0 | (x)) << INT_STATUS_RTC_ALARM_LSB) & INT_STATUS_RTC_ALARM_MASK) -#define INT_STATUS_RTC_ALARM_RESET 1'h0 -#define INT_STATUS_HF_TIMER_MSB 10 -#define INT_STATUS_HF_TIMER_LSB 10 -#define INT_STATUS_HF_TIMER_MASK 'h00000400 -#define INT_STATUS_HF_TIMER_GET(x) (((x) & INT_STATUS_HF_TIMER_MASK) >> INT_STATUS_HF_TIMER_LSB) -#define INT_STATUS_HF_TIMER_SET(x) (((32'd0 | (x)) << INT_STATUS_HF_TIMER_LSB) & INT_STATUS_HF_TIMER_MASK) -#define INT_STATUS_HF_TIMER_RESET 1'h0 -#define INT_STATUS_LF_TIMER3_MSB 9 -#define INT_STATUS_LF_TIMER3_LSB 9 -#define INT_STATUS_LF_TIMER3_MASK 'h00000200 -#define INT_STATUS_LF_TIMER3_GET(x) (((x) & INT_STATUS_LF_TIMER3_MASK) >> INT_STATUS_LF_TIMER3_LSB) -#define INT_STATUS_LF_TIMER3_SET(x) (((32'd0 | (x)) << INT_STATUS_LF_TIMER3_LSB) & INT_STATUS_LF_TIMER3_MASK) -#define INT_STATUS_LF_TIMER3_RESET 1'h0 -#define INT_STATUS_LF_TIMER2_MSB 8 -#define INT_STATUS_LF_TIMER2_LSB 8 -#define INT_STATUS_LF_TIMER2_MASK 'h00000100 -#define INT_STATUS_LF_TIMER2_GET(x) (((x) & INT_STATUS_LF_TIMER2_MASK) >> INT_STATUS_LF_TIMER2_LSB) -#define INT_STATUS_LF_TIMER2_SET(x) (((32'd0 | (x)) << INT_STATUS_LF_TIMER2_LSB) & INT_STATUS_LF_TIMER2_MASK) -#define INT_STATUS_LF_TIMER2_RESET 1'h0 -#define INT_STATUS_LF_TIMER1_MSB 7 -#define INT_STATUS_LF_TIMER1_LSB 7 -#define INT_STATUS_LF_TIMER1_MASK 'h00000080 -#define INT_STATUS_LF_TIMER1_GET(x) (((x) & INT_STATUS_LF_TIMER1_MASK) >> INT_STATUS_LF_TIMER1_LSB) -#define INT_STATUS_LF_TIMER1_SET(x) (((32'd0 | (x)) << INT_STATUS_LF_TIMER1_LSB) & INT_STATUS_LF_TIMER1_MASK) -#define INT_STATUS_LF_TIMER1_RESET 1'h0 -#define INT_STATUS_LF_TIMER0_MSB 6 -#define INT_STATUS_LF_TIMER0_LSB 6 -#define INT_STATUS_LF_TIMER0_MASK 'h00000040 -#define INT_STATUS_LF_TIMER0_GET(x) (((x) & INT_STATUS_LF_TIMER0_MASK) >> INT_STATUS_LF_TIMER0_LSB) -#define INT_STATUS_LF_TIMER0_SET(x) (((32'd0 | (x)) << INT_STATUS_LF_TIMER0_LSB) & INT_STATUS_LF_TIMER0_MASK) -#define INT_STATUS_LF_TIMER0_RESET 1'h0 -#define INT_STATUS_KEYPAD_MSB 5 -#define INT_STATUS_KEYPAD_LSB 5 -#define INT_STATUS_KEYPAD_MASK 'h00000020 -#define INT_STATUS_KEYPAD_GET(x) (((x) & INT_STATUS_KEYPAD_MASK) >> INT_STATUS_KEYPAD_LSB) -#define INT_STATUS_KEYPAD_SET(x) (((32'd0 | (x)) << INT_STATUS_KEYPAD_LSB) & INT_STATUS_KEYPAD_MASK) -#define INT_STATUS_KEYPAD_RESET 1'h0 -#define INT_STATUS_SI_MSB 4 -#define INT_STATUS_SI_LSB 4 -#define INT_STATUS_SI_MASK 'h00000010 -#define INT_STATUS_SI_GET(x) (((x) & INT_STATUS_SI_MASK) >> INT_STATUS_SI_LSB) -#define INT_STATUS_SI_SET(x) (((32'd0 | (x)) << INT_STATUS_SI_LSB) & INT_STATUS_SI_MASK) -#define INT_STATUS_SI_RESET 1'h0 -#define INT_STATUS_GPIO_MSB 3 -#define INT_STATUS_GPIO_LSB 3 -#define INT_STATUS_GPIO_MASK 'h00000008 -#define INT_STATUS_GPIO_GET(x) (((x) & INT_STATUS_GPIO_MASK) >> INT_STATUS_GPIO_LSB) -#define INT_STATUS_GPIO_SET(x) (((32'd0 | (x)) << INT_STATUS_GPIO_LSB) & INT_STATUS_GPIO_MASK) -#define INT_STATUS_GPIO_RESET 1'h0 -#define INT_STATUS_UART_MSB 2 -#define INT_STATUS_UART_LSB 2 -#define INT_STATUS_UART_MASK 'h00000004 -#define INT_STATUS_UART_GET(x) (((x) & INT_STATUS_UART_MASK) >> INT_STATUS_UART_LSB) -#define INT_STATUS_UART_SET(x) (((32'd0 | (x)) << INT_STATUS_UART_LSB) & INT_STATUS_UART_MASK) -#define INT_STATUS_UART_RESET 1'h0 -#define INT_STATUS_ERROR_MSB 1 -#define INT_STATUS_ERROR_LSB 1 -#define INT_STATUS_ERROR_MASK 'h00000002 -#define INT_STATUS_ERROR_GET(x) (((x) & INT_STATUS_ERROR_MASK) >> INT_STATUS_ERROR_LSB) -#define INT_STATUS_ERROR_SET(x) (((32'd0 | (x)) << INT_STATUS_ERROR_LSB) & INT_STATUS_ERROR_MASK) -#define INT_STATUS_ERROR_RESET 1'h0 -#define INT_STATUS_WDT_INT_MSB 0 -#define INT_STATUS_WDT_INT_LSB 0 -#define INT_STATUS_WDT_INT_MASK 'h00000001 -#define INT_STATUS_WDT_INT_GET(x) (((x) & INT_STATUS_WDT_INT_MASK) >> INT_STATUS_WDT_INT_LSB) -#define INT_STATUS_WDT_INT_SET(x) (((32'd0 | (x)) << INT_STATUS_WDT_INT_LSB) & INT_STATUS_WDT_INT_MASK) -#define INT_STATUS_WDT_INT_RESET 1'h0 -#define INT_STATUS_RESET (32'h0 | \ - INT_STATUS_RTC_POWER_SET(INT_STATUS_RTC_POWER_RESET) | \ - INT_STATUS_MAC_SET(INT_STATUS_MAC_RESET) | \ - INT_STATUS_MAILBOX_SET(INT_STATUS_MAILBOX_RESET) | \ - INT_STATUS_RTC_ALARM_SET(INT_STATUS_RTC_ALARM_RESET) | \ - INT_STATUS_HF_TIMER_SET(INT_STATUS_HF_TIMER_RESET) | \ - INT_STATUS_LF_TIMER3_SET(INT_STATUS_LF_TIMER3_RESET) | \ - INT_STATUS_LF_TIMER2_SET(INT_STATUS_LF_TIMER2_RESET) | \ - INT_STATUS_LF_TIMER1_SET(INT_STATUS_LF_TIMER1_RESET) | \ - INT_STATUS_LF_TIMER0_SET(INT_STATUS_LF_TIMER0_RESET) | \ - INT_STATUS_KEYPAD_SET(INT_STATUS_KEYPAD_RESET) | \ - INT_STATUS_SI_SET(INT_STATUS_SI_RESET) | \ - INT_STATUS_GPIO_SET(INT_STATUS_GPIO_RESET) | \ - INT_STATUS_UART_SET(INT_STATUS_UART_RESET) | \ - INT_STATUS_ERROR_SET(INT_STATUS_ERROR_RESET) | \ - INT_STATUS_WDT_INT_SET(INT_STATUS_WDT_INT_RESET)) -#define INT_STATUS_HW_MASK (32'h0 | \ - INT_STATUS_RTC_POWER_MASK | \ - INT_STATUS_MAC_MASK | \ - INT_STATUS_MAILBOX_MASK | \ - INT_STATUS_RTC_ALARM_MASK | \ - INT_STATUS_HF_TIMER_MASK | \ - INT_STATUS_LF_TIMER3_MASK | \ - INT_STATUS_LF_TIMER2_MASK | \ - INT_STATUS_LF_TIMER1_MASK | \ - INT_STATUS_LF_TIMER0_MASK | \ - INT_STATUS_KEYPAD_MASK | \ - INT_STATUS_SI_MASK | \ - INT_STATUS_GPIO_MASK | \ - INT_STATUS_UART_MASK | \ - INT_STATUS_ERROR_MASK | \ - INT_STATUS_WDT_INT_MASK) -#define INT_STATUS_SW_MASK (32'h0) - -#define LF_TIMER0_ADDRESS 'h00000048 -#define LF_TIMER0_TARGET_MSB 31 -#define LF_TIMER0_TARGET_LSB 0 -#define LF_TIMER0_TARGET_MASK 'hffffffff -#define LF_TIMER0_TARGET_GET(x) (((x) & LF_TIMER0_TARGET_MASK) >> LF_TIMER0_TARGET_LSB) -#define LF_TIMER0_TARGET_SET(x) (((32'd0 | (x)) << LF_TIMER0_TARGET_LSB) & LF_TIMER0_TARGET_MASK) -#define LF_TIMER0_TARGET_RESET 32'h0 -#define LF_TIMER0_RESET (32'h0 | \ - LF_TIMER0_TARGET_SET(LF_TIMER0_TARGET_RESET)) -#define LF_TIMER0_HW_MASK (32'h0) -#define LF_TIMER0_SW_MASK (32'h0 | \ - LF_TIMER0_TARGET_MASK) - -#define LF_TIMER_COUNT0_ADDRESS 'h0000004c -#define LF_TIMER_COUNT0_VALUE_MSB 31 -#define LF_TIMER_COUNT0_VALUE_LSB 0 -#define LF_TIMER_COUNT0_VALUE_MASK 'hffffffff -#define LF_TIMER_COUNT0_VALUE_GET(x) (((x) & LF_TIMER_COUNT0_VALUE_MASK) >> LF_TIMER_COUNT0_VALUE_LSB) -#define LF_TIMER_COUNT0_VALUE_SET(x) (((32'd0 | (x)) << LF_TIMER_COUNT0_VALUE_LSB) & LF_TIMER_COUNT0_VALUE_MASK) -#define LF_TIMER_COUNT0_VALUE_RESET 32'h0 -#define LF_TIMER_COUNT0_RESET (32'h0 | \ - LF_TIMER_COUNT0_VALUE_SET(LF_TIMER_COUNT0_VALUE_RESET)) -#define LF_TIMER_COUNT0_HW_MASK (32'h0 | \ - LF_TIMER_COUNT0_VALUE_MASK) -#define LF_TIMER_COUNT0_SW_MASK (32'h0) - -#define LF_TIMER_CONTROL0_ADDRESS 'h00000050 -#define LF_TIMER_CONTROL0_ENABLE_MSB 2 -#define LF_TIMER_CONTROL0_ENABLE_LSB 2 -#define LF_TIMER_CONTROL0_ENABLE_MASK 'h00000004 -#define LF_TIMER_CONTROL0_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL0_ENABLE_MASK) >> LF_TIMER_CONTROL0_ENABLE_LSB) -#define LF_TIMER_CONTROL0_ENABLE_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL0_ENABLE_LSB) & LF_TIMER_CONTROL0_ENABLE_MASK) -#define LF_TIMER_CONTROL0_ENABLE_RESET 1'h0 -#define LF_TIMER_CONTROL0_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL0_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL0_AUTO_RESTART_MASK 'h00000002 -#define LF_TIMER_CONTROL0_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL0_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL0_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL0_AUTO_RESTART_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL0_AUTO_RESTART_LSB) & LF_TIMER_CONTROL0_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL0_AUTO_RESTART_RESET 1'h0 -#define LF_TIMER_CONTROL0_RESET_MSB 0 -#define LF_TIMER_CONTROL0_RESET_LSB 0 -#define LF_TIMER_CONTROL0_RESET_MASK 'h00000001 -#define LF_TIMER_CONTROL0_RESET_GET(x) (((x) & LF_TIMER_CONTROL0_RESET_MASK) >> LF_TIMER_CONTROL0_RESET_LSB) -#define LF_TIMER_CONTROL0_RESET_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL0_RESET_LSB) & LF_TIMER_CONTROL0_RESET_MASK) -#define LF_TIMER_CONTROL0_RESET_RESET 1'h0 -#define LF_TIMER_CONTROL0_RESET (32'h0 | \ - LF_TIMER_CONTROL0_ENABLE_SET(LF_TIMER_CONTROL0_ENABLE_RESET) | \ - LF_TIMER_CONTROL0_AUTO_RESTART_SET(LF_TIMER_CONTROL0_AUTO_RESTART_RESET) | \ - LF_TIMER_CONTROL0_RESET_SET(LF_TIMER_CONTROL0_RESET_RESET)) -#define LF_TIMER_CONTROL0_HW_MASK (32'h0 | \ - LF_TIMER_CONTROL0_RESET_MASK) -#define LF_TIMER_CONTROL0_SW_MASK (32'h0 | \ - LF_TIMER_CONTROL0_ENABLE_MASK | \ - LF_TIMER_CONTROL0_AUTO_RESTART_MASK | \ - LF_TIMER_CONTROL0_RESET_MASK) - -#define LF_TIMER_STATUS0_ADDRESS 'h00000054 -#define LF_TIMER_STATUS0_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS0_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS0_INTERRUPT_MASK 'h00000001 -#define LF_TIMER_STATUS0_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS0_INTERRUPT_MASK) >> LF_TIMER_STATUS0_INTERRUPT_LSB) -#define LF_TIMER_STATUS0_INTERRUPT_SET(x) (((32'd0 | (x)) << LF_TIMER_STATUS0_INTERRUPT_LSB) & LF_TIMER_STATUS0_INTERRUPT_MASK) -#define LF_TIMER_STATUS0_INTERRUPT_RESET 1'h0 -#define LF_TIMER_STATUS0_RESET (32'h0 | \ - LF_TIMER_STATUS0_INTERRUPT_SET(LF_TIMER_STATUS0_INTERRUPT_RESET)) -#define LF_TIMER_STATUS0_HW_MASK (32'h0 | \ - LF_TIMER_STATUS0_INTERRUPT_MASK) -#define LF_TIMER_STATUS0_SW_MASK (32'h0 | \ - LF_TIMER_STATUS0_INTERRUPT_MASK) - -#define LF_TIMER1_ADDRESS 'h00000058 -#define LF_TIMER1_TARGET_MSB 31 -#define LF_TIMER1_TARGET_LSB 0 -#define LF_TIMER1_TARGET_MASK 'hffffffff -#define LF_TIMER1_TARGET_GET(x) (((x) & LF_TIMER1_TARGET_MASK) >> LF_TIMER1_TARGET_LSB) -#define LF_TIMER1_TARGET_SET(x) (((32'd0 | (x)) << LF_TIMER1_TARGET_LSB) & LF_TIMER1_TARGET_MASK) -#define LF_TIMER1_TARGET_RESET 32'h0 -#define LF_TIMER1_RESET (32'h0 | \ - LF_TIMER1_TARGET_SET(LF_TIMER1_TARGET_RESET)) -#define LF_TIMER1_HW_MASK (32'h0) -#define LF_TIMER1_SW_MASK (32'h0 | \ - LF_TIMER1_TARGET_MASK) - -#define LF_TIMER_COUNT1_ADDRESS 'h0000005c -#define LF_TIMER_COUNT1_VALUE_MSB 31 -#define LF_TIMER_COUNT1_VALUE_LSB 0 -#define LF_TIMER_COUNT1_VALUE_MASK 'hffffffff -#define LF_TIMER_COUNT1_VALUE_GET(x) (((x) & LF_TIMER_COUNT1_VALUE_MASK) >> LF_TIMER_COUNT1_VALUE_LSB) -#define LF_TIMER_COUNT1_VALUE_SET(x) (((32'd0 | (x)) << LF_TIMER_COUNT1_VALUE_LSB) & LF_TIMER_COUNT1_VALUE_MASK) -#define LF_TIMER_COUNT1_VALUE_RESET 32'h0 -#define LF_TIMER_COUNT1_RESET (32'h0 | \ - LF_TIMER_COUNT1_VALUE_SET(LF_TIMER_COUNT1_VALUE_RESET)) -#define LF_TIMER_COUNT1_HW_MASK (32'h0 | \ - LF_TIMER_COUNT1_VALUE_MASK) -#define LF_TIMER_COUNT1_SW_MASK (32'h0) - -#define LF_TIMER_CONTROL1_ADDRESS 'h00000060 -#define LF_TIMER_CONTROL1_ENABLE_MSB 2 -#define LF_TIMER_CONTROL1_ENABLE_LSB 2 -#define LF_TIMER_CONTROL1_ENABLE_MASK 'h00000004 -#define LF_TIMER_CONTROL1_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL1_ENABLE_MASK) >> LF_TIMER_CONTROL1_ENABLE_LSB) -#define LF_TIMER_CONTROL1_ENABLE_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL1_ENABLE_LSB) & LF_TIMER_CONTROL1_ENABLE_MASK) -#define LF_TIMER_CONTROL1_ENABLE_RESET 1'h0 -#define LF_TIMER_CONTROL1_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL1_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL1_AUTO_RESTART_MASK 'h00000002 -#define LF_TIMER_CONTROL1_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL1_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL1_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL1_AUTO_RESTART_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL1_AUTO_RESTART_LSB) & LF_TIMER_CONTROL1_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL1_AUTO_RESTART_RESET 1'h0 -#define LF_TIMER_CONTROL1_RESET_MSB 0 -#define LF_TIMER_CONTROL1_RESET_LSB 0 -#define LF_TIMER_CONTROL1_RESET_MASK 'h00000001 -#define LF_TIMER_CONTROL1_RESET_GET(x) (((x) & LF_TIMER_CONTROL1_RESET_MASK) >> LF_TIMER_CONTROL1_RESET_LSB) -#define LF_TIMER_CONTROL1_RESET_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL1_RESET_LSB) & LF_TIMER_CONTROL1_RESET_MASK) -#define LF_TIMER_CONTROL1_RESET_RESET 1'h0 -#define LF_TIMER_CONTROL1_RESET (32'h0 | \ - LF_TIMER_CONTROL1_ENABLE_SET(LF_TIMER_CONTROL1_ENABLE_RESET) | \ - LF_TIMER_CONTROL1_AUTO_RESTART_SET(LF_TIMER_CONTROL1_AUTO_RESTART_RESET) | \ - LF_TIMER_CONTROL1_RESET_SET(LF_TIMER_CONTROL1_RESET_RESET)) -#define LF_TIMER_CONTROL1_HW_MASK (32'h0 | \ - LF_TIMER_CONTROL1_RESET_MASK) -#define LF_TIMER_CONTROL1_SW_MASK (32'h0 | \ - LF_TIMER_CONTROL1_ENABLE_MASK | \ - LF_TIMER_CONTROL1_AUTO_RESTART_MASK | \ - LF_TIMER_CONTROL1_RESET_MASK) - -#define LF_TIMER_STATUS1_ADDRESS 'h00000064 -#define LF_TIMER_STATUS1_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS1_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS1_INTERRUPT_MASK 'h00000001 -#define LF_TIMER_STATUS1_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS1_INTERRUPT_MASK) >> LF_TIMER_STATUS1_INTERRUPT_LSB) -#define LF_TIMER_STATUS1_INTERRUPT_SET(x) (((32'd0 | (x)) << LF_TIMER_STATUS1_INTERRUPT_LSB) & LF_TIMER_STATUS1_INTERRUPT_MASK) -#define LF_TIMER_STATUS1_INTERRUPT_RESET 1'h0 -#define LF_TIMER_STATUS1_RESET (32'h0 | \ - LF_TIMER_STATUS1_INTERRUPT_SET(LF_TIMER_STATUS1_INTERRUPT_RESET)) -#define LF_TIMER_STATUS1_HW_MASK (32'h0 | \ - LF_TIMER_STATUS1_INTERRUPT_MASK) -#define LF_TIMER_STATUS1_SW_MASK (32'h0 | \ - LF_TIMER_STATUS1_INTERRUPT_MASK) - -#define LF_TIMER2_ADDRESS 'h00000068 -#define LF_TIMER2_TARGET_MSB 31 -#define LF_TIMER2_TARGET_LSB 0 -#define LF_TIMER2_TARGET_MASK 'hffffffff -#define LF_TIMER2_TARGET_GET(x) (((x) & LF_TIMER2_TARGET_MASK) >> LF_TIMER2_TARGET_LSB) -#define LF_TIMER2_TARGET_SET(x) (((32'd0 | (x)) << LF_TIMER2_TARGET_LSB) & LF_TIMER2_TARGET_MASK) -#define LF_TIMER2_TARGET_RESET 32'h0 -#define LF_TIMER2_RESET (32'h0 | \ - LF_TIMER2_TARGET_SET(LF_TIMER2_TARGET_RESET)) -#define LF_TIMER2_HW_MASK (32'h0) -#define LF_TIMER2_SW_MASK (32'h0 | \ - LF_TIMER2_TARGET_MASK) - -#define LF_TIMER_COUNT2_ADDRESS 'h0000006c -#define LF_TIMER_COUNT2_VALUE_MSB 31 -#define LF_TIMER_COUNT2_VALUE_LSB 0 -#define LF_TIMER_COUNT2_VALUE_MASK 'hffffffff -#define LF_TIMER_COUNT2_VALUE_GET(x) (((x) & LF_TIMER_COUNT2_VALUE_MASK) >> LF_TIMER_COUNT2_VALUE_LSB) -#define LF_TIMER_COUNT2_VALUE_SET(x) (((32'd0 | (x)) << LF_TIMER_COUNT2_VALUE_LSB) & LF_TIMER_COUNT2_VALUE_MASK) -#define LF_TIMER_COUNT2_VALUE_RESET 32'h0 -#define LF_TIMER_COUNT2_RESET (32'h0 | \ - LF_TIMER_COUNT2_VALUE_SET(LF_TIMER_COUNT2_VALUE_RESET)) -#define LF_TIMER_COUNT2_HW_MASK (32'h0 | \ - LF_TIMER_COUNT2_VALUE_MASK) -#define LF_TIMER_COUNT2_SW_MASK (32'h0) - -#define LF_TIMER_CONTROL2_ADDRESS 'h00000070 -#define LF_TIMER_CONTROL2_ENABLE_MSB 2 -#define LF_TIMER_CONTROL2_ENABLE_LSB 2 -#define LF_TIMER_CONTROL2_ENABLE_MASK 'h00000004 -#define LF_TIMER_CONTROL2_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL2_ENABLE_MASK) >> LF_TIMER_CONTROL2_ENABLE_LSB) -#define LF_TIMER_CONTROL2_ENABLE_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL2_ENABLE_LSB) & LF_TIMER_CONTROL2_ENABLE_MASK) -#define LF_TIMER_CONTROL2_ENABLE_RESET 1'h0 -#define LF_TIMER_CONTROL2_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL2_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL2_AUTO_RESTART_MASK 'h00000002 -#define LF_TIMER_CONTROL2_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL2_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL2_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL2_AUTO_RESTART_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL2_AUTO_RESTART_LSB) & LF_TIMER_CONTROL2_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL2_AUTO_RESTART_RESET 1'h0 -#define LF_TIMER_CONTROL2_RESET_MSB 0 -#define LF_TIMER_CONTROL2_RESET_LSB 0 -#define LF_TIMER_CONTROL2_RESET_MASK 'h00000001 -#define LF_TIMER_CONTROL2_RESET_GET(x) (((x) & LF_TIMER_CONTROL2_RESET_MASK) >> LF_TIMER_CONTROL2_RESET_LSB) -#define LF_TIMER_CONTROL2_RESET_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL2_RESET_LSB) & LF_TIMER_CONTROL2_RESET_MASK) -#define LF_TIMER_CONTROL2_RESET_RESET 1'h0 -#define LF_TIMER_CONTROL2_RESET (32'h0 | \ - LF_TIMER_CONTROL2_ENABLE_SET(LF_TIMER_CONTROL2_ENABLE_RESET) | \ - LF_TIMER_CONTROL2_AUTO_RESTART_SET(LF_TIMER_CONTROL2_AUTO_RESTART_RESET) | \ - LF_TIMER_CONTROL2_RESET_SET(LF_TIMER_CONTROL2_RESET_RESET)) -#define LF_TIMER_CONTROL2_HW_MASK (32'h0 | \ - LF_TIMER_CONTROL2_RESET_MASK) -#define LF_TIMER_CONTROL2_SW_MASK (32'h0 | \ - LF_TIMER_CONTROL2_ENABLE_MASK | \ - LF_TIMER_CONTROL2_AUTO_RESTART_MASK | \ - LF_TIMER_CONTROL2_RESET_MASK) - -#define LF_TIMER_STATUS2_ADDRESS 'h00000074 -#define LF_TIMER_STATUS2_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS2_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS2_INTERRUPT_MASK 'h00000001 -#define LF_TIMER_STATUS2_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS2_INTERRUPT_MASK) >> LF_TIMER_STATUS2_INTERRUPT_LSB) -#define LF_TIMER_STATUS2_INTERRUPT_SET(x) (((32'd0 | (x)) << LF_TIMER_STATUS2_INTERRUPT_LSB) & LF_TIMER_STATUS2_INTERRUPT_MASK) -#define LF_TIMER_STATUS2_INTERRUPT_RESET 1'h0 -#define LF_TIMER_STATUS2_RESET (32'h0 | \ - LF_TIMER_STATUS2_INTERRUPT_SET(LF_TIMER_STATUS2_INTERRUPT_RESET)) -#define LF_TIMER_STATUS2_HW_MASK (32'h0 | \ - LF_TIMER_STATUS2_INTERRUPT_MASK) -#define LF_TIMER_STATUS2_SW_MASK (32'h0 | \ - LF_TIMER_STATUS2_INTERRUPT_MASK) - -#define LF_TIMER3_ADDRESS 'h00000078 -#define LF_TIMER3_TARGET_MSB 31 -#define LF_TIMER3_TARGET_LSB 0 -#define LF_TIMER3_TARGET_MASK 'hffffffff -#define LF_TIMER3_TARGET_GET(x) (((x) & LF_TIMER3_TARGET_MASK) >> LF_TIMER3_TARGET_LSB) -#define LF_TIMER3_TARGET_SET(x) (((32'd0 | (x)) << LF_TIMER3_TARGET_LSB) & LF_TIMER3_TARGET_MASK) -#define LF_TIMER3_TARGET_RESET 32'h0 -#define LF_TIMER3_RESET (32'h0 | \ - LF_TIMER3_TARGET_SET(LF_TIMER3_TARGET_RESET)) -#define LF_TIMER3_HW_MASK (32'h0) -#define LF_TIMER3_SW_MASK (32'h0 | \ - LF_TIMER3_TARGET_MASK) - -#define LF_TIMER_COUNT3_ADDRESS 'h0000007c -#define LF_TIMER_COUNT3_VALUE_MSB 31 -#define LF_TIMER_COUNT3_VALUE_LSB 0 -#define LF_TIMER_COUNT3_VALUE_MASK 'hffffffff -#define LF_TIMER_COUNT3_VALUE_GET(x) (((x) & LF_TIMER_COUNT3_VALUE_MASK) >> LF_TIMER_COUNT3_VALUE_LSB) -#define LF_TIMER_COUNT3_VALUE_SET(x) (((32'd0 | (x)) << LF_TIMER_COUNT3_VALUE_LSB) & LF_TIMER_COUNT3_VALUE_MASK) -#define LF_TIMER_COUNT3_VALUE_RESET 32'h0 -#define LF_TIMER_COUNT3_RESET (32'h0 | \ - LF_TIMER_COUNT3_VALUE_SET(LF_TIMER_COUNT3_VALUE_RESET)) -#define LF_TIMER_COUNT3_HW_MASK (32'h0 | \ - LF_TIMER_COUNT3_VALUE_MASK) -#define LF_TIMER_COUNT3_SW_MASK (32'h0) - -#define LF_TIMER_CONTROL3_ADDRESS 'h00000080 -#define LF_TIMER_CONTROL3_ENABLE_MSB 2 -#define LF_TIMER_CONTROL3_ENABLE_LSB 2 -#define LF_TIMER_CONTROL3_ENABLE_MASK 'h00000004 -#define LF_TIMER_CONTROL3_ENABLE_GET(x) (((x) & LF_TIMER_CONTROL3_ENABLE_MASK) >> LF_TIMER_CONTROL3_ENABLE_LSB) -#define LF_TIMER_CONTROL3_ENABLE_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL3_ENABLE_LSB) & LF_TIMER_CONTROL3_ENABLE_MASK) -#define LF_TIMER_CONTROL3_ENABLE_RESET 1'h0 -#define LF_TIMER_CONTROL3_AUTO_RESTART_MSB 1 -#define LF_TIMER_CONTROL3_AUTO_RESTART_LSB 1 -#define LF_TIMER_CONTROL3_AUTO_RESTART_MASK 'h00000002 -#define LF_TIMER_CONTROL3_AUTO_RESTART_GET(x) (((x) & LF_TIMER_CONTROL3_AUTO_RESTART_MASK) >> LF_TIMER_CONTROL3_AUTO_RESTART_LSB) -#define LF_TIMER_CONTROL3_AUTO_RESTART_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL3_AUTO_RESTART_LSB) & LF_TIMER_CONTROL3_AUTO_RESTART_MASK) -#define LF_TIMER_CONTROL3_AUTO_RESTART_RESET 1'h0 -#define LF_TIMER_CONTROL3_RESET_MSB 0 -#define LF_TIMER_CONTROL3_RESET_LSB 0 -#define LF_TIMER_CONTROL3_RESET_MASK 'h00000001 -#define LF_TIMER_CONTROL3_RESET_GET(x) (((x) & LF_TIMER_CONTROL3_RESET_MASK) >> LF_TIMER_CONTROL3_RESET_LSB) -#define LF_TIMER_CONTROL3_RESET_SET(x) (((32'd0 | (x)) << LF_TIMER_CONTROL3_RESET_LSB) & LF_TIMER_CONTROL3_RESET_MASK) -#define LF_TIMER_CONTROL3_RESET_RESET 1'h0 -#define LF_TIMER_CONTROL3_RESET (32'h0 | \ - LF_TIMER_CONTROL3_ENABLE_SET(LF_TIMER_CONTROL3_ENABLE_RESET) | \ - LF_TIMER_CONTROL3_AUTO_RESTART_SET(LF_TIMER_CONTROL3_AUTO_RESTART_RESET) | \ - LF_TIMER_CONTROL3_RESET_SET(LF_TIMER_CONTROL3_RESET_RESET)) -#define LF_TIMER_CONTROL3_HW_MASK (32'h0 | \ - LF_TIMER_CONTROL3_RESET_MASK) -#define LF_TIMER_CONTROL3_SW_MASK (32'h0 | \ - LF_TIMER_CONTROL3_ENABLE_MASK | \ - LF_TIMER_CONTROL3_AUTO_RESTART_MASK | \ - LF_TIMER_CONTROL3_RESET_MASK) - -#define LF_TIMER_STATUS3_ADDRESS 'h00000084 -#define LF_TIMER_STATUS3_INTERRUPT_MSB 0 -#define LF_TIMER_STATUS3_INTERRUPT_LSB 0 -#define LF_TIMER_STATUS3_INTERRUPT_MASK 'h00000001 -#define LF_TIMER_STATUS3_INTERRUPT_GET(x) (((x) & LF_TIMER_STATUS3_INTERRUPT_MASK) >> LF_TIMER_STATUS3_INTERRUPT_LSB) -#define LF_TIMER_STATUS3_INTERRUPT_SET(x) (((32'd0 | (x)) << LF_TIMER_STATUS3_INTERRUPT_LSB) & LF_TIMER_STATUS3_INTERRUPT_MASK) -#define LF_TIMER_STATUS3_INTERRUPT_RESET 1'h0 -#define LF_TIMER_STATUS3_RESET (32'h0 | \ - LF_TIMER_STATUS3_INTERRUPT_SET(LF_TIMER_STATUS3_INTERRUPT_RESET)) -#define LF_TIMER_STATUS3_HW_MASK (32'h0 | \ - LF_TIMER_STATUS3_INTERRUPT_MASK) -#define LF_TIMER_STATUS3_SW_MASK (32'h0 | \ - LF_TIMER_STATUS3_INTERRUPT_MASK) - -#define HF_TIMER_ADDRESS 'h00000088 -#define HF_TIMER_TARGET_MSB 31 -#define HF_TIMER_TARGET_LSB 12 -#define HF_TIMER_TARGET_MASK 'hfffff000 -#define HF_TIMER_TARGET_GET(x) (((x) & HF_TIMER_TARGET_MASK) >> HF_TIMER_TARGET_LSB) -#define HF_TIMER_TARGET_SET(x) (((32'd0 | (x)) << HF_TIMER_TARGET_LSB) & HF_TIMER_TARGET_MASK) -#define HF_TIMER_TARGET_RESET 20'h0 -#define HF_TIMER_RESET (32'h0 | \ - HF_TIMER_TARGET_SET(HF_TIMER_TARGET_RESET)) -#define HF_TIMER_HW_MASK (32'h0) -#define HF_TIMER_SW_MASK (32'h0 | \ - HF_TIMER_TARGET_MASK) - -#define HF_TIMER_COUNT_ADDRESS 'h0000008c -#define HF_TIMER_COUNT_VALUE_MSB 31 -#define HF_TIMER_COUNT_VALUE_LSB 12 -#define HF_TIMER_COUNT_VALUE_MASK 'hfffff000 -#define HF_TIMER_COUNT_VALUE_GET(x) (((x) & HF_TIMER_COUNT_VALUE_MASK) >> HF_TIMER_COUNT_VALUE_LSB) -#define HF_TIMER_COUNT_VALUE_SET(x) (((32'd0 | (x)) << HF_TIMER_COUNT_VALUE_LSB) & HF_TIMER_COUNT_VALUE_MASK) -#define HF_TIMER_COUNT_VALUE_RESET 20'h0 -#define HF_TIMER_COUNT_RESET (32'h0 | \ - HF_TIMER_COUNT_VALUE_SET(HF_TIMER_COUNT_VALUE_RESET)) -#define HF_TIMER_COUNT_HW_MASK (32'h0 | \ - HF_TIMER_COUNT_VALUE_MASK) -#define HF_TIMER_COUNT_SW_MASK (32'h0) - -#define HF_LF_COUNT_ADDRESS 'h00000090 -#define HF_LF_COUNT_VALUE_MSB 31 -#define HF_LF_COUNT_VALUE_LSB 0 -#define HF_LF_COUNT_VALUE_MASK 'hffffffff -#define HF_LF_COUNT_VALUE_GET(x) (((x) & HF_LF_COUNT_VALUE_MASK) >> HF_LF_COUNT_VALUE_LSB) -#define HF_LF_COUNT_VALUE_SET(x) (((32'd0 | (x)) << HF_LF_COUNT_VALUE_LSB) & HF_LF_COUNT_VALUE_MASK) -#define HF_LF_COUNT_VALUE_RESET 32'h0 -#define HF_LF_COUNT_RESET (32'h0 | \ - HF_LF_COUNT_VALUE_SET(HF_LF_COUNT_VALUE_RESET)) -#define HF_LF_COUNT_HW_MASK (32'h0 | \ - HF_LF_COUNT_VALUE_MASK) -#define HF_LF_COUNT_SW_MASK (32'h0) - -#define HF_TIMER_CONTROL_ADDRESS 'h00000094 -#define HF_TIMER_CONTROL_ENABLE_MSB 3 -#define HF_TIMER_CONTROL_ENABLE_LSB 3 -#define HF_TIMER_CONTROL_ENABLE_MASK 'h00000008 -#define HF_TIMER_CONTROL_ENABLE_GET(x) (((x) & HF_TIMER_CONTROL_ENABLE_MASK) >> HF_TIMER_CONTROL_ENABLE_LSB) -#define HF_TIMER_CONTROL_ENABLE_SET(x) (((32'd0 | (x)) << HF_TIMER_CONTROL_ENABLE_LSB) & HF_TIMER_CONTROL_ENABLE_MASK) -#define HF_TIMER_CONTROL_ENABLE_RESET 1'h1 -#define HF_TIMER_CONTROL_ON_MSB 2 -#define HF_TIMER_CONTROL_ON_LSB 2 -#define HF_TIMER_CONTROL_ON_MASK 'h00000004 -#define HF_TIMER_CONTROL_ON_GET(x) (((x) & HF_TIMER_CONTROL_ON_MASK) >> HF_TIMER_CONTROL_ON_LSB) -#define HF_TIMER_CONTROL_ON_SET(x) (((32'd0 | (x)) << HF_TIMER_CONTROL_ON_LSB) & HF_TIMER_CONTROL_ON_MASK) -#define HF_TIMER_CONTROL_ON_RESET 1'h0 -#define HF_TIMER_CONTROL_AUTO_RESTART_MSB 1 -#define HF_TIMER_CONTROL_AUTO_RESTART_LSB 1 -#define HF_TIMER_CONTROL_AUTO_RESTART_MASK 'h00000002 -#define HF_TIMER_CONTROL_AUTO_RESTART_GET(x) (((x) & HF_TIMER_CONTROL_AUTO_RESTART_MASK) >> HF_TIMER_CONTROL_AUTO_RESTART_LSB) -#define HF_TIMER_CONTROL_AUTO_RESTART_SET(x) (((32'd0 | (x)) << HF_TIMER_CONTROL_AUTO_RESTART_LSB) & HF_TIMER_CONTROL_AUTO_RESTART_MASK) -#define HF_TIMER_CONTROL_AUTO_RESTART_RESET 1'h0 -#define HF_TIMER_CONTROL_RESET_MSB 0 -#define HF_TIMER_CONTROL_RESET_LSB 0 -#define HF_TIMER_CONTROL_RESET_MASK 'h00000001 -#define HF_TIMER_CONTROL_RESET_GET(x) (((x) & HF_TIMER_CONTROL_RESET_MASK) >> HF_TIMER_CONTROL_RESET_LSB) -#define HF_TIMER_CONTROL_RESET_SET(x) (((32'd0 | (x)) << HF_TIMER_CONTROL_RESET_LSB) & HF_TIMER_CONTROL_RESET_MASK) -#define HF_TIMER_CONTROL_RESET_RESET 1'h0 -#define HF_TIMER_CONTROL_RESET (32'h0 | \ - HF_TIMER_CONTROL_ENABLE_SET(HF_TIMER_CONTROL_ENABLE_RESET) | \ - HF_TIMER_CONTROL_ON_SET(HF_TIMER_CONTROL_ON_RESET) | \ - HF_TIMER_CONTROL_AUTO_RESTART_SET(HF_TIMER_CONTROL_AUTO_RESTART_RESET) | \ - HF_TIMER_CONTROL_RESET_SET(HF_TIMER_CONTROL_RESET_RESET)) -#define HF_TIMER_CONTROL_HW_MASK (32'h0 | \ - HF_TIMER_CONTROL_RESET_MASK) -#define HF_TIMER_CONTROL_SW_MASK (32'h0 | \ - HF_TIMER_CONTROL_ENABLE_MASK | \ - HF_TIMER_CONTROL_ON_MASK | \ - HF_TIMER_CONTROL_AUTO_RESTART_MASK | \ - HF_TIMER_CONTROL_RESET_MASK) - -#define HF_TIMER_STATUS_ADDRESS 'h00000098 -#define HF_TIMER_STATUS_INTERRUPT_MSB 0 -#define HF_TIMER_STATUS_INTERRUPT_LSB 0 -#define HF_TIMER_STATUS_INTERRUPT_MASK 'h00000001 -#define HF_TIMER_STATUS_INTERRUPT_GET(x) (((x) & HF_TIMER_STATUS_INTERRUPT_MASK) >> HF_TIMER_STATUS_INTERRUPT_LSB) -#define HF_TIMER_STATUS_INTERRUPT_SET(x) (((32'd0 | (x)) << HF_TIMER_STATUS_INTERRUPT_LSB) & HF_TIMER_STATUS_INTERRUPT_MASK) -#define HF_TIMER_STATUS_INTERRUPT_RESET 1'h0 -#define HF_TIMER_STATUS_RESET (32'h0 | \ - HF_TIMER_STATUS_INTERRUPT_SET(HF_TIMER_STATUS_INTERRUPT_RESET)) -#define HF_TIMER_STATUS_HW_MASK (32'h0 | \ - HF_TIMER_STATUS_INTERRUPT_MASK) -#define HF_TIMER_STATUS_SW_MASK (32'h0 | \ - HF_TIMER_STATUS_INTERRUPT_MASK) - -#define RTC_CONTROL_ADDRESS 'h0000009c -#define RTC_CONTROL_ENABLE_MSB 2 -#define RTC_CONTROL_ENABLE_LSB 2 -#define RTC_CONTROL_ENABLE_MASK 'h00000004 -#define RTC_CONTROL_ENABLE_GET(x) (((x) & RTC_CONTROL_ENABLE_MASK) >> RTC_CONTROL_ENABLE_LSB) -#define RTC_CONTROL_ENABLE_SET(x) (((32'd0 | (x)) << RTC_CONTROL_ENABLE_LSB) & RTC_CONTROL_ENABLE_MASK) -#define RTC_CONTROL_ENABLE_RESET 1'h0 -#define RTC_CONTROL_LOAD_RTC_MSB 1 -#define RTC_CONTROL_LOAD_RTC_LSB 1 -#define RTC_CONTROL_LOAD_RTC_MASK 'h00000002 -#define RTC_CONTROL_LOAD_RTC_GET(x) (((x) & RTC_CONTROL_LOAD_RTC_MASK) >> RTC_CONTROL_LOAD_RTC_LSB) -#define RTC_CONTROL_LOAD_RTC_SET(x) (((32'd0 | (x)) << RTC_CONTROL_LOAD_RTC_LSB) & RTC_CONTROL_LOAD_RTC_MASK) -#define RTC_CONTROL_LOAD_RTC_RESET 1'h0 -#define RTC_CONTROL_LOAD_ALARM_MSB 0 -#define RTC_CONTROL_LOAD_ALARM_LSB 0 -#define RTC_CONTROL_LOAD_ALARM_MASK 'h00000001 -#define RTC_CONTROL_LOAD_ALARM_GET(x) (((x) & RTC_CONTROL_LOAD_ALARM_MASK) >> RTC_CONTROL_LOAD_ALARM_LSB) -#define RTC_CONTROL_LOAD_ALARM_SET(x) (((32'd0 | (x)) << RTC_CONTROL_LOAD_ALARM_LSB) & RTC_CONTROL_LOAD_ALARM_MASK) -#define RTC_CONTROL_LOAD_ALARM_RESET 1'h0 -#define RTC_CONTROL_RESET (32'h0 | \ - RTC_CONTROL_ENABLE_SET(RTC_CONTROL_ENABLE_RESET) | \ - RTC_CONTROL_LOAD_RTC_SET(RTC_CONTROL_LOAD_RTC_RESET) | \ - RTC_CONTROL_LOAD_ALARM_SET(RTC_CONTROL_LOAD_ALARM_RESET)) -#define RTC_CONTROL_HW_MASK (32'h0 | \ - RTC_CONTROL_LOAD_RTC_MASK | \ - RTC_CONTROL_LOAD_ALARM_MASK) -#define RTC_CONTROL_SW_MASK (32'h0 | \ - RTC_CONTROL_ENABLE_MASK | \ - RTC_CONTROL_LOAD_RTC_MASK | \ - RTC_CONTROL_LOAD_ALARM_MASK) - -#define RTC_TIME_ADDRESS 'h000000a0 -#define RTC_TIME_WEEK_DAY_MSB 26 -#define RTC_TIME_WEEK_DAY_LSB 24 -#define RTC_TIME_WEEK_DAY_MASK 'h07000000 -#define RTC_TIME_WEEK_DAY_GET(x) (((x) & RTC_TIME_WEEK_DAY_MASK) >> RTC_TIME_WEEK_DAY_LSB) -#define RTC_TIME_WEEK_DAY_SET(x) (((32'd0 | (x)) << RTC_TIME_WEEK_DAY_LSB) & RTC_TIME_WEEK_DAY_MASK) -#define RTC_TIME_WEEK_DAY_RESET 3'h1 -#define RTC_TIME_HOUR_MSB 21 -#define RTC_TIME_HOUR_LSB 16 -#define RTC_TIME_HOUR_MASK 'h003f0000 -#define RTC_TIME_HOUR_GET(x) (((x) & RTC_TIME_HOUR_MASK) >> RTC_TIME_HOUR_LSB) -#define RTC_TIME_HOUR_SET(x) (((32'd0 | (x)) << RTC_TIME_HOUR_LSB) & RTC_TIME_HOUR_MASK) -#define RTC_TIME_HOUR_RESET 6'h12 -#define RTC_TIME_MINUTE_MSB 14 -#define RTC_TIME_MINUTE_LSB 8 -#define RTC_TIME_MINUTE_MASK 'h00007f00 -#define RTC_TIME_MINUTE_GET(x) (((x) & RTC_TIME_MINUTE_MASK) >> RTC_TIME_MINUTE_LSB) -#define RTC_TIME_MINUTE_SET(x) (((32'd0 | (x)) << RTC_TIME_MINUTE_LSB) & RTC_TIME_MINUTE_MASK) -#define RTC_TIME_MINUTE_RESET 7'h0 -#define RTC_TIME_SECOND_MSB 6 -#define RTC_TIME_SECOND_LSB 0 -#define RTC_TIME_SECOND_MASK 'h0000007f -#define RTC_TIME_SECOND_GET(x) (((x) & RTC_TIME_SECOND_MASK) >> RTC_TIME_SECOND_LSB) -#define RTC_TIME_SECOND_SET(x) (((32'd0 | (x)) << RTC_TIME_SECOND_LSB) & RTC_TIME_SECOND_MASK) -#define RTC_TIME_SECOND_RESET 7'h0 -#define RTC_TIME_RESET (32'h0 | \ - RTC_TIME_WEEK_DAY_SET(RTC_TIME_WEEK_DAY_RESET) | \ - RTC_TIME_HOUR_SET(RTC_TIME_HOUR_RESET) | \ - RTC_TIME_MINUTE_SET(RTC_TIME_MINUTE_RESET) | \ - RTC_TIME_SECOND_SET(RTC_TIME_SECOND_RESET)) -#define RTC_TIME_HW_MASK (32'h0 | \ - RTC_TIME_WEEK_DAY_MASK | \ - RTC_TIME_HOUR_MASK | \ - RTC_TIME_MINUTE_MASK | \ - RTC_TIME_SECOND_MASK) -#define RTC_TIME_SW_MASK (32'h0) - -#define RTC_DATE_ADDRESS 'h000000a4 -#define RTC_DATE_YEAR_MSB 23 -#define RTC_DATE_YEAR_LSB 16 -#define RTC_DATE_YEAR_MASK 'h00ff0000 -#define RTC_DATE_YEAR_GET(x) (((x) & RTC_DATE_YEAR_MASK) >> RTC_DATE_YEAR_LSB) -#define RTC_DATE_YEAR_SET(x) (((32'd0 | (x)) << RTC_DATE_YEAR_LSB) & RTC_DATE_YEAR_MASK) -#define RTC_DATE_YEAR_RESET 8'h0 -#define RTC_DATE_MONTH_MSB 12 -#define RTC_DATE_MONTH_LSB 8 -#define RTC_DATE_MONTH_MASK 'h00001f00 -#define RTC_DATE_MONTH_GET(x) (((x) & RTC_DATE_MONTH_MASK) >> RTC_DATE_MONTH_LSB) -#define RTC_DATE_MONTH_SET(x) (((32'd0 | (x)) << RTC_DATE_MONTH_LSB) & RTC_DATE_MONTH_MASK) -#define RTC_DATE_MONTH_RESET 5'h1 -#define RTC_DATE_MONTH_DAY_MSB 5 -#define RTC_DATE_MONTH_DAY_LSB 0 -#define RTC_DATE_MONTH_DAY_MASK 'h0000003f -#define RTC_DATE_MONTH_DAY_GET(x) (((x) & RTC_DATE_MONTH_DAY_MASK) >> RTC_DATE_MONTH_DAY_LSB) -#define RTC_DATE_MONTH_DAY_SET(x) (((32'd0 | (x)) << RTC_DATE_MONTH_DAY_LSB) & RTC_DATE_MONTH_DAY_MASK) -#define RTC_DATE_MONTH_DAY_RESET 6'h1 -#define RTC_DATE_RESET (32'h0 | \ - RTC_DATE_YEAR_SET(RTC_DATE_YEAR_RESET) | \ - RTC_DATE_MONTH_SET(RTC_DATE_MONTH_RESET) | \ - RTC_DATE_MONTH_DAY_SET(RTC_DATE_MONTH_DAY_RESET)) -#define RTC_DATE_HW_MASK (32'h0 | \ - RTC_DATE_YEAR_MASK | \ - RTC_DATE_MONTH_MASK | \ - RTC_DATE_MONTH_DAY_MASK) -#define RTC_DATE_SW_MASK (32'h0) - -#define RTC_SET_TIME_ADDRESS 'h000000a8 -#define RTC_SET_TIME_WEEK_DAY_MSB 26 -#define RTC_SET_TIME_WEEK_DAY_LSB 24 -#define RTC_SET_TIME_WEEK_DAY_MASK 'h07000000 -#define RTC_SET_TIME_WEEK_DAY_GET(x) (((x) & RTC_SET_TIME_WEEK_DAY_MASK) >> RTC_SET_TIME_WEEK_DAY_LSB) -#define RTC_SET_TIME_WEEK_DAY_SET(x) (((32'd0 | (x)) << RTC_SET_TIME_WEEK_DAY_LSB) & RTC_SET_TIME_WEEK_DAY_MASK) -#define RTC_SET_TIME_WEEK_DAY_RESET 3'h1 -#define RTC_SET_TIME_HOUR_MSB 21 -#define RTC_SET_TIME_HOUR_LSB 16 -#define RTC_SET_TIME_HOUR_MASK 'h003f0000 -#define RTC_SET_TIME_HOUR_GET(x) (((x) & RTC_SET_TIME_HOUR_MASK) >> RTC_SET_TIME_HOUR_LSB) -#define RTC_SET_TIME_HOUR_SET(x) (((32'd0 | (x)) << RTC_SET_TIME_HOUR_LSB) & RTC_SET_TIME_HOUR_MASK) -#define RTC_SET_TIME_HOUR_RESET 6'h0 -#define RTC_SET_TIME_MINUTE_MSB 14 -#define RTC_SET_TIME_MINUTE_LSB 8 -#define RTC_SET_TIME_MINUTE_MASK 'h00007f00 -#define RTC_SET_TIME_MINUTE_GET(x) (((x) & RTC_SET_TIME_MINUTE_MASK) >> RTC_SET_TIME_MINUTE_LSB) -#define RTC_SET_TIME_MINUTE_SET(x) (((32'd0 | (x)) << RTC_SET_TIME_MINUTE_LSB) & RTC_SET_TIME_MINUTE_MASK) -#define RTC_SET_TIME_MINUTE_RESET 7'h0 -#define RTC_SET_TIME_SECOND_MSB 6 -#define RTC_SET_TIME_SECOND_LSB 0 -#define RTC_SET_TIME_SECOND_MASK 'h0000007f -#define RTC_SET_TIME_SECOND_GET(x) (((x) & RTC_SET_TIME_SECOND_MASK) >> RTC_SET_TIME_SECOND_LSB) -#define RTC_SET_TIME_SECOND_SET(x) (((32'd0 | (x)) << RTC_SET_TIME_SECOND_LSB) & RTC_SET_TIME_SECOND_MASK) -#define RTC_SET_TIME_SECOND_RESET 7'h0 -#define RTC_SET_TIME_RESET (32'h0 | \ - RTC_SET_TIME_WEEK_DAY_SET(RTC_SET_TIME_WEEK_DAY_RESET) | \ - RTC_SET_TIME_HOUR_SET(RTC_SET_TIME_HOUR_RESET) | \ - RTC_SET_TIME_MINUTE_SET(RTC_SET_TIME_MINUTE_RESET) | \ - RTC_SET_TIME_SECOND_SET(RTC_SET_TIME_SECOND_RESET)) -#define RTC_SET_TIME_HW_MASK (32'h0) -#define RTC_SET_TIME_SW_MASK (32'h0 | \ - RTC_SET_TIME_WEEK_DAY_MASK | \ - RTC_SET_TIME_HOUR_MASK | \ - RTC_SET_TIME_MINUTE_MASK | \ - RTC_SET_TIME_SECOND_MASK) - -#define RTC_SET_DATE_ADDRESS 'h000000ac -#define RTC_SET_DATE_YEAR_MSB 23 -#define RTC_SET_DATE_YEAR_LSB 16 -#define RTC_SET_DATE_YEAR_MASK 'h00ff0000 -#define RTC_SET_DATE_YEAR_GET(x) (((x) & RTC_SET_DATE_YEAR_MASK) >> RTC_SET_DATE_YEAR_LSB) -#define RTC_SET_DATE_YEAR_SET(x) (((32'd0 | (x)) << RTC_SET_DATE_YEAR_LSB) & RTC_SET_DATE_YEAR_MASK) -#define RTC_SET_DATE_YEAR_RESET 8'h0 -#define RTC_SET_DATE_MONTH_MSB 12 -#define RTC_SET_DATE_MONTH_LSB 8 -#define RTC_SET_DATE_MONTH_MASK 'h00001f00 -#define RTC_SET_DATE_MONTH_GET(x) (((x) & RTC_SET_DATE_MONTH_MASK) >> RTC_SET_DATE_MONTH_LSB) -#define RTC_SET_DATE_MONTH_SET(x) (((32'd0 | (x)) << RTC_SET_DATE_MONTH_LSB) & RTC_SET_DATE_MONTH_MASK) -#define RTC_SET_DATE_MONTH_RESET 5'h1 -#define RTC_SET_DATE_MONTH_DAY_MSB 5 -#define RTC_SET_DATE_MONTH_DAY_LSB 0 -#define RTC_SET_DATE_MONTH_DAY_MASK 'h0000003f -#define RTC_SET_DATE_MONTH_DAY_GET(x) (((x) & RTC_SET_DATE_MONTH_DAY_MASK) >> RTC_SET_DATE_MONTH_DAY_LSB) -#define RTC_SET_DATE_MONTH_DAY_SET(x) (((32'd0 | (x)) << RTC_SET_DATE_MONTH_DAY_LSB) & RTC_SET_DATE_MONTH_DAY_MASK) -#define RTC_SET_DATE_MONTH_DAY_RESET 6'h1 -#define RTC_SET_DATE_RESET (32'h0 | \ - RTC_SET_DATE_YEAR_SET(RTC_SET_DATE_YEAR_RESET) | \ - RTC_SET_DATE_MONTH_SET(RTC_SET_DATE_MONTH_RESET) | \ - RTC_SET_DATE_MONTH_DAY_SET(RTC_SET_DATE_MONTH_DAY_RESET)) -#define RTC_SET_DATE_HW_MASK (32'h0) -#define RTC_SET_DATE_SW_MASK (32'h0 | \ - RTC_SET_DATE_YEAR_MASK | \ - RTC_SET_DATE_MONTH_MASK | \ - RTC_SET_DATE_MONTH_DAY_MASK) - -#define RTC_SET_ALARM_ADDRESS 'h000000b0 -#define RTC_SET_ALARM_HOUR_MSB 21 -#define RTC_SET_ALARM_HOUR_LSB 16 -#define RTC_SET_ALARM_HOUR_MASK 'h003f0000 -#define RTC_SET_ALARM_HOUR_GET(x) (((x) & RTC_SET_ALARM_HOUR_MASK) >> RTC_SET_ALARM_HOUR_LSB) -#define RTC_SET_ALARM_HOUR_SET(x) (((32'd0 | (x)) << RTC_SET_ALARM_HOUR_LSB) & RTC_SET_ALARM_HOUR_MASK) -#define RTC_SET_ALARM_HOUR_RESET 6'h0 -#define RTC_SET_ALARM_MINUTE_MSB 14 -#define RTC_SET_ALARM_MINUTE_LSB 8 -#define RTC_SET_ALARM_MINUTE_MASK 'h00007f00 -#define RTC_SET_ALARM_MINUTE_GET(x) (((x) & RTC_SET_ALARM_MINUTE_MASK) >> RTC_SET_ALARM_MINUTE_LSB) -#define RTC_SET_ALARM_MINUTE_SET(x) (((32'd0 | (x)) << RTC_SET_ALARM_MINUTE_LSB) & RTC_SET_ALARM_MINUTE_MASK) -#define RTC_SET_ALARM_MINUTE_RESET 7'h0 -#define RTC_SET_ALARM_SECOND_MSB 6 -#define RTC_SET_ALARM_SECOND_LSB 0 -#define RTC_SET_ALARM_SECOND_MASK 'h0000007f -#define RTC_SET_ALARM_SECOND_GET(x) (((x) & RTC_SET_ALARM_SECOND_MASK) >> RTC_SET_ALARM_SECOND_LSB) -#define RTC_SET_ALARM_SECOND_SET(x) (((32'd0 | (x)) << RTC_SET_ALARM_SECOND_LSB) & RTC_SET_ALARM_SECOND_MASK) -#define RTC_SET_ALARM_SECOND_RESET 7'h0 -#define RTC_SET_ALARM_RESET (32'h0 | \ - RTC_SET_ALARM_HOUR_SET(RTC_SET_ALARM_HOUR_RESET) | \ - RTC_SET_ALARM_MINUTE_SET(RTC_SET_ALARM_MINUTE_RESET) | \ - RTC_SET_ALARM_SECOND_SET(RTC_SET_ALARM_SECOND_RESET)) -#define RTC_SET_ALARM_HW_MASK (32'h0) -#define RTC_SET_ALARM_SW_MASK (32'h0 | \ - RTC_SET_ALARM_HOUR_MASK | \ - RTC_SET_ALARM_MINUTE_MASK | \ - RTC_SET_ALARM_SECOND_MASK) - -#define RTC_CONFIG_ADDRESS 'h000000b4 -#define RTC_CONFIG_BCD_MSB 2 -#define RTC_CONFIG_BCD_LSB 2 -#define RTC_CONFIG_BCD_MASK 'h00000004 -#define RTC_CONFIG_BCD_GET(x) (((x) & RTC_CONFIG_BCD_MASK) >> RTC_CONFIG_BCD_LSB) -#define RTC_CONFIG_BCD_SET(x) (((32'd0 | (x)) << RTC_CONFIG_BCD_LSB) & RTC_CONFIG_BCD_MASK) -#define RTC_CONFIG_BCD_RESET 1'h1 -#define RTC_CONFIG_TWELVE_HOUR_MSB 1 -#define RTC_CONFIG_TWELVE_HOUR_LSB 1 -#define RTC_CONFIG_TWELVE_HOUR_MASK 'h00000002 -#define RTC_CONFIG_TWELVE_HOUR_GET(x) (((x) & RTC_CONFIG_TWELVE_HOUR_MASK) >> RTC_CONFIG_TWELVE_HOUR_LSB) -#define RTC_CONFIG_TWELVE_HOUR_SET(x) (((32'd0 | (x)) << RTC_CONFIG_TWELVE_HOUR_LSB) & RTC_CONFIG_TWELVE_HOUR_MASK) -#define RTC_CONFIG_TWELVE_HOUR_RESET 1'h1 -#define RTC_CONFIG_DSE_MSB 0 -#define RTC_CONFIG_DSE_LSB 0 -#define RTC_CONFIG_DSE_MASK 'h00000001 -#define RTC_CONFIG_DSE_GET(x) (((x) & RTC_CONFIG_DSE_MASK) >> RTC_CONFIG_DSE_LSB) -#define RTC_CONFIG_DSE_SET(x) (((32'd0 | (x)) << RTC_CONFIG_DSE_LSB) & RTC_CONFIG_DSE_MASK) -#define RTC_CONFIG_DSE_RESET 1'h1 -#define RTC_CONFIG_RESET (32'h0 | \ - RTC_CONFIG_BCD_SET(RTC_CONFIG_BCD_RESET) | \ - RTC_CONFIG_TWELVE_HOUR_SET(RTC_CONFIG_TWELVE_HOUR_RESET) | \ - RTC_CONFIG_DSE_SET(RTC_CONFIG_DSE_RESET)) -#define RTC_CONFIG_HW_MASK (32'h0) -#define RTC_CONFIG_SW_MASK (32'h0 | \ - RTC_CONFIG_BCD_MASK | \ - RTC_CONFIG_TWELVE_HOUR_MASK | \ - RTC_CONFIG_DSE_MASK) - -#define RTC_ALARM_STATUS_ADDRESS 'h000000b8 -#define RTC_ALARM_STATUS_ENABLE_MSB 1 -#define RTC_ALARM_STATUS_ENABLE_LSB 1 -#define RTC_ALARM_STATUS_ENABLE_MASK 'h00000002 -#define RTC_ALARM_STATUS_ENABLE_GET(x) (((x) & RTC_ALARM_STATUS_ENABLE_MASK) >> RTC_ALARM_STATUS_ENABLE_LSB) -#define RTC_ALARM_STATUS_ENABLE_SET(x) (((32'd0 | (x)) << RTC_ALARM_STATUS_ENABLE_LSB) & RTC_ALARM_STATUS_ENABLE_MASK) -#define RTC_ALARM_STATUS_ENABLE_RESET 1'h0 -#define RTC_ALARM_STATUS_INTERRUPT_MSB 0 -#define RTC_ALARM_STATUS_INTERRUPT_LSB 0 -#define RTC_ALARM_STATUS_INTERRUPT_MASK 'h00000001 -#define RTC_ALARM_STATUS_INTERRUPT_GET(x) (((x) & RTC_ALARM_STATUS_INTERRUPT_MASK) >> RTC_ALARM_STATUS_INTERRUPT_LSB) -#define RTC_ALARM_STATUS_INTERRUPT_SET(x) (((32'd0 | (x)) << RTC_ALARM_STATUS_INTERRUPT_LSB) & RTC_ALARM_STATUS_INTERRUPT_MASK) -#define RTC_ALARM_STATUS_INTERRUPT_RESET 1'h0 -#define RTC_ALARM_STATUS_RESET (32'h0 | \ - RTC_ALARM_STATUS_ENABLE_SET(RTC_ALARM_STATUS_ENABLE_RESET) | \ - RTC_ALARM_STATUS_INTERRUPT_SET(RTC_ALARM_STATUS_INTERRUPT_RESET)) -#define RTC_ALARM_STATUS_HW_MASK (32'h0 | \ - RTC_ALARM_STATUS_ENABLE_MASK | \ - RTC_ALARM_STATUS_INTERRUPT_MASK) -#define RTC_ALARM_STATUS_SW_MASK (32'h0 | \ - RTC_ALARM_STATUS_ENABLE_MASK | \ - RTC_ALARM_STATUS_INTERRUPT_MASK) - -#define UART_WAKEUP_ADDRESS 'h000000bc -#define UART_WAKEUP_ENABLE_MSB 0 -#define UART_WAKEUP_ENABLE_LSB 0 -#define UART_WAKEUP_ENABLE_MASK 'h00000001 -#define UART_WAKEUP_ENABLE_GET(x) (((x) & UART_WAKEUP_ENABLE_MASK) >> UART_WAKEUP_ENABLE_LSB) -#define UART_WAKEUP_ENABLE_SET(x) (((32'd0 | (x)) << UART_WAKEUP_ENABLE_LSB) & UART_WAKEUP_ENABLE_MASK) -#define UART_WAKEUP_ENABLE_RESET 1'h0 -#define UART_WAKEUP_RESET (32'h0 | \ - UART_WAKEUP_ENABLE_SET(UART_WAKEUP_ENABLE_RESET)) -#define UART_WAKEUP_HW_MASK (32'h0) -#define UART_WAKEUP_SW_MASK (32'h0 | \ - UART_WAKEUP_ENABLE_MASK) - -#define RESET_CAUSE_ADDRESS 'h000000c0 -#define RESET_CAUSE_LAST_MSB 2 -#define RESET_CAUSE_LAST_LSB 0 -#define RESET_CAUSE_LAST_MASK 'h00000007 -#define RESET_CAUSE_LAST_GET(x) (((x) & RESET_CAUSE_LAST_MASK) >> RESET_CAUSE_LAST_LSB) -#define RESET_CAUSE_LAST_SET(x) (((32'd0 | (x)) << RESET_CAUSE_LAST_LSB) & RESET_CAUSE_LAST_MASK) -#define RESET_CAUSE_LAST_RESET 3'h0 -#define RESET_CAUSE_RESET (32'h0 | \ - RESET_CAUSE_LAST_SET(RESET_CAUSE_LAST_RESET)) -#define RESET_CAUSE_HW_MASK (32'h0 | \ - RESET_CAUSE_LAST_MASK) -#define RESET_CAUSE_SW_MASK (32'h0) - -#define SYSTEM_SLEEP_ADDRESS 'h000000c4 -#define SYSTEM_SLEEP_HOST_IF_MSB 4 -#define SYSTEM_SLEEP_HOST_IF_LSB 4 -#define SYSTEM_SLEEP_HOST_IF_MASK 'h00000010 -#define SYSTEM_SLEEP_HOST_IF_GET(x) (((x) & SYSTEM_SLEEP_HOST_IF_MASK) >> SYSTEM_SLEEP_HOST_IF_LSB) -#define SYSTEM_SLEEP_HOST_IF_SET(x) (((32'd0 | (x)) << SYSTEM_SLEEP_HOST_IF_LSB) & SYSTEM_SLEEP_HOST_IF_MASK) -#define SYSTEM_SLEEP_HOST_IF_RESET 1'h1 -#define SYSTEM_SLEEP_MBOX_MSB 3 -#define SYSTEM_SLEEP_MBOX_LSB 3 -#define SYSTEM_SLEEP_MBOX_MASK 'h00000008 -#define SYSTEM_SLEEP_MBOX_GET(x) (((x) & SYSTEM_SLEEP_MBOX_MASK) >> SYSTEM_SLEEP_MBOX_LSB) -#define SYSTEM_SLEEP_MBOX_SET(x) (((32'd0 | (x)) << SYSTEM_SLEEP_MBOX_LSB) & SYSTEM_SLEEP_MBOX_MASK) -#define SYSTEM_SLEEP_MBOX_RESET 1'h1 -#define SYSTEM_SLEEP_MAC_IF_MSB 2 -#define SYSTEM_SLEEP_MAC_IF_LSB 2 -#define SYSTEM_SLEEP_MAC_IF_MASK 'h00000004 -#define SYSTEM_SLEEP_MAC_IF_GET(x) (((x) & SYSTEM_SLEEP_MAC_IF_MASK) >> SYSTEM_SLEEP_MAC_IF_LSB) -#define SYSTEM_SLEEP_MAC_IF_SET(x) (((32'd0 | (x)) << SYSTEM_SLEEP_MAC_IF_LSB) & SYSTEM_SLEEP_MAC_IF_MASK) -#define SYSTEM_SLEEP_MAC_IF_RESET 1'h1 -#define SYSTEM_SLEEP_LIGHT_MSB 1 -#define SYSTEM_SLEEP_LIGHT_LSB 1 -#define SYSTEM_SLEEP_LIGHT_MASK 'h00000002 -#define SYSTEM_SLEEP_LIGHT_GET(x) (((x) & SYSTEM_SLEEP_LIGHT_MASK) >> SYSTEM_SLEEP_LIGHT_LSB) -#define SYSTEM_SLEEP_LIGHT_SET(x) (((32'd0 | (x)) << SYSTEM_SLEEP_LIGHT_LSB) & SYSTEM_SLEEP_LIGHT_MASK) -#define SYSTEM_SLEEP_LIGHT_RESET 1'h0 -#define SYSTEM_SLEEP_DISABLE_MSB 0 -#define SYSTEM_SLEEP_DISABLE_LSB 0 -#define SYSTEM_SLEEP_DISABLE_MASK 'h00000001 -#define SYSTEM_SLEEP_DISABLE_GET(x) (((x) & SYSTEM_SLEEP_DISABLE_MASK) >> SYSTEM_SLEEP_DISABLE_LSB) -#define SYSTEM_SLEEP_DISABLE_SET(x) (((32'd0 | (x)) << SYSTEM_SLEEP_DISABLE_LSB) & SYSTEM_SLEEP_DISABLE_MASK) -#define SYSTEM_SLEEP_DISABLE_RESET 1'h1 -#define SYSTEM_SLEEP_RESET (32'h0 | \ - SYSTEM_SLEEP_HOST_IF_SET(SYSTEM_SLEEP_HOST_IF_RESET) | \ - SYSTEM_SLEEP_MBOX_SET(SYSTEM_SLEEP_MBOX_RESET) | \ - SYSTEM_SLEEP_MAC_IF_SET(SYSTEM_SLEEP_MAC_IF_RESET) | \ - SYSTEM_SLEEP_LIGHT_SET(SYSTEM_SLEEP_LIGHT_RESET) | \ - SYSTEM_SLEEP_DISABLE_SET(SYSTEM_SLEEP_DISABLE_RESET)) -#define SYSTEM_SLEEP_HW_MASK (32'h0 | \ - SYSTEM_SLEEP_HOST_IF_MASK | \ - SYSTEM_SLEEP_MBOX_MASK | \ - SYSTEM_SLEEP_MAC_IF_MASK) -#define SYSTEM_SLEEP_SW_MASK (32'h0 | \ - SYSTEM_SLEEP_LIGHT_MASK | \ - SYSTEM_SLEEP_DISABLE_MASK) - -#define SDIO_WRAPPER_ADDRESS 'h000000c8 -#define SDIO_WRAPPER_SLEEP_MSB 3 -#define SDIO_WRAPPER_SLEEP_LSB 3 -#define SDIO_WRAPPER_SLEEP_MASK 'h00000008 -#define SDIO_WRAPPER_SLEEP_GET(x) (((x) & SDIO_WRAPPER_SLEEP_MASK) >> SDIO_WRAPPER_SLEEP_LSB) -#define SDIO_WRAPPER_SLEEP_SET(x) (((32'd0 | (x)) << SDIO_WRAPPER_SLEEP_LSB) & SDIO_WRAPPER_SLEEP_MASK) -#define SDIO_WRAPPER_SLEEP_RESET 1'h1 -#define SDIO_WRAPPER_WAKEUP_MSB 2 -#define SDIO_WRAPPER_WAKEUP_LSB 2 -#define SDIO_WRAPPER_WAKEUP_MASK 'h00000004 -#define SDIO_WRAPPER_WAKEUP_GET(x) (((x) & SDIO_WRAPPER_WAKEUP_MASK) >> SDIO_WRAPPER_WAKEUP_LSB) -#define SDIO_WRAPPER_WAKEUP_SET(x) (((32'd0 | (x)) << SDIO_WRAPPER_WAKEUP_LSB) & SDIO_WRAPPER_WAKEUP_MASK) -#define SDIO_WRAPPER_WAKEUP_RESET 1'h1 -#define SDIO_WRAPPER_SOC_ON_MSB 1 -#define SDIO_WRAPPER_SOC_ON_LSB 1 -#define SDIO_WRAPPER_SOC_ON_MASK 'h00000002 -#define SDIO_WRAPPER_SOC_ON_GET(x) (((x) & SDIO_WRAPPER_SOC_ON_MASK) >> SDIO_WRAPPER_SOC_ON_LSB) -#define SDIO_WRAPPER_SOC_ON_SET(x) (((32'd0 | (x)) << SDIO_WRAPPER_SOC_ON_LSB) & SDIO_WRAPPER_SOC_ON_MASK) -#define SDIO_WRAPPER_SOC_ON_RESET 1'h1 -#define SDIO_WRAPPER_ON_MSB 0 -#define SDIO_WRAPPER_ON_LSB 0 -#define SDIO_WRAPPER_ON_MASK 'h00000001 -#define SDIO_WRAPPER_ON_GET(x) (((x) & SDIO_WRAPPER_ON_MASK) >> SDIO_WRAPPER_ON_LSB) -#define SDIO_WRAPPER_ON_SET(x) (((32'd0 | (x)) << SDIO_WRAPPER_ON_LSB) & SDIO_WRAPPER_ON_MASK) -#define SDIO_WRAPPER_ON_RESET 1'h1 -#define SDIO_WRAPPER_RESET (32'h0 | \ - SDIO_WRAPPER_SLEEP_SET(SDIO_WRAPPER_SLEEP_RESET) | \ - SDIO_WRAPPER_WAKEUP_SET(SDIO_WRAPPER_WAKEUP_RESET) | \ - SDIO_WRAPPER_SOC_ON_SET(SDIO_WRAPPER_SOC_ON_RESET) | \ - SDIO_WRAPPER_ON_SET(SDIO_WRAPPER_ON_RESET)) -#define SDIO_WRAPPER_HW_MASK (32'h0) -#define SDIO_WRAPPER_SW_MASK (32'h0 | \ - SDIO_WRAPPER_SLEEP_MASK | \ - SDIO_WRAPPER_WAKEUP_MASK | \ - SDIO_WRAPPER_SOC_ON_MASK | \ - SDIO_WRAPPER_ON_MASK) - -#define MAC_SLEEP_CONTROL_ADDRESS 'h000000cc -#define MAC_SLEEP_CONTROL_ENABLE_MSB 1 -#define MAC_SLEEP_CONTROL_ENABLE_LSB 0 -#define MAC_SLEEP_CONTROL_ENABLE_MASK 'h00000003 -#define MAC_SLEEP_CONTROL_ENABLE_GET(x) (((x) & MAC_SLEEP_CONTROL_ENABLE_MASK) >> MAC_SLEEP_CONTROL_ENABLE_LSB) -#define MAC_SLEEP_CONTROL_ENABLE_SET(x) (((32'd0 | (x)) << MAC_SLEEP_CONTROL_ENABLE_LSB) & MAC_SLEEP_CONTROL_ENABLE_MASK) -#define MAC_SLEEP_CONTROL_ENABLE_RESET 2'h1 -#define MAC_SLEEP_CONTROL_RESET (32'h0 | \ - MAC_SLEEP_CONTROL_ENABLE_SET(MAC_SLEEP_CONTROL_ENABLE_RESET)) -#define MAC_SLEEP_CONTROL_HW_MASK (32'h0) -#define MAC_SLEEP_CONTROL_SW_MASK (32'h0 | \ - MAC_SLEEP_CONTROL_ENABLE_MASK) - -#define KEEP_AWAKE_ADDRESS 'h000000d0 -#define KEEP_AWAKE_COUNT_MSB 7 -#define KEEP_AWAKE_COUNT_LSB 0 -#define KEEP_AWAKE_COUNT_MASK 'h000000ff -#define KEEP_AWAKE_COUNT_GET(x) (((x) & KEEP_AWAKE_COUNT_MASK) >> KEEP_AWAKE_COUNT_LSB) -#define KEEP_AWAKE_COUNT_SET(x) (((32'd0 | (x)) << KEEP_AWAKE_COUNT_LSB) & KEEP_AWAKE_COUNT_MASK) -#define KEEP_AWAKE_COUNT_RESET 8'h2 -#define KEEP_AWAKE_RESET (32'h0 | \ - KEEP_AWAKE_COUNT_SET(KEEP_AWAKE_COUNT_RESET)) -#define KEEP_AWAKE_HW_MASK (32'h0) -#define KEEP_AWAKE_SW_MASK (32'h0 | \ - KEEP_AWAKE_COUNT_MASK) - -#define LPO_CAL_TIME_ADDRESS 'h000000d4 -#define LPO_CAL_TIME_LENGTH_MSB 13 -#define LPO_CAL_TIME_LENGTH_LSB 0 -#define LPO_CAL_TIME_LENGTH_MASK 'h00003fff -#define LPO_CAL_TIME_LENGTH_GET(x) (((x) & LPO_CAL_TIME_LENGTH_MASK) >> LPO_CAL_TIME_LENGTH_LSB) -#define LPO_CAL_TIME_LENGTH_SET(x) (((32'd0 | (x)) << LPO_CAL_TIME_LENGTH_LSB) & LPO_CAL_TIME_LENGTH_MASK) -#define LPO_CAL_TIME_LENGTH_RESET 14'h421 -#define LPO_CAL_TIME_RESET (32'h0 | \ - LPO_CAL_TIME_LENGTH_SET(LPO_CAL_TIME_LENGTH_RESET)) -#define LPO_CAL_TIME_HW_MASK (32'h0) -#define LPO_CAL_TIME_SW_MASK (32'h0 | \ - LPO_CAL_TIME_LENGTH_MASK) - -#define LPO_INIT_DIVIDEND_INT_ADDRESS 'h000000d8 -#define LPO_INIT_DIVIDEND_INT_VALUE_MSB 23 -#define LPO_INIT_DIVIDEND_INT_VALUE_LSB 0 -#define LPO_INIT_DIVIDEND_INT_VALUE_MASK 'h00ffffff -#define LPO_INIT_DIVIDEND_INT_VALUE_GET(x) (((x) & LPO_INIT_DIVIDEND_INT_VALUE_MASK) >> LPO_INIT_DIVIDEND_INT_VALUE_LSB) -#define LPO_INIT_DIVIDEND_INT_VALUE_SET(x) (((32'd0 | (x)) << LPO_INIT_DIVIDEND_INT_VALUE_LSB) & LPO_INIT_DIVIDEND_INT_VALUE_MASK) -#define LPO_INIT_DIVIDEND_INT_VALUE_RESET 24'hcce41 -#define LPO_INIT_DIVIDEND_INT_RESET (32'h0 | \ - LPO_INIT_DIVIDEND_INT_VALUE_SET(LPO_INIT_DIVIDEND_INT_VALUE_RESET)) -#define LPO_INIT_DIVIDEND_INT_HW_MASK (32'h0) -#define LPO_INIT_DIVIDEND_INT_SW_MASK (32'h0 | \ - LPO_INIT_DIVIDEND_INT_VALUE_MASK) - -#define LPO_INIT_DIVIDEND_FRACTION_ADDRESS 'h000000dc -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_MSB 10 -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB 0 -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK 'h000007ff -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_GET(x) (((x) & LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK) >> LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB) -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_SET(x) (((32'd0 | (x)) << LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB) & LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK) -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_RESET 11'h330 -#define LPO_INIT_DIVIDEND_FRACTION_RESET (32'h0 | \ - LPO_INIT_DIVIDEND_FRACTION_VALUE_SET(LPO_INIT_DIVIDEND_FRACTION_VALUE_RESET)) -#define LPO_INIT_DIVIDEND_FRACTION_HW_MASK (32'h0) -#define LPO_INIT_DIVIDEND_FRACTION_SW_MASK (32'h0 | \ - LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK) - -#define LPO_CAL_ADDRESS 'h000000e0 -#define LPO_CAL_ENABLE_MSB 20 -#define LPO_CAL_ENABLE_LSB 20 -#define LPO_CAL_ENABLE_MASK 'h00100000 -#define LPO_CAL_ENABLE_GET(x) (((x) & LPO_CAL_ENABLE_MASK) >> LPO_CAL_ENABLE_LSB) -#define LPO_CAL_ENABLE_SET(x) (((32'd0 | (x)) << LPO_CAL_ENABLE_LSB) & LPO_CAL_ENABLE_MASK) -#define LPO_CAL_ENABLE_RESET 1'h0 -#define LPO_CAL_COUNT_MSB 19 -#define LPO_CAL_COUNT_LSB 0 -#define LPO_CAL_COUNT_MASK 'h000fffff -#define LPO_CAL_COUNT_GET(x) (((x) & LPO_CAL_COUNT_MASK) >> LPO_CAL_COUNT_LSB) -#define LPO_CAL_COUNT_SET(x) (((32'd0 | (x)) << LPO_CAL_COUNT_LSB) & LPO_CAL_COUNT_MASK) -#define LPO_CAL_COUNT_RESET 20'h12c00 -#define LPO_CAL_RESET (32'h0 | \ - LPO_CAL_ENABLE_SET(LPO_CAL_ENABLE_RESET) | \ - LPO_CAL_COUNT_SET(LPO_CAL_COUNT_RESET)) -#define LPO_CAL_HW_MASK (32'h0 | \ - LPO_CAL_COUNT_MASK) -#define LPO_CAL_SW_MASK (32'h0 | \ - LPO_CAL_ENABLE_MASK) - -#define LPO_CAL_TEST_CONTROL_ADDRESS 'h000000e4 -#define LPO_CAL_TEST_CONTROL_ENABLE_MSB 5 -#define LPO_CAL_TEST_CONTROL_ENABLE_LSB 5 -#define LPO_CAL_TEST_CONTROL_ENABLE_MASK 'h00000020 -#define LPO_CAL_TEST_CONTROL_ENABLE_GET(x) (((x) & LPO_CAL_TEST_CONTROL_ENABLE_MASK) >> LPO_CAL_TEST_CONTROL_ENABLE_LSB) -#define LPO_CAL_TEST_CONTROL_ENABLE_SET(x) (((32'd0 | (x)) << LPO_CAL_TEST_CONTROL_ENABLE_LSB) & LPO_CAL_TEST_CONTROL_ENABLE_MASK) -#define LPO_CAL_TEST_CONTROL_ENABLE_RESET 1'h0 -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_MSB 4 -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB 0 -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK 'h0000001f -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_GET(x) (((x) & LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK) >> LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB) -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_SET(x) (((32'd0 | (x)) << LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB) & LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK) -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_RESET 5'h0 -#define LPO_CAL_TEST_CONTROL_RESET (32'h0 | \ - LPO_CAL_TEST_CONTROL_ENABLE_SET(LPO_CAL_TEST_CONTROL_ENABLE_RESET) | \ - LPO_CAL_TEST_CONTROL_RTC_CYCLES_SET(LPO_CAL_TEST_CONTROL_RTC_CYCLES_RESET)) -#define LPO_CAL_TEST_CONTROL_HW_MASK (32'h0) -#define LPO_CAL_TEST_CONTROL_SW_MASK (32'h0 | \ - LPO_CAL_TEST_CONTROL_ENABLE_MASK | \ - LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK) - -#define LPO_CAL_TEST_STATUS_ADDRESS 'h000000e8 -#define LPO_CAL_TEST_STATUS_READY_MSB 16 -#define LPO_CAL_TEST_STATUS_READY_LSB 16 -#define LPO_CAL_TEST_STATUS_READY_MASK 'h00010000 -#define LPO_CAL_TEST_STATUS_READY_GET(x) (((x) & LPO_CAL_TEST_STATUS_READY_MASK) >> LPO_CAL_TEST_STATUS_READY_LSB) -#define LPO_CAL_TEST_STATUS_READY_SET(x) (((32'd0 | (x)) << LPO_CAL_TEST_STATUS_READY_LSB) & LPO_CAL_TEST_STATUS_READY_MASK) -#define LPO_CAL_TEST_STATUS_READY_RESET 1'h0 -#define LPO_CAL_TEST_STATUS_COUNT_MSB 15 -#define LPO_CAL_TEST_STATUS_COUNT_LSB 0 -#define LPO_CAL_TEST_STATUS_COUNT_MASK 'h0000ffff -#define LPO_CAL_TEST_STATUS_COUNT_GET(x) (((x) & LPO_CAL_TEST_STATUS_COUNT_MASK) >> LPO_CAL_TEST_STATUS_COUNT_LSB) -#define LPO_CAL_TEST_STATUS_COUNT_SET(x) (((32'd0 | (x)) << LPO_CAL_TEST_STATUS_COUNT_LSB) & LPO_CAL_TEST_STATUS_COUNT_MASK) -#define LPO_CAL_TEST_STATUS_COUNT_RESET 16'h0 -#define LPO_CAL_TEST_STATUS_RESET (32'h0 | \ - LPO_CAL_TEST_STATUS_READY_SET(LPO_CAL_TEST_STATUS_READY_RESET) | \ - LPO_CAL_TEST_STATUS_COUNT_SET(LPO_CAL_TEST_STATUS_COUNT_RESET)) -#define LPO_CAL_TEST_STATUS_HW_MASK (32'h0 | \ - LPO_CAL_TEST_STATUS_READY_MASK | \ - LPO_CAL_TEST_STATUS_COUNT_MASK) -#define LPO_CAL_TEST_STATUS_SW_MASK (32'h0) - -#define CHIP_ID_ADDRESS 'h000000ec -#define CHIP_ID_DEVICE_ID_MSB 31 -#define CHIP_ID_DEVICE_ID_LSB 16 -#define CHIP_ID_DEVICE_ID_MASK 'hffff0000 -#define CHIP_ID_DEVICE_ID_GET(x) (((x) & CHIP_ID_DEVICE_ID_MASK) >> CHIP_ID_DEVICE_ID_LSB) -#define CHIP_ID_DEVICE_ID_SET(x) (((32'd0 | (x)) << CHIP_ID_DEVICE_ID_LSB) & CHIP_ID_DEVICE_ID_MASK) -#define CHIP_ID_DEVICE_ID_RESET 16'h0 -#define CHIP_ID_CONFIG_ID_MSB 15 -#define CHIP_ID_CONFIG_ID_LSB 4 -#define CHIP_ID_CONFIG_ID_MASK 'h0000fff0 -#define CHIP_ID_CONFIG_ID_GET(x) (((x) & CHIP_ID_CONFIG_ID_MASK) >> CHIP_ID_CONFIG_ID_LSB) -#define CHIP_ID_CONFIG_ID_SET(x) (((32'd0 | (x)) << CHIP_ID_CONFIG_ID_LSB) & CHIP_ID_CONFIG_ID_MASK) -#define CHIP_ID_CONFIG_ID_RESET 12'h0 -#define CHIP_ID_VERSION_ID_MSB 3 -#define CHIP_ID_VERSION_ID_LSB 0 -#define CHIP_ID_VERSION_ID_MASK 'h0000000f -#define CHIP_ID_VERSION_ID_GET(x) (((x) & CHIP_ID_VERSION_ID_MASK) >> CHIP_ID_VERSION_ID_LSB) -#define CHIP_ID_VERSION_ID_SET(x) (((32'd0 | (x)) << CHIP_ID_VERSION_ID_LSB) & CHIP_ID_VERSION_ID_MASK) -#define CHIP_ID_VERSION_ID_RESET 4'h1 -#define CHIP_ID_RESET (32'h0 | \ - CHIP_ID_DEVICE_ID_SET(CHIP_ID_DEVICE_ID_RESET) | \ - CHIP_ID_CONFIG_ID_SET(CHIP_ID_CONFIG_ID_RESET) | \ - CHIP_ID_VERSION_ID_SET(CHIP_ID_VERSION_ID_RESET)) -#define CHIP_ID_HW_MASK (32'h0 | \ - CHIP_ID_DEVICE_ID_MASK | \ - CHIP_ID_CONFIG_ID_MASK | \ - CHIP_ID_VERSION_ID_MASK) -#define CHIP_ID_SW_MASK (32'h0) - -#define DERIVED_RTC_CLK_ADDRESS 'h000000f0 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MSB 20 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB 20 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK 'h00100000 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_GET(x) (((x) & DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK) >> DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_SET(x) (((32'd0 | (x)) << DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB) & DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_RESET 1'h0 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_MSB 18 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB 18 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK 'h00040000 -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_GET(x) (((x) & DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK) >> DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_SET(x) (((32'd0 | (x)) << DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB) & DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_RESET 1'h0 -#define DERIVED_RTC_CLK_FORCE_MSB 17 -#define DERIVED_RTC_CLK_FORCE_LSB 16 -#define DERIVED_RTC_CLK_FORCE_MASK 'h00030000 -#define DERIVED_RTC_CLK_FORCE_GET(x) (((x) & DERIVED_RTC_CLK_FORCE_MASK) >> DERIVED_RTC_CLK_FORCE_LSB) -#define DERIVED_RTC_CLK_FORCE_SET(x) (((32'd0 | (x)) << DERIVED_RTC_CLK_FORCE_LSB) & DERIVED_RTC_CLK_FORCE_MASK) -#define DERIVED_RTC_CLK_FORCE_RESET 2'h0 -#define DERIVED_RTC_CLK_PERIOD_MSB 15 -#define DERIVED_RTC_CLK_PERIOD_LSB 1 -#define DERIVED_RTC_CLK_PERIOD_MASK 'h0000fffe -#define DERIVED_RTC_CLK_PERIOD_GET(x) (((x) & DERIVED_RTC_CLK_PERIOD_MASK) >> DERIVED_RTC_CLK_PERIOD_LSB) -#define DERIVED_RTC_CLK_PERIOD_SET(x) (((32'd0 | (x)) << DERIVED_RTC_CLK_PERIOD_LSB) & DERIVED_RTC_CLK_PERIOD_MASK) -#define DERIVED_RTC_CLK_PERIOD_RESET 15'h262 -#define DERIVED_RTC_CLK_RESET (32'h0 | \ - DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_SET(DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_RESET) | \ - DERIVED_RTC_CLK_EXTERNAL_DETECT_SET(DERIVED_RTC_CLK_EXTERNAL_DETECT_RESET) | \ - DERIVED_RTC_CLK_FORCE_SET(DERIVED_RTC_CLK_FORCE_RESET) | \ - DERIVED_RTC_CLK_PERIOD_SET(DERIVED_RTC_CLK_PERIOD_RESET)) -#define DERIVED_RTC_CLK_HW_MASK (32'h0 | \ - DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK) -#define DERIVED_RTC_CLK_SW_MASK (32'h0 | \ - DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK | \ - DERIVED_RTC_CLK_FORCE_MASK | \ - DERIVED_RTC_CLK_PERIOD_MASK) - -#define MAC_PCU_SLP32_MODE_ADDRESS 'h000000f4 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MSB 21 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_LSB 21 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MASK 'h00200000 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_GET(x) (((x) & MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MASK) >> MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_LSB) -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_LSB) & MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MASK) -#define MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_RESET 1'h1 -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MSB 19 -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB 0 -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK 'h000fffff -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_GET(x) (((x) & MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK) >> MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB) -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB) & MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK) -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_RESET 20'hf424 -#define MAC_PCU_SLP32_MODE_RESET (32'h0 | \ - MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_SET(MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_RESET) | \ - MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_SET(MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_RESET)) -#define MAC_PCU_SLP32_MODE_HW_MASK (32'h0 | \ - MAC_PCU_SLP32_MODE_TSF_WRITE_PENDING_MASK) -#define MAC_PCU_SLP32_MODE_SW_MASK (32'h0 | \ - MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK) - -#define MAC_PCU_SLP32_WAKE_ADDRESS 'h000000f8 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_MSB 15 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_LSB 0 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_MASK 'h0000ffff -#define MAC_PCU_SLP32_WAKE_XTL_TIME_GET(x) (((x) & MAC_PCU_SLP32_WAKE_XTL_TIME_MASK) >> MAC_PCU_SLP32_WAKE_XTL_TIME_LSB) -#define MAC_PCU_SLP32_WAKE_XTL_TIME_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP32_WAKE_XTL_TIME_LSB) & MAC_PCU_SLP32_WAKE_XTL_TIME_MASK) -#define MAC_PCU_SLP32_WAKE_XTL_TIME_RESET 16'h100 -#define MAC_PCU_SLP32_WAKE_RESET (32'h0 | \ - MAC_PCU_SLP32_WAKE_XTL_TIME_SET(MAC_PCU_SLP32_WAKE_XTL_TIME_RESET)) -#define MAC_PCU_SLP32_WAKE_HW_MASK (32'h0) -#define MAC_PCU_SLP32_WAKE_SW_MASK (32'h0 | \ - MAC_PCU_SLP32_WAKE_XTL_TIME_MASK) - -#define MAC_PCU_SLP32_INC_ADDRESS 'h000000fc -#define MAC_PCU_SLP32_INC_TSF_INC_MSB 19 -#define MAC_PCU_SLP32_INC_TSF_INC_LSB 0 -#define MAC_PCU_SLP32_INC_TSF_INC_MASK 'h000fffff -#define MAC_PCU_SLP32_INC_TSF_INC_GET(x) (((x) & MAC_PCU_SLP32_INC_TSF_INC_MASK) >> MAC_PCU_SLP32_INC_TSF_INC_LSB) -#define MAC_PCU_SLP32_INC_TSF_INC_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP32_INC_TSF_INC_LSB) & MAC_PCU_SLP32_INC_TSF_INC_MASK) -#define MAC_PCU_SLP32_INC_TSF_INC_RESET 20'h1e848 -#define MAC_PCU_SLP32_INC_RESET (32'h0 | \ - MAC_PCU_SLP32_INC_TSF_INC_SET(MAC_PCU_SLP32_INC_TSF_INC_RESET)) -#define MAC_PCU_SLP32_INC_HW_MASK (32'h0) -#define MAC_PCU_SLP32_INC_SW_MASK (32'h0 | \ - MAC_PCU_SLP32_INC_TSF_INC_MASK) - -#define MAC_PCU_SLP_MIB1_ADDRESS 'h00000100 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_MSB 31 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB 0 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK 'hffffffff -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK) >> MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB) -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB) & MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK) -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_RESET 32'h0 -#define MAC_PCU_SLP_MIB1_RESET (32'h0 | \ - MAC_PCU_SLP_MIB1_SLEEP_CNT_SET(MAC_PCU_SLP_MIB1_SLEEP_CNT_RESET)) -#define MAC_PCU_SLP_MIB1_HW_MASK (32'h0 | \ - MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK) -#define MAC_PCU_SLP_MIB1_SW_MASK (32'h0 | \ - MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK) - -#define MAC_PCU_SLP_MIB2_ADDRESS 'h00000104 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_MSB 31 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB 0 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK 'hffffffff -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK) >> MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB) -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB) & MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK) -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_RESET 32'h0 -#define MAC_PCU_SLP_MIB2_RESET (32'h0 | \ - MAC_PCU_SLP_MIB2_CYCLE_CNT_SET(MAC_PCU_SLP_MIB2_CYCLE_CNT_RESET)) -#define MAC_PCU_SLP_MIB2_HW_MASK (32'h0 | \ - MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK) -#define MAC_PCU_SLP_MIB2_SW_MASK (32'h0 | \ - MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK) - -#define MAC_PCU_SLP_MIB3_ADDRESS 'h00000108 -#define MAC_PCU_SLP_MIB3_PENDING_MSB 1 -#define MAC_PCU_SLP_MIB3_PENDING_LSB 1 -#define MAC_PCU_SLP_MIB3_PENDING_MASK 'h00000002 -#define MAC_PCU_SLP_MIB3_PENDING_GET(x) (((x) & MAC_PCU_SLP_MIB3_PENDING_MASK) >> MAC_PCU_SLP_MIB3_PENDING_LSB) -#define MAC_PCU_SLP_MIB3_PENDING_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP_MIB3_PENDING_LSB) & MAC_PCU_SLP_MIB3_PENDING_MASK) -#define MAC_PCU_SLP_MIB3_PENDING_RESET 1'h0 -#define MAC_PCU_SLP_MIB3_CLR_CNT_MSB 0 -#define MAC_PCU_SLP_MIB3_CLR_CNT_LSB 0 -#define MAC_PCU_SLP_MIB3_CLR_CNT_MASK 'h00000001 -#define MAC_PCU_SLP_MIB3_CLR_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB3_CLR_CNT_MASK) >> MAC_PCU_SLP_MIB3_CLR_CNT_LSB) -#define MAC_PCU_SLP_MIB3_CLR_CNT_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP_MIB3_CLR_CNT_LSB) & MAC_PCU_SLP_MIB3_CLR_CNT_MASK) -#define MAC_PCU_SLP_MIB3_CLR_CNT_RESET 1'h0 -#define MAC_PCU_SLP_MIB3_RESET (32'h0 | \ - MAC_PCU_SLP_MIB3_PENDING_SET(MAC_PCU_SLP_MIB3_PENDING_RESET) | \ - MAC_PCU_SLP_MIB3_CLR_CNT_SET(MAC_PCU_SLP_MIB3_CLR_CNT_RESET)) -#define MAC_PCU_SLP_MIB3_HW_MASK (32'h0 | \ - MAC_PCU_SLP_MIB3_PENDING_MASK) -#define MAC_PCU_SLP_MIB3_SW_MASK (32'h0 | \ - MAC_PCU_SLP_MIB3_CLR_CNT_MASK) - -#define MAC_PCU_SLP_BEACON_ADDRESS 'h0000010c -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MSB 24 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_LSB 24 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MASK 'h01000000 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_GET(x) (((x) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MASK) >> MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_LSB) -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_LSB) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MASK) -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_RESET 1'h0 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MSB 23 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_LSB 0 -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MASK 'h00ffffff -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_GET(x) (((x) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MASK) >> MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_LSB) -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_SET(x) (((32'd0 | (x)) << MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_LSB) & MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MASK) -#define MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_RESET 24'hffffff -#define MAC_PCU_SLP_BEACON_RESET (32'h0 | \ - MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_SET(MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_RESET) | \ - MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_SET(MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_RESET)) -#define MAC_PCU_SLP_BEACON_HW_MASK (32'h0) -#define MAC_PCU_SLP_BEACON_SW_MASK (32'h0 | \ - MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_ENABLE_MASK | \ - MAC_PCU_SLP_BEACON_BMISS_TIMEOUT_MASK) - -#define POWER_REG_ADDRESS 'h00000110 -#define POWER_REG_VLVL_MSB 11 -#define POWER_REG_VLVL_LSB 8 -#define POWER_REG_VLVL_MASK 'h00000f00 -#define POWER_REG_VLVL_GET(x) (((x) & POWER_REG_VLVL_MASK) >> POWER_REG_VLVL_LSB) -#define POWER_REG_VLVL_SET(x) (((32'd0 | (x)) << POWER_REG_VLVL_LSB) & POWER_REG_VLVL_MASK) -#define POWER_REG_VLVL_RESET 4'h0 -#define POWER_REG_CPU_INT_ENABLE_MSB 7 -#define POWER_REG_CPU_INT_ENABLE_LSB 7 -#define POWER_REG_CPU_INT_ENABLE_MASK 'h00000080 -#define POWER_REG_CPU_INT_ENABLE_GET(x) (((x) & POWER_REG_CPU_INT_ENABLE_MASK) >> POWER_REG_CPU_INT_ENABLE_LSB) -#define POWER_REG_CPU_INT_ENABLE_SET(x) (((32'd0 | (x)) << POWER_REG_CPU_INT_ENABLE_LSB) & POWER_REG_CPU_INT_ENABLE_MASK) -#define POWER_REG_CPU_INT_ENABLE_RESET 1'h0 -#define POWER_REG_WLAN_ISO_DIS_MSB 6 -#define POWER_REG_WLAN_ISO_DIS_LSB 6 -#define POWER_REG_WLAN_ISO_DIS_MASK 'h00000040 -#define POWER_REG_WLAN_ISO_DIS_GET(x) (((x) & POWER_REG_WLAN_ISO_DIS_MASK) >> POWER_REG_WLAN_ISO_DIS_LSB) -#define POWER_REG_WLAN_ISO_DIS_SET(x) (((32'd0 | (x)) << POWER_REG_WLAN_ISO_DIS_LSB) & POWER_REG_WLAN_ISO_DIS_MASK) -#define POWER_REG_WLAN_ISO_DIS_RESET 1'h0 -#define POWER_REG_WLAN_ISO_CNTL_MSB 5 -#define POWER_REG_WLAN_ISO_CNTL_LSB 5 -#define POWER_REG_WLAN_ISO_CNTL_MASK 'h00000020 -#define POWER_REG_WLAN_ISO_CNTL_GET(x) (((x) & POWER_REG_WLAN_ISO_CNTL_MASK) >> POWER_REG_WLAN_ISO_CNTL_LSB) -#define POWER_REG_WLAN_ISO_CNTL_SET(x) (((32'd0 | (x)) << POWER_REG_WLAN_ISO_CNTL_LSB) & POWER_REG_WLAN_ISO_CNTL_MASK) -#define POWER_REG_WLAN_ISO_CNTL_RESET 1'h0 -#define POWER_REG_RADIO_PWD_EN_MSB 4 -#define POWER_REG_RADIO_PWD_EN_LSB 4 -#define POWER_REG_RADIO_PWD_EN_MASK 'h00000010 -#define POWER_REG_RADIO_PWD_EN_GET(x) (((x) & POWER_REG_RADIO_PWD_EN_MASK) >> POWER_REG_RADIO_PWD_EN_LSB) -#define POWER_REG_RADIO_PWD_EN_SET(x) (((32'd0 | (x)) << POWER_REG_RADIO_PWD_EN_LSB) & POWER_REG_RADIO_PWD_EN_MASK) -#define POWER_REG_RADIO_PWD_EN_RESET 1'h0 -#define POWER_REG_SOC_SCALE_EN_MSB 3 -#define POWER_REG_SOC_SCALE_EN_LSB 3 -#define POWER_REG_SOC_SCALE_EN_MASK 'h00000008 -#define POWER_REG_SOC_SCALE_EN_GET(x) (((x) & POWER_REG_SOC_SCALE_EN_MASK) >> POWER_REG_SOC_SCALE_EN_LSB) -#define POWER_REG_SOC_SCALE_EN_SET(x) (((32'd0 | (x)) << POWER_REG_SOC_SCALE_EN_LSB) & POWER_REG_SOC_SCALE_EN_MASK) -#define POWER_REG_SOC_SCALE_EN_RESET 1'h0 -#define POWER_REG_WLAN_SCALE_EN_MSB 2 -#define POWER_REG_WLAN_SCALE_EN_LSB 2 -#define POWER_REG_WLAN_SCALE_EN_MASK 'h00000004 -#define POWER_REG_WLAN_SCALE_EN_GET(x) (((x) & POWER_REG_WLAN_SCALE_EN_MASK) >> POWER_REG_WLAN_SCALE_EN_LSB) -#define POWER_REG_WLAN_SCALE_EN_SET(x) (((32'd0 | (x)) << POWER_REG_WLAN_SCALE_EN_LSB) & POWER_REG_WLAN_SCALE_EN_MASK) -#define POWER_REG_WLAN_SCALE_EN_RESET 1'h0 -#define POWER_REG_WLAN_PWD_EN_MSB 1 -#define POWER_REG_WLAN_PWD_EN_LSB 1 -#define POWER_REG_WLAN_PWD_EN_MASK 'h00000002 -#define POWER_REG_WLAN_PWD_EN_GET(x) (((x) & POWER_REG_WLAN_PWD_EN_MASK) >> POWER_REG_WLAN_PWD_EN_LSB) -#define POWER_REG_WLAN_PWD_EN_SET(x) (((32'd0 | (x)) << POWER_REG_WLAN_PWD_EN_LSB) & POWER_REG_WLAN_PWD_EN_MASK) -#define POWER_REG_WLAN_PWD_EN_RESET 1'h0 -#define POWER_REG_POWER_EN_MSB 0 -#define POWER_REG_POWER_EN_LSB 0 -#define POWER_REG_POWER_EN_MASK 'h00000001 -#define POWER_REG_POWER_EN_GET(x) (((x) & POWER_REG_POWER_EN_MASK) >> POWER_REG_POWER_EN_LSB) -#define POWER_REG_POWER_EN_SET(x) (((32'd0 | (x)) << POWER_REG_POWER_EN_LSB) & POWER_REG_POWER_EN_MASK) -#define POWER_REG_POWER_EN_RESET 1'h0 -#define POWER_REG_RESET (32'h0 | \ - POWER_REG_VLVL_SET(POWER_REG_VLVL_RESET) | \ - POWER_REG_CPU_INT_ENABLE_SET(POWER_REG_CPU_INT_ENABLE_RESET) | \ - POWER_REG_WLAN_ISO_DIS_SET(POWER_REG_WLAN_ISO_DIS_RESET) | \ - POWER_REG_WLAN_ISO_CNTL_SET(POWER_REG_WLAN_ISO_CNTL_RESET) | \ - POWER_REG_RADIO_PWD_EN_SET(POWER_REG_RADIO_PWD_EN_RESET) | \ - POWER_REG_SOC_SCALE_EN_SET(POWER_REG_SOC_SCALE_EN_RESET) | \ - POWER_REG_WLAN_SCALE_EN_SET(POWER_REG_WLAN_SCALE_EN_RESET) | \ - POWER_REG_WLAN_PWD_EN_SET(POWER_REG_WLAN_PWD_EN_RESET) | \ - POWER_REG_POWER_EN_SET(POWER_REG_POWER_EN_RESET)) -#define POWER_REG_HW_MASK (32'h0) -#define POWER_REG_SW_MASK (32'h0 | \ - POWER_REG_VLVL_MASK | \ - POWER_REG_CPU_INT_ENABLE_MASK | \ - POWER_REG_WLAN_ISO_DIS_MASK | \ - POWER_REG_WLAN_ISO_CNTL_MASK | \ - POWER_REG_RADIO_PWD_EN_MASK | \ - POWER_REG_SOC_SCALE_EN_MASK | \ - POWER_REG_WLAN_SCALE_EN_MASK | \ - POWER_REG_WLAN_PWD_EN_MASK | \ - POWER_REG_POWER_EN_MASK) - -#define CORE_CLK_CTRL_ADDRESS 'h00000114 -#define CORE_CLK_CTRL_DIV_MSB 2 -#define CORE_CLK_CTRL_DIV_LSB 0 -#define CORE_CLK_CTRL_DIV_MASK 'h00000007 -#define CORE_CLK_CTRL_DIV_GET(x) (((x) & CORE_CLK_CTRL_DIV_MASK) >> CORE_CLK_CTRL_DIV_LSB) -#define CORE_CLK_CTRL_DIV_SET(x) (((32'd0 | (x)) << CORE_CLK_CTRL_DIV_LSB) & CORE_CLK_CTRL_DIV_MASK) -#define CORE_CLK_CTRL_DIV_RESET 3'h2 -#define CORE_CLK_CTRL_RESET (32'h0 | \ - CORE_CLK_CTRL_DIV_SET(CORE_CLK_CTRL_DIV_RESET)) -#define CORE_CLK_CTRL_HW_MASK (32'h0) -#define CORE_CLK_CTRL_SW_MASK (32'h0 | \ - CORE_CLK_CTRL_DIV_MASK) - -#define SDIO_SETUP_CIRCUIT_ADDRESS 'h00000120 -#define SDIO_SETUP_CIRCUIT_VECTOR_MSB 7 -#define SDIO_SETUP_CIRCUIT_VECTOR_LSB 0 -#define SDIO_SETUP_CIRCUIT_VECTOR_MASK 'h000000ff -#define SDIO_SETUP_CIRCUIT_VECTOR_GET(x) (((x) & SDIO_SETUP_CIRCUIT_VECTOR_MASK) >> SDIO_SETUP_CIRCUIT_VECTOR_LSB) -#define SDIO_SETUP_CIRCUIT_VECTOR_SET(x) (((32'd0 | (x)) << SDIO_SETUP_CIRCUIT_VECTOR_LSB) & SDIO_SETUP_CIRCUIT_VECTOR_MASK) -#define SDIO_SETUP_CIRCUIT_VECTOR_RESET 8'h0 -#define SDIO_SETUP_CIRCUIT_RESET (32'h0 | \ - SDIO_SETUP_CIRCUIT_VECTOR_SET(SDIO_SETUP_CIRCUIT_VECTOR_RESET)) -#define SDIO_SETUP_CIRCUIT_HW_MASK (32'h0 | \ - SDIO_SETUP_CIRCUIT_VECTOR_MASK) -#define SDIO_SETUP_CIRCUIT_SW_MASK (32'h0) - -#define SDIO_SETUP_CONFIG_ADDRESS 'h00000140 -#define SDIO_SETUP_CONFIG_ENABLE_MSB 1 -#define SDIO_SETUP_CONFIG_ENABLE_LSB 1 -#define SDIO_SETUP_CONFIG_ENABLE_MASK 'h00000002 -#define SDIO_SETUP_CONFIG_ENABLE_GET(x) (((x) & SDIO_SETUP_CONFIG_ENABLE_MASK) >> SDIO_SETUP_CONFIG_ENABLE_LSB) -#define SDIO_SETUP_CONFIG_ENABLE_SET(x) (((32'd0 | (x)) << SDIO_SETUP_CONFIG_ENABLE_LSB) & SDIO_SETUP_CONFIG_ENABLE_MASK) -#define SDIO_SETUP_CONFIG_ENABLE_RESET 1'h0 -#define SDIO_SETUP_CONFIG_CLEAR_MSB 0 -#define SDIO_SETUP_CONFIG_CLEAR_LSB 0 -#define SDIO_SETUP_CONFIG_CLEAR_MASK 'h00000001 -#define SDIO_SETUP_CONFIG_CLEAR_GET(x) (((x) & SDIO_SETUP_CONFIG_CLEAR_MASK) >> SDIO_SETUP_CONFIG_CLEAR_LSB) -#define SDIO_SETUP_CONFIG_CLEAR_SET(x) (((32'd0 | (x)) << SDIO_SETUP_CONFIG_CLEAR_LSB) & SDIO_SETUP_CONFIG_CLEAR_MASK) -#define SDIO_SETUP_CONFIG_CLEAR_RESET 1'h1 -#define SDIO_SETUP_CONFIG_RESET (32'h0 | \ - SDIO_SETUP_CONFIG_ENABLE_SET(SDIO_SETUP_CONFIG_ENABLE_RESET) | \ - SDIO_SETUP_CONFIG_CLEAR_SET(SDIO_SETUP_CONFIG_CLEAR_RESET)) -#define SDIO_SETUP_CONFIG_HW_MASK (32'h0) -#define SDIO_SETUP_CONFIG_SW_MASK (32'h0 | \ - SDIO_SETUP_CONFIG_ENABLE_MASK | \ - SDIO_SETUP_CONFIG_CLEAR_MASK) - -#define CPU_SETUP_CONFIG_ADDRESS 'h00000144 -#define CPU_SETUP_CONFIG_ENABLE_MSB 1 -#define CPU_SETUP_CONFIG_ENABLE_LSB 1 -#define CPU_SETUP_CONFIG_ENABLE_MASK 'h00000002 -#define CPU_SETUP_CONFIG_ENABLE_GET(x) (((x) & CPU_SETUP_CONFIG_ENABLE_MASK) >> CPU_SETUP_CONFIG_ENABLE_LSB) -#define CPU_SETUP_CONFIG_ENABLE_SET(x) (((32'd0 | (x)) << CPU_SETUP_CONFIG_ENABLE_LSB) & CPU_SETUP_CONFIG_ENABLE_MASK) -#define CPU_SETUP_CONFIG_ENABLE_RESET 1'h0 -#define CPU_SETUP_CONFIG_CLEAR_MSB 0 -#define CPU_SETUP_CONFIG_CLEAR_LSB 0 -#define CPU_SETUP_CONFIG_CLEAR_MASK 'h00000001 -#define CPU_SETUP_CONFIG_CLEAR_GET(x) (((x) & CPU_SETUP_CONFIG_CLEAR_MASK) >> CPU_SETUP_CONFIG_CLEAR_LSB) -#define CPU_SETUP_CONFIG_CLEAR_SET(x) (((32'd0 | (x)) << CPU_SETUP_CONFIG_CLEAR_LSB) & CPU_SETUP_CONFIG_CLEAR_MASK) -#define CPU_SETUP_CONFIG_CLEAR_RESET 1'h0 -#define CPU_SETUP_CONFIG_RESET (32'h0 | \ - CPU_SETUP_CONFIG_ENABLE_SET(CPU_SETUP_CONFIG_ENABLE_RESET) | \ - CPU_SETUP_CONFIG_CLEAR_SET(CPU_SETUP_CONFIG_CLEAR_RESET)) -#define CPU_SETUP_CONFIG_HW_MASK (32'h0) -#define CPU_SETUP_CONFIG_SW_MASK (32'h0 | \ - CPU_SETUP_CONFIG_ENABLE_MASK | \ - CPU_SETUP_CONFIG_CLEAR_MASK) - -#define CPU_SETUP_CIRCUIT_ADDRESS 'h00000160 -#define CPU_SETUP_CIRCUIT_VECTOR_MSB 7 -#define CPU_SETUP_CIRCUIT_VECTOR_LSB 0 -#define CPU_SETUP_CIRCUIT_VECTOR_MASK 'h000000ff -#define CPU_SETUP_CIRCUIT_VECTOR_GET(x) (((x) & CPU_SETUP_CIRCUIT_VECTOR_MASK) >> CPU_SETUP_CIRCUIT_VECTOR_LSB) -#define CPU_SETUP_CIRCUIT_VECTOR_SET(x) (((32'd0 | (x)) << CPU_SETUP_CIRCUIT_VECTOR_LSB) & CPU_SETUP_CIRCUIT_VECTOR_MASK) -#define CPU_SETUP_CIRCUIT_VECTOR_RESET 8'h0 -#define CPU_SETUP_CIRCUIT_RESET (32'h0 | \ - CPU_SETUP_CIRCUIT_VECTOR_SET(CPU_SETUP_CIRCUIT_VECTOR_RESET)) -#define CPU_SETUP_CIRCUIT_HW_MASK (32'h0 | \ - CPU_SETUP_CIRCUIT_VECTOR_MASK) -#define CPU_SETUP_CIRCUIT_SW_MASK (32'h0) - -#define BB_SETUP_CONFIG_ADDRESS 'h00000180 -#define BB_SETUP_CONFIG_ENABLE_MSB 1 -#define BB_SETUP_CONFIG_ENABLE_LSB 1 -#define BB_SETUP_CONFIG_ENABLE_MASK 'h00000002 -#define BB_SETUP_CONFIG_ENABLE_GET(x) (((x) & BB_SETUP_CONFIG_ENABLE_MASK) >> BB_SETUP_CONFIG_ENABLE_LSB) -#define BB_SETUP_CONFIG_ENABLE_SET(x) (((32'd0 | (x)) << BB_SETUP_CONFIG_ENABLE_LSB) & BB_SETUP_CONFIG_ENABLE_MASK) -#define BB_SETUP_CONFIG_ENABLE_RESET 1'h0 -#define BB_SETUP_CONFIG_CLEAR_MSB 0 -#define BB_SETUP_CONFIG_CLEAR_LSB 0 -#define BB_SETUP_CONFIG_CLEAR_MASK 'h00000001 -#define BB_SETUP_CONFIG_CLEAR_GET(x) (((x) & BB_SETUP_CONFIG_CLEAR_MASK) >> BB_SETUP_CONFIG_CLEAR_LSB) -#define BB_SETUP_CONFIG_CLEAR_SET(x) (((32'd0 | (x)) << BB_SETUP_CONFIG_CLEAR_LSB) & BB_SETUP_CONFIG_CLEAR_MASK) -#define BB_SETUP_CONFIG_CLEAR_RESET 1'h0 -#define BB_SETUP_CONFIG_RESET (32'h0 | \ - BB_SETUP_CONFIG_ENABLE_SET(BB_SETUP_CONFIG_ENABLE_RESET) | \ - BB_SETUP_CONFIG_CLEAR_SET(BB_SETUP_CONFIG_CLEAR_RESET)) -#define BB_SETUP_CONFIG_HW_MASK (32'h0) -#define BB_SETUP_CONFIG_SW_MASK (32'h0 | \ - BB_SETUP_CONFIG_ENABLE_MASK | \ - BB_SETUP_CONFIG_CLEAR_MASK) - -#define BB_SETUP_CIRCUIT_ADDRESS 'h000001a0 -#define BB_SETUP_CIRCUIT_VECTOR_MSB 7 -#define BB_SETUP_CIRCUIT_VECTOR_LSB 0 -#define BB_SETUP_CIRCUIT_VECTOR_MASK 'h000000ff -#define BB_SETUP_CIRCUIT_VECTOR_GET(x) (((x) & BB_SETUP_CIRCUIT_VECTOR_MASK) >> BB_SETUP_CIRCUIT_VECTOR_LSB) -#define BB_SETUP_CIRCUIT_VECTOR_SET(x) (((32'd0 | (x)) << BB_SETUP_CIRCUIT_VECTOR_LSB) & BB_SETUP_CIRCUIT_VECTOR_MASK) -#define BB_SETUP_CIRCUIT_VECTOR_RESET 8'h0 -#define BB_SETUP_CIRCUIT_RESET (32'h0 | \ - BB_SETUP_CIRCUIT_VECTOR_SET(BB_SETUP_CIRCUIT_VECTOR_RESET)) -#define BB_SETUP_CIRCUIT_HW_MASK (32'h0 | \ - BB_SETUP_CIRCUIT_VECTOR_MASK) -#define BB_SETUP_CIRCUIT_SW_MASK (32'h0) - -#define GPIO_WAKEUP_CONTROL_ADDRESS 'h000001c0 -#define GPIO_WAKEUP_CONTROL_ENABLE_MSB 0 -#define GPIO_WAKEUP_CONTROL_ENABLE_LSB 0 -#define GPIO_WAKEUP_CONTROL_ENABLE_MASK 'h00000001 -#define GPIO_WAKEUP_CONTROL_ENABLE_GET(x) (((x) & GPIO_WAKEUP_CONTROL_ENABLE_MASK) >> GPIO_WAKEUP_CONTROL_ENABLE_LSB) -#define GPIO_WAKEUP_CONTROL_ENABLE_SET(x) (((32'd0 | (x)) << GPIO_WAKEUP_CONTROL_ENABLE_LSB) & GPIO_WAKEUP_CONTROL_ENABLE_MASK) -#define GPIO_WAKEUP_CONTROL_ENABLE_RESET 1'h0 -#define GPIO_WAKEUP_CONTROL_RESET (32'h0 | \ - GPIO_WAKEUP_CONTROL_ENABLE_SET(GPIO_WAKEUP_CONTROL_ENABLE_RESET)) -#define GPIO_WAKEUP_CONTROL_HW_MASK (32'h0) -#define GPIO_WAKEUP_CONTROL_SW_MASK (32'h0 | \ - GPIO_WAKEUP_CONTROL_ENABLE_MASK) - -#define RTC_REG_ADDRESS_MSB 8 - -#endif /* _RTC_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rxtxbb_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rxtxbb_reg.h deleted file mode 100644 index 498d78701818..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rxtxbb_reg.h +++ /dev/null @@ -1,278 +0,0 @@ -#ifndef _RXTXBB_REG_REG_H_ -#define _RXTXBB_REG_REG_H_ - -#define RXTXBB_RXTXBB1_ADDRESS 0x00000000 -#define RXTXBB_RXTXBB1_OFFSET 0x00000000 -#define RXTXBB_RXTXBB1_SPARE_MSB 31 -#define RXTXBB_RXTXBB1_SPARE_LSB 19 -#define RXTXBB_RXTXBB1_SPARE_MASK 0xfff80000 -#define RXTXBB_RXTXBB1_SPARE_GET(x) (((x) & RXTXBB_RXTXBB1_SPARE_MASK) >> RXTXBB_RXTXBB1_SPARE_LSB) -#define RXTXBB_RXTXBB1_SPARE_SET(x) (((x) << RXTXBB_RXTXBB1_SPARE_LSB) & RXTXBB_RXTXBB1_SPARE_MASK) -#define RXTXBB_RXTXBB1_FNOTCH_MSB 18 -#define RXTXBB_RXTXBB1_FNOTCH_LSB 17 -#define RXTXBB_RXTXBB1_FNOTCH_MASK 0x00060000 -#define RXTXBB_RXTXBB1_FNOTCH_GET(x) (((x) & RXTXBB_RXTXBB1_FNOTCH_MASK) >> RXTXBB_RXTXBB1_FNOTCH_LSB) -#define RXTXBB_RXTXBB1_FNOTCH_SET(x) (((x) << RXTXBB_RXTXBB1_FNOTCH_LSB) & RXTXBB_RXTXBB1_FNOTCH_MASK) -#define RXTXBB_RXTXBB1_SEL_ATB_MSB 16 -#define RXTXBB_RXTXBB1_SEL_ATB_LSB 9 -#define RXTXBB_RXTXBB1_SEL_ATB_MASK 0x0001fe00 -#define RXTXBB_RXTXBB1_SEL_ATB_GET(x) (((x) & RXTXBB_RXTXBB1_SEL_ATB_MASK) >> RXTXBB_RXTXBB1_SEL_ATB_LSB) -#define RXTXBB_RXTXBB1_SEL_ATB_SET(x) (((x) << RXTXBB_RXTXBB1_SEL_ATB_LSB) & RXTXBB_RXTXBB1_SEL_ATB_MASK) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_LSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MASK 0x00000100 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_GET(x) (((x) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) >> RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_SET(x) (((x) << RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) -#define RXTXBB_RXTXBB1_PDV2I_MSB 7 -#define RXTXBB_RXTXBB1_PDV2I_LSB 7 -#define RXTXBB_RXTXBB1_PDV2I_MASK 0x00000080 -#define RXTXBB_RXTXBB1_PDV2I_GET(x) (((x) & RXTXBB_RXTXBB1_PDV2I_MASK) >> RXTXBB_RXTXBB1_PDV2I_LSB) -#define RXTXBB_RXTXBB1_PDV2I_SET(x) (((x) << RXTXBB_RXTXBB1_PDV2I_LSB) & RXTXBB_RXTXBB1_PDV2I_MASK) -#define RXTXBB_RXTXBB1_PDI2V_MSB 6 -#define RXTXBB_RXTXBB1_PDI2V_LSB 6 -#define RXTXBB_RXTXBB1_PDI2V_MASK 0x00000040 -#define RXTXBB_RXTXBB1_PDI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDI2V_MASK) >> RXTXBB_RXTXBB1_PDI2V_LSB) -#define RXTXBB_RXTXBB1_PDI2V_SET(x) (((x) << RXTXBB_RXTXBB1_PDI2V_LSB) & RXTXBB_RXTXBB1_PDI2V_MASK) -#define RXTXBB_RXTXBB1_PDRXTXBB_MSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_LSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_MASK 0x00000020 -#define RXTXBB_RXTXBB1_PDRXTXBB_GET(x) (((x) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) >> RXTXBB_RXTXBB1_PDRXTXBB_LSB) -#define RXTXBB_RXTXBB1_PDRXTXBB_SET(x) (((x) << RXTXBB_RXTXBB1_PDRXTXBB_LSB) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK 0x00000010 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK 0x00000008 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_LSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MASK 0x00000004 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) >> RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_SET(x) (((x) << RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) -#define RXTXBB_RXTXBB1_PDLOQ_MSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_LSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_MASK 0x00000002 -#define RXTXBB_RXTXBB1_PDLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDLOQ_MASK) >> RXTXBB_RXTXBB1_PDLOQ_LSB) -#define RXTXBB_RXTXBB1_PDLOQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDLOQ_LSB) & RXTXBB_RXTXBB1_PDLOQ_MASK) -#define RXTXBB_RXTXBB1_PDHIQ_MSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_LSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_MASK 0x00000001 -#define RXTXBB_RXTXBB1_PDHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDHIQ_MASK) >> RXTXBB_RXTXBB1_PDHIQ_LSB) -#define RXTXBB_RXTXBB1_PDHIQ_SET(x) (((x) << RXTXBB_RXTXBB1_PDHIQ_LSB) & RXTXBB_RXTXBB1_PDHIQ_MASK) - -#define RXTXBB_RXTXBB2_ADDRESS 0x00000004 -#define RXTXBB_RXTXBB2_OFFSET 0x00000004 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MSB 31 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB 29 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK 0xe0000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_SET(x) (((x) << RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MSB 28 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB 26 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK 0x1c000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_SET(x) (((x) << RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MSB 25 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB 23 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK 0x03800000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_SET(x) (((x) << RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) -#define RXTXBB_RXTXBB2_SPARE_MSB 22 -#define RXTXBB_RXTXBB2_SPARE_LSB 21 -#define RXTXBB_RXTXBB2_SPARE_MASK 0x00600000 -#define RXTXBB_RXTXBB2_SPARE_GET(x) (((x) & RXTXBB_RXTXBB2_SPARE_MASK) >> RXTXBB_RXTXBB2_SPARE_LSB) -#define RXTXBB_RXTXBB2_SPARE_SET(x) (((x) << RXTXBB_RXTXBB2_SPARE_LSB) & RXTXBB_RXTXBB2_SPARE_MASK) -#define RXTXBB_RXTXBB2_SHORTBUFFER_MSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_LSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_MASK 0x00100000 -#define RXTXBB_RXTXBB2_SHORTBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) >> RXTXBB_RXTXBB2_SHORTBUFFER_LSB) -#define RXTXBB_RXTXBB2_SHORTBUFFER_SET(x) (((x) << RXTXBB_RXTXBB2_SHORTBUFFER_LSB) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) -#define RXTXBB_RXTXBB2_SELBUFFER_MSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_LSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_MASK 0x00080000 -#define RXTXBB_RXTXBB2_SELBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SELBUFFER_MASK) >> RXTXBB_RXTXBB2_SELBUFFER_LSB) -#define RXTXBB_RXTXBB2_SELBUFFER_SET(x) (((x) << RXTXBB_RXTXBB2_SELBUFFER_LSB) & RXTXBB_RXTXBB2_SELBUFFER_MASK) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK 0x00040000 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK 0x00020000 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK 0x00010000 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK 0x00008000 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_SET(x) (((x) << RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) -#define RXTXBB_RXTXBB2_CMSEL_MSB 14 -#define RXTXBB_RXTXBB2_CMSEL_LSB 13 -#define RXTXBB_RXTXBB2_CMSEL_MASK 0x00006000 -#define RXTXBB_RXTXBB2_CMSEL_GET(x) (((x) & RXTXBB_RXTXBB2_CMSEL_MASK) >> RXTXBB_RXTXBB2_CMSEL_LSB) -#define RXTXBB_RXTXBB2_CMSEL_SET(x) (((x) << RXTXBB_RXTXBB2_CMSEL_LSB) & RXTXBB_RXTXBB2_CMSEL_MASK) -#define RXTXBB_RXTXBB2_FILTERFC_MSB 12 -#define RXTXBB_RXTXBB2_FILTERFC_LSB 8 -#define RXTXBB_RXTXBB2_FILTERFC_MASK 0x00001f00 -#define RXTXBB_RXTXBB2_FILTERFC_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERFC_MASK) >> RXTXBB_RXTXBB2_FILTERFC_LSB) -#define RXTXBB_RXTXBB2_FILTERFC_SET(x) (((x) << RXTXBB_RXTXBB2_FILTERFC_LSB) & RXTXBB_RXTXBB2_FILTERFC_MASK) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK 0x00000080 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_GET(x) (((x) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) >> RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_SET(x) (((x) << RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK 0x00000040 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) >> RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_SET(x) (((x) << RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK 0x00000020 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK 0x00000010 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK 0x00000008 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK 0x00000004 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK 0x00000002 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_SET(x) (((x) << RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK 0x00000001 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_GET(x) (((x) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) >> RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_SET(x) (((x) << RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) - -#define RXTXBB_RXTXBB3_ADDRESS 0x00000008 -#define RXTXBB_RXTXBB3_OFFSET 0x00000008 -#define RXTXBB_RXTXBB3_SPARE_MSB 31 -#define RXTXBB_RXTXBB3_SPARE_LSB 27 -#define RXTXBB_RXTXBB3_SPARE_MASK 0xf8000000 -#define RXTXBB_RXTXBB3_SPARE_GET(x) (((x) & RXTXBB_RXTXBB3_SPARE_MASK) >> RXTXBB_RXTXBB3_SPARE_LSB) -#define RXTXBB_RXTXBB3_SPARE_SET(x) (((x) << RXTXBB_RXTXBB3_SPARE_LSB) & RXTXBB_RXTXBB3_SPARE_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MSB 26 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB 24 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK 0x07000000 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MSB 23 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB 21 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK 0x00e00000 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MSB 20 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB 18 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK 0x001c0000 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MSB 17 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB 15 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK 0x00038000 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MSB 14 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB 12 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK 0x00007000 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MSB 11 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB 9 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK 0x00000e00 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MSB 8 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB 6 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK 0x000001c0 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MSB 5 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB 3 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK 0x00000038 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) >> RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MSB 2 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB 0 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK 0x00000007 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_SET(x) (((x) << RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) - -#define RXTXBB_RXTXBB4_ADDRESS 0x0000000c -#define RXTXBB_RXTXBB4_OFFSET 0x0000000c -#define RXTXBB_RXTXBB4_SPARE_MSB 31 -#define RXTXBB_RXTXBB4_SPARE_LSB 31 -#define RXTXBB_RXTXBB4_SPARE_MASK 0x80000000 -#define RXTXBB_RXTXBB4_SPARE_GET(x) (((x) & RXTXBB_RXTXBB4_SPARE_MASK) >> RXTXBB_RXTXBB4_SPARE_LSB) -#define RXTXBB_RXTXBB4_SPARE_SET(x) (((x) << RXTXBB_RXTXBB4_SPARE_LSB) & RXTXBB_RXTXBB4_SPARE_MASK) -#define RXTXBB_RXTXBB4_LOCALOFFSET_MSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_LSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_MASK 0x40000000 -#define RXTXBB_RXTXBB4_LOCALOFFSET_GET(x) (((x) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) >> RXTXBB_RXTXBB4_LOCALOFFSET_LSB) -#define RXTXBB_RXTXBB4_LOCALOFFSET_SET(x) (((x) << RXTXBB_RXTXBB4_LOCALOFFSET_LSB) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHII_MSB 29 -#define RXTXBB_RXTXBB4_OFSTCORRHII_LSB 25 -#define RXTXBB_RXTXBB4_OFSTCORRHII_MASK 0x3e000000 -#define RXTXBB_RXTXBB4_OFSTCORRHII_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHII_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHII_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRHII_LSB) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MSB 24 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB 20 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK 0x01f00000 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MSB 19 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_LSB 15 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MASK 0x000f8000 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MSB 14 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB 10 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK 0x00007c00 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MSB 9 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB 5 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK 0x000003e0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MSB 4 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB 0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK 0x0000001f -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_SET(x) (((x) << RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct rxtxbb_reg_reg_s { - volatile unsigned int rxtxbb_rxtxbb1; - volatile unsigned int rxtxbb_rxtxbb2; - volatile unsigned int rxtxbb_rxtxbb3; - volatile unsigned int rxtxbb_rxtxbb4; -} rxtxbb_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _RXTXBB_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rxtxbb_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rxtxbb_reg.vrh deleted file mode 100644 index 0b15458c4635..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/rxtxbb_reg.vrh +++ /dev/null @@ -1,433 +0,0 @@ -#ifndef _RXTXBB_REG_VRH_ -#define _RXTXBB_REG_VRH_ - -#define RXTXBB_RXTXBB1_ADDRESS 'h00000000 -#define RXTXBB_RXTXBB1_SPARE_MSB 31 -#define RXTXBB_RXTXBB1_SPARE_LSB 19 -#define RXTXBB_RXTXBB1_SPARE_MASK 'hfff80000 -#define RXTXBB_RXTXBB1_SPARE_GET(x) (((x) & RXTXBB_RXTXBB1_SPARE_MASK) >> RXTXBB_RXTXBB1_SPARE_LSB) -#define RXTXBB_RXTXBB1_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_SPARE_LSB) & RXTXBB_RXTXBB1_SPARE_MASK) -#define RXTXBB_RXTXBB1_SPARE_RESET 13'h0 -#define RXTXBB_RXTXBB1_FNOTCH_MSB 18 -#define RXTXBB_RXTXBB1_FNOTCH_LSB 17 -#define RXTXBB_RXTXBB1_FNOTCH_MASK 'h00060000 -#define RXTXBB_RXTXBB1_FNOTCH_GET(x) (((x) & RXTXBB_RXTXBB1_FNOTCH_MASK) >> RXTXBB_RXTXBB1_FNOTCH_LSB) -#define RXTXBB_RXTXBB1_FNOTCH_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_FNOTCH_LSB) & RXTXBB_RXTXBB1_FNOTCH_MASK) -#define RXTXBB_RXTXBB1_FNOTCH_RESET 2'h0 -#define RXTXBB_RXTXBB1_SEL_ATB_MSB 16 -#define RXTXBB_RXTXBB1_SEL_ATB_LSB 9 -#define RXTXBB_RXTXBB1_SEL_ATB_MASK 'h0001fe00 -#define RXTXBB_RXTXBB1_SEL_ATB_GET(x) (((x) & RXTXBB_RXTXBB1_SEL_ATB_MASK) >> RXTXBB_RXTXBB1_SEL_ATB_LSB) -#define RXTXBB_RXTXBB1_SEL_ATB_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_SEL_ATB_LSB) & RXTXBB_RXTXBB1_SEL_ATB_MASK) -#define RXTXBB_RXTXBB1_SEL_ATB_RESET 8'h0 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_LSB 8 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_MASK 'h00000100 -#define RXTXBB_RXTXBB1_PDDACINTERFACE_GET(x) (((x) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) >> RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDDACINTERFACE_LSB) & RXTXBB_RXTXBB1_PDDACINTERFACE_MASK) -#define RXTXBB_RXTXBB1_PDDACINTERFACE_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDV2I_MSB 7 -#define RXTXBB_RXTXBB1_PDV2I_LSB 7 -#define RXTXBB_RXTXBB1_PDV2I_MASK 'h00000080 -#define RXTXBB_RXTXBB1_PDV2I_GET(x) (((x) & RXTXBB_RXTXBB1_PDV2I_MASK) >> RXTXBB_RXTXBB1_PDV2I_LSB) -#define RXTXBB_RXTXBB1_PDV2I_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDV2I_LSB) & RXTXBB_RXTXBB1_PDV2I_MASK) -#define RXTXBB_RXTXBB1_PDV2I_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDI2V_MSB 6 -#define RXTXBB_RXTXBB1_PDI2V_LSB 6 -#define RXTXBB_RXTXBB1_PDI2V_MASK 'h00000040 -#define RXTXBB_RXTXBB1_PDI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDI2V_MASK) >> RXTXBB_RXTXBB1_PDI2V_LSB) -#define RXTXBB_RXTXBB1_PDI2V_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDI2V_LSB) & RXTXBB_RXTXBB1_PDI2V_MASK) -#define RXTXBB_RXTXBB1_PDI2V_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDRXTXBB_MSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_LSB 5 -#define RXTXBB_RXTXBB1_PDRXTXBB_MASK 'h00000020 -#define RXTXBB_RXTXBB1_PDRXTXBB_GET(x) (((x) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) >> RXTXBB_RXTXBB1_PDRXTXBB_LSB) -#define RXTXBB_RXTXBB1_PDRXTXBB_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDRXTXBB_LSB) & RXTXBB_RXTXBB1_PDRXTXBB_MASK) -#define RXTXBB_RXTXBB1_PDRXTXBB_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB 4 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK 'h00000010 -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDOFFSETLOQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETLOQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB 3 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK 'h00000008 -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) >> RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDOFFSETHIQ_LSB) & RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETHIQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_LSB 2 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_MASK 'h00000004 -#define RXTXBB_RXTXBB1_PDOFFSETI2V_GET(x) (((x) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) >> RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDOFFSETI2V_LSB) & RXTXBB_RXTXBB1_PDOFFSETI2V_MASK) -#define RXTXBB_RXTXBB1_PDOFFSETI2V_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDLOQ_MSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_LSB 1 -#define RXTXBB_RXTXBB1_PDLOQ_MASK 'h00000002 -#define RXTXBB_RXTXBB1_PDLOQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDLOQ_MASK) >> RXTXBB_RXTXBB1_PDLOQ_LSB) -#define RXTXBB_RXTXBB1_PDLOQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDLOQ_LSB) & RXTXBB_RXTXBB1_PDLOQ_MASK) -#define RXTXBB_RXTXBB1_PDLOQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_PDHIQ_MSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_LSB 0 -#define RXTXBB_RXTXBB1_PDHIQ_MASK 'h00000001 -#define RXTXBB_RXTXBB1_PDHIQ_GET(x) (((x) & RXTXBB_RXTXBB1_PDHIQ_MASK) >> RXTXBB_RXTXBB1_PDHIQ_LSB) -#define RXTXBB_RXTXBB1_PDHIQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB1_PDHIQ_LSB) & RXTXBB_RXTXBB1_PDHIQ_MASK) -#define RXTXBB_RXTXBB1_PDHIQ_RESET 1'h0 -#define RXTXBB_RXTXBB1_RESET (32'h0 | \ - RXTXBB_RXTXBB1_SPARE_SET(RXTXBB_RXTXBB1_SPARE_RESET) | \ - RXTXBB_RXTXBB1_FNOTCH_SET(RXTXBB_RXTXBB1_FNOTCH_RESET) | \ - RXTXBB_RXTXBB1_SEL_ATB_SET(RXTXBB_RXTXBB1_SEL_ATB_RESET) | \ - RXTXBB_RXTXBB1_PDDACINTERFACE_SET(RXTXBB_RXTXBB1_PDDACINTERFACE_RESET) | \ - RXTXBB_RXTXBB1_PDV2I_SET(RXTXBB_RXTXBB1_PDV2I_RESET) | \ - RXTXBB_RXTXBB1_PDI2V_SET(RXTXBB_RXTXBB1_PDI2V_RESET) | \ - RXTXBB_RXTXBB1_PDRXTXBB_SET(RXTXBB_RXTXBB1_PDRXTXBB_RESET) | \ - RXTXBB_RXTXBB1_PDOFFSETLOQ_SET(RXTXBB_RXTXBB1_PDOFFSETLOQ_RESET) | \ - RXTXBB_RXTXBB1_PDOFFSETHIQ_SET(RXTXBB_RXTXBB1_PDOFFSETHIQ_RESET) | \ - RXTXBB_RXTXBB1_PDOFFSETI2V_SET(RXTXBB_RXTXBB1_PDOFFSETI2V_RESET) | \ - RXTXBB_RXTXBB1_PDLOQ_SET(RXTXBB_RXTXBB1_PDLOQ_RESET) | \ - RXTXBB_RXTXBB1_PDHIQ_SET(RXTXBB_RXTXBB1_PDHIQ_RESET)) -#define RXTXBB_RXTXBB1_HW_MASK (32'h0) -#define RXTXBB_RXTXBB1_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB1_SPARE_MASK | \ - RXTXBB_RXTXBB1_FNOTCH_MASK | \ - RXTXBB_RXTXBB1_SEL_ATB_MASK | \ - RXTXBB_RXTXBB1_PDDACINTERFACE_MASK | \ - RXTXBB_RXTXBB1_PDV2I_MASK | \ - RXTXBB_RXTXBB1_PDI2V_MASK | \ - RXTXBB_RXTXBB1_PDRXTXBB_MASK | \ - RXTXBB_RXTXBB1_PDOFFSETLOQ_MASK | \ - RXTXBB_RXTXBB1_PDOFFSETHIQ_MASK | \ - RXTXBB_RXTXBB1_PDOFFSETI2V_MASK | \ - RXTXBB_RXTXBB1_PDLOQ_MASK | \ - RXTXBB_RXTXBB1_PDHIQ_MASK) - -#define RXTXBB_RXTXBB2_ADDRESS 'h00000004 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MSB 31 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB 29 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK 'he0000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_RESET 3'h6 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MSB 28 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB 26 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK 'h1c000000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_RESET 3'h6 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MSB 25 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB 23 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK 'h03800000 -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) >> RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_LSB) & RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK) -#define RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_RESET 3'h6 -#define RXTXBB_RXTXBB2_SPARE_MSB 22 -#define RXTXBB_RXTXBB2_SPARE_LSB 21 -#define RXTXBB_RXTXBB2_SPARE_MASK 'h00600000 -#define RXTXBB_RXTXBB2_SPARE_GET(x) (((x) & RXTXBB_RXTXBB2_SPARE_MASK) >> RXTXBB_RXTXBB2_SPARE_LSB) -#define RXTXBB_RXTXBB2_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SPARE_LSB) & RXTXBB_RXTXBB2_SPARE_MASK) -#define RXTXBB_RXTXBB2_SPARE_RESET 2'h0 -#define RXTXBB_RXTXBB2_SHORTBUFFER_MSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_LSB 20 -#define RXTXBB_RXTXBB2_SHORTBUFFER_MASK 'h00100000 -#define RXTXBB_RXTXBB2_SHORTBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) >> RXTXBB_RXTXBB2_SHORTBUFFER_LSB) -#define RXTXBB_RXTXBB2_SHORTBUFFER_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SHORTBUFFER_LSB) & RXTXBB_RXTXBB2_SHORTBUFFER_MASK) -#define RXTXBB_RXTXBB2_SHORTBUFFER_RESET 1'h0 -#define RXTXBB_RXTXBB2_SELBUFFER_MSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_LSB 19 -#define RXTXBB_RXTXBB2_SELBUFFER_MASK 'h00080000 -#define RXTXBB_RXTXBB2_SELBUFFER_GET(x) (((x) & RXTXBB_RXTXBB2_SELBUFFER_MASK) >> RXTXBB_RXTXBB2_SELBUFFER_LSB) -#define RXTXBB_RXTXBB2_SELBUFFER_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SELBUFFER_LSB) & RXTXBB_RXTXBB2_SELBUFFER_MASK) -#define RXTXBB_RXTXBB2_SELBUFFER_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB 18 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK 'h00040000 -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_DAC_TEST_LSB) & RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_DAC_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB 17 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK 'h00020000 -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_LOQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_LOQ_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB 16 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK 'h00010000 -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_HIQ_TEST_LSB) & RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_HIQ_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB 15 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK 'h00008000 -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_GET(x) (((x) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) >> RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_SEL_I2V_TEST_LSB) & RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK) -#define RXTXBB_RXTXBB2_SEL_I2V_TEST_RESET 1'h0 -#define RXTXBB_RXTXBB2_CMSEL_MSB 14 -#define RXTXBB_RXTXBB2_CMSEL_LSB 13 -#define RXTXBB_RXTXBB2_CMSEL_MASK 'h00006000 -#define RXTXBB_RXTXBB2_CMSEL_GET(x) (((x) & RXTXBB_RXTXBB2_CMSEL_MASK) >> RXTXBB_RXTXBB2_CMSEL_LSB) -#define RXTXBB_RXTXBB2_CMSEL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_CMSEL_LSB) & RXTXBB_RXTXBB2_CMSEL_MASK) -#define RXTXBB_RXTXBB2_CMSEL_RESET 2'h1 -#define RXTXBB_RXTXBB2_FILTERFC_MSB 12 -#define RXTXBB_RXTXBB2_FILTERFC_LSB 8 -#define RXTXBB_RXTXBB2_FILTERFC_MASK 'h00001f00 -#define RXTXBB_RXTXBB2_FILTERFC_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERFC_MASK) >> RXTXBB_RXTXBB2_FILTERFC_LSB) -#define RXTXBB_RXTXBB2_FILTERFC_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_FILTERFC_LSB) & RXTXBB_RXTXBB2_FILTERFC_MASK) -#define RXTXBB_RXTXBB2_FILTERFC_RESET 5'h10 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB 7 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK 'h00000080 -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_GET(x) (((x) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) >> RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_LOCALFILTERTUNING_LSB) & RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK) -#define RXTXBB_RXTXBB2_LOCALFILTERTUNING_RESET 1'h0 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB 6 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK 'h00000040 -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_GET(x) (((x) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) >> RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_FILTERDOUBLEBW_LSB) & RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK) -#define RXTXBB_RXTXBB2_FILTERDOUBLEBW_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB 5 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK 'h00000020 -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH2HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH2HIQ_EN_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB 4 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK 'h00000010 -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH1HIQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1HIQ_EN_RESET 1'h1 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB 3 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK 'h00000008 -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH3LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH3LOQ_EN_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB 2 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK 'h00000004 -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH2LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH2LOQ_EN_RESET 1'h0 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB 1 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK 'h00000002 -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_GET(x) (((x) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) >> RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH1LOQ_EN_LSB) & RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK) -#define RXTXBB_RXTXBB2_PATH1LOQ_EN_RESET 1'h1 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB 0 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK 'h00000001 -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_GET(x) (((x) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) >> RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB2_PATH_OVERRIDE_LSB) & RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) -#define RXTXBB_RXTXBB2_PATH_OVERRIDE_RESET 1'h0 -#define RXTXBB_RXTXBB2_RESET (32'h0 | \ - RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_SET(RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_RESET) | \ - RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_SET(RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_RESET) | \ - RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_SET(RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_RESET) | \ - RXTXBB_RXTXBB2_SPARE_SET(RXTXBB_RXTXBB2_SPARE_RESET) | \ - RXTXBB_RXTXBB2_SHORTBUFFER_SET(RXTXBB_RXTXBB2_SHORTBUFFER_RESET) | \ - RXTXBB_RXTXBB2_SELBUFFER_SET(RXTXBB_RXTXBB2_SELBUFFER_RESET) | \ - RXTXBB_RXTXBB2_SEL_DAC_TEST_SET(RXTXBB_RXTXBB2_SEL_DAC_TEST_RESET) | \ - RXTXBB_RXTXBB2_SEL_LOQ_TEST_SET(RXTXBB_RXTXBB2_SEL_LOQ_TEST_RESET) | \ - RXTXBB_RXTXBB2_SEL_HIQ_TEST_SET(RXTXBB_RXTXBB2_SEL_HIQ_TEST_RESET) | \ - RXTXBB_RXTXBB2_SEL_I2V_TEST_SET(RXTXBB_RXTXBB2_SEL_I2V_TEST_RESET) | \ - RXTXBB_RXTXBB2_CMSEL_SET(RXTXBB_RXTXBB2_CMSEL_RESET) | \ - RXTXBB_RXTXBB2_FILTERFC_SET(RXTXBB_RXTXBB2_FILTERFC_RESET) | \ - RXTXBB_RXTXBB2_LOCALFILTERTUNING_SET(RXTXBB_RXTXBB2_LOCALFILTERTUNING_RESET) | \ - RXTXBB_RXTXBB2_FILTERDOUBLEBW_SET(RXTXBB_RXTXBB2_FILTERDOUBLEBW_RESET) | \ - RXTXBB_RXTXBB2_PATH2HIQ_EN_SET(RXTXBB_RXTXBB2_PATH2HIQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH1HIQ_EN_SET(RXTXBB_RXTXBB2_PATH1HIQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH3LOQ_EN_SET(RXTXBB_RXTXBB2_PATH3LOQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH2LOQ_EN_SET(RXTXBB_RXTXBB2_PATH2LOQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH1LOQ_EN_SET(RXTXBB_RXTXBB2_PATH1LOQ_EN_RESET) | \ - RXTXBB_RXTXBB2_PATH_OVERRIDE_SET(RXTXBB_RXTXBB2_PATH_OVERRIDE_RESET)) -#define RXTXBB_RXTXBB2_HW_MASK (32'h0 | \ - RXTXBB_RXTXBB2_FILTERFC_MASK) -#define RXTXBB_RXTXBB2_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB2_IBN_37P5_OSHI_CTRL_MASK | \ - RXTXBB_RXTXBB2_IBN_37P5_OSLO_CTRL_MASK | \ - RXTXBB_RXTXBB2_IBN_37P5_OSI2V_CTRL_MASK | \ - RXTXBB_RXTXBB2_SPARE_MASK | \ - RXTXBB_RXTXBB2_SHORTBUFFER_MASK | \ - RXTXBB_RXTXBB2_SELBUFFER_MASK | \ - RXTXBB_RXTXBB2_SEL_DAC_TEST_MASK | \ - RXTXBB_RXTXBB2_SEL_LOQ_TEST_MASK | \ - RXTXBB_RXTXBB2_SEL_HIQ_TEST_MASK | \ - RXTXBB_RXTXBB2_SEL_I2V_TEST_MASK | \ - RXTXBB_RXTXBB2_CMSEL_MASK | \ - RXTXBB_RXTXBB2_FILTERFC_MASK | \ - RXTXBB_RXTXBB2_LOCALFILTERTUNING_MASK | \ - RXTXBB_RXTXBB2_FILTERDOUBLEBW_MASK | \ - RXTXBB_RXTXBB2_PATH2HIQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH1HIQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH3LOQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH2LOQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH1LOQ_EN_MASK | \ - RXTXBB_RXTXBB2_PATH_OVERRIDE_MASK) - -#define RXTXBB_RXTXBB3_ADDRESS 'h00000008 -#define RXTXBB_RXTXBB3_SPARE_MSB 31 -#define RXTXBB_RXTXBB3_SPARE_LSB 27 -#define RXTXBB_RXTXBB3_SPARE_MASK 'hf8000000 -#define RXTXBB_RXTXBB3_SPARE_GET(x) (((x) & RXTXBB_RXTXBB3_SPARE_MASK) >> RXTXBB_RXTXBB3_SPARE_LSB) -#define RXTXBB_RXTXBB3_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_SPARE_LSB) & RXTXBB_RXTXBB3_SPARE_MASK) -#define RXTXBB_RXTXBB3_SPARE_RESET 5'h0 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MSB 26 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB 24 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK 'h07000000 -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MSB 23 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB 21 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK 'h00e00000 -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MSB 20 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB 18 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK 'h001c0000 -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MSB 17 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB 15 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK 'h00038000 -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MSB 14 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB 12 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK 'h00007000 -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MSB 11 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB 9 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK 'h00000e00 -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MSB 8 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB 6 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK 'h000001c0 -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MSB 5 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB 3 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK 'h00000038 -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) >> RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_LSB) & RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_RESET 3'h2 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MSB 2 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB 0 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK 'h00000007 -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_GET(x) (((x) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) >> RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_LSB) & RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) -#define RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_RESET 3'h4 -#define RXTXBB_RXTXBB3_RESET (32'h0 | \ - RXTXBB_RXTXBB3_SPARE_SET(RXTXBB_RXTXBB3_SPARE_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_SET(RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_SET(RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_RESET) | \ - RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_SET(RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_RESET)) -#define RXTXBB_RXTXBB3_HW_MASK (32'h0) -#define RXTXBB_RXTXBB3_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB3_SPARE_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_CM_BUFAMP_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_BKV2I_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_I2V_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_HI1_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_HI2_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_LO1_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_25U_LO2_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBRN_12P5_CM_CTRL_MASK | \ - RXTXBB_RXTXBB3_IBN_100U_TEST_CTRL_MASK) - -#define RXTXBB_RXTXBB4_ADDRESS 'h0000000c -#define RXTXBB_RXTXBB4_SPARE_MSB 31 -#define RXTXBB_RXTXBB4_SPARE_LSB 31 -#define RXTXBB_RXTXBB4_SPARE_MASK 'h80000000 -#define RXTXBB_RXTXBB4_SPARE_GET(x) (((x) & RXTXBB_RXTXBB4_SPARE_MASK) >> RXTXBB_RXTXBB4_SPARE_LSB) -#define RXTXBB_RXTXBB4_SPARE_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_SPARE_LSB) & RXTXBB_RXTXBB4_SPARE_MASK) -#define RXTXBB_RXTXBB4_SPARE_RESET 1'h0 -#define RXTXBB_RXTXBB4_LOCALOFFSET_MSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_LSB 30 -#define RXTXBB_RXTXBB4_LOCALOFFSET_MASK 'h40000000 -#define RXTXBB_RXTXBB4_LOCALOFFSET_GET(x) (((x) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) >> RXTXBB_RXTXBB4_LOCALOFFSET_LSB) -#define RXTXBB_RXTXBB4_LOCALOFFSET_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_LOCALOFFSET_LSB) & RXTXBB_RXTXBB4_LOCALOFFSET_MASK) -#define RXTXBB_RXTXBB4_LOCALOFFSET_RESET 1'h0 -#define RXTXBB_RXTXBB4_OFSTCORRHII_MSB 29 -#define RXTXBB_RXTXBB4_OFSTCORRHII_LSB 25 -#define RXTXBB_RXTXBB4_OFSTCORRHII_MASK 'h3e000000 -#define RXTXBB_RXTXBB4_OFSTCORRHII_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHII_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHII_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRHII_LSB) & RXTXBB_RXTXBB4_OFSTCORRHII_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHII_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MSB 24 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB 20 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK 'h01f00000 -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRHIQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRHIQ_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MSB 19 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_LSB 15 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_MASK 'h000f8000 -#define RXTXBB_RXTXBB4_OFSTCORRLOI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRLOI_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOI_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MSB 14 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB 10 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK 'h00007c00 -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRLOQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRLOQ_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MSB 9 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB 5 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK 'h000003e0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRI2VI_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VI_RESET 5'h10 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MSB 4 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB 0 -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK 'h0000001f -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_GET(x) (((x) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) >> RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_SET(x) (((32'd0 | (x)) << RXTXBB_RXTXBB4_OFSTCORRI2VQ_LSB) & RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) -#define RXTXBB_RXTXBB4_OFSTCORRI2VQ_RESET 5'h10 -#define RXTXBB_RXTXBB4_RESET (32'h0 | \ - RXTXBB_RXTXBB4_SPARE_SET(RXTXBB_RXTXBB4_SPARE_RESET) | \ - RXTXBB_RXTXBB4_LOCALOFFSET_SET(RXTXBB_RXTXBB4_LOCALOFFSET_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRHII_SET(RXTXBB_RXTXBB4_OFSTCORRHII_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRHIQ_SET(RXTXBB_RXTXBB4_OFSTCORRHIQ_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRLOI_SET(RXTXBB_RXTXBB4_OFSTCORRLOI_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRLOQ_SET(RXTXBB_RXTXBB4_OFSTCORRLOQ_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRI2VI_SET(RXTXBB_RXTXBB4_OFSTCORRI2VI_RESET) | \ - RXTXBB_RXTXBB4_OFSTCORRI2VQ_SET(RXTXBB_RXTXBB4_OFSTCORRI2VQ_RESET)) -#define RXTXBB_RXTXBB4_HW_MASK (32'h0 | \ - RXTXBB_RXTXBB4_OFSTCORRHII_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) -#define RXTXBB_RXTXBB4_SW_MASK (32'h0 | \ - RXTXBB_RXTXBB4_SPARE_MASK | \ - RXTXBB_RXTXBB4_LOCALOFFSET_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRHII_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRHIQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRLOQ_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VI_MASK | \ - RXTXBB_RXTXBB4_OFSTCORRI2VQ_MASK) - -#define RXTXBB_REG_ADDRESS_MSB 3 - -#endif /* _RXTXBB_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/si_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/si_reg.h deleted file mode 100644 index 16fb99cfd0b8..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/si_reg.h +++ /dev/null @@ -1,186 +0,0 @@ -#ifndef _SI_REG_REG_H_ -#define _SI_REG_REG_H_ - -#define SI_CONFIG_ADDRESS 0x00000000 -#define SI_CONFIG_OFFSET 0x00000000 -#define SI_CONFIG_ERR_INT_MSB 19 -#define SI_CONFIG_ERR_INT_LSB 19 -#define SI_CONFIG_ERR_INT_MASK 0x00080000 -#define SI_CONFIG_ERR_INT_GET(x) (((x) & SI_CONFIG_ERR_INT_MASK) >> SI_CONFIG_ERR_INT_LSB) -#define SI_CONFIG_ERR_INT_SET(x) (((x) << SI_CONFIG_ERR_INT_LSB) & SI_CONFIG_ERR_INT_MASK) -#define SI_CONFIG_BIDIR_OD_DATA_MSB 18 -#define SI_CONFIG_BIDIR_OD_DATA_LSB 18 -#define SI_CONFIG_BIDIR_OD_DATA_MASK 0x00040000 -#define SI_CONFIG_BIDIR_OD_DATA_GET(x) (((x) & SI_CONFIG_BIDIR_OD_DATA_MASK) >> SI_CONFIG_BIDIR_OD_DATA_LSB) -#define SI_CONFIG_BIDIR_OD_DATA_SET(x) (((x) << SI_CONFIG_BIDIR_OD_DATA_LSB) & SI_CONFIG_BIDIR_OD_DATA_MASK) -#define SI_CONFIG_I2C_MSB 16 -#define SI_CONFIG_I2C_LSB 16 -#define SI_CONFIG_I2C_MASK 0x00010000 -#define SI_CONFIG_I2C_GET(x) (((x) & SI_CONFIG_I2C_MASK) >> SI_CONFIG_I2C_LSB) -#define SI_CONFIG_I2C_SET(x) (((x) << SI_CONFIG_I2C_LSB) & SI_CONFIG_I2C_MASK) -#define SI_CONFIG_POS_SAMPLE_MSB 7 -#define SI_CONFIG_POS_SAMPLE_LSB 7 -#define SI_CONFIG_POS_SAMPLE_MASK 0x00000080 -#define SI_CONFIG_POS_SAMPLE_GET(x) (((x) & SI_CONFIG_POS_SAMPLE_MASK) >> SI_CONFIG_POS_SAMPLE_LSB) -#define SI_CONFIG_POS_SAMPLE_SET(x) (((x) << SI_CONFIG_POS_SAMPLE_LSB) & SI_CONFIG_POS_SAMPLE_MASK) -#define SI_CONFIG_POS_DRIVE_MSB 6 -#define SI_CONFIG_POS_DRIVE_LSB 6 -#define SI_CONFIG_POS_DRIVE_MASK 0x00000040 -#define SI_CONFIG_POS_DRIVE_GET(x) (((x) & SI_CONFIG_POS_DRIVE_MASK) >> SI_CONFIG_POS_DRIVE_LSB) -#define SI_CONFIG_POS_DRIVE_SET(x) (((x) << SI_CONFIG_POS_DRIVE_LSB) & SI_CONFIG_POS_DRIVE_MASK) -#define SI_CONFIG_INACTIVE_DATA_MSB 5 -#define SI_CONFIG_INACTIVE_DATA_LSB 5 -#define SI_CONFIG_INACTIVE_DATA_MASK 0x00000020 -#define SI_CONFIG_INACTIVE_DATA_GET(x) (((x) & SI_CONFIG_INACTIVE_DATA_MASK) >> SI_CONFIG_INACTIVE_DATA_LSB) -#define SI_CONFIG_INACTIVE_DATA_SET(x) (((x) << SI_CONFIG_INACTIVE_DATA_LSB) & SI_CONFIG_INACTIVE_DATA_MASK) -#define SI_CONFIG_INACTIVE_CLK_MSB 4 -#define SI_CONFIG_INACTIVE_CLK_LSB 4 -#define SI_CONFIG_INACTIVE_CLK_MASK 0x00000010 -#define SI_CONFIG_INACTIVE_CLK_GET(x) (((x) & SI_CONFIG_INACTIVE_CLK_MASK) >> SI_CONFIG_INACTIVE_CLK_LSB) -#define SI_CONFIG_INACTIVE_CLK_SET(x) (((x) << SI_CONFIG_INACTIVE_CLK_LSB) & SI_CONFIG_INACTIVE_CLK_MASK) -#define SI_CONFIG_DIVIDER_MSB 3 -#define SI_CONFIG_DIVIDER_LSB 0 -#define SI_CONFIG_DIVIDER_MASK 0x0000000f -#define SI_CONFIG_DIVIDER_GET(x) (((x) & SI_CONFIG_DIVIDER_MASK) >> SI_CONFIG_DIVIDER_LSB) -#define SI_CONFIG_DIVIDER_SET(x) (((x) << SI_CONFIG_DIVIDER_LSB) & SI_CONFIG_DIVIDER_MASK) - -#define SI_CS_ADDRESS 0x00000004 -#define SI_CS_OFFSET 0x00000004 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_MSB 13 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_LSB 11 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_MASK 0x00003800 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_GET(x) (((x) & SI_CS_BIT_CNT_IN_LAST_BYTE_MASK) >> SI_CS_BIT_CNT_IN_LAST_BYTE_LSB) -#define SI_CS_BIT_CNT_IN_LAST_BYTE_SET(x) (((x) << SI_CS_BIT_CNT_IN_LAST_BYTE_LSB) & SI_CS_BIT_CNT_IN_LAST_BYTE_MASK) -#define SI_CS_DONE_ERR_MSB 10 -#define SI_CS_DONE_ERR_LSB 10 -#define SI_CS_DONE_ERR_MASK 0x00000400 -#define SI_CS_DONE_ERR_GET(x) (((x) & SI_CS_DONE_ERR_MASK) >> SI_CS_DONE_ERR_LSB) -#define SI_CS_DONE_ERR_SET(x) (((x) << SI_CS_DONE_ERR_LSB) & SI_CS_DONE_ERR_MASK) -#define SI_CS_DONE_INT_MSB 9 -#define SI_CS_DONE_INT_LSB 9 -#define SI_CS_DONE_INT_MASK 0x00000200 -#define SI_CS_DONE_INT_GET(x) (((x) & SI_CS_DONE_INT_MASK) >> SI_CS_DONE_INT_LSB) -#define SI_CS_DONE_INT_SET(x) (((x) << SI_CS_DONE_INT_LSB) & SI_CS_DONE_INT_MASK) -#define SI_CS_START_MSB 8 -#define SI_CS_START_LSB 8 -#define SI_CS_START_MASK 0x00000100 -#define SI_CS_START_GET(x) (((x) & SI_CS_START_MASK) >> SI_CS_START_LSB) -#define SI_CS_START_SET(x) (((x) << SI_CS_START_LSB) & SI_CS_START_MASK) -#define SI_CS_RX_CNT_MSB 7 -#define SI_CS_RX_CNT_LSB 4 -#define SI_CS_RX_CNT_MASK 0x000000f0 -#define SI_CS_RX_CNT_GET(x) (((x) & SI_CS_RX_CNT_MASK) >> SI_CS_RX_CNT_LSB) -#define SI_CS_RX_CNT_SET(x) (((x) << SI_CS_RX_CNT_LSB) & SI_CS_RX_CNT_MASK) -#define SI_CS_TX_CNT_MSB 3 -#define SI_CS_TX_CNT_LSB 0 -#define SI_CS_TX_CNT_MASK 0x0000000f -#define SI_CS_TX_CNT_GET(x) (((x) & SI_CS_TX_CNT_MASK) >> SI_CS_TX_CNT_LSB) -#define SI_CS_TX_CNT_SET(x) (((x) << SI_CS_TX_CNT_LSB) & SI_CS_TX_CNT_MASK) - -#define SI_TX_DATA0_ADDRESS 0x00000008 -#define SI_TX_DATA0_OFFSET 0x00000008 -#define SI_TX_DATA0_DATA3_MSB 31 -#define SI_TX_DATA0_DATA3_LSB 24 -#define SI_TX_DATA0_DATA3_MASK 0xff000000 -#define SI_TX_DATA0_DATA3_GET(x) (((x) & SI_TX_DATA0_DATA3_MASK) >> SI_TX_DATA0_DATA3_LSB) -#define SI_TX_DATA0_DATA3_SET(x) (((x) << SI_TX_DATA0_DATA3_LSB) & SI_TX_DATA0_DATA3_MASK) -#define SI_TX_DATA0_DATA2_MSB 23 -#define SI_TX_DATA0_DATA2_LSB 16 -#define SI_TX_DATA0_DATA2_MASK 0x00ff0000 -#define SI_TX_DATA0_DATA2_GET(x) (((x) & SI_TX_DATA0_DATA2_MASK) >> SI_TX_DATA0_DATA2_LSB) -#define SI_TX_DATA0_DATA2_SET(x) (((x) << SI_TX_DATA0_DATA2_LSB) & SI_TX_DATA0_DATA2_MASK) -#define SI_TX_DATA0_DATA1_MSB 15 -#define SI_TX_DATA0_DATA1_LSB 8 -#define SI_TX_DATA0_DATA1_MASK 0x0000ff00 -#define SI_TX_DATA0_DATA1_GET(x) (((x) & SI_TX_DATA0_DATA1_MASK) >> SI_TX_DATA0_DATA1_LSB) -#define SI_TX_DATA0_DATA1_SET(x) (((x) << SI_TX_DATA0_DATA1_LSB) & SI_TX_DATA0_DATA1_MASK) -#define SI_TX_DATA0_DATA0_MSB 7 -#define SI_TX_DATA0_DATA0_LSB 0 -#define SI_TX_DATA0_DATA0_MASK 0x000000ff -#define SI_TX_DATA0_DATA0_GET(x) (((x) & SI_TX_DATA0_DATA0_MASK) >> SI_TX_DATA0_DATA0_LSB) -#define SI_TX_DATA0_DATA0_SET(x) (((x) << SI_TX_DATA0_DATA0_LSB) & SI_TX_DATA0_DATA0_MASK) - -#define SI_TX_DATA1_ADDRESS 0x0000000c -#define SI_TX_DATA1_OFFSET 0x0000000c -#define SI_TX_DATA1_DATA7_MSB 31 -#define SI_TX_DATA1_DATA7_LSB 24 -#define SI_TX_DATA1_DATA7_MASK 0xff000000 -#define SI_TX_DATA1_DATA7_GET(x) (((x) & SI_TX_DATA1_DATA7_MASK) >> SI_TX_DATA1_DATA7_LSB) -#define SI_TX_DATA1_DATA7_SET(x) (((x) << SI_TX_DATA1_DATA7_LSB) & SI_TX_DATA1_DATA7_MASK) -#define SI_TX_DATA1_DATA6_MSB 23 -#define SI_TX_DATA1_DATA6_LSB 16 -#define SI_TX_DATA1_DATA6_MASK 0x00ff0000 -#define SI_TX_DATA1_DATA6_GET(x) (((x) & SI_TX_DATA1_DATA6_MASK) >> SI_TX_DATA1_DATA6_LSB) -#define SI_TX_DATA1_DATA6_SET(x) (((x) << SI_TX_DATA1_DATA6_LSB) & SI_TX_DATA1_DATA6_MASK) -#define SI_TX_DATA1_DATA5_MSB 15 -#define SI_TX_DATA1_DATA5_LSB 8 -#define SI_TX_DATA1_DATA5_MASK 0x0000ff00 -#define SI_TX_DATA1_DATA5_GET(x) (((x) & SI_TX_DATA1_DATA5_MASK) >> SI_TX_DATA1_DATA5_LSB) -#define SI_TX_DATA1_DATA5_SET(x) (((x) << SI_TX_DATA1_DATA5_LSB) & SI_TX_DATA1_DATA5_MASK) -#define SI_TX_DATA1_DATA4_MSB 7 -#define SI_TX_DATA1_DATA4_LSB 0 -#define SI_TX_DATA1_DATA4_MASK 0x000000ff -#define SI_TX_DATA1_DATA4_GET(x) (((x) & SI_TX_DATA1_DATA4_MASK) >> SI_TX_DATA1_DATA4_LSB) -#define SI_TX_DATA1_DATA4_SET(x) (((x) << SI_TX_DATA1_DATA4_LSB) & SI_TX_DATA1_DATA4_MASK) - -#define SI_RX_DATA0_ADDRESS 0x00000010 -#define SI_RX_DATA0_OFFSET 0x00000010 -#define SI_RX_DATA0_DATA3_MSB 31 -#define SI_RX_DATA0_DATA3_LSB 24 -#define SI_RX_DATA0_DATA3_MASK 0xff000000 -#define SI_RX_DATA0_DATA3_GET(x) (((x) & SI_RX_DATA0_DATA3_MASK) >> SI_RX_DATA0_DATA3_LSB) -#define SI_RX_DATA0_DATA3_SET(x) (((x) << SI_RX_DATA0_DATA3_LSB) & SI_RX_DATA0_DATA3_MASK) -#define SI_RX_DATA0_DATA2_MSB 23 -#define SI_RX_DATA0_DATA2_LSB 16 -#define SI_RX_DATA0_DATA2_MASK 0x00ff0000 -#define SI_RX_DATA0_DATA2_GET(x) (((x) & SI_RX_DATA0_DATA2_MASK) >> SI_RX_DATA0_DATA2_LSB) -#define SI_RX_DATA0_DATA2_SET(x) (((x) << SI_RX_DATA0_DATA2_LSB) & SI_RX_DATA0_DATA2_MASK) -#define SI_RX_DATA0_DATA1_MSB 15 -#define SI_RX_DATA0_DATA1_LSB 8 -#define SI_RX_DATA0_DATA1_MASK 0x0000ff00 -#define SI_RX_DATA0_DATA1_GET(x) (((x) & SI_RX_DATA0_DATA1_MASK) >> SI_RX_DATA0_DATA1_LSB) -#define SI_RX_DATA0_DATA1_SET(x) (((x) << SI_RX_DATA0_DATA1_LSB) & SI_RX_DATA0_DATA1_MASK) -#define SI_RX_DATA0_DATA0_MSB 7 -#define SI_RX_DATA0_DATA0_LSB 0 -#define SI_RX_DATA0_DATA0_MASK 0x000000ff -#define SI_RX_DATA0_DATA0_GET(x) (((x) & SI_RX_DATA0_DATA0_MASK) >> SI_RX_DATA0_DATA0_LSB) -#define SI_RX_DATA0_DATA0_SET(x) (((x) << SI_RX_DATA0_DATA0_LSB) & SI_RX_DATA0_DATA0_MASK) - -#define SI_RX_DATA1_ADDRESS 0x00000014 -#define SI_RX_DATA1_OFFSET 0x00000014 -#define SI_RX_DATA1_DATA7_MSB 31 -#define SI_RX_DATA1_DATA7_LSB 24 -#define SI_RX_DATA1_DATA7_MASK 0xff000000 -#define SI_RX_DATA1_DATA7_GET(x) (((x) & SI_RX_DATA1_DATA7_MASK) >> SI_RX_DATA1_DATA7_LSB) -#define SI_RX_DATA1_DATA7_SET(x) (((x) << SI_RX_DATA1_DATA7_LSB) & SI_RX_DATA1_DATA7_MASK) -#define SI_RX_DATA1_DATA6_MSB 23 -#define SI_RX_DATA1_DATA6_LSB 16 -#define SI_RX_DATA1_DATA6_MASK 0x00ff0000 -#define SI_RX_DATA1_DATA6_GET(x) (((x) & SI_RX_DATA1_DATA6_MASK) >> SI_RX_DATA1_DATA6_LSB) -#define SI_RX_DATA1_DATA6_SET(x) (((x) << SI_RX_DATA1_DATA6_LSB) & SI_RX_DATA1_DATA6_MASK) -#define SI_RX_DATA1_DATA5_MSB 15 -#define SI_RX_DATA1_DATA5_LSB 8 -#define SI_RX_DATA1_DATA5_MASK 0x0000ff00 -#define SI_RX_DATA1_DATA5_GET(x) (((x) & SI_RX_DATA1_DATA5_MASK) >> SI_RX_DATA1_DATA5_LSB) -#define SI_RX_DATA1_DATA5_SET(x) (((x) << SI_RX_DATA1_DATA5_LSB) & SI_RX_DATA1_DATA5_MASK) -#define SI_RX_DATA1_DATA4_MSB 7 -#define SI_RX_DATA1_DATA4_LSB 0 -#define SI_RX_DATA1_DATA4_MASK 0x000000ff -#define SI_RX_DATA1_DATA4_GET(x) (((x) & SI_RX_DATA1_DATA4_MASK) >> SI_RX_DATA1_DATA4_LSB) -#define SI_RX_DATA1_DATA4_SET(x) (((x) << SI_RX_DATA1_DATA4_LSB) & SI_RX_DATA1_DATA4_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct si_reg_reg_s { - volatile unsigned int si_config; - volatile unsigned int si_cs; - volatile unsigned int si_tx_data0; - volatile unsigned int si_tx_data1; - volatile unsigned int si_rx_data0; - volatile unsigned int si_rx_data1; -} si_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _SI_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/si_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/si_reg.vrh deleted file mode 100644 index 10751ad46f80..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/si_reg.vrh +++ /dev/null @@ -1,278 +0,0 @@ -#ifndef _SI_REG_VRH_ -#define _SI_REG_VRH_ - -#define SI_CONFIG_ADDRESS 'h00000000 -#define SI_CONFIG_ERR_INT_MSB 19 -#define SI_CONFIG_ERR_INT_LSB 19 -#define SI_CONFIG_ERR_INT_MASK 'h00080000 -#define SI_CONFIG_ERR_INT_GET(x) (((x) & SI_CONFIG_ERR_INT_MASK) >> SI_CONFIG_ERR_INT_LSB) -#define SI_CONFIG_ERR_INT_SET(x) (((32'd0 | (x)) << SI_CONFIG_ERR_INT_LSB) & SI_CONFIG_ERR_INT_MASK) -#define SI_CONFIG_ERR_INT_RESET 1'h0 -#define SI_CONFIG_BIDIR_OD_DATA_MSB 18 -#define SI_CONFIG_BIDIR_OD_DATA_LSB 18 -#define SI_CONFIG_BIDIR_OD_DATA_MASK 'h00040000 -#define SI_CONFIG_BIDIR_OD_DATA_GET(x) (((x) & SI_CONFIG_BIDIR_OD_DATA_MASK) >> SI_CONFIG_BIDIR_OD_DATA_LSB) -#define SI_CONFIG_BIDIR_OD_DATA_SET(x) (((32'd0 | (x)) << SI_CONFIG_BIDIR_OD_DATA_LSB) & SI_CONFIG_BIDIR_OD_DATA_MASK) -#define SI_CONFIG_BIDIR_OD_DATA_RESET 1'h1 -#define SI_CONFIG_I2C_MSB 16 -#define SI_CONFIG_I2C_LSB 16 -#define SI_CONFIG_I2C_MASK 'h00010000 -#define SI_CONFIG_I2C_GET(x) (((x) & SI_CONFIG_I2C_MASK) >> SI_CONFIG_I2C_LSB) -#define SI_CONFIG_I2C_SET(x) (((32'd0 | (x)) << SI_CONFIG_I2C_LSB) & SI_CONFIG_I2C_MASK) -#define SI_CONFIG_I2C_RESET 1'h1 -#define SI_CONFIG_POS_SAMPLE_MSB 7 -#define SI_CONFIG_POS_SAMPLE_LSB 7 -#define SI_CONFIG_POS_SAMPLE_MASK 'h00000080 -#define SI_CONFIG_POS_SAMPLE_GET(x) (((x) & SI_CONFIG_POS_SAMPLE_MASK) >> SI_CONFIG_POS_SAMPLE_LSB) -#define SI_CONFIG_POS_SAMPLE_SET(x) (((32'd0 | (x)) << SI_CONFIG_POS_SAMPLE_LSB) & SI_CONFIG_POS_SAMPLE_MASK) -#define SI_CONFIG_POS_SAMPLE_RESET 1'h1 -#define SI_CONFIG_POS_DRIVE_MSB 6 -#define SI_CONFIG_POS_DRIVE_LSB 6 -#define SI_CONFIG_POS_DRIVE_MASK 'h00000040 -#define SI_CONFIG_POS_DRIVE_GET(x) (((x) & SI_CONFIG_POS_DRIVE_MASK) >> SI_CONFIG_POS_DRIVE_LSB) -#define SI_CONFIG_POS_DRIVE_SET(x) (((32'd0 | (x)) << SI_CONFIG_POS_DRIVE_LSB) & SI_CONFIG_POS_DRIVE_MASK) -#define SI_CONFIG_POS_DRIVE_RESET 1'h0 -#define SI_CONFIG_INACTIVE_DATA_MSB 5 -#define SI_CONFIG_INACTIVE_DATA_LSB 5 -#define SI_CONFIG_INACTIVE_DATA_MASK 'h00000020 -#define SI_CONFIG_INACTIVE_DATA_GET(x) (((x) & SI_CONFIG_INACTIVE_DATA_MASK) >> SI_CONFIG_INACTIVE_DATA_LSB) -#define SI_CONFIG_INACTIVE_DATA_SET(x) (((32'd0 | (x)) << SI_CONFIG_INACTIVE_DATA_LSB) & SI_CONFIG_INACTIVE_DATA_MASK) -#define SI_CONFIG_INACTIVE_DATA_RESET 1'h1 -#define SI_CONFIG_INACTIVE_CLK_MSB 4 -#define SI_CONFIG_INACTIVE_CLK_LSB 4 -#define SI_CONFIG_INACTIVE_CLK_MASK 'h00000010 -#define SI_CONFIG_INACTIVE_CLK_GET(x) (((x) & SI_CONFIG_INACTIVE_CLK_MASK) >> SI_CONFIG_INACTIVE_CLK_LSB) -#define SI_CONFIG_INACTIVE_CLK_SET(x) (((32'd0 | (x)) << SI_CONFIG_INACTIVE_CLK_LSB) & SI_CONFIG_INACTIVE_CLK_MASK) -#define SI_CONFIG_INACTIVE_CLK_RESET 1'h1 -#define SI_CONFIG_DIVIDER_MSB 3 -#define SI_CONFIG_DIVIDER_LSB 0 -#define SI_CONFIG_DIVIDER_MASK 'h0000000f -#define SI_CONFIG_DIVIDER_GET(x) (((x) & SI_CONFIG_DIVIDER_MASK) >> SI_CONFIG_DIVIDER_LSB) -#define SI_CONFIG_DIVIDER_SET(x) (((32'd0 | (x)) << SI_CONFIG_DIVIDER_LSB) & SI_CONFIG_DIVIDER_MASK) -#define SI_CONFIG_DIVIDER_RESET 4'h0 -#define SI_CONFIG_RESET (32'h0 | \ - SI_CONFIG_ERR_INT_SET(SI_CONFIG_ERR_INT_RESET) | \ - SI_CONFIG_BIDIR_OD_DATA_SET(SI_CONFIG_BIDIR_OD_DATA_RESET) | \ - SI_CONFIG_I2C_SET(SI_CONFIG_I2C_RESET) | \ - SI_CONFIG_POS_SAMPLE_SET(SI_CONFIG_POS_SAMPLE_RESET) | \ - SI_CONFIG_POS_DRIVE_SET(SI_CONFIG_POS_DRIVE_RESET) | \ - SI_CONFIG_INACTIVE_DATA_SET(SI_CONFIG_INACTIVE_DATA_RESET) | \ - SI_CONFIG_INACTIVE_CLK_SET(SI_CONFIG_INACTIVE_CLK_RESET) | \ - SI_CONFIG_DIVIDER_SET(SI_CONFIG_DIVIDER_RESET)) -#define SI_CONFIG_HW_MASK (32'h0) -#define SI_CONFIG_SW_MASK (32'h0 | \ - SI_CONFIG_ERR_INT_MASK | \ - SI_CONFIG_BIDIR_OD_DATA_MASK | \ - SI_CONFIG_I2C_MASK | \ - SI_CONFIG_POS_SAMPLE_MASK | \ - SI_CONFIG_POS_DRIVE_MASK | \ - SI_CONFIG_INACTIVE_DATA_MASK | \ - SI_CONFIG_INACTIVE_CLK_MASK | \ - SI_CONFIG_DIVIDER_MASK) - -#define SI_CS_ADDRESS 'h00000004 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_MSB 13 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_LSB 11 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_MASK 'h00003800 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_GET(x) (((x) & SI_CS_BIT_CNT_IN_LAST_BYTE_MASK) >> SI_CS_BIT_CNT_IN_LAST_BYTE_LSB) -#define SI_CS_BIT_CNT_IN_LAST_BYTE_SET(x) (((32'd0 | (x)) << SI_CS_BIT_CNT_IN_LAST_BYTE_LSB) & SI_CS_BIT_CNT_IN_LAST_BYTE_MASK) -#define SI_CS_BIT_CNT_IN_LAST_BYTE_RESET 3'h0 -#define SI_CS_DONE_ERR_MSB 10 -#define SI_CS_DONE_ERR_LSB 10 -#define SI_CS_DONE_ERR_MASK 'h00000400 -#define SI_CS_DONE_ERR_GET(x) (((x) & SI_CS_DONE_ERR_MASK) >> SI_CS_DONE_ERR_LSB) -#define SI_CS_DONE_ERR_SET(x) (((32'd0 | (x)) << SI_CS_DONE_ERR_LSB) & SI_CS_DONE_ERR_MASK) -#define SI_CS_DONE_ERR_RESET 1'h0 -#define SI_CS_DONE_INT_MSB 9 -#define SI_CS_DONE_INT_LSB 9 -#define SI_CS_DONE_INT_MASK 'h00000200 -#define SI_CS_DONE_INT_GET(x) (((x) & SI_CS_DONE_INT_MASK) >> SI_CS_DONE_INT_LSB) -#define SI_CS_DONE_INT_SET(x) (((32'd0 | (x)) << SI_CS_DONE_INT_LSB) & SI_CS_DONE_INT_MASK) -#define SI_CS_DONE_INT_RESET 1'h0 -#define SI_CS_START_MSB 8 -#define SI_CS_START_LSB 8 -#define SI_CS_START_MASK 'h00000100 -#define SI_CS_START_GET(x) (((x) & SI_CS_START_MASK) >> SI_CS_START_LSB) -#define SI_CS_START_SET(x) (((32'd0 | (x)) << SI_CS_START_LSB) & SI_CS_START_MASK) -#define SI_CS_START_RESET 1'h0 -#define SI_CS_RX_CNT_MSB 7 -#define SI_CS_RX_CNT_LSB 4 -#define SI_CS_RX_CNT_MASK 'h000000f0 -#define SI_CS_RX_CNT_GET(x) (((x) & SI_CS_RX_CNT_MASK) >> SI_CS_RX_CNT_LSB) -#define SI_CS_RX_CNT_SET(x) (((32'd0 | (x)) << SI_CS_RX_CNT_LSB) & SI_CS_RX_CNT_MASK) -#define SI_CS_RX_CNT_RESET 4'h0 -#define SI_CS_TX_CNT_MSB 3 -#define SI_CS_TX_CNT_LSB 0 -#define SI_CS_TX_CNT_MASK 'h0000000f -#define SI_CS_TX_CNT_GET(x) (((x) & SI_CS_TX_CNT_MASK) >> SI_CS_TX_CNT_LSB) -#define SI_CS_TX_CNT_SET(x) (((32'd0 | (x)) << SI_CS_TX_CNT_LSB) & SI_CS_TX_CNT_MASK) -#define SI_CS_TX_CNT_RESET 4'h0 -#define SI_CS_RESET (32'h0 | \ - SI_CS_BIT_CNT_IN_LAST_BYTE_SET(SI_CS_BIT_CNT_IN_LAST_BYTE_RESET) | \ - SI_CS_DONE_ERR_SET(SI_CS_DONE_ERR_RESET) | \ - SI_CS_DONE_INT_SET(SI_CS_DONE_INT_RESET) | \ - SI_CS_START_SET(SI_CS_START_RESET) | \ - SI_CS_RX_CNT_SET(SI_CS_RX_CNT_RESET) | \ - SI_CS_TX_CNT_SET(SI_CS_TX_CNT_RESET)) -#define SI_CS_HW_MASK (32'h0 | \ - SI_CS_DONE_ERR_MASK | \ - SI_CS_DONE_INT_MASK | \ - SI_CS_START_MASK) -#define SI_CS_SW_MASK (32'h0 | \ - SI_CS_BIT_CNT_IN_LAST_BYTE_MASK | \ - SI_CS_DONE_INT_MASK | \ - SI_CS_START_MASK | \ - SI_CS_RX_CNT_MASK | \ - SI_CS_TX_CNT_MASK) - -#define SI_TX_DATA0_ADDRESS 'h00000008 -#define SI_TX_DATA0_DATA3_MSB 31 -#define SI_TX_DATA0_DATA3_LSB 24 -#define SI_TX_DATA0_DATA3_MASK 'hff000000 -#define SI_TX_DATA0_DATA3_GET(x) (((x) & SI_TX_DATA0_DATA3_MASK) >> SI_TX_DATA0_DATA3_LSB) -#define SI_TX_DATA0_DATA3_SET(x) (((32'd0 | (x)) << SI_TX_DATA0_DATA3_LSB) & SI_TX_DATA0_DATA3_MASK) -#define SI_TX_DATA0_DATA3_RESET 8'h0 -#define SI_TX_DATA0_DATA2_MSB 23 -#define SI_TX_DATA0_DATA2_LSB 16 -#define SI_TX_DATA0_DATA2_MASK 'h00ff0000 -#define SI_TX_DATA0_DATA2_GET(x) (((x) & SI_TX_DATA0_DATA2_MASK) >> SI_TX_DATA0_DATA2_LSB) -#define SI_TX_DATA0_DATA2_SET(x) (((32'd0 | (x)) << SI_TX_DATA0_DATA2_LSB) & SI_TX_DATA0_DATA2_MASK) -#define SI_TX_DATA0_DATA2_RESET 8'h0 -#define SI_TX_DATA0_DATA1_MSB 15 -#define SI_TX_DATA0_DATA1_LSB 8 -#define SI_TX_DATA0_DATA1_MASK 'h0000ff00 -#define SI_TX_DATA0_DATA1_GET(x) (((x) & SI_TX_DATA0_DATA1_MASK) >> SI_TX_DATA0_DATA1_LSB) -#define SI_TX_DATA0_DATA1_SET(x) (((32'd0 | (x)) << SI_TX_DATA0_DATA1_LSB) & SI_TX_DATA0_DATA1_MASK) -#define SI_TX_DATA0_DATA1_RESET 8'h0 -#define SI_TX_DATA0_DATA0_MSB 7 -#define SI_TX_DATA0_DATA0_LSB 0 -#define SI_TX_DATA0_DATA0_MASK 'h000000ff -#define SI_TX_DATA0_DATA0_GET(x) (((x) & SI_TX_DATA0_DATA0_MASK) >> SI_TX_DATA0_DATA0_LSB) -#define SI_TX_DATA0_DATA0_SET(x) (((32'd0 | (x)) << SI_TX_DATA0_DATA0_LSB) & SI_TX_DATA0_DATA0_MASK) -#define SI_TX_DATA0_DATA0_RESET 8'h0 -#define SI_TX_DATA0_RESET (32'h0 | \ - SI_TX_DATA0_DATA3_SET(SI_TX_DATA0_DATA3_RESET) | \ - SI_TX_DATA0_DATA2_SET(SI_TX_DATA0_DATA2_RESET) | \ - SI_TX_DATA0_DATA1_SET(SI_TX_DATA0_DATA1_RESET) | \ - SI_TX_DATA0_DATA0_SET(SI_TX_DATA0_DATA0_RESET)) -#define SI_TX_DATA0_HW_MASK (32'h0) -#define SI_TX_DATA0_SW_MASK (32'h0 | \ - SI_TX_DATA0_DATA3_MASK | \ - SI_TX_DATA0_DATA2_MASK | \ - SI_TX_DATA0_DATA1_MASK | \ - SI_TX_DATA0_DATA0_MASK) - -#define SI_TX_DATA1_ADDRESS 'h0000000c -#define SI_TX_DATA1_DATA7_MSB 31 -#define SI_TX_DATA1_DATA7_LSB 24 -#define SI_TX_DATA1_DATA7_MASK 'hff000000 -#define SI_TX_DATA1_DATA7_GET(x) (((x) & SI_TX_DATA1_DATA7_MASK) >> SI_TX_DATA1_DATA7_LSB) -#define SI_TX_DATA1_DATA7_SET(x) (((32'd0 | (x)) << SI_TX_DATA1_DATA7_LSB) & SI_TX_DATA1_DATA7_MASK) -#define SI_TX_DATA1_DATA7_RESET 8'h0 -#define SI_TX_DATA1_DATA6_MSB 23 -#define SI_TX_DATA1_DATA6_LSB 16 -#define SI_TX_DATA1_DATA6_MASK 'h00ff0000 -#define SI_TX_DATA1_DATA6_GET(x) (((x) & SI_TX_DATA1_DATA6_MASK) >> SI_TX_DATA1_DATA6_LSB) -#define SI_TX_DATA1_DATA6_SET(x) (((32'd0 | (x)) << SI_TX_DATA1_DATA6_LSB) & SI_TX_DATA1_DATA6_MASK) -#define SI_TX_DATA1_DATA6_RESET 8'h0 -#define SI_TX_DATA1_DATA5_MSB 15 -#define SI_TX_DATA1_DATA5_LSB 8 -#define SI_TX_DATA1_DATA5_MASK 'h0000ff00 -#define SI_TX_DATA1_DATA5_GET(x) (((x) & SI_TX_DATA1_DATA5_MASK) >> SI_TX_DATA1_DATA5_LSB) -#define SI_TX_DATA1_DATA5_SET(x) (((32'd0 | (x)) << SI_TX_DATA1_DATA5_LSB) & SI_TX_DATA1_DATA5_MASK) -#define SI_TX_DATA1_DATA5_RESET 8'h0 -#define SI_TX_DATA1_DATA4_MSB 7 -#define SI_TX_DATA1_DATA4_LSB 0 -#define SI_TX_DATA1_DATA4_MASK 'h000000ff -#define SI_TX_DATA1_DATA4_GET(x) (((x) & SI_TX_DATA1_DATA4_MASK) >> SI_TX_DATA1_DATA4_LSB) -#define SI_TX_DATA1_DATA4_SET(x) (((32'd0 | (x)) << SI_TX_DATA1_DATA4_LSB) & SI_TX_DATA1_DATA4_MASK) -#define SI_TX_DATA1_DATA4_RESET 8'h0 -#define SI_TX_DATA1_RESET (32'h0 | \ - SI_TX_DATA1_DATA7_SET(SI_TX_DATA1_DATA7_RESET) | \ - SI_TX_DATA1_DATA6_SET(SI_TX_DATA1_DATA6_RESET) | \ - SI_TX_DATA1_DATA5_SET(SI_TX_DATA1_DATA5_RESET) | \ - SI_TX_DATA1_DATA4_SET(SI_TX_DATA1_DATA4_RESET)) -#define SI_TX_DATA1_HW_MASK (32'h0) -#define SI_TX_DATA1_SW_MASK (32'h0 | \ - SI_TX_DATA1_DATA7_MASK | \ - SI_TX_DATA1_DATA6_MASK | \ - SI_TX_DATA1_DATA5_MASK | \ - SI_TX_DATA1_DATA4_MASK) - -#define SI_RX_DATA0_ADDRESS 'h00000010 -#define SI_RX_DATA0_DATA3_MSB 31 -#define SI_RX_DATA0_DATA3_LSB 24 -#define SI_RX_DATA0_DATA3_MASK 'hff000000 -#define SI_RX_DATA0_DATA3_GET(x) (((x) & SI_RX_DATA0_DATA3_MASK) >> SI_RX_DATA0_DATA3_LSB) -#define SI_RX_DATA0_DATA3_SET(x) (((32'd0 | (x)) << SI_RX_DATA0_DATA3_LSB) & SI_RX_DATA0_DATA3_MASK) -#define SI_RX_DATA0_DATA3_RESET 8'h0 -#define SI_RX_DATA0_DATA2_MSB 23 -#define SI_RX_DATA0_DATA2_LSB 16 -#define SI_RX_DATA0_DATA2_MASK 'h00ff0000 -#define SI_RX_DATA0_DATA2_GET(x) (((x) & SI_RX_DATA0_DATA2_MASK) >> SI_RX_DATA0_DATA2_LSB) -#define SI_RX_DATA0_DATA2_SET(x) (((32'd0 | (x)) << SI_RX_DATA0_DATA2_LSB) & SI_RX_DATA0_DATA2_MASK) -#define SI_RX_DATA0_DATA2_RESET 8'h0 -#define SI_RX_DATA0_DATA1_MSB 15 -#define SI_RX_DATA0_DATA1_LSB 8 -#define SI_RX_DATA0_DATA1_MASK 'h0000ff00 -#define SI_RX_DATA0_DATA1_GET(x) (((x) & SI_RX_DATA0_DATA1_MASK) >> SI_RX_DATA0_DATA1_LSB) -#define SI_RX_DATA0_DATA1_SET(x) (((32'd0 | (x)) << SI_RX_DATA0_DATA1_LSB) & SI_RX_DATA0_DATA1_MASK) -#define SI_RX_DATA0_DATA1_RESET 8'h0 -#define SI_RX_DATA0_DATA0_MSB 7 -#define SI_RX_DATA0_DATA0_LSB 0 -#define SI_RX_DATA0_DATA0_MASK 'h000000ff -#define SI_RX_DATA0_DATA0_GET(x) (((x) & SI_RX_DATA0_DATA0_MASK) >> SI_RX_DATA0_DATA0_LSB) -#define SI_RX_DATA0_DATA0_SET(x) (((32'd0 | (x)) << SI_RX_DATA0_DATA0_LSB) & SI_RX_DATA0_DATA0_MASK) -#define SI_RX_DATA0_DATA0_RESET 8'h0 -#define SI_RX_DATA0_RESET (32'h0 | \ - SI_RX_DATA0_DATA3_SET(SI_RX_DATA0_DATA3_RESET) | \ - SI_RX_DATA0_DATA2_SET(SI_RX_DATA0_DATA2_RESET) | \ - SI_RX_DATA0_DATA1_SET(SI_RX_DATA0_DATA1_RESET) | \ - SI_RX_DATA0_DATA0_SET(SI_RX_DATA0_DATA0_RESET)) -#define SI_RX_DATA0_HW_MASK (32'h0 | \ - SI_RX_DATA0_DATA3_MASK | \ - SI_RX_DATA0_DATA2_MASK | \ - SI_RX_DATA0_DATA1_MASK | \ - SI_RX_DATA0_DATA0_MASK) -#define SI_RX_DATA0_SW_MASK (32'h0) - -#define SI_RX_DATA1_ADDRESS 'h00000014 -#define SI_RX_DATA1_DATA7_MSB 31 -#define SI_RX_DATA1_DATA7_LSB 24 -#define SI_RX_DATA1_DATA7_MASK 'hff000000 -#define SI_RX_DATA1_DATA7_GET(x) (((x) & SI_RX_DATA1_DATA7_MASK) >> SI_RX_DATA1_DATA7_LSB) -#define SI_RX_DATA1_DATA7_SET(x) (((32'd0 | (x)) << SI_RX_DATA1_DATA7_LSB) & SI_RX_DATA1_DATA7_MASK) -#define SI_RX_DATA1_DATA7_RESET 8'h0 -#define SI_RX_DATA1_DATA6_MSB 23 -#define SI_RX_DATA1_DATA6_LSB 16 -#define SI_RX_DATA1_DATA6_MASK 'h00ff0000 -#define SI_RX_DATA1_DATA6_GET(x) (((x) & SI_RX_DATA1_DATA6_MASK) >> SI_RX_DATA1_DATA6_LSB) -#define SI_RX_DATA1_DATA6_SET(x) (((32'd0 | (x)) << SI_RX_DATA1_DATA6_LSB) & SI_RX_DATA1_DATA6_MASK) -#define SI_RX_DATA1_DATA6_RESET 8'h0 -#define SI_RX_DATA1_DATA5_MSB 15 -#define SI_RX_DATA1_DATA5_LSB 8 -#define SI_RX_DATA1_DATA5_MASK 'h0000ff00 -#define SI_RX_DATA1_DATA5_GET(x) (((x) & SI_RX_DATA1_DATA5_MASK) >> SI_RX_DATA1_DATA5_LSB) -#define SI_RX_DATA1_DATA5_SET(x) (((32'd0 | (x)) << SI_RX_DATA1_DATA5_LSB) & SI_RX_DATA1_DATA5_MASK) -#define SI_RX_DATA1_DATA5_RESET 8'h0 -#define SI_RX_DATA1_DATA4_MSB 7 -#define SI_RX_DATA1_DATA4_LSB 0 -#define SI_RX_DATA1_DATA4_MASK 'h000000ff -#define SI_RX_DATA1_DATA4_GET(x) (((x) & SI_RX_DATA1_DATA4_MASK) >> SI_RX_DATA1_DATA4_LSB) -#define SI_RX_DATA1_DATA4_SET(x) (((32'd0 | (x)) << SI_RX_DATA1_DATA4_LSB) & SI_RX_DATA1_DATA4_MASK) -#define SI_RX_DATA1_DATA4_RESET 8'h0 -#define SI_RX_DATA1_RESET (32'h0 | \ - SI_RX_DATA1_DATA7_SET(SI_RX_DATA1_DATA7_RESET) | \ - SI_RX_DATA1_DATA6_SET(SI_RX_DATA1_DATA6_RESET) | \ - SI_RX_DATA1_DATA5_SET(SI_RX_DATA1_DATA5_RESET) | \ - SI_RX_DATA1_DATA4_SET(SI_RX_DATA1_DATA4_RESET)) -#define SI_RX_DATA1_HW_MASK (32'h0 | \ - SI_RX_DATA1_DATA7_MASK | \ - SI_RX_DATA1_DATA6_MASK | \ - SI_RX_DATA1_DATA5_MASK | \ - SI_RX_DATA1_DATA4_MASK) -#define SI_RX_DATA1_SW_MASK (32'h0) - -#define SI_REG_ADDRESS_MSB 4 - -#endif /* _SI_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/synth_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/synth_reg.h deleted file mode 100644 index 2cdbc0d86b82..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/synth_reg.h +++ /dev/null @@ -1,599 +0,0 @@ -#ifndef _SYNTH_REG_REG_H_ -#define _SYNTH_REG_REG_H_ - -#define SYNTH_SYNTH1_ADDRESS 0x00000000 -#define SYNTH_SYNTH1_OFFSET 0x00000000 -#define SYNTH_SYNTH1_PWD_BIAS_MSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_LSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_MASK 0x80000000 -#define SYNTH_SYNTH1_PWD_BIAS_GET(x) (((x) & SYNTH_SYNTH1_PWD_BIAS_MASK) >> SYNTH_SYNTH1_PWD_BIAS_LSB) -#define SYNTH_SYNTH1_PWD_BIAS_SET(x) (((x) << SYNTH_SYNTH1_PWD_BIAS_LSB) & SYNTH_SYNTH1_PWD_BIAS_MASK) -#define SYNTH_SYNTH1_PWD_CP_MSB 30 -#define SYNTH_SYNTH1_PWD_CP_LSB 30 -#define SYNTH_SYNTH1_PWD_CP_MASK 0x40000000 -#define SYNTH_SYNTH1_PWD_CP_GET(x) (((x) & SYNTH_SYNTH1_PWD_CP_MASK) >> SYNTH_SYNTH1_PWD_CP_LSB) -#define SYNTH_SYNTH1_PWD_CP_SET(x) (((x) << SYNTH_SYNTH1_PWD_CP_LSB) & SYNTH_SYNTH1_PWD_CP_MASK) -#define SYNTH_SYNTH1_PWD_VCMON_MSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_LSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_MASK 0x20000000 -#define SYNTH_SYNTH1_PWD_VCMON_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCMON_MASK) >> SYNTH_SYNTH1_PWD_VCMON_LSB) -#define SYNTH_SYNTH1_PWD_VCMON_SET(x) (((x) << SYNTH_SYNTH1_PWD_VCMON_LSB) & SYNTH_SYNTH1_PWD_VCMON_MASK) -#define SYNTH_SYNTH1_PWD_VCO_MSB 28 -#define SYNTH_SYNTH1_PWD_VCO_LSB 28 -#define SYNTH_SYNTH1_PWD_VCO_MASK 0x10000000 -#define SYNTH_SYNTH1_PWD_VCO_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCO_MASK) >> SYNTH_SYNTH1_PWD_VCO_LSB) -#define SYNTH_SYNTH1_PWD_VCO_SET(x) (((x) << SYNTH_SYNTH1_PWD_VCO_LSB) & SYNTH_SYNTH1_PWD_VCO_MASK) -#define SYNTH_SYNTH1_PWD_PRESC_MSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_LSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_MASK 0x08000000 -#define SYNTH_SYNTH1_PWD_PRESC_GET(x) (((x) & SYNTH_SYNTH1_PWD_PRESC_MASK) >> SYNTH_SYNTH1_PWD_PRESC_LSB) -#define SYNTH_SYNTH1_PWD_PRESC_SET(x) (((x) << SYNTH_SYNTH1_PWD_PRESC_LSB) & SYNTH_SYNTH1_PWD_PRESC_MASK) -#define SYNTH_SYNTH1_PWD_LODIV_MSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_LSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_MASK 0x04000000 -#define SYNTH_SYNTH1_PWD_LODIV_GET(x) (((x) & SYNTH_SYNTH1_PWD_LODIV_MASK) >> SYNTH_SYNTH1_PWD_LODIV_LSB) -#define SYNTH_SYNTH1_PWD_LODIV_SET(x) (((x) << SYNTH_SYNTH1_PWD_LODIV_LSB) & SYNTH_SYNTH1_PWD_LODIV_MASK) -#define SYNTH_SYNTH1_PWD_LOMIX_MSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_LSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_MASK 0x02000000 -#define SYNTH_SYNTH1_PWD_LOMIX_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOMIX_MASK) >> SYNTH_SYNTH1_PWD_LOMIX_LSB) -#define SYNTH_SYNTH1_PWD_LOMIX_SET(x) (((x) << SYNTH_SYNTH1_PWD_LOMIX_LSB) & SYNTH_SYNTH1_PWD_LOMIX_MASK) -#define SYNTH_SYNTH1_FORCE_LO_ON_MSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_LSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_MASK 0x01000000 -#define SYNTH_SYNTH1_FORCE_LO_ON_GET(x) (((x) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) >> SYNTH_SYNTH1_FORCE_LO_ON_LSB) -#define SYNTH_SYNTH1_FORCE_LO_ON_SET(x) (((x) << SYNTH_SYNTH1_FORCE_LO_ON_LSB) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) -#define SYNTH_SYNTH1_PWD_LOBUF5G_MSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_LSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_MASK 0x00800000 -#define SYNTH_SYNTH1_PWD_LOBUF5G_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) >> SYNTH_SYNTH1_PWD_LOBUF5G_LSB) -#define SYNTH_SYNTH1_PWD_LOBUF5G_SET(x) (((x) << SYNTH_SYNTH1_PWD_LOBUF5G_LSB) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) -#define SYNTH_SYNTH1_VCOREGBYPASS_MSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_LSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_MASK 0x00400000 -#define SYNTH_SYNTH1_VCOREGBYPASS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) >> SYNTH_SYNTH1_VCOREGBYPASS_LSB) -#define SYNTH_SYNTH1_VCOREGBYPASS_SET(x) (((x) << SYNTH_SYNTH1_VCOREGBYPASS_LSB) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) -#define SYNTH_SYNTH1_VCOREGLEVEL_MSB 21 -#define SYNTH_SYNTH1_VCOREGLEVEL_LSB 20 -#define SYNTH_SYNTH1_VCOREGLEVEL_MASK 0x00300000 -#define SYNTH_SYNTH1_VCOREGLEVEL_GET(x) (((x) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) >> SYNTH_SYNTH1_VCOREGLEVEL_LSB) -#define SYNTH_SYNTH1_VCOREGLEVEL_SET(x) (((x) << SYNTH_SYNTH1_VCOREGLEVEL_LSB) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) -#define SYNTH_SYNTH1_VCOREGBIAS_MSB 19 -#define SYNTH_SYNTH1_VCOREGBIAS_LSB 18 -#define SYNTH_SYNTH1_VCOREGBIAS_MASK 0x000c0000 -#define SYNTH_SYNTH1_VCOREGBIAS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBIAS_MASK) >> SYNTH_SYNTH1_VCOREGBIAS_LSB) -#define SYNTH_SYNTH1_VCOREGBIAS_SET(x) (((x) << SYNTH_SYNTH1_VCOREGBIAS_LSB) & SYNTH_SYNTH1_VCOREGBIAS_MASK) -#define SYNTH_SYNTH1_SLIDINGIF_MSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_LSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_MASK 0x00020000 -#define SYNTH_SYNTH1_SLIDINGIF_GET(x) (((x) & SYNTH_SYNTH1_SLIDINGIF_MASK) >> SYNTH_SYNTH1_SLIDINGIF_LSB) -#define SYNTH_SYNTH1_SLIDINGIF_SET(x) (((x) << SYNTH_SYNTH1_SLIDINGIF_LSB) & SYNTH_SYNTH1_SLIDINGIF_MASK) -#define SYNTH_SYNTH1_SPARE_PWD_MSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_LSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_MASK 0x00010000 -#define SYNTH_SYNTH1_SPARE_PWD_GET(x) (((x) & SYNTH_SYNTH1_SPARE_PWD_MASK) >> SYNTH_SYNTH1_SPARE_PWD_LSB) -#define SYNTH_SYNTH1_SPARE_PWD_SET(x) (((x) << SYNTH_SYNTH1_SPARE_PWD_LSB) & SYNTH_SYNTH1_SPARE_PWD_MASK) -#define SYNTH_SYNTH1_CON_VDDVCOREG_MSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_LSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_MASK 0x00008000 -#define SYNTH_SYNTH1_CON_VDDVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) >> SYNTH_SYNTH1_CON_VDDVCOREG_LSB) -#define SYNTH_SYNTH1_CON_VDDVCOREG_SET(x) (((x) << SYNTH_SYNTH1_CON_VDDVCOREG_LSB) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) -#define SYNTH_SYNTH1_CON_IVCOREG_MSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_LSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_MASK 0x00004000 -#define SYNTH_SYNTH1_CON_IVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOREG_MASK) >> SYNTH_SYNTH1_CON_IVCOREG_LSB) -#define SYNTH_SYNTH1_CON_IVCOREG_SET(x) (((x) << SYNTH_SYNTH1_CON_IVCOREG_LSB) & SYNTH_SYNTH1_CON_IVCOREG_MASK) -#define SYNTH_SYNTH1_CON_IVCOBUF_MSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_LSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_MASK 0x00002000 -#define SYNTH_SYNTH1_CON_IVCOBUF_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) >> SYNTH_SYNTH1_CON_IVCOBUF_LSB) -#define SYNTH_SYNTH1_CON_IVCOBUF_SET(x) (((x) << SYNTH_SYNTH1_CON_IVCOBUF_LSB) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) -#define SYNTH_SYNTH1_SEL_VCMONABUS_MSB 12 -#define SYNTH_SYNTH1_SEL_VCMONABUS_LSB 10 -#define SYNTH_SYNTH1_SEL_VCMONABUS_MASK 0x00001c00 -#define SYNTH_SYNTH1_SEL_VCMONABUS_GET(x) (((x) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) >> SYNTH_SYNTH1_SEL_VCMONABUS_LSB) -#define SYNTH_SYNTH1_SEL_VCMONABUS_SET(x) (((x) << SYNTH_SYNTH1_SEL_VCMONABUS_LSB) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK 0x00000200 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) >> SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_LSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MASK 0x00000100 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) >> SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK 0x00000080 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK 0x00000040 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_SET(x) (((x) << SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_MSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_LSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_MASK 0x00000020 -#define SYNTH_SYNTH1_MONITOR_FB_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_MASK) >> SYNTH_SYNTH1_MONITOR_FB_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_FB_LSB) & SYNTH_SYNTH1_MONITOR_FB_MASK) -#define SYNTH_SYNTH1_MONITOR_REF_MSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_LSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_MASK 0x00000010 -#define SYNTH_SYNTH1_MONITOR_REF_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_REF_MASK) >> SYNTH_SYNTH1_MONITOR_REF_LSB) -#define SYNTH_SYNTH1_MONITOR_REF_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_REF_LSB) & SYNTH_SYNTH1_MONITOR_REF_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK 0x00000008 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) >> SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK 0x00000004 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) >> SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_LSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MASK 0x00000002 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) >> SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK 0x00000001 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) >> SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(x) (((x) << SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) - -#define SYNTH_SYNTH2_ADDRESS 0x00000004 -#define SYNTH_SYNTH2_OFFSET 0x00000004 -#define SYNTH_SYNTH2_VC_CAL_REF_MSB 31 -#define SYNTH_SYNTH2_VC_CAL_REF_LSB 29 -#define SYNTH_SYNTH2_VC_CAL_REF_MASK 0xe0000000 -#define SYNTH_SYNTH2_VC_CAL_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_CAL_REF_MASK) >> SYNTH_SYNTH2_VC_CAL_REF_LSB) -#define SYNTH_SYNTH2_VC_CAL_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_CAL_REF_LSB) & SYNTH_SYNTH2_VC_CAL_REF_MASK) -#define SYNTH_SYNTH2_VC_HI_REF_MSB 28 -#define SYNTH_SYNTH2_VC_HI_REF_LSB 26 -#define SYNTH_SYNTH2_VC_HI_REF_MASK 0x1c000000 -#define SYNTH_SYNTH2_VC_HI_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_HI_REF_MASK) >> SYNTH_SYNTH2_VC_HI_REF_LSB) -#define SYNTH_SYNTH2_VC_HI_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_HI_REF_LSB) & SYNTH_SYNTH2_VC_HI_REF_MASK) -#define SYNTH_SYNTH2_VC_MID_REF_MSB 25 -#define SYNTH_SYNTH2_VC_MID_REF_LSB 23 -#define SYNTH_SYNTH2_VC_MID_REF_MASK 0x03800000 -#define SYNTH_SYNTH2_VC_MID_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_MID_REF_MASK) >> SYNTH_SYNTH2_VC_MID_REF_LSB) -#define SYNTH_SYNTH2_VC_MID_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_MID_REF_LSB) & SYNTH_SYNTH2_VC_MID_REF_MASK) -#define SYNTH_SYNTH2_VC_LOW_REF_MSB 22 -#define SYNTH_SYNTH2_VC_LOW_REF_LSB 20 -#define SYNTH_SYNTH2_VC_LOW_REF_MASK 0x00700000 -#define SYNTH_SYNTH2_VC_LOW_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_LOW_REF_MASK) >> SYNTH_SYNTH2_VC_LOW_REF_LSB) -#define SYNTH_SYNTH2_VC_LOW_REF_SET(x) (((x) << SYNTH_SYNTH2_VC_LOW_REF_LSB) & SYNTH_SYNTH2_VC_LOW_REF_MASK) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MSB 19 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB 15 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK 0x000f8000 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_GET(x) (((x) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) >> SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_SET(x) (((x) << SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) -#define SYNTH_SYNTH2_LOOP_CP_MSB 14 -#define SYNTH_SYNTH2_LOOP_CP_LSB 10 -#define SYNTH_SYNTH2_LOOP_CP_MASK 0x00007c00 -#define SYNTH_SYNTH2_LOOP_CP_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CP_MASK) >> SYNTH_SYNTH2_LOOP_CP_LSB) -#define SYNTH_SYNTH2_LOOP_CP_SET(x) (((x) << SYNTH_SYNTH2_LOOP_CP_LSB) & SYNTH_SYNTH2_LOOP_CP_MASK) -#define SYNTH_SYNTH2_LOOP_RS_MSB 9 -#define SYNTH_SYNTH2_LOOP_RS_LSB 5 -#define SYNTH_SYNTH2_LOOP_RS_MASK 0x000003e0 -#define SYNTH_SYNTH2_LOOP_RS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_RS_MASK) >> SYNTH_SYNTH2_LOOP_RS_LSB) -#define SYNTH_SYNTH2_LOOP_RS_SET(x) (((x) << SYNTH_SYNTH2_LOOP_RS_LSB) & SYNTH_SYNTH2_LOOP_RS_MASK) -#define SYNTH_SYNTH2_LOOP_CS_MSB 4 -#define SYNTH_SYNTH2_LOOP_CS_LSB 3 -#define SYNTH_SYNTH2_LOOP_CS_MASK 0x00000018 -#define SYNTH_SYNTH2_LOOP_CS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CS_MASK) >> SYNTH_SYNTH2_LOOP_CS_LSB) -#define SYNTH_SYNTH2_LOOP_CS_SET(x) (((x) << SYNTH_SYNTH2_LOOP_CS_LSB) & SYNTH_SYNTH2_LOOP_CS_MASK) -#define SYNTH_SYNTH2_SPARE_BITS_MSB 2 -#define SYNTH_SYNTH2_SPARE_BITS_LSB 0 -#define SYNTH_SYNTH2_SPARE_BITS_MASK 0x00000007 -#define SYNTH_SYNTH2_SPARE_BITS_GET(x) (((x) & SYNTH_SYNTH2_SPARE_BITS_MASK) >> SYNTH_SYNTH2_SPARE_BITS_LSB) -#define SYNTH_SYNTH2_SPARE_BITS_SET(x) (((x) << SYNTH_SYNTH2_SPARE_BITS_LSB) & SYNTH_SYNTH2_SPARE_BITS_MASK) - -#define SYNTH_SYNTH3_ADDRESS 0x00000008 -#define SYNTH_SYNTH3_OFFSET 0x00000008 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_LSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MASK 0x80000000 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_GET(x) (((x) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) >> SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) -#define SYNTH_SYNTH3_DIS_CLK_XTAL_SET(x) (((x) << SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_LSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MASK 0x40000000 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_GET(x) (((x) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) >> SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_SET(x) (((x) << SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MSB 29 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB 24 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK 0x3f000000 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_SET(x) (((x) << SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_PWRUP_MSB 23 -#define SYNTH_SYNTH3_WAIT_PWRUP_LSB 18 -#define SYNTH_SYNTH3_WAIT_PWRUP_MASK 0x00fc0000 -#define SYNTH_SYNTH3_WAIT_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_PWRUP_SET(x) (((x) << SYNTH_SYNTH3_WAIT_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MSB 17 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_LSB 12 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MASK 0x0003f000 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_SET(x) (((x) << SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MSB 11 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_LSB 6 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MASK 0x00000fc0 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_SET(x) (((x) << SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MSB 5 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_LSB 0 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MASK 0x0000003f -#define SYNTH_SYNTH3_WAIT_VC_CHECK_GET(x) (((x) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) >> SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_SET(x) (((x) << SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) - -#define SYNTH_SYNTH4_ADDRESS 0x0000000c -#define SYNTH_SYNTH4_OFFSET 0x0000000c -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK 0x80000000 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_GET(x) (((x) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) >> SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_SET(x) (((x) << SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) -#define SYNTH_SYNTH4_DIS_LOSTVC_MSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_LSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_MASK 0x40000000 -#define SYNTH_SYNTH4_DIS_LOSTVC_GET(x) (((x) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) >> SYNTH_SYNTH4_DIS_LOSTVC_LSB) -#define SYNTH_SYNTH4_DIS_LOSTVC_SET(x) (((x) << SYNTH_SYNTH4_DIS_LOSTVC_LSB) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_LSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MASK 0x20000000 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_GET(x) (((x) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) >> SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_SET(x) (((x) << SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK 0x10000000 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_GET(x) (((x) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) >> SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_SET(x) (((x) << SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) -#define SYNTH_SYNTH4_FORCE_PINVC_MSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_LSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_MASK 0x08000000 -#define SYNTH_SYNTH4_FORCE_PINVC_GET(x) (((x) & SYNTH_SYNTH4_FORCE_PINVC_MASK) >> SYNTH_SYNTH4_FORCE_PINVC_LSB) -#define SYNTH_SYNTH4_FORCE_PINVC_SET(x) (((x) << SYNTH_SYNTH4_FORCE_PINVC_LSB) & SYNTH_SYNTH4_FORCE_PINVC_MASK) -#define SYNTH_SYNTH4_FORCE_VCOCAP_MSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_LSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_MASK 0x04000000 -#define SYNTH_SYNTH4_FORCE_VCOCAP_GET(x) (((x) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) >> SYNTH_SYNTH4_FORCE_VCOCAP_LSB) -#define SYNTH_SYNTH4_FORCE_VCOCAP_SET(x) (((x) << SYNTH_SYNTH4_FORCE_VCOCAP_LSB) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) -#define SYNTH_SYNTH4_VCOCAP_OVR_MSB 25 -#define SYNTH_SYNTH4_VCOCAP_OVR_LSB 18 -#define SYNTH_SYNTH4_VCOCAP_OVR_MASK 0x03fc0000 -#define SYNTH_SYNTH4_VCOCAP_OVR_GET(x) (((x) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) >> SYNTH_SYNTH4_VCOCAP_OVR_LSB) -#define SYNTH_SYNTH4_VCOCAP_OVR_SET(x) (((x) << SYNTH_SYNTH4_VCOCAP_OVR_LSB) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) -#define SYNTH_SYNTH4_VCOCAPPULLUP_MSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_LSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_MASK 0x00020000 -#define SYNTH_SYNTH4_VCOCAPPULLUP_GET(x) (((x) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) >> SYNTH_SYNTH4_VCOCAPPULLUP_LSB) -#define SYNTH_SYNTH4_VCOCAPPULLUP_SET(x) (((x) << SYNTH_SYNTH4_VCOCAPPULLUP_LSB) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) -#define SYNTH_SYNTH4_REFDIVSEL_MSB 16 -#define SYNTH_SYNTH4_REFDIVSEL_LSB 15 -#define SYNTH_SYNTH4_REFDIVSEL_MASK 0x00018000 -#define SYNTH_SYNTH4_REFDIVSEL_GET(x) (((x) & SYNTH_SYNTH4_REFDIVSEL_MASK) >> SYNTH_SYNTH4_REFDIVSEL_LSB) -#define SYNTH_SYNTH4_REFDIVSEL_SET(x) (((x) << SYNTH_SYNTH4_REFDIVSEL_LSB) & SYNTH_SYNTH4_REFDIVSEL_MASK) -#define SYNTH_SYNTH4_PFDDELAY_MSB 14 -#define SYNTH_SYNTH4_PFDDELAY_LSB 14 -#define SYNTH_SYNTH4_PFDDELAY_MASK 0x00004000 -#define SYNTH_SYNTH4_PFDDELAY_GET(x) (((x) & SYNTH_SYNTH4_PFDDELAY_MASK) >> SYNTH_SYNTH4_PFDDELAY_LSB) -#define SYNTH_SYNTH4_PFDDELAY_SET(x) (((x) << SYNTH_SYNTH4_PFDDELAY_LSB) & SYNTH_SYNTH4_PFDDELAY_MASK) -#define SYNTH_SYNTH4_PFD_DISABLE_MSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_LSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_MASK 0x00002000 -#define SYNTH_SYNTH4_PFD_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_PFD_DISABLE_MASK) >> SYNTH_SYNTH4_PFD_DISABLE_LSB) -#define SYNTH_SYNTH4_PFD_DISABLE_SET(x) (((x) << SYNTH_SYNTH4_PFD_DISABLE_LSB) & SYNTH_SYNTH4_PFD_DISABLE_MASK) -#define SYNTH_SYNTH4_PRESCSEL_MSB 12 -#define SYNTH_SYNTH4_PRESCSEL_LSB 11 -#define SYNTH_SYNTH4_PRESCSEL_MASK 0x00001800 -#define SYNTH_SYNTH4_PRESCSEL_GET(x) (((x) & SYNTH_SYNTH4_PRESCSEL_MASK) >> SYNTH_SYNTH4_PRESCSEL_LSB) -#define SYNTH_SYNTH4_PRESCSEL_SET(x) (((x) << SYNTH_SYNTH4_PRESCSEL_LSB) & SYNTH_SYNTH4_PRESCSEL_MASK) -#define SYNTH_SYNTH4_RESET_PRESC_MSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_LSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_MASK 0x00000400 -#define SYNTH_SYNTH4_RESET_PRESC_GET(x) (((x) & SYNTH_SYNTH4_RESET_PRESC_MASK) >> SYNTH_SYNTH4_RESET_PRESC_LSB) -#define SYNTH_SYNTH4_RESET_PRESC_SET(x) (((x) << SYNTH_SYNTH4_RESET_PRESC_LSB) & SYNTH_SYNTH4_RESET_PRESC_MASK) -#define SYNTH_SYNTH4_SDM_DISABLE_MSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_LSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_MASK 0x00000200 -#define SYNTH_SYNTH4_SDM_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_SDM_DISABLE_MASK) >> SYNTH_SYNTH4_SDM_DISABLE_LSB) -#define SYNTH_SYNTH4_SDM_DISABLE_SET(x) (((x) << SYNTH_SYNTH4_SDM_DISABLE_LSB) & SYNTH_SYNTH4_SDM_DISABLE_MASK) -#define SYNTH_SYNTH4_SDM_MODE_MSB 8 -#define SYNTH_SYNTH4_SDM_MODE_LSB 8 -#define SYNTH_SYNTH4_SDM_MODE_MASK 0x00000100 -#define SYNTH_SYNTH4_SDM_MODE_GET(x) (((x) & SYNTH_SYNTH4_SDM_MODE_MASK) >> SYNTH_SYNTH4_SDM_MODE_LSB) -#define SYNTH_SYNTH4_SDM_MODE_SET(x) (((x) << SYNTH_SYNTH4_SDM_MODE_LSB) & SYNTH_SYNTH4_SDM_MODE_MASK) -#define SYNTH_SYNTH4_SDM_DITHER_MSB 7 -#define SYNTH_SYNTH4_SDM_DITHER_LSB 6 -#define SYNTH_SYNTH4_SDM_DITHER_MASK 0x000000c0 -#define SYNTH_SYNTH4_SDM_DITHER_GET(x) (((x) & SYNTH_SYNTH4_SDM_DITHER_MASK) >> SYNTH_SYNTH4_SDM_DITHER_LSB) -#define SYNTH_SYNTH4_SDM_DITHER_SET(x) (((x) << SYNTH_SYNTH4_SDM_DITHER_LSB) & SYNTH_SYNTH4_SDM_DITHER_MASK) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK 0x00000020 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_GET(x) (((x) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) >> SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_SET(x) (((x) << SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK 0x00000010 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_GET(x) (((x) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) >> SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_SET(x) (((x) << SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) -#define SYNTH_SYNTH4_SPARE_MISC_MSB 3 -#define SYNTH_SYNTH4_SPARE_MISC_LSB 2 -#define SYNTH_SYNTH4_SPARE_MISC_MASK 0x0000000c -#define SYNTH_SYNTH4_SPARE_MISC_GET(x) (((x) & SYNTH_SYNTH4_SPARE_MISC_MASK) >> SYNTH_SYNTH4_SPARE_MISC_LSB) -#define SYNTH_SYNTH4_SPARE_MISC_SET(x) (((x) << SYNTH_SYNTH4_SPARE_MISC_LSB) & SYNTH_SYNTH4_SPARE_MISC_MASK) -#define SYNTH_SYNTH4_LONGSHIFTSEL_MSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_LSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_MASK 0x00000002 -#define SYNTH_SYNTH4_LONGSHIFTSEL_GET(x) (((x) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) >> SYNTH_SYNTH4_LONGSHIFTSEL_LSB) -#define SYNTH_SYNTH4_LONGSHIFTSEL_SET(x) (((x) << SYNTH_SYNTH4_LONGSHIFTSEL_LSB) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_LSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MASK 0x00000001 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_GET(x) (((x) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) >> SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_SET(x) (((x) << SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) - -#define SYNTH_SYNTH5_ADDRESS 0x00000010 -#define SYNTH_SYNTH5_OFFSET 0x00000010 -#define SYNTH_SYNTH5_LOOP_IP0_MSB 31 -#define SYNTH_SYNTH5_LOOP_IP0_LSB 28 -#define SYNTH_SYNTH5_LOOP_IP0_MASK 0xf0000000 -#define SYNTH_SYNTH5_LOOP_IP0_GET(x) (((x) & SYNTH_SYNTH5_LOOP_IP0_MASK) >> SYNTH_SYNTH5_LOOP_IP0_LSB) -#define SYNTH_SYNTH5_LOOP_IP0_SET(x) (((x) << SYNTH_SYNTH5_LOOP_IP0_LSB) & SYNTH_SYNTH5_LOOP_IP0_MASK) -#define SYNTH_SYNTH5_SLOPE_IP_MSB 27 -#define SYNTH_SYNTH5_SLOPE_IP_LSB 25 -#define SYNTH_SYNTH5_SLOPE_IP_MASK 0x0e000000 -#define SYNTH_SYNTH5_SLOPE_IP_GET(x) (((x) & SYNTH_SYNTH5_SLOPE_IP_MASK) >> SYNTH_SYNTH5_SLOPE_IP_LSB) -#define SYNTH_SYNTH5_SLOPE_IP_SET(x) (((x) << SYNTH_SYNTH5_SLOPE_IP_LSB) & SYNTH_SYNTH5_SLOPE_IP_MASK) -#define SYNTH_SYNTH5_CPBIAS_MSB 24 -#define SYNTH_SYNTH5_CPBIAS_LSB 23 -#define SYNTH_SYNTH5_CPBIAS_MASK 0x01800000 -#define SYNTH_SYNTH5_CPBIAS_GET(x) (((x) & SYNTH_SYNTH5_CPBIAS_MASK) >> SYNTH_SYNTH5_CPBIAS_LSB) -#define SYNTH_SYNTH5_CPBIAS_SET(x) (((x) << SYNTH_SYNTH5_CPBIAS_LSB) & SYNTH_SYNTH5_CPBIAS_MASK) -#define SYNTH_SYNTH5_CPSTEERING_EN_MSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_LSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_MASK 0x00400000 -#define SYNTH_SYNTH5_CPSTEERING_EN_GET(x) (((x) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) >> SYNTH_SYNTH5_CPSTEERING_EN_LSB) -#define SYNTH_SYNTH5_CPSTEERING_EN_SET(x) (((x) << SYNTH_SYNTH5_CPSTEERING_EN_LSB) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) -#define SYNTH_SYNTH5_CPLOWLK_MSB 21 -#define SYNTH_SYNTH5_CPLOWLK_LSB 21 -#define SYNTH_SYNTH5_CPLOWLK_MASK 0x00200000 -#define SYNTH_SYNTH5_CPLOWLK_GET(x) (((x) & SYNTH_SYNTH5_CPLOWLK_MASK) >> SYNTH_SYNTH5_CPLOWLK_LSB) -#define SYNTH_SYNTH5_CPLOWLK_SET(x) (((x) << SYNTH_SYNTH5_CPLOWLK_LSB) & SYNTH_SYNTH5_CPLOWLK_MASK) -#define SYNTH_SYNTH5_LOOPLEAKCUR_MSB 20 -#define SYNTH_SYNTH5_LOOPLEAKCUR_LSB 17 -#define SYNTH_SYNTH5_LOOPLEAKCUR_MASK 0x001e0000 -#define SYNTH_SYNTH5_LOOPLEAKCUR_GET(x) (((x) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) >> SYNTH_SYNTH5_LOOPLEAKCUR_LSB) -#define SYNTH_SYNTH5_LOOPLEAKCUR_SET(x) (((x) << SYNTH_SYNTH5_LOOPLEAKCUR_LSB) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) -#define SYNTH_SYNTH5_CAPRANGE1_MSB 16 -#define SYNTH_SYNTH5_CAPRANGE1_LSB 13 -#define SYNTH_SYNTH5_CAPRANGE1_MASK 0x0001e000 -#define SYNTH_SYNTH5_CAPRANGE1_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE1_MASK) >> SYNTH_SYNTH5_CAPRANGE1_LSB) -#define SYNTH_SYNTH5_CAPRANGE1_SET(x) (((x) << SYNTH_SYNTH5_CAPRANGE1_LSB) & SYNTH_SYNTH5_CAPRANGE1_MASK) -#define SYNTH_SYNTH5_CAPRANGE2_MSB 12 -#define SYNTH_SYNTH5_CAPRANGE2_LSB 9 -#define SYNTH_SYNTH5_CAPRANGE2_MASK 0x00001e00 -#define SYNTH_SYNTH5_CAPRANGE2_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE2_MASK) >> SYNTH_SYNTH5_CAPRANGE2_LSB) -#define SYNTH_SYNTH5_CAPRANGE2_SET(x) (((x) << SYNTH_SYNTH5_CAPRANGE2_LSB) & SYNTH_SYNTH5_CAPRANGE2_MASK) -#define SYNTH_SYNTH5_CAPRANGE3_MSB 8 -#define SYNTH_SYNTH5_CAPRANGE3_LSB 5 -#define SYNTH_SYNTH5_CAPRANGE3_MASK 0x000001e0 -#define SYNTH_SYNTH5_CAPRANGE3_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE3_MASK) >> SYNTH_SYNTH5_CAPRANGE3_LSB) -#define SYNTH_SYNTH5_CAPRANGE3_SET(x) (((x) << SYNTH_SYNTH5_CAPRANGE3_LSB) & SYNTH_SYNTH5_CAPRANGE3_MASK) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK 0x00000010 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_SET(x) (((x) << SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MSB 3 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB 2 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK 0x0000000c -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_GET(x) (((x) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) >> SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_SET(x) (((x) << SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) -#define SYNTH_SYNTH5_SPARE_MSB 1 -#define SYNTH_SYNTH5_SPARE_LSB 0 -#define SYNTH_SYNTH5_SPARE_MASK 0x00000003 -#define SYNTH_SYNTH5_SPARE_GET(x) (((x) & SYNTH_SYNTH5_SPARE_MASK) >> SYNTH_SYNTH5_SPARE_LSB) -#define SYNTH_SYNTH5_SPARE_SET(x) (((x) << SYNTH_SYNTH5_SPARE_LSB) & SYNTH_SYNTH5_SPARE_MASK) - -#define SYNTH_SYNTH6_ADDRESS 0x00000014 -#define SYNTH_SYNTH6_OFFSET 0x00000014 -#define SYNTH_SYNTH6_IRCP_MSB 31 -#define SYNTH_SYNTH6_IRCP_LSB 29 -#define SYNTH_SYNTH6_IRCP_MASK 0xe0000000 -#define SYNTH_SYNTH6_IRCP_GET(x) (((x) & SYNTH_SYNTH6_IRCP_MASK) >> SYNTH_SYNTH6_IRCP_LSB) -#define SYNTH_SYNTH6_IRCP_SET(x) (((x) << SYNTH_SYNTH6_IRCP_LSB) & SYNTH_SYNTH6_IRCP_MASK) -#define SYNTH_SYNTH6_IRVCMON_MSB 28 -#define SYNTH_SYNTH6_IRVCMON_LSB 26 -#define SYNTH_SYNTH6_IRVCMON_MASK 0x1c000000 -#define SYNTH_SYNTH6_IRVCMON_GET(x) (((x) & SYNTH_SYNTH6_IRVCMON_MASK) >> SYNTH_SYNTH6_IRVCMON_LSB) -#define SYNTH_SYNTH6_IRVCMON_SET(x) (((x) << SYNTH_SYNTH6_IRVCMON_LSB) & SYNTH_SYNTH6_IRVCMON_MASK) -#define SYNTH_SYNTH6_IRSPARE_MSB 25 -#define SYNTH_SYNTH6_IRSPARE_LSB 23 -#define SYNTH_SYNTH6_IRSPARE_MASK 0x03800000 -#define SYNTH_SYNTH6_IRSPARE_GET(x) (((x) & SYNTH_SYNTH6_IRSPARE_MASK) >> SYNTH_SYNTH6_IRSPARE_LSB) -#define SYNTH_SYNTH6_IRSPARE_SET(x) (((x) << SYNTH_SYNTH6_IRSPARE_LSB) & SYNTH_SYNTH6_IRSPARE_MASK) -#define SYNTH_SYNTH6_ICPRESC_MSB 22 -#define SYNTH_SYNTH6_ICPRESC_LSB 20 -#define SYNTH_SYNTH6_ICPRESC_MASK 0x00700000 -#define SYNTH_SYNTH6_ICPRESC_GET(x) (((x) & SYNTH_SYNTH6_ICPRESC_MASK) >> SYNTH_SYNTH6_ICPRESC_LSB) -#define SYNTH_SYNTH6_ICPRESC_SET(x) (((x) << SYNTH_SYNTH6_ICPRESC_LSB) & SYNTH_SYNTH6_ICPRESC_MASK) -#define SYNTH_SYNTH6_ICLODIV_MSB 19 -#define SYNTH_SYNTH6_ICLODIV_LSB 17 -#define SYNTH_SYNTH6_ICLODIV_MASK 0x000e0000 -#define SYNTH_SYNTH6_ICLODIV_GET(x) (((x) & SYNTH_SYNTH6_ICLODIV_MASK) >> SYNTH_SYNTH6_ICLODIV_LSB) -#define SYNTH_SYNTH6_ICLODIV_SET(x) (((x) << SYNTH_SYNTH6_ICLODIV_LSB) & SYNTH_SYNTH6_ICLODIV_MASK) -#define SYNTH_SYNTH6_ICLOMIX_MSB 16 -#define SYNTH_SYNTH6_ICLOMIX_LSB 14 -#define SYNTH_SYNTH6_ICLOMIX_MASK 0x0001c000 -#define SYNTH_SYNTH6_ICLOMIX_GET(x) (((x) & SYNTH_SYNTH6_ICLOMIX_MASK) >> SYNTH_SYNTH6_ICLOMIX_LSB) -#define SYNTH_SYNTH6_ICLOMIX_SET(x) (((x) << SYNTH_SYNTH6_ICLOMIX_LSB) & SYNTH_SYNTH6_ICLOMIX_MASK) -#define SYNTH_SYNTH6_ICSPAREA_MSB 13 -#define SYNTH_SYNTH6_ICSPAREA_LSB 11 -#define SYNTH_SYNTH6_ICSPAREA_MASK 0x00003800 -#define SYNTH_SYNTH6_ICSPAREA_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREA_MASK) >> SYNTH_SYNTH6_ICSPAREA_LSB) -#define SYNTH_SYNTH6_ICSPAREA_SET(x) (((x) << SYNTH_SYNTH6_ICSPAREA_LSB) & SYNTH_SYNTH6_ICSPAREA_MASK) -#define SYNTH_SYNTH6_ICSPAREB_MSB 10 -#define SYNTH_SYNTH6_ICSPAREB_LSB 8 -#define SYNTH_SYNTH6_ICSPAREB_MASK 0x00000700 -#define SYNTH_SYNTH6_ICSPAREB_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREB_MASK) >> SYNTH_SYNTH6_ICSPAREB_LSB) -#define SYNTH_SYNTH6_ICSPAREB_SET(x) (((x) << SYNTH_SYNTH6_ICSPAREB_LSB) & SYNTH_SYNTH6_ICSPAREB_MASK) -#define SYNTH_SYNTH6_ICVCO_MSB 7 -#define SYNTH_SYNTH6_ICVCO_LSB 5 -#define SYNTH_SYNTH6_ICVCO_MASK 0x000000e0 -#define SYNTH_SYNTH6_ICVCO_GET(x) (((x) & SYNTH_SYNTH6_ICVCO_MASK) >> SYNTH_SYNTH6_ICVCO_LSB) -#define SYNTH_SYNTH6_ICVCO_SET(x) (((x) << SYNTH_SYNTH6_ICVCO_LSB) & SYNTH_SYNTH6_ICVCO_MASK) -#define SYNTH_SYNTH6_VCOBUFBIAS_MSB 4 -#define SYNTH_SYNTH6_VCOBUFBIAS_LSB 3 -#define SYNTH_SYNTH6_VCOBUFBIAS_MASK 0x00000018 -#define SYNTH_SYNTH6_VCOBUFBIAS_GET(x) (((x) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) >> SYNTH_SYNTH6_VCOBUFBIAS_LSB) -#define SYNTH_SYNTH6_VCOBUFBIAS_SET(x) (((x) << SYNTH_SYNTH6_VCOBUFBIAS_LSB) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) -#define SYNTH_SYNTH6_SPARE_BIAS_MSB 2 -#define SYNTH_SYNTH6_SPARE_BIAS_LSB 0 -#define SYNTH_SYNTH6_SPARE_BIAS_MASK 0x00000007 -#define SYNTH_SYNTH6_SPARE_BIAS_GET(x) (((x) & SYNTH_SYNTH6_SPARE_BIAS_MASK) >> SYNTH_SYNTH6_SPARE_BIAS_LSB) -#define SYNTH_SYNTH6_SPARE_BIAS_SET(x) (((x) << SYNTH_SYNTH6_SPARE_BIAS_LSB) & SYNTH_SYNTH6_SPARE_BIAS_MASK) - -#define SYNTH_SYNTH7_ADDRESS 0x00000018 -#define SYNTH_SYNTH7_OFFSET 0x00000018 -#define SYNTH_SYNTH7_SYNTH_ON_MSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_LSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_MASK 0x80000000 -#define SYNTH_SYNTH7_SYNTH_ON_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_ON_MASK) >> SYNTH_SYNTH7_SYNTH_ON_LSB) -#define SYNTH_SYNTH7_SYNTH_ON_SET(x) (((x) << SYNTH_SYNTH7_SYNTH_ON_LSB) & SYNTH_SYNTH7_SYNTH_ON_MASK) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MSB 30 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_LSB 27 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MASK 0x78000000 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) >> SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_SET(x) (((x) << SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) -#define SYNTH_SYNTH7_CAP_SEARCH_MSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_LSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_MASK 0x04000000 -#define SYNTH_SYNTH7_CAP_SEARCH_GET(x) (((x) & SYNTH_SYNTH7_CAP_SEARCH_MASK) >> SYNTH_SYNTH7_CAP_SEARCH_LSB) -#define SYNTH_SYNTH7_CAP_SEARCH_SET(x) (((x) << SYNTH_SYNTH7_CAP_SEARCH_LSB) & SYNTH_SYNTH7_CAP_SEARCH_MASK) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK 0x02000000 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) >> SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_SET(x) (((x) << SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) -#define SYNTH_SYNTH7_PIN_VC_MSB 24 -#define SYNTH_SYNTH7_PIN_VC_LSB 24 -#define SYNTH_SYNTH7_PIN_VC_MASK 0x01000000 -#define SYNTH_SYNTH7_PIN_VC_GET(x) (((x) & SYNTH_SYNTH7_PIN_VC_MASK) >> SYNTH_SYNTH7_PIN_VC_LSB) -#define SYNTH_SYNTH7_PIN_VC_SET(x) (((x) << SYNTH_SYNTH7_PIN_VC_LSB) & SYNTH_SYNTH7_PIN_VC_MASK) -#define SYNTH_SYNTH7_VCO_CAP_ST_MSB 23 -#define SYNTH_SYNTH7_VCO_CAP_ST_LSB 16 -#define SYNTH_SYNTH7_VCO_CAP_ST_MASK 0x00ff0000 -#define SYNTH_SYNTH7_VCO_CAP_ST_GET(x) (((x) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) >> SYNTH_SYNTH7_VCO_CAP_ST_LSB) -#define SYNTH_SYNTH7_VCO_CAP_ST_SET(x) (((x) << SYNTH_SYNTH7_VCO_CAP_ST_LSB) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) -#define SYNTH_SYNTH7_SHORT_R_MSB 15 -#define SYNTH_SYNTH7_SHORT_R_LSB 15 -#define SYNTH_SYNTH7_SHORT_R_MASK 0x00008000 -#define SYNTH_SYNTH7_SHORT_R_GET(x) (((x) & SYNTH_SYNTH7_SHORT_R_MASK) >> SYNTH_SYNTH7_SHORT_R_LSB) -#define SYNTH_SYNTH7_SHORT_R_SET(x) (((x) << SYNTH_SYNTH7_SHORT_R_LSB) & SYNTH_SYNTH7_SHORT_R_MASK) -#define SYNTH_SYNTH7_RESET_RFD_MSB 14 -#define SYNTH_SYNTH7_RESET_RFD_LSB 14 -#define SYNTH_SYNTH7_RESET_RFD_MASK 0x00004000 -#define SYNTH_SYNTH7_RESET_RFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_RFD_MASK) >> SYNTH_SYNTH7_RESET_RFD_LSB) -#define SYNTH_SYNTH7_RESET_RFD_SET(x) (((x) << SYNTH_SYNTH7_RESET_RFD_LSB) & SYNTH_SYNTH7_RESET_RFD_MASK) -#define SYNTH_SYNTH7_RESET_PFD_MSB 13 -#define SYNTH_SYNTH7_RESET_PFD_LSB 13 -#define SYNTH_SYNTH7_RESET_PFD_MASK 0x00002000 -#define SYNTH_SYNTH7_RESET_PFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_PFD_MASK) >> SYNTH_SYNTH7_RESET_PFD_LSB) -#define SYNTH_SYNTH7_RESET_PFD_SET(x) (((x) << SYNTH_SYNTH7_RESET_PFD_LSB) & SYNTH_SYNTH7_RESET_PFD_MASK) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK 0x00001000 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_GET(x) (((x) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) >> SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_SET(x) (((x) << SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) -#define SYNTH_SYNTH7_RESET_SDM_B_MSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_LSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_MASK 0x00000800 -#define SYNTH_SYNTH7_RESET_SDM_B_GET(x) (((x) & SYNTH_SYNTH7_RESET_SDM_B_MASK) >> SYNTH_SYNTH7_RESET_SDM_B_LSB) -#define SYNTH_SYNTH7_RESET_SDM_B_SET(x) (((x) << SYNTH_SYNTH7_RESET_SDM_B_LSB) & SYNTH_SYNTH7_RESET_SDM_B_MASK) -#define SYNTH_SYNTH7_VC2HIGH_MSB 10 -#define SYNTH_SYNTH7_VC2HIGH_LSB 10 -#define SYNTH_SYNTH7_VC2HIGH_MASK 0x00000400 -#define SYNTH_SYNTH7_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH7_VC2HIGH_MASK) >> SYNTH_SYNTH7_VC2HIGH_LSB) -#define SYNTH_SYNTH7_VC2HIGH_SET(x) (((x) << SYNTH_SYNTH7_VC2HIGH_LSB) & SYNTH_SYNTH7_VC2HIGH_MASK) -#define SYNTH_SYNTH7_VC2LOW_MSB 9 -#define SYNTH_SYNTH7_VC2LOW_LSB 9 -#define SYNTH_SYNTH7_VC2LOW_MASK 0x00000200 -#define SYNTH_SYNTH7_VC2LOW_GET(x) (((x) & SYNTH_SYNTH7_VC2LOW_MASK) >> SYNTH_SYNTH7_VC2LOW_LSB) -#define SYNTH_SYNTH7_VC2LOW_SET(x) (((x) << SYNTH_SYNTH7_VC2LOW_LSB) & SYNTH_SYNTH7_VC2LOW_MASK) -#define SYNTH_SYNTH7_LOOP_IP_MSB 8 -#define SYNTH_SYNTH7_LOOP_IP_LSB 5 -#define SYNTH_SYNTH7_LOOP_IP_MASK 0x000001e0 -#define SYNTH_SYNTH7_LOOP_IP_GET(x) (((x) & SYNTH_SYNTH7_LOOP_IP_MASK) >> SYNTH_SYNTH7_LOOP_IP_LSB) -#define SYNTH_SYNTH7_LOOP_IP_SET(x) (((x) << SYNTH_SYNTH7_LOOP_IP_LSB) & SYNTH_SYNTH7_LOOP_IP_MASK) -#define SYNTH_SYNTH7_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH7_LOBUF5GTUNE_LSB 3 -#define SYNTH_SYNTH7_LOBUF5GTUNE_MASK 0x00000018 -#define SYNTH_SYNTH7_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH7_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH7_LOBUF5GTUNE_SET(x) (((x) << SYNTH_SYNTH7_LOBUF5GTUNE_LSB) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH7_SPARE_READ_MSB 2 -#define SYNTH_SYNTH7_SPARE_READ_LSB 0 -#define SYNTH_SYNTH7_SPARE_READ_MASK 0x00000007 -#define SYNTH_SYNTH7_SPARE_READ_GET(x) (((x) & SYNTH_SYNTH7_SPARE_READ_MASK) >> SYNTH_SYNTH7_SPARE_READ_LSB) -#define SYNTH_SYNTH7_SPARE_READ_SET(x) (((x) << SYNTH_SYNTH7_SPARE_READ_LSB) & SYNTH_SYNTH7_SPARE_READ_MASK) - -#define SYNTH_SYNTH8_ADDRESS 0x0000001c -#define SYNTH_SYNTH8_OFFSET 0x0000001c -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK 0x80000000 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_GET(x) (((x) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) >> SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_SET(x) (((x) << SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) -#define SYNTH_SYNTH8_FRACMODE_MSB 30 -#define SYNTH_SYNTH8_FRACMODE_LSB 30 -#define SYNTH_SYNTH8_FRACMODE_MASK 0x40000000 -#define SYNTH_SYNTH8_FRACMODE_GET(x) (((x) & SYNTH_SYNTH8_FRACMODE_MASK) >> SYNTH_SYNTH8_FRACMODE_LSB) -#define SYNTH_SYNTH8_FRACMODE_SET(x) (((x) << SYNTH_SYNTH8_FRACMODE_LSB) & SYNTH_SYNTH8_FRACMODE_MASK) -#define SYNTH_SYNTH8_AMODEREFSEL_MSB 29 -#define SYNTH_SYNTH8_AMODEREFSEL_LSB 28 -#define SYNTH_SYNTH8_AMODEREFSEL_MASK 0x30000000 -#define SYNTH_SYNTH8_AMODEREFSEL_GET(x) (((x) & SYNTH_SYNTH8_AMODEREFSEL_MASK) >> SYNTH_SYNTH8_AMODEREFSEL_LSB) -#define SYNTH_SYNTH8_AMODEREFSEL_SET(x) (((x) << SYNTH_SYNTH8_AMODEREFSEL_LSB) & SYNTH_SYNTH8_AMODEREFSEL_MASK) -#define SYNTH_SYNTH8_SPARE_MSB 27 -#define SYNTH_SYNTH8_SPARE_LSB 27 -#define SYNTH_SYNTH8_SPARE_MASK 0x08000000 -#define SYNTH_SYNTH8_SPARE_GET(x) (((x) & SYNTH_SYNTH8_SPARE_MASK) >> SYNTH_SYNTH8_SPARE_LSB) -#define SYNTH_SYNTH8_SPARE_SET(x) (((x) << SYNTH_SYNTH8_SPARE_LSB) & SYNTH_SYNTH8_SPARE_MASK) -#define SYNTH_SYNTH8_CHANSEL_MSB 26 -#define SYNTH_SYNTH8_CHANSEL_LSB 18 -#define SYNTH_SYNTH8_CHANSEL_MASK 0x07fc0000 -#define SYNTH_SYNTH8_CHANSEL_GET(x) (((x) & SYNTH_SYNTH8_CHANSEL_MASK) >> SYNTH_SYNTH8_CHANSEL_LSB) -#define SYNTH_SYNTH8_CHANSEL_SET(x) (((x) << SYNTH_SYNTH8_CHANSEL_LSB) & SYNTH_SYNTH8_CHANSEL_MASK) -#define SYNTH_SYNTH8_CHANFRAC_MSB 17 -#define SYNTH_SYNTH8_CHANFRAC_LSB 1 -#define SYNTH_SYNTH8_CHANFRAC_MASK 0x0003fffe -#define SYNTH_SYNTH8_CHANFRAC_GET(x) (((x) & SYNTH_SYNTH8_CHANFRAC_MASK) >> SYNTH_SYNTH8_CHANFRAC_LSB) -#define SYNTH_SYNTH8_CHANFRAC_SET(x) (((x) << SYNTH_SYNTH8_CHANFRAC_LSB) & SYNTH_SYNTH8_CHANFRAC_MASK) -#define SYNTH_SYNTH8_FORCE_FRACLSB_MSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_LSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_MASK 0x00000001 -#define SYNTH_SYNTH8_FORCE_FRACLSB_GET(x) (((x) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) >> SYNTH_SYNTH8_FORCE_FRACLSB_LSB) -#define SYNTH_SYNTH8_FORCE_FRACLSB_SET(x) (((x) << SYNTH_SYNTH8_FORCE_FRACLSB_LSB) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct synth_reg_reg_s { - volatile unsigned int synth_synth1; - volatile unsigned int synth_synth2; - volatile unsigned int synth_synth3; - volatile unsigned int synth_synth4; - volatile unsigned int synth_synth5; - volatile unsigned int synth_synth6; - volatile unsigned int synth_synth7; - volatile unsigned int synth_synth8; -} synth_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _SYNTH_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/synth_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/synth_reg.vrh deleted file mode 100644 index 306c6471becb..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/synth_reg.vrh +++ /dev/null @@ -1,939 +0,0 @@ -#ifndef _SYNTH_REG_VRH_ -#define _SYNTH_REG_VRH_ - -#define SYNTH_SYNTH1_ADDRESS 'h00000000 -#define SYNTH_SYNTH1_PWD_BIAS_MSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_LSB 31 -#define SYNTH_SYNTH1_PWD_BIAS_MASK 'h80000000 -#define SYNTH_SYNTH1_PWD_BIAS_GET(x) (((x) & SYNTH_SYNTH1_PWD_BIAS_MASK) >> SYNTH_SYNTH1_PWD_BIAS_LSB) -#define SYNTH_SYNTH1_PWD_BIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_BIAS_LSB) & SYNTH_SYNTH1_PWD_BIAS_MASK) -#define SYNTH_SYNTH1_PWD_BIAS_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_CP_MSB 30 -#define SYNTH_SYNTH1_PWD_CP_LSB 30 -#define SYNTH_SYNTH1_PWD_CP_MASK 'h40000000 -#define SYNTH_SYNTH1_PWD_CP_GET(x) (((x) & SYNTH_SYNTH1_PWD_CP_MASK) >> SYNTH_SYNTH1_PWD_CP_LSB) -#define SYNTH_SYNTH1_PWD_CP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_CP_LSB) & SYNTH_SYNTH1_PWD_CP_MASK) -#define SYNTH_SYNTH1_PWD_CP_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_VCMON_MSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_LSB 29 -#define SYNTH_SYNTH1_PWD_VCMON_MASK 'h20000000 -#define SYNTH_SYNTH1_PWD_VCMON_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCMON_MASK) >> SYNTH_SYNTH1_PWD_VCMON_LSB) -#define SYNTH_SYNTH1_PWD_VCMON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_VCMON_LSB) & SYNTH_SYNTH1_PWD_VCMON_MASK) -#define SYNTH_SYNTH1_PWD_VCMON_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_VCO_MSB 28 -#define SYNTH_SYNTH1_PWD_VCO_LSB 28 -#define SYNTH_SYNTH1_PWD_VCO_MASK 'h10000000 -#define SYNTH_SYNTH1_PWD_VCO_GET(x) (((x) & SYNTH_SYNTH1_PWD_VCO_MASK) >> SYNTH_SYNTH1_PWD_VCO_LSB) -#define SYNTH_SYNTH1_PWD_VCO_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_VCO_LSB) & SYNTH_SYNTH1_PWD_VCO_MASK) -#define SYNTH_SYNTH1_PWD_VCO_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_PRESC_MSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_LSB 27 -#define SYNTH_SYNTH1_PWD_PRESC_MASK 'h08000000 -#define SYNTH_SYNTH1_PWD_PRESC_GET(x) (((x) & SYNTH_SYNTH1_PWD_PRESC_MASK) >> SYNTH_SYNTH1_PWD_PRESC_LSB) -#define SYNTH_SYNTH1_PWD_PRESC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_PRESC_LSB) & SYNTH_SYNTH1_PWD_PRESC_MASK) -#define SYNTH_SYNTH1_PWD_PRESC_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_LODIV_MSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_LSB 26 -#define SYNTH_SYNTH1_PWD_LODIV_MASK 'h04000000 -#define SYNTH_SYNTH1_PWD_LODIV_GET(x) (((x) & SYNTH_SYNTH1_PWD_LODIV_MASK) >> SYNTH_SYNTH1_PWD_LODIV_LSB) -#define SYNTH_SYNTH1_PWD_LODIV_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_LODIV_LSB) & SYNTH_SYNTH1_PWD_LODIV_MASK) -#define SYNTH_SYNTH1_PWD_LODIV_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_LOMIX_MSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_LSB 25 -#define SYNTH_SYNTH1_PWD_LOMIX_MASK 'h02000000 -#define SYNTH_SYNTH1_PWD_LOMIX_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOMIX_MASK) >> SYNTH_SYNTH1_PWD_LOMIX_LSB) -#define SYNTH_SYNTH1_PWD_LOMIX_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_LOMIX_LSB) & SYNTH_SYNTH1_PWD_LOMIX_MASK) -#define SYNTH_SYNTH1_PWD_LOMIX_RESET 1'h0 -#define SYNTH_SYNTH1_FORCE_LO_ON_MSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_LSB 24 -#define SYNTH_SYNTH1_FORCE_LO_ON_MASK 'h01000000 -#define SYNTH_SYNTH1_FORCE_LO_ON_GET(x) (((x) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) >> SYNTH_SYNTH1_FORCE_LO_ON_LSB) -#define SYNTH_SYNTH1_FORCE_LO_ON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_FORCE_LO_ON_LSB) & SYNTH_SYNTH1_FORCE_LO_ON_MASK) -#define SYNTH_SYNTH1_FORCE_LO_ON_RESET 1'h0 -#define SYNTH_SYNTH1_PWD_LOBUF5G_MSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_LSB 23 -#define SYNTH_SYNTH1_PWD_LOBUF5G_MASK 'h00800000 -#define SYNTH_SYNTH1_PWD_LOBUF5G_GET(x) (((x) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) >> SYNTH_SYNTH1_PWD_LOBUF5G_LSB) -#define SYNTH_SYNTH1_PWD_LOBUF5G_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWD_LOBUF5G_LSB) & SYNTH_SYNTH1_PWD_LOBUF5G_MASK) -#define SYNTH_SYNTH1_PWD_LOBUF5G_RESET 1'h0 -#define SYNTH_SYNTH1_VCOREGBYPASS_MSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_LSB 22 -#define SYNTH_SYNTH1_VCOREGBYPASS_MASK 'h00400000 -#define SYNTH_SYNTH1_VCOREGBYPASS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) >> SYNTH_SYNTH1_VCOREGBYPASS_LSB) -#define SYNTH_SYNTH1_VCOREGBYPASS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_VCOREGBYPASS_LSB) & SYNTH_SYNTH1_VCOREGBYPASS_MASK) -#define SYNTH_SYNTH1_VCOREGBYPASS_RESET 1'h1 -#define SYNTH_SYNTH1_VCOREGLEVEL_MSB 21 -#define SYNTH_SYNTH1_VCOREGLEVEL_LSB 20 -#define SYNTH_SYNTH1_VCOREGLEVEL_MASK 'h00300000 -#define SYNTH_SYNTH1_VCOREGLEVEL_GET(x) (((x) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) >> SYNTH_SYNTH1_VCOREGLEVEL_LSB) -#define SYNTH_SYNTH1_VCOREGLEVEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_VCOREGLEVEL_LSB) & SYNTH_SYNTH1_VCOREGLEVEL_MASK) -#define SYNTH_SYNTH1_VCOREGLEVEL_RESET 2'h1 -#define SYNTH_SYNTH1_VCOREGBIAS_MSB 19 -#define SYNTH_SYNTH1_VCOREGBIAS_LSB 18 -#define SYNTH_SYNTH1_VCOREGBIAS_MASK 'h000c0000 -#define SYNTH_SYNTH1_VCOREGBIAS_GET(x) (((x) & SYNTH_SYNTH1_VCOREGBIAS_MASK) >> SYNTH_SYNTH1_VCOREGBIAS_LSB) -#define SYNTH_SYNTH1_VCOREGBIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_VCOREGBIAS_LSB) & SYNTH_SYNTH1_VCOREGBIAS_MASK) -#define SYNTH_SYNTH1_VCOREGBIAS_RESET 2'h1 -#define SYNTH_SYNTH1_SLIDINGIF_MSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_LSB 17 -#define SYNTH_SYNTH1_SLIDINGIF_MASK 'h00020000 -#define SYNTH_SYNTH1_SLIDINGIF_GET(x) (((x) & SYNTH_SYNTH1_SLIDINGIF_MASK) >> SYNTH_SYNTH1_SLIDINGIF_LSB) -#define SYNTH_SYNTH1_SLIDINGIF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_SLIDINGIF_LSB) & SYNTH_SYNTH1_SLIDINGIF_MASK) -#define SYNTH_SYNTH1_SLIDINGIF_RESET 1'h0 -#define SYNTH_SYNTH1_SPARE_PWD_MSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_LSB 16 -#define SYNTH_SYNTH1_SPARE_PWD_MASK 'h00010000 -#define SYNTH_SYNTH1_SPARE_PWD_GET(x) (((x) & SYNTH_SYNTH1_SPARE_PWD_MASK) >> SYNTH_SYNTH1_SPARE_PWD_LSB) -#define SYNTH_SYNTH1_SPARE_PWD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_SPARE_PWD_LSB) & SYNTH_SYNTH1_SPARE_PWD_MASK) -#define SYNTH_SYNTH1_SPARE_PWD_RESET 1'h0 -#define SYNTH_SYNTH1_CON_VDDVCOREG_MSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_LSB 15 -#define SYNTH_SYNTH1_CON_VDDVCOREG_MASK 'h00008000 -#define SYNTH_SYNTH1_CON_VDDVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) >> SYNTH_SYNTH1_CON_VDDVCOREG_LSB) -#define SYNTH_SYNTH1_CON_VDDVCOREG_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_CON_VDDVCOREG_LSB) & SYNTH_SYNTH1_CON_VDDVCOREG_MASK) -#define SYNTH_SYNTH1_CON_VDDVCOREG_RESET 1'h0 -#define SYNTH_SYNTH1_CON_IVCOREG_MSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_LSB 14 -#define SYNTH_SYNTH1_CON_IVCOREG_MASK 'h00004000 -#define SYNTH_SYNTH1_CON_IVCOREG_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOREG_MASK) >> SYNTH_SYNTH1_CON_IVCOREG_LSB) -#define SYNTH_SYNTH1_CON_IVCOREG_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_CON_IVCOREG_LSB) & SYNTH_SYNTH1_CON_IVCOREG_MASK) -#define SYNTH_SYNTH1_CON_IVCOREG_RESET 1'h0 -#define SYNTH_SYNTH1_CON_IVCOBUF_MSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_LSB 13 -#define SYNTH_SYNTH1_CON_IVCOBUF_MASK 'h00002000 -#define SYNTH_SYNTH1_CON_IVCOBUF_GET(x) (((x) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) >> SYNTH_SYNTH1_CON_IVCOBUF_LSB) -#define SYNTH_SYNTH1_CON_IVCOBUF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_CON_IVCOBUF_LSB) & SYNTH_SYNTH1_CON_IVCOBUF_MASK) -#define SYNTH_SYNTH1_CON_IVCOBUF_RESET 1'h0 -#define SYNTH_SYNTH1_SEL_VCMONABUS_MSB 12 -#define SYNTH_SYNTH1_SEL_VCMONABUS_LSB 10 -#define SYNTH_SYNTH1_SEL_VCMONABUS_MASK 'h00001c00 -#define SYNTH_SYNTH1_SEL_VCMONABUS_GET(x) (((x) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) >> SYNTH_SYNTH1_SEL_VCMONABUS_LSB) -#define SYNTH_SYNTH1_SEL_VCMONABUS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_SEL_VCMONABUS_LSB) & SYNTH_SYNTH1_SEL_VCMONABUS_MASK) -#define SYNTH_SYNTH1_SEL_VCMONABUS_RESET 3'h0 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB 9 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK 'h00000200 -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) >> SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_VCOBUF_PD_LSB) & SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK) -#define SYNTH_SYNTH1_PWUP_VCOBUF_PD_RESET 1'h0 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_LSB 8 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_MASK 'h00000100 -#define SYNTH_SYNTH1_PWUP_LODIV_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) >> SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_LODIV_PD_LSB) & SYNTH_SYNTH1_PWUP_LODIV_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LODIV_PD_RESET 1'h0 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB 7 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK 'h00000080 -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_LOMIX_PD_LSB) & SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOMIX_PD_RESET 1'h0 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB 6 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK 'h00000040 -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_GET(x) (((x) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) >> SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_PWUP_LOBUF5G_PD_LSB) & SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK) -#define SYNTH_SYNTH1_PWUP_LOBUF5G_PD_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_FB_MSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_LSB 5 -#define SYNTH_SYNTH1_MONITOR_FB_MASK 'h00000020 -#define SYNTH_SYNTH1_MONITOR_FB_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_MASK) >> SYNTH_SYNTH1_MONITOR_FB_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_FB_LSB) & SYNTH_SYNTH1_MONITOR_FB_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_REF_MSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_LSB 4 -#define SYNTH_SYNTH1_MONITOR_REF_MASK 'h00000010 -#define SYNTH_SYNTH1_MONITOR_REF_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_REF_MASK) >> SYNTH_SYNTH1_MONITOR_REF_LSB) -#define SYNTH_SYNTH1_MONITOR_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_REF_LSB) & SYNTH_SYNTH1_MONITOR_REF_MASK) -#define SYNTH_SYNTH1_MONITOR_REF_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB 3 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK 'h00000008 -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) >> SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_FB_DIV2_LSB) & SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK) -#define SYNTH_SYNTH1_MONITOR_FB_DIV2_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB 2 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK 'h00000004 -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) >> SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_VC2HIGH_LSB) & SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2HIGH_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_LSB 1 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_MASK 'h00000002 -#define SYNTH_SYNTH1_MONITOR_VC2LOW_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) >> SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_VC2LOW_LSB) & SYNTH_SYNTH1_MONITOR_VC2LOW_MASK) -#define SYNTH_SYNTH1_MONITOR_VC2LOW_RESET 1'h0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB 0 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK 'h00000001 -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_GET(x) (((x) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) >> SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB) & SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) -#define SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_RESET 1'h0 -#define SYNTH_SYNTH1_RESET (32'h0 | \ - SYNTH_SYNTH1_PWD_BIAS_SET(SYNTH_SYNTH1_PWD_BIAS_RESET) | \ - SYNTH_SYNTH1_PWD_CP_SET(SYNTH_SYNTH1_PWD_CP_RESET) | \ - SYNTH_SYNTH1_PWD_VCMON_SET(SYNTH_SYNTH1_PWD_VCMON_RESET) | \ - SYNTH_SYNTH1_PWD_VCO_SET(SYNTH_SYNTH1_PWD_VCO_RESET) | \ - SYNTH_SYNTH1_PWD_PRESC_SET(SYNTH_SYNTH1_PWD_PRESC_RESET) | \ - SYNTH_SYNTH1_PWD_LODIV_SET(SYNTH_SYNTH1_PWD_LODIV_RESET) | \ - SYNTH_SYNTH1_PWD_LOMIX_SET(SYNTH_SYNTH1_PWD_LOMIX_RESET) | \ - SYNTH_SYNTH1_FORCE_LO_ON_SET(SYNTH_SYNTH1_FORCE_LO_ON_RESET) | \ - SYNTH_SYNTH1_PWD_LOBUF5G_SET(SYNTH_SYNTH1_PWD_LOBUF5G_RESET) | \ - SYNTH_SYNTH1_VCOREGBYPASS_SET(SYNTH_SYNTH1_VCOREGBYPASS_RESET) | \ - SYNTH_SYNTH1_VCOREGLEVEL_SET(SYNTH_SYNTH1_VCOREGLEVEL_RESET) | \ - SYNTH_SYNTH1_VCOREGBIAS_SET(SYNTH_SYNTH1_VCOREGBIAS_RESET) | \ - SYNTH_SYNTH1_SLIDINGIF_SET(SYNTH_SYNTH1_SLIDINGIF_RESET) | \ - SYNTH_SYNTH1_SPARE_PWD_SET(SYNTH_SYNTH1_SPARE_PWD_RESET) | \ - SYNTH_SYNTH1_CON_VDDVCOREG_SET(SYNTH_SYNTH1_CON_VDDVCOREG_RESET) | \ - SYNTH_SYNTH1_CON_IVCOREG_SET(SYNTH_SYNTH1_CON_IVCOREG_RESET) | \ - SYNTH_SYNTH1_CON_IVCOBUF_SET(SYNTH_SYNTH1_CON_IVCOBUF_RESET) | \ - SYNTH_SYNTH1_SEL_VCMONABUS_SET(SYNTH_SYNTH1_SEL_VCMONABUS_RESET) | \ - SYNTH_SYNTH1_PWUP_VCOBUF_PD_SET(SYNTH_SYNTH1_PWUP_VCOBUF_PD_RESET) | \ - SYNTH_SYNTH1_PWUP_LODIV_PD_SET(SYNTH_SYNTH1_PWUP_LODIV_PD_RESET) | \ - SYNTH_SYNTH1_PWUP_LOMIX_PD_SET(SYNTH_SYNTH1_PWUP_LOMIX_PD_RESET) | \ - SYNTH_SYNTH1_PWUP_LOBUF5G_PD_SET(SYNTH_SYNTH1_PWUP_LOBUF5G_PD_RESET) | \ - SYNTH_SYNTH1_MONITOR_FB_SET(SYNTH_SYNTH1_MONITOR_FB_RESET) | \ - SYNTH_SYNTH1_MONITOR_REF_SET(SYNTH_SYNTH1_MONITOR_REF_RESET) | \ - SYNTH_SYNTH1_MONITOR_FB_DIV2_SET(SYNTH_SYNTH1_MONITOR_FB_DIV2_RESET) | \ - SYNTH_SYNTH1_MONITOR_VC2HIGH_SET(SYNTH_SYNTH1_MONITOR_VC2HIGH_RESET) | \ - SYNTH_SYNTH1_MONITOR_VC2LOW_SET(SYNTH_SYNTH1_MONITOR_VC2LOW_RESET) | \ - SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_RESET)) -#define SYNTH_SYNTH1_HW_MASK (32'h0) -#define SYNTH_SYNTH1_SW_MASK (32'h0 | \ - SYNTH_SYNTH1_PWD_BIAS_MASK | \ - SYNTH_SYNTH1_PWD_CP_MASK | \ - SYNTH_SYNTH1_PWD_VCMON_MASK | \ - SYNTH_SYNTH1_PWD_VCO_MASK | \ - SYNTH_SYNTH1_PWD_PRESC_MASK | \ - SYNTH_SYNTH1_PWD_LODIV_MASK | \ - SYNTH_SYNTH1_PWD_LOMIX_MASK | \ - SYNTH_SYNTH1_FORCE_LO_ON_MASK | \ - SYNTH_SYNTH1_PWD_LOBUF5G_MASK | \ - SYNTH_SYNTH1_VCOREGBYPASS_MASK | \ - SYNTH_SYNTH1_VCOREGLEVEL_MASK | \ - SYNTH_SYNTH1_VCOREGBIAS_MASK | \ - SYNTH_SYNTH1_SLIDINGIF_MASK | \ - SYNTH_SYNTH1_SPARE_PWD_MASK | \ - SYNTH_SYNTH1_CON_VDDVCOREG_MASK | \ - SYNTH_SYNTH1_CON_IVCOREG_MASK | \ - SYNTH_SYNTH1_CON_IVCOBUF_MASK | \ - SYNTH_SYNTH1_SEL_VCMONABUS_MASK | \ - SYNTH_SYNTH1_PWUP_VCOBUF_PD_MASK | \ - SYNTH_SYNTH1_PWUP_LODIV_PD_MASK | \ - SYNTH_SYNTH1_PWUP_LOMIX_PD_MASK | \ - SYNTH_SYNTH1_PWUP_LOBUF5G_PD_MASK | \ - SYNTH_SYNTH1_MONITOR_FB_MASK | \ - SYNTH_SYNTH1_MONITOR_REF_MASK | \ - SYNTH_SYNTH1_MONITOR_FB_DIV2_MASK | \ - SYNTH_SYNTH1_MONITOR_VC2HIGH_MASK | \ - SYNTH_SYNTH1_MONITOR_VC2LOW_MASK | \ - SYNTH_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK) - -#define SYNTH_SYNTH2_ADDRESS 'h00000004 -#define SYNTH_SYNTH2_VC_CAL_REF_MSB 31 -#define SYNTH_SYNTH2_VC_CAL_REF_LSB 29 -#define SYNTH_SYNTH2_VC_CAL_REF_MASK 'he0000000 -#define SYNTH_SYNTH2_VC_CAL_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_CAL_REF_MASK) >> SYNTH_SYNTH2_VC_CAL_REF_LSB) -#define SYNTH_SYNTH2_VC_CAL_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_CAL_REF_LSB) & SYNTH_SYNTH2_VC_CAL_REF_MASK) -#define SYNTH_SYNTH2_VC_CAL_REF_RESET 3'h0 -#define SYNTH_SYNTH2_VC_HI_REF_MSB 28 -#define SYNTH_SYNTH2_VC_HI_REF_LSB 26 -#define SYNTH_SYNTH2_VC_HI_REF_MASK 'h1c000000 -#define SYNTH_SYNTH2_VC_HI_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_HI_REF_MASK) >> SYNTH_SYNTH2_VC_HI_REF_LSB) -#define SYNTH_SYNTH2_VC_HI_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_HI_REF_LSB) & SYNTH_SYNTH2_VC_HI_REF_MASK) -#define SYNTH_SYNTH2_VC_HI_REF_RESET 3'h3 -#define SYNTH_SYNTH2_VC_MID_REF_MSB 25 -#define SYNTH_SYNTH2_VC_MID_REF_LSB 23 -#define SYNTH_SYNTH2_VC_MID_REF_MASK 'h03800000 -#define SYNTH_SYNTH2_VC_MID_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_MID_REF_MASK) >> SYNTH_SYNTH2_VC_MID_REF_LSB) -#define SYNTH_SYNTH2_VC_MID_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_MID_REF_LSB) & SYNTH_SYNTH2_VC_MID_REF_MASK) -#define SYNTH_SYNTH2_VC_MID_REF_RESET 3'h4 -#define SYNTH_SYNTH2_VC_LOW_REF_MSB 22 -#define SYNTH_SYNTH2_VC_LOW_REF_LSB 20 -#define SYNTH_SYNTH2_VC_LOW_REF_MASK 'h00700000 -#define SYNTH_SYNTH2_VC_LOW_REF_GET(x) (((x) & SYNTH_SYNTH2_VC_LOW_REF_MASK) >> SYNTH_SYNTH2_VC_LOW_REF_LSB) -#define SYNTH_SYNTH2_VC_LOW_REF_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_VC_LOW_REF_LSB) & SYNTH_SYNTH2_VC_LOW_REF_MASK) -#define SYNTH_SYNTH2_VC_LOW_REF_RESET 3'h4 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MSB 19 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB 15 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK 'h000f8000 -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_GET(x) (((x) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) >> SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_3RD_ORDER_R_LSB) & SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK) -#define SYNTH_SYNTH2_LOOP_3RD_ORDER_R_RESET 5'h8 -#define SYNTH_SYNTH2_LOOP_CP_MSB 14 -#define SYNTH_SYNTH2_LOOP_CP_LSB 10 -#define SYNTH_SYNTH2_LOOP_CP_MASK 'h00007c00 -#define SYNTH_SYNTH2_LOOP_CP_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CP_MASK) >> SYNTH_SYNTH2_LOOP_CP_LSB) -#define SYNTH_SYNTH2_LOOP_CP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_CP_LSB) & SYNTH_SYNTH2_LOOP_CP_MASK) -#define SYNTH_SYNTH2_LOOP_CP_RESET 5'h8 -#define SYNTH_SYNTH2_LOOP_RS_MSB 9 -#define SYNTH_SYNTH2_LOOP_RS_LSB 5 -#define SYNTH_SYNTH2_LOOP_RS_MASK 'h000003e0 -#define SYNTH_SYNTH2_LOOP_RS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_RS_MASK) >> SYNTH_SYNTH2_LOOP_RS_LSB) -#define SYNTH_SYNTH2_LOOP_RS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_RS_LSB) & SYNTH_SYNTH2_LOOP_RS_MASK) -#define SYNTH_SYNTH2_LOOP_RS_RESET 5'h5 -#define SYNTH_SYNTH2_LOOP_CS_MSB 4 -#define SYNTH_SYNTH2_LOOP_CS_LSB 3 -#define SYNTH_SYNTH2_LOOP_CS_MASK 'h00000018 -#define SYNTH_SYNTH2_LOOP_CS_GET(x) (((x) & SYNTH_SYNTH2_LOOP_CS_MASK) >> SYNTH_SYNTH2_LOOP_CS_LSB) -#define SYNTH_SYNTH2_LOOP_CS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_LOOP_CS_LSB) & SYNTH_SYNTH2_LOOP_CS_MASK) -#define SYNTH_SYNTH2_LOOP_CS_RESET 2'h3 -#define SYNTH_SYNTH2_SPARE_BITS_MSB 2 -#define SYNTH_SYNTH2_SPARE_BITS_LSB 0 -#define SYNTH_SYNTH2_SPARE_BITS_MASK 'h00000007 -#define SYNTH_SYNTH2_SPARE_BITS_GET(x) (((x) & SYNTH_SYNTH2_SPARE_BITS_MASK) >> SYNTH_SYNTH2_SPARE_BITS_LSB) -#define SYNTH_SYNTH2_SPARE_BITS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH2_SPARE_BITS_LSB) & SYNTH_SYNTH2_SPARE_BITS_MASK) -#define SYNTH_SYNTH2_SPARE_BITS_RESET 3'h0 -#define SYNTH_SYNTH2_RESET (32'h0 | \ - SYNTH_SYNTH2_VC_CAL_REF_SET(SYNTH_SYNTH2_VC_CAL_REF_RESET) | \ - SYNTH_SYNTH2_VC_HI_REF_SET(SYNTH_SYNTH2_VC_HI_REF_RESET) | \ - SYNTH_SYNTH2_VC_MID_REF_SET(SYNTH_SYNTH2_VC_MID_REF_RESET) | \ - SYNTH_SYNTH2_VC_LOW_REF_SET(SYNTH_SYNTH2_VC_LOW_REF_RESET) | \ - SYNTH_SYNTH2_LOOP_3RD_ORDER_R_SET(SYNTH_SYNTH2_LOOP_3RD_ORDER_R_RESET) | \ - SYNTH_SYNTH2_LOOP_CP_SET(SYNTH_SYNTH2_LOOP_CP_RESET) | \ - SYNTH_SYNTH2_LOOP_RS_SET(SYNTH_SYNTH2_LOOP_RS_RESET) | \ - SYNTH_SYNTH2_LOOP_CS_SET(SYNTH_SYNTH2_LOOP_CS_RESET) | \ - SYNTH_SYNTH2_SPARE_BITS_SET(SYNTH_SYNTH2_SPARE_BITS_RESET)) -#define SYNTH_SYNTH2_HW_MASK (32'h0) -#define SYNTH_SYNTH2_SW_MASK (32'h0 | \ - SYNTH_SYNTH2_VC_CAL_REF_MASK | \ - SYNTH_SYNTH2_VC_HI_REF_MASK | \ - SYNTH_SYNTH2_VC_MID_REF_MASK | \ - SYNTH_SYNTH2_VC_LOW_REF_MASK | \ - SYNTH_SYNTH2_LOOP_3RD_ORDER_R_MASK | \ - SYNTH_SYNTH2_LOOP_CP_MASK | \ - SYNTH_SYNTH2_LOOP_RS_MASK | \ - SYNTH_SYNTH2_LOOP_CS_MASK | \ - SYNTH_SYNTH2_SPARE_BITS_MASK) - -#define SYNTH_SYNTH3_ADDRESS 'h00000008 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_LSB 31 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_MASK 'h80000000 -#define SYNTH_SYNTH3_DIS_CLK_XTAL_GET(x) (((x) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) >> SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) -#define SYNTH_SYNTH3_DIS_CLK_XTAL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_DIS_CLK_XTAL_LSB) & SYNTH_SYNTH3_DIS_CLK_XTAL_MASK) -#define SYNTH_SYNTH3_DIS_CLK_XTAL_RESET 1'h0 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_LSB 30 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_MASK 'h40000000 -#define SYNTH_SYNTH3_SEL_CLK_DIV2_GET(x) (((x) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) >> SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_SEL_CLK_DIV2_LSB) & SYNTH_SYNTH3_SEL_CLK_DIV2_MASK) -#define SYNTH_SYNTH3_SEL_CLK_DIV2_RESET 1'h1 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MSB 29 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB 24 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK 'h3f000000 -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_RESET 6'h14 -#define SYNTH_SYNTH3_WAIT_PWRUP_MSB 23 -#define SYNTH_SYNTH3_WAIT_PWRUP_LSB 18 -#define SYNTH_SYNTH3_WAIT_PWRUP_MASK 'h00fc0000 -#define SYNTH_SYNTH3_WAIT_PWRUP_GET(x) (((x) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) >> SYNTH_SYNTH3_WAIT_PWRUP_LSB) -#define SYNTH_SYNTH3_WAIT_PWRUP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_PWRUP_LSB) & SYNTH_SYNTH3_WAIT_PWRUP_MASK) -#define SYNTH_SYNTH3_WAIT_PWRUP_RESET 6'h8 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MSB 17 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_LSB 12 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_MASK 'h0003f000 -#define SYNTH_SYNTH3_WAIT_CAL_BIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_CAL_BIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_BIN_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_BIN_RESET 6'h14 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MSB 11 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_LSB 6 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_MASK 'h00000fc0 -#define SYNTH_SYNTH3_WAIT_CAL_LIN_GET(x) (((x) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) >> SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_CAL_LIN_LSB) & SYNTH_SYNTH3_WAIT_CAL_LIN_MASK) -#define SYNTH_SYNTH3_WAIT_CAL_LIN_RESET 6'h14 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MSB 5 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_LSB 0 -#define SYNTH_SYNTH3_WAIT_VC_CHECK_MASK 'h0000003f -#define SYNTH_SYNTH3_WAIT_VC_CHECK_GET(x) (((x) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) >> SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH3_WAIT_VC_CHECK_LSB) & SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) -#define SYNTH_SYNTH3_WAIT_VC_CHECK_RESET 6'h14 -#define SYNTH_SYNTH3_RESET (32'h0 | \ - SYNTH_SYNTH3_DIS_CLK_XTAL_SET(SYNTH_SYNTH3_DIS_CLK_XTAL_RESET) | \ - SYNTH_SYNTH3_SEL_CLK_DIV2_SET(SYNTH_SYNTH3_SEL_CLK_DIV2_RESET) | \ - SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_SET(SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_RESET) | \ - SYNTH_SYNTH3_WAIT_PWRUP_SET(SYNTH_SYNTH3_WAIT_PWRUP_RESET) | \ - SYNTH_SYNTH3_WAIT_CAL_BIN_SET(SYNTH_SYNTH3_WAIT_CAL_BIN_RESET) | \ - SYNTH_SYNTH3_WAIT_CAL_LIN_SET(SYNTH_SYNTH3_WAIT_CAL_LIN_RESET) | \ - SYNTH_SYNTH3_WAIT_VC_CHECK_SET(SYNTH_SYNTH3_WAIT_VC_CHECK_RESET)) -#define SYNTH_SYNTH3_HW_MASK (32'h0) -#define SYNTH_SYNTH3_SW_MASK (32'h0 | \ - SYNTH_SYNTH3_DIS_CLK_XTAL_MASK | \ - SYNTH_SYNTH3_SEL_CLK_DIV2_MASK | \ - SYNTH_SYNTH3_WAIT_SHORTR_PWRUP_MASK | \ - SYNTH_SYNTH3_WAIT_PWRUP_MASK | \ - SYNTH_SYNTH3_WAIT_CAL_BIN_MASK | \ - SYNTH_SYNTH3_WAIT_CAL_LIN_MASK | \ - SYNTH_SYNTH3_WAIT_VC_CHECK_MASK) - -#define SYNTH_SYNTH4_ADDRESS 'h0000000c -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB 31 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK 'h80000000 -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_GET(x) (((x) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) >> SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_LSB) & SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK) -#define SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_RESET 1'h0 -#define SYNTH_SYNTH4_DIS_LOSTVC_MSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_LSB 30 -#define SYNTH_SYNTH4_DIS_LOSTVC_MASK 'h40000000 -#define SYNTH_SYNTH4_DIS_LOSTVC_GET(x) (((x) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) >> SYNTH_SYNTH4_DIS_LOSTVC_LSB) -#define SYNTH_SYNTH4_DIS_LOSTVC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_DIS_LOSTVC_LSB) & SYNTH_SYNTH4_DIS_LOSTVC_MASK) -#define SYNTH_SYNTH4_DIS_LOSTVC_RESET 1'h0 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_LSB 29 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_MASK 'h20000000 -#define SYNTH_SYNTH4_ALWAYS_SHORTR_GET(x) (((x) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) >> SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_ALWAYS_SHORTR_LSB) & SYNTH_SYNTH4_ALWAYS_SHORTR_MASK) -#define SYNTH_SYNTH4_ALWAYS_SHORTR_RESET 1'h0 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB 28 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK 'h10000000 -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_GET(x) (((x) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) >> SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_LSB) & SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK) -#define SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_RESET 1'h1 -#define SYNTH_SYNTH4_FORCE_PINVC_MSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_LSB 27 -#define SYNTH_SYNTH4_FORCE_PINVC_MASK 'h08000000 -#define SYNTH_SYNTH4_FORCE_PINVC_GET(x) (((x) & SYNTH_SYNTH4_FORCE_PINVC_MASK) >> SYNTH_SYNTH4_FORCE_PINVC_LSB) -#define SYNTH_SYNTH4_FORCE_PINVC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_FORCE_PINVC_LSB) & SYNTH_SYNTH4_FORCE_PINVC_MASK) -#define SYNTH_SYNTH4_FORCE_PINVC_RESET 1'h0 -#define SYNTH_SYNTH4_FORCE_VCOCAP_MSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_LSB 26 -#define SYNTH_SYNTH4_FORCE_VCOCAP_MASK 'h04000000 -#define SYNTH_SYNTH4_FORCE_VCOCAP_GET(x) (((x) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) >> SYNTH_SYNTH4_FORCE_VCOCAP_LSB) -#define SYNTH_SYNTH4_FORCE_VCOCAP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_FORCE_VCOCAP_LSB) & SYNTH_SYNTH4_FORCE_VCOCAP_MASK) -#define SYNTH_SYNTH4_FORCE_VCOCAP_RESET 1'h0 -#define SYNTH_SYNTH4_VCOCAP_OVR_MSB 25 -#define SYNTH_SYNTH4_VCOCAP_OVR_LSB 18 -#define SYNTH_SYNTH4_VCOCAP_OVR_MASK 'h03fc0000 -#define SYNTH_SYNTH4_VCOCAP_OVR_GET(x) (((x) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) >> SYNTH_SYNTH4_VCOCAP_OVR_LSB) -#define SYNTH_SYNTH4_VCOCAP_OVR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_VCOCAP_OVR_LSB) & SYNTH_SYNTH4_VCOCAP_OVR_MASK) -#define SYNTH_SYNTH4_VCOCAP_OVR_RESET 8'h80 -#define SYNTH_SYNTH4_VCOCAPPULLUP_MSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_LSB 17 -#define SYNTH_SYNTH4_VCOCAPPULLUP_MASK 'h00020000 -#define SYNTH_SYNTH4_VCOCAPPULLUP_GET(x) (((x) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) >> SYNTH_SYNTH4_VCOCAPPULLUP_LSB) -#define SYNTH_SYNTH4_VCOCAPPULLUP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_VCOCAPPULLUP_LSB) & SYNTH_SYNTH4_VCOCAPPULLUP_MASK) -#define SYNTH_SYNTH4_VCOCAPPULLUP_RESET 1'h1 -#define SYNTH_SYNTH4_REFDIVSEL_MSB 16 -#define SYNTH_SYNTH4_REFDIVSEL_LSB 15 -#define SYNTH_SYNTH4_REFDIVSEL_MASK 'h00018000 -#define SYNTH_SYNTH4_REFDIVSEL_GET(x) (((x) & SYNTH_SYNTH4_REFDIVSEL_MASK) >> SYNTH_SYNTH4_REFDIVSEL_LSB) -#define SYNTH_SYNTH4_REFDIVSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_REFDIVSEL_LSB) & SYNTH_SYNTH4_REFDIVSEL_MASK) -#define SYNTH_SYNTH4_REFDIVSEL_RESET 2'h0 -#define SYNTH_SYNTH4_PFDDELAY_MSB 14 -#define SYNTH_SYNTH4_PFDDELAY_LSB 14 -#define SYNTH_SYNTH4_PFDDELAY_MASK 'h00004000 -#define SYNTH_SYNTH4_PFDDELAY_GET(x) (((x) & SYNTH_SYNTH4_PFDDELAY_MASK) >> SYNTH_SYNTH4_PFDDELAY_LSB) -#define SYNTH_SYNTH4_PFDDELAY_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PFDDELAY_LSB) & SYNTH_SYNTH4_PFDDELAY_MASK) -#define SYNTH_SYNTH4_PFDDELAY_RESET 1'h1 -#define SYNTH_SYNTH4_PFD_DISABLE_MSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_LSB 13 -#define SYNTH_SYNTH4_PFD_DISABLE_MASK 'h00002000 -#define SYNTH_SYNTH4_PFD_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_PFD_DISABLE_MASK) >> SYNTH_SYNTH4_PFD_DISABLE_LSB) -#define SYNTH_SYNTH4_PFD_DISABLE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PFD_DISABLE_LSB) & SYNTH_SYNTH4_PFD_DISABLE_MASK) -#define SYNTH_SYNTH4_PFD_DISABLE_RESET 1'h0 -#define SYNTH_SYNTH4_PRESCSEL_MSB 12 -#define SYNTH_SYNTH4_PRESCSEL_LSB 11 -#define SYNTH_SYNTH4_PRESCSEL_MASK 'h00001800 -#define SYNTH_SYNTH4_PRESCSEL_GET(x) (((x) & SYNTH_SYNTH4_PRESCSEL_MASK) >> SYNTH_SYNTH4_PRESCSEL_LSB) -#define SYNTH_SYNTH4_PRESCSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PRESCSEL_LSB) & SYNTH_SYNTH4_PRESCSEL_MASK) -#define SYNTH_SYNTH4_PRESCSEL_RESET 2'h3 -#define SYNTH_SYNTH4_RESET_PRESC_MSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_LSB 10 -#define SYNTH_SYNTH4_RESET_PRESC_MASK 'h00000400 -#define SYNTH_SYNTH4_RESET_PRESC_GET(x) (((x) & SYNTH_SYNTH4_RESET_PRESC_MASK) >> SYNTH_SYNTH4_RESET_PRESC_LSB) -#define SYNTH_SYNTH4_RESET_PRESC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_RESET_PRESC_LSB) & SYNTH_SYNTH4_RESET_PRESC_MASK) -#define SYNTH_SYNTH4_RESET_PRESC_RESET 1'h0 -#define SYNTH_SYNTH4_SDM_DISABLE_MSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_LSB 9 -#define SYNTH_SYNTH4_SDM_DISABLE_MASK 'h00000200 -#define SYNTH_SYNTH4_SDM_DISABLE_GET(x) (((x) & SYNTH_SYNTH4_SDM_DISABLE_MASK) >> SYNTH_SYNTH4_SDM_DISABLE_LSB) -#define SYNTH_SYNTH4_SDM_DISABLE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SDM_DISABLE_LSB) & SYNTH_SYNTH4_SDM_DISABLE_MASK) -#define SYNTH_SYNTH4_SDM_DISABLE_RESET 1'h0 -#define SYNTH_SYNTH4_SDM_MODE_MSB 8 -#define SYNTH_SYNTH4_SDM_MODE_LSB 8 -#define SYNTH_SYNTH4_SDM_MODE_MASK 'h00000100 -#define SYNTH_SYNTH4_SDM_MODE_GET(x) (((x) & SYNTH_SYNTH4_SDM_MODE_MASK) >> SYNTH_SYNTH4_SDM_MODE_LSB) -#define SYNTH_SYNTH4_SDM_MODE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SDM_MODE_LSB) & SYNTH_SYNTH4_SDM_MODE_MASK) -#define SYNTH_SYNTH4_SDM_MODE_RESET 1'h0 -#define SYNTH_SYNTH4_SDM_DITHER_MSB 7 -#define SYNTH_SYNTH4_SDM_DITHER_LSB 6 -#define SYNTH_SYNTH4_SDM_DITHER_MASK 'h000000c0 -#define SYNTH_SYNTH4_SDM_DITHER_GET(x) (((x) & SYNTH_SYNTH4_SDM_DITHER_MASK) >> SYNTH_SYNTH4_SDM_DITHER_LSB) -#define SYNTH_SYNTH4_SDM_DITHER_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SDM_DITHER_LSB) & SYNTH_SYNTH4_SDM_DITHER_MASK) -#define SYNTH_SYNTH4_SDM_DITHER_RESET 2'h0 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB 5 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK 'h00000020 -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_GET(x) (((x) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) >> SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_PSCOUNT_FBSEL_LSB) & SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK) -#define SYNTH_SYNTH4_PSCOUNT_FBSEL_RESET 1'h0 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB 4 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK 'h00000010 -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_GET(x) (((x) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) >> SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_LSB) & SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK) -#define SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_RESET 1'h0 -#define SYNTH_SYNTH4_SPARE_MISC_MSB 3 -#define SYNTH_SYNTH4_SPARE_MISC_LSB 2 -#define SYNTH_SYNTH4_SPARE_MISC_MASK 'h0000000c -#define SYNTH_SYNTH4_SPARE_MISC_GET(x) (((x) & SYNTH_SYNTH4_SPARE_MISC_MASK) >> SYNTH_SYNTH4_SPARE_MISC_LSB) -#define SYNTH_SYNTH4_SPARE_MISC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_SPARE_MISC_LSB) & SYNTH_SYNTH4_SPARE_MISC_MASK) -#define SYNTH_SYNTH4_SPARE_MISC_RESET 2'h0 -#define SYNTH_SYNTH4_LONGSHIFTSEL_MSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_LSB 1 -#define SYNTH_SYNTH4_LONGSHIFTSEL_MASK 'h00000002 -#define SYNTH_SYNTH4_LONGSHIFTSEL_GET(x) (((x) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) >> SYNTH_SYNTH4_LONGSHIFTSEL_LSB) -#define SYNTH_SYNTH4_LONGSHIFTSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_LONGSHIFTSEL_LSB) & SYNTH_SYNTH4_LONGSHIFTSEL_MASK) -#define SYNTH_SYNTH4_LONGSHIFTSEL_RESET 1'h0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_LSB 0 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_MASK 'h00000001 -#define SYNTH_SYNTH4_FORCE_SHIFTREG_GET(x) (((x) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) >> SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH4_FORCE_SHIFTREG_LSB) & SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) -#define SYNTH_SYNTH4_FORCE_SHIFTREG_RESET 1'h0 -#define SYNTH_SYNTH4_RESET (32'h0 | \ - SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_SET(SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_RESET) | \ - SYNTH_SYNTH4_DIS_LOSTVC_SET(SYNTH_SYNTH4_DIS_LOSTVC_RESET) | \ - SYNTH_SYNTH4_ALWAYS_SHORTR_SET(SYNTH_SYNTH4_ALWAYS_SHORTR_RESET) | \ - SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_SET(SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_RESET) | \ - SYNTH_SYNTH4_FORCE_PINVC_SET(SYNTH_SYNTH4_FORCE_PINVC_RESET) | \ - SYNTH_SYNTH4_FORCE_VCOCAP_SET(SYNTH_SYNTH4_FORCE_VCOCAP_RESET) | \ - SYNTH_SYNTH4_VCOCAP_OVR_SET(SYNTH_SYNTH4_VCOCAP_OVR_RESET) | \ - SYNTH_SYNTH4_VCOCAPPULLUP_SET(SYNTH_SYNTH4_VCOCAPPULLUP_RESET) | \ - SYNTH_SYNTH4_REFDIVSEL_SET(SYNTH_SYNTH4_REFDIVSEL_RESET) | \ - SYNTH_SYNTH4_PFDDELAY_SET(SYNTH_SYNTH4_PFDDELAY_RESET) | \ - SYNTH_SYNTH4_PFD_DISABLE_SET(SYNTH_SYNTH4_PFD_DISABLE_RESET) | \ - SYNTH_SYNTH4_PRESCSEL_SET(SYNTH_SYNTH4_PRESCSEL_RESET) | \ - SYNTH_SYNTH4_RESET_PRESC_SET(SYNTH_SYNTH4_RESET_PRESC_RESET) | \ - SYNTH_SYNTH4_SDM_DISABLE_SET(SYNTH_SYNTH4_SDM_DISABLE_RESET) | \ - SYNTH_SYNTH4_SDM_MODE_SET(SYNTH_SYNTH4_SDM_MODE_RESET) | \ - SYNTH_SYNTH4_SDM_DITHER_SET(SYNTH_SYNTH4_SDM_DITHER_RESET) | \ - SYNTH_SYNTH4_PSCOUNT_FBSEL_SET(SYNTH_SYNTH4_PSCOUNT_FBSEL_RESET) | \ - SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_SET(SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_RESET) | \ - SYNTH_SYNTH4_SPARE_MISC_SET(SYNTH_SYNTH4_SPARE_MISC_RESET) | \ - SYNTH_SYNTH4_LONGSHIFTSEL_SET(SYNTH_SYNTH4_LONGSHIFTSEL_RESET) | \ - SYNTH_SYNTH4_FORCE_SHIFTREG_SET(SYNTH_SYNTH4_FORCE_SHIFTREG_RESET)) -#define SYNTH_SYNTH4_HW_MASK (32'h0) -#define SYNTH_SYNTH4_SW_MASK (32'h0 | \ - SYNTH_SYNTH4_DIS_LIN_CAPSEARCH_MASK | \ - SYNTH_SYNTH4_DIS_LOSTVC_MASK | \ - SYNTH_SYNTH4_ALWAYS_SHORTR_MASK | \ - SYNTH_SYNTH4_SHORTR_UNTIL_LOCKED_MASK | \ - SYNTH_SYNTH4_FORCE_PINVC_MASK | \ - SYNTH_SYNTH4_FORCE_VCOCAP_MASK | \ - SYNTH_SYNTH4_VCOCAP_OVR_MASK | \ - SYNTH_SYNTH4_VCOCAPPULLUP_MASK | \ - SYNTH_SYNTH4_REFDIVSEL_MASK | \ - SYNTH_SYNTH4_PFDDELAY_MASK | \ - SYNTH_SYNTH4_PFD_DISABLE_MASK | \ - SYNTH_SYNTH4_PRESCSEL_MASK | \ - SYNTH_SYNTH4_RESET_PRESC_MASK | \ - SYNTH_SYNTH4_SDM_DISABLE_MASK | \ - SYNTH_SYNTH4_SDM_MODE_MASK | \ - SYNTH_SYNTH4_SDM_DITHER_MASK | \ - SYNTH_SYNTH4_PSCOUNT_FBSEL_MASK | \ - SYNTH_SYNTH4_SEL_CLKXTAL_EDGE_MASK | \ - SYNTH_SYNTH4_SPARE_MISC_MASK | \ - SYNTH_SYNTH4_LONGSHIFTSEL_MASK | \ - SYNTH_SYNTH4_FORCE_SHIFTREG_MASK) - -#define SYNTH_SYNTH5_ADDRESS 'h00000010 -#define SYNTH_SYNTH5_LOOP_IP0_MSB 31 -#define SYNTH_SYNTH5_LOOP_IP0_LSB 28 -#define SYNTH_SYNTH5_LOOP_IP0_MASK 'hf0000000 -#define SYNTH_SYNTH5_LOOP_IP0_GET(x) (((x) & SYNTH_SYNTH5_LOOP_IP0_MASK) >> SYNTH_SYNTH5_LOOP_IP0_LSB) -#define SYNTH_SYNTH5_LOOP_IP0_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_LOOP_IP0_LSB) & SYNTH_SYNTH5_LOOP_IP0_MASK) -#define SYNTH_SYNTH5_LOOP_IP0_RESET 4'hd -#define SYNTH_SYNTH5_SLOPE_IP_MSB 27 -#define SYNTH_SYNTH5_SLOPE_IP_LSB 25 -#define SYNTH_SYNTH5_SLOPE_IP_MASK 'h0e000000 -#define SYNTH_SYNTH5_SLOPE_IP_GET(x) (((x) & SYNTH_SYNTH5_SLOPE_IP_MASK) >> SYNTH_SYNTH5_SLOPE_IP_LSB) -#define SYNTH_SYNTH5_SLOPE_IP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_SLOPE_IP_LSB) & SYNTH_SYNTH5_SLOPE_IP_MASK) -#define SYNTH_SYNTH5_SLOPE_IP_RESET 3'h0 -#define SYNTH_SYNTH5_CPBIAS_MSB 24 -#define SYNTH_SYNTH5_CPBIAS_LSB 23 -#define SYNTH_SYNTH5_CPBIAS_MASK 'h01800000 -#define SYNTH_SYNTH5_CPBIAS_GET(x) (((x) & SYNTH_SYNTH5_CPBIAS_MASK) >> SYNTH_SYNTH5_CPBIAS_LSB) -#define SYNTH_SYNTH5_CPBIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CPBIAS_LSB) & SYNTH_SYNTH5_CPBIAS_MASK) -#define SYNTH_SYNTH5_CPBIAS_RESET 2'h1 -#define SYNTH_SYNTH5_CPSTEERING_EN_MSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_LSB 22 -#define SYNTH_SYNTH5_CPSTEERING_EN_MASK 'h00400000 -#define SYNTH_SYNTH5_CPSTEERING_EN_GET(x) (((x) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) >> SYNTH_SYNTH5_CPSTEERING_EN_LSB) -#define SYNTH_SYNTH5_CPSTEERING_EN_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CPSTEERING_EN_LSB) & SYNTH_SYNTH5_CPSTEERING_EN_MASK) -#define SYNTH_SYNTH5_CPSTEERING_EN_RESET 1'h0 -#define SYNTH_SYNTH5_CPLOWLK_MSB 21 -#define SYNTH_SYNTH5_CPLOWLK_LSB 21 -#define SYNTH_SYNTH5_CPLOWLK_MASK 'h00200000 -#define SYNTH_SYNTH5_CPLOWLK_GET(x) (((x) & SYNTH_SYNTH5_CPLOWLK_MASK) >> SYNTH_SYNTH5_CPLOWLK_LSB) -#define SYNTH_SYNTH5_CPLOWLK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CPLOWLK_LSB) & SYNTH_SYNTH5_CPLOWLK_MASK) -#define SYNTH_SYNTH5_CPLOWLK_RESET 1'h0 -#define SYNTH_SYNTH5_LOOPLEAKCUR_MSB 20 -#define SYNTH_SYNTH5_LOOPLEAKCUR_LSB 17 -#define SYNTH_SYNTH5_LOOPLEAKCUR_MASK 'h001e0000 -#define SYNTH_SYNTH5_LOOPLEAKCUR_GET(x) (((x) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) >> SYNTH_SYNTH5_LOOPLEAKCUR_LSB) -#define SYNTH_SYNTH5_LOOPLEAKCUR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_LOOPLEAKCUR_LSB) & SYNTH_SYNTH5_LOOPLEAKCUR_MASK) -#define SYNTH_SYNTH5_LOOPLEAKCUR_RESET 4'h0 -#define SYNTH_SYNTH5_CAPRANGE1_MSB 16 -#define SYNTH_SYNTH5_CAPRANGE1_LSB 13 -#define SYNTH_SYNTH5_CAPRANGE1_MASK 'h0001e000 -#define SYNTH_SYNTH5_CAPRANGE1_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE1_MASK) >> SYNTH_SYNTH5_CAPRANGE1_LSB) -#define SYNTH_SYNTH5_CAPRANGE1_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CAPRANGE1_LSB) & SYNTH_SYNTH5_CAPRANGE1_MASK) -#define SYNTH_SYNTH5_CAPRANGE1_RESET 4'h4 -#define SYNTH_SYNTH5_CAPRANGE2_MSB 12 -#define SYNTH_SYNTH5_CAPRANGE2_LSB 9 -#define SYNTH_SYNTH5_CAPRANGE2_MASK 'h00001e00 -#define SYNTH_SYNTH5_CAPRANGE2_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE2_MASK) >> SYNTH_SYNTH5_CAPRANGE2_LSB) -#define SYNTH_SYNTH5_CAPRANGE2_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CAPRANGE2_LSB) & SYNTH_SYNTH5_CAPRANGE2_MASK) -#define SYNTH_SYNTH5_CAPRANGE2_RESET 4'h8 -#define SYNTH_SYNTH5_CAPRANGE3_MSB 8 -#define SYNTH_SYNTH5_CAPRANGE3_LSB 5 -#define SYNTH_SYNTH5_CAPRANGE3_MASK 'h000001e0 -#define SYNTH_SYNTH5_CAPRANGE3_GET(x) (((x) & SYNTH_SYNTH5_CAPRANGE3_MASK) >> SYNTH_SYNTH5_CAPRANGE3_LSB) -#define SYNTH_SYNTH5_CAPRANGE3_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_CAPRANGE3_LSB) & SYNTH_SYNTH5_CAPRANGE3_MASK) -#define SYNTH_SYNTH5_CAPRANGE3_RESET 4'hc -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB 4 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK 'h00000010 -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_LSB) & SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_RESET 1'h0 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MSB 3 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB 2 -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK 'h0000000c -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_GET(x) (((x) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) >> SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_LOBUF5GTUNE_OVR_LSB) & SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK) -#define SYNTH_SYNTH5_LOBUF5GTUNE_OVR_RESET 2'h2 -#define SYNTH_SYNTH5_SPARE_MSB 1 -#define SYNTH_SYNTH5_SPARE_LSB 0 -#define SYNTH_SYNTH5_SPARE_MASK 'h00000003 -#define SYNTH_SYNTH5_SPARE_GET(x) (((x) & SYNTH_SYNTH5_SPARE_MASK) >> SYNTH_SYNTH5_SPARE_LSB) -#define SYNTH_SYNTH5_SPARE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH5_SPARE_LSB) & SYNTH_SYNTH5_SPARE_MASK) -#define SYNTH_SYNTH5_SPARE_RESET 2'h0 -#define SYNTH_SYNTH5_RESET (32'h0 | \ - SYNTH_SYNTH5_LOOP_IP0_SET(SYNTH_SYNTH5_LOOP_IP0_RESET) | \ - SYNTH_SYNTH5_SLOPE_IP_SET(SYNTH_SYNTH5_SLOPE_IP_RESET) | \ - SYNTH_SYNTH5_CPBIAS_SET(SYNTH_SYNTH5_CPBIAS_RESET) | \ - SYNTH_SYNTH5_CPSTEERING_EN_SET(SYNTH_SYNTH5_CPSTEERING_EN_RESET) | \ - SYNTH_SYNTH5_CPLOWLK_SET(SYNTH_SYNTH5_CPLOWLK_RESET) | \ - SYNTH_SYNTH5_LOOPLEAKCUR_SET(SYNTH_SYNTH5_LOOPLEAKCUR_RESET) | \ - SYNTH_SYNTH5_CAPRANGE1_SET(SYNTH_SYNTH5_CAPRANGE1_RESET) | \ - SYNTH_SYNTH5_CAPRANGE2_SET(SYNTH_SYNTH5_CAPRANGE2_RESET) | \ - SYNTH_SYNTH5_CAPRANGE3_SET(SYNTH_SYNTH5_CAPRANGE3_RESET) | \ - SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_SET(SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_RESET) | \ - SYNTH_SYNTH5_LOBUF5GTUNE_OVR_SET(SYNTH_SYNTH5_LOBUF5GTUNE_OVR_RESET) | \ - SYNTH_SYNTH5_SPARE_SET(SYNTH_SYNTH5_SPARE_RESET)) -#define SYNTH_SYNTH5_HW_MASK (32'h0) -#define SYNTH_SYNTH5_SW_MASK (32'h0 | \ - SYNTH_SYNTH5_LOOP_IP0_MASK | \ - SYNTH_SYNTH5_SLOPE_IP_MASK | \ - SYNTH_SYNTH5_CPBIAS_MASK | \ - SYNTH_SYNTH5_CPSTEERING_EN_MASK | \ - SYNTH_SYNTH5_CPLOWLK_MASK | \ - SYNTH_SYNTH5_LOOPLEAKCUR_MASK | \ - SYNTH_SYNTH5_CAPRANGE1_MASK | \ - SYNTH_SYNTH5_CAPRANGE2_MASK | \ - SYNTH_SYNTH5_CAPRANGE3_MASK | \ - SYNTH_SYNTH5_FORCE_LOBUF5GTUNE_MASK | \ - SYNTH_SYNTH5_LOBUF5GTUNE_OVR_MASK | \ - SYNTH_SYNTH5_SPARE_MASK) - -#define SYNTH_SYNTH6_ADDRESS 'h00000014 -#define SYNTH_SYNTH6_IRCP_MSB 31 -#define SYNTH_SYNTH6_IRCP_LSB 29 -#define SYNTH_SYNTH6_IRCP_MASK 'he0000000 -#define SYNTH_SYNTH6_IRCP_GET(x) (((x) & SYNTH_SYNTH6_IRCP_MASK) >> SYNTH_SYNTH6_IRCP_LSB) -#define SYNTH_SYNTH6_IRCP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_IRCP_LSB) & SYNTH_SYNTH6_IRCP_MASK) -#define SYNTH_SYNTH6_IRCP_RESET 3'h4 -#define SYNTH_SYNTH6_IRVCMON_MSB 28 -#define SYNTH_SYNTH6_IRVCMON_LSB 26 -#define SYNTH_SYNTH6_IRVCMON_MASK 'h1c000000 -#define SYNTH_SYNTH6_IRVCMON_GET(x) (((x) & SYNTH_SYNTH6_IRVCMON_MASK) >> SYNTH_SYNTH6_IRVCMON_LSB) -#define SYNTH_SYNTH6_IRVCMON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_IRVCMON_LSB) & SYNTH_SYNTH6_IRVCMON_MASK) -#define SYNTH_SYNTH6_IRVCMON_RESET 3'h4 -#define SYNTH_SYNTH6_IRSPARE_MSB 25 -#define SYNTH_SYNTH6_IRSPARE_LSB 23 -#define SYNTH_SYNTH6_IRSPARE_MASK 'h03800000 -#define SYNTH_SYNTH6_IRSPARE_GET(x) (((x) & SYNTH_SYNTH6_IRSPARE_MASK) >> SYNTH_SYNTH6_IRSPARE_LSB) -#define SYNTH_SYNTH6_IRSPARE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_IRSPARE_LSB) & SYNTH_SYNTH6_IRSPARE_MASK) -#define SYNTH_SYNTH6_IRSPARE_RESET 3'h4 -#define SYNTH_SYNTH6_ICPRESC_MSB 22 -#define SYNTH_SYNTH6_ICPRESC_LSB 20 -#define SYNTH_SYNTH6_ICPRESC_MASK 'h00700000 -#define SYNTH_SYNTH6_ICPRESC_GET(x) (((x) & SYNTH_SYNTH6_ICPRESC_MASK) >> SYNTH_SYNTH6_ICPRESC_LSB) -#define SYNTH_SYNTH6_ICPRESC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICPRESC_LSB) & SYNTH_SYNTH6_ICPRESC_MASK) -#define SYNTH_SYNTH6_ICPRESC_RESET 3'h4 -#define SYNTH_SYNTH6_ICLODIV_MSB 19 -#define SYNTH_SYNTH6_ICLODIV_LSB 17 -#define SYNTH_SYNTH6_ICLODIV_MASK 'h000e0000 -#define SYNTH_SYNTH6_ICLODIV_GET(x) (((x) & SYNTH_SYNTH6_ICLODIV_MASK) >> SYNTH_SYNTH6_ICLODIV_LSB) -#define SYNTH_SYNTH6_ICLODIV_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICLODIV_LSB) & SYNTH_SYNTH6_ICLODIV_MASK) -#define SYNTH_SYNTH6_ICLODIV_RESET 3'h4 -#define SYNTH_SYNTH6_ICLOMIX_MSB 16 -#define SYNTH_SYNTH6_ICLOMIX_LSB 14 -#define SYNTH_SYNTH6_ICLOMIX_MASK 'h0001c000 -#define SYNTH_SYNTH6_ICLOMIX_GET(x) (((x) & SYNTH_SYNTH6_ICLOMIX_MASK) >> SYNTH_SYNTH6_ICLOMIX_LSB) -#define SYNTH_SYNTH6_ICLOMIX_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICLOMIX_LSB) & SYNTH_SYNTH6_ICLOMIX_MASK) -#define SYNTH_SYNTH6_ICLOMIX_RESET 3'h4 -#define SYNTH_SYNTH6_ICSPAREA_MSB 13 -#define SYNTH_SYNTH6_ICSPAREA_LSB 11 -#define SYNTH_SYNTH6_ICSPAREA_MASK 'h00003800 -#define SYNTH_SYNTH6_ICSPAREA_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREA_MASK) >> SYNTH_SYNTH6_ICSPAREA_LSB) -#define SYNTH_SYNTH6_ICSPAREA_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICSPAREA_LSB) & SYNTH_SYNTH6_ICSPAREA_MASK) -#define SYNTH_SYNTH6_ICSPAREA_RESET 3'h4 -#define SYNTH_SYNTH6_ICSPAREB_MSB 10 -#define SYNTH_SYNTH6_ICSPAREB_LSB 8 -#define SYNTH_SYNTH6_ICSPAREB_MASK 'h00000700 -#define SYNTH_SYNTH6_ICSPAREB_GET(x) (((x) & SYNTH_SYNTH6_ICSPAREB_MASK) >> SYNTH_SYNTH6_ICSPAREB_LSB) -#define SYNTH_SYNTH6_ICSPAREB_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICSPAREB_LSB) & SYNTH_SYNTH6_ICSPAREB_MASK) -#define SYNTH_SYNTH6_ICSPAREB_RESET 3'h4 -#define SYNTH_SYNTH6_ICVCO_MSB 7 -#define SYNTH_SYNTH6_ICVCO_LSB 5 -#define SYNTH_SYNTH6_ICVCO_MASK 'h000000e0 -#define SYNTH_SYNTH6_ICVCO_GET(x) (((x) & SYNTH_SYNTH6_ICVCO_MASK) >> SYNTH_SYNTH6_ICVCO_LSB) -#define SYNTH_SYNTH6_ICVCO_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_ICVCO_LSB) & SYNTH_SYNTH6_ICVCO_MASK) -#define SYNTH_SYNTH6_ICVCO_RESET 3'h4 -#define SYNTH_SYNTH6_VCOBUFBIAS_MSB 4 -#define SYNTH_SYNTH6_VCOBUFBIAS_LSB 3 -#define SYNTH_SYNTH6_VCOBUFBIAS_MASK 'h00000018 -#define SYNTH_SYNTH6_VCOBUFBIAS_GET(x) (((x) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) >> SYNTH_SYNTH6_VCOBUFBIAS_LSB) -#define SYNTH_SYNTH6_VCOBUFBIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_VCOBUFBIAS_LSB) & SYNTH_SYNTH6_VCOBUFBIAS_MASK) -#define SYNTH_SYNTH6_VCOBUFBIAS_RESET 2'h2 -#define SYNTH_SYNTH6_SPARE_BIAS_MSB 2 -#define SYNTH_SYNTH6_SPARE_BIAS_LSB 0 -#define SYNTH_SYNTH6_SPARE_BIAS_MASK 'h00000007 -#define SYNTH_SYNTH6_SPARE_BIAS_GET(x) (((x) & SYNTH_SYNTH6_SPARE_BIAS_MASK) >> SYNTH_SYNTH6_SPARE_BIAS_LSB) -#define SYNTH_SYNTH6_SPARE_BIAS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH6_SPARE_BIAS_LSB) & SYNTH_SYNTH6_SPARE_BIAS_MASK) -#define SYNTH_SYNTH6_SPARE_BIAS_RESET 3'h0 -#define SYNTH_SYNTH6_RESET (32'h0 | \ - SYNTH_SYNTH6_IRCP_SET(SYNTH_SYNTH6_IRCP_RESET) | \ - SYNTH_SYNTH6_IRVCMON_SET(SYNTH_SYNTH6_IRVCMON_RESET) | \ - SYNTH_SYNTH6_IRSPARE_SET(SYNTH_SYNTH6_IRSPARE_RESET) | \ - SYNTH_SYNTH6_ICPRESC_SET(SYNTH_SYNTH6_ICPRESC_RESET) | \ - SYNTH_SYNTH6_ICLODIV_SET(SYNTH_SYNTH6_ICLODIV_RESET) | \ - SYNTH_SYNTH6_ICLOMIX_SET(SYNTH_SYNTH6_ICLOMIX_RESET) | \ - SYNTH_SYNTH6_ICSPAREA_SET(SYNTH_SYNTH6_ICSPAREA_RESET) | \ - SYNTH_SYNTH6_ICSPAREB_SET(SYNTH_SYNTH6_ICSPAREB_RESET) | \ - SYNTH_SYNTH6_ICVCO_SET(SYNTH_SYNTH6_ICVCO_RESET) | \ - SYNTH_SYNTH6_VCOBUFBIAS_SET(SYNTH_SYNTH6_VCOBUFBIAS_RESET) | \ - SYNTH_SYNTH6_SPARE_BIAS_SET(SYNTH_SYNTH6_SPARE_BIAS_RESET)) -#define SYNTH_SYNTH6_HW_MASK (32'h0) -#define SYNTH_SYNTH6_SW_MASK (32'h0 | \ - SYNTH_SYNTH6_IRCP_MASK | \ - SYNTH_SYNTH6_IRVCMON_MASK | \ - SYNTH_SYNTH6_IRSPARE_MASK | \ - SYNTH_SYNTH6_ICPRESC_MASK | \ - SYNTH_SYNTH6_ICLODIV_MASK | \ - SYNTH_SYNTH6_ICLOMIX_MASK | \ - SYNTH_SYNTH6_ICSPAREA_MASK | \ - SYNTH_SYNTH6_ICSPAREB_MASK | \ - SYNTH_SYNTH6_ICVCO_MASK | \ - SYNTH_SYNTH6_VCOBUFBIAS_MASK | \ - SYNTH_SYNTH6_SPARE_BIAS_MASK) - -#define SYNTH_SYNTH7_ADDRESS 'h00000018 -#define SYNTH_SYNTH7_SYNTH_ON_MSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_LSB 31 -#define SYNTH_SYNTH7_SYNTH_ON_MASK 'h80000000 -#define SYNTH_SYNTH7_SYNTH_ON_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_ON_MASK) >> SYNTH_SYNTH7_SYNTH_ON_LSB) -#define SYNTH_SYNTH7_SYNTH_ON_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SYNTH_ON_LSB) & SYNTH_SYNTH7_SYNTH_ON_MASK) -#define SYNTH_SYNTH7_SYNTH_ON_RESET 1'h0 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MSB 30 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_LSB 27 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_MASK 'h78000000 -#define SYNTH_SYNTH7_SYNTH_SM_STATE_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) >> SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SYNTH_SM_STATE_LSB) & SYNTH_SYNTH7_SYNTH_SM_STATE_MASK) -#define SYNTH_SYNTH7_SYNTH_SM_STATE_RESET 4'h0 -#define SYNTH_SYNTH7_CAP_SEARCH_MSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_LSB 26 -#define SYNTH_SYNTH7_CAP_SEARCH_MASK 'h04000000 -#define SYNTH_SYNTH7_CAP_SEARCH_GET(x) (((x) & SYNTH_SYNTH7_CAP_SEARCH_MASK) >> SYNTH_SYNTH7_CAP_SEARCH_LSB) -#define SYNTH_SYNTH7_CAP_SEARCH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_CAP_SEARCH_LSB) & SYNTH_SYNTH7_CAP_SEARCH_MASK) -#define SYNTH_SYNTH7_CAP_SEARCH_RESET 1'h0 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB 25 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK 'h02000000 -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_GET(x) (((x) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) >> SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_LSB) & SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK) -#define SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_RESET 1'h0 -#define SYNTH_SYNTH7_PIN_VC_MSB 24 -#define SYNTH_SYNTH7_PIN_VC_LSB 24 -#define SYNTH_SYNTH7_PIN_VC_MASK 'h01000000 -#define SYNTH_SYNTH7_PIN_VC_GET(x) (((x) & SYNTH_SYNTH7_PIN_VC_MASK) >> SYNTH_SYNTH7_PIN_VC_LSB) -#define SYNTH_SYNTH7_PIN_VC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_PIN_VC_LSB) & SYNTH_SYNTH7_PIN_VC_MASK) -#define SYNTH_SYNTH7_PIN_VC_RESET 1'h0 -#define SYNTH_SYNTH7_VCO_CAP_ST_MSB 23 -#define SYNTH_SYNTH7_VCO_CAP_ST_LSB 16 -#define SYNTH_SYNTH7_VCO_CAP_ST_MASK 'h00ff0000 -#define SYNTH_SYNTH7_VCO_CAP_ST_GET(x) (((x) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) >> SYNTH_SYNTH7_VCO_CAP_ST_LSB) -#define SYNTH_SYNTH7_VCO_CAP_ST_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_VCO_CAP_ST_LSB) & SYNTH_SYNTH7_VCO_CAP_ST_MASK) -#define SYNTH_SYNTH7_VCO_CAP_ST_RESET 8'h0 -#define SYNTH_SYNTH7_SHORT_R_MSB 15 -#define SYNTH_SYNTH7_SHORT_R_LSB 15 -#define SYNTH_SYNTH7_SHORT_R_MASK 'h00008000 -#define SYNTH_SYNTH7_SHORT_R_GET(x) (((x) & SYNTH_SYNTH7_SHORT_R_MASK) >> SYNTH_SYNTH7_SHORT_R_LSB) -#define SYNTH_SYNTH7_SHORT_R_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SHORT_R_LSB) & SYNTH_SYNTH7_SHORT_R_MASK) -#define SYNTH_SYNTH7_SHORT_R_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_RFD_MSB 14 -#define SYNTH_SYNTH7_RESET_RFD_LSB 14 -#define SYNTH_SYNTH7_RESET_RFD_MASK 'h00004000 -#define SYNTH_SYNTH7_RESET_RFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_RFD_MASK) >> SYNTH_SYNTH7_RESET_RFD_LSB) -#define SYNTH_SYNTH7_RESET_RFD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_RFD_LSB) & SYNTH_SYNTH7_RESET_RFD_MASK) -#define SYNTH_SYNTH7_RESET_RFD_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_PFD_MSB 13 -#define SYNTH_SYNTH7_RESET_PFD_LSB 13 -#define SYNTH_SYNTH7_RESET_PFD_MASK 'h00002000 -#define SYNTH_SYNTH7_RESET_PFD_GET(x) (((x) & SYNTH_SYNTH7_RESET_PFD_MASK) >> SYNTH_SYNTH7_RESET_PFD_LSB) -#define SYNTH_SYNTH7_RESET_PFD_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_PFD_LSB) & SYNTH_SYNTH7_RESET_PFD_MASK) -#define SYNTH_SYNTH7_RESET_PFD_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB 12 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK 'h00001000 -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_GET(x) (((x) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) >> SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_PSCOUNTERS_LSB) & SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK) -#define SYNTH_SYNTH7_RESET_PSCOUNTERS_RESET 1'h0 -#define SYNTH_SYNTH7_RESET_SDM_B_MSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_LSB 11 -#define SYNTH_SYNTH7_RESET_SDM_B_MASK 'h00000800 -#define SYNTH_SYNTH7_RESET_SDM_B_GET(x) (((x) & SYNTH_SYNTH7_RESET_SDM_B_MASK) >> SYNTH_SYNTH7_RESET_SDM_B_LSB) -#define SYNTH_SYNTH7_RESET_SDM_B_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_RESET_SDM_B_LSB) & SYNTH_SYNTH7_RESET_SDM_B_MASK) -#define SYNTH_SYNTH7_RESET_SDM_B_RESET 1'h0 -#define SYNTH_SYNTH7_VC2HIGH_MSB 10 -#define SYNTH_SYNTH7_VC2HIGH_LSB 10 -#define SYNTH_SYNTH7_VC2HIGH_MASK 'h00000400 -#define SYNTH_SYNTH7_VC2HIGH_GET(x) (((x) & SYNTH_SYNTH7_VC2HIGH_MASK) >> SYNTH_SYNTH7_VC2HIGH_LSB) -#define SYNTH_SYNTH7_VC2HIGH_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_VC2HIGH_LSB) & SYNTH_SYNTH7_VC2HIGH_MASK) -#define SYNTH_SYNTH7_VC2HIGH_RESET 1'h0 -#define SYNTH_SYNTH7_VC2LOW_MSB 9 -#define SYNTH_SYNTH7_VC2LOW_LSB 9 -#define SYNTH_SYNTH7_VC2LOW_MASK 'h00000200 -#define SYNTH_SYNTH7_VC2LOW_GET(x) (((x) & SYNTH_SYNTH7_VC2LOW_MASK) >> SYNTH_SYNTH7_VC2LOW_LSB) -#define SYNTH_SYNTH7_VC2LOW_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_VC2LOW_LSB) & SYNTH_SYNTH7_VC2LOW_MASK) -#define SYNTH_SYNTH7_VC2LOW_RESET 1'h0 -#define SYNTH_SYNTH7_LOOP_IP_MSB 8 -#define SYNTH_SYNTH7_LOOP_IP_LSB 5 -#define SYNTH_SYNTH7_LOOP_IP_MASK 'h000001e0 -#define SYNTH_SYNTH7_LOOP_IP_GET(x) (((x) & SYNTH_SYNTH7_LOOP_IP_MASK) >> SYNTH_SYNTH7_LOOP_IP_LSB) -#define SYNTH_SYNTH7_LOOP_IP_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_LOOP_IP_LSB) & SYNTH_SYNTH7_LOOP_IP_MASK) -#define SYNTH_SYNTH7_LOOP_IP_RESET 4'h0 -#define SYNTH_SYNTH7_LOBUF5GTUNE_MSB 4 -#define SYNTH_SYNTH7_LOBUF5GTUNE_LSB 3 -#define SYNTH_SYNTH7_LOBUF5GTUNE_MASK 'h00000018 -#define SYNTH_SYNTH7_LOBUF5GTUNE_GET(x) (((x) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) >> SYNTH_SYNTH7_LOBUF5GTUNE_LSB) -#define SYNTH_SYNTH7_LOBUF5GTUNE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_LOBUF5GTUNE_LSB) & SYNTH_SYNTH7_LOBUF5GTUNE_MASK) -#define SYNTH_SYNTH7_LOBUF5GTUNE_RESET 2'h0 -#define SYNTH_SYNTH7_SPARE_READ_MSB 2 -#define SYNTH_SYNTH7_SPARE_READ_LSB 0 -#define SYNTH_SYNTH7_SPARE_READ_MASK 'h00000007 -#define SYNTH_SYNTH7_SPARE_READ_GET(x) (((x) & SYNTH_SYNTH7_SPARE_READ_MASK) >> SYNTH_SYNTH7_SPARE_READ_LSB) -#define SYNTH_SYNTH7_SPARE_READ_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH7_SPARE_READ_LSB) & SYNTH_SYNTH7_SPARE_READ_MASK) -#define SYNTH_SYNTH7_SPARE_READ_RESET 3'h0 -#define SYNTH_SYNTH7_RESET (32'h0 | \ - SYNTH_SYNTH7_SYNTH_ON_SET(SYNTH_SYNTH7_SYNTH_ON_RESET) | \ - SYNTH_SYNTH7_SYNTH_SM_STATE_SET(SYNTH_SYNTH7_SYNTH_SM_STATE_RESET) | \ - SYNTH_SYNTH7_CAP_SEARCH_SET(SYNTH_SYNTH7_CAP_SEARCH_RESET) | \ - SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_SET(SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_RESET) | \ - SYNTH_SYNTH7_PIN_VC_SET(SYNTH_SYNTH7_PIN_VC_RESET) | \ - SYNTH_SYNTH7_VCO_CAP_ST_SET(SYNTH_SYNTH7_VCO_CAP_ST_RESET) | \ - SYNTH_SYNTH7_SHORT_R_SET(SYNTH_SYNTH7_SHORT_R_RESET) | \ - SYNTH_SYNTH7_RESET_RFD_SET(SYNTH_SYNTH7_RESET_RFD_RESET) | \ - SYNTH_SYNTH7_RESET_PFD_SET(SYNTH_SYNTH7_RESET_PFD_RESET) | \ - SYNTH_SYNTH7_RESET_PSCOUNTERS_SET(SYNTH_SYNTH7_RESET_PSCOUNTERS_RESET) | \ - SYNTH_SYNTH7_RESET_SDM_B_SET(SYNTH_SYNTH7_RESET_SDM_B_RESET) | \ - SYNTH_SYNTH7_VC2HIGH_SET(SYNTH_SYNTH7_VC2HIGH_RESET) | \ - SYNTH_SYNTH7_VC2LOW_SET(SYNTH_SYNTH7_VC2LOW_RESET) | \ - SYNTH_SYNTH7_LOOP_IP_SET(SYNTH_SYNTH7_LOOP_IP_RESET) | \ - SYNTH_SYNTH7_LOBUF5GTUNE_SET(SYNTH_SYNTH7_LOBUF5GTUNE_RESET) | \ - SYNTH_SYNTH7_SPARE_READ_SET(SYNTH_SYNTH7_SPARE_READ_RESET)) -#define SYNTH_SYNTH7_HW_MASK (32'h0 | \ - SYNTH_SYNTH7_SYNTH_ON_MASK | \ - SYNTH_SYNTH7_SYNTH_SM_STATE_MASK | \ - SYNTH_SYNTH7_CAP_SEARCH_MASK | \ - SYNTH_SYNTH7_SYNTH_LOCK_VC_OK_MASK | \ - SYNTH_SYNTH7_PIN_VC_MASK | \ - SYNTH_SYNTH7_VCO_CAP_ST_MASK | \ - SYNTH_SYNTH7_SHORT_R_MASK | \ - SYNTH_SYNTH7_RESET_RFD_MASK | \ - SYNTH_SYNTH7_RESET_PFD_MASK | \ - SYNTH_SYNTH7_RESET_PSCOUNTERS_MASK | \ - SYNTH_SYNTH7_RESET_SDM_B_MASK | \ - SYNTH_SYNTH7_VC2HIGH_MASK | \ - SYNTH_SYNTH7_VC2LOW_MASK | \ - SYNTH_SYNTH7_LOOP_IP_MASK | \ - SYNTH_SYNTH7_LOBUF5GTUNE_MASK | \ - SYNTH_SYNTH7_SPARE_READ_MASK) -#define SYNTH_SYNTH7_SW_MASK (32'h0) - -#define SYNTH_SYNTH8_ADDRESS 'h0000001c -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB 31 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK 'h80000000 -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_GET(x) (((x) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) >> SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_LOADSYNTHCHANNEL_LSB) & SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK) -#define SYNTH_SYNTH8_LOADSYNTHCHANNEL_RESET 1'h0 -#define SYNTH_SYNTH8_FRACMODE_MSB 30 -#define SYNTH_SYNTH8_FRACMODE_LSB 30 -#define SYNTH_SYNTH8_FRACMODE_MASK 'h40000000 -#define SYNTH_SYNTH8_FRACMODE_GET(x) (((x) & SYNTH_SYNTH8_FRACMODE_MASK) >> SYNTH_SYNTH8_FRACMODE_LSB) -#define SYNTH_SYNTH8_FRACMODE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_FRACMODE_LSB) & SYNTH_SYNTH8_FRACMODE_MASK) -#define SYNTH_SYNTH8_FRACMODE_RESET 1'h0 -#define SYNTH_SYNTH8_AMODEREFSEL_MSB 29 -#define SYNTH_SYNTH8_AMODEREFSEL_LSB 28 -#define SYNTH_SYNTH8_AMODEREFSEL_MASK 'h30000000 -#define SYNTH_SYNTH8_AMODEREFSEL_GET(x) (((x) & SYNTH_SYNTH8_AMODEREFSEL_MASK) >> SYNTH_SYNTH8_AMODEREFSEL_LSB) -#define SYNTH_SYNTH8_AMODEREFSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_AMODEREFSEL_LSB) & SYNTH_SYNTH8_AMODEREFSEL_MASK) -#define SYNTH_SYNTH8_AMODEREFSEL_RESET 2'h0 -#define SYNTH_SYNTH8_SPARE_MSB 27 -#define SYNTH_SYNTH8_SPARE_LSB 27 -#define SYNTH_SYNTH8_SPARE_MASK 'h08000000 -#define SYNTH_SYNTH8_SPARE_GET(x) (((x) & SYNTH_SYNTH8_SPARE_MASK) >> SYNTH_SYNTH8_SPARE_LSB) -#define SYNTH_SYNTH8_SPARE_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_SPARE_LSB) & SYNTH_SYNTH8_SPARE_MASK) -#define SYNTH_SYNTH8_SPARE_RESET 1'h0 -#define SYNTH_SYNTH8_CHANSEL_MSB 26 -#define SYNTH_SYNTH8_CHANSEL_LSB 18 -#define SYNTH_SYNTH8_CHANSEL_MASK 'h07fc0000 -#define SYNTH_SYNTH8_CHANSEL_GET(x) (((x) & SYNTH_SYNTH8_CHANSEL_MASK) >> SYNTH_SYNTH8_CHANSEL_LSB) -#define SYNTH_SYNTH8_CHANSEL_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_CHANSEL_LSB) & SYNTH_SYNTH8_CHANSEL_MASK) -#define SYNTH_SYNTH8_CHANSEL_RESET 9'h0 -#define SYNTH_SYNTH8_CHANFRAC_MSB 17 -#define SYNTH_SYNTH8_CHANFRAC_LSB 1 -#define SYNTH_SYNTH8_CHANFRAC_MASK 'h0003fffe -#define SYNTH_SYNTH8_CHANFRAC_GET(x) (((x) & SYNTH_SYNTH8_CHANFRAC_MASK) >> SYNTH_SYNTH8_CHANFRAC_LSB) -#define SYNTH_SYNTH8_CHANFRAC_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_CHANFRAC_LSB) & SYNTH_SYNTH8_CHANFRAC_MASK) -#define SYNTH_SYNTH8_CHANFRAC_RESET 17'h0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_MSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_LSB 0 -#define SYNTH_SYNTH8_FORCE_FRACLSB_MASK 'h00000001 -#define SYNTH_SYNTH8_FORCE_FRACLSB_GET(x) (((x) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) >> SYNTH_SYNTH8_FORCE_FRACLSB_LSB) -#define SYNTH_SYNTH8_FORCE_FRACLSB_SET(x) (((32'd0 | (x)) << SYNTH_SYNTH8_FORCE_FRACLSB_LSB) & SYNTH_SYNTH8_FORCE_FRACLSB_MASK) -#define SYNTH_SYNTH8_FORCE_FRACLSB_RESET 1'h0 -#define SYNTH_SYNTH8_RESET (32'h0 | \ - SYNTH_SYNTH8_LOADSYNTHCHANNEL_SET(SYNTH_SYNTH8_LOADSYNTHCHANNEL_RESET) | \ - SYNTH_SYNTH8_FRACMODE_SET(SYNTH_SYNTH8_FRACMODE_RESET) | \ - SYNTH_SYNTH8_AMODEREFSEL_SET(SYNTH_SYNTH8_AMODEREFSEL_RESET) | \ - SYNTH_SYNTH8_SPARE_SET(SYNTH_SYNTH8_SPARE_RESET) | \ - SYNTH_SYNTH8_CHANSEL_SET(SYNTH_SYNTH8_CHANSEL_RESET) | \ - SYNTH_SYNTH8_CHANFRAC_SET(SYNTH_SYNTH8_CHANFRAC_RESET) | \ - SYNTH_SYNTH8_FORCE_FRACLSB_SET(SYNTH_SYNTH8_FORCE_FRACLSB_RESET)) -#define SYNTH_SYNTH8_HW_MASK (32'h0 | \ - SYNTH_SYNTH8_FRACMODE_MASK | \ - SYNTH_SYNTH8_AMODEREFSEL_MASK | \ - SYNTH_SYNTH8_SPARE_MASK | \ - SYNTH_SYNTH8_CHANSEL_MASK | \ - SYNTH_SYNTH8_CHANFRAC_MASK) -#define SYNTH_SYNTH8_SW_MASK (32'h0 | \ - SYNTH_SYNTH8_LOADSYNTHCHANNEL_MASK | \ - SYNTH_SYNTH8_FRACMODE_MASK | \ - SYNTH_SYNTH8_AMODEREFSEL_MASK | \ - SYNTH_SYNTH8_SPARE_MASK | \ - SYNTH_SYNTH8_CHANSEL_MASK | \ - SYNTH_SYNTH8_CHANFRAC_MASK | \ - SYNTH_SYNTH8_FORCE_FRACLSB_MASK) - -#define SYNTH_REG_ADDRESS_MSB 4 - -#endif /* _SYNTH_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/top_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/top_reg.h deleted file mode 100644 index 14ed9bfdcb6d..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/top_reg.h +++ /dev/null @@ -1,235 +0,0 @@ -#ifndef _TOP_REG_REG_H_ -#define _TOP_REG_REG_H_ - -#define TOP_GAIN_ADDRESS 0x00000000 -#define TOP_GAIN_OFFSET 0x00000000 -#define TOP_GAIN_TX6DBLOQGAIN_MSB 31 -#define TOP_GAIN_TX6DBLOQGAIN_LSB 30 -#define TOP_GAIN_TX6DBLOQGAIN_MASK 0xc0000000 -#define TOP_GAIN_TX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX6DBLOQGAIN_MASK) >> TOP_GAIN_TX6DBLOQGAIN_LSB) -#define TOP_GAIN_TX6DBLOQGAIN_SET(x) (((x) << TOP_GAIN_TX6DBLOQGAIN_LSB) & TOP_GAIN_TX6DBLOQGAIN_MASK) -#define TOP_GAIN_TX1DBLOQGAIN_MSB 29 -#define TOP_GAIN_TX1DBLOQGAIN_LSB 27 -#define TOP_GAIN_TX1DBLOQGAIN_MASK 0x38000000 -#define TOP_GAIN_TX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX1DBLOQGAIN_MASK) >> TOP_GAIN_TX1DBLOQGAIN_LSB) -#define TOP_GAIN_TX1DBLOQGAIN_SET(x) (((x) << TOP_GAIN_TX1DBLOQGAIN_LSB) & TOP_GAIN_TX1DBLOQGAIN_MASK) -#define TOP_GAIN_TXV2IGAIN_MSB 26 -#define TOP_GAIN_TXV2IGAIN_LSB 25 -#define TOP_GAIN_TXV2IGAIN_MASK 0x06000000 -#define TOP_GAIN_TXV2IGAIN_GET(x) (((x) & TOP_GAIN_TXV2IGAIN_MASK) >> TOP_GAIN_TXV2IGAIN_LSB) -#define TOP_GAIN_TXV2IGAIN_SET(x) (((x) << TOP_GAIN_TXV2IGAIN_LSB) & TOP_GAIN_TXV2IGAIN_MASK) -#define TOP_GAIN_PABUF5GN_MSB 24 -#define TOP_GAIN_PABUF5GN_LSB 24 -#define TOP_GAIN_PABUF5GN_MASK 0x01000000 -#define TOP_GAIN_PABUF5GN_GET(x) (((x) & TOP_GAIN_PABUF5GN_MASK) >> TOP_GAIN_PABUF5GN_LSB) -#define TOP_GAIN_PABUF5GN_SET(x) (((x) << TOP_GAIN_PABUF5GN_LSB) & TOP_GAIN_PABUF5GN_MASK) -#define TOP_GAIN_PADRVGN_MSB 23 -#define TOP_GAIN_PADRVGN_LSB 21 -#define TOP_GAIN_PADRVGN_MASK 0x00e00000 -#define TOP_GAIN_PADRVGN_GET(x) (((x) & TOP_GAIN_PADRVGN_MASK) >> TOP_GAIN_PADRVGN_LSB) -#define TOP_GAIN_PADRVGN_SET(x) (((x) << TOP_GAIN_PADRVGN_LSB) & TOP_GAIN_PADRVGN_MASK) -#define TOP_GAIN_PAOUT2GN_MSB 20 -#define TOP_GAIN_PAOUT2GN_LSB 18 -#define TOP_GAIN_PAOUT2GN_MASK 0x001c0000 -#define TOP_GAIN_PAOUT2GN_GET(x) (((x) & TOP_GAIN_PAOUT2GN_MASK) >> TOP_GAIN_PAOUT2GN_LSB) -#define TOP_GAIN_PAOUT2GN_SET(x) (((x) << TOP_GAIN_PAOUT2GN_LSB) & TOP_GAIN_PAOUT2GN_MASK) -#define TOP_GAIN_LNAON_MSB 17 -#define TOP_GAIN_LNAON_LSB 17 -#define TOP_GAIN_LNAON_MASK 0x00020000 -#define TOP_GAIN_LNAON_GET(x) (((x) & TOP_GAIN_LNAON_MASK) >> TOP_GAIN_LNAON_LSB) -#define TOP_GAIN_LNAON_SET(x) (((x) << TOP_GAIN_LNAON_LSB) & TOP_GAIN_LNAON_MASK) -#define TOP_GAIN_LNAGAIN_MSB 16 -#define TOP_GAIN_LNAGAIN_LSB 13 -#define TOP_GAIN_LNAGAIN_MASK 0x0001e000 -#define TOP_GAIN_LNAGAIN_GET(x) (((x) & TOP_GAIN_LNAGAIN_MASK) >> TOP_GAIN_LNAGAIN_LSB) -#define TOP_GAIN_LNAGAIN_SET(x) (((x) << TOP_GAIN_LNAGAIN_LSB) & TOP_GAIN_LNAGAIN_MASK) -#define TOP_GAIN_RFVGA5GAIN_MSB 12 -#define TOP_GAIN_RFVGA5GAIN_LSB 11 -#define TOP_GAIN_RFVGA5GAIN_MASK 0x00001800 -#define TOP_GAIN_RFVGA5GAIN_GET(x) (((x) & TOP_GAIN_RFVGA5GAIN_MASK) >> TOP_GAIN_RFVGA5GAIN_LSB) -#define TOP_GAIN_RFVGA5GAIN_SET(x) (((x) << TOP_GAIN_RFVGA5GAIN_LSB) & TOP_GAIN_RFVGA5GAIN_MASK) -#define TOP_GAIN_RFGMGN_MSB 10 -#define TOP_GAIN_RFGMGN_LSB 8 -#define TOP_GAIN_RFGMGN_MASK 0x00000700 -#define TOP_GAIN_RFGMGN_GET(x) (((x) & TOP_GAIN_RFGMGN_MASK) >> TOP_GAIN_RFGMGN_LSB) -#define TOP_GAIN_RFGMGN_SET(x) (((x) << TOP_GAIN_RFGMGN_LSB) & TOP_GAIN_RFGMGN_MASK) -#define TOP_GAIN_RX6DBLOQGAIN_MSB 7 -#define TOP_GAIN_RX6DBLOQGAIN_LSB 6 -#define TOP_GAIN_RX6DBLOQGAIN_MASK 0x000000c0 -#define TOP_GAIN_RX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBLOQGAIN_MASK) >> TOP_GAIN_RX6DBLOQGAIN_LSB) -#define TOP_GAIN_RX6DBLOQGAIN_SET(x) (((x) << TOP_GAIN_RX6DBLOQGAIN_LSB) & TOP_GAIN_RX6DBLOQGAIN_MASK) -#define TOP_GAIN_RX1DBLOQGAIN_MSB 5 -#define TOP_GAIN_RX1DBLOQGAIN_LSB 3 -#define TOP_GAIN_RX1DBLOQGAIN_MASK 0x00000038 -#define TOP_GAIN_RX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX1DBLOQGAIN_MASK) >> TOP_GAIN_RX1DBLOQGAIN_LSB) -#define TOP_GAIN_RX1DBLOQGAIN_SET(x) (((x) << TOP_GAIN_RX1DBLOQGAIN_LSB) & TOP_GAIN_RX1DBLOQGAIN_MASK) -#define TOP_GAIN_RX6DBHIQGAIN_MSB 2 -#define TOP_GAIN_RX6DBHIQGAIN_LSB 1 -#define TOP_GAIN_RX6DBHIQGAIN_MASK 0x00000006 -#define TOP_GAIN_RX6DBHIQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBHIQGAIN_MASK) >> TOP_GAIN_RX6DBHIQGAIN_LSB) -#define TOP_GAIN_RX6DBHIQGAIN_SET(x) (((x) << TOP_GAIN_RX6DBHIQGAIN_LSB) & TOP_GAIN_RX6DBHIQGAIN_MASK) -#define TOP_GAIN_SPARE_MSB 0 -#define TOP_GAIN_SPARE_LSB 0 -#define TOP_GAIN_SPARE_MASK 0x00000001 -#define TOP_GAIN_SPARE_GET(x) (((x) & TOP_GAIN_SPARE_MASK) >> TOP_GAIN_SPARE_LSB) -#define TOP_GAIN_SPARE_SET(x) (((x) << TOP_GAIN_SPARE_LSB) & TOP_GAIN_SPARE_MASK) - -#define TOP_TOP_ADDRESS 0x00000004 -#define TOP_TOP_OFFSET 0x00000004 -#define TOP_TOP_LOCALTXGAIN_MSB 31 -#define TOP_TOP_LOCALTXGAIN_LSB 31 -#define TOP_TOP_LOCALTXGAIN_MASK 0x80000000 -#define TOP_TOP_LOCALTXGAIN_GET(x) (((x) & TOP_TOP_LOCALTXGAIN_MASK) >> TOP_TOP_LOCALTXGAIN_LSB) -#define TOP_TOP_LOCALTXGAIN_SET(x) (((x) << TOP_TOP_LOCALTXGAIN_LSB) & TOP_TOP_LOCALTXGAIN_MASK) -#define TOP_TOP_LOCALRXGAIN_MSB 30 -#define TOP_TOP_LOCALRXGAIN_LSB 30 -#define TOP_TOP_LOCALRXGAIN_MASK 0x40000000 -#define TOP_TOP_LOCALRXGAIN_GET(x) (((x) & TOP_TOP_LOCALRXGAIN_MASK) >> TOP_TOP_LOCALRXGAIN_LSB) -#define TOP_TOP_LOCALRXGAIN_SET(x) (((x) << TOP_TOP_LOCALRXGAIN_LSB) & TOP_TOP_LOCALRXGAIN_MASK) -#define TOP_TOP_LOCALMODE_MSB 29 -#define TOP_TOP_LOCALMODE_LSB 29 -#define TOP_TOP_LOCALMODE_MASK 0x20000000 -#define TOP_TOP_LOCALMODE_GET(x) (((x) & TOP_TOP_LOCALMODE_MASK) >> TOP_TOP_LOCALMODE_LSB) -#define TOP_TOP_LOCALMODE_SET(x) (((x) << TOP_TOP_LOCALMODE_LSB) & TOP_TOP_LOCALMODE_MASK) -#define TOP_TOP_CALFC_MSB 28 -#define TOP_TOP_CALFC_LSB 28 -#define TOP_TOP_CALFC_MASK 0x10000000 -#define TOP_TOP_CALFC_GET(x) (((x) & TOP_TOP_CALFC_MASK) >> TOP_TOP_CALFC_LSB) -#define TOP_TOP_CALFC_SET(x) (((x) << TOP_TOP_CALFC_LSB) & TOP_TOP_CALFC_MASK) -#define TOP_TOP_CALDC_MSB 27 -#define TOP_TOP_CALDC_LSB 27 -#define TOP_TOP_CALDC_MASK 0x08000000 -#define TOP_TOP_CALDC_GET(x) (((x) & TOP_TOP_CALDC_MASK) >> TOP_TOP_CALDC_LSB) -#define TOP_TOP_CALDC_SET(x) (((x) << TOP_TOP_CALDC_LSB) & TOP_TOP_CALDC_MASK) -#define TOP_TOP_CAL_RESIDUE_MSB 26 -#define TOP_TOP_CAL_RESIDUE_LSB 26 -#define TOP_TOP_CAL_RESIDUE_MASK 0x04000000 -#define TOP_TOP_CAL_RESIDUE_GET(x) (((x) & TOP_TOP_CAL_RESIDUE_MASK) >> TOP_TOP_CAL_RESIDUE_LSB) -#define TOP_TOP_CAL_RESIDUE_SET(x) (((x) << TOP_TOP_CAL_RESIDUE_LSB) & TOP_TOP_CAL_RESIDUE_MASK) -#define TOP_TOP_BMODE_MSB 25 -#define TOP_TOP_BMODE_LSB 25 -#define TOP_TOP_BMODE_MASK 0x02000000 -#define TOP_TOP_BMODE_GET(x) (((x) & TOP_TOP_BMODE_MASK) >> TOP_TOP_BMODE_LSB) -#define TOP_TOP_BMODE_SET(x) (((x) << TOP_TOP_BMODE_LSB) & TOP_TOP_BMODE_MASK) -#define TOP_TOP_SYNTHON_MSB 24 -#define TOP_TOP_SYNTHON_LSB 24 -#define TOP_TOP_SYNTHON_MASK 0x01000000 -#define TOP_TOP_SYNTHON_GET(x) (((x) & TOP_TOP_SYNTHON_MASK) >> TOP_TOP_SYNTHON_LSB) -#define TOP_TOP_SYNTHON_SET(x) (((x) << TOP_TOP_SYNTHON_LSB) & TOP_TOP_SYNTHON_MASK) -#define TOP_TOP_RXON_MSB 23 -#define TOP_TOP_RXON_LSB 23 -#define TOP_TOP_RXON_MASK 0x00800000 -#define TOP_TOP_RXON_GET(x) (((x) & TOP_TOP_RXON_MASK) >> TOP_TOP_RXON_LSB) -#define TOP_TOP_RXON_SET(x) (((x) << TOP_TOP_RXON_LSB) & TOP_TOP_RXON_MASK) -#define TOP_TOP_TXON_MSB 22 -#define TOP_TOP_TXON_LSB 22 -#define TOP_TOP_TXON_MASK 0x00400000 -#define TOP_TOP_TXON_GET(x) (((x) & TOP_TOP_TXON_MASK) >> TOP_TOP_TXON_LSB) -#define TOP_TOP_TXON_SET(x) (((x) << TOP_TOP_TXON_LSB) & TOP_TOP_TXON_MASK) -#define TOP_TOP_PAON_MSB 21 -#define TOP_TOP_PAON_LSB 21 -#define TOP_TOP_PAON_MASK 0x00200000 -#define TOP_TOP_PAON_GET(x) (((x) & TOP_TOP_PAON_MASK) >> TOP_TOP_PAON_LSB) -#define TOP_TOP_PAON_SET(x) (((x) << TOP_TOP_PAON_LSB) & TOP_TOP_PAON_MASK) -#define TOP_TOP_CALTX_MSB 20 -#define TOP_TOP_CALTX_LSB 20 -#define TOP_TOP_CALTX_MASK 0x00100000 -#define TOP_TOP_CALTX_GET(x) (((x) & TOP_TOP_CALTX_MASK) >> TOP_TOP_CALTX_LSB) -#define TOP_TOP_CALTX_SET(x) (((x) << TOP_TOP_CALTX_LSB) & TOP_TOP_CALTX_MASK) -#define TOP_TOP_LOCALADDAC_MSB 19 -#define TOP_TOP_LOCALADDAC_LSB 19 -#define TOP_TOP_LOCALADDAC_MASK 0x00080000 -#define TOP_TOP_LOCALADDAC_GET(x) (((x) & TOP_TOP_LOCALADDAC_MASK) >> TOP_TOP_LOCALADDAC_LSB) -#define TOP_TOP_LOCALADDAC_SET(x) (((x) << TOP_TOP_LOCALADDAC_LSB) & TOP_TOP_LOCALADDAC_MASK) -#define TOP_TOP_PWDPLL_MSB 18 -#define TOP_TOP_PWDPLL_LSB 18 -#define TOP_TOP_PWDPLL_MASK 0x00040000 -#define TOP_TOP_PWDPLL_GET(x) (((x) & TOP_TOP_PWDPLL_MASK) >> TOP_TOP_PWDPLL_LSB) -#define TOP_TOP_PWDPLL_SET(x) (((x) << TOP_TOP_PWDPLL_LSB) & TOP_TOP_PWDPLL_MASK) -#define TOP_TOP_PWDADC_MSB 17 -#define TOP_TOP_PWDADC_LSB 17 -#define TOP_TOP_PWDADC_MASK 0x00020000 -#define TOP_TOP_PWDADC_GET(x) (((x) & TOP_TOP_PWDADC_MASK) >> TOP_TOP_PWDADC_LSB) -#define TOP_TOP_PWDADC_SET(x) (((x) << TOP_TOP_PWDADC_LSB) & TOP_TOP_PWDADC_MASK) -#define TOP_TOP_PWDDAC_MSB 16 -#define TOP_TOP_PWDDAC_LSB 16 -#define TOP_TOP_PWDDAC_MASK 0x00010000 -#define TOP_TOP_PWDDAC_GET(x) (((x) & TOP_TOP_PWDDAC_MASK) >> TOP_TOP_PWDDAC_LSB) -#define TOP_TOP_PWDDAC_SET(x) (((x) << TOP_TOP_PWDDAC_LSB) & TOP_TOP_PWDDAC_MASK) -#define TOP_TOP_LOCALXTAL_MSB 15 -#define TOP_TOP_LOCALXTAL_LSB 15 -#define TOP_TOP_LOCALXTAL_MASK 0x00008000 -#define TOP_TOP_LOCALXTAL_GET(x) (((x) & TOP_TOP_LOCALXTAL_MASK) >> TOP_TOP_LOCALXTAL_LSB) -#define TOP_TOP_LOCALXTAL_SET(x) (((x) << TOP_TOP_LOCALXTAL_LSB) & TOP_TOP_LOCALXTAL_MASK) -#define TOP_TOP_PWDCLKIN_MSB 14 -#define TOP_TOP_PWDCLKIN_LSB 14 -#define TOP_TOP_PWDCLKIN_MASK 0x00004000 -#define TOP_TOP_PWDCLKIN_GET(x) (((x) & TOP_TOP_PWDCLKIN_MASK) >> TOP_TOP_PWDCLKIN_LSB) -#define TOP_TOP_PWDCLKIN_SET(x) (((x) << TOP_TOP_PWDCLKIN_LSB) & TOP_TOP_PWDCLKIN_MASK) -#define TOP_TOP_OSCON_MSB 13 -#define TOP_TOP_OSCON_LSB 13 -#define TOP_TOP_OSCON_MASK 0x00002000 -#define TOP_TOP_OSCON_GET(x) (((x) & TOP_TOP_OSCON_MASK) >> TOP_TOP_OSCON_LSB) -#define TOP_TOP_OSCON_SET(x) (((x) << TOP_TOP_OSCON_LSB) & TOP_TOP_OSCON_MASK) -#define TOP_TOP_SCLKEN_FORCE_MSB 12 -#define TOP_TOP_SCLKEN_FORCE_LSB 12 -#define TOP_TOP_SCLKEN_FORCE_MASK 0x00001000 -#define TOP_TOP_SCLKEN_FORCE_GET(x) (((x) & TOP_TOP_SCLKEN_FORCE_MASK) >> TOP_TOP_SCLKEN_FORCE_LSB) -#define TOP_TOP_SCLKEN_FORCE_SET(x) (((x) << TOP_TOP_SCLKEN_FORCE_LSB) & TOP_TOP_SCLKEN_FORCE_MASK) -#define TOP_TOP_SYNTHON_FORCE_MSB 11 -#define TOP_TOP_SYNTHON_FORCE_LSB 11 -#define TOP_TOP_SYNTHON_FORCE_MASK 0x00000800 -#define TOP_TOP_SYNTHON_FORCE_GET(x) (((x) & TOP_TOP_SYNTHON_FORCE_MASK) >> TOP_TOP_SYNTHON_FORCE_LSB) -#define TOP_TOP_SYNTHON_FORCE_SET(x) (((x) << TOP_TOP_SYNTHON_FORCE_LSB) & TOP_TOP_SYNTHON_FORCE_MASK) -#define TOP_TOP_PDBIAS_MSB 10 -#define TOP_TOP_PDBIAS_LSB 10 -#define TOP_TOP_PDBIAS_MASK 0x00000400 -#define TOP_TOP_PDBIAS_GET(x) (((x) & TOP_TOP_PDBIAS_MASK) >> TOP_TOP_PDBIAS_LSB) -#define TOP_TOP_PDBIAS_SET(x) (((x) << TOP_TOP_PDBIAS_LSB) & TOP_TOP_PDBIAS_MASK) -#define TOP_TOP_DATAOUTSEL_MSB 9 -#define TOP_TOP_DATAOUTSEL_LSB 8 -#define TOP_TOP_DATAOUTSEL_MASK 0x00000300 -#define TOP_TOP_DATAOUTSEL_GET(x) (((x) & TOP_TOP_DATAOUTSEL_MASK) >> TOP_TOP_DATAOUTSEL_LSB) -#define TOP_TOP_DATAOUTSEL_SET(x) (((x) << TOP_TOP_DATAOUTSEL_LSB) & TOP_TOP_DATAOUTSEL_MASK) -#define TOP_TOP_REVID_MSB 7 -#define TOP_TOP_REVID_LSB 5 -#define TOP_TOP_REVID_MASK 0x000000e0 -#define TOP_TOP_REVID_GET(x) (((x) & TOP_TOP_REVID_MASK) >> TOP_TOP_REVID_LSB) -#define TOP_TOP_REVID_SET(x) (((x) << TOP_TOP_REVID_LSB) & TOP_TOP_REVID_MASK) -#define TOP_TOP_INT2PAD_MSB 4 -#define TOP_TOP_INT2PAD_LSB 4 -#define TOP_TOP_INT2PAD_MASK 0x00000010 -#define TOP_TOP_INT2PAD_GET(x) (((x) & TOP_TOP_INT2PAD_MASK) >> TOP_TOP_INT2PAD_LSB) -#define TOP_TOP_INT2PAD_SET(x) (((x) << TOP_TOP_INT2PAD_LSB) & TOP_TOP_INT2PAD_MASK) -#define TOP_TOP_INTH2PAD_MSB 3 -#define TOP_TOP_INTH2PAD_LSB 3 -#define TOP_TOP_INTH2PAD_MASK 0x00000008 -#define TOP_TOP_INTH2PAD_GET(x) (((x) & TOP_TOP_INTH2PAD_MASK) >> TOP_TOP_INTH2PAD_LSB) -#define TOP_TOP_INTH2PAD_SET(x) (((x) << TOP_TOP_INTH2PAD_LSB) & TOP_TOP_INTH2PAD_MASK) -#define TOP_TOP_PAD2GND_MSB 2 -#define TOP_TOP_PAD2GND_LSB 2 -#define TOP_TOP_PAD2GND_MASK 0x00000004 -#define TOP_TOP_PAD2GND_GET(x) (((x) & TOP_TOP_PAD2GND_MASK) >> TOP_TOP_PAD2GND_LSB) -#define TOP_TOP_PAD2GND_SET(x) (((x) << TOP_TOP_PAD2GND_LSB) & TOP_TOP_PAD2GND_MASK) -#define TOP_TOP_INT2GND_MSB 1 -#define TOP_TOP_INT2GND_LSB 1 -#define TOP_TOP_INT2GND_MASK 0x00000002 -#define TOP_TOP_INT2GND_GET(x) (((x) & TOP_TOP_INT2GND_MASK) >> TOP_TOP_INT2GND_LSB) -#define TOP_TOP_INT2GND_SET(x) (((x) << TOP_TOP_INT2GND_LSB) & TOP_TOP_INT2GND_MASK) -#define TOP_TOP_FORCE_XPAON_MSB 0 -#define TOP_TOP_FORCE_XPAON_LSB 0 -#define TOP_TOP_FORCE_XPAON_MASK 0x00000001 -#define TOP_TOP_FORCE_XPAON_GET(x) (((x) & TOP_TOP_FORCE_XPAON_MASK) >> TOP_TOP_FORCE_XPAON_LSB) -#define TOP_TOP_FORCE_XPAON_SET(x) (((x) << TOP_TOP_FORCE_XPAON_LSB) & TOP_TOP_FORCE_XPAON_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct top_reg_reg_s { - volatile unsigned int top_gain; - volatile unsigned int top_top; -} top_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _TOP_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/top_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/top_reg.vrh deleted file mode 100644 index 8641cc058ea1..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/top_reg.vrh +++ /dev/null @@ -1,388 +0,0 @@ -#ifndef _TOP_REG_VRH_ -#define _TOP_REG_VRH_ - -#define TOP_GAIN_ADDRESS 'h00000000 -#define TOP_GAIN_TX6DBLOQGAIN_MSB 31 -#define TOP_GAIN_TX6DBLOQGAIN_LSB 30 -#define TOP_GAIN_TX6DBLOQGAIN_MASK 'hc0000000 -#define TOP_GAIN_TX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX6DBLOQGAIN_MASK) >> TOP_GAIN_TX6DBLOQGAIN_LSB) -#define TOP_GAIN_TX6DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_TX6DBLOQGAIN_LSB) & TOP_GAIN_TX6DBLOQGAIN_MASK) -#define TOP_GAIN_TX6DBLOQGAIN_RESET 2'h3 -#define TOP_GAIN_TX1DBLOQGAIN_MSB 29 -#define TOP_GAIN_TX1DBLOQGAIN_LSB 27 -#define TOP_GAIN_TX1DBLOQGAIN_MASK 'h38000000 -#define TOP_GAIN_TX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_TX1DBLOQGAIN_MASK) >> TOP_GAIN_TX1DBLOQGAIN_LSB) -#define TOP_GAIN_TX1DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_TX1DBLOQGAIN_LSB) & TOP_GAIN_TX1DBLOQGAIN_MASK) -#define TOP_GAIN_TX1DBLOQGAIN_RESET 3'h6 -#define TOP_GAIN_TXV2IGAIN_MSB 26 -#define TOP_GAIN_TXV2IGAIN_LSB 25 -#define TOP_GAIN_TXV2IGAIN_MASK 'h06000000 -#define TOP_GAIN_TXV2IGAIN_GET(x) (((x) & TOP_GAIN_TXV2IGAIN_MASK) >> TOP_GAIN_TXV2IGAIN_LSB) -#define TOP_GAIN_TXV2IGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_TXV2IGAIN_LSB) & TOP_GAIN_TXV2IGAIN_MASK) -#define TOP_GAIN_TXV2IGAIN_RESET 2'h3 -#define TOP_GAIN_PABUF5GN_MSB 24 -#define TOP_GAIN_PABUF5GN_LSB 24 -#define TOP_GAIN_PABUF5GN_MASK 'h01000000 -#define TOP_GAIN_PABUF5GN_GET(x) (((x) & TOP_GAIN_PABUF5GN_MASK) >> TOP_GAIN_PABUF5GN_LSB) -#define TOP_GAIN_PABUF5GN_SET(x) (((32'd0 | (x)) << TOP_GAIN_PABUF5GN_LSB) & TOP_GAIN_PABUF5GN_MASK) -#define TOP_GAIN_PABUF5GN_RESET 1'h1 -#define TOP_GAIN_PADRVGN_MSB 23 -#define TOP_GAIN_PADRVGN_LSB 21 -#define TOP_GAIN_PADRVGN_MASK 'h00e00000 -#define TOP_GAIN_PADRVGN_GET(x) (((x) & TOP_GAIN_PADRVGN_MASK) >> TOP_GAIN_PADRVGN_LSB) -#define TOP_GAIN_PADRVGN_SET(x) (((32'd0 | (x)) << TOP_GAIN_PADRVGN_LSB) & TOP_GAIN_PADRVGN_MASK) -#define TOP_GAIN_PADRVGN_RESET 3'h7 -#define TOP_GAIN_PAOUT2GN_MSB 20 -#define TOP_GAIN_PAOUT2GN_LSB 18 -#define TOP_GAIN_PAOUT2GN_MASK 'h001c0000 -#define TOP_GAIN_PAOUT2GN_GET(x) (((x) & TOP_GAIN_PAOUT2GN_MASK) >> TOP_GAIN_PAOUT2GN_LSB) -#define TOP_GAIN_PAOUT2GN_SET(x) (((32'd0 | (x)) << TOP_GAIN_PAOUT2GN_LSB) & TOP_GAIN_PAOUT2GN_MASK) -#define TOP_GAIN_PAOUT2GN_RESET 3'h7 -#define TOP_GAIN_LNAON_MSB 17 -#define TOP_GAIN_LNAON_LSB 17 -#define TOP_GAIN_LNAON_MASK 'h00020000 -#define TOP_GAIN_LNAON_GET(x) (((x) & TOP_GAIN_LNAON_MASK) >> TOP_GAIN_LNAON_LSB) -#define TOP_GAIN_LNAON_SET(x) (((32'd0 | (x)) << TOP_GAIN_LNAON_LSB) & TOP_GAIN_LNAON_MASK) -#define TOP_GAIN_LNAON_RESET 1'h1 -#define TOP_GAIN_LNAGAIN_MSB 16 -#define TOP_GAIN_LNAGAIN_LSB 13 -#define TOP_GAIN_LNAGAIN_MASK 'h0001e000 -#define TOP_GAIN_LNAGAIN_GET(x) (((x) & TOP_GAIN_LNAGAIN_MASK) >> TOP_GAIN_LNAGAIN_LSB) -#define TOP_GAIN_LNAGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_LNAGAIN_LSB) & TOP_GAIN_LNAGAIN_MASK) -#define TOP_GAIN_LNAGAIN_RESET 4'hf -#define TOP_GAIN_RFVGA5GAIN_MSB 12 -#define TOP_GAIN_RFVGA5GAIN_LSB 11 -#define TOP_GAIN_RFVGA5GAIN_MASK 'h00001800 -#define TOP_GAIN_RFVGA5GAIN_GET(x) (((x) & TOP_GAIN_RFVGA5GAIN_MASK) >> TOP_GAIN_RFVGA5GAIN_LSB) -#define TOP_GAIN_RFVGA5GAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RFVGA5GAIN_LSB) & TOP_GAIN_RFVGA5GAIN_MASK) -#define TOP_GAIN_RFVGA5GAIN_RESET 2'h3 -#define TOP_GAIN_RFGMGN_MSB 10 -#define TOP_GAIN_RFGMGN_LSB 8 -#define TOP_GAIN_RFGMGN_MASK 'h00000700 -#define TOP_GAIN_RFGMGN_GET(x) (((x) & TOP_GAIN_RFGMGN_MASK) >> TOP_GAIN_RFGMGN_LSB) -#define TOP_GAIN_RFGMGN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RFGMGN_LSB) & TOP_GAIN_RFGMGN_MASK) -#define TOP_GAIN_RFGMGN_RESET 3'h7 -#define TOP_GAIN_RX6DBLOQGAIN_MSB 7 -#define TOP_GAIN_RX6DBLOQGAIN_LSB 6 -#define TOP_GAIN_RX6DBLOQGAIN_MASK 'h000000c0 -#define TOP_GAIN_RX6DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBLOQGAIN_MASK) >> TOP_GAIN_RX6DBLOQGAIN_LSB) -#define TOP_GAIN_RX6DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RX6DBLOQGAIN_LSB) & TOP_GAIN_RX6DBLOQGAIN_MASK) -#define TOP_GAIN_RX6DBLOQGAIN_RESET 2'h3 -#define TOP_GAIN_RX1DBLOQGAIN_MSB 5 -#define TOP_GAIN_RX1DBLOQGAIN_LSB 3 -#define TOP_GAIN_RX1DBLOQGAIN_MASK 'h00000038 -#define TOP_GAIN_RX1DBLOQGAIN_GET(x) (((x) & TOP_GAIN_RX1DBLOQGAIN_MASK) >> TOP_GAIN_RX1DBLOQGAIN_LSB) -#define TOP_GAIN_RX1DBLOQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RX1DBLOQGAIN_LSB) & TOP_GAIN_RX1DBLOQGAIN_MASK) -#define TOP_GAIN_RX1DBLOQGAIN_RESET 3'h6 -#define TOP_GAIN_RX6DBHIQGAIN_MSB 2 -#define TOP_GAIN_RX6DBHIQGAIN_LSB 1 -#define TOP_GAIN_RX6DBHIQGAIN_MASK 'h00000006 -#define TOP_GAIN_RX6DBHIQGAIN_GET(x) (((x) & TOP_GAIN_RX6DBHIQGAIN_MASK) >> TOP_GAIN_RX6DBHIQGAIN_LSB) -#define TOP_GAIN_RX6DBHIQGAIN_SET(x) (((32'd0 | (x)) << TOP_GAIN_RX6DBHIQGAIN_LSB) & TOP_GAIN_RX6DBHIQGAIN_MASK) -#define TOP_GAIN_RX6DBHIQGAIN_RESET 2'h3 -#define TOP_GAIN_SPARE_MSB 0 -#define TOP_GAIN_SPARE_LSB 0 -#define TOP_GAIN_SPARE_MASK 'h00000001 -#define TOP_GAIN_SPARE_GET(x) (((x) & TOP_GAIN_SPARE_MASK) >> TOP_GAIN_SPARE_LSB) -#define TOP_GAIN_SPARE_SET(x) (((32'd0 | (x)) << TOP_GAIN_SPARE_LSB) & TOP_GAIN_SPARE_MASK) -#define TOP_GAIN_SPARE_RESET 1'h0 -#define TOP_GAIN_RESET (32'h0 | \ - TOP_GAIN_TX6DBLOQGAIN_SET(TOP_GAIN_TX6DBLOQGAIN_RESET) | \ - TOP_GAIN_TX1DBLOQGAIN_SET(TOP_GAIN_TX1DBLOQGAIN_RESET) | \ - TOP_GAIN_TXV2IGAIN_SET(TOP_GAIN_TXV2IGAIN_RESET) | \ - TOP_GAIN_PABUF5GN_SET(TOP_GAIN_PABUF5GN_RESET) | \ - TOP_GAIN_PADRVGN_SET(TOP_GAIN_PADRVGN_RESET) | \ - TOP_GAIN_PAOUT2GN_SET(TOP_GAIN_PAOUT2GN_RESET) | \ - TOP_GAIN_LNAON_SET(TOP_GAIN_LNAON_RESET) | \ - TOP_GAIN_LNAGAIN_SET(TOP_GAIN_LNAGAIN_RESET) | \ - TOP_GAIN_RFVGA5GAIN_SET(TOP_GAIN_RFVGA5GAIN_RESET) | \ - TOP_GAIN_RFGMGN_SET(TOP_GAIN_RFGMGN_RESET) | \ - TOP_GAIN_RX6DBLOQGAIN_SET(TOP_GAIN_RX6DBLOQGAIN_RESET) | \ - TOP_GAIN_RX1DBLOQGAIN_SET(TOP_GAIN_RX1DBLOQGAIN_RESET) | \ - TOP_GAIN_RX6DBHIQGAIN_SET(TOP_GAIN_RX6DBHIQGAIN_RESET) | \ - TOP_GAIN_SPARE_SET(TOP_GAIN_SPARE_RESET)) -#define TOP_GAIN_HW_MASK (32'h0 | \ - TOP_GAIN_TX6DBLOQGAIN_MASK | \ - TOP_GAIN_TX1DBLOQGAIN_MASK | \ - TOP_GAIN_TXV2IGAIN_MASK | \ - TOP_GAIN_PABUF5GN_MASK | \ - TOP_GAIN_PADRVGN_MASK | \ - TOP_GAIN_PAOUT2GN_MASK | \ - TOP_GAIN_LNAON_MASK | \ - TOP_GAIN_LNAGAIN_MASK | \ - TOP_GAIN_RFVGA5GAIN_MASK | \ - TOP_GAIN_RFGMGN_MASK | \ - TOP_GAIN_RX6DBLOQGAIN_MASK | \ - TOP_GAIN_RX1DBLOQGAIN_MASK | \ - TOP_GAIN_RX6DBHIQGAIN_MASK | \ - TOP_GAIN_SPARE_MASK) -#define TOP_GAIN_SW_MASK (32'h0 | \ - TOP_GAIN_TX6DBLOQGAIN_MASK | \ - TOP_GAIN_TX1DBLOQGAIN_MASK | \ - TOP_GAIN_TXV2IGAIN_MASK | \ - TOP_GAIN_PABUF5GN_MASK | \ - TOP_GAIN_PADRVGN_MASK | \ - TOP_GAIN_PAOUT2GN_MASK | \ - TOP_GAIN_LNAON_MASK | \ - TOP_GAIN_LNAGAIN_MASK | \ - TOP_GAIN_RFVGA5GAIN_MASK | \ - TOP_GAIN_RFGMGN_MASK | \ - TOP_GAIN_RX6DBLOQGAIN_MASK | \ - TOP_GAIN_RX1DBLOQGAIN_MASK | \ - TOP_GAIN_RX6DBHIQGAIN_MASK | \ - TOP_GAIN_SPARE_MASK) - -#define TOP_TOP_ADDRESS 'h00000004 -#define TOP_TOP_LOCALTXGAIN_MSB 31 -#define TOP_TOP_LOCALTXGAIN_LSB 31 -#define TOP_TOP_LOCALTXGAIN_MASK 'h80000000 -#define TOP_TOP_LOCALTXGAIN_GET(x) (((x) & TOP_TOP_LOCALTXGAIN_MASK) >> TOP_TOP_LOCALTXGAIN_LSB) -#define TOP_TOP_LOCALTXGAIN_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALTXGAIN_LSB) & TOP_TOP_LOCALTXGAIN_MASK) -#define TOP_TOP_LOCALTXGAIN_RESET 1'h0 -#define TOP_TOP_LOCALRXGAIN_MSB 30 -#define TOP_TOP_LOCALRXGAIN_LSB 30 -#define TOP_TOP_LOCALRXGAIN_MASK 'h40000000 -#define TOP_TOP_LOCALRXGAIN_GET(x) (((x) & TOP_TOP_LOCALRXGAIN_MASK) >> TOP_TOP_LOCALRXGAIN_LSB) -#define TOP_TOP_LOCALRXGAIN_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALRXGAIN_LSB) & TOP_TOP_LOCALRXGAIN_MASK) -#define TOP_TOP_LOCALRXGAIN_RESET 1'h0 -#define TOP_TOP_LOCALMODE_MSB 29 -#define TOP_TOP_LOCALMODE_LSB 29 -#define TOP_TOP_LOCALMODE_MASK 'h20000000 -#define TOP_TOP_LOCALMODE_GET(x) (((x) & TOP_TOP_LOCALMODE_MASK) >> TOP_TOP_LOCALMODE_LSB) -#define TOP_TOP_LOCALMODE_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALMODE_LSB) & TOP_TOP_LOCALMODE_MASK) -#define TOP_TOP_LOCALMODE_RESET 1'h0 -#define TOP_TOP_CALFC_MSB 28 -#define TOP_TOP_CALFC_LSB 28 -#define TOP_TOP_CALFC_MASK 'h10000000 -#define TOP_TOP_CALFC_GET(x) (((x) & TOP_TOP_CALFC_MASK) >> TOP_TOP_CALFC_LSB) -#define TOP_TOP_CALFC_SET(x) (((32'd0 | (x)) << TOP_TOP_CALFC_LSB) & TOP_TOP_CALFC_MASK) -#define TOP_TOP_CALFC_RESET 1'h0 -#define TOP_TOP_CALDC_MSB 27 -#define TOP_TOP_CALDC_LSB 27 -#define TOP_TOP_CALDC_MASK 'h08000000 -#define TOP_TOP_CALDC_GET(x) (((x) & TOP_TOP_CALDC_MASK) >> TOP_TOP_CALDC_LSB) -#define TOP_TOP_CALDC_SET(x) (((32'd0 | (x)) << TOP_TOP_CALDC_LSB) & TOP_TOP_CALDC_MASK) -#define TOP_TOP_CALDC_RESET 1'h0 -#define TOP_TOP_CAL_RESIDUE_MSB 26 -#define TOP_TOP_CAL_RESIDUE_LSB 26 -#define TOP_TOP_CAL_RESIDUE_MASK 'h04000000 -#define TOP_TOP_CAL_RESIDUE_GET(x) (((x) & TOP_TOP_CAL_RESIDUE_MASK) >> TOP_TOP_CAL_RESIDUE_LSB) -#define TOP_TOP_CAL_RESIDUE_SET(x) (((32'd0 | (x)) << TOP_TOP_CAL_RESIDUE_LSB) & TOP_TOP_CAL_RESIDUE_MASK) -#define TOP_TOP_CAL_RESIDUE_RESET 1'h0 -#define TOP_TOP_BMODE_MSB 25 -#define TOP_TOP_BMODE_LSB 25 -#define TOP_TOP_BMODE_MASK 'h02000000 -#define TOP_TOP_BMODE_GET(x) (((x) & TOP_TOP_BMODE_MASK) >> TOP_TOP_BMODE_LSB) -#define TOP_TOP_BMODE_SET(x) (((32'd0 | (x)) << TOP_TOP_BMODE_LSB) & TOP_TOP_BMODE_MASK) -#define TOP_TOP_BMODE_RESET 1'h1 -#define TOP_TOP_SYNTHON_MSB 24 -#define TOP_TOP_SYNTHON_LSB 24 -#define TOP_TOP_SYNTHON_MASK 'h01000000 -#define TOP_TOP_SYNTHON_GET(x) (((x) & TOP_TOP_SYNTHON_MASK) >> TOP_TOP_SYNTHON_LSB) -#define TOP_TOP_SYNTHON_SET(x) (((32'd0 | (x)) << TOP_TOP_SYNTHON_LSB) & TOP_TOP_SYNTHON_MASK) -#define TOP_TOP_SYNTHON_RESET 1'h0 -#define TOP_TOP_RXON_MSB 23 -#define TOP_TOP_RXON_LSB 23 -#define TOP_TOP_RXON_MASK 'h00800000 -#define TOP_TOP_RXON_GET(x) (((x) & TOP_TOP_RXON_MASK) >> TOP_TOP_RXON_LSB) -#define TOP_TOP_RXON_SET(x) (((32'd0 | (x)) << TOP_TOP_RXON_LSB) & TOP_TOP_RXON_MASK) -#define TOP_TOP_RXON_RESET 1'h0 -#define TOP_TOP_TXON_MSB 22 -#define TOP_TOP_TXON_LSB 22 -#define TOP_TOP_TXON_MASK 'h00400000 -#define TOP_TOP_TXON_GET(x) (((x) & TOP_TOP_TXON_MASK) >> TOP_TOP_TXON_LSB) -#define TOP_TOP_TXON_SET(x) (((32'd0 | (x)) << TOP_TOP_TXON_LSB) & TOP_TOP_TXON_MASK) -#define TOP_TOP_TXON_RESET 1'h0 -#define TOP_TOP_PAON_MSB 21 -#define TOP_TOP_PAON_LSB 21 -#define TOP_TOP_PAON_MASK 'h00200000 -#define TOP_TOP_PAON_GET(x) (((x) & TOP_TOP_PAON_MASK) >> TOP_TOP_PAON_LSB) -#define TOP_TOP_PAON_SET(x) (((32'd0 | (x)) << TOP_TOP_PAON_LSB) & TOP_TOP_PAON_MASK) -#define TOP_TOP_PAON_RESET 1'h0 -#define TOP_TOP_CALTX_MSB 20 -#define TOP_TOP_CALTX_LSB 20 -#define TOP_TOP_CALTX_MASK 'h00100000 -#define TOP_TOP_CALTX_GET(x) (((x) & TOP_TOP_CALTX_MASK) >> TOP_TOP_CALTX_LSB) -#define TOP_TOP_CALTX_SET(x) (((32'd0 | (x)) << TOP_TOP_CALTX_LSB) & TOP_TOP_CALTX_MASK) -#define TOP_TOP_CALTX_RESET 1'h0 -#define TOP_TOP_LOCALADDAC_MSB 19 -#define TOP_TOP_LOCALADDAC_LSB 19 -#define TOP_TOP_LOCALADDAC_MASK 'h00080000 -#define TOP_TOP_LOCALADDAC_GET(x) (((x) & TOP_TOP_LOCALADDAC_MASK) >> TOP_TOP_LOCALADDAC_LSB) -#define TOP_TOP_LOCALADDAC_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALADDAC_LSB) & TOP_TOP_LOCALADDAC_MASK) -#define TOP_TOP_LOCALADDAC_RESET 1'h0 -#define TOP_TOP_PWDPLL_MSB 18 -#define TOP_TOP_PWDPLL_LSB 18 -#define TOP_TOP_PWDPLL_MASK 'h00040000 -#define TOP_TOP_PWDPLL_GET(x) (((x) & TOP_TOP_PWDPLL_MASK) >> TOP_TOP_PWDPLL_LSB) -#define TOP_TOP_PWDPLL_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDPLL_LSB) & TOP_TOP_PWDPLL_MASK) -#define TOP_TOP_PWDPLL_RESET 1'h0 -#define TOP_TOP_PWDADC_MSB 17 -#define TOP_TOP_PWDADC_LSB 17 -#define TOP_TOP_PWDADC_MASK 'h00020000 -#define TOP_TOP_PWDADC_GET(x) (((x) & TOP_TOP_PWDADC_MASK) >> TOP_TOP_PWDADC_LSB) -#define TOP_TOP_PWDADC_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDADC_LSB) & TOP_TOP_PWDADC_MASK) -#define TOP_TOP_PWDADC_RESET 1'h0 -#define TOP_TOP_PWDDAC_MSB 16 -#define TOP_TOP_PWDDAC_LSB 16 -#define TOP_TOP_PWDDAC_MASK 'h00010000 -#define TOP_TOP_PWDDAC_GET(x) (((x) & TOP_TOP_PWDDAC_MASK) >> TOP_TOP_PWDDAC_LSB) -#define TOP_TOP_PWDDAC_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDDAC_LSB) & TOP_TOP_PWDDAC_MASK) -#define TOP_TOP_PWDDAC_RESET 1'h0 -#define TOP_TOP_LOCALXTAL_MSB 15 -#define TOP_TOP_LOCALXTAL_LSB 15 -#define TOP_TOP_LOCALXTAL_MASK 'h00008000 -#define TOP_TOP_LOCALXTAL_GET(x) (((x) & TOP_TOP_LOCALXTAL_MASK) >> TOP_TOP_LOCALXTAL_LSB) -#define TOP_TOP_LOCALXTAL_SET(x) (((32'd0 | (x)) << TOP_TOP_LOCALXTAL_LSB) & TOP_TOP_LOCALXTAL_MASK) -#define TOP_TOP_LOCALXTAL_RESET 1'h0 -#define TOP_TOP_PWDCLKIN_MSB 14 -#define TOP_TOP_PWDCLKIN_LSB 14 -#define TOP_TOP_PWDCLKIN_MASK 'h00004000 -#define TOP_TOP_PWDCLKIN_GET(x) (((x) & TOP_TOP_PWDCLKIN_MASK) >> TOP_TOP_PWDCLKIN_LSB) -#define TOP_TOP_PWDCLKIN_SET(x) (((32'd0 | (x)) << TOP_TOP_PWDCLKIN_LSB) & TOP_TOP_PWDCLKIN_MASK) -#define TOP_TOP_PWDCLKIN_RESET 1'h0 -#define TOP_TOP_OSCON_MSB 13 -#define TOP_TOP_OSCON_LSB 13 -#define TOP_TOP_OSCON_MASK 'h00002000 -#define TOP_TOP_OSCON_GET(x) (((x) & TOP_TOP_OSCON_MASK) >> TOP_TOP_OSCON_LSB) -#define TOP_TOP_OSCON_SET(x) (((32'd0 | (x)) << TOP_TOP_OSCON_LSB) & TOP_TOP_OSCON_MASK) -#define TOP_TOP_OSCON_RESET 1'h1 -#define TOP_TOP_SCLKEN_FORCE_MSB 12 -#define TOP_TOP_SCLKEN_FORCE_LSB 12 -#define TOP_TOP_SCLKEN_FORCE_MASK 'h00001000 -#define TOP_TOP_SCLKEN_FORCE_GET(x) (((x) & TOP_TOP_SCLKEN_FORCE_MASK) >> TOP_TOP_SCLKEN_FORCE_LSB) -#define TOP_TOP_SCLKEN_FORCE_SET(x) (((32'd0 | (x)) << TOP_TOP_SCLKEN_FORCE_LSB) & TOP_TOP_SCLKEN_FORCE_MASK) -#define TOP_TOP_SCLKEN_FORCE_RESET 1'h0 -#define TOP_TOP_SYNTHON_FORCE_MSB 11 -#define TOP_TOP_SYNTHON_FORCE_LSB 11 -#define TOP_TOP_SYNTHON_FORCE_MASK 'h00000800 -#define TOP_TOP_SYNTHON_FORCE_GET(x) (((x) & TOP_TOP_SYNTHON_FORCE_MASK) >> TOP_TOP_SYNTHON_FORCE_LSB) -#define TOP_TOP_SYNTHON_FORCE_SET(x) (((32'd0 | (x)) << TOP_TOP_SYNTHON_FORCE_LSB) & TOP_TOP_SYNTHON_FORCE_MASK) -#define TOP_TOP_SYNTHON_FORCE_RESET 1'h0 -#define TOP_TOP_PDBIAS_MSB 10 -#define TOP_TOP_PDBIAS_LSB 10 -#define TOP_TOP_PDBIAS_MASK 'h00000400 -#define TOP_TOP_PDBIAS_GET(x) (((x) & TOP_TOP_PDBIAS_MASK) >> TOP_TOP_PDBIAS_LSB) -#define TOP_TOP_PDBIAS_SET(x) (((32'd0 | (x)) << TOP_TOP_PDBIAS_LSB) & TOP_TOP_PDBIAS_MASK) -#define TOP_TOP_PDBIAS_RESET 1'h0 -#define TOP_TOP_DATAOUTSEL_MSB 9 -#define TOP_TOP_DATAOUTSEL_LSB 8 -#define TOP_TOP_DATAOUTSEL_MASK 'h00000300 -#define TOP_TOP_DATAOUTSEL_GET(x) (((x) & TOP_TOP_DATAOUTSEL_MASK) >> TOP_TOP_DATAOUTSEL_LSB) -#define TOP_TOP_DATAOUTSEL_SET(x) (((32'd0 | (x)) << TOP_TOP_DATAOUTSEL_LSB) & TOP_TOP_DATAOUTSEL_MASK) -#define TOP_TOP_DATAOUTSEL_RESET 2'h3 -#define TOP_TOP_REVID_MSB 7 -#define TOP_TOP_REVID_LSB 5 -#define TOP_TOP_REVID_MASK 'h000000e0 -#define TOP_TOP_REVID_GET(x) (((x) & TOP_TOP_REVID_MASK) >> TOP_TOP_REVID_LSB) -#define TOP_TOP_REVID_SET(x) (((32'd0 | (x)) << TOP_TOP_REVID_LSB) & TOP_TOP_REVID_MASK) -#define TOP_TOP_REVID_RESET 3'h0 -#define TOP_TOP_INT2PAD_MSB 4 -#define TOP_TOP_INT2PAD_LSB 4 -#define TOP_TOP_INT2PAD_MASK 'h00000010 -#define TOP_TOP_INT2PAD_GET(x) (((x) & TOP_TOP_INT2PAD_MASK) >> TOP_TOP_INT2PAD_LSB) -#define TOP_TOP_INT2PAD_SET(x) (((32'd0 | (x)) << TOP_TOP_INT2PAD_LSB) & TOP_TOP_INT2PAD_MASK) -#define TOP_TOP_INT2PAD_RESET 1'h0 -#define TOP_TOP_INTH2PAD_MSB 3 -#define TOP_TOP_INTH2PAD_LSB 3 -#define TOP_TOP_INTH2PAD_MASK 'h00000008 -#define TOP_TOP_INTH2PAD_GET(x) (((x) & TOP_TOP_INTH2PAD_MASK) >> TOP_TOP_INTH2PAD_LSB) -#define TOP_TOP_INTH2PAD_SET(x) (((32'd0 | (x)) << TOP_TOP_INTH2PAD_LSB) & TOP_TOP_INTH2PAD_MASK) -#define TOP_TOP_INTH2PAD_RESET 1'h0 -#define TOP_TOP_PAD2GND_MSB 2 -#define TOP_TOP_PAD2GND_LSB 2 -#define TOP_TOP_PAD2GND_MASK 'h00000004 -#define TOP_TOP_PAD2GND_GET(x) (((x) & TOP_TOP_PAD2GND_MASK) >> TOP_TOP_PAD2GND_LSB) -#define TOP_TOP_PAD2GND_SET(x) (((32'd0 | (x)) << TOP_TOP_PAD2GND_LSB) & TOP_TOP_PAD2GND_MASK) -#define TOP_TOP_PAD2GND_RESET 1'h0 -#define TOP_TOP_INT2GND_MSB 1 -#define TOP_TOP_INT2GND_LSB 1 -#define TOP_TOP_INT2GND_MASK 'h00000002 -#define TOP_TOP_INT2GND_GET(x) (((x) & TOP_TOP_INT2GND_MASK) >> TOP_TOP_INT2GND_LSB) -#define TOP_TOP_INT2GND_SET(x) (((32'd0 | (x)) << TOP_TOP_INT2GND_LSB) & TOP_TOP_INT2GND_MASK) -#define TOP_TOP_INT2GND_RESET 1'h0 -#define TOP_TOP_FORCE_XPAON_MSB 0 -#define TOP_TOP_FORCE_XPAON_LSB 0 -#define TOP_TOP_FORCE_XPAON_MASK 'h00000001 -#define TOP_TOP_FORCE_XPAON_GET(x) (((x) & TOP_TOP_FORCE_XPAON_MASK) >> TOP_TOP_FORCE_XPAON_LSB) -#define TOP_TOP_FORCE_XPAON_SET(x) (((32'd0 | (x)) << TOP_TOP_FORCE_XPAON_LSB) & TOP_TOP_FORCE_XPAON_MASK) -#define TOP_TOP_FORCE_XPAON_RESET 1'h0 -#define TOP_TOP_RESET (32'h0 | \ - TOP_TOP_LOCALTXGAIN_SET(TOP_TOP_LOCALTXGAIN_RESET) | \ - TOP_TOP_LOCALRXGAIN_SET(TOP_TOP_LOCALRXGAIN_RESET) | \ - TOP_TOP_LOCALMODE_SET(TOP_TOP_LOCALMODE_RESET) | \ - TOP_TOP_CALFC_SET(TOP_TOP_CALFC_RESET) | \ - TOP_TOP_CALDC_SET(TOP_TOP_CALDC_RESET) | \ - TOP_TOP_CAL_RESIDUE_SET(TOP_TOP_CAL_RESIDUE_RESET) | \ - TOP_TOP_BMODE_SET(TOP_TOP_BMODE_RESET) | \ - TOP_TOP_SYNTHON_SET(TOP_TOP_SYNTHON_RESET) | \ - TOP_TOP_RXON_SET(TOP_TOP_RXON_RESET) | \ - TOP_TOP_TXON_SET(TOP_TOP_TXON_RESET) | \ - TOP_TOP_PAON_SET(TOP_TOP_PAON_RESET) | \ - TOP_TOP_CALTX_SET(TOP_TOP_CALTX_RESET) | \ - TOP_TOP_LOCALADDAC_SET(TOP_TOP_LOCALADDAC_RESET) | \ - TOP_TOP_PWDPLL_SET(TOP_TOP_PWDPLL_RESET) | \ - TOP_TOP_PWDADC_SET(TOP_TOP_PWDADC_RESET) | \ - TOP_TOP_PWDDAC_SET(TOP_TOP_PWDDAC_RESET) | \ - TOP_TOP_LOCALXTAL_SET(TOP_TOP_LOCALXTAL_RESET) | \ - TOP_TOP_PWDCLKIN_SET(TOP_TOP_PWDCLKIN_RESET) | \ - TOP_TOP_OSCON_SET(TOP_TOP_OSCON_RESET) | \ - TOP_TOP_SCLKEN_FORCE_SET(TOP_TOP_SCLKEN_FORCE_RESET) | \ - TOP_TOP_SYNTHON_FORCE_SET(TOP_TOP_SYNTHON_FORCE_RESET) | \ - TOP_TOP_PDBIAS_SET(TOP_TOP_PDBIAS_RESET) | \ - TOP_TOP_DATAOUTSEL_SET(TOP_TOP_DATAOUTSEL_RESET) | \ - TOP_TOP_REVID_SET(TOP_TOP_REVID_RESET) | \ - TOP_TOP_INT2PAD_SET(TOP_TOP_INT2PAD_RESET) | \ - TOP_TOP_INTH2PAD_SET(TOP_TOP_INTH2PAD_RESET) | \ - TOP_TOP_PAD2GND_SET(TOP_TOP_PAD2GND_RESET) | \ - TOP_TOP_INT2GND_SET(TOP_TOP_INT2GND_RESET) | \ - TOP_TOP_FORCE_XPAON_SET(TOP_TOP_FORCE_XPAON_RESET)) -#define TOP_TOP_HW_MASK (32'h0 | \ - TOP_TOP_CALFC_MASK | \ - TOP_TOP_CALDC_MASK | \ - TOP_TOP_CAL_RESIDUE_MASK | \ - TOP_TOP_BMODE_MASK | \ - TOP_TOP_SYNTHON_MASK | \ - TOP_TOP_RXON_MASK | \ - TOP_TOP_TXON_MASK | \ - TOP_TOP_PAON_MASK | \ - TOP_TOP_CALTX_MASK | \ - TOP_TOP_PWDPLL_MASK | \ - TOP_TOP_PWDADC_MASK | \ - TOP_TOP_PWDDAC_MASK | \ - TOP_TOP_PWDCLKIN_MASK | \ - TOP_TOP_OSCON_MASK | \ - TOP_TOP_REVID_MASK) -#define TOP_TOP_SW_MASK (32'h0 | \ - TOP_TOP_LOCALTXGAIN_MASK | \ - TOP_TOP_LOCALRXGAIN_MASK | \ - TOP_TOP_LOCALMODE_MASK | \ - TOP_TOP_CALFC_MASK | \ - TOP_TOP_CALDC_MASK | \ - TOP_TOP_CAL_RESIDUE_MASK | \ - TOP_TOP_BMODE_MASK | \ - TOP_TOP_SYNTHON_MASK | \ - TOP_TOP_RXON_MASK | \ - TOP_TOP_TXON_MASK | \ - TOP_TOP_PAON_MASK | \ - TOP_TOP_CALTX_MASK | \ - TOP_TOP_LOCALADDAC_MASK | \ - TOP_TOP_PWDPLL_MASK | \ - TOP_TOP_PWDADC_MASK | \ - TOP_TOP_PWDDAC_MASK | \ - TOP_TOP_LOCALXTAL_MASK | \ - TOP_TOP_PWDCLKIN_MASK | \ - TOP_TOP_OSCON_MASK | \ - TOP_TOP_SCLKEN_FORCE_MASK | \ - TOP_TOP_SYNTHON_FORCE_MASK | \ - TOP_TOP_PDBIAS_MASK | \ - TOP_TOP_DATAOUTSEL_MASK | \ - TOP_TOP_INT2PAD_MASK | \ - TOP_TOP_INTH2PAD_MASK | \ - TOP_TOP_PAD2GND_MASK | \ - TOP_TOP_INT2GND_MASK | \ - TOP_TOP_FORCE_XPAON_MASK) - -#define TOP_REG_ADDRESS_MSB 2 - -#endif /* _TOP_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/txpc_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/txpc_reg.h deleted file mode 100644 index ed2b1260464d..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/txpc_reg.h +++ /dev/null @@ -1,170 +0,0 @@ -#ifndef _TXPC_REG_REG_H_ -#define _TXPC_REG_REG_H_ - -#define TXPC_TXPC_ADDRESS 0x00000000 -#define TXPC_TXPC_OFFSET 0x00000000 -#define TXPC_TXPC_SELINTPD_MSB 31 -#define TXPC_TXPC_SELINTPD_LSB 31 -#define TXPC_TXPC_SELINTPD_MASK 0x80000000 -#define TXPC_TXPC_SELINTPD_GET(x) (((x) & TXPC_TXPC_SELINTPD_MASK) >> TXPC_TXPC_SELINTPD_LSB) -#define TXPC_TXPC_SELINTPD_SET(x) (((x) << TXPC_TXPC_SELINTPD_LSB) & TXPC_TXPC_SELINTPD_MASK) -#define TXPC_TXPC_TEST_MSB 30 -#define TXPC_TXPC_TEST_LSB 30 -#define TXPC_TXPC_TEST_MASK 0x40000000 -#define TXPC_TXPC_TEST_GET(x) (((x) & TXPC_TXPC_TEST_MASK) >> TXPC_TXPC_TEST_LSB) -#define TXPC_TXPC_TEST_SET(x) (((x) << TXPC_TXPC_TEST_LSB) & TXPC_TXPC_TEST_MASK) -#define TXPC_TXPC_TESTGAIN_MSB 29 -#define TXPC_TXPC_TESTGAIN_LSB 28 -#define TXPC_TXPC_TESTGAIN_MASK 0x30000000 -#define TXPC_TXPC_TESTGAIN_GET(x) (((x) & TXPC_TXPC_TESTGAIN_MASK) >> TXPC_TXPC_TESTGAIN_LSB) -#define TXPC_TXPC_TESTGAIN_SET(x) (((x) << TXPC_TXPC_TESTGAIN_LSB) & TXPC_TXPC_TESTGAIN_MASK) -#define TXPC_TXPC_TESTDAC_MSB 27 -#define TXPC_TXPC_TESTDAC_LSB 22 -#define TXPC_TXPC_TESTDAC_MASK 0x0fc00000 -#define TXPC_TXPC_TESTDAC_GET(x) (((x) & TXPC_TXPC_TESTDAC_MASK) >> TXPC_TXPC_TESTDAC_LSB) -#define TXPC_TXPC_TESTDAC_SET(x) (((x) << TXPC_TXPC_TESTDAC_LSB) & TXPC_TXPC_TESTDAC_MASK) -#define TXPC_TXPC_TESTPWDPC_MSB 21 -#define TXPC_TXPC_TESTPWDPC_LSB 21 -#define TXPC_TXPC_TESTPWDPC_MASK 0x00200000 -#define TXPC_TXPC_TESTPWDPC_GET(x) (((x) & TXPC_TXPC_TESTPWDPC_MASK) >> TXPC_TXPC_TESTPWDPC_LSB) -#define TXPC_TXPC_TESTPWDPC_SET(x) (((x) << TXPC_TXPC_TESTPWDPC_LSB) & TXPC_TXPC_TESTPWDPC_MASK) -#define TXPC_TXPC_CURHALF_MSB 20 -#define TXPC_TXPC_CURHALF_LSB 20 -#define TXPC_TXPC_CURHALF_MASK 0x00100000 -#define TXPC_TXPC_CURHALF_GET(x) (((x) & TXPC_TXPC_CURHALF_MASK) >> TXPC_TXPC_CURHALF_LSB) -#define TXPC_TXPC_CURHALF_SET(x) (((x) << TXPC_TXPC_CURHALF_LSB) & TXPC_TXPC_CURHALF_MASK) -#define TXPC_TXPC_NEGOUT_MSB 19 -#define TXPC_TXPC_NEGOUT_LSB 19 -#define TXPC_TXPC_NEGOUT_MASK 0x00080000 -#define TXPC_TXPC_NEGOUT_GET(x) (((x) & TXPC_TXPC_NEGOUT_MASK) >> TXPC_TXPC_NEGOUT_LSB) -#define TXPC_TXPC_NEGOUT_SET(x) (((x) << TXPC_TXPC_NEGOUT_LSB) & TXPC_TXPC_NEGOUT_MASK) -#define TXPC_TXPC_CLKDELAY_MSB 18 -#define TXPC_TXPC_CLKDELAY_LSB 18 -#define TXPC_TXPC_CLKDELAY_MASK 0x00040000 -#define TXPC_TXPC_CLKDELAY_GET(x) (((x) & TXPC_TXPC_CLKDELAY_MASK) >> TXPC_TXPC_CLKDELAY_LSB) -#define TXPC_TXPC_CLKDELAY_SET(x) (((x) << TXPC_TXPC_CLKDELAY_LSB) & TXPC_TXPC_CLKDELAY_MASK) -#define TXPC_TXPC_SELMODREF_MSB 17 -#define TXPC_TXPC_SELMODREF_LSB 17 -#define TXPC_TXPC_SELMODREF_MASK 0x00020000 -#define TXPC_TXPC_SELMODREF_GET(x) (((x) & TXPC_TXPC_SELMODREF_MASK) >> TXPC_TXPC_SELMODREF_LSB) -#define TXPC_TXPC_SELMODREF_SET(x) (((x) << TXPC_TXPC_SELMODREF_LSB) & TXPC_TXPC_SELMODREF_MASK) -#define TXPC_TXPC_SELCMOUT_MSB 16 -#define TXPC_TXPC_SELCMOUT_LSB 16 -#define TXPC_TXPC_SELCMOUT_MASK 0x00010000 -#define TXPC_TXPC_SELCMOUT_GET(x) (((x) & TXPC_TXPC_SELCMOUT_MASK) >> TXPC_TXPC_SELCMOUT_LSB) -#define TXPC_TXPC_SELCMOUT_SET(x) (((x) << TXPC_TXPC_SELCMOUT_LSB) & TXPC_TXPC_SELCMOUT_MASK) -#define TXPC_TXPC_TSMODE_MSB 15 -#define TXPC_TXPC_TSMODE_LSB 14 -#define TXPC_TXPC_TSMODE_MASK 0x0000c000 -#define TXPC_TXPC_TSMODE_GET(x) (((x) & TXPC_TXPC_TSMODE_MASK) >> TXPC_TXPC_TSMODE_LSB) -#define TXPC_TXPC_TSMODE_SET(x) (((x) << TXPC_TXPC_TSMODE_LSB) & TXPC_TXPC_TSMODE_MASK) -#define TXPC_TXPC_N_MSB 13 -#define TXPC_TXPC_N_LSB 6 -#define TXPC_TXPC_N_MASK 0x00003fc0 -#define TXPC_TXPC_N_GET(x) (((x) & TXPC_TXPC_N_MASK) >> TXPC_TXPC_N_LSB) -#define TXPC_TXPC_N_SET(x) (((x) << TXPC_TXPC_N_LSB) & TXPC_TXPC_N_MASK) -#define TXPC_TXPC_ON1STSYNTHON_MSB 5 -#define TXPC_TXPC_ON1STSYNTHON_LSB 5 -#define TXPC_TXPC_ON1STSYNTHON_MASK 0x00000020 -#define TXPC_TXPC_ON1STSYNTHON_GET(x) (((x) & TXPC_TXPC_ON1STSYNTHON_MASK) >> TXPC_TXPC_ON1STSYNTHON_LSB) -#define TXPC_TXPC_ON1STSYNTHON_SET(x) (((x) << TXPC_TXPC_ON1STSYNTHON_LSB) & TXPC_TXPC_ON1STSYNTHON_MASK) -#define TXPC_TXPC_SELINIT_MSB 4 -#define TXPC_TXPC_SELINIT_LSB 3 -#define TXPC_TXPC_SELINIT_MASK 0x00000018 -#define TXPC_TXPC_SELINIT_GET(x) (((x) & TXPC_TXPC_SELINIT_MASK) >> TXPC_TXPC_SELINIT_LSB) -#define TXPC_TXPC_SELINIT_SET(x) (((x) << TXPC_TXPC_SELINIT_LSB) & TXPC_TXPC_SELINIT_MASK) -#define TXPC_TXPC_SELCOUNT_MSB 2 -#define TXPC_TXPC_SELCOUNT_LSB 2 -#define TXPC_TXPC_SELCOUNT_MASK 0x00000004 -#define TXPC_TXPC_SELCOUNT_GET(x) (((x) & TXPC_TXPC_SELCOUNT_MASK) >> TXPC_TXPC_SELCOUNT_LSB) -#define TXPC_TXPC_SELCOUNT_SET(x) (((x) << TXPC_TXPC_SELCOUNT_LSB) & TXPC_TXPC_SELCOUNT_MASK) -#define TXPC_TXPC_ATBSEL_MSB 1 -#define TXPC_TXPC_ATBSEL_LSB 0 -#define TXPC_TXPC_ATBSEL_MASK 0x00000003 -#define TXPC_TXPC_ATBSEL_GET(x) (((x) & TXPC_TXPC_ATBSEL_MASK) >> TXPC_TXPC_ATBSEL_LSB) -#define TXPC_TXPC_ATBSEL_SET(x) (((x) << TXPC_TXPC_ATBSEL_LSB) & TXPC_TXPC_ATBSEL_MASK) - -#define TXPC_MISC_ADDRESS 0x00000004 -#define TXPC_MISC_OFFSET 0x00000004 -#define TXPC_MISC_FLIPBMODE_MSB 31 -#define TXPC_MISC_FLIPBMODE_LSB 31 -#define TXPC_MISC_FLIPBMODE_MASK 0x80000000 -#define TXPC_MISC_FLIPBMODE_GET(x) (((x) & TXPC_MISC_FLIPBMODE_MASK) >> TXPC_MISC_FLIPBMODE_LSB) -#define TXPC_MISC_FLIPBMODE_SET(x) (((x) << TXPC_MISC_FLIPBMODE_LSB) & TXPC_MISC_FLIPBMODE_MASK) -#define TXPC_MISC_LEVEL_MSB 30 -#define TXPC_MISC_LEVEL_LSB 29 -#define TXPC_MISC_LEVEL_MASK 0x60000000 -#define TXPC_MISC_LEVEL_GET(x) (((x) & TXPC_MISC_LEVEL_MASK) >> TXPC_MISC_LEVEL_LSB) -#define TXPC_MISC_LEVEL_SET(x) (((x) << TXPC_MISC_LEVEL_LSB) & TXPC_MISC_LEVEL_MASK) -#define TXPC_MISC_LDO_TEST_MODE_MSB 28 -#define TXPC_MISC_LDO_TEST_MODE_LSB 28 -#define TXPC_MISC_LDO_TEST_MODE_MASK 0x10000000 -#define TXPC_MISC_LDO_TEST_MODE_GET(x) (((x) & TXPC_MISC_LDO_TEST_MODE_MASK) >> TXPC_MISC_LDO_TEST_MODE_LSB) -#define TXPC_MISC_LDO_TEST_MODE_SET(x) (((x) << TXPC_MISC_LDO_TEST_MODE_LSB) & TXPC_MISC_LDO_TEST_MODE_MASK) -#define TXPC_MISC_NOTCXODET_MSB 27 -#define TXPC_MISC_NOTCXODET_LSB 27 -#define TXPC_MISC_NOTCXODET_MASK 0x08000000 -#define TXPC_MISC_NOTCXODET_GET(x) (((x) & TXPC_MISC_NOTCXODET_MASK) >> TXPC_MISC_NOTCXODET_LSB) -#define TXPC_MISC_NOTCXODET_SET(x) (((x) << TXPC_MISC_NOTCXODET_LSB) & TXPC_MISC_NOTCXODET_MASK) -#define TXPC_MISC_PWDCLKIND_MSB 26 -#define TXPC_MISC_PWDCLKIND_LSB 26 -#define TXPC_MISC_PWDCLKIND_MASK 0x04000000 -#define TXPC_MISC_PWDCLKIND_GET(x) (((x) & TXPC_MISC_PWDCLKIND_MASK) >> TXPC_MISC_PWDCLKIND_LSB) -#define TXPC_MISC_PWDCLKIND_SET(x) (((x) << TXPC_MISC_PWDCLKIND_LSB) & TXPC_MISC_PWDCLKIND_MASK) -#define TXPC_MISC_PWDXINPAD_MSB 25 -#define TXPC_MISC_PWDXINPAD_LSB 25 -#define TXPC_MISC_PWDXINPAD_MASK 0x02000000 -#define TXPC_MISC_PWDXINPAD_GET(x) (((x) & TXPC_MISC_PWDXINPAD_MASK) >> TXPC_MISC_PWDXINPAD_LSB) -#define TXPC_MISC_PWDXINPAD_SET(x) (((x) << TXPC_MISC_PWDXINPAD_LSB) & TXPC_MISC_PWDXINPAD_MASK) -#define TXPC_MISC_LOCALBIAS_MSB 24 -#define TXPC_MISC_LOCALBIAS_LSB 24 -#define TXPC_MISC_LOCALBIAS_MASK 0x01000000 -#define TXPC_MISC_LOCALBIAS_GET(x) (((x) & TXPC_MISC_LOCALBIAS_MASK) >> TXPC_MISC_LOCALBIAS_LSB) -#define TXPC_MISC_LOCALBIAS_SET(x) (((x) << TXPC_MISC_LOCALBIAS_LSB) & TXPC_MISC_LOCALBIAS_MASK) -#define TXPC_MISC_LOCALBIAS2X_MSB 23 -#define TXPC_MISC_LOCALBIAS2X_LSB 23 -#define TXPC_MISC_LOCALBIAS2X_MASK 0x00800000 -#define TXPC_MISC_LOCALBIAS2X_GET(x) (((x) & TXPC_MISC_LOCALBIAS2X_MASK) >> TXPC_MISC_LOCALBIAS2X_LSB) -#define TXPC_MISC_LOCALBIAS2X_SET(x) (((x) << TXPC_MISC_LOCALBIAS2X_LSB) & TXPC_MISC_LOCALBIAS2X_MASK) -#define TXPC_MISC_SELTSP_MSB 22 -#define TXPC_MISC_SELTSP_LSB 22 -#define TXPC_MISC_SELTSP_MASK 0x00400000 -#define TXPC_MISC_SELTSP_GET(x) (((x) & TXPC_MISC_SELTSP_MASK) >> TXPC_MISC_SELTSP_LSB) -#define TXPC_MISC_SELTSP_SET(x) (((x) << TXPC_MISC_SELTSP_LSB) & TXPC_MISC_SELTSP_MASK) -#define TXPC_MISC_SELTSN_MSB 21 -#define TXPC_MISC_SELTSN_LSB 21 -#define TXPC_MISC_SELTSN_MASK 0x00200000 -#define TXPC_MISC_SELTSN_GET(x) (((x) & TXPC_MISC_SELTSN_MASK) >> TXPC_MISC_SELTSN_LSB) -#define TXPC_MISC_SELTSN_SET(x) (((x) << TXPC_MISC_SELTSN_LSB) & TXPC_MISC_SELTSN_MASK) -#define TXPC_MISC_SPARE_A_MSB 20 -#define TXPC_MISC_SPARE_A_LSB 18 -#define TXPC_MISC_SPARE_A_MASK 0x001c0000 -#define TXPC_MISC_SPARE_A_GET(x) (((x) & TXPC_MISC_SPARE_A_MASK) >> TXPC_MISC_SPARE_A_LSB) -#define TXPC_MISC_SPARE_A_SET(x) (((x) << TXPC_MISC_SPARE_A_LSB) & TXPC_MISC_SPARE_A_MASK) -#define TXPC_MISC_DECOUT_MSB 17 -#define TXPC_MISC_DECOUT_LSB 8 -#define TXPC_MISC_DECOUT_MASK 0x0003ff00 -#define TXPC_MISC_DECOUT_GET(x) (((x) & TXPC_MISC_DECOUT_MASK) >> TXPC_MISC_DECOUT_LSB) -#define TXPC_MISC_DECOUT_SET(x) (((x) << TXPC_MISC_DECOUT_LSB) & TXPC_MISC_DECOUT_MASK) -#define TXPC_MISC_XTALDIV_MSB 7 -#define TXPC_MISC_XTALDIV_LSB 6 -#define TXPC_MISC_XTALDIV_MASK 0x000000c0 -#define TXPC_MISC_XTALDIV_GET(x) (((x) & TXPC_MISC_XTALDIV_MASK) >> TXPC_MISC_XTALDIV_LSB) -#define TXPC_MISC_XTALDIV_SET(x) (((x) << TXPC_MISC_XTALDIV_LSB) & TXPC_MISC_XTALDIV_MASK) -#define TXPC_MISC_SPARE_MSB 5 -#define TXPC_MISC_SPARE_LSB 0 -#define TXPC_MISC_SPARE_MASK 0x0000003f -#define TXPC_MISC_SPARE_GET(x) (((x) & TXPC_MISC_SPARE_MASK) >> TXPC_MISC_SPARE_LSB) -#define TXPC_MISC_SPARE_SET(x) (((x) << TXPC_MISC_SPARE_LSB) & TXPC_MISC_SPARE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct txpc_reg_reg_s { - volatile unsigned int txpc_txpc; - volatile unsigned int txpc_misc; -} txpc_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _TXPC_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/txpc_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/txpc_reg.vrh deleted file mode 100644 index 0b5423f0805a..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/txpc_reg.vrh +++ /dev/null @@ -1,257 +0,0 @@ -#ifndef _TXPC_REG_VRH_ -#define _TXPC_REG_VRH_ - -#define TXPC_TXPC_ADDRESS 'h00000000 -#define TXPC_TXPC_SELINTPD_MSB 31 -#define TXPC_TXPC_SELINTPD_LSB 31 -#define TXPC_TXPC_SELINTPD_MASK 'h80000000 -#define TXPC_TXPC_SELINTPD_GET(x) (((x) & TXPC_TXPC_SELINTPD_MASK) >> TXPC_TXPC_SELINTPD_LSB) -#define TXPC_TXPC_SELINTPD_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELINTPD_LSB) & TXPC_TXPC_SELINTPD_MASK) -#define TXPC_TXPC_SELINTPD_RESET 1'h0 -#define TXPC_TXPC_TEST_MSB 30 -#define TXPC_TXPC_TEST_LSB 30 -#define TXPC_TXPC_TEST_MASK 'h40000000 -#define TXPC_TXPC_TEST_GET(x) (((x) & TXPC_TXPC_TEST_MASK) >> TXPC_TXPC_TEST_LSB) -#define TXPC_TXPC_TEST_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TEST_LSB) & TXPC_TXPC_TEST_MASK) -#define TXPC_TXPC_TEST_RESET 1'h0 -#define TXPC_TXPC_TESTGAIN_MSB 29 -#define TXPC_TXPC_TESTGAIN_LSB 28 -#define TXPC_TXPC_TESTGAIN_MASK 'h30000000 -#define TXPC_TXPC_TESTGAIN_GET(x) (((x) & TXPC_TXPC_TESTGAIN_MASK) >> TXPC_TXPC_TESTGAIN_LSB) -#define TXPC_TXPC_TESTGAIN_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TESTGAIN_LSB) & TXPC_TXPC_TESTGAIN_MASK) -#define TXPC_TXPC_TESTGAIN_RESET 2'h0 -#define TXPC_TXPC_TESTDAC_MSB 27 -#define TXPC_TXPC_TESTDAC_LSB 22 -#define TXPC_TXPC_TESTDAC_MASK 'h0fc00000 -#define TXPC_TXPC_TESTDAC_GET(x) (((x) & TXPC_TXPC_TESTDAC_MASK) >> TXPC_TXPC_TESTDAC_LSB) -#define TXPC_TXPC_TESTDAC_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TESTDAC_LSB) & TXPC_TXPC_TESTDAC_MASK) -#define TXPC_TXPC_TESTDAC_RESET 6'h20 -#define TXPC_TXPC_TESTPWDPC_MSB 21 -#define TXPC_TXPC_TESTPWDPC_LSB 21 -#define TXPC_TXPC_TESTPWDPC_MASK 'h00200000 -#define TXPC_TXPC_TESTPWDPC_GET(x) (((x) & TXPC_TXPC_TESTPWDPC_MASK) >> TXPC_TXPC_TESTPWDPC_LSB) -#define TXPC_TXPC_TESTPWDPC_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TESTPWDPC_LSB) & TXPC_TXPC_TESTPWDPC_MASK) -#define TXPC_TXPC_TESTPWDPC_RESET 1'h0 -#define TXPC_TXPC_CURHALF_MSB 20 -#define TXPC_TXPC_CURHALF_LSB 20 -#define TXPC_TXPC_CURHALF_MASK 'h00100000 -#define TXPC_TXPC_CURHALF_GET(x) (((x) & TXPC_TXPC_CURHALF_MASK) >> TXPC_TXPC_CURHALF_LSB) -#define TXPC_TXPC_CURHALF_SET(x) (((32'd0 | (x)) << TXPC_TXPC_CURHALF_LSB) & TXPC_TXPC_CURHALF_MASK) -#define TXPC_TXPC_CURHALF_RESET 1'h1 -#define TXPC_TXPC_NEGOUT_MSB 19 -#define TXPC_TXPC_NEGOUT_LSB 19 -#define TXPC_TXPC_NEGOUT_MASK 'h00080000 -#define TXPC_TXPC_NEGOUT_GET(x) (((x) & TXPC_TXPC_NEGOUT_MASK) >> TXPC_TXPC_NEGOUT_LSB) -#define TXPC_TXPC_NEGOUT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_NEGOUT_LSB) & TXPC_TXPC_NEGOUT_MASK) -#define TXPC_TXPC_NEGOUT_RESET 1'h0 -#define TXPC_TXPC_CLKDELAY_MSB 18 -#define TXPC_TXPC_CLKDELAY_LSB 18 -#define TXPC_TXPC_CLKDELAY_MASK 'h00040000 -#define TXPC_TXPC_CLKDELAY_GET(x) (((x) & TXPC_TXPC_CLKDELAY_MASK) >> TXPC_TXPC_CLKDELAY_LSB) -#define TXPC_TXPC_CLKDELAY_SET(x) (((32'd0 | (x)) << TXPC_TXPC_CLKDELAY_LSB) & TXPC_TXPC_CLKDELAY_MASK) -#define TXPC_TXPC_CLKDELAY_RESET 1'h0 -#define TXPC_TXPC_SELMODREF_MSB 17 -#define TXPC_TXPC_SELMODREF_LSB 17 -#define TXPC_TXPC_SELMODREF_MASK 'h00020000 -#define TXPC_TXPC_SELMODREF_GET(x) (((x) & TXPC_TXPC_SELMODREF_MASK) >> TXPC_TXPC_SELMODREF_LSB) -#define TXPC_TXPC_SELMODREF_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELMODREF_LSB) & TXPC_TXPC_SELMODREF_MASK) -#define TXPC_TXPC_SELMODREF_RESET 1'h0 -#define TXPC_TXPC_SELCMOUT_MSB 16 -#define TXPC_TXPC_SELCMOUT_LSB 16 -#define TXPC_TXPC_SELCMOUT_MASK 'h00010000 -#define TXPC_TXPC_SELCMOUT_GET(x) (((x) & TXPC_TXPC_SELCMOUT_MASK) >> TXPC_TXPC_SELCMOUT_LSB) -#define TXPC_TXPC_SELCMOUT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELCMOUT_LSB) & TXPC_TXPC_SELCMOUT_MASK) -#define TXPC_TXPC_SELCMOUT_RESET 1'h0 -#define TXPC_TXPC_TSMODE_MSB 15 -#define TXPC_TXPC_TSMODE_LSB 14 -#define TXPC_TXPC_TSMODE_MASK 'h0000c000 -#define TXPC_TXPC_TSMODE_GET(x) (((x) & TXPC_TXPC_TSMODE_MASK) >> TXPC_TXPC_TSMODE_LSB) -#define TXPC_TXPC_TSMODE_SET(x) (((32'd0 | (x)) << TXPC_TXPC_TSMODE_LSB) & TXPC_TXPC_TSMODE_MASK) -#define TXPC_TXPC_TSMODE_RESET 2'h0 -#define TXPC_TXPC_N_MSB 13 -#define TXPC_TXPC_N_LSB 6 -#define TXPC_TXPC_N_MASK 'h00003fc0 -#define TXPC_TXPC_N_GET(x) (((x) & TXPC_TXPC_N_MASK) >> TXPC_TXPC_N_LSB) -#define TXPC_TXPC_N_SET(x) (((32'd0 | (x)) << TXPC_TXPC_N_LSB) & TXPC_TXPC_N_MASK) -#define TXPC_TXPC_N_RESET 8'h80 -#define TXPC_TXPC_ON1STSYNTHON_MSB 5 -#define TXPC_TXPC_ON1STSYNTHON_LSB 5 -#define TXPC_TXPC_ON1STSYNTHON_MASK 'h00000020 -#define TXPC_TXPC_ON1STSYNTHON_GET(x) (((x) & TXPC_TXPC_ON1STSYNTHON_MASK) >> TXPC_TXPC_ON1STSYNTHON_LSB) -#define TXPC_TXPC_ON1STSYNTHON_SET(x) (((32'd0 | (x)) << TXPC_TXPC_ON1STSYNTHON_LSB) & TXPC_TXPC_ON1STSYNTHON_MASK) -#define TXPC_TXPC_ON1STSYNTHON_RESET 1'h1 -#define TXPC_TXPC_SELINIT_MSB 4 -#define TXPC_TXPC_SELINIT_LSB 3 -#define TXPC_TXPC_SELINIT_MASK 'h00000018 -#define TXPC_TXPC_SELINIT_GET(x) (((x) & TXPC_TXPC_SELINIT_MASK) >> TXPC_TXPC_SELINIT_LSB) -#define TXPC_TXPC_SELINIT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELINIT_LSB) & TXPC_TXPC_SELINIT_MASK) -#define TXPC_TXPC_SELINIT_RESET 2'h3 -#define TXPC_TXPC_SELCOUNT_MSB 2 -#define TXPC_TXPC_SELCOUNT_LSB 2 -#define TXPC_TXPC_SELCOUNT_MASK 'h00000004 -#define TXPC_TXPC_SELCOUNT_GET(x) (((x) & TXPC_TXPC_SELCOUNT_MASK) >> TXPC_TXPC_SELCOUNT_LSB) -#define TXPC_TXPC_SELCOUNT_SET(x) (((32'd0 | (x)) << TXPC_TXPC_SELCOUNT_LSB) & TXPC_TXPC_SELCOUNT_MASK) -#define TXPC_TXPC_SELCOUNT_RESET 1'h1 -#define TXPC_TXPC_ATBSEL_MSB 1 -#define TXPC_TXPC_ATBSEL_LSB 0 -#define TXPC_TXPC_ATBSEL_MASK 'h00000003 -#define TXPC_TXPC_ATBSEL_GET(x) (((x) & TXPC_TXPC_ATBSEL_MASK) >> TXPC_TXPC_ATBSEL_LSB) -#define TXPC_TXPC_ATBSEL_SET(x) (((32'd0 | (x)) << TXPC_TXPC_ATBSEL_LSB) & TXPC_TXPC_ATBSEL_MASK) -#define TXPC_TXPC_ATBSEL_RESET 2'h0 -#define TXPC_TXPC_RESET (32'h0 | \ - TXPC_TXPC_SELINTPD_SET(TXPC_TXPC_SELINTPD_RESET) | \ - TXPC_TXPC_TEST_SET(TXPC_TXPC_TEST_RESET) | \ - TXPC_TXPC_TESTGAIN_SET(TXPC_TXPC_TESTGAIN_RESET) | \ - TXPC_TXPC_TESTDAC_SET(TXPC_TXPC_TESTDAC_RESET) | \ - TXPC_TXPC_TESTPWDPC_SET(TXPC_TXPC_TESTPWDPC_RESET) | \ - TXPC_TXPC_CURHALF_SET(TXPC_TXPC_CURHALF_RESET) | \ - TXPC_TXPC_NEGOUT_SET(TXPC_TXPC_NEGOUT_RESET) | \ - TXPC_TXPC_CLKDELAY_SET(TXPC_TXPC_CLKDELAY_RESET) | \ - TXPC_TXPC_SELMODREF_SET(TXPC_TXPC_SELMODREF_RESET) | \ - TXPC_TXPC_SELCMOUT_SET(TXPC_TXPC_SELCMOUT_RESET) | \ - TXPC_TXPC_TSMODE_SET(TXPC_TXPC_TSMODE_RESET) | \ - TXPC_TXPC_N_SET(TXPC_TXPC_N_RESET) | \ - TXPC_TXPC_ON1STSYNTHON_SET(TXPC_TXPC_ON1STSYNTHON_RESET) | \ - TXPC_TXPC_SELINIT_SET(TXPC_TXPC_SELINIT_RESET) | \ - TXPC_TXPC_SELCOUNT_SET(TXPC_TXPC_SELCOUNT_RESET) | \ - TXPC_TXPC_ATBSEL_SET(TXPC_TXPC_ATBSEL_RESET)) -#define TXPC_TXPC_HW_MASK (32'h0) -#define TXPC_TXPC_SW_MASK (32'h0 | \ - TXPC_TXPC_SELINTPD_MASK | \ - TXPC_TXPC_TEST_MASK | \ - TXPC_TXPC_TESTGAIN_MASK | \ - TXPC_TXPC_TESTDAC_MASK | \ - TXPC_TXPC_TESTPWDPC_MASK | \ - TXPC_TXPC_CURHALF_MASK | \ - TXPC_TXPC_NEGOUT_MASK | \ - TXPC_TXPC_CLKDELAY_MASK | \ - TXPC_TXPC_SELMODREF_MASK | \ - TXPC_TXPC_SELCMOUT_MASK | \ - TXPC_TXPC_TSMODE_MASK | \ - TXPC_TXPC_N_MASK | \ - TXPC_TXPC_ON1STSYNTHON_MASK | \ - TXPC_TXPC_SELINIT_MASK | \ - TXPC_TXPC_SELCOUNT_MASK | \ - TXPC_TXPC_ATBSEL_MASK) - -#define TXPC_MISC_ADDRESS 'h00000004 -#define TXPC_MISC_FLIPBMODE_MSB 31 -#define TXPC_MISC_FLIPBMODE_LSB 31 -#define TXPC_MISC_FLIPBMODE_MASK 'h80000000 -#define TXPC_MISC_FLIPBMODE_GET(x) (((x) & TXPC_MISC_FLIPBMODE_MASK) >> TXPC_MISC_FLIPBMODE_LSB) -#define TXPC_MISC_FLIPBMODE_SET(x) (((32'd0 | (x)) << TXPC_MISC_FLIPBMODE_LSB) & TXPC_MISC_FLIPBMODE_MASK) -#define TXPC_MISC_FLIPBMODE_RESET 1'h0 -#define TXPC_MISC_LEVEL_MSB 30 -#define TXPC_MISC_LEVEL_LSB 29 -#define TXPC_MISC_LEVEL_MASK 'h60000000 -#define TXPC_MISC_LEVEL_GET(x) (((x) & TXPC_MISC_LEVEL_MASK) >> TXPC_MISC_LEVEL_LSB) -#define TXPC_MISC_LEVEL_SET(x) (((32'd0 | (x)) << TXPC_MISC_LEVEL_LSB) & TXPC_MISC_LEVEL_MASK) -#define TXPC_MISC_LEVEL_RESET 2'h0 -#define TXPC_MISC_LDO_TEST_MODE_MSB 28 -#define TXPC_MISC_LDO_TEST_MODE_LSB 28 -#define TXPC_MISC_LDO_TEST_MODE_MASK 'h10000000 -#define TXPC_MISC_LDO_TEST_MODE_GET(x) (((x) & TXPC_MISC_LDO_TEST_MODE_MASK) >> TXPC_MISC_LDO_TEST_MODE_LSB) -#define TXPC_MISC_LDO_TEST_MODE_SET(x) (((32'd0 | (x)) << TXPC_MISC_LDO_TEST_MODE_LSB) & TXPC_MISC_LDO_TEST_MODE_MASK) -#define TXPC_MISC_LDO_TEST_MODE_RESET 1'h0 -#define TXPC_MISC_NOTCXODET_MSB 27 -#define TXPC_MISC_NOTCXODET_LSB 27 -#define TXPC_MISC_NOTCXODET_MASK 'h08000000 -#define TXPC_MISC_NOTCXODET_GET(x) (((x) & TXPC_MISC_NOTCXODET_MASK) >> TXPC_MISC_NOTCXODET_LSB) -#define TXPC_MISC_NOTCXODET_SET(x) (((32'd0 | (x)) << TXPC_MISC_NOTCXODET_LSB) & TXPC_MISC_NOTCXODET_MASK) -#define TXPC_MISC_NOTCXODET_RESET 1'h0 -#define TXPC_MISC_PWDCLKIND_MSB 26 -#define TXPC_MISC_PWDCLKIND_LSB 26 -#define TXPC_MISC_PWDCLKIND_MASK 'h04000000 -#define TXPC_MISC_PWDCLKIND_GET(x) (((x) & TXPC_MISC_PWDCLKIND_MASK) >> TXPC_MISC_PWDCLKIND_LSB) -#define TXPC_MISC_PWDCLKIND_SET(x) (((32'd0 | (x)) << TXPC_MISC_PWDCLKIND_LSB) & TXPC_MISC_PWDCLKIND_MASK) -#define TXPC_MISC_PWDCLKIND_RESET 1'h0 -#define TXPC_MISC_PWDXINPAD_MSB 25 -#define TXPC_MISC_PWDXINPAD_LSB 25 -#define TXPC_MISC_PWDXINPAD_MASK 'h02000000 -#define TXPC_MISC_PWDXINPAD_GET(x) (((x) & TXPC_MISC_PWDXINPAD_MASK) >> TXPC_MISC_PWDXINPAD_LSB) -#define TXPC_MISC_PWDXINPAD_SET(x) (((32'd0 | (x)) << TXPC_MISC_PWDXINPAD_LSB) & TXPC_MISC_PWDXINPAD_MASK) -#define TXPC_MISC_PWDXINPAD_RESET 1'h0 -#define TXPC_MISC_LOCALBIAS_MSB 24 -#define TXPC_MISC_LOCALBIAS_LSB 24 -#define TXPC_MISC_LOCALBIAS_MASK 'h01000000 -#define TXPC_MISC_LOCALBIAS_GET(x) (((x) & TXPC_MISC_LOCALBIAS_MASK) >> TXPC_MISC_LOCALBIAS_LSB) -#define TXPC_MISC_LOCALBIAS_SET(x) (((32'd0 | (x)) << TXPC_MISC_LOCALBIAS_LSB) & TXPC_MISC_LOCALBIAS_MASK) -#define TXPC_MISC_LOCALBIAS_RESET 1'h1 -#define TXPC_MISC_LOCALBIAS2X_MSB 23 -#define TXPC_MISC_LOCALBIAS2X_LSB 23 -#define TXPC_MISC_LOCALBIAS2X_MASK 'h00800000 -#define TXPC_MISC_LOCALBIAS2X_GET(x) (((x) & TXPC_MISC_LOCALBIAS2X_MASK) >> TXPC_MISC_LOCALBIAS2X_LSB) -#define TXPC_MISC_LOCALBIAS2X_SET(x) (((32'd0 | (x)) << TXPC_MISC_LOCALBIAS2X_LSB) & TXPC_MISC_LOCALBIAS2X_MASK) -#define TXPC_MISC_LOCALBIAS2X_RESET 1'h0 -#define TXPC_MISC_SELTSP_MSB 22 -#define TXPC_MISC_SELTSP_LSB 22 -#define TXPC_MISC_SELTSP_MASK 'h00400000 -#define TXPC_MISC_SELTSP_GET(x) (((x) & TXPC_MISC_SELTSP_MASK) >> TXPC_MISC_SELTSP_LSB) -#define TXPC_MISC_SELTSP_SET(x) (((32'd0 | (x)) << TXPC_MISC_SELTSP_LSB) & TXPC_MISC_SELTSP_MASK) -#define TXPC_MISC_SELTSP_RESET 1'h0 -#define TXPC_MISC_SELTSN_MSB 21 -#define TXPC_MISC_SELTSN_LSB 21 -#define TXPC_MISC_SELTSN_MASK 'h00200000 -#define TXPC_MISC_SELTSN_GET(x) (((x) & TXPC_MISC_SELTSN_MASK) >> TXPC_MISC_SELTSN_LSB) -#define TXPC_MISC_SELTSN_SET(x) (((32'd0 | (x)) << TXPC_MISC_SELTSN_LSB) & TXPC_MISC_SELTSN_MASK) -#define TXPC_MISC_SELTSN_RESET 1'h0 -#define TXPC_MISC_SPARE_A_MSB 20 -#define TXPC_MISC_SPARE_A_LSB 18 -#define TXPC_MISC_SPARE_A_MASK 'h001c0000 -#define TXPC_MISC_SPARE_A_GET(x) (((x) & TXPC_MISC_SPARE_A_MASK) >> TXPC_MISC_SPARE_A_LSB) -#define TXPC_MISC_SPARE_A_SET(x) (((32'd0 | (x)) << TXPC_MISC_SPARE_A_LSB) & TXPC_MISC_SPARE_A_MASK) -#define TXPC_MISC_SPARE_A_RESET 3'h0 -#define TXPC_MISC_DECOUT_MSB 17 -#define TXPC_MISC_DECOUT_LSB 8 -#define TXPC_MISC_DECOUT_MASK 'h0003ff00 -#define TXPC_MISC_DECOUT_GET(x) (((x) & TXPC_MISC_DECOUT_MASK) >> TXPC_MISC_DECOUT_LSB) -#define TXPC_MISC_DECOUT_SET(x) (((32'd0 | (x)) << TXPC_MISC_DECOUT_LSB) & TXPC_MISC_DECOUT_MASK) -#define TXPC_MISC_DECOUT_RESET 10'h0 -#define TXPC_MISC_XTALDIV_MSB 7 -#define TXPC_MISC_XTALDIV_LSB 6 -#define TXPC_MISC_XTALDIV_MASK 'h000000c0 -#define TXPC_MISC_XTALDIV_GET(x) (((x) & TXPC_MISC_XTALDIV_MASK) >> TXPC_MISC_XTALDIV_LSB) -#define TXPC_MISC_XTALDIV_SET(x) (((32'd0 | (x)) << TXPC_MISC_XTALDIV_LSB) & TXPC_MISC_XTALDIV_MASK) -#define TXPC_MISC_XTALDIV_RESET 2'h0 -#define TXPC_MISC_SPARE_MSB 5 -#define TXPC_MISC_SPARE_LSB 0 -#define TXPC_MISC_SPARE_MASK 'h0000003f -#define TXPC_MISC_SPARE_GET(x) (((x) & TXPC_MISC_SPARE_MASK) >> TXPC_MISC_SPARE_LSB) -#define TXPC_MISC_SPARE_SET(x) (((32'd0 | (x)) << TXPC_MISC_SPARE_LSB) & TXPC_MISC_SPARE_MASK) -#define TXPC_MISC_SPARE_RESET 6'h0 -#define TXPC_MISC_RESET (32'h0 | \ - TXPC_MISC_FLIPBMODE_SET(TXPC_MISC_FLIPBMODE_RESET) | \ - TXPC_MISC_LEVEL_SET(TXPC_MISC_LEVEL_RESET) | \ - TXPC_MISC_LDO_TEST_MODE_SET(TXPC_MISC_LDO_TEST_MODE_RESET) | \ - TXPC_MISC_NOTCXODET_SET(TXPC_MISC_NOTCXODET_RESET) | \ - TXPC_MISC_PWDCLKIND_SET(TXPC_MISC_PWDCLKIND_RESET) | \ - TXPC_MISC_PWDXINPAD_SET(TXPC_MISC_PWDXINPAD_RESET) | \ - TXPC_MISC_LOCALBIAS_SET(TXPC_MISC_LOCALBIAS_RESET) | \ - TXPC_MISC_LOCALBIAS2X_SET(TXPC_MISC_LOCALBIAS2X_RESET) | \ - TXPC_MISC_SELTSP_SET(TXPC_MISC_SELTSP_RESET) | \ - TXPC_MISC_SELTSN_SET(TXPC_MISC_SELTSN_RESET) | \ - TXPC_MISC_SPARE_A_SET(TXPC_MISC_SPARE_A_RESET) | \ - TXPC_MISC_DECOUT_SET(TXPC_MISC_DECOUT_RESET) | \ - TXPC_MISC_XTALDIV_SET(TXPC_MISC_XTALDIV_RESET) | \ - TXPC_MISC_SPARE_SET(TXPC_MISC_SPARE_RESET)) -#define TXPC_MISC_HW_MASK (32'h0 | \ - TXPC_MISC_DECOUT_MASK) -#define TXPC_MISC_SW_MASK (32'h0 | \ - TXPC_MISC_FLIPBMODE_MASK | \ - TXPC_MISC_LEVEL_MASK | \ - TXPC_MISC_LDO_TEST_MODE_MASK | \ - TXPC_MISC_NOTCXODET_MASK | \ - TXPC_MISC_PWDCLKIND_MASK | \ - TXPC_MISC_PWDXINPAD_MASK | \ - TXPC_MISC_LOCALBIAS_MASK | \ - TXPC_MISC_LOCALBIAS2X_MASK | \ - TXPC_MISC_SELTSP_MASK | \ - TXPC_MISC_SELTSN_MASK | \ - TXPC_MISC_SPARE_A_MASK | \ - TXPC_MISC_DECOUT_MASK | \ - TXPC_MISC_XTALDIV_MASK | \ - TXPC_MISC_SPARE_MASK) - -#define TXPC_REG_ADDRESS_MSB 2 - -#endif /* _TXPC_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/uart_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/uart_reg.h deleted file mode 100644 index 5db321b72b2c..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/uart_reg.h +++ /dev/null @@ -1,327 +0,0 @@ -#ifndef _UART_REG_REG_H_ -#define _UART_REG_REG_H_ - -#define RBR_ADDRESS 0x00000000 -#define RBR_OFFSET 0x00000000 -#define RBR_RBR_MSB 7 -#define RBR_RBR_LSB 0 -#define RBR_RBR_MASK 0x000000ff -#define RBR_RBR_GET(x) (((x) & RBR_RBR_MASK) >> RBR_RBR_LSB) -#define RBR_RBR_SET(x) (((x) << RBR_RBR_LSB) & RBR_RBR_MASK) - -#define THR_ADDRESS 0x00000000 -#define THR_OFFSET 0x00000000 -#define THR_THR_MSB 7 -#define THR_THR_LSB 0 -#define THR_THR_MASK 0x000000ff -#define THR_THR_GET(x) (((x) & THR_THR_MASK) >> THR_THR_LSB) -#define THR_THR_SET(x) (((x) << THR_THR_LSB) & THR_THR_MASK) - -#define DLL_ADDRESS 0x00000000 -#define DLL_OFFSET 0x00000000 -#define DLL_DLL_MSB 7 -#define DLL_DLL_LSB 0 -#define DLL_DLL_MASK 0x000000ff -#define DLL_DLL_GET(x) (((x) & DLL_DLL_MASK) >> DLL_DLL_LSB) -#define DLL_DLL_SET(x) (((x) << DLL_DLL_LSB) & DLL_DLL_MASK) - -#define DLH_ADDRESS 0x00000004 -#define DLH_OFFSET 0x00000004 -#define DLH_DLH_MSB 7 -#define DLH_DLH_LSB 0 -#define DLH_DLH_MASK 0x000000ff -#define DLH_DLH_GET(x) (((x) & DLH_DLH_MASK) >> DLH_DLH_LSB) -#define DLH_DLH_SET(x) (((x) << DLH_DLH_LSB) & DLH_DLH_MASK) - -#define IER_ADDRESS 0x00000004 -#define IER_OFFSET 0x00000004 -#define IER_EDDSI_MSB 3 -#define IER_EDDSI_LSB 3 -#define IER_EDDSI_MASK 0x00000008 -#define IER_EDDSI_GET(x) (((x) & IER_EDDSI_MASK) >> IER_EDDSI_LSB) -#define IER_EDDSI_SET(x) (((x) << IER_EDDSI_LSB) & IER_EDDSI_MASK) -#define IER_ELSI_MSB 2 -#define IER_ELSI_LSB 2 -#define IER_ELSI_MASK 0x00000004 -#define IER_ELSI_GET(x) (((x) & IER_ELSI_MASK) >> IER_ELSI_LSB) -#define IER_ELSI_SET(x) (((x) << IER_ELSI_LSB) & IER_ELSI_MASK) -#define IER_ETBEI_MSB 1 -#define IER_ETBEI_LSB 1 -#define IER_ETBEI_MASK 0x00000002 -#define IER_ETBEI_GET(x) (((x) & IER_ETBEI_MASK) >> IER_ETBEI_LSB) -#define IER_ETBEI_SET(x) (((x) << IER_ETBEI_LSB) & IER_ETBEI_MASK) -#define IER_ERBFI_MSB 0 -#define IER_ERBFI_LSB 0 -#define IER_ERBFI_MASK 0x00000001 -#define IER_ERBFI_GET(x) (((x) & IER_ERBFI_MASK) >> IER_ERBFI_LSB) -#define IER_ERBFI_SET(x) (((x) << IER_ERBFI_LSB) & IER_ERBFI_MASK) - -#define IIR_ADDRESS 0x00000008 -#define IIR_OFFSET 0x00000008 -#define IIR_FIFO_STATUS_MSB 7 -#define IIR_FIFO_STATUS_LSB 6 -#define IIR_FIFO_STATUS_MASK 0x000000c0 -#define IIR_FIFO_STATUS_GET(x) (((x) & IIR_FIFO_STATUS_MASK) >> IIR_FIFO_STATUS_LSB) -#define IIR_FIFO_STATUS_SET(x) (((x) << IIR_FIFO_STATUS_LSB) & IIR_FIFO_STATUS_MASK) -#define IIR_IID_MSB 3 -#define IIR_IID_LSB 0 -#define IIR_IID_MASK 0x0000000f -#define IIR_IID_GET(x) (((x) & IIR_IID_MASK) >> IIR_IID_LSB) -#define IIR_IID_SET(x) (((x) << IIR_IID_LSB) & IIR_IID_MASK) - -#define FCR_ADDRESS 0x00000008 -#define FCR_OFFSET 0x00000008 -#define FCR_RCVR_TRIG_MSB 7 -#define FCR_RCVR_TRIG_LSB 6 -#define FCR_RCVR_TRIG_MASK 0x000000c0 -#define FCR_RCVR_TRIG_GET(x) (((x) & FCR_RCVR_TRIG_MASK) >> FCR_RCVR_TRIG_LSB) -#define FCR_RCVR_TRIG_SET(x) (((x) << FCR_RCVR_TRIG_LSB) & FCR_RCVR_TRIG_MASK) -#define FCR_DMA_MODE_MSB 3 -#define FCR_DMA_MODE_LSB 3 -#define FCR_DMA_MODE_MASK 0x00000008 -#define FCR_DMA_MODE_GET(x) (((x) & FCR_DMA_MODE_MASK) >> FCR_DMA_MODE_LSB) -#define FCR_DMA_MODE_SET(x) (((x) << FCR_DMA_MODE_LSB) & FCR_DMA_MODE_MASK) -#define FCR_XMIT_FIFO_RST_MSB 2 -#define FCR_XMIT_FIFO_RST_LSB 2 -#define FCR_XMIT_FIFO_RST_MASK 0x00000004 -#define FCR_XMIT_FIFO_RST_GET(x) (((x) & FCR_XMIT_FIFO_RST_MASK) >> FCR_XMIT_FIFO_RST_LSB) -#define FCR_XMIT_FIFO_RST_SET(x) (((x) << FCR_XMIT_FIFO_RST_LSB) & FCR_XMIT_FIFO_RST_MASK) -#define FCR_RCVR_FIFO_RST_MSB 1 -#define FCR_RCVR_FIFO_RST_LSB 1 -#define FCR_RCVR_FIFO_RST_MASK 0x00000002 -#define FCR_RCVR_FIFO_RST_GET(x) (((x) & FCR_RCVR_FIFO_RST_MASK) >> FCR_RCVR_FIFO_RST_LSB) -#define FCR_RCVR_FIFO_RST_SET(x) (((x) << FCR_RCVR_FIFO_RST_LSB) & FCR_RCVR_FIFO_RST_MASK) -#define FCR_FIFO_EN_MSB 0 -#define FCR_FIFO_EN_LSB 0 -#define FCR_FIFO_EN_MASK 0x00000001 -#define FCR_FIFO_EN_GET(x) (((x) & FCR_FIFO_EN_MASK) >> FCR_FIFO_EN_LSB) -#define FCR_FIFO_EN_SET(x) (((x) << FCR_FIFO_EN_LSB) & FCR_FIFO_EN_MASK) - -#define LCR_ADDRESS 0x0000000c -#define LCR_OFFSET 0x0000000c -#define LCR_DLAB_MSB 7 -#define LCR_DLAB_LSB 7 -#define LCR_DLAB_MASK 0x00000080 -#define LCR_DLAB_GET(x) (((x) & LCR_DLAB_MASK) >> LCR_DLAB_LSB) -#define LCR_DLAB_SET(x) (((x) << LCR_DLAB_LSB) & LCR_DLAB_MASK) -#define LCR_BREAK_MSB 6 -#define LCR_BREAK_LSB 6 -#define LCR_BREAK_MASK 0x00000040 -#define LCR_BREAK_GET(x) (((x) & LCR_BREAK_MASK) >> LCR_BREAK_LSB) -#define LCR_BREAK_SET(x) (((x) << LCR_BREAK_LSB) & LCR_BREAK_MASK) -#define LCR_EPS_MSB 4 -#define LCR_EPS_LSB 4 -#define LCR_EPS_MASK 0x00000010 -#define LCR_EPS_GET(x) (((x) & LCR_EPS_MASK) >> LCR_EPS_LSB) -#define LCR_EPS_SET(x) (((x) << LCR_EPS_LSB) & LCR_EPS_MASK) -#define LCR_PEN_MSB 3 -#define LCR_PEN_LSB 3 -#define LCR_PEN_MASK 0x00000008 -#define LCR_PEN_GET(x) (((x) & LCR_PEN_MASK) >> LCR_PEN_LSB) -#define LCR_PEN_SET(x) (((x) << LCR_PEN_LSB) & LCR_PEN_MASK) -#define LCR_STOP_MSB 2 -#define LCR_STOP_LSB 2 -#define LCR_STOP_MASK 0x00000004 -#define LCR_STOP_GET(x) (((x) & LCR_STOP_MASK) >> LCR_STOP_LSB) -#define LCR_STOP_SET(x) (((x) << LCR_STOP_LSB) & LCR_STOP_MASK) -#define LCR_CLS_MSB 1 -#define LCR_CLS_LSB 0 -#define LCR_CLS_MASK 0x00000003 -#define LCR_CLS_GET(x) (((x) & LCR_CLS_MASK) >> LCR_CLS_LSB) -#define LCR_CLS_SET(x) (((x) << LCR_CLS_LSB) & LCR_CLS_MASK) - -#define MCR_ADDRESS 0x00000010 -#define MCR_OFFSET 0x00000010 -#define MCR_LOOPBACK_MSB 5 -#define MCR_LOOPBACK_LSB 5 -#define MCR_LOOPBACK_MASK 0x00000020 -#define MCR_LOOPBACK_GET(x) (((x) & MCR_LOOPBACK_MASK) >> MCR_LOOPBACK_LSB) -#define MCR_LOOPBACK_SET(x) (((x) << MCR_LOOPBACK_LSB) & MCR_LOOPBACK_MASK) -#define MCR_OUT2_MSB 3 -#define MCR_OUT2_LSB 3 -#define MCR_OUT2_MASK 0x00000008 -#define MCR_OUT2_GET(x) (((x) & MCR_OUT2_MASK) >> MCR_OUT2_LSB) -#define MCR_OUT2_SET(x) (((x) << MCR_OUT2_LSB) & MCR_OUT2_MASK) -#define MCR_OUT1_MSB 2 -#define MCR_OUT1_LSB 2 -#define MCR_OUT1_MASK 0x00000004 -#define MCR_OUT1_GET(x) (((x) & MCR_OUT1_MASK) >> MCR_OUT1_LSB) -#define MCR_OUT1_SET(x) (((x) << MCR_OUT1_LSB) & MCR_OUT1_MASK) -#define MCR_RTS_MSB 1 -#define MCR_RTS_LSB 1 -#define MCR_RTS_MASK 0x00000002 -#define MCR_RTS_GET(x) (((x) & MCR_RTS_MASK) >> MCR_RTS_LSB) -#define MCR_RTS_SET(x) (((x) << MCR_RTS_LSB) & MCR_RTS_MASK) -#define MCR_DTR_MSB 0 -#define MCR_DTR_LSB 0 -#define MCR_DTR_MASK 0x00000001 -#define MCR_DTR_GET(x) (((x) & MCR_DTR_MASK) >> MCR_DTR_LSB) -#define MCR_DTR_SET(x) (((x) << MCR_DTR_LSB) & MCR_DTR_MASK) - -#define LSR_ADDRESS 0x00000014 -#define LSR_OFFSET 0x00000014 -#define LSR_FERR_MSB 7 -#define LSR_FERR_LSB 7 -#define LSR_FERR_MASK 0x00000080 -#define LSR_FERR_GET(x) (((x) & LSR_FERR_MASK) >> LSR_FERR_LSB) -#define LSR_FERR_SET(x) (((x) << LSR_FERR_LSB) & LSR_FERR_MASK) -#define LSR_TEMT_MSB 6 -#define LSR_TEMT_LSB 6 -#define LSR_TEMT_MASK 0x00000040 -#define LSR_TEMT_GET(x) (((x) & LSR_TEMT_MASK) >> LSR_TEMT_LSB) -#define LSR_TEMT_SET(x) (((x) << LSR_TEMT_LSB) & LSR_TEMT_MASK) -#define LSR_THRE_MSB 5 -#define LSR_THRE_LSB 5 -#define LSR_THRE_MASK 0x00000020 -#define LSR_THRE_GET(x) (((x) & LSR_THRE_MASK) >> LSR_THRE_LSB) -#define LSR_THRE_SET(x) (((x) << LSR_THRE_LSB) & LSR_THRE_MASK) -#define LSR_BI_MSB 4 -#define LSR_BI_LSB 4 -#define LSR_BI_MASK 0x00000010 -#define LSR_BI_GET(x) (((x) & LSR_BI_MASK) >> LSR_BI_LSB) -#define LSR_BI_SET(x) (((x) << LSR_BI_LSB) & LSR_BI_MASK) -#define LSR_FE_MSB 3 -#define LSR_FE_LSB 3 -#define LSR_FE_MASK 0x00000008 -#define LSR_FE_GET(x) (((x) & LSR_FE_MASK) >> LSR_FE_LSB) -#define LSR_FE_SET(x) (((x) << LSR_FE_LSB) & LSR_FE_MASK) -#define LSR_PE_MSB 2 -#define LSR_PE_LSB 2 -#define LSR_PE_MASK 0x00000004 -#define LSR_PE_GET(x) (((x) & LSR_PE_MASK) >> LSR_PE_LSB) -#define LSR_PE_SET(x) (((x) << LSR_PE_LSB) & LSR_PE_MASK) -#define LSR_OE_MSB 1 -#define LSR_OE_LSB 1 -#define LSR_OE_MASK 0x00000002 -#define LSR_OE_GET(x) (((x) & LSR_OE_MASK) >> LSR_OE_LSB) -#define LSR_OE_SET(x) (((x) << LSR_OE_LSB) & LSR_OE_MASK) -#define LSR_DR_MSB 0 -#define LSR_DR_LSB 0 -#define LSR_DR_MASK 0x00000001 -#define LSR_DR_GET(x) (((x) & LSR_DR_MASK) >> LSR_DR_LSB) -#define LSR_DR_SET(x) (((x) << LSR_DR_LSB) & LSR_DR_MASK) - -#define MSR_ADDRESS 0x00000018 -#define MSR_OFFSET 0x00000018 -#define MSR_DCD_MSB 7 -#define MSR_DCD_LSB 7 -#define MSR_DCD_MASK 0x00000080 -#define MSR_DCD_GET(x) (((x) & MSR_DCD_MASK) >> MSR_DCD_LSB) -#define MSR_DCD_SET(x) (((x) << MSR_DCD_LSB) & MSR_DCD_MASK) -#define MSR_RI_MSB 6 -#define MSR_RI_LSB 6 -#define MSR_RI_MASK 0x00000040 -#define MSR_RI_GET(x) (((x) & MSR_RI_MASK) >> MSR_RI_LSB) -#define MSR_RI_SET(x) (((x) << MSR_RI_LSB) & MSR_RI_MASK) -#define MSR_DSR_MSB 5 -#define MSR_DSR_LSB 5 -#define MSR_DSR_MASK 0x00000020 -#define MSR_DSR_GET(x) (((x) & MSR_DSR_MASK) >> MSR_DSR_LSB) -#define MSR_DSR_SET(x) (((x) << MSR_DSR_LSB) & MSR_DSR_MASK) -#define MSR_CTS_MSB 4 -#define MSR_CTS_LSB 4 -#define MSR_CTS_MASK 0x00000010 -#define MSR_CTS_GET(x) (((x) & MSR_CTS_MASK) >> MSR_CTS_LSB) -#define MSR_CTS_SET(x) (((x) << MSR_CTS_LSB) & MSR_CTS_MASK) -#define MSR_DDCD_MSB 3 -#define MSR_DDCD_LSB 3 -#define MSR_DDCD_MASK 0x00000008 -#define MSR_DDCD_GET(x) (((x) & MSR_DDCD_MASK) >> MSR_DDCD_LSB) -#define MSR_DDCD_SET(x) (((x) << MSR_DDCD_LSB) & MSR_DDCD_MASK) -#define MSR_TERI_MSB 2 -#define MSR_TERI_LSB 2 -#define MSR_TERI_MASK 0x00000004 -#define MSR_TERI_GET(x) (((x) & MSR_TERI_MASK) >> MSR_TERI_LSB) -#define MSR_TERI_SET(x) (((x) << MSR_TERI_LSB) & MSR_TERI_MASK) -#define MSR_DDSR_MSB 1 -#define MSR_DDSR_LSB 1 -#define MSR_DDSR_MASK 0x00000002 -#define MSR_DDSR_GET(x) (((x) & MSR_DDSR_MASK) >> MSR_DDSR_LSB) -#define MSR_DDSR_SET(x) (((x) << MSR_DDSR_LSB) & MSR_DDSR_MASK) -#define MSR_DCTS_MSB 0 -#define MSR_DCTS_LSB 0 -#define MSR_DCTS_MASK 0x00000001 -#define MSR_DCTS_GET(x) (((x) & MSR_DCTS_MASK) >> MSR_DCTS_LSB) -#define MSR_DCTS_SET(x) (((x) << MSR_DCTS_LSB) & MSR_DCTS_MASK) - -#define SCR_ADDRESS 0x0000001c -#define SCR_OFFSET 0x0000001c -#define SCR_SCR_MSB 7 -#define SCR_SCR_LSB 0 -#define SCR_SCR_MASK 0x000000ff -#define SCR_SCR_GET(x) (((x) & SCR_SCR_MASK) >> SCR_SCR_LSB) -#define SCR_SCR_SET(x) (((x) << SCR_SCR_LSB) & SCR_SCR_MASK) - -#define SRBR_ADDRESS 0x00000020 -#define SRBR_OFFSET 0x00000020 -#define SRBR_SRBR_MSB 7 -#define SRBR_SRBR_LSB 0 -#define SRBR_SRBR_MASK 0x000000ff -#define SRBR_SRBR_GET(x) (((x) & SRBR_SRBR_MASK) >> SRBR_SRBR_LSB) -#define SRBR_SRBR_SET(x) (((x) << SRBR_SRBR_LSB) & SRBR_SRBR_MASK) - -#define SIIR_ADDRESS 0x00000028 -#define SIIR_OFFSET 0x00000028 -#define SIIR_SIIR_MSB 7 -#define SIIR_SIIR_LSB 0 -#define SIIR_SIIR_MASK 0x000000ff -#define SIIR_SIIR_GET(x) (((x) & SIIR_SIIR_MASK) >> SIIR_SIIR_LSB) -#define SIIR_SIIR_SET(x) (((x) << SIIR_SIIR_LSB) & SIIR_SIIR_MASK) - -#define MWR_ADDRESS 0x0000002c -#define MWR_OFFSET 0x0000002c -#define MWR_MWR_MSB 31 -#define MWR_MWR_LSB 0 -#define MWR_MWR_MASK 0xffffffff -#define MWR_MWR_GET(x) (((x) & MWR_MWR_MASK) >> MWR_MWR_LSB) -#define MWR_MWR_SET(x) (((x) << MWR_MWR_LSB) & MWR_MWR_MASK) - -#define SLSR_ADDRESS 0x00000034 -#define SLSR_OFFSET 0x00000034 -#define SLSR_SLSR_MSB 7 -#define SLSR_SLSR_LSB 0 -#define SLSR_SLSR_MASK 0x000000ff -#define SLSR_SLSR_GET(x) (((x) & SLSR_SLSR_MASK) >> SLSR_SLSR_LSB) -#define SLSR_SLSR_SET(x) (((x) << SLSR_SLSR_LSB) & SLSR_SLSR_MASK) - -#define SMSR_ADDRESS 0x00000038 -#define SMSR_OFFSET 0x00000038 -#define SMSR_SMSR_MSB 7 -#define SMSR_SMSR_LSB 0 -#define SMSR_SMSR_MASK 0x000000ff -#define SMSR_SMSR_GET(x) (((x) & SMSR_SMSR_MASK) >> SMSR_SMSR_LSB) -#define SMSR_SMSR_SET(x) (((x) << SMSR_SMSR_LSB) & SMSR_SMSR_MASK) - -#define MRR_ADDRESS 0x0000003c -#define MRR_OFFSET 0x0000003c -#define MRR_MRR_MSB 31 -#define MRR_MRR_LSB 0 -#define MRR_MRR_MASK 0xffffffff -#define MRR_MRR_GET(x) (((x) & MRR_MRR_MASK) >> MRR_MRR_LSB) -#define MRR_MRR_SET(x) (((x) << MRR_MRR_LSB) & MRR_MRR_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct uart_reg_reg_s { - volatile unsigned int rbr; - volatile unsigned int dlh; - volatile unsigned int iir; - volatile unsigned int lcr; - volatile unsigned int mcr; - volatile unsigned int lsr; - volatile unsigned int msr; - volatile unsigned int scr; - volatile unsigned int srbr; - unsigned char pad0[4]; /* pad to 0x28 */ - volatile unsigned int siir; - volatile unsigned int mwr; - unsigned char pad1[4]; /* pad to 0x34 */ - volatile unsigned int slsr; - volatile unsigned int smsr; - volatile unsigned int mrr; -} uart_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _UART_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/uart_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/uart_reg.vrh deleted file mode 100644 index fe59c18daa3f..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/uart_reg.vrh +++ /dev/null @@ -1,488 +0,0 @@ -#ifndef _UART_REG_VRH_ -#define _UART_REG_VRH_ - -#define RBR_ADDRESS 'h00000000 -#define RBR_RBR_MSB 7 -#define RBR_RBR_LSB 0 -#define RBR_RBR_MASK 'h000000ff -#define RBR_RBR_GET(x) (((x) & RBR_RBR_MASK) >> RBR_RBR_LSB) -#define RBR_RBR_SET(x) (((32'd0 | (x)) << RBR_RBR_LSB) & RBR_RBR_MASK) -#define RBR_RBR_RESET 8'h0 -#define RBR_RESET (32'h0 | \ - RBR_RBR_SET(RBR_RBR_RESET)) -#define RBR_HW_MASK (32'h0 | \ - RBR_RBR_MASK) -#define RBR_SW_MASK (32'h0) - -#define THR_ADDRESS 'h00000000 -#define THR_THR_MSB 7 -#define THR_THR_LSB 0 -#define THR_THR_MASK 'h000000ff -#define THR_THR_GET(x) (((x) & THR_THR_MASK) >> THR_THR_LSB) -#define THR_THR_SET(x) (((32'd0 | (x)) << THR_THR_LSB) & THR_THR_MASK) -#define THR_THR_RESET 8'h0 -#define THR_RESET (32'h0 | \ - THR_THR_SET(THR_THR_RESET)) -#define THR_HW_MASK (32'h0) -#define THR_SW_MASK (32'h0 | \ - THR_THR_MASK) - -#define DLL_ADDRESS 'h00000000 -#define DLL_DLL_MSB 7 -#define DLL_DLL_LSB 0 -#define DLL_DLL_MASK 'h000000ff -#define DLL_DLL_GET(x) (((x) & DLL_DLL_MASK) >> DLL_DLL_LSB) -#define DLL_DLL_SET(x) (((32'd0 | (x)) << DLL_DLL_LSB) & DLL_DLL_MASK) -#define DLL_DLL_RESET 8'h0 -#define DLL_RESET (32'h0 | \ - DLL_DLL_SET(DLL_DLL_RESET)) -#define DLL_HW_MASK (32'h0) -#define DLL_SW_MASK (32'h0 | \ - DLL_DLL_MASK) - -#define DLH_ADDRESS 'h00000004 -#define DLH_DLH_MSB 7 -#define DLH_DLH_LSB 0 -#define DLH_DLH_MASK 'h000000ff -#define DLH_DLH_GET(x) (((x) & DLH_DLH_MASK) >> DLH_DLH_LSB) -#define DLH_DLH_SET(x) (((32'd0 | (x)) << DLH_DLH_LSB) & DLH_DLH_MASK) -#define DLH_DLH_RESET 8'h0 -#define DLH_RESET (32'h0 | \ - DLH_DLH_SET(DLH_DLH_RESET)) -#define DLH_HW_MASK (32'h0) -#define DLH_SW_MASK (32'h0 | \ - DLH_DLH_MASK) - -#define IER_ADDRESS 'h00000004 -#define IER_EDDSI_MSB 3 -#define IER_EDDSI_LSB 3 -#define IER_EDDSI_MASK 'h00000008 -#define IER_EDDSI_GET(x) (((x) & IER_EDDSI_MASK) >> IER_EDDSI_LSB) -#define IER_EDDSI_SET(x) (((32'd0 | (x)) << IER_EDDSI_LSB) & IER_EDDSI_MASK) -#define IER_EDDSI_RESET 1'h0 -#define IER_ELSI_MSB 2 -#define IER_ELSI_LSB 2 -#define IER_ELSI_MASK 'h00000004 -#define IER_ELSI_GET(x) (((x) & IER_ELSI_MASK) >> IER_ELSI_LSB) -#define IER_ELSI_SET(x) (((32'd0 | (x)) << IER_ELSI_LSB) & IER_ELSI_MASK) -#define IER_ELSI_RESET 1'h0 -#define IER_ETBEI_MSB 1 -#define IER_ETBEI_LSB 1 -#define IER_ETBEI_MASK 'h00000002 -#define IER_ETBEI_GET(x) (((x) & IER_ETBEI_MASK) >> IER_ETBEI_LSB) -#define IER_ETBEI_SET(x) (((32'd0 | (x)) << IER_ETBEI_LSB) & IER_ETBEI_MASK) -#define IER_ETBEI_RESET 1'h0 -#define IER_ERBFI_MSB 0 -#define IER_ERBFI_LSB 0 -#define IER_ERBFI_MASK 'h00000001 -#define IER_ERBFI_GET(x) (((x) & IER_ERBFI_MASK) >> IER_ERBFI_LSB) -#define IER_ERBFI_SET(x) (((32'd0 | (x)) << IER_ERBFI_LSB) & IER_ERBFI_MASK) -#define IER_ERBFI_RESET 1'h0 -#define IER_RESET (32'h0 | \ - IER_EDDSI_SET(IER_EDDSI_RESET) | \ - IER_ELSI_SET(IER_ELSI_RESET) | \ - IER_ETBEI_SET(IER_ETBEI_RESET) | \ - IER_ERBFI_SET(IER_ERBFI_RESET)) -#define IER_HW_MASK (32'h0) -#define IER_SW_MASK (32'h0 | \ - IER_EDDSI_MASK | \ - IER_ELSI_MASK | \ - IER_ETBEI_MASK | \ - IER_ERBFI_MASK) - -#define IIR_ADDRESS 'h00000008 -#define IIR_FIFO_STATUS_MSB 7 -#define IIR_FIFO_STATUS_LSB 6 -#define IIR_FIFO_STATUS_MASK 'h000000c0 -#define IIR_FIFO_STATUS_GET(x) (((x) & IIR_FIFO_STATUS_MASK) >> IIR_FIFO_STATUS_LSB) -#define IIR_FIFO_STATUS_SET(x) (((32'd0 | (x)) << IIR_FIFO_STATUS_LSB) & IIR_FIFO_STATUS_MASK) -#define IIR_FIFO_STATUS_RESET 2'h0 -#define IIR_IID_MSB 3 -#define IIR_IID_LSB 0 -#define IIR_IID_MASK 'h0000000f -#define IIR_IID_GET(x) (((x) & IIR_IID_MASK) >> IIR_IID_LSB) -#define IIR_IID_SET(x) (((32'd0 | (x)) << IIR_IID_LSB) & IIR_IID_MASK) -#define IIR_IID_RESET 4'h0 -#define IIR_RESET (32'h0 | \ - IIR_FIFO_STATUS_SET(IIR_FIFO_STATUS_RESET) | \ - IIR_IID_SET(IIR_IID_RESET)) -#define IIR_HW_MASK (32'h0 | \ - IIR_FIFO_STATUS_MASK | \ - IIR_IID_MASK) -#define IIR_SW_MASK (32'h0) - -#define FCR_ADDRESS 'h00000008 -#define FCR_RCVR_TRIG_MSB 7 -#define FCR_RCVR_TRIG_LSB 6 -#define FCR_RCVR_TRIG_MASK 'h000000c0 -#define FCR_RCVR_TRIG_GET(x) (((x) & FCR_RCVR_TRIG_MASK) >> FCR_RCVR_TRIG_LSB) -#define FCR_RCVR_TRIG_SET(x) (((32'd0 | (x)) << FCR_RCVR_TRIG_LSB) & FCR_RCVR_TRIG_MASK) -#define FCR_RCVR_TRIG_RESET 2'h0 -#define FCR_DMA_MODE_MSB 3 -#define FCR_DMA_MODE_LSB 3 -#define FCR_DMA_MODE_MASK 'h00000008 -#define FCR_DMA_MODE_GET(x) (((x) & FCR_DMA_MODE_MASK) >> FCR_DMA_MODE_LSB) -#define FCR_DMA_MODE_SET(x) (((32'd0 | (x)) << FCR_DMA_MODE_LSB) & FCR_DMA_MODE_MASK) -#define FCR_DMA_MODE_RESET 1'h0 -#define FCR_XMIT_FIFO_RST_MSB 2 -#define FCR_XMIT_FIFO_RST_LSB 2 -#define FCR_XMIT_FIFO_RST_MASK 'h00000004 -#define FCR_XMIT_FIFO_RST_GET(x) (((x) & FCR_XMIT_FIFO_RST_MASK) >> FCR_XMIT_FIFO_RST_LSB) -#define FCR_XMIT_FIFO_RST_SET(x) (((32'd0 | (x)) << FCR_XMIT_FIFO_RST_LSB) & FCR_XMIT_FIFO_RST_MASK) -#define FCR_XMIT_FIFO_RST_RESET 1'h0 -#define FCR_RCVR_FIFO_RST_MSB 1 -#define FCR_RCVR_FIFO_RST_LSB 1 -#define FCR_RCVR_FIFO_RST_MASK 'h00000002 -#define FCR_RCVR_FIFO_RST_GET(x) (((x) & FCR_RCVR_FIFO_RST_MASK) >> FCR_RCVR_FIFO_RST_LSB) -#define FCR_RCVR_FIFO_RST_SET(x) (((32'd0 | (x)) << FCR_RCVR_FIFO_RST_LSB) & FCR_RCVR_FIFO_RST_MASK) -#define FCR_RCVR_FIFO_RST_RESET 1'h0 -#define FCR_FIFO_EN_MSB 0 -#define FCR_FIFO_EN_LSB 0 -#define FCR_FIFO_EN_MASK 'h00000001 -#define FCR_FIFO_EN_GET(x) (((x) & FCR_FIFO_EN_MASK) >> FCR_FIFO_EN_LSB) -#define FCR_FIFO_EN_SET(x) (((32'd0 | (x)) << FCR_FIFO_EN_LSB) & FCR_FIFO_EN_MASK) -#define FCR_FIFO_EN_RESET 1'h0 -#define FCR_RESET (32'h0 | \ - FCR_RCVR_TRIG_SET(FCR_RCVR_TRIG_RESET) | \ - FCR_DMA_MODE_SET(FCR_DMA_MODE_RESET) | \ - FCR_XMIT_FIFO_RST_SET(FCR_XMIT_FIFO_RST_RESET) | \ - FCR_RCVR_FIFO_RST_SET(FCR_RCVR_FIFO_RST_RESET) | \ - FCR_FIFO_EN_SET(FCR_FIFO_EN_RESET)) -#define FCR_HW_MASK (32'h0) -#define FCR_SW_MASK (32'h0 | \ - FCR_RCVR_TRIG_MASK | \ - FCR_DMA_MODE_MASK | \ - FCR_XMIT_FIFO_RST_MASK | \ - FCR_RCVR_FIFO_RST_MASK | \ - FCR_FIFO_EN_MASK) - -#define LCR_ADDRESS 'h0000000c -#define LCR_DLAB_MSB 7 -#define LCR_DLAB_LSB 7 -#define LCR_DLAB_MASK 'h00000080 -#define LCR_DLAB_GET(x) (((x) & LCR_DLAB_MASK) >> LCR_DLAB_LSB) -#define LCR_DLAB_SET(x) (((32'd0 | (x)) << LCR_DLAB_LSB) & LCR_DLAB_MASK) -#define LCR_DLAB_RESET 1'h0 -#define LCR_BREAK_MSB 6 -#define LCR_BREAK_LSB 6 -#define LCR_BREAK_MASK 'h00000040 -#define LCR_BREAK_GET(x) (((x) & LCR_BREAK_MASK) >> LCR_BREAK_LSB) -#define LCR_BREAK_SET(x) (((32'd0 | (x)) << LCR_BREAK_LSB) & LCR_BREAK_MASK) -#define LCR_BREAK_RESET 1'h0 -#define LCR_EPS_MSB 4 -#define LCR_EPS_LSB 4 -#define LCR_EPS_MASK 'h00000010 -#define LCR_EPS_GET(x) (((x) & LCR_EPS_MASK) >> LCR_EPS_LSB) -#define LCR_EPS_SET(x) (((32'd0 | (x)) << LCR_EPS_LSB) & LCR_EPS_MASK) -#define LCR_EPS_RESET 1'h0 -#define LCR_PEN_MSB 3 -#define LCR_PEN_LSB 3 -#define LCR_PEN_MASK 'h00000008 -#define LCR_PEN_GET(x) (((x) & LCR_PEN_MASK) >> LCR_PEN_LSB) -#define LCR_PEN_SET(x) (((32'd0 | (x)) << LCR_PEN_LSB) & LCR_PEN_MASK) -#define LCR_PEN_RESET 1'h0 -#define LCR_STOP_MSB 2 -#define LCR_STOP_LSB 2 -#define LCR_STOP_MASK 'h00000004 -#define LCR_STOP_GET(x) (((x) & LCR_STOP_MASK) >> LCR_STOP_LSB) -#define LCR_STOP_SET(x) (((32'd0 | (x)) << LCR_STOP_LSB) & LCR_STOP_MASK) -#define LCR_STOP_RESET 1'h0 -#define LCR_CLS_MSB 1 -#define LCR_CLS_LSB 0 -#define LCR_CLS_MASK 'h00000003 -#define LCR_CLS_GET(x) (((x) & LCR_CLS_MASK) >> LCR_CLS_LSB) -#define LCR_CLS_SET(x) (((32'd0 | (x)) << LCR_CLS_LSB) & LCR_CLS_MASK) -#define LCR_CLS_RESET 2'h0 -#define LCR_RESET (32'h0 | \ - LCR_DLAB_SET(LCR_DLAB_RESET) | \ - LCR_BREAK_SET(LCR_BREAK_RESET) | \ - LCR_EPS_SET(LCR_EPS_RESET) | \ - LCR_PEN_SET(LCR_PEN_RESET) | \ - LCR_STOP_SET(LCR_STOP_RESET) | \ - LCR_CLS_SET(LCR_CLS_RESET)) -#define LCR_HW_MASK (32'h0) -#define LCR_SW_MASK (32'h0 | \ - LCR_DLAB_MASK | \ - LCR_BREAK_MASK | \ - LCR_EPS_MASK | \ - LCR_PEN_MASK | \ - LCR_STOP_MASK | \ - LCR_CLS_MASK) - -#define MCR_ADDRESS 'h00000010 -#define MCR_LOOPBACK_MSB 5 -#define MCR_LOOPBACK_LSB 5 -#define MCR_LOOPBACK_MASK 'h00000020 -#define MCR_LOOPBACK_GET(x) (((x) & MCR_LOOPBACK_MASK) >> MCR_LOOPBACK_LSB) -#define MCR_LOOPBACK_SET(x) (((32'd0 | (x)) << MCR_LOOPBACK_LSB) & MCR_LOOPBACK_MASK) -#define MCR_LOOPBACK_RESET 1'h1 -#define MCR_OUT2_MSB 3 -#define MCR_OUT2_LSB 3 -#define MCR_OUT2_MASK 'h00000008 -#define MCR_OUT2_GET(x) (((x) & MCR_OUT2_MASK) >> MCR_OUT2_LSB) -#define MCR_OUT2_SET(x) (((32'd0 | (x)) << MCR_OUT2_LSB) & MCR_OUT2_MASK) -#define MCR_OUT2_RESET 1'h1 -#define MCR_OUT1_MSB 2 -#define MCR_OUT1_LSB 2 -#define MCR_OUT1_MASK 'h00000004 -#define MCR_OUT1_GET(x) (((x) & MCR_OUT1_MASK) >> MCR_OUT1_LSB) -#define MCR_OUT1_SET(x) (((32'd0 | (x)) << MCR_OUT1_LSB) & MCR_OUT1_MASK) -#define MCR_OUT1_RESET 1'h1 -#define MCR_RTS_MSB 1 -#define MCR_RTS_LSB 1 -#define MCR_RTS_MASK 'h00000002 -#define MCR_RTS_GET(x) (((x) & MCR_RTS_MASK) >> MCR_RTS_LSB) -#define MCR_RTS_SET(x) (((32'd0 | (x)) << MCR_RTS_LSB) & MCR_RTS_MASK) -#define MCR_RTS_RESET 1'h1 -#define MCR_DTR_MSB 0 -#define MCR_DTR_LSB 0 -#define MCR_DTR_MASK 'h00000001 -#define MCR_DTR_GET(x) (((x) & MCR_DTR_MASK) >> MCR_DTR_LSB) -#define MCR_DTR_SET(x) (((32'd0 | (x)) << MCR_DTR_LSB) & MCR_DTR_MASK) -#define MCR_DTR_RESET 1'h1 -#define MCR_RESET (32'h0 | \ - MCR_LOOPBACK_SET(MCR_LOOPBACK_RESET) | \ - MCR_OUT2_SET(MCR_OUT2_RESET) | \ - MCR_OUT1_SET(MCR_OUT1_RESET) | \ - MCR_RTS_SET(MCR_RTS_RESET) | \ - MCR_DTR_SET(MCR_DTR_RESET)) -#define MCR_HW_MASK (32'h0) -#define MCR_SW_MASK (32'h0 | \ - MCR_LOOPBACK_MASK | \ - MCR_OUT2_MASK | \ - MCR_OUT1_MASK | \ - MCR_RTS_MASK | \ - MCR_DTR_MASK) - -#define LSR_ADDRESS 'h00000014 -#define LSR_FERR_MSB 7 -#define LSR_FERR_LSB 7 -#define LSR_FERR_MASK 'h00000080 -#define LSR_FERR_GET(x) (((x) & LSR_FERR_MASK) >> LSR_FERR_LSB) -#define LSR_FERR_SET(x) (((32'd0 | (x)) << LSR_FERR_LSB) & LSR_FERR_MASK) -#define LSR_FERR_RESET 1'h0 -#define LSR_TEMT_MSB 6 -#define LSR_TEMT_LSB 6 -#define LSR_TEMT_MASK 'h00000040 -#define LSR_TEMT_GET(x) (((x) & LSR_TEMT_MASK) >> LSR_TEMT_LSB) -#define LSR_TEMT_SET(x) (((32'd0 | (x)) << LSR_TEMT_LSB) & LSR_TEMT_MASK) -#define LSR_TEMT_RESET 1'h0 -#define LSR_THRE_MSB 5 -#define LSR_THRE_LSB 5 -#define LSR_THRE_MASK 'h00000020 -#define LSR_THRE_GET(x) (((x) & LSR_THRE_MASK) >> LSR_THRE_LSB) -#define LSR_THRE_SET(x) (((32'd0 | (x)) << LSR_THRE_LSB) & LSR_THRE_MASK) -#define LSR_THRE_RESET 1'h0 -#define LSR_BI_MSB 4 -#define LSR_BI_LSB 4 -#define LSR_BI_MASK 'h00000010 -#define LSR_BI_GET(x) (((x) & LSR_BI_MASK) >> LSR_BI_LSB) -#define LSR_BI_SET(x) (((32'd0 | (x)) << LSR_BI_LSB) & LSR_BI_MASK) -#define LSR_BI_RESET 1'h0 -#define LSR_FE_MSB 3 -#define LSR_FE_LSB 3 -#define LSR_FE_MASK 'h00000008 -#define LSR_FE_GET(x) (((x) & LSR_FE_MASK) >> LSR_FE_LSB) -#define LSR_FE_SET(x) (((32'd0 | (x)) << LSR_FE_LSB) & LSR_FE_MASK) -#define LSR_FE_RESET 1'h0 -#define LSR_PE_MSB 2 -#define LSR_PE_LSB 2 -#define LSR_PE_MASK 'h00000004 -#define LSR_PE_GET(x) (((x) & LSR_PE_MASK) >> LSR_PE_LSB) -#define LSR_PE_SET(x) (((32'd0 | (x)) << LSR_PE_LSB) & LSR_PE_MASK) -#define LSR_PE_RESET 1'h0 -#define LSR_OE_MSB 1 -#define LSR_OE_LSB 1 -#define LSR_OE_MASK 'h00000002 -#define LSR_OE_GET(x) (((x) & LSR_OE_MASK) >> LSR_OE_LSB) -#define LSR_OE_SET(x) (((32'd0 | (x)) << LSR_OE_LSB) & LSR_OE_MASK) -#define LSR_OE_RESET 1'h0 -#define LSR_DR_MSB 0 -#define LSR_DR_LSB 0 -#define LSR_DR_MASK 'h00000001 -#define LSR_DR_GET(x) (((x) & LSR_DR_MASK) >> LSR_DR_LSB) -#define LSR_DR_SET(x) (((32'd0 | (x)) << LSR_DR_LSB) & LSR_DR_MASK) -#define LSR_DR_RESET 1'h0 -#define LSR_RESET (32'h0 | \ - LSR_FERR_SET(LSR_FERR_RESET) | \ - LSR_TEMT_SET(LSR_TEMT_RESET) | \ - LSR_THRE_SET(LSR_THRE_RESET) | \ - LSR_BI_SET(LSR_BI_RESET) | \ - LSR_FE_SET(LSR_FE_RESET) | \ - LSR_PE_SET(LSR_PE_RESET) | \ - LSR_OE_SET(LSR_OE_RESET) | \ - LSR_DR_SET(LSR_DR_RESET)) -#define LSR_HW_MASK (32'h0) -#define LSR_SW_MASK (32'h0 | \ - LSR_FERR_MASK | \ - LSR_TEMT_MASK | \ - LSR_THRE_MASK | \ - LSR_BI_MASK | \ - LSR_FE_MASK | \ - LSR_PE_MASK | \ - LSR_OE_MASK | \ - LSR_DR_MASK) - -#define MSR_ADDRESS 'h00000018 -#define MSR_DCD_MSB 7 -#define MSR_DCD_LSB 7 -#define MSR_DCD_MASK 'h00000080 -#define MSR_DCD_GET(x) (((x) & MSR_DCD_MASK) >> MSR_DCD_LSB) -#define MSR_DCD_SET(x) (((32'd0 | (x)) << MSR_DCD_LSB) & MSR_DCD_MASK) -#define MSR_DCD_RESET 1'h0 -#define MSR_RI_MSB 6 -#define MSR_RI_LSB 6 -#define MSR_RI_MASK 'h00000040 -#define MSR_RI_GET(x) (((x) & MSR_RI_MASK) >> MSR_RI_LSB) -#define MSR_RI_SET(x) (((32'd0 | (x)) << MSR_RI_LSB) & MSR_RI_MASK) -#define MSR_RI_RESET 1'h0 -#define MSR_DSR_MSB 5 -#define MSR_DSR_LSB 5 -#define MSR_DSR_MASK 'h00000020 -#define MSR_DSR_GET(x) (((x) & MSR_DSR_MASK) >> MSR_DSR_LSB) -#define MSR_DSR_SET(x) (((32'd0 | (x)) << MSR_DSR_LSB) & MSR_DSR_MASK) -#define MSR_DSR_RESET 1'h0 -#define MSR_CTS_MSB 4 -#define MSR_CTS_LSB 4 -#define MSR_CTS_MASK 'h00000010 -#define MSR_CTS_GET(x) (((x) & MSR_CTS_MASK) >> MSR_CTS_LSB) -#define MSR_CTS_SET(x) (((32'd0 | (x)) << MSR_CTS_LSB) & MSR_CTS_MASK) -#define MSR_CTS_RESET 1'h0 -#define MSR_DDCD_MSB 3 -#define MSR_DDCD_LSB 3 -#define MSR_DDCD_MASK 'h00000008 -#define MSR_DDCD_GET(x) (((x) & MSR_DDCD_MASK) >> MSR_DDCD_LSB) -#define MSR_DDCD_SET(x) (((32'd0 | (x)) << MSR_DDCD_LSB) & MSR_DDCD_MASK) -#define MSR_DDCD_RESET 1'h0 -#define MSR_TERI_MSB 2 -#define MSR_TERI_LSB 2 -#define MSR_TERI_MASK 'h00000004 -#define MSR_TERI_GET(x) (((x) & MSR_TERI_MASK) >> MSR_TERI_LSB) -#define MSR_TERI_SET(x) (((32'd0 | (x)) << MSR_TERI_LSB) & MSR_TERI_MASK) -#define MSR_TERI_RESET 1'h0 -#define MSR_DDSR_MSB 1 -#define MSR_DDSR_LSB 1 -#define MSR_DDSR_MASK 'h00000002 -#define MSR_DDSR_GET(x) (((x) & MSR_DDSR_MASK) >> MSR_DDSR_LSB) -#define MSR_DDSR_SET(x) (((32'd0 | (x)) << MSR_DDSR_LSB) & MSR_DDSR_MASK) -#define MSR_DDSR_RESET 1'h0 -#define MSR_DCTS_MSB 0 -#define MSR_DCTS_LSB 0 -#define MSR_DCTS_MASK 'h00000001 -#define MSR_DCTS_GET(x) (((x) & MSR_DCTS_MASK) >> MSR_DCTS_LSB) -#define MSR_DCTS_SET(x) (((32'd0 | (x)) << MSR_DCTS_LSB) & MSR_DCTS_MASK) -#define MSR_DCTS_RESET 1'h0 -#define MSR_RESET (32'h0 | \ - MSR_DCD_SET(MSR_DCD_RESET) | \ - MSR_RI_SET(MSR_RI_RESET) | \ - MSR_DSR_SET(MSR_DSR_RESET) | \ - MSR_CTS_SET(MSR_CTS_RESET) | \ - MSR_DDCD_SET(MSR_DDCD_RESET) | \ - MSR_TERI_SET(MSR_TERI_RESET) | \ - MSR_DDSR_SET(MSR_DDSR_RESET) | \ - MSR_DCTS_SET(MSR_DCTS_RESET)) -#define MSR_HW_MASK (32'h0) -#define MSR_SW_MASK (32'h0 | \ - MSR_DCD_MASK | \ - MSR_RI_MASK | \ - MSR_DSR_MASK | \ - MSR_CTS_MASK | \ - MSR_DDCD_MASK | \ - MSR_TERI_MASK | \ - MSR_DDSR_MASK | \ - MSR_DCTS_MASK) - -#define SCR_ADDRESS 'h0000001c -#define SCR_SCR_MSB 7 -#define SCR_SCR_LSB 0 -#define SCR_SCR_MASK 'h000000ff -#define SCR_SCR_GET(x) (((x) & SCR_SCR_MASK) >> SCR_SCR_LSB) -#define SCR_SCR_SET(x) (((32'd0 | (x)) << SCR_SCR_LSB) & SCR_SCR_MASK) -#define SCR_SCR_RESET 8'h0 -#define SCR_RESET (32'h0 | \ - SCR_SCR_SET(SCR_SCR_RESET)) -#define SCR_HW_MASK (32'h0) -#define SCR_SW_MASK (32'h0 | \ - SCR_SCR_MASK) - -#define SRBR_ADDRESS 'h00000020 -#define SRBR_SRBR_MSB 7 -#define SRBR_SRBR_LSB 0 -#define SRBR_SRBR_MASK 'h000000ff -#define SRBR_SRBR_GET(x) (((x) & SRBR_SRBR_MASK) >> SRBR_SRBR_LSB) -#define SRBR_SRBR_SET(x) (((32'd0 | (x)) << SRBR_SRBR_LSB) & SRBR_SRBR_MASK) -#define SRBR_SRBR_RESET 8'h0 -#define SRBR_RESET (32'h0 | \ - SRBR_SRBR_SET(SRBR_SRBR_RESET)) -#define SRBR_HW_MASK (32'h0) -#define SRBR_SW_MASK (32'h0 | \ - SRBR_SRBR_MASK) - -#define SIIR_ADDRESS 'h00000028 -#define SIIR_SIIR_MSB 7 -#define SIIR_SIIR_LSB 0 -#define SIIR_SIIR_MASK 'h000000ff -#define SIIR_SIIR_GET(x) (((x) & SIIR_SIIR_MASK) >> SIIR_SIIR_LSB) -#define SIIR_SIIR_SET(x) (((32'd0 | (x)) << SIIR_SIIR_LSB) & SIIR_SIIR_MASK) -#define SIIR_SIIR_RESET 8'h0 -#define SIIR_RESET (32'h0 | \ - SIIR_SIIR_SET(SIIR_SIIR_RESET)) -#define SIIR_HW_MASK (32'h0) -#define SIIR_SW_MASK (32'h0 | \ - SIIR_SIIR_MASK) - -#define MWR_ADDRESS 'h0000002c -#define MWR_MWR_MSB 31 -#define MWR_MWR_LSB 0 -#define MWR_MWR_MASK 'hffffffff -#define MWR_MWR_GET(x) (((x) & MWR_MWR_MASK) >> MWR_MWR_LSB) -#define MWR_MWR_SET(x) (((32'd0 | (x)) << MWR_MWR_LSB) & MWR_MWR_MASK) -#define MWR_MWR_RESET 32'h0 -#define MWR_RESET (32'h0 | \ - MWR_MWR_SET(MWR_MWR_RESET)) -#define MWR_HW_MASK (32'h0) -#define MWR_SW_MASK (32'h0 | \ - MWR_MWR_MASK) - -#define SLSR_ADDRESS 'h00000034 -#define SLSR_SLSR_MSB 7 -#define SLSR_SLSR_LSB 0 -#define SLSR_SLSR_MASK 'h000000ff -#define SLSR_SLSR_GET(x) (((x) & SLSR_SLSR_MASK) >> SLSR_SLSR_LSB) -#define SLSR_SLSR_SET(x) (((32'd0 | (x)) << SLSR_SLSR_LSB) & SLSR_SLSR_MASK) -#define SLSR_SLSR_RESET 8'h0 -#define SLSR_RESET (32'h0 | \ - SLSR_SLSR_SET(SLSR_SLSR_RESET)) -#define SLSR_HW_MASK (32'h0) -#define SLSR_SW_MASK (32'h0 | \ - SLSR_SLSR_MASK) - -#define SMSR_ADDRESS 'h00000038 -#define SMSR_SMSR_MSB 7 -#define SMSR_SMSR_LSB 0 -#define SMSR_SMSR_MASK 'h000000ff -#define SMSR_SMSR_GET(x) (((x) & SMSR_SMSR_MASK) >> SMSR_SMSR_LSB) -#define SMSR_SMSR_SET(x) (((32'd0 | (x)) << SMSR_SMSR_LSB) & SMSR_SMSR_MASK) -#define SMSR_SMSR_RESET 8'h0 -#define SMSR_RESET (32'h0 | \ - SMSR_SMSR_SET(SMSR_SMSR_RESET)) -#define SMSR_HW_MASK (32'h0) -#define SMSR_SW_MASK (32'h0 | \ - SMSR_SMSR_MASK) - -#define MRR_ADDRESS 'h0000003c -#define MRR_MRR_MSB 31 -#define MRR_MRR_LSB 0 -#define MRR_MRR_MASK 'hffffffff -#define MRR_MRR_GET(x) (((x) & MRR_MRR_MASK) >> MRR_MRR_LSB) -#define MRR_MRR_SET(x) (((32'd0 | (x)) << MRR_MRR_LSB) & MRR_MRR_MASK) -#define MRR_MRR_RESET 32'h0 -#define MRR_RESET (32'h0 | \ - MRR_MRR_SET(MRR_MRR_RESET)) -#define MRR_HW_MASK (32'h0) -#define MRR_SW_MASK (32'h0 | \ - MRR_MRR_MASK) - -#define UART_REG_ADDRESS_MSB 5 - -#endif /* _UART_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/vmc_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/vmc_reg.h deleted file mode 100644 index 932ec510d26b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/vmc_reg.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef _VMC_REG_REG_H_ -#define _VMC_REG_REG_H_ - -#define MC_TCAM_VALID_ADDRESS 0x00000000 -#define MC_TCAM_VALID_OFFSET 0x00000000 -#define MC_TCAM_VALID_BIT_MSB 0 -#define MC_TCAM_VALID_BIT_LSB 0 -#define MC_TCAM_VALID_BIT_MASK 0x00000001 -#define MC_TCAM_VALID_BIT_GET(x) (((x) & MC_TCAM_VALID_BIT_MASK) >> MC_TCAM_VALID_BIT_LSB) -#define MC_TCAM_VALID_BIT_SET(x) (((x) << MC_TCAM_VALID_BIT_LSB) & MC_TCAM_VALID_BIT_MASK) - -#define MC_TCAM_MASK_ADDRESS 0x00000080 -#define MC_TCAM_MASK_OFFSET 0x00000080 -#define MC_TCAM_MASK_SIZE_MSB 2 -#define MC_TCAM_MASK_SIZE_LSB 0 -#define MC_TCAM_MASK_SIZE_MASK 0x00000007 -#define MC_TCAM_MASK_SIZE_GET(x) (((x) & MC_TCAM_MASK_SIZE_MASK) >> MC_TCAM_MASK_SIZE_LSB) -#define MC_TCAM_MASK_SIZE_SET(x) (((x) << MC_TCAM_MASK_SIZE_LSB) & MC_TCAM_MASK_SIZE_MASK) - -#define MC_TCAM_COMPARE_ADDRESS 0x00000100 -#define MC_TCAM_COMPARE_OFFSET 0x00000100 -#define MC_TCAM_COMPARE_KEY_MSB 21 -#define MC_TCAM_COMPARE_KEY_LSB 5 -#define MC_TCAM_COMPARE_KEY_MASK 0x003fffe0 -#define MC_TCAM_COMPARE_KEY_GET(x) (((x) & MC_TCAM_COMPARE_KEY_MASK) >> MC_TCAM_COMPARE_KEY_LSB) -#define MC_TCAM_COMPARE_KEY_SET(x) (((x) << MC_TCAM_COMPARE_KEY_LSB) & MC_TCAM_COMPARE_KEY_MASK) - -#define MC_TCAM_TARGET_ADDRESS 0x00000180 -#define MC_TCAM_TARGET_OFFSET 0x00000180 -#define MC_TCAM_TARGET_ADDR_MSB 21 -#define MC_TCAM_TARGET_ADDR_LSB 5 -#define MC_TCAM_TARGET_ADDR_MASK 0x003fffe0 -#define MC_TCAM_TARGET_ADDR_GET(x) (((x) & MC_TCAM_TARGET_ADDR_MASK) >> MC_TCAM_TARGET_ADDR_LSB) -#define MC_TCAM_TARGET_ADDR_SET(x) (((x) << MC_TCAM_TARGET_ADDR_LSB) & MC_TCAM_TARGET_ADDR_MASK) - -#define ADDR_ERROR_CONTROL_ADDRESS 0x00000200 -#define ADDR_ERROR_CONTROL_OFFSET 0x00000200 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_MSB 1 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB 1 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK 0x00000002 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_GET(x) (((x) & ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK) >> ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB) -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_SET(x) (((x) << ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB) & ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK) -#define ADDR_ERROR_CONTROL_ENABLE_MSB 0 -#define ADDR_ERROR_CONTROL_ENABLE_LSB 0 -#define ADDR_ERROR_CONTROL_ENABLE_MASK 0x00000001 -#define ADDR_ERROR_CONTROL_ENABLE_GET(x) (((x) & ADDR_ERROR_CONTROL_ENABLE_MASK) >> ADDR_ERROR_CONTROL_ENABLE_LSB) -#define ADDR_ERROR_CONTROL_ENABLE_SET(x) (((x) << ADDR_ERROR_CONTROL_ENABLE_LSB) & ADDR_ERROR_CONTROL_ENABLE_MASK) - -#define ADDR_ERROR_STATUS_ADDRESS 0x00000204 -#define ADDR_ERROR_STATUS_OFFSET 0x00000204 -#define ADDR_ERROR_STATUS_WRITE_MSB 25 -#define ADDR_ERROR_STATUS_WRITE_LSB 25 -#define ADDR_ERROR_STATUS_WRITE_MASK 0x02000000 -#define ADDR_ERROR_STATUS_WRITE_GET(x) (((x) & ADDR_ERROR_STATUS_WRITE_MASK) >> ADDR_ERROR_STATUS_WRITE_LSB) -#define ADDR_ERROR_STATUS_WRITE_SET(x) (((x) << ADDR_ERROR_STATUS_WRITE_LSB) & ADDR_ERROR_STATUS_WRITE_MASK) -#define ADDR_ERROR_STATUS_ADDRESS_MSB 24 -#define ADDR_ERROR_STATUS_ADDRESS_LSB 0 -#define ADDR_ERROR_STATUS_ADDRESS_MASK 0x01ffffff -#define ADDR_ERROR_STATUS_ADDRESS_GET(x) (((x) & ADDR_ERROR_STATUS_ADDRESS_MASK) >> ADDR_ERROR_STATUS_ADDRESS_LSB) -#define ADDR_ERROR_STATUS_ADDRESS_SET(x) (((x) << ADDR_ERROR_STATUS_ADDRESS_LSB) & ADDR_ERROR_STATUS_ADDRESS_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct vmc_reg_reg_s { - volatile unsigned int mc_tcam_valid[32]; - volatile unsigned int mc_tcam_mask[32]; - volatile unsigned int mc_tcam_compare[32]; - volatile unsigned int mc_tcam_target[32]; - volatile unsigned int addr_error_control; - volatile unsigned int addr_error_status; -} vmc_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _VMC_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/vmc_reg.vrh b/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/vmc_reg.vrh deleted file mode 100644 index cd9b7e599390..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw2.0/hw/vmc_reg.vrh +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef _VMC_REG_VRH_ -#define _VMC_REG_VRH_ - -#define MC_TCAM_VALID_ADDRESS 'h00000000 -#define MC_TCAM_VALID_BIT_MSB 0 -#define MC_TCAM_VALID_BIT_LSB 0 -#define MC_TCAM_VALID_BIT_MASK 'h00000001 -#define MC_TCAM_VALID_BIT_GET(x) (((x) & MC_TCAM_VALID_BIT_MASK) >> MC_TCAM_VALID_BIT_LSB) -#define MC_TCAM_VALID_BIT_SET(x) (((32'd0 | (x)) << MC_TCAM_VALID_BIT_LSB) & MC_TCAM_VALID_BIT_MASK) -#define MC_TCAM_VALID_BIT_RESET 1'h0 -#define MC_TCAM_VALID_RESET (32'h0 | \ - MC_TCAM_VALID_BIT_SET(MC_TCAM_VALID_BIT_RESET)) -#define MC_TCAM_VALID_HW_MASK (32'h0) -#define MC_TCAM_VALID_SW_MASK (32'h0 | \ - MC_TCAM_VALID_BIT_MASK) - -#define MC_TCAM_MASK_ADDRESS 'h00000080 -#define MC_TCAM_MASK_SIZE_MSB 2 -#define MC_TCAM_MASK_SIZE_LSB 0 -#define MC_TCAM_MASK_SIZE_MASK 'h00000007 -#define MC_TCAM_MASK_SIZE_GET(x) (((x) & MC_TCAM_MASK_SIZE_MASK) >> MC_TCAM_MASK_SIZE_LSB) -#define MC_TCAM_MASK_SIZE_SET(x) (((32'd0 | (x)) << MC_TCAM_MASK_SIZE_LSB) & MC_TCAM_MASK_SIZE_MASK) -#define MC_TCAM_MASK_SIZE_RESET 3'h0 -#define MC_TCAM_MASK_RESET (32'h0 | \ - MC_TCAM_MASK_SIZE_SET(MC_TCAM_MASK_SIZE_RESET)) -#define MC_TCAM_MASK_HW_MASK (32'h0) -#define MC_TCAM_MASK_SW_MASK (32'h0 | \ - MC_TCAM_MASK_SIZE_MASK) - -#define MC_TCAM_COMPARE_ADDRESS 'h00000100 -#define MC_TCAM_COMPARE_KEY_MSB 21 -#define MC_TCAM_COMPARE_KEY_LSB 5 -#define MC_TCAM_COMPARE_KEY_MASK 'h003fffe0 -#define MC_TCAM_COMPARE_KEY_GET(x) (((x) & MC_TCAM_COMPARE_KEY_MASK) >> MC_TCAM_COMPARE_KEY_LSB) -#define MC_TCAM_COMPARE_KEY_SET(x) (((32'd0 | (x)) << MC_TCAM_COMPARE_KEY_LSB) & MC_TCAM_COMPARE_KEY_MASK) -#define MC_TCAM_COMPARE_KEY_RESET 17'h0 -#define MC_TCAM_COMPARE_RESET (32'h0 | \ - MC_TCAM_COMPARE_KEY_SET(MC_TCAM_COMPARE_KEY_RESET)) -#define MC_TCAM_COMPARE_HW_MASK (32'h0) -#define MC_TCAM_COMPARE_SW_MASK (32'h0 | \ - MC_TCAM_COMPARE_KEY_MASK) - -#define MC_TCAM_TARGET_ADDRESS 'h00000180 -#define MC_TCAM_TARGET_ADDR_MSB 21 -#define MC_TCAM_TARGET_ADDR_LSB 5 -#define MC_TCAM_TARGET_ADDR_MASK 'h003fffe0 -#define MC_TCAM_TARGET_ADDR_GET(x) (((x) & MC_TCAM_TARGET_ADDR_MASK) >> MC_TCAM_TARGET_ADDR_LSB) -#define MC_TCAM_TARGET_ADDR_SET(x) (((32'd0 | (x)) << MC_TCAM_TARGET_ADDR_LSB) & MC_TCAM_TARGET_ADDR_MASK) -#define MC_TCAM_TARGET_ADDR_RESET 17'h0 -#define MC_TCAM_TARGET_RESET (32'h0 | \ - MC_TCAM_TARGET_ADDR_SET(MC_TCAM_TARGET_ADDR_RESET)) -#define MC_TCAM_TARGET_HW_MASK (32'h0) -#define MC_TCAM_TARGET_SW_MASK (32'h0 | \ - MC_TCAM_TARGET_ADDR_MASK) - -#define ADDR_ERROR_CONTROL_ADDRESS 'h00000200 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_MSB 1 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB 1 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK 'h00000002 -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_GET(x) (((x) & ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK) >> ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB) -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_SET(x) (((32'd0 | (x)) << ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB) & ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK) -#define ADDR_ERROR_CONTROL_QUAL_ENABLE_RESET 1'h0 -#define ADDR_ERROR_CONTROL_ENABLE_MSB 0 -#define ADDR_ERROR_CONTROL_ENABLE_LSB 0 -#define ADDR_ERROR_CONTROL_ENABLE_MASK 'h00000001 -#define ADDR_ERROR_CONTROL_ENABLE_GET(x) (((x) & ADDR_ERROR_CONTROL_ENABLE_MASK) >> ADDR_ERROR_CONTROL_ENABLE_LSB) -#define ADDR_ERROR_CONTROL_ENABLE_SET(x) (((32'd0 | (x)) << ADDR_ERROR_CONTROL_ENABLE_LSB) & ADDR_ERROR_CONTROL_ENABLE_MASK) -#define ADDR_ERROR_CONTROL_ENABLE_RESET 1'h0 -#define ADDR_ERROR_CONTROL_RESET (32'h0 | \ - ADDR_ERROR_CONTROL_QUAL_ENABLE_SET(ADDR_ERROR_CONTROL_QUAL_ENABLE_RESET) | \ - ADDR_ERROR_CONTROL_ENABLE_SET(ADDR_ERROR_CONTROL_ENABLE_RESET)) -#define ADDR_ERROR_CONTROL_HW_MASK (32'h0) -#define ADDR_ERROR_CONTROL_SW_MASK (32'h0 | \ - ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK | \ - ADDR_ERROR_CONTROL_ENABLE_MASK) - -#define ADDR_ERROR_STATUS_ADDRESS 'h00000204 -#define ADDR_ERROR_STATUS_WRITE_MSB 25 -#define ADDR_ERROR_STATUS_WRITE_LSB 25 -#define ADDR_ERROR_STATUS_WRITE_MASK 'h02000000 -#define ADDR_ERROR_STATUS_WRITE_GET(x) (((x) & ADDR_ERROR_STATUS_WRITE_MASK) >> ADDR_ERROR_STATUS_WRITE_LSB) -#define ADDR_ERROR_STATUS_WRITE_SET(x) (((32'd0 | (x)) << ADDR_ERROR_STATUS_WRITE_LSB) & ADDR_ERROR_STATUS_WRITE_MASK) -#define ADDR_ERROR_STATUS_WRITE_RESET 1'h0 -#define ADDR_ERROR_STATUS_ADDRESS_MSB 24 -#define ADDR_ERROR_STATUS_ADDRESS_LSB 0 -#define ADDR_ERROR_STATUS_ADDRESS_MASK 'h01ffffff -#define ADDR_ERROR_STATUS_ADDRESS_GET(x) (((x) & ADDR_ERROR_STATUS_ADDRESS_MASK) >> ADDR_ERROR_STATUS_ADDRESS_LSB) -#define ADDR_ERROR_STATUS_ADDRESS_SET(x) (((32'd0 | (x)) << ADDR_ERROR_STATUS_ADDRESS_LSB) & ADDR_ERROR_STATUS_ADDRESS_MASK) -#define ADDR_ERROR_STATUS_ADDRESS_RESET 25'h0 -#define ADDR_ERROR_STATUS_RESET (32'h0 | \ - ADDR_ERROR_STATUS_WRITE_SET(ADDR_ERROR_STATUS_WRITE_RESET) | \ - ADDR_ERROR_STATUS_ADDRESS_SET(ADDR_ERROR_STATUS_ADDRESS_RESET)) -#define ADDR_ERROR_STATUS_HW_MASK (32'h0 | \ - ADDR_ERROR_STATUS_WRITE_MASK | \ - ADDR_ERROR_STATUS_ADDRESS_MASK) -#define ADDR_ERROR_STATUS_SW_MASK (32'h0) - -#define VMC_REG_ADDRESS_MSB 9 - -#endif /* _VMC_REG_VRH_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/analog_intf_ares_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/analog_intf_ares_reg.h deleted file mode 100644 index e504319412b9..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/analog_intf_ares_reg.h +++ /dev/null @@ -1,3291 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2009 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _ANALOG_INTF_ARES_REG_REG_H_ -#define _ANALOG_INTF_ARES_REG_REG_H_ - - -/* macros for RXRF_BIAS1 */ -#define PHY_ANALOG_RXRF_BIAS1_ADDRESS 0x00000000 -#define PHY_ANALOG_RXRF_BIAS1_OFFSET 0x00000000 -#define PHY_ANALOG_RXRF_BIAS1_SPARE_MSB 0 -#define PHY_ANALOG_RXRF_BIAS1_SPARE_LSB 0 -#define PHY_ANALOG_RXRF_BIAS1_SPARE_MASK 0x00000001 -#define PHY_ANALOG_RXRF_BIAS1_SPARE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXRF_BIAS1_SPARE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_MSB 3 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_LSB 1 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_MASK 0x0000000e -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_MSB 6 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_LSB 4 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_MASK 0x00000070 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_GET(x) (((x) & 0x00000070) >> 4) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_SET(x) (((x) << 4) & 0x00000070) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_MSB 9 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_LSB 7 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_MASK 0x00000380 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_GET(x) (((x) & 0x00000380) >> 7) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_SET(x) (((x) << 7) & 0x00000380) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_MSB 12 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_LSB 10 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_MASK 0x00001c00 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_GET(x) (((x) & 0x00001c00) >> 10) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_SET(x) (((x) << 10) & 0x00001c00) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_MSB 15 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_LSB 13 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_MASK 0x0000e000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_GET(x) (((x) & 0x0000e000) >> 13) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_SET(x) (((x) << 13) & 0x0000e000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_MSB 18 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_LSB 16 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_MASK 0x00070000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_GET(x) (((x) & 0x00070000) >> 16) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_SET(x) (((x) << 16) & 0x00070000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_MSB 21 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_LSB 19 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_MASK 0x00380000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_GET(x) (((x) & 0x00380000) >> 19) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_SET(x) (((x) << 19) & 0x00380000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_MSB 24 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_LSB 22 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_MASK 0x01c00000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_GET(x) (((x) & 0x01c00000) >> 22) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_SET(x) (((x) << 22) & 0x01c00000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_MSB 27 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_LSB 25 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_MASK 0x0e000000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_GET(x) (((x) & 0x0e000000) >> 25) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_SET(x) (((x) << 25) & 0x0e000000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_MSB 30 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_LSB 28 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_MASK 0x70000000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_GET(x) (((x) & 0x70000000) >> 28) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_SET(x) (((x) << 28) & 0x70000000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_MSB 31 -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_LSB 31 -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_MASK 0x80000000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_SET(x) (((x) << 31) & 0x80000000) - -/* macros for RXRF_BIAS2 */ -#define PHY_ANALOG_RXRF_BIAS2_ADDRESS 0x00000004 -#define PHY_ANALOG_RXRF_BIAS2_OFFSET 0x00000004 -#define PHY_ANALOG_RXRF_BIAS2_SPARE_MSB 0 -#define PHY_ANALOG_RXRF_BIAS2_SPARE_LSB 0 -#define PHY_ANALOG_RXRF_BIAS2_SPARE_MASK 0x00000001 -#define PHY_ANALOG_RXRF_BIAS2_SPARE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXRF_BIAS2_SPARE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXRF_BIAS2_PKEN_MSB 3 -#define PHY_ANALOG_RXRF_BIAS2_PKEN_LSB 1 -#define PHY_ANALOG_RXRF_BIAS2_PKEN_MASK 0x0000000e -#define PHY_ANALOG_RXRF_BIAS2_PKEN_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_ANALOG_RXRF_BIAS2_PKEN_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_MSB 6 -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_LSB 4 -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_MASK 0x00000070 -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_GET(x) (((x) & 0x00000070) >> 4) -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_SET(x) (((x) << 4) & 0x00000070) -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_MSB 7 -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_LSB 7 -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_MASK 0x00000080 -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC5GH_MSB 10 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC5GH_LSB 8 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC5GH_MASK 0x00000700 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC5GH_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC5GH_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC5G_MSB 13 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC5G_LSB 11 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC5G_MASK 0x00003800 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC5G_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC5G_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC5G_MSB 16 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC5G_LSB 14 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC5G_MASK 0x0001c000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC5G_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC5G_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC2GH_MSB 19 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC2GH_LSB 17 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC2GH_MASK 0x000e0000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC2GH_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC2GH_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC2G_MSB 22 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC2G_LSB 20 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC2G_MASK 0x00700000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC2G_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC2G_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC2G_MSB 25 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC2G_LSB 23 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC2G_MASK 0x03800000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC2G_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC2G_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_MSB 28 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_LSB 26 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_MASK 0x1c000000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_MSB 31 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_LSB 29 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_MASK 0xe0000000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for RXRF_GAINSTAGES */ -#define PHY_ANALOG_RXRF_GAINSTAGES_ADDRESS 0x00000008 -#define PHY_ANALOG_RXRF_GAINSTAGES_OFFSET 0x00000008 -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_MSB 0 -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_LSB 0 -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_MASK 0x00000001 -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_MSB 1 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_LSB 1 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_MASK 0x00000002 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_MSB 3 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_LSB 2 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_MASK 0x0000000c -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_MSB 5 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_LSB 4 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_MASK 0x00000030 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_GET(x) (((x) & 0x00000030) >> 4) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_SET(x) (((x) << 4) & 0x00000030) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_MSB 6 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_LSB 6 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_MASK 0x00000040 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_MSB 7 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_LSB 7 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_MASK 0x00000080 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_MSB 8 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_LSB 8 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_MASK 0x00000100 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_MSB 9 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_LSB 9 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_MASK 0x00000200 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_MSB 10 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_LSB 10 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_MASK 0x00000400 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_MSB 12 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_LSB 11 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_MASK 0x00001800 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_GET(x) (((x) & 0x00001800) >> 11) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_SET(x) (((x) << 11) & 0x00001800) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_MSB 13 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_LSB 13 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_MASK 0x00002000 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_MSB 14 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_LSB 14 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_MASK 0x00004000 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_MSB 15 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_LSB 15 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_MASK 0x00008000 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_MSB 16 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_LSB 16 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_MASK 0x00010000 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_MSB 17 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_LSB 17 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_MASK 0x00020000 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_MSB 19 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_LSB 18 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_MASK 0x000c0000 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_GET(x) (((x) & 0x000c0000) >> 18) -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_SET(x) (((x) << 18) & 0x000c0000) -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_MSB 22 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_LSB 20 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_MASK 0x00700000 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_MSB 25 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_LSB 23 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_MASK 0x03800000 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_MSB 27 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_LSB 26 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_MASK 0x0c000000 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_GET(x) (((x) & 0x0c000000) >> 26) -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_SET(x) (((x) << 26) & 0x0c000000) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_MSB 30 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_LSB 28 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_MASK 0x70000000 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_GET(x) (((x) & 0x70000000) >> 28) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_SET(x) (((x) << 28) & 0x70000000) -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_MSB 31 -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_LSB 31 -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_MASK 0x80000000 -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for RXRF_AGC */ -#define PHY_ANALOG_RXRF_AGC_ADDRESS 0x0000000c -#define PHY_ANALOG_RXRF_AGC_OFFSET 0x0000000c -#define PHY_ANALOG_RXRF_AGC_SPARE_MSB 5 -#define PHY_ANALOG_RXRF_AGC_SPARE_LSB 0 -#define PHY_ANALOG_RXRF_AGC_SPARE_MASK 0x0000003f -#define PHY_ANALOG_RXRF_AGC_SPARE_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_ANALOG_RXRF_AGC_SPARE_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_MSB 8 -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_LSB 6 -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_MASK 0x000001c0 -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_GET(x) (((x) & 0x000001c0) >> 6) -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_SET(x) (((x) << 6) & 0x000001c0) -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_MSB 14 -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_LSB 9 -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_MASK 0x00007e00 -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_GET(x) (((x) & 0x00007e00) >> 9) -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_SET(x) (((x) << 9) & 0x00007e00) -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_MSB 18 -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_LSB 15 -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_MASK 0x00078000 -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_GET(x) (((x) & 0x00078000) >> 15) -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_SET(x) (((x) << 15) & 0x00078000) -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_MSB 24 -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_LSB 19 -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_MASK 0x01f80000 -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_GET(x) (((x) & 0x01f80000) >> 19) -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_SET(x) (((x) << 19) & 0x01f80000) -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_MSB 28 -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_LSB 25 -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_MASK 0x1e000000 -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_GET(x) (((x) & 0x1e000000) >> 25) -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_SET(x) (((x) << 25) & 0x1e000000) -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_MSB 29 -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_LSB 29 -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_MASK 0x20000000 -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_MSB 30 -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_LSB 30 -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_MASK 0x40000000 -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_MSB 31 -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_LSB 31 -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_MASK 0x80000000 -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TXRF1 */ -#define PHY_ANALOG_TXRF1_ADDRESS 0x00000040 -#define PHY_ANALOG_TXRF1_OFFSET 0x00000040 -#define PHY_ANALOG_TXRF1_DCAS2G_MSB 2 -#define PHY_ANALOG_TXRF1_DCAS2G_LSB 0 -#define PHY_ANALOG_TXRF1_DCAS2G_MASK 0x00000007 -#define PHY_ANALOG_TXRF1_DCAS2G_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_TXRF1_DCAS2G_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_TXRF1_OB2G_PALOFF_MSB 5 -#define PHY_ANALOG_TXRF1_OB2G_PALOFF_LSB 3 -#define PHY_ANALOG_TXRF1_OB2G_PALOFF_MASK 0x00000038 -#define PHY_ANALOG_TXRF1_OB2G_PALOFF_GET(x) (((x) & 0x00000038) >> 3) -#define PHY_ANALOG_TXRF1_OB2G_PALOFF_SET(x) (((x) << 3) & 0x00000038) -#define PHY_ANALOG_TXRF1_OB2G_QAM_MSB 8 -#define PHY_ANALOG_TXRF1_OB2G_QAM_LSB 6 -#define PHY_ANALOG_TXRF1_OB2G_QAM_MASK 0x000001c0 -#define PHY_ANALOG_TXRF1_OB2G_QAM_GET(x) (((x) & 0x000001c0) >> 6) -#define PHY_ANALOG_TXRF1_OB2G_QAM_SET(x) (((x) << 6) & 0x000001c0) -#define PHY_ANALOG_TXRF1_OB2G_PSK_MSB 11 -#define PHY_ANALOG_TXRF1_OB2G_PSK_LSB 9 -#define PHY_ANALOG_TXRF1_OB2G_PSK_MASK 0x00000e00 -#define PHY_ANALOG_TXRF1_OB2G_PSK_GET(x) (((x) & 0x00000e00) >> 9) -#define PHY_ANALOG_TXRF1_OB2G_PSK_SET(x) (((x) << 9) & 0x00000e00) -#define PHY_ANALOG_TXRF1_OB2G_CCK_MSB 14 -#define PHY_ANALOG_TXRF1_OB2G_CCK_LSB 12 -#define PHY_ANALOG_TXRF1_OB2G_CCK_MASK 0x00007000 -#define PHY_ANALOG_TXRF1_OB2G_CCK_GET(x) (((x) & 0x00007000) >> 12) -#define PHY_ANALOG_TXRF1_OB2G_CCK_SET(x) (((x) << 12) & 0x00007000) -#define PHY_ANALOG_TXRF1_DB2G_MSB 17 -#define PHY_ANALOG_TXRF1_DB2G_LSB 15 -#define PHY_ANALOG_TXRF1_DB2G_MASK 0x00038000 -#define PHY_ANALOG_TXRF1_DB2G_GET(x) (((x) & 0x00038000) >> 15) -#define PHY_ANALOG_TXRF1_DB2G_SET(x) (((x) << 15) & 0x00038000) -#define PHY_ANALOG_TXRF1_PDOUT2G_MSB 18 -#define PHY_ANALOG_TXRF1_PDOUT2G_LSB 18 -#define PHY_ANALOG_TXRF1_PDOUT2G_MASK 0x00040000 -#define PHY_ANALOG_TXRF1_PDOUT2G_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_TXRF1_PDOUT2G_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_TXRF1_PDDR2G_MSB 19 -#define PHY_ANALOG_TXRF1_PDDR2G_LSB 19 -#define PHY_ANALOG_TXRF1_PDDR2G_MASK 0x00080000 -#define PHY_ANALOG_TXRF1_PDDR2G_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_ANALOG_TXRF1_PDDR2G_SET(x) (((x) << 19) & 0x00080000) -#define PHY_ANALOG_TXRF1_PDMXR2G_MSB 20 -#define PHY_ANALOG_TXRF1_PDMXR2G_LSB 20 -#define PHY_ANALOG_TXRF1_PDMXR2G_MASK 0x00100000 -#define PHY_ANALOG_TXRF1_PDMXR2G_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_TXRF1_PDMXR2G_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_TXRF1_PDLO2G_MSB 21 -#define PHY_ANALOG_TXRF1_PDLO2G_LSB 21 -#define PHY_ANALOG_TXRF1_PDLO2G_MASK 0x00200000 -#define PHY_ANALOG_TXRF1_PDLO2G_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_TXRF1_PDLO2G_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_MSB 22 -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_LSB 22 -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_MASK 0x00400000 -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_MSB 23 -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_LSB 23 -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_MASK 0x00800000 -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_TXRF1_PADRVGN2G_MSB 30 -#define PHY_ANALOG_TXRF1_PADRVGN2G_LSB 24 -#define PHY_ANALOG_TXRF1_PADRVGN2G_MASK 0x7f000000 -#define PHY_ANALOG_TXRF1_PADRVGN2G_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_ANALOG_TXRF1_PADRVGN2G_SET(x) (((x) << 24) & 0x7f000000) -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_MSB 31 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_LSB 31 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_MASK 0x80000000 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TXRF2 */ -#define PHY_ANALOG_TXRF2_ADDRESS 0x00000044 -#define PHY_ANALOG_TXRF2_OFFSET 0x00000044 -#define PHY_ANALOG_TXRF2_SPARE2_MSB 0 -#define PHY_ANALOG_TXRF2_SPARE2_LSB 0 -#define PHY_ANALOG_TXRF2_SPARE2_MASK 0x00000001 -#define PHY_ANALOG_TXRF2_SPARE2_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_TXRF2_SPARE2_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_TXRF2_D3B5G_MSB 3 -#define PHY_ANALOG_TXRF2_D3B5G_LSB 1 -#define PHY_ANALOG_TXRF2_D3B5G_MASK 0x0000000e -#define PHY_ANALOG_TXRF2_D3B5G_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_ANALOG_TXRF2_D3B5G_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_ANALOG_TXRF2_D4B5G_MSB 6 -#define PHY_ANALOG_TXRF2_D4B5G_LSB 4 -#define PHY_ANALOG_TXRF2_D4B5G_MASK 0x00000070 -#define PHY_ANALOG_TXRF2_D4B5G_GET(x) (((x) & 0x00000070) >> 4) -#define PHY_ANALOG_TXRF2_D4B5G_SET(x) (((x) << 4) & 0x00000070) -#define PHY_ANALOG_TXRF2_PDOUT5G_MSB 10 -#define PHY_ANALOG_TXRF2_PDOUT5G_LSB 7 -#define PHY_ANALOG_TXRF2_PDOUT5G_MASK 0x00000780 -#define PHY_ANALOG_TXRF2_PDOUT5G_GET(x) (((x) & 0x00000780) >> 7) -#define PHY_ANALOG_TXRF2_PDOUT5G_SET(x) (((x) << 7) & 0x00000780) -#define PHY_ANALOG_TXRF2_PDMXR5G_MSB 11 -#define PHY_ANALOG_TXRF2_PDMXR5G_LSB 11 -#define PHY_ANALOG_TXRF2_PDMXR5G_MASK 0x00000800 -#define PHY_ANALOG_TXRF2_PDMXR5G_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_TXRF2_PDMXR5G_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_TXRF2_PDLOBUF5G_MSB 12 -#define PHY_ANALOG_TXRF2_PDLOBUF5G_LSB 12 -#define PHY_ANALOG_TXRF2_PDLOBUF5G_MASK 0x00001000 -#define PHY_ANALOG_TXRF2_PDLOBUF5G_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_TXRF2_PDLOBUF5G_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_TXRF2_PDLODIV5G_MSB 13 -#define PHY_ANALOG_TXRF2_PDLODIV5G_LSB 13 -#define PHY_ANALOG_TXRF2_PDLODIV5G_MASK 0x00002000 -#define PHY_ANALOG_TXRF2_PDLODIV5G_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_TXRF2_PDLODIV5G_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_TXRF2_LOBUF5GFORCED_MSB 14 -#define PHY_ANALOG_TXRF2_LOBUF5GFORCED_LSB 14 -#define PHY_ANALOG_TXRF2_LOBUF5GFORCED_MASK 0x00004000 -#define PHY_ANALOG_TXRF2_LOBUF5GFORCED_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_TXRF2_LOBUF5GFORCED_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_TXRF2_LODIV5GFORCED_MSB 15 -#define PHY_ANALOG_TXRF2_LODIV5GFORCED_LSB 15 -#define PHY_ANALOG_TXRF2_LODIV5GFORCED_MASK 0x00008000 -#define PHY_ANALOG_TXRF2_LODIV5GFORCED_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_TXRF2_LODIV5GFORCED_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_TXRF2_PADRV2GN5G_MSB 19 -#define PHY_ANALOG_TXRF2_PADRV2GN5G_LSB 16 -#define PHY_ANALOG_TXRF2_PADRV2GN5G_MASK 0x000f0000 -#define PHY_ANALOG_TXRF2_PADRV2GN5G_GET(x) (((x) & 0x000f0000) >> 16) -#define PHY_ANALOG_TXRF2_PADRV2GN5G_SET(x) (((x) << 16) & 0x000f0000) -#define PHY_ANALOG_TXRF2_PADRV3GN5G_MSB 23 -#define PHY_ANALOG_TXRF2_PADRV3GN5G_LSB 20 -#define PHY_ANALOG_TXRF2_PADRV3GN5G_MASK 0x00f00000 -#define PHY_ANALOG_TXRF2_PADRV3GN5G_GET(x) (((x) & 0x00f00000) >> 20) -#define PHY_ANALOG_TXRF2_PADRV3GN5G_SET(x) (((x) << 20) & 0x00f00000) -#define PHY_ANALOG_TXRF2_PADRV4GN5G_MSB 27 -#define PHY_ANALOG_TXRF2_PADRV4GN5G_LSB 24 -#define PHY_ANALOG_TXRF2_PADRV4GN5G_MASK 0x0f000000 -#define PHY_ANALOG_TXRF2_PADRV4GN5G_GET(x) (((x) & 0x0f000000) >> 24) -#define PHY_ANALOG_TXRF2_PADRV4GN5G_SET(x) (((x) << 24) & 0x0f000000) -#define PHY_ANALOG_TXRF2_LOCALTXGAIN5G_MSB 28 -#define PHY_ANALOG_TXRF2_LOCALTXGAIN5G_LSB 28 -#define PHY_ANALOG_TXRF2_LOCALTXGAIN5G_MASK 0x10000000 -#define PHY_ANALOG_TXRF2_LOCALTXGAIN5G_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_TXRF2_LOCALTXGAIN5G_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_TXRF2_OCAS2G_MSB 31 -#define PHY_ANALOG_TXRF2_OCAS2G_LSB 29 -#define PHY_ANALOG_TXRF2_OCAS2G_MASK 0xe0000000 -#define PHY_ANALOG_TXRF2_OCAS2G_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_TXRF2_OCAS2G_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for TXRF3 */ -#define PHY_ANALOG_TXRF3_ADDRESS 0x00000048 -#define PHY_ANALOG_TXRF3_OFFSET 0x00000048 -#define PHY_ANALOG_TXRF3_SPARE3_MSB 22 -#define PHY_ANALOG_TXRF3_SPARE3_LSB 0 -#define PHY_ANALOG_TXRF3_SPARE3_MASK 0x007fffff -#define PHY_ANALOG_TXRF3_SPARE3_GET(x) (((x) & 0x007fffff) >> 0) -#define PHY_ANALOG_TXRF3_SPARE3_SET(x) (((x) << 0) & 0x007fffff) -#define PHY_ANALOG_TXRF3_CAS5G_MSB 25 -#define PHY_ANALOG_TXRF3_CAS5G_LSB 23 -#define PHY_ANALOG_TXRF3_CAS5G_MASK 0x03800000 -#define PHY_ANALOG_TXRF3_CAS5G_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_TXRF3_CAS5G_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_TXRF3_OB5G_MSB 28 -#define PHY_ANALOG_TXRF3_OB5G_LSB 26 -#define PHY_ANALOG_TXRF3_OB5G_MASK 0x1c000000 -#define PHY_ANALOG_TXRF3_OB5G_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_TXRF3_OB5G_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_TXRF3_D2B5G_MSB 31 -#define PHY_ANALOG_TXRF3_D2B5G_LSB 29 -#define PHY_ANALOG_TXRF3_D2B5G_MASK 0xe0000000 -#define PHY_ANALOG_TXRF3_D2B5G_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_TXRF3_D2B5G_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for TXRF4 */ -#define PHY_ANALOG_TXRF4_ADDRESS 0x0000004c -#define PHY_ANALOG_TXRF4_OFFSET 0x0000004c -#define PHY_ANALOG_TXRF4_COMP2G_PSK_MSB 2 -#define PHY_ANALOG_TXRF4_COMP2G_PSK_LSB 0 -#define PHY_ANALOG_TXRF4_COMP2G_PSK_MASK 0x00000007 -#define PHY_ANALOG_TXRF4_COMP2G_PSK_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_TXRF4_COMP2G_PSK_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_TXRF4_COMP2G_CCK_MSB 5 -#define PHY_ANALOG_TXRF4_COMP2G_CCK_LSB 3 -#define PHY_ANALOG_TXRF4_COMP2G_CCK_MASK 0x00000038 -#define PHY_ANALOG_TXRF4_COMP2G_CCK_GET(x) (((x) & 0x00000038) >> 3) -#define PHY_ANALOG_TXRF4_COMP2G_CCK_SET(x) (((x) << 3) & 0x00000038) -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_MSB 8 -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_LSB 6 -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_MASK 0x000001c0 -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_GET(x) (((x) & 0x000001c0) >> 6) -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_SET(x) (((x) << 6) & 0x000001c0) -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_MSB 11 -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_LSB 9 -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_MASK 0x00000e00 -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_GET(x) (((x) & 0x00000e00) >> 9) -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_SET(x) (((x) << 9) & 0x00000e00) -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_MSB 14 -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_LSB 12 -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_MASK 0x00007000 -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_GET(x) (((x) & 0x00007000) >> 12) -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_SET(x) (((x) << 12) & 0x00007000) -#define PHY_ANALOG_TXRF4_AMP2CAS2G_MSB 17 -#define PHY_ANALOG_TXRF4_AMP2CAS2G_LSB 15 -#define PHY_ANALOG_TXRF4_AMP2CAS2G_MASK 0x00038000 -#define PHY_ANALOG_TXRF4_AMP2CAS2G_GET(x) (((x) & 0x00038000) >> 15) -#define PHY_ANALOG_TXRF4_AMP2CAS2G_SET(x) (((x) << 15) & 0x00038000) -#define PHY_ANALOG_TXRF4_FILTR2G_MSB 19 -#define PHY_ANALOG_TXRF4_FILTR2G_LSB 18 -#define PHY_ANALOG_TXRF4_FILTR2G_MASK 0x000c0000 -#define PHY_ANALOG_TXRF4_FILTR2G_GET(x) (((x) & 0x000c0000) >> 18) -#define PHY_ANALOG_TXRF4_FILTR2G_SET(x) (((x) << 18) & 0x000c0000) -#define PHY_ANALOG_TXRF4_PWDFB2_2G_MSB 20 -#define PHY_ANALOG_TXRF4_PWDFB2_2G_LSB 20 -#define PHY_ANALOG_TXRF4_PWDFB2_2G_MASK 0x00100000 -#define PHY_ANALOG_TXRF4_PWDFB2_2G_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_TXRF4_PWDFB2_2G_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_TXRF4_PWDFB1_2G_MSB 21 -#define PHY_ANALOG_TXRF4_PWDFB1_2G_LSB 21 -#define PHY_ANALOG_TXRF4_PWDFB1_2G_MASK 0x00200000 -#define PHY_ANALOG_TXRF4_PWDFB1_2G_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_TXRF4_PWDFB1_2G_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_TXRF4_PDFB2G_MSB 22 -#define PHY_ANALOG_TXRF4_PDFB2G_LSB 22 -#define PHY_ANALOG_TXRF4_PDFB2G_MASK 0x00400000 -#define PHY_ANALOG_TXRF4_PDFB2G_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_TXRF4_PDFB2G_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_TXRF4_RDIV5G_MSB 24 -#define PHY_ANALOG_TXRF4_RDIV5G_LSB 23 -#define PHY_ANALOG_TXRF4_RDIV5G_MASK 0x01800000 -#define PHY_ANALOG_TXRF4_RDIV5G_GET(x) (((x) & 0x01800000) >> 23) -#define PHY_ANALOG_TXRF4_RDIV5G_SET(x) (((x) << 23) & 0x01800000) -#define PHY_ANALOG_TXRF4_CAPDIV5G_MSB 27 -#define PHY_ANALOG_TXRF4_CAPDIV5G_LSB 25 -#define PHY_ANALOG_TXRF4_CAPDIV5G_MASK 0x0e000000 -#define PHY_ANALOG_TXRF4_CAPDIV5G_GET(x) (((x) & 0x0e000000) >> 25) -#define PHY_ANALOG_TXRF4_CAPDIV5G_SET(x) (((x) << 25) & 0x0e000000) -#define PHY_ANALOG_TXRF4_PDPREDIST5G_MSB 28 -#define PHY_ANALOG_TXRF4_PDPREDIST5G_LSB 28 -#define PHY_ANALOG_TXRF4_PDPREDIST5G_MASK 0x10000000 -#define PHY_ANALOG_TXRF4_PDPREDIST5G_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_TXRF4_PDPREDIST5G_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_TXRF4_RDIV2G_MSB 30 -#define PHY_ANALOG_TXRF4_RDIV2G_LSB 29 -#define PHY_ANALOG_TXRF4_RDIV2G_MASK 0x60000000 -#define PHY_ANALOG_TXRF4_RDIV2G_GET(x) (((x) & 0x60000000) >> 29) -#define PHY_ANALOG_TXRF4_RDIV2G_SET(x) (((x) << 29) & 0x60000000) -#define PHY_ANALOG_TXRF4_PDPREDIST2G_MSB 31 -#define PHY_ANALOG_TXRF4_PDPREDIST2G_LSB 31 -#define PHY_ANALOG_TXRF4_PDPREDIST2G_MASK 0x80000000 -#define PHY_ANALOG_TXRF4_PDPREDIST2G_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_TXRF4_PDPREDIST2G_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TXRF5 */ -#define PHY_ANALOG_TXRF5_ADDRESS 0x00000050 -#define PHY_ANALOG_TXRF5_OFFSET 0x00000050 -#define PHY_ANALOG_TXRF5_FBHI2G_MSB 0 -#define PHY_ANALOG_TXRF5_FBHI2G_LSB 0 -#define PHY_ANALOG_TXRF5_FBHI2G_MASK 0x00000001 -#define PHY_ANALOG_TXRF5_FBHI2G_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_TXRF5_FBLO2G_MSB 1 -#define PHY_ANALOG_TXRF5_FBLO2G_LSB 1 -#define PHY_ANALOG_TXRF5_FBLO2G_MASK 0x00000002 -#define PHY_ANALOG_TXRF5_FBLO2G_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_TXRF5_REFHI2G_MSB 4 -#define PHY_ANALOG_TXRF5_REFHI2G_LSB 2 -#define PHY_ANALOG_TXRF5_REFHI2G_MASK 0x0000001c -#define PHY_ANALOG_TXRF5_REFHI2G_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_ANALOG_TXRF5_REFHI2G_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_ANALOG_TXRF5_REFLO2G_MSB 7 -#define PHY_ANALOG_TXRF5_REFLO2G_LSB 5 -#define PHY_ANALOG_TXRF5_REFLO2G_MASK 0x000000e0 -#define PHY_ANALOG_TXRF5_REFLO2G_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_TXRF5_REFLO2G_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_MSB 9 -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_LSB 8 -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_MASK 0x00000300 -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_SET(x) (((x) << 8) & 0x00000300) -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_MSB 11 -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_LSB 10 -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_MASK 0x00000c00 -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_GET(x) (((x) & 0x00000c00) >> 10) -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_SET(x) (((x) << 10) & 0x00000c00) -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_MSB 13 -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_LSB 12 -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_MASK 0x00003000 -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_GET(x) (((x) & 0x00003000) >> 12) -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_SET(x) (((x) << 12) & 0x00003000) -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_MSB 15 -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_LSB 14 -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_MASK 0x0000c000 -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_GET(x) (((x) & 0x0000c000) >> 14) -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_SET(x) (((x) << 14) & 0x0000c000) -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_MSB 17 -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_LSB 16 -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_MASK 0x00030000 -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_GET(x) (((x) & 0x00030000) >> 16) -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_SET(x) (((x) << 16) & 0x00030000) -#define PHY_ANALOG_TXRF5_PK1B2G_CCK_MSB 19 -#define PHY_ANALOG_TXRF5_PK1B2G_CCK_LSB 18 -#define PHY_ANALOG_TXRF5_PK1B2G_CCK_MASK 0x000c0000 -#define PHY_ANALOG_TXRF5_PK1B2G_CCK_GET(x) (((x) & 0x000c0000) >> 18) -#define PHY_ANALOG_TXRF5_PK1B2G_CCK_SET(x) (((x) << 18) & 0x000c0000) -#define PHY_ANALOG_TXRF5_MIOB2G_QAM_MSB 22 -#define PHY_ANALOG_TXRF5_MIOB2G_QAM_LSB 20 -#define PHY_ANALOG_TXRF5_MIOB2G_QAM_MASK 0x00700000 -#define PHY_ANALOG_TXRF5_MIOB2G_QAM_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_TXRF5_MIOB2G_QAM_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_TXRF5_MIOB2G_PSK_MSB 25 -#define PHY_ANALOG_TXRF5_MIOB2G_PSK_LSB 23 -#define PHY_ANALOG_TXRF5_MIOB2G_PSK_MASK 0x03800000 -#define PHY_ANALOG_TXRF5_MIOB2G_PSK_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_TXRF5_MIOB2G_PSK_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_TXRF5_MIOB2G_CCK_MSB 28 -#define PHY_ANALOG_TXRF5_MIOB2G_CCK_LSB 26 -#define PHY_ANALOG_TXRF5_MIOB2G_CCK_MASK 0x1c000000 -#define PHY_ANALOG_TXRF5_MIOB2G_CCK_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_TXRF5_MIOB2G_CCK_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_TXRF5_COMP2G_QAM_MSB 31 -#define PHY_ANALOG_TXRF5_COMP2G_QAM_LSB 29 -#define PHY_ANALOG_TXRF5_COMP2G_QAM_MASK 0xe0000000 -#define PHY_ANALOG_TXRF5_COMP2G_QAM_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_TXRF5_COMP2G_QAM_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for TXRF6 */ -#define PHY_ANALOG_TXRF6_ADDRESS 0x00000054 -#define PHY_ANALOG_TXRF6_OFFSET 0x00000054 -#define PHY_ANALOG_TXRF6_SPARE6_MSB 0 -#define PHY_ANALOG_TXRF6_SPARE6_LSB 0 -#define PHY_ANALOG_TXRF6_SPARE6_MASK 0x00000001 -#define PHY_ANALOG_TXRF6_SPARE6_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_TXRF6_SPARE6_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_TXRF6_PAL_LOCKED_MSB 1 -#define PHY_ANALOG_TXRF6_PAL_LOCKED_LSB 1 -#define PHY_ANALOG_TXRF6_PAL_LOCKED_MASK 0x00000002 -#define PHY_ANALOG_TXRF6_PAL_LOCKED_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_TXRF6_PADRVGN2G_SMOUT_MSB 7 -#define PHY_ANALOG_TXRF6_PADRVGN2G_SMOUT_LSB 2 -#define PHY_ANALOG_TXRF6_PADRVGN2G_SMOUT_MASK 0x000000fc -#define PHY_ANALOG_TXRF6_PADRVGN2G_SMOUT_GET(x) (((x) & 0x000000fc) >> 2) -#define PHY_ANALOG_TXRF6_GAINSTEP2G_MSB 10 -#define PHY_ANALOG_TXRF6_GAINSTEP2G_LSB 8 -#define PHY_ANALOG_TXRF6_GAINSTEP2G_MASK 0x00000700 -#define PHY_ANALOG_TXRF6_GAINSTEP2G_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_TXRF6_GAINSTEP2G_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_MSB 11 -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_LSB 11 -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_MASK 0x00000800 -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_MSB 15 -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_LSB 12 -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_MASK 0x0000f000 -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_GET(x) (((x) & 0x0000f000) >> 12) -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_SET(x) (((x) << 12) & 0x0000f000) -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_MSB 18 -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_LSB 16 -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_MASK 0x00070000 -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_GET(x) (((x) & 0x00070000) >> 16) -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_SET(x) (((x) << 16) & 0x00070000) -#define PHY_ANALOG_TXRF6_CAPDIV2G_MSB 21 -#define PHY_ANALOG_TXRF6_CAPDIV2G_LSB 19 -#define PHY_ANALOG_TXRF6_CAPDIV2G_MASK 0x00380000 -#define PHY_ANALOG_TXRF6_CAPDIV2G_GET(x) (((x) & 0x00380000) >> 19) -#define PHY_ANALOG_TXRF6_CAPDIV2G_SET(x) (((x) << 19) & 0x00380000) -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_MSB 22 -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_LSB 22 -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_MASK 0x00400000 -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_TXRF6_ENPACAL2G_MSB 23 -#define PHY_ANALOG_TXRF6_ENPACAL2G_LSB 23 -#define PHY_ANALOG_TXRF6_ENPACAL2G_MASK 0x00800000 -#define PHY_ANALOG_TXRF6_ENPACAL2G_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_TXRF6_ENPACAL2G_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_TXRF6_OFFSET2G_MSB 30 -#define PHY_ANALOG_TXRF6_OFFSET2G_LSB 24 -#define PHY_ANALOG_TXRF6_OFFSET2G_MASK 0x7f000000 -#define PHY_ANALOG_TXRF6_OFFSET2G_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_ANALOG_TXRF6_OFFSET2G_SET(x) (((x) << 24) & 0x7f000000) -#define PHY_ANALOG_TXRF6_ENOFFSETCAL2G_MSB 31 -#define PHY_ANALOG_TXRF6_ENOFFSETCAL2G_LSB 31 -#define PHY_ANALOG_TXRF6_ENOFFSETCAL2G_MASK 0x80000000 -#define PHY_ANALOG_TXRF6_ENOFFSETCAL2G_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_TXRF6_ENOFFSETCAL2G_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TXRF7 */ -#define PHY_ANALOG_TXRF7_ADDRESS 0x00000058 -#define PHY_ANALOG_TXRF7_OFFSET 0x00000058 -#define PHY_ANALOG_TXRF7_SPARE7_MSB 1 -#define PHY_ANALOG_TXRF7_SPARE7_LSB 0 -#define PHY_ANALOG_TXRF7_SPARE7_MASK 0x00000003 -#define PHY_ANALOG_TXRF7_SPARE7_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF7_SPARE7_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_MSB 7 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_LSB 2 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_MASK 0x000000fc -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_GET(x) (((x) & 0x000000fc) >> 2) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_SET(x) (((x) << 2) & 0x000000fc) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_MSB 13 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_LSB 8 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_MASK 0x00003f00 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_MSB 19 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_LSB 14 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_MASK 0x000fc000 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_GET(x) (((x) & 0x000fc000) >> 14) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_SET(x) (((x) << 14) & 0x000fc000) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_MSB 25 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_LSB 20 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_MASK 0x03f00000 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_GET(x) (((x) & 0x03f00000) >> 20) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_SET(x) (((x) << 20) & 0x03f00000) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_MSB 31 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_LSB 26 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_MASK 0xfc000000 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_GET(x) (((x) & 0xfc000000) >> 26) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_SET(x) (((x) << 26) & 0xfc000000) - -/* macros for TXRF8 */ -#define PHY_ANALOG_TXRF8_ADDRESS 0x0000005c -#define PHY_ANALOG_TXRF8_OFFSET 0x0000005c -#define PHY_ANALOG_TXRF8_SPARE8_MSB 1 -#define PHY_ANALOG_TXRF8_SPARE8_LSB 0 -#define PHY_ANALOG_TXRF8_SPARE8_MASK 0x00000003 -#define PHY_ANALOG_TXRF8_SPARE8_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF8_SPARE8_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_MSB 7 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_LSB 2 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_MASK 0x000000fc -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_GET(x) (((x) & 0x000000fc) >> 2) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_SET(x) (((x) << 2) & 0x000000fc) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_MSB 13 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_LSB 8 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_MASK 0x00003f00 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_MSB 19 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_LSB 14 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_MASK 0x000fc000 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_GET(x) (((x) & 0x000fc000) >> 14) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_SET(x) (((x) << 14) & 0x000fc000) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_MSB 25 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_LSB 20 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_MASK 0x03f00000 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_GET(x) (((x) & 0x03f00000) >> 20) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_SET(x) (((x) << 20) & 0x03f00000) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_MSB 31 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_LSB 26 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_MASK 0xfc000000 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_GET(x) (((x) & 0xfc000000) >> 26) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_SET(x) (((x) << 26) & 0xfc000000) - -/* macros for TXRF9 */ -#define PHY_ANALOG_TXRF9_ADDRESS 0x00000060 -#define PHY_ANALOG_TXRF9_OFFSET 0x00000060 -#define PHY_ANALOG_TXRF9_SPARE9_MSB 1 -#define PHY_ANALOG_TXRF9_SPARE9_LSB 0 -#define PHY_ANALOG_TXRF9_SPARE9_MASK 0x00000003 -#define PHY_ANALOG_TXRF9_SPARE9_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF9_SPARE9_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_MSB 7 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_LSB 2 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_MASK 0x000000fc -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_GET(x) (((x) & 0x000000fc) >> 2) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_SET(x) (((x) << 2) & 0x000000fc) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_MSB 13 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_LSB 8 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_MASK 0x00003f00 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_MSB 19 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_LSB 14 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_MASK 0x000fc000 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_GET(x) (((x) & 0x000fc000) >> 14) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_SET(x) (((x) << 14) & 0x000fc000) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_MSB 25 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_LSB 20 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_MASK 0x03f00000 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_GET(x) (((x) & 0x03f00000) >> 20) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_SET(x) (((x) << 20) & 0x03f00000) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_MSB 31 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_LSB 26 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_MASK 0xfc000000 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_GET(x) (((x) & 0xfc000000) >> 26) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_SET(x) (((x) << 26) & 0xfc000000) - -/* macros for TXRF10 */ -#define PHY_ANALOG_TXRF10_ADDRESS 0x00000064 -#define PHY_ANALOG_TXRF10_OFFSET 0x00000064 -#define PHY_ANALOG_TXRF10_SPARE10_MSB 12 -#define PHY_ANALOG_TXRF10_SPARE10_LSB 0 -#define PHY_ANALOG_TXRF10_SPARE10_MASK 0x00001fff -#define PHY_ANALOG_TXRF10_SPARE10_GET(x) (((x) & 0x00001fff) >> 0) -#define PHY_ANALOG_TXRF10_SPARE10_SET(x) (((x) << 0) & 0x00001fff) -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_MSB 13 -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_LSB 13 -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_MASK 0x00002000 -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_TXRF10_D3B5GCALTX_MSB 16 -#define PHY_ANALOG_TXRF10_D3B5GCALTX_LSB 14 -#define PHY_ANALOG_TXRF10_D3B5GCALTX_MASK 0x0001c000 -#define PHY_ANALOG_TXRF10_D3B5GCALTX_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_TXRF10_D3B5GCALTX_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_TXRF10_D4B5GCALTX_MSB 19 -#define PHY_ANALOG_TXRF10_D4B5GCALTX_LSB 17 -#define PHY_ANALOG_TXRF10_D4B5GCALTX_MASK 0x000e0000 -#define PHY_ANALOG_TXRF10_D4B5GCALTX_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_TXRF10_D4B5GCALTX_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_MSB 26 -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_LSB 20 -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_MASK 0x07f00000 -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_GET(x) (((x) & 0x07f00000) >> 20) -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_SET(x) (((x) << 20) & 0x07f00000) -#define PHY_ANALOG_TXRF10_DB2GCALTX_MSB 29 -#define PHY_ANALOG_TXRF10_DB2GCALTX_LSB 27 -#define PHY_ANALOG_TXRF10_DB2GCALTX_MASK 0x38000000 -#define PHY_ANALOG_TXRF10_DB2GCALTX_GET(x) (((x) & 0x38000000) >> 27) -#define PHY_ANALOG_TXRF10_DB2GCALTX_SET(x) (((x) << 27) & 0x38000000) -#define PHY_ANALOG_TXRF10_CALTXSHIFT_MSB 30 -#define PHY_ANALOG_TXRF10_CALTXSHIFT_LSB 30 -#define PHY_ANALOG_TXRF10_CALTXSHIFT_MASK 0x40000000 -#define PHY_ANALOG_TXRF10_CALTXSHIFT_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_TXRF10_CALTXSHIFT_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_MSB 31 -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_LSB 31 -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_MASK 0x80000000 -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TXRF11 */ -#define PHY_ANALOG_TXRF11_ADDRESS 0x00000068 -#define PHY_ANALOG_TXRF11_OFFSET 0x00000068 -#define PHY_ANALOG_TXRF11_SPARE11_MSB 1 -#define PHY_ANALOG_TXRF11_SPARE11_LSB 0 -#define PHY_ANALOG_TXRF11_SPARE11_MASK 0x00000003 -#define PHY_ANALOG_TXRF11_SPARE11_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF11_SPARE11_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS5G_MSB 4 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS5G_LSB 2 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS5G_MASK 0x0000001c -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS5G_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS5G_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_MSB 7 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_LSB 5 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_MASK 0x000000e0 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_MSB 10 -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_LSB 8 -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_MASK 0x00000700 -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_MSB 13 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_LSB 11 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_MASK 0x00003800 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_MSB 16 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_LSB 14 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_MASK 0x0001c000 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_MSB 19 -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_LSB 17 -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_MASK 0x000e0000 -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_MSB 22 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_LSB 20 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_MASK 0x00700000 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_MSB 25 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_LSB 23 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_MASK 0x03800000 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_MSB 28 -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_LSB 26 -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_MASK 0x1c000000 -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_MSB 31 -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_LSB 29 -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_MASK 0xe0000000 -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for TXRF12 */ -#define PHY_ANALOG_TXRF12_ADDRESS 0x0000006c -#define PHY_ANALOG_TXRF12_OFFSET 0x0000006c -#define PHY_ANALOG_TXRF12_SPARE12_2_MSB 7 -#define PHY_ANALOG_TXRF12_SPARE12_2_LSB 0 -#define PHY_ANALOG_TXRF12_SPARE12_2_MASK 0x000000ff -#define PHY_ANALOG_TXRF12_SPARE12_2_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_ANALOG_TXRF12_SPARE12_1_MSB 15 -#define PHY_ANALOG_TXRF12_SPARE12_1_LSB 8 -#define PHY_ANALOG_TXRF12_SPARE12_1_MASK 0x0000ff00 -#define PHY_ANALOG_TXRF12_SPARE12_1_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_ANALOG_TXRF12_SPARE12_1_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_ANALOG_TXRF12_ATBSEL5G_MSB 19 -#define PHY_ANALOG_TXRF12_ATBSEL5G_LSB 16 -#define PHY_ANALOG_TXRF12_ATBSEL5G_MASK 0x000f0000 -#define PHY_ANALOG_TXRF12_ATBSEL5G_GET(x) (((x) & 0x000f0000) >> 16) -#define PHY_ANALOG_TXRF12_ATBSEL5G_SET(x) (((x) << 16) & 0x000f0000) -#define PHY_ANALOG_TXRF12_ATBSEL2G_MSB 22 -#define PHY_ANALOG_TXRF12_ATBSEL2G_LSB 20 -#define PHY_ANALOG_TXRF12_ATBSEL2G_MASK 0x00700000 -#define PHY_ANALOG_TXRF12_ATBSEL2G_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_TXRF12_ATBSEL2G_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_MSB 25 -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_LSB 23 -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_MASK 0x03800000 -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_MSB 28 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_LSB 26 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_MASK 0x1c000000 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_MSB 31 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_LSB 29 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_MASK 0xe0000000 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for SYNTH1 */ -#define PHY_ANALOG_SYNTH1_ADDRESS 0x00000080 -#define PHY_ANALOG_SYNTH1_OFFSET 0x00000080 -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_MSB 2 -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_LSB 0 -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_MASK 0x00000007 -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_MSB 5 -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_LSB 3 -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_MASK 0x00000038 -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_GET(x) (((x) & 0x00000038) >> 3) -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_SET(x) (((x) << 3) & 0x00000038) -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_MSB 6 -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB 6 -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK 0x00000040 -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_MSB 7 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_LSB 7 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_MASK 0x00000080 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_MSB 8 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_LSB 8 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_MASK 0x00000100 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_MSB 9 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_LSB 9 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_MASK 0x00000200 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_SYNTH1_MONITOR_REF_MSB 10 -#define PHY_ANALOG_SYNTH1_MONITOR_REF_LSB 10 -#define PHY_ANALOG_SYNTH1_MONITOR_REF_MASK 0x00000400 -#define PHY_ANALOG_SYNTH1_MONITOR_REF_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_SYNTH1_MONITOR_REF_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_SYNTH1_MONITOR_FB_MSB 11 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_LSB 11 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_MASK 0x00000800 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_SYNTH1_MONITOR_FB_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_MSB 12 -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_LSB 12 -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_MASK 0x00001000 -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_SYNTH1_PWUP_PD_MSB 15 -#define PHY_ANALOG_SYNTH1_PWUP_PD_LSB 13 -#define PHY_ANALOG_SYNTH1_PWUP_PD_MASK 0x0000e000 -#define PHY_ANALOG_SYNTH1_PWUP_PD_GET(x) (((x) & 0x0000e000) >> 13) -#define PHY_ANALOG_SYNTH1_PWUP_PD_SET(x) (((x) << 13) & 0x0000e000) -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_MSB 16 -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_LSB 16 -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_MASK 0x00010000 -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_MSB 18 -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_LSB 17 -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_MASK 0x00060000 -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_GET(x) (((x) & 0x00060000) >> 17) -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_SET(x) (((x) << 17) & 0x00060000) -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_MSB 20 -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_LSB 19 -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_MASK 0x00180000 -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_GET(x) (((x) & 0x00180000) >> 19) -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_SET(x) (((x) << 19) & 0x00180000) -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_MSB 21 -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_LSB 21 -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_MASK 0x00200000 -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_MSB 22 -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_LSB 22 -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_MASK 0x00400000 -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_MSB 23 -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_LSB 23 -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_MASK 0x00800000 -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_SYNTH1_PWD_LODIV_MSB 24 -#define PHY_ANALOG_SYNTH1_PWD_LODIV_LSB 24 -#define PHY_ANALOG_SYNTH1_PWD_LODIV_MASK 0x01000000 -#define PHY_ANALOG_SYNTH1_PWD_LODIV_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_ANALOG_SYNTH1_PWD_LODIV_SET(x) (((x) << 24) & 0x01000000) -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_MSB 25 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_LSB 25 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_MASK 0x02000000 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_SET(x) (((x) << 25) & 0x02000000) -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_MSB 26 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_LSB 26 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_MASK 0x04000000 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_SYNTH1_PWD_PRESC_MSB 27 -#define PHY_ANALOG_SYNTH1_PWD_PRESC_LSB 27 -#define PHY_ANALOG_SYNTH1_PWD_PRESC_MASK 0x08000000 -#define PHY_ANALOG_SYNTH1_PWD_PRESC_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_SYNTH1_PWD_PRESC_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_SYNTH1_PWD_VCO_MSB 28 -#define PHY_ANALOG_SYNTH1_PWD_VCO_LSB 28 -#define PHY_ANALOG_SYNTH1_PWD_VCO_MASK 0x10000000 -#define PHY_ANALOG_SYNTH1_PWD_VCO_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_SYNTH1_PWD_VCO_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_SYNTH1_PWD_VCMON_MSB 29 -#define PHY_ANALOG_SYNTH1_PWD_VCMON_LSB 29 -#define PHY_ANALOG_SYNTH1_PWD_VCMON_MASK 0x20000000 -#define PHY_ANALOG_SYNTH1_PWD_VCMON_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_SYNTH1_PWD_VCMON_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_SYNTH1_PWD_CP_MSB 30 -#define PHY_ANALOG_SYNTH1_PWD_CP_LSB 30 -#define PHY_ANALOG_SYNTH1_PWD_CP_MASK 0x40000000 -#define PHY_ANALOG_SYNTH1_PWD_CP_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_SYNTH1_PWD_CP_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_SYNTH1_PWD_BIAS_MSB 31 -#define PHY_ANALOG_SYNTH1_PWD_BIAS_LSB 31 -#define PHY_ANALOG_SYNTH1_PWD_BIAS_MASK 0x80000000 -#define PHY_ANALOG_SYNTH1_PWD_BIAS_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH1_PWD_BIAS_SET(x) (((x) << 31) & 0x80000000) - -/* macros for SYNTH2 */ -#define PHY_ANALOG_SYNTH2_ADDRESS 0x00000084 -#define PHY_ANALOG_SYNTH2_OFFSET 0x00000084 -#define PHY_ANALOG_SYNTH2_CAPRANGE3_MSB 3 -#define PHY_ANALOG_SYNTH2_CAPRANGE3_LSB 0 -#define PHY_ANALOG_SYNTH2_CAPRANGE3_MASK 0x0000000f -#define PHY_ANALOG_SYNTH2_CAPRANGE3_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_SYNTH2_CAPRANGE3_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_ANALOG_SYNTH2_CAPRANGE2_MSB 7 -#define PHY_ANALOG_SYNTH2_CAPRANGE2_LSB 4 -#define PHY_ANALOG_SYNTH2_CAPRANGE2_MASK 0x000000f0 -#define PHY_ANALOG_SYNTH2_CAPRANGE2_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_SYNTH2_CAPRANGE2_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_ANALOG_SYNTH2_CAPRANGE1_MSB 11 -#define PHY_ANALOG_SYNTH2_CAPRANGE1_LSB 8 -#define PHY_ANALOG_SYNTH2_CAPRANGE1_MASK 0x00000f00 -#define PHY_ANALOG_SYNTH2_CAPRANGE1_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_SYNTH2_CAPRANGE1_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_MSB 15 -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_LSB 12 -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_MASK 0x0000f000 -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_GET(x) (((x) & 0x0000f000) >> 12) -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_SET(x) (((x) << 12) & 0x0000f000) -#define PHY_ANALOG_SYNTH2_CPLOWLK_MSB 16 -#define PHY_ANALOG_SYNTH2_CPLOWLK_LSB 16 -#define PHY_ANALOG_SYNTH2_CPLOWLK_MASK 0x00010000 -#define PHY_ANALOG_SYNTH2_CPLOWLK_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_SYNTH2_CPLOWLK_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_MSB 17 -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_LSB 17 -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_MASK 0x00020000 -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_SYNTH2_CPBIAS_MSB 19 -#define PHY_ANALOG_SYNTH2_CPBIAS_LSB 18 -#define PHY_ANALOG_SYNTH2_CPBIAS_MASK 0x000c0000 -#define PHY_ANALOG_SYNTH2_CPBIAS_GET(x) (((x) & 0x000c0000) >> 18) -#define PHY_ANALOG_SYNTH2_CPBIAS_SET(x) (((x) << 18) & 0x000c0000) -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_MSB 22 -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_LSB 20 -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_MASK 0x00700000 -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_SYNTH2_VC_MID_REF_MSB 25 -#define PHY_ANALOG_SYNTH2_VC_MID_REF_LSB 23 -#define PHY_ANALOG_SYNTH2_VC_MID_REF_MASK 0x03800000 -#define PHY_ANALOG_SYNTH2_VC_MID_REF_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_SYNTH2_VC_MID_REF_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_SYNTH2_VC_HI_REF_MSB 28 -#define PHY_ANALOG_SYNTH2_VC_HI_REF_LSB 26 -#define PHY_ANALOG_SYNTH2_VC_HI_REF_MASK 0x1c000000 -#define PHY_ANALOG_SYNTH2_VC_HI_REF_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_SYNTH2_VC_HI_REF_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_MSB 31 -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_LSB 29 -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_MASK 0xe0000000 -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for SYNTH3 */ -#define PHY_ANALOG_SYNTH3_ADDRESS 0x00000088 -#define PHY_ANALOG_SYNTH3_OFFSET 0x00000088 -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_MSB 5 -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_LSB 0 -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_MASK 0x0000003f -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_MSB 11 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_LSB 6 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_MASK 0x00000fc0 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_MSB 17 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_LSB 12 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_MASK 0x0003f000 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_SET(x) (((x) << 12) & 0x0003f000) -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_MSB 23 -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_LSB 18 -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_MASK 0x00fc0000 -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_GET(x) (((x) & 0x00fc0000) >> 18) -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_SET(x) (((x) << 18) & 0x00fc0000) -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_MSB 29 -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_LSB 24 -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_MASK 0x3f000000 -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_SET(x) (((x) << 24) & 0x3f000000) -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_MSB 30 -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_LSB 30 -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_MASK 0x40000000 -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_MSB 31 -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_LSB 31 -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_MASK 0x80000000 -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_SET(x) (((x) << 31) & 0x80000000) - -/* macros for SYNTH4 */ -#define PHY_ANALOG_SYNTH4_ADDRESS 0x0000008c -#define PHY_ANALOG_SYNTH4_OFFSET 0x0000008c -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_MSB 0 -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_LSB 0 -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_MASK 0x00000001 -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_MSB 1 -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_LSB 1 -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_MASK 0x00000002 -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_MSB 3 -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_LSB 2 -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_MASK 0x0000000c -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_MSB 4 -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_LSB 4 -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_MASK 0x00000010 -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_MSB 5 -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_LSB 5 -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_MASK 0x00000020 -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_SYNTH4_SDM_DITHER_MSB 7 -#define PHY_ANALOG_SYNTH4_SDM_DITHER_LSB 6 -#define PHY_ANALOG_SYNTH4_SDM_DITHER_MASK 0x000000c0 -#define PHY_ANALOG_SYNTH4_SDM_DITHER_GET(x) (((x) & 0x000000c0) >> 6) -#define PHY_ANALOG_SYNTH4_SDM_DITHER_SET(x) (((x) << 6) & 0x000000c0) -#define PHY_ANALOG_SYNTH4_SDM_MODE_MSB 8 -#define PHY_ANALOG_SYNTH4_SDM_MODE_LSB 8 -#define PHY_ANALOG_SYNTH4_SDM_MODE_MASK 0x00000100 -#define PHY_ANALOG_SYNTH4_SDM_MODE_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_SYNTH4_SDM_MODE_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_MSB 9 -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_LSB 9 -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_MASK 0x00000200 -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_SYNTH4_RESET_PRESC_MSB 10 -#define PHY_ANALOG_SYNTH4_RESET_PRESC_LSB 10 -#define PHY_ANALOG_SYNTH4_RESET_PRESC_MASK 0x00000400 -#define PHY_ANALOG_SYNTH4_RESET_PRESC_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_SYNTH4_RESET_PRESC_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_SYNTH4_PRESCSEL_MSB 12 -#define PHY_ANALOG_SYNTH4_PRESCSEL_LSB 11 -#define PHY_ANALOG_SYNTH4_PRESCSEL_MASK 0x00001800 -#define PHY_ANALOG_SYNTH4_PRESCSEL_GET(x) (((x) & 0x00001800) >> 11) -#define PHY_ANALOG_SYNTH4_PRESCSEL_SET(x) (((x) << 11) & 0x00001800) -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_MSB 13 -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_LSB 13 -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_MASK 0x00002000 -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_MSB 14 -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_LSB 14 -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_MASK 0x00004000 -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_MSB 15 -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_LSB 15 -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_MASK 0x00008000 -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_MSB 16 -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_LSB 16 -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_MASK 0x00010000 -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_MSB 17 -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_LSB 17 -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_MASK 0x00020000 -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_MSB 25 -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_LSB 18 -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_MASK 0x03fc0000 -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_GET(x) (((x) & 0x03fc0000) >> 18) -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_SET(x) (((x) << 18) & 0x03fc0000) -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_MSB 26 -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_LSB 26 -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_MASK 0x04000000 -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_MSB 27 -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_LSB 27 -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_MASK 0x08000000 -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_MSB 28 -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_LSB 28 -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_MASK 0x10000000 -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_MSB 29 -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_LSB 29 -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_MASK 0x20000000 -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_MSB 30 -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_LSB 30 -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_MASK 0x40000000 -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_MSB 31 -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_LSB 31 -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_MASK 0x80000000 -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_SET(x) (((x) << 31) & 0x80000000) - -/* macros for SYNTH5 */ -#define PHY_ANALOG_SYNTH5_ADDRESS 0x00000090 -#define PHY_ANALOG_SYNTH5_OFFSET 0x00000090 -#define PHY_ANALOG_SYNTH5_VCOBIAS_MSB 1 -#define PHY_ANALOG_SYNTH5_VCOBIAS_LSB 0 -#define PHY_ANALOG_SYNTH5_VCOBIAS_MASK 0x00000003 -#define PHY_ANALOG_SYNTH5_VCOBIAS_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_SYNTH5_VCOBIAS_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_MSB 4 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_LSB 2 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_MASK 0x0000001c -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_MSB 7 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_LSB 5 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_MASK 0x000000e0 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_MSB 10 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_LSB 8 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_MASK 0x00000700 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_MSB 13 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_LSB 11 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_MASK 0x00003800 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_MSB 14 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_LSB 14 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_MASK 0x00004000 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_MSB 17 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_LSB 15 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_MASK 0x00038000 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_GET(x) (((x) & 0x00038000) >> 15) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_SET(x) (((x) << 15) & 0x00038000) -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_MSB 20 -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_LSB 18 -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_MASK 0x001c0000 -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_GET(x) (((x) & 0x001c0000) >> 18) -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_SET(x) (((x) << 18) & 0x001c0000) -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_MSB 23 -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_LSB 21 -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_MASK 0x00e00000 -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_GET(x) (((x) & 0x00e00000) >> 21) -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_SET(x) (((x) << 21) & 0x00e00000) -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_MSB 26 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_LSB 24 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_MASK 0x07000000 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_GET(x) (((x) & 0x07000000) >> 24) -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_SET(x) (((x) << 24) & 0x07000000) -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_MSB 29 -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_LSB 27 -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_MASK 0x38000000 -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_GET(x) (((x) & 0x38000000) >> 27) -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_SET(x) (((x) << 27) & 0x38000000) -#define PHY_ANALOG_SYNTH5_SPARE5A_MSB 31 -#define PHY_ANALOG_SYNTH5_SPARE5A_LSB 30 -#define PHY_ANALOG_SYNTH5_SPARE5A_MASK 0xc0000000 -#define PHY_ANALOG_SYNTH5_SPARE5A_GET(x) (((x) & 0xc0000000) >> 30) -#define PHY_ANALOG_SYNTH5_SPARE5A_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for SYNTH6 */ -#define PHY_ANALOG_SYNTH6_ADDRESS 0x00000094 -#define PHY_ANALOG_SYNTH6_OFFSET 0x00000094 -#define PHY_ANALOG_SYNTH6_LOBUF5GTUNE_MSB 1 -#define PHY_ANALOG_SYNTH6_LOBUF5GTUNE_LSB 0 -#define PHY_ANALOG_SYNTH6_LOBUF5GTUNE_MASK 0x00000003 -#define PHY_ANALOG_SYNTH6_LOBUF5GTUNE_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_SYNTH6_LOOP_IP_MSB 8 -#define PHY_ANALOG_SYNTH6_LOOP_IP_LSB 2 -#define PHY_ANALOG_SYNTH6_LOOP_IP_MASK 0x000001fc -#define PHY_ANALOG_SYNTH6_LOOP_IP_GET(x) (((x) & 0x000001fc) >> 2) -#define PHY_ANALOG_SYNTH6_VC2LOW_MSB 9 -#define PHY_ANALOG_SYNTH6_VC2LOW_LSB 9 -#define PHY_ANALOG_SYNTH6_VC2LOW_MASK 0x00000200 -#define PHY_ANALOG_SYNTH6_VC2LOW_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_SYNTH6_VC2HIGH_MSB 10 -#define PHY_ANALOG_SYNTH6_VC2HIGH_LSB 10 -#define PHY_ANALOG_SYNTH6_VC2HIGH_MASK 0x00000400 -#define PHY_ANALOG_SYNTH6_VC2HIGH_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_SYNTH6_RESET_SDM_B_MSB 11 -#define PHY_ANALOG_SYNTH6_RESET_SDM_B_LSB 11 -#define PHY_ANALOG_SYNTH6_RESET_SDM_B_MASK 0x00000800 -#define PHY_ANALOG_SYNTH6_RESET_SDM_B_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_SYNTH6_RESET_PSCOUNTERS_MSB 12 -#define PHY_ANALOG_SYNTH6_RESET_PSCOUNTERS_LSB 12 -#define PHY_ANALOG_SYNTH6_RESET_PSCOUNTERS_MASK 0x00001000 -#define PHY_ANALOG_SYNTH6_RESET_PSCOUNTERS_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_SYNTH6_RESET_PFD_MSB 13 -#define PHY_ANALOG_SYNTH6_RESET_PFD_LSB 13 -#define PHY_ANALOG_SYNTH6_RESET_PFD_MASK 0x00002000 -#define PHY_ANALOG_SYNTH6_RESET_PFD_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_SYNTH6_RESET_RFD_MSB 14 -#define PHY_ANALOG_SYNTH6_RESET_RFD_LSB 14 -#define PHY_ANALOG_SYNTH6_RESET_RFD_MASK 0x00004000 -#define PHY_ANALOG_SYNTH6_RESET_RFD_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_SYNTH6_SHORT_R_MSB 15 -#define PHY_ANALOG_SYNTH6_SHORT_R_LSB 15 -#define PHY_ANALOG_SYNTH6_SHORT_R_MASK 0x00008000 -#define PHY_ANALOG_SYNTH6_SHORT_R_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_SYNTH6_VCO_CAP_ST_MSB 23 -#define PHY_ANALOG_SYNTH6_VCO_CAP_ST_LSB 16 -#define PHY_ANALOG_SYNTH6_VCO_CAP_ST_MASK 0x00ff0000 -#define PHY_ANALOG_SYNTH6_VCO_CAP_ST_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_ANALOG_SYNTH6_PIN_VC_MSB 24 -#define PHY_ANALOG_SYNTH6_PIN_VC_LSB 24 -#define PHY_ANALOG_SYNTH6_PIN_VC_MASK 0x01000000 -#define PHY_ANALOG_SYNTH6_PIN_VC_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_ANALOG_SYNTH6_SYNTH_LOCK_VC_OK_MSB 25 -#define PHY_ANALOG_SYNTH6_SYNTH_LOCK_VC_OK_LSB 25 -#define PHY_ANALOG_SYNTH6_SYNTH_LOCK_VC_OK_MASK 0x02000000 -#define PHY_ANALOG_SYNTH6_SYNTH_LOCK_VC_OK_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_ANALOG_SYNTH6_CAP_SEARCH_MSB 26 -#define PHY_ANALOG_SYNTH6_CAP_SEARCH_LSB 26 -#define PHY_ANALOG_SYNTH6_CAP_SEARCH_MASK 0x04000000 -#define PHY_ANALOG_SYNTH6_CAP_SEARCH_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_SYNTH6_SYNTH_SM_STATE_MSB 30 -#define PHY_ANALOG_SYNTH6_SYNTH_SM_STATE_LSB 27 -#define PHY_ANALOG_SYNTH6_SYNTH_SM_STATE_MASK 0x78000000 -#define PHY_ANALOG_SYNTH6_SYNTH_SM_STATE_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_ANALOG_SYNTH6_SYNTH_ON_MSB 31 -#define PHY_ANALOG_SYNTH6_SYNTH_ON_LSB 31 -#define PHY_ANALOG_SYNTH6_SYNTH_ON_MASK 0x80000000 -#define PHY_ANALOG_SYNTH6_SYNTH_ON_GET(x) (((x) & 0x80000000) >> 31) - -/* macros for SYNTH7 */ -#define PHY_ANALOG_SYNTH7_ADDRESS 0x00000098 -#define PHY_ANALOG_SYNTH7_OFFSET 0x00000098 -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_MSB 0 -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_LSB 0 -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_MASK 0x00000001 -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_MSB 1 -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_LSB 1 -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_MASK 0x00000002 -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_SYNTH7_CHANFRAC_MSB 18 -#define PHY_ANALOG_SYNTH7_CHANFRAC_LSB 2 -#define PHY_ANALOG_SYNTH7_CHANFRAC_MASK 0x0007fffc -#define PHY_ANALOG_SYNTH7_CHANFRAC_GET(x) (((x) & 0x0007fffc) >> 2) -#define PHY_ANALOG_SYNTH7_CHANFRAC_SET(x) (((x) << 2) & 0x0007fffc) -#define PHY_ANALOG_SYNTH7_CHANSEL_MSB 27 -#define PHY_ANALOG_SYNTH7_CHANSEL_LSB 19 -#define PHY_ANALOG_SYNTH7_CHANSEL_MASK 0x0ff80000 -#define PHY_ANALOG_SYNTH7_CHANSEL_GET(x) (((x) & 0x0ff80000) >> 19) -#define PHY_ANALOG_SYNTH7_CHANSEL_SET(x) (((x) << 19) & 0x0ff80000) -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_MSB 29 -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_LSB 28 -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_MASK 0x30000000 -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_GET(x) (((x) & 0x30000000) >> 28) -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_SET(x) (((x) << 28) & 0x30000000) -#define PHY_ANALOG_SYNTH7_FRACMODE_MSB 30 -#define PHY_ANALOG_SYNTH7_FRACMODE_LSB 30 -#define PHY_ANALOG_SYNTH7_FRACMODE_MASK 0x40000000 -#define PHY_ANALOG_SYNTH7_FRACMODE_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_SYNTH7_FRACMODE_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_MSB 31 -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_LSB 31 -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_MASK 0x80000000 -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_SET(x) (((x) << 31) & 0x80000000) - -/* macros for SYNTH8 */ -#define PHY_ANALOG_SYNTH8_ADDRESS 0x0000009c -#define PHY_ANALOG_SYNTH8_OFFSET 0x0000009c -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_MSB 0 -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_LSB 0 -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_MASK 0x00000001 -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_MSB 7 -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_LSB 1 -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_MASK 0x000000fe -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_GET(x) (((x) & 0x000000fe) >> 1) -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_SET(x) (((x) << 1) & 0x000000fe) -#define PHY_ANALOG_SYNTH8_LOOP_CSB_MSB 11 -#define PHY_ANALOG_SYNTH8_LOOP_CSB_LSB 8 -#define PHY_ANALOG_SYNTH8_LOOP_CSB_MASK 0x00000f00 -#define PHY_ANALOG_SYNTH8_LOOP_CSB_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_SYNTH8_LOOP_CSB_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_SYNTH8_LOOP_RSB_MSB 16 -#define PHY_ANALOG_SYNTH8_LOOP_RSB_LSB 12 -#define PHY_ANALOG_SYNTH8_LOOP_RSB_MASK 0x0001f000 -#define PHY_ANALOG_SYNTH8_LOOP_RSB_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_ANALOG_SYNTH8_LOOP_RSB_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_ANALOG_SYNTH8_LOOP_CPB_MSB 21 -#define PHY_ANALOG_SYNTH8_LOOP_CPB_LSB 17 -#define PHY_ANALOG_SYNTH8_LOOP_CPB_MASK 0x003e0000 -#define PHY_ANALOG_SYNTH8_LOOP_CPB_GET(x) (((x) & 0x003e0000) >> 17) -#define PHY_ANALOG_SYNTH8_LOOP_CPB_SET(x) (((x) << 17) & 0x003e0000) -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_MSB 26 -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_LSB 22 -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_MASK 0x07c00000 -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_GET(x) (((x) & 0x07c00000) >> 22) -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_SET(x) (((x) << 22) & 0x07c00000) -#define PHY_ANALOG_SYNTH8_REFDIVB_MSB 31 -#define PHY_ANALOG_SYNTH8_REFDIVB_LSB 27 -#define PHY_ANALOG_SYNTH8_REFDIVB_MASK 0xf8000000 -#define PHY_ANALOG_SYNTH8_REFDIVB_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_SYNTH8_REFDIVB_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for SYNTH9 */ -#define PHY_ANALOG_SYNTH9_ADDRESS 0x000000a0 -#define PHY_ANALOG_SYNTH9_OFFSET 0x000000a0 -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_MSB 0 -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_LSB 0 -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_MASK 0x00000001 -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_MSB 3 -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_LSB 1 -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_MASK 0x0000000e -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_MSB 7 -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_LSB 4 -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_MASK 0x000000f0 -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_MSB 11 -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_LSB 8 -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_MASK 0x00000f00 -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_MSB 16 -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_LSB 12 -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_MASK 0x0001f000 -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_MSB 21 -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_LSB 17 -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_MASK 0x003e0000 -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_GET(x) (((x) & 0x003e0000) >> 17) -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_SET(x) (((x) << 17) & 0x003e0000) -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_MSB 26 -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_LSB 22 -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_MASK 0x07c00000 -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_GET(x) (((x) & 0x07c00000) >> 22) -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_SET(x) (((x) << 22) & 0x07c00000) -#define PHY_ANALOG_SYNTH9_REFDIVA_MSB 31 -#define PHY_ANALOG_SYNTH9_REFDIVA_LSB 27 -#define PHY_ANALOG_SYNTH9_REFDIVA_MASK 0xf8000000 -#define PHY_ANALOG_SYNTH9_REFDIVA_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_SYNTH9_REFDIVA_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for SYNTH10 */ -#define PHY_ANALOG_SYNTH10_ADDRESS 0x000000a4 -#define PHY_ANALOG_SYNTH10_OFFSET 0x000000a4 -#define PHY_ANALOG_SYNTH10_SPARE10A_MSB 0 -#define PHY_ANALOG_SYNTH10_SPARE10A_LSB 0 -#define PHY_ANALOG_SYNTH10_SPARE10A_MASK 0x00000001 -#define PHY_ANALOG_SYNTH10_SPARE10A_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH10_SPARE10A_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_MSB 3 -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_LSB 1 -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_MASK 0x0000000e -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_ANALOG_SYNTH10_EN_2X_LOOPFILT_MSB 4 -#define PHY_ANALOG_SYNTH10_EN_2X_LOOPFILT_LSB 4 -#define PHY_ANALOG_SYNTH10_EN_2X_LOOPFILT_MASK 0x00000010 -#define PHY_ANALOG_SYNTH10_EN_2X_LOOPFILT_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_SYNTH10_EN_2X_LOOPFILT_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_MSB 7 -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_LSB 5 -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_MASK 0x000000e0 -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_MSB 10 -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_LSB 8 -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_MASK 0x00000700 -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_MSB 13 -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_LSB 11 -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_MASK 0x00003800 -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_MSB 17 -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_LSB 14 -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_MASK 0x0003c000 -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_GET(x) (((x) & 0x0003c000) >> 14) -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_SET(x) (((x) << 14) & 0x0003c000) -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_MSB 21 -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_LSB 18 -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_MASK 0x003c0000 -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_GET(x) (((x) & 0x003c0000) >> 18) -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_SET(x) (((x) << 18) & 0x003c0000) -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_MSB 26 -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_LSB 22 -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_MASK 0x07c00000 -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_GET(x) (((x) & 0x07c00000) >> 22) -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_SET(x) (((x) << 22) & 0x07c00000) -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_MSB 31 -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_LSB 27 -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_MASK 0xf8000000 -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for SYNTH11 */ -#define PHY_ANALOG_SYNTH11_ADDRESS 0x000000a8 -#define PHY_ANALOG_SYNTH11_OFFSET 0x000000a8 -#define PHY_ANALOG_SYNTH11_SPARE11A_MSB 4 -#define PHY_ANALOG_SYNTH11_SPARE11A_LSB 0 -#define PHY_ANALOG_SYNTH11_SPARE11A_MASK 0x0000001f -#define PHY_ANALOG_SYNTH11_SPARE11A_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_SYNTH11_SPARE11A_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_MSB 5 -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_LSB 5 -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_MASK 0x00000020 -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_SYNTH11_LOREFSEL_MSB 7 -#define PHY_ANALOG_SYNTH11_LOREFSEL_LSB 6 -#define PHY_ANALOG_SYNTH11_LOREFSEL_MASK 0x000000c0 -#define PHY_ANALOG_SYNTH11_LOREFSEL_GET(x) (((x) & 0x000000c0) >> 6) -#define PHY_ANALOG_SYNTH11_LOREFSEL_SET(x) (((x) << 6) & 0x000000c0) -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_MSB 9 -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_LSB 8 -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_MASK 0x00000300 -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_SET(x) (((x) << 8) & 0x00000300) -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_MSB 10 -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_LSB 10 -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_MASK 0x00000400 -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_MSB 13 -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_LSB 11 -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_MASK 0x00003800 -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_MSB 17 -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_LSB 14 -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_MASK 0x0003c000 -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_GET(x) (((x) & 0x0003c000) >> 14) -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_SET(x) (((x) << 14) & 0x0003c000) -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_MSB 21 -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_LSB 18 -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_MASK 0x003c0000 -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_GET(x) (((x) & 0x003c0000) >> 18) -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_SET(x) (((x) << 18) & 0x003c0000) -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_MSB 26 -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_LSB 22 -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_MASK 0x07c00000 -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_GET(x) (((x) & 0x07c00000) >> 22) -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_SET(x) (((x) << 22) & 0x07c00000) -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_MSB 31 -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_LSB 27 -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_MASK 0xf8000000 -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for SYNTH12 */ -#define PHY_ANALOG_SYNTH12_ADDRESS 0x000000ac -#define PHY_ANALOG_SYNTH12_OFFSET 0x000000ac -#define PHY_ANALOG_SYNTH12_SPARE12A_MSB 17 -#define PHY_ANALOG_SYNTH12_SPARE12A_LSB 0 -#define PHY_ANALOG_SYNTH12_SPARE12A_MASK 0x0003ffff -#define PHY_ANALOG_SYNTH12_SPARE12A_GET(x) (((x) & 0x0003ffff) >> 0) -#define PHY_ANALOG_SYNTH12_SPARE12A_SET(x) (((x) << 0) & 0x0003ffff) -#define PHY_ANALOG_SYNTH12_STRCONT_MSB 18 -#define PHY_ANALOG_SYNTH12_STRCONT_LSB 18 -#define PHY_ANALOG_SYNTH12_STRCONT_MASK 0x00040000 -#define PHY_ANALOG_SYNTH12_STRCONT_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_SYNTH12_STRCONT_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_SYNTH12_VREFMUL3_MSB 22 -#define PHY_ANALOG_SYNTH12_VREFMUL3_LSB 19 -#define PHY_ANALOG_SYNTH12_VREFMUL3_MASK 0x00780000 -#define PHY_ANALOG_SYNTH12_VREFMUL3_GET(x) (((x) & 0x00780000) >> 19) -#define PHY_ANALOG_SYNTH12_VREFMUL3_SET(x) (((x) << 19) & 0x00780000) -#define PHY_ANALOG_SYNTH12_VREFMUL2_MSB 26 -#define PHY_ANALOG_SYNTH12_VREFMUL2_LSB 23 -#define PHY_ANALOG_SYNTH12_VREFMUL2_MASK 0x07800000 -#define PHY_ANALOG_SYNTH12_VREFMUL2_GET(x) (((x) & 0x07800000) >> 23) -#define PHY_ANALOG_SYNTH12_VREFMUL2_SET(x) (((x) << 23) & 0x07800000) -#define PHY_ANALOG_SYNTH12_VREFMUL1_MSB 30 -#define PHY_ANALOG_SYNTH12_VREFMUL1_LSB 27 -#define PHY_ANALOG_SYNTH12_VREFMUL1_MASK 0x78000000 -#define PHY_ANALOG_SYNTH12_VREFMUL1_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_ANALOG_SYNTH12_VREFMUL1_SET(x) (((x) << 27) & 0x78000000) -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_MSB 31 -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_LSB 31 -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_MASK 0x80000000 -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BIAS1 */ -#define PHY_ANALOG_BIAS1_ADDRESS 0x000000c0 -#define PHY_ANALOG_BIAS1_OFFSET 0x000000c0 -#define PHY_ANALOG_BIAS1_SPARE1_MSB 6 -#define PHY_ANALOG_BIAS1_SPARE1_LSB 0 -#define PHY_ANALOG_BIAS1_SPARE1_MASK 0x0000007f -#define PHY_ANALOG_BIAS1_SPARE1_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_ANALOG_BIAS1_SPARE1_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_MSB 9 -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_LSB 7 -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_MASK 0x00000380 -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_GET(x) (((x) & 0x00000380) >> 7) -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_SET(x) (((x) << 7) & 0x00000380) -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_MSB 12 -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_LSB 10 -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_MASK 0x00001c00 -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_GET(x) (((x) & 0x00001c00) >> 10) -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_SET(x) (((x) << 10) & 0x00001c00) -#define PHY_ANALOG_BIAS1_PWD_IC25BB_MSB 15 -#define PHY_ANALOG_BIAS1_PWD_IC25BB_LSB 13 -#define PHY_ANALOG_BIAS1_PWD_IC25BB_MASK 0x0000e000 -#define PHY_ANALOG_BIAS1_PWD_IC25BB_GET(x) (((x) & 0x0000e000) >> 13) -#define PHY_ANALOG_BIAS1_PWD_IC25BB_SET(x) (((x) << 13) & 0x0000e000) -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_MSB 18 -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_LSB 16 -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_MASK 0x00070000 -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_GET(x) (((x) & 0x00070000) >> 16) -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_SET(x) (((x) << 16) & 0x00070000) -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_MSB 21 -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_LSB 19 -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_MASK 0x00380000 -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_GET(x) (((x) & 0x00380000) >> 19) -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_SET(x) (((x) << 19) & 0x00380000) -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_MSB 24 -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_LSB 22 -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_MASK 0x01c00000 -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_GET(x) (((x) & 0x01c00000) >> 22) -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_SET(x) (((x) << 22) & 0x01c00000) -#define PHY_ANALOG_BIAS1_BIAS_SEL_MSB 31 -#define PHY_ANALOG_BIAS1_BIAS_SEL_LSB 25 -#define PHY_ANALOG_BIAS1_BIAS_SEL_MASK 0xfe000000 -#define PHY_ANALOG_BIAS1_BIAS_SEL_GET(x) (((x) & 0xfe000000) >> 25) -#define PHY_ANALOG_BIAS1_BIAS_SEL_SET(x) (((x) << 25) & 0xfe000000) - -/* macros for BIAS2 */ -#define PHY_ANALOG_BIAS2_ADDRESS 0x000000c4 -#define PHY_ANALOG_BIAS2_OFFSET 0x000000c4 -#define PHY_ANALOG_BIAS2_SPARE2_MSB 4 -#define PHY_ANALOG_BIAS2_SPARE2_LSB 0 -#define PHY_ANALOG_BIAS2_SPARE2_MASK 0x0000001f -#define PHY_ANALOG_BIAS2_SPARE2_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_BIAS2_SPARE2_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_BIAS2_PWD_IC25XTALREG_MSB 7 -#define PHY_ANALOG_BIAS2_PWD_IC25XTALREG_LSB 5 -#define PHY_ANALOG_BIAS2_PWD_IC25XTALREG_MASK 0x000000e0 -#define PHY_ANALOG_BIAS2_PWD_IC25XTALREG_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_BIAS2_PWD_IC25XTALREG_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_MSB 10 -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_LSB 8 -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_MASK 0x00000700 -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_MSB 13 -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_LSB 11 -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_MASK 0x00003800 -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_MSB 16 -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_LSB 14 -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_MASK 0x0001c000 -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_BIAS2_PWD_IC50SYNTH_MSB 19 -#define PHY_ANALOG_BIAS2_PWD_IC50SYNTH_LSB 17 -#define PHY_ANALOG_BIAS2_PWD_IC50SYNTH_MASK 0x000e0000 -#define PHY_ANALOG_BIAS2_PWD_IC50SYNTH_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_BIAS2_PWD_IC50SYNTH_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_MSB 22 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_LSB 20 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_MASK 0x00700000 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_MSB 25 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_LSB 23 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_MASK 0x03800000 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_MSB 28 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_LSB 26 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_MASK 0x1c000000 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_MSB 31 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_LSB 29 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_MASK 0xe0000000 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for BIAS3 */ -#define PHY_ANALOG_BIAS3_ADDRESS 0x000000c8 -#define PHY_ANALOG_BIAS3_OFFSET 0x000000c8 -#define PHY_ANALOG_BIAS3_SPARE3_MSB 1 -#define PHY_ANALOG_BIAS3_SPARE3_LSB 0 -#define PHY_ANALOG_BIAS3_SPARE3_MASK 0x00000003 -#define PHY_ANALOG_BIAS3_SPARE3_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_BIAS3_SPARE3_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_BIAS3_PWD_IR25XTALREG_MSB 4 -#define PHY_ANALOG_BIAS3_PWD_IR25XTALREG_LSB 2 -#define PHY_ANALOG_BIAS3_PWD_IR25XTALREG_MASK 0x0000001c -#define PHY_ANALOG_BIAS3_PWD_IR25XTALREG_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_ANALOG_BIAS3_PWD_IR25XTALREG_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_MSB 7 -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_LSB 5 -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_MASK 0x000000e0 -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_MSB 10 -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_LSB 8 -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_MASK 0x00000700 -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_BIAS3_PWD_IR50SYNTH_MSB 13 -#define PHY_ANALOG_BIAS3_PWD_IR50SYNTH_LSB 11 -#define PHY_ANALOG_BIAS3_PWD_IR50SYNTH_MASK 0x00003800 -#define PHY_ANALOG_BIAS3_PWD_IR50SYNTH_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_BIAS3_PWD_IR50SYNTH_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_MSB 16 -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_LSB 14 -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_MASK 0x0001c000 -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_BIAS3_PWD_IR25BB_MSB 19 -#define PHY_ANALOG_BIAS3_PWD_IR25BB_LSB 17 -#define PHY_ANALOG_BIAS3_PWD_IR25BB_MASK 0x000e0000 -#define PHY_ANALOG_BIAS3_PWD_IR25BB_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_BIAS3_PWD_IR25BB_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_MSB 22 -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_LSB 20 -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_MASK 0x00700000 -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_MSB 25 -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_LSB 23 -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_MASK 0x03800000 -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_MSB 28 -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_LSB 26 -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_MASK 0x1c000000 -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_MSB 31 -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_LSB 29 -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_MASK 0xe0000000 -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for BIAS4 */ -#define PHY_ANALOG_BIAS4_ADDRESS 0x000000cc -#define PHY_ANALOG_BIAS4_OFFSET 0x000000cc -#define PHY_ANALOG_BIAS4_SPARE4_MSB 13 -#define PHY_ANALOG_BIAS4_SPARE4_LSB 0 -#define PHY_ANALOG_BIAS4_SPARE4_MASK 0x00003fff -#define PHY_ANALOG_BIAS4_SPARE4_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_ANALOG_BIAS4_SPARE4_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_MSB 16 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_LSB 14 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_MASK 0x0001c000 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_MSB 19 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_LSB 17 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_MASK 0x000e0000 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREA_MSB 22 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREA_LSB 20 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREA_MASK 0x00700000 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREA_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREA_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_MSB 25 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_LSB 23 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_MASK 0x03800000 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_MSB 28 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_LSB 26 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_MASK 0x1c000000 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_MSB 31 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_LSB 29 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_MASK 0xe0000000 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for RXTX1 */ -#define PHY_ANALOG_RXTX1_ADDRESS 0x00000100 -#define PHY_ANALOG_RXTX1_OFFSET 0x00000100 -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_MSB 0 -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_LSB 0 -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_MASK 0x00000001 -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXTX1_MANRXGAIN_MSB 1 -#define PHY_ANALOG_RXTX1_MANRXGAIN_LSB 1 -#define PHY_ANALOG_RXTX1_MANRXGAIN_MASK 0x00000002 -#define PHY_ANALOG_RXTX1_MANRXGAIN_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_RXTX1_MANRXGAIN_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_RXTX1_AGC_DBDAC_MSB 5 -#define PHY_ANALOG_RXTX1_AGC_DBDAC_LSB 2 -#define PHY_ANALOG_RXTX1_AGC_DBDAC_MASK 0x0000003c -#define PHY_ANALOG_RXTX1_AGC_DBDAC_GET(x) (((x) & 0x0000003c) >> 2) -#define PHY_ANALOG_RXTX1_AGC_DBDAC_SET(x) (((x) << 2) & 0x0000003c) -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_MSB 6 -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_LSB 6 -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_MASK 0x00000040 -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RXTX1_ENABLE_PAL_MSB 7 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_LSB 7 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_MASK 0x00000080 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXTX1_ENABLE_PAL_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_MSB 8 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_LSB 8 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_MASK 0x00000100 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_MSB 11 -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_LSB 9 -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_MASK 0x00000e00 -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_GET(x) (((x) & 0x00000e00) >> 9) -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_SET(x) (((x) << 9) & 0x00000e00) -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_MSB 13 -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_LSB 12 -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_MASK 0x00003000 -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_GET(x) (((x) & 0x00003000) >> 12) -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_SET(x) (((x) << 12) & 0x00003000) -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_MSB 14 -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_LSB 14 -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_MASK 0x00004000 -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_RXTX1_PADRV2GN_MSB 18 -#define PHY_ANALOG_RXTX1_PADRV2GN_LSB 15 -#define PHY_ANALOG_RXTX1_PADRV2GN_MASK 0x00078000 -#define PHY_ANALOG_RXTX1_PADRV2GN_GET(x) (((x) & 0x00078000) >> 15) -#define PHY_ANALOG_RXTX1_PADRV2GN_SET(x) (((x) << 15) & 0x00078000) -#define PHY_ANALOG_RXTX1_PADRV3GN5G_MSB 22 -#define PHY_ANALOG_RXTX1_PADRV3GN5G_LSB 19 -#define PHY_ANALOG_RXTX1_PADRV3GN5G_MASK 0x00780000 -#define PHY_ANALOG_RXTX1_PADRV3GN5G_GET(x) (((x) & 0x00780000) >> 19) -#define PHY_ANALOG_RXTX1_PADRV3GN5G_SET(x) (((x) << 19) & 0x00780000) -#define PHY_ANALOG_RXTX1_PADRV4GN5G_MSB 26 -#define PHY_ANALOG_RXTX1_PADRV4GN5G_LSB 23 -#define PHY_ANALOG_RXTX1_PADRV4GN5G_MASK 0x07800000 -#define PHY_ANALOG_RXTX1_PADRV4GN5G_GET(x) (((x) & 0x07800000) >> 23) -#define PHY_ANALOG_RXTX1_PADRV4GN5G_SET(x) (((x) << 23) & 0x07800000) -#define PHY_ANALOG_RXTX1_TXBB_GC_MSB 30 -#define PHY_ANALOG_RXTX1_TXBB_GC_LSB 27 -#define PHY_ANALOG_RXTX1_TXBB_GC_MASK 0x78000000 -#define PHY_ANALOG_RXTX1_TXBB_GC_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_ANALOG_RXTX1_TXBB_GC_SET(x) (((x) << 27) & 0x78000000) -#define PHY_ANALOG_RXTX1_MANTXGAIN_MSB 31 -#define PHY_ANALOG_RXTX1_MANTXGAIN_LSB 31 -#define PHY_ANALOG_RXTX1_MANTXGAIN_MASK 0x80000000 -#define PHY_ANALOG_RXTX1_MANTXGAIN_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXTX1_MANTXGAIN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for RXTX2 */ -#define PHY_ANALOG_RXTX2_ADDRESS 0x00000104 -#define PHY_ANALOG_RXTX2_OFFSET 0x00000104 -#define PHY_ANALOG_RXTX2_BMODE_MSB 0 -#define PHY_ANALOG_RXTX2_BMODE_LSB 0 -#define PHY_ANALOG_RXTX2_BMODE_MASK 0x00000001 -#define PHY_ANALOG_RXTX2_BMODE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXTX2_BMODE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXTX2_BMODE_OVR_MSB 1 -#define PHY_ANALOG_RXTX2_BMODE_OVR_LSB 1 -#define PHY_ANALOG_RXTX2_BMODE_OVR_MASK 0x00000002 -#define PHY_ANALOG_RXTX2_BMODE_OVR_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_RXTX2_BMODE_OVR_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_RXTX2_SYNTHON_MSB 2 -#define PHY_ANALOG_RXTX2_SYNTHON_LSB 2 -#define PHY_ANALOG_RXTX2_SYNTHON_MASK 0x00000004 -#define PHY_ANALOG_RXTX2_SYNTHON_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_RXTX2_SYNTHON_SET(x) (((x) << 2) & 0x00000004) -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_MSB 3 -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_LSB 3 -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_MASK 0x00000008 -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_RXTX2_BW_ST_MSB 5 -#define PHY_ANALOG_RXTX2_BW_ST_LSB 4 -#define PHY_ANALOG_RXTX2_BW_ST_MASK 0x00000030 -#define PHY_ANALOG_RXTX2_BW_ST_GET(x) (((x) & 0x00000030) >> 4) -#define PHY_ANALOG_RXTX2_BW_ST_SET(x) (((x) << 4) & 0x00000030) -#define PHY_ANALOG_RXTX2_BW_ST_OVR_MSB 6 -#define PHY_ANALOG_RXTX2_BW_ST_OVR_LSB 6 -#define PHY_ANALOG_RXTX2_BW_ST_OVR_MASK 0x00000040 -#define PHY_ANALOG_RXTX2_BW_ST_OVR_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RXTX2_BW_ST_OVR_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RXTX2_TXON_MSB 7 -#define PHY_ANALOG_RXTX2_TXON_LSB 7 -#define PHY_ANALOG_RXTX2_TXON_MASK 0x00000080 -#define PHY_ANALOG_RXTX2_TXON_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXTX2_TXON_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXTX2_TXON_OVR_MSB 8 -#define PHY_ANALOG_RXTX2_TXON_OVR_LSB 8 -#define PHY_ANALOG_RXTX2_TXON_OVR_MASK 0x00000100 -#define PHY_ANALOG_RXTX2_TXON_OVR_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RXTX2_TXON_OVR_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RXTX2_PAON_MSB 9 -#define PHY_ANALOG_RXTX2_PAON_LSB 9 -#define PHY_ANALOG_RXTX2_PAON_MASK 0x00000200 -#define PHY_ANALOG_RXTX2_PAON_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_RXTX2_PAON_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_RXTX2_PAON_OVR_MSB 10 -#define PHY_ANALOG_RXTX2_PAON_OVR_LSB 10 -#define PHY_ANALOG_RXTX2_PAON_OVR_MASK 0x00000400 -#define PHY_ANALOG_RXTX2_PAON_OVR_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_RXTX2_PAON_OVR_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_RXTX2_RXON_MSB 11 -#define PHY_ANALOG_RXTX2_RXON_LSB 11 -#define PHY_ANALOG_RXTX2_RXON_MASK 0x00000800 -#define PHY_ANALOG_RXTX2_RXON_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_RXTX2_RXON_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_RXTX2_RXON_OVR_MSB 12 -#define PHY_ANALOG_RXTX2_RXON_OVR_LSB 12 -#define PHY_ANALOG_RXTX2_RXON_OVR_MASK 0x00001000 -#define PHY_ANALOG_RXTX2_RXON_OVR_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_RXTX2_RXON_OVR_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_RXTX2_AGCON_MSB 13 -#define PHY_ANALOG_RXTX2_AGCON_LSB 13 -#define PHY_ANALOG_RXTX2_AGCON_MASK 0x00002000 -#define PHY_ANALOG_RXTX2_AGCON_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_RXTX2_AGCON_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_RXTX2_AGCON_OVR_MSB 14 -#define PHY_ANALOG_RXTX2_AGCON_OVR_LSB 14 -#define PHY_ANALOG_RXTX2_AGCON_OVR_MASK 0x00004000 -#define PHY_ANALOG_RXTX2_AGCON_OVR_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_RXTX2_AGCON_OVR_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_RXTX2_TXMOD_MSB 17 -#define PHY_ANALOG_RXTX2_TXMOD_LSB 15 -#define PHY_ANALOG_RXTX2_TXMOD_MASK 0x00038000 -#define PHY_ANALOG_RXTX2_TXMOD_GET(x) (((x) & 0x00038000) >> 15) -#define PHY_ANALOG_RXTX2_TXMOD_SET(x) (((x) << 15) & 0x00038000) -#define PHY_ANALOG_RXTX2_TXMOD_OVR_MSB 18 -#define PHY_ANALOG_RXTX2_TXMOD_OVR_LSB 18 -#define PHY_ANALOG_RXTX2_TXMOD_OVR_MASK 0x00040000 -#define PHY_ANALOG_RXTX2_TXMOD_OVR_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_RXTX2_TXMOD_OVR_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_MSB 21 -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_LSB 19 -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_MASK 0x00380000 -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_GET(x) (((x) & 0x00380000) >> 19) -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_SET(x) (((x) << 19) & 0x00380000) -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_MSB 23 -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_LSB 22 -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_MASK 0x00c00000 -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_GET(x) (((x) & 0x00c00000) >> 22) -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_SET(x) (((x) << 22) & 0x00c00000) -#define PHY_ANALOG_RXTX2_MXRGAIN_MSB 25 -#define PHY_ANALOG_RXTX2_MXRGAIN_LSB 24 -#define PHY_ANALOG_RXTX2_MXRGAIN_MASK 0x03000000 -#define PHY_ANALOG_RXTX2_MXRGAIN_GET(x) (((x) & 0x03000000) >> 24) -#define PHY_ANALOG_RXTX2_MXRGAIN_SET(x) (((x) << 24) & 0x03000000) -#define PHY_ANALOG_RXTX2_VGAGAIN_MSB 28 -#define PHY_ANALOG_RXTX2_VGAGAIN_LSB 26 -#define PHY_ANALOG_RXTX2_VGAGAIN_MASK 0x1c000000 -#define PHY_ANALOG_RXTX2_VGAGAIN_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_RXTX2_VGAGAIN_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_RXTX2_LNAGAIN_MSB 31 -#define PHY_ANALOG_RXTX2_LNAGAIN_LSB 29 -#define PHY_ANALOG_RXTX2_LNAGAIN_MASK 0xe0000000 -#define PHY_ANALOG_RXTX2_LNAGAIN_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_RXTX2_LNAGAIN_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for RXTX3 */ -#define PHY_ANALOG_RXTX3_ADDRESS 0x00000108 -#define PHY_ANALOG_RXTX3_OFFSET 0x00000108 -#define PHY_ANALOG_RXTX3_SPARE3_MSB 2 -#define PHY_ANALOG_RXTX3_SPARE3_LSB 0 -#define PHY_ANALOG_RXTX3_SPARE3_MASK 0x00000007 -#define PHY_ANALOG_RXTX3_SPARE3_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_RXTX3_SPARE3_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_RXTX3_DACFULLSCALE_MSB 3 -#define PHY_ANALOG_RXTX3_DACFULLSCALE_LSB 3 -#define PHY_ANALOG_RXTX3_DACFULLSCALE_MASK 0x00000008 -#define PHY_ANALOG_RXTX3_DACFULLSCALE_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_RXTX3_DACFULLSCALE_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_RXTX3_DACRSTB_MSB 4 -#define PHY_ANALOG_RXTX3_DACRSTB_LSB 4 -#define PHY_ANALOG_RXTX3_DACRSTB_MASK 0x00000010 -#define PHY_ANALOG_RXTX3_DACRSTB_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_RXTX3_DACRSTB_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_RXTX3_ADDACLOOPBACK_MSB 5 -#define PHY_ANALOG_RXTX3_ADDACLOOPBACK_LSB 5 -#define PHY_ANALOG_RXTX3_ADDACLOOPBACK_MASK 0x00000020 -#define PHY_ANALOG_RXTX3_ADDACLOOPBACK_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_RXTX3_ADDACLOOPBACK_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_RXTX3_ADCSHORT_MSB 6 -#define PHY_ANALOG_RXTX3_ADCSHORT_LSB 6 -#define PHY_ANALOG_RXTX3_ADCSHORT_MASK 0x00000040 -#define PHY_ANALOG_RXTX3_ADCSHORT_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RXTX3_ADCSHORT_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RXTX3_DACPWD_MSB 7 -#define PHY_ANALOG_RXTX3_DACPWD_LSB 7 -#define PHY_ANALOG_RXTX3_DACPWD_MASK 0x00000080 -#define PHY_ANALOG_RXTX3_DACPWD_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXTX3_DACPWD_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXTX3_DACPWD_OVR_MSB 8 -#define PHY_ANALOG_RXTX3_DACPWD_OVR_LSB 8 -#define PHY_ANALOG_RXTX3_DACPWD_OVR_MASK 0x00000100 -#define PHY_ANALOG_RXTX3_DACPWD_OVR_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RXTX3_DACPWD_OVR_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RXTX3_ADCPWD_MSB 9 -#define PHY_ANALOG_RXTX3_ADCPWD_LSB 9 -#define PHY_ANALOG_RXTX3_ADCPWD_MASK 0x00000200 -#define PHY_ANALOG_RXTX3_ADCPWD_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_RXTX3_ADCPWD_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_MSB 10 -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_LSB 10 -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_MASK 0x00000400 -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_RXTX3_AGC_CALDAC_MSB 16 -#define PHY_ANALOG_RXTX3_AGC_CALDAC_LSB 11 -#define PHY_ANALOG_RXTX3_AGC_CALDAC_MASK 0x0001f800 -#define PHY_ANALOG_RXTX3_AGC_CALDAC_GET(x) (((x) & 0x0001f800) >> 11) -#define PHY_ANALOG_RXTX3_AGC_CALDAC_SET(x) (((x) << 11) & 0x0001f800) -#define PHY_ANALOG_RXTX3_AGC_CAL_MSB 17 -#define PHY_ANALOG_RXTX3_AGC_CAL_LSB 17 -#define PHY_ANALOG_RXTX3_AGC_CAL_MASK 0x00020000 -#define PHY_ANALOG_RXTX3_AGC_CAL_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_RXTX3_AGC_CAL_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_MSB 18 -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_LSB 18 -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_MASK 0x00040000 -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_RXTX3_LOFORCEDON_MSB 19 -#define PHY_ANALOG_RXTX3_LOFORCEDON_LSB 19 -#define PHY_ANALOG_RXTX3_LOFORCEDON_MASK 0x00080000 -#define PHY_ANALOG_RXTX3_LOFORCEDON_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_ANALOG_RXTX3_LOFORCEDON_SET(x) (((x) << 19) & 0x00080000) -#define PHY_ANALOG_RXTX3_CALRESIDUE_MSB 20 -#define PHY_ANALOG_RXTX3_CALRESIDUE_LSB 20 -#define PHY_ANALOG_RXTX3_CALRESIDUE_MASK 0x00100000 -#define PHY_ANALOG_RXTX3_CALRESIDUE_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_RXTX3_CALRESIDUE_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_MSB 21 -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_LSB 21 -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_MASK 0x00200000 -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_RXTX3_CALFC_MSB 22 -#define PHY_ANALOG_RXTX3_CALFC_LSB 22 -#define PHY_ANALOG_RXTX3_CALFC_MASK 0x00400000 -#define PHY_ANALOG_RXTX3_CALFC_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_RXTX3_CALFC_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_RXTX3_CALFC_OVR_MSB 23 -#define PHY_ANALOG_RXTX3_CALFC_OVR_LSB 23 -#define PHY_ANALOG_RXTX3_CALFC_OVR_MASK 0x00800000 -#define PHY_ANALOG_RXTX3_CALFC_OVR_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_RXTX3_CALFC_OVR_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_RXTX3_CALTX_MSB 24 -#define PHY_ANALOG_RXTX3_CALTX_LSB 24 -#define PHY_ANALOG_RXTX3_CALTX_MASK 0x01000000 -#define PHY_ANALOG_RXTX3_CALTX_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_ANALOG_RXTX3_CALTX_SET(x) (((x) << 24) & 0x01000000) -#define PHY_ANALOG_RXTX3_CALTX_OVR_MSB 25 -#define PHY_ANALOG_RXTX3_CALTX_OVR_LSB 25 -#define PHY_ANALOG_RXTX3_CALTX_OVR_MASK 0x02000000 -#define PHY_ANALOG_RXTX3_CALTX_OVR_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_ANALOG_RXTX3_CALTX_OVR_SET(x) (((x) << 25) & 0x02000000) -#define PHY_ANALOG_RXTX3_CALTXSHIFT_MSB 26 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_LSB 26 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_MASK 0x04000000 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_RXTX3_CALTXSHIFT_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_MSB 27 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_LSB 27 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_MASK 0x08000000 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_RXTX3_CALPA_MSB 28 -#define PHY_ANALOG_RXTX3_CALPA_LSB 28 -#define PHY_ANALOG_RXTX3_CALPA_MASK 0x10000000 -#define PHY_ANALOG_RXTX3_CALPA_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_RXTX3_CALPA_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_RXTX3_CALPA_OVR_MSB 29 -#define PHY_ANALOG_RXTX3_CALPA_OVR_LSB 29 -#define PHY_ANALOG_RXTX3_CALPA_OVR_MASK 0x20000000 -#define PHY_ANALOG_RXTX3_CALPA_OVR_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_RXTX3_CALPA_OVR_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_RXTX3_SPURON_MSB 30 -#define PHY_ANALOG_RXTX3_SPURON_LSB 30 -#define PHY_ANALOG_RXTX3_SPURON_MASK 0x40000000 -#define PHY_ANALOG_RXTX3_SPURON_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_RXTX3_SPURON_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_RXTX3_SPURON_OVR_MSB 31 -#define PHY_ANALOG_RXTX3_SPURON_OVR_LSB 31 -#define PHY_ANALOG_RXTX3_SPURON_OVR_MASK 0x80000000 -#define PHY_ANALOG_RXTX3_SPURON_OVR_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXTX3_SPURON_OVR_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB1 */ -#define PHY_ANALOG_BB1_ADDRESS 0x00000140 -#define PHY_ANALOG_BB1_OFFSET 0x00000140 -#define PHY_ANALOG_BB1_I2V_CURR2X_MSB 0 -#define PHY_ANALOG_BB1_I2V_CURR2X_LSB 0 -#define PHY_ANALOG_BB1_I2V_CURR2X_MASK 0x00000001 -#define PHY_ANALOG_BB1_I2V_CURR2X_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_BB1_I2V_CURR2X_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_BB1_ENABLE_LOQ_MSB 1 -#define PHY_ANALOG_BB1_ENABLE_LOQ_LSB 1 -#define PHY_ANALOG_BB1_ENABLE_LOQ_MASK 0x00000002 -#define PHY_ANALOG_BB1_ENABLE_LOQ_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_BB1_ENABLE_LOQ_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_BB1_FORCE_LOQ_MSB 2 -#define PHY_ANALOG_BB1_FORCE_LOQ_LSB 2 -#define PHY_ANALOG_BB1_FORCE_LOQ_MASK 0x00000004 -#define PHY_ANALOG_BB1_FORCE_LOQ_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_BB1_FORCE_LOQ_SET(x) (((x) << 2) & 0x00000004) -#define PHY_ANALOG_BB1_ENABLE_NOTCH_MSB 3 -#define PHY_ANALOG_BB1_ENABLE_NOTCH_LSB 3 -#define PHY_ANALOG_BB1_ENABLE_NOTCH_MASK 0x00000008 -#define PHY_ANALOG_BB1_ENABLE_NOTCH_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_BB1_ENABLE_NOTCH_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_BB1_FORCE_NOTCH_MSB 4 -#define PHY_ANALOG_BB1_FORCE_NOTCH_LSB 4 -#define PHY_ANALOG_BB1_FORCE_NOTCH_MASK 0x00000010 -#define PHY_ANALOG_BB1_FORCE_NOTCH_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_BB1_FORCE_NOTCH_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_MSB 5 -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_LSB 5 -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_MASK 0x00000020 -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_BB1_FORCE_BIQUAD_MSB 6 -#define PHY_ANALOG_BB1_FORCE_BIQUAD_LSB 6 -#define PHY_ANALOG_BB1_FORCE_BIQUAD_MASK 0x00000040 -#define PHY_ANALOG_BB1_FORCE_BIQUAD_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_BB1_FORCE_BIQUAD_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_BB1_ENABLE_OSDAC_MSB 7 -#define PHY_ANALOG_BB1_ENABLE_OSDAC_LSB 7 -#define PHY_ANALOG_BB1_ENABLE_OSDAC_MASK 0x00000080 -#define PHY_ANALOG_BB1_ENABLE_OSDAC_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_BB1_ENABLE_OSDAC_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_BB1_FORCE_OSDAC_MSB 8 -#define PHY_ANALOG_BB1_FORCE_OSDAC_LSB 8 -#define PHY_ANALOG_BB1_FORCE_OSDAC_MASK 0x00000100 -#define PHY_ANALOG_BB1_FORCE_OSDAC_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_BB1_FORCE_OSDAC_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_BB1_ENABLE_V2I_MSB 9 -#define PHY_ANALOG_BB1_ENABLE_V2I_LSB 9 -#define PHY_ANALOG_BB1_ENABLE_V2I_MASK 0x00000200 -#define PHY_ANALOG_BB1_ENABLE_V2I_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_BB1_ENABLE_V2I_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_BB1_FORCE_V2I_MSB 10 -#define PHY_ANALOG_BB1_FORCE_V2I_LSB 10 -#define PHY_ANALOG_BB1_FORCE_V2I_MASK 0x00000400 -#define PHY_ANALOG_BB1_FORCE_V2I_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_BB1_FORCE_V2I_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_BB1_ENABLE_I2V_MSB 11 -#define PHY_ANALOG_BB1_ENABLE_I2V_LSB 11 -#define PHY_ANALOG_BB1_ENABLE_I2V_MASK 0x00000800 -#define PHY_ANALOG_BB1_ENABLE_I2V_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_BB1_ENABLE_I2V_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_BB1_FORCE_I2V_MSB 12 -#define PHY_ANALOG_BB1_FORCE_I2V_LSB 12 -#define PHY_ANALOG_BB1_FORCE_I2V_MASK 0x00001000 -#define PHY_ANALOG_BB1_FORCE_I2V_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_BB1_FORCE_I2V_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_BB1_CMSEL_MSB 15 -#define PHY_ANALOG_BB1_CMSEL_LSB 13 -#define PHY_ANALOG_BB1_CMSEL_MASK 0x0000e000 -#define PHY_ANALOG_BB1_CMSEL_GET(x) (((x) & 0x0000e000) >> 13) -#define PHY_ANALOG_BB1_CMSEL_SET(x) (((x) << 13) & 0x0000e000) -#define PHY_ANALOG_BB1_ATBSEL_MSB 17 -#define PHY_ANALOG_BB1_ATBSEL_LSB 16 -#define PHY_ANALOG_BB1_ATBSEL_MASK 0x00030000 -#define PHY_ANALOG_BB1_ATBSEL_GET(x) (((x) & 0x00030000) >> 16) -#define PHY_ANALOG_BB1_ATBSEL_SET(x) (((x) << 16) & 0x00030000) -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_MSB 18 -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_LSB 18 -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_MASK 0x00040000 -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_MSB 23 -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_LSB 19 -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_MASK 0x00f80000 -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_GET(x) (((x) & 0x00f80000) >> 19) -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_SET(x) (((x) << 19) & 0x00f80000) -#define PHY_ANALOG_BB1_OFSTCORRI2VI_MSB 28 -#define PHY_ANALOG_BB1_OFSTCORRI2VI_LSB 24 -#define PHY_ANALOG_BB1_OFSTCORRI2VI_MASK 0x1f000000 -#define PHY_ANALOG_BB1_OFSTCORRI2VI_GET(x) (((x) & 0x1f000000) >> 24) -#define PHY_ANALOG_BB1_OFSTCORRI2VI_SET(x) (((x) << 24) & 0x1f000000) -#define PHY_ANALOG_BB1_LOCALOFFSET_MSB 29 -#define PHY_ANALOG_BB1_LOCALOFFSET_LSB 29 -#define PHY_ANALOG_BB1_LOCALOFFSET_MASK 0x20000000 -#define PHY_ANALOG_BB1_LOCALOFFSET_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_BB1_LOCALOFFSET_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_BB1_RANGE_OSDAC_MSB 31 -#define PHY_ANALOG_BB1_RANGE_OSDAC_LSB 30 -#define PHY_ANALOG_BB1_RANGE_OSDAC_MASK 0xc0000000 -#define PHY_ANALOG_BB1_RANGE_OSDAC_GET(x) (((x) & 0xc0000000) >> 30) -#define PHY_ANALOG_BB1_RANGE_OSDAC_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for BB2 */ -#define PHY_ANALOG_BB2_ADDRESS 0x00000144 -#define PHY_ANALOG_BB2_OFFSET 0x00000144 -#define PHY_ANALOG_BB2_SPARE_MSB 6 -#define PHY_ANALOG_BB2_SPARE_LSB 0 -#define PHY_ANALOG_BB2_SPARE_MASK 0x0000007f -#define PHY_ANALOG_BB2_SPARE_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_ANALOG_BB2_SPARE_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_ANALOG_BB2_SEL_TEST_MSB 9 -#define PHY_ANALOG_BB2_SEL_TEST_LSB 7 -#define PHY_ANALOG_BB2_SEL_TEST_MASK 0x00000380 -#define PHY_ANALOG_BB2_SEL_TEST_GET(x) (((x) & 0x00000380) >> 7) -#define PHY_ANALOG_BB2_SEL_TEST_SET(x) (((x) << 7) & 0x00000380) -#define PHY_ANALOG_BB2_SCFIR_CAP_MSB 14 -#define PHY_ANALOG_BB2_SCFIR_CAP_LSB 10 -#define PHY_ANALOG_BB2_SCFIR_CAP_MASK 0x00007c00 -#define PHY_ANALOG_BB2_SCFIR_CAP_GET(x) (((x) & 0x00007c00) >> 10) -#define PHY_ANALOG_BB2_SCFIR_CAP_SET(x) (((x) << 10) & 0x00007c00) -#define PHY_ANALOG_BB2_OVERRIDE_SCFIR_CAP_MSB 15 -#define PHY_ANALOG_BB2_OVERRIDE_SCFIR_CAP_LSB 15 -#define PHY_ANALOG_BB2_OVERRIDE_SCFIR_CAP_MASK 0x00008000 -#define PHY_ANALOG_BB2_OVERRIDE_SCFIR_CAP_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_BB2_OVERRIDE_SCFIR_CAP_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_BB2_FNOTCH_MSB 19 -#define PHY_ANALOG_BB2_FNOTCH_LSB 16 -#define PHY_ANALOG_BB2_FNOTCH_MASK 0x000f0000 -#define PHY_ANALOG_BB2_FNOTCH_GET(x) (((x) & 0x000f0000) >> 16) -#define PHY_ANALOG_BB2_FNOTCH_SET(x) (((x) << 16) & 0x000f0000) -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_MSB 20 -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_LSB 20 -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_MASK 0x00100000 -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_BB2_FILTERFC_MSB 25 -#define PHY_ANALOG_BB2_FILTERFC_LSB 21 -#define PHY_ANALOG_BB2_FILTERFC_MASK 0x03e00000 -#define PHY_ANALOG_BB2_FILTERFC_GET(x) (((x) & 0x03e00000) >> 21) -#define PHY_ANALOG_BB2_FILTERFC_SET(x) (((x) << 21) & 0x03e00000) -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_MSB 26 -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_LSB 26 -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_MASK 0x04000000 -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_MSB 27 -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_LSB 27 -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_MASK 0x08000000 -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_MSB 28 -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_LSB 28 -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_MASK 0x10000000 -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_BB2_RXIN2I2V_EN_MSB 29 -#define PHY_ANALOG_BB2_RXIN2I2V_EN_LSB 29 -#define PHY_ANALOG_BB2_RXIN2I2V_EN_MASK 0x20000000 -#define PHY_ANALOG_BB2_RXIN2I2V_EN_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_BB2_RXIN2I2V_EN_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_BB2_RXIN2BQ_EN_MSB 30 -#define PHY_ANALOG_BB2_RXIN2BQ_EN_LSB 30 -#define PHY_ANALOG_BB2_RXIN2BQ_EN_MASK 0x40000000 -#define PHY_ANALOG_BB2_RXIN2BQ_EN_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_BB2_RXIN2BQ_EN_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_MSB 31 -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_LSB 31 -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_MASK 0x80000000 -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TOP1 */ -#define PHY_ANALOG_TOP1_ADDRESS 0x00000280 -#define PHY_ANALOG_TOP1_OFFSET 0x00000280 -#define PHY_ANALOG_TOP1_SEL_KVCO_MSB 1 -#define PHY_ANALOG_TOP1_SEL_KVCO_LSB 0 -#define PHY_ANALOG_TOP1_SEL_KVCO_MASK 0x00000003 -#define PHY_ANALOG_TOP1_SEL_KVCO_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TOP1_SEL_KVCO_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TOP1_PLLATB_MSB 3 -#define PHY_ANALOG_TOP1_PLLATB_LSB 2 -#define PHY_ANALOG_TOP1_PLLATB_MASK 0x0000000c -#define PHY_ANALOG_TOP1_PLLATB_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_ANALOG_TOP1_PLLATB_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_ANALOG_TOP1_PLL_SVREG_MSB 4 -#define PHY_ANALOG_TOP1_PLL_SVREG_LSB 4 -#define PHY_ANALOG_TOP1_PLL_SVREG_MASK 0x00000010 -#define PHY_ANALOG_TOP1_PLL_SVREG_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_TOP1_PLL_SVREG_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_TOP1_HI_FREQ_EN_MSB 5 -#define PHY_ANALOG_TOP1_HI_FREQ_EN_LSB 5 -#define PHY_ANALOG_TOP1_HI_FREQ_EN_MASK 0x00000020 -#define PHY_ANALOG_TOP1_HI_FREQ_EN_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_TOP1_HI_FREQ_EN_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_TOP1_PWDPLL_MSB 6 -#define PHY_ANALOG_TOP1_PWDPLL_LSB 6 -#define PHY_ANALOG_TOP1_PWDPLL_MASK 0x00000040 -#define PHY_ANALOG_TOP1_PWDPLL_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_TOP1_PWDPLL_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_TOP1_PWDEXTCLKBUF_MSB 7 -#define PHY_ANALOG_TOP1_PWDEXTCLKBUF_LSB 7 -#define PHY_ANALOG_TOP1_PWDEXTCLKBUF_MASK 0x00000080 -#define PHY_ANALOG_TOP1_PWDEXTCLKBUF_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_TOP1_PWDEXTCLKBUF_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_TOP1_ADCPWD_PHASE_MSB 9 -#define PHY_ANALOG_TOP1_ADCPWD_PHASE_LSB 8 -#define PHY_ANALOG_TOP1_ADCPWD_PHASE_MASK 0x00000300 -#define PHY_ANALOG_TOP1_ADCPWD_PHASE_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_ANALOG_TOP1_ADCPWD_PHASE_SET(x) (((x) << 8) & 0x00000300) -#define PHY_ANALOG_TOP1_ADCCLK_PHASE_MSB 11 -#define PHY_ANALOG_TOP1_ADCCLK_PHASE_LSB 10 -#define PHY_ANALOG_TOP1_ADCCLK_PHASE_MASK 0x00000c00 -#define PHY_ANALOG_TOP1_ADCCLK_PHASE_GET(x) (((x) & 0x00000c00) >> 10) -#define PHY_ANALOG_TOP1_ADCCLK_PHASE_SET(x) (((x) << 10) & 0x00000c00) -#define PHY_ANALOG_TOP1_DAC_CLK_SEL_MSB 13 -#define PHY_ANALOG_TOP1_DAC_CLK_SEL_LSB 12 -#define PHY_ANALOG_TOP1_DAC_CLK_SEL_MASK 0x00003000 -#define PHY_ANALOG_TOP1_DAC_CLK_SEL_GET(x) (((x) & 0x00003000) >> 12) -#define PHY_ANALOG_TOP1_DAC_CLK_SEL_SET(x) (((x) << 12) & 0x00003000) -#define PHY_ANALOG_TOP1_ADC_CLK_SEL_MSB 15 -#define PHY_ANALOG_TOP1_ADC_CLK_SEL_LSB 14 -#define PHY_ANALOG_TOP1_ADC_CLK_SEL_MASK 0x0000c000 -#define PHY_ANALOG_TOP1_ADC_CLK_SEL_GET(x) (((x) & 0x0000c000) >> 14) -#define PHY_ANALOG_TOP1_ADC_CLK_SEL_SET(x) (((x) << 14) & 0x0000c000) -#define PHY_ANALOG_TOP1_REFDIV_MSB 19 -#define PHY_ANALOG_TOP1_REFDIV_LSB 16 -#define PHY_ANALOG_TOP1_REFDIV_MASK 0x000f0000 -#define PHY_ANALOG_TOP1_REFDIV_GET(x) (((x) & 0x000f0000) >> 16) -#define PHY_ANALOG_TOP1_REFDIV_SET(x) (((x) << 16) & 0x000f0000) -#define PHY_ANALOG_TOP1_DIV_MSB 29 -#define PHY_ANALOG_TOP1_DIV_LSB 20 -#define PHY_ANALOG_TOP1_DIV_MASK 0x3ff00000 -#define PHY_ANALOG_TOP1_DIV_GET(x) (((x) & 0x3ff00000) >> 20) -#define PHY_ANALOG_TOP1_DIV_SET(x) (((x) << 20) & 0x3ff00000) -#define PHY_ANALOG_TOP1_PLLBYPASS_MSB 30 -#define PHY_ANALOG_TOP1_PLLBYPASS_LSB 30 -#define PHY_ANALOG_TOP1_PLLBYPASS_MASK 0x40000000 -#define PHY_ANALOG_TOP1_PLLBYPASS_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_TOP1_PLLBYPASS_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_TOP1_CLKMOD_RSTB_MSB 31 -#define PHY_ANALOG_TOP1_CLKMOD_RSTB_LSB 31 -#define PHY_ANALOG_TOP1_CLKMOD_RSTB_MASK 0x80000000 -#define PHY_ANALOG_TOP1_CLKMOD_RSTB_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_TOP1_CLKMOD_RSTB_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TOP2 */ -#define PHY_ANALOG_TOP2_ADDRESS 0x00000284 -#define PHY_ANALOG_TOP2_OFFSET 0x00000284 -#define PHY_ANALOG_TOP2_PLL_LOWLEAK_MSB 0 -#define PHY_ANALOG_TOP2_PLL_LOWLEAK_LSB 0 -#define PHY_ANALOG_TOP2_PLL_LOWLEAK_MASK 0x00000001 -#define PHY_ANALOG_TOP2_PLL_LOWLEAK_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_TOP2_PLL_LOWLEAK_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_TOP2_PLL_LEAK_MSB 4 -#define PHY_ANALOG_TOP2_PLL_LEAK_LSB 1 -#define PHY_ANALOG_TOP2_PLL_LEAK_MASK 0x0000001e -#define PHY_ANALOG_TOP2_PLL_LEAK_GET(x) (((x) & 0x0000001e) >> 1) -#define PHY_ANALOG_TOP2_PLL_LEAK_SET(x) (((x) << 1) & 0x0000001e) -#define PHY_ANALOG_TOP2_PLLFRAC_MSB 19 -#define PHY_ANALOG_TOP2_PLLFRAC_LSB 5 -#define PHY_ANALOG_TOP2_PLLFRAC_MASK 0x000fffe0 -#define PHY_ANALOG_TOP2_PLLFRAC_GET(x) (((x) & 0x000fffe0) >> 5) -#define PHY_ANALOG_TOP2_PLLFRAC_SET(x) (((x) << 5) & 0x000fffe0) -#define PHY_ANALOG_TOP2_PWD_PLLSDM_MSB 20 -#define PHY_ANALOG_TOP2_PWD_PLLSDM_LSB 20 -#define PHY_ANALOG_TOP2_PWD_PLLSDM_MASK 0x00100000 -#define PHY_ANALOG_TOP2_PWD_PLLSDM_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_TOP2_PWD_PLLSDM_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_TOP2_PLLICP_MSB 23 -#define PHY_ANALOG_TOP2_PLLICP_LSB 21 -#define PHY_ANALOG_TOP2_PLLICP_MASK 0x00e00000 -#define PHY_ANALOG_TOP2_PLLICP_GET(x) (((x) & 0x00e00000) >> 21) -#define PHY_ANALOG_TOP2_PLLICP_SET(x) (((x) << 21) & 0x00e00000) -#define PHY_ANALOG_TOP2_PLLFILTER_MSB 31 -#define PHY_ANALOG_TOP2_PLLFILTER_LSB 24 -#define PHY_ANALOG_TOP2_PLLFILTER_MASK 0xff000000 -#define PHY_ANALOG_TOP2_PLLFILTER_GET(x) (((x) & 0xff000000) >> 24) -#define PHY_ANALOG_TOP2_PLLFILTER_SET(x) (((x) << 24) & 0xff000000) - -/* macros for TOP3 */ -#define PHY_ANALOG_TOP3_ADDRESS 0x00000288 -#define PHY_ANALOG_TOP3_OFFSET 0x00000288 -#define PHY_ANALOG_TOP3_INT2GND_MSB 0 -#define PHY_ANALOG_TOP3_INT2GND_LSB 0 -#define PHY_ANALOG_TOP3_INT2GND_MASK 0x00000001 -#define PHY_ANALOG_TOP3_INT2GND_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_TOP3_INT2GND_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_TOP3_PWDPALCLK_MSB 1 -#define PHY_ANALOG_TOP3_PWDPALCLK_LSB 1 -#define PHY_ANALOG_TOP3_PWDPALCLK_MASK 0x00000002 -#define PHY_ANALOG_TOP3_PWDPALCLK_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_TOP3_PWDPALCLK_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_TOP3_PWDAGCCLK_MSB 2 -#define PHY_ANALOG_TOP3_PWDAGCCLK_LSB 2 -#define PHY_ANALOG_TOP3_PWDAGCCLK_MASK 0x00000004 -#define PHY_ANALOG_TOP3_PWDAGCCLK_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_TOP3_PWDAGCCLK_SET(x) (((x) << 2) & 0x00000004) -#define PHY_ANALOG_TOP3_PWDV2I_MSB 3 -#define PHY_ANALOG_TOP3_PWDV2I_LSB 3 -#define PHY_ANALOG_TOP3_PWDV2I_MASK 0x00000008 -#define PHY_ANALOG_TOP3_PWDV2I_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_TOP3_PWDV2I_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_TOP3_PWDBIAS_MSB 4 -#define PHY_ANALOG_TOP3_PWDBIAS_LSB 4 -#define PHY_ANALOG_TOP3_PWDBIAS_MASK 0x00000010 -#define PHY_ANALOG_TOP3_PWDBIAS_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_TOP3_PWDBIAS_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_TOP3_PWDBG_MSB 5 -#define PHY_ANALOG_TOP3_PWDBG_LSB 5 -#define PHY_ANALOG_TOP3_PWDBG_MASK 0x00000020 -#define PHY_ANALOG_TOP3_PWDBG_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_TOP3_PWDBG_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_TOP3_XTAL_SELVREG_MSB 6 -#define PHY_ANALOG_TOP3_XTAL_SELVREG_LSB 6 -#define PHY_ANALOG_TOP3_XTAL_SELVREG_MASK 0x00000040 -#define PHY_ANALOG_TOP3_XTAL_SELVREG_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_TOP3_XTAL_SELVREG_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_TOP3_XTAL_PWDREG_MSB 7 -#define PHY_ANALOG_TOP3_XTAL_PWDREG_LSB 7 -#define PHY_ANALOG_TOP3_XTAL_PWDREG_MASK 0x00000080 -#define PHY_ANALOG_TOP3_XTAL_PWDREG_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_TOP3_XTAL_PWDREG_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_TOP3_XTAL_PWDCLKIN_MSB 8 -#define PHY_ANALOG_TOP3_XTAL_PWDCLKIN_LSB 8 -#define PHY_ANALOG_TOP3_XTAL_PWDCLKIN_MASK 0x00000100 -#define PHY_ANALOG_TOP3_XTAL_PWDCLKIN_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_TOP3_XTAL_PWDCLKIN_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_TOP3_XTAL_PWDCLKD_MSB 9 -#define PHY_ANALOG_TOP3_XTAL_PWDCLKD_LSB 9 -#define PHY_ANALOG_TOP3_XTAL_PWDCLKD_MASK 0x00000200 -#define PHY_ANALOG_TOP3_XTAL_PWDCLKD_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_TOP3_XTAL_PWDCLKD_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_TOP3_XTAL_OSCON_MSB 10 -#define PHY_ANALOG_TOP3_XTAL_OSCON_LSB 10 -#define PHY_ANALOG_TOP3_XTAL_OSCON_MASK 0x00000400 -#define PHY_ANALOG_TOP3_XTAL_OSCON_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_TOP3_XTAL_OSCON_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_TOP3_XTAL_NOTCXODET_MSB 11 -#define PHY_ANALOG_TOP3_XTAL_NOTCXODET_LSB 11 -#define PHY_ANALOG_TOP3_XTAL_NOTCXODET_MASK 0x00000800 -#define PHY_ANALOG_TOP3_XTAL_NOTCXODET_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_TOP3_XTAL_NOTCXODET_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_TOP3_XTAL_LOCALBIAS_MSB 12 -#define PHY_ANALOG_TOP3_XTAL_LOCALBIAS_LSB 12 -#define PHY_ANALOG_TOP3_XTAL_LOCALBIAS_MASK 0x00001000 -#define PHY_ANALOG_TOP3_XTAL_LOCALBIAS_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_TOP3_XTAL_LOCALBIAS_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_TOP3_XTAL_HIGHZ_MSB 13 -#define PHY_ANALOG_TOP3_XTAL_HIGHZ_LSB 13 -#define PHY_ANALOG_TOP3_XTAL_HIGHZ_MASK 0x00002000 -#define PHY_ANALOG_TOP3_XTAL_HIGHZ_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_TOP3_XTAL_HIGHZ_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_TOP3_XTAL_DRVPNR_MSB 15 -#define PHY_ANALOG_TOP3_XTAL_DRVPNR_LSB 14 -#define PHY_ANALOG_TOP3_XTAL_DRVPNR_MASK 0x0000c000 -#define PHY_ANALOG_TOP3_XTAL_DRVPNR_GET(x) (((x) & 0x0000c000) >> 14) -#define PHY_ANALOG_TOP3_XTAL_DRVPNR_SET(x) (((x) << 14) & 0x0000c000) -#define PHY_ANALOG_TOP3_XTALCAPOUTDAC_MSB 22 -#define PHY_ANALOG_TOP3_XTALCAPOUTDAC_LSB 16 -#define PHY_ANALOG_TOP3_XTALCAPOUTDAC_MASK 0x007f0000 -#define PHY_ANALOG_TOP3_XTALCAPOUTDAC_GET(x) (((x) & 0x007f0000) >> 16) -#define PHY_ANALOG_TOP3_XTALCAPOUTDAC_SET(x) (((x) << 16) & 0x007f0000) -#define PHY_ANALOG_TOP3_XTAL_CAPINDAC_MSB 29 -#define PHY_ANALOG_TOP3_XTAL_CAPINDAC_LSB 23 -#define PHY_ANALOG_TOP3_XTAL_CAPINDAC_MASK 0x3f800000 -#define PHY_ANALOG_TOP3_XTAL_CAPINDAC_GET(x) (((x) & 0x3f800000) >> 23) -#define PHY_ANALOG_TOP3_XTAL_CAPINDAC_SET(x) (((x) << 23) & 0x3f800000) -#define PHY_ANALOG_TOP3_XTAL_BIAS2X_MSB 30 -#define PHY_ANALOG_TOP3_XTAL_BIAS2X_LSB 30 -#define PHY_ANALOG_TOP3_XTAL_BIAS2X_MASK 0x40000000 -#define PHY_ANALOG_TOP3_XTAL_BIAS2X_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_TOP3_XTAL_BIAS2X_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_TOP3_TCXODET_MSB 31 -#define PHY_ANALOG_TOP3_TCXODET_LSB 31 -#define PHY_ANALOG_TOP3_TCXODET_MASK 0x80000000 -#define PHY_ANALOG_TOP3_TCXODET_GET(x) (((x) & 0x80000000) >> 31) - -/* macros for TOP4 */ -#define PHY_ANALOG_TOP4_ADDRESS 0x0000028c -#define PHY_ANALOG_TOP4_OFFSET 0x0000028c -#define PHY_ANALOG_TOP4_SPARE4_MSB 19 -#define PHY_ANALOG_TOP4_SPARE4_LSB 0 -#define PHY_ANALOG_TOP4_SPARE4_MASK 0x000fffff -#define PHY_ANALOG_TOP4_SPARE4_GET(x) (((x) & 0x000fffff) >> 0) -#define PHY_ANALOG_TOP4_SPARE4_SET(x) (((x) << 0) & 0x000fffff) -#define PHY_ANALOG_TOP4_SEL_TEMPSENSOR_MSB 20 -#define PHY_ANALOG_TOP4_SEL_TEMPSENSOR_LSB 20 -#define PHY_ANALOG_TOP4_SEL_TEMPSENSOR_MASK 0x00100000 -#define PHY_ANALOG_TOP4_SEL_TEMPSENSOR_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_TOP4_SEL_TEMPSENSOR_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_TOP4_ADCPWD_OVR_MSB 21 -#define PHY_ANALOG_TOP4_ADCPWD_OVR_LSB 21 -#define PHY_ANALOG_TOP4_ADCPWD_OVR_MASK 0x00200000 -#define PHY_ANALOG_TOP4_ADCPWD_OVR_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_TOP4_ADCPWD_OVR_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_TOP4_ADCPWD_INT_MSB 22 -#define PHY_ANALOG_TOP4_ADCPWD_INT_LSB 22 -#define PHY_ANALOG_TOP4_ADCPWD_INT_MASK 0x00400000 -#define PHY_ANALOG_TOP4_ADCPWD_INT_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_TOP4_ADCPWD_INT_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_TOP4_TESTIQ_OFF_MSB 23 -#define PHY_ANALOG_TOP4_TESTIQ_OFF_LSB 23 -#define PHY_ANALOG_TOP4_TESTIQ_OFF_MASK 0x00800000 -#define PHY_ANALOG_TOP4_TESTIQ_OFF_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_TOP4_TESTIQ_OFF_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_TOP4_TESTIQ_BUFEN_MSB 24 -#define PHY_ANALOG_TOP4_TESTIQ_BUFEN_LSB 24 -#define PHY_ANALOG_TOP4_TESTIQ_BUFEN_MASK 0x01000000 -#define PHY_ANALOG_TOP4_TESTIQ_BUFEN_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_ANALOG_TOP4_TESTIQ_BUFEN_SET(x) (((x) << 24) & 0x01000000) -#define PHY_ANALOG_TOP4_PAL_LOCKEDEN_MSB 25 -#define PHY_ANALOG_TOP4_PAL_LOCKEDEN_LSB 25 -#define PHY_ANALOG_TOP4_PAL_LOCKEDEN_MASK 0x02000000 -#define PHY_ANALOG_TOP4_PAL_LOCKEDEN_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_ANALOG_TOP4_PAL_LOCKEDEN_SET(x) (((x) << 25) & 0x02000000) -#define PHY_ANALOG_TOP4_SYNTHDIGOUTEN_MSB 26 -#define PHY_ANALOG_TOP4_SYNTHDIGOUTEN_LSB 26 -#define PHY_ANALOG_TOP4_SYNTHDIGOUTEN_MASK 0x04000000 -#define PHY_ANALOG_TOP4_SYNTHDIGOUTEN_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_TOP4_SYNTHDIGOUTEN_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_TOP4_ENBTCLK_MSB 27 -#define PHY_ANALOG_TOP4_ENBTCLK_LSB 27 -#define PHY_ANALOG_TOP4_ENBTCLK_MASK 0x08000000 -#define PHY_ANALOG_TOP4_ENBTCLK_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_TOP4_ENBTCLK_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_TOP4_PAD2GND_MSB 28 -#define PHY_ANALOG_TOP4_PAD2GND_LSB 28 -#define PHY_ANALOG_TOP4_PAD2GND_MASK 0x10000000 -#define PHY_ANALOG_TOP4_PAD2GND_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_TOP4_PAD2GND_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_TOP4_INTH2PAD_MSB 29 -#define PHY_ANALOG_TOP4_INTH2PAD_LSB 29 -#define PHY_ANALOG_TOP4_INTH2PAD_MASK 0x20000000 -#define PHY_ANALOG_TOP4_INTH2PAD_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_TOP4_INTH2PAD_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_TOP4_INTH2GND_MSB 30 -#define PHY_ANALOG_TOP4_INTH2GND_LSB 30 -#define PHY_ANALOG_TOP4_INTH2GND_MASK 0x40000000 -#define PHY_ANALOG_TOP4_INTH2GND_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_TOP4_INTH2GND_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_TOP4_INT2PAD_MSB 31 -#define PHY_ANALOG_TOP4_INT2PAD_LSB 31 -#define PHY_ANALOG_TOP4_INT2PAD_MASK 0x80000000 -#define PHY_ANALOG_TOP4_INT2PAD_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_TOP4_INT2PAD_SET(x) (((x) << 31) & 0x80000000) - -/* macros for rbist_cntrl */ -#define PHY_ANALOG_RBIST_CNTRL_ADDRESS 0x00000380 -#define PHY_ANALOG_RBIST_CNTRL_OFFSET 0x00000380 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_MSB 0 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_LSB 0 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_MASK 0x00000001 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_MSB 1 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_LSB 1 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_MASK 0x00000002 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_MSB 2 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_LSB 2 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_MASK 0x00000004 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_SET(x) (((x) << 2) & 0x00000004) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_MSB 3 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_LSB 3 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_MASK 0x00000008 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_MSB 4 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_LSB 4 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_MASK 0x00000010 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_MSB 5 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_LSB 5 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_MASK 0x00000020 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_MSB 6 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_LSB 6 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_MASK 0x00000040 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_MSB 7 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_LSB 7 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_MASK 0x00000080 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_MSB 8 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_LSB 8 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_MASK 0x00000100 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_MSB 9 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_LSB 9 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_MASK 0x00000200 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_MSB 10 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_LSB 10 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_MASK 0x00000400 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_MSB 11 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_LSB 11 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_MASK 0x00000800 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_MSB 12 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_LSB 12 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_MASK 0x00001000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_MSB 13 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_LSB 13 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_MASK 0x00002000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_MSB 14 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_LSB 14 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_MASK 0x00004000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_MSB 15 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_LSB 15 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_MASK 0x00008000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_MSB 16 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_LSB 16 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_MASK 0x00010000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_MSB 17 -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_LSB 17 -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_MASK 0x00020000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_SET(x) (((x) << 17) & 0x00020000) - -/* macros for tx_dc_offset */ -#define PHY_ANALOG_TX_DC_OFFSET_ADDRESS 0x00000384 -#define PHY_ANALOG_TX_DC_OFFSET_OFFSET 0x00000384 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_MSB 10 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_LSB 0 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_MASK 0x000007ff -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_GET(x) (((x) & 0x000007ff) >> 0) -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_SET(x) (((x) << 0) & 0x000007ff) -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_MSB 26 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_LSB 16 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_MASK 0x07ff0000 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_GET(x) (((x) & 0x07ff0000) >> 16) -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_SET(x) (((x) << 16) & 0x07ff0000) - -/* macros for tx_tonegen0 */ -#define PHY_ANALOG_TX_TONEGEN0_ADDRESS 0x00000388 -#define PHY_ANALOG_TX_TONEGEN0_OFFSET 0x00000388 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_MSB 6 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_LSB 0 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_MASK 0x0000007f -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_MSB 11 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_LSB 8 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_MASK 0x00000f00 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_MSB 23 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_LSB 16 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_MASK 0x00ff0000 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_MSB 30 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_LSB 24 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_MASK 0x7f000000 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for tx_tonegen1 */ -#define PHY_ANALOG_TX_TONEGEN1_ADDRESS 0x0000038c -#define PHY_ANALOG_TX_TONEGEN1_OFFSET 0x0000038c -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_MSB 6 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_LSB 0 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_MASK 0x0000007f -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_MSB 11 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_LSB 8 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_MASK 0x00000f00 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_MSB 23 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_LSB 16 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_MASK 0x00ff0000 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_MSB 30 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_LSB 24 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_MASK 0x7f000000 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for tx_lftonegen0 */ -#define PHY_ANALOG_TX_LFTONEGEN0_ADDRESS 0x00000390 -#define PHY_ANALOG_TX_LFTONEGEN0_OFFSET 0x00000390 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_MSB 6 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_LSB 0 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_MASK 0x0000007f -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_MSB 11 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_LSB 8 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_MASK 0x00000f00 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_MSB 23 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_LSB 16 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_MASK 0x00ff0000 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_MSB 30 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_LSB 24 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_MASK 0x7f000000 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for tx_linear_ramp_i */ -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ADDRESS 0x00000394 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_OFFSET 0x00000394 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_MSB 10 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_LSB 0 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_MASK 0x000007ff -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_GET(x) (((x) & 0x000007ff) >> 0) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_SET(x) (((x) << 0) & 0x000007ff) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_MSB 21 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_LSB 12 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_MASK 0x003ff000 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_GET(x) (((x) & 0x003ff000) >> 12) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_SET(x) (((x) << 12) & 0x003ff000) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_MSB 29 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_LSB 24 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_MASK 0x3f000000 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for tx_linear_ramp_q */ -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ADDRESS 0x00000398 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_OFFSET 0x00000398 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_MSB 10 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_LSB 0 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_MASK 0x000007ff -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_GET(x) (((x) & 0x000007ff) >> 0) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_SET(x) (((x) << 0) & 0x000007ff) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_MSB 21 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_LSB 12 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_MASK 0x003ff000 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_GET(x) (((x) & 0x003ff000) >> 12) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_SET(x) (((x) << 12) & 0x003ff000) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_MSB 29 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_LSB 24 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_MASK 0x3f000000 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for tx_prbs_mag */ -#define PHY_ANALOG_TX_PRBS_MAG_ADDRESS 0x0000039c -#define PHY_ANALOG_TX_PRBS_MAG_OFFSET 0x0000039c -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_MSB 9 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_LSB 0 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_MASK 0x000003ff -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_MSB 25 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_LSB 16 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_MASK 0x03ff0000 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_GET(x) (((x) & 0x03ff0000) >> 16) -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_SET(x) (((x) << 16) & 0x03ff0000) - -/* macros for tx_prbs_seed_i */ -#define PHY_ANALOG_TX_PRBS_SEED_I_ADDRESS 0x000003a0 -#define PHY_ANALOG_TX_PRBS_SEED_I_OFFSET 0x000003a0 -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_MSB 30 -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_LSB 0 -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_MASK 0x7fffffff -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_GET(x) (((x) & 0x7fffffff) >> 0) -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_SET(x) (((x) << 0) & 0x7fffffff) - -/* macros for tx_prbs_seed_q */ -#define PHY_ANALOG_TX_PRBS_SEED_Q_ADDRESS 0x000003a4 -#define PHY_ANALOG_TX_PRBS_SEED_Q_OFFSET 0x000003a4 -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_MSB 30 -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_LSB 0 -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_MASK 0x7fffffff -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_GET(x) (((x) & 0x7fffffff) >> 0) -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_SET(x) (((x) << 0) & 0x7fffffff) - -/* macros for cmac_dc_cancel */ -#define PHY_ANALOG_CMAC_DC_CANCEL_ADDRESS 0x000003a8 -#define PHY_ANALOG_CMAC_DC_CANCEL_OFFSET 0x000003a8 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_MSB 9 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_LSB 0 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_MASK 0x000003ff -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_MSB 25 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_LSB 16 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_MASK 0x03ff0000 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_GET(x) (((x) & 0x03ff0000) >> 16) -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_SET(x) (((x) << 16) & 0x03ff0000) - -/* macros for cmac_dc_offset */ -#define PHY_ANALOG_CMAC_DC_OFFSET_ADDRESS 0x000003ac -#define PHY_ANALOG_CMAC_DC_OFFSET_OFFSET 0x000003ac -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_SET(x) (((x) << 0) & 0x0000000f) - -/* macros for cmac_corr */ -#define PHY_ANALOG_CMAC_CORR_ADDRESS 0x000003b0 -#define PHY_ANALOG_CMAC_CORR_OFFSET 0x000003b0 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_MSB 4 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_MASK 0x0000001f -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_MSB 13 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_LSB 8 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_MASK 0x00003f00 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_SET(x) (((x) << 8) & 0x00003f00) - -/* macros for cmac_power */ -#define PHY_ANALOG_CMAC_POWER_ADDRESS 0x000003b4 -#define PHY_ANALOG_CMAC_POWER_OFFSET 0x000003b4 -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_SET(x) (((x) << 0) & 0x0000000f) - -/* macros for cmac_cross_corr */ -#define PHY_ANALOG_CMAC_CROSS_CORR_ADDRESS 0x000003b8 -#define PHY_ANALOG_CMAC_CROSS_CORR_OFFSET 0x000003b8 -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_SET(x) (((x) << 0) & 0x0000000f) - -/* macros for cmac_i2q2 */ -#define PHY_ANALOG_CMAC_I2Q2_ADDRESS 0x000003bc -#define PHY_ANALOG_CMAC_I2Q2_OFFSET 0x000003bc -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_SET(x) (((x) << 0) & 0x0000000f) - -/* macros for cmac_power_hpf */ -#define PHY_ANALOG_CMAC_POWER_HPF_ADDRESS 0x000003c0 -#define PHY_ANALOG_CMAC_POWER_HPF_OFFSET 0x000003c0 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_MSB 7 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_LSB 4 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_MASK 0x000000f0 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_SET(x) (((x) << 4) & 0x000000f0) - -/* macros for rxdac_set1 */ -#define PHY_ANALOG_RXDAC_SET1_ADDRESS 0x000003c4 -#define PHY_ANALOG_RXDAC_SET1_OFFSET 0x000003c4 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_MSB 1 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_LSB 0 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_MASK 0x00000003 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_MSB 4 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_LSB 4 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_MASK 0x00000010 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_MSB 13 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_LSB 8 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_MASK 0x00003f00 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_MSB 19 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_LSB 16 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_MASK 0x000f0000 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_GET(x) (((x) & 0x000f0000) >> 16) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_SET(x) (((x) << 16) & 0x000f0000) - -/* macros for rxdac_set2 */ -#define PHY_ANALOG_RXDAC_SET2_ADDRESS 0x000003c8 -#define PHY_ANALOG_RXDAC_SET2_OFFSET 0x000003c8 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_MSB 4 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_LSB 0 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_MASK 0x0000001f -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_MSB 12 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_LSB 8 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_MASK 0x00001f00 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_GET(x) (((x) & 0x00001f00) >> 8) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_SET(x) (((x) << 8) & 0x00001f00) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_MSB 20 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_LSB 16 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_MASK 0x001f0000 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_GET(x) (((x) & 0x001f0000) >> 16) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_SET(x) (((x) << 16) & 0x001f0000) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_MSB 28 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_LSB 24 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_MASK 0x1f000000 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_GET(x) (((x) & 0x1f000000) >> 24) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_SET(x) (((x) << 24) & 0x1f000000) - -/* macros for rxdac_long_shift */ -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ADDRESS 0x000003cc -#define PHY_ANALOG_RXDAC_LONG_SHIFT_OFFSET 0x000003cc -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_MSB 4 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_LSB 0 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_MASK 0x0000001f -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_MSB 12 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_LSB 8 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_MASK 0x00001f00 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_GET(x) (((x) & 0x00001f00) >> 8) -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_SET(x) (((x) << 8) & 0x00001f00) - -/* macros for cmac_results_i */ -#define PHY_ANALOG_CMAC_RESULTS_I_ADDRESS 0x000003d0 -#define PHY_ANALOG_CMAC_RESULTS_I_OFFSET 0x000003d0 -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_MSB 31 -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_LSB 0 -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_MASK 0xffffffff -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for cmac_results_q */ -#define PHY_ANALOG_CMAC_RESULTS_Q_ADDRESS 0x000003d4 -#define PHY_ANALOG_CMAC_RESULTS_Q_OFFSET 0x000003d4 -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_MSB 31 -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_LSB 0 -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_MASK 0xffffffff -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for PMU1 */ -#define PHY_ANALOG_PMU1_ADDRESS 0x00000740 -#define PHY_ANALOG_PMU1_OFFSET 0x00000740 -#define PHY_ANALOG_PMU1_SPARE_MSB 10 -#define PHY_ANALOG_PMU1_SPARE_LSB 0 -#define PHY_ANALOG_PMU1_SPARE_MASK 0x000007ff -#define PHY_ANALOG_PMU1_SPARE_GET(x) (((x) & 0x000007ff) >> 0) -#define PHY_ANALOG_PMU1_SPARE_SET(x) (((x) << 0) & 0x000007ff) -#define PHY_ANALOG_PMU1_OTP_V25_PWD_MSB 11 -#define PHY_ANALOG_PMU1_OTP_V25_PWD_LSB 11 -#define PHY_ANALOG_PMU1_OTP_V25_PWD_MASK 0x00000800 -#define PHY_ANALOG_PMU1_OTP_V25_PWD_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_PMU1_OTP_V25_PWD_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_PMU1_PAREGON_MAN_MSB 12 -#define PHY_ANALOG_PMU1_PAREGON_MAN_LSB 12 -#define PHY_ANALOG_PMU1_PAREGON_MAN_MASK 0x00001000 -#define PHY_ANALOG_PMU1_PAREGON_MAN_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_PMU1_PAREGON_MAN_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_PMU1_OTPREGON_MAN_MSB 13 -#define PHY_ANALOG_PMU1_OTPREGON_MAN_LSB 13 -#define PHY_ANALOG_PMU1_OTPREGON_MAN_MASK 0x00002000 -#define PHY_ANALOG_PMU1_OTPREGON_MAN_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_PMU1_OTPREGON_MAN_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_PMU1_DREGON_MAN_MSB 14 -#define PHY_ANALOG_PMU1_DREGON_MAN_LSB 14 -#define PHY_ANALOG_PMU1_DREGON_MAN_MASK 0x00004000 -#define PHY_ANALOG_PMU1_DREGON_MAN_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_PMU1_DREGON_MAN_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_PMU1_DISCONTMODEEN_MSB 15 -#define PHY_ANALOG_PMU1_DISCONTMODEEN_LSB 15 -#define PHY_ANALOG_PMU1_DISCONTMODEEN_MASK 0x00008000 -#define PHY_ANALOG_PMU1_DISCONTMODEEN_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_PMU1_DISCONTMODEEN_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_PMU1_SWREGON_MAN_MSB 16 -#define PHY_ANALOG_PMU1_SWREGON_MAN_LSB 16 -#define PHY_ANALOG_PMU1_SWREGON_MAN_MASK 0x00010000 -#define PHY_ANALOG_PMU1_SWREGON_MAN_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_PMU1_SWREGON_MAN_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_MSB 18 -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_LSB 17 -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_MASK 0x00060000 -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_GET(x) (((x) & 0x00060000) >> 17) -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_SET(x) (((x) << 17) & 0x00060000) -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_MSB 21 -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_LSB 19 -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_MASK 0x00380000 -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_GET(x) (((x) & 0x00380000) >> 19) -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_SET(x) (((x) << 19) & 0x00380000) -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_MSB 23 -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_LSB 22 -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_MASK 0x00c00000 -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_GET(x) (((x) & 0x00c00000) >> 22) -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_SET(x) (((x) << 22) & 0x00c00000) -#define PHY_ANALOG_PMU1_SREG_LVLCTR_MSB 25 -#define PHY_ANALOG_PMU1_SREG_LVLCTR_LSB 24 -#define PHY_ANALOG_PMU1_SREG_LVLCTR_MASK 0x03000000 -#define PHY_ANALOG_PMU1_SREG_LVLCTR_GET(x) (((x) & 0x03000000) >> 24) -#define PHY_ANALOG_PMU1_SREG_LVLCTR_SET(x) (((x) << 24) & 0x03000000) -#define PHY_ANALOG_PMU1_DREG_LVLCTR_MSB 27 -#define PHY_ANALOG_PMU1_DREG_LVLCTR_LSB 26 -#define PHY_ANALOG_PMU1_DREG_LVLCTR_MASK 0x0c000000 -#define PHY_ANALOG_PMU1_DREG_LVLCTR_GET(x) (((x) & 0x0c000000) >> 26) -#define PHY_ANALOG_PMU1_DREG_LVLCTR_SET(x) (((x) << 26) & 0x0c000000) -#define PHY_ANALOG_PMU1_PAREG_XPNP_MSB 28 -#define PHY_ANALOG_PMU1_PAREG_XPNP_LSB 28 -#define PHY_ANALOG_PMU1_PAREG_XPNP_MASK 0x10000000 -#define PHY_ANALOG_PMU1_PAREG_XPNP_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_PMU1_PAREG_XPNP_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_MSB 31 -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_LSB 29 -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_MASK 0xe0000000 -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for PMU2 */ -#define PHY_ANALOG_PMU2_ADDRESS 0x00000744 -#define PHY_ANALOG_PMU2_OFFSET 0x00000744 -#define PHY_ANALOG_PMU2_SPARE_MSB 7 -#define PHY_ANALOG_PMU2_SPARE_LSB 0 -#define PHY_ANALOG_PMU2_SPARE_MASK 0x000000ff -#define PHY_ANALOG_PMU2_SPARE_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_ANALOG_PMU2_SPARE_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_MSB 8 -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_LSB 8 -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_MASK 0x00000100 -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_MSB 9 -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_LSB 9 -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_MASK 0x00000200 -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_MSB 10 -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_LSB 10 -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_MASK 0x00000400 -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_MSB 11 -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_LSB 11 -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_MASK 0x00000800 -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_MSB 12 -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_LSB 12 -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_MASK 0x00001000 -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_MSB 13 -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_LSB 13 -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_MASK 0x00002000 -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_MSB 14 -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_LSB 14 -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_MASK 0x00004000 -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_MSB 15 -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_LSB 15 -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_MASK 0x00008000 -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_PMU2_PMU_MAN_OVERRIDE_EN_MSB 16 -#define PHY_ANALOG_PMU2_PMU_MAN_OVERRIDE_EN_LSB 16 -#define PHY_ANALOG_PMU2_PMU_MAN_OVERRIDE_EN_MASK 0x00010000 -#define PHY_ANALOG_PMU2_PMU_MAN_OVERRIDE_EN_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_PMU2_PMU_MAN_OVERRIDE_EN_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_MSB 18 -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_LSB 17 -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_MASK 0x00060000 -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_GET(x) (((x) & 0x00060000) >> 17) -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_SET(x) (((x) << 17) & 0x00060000) -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_MSB 19 -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_LSB 19 -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_MASK 0x00080000 -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_SET(x) (((x) << 19) & 0x00080000) -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_MSB 21 -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_LSB 20 -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_MASK 0x00300000 -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_GET(x) (((x) & 0x00300000) >> 20) -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_SET(x) (((x) << 20) & 0x00300000) -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_MSB 22 -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_LSB 22 -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_MASK 0x00400000 -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_MSB 24 -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_LSB 23 -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_MASK 0x01800000 -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_GET(x) (((x) & 0x01800000) >> 23) -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_SET(x) (((x) << 23) & 0x01800000) -#define PHY_ANALOG_PMU2_SWREG2ATB_MSB 27 -#define PHY_ANALOG_PMU2_SWREG2ATB_LSB 25 -#define PHY_ANALOG_PMU2_SWREG2ATB_MASK 0x0e000000 -#define PHY_ANALOG_PMU2_SWREG2ATB_GET(x) (((x) & 0x0e000000) >> 25) -#define PHY_ANALOG_PMU2_SWREG2ATB_SET(x) (((x) << 25) & 0x0e000000) -#define PHY_ANALOG_PMU2_OTPREG2ATB_MSB 28 -#define PHY_ANALOG_PMU2_OTPREG2ATB_LSB 28 -#define PHY_ANALOG_PMU2_OTPREG2ATB_MASK 0x10000000 -#define PHY_ANALOG_PMU2_OTPREG2ATB_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_PMU2_OTPREG2ATB_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_MSB 30 -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_LSB 29 -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_MASK 0x60000000 -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_GET(x) (((x) & 0x60000000) >> 29) -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_SET(x) (((x) << 29) & 0x60000000) -#define PHY_ANALOG_PMU2_DREG_LVLCTR_MANOVR_EN_MSB 31 -#define PHY_ANALOG_PMU2_DREG_LVLCTR_MANOVR_EN_LSB 31 -#define PHY_ANALOG_PMU2_DREG_LVLCTR_MANOVR_EN_MASK 0x80000000 -#define PHY_ANALOG_PMU2_DREG_LVLCTR_MANOVR_EN_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_PMU2_DREG_LVLCTR_MANOVR_EN_SET(x) (((x) << 31) & 0x80000000) - - -#ifndef __ASSEMBLER__ - -typedef struct analog_intf_ares_reg_reg_s { - volatile unsigned int RXRF_BIAS1; /* 0x0 - 0x4 */ - volatile unsigned int RXRF_BIAS2; /* 0x4 - 0x8 */ - volatile unsigned int RXRF_GAINSTAGES; /* 0x8 - 0xc */ - volatile unsigned int RXRF_AGC; /* 0xc - 0x10 */ - volatile char pad__0[0x30]; /* 0x10 - 0x40 */ - volatile unsigned int TXRF1; /* 0x40 - 0x44 */ - volatile unsigned int TXRF2; /* 0x44 - 0x48 */ - volatile unsigned int TXRF3; /* 0x48 - 0x4c */ - volatile unsigned int TXRF4; /* 0x4c - 0x50 */ - volatile unsigned int TXRF5; /* 0x50 - 0x54 */ - volatile unsigned int TXRF6; /* 0x54 - 0x58 */ - volatile unsigned int TXRF7; /* 0x58 - 0x5c */ - volatile unsigned int TXRF8; /* 0x5c - 0x60 */ - volatile unsigned int TXRF9; /* 0x60 - 0x64 */ - volatile unsigned int TXRF10; /* 0x64 - 0x68 */ - volatile unsigned int TXRF11; /* 0x68 - 0x6c */ - volatile unsigned int TXRF12; /* 0x6c - 0x70 */ - volatile char pad__1[0x10]; /* 0x70 - 0x80 */ - volatile unsigned int SYNTH1; /* 0x80 - 0x84 */ - volatile unsigned int SYNTH2; /* 0x84 - 0x88 */ - volatile unsigned int SYNTH3; /* 0x88 - 0x8c */ - volatile unsigned int SYNTH4; /* 0x8c - 0x90 */ - volatile unsigned int SYNTH5; /* 0x90 - 0x94 */ - volatile unsigned int SYNTH6; /* 0x94 - 0x98 */ - volatile unsigned int SYNTH7; /* 0x98 - 0x9c */ - volatile unsigned int SYNTH8; /* 0x9c - 0xa0 */ - volatile unsigned int SYNTH9; /* 0xa0 - 0xa4 */ - volatile unsigned int SYNTH10; /* 0xa4 - 0xa8 */ - volatile unsigned int SYNTH11; /* 0xa8 - 0xac */ - volatile unsigned int SYNTH12; /* 0xac - 0xb0 */ - volatile char pad__2[0x10]; /* 0xb0 - 0xc0 */ - volatile unsigned int BIAS1; /* 0xc0 - 0xc4 */ - volatile unsigned int BIAS2; /* 0xc4 - 0xc8 */ - volatile unsigned int BIAS3; /* 0xc8 - 0xcc */ - volatile unsigned int BIAS4; /* 0xcc - 0xd0 */ - volatile char pad__3[0x30]; /* 0xd0 - 0x100 */ - volatile unsigned int RXTX1; /* 0x100 - 0x104 */ - volatile unsigned int RXTX2; /* 0x104 - 0x108 */ - volatile unsigned int RXTX3; /* 0x108 - 0x10c */ - volatile char pad__4[0x34]; /* 0x10c - 0x140 */ - volatile unsigned int BB1; /* 0x140 - 0x144 */ - volatile unsigned int BB2; /* 0x144 - 0x148 */ - volatile char pad__5[0x138]; /* 0x148 - 0x280 */ - volatile unsigned int TOP1; /* 0x280 - 0x284 */ - volatile unsigned int TOP2; /* 0x284 - 0x288 */ - volatile unsigned int TOP3; /* 0x288 - 0x28c */ - volatile unsigned int TOP4; /* 0x28c - 0x290 */ - volatile char pad__6[0xf0]; /* 0x290 - 0x380 */ - volatile unsigned int rbist_cntrl; /* 0x380 - 0x384 */ - volatile unsigned int tx_dc_offset; /* 0x384 - 0x388 */ - volatile unsigned int tx_tonegen0; /* 0x388 - 0x38c */ - volatile unsigned int tx_tonegen1; /* 0x38c - 0x390 */ - volatile unsigned int tx_lftonegen0; /* 0x390 - 0x394 */ - volatile unsigned int tx_linear_ramp_i; /* 0x394 - 0x398 */ - volatile unsigned int tx_linear_ramp_q; /* 0x398 - 0x39c */ - volatile unsigned int tx_prbs_mag; /* 0x39c - 0x3a0 */ - volatile unsigned int tx_prbs_seed_i; /* 0x3a0 - 0x3a4 */ - volatile unsigned int tx_prbs_seed_q; /* 0x3a4 - 0x3a8 */ - volatile unsigned int cmac_dc_cancel; /* 0x3a8 - 0x3ac */ - volatile unsigned int cmac_dc_offset; /* 0x3ac - 0x3b0 */ - volatile unsigned int cmac_corr; /* 0x3b0 - 0x3b4 */ - volatile unsigned int cmac_power; /* 0x3b4 - 0x3b8 */ - volatile unsigned int cmac_cross_corr; /* 0x3b8 - 0x3bc */ - volatile unsigned int cmac_i2q2; /* 0x3bc - 0x3c0 */ - volatile unsigned int cmac_power_hpf; /* 0x3c0 - 0x3c4 */ - volatile unsigned int rxdac_set1; /* 0x3c4 - 0x3c8 */ - volatile unsigned int rxdac_set2; /* 0x3c8 - 0x3cc */ - volatile unsigned int rxdac_long_shift; /* 0x3cc - 0x3d0 */ - volatile unsigned int cmac_results_i; /* 0x3d0 - 0x3d4 */ - volatile unsigned int cmac_results_q; /* 0x3d4 - 0x3d8 */ - volatile char pad__7[0x368]; /* 0x3d8 - 0x740 */ - volatile unsigned int PMU1; /* 0x740 - 0x744 */ - volatile unsigned int PMU2; /* 0x744 - 0x748 */ -} analog_intf_ares_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _ANALOG_INTF_ARES_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/analog_intf_athr_wlan_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/analog_intf_athr_wlan_reg.h deleted file mode 100644 index e51497987972..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/analog_intf_athr_wlan_reg.h +++ /dev/null @@ -1,3674 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2009 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _ANALOG_INTF_ATHR_WLAN_REG_REG_H_ -#define _ANALOG_INTF_ATHR_WLAN_REG_REG_H_ - - -/* macros for RXRF_BIAS1 */ -#define PHY_ANALOG_RXRF_BIAS1_ADDRESS 0x00000000 -#define PHY_ANALOG_RXRF_BIAS1_OFFSET 0x00000000 -#define PHY_ANALOG_RXRF_BIAS1_SPARE_MSB 0 -#define PHY_ANALOG_RXRF_BIAS1_SPARE_LSB 0 -#define PHY_ANALOG_RXRF_BIAS1_SPARE_MASK 0x00000001 -#define PHY_ANALOG_RXRF_BIAS1_SPARE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXRF_BIAS1_SPARE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_MSB 3 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_LSB 1 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_MASK 0x0000000e -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_MSB 6 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_LSB 4 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_MASK 0x00000070 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_GET(x) (((x) & 0x00000070) >> 4) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_SET(x) (((x) << 4) & 0x00000070) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_MSB 9 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_LSB 7 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_MASK 0x00000380 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_GET(x) (((x) & 0x00000380) >> 7) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_SET(x) (((x) << 7) & 0x00000380) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_MSB 12 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_LSB 10 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_MASK 0x00001c00 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_GET(x) (((x) & 0x00001c00) >> 10) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_SET(x) (((x) << 10) & 0x00001c00) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_MSB 15 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_LSB 13 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_MASK 0x0000e000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_GET(x) (((x) & 0x0000e000) >> 13) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_SET(x) (((x) << 13) & 0x0000e000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_MSB 18 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_LSB 16 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_MASK 0x00070000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_GET(x) (((x) & 0x00070000) >> 16) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_SET(x) (((x) << 16) & 0x00070000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_MSB 21 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_LSB 19 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_MASK 0x00380000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_GET(x) (((x) & 0x00380000) >> 19) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_SET(x) (((x) << 19) & 0x00380000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_MSB 24 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_LSB 22 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_MASK 0x01c00000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_GET(x) (((x) & 0x01c00000) >> 22) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_SET(x) (((x) << 22) & 0x01c00000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_MSB 27 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_LSB 25 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_MASK 0x0e000000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_GET(x) (((x) & 0x0e000000) >> 25) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_SET(x) (((x) << 25) & 0x0e000000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_MSB 30 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_LSB 28 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_MASK 0x70000000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_GET(x) (((x) & 0x70000000) >> 28) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_SET(x) (((x) << 28) & 0x70000000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_MSB 31 -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_LSB 31 -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_MASK 0x80000000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_SET(x) (((x) << 31) & 0x80000000) - -/* macros for RXRF_BIAS2 */ -#define PHY_ANALOG_RXRF_BIAS2_ADDRESS 0x00000004 -#define PHY_ANALOG_RXRF_BIAS2_OFFSET 0x00000004 -#define PHY_ANALOG_RXRF_BIAS2_SPARE_MSB 0 -#define PHY_ANALOG_RXRF_BIAS2_SPARE_LSB 0 -#define PHY_ANALOG_RXRF_BIAS2_SPARE_MASK 0x00000001 -#define PHY_ANALOG_RXRF_BIAS2_SPARE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXRF_BIAS2_SPARE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXRF_BIAS2_PKEN_MSB 3 -#define PHY_ANALOG_RXRF_BIAS2_PKEN_LSB 1 -#define PHY_ANALOG_RXRF_BIAS2_PKEN_MASK 0x0000000e -#define PHY_ANALOG_RXRF_BIAS2_PKEN_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_ANALOG_RXRF_BIAS2_PKEN_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_MSB 6 -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_LSB 4 -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_MASK 0x00000070 -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_GET(x) (((x) & 0x00000070) >> 4) -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_SET(x) (((x) << 4) & 0x00000070) -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_MSB 7 -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_LSB 7 -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_MASK 0x00000080 -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPAREH_MSB 10 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPAREH_LSB 8 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPAREH_MASK 0x00000700 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPAREH_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPAREH_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPARE_MSB 13 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPARE_LSB 11 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPARE_MASK 0x00003800 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPARE_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPARE_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25LNABUF_MSB 16 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25LNABUF_LSB 14 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25LNABUF_MASK 0x0001c000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25LNABUF_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25LNABUF_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGCH_MSB 19 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGCH_LSB 17 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGCH_MASK 0x000e0000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGCH_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGCH_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC_MSB 22 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC_LSB 20 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC_MASK 0x00700000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC_MSB 25 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC_LSB 23 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC_MASK 0x03800000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_MSB 28 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_LSB 26 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_MASK 0x1c000000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_MSB 31 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_LSB 29 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_MASK 0xe0000000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for RXRF_GAINSTAGES */ -#define PHY_ANALOG_RXRF_GAINSTAGES_ADDRESS 0x00000008 -#define PHY_ANALOG_RXRF_GAINSTAGES_OFFSET 0x00000008 -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_MSB 0 -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_LSB 0 -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_MASK 0x00000001 -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_MSB 1 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_LSB 1 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_MASK 0x00000002 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_MSB 3 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_LSB 2 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_MASK 0x0000000c -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_MSB 5 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_LSB 4 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_MASK 0x00000030 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_GET(x) (((x) & 0x00000030) >> 4) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_SET(x) (((x) << 4) & 0x00000030) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_MSB 6 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_LSB 6 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_MASK 0x00000040 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_MSB 7 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_LSB 7 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_MASK 0x00000080 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_MSB 8 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_LSB 8 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_MASK 0x00000100 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_MSB 9 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_LSB 9 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_MASK 0x00000200 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_MSB 10 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_LSB 10 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_MASK 0x00000400 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_MSB 12 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_LSB 11 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_MASK 0x00001800 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_GET(x) (((x) & 0x00001800) >> 11) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_SET(x) (((x) << 11) & 0x00001800) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_MSB 13 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_LSB 13 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_MASK 0x00002000 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_MSB 14 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_LSB 14 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_MASK 0x00004000 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_MSB 15 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_LSB 15 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_MASK 0x00008000 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_MSB 16 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_LSB 16 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_MASK 0x00010000 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_MSB 17 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_LSB 17 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_MASK 0x00020000 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_MSB 19 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_LSB 18 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_MASK 0x000c0000 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_GET(x) (((x) & 0x000c0000) >> 18) -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_SET(x) (((x) << 18) & 0x000c0000) -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_MSB 22 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_LSB 20 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_MASK 0x00700000 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_MSB 25 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_LSB 23 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_MASK 0x03800000 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_MSB 27 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_LSB 26 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_MASK 0x0c000000 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_GET(x) (((x) & 0x0c000000) >> 26) -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_SET(x) (((x) << 26) & 0x0c000000) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_MSB 30 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_LSB 28 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_MASK 0x70000000 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_GET(x) (((x) & 0x70000000) >> 28) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_SET(x) (((x) << 28) & 0x70000000) -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_MSB 31 -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_LSB 31 -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_MASK 0x80000000 -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for RXRF_AGC */ -#define PHY_ANALOG_RXRF_AGC_ADDRESS 0x0000000c -#define PHY_ANALOG_RXRF_AGC_OFFSET 0x0000000c -#define PHY_ANALOG_RXRF_AGC_RF5G_ON_DURING_CALPA_MSB 0 -#define PHY_ANALOG_RXRF_AGC_RF5G_ON_DURING_CALPA_LSB 0 -#define PHY_ANALOG_RXRF_AGC_RF5G_ON_DURING_CALPA_MASK 0x00000001 -#define PHY_ANALOG_RXRF_AGC_RF5G_ON_DURING_CALPA_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXRF_AGC_RF5G_ON_DURING_CALPA_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXRF_AGC_RF2G_ON_DURING_CALPA_MSB 1 -#define PHY_ANALOG_RXRF_AGC_RF2G_ON_DURING_CALPA_LSB 1 -#define PHY_ANALOG_RXRF_AGC_RF2G_ON_DURING_CALPA_MASK 0x00000002 -#define PHY_ANALOG_RXRF_AGC_RF2G_ON_DURING_CALPA_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_RXRF_AGC_RF2G_ON_DURING_CALPA_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_RXRF_AGC_AGC_OUT_MSB 2 -#define PHY_ANALOG_RXRF_AGC_AGC_OUT_LSB 2 -#define PHY_ANALOG_RXRF_AGC_AGC_OUT_MASK 0x00000004 -#define PHY_ANALOG_RXRF_AGC_AGC_OUT_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_RXRF_AGC_LNABUFGAIN2X_MSB 3 -#define PHY_ANALOG_RXRF_AGC_LNABUFGAIN2X_LSB 3 -#define PHY_ANALOG_RXRF_AGC_LNABUFGAIN2X_MASK 0x00000008 -#define PHY_ANALOG_RXRF_AGC_LNABUFGAIN2X_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_RXRF_AGC_LNABUFGAIN2X_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_RXRF_AGC_LNABUF_PWD_OVR_MSB 4 -#define PHY_ANALOG_RXRF_AGC_LNABUF_PWD_OVR_LSB 4 -#define PHY_ANALOG_RXRF_AGC_LNABUF_PWD_OVR_MASK 0x00000010 -#define PHY_ANALOG_RXRF_AGC_LNABUF_PWD_OVR_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_RXRF_AGC_LNABUF_PWD_OVR_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_RXRF_AGC_PWD_LNABUF_MSB 5 -#define PHY_ANALOG_RXRF_AGC_PWD_LNABUF_LSB 5 -#define PHY_ANALOG_RXRF_AGC_PWD_LNABUF_MASK 0x00000020 -#define PHY_ANALOG_RXRF_AGC_PWD_LNABUF_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_RXRF_AGC_PWD_LNABUF_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_MSB 8 -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_LSB 6 -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_MASK 0x000001c0 -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_GET(x) (((x) & 0x000001c0) >> 6) -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_SET(x) (((x) << 6) & 0x000001c0) -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_MSB 14 -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_LSB 9 -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_MASK 0x00007e00 -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_GET(x) (((x) & 0x00007e00) >> 9) -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_SET(x) (((x) << 9) & 0x00007e00) -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_MSB 18 -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_LSB 15 -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_MASK 0x00078000 -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_GET(x) (((x) & 0x00078000) >> 15) -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_SET(x) (((x) << 15) & 0x00078000) -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_MSB 24 -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_LSB 19 -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_MASK 0x01f80000 -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_GET(x) (((x) & 0x01f80000) >> 19) -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_SET(x) (((x) << 19) & 0x01f80000) -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_MSB 28 -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_LSB 25 -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_MASK 0x1e000000 -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_GET(x) (((x) & 0x1e000000) >> 25) -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_SET(x) (((x) << 25) & 0x1e000000) -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_MSB 29 -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_LSB 29 -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_MASK 0x20000000 -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_MSB 30 -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_LSB 30 -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_MASK 0x40000000 -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_MSB 31 -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_LSB 31 -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_MASK 0x80000000 -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TXRF1 */ -#define PHY_ANALOG_TXRF1_ADDRESS 0x00000040 -#define PHY_ANALOG_TXRF1_OFFSET 0x00000040 -#define PHY_ANALOG_TXRF1_PDLOBUF5G_MSB 0 -#define PHY_ANALOG_TXRF1_PDLOBUF5G_LSB 0 -#define PHY_ANALOG_TXRF1_PDLOBUF5G_MASK 0x00000001 -#define PHY_ANALOG_TXRF1_PDLOBUF5G_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_TXRF1_PDLOBUF5G_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_TXRF1_PDLODIV5G_MSB 1 -#define PHY_ANALOG_TXRF1_PDLODIV5G_LSB 1 -#define PHY_ANALOG_TXRF1_PDLODIV5G_MASK 0x00000002 -#define PHY_ANALOG_TXRF1_PDLODIV5G_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_TXRF1_PDLODIV5G_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_TXRF1_LOBUF5GFORCED_MSB 2 -#define PHY_ANALOG_TXRF1_LOBUF5GFORCED_LSB 2 -#define PHY_ANALOG_TXRF1_LOBUF5GFORCED_MASK 0x00000004 -#define PHY_ANALOG_TXRF1_LOBUF5GFORCED_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_TXRF1_LOBUF5GFORCED_SET(x) (((x) << 2) & 0x00000004) -#define PHY_ANALOG_TXRF1_LODIV5GFORCED_MSB 3 -#define PHY_ANALOG_TXRF1_LODIV5GFORCED_LSB 3 -#define PHY_ANALOG_TXRF1_LODIV5GFORCED_MASK 0x00000008 -#define PHY_ANALOG_TXRF1_LODIV5GFORCED_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_TXRF1_LODIV5GFORCED_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_TXRF1_PADRV2GN5G_MSB 7 -#define PHY_ANALOG_TXRF1_PADRV2GN5G_LSB 4 -#define PHY_ANALOG_TXRF1_PADRV2GN5G_MASK 0x000000f0 -#define PHY_ANALOG_TXRF1_PADRV2GN5G_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_TXRF1_PADRV2GN5G_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_ANALOG_TXRF1_PADRV3GN5G_MSB 11 -#define PHY_ANALOG_TXRF1_PADRV3GN5G_LSB 8 -#define PHY_ANALOG_TXRF1_PADRV3GN5G_MASK 0x00000f00 -#define PHY_ANALOG_TXRF1_PADRV3GN5G_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_TXRF1_PADRV3GN5G_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_TXRF1_PADRV4GN5G_MSB 15 -#define PHY_ANALOG_TXRF1_PADRV4GN5G_LSB 12 -#define PHY_ANALOG_TXRF1_PADRV4GN5G_MASK 0x0000f000 -#define PHY_ANALOG_TXRF1_PADRV4GN5G_GET(x) (((x) & 0x0000f000) >> 12) -#define PHY_ANALOG_TXRF1_PADRV4GN5G_SET(x) (((x) << 12) & 0x0000f000) -#define PHY_ANALOG_TXRF1_LOCALTXGAIN5G_MSB 16 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN5G_LSB 16 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN5G_MASK 0x00010000 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN5G_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_TXRF1_LOCALTXGAIN5G_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_TXRF1_PDOUT2G_MSB 17 -#define PHY_ANALOG_TXRF1_PDOUT2G_LSB 17 -#define PHY_ANALOG_TXRF1_PDOUT2G_MASK 0x00020000 -#define PHY_ANALOG_TXRF1_PDOUT2G_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_TXRF1_PDOUT2G_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_TXRF1_PDDR2G_MSB 18 -#define PHY_ANALOG_TXRF1_PDDR2G_LSB 18 -#define PHY_ANALOG_TXRF1_PDDR2G_MASK 0x00040000 -#define PHY_ANALOG_TXRF1_PDDR2G_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_TXRF1_PDDR2G_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_TXRF1_PDMXR2G_MSB 19 -#define PHY_ANALOG_TXRF1_PDMXR2G_LSB 19 -#define PHY_ANALOG_TXRF1_PDMXR2G_MASK 0x00080000 -#define PHY_ANALOG_TXRF1_PDMXR2G_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_ANALOG_TXRF1_PDMXR2G_SET(x) (((x) << 19) & 0x00080000) -#define PHY_ANALOG_TXRF1_PDLOBUF2G_MSB 20 -#define PHY_ANALOG_TXRF1_PDLOBUF2G_LSB 20 -#define PHY_ANALOG_TXRF1_PDLOBUF2G_MASK 0x00100000 -#define PHY_ANALOG_TXRF1_PDLOBUF2G_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_TXRF1_PDLOBUF2G_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_TXRF1_PDLODIV2G_MSB 21 -#define PHY_ANALOG_TXRF1_PDLODIV2G_LSB 21 -#define PHY_ANALOG_TXRF1_PDLODIV2G_MASK 0x00200000 -#define PHY_ANALOG_TXRF1_PDLODIV2G_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_TXRF1_PDLODIV2G_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_MSB 22 -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_LSB 22 -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_MASK 0x00400000 -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_MSB 23 -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_LSB 23 -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_MASK 0x00800000 -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_TXRF1_PADRVGN2G_MSB 30 -#define PHY_ANALOG_TXRF1_PADRVGN2G_LSB 24 -#define PHY_ANALOG_TXRF1_PADRVGN2G_MASK 0x7f000000 -#define PHY_ANALOG_TXRF1_PADRVGN2G_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_ANALOG_TXRF1_PADRVGN2G_SET(x) (((x) << 24) & 0x7f000000) -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_MSB 31 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_LSB 31 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_MASK 0x80000000 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TXRF2 */ -#define PHY_ANALOG_TXRF2_ADDRESS 0x00000044 -#define PHY_ANALOG_TXRF2_OFFSET 0x00000044 -#define PHY_ANALOG_TXRF2_D3B5G_MSB 2 -#define PHY_ANALOG_TXRF2_D3B5G_LSB 0 -#define PHY_ANALOG_TXRF2_D3B5G_MASK 0x00000007 -#define PHY_ANALOG_TXRF2_D3B5G_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_TXRF2_D3B5G_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_TXRF2_D4B5G_MSB 5 -#define PHY_ANALOG_TXRF2_D4B5G_LSB 3 -#define PHY_ANALOG_TXRF2_D4B5G_MASK 0x00000038 -#define PHY_ANALOG_TXRF2_D4B5G_GET(x) (((x) & 0x00000038) >> 3) -#define PHY_ANALOG_TXRF2_D4B5G_SET(x) (((x) << 3) & 0x00000038) -#define PHY_ANALOG_TXRF2_OCAS2G_MSB 8 -#define PHY_ANALOG_TXRF2_OCAS2G_LSB 6 -#define PHY_ANALOG_TXRF2_OCAS2G_MASK 0x000001c0 -#define PHY_ANALOG_TXRF2_OCAS2G_GET(x) (((x) & 0x000001c0) >> 6) -#define PHY_ANALOG_TXRF2_OCAS2G_SET(x) (((x) << 6) & 0x000001c0) -#define PHY_ANALOG_TXRF2_DCAS2G_MSB 11 -#define PHY_ANALOG_TXRF2_DCAS2G_LSB 9 -#define PHY_ANALOG_TXRF2_DCAS2G_MASK 0x00000e00 -#define PHY_ANALOG_TXRF2_DCAS2G_GET(x) (((x) & 0x00000e00) >> 9) -#define PHY_ANALOG_TXRF2_DCAS2G_SET(x) (((x) << 9) & 0x00000e00) -#define PHY_ANALOG_TXRF2_OB2G_PALOFF_MSB 14 -#define PHY_ANALOG_TXRF2_OB2G_PALOFF_LSB 12 -#define PHY_ANALOG_TXRF2_OB2G_PALOFF_MASK 0x00007000 -#define PHY_ANALOG_TXRF2_OB2G_PALOFF_GET(x) (((x) & 0x00007000) >> 12) -#define PHY_ANALOG_TXRF2_OB2G_PALOFF_SET(x) (((x) << 12) & 0x00007000) -#define PHY_ANALOG_TXRF2_OB2G_QAM_MSB 17 -#define PHY_ANALOG_TXRF2_OB2G_QAM_LSB 15 -#define PHY_ANALOG_TXRF2_OB2G_QAM_MASK 0x00038000 -#define PHY_ANALOG_TXRF2_OB2G_QAM_GET(x) (((x) & 0x00038000) >> 15) -#define PHY_ANALOG_TXRF2_OB2G_QAM_SET(x) (((x) << 15) & 0x00038000) -#define PHY_ANALOG_TXRF2_OB2G_PSK_MSB 20 -#define PHY_ANALOG_TXRF2_OB2G_PSK_LSB 18 -#define PHY_ANALOG_TXRF2_OB2G_PSK_MASK 0x001c0000 -#define PHY_ANALOG_TXRF2_OB2G_PSK_GET(x) (((x) & 0x001c0000) >> 18) -#define PHY_ANALOG_TXRF2_OB2G_PSK_SET(x) (((x) << 18) & 0x001c0000) -#define PHY_ANALOG_TXRF2_OB2G_CCK_MSB 23 -#define PHY_ANALOG_TXRF2_OB2G_CCK_LSB 21 -#define PHY_ANALOG_TXRF2_OB2G_CCK_MASK 0x00e00000 -#define PHY_ANALOG_TXRF2_OB2G_CCK_GET(x) (((x) & 0x00e00000) >> 21) -#define PHY_ANALOG_TXRF2_OB2G_CCK_SET(x) (((x) << 21) & 0x00e00000) -#define PHY_ANALOG_TXRF2_DB2G_MSB 26 -#define PHY_ANALOG_TXRF2_DB2G_LSB 24 -#define PHY_ANALOG_TXRF2_DB2G_MASK 0x07000000 -#define PHY_ANALOG_TXRF2_DB2G_GET(x) (((x) & 0x07000000) >> 24) -#define PHY_ANALOG_TXRF2_DB2G_SET(x) (((x) << 24) & 0x07000000) -#define PHY_ANALOG_TXRF2_PDOUT5G_MSB 30 -#define PHY_ANALOG_TXRF2_PDOUT5G_LSB 27 -#define PHY_ANALOG_TXRF2_PDOUT5G_MASK 0x78000000 -#define PHY_ANALOG_TXRF2_PDOUT5G_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_ANALOG_TXRF2_PDOUT5G_SET(x) (((x) << 27) & 0x78000000) -#define PHY_ANALOG_TXRF2_PDMXR5G_MSB 31 -#define PHY_ANALOG_TXRF2_PDMXR5G_LSB 31 -#define PHY_ANALOG_TXRF2_PDMXR5G_MASK 0x80000000 -#define PHY_ANALOG_TXRF2_PDMXR5G_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_TXRF2_PDMXR5G_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TXRF3 */ -#define PHY_ANALOG_TXRF3_ADDRESS 0x00000048 -#define PHY_ANALOG_TXRF3_OFFSET 0x00000048 -#define PHY_ANALOG_TXRF3_FILTR2G_MSB 1 -#define PHY_ANALOG_TXRF3_FILTR2G_LSB 0 -#define PHY_ANALOG_TXRF3_FILTR2G_MASK 0x00000003 -#define PHY_ANALOG_TXRF3_FILTR2G_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF3_FILTR2G_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF3_PWDFB2_2G_MSB 2 -#define PHY_ANALOG_TXRF3_PWDFB2_2G_LSB 2 -#define PHY_ANALOG_TXRF3_PWDFB2_2G_MASK 0x00000004 -#define PHY_ANALOG_TXRF3_PWDFB2_2G_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_TXRF3_PWDFB2_2G_SET(x) (((x) << 2) & 0x00000004) -#define PHY_ANALOG_TXRF3_PWDFB1_2G_MSB 3 -#define PHY_ANALOG_TXRF3_PWDFB1_2G_LSB 3 -#define PHY_ANALOG_TXRF3_PWDFB1_2G_MASK 0x00000008 -#define PHY_ANALOG_TXRF3_PWDFB1_2G_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_TXRF3_PWDFB1_2G_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_TXRF3_PDFB2G_MSB 4 -#define PHY_ANALOG_TXRF3_PDFB2G_LSB 4 -#define PHY_ANALOG_TXRF3_PDFB2G_MASK 0x00000010 -#define PHY_ANALOG_TXRF3_PDFB2G_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_TXRF3_PDFB2G_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_TXRF3_RDIV5G_MSB 6 -#define PHY_ANALOG_TXRF3_RDIV5G_LSB 5 -#define PHY_ANALOG_TXRF3_RDIV5G_MASK 0x00000060 -#define PHY_ANALOG_TXRF3_RDIV5G_GET(x) (((x) & 0x00000060) >> 5) -#define PHY_ANALOG_TXRF3_RDIV5G_SET(x) (((x) << 5) & 0x00000060) -#define PHY_ANALOG_TXRF3_CAPDIV5G_MSB 9 -#define PHY_ANALOG_TXRF3_CAPDIV5G_LSB 7 -#define PHY_ANALOG_TXRF3_CAPDIV5G_MASK 0x00000380 -#define PHY_ANALOG_TXRF3_CAPDIV5G_GET(x) (((x) & 0x00000380) >> 7) -#define PHY_ANALOG_TXRF3_CAPDIV5G_SET(x) (((x) << 7) & 0x00000380) -#define PHY_ANALOG_TXRF3_PDPREDIST5G_MSB 10 -#define PHY_ANALOG_TXRF3_PDPREDIST5G_LSB 10 -#define PHY_ANALOG_TXRF3_PDPREDIST5G_MASK 0x00000400 -#define PHY_ANALOG_TXRF3_PDPREDIST5G_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_TXRF3_PDPREDIST5G_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_TXRF3_RDIV2G_MSB 12 -#define PHY_ANALOG_TXRF3_RDIV2G_LSB 11 -#define PHY_ANALOG_TXRF3_RDIV2G_MASK 0x00001800 -#define PHY_ANALOG_TXRF3_RDIV2G_GET(x) (((x) & 0x00001800) >> 11) -#define PHY_ANALOG_TXRF3_RDIV2G_SET(x) (((x) << 11) & 0x00001800) -#define PHY_ANALOG_TXRF3_PDPREDIST2G_MSB 13 -#define PHY_ANALOG_TXRF3_PDPREDIST2G_LSB 13 -#define PHY_ANALOG_TXRF3_PDPREDIST2G_MASK 0x00002000 -#define PHY_ANALOG_TXRF3_PDPREDIST2G_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_TXRF3_PDPREDIST2G_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_TXRF3_OCAS5G_MSB 16 -#define PHY_ANALOG_TXRF3_OCAS5G_LSB 14 -#define PHY_ANALOG_TXRF3_OCAS5G_MASK 0x0001c000 -#define PHY_ANALOG_TXRF3_OCAS5G_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_TXRF3_OCAS5G_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_TXRF3_D2CAS5G_MSB 19 -#define PHY_ANALOG_TXRF3_D2CAS5G_LSB 17 -#define PHY_ANALOG_TXRF3_D2CAS5G_MASK 0x000e0000 -#define PHY_ANALOG_TXRF3_D2CAS5G_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_TXRF3_D2CAS5G_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_TXRF3_D3CAS5G_MSB 22 -#define PHY_ANALOG_TXRF3_D3CAS5G_LSB 20 -#define PHY_ANALOG_TXRF3_D3CAS5G_MASK 0x00700000 -#define PHY_ANALOG_TXRF3_D3CAS5G_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_TXRF3_D3CAS5G_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_TXRF3_D4CAS5G_MSB 25 -#define PHY_ANALOG_TXRF3_D4CAS5G_LSB 23 -#define PHY_ANALOG_TXRF3_D4CAS5G_MASK 0x03800000 -#define PHY_ANALOG_TXRF3_D4CAS5G_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_TXRF3_D4CAS5G_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_TXRF3_OB5G_MSB 28 -#define PHY_ANALOG_TXRF3_OB5G_LSB 26 -#define PHY_ANALOG_TXRF3_OB5G_MASK 0x1c000000 -#define PHY_ANALOG_TXRF3_OB5G_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_TXRF3_OB5G_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_TXRF3_D2B5G_MSB 31 -#define PHY_ANALOG_TXRF3_D2B5G_LSB 29 -#define PHY_ANALOG_TXRF3_D2B5G_MASK 0xe0000000 -#define PHY_ANALOG_TXRF3_D2B5G_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_TXRF3_D2B5G_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for TXRF4 */ -#define PHY_ANALOG_TXRF4_ADDRESS 0x0000004c -#define PHY_ANALOG_TXRF4_OFFSET 0x0000004c -#define PHY_ANALOG_TXRF4_PK1B2G_CCK_MSB 1 -#define PHY_ANALOG_TXRF4_PK1B2G_CCK_LSB 0 -#define PHY_ANALOG_TXRF4_PK1B2G_CCK_MASK 0x00000003 -#define PHY_ANALOG_TXRF4_PK1B2G_CCK_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF4_PK1B2G_CCK_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF4_MIOB2G_QAM_MSB 4 -#define PHY_ANALOG_TXRF4_MIOB2G_QAM_LSB 2 -#define PHY_ANALOG_TXRF4_MIOB2G_QAM_MASK 0x0000001c -#define PHY_ANALOG_TXRF4_MIOB2G_QAM_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_ANALOG_TXRF4_MIOB2G_QAM_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_ANALOG_TXRF4_MIOB2G_PSK_MSB 7 -#define PHY_ANALOG_TXRF4_MIOB2G_PSK_LSB 5 -#define PHY_ANALOG_TXRF4_MIOB2G_PSK_MASK 0x000000e0 -#define PHY_ANALOG_TXRF4_MIOB2G_PSK_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_TXRF4_MIOB2G_PSK_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_TXRF4_MIOB2G_CCK_MSB 10 -#define PHY_ANALOG_TXRF4_MIOB2G_CCK_LSB 8 -#define PHY_ANALOG_TXRF4_MIOB2G_CCK_MASK 0x00000700 -#define PHY_ANALOG_TXRF4_MIOB2G_CCK_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_TXRF4_MIOB2G_CCK_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_TXRF4_COMP2G_QAM_MSB 13 -#define PHY_ANALOG_TXRF4_COMP2G_QAM_LSB 11 -#define PHY_ANALOG_TXRF4_COMP2G_QAM_MASK 0x00003800 -#define PHY_ANALOG_TXRF4_COMP2G_QAM_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_TXRF4_COMP2G_QAM_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_TXRF4_COMP2G_PSK_MSB 16 -#define PHY_ANALOG_TXRF4_COMP2G_PSK_LSB 14 -#define PHY_ANALOG_TXRF4_COMP2G_PSK_MASK 0x0001c000 -#define PHY_ANALOG_TXRF4_COMP2G_PSK_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_TXRF4_COMP2G_PSK_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_TXRF4_COMP2G_CCK_MSB 19 -#define PHY_ANALOG_TXRF4_COMP2G_CCK_LSB 17 -#define PHY_ANALOG_TXRF4_COMP2G_CCK_MASK 0x000e0000 -#define PHY_ANALOG_TXRF4_COMP2G_CCK_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_TXRF4_COMP2G_CCK_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_MSB 22 -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_LSB 20 -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_MASK 0x00700000 -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_MSB 25 -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_LSB 23 -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_MASK 0x03800000 -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_MSB 28 -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_LSB 26 -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_MASK 0x1c000000 -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_TXRF4_AMP2CAS2G_MSB 31 -#define PHY_ANALOG_TXRF4_AMP2CAS2G_LSB 29 -#define PHY_ANALOG_TXRF4_AMP2CAS2G_MASK 0xe0000000 -#define PHY_ANALOG_TXRF4_AMP2CAS2G_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_TXRF4_AMP2CAS2G_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for TXRF5 */ -#define PHY_ANALOG_TXRF5_ADDRESS 0x00000050 -#define PHY_ANALOG_TXRF5_OFFSET 0x00000050 -#define PHY_ANALOG_TXRF5_SPARE5_MSB 0 -#define PHY_ANALOG_TXRF5_SPARE5_LSB 0 -#define PHY_ANALOG_TXRF5_SPARE5_MASK 0x00000001 -#define PHY_ANALOG_TXRF5_SPARE5_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_TXRF5_SPARE5_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_TXRF5_PAL_LOCKED_MSB 1 -#define PHY_ANALOG_TXRF5_PAL_LOCKED_LSB 1 -#define PHY_ANALOG_TXRF5_PAL_LOCKED_MASK 0x00000002 -#define PHY_ANALOG_TXRF5_PAL_LOCKED_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_TXRF5_FBHI2G_MSB 2 -#define PHY_ANALOG_TXRF5_FBHI2G_LSB 2 -#define PHY_ANALOG_TXRF5_FBHI2G_MASK 0x00000004 -#define PHY_ANALOG_TXRF5_FBHI2G_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_TXRF5_FBLO2G_MSB 3 -#define PHY_ANALOG_TXRF5_FBLO2G_LSB 3 -#define PHY_ANALOG_TXRF5_FBLO2G_MASK 0x00000008 -#define PHY_ANALOG_TXRF5_FBLO2G_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_TXRF5_NOPALGAIN2G_MSB 4 -#define PHY_ANALOG_TXRF5_NOPALGAIN2G_LSB 4 -#define PHY_ANALOG_TXRF5_NOPALGAIN2G_MASK 0x00000010 -#define PHY_ANALOG_TXRF5_NOPALGAIN2G_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_TXRF5_NOPALGAIN2G_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_TXRF5_ENPACAL2G_MSB 5 -#define PHY_ANALOG_TXRF5_ENPACAL2G_LSB 5 -#define PHY_ANALOG_TXRF5_ENPACAL2G_MASK 0x00000020 -#define PHY_ANALOG_TXRF5_ENPACAL2G_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_TXRF5_ENPACAL2G_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_TXRF5_OFFSET2G_MSB 12 -#define PHY_ANALOG_TXRF5_OFFSET2G_LSB 6 -#define PHY_ANALOG_TXRF5_OFFSET2G_MASK 0x00001fc0 -#define PHY_ANALOG_TXRF5_OFFSET2G_GET(x) (((x) & 0x00001fc0) >> 6) -#define PHY_ANALOG_TXRF5_OFFSET2G_SET(x) (((x) << 6) & 0x00001fc0) -#define PHY_ANALOG_TXRF5_ENOFFSETCAL2G_MSB 13 -#define PHY_ANALOG_TXRF5_ENOFFSETCAL2G_LSB 13 -#define PHY_ANALOG_TXRF5_ENOFFSETCAL2G_MASK 0x00002000 -#define PHY_ANALOG_TXRF5_ENOFFSETCAL2G_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_TXRF5_ENOFFSETCAL2G_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_TXRF5_REFHI2G_MSB 16 -#define PHY_ANALOG_TXRF5_REFHI2G_LSB 14 -#define PHY_ANALOG_TXRF5_REFHI2G_MASK 0x0001c000 -#define PHY_ANALOG_TXRF5_REFHI2G_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_TXRF5_REFHI2G_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_TXRF5_REFLO2G_MSB 19 -#define PHY_ANALOG_TXRF5_REFLO2G_LSB 17 -#define PHY_ANALOG_TXRF5_REFLO2G_MASK 0x000e0000 -#define PHY_ANALOG_TXRF5_REFLO2G_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_TXRF5_REFLO2G_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_TXRF5_PALCLAMP2G_MSB 21 -#define PHY_ANALOG_TXRF5_PALCLAMP2G_LSB 20 -#define PHY_ANALOG_TXRF5_PALCLAMP2G_MASK 0x00300000 -#define PHY_ANALOG_TXRF5_PALCLAMP2G_GET(x) (((x) & 0x00300000) >> 20) -#define PHY_ANALOG_TXRF5_PALCLAMP2G_SET(x) (((x) << 20) & 0x00300000) -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_MSB 23 -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_LSB 22 -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_MASK 0x00c00000 -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_GET(x) (((x) & 0x00c00000) >> 22) -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_SET(x) (((x) << 22) & 0x00c00000) -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_MSB 25 -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_LSB 24 -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_MASK 0x03000000 -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_GET(x) (((x) & 0x03000000) >> 24) -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_SET(x) (((x) << 24) & 0x03000000) -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_MSB 27 -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_LSB 26 -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_MASK 0x0c000000 -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_GET(x) (((x) & 0x0c000000) >> 26) -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_SET(x) (((x) << 26) & 0x0c000000) -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_MSB 29 -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_LSB 28 -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_MASK 0x30000000 -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_GET(x) (((x) & 0x30000000) >> 28) -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_SET(x) (((x) << 28) & 0x30000000) -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_MSB 31 -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_LSB 30 -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_MASK 0xc0000000 -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_GET(x) (((x) & 0xc0000000) >> 30) -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for TXRF6 */ -#define PHY_ANALOG_TXRF6_ADDRESS 0x00000054 -#define PHY_ANALOG_TXRF6_OFFSET 0x00000054 -#define PHY_ANALOG_TXRF6_PALCLKGATE2G_MSB 0 -#define PHY_ANALOG_TXRF6_PALCLKGATE2G_LSB 0 -#define PHY_ANALOG_TXRF6_PALCLKGATE2G_MASK 0x00000001 -#define PHY_ANALOG_TXRF6_PALCLKGATE2G_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_TXRF6_PALCLKGATE2G_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_TXRF6_PALFLUCTCOUNT2G_MSB 8 -#define PHY_ANALOG_TXRF6_PALFLUCTCOUNT2G_LSB 1 -#define PHY_ANALOG_TXRF6_PALFLUCTCOUNT2G_MASK 0x000001fe -#define PHY_ANALOG_TXRF6_PALFLUCTCOUNT2G_GET(x) (((x) & 0x000001fe) >> 1) -#define PHY_ANALOG_TXRF6_PALFLUCTCOUNT2G_SET(x) (((x) << 1) & 0x000001fe) -#define PHY_ANALOG_TXRF6_PALFLUCTGAIN2G_MSB 10 -#define PHY_ANALOG_TXRF6_PALFLUCTGAIN2G_LSB 9 -#define PHY_ANALOG_TXRF6_PALFLUCTGAIN2G_MASK 0x00000600 -#define PHY_ANALOG_TXRF6_PALFLUCTGAIN2G_GET(x) (((x) & 0x00000600) >> 9) -#define PHY_ANALOG_TXRF6_PALFLUCTGAIN2G_SET(x) (((x) << 9) & 0x00000600) -#define PHY_ANALOG_TXRF6_PALNOFLUCT2G_MSB 11 -#define PHY_ANALOG_TXRF6_PALNOFLUCT2G_LSB 11 -#define PHY_ANALOG_TXRF6_PALNOFLUCT2G_MASK 0x00000800 -#define PHY_ANALOG_TXRF6_PALNOFLUCT2G_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_TXRF6_PALNOFLUCT2G_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_TXRF6_GAINSTEP2G_MSB 14 -#define PHY_ANALOG_TXRF6_GAINSTEP2G_LSB 12 -#define PHY_ANALOG_TXRF6_GAINSTEP2G_MASK 0x00007000 -#define PHY_ANALOG_TXRF6_GAINSTEP2G_GET(x) (((x) & 0x00007000) >> 12) -#define PHY_ANALOG_TXRF6_GAINSTEP2G_SET(x) (((x) << 12) & 0x00007000) -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_MSB 15 -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_LSB 15 -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_MASK 0x00008000 -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_TXRF6_CAPDIV_I2G_MSB 19 -#define PHY_ANALOG_TXRF6_CAPDIV_I2G_LSB 16 -#define PHY_ANALOG_TXRF6_CAPDIV_I2G_MASK 0x000f0000 -#define PHY_ANALOG_TXRF6_CAPDIV_I2G_GET(x) (((x) & 0x000f0000) >> 16) -#define PHY_ANALOG_TXRF6_CAPDIV_I2G_SET(x) (((x) << 16) & 0x000f0000) -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_MSB 23 -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_LSB 20 -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_MASK 0x00f00000 -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_GET(x) (((x) & 0x00f00000) >> 20) -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_SET(x) (((x) << 20) & 0x00f00000) -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_MSB 26 -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_LSB 24 -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_MASK 0x07000000 -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_GET(x) (((x) & 0x07000000) >> 24) -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_SET(x) (((x) << 24) & 0x07000000) -#define PHY_ANALOG_TXRF6_CAPDIV2G_MSB 30 -#define PHY_ANALOG_TXRF6_CAPDIV2G_LSB 27 -#define PHY_ANALOG_TXRF6_CAPDIV2G_MASK 0x78000000 -#define PHY_ANALOG_TXRF6_CAPDIV2G_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_ANALOG_TXRF6_CAPDIV2G_SET(x) (((x) << 27) & 0x78000000) -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_MSB 31 -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_LSB 31 -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_MASK 0x80000000 -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TXRF7 */ -#define PHY_ANALOG_TXRF7_ADDRESS 0x00000058 -#define PHY_ANALOG_TXRF7_OFFSET 0x00000058 -#define PHY_ANALOG_TXRF7_SPARE7_MSB 1 -#define PHY_ANALOG_TXRF7_SPARE7_LSB 0 -#define PHY_ANALOG_TXRF7_SPARE7_MASK 0x00000003 -#define PHY_ANALOG_TXRF7_SPARE7_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF7_SPARE7_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_MSB 7 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_LSB 2 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_MASK 0x000000fc -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_GET(x) (((x) & 0x000000fc) >> 2) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_SET(x) (((x) << 2) & 0x000000fc) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_MSB 13 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_LSB 8 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_MASK 0x00003f00 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_MSB 19 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_LSB 14 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_MASK 0x000fc000 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_GET(x) (((x) & 0x000fc000) >> 14) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_SET(x) (((x) << 14) & 0x000fc000) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_MSB 25 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_LSB 20 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_MASK 0x03f00000 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_GET(x) (((x) & 0x03f00000) >> 20) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_SET(x) (((x) << 20) & 0x03f00000) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_MSB 31 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_LSB 26 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_MASK 0xfc000000 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_GET(x) (((x) & 0xfc000000) >> 26) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_SET(x) (((x) << 26) & 0xfc000000) - -/* macros for TXRF8 */ -#define PHY_ANALOG_TXRF8_ADDRESS 0x0000005c -#define PHY_ANALOG_TXRF8_OFFSET 0x0000005c -#define PHY_ANALOG_TXRF8_SPARE8_MSB 1 -#define PHY_ANALOG_TXRF8_SPARE8_LSB 0 -#define PHY_ANALOG_TXRF8_SPARE8_MASK 0x00000003 -#define PHY_ANALOG_TXRF8_SPARE8_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF8_SPARE8_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_MSB 7 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_LSB 2 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_MASK 0x000000fc -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_GET(x) (((x) & 0x000000fc) >> 2) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_SET(x) (((x) << 2) & 0x000000fc) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_MSB 13 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_LSB 8 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_MASK 0x00003f00 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_MSB 19 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_LSB 14 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_MASK 0x000fc000 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_GET(x) (((x) & 0x000fc000) >> 14) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_SET(x) (((x) << 14) & 0x000fc000) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_MSB 25 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_LSB 20 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_MASK 0x03f00000 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_GET(x) (((x) & 0x03f00000) >> 20) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_SET(x) (((x) << 20) & 0x03f00000) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_MSB 31 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_LSB 26 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_MASK 0xfc000000 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_GET(x) (((x) & 0xfc000000) >> 26) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_SET(x) (((x) << 26) & 0xfc000000) - -/* macros for TXRF9 */ -#define PHY_ANALOG_TXRF9_ADDRESS 0x00000060 -#define PHY_ANALOG_TXRF9_OFFSET 0x00000060 -#define PHY_ANALOG_TXRF9_SPARE9_MSB 1 -#define PHY_ANALOG_TXRF9_SPARE9_LSB 0 -#define PHY_ANALOG_TXRF9_SPARE9_MASK 0x00000003 -#define PHY_ANALOG_TXRF9_SPARE9_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF9_SPARE9_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_MSB 7 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_LSB 2 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_MASK 0x000000fc -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_GET(x) (((x) & 0x000000fc) >> 2) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_SET(x) (((x) << 2) & 0x000000fc) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_MSB 13 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_LSB 8 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_MASK 0x00003f00 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_MSB 19 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_LSB 14 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_MASK 0x000fc000 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_GET(x) (((x) & 0x000fc000) >> 14) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_SET(x) (((x) << 14) & 0x000fc000) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_MSB 25 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_LSB 20 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_MASK 0x03f00000 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_GET(x) (((x) & 0x03f00000) >> 20) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_SET(x) (((x) << 20) & 0x03f00000) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_MSB 31 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_LSB 26 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_MASK 0xfc000000 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_GET(x) (((x) & 0xfc000000) >> 26) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_SET(x) (((x) << 26) & 0xfc000000) - -/* macros for TXRF10 */ -#define PHY_ANALOG_TXRF10_ADDRESS 0x00000064 -#define PHY_ANALOG_TXRF10_OFFSET 0x00000064 -#define PHY_ANALOG_TXRF10_SPARE10_MSB 2 -#define PHY_ANALOG_TXRF10_SPARE10_LSB 0 -#define PHY_ANALOG_TXRF10_SPARE10_MASK 0x00000007 -#define PHY_ANALOG_TXRF10_SPARE10_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_TXRF10_SPARE10_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_MSB 3 -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_LSB 3 -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_MASK 0x00000008 -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_TXRF10_D3B5GCALTX_MSB 6 -#define PHY_ANALOG_TXRF10_D3B5GCALTX_LSB 4 -#define PHY_ANALOG_TXRF10_D3B5GCALTX_MASK 0x00000070 -#define PHY_ANALOG_TXRF10_D3B5GCALTX_GET(x) (((x) & 0x00000070) >> 4) -#define PHY_ANALOG_TXRF10_D3B5GCALTX_SET(x) (((x) << 4) & 0x00000070) -#define PHY_ANALOG_TXRF10_D4B5GCALTX_MSB 9 -#define PHY_ANALOG_TXRF10_D4B5GCALTX_LSB 7 -#define PHY_ANALOG_TXRF10_D4B5GCALTX_MASK 0x00000380 -#define PHY_ANALOG_TXRF10_D4B5GCALTX_GET(x) (((x) & 0x00000380) >> 7) -#define PHY_ANALOG_TXRF10_D4B5GCALTX_SET(x) (((x) << 7) & 0x00000380) -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_MSB 16 -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_LSB 10 -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_MASK 0x0001fc00 -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_GET(x) (((x) & 0x0001fc00) >> 10) -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_SET(x) (((x) << 10) & 0x0001fc00) -#define PHY_ANALOG_TXRF10_DB2GCALTX_MSB 19 -#define PHY_ANALOG_TXRF10_DB2GCALTX_LSB 17 -#define PHY_ANALOG_TXRF10_DB2GCALTX_MASK 0x000e0000 -#define PHY_ANALOG_TXRF10_DB2GCALTX_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_TXRF10_DB2GCALTX_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_TXRF10_CALTXSHIFT_MSB 20 -#define PHY_ANALOG_TXRF10_CALTXSHIFT_LSB 20 -#define PHY_ANALOG_TXRF10_CALTXSHIFT_MASK 0x00100000 -#define PHY_ANALOG_TXRF10_CALTXSHIFT_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_TXRF10_CALTXSHIFT_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_MSB 21 -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_LSB 21 -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_MASK 0x00200000 -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_TXRF10_PADRVGN2G_SMOUT_MSB 27 -#define PHY_ANALOG_TXRF10_PADRVGN2G_SMOUT_LSB 22 -#define PHY_ANALOG_TXRF10_PADRVGN2G_SMOUT_MASK 0x0fc00000 -#define PHY_ANALOG_TXRF10_PADRVGN2G_SMOUT_GET(x) (((x) & 0x0fc00000) >> 22) -#define PHY_ANALOG_TXRF10_PADRVGN_INDEX2G_SMOUT_MSB 31 -#define PHY_ANALOG_TXRF10_PADRVGN_INDEX2G_SMOUT_LSB 28 -#define PHY_ANALOG_TXRF10_PADRVGN_INDEX2G_SMOUT_MASK 0xf0000000 -#define PHY_ANALOG_TXRF10_PADRVGN_INDEX2G_SMOUT_GET(x) (((x) & 0xf0000000) >> 28) - -/* macros for TXRF11 */ -#define PHY_ANALOG_TXRF11_ADDRESS 0x00000068 -#define PHY_ANALOG_TXRF11_OFFSET 0x00000068 -#define PHY_ANALOG_TXRF11_SPARE11_MSB 1 -#define PHY_ANALOG_TXRF11_SPARE11_LSB 0 -#define PHY_ANALOG_TXRF11_SPARE11_MASK 0x00000003 -#define PHY_ANALOG_TXRF11_SPARE11_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF11_SPARE11_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_MSB 4 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_LSB 2 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_MASK 0x0000001c -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_MSB 7 -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_LSB 5 -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_MASK 0x000000e0 -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_MSB 10 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_LSB 8 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_MASK 0x00000700 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_MSB 13 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_LSB 11 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_MASK 0x00003800 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_MSB 16 -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_LSB 14 -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_MASK 0x0001c000 -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_TXRF11_PWD_IC25TEMPSEN_MSB 19 -#define PHY_ANALOG_TXRF11_PWD_IC25TEMPSEN_LSB 17 -#define PHY_ANALOG_TXRF11_PWD_IC25TEMPSEN_MASK 0x000e0000 -#define PHY_ANALOG_TXRF11_PWD_IC25TEMPSEN_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_TXRF11_PWD_IC25TEMPSEN_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_MSB 22 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_LSB 20 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_MASK 0x00700000 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_MSB 25 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_LSB 23 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_MASK 0x03800000 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_MSB 28 -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_LSB 26 -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_MASK 0x1c000000 -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_MSB 31 -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_LSB 29 -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_MASK 0xe0000000 -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for TXRF12 */ -#define PHY_ANALOG_TXRF12_ADDRESS 0x0000006c -#define PHY_ANALOG_TXRF12_OFFSET 0x0000006c -#define PHY_ANALOG_TXRF12_SPARE12_2_MSB 7 -#define PHY_ANALOG_TXRF12_SPARE12_2_LSB 0 -#define PHY_ANALOG_TXRF12_SPARE12_2_MASK 0x000000ff -#define PHY_ANALOG_TXRF12_SPARE12_2_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_ANALOG_TXRF12_SPARE12_1_MSB 9 -#define PHY_ANALOG_TXRF12_SPARE12_1_LSB 8 -#define PHY_ANALOG_TXRF12_SPARE12_1_MASK 0x00000300 -#define PHY_ANALOG_TXRF12_SPARE12_1_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_ANALOG_TXRF12_SPARE12_1_SET(x) (((x) << 8) & 0x00000300) -#define PHY_ANALOG_TXRF12_ATBSEL5G_MSB 13 -#define PHY_ANALOG_TXRF12_ATBSEL5G_LSB 10 -#define PHY_ANALOG_TXRF12_ATBSEL5G_MASK 0x00003c00 -#define PHY_ANALOG_TXRF12_ATBSEL5G_GET(x) (((x) & 0x00003c00) >> 10) -#define PHY_ANALOG_TXRF12_ATBSEL5G_SET(x) (((x) << 10) & 0x00003c00) -#define PHY_ANALOG_TXRF12_ATBSEL2G_MSB 16 -#define PHY_ANALOG_TXRF12_ATBSEL2G_LSB 14 -#define PHY_ANALOG_TXRF12_ATBSEL2G_MASK 0x0001c000 -#define PHY_ANALOG_TXRF12_ATBSEL2G_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_TXRF12_ATBSEL2G_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_MSB 19 -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_LSB 17 -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_MASK 0x000e0000 -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_TXRF12_PWD_IR25TEMPSEN_MSB 22 -#define PHY_ANALOG_TXRF12_PWD_IR25TEMPSEN_LSB 20 -#define PHY_ANALOG_TXRF12_PWD_IR25TEMPSEN_MASK 0x00700000 -#define PHY_ANALOG_TXRF12_PWD_IR25TEMPSEN_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_TXRF12_PWD_IR25TEMPSEN_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_MSB 25 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_LSB 23 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_MASK 0x03800000 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_MSB 28 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_LSB 26 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_MASK 0x1c000000 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_TXRF12_PWD_IR25MIXBIAS5G_MSB 31 -#define PHY_ANALOG_TXRF12_PWD_IR25MIXBIAS5G_LSB 29 -#define PHY_ANALOG_TXRF12_PWD_IR25MIXBIAS5G_MASK 0xe0000000 -#define PHY_ANALOG_TXRF12_PWD_IR25MIXBIAS5G_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_TXRF12_PWD_IR25MIXBIAS5G_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for SYNTH1 */ -#define PHY_ANALOG_SYNTH1_ADDRESS 0x00000080 -#define PHY_ANALOG_SYNTH1_OFFSET 0x00000080 -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_MSB 2 -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_LSB 0 -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_MASK 0x00000007 -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_MSB 5 -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_LSB 3 -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_MASK 0x00000038 -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_GET(x) (((x) & 0x00000038) >> 3) -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_SET(x) (((x) << 3) & 0x00000038) -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_MSB 6 -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB 6 -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK 0x00000040 -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_MSB 7 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_LSB 7 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_MASK 0x00000080 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_MSB 8 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_LSB 8 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_MASK 0x00000100 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_MSB 9 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_LSB 9 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_MASK 0x00000200 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_SYNTH1_MONITOR_REF_MSB 10 -#define PHY_ANALOG_SYNTH1_MONITOR_REF_LSB 10 -#define PHY_ANALOG_SYNTH1_MONITOR_REF_MASK 0x00000400 -#define PHY_ANALOG_SYNTH1_MONITOR_REF_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_SYNTH1_MONITOR_REF_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_SYNTH1_MONITOR_FB_MSB 11 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_LSB 11 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_MASK 0x00000800 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_SYNTH1_MONITOR_FB_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_MSB 12 -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_LSB 12 -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_MASK 0x00001000 -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_SYNTH1_PWUP_PD_MSB 15 -#define PHY_ANALOG_SYNTH1_PWUP_PD_LSB 13 -#define PHY_ANALOG_SYNTH1_PWUP_PD_MASK 0x0000e000 -#define PHY_ANALOG_SYNTH1_PWUP_PD_GET(x) (((x) & 0x0000e000) >> 13) -#define PHY_ANALOG_SYNTH1_PWUP_PD_SET(x) (((x) << 13) & 0x0000e000) -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_MSB 16 -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_LSB 16 -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_MASK 0x00010000 -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_MSB 18 -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_LSB 17 -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_MASK 0x00060000 -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_GET(x) (((x) & 0x00060000) >> 17) -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_SET(x) (((x) << 17) & 0x00060000) -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_MSB 20 -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_LSB 19 -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_MASK 0x00180000 -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_GET(x) (((x) & 0x00180000) >> 19) -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_SET(x) (((x) << 19) & 0x00180000) -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_MSB 21 -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_LSB 21 -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_MASK 0x00200000 -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_MSB 22 -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_LSB 22 -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_MASK 0x00400000 -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_MSB 23 -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_LSB 23 -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_MASK 0x00800000 -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_SYNTH1_PWD_LODIV_MSB 24 -#define PHY_ANALOG_SYNTH1_PWD_LODIV_LSB 24 -#define PHY_ANALOG_SYNTH1_PWD_LODIV_MASK 0x01000000 -#define PHY_ANALOG_SYNTH1_PWD_LODIV_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_ANALOG_SYNTH1_PWD_LODIV_SET(x) (((x) << 24) & 0x01000000) -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_MSB 25 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_LSB 25 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_MASK 0x02000000 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_SET(x) (((x) << 25) & 0x02000000) -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_MSB 26 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_LSB 26 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_MASK 0x04000000 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_SYNTH1_PWD_PRESC_MSB 27 -#define PHY_ANALOG_SYNTH1_PWD_PRESC_LSB 27 -#define PHY_ANALOG_SYNTH1_PWD_PRESC_MASK 0x08000000 -#define PHY_ANALOG_SYNTH1_PWD_PRESC_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_SYNTH1_PWD_PRESC_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_SYNTH1_PWD_VCO_MSB 28 -#define PHY_ANALOG_SYNTH1_PWD_VCO_LSB 28 -#define PHY_ANALOG_SYNTH1_PWD_VCO_MASK 0x10000000 -#define PHY_ANALOG_SYNTH1_PWD_VCO_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_SYNTH1_PWD_VCO_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_SYNTH1_PWD_VCMON_MSB 29 -#define PHY_ANALOG_SYNTH1_PWD_VCMON_LSB 29 -#define PHY_ANALOG_SYNTH1_PWD_VCMON_MASK 0x20000000 -#define PHY_ANALOG_SYNTH1_PWD_VCMON_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_SYNTH1_PWD_VCMON_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_SYNTH1_PWD_CP_MSB 30 -#define PHY_ANALOG_SYNTH1_PWD_CP_LSB 30 -#define PHY_ANALOG_SYNTH1_PWD_CP_MASK 0x40000000 -#define PHY_ANALOG_SYNTH1_PWD_CP_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_SYNTH1_PWD_CP_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_SYNTH1_PWD_BIAS_MSB 31 -#define PHY_ANALOG_SYNTH1_PWD_BIAS_LSB 31 -#define PHY_ANALOG_SYNTH1_PWD_BIAS_MASK 0x80000000 -#define PHY_ANALOG_SYNTH1_PWD_BIAS_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH1_PWD_BIAS_SET(x) (((x) << 31) & 0x80000000) - -/* macros for SYNTH2 */ -#define PHY_ANALOG_SYNTH2_ADDRESS 0x00000084 -#define PHY_ANALOG_SYNTH2_OFFSET 0x00000084 -#define PHY_ANALOG_SYNTH2_CAPRANGE3_MSB 3 -#define PHY_ANALOG_SYNTH2_CAPRANGE3_LSB 0 -#define PHY_ANALOG_SYNTH2_CAPRANGE3_MASK 0x0000000f -#define PHY_ANALOG_SYNTH2_CAPRANGE3_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_SYNTH2_CAPRANGE3_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_ANALOG_SYNTH2_CAPRANGE2_MSB 7 -#define PHY_ANALOG_SYNTH2_CAPRANGE2_LSB 4 -#define PHY_ANALOG_SYNTH2_CAPRANGE2_MASK 0x000000f0 -#define PHY_ANALOG_SYNTH2_CAPRANGE2_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_SYNTH2_CAPRANGE2_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_ANALOG_SYNTH2_CAPRANGE1_MSB 11 -#define PHY_ANALOG_SYNTH2_CAPRANGE1_LSB 8 -#define PHY_ANALOG_SYNTH2_CAPRANGE1_MASK 0x00000f00 -#define PHY_ANALOG_SYNTH2_CAPRANGE1_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_SYNTH2_CAPRANGE1_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_INTN_MSB 15 -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_INTN_LSB 12 -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_INTN_MASK 0x0000f000 -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_INTN_GET(x) (((x) & 0x0000f000) >> 12) -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_INTN_SET(x) (((x) << 12) & 0x0000f000) -#define PHY_ANALOG_SYNTH2_CPLOWLK_INTN_MSB 16 -#define PHY_ANALOG_SYNTH2_CPLOWLK_INTN_LSB 16 -#define PHY_ANALOG_SYNTH2_CPLOWLK_INTN_MASK 0x00010000 -#define PHY_ANALOG_SYNTH2_CPLOWLK_INTN_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_SYNTH2_CPLOWLK_INTN_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_MSB 17 -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_LSB 17 -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_MASK 0x00020000 -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_SYNTH2_CPBIAS_INTN_MSB 19 -#define PHY_ANALOG_SYNTH2_CPBIAS_INTN_LSB 18 -#define PHY_ANALOG_SYNTH2_CPBIAS_INTN_MASK 0x000c0000 -#define PHY_ANALOG_SYNTH2_CPBIAS_INTN_GET(x) (((x) & 0x000c0000) >> 18) -#define PHY_ANALOG_SYNTH2_CPBIAS_INTN_SET(x) (((x) << 18) & 0x000c0000) -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_MSB 22 -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_LSB 20 -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_MASK 0x00700000 -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_SYNTH2_VC_MID_REF_MSB 25 -#define PHY_ANALOG_SYNTH2_VC_MID_REF_LSB 23 -#define PHY_ANALOG_SYNTH2_VC_MID_REF_MASK 0x03800000 -#define PHY_ANALOG_SYNTH2_VC_MID_REF_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_SYNTH2_VC_MID_REF_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_SYNTH2_VC_HI_REF_MSB 28 -#define PHY_ANALOG_SYNTH2_VC_HI_REF_LSB 26 -#define PHY_ANALOG_SYNTH2_VC_HI_REF_MASK 0x1c000000 -#define PHY_ANALOG_SYNTH2_VC_HI_REF_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_SYNTH2_VC_HI_REF_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_MSB 31 -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_LSB 29 -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_MASK 0xe0000000 -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for SYNTH3 */ -#define PHY_ANALOG_SYNTH3_ADDRESS 0x00000088 -#define PHY_ANALOG_SYNTH3_OFFSET 0x00000088 -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_MSB 5 -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_LSB 0 -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_MASK 0x0000003f -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_MSB 11 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_LSB 6 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_MASK 0x00000fc0 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_MSB 17 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_LSB 12 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_MASK 0x0003f000 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_SET(x) (((x) << 12) & 0x0003f000) -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_MSB 23 -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_LSB 18 -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_MASK 0x00fc0000 -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_GET(x) (((x) & 0x00fc0000) >> 18) -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_SET(x) (((x) << 18) & 0x00fc0000) -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_MSB 29 -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_LSB 24 -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_MASK 0x3f000000 -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_SET(x) (((x) << 24) & 0x3f000000) -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_MSB 30 -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_LSB 30 -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_MASK 0x40000000 -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_MSB 31 -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_LSB 31 -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_MASK 0x80000000 -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_SET(x) (((x) << 31) & 0x80000000) - -/* macros for SYNTH4 */ -#define PHY_ANALOG_SYNTH4_ADDRESS 0x0000008c -#define PHY_ANALOG_SYNTH4_OFFSET 0x0000008c -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_MSB 0 -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_LSB 0 -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_MASK 0x00000001 -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_MSB 1 -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_LSB 1 -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_MASK 0x00000002 -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_MSB 3 -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_LSB 2 -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_MASK 0x0000000c -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_MSB 4 -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_LSB 4 -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_MASK 0x00000010 -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_MSB 5 -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_LSB 5 -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_MASK 0x00000020 -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_SYNTH4_SDM_DITHER1_MSB 7 -#define PHY_ANALOG_SYNTH4_SDM_DITHER1_LSB 6 -#define PHY_ANALOG_SYNTH4_SDM_DITHER1_MASK 0x000000c0 -#define PHY_ANALOG_SYNTH4_SDM_DITHER1_GET(x) (((x) & 0x000000c0) >> 6) -#define PHY_ANALOG_SYNTH4_SDM_DITHER1_SET(x) (((x) << 6) & 0x000000c0) -#define PHY_ANALOG_SYNTH4_SDM_MODE_MSB 8 -#define PHY_ANALOG_SYNTH4_SDM_MODE_LSB 8 -#define PHY_ANALOG_SYNTH4_SDM_MODE_MASK 0x00000100 -#define PHY_ANALOG_SYNTH4_SDM_MODE_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_SYNTH4_SDM_MODE_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_MSB 9 -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_LSB 9 -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_MASK 0x00000200 -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_SYNTH4_RESET_PRESC_MSB 10 -#define PHY_ANALOG_SYNTH4_RESET_PRESC_LSB 10 -#define PHY_ANALOG_SYNTH4_RESET_PRESC_MASK 0x00000400 -#define PHY_ANALOG_SYNTH4_RESET_PRESC_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_SYNTH4_RESET_PRESC_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_SYNTH4_PRESCSEL_MSB 12 -#define PHY_ANALOG_SYNTH4_PRESCSEL_LSB 11 -#define PHY_ANALOG_SYNTH4_PRESCSEL_MASK 0x00001800 -#define PHY_ANALOG_SYNTH4_PRESCSEL_GET(x) (((x) & 0x00001800) >> 11) -#define PHY_ANALOG_SYNTH4_PRESCSEL_SET(x) (((x) << 11) & 0x00001800) -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_MSB 13 -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_LSB 13 -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_MASK 0x00002000 -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_MSB 14 -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_LSB 14 -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_MASK 0x00004000 -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_MSB 15 -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_LSB 15 -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_MASK 0x00008000 -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_MSB 16 -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_LSB 16 -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_MASK 0x00010000 -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_MSB 17 -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_LSB 17 -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_MASK 0x00020000 -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_MSB 25 -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_LSB 18 -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_MASK 0x03fc0000 -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_GET(x) (((x) & 0x03fc0000) >> 18) -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_SET(x) (((x) << 18) & 0x03fc0000) -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_MSB 26 -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_LSB 26 -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_MASK 0x04000000 -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_MSB 27 -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_LSB 27 -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_MASK 0x08000000 -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_MSB 28 -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_LSB 28 -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_MASK 0x10000000 -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_MSB 29 -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_LSB 29 -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_MASK 0x20000000 -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_MSB 30 -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_LSB 30 -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_MASK 0x40000000 -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_MSB 31 -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_LSB 31 -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_MASK 0x80000000 -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_SET(x) (((x) << 31) & 0x80000000) - -/* macros for SYNTH5 */ -#define PHY_ANALOG_SYNTH5_ADDRESS 0x00000090 -#define PHY_ANALOG_SYNTH5_OFFSET 0x00000090 -#define PHY_ANALOG_SYNTH5_VCOBIAS_MSB 1 -#define PHY_ANALOG_SYNTH5_VCOBIAS_LSB 0 -#define PHY_ANALOG_SYNTH5_VCOBIAS_MASK 0x00000003 -#define PHY_ANALOG_SYNTH5_VCOBIAS_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_SYNTH5_VCOBIAS_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_MSB 4 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_LSB 2 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_MASK 0x0000001c -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_MSB 7 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_LSB 5 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_MASK 0x000000e0 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_MSB 10 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_LSB 8 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_MASK 0x00000700 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_MSB 13 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_LSB 11 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_MASK 0x00003800 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_MSB 14 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_LSB 14 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_MASK 0x00004000 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_MSB 17 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_LSB 15 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_MASK 0x00038000 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_GET(x) (((x) & 0x00038000) >> 15) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_SET(x) (((x) << 15) & 0x00038000) -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_MSB 20 -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_LSB 18 -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_MASK 0x001c0000 -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_GET(x) (((x) & 0x001c0000) >> 18) -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_SET(x) (((x) << 18) & 0x001c0000) -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_MSB 23 -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_LSB 21 -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_MASK 0x00e00000 -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_GET(x) (((x) & 0x00e00000) >> 21) -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_SET(x) (((x) << 21) & 0x00e00000) -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_MSB 26 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_LSB 24 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_MASK 0x07000000 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_GET(x) (((x) & 0x07000000) >> 24) -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_SET(x) (((x) << 24) & 0x07000000) -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_MSB 29 -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_LSB 27 -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_MASK 0x38000000 -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_GET(x) (((x) & 0x38000000) >> 27) -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_SET(x) (((x) << 27) & 0x38000000) -#define PHY_ANALOG_SYNTH5_SDM_DITHER2_MSB 31 -#define PHY_ANALOG_SYNTH5_SDM_DITHER2_LSB 30 -#define PHY_ANALOG_SYNTH5_SDM_DITHER2_MASK 0xc0000000 -#define PHY_ANALOG_SYNTH5_SDM_DITHER2_GET(x) (((x) & 0xc0000000) >> 30) -#define PHY_ANALOG_SYNTH5_SDM_DITHER2_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for SYNTH6 */ -#define PHY_ANALOG_SYNTH6_ADDRESS 0x00000094 -#define PHY_ANALOG_SYNTH6_OFFSET 0x00000094 -#define PHY_ANALOG_SYNTH6_LOBUF5GTUNE_MSB 1 -#define PHY_ANALOG_SYNTH6_LOBUF5GTUNE_LSB 0 -#define PHY_ANALOG_SYNTH6_LOBUF5GTUNE_MASK 0x00000003 -#define PHY_ANALOG_SYNTH6_LOBUF5GTUNE_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_SYNTH6_LOOP_IP_MSB 8 -#define PHY_ANALOG_SYNTH6_LOOP_IP_LSB 2 -#define PHY_ANALOG_SYNTH6_LOOP_IP_MASK 0x000001fc -#define PHY_ANALOG_SYNTH6_LOOP_IP_GET(x) (((x) & 0x000001fc) >> 2) -#define PHY_ANALOG_SYNTH6_VC2LOW_MSB 9 -#define PHY_ANALOG_SYNTH6_VC2LOW_LSB 9 -#define PHY_ANALOG_SYNTH6_VC2LOW_MASK 0x00000200 -#define PHY_ANALOG_SYNTH6_VC2LOW_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_SYNTH6_VC2HIGH_MSB 10 -#define PHY_ANALOG_SYNTH6_VC2HIGH_LSB 10 -#define PHY_ANALOG_SYNTH6_VC2HIGH_MASK 0x00000400 -#define PHY_ANALOG_SYNTH6_VC2HIGH_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_SYNTH6_RESET_SDM_B_MSB 11 -#define PHY_ANALOG_SYNTH6_RESET_SDM_B_LSB 11 -#define PHY_ANALOG_SYNTH6_RESET_SDM_B_MASK 0x00000800 -#define PHY_ANALOG_SYNTH6_RESET_SDM_B_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_SYNTH6_RESET_PSCOUNTERS_MSB 12 -#define PHY_ANALOG_SYNTH6_RESET_PSCOUNTERS_LSB 12 -#define PHY_ANALOG_SYNTH6_RESET_PSCOUNTERS_MASK 0x00001000 -#define PHY_ANALOG_SYNTH6_RESET_PSCOUNTERS_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_SYNTH6_RESET_PFD_MSB 13 -#define PHY_ANALOG_SYNTH6_RESET_PFD_LSB 13 -#define PHY_ANALOG_SYNTH6_RESET_PFD_MASK 0x00002000 -#define PHY_ANALOG_SYNTH6_RESET_PFD_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_SYNTH6_RESET_RFD_MSB 14 -#define PHY_ANALOG_SYNTH6_RESET_RFD_LSB 14 -#define PHY_ANALOG_SYNTH6_RESET_RFD_MASK 0x00004000 -#define PHY_ANALOG_SYNTH6_RESET_RFD_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_SYNTH6_SHORT_R_MSB 15 -#define PHY_ANALOG_SYNTH6_SHORT_R_LSB 15 -#define PHY_ANALOG_SYNTH6_SHORT_R_MASK 0x00008000 -#define PHY_ANALOG_SYNTH6_SHORT_R_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_SYNTH6_VCO_CAP_ST_MSB 23 -#define PHY_ANALOG_SYNTH6_VCO_CAP_ST_LSB 16 -#define PHY_ANALOG_SYNTH6_VCO_CAP_ST_MASK 0x00ff0000 -#define PHY_ANALOG_SYNTH6_VCO_CAP_ST_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_ANALOG_SYNTH6_PIN_VC_MSB 24 -#define PHY_ANALOG_SYNTH6_PIN_VC_LSB 24 -#define PHY_ANALOG_SYNTH6_PIN_VC_MASK 0x01000000 -#define PHY_ANALOG_SYNTH6_PIN_VC_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_ANALOG_SYNTH6_SYNTH_LOCK_VC_OK_MSB 25 -#define PHY_ANALOG_SYNTH6_SYNTH_LOCK_VC_OK_LSB 25 -#define PHY_ANALOG_SYNTH6_SYNTH_LOCK_VC_OK_MASK 0x02000000 -#define PHY_ANALOG_SYNTH6_SYNTH_LOCK_VC_OK_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_ANALOG_SYNTH6_CAP_SEARCH_MSB 26 -#define PHY_ANALOG_SYNTH6_CAP_SEARCH_LSB 26 -#define PHY_ANALOG_SYNTH6_CAP_SEARCH_MASK 0x04000000 -#define PHY_ANALOG_SYNTH6_CAP_SEARCH_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_SYNTH6_SYNTH_SM_STATE_MSB 30 -#define PHY_ANALOG_SYNTH6_SYNTH_SM_STATE_LSB 27 -#define PHY_ANALOG_SYNTH6_SYNTH_SM_STATE_MASK 0x78000000 -#define PHY_ANALOG_SYNTH6_SYNTH_SM_STATE_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_ANALOG_SYNTH6_SYNTH_ON_MSB 31 -#define PHY_ANALOG_SYNTH6_SYNTH_ON_LSB 31 -#define PHY_ANALOG_SYNTH6_SYNTH_ON_MASK 0x80000000 -#define PHY_ANALOG_SYNTH6_SYNTH_ON_GET(x) (((x) & 0x80000000) >> 31) - -/* macros for SYNTH7 */ -#define PHY_ANALOG_SYNTH7_ADDRESS 0x00000098 -#define PHY_ANALOG_SYNTH7_OFFSET 0x00000098 -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_MSB 0 -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_LSB 0 -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_MASK 0x00000001 -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_MSB 1 -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_LSB 1 -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_MASK 0x00000002 -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_SYNTH7_CHANFRAC_MSB 18 -#define PHY_ANALOG_SYNTH7_CHANFRAC_LSB 2 -#define PHY_ANALOG_SYNTH7_CHANFRAC_MASK 0x0007fffc -#define PHY_ANALOG_SYNTH7_CHANFRAC_GET(x) (((x) & 0x0007fffc) >> 2) -#define PHY_ANALOG_SYNTH7_CHANFRAC_SET(x) (((x) << 2) & 0x0007fffc) -#define PHY_ANALOG_SYNTH7_CHANSEL_MSB 27 -#define PHY_ANALOG_SYNTH7_CHANSEL_LSB 19 -#define PHY_ANALOG_SYNTH7_CHANSEL_MASK 0x0ff80000 -#define PHY_ANALOG_SYNTH7_CHANSEL_GET(x) (((x) & 0x0ff80000) >> 19) -#define PHY_ANALOG_SYNTH7_CHANSEL_SET(x) (((x) << 19) & 0x0ff80000) -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_MSB 29 -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_LSB 28 -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_MASK 0x30000000 -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_GET(x) (((x) & 0x30000000) >> 28) -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_SET(x) (((x) << 28) & 0x30000000) -#define PHY_ANALOG_SYNTH7_FRACMODE_MSB 30 -#define PHY_ANALOG_SYNTH7_FRACMODE_LSB 30 -#define PHY_ANALOG_SYNTH7_FRACMODE_MASK 0x40000000 -#define PHY_ANALOG_SYNTH7_FRACMODE_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_SYNTH7_FRACMODE_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_MSB 31 -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_LSB 31 -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_MASK 0x80000000 -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_SET(x) (((x) << 31) & 0x80000000) - -/* macros for SYNTH8 */ -#define PHY_ANALOG_SYNTH8_ADDRESS 0x0000009c -#define PHY_ANALOG_SYNTH8_OFFSET 0x0000009c -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_MSB 0 -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_LSB 0 -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_MASK 0x00000001 -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_MSB 7 -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_LSB 1 -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_MASK 0x000000fe -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_GET(x) (((x) & 0x000000fe) >> 1) -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_SET(x) (((x) << 1) & 0x000000fe) -#define PHY_ANALOG_SYNTH8_LOOP_CSB_MSB 11 -#define PHY_ANALOG_SYNTH8_LOOP_CSB_LSB 8 -#define PHY_ANALOG_SYNTH8_LOOP_CSB_MASK 0x00000f00 -#define PHY_ANALOG_SYNTH8_LOOP_CSB_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_SYNTH8_LOOP_CSB_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_SYNTH8_LOOP_RSB_MSB 16 -#define PHY_ANALOG_SYNTH8_LOOP_RSB_LSB 12 -#define PHY_ANALOG_SYNTH8_LOOP_RSB_MASK 0x0001f000 -#define PHY_ANALOG_SYNTH8_LOOP_RSB_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_ANALOG_SYNTH8_LOOP_RSB_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_ANALOG_SYNTH8_LOOP_CPB_MSB 21 -#define PHY_ANALOG_SYNTH8_LOOP_CPB_LSB 17 -#define PHY_ANALOG_SYNTH8_LOOP_CPB_MASK 0x003e0000 -#define PHY_ANALOG_SYNTH8_LOOP_CPB_GET(x) (((x) & 0x003e0000) >> 17) -#define PHY_ANALOG_SYNTH8_LOOP_CPB_SET(x) (((x) << 17) & 0x003e0000) -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_MSB 26 -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_LSB 22 -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_MASK 0x07c00000 -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_GET(x) (((x) & 0x07c00000) >> 22) -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_SET(x) (((x) << 22) & 0x07c00000) -#define PHY_ANALOG_SYNTH8_REFDIVB_MSB 31 -#define PHY_ANALOG_SYNTH8_REFDIVB_LSB 27 -#define PHY_ANALOG_SYNTH8_REFDIVB_MASK 0xf8000000 -#define PHY_ANALOG_SYNTH8_REFDIVB_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_SYNTH8_REFDIVB_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for SYNTH9 */ -#define PHY_ANALOG_SYNTH9_ADDRESS 0x000000a0 -#define PHY_ANALOG_SYNTH9_OFFSET 0x000000a0 -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_MSB 0 -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_LSB 0 -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_MASK 0x00000001 -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_MSB 3 -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_LSB 1 -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_MASK 0x0000000e -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_MSB 7 -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_LSB 4 -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_MASK 0x000000f0 -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_MSB 11 -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_LSB 8 -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_MASK 0x00000f00 -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_MSB 16 -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_LSB 12 -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_MASK 0x0001f000 -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_MSB 21 -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_LSB 17 -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_MASK 0x003e0000 -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_GET(x) (((x) & 0x003e0000) >> 17) -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_SET(x) (((x) << 17) & 0x003e0000) -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_MSB 26 -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_LSB 22 -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_MASK 0x07c00000 -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_GET(x) (((x) & 0x07c00000) >> 22) -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_SET(x) (((x) << 22) & 0x07c00000) -#define PHY_ANALOG_SYNTH9_REFDIVA_MSB 31 -#define PHY_ANALOG_SYNTH9_REFDIVA_LSB 27 -#define PHY_ANALOG_SYNTH9_REFDIVA_MASK 0xf8000000 -#define PHY_ANALOG_SYNTH9_REFDIVA_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_SYNTH9_REFDIVA_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for SYNTH10 */ -#define PHY_ANALOG_SYNTH10_ADDRESS 0x000000a4 -#define PHY_ANALOG_SYNTH10_OFFSET 0x000000a4 -#define PHY_ANALOG_SYNTH10_SPARE10A_MSB 1 -#define PHY_ANALOG_SYNTH10_SPARE10A_LSB 0 -#define PHY_ANALOG_SYNTH10_SPARE10A_MASK 0x00000003 -#define PHY_ANALOG_SYNTH10_SPARE10A_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_SYNTH10_SPARE10A_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_MSB 4 -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_LSB 2 -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_MASK 0x0000001c -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_MSB 7 -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_LSB 5 -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_MASK 0x000000e0 -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_MSB 10 -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_LSB 8 -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_MASK 0x00000700 -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_MSB 13 -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_LSB 11 -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_MASK 0x00003800 -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_MSB 17 -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_LSB 14 -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_MASK 0x0003c000 -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_GET(x) (((x) & 0x0003c000) >> 14) -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_SET(x) (((x) << 14) & 0x0003c000) -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_MSB 21 -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_LSB 18 -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_MASK 0x003c0000 -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_GET(x) (((x) & 0x003c0000) >> 18) -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_SET(x) (((x) << 18) & 0x003c0000) -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_MSB 26 -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_LSB 22 -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_MASK 0x07c00000 -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_GET(x) (((x) & 0x07c00000) >> 22) -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_SET(x) (((x) << 22) & 0x07c00000) -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_MSB 31 -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_LSB 27 -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_MASK 0xf8000000 -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for SYNTH11 */ -#define PHY_ANALOG_SYNTH11_ADDRESS 0x000000a8 -#define PHY_ANALOG_SYNTH11_OFFSET 0x000000a8 -#define PHY_ANALOG_SYNTH11_SPARE11A_MSB 4 -#define PHY_ANALOG_SYNTH11_SPARE11A_LSB 0 -#define PHY_ANALOG_SYNTH11_SPARE11A_MASK 0x0000001f -#define PHY_ANALOG_SYNTH11_SPARE11A_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_SYNTH11_SPARE11A_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_MSB 5 -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_LSB 5 -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_MASK 0x00000020 -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_SYNTH11_LOREFSEL_MSB 7 -#define PHY_ANALOG_SYNTH11_LOREFSEL_LSB 6 -#define PHY_ANALOG_SYNTH11_LOREFSEL_MASK 0x000000c0 -#define PHY_ANALOG_SYNTH11_LOREFSEL_GET(x) (((x) & 0x000000c0) >> 6) -#define PHY_ANALOG_SYNTH11_LOREFSEL_SET(x) (((x) << 6) & 0x000000c0) -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_MSB 9 -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_LSB 8 -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_MASK 0x00000300 -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_SET(x) (((x) << 8) & 0x00000300) -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_MSB 10 -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_LSB 10 -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_MASK 0x00000400 -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_MSB 13 -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_LSB 11 -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_MASK 0x00003800 -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_MSB 17 -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_LSB 14 -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_MASK 0x0003c000 -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_GET(x) (((x) & 0x0003c000) >> 14) -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_SET(x) (((x) << 14) & 0x0003c000) -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_MSB 21 -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_LSB 18 -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_MASK 0x003c0000 -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_GET(x) (((x) & 0x003c0000) >> 18) -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_SET(x) (((x) << 18) & 0x003c0000) -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_MSB 26 -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_LSB 22 -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_MASK 0x07c00000 -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_GET(x) (((x) & 0x07c00000) >> 22) -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_SET(x) (((x) << 22) & 0x07c00000) -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_MSB 31 -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_LSB 27 -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_MASK 0xf8000000 -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for SYNTH12 */ -#define PHY_ANALOG_SYNTH12_ADDRESS 0x000000ac -#define PHY_ANALOG_SYNTH12_OFFSET 0x000000ac -#define PHY_ANALOG_SYNTH12_SPARE12A_MSB 9 -#define PHY_ANALOG_SYNTH12_SPARE12A_LSB 0 -#define PHY_ANALOG_SYNTH12_SPARE12A_MASK 0x000003ff -#define PHY_ANALOG_SYNTH12_SPARE12A_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_ANALOG_SYNTH12_SPARE12A_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_ANALOG_SYNTH12_LOOPLEAKCUR_FRACN_MSB 13 -#define PHY_ANALOG_SYNTH12_LOOPLEAKCUR_FRACN_LSB 10 -#define PHY_ANALOG_SYNTH12_LOOPLEAKCUR_FRACN_MASK 0x00003c00 -#define PHY_ANALOG_SYNTH12_LOOPLEAKCUR_FRACN_GET(x) (((x) & 0x00003c00) >> 10) -#define PHY_ANALOG_SYNTH12_LOOPLEAKCUR_FRACN_SET(x) (((x) << 10) & 0x00003c00) -#define PHY_ANALOG_SYNTH12_CPLOWLK_FRACN_MSB 14 -#define PHY_ANALOG_SYNTH12_CPLOWLK_FRACN_LSB 14 -#define PHY_ANALOG_SYNTH12_CPLOWLK_FRACN_MASK 0x00004000 -#define PHY_ANALOG_SYNTH12_CPLOWLK_FRACN_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_SYNTH12_CPLOWLK_FRACN_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_SYNTH12_CPBIAS_FRACN_MSB 16 -#define PHY_ANALOG_SYNTH12_CPBIAS_FRACN_LSB 15 -#define PHY_ANALOG_SYNTH12_CPBIAS_FRACN_MASK 0x00018000 -#define PHY_ANALOG_SYNTH12_CPBIAS_FRACN_GET(x) (((x) & 0x00018000) >> 15) -#define PHY_ANALOG_SYNTH12_CPBIAS_FRACN_SET(x) (((x) << 15) & 0x00018000) -#define PHY_ANALOG_SYNTH12_SYNTHDIGOUTEN_MSB 17 -#define PHY_ANALOG_SYNTH12_SYNTHDIGOUTEN_LSB 17 -#define PHY_ANALOG_SYNTH12_SYNTHDIGOUTEN_MASK 0x00020000 -#define PHY_ANALOG_SYNTH12_SYNTHDIGOUTEN_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_SYNTH12_SYNTHDIGOUTEN_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_SYNTH12_STRCONT_MSB 18 -#define PHY_ANALOG_SYNTH12_STRCONT_LSB 18 -#define PHY_ANALOG_SYNTH12_STRCONT_MASK 0x00040000 -#define PHY_ANALOG_SYNTH12_STRCONT_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_SYNTH12_STRCONT_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_SYNTH12_VREFMUL3_MSB 22 -#define PHY_ANALOG_SYNTH12_VREFMUL3_LSB 19 -#define PHY_ANALOG_SYNTH12_VREFMUL3_MASK 0x00780000 -#define PHY_ANALOG_SYNTH12_VREFMUL3_GET(x) (((x) & 0x00780000) >> 19) -#define PHY_ANALOG_SYNTH12_VREFMUL3_SET(x) (((x) << 19) & 0x00780000) -#define PHY_ANALOG_SYNTH12_VREFMUL2_MSB 26 -#define PHY_ANALOG_SYNTH12_VREFMUL2_LSB 23 -#define PHY_ANALOG_SYNTH12_VREFMUL2_MASK 0x07800000 -#define PHY_ANALOG_SYNTH12_VREFMUL2_GET(x) (((x) & 0x07800000) >> 23) -#define PHY_ANALOG_SYNTH12_VREFMUL2_SET(x) (((x) << 23) & 0x07800000) -#define PHY_ANALOG_SYNTH12_VREFMUL1_MSB 30 -#define PHY_ANALOG_SYNTH12_VREFMUL1_LSB 27 -#define PHY_ANALOG_SYNTH12_VREFMUL1_MASK 0x78000000 -#define PHY_ANALOG_SYNTH12_VREFMUL1_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_ANALOG_SYNTH12_VREFMUL1_SET(x) (((x) << 27) & 0x78000000) -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_MSB 31 -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_LSB 31 -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_MASK 0x80000000 -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for SYNTH13 */ -#define PHY_ANALOG_SYNTH13_ADDRESS 0x000000b0 -#define PHY_ANALOG_SYNTH13_OFFSET 0x000000b0 -#define PHY_ANALOG_SYNTH13_SPARE13A_MSB 0 -#define PHY_ANALOG_SYNTH13_SPARE13A_LSB 0 -#define PHY_ANALOG_SYNTH13_SPARE13A_MASK 0x00000001 -#define PHY_ANALOG_SYNTH13_SPARE13A_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH13_SPARE13A_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH13_SLOPE_ICPA_FRACN_MSB 3 -#define PHY_ANALOG_SYNTH13_SLOPE_ICPA_FRACN_LSB 1 -#define PHY_ANALOG_SYNTH13_SLOPE_ICPA_FRACN_MASK 0x0000000e -#define PHY_ANALOG_SYNTH13_SLOPE_ICPA_FRACN_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_ANALOG_SYNTH13_SLOPE_ICPA_FRACN_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_ANALOG_SYNTH13_LOOP_ICPA_FRACN_MSB 7 -#define PHY_ANALOG_SYNTH13_LOOP_ICPA_FRACN_LSB 4 -#define PHY_ANALOG_SYNTH13_LOOP_ICPA_FRACN_MASK 0x000000f0 -#define PHY_ANALOG_SYNTH13_LOOP_ICPA_FRACN_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_SYNTH13_LOOP_ICPA_FRACN_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_ANALOG_SYNTH13_LOOP_CSA_FRACN_MSB 11 -#define PHY_ANALOG_SYNTH13_LOOP_CSA_FRACN_LSB 8 -#define PHY_ANALOG_SYNTH13_LOOP_CSA_FRACN_MASK 0x00000f00 -#define PHY_ANALOG_SYNTH13_LOOP_CSA_FRACN_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_SYNTH13_LOOP_CSA_FRACN_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_SYNTH13_LOOP_RSA_FRACN_MSB 16 -#define PHY_ANALOG_SYNTH13_LOOP_RSA_FRACN_LSB 12 -#define PHY_ANALOG_SYNTH13_LOOP_RSA_FRACN_MASK 0x0001f000 -#define PHY_ANALOG_SYNTH13_LOOP_RSA_FRACN_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_ANALOG_SYNTH13_LOOP_RSA_FRACN_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_ANALOG_SYNTH13_LOOP_CPA_FRACN_MSB 21 -#define PHY_ANALOG_SYNTH13_LOOP_CPA_FRACN_LSB 17 -#define PHY_ANALOG_SYNTH13_LOOP_CPA_FRACN_MASK 0x003e0000 -#define PHY_ANALOG_SYNTH13_LOOP_CPA_FRACN_GET(x) (((x) & 0x003e0000) >> 17) -#define PHY_ANALOG_SYNTH13_LOOP_CPA_FRACN_SET(x) (((x) << 17) & 0x003e0000) -#define PHY_ANALOG_SYNTH13_LOOP_3RD_ORDER_RA_FRACN_MSB 26 -#define PHY_ANALOG_SYNTH13_LOOP_3RD_ORDER_RA_FRACN_LSB 22 -#define PHY_ANALOG_SYNTH13_LOOP_3RD_ORDER_RA_FRACN_MASK 0x07c00000 -#define PHY_ANALOG_SYNTH13_LOOP_3RD_ORDER_RA_FRACN_GET(x) (((x) & 0x07c00000) >> 22) -#define PHY_ANALOG_SYNTH13_LOOP_3RD_ORDER_RA_FRACN_SET(x) (((x) << 22) & 0x07c00000) -#define PHY_ANALOG_SYNTH13_REFDIVA_FRACN_MSB 31 -#define PHY_ANALOG_SYNTH13_REFDIVA_FRACN_LSB 27 -#define PHY_ANALOG_SYNTH13_REFDIVA_FRACN_MASK 0xf8000000 -#define PHY_ANALOG_SYNTH13_REFDIVA_FRACN_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_SYNTH13_REFDIVA_FRACN_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for SYNTH14 */ -#define PHY_ANALOG_SYNTH14_ADDRESS 0x000000b4 -#define PHY_ANALOG_SYNTH14_OFFSET 0x000000b4 -#define PHY_ANALOG_SYNTH14_SPARE14A_MSB 1 -#define PHY_ANALOG_SYNTH14_SPARE14A_LSB 0 -#define PHY_ANALOG_SYNTH14_SPARE14A_MASK 0x00000003 -#define PHY_ANALOG_SYNTH14_SPARE14A_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_SYNTH14_SPARE14A_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_3_MSB 3 -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_3_LSB 2 -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_3_MASK 0x0000000c -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_3_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_3_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_3_MSB 5 -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_3_LSB 4 -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_3_MASK 0x00000030 -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_3_GET(x) (((x) & 0x00000030) >> 4) -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_3_SET(x) (((x) << 4) & 0x00000030) -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_2_MSB 7 -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_2_LSB 6 -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_2_MASK 0x000000c0 -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_2_GET(x) (((x) & 0x000000c0) >> 6) -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_2_SET(x) (((x) << 6) & 0x000000c0) -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_2_MSB 9 -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_2_LSB 8 -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_2_MASK 0x00000300 -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_2_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_2_SET(x) (((x) << 8) & 0x00000300) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_3_MSB 10 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_3_LSB 10 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_3_MASK 0x00000400 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_3_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_3_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_3_MSB 11 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_3_LSB 11 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_3_MASK 0x00000800 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_3_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_3_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_2_MSB 12 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_2_LSB 12 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_2_MASK 0x00001000 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_2_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_2_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_2_MSB 13 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_2_LSB 13 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_2_MASK 0x00002000 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_2_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_2_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_SYNTH14_PWUPLO23_PD_MSB 16 -#define PHY_ANALOG_SYNTH14_PWUPLO23_PD_LSB 14 -#define PHY_ANALOG_SYNTH14_PWUPLO23_PD_MASK 0x0001c000 -#define PHY_ANALOG_SYNTH14_PWUPLO23_PD_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_SYNTH14_PWUPLO23_PD_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_3_MSB 19 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_3_LSB 17 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_3_MASK 0x000e0000 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_3_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_3_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_3_MSB 22 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_3_LSB 20 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_3_MASK 0x00700000 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_3_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_3_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_2_MSB 25 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_2_LSB 23 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_2_MASK 0x03800000 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_2_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_2_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_2_MSB 28 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_2_LSB 26 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_2_MASK 0x1c000000 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_2_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_2_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_SYNTH14_PWDB_ICLVLSHFT_MSB 31 -#define PHY_ANALOG_SYNTH14_PWDB_ICLVLSHFT_LSB 29 -#define PHY_ANALOG_SYNTH14_PWDB_ICLVLSHFT_MASK 0xe0000000 -#define PHY_ANALOG_SYNTH14_PWDB_ICLVLSHFT_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_SYNTH14_PWDB_ICLVLSHFT_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for BIAS1 */ -#define PHY_ANALOG_BIAS1_ADDRESS 0x000000c0 -#define PHY_ANALOG_BIAS1_OFFSET 0x000000c0 -#define PHY_ANALOG_BIAS1_SPARE1_MSB 6 -#define PHY_ANALOG_BIAS1_SPARE1_LSB 0 -#define PHY_ANALOG_BIAS1_SPARE1_MASK 0x0000007f -#define PHY_ANALOG_BIAS1_SPARE1_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_ANALOG_BIAS1_SPARE1_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_MSB 9 -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_LSB 7 -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_MASK 0x00000380 -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_GET(x) (((x) & 0x00000380) >> 7) -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_SET(x) (((x) << 7) & 0x00000380) -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_MSB 12 -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_LSB 10 -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_MASK 0x00001c00 -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_GET(x) (((x) & 0x00001c00) >> 10) -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_SET(x) (((x) << 10) & 0x00001c00) -#define PHY_ANALOG_BIAS1_PWD_IC25BB_MSB 15 -#define PHY_ANALOG_BIAS1_PWD_IC25BB_LSB 13 -#define PHY_ANALOG_BIAS1_PWD_IC25BB_MASK 0x0000e000 -#define PHY_ANALOG_BIAS1_PWD_IC25BB_GET(x) (((x) & 0x0000e000) >> 13) -#define PHY_ANALOG_BIAS1_PWD_IC25BB_SET(x) (((x) << 13) & 0x0000e000) -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_MSB 18 -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_LSB 16 -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_MASK 0x00070000 -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_GET(x) (((x) & 0x00070000) >> 16) -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_SET(x) (((x) << 16) & 0x00070000) -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_MSB 21 -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_LSB 19 -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_MASK 0x00380000 -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_GET(x) (((x) & 0x00380000) >> 19) -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_SET(x) (((x) << 19) & 0x00380000) -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_MSB 24 -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_LSB 22 -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_MASK 0x01c00000 -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_GET(x) (((x) & 0x01c00000) >> 22) -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_SET(x) (((x) << 22) & 0x01c00000) -#define PHY_ANALOG_BIAS1_BIAS_SEL_MSB 31 -#define PHY_ANALOG_BIAS1_BIAS_SEL_LSB 25 -#define PHY_ANALOG_BIAS1_BIAS_SEL_MASK 0xfe000000 -#define PHY_ANALOG_BIAS1_BIAS_SEL_GET(x) (((x) & 0xfe000000) >> 25) -#define PHY_ANALOG_BIAS1_BIAS_SEL_SET(x) (((x) << 25) & 0xfe000000) - -/* macros for BIAS2 */ -#define PHY_ANALOG_BIAS2_ADDRESS 0x000000c4 -#define PHY_ANALOG_BIAS2_OFFSET 0x000000c4 -#define PHY_ANALOG_BIAS2_SPARE2_MSB 4 -#define PHY_ANALOG_BIAS2_SPARE2_LSB 0 -#define PHY_ANALOG_BIAS2_SPARE2_MASK 0x0000001f -#define PHY_ANALOG_BIAS2_SPARE2_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_BIAS2_SPARE2_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_BIAS2_PWD_IC25XPA_MSB 7 -#define PHY_ANALOG_BIAS2_PWD_IC25XPA_LSB 5 -#define PHY_ANALOG_BIAS2_PWD_IC25XPA_MASK 0x000000e0 -#define PHY_ANALOG_BIAS2_PWD_IC25XPA_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_BIAS2_PWD_IC25XPA_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_MSB 10 -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_LSB 8 -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_MASK 0x00000700 -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_MSB 13 -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_LSB 11 -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_MASK 0x00003800 -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_MSB 16 -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_LSB 14 -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_MASK 0x0001c000 -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_BIAS2_PWD_IC25SYNTH_MSB 19 -#define PHY_ANALOG_BIAS2_PWD_IC25SYNTH_LSB 17 -#define PHY_ANALOG_BIAS2_PWD_IC25SYNTH_MASK 0x000e0000 -#define PHY_ANALOG_BIAS2_PWD_IC25SYNTH_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_BIAS2_PWD_IC25SYNTH_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_MSB 22 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_LSB 20 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_MASK 0x00700000 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_MSB 25 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_LSB 23 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_MASK 0x03800000 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_MSB 28 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_LSB 26 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_MASK 0x1c000000 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_MSB 31 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_LSB 29 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_MASK 0xe0000000 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for BIAS3 */ -#define PHY_ANALOG_BIAS3_ADDRESS 0x000000c8 -#define PHY_ANALOG_BIAS3_OFFSET 0x000000c8 -#define PHY_ANALOG_BIAS3_SPARE3_MSB 1 -#define PHY_ANALOG_BIAS3_SPARE3_LSB 0 -#define PHY_ANALOG_BIAS3_SPARE3_MASK 0x00000003 -#define PHY_ANALOG_BIAS3_SPARE3_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_BIAS3_SPARE3_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_BIAS3_PWD_IR25SAR_MSB 4 -#define PHY_ANALOG_BIAS3_PWD_IR25SAR_LSB 2 -#define PHY_ANALOG_BIAS3_PWD_IR25SAR_MASK 0x0000001c -#define PHY_ANALOG_BIAS3_PWD_IR25SAR_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_ANALOG_BIAS3_PWD_IR25SAR_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_MSB 7 -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_LSB 5 -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_MASK 0x000000e0 -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_MSB 10 -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_LSB 8 -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_MASK 0x00000700 -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_BIAS3_PWD_IR25SYNTH_MSB 13 -#define PHY_ANALOG_BIAS3_PWD_IR25SYNTH_LSB 11 -#define PHY_ANALOG_BIAS3_PWD_IR25SYNTH_MASK 0x00003800 -#define PHY_ANALOG_BIAS3_PWD_IR25SYNTH_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_BIAS3_PWD_IR25SYNTH_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_MSB 16 -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_LSB 14 -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_MASK 0x0001c000 -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_BIAS3_PWD_IR25BB_MSB 19 -#define PHY_ANALOG_BIAS3_PWD_IR25BB_LSB 17 -#define PHY_ANALOG_BIAS3_PWD_IR25BB_MASK 0x000e0000 -#define PHY_ANALOG_BIAS3_PWD_IR25BB_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_BIAS3_PWD_IR25BB_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_MSB 22 -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_LSB 20 -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_MASK 0x00700000 -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_MSB 25 -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_LSB 23 -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_MASK 0x03800000 -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_MSB 28 -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_LSB 26 -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_MASK 0x1c000000 -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_MSB 31 -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_LSB 29 -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_MASK 0xe0000000 -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for BIAS4 */ -#define PHY_ANALOG_BIAS4_ADDRESS 0x000000cc -#define PHY_ANALOG_BIAS4_OFFSET 0x000000cc -#define PHY_ANALOG_BIAS4_SPARE4_MSB 10 -#define PHY_ANALOG_BIAS4_SPARE4_LSB 0 -#define PHY_ANALOG_BIAS4_SPARE4_MASK 0x000007ff -#define PHY_ANALOG_BIAS4_SPARE4_GET(x) (((x) & 0x000007ff) >> 0) -#define PHY_ANALOG_BIAS4_SPARE4_SET(x) (((x) << 0) & 0x000007ff) -#define PHY_ANALOG_BIAS4_PWD_IR25SPARED_MSB 13 -#define PHY_ANALOG_BIAS4_PWD_IR25SPARED_LSB 11 -#define PHY_ANALOG_BIAS4_PWD_IR25SPARED_MASK 0x00003800 -#define PHY_ANALOG_BIAS4_PWD_IR25SPARED_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_BIAS4_PWD_IR25SPARED_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_MSB 16 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_LSB 14 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_MASK 0x0001c000 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_MSB 19 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_LSB 17 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_MASK 0x000e0000 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_BIAS4_PWD_IR25XPA_MSB 22 -#define PHY_ANALOG_BIAS4_PWD_IR25XPA_LSB 20 -#define PHY_ANALOG_BIAS4_PWD_IR25XPA_MASK 0x00700000 -#define PHY_ANALOG_BIAS4_PWD_IR25XPA_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_BIAS4_PWD_IR25XPA_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_MSB 25 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_LSB 23 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_MASK 0x03800000 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_MSB 28 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_LSB 26 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_MASK 0x1c000000 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_MSB 31 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_LSB 29 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_MASK 0xe0000000 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for RXTX1 */ -#define PHY_ANALOG_RXTX1_ADDRESS 0x00000100 -#define PHY_ANALOG_RXTX1_OFFSET 0x00000100 -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_MSB 0 -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_LSB 0 -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_MASK 0x00000001 -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXTX1_MANRXGAIN_MSB 1 -#define PHY_ANALOG_RXTX1_MANRXGAIN_LSB 1 -#define PHY_ANALOG_RXTX1_MANRXGAIN_MASK 0x00000002 -#define PHY_ANALOG_RXTX1_MANRXGAIN_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_RXTX1_MANRXGAIN_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_RXTX1_AGC_DBDAC_MSB 5 -#define PHY_ANALOG_RXTX1_AGC_DBDAC_LSB 2 -#define PHY_ANALOG_RXTX1_AGC_DBDAC_MASK 0x0000003c -#define PHY_ANALOG_RXTX1_AGC_DBDAC_GET(x) (((x) & 0x0000003c) >> 2) -#define PHY_ANALOG_RXTX1_AGC_DBDAC_SET(x) (((x) << 2) & 0x0000003c) -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_MSB 6 -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_LSB 6 -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_MASK 0x00000040 -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RXTX1_ENABLE_PAL_MSB 7 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_LSB 7 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_MASK 0x00000080 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXTX1_ENABLE_PAL_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_MSB 8 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_LSB 8 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_MASK 0x00000100 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_MSB 11 -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_LSB 9 -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_MASK 0x00000e00 -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_GET(x) (((x) & 0x00000e00) >> 9) -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_SET(x) (((x) << 9) & 0x00000e00) -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_MSB 13 -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_LSB 12 -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_MASK 0x00003000 -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_GET(x) (((x) & 0x00003000) >> 12) -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_SET(x) (((x) << 12) & 0x00003000) -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_MSB 14 -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_LSB 14 -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_MASK 0x00004000 -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_RXTX1_PADRV2GN_MSB 18 -#define PHY_ANALOG_RXTX1_PADRV2GN_LSB 15 -#define PHY_ANALOG_RXTX1_PADRV2GN_MASK 0x00078000 -#define PHY_ANALOG_RXTX1_PADRV2GN_GET(x) (((x) & 0x00078000) >> 15) -#define PHY_ANALOG_RXTX1_PADRV2GN_SET(x) (((x) << 15) & 0x00078000) -#define PHY_ANALOG_RXTX1_PADRV3GN5G_MSB 22 -#define PHY_ANALOG_RXTX1_PADRV3GN5G_LSB 19 -#define PHY_ANALOG_RXTX1_PADRV3GN5G_MASK 0x00780000 -#define PHY_ANALOG_RXTX1_PADRV3GN5G_GET(x) (((x) & 0x00780000) >> 19) -#define PHY_ANALOG_RXTX1_PADRV3GN5G_SET(x) (((x) << 19) & 0x00780000) -#define PHY_ANALOG_RXTX1_PADRV4GN5G_MSB 26 -#define PHY_ANALOG_RXTX1_PADRV4GN5G_LSB 23 -#define PHY_ANALOG_RXTX1_PADRV4GN5G_MASK 0x07800000 -#define PHY_ANALOG_RXTX1_PADRV4GN5G_GET(x) (((x) & 0x07800000) >> 23) -#define PHY_ANALOG_RXTX1_PADRV4GN5G_SET(x) (((x) << 23) & 0x07800000) -#define PHY_ANALOG_RXTX1_TXBB_GC_MSB 30 -#define PHY_ANALOG_RXTX1_TXBB_GC_LSB 27 -#define PHY_ANALOG_RXTX1_TXBB_GC_MASK 0x78000000 -#define PHY_ANALOG_RXTX1_TXBB_GC_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_ANALOG_RXTX1_TXBB_GC_SET(x) (((x) << 27) & 0x78000000) -#define PHY_ANALOG_RXTX1_MANTXGAIN_MSB 31 -#define PHY_ANALOG_RXTX1_MANTXGAIN_LSB 31 -#define PHY_ANALOG_RXTX1_MANTXGAIN_MASK 0x80000000 -#define PHY_ANALOG_RXTX1_MANTXGAIN_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXTX1_MANTXGAIN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for RXTX2 */ -#define PHY_ANALOG_RXTX2_ADDRESS 0x00000104 -#define PHY_ANALOG_RXTX2_OFFSET 0x00000104 -#define PHY_ANALOG_RXTX2_BMODE_MSB 0 -#define PHY_ANALOG_RXTX2_BMODE_LSB 0 -#define PHY_ANALOG_RXTX2_BMODE_MASK 0x00000001 -#define PHY_ANALOG_RXTX2_BMODE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXTX2_BMODE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXTX2_BMODE_OVR_MSB 1 -#define PHY_ANALOG_RXTX2_BMODE_OVR_LSB 1 -#define PHY_ANALOG_RXTX2_BMODE_OVR_MASK 0x00000002 -#define PHY_ANALOG_RXTX2_BMODE_OVR_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_RXTX2_BMODE_OVR_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_RXTX2_SYNTHON_MSB 2 -#define PHY_ANALOG_RXTX2_SYNTHON_LSB 2 -#define PHY_ANALOG_RXTX2_SYNTHON_MASK 0x00000004 -#define PHY_ANALOG_RXTX2_SYNTHON_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_RXTX2_SYNTHON_SET(x) (((x) << 2) & 0x00000004) -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_MSB 3 -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_LSB 3 -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_MASK 0x00000008 -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_RXTX2_BW_ST_MSB 5 -#define PHY_ANALOG_RXTX2_BW_ST_LSB 4 -#define PHY_ANALOG_RXTX2_BW_ST_MASK 0x00000030 -#define PHY_ANALOG_RXTX2_BW_ST_GET(x) (((x) & 0x00000030) >> 4) -#define PHY_ANALOG_RXTX2_BW_ST_SET(x) (((x) << 4) & 0x00000030) -#define PHY_ANALOG_RXTX2_BW_ST_OVR_MSB 6 -#define PHY_ANALOG_RXTX2_BW_ST_OVR_LSB 6 -#define PHY_ANALOG_RXTX2_BW_ST_OVR_MASK 0x00000040 -#define PHY_ANALOG_RXTX2_BW_ST_OVR_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RXTX2_BW_ST_OVR_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RXTX2_TXON_MSB 7 -#define PHY_ANALOG_RXTX2_TXON_LSB 7 -#define PHY_ANALOG_RXTX2_TXON_MASK 0x00000080 -#define PHY_ANALOG_RXTX2_TXON_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXTX2_TXON_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXTX2_TXON_OVR_MSB 8 -#define PHY_ANALOG_RXTX2_TXON_OVR_LSB 8 -#define PHY_ANALOG_RXTX2_TXON_OVR_MASK 0x00000100 -#define PHY_ANALOG_RXTX2_TXON_OVR_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RXTX2_TXON_OVR_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RXTX2_PAON_MSB 9 -#define PHY_ANALOG_RXTX2_PAON_LSB 9 -#define PHY_ANALOG_RXTX2_PAON_MASK 0x00000200 -#define PHY_ANALOG_RXTX2_PAON_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_RXTX2_PAON_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_RXTX2_PAON_OVR_MSB 10 -#define PHY_ANALOG_RXTX2_PAON_OVR_LSB 10 -#define PHY_ANALOG_RXTX2_PAON_OVR_MASK 0x00000400 -#define PHY_ANALOG_RXTX2_PAON_OVR_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_RXTX2_PAON_OVR_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_RXTX2_RXON_MSB 11 -#define PHY_ANALOG_RXTX2_RXON_LSB 11 -#define PHY_ANALOG_RXTX2_RXON_MASK 0x00000800 -#define PHY_ANALOG_RXTX2_RXON_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_RXTX2_RXON_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_RXTX2_RXON_OVR_MSB 12 -#define PHY_ANALOG_RXTX2_RXON_OVR_LSB 12 -#define PHY_ANALOG_RXTX2_RXON_OVR_MASK 0x00001000 -#define PHY_ANALOG_RXTX2_RXON_OVR_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_RXTX2_RXON_OVR_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_RXTX2_AGCON_MSB 13 -#define PHY_ANALOG_RXTX2_AGCON_LSB 13 -#define PHY_ANALOG_RXTX2_AGCON_MASK 0x00002000 -#define PHY_ANALOG_RXTX2_AGCON_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_RXTX2_AGCON_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_RXTX2_AGCON_OVR_MSB 14 -#define PHY_ANALOG_RXTX2_AGCON_OVR_LSB 14 -#define PHY_ANALOG_RXTX2_AGCON_OVR_MASK 0x00004000 -#define PHY_ANALOG_RXTX2_AGCON_OVR_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_RXTX2_AGCON_OVR_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_RXTX2_TXMOD_MSB 17 -#define PHY_ANALOG_RXTX2_TXMOD_LSB 15 -#define PHY_ANALOG_RXTX2_TXMOD_MASK 0x00038000 -#define PHY_ANALOG_RXTX2_TXMOD_GET(x) (((x) & 0x00038000) >> 15) -#define PHY_ANALOG_RXTX2_TXMOD_SET(x) (((x) << 15) & 0x00038000) -#define PHY_ANALOG_RXTX2_TXMOD_OVR_MSB 18 -#define PHY_ANALOG_RXTX2_TXMOD_OVR_LSB 18 -#define PHY_ANALOG_RXTX2_TXMOD_OVR_MASK 0x00040000 -#define PHY_ANALOG_RXTX2_TXMOD_OVR_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_RXTX2_TXMOD_OVR_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_MSB 21 -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_LSB 19 -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_MASK 0x00380000 -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_GET(x) (((x) & 0x00380000) >> 19) -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_SET(x) (((x) << 19) & 0x00380000) -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_MSB 23 -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_LSB 22 -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_MASK 0x00c00000 -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_GET(x) (((x) & 0x00c00000) >> 22) -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_SET(x) (((x) << 22) & 0x00c00000) -#define PHY_ANALOG_RXTX2_MXRGAIN_MSB 25 -#define PHY_ANALOG_RXTX2_MXRGAIN_LSB 24 -#define PHY_ANALOG_RXTX2_MXRGAIN_MASK 0x03000000 -#define PHY_ANALOG_RXTX2_MXRGAIN_GET(x) (((x) & 0x03000000) >> 24) -#define PHY_ANALOG_RXTX2_MXRGAIN_SET(x) (((x) << 24) & 0x03000000) -#define PHY_ANALOG_RXTX2_VGAGAIN_MSB 28 -#define PHY_ANALOG_RXTX2_VGAGAIN_LSB 26 -#define PHY_ANALOG_RXTX2_VGAGAIN_MASK 0x1c000000 -#define PHY_ANALOG_RXTX2_VGAGAIN_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_RXTX2_VGAGAIN_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_RXTX2_LNAGAIN_MSB 31 -#define PHY_ANALOG_RXTX2_LNAGAIN_LSB 29 -#define PHY_ANALOG_RXTX2_LNAGAIN_MASK 0xe0000000 -#define PHY_ANALOG_RXTX2_LNAGAIN_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_RXTX2_LNAGAIN_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for RXTX3 */ -#define PHY_ANALOG_RXTX3_ADDRESS 0x00000108 -#define PHY_ANALOG_RXTX3_OFFSET 0x00000108 -#define PHY_ANALOG_RXTX3_SPARE3_MSB 2 -#define PHY_ANALOG_RXTX3_SPARE3_LSB 0 -#define PHY_ANALOG_RXTX3_SPARE3_MASK 0x00000007 -#define PHY_ANALOG_RXTX3_SPARE3_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_RXTX3_SPARE3_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_RXTX3_SPURON_MSB 3 -#define PHY_ANALOG_RXTX3_SPURON_LSB 3 -#define PHY_ANALOG_RXTX3_SPURON_MASK 0x00000008 -#define PHY_ANALOG_RXTX3_SPURON_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_RXTX3_SPURON_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_RXTX3_PAL_LOCKEDEN_MSB 4 -#define PHY_ANALOG_RXTX3_PAL_LOCKEDEN_LSB 4 -#define PHY_ANALOG_RXTX3_PAL_LOCKEDEN_MASK 0x00000010 -#define PHY_ANALOG_RXTX3_PAL_LOCKEDEN_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_RXTX3_PAL_LOCKEDEN_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_RXTX3_DACFULLSCALE_MSB 5 -#define PHY_ANALOG_RXTX3_DACFULLSCALE_LSB 5 -#define PHY_ANALOG_RXTX3_DACFULLSCALE_MASK 0x00000020 -#define PHY_ANALOG_RXTX3_DACFULLSCALE_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_RXTX3_DACFULLSCALE_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_RXTX3_ADCSHORT_MSB 6 -#define PHY_ANALOG_RXTX3_ADCSHORT_LSB 6 -#define PHY_ANALOG_RXTX3_ADCSHORT_MASK 0x00000040 -#define PHY_ANALOG_RXTX3_ADCSHORT_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RXTX3_ADCSHORT_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RXTX3_DACPWD_MSB 7 -#define PHY_ANALOG_RXTX3_DACPWD_LSB 7 -#define PHY_ANALOG_RXTX3_DACPWD_MASK 0x00000080 -#define PHY_ANALOG_RXTX3_DACPWD_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXTX3_DACPWD_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXTX3_DACPWD_OVR_MSB 8 -#define PHY_ANALOG_RXTX3_DACPWD_OVR_LSB 8 -#define PHY_ANALOG_RXTX3_DACPWD_OVR_MASK 0x00000100 -#define PHY_ANALOG_RXTX3_DACPWD_OVR_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RXTX3_DACPWD_OVR_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RXTX3_ADCPWD_MSB 9 -#define PHY_ANALOG_RXTX3_ADCPWD_LSB 9 -#define PHY_ANALOG_RXTX3_ADCPWD_MASK 0x00000200 -#define PHY_ANALOG_RXTX3_ADCPWD_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_RXTX3_ADCPWD_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_MSB 10 -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_LSB 10 -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_MASK 0x00000400 -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_RXTX3_AGC_CALDAC_MSB 16 -#define PHY_ANALOG_RXTX3_AGC_CALDAC_LSB 11 -#define PHY_ANALOG_RXTX3_AGC_CALDAC_MASK 0x0001f800 -#define PHY_ANALOG_RXTX3_AGC_CALDAC_GET(x) (((x) & 0x0001f800) >> 11) -#define PHY_ANALOG_RXTX3_AGC_CALDAC_SET(x) (((x) << 11) & 0x0001f800) -#define PHY_ANALOG_RXTX3_AGC_CAL_MSB 17 -#define PHY_ANALOG_RXTX3_AGC_CAL_LSB 17 -#define PHY_ANALOG_RXTX3_AGC_CAL_MASK 0x00020000 -#define PHY_ANALOG_RXTX3_AGC_CAL_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_RXTX3_AGC_CAL_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_MSB 18 -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_LSB 18 -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_MASK 0x00040000 -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_RXTX3_LOFORCEDON_MSB 19 -#define PHY_ANALOG_RXTX3_LOFORCEDON_LSB 19 -#define PHY_ANALOG_RXTX3_LOFORCEDON_MASK 0x00080000 -#define PHY_ANALOG_RXTX3_LOFORCEDON_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_ANALOG_RXTX3_LOFORCEDON_SET(x) (((x) << 19) & 0x00080000) -#define PHY_ANALOG_RXTX3_CALRESIDUE_MSB 20 -#define PHY_ANALOG_RXTX3_CALRESIDUE_LSB 20 -#define PHY_ANALOG_RXTX3_CALRESIDUE_MASK 0x00100000 -#define PHY_ANALOG_RXTX3_CALRESIDUE_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_RXTX3_CALRESIDUE_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_MSB 21 -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_LSB 21 -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_MASK 0x00200000 -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_RXTX3_CALFC_MSB 22 -#define PHY_ANALOG_RXTX3_CALFC_LSB 22 -#define PHY_ANALOG_RXTX3_CALFC_MASK 0x00400000 -#define PHY_ANALOG_RXTX3_CALFC_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_RXTX3_CALFC_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_RXTX3_CALFC_OVR_MSB 23 -#define PHY_ANALOG_RXTX3_CALFC_OVR_LSB 23 -#define PHY_ANALOG_RXTX3_CALFC_OVR_MASK 0x00800000 -#define PHY_ANALOG_RXTX3_CALFC_OVR_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_RXTX3_CALFC_OVR_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_RXTX3_CALTX_MSB 24 -#define PHY_ANALOG_RXTX3_CALTX_LSB 24 -#define PHY_ANALOG_RXTX3_CALTX_MASK 0x01000000 -#define PHY_ANALOG_RXTX3_CALTX_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_ANALOG_RXTX3_CALTX_SET(x) (((x) << 24) & 0x01000000) -#define PHY_ANALOG_RXTX3_CALTX_OVR_MSB 25 -#define PHY_ANALOG_RXTX3_CALTX_OVR_LSB 25 -#define PHY_ANALOG_RXTX3_CALTX_OVR_MASK 0x02000000 -#define PHY_ANALOG_RXTX3_CALTX_OVR_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_ANALOG_RXTX3_CALTX_OVR_SET(x) (((x) << 25) & 0x02000000) -#define PHY_ANALOG_RXTX3_CALTXSHIFT_MSB 26 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_LSB 26 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_MASK 0x04000000 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_RXTX3_CALTXSHIFT_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_MSB 27 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_LSB 27 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_MASK 0x08000000 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_RXTX3_CALPA_MSB 28 -#define PHY_ANALOG_RXTX3_CALPA_LSB 28 -#define PHY_ANALOG_RXTX3_CALPA_MASK 0x10000000 -#define PHY_ANALOG_RXTX3_CALPA_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_RXTX3_CALPA_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_RXTX3_CALPA_OVR_MSB 29 -#define PHY_ANALOG_RXTX3_CALPA_OVR_LSB 29 -#define PHY_ANALOG_RXTX3_CALPA_OVR_MASK 0x20000000 -#define PHY_ANALOG_RXTX3_CALPA_OVR_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_RXTX3_CALPA_OVR_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_RXTX3_TURBOADC_MSB 30 -#define PHY_ANALOG_RXTX3_TURBOADC_LSB 30 -#define PHY_ANALOG_RXTX3_TURBOADC_MASK 0x40000000 -#define PHY_ANALOG_RXTX3_TURBOADC_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_RXTX3_TURBOADC_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_RXTX3_TURBOADC_OVR_MSB 31 -#define PHY_ANALOG_RXTX3_TURBOADC_OVR_LSB 31 -#define PHY_ANALOG_RXTX3_TURBOADC_OVR_MASK 0x80000000 -#define PHY_ANALOG_RXTX3_TURBOADC_OVR_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXTX3_TURBOADC_OVR_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB1 */ -#define PHY_ANALOG_BB1_ADDRESS 0x00000140 -#define PHY_ANALOG_BB1_OFFSET 0x00000140 -#define PHY_ANALOG_BB1_I2V_CURR2X_MSB 0 -#define PHY_ANALOG_BB1_I2V_CURR2X_LSB 0 -#define PHY_ANALOG_BB1_I2V_CURR2X_MASK 0x00000001 -#define PHY_ANALOG_BB1_I2V_CURR2X_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_BB1_I2V_CURR2X_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_BB1_ENABLE_LOQ_MSB 1 -#define PHY_ANALOG_BB1_ENABLE_LOQ_LSB 1 -#define PHY_ANALOG_BB1_ENABLE_LOQ_MASK 0x00000002 -#define PHY_ANALOG_BB1_ENABLE_LOQ_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_BB1_ENABLE_LOQ_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_BB1_FORCE_LOQ_MSB 2 -#define PHY_ANALOG_BB1_FORCE_LOQ_LSB 2 -#define PHY_ANALOG_BB1_FORCE_LOQ_MASK 0x00000004 -#define PHY_ANALOG_BB1_FORCE_LOQ_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_BB1_FORCE_LOQ_SET(x) (((x) << 2) & 0x00000004) -#define PHY_ANALOG_BB1_ENABLE_NOTCH_MSB 3 -#define PHY_ANALOG_BB1_ENABLE_NOTCH_LSB 3 -#define PHY_ANALOG_BB1_ENABLE_NOTCH_MASK 0x00000008 -#define PHY_ANALOG_BB1_ENABLE_NOTCH_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_BB1_ENABLE_NOTCH_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_BB1_FORCE_NOTCH_MSB 4 -#define PHY_ANALOG_BB1_FORCE_NOTCH_LSB 4 -#define PHY_ANALOG_BB1_FORCE_NOTCH_MASK 0x00000010 -#define PHY_ANALOG_BB1_FORCE_NOTCH_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_BB1_FORCE_NOTCH_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_MSB 5 -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_LSB 5 -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_MASK 0x00000020 -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_BB1_FORCE_BIQUAD_MSB 6 -#define PHY_ANALOG_BB1_FORCE_BIQUAD_LSB 6 -#define PHY_ANALOG_BB1_FORCE_BIQUAD_MASK 0x00000040 -#define PHY_ANALOG_BB1_FORCE_BIQUAD_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_BB1_FORCE_BIQUAD_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_BB1_ENABLE_OSDAC_MSB 7 -#define PHY_ANALOG_BB1_ENABLE_OSDAC_LSB 7 -#define PHY_ANALOG_BB1_ENABLE_OSDAC_MASK 0x00000080 -#define PHY_ANALOG_BB1_ENABLE_OSDAC_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_BB1_ENABLE_OSDAC_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_BB1_FORCE_OSDAC_MSB 8 -#define PHY_ANALOG_BB1_FORCE_OSDAC_LSB 8 -#define PHY_ANALOG_BB1_FORCE_OSDAC_MASK 0x00000100 -#define PHY_ANALOG_BB1_FORCE_OSDAC_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_BB1_FORCE_OSDAC_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_BB1_ENABLE_V2I_MSB 9 -#define PHY_ANALOG_BB1_ENABLE_V2I_LSB 9 -#define PHY_ANALOG_BB1_ENABLE_V2I_MASK 0x00000200 -#define PHY_ANALOG_BB1_ENABLE_V2I_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_BB1_ENABLE_V2I_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_BB1_FORCE_V2I_MSB 10 -#define PHY_ANALOG_BB1_FORCE_V2I_LSB 10 -#define PHY_ANALOG_BB1_FORCE_V2I_MASK 0x00000400 -#define PHY_ANALOG_BB1_FORCE_V2I_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_BB1_FORCE_V2I_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_BB1_ENABLE_I2V_MSB 11 -#define PHY_ANALOG_BB1_ENABLE_I2V_LSB 11 -#define PHY_ANALOG_BB1_ENABLE_I2V_MASK 0x00000800 -#define PHY_ANALOG_BB1_ENABLE_I2V_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_BB1_ENABLE_I2V_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_BB1_FORCE_I2V_MSB 12 -#define PHY_ANALOG_BB1_FORCE_I2V_LSB 12 -#define PHY_ANALOG_BB1_FORCE_I2V_MASK 0x00001000 -#define PHY_ANALOG_BB1_FORCE_I2V_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_BB1_FORCE_I2V_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_BB1_CMSEL_MSB 15 -#define PHY_ANALOG_BB1_CMSEL_LSB 13 -#define PHY_ANALOG_BB1_CMSEL_MASK 0x0000e000 -#define PHY_ANALOG_BB1_CMSEL_GET(x) (((x) & 0x0000e000) >> 13) -#define PHY_ANALOG_BB1_CMSEL_SET(x) (((x) << 13) & 0x0000e000) -#define PHY_ANALOG_BB1_ATBSEL_MSB 17 -#define PHY_ANALOG_BB1_ATBSEL_LSB 16 -#define PHY_ANALOG_BB1_ATBSEL_MASK 0x00030000 -#define PHY_ANALOG_BB1_ATBSEL_GET(x) (((x) & 0x00030000) >> 16) -#define PHY_ANALOG_BB1_ATBSEL_SET(x) (((x) << 16) & 0x00030000) -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_MSB 18 -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_LSB 18 -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_MASK 0x00040000 -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_MSB 23 -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_LSB 19 -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_MASK 0x00f80000 -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_GET(x) (((x) & 0x00f80000) >> 19) -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_SET(x) (((x) << 19) & 0x00f80000) -#define PHY_ANALOG_BB1_OFSTCORRI2VI_MSB 28 -#define PHY_ANALOG_BB1_OFSTCORRI2VI_LSB 24 -#define PHY_ANALOG_BB1_OFSTCORRI2VI_MASK 0x1f000000 -#define PHY_ANALOG_BB1_OFSTCORRI2VI_GET(x) (((x) & 0x1f000000) >> 24) -#define PHY_ANALOG_BB1_OFSTCORRI2VI_SET(x) (((x) << 24) & 0x1f000000) -#define PHY_ANALOG_BB1_LOCALOFFSET_MSB 29 -#define PHY_ANALOG_BB1_LOCALOFFSET_LSB 29 -#define PHY_ANALOG_BB1_LOCALOFFSET_MASK 0x20000000 -#define PHY_ANALOG_BB1_LOCALOFFSET_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_BB1_LOCALOFFSET_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_BB1_RANGE_OSDAC_MSB 31 -#define PHY_ANALOG_BB1_RANGE_OSDAC_LSB 30 -#define PHY_ANALOG_BB1_RANGE_OSDAC_MASK 0xc0000000 -#define PHY_ANALOG_BB1_RANGE_OSDAC_GET(x) (((x) & 0xc0000000) >> 30) -#define PHY_ANALOG_BB1_RANGE_OSDAC_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for BB2 */ -#define PHY_ANALOG_BB2_ADDRESS 0x00000144 -#define PHY_ANALOG_BB2_OFFSET 0x00000144 -#define PHY_ANALOG_BB2_SPARE_MSB 3 -#define PHY_ANALOG_BB2_SPARE_LSB 0 -#define PHY_ANALOG_BB2_SPARE_MASK 0x0000000f -#define PHY_ANALOG_BB2_SPARE_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_BB2_SPARE_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_ANALOG_BB2_MXR_HIGHGAINMASK_MSB 7 -#define PHY_ANALOG_BB2_MXR_HIGHGAINMASK_LSB 4 -#define PHY_ANALOG_BB2_MXR_HIGHGAINMASK_MASK 0x000000f0 -#define PHY_ANALOG_BB2_MXR_HIGHGAINMASK_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_BB2_MXR_HIGHGAINMASK_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_ANALOG_BB2_SEL_TEST_MSB 9 -#define PHY_ANALOG_BB2_SEL_TEST_LSB 8 -#define PHY_ANALOG_BB2_SEL_TEST_MASK 0x00000300 -#define PHY_ANALOG_BB2_SEL_TEST_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_ANALOG_BB2_SEL_TEST_SET(x) (((x) << 8) & 0x00000300) -#define PHY_ANALOG_BB2_RCFILTER_CAP_MSB 14 -#define PHY_ANALOG_BB2_RCFILTER_CAP_LSB 10 -#define PHY_ANALOG_BB2_RCFILTER_CAP_MASK 0x00007c00 -#define PHY_ANALOG_BB2_RCFILTER_CAP_GET(x) (((x) & 0x00007c00) >> 10) -#define PHY_ANALOG_BB2_RCFILTER_CAP_SET(x) (((x) << 10) & 0x00007c00) -#define PHY_ANALOG_BB2_OVERRIDE_RCFILTER_CAP_MSB 15 -#define PHY_ANALOG_BB2_OVERRIDE_RCFILTER_CAP_LSB 15 -#define PHY_ANALOG_BB2_OVERRIDE_RCFILTER_CAP_MASK 0x00008000 -#define PHY_ANALOG_BB2_OVERRIDE_RCFILTER_CAP_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_BB2_OVERRIDE_RCFILTER_CAP_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_BB2_FNOTCH_MSB 19 -#define PHY_ANALOG_BB2_FNOTCH_LSB 16 -#define PHY_ANALOG_BB2_FNOTCH_MASK 0x000f0000 -#define PHY_ANALOG_BB2_FNOTCH_GET(x) (((x) & 0x000f0000) >> 16) -#define PHY_ANALOG_BB2_FNOTCH_SET(x) (((x) << 16) & 0x000f0000) -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_MSB 20 -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_LSB 20 -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_MASK 0x00100000 -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_BB2_FILTERFC_MSB 25 -#define PHY_ANALOG_BB2_FILTERFC_LSB 21 -#define PHY_ANALOG_BB2_FILTERFC_MASK 0x03e00000 -#define PHY_ANALOG_BB2_FILTERFC_GET(x) (((x) & 0x03e00000) >> 21) -#define PHY_ANALOG_BB2_FILTERFC_SET(x) (((x) << 21) & 0x03e00000) -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_MSB 26 -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_LSB 26 -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_MASK 0x04000000 -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_MSB 27 -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_LSB 27 -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_MASK 0x08000000 -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_MSB 28 -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_LSB 28 -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_MASK 0x10000000 -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_BB2_RXIN2I2V_EN_MSB 29 -#define PHY_ANALOG_BB2_RXIN2I2V_EN_LSB 29 -#define PHY_ANALOG_BB2_RXIN2I2V_EN_MASK 0x20000000 -#define PHY_ANALOG_BB2_RXIN2I2V_EN_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_BB2_RXIN2I2V_EN_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_BB2_RXIN2BQ_EN_MSB 30 -#define PHY_ANALOG_BB2_RXIN2BQ_EN_LSB 30 -#define PHY_ANALOG_BB2_RXIN2BQ_EN_MASK 0x40000000 -#define PHY_ANALOG_BB2_RXIN2BQ_EN_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_BB2_RXIN2BQ_EN_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_MSB 31 -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_LSB 31 -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_MASK 0x80000000 -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB3 */ -#define PHY_ANALOG_BB3_ADDRESS 0x00000148 -#define PHY_ANALOG_BB3_OFFSET 0x00000148 -#define PHY_ANALOG_BB3_SPARE_MSB 15 -#define PHY_ANALOG_BB3_SPARE_LSB 0 -#define PHY_ANALOG_BB3_SPARE_MASK 0x0000ffff -#define PHY_ANALOG_BB3_SPARE_GET(x) (((x) & 0x0000ffff) >> 0) -#define PHY_ANALOG_BB3_SPARE_SET(x) (((x) << 0) & 0x0000ffff) -#define PHY_ANALOG_BB3_FILTERFC_MSB 20 -#define PHY_ANALOG_BB3_FILTERFC_LSB 16 -#define PHY_ANALOG_BB3_FILTERFC_MASK 0x001f0000 -#define PHY_ANALOG_BB3_FILTERFC_GET(x) (((x) & 0x001f0000) >> 16) -#define PHY_ANALOG_BB3_OFSTCORRI2VQ_MSB 25 -#define PHY_ANALOG_BB3_OFSTCORRI2VQ_LSB 21 -#define PHY_ANALOG_BB3_OFSTCORRI2VQ_MASK 0x03e00000 -#define PHY_ANALOG_BB3_OFSTCORRI2VQ_GET(x) (((x) & 0x03e00000) >> 21) -#define PHY_ANALOG_BB3_OFSTCORRI2VI_MSB 30 -#define PHY_ANALOG_BB3_OFSTCORRI2VI_LSB 26 -#define PHY_ANALOG_BB3_OFSTCORRI2VI_MASK 0x7c000000 -#define PHY_ANALOG_BB3_OFSTCORRI2VI_GET(x) (((x) & 0x7c000000) >> 26) -#define PHY_ANALOG_BB3_EN_TXBBCONSTCUR_MSB 31 -#define PHY_ANALOG_BB3_EN_TXBBCONSTCUR_LSB 31 -#define PHY_ANALOG_BB3_EN_TXBBCONSTCUR_MASK 0x80000000 -#define PHY_ANALOG_BB3_EN_TXBBCONSTCUR_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_BB3_EN_TXBBCONSTCUR_SET(x) (((x) << 31) & 0x80000000) - -/* macros for PLLCLKMODA */ -#define PHY_ANALOG_PLLCLKMODA_ADDRESS 0x00000280 -#define PHY_ANALOG_PLLCLKMODA_OFFSET 0x00000280 -#define PHY_ANALOG_PLLCLKMODA_PWD_PLLSDM_MSB 0 -#define PHY_ANALOG_PLLCLKMODA_PWD_PLLSDM_LSB 0 -#define PHY_ANALOG_PLLCLKMODA_PWD_PLLSDM_MASK 0x00000001 -#define PHY_ANALOG_PLLCLKMODA_PWD_PLLSDM_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_PLLCLKMODA_PWD_PLLSDM_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_PLLCLKMODA_PWDPLL_MSB 1 -#define PHY_ANALOG_PLLCLKMODA_PWDPLL_LSB 1 -#define PHY_ANALOG_PLLCLKMODA_PWDPLL_MASK 0x00000002 -#define PHY_ANALOG_PLLCLKMODA_PWDPLL_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_PLLCLKMODA_PWDPLL_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_PLLCLKMODA_PLLFRAC_MSB 16 -#define PHY_ANALOG_PLLCLKMODA_PLLFRAC_LSB 2 -#define PHY_ANALOG_PLLCLKMODA_PLLFRAC_MASK 0x0001fffc -#define PHY_ANALOG_PLLCLKMODA_PLLFRAC_GET(x) (((x) & 0x0001fffc) >> 2) -#define PHY_ANALOG_PLLCLKMODA_PLLFRAC_SET(x) (((x) << 2) & 0x0001fffc) -#define PHY_ANALOG_PLLCLKMODA_REFDIV_MSB 20 -#define PHY_ANALOG_PLLCLKMODA_REFDIV_LSB 17 -#define PHY_ANALOG_PLLCLKMODA_REFDIV_MASK 0x001e0000 -#define PHY_ANALOG_PLLCLKMODA_REFDIV_GET(x) (((x) & 0x001e0000) >> 17) -#define PHY_ANALOG_PLLCLKMODA_REFDIV_SET(x) (((x) << 17) & 0x001e0000) -#define PHY_ANALOG_PLLCLKMODA_DIV_MSB 30 -#define PHY_ANALOG_PLLCLKMODA_DIV_LSB 21 -#define PHY_ANALOG_PLLCLKMODA_DIV_MASK 0x7fe00000 -#define PHY_ANALOG_PLLCLKMODA_DIV_GET(x) (((x) & 0x7fe00000) >> 21) -#define PHY_ANALOG_PLLCLKMODA_DIV_SET(x) (((x) << 21) & 0x7fe00000) -#define PHY_ANALOG_PLLCLKMODA_LOCAL_PLL_MSB 31 -#define PHY_ANALOG_PLLCLKMODA_LOCAL_PLL_LSB 31 -#define PHY_ANALOG_PLLCLKMODA_LOCAL_PLL_MASK 0x80000000 -#define PHY_ANALOG_PLLCLKMODA_LOCAL_PLL_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_PLLCLKMODA_LOCAL_PLL_SET(x) (((x) << 31) & 0x80000000) - -/* macros for PLLCLKMODA2 */ -#define PHY_ANALOG_PLLCLKMODA2_ADDRESS 0x00000284 -#define PHY_ANALOG_PLLCLKMODA2_OFFSET 0x00000284 -#define PHY_ANALOG_PLLCLKMODA2_SPARE_MSB 3 -#define PHY_ANALOG_PLLCLKMODA2_SPARE_LSB 0 -#define PHY_ANALOG_PLLCLKMODA2_SPARE_MASK 0x0000000f -#define PHY_ANALOG_PLLCLKMODA2_SPARE_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_PLLCLKMODA2_SPARE_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_ANALOG_PLLCLKMODA2_DACPWD_MSB 4 -#define PHY_ANALOG_PLLCLKMODA2_DACPWD_LSB 4 -#define PHY_ANALOG_PLLCLKMODA2_DACPWD_MASK 0x00000010 -#define PHY_ANALOG_PLLCLKMODA2_DACPWD_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_PLLCLKMODA2_DACPWD_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_PLLCLKMODA2_ADCPWD_MSB 5 -#define PHY_ANALOG_PLLCLKMODA2_ADCPWD_LSB 5 -#define PHY_ANALOG_PLLCLKMODA2_ADCPWD_MASK 0x00000020 -#define PHY_ANALOG_PLLCLKMODA2_ADCPWD_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_PLLCLKMODA2_ADCPWD_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_ADDAC_MSB 6 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_ADDAC_LSB 6 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_ADDAC_MASK 0x00000040 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_ADDAC_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_ADDAC_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_PLLCLKMODA2_DAC_CLK_SEL_MSB 8 -#define PHY_ANALOG_PLLCLKMODA2_DAC_CLK_SEL_LSB 7 -#define PHY_ANALOG_PLLCLKMODA2_DAC_CLK_SEL_MASK 0x00000180 -#define PHY_ANALOG_PLLCLKMODA2_DAC_CLK_SEL_GET(x) (((x) & 0x00000180) >> 7) -#define PHY_ANALOG_PLLCLKMODA2_DAC_CLK_SEL_SET(x) (((x) << 7) & 0x00000180) -#define PHY_ANALOG_PLLCLKMODA2_ADC_CLK_SEL_MSB 12 -#define PHY_ANALOG_PLLCLKMODA2_ADC_CLK_SEL_LSB 9 -#define PHY_ANALOG_PLLCLKMODA2_ADC_CLK_SEL_MASK 0x00001e00 -#define PHY_ANALOG_PLLCLKMODA2_ADC_CLK_SEL_GET(x) (((x) & 0x00001e00) >> 9) -#define PHY_ANALOG_PLLCLKMODA2_ADC_CLK_SEL_SET(x) (((x) << 9) & 0x00001e00) -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_CLKMODA_MSB 13 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_CLKMODA_LSB 13 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_CLKMODA_MASK 0x00002000 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_CLKMODA_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_CLKMODA_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_PLLCLKMODA2_PLLBYPASS_MSB 14 -#define PHY_ANALOG_PLLCLKMODA2_PLLBYPASS_LSB 14 -#define PHY_ANALOG_PLLCLKMODA2_PLLBYPASS_MASK 0x00004000 -#define PHY_ANALOG_PLLCLKMODA2_PLLBYPASS_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_PLLCLKMODA2_PLLBYPASS_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_PLLBYPASS_MSB 15 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_PLLBYPASS_LSB 15 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_PLLBYPASS_MASK 0x00008000 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_PLLBYPASS_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_PLLBYPASS_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_PLLCLKMODA2_PLLATB_MSB 17 -#define PHY_ANALOG_PLLCLKMODA2_PLLATB_LSB 16 -#define PHY_ANALOG_PLLCLKMODA2_PLLATB_MASK 0x00030000 -#define PHY_ANALOG_PLLCLKMODA2_PLLATB_GET(x) (((x) & 0x00030000) >> 16) -#define PHY_ANALOG_PLLCLKMODA2_PLLATB_SET(x) (((x) << 16) & 0x00030000) -#define PHY_ANALOG_PLLCLKMODA2_PLL_SVREG_MSB 18 -#define PHY_ANALOG_PLLCLKMODA2_PLL_SVREG_LSB 18 -#define PHY_ANALOG_PLLCLKMODA2_PLL_SVREG_MASK 0x00040000 -#define PHY_ANALOG_PLLCLKMODA2_PLL_SVREG_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_PLLCLKMODA2_PLL_SVREG_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_PLLCLKMODA2_HI_FREQ_EN_MSB 19 -#define PHY_ANALOG_PLLCLKMODA2_HI_FREQ_EN_LSB 19 -#define PHY_ANALOG_PLLCLKMODA2_HI_FREQ_EN_MASK 0x00080000 -#define PHY_ANALOG_PLLCLKMODA2_HI_FREQ_EN_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_ANALOG_PLLCLKMODA2_HI_FREQ_EN_SET(x) (((x) << 19) & 0x00080000) -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_INT_L_MSB 20 -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_INT_L_LSB 20 -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_INT_L_MASK 0x00100000 -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_INT_L_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_INT_L_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_OVR_MSB 21 -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_OVR_LSB 21 -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_OVR_MASK 0x00200000 -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_OVR_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_OVR_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_PLLCLKMODA2_PLL_KVCO_MSB 23 -#define PHY_ANALOG_PLLCLKMODA2_PLL_KVCO_LSB 22 -#define PHY_ANALOG_PLLCLKMODA2_PLL_KVCO_MASK 0x00c00000 -#define PHY_ANALOG_PLLCLKMODA2_PLL_KVCO_GET(x) (((x) & 0x00c00000) >> 22) -#define PHY_ANALOG_PLLCLKMODA2_PLL_KVCO_SET(x) (((x) << 22) & 0x00c00000) -#define PHY_ANALOG_PLLCLKMODA2_PLLICP_MSB 26 -#define PHY_ANALOG_PLLCLKMODA2_PLLICP_LSB 24 -#define PHY_ANALOG_PLLCLKMODA2_PLLICP_MASK 0x07000000 -#define PHY_ANALOG_PLLCLKMODA2_PLLICP_GET(x) (((x) & 0x07000000) >> 24) -#define PHY_ANALOG_PLLCLKMODA2_PLLICP_SET(x) (((x) << 24) & 0x07000000) -#define PHY_ANALOG_PLLCLKMODA2_PLLFILTER_MSB 31 -#define PHY_ANALOG_PLLCLKMODA2_PLLFILTER_LSB 27 -#define PHY_ANALOG_PLLCLKMODA2_PLLFILTER_MASK 0xf8000000 -#define PHY_ANALOG_PLLCLKMODA2_PLLFILTER_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_PLLCLKMODA2_PLLFILTER_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for TOP */ -#define PHY_ANALOG_TOP_ADDRESS 0x00000288 -#define PHY_ANALOG_TOP_OFFSET 0x00000288 -#define PHY_ANALOG_TOP_SPARE_MSB 2 -#define PHY_ANALOG_TOP_SPARE_LSB 0 -#define PHY_ANALOG_TOP_SPARE_MASK 0x00000007 -#define PHY_ANALOG_TOP_SPARE_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_TOP_SPARE_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_TOP_PWDBIAS_MSB 3 -#define PHY_ANALOG_TOP_PWDBIAS_LSB 3 -#define PHY_ANALOG_TOP_PWDBIAS_MASK 0x00000008 -#define PHY_ANALOG_TOP_PWDBIAS_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_TOP_PWDBIAS_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_TOP_FLIP_XPABIAS_MSB 4 -#define PHY_ANALOG_TOP_FLIP_XPABIAS_LSB 4 -#define PHY_ANALOG_TOP_FLIP_XPABIAS_MASK 0x00000010 -#define PHY_ANALOG_TOP_FLIP_XPABIAS_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_TOP_FLIP_XPABIAS_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_TOP_XPAON2_MSB 5 -#define PHY_ANALOG_TOP_XPAON2_LSB 5 -#define PHY_ANALOG_TOP_XPAON2_MASK 0x00000020 -#define PHY_ANALOG_TOP_XPAON2_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_TOP_XPAON2_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_TOP_XPAON5_MSB 6 -#define PHY_ANALOG_TOP_XPAON5_LSB 6 -#define PHY_ANALOG_TOP_XPAON5_MASK 0x00000040 -#define PHY_ANALOG_TOP_XPAON5_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_TOP_XPAON5_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_TOP_XPASHORT2GND_MSB 7 -#define PHY_ANALOG_TOP_XPASHORT2GND_LSB 7 -#define PHY_ANALOG_TOP_XPASHORT2GND_MASK 0x00000080 -#define PHY_ANALOG_TOP_XPASHORT2GND_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_TOP_XPASHORT2GND_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_TOP_XPABIASLVL_MSB 11 -#define PHY_ANALOG_TOP_XPABIASLVL_LSB 8 -#define PHY_ANALOG_TOP_XPABIASLVL_MASK 0x00000f00 -#define PHY_ANALOG_TOP_XPABIASLVL_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_TOP_XPABIASLVL_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_TOP_XPABIAS_EN_MSB 12 -#define PHY_ANALOG_TOP_XPABIAS_EN_LSB 12 -#define PHY_ANALOG_TOP_XPABIAS_EN_MASK 0x00001000 -#define PHY_ANALOG_TOP_XPABIAS_EN_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_TOP_XPABIAS_EN_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_TOP_ATBSELECT_MSB 13 -#define PHY_ANALOG_TOP_ATBSELECT_LSB 13 -#define PHY_ANALOG_TOP_ATBSELECT_MASK 0x00002000 -#define PHY_ANALOG_TOP_ATBSELECT_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_TOP_ATBSELECT_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_TOP_LOCAL_XPA_MSB 14 -#define PHY_ANALOG_TOP_LOCAL_XPA_LSB 14 -#define PHY_ANALOG_TOP_LOCAL_XPA_MASK 0x00004000 -#define PHY_ANALOG_TOP_LOCAL_XPA_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_TOP_LOCAL_XPA_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_TOP_XPABIAS_BYPASS_MSB 15 -#define PHY_ANALOG_TOP_XPABIAS_BYPASS_LSB 15 -#define PHY_ANALOG_TOP_XPABIAS_BYPASS_MASK 0x00008000 -#define PHY_ANALOG_TOP_XPABIAS_BYPASS_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_TOP_XPABIAS_BYPASS_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_TOP_TEST_PADQ_EN_MSB 16 -#define PHY_ANALOG_TOP_TEST_PADQ_EN_LSB 16 -#define PHY_ANALOG_TOP_TEST_PADQ_EN_MASK 0x00010000 -#define PHY_ANALOG_TOP_TEST_PADQ_EN_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_TOP_TEST_PADQ_EN_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_TOP_TEST_PADI_EN_MSB 17 -#define PHY_ANALOG_TOP_TEST_PADI_EN_LSB 17 -#define PHY_ANALOG_TOP_TEST_PADI_EN_MASK 0x00020000 -#define PHY_ANALOG_TOP_TEST_PADI_EN_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_TOP_TEST_PADI_EN_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_TOP_TESTIQ_RSEL_MSB 18 -#define PHY_ANALOG_TOP_TESTIQ_RSEL_LSB 18 -#define PHY_ANALOG_TOP_TESTIQ_RSEL_MASK 0x00040000 -#define PHY_ANALOG_TOP_TESTIQ_RSEL_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_TOP_TESTIQ_RSEL_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_TOP_TESTIQ_BUFEN_MSB 19 -#define PHY_ANALOG_TOP_TESTIQ_BUFEN_LSB 19 -#define PHY_ANALOG_TOP_TESTIQ_BUFEN_MASK 0x00080000 -#define PHY_ANALOG_TOP_TESTIQ_BUFEN_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_ANALOG_TOP_TESTIQ_BUFEN_SET(x) (((x) << 19) & 0x00080000) -#define PHY_ANALOG_TOP_PAD2GND_MSB 20 -#define PHY_ANALOG_TOP_PAD2GND_LSB 20 -#define PHY_ANALOG_TOP_PAD2GND_MASK 0x00100000 -#define PHY_ANALOG_TOP_PAD2GND_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_TOP_PAD2GND_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_TOP_INTH2PAD_MSB 21 -#define PHY_ANALOG_TOP_INTH2PAD_LSB 21 -#define PHY_ANALOG_TOP_INTH2PAD_MASK 0x00200000 -#define PHY_ANALOG_TOP_INTH2PAD_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_TOP_INTH2PAD_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_TOP_INTH2GND_MSB 22 -#define PHY_ANALOG_TOP_INTH2GND_LSB 22 -#define PHY_ANALOG_TOP_INTH2GND_MASK 0x00400000 -#define PHY_ANALOG_TOP_INTH2GND_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_TOP_INTH2GND_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_TOP_INT2PAD_MSB 23 -#define PHY_ANALOG_TOP_INT2PAD_LSB 23 -#define PHY_ANALOG_TOP_INT2PAD_MASK 0x00800000 -#define PHY_ANALOG_TOP_INT2PAD_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_TOP_INT2PAD_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_TOP_INT2GND_MSB 24 -#define PHY_ANALOG_TOP_INT2GND_LSB 24 -#define PHY_ANALOG_TOP_INT2GND_MASK 0x01000000 -#define PHY_ANALOG_TOP_INT2GND_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_ANALOG_TOP_INT2GND_SET(x) (((x) << 24) & 0x01000000) -#define PHY_ANALOG_TOP_PWDPALCLK_MSB 25 -#define PHY_ANALOG_TOP_PWDPALCLK_LSB 25 -#define PHY_ANALOG_TOP_PWDPALCLK_MASK 0x02000000 -#define PHY_ANALOG_TOP_PWDPALCLK_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_ANALOG_TOP_PWDPALCLK_SET(x) (((x) << 25) & 0x02000000) -#define PHY_ANALOG_TOP_INV_CLK320_ADC_MSB 26 -#define PHY_ANALOG_TOP_INV_CLK320_ADC_LSB 26 -#define PHY_ANALOG_TOP_INV_CLK320_ADC_MASK 0x04000000 -#define PHY_ANALOG_TOP_INV_CLK320_ADC_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_TOP_INV_CLK320_ADC_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_TOP_FLIP_REFCLK40_MSB 27 -#define PHY_ANALOG_TOP_FLIP_REFCLK40_LSB 27 -#define PHY_ANALOG_TOP_FLIP_REFCLK40_MASK 0x08000000 -#define PHY_ANALOG_TOP_FLIP_REFCLK40_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_TOP_FLIP_REFCLK40_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_TOP_FLIP_PLLCLK320_MSB 28 -#define PHY_ANALOG_TOP_FLIP_PLLCLK320_LSB 28 -#define PHY_ANALOG_TOP_FLIP_PLLCLK320_MASK 0x10000000 -#define PHY_ANALOG_TOP_FLIP_PLLCLK320_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_TOP_FLIP_PLLCLK320_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_TOP_FLIP_PLLCLK160_MSB 29 -#define PHY_ANALOG_TOP_FLIP_PLLCLK160_LSB 29 -#define PHY_ANALOG_TOP_FLIP_PLLCLK160_MASK 0x20000000 -#define PHY_ANALOG_TOP_FLIP_PLLCLK160_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_TOP_FLIP_PLLCLK160_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_TOP_CLK_SEL_MSB 31 -#define PHY_ANALOG_TOP_CLK_SEL_LSB 30 -#define PHY_ANALOG_TOP_CLK_SEL_MASK 0xc0000000 -#define PHY_ANALOG_TOP_CLK_SEL_GET(x) (((x) & 0xc0000000) >> 30) -#define PHY_ANALOG_TOP_CLK_SEL_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for THERM */ -#define PHY_ANALOG_THERM_ADDRESS 0x0000028c -#define PHY_ANALOG_THERM_OFFSET 0x0000028c -#define PHY_ANALOG_THERM_LOREG_LVL_MSB 2 -#define PHY_ANALOG_THERM_LOREG_LVL_LSB 0 -#define PHY_ANALOG_THERM_LOREG_LVL_MASK 0x00000007 -#define PHY_ANALOG_THERM_LOREG_LVL_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_THERM_LOREG_LVL_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_THERM_RFREG_LVL_MSB 5 -#define PHY_ANALOG_THERM_RFREG_LVL_LSB 3 -#define PHY_ANALOG_THERM_RFREG_LVL_MASK 0x00000038 -#define PHY_ANALOG_THERM_RFREG_LVL_GET(x) (((x) & 0x00000038) >> 3) -#define PHY_ANALOG_THERM_RFREG_LVL_SET(x) (((x) << 3) & 0x00000038) -#define PHY_ANALOG_THERM_SAR_ADC_DONE_MSB 6 -#define PHY_ANALOG_THERM_SAR_ADC_DONE_LSB 6 -#define PHY_ANALOG_THERM_SAR_ADC_DONE_MASK 0x00000040 -#define PHY_ANALOG_THERM_SAR_ADC_DONE_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_THERM_SAR_ADC_OUT_MSB 14 -#define PHY_ANALOG_THERM_SAR_ADC_OUT_LSB 7 -#define PHY_ANALOG_THERM_SAR_ADC_OUT_MASK 0x00007f80 -#define PHY_ANALOG_THERM_SAR_ADC_OUT_GET(x) (((x) & 0x00007f80) >> 7) -#define PHY_ANALOG_THERM_SAR_DACTEST_CODE_MSB 22 -#define PHY_ANALOG_THERM_SAR_DACTEST_CODE_LSB 15 -#define PHY_ANALOG_THERM_SAR_DACTEST_CODE_MASK 0x007f8000 -#define PHY_ANALOG_THERM_SAR_DACTEST_CODE_GET(x) (((x) & 0x007f8000) >> 15) -#define PHY_ANALOG_THERM_SAR_DACTEST_CODE_SET(x) (((x) << 15) & 0x007f8000) -#define PHY_ANALOG_THERM_SAR_DACTEST_EN_MSB 23 -#define PHY_ANALOG_THERM_SAR_DACTEST_EN_LSB 23 -#define PHY_ANALOG_THERM_SAR_DACTEST_EN_MASK 0x00800000 -#define PHY_ANALOG_THERM_SAR_DACTEST_EN_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_THERM_SAR_DACTEST_EN_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_THERM_SAR_ADCCAL_EN_MSB 24 -#define PHY_ANALOG_THERM_SAR_ADCCAL_EN_LSB 24 -#define PHY_ANALOG_THERM_SAR_ADCCAL_EN_MASK 0x01000000 -#define PHY_ANALOG_THERM_SAR_ADCCAL_EN_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_ANALOG_THERM_SAR_ADCCAL_EN_SET(x) (((x) << 24) & 0x01000000) -#define PHY_ANALOG_THERM_THERMSEL_MSB 26 -#define PHY_ANALOG_THERM_THERMSEL_LSB 25 -#define PHY_ANALOG_THERM_THERMSEL_MASK 0x06000000 -#define PHY_ANALOG_THERM_THERMSEL_GET(x) (((x) & 0x06000000) >> 25) -#define PHY_ANALOG_THERM_THERMSEL_SET(x) (((x) << 25) & 0x06000000) -#define PHY_ANALOG_THERM_SAR_SLOW_EN_MSB 27 -#define PHY_ANALOG_THERM_SAR_SLOW_EN_LSB 27 -#define PHY_ANALOG_THERM_SAR_SLOW_EN_MASK 0x08000000 -#define PHY_ANALOG_THERM_SAR_SLOW_EN_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_THERM_SAR_SLOW_EN_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_THERM_THERMSTART_MSB 28 -#define PHY_ANALOG_THERM_THERMSTART_LSB 28 -#define PHY_ANALOG_THERM_THERMSTART_MASK 0x10000000 -#define PHY_ANALOG_THERM_THERMSTART_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_THERM_THERMSTART_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_THERM_SAR_AUTOPWD_EN_MSB 29 -#define PHY_ANALOG_THERM_SAR_AUTOPWD_EN_LSB 29 -#define PHY_ANALOG_THERM_SAR_AUTOPWD_EN_MASK 0x20000000 -#define PHY_ANALOG_THERM_SAR_AUTOPWD_EN_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_THERM_SAR_AUTOPWD_EN_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_THERM_THERMON_MSB 30 -#define PHY_ANALOG_THERM_THERMON_LSB 30 -#define PHY_ANALOG_THERM_THERMON_MASK 0x40000000 -#define PHY_ANALOG_THERM_THERMON_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_THERM_THERMON_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_THERM_LOCAL_THERM_MSB 31 -#define PHY_ANALOG_THERM_LOCAL_THERM_LSB 31 -#define PHY_ANALOG_THERM_LOCAL_THERM_MASK 0x80000000 -#define PHY_ANALOG_THERM_LOCAL_THERM_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_THERM_LOCAL_THERM_SET(x) (((x) << 31) & 0x80000000) - -/* macros for XTAL */ -#define PHY_ANALOG_XTAL_ADDRESS 0x00000290 -#define PHY_ANALOG_XTAL_OFFSET 0x00000290 -#define PHY_ANALOG_XTAL_SPARE_MSB 5 -#define PHY_ANALOG_XTAL_SPARE_LSB 0 -#define PHY_ANALOG_XTAL_SPARE_MASK 0x0000003f -#define PHY_ANALOG_XTAL_SPARE_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_ANALOG_XTAL_SPARE_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_ANALOG_XTAL_XTAL_NOTCXODET_MSB 6 -#define PHY_ANALOG_XTAL_XTAL_NOTCXODET_LSB 6 -#define PHY_ANALOG_XTAL_XTAL_NOTCXODET_MASK 0x00000040 -#define PHY_ANALOG_XTAL_XTAL_NOTCXODET_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_XTAL_XTAL_NOTCXODET_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_XTAL_LOCALBIAS2X_MSB 7 -#define PHY_ANALOG_XTAL_LOCALBIAS2X_LSB 7 -#define PHY_ANALOG_XTAL_LOCALBIAS2X_MASK 0x00000080 -#define PHY_ANALOG_XTAL_LOCALBIAS2X_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_XTAL_LOCALBIAS2X_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_XTAL_LOCAL_XTAL_MSB 8 -#define PHY_ANALOG_XTAL_LOCAL_XTAL_LSB 8 -#define PHY_ANALOG_XTAL_LOCAL_XTAL_MASK 0x00000100 -#define PHY_ANALOG_XTAL_LOCAL_XTAL_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_XTAL_LOCAL_XTAL_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_XTAL_XTAL_PWDCLKIN_MSB 9 -#define PHY_ANALOG_XTAL_XTAL_PWDCLKIN_LSB 9 -#define PHY_ANALOG_XTAL_XTAL_PWDCLKIN_MASK 0x00000200 -#define PHY_ANALOG_XTAL_XTAL_PWDCLKIN_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_XTAL_XTAL_PWDCLKIN_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_XTAL_XTAL_OSCON_MSB 10 -#define PHY_ANALOG_XTAL_XTAL_OSCON_LSB 10 -#define PHY_ANALOG_XTAL_XTAL_OSCON_MASK 0x00000400 -#define PHY_ANALOG_XTAL_XTAL_OSCON_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_XTAL_XTAL_OSCON_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_XTAL_XTAL_PWDCLKD_MSB 11 -#define PHY_ANALOG_XTAL_XTAL_PWDCLKD_LSB 11 -#define PHY_ANALOG_XTAL_XTAL_PWDCLKD_MASK 0x00000800 -#define PHY_ANALOG_XTAL_XTAL_PWDCLKD_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_XTAL_XTAL_PWDCLKD_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_XTAL_XTAL_LOCALBIAS_MSB 12 -#define PHY_ANALOG_XTAL_XTAL_LOCALBIAS_LSB 12 -#define PHY_ANALOG_XTAL_XTAL_LOCALBIAS_MASK 0x00001000 -#define PHY_ANALOG_XTAL_XTAL_LOCALBIAS_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_XTAL_XTAL_LOCALBIAS_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_XTAL_XTAL_SHRTXIN_MSB 13 -#define PHY_ANALOG_XTAL_XTAL_SHRTXIN_LSB 13 -#define PHY_ANALOG_XTAL_XTAL_SHRTXIN_MASK 0x00002000 -#define PHY_ANALOG_XTAL_XTAL_SHRTXIN_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_XTAL_XTAL_SHRTXIN_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_XTAL_XTAL_DRVSTR_MSB 15 -#define PHY_ANALOG_XTAL_XTAL_DRVSTR_LSB 14 -#define PHY_ANALOG_XTAL_XTAL_DRVSTR_MASK 0x0000c000 -#define PHY_ANALOG_XTAL_XTAL_DRVSTR_GET(x) (((x) & 0x0000c000) >> 14) -#define PHY_ANALOG_XTAL_XTAL_DRVSTR_SET(x) (((x) << 14) & 0x0000c000) -#define PHY_ANALOG_XTAL_XTAL_CAPOUTDAC_MSB 22 -#define PHY_ANALOG_XTAL_XTAL_CAPOUTDAC_LSB 16 -#define PHY_ANALOG_XTAL_XTAL_CAPOUTDAC_MASK 0x007f0000 -#define PHY_ANALOG_XTAL_XTAL_CAPOUTDAC_GET(x) (((x) & 0x007f0000) >> 16) -#define PHY_ANALOG_XTAL_XTAL_CAPOUTDAC_SET(x) (((x) << 16) & 0x007f0000) -#define PHY_ANALOG_XTAL_XTAL_CAPINDAC_MSB 29 -#define PHY_ANALOG_XTAL_XTAL_CAPINDAC_LSB 23 -#define PHY_ANALOG_XTAL_XTAL_CAPINDAC_MASK 0x3f800000 -#define PHY_ANALOG_XTAL_XTAL_CAPINDAC_GET(x) (((x) & 0x3f800000) >> 23) -#define PHY_ANALOG_XTAL_XTAL_CAPINDAC_SET(x) (((x) << 23) & 0x3f800000) -#define PHY_ANALOG_XTAL_XTAL_BIAS2X_MSB 30 -#define PHY_ANALOG_XTAL_XTAL_BIAS2X_LSB 30 -#define PHY_ANALOG_XTAL_XTAL_BIAS2X_MASK 0x40000000 -#define PHY_ANALOG_XTAL_XTAL_BIAS2X_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_XTAL_XTAL_BIAS2X_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_XTAL_TCXODET_MSB 31 -#define PHY_ANALOG_XTAL_TCXODET_LSB 31 -#define PHY_ANALOG_XTAL_TCXODET_MASK 0x80000000 -#define PHY_ANALOG_XTAL_TCXODET_GET(x) (((x) & 0x80000000) >> 31) - -/* macros for rbist_cntrl */ -#define PHY_ANALOG_RBIST_CNTRL_ADDRESS 0x00000380 -#define PHY_ANALOG_RBIST_CNTRL_OFFSET 0x00000380 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_MSB 0 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_LSB 0 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_MASK 0x00000001 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_MSB 1 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_LSB 1 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_MASK 0x00000002 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_MSB 2 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_LSB 2 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_MASK 0x00000004 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_SET(x) (((x) << 2) & 0x00000004) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_MSB 3 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_LSB 3 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_MASK 0x00000008 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_MSB 4 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_LSB 4 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_MASK 0x00000010 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_MSB 5 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_LSB 5 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_MASK 0x00000020 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_MSB 6 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_LSB 6 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_MASK 0x00000040 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_MSB 7 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_LSB 7 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_MASK 0x00000080 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_MSB 8 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_LSB 8 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_MASK 0x00000100 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_MSB 9 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_LSB 9 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_MASK 0x00000200 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_MSB 10 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_LSB 10 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_MASK 0x00000400 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_MSB 11 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_LSB 11 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_MASK 0x00000800 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_MSB 12 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_LSB 12 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_MASK 0x00001000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_MSB 13 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_LSB 13 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_MASK 0x00002000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_MSB 14 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_LSB 14 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_MASK 0x00004000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_MSB 15 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_LSB 15 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_MASK 0x00008000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_MSB 16 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_LSB 16 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_MASK 0x00010000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_MSB 17 -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_LSB 17 -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_MASK 0x00020000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_SET(x) (((x) << 17) & 0x00020000) - -/* macros for tx_dc_offset */ -#define PHY_ANALOG_TX_DC_OFFSET_ADDRESS 0x00000384 -#define PHY_ANALOG_TX_DC_OFFSET_OFFSET 0x00000384 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_MSB 10 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_LSB 0 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_MASK 0x000007ff -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_GET(x) (((x) & 0x000007ff) >> 0) -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_SET(x) (((x) << 0) & 0x000007ff) -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_MSB 26 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_LSB 16 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_MASK 0x07ff0000 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_GET(x) (((x) & 0x07ff0000) >> 16) -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_SET(x) (((x) << 16) & 0x07ff0000) - -/* macros for tx_tonegen0 */ -#define PHY_ANALOG_TX_TONEGEN0_ADDRESS 0x00000388 -#define PHY_ANALOG_TX_TONEGEN0_OFFSET 0x00000388 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_MSB 6 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_LSB 0 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_MASK 0x0000007f -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_MSB 11 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_LSB 8 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_MASK 0x00000f00 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_MSB 23 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_LSB 16 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_MASK 0x00ff0000 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_MSB 30 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_LSB 24 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_MASK 0x7f000000 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for tx_tonegen1 */ -#define PHY_ANALOG_TX_TONEGEN1_ADDRESS 0x0000038c -#define PHY_ANALOG_TX_TONEGEN1_OFFSET 0x0000038c -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_MSB 6 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_LSB 0 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_MASK 0x0000007f -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_MSB 11 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_LSB 8 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_MASK 0x00000f00 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_MSB 23 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_LSB 16 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_MASK 0x00ff0000 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_MSB 30 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_LSB 24 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_MASK 0x7f000000 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for tx_lftonegen0 */ -#define PHY_ANALOG_TX_LFTONEGEN0_ADDRESS 0x00000390 -#define PHY_ANALOG_TX_LFTONEGEN0_OFFSET 0x00000390 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_MSB 6 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_LSB 0 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_MASK 0x0000007f -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_MSB 11 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_LSB 8 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_MASK 0x00000f00 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_MSB 23 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_LSB 16 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_MASK 0x00ff0000 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_MSB 30 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_LSB 24 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_MASK 0x7f000000 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for tx_linear_ramp_i */ -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ADDRESS 0x00000394 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_OFFSET 0x00000394 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_MSB 10 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_LSB 0 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_MASK 0x000007ff -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_GET(x) (((x) & 0x000007ff) >> 0) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_SET(x) (((x) << 0) & 0x000007ff) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_MSB 21 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_LSB 12 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_MASK 0x003ff000 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_GET(x) (((x) & 0x003ff000) >> 12) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_SET(x) (((x) << 12) & 0x003ff000) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_MSB 29 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_LSB 24 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_MASK 0x3f000000 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for tx_linear_ramp_q */ -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ADDRESS 0x00000398 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_OFFSET 0x00000398 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_MSB 10 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_LSB 0 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_MASK 0x000007ff -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_GET(x) (((x) & 0x000007ff) >> 0) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_SET(x) (((x) << 0) & 0x000007ff) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_MSB 21 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_LSB 12 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_MASK 0x003ff000 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_GET(x) (((x) & 0x003ff000) >> 12) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_SET(x) (((x) << 12) & 0x003ff000) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_MSB 29 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_LSB 24 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_MASK 0x3f000000 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for tx_prbs_mag */ -#define PHY_ANALOG_TX_PRBS_MAG_ADDRESS 0x0000039c -#define PHY_ANALOG_TX_PRBS_MAG_OFFSET 0x0000039c -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_MSB 9 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_LSB 0 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_MASK 0x000003ff -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_MSB 25 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_LSB 16 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_MASK 0x03ff0000 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_GET(x) (((x) & 0x03ff0000) >> 16) -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_SET(x) (((x) << 16) & 0x03ff0000) - -/* macros for tx_prbs_seed_i */ -#define PHY_ANALOG_TX_PRBS_SEED_I_ADDRESS 0x000003a0 -#define PHY_ANALOG_TX_PRBS_SEED_I_OFFSET 0x000003a0 -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_MSB 30 -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_LSB 0 -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_MASK 0x7fffffff -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_GET(x) (((x) & 0x7fffffff) >> 0) -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_SET(x) (((x) << 0) & 0x7fffffff) - -/* macros for tx_prbs_seed_q */ -#define PHY_ANALOG_TX_PRBS_SEED_Q_ADDRESS 0x000003a4 -#define PHY_ANALOG_TX_PRBS_SEED_Q_OFFSET 0x000003a4 -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_MSB 30 -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_LSB 0 -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_MASK 0x7fffffff -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_GET(x) (((x) & 0x7fffffff) >> 0) -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_SET(x) (((x) << 0) & 0x7fffffff) - -/* macros for cmac_dc_cancel */ -#define PHY_ANALOG_CMAC_DC_CANCEL_ADDRESS 0x000003a8 -#define PHY_ANALOG_CMAC_DC_CANCEL_OFFSET 0x000003a8 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_MSB 9 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_LSB 0 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_MASK 0x000003ff -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_MSB 25 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_LSB 16 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_MASK 0x03ff0000 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_GET(x) (((x) & 0x03ff0000) >> 16) -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_SET(x) (((x) << 16) & 0x03ff0000) - -/* macros for cmac_dc_offset */ -#define PHY_ANALOG_CMAC_DC_OFFSET_ADDRESS 0x000003ac -#define PHY_ANALOG_CMAC_DC_OFFSET_OFFSET 0x000003ac -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_SET(x) (((x) << 0) & 0x0000000f) - -/* macros for cmac_corr */ -#define PHY_ANALOG_CMAC_CORR_ADDRESS 0x000003b0 -#define PHY_ANALOG_CMAC_CORR_OFFSET 0x000003b0 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_MSB 4 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_MASK 0x0000001f -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_MSB 13 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_LSB 8 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_MASK 0x00003f00 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_SET(x) (((x) << 8) & 0x00003f00) - -/* macros for cmac_power */ -#define PHY_ANALOG_CMAC_POWER_ADDRESS 0x000003b4 -#define PHY_ANALOG_CMAC_POWER_OFFSET 0x000003b4 -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_SET(x) (((x) << 0) & 0x0000000f) - -/* macros for cmac_cross_corr */ -#define PHY_ANALOG_CMAC_CROSS_CORR_ADDRESS 0x000003b8 -#define PHY_ANALOG_CMAC_CROSS_CORR_OFFSET 0x000003b8 -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_SET(x) (((x) << 0) & 0x0000000f) - -/* macros for cmac_i2q2 */ -#define PHY_ANALOG_CMAC_I2Q2_ADDRESS 0x000003bc -#define PHY_ANALOG_CMAC_I2Q2_OFFSET 0x000003bc -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_SET(x) (((x) << 0) & 0x0000000f) - -/* macros for cmac_power_hpf */ -#define PHY_ANALOG_CMAC_POWER_HPF_ADDRESS 0x000003c0 -#define PHY_ANALOG_CMAC_POWER_HPF_OFFSET 0x000003c0 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_MSB 7 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_LSB 4 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_MASK 0x000000f0 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_SET(x) (((x) << 4) & 0x000000f0) - -/* macros for rxdac_set1 */ -#define PHY_ANALOG_RXDAC_SET1_ADDRESS 0x000003c4 -#define PHY_ANALOG_RXDAC_SET1_OFFSET 0x000003c4 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_MSB 1 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_LSB 0 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_MASK 0x00000003 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_MSB 4 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_LSB 4 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_MASK 0x00000010 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_MSB 13 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_LSB 8 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_MASK 0x00003f00 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_MSB 19 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_LSB 16 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_MASK 0x000f0000 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_GET(x) (((x) & 0x000f0000) >> 16) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_SET(x) (((x) << 16) & 0x000f0000) - -/* macros for rxdac_set2 */ -#define PHY_ANALOG_RXDAC_SET2_ADDRESS 0x000003c8 -#define PHY_ANALOG_RXDAC_SET2_OFFSET 0x000003c8 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_MSB 4 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_LSB 0 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_MASK 0x0000001f -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_MSB 12 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_LSB 8 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_MASK 0x00001f00 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_GET(x) (((x) & 0x00001f00) >> 8) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_SET(x) (((x) << 8) & 0x00001f00) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_MSB 20 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_LSB 16 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_MASK 0x001f0000 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_GET(x) (((x) & 0x001f0000) >> 16) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_SET(x) (((x) << 16) & 0x001f0000) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_MSB 28 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_LSB 24 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_MASK 0x1f000000 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_GET(x) (((x) & 0x1f000000) >> 24) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_SET(x) (((x) << 24) & 0x1f000000) - -/* macros for rxdac_long_shift */ -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ADDRESS 0x000003cc -#define PHY_ANALOG_RXDAC_LONG_SHIFT_OFFSET 0x000003cc -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_MSB 4 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_LSB 0 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_MASK 0x0000001f -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_MSB 12 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_LSB 8 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_MASK 0x00001f00 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_GET(x) (((x) & 0x00001f00) >> 8) -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_SET(x) (((x) << 8) & 0x00001f00) - -/* macros for cmac_results_i */ -#define PHY_ANALOG_CMAC_RESULTS_I_ADDRESS 0x000003d0 -#define PHY_ANALOG_CMAC_RESULTS_I_OFFSET 0x000003d0 -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_MSB 31 -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_LSB 0 -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_MASK 0xffffffff -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for cmac_results_q */ -#define PHY_ANALOG_CMAC_RESULTS_Q_ADDRESS 0x000003d4 -#define PHY_ANALOG_CMAC_RESULTS_Q_OFFSET 0x000003d4 -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_MSB 31 -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_LSB 0 -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_MASK 0xffffffff -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for PMU1 */ -#define PHY_ANALOG_PMU1_ADDRESS 0x00000740 -#define PHY_ANALOG_PMU1_OFFSET 0x00000740 -#define PHY_ANALOG_PMU1_SPARE_MSB 10 -#define PHY_ANALOG_PMU1_SPARE_LSB 0 -#define PHY_ANALOG_PMU1_SPARE_MASK 0x000007ff -#define PHY_ANALOG_PMU1_SPARE_GET(x) (((x) & 0x000007ff) >> 0) -#define PHY_ANALOG_PMU1_SPARE_SET(x) (((x) << 0) & 0x000007ff) -#define PHY_ANALOG_PMU1_OTP_V25_PWD_MSB 11 -#define PHY_ANALOG_PMU1_OTP_V25_PWD_LSB 11 -#define PHY_ANALOG_PMU1_OTP_V25_PWD_MASK 0x00000800 -#define PHY_ANALOG_PMU1_OTP_V25_PWD_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_PMU1_OTP_V25_PWD_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_PMU1_PAREGON_MAN_MSB 12 -#define PHY_ANALOG_PMU1_PAREGON_MAN_LSB 12 -#define PHY_ANALOG_PMU1_PAREGON_MAN_MASK 0x00001000 -#define PHY_ANALOG_PMU1_PAREGON_MAN_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_PMU1_PAREGON_MAN_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_PMU1_OTPREGON_MAN_MSB 13 -#define PHY_ANALOG_PMU1_OTPREGON_MAN_LSB 13 -#define PHY_ANALOG_PMU1_OTPREGON_MAN_MASK 0x00002000 -#define PHY_ANALOG_PMU1_OTPREGON_MAN_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_PMU1_OTPREGON_MAN_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_PMU1_DREGON_MAN_MSB 14 -#define PHY_ANALOG_PMU1_DREGON_MAN_LSB 14 -#define PHY_ANALOG_PMU1_DREGON_MAN_MASK 0x00004000 -#define PHY_ANALOG_PMU1_DREGON_MAN_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_PMU1_DREGON_MAN_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_PMU1_DISCONTMODEEN_MSB 15 -#define PHY_ANALOG_PMU1_DISCONTMODEEN_LSB 15 -#define PHY_ANALOG_PMU1_DISCONTMODEEN_MASK 0x00008000 -#define PHY_ANALOG_PMU1_DISCONTMODEEN_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_PMU1_DISCONTMODEEN_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_PMU1_SWREGON_MAN_MSB 16 -#define PHY_ANALOG_PMU1_SWREGON_MAN_LSB 16 -#define PHY_ANALOG_PMU1_SWREGON_MAN_MASK 0x00010000 -#define PHY_ANALOG_PMU1_SWREGON_MAN_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_PMU1_SWREGON_MAN_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_MSB 18 -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_LSB 17 -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_MASK 0x00060000 -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_GET(x) (((x) & 0x00060000) >> 17) -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_SET(x) (((x) << 17) & 0x00060000) -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_MSB 21 -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_LSB 19 -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_MASK 0x00380000 -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_GET(x) (((x) & 0x00380000) >> 19) -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_SET(x) (((x) << 19) & 0x00380000) -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_MSB 23 -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_LSB 22 -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_MASK 0x00c00000 -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_GET(x) (((x) & 0x00c00000) >> 22) -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_SET(x) (((x) << 22) & 0x00c00000) -#define PHY_ANALOG_PMU1_SREG_LVLCTR_MSB 25 -#define PHY_ANALOG_PMU1_SREG_LVLCTR_LSB 24 -#define PHY_ANALOG_PMU1_SREG_LVLCTR_MASK 0x03000000 -#define PHY_ANALOG_PMU1_SREG_LVLCTR_GET(x) (((x) & 0x03000000) >> 24) -#define PHY_ANALOG_PMU1_SREG_LVLCTR_SET(x) (((x) << 24) & 0x03000000) -#define PHY_ANALOG_PMU1_DREG_LVLCTR_MSB 27 -#define PHY_ANALOG_PMU1_DREG_LVLCTR_LSB 26 -#define PHY_ANALOG_PMU1_DREG_LVLCTR_MASK 0x0c000000 -#define PHY_ANALOG_PMU1_DREG_LVLCTR_GET(x) (((x) & 0x0c000000) >> 26) -#define PHY_ANALOG_PMU1_DREG_LVLCTR_SET(x) (((x) << 26) & 0x0c000000) -#define PHY_ANALOG_PMU1_PAREG_XPNP_MSB 28 -#define PHY_ANALOG_PMU1_PAREG_XPNP_LSB 28 -#define PHY_ANALOG_PMU1_PAREG_XPNP_MASK 0x10000000 -#define PHY_ANALOG_PMU1_PAREG_XPNP_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_PMU1_PAREG_XPNP_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_MSB 31 -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_LSB 29 -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_MASK 0xe0000000 -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for PMU2 */ -#define PHY_ANALOG_PMU2_ADDRESS 0x00000744 -#define PHY_ANALOG_PMU2_OFFSET 0x00000744 -#define PHY_ANALOG_PMU2_SPARE_MSB 7 -#define PHY_ANALOG_PMU2_SPARE_LSB 0 -#define PHY_ANALOG_PMU2_SPARE_MASK 0x000000ff -#define PHY_ANALOG_PMU2_SPARE_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_ANALOG_PMU2_SPARE_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_MSB 8 -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_LSB 8 -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_MASK 0x00000100 -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_MSB 9 -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_LSB 9 -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_MASK 0x00000200 -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_MSB 10 -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_LSB 10 -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_MASK 0x00000400 -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_MSB 11 -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_LSB 11 -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_MASK 0x00000800 -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_MSB 12 -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_LSB 12 -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_MASK 0x00001000 -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_MSB 13 -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_LSB 13 -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_MASK 0x00002000 -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_MSB 14 -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_LSB 14 -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_MASK 0x00004000 -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_MSB 15 -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_LSB 15 -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_MASK 0x00008000 -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_PMU2_PMU_MAN_OVERRIDE_EN_MSB 16 -#define PHY_ANALOG_PMU2_PMU_MAN_OVERRIDE_EN_LSB 16 -#define PHY_ANALOG_PMU2_PMU_MAN_OVERRIDE_EN_MASK 0x00010000 -#define PHY_ANALOG_PMU2_PMU_MAN_OVERRIDE_EN_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_PMU2_PMU_MAN_OVERRIDE_EN_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_MSB 18 -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_LSB 17 -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_MASK 0x00060000 -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_GET(x) (((x) & 0x00060000) >> 17) -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_SET(x) (((x) << 17) & 0x00060000) -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_MSB 19 -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_LSB 19 -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_MASK 0x00080000 -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_SET(x) (((x) << 19) & 0x00080000) -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_MSB 21 -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_LSB 20 -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_MASK 0x00300000 -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_GET(x) (((x) & 0x00300000) >> 20) -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_SET(x) (((x) << 20) & 0x00300000) -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_MSB 22 -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_LSB 22 -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_MASK 0x00400000 -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_MSB 24 -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_LSB 23 -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_MASK 0x01800000 -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_GET(x) (((x) & 0x01800000) >> 23) -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_SET(x) (((x) << 23) & 0x01800000) -#define PHY_ANALOG_PMU2_SWREG2ATB_MSB 27 -#define PHY_ANALOG_PMU2_SWREG2ATB_LSB 25 -#define PHY_ANALOG_PMU2_SWREG2ATB_MASK 0x0e000000 -#define PHY_ANALOG_PMU2_SWREG2ATB_GET(x) (((x) & 0x0e000000) >> 25) -#define PHY_ANALOG_PMU2_SWREG2ATB_SET(x) (((x) << 25) & 0x0e000000) -#define PHY_ANALOG_PMU2_OTPREG2ATB_MSB 28 -#define PHY_ANALOG_PMU2_OTPREG2ATB_LSB 28 -#define PHY_ANALOG_PMU2_OTPREG2ATB_MASK 0x10000000 -#define PHY_ANALOG_PMU2_OTPREG2ATB_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_PMU2_OTPREG2ATB_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_MSB 30 -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_LSB 29 -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_MASK 0x60000000 -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_GET(x) (((x) & 0x60000000) >> 29) -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_SET(x) (((x) << 29) & 0x60000000) -#define PHY_ANALOG_PMU2_DREG_LVLCTR_MANOVR_EN_MSB 31 -#define PHY_ANALOG_PMU2_DREG_LVLCTR_MANOVR_EN_LSB 31 -#define PHY_ANALOG_PMU2_DREG_LVLCTR_MANOVR_EN_MASK 0x80000000 -#define PHY_ANALOG_PMU2_DREG_LVLCTR_MANOVR_EN_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_PMU2_DREG_LVLCTR_MANOVR_EN_SET(x) (((x) << 31) & 0x80000000) - - -#ifndef __ASSEMBLER__ - -typedef struct analog_intf_athr_wlan_reg_reg_s { - volatile unsigned int RXRF_BIAS1; /* 0x0 - 0x4 */ - volatile unsigned int RXRF_BIAS2; /* 0x4 - 0x8 */ - volatile unsigned int RXRF_GAINSTAGES; /* 0x8 - 0xc */ - volatile unsigned int RXRF_AGC; /* 0xc - 0x10 */ - volatile char pad__0[0x30]; /* 0x10 - 0x40 */ - volatile unsigned int TXRF1; /* 0x40 - 0x44 */ - volatile unsigned int TXRF2; /* 0x44 - 0x48 */ - volatile unsigned int TXRF3; /* 0x48 - 0x4c */ - volatile unsigned int TXRF4; /* 0x4c - 0x50 */ - volatile unsigned int TXRF5; /* 0x50 - 0x54 */ - volatile unsigned int TXRF6; /* 0x54 - 0x58 */ - volatile unsigned int TXRF7; /* 0x58 - 0x5c */ - volatile unsigned int TXRF8; /* 0x5c - 0x60 */ - volatile unsigned int TXRF9; /* 0x60 - 0x64 */ - volatile unsigned int TXRF10; /* 0x64 - 0x68 */ - volatile unsigned int TXRF11; /* 0x68 - 0x6c */ - volatile unsigned int TXRF12; /* 0x6c - 0x70 */ - volatile char pad__1[0x10]; /* 0x70 - 0x80 */ - volatile unsigned int SYNTH1; /* 0x80 - 0x84 */ - volatile unsigned int SYNTH2; /* 0x84 - 0x88 */ - volatile unsigned int SYNTH3; /* 0x88 - 0x8c */ - volatile unsigned int SYNTH4; /* 0x8c - 0x90 */ - volatile unsigned int SYNTH5; /* 0x90 - 0x94 */ - volatile unsigned int SYNTH6; /* 0x94 - 0x98 */ - volatile unsigned int SYNTH7; /* 0x98 - 0x9c */ - volatile unsigned int SYNTH8; /* 0x9c - 0xa0 */ - volatile unsigned int SYNTH9; /* 0xa0 - 0xa4 */ - volatile unsigned int SYNTH10; /* 0xa4 - 0xa8 */ - volatile unsigned int SYNTH11; /* 0xa8 - 0xac */ - volatile unsigned int SYNTH12; /* 0xac - 0xb0 */ - volatile unsigned int SYNTH13; /* 0xb0 - 0xb4 */ - volatile unsigned int SYNTH14; /* 0xb4 - 0xb8 */ - volatile char pad__2[0x8]; /* 0xb8 - 0xc0 */ - volatile unsigned int BIAS1; /* 0xc0 - 0xc4 */ - volatile unsigned int BIAS2; /* 0xc4 - 0xc8 */ - volatile unsigned int BIAS3; /* 0xc8 - 0xcc */ - volatile unsigned int BIAS4; /* 0xcc - 0xd0 */ - volatile char pad__3[0x30]; /* 0xd0 - 0x100 */ - volatile unsigned int RXTX1; /* 0x100 - 0x104 */ - volatile unsigned int RXTX2; /* 0x104 - 0x108 */ - volatile unsigned int RXTX3; /* 0x108 - 0x10c */ - volatile char pad__4[0x34]; /* 0x10c - 0x140 */ - volatile unsigned int BB1; /* 0x140 - 0x144 */ - volatile unsigned int BB2; /* 0x144 - 0x148 */ - volatile unsigned int BB3; /* 0x148 - 0x14c */ - volatile char pad__5[0x134]; /* 0x14c - 0x280 */ - volatile unsigned int PLLCLKMODA; /* 0x280 - 0x284 */ - volatile unsigned int PLLCLKMODA2; /* 0x284 - 0x288 */ - volatile unsigned int TOP; /* 0x288 - 0x28c */ - volatile unsigned int THERM; /* 0x28c - 0x290 */ - volatile unsigned int XTAL; /* 0x290 - 0x294 */ - volatile char pad__6[0xec]; /* 0x294 - 0x380 */ - volatile unsigned int rbist_cntrl; /* 0x380 - 0x384 */ - volatile unsigned int tx_dc_offset; /* 0x384 - 0x388 */ - volatile unsigned int tx_tonegen0; /* 0x388 - 0x38c */ - volatile unsigned int tx_tonegen1; /* 0x38c - 0x390 */ - volatile unsigned int tx_lftonegen0; /* 0x390 - 0x394 */ - volatile unsigned int tx_linear_ramp_i; /* 0x394 - 0x398 */ - volatile unsigned int tx_linear_ramp_q; /* 0x398 - 0x39c */ - volatile unsigned int tx_prbs_mag; /* 0x39c - 0x3a0 */ - volatile unsigned int tx_prbs_seed_i; /* 0x3a0 - 0x3a4 */ - volatile unsigned int tx_prbs_seed_q; /* 0x3a4 - 0x3a8 */ - volatile unsigned int cmac_dc_cancel; /* 0x3a8 - 0x3ac */ - volatile unsigned int cmac_dc_offset; /* 0x3ac - 0x3b0 */ - volatile unsigned int cmac_corr; /* 0x3b0 - 0x3b4 */ - volatile unsigned int cmac_power; /* 0x3b4 - 0x3b8 */ - volatile unsigned int cmac_cross_corr; /* 0x3b8 - 0x3bc */ - volatile unsigned int cmac_i2q2; /* 0x3bc - 0x3c0 */ - volatile unsigned int cmac_power_hpf; /* 0x3c0 - 0x3c4 */ - volatile unsigned int rxdac_set1; /* 0x3c4 - 0x3c8 */ - volatile unsigned int rxdac_set2; /* 0x3c8 - 0x3cc */ - volatile unsigned int rxdac_long_shift; /* 0x3cc - 0x3d0 */ - volatile unsigned int cmac_results_i; /* 0x3d0 - 0x3d4 */ - volatile unsigned int cmac_results_q; /* 0x3d4 - 0x3d8 */ - volatile char pad__7[0x368]; /* 0x3d8 - 0x740 */ - volatile unsigned int PMU1; /* 0x740 - 0x744 */ - volatile unsigned int PMU2; /* 0x744 - 0x748 */ -} analog_intf_athr_wlan_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _ANALOG_INTF_ATHR_WLAN_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/analog_intf_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/analog_intf_reg.h deleted file mode 100644 index ab3e163e857f..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/analog_intf_reg.h +++ /dev/null @@ -1,37 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "analog_intf_athr_wlan_reg.h" - - -#ifndef BT_HEADERS - - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/apb_athr_wlan_map.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/apb_athr_wlan_map.h deleted file mode 100644 index 4eebb1f0285d..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/apb_athr_wlan_map.h +++ /dev/null @@ -1,40 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _APB_ATHR_WLAN_MAP_H_ -#define _APB_ATHR_WLAN_MAP_H_ - -#define WLAN_RTC_BASE_ADDRESS 0x00004000 -#define WLAN_VMC_BASE_ADDRESS 0x00008000 -#define WLAN_UART_BASE_ADDRESS 0x0000c000 -#define WLAN_DBG_UART_BASE_ADDRESS 0x0000d000 -#define WLAN_UMBOX_BASE_ADDRESS 0x0000e000 -#define WLAN_SI_BASE_ADDRESS 0x00010000 -#define WLAN_GPIO_BASE_ADDRESS 0x00014000 -#define WLAN_MBOX_BASE_ADDRESS 0x00018000 -#define WLAN_ANALOG_INTF_BASE_ADDRESS 0x0001c000 -#define WLAN_MAC_BASE_ADDRESS 0x00020000 -#define WLAN_RDMA_BASE_ADDRESS 0x00030100 -#define EFUSE_BASE_ADDRESS 0x00031000 - -#endif /* _APB_ATHR_WLAN_MAP_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/apb_map.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/apb_map.h deleted file mode 100644 index d267d8aeedbc..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/apb_map.h +++ /dev/null @@ -1,48 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "apb_athr_wlan_map.h" - - -#ifndef BT_HEADERS - -#define RTC_BASE_ADDRESS WLAN_RTC_BASE_ADDRESS -#define VMC_BASE_ADDRESS WLAN_VMC_BASE_ADDRESS -#define UART_BASE_ADDRESS WLAN_UART_BASE_ADDRESS -#define DBG_UART_BASE_ADDRESS WLAN_DBG_UART_BASE_ADDRESS -#define UMBOX_BASE_ADDRESS WLAN_UMBOX_BASE_ADDRESS -#define SI_BASE_ADDRESS WLAN_SI_BASE_ADDRESS -#define GPIO_BASE_ADDRESS WLAN_GPIO_BASE_ADDRESS -#define MBOX_BASE_ADDRESS WLAN_MBOX_BASE_ADDRESS -#define ANALOG_INTF_BASE_ADDRESS WLAN_ANALOG_INTF_BASE_ADDRESS -#define MAC_BASE_ADDRESS WLAN_MAC_BASE_ADDRESS -#define RDMA_BASE_ADDRESS WLAN_RDMA_BASE_ADDRESS - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/bb_lc_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/bb_lc_reg.h deleted file mode 100644 index f68edbcd761b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/bb_lc_reg.h +++ /dev/null @@ -1,7076 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2009 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _BB_LC_REG_REG_H_ -#define _BB_LC_REG_REG_H_ - - -/* macros for BB_test_controls */ -#define PHY_BB_TEST_CONTROLS_ADDRESS 0x00009800 -#define PHY_BB_TEST_CONTROLS_OFFSET 0x00009800 -#define PHY_BB_TEST_CONTROLS_CF_TSTTRIG_SEL_MSB 3 -#define PHY_BB_TEST_CONTROLS_CF_TSTTRIG_SEL_LSB 0 -#define PHY_BB_TEST_CONTROLS_CF_TSTTRIG_SEL_MASK 0x0000000f -#define PHY_BB_TEST_CONTROLS_CF_TSTTRIG_SEL_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_BB_TEST_CONTROLS_CF_TSTTRIG_SEL_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_BB_TEST_CONTROLS_CF_TSTTRIG_MSB 4 -#define PHY_BB_TEST_CONTROLS_CF_TSTTRIG_LSB 4 -#define PHY_BB_TEST_CONTROLS_CF_TSTTRIG_MASK 0x00000010 -#define PHY_BB_TEST_CONTROLS_CF_TSTTRIG_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_BB_TEST_CONTROLS_CF_TSTTRIG_SET(x) (((x) << 4) & 0x00000010) -#define PHY_BB_TEST_CONTROLS_CF_RFSHIFT_SEL_MSB 6 -#define PHY_BB_TEST_CONTROLS_CF_RFSHIFT_SEL_LSB 5 -#define PHY_BB_TEST_CONTROLS_CF_RFSHIFT_SEL_MASK 0x00000060 -#define PHY_BB_TEST_CONTROLS_CF_RFSHIFT_SEL_GET(x) (((x) & 0x00000060) >> 5) -#define PHY_BB_TEST_CONTROLS_CF_RFSHIFT_SEL_SET(x) (((x) << 5) & 0x00000060) -#define PHY_BB_TEST_CONTROLS_CARDBUS_MODE_MSB 9 -#define PHY_BB_TEST_CONTROLS_CARDBUS_MODE_LSB 8 -#define PHY_BB_TEST_CONTROLS_CARDBUS_MODE_MASK 0x00000300 -#define PHY_BB_TEST_CONTROLS_CARDBUS_MODE_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_BB_TEST_CONTROLS_CARDBUS_MODE_SET(x) (((x) << 8) & 0x00000300) -#define PHY_BB_TEST_CONTROLS_CLKOUT_IS_CLK32_MSB 10 -#define PHY_BB_TEST_CONTROLS_CLKOUT_IS_CLK32_LSB 10 -#define PHY_BB_TEST_CONTROLS_CLKOUT_IS_CLK32_MASK 0x00000400 -#define PHY_BB_TEST_CONTROLS_CLKOUT_IS_CLK32_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_BB_TEST_CONTROLS_CLKOUT_IS_CLK32_SET(x) (((x) << 10) & 0x00000400) -#define PHY_BB_TEST_CONTROLS_ENABLE_RFSILENT_BB_MSB 13 -#define PHY_BB_TEST_CONTROLS_ENABLE_RFSILENT_BB_LSB 13 -#define PHY_BB_TEST_CONTROLS_ENABLE_RFSILENT_BB_MASK 0x00002000 -#define PHY_BB_TEST_CONTROLS_ENABLE_RFSILENT_BB_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_BB_TEST_CONTROLS_ENABLE_RFSILENT_BB_SET(x) (((x) << 13) & 0x00002000) -#define PHY_BB_TEST_CONTROLS_ENABLE_MINI_OBS_MSB 15 -#define PHY_BB_TEST_CONTROLS_ENABLE_MINI_OBS_LSB 15 -#define PHY_BB_TEST_CONTROLS_ENABLE_MINI_OBS_MASK 0x00008000 -#define PHY_BB_TEST_CONTROLS_ENABLE_MINI_OBS_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_BB_TEST_CONTROLS_ENABLE_MINI_OBS_SET(x) (((x) << 15) & 0x00008000) -#define PHY_BB_TEST_CONTROLS_SLOW_CLK160_MSB 17 -#define PHY_BB_TEST_CONTROLS_SLOW_CLK160_LSB 17 -#define PHY_BB_TEST_CONTROLS_SLOW_CLK160_MASK 0x00020000 -#define PHY_BB_TEST_CONTROLS_SLOW_CLK160_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_BB_TEST_CONTROLS_SLOW_CLK160_SET(x) (((x) << 17) & 0x00020000) -#define PHY_BB_TEST_CONTROLS_AGC_OBS_SEL_3_MSB 18 -#define PHY_BB_TEST_CONTROLS_AGC_OBS_SEL_3_LSB 18 -#define PHY_BB_TEST_CONTROLS_AGC_OBS_SEL_3_MASK 0x00040000 -#define PHY_BB_TEST_CONTROLS_AGC_OBS_SEL_3_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_BB_TEST_CONTROLS_AGC_OBS_SEL_3_SET(x) (((x) << 18) & 0x00040000) -#define PHY_BB_TEST_CONTROLS_CF_BBB_OBS_SEL_MSB 22 -#define PHY_BB_TEST_CONTROLS_CF_BBB_OBS_SEL_LSB 19 -#define PHY_BB_TEST_CONTROLS_CF_BBB_OBS_SEL_MASK 0x00780000 -#define PHY_BB_TEST_CONTROLS_CF_BBB_OBS_SEL_GET(x) (((x) & 0x00780000) >> 19) -#define PHY_BB_TEST_CONTROLS_CF_BBB_OBS_SEL_SET(x) (((x) << 19) & 0x00780000) -#define PHY_BB_TEST_CONTROLS_RX_OBS_SEL_5TH_BIT_MSB 23 -#define PHY_BB_TEST_CONTROLS_RX_OBS_SEL_5TH_BIT_LSB 23 -#define PHY_BB_TEST_CONTROLS_RX_OBS_SEL_5TH_BIT_MASK 0x00800000 -#define PHY_BB_TEST_CONTROLS_RX_OBS_SEL_5TH_BIT_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_BB_TEST_CONTROLS_RX_OBS_SEL_5TH_BIT_SET(x) (((x) << 23) & 0x00800000) -#define PHY_BB_TEST_CONTROLS_AGC_OBS_SEL_4_MSB 24 -#define PHY_BB_TEST_CONTROLS_AGC_OBS_SEL_4_LSB 24 -#define PHY_BB_TEST_CONTROLS_AGC_OBS_SEL_4_MASK 0x01000000 -#define PHY_BB_TEST_CONTROLS_AGC_OBS_SEL_4_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_BB_TEST_CONTROLS_AGC_OBS_SEL_4_SET(x) (((x) << 24) & 0x01000000) -#define PHY_BB_TEST_CONTROLS_FORCE_AGC_CLEAR_MSB 28 -#define PHY_BB_TEST_CONTROLS_FORCE_AGC_CLEAR_LSB 28 -#define PHY_BB_TEST_CONTROLS_FORCE_AGC_CLEAR_MASK 0x10000000 -#define PHY_BB_TEST_CONTROLS_FORCE_AGC_CLEAR_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_BB_TEST_CONTROLS_FORCE_AGC_CLEAR_SET(x) (((x) << 28) & 0x10000000) -#define PHY_BB_TEST_CONTROLS_TSTDAC_OUT_SEL_MSB 31 -#define PHY_BB_TEST_CONTROLS_TSTDAC_OUT_SEL_LSB 30 -#define PHY_BB_TEST_CONTROLS_TSTDAC_OUT_SEL_MASK 0xc0000000 -#define PHY_BB_TEST_CONTROLS_TSTDAC_OUT_SEL_GET(x) (((x) & 0xc0000000) >> 30) -#define PHY_BB_TEST_CONTROLS_TSTDAC_OUT_SEL_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for BB_gen_controls */ -#define PHY_BB_GEN_CONTROLS_ADDRESS 0x00009804 -#define PHY_BB_GEN_CONTROLS_OFFSET 0x00009804 -#define PHY_BB_GEN_CONTROLS_TURBO_MSB 0 -#define PHY_BB_GEN_CONTROLS_TURBO_LSB 0 -#define PHY_BB_GEN_CONTROLS_TURBO_MASK 0x00000001 -#define PHY_BB_GEN_CONTROLS_TURBO_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_GEN_CONTROLS_TURBO_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_GEN_CONTROLS_CF_SHORT20_MSB 1 -#define PHY_BB_GEN_CONTROLS_CF_SHORT20_LSB 1 -#define PHY_BB_GEN_CONTROLS_CF_SHORT20_MASK 0x00000002 -#define PHY_BB_GEN_CONTROLS_CF_SHORT20_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_GEN_CONTROLS_CF_SHORT20_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_GEN_CONTROLS_DYN_20_40_MSB 2 -#define PHY_BB_GEN_CONTROLS_DYN_20_40_LSB 2 -#define PHY_BB_GEN_CONTROLS_DYN_20_40_MASK 0x00000004 -#define PHY_BB_GEN_CONTROLS_DYN_20_40_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_BB_GEN_CONTROLS_DYN_20_40_SET(x) (((x) << 2) & 0x00000004) -#define PHY_BB_GEN_CONTROLS_DYN_20_40_PRI_ONLY_MSB 3 -#define PHY_BB_GEN_CONTROLS_DYN_20_40_PRI_ONLY_LSB 3 -#define PHY_BB_GEN_CONTROLS_DYN_20_40_PRI_ONLY_MASK 0x00000008 -#define PHY_BB_GEN_CONTROLS_DYN_20_40_PRI_ONLY_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_BB_GEN_CONTROLS_DYN_20_40_PRI_ONLY_SET(x) (((x) << 3) & 0x00000008) -#define PHY_BB_GEN_CONTROLS_DYN_20_40_PRI_CHN_MSB 4 -#define PHY_BB_GEN_CONTROLS_DYN_20_40_PRI_CHN_LSB 4 -#define PHY_BB_GEN_CONTROLS_DYN_20_40_PRI_CHN_MASK 0x00000010 -#define PHY_BB_GEN_CONTROLS_DYN_20_40_PRI_CHN_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_BB_GEN_CONTROLS_DYN_20_40_PRI_CHN_SET(x) (((x) << 4) & 0x00000010) -#define PHY_BB_GEN_CONTROLS_DYN_20_40_EXT_CHN_MSB 5 -#define PHY_BB_GEN_CONTROLS_DYN_20_40_EXT_CHN_LSB 5 -#define PHY_BB_GEN_CONTROLS_DYN_20_40_EXT_CHN_MASK 0x00000020 -#define PHY_BB_GEN_CONTROLS_DYN_20_40_EXT_CHN_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_BB_GEN_CONTROLS_DYN_20_40_EXT_CHN_SET(x) (((x) << 5) & 0x00000020) -#define PHY_BB_GEN_CONTROLS_HT_ENABLE_MSB 6 -#define PHY_BB_GEN_CONTROLS_HT_ENABLE_LSB 6 -#define PHY_BB_GEN_CONTROLS_HT_ENABLE_MASK 0x00000040 -#define PHY_BB_GEN_CONTROLS_HT_ENABLE_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_BB_GEN_CONTROLS_HT_ENABLE_SET(x) (((x) << 6) & 0x00000040) -#define PHY_BB_GEN_CONTROLS_ALLOW_SHORT_GI_MSB 7 -#define PHY_BB_GEN_CONTROLS_ALLOW_SHORT_GI_LSB 7 -#define PHY_BB_GEN_CONTROLS_ALLOW_SHORT_GI_MASK 0x00000080 -#define PHY_BB_GEN_CONTROLS_ALLOW_SHORT_GI_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_BB_GEN_CONTROLS_ALLOW_SHORT_GI_SET(x) (((x) << 7) & 0x00000080) -#define PHY_BB_GEN_CONTROLS_CF_2_CHAINS_USE_WALSH_MSB 8 -#define PHY_BB_GEN_CONTROLS_CF_2_CHAINS_USE_WALSH_LSB 8 -#define PHY_BB_GEN_CONTROLS_CF_2_CHAINS_USE_WALSH_MASK 0x00000100 -#define PHY_BB_GEN_CONTROLS_CF_2_CHAINS_USE_WALSH_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_BB_GEN_CONTROLS_CF_2_CHAINS_USE_WALSH_SET(x) (((x) << 8) & 0x00000100) -#define PHY_BB_GEN_CONTROLS_CF_SINGLE_HT_LTF1_MSB 9 -#define PHY_BB_GEN_CONTROLS_CF_SINGLE_HT_LTF1_LSB 9 -#define PHY_BB_GEN_CONTROLS_CF_SINGLE_HT_LTF1_MASK 0x00000200 -#define PHY_BB_GEN_CONTROLS_CF_SINGLE_HT_LTF1_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_BB_GEN_CONTROLS_CF_SINGLE_HT_LTF1_SET(x) (((x) << 9) & 0x00000200) -#define PHY_BB_GEN_CONTROLS_GF_ENABLE_MSB 10 -#define PHY_BB_GEN_CONTROLS_GF_ENABLE_LSB 10 -#define PHY_BB_GEN_CONTROLS_GF_ENABLE_MASK 0x00000400 -#define PHY_BB_GEN_CONTROLS_GF_ENABLE_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_BB_GEN_CONTROLS_GF_ENABLE_SET(x) (((x) << 10) & 0x00000400) -#define PHY_BB_GEN_CONTROLS_BYPASS_DAC_FIFO_N_MSB 11 -#define PHY_BB_GEN_CONTROLS_BYPASS_DAC_FIFO_N_LSB 11 -#define PHY_BB_GEN_CONTROLS_BYPASS_DAC_FIFO_N_MASK 0x00000800 -#define PHY_BB_GEN_CONTROLS_BYPASS_DAC_FIFO_N_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_BB_GEN_CONTROLS_BYPASS_DAC_FIFO_N_SET(x) (((x) << 11) & 0x00000800) - -/* macros for BB_test_controls_status */ -#define PHY_BB_TEST_CONTROLS_STATUS_ADDRESS 0x00009808 -#define PHY_BB_TEST_CONTROLS_STATUS_OFFSET 0x00009808 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TSTDAC_EN_MSB 0 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TSTDAC_EN_LSB 0 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TSTDAC_EN_MASK 0x00000001 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TSTDAC_EN_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TSTDAC_EN_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_SRC_IS_TSTDAC_MSB 1 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_SRC_IS_TSTDAC_LSB 1 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_SRC_IS_TSTDAC_MASK 0x00000002 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_SRC_IS_TSTDAC_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_SRC_IS_TSTDAC_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_OBS_SEL_MSB 4 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_OBS_SEL_LSB 2 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_OBS_SEL_MASK 0x0000001c -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_OBS_SEL_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_OBS_SEL_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_OBS_MUX_SEL_MSB 6 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_OBS_MUX_SEL_LSB 5 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_OBS_MUX_SEL_MASK 0x00000060 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_OBS_MUX_SEL_GET(x) (((x) & 0x00000060) >> 5) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_OBS_MUX_SEL_SET(x) (((x) << 5) & 0x00000060) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_SRC_ALTERNATE_MSB 7 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_SRC_ALTERNATE_LSB 7 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_SRC_ALTERNATE_MASK 0x00000080 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_SRC_ALTERNATE_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TX_SRC_ALTERNATE_SET(x) (((x) << 7) & 0x00000080) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TSTADC_EN_MSB 8 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TSTADC_EN_LSB 8 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TSTADC_EN_MASK 0x00000100 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TSTADC_EN_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_TSTADC_EN_SET(x) (((x) << 8) & 0x00000100) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_RX_SRC_IS_TSTADC_MSB 9 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_RX_SRC_IS_TSTADC_LSB 9 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_RX_SRC_IS_TSTADC_MASK 0x00000200 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_RX_SRC_IS_TSTADC_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_RX_SRC_IS_TSTADC_SET(x) (((x) << 9) & 0x00000200) -#define PHY_BB_TEST_CONTROLS_STATUS_RX_OBS_SEL_MSB 13 -#define PHY_BB_TEST_CONTROLS_STATUS_RX_OBS_SEL_LSB 10 -#define PHY_BB_TEST_CONTROLS_STATUS_RX_OBS_SEL_MASK 0x00003c00 -#define PHY_BB_TEST_CONTROLS_STATUS_RX_OBS_SEL_GET(x) (((x) & 0x00003c00) >> 10) -#define PHY_BB_TEST_CONTROLS_STATUS_RX_OBS_SEL_SET(x) (((x) << 10) & 0x00003c00) -#define PHY_BB_TEST_CONTROLS_STATUS_DISABLE_A2_WARM_RESET_MSB 14 -#define PHY_BB_TEST_CONTROLS_STATUS_DISABLE_A2_WARM_RESET_LSB 14 -#define PHY_BB_TEST_CONTROLS_STATUS_DISABLE_A2_WARM_RESET_MASK 0x00004000 -#define PHY_BB_TEST_CONTROLS_STATUS_DISABLE_A2_WARM_RESET_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_BB_TEST_CONTROLS_STATUS_DISABLE_A2_WARM_RESET_SET(x) (((x) << 14) & 0x00004000) -#define PHY_BB_TEST_CONTROLS_STATUS_RESET_A2_MSB 15 -#define PHY_BB_TEST_CONTROLS_STATUS_RESET_A2_LSB 15 -#define PHY_BB_TEST_CONTROLS_STATUS_RESET_A2_MASK 0x00008000 -#define PHY_BB_TEST_CONTROLS_STATUS_RESET_A2_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_BB_TEST_CONTROLS_STATUS_RESET_A2_SET(x) (((x) << 15) & 0x00008000) -#define PHY_BB_TEST_CONTROLS_STATUS_AGC_OBS_SEL_MSB 18 -#define PHY_BB_TEST_CONTROLS_STATUS_AGC_OBS_SEL_LSB 16 -#define PHY_BB_TEST_CONTROLS_STATUS_AGC_OBS_SEL_MASK 0x00070000 -#define PHY_BB_TEST_CONTROLS_STATUS_AGC_OBS_SEL_GET(x) (((x) & 0x00070000) >> 16) -#define PHY_BB_TEST_CONTROLS_STATUS_AGC_OBS_SEL_SET(x) (((x) << 16) & 0x00070000) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_ENABLE_FFT_DUMP_MSB 19 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_ENABLE_FFT_DUMP_LSB 19 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_ENABLE_FFT_DUMP_MASK 0x00080000 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_ENABLE_FFT_DUMP_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_ENABLE_FFT_DUMP_SET(x) (((x) << 19) & 0x00080000) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_IN_MSB 23 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_IN_LSB 23 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_IN_MASK 0x00800000 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_IN_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_IN_SET(x) (((x) << 23) & 0x00800000) -#define PHY_BB_TEST_CONTROLS_STATUS_DISABLE_AGC_TO_A2_MSB 27 -#define PHY_BB_TEST_CONTROLS_STATUS_DISABLE_AGC_TO_A2_LSB 27 -#define PHY_BB_TEST_CONTROLS_STATUS_DISABLE_AGC_TO_A2_MASK 0x08000000 -#define PHY_BB_TEST_CONTROLS_STATUS_DISABLE_AGC_TO_A2_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_BB_TEST_CONTROLS_STATUS_DISABLE_AGC_TO_A2_SET(x) (((x) << 27) & 0x08000000) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_EN_MSB 28 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_EN_LSB 28 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_EN_MASK 0x10000000 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_EN_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_EN_SET(x) (((x) << 28) & 0x10000000) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_SEL_MSB 30 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_SEL_LSB 29 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_SEL_MASK 0x60000000 -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_SEL_GET(x) (((x) & 0x60000000) >> 29) -#define PHY_BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_SEL_SET(x) (((x) << 29) & 0x60000000) - -/* macros for BB_timing_controls_1 */ -#define PHY_BB_TIMING_CONTROLS_1_ADDRESS 0x0000980c -#define PHY_BB_TIMING_CONTROLS_1_OFFSET 0x0000980c -#define PHY_BB_TIMING_CONTROLS_1_STE_THR_MSB 6 -#define PHY_BB_TIMING_CONTROLS_1_STE_THR_LSB 0 -#define PHY_BB_TIMING_CONTROLS_1_STE_THR_MASK 0x0000007f -#define PHY_BB_TIMING_CONTROLS_1_STE_THR_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_BB_TIMING_CONTROLS_1_STE_THR_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_BB_TIMING_CONTROLS_1_STE_TO_LONG1_MSB 12 -#define PHY_BB_TIMING_CONTROLS_1_STE_TO_LONG1_LSB 7 -#define PHY_BB_TIMING_CONTROLS_1_STE_TO_LONG1_MASK 0x00001f80 -#define PHY_BB_TIMING_CONTROLS_1_STE_TO_LONG1_GET(x) (((x) & 0x00001f80) >> 7) -#define PHY_BB_TIMING_CONTROLS_1_STE_TO_LONG1_SET(x) (((x) << 7) & 0x00001f80) -#define PHY_BB_TIMING_CONTROLS_1_TIMING_BACKOFF_MSB 16 -#define PHY_BB_TIMING_CONTROLS_1_TIMING_BACKOFF_LSB 13 -#define PHY_BB_TIMING_CONTROLS_1_TIMING_BACKOFF_MASK 0x0001e000 -#define PHY_BB_TIMING_CONTROLS_1_TIMING_BACKOFF_GET(x) (((x) & 0x0001e000) >> 13) -#define PHY_BB_TIMING_CONTROLS_1_TIMING_BACKOFF_SET(x) (((x) << 13) & 0x0001e000) -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_HT_FINE_PPM_MSB 17 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_HT_FINE_PPM_LSB 17 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_HT_FINE_PPM_MASK 0x00020000 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_HT_FINE_PPM_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_HT_FINE_PPM_SET(x) (((x) << 17) & 0x00020000) -#define PHY_BB_TIMING_CONTROLS_1_HT_FINE_PPM_STREAM_MSB 19 -#define PHY_BB_TIMING_CONTROLS_1_HT_FINE_PPM_STREAM_LSB 18 -#define PHY_BB_TIMING_CONTROLS_1_HT_FINE_PPM_STREAM_MASK 0x000c0000 -#define PHY_BB_TIMING_CONTROLS_1_HT_FINE_PPM_STREAM_GET(x) (((x) & 0x000c0000) >> 18) -#define PHY_BB_TIMING_CONTROLS_1_HT_FINE_PPM_STREAM_SET(x) (((x) << 18) & 0x000c0000) -#define PHY_BB_TIMING_CONTROLS_1_HT_FINE_PPM_QAM_MSB 21 -#define PHY_BB_TIMING_CONTROLS_1_HT_FINE_PPM_QAM_LSB 20 -#define PHY_BB_TIMING_CONTROLS_1_HT_FINE_PPM_QAM_MASK 0x00300000 -#define PHY_BB_TIMING_CONTROLS_1_HT_FINE_PPM_QAM_GET(x) (((x) & 0x00300000) >> 20) -#define PHY_BB_TIMING_CONTROLS_1_HT_FINE_PPM_QAM_SET(x) (((x) << 20) & 0x00300000) -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_LONG_CHANFIL_MSB 22 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_LONG_CHANFIL_LSB 22 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_LONG_CHANFIL_MASK 0x00400000 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_LONG_CHANFIL_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_LONG_CHANFIL_SET(x) (((x) << 22) & 0x00400000) -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_RX_STBC_MSB 23 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_RX_STBC_LSB 23 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_RX_STBC_MASK 0x00800000 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_RX_STBC_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_RX_STBC_SET(x) (((x) << 23) & 0x00800000) -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_CHANNEL_FILTER_MSB 24 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_CHANNEL_FILTER_LSB 24 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_CHANNEL_FILTER_MASK 0x01000000 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_CHANNEL_FILTER_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_CHANNEL_FILTER_SET(x) (((x) << 24) & 0x01000000) -#define PHY_BB_TIMING_CONTROLS_1_FALSE_ALARM_MSB 26 -#define PHY_BB_TIMING_CONTROLS_1_FALSE_ALARM_LSB 25 -#define PHY_BB_TIMING_CONTROLS_1_FALSE_ALARM_MASK 0x06000000 -#define PHY_BB_TIMING_CONTROLS_1_FALSE_ALARM_GET(x) (((x) & 0x06000000) >> 25) -#define PHY_BB_TIMING_CONTROLS_1_FALSE_ALARM_SET(x) (((x) << 25) & 0x06000000) -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_LONG_RESCALE_MSB 27 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_LONG_RESCALE_LSB 27 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_LONG_RESCALE_MASK 0x08000000 -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_LONG_RESCALE_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_BB_TIMING_CONTROLS_1_ENABLE_LONG_RESCALE_SET(x) (((x) << 27) & 0x08000000) -#define PHY_BB_TIMING_CONTROLS_1_TIMING_LEAK_ENABLE_MSB 28 -#define PHY_BB_TIMING_CONTROLS_1_TIMING_LEAK_ENABLE_LSB 28 -#define PHY_BB_TIMING_CONTROLS_1_TIMING_LEAK_ENABLE_MASK 0x10000000 -#define PHY_BB_TIMING_CONTROLS_1_TIMING_LEAK_ENABLE_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_BB_TIMING_CONTROLS_1_TIMING_LEAK_ENABLE_SET(x) (((x) << 28) & 0x10000000) -#define PHY_BB_TIMING_CONTROLS_1_COARSE_PPM_SELECT_MSB 30 -#define PHY_BB_TIMING_CONTROLS_1_COARSE_PPM_SELECT_LSB 29 -#define PHY_BB_TIMING_CONTROLS_1_COARSE_PPM_SELECT_MASK 0x60000000 -#define PHY_BB_TIMING_CONTROLS_1_COARSE_PPM_SELECT_GET(x) (((x) & 0x60000000) >> 29) -#define PHY_BB_TIMING_CONTROLS_1_COARSE_PPM_SELECT_SET(x) (((x) << 29) & 0x60000000) -#define PHY_BB_TIMING_CONTROLS_1_FFT_SCALING_MSB 31 -#define PHY_BB_TIMING_CONTROLS_1_FFT_SCALING_LSB 31 -#define PHY_BB_TIMING_CONTROLS_1_FFT_SCALING_MASK 0x80000000 -#define PHY_BB_TIMING_CONTROLS_1_FFT_SCALING_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_TIMING_CONTROLS_1_FFT_SCALING_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_timing_controls_2 */ -#define PHY_BB_TIMING_CONTROLS_2_ADDRESS 0x00009810 -#define PHY_BB_TIMING_CONTROLS_2_OFFSET 0x00009810 -#define PHY_BB_TIMING_CONTROLS_2_FORCED_DELTA_PHI_SYMBOL_MSB 11 -#define PHY_BB_TIMING_CONTROLS_2_FORCED_DELTA_PHI_SYMBOL_LSB 0 -#define PHY_BB_TIMING_CONTROLS_2_FORCED_DELTA_PHI_SYMBOL_MASK 0x00000fff -#define PHY_BB_TIMING_CONTROLS_2_FORCED_DELTA_PHI_SYMBOL_GET(x) (((x) & 0x00000fff) >> 0) -#define PHY_BB_TIMING_CONTROLS_2_FORCED_DELTA_PHI_SYMBOL_SET(x) (((x) << 0) & 0x00000fff) -#define PHY_BB_TIMING_CONTROLS_2_FORCE_DELTA_PHI_SYMBOL_MSB 12 -#define PHY_BB_TIMING_CONTROLS_2_FORCE_DELTA_PHI_SYMBOL_LSB 12 -#define PHY_BB_TIMING_CONTROLS_2_FORCE_DELTA_PHI_SYMBOL_MASK 0x00001000 -#define PHY_BB_TIMING_CONTROLS_2_FORCE_DELTA_PHI_SYMBOL_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_BB_TIMING_CONTROLS_2_FORCE_DELTA_PHI_SYMBOL_SET(x) (((x) << 12) & 0x00001000) -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_MAGNITUDE_TRACK_MSB 13 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_MAGNITUDE_TRACK_LSB 13 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_MAGNITUDE_TRACK_MASK 0x00002000 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_MAGNITUDE_TRACK_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_MAGNITUDE_TRACK_SET(x) (((x) << 13) & 0x00002000) -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_SLOPE_FILTER_MSB 14 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_SLOPE_FILTER_LSB 14 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_SLOPE_FILTER_MASK 0x00004000 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_SLOPE_FILTER_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_SLOPE_FILTER_SET(x) (((x) << 14) & 0x00004000) -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_OFFSET_FILTER_MSB 15 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_OFFSET_FILTER_LSB 15 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_OFFSET_FILTER_MASK 0x00008000 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_OFFSET_FILTER_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_OFFSET_FILTER_SET(x) (((x) << 15) & 0x00008000) -#define PHY_BB_TIMING_CONTROLS_2_DC_OFF_DELTAF_THRES_MSB 22 -#define PHY_BB_TIMING_CONTROLS_2_DC_OFF_DELTAF_THRES_LSB 16 -#define PHY_BB_TIMING_CONTROLS_2_DC_OFF_DELTAF_THRES_MASK 0x007f0000 -#define PHY_BB_TIMING_CONTROLS_2_DC_OFF_DELTAF_THRES_GET(x) (((x) & 0x007f0000) >> 16) -#define PHY_BB_TIMING_CONTROLS_2_DC_OFF_DELTAF_THRES_SET(x) (((x) << 16) & 0x007f0000) -#define PHY_BB_TIMING_CONTROLS_2_DC_OFF_TIM_CONST_MSB 26 -#define PHY_BB_TIMING_CONTROLS_2_DC_OFF_TIM_CONST_LSB 24 -#define PHY_BB_TIMING_CONTROLS_2_DC_OFF_TIM_CONST_MASK 0x07000000 -#define PHY_BB_TIMING_CONTROLS_2_DC_OFF_TIM_CONST_GET(x) (((x) & 0x07000000) >> 24) -#define PHY_BB_TIMING_CONTROLS_2_DC_OFF_TIM_CONST_SET(x) (((x) << 24) & 0x07000000) -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_MSB 27 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_LSB 27 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_MASK 0x08000000 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_SET(x) (((x) << 27) & 0x08000000) -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_TRACK_MSB 28 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_TRACK_LSB 28 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_TRACK_MASK 0x10000000 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_TRACK_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_TRACK_SET(x) (((x) << 28) & 0x10000000) -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_WEIGHTING_MSB 29 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_WEIGHTING_LSB 29 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_WEIGHTING_MASK 0x20000000 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_WEIGHTING_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_WEIGHTING_SET(x) (((x) << 29) & 0x20000000) -#define PHY_BB_TIMING_CONTROLS_2_TRACEBACK128_MSB 30 -#define PHY_BB_TIMING_CONTROLS_2_TRACEBACK128_LSB 30 -#define PHY_BB_TIMING_CONTROLS_2_TRACEBACK128_MASK 0x40000000 -#define PHY_BB_TIMING_CONTROLS_2_TRACEBACK128_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_TIMING_CONTROLS_2_TRACEBACK128_SET(x) (((x) << 30) & 0x40000000) -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_HT_FINE_TIMING_MSB 31 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_HT_FINE_TIMING_LSB 31 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_HT_FINE_TIMING_MASK 0x80000000 -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_HT_FINE_TIMING_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_TIMING_CONTROLS_2_ENABLE_HT_FINE_TIMING_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_timing_controls_3 */ -#define PHY_BB_TIMING_CONTROLS_3_ADDRESS 0x00009814 -#define PHY_BB_TIMING_CONTROLS_3_OFFSET 0x00009814 -#define PHY_BB_TIMING_CONTROLS_3_PPM_RESCUE_INTERVAL_MSB 7 -#define PHY_BB_TIMING_CONTROLS_3_PPM_RESCUE_INTERVAL_LSB 0 -#define PHY_BB_TIMING_CONTROLS_3_PPM_RESCUE_INTERVAL_MASK 0x000000ff -#define PHY_BB_TIMING_CONTROLS_3_PPM_RESCUE_INTERVAL_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_TIMING_CONTROLS_3_PPM_RESCUE_INTERVAL_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_PPM_RESCUE_MSB 8 -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_PPM_RESCUE_LSB 8 -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_PPM_RESCUE_MASK 0x00000100 -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_PPM_RESCUE_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_PPM_RESCUE_SET(x) (((x) << 8) & 0x00000100) -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_FINE_PPM_MSB 9 -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_FINE_PPM_LSB 9 -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_FINE_PPM_MASK 0x00000200 -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_FINE_PPM_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_FINE_PPM_SET(x) (((x) << 9) & 0x00000200) -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_FINE_INTERP_MSB 10 -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_FINE_INTERP_LSB 10 -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_FINE_INTERP_MASK 0x00000400 -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_FINE_INTERP_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_FINE_INTERP_SET(x) (((x) << 10) & 0x00000400) -#define PHY_BB_TIMING_CONTROLS_3_CONTINUOUS_PPM_RESCUE_MSB 11 -#define PHY_BB_TIMING_CONTROLS_3_CONTINUOUS_PPM_RESCUE_LSB 11 -#define PHY_BB_TIMING_CONTROLS_3_CONTINUOUS_PPM_RESCUE_MASK 0x00000800 -#define PHY_BB_TIMING_CONTROLS_3_CONTINUOUS_PPM_RESCUE_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_BB_TIMING_CONTROLS_3_CONTINUOUS_PPM_RESCUE_SET(x) (((x) << 11) & 0x00000800) -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_DF_CHANEST_MSB 12 -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_DF_CHANEST_LSB 12 -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_DF_CHANEST_MASK 0x00001000 -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_DF_CHANEST_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_BB_TIMING_CONTROLS_3_ENABLE_DF_CHANEST_SET(x) (((x) << 12) & 0x00001000) -#define PHY_BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_EXP_MSB 16 -#define PHY_BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_EXP_LSB 13 -#define PHY_BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_EXP_MASK 0x0001e000 -#define PHY_BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_EXP_GET(x) (((x) & 0x0001e000) >> 13) -#define PHY_BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_EXP_SET(x) (((x) << 13) & 0x0001e000) -#define PHY_BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_MAN_MSB 31 -#define PHY_BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_MAN_LSB 17 -#define PHY_BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_MAN_MASK 0xfffe0000 -#define PHY_BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_MAN_GET(x) (((x) & 0xfffe0000) >> 17) -#define PHY_BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_MAN_SET(x) (((x) << 17) & 0xfffe0000) - -/* macros for BB_D2_chip_id */ -#define PHY_BB_D2_CHIP_ID_ADDRESS 0x00009818 -#define PHY_BB_D2_CHIP_ID_OFFSET 0x00009818 -#define PHY_BB_D2_CHIP_ID_OLD_ID_MSB 7 -#define PHY_BB_D2_CHIP_ID_OLD_ID_LSB 0 -#define PHY_BB_D2_CHIP_ID_OLD_ID_MASK 0x000000ff -#define PHY_BB_D2_CHIP_ID_OLD_ID_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_D2_CHIP_ID_ID_MSB 31 -#define PHY_BB_D2_CHIP_ID_ID_LSB 8 -#define PHY_BB_D2_CHIP_ID_ID_MASK 0xffffff00 -#define PHY_BB_D2_CHIP_ID_ID_GET(x) (((x) & 0xffffff00) >> 8) - -/* macros for BB_active */ -#define PHY_BB_ACTIVE_ADDRESS 0x0000981c -#define PHY_BB_ACTIVE_OFFSET 0x0000981c -#define PHY_BB_ACTIVE_CF_ACTIVE_MSB 0 -#define PHY_BB_ACTIVE_CF_ACTIVE_LSB 0 -#define PHY_BB_ACTIVE_CF_ACTIVE_MASK 0x00000001 -#define PHY_BB_ACTIVE_CF_ACTIVE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_ACTIVE_CF_ACTIVE_SET(x) (((x) << 0) & 0x00000001) - -/* macros for BB_tx_timing_1 */ -#define PHY_BB_TX_TIMING_1_ADDRESS 0x00009820 -#define PHY_BB_TX_TIMING_1_OFFSET 0x00009820 -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_ADC_OFF_MSB 7 -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_ADC_OFF_LSB 0 -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_ADC_OFF_MASK 0x000000ff -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_ADC_OFF_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_ADC_OFF_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_A2_RX_OFF_MSB 15 -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_A2_RX_OFF_LSB 8 -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_A2_RX_OFF_MASK 0x0000ff00 -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_A2_RX_OFF_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_A2_RX_OFF_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_DAC_ON_MSB 23 -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_DAC_ON_LSB 16 -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_DAC_ON_MASK 0x00ff0000 -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_DAC_ON_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_DAC_ON_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_A2_TX_ON_MSB 31 -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_A2_TX_ON_LSB 24 -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_A2_TX_ON_MASK 0xff000000 -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_A2_TX_ON_GET(x) (((x) & 0xff000000) >> 24) -#define PHY_BB_TX_TIMING_1_TX_FRAME_TO_A2_TX_ON_SET(x) (((x) << 24) & 0xff000000) - -/* macros for BB_tx_timing_2 */ -#define PHY_BB_TX_TIMING_2_ADDRESS 0x00009824 -#define PHY_BB_TX_TIMING_2_OFFSET 0x00009824 -#define PHY_BB_TX_TIMING_2_TX_FRAME_TO_TX_D_START_MSB 7 -#define PHY_BB_TX_TIMING_2_TX_FRAME_TO_TX_D_START_LSB 0 -#define PHY_BB_TX_TIMING_2_TX_FRAME_TO_TX_D_START_MASK 0x000000ff -#define PHY_BB_TX_TIMING_2_TX_FRAME_TO_TX_D_START_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_TX_TIMING_2_TX_FRAME_TO_TX_D_START_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_TX_TIMING_2_TX_FRAME_TO_PA_ON_MSB 15 -#define PHY_BB_TX_TIMING_2_TX_FRAME_TO_PA_ON_LSB 8 -#define PHY_BB_TX_TIMING_2_TX_FRAME_TO_PA_ON_MASK 0x0000ff00 -#define PHY_BB_TX_TIMING_2_TX_FRAME_TO_PA_ON_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_TX_TIMING_2_TX_FRAME_TO_PA_ON_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_TX_TIMING_2_TX_END_TO_PA_OFF_MSB 23 -#define PHY_BB_TX_TIMING_2_TX_END_TO_PA_OFF_LSB 16 -#define PHY_BB_TX_TIMING_2_TX_END_TO_PA_OFF_MASK 0x00ff0000 -#define PHY_BB_TX_TIMING_2_TX_END_TO_PA_OFF_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_TX_TIMING_2_TX_END_TO_PA_OFF_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_BB_TX_TIMING_2_TX_END_TO_A2_TX_OFF_MSB 31 -#define PHY_BB_TX_TIMING_2_TX_END_TO_A2_TX_OFF_LSB 24 -#define PHY_BB_TX_TIMING_2_TX_END_TO_A2_TX_OFF_MASK 0xff000000 -#define PHY_BB_TX_TIMING_2_TX_END_TO_A2_TX_OFF_GET(x) (((x) & 0xff000000) >> 24) -#define PHY_BB_TX_TIMING_2_TX_END_TO_A2_TX_OFF_SET(x) (((x) << 24) & 0xff000000) - -/* macros for BB_tx_timing_3 */ -#define PHY_BB_TX_TIMING_3_ADDRESS 0x00009828 -#define PHY_BB_TX_TIMING_3_OFFSET 0x00009828 -#define PHY_BB_TX_TIMING_3_TX_END_TO_DAC_OFF_MSB 7 -#define PHY_BB_TX_TIMING_3_TX_END_TO_DAC_OFF_LSB 0 -#define PHY_BB_TX_TIMING_3_TX_END_TO_DAC_OFF_MASK 0x000000ff -#define PHY_BB_TX_TIMING_3_TX_END_TO_DAC_OFF_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_TX_TIMING_3_TX_END_TO_DAC_OFF_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_TX_TIMING_3_TX_FRAME_TO_THERM_CHAIN_ON_MSB 15 -#define PHY_BB_TX_TIMING_3_TX_FRAME_TO_THERM_CHAIN_ON_LSB 8 -#define PHY_BB_TX_TIMING_3_TX_FRAME_TO_THERM_CHAIN_ON_MASK 0x0000ff00 -#define PHY_BB_TX_TIMING_3_TX_FRAME_TO_THERM_CHAIN_ON_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_TX_TIMING_3_TX_FRAME_TO_THERM_CHAIN_ON_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_TX_TIMING_3_TX_END_TO_A2_RX_ON_MSB 23 -#define PHY_BB_TX_TIMING_3_TX_END_TO_A2_RX_ON_LSB 16 -#define PHY_BB_TX_TIMING_3_TX_END_TO_A2_RX_ON_MASK 0x00ff0000 -#define PHY_BB_TX_TIMING_3_TX_END_TO_A2_RX_ON_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_TX_TIMING_3_TX_END_TO_A2_RX_ON_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_BB_TX_TIMING_3_TX_END_TO_ADC_ON_MSB 31 -#define PHY_BB_TX_TIMING_3_TX_END_TO_ADC_ON_LSB 24 -#define PHY_BB_TX_TIMING_3_TX_END_TO_ADC_ON_MASK 0xff000000 -#define PHY_BB_TX_TIMING_3_TX_END_TO_ADC_ON_GET(x) (((x) & 0xff000000) >> 24) -#define PHY_BB_TX_TIMING_3_TX_END_TO_ADC_ON_SET(x) (((x) << 24) & 0xff000000) - -/* macros for BB_addac_parallel_control */ -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ADDRESS 0x0000982c -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFFSET 0x0000982c -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_DACLPMODE_MSB 12 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_DACLPMODE_LSB 12 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_DACLPMODE_MASK 0x00001000 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_DACLPMODE_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_DACLPMODE_SET(x) (((x) << 12) & 0x00001000) -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_PWDDAC_MSB 13 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_PWDDAC_LSB 13 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_PWDDAC_MASK 0x00002000 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_PWDDAC_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_PWDDAC_SET(x) (((x) << 13) & 0x00002000) -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_PWDADC_MSB 15 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_PWDADC_LSB 15 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_PWDADC_MASK 0x00008000 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_PWDADC_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_BB_ADDAC_PARALLEL_CONTROL_OFF_PWDADC_SET(x) (((x) << 15) & 0x00008000) -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_DACLPMODE_MSB 28 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_DACLPMODE_LSB 28 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_DACLPMODE_MASK 0x10000000 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_DACLPMODE_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_DACLPMODE_SET(x) (((x) << 28) & 0x10000000) -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_PWDDAC_MSB 29 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_PWDDAC_LSB 29 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_PWDDAC_MASK 0x20000000 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_PWDDAC_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_PWDDAC_SET(x) (((x) << 29) & 0x20000000) -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_PWDADC_MSB 31 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_PWDADC_LSB 31 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_PWDADC_MASK 0x80000000 -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_PWDADC_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_ADDAC_PARALLEL_CONTROL_ON_PWDADC_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_xpa_timing_control */ -#define PHY_BB_XPA_TIMING_CONTROL_ADDRESS 0x00009834 -#define PHY_BB_XPA_TIMING_CONTROL_OFFSET 0x00009834 -#define PHY_BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAA_ON_MSB 7 -#define PHY_BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAA_ON_LSB 0 -#define PHY_BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAA_ON_MASK 0x000000ff -#define PHY_BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAA_ON_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAA_ON_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAB_ON_MSB 15 -#define PHY_BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAB_ON_LSB 8 -#define PHY_BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAB_ON_MASK 0x0000ff00 -#define PHY_BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAB_ON_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAB_ON_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_XPA_TIMING_CONTROL_TX_END_TO_XPAA_OFF_MSB 23 -#define PHY_BB_XPA_TIMING_CONTROL_TX_END_TO_XPAA_OFF_LSB 16 -#define PHY_BB_XPA_TIMING_CONTROL_TX_END_TO_XPAA_OFF_MASK 0x00ff0000 -#define PHY_BB_XPA_TIMING_CONTROL_TX_END_TO_XPAA_OFF_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_XPA_TIMING_CONTROL_TX_END_TO_XPAA_OFF_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_BB_XPA_TIMING_CONTROL_TX_END_TO_XPAB_OFF_MSB 31 -#define PHY_BB_XPA_TIMING_CONTROL_TX_END_TO_XPAB_OFF_LSB 24 -#define PHY_BB_XPA_TIMING_CONTROL_TX_END_TO_XPAB_OFF_MASK 0xff000000 -#define PHY_BB_XPA_TIMING_CONTROL_TX_END_TO_XPAB_OFF_GET(x) (((x) & 0xff000000) >> 24) -#define PHY_BB_XPA_TIMING_CONTROL_TX_END_TO_XPAB_OFF_SET(x) (((x) << 24) & 0xff000000) - -/* macros for BB_misc_pa_control */ -#define PHY_BB_MISC_PA_CONTROL_ADDRESS 0x00009838 -#define PHY_BB_MISC_PA_CONTROL_OFFSET 0x00009838 -#define PHY_BB_MISC_PA_CONTROL_XPAA_ACTIVE_HIGH_MSB 0 -#define PHY_BB_MISC_PA_CONTROL_XPAA_ACTIVE_HIGH_LSB 0 -#define PHY_BB_MISC_PA_CONTROL_XPAA_ACTIVE_HIGH_MASK 0x00000001 -#define PHY_BB_MISC_PA_CONTROL_XPAA_ACTIVE_HIGH_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_MISC_PA_CONTROL_XPAA_ACTIVE_HIGH_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_MISC_PA_CONTROL_XPAB_ACTIVE_HIGH_MSB 1 -#define PHY_BB_MISC_PA_CONTROL_XPAB_ACTIVE_HIGH_LSB 1 -#define PHY_BB_MISC_PA_CONTROL_XPAB_ACTIVE_HIGH_MASK 0x00000002 -#define PHY_BB_MISC_PA_CONTROL_XPAB_ACTIVE_HIGH_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_MISC_PA_CONTROL_XPAB_ACTIVE_HIGH_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_MISC_PA_CONTROL_ENABLE_XPAA_MSB 2 -#define PHY_BB_MISC_PA_CONTROL_ENABLE_XPAA_LSB 2 -#define PHY_BB_MISC_PA_CONTROL_ENABLE_XPAA_MASK 0x00000004 -#define PHY_BB_MISC_PA_CONTROL_ENABLE_XPAA_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_BB_MISC_PA_CONTROL_ENABLE_XPAA_SET(x) (((x) << 2) & 0x00000004) -#define PHY_BB_MISC_PA_CONTROL_ENABLE_XPAB_MSB 3 -#define PHY_BB_MISC_PA_CONTROL_ENABLE_XPAB_LSB 3 -#define PHY_BB_MISC_PA_CONTROL_ENABLE_XPAB_MASK 0x00000008 -#define PHY_BB_MISC_PA_CONTROL_ENABLE_XPAB_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_BB_MISC_PA_CONTROL_ENABLE_XPAB_SET(x) (((x) << 3) & 0x00000008) - -/* macros for BB_tstdac_constant */ -#define PHY_BB_TSTDAC_CONSTANT_ADDRESS 0x0000983c -#define PHY_BB_TSTDAC_CONSTANT_OFFSET 0x0000983c -#define PHY_BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_I_MSB 10 -#define PHY_BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_I_LSB 0 -#define PHY_BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_I_MASK 0x000007ff -#define PHY_BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_I_GET(x) (((x) & 0x000007ff) >> 0) -#define PHY_BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_I_SET(x) (((x) << 0) & 0x000007ff) -#define PHY_BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_Q_MSB 21 -#define PHY_BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_Q_LSB 11 -#define PHY_BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_Q_MASK 0x003ff800 -#define PHY_BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_Q_GET(x) (((x) & 0x003ff800) >> 11) -#define PHY_BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_Q_SET(x) (((x) << 11) & 0x003ff800) - -/* macros for BB_find_signal_low */ -#define PHY_BB_FIND_SIGNAL_LOW_ADDRESS 0x00009840 -#define PHY_BB_FIND_SIGNAL_LOW_OFFSET 0x00009840 -#define PHY_BB_FIND_SIGNAL_LOW_RELSTEP_LOW_MSB 5 -#define PHY_BB_FIND_SIGNAL_LOW_RELSTEP_LOW_LSB 0 -#define PHY_BB_FIND_SIGNAL_LOW_RELSTEP_LOW_MASK 0x0000003f -#define PHY_BB_FIND_SIGNAL_LOW_RELSTEP_LOW_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_FIND_SIGNAL_LOW_RELSTEP_LOW_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_FIND_SIGNAL_LOW_FIRSTEP_LOW_MSB 11 -#define PHY_BB_FIND_SIGNAL_LOW_FIRSTEP_LOW_LSB 6 -#define PHY_BB_FIND_SIGNAL_LOW_FIRSTEP_LOW_MASK 0x00000fc0 -#define PHY_BB_FIND_SIGNAL_LOW_FIRSTEP_LOW_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_FIND_SIGNAL_LOW_FIRSTEP_LOW_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_FIND_SIGNAL_LOW_FIRPWR_LOW_MSB 19 -#define PHY_BB_FIND_SIGNAL_LOW_FIRPWR_LOW_LSB 12 -#define PHY_BB_FIND_SIGNAL_LOW_FIRPWR_LOW_MASK 0x000ff000 -#define PHY_BB_FIND_SIGNAL_LOW_FIRPWR_LOW_GET(x) (((x) & 0x000ff000) >> 12) -#define PHY_BB_FIND_SIGNAL_LOW_FIRPWR_LOW_SET(x) (((x) << 12) & 0x000ff000) -#define PHY_BB_FIND_SIGNAL_LOW_YCOK_MAX_LOW_MSB 23 -#define PHY_BB_FIND_SIGNAL_LOW_YCOK_MAX_LOW_LSB 20 -#define PHY_BB_FIND_SIGNAL_LOW_YCOK_MAX_LOW_MASK 0x00f00000 -#define PHY_BB_FIND_SIGNAL_LOW_YCOK_MAX_LOW_GET(x) (((x) & 0x00f00000) >> 20) -#define PHY_BB_FIND_SIGNAL_LOW_YCOK_MAX_LOW_SET(x) (((x) << 20) & 0x00f00000) -#define PHY_BB_FIND_SIGNAL_LOW_LONG_SC_THRESH_MSB 30 -#define PHY_BB_FIND_SIGNAL_LOW_LONG_SC_THRESH_LSB 24 -#define PHY_BB_FIND_SIGNAL_LOW_LONG_SC_THRESH_MASK 0x7f000000 -#define PHY_BB_FIND_SIGNAL_LOW_LONG_SC_THRESH_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_BB_FIND_SIGNAL_LOW_LONG_SC_THRESH_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for BB_settling_time */ -#define PHY_BB_SETTLING_TIME_ADDRESS 0x00009844 -#define PHY_BB_SETTLING_TIME_OFFSET 0x00009844 -#define PHY_BB_SETTLING_TIME_AGC_SETTLING_MSB 6 -#define PHY_BB_SETTLING_TIME_AGC_SETTLING_LSB 0 -#define PHY_BB_SETTLING_TIME_AGC_SETTLING_MASK 0x0000007f -#define PHY_BB_SETTLING_TIME_AGC_SETTLING_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_BB_SETTLING_TIME_AGC_SETTLING_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_BB_SETTLING_TIME_SWITCH_SETTLING_MSB 13 -#define PHY_BB_SETTLING_TIME_SWITCH_SETTLING_LSB 7 -#define PHY_BB_SETTLING_TIME_SWITCH_SETTLING_MASK 0x00003f80 -#define PHY_BB_SETTLING_TIME_SWITCH_SETTLING_GET(x) (((x) & 0x00003f80) >> 7) -#define PHY_BB_SETTLING_TIME_SWITCH_SETTLING_SET(x) (((x) << 7) & 0x00003f80) -#define PHY_BB_SETTLING_TIME_ADCSAT_THRL_MSB 19 -#define PHY_BB_SETTLING_TIME_ADCSAT_THRL_LSB 14 -#define PHY_BB_SETTLING_TIME_ADCSAT_THRL_MASK 0x000fc000 -#define PHY_BB_SETTLING_TIME_ADCSAT_THRL_GET(x) (((x) & 0x000fc000) >> 14) -#define PHY_BB_SETTLING_TIME_ADCSAT_THRL_SET(x) (((x) << 14) & 0x000fc000) -#define PHY_BB_SETTLING_TIME_ADCSAT_THRH_MSB 25 -#define PHY_BB_SETTLING_TIME_ADCSAT_THRH_LSB 20 -#define PHY_BB_SETTLING_TIME_ADCSAT_THRH_MASK 0x03f00000 -#define PHY_BB_SETTLING_TIME_ADCSAT_THRH_GET(x) (((x) & 0x03f00000) >> 20) -#define PHY_BB_SETTLING_TIME_ADCSAT_THRH_SET(x) (((x) << 20) & 0x03f00000) -#define PHY_BB_SETTLING_TIME_LBRESET_ADVANCE_MSB 29 -#define PHY_BB_SETTLING_TIME_LBRESET_ADVANCE_LSB 26 -#define PHY_BB_SETTLING_TIME_LBRESET_ADVANCE_MASK 0x3c000000 -#define PHY_BB_SETTLING_TIME_LBRESET_ADVANCE_GET(x) (((x) & 0x3c000000) >> 26) -#define PHY_BB_SETTLING_TIME_LBRESET_ADVANCE_SET(x) (((x) << 26) & 0x3c000000) - -/* macros for BB_gain_force_max_gains_b0 */ -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_ADDRESS 0x00009848 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_OFFSET 0x00009848 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_HYST_MARGIN_0_MSB 13 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_HYST_MARGIN_0_LSB 7 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_HYST_MARGIN_0_MASK 0x00003f80 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_HYST_MARGIN_0_GET(x) (((x) & 0x00003f80) >> 7) -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_HYST_MARGIN_0_SET(x) (((x) << 7) & 0x00003f80) -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_HYST_MARGIN_0_MSB 20 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_HYST_MARGIN_0_LSB 14 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_HYST_MARGIN_0_MASK 0x001fc000 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_HYST_MARGIN_0_GET(x) (((x) & 0x001fc000) >> 14) -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_HYST_MARGIN_0_SET(x) (((x) << 14) & 0x001fc000) -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_GAIN_FORCE_MSB 21 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_GAIN_FORCE_LSB 21 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_GAIN_FORCE_MASK 0x00200000 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_GAIN_FORCE_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_GAIN_FORCE_SET(x) (((x) << 21) & 0x00200000) -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_ENABLE_SHARED_RX_MSB 31 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_ENABLE_SHARED_RX_LSB 31 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_ENABLE_SHARED_RX_MASK 0x80000000 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_ENABLE_SHARED_RX_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B0_ENABLE_SHARED_RX_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_gains_min_offsets_b0 */ -#define PHY_BB_GAINS_MIN_OFFSETS_B0_ADDRESS 0x0000984c -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSET 0x0000984c -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC1_MSB 6 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC1_LSB 0 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC1_MASK 0x0000007f -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC1_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC1_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC2_MSB 11 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC2_LSB 7 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC2_MASK 0x00000f80 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC2_GET(x) (((x) & 0x00000f80) >> 7) -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC2_SET(x) (((x) << 7) & 0x00000f80) -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC3_MSB 16 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC3_LSB 12 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC3_MASK 0x0001f000 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC3_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_BB_GAINS_MIN_OFFSETS_B0_OFFSETC3_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_BB_GAINS_MIN_OFFSETS_B0_RF_GAIN_F_0_MSB 24 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_RF_GAIN_F_0_LSB 17 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_RF_GAIN_F_0_MASK 0x01fe0000 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_RF_GAIN_F_0_GET(x) (((x) & 0x01fe0000) >> 17) -#define PHY_BB_GAINS_MIN_OFFSETS_B0_RF_GAIN_F_0_SET(x) (((x) << 17) & 0x01fe0000) -#define PHY_BB_GAINS_MIN_OFFSETS_B0_XATTEN1_SW_F_0_MSB 25 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_XATTEN1_SW_F_0_LSB 25 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_XATTEN1_SW_F_0_MASK 0x02000000 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_XATTEN1_SW_F_0_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_BB_GAINS_MIN_OFFSETS_B0_XATTEN1_SW_F_0_SET(x) (((x) << 25) & 0x02000000) -#define PHY_BB_GAINS_MIN_OFFSETS_B0_XATTEN2_SW_F_0_MSB 26 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_XATTEN2_SW_F_0_LSB 26 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_XATTEN2_SW_F_0_MASK 0x04000000 -#define PHY_BB_GAINS_MIN_OFFSETS_B0_XATTEN2_SW_F_0_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_BB_GAINS_MIN_OFFSETS_B0_XATTEN2_SW_F_0_SET(x) (((x) << 26) & 0x04000000) - -/* macros for BB_desired_sigsize */ -#define PHY_BB_DESIRED_SIGSIZE_ADDRESS 0x00009850 -#define PHY_BB_DESIRED_SIGSIZE_OFFSET 0x00009850 -#define PHY_BB_DESIRED_SIGSIZE_ADC_DESIRED_SIZE_MSB 7 -#define PHY_BB_DESIRED_SIGSIZE_ADC_DESIRED_SIZE_LSB 0 -#define PHY_BB_DESIRED_SIGSIZE_ADC_DESIRED_SIZE_MASK 0x000000ff -#define PHY_BB_DESIRED_SIGSIZE_ADC_DESIRED_SIZE_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_DESIRED_SIGSIZE_ADC_DESIRED_SIZE_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_DESIRED_SIGSIZE_TOTAL_DESIRED_MSB 27 -#define PHY_BB_DESIRED_SIGSIZE_TOTAL_DESIRED_LSB 20 -#define PHY_BB_DESIRED_SIGSIZE_TOTAL_DESIRED_MASK 0x0ff00000 -#define PHY_BB_DESIRED_SIGSIZE_TOTAL_DESIRED_GET(x) (((x) & 0x0ff00000) >> 20) -#define PHY_BB_DESIRED_SIGSIZE_TOTAL_DESIRED_SET(x) (((x) << 20) & 0x0ff00000) -#define PHY_BB_DESIRED_SIGSIZE_INIT_GC_COUNT_MAX_MSB 29 -#define PHY_BB_DESIRED_SIGSIZE_INIT_GC_COUNT_MAX_LSB 28 -#define PHY_BB_DESIRED_SIGSIZE_INIT_GC_COUNT_MAX_MASK 0x30000000 -#define PHY_BB_DESIRED_SIGSIZE_INIT_GC_COUNT_MAX_GET(x) (((x) & 0x30000000) >> 28) -#define PHY_BB_DESIRED_SIGSIZE_INIT_GC_COUNT_MAX_SET(x) (((x) << 28) & 0x30000000) -#define PHY_BB_DESIRED_SIGSIZE_REDUCE_INIT_GC_COUNT_MSB 30 -#define PHY_BB_DESIRED_SIGSIZE_REDUCE_INIT_GC_COUNT_LSB 30 -#define PHY_BB_DESIRED_SIGSIZE_REDUCE_INIT_GC_COUNT_MASK 0x40000000 -#define PHY_BB_DESIRED_SIGSIZE_REDUCE_INIT_GC_COUNT_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_DESIRED_SIGSIZE_REDUCE_INIT_GC_COUNT_SET(x) (((x) << 30) & 0x40000000) -#define PHY_BB_DESIRED_SIGSIZE_ENA_INIT_GAIN_MSB 31 -#define PHY_BB_DESIRED_SIGSIZE_ENA_INIT_GAIN_LSB 31 -#define PHY_BB_DESIRED_SIGSIZE_ENA_INIT_GAIN_MASK 0x80000000 -#define PHY_BB_DESIRED_SIGSIZE_ENA_INIT_GAIN_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_DESIRED_SIGSIZE_ENA_INIT_GAIN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_timing_control_3a */ -#define PHY_BB_TIMING_CONTROL_3A_ADDRESS 0x00009854 -#define PHY_BB_TIMING_CONTROL_3A_OFFSET 0x00009854 -#define PHY_BB_TIMING_CONTROL_3A_STE_THR_HI_RSSI_MSB 6 -#define PHY_BB_TIMING_CONTROL_3A_STE_THR_HI_RSSI_LSB 0 -#define PHY_BB_TIMING_CONTROL_3A_STE_THR_HI_RSSI_MASK 0x0000007f -#define PHY_BB_TIMING_CONTROL_3A_STE_THR_HI_RSSI_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_BB_TIMING_CONTROL_3A_STE_THR_HI_RSSI_SET(x) (((x) << 0) & 0x0000007f) - -/* macros for BB_find_signal */ -#define PHY_BB_FIND_SIGNAL_ADDRESS 0x00009858 -#define PHY_BB_FIND_SIGNAL_OFFSET 0x00009858 -#define PHY_BB_FIND_SIGNAL_RELSTEP_MSB 5 -#define PHY_BB_FIND_SIGNAL_RELSTEP_LSB 0 -#define PHY_BB_FIND_SIGNAL_RELSTEP_MASK 0x0000003f -#define PHY_BB_FIND_SIGNAL_RELSTEP_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_FIND_SIGNAL_RELSTEP_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_FIND_SIGNAL_RELPWR_MSB 11 -#define PHY_BB_FIND_SIGNAL_RELPWR_LSB 6 -#define PHY_BB_FIND_SIGNAL_RELPWR_MASK 0x00000fc0 -#define PHY_BB_FIND_SIGNAL_RELPWR_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_FIND_SIGNAL_RELPWR_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_FIND_SIGNAL_FIRSTEP_MSB 17 -#define PHY_BB_FIND_SIGNAL_FIRSTEP_LSB 12 -#define PHY_BB_FIND_SIGNAL_FIRSTEP_MASK 0x0003f000 -#define PHY_BB_FIND_SIGNAL_FIRSTEP_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_BB_FIND_SIGNAL_FIRSTEP_SET(x) (((x) << 12) & 0x0003f000) -#define PHY_BB_FIND_SIGNAL_FIRPWR_MSB 25 -#define PHY_BB_FIND_SIGNAL_FIRPWR_LSB 18 -#define PHY_BB_FIND_SIGNAL_FIRPWR_MASK 0x03fc0000 -#define PHY_BB_FIND_SIGNAL_FIRPWR_GET(x) (((x) & 0x03fc0000) >> 18) -#define PHY_BB_FIND_SIGNAL_FIRPWR_SET(x) (((x) << 18) & 0x03fc0000) -#define PHY_BB_FIND_SIGNAL_M1COUNT_MAX_MSB 31 -#define PHY_BB_FIND_SIGNAL_M1COUNT_MAX_LSB 26 -#define PHY_BB_FIND_SIGNAL_M1COUNT_MAX_MASK 0xfc000000 -#define PHY_BB_FIND_SIGNAL_M1COUNT_MAX_GET(x) (((x) & 0xfc000000) >> 26) -#define PHY_BB_FIND_SIGNAL_M1COUNT_MAX_SET(x) (((x) << 26) & 0xfc000000) - -/* macros for BB_agc */ -#define PHY_BB_AGC_ADDRESS 0x0000985c -#define PHY_BB_AGC_OFFSET 0x0000985c -#define PHY_BB_AGC_COARSEPWR_CONST_MSB 6 -#define PHY_BB_AGC_COARSEPWR_CONST_LSB 0 -#define PHY_BB_AGC_COARSEPWR_CONST_MASK 0x0000007f -#define PHY_BB_AGC_COARSEPWR_CONST_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_BB_AGC_COARSEPWR_CONST_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_BB_AGC_COARSE_LOW_MSB 14 -#define PHY_BB_AGC_COARSE_LOW_LSB 7 -#define PHY_BB_AGC_COARSE_LOW_MASK 0x00007f80 -#define PHY_BB_AGC_COARSE_LOW_GET(x) (((x) & 0x00007f80) >> 7) -#define PHY_BB_AGC_COARSE_LOW_SET(x) (((x) << 7) & 0x00007f80) -#define PHY_BB_AGC_COARSE_HIGH_MSB 21 -#define PHY_BB_AGC_COARSE_HIGH_LSB 15 -#define PHY_BB_AGC_COARSE_HIGH_MASK 0x003f8000 -#define PHY_BB_AGC_COARSE_HIGH_GET(x) (((x) & 0x003f8000) >> 15) -#define PHY_BB_AGC_COARSE_HIGH_SET(x) (((x) << 15) & 0x003f8000) -#define PHY_BB_AGC_QUICK_DROP_MSB 29 -#define PHY_BB_AGC_QUICK_DROP_LSB 22 -#define PHY_BB_AGC_QUICK_DROP_MASK 0x3fc00000 -#define PHY_BB_AGC_QUICK_DROP_GET(x) (((x) & 0x3fc00000) >> 22) -#define PHY_BB_AGC_QUICK_DROP_SET(x) (((x) << 22) & 0x3fc00000) -#define PHY_BB_AGC_RSSI_OUT_SELECT_MSB 31 -#define PHY_BB_AGC_RSSI_OUT_SELECT_LSB 30 -#define PHY_BB_AGC_RSSI_OUT_SELECT_MASK 0xc0000000 -#define PHY_BB_AGC_RSSI_OUT_SELECT_GET(x) (((x) & 0xc0000000) >> 30) -#define PHY_BB_AGC_RSSI_OUT_SELECT_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for BB_agc_control */ -#define PHY_BB_AGC_CONTROL_ADDRESS 0x00009860 -#define PHY_BB_AGC_CONTROL_OFFSET 0x00009860 -#define PHY_BB_AGC_CONTROL_DO_CALIBRATE_MSB 0 -#define PHY_BB_AGC_CONTROL_DO_CALIBRATE_LSB 0 -#define PHY_BB_AGC_CONTROL_DO_CALIBRATE_MASK 0x00000001 -#define PHY_BB_AGC_CONTROL_DO_CALIBRATE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_AGC_CONTROL_DO_CALIBRATE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_AGC_CONTROL_DO_NOISEFLOOR_MSB 1 -#define PHY_BB_AGC_CONTROL_DO_NOISEFLOOR_LSB 1 -#define PHY_BB_AGC_CONTROL_DO_NOISEFLOOR_MASK 0x00000002 -#define PHY_BB_AGC_CONTROL_DO_NOISEFLOOR_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_AGC_CONTROL_DO_NOISEFLOOR_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_AGC_CONTROL_MIN_NUM_GAIN_CHANGE_MSB 5 -#define PHY_BB_AGC_CONTROL_MIN_NUM_GAIN_CHANGE_LSB 3 -#define PHY_BB_AGC_CONTROL_MIN_NUM_GAIN_CHANGE_MASK 0x00000038 -#define PHY_BB_AGC_CONTROL_MIN_NUM_GAIN_CHANGE_GET(x) (((x) & 0x00000038) >> 3) -#define PHY_BB_AGC_CONTROL_MIN_NUM_GAIN_CHANGE_SET(x) (((x) << 3) & 0x00000038) -#define PHY_BB_AGC_CONTROL_YCOK_MAX_MSB 9 -#define PHY_BB_AGC_CONTROL_YCOK_MAX_LSB 6 -#define PHY_BB_AGC_CONTROL_YCOK_MAX_MASK 0x000003c0 -#define PHY_BB_AGC_CONTROL_YCOK_MAX_GET(x) (((x) & 0x000003c0) >> 6) -#define PHY_BB_AGC_CONTROL_YCOK_MAX_SET(x) (((x) << 6) & 0x000003c0) -#define PHY_BB_AGC_CONTROL_LEAKY_BUCKET_ENABLE_MSB 10 -#define PHY_BB_AGC_CONTROL_LEAKY_BUCKET_ENABLE_LSB 10 -#define PHY_BB_AGC_CONTROL_LEAKY_BUCKET_ENABLE_MASK 0x00000400 -#define PHY_BB_AGC_CONTROL_LEAKY_BUCKET_ENABLE_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_BB_AGC_CONTROL_LEAKY_BUCKET_ENABLE_SET(x) (((x) << 10) & 0x00000400) -#define PHY_BB_AGC_CONTROL_CAL_ENABLE_MSB 11 -#define PHY_BB_AGC_CONTROL_CAL_ENABLE_LSB 11 -#define PHY_BB_AGC_CONTROL_CAL_ENABLE_MASK 0x00000800 -#define PHY_BB_AGC_CONTROL_CAL_ENABLE_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_BB_AGC_CONTROL_CAL_ENABLE_SET(x) (((x) << 11) & 0x00000800) -#define PHY_BB_AGC_CONTROL_USE_TABLE_SEED_MSB 12 -#define PHY_BB_AGC_CONTROL_USE_TABLE_SEED_LSB 12 -#define PHY_BB_AGC_CONTROL_USE_TABLE_SEED_MASK 0x00001000 -#define PHY_BB_AGC_CONTROL_USE_TABLE_SEED_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_BB_AGC_CONTROL_USE_TABLE_SEED_SET(x) (((x) << 12) & 0x00001000) -#define PHY_BB_AGC_CONTROL_AGC_UPDATE_TABLE_SEED_MSB 13 -#define PHY_BB_AGC_CONTROL_AGC_UPDATE_TABLE_SEED_LSB 13 -#define PHY_BB_AGC_CONTROL_AGC_UPDATE_TABLE_SEED_MASK 0x00002000 -#define PHY_BB_AGC_CONTROL_AGC_UPDATE_TABLE_SEED_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_BB_AGC_CONTROL_AGC_UPDATE_TABLE_SEED_SET(x) (((x) << 13) & 0x00002000) -#define PHY_BB_AGC_CONTROL_ENABLE_NOISEFLOOR_MSB 15 -#define PHY_BB_AGC_CONTROL_ENABLE_NOISEFLOOR_LSB 15 -#define PHY_BB_AGC_CONTROL_ENABLE_NOISEFLOOR_MASK 0x00008000 -#define PHY_BB_AGC_CONTROL_ENABLE_NOISEFLOOR_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_BB_AGC_CONTROL_ENABLE_NOISEFLOOR_SET(x) (((x) << 15) & 0x00008000) -#define PHY_BB_AGC_CONTROL_ENABLE_FLTR_CAL_MSB 16 -#define PHY_BB_AGC_CONTROL_ENABLE_FLTR_CAL_LSB 16 -#define PHY_BB_AGC_CONTROL_ENABLE_FLTR_CAL_MASK 0x00010000 -#define PHY_BB_AGC_CONTROL_ENABLE_FLTR_CAL_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_BB_AGC_CONTROL_ENABLE_FLTR_CAL_SET(x) (((x) << 16) & 0x00010000) -#define PHY_BB_AGC_CONTROL_NO_UPDATE_NOISEFLOOR_MSB 17 -#define PHY_BB_AGC_CONTROL_NO_UPDATE_NOISEFLOOR_LSB 17 -#define PHY_BB_AGC_CONTROL_NO_UPDATE_NOISEFLOOR_MASK 0x00020000 -#define PHY_BB_AGC_CONTROL_NO_UPDATE_NOISEFLOOR_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_BB_AGC_CONTROL_NO_UPDATE_NOISEFLOOR_SET(x) (((x) << 17) & 0x00020000) -#define PHY_BB_AGC_CONTROL_EXTEND_NF_PWR_MEAS_MSB 18 -#define PHY_BB_AGC_CONTROL_EXTEND_NF_PWR_MEAS_LSB 18 -#define PHY_BB_AGC_CONTROL_EXTEND_NF_PWR_MEAS_MASK 0x00040000 -#define PHY_BB_AGC_CONTROL_EXTEND_NF_PWR_MEAS_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_BB_AGC_CONTROL_EXTEND_NF_PWR_MEAS_SET(x) (((x) << 18) & 0x00040000) -#define PHY_BB_AGC_CONTROL_CLC_SUCCESS_MSB 19 -#define PHY_BB_AGC_CONTROL_CLC_SUCCESS_LSB 19 -#define PHY_BB_AGC_CONTROL_CLC_SUCCESS_MASK 0x00080000 -#define PHY_BB_AGC_CONTROL_CLC_SUCCESS_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_BB_AGC_CONTROL_ENABLE_PKDET_CAL_MSB 20 -#define PHY_BB_AGC_CONTROL_ENABLE_PKDET_CAL_LSB 20 -#define PHY_BB_AGC_CONTROL_ENABLE_PKDET_CAL_MASK 0x00100000 -#define PHY_BB_AGC_CONTROL_ENABLE_PKDET_CAL_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_BB_AGC_CONTROL_ENABLE_PKDET_CAL_SET(x) (((x) << 20) & 0x00100000) - -/* macros for BB_cca_b0 */ -#define PHY_BB_CCA_B0_ADDRESS 0x00009864 -#define PHY_BB_CCA_B0_OFFSET 0x00009864 -#define PHY_BB_CCA_B0_CF_MAXCCAPWR_0_MSB 8 -#define PHY_BB_CCA_B0_CF_MAXCCAPWR_0_LSB 0 -#define PHY_BB_CCA_B0_CF_MAXCCAPWR_0_MASK 0x000001ff -#define PHY_BB_CCA_B0_CF_MAXCCAPWR_0_GET(x) (((x) & 0x000001ff) >> 0) -#define PHY_BB_CCA_B0_CF_MAXCCAPWR_0_SET(x) (((x) << 0) & 0x000001ff) -#define PHY_BB_CCA_B0_CF_CCA_COUNT_MAXC_MSB 11 -#define PHY_BB_CCA_B0_CF_CCA_COUNT_MAXC_LSB 9 -#define PHY_BB_CCA_B0_CF_CCA_COUNT_MAXC_MASK 0x00000e00 -#define PHY_BB_CCA_B0_CF_CCA_COUNT_MAXC_GET(x) (((x) & 0x00000e00) >> 9) -#define PHY_BB_CCA_B0_CF_CCA_COUNT_MAXC_SET(x) (((x) << 9) & 0x00000e00) -#define PHY_BB_CCA_B0_CF_THRESH62_MSB 19 -#define PHY_BB_CCA_B0_CF_THRESH62_LSB 12 -#define PHY_BB_CCA_B0_CF_THRESH62_MASK 0x000ff000 -#define PHY_BB_CCA_B0_CF_THRESH62_GET(x) (((x) & 0x000ff000) >> 12) -#define PHY_BB_CCA_B0_CF_THRESH62_SET(x) (((x) << 12) & 0x000ff000) -#define PHY_BB_CCA_B0_MINCCAPWR_0_MSB 28 -#define PHY_BB_CCA_B0_MINCCAPWR_0_LSB 20 -#define PHY_BB_CCA_B0_MINCCAPWR_0_MASK 0x1ff00000 -#define PHY_BB_CCA_B0_MINCCAPWR_0_GET(x) (((x) & 0x1ff00000) >> 20) - -/* macros for BB_sfcorr */ -#define PHY_BB_SFCORR_ADDRESS 0x00009868 -#define PHY_BB_SFCORR_OFFSET 0x00009868 -#define PHY_BB_SFCORR_M2COUNT_THR_MSB 4 -#define PHY_BB_SFCORR_M2COUNT_THR_LSB 0 -#define PHY_BB_SFCORR_M2COUNT_THR_MASK 0x0000001f -#define PHY_BB_SFCORR_M2COUNT_THR_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_SFCORR_M2COUNT_THR_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_SFCORR_ADCSAT_THRESH_MSB 10 -#define PHY_BB_SFCORR_ADCSAT_THRESH_LSB 5 -#define PHY_BB_SFCORR_ADCSAT_THRESH_MASK 0x000007e0 -#define PHY_BB_SFCORR_ADCSAT_THRESH_GET(x) (((x) & 0x000007e0) >> 5) -#define PHY_BB_SFCORR_ADCSAT_THRESH_SET(x) (((x) << 5) & 0x000007e0) -#define PHY_BB_SFCORR_ADCSAT_ICOUNT_MSB 16 -#define PHY_BB_SFCORR_ADCSAT_ICOUNT_LSB 11 -#define PHY_BB_SFCORR_ADCSAT_ICOUNT_MASK 0x0001f800 -#define PHY_BB_SFCORR_ADCSAT_ICOUNT_GET(x) (((x) & 0x0001f800) >> 11) -#define PHY_BB_SFCORR_ADCSAT_ICOUNT_SET(x) (((x) << 11) & 0x0001f800) -#define PHY_BB_SFCORR_M1_THRES_MSB 23 -#define PHY_BB_SFCORR_M1_THRES_LSB 17 -#define PHY_BB_SFCORR_M1_THRES_MASK 0x00fe0000 -#define PHY_BB_SFCORR_M1_THRES_GET(x) (((x) & 0x00fe0000) >> 17) -#define PHY_BB_SFCORR_M1_THRES_SET(x) (((x) << 17) & 0x00fe0000) -#define PHY_BB_SFCORR_M2_THRES_MSB 30 -#define PHY_BB_SFCORR_M2_THRES_LSB 24 -#define PHY_BB_SFCORR_M2_THRES_MASK 0x7f000000 -#define PHY_BB_SFCORR_M2_THRES_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_BB_SFCORR_M2_THRES_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for BB_self_corr_low */ -#define PHY_BB_SELF_CORR_LOW_ADDRESS 0x0000986c -#define PHY_BB_SELF_CORR_LOW_OFFSET 0x0000986c -#define PHY_BB_SELF_CORR_LOW_USE_SELF_CORR_LOW_MSB 0 -#define PHY_BB_SELF_CORR_LOW_USE_SELF_CORR_LOW_LSB 0 -#define PHY_BB_SELF_CORR_LOW_USE_SELF_CORR_LOW_MASK 0x00000001 -#define PHY_BB_SELF_CORR_LOW_USE_SELF_CORR_LOW_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_SELF_CORR_LOW_USE_SELF_CORR_LOW_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_SELF_CORR_LOW_M1COUNT_MAX_LOW_MSB 7 -#define PHY_BB_SELF_CORR_LOW_M1COUNT_MAX_LOW_LSB 1 -#define PHY_BB_SELF_CORR_LOW_M1COUNT_MAX_LOW_MASK 0x000000fe -#define PHY_BB_SELF_CORR_LOW_M1COUNT_MAX_LOW_GET(x) (((x) & 0x000000fe) >> 1) -#define PHY_BB_SELF_CORR_LOW_M1COUNT_MAX_LOW_SET(x) (((x) << 1) & 0x000000fe) -#define PHY_BB_SELF_CORR_LOW_M2COUNT_THR_LOW_MSB 13 -#define PHY_BB_SELF_CORR_LOW_M2COUNT_THR_LOW_LSB 8 -#define PHY_BB_SELF_CORR_LOW_M2COUNT_THR_LOW_MASK 0x00003f00 -#define PHY_BB_SELF_CORR_LOW_M2COUNT_THR_LOW_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_SELF_CORR_LOW_M2COUNT_THR_LOW_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_SELF_CORR_LOW_M1_THRESH_LOW_MSB 20 -#define PHY_BB_SELF_CORR_LOW_M1_THRESH_LOW_LSB 14 -#define PHY_BB_SELF_CORR_LOW_M1_THRESH_LOW_MASK 0x001fc000 -#define PHY_BB_SELF_CORR_LOW_M1_THRESH_LOW_GET(x) (((x) & 0x001fc000) >> 14) -#define PHY_BB_SELF_CORR_LOW_M1_THRESH_LOW_SET(x) (((x) << 14) & 0x001fc000) -#define PHY_BB_SELF_CORR_LOW_M2_THRESH_LOW_MSB 27 -#define PHY_BB_SELF_CORR_LOW_M2_THRESH_LOW_LSB 21 -#define PHY_BB_SELF_CORR_LOW_M2_THRESH_LOW_MASK 0x0fe00000 -#define PHY_BB_SELF_CORR_LOW_M2_THRESH_LOW_GET(x) (((x) & 0x0fe00000) >> 21) -#define PHY_BB_SELF_CORR_LOW_M2_THRESH_LOW_SET(x) (((x) << 21) & 0x0fe00000) - -/* macros for BB_synth_control */ -#define PHY_BB_SYNTH_CONTROL_ADDRESS 0x00009874 -#define PHY_BB_SYNTH_CONTROL_OFFSET 0x00009874 -#define PHY_BB_SYNTH_CONTROL_RFCHANFRAC_MSB 16 -#define PHY_BB_SYNTH_CONTROL_RFCHANFRAC_LSB 0 -#define PHY_BB_SYNTH_CONTROL_RFCHANFRAC_MASK 0x0001ffff -#define PHY_BB_SYNTH_CONTROL_RFCHANFRAC_GET(x) (((x) & 0x0001ffff) >> 0) -#define PHY_BB_SYNTH_CONTROL_RFCHANFRAC_SET(x) (((x) << 0) & 0x0001ffff) -#define PHY_BB_SYNTH_CONTROL_RFCHANNEL_MSB 25 -#define PHY_BB_SYNTH_CONTROL_RFCHANNEL_LSB 17 -#define PHY_BB_SYNTH_CONTROL_RFCHANNEL_MASK 0x03fe0000 -#define PHY_BB_SYNTH_CONTROL_RFCHANNEL_GET(x) (((x) & 0x03fe0000) >> 17) -#define PHY_BB_SYNTH_CONTROL_RFCHANNEL_SET(x) (((x) << 17) & 0x03fe0000) -#define PHY_BB_SYNTH_CONTROL_RFAMODEREFSEL_MSB 27 -#define PHY_BB_SYNTH_CONTROL_RFAMODEREFSEL_LSB 26 -#define PHY_BB_SYNTH_CONTROL_RFAMODEREFSEL_MASK 0x0c000000 -#define PHY_BB_SYNTH_CONTROL_RFAMODEREFSEL_GET(x) (((x) & 0x0c000000) >> 26) -#define PHY_BB_SYNTH_CONTROL_RFAMODEREFSEL_SET(x) (((x) << 26) & 0x0c000000) -#define PHY_BB_SYNTH_CONTROL_RFFRACMODE_MSB 28 -#define PHY_BB_SYNTH_CONTROL_RFFRACMODE_LSB 28 -#define PHY_BB_SYNTH_CONTROL_RFFRACMODE_MASK 0x10000000 -#define PHY_BB_SYNTH_CONTROL_RFFRACMODE_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_BB_SYNTH_CONTROL_RFFRACMODE_SET(x) (((x) << 28) & 0x10000000) -#define PHY_BB_SYNTH_CONTROL_RFBMODE_MSB 29 -#define PHY_BB_SYNTH_CONTROL_RFBMODE_LSB 29 -#define PHY_BB_SYNTH_CONTROL_RFBMODE_MASK 0x20000000 -#define PHY_BB_SYNTH_CONTROL_RFBMODE_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_BB_SYNTH_CONTROL_RFBMODE_SET(x) (((x) << 29) & 0x20000000) -#define PHY_BB_SYNTH_CONTROL_RFSYNTH_CTRL_SSHIFT_MSB 30 -#define PHY_BB_SYNTH_CONTROL_RFSYNTH_CTRL_SSHIFT_LSB 30 -#define PHY_BB_SYNTH_CONTROL_RFSYNTH_CTRL_SSHIFT_MASK 0x40000000 -#define PHY_BB_SYNTH_CONTROL_RFSYNTH_CTRL_SSHIFT_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_SYNTH_CONTROL_RFSYNTH_CTRL_SSHIFT_SET(x) (((x) << 30) & 0x40000000) - -/* macros for BB_addac_clk_select */ -#define PHY_BB_ADDAC_CLK_SELECT_ADDRESS 0x00009878 -#define PHY_BB_ADDAC_CLK_SELECT_OFFSET 0x00009878 -#define PHY_BB_ADDAC_CLK_SELECT_BB_DAC_CLK_SELECT_MSB 3 -#define PHY_BB_ADDAC_CLK_SELECT_BB_DAC_CLK_SELECT_LSB 2 -#define PHY_BB_ADDAC_CLK_SELECT_BB_DAC_CLK_SELECT_MASK 0x0000000c -#define PHY_BB_ADDAC_CLK_SELECT_BB_DAC_CLK_SELECT_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_BB_ADDAC_CLK_SELECT_BB_DAC_CLK_SELECT_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_BB_ADDAC_CLK_SELECT_BB_ADC_CLK_SELECT_MSB 5 -#define PHY_BB_ADDAC_CLK_SELECT_BB_ADC_CLK_SELECT_LSB 4 -#define PHY_BB_ADDAC_CLK_SELECT_BB_ADC_CLK_SELECT_MASK 0x00000030 -#define PHY_BB_ADDAC_CLK_SELECT_BB_ADC_CLK_SELECT_GET(x) (((x) & 0x00000030) >> 4) -#define PHY_BB_ADDAC_CLK_SELECT_BB_ADC_CLK_SELECT_SET(x) (((x) << 4) & 0x00000030) - -/* macros for BB_pll_cntl */ -#define PHY_BB_PLL_CNTL_ADDRESS 0x0000987c -#define PHY_BB_PLL_CNTL_OFFSET 0x0000987c -#define PHY_BB_PLL_CNTL_BB_PLL_DIV_MSB 9 -#define PHY_BB_PLL_CNTL_BB_PLL_DIV_LSB 0 -#define PHY_BB_PLL_CNTL_BB_PLL_DIV_MASK 0x000003ff -#define PHY_BB_PLL_CNTL_BB_PLL_DIV_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_BB_PLL_CNTL_BB_PLL_DIV_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_BB_PLL_CNTL_BB_PLL_REFDIV_MSB 13 -#define PHY_BB_PLL_CNTL_BB_PLL_REFDIV_LSB 10 -#define PHY_BB_PLL_CNTL_BB_PLL_REFDIV_MASK 0x00003c00 -#define PHY_BB_PLL_CNTL_BB_PLL_REFDIV_GET(x) (((x) & 0x00003c00) >> 10) -#define PHY_BB_PLL_CNTL_BB_PLL_REFDIV_SET(x) (((x) << 10) & 0x00003c00) -#define PHY_BB_PLL_CNTL_BB_PLL_CLK_SEL_MSB 15 -#define PHY_BB_PLL_CNTL_BB_PLL_CLK_SEL_LSB 14 -#define PHY_BB_PLL_CNTL_BB_PLL_CLK_SEL_MASK 0x0000c000 -#define PHY_BB_PLL_CNTL_BB_PLL_CLK_SEL_GET(x) (((x) & 0x0000c000) >> 14) -#define PHY_BB_PLL_CNTL_BB_PLL_CLK_SEL_SET(x) (((x) << 14) & 0x0000c000) -#define PHY_BB_PLL_CNTL_BB_PLLBYPASS_MSB 16 -#define PHY_BB_PLL_CNTL_BB_PLLBYPASS_LSB 16 -#define PHY_BB_PLL_CNTL_BB_PLLBYPASS_MASK 0x00010000 -#define PHY_BB_PLL_CNTL_BB_PLLBYPASS_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_BB_PLL_CNTL_BB_PLLBYPASS_SET(x) (((x) << 16) & 0x00010000) -#define PHY_BB_PLL_CNTL_BB_PLL_SETTLE_TIME_MSB 27 -#define PHY_BB_PLL_CNTL_BB_PLL_SETTLE_TIME_LSB 17 -#define PHY_BB_PLL_CNTL_BB_PLL_SETTLE_TIME_MASK 0x0ffe0000 -#define PHY_BB_PLL_CNTL_BB_PLL_SETTLE_TIME_GET(x) (((x) & 0x0ffe0000) >> 17) -#define PHY_BB_PLL_CNTL_BB_PLL_SETTLE_TIME_SET(x) (((x) << 17) & 0x0ffe0000) - -/* macros for BB_vit_spur_mask_A */ -#define PHY_BB_VIT_SPUR_MASK_A_ADDRESS 0x00009900 -#define PHY_BB_VIT_SPUR_MASK_A_OFFSET 0x00009900 -#define PHY_BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_A_MSB 9 -#define PHY_BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_A_LSB 0 -#define PHY_BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_A_MASK 0x000003ff -#define PHY_BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_A_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_A_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_MSB 16 -#define PHY_BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_LSB 10 -#define PHY_BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_MASK 0x0001fc00 -#define PHY_BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_GET(x) (((x) & 0x0001fc00) >> 10) -#define PHY_BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_SET(x) (((x) << 10) & 0x0001fc00) - -/* macros for BB_vit_spur_mask_B */ -#define PHY_BB_VIT_SPUR_MASK_B_ADDRESS 0x00009904 -#define PHY_BB_VIT_SPUR_MASK_B_OFFSET 0x00009904 -#define PHY_BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_B_MSB 9 -#define PHY_BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_B_LSB 0 -#define PHY_BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_B_MASK 0x000003ff -#define PHY_BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_B_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_B_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_IDX_B_MSB 16 -#define PHY_BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_IDX_B_LSB 10 -#define PHY_BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_IDX_B_MASK 0x0001fc00 -#define PHY_BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_IDX_B_GET(x) (((x) & 0x0001fc00) >> 10) -#define PHY_BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_IDX_B_SET(x) (((x) << 10) & 0x0001fc00) - -/* macros for BB_pilot_spur_mask */ -#define PHY_BB_PILOT_SPUR_MASK_ADDRESS 0x00009908 -#define PHY_BB_PILOT_SPUR_MASK_OFFSET 0x00009908 -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_A_MSB 4 -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_A_LSB 0 -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_A_MASK 0x0000001f -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_A_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_A_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A_MSB 11 -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A_LSB 5 -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A_MASK 0x00000fe0 -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A_GET(x) (((x) & 0x00000fe0) >> 5) -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A_SET(x) (((x) << 5) & 0x00000fe0) -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_B_MSB 16 -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_B_LSB 12 -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_B_MASK 0x0001f000 -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_B_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_B_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B_MSB 23 -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B_LSB 17 -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B_MASK 0x00fe0000 -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B_GET(x) (((x) & 0x00fe0000) >> 17) -#define PHY_BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B_SET(x) (((x) << 17) & 0x00fe0000) - -/* macros for BB_chan_spur_mask */ -#define PHY_BB_CHAN_SPUR_MASK_ADDRESS 0x0000990c -#define PHY_BB_CHAN_SPUR_MASK_OFFSET 0x0000990c -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_A_MSB 4 -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_A_LSB 0 -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_A_MASK 0x0000001f -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_A_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_A_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A_MSB 11 -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A_LSB 5 -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A_MASK 0x00000fe0 -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A_GET(x) (((x) & 0x00000fe0) >> 5) -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A_SET(x) (((x) << 5) & 0x00000fe0) -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_B_MSB 16 -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_B_LSB 12 -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_B_MASK 0x0001f000 -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_B_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_B_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B_MSB 23 -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B_LSB 17 -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B_MASK 0x00fe0000 -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B_GET(x) (((x) & 0x00fe0000) >> 17) -#define PHY_BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B_SET(x) (((x) << 17) & 0x00fe0000) - -/* macros for BB_spectral_scan */ -#define PHY_BB_SPECTRAL_SCAN_ADDRESS 0x00009910 -#define PHY_BB_SPECTRAL_SCAN_OFFSET 0x00009910 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ENA_MSB 0 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ENA_LSB 0 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ENA_MASK 0x00000001 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ENA_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ENA_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ACTIVE_MSB 1 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ACTIVE_LSB 1 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ACTIVE_MASK 0x00000002 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ACTIVE_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ACTIVE_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_SPECTRAL_SCAN_DISABLE_RADAR_TCTL_RST_MSB 2 -#define PHY_BB_SPECTRAL_SCAN_DISABLE_RADAR_TCTL_RST_LSB 2 -#define PHY_BB_SPECTRAL_SCAN_DISABLE_RADAR_TCTL_RST_MASK 0x00000004 -#define PHY_BB_SPECTRAL_SCAN_DISABLE_RADAR_TCTL_RST_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_BB_SPECTRAL_SCAN_DISABLE_RADAR_TCTL_RST_SET(x) (((x) << 2) & 0x00000004) -#define PHY_BB_SPECTRAL_SCAN_DISABLE_PULSE_COARSE_LOW_MSB 3 -#define PHY_BB_SPECTRAL_SCAN_DISABLE_PULSE_COARSE_LOW_LSB 3 -#define PHY_BB_SPECTRAL_SCAN_DISABLE_PULSE_COARSE_LOW_MASK 0x00000008 -#define PHY_BB_SPECTRAL_SCAN_DISABLE_PULSE_COARSE_LOW_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_BB_SPECTRAL_SCAN_DISABLE_PULSE_COARSE_LOW_SET(x) (((x) << 3) & 0x00000008) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_FFT_PERIOD_MSB 7 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_FFT_PERIOD_LSB 4 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_FFT_PERIOD_MASK 0x000000f0 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_FFT_PERIOD_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_FFT_PERIOD_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PERIOD_MSB 15 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PERIOD_LSB 8 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PERIOD_MASK 0x0000ff00 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PERIOD_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PERIOD_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COUNT_MSB 27 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COUNT_LSB 16 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COUNT_MASK 0x0fff0000 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COUNT_GET(x) (((x) & 0x0fff0000) >> 16) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COUNT_SET(x) (((x) << 16) & 0x0fff0000) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_SHORT_RPT_MSB 28 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_SHORT_RPT_LSB 28 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_SHORT_RPT_MASK 0x10000000 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_SHORT_RPT_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_SHORT_RPT_SET(x) (((x) << 28) & 0x10000000) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PRIORITY_MSB 29 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PRIORITY_LSB 29 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PRIORITY_MASK 0x20000000 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PRIORITY_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PRIORITY_SET(x) (((x) << 29) & 0x20000000) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_USE_ERR5_MSB 30 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_USE_ERR5_LSB 30 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_USE_ERR5_MASK 0x40000000 -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_USE_ERR5_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_SPECTRAL_SCAN_SPECTRAL_SCAN_USE_ERR5_SET(x) (((x) << 30) & 0x40000000) - -/* macros for BB_analog_power_on_time */ -#define PHY_BB_ANALOG_POWER_ON_TIME_ADDRESS 0x00009914 -#define PHY_BB_ANALOG_POWER_ON_TIME_OFFSET 0x00009914 -#define PHY_BB_ANALOG_POWER_ON_TIME_ACTIVE_TO_RECEIVE_MSB 13 -#define PHY_BB_ANALOG_POWER_ON_TIME_ACTIVE_TO_RECEIVE_LSB 0 -#define PHY_BB_ANALOG_POWER_ON_TIME_ACTIVE_TO_RECEIVE_MASK 0x00003fff -#define PHY_BB_ANALOG_POWER_ON_TIME_ACTIVE_TO_RECEIVE_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_ANALOG_POWER_ON_TIME_ACTIVE_TO_RECEIVE_SET(x) (((x) << 0) & 0x00003fff) - -/* macros for BB_search_start_delay */ -#define PHY_BB_SEARCH_START_DELAY_ADDRESS 0x00009918 -#define PHY_BB_SEARCH_START_DELAY_OFFSET 0x00009918 -#define PHY_BB_SEARCH_START_DELAY_SEARCH_START_DELAY_MSB 11 -#define PHY_BB_SEARCH_START_DELAY_SEARCH_START_DELAY_LSB 0 -#define PHY_BB_SEARCH_START_DELAY_SEARCH_START_DELAY_MASK 0x00000fff -#define PHY_BB_SEARCH_START_DELAY_SEARCH_START_DELAY_GET(x) (((x) & 0x00000fff) >> 0) -#define PHY_BB_SEARCH_START_DELAY_SEARCH_START_DELAY_SET(x) (((x) << 0) & 0x00000fff) -#define PHY_BB_SEARCH_START_DELAY_ENABLE_FLT_SVD_MSB 12 -#define PHY_BB_SEARCH_START_DELAY_ENABLE_FLT_SVD_LSB 12 -#define PHY_BB_SEARCH_START_DELAY_ENABLE_FLT_SVD_MASK 0x00001000 -#define PHY_BB_SEARCH_START_DELAY_ENABLE_FLT_SVD_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_BB_SEARCH_START_DELAY_ENABLE_FLT_SVD_SET(x) (((x) << 12) & 0x00001000) -#define PHY_BB_SEARCH_START_DELAY_ENABLE_SEND_CHAN_MSB 13 -#define PHY_BB_SEARCH_START_DELAY_ENABLE_SEND_CHAN_LSB 13 -#define PHY_BB_SEARCH_START_DELAY_ENABLE_SEND_CHAN_MASK 0x00002000 -#define PHY_BB_SEARCH_START_DELAY_ENABLE_SEND_CHAN_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_BB_SEARCH_START_DELAY_ENABLE_SEND_CHAN_SET(x) (((x) << 13) & 0x00002000) - -/* macros for BB_max_rx_length */ -#define PHY_BB_MAX_RX_LENGTH_ADDRESS 0x0000991c -#define PHY_BB_MAX_RX_LENGTH_OFFSET 0x0000991c -#define PHY_BB_MAX_RX_LENGTH_MAX_RX_LENGTH_MSB 11 -#define PHY_BB_MAX_RX_LENGTH_MAX_RX_LENGTH_LSB 0 -#define PHY_BB_MAX_RX_LENGTH_MAX_RX_LENGTH_MASK 0x00000fff -#define PHY_BB_MAX_RX_LENGTH_MAX_RX_LENGTH_GET(x) (((x) & 0x00000fff) >> 0) -#define PHY_BB_MAX_RX_LENGTH_MAX_RX_LENGTH_SET(x) (((x) << 0) & 0x00000fff) -#define PHY_BB_MAX_RX_LENGTH_MAX_HT_LENGTH_MSB 29 -#define PHY_BB_MAX_RX_LENGTH_MAX_HT_LENGTH_LSB 12 -#define PHY_BB_MAX_RX_LENGTH_MAX_HT_LENGTH_MASK 0x3ffff000 -#define PHY_BB_MAX_RX_LENGTH_MAX_HT_LENGTH_GET(x) (((x) & 0x3ffff000) >> 12) -#define PHY_BB_MAX_RX_LENGTH_MAX_HT_LENGTH_SET(x) (((x) << 12) & 0x3ffff000) - -/* macros for BB_timing_control_4 */ -#define PHY_BB_TIMING_CONTROL_4_ADDRESS 0x00009920 -#define PHY_BB_TIMING_CONTROL_4_OFFSET 0x00009920 -#define PHY_BB_TIMING_CONTROL_4_CAL_LG_COUNT_MAX_MSB 15 -#define PHY_BB_TIMING_CONTROL_4_CAL_LG_COUNT_MAX_LSB 12 -#define PHY_BB_TIMING_CONTROL_4_CAL_LG_COUNT_MAX_MASK 0x0000f000 -#define PHY_BB_TIMING_CONTROL_4_CAL_LG_COUNT_MAX_GET(x) (((x) & 0x0000f000) >> 12) -#define PHY_BB_TIMING_CONTROL_4_CAL_LG_COUNT_MAX_SET(x) (((x) << 12) & 0x0000f000) -#define PHY_BB_TIMING_CONTROL_4_DO_GAIN_DC_IQ_CAL_MSB 16 -#define PHY_BB_TIMING_CONTROL_4_DO_GAIN_DC_IQ_CAL_LSB 16 -#define PHY_BB_TIMING_CONTROL_4_DO_GAIN_DC_IQ_CAL_MASK 0x00010000 -#define PHY_BB_TIMING_CONTROL_4_DO_GAIN_DC_IQ_CAL_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_BB_TIMING_CONTROL_4_DO_GAIN_DC_IQ_CAL_SET(x) (((x) << 16) & 0x00010000) -#define PHY_BB_TIMING_CONTROL_4_USE_PILOT_TRACK_DF_MSB 20 -#define PHY_BB_TIMING_CONTROL_4_USE_PILOT_TRACK_DF_LSB 17 -#define PHY_BB_TIMING_CONTROL_4_USE_PILOT_TRACK_DF_MASK 0x001e0000 -#define PHY_BB_TIMING_CONTROL_4_USE_PILOT_TRACK_DF_GET(x) (((x) & 0x001e0000) >> 17) -#define PHY_BB_TIMING_CONTROL_4_USE_PILOT_TRACK_DF_SET(x) (((x) << 17) & 0x001e0000) -#define PHY_BB_TIMING_CONTROL_4_EARLY_TRIGGER_THR_MSB 27 -#define PHY_BB_TIMING_CONTROL_4_EARLY_TRIGGER_THR_LSB 21 -#define PHY_BB_TIMING_CONTROL_4_EARLY_TRIGGER_THR_MASK 0x0fe00000 -#define PHY_BB_TIMING_CONTROL_4_EARLY_TRIGGER_THR_GET(x) (((x) & 0x0fe00000) >> 21) -#define PHY_BB_TIMING_CONTROL_4_EARLY_TRIGGER_THR_SET(x) (((x) << 21) & 0x0fe00000) -#define PHY_BB_TIMING_CONTROL_4_ENABLE_PILOT_MASK_MSB 28 -#define PHY_BB_TIMING_CONTROL_4_ENABLE_PILOT_MASK_LSB 28 -#define PHY_BB_TIMING_CONTROL_4_ENABLE_PILOT_MASK_MASK 0x10000000 -#define PHY_BB_TIMING_CONTROL_4_ENABLE_PILOT_MASK_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_BB_TIMING_CONTROL_4_ENABLE_PILOT_MASK_SET(x) (((x) << 28) & 0x10000000) -#define PHY_BB_TIMING_CONTROL_4_ENABLE_CHAN_MASK_MSB 29 -#define PHY_BB_TIMING_CONTROL_4_ENABLE_CHAN_MASK_LSB 29 -#define PHY_BB_TIMING_CONTROL_4_ENABLE_CHAN_MASK_MASK 0x20000000 -#define PHY_BB_TIMING_CONTROL_4_ENABLE_CHAN_MASK_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_BB_TIMING_CONTROL_4_ENABLE_CHAN_MASK_SET(x) (((x) << 29) & 0x20000000) -#define PHY_BB_TIMING_CONTROL_4_ENABLE_SPUR_FILTER_MSB 30 -#define PHY_BB_TIMING_CONTROL_4_ENABLE_SPUR_FILTER_LSB 30 -#define PHY_BB_TIMING_CONTROL_4_ENABLE_SPUR_FILTER_MASK 0x40000000 -#define PHY_BB_TIMING_CONTROL_4_ENABLE_SPUR_FILTER_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_TIMING_CONTROL_4_ENABLE_SPUR_FILTER_SET(x) (((x) << 30) & 0x40000000) -#define PHY_BB_TIMING_CONTROL_4_ENABLE_SPUR_RSSI_MSB 31 -#define PHY_BB_TIMING_CONTROL_4_ENABLE_SPUR_RSSI_LSB 31 -#define PHY_BB_TIMING_CONTROL_4_ENABLE_SPUR_RSSI_MASK 0x80000000 -#define PHY_BB_TIMING_CONTROL_4_ENABLE_SPUR_RSSI_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_TIMING_CONTROL_4_ENABLE_SPUR_RSSI_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_timing_control_5 */ -#define PHY_BB_TIMING_CONTROL_5_ADDRESS 0x00009924 -#define PHY_BB_TIMING_CONTROL_5_OFFSET 0x00009924 -#define PHY_BB_TIMING_CONTROL_5_ENABLE_CYCPWR_THR1_MSB 0 -#define PHY_BB_TIMING_CONTROL_5_ENABLE_CYCPWR_THR1_LSB 0 -#define PHY_BB_TIMING_CONTROL_5_ENABLE_CYCPWR_THR1_MASK 0x00000001 -#define PHY_BB_TIMING_CONTROL_5_ENABLE_CYCPWR_THR1_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_TIMING_CONTROL_5_ENABLE_CYCPWR_THR1_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_TIMING_CONTROL_5_CYCPWR_THR1_MSB 7 -#define PHY_BB_TIMING_CONTROL_5_CYCPWR_THR1_LSB 1 -#define PHY_BB_TIMING_CONTROL_5_CYCPWR_THR1_MASK 0x000000fe -#define PHY_BB_TIMING_CONTROL_5_CYCPWR_THR1_GET(x) (((x) & 0x000000fe) >> 1) -#define PHY_BB_TIMING_CONTROL_5_CYCPWR_THR1_SET(x) (((x) << 1) & 0x000000fe) -#define PHY_BB_TIMING_CONTROL_5_ENABLE_RSSI_THR1A_MSB 15 -#define PHY_BB_TIMING_CONTROL_5_ENABLE_RSSI_THR1A_LSB 15 -#define PHY_BB_TIMING_CONTROL_5_ENABLE_RSSI_THR1A_MASK 0x00008000 -#define PHY_BB_TIMING_CONTROL_5_ENABLE_RSSI_THR1A_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_BB_TIMING_CONTROL_5_ENABLE_RSSI_THR1A_SET(x) (((x) << 15) & 0x00008000) -#define PHY_BB_TIMING_CONTROL_5_RSSI_THR1A_MSB 22 -#define PHY_BB_TIMING_CONTROL_5_RSSI_THR1A_LSB 16 -#define PHY_BB_TIMING_CONTROL_5_RSSI_THR1A_MASK 0x007f0000 -#define PHY_BB_TIMING_CONTROL_5_RSSI_THR1A_GET(x) (((x) & 0x007f0000) >> 16) -#define PHY_BB_TIMING_CONTROL_5_RSSI_THR1A_SET(x) (((x) << 16) & 0x007f0000) -#define PHY_BB_TIMING_CONTROL_5_LONG_SC_THRESH_HI_RSSI_MSB 29 -#define PHY_BB_TIMING_CONTROL_5_LONG_SC_THRESH_HI_RSSI_LSB 23 -#define PHY_BB_TIMING_CONTROL_5_LONG_SC_THRESH_HI_RSSI_MASK 0x3f800000 -#define PHY_BB_TIMING_CONTROL_5_LONG_SC_THRESH_HI_RSSI_GET(x) (((x) & 0x3f800000) >> 23) -#define PHY_BB_TIMING_CONTROL_5_LONG_SC_THRESH_HI_RSSI_SET(x) (((x) << 23) & 0x3f800000) -#define PHY_BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_MSB 30 -#define PHY_BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_LSB 30 -#define PHY_BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_MASK 0x40000000 -#define PHY_BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_SET(x) (((x) << 30) & 0x40000000) -#define PHY_BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_EN_MSB 31 -#define PHY_BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_EN_LSB 31 -#define PHY_BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_EN_MASK 0x80000000 -#define PHY_BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_EN_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_EN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_phyonly_warm_reset */ -#define PHY_BB_PHYONLY_WARM_RESET_ADDRESS 0x00009928 -#define PHY_BB_PHYONLY_WARM_RESET_OFFSET 0x00009928 -#define PHY_BB_PHYONLY_WARM_RESET_PHYONLY_RST_WARM_L_MSB 0 -#define PHY_BB_PHYONLY_WARM_RESET_PHYONLY_RST_WARM_L_LSB 0 -#define PHY_BB_PHYONLY_WARM_RESET_PHYONLY_RST_WARM_L_MASK 0x00000001 -#define PHY_BB_PHYONLY_WARM_RESET_PHYONLY_RST_WARM_L_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_PHYONLY_WARM_RESET_PHYONLY_RST_WARM_L_SET(x) (((x) << 0) & 0x00000001) - -/* macros for BB_phyonly_control */ -#define PHY_BB_PHYONLY_CONTROL_ADDRESS 0x0000992c -#define PHY_BB_PHYONLY_CONTROL_OFFSET 0x0000992c -#define PHY_BB_PHYONLY_CONTROL_RX_DRAIN_RATE_MSB 0 -#define PHY_BB_PHYONLY_CONTROL_RX_DRAIN_RATE_LSB 0 -#define PHY_BB_PHYONLY_CONTROL_RX_DRAIN_RATE_MASK 0x00000001 -#define PHY_BB_PHYONLY_CONTROL_RX_DRAIN_RATE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_PHYONLY_CONTROL_RX_DRAIN_RATE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_PHYONLY_CONTROL_LATE_TX_SIGNAL_SYMBOL_MSB 1 -#define PHY_BB_PHYONLY_CONTROL_LATE_TX_SIGNAL_SYMBOL_LSB 1 -#define PHY_BB_PHYONLY_CONTROL_LATE_TX_SIGNAL_SYMBOL_MASK 0x00000002 -#define PHY_BB_PHYONLY_CONTROL_LATE_TX_SIGNAL_SYMBOL_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_PHYONLY_CONTROL_LATE_TX_SIGNAL_SYMBOL_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_PHYONLY_CONTROL_GENERATE_SCRAMBLER_MSB 2 -#define PHY_BB_PHYONLY_CONTROL_GENERATE_SCRAMBLER_LSB 2 -#define PHY_BB_PHYONLY_CONTROL_GENERATE_SCRAMBLER_MASK 0x00000004 -#define PHY_BB_PHYONLY_CONTROL_GENERATE_SCRAMBLER_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_BB_PHYONLY_CONTROL_GENERATE_SCRAMBLER_SET(x) (((x) << 2) & 0x00000004) -#define PHY_BB_PHYONLY_CONTROL_TX_ANTENNA_SELECT_MSB 3 -#define PHY_BB_PHYONLY_CONTROL_TX_ANTENNA_SELECT_LSB 3 -#define PHY_BB_PHYONLY_CONTROL_TX_ANTENNA_SELECT_MASK 0x00000008 -#define PHY_BB_PHYONLY_CONTROL_TX_ANTENNA_SELECT_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_BB_PHYONLY_CONTROL_TX_ANTENNA_SELECT_SET(x) (((x) << 3) & 0x00000008) -#define PHY_BB_PHYONLY_CONTROL_STATIC_TX_ANTENNA_MSB 4 -#define PHY_BB_PHYONLY_CONTROL_STATIC_TX_ANTENNA_LSB 4 -#define PHY_BB_PHYONLY_CONTROL_STATIC_TX_ANTENNA_MASK 0x00000010 -#define PHY_BB_PHYONLY_CONTROL_STATIC_TX_ANTENNA_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_BB_PHYONLY_CONTROL_STATIC_TX_ANTENNA_SET(x) (((x) << 4) & 0x00000010) -#define PHY_BB_PHYONLY_CONTROL_RX_ANTENNA_SELECT_MSB 5 -#define PHY_BB_PHYONLY_CONTROL_RX_ANTENNA_SELECT_LSB 5 -#define PHY_BB_PHYONLY_CONTROL_RX_ANTENNA_SELECT_MASK 0x00000020 -#define PHY_BB_PHYONLY_CONTROL_RX_ANTENNA_SELECT_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_BB_PHYONLY_CONTROL_RX_ANTENNA_SELECT_SET(x) (((x) << 5) & 0x00000020) -#define PHY_BB_PHYONLY_CONTROL_STATIC_RX_ANTENNA_MSB 6 -#define PHY_BB_PHYONLY_CONTROL_STATIC_RX_ANTENNA_LSB 6 -#define PHY_BB_PHYONLY_CONTROL_STATIC_RX_ANTENNA_MASK 0x00000040 -#define PHY_BB_PHYONLY_CONTROL_STATIC_RX_ANTENNA_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_BB_PHYONLY_CONTROL_STATIC_RX_ANTENNA_SET(x) (((x) << 6) & 0x00000040) -#define PHY_BB_PHYONLY_CONTROL_EN_LOW_FREQ_SLEEP_MSB 7 -#define PHY_BB_PHYONLY_CONTROL_EN_LOW_FREQ_SLEEP_LSB 7 -#define PHY_BB_PHYONLY_CONTROL_EN_LOW_FREQ_SLEEP_MASK 0x00000080 -#define PHY_BB_PHYONLY_CONTROL_EN_LOW_FREQ_SLEEP_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_BB_PHYONLY_CONTROL_EN_LOW_FREQ_SLEEP_SET(x) (((x) << 7) & 0x00000080) - -/* macros for BB_powertx_rate1 */ -#define PHY_BB_POWERTX_RATE1_ADDRESS 0x00009934 -#define PHY_BB_POWERTX_RATE1_OFFSET 0x00009934 -#define PHY_BB_POWERTX_RATE1_POWERTX_0_MSB 5 -#define PHY_BB_POWERTX_RATE1_POWERTX_0_LSB 0 -#define PHY_BB_POWERTX_RATE1_POWERTX_0_MASK 0x0000003f -#define PHY_BB_POWERTX_RATE1_POWERTX_0_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_POWERTX_RATE1_POWERTX_0_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_POWERTX_RATE1_POWERTX_1_MSB 13 -#define PHY_BB_POWERTX_RATE1_POWERTX_1_LSB 8 -#define PHY_BB_POWERTX_RATE1_POWERTX_1_MASK 0x00003f00 -#define PHY_BB_POWERTX_RATE1_POWERTX_1_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_POWERTX_RATE1_POWERTX_1_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_POWERTX_RATE1_POWERTX_2_MSB 21 -#define PHY_BB_POWERTX_RATE1_POWERTX_2_LSB 16 -#define PHY_BB_POWERTX_RATE1_POWERTX_2_MASK 0x003f0000 -#define PHY_BB_POWERTX_RATE1_POWERTX_2_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_POWERTX_RATE1_POWERTX_2_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_POWERTX_RATE1_POWERTX_3_MSB 29 -#define PHY_BB_POWERTX_RATE1_POWERTX_3_LSB 24 -#define PHY_BB_POWERTX_RATE1_POWERTX_3_MASK 0x3f000000 -#define PHY_BB_POWERTX_RATE1_POWERTX_3_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_BB_POWERTX_RATE1_POWERTX_3_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for BB_powertx_rate2 */ -#define PHY_BB_POWERTX_RATE2_ADDRESS 0x00009938 -#define PHY_BB_POWERTX_RATE2_OFFSET 0x00009938 -#define PHY_BB_POWERTX_RATE2_POWERTX_4_MSB 5 -#define PHY_BB_POWERTX_RATE2_POWERTX_4_LSB 0 -#define PHY_BB_POWERTX_RATE2_POWERTX_4_MASK 0x0000003f -#define PHY_BB_POWERTX_RATE2_POWERTX_4_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_POWERTX_RATE2_POWERTX_4_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_POWERTX_RATE2_POWERTX_5_MSB 13 -#define PHY_BB_POWERTX_RATE2_POWERTX_5_LSB 8 -#define PHY_BB_POWERTX_RATE2_POWERTX_5_MASK 0x00003f00 -#define PHY_BB_POWERTX_RATE2_POWERTX_5_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_POWERTX_RATE2_POWERTX_5_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_POWERTX_RATE2_POWERTX_6_MSB 21 -#define PHY_BB_POWERTX_RATE2_POWERTX_6_LSB 16 -#define PHY_BB_POWERTX_RATE2_POWERTX_6_MASK 0x003f0000 -#define PHY_BB_POWERTX_RATE2_POWERTX_6_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_POWERTX_RATE2_POWERTX_6_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_POWERTX_RATE2_POWERTX_7_MSB 29 -#define PHY_BB_POWERTX_RATE2_POWERTX_7_LSB 24 -#define PHY_BB_POWERTX_RATE2_POWERTX_7_MASK 0x3f000000 -#define PHY_BB_POWERTX_RATE2_POWERTX_7_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_BB_POWERTX_RATE2_POWERTX_7_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for BB_powertx_max */ -#define PHY_BB_POWERTX_MAX_ADDRESS 0x0000993c -#define PHY_BB_POWERTX_MAX_OFFSET 0x0000993c -#define PHY_BB_POWERTX_MAX_USE_PER_PACKET_POWERTX_MAX_MSB 6 -#define PHY_BB_POWERTX_MAX_USE_PER_PACKET_POWERTX_MAX_LSB 6 -#define PHY_BB_POWERTX_MAX_USE_PER_PACKET_POWERTX_MAX_MASK 0x00000040 -#define PHY_BB_POWERTX_MAX_USE_PER_PACKET_POWERTX_MAX_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_BB_POWERTX_MAX_USE_PER_PACKET_POWERTX_MAX_SET(x) (((x) << 6) & 0x00000040) - -/* macros for BB_extension_radar */ -#define PHY_BB_EXTENSION_RADAR_ADDRESS 0x00009940 -#define PHY_BB_EXTENSION_RADAR_OFFSET 0x00009940 -#define PHY_BB_EXTENSION_RADAR_BLOCKER40_MAX_RADAR_MSB 13 -#define PHY_BB_EXTENSION_RADAR_BLOCKER40_MAX_RADAR_LSB 8 -#define PHY_BB_EXTENSION_RADAR_BLOCKER40_MAX_RADAR_MASK 0x00003f00 -#define PHY_BB_EXTENSION_RADAR_BLOCKER40_MAX_RADAR_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_EXTENSION_RADAR_BLOCKER40_MAX_RADAR_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_EXTENSION_RADAR_ENABLE_EXT_RADAR_MSB 14 -#define PHY_BB_EXTENSION_RADAR_ENABLE_EXT_RADAR_LSB 14 -#define PHY_BB_EXTENSION_RADAR_ENABLE_EXT_RADAR_MASK 0x00004000 -#define PHY_BB_EXTENSION_RADAR_ENABLE_EXT_RADAR_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_BB_EXTENSION_RADAR_ENABLE_EXT_RADAR_SET(x) (((x) << 14) & 0x00004000) -#define PHY_BB_EXTENSION_RADAR_RADAR_DC_PWR_THRESH_MSB 22 -#define PHY_BB_EXTENSION_RADAR_RADAR_DC_PWR_THRESH_LSB 15 -#define PHY_BB_EXTENSION_RADAR_RADAR_DC_PWR_THRESH_MASK 0x007f8000 -#define PHY_BB_EXTENSION_RADAR_RADAR_DC_PWR_THRESH_GET(x) (((x) & 0x007f8000) >> 15) -#define PHY_BB_EXTENSION_RADAR_RADAR_DC_PWR_THRESH_SET(x) (((x) << 15) & 0x007f8000) -#define PHY_BB_EXTENSION_RADAR_RADAR_LB_DC_CAP_MSB 30 -#define PHY_BB_EXTENSION_RADAR_RADAR_LB_DC_CAP_LSB 23 -#define PHY_BB_EXTENSION_RADAR_RADAR_LB_DC_CAP_MASK 0x7f800000 -#define PHY_BB_EXTENSION_RADAR_RADAR_LB_DC_CAP_GET(x) (((x) & 0x7f800000) >> 23) -#define PHY_BB_EXTENSION_RADAR_RADAR_LB_DC_CAP_SET(x) (((x) << 23) & 0x7f800000) -#define PHY_BB_EXTENSION_RADAR_DISABLE_ADCSAT_HOLD_MSB 31 -#define PHY_BB_EXTENSION_RADAR_DISABLE_ADCSAT_HOLD_LSB 31 -#define PHY_BB_EXTENSION_RADAR_DISABLE_ADCSAT_HOLD_MASK 0x80000000 -#define PHY_BB_EXTENSION_RADAR_DISABLE_ADCSAT_HOLD_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_EXTENSION_RADAR_DISABLE_ADCSAT_HOLD_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_frame_control */ -#define PHY_BB_FRAME_CONTROL_ADDRESS 0x00009944 -#define PHY_BB_FRAME_CONTROL_OFFSET 0x00009944 -#define PHY_BB_FRAME_CONTROL_CF_OVERLAP_WINDOW_MSB 1 -#define PHY_BB_FRAME_CONTROL_CF_OVERLAP_WINDOW_LSB 0 -#define PHY_BB_FRAME_CONTROL_CF_OVERLAP_WINDOW_MASK 0x00000003 -#define PHY_BB_FRAME_CONTROL_CF_OVERLAP_WINDOW_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_BB_FRAME_CONTROL_CF_OVERLAP_WINDOW_SET(x) (((x) << 0) & 0x00000003) -#define PHY_BB_FRAME_CONTROL_CF_SCALE_SHORT_MSB 2 -#define PHY_BB_FRAME_CONTROL_CF_SCALE_SHORT_LSB 2 -#define PHY_BB_FRAME_CONTROL_CF_SCALE_SHORT_MASK 0x00000004 -#define PHY_BB_FRAME_CONTROL_CF_SCALE_SHORT_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_BB_FRAME_CONTROL_CF_SCALE_SHORT_SET(x) (((x) << 2) & 0x00000004) -#define PHY_BB_FRAME_CONTROL_CF_TX_CLIP_MSB 5 -#define PHY_BB_FRAME_CONTROL_CF_TX_CLIP_LSB 3 -#define PHY_BB_FRAME_CONTROL_CF_TX_CLIP_MASK 0x00000038 -#define PHY_BB_FRAME_CONTROL_CF_TX_CLIP_GET(x) (((x) & 0x00000038) >> 3) -#define PHY_BB_FRAME_CONTROL_CF_TX_CLIP_SET(x) (((x) << 3) & 0x00000038) -#define PHY_BB_FRAME_CONTROL_CF_TX_DOUBLESAMP_DAC_MSB 7 -#define PHY_BB_FRAME_CONTROL_CF_TX_DOUBLESAMP_DAC_LSB 6 -#define PHY_BB_FRAME_CONTROL_CF_TX_DOUBLESAMP_DAC_MASK 0x000000c0 -#define PHY_BB_FRAME_CONTROL_CF_TX_DOUBLESAMP_DAC_GET(x) (((x) & 0x000000c0) >> 6) -#define PHY_BB_FRAME_CONTROL_CF_TX_DOUBLESAMP_DAC_SET(x) (((x) << 6) & 0x000000c0) -#define PHY_BB_FRAME_CONTROL_TX_END_ADJUST_MSB 15 -#define PHY_BB_FRAME_CONTROL_TX_END_ADJUST_LSB 8 -#define PHY_BB_FRAME_CONTROL_TX_END_ADJUST_MASK 0x0000ff00 -#define PHY_BB_FRAME_CONTROL_TX_END_ADJUST_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_FRAME_CONTROL_TX_END_ADJUST_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_FRAME_CONTROL_PREPEND_CHAN_INFO_MSB 16 -#define PHY_BB_FRAME_CONTROL_PREPEND_CHAN_INFO_LSB 16 -#define PHY_BB_FRAME_CONTROL_PREPEND_CHAN_INFO_MASK 0x00010000 -#define PHY_BB_FRAME_CONTROL_PREPEND_CHAN_INFO_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_BB_FRAME_CONTROL_PREPEND_CHAN_INFO_SET(x) (((x) << 16) & 0x00010000) -#define PHY_BB_FRAME_CONTROL_SHORT_HIGH_PAR_NORM_MSB 17 -#define PHY_BB_FRAME_CONTROL_SHORT_HIGH_PAR_NORM_LSB 17 -#define PHY_BB_FRAME_CONTROL_SHORT_HIGH_PAR_NORM_MASK 0x00020000 -#define PHY_BB_FRAME_CONTROL_SHORT_HIGH_PAR_NORM_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_BB_FRAME_CONTROL_SHORT_HIGH_PAR_NORM_SET(x) (((x) << 17) & 0x00020000) -#define PHY_BB_FRAME_CONTROL_EN_ERR_GREEN_FIELD_MSB 18 -#define PHY_BB_FRAME_CONTROL_EN_ERR_GREEN_FIELD_LSB 18 -#define PHY_BB_FRAME_CONTROL_EN_ERR_GREEN_FIELD_MASK 0x00040000 -#define PHY_BB_FRAME_CONTROL_EN_ERR_GREEN_FIELD_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_BB_FRAME_CONTROL_EN_ERR_GREEN_FIELD_SET(x) (((x) << 18) & 0x00040000) -#define PHY_BB_FRAME_CONTROL_EN_ERR_XR_POWER_RATIO_MSB 19 -#define PHY_BB_FRAME_CONTROL_EN_ERR_XR_POWER_RATIO_LSB 19 -#define PHY_BB_FRAME_CONTROL_EN_ERR_XR_POWER_RATIO_MASK 0x00080000 -#define PHY_BB_FRAME_CONTROL_EN_ERR_XR_POWER_RATIO_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_BB_FRAME_CONTROL_EN_ERR_XR_POWER_RATIO_SET(x) (((x) << 19) & 0x00080000) -#define PHY_BB_FRAME_CONTROL_EN_ERR_OFDM_XCORR_MSB 20 -#define PHY_BB_FRAME_CONTROL_EN_ERR_OFDM_XCORR_LSB 20 -#define PHY_BB_FRAME_CONTROL_EN_ERR_OFDM_XCORR_MASK 0x00100000 -#define PHY_BB_FRAME_CONTROL_EN_ERR_OFDM_XCORR_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_BB_FRAME_CONTROL_EN_ERR_OFDM_XCORR_SET(x) (((x) << 20) & 0x00100000) -#define PHY_BB_FRAME_CONTROL_EN_ERR_LONG_SC_THR_MSB 21 -#define PHY_BB_FRAME_CONTROL_EN_ERR_LONG_SC_THR_LSB 21 -#define PHY_BB_FRAME_CONTROL_EN_ERR_LONG_SC_THR_MASK 0x00200000 -#define PHY_BB_FRAME_CONTROL_EN_ERR_LONG_SC_THR_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_BB_FRAME_CONTROL_EN_ERR_LONG_SC_THR_SET(x) (((x) << 21) & 0x00200000) -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_LONG1_MSB 22 -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_LONG1_LSB 22 -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_LONG1_MASK 0x00400000 -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_LONG1_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_LONG1_SET(x) (((x) << 22) & 0x00400000) -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_EARLY_TRIG_MSB 23 -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_EARLY_TRIG_LSB 23 -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_EARLY_TRIG_MASK 0x00800000 -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_EARLY_TRIG_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_EARLY_TRIG_SET(x) (((x) << 23) & 0x00800000) -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_TIMEOUT_MSB 24 -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_TIMEOUT_LSB 24 -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_TIMEOUT_MASK 0x01000000 -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_TIMEOUT_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_BB_FRAME_CONTROL_EN_ERR_TIM_TIMEOUT_SET(x) (((x) << 24) & 0x01000000) -#define PHY_BB_FRAME_CONTROL_EN_ERR_SIGNAL_PARITY_MSB 25 -#define PHY_BB_FRAME_CONTROL_EN_ERR_SIGNAL_PARITY_LSB 25 -#define PHY_BB_FRAME_CONTROL_EN_ERR_SIGNAL_PARITY_MASK 0x02000000 -#define PHY_BB_FRAME_CONTROL_EN_ERR_SIGNAL_PARITY_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_BB_FRAME_CONTROL_EN_ERR_SIGNAL_PARITY_SET(x) (((x) << 25) & 0x02000000) -#define PHY_BB_FRAME_CONTROL_EN_ERR_RATE_ILLEGAL_MSB 26 -#define PHY_BB_FRAME_CONTROL_EN_ERR_RATE_ILLEGAL_LSB 26 -#define PHY_BB_FRAME_CONTROL_EN_ERR_RATE_ILLEGAL_MASK 0x04000000 -#define PHY_BB_FRAME_CONTROL_EN_ERR_RATE_ILLEGAL_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_BB_FRAME_CONTROL_EN_ERR_RATE_ILLEGAL_SET(x) (((x) << 26) & 0x04000000) -#define PHY_BB_FRAME_CONTROL_EN_ERR_LENGTH_ILLEGAL_MSB 27 -#define PHY_BB_FRAME_CONTROL_EN_ERR_LENGTH_ILLEGAL_LSB 27 -#define PHY_BB_FRAME_CONTROL_EN_ERR_LENGTH_ILLEGAL_MASK 0x08000000 -#define PHY_BB_FRAME_CONTROL_EN_ERR_LENGTH_ILLEGAL_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_BB_FRAME_CONTROL_EN_ERR_LENGTH_ILLEGAL_SET(x) (((x) << 27) & 0x08000000) -#define PHY_BB_FRAME_CONTROL_EN_ERR_HT_SERVICE_MSB 28 -#define PHY_BB_FRAME_CONTROL_EN_ERR_HT_SERVICE_LSB 28 -#define PHY_BB_FRAME_CONTROL_EN_ERR_HT_SERVICE_MASK 0x10000000 -#define PHY_BB_FRAME_CONTROL_EN_ERR_HT_SERVICE_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_BB_FRAME_CONTROL_EN_ERR_HT_SERVICE_SET(x) (((x) << 28) & 0x10000000) -#define PHY_BB_FRAME_CONTROL_EN_ERR_SERVICE_MSB 29 -#define PHY_BB_FRAME_CONTROL_EN_ERR_SERVICE_LSB 29 -#define PHY_BB_FRAME_CONTROL_EN_ERR_SERVICE_MASK 0x20000000 -#define PHY_BB_FRAME_CONTROL_EN_ERR_SERVICE_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_BB_FRAME_CONTROL_EN_ERR_SERVICE_SET(x) (((x) << 29) & 0x20000000) -#define PHY_BB_FRAME_CONTROL_EN_ERR_TX_UNDERRUN_MSB 30 -#define PHY_BB_FRAME_CONTROL_EN_ERR_TX_UNDERRUN_LSB 30 -#define PHY_BB_FRAME_CONTROL_EN_ERR_TX_UNDERRUN_MASK 0x40000000 -#define PHY_BB_FRAME_CONTROL_EN_ERR_TX_UNDERRUN_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_FRAME_CONTROL_EN_ERR_TX_UNDERRUN_SET(x) (((x) << 30) & 0x40000000) -#define PHY_BB_FRAME_CONTROL_EN_ERR_RX_ABORT_MSB 31 -#define PHY_BB_FRAME_CONTROL_EN_ERR_RX_ABORT_LSB 31 -#define PHY_BB_FRAME_CONTROL_EN_ERR_RX_ABORT_MASK 0x80000000 -#define PHY_BB_FRAME_CONTROL_EN_ERR_RX_ABORT_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_FRAME_CONTROL_EN_ERR_RX_ABORT_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_timing_control_6 */ -#define PHY_BB_TIMING_CONTROL_6_ADDRESS 0x00009948 -#define PHY_BB_TIMING_CONTROL_6_OFFSET 0x00009948 -#define PHY_BB_TIMING_CONTROL_6_HI_RSSI_THRESH_MSB 7 -#define PHY_BB_TIMING_CONTROL_6_HI_RSSI_THRESH_LSB 0 -#define PHY_BB_TIMING_CONTROL_6_HI_RSSI_THRESH_MASK 0x000000ff -#define PHY_BB_TIMING_CONTROL_6_HI_RSSI_THRESH_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_TIMING_CONTROL_6_HI_RSSI_THRESH_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_TIMING_CONTROL_6_EARLY_TRIGGER_THR_HI_RSSI_MSB 14 -#define PHY_BB_TIMING_CONTROL_6_EARLY_TRIGGER_THR_HI_RSSI_LSB 8 -#define PHY_BB_TIMING_CONTROL_6_EARLY_TRIGGER_THR_HI_RSSI_MASK 0x00007f00 -#define PHY_BB_TIMING_CONTROL_6_EARLY_TRIGGER_THR_HI_RSSI_GET(x) (((x) & 0x00007f00) >> 8) -#define PHY_BB_TIMING_CONTROL_6_EARLY_TRIGGER_THR_HI_RSSI_SET(x) (((x) << 8) & 0x00007f00) -#define PHY_BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_MSB 20 -#define PHY_BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_LSB 15 -#define PHY_BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_MASK 0x001f8000 -#define PHY_BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_GET(x) (((x) & 0x001f8000) >> 15) -#define PHY_BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_SET(x) (((x) << 15) & 0x001f8000) -#define PHY_BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_HI_RSSI_MSB 27 -#define PHY_BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_HI_RSSI_LSB 21 -#define PHY_BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_HI_RSSI_MASK 0x0fe00000 -#define PHY_BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_HI_RSSI_GET(x) (((x) & 0x0fe00000) >> 21) -#define PHY_BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_HI_RSSI_SET(x) (((x) << 21) & 0x0fe00000) -#define PHY_BB_TIMING_CONTROL_6_LONG_MEDIUM_RATIO_THR_MSB 31 -#define PHY_BB_TIMING_CONTROL_6_LONG_MEDIUM_RATIO_THR_LSB 28 -#define PHY_BB_TIMING_CONTROL_6_LONG_MEDIUM_RATIO_THR_MASK 0xf0000000 -#define PHY_BB_TIMING_CONTROL_6_LONG_MEDIUM_RATIO_THR_GET(x) (((x) & 0xf0000000) >> 28) -#define PHY_BB_TIMING_CONTROL_6_LONG_MEDIUM_RATIO_THR_SET(x) (((x) << 28) & 0xf0000000) - -/* macros for BB_spur_mask_controls */ -#define PHY_BB_SPUR_MASK_CONTROLS_ADDRESS 0x0000994c -#define PHY_BB_SPUR_MASK_CONTROLS_OFFSET 0x0000994c -#define PHY_BB_SPUR_MASK_CONTROLS_SPUR_RSSI_THRESH_MSB 7 -#define PHY_BB_SPUR_MASK_CONTROLS_SPUR_RSSI_THRESH_LSB 0 -#define PHY_BB_SPUR_MASK_CONTROLS_SPUR_RSSI_THRESH_MASK 0x000000ff -#define PHY_BB_SPUR_MASK_CONTROLS_SPUR_RSSI_THRESH_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_SPUR_MASK_CONTROLS_SPUR_RSSI_THRESH_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_SPUR_MASK_CONTROLS_EN_VIT_SPUR_RSSI_MSB 8 -#define PHY_BB_SPUR_MASK_CONTROLS_EN_VIT_SPUR_RSSI_LSB 8 -#define PHY_BB_SPUR_MASK_CONTROLS_EN_VIT_SPUR_RSSI_MASK 0x00000100 -#define PHY_BB_SPUR_MASK_CONTROLS_EN_VIT_SPUR_RSSI_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_BB_SPUR_MASK_CONTROLS_EN_VIT_SPUR_RSSI_SET(x) (((x) << 8) & 0x00000100) -#define PHY_BB_SPUR_MASK_CONTROLS_ENABLE_MASK_PPM_MSB 17 -#define PHY_BB_SPUR_MASK_CONTROLS_ENABLE_MASK_PPM_LSB 17 -#define PHY_BB_SPUR_MASK_CONTROLS_ENABLE_MASK_PPM_MASK 0x00020000 -#define PHY_BB_SPUR_MASK_CONTROLS_ENABLE_MASK_PPM_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_BB_SPUR_MASK_CONTROLS_ENABLE_MASK_PPM_SET(x) (((x) << 17) & 0x00020000) -#define PHY_BB_SPUR_MASK_CONTROLS_MASK_RATE_CNTL_MSB 25 -#define PHY_BB_SPUR_MASK_CONTROLS_MASK_RATE_CNTL_LSB 18 -#define PHY_BB_SPUR_MASK_CONTROLS_MASK_RATE_CNTL_MASK 0x03fc0000 -#define PHY_BB_SPUR_MASK_CONTROLS_MASK_RATE_CNTL_GET(x) (((x) & 0x03fc0000) >> 18) -#define PHY_BB_SPUR_MASK_CONTROLS_MASK_RATE_CNTL_SET(x) (((x) << 18) & 0x03fc0000) - -/* macros for BB_rx_iq_corr_b0 */ -#define PHY_BB_RX_IQ_CORR_B0_ADDRESS 0x00009950 -#define PHY_BB_RX_IQ_CORR_B0_OFFSET 0x00009950 -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_Q_Q_COFF_0_MSB 6 -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_Q_Q_COFF_0_LSB 0 -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_Q_Q_COFF_0_MASK 0x0000007f -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_Q_Q_COFF_0_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_Q_Q_COFF_0_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_Q_I_COFF_0_MSB 13 -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_Q_I_COFF_0_LSB 7 -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_Q_I_COFF_0_MASK 0x00003f80 -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_Q_I_COFF_0_GET(x) (((x) & 0x00003f80) >> 7) -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_Q_I_COFF_0_SET(x) (((x) << 7) & 0x00003f80) -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_ENABLE_MSB 14 -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_ENABLE_LSB 14 -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_ENABLE_MASK 0x00004000 -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_ENABLE_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_BB_RX_IQ_CORR_B0_RX_IQCORR_ENABLE_SET(x) (((x) << 14) & 0x00004000) -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_Q_COFF_0_MSB 21 -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_Q_COFF_0_LSB 15 -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_Q_COFF_0_MASK 0x003f8000 -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_Q_COFF_0_GET(x) (((x) & 0x003f8000) >> 15) -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_Q_COFF_0_SET(x) (((x) << 15) & 0x003f8000) -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_I_COFF_0_MSB 28 -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_I_COFF_0_LSB 22 -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_I_COFF_0_MASK 0x1fc00000 -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_I_COFF_0_GET(x) (((x) & 0x1fc00000) >> 22) -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_I_COFF_0_SET(x) (((x) << 22) & 0x1fc00000) -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_ENABLE_MSB 29 -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_ENABLE_LSB 29 -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_ENABLE_MASK 0x20000000 -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_ENABLE_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_ENABLE_SET(x) (((x) << 29) & 0x20000000) - -/* macros for BB_radar_detection */ -#define PHY_BB_RADAR_DETECTION_ADDRESS 0x00009954 -#define PHY_BB_RADAR_DETECTION_OFFSET 0x00009954 -#define PHY_BB_RADAR_DETECTION_PULSE_DETECT_ENABLE_MSB 0 -#define PHY_BB_RADAR_DETECTION_PULSE_DETECT_ENABLE_LSB 0 -#define PHY_BB_RADAR_DETECTION_PULSE_DETECT_ENABLE_MASK 0x00000001 -#define PHY_BB_RADAR_DETECTION_PULSE_DETECT_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_RADAR_DETECTION_PULSE_DETECT_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_RADAR_DETECTION_PULSE_IN_BAND_THRESH_MSB 5 -#define PHY_BB_RADAR_DETECTION_PULSE_IN_BAND_THRESH_LSB 1 -#define PHY_BB_RADAR_DETECTION_PULSE_IN_BAND_THRESH_MASK 0x0000003e -#define PHY_BB_RADAR_DETECTION_PULSE_IN_BAND_THRESH_GET(x) (((x) & 0x0000003e) >> 1) -#define PHY_BB_RADAR_DETECTION_PULSE_IN_BAND_THRESH_SET(x) (((x) << 1) & 0x0000003e) -#define PHY_BB_RADAR_DETECTION_PULSE_RSSI_THRESH_MSB 11 -#define PHY_BB_RADAR_DETECTION_PULSE_RSSI_THRESH_LSB 6 -#define PHY_BB_RADAR_DETECTION_PULSE_RSSI_THRESH_MASK 0x00000fc0 -#define PHY_BB_RADAR_DETECTION_PULSE_RSSI_THRESH_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_RADAR_DETECTION_PULSE_RSSI_THRESH_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_RADAR_DETECTION_PULSE_HEIGHT_THRESH_MSB 17 -#define PHY_BB_RADAR_DETECTION_PULSE_HEIGHT_THRESH_LSB 12 -#define PHY_BB_RADAR_DETECTION_PULSE_HEIGHT_THRESH_MASK 0x0003f000 -#define PHY_BB_RADAR_DETECTION_PULSE_HEIGHT_THRESH_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_BB_RADAR_DETECTION_PULSE_HEIGHT_THRESH_SET(x) (((x) << 12) & 0x0003f000) -#define PHY_BB_RADAR_DETECTION_RADAR_RSSI_THRESH_MSB 23 -#define PHY_BB_RADAR_DETECTION_RADAR_RSSI_THRESH_LSB 18 -#define PHY_BB_RADAR_DETECTION_RADAR_RSSI_THRESH_MASK 0x00fc0000 -#define PHY_BB_RADAR_DETECTION_RADAR_RSSI_THRESH_GET(x) (((x) & 0x00fc0000) >> 18) -#define PHY_BB_RADAR_DETECTION_RADAR_RSSI_THRESH_SET(x) (((x) << 18) & 0x00fc0000) -#define PHY_BB_RADAR_DETECTION_RADAR_FIRPWR_THRESH_MSB 30 -#define PHY_BB_RADAR_DETECTION_RADAR_FIRPWR_THRESH_LSB 24 -#define PHY_BB_RADAR_DETECTION_RADAR_FIRPWR_THRESH_MASK 0x7f000000 -#define PHY_BB_RADAR_DETECTION_RADAR_FIRPWR_THRESH_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_BB_RADAR_DETECTION_RADAR_FIRPWR_THRESH_SET(x) (((x) << 24) & 0x7f000000) -#define PHY_BB_RADAR_DETECTION_ENABLE_RADAR_FFT_MSB 31 -#define PHY_BB_RADAR_DETECTION_ENABLE_RADAR_FFT_LSB 31 -#define PHY_BB_RADAR_DETECTION_ENABLE_RADAR_FFT_MASK 0x80000000 -#define PHY_BB_RADAR_DETECTION_ENABLE_RADAR_FFT_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_RADAR_DETECTION_ENABLE_RADAR_FFT_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_radar_detection_2 */ -#define PHY_BB_RADAR_DETECTION_2_ADDRESS 0x00009958 -#define PHY_BB_RADAR_DETECTION_2_OFFSET 0x00009958 -#define PHY_BB_RADAR_DETECTION_2_RADAR_LENGTH_MAX_MSB 7 -#define PHY_BB_RADAR_DETECTION_2_RADAR_LENGTH_MAX_LSB 0 -#define PHY_BB_RADAR_DETECTION_2_RADAR_LENGTH_MAX_MASK 0x000000ff -#define PHY_BB_RADAR_DETECTION_2_RADAR_LENGTH_MAX_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_RADAR_DETECTION_2_RADAR_LENGTH_MAX_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_RADAR_DETECTION_2_PULSE_RELSTEP_THRESH_MSB 12 -#define PHY_BB_RADAR_DETECTION_2_PULSE_RELSTEP_THRESH_LSB 8 -#define PHY_BB_RADAR_DETECTION_2_PULSE_RELSTEP_THRESH_MASK 0x00001f00 -#define PHY_BB_RADAR_DETECTION_2_PULSE_RELSTEP_THRESH_GET(x) (((x) & 0x00001f00) >> 8) -#define PHY_BB_RADAR_DETECTION_2_PULSE_RELSTEP_THRESH_SET(x) (((x) << 8) & 0x00001f00) -#define PHY_BB_RADAR_DETECTION_2_ENABLE_PULSE_RELSTEP_CHECK_MSB 13 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_PULSE_RELSTEP_CHECK_LSB 13 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_PULSE_RELSTEP_CHECK_MASK 0x00002000 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_PULSE_RELSTEP_CHECK_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_BB_RADAR_DETECTION_2_ENABLE_PULSE_RELSTEP_CHECK_SET(x) (((x) << 13) & 0x00002000) -#define PHY_BB_RADAR_DETECTION_2_ENABLE_MAX_RADAR_RSSI_MSB 14 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_MAX_RADAR_RSSI_LSB 14 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_MAX_RADAR_RSSI_MASK 0x00004000 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_MAX_RADAR_RSSI_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_BB_RADAR_DETECTION_2_ENABLE_MAX_RADAR_RSSI_SET(x) (((x) << 14) & 0x00004000) -#define PHY_BB_RADAR_DETECTION_2_ENABLE_BLOCK_RADAR_CHECK_MSB 15 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_BLOCK_RADAR_CHECK_LSB 15 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_BLOCK_RADAR_CHECK_MASK 0x00008000 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_BLOCK_RADAR_CHECK_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_BB_RADAR_DETECTION_2_ENABLE_BLOCK_RADAR_CHECK_SET(x) (((x) << 15) & 0x00008000) -#define PHY_BB_RADAR_DETECTION_2_RADAR_RELPWR_THRESH_MSB 21 -#define PHY_BB_RADAR_DETECTION_2_RADAR_RELPWR_THRESH_LSB 16 -#define PHY_BB_RADAR_DETECTION_2_RADAR_RELPWR_THRESH_MASK 0x003f0000 -#define PHY_BB_RADAR_DETECTION_2_RADAR_RELPWR_THRESH_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_RADAR_DETECTION_2_RADAR_RELPWR_THRESH_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_RADAR_DETECTION_2_RADAR_USE_FIRPWR_128_MSB 22 -#define PHY_BB_RADAR_DETECTION_2_RADAR_USE_FIRPWR_128_LSB 22 -#define PHY_BB_RADAR_DETECTION_2_RADAR_USE_FIRPWR_128_MASK 0x00400000 -#define PHY_BB_RADAR_DETECTION_2_RADAR_USE_FIRPWR_128_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_BB_RADAR_DETECTION_2_RADAR_USE_FIRPWR_128_SET(x) (((x) << 22) & 0x00400000) -#define PHY_BB_RADAR_DETECTION_2_ENABLE_RADAR_RELPWR_CHECK_MSB 23 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_RADAR_RELPWR_CHECK_LSB 23 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_RADAR_RELPWR_CHECK_MASK 0x00800000 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_RADAR_RELPWR_CHECK_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_BB_RADAR_DETECTION_2_ENABLE_RADAR_RELPWR_CHECK_SET(x) (((x) << 23) & 0x00800000) -#define PHY_BB_RADAR_DETECTION_2_CF_RADAR_BIN_THRESH_SEL_MSB 26 -#define PHY_BB_RADAR_DETECTION_2_CF_RADAR_BIN_THRESH_SEL_LSB 24 -#define PHY_BB_RADAR_DETECTION_2_CF_RADAR_BIN_THRESH_SEL_MASK 0x07000000 -#define PHY_BB_RADAR_DETECTION_2_CF_RADAR_BIN_THRESH_SEL_GET(x) (((x) & 0x07000000) >> 24) -#define PHY_BB_RADAR_DETECTION_2_CF_RADAR_BIN_THRESH_SEL_SET(x) (((x) << 24) & 0x07000000) -#define PHY_BB_RADAR_DETECTION_2_ENABLE_PULSE_GC_COUNT_CHECK_MSB 27 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_PULSE_GC_COUNT_CHECK_LSB 27 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_PULSE_GC_COUNT_CHECK_MASK 0x08000000 -#define PHY_BB_RADAR_DETECTION_2_ENABLE_PULSE_GC_COUNT_CHECK_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_BB_RADAR_DETECTION_2_ENABLE_PULSE_GC_COUNT_CHECK_SET(x) (((x) << 27) & 0x08000000) - -/* macros for BB_tx_phase_ramp_b0 */ -#define PHY_BB_TX_PHASE_RAMP_B0_ADDRESS 0x0000995c -#define PHY_BB_TX_PHASE_RAMP_B0_OFFSET 0x0000995c -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ENABLE_0_MSB 0 -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ENABLE_0_LSB 0 -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ENABLE_0_MASK 0x00000001 -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ENABLE_0_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ENABLE_0_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_BIAS_0_MSB 6 -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_BIAS_0_LSB 1 -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_BIAS_0_MASK 0x0000007e -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_BIAS_0_GET(x) (((x) & 0x0000007e) >> 1) -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_BIAS_0_SET(x) (((x) << 1) & 0x0000007e) -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_INIT_0_MSB 16 -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_INIT_0_LSB 7 -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_INIT_0_MASK 0x0001ff80 -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_INIT_0_GET(x) (((x) & 0x0001ff80) >> 7) -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_INIT_0_SET(x) (((x) << 7) & 0x0001ff80) -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ALPHA_0_MSB 24 -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ALPHA_0_LSB 17 -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ALPHA_0_MASK 0x01fe0000 -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ALPHA_0_GET(x) (((x) & 0x01fe0000) >> 17) -#define PHY_BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ALPHA_0_SET(x) (((x) << 17) & 0x01fe0000) - -/* macros for BB_switch_table_chn_b0 */ -#define PHY_BB_SWITCH_TABLE_CHN_B0_ADDRESS 0x00009960 -#define PHY_BB_SWITCH_TABLE_CHN_B0_OFFSET 0x00009960 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_IDLE_0_MSB 1 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_IDLE_0_LSB 0 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_IDLE_0_MASK 0x00000003 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_IDLE_0_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_IDLE_0_SET(x) (((x) << 0) & 0x00000003) -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_T_0_MSB 3 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_T_0_LSB 2 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_T_0_MASK 0x0000000c -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_T_0_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_T_0_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_R_0_MSB 5 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_R_0_LSB 4 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_R_0_MASK 0x00000030 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_R_0_GET(x) (((x) & 0x00000030) >> 4) -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_R_0_SET(x) (((x) << 4) & 0x00000030) -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX1_0_MSB 7 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX1_0_LSB 6 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX1_0_MASK 0x000000c0 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX1_0_GET(x) (((x) & 0x000000c0) >> 6) -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX1_0_SET(x) (((x) << 6) & 0x000000c0) -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX12_0_MSB 9 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX12_0_LSB 8 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX12_0_MASK 0x00000300 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX12_0_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX12_0_SET(x) (((x) << 8) & 0x00000300) -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_B_0_MSB 11 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_B_0_LSB 10 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_B_0_MASK 0x00000c00 -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_B_0_GET(x) (((x) & 0x00000c00) >> 10) -#define PHY_BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_B_0_SET(x) (((x) << 10) & 0x00000c00) - -/* macros for BB_switch_table_com1 */ -#define PHY_BB_SWITCH_TABLE_COM1_ADDRESS 0x00009964 -#define PHY_BB_SWITCH_TABLE_COM1_OFFSET 0x00009964 -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_MSB 3 -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_LSB 0 -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_MASK 0x0000000f -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T1_MSB 7 -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T1_LSB 4 -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T1_MASK 0x000000f0 -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T1_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T1_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T2_MSB 11 -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T2_LSB 8 -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T2_MASK 0x00000f00 -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T2_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T2_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_B_MSB 15 -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_B_LSB 12 -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_B_MASK 0x0000f000 -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_B_GET(x) (((x) & 0x0000f000) >> 12) -#define PHY_BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_B_SET(x) (((x) << 12) & 0x0000f000) - -/* macros for BB_cca_ctrl_2_b0 */ -#define PHY_BB_CCA_CTRL_2_B0_ADDRESS 0x00009968 -#define PHY_BB_CCA_CTRL_2_B0_OFFSET 0x00009968 -#define PHY_BB_CCA_CTRL_2_B0_MINCCAPWR_THR_0_MSB 8 -#define PHY_BB_CCA_CTRL_2_B0_MINCCAPWR_THR_0_LSB 0 -#define PHY_BB_CCA_CTRL_2_B0_MINCCAPWR_THR_0_MASK 0x000001ff -#define PHY_BB_CCA_CTRL_2_B0_MINCCAPWR_THR_0_GET(x) (((x) & 0x000001ff) >> 0) -#define PHY_BB_CCA_CTRL_2_B0_MINCCAPWR_THR_0_SET(x) (((x) << 0) & 0x000001ff) -#define PHY_BB_CCA_CTRL_2_B0_ENABLE_MINCCAPWR_THR_MSB 9 -#define PHY_BB_CCA_CTRL_2_B0_ENABLE_MINCCAPWR_THR_LSB 9 -#define PHY_BB_CCA_CTRL_2_B0_ENABLE_MINCCAPWR_THR_MASK 0x00000200 -#define PHY_BB_CCA_CTRL_2_B0_ENABLE_MINCCAPWR_THR_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_BB_CCA_CTRL_2_B0_ENABLE_MINCCAPWR_THR_SET(x) (((x) << 9) & 0x00000200) -#define PHY_BB_CCA_CTRL_2_B0_NF_GAIN_COMP_0_MSB 17 -#define PHY_BB_CCA_CTRL_2_B0_NF_GAIN_COMP_0_LSB 10 -#define PHY_BB_CCA_CTRL_2_B0_NF_GAIN_COMP_0_MASK 0x0003fc00 -#define PHY_BB_CCA_CTRL_2_B0_NF_GAIN_COMP_0_GET(x) (((x) & 0x0003fc00) >> 10) -#define PHY_BB_CCA_CTRL_2_B0_NF_GAIN_COMP_0_SET(x) (((x) << 10) & 0x0003fc00) -#define PHY_BB_CCA_CTRL_2_B0_THRESH62_MODE_MSB 18 -#define PHY_BB_CCA_CTRL_2_B0_THRESH62_MODE_LSB 18 -#define PHY_BB_CCA_CTRL_2_B0_THRESH62_MODE_MASK 0x00040000 -#define PHY_BB_CCA_CTRL_2_B0_THRESH62_MODE_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_BB_CCA_CTRL_2_B0_THRESH62_MODE_SET(x) (((x) << 18) & 0x00040000) - -/* macros for BB_switch_table_com2 */ -#define PHY_BB_SWITCH_TABLE_COM2_ADDRESS 0x0000996c -#define PHY_BB_SWITCH_TABLE_COM2_OFFSET 0x0000996c -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1NXAL1_MSB 3 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1NXAL1_LSB 0 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1NXAL1_MASK 0x0000000f -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1NXAL1_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1NXAL1_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2NXAL1_MSB 7 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2NXAL1_LSB 4 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2NXAL1_MASK 0x000000f0 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2NXAL1_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2NXAL1_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1XAL1_MSB 11 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1XAL1_LSB 8 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1XAL1_MASK 0x00000f00 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1XAL1_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1XAL1_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2XAL1_MSB 15 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2XAL1_LSB 12 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2XAL1_MASK 0x0000f000 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2XAL1_GET(x) (((x) & 0x0000f000) >> 12) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2XAL1_SET(x) (((x) << 12) & 0x0000f000) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1NXAL2_MSB 19 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1NXAL2_LSB 16 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1NXAL2_MASK 0x000f0000 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1NXAL2_GET(x) (((x) & 0x000f0000) >> 16) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1NXAL2_SET(x) (((x) << 16) & 0x000f0000) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2NXAL2_MSB 23 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2NXAL2_LSB 20 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2NXAL2_MASK 0x00f00000 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2NXAL2_GET(x) (((x) & 0x00f00000) >> 20) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2NXAL2_SET(x) (((x) << 20) & 0x00f00000) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1XAL2_MSB 27 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1XAL2_LSB 24 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1XAL2_MASK 0x0f000000 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1XAL2_GET(x) (((x) & 0x0f000000) >> 24) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1XAL2_SET(x) (((x) << 24) & 0x0f000000) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2XAL2_MSB 31 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2XAL2_LSB 28 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2XAL2_MASK 0xf0000000 -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2XAL2_GET(x) (((x) & 0xf0000000) >> 28) -#define PHY_BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2XAL2_SET(x) (((x) << 28) & 0xf0000000) - -/* macros for BB_restart */ -#define PHY_BB_RESTART_ADDRESS 0x00009970 -#define PHY_BB_RESTART_OFFSET 0x00009970 -#define PHY_BB_RESTART_ENABLE_RESTART_MSB 0 -#define PHY_BB_RESTART_ENABLE_RESTART_LSB 0 -#define PHY_BB_RESTART_ENABLE_RESTART_MASK 0x00000001 -#define PHY_BB_RESTART_ENABLE_RESTART_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_RESTART_ENABLE_RESTART_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_RESTART_RESTART_LGFIRPWR_DELTA_MSB 5 -#define PHY_BB_RESTART_RESTART_LGFIRPWR_DELTA_LSB 1 -#define PHY_BB_RESTART_RESTART_LGFIRPWR_DELTA_MASK 0x0000003e -#define PHY_BB_RESTART_RESTART_LGFIRPWR_DELTA_GET(x) (((x) & 0x0000003e) >> 1) -#define PHY_BB_RESTART_RESTART_LGFIRPWR_DELTA_SET(x) (((x) << 1) & 0x0000003e) -#define PHY_BB_RESTART_ENABLE_PWR_DROP_ERR_MSB 6 -#define PHY_BB_RESTART_ENABLE_PWR_DROP_ERR_LSB 6 -#define PHY_BB_RESTART_ENABLE_PWR_DROP_ERR_MASK 0x00000040 -#define PHY_BB_RESTART_ENABLE_PWR_DROP_ERR_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_BB_RESTART_ENABLE_PWR_DROP_ERR_SET(x) (((x) << 6) & 0x00000040) -#define PHY_BB_RESTART_PWRDROP_LGFIRPWR_DELTA_MSB 11 -#define PHY_BB_RESTART_PWRDROP_LGFIRPWR_DELTA_LSB 7 -#define PHY_BB_RESTART_PWRDROP_LGFIRPWR_DELTA_MASK 0x00000f80 -#define PHY_BB_RESTART_PWRDROP_LGFIRPWR_DELTA_GET(x) (((x) & 0x00000f80) >> 7) -#define PHY_BB_RESTART_PWRDROP_LGFIRPWR_DELTA_SET(x) (((x) << 7) & 0x00000f80) -#define PHY_BB_RESTART_OFDM_CCK_RSSI_BIAS_MSB 17 -#define PHY_BB_RESTART_OFDM_CCK_RSSI_BIAS_LSB 12 -#define PHY_BB_RESTART_OFDM_CCK_RSSI_BIAS_MASK 0x0003f000 -#define PHY_BB_RESTART_OFDM_CCK_RSSI_BIAS_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_BB_RESTART_OFDM_CCK_RSSI_BIAS_SET(x) (((x) << 12) & 0x0003f000) -#define PHY_BB_RESTART_ANT_FAST_DIV_GC_LIMIT_MSB 20 -#define PHY_BB_RESTART_ANT_FAST_DIV_GC_LIMIT_LSB 18 -#define PHY_BB_RESTART_ANT_FAST_DIV_GC_LIMIT_MASK 0x001c0000 -#define PHY_BB_RESTART_ANT_FAST_DIV_GC_LIMIT_GET(x) (((x) & 0x001c0000) >> 18) -#define PHY_BB_RESTART_ANT_FAST_DIV_GC_LIMIT_SET(x) (((x) << 18) & 0x001c0000) -#define PHY_BB_RESTART_ENABLE_ANT_FAST_DIV_M2FLAG_MSB 21 -#define PHY_BB_RESTART_ENABLE_ANT_FAST_DIV_M2FLAG_LSB 21 -#define PHY_BB_RESTART_ENABLE_ANT_FAST_DIV_M2FLAG_MASK 0x00200000 -#define PHY_BB_RESTART_ENABLE_ANT_FAST_DIV_M2FLAG_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_BB_RESTART_ENABLE_ANT_FAST_DIV_M2FLAG_SET(x) (((x) << 21) & 0x00200000) -#define PHY_BB_RESTART_WEAK_RSSI_VOTE_THR_MSB 28 -#define PHY_BB_RESTART_WEAK_RSSI_VOTE_THR_LSB 22 -#define PHY_BB_RESTART_WEAK_RSSI_VOTE_THR_MASK 0x1fc00000 -#define PHY_BB_RESTART_WEAK_RSSI_VOTE_THR_GET(x) (((x) & 0x1fc00000) >> 22) -#define PHY_BB_RESTART_WEAK_RSSI_VOTE_THR_SET(x) (((x) << 22) & 0x1fc00000) -#define PHY_BB_RESTART_ENABLE_PWR_DROP_ERR_CCK_MSB 29 -#define PHY_BB_RESTART_ENABLE_PWR_DROP_ERR_CCK_LSB 29 -#define PHY_BB_RESTART_ENABLE_PWR_DROP_ERR_CCK_MASK 0x20000000 -#define PHY_BB_RESTART_ENABLE_PWR_DROP_ERR_CCK_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_BB_RESTART_ENABLE_PWR_DROP_ERR_CCK_SET(x) (((x) << 29) & 0x20000000) -#define PHY_BB_RESTART_DISABLE_DC_RESTART_MSB 30 -#define PHY_BB_RESTART_DISABLE_DC_RESTART_LSB 30 -#define PHY_BB_RESTART_DISABLE_DC_RESTART_MASK 0x40000000 -#define PHY_BB_RESTART_DISABLE_DC_RESTART_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_RESTART_DISABLE_DC_RESTART_SET(x) (((x) << 30) & 0x40000000) -#define PHY_BB_RESTART_RESTART_MODE_BW40_MSB 31 -#define PHY_BB_RESTART_RESTART_MODE_BW40_LSB 31 -#define PHY_BB_RESTART_RESTART_MODE_BW40_MASK 0x80000000 -#define PHY_BB_RESTART_RESTART_MODE_BW40_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_RESTART_RESTART_MODE_BW40_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_scrambler_seed */ -#define PHY_BB_SCRAMBLER_SEED_ADDRESS 0x00009978 -#define PHY_BB_SCRAMBLER_SEED_OFFSET 0x00009978 -#define PHY_BB_SCRAMBLER_SEED_FIXED_SCRAMBLER_SEED_MSB 6 -#define PHY_BB_SCRAMBLER_SEED_FIXED_SCRAMBLER_SEED_LSB 0 -#define PHY_BB_SCRAMBLER_SEED_FIXED_SCRAMBLER_SEED_MASK 0x0000007f -#define PHY_BB_SCRAMBLER_SEED_FIXED_SCRAMBLER_SEED_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_BB_SCRAMBLER_SEED_FIXED_SCRAMBLER_SEED_SET(x) (((x) << 0) & 0x0000007f) - -/* macros for BB_rfbus_request */ -#define PHY_BB_RFBUS_REQUEST_ADDRESS 0x0000997c -#define PHY_BB_RFBUS_REQUEST_OFFSET 0x0000997c -#define PHY_BB_RFBUS_REQUEST_RFBUS_REQUEST_MSB 0 -#define PHY_BB_RFBUS_REQUEST_RFBUS_REQUEST_LSB 0 -#define PHY_BB_RFBUS_REQUEST_RFBUS_REQUEST_MASK 0x00000001 -#define PHY_BB_RFBUS_REQUEST_RFBUS_REQUEST_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_RFBUS_REQUEST_RFBUS_REQUEST_SET(x) (((x) << 0) & 0x00000001) - -/* macros for BB_timing_control_11 */ -#define PHY_BB_TIMING_CONTROL_11_ADDRESS 0x000099a0 -#define PHY_BB_TIMING_CONTROL_11_OFFSET 0x000099a0 -#define PHY_BB_TIMING_CONTROL_11_SPUR_DELTA_PHASE_MSB 19 -#define PHY_BB_TIMING_CONTROL_11_SPUR_DELTA_PHASE_LSB 0 -#define PHY_BB_TIMING_CONTROL_11_SPUR_DELTA_PHASE_MASK 0x000fffff -#define PHY_BB_TIMING_CONTROL_11_SPUR_DELTA_PHASE_GET(x) (((x) & 0x000fffff) >> 0) -#define PHY_BB_TIMING_CONTROL_11_SPUR_DELTA_PHASE_SET(x) (((x) << 0) & 0x000fffff) -#define PHY_BB_TIMING_CONTROL_11_SPUR_FREQ_SD_MSB 29 -#define PHY_BB_TIMING_CONTROL_11_SPUR_FREQ_SD_LSB 20 -#define PHY_BB_TIMING_CONTROL_11_SPUR_FREQ_SD_MASK 0x3ff00000 -#define PHY_BB_TIMING_CONTROL_11_SPUR_FREQ_SD_GET(x) (((x) & 0x3ff00000) >> 20) -#define PHY_BB_TIMING_CONTROL_11_SPUR_FREQ_SD_SET(x) (((x) << 20) & 0x3ff00000) -#define PHY_BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_AGC_MSB 30 -#define PHY_BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_AGC_LSB 30 -#define PHY_BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_AGC_MASK 0x40000000 -#define PHY_BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_AGC_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_AGC_SET(x) (((x) << 30) & 0x40000000) -#define PHY_BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_SELFCOR_MSB 31 -#define PHY_BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_SELFCOR_LSB 31 -#define PHY_BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_SELFCOR_MASK 0x80000000 -#define PHY_BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_SELFCOR_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_SELFCOR_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_multichain_enable */ -#define PHY_BB_MULTICHAIN_ENABLE_ADDRESS 0x000099a4 -#define PHY_BB_MULTICHAIN_ENABLE_OFFSET 0x000099a4 -#define PHY_BB_MULTICHAIN_ENABLE_RX_CHAIN_MASK_MSB 2 -#define PHY_BB_MULTICHAIN_ENABLE_RX_CHAIN_MASK_LSB 0 -#define PHY_BB_MULTICHAIN_ENABLE_RX_CHAIN_MASK_MASK 0x00000007 -#define PHY_BB_MULTICHAIN_ENABLE_RX_CHAIN_MASK_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_BB_MULTICHAIN_ENABLE_RX_CHAIN_MASK_SET(x) (((x) << 0) & 0x00000007) - -/* macros for BB_multichain_control */ -#define PHY_BB_MULTICHAIN_CONTROL_ADDRESS 0x000099a8 -#define PHY_BB_MULTICHAIN_CONTROL_OFFSET 0x000099a8 -#define PHY_BB_MULTICHAIN_CONTROL_FORCE_ANALOG_GAIN_DIFF_MSB 0 -#define PHY_BB_MULTICHAIN_CONTROL_FORCE_ANALOG_GAIN_DIFF_LSB 0 -#define PHY_BB_MULTICHAIN_CONTROL_FORCE_ANALOG_GAIN_DIFF_MASK 0x00000001 -#define PHY_BB_MULTICHAIN_CONTROL_FORCE_ANALOG_GAIN_DIFF_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_MULTICHAIN_CONTROL_FORCE_ANALOG_GAIN_DIFF_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_01_MSB 7 -#define PHY_BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_01_LSB 1 -#define PHY_BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_01_MASK 0x000000fe -#define PHY_BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_01_GET(x) (((x) & 0x000000fe) >> 1) -#define PHY_BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_01_SET(x) (((x) << 1) & 0x000000fe) -#define PHY_BB_MULTICHAIN_CONTROL_SYNC_SYNTHON_MSB 8 -#define PHY_BB_MULTICHAIN_CONTROL_SYNC_SYNTHON_LSB 8 -#define PHY_BB_MULTICHAIN_CONTROL_SYNC_SYNTHON_MASK 0x00000100 -#define PHY_BB_MULTICHAIN_CONTROL_SYNC_SYNTHON_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_BB_MULTICHAIN_CONTROL_SYNC_SYNTHON_SET(x) (((x) << 8) & 0x00000100) -#define PHY_BB_MULTICHAIN_CONTROL_USE_POSEDGE_REFCLK_MSB 9 -#define PHY_BB_MULTICHAIN_CONTROL_USE_POSEDGE_REFCLK_LSB 9 -#define PHY_BB_MULTICHAIN_CONTROL_USE_POSEDGE_REFCLK_MASK 0x00000200 -#define PHY_BB_MULTICHAIN_CONTROL_USE_POSEDGE_REFCLK_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_BB_MULTICHAIN_CONTROL_USE_POSEDGE_REFCLK_SET(x) (((x) << 9) & 0x00000200) -#define PHY_BB_MULTICHAIN_CONTROL_CF_SHORT_SAT_MSB 20 -#define PHY_BB_MULTICHAIN_CONTROL_CF_SHORT_SAT_LSB 10 -#define PHY_BB_MULTICHAIN_CONTROL_CF_SHORT_SAT_MASK 0x001ffc00 -#define PHY_BB_MULTICHAIN_CONTROL_CF_SHORT_SAT_GET(x) (((x) & 0x001ffc00) >> 10) -#define PHY_BB_MULTICHAIN_CONTROL_CF_SHORT_SAT_SET(x) (((x) << 10) & 0x001ffc00) -#define PHY_BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_02_MSB 28 -#define PHY_BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_02_LSB 22 -#define PHY_BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_02_MASK 0x1fc00000 -#define PHY_BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_02_GET(x) (((x) & 0x1fc00000) >> 22) -#define PHY_BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_02_SET(x) (((x) << 22) & 0x1fc00000) -#define PHY_BB_MULTICHAIN_CONTROL_FORCE_SIGMA_ZERO_MSB 29 -#define PHY_BB_MULTICHAIN_CONTROL_FORCE_SIGMA_ZERO_LSB 29 -#define PHY_BB_MULTICHAIN_CONTROL_FORCE_SIGMA_ZERO_MASK 0x20000000 -#define PHY_BB_MULTICHAIN_CONTROL_FORCE_SIGMA_ZERO_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_BB_MULTICHAIN_CONTROL_FORCE_SIGMA_ZERO_SET(x) (((x) << 29) & 0x20000000) - -/* macros for BB_multichain_gain_ctrl */ -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ADDRESS 0x000099ac -#define PHY_BB_MULTICHAIN_GAIN_CTRL_OFFSET 0x000099ac -#define PHY_BB_MULTICHAIN_GAIN_CTRL_QUICKDROP_LOW_MSB 7 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_QUICKDROP_LOW_LSB 0 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_QUICKDROP_LOW_MASK 0x000000ff -#define PHY_BB_MULTICHAIN_GAIN_CTRL_QUICKDROP_LOW_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_QUICKDROP_LOW_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_CHECK_STRONG_ANT_MSB 8 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_CHECK_STRONG_ANT_LSB 8 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_CHECK_STRONG_ANT_MASK 0x00000100 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_CHECK_STRONG_ANT_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_CHECK_STRONG_ANT_SET(x) (((x) << 8) & 0x00000100) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_FAST_DIV_BIAS_MSB 14 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_FAST_DIV_BIAS_LSB 9 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_FAST_DIV_BIAS_MASK 0x00007e00 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_FAST_DIV_BIAS_GET(x) (((x) & 0x00007e00) >> 9) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_FAST_DIV_BIAS_SET(x) (((x) << 9) & 0x00007e00) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_SNR_MSB 20 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_SNR_LSB 15 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_SNR_MASK 0x001f8000 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_SNR_GET(x) (((x) & 0x001f8000) >> 15) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_SNR_SET(x) (((x) << 15) & 0x001f8000) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_ENA_MSB 21 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_ENA_LSB 21 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_ENA_MASK 0x00200000 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_ENA_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_ENA_SET(x) (((x) << 21) & 0x00200000) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_MODE_MSB 22 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_MODE_LSB 22 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_MODE_MASK 0x00400000 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_MODE_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_MODE_SET(x) (((x) << 22) & 0x00400000) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_SW_RX_PROT_MSB 23 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_SW_RX_PROT_LSB 23 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_SW_RX_PROT_MASK 0x00800000 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_SW_RX_PROT_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_SW_RX_PROT_SET(x) (((x) << 23) & 0x00800000) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_DIV_LNADIV_MSB 24 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_DIV_LNADIV_LSB 24 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_DIV_LNADIV_MASK 0x01000000 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_DIV_LNADIV_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_DIV_LNADIV_SET(x) (((x) << 24) & 0x01000000) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_LNACONF_MSB 26 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_LNACONF_LSB 25 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_LNACONF_MASK 0x06000000 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_LNACONF_GET(x) (((x) & 0x06000000) >> 25) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_LNACONF_SET(x) (((x) << 25) & 0x06000000) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_LNACONF_MSB 28 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_LNACONF_LSB 27 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_LNACONF_MASK 0x18000000 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_LNACONF_GET(x) (((x) & 0x18000000) >> 27) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_LNACONF_SET(x) (((x) << 27) & 0x18000000) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_GAINTB_MSB 29 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_GAINTB_LSB 29 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_GAINTB_MASK 0x20000000 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_GAINTB_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_GAINTB_SET(x) (((x) << 29) & 0x20000000) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_GAINTB_MSB 30 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_GAINTB_LSB 30 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_GAINTB_MASK 0x40000000 -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_GAINTB_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_GAINTB_SET(x) (((x) << 30) & 0x40000000) - -/* macros for BB_adc_gain_dc_corr_b0 */ -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADDRESS 0x000099b4 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_OFFSET 0x000099b4 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_Q_COEFF_0_MSB 5 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_Q_COEFF_0_LSB 0 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_Q_COEFF_0_MASK 0x0000003f -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_Q_COEFF_0_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_Q_COEFF_0_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_I_COEFF_0_MSB 11 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_I_COEFF_0_LSB 6 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_I_COEFF_0_MASK 0x00000fc0 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_I_COEFF_0_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_I_COEFF_0_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_Q_COEFF_0_MSB 20 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_Q_COEFF_0_LSB 12 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_Q_COEFF_0_MASK 0x001ff000 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_Q_COEFF_0_GET(x) (((x) & 0x001ff000) >> 12) -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_Q_COEFF_0_SET(x) (((x) << 12) & 0x001ff000) -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_I_COEFF_0_MSB 29 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_I_COEFF_0_LSB 21 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_I_COEFF_0_MASK 0x3fe00000 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_I_COEFF_0_GET(x) (((x) & 0x3fe00000) >> 21) -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_I_COEFF_0_SET(x) (((x) << 21) & 0x3fe00000) -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_ENABLE_MSB 30 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_ENABLE_LSB 30 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_ENABLE_MASK 0x40000000 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_ENABLE_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_ENABLE_SET(x) (((x) << 30) & 0x40000000) -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_ENABLE_MSB 31 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_ENABLE_LSB 31 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_ENABLE_MASK 0x80000000 -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_ENABLE_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_ENABLE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_ext_chan_pwr_thr_1 */ -#define PHY_BB_EXT_CHAN_PWR_THR_1_ADDRESS 0x000099b8 -#define PHY_BB_EXT_CHAN_PWR_THR_1_OFFSET 0x000099b8 -#define PHY_BB_EXT_CHAN_PWR_THR_1_THRESH62_EXT_MSB 7 -#define PHY_BB_EXT_CHAN_PWR_THR_1_THRESH62_EXT_LSB 0 -#define PHY_BB_EXT_CHAN_PWR_THR_1_THRESH62_EXT_MASK 0x000000ff -#define PHY_BB_EXT_CHAN_PWR_THR_1_THRESH62_EXT_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_EXT_CHAN_PWR_THR_1_THRESH62_EXT_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_MINGAINIDX_MSB 15 -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_MINGAINIDX_LSB 8 -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_MINGAINIDX_MASK 0x0000ff00 -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_MINGAINIDX_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_MINGAINIDX_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTAGAINIDX_MSB 20 -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTAGAINIDX_LSB 16 -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTAGAINIDX_MASK 0x001f0000 -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTAGAINIDX_GET(x) (((x) & 0x001f0000) >> 16) -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTAGAINIDX_SET(x) (((x) << 16) & 0x001f0000) -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTANF_MSB 26 -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTANF_LSB 21 -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTANF_MASK 0x07e00000 -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTANF_GET(x) (((x) & 0x07e00000) >> 21) -#define PHY_BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTANF_SET(x) (((x) << 21) & 0x07e00000) - -/* macros for BB_ext_chan_pwr_thr_2_b0 */ -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_ADDRESS 0x000099bc -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_OFFSET 0x000099bc -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_CF_MAXCCAPWR_EXT_0_MSB 8 -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_CF_MAXCCAPWR_EXT_0_LSB 0 -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_CF_MAXCCAPWR_EXT_0_MASK 0x000001ff -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_CF_MAXCCAPWR_EXT_0_GET(x) (((x) & 0x000001ff) >> 0) -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_CF_MAXCCAPWR_EXT_0_SET(x) (((x) << 0) & 0x000001ff) -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_CYCPWR_THR1_EXT_MSB 15 -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_CYCPWR_THR1_EXT_LSB 9 -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_CYCPWR_THR1_EXT_MASK 0x0000fe00 -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_CYCPWR_THR1_EXT_GET(x) (((x) & 0x0000fe00) >> 9) -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_CYCPWR_THR1_EXT_SET(x) (((x) << 9) & 0x0000fe00) -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_MINCCAPWR_EXT_0_MSB 24 -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_MINCCAPWR_EXT_0_LSB 16 -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_MINCCAPWR_EXT_0_MASK 0x01ff0000 -#define PHY_BB_EXT_CHAN_PWR_THR_2_B0_MINCCAPWR_EXT_0_GET(x) (((x) & 0x01ff0000) >> 16) - -/* macros for BB_ext_chan_scorr_thr */ -#define PHY_BB_EXT_CHAN_SCORR_THR_ADDRESS 0x000099c0 -#define PHY_BB_EXT_CHAN_SCORR_THR_OFFSET 0x000099c0 -#define PHY_BB_EXT_CHAN_SCORR_THR_M1_THRES_EXT_MSB 6 -#define PHY_BB_EXT_CHAN_SCORR_THR_M1_THRES_EXT_LSB 0 -#define PHY_BB_EXT_CHAN_SCORR_THR_M1_THRES_EXT_MASK 0x0000007f -#define PHY_BB_EXT_CHAN_SCORR_THR_M1_THRES_EXT_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_BB_EXT_CHAN_SCORR_THR_M1_THRES_EXT_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_BB_EXT_CHAN_SCORR_THR_M2_THRES_EXT_MSB 13 -#define PHY_BB_EXT_CHAN_SCORR_THR_M2_THRES_EXT_LSB 7 -#define PHY_BB_EXT_CHAN_SCORR_THR_M2_THRES_EXT_MASK 0x00003f80 -#define PHY_BB_EXT_CHAN_SCORR_THR_M2_THRES_EXT_GET(x) (((x) & 0x00003f80) >> 7) -#define PHY_BB_EXT_CHAN_SCORR_THR_M2_THRES_EXT_SET(x) (((x) << 7) & 0x00003f80) -#define PHY_BB_EXT_CHAN_SCORR_THR_M1_THRES_LOW_EXT_MSB 20 -#define PHY_BB_EXT_CHAN_SCORR_THR_M1_THRES_LOW_EXT_LSB 14 -#define PHY_BB_EXT_CHAN_SCORR_THR_M1_THRES_LOW_EXT_MASK 0x001fc000 -#define PHY_BB_EXT_CHAN_SCORR_THR_M1_THRES_LOW_EXT_GET(x) (((x) & 0x001fc000) >> 14) -#define PHY_BB_EXT_CHAN_SCORR_THR_M1_THRES_LOW_EXT_SET(x) (((x) << 14) & 0x001fc000) -#define PHY_BB_EXT_CHAN_SCORR_THR_M2_THRES_LOW_EXT_MSB 27 -#define PHY_BB_EXT_CHAN_SCORR_THR_M2_THRES_LOW_EXT_LSB 21 -#define PHY_BB_EXT_CHAN_SCORR_THR_M2_THRES_LOW_EXT_MASK 0x0fe00000 -#define PHY_BB_EXT_CHAN_SCORR_THR_M2_THRES_LOW_EXT_GET(x) (((x) & 0x0fe00000) >> 21) -#define PHY_BB_EXT_CHAN_SCORR_THR_M2_THRES_LOW_EXT_SET(x) (((x) << 21) & 0x0fe00000) -#define PHY_BB_EXT_CHAN_SCORR_THR_SPUR_SUBCHANNEL_SD_MSB 28 -#define PHY_BB_EXT_CHAN_SCORR_THR_SPUR_SUBCHANNEL_SD_LSB 28 -#define PHY_BB_EXT_CHAN_SCORR_THR_SPUR_SUBCHANNEL_SD_MASK 0x10000000 -#define PHY_BB_EXT_CHAN_SCORR_THR_SPUR_SUBCHANNEL_SD_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_BB_EXT_CHAN_SCORR_THR_SPUR_SUBCHANNEL_SD_SET(x) (((x) << 28) & 0x10000000) - -/* macros for BB_ext_chan_detect_win */ -#define PHY_BB_EXT_CHAN_DETECT_WIN_ADDRESS 0x000099c4 -#define PHY_BB_EXT_CHAN_DETECT_WIN_OFFSET 0x000099c4 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_MSB 3 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_LSB 0 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_MASK 0x0000000f -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_LOW_MSB 7 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_LOW_LSB 4 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_LOW_MASK 0x000000f0 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_LOW_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_LOW_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_CCK_MSB 12 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_CCK_LSB 8 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_CCK_MASK 0x00001f00 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_CCK_GET(x) (((x) & 0x00001f00) >> 8) -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_CCK_SET(x) (((x) << 8) & 0x00001f00) -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_20H_COUNT_MSB 15 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_20H_COUNT_LSB 13 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_20H_COUNT_MASK 0x0000e000 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_20H_COUNT_GET(x) (((x) & 0x0000e000) >> 13) -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_20H_COUNT_SET(x) (((x) << 13) & 0x0000e000) -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_EXT_BLK_COUNT_MSB 18 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_EXT_BLK_COUNT_LSB 16 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_EXT_BLK_COUNT_MASK 0x00070000 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_EXT_BLK_COUNT_GET(x) (((x) & 0x00070000) >> 16) -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_EXT_BLK_COUNT_SET(x) (((x) << 16) & 0x00070000) -#define PHY_BB_EXT_CHAN_DETECT_WIN_WEAK_SIG_THR_CCK_EXT_MSB 24 -#define PHY_BB_EXT_CHAN_DETECT_WIN_WEAK_SIG_THR_CCK_EXT_LSB 19 -#define PHY_BB_EXT_CHAN_DETECT_WIN_WEAK_SIG_THR_CCK_EXT_MASK 0x01f80000 -#define PHY_BB_EXT_CHAN_DETECT_WIN_WEAK_SIG_THR_CCK_EXT_GET(x) (((x) & 0x01f80000) >> 19) -#define PHY_BB_EXT_CHAN_DETECT_WIN_WEAK_SIG_THR_CCK_EXT_SET(x) (((x) << 19) & 0x01f80000) -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_THRESH_MSB 28 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_THRESH_LSB 25 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_THRESH_MASK 0x1e000000 -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_THRESH_GET(x) (((x) & 0x1e000000) >> 25) -#define PHY_BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_THRESH_SET(x) (((x) << 25) & 0x1e000000) - -/* macros for BB_pwr_thr_20_40_det */ -#define PHY_BB_PWR_THR_20_40_DET_ADDRESS 0x000099c8 -#define PHY_BB_PWR_THR_20_40_DET_OFFSET 0x000099c8 -#define PHY_BB_PWR_THR_20_40_DET_PWRDIFF40_THRSTR_MSB 4 -#define PHY_BB_PWR_THR_20_40_DET_PWRDIFF40_THRSTR_LSB 0 -#define PHY_BB_PWR_THR_20_40_DET_PWRDIFF40_THRSTR_MASK 0x0000001f -#define PHY_BB_PWR_THR_20_40_DET_PWRDIFF40_THRSTR_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_PWR_THR_20_40_DET_PWRDIFF40_THRSTR_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_PWR_THR_20_40_DET_BLOCKER40_MAX_MSB 10 -#define PHY_BB_PWR_THR_20_40_DET_BLOCKER40_MAX_LSB 5 -#define PHY_BB_PWR_THR_20_40_DET_BLOCKER40_MAX_MASK 0x000007e0 -#define PHY_BB_PWR_THR_20_40_DET_BLOCKER40_MAX_GET(x) (((x) & 0x000007e0) >> 5) -#define PHY_BB_PWR_THR_20_40_DET_BLOCKER40_MAX_SET(x) (((x) << 5) & 0x000007e0) -#define PHY_BB_PWR_THR_20_40_DET_DET40_PWRSTEP_MAX_MSB 15 -#define PHY_BB_PWR_THR_20_40_DET_DET40_PWRSTEP_MAX_LSB 11 -#define PHY_BB_PWR_THR_20_40_DET_DET40_PWRSTEP_MAX_MASK 0x0000f800 -#define PHY_BB_PWR_THR_20_40_DET_DET40_PWRSTEP_MAX_GET(x) (((x) & 0x0000f800) >> 11) -#define PHY_BB_PWR_THR_20_40_DET_DET40_PWRSTEP_MAX_SET(x) (((x) << 11) & 0x0000f800) -#define PHY_BB_PWR_THR_20_40_DET_DET40_THR_SNR_MSB 23 -#define PHY_BB_PWR_THR_20_40_DET_DET40_THR_SNR_LSB 16 -#define PHY_BB_PWR_THR_20_40_DET_DET40_THR_SNR_MASK 0x00ff0000 -#define PHY_BB_PWR_THR_20_40_DET_DET40_THR_SNR_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_PWR_THR_20_40_DET_DET40_THR_SNR_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_BB_PWR_THR_20_40_DET_DET40_PRI_BIAS_MSB 28 -#define PHY_BB_PWR_THR_20_40_DET_DET40_PRI_BIAS_LSB 24 -#define PHY_BB_PWR_THR_20_40_DET_DET40_PRI_BIAS_MASK 0x1f000000 -#define PHY_BB_PWR_THR_20_40_DET_DET40_PRI_BIAS_GET(x) (((x) & 0x1f000000) >> 24) -#define PHY_BB_PWR_THR_20_40_DET_DET40_PRI_BIAS_SET(x) (((x) << 24) & 0x1f000000) -#define PHY_BB_PWR_THR_20_40_DET_PWRSTEP40_ENA_MSB 29 -#define PHY_BB_PWR_THR_20_40_DET_PWRSTEP40_ENA_LSB 29 -#define PHY_BB_PWR_THR_20_40_DET_PWRSTEP40_ENA_MASK 0x20000000 -#define PHY_BB_PWR_THR_20_40_DET_PWRSTEP40_ENA_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_BB_PWR_THR_20_40_DET_PWRSTEP40_ENA_SET(x) (((x) << 29) & 0x20000000) -#define PHY_BB_PWR_THR_20_40_DET_LOWSNR40_ENA_MSB 30 -#define PHY_BB_PWR_THR_20_40_DET_LOWSNR40_ENA_LSB 30 -#define PHY_BB_PWR_THR_20_40_DET_LOWSNR40_ENA_MASK 0x40000000 -#define PHY_BB_PWR_THR_20_40_DET_LOWSNR40_ENA_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_PWR_THR_20_40_DET_LOWSNR40_ENA_SET(x) (((x) << 30) & 0x40000000) - -/* macros for BB_short_gi_delta_slope */ -#define PHY_BB_SHORT_GI_DELTA_SLOPE_ADDRESS 0x000099d0 -#define PHY_BB_SHORT_GI_DELTA_SLOPE_OFFSET 0x000099d0 -#define PHY_BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_EXP_SHORT_GI_MSB 3 -#define PHY_BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_EXP_SHORT_GI_LSB 0 -#define PHY_BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_EXP_SHORT_GI_MASK 0x0000000f -#define PHY_BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_EXP_SHORT_GI_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_EXP_SHORT_GI_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_MAN_SHORT_GI_MSB 18 -#define PHY_BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_MAN_SHORT_GI_LSB 4 -#define PHY_BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_MAN_SHORT_GI_MASK 0x0007fff0 -#define PHY_BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_MAN_SHORT_GI_GET(x) (((x) & 0x0007fff0) >> 4) -#define PHY_BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_MAN_SHORT_GI_SET(x) (((x) << 4) & 0x0007fff0) - -/* macros for BB_chaninfo_ctrl */ -#define PHY_BB_CHANINFO_CTRL_ADDRESS 0x000099dc -#define PHY_BB_CHANINFO_CTRL_OFFSET 0x000099dc -#define PHY_BB_CHANINFO_CTRL_CAPTURE_CHAN_INFO_MSB 0 -#define PHY_BB_CHANINFO_CTRL_CAPTURE_CHAN_INFO_LSB 0 -#define PHY_BB_CHANINFO_CTRL_CAPTURE_CHAN_INFO_MASK 0x00000001 -#define PHY_BB_CHANINFO_CTRL_CAPTURE_CHAN_INFO_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_CHANINFO_CTRL_CAPTURE_CHAN_INFO_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_CHANINFO_CTRL_DISABLE_CHANINFOMEM_MSB 1 -#define PHY_BB_CHANINFO_CTRL_DISABLE_CHANINFOMEM_LSB 1 -#define PHY_BB_CHANINFO_CTRL_DISABLE_CHANINFOMEM_MASK 0x00000002 -#define PHY_BB_CHANINFO_CTRL_DISABLE_CHANINFOMEM_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_CHANINFO_CTRL_DISABLE_CHANINFOMEM_SET(x) (((x) << 1) & 0x00000002) - -/* macros for BB_heavy_clip_ctrl */ -#define PHY_BB_HEAVY_CLIP_CTRL_ADDRESS 0x000099e0 -#define PHY_BB_HEAVY_CLIP_CTRL_OFFSET 0x000099e0 -#define PHY_BB_HEAVY_CLIP_CTRL_CF_HEAVY_CLIP_ENABLE_MSB 8 -#define PHY_BB_HEAVY_CLIP_CTRL_CF_HEAVY_CLIP_ENABLE_LSB 0 -#define PHY_BB_HEAVY_CLIP_CTRL_CF_HEAVY_CLIP_ENABLE_MASK 0x000001ff -#define PHY_BB_HEAVY_CLIP_CTRL_CF_HEAVY_CLIP_ENABLE_GET(x) (((x) & 0x000001ff) >> 0) -#define PHY_BB_HEAVY_CLIP_CTRL_CF_HEAVY_CLIP_ENABLE_SET(x) (((x) << 0) & 0x000001ff) -#define PHY_BB_HEAVY_CLIP_CTRL_PRE_EMP_HT40_ENABLE_MSB 9 -#define PHY_BB_HEAVY_CLIP_CTRL_PRE_EMP_HT40_ENABLE_LSB 9 -#define PHY_BB_HEAVY_CLIP_CTRL_PRE_EMP_HT40_ENABLE_MASK 0x00000200 -#define PHY_BB_HEAVY_CLIP_CTRL_PRE_EMP_HT40_ENABLE_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_BB_HEAVY_CLIP_CTRL_PRE_EMP_HT40_ENABLE_SET(x) (((x) << 9) & 0x00000200) - -/* macros for BB_heavy_clip_20 */ -#define PHY_BB_HEAVY_CLIP_20_ADDRESS 0x000099e4 -#define PHY_BB_HEAVY_CLIP_20_OFFSET 0x000099e4 -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_0_MSB 7 -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_0_LSB 0 -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_0_MASK 0x000000ff -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_0_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_0_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_1_MSB 15 -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_1_LSB 8 -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_1_MASK 0x0000ff00 -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_1_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_1_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_2_MSB 23 -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_2_LSB 16 -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_2_MASK 0x00ff0000 -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_2_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_2_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_3_MSB 31 -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_3_LSB 24 -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_3_MASK 0xff000000 -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_3_GET(x) (((x) & 0xff000000) >> 24) -#define PHY_BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_3_SET(x) (((x) << 24) & 0xff000000) - -/* macros for BB_heavy_clip_40 */ -#define PHY_BB_HEAVY_CLIP_40_ADDRESS 0x000099e8 -#define PHY_BB_HEAVY_CLIP_40_OFFSET 0x000099e8 -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_4_MSB 7 -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_4_LSB 0 -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_4_MASK 0x000000ff -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_4_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_4_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_5_MSB 15 -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_5_LSB 8 -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_5_MASK 0x0000ff00 -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_5_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_5_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_6_MSB 23 -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_6_LSB 16 -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_6_MASK 0x00ff0000 -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_6_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_6_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_7_MSB 31 -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_7_LSB 24 -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_7_MASK 0xff000000 -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_7_GET(x) (((x) & 0xff000000) >> 24) -#define PHY_BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_7_SET(x) (((x) << 24) & 0xff000000) - -/* macros for BB_rifs_srch */ -#define PHY_BB_RIFS_SRCH_ADDRESS 0x000099ec -#define PHY_BB_RIFS_SRCH_OFFSET 0x000099ec -#define PHY_BB_RIFS_SRCH_HEAVY_CLIP_FACTOR_XR_MSB 7 -#define PHY_BB_RIFS_SRCH_HEAVY_CLIP_FACTOR_XR_LSB 0 -#define PHY_BB_RIFS_SRCH_HEAVY_CLIP_FACTOR_XR_MASK 0x000000ff -#define PHY_BB_RIFS_SRCH_HEAVY_CLIP_FACTOR_XR_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_RIFS_SRCH_HEAVY_CLIP_FACTOR_XR_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_RIFS_SRCH_INIT_GAIN_DB_OFFSET_MSB 15 -#define PHY_BB_RIFS_SRCH_INIT_GAIN_DB_OFFSET_LSB 8 -#define PHY_BB_RIFS_SRCH_INIT_GAIN_DB_OFFSET_MASK 0x0000ff00 -#define PHY_BB_RIFS_SRCH_INIT_GAIN_DB_OFFSET_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_RIFS_SRCH_INIT_GAIN_DB_OFFSET_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_RIFS_SRCH_RIFS_INIT_DELAY_MSB 25 -#define PHY_BB_RIFS_SRCH_RIFS_INIT_DELAY_LSB 16 -#define PHY_BB_RIFS_SRCH_RIFS_INIT_DELAY_MASK 0x03ff0000 -#define PHY_BB_RIFS_SRCH_RIFS_INIT_DELAY_GET(x) (((x) & 0x03ff0000) >> 16) -#define PHY_BB_RIFS_SRCH_RIFS_INIT_DELAY_SET(x) (((x) << 16) & 0x03ff0000) -#define PHY_BB_RIFS_SRCH_RIFS_DISABLE_PWRLOW_GC_MSB 26 -#define PHY_BB_RIFS_SRCH_RIFS_DISABLE_PWRLOW_GC_LSB 26 -#define PHY_BB_RIFS_SRCH_RIFS_DISABLE_PWRLOW_GC_MASK 0x04000000 -#define PHY_BB_RIFS_SRCH_RIFS_DISABLE_PWRLOW_GC_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_BB_RIFS_SRCH_RIFS_DISABLE_PWRLOW_GC_SET(x) (((x) << 26) & 0x04000000) -#define PHY_BB_RIFS_SRCH_RIFS_DISABLE_CCK_DET_MSB 27 -#define PHY_BB_RIFS_SRCH_RIFS_DISABLE_CCK_DET_LSB 27 -#define PHY_BB_RIFS_SRCH_RIFS_DISABLE_CCK_DET_MASK 0x08000000 -#define PHY_BB_RIFS_SRCH_RIFS_DISABLE_CCK_DET_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_BB_RIFS_SRCH_RIFS_DISABLE_CCK_DET_SET(x) (((x) << 27) & 0x08000000) - -/* macros for BB_iq_adc_cal_mode */ -#define PHY_BB_IQ_ADC_CAL_MODE_ADDRESS 0x000099f0 -#define PHY_BB_IQ_ADC_CAL_MODE_OFFSET 0x000099f0 -#define PHY_BB_IQ_ADC_CAL_MODE_GAIN_DC_IQ_CAL_MODE_MSB 1 -#define PHY_BB_IQ_ADC_CAL_MODE_GAIN_DC_IQ_CAL_MODE_LSB 0 -#define PHY_BB_IQ_ADC_CAL_MODE_GAIN_DC_IQ_CAL_MODE_MASK 0x00000003 -#define PHY_BB_IQ_ADC_CAL_MODE_GAIN_DC_IQ_CAL_MODE_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_BB_IQ_ADC_CAL_MODE_GAIN_DC_IQ_CAL_MODE_SET(x) (((x) << 0) & 0x00000003) -#define PHY_BB_IQ_ADC_CAL_MODE_TEST_CALADCOFF_MSB 2 -#define PHY_BB_IQ_ADC_CAL_MODE_TEST_CALADCOFF_LSB 2 -#define PHY_BB_IQ_ADC_CAL_MODE_TEST_CALADCOFF_MASK 0x00000004 -#define PHY_BB_IQ_ADC_CAL_MODE_TEST_CALADCOFF_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_BB_IQ_ADC_CAL_MODE_TEST_CALADCOFF_SET(x) (((x) << 2) & 0x00000004) - -/* macros for BB_per_chain_csd */ -#define PHY_BB_PER_CHAIN_CSD_ADDRESS 0x000099fc -#define PHY_BB_PER_CHAIN_CSD_OFFSET 0x000099fc -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN1_2CHAINS_MSB 4 -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN1_2CHAINS_LSB 0 -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN1_2CHAINS_MASK 0x0000001f -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN1_2CHAINS_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN1_2CHAINS_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN1_3CHAINS_MSB 9 -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN1_3CHAINS_LSB 5 -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN1_3CHAINS_MASK 0x000003e0 -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN1_3CHAINS_GET(x) (((x) & 0x000003e0) >> 5) -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN1_3CHAINS_SET(x) (((x) << 5) & 0x000003e0) -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN2_3CHAINS_MSB 14 -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN2_3CHAINS_LSB 10 -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN2_3CHAINS_MASK 0x00007c00 -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN2_3CHAINS_GET(x) (((x) & 0x00007c00) >> 10) -#define PHY_BB_PER_CHAIN_CSD_CSD_CHN2_3CHAINS_SET(x) (((x) << 10) & 0x00007c00) - -/* macros for BB_rx_ocgain */ -#define PHY_BB_RX_OCGAIN_ADDRESS 0x00009a00 -#define PHY_BB_RX_OCGAIN_OFFSET 0x00009a00 -#define PHY_BB_RX_OCGAIN_GAIN_ENTRY_MSB 31 -#define PHY_BB_RX_OCGAIN_GAIN_ENTRY_LSB 0 -#define PHY_BB_RX_OCGAIN_GAIN_ENTRY_MASK 0xffffffff -#define PHY_BB_RX_OCGAIN_GAIN_ENTRY_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_crc */ -#define PHY_BB_TX_CRC_ADDRESS 0x00009c00 -#define PHY_BB_TX_CRC_OFFSET 0x00009c00 -#define PHY_BB_TX_CRC_TX_CRC_MSB 15 -#define PHY_BB_TX_CRC_TX_CRC_LSB 0 -#define PHY_BB_TX_CRC_TX_CRC_MASK 0x0000ffff -#define PHY_BB_TX_CRC_TX_CRC_GET(x) (((x) & 0x0000ffff) >> 0) - -/* macros for BB_iq_adc_meas_0_b0 */ -#define PHY_BB_IQ_ADC_MEAS_0_B0_ADDRESS 0x00009c10 -#define PHY_BB_IQ_ADC_MEAS_0_B0_OFFSET 0x00009c10 -#define PHY_BB_IQ_ADC_MEAS_0_B0_GAIN_DC_IQ_CAL_MEAS_0_0_MSB 31 -#define PHY_BB_IQ_ADC_MEAS_0_B0_GAIN_DC_IQ_CAL_MEAS_0_0_LSB 0 -#define PHY_BB_IQ_ADC_MEAS_0_B0_GAIN_DC_IQ_CAL_MEAS_0_0_MASK 0xffffffff -#define PHY_BB_IQ_ADC_MEAS_0_B0_GAIN_DC_IQ_CAL_MEAS_0_0_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for BB_iq_adc_meas_1_b0 */ -#define PHY_BB_IQ_ADC_MEAS_1_B0_ADDRESS 0x00009c14 -#define PHY_BB_IQ_ADC_MEAS_1_B0_OFFSET 0x00009c14 -#define PHY_BB_IQ_ADC_MEAS_1_B0_GAIN_DC_IQ_CAL_MEAS_1_0_MSB 31 -#define PHY_BB_IQ_ADC_MEAS_1_B0_GAIN_DC_IQ_CAL_MEAS_1_0_LSB 0 -#define PHY_BB_IQ_ADC_MEAS_1_B0_GAIN_DC_IQ_CAL_MEAS_1_0_MASK 0xffffffff -#define PHY_BB_IQ_ADC_MEAS_1_B0_GAIN_DC_IQ_CAL_MEAS_1_0_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for BB_iq_adc_meas_2_b0 */ -#define PHY_BB_IQ_ADC_MEAS_2_B0_ADDRESS 0x00009c18 -#define PHY_BB_IQ_ADC_MEAS_2_B0_OFFSET 0x00009c18 -#define PHY_BB_IQ_ADC_MEAS_2_B0_GAIN_DC_IQ_CAL_MEAS_2_0_MSB 31 -#define PHY_BB_IQ_ADC_MEAS_2_B0_GAIN_DC_IQ_CAL_MEAS_2_0_LSB 0 -#define PHY_BB_IQ_ADC_MEAS_2_B0_GAIN_DC_IQ_CAL_MEAS_2_0_MASK 0xffffffff -#define PHY_BB_IQ_ADC_MEAS_2_B0_GAIN_DC_IQ_CAL_MEAS_2_0_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for BB_iq_adc_meas_3_b0 */ -#define PHY_BB_IQ_ADC_MEAS_3_B0_ADDRESS 0x00009c1c -#define PHY_BB_IQ_ADC_MEAS_3_B0_OFFSET 0x00009c1c -#define PHY_BB_IQ_ADC_MEAS_3_B0_GAIN_DC_IQ_CAL_MEAS_3_0_MSB 31 -#define PHY_BB_IQ_ADC_MEAS_3_B0_GAIN_DC_IQ_CAL_MEAS_3_0_LSB 0 -#define PHY_BB_IQ_ADC_MEAS_3_B0_GAIN_DC_IQ_CAL_MEAS_3_0_MASK 0xffffffff -#define PHY_BB_IQ_ADC_MEAS_3_B0_GAIN_DC_IQ_CAL_MEAS_3_0_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for BB_rfbus_grant */ -#define PHY_BB_RFBUS_GRANT_ADDRESS 0x00009c20 -#define PHY_BB_RFBUS_GRANT_OFFSET 0x00009c20 -#define PHY_BB_RFBUS_GRANT_RFBUS_GRANT_MSB 0 -#define PHY_BB_RFBUS_GRANT_RFBUS_GRANT_LSB 0 -#define PHY_BB_RFBUS_GRANT_RFBUS_GRANT_MASK 0x00000001 -#define PHY_BB_RFBUS_GRANT_RFBUS_GRANT_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_RFBUS_GRANT_BT_ANT_MSB 1 -#define PHY_BB_RFBUS_GRANT_BT_ANT_LSB 1 -#define PHY_BB_RFBUS_GRANT_BT_ANT_MASK 0x00000002 -#define PHY_BB_RFBUS_GRANT_BT_ANT_GET(x) (((x) & 0x00000002) >> 1) - -/* macros for BB_tstadc */ -#define PHY_BB_TSTADC_ADDRESS 0x00009c24 -#define PHY_BB_TSTADC_OFFSET 0x00009c24 -#define PHY_BB_TSTADC_TSTADC_OUT_Q_MSB 9 -#define PHY_BB_TSTADC_TSTADC_OUT_Q_LSB 0 -#define PHY_BB_TSTADC_TSTADC_OUT_Q_MASK 0x000003ff -#define PHY_BB_TSTADC_TSTADC_OUT_Q_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_BB_TSTADC_TSTADC_OUT_I_MSB 19 -#define PHY_BB_TSTADC_TSTADC_OUT_I_LSB 10 -#define PHY_BB_TSTADC_TSTADC_OUT_I_MASK 0x000ffc00 -#define PHY_BB_TSTADC_TSTADC_OUT_I_GET(x) (((x) & 0x000ffc00) >> 10) - -/* macros for BB_tstdac */ -#define PHY_BB_TSTDAC_ADDRESS 0x00009c28 -#define PHY_BB_TSTDAC_OFFSET 0x00009c28 -#define PHY_BB_TSTDAC_TSTDAC_OUT_Q_MSB 9 -#define PHY_BB_TSTDAC_TSTDAC_OUT_Q_LSB 0 -#define PHY_BB_TSTDAC_TSTDAC_OUT_Q_MASK 0x000003ff -#define PHY_BB_TSTDAC_TSTDAC_OUT_Q_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_BB_TSTDAC_TSTDAC_OUT_I_MSB 19 -#define PHY_BB_TSTDAC_TSTDAC_OUT_I_LSB 10 -#define PHY_BB_TSTDAC_TSTDAC_OUT_I_MASK 0x000ffc00 -#define PHY_BB_TSTDAC_TSTDAC_OUT_I_GET(x) (((x) & 0x000ffc00) >> 10) - -/* macros for BB_illegal_tx_rate */ -#define PHY_BB_ILLEGAL_TX_RATE_ADDRESS 0x00009c30 -#define PHY_BB_ILLEGAL_TX_RATE_OFFSET 0x00009c30 -#define PHY_BB_ILLEGAL_TX_RATE_ILLEGAL_TX_RATE_MSB 0 -#define PHY_BB_ILLEGAL_TX_RATE_ILLEGAL_TX_RATE_LSB 0 -#define PHY_BB_ILLEGAL_TX_RATE_ILLEGAL_TX_RATE_MASK 0x00000001 -#define PHY_BB_ILLEGAL_TX_RATE_ILLEGAL_TX_RATE_GET(x) (((x) & 0x00000001) >> 0) - -/* macros for BB_spur_report_b0 */ -#define PHY_BB_SPUR_REPORT_B0_ADDRESS 0x00009c34 -#define PHY_BB_SPUR_REPORT_B0_OFFSET 0x00009c34 -#define PHY_BB_SPUR_REPORT_B0_SPUR_EST_I_0_MSB 7 -#define PHY_BB_SPUR_REPORT_B0_SPUR_EST_I_0_LSB 0 -#define PHY_BB_SPUR_REPORT_B0_SPUR_EST_I_0_MASK 0x000000ff -#define PHY_BB_SPUR_REPORT_B0_SPUR_EST_I_0_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_SPUR_REPORT_B0_SPUR_EST_Q_0_MSB 15 -#define PHY_BB_SPUR_REPORT_B0_SPUR_EST_Q_0_LSB 8 -#define PHY_BB_SPUR_REPORT_B0_SPUR_EST_Q_0_MASK 0x0000ff00 -#define PHY_BB_SPUR_REPORT_B0_SPUR_EST_Q_0_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_SPUR_REPORT_B0_POWER_WITH_SPUR_REMOVED_0_MSB 31 -#define PHY_BB_SPUR_REPORT_B0_POWER_WITH_SPUR_REMOVED_0_LSB 16 -#define PHY_BB_SPUR_REPORT_B0_POWER_WITH_SPUR_REMOVED_0_MASK 0xffff0000 -#define PHY_BB_SPUR_REPORT_B0_POWER_WITH_SPUR_REMOVED_0_GET(x) (((x) & 0xffff0000) >> 16) - -/* macros for BB_channel_status */ -#define PHY_BB_CHANNEL_STATUS_ADDRESS 0x00009c38 -#define PHY_BB_CHANNEL_STATUS_OFFSET 0x00009c38 -#define PHY_BB_CHANNEL_STATUS_BT_ACTIVE_MSB 0 -#define PHY_BB_CHANNEL_STATUS_BT_ACTIVE_LSB 0 -#define PHY_BB_CHANNEL_STATUS_BT_ACTIVE_MASK 0x00000001 -#define PHY_BB_CHANNEL_STATUS_BT_ACTIVE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_CHANNEL_STATUS_RX_CLEAR_RAW_MSB 1 -#define PHY_BB_CHANNEL_STATUS_RX_CLEAR_RAW_LSB 1 -#define PHY_BB_CHANNEL_STATUS_RX_CLEAR_RAW_MASK 0x00000002 -#define PHY_BB_CHANNEL_STATUS_RX_CLEAR_RAW_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_CHANNEL_STATUS_RX_CLEAR_MAC_MSB 2 -#define PHY_BB_CHANNEL_STATUS_RX_CLEAR_MAC_LSB 2 -#define PHY_BB_CHANNEL_STATUS_RX_CLEAR_MAC_MASK 0x00000004 -#define PHY_BB_CHANNEL_STATUS_RX_CLEAR_MAC_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_BB_CHANNEL_STATUS_RX_CLEAR_PAD_MSB 3 -#define PHY_BB_CHANNEL_STATUS_RX_CLEAR_PAD_LSB 3 -#define PHY_BB_CHANNEL_STATUS_RX_CLEAR_PAD_MASK 0x00000008 -#define PHY_BB_CHANNEL_STATUS_RX_CLEAR_PAD_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_BB_CHANNEL_STATUS_BB_SW_OUT_0_MSB 5 -#define PHY_BB_CHANNEL_STATUS_BB_SW_OUT_0_LSB 4 -#define PHY_BB_CHANNEL_STATUS_BB_SW_OUT_0_MASK 0x00000030 -#define PHY_BB_CHANNEL_STATUS_BB_SW_OUT_0_GET(x) (((x) & 0x00000030) >> 4) -#define PHY_BB_CHANNEL_STATUS_BB_SW_OUT_1_MSB 7 -#define PHY_BB_CHANNEL_STATUS_BB_SW_OUT_1_LSB 6 -#define PHY_BB_CHANNEL_STATUS_BB_SW_OUT_1_MASK 0x000000c0 -#define PHY_BB_CHANNEL_STATUS_BB_SW_OUT_1_GET(x) (((x) & 0x000000c0) >> 6) -#define PHY_BB_CHANNEL_STATUS_BB_SW_OUT_2_MSB 9 -#define PHY_BB_CHANNEL_STATUS_BB_SW_OUT_2_LSB 8 -#define PHY_BB_CHANNEL_STATUS_BB_SW_OUT_2_MASK 0x00000300 -#define PHY_BB_CHANNEL_STATUS_BB_SW_OUT_2_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_BB_CHANNEL_STATUS_BB_SW_COM_OUT_MSB 13 -#define PHY_BB_CHANNEL_STATUS_BB_SW_COM_OUT_LSB 10 -#define PHY_BB_CHANNEL_STATUS_BB_SW_COM_OUT_MASK 0x00003c00 -#define PHY_BB_CHANNEL_STATUS_BB_SW_COM_OUT_GET(x) (((x) & 0x00003c00) >> 10) -#define PHY_BB_CHANNEL_STATUS_ANT_DIV_CFG_USED_MSB 16 -#define PHY_BB_CHANNEL_STATUS_ANT_DIV_CFG_USED_LSB 14 -#define PHY_BB_CHANNEL_STATUS_ANT_DIV_CFG_USED_MASK 0x0001c000 -#define PHY_BB_CHANNEL_STATUS_ANT_DIV_CFG_USED_GET(x) (((x) & 0x0001c000) >> 14) - -/* macros for BB_rssi_b0 */ -#define PHY_BB_RSSI_B0_ADDRESS 0x00009c3c -#define PHY_BB_RSSI_B0_OFFSET 0x00009c3c -#define PHY_BB_RSSI_B0_RSSI_0_MSB 7 -#define PHY_BB_RSSI_B0_RSSI_0_LSB 0 -#define PHY_BB_RSSI_B0_RSSI_0_MASK 0x000000ff -#define PHY_BB_RSSI_B0_RSSI_0_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_RSSI_B0_RSSI_EXT_0_MSB 15 -#define PHY_BB_RSSI_B0_RSSI_EXT_0_LSB 8 -#define PHY_BB_RSSI_B0_RSSI_EXT_0_MASK 0x0000ff00 -#define PHY_BB_RSSI_B0_RSSI_EXT_0_GET(x) (((x) & 0x0000ff00) >> 8) - -/* macros for BB_spur_est_cck_report_b0 */ -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_ADDRESS 0x00009c40 -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_OFFSET 0x00009c40 -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_I_0_CCK_MSB 7 -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_I_0_CCK_LSB 0 -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_I_0_CCK_MASK 0x000000ff -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_I_0_CCK_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_Q_0_CCK_MSB 15 -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_Q_0_CCK_LSB 8 -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_Q_0_CCK_MASK 0x0000ff00 -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_Q_0_CCK_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_I_0_CCK_MSB 23 -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_I_0_CCK_LSB 16 -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_I_0_CCK_MASK 0x00ff0000 -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_I_0_CCK_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_Q_0_CCK_MSB 31 -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_Q_0_CCK_LSB 24 -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_Q_0_CCK_MASK 0xff000000 -#define PHY_BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_Q_0_CCK_GET(x) (((x) & 0xff000000) >> 24) - -/* macros for BB_chan_info_noise_pwr */ -#define PHY_BB_CHAN_INFO_NOISE_PWR_ADDRESS 0x00009cac -#define PHY_BB_CHAN_INFO_NOISE_PWR_OFFSET 0x00009cac -#define PHY_BB_CHAN_INFO_NOISE_PWR_NOISE_POWER_MSB 11 -#define PHY_BB_CHAN_INFO_NOISE_PWR_NOISE_POWER_LSB 0 -#define PHY_BB_CHAN_INFO_NOISE_PWR_NOISE_POWER_MASK 0x00000fff -#define PHY_BB_CHAN_INFO_NOISE_PWR_NOISE_POWER_GET(x) (((x) & 0x00000fff) >> 0) - -/* macros for BB_chan_info_gain_diff */ -#define PHY_BB_CHAN_INFO_GAIN_DIFF_ADDRESS 0x00009cb0 -#define PHY_BB_CHAN_INFO_GAIN_DIFF_OFFSET 0x00009cb0 -#define PHY_BB_CHAN_INFO_GAIN_DIFF_FINE_PPM_MSB 11 -#define PHY_BB_CHAN_INFO_GAIN_DIFF_FINE_PPM_LSB 0 -#define PHY_BB_CHAN_INFO_GAIN_DIFF_FINE_PPM_MASK 0x00000fff -#define PHY_BB_CHAN_INFO_GAIN_DIFF_FINE_PPM_GET(x) (((x) & 0x00000fff) >> 0) - -/* macros for BB_chan_info_fine_timing */ -#define PHY_BB_CHAN_INFO_FINE_TIMING_ADDRESS 0x00009cb4 -#define PHY_BB_CHAN_INFO_FINE_TIMING_OFFSET 0x00009cb4 -#define PHY_BB_CHAN_INFO_FINE_TIMING_COARSE_PPM_MSB 11 -#define PHY_BB_CHAN_INFO_FINE_TIMING_COARSE_PPM_LSB 0 -#define PHY_BB_CHAN_INFO_FINE_TIMING_COARSE_PPM_MASK 0x00000fff -#define PHY_BB_CHAN_INFO_FINE_TIMING_COARSE_PPM_GET(x) (((x) & 0x00000fff) >> 0) -#define PHY_BB_CHAN_INFO_FINE_TIMING_FINE_TIMING_MSB 21 -#define PHY_BB_CHAN_INFO_FINE_TIMING_FINE_TIMING_LSB 12 -#define PHY_BB_CHAN_INFO_FINE_TIMING_FINE_TIMING_MASK 0x003ff000 -#define PHY_BB_CHAN_INFO_FINE_TIMING_FINE_TIMING_GET(x) (((x) & 0x003ff000) >> 12) - -/* macros for BB_chan_info_gain_b0 */ -#define PHY_BB_CHAN_INFO_GAIN_B0_ADDRESS 0x00009cb8 -#define PHY_BB_CHAN_INFO_GAIN_B0_OFFSET 0x00009cb8 -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RSSI_0_MSB 7 -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RSSI_0_LSB 0 -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RSSI_0_MASK 0x000000ff -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RSSI_0_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RF_GAIN_0_MSB 15 -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RF_GAIN_0_LSB 8 -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RF_GAIN_0_MASK 0x0000ff00 -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RF_GAIN_0_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN1_SW_0_MSB 16 -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN1_SW_0_LSB 16 -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN1_SW_0_MASK 0x00010000 -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN1_SW_0_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN2_SW_0_MSB 17 -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN2_SW_0_LSB 17 -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN2_SW_0_MASK 0x00020000 -#define PHY_BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN2_SW_0_GET(x) (((x) & 0x00020000) >> 17) - -/* macros for BB_chan_info_chan_tab_b0 */ -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_ADDRESS 0x00009cbc -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_OFFSET 0x00009cbc -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_Q_0_MSB 5 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_Q_0_LSB 0 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_Q_0_MASK 0x0000003f -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_Q_0_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_I_0_MSB 11 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_I_0_LSB 6 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_I_0_MASK 0x00000fc0 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_I_0_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_EXP_0_MSB 15 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_EXP_0_LSB 12 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_EXP_0_MASK 0x0000f000 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_EXP_0_GET(x) (((x) & 0x0000f000) >> 12) -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_Q_1_MSB 21 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_Q_1_LSB 16 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_Q_1_MASK 0x003f0000 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_Q_1_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_I_1_MSB 27 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_I_1_LSB 22 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_I_1_MASK 0x0fc00000 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_MAN_I_1_GET(x) (((x) & 0x0fc00000) >> 22) -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_EXP_1_MSB 31 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_EXP_1_LSB 28 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_EXP_1_MASK 0xf0000000 -#define PHY_BB_CHAN_INFO_CHAN_TAB_B0_EXP_1_GET(x) (((x) & 0xf0000000) >> 28) - -/* macros for BB_paprd_am2am_mask */ -#define PHY_BB_PAPRD_AM2AM_MASK_ADDRESS 0x00009de4 -#define PHY_BB_PAPRD_AM2AM_MASK_OFFSET 0x00009de4 -#define PHY_BB_PAPRD_AM2AM_MASK_PAPRD_AM2AM_MASK_MSB 24 -#define PHY_BB_PAPRD_AM2AM_MASK_PAPRD_AM2AM_MASK_LSB 0 -#define PHY_BB_PAPRD_AM2AM_MASK_PAPRD_AM2AM_MASK_MASK 0x01ffffff -#define PHY_BB_PAPRD_AM2AM_MASK_PAPRD_AM2AM_MASK_GET(x) (((x) & 0x01ffffff) >> 0) -#define PHY_BB_PAPRD_AM2AM_MASK_PAPRD_AM2AM_MASK_SET(x) (((x) << 0) & 0x01ffffff) - -/* macros for BB_paprd_am2pm_mask */ -#define PHY_BB_PAPRD_AM2PM_MASK_ADDRESS 0x00009de8 -#define PHY_BB_PAPRD_AM2PM_MASK_OFFSET 0x00009de8 -#define PHY_BB_PAPRD_AM2PM_MASK_PAPRD_AM2PM_MASK_MSB 24 -#define PHY_BB_PAPRD_AM2PM_MASK_PAPRD_AM2PM_MASK_LSB 0 -#define PHY_BB_PAPRD_AM2PM_MASK_PAPRD_AM2PM_MASK_MASK 0x01ffffff -#define PHY_BB_PAPRD_AM2PM_MASK_PAPRD_AM2PM_MASK_GET(x) (((x) & 0x01ffffff) >> 0) -#define PHY_BB_PAPRD_AM2PM_MASK_PAPRD_AM2PM_MASK_SET(x) (((x) << 0) & 0x01ffffff) - -/* macros for BB_paprd_ht40_mask */ -#define PHY_BB_PAPRD_HT40_MASK_ADDRESS 0x00009dec -#define PHY_BB_PAPRD_HT40_MASK_OFFSET 0x00009dec -#define PHY_BB_PAPRD_HT40_MASK_PAPRD_HT40_MASK_MSB 24 -#define PHY_BB_PAPRD_HT40_MASK_PAPRD_HT40_MASK_LSB 0 -#define PHY_BB_PAPRD_HT40_MASK_PAPRD_HT40_MASK_MASK 0x01ffffff -#define PHY_BB_PAPRD_HT40_MASK_PAPRD_HT40_MASK_GET(x) (((x) & 0x01ffffff) >> 0) -#define PHY_BB_PAPRD_HT40_MASK_PAPRD_HT40_MASK_SET(x) (((x) << 0) & 0x01ffffff) - -/* macros for BB_paprd_ctrl0 */ -#define PHY_BB_PAPRD_CTRL0_ADDRESS 0x00009df0 -#define PHY_BB_PAPRD_CTRL0_OFFSET 0x00009df0 -#define PHY_BB_PAPRD_CTRL0_PAPRD_ENABLE_MSB 0 -#define PHY_BB_PAPRD_CTRL0_PAPRD_ENABLE_LSB 0 -#define PHY_BB_PAPRD_CTRL0_PAPRD_ENABLE_MASK 0x00000001 -#define PHY_BB_PAPRD_CTRL0_PAPRD_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_PAPRD_CTRL0_PAPRD_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_PAPRD_CTRL0_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_MSB 1 -#define PHY_BB_PAPRD_CTRL0_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_LSB 1 -#define PHY_BB_PAPRD_CTRL0_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_MASK 0x00000002 -#define PHY_BB_PAPRD_CTRL0_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_PAPRD_CTRL0_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_PAPRD_CTRL0_PAPRD_VALID_GAIN_MSB 26 -#define PHY_BB_PAPRD_CTRL0_PAPRD_VALID_GAIN_LSB 2 -#define PHY_BB_PAPRD_CTRL0_PAPRD_VALID_GAIN_MASK 0x07fffffc -#define PHY_BB_PAPRD_CTRL0_PAPRD_VALID_GAIN_GET(x) (((x) & 0x07fffffc) >> 2) -#define PHY_BB_PAPRD_CTRL0_PAPRD_VALID_GAIN_SET(x) (((x) << 2) & 0x07fffffc) -#define PHY_BB_PAPRD_CTRL0_PAPRD_MAG_THRSH_MSB 31 -#define PHY_BB_PAPRD_CTRL0_PAPRD_MAG_THRSH_LSB 27 -#define PHY_BB_PAPRD_CTRL0_PAPRD_MAG_THRSH_MASK 0xf8000000 -#define PHY_BB_PAPRD_CTRL0_PAPRD_MAG_THRSH_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_BB_PAPRD_CTRL0_PAPRD_MAG_THRSH_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for BB_paprd_ctrl1 */ -#define PHY_BB_PAPRD_CTRL1_ADDRESS 0x00009df4 -#define PHY_BB_PAPRD_CTRL1_OFFSET 0x00009df4 -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_SCALING_ENABLE_MSB 0 -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_SCALING_ENABLE_LSB 0 -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_SCALING_ENABLE_MASK 0x00000001 -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_SCALING_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_SCALING_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_AM2AM_ENABLE_MSB 1 -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_AM2AM_ENABLE_LSB 1 -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_AM2AM_ENABLE_MASK 0x00000002 -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_AM2AM_ENABLE_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_AM2AM_ENABLE_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_AM2PM_ENABLE_MSB 2 -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_AM2PM_ENABLE_LSB 2 -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_AM2PM_ENABLE_MASK 0x00000004 -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_AM2PM_ENABLE_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_BB_PAPRD_CTRL1_PAPRD_ADAPTIVE_AM2PM_ENABLE_SET(x) (((x) << 2) & 0x00000004) -#define PHY_BB_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL_MSB 8 -#define PHY_BB_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL_LSB 3 -#define PHY_BB_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL_MASK 0x000001f8 -#define PHY_BB_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL_GET(x) (((x) & 0x000001f8) >> 3) -#define PHY_BB_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL_SET(x) (((x) << 3) & 0x000001f8) -#define PHY_BB_PAPRD_CTRL1_PA_GAIN_SCALE_FACTOR_MSB 16 -#define PHY_BB_PAPRD_CTRL1_PA_GAIN_SCALE_FACTOR_LSB 9 -#define PHY_BB_PAPRD_CTRL1_PA_GAIN_SCALE_FACTOR_MASK 0x0001fe00 -#define PHY_BB_PAPRD_CTRL1_PA_GAIN_SCALE_FACTOR_GET(x) (((x) & 0x0001fe00) >> 9) -#define PHY_BB_PAPRD_CTRL1_PA_GAIN_SCALE_FACTOR_SET(x) (((x) << 9) & 0x0001fe00) -#define PHY_BB_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACTOR_MSB 26 -#define PHY_BB_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACTOR_LSB 17 -#define PHY_BB_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACTOR_MASK 0x07fe0000 -#define PHY_BB_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACTOR_GET(x) (((x) & 0x07fe0000) >> 17) -#define PHY_BB_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACTOR_SET(x) (((x) << 17) & 0x07fe0000) -#define PHY_BB_PAPRD_CTRL1_PAPRD_TRAINER_IANDQ_SEL_MSB 27 -#define PHY_BB_PAPRD_CTRL1_PAPRD_TRAINER_IANDQ_SEL_LSB 27 -#define PHY_BB_PAPRD_CTRL1_PAPRD_TRAINER_IANDQ_SEL_MASK 0x08000000 -#define PHY_BB_PAPRD_CTRL1_PAPRD_TRAINER_IANDQ_SEL_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_BB_PAPRD_CTRL1_PAPRD_TRAINER_IANDQ_SEL_SET(x) (((x) << 27) & 0x08000000) - -/* macros for BB_pa_gain123 */ -#define PHY_BB_PA_GAIN123_ADDRESS 0x00009df8 -#define PHY_BB_PA_GAIN123_OFFSET 0x00009df8 -#define PHY_BB_PA_GAIN123_PA_GAIN1_MSB 9 -#define PHY_BB_PA_GAIN123_PA_GAIN1_LSB 0 -#define PHY_BB_PA_GAIN123_PA_GAIN1_MASK 0x000003ff -#define PHY_BB_PA_GAIN123_PA_GAIN1_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_BB_PA_GAIN123_PA_GAIN1_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_BB_PA_GAIN123_PA_GAIN2_MSB 19 -#define PHY_BB_PA_GAIN123_PA_GAIN2_LSB 10 -#define PHY_BB_PA_GAIN123_PA_GAIN2_MASK 0x000ffc00 -#define PHY_BB_PA_GAIN123_PA_GAIN2_GET(x) (((x) & 0x000ffc00) >> 10) -#define PHY_BB_PA_GAIN123_PA_GAIN2_SET(x) (((x) << 10) & 0x000ffc00) -#define PHY_BB_PA_GAIN123_PA_GAIN3_MSB 29 -#define PHY_BB_PA_GAIN123_PA_GAIN3_LSB 20 -#define PHY_BB_PA_GAIN123_PA_GAIN3_MASK 0x3ff00000 -#define PHY_BB_PA_GAIN123_PA_GAIN3_GET(x) (((x) & 0x3ff00000) >> 20) -#define PHY_BB_PA_GAIN123_PA_GAIN3_SET(x) (((x) << 20) & 0x3ff00000) - -/* macros for BB_pa_gain45 */ -#define PHY_BB_PA_GAIN45_ADDRESS 0x00009dfc -#define PHY_BB_PA_GAIN45_OFFSET 0x00009dfc -#define PHY_BB_PA_GAIN45_PA_GAIN4_MSB 9 -#define PHY_BB_PA_GAIN45_PA_GAIN4_LSB 0 -#define PHY_BB_PA_GAIN45_PA_GAIN4_MASK 0x000003ff -#define PHY_BB_PA_GAIN45_PA_GAIN4_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_BB_PA_GAIN45_PA_GAIN4_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_BB_PA_GAIN45_PA_GAIN5_MSB 19 -#define PHY_BB_PA_GAIN45_PA_GAIN5_LSB 10 -#define PHY_BB_PA_GAIN45_PA_GAIN5_MASK 0x000ffc00 -#define PHY_BB_PA_GAIN45_PA_GAIN5_GET(x) (((x) & 0x000ffc00) >> 10) -#define PHY_BB_PA_GAIN45_PA_GAIN5_SET(x) (((x) << 10) & 0x000ffc00) -#define PHY_BB_PA_GAIN45_PAPRD_ADAPTIVE_TABLE_VALID_MSB 24 -#define PHY_BB_PA_GAIN45_PAPRD_ADAPTIVE_TABLE_VALID_LSB 20 -#define PHY_BB_PA_GAIN45_PAPRD_ADAPTIVE_TABLE_VALID_MASK 0x01f00000 -#define PHY_BB_PA_GAIN45_PAPRD_ADAPTIVE_TABLE_VALID_GET(x) (((x) & 0x01f00000) >> 20) -#define PHY_BB_PA_GAIN45_PAPRD_ADAPTIVE_TABLE_VALID_SET(x) (((x) << 20) & 0x01f00000) - -/* macros for BB_paprd_pre_post_scale_0 */ -#define PHY_BB_PAPRD_PRE_POST_SCALE_0_ADDRESS 0x00009e00 -#define PHY_BB_PAPRD_PRE_POST_SCALE_0_OFFSET 0x00009e00 -#define PHY_BB_PAPRD_PRE_POST_SCALE_0_PAPRD_PRE_POST_SCALING_0_MSB 17 -#define PHY_BB_PAPRD_PRE_POST_SCALE_0_PAPRD_PRE_POST_SCALING_0_LSB 0 -#define PHY_BB_PAPRD_PRE_POST_SCALE_0_PAPRD_PRE_POST_SCALING_0_MASK 0x0003ffff -#define PHY_BB_PAPRD_PRE_POST_SCALE_0_PAPRD_PRE_POST_SCALING_0_GET(x) (((x) & 0x0003ffff) >> 0) -#define PHY_BB_PAPRD_PRE_POST_SCALE_0_PAPRD_PRE_POST_SCALING_0_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for BB_paprd_pre_post_scale_1 */ -#define PHY_BB_PAPRD_PRE_POST_SCALE_1_ADDRESS 0x00009e04 -#define PHY_BB_PAPRD_PRE_POST_SCALE_1_OFFSET 0x00009e04 -#define PHY_BB_PAPRD_PRE_POST_SCALE_1_PAPRD_PRE_POST_SCALING_1_MSB 17 -#define PHY_BB_PAPRD_PRE_POST_SCALE_1_PAPRD_PRE_POST_SCALING_1_LSB 0 -#define PHY_BB_PAPRD_PRE_POST_SCALE_1_PAPRD_PRE_POST_SCALING_1_MASK 0x0003ffff -#define PHY_BB_PAPRD_PRE_POST_SCALE_1_PAPRD_PRE_POST_SCALING_1_GET(x) (((x) & 0x0003ffff) >> 0) -#define PHY_BB_PAPRD_PRE_POST_SCALE_1_PAPRD_PRE_POST_SCALING_1_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for BB_paprd_pre_post_scale_2 */ -#define PHY_BB_PAPRD_PRE_POST_SCALE_2_ADDRESS 0x00009e08 -#define PHY_BB_PAPRD_PRE_POST_SCALE_2_OFFSET 0x00009e08 -#define PHY_BB_PAPRD_PRE_POST_SCALE_2_PAPRD_PRE_POST_SCALING_2_MSB 17 -#define PHY_BB_PAPRD_PRE_POST_SCALE_2_PAPRD_PRE_POST_SCALING_2_LSB 0 -#define PHY_BB_PAPRD_PRE_POST_SCALE_2_PAPRD_PRE_POST_SCALING_2_MASK 0x0003ffff -#define PHY_BB_PAPRD_PRE_POST_SCALE_2_PAPRD_PRE_POST_SCALING_2_GET(x) (((x) & 0x0003ffff) >> 0) -#define PHY_BB_PAPRD_PRE_POST_SCALE_2_PAPRD_PRE_POST_SCALING_2_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for BB_paprd_pre_post_scale_3 */ -#define PHY_BB_PAPRD_PRE_POST_SCALE_3_ADDRESS 0x00009e0c -#define PHY_BB_PAPRD_PRE_POST_SCALE_3_OFFSET 0x00009e0c -#define PHY_BB_PAPRD_PRE_POST_SCALE_3_PAPRD_PRE_POST_SCALING_3_MSB 17 -#define PHY_BB_PAPRD_PRE_POST_SCALE_3_PAPRD_PRE_POST_SCALING_3_LSB 0 -#define PHY_BB_PAPRD_PRE_POST_SCALE_3_PAPRD_PRE_POST_SCALING_3_MASK 0x0003ffff -#define PHY_BB_PAPRD_PRE_POST_SCALE_3_PAPRD_PRE_POST_SCALING_3_GET(x) (((x) & 0x0003ffff) >> 0) -#define PHY_BB_PAPRD_PRE_POST_SCALE_3_PAPRD_PRE_POST_SCALING_3_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for BB_paprd_pre_post_scale_4 */ -#define PHY_BB_PAPRD_PRE_POST_SCALE_4_ADDRESS 0x00009e10 -#define PHY_BB_PAPRD_PRE_POST_SCALE_4_OFFSET 0x00009e10 -#define PHY_BB_PAPRD_PRE_POST_SCALE_4_PAPRD_PRE_POST_SCALING_4_MSB 17 -#define PHY_BB_PAPRD_PRE_POST_SCALE_4_PAPRD_PRE_POST_SCALING_4_LSB 0 -#define PHY_BB_PAPRD_PRE_POST_SCALE_4_PAPRD_PRE_POST_SCALING_4_MASK 0x0003ffff -#define PHY_BB_PAPRD_PRE_POST_SCALE_4_PAPRD_PRE_POST_SCALING_4_GET(x) (((x) & 0x0003ffff) >> 0) -#define PHY_BB_PAPRD_PRE_POST_SCALE_4_PAPRD_PRE_POST_SCALING_4_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for BB_paprd_pre_post_scale_5 */ -#define PHY_BB_PAPRD_PRE_POST_SCALE_5_ADDRESS 0x00009e14 -#define PHY_BB_PAPRD_PRE_POST_SCALE_5_OFFSET 0x00009e14 -#define PHY_BB_PAPRD_PRE_POST_SCALE_5_PAPRD_PRE_POST_SCALING_5_MSB 17 -#define PHY_BB_PAPRD_PRE_POST_SCALE_5_PAPRD_PRE_POST_SCALING_5_LSB 0 -#define PHY_BB_PAPRD_PRE_POST_SCALE_5_PAPRD_PRE_POST_SCALING_5_MASK 0x0003ffff -#define PHY_BB_PAPRD_PRE_POST_SCALE_5_PAPRD_PRE_POST_SCALING_5_GET(x) (((x) & 0x0003ffff) >> 0) -#define PHY_BB_PAPRD_PRE_POST_SCALE_5_PAPRD_PRE_POST_SCALING_5_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for BB_paprd_pre_post_scale_6 */ -#define PHY_BB_PAPRD_PRE_POST_SCALE_6_ADDRESS 0x00009e18 -#define PHY_BB_PAPRD_PRE_POST_SCALE_6_OFFSET 0x00009e18 -#define PHY_BB_PAPRD_PRE_POST_SCALE_6_PAPRD_PRE_POST_SCALING_6_MSB 17 -#define PHY_BB_PAPRD_PRE_POST_SCALE_6_PAPRD_PRE_POST_SCALING_6_LSB 0 -#define PHY_BB_PAPRD_PRE_POST_SCALE_6_PAPRD_PRE_POST_SCALING_6_MASK 0x0003ffff -#define PHY_BB_PAPRD_PRE_POST_SCALE_6_PAPRD_PRE_POST_SCALING_6_GET(x) (((x) & 0x0003ffff) >> 0) -#define PHY_BB_PAPRD_PRE_POST_SCALE_6_PAPRD_PRE_POST_SCALING_6_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for BB_paprd_pre_post_scale_7 */ -#define PHY_BB_PAPRD_PRE_POST_SCALE_7_ADDRESS 0x00009e1c -#define PHY_BB_PAPRD_PRE_POST_SCALE_7_OFFSET 0x00009e1c -#define PHY_BB_PAPRD_PRE_POST_SCALE_7_PAPRD_PRE_POST_SCALING_7_MSB 17 -#define PHY_BB_PAPRD_PRE_POST_SCALE_7_PAPRD_PRE_POST_SCALING_7_LSB 0 -#define PHY_BB_PAPRD_PRE_POST_SCALE_7_PAPRD_PRE_POST_SCALING_7_MASK 0x0003ffff -#define PHY_BB_PAPRD_PRE_POST_SCALE_7_PAPRD_PRE_POST_SCALING_7_GET(x) (((x) & 0x0003ffff) >> 0) -#define PHY_BB_PAPRD_PRE_POST_SCALE_7_PAPRD_PRE_POST_SCALING_7_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for BB_paprd_mem_tab */ -#define PHY_BB_PAPRD_MEM_TAB_ADDRESS 0x00009e20 -#define PHY_BB_PAPRD_MEM_TAB_OFFSET 0x00009e20 -#define PHY_BB_PAPRD_MEM_TAB_PAPRD_MEM_MSB 21 -#define PHY_BB_PAPRD_MEM_TAB_PAPRD_MEM_LSB 0 -#define PHY_BB_PAPRD_MEM_TAB_PAPRD_MEM_MASK 0x003fffff -#define PHY_BB_PAPRD_MEM_TAB_PAPRD_MEM_GET(x) (((x) & 0x003fffff) >> 0) -#define PHY_BB_PAPRD_MEM_TAB_PAPRD_MEM_SET(x) (((x) << 0) & 0x003fffff) - -/* macros for BB_peak_det_ctrl_1 */ -#define PHY_BB_PEAK_DET_CTRL_1_ADDRESS 0x0000a000 -#define PHY_BB_PEAK_DET_CTRL_1_OFFSET 0x0000a000 -#define PHY_BB_PEAK_DET_CTRL_1_USE_OC_GAIN_TABLE_MSB 0 -#define PHY_BB_PEAK_DET_CTRL_1_USE_OC_GAIN_TABLE_LSB 0 -#define PHY_BB_PEAK_DET_CTRL_1_USE_OC_GAIN_TABLE_MASK 0x00000001 -#define PHY_BB_PEAK_DET_CTRL_1_USE_OC_GAIN_TABLE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_PEAK_DET_CTRL_1_USE_OC_GAIN_TABLE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_PEAK_DET_CTRL_1_USE_PEAK_DET_MSB 1 -#define PHY_BB_PEAK_DET_CTRL_1_USE_PEAK_DET_LSB 1 -#define PHY_BB_PEAK_DET_CTRL_1_USE_PEAK_DET_MASK 0x00000002 -#define PHY_BB_PEAK_DET_CTRL_1_USE_PEAK_DET_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_PEAK_DET_CTRL_1_USE_PEAK_DET_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_WIN_LEN_MSB 7 -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_WIN_LEN_LSB 2 -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_WIN_LEN_MASK 0x000000fc -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_WIN_LEN_GET(x) (((x) & 0x000000fc) >> 2) -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_WIN_LEN_SET(x) (((x) << 2) & 0x000000fc) -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_LOW_MSB 12 -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_LOW_LSB 8 -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_LOW_MASK 0x00001f00 -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_LOW_GET(x) (((x) & 0x00001f00) >> 8) -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_LOW_SET(x) (((x) << 8) & 0x00001f00) -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_MED_MSB 17 -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_MED_LSB 13 -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_MED_MASK 0x0003e000 -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_MED_GET(x) (((x) & 0x0003e000) >> 13) -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_MED_SET(x) (((x) << 13) & 0x0003e000) -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_HIGH_MSB 22 -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_HIGH_LSB 18 -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_HIGH_MASK 0x007c0000 -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_HIGH_GET(x) (((x) & 0x007c0000) >> 18) -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_HIGH_SET(x) (((x) << 18) & 0x007c0000) -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_SETTLING_MSB 29 -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_SETTLING_LSB 23 -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_SETTLING_MASK 0x3f800000 -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_SETTLING_GET(x) (((x) & 0x3f800000) >> 23) -#define PHY_BB_PEAK_DET_CTRL_1_PEAK_DET_SETTLING_SET(x) (((x) << 23) & 0x3f800000) -#define PHY_BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_CAL_MSB 30 -#define PHY_BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_CAL_LSB 30 -#define PHY_BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_CAL_MASK 0x40000000 -#define PHY_BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_CAL_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_CAL_SET(x) (((x) << 30) & 0x40000000) -#define PHY_BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_RX_MSB 31 -#define PHY_BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_RX_LSB 31 -#define PHY_BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_RX_MASK 0x80000000 -#define PHY_BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_RX_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_RX_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_peak_det_ctrl_2 */ -#define PHY_BB_PEAK_DET_CTRL_2_ADDRESS 0x0000a004 -#define PHY_BB_PEAK_DET_CTRL_2_OFFSET 0x0000a004 -#define PHY_BB_PEAK_DET_CTRL_2_RFSAT_2_ADD_RFGAIN_DEL_MSB 9 -#define PHY_BB_PEAK_DET_CTRL_2_RFSAT_2_ADD_RFGAIN_DEL_LSB 0 -#define PHY_BB_PEAK_DET_CTRL_2_RFSAT_2_ADD_RFGAIN_DEL_MASK 0x000003ff -#define PHY_BB_PEAK_DET_CTRL_2_RFSAT_2_ADD_RFGAIN_DEL_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_BB_PEAK_DET_CTRL_2_RFSAT_2_ADD_RFGAIN_DEL_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_LOW_MSB 14 -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_LOW_LSB 10 -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_LOW_MASK 0x00007c00 -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_LOW_GET(x) (((x) & 0x00007c00) >> 10) -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_LOW_SET(x) (((x) << 10) & 0x00007c00) -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_MED_MSB 19 -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_MED_LSB 15 -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_MED_MASK 0x000f8000 -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_MED_GET(x) (((x) & 0x000f8000) >> 15) -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_MED_SET(x) (((x) << 15) & 0x000f8000) -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_HIGH_MSB 24 -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_HIGH_LSB 20 -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_HIGH_MASK 0x01f00000 -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_HIGH_GET(x) (((x) & 0x01f00000) >> 20) -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_HIGH_SET(x) (((x) << 20) & 0x01f00000) -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_NON_MSB 29 -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_NON_LSB 25 -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_NON_MASK 0x3e000000 -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_NON_GET(x) (((x) & 0x3e000000) >> 25) -#define PHY_BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_NON_SET(x) (((x) << 25) & 0x3e000000) - -/* macros for BB_rx_gain_bounds_1 */ -#define PHY_BB_RX_GAIN_BOUNDS_1_ADDRESS 0x0000a008 -#define PHY_BB_RX_GAIN_BOUNDS_1_OFFSET 0x0000a008 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_MB_GAIN_MSB 7 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_MB_GAIN_LSB 0 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_MB_GAIN_MASK 0x000000ff -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_MB_GAIN_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_MB_GAIN_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_REF_MSB 15 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_REF_LSB 8 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_REF_MASK 0x0000ff00 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_REF_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_REF_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_MSB 23 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_LSB 16 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_MASK 0x00ff0000 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_2G_MSB 24 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_2G_LSB 24 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_2G_MASK 0x01000000 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_2G_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_2G_SET(x) (((x) << 24) & 0x01000000) -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_5G_MSB 25 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_5G_LSB 25 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_5G_MASK 0x02000000 -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_5G_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_5G_SET(x) (((x) << 25) & 0x02000000) - -/* macros for BB_rx_gain_bounds_2 */ -#define PHY_BB_RX_GAIN_BOUNDS_2_ADDRESS 0x0000a00c -#define PHY_BB_RX_GAIN_BOUNDS_2_OFFSET 0x0000a00c -#define PHY_BB_RX_GAIN_BOUNDS_2_GC_RSSI_LOW_DB_MSB 7 -#define PHY_BB_RX_GAIN_BOUNDS_2_GC_RSSI_LOW_DB_LSB 0 -#define PHY_BB_RX_GAIN_BOUNDS_2_GC_RSSI_LOW_DB_MASK 0x000000ff -#define PHY_BB_RX_GAIN_BOUNDS_2_GC_RSSI_LOW_DB_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_RX_GAIN_BOUNDS_2_GC_RSSI_LOW_DB_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_REF_BASE_ADDR_MSB 15 -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_REF_BASE_ADDR_LSB 8 -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_REF_BASE_ADDR_MASK 0x0000ff00 -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_REF_BASE_ADDR_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_REF_BASE_ADDR_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_BASE_ADDR_MSB 23 -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_BASE_ADDR_LSB 16 -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_BASE_ADDR_MASK 0x00ff0000 -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_BASE_ADDR_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_BASE_ADDR_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_DIV_BASE_ADDR_MSB 31 -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_DIV_BASE_ADDR_LSB 24 -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_DIV_BASE_ADDR_MASK 0xff000000 -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_DIV_BASE_ADDR_GET(x) (((x) & 0xff000000) >> 24) -#define PHY_BB_RX_GAIN_BOUNDS_2_RF_GAIN_DIV_BASE_ADDR_SET(x) (((x) << 24) & 0xff000000) - -/* macros for BB_peak_det_cal_ctrl */ -#define PHY_BB_PEAK_DET_CAL_CTRL_ADDRESS 0x0000a010 -#define PHY_BB_PEAK_DET_CAL_CTRL_OFFSET 0x0000a010 -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_WIN_THR_MSB 5 -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_WIN_THR_LSB 0 -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_WIN_THR_MASK 0x0000003f -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_WIN_THR_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_WIN_THR_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_BIAS_MSB 11 -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_BIAS_LSB 6 -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_BIAS_MASK 0x00000fc0 -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_BIAS_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_BIAS_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_MEAS_TIME_SEL_MSB 13 -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_MEAS_TIME_SEL_LSB 12 -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_MEAS_TIME_SEL_MASK 0x00003000 -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_MEAS_TIME_SEL_GET(x) (((x) & 0x00003000) >> 12) -#define PHY_BB_PEAK_DET_CAL_CTRL_PKDET_CAL_MEAS_TIME_SEL_SET(x) (((x) << 12) & 0x00003000) - -/* macros for BB_agc_dig_dc_ctrl */ -#define PHY_BB_AGC_DIG_DC_CTRL_ADDRESS 0x0000a014 -#define PHY_BB_AGC_DIG_DC_CTRL_OFFSET 0x0000a014 -#define PHY_BB_AGC_DIG_DC_CTRL_USE_DIG_DC_MSB 0 -#define PHY_BB_AGC_DIG_DC_CTRL_USE_DIG_DC_LSB 0 -#define PHY_BB_AGC_DIG_DC_CTRL_USE_DIG_DC_MASK 0x00000001 -#define PHY_BB_AGC_DIG_DC_CTRL_USE_DIG_DC_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_AGC_DIG_DC_CTRL_USE_DIG_DC_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_SCALE_BIAS_MSB 3 -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_SCALE_BIAS_LSB 1 -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_SCALE_BIAS_MASK 0x0000000e -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_SCALE_BIAS_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_SCALE_BIAS_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_CORRECT_CAP_MSB 9 -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_CORRECT_CAP_LSB 4 -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_CORRECT_CAP_MASK 0x000003f0 -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_CORRECT_CAP_GET(x) (((x) & 0x000003f0) >> 4) -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_CORRECT_CAP_SET(x) (((x) << 4) & 0x000003f0) -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_MIXER_SEL_MASK_MSB 31 -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_MIXER_SEL_MASK_LSB 16 -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_MIXER_SEL_MASK_MASK 0xffff0000 -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_MIXER_SEL_MASK_GET(x) (((x) & 0xffff0000) >> 16) -#define PHY_BB_AGC_DIG_DC_CTRL_DIG_DC_MIXER_SEL_MASK_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for BB_agc_dig_dc_status_i_b0 */ -#define PHY_BB_AGC_DIG_DC_STATUS_I_B0_ADDRESS 0x0000a018 -#define PHY_BB_AGC_DIG_DC_STATUS_I_B0_OFFSET 0x0000a018 -#define PHY_BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C1_RES_I_0_MSB 8 -#define PHY_BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C1_RES_I_0_LSB 0 -#define PHY_BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C1_RES_I_0_MASK 0x000001ff -#define PHY_BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C1_RES_I_0_GET(x) (((x) & 0x000001ff) >> 0) -#define PHY_BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C2_RES_I_0_MSB 17 -#define PHY_BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C2_RES_I_0_LSB 9 -#define PHY_BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C2_RES_I_0_MASK 0x0003fe00 -#define PHY_BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C2_RES_I_0_GET(x) (((x) & 0x0003fe00) >> 9) -#define PHY_BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C3_RES_I_0_MSB 26 -#define PHY_BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C3_RES_I_0_LSB 18 -#define PHY_BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C3_RES_I_0_MASK 0x07fc0000 -#define PHY_BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C3_RES_I_0_GET(x) (((x) & 0x07fc0000) >> 18) - -/* macros for BB_agc_dig_dc_status_q_b0 */ -#define PHY_BB_AGC_DIG_DC_STATUS_Q_B0_ADDRESS 0x0000a01c -#define PHY_BB_AGC_DIG_DC_STATUS_Q_B0_OFFSET 0x0000a01c -#define PHY_BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C1_RES_Q_0_MSB 8 -#define PHY_BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C1_RES_Q_0_LSB 0 -#define PHY_BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C1_RES_Q_0_MASK 0x000001ff -#define PHY_BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C1_RES_Q_0_GET(x) (((x) & 0x000001ff) >> 0) -#define PHY_BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C2_RES_Q_0_MSB 17 -#define PHY_BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C2_RES_Q_0_LSB 9 -#define PHY_BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C2_RES_Q_0_MASK 0x0003fe00 -#define PHY_BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C2_RES_Q_0_GET(x) (((x) & 0x0003fe00) >> 9) -#define PHY_BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C3_RES_Q_0_MSB 26 -#define PHY_BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C3_RES_Q_0_LSB 18 -#define PHY_BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C3_RES_Q_0_MASK 0x07fc0000 -#define PHY_BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C3_RES_Q_0_GET(x) (((x) & 0x07fc0000) >> 18) - -/* macros for BB_bbb_txfir_0 */ -#define PHY_BB_BBB_TXFIR_0_ADDRESS 0x0000a1f4 -#define PHY_BB_BBB_TXFIR_0_OFFSET 0x0000a1f4 -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H0_MSB 3 -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H0_LSB 0 -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H0_MASK 0x0000000f -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H0_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H0_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H1_MSB 11 -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H1_LSB 8 -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H1_MASK 0x00000f00 -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H1_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H1_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H2_MSB 20 -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H2_LSB 16 -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H2_MASK 0x001f0000 -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H2_GET(x) (((x) & 0x001f0000) >> 16) -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H2_SET(x) (((x) << 16) & 0x001f0000) -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H3_MSB 28 -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H3_LSB 24 -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H3_MASK 0x1f000000 -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H3_GET(x) (((x) & 0x1f000000) >> 24) -#define PHY_BB_BBB_TXFIR_0_TXFIR_COEFF_H3_SET(x) (((x) << 24) & 0x1f000000) - -/* macros for BB_bbb_txfir_1 */ -#define PHY_BB_BBB_TXFIR_1_ADDRESS 0x0000a1f8 -#define PHY_BB_BBB_TXFIR_1_OFFSET 0x0000a1f8 -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H4_MSB 5 -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H4_LSB 0 -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H4_MASK 0x0000003f -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H4_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H4_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H5_MSB 13 -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H5_LSB 8 -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H5_MASK 0x00003f00 -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H5_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H5_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H6_MSB 22 -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H6_LSB 16 -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H6_MASK 0x007f0000 -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H6_GET(x) (((x) & 0x007f0000) >> 16) -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H6_SET(x) (((x) << 16) & 0x007f0000) -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H7_MSB 30 -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H7_LSB 24 -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H7_MASK 0x7f000000 -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H7_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_BB_BBB_TXFIR_1_TXFIR_COEFF_H7_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for BB_bbb_txfir_2 */ -#define PHY_BB_BBB_TXFIR_2_ADDRESS 0x0000a1fc -#define PHY_BB_BBB_TXFIR_2_OFFSET 0x0000a1fc -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H8_MSB 7 -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H8_LSB 0 -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H8_MASK 0x000000ff -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H8_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H8_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H9_MSB 15 -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H9_LSB 8 -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H9_MASK 0x0000ff00 -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H9_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H9_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H10_MSB 23 -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H10_LSB 16 -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H10_MASK 0x00ff0000 -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H10_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H10_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H11_MSB 31 -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H11_LSB 24 -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H11_MASK 0xff000000 -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H11_GET(x) (((x) & 0xff000000) >> 24) -#define PHY_BB_BBB_TXFIR_2_TXFIR_COEFF_H11_SET(x) (((x) << 24) & 0xff000000) - -/* macros for BB_modes_select */ -#define PHY_BB_MODES_SELECT_ADDRESS 0x0000a200 -#define PHY_BB_MODES_SELECT_OFFSET 0x0000a200 -#define PHY_BB_MODES_SELECT_CCK_MODE_MSB 0 -#define PHY_BB_MODES_SELECT_CCK_MODE_LSB 0 -#define PHY_BB_MODES_SELECT_CCK_MODE_MASK 0x00000001 -#define PHY_BB_MODES_SELECT_CCK_MODE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_MODES_SELECT_CCK_MODE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_MODES_SELECT_DYN_OFDM_CCK_MODE_MSB 2 -#define PHY_BB_MODES_SELECT_DYN_OFDM_CCK_MODE_LSB 2 -#define PHY_BB_MODES_SELECT_DYN_OFDM_CCK_MODE_MASK 0x00000004 -#define PHY_BB_MODES_SELECT_DYN_OFDM_CCK_MODE_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_BB_MODES_SELECT_DYN_OFDM_CCK_MODE_SET(x) (((x) << 2) & 0x00000004) -#define PHY_BB_MODES_SELECT_HALF_RATE_MODE_MSB 5 -#define PHY_BB_MODES_SELECT_HALF_RATE_MODE_LSB 5 -#define PHY_BB_MODES_SELECT_HALF_RATE_MODE_MASK 0x00000020 -#define PHY_BB_MODES_SELECT_HALF_RATE_MODE_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_BB_MODES_SELECT_HALF_RATE_MODE_SET(x) (((x) << 5) & 0x00000020) -#define PHY_BB_MODES_SELECT_QUARTER_RATE_MODE_MSB 6 -#define PHY_BB_MODES_SELECT_QUARTER_RATE_MODE_LSB 6 -#define PHY_BB_MODES_SELECT_QUARTER_RATE_MODE_MASK 0x00000040 -#define PHY_BB_MODES_SELECT_QUARTER_RATE_MODE_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_BB_MODES_SELECT_QUARTER_RATE_MODE_SET(x) (((x) << 6) & 0x00000040) -#define PHY_BB_MODES_SELECT_MAC_CLK_MODE_MSB 7 -#define PHY_BB_MODES_SELECT_MAC_CLK_MODE_LSB 7 -#define PHY_BB_MODES_SELECT_MAC_CLK_MODE_MASK 0x00000080 -#define PHY_BB_MODES_SELECT_MAC_CLK_MODE_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_BB_MODES_SELECT_MAC_CLK_MODE_SET(x) (((x) << 7) & 0x00000080) -#define PHY_BB_MODES_SELECT_DISABLE_DYN_CCK_DET_MSB 8 -#define PHY_BB_MODES_SELECT_DISABLE_DYN_CCK_DET_LSB 8 -#define PHY_BB_MODES_SELECT_DISABLE_DYN_CCK_DET_MASK 0x00000100 -#define PHY_BB_MODES_SELECT_DISABLE_DYN_CCK_DET_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_BB_MODES_SELECT_DISABLE_DYN_CCK_DET_SET(x) (((x) << 8) & 0x00000100) - -/* macros for BB_bbb_tx_ctrl */ -#define PHY_BB_BBB_TX_CTRL_ADDRESS 0x0000a204 -#define PHY_BB_BBB_TX_CTRL_OFFSET 0x0000a204 -#define PHY_BB_BBB_TX_CTRL_DISABLE_SCRAMBLER_MSB 0 -#define PHY_BB_BBB_TX_CTRL_DISABLE_SCRAMBLER_LSB 0 -#define PHY_BB_BBB_TX_CTRL_DISABLE_SCRAMBLER_MASK 0x00000001 -#define PHY_BB_BBB_TX_CTRL_DISABLE_SCRAMBLER_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_BBB_TX_CTRL_DISABLE_SCRAMBLER_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_BBB_TX_CTRL_USE_SCRAMBLER_SEED_MSB 1 -#define PHY_BB_BBB_TX_CTRL_USE_SCRAMBLER_SEED_LSB 1 -#define PHY_BB_BBB_TX_CTRL_USE_SCRAMBLER_SEED_MASK 0x00000002 -#define PHY_BB_BBB_TX_CTRL_USE_SCRAMBLER_SEED_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_BBB_TX_CTRL_USE_SCRAMBLER_SEED_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_BBB_TX_CTRL_TX_DAC_SCALE_CCK_MSB 3 -#define PHY_BB_BBB_TX_CTRL_TX_DAC_SCALE_CCK_LSB 2 -#define PHY_BB_BBB_TX_CTRL_TX_DAC_SCALE_CCK_MASK 0x0000000c -#define PHY_BB_BBB_TX_CTRL_TX_DAC_SCALE_CCK_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_BB_BBB_TX_CTRL_TX_DAC_SCALE_CCK_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_BB_BBB_TX_CTRL_TXFIR_JAPAN_CCK_MSB 4 -#define PHY_BB_BBB_TX_CTRL_TXFIR_JAPAN_CCK_LSB 4 -#define PHY_BB_BBB_TX_CTRL_TXFIR_JAPAN_CCK_MASK 0x00000010 -#define PHY_BB_BBB_TX_CTRL_TXFIR_JAPAN_CCK_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_BB_BBB_TX_CTRL_TXFIR_JAPAN_CCK_SET(x) (((x) << 4) & 0x00000010) -#define PHY_BB_BBB_TX_CTRL_ALLOW_1MBPS_SHORT_MSB 5 -#define PHY_BB_BBB_TX_CTRL_ALLOW_1MBPS_SHORT_LSB 5 -#define PHY_BB_BBB_TX_CTRL_ALLOW_1MBPS_SHORT_MASK 0x00000020 -#define PHY_BB_BBB_TX_CTRL_ALLOW_1MBPS_SHORT_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_BB_BBB_TX_CTRL_ALLOW_1MBPS_SHORT_SET(x) (((x) << 5) & 0x00000020) -#define PHY_BB_BBB_TX_CTRL_TX_CCK_DELAY_1_MSB 8 -#define PHY_BB_BBB_TX_CTRL_TX_CCK_DELAY_1_LSB 6 -#define PHY_BB_BBB_TX_CTRL_TX_CCK_DELAY_1_MASK 0x000001c0 -#define PHY_BB_BBB_TX_CTRL_TX_CCK_DELAY_1_GET(x) (((x) & 0x000001c0) >> 6) -#define PHY_BB_BBB_TX_CTRL_TX_CCK_DELAY_1_SET(x) (((x) << 6) & 0x000001c0) -#define PHY_BB_BBB_TX_CTRL_TX_CCK_DELAY_2_MSB 11 -#define PHY_BB_BBB_TX_CTRL_TX_CCK_DELAY_2_LSB 9 -#define PHY_BB_BBB_TX_CTRL_TX_CCK_DELAY_2_MASK 0x00000e00 -#define PHY_BB_BBB_TX_CTRL_TX_CCK_DELAY_2_GET(x) (((x) & 0x00000e00) >> 9) -#define PHY_BB_BBB_TX_CTRL_TX_CCK_DELAY_2_SET(x) (((x) << 9) & 0x00000e00) - -/* macros for BB_bbb_sig_detect */ -#define PHY_BB_BBB_SIG_DETECT_ADDRESS 0x0000a208 -#define PHY_BB_BBB_SIG_DETECT_OFFSET 0x0000a208 -#define PHY_BB_BBB_SIG_DETECT_WEAK_SIG_THR_CCK_MSB 5 -#define PHY_BB_BBB_SIG_DETECT_WEAK_SIG_THR_CCK_LSB 0 -#define PHY_BB_BBB_SIG_DETECT_WEAK_SIG_THR_CCK_MASK 0x0000003f -#define PHY_BB_BBB_SIG_DETECT_WEAK_SIG_THR_CCK_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_BBB_SIG_DETECT_WEAK_SIG_THR_CCK_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_BBB_SIG_DETECT_ANT_SWITCH_TIME_MSB 12 -#define PHY_BB_BBB_SIG_DETECT_ANT_SWITCH_TIME_LSB 6 -#define PHY_BB_BBB_SIG_DETECT_ANT_SWITCH_TIME_MASK 0x00001fc0 -#define PHY_BB_BBB_SIG_DETECT_ANT_SWITCH_TIME_GET(x) (((x) & 0x00001fc0) >> 6) -#define PHY_BB_BBB_SIG_DETECT_ANT_SWITCH_TIME_SET(x) (((x) << 6) & 0x00001fc0) -#define PHY_BB_BBB_SIG_DETECT_ENABLE_ANT_FAST_DIV_MSB 13 -#define PHY_BB_BBB_SIG_DETECT_ENABLE_ANT_FAST_DIV_LSB 13 -#define PHY_BB_BBB_SIG_DETECT_ENABLE_ANT_FAST_DIV_MASK 0x00002000 -#define PHY_BB_BBB_SIG_DETECT_ENABLE_ANT_FAST_DIV_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_BB_BBB_SIG_DETECT_ENABLE_ANT_FAST_DIV_SET(x) (((x) << 13) & 0x00002000) -#define PHY_BB_BBB_SIG_DETECT_LB_ALPHA_128_CCK_MSB 14 -#define PHY_BB_BBB_SIG_DETECT_LB_ALPHA_128_CCK_LSB 14 -#define PHY_BB_BBB_SIG_DETECT_LB_ALPHA_128_CCK_MASK 0x00004000 -#define PHY_BB_BBB_SIG_DETECT_LB_ALPHA_128_CCK_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_BB_BBB_SIG_DETECT_LB_ALPHA_128_CCK_SET(x) (((x) << 14) & 0x00004000) -#define PHY_BB_BBB_SIG_DETECT_LB_RX_ENABLE_CCK_MSB 15 -#define PHY_BB_BBB_SIG_DETECT_LB_RX_ENABLE_CCK_LSB 15 -#define PHY_BB_BBB_SIG_DETECT_LB_RX_ENABLE_CCK_MASK 0x00008000 -#define PHY_BB_BBB_SIG_DETECT_LB_RX_ENABLE_CCK_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_BB_BBB_SIG_DETECT_LB_RX_ENABLE_CCK_SET(x) (((x) << 15) & 0x00008000) -#define PHY_BB_BBB_SIG_DETECT_CYC32_COARSE_DC_EST_CCK_MSB 16 -#define PHY_BB_BBB_SIG_DETECT_CYC32_COARSE_DC_EST_CCK_LSB 16 -#define PHY_BB_BBB_SIG_DETECT_CYC32_COARSE_DC_EST_CCK_MASK 0x00010000 -#define PHY_BB_BBB_SIG_DETECT_CYC32_COARSE_DC_EST_CCK_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_BB_BBB_SIG_DETECT_CYC32_COARSE_DC_EST_CCK_SET(x) (((x) << 16) & 0x00010000) -#define PHY_BB_BBB_SIG_DETECT_CYC64_COARSE_DC_EST_CCK_MSB 17 -#define PHY_BB_BBB_SIG_DETECT_CYC64_COARSE_DC_EST_CCK_LSB 17 -#define PHY_BB_BBB_SIG_DETECT_CYC64_COARSE_DC_EST_CCK_MASK 0x00020000 -#define PHY_BB_BBB_SIG_DETECT_CYC64_COARSE_DC_EST_CCK_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_BB_BBB_SIG_DETECT_CYC64_COARSE_DC_EST_CCK_SET(x) (((x) << 17) & 0x00020000) -#define PHY_BB_BBB_SIG_DETECT_ENABLE_COARSE_DC_CCK_MSB 18 -#define PHY_BB_BBB_SIG_DETECT_ENABLE_COARSE_DC_CCK_LSB 18 -#define PHY_BB_BBB_SIG_DETECT_ENABLE_COARSE_DC_CCK_MASK 0x00040000 -#define PHY_BB_BBB_SIG_DETECT_ENABLE_COARSE_DC_CCK_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_BB_BBB_SIG_DETECT_ENABLE_COARSE_DC_CCK_SET(x) (((x) << 18) & 0x00040000) -#define PHY_BB_BBB_SIG_DETECT_CYC256_FINE_DC_EST_CCK_MSB 19 -#define PHY_BB_BBB_SIG_DETECT_CYC256_FINE_DC_EST_CCK_LSB 19 -#define PHY_BB_BBB_SIG_DETECT_CYC256_FINE_DC_EST_CCK_MASK 0x00080000 -#define PHY_BB_BBB_SIG_DETECT_CYC256_FINE_DC_EST_CCK_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_BB_BBB_SIG_DETECT_CYC256_FINE_DC_EST_CCK_SET(x) (((x) << 19) & 0x00080000) -#define PHY_BB_BBB_SIG_DETECT_ENABLE_FINE_DC_CCK_MSB 20 -#define PHY_BB_BBB_SIG_DETECT_ENABLE_FINE_DC_CCK_LSB 20 -#define PHY_BB_BBB_SIG_DETECT_ENABLE_FINE_DC_CCK_MASK 0x00100000 -#define PHY_BB_BBB_SIG_DETECT_ENABLE_FINE_DC_CCK_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_BB_BBB_SIG_DETECT_ENABLE_FINE_DC_CCK_SET(x) (((x) << 20) & 0x00100000) -#define PHY_BB_BBB_SIG_DETECT_DELAY_START_SYNC_CCK_MSB 21 -#define PHY_BB_BBB_SIG_DETECT_DELAY_START_SYNC_CCK_LSB 21 -#define PHY_BB_BBB_SIG_DETECT_DELAY_START_SYNC_CCK_MASK 0x00200000 -#define PHY_BB_BBB_SIG_DETECT_DELAY_START_SYNC_CCK_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_BB_BBB_SIG_DETECT_DELAY_START_SYNC_CCK_SET(x) (((x) << 21) & 0x00200000) -#define PHY_BB_BBB_SIG_DETECT_USE_DC_EST_DURING_SRCH_MSB 22 -#define PHY_BB_BBB_SIG_DETECT_USE_DC_EST_DURING_SRCH_LSB 22 -#define PHY_BB_BBB_SIG_DETECT_USE_DC_EST_DURING_SRCH_MASK 0x00400000 -#define PHY_BB_BBB_SIG_DETECT_USE_DC_EST_DURING_SRCH_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_BB_BBB_SIG_DETECT_USE_DC_EST_DURING_SRCH_SET(x) (((x) << 22) & 0x00400000) -#define PHY_BB_BBB_SIG_DETECT_ENABLE_BARKER_TWO_PHASE_MSB 31 -#define PHY_BB_BBB_SIG_DETECT_ENABLE_BARKER_TWO_PHASE_LSB 31 -#define PHY_BB_BBB_SIG_DETECT_ENABLE_BARKER_TWO_PHASE_MASK 0x80000000 -#define PHY_BB_BBB_SIG_DETECT_ENABLE_BARKER_TWO_PHASE_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_BBB_SIG_DETECT_ENABLE_BARKER_TWO_PHASE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_ext_atten_switch_ctl_b0 */ -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_ADDRESS 0x0000a20c -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_OFFSET 0x0000a20c -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_DB_0_MSB 5 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_DB_0_LSB 0 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_DB_0_MASK 0x0000003f -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_DB_0_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_DB_0_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_DB_0_MSB 11 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_DB_0_LSB 6 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_DB_0_MASK 0x00000fc0 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_DB_0_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_DB_0_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_MARGIN_0_MSB 16 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_MARGIN_0_LSB 12 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_MARGIN_0_MASK 0x0001f000 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_MARGIN_0_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_MARGIN_0_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_MARGIN_0_MSB 21 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_MARGIN_0_LSB 17 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_MARGIN_0_MASK 0x003e0000 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_MARGIN_0_GET(x) (((x) & 0x003e0000) >> 17) -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_MARGIN_0_SET(x) (((x) << 17) & 0x003e0000) - -/* macros for BB_bbb_rx_ctrl_1 */ -#define PHY_BB_BBB_RX_CTRL_1_ADDRESS 0x0000a210 -#define PHY_BB_BBB_RX_CTRL_1_OFFSET 0x0000a210 -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_2_MSB 2 -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_2_LSB 0 -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_2_MASK 0x00000007 -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_2_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_2_SET(x) (((x) << 0) & 0x00000007) -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_MSB 7 -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_LSB 3 -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_MASK 0x000000f8 -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_GET(x) (((x) & 0x000000f8) >> 3) -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_SET(x) (((x) << 3) & 0x000000f8) -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_N_SYNC_MSB 10 -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_N_SYNC_LSB 8 -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_N_SYNC_MASK 0x00000700 -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_N_SYNC_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_BB_BBB_RX_CTRL_1_COARSE_TIM_N_SYNC_SET(x) (((x) << 8) & 0x00000700) -#define PHY_BB_BBB_RX_CTRL_1_MAX_BAL_LONG_MSB 15 -#define PHY_BB_BBB_RX_CTRL_1_MAX_BAL_LONG_LSB 11 -#define PHY_BB_BBB_RX_CTRL_1_MAX_BAL_LONG_MASK 0x0000f800 -#define PHY_BB_BBB_RX_CTRL_1_MAX_BAL_LONG_GET(x) (((x) & 0x0000f800) >> 11) -#define PHY_BB_BBB_RX_CTRL_1_MAX_BAL_LONG_SET(x) (((x) << 11) & 0x0000f800) -#define PHY_BB_BBB_RX_CTRL_1_MAX_BAL_SHORT_MSB 20 -#define PHY_BB_BBB_RX_CTRL_1_MAX_BAL_SHORT_LSB 16 -#define PHY_BB_BBB_RX_CTRL_1_MAX_BAL_SHORT_MASK 0x001f0000 -#define PHY_BB_BBB_RX_CTRL_1_MAX_BAL_SHORT_GET(x) (((x) & 0x001f0000) >> 16) -#define PHY_BB_BBB_RX_CTRL_1_MAX_BAL_SHORT_SET(x) (((x) << 16) & 0x001f0000) -#define PHY_BB_BBB_RX_CTRL_1_RECON_LMS_STEP_MSB 23 -#define PHY_BB_BBB_RX_CTRL_1_RECON_LMS_STEP_LSB 21 -#define PHY_BB_BBB_RX_CTRL_1_RECON_LMS_STEP_MASK 0x00e00000 -#define PHY_BB_BBB_RX_CTRL_1_RECON_LMS_STEP_GET(x) (((x) & 0x00e00000) >> 21) -#define PHY_BB_BBB_RX_CTRL_1_RECON_LMS_STEP_SET(x) (((x) << 21) & 0x00e00000) -#define PHY_BB_BBB_RX_CTRL_1_SB_CHECK_WIN_MSB 30 -#define PHY_BB_BBB_RX_CTRL_1_SB_CHECK_WIN_LSB 24 -#define PHY_BB_BBB_RX_CTRL_1_SB_CHECK_WIN_MASK 0x7f000000 -#define PHY_BB_BBB_RX_CTRL_1_SB_CHECK_WIN_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_BB_BBB_RX_CTRL_1_SB_CHECK_WIN_SET(x) (((x) << 24) & 0x7f000000) -#define PHY_BB_BBB_RX_CTRL_1_EN_RX_ABORT_CCK_MSB 31 -#define PHY_BB_BBB_RX_CTRL_1_EN_RX_ABORT_CCK_LSB 31 -#define PHY_BB_BBB_RX_CTRL_1_EN_RX_ABORT_CCK_MASK 0x80000000 -#define PHY_BB_BBB_RX_CTRL_1_EN_RX_ABORT_CCK_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_BBB_RX_CTRL_1_EN_RX_ABORT_CCK_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_bbb_rx_ctrl_2 */ -#define PHY_BB_BBB_RX_CTRL_2_ADDRESS 0x0000a214 -#define PHY_BB_BBB_RX_CTRL_2_OFFSET 0x0000a214 -#define PHY_BB_BBB_RX_CTRL_2_FREQ_EST_N_AVG_LONG_MSB 5 -#define PHY_BB_BBB_RX_CTRL_2_FREQ_EST_N_AVG_LONG_LSB 0 -#define PHY_BB_BBB_RX_CTRL_2_FREQ_EST_N_AVG_LONG_MASK 0x0000003f -#define PHY_BB_BBB_RX_CTRL_2_FREQ_EST_N_AVG_LONG_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_BBB_RX_CTRL_2_FREQ_EST_N_AVG_LONG_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_BBB_RX_CTRL_2_CHAN_AVG_LONG_MSB 11 -#define PHY_BB_BBB_RX_CTRL_2_CHAN_AVG_LONG_LSB 6 -#define PHY_BB_BBB_RX_CTRL_2_CHAN_AVG_LONG_MASK 0x00000fc0 -#define PHY_BB_BBB_RX_CTRL_2_CHAN_AVG_LONG_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_BBB_RX_CTRL_2_CHAN_AVG_LONG_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_BBB_RX_CTRL_2_COARSE_TIM_THRESHOLD_3_MSB 16 -#define PHY_BB_BBB_RX_CTRL_2_COARSE_TIM_THRESHOLD_3_LSB 12 -#define PHY_BB_BBB_RX_CTRL_2_COARSE_TIM_THRESHOLD_3_MASK 0x0001f000 -#define PHY_BB_BBB_RX_CTRL_2_COARSE_TIM_THRESHOLD_3_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_BB_BBB_RX_CTRL_2_COARSE_TIM_THRESHOLD_3_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_BB_BBB_RX_CTRL_2_FREQ_TRACK_UPDATE_PERIOD_MSB 21 -#define PHY_BB_BBB_RX_CTRL_2_FREQ_TRACK_UPDATE_PERIOD_LSB 17 -#define PHY_BB_BBB_RX_CTRL_2_FREQ_TRACK_UPDATE_PERIOD_MASK 0x003e0000 -#define PHY_BB_BBB_RX_CTRL_2_FREQ_TRACK_UPDATE_PERIOD_GET(x) (((x) & 0x003e0000) >> 17) -#define PHY_BB_BBB_RX_CTRL_2_FREQ_TRACK_UPDATE_PERIOD_SET(x) (((x) << 17) & 0x003e0000) -#define PHY_BB_BBB_RX_CTRL_2_FREQ_EST_SCALING_PERIOD_MSB 25 -#define PHY_BB_BBB_RX_CTRL_2_FREQ_EST_SCALING_PERIOD_LSB 22 -#define PHY_BB_BBB_RX_CTRL_2_FREQ_EST_SCALING_PERIOD_MASK 0x03c00000 -#define PHY_BB_BBB_RX_CTRL_2_FREQ_EST_SCALING_PERIOD_GET(x) (((x) & 0x03c00000) >> 22) -#define PHY_BB_BBB_RX_CTRL_2_FREQ_EST_SCALING_PERIOD_SET(x) (((x) << 22) & 0x03c00000) -#define PHY_BB_BBB_RX_CTRL_2_LOOP_COEF_DPSK_C2_DATA_MSB 31 -#define PHY_BB_BBB_RX_CTRL_2_LOOP_COEF_DPSK_C2_DATA_LSB 26 -#define PHY_BB_BBB_RX_CTRL_2_LOOP_COEF_DPSK_C2_DATA_MASK 0xfc000000 -#define PHY_BB_BBB_RX_CTRL_2_LOOP_COEF_DPSK_C2_DATA_GET(x) (((x) & 0xfc000000) >> 26) -#define PHY_BB_BBB_RX_CTRL_2_LOOP_COEF_DPSK_C2_DATA_SET(x) (((x) << 26) & 0xfc000000) - -/* macros for BB_bbb_rx_ctrl_3 */ -#define PHY_BB_BBB_RX_CTRL_3_ADDRESS 0x0000a218 -#define PHY_BB_BBB_RX_CTRL_3_OFFSET 0x0000a218 -#define PHY_BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_DPSK_MSB 7 -#define PHY_BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_DPSK_LSB 0 -#define PHY_BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_DPSK_MASK 0x000000ff -#define PHY_BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_DPSK_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_DPSK_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_CCK_MSB 15 -#define PHY_BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_CCK_LSB 8 -#define PHY_BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_CCK_MASK 0x0000ff00 -#define PHY_BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_CCK_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_CCK_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_BBB_RX_CTRL_3_TIMER_N_SFD_MSB 23 -#define PHY_BB_BBB_RX_CTRL_3_TIMER_N_SFD_LSB 16 -#define PHY_BB_BBB_RX_CTRL_3_TIMER_N_SFD_MASK 0x00ff0000 -#define PHY_BB_BBB_RX_CTRL_3_TIMER_N_SFD_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_BBB_RX_CTRL_3_TIMER_N_SFD_SET(x) (((x) << 16) & 0x00ff0000) - -/* macros for BB_bbb_rx_ctrl_4 */ -#define PHY_BB_BBB_RX_CTRL_4_ADDRESS 0x0000a21c -#define PHY_BB_BBB_RX_CTRL_4_OFFSET 0x0000a21c -#define PHY_BB_BBB_RX_CTRL_4_TIMER_N_SYNC_MSB 3 -#define PHY_BB_BBB_RX_CTRL_4_TIMER_N_SYNC_LSB 0 -#define PHY_BB_BBB_RX_CTRL_4_TIMER_N_SYNC_MASK 0x0000000f -#define PHY_BB_BBB_RX_CTRL_4_TIMER_N_SYNC_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_BB_BBB_RX_CTRL_4_TIMER_N_SYNC_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_BB_BBB_RX_CTRL_4_TIM_ADJUST_TIMER_EXP_MSB 15 -#define PHY_BB_BBB_RX_CTRL_4_TIM_ADJUST_TIMER_EXP_LSB 4 -#define PHY_BB_BBB_RX_CTRL_4_TIM_ADJUST_TIMER_EXP_MASK 0x0000fff0 -#define PHY_BB_BBB_RX_CTRL_4_TIM_ADJUST_TIMER_EXP_GET(x) (((x) & 0x0000fff0) >> 4) -#define PHY_BB_BBB_RX_CTRL_4_TIM_ADJUST_TIMER_EXP_SET(x) (((x) << 4) & 0x0000fff0) -#define PHY_BB_BBB_RX_CTRL_4_FORCE_UNLOCKED_CLOCKS_MSB 16 -#define PHY_BB_BBB_RX_CTRL_4_FORCE_UNLOCKED_CLOCKS_LSB 16 -#define PHY_BB_BBB_RX_CTRL_4_FORCE_UNLOCKED_CLOCKS_MASK 0x00010000 -#define PHY_BB_BBB_RX_CTRL_4_FORCE_UNLOCKED_CLOCKS_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_BB_BBB_RX_CTRL_4_FORCE_UNLOCKED_CLOCKS_SET(x) (((x) << 16) & 0x00010000) -#define PHY_BB_BBB_RX_CTRL_4_DYNAMIC_PREAM_SEL_MSB 17 -#define PHY_BB_BBB_RX_CTRL_4_DYNAMIC_PREAM_SEL_LSB 17 -#define PHY_BB_BBB_RX_CTRL_4_DYNAMIC_PREAM_SEL_MASK 0x00020000 -#define PHY_BB_BBB_RX_CTRL_4_DYNAMIC_PREAM_SEL_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_BB_BBB_RX_CTRL_4_DYNAMIC_PREAM_SEL_SET(x) (((x) << 17) & 0x00020000) -#define PHY_BB_BBB_RX_CTRL_4_SHORT_PREAMBLE_MSB 18 -#define PHY_BB_BBB_RX_CTRL_4_SHORT_PREAMBLE_LSB 18 -#define PHY_BB_BBB_RX_CTRL_4_SHORT_PREAMBLE_MASK 0x00040000 -#define PHY_BB_BBB_RX_CTRL_4_SHORT_PREAMBLE_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_BB_BBB_RX_CTRL_4_SHORT_PREAMBLE_SET(x) (((x) << 18) & 0x00040000) -#define PHY_BB_BBB_RX_CTRL_4_FREQ_EST_N_AVG_SHORT_MSB 24 -#define PHY_BB_BBB_RX_CTRL_4_FREQ_EST_N_AVG_SHORT_LSB 19 -#define PHY_BB_BBB_RX_CTRL_4_FREQ_EST_N_AVG_SHORT_MASK 0x01f80000 -#define PHY_BB_BBB_RX_CTRL_4_FREQ_EST_N_AVG_SHORT_GET(x) (((x) & 0x01f80000) >> 19) -#define PHY_BB_BBB_RX_CTRL_4_FREQ_EST_N_AVG_SHORT_SET(x) (((x) << 19) & 0x01f80000) -#define PHY_BB_BBB_RX_CTRL_4_CHAN_AVG_SHORT_MSB 30 -#define PHY_BB_BBB_RX_CTRL_4_CHAN_AVG_SHORT_LSB 25 -#define PHY_BB_BBB_RX_CTRL_4_CHAN_AVG_SHORT_MASK 0x7e000000 -#define PHY_BB_BBB_RX_CTRL_4_CHAN_AVG_SHORT_GET(x) (((x) & 0x7e000000) >> 25) -#define PHY_BB_BBB_RX_CTRL_4_CHAN_AVG_SHORT_SET(x) (((x) << 25) & 0x7e000000) - -/* macros for BB_bbb_rx_ctrl_5 */ -#define PHY_BB_BBB_RX_CTRL_5_ADDRESS 0x0000a220 -#define PHY_BB_BBB_RX_CTRL_5_OFFSET 0x0000a220 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_DATA_MSB 4 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_DATA_LSB 0 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_DATA_MASK 0x0000001f -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_DATA_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_DATA_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_HEAD_MSB 9 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_HEAD_LSB 5 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_HEAD_MASK 0x000003e0 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_HEAD_GET(x) (((x) & 0x000003e0) >> 5) -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_HEAD_SET(x) (((x) << 5) & 0x000003e0) -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C2_HEAD_MSB 15 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C2_HEAD_LSB 10 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C2_HEAD_MASK 0x0000fc00 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C2_HEAD_GET(x) (((x) & 0x0000fc00) >> 10) -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C2_HEAD_SET(x) (((x) << 10) & 0x0000fc00) -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C1_MSB 20 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C1_LSB 16 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C1_MASK 0x001f0000 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C1_GET(x) (((x) & 0x001f0000) >> 16) -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C1_SET(x) (((x) << 16) & 0x001f0000) -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C2_MSB 26 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C2_LSB 21 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C2_MASK 0x07e00000 -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C2_GET(x) (((x) & 0x07e00000) >> 21) -#define PHY_BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C2_SET(x) (((x) << 21) & 0x07e00000) - -/* macros for BB_bbb_rx_ctrl_6 */ -#define PHY_BB_BBB_RX_CTRL_6_ADDRESS 0x0000a224 -#define PHY_BB_BBB_RX_CTRL_6_OFFSET 0x0000a224 -#define PHY_BB_BBB_RX_CTRL_6_SYNC_START_DELAY_MSB 9 -#define PHY_BB_BBB_RX_CTRL_6_SYNC_START_DELAY_LSB 0 -#define PHY_BB_BBB_RX_CTRL_6_SYNC_START_DELAY_MASK 0x000003ff -#define PHY_BB_BBB_RX_CTRL_6_SYNC_START_DELAY_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_BB_BBB_RX_CTRL_6_SYNC_START_DELAY_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_BB_BBB_RX_CTRL_6_MAP_1S_TO_2S_MSB 10 -#define PHY_BB_BBB_RX_CTRL_6_MAP_1S_TO_2S_LSB 10 -#define PHY_BB_BBB_RX_CTRL_6_MAP_1S_TO_2S_MASK 0x00000400 -#define PHY_BB_BBB_RX_CTRL_6_MAP_1S_TO_2S_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_BB_BBB_RX_CTRL_6_MAP_1S_TO_2S_SET(x) (((x) << 10) & 0x00000400) -#define PHY_BB_BBB_RX_CTRL_6_START_IIR_DELAY_MSB 20 -#define PHY_BB_BBB_RX_CTRL_6_START_IIR_DELAY_LSB 11 -#define PHY_BB_BBB_RX_CTRL_6_START_IIR_DELAY_MASK 0x001ff800 -#define PHY_BB_BBB_RX_CTRL_6_START_IIR_DELAY_GET(x) (((x) & 0x001ff800) >> 11) -#define PHY_BB_BBB_RX_CTRL_6_START_IIR_DELAY_SET(x) (((x) << 11) & 0x001ff800) - -/* macros for BB_bbb_dagc_ctrl */ -#define PHY_BB_BBB_DAGC_CTRL_ADDRESS 0x0000a228 -#define PHY_BB_BBB_DAGC_CTRL_OFFSET 0x0000a228 -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_DAGC_CCK_MSB 0 -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_DAGC_CCK_LSB 0 -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_DAGC_CCK_MASK 0x00000001 -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_DAGC_CCK_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_DAGC_CCK_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_BBB_DAGC_CTRL_DAGC_TARGET_PWR_CCK_MSB 8 -#define PHY_BB_BBB_DAGC_CTRL_DAGC_TARGET_PWR_CCK_LSB 1 -#define PHY_BB_BBB_DAGC_CTRL_DAGC_TARGET_PWR_CCK_MASK 0x000001fe -#define PHY_BB_BBB_DAGC_CTRL_DAGC_TARGET_PWR_CCK_GET(x) (((x) & 0x000001fe) >> 1) -#define PHY_BB_BBB_DAGC_CTRL_DAGC_TARGET_PWR_CCK_SET(x) (((x) << 1) & 0x000001fe) -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_BARKER_RSSI_THR_MSB 9 -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_BARKER_RSSI_THR_LSB 9 -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_BARKER_RSSI_THR_MASK 0x00000200 -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_BARKER_RSSI_THR_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_BARKER_RSSI_THR_SET(x) (((x) << 9) & 0x00000200) -#define PHY_BB_BBB_DAGC_CTRL_BARKER_RSSI_THR_MSB 16 -#define PHY_BB_BBB_DAGC_CTRL_BARKER_RSSI_THR_LSB 10 -#define PHY_BB_BBB_DAGC_CTRL_BARKER_RSSI_THR_MASK 0x0001fc00 -#define PHY_BB_BBB_DAGC_CTRL_BARKER_RSSI_THR_GET(x) (((x) & 0x0001fc00) >> 10) -#define PHY_BB_BBB_DAGC_CTRL_BARKER_RSSI_THR_SET(x) (((x) << 10) & 0x0001fc00) -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_FIRSTEP_SEL_MSB 17 -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_FIRSTEP_SEL_LSB 17 -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_FIRSTEP_SEL_MASK 0x00020000 -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_FIRSTEP_SEL_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_BB_BBB_DAGC_CTRL_ENABLE_FIRSTEP_SEL_SET(x) (((x) << 17) & 0x00020000) -#define PHY_BB_BBB_DAGC_CTRL_FIRSTEP_2_MSB 23 -#define PHY_BB_BBB_DAGC_CTRL_FIRSTEP_2_LSB 18 -#define PHY_BB_BBB_DAGC_CTRL_FIRSTEP_2_MASK 0x00fc0000 -#define PHY_BB_BBB_DAGC_CTRL_FIRSTEP_2_GET(x) (((x) & 0x00fc0000) >> 18) -#define PHY_BB_BBB_DAGC_CTRL_FIRSTEP_2_SET(x) (((x) << 18) & 0x00fc0000) -#define PHY_BB_BBB_DAGC_CTRL_FIRSTEP_COUNT_LGMAX_MSB 27 -#define PHY_BB_BBB_DAGC_CTRL_FIRSTEP_COUNT_LGMAX_LSB 24 -#define PHY_BB_BBB_DAGC_CTRL_FIRSTEP_COUNT_LGMAX_MASK 0x0f000000 -#define PHY_BB_BBB_DAGC_CTRL_FIRSTEP_COUNT_LGMAX_GET(x) (((x) & 0x0f000000) >> 24) -#define PHY_BB_BBB_DAGC_CTRL_FIRSTEP_COUNT_LGMAX_SET(x) (((x) << 24) & 0x0f000000) - -/* macros for BB_force_clken_cck */ -#define PHY_BB_FORCE_CLKEN_CCK_ADDRESS 0x0000a22c -#define PHY_BB_FORCE_CLKEN_CCK_OFFSET 0x0000a22c -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE0_MSB 0 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE0_LSB 0 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE0_MASK 0x00000001 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE0_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE0_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE1_MSB 1 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE1_LSB 1 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE1_MASK 0x00000002 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE1_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE1_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE2_MSB 2 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE2_LSB 2 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE2_MASK 0x00000004 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE2_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE2_SET(x) (((x) << 2) & 0x00000004) -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE3_MSB 3 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE3_LSB 3 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE3_MASK 0x00000008 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE3_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE3_SET(x) (((x) << 3) & 0x00000008) -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ALWAYS_MSB 4 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ALWAYS_LSB 4 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ALWAYS_MASK 0x00000010 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ALWAYS_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_RX_ALWAYS_SET(x) (((x) << 4) & 0x00000010) -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_TXSM_CLKEN_MSB 5 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_TXSM_CLKEN_LSB 5 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_TXSM_CLKEN_MASK 0x00000020 -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_TXSM_CLKEN_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_BB_FORCE_CLKEN_CCK_FORCE_TXSM_CLKEN_SET(x) (((x) << 5) & 0x00000020) - -/* macros for BB_rx_clear_delay */ -#define PHY_BB_RX_CLEAR_DELAY_ADDRESS 0x0000a230 -#define PHY_BB_RX_CLEAR_DELAY_OFFSET 0x0000a230 -#define PHY_BB_RX_CLEAR_DELAY_OFDM_XR_RX_CLEAR_DELAY_MSB 9 -#define PHY_BB_RX_CLEAR_DELAY_OFDM_XR_RX_CLEAR_DELAY_LSB 0 -#define PHY_BB_RX_CLEAR_DELAY_OFDM_XR_RX_CLEAR_DELAY_MASK 0x000003ff -#define PHY_BB_RX_CLEAR_DELAY_OFDM_XR_RX_CLEAR_DELAY_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_BB_RX_CLEAR_DELAY_OFDM_XR_RX_CLEAR_DELAY_SET(x) (((x) << 0) & 0x000003ff) - -/* macros for BB_powertx_rate3 */ -#define PHY_BB_POWERTX_RATE3_ADDRESS 0x0000a234 -#define PHY_BB_POWERTX_RATE3_OFFSET 0x0000a234 -#define PHY_BB_POWERTX_RATE3_POWERTX_1L_MSB 5 -#define PHY_BB_POWERTX_RATE3_POWERTX_1L_LSB 0 -#define PHY_BB_POWERTX_RATE3_POWERTX_1L_MASK 0x0000003f -#define PHY_BB_POWERTX_RATE3_POWERTX_1L_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_POWERTX_RATE3_POWERTX_1L_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_POWERTX_RATE3_POWERTX_2L_MSB 21 -#define PHY_BB_POWERTX_RATE3_POWERTX_2L_LSB 16 -#define PHY_BB_POWERTX_RATE3_POWERTX_2L_MASK 0x003f0000 -#define PHY_BB_POWERTX_RATE3_POWERTX_2L_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_POWERTX_RATE3_POWERTX_2L_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_POWERTX_RATE3_POWERTX_2S_MSB 29 -#define PHY_BB_POWERTX_RATE3_POWERTX_2S_LSB 24 -#define PHY_BB_POWERTX_RATE3_POWERTX_2S_MASK 0x3f000000 -#define PHY_BB_POWERTX_RATE3_POWERTX_2S_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_BB_POWERTX_RATE3_POWERTX_2S_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for BB_powertx_rate4 */ -#define PHY_BB_POWERTX_RATE4_ADDRESS 0x0000a238 -#define PHY_BB_POWERTX_RATE4_OFFSET 0x0000a238 -#define PHY_BB_POWERTX_RATE4_POWERTX_55L_MSB 5 -#define PHY_BB_POWERTX_RATE4_POWERTX_55L_LSB 0 -#define PHY_BB_POWERTX_RATE4_POWERTX_55L_MASK 0x0000003f -#define PHY_BB_POWERTX_RATE4_POWERTX_55L_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_POWERTX_RATE4_POWERTX_55L_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_POWERTX_RATE4_POWERTX_55S_MSB 13 -#define PHY_BB_POWERTX_RATE4_POWERTX_55S_LSB 8 -#define PHY_BB_POWERTX_RATE4_POWERTX_55S_MASK 0x00003f00 -#define PHY_BB_POWERTX_RATE4_POWERTX_55S_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_POWERTX_RATE4_POWERTX_55S_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_POWERTX_RATE4_POWERTX_11L_MSB 21 -#define PHY_BB_POWERTX_RATE4_POWERTX_11L_LSB 16 -#define PHY_BB_POWERTX_RATE4_POWERTX_11L_MASK 0x003f0000 -#define PHY_BB_POWERTX_RATE4_POWERTX_11L_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_POWERTX_RATE4_POWERTX_11L_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_POWERTX_RATE4_POWERTX_11S_MSB 29 -#define PHY_BB_POWERTX_RATE4_POWERTX_11S_LSB 24 -#define PHY_BB_POWERTX_RATE4_POWERTX_11S_MASK 0x3f000000 -#define PHY_BB_POWERTX_RATE4_POWERTX_11S_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_BB_POWERTX_RATE4_POWERTX_11S_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for BB_cck_spur_mit */ -#define PHY_BB_CCK_SPUR_MIT_ADDRESS 0x0000a240 -#define PHY_BB_CCK_SPUR_MIT_OFFSET 0x0000a240 -#define PHY_BB_CCK_SPUR_MIT_USE_CCK_SPUR_MIT_MSB 0 -#define PHY_BB_CCK_SPUR_MIT_USE_CCK_SPUR_MIT_LSB 0 -#define PHY_BB_CCK_SPUR_MIT_USE_CCK_SPUR_MIT_MASK 0x00000001 -#define PHY_BB_CCK_SPUR_MIT_USE_CCK_SPUR_MIT_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_CCK_SPUR_MIT_USE_CCK_SPUR_MIT_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_CCK_SPUR_MIT_SPUR_RSSI_THR_MSB 8 -#define PHY_BB_CCK_SPUR_MIT_SPUR_RSSI_THR_LSB 1 -#define PHY_BB_CCK_SPUR_MIT_SPUR_RSSI_THR_MASK 0x000001fe -#define PHY_BB_CCK_SPUR_MIT_SPUR_RSSI_THR_GET(x) (((x) & 0x000001fe) >> 1) -#define PHY_BB_CCK_SPUR_MIT_SPUR_RSSI_THR_SET(x) (((x) << 1) & 0x000001fe) -#define PHY_BB_CCK_SPUR_MIT_CCK_SPUR_FREQ_MSB 28 -#define PHY_BB_CCK_SPUR_MIT_CCK_SPUR_FREQ_LSB 9 -#define PHY_BB_CCK_SPUR_MIT_CCK_SPUR_FREQ_MASK 0x1ffffe00 -#define PHY_BB_CCK_SPUR_MIT_CCK_SPUR_FREQ_GET(x) (((x) & 0x1ffffe00) >> 9) -#define PHY_BB_CCK_SPUR_MIT_CCK_SPUR_FREQ_SET(x) (((x) << 9) & 0x1ffffe00) -#define PHY_BB_CCK_SPUR_MIT_SPUR_FILTER_TYPE_MSB 30 -#define PHY_BB_CCK_SPUR_MIT_SPUR_FILTER_TYPE_LSB 29 -#define PHY_BB_CCK_SPUR_MIT_SPUR_FILTER_TYPE_MASK 0x60000000 -#define PHY_BB_CCK_SPUR_MIT_SPUR_FILTER_TYPE_GET(x) (((x) & 0x60000000) >> 29) -#define PHY_BB_CCK_SPUR_MIT_SPUR_FILTER_TYPE_SET(x) (((x) << 29) & 0x60000000) - -/* macros for BB_panic_watchdog_status */ -#define PHY_BB_PANIC_WATCHDOG_STATUS_ADDRESS 0x0000a244 -#define PHY_BB_PANIC_WATCHDOG_STATUS_OFFSET 0x0000a244 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_1_MSB 2 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_1_LSB 0 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_1_MASK 0x00000007 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_1_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_1_SET(x) (((x) << 0) & 0x00000007) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_DET_HANG_MSB 3 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_DET_HANG_LSB 3 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_DET_HANG_MASK 0x00000008 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_DET_HANG_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_DET_HANG_SET(x) (((x) << 3) & 0x00000008) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_2_MSB 7 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_2_LSB 4 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_2_MASK 0x000000f0 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_2_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_2_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_3_MSB 11 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_3_LSB 8 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_3_MASK 0x00000f00 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_3_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_3_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_4_MSB 15 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_4_LSB 12 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_4_MASK 0x0000f000 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_4_GET(x) (((x) & 0x0000f000) >> 12) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_4_SET(x) (((x) << 12) & 0x0000f000) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_5_MSB 19 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_5_LSB 16 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_5_MASK 0x000f0000 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_5_GET(x) (((x) & 0x000f0000) >> 16) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_5_SET(x) (((x) << 16) & 0x000f0000) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_6_MSB 23 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_6_LSB 20 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_6_MASK 0x00f00000 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_6_GET(x) (((x) & 0x00f00000) >> 20) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_6_SET(x) (((x) << 20) & 0x00f00000) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_7_MSB 27 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_7_LSB 24 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_7_MASK 0x0f000000 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_7_GET(x) (((x) & 0x0f000000) >> 24) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_7_SET(x) (((x) << 24) & 0x0f000000) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_8_MSB 31 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_8_LSB 28 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_8_MASK 0xf0000000 -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_8_GET(x) (((x) & 0xf0000000) >> 28) -#define PHY_BB_PANIC_WATCHDOG_STATUS_PANIC_WATCHDOG_STATUS_8_SET(x) (((x) << 28) & 0xf0000000) - -/* macros for BB_panic_watchdog_ctrl_1 */ -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_ADDRESS 0x0000a248 -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_OFFSET 0x0000a248 -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_ENABLE_PANIC_WATCHDOG_NON_IDLE_MSB 0 -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_ENABLE_PANIC_WATCHDOG_NON_IDLE_LSB 0 -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_ENABLE_PANIC_WATCHDOG_NON_IDLE_MASK 0x00000001 -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_ENABLE_PANIC_WATCHDOG_NON_IDLE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_ENABLE_PANIC_WATCHDOG_NON_IDLE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_ENABLE_PANIC_WATCHDOG_IDLE_MSB 1 -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_ENABLE_PANIC_WATCHDOG_IDLE_LSB 1 -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_ENABLE_PANIC_WATCHDOG_IDLE_MASK 0x00000002 -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_ENABLE_PANIC_WATCHDOG_IDLE_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_ENABLE_PANIC_WATCHDOG_IDLE_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_PANIC_WATCHDOG_NON_IDLE_LIMIT_MSB 15 -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_PANIC_WATCHDOG_NON_IDLE_LIMIT_LSB 2 -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_PANIC_WATCHDOG_NON_IDLE_LIMIT_MASK 0x0000fffc -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_PANIC_WATCHDOG_NON_IDLE_LIMIT_GET(x) (((x) & 0x0000fffc) >> 2) -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_PANIC_WATCHDOG_NON_IDLE_LIMIT_SET(x) (((x) << 2) & 0x0000fffc) -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_PANIC_WATCHDOG_IDLE_LIMIT_MSB 31 -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_PANIC_WATCHDOG_IDLE_LIMIT_LSB 16 -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_PANIC_WATCHDOG_IDLE_LIMIT_MASK 0xffff0000 -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_PANIC_WATCHDOG_IDLE_LIMIT_GET(x) (((x) & 0xffff0000) >> 16) -#define PHY_BB_PANIC_WATCHDOG_CTRL_1_PANIC_WATCHDOG_IDLE_LIMIT_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for BB_panic_watchdog_ctrl_2 */ -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_ADDRESS 0x0000a24c -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_OFFSET 0x0000a24c -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_FORCE_FAST_ADC_CLK_MSB 0 -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_FORCE_FAST_ADC_CLK_LSB 0 -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_FORCE_FAST_ADC_CLK_MASK 0x00000001 -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_FORCE_FAST_ADC_CLK_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_FORCE_FAST_ADC_CLK_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_PANIC_WATCHDOG_RESET_ENA_MSB 1 -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_PANIC_WATCHDOG_RESET_ENA_LSB 1 -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_PANIC_WATCHDOG_RESET_ENA_MASK 0x00000002 -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_PANIC_WATCHDOG_RESET_ENA_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_PANIC_WATCHDOG_RESET_ENA_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_PANIC_WATCHDOG_IRQ_ENA_MSB 2 -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_PANIC_WATCHDOG_IRQ_ENA_LSB 2 -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_PANIC_WATCHDOG_IRQ_ENA_MASK 0x00000004 -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_PANIC_WATCHDOG_IRQ_ENA_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_BB_PANIC_WATCHDOG_CTRL_2_PANIC_WATCHDOG_IRQ_ENA_SET(x) (((x) << 2) & 0x00000004) - -/* macros for BB_iqcorr_ctrl_cck */ -#define PHY_BB_IQCORR_CTRL_CCK_ADDRESS 0x0000a250 -#define PHY_BB_IQCORR_CTRL_CCK_OFFSET 0x0000a250 -#define PHY_BB_IQCORR_CTRL_CCK_IQCORR_Q_Q_COFF_CCK_MSB 4 -#define PHY_BB_IQCORR_CTRL_CCK_IQCORR_Q_Q_COFF_CCK_LSB 0 -#define PHY_BB_IQCORR_CTRL_CCK_IQCORR_Q_Q_COFF_CCK_MASK 0x0000001f -#define PHY_BB_IQCORR_CTRL_CCK_IQCORR_Q_Q_COFF_CCK_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_IQCORR_CTRL_CCK_IQCORR_Q_Q_COFF_CCK_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_IQCORR_CTRL_CCK_IQCORR_Q_I_COFF_CCK_MSB 10 -#define PHY_BB_IQCORR_CTRL_CCK_IQCORR_Q_I_COFF_CCK_LSB 5 -#define PHY_BB_IQCORR_CTRL_CCK_IQCORR_Q_I_COFF_CCK_MASK 0x000007e0 -#define PHY_BB_IQCORR_CTRL_CCK_IQCORR_Q_I_COFF_CCK_GET(x) (((x) & 0x000007e0) >> 5) -#define PHY_BB_IQCORR_CTRL_CCK_IQCORR_Q_I_COFF_CCK_SET(x) (((x) << 5) & 0x000007e0) -#define PHY_BB_IQCORR_CTRL_CCK_ENABLE_IQCORR_CCK_MSB 11 -#define PHY_BB_IQCORR_CTRL_CCK_ENABLE_IQCORR_CCK_LSB 11 -#define PHY_BB_IQCORR_CTRL_CCK_ENABLE_IQCORR_CCK_MASK 0x00000800 -#define PHY_BB_IQCORR_CTRL_CCK_ENABLE_IQCORR_CCK_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_BB_IQCORR_CTRL_CCK_ENABLE_IQCORR_CCK_SET(x) (((x) << 11) & 0x00000800) -#define PHY_BB_IQCORR_CTRL_CCK_RXCAL_MEAS_TIME_SEL_MSB 13 -#define PHY_BB_IQCORR_CTRL_CCK_RXCAL_MEAS_TIME_SEL_LSB 12 -#define PHY_BB_IQCORR_CTRL_CCK_RXCAL_MEAS_TIME_SEL_MASK 0x00003000 -#define PHY_BB_IQCORR_CTRL_CCK_RXCAL_MEAS_TIME_SEL_GET(x) (((x) & 0x00003000) >> 12) -#define PHY_BB_IQCORR_CTRL_CCK_RXCAL_MEAS_TIME_SEL_SET(x) (((x) << 12) & 0x00003000) -#define PHY_BB_IQCORR_CTRL_CCK_CLCAL_MEAS_TIME_SEL_MSB 15 -#define PHY_BB_IQCORR_CTRL_CCK_CLCAL_MEAS_TIME_SEL_LSB 14 -#define PHY_BB_IQCORR_CTRL_CCK_CLCAL_MEAS_TIME_SEL_MASK 0x0000c000 -#define PHY_BB_IQCORR_CTRL_CCK_CLCAL_MEAS_TIME_SEL_GET(x) (((x) & 0x0000c000) >> 14) -#define PHY_BB_IQCORR_CTRL_CCK_CLCAL_MEAS_TIME_SEL_SET(x) (((x) << 14) & 0x0000c000) -#define PHY_BB_IQCORR_CTRL_CCK_CF_CLC_INIT_RFGAIN_MSB 20 -#define PHY_BB_IQCORR_CTRL_CCK_CF_CLC_INIT_RFGAIN_LSB 16 -#define PHY_BB_IQCORR_CTRL_CCK_CF_CLC_INIT_RFGAIN_MASK 0x001f0000 -#define PHY_BB_IQCORR_CTRL_CCK_CF_CLC_INIT_RFGAIN_GET(x) (((x) & 0x001f0000) >> 16) -#define PHY_BB_IQCORR_CTRL_CCK_CF_CLC_INIT_RFGAIN_SET(x) (((x) << 16) & 0x001f0000) -#define PHY_BB_IQCORR_CTRL_CCK_CF_CLC_PAL_MODE_MSB 21 -#define PHY_BB_IQCORR_CTRL_CCK_CF_CLC_PAL_MODE_LSB 21 -#define PHY_BB_IQCORR_CTRL_CCK_CF_CLC_PAL_MODE_MASK 0x00200000 -#define PHY_BB_IQCORR_CTRL_CCK_CF_CLC_PAL_MODE_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_BB_IQCORR_CTRL_CCK_CF_CLC_PAL_MODE_SET(x) (((x) << 21) & 0x00200000) - -/* macros for BB_bluetooth_cntl */ -#define PHY_BB_BLUETOOTH_CNTL_ADDRESS 0x0000a254 -#define PHY_BB_BLUETOOTH_CNTL_OFFSET 0x0000a254 -#define PHY_BB_BLUETOOTH_CNTL_BT_BREAK_CCK_EN_MSB 0 -#define PHY_BB_BLUETOOTH_CNTL_BT_BREAK_CCK_EN_LSB 0 -#define PHY_BB_BLUETOOTH_CNTL_BT_BREAK_CCK_EN_MASK 0x00000001 -#define PHY_BB_BLUETOOTH_CNTL_BT_BREAK_CCK_EN_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_BLUETOOTH_CNTL_BT_BREAK_CCK_EN_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_BLUETOOTH_CNTL_BT_ANT_HALT_WLAN_MSB 1 -#define PHY_BB_BLUETOOTH_CNTL_BT_ANT_HALT_WLAN_LSB 1 -#define PHY_BB_BLUETOOTH_CNTL_BT_ANT_HALT_WLAN_MASK 0x00000002 -#define PHY_BB_BLUETOOTH_CNTL_BT_ANT_HALT_WLAN_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_BLUETOOTH_CNTL_BT_ANT_HALT_WLAN_SET(x) (((x) << 1) & 0x00000002) - -/* macros for BB_tpc_1 */ -#define PHY_BB_TPC_1_ADDRESS 0x0000a258 -#define PHY_BB_TPC_1_OFFSET 0x0000a258 -#define PHY_BB_TPC_1_FORCE_DAC_GAIN_MSB 0 -#define PHY_BB_TPC_1_FORCE_DAC_GAIN_LSB 0 -#define PHY_BB_TPC_1_FORCE_DAC_GAIN_MASK 0x00000001 -#define PHY_BB_TPC_1_FORCE_DAC_GAIN_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_TPC_1_FORCE_DAC_GAIN_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_TPC_1_FORCED_DAC_GAIN_MSB 5 -#define PHY_BB_TPC_1_FORCED_DAC_GAIN_LSB 1 -#define PHY_BB_TPC_1_FORCED_DAC_GAIN_MASK 0x0000003e -#define PHY_BB_TPC_1_FORCED_DAC_GAIN_GET(x) (((x) & 0x0000003e) >> 1) -#define PHY_BB_TPC_1_FORCED_DAC_GAIN_SET(x) (((x) << 1) & 0x0000003e) -#define PHY_BB_TPC_1_PD_DC_OFFSET_TARGET_MSB 13 -#define PHY_BB_TPC_1_PD_DC_OFFSET_TARGET_LSB 6 -#define PHY_BB_TPC_1_PD_DC_OFFSET_TARGET_MASK 0x00003fc0 -#define PHY_BB_TPC_1_PD_DC_OFFSET_TARGET_GET(x) (((x) & 0x00003fc0) >> 6) -#define PHY_BB_TPC_1_PD_DC_OFFSET_TARGET_SET(x) (((x) << 6) & 0x00003fc0) -#define PHY_BB_TPC_1_NUM_PD_GAIN_MSB 15 -#define PHY_BB_TPC_1_NUM_PD_GAIN_LSB 14 -#define PHY_BB_TPC_1_NUM_PD_GAIN_MASK 0x0000c000 -#define PHY_BB_TPC_1_NUM_PD_GAIN_GET(x) (((x) & 0x0000c000) >> 14) -#define PHY_BB_TPC_1_NUM_PD_GAIN_SET(x) (((x) << 14) & 0x0000c000) -#define PHY_BB_TPC_1_PD_GAIN_SETTING1_MSB 17 -#define PHY_BB_TPC_1_PD_GAIN_SETTING1_LSB 16 -#define PHY_BB_TPC_1_PD_GAIN_SETTING1_MASK 0x00030000 -#define PHY_BB_TPC_1_PD_GAIN_SETTING1_GET(x) (((x) & 0x00030000) >> 16) -#define PHY_BB_TPC_1_PD_GAIN_SETTING1_SET(x) (((x) << 16) & 0x00030000) -#define PHY_BB_TPC_1_PD_GAIN_SETTING2_MSB 19 -#define PHY_BB_TPC_1_PD_GAIN_SETTING2_LSB 18 -#define PHY_BB_TPC_1_PD_GAIN_SETTING2_MASK 0x000c0000 -#define PHY_BB_TPC_1_PD_GAIN_SETTING2_GET(x) (((x) & 0x000c0000) >> 18) -#define PHY_BB_TPC_1_PD_GAIN_SETTING2_SET(x) (((x) << 18) & 0x000c0000) -#define PHY_BB_TPC_1_PD_GAIN_SETTING3_MSB 21 -#define PHY_BB_TPC_1_PD_GAIN_SETTING3_LSB 20 -#define PHY_BB_TPC_1_PD_GAIN_SETTING3_MASK 0x00300000 -#define PHY_BB_TPC_1_PD_GAIN_SETTING3_GET(x) (((x) & 0x00300000) >> 20) -#define PHY_BB_TPC_1_PD_GAIN_SETTING3_SET(x) (((x) << 20) & 0x00300000) -#define PHY_BB_TPC_1_ENABLE_PD_CALIBRATE_MSB 22 -#define PHY_BB_TPC_1_ENABLE_PD_CALIBRATE_LSB 22 -#define PHY_BB_TPC_1_ENABLE_PD_CALIBRATE_MASK 0x00400000 -#define PHY_BB_TPC_1_ENABLE_PD_CALIBRATE_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_BB_TPC_1_ENABLE_PD_CALIBRATE_SET(x) (((x) << 22) & 0x00400000) -#define PHY_BB_TPC_1_PD_CALIBRATE_WAIT_MSB 28 -#define PHY_BB_TPC_1_PD_CALIBRATE_WAIT_LSB 23 -#define PHY_BB_TPC_1_PD_CALIBRATE_WAIT_MASK 0x1f800000 -#define PHY_BB_TPC_1_PD_CALIBRATE_WAIT_GET(x) (((x) & 0x1f800000) >> 23) -#define PHY_BB_TPC_1_PD_CALIBRATE_WAIT_SET(x) (((x) << 23) & 0x1f800000) -#define PHY_BB_TPC_1_FORCE_PDADC_GAIN_MSB 29 -#define PHY_BB_TPC_1_FORCE_PDADC_GAIN_LSB 29 -#define PHY_BB_TPC_1_FORCE_PDADC_GAIN_MASK 0x20000000 -#define PHY_BB_TPC_1_FORCE_PDADC_GAIN_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_BB_TPC_1_FORCE_PDADC_GAIN_SET(x) (((x) << 29) & 0x20000000) -#define PHY_BB_TPC_1_FORCED_PDADC_GAIN_MSB 31 -#define PHY_BB_TPC_1_FORCED_PDADC_GAIN_LSB 30 -#define PHY_BB_TPC_1_FORCED_PDADC_GAIN_MASK 0xc0000000 -#define PHY_BB_TPC_1_FORCED_PDADC_GAIN_GET(x) (((x) & 0xc0000000) >> 30) -#define PHY_BB_TPC_1_FORCED_PDADC_GAIN_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for BB_tpc_2 */ -#define PHY_BB_TPC_2_ADDRESS 0x0000a25c -#define PHY_BB_TPC_2_OFFSET 0x0000a25c -#define PHY_BB_TPC_2_TX_FRAME_TO_PDADC_ON_MSB 7 -#define PHY_BB_TPC_2_TX_FRAME_TO_PDADC_ON_LSB 0 -#define PHY_BB_TPC_2_TX_FRAME_TO_PDADC_ON_MASK 0x000000ff -#define PHY_BB_TPC_2_TX_FRAME_TO_PDADC_ON_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_TPC_2_TX_FRAME_TO_PDADC_ON_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_TPC_2_TX_FRAME_TO_PD_ACC_OFDM_MSB 15 -#define PHY_BB_TPC_2_TX_FRAME_TO_PD_ACC_OFDM_LSB 8 -#define PHY_BB_TPC_2_TX_FRAME_TO_PD_ACC_OFDM_MASK 0x0000ff00 -#define PHY_BB_TPC_2_TX_FRAME_TO_PD_ACC_OFDM_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_TPC_2_TX_FRAME_TO_PD_ACC_OFDM_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_TPC_2_TX_FRAME_TO_PD_ACC_CCK_MSB 23 -#define PHY_BB_TPC_2_TX_FRAME_TO_PD_ACC_CCK_LSB 16 -#define PHY_BB_TPC_2_TX_FRAME_TO_PD_ACC_CCK_MASK 0x00ff0000 -#define PHY_BB_TPC_2_TX_FRAME_TO_PD_ACC_CCK_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_TPC_2_TX_FRAME_TO_PD_ACC_CCK_SET(x) (((x) << 16) & 0x00ff0000) - -/* macros for BB_tpc_3 */ -#define PHY_BB_TPC_3_ADDRESS 0x0000a260 -#define PHY_BB_TPC_3_OFFSET 0x0000a260 -#define PHY_BB_TPC_3_TX_END_TO_PDADC_ON_MSB 7 -#define PHY_BB_TPC_3_TX_END_TO_PDADC_ON_LSB 0 -#define PHY_BB_TPC_3_TX_END_TO_PDADC_ON_MASK 0x000000ff -#define PHY_BB_TPC_3_TX_END_TO_PDADC_ON_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_TPC_3_TX_END_TO_PDADC_ON_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_TPC_3_TX_END_TO_PD_ACC_ON_MSB 15 -#define PHY_BB_TPC_3_TX_END_TO_PD_ACC_ON_LSB 8 -#define PHY_BB_TPC_3_TX_END_TO_PD_ACC_ON_MASK 0x0000ff00 -#define PHY_BB_TPC_3_TX_END_TO_PD_ACC_ON_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_TPC_3_TX_END_TO_PD_ACC_ON_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_TPC_3_PD_ACC_WINDOW_DC_OFF_MSB 18 -#define PHY_BB_TPC_3_PD_ACC_WINDOW_DC_OFF_LSB 16 -#define PHY_BB_TPC_3_PD_ACC_WINDOW_DC_OFF_MASK 0x00070000 -#define PHY_BB_TPC_3_PD_ACC_WINDOW_DC_OFF_GET(x) (((x) & 0x00070000) >> 16) -#define PHY_BB_TPC_3_PD_ACC_WINDOW_DC_OFF_SET(x) (((x) << 16) & 0x00070000) -#define PHY_BB_TPC_3_PD_ACC_WINDOW_CAL_MSB 21 -#define PHY_BB_TPC_3_PD_ACC_WINDOW_CAL_LSB 19 -#define PHY_BB_TPC_3_PD_ACC_WINDOW_CAL_MASK 0x00380000 -#define PHY_BB_TPC_3_PD_ACC_WINDOW_CAL_GET(x) (((x) & 0x00380000) >> 19) -#define PHY_BB_TPC_3_PD_ACC_WINDOW_CAL_SET(x) (((x) << 19) & 0x00380000) -#define PHY_BB_TPC_3_PD_ACC_WINDOW_OFDM_MSB 24 -#define PHY_BB_TPC_3_PD_ACC_WINDOW_OFDM_LSB 22 -#define PHY_BB_TPC_3_PD_ACC_WINDOW_OFDM_MASK 0x01c00000 -#define PHY_BB_TPC_3_PD_ACC_WINDOW_OFDM_GET(x) (((x) & 0x01c00000) >> 22) -#define PHY_BB_TPC_3_PD_ACC_WINDOW_OFDM_SET(x) (((x) << 22) & 0x01c00000) -#define PHY_BB_TPC_3_PD_ACC_WINDOW_CCK_MSB 27 -#define PHY_BB_TPC_3_PD_ACC_WINDOW_CCK_LSB 25 -#define PHY_BB_TPC_3_PD_ACC_WINDOW_CCK_MASK 0x0e000000 -#define PHY_BB_TPC_3_PD_ACC_WINDOW_CCK_GET(x) (((x) & 0x0e000000) >> 25) -#define PHY_BB_TPC_3_PD_ACC_WINDOW_CCK_SET(x) (((x) << 25) & 0x0e000000) -#define PHY_BB_TPC_3_TPC_CLK_GATE_ENABLE_MSB 31 -#define PHY_BB_TPC_3_TPC_CLK_GATE_ENABLE_LSB 31 -#define PHY_BB_TPC_3_TPC_CLK_GATE_ENABLE_MASK 0x80000000 -#define PHY_BB_TPC_3_TPC_CLK_GATE_ENABLE_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_TPC_3_TPC_CLK_GATE_ENABLE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_tpc_4_b0 */ -#define PHY_BB_TPC_4_B0_ADDRESS 0x0000a264 -#define PHY_BB_TPC_4_B0_OFFSET 0x0000a264 -#define PHY_BB_TPC_4_B0_PD_AVG_VALID_0_MSB 0 -#define PHY_BB_TPC_4_B0_PD_AVG_VALID_0_LSB 0 -#define PHY_BB_TPC_4_B0_PD_AVG_VALID_0_MASK 0x00000001 -#define PHY_BB_TPC_4_B0_PD_AVG_VALID_0_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_TPC_4_B0_PD_AVG_OUT_0_MSB 8 -#define PHY_BB_TPC_4_B0_PD_AVG_OUT_0_LSB 1 -#define PHY_BB_TPC_4_B0_PD_AVG_OUT_0_MASK 0x000001fe -#define PHY_BB_TPC_4_B0_PD_AVG_OUT_0_GET(x) (((x) & 0x000001fe) >> 1) -#define PHY_BB_TPC_4_B0_DAC_GAIN_0_MSB 13 -#define PHY_BB_TPC_4_B0_DAC_GAIN_0_LSB 9 -#define PHY_BB_TPC_4_B0_DAC_GAIN_0_MASK 0x00003e00 -#define PHY_BB_TPC_4_B0_DAC_GAIN_0_GET(x) (((x) & 0x00003e00) >> 9) -#define PHY_BB_TPC_4_B0_TX_GAIN_SETTING_0_MSB 19 -#define PHY_BB_TPC_4_B0_TX_GAIN_SETTING_0_LSB 14 -#define PHY_BB_TPC_4_B0_TX_GAIN_SETTING_0_MASK 0x000fc000 -#define PHY_BB_TPC_4_B0_TX_GAIN_SETTING_0_GET(x) (((x) & 0x000fc000) >> 14) -#define PHY_BB_TPC_4_B0_RATE_SENT_0_MSB 24 -#define PHY_BB_TPC_4_B0_RATE_SENT_0_LSB 20 -#define PHY_BB_TPC_4_B0_RATE_SENT_0_MASK 0x01f00000 -#define PHY_BB_TPC_4_B0_RATE_SENT_0_GET(x) (((x) & 0x01f00000) >> 20) -#define PHY_BB_TPC_4_B0_ERROR_EST_UPDATE_POWER_THRESH_MSB 30 -#define PHY_BB_TPC_4_B0_ERROR_EST_UPDATE_POWER_THRESH_LSB 25 -#define PHY_BB_TPC_4_B0_ERROR_EST_UPDATE_POWER_THRESH_MASK 0x7e000000 -#define PHY_BB_TPC_4_B0_ERROR_EST_UPDATE_POWER_THRESH_GET(x) (((x) & 0x7e000000) >> 25) -#define PHY_BB_TPC_4_B0_ERROR_EST_UPDATE_POWER_THRESH_SET(x) (((x) << 25) & 0x7e000000) - -/* macros for BB_analog_swap */ -#define PHY_BB_ANALOG_SWAP_ADDRESS 0x0000a268 -#define PHY_BB_ANALOG_SWAP_OFFSET 0x0000a268 -#define PHY_BB_ANALOG_SWAP_ANALOG_RX_SWAP_CNTL_MSB 2 -#define PHY_BB_ANALOG_SWAP_ANALOG_RX_SWAP_CNTL_LSB 0 -#define PHY_BB_ANALOG_SWAP_ANALOG_RX_SWAP_CNTL_MASK 0x00000007 -#define PHY_BB_ANALOG_SWAP_ANALOG_RX_SWAP_CNTL_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_BB_ANALOG_SWAP_ANALOG_RX_SWAP_CNTL_SET(x) (((x) << 0) & 0x00000007) -#define PHY_BB_ANALOG_SWAP_ANALOG_TX_SWAP_CNTL_MSB 5 -#define PHY_BB_ANALOG_SWAP_ANALOG_TX_SWAP_CNTL_LSB 3 -#define PHY_BB_ANALOG_SWAP_ANALOG_TX_SWAP_CNTL_MASK 0x00000038 -#define PHY_BB_ANALOG_SWAP_ANALOG_TX_SWAP_CNTL_GET(x) (((x) & 0x00000038) >> 3) -#define PHY_BB_ANALOG_SWAP_ANALOG_TX_SWAP_CNTL_SET(x) (((x) << 3) & 0x00000038) -#define PHY_BB_ANALOG_SWAP_SWAP_ALT_CHN_MSB 6 -#define PHY_BB_ANALOG_SWAP_SWAP_ALT_CHN_LSB 6 -#define PHY_BB_ANALOG_SWAP_SWAP_ALT_CHN_MASK 0x00000040 -#define PHY_BB_ANALOG_SWAP_SWAP_ALT_CHN_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_BB_ANALOG_SWAP_SWAP_ALT_CHN_SET(x) (((x) << 6) & 0x00000040) -#define PHY_BB_ANALOG_SWAP_ANALOG_DC_DAC_POLARITY_MSB 7 -#define PHY_BB_ANALOG_SWAP_ANALOG_DC_DAC_POLARITY_LSB 7 -#define PHY_BB_ANALOG_SWAP_ANALOG_DC_DAC_POLARITY_MASK 0x00000080 -#define PHY_BB_ANALOG_SWAP_ANALOG_DC_DAC_POLARITY_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_BB_ANALOG_SWAP_ANALOG_DC_DAC_POLARITY_SET(x) (((x) << 7) & 0x00000080) -#define PHY_BB_ANALOG_SWAP_ANALOG_PKDET_DAC_POLARITY_MSB 8 -#define PHY_BB_ANALOG_SWAP_ANALOG_PKDET_DAC_POLARITY_LSB 8 -#define PHY_BB_ANALOG_SWAP_ANALOG_PKDET_DAC_POLARITY_MASK 0x00000100 -#define PHY_BB_ANALOG_SWAP_ANALOG_PKDET_DAC_POLARITY_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_BB_ANALOG_SWAP_ANALOG_PKDET_DAC_POLARITY_SET(x) (((x) << 8) & 0x00000100) - -/* macros for BB_tpc_5_b0 */ -#define PHY_BB_TPC_5_B0_ADDRESS 0x0000a26c -#define PHY_BB_TPC_5_B0_OFFSET 0x0000a26c -#define PHY_BB_TPC_5_B0_PD_GAIN_OVERLAP_MSB 3 -#define PHY_BB_TPC_5_B0_PD_GAIN_OVERLAP_LSB 0 -#define PHY_BB_TPC_5_B0_PD_GAIN_OVERLAP_MASK 0x0000000f -#define PHY_BB_TPC_5_B0_PD_GAIN_OVERLAP_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_BB_TPC_5_B0_PD_GAIN_OVERLAP_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_1_0_MSB 9 -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_1_0_LSB 4 -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_1_0_MASK 0x000003f0 -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_1_0_GET(x) (((x) & 0x000003f0) >> 4) -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_1_0_SET(x) (((x) << 4) & 0x000003f0) -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_2_0_MSB 15 -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_2_0_LSB 10 -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_2_0_MASK 0x0000fc00 -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_2_0_GET(x) (((x) & 0x0000fc00) >> 10) -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_2_0_SET(x) (((x) << 10) & 0x0000fc00) -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_3_0_MSB 21 -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_3_0_LSB 16 -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_3_0_MASK 0x003f0000 -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_3_0_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_3_0_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_4_0_MSB 27 -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_4_0_LSB 22 -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_4_0_MASK 0x0fc00000 -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_4_0_GET(x) (((x) & 0x0fc00000) >> 22) -#define PHY_BB_TPC_5_B0_PD_GAIN_BOUNDARY_4_0_SET(x) (((x) << 22) & 0x0fc00000) - -/* macros for BB_tpc_6_b0 */ -#define PHY_BB_TPC_6_B0_ADDRESS 0x0000a270 -#define PHY_BB_TPC_6_B0_OFFSET 0x0000a270 -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_1_0_MSB 5 -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_1_0_LSB 0 -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_1_0_MASK 0x0000003f -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_1_0_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_1_0_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_2_0_MSB 11 -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_2_0_LSB 6 -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_2_0_MASK 0x00000fc0 -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_2_0_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_2_0_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_3_0_MSB 17 -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_3_0_LSB 12 -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_3_0_MASK 0x0003f000 -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_3_0_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_3_0_SET(x) (((x) << 12) & 0x0003f000) -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_4_0_MSB 23 -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_4_0_LSB 18 -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_4_0_MASK 0x00fc0000 -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_4_0_GET(x) (((x) & 0x00fc0000) >> 18) -#define PHY_BB_TPC_6_B0_PD_DAC_SETTING_4_0_SET(x) (((x) << 18) & 0x00fc0000) -#define PHY_BB_TPC_6_B0_ERROR_EST_MODE_MSB 25 -#define PHY_BB_TPC_6_B0_ERROR_EST_MODE_LSB 24 -#define PHY_BB_TPC_6_B0_ERROR_EST_MODE_MASK 0x03000000 -#define PHY_BB_TPC_6_B0_ERROR_EST_MODE_GET(x) (((x) & 0x03000000) >> 24) -#define PHY_BB_TPC_6_B0_ERROR_EST_MODE_SET(x) (((x) << 24) & 0x03000000) -#define PHY_BB_TPC_6_B0_ERROR_EST_FILTER_COEFF_MSB 28 -#define PHY_BB_TPC_6_B0_ERROR_EST_FILTER_COEFF_LSB 26 -#define PHY_BB_TPC_6_B0_ERROR_EST_FILTER_COEFF_MASK 0x1c000000 -#define PHY_BB_TPC_6_B0_ERROR_EST_FILTER_COEFF_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_BB_TPC_6_B0_ERROR_EST_FILTER_COEFF_SET(x) (((x) << 26) & 0x1c000000) - -/* macros for BB_tpc_7 */ -#define PHY_BB_TPC_7_ADDRESS 0x0000a274 -#define PHY_BB_TPC_7_OFFSET 0x0000a274 -#define PHY_BB_TPC_7_TX_GAIN_TABLE_MAX_MSB 5 -#define PHY_BB_TPC_7_TX_GAIN_TABLE_MAX_LSB 0 -#define PHY_BB_TPC_7_TX_GAIN_TABLE_MAX_MASK 0x0000003f -#define PHY_BB_TPC_7_TX_GAIN_TABLE_MAX_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_TPC_7_TX_GAIN_TABLE_MAX_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_TPC_7_INIT_TX_GAIN_SETTING_MSB 11 -#define PHY_BB_TPC_7_INIT_TX_GAIN_SETTING_LSB 6 -#define PHY_BB_TPC_7_INIT_TX_GAIN_SETTING_MASK 0x00000fc0 -#define PHY_BB_TPC_7_INIT_TX_GAIN_SETTING_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_TPC_7_INIT_TX_GAIN_SETTING_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_TPC_7_EN_CL_GAIN_MOD_MSB 12 -#define PHY_BB_TPC_7_EN_CL_GAIN_MOD_LSB 12 -#define PHY_BB_TPC_7_EN_CL_GAIN_MOD_MASK 0x00001000 -#define PHY_BB_TPC_7_EN_CL_GAIN_MOD_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_BB_TPC_7_EN_CL_GAIN_MOD_SET(x) (((x) << 12) & 0x00001000) -#define PHY_BB_TPC_7_USE_TX_PD_IN_XPA_MSB 13 -#define PHY_BB_TPC_7_USE_TX_PD_IN_XPA_LSB 13 -#define PHY_BB_TPC_7_USE_TX_PD_IN_XPA_MASK 0x00002000 -#define PHY_BB_TPC_7_USE_TX_PD_IN_XPA_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_BB_TPC_7_USE_TX_PD_IN_XPA_SET(x) (((x) << 13) & 0x00002000) -#define PHY_BB_TPC_7_EXTEND_TX_FRAME_FOR_TPC_MSB 14 -#define PHY_BB_TPC_7_EXTEND_TX_FRAME_FOR_TPC_LSB 14 -#define PHY_BB_TPC_7_EXTEND_TX_FRAME_FOR_TPC_MASK 0x00004000 -#define PHY_BB_TPC_7_EXTEND_TX_FRAME_FOR_TPC_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_BB_TPC_7_EXTEND_TX_FRAME_FOR_TPC_SET(x) (((x) << 14) & 0x00004000) -#define PHY_BB_TPC_7_USE_INIT_TX_GAIN_SETTING_AFTER_WARM_RESET_MSB 15 -#define PHY_BB_TPC_7_USE_INIT_TX_GAIN_SETTING_AFTER_WARM_RESET_LSB 15 -#define PHY_BB_TPC_7_USE_INIT_TX_GAIN_SETTING_AFTER_WARM_RESET_MASK 0x00008000 -#define PHY_BB_TPC_7_USE_INIT_TX_GAIN_SETTING_AFTER_WARM_RESET_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_BB_TPC_7_USE_INIT_TX_GAIN_SETTING_AFTER_WARM_RESET_SET(x) (((x) << 15) & 0x00008000) - -/* macros for BB_tpc_8 */ -#define PHY_BB_TPC_8_ADDRESS 0x0000a278 -#define PHY_BB_TPC_8_OFFSET 0x0000a278 -#define PHY_BB_TPC_8_DESIRED_SCALE_0_MSB 4 -#define PHY_BB_TPC_8_DESIRED_SCALE_0_LSB 0 -#define PHY_BB_TPC_8_DESIRED_SCALE_0_MASK 0x0000001f -#define PHY_BB_TPC_8_DESIRED_SCALE_0_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_TPC_8_DESIRED_SCALE_0_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_TPC_8_DESIRED_SCALE_1_MSB 9 -#define PHY_BB_TPC_8_DESIRED_SCALE_1_LSB 5 -#define PHY_BB_TPC_8_DESIRED_SCALE_1_MASK 0x000003e0 -#define PHY_BB_TPC_8_DESIRED_SCALE_1_GET(x) (((x) & 0x000003e0) >> 5) -#define PHY_BB_TPC_8_DESIRED_SCALE_1_SET(x) (((x) << 5) & 0x000003e0) -#define PHY_BB_TPC_8_DESIRED_SCALE_2_MSB 14 -#define PHY_BB_TPC_8_DESIRED_SCALE_2_LSB 10 -#define PHY_BB_TPC_8_DESIRED_SCALE_2_MASK 0x00007c00 -#define PHY_BB_TPC_8_DESIRED_SCALE_2_GET(x) (((x) & 0x00007c00) >> 10) -#define PHY_BB_TPC_8_DESIRED_SCALE_2_SET(x) (((x) << 10) & 0x00007c00) -#define PHY_BB_TPC_8_DESIRED_SCALE_3_MSB 19 -#define PHY_BB_TPC_8_DESIRED_SCALE_3_LSB 15 -#define PHY_BB_TPC_8_DESIRED_SCALE_3_MASK 0x000f8000 -#define PHY_BB_TPC_8_DESIRED_SCALE_3_GET(x) (((x) & 0x000f8000) >> 15) -#define PHY_BB_TPC_8_DESIRED_SCALE_3_SET(x) (((x) << 15) & 0x000f8000) -#define PHY_BB_TPC_8_DESIRED_SCALE_4_MSB 24 -#define PHY_BB_TPC_8_DESIRED_SCALE_4_LSB 20 -#define PHY_BB_TPC_8_DESIRED_SCALE_4_MASK 0x01f00000 -#define PHY_BB_TPC_8_DESIRED_SCALE_4_GET(x) (((x) & 0x01f00000) >> 20) -#define PHY_BB_TPC_8_DESIRED_SCALE_4_SET(x) (((x) << 20) & 0x01f00000) -#define PHY_BB_TPC_8_DESIRED_SCALE_5_MSB 29 -#define PHY_BB_TPC_8_DESIRED_SCALE_5_LSB 25 -#define PHY_BB_TPC_8_DESIRED_SCALE_5_MASK 0x3e000000 -#define PHY_BB_TPC_8_DESIRED_SCALE_5_GET(x) (((x) & 0x3e000000) >> 25) -#define PHY_BB_TPC_8_DESIRED_SCALE_5_SET(x) (((x) << 25) & 0x3e000000) - -/* macros for BB_tpc_9 */ -#define PHY_BB_TPC_9_ADDRESS 0x0000a27c -#define PHY_BB_TPC_9_OFFSET 0x0000a27c -#define PHY_BB_TPC_9_DESIRED_SCALE_6_MSB 4 -#define PHY_BB_TPC_9_DESIRED_SCALE_6_LSB 0 -#define PHY_BB_TPC_9_DESIRED_SCALE_6_MASK 0x0000001f -#define PHY_BB_TPC_9_DESIRED_SCALE_6_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_TPC_9_DESIRED_SCALE_6_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_TPC_9_DESIRED_SCALE_7_MSB 9 -#define PHY_BB_TPC_9_DESIRED_SCALE_7_LSB 5 -#define PHY_BB_TPC_9_DESIRED_SCALE_7_MASK 0x000003e0 -#define PHY_BB_TPC_9_DESIRED_SCALE_7_GET(x) (((x) & 0x000003e0) >> 5) -#define PHY_BB_TPC_9_DESIRED_SCALE_7_SET(x) (((x) << 5) & 0x000003e0) -#define PHY_BB_TPC_9_DESIRED_SCALE_CCK_MSB 14 -#define PHY_BB_TPC_9_DESIRED_SCALE_CCK_LSB 10 -#define PHY_BB_TPC_9_DESIRED_SCALE_CCK_MASK 0x00007c00 -#define PHY_BB_TPC_9_DESIRED_SCALE_CCK_GET(x) (((x) & 0x00007c00) >> 10) -#define PHY_BB_TPC_9_DESIRED_SCALE_CCK_SET(x) (((x) << 10) & 0x00007c00) -#define PHY_BB_TPC_9_EN_PD_DC_OFFSET_THR_MSB 20 -#define PHY_BB_TPC_9_EN_PD_DC_OFFSET_THR_LSB 20 -#define PHY_BB_TPC_9_EN_PD_DC_OFFSET_THR_MASK 0x00100000 -#define PHY_BB_TPC_9_EN_PD_DC_OFFSET_THR_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_BB_TPC_9_EN_PD_DC_OFFSET_THR_SET(x) (((x) << 20) & 0x00100000) -#define PHY_BB_TPC_9_PD_DC_OFFSET_THR_MSB 26 -#define PHY_BB_TPC_9_PD_DC_OFFSET_THR_LSB 21 -#define PHY_BB_TPC_9_PD_DC_OFFSET_THR_MASK 0x07e00000 -#define PHY_BB_TPC_9_PD_DC_OFFSET_THR_GET(x) (((x) & 0x07e00000) >> 21) -#define PHY_BB_TPC_9_PD_DC_OFFSET_THR_SET(x) (((x) << 21) & 0x07e00000) -#define PHY_BB_TPC_9_WAIT_CALTX_SETTLE_MSB 30 -#define PHY_BB_TPC_9_WAIT_CALTX_SETTLE_LSB 27 -#define PHY_BB_TPC_9_WAIT_CALTX_SETTLE_MASK 0x78000000 -#define PHY_BB_TPC_9_WAIT_CALTX_SETTLE_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_BB_TPC_9_WAIT_CALTX_SETTLE_SET(x) (((x) << 27) & 0x78000000) -#define PHY_BB_TPC_9_DISABLE_PDADC_RESIDUAL_DC_REMOVAL_MSB 31 -#define PHY_BB_TPC_9_DISABLE_PDADC_RESIDUAL_DC_REMOVAL_LSB 31 -#define PHY_BB_TPC_9_DISABLE_PDADC_RESIDUAL_DC_REMOVAL_MASK 0x80000000 -#define PHY_BB_TPC_9_DISABLE_PDADC_RESIDUAL_DC_REMOVAL_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_TPC_9_DISABLE_PDADC_RESIDUAL_DC_REMOVAL_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_pdadc_tab_b0 */ -#define PHY_BB_PDADC_TAB_B0_ADDRESS 0x0000a280 -#define PHY_BB_PDADC_TAB_B0_OFFSET 0x0000a280 -#define PHY_BB_PDADC_TAB_B0_TAB_ENTRY_MSB 31 -#define PHY_BB_PDADC_TAB_B0_TAB_ENTRY_LSB 0 -#define PHY_BB_PDADC_TAB_B0_TAB_ENTRY_MASK 0xffffffff -#define PHY_BB_PDADC_TAB_B0_TAB_ENTRY_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_cl_tab_b0 */ -#define PHY_BB_CL_TAB_B0_ADDRESS 0x0000a300 -#define PHY_BB_CL_TAB_B0_OFFSET 0x0000a300 -#define PHY_BB_CL_TAB_B0_CL_GAIN_MOD_MSB 4 -#define PHY_BB_CL_TAB_B0_CL_GAIN_MOD_LSB 0 -#define PHY_BB_CL_TAB_B0_CL_GAIN_MOD_MASK 0x0000001f -#define PHY_BB_CL_TAB_B0_CL_GAIN_MOD_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_CL_TAB_B0_CL_GAIN_MOD_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_CL_TAB_B0_CARR_LK_DC_ADD_Q_MSB 15 -#define PHY_BB_CL_TAB_B0_CARR_LK_DC_ADD_Q_LSB 5 -#define PHY_BB_CL_TAB_B0_CARR_LK_DC_ADD_Q_MASK 0x0000ffe0 -#define PHY_BB_CL_TAB_B0_CARR_LK_DC_ADD_Q_GET(x) (((x) & 0x0000ffe0) >> 5) -#define PHY_BB_CL_TAB_B0_CARR_LK_DC_ADD_Q_SET(x) (((x) << 5) & 0x0000ffe0) -#define PHY_BB_CL_TAB_B0_CARR_LK_DC_ADD_I_MSB 26 -#define PHY_BB_CL_TAB_B0_CARR_LK_DC_ADD_I_LSB 16 -#define PHY_BB_CL_TAB_B0_CARR_LK_DC_ADD_I_MASK 0x07ff0000 -#define PHY_BB_CL_TAB_B0_CARR_LK_DC_ADD_I_GET(x) (((x) & 0x07ff0000) >> 16) -#define PHY_BB_CL_TAB_B0_CARR_LK_DC_ADD_I_SET(x) (((x) << 16) & 0x07ff0000) -#define PHY_BB_CL_TAB_B0_BB_GAIN_MSB 30 -#define PHY_BB_CL_TAB_B0_BB_GAIN_LSB 27 -#define PHY_BB_CL_TAB_B0_BB_GAIN_MASK 0x78000000 -#define PHY_BB_CL_TAB_B0_BB_GAIN_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_BB_CL_TAB_B0_BB_GAIN_SET(x) (((x) << 27) & 0x78000000) - -/* macros for BB_cl_map_0_b0 */ -#define PHY_BB_CL_MAP_0_B0_ADDRESS 0x0000a340 -#define PHY_BB_CL_MAP_0_B0_OFFSET 0x0000a340 -#define PHY_BB_CL_MAP_0_B0_CL_MAP_0_MSB 31 -#define PHY_BB_CL_MAP_0_B0_CL_MAP_0_LSB 0 -#define PHY_BB_CL_MAP_0_B0_CL_MAP_0_MASK 0xffffffff -#define PHY_BB_CL_MAP_0_B0_CL_MAP_0_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_CL_MAP_0_B0_CL_MAP_0_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_cl_map_1_b0 */ -#define PHY_BB_CL_MAP_1_B0_ADDRESS 0x0000a344 -#define PHY_BB_CL_MAP_1_B0_OFFSET 0x0000a344 -#define PHY_BB_CL_MAP_1_B0_CL_MAP_1_MSB 31 -#define PHY_BB_CL_MAP_1_B0_CL_MAP_1_LSB 0 -#define PHY_BB_CL_MAP_1_B0_CL_MAP_1_MASK 0xffffffff -#define PHY_BB_CL_MAP_1_B0_CL_MAP_1_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_CL_MAP_1_B0_CL_MAP_1_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_cl_map_2_b0 */ -#define PHY_BB_CL_MAP_2_B0_ADDRESS 0x0000a348 -#define PHY_BB_CL_MAP_2_B0_OFFSET 0x0000a348 -#define PHY_BB_CL_MAP_2_B0_CL_MAP_2_MSB 31 -#define PHY_BB_CL_MAP_2_B0_CL_MAP_2_LSB 0 -#define PHY_BB_CL_MAP_2_B0_CL_MAP_2_MASK 0xffffffff -#define PHY_BB_CL_MAP_2_B0_CL_MAP_2_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_CL_MAP_2_B0_CL_MAP_2_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_cl_map_3_b0 */ -#define PHY_BB_CL_MAP_3_B0_ADDRESS 0x0000a34c -#define PHY_BB_CL_MAP_3_B0_OFFSET 0x0000a34c -#define PHY_BB_CL_MAP_3_B0_CL_MAP_3_MSB 31 -#define PHY_BB_CL_MAP_3_B0_CL_MAP_3_LSB 0 -#define PHY_BB_CL_MAP_3_B0_CL_MAP_3_MASK 0xffffffff -#define PHY_BB_CL_MAP_3_B0_CL_MAP_3_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_CL_MAP_3_B0_CL_MAP_3_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_cl_cal_ctrl */ -#define PHY_BB_CL_CAL_CTRL_ADDRESS 0x0000a358 -#define PHY_BB_CL_CAL_CTRL_OFFSET 0x0000a358 -#define PHY_BB_CL_CAL_CTRL_ENABLE_PARALLEL_CAL_MSB 0 -#define PHY_BB_CL_CAL_CTRL_ENABLE_PARALLEL_CAL_LSB 0 -#define PHY_BB_CL_CAL_CTRL_ENABLE_PARALLEL_CAL_MASK 0x00000001 -#define PHY_BB_CL_CAL_CTRL_ENABLE_PARALLEL_CAL_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_CL_CAL_CTRL_ENABLE_PARALLEL_CAL_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_CL_CAL_CTRL_ENABLE_CL_CALIBRATE_MSB 1 -#define PHY_BB_CL_CAL_CTRL_ENABLE_CL_CALIBRATE_LSB 1 -#define PHY_BB_CL_CAL_CTRL_ENABLE_CL_CALIBRATE_MASK 0x00000002 -#define PHY_BB_CL_CAL_CTRL_ENABLE_CL_CALIBRATE_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_CL_CAL_CTRL_ENABLE_CL_CALIBRATE_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_CL_CAL_CTRL_CF_CLC_TEST_POINT_MSB 3 -#define PHY_BB_CL_CAL_CTRL_CF_CLC_TEST_POINT_LSB 2 -#define PHY_BB_CL_CAL_CTRL_CF_CLC_TEST_POINT_MASK 0x0000000c -#define PHY_BB_CL_CAL_CTRL_CF_CLC_TEST_POINT_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_BB_CL_CAL_CTRL_CF_CLC_TEST_POINT_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_BB_CL_CAL_CTRL_CF_CLC_FORCED_PAGAIN_MSB 7 -#define PHY_BB_CL_CAL_CTRL_CF_CLC_FORCED_PAGAIN_LSB 4 -#define PHY_BB_CL_CAL_CTRL_CF_CLC_FORCED_PAGAIN_MASK 0x000000f0 -#define PHY_BB_CL_CAL_CTRL_CF_CLC_FORCED_PAGAIN_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_BB_CL_CAL_CTRL_CF_CLC_FORCED_PAGAIN_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_BB_CL_CAL_CTRL_CARR_LEAK_MAX_OFFSET_MSB 15 -#define PHY_BB_CL_CAL_CTRL_CARR_LEAK_MAX_OFFSET_LSB 8 -#define PHY_BB_CL_CAL_CTRL_CARR_LEAK_MAX_OFFSET_MASK 0x0000ff00 -#define PHY_BB_CL_CAL_CTRL_CARR_LEAK_MAX_OFFSET_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_CL_CAL_CTRL_CARR_LEAK_MAX_OFFSET_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_CL_CAL_CTRL_CF_CLC_INIT_BBGAIN_MSB 21 -#define PHY_BB_CL_CAL_CTRL_CF_CLC_INIT_BBGAIN_LSB 16 -#define PHY_BB_CL_CAL_CTRL_CF_CLC_INIT_BBGAIN_MASK 0x003f0000 -#define PHY_BB_CL_CAL_CTRL_CF_CLC_INIT_BBGAIN_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_CL_CAL_CTRL_CF_CLC_INIT_BBGAIN_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_CL_CAL_CTRL_CF_ADC_BOUND_MSB 29 -#define PHY_BB_CL_CAL_CTRL_CF_ADC_BOUND_LSB 22 -#define PHY_BB_CL_CAL_CTRL_CF_ADC_BOUND_MASK 0x3fc00000 -#define PHY_BB_CL_CAL_CTRL_CF_ADC_BOUND_GET(x) (((x) & 0x3fc00000) >> 22) -#define PHY_BB_CL_CAL_CTRL_CF_ADC_BOUND_SET(x) (((x) << 22) & 0x3fc00000) -#define PHY_BB_CL_CAL_CTRL_USE_DAC_CL_CORRECTION_MSB 30 -#define PHY_BB_CL_CAL_CTRL_USE_DAC_CL_CORRECTION_LSB 30 -#define PHY_BB_CL_CAL_CTRL_USE_DAC_CL_CORRECTION_MASK 0x40000000 -#define PHY_BB_CL_CAL_CTRL_USE_DAC_CL_CORRECTION_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_CL_CAL_CTRL_USE_DAC_CL_CORRECTION_SET(x) (((x) << 30) & 0x40000000) -#define PHY_BB_CL_CAL_CTRL_CL_MAP_HW_GEN_MSB 31 -#define PHY_BB_CL_CAL_CTRL_CL_MAP_HW_GEN_LSB 31 -#define PHY_BB_CL_CAL_CTRL_CL_MAP_HW_GEN_MASK 0x80000000 -#define PHY_BB_CL_CAL_CTRL_CL_MAP_HW_GEN_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_CL_CAL_CTRL_CL_MAP_HW_GEN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_cl_map_pal_0_b0 */ -#define PHY_BB_CL_MAP_PAL_0_B0_ADDRESS 0x0000a35c -#define PHY_BB_CL_MAP_PAL_0_B0_OFFSET 0x0000a35c -#define PHY_BB_CL_MAP_PAL_0_B0_CL_MAP_0_MSB 31 -#define PHY_BB_CL_MAP_PAL_0_B0_CL_MAP_0_LSB 0 -#define PHY_BB_CL_MAP_PAL_0_B0_CL_MAP_0_MASK 0xffffffff -#define PHY_BB_CL_MAP_PAL_0_B0_CL_MAP_0_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_CL_MAP_PAL_0_B0_CL_MAP_0_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_cl_map_pal_1_b0 */ -#define PHY_BB_CL_MAP_PAL_1_B0_ADDRESS 0x0000a360 -#define PHY_BB_CL_MAP_PAL_1_B0_OFFSET 0x0000a360 -#define PHY_BB_CL_MAP_PAL_1_B0_CL_MAP_1_MSB 31 -#define PHY_BB_CL_MAP_PAL_1_B0_CL_MAP_1_LSB 0 -#define PHY_BB_CL_MAP_PAL_1_B0_CL_MAP_1_MASK 0xffffffff -#define PHY_BB_CL_MAP_PAL_1_B0_CL_MAP_1_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_CL_MAP_PAL_1_B0_CL_MAP_1_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_cl_map_pal_2_b0 */ -#define PHY_BB_CL_MAP_PAL_2_B0_ADDRESS 0x0000a364 -#define PHY_BB_CL_MAP_PAL_2_B0_OFFSET 0x0000a364 -#define PHY_BB_CL_MAP_PAL_2_B0_CL_MAP_2_MSB 31 -#define PHY_BB_CL_MAP_PAL_2_B0_CL_MAP_2_LSB 0 -#define PHY_BB_CL_MAP_PAL_2_B0_CL_MAP_2_MASK 0xffffffff -#define PHY_BB_CL_MAP_PAL_2_B0_CL_MAP_2_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_CL_MAP_PAL_2_B0_CL_MAP_2_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_cl_map_pal_3_b0 */ -#define PHY_BB_CL_MAP_PAL_3_B0_ADDRESS 0x0000a368 -#define PHY_BB_CL_MAP_PAL_3_B0_OFFSET 0x0000a368 -#define PHY_BB_CL_MAP_PAL_3_B0_CL_MAP_3_MSB 31 -#define PHY_BB_CL_MAP_PAL_3_B0_CL_MAP_3_LSB 0 -#define PHY_BB_CL_MAP_PAL_3_B0_CL_MAP_3_MASK 0xffffffff -#define PHY_BB_CL_MAP_PAL_3_B0_CL_MAP_3_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_CL_MAP_PAL_3_B0_CL_MAP_3_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_rifs */ -#define PHY_BB_RIFS_ADDRESS 0x0000a388 -#define PHY_BB_RIFS_OFFSET 0x0000a388 -#define PHY_BB_RIFS_DISABLE_FCC_FIX_MSB 25 -#define PHY_BB_RIFS_DISABLE_FCC_FIX_LSB 25 -#define PHY_BB_RIFS_DISABLE_FCC_FIX_MASK 0x02000000 -#define PHY_BB_RIFS_DISABLE_FCC_FIX_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_BB_RIFS_DISABLE_FCC_FIX_SET(x) (((x) << 25) & 0x02000000) -#define PHY_BB_RIFS_ENABLE_RESET_TDOMAIN_MSB 26 -#define PHY_BB_RIFS_ENABLE_RESET_TDOMAIN_LSB 26 -#define PHY_BB_RIFS_ENABLE_RESET_TDOMAIN_MASK 0x04000000 -#define PHY_BB_RIFS_ENABLE_RESET_TDOMAIN_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_BB_RIFS_ENABLE_RESET_TDOMAIN_SET(x) (((x) << 26) & 0x04000000) -#define PHY_BB_RIFS_DISABLE_FCC_FIX2_MSB 27 -#define PHY_BB_RIFS_DISABLE_FCC_FIX2_LSB 27 -#define PHY_BB_RIFS_DISABLE_FCC_FIX2_MASK 0x08000000 -#define PHY_BB_RIFS_DISABLE_FCC_FIX2_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_BB_RIFS_DISABLE_FCC_FIX2_SET(x) (((x) << 27) & 0x08000000) -#define PHY_BB_RIFS_DISABLE_RIFS_CCK_FIX_MSB 28 -#define PHY_BB_RIFS_DISABLE_RIFS_CCK_FIX_LSB 28 -#define PHY_BB_RIFS_DISABLE_RIFS_CCK_FIX_MASK 0x10000000 -#define PHY_BB_RIFS_DISABLE_RIFS_CCK_FIX_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_BB_RIFS_DISABLE_RIFS_CCK_FIX_SET(x) (((x) << 28) & 0x10000000) -#define PHY_BB_RIFS_DISABLE_ERROR_RESET_FIX_MSB 29 -#define PHY_BB_RIFS_DISABLE_ERROR_RESET_FIX_LSB 29 -#define PHY_BB_RIFS_DISABLE_ERROR_RESET_FIX_MASK 0x20000000 -#define PHY_BB_RIFS_DISABLE_ERROR_RESET_FIX_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_BB_RIFS_DISABLE_ERROR_RESET_FIX_SET(x) (((x) << 29) & 0x20000000) -#define PHY_BB_RIFS_RADAR_USE_FDOMAIN_RESET_MSB 30 -#define PHY_BB_RIFS_RADAR_USE_FDOMAIN_RESET_LSB 30 -#define PHY_BB_RIFS_RADAR_USE_FDOMAIN_RESET_MASK 0x40000000 -#define PHY_BB_RIFS_RADAR_USE_FDOMAIN_RESET_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_BB_RIFS_RADAR_USE_FDOMAIN_RESET_SET(x) (((x) << 30) & 0x40000000) - -/* macros for BB_powertx_rate5 */ -#define PHY_BB_POWERTX_RATE5_ADDRESS 0x0000a38c -#define PHY_BB_POWERTX_RATE5_OFFSET 0x0000a38c -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_0_MSB 5 -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_0_LSB 0 -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_0_MASK 0x0000003f -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_0_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_0_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_1_MSB 13 -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_1_LSB 8 -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_1_MASK 0x00003f00 -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_1_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_1_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_2_MSB 21 -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_2_LSB 16 -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_2_MASK 0x003f0000 -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_2_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_2_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_3_MSB 29 -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_3_LSB 24 -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_3_MASK 0x3f000000 -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_3_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_BB_POWERTX_RATE5_POWERTXHT20_3_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for BB_powertx_rate6 */ -#define PHY_BB_POWERTX_RATE6_ADDRESS 0x0000a390 -#define PHY_BB_POWERTX_RATE6_OFFSET 0x0000a390 -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_4_MSB 5 -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_4_LSB 0 -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_4_MASK 0x0000003f -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_4_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_4_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_5_MSB 13 -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_5_LSB 8 -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_5_MASK 0x00003f00 -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_5_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_5_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_6_MSB 21 -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_6_LSB 16 -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_6_MASK 0x003f0000 -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_6_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_6_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_7_MSB 29 -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_7_LSB 24 -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_7_MASK 0x3f000000 -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_7_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_BB_POWERTX_RATE6_POWERTXHT20_7_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for BB_tpc_10 */ -#define PHY_BB_TPC_10_ADDRESS 0x0000a394 -#define PHY_BB_TPC_10_OFFSET 0x0000a394 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_0_MSB 4 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_0_LSB 0 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_0_MASK 0x0000001f -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_0_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_0_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_1_MSB 9 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_1_LSB 5 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_1_MASK 0x000003e0 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_1_GET(x) (((x) & 0x000003e0) >> 5) -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_1_SET(x) (((x) << 5) & 0x000003e0) -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_2_MSB 14 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_2_LSB 10 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_2_MASK 0x00007c00 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_2_GET(x) (((x) & 0x00007c00) >> 10) -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_2_SET(x) (((x) << 10) & 0x00007c00) -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_3_MSB 19 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_3_LSB 15 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_3_MASK 0x000f8000 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_3_GET(x) (((x) & 0x000f8000) >> 15) -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_3_SET(x) (((x) << 15) & 0x000f8000) -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_4_MSB 24 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_4_LSB 20 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_4_MASK 0x01f00000 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_4_GET(x) (((x) & 0x01f00000) >> 20) -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_4_SET(x) (((x) << 20) & 0x01f00000) -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_5_MSB 29 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_5_LSB 25 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_5_MASK 0x3e000000 -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_5_GET(x) (((x) & 0x3e000000) >> 25) -#define PHY_BB_TPC_10_DESIRED_SCALE_HT20_5_SET(x) (((x) << 25) & 0x3e000000) - -/* macros for BB_tpc_11_b0 */ -#define PHY_BB_TPC_11_B0_ADDRESS 0x0000a398 -#define PHY_BB_TPC_11_B0_OFFSET 0x0000a398 -#define PHY_BB_TPC_11_B0_DESIRED_SCALE_HT20_6_MSB 4 -#define PHY_BB_TPC_11_B0_DESIRED_SCALE_HT20_6_LSB 0 -#define PHY_BB_TPC_11_B0_DESIRED_SCALE_HT20_6_MASK 0x0000001f -#define PHY_BB_TPC_11_B0_DESIRED_SCALE_HT20_6_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_TPC_11_B0_DESIRED_SCALE_HT20_6_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_TPC_11_B0_DESIRED_SCALE_HT20_7_MSB 9 -#define PHY_BB_TPC_11_B0_DESIRED_SCALE_HT20_7_LSB 5 -#define PHY_BB_TPC_11_B0_DESIRED_SCALE_HT20_7_MASK 0x000003e0 -#define PHY_BB_TPC_11_B0_DESIRED_SCALE_HT20_7_GET(x) (((x) & 0x000003e0) >> 5) -#define PHY_BB_TPC_11_B0_DESIRED_SCALE_HT20_7_SET(x) (((x) << 5) & 0x000003e0) -#define PHY_BB_TPC_11_B0_OLPC_GAIN_DELTA_0_MSB 23 -#define PHY_BB_TPC_11_B0_OLPC_GAIN_DELTA_0_LSB 16 -#define PHY_BB_TPC_11_B0_OLPC_GAIN_DELTA_0_MASK 0x00ff0000 -#define PHY_BB_TPC_11_B0_OLPC_GAIN_DELTA_0_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_TPC_11_B0_OLPC_GAIN_DELTA_0_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_BB_TPC_11_B0_OLPC_GAIN_DELTA_0_PAL_ON_MSB 31 -#define PHY_BB_TPC_11_B0_OLPC_GAIN_DELTA_0_PAL_ON_LSB 24 -#define PHY_BB_TPC_11_B0_OLPC_GAIN_DELTA_0_PAL_ON_MASK 0xff000000 -#define PHY_BB_TPC_11_B0_OLPC_GAIN_DELTA_0_PAL_ON_GET(x) (((x) & 0xff000000) >> 24) -#define PHY_BB_TPC_11_B0_OLPC_GAIN_DELTA_0_PAL_ON_SET(x) (((x) << 24) & 0xff000000) - -/* macros for BB_cal_chain_mask */ -#define PHY_BB_CAL_CHAIN_MASK_ADDRESS 0x0000a39c -#define PHY_BB_CAL_CHAIN_MASK_OFFSET 0x0000a39c -#define PHY_BB_CAL_CHAIN_MASK_CAL_CHAIN_MASK_MSB 2 -#define PHY_BB_CAL_CHAIN_MASK_CAL_CHAIN_MASK_LSB 0 -#define PHY_BB_CAL_CHAIN_MASK_CAL_CHAIN_MASK_MASK 0x00000007 -#define PHY_BB_CAL_CHAIN_MASK_CAL_CHAIN_MASK_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_BB_CAL_CHAIN_MASK_CAL_CHAIN_MASK_SET(x) (((x) << 0) & 0x00000007) - -/* macros for BB_powertx_sub */ -#define PHY_BB_POWERTX_SUB_ADDRESS 0x0000a3bc -#define PHY_BB_POWERTX_SUB_OFFSET 0x0000a3bc -#define PHY_BB_POWERTX_SUB_POWERTX_SUB_FOR_2CHAIN_MSB 5 -#define PHY_BB_POWERTX_SUB_POWERTX_SUB_FOR_2CHAIN_LSB 0 -#define PHY_BB_POWERTX_SUB_POWERTX_SUB_FOR_2CHAIN_MASK 0x0000003f -#define PHY_BB_POWERTX_SUB_POWERTX_SUB_FOR_2CHAIN_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_POWERTX_SUB_POWERTX_SUB_FOR_2CHAIN_SET(x) (((x) << 0) & 0x0000003f) - -/* macros for BB_powertx_rate7 */ -#define PHY_BB_POWERTX_RATE7_ADDRESS 0x0000a3c0 -#define PHY_BB_POWERTX_RATE7_OFFSET 0x0000a3c0 -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_0_MSB 5 -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_0_LSB 0 -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_0_MASK 0x0000003f -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_0_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_0_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_1_MSB 13 -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_1_LSB 8 -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_1_MASK 0x00003f00 -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_1_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_1_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_2_MSB 21 -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_2_LSB 16 -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_2_MASK 0x003f0000 -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_2_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_2_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_3_MSB 29 -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_3_LSB 24 -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_3_MASK 0x3f000000 -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_3_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_BB_POWERTX_RATE7_POWERTXHT40_3_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for BB_powertx_rate8 */ -#define PHY_BB_POWERTX_RATE8_ADDRESS 0x0000a3c4 -#define PHY_BB_POWERTX_RATE8_OFFSET 0x0000a3c4 -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_4_MSB 5 -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_4_LSB 0 -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_4_MASK 0x0000003f -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_4_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_4_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_5_MSB 13 -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_5_LSB 8 -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_5_MASK 0x00003f00 -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_5_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_5_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_6_MSB 21 -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_6_LSB 16 -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_6_MASK 0x003f0000 -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_6_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_6_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_7_MSB 29 -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_7_LSB 24 -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_7_MASK 0x3f000000 -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_7_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_BB_POWERTX_RATE8_POWERTXHT40_7_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for BB_powertx_rate9 */ -#define PHY_BB_POWERTX_RATE9_ADDRESS 0x0000a3c8 -#define PHY_BB_POWERTX_RATE9_OFFSET 0x0000a3c8 -#define PHY_BB_POWERTX_RATE9_POWERTX_DUP40_CCK_MSB 5 -#define PHY_BB_POWERTX_RATE9_POWERTX_DUP40_CCK_LSB 0 -#define PHY_BB_POWERTX_RATE9_POWERTX_DUP40_CCK_MASK 0x0000003f -#define PHY_BB_POWERTX_RATE9_POWERTX_DUP40_CCK_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_POWERTX_RATE9_POWERTX_DUP40_CCK_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_POWERTX_RATE9_POWERTX_DUP40_OFDM_MSB 13 -#define PHY_BB_POWERTX_RATE9_POWERTX_DUP40_OFDM_LSB 8 -#define PHY_BB_POWERTX_RATE9_POWERTX_DUP40_OFDM_MASK 0x00003f00 -#define PHY_BB_POWERTX_RATE9_POWERTX_DUP40_OFDM_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_POWERTX_RATE9_POWERTX_DUP40_OFDM_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_POWERTX_RATE9_POWERTX_EXT20_CCK_MSB 21 -#define PHY_BB_POWERTX_RATE9_POWERTX_EXT20_CCK_LSB 16 -#define PHY_BB_POWERTX_RATE9_POWERTX_EXT20_CCK_MASK 0x003f0000 -#define PHY_BB_POWERTX_RATE9_POWERTX_EXT20_CCK_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_POWERTX_RATE9_POWERTX_EXT20_CCK_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_POWERTX_RATE9_POWERTX_EXT20_OFDM_MSB 29 -#define PHY_BB_POWERTX_RATE9_POWERTX_EXT20_OFDM_LSB 24 -#define PHY_BB_POWERTX_RATE9_POWERTX_EXT20_OFDM_MASK 0x3f000000 -#define PHY_BB_POWERTX_RATE9_POWERTX_EXT20_OFDM_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_BB_POWERTX_RATE9_POWERTX_EXT20_OFDM_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for BB_powertx_rate10 */ -#define PHY_BB_POWERTX_RATE10_ADDRESS 0x0000a3cc -#define PHY_BB_POWERTX_RATE10_OFFSET 0x0000a3cc -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_8_MSB 5 -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_8_LSB 0 -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_8_MASK 0x0000003f -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_8_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_8_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_9_MSB 13 -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_9_LSB 8 -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_9_MASK 0x00003f00 -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_9_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_9_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_10_MSB 21 -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_10_LSB 16 -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_10_MASK 0x003f0000 -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_10_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_10_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_11_MSB 29 -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_11_LSB 24 -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_11_MASK 0x3f000000 -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_11_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_BB_POWERTX_RATE10_POWERTXHT20_11_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for BB_powertx_rate11 */ -#define PHY_BB_POWERTX_RATE11_ADDRESS 0x0000a3d0 -#define PHY_BB_POWERTX_RATE11_OFFSET 0x0000a3d0 -#define PHY_BB_POWERTX_RATE11_POWERTXHT20_12_MSB 5 -#define PHY_BB_POWERTX_RATE11_POWERTXHT20_12_LSB 0 -#define PHY_BB_POWERTX_RATE11_POWERTXHT20_12_MASK 0x0000003f -#define PHY_BB_POWERTX_RATE11_POWERTXHT20_12_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_POWERTX_RATE11_POWERTXHT20_12_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_POWERTX_RATE11_POWERTXHT20_13_MSB 13 -#define PHY_BB_POWERTX_RATE11_POWERTXHT20_13_LSB 8 -#define PHY_BB_POWERTX_RATE11_POWERTXHT20_13_MASK 0x00003f00 -#define PHY_BB_POWERTX_RATE11_POWERTXHT20_13_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_POWERTX_RATE11_POWERTXHT20_13_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_POWERTX_RATE11_POWERTXHT40_12_MSB 21 -#define PHY_BB_POWERTX_RATE11_POWERTXHT40_12_LSB 16 -#define PHY_BB_POWERTX_RATE11_POWERTXHT40_12_MASK 0x003f0000 -#define PHY_BB_POWERTX_RATE11_POWERTXHT40_12_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_POWERTX_RATE11_POWERTXHT40_12_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_POWERTX_RATE11_POWERTXHT40_13_MSB 29 -#define PHY_BB_POWERTX_RATE11_POWERTXHT40_13_LSB 24 -#define PHY_BB_POWERTX_RATE11_POWERTXHT40_13_MASK 0x3f000000 -#define PHY_BB_POWERTX_RATE11_POWERTXHT40_13_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_BB_POWERTX_RATE11_POWERTXHT40_13_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for BB_powertx_rate12 */ -#define PHY_BB_POWERTX_RATE12_ADDRESS 0x0000a3d4 -#define PHY_BB_POWERTX_RATE12_OFFSET 0x0000a3d4 -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_8_MSB 5 -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_8_LSB 0 -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_8_MASK 0x0000003f -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_8_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_8_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_9_MSB 13 -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_9_LSB 8 -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_9_MASK 0x00003f00 -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_9_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_9_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_10_MSB 21 -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_10_LSB 16 -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_10_MASK 0x003f0000 -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_10_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_10_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_11_MSB 29 -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_11_LSB 24 -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_11_MASK 0x3f000000 -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_11_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_BB_POWERTX_RATE12_POWERTXHT40_11_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for BB_force_analog */ -#define PHY_BB_FORCE_ANALOG_ADDRESS 0x0000a3d8 -#define PHY_BB_FORCE_ANALOG_OFFSET 0x0000a3d8 -#define PHY_BB_FORCE_ANALOG_FORCE_XPAON_MSB 0 -#define PHY_BB_FORCE_ANALOG_FORCE_XPAON_LSB 0 -#define PHY_BB_FORCE_ANALOG_FORCE_XPAON_MASK 0x00000001 -#define PHY_BB_FORCE_ANALOG_FORCE_XPAON_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_FORCE_ANALOG_FORCE_XPAON_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_FORCE_ANALOG_FORCED_XPAON_MSB 3 -#define PHY_BB_FORCE_ANALOG_FORCED_XPAON_LSB 1 -#define PHY_BB_FORCE_ANALOG_FORCED_XPAON_MASK 0x0000000e -#define PHY_BB_FORCE_ANALOG_FORCED_XPAON_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_BB_FORCE_ANALOG_FORCED_XPAON_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_BB_FORCE_ANALOG_FORCE_PDADC_PWD_MSB 4 -#define PHY_BB_FORCE_ANALOG_FORCE_PDADC_PWD_LSB 4 -#define PHY_BB_FORCE_ANALOG_FORCE_PDADC_PWD_MASK 0x00000010 -#define PHY_BB_FORCE_ANALOG_FORCE_PDADC_PWD_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_BB_FORCE_ANALOG_FORCE_PDADC_PWD_SET(x) (((x) << 4) & 0x00000010) -#define PHY_BB_FORCE_ANALOG_FORCED_PDADC_PWD_MSB 7 -#define PHY_BB_FORCE_ANALOG_FORCED_PDADC_PWD_LSB 5 -#define PHY_BB_FORCE_ANALOG_FORCED_PDADC_PWD_MASK 0x000000e0 -#define PHY_BB_FORCE_ANALOG_FORCED_PDADC_PWD_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_BB_FORCE_ANALOG_FORCED_PDADC_PWD_SET(x) (((x) << 5) & 0x000000e0) - -/* macros for BB_tpc_12 */ -#define PHY_BB_TPC_12_ADDRESS 0x0000a3dc -#define PHY_BB_TPC_12_OFFSET 0x0000a3dc -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_0_MSB 4 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_0_LSB 0 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_0_MASK 0x0000001f -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_0_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_0_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_1_MSB 9 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_1_LSB 5 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_1_MASK 0x000003e0 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_1_GET(x) (((x) & 0x000003e0) >> 5) -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_1_SET(x) (((x) << 5) & 0x000003e0) -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_2_MSB 14 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_2_LSB 10 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_2_MASK 0x00007c00 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_2_GET(x) (((x) & 0x00007c00) >> 10) -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_2_SET(x) (((x) << 10) & 0x00007c00) -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_3_MSB 19 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_3_LSB 15 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_3_MASK 0x000f8000 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_3_GET(x) (((x) & 0x000f8000) >> 15) -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_3_SET(x) (((x) << 15) & 0x000f8000) -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_4_MSB 24 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_4_LSB 20 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_4_MASK 0x01f00000 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_4_GET(x) (((x) & 0x01f00000) >> 20) -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_4_SET(x) (((x) << 20) & 0x01f00000) -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_5_MSB 29 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_5_LSB 25 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_5_MASK 0x3e000000 -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_5_GET(x) (((x) & 0x3e000000) >> 25) -#define PHY_BB_TPC_12_DESIRED_SCALE_HT40_5_SET(x) (((x) << 25) & 0x3e000000) - -/* macros for BB_tpc_13 */ -#define PHY_BB_TPC_13_ADDRESS 0x0000a3e0 -#define PHY_BB_TPC_13_OFFSET 0x0000a3e0 -#define PHY_BB_TPC_13_DESIRED_SCALE_HT40_6_MSB 4 -#define PHY_BB_TPC_13_DESIRED_SCALE_HT40_6_LSB 0 -#define PHY_BB_TPC_13_DESIRED_SCALE_HT40_6_MASK 0x0000001f -#define PHY_BB_TPC_13_DESIRED_SCALE_HT40_6_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_TPC_13_DESIRED_SCALE_HT40_6_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_TPC_13_DESIRED_SCALE_HT40_7_MSB 9 -#define PHY_BB_TPC_13_DESIRED_SCALE_HT40_7_LSB 5 -#define PHY_BB_TPC_13_DESIRED_SCALE_HT40_7_MASK 0x000003e0 -#define PHY_BB_TPC_13_DESIRED_SCALE_HT40_7_GET(x) (((x) & 0x000003e0) >> 5) -#define PHY_BB_TPC_13_DESIRED_SCALE_HT40_7_SET(x) (((x) << 5) & 0x000003e0) - -/* macros for BB_tpc_14 */ -#define PHY_BB_TPC_14_ADDRESS 0x0000a3e4 -#define PHY_BB_TPC_14_OFFSET 0x0000a3e4 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_8_MSB 4 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_8_LSB 0 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_8_MASK 0x0000001f -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_8_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_8_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_9_MSB 9 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_9_LSB 5 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_9_MASK 0x000003e0 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_9_GET(x) (((x) & 0x000003e0) >> 5) -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_9_SET(x) (((x) << 5) & 0x000003e0) -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_10_MSB 14 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_10_LSB 10 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_10_MASK 0x00007c00 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_10_GET(x) (((x) & 0x00007c00) >> 10) -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_10_SET(x) (((x) << 10) & 0x00007c00) -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_11_MSB 19 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_11_LSB 15 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_11_MASK 0x000f8000 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_11_GET(x) (((x) & 0x000f8000) >> 15) -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_11_SET(x) (((x) << 15) & 0x000f8000) -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_12_MSB 24 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_12_LSB 20 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_12_MASK 0x01f00000 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_12_GET(x) (((x) & 0x01f00000) >> 20) -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_12_SET(x) (((x) << 20) & 0x01f00000) -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_13_MSB 29 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_13_LSB 25 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_13_MASK 0x3e000000 -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_13_GET(x) (((x) & 0x3e000000) >> 25) -#define PHY_BB_TPC_14_DESIRED_SCALE_HT20_13_SET(x) (((x) << 25) & 0x3e000000) - -/* macros for BB_tpc_15 */ -#define PHY_BB_TPC_15_ADDRESS 0x0000a3e8 -#define PHY_BB_TPC_15_OFFSET 0x0000a3e8 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_8_MSB 4 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_8_LSB 0 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_8_MASK 0x0000001f -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_8_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_8_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_9_MSB 9 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_9_LSB 5 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_9_MASK 0x000003e0 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_9_GET(x) (((x) & 0x000003e0) >> 5) -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_9_SET(x) (((x) << 5) & 0x000003e0) -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_10_MSB 14 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_10_LSB 10 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_10_MASK 0x00007c00 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_10_GET(x) (((x) & 0x00007c00) >> 10) -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_10_SET(x) (((x) << 10) & 0x00007c00) -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_11_MSB 19 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_11_LSB 15 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_11_MASK 0x000f8000 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_11_GET(x) (((x) & 0x000f8000) >> 15) -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_11_SET(x) (((x) << 15) & 0x000f8000) -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_12_MSB 24 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_12_LSB 20 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_12_MASK 0x01f00000 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_12_GET(x) (((x) & 0x01f00000) >> 20) -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_12_SET(x) (((x) << 20) & 0x01f00000) -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_13_MSB 29 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_13_LSB 25 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_13_MASK 0x3e000000 -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_13_GET(x) (((x) & 0x3e000000) >> 25) -#define PHY_BB_TPC_15_DESIRED_SCALE_HT40_13_SET(x) (((x) << 25) & 0x3e000000) - -/* macros for BB_tpc_16 */ -#define PHY_BB_TPC_16_ADDRESS 0x0000a3ec -#define PHY_BB_TPC_16_OFFSET 0x0000a3ec -#define PHY_BB_TPC_16_PDADC_PAR_CORR_CCK_MSB 13 -#define PHY_BB_TPC_16_PDADC_PAR_CORR_CCK_LSB 8 -#define PHY_BB_TPC_16_PDADC_PAR_CORR_CCK_MASK 0x00003f00 -#define PHY_BB_TPC_16_PDADC_PAR_CORR_CCK_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_BB_TPC_16_PDADC_PAR_CORR_CCK_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_BB_TPC_16_PDADC_PAR_CORR_OFDM_MSB 21 -#define PHY_BB_TPC_16_PDADC_PAR_CORR_OFDM_LSB 16 -#define PHY_BB_TPC_16_PDADC_PAR_CORR_OFDM_MASK 0x003f0000 -#define PHY_BB_TPC_16_PDADC_PAR_CORR_OFDM_GET(x) (((x) & 0x003f0000) >> 16) -#define PHY_BB_TPC_16_PDADC_PAR_CORR_OFDM_SET(x) (((x) << 16) & 0x003f0000) -#define PHY_BB_TPC_16_PDADC_PAR_CORR_HT40_MSB 29 -#define PHY_BB_TPC_16_PDADC_PAR_CORR_HT40_LSB 24 -#define PHY_BB_TPC_16_PDADC_PAR_CORR_HT40_MASK 0x3f000000 -#define PHY_BB_TPC_16_PDADC_PAR_CORR_HT40_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_BB_TPC_16_PDADC_PAR_CORR_HT40_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for BB_tpc_17 */ -#define PHY_BB_TPC_17_ADDRESS 0x0000a3f0 -#define PHY_BB_TPC_17_OFFSET 0x0000a3f0 -#define PHY_BB_TPC_17_ENABLE_PAL_MSB 0 -#define PHY_BB_TPC_17_ENABLE_PAL_LSB 0 -#define PHY_BB_TPC_17_ENABLE_PAL_MASK 0x00000001 -#define PHY_BB_TPC_17_ENABLE_PAL_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_TPC_17_ENABLE_PAL_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_TPC_17_ENABLE_PAL_CCK_MSB 1 -#define PHY_BB_TPC_17_ENABLE_PAL_CCK_LSB 1 -#define PHY_BB_TPC_17_ENABLE_PAL_CCK_MASK 0x00000002 -#define PHY_BB_TPC_17_ENABLE_PAL_CCK_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_TPC_17_ENABLE_PAL_CCK_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_TPC_17_ENABLE_PAL_OFDM_20_MSB 2 -#define PHY_BB_TPC_17_ENABLE_PAL_OFDM_20_LSB 2 -#define PHY_BB_TPC_17_ENABLE_PAL_OFDM_20_MASK 0x00000004 -#define PHY_BB_TPC_17_ENABLE_PAL_OFDM_20_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_BB_TPC_17_ENABLE_PAL_OFDM_20_SET(x) (((x) << 2) & 0x00000004) -#define PHY_BB_TPC_17_ENABLE_PAL_OFDM_40_MSB 3 -#define PHY_BB_TPC_17_ENABLE_PAL_OFDM_40_LSB 3 -#define PHY_BB_TPC_17_ENABLE_PAL_OFDM_40_MASK 0x00000008 -#define PHY_BB_TPC_17_ENABLE_PAL_OFDM_40_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_BB_TPC_17_ENABLE_PAL_OFDM_40_SET(x) (((x) << 3) & 0x00000008) -#define PHY_BB_TPC_17_PAL_POWER_THRESHOLD_MSB 9 -#define PHY_BB_TPC_17_PAL_POWER_THRESHOLD_LSB 4 -#define PHY_BB_TPC_17_PAL_POWER_THRESHOLD_MASK 0x000003f0 -#define PHY_BB_TPC_17_PAL_POWER_THRESHOLD_GET(x) (((x) & 0x000003f0) >> 4) -#define PHY_BB_TPC_17_PAL_POWER_THRESHOLD_SET(x) (((x) << 4) & 0x000003f0) -#define PHY_BB_TPC_17_FORCE_PAL_LOCKED_MSB 10 -#define PHY_BB_TPC_17_FORCE_PAL_LOCKED_LSB 10 -#define PHY_BB_TPC_17_FORCE_PAL_LOCKED_MASK 0x00000400 -#define PHY_BB_TPC_17_FORCE_PAL_LOCKED_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_BB_TPC_17_FORCE_PAL_LOCKED_SET(x) (((x) << 10) & 0x00000400) -#define PHY_BB_TPC_17_INIT_TX_GAIN_SETTING_PAL_ON_MSB 16 -#define PHY_BB_TPC_17_INIT_TX_GAIN_SETTING_PAL_ON_LSB 11 -#define PHY_BB_TPC_17_INIT_TX_GAIN_SETTING_PAL_ON_MASK 0x0001f800 -#define PHY_BB_TPC_17_INIT_TX_GAIN_SETTING_PAL_ON_GET(x) (((x) & 0x0001f800) >> 11) -#define PHY_BB_TPC_17_INIT_TX_GAIN_SETTING_PAL_ON_SET(x) (((x) << 11) & 0x0001f800) - -/* macros for BB_tpc_18 */ -#define PHY_BB_TPC_18_ADDRESS 0x0000a3f4 -#define PHY_BB_TPC_18_OFFSET 0x0000a3f4 -#define PHY_BB_TPC_18_THERM_CAL_VALUE_MSB 7 -#define PHY_BB_TPC_18_THERM_CAL_VALUE_LSB 0 -#define PHY_BB_TPC_18_THERM_CAL_VALUE_MASK 0x000000ff -#define PHY_BB_TPC_18_THERM_CAL_VALUE_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_TPC_18_THERM_CAL_VALUE_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_TPC_18_VOLT_CAL_VALUE_MSB 15 -#define PHY_BB_TPC_18_VOLT_CAL_VALUE_LSB 8 -#define PHY_BB_TPC_18_VOLT_CAL_VALUE_MASK 0x0000ff00 -#define PHY_BB_TPC_18_VOLT_CAL_VALUE_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_TPC_18_VOLT_CAL_VALUE_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_TPC_18_USE_LEGACY_TPC_MSB 16 -#define PHY_BB_TPC_18_USE_LEGACY_TPC_LSB 16 -#define PHY_BB_TPC_18_USE_LEGACY_TPC_MASK 0x00010000 -#define PHY_BB_TPC_18_USE_LEGACY_TPC_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_BB_TPC_18_USE_LEGACY_TPC_SET(x) (((x) << 16) & 0x00010000) - -/* macros for BB_tpc_19 */ -#define PHY_BB_TPC_19_ADDRESS 0x0000a3f8 -#define PHY_BB_TPC_19_OFFSET 0x0000a3f8 -#define PHY_BB_TPC_19_ALPHA_THERM_MSB 7 -#define PHY_BB_TPC_19_ALPHA_THERM_LSB 0 -#define PHY_BB_TPC_19_ALPHA_THERM_MASK 0x000000ff -#define PHY_BB_TPC_19_ALPHA_THERM_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_TPC_19_ALPHA_THERM_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_TPC_19_ALPHA_THERM_PAL_ON_MSB 15 -#define PHY_BB_TPC_19_ALPHA_THERM_PAL_ON_LSB 8 -#define PHY_BB_TPC_19_ALPHA_THERM_PAL_ON_MASK 0x0000ff00 -#define PHY_BB_TPC_19_ALPHA_THERM_PAL_ON_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_TPC_19_ALPHA_THERM_PAL_ON_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_TPC_19_ALPHA_VOLT_MSB 20 -#define PHY_BB_TPC_19_ALPHA_VOLT_LSB 16 -#define PHY_BB_TPC_19_ALPHA_VOLT_MASK 0x001f0000 -#define PHY_BB_TPC_19_ALPHA_VOLT_GET(x) (((x) & 0x001f0000) >> 16) -#define PHY_BB_TPC_19_ALPHA_VOLT_SET(x) (((x) << 16) & 0x001f0000) -#define PHY_BB_TPC_19_ALPHA_VOLT_PAL_ON_MSB 25 -#define PHY_BB_TPC_19_ALPHA_VOLT_PAL_ON_LSB 21 -#define PHY_BB_TPC_19_ALPHA_VOLT_PAL_ON_MASK 0x03e00000 -#define PHY_BB_TPC_19_ALPHA_VOLT_PAL_ON_GET(x) (((x) & 0x03e00000) >> 21) -#define PHY_BB_TPC_19_ALPHA_VOLT_PAL_ON_SET(x) (((x) << 21) & 0x03e00000) - -/* macros for BB_tpc_20 */ -#define PHY_BB_TPC_20_ADDRESS 0x0000a3fc -#define PHY_BB_TPC_20_OFFSET 0x0000a3fc -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_0_MSB 0 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_0_LSB 0 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_0_MASK 0x00000001 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_0_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_0_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_1_MSB 1 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_1_LSB 1 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_1_MASK 0x00000002 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_1_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_1_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_2_MSB 2 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_2_LSB 2 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_2_MASK 0x00000004 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_2_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_2_SET(x) (((x) << 2) & 0x00000004) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_3_MSB 3 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_3_LSB 3 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_3_MASK 0x00000008 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_3_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_3_SET(x) (((x) << 3) & 0x00000008) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_4_MSB 4 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_4_LSB 4 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_4_MASK 0x00000010 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_4_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_4_SET(x) (((x) << 4) & 0x00000010) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_5_MSB 5 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_5_LSB 5 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_5_MASK 0x00000020 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_5_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_5_SET(x) (((x) << 5) & 0x00000020) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_6_MSB 6 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_6_LSB 6 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_6_MASK 0x00000040 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_6_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_6_SET(x) (((x) << 6) & 0x00000040) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_7_MSB 7 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_7_LSB 7 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_7_MASK 0x00000080 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_7_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_7_SET(x) (((x) << 7) & 0x00000080) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_8_MSB 8 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_8_LSB 8 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_8_MASK 0x00000100 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_8_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_8_SET(x) (((x) << 8) & 0x00000100) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_9_MSB 9 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_9_LSB 9 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_9_MASK 0x00000200 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_9_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_9_SET(x) (((x) << 9) & 0x00000200) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_10_MSB 10 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_10_LSB 10 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_10_MASK 0x00000400 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_10_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_10_SET(x) (((x) << 10) & 0x00000400) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_11_MSB 11 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_11_LSB 11 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_11_MASK 0x00000800 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_11_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_11_SET(x) (((x) << 11) & 0x00000800) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_12_MSB 12 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_12_LSB 12 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_12_MASK 0x00001000 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_12_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_12_SET(x) (((x) << 12) & 0x00001000) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_13_MSB 13 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_13_LSB 13 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_13_MASK 0x00002000 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_13_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_13_SET(x) (((x) << 13) & 0x00002000) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_14_MSB 14 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_14_LSB 14 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_14_MASK 0x00004000 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_14_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_14_SET(x) (((x) << 14) & 0x00004000) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_15_MSB 15 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_15_LSB 15 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_15_MASK 0x00008000 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_15_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_15_SET(x) (((x) << 15) & 0x00008000) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_16_MSB 16 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_16_LSB 16 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_16_MASK 0x00010000 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_16_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_16_SET(x) (((x) << 16) & 0x00010000) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_17_MSB 17 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_17_LSB 17 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_17_MASK 0x00020000 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_17_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_17_SET(x) (((x) << 17) & 0x00020000) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_18_MSB 18 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_18_LSB 18 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_18_MASK 0x00040000 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_18_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_18_SET(x) (((x) << 18) & 0x00040000) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_19_MSB 19 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_19_LSB 19 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_19_MASK 0x00080000 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_19_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_19_SET(x) (((x) << 19) & 0x00080000) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_20_MSB 20 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_20_LSB 20 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_20_MASK 0x00100000 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_20_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_20_SET(x) (((x) << 20) & 0x00100000) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_21_MSB 21 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_21_LSB 21 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_21_MASK 0x00200000 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_21_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_21_SET(x) (((x) << 21) & 0x00200000) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_22_MSB 22 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_22_LSB 22 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_22_MASK 0x00400000 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_22_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_22_SET(x) (((x) << 22) & 0x00400000) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_23_MSB 23 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_23_LSB 23 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_23_MASK 0x00800000 -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_23_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_BB_TPC_20_ENABLE_PAL_MCS_23_SET(x) (((x) << 23) & 0x00800000) - -/* macros for BB_tx_gain_tab_1 */ -#define PHY_BB_TX_GAIN_TAB_1_ADDRESS 0x0000a400 -#define PHY_BB_TX_GAIN_TAB_1_OFFSET 0x0000a400 -#define PHY_BB_TX_GAIN_TAB_1_TG_TABLE1_MSB 31 -#define PHY_BB_TX_GAIN_TAB_1_TG_TABLE1_LSB 0 -#define PHY_BB_TX_GAIN_TAB_1_TG_TABLE1_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_1_TG_TABLE1_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_1_TG_TABLE1_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_2 */ -#define PHY_BB_TX_GAIN_TAB_2_ADDRESS 0x0000a404 -#define PHY_BB_TX_GAIN_TAB_2_OFFSET 0x0000a404 -#define PHY_BB_TX_GAIN_TAB_2_TG_TABLE2_MSB 31 -#define PHY_BB_TX_GAIN_TAB_2_TG_TABLE2_LSB 0 -#define PHY_BB_TX_GAIN_TAB_2_TG_TABLE2_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_2_TG_TABLE2_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_2_TG_TABLE2_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_3 */ -#define PHY_BB_TX_GAIN_TAB_3_ADDRESS 0x0000a408 -#define PHY_BB_TX_GAIN_TAB_3_OFFSET 0x0000a408 -#define PHY_BB_TX_GAIN_TAB_3_TG_TABLE3_MSB 31 -#define PHY_BB_TX_GAIN_TAB_3_TG_TABLE3_LSB 0 -#define PHY_BB_TX_GAIN_TAB_3_TG_TABLE3_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_3_TG_TABLE3_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_3_TG_TABLE3_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_4 */ -#define PHY_BB_TX_GAIN_TAB_4_ADDRESS 0x0000a40c -#define PHY_BB_TX_GAIN_TAB_4_OFFSET 0x0000a40c -#define PHY_BB_TX_GAIN_TAB_4_TG_TABLE4_MSB 31 -#define PHY_BB_TX_GAIN_TAB_4_TG_TABLE4_LSB 0 -#define PHY_BB_TX_GAIN_TAB_4_TG_TABLE4_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_4_TG_TABLE4_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_4_TG_TABLE4_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_5 */ -#define PHY_BB_TX_GAIN_TAB_5_ADDRESS 0x0000a410 -#define PHY_BB_TX_GAIN_TAB_5_OFFSET 0x0000a410 -#define PHY_BB_TX_GAIN_TAB_5_TG_TABLE5_MSB 31 -#define PHY_BB_TX_GAIN_TAB_5_TG_TABLE5_LSB 0 -#define PHY_BB_TX_GAIN_TAB_5_TG_TABLE5_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_5_TG_TABLE5_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_5_TG_TABLE5_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_6 */ -#define PHY_BB_TX_GAIN_TAB_6_ADDRESS 0x0000a414 -#define PHY_BB_TX_GAIN_TAB_6_OFFSET 0x0000a414 -#define PHY_BB_TX_GAIN_TAB_6_TG_TABLE6_MSB 31 -#define PHY_BB_TX_GAIN_TAB_6_TG_TABLE6_LSB 0 -#define PHY_BB_TX_GAIN_TAB_6_TG_TABLE6_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_6_TG_TABLE6_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_6_TG_TABLE6_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_7 */ -#define PHY_BB_TX_GAIN_TAB_7_ADDRESS 0x0000a418 -#define PHY_BB_TX_GAIN_TAB_7_OFFSET 0x0000a418 -#define PHY_BB_TX_GAIN_TAB_7_TG_TABLE7_MSB 31 -#define PHY_BB_TX_GAIN_TAB_7_TG_TABLE7_LSB 0 -#define PHY_BB_TX_GAIN_TAB_7_TG_TABLE7_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_7_TG_TABLE7_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_7_TG_TABLE7_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_8 */ -#define PHY_BB_TX_GAIN_TAB_8_ADDRESS 0x0000a41c -#define PHY_BB_TX_GAIN_TAB_8_OFFSET 0x0000a41c -#define PHY_BB_TX_GAIN_TAB_8_TG_TABLE8_MSB 31 -#define PHY_BB_TX_GAIN_TAB_8_TG_TABLE8_LSB 0 -#define PHY_BB_TX_GAIN_TAB_8_TG_TABLE8_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_8_TG_TABLE8_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_8_TG_TABLE8_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_9 */ -#define PHY_BB_TX_GAIN_TAB_9_ADDRESS 0x0000a420 -#define PHY_BB_TX_GAIN_TAB_9_OFFSET 0x0000a420 -#define PHY_BB_TX_GAIN_TAB_9_TG_TABLE9_MSB 31 -#define PHY_BB_TX_GAIN_TAB_9_TG_TABLE9_LSB 0 -#define PHY_BB_TX_GAIN_TAB_9_TG_TABLE9_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_9_TG_TABLE9_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_9_TG_TABLE9_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_10 */ -#define PHY_BB_TX_GAIN_TAB_10_ADDRESS 0x0000a424 -#define PHY_BB_TX_GAIN_TAB_10_OFFSET 0x0000a424 -#define PHY_BB_TX_GAIN_TAB_10_TG_TABLE10_MSB 31 -#define PHY_BB_TX_GAIN_TAB_10_TG_TABLE10_LSB 0 -#define PHY_BB_TX_GAIN_TAB_10_TG_TABLE10_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_10_TG_TABLE10_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_10_TG_TABLE10_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_11 */ -#define PHY_BB_TX_GAIN_TAB_11_ADDRESS 0x0000a428 -#define PHY_BB_TX_GAIN_TAB_11_OFFSET 0x0000a428 -#define PHY_BB_TX_GAIN_TAB_11_TG_TABLE11_MSB 31 -#define PHY_BB_TX_GAIN_TAB_11_TG_TABLE11_LSB 0 -#define PHY_BB_TX_GAIN_TAB_11_TG_TABLE11_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_11_TG_TABLE11_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_11_TG_TABLE11_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_12 */ -#define PHY_BB_TX_GAIN_TAB_12_ADDRESS 0x0000a42c -#define PHY_BB_TX_GAIN_TAB_12_OFFSET 0x0000a42c -#define PHY_BB_TX_GAIN_TAB_12_TG_TABLE12_MSB 31 -#define PHY_BB_TX_GAIN_TAB_12_TG_TABLE12_LSB 0 -#define PHY_BB_TX_GAIN_TAB_12_TG_TABLE12_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_12_TG_TABLE12_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_12_TG_TABLE12_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_13 */ -#define PHY_BB_TX_GAIN_TAB_13_ADDRESS 0x0000a430 -#define PHY_BB_TX_GAIN_TAB_13_OFFSET 0x0000a430 -#define PHY_BB_TX_GAIN_TAB_13_TG_TABLE13_MSB 31 -#define PHY_BB_TX_GAIN_TAB_13_TG_TABLE13_LSB 0 -#define PHY_BB_TX_GAIN_TAB_13_TG_TABLE13_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_13_TG_TABLE13_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_13_TG_TABLE13_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_14 */ -#define PHY_BB_TX_GAIN_TAB_14_ADDRESS 0x0000a434 -#define PHY_BB_TX_GAIN_TAB_14_OFFSET 0x0000a434 -#define PHY_BB_TX_GAIN_TAB_14_TG_TABLE14_MSB 31 -#define PHY_BB_TX_GAIN_TAB_14_TG_TABLE14_LSB 0 -#define PHY_BB_TX_GAIN_TAB_14_TG_TABLE14_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_14_TG_TABLE14_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_14_TG_TABLE14_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_15 */ -#define PHY_BB_TX_GAIN_TAB_15_ADDRESS 0x0000a438 -#define PHY_BB_TX_GAIN_TAB_15_OFFSET 0x0000a438 -#define PHY_BB_TX_GAIN_TAB_15_TG_TABLE15_MSB 31 -#define PHY_BB_TX_GAIN_TAB_15_TG_TABLE15_LSB 0 -#define PHY_BB_TX_GAIN_TAB_15_TG_TABLE15_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_15_TG_TABLE15_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_15_TG_TABLE15_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_16 */ -#define PHY_BB_TX_GAIN_TAB_16_ADDRESS 0x0000a43c -#define PHY_BB_TX_GAIN_TAB_16_OFFSET 0x0000a43c -#define PHY_BB_TX_GAIN_TAB_16_TG_TABLE16_MSB 31 -#define PHY_BB_TX_GAIN_TAB_16_TG_TABLE16_LSB 0 -#define PHY_BB_TX_GAIN_TAB_16_TG_TABLE16_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_16_TG_TABLE16_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_16_TG_TABLE16_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_17 */ -#define PHY_BB_TX_GAIN_TAB_17_ADDRESS 0x0000a440 -#define PHY_BB_TX_GAIN_TAB_17_OFFSET 0x0000a440 -#define PHY_BB_TX_GAIN_TAB_17_TG_TABLE17_MSB 31 -#define PHY_BB_TX_GAIN_TAB_17_TG_TABLE17_LSB 0 -#define PHY_BB_TX_GAIN_TAB_17_TG_TABLE17_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_17_TG_TABLE17_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_17_TG_TABLE17_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_18 */ -#define PHY_BB_TX_GAIN_TAB_18_ADDRESS 0x0000a444 -#define PHY_BB_TX_GAIN_TAB_18_OFFSET 0x0000a444 -#define PHY_BB_TX_GAIN_TAB_18_TG_TABLE18_MSB 31 -#define PHY_BB_TX_GAIN_TAB_18_TG_TABLE18_LSB 0 -#define PHY_BB_TX_GAIN_TAB_18_TG_TABLE18_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_18_TG_TABLE18_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_18_TG_TABLE18_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_19 */ -#define PHY_BB_TX_GAIN_TAB_19_ADDRESS 0x0000a448 -#define PHY_BB_TX_GAIN_TAB_19_OFFSET 0x0000a448 -#define PHY_BB_TX_GAIN_TAB_19_TG_TABLE19_MSB 31 -#define PHY_BB_TX_GAIN_TAB_19_TG_TABLE19_LSB 0 -#define PHY_BB_TX_GAIN_TAB_19_TG_TABLE19_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_19_TG_TABLE19_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_19_TG_TABLE19_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_20 */ -#define PHY_BB_TX_GAIN_TAB_20_ADDRESS 0x0000a44c -#define PHY_BB_TX_GAIN_TAB_20_OFFSET 0x0000a44c -#define PHY_BB_TX_GAIN_TAB_20_TG_TABLE20_MSB 31 -#define PHY_BB_TX_GAIN_TAB_20_TG_TABLE20_LSB 0 -#define PHY_BB_TX_GAIN_TAB_20_TG_TABLE20_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_20_TG_TABLE20_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_20_TG_TABLE20_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_21 */ -#define PHY_BB_TX_GAIN_TAB_21_ADDRESS 0x0000a450 -#define PHY_BB_TX_GAIN_TAB_21_OFFSET 0x0000a450 -#define PHY_BB_TX_GAIN_TAB_21_TG_TABLE21_MSB 31 -#define PHY_BB_TX_GAIN_TAB_21_TG_TABLE21_LSB 0 -#define PHY_BB_TX_GAIN_TAB_21_TG_TABLE21_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_21_TG_TABLE21_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_21_TG_TABLE21_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_22 */ -#define PHY_BB_TX_GAIN_TAB_22_ADDRESS 0x0000a454 -#define PHY_BB_TX_GAIN_TAB_22_OFFSET 0x0000a454 -#define PHY_BB_TX_GAIN_TAB_22_TG_TABLE22_MSB 31 -#define PHY_BB_TX_GAIN_TAB_22_TG_TABLE22_LSB 0 -#define PHY_BB_TX_GAIN_TAB_22_TG_TABLE22_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_22_TG_TABLE22_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_22_TG_TABLE22_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_23 */ -#define PHY_BB_TX_GAIN_TAB_23_ADDRESS 0x0000a458 -#define PHY_BB_TX_GAIN_TAB_23_OFFSET 0x0000a458 -#define PHY_BB_TX_GAIN_TAB_23_TG_TABLE23_MSB 31 -#define PHY_BB_TX_GAIN_TAB_23_TG_TABLE23_LSB 0 -#define PHY_BB_TX_GAIN_TAB_23_TG_TABLE23_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_23_TG_TABLE23_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_23_TG_TABLE23_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_24 */ -#define PHY_BB_TX_GAIN_TAB_24_ADDRESS 0x0000a45c -#define PHY_BB_TX_GAIN_TAB_24_OFFSET 0x0000a45c -#define PHY_BB_TX_GAIN_TAB_24_TG_TABLE24_MSB 31 -#define PHY_BB_TX_GAIN_TAB_24_TG_TABLE24_LSB 0 -#define PHY_BB_TX_GAIN_TAB_24_TG_TABLE24_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_24_TG_TABLE24_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_24_TG_TABLE24_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_25 */ -#define PHY_BB_TX_GAIN_TAB_25_ADDRESS 0x0000a460 -#define PHY_BB_TX_GAIN_TAB_25_OFFSET 0x0000a460 -#define PHY_BB_TX_GAIN_TAB_25_TG_TABLE25_MSB 31 -#define PHY_BB_TX_GAIN_TAB_25_TG_TABLE25_LSB 0 -#define PHY_BB_TX_GAIN_TAB_25_TG_TABLE25_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_25_TG_TABLE25_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_25_TG_TABLE25_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_26 */ -#define PHY_BB_TX_GAIN_TAB_26_ADDRESS 0x0000a464 -#define PHY_BB_TX_GAIN_TAB_26_OFFSET 0x0000a464 -#define PHY_BB_TX_GAIN_TAB_26_TG_TABLE26_MSB 31 -#define PHY_BB_TX_GAIN_TAB_26_TG_TABLE26_LSB 0 -#define PHY_BB_TX_GAIN_TAB_26_TG_TABLE26_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_26_TG_TABLE26_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_26_TG_TABLE26_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_27 */ -#define PHY_BB_TX_GAIN_TAB_27_ADDRESS 0x0000a468 -#define PHY_BB_TX_GAIN_TAB_27_OFFSET 0x0000a468 -#define PHY_BB_TX_GAIN_TAB_27_TG_TABLE27_MSB 31 -#define PHY_BB_TX_GAIN_TAB_27_TG_TABLE27_LSB 0 -#define PHY_BB_TX_GAIN_TAB_27_TG_TABLE27_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_27_TG_TABLE27_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_27_TG_TABLE27_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_28 */ -#define PHY_BB_TX_GAIN_TAB_28_ADDRESS 0x0000a46c -#define PHY_BB_TX_GAIN_TAB_28_OFFSET 0x0000a46c -#define PHY_BB_TX_GAIN_TAB_28_TG_TABLE28_MSB 31 -#define PHY_BB_TX_GAIN_TAB_28_TG_TABLE28_LSB 0 -#define PHY_BB_TX_GAIN_TAB_28_TG_TABLE28_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_28_TG_TABLE28_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_28_TG_TABLE28_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_29 */ -#define PHY_BB_TX_GAIN_TAB_29_ADDRESS 0x0000a470 -#define PHY_BB_TX_GAIN_TAB_29_OFFSET 0x0000a470 -#define PHY_BB_TX_GAIN_TAB_29_TG_TABLE29_MSB 31 -#define PHY_BB_TX_GAIN_TAB_29_TG_TABLE29_LSB 0 -#define PHY_BB_TX_GAIN_TAB_29_TG_TABLE29_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_29_TG_TABLE29_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_29_TG_TABLE29_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_30 */ -#define PHY_BB_TX_GAIN_TAB_30_ADDRESS 0x0000a474 -#define PHY_BB_TX_GAIN_TAB_30_OFFSET 0x0000a474 -#define PHY_BB_TX_GAIN_TAB_30_TG_TABLE30_MSB 31 -#define PHY_BB_TX_GAIN_TAB_30_TG_TABLE30_LSB 0 -#define PHY_BB_TX_GAIN_TAB_30_TG_TABLE30_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_30_TG_TABLE30_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_30_TG_TABLE30_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_31 */ -#define PHY_BB_TX_GAIN_TAB_31_ADDRESS 0x0000a478 -#define PHY_BB_TX_GAIN_TAB_31_OFFSET 0x0000a478 -#define PHY_BB_TX_GAIN_TAB_31_TG_TABLE31_MSB 31 -#define PHY_BB_TX_GAIN_TAB_31_TG_TABLE31_LSB 0 -#define PHY_BB_TX_GAIN_TAB_31_TG_TABLE31_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_31_TG_TABLE31_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_31_TG_TABLE31_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_32 */ -#define PHY_BB_TX_GAIN_TAB_32_ADDRESS 0x0000a47c -#define PHY_BB_TX_GAIN_TAB_32_OFFSET 0x0000a47c -#define PHY_BB_TX_GAIN_TAB_32_TG_TABLE32_MSB 31 -#define PHY_BB_TX_GAIN_TAB_32_TG_TABLE32_LSB 0 -#define PHY_BB_TX_GAIN_TAB_32_TG_TABLE32_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_32_TG_TABLE32_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_32_TG_TABLE32_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_1 */ -#define PHY_BB_TX_GAIN_TAB_PAL_1_ADDRESS 0x0000a480 -#define PHY_BB_TX_GAIN_TAB_PAL_1_OFFSET 0x0000a480 -#define PHY_BB_TX_GAIN_TAB_PAL_1_TG_TABLE1_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_1_TG_TABLE1_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_1_TG_TABLE1_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_1_TG_TABLE1_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_1_TG_TABLE1_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_2 */ -#define PHY_BB_TX_GAIN_TAB_PAL_2_ADDRESS 0x0000a484 -#define PHY_BB_TX_GAIN_TAB_PAL_2_OFFSET 0x0000a484 -#define PHY_BB_TX_GAIN_TAB_PAL_2_TG_TABLE2_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_2_TG_TABLE2_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_2_TG_TABLE2_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_2_TG_TABLE2_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_2_TG_TABLE2_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_3 */ -#define PHY_BB_TX_GAIN_TAB_PAL_3_ADDRESS 0x0000a488 -#define PHY_BB_TX_GAIN_TAB_PAL_3_OFFSET 0x0000a488 -#define PHY_BB_TX_GAIN_TAB_PAL_3_TG_TABLE3_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_3_TG_TABLE3_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_3_TG_TABLE3_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_3_TG_TABLE3_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_3_TG_TABLE3_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_4 */ -#define PHY_BB_TX_GAIN_TAB_PAL_4_ADDRESS 0x0000a48c -#define PHY_BB_TX_GAIN_TAB_PAL_4_OFFSET 0x0000a48c -#define PHY_BB_TX_GAIN_TAB_PAL_4_TG_TABLE4_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_4_TG_TABLE4_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_4_TG_TABLE4_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_4_TG_TABLE4_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_4_TG_TABLE4_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_5 */ -#define PHY_BB_TX_GAIN_TAB_PAL_5_ADDRESS 0x0000a490 -#define PHY_BB_TX_GAIN_TAB_PAL_5_OFFSET 0x0000a490 -#define PHY_BB_TX_GAIN_TAB_PAL_5_TG_TABLE5_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_5_TG_TABLE5_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_5_TG_TABLE5_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_5_TG_TABLE5_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_5_TG_TABLE5_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_6 */ -#define PHY_BB_TX_GAIN_TAB_PAL_6_ADDRESS 0x0000a494 -#define PHY_BB_TX_GAIN_TAB_PAL_6_OFFSET 0x0000a494 -#define PHY_BB_TX_GAIN_TAB_PAL_6_TG_TABLE6_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_6_TG_TABLE6_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_6_TG_TABLE6_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_6_TG_TABLE6_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_6_TG_TABLE6_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_7 */ -#define PHY_BB_TX_GAIN_TAB_PAL_7_ADDRESS 0x0000a498 -#define PHY_BB_TX_GAIN_TAB_PAL_7_OFFSET 0x0000a498 -#define PHY_BB_TX_GAIN_TAB_PAL_7_TG_TABLE7_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_7_TG_TABLE7_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_7_TG_TABLE7_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_7_TG_TABLE7_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_7_TG_TABLE7_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_8 */ -#define PHY_BB_TX_GAIN_TAB_PAL_8_ADDRESS 0x0000a49c -#define PHY_BB_TX_GAIN_TAB_PAL_8_OFFSET 0x0000a49c -#define PHY_BB_TX_GAIN_TAB_PAL_8_TG_TABLE8_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_8_TG_TABLE8_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_8_TG_TABLE8_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_8_TG_TABLE8_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_8_TG_TABLE8_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_9 */ -#define PHY_BB_TX_GAIN_TAB_PAL_9_ADDRESS 0x0000a4a0 -#define PHY_BB_TX_GAIN_TAB_PAL_9_OFFSET 0x0000a4a0 -#define PHY_BB_TX_GAIN_TAB_PAL_9_TG_TABLE9_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_9_TG_TABLE9_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_9_TG_TABLE9_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_9_TG_TABLE9_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_9_TG_TABLE9_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_10 */ -#define PHY_BB_TX_GAIN_TAB_PAL_10_ADDRESS 0x0000a4a4 -#define PHY_BB_TX_GAIN_TAB_PAL_10_OFFSET 0x0000a4a4 -#define PHY_BB_TX_GAIN_TAB_PAL_10_TG_TABLE10_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_10_TG_TABLE10_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_10_TG_TABLE10_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_10_TG_TABLE10_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_10_TG_TABLE10_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_11 */ -#define PHY_BB_TX_GAIN_TAB_PAL_11_ADDRESS 0x0000a4a8 -#define PHY_BB_TX_GAIN_TAB_PAL_11_OFFSET 0x0000a4a8 -#define PHY_BB_TX_GAIN_TAB_PAL_11_TG_TABLE11_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_11_TG_TABLE11_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_11_TG_TABLE11_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_11_TG_TABLE11_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_11_TG_TABLE11_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_12 */ -#define PHY_BB_TX_GAIN_TAB_PAL_12_ADDRESS 0x0000a4ac -#define PHY_BB_TX_GAIN_TAB_PAL_12_OFFSET 0x0000a4ac -#define PHY_BB_TX_GAIN_TAB_PAL_12_TG_TABLE12_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_12_TG_TABLE12_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_12_TG_TABLE12_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_12_TG_TABLE12_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_12_TG_TABLE12_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_13 */ -#define PHY_BB_TX_GAIN_TAB_PAL_13_ADDRESS 0x0000a4b0 -#define PHY_BB_TX_GAIN_TAB_PAL_13_OFFSET 0x0000a4b0 -#define PHY_BB_TX_GAIN_TAB_PAL_13_TG_TABLE13_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_13_TG_TABLE13_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_13_TG_TABLE13_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_13_TG_TABLE13_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_13_TG_TABLE13_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_14 */ -#define PHY_BB_TX_GAIN_TAB_PAL_14_ADDRESS 0x0000a4b4 -#define PHY_BB_TX_GAIN_TAB_PAL_14_OFFSET 0x0000a4b4 -#define PHY_BB_TX_GAIN_TAB_PAL_14_TG_TABLE14_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_14_TG_TABLE14_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_14_TG_TABLE14_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_14_TG_TABLE14_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_14_TG_TABLE14_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_15 */ -#define PHY_BB_TX_GAIN_TAB_PAL_15_ADDRESS 0x0000a4b8 -#define PHY_BB_TX_GAIN_TAB_PAL_15_OFFSET 0x0000a4b8 -#define PHY_BB_TX_GAIN_TAB_PAL_15_TG_TABLE15_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_15_TG_TABLE15_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_15_TG_TABLE15_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_15_TG_TABLE15_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_15_TG_TABLE15_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_16 */ -#define PHY_BB_TX_GAIN_TAB_PAL_16_ADDRESS 0x0000a4bc -#define PHY_BB_TX_GAIN_TAB_PAL_16_OFFSET 0x0000a4bc -#define PHY_BB_TX_GAIN_TAB_PAL_16_TG_TABLE16_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_16_TG_TABLE16_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_16_TG_TABLE16_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_16_TG_TABLE16_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_16_TG_TABLE16_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_17 */ -#define PHY_BB_TX_GAIN_TAB_PAL_17_ADDRESS 0x0000a4c0 -#define PHY_BB_TX_GAIN_TAB_PAL_17_OFFSET 0x0000a4c0 -#define PHY_BB_TX_GAIN_TAB_PAL_17_TG_TABLE17_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_17_TG_TABLE17_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_17_TG_TABLE17_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_17_TG_TABLE17_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_17_TG_TABLE17_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_18 */ -#define PHY_BB_TX_GAIN_TAB_PAL_18_ADDRESS 0x0000a4c4 -#define PHY_BB_TX_GAIN_TAB_PAL_18_OFFSET 0x0000a4c4 -#define PHY_BB_TX_GAIN_TAB_PAL_18_TG_TABLE18_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_18_TG_TABLE18_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_18_TG_TABLE18_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_18_TG_TABLE18_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_18_TG_TABLE18_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_19 */ -#define PHY_BB_TX_GAIN_TAB_PAL_19_ADDRESS 0x0000a4c8 -#define PHY_BB_TX_GAIN_TAB_PAL_19_OFFSET 0x0000a4c8 -#define PHY_BB_TX_GAIN_TAB_PAL_19_TG_TABLE19_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_19_TG_TABLE19_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_19_TG_TABLE19_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_19_TG_TABLE19_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_19_TG_TABLE19_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_20 */ -#define PHY_BB_TX_GAIN_TAB_PAL_20_ADDRESS 0x0000a4cc -#define PHY_BB_TX_GAIN_TAB_PAL_20_OFFSET 0x0000a4cc -#define PHY_BB_TX_GAIN_TAB_PAL_20_TG_TABLE20_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_20_TG_TABLE20_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_20_TG_TABLE20_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_20_TG_TABLE20_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_20_TG_TABLE20_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_21 */ -#define PHY_BB_TX_GAIN_TAB_PAL_21_ADDRESS 0x0000a4d0 -#define PHY_BB_TX_GAIN_TAB_PAL_21_OFFSET 0x0000a4d0 -#define PHY_BB_TX_GAIN_TAB_PAL_21_TG_TABLE21_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_21_TG_TABLE21_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_21_TG_TABLE21_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_21_TG_TABLE21_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_21_TG_TABLE21_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_22 */ -#define PHY_BB_TX_GAIN_TAB_PAL_22_ADDRESS 0x0000a4d4 -#define PHY_BB_TX_GAIN_TAB_PAL_22_OFFSET 0x0000a4d4 -#define PHY_BB_TX_GAIN_TAB_PAL_22_TG_TABLE22_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_22_TG_TABLE22_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_22_TG_TABLE22_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_22_TG_TABLE22_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_22_TG_TABLE22_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_23 */ -#define PHY_BB_TX_GAIN_TAB_PAL_23_ADDRESS 0x0000a4d8 -#define PHY_BB_TX_GAIN_TAB_PAL_23_OFFSET 0x0000a4d8 -#define PHY_BB_TX_GAIN_TAB_PAL_23_TG_TABLE23_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_23_TG_TABLE23_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_23_TG_TABLE23_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_23_TG_TABLE23_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_23_TG_TABLE23_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_24 */ -#define PHY_BB_TX_GAIN_TAB_PAL_24_ADDRESS 0x0000a4dc -#define PHY_BB_TX_GAIN_TAB_PAL_24_OFFSET 0x0000a4dc -#define PHY_BB_TX_GAIN_TAB_PAL_24_TG_TABLE24_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_24_TG_TABLE24_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_24_TG_TABLE24_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_24_TG_TABLE24_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_24_TG_TABLE24_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_25 */ -#define PHY_BB_TX_GAIN_TAB_PAL_25_ADDRESS 0x0000a4e0 -#define PHY_BB_TX_GAIN_TAB_PAL_25_OFFSET 0x0000a4e0 -#define PHY_BB_TX_GAIN_TAB_PAL_25_TG_TABLE25_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_25_TG_TABLE25_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_25_TG_TABLE25_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_25_TG_TABLE25_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_25_TG_TABLE25_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_26 */ -#define PHY_BB_TX_GAIN_TAB_PAL_26_ADDRESS 0x0000a4e4 -#define PHY_BB_TX_GAIN_TAB_PAL_26_OFFSET 0x0000a4e4 -#define PHY_BB_TX_GAIN_TAB_PAL_26_TG_TABLE26_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_26_TG_TABLE26_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_26_TG_TABLE26_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_26_TG_TABLE26_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_26_TG_TABLE26_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_27 */ -#define PHY_BB_TX_GAIN_TAB_PAL_27_ADDRESS 0x0000a4e8 -#define PHY_BB_TX_GAIN_TAB_PAL_27_OFFSET 0x0000a4e8 -#define PHY_BB_TX_GAIN_TAB_PAL_27_TG_TABLE27_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_27_TG_TABLE27_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_27_TG_TABLE27_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_27_TG_TABLE27_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_27_TG_TABLE27_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_28 */ -#define PHY_BB_TX_GAIN_TAB_PAL_28_ADDRESS 0x0000a4ec -#define PHY_BB_TX_GAIN_TAB_PAL_28_OFFSET 0x0000a4ec -#define PHY_BB_TX_GAIN_TAB_PAL_28_TG_TABLE28_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_28_TG_TABLE28_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_28_TG_TABLE28_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_28_TG_TABLE28_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_28_TG_TABLE28_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_29 */ -#define PHY_BB_TX_GAIN_TAB_PAL_29_ADDRESS 0x0000a4f0 -#define PHY_BB_TX_GAIN_TAB_PAL_29_OFFSET 0x0000a4f0 -#define PHY_BB_TX_GAIN_TAB_PAL_29_TG_TABLE29_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_29_TG_TABLE29_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_29_TG_TABLE29_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_29_TG_TABLE29_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_29_TG_TABLE29_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_30 */ -#define PHY_BB_TX_GAIN_TAB_PAL_30_ADDRESS 0x0000a4f4 -#define PHY_BB_TX_GAIN_TAB_PAL_30_OFFSET 0x0000a4f4 -#define PHY_BB_TX_GAIN_TAB_PAL_30_TG_TABLE30_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_30_TG_TABLE30_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_30_TG_TABLE30_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_30_TG_TABLE30_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_30_TG_TABLE30_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_31 */ -#define PHY_BB_TX_GAIN_TAB_PAL_31_ADDRESS 0x0000a4f8 -#define PHY_BB_TX_GAIN_TAB_PAL_31_OFFSET 0x0000a4f8 -#define PHY_BB_TX_GAIN_TAB_PAL_31_TG_TABLE31_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_31_TG_TABLE31_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_31_TG_TABLE31_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_31_TG_TABLE31_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_31_TG_TABLE31_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_tx_gain_tab_pal_32 */ -#define PHY_BB_TX_GAIN_TAB_PAL_32_ADDRESS 0x0000a4fc -#define PHY_BB_TX_GAIN_TAB_PAL_32_OFFSET 0x0000a4fc -#define PHY_BB_TX_GAIN_TAB_PAL_32_TG_TABLE32_PAL_ON_MSB 31 -#define PHY_BB_TX_GAIN_TAB_PAL_32_TG_TABLE32_PAL_ON_LSB 0 -#define PHY_BB_TX_GAIN_TAB_PAL_32_TG_TABLE32_PAL_ON_MASK 0xffffffff -#define PHY_BB_TX_GAIN_TAB_PAL_32_TG_TABLE32_PAL_ON_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_TX_GAIN_TAB_PAL_32_TG_TABLE32_PAL_ON_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_caltx_gain_set_0 */ -#define PHY_BB_CALTX_GAIN_SET_0_ADDRESS 0x0000a518 -#define PHY_BB_CALTX_GAIN_SET_0_OFFSET 0x0000a518 -#define PHY_BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_0_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_0_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_0_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_0_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_0_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_1_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_1_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_1_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_1_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_1_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_2 */ -#define PHY_BB_CALTX_GAIN_SET_2_ADDRESS 0x0000a51c -#define PHY_BB_CALTX_GAIN_SET_2_OFFSET 0x0000a51c -#define PHY_BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_2_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_2_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_2_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_2_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_2_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_3_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_3_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_3_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_3_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_3_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_4 */ -#define PHY_BB_CALTX_GAIN_SET_4_ADDRESS 0x0000a520 -#define PHY_BB_CALTX_GAIN_SET_4_OFFSET 0x0000a520 -#define PHY_BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_4_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_4_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_4_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_4_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_4_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_5_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_5_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_5_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_5_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_5_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_6 */ -#define PHY_BB_CALTX_GAIN_SET_6_ADDRESS 0x0000a524 -#define PHY_BB_CALTX_GAIN_SET_6_OFFSET 0x0000a524 -#define PHY_BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_6_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_6_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_6_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_6_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_6_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_7_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_7_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_7_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_7_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_7_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_8 */ -#define PHY_BB_CALTX_GAIN_SET_8_ADDRESS 0x0000a528 -#define PHY_BB_CALTX_GAIN_SET_8_OFFSET 0x0000a528 -#define PHY_BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_8_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_8_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_8_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_8_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_8_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_9_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_9_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_9_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_9_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_9_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_10 */ -#define PHY_BB_CALTX_GAIN_SET_10_ADDRESS 0x0000a52c -#define PHY_BB_CALTX_GAIN_SET_10_OFFSET 0x0000a52c -#define PHY_BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_10_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_10_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_10_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_10_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_10_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_11_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_11_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_11_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_11_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_11_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_12 */ -#define PHY_BB_CALTX_GAIN_SET_12_ADDRESS 0x0000a530 -#define PHY_BB_CALTX_GAIN_SET_12_OFFSET 0x0000a530 -#define PHY_BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_12_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_12_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_12_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_12_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_12_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_13_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_13_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_13_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_13_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_13_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_14 */ -#define PHY_BB_CALTX_GAIN_SET_14_ADDRESS 0x0000a534 -#define PHY_BB_CALTX_GAIN_SET_14_OFFSET 0x0000a534 -#define PHY_BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_14_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_14_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_14_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_14_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_14_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_15_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_15_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_15_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_15_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_15_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_16 */ -#define PHY_BB_CALTX_GAIN_SET_16_ADDRESS 0x0000a538 -#define PHY_BB_CALTX_GAIN_SET_16_OFFSET 0x0000a538 -#define PHY_BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_16_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_16_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_16_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_16_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_16_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_17_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_17_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_17_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_17_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_17_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_18 */ -#define PHY_BB_CALTX_GAIN_SET_18_ADDRESS 0x0000a53c -#define PHY_BB_CALTX_GAIN_SET_18_OFFSET 0x0000a53c -#define PHY_BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_18_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_18_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_18_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_18_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_18_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_19_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_19_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_19_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_19_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_19_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_20 */ -#define PHY_BB_CALTX_GAIN_SET_20_ADDRESS 0x0000a540 -#define PHY_BB_CALTX_GAIN_SET_20_OFFSET 0x0000a540 -#define PHY_BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_20_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_20_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_20_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_20_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_20_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_21_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_21_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_21_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_21_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_21_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_22 */ -#define PHY_BB_CALTX_GAIN_SET_22_ADDRESS 0x0000a544 -#define PHY_BB_CALTX_GAIN_SET_22_OFFSET 0x0000a544 -#define PHY_BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_22_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_22_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_22_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_22_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_22_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_23_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_23_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_23_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_23_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_23_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_24 */ -#define PHY_BB_CALTX_GAIN_SET_24_ADDRESS 0x0000a548 -#define PHY_BB_CALTX_GAIN_SET_24_OFFSET 0x0000a548 -#define PHY_BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_24_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_24_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_24_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_24_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_24_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_25_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_25_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_25_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_25_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_25_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_26 */ -#define PHY_BB_CALTX_GAIN_SET_26_ADDRESS 0x0000a54c -#define PHY_BB_CALTX_GAIN_SET_26_OFFSET 0x0000a54c -#define PHY_BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_26_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_26_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_26_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_26_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_26_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_27_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_27_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_27_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_27_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_27_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_28 */ -#define PHY_BB_CALTX_GAIN_SET_28_ADDRESS 0x0000a550 -#define PHY_BB_CALTX_GAIN_SET_28_OFFSET 0x0000a550 -#define PHY_BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_28_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_28_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_28_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_28_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_28_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_29_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_29_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_29_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_29_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_29_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_caltx_gain_set_30 */ -#define PHY_BB_CALTX_GAIN_SET_30_ADDRESS 0x0000a554 -#define PHY_BB_CALTX_GAIN_SET_30_OFFSET 0x0000a554 -#define PHY_BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_30_MSB 13 -#define PHY_BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_30_LSB 0 -#define PHY_BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_30_MASK 0x00003fff -#define PHY_BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_30_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_30_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_31_MSB 27 -#define PHY_BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_31_LSB 14 -#define PHY_BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_31_MASK 0x0fffc000 -#define PHY_BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_31_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_31_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_txiqcal_meas_b0 */ -#define PHY_BB_TXIQCAL_MEAS_B0_ADDRESS 0x0000a558 -#define PHY_BB_TXIQCAL_MEAS_B0_OFFSET 0x0000a558 -#define PHY_BB_TXIQCAL_MEAS_B0_TXIQC_MEAS_DATA0_0_MSB 11 -#define PHY_BB_TXIQCAL_MEAS_B0_TXIQC_MEAS_DATA0_0_LSB 0 -#define PHY_BB_TXIQCAL_MEAS_B0_TXIQC_MEAS_DATA0_0_MASK 0x00000fff -#define PHY_BB_TXIQCAL_MEAS_B0_TXIQC_MEAS_DATA0_0_GET(x) (((x) & 0x00000fff) >> 0) -#define PHY_BB_TXIQCAL_MEAS_B0_TXIQC_MEAS_DATA1_0_MSB 23 -#define PHY_BB_TXIQCAL_MEAS_B0_TXIQC_MEAS_DATA1_0_LSB 12 -#define PHY_BB_TXIQCAL_MEAS_B0_TXIQC_MEAS_DATA1_0_MASK 0x00fff000 -#define PHY_BB_TXIQCAL_MEAS_B0_TXIQC_MEAS_DATA1_0_GET(x) (((x) & 0x00fff000) >> 12) - -/* macros for BB_txiqcal_start */ -#define PHY_BB_TXIQCAL_START_ADDRESS 0x0000a6d8 -#define PHY_BB_TXIQCAL_START_OFFSET 0x0000a6d8 -#define PHY_BB_TXIQCAL_START_DO_TX_IQCAL_MSB 0 -#define PHY_BB_TXIQCAL_START_DO_TX_IQCAL_LSB 0 -#define PHY_BB_TXIQCAL_START_DO_TX_IQCAL_MASK 0x00000001 -#define PHY_BB_TXIQCAL_START_DO_TX_IQCAL_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_TXIQCAL_START_DO_TX_IQCAL_SET(x) (((x) << 0) & 0x00000001) - -/* macros for BB_txiqcal_control_0 */ -#define PHY_BB_TXIQCAL_CONTROL_0_ADDRESS 0x0000a6dc -#define PHY_BB_TXIQCAL_CONTROL_0_OFFSET 0x0000a6dc -#define PHY_BB_TXIQCAL_CONTROL_0_IQC_TX_TABLE_SEL_MSB 0 -#define PHY_BB_TXIQCAL_CONTROL_0_IQC_TX_TABLE_SEL_LSB 0 -#define PHY_BB_TXIQCAL_CONTROL_0_IQC_TX_TABLE_SEL_MASK 0x00000001 -#define PHY_BB_TXIQCAL_CONTROL_0_IQC_TX_TABLE_SEL_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_TXIQCAL_CONTROL_0_IQC_TX_TABLE_SEL_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_TXIQCAL_CONTROL_0_BASE_TX_TONE_DB_MSB 6 -#define PHY_BB_TXIQCAL_CONTROL_0_BASE_TX_TONE_DB_LSB 1 -#define PHY_BB_TXIQCAL_CONTROL_0_BASE_TX_TONE_DB_MASK 0x0000007e -#define PHY_BB_TXIQCAL_CONTROL_0_BASE_TX_TONE_DB_GET(x) (((x) & 0x0000007e) >> 1) -#define PHY_BB_TXIQCAL_CONTROL_0_BASE_TX_TONE_DB_SET(x) (((x) << 1) & 0x0000007e) -#define PHY_BB_TXIQCAL_CONTROL_0_MAX_TX_TONE_GAIN_MSB 12 -#define PHY_BB_TXIQCAL_CONTROL_0_MAX_TX_TONE_GAIN_LSB 7 -#define PHY_BB_TXIQCAL_CONTROL_0_MAX_TX_TONE_GAIN_MASK 0x00001f80 -#define PHY_BB_TXIQCAL_CONTROL_0_MAX_TX_TONE_GAIN_GET(x) (((x) & 0x00001f80) >> 7) -#define PHY_BB_TXIQCAL_CONTROL_0_MAX_TX_TONE_GAIN_SET(x) (((x) << 7) & 0x00001f80) -#define PHY_BB_TXIQCAL_CONTROL_0_MIN_TX_TONE_GAIN_MSB 18 -#define PHY_BB_TXIQCAL_CONTROL_0_MIN_TX_TONE_GAIN_LSB 13 -#define PHY_BB_TXIQCAL_CONTROL_0_MIN_TX_TONE_GAIN_MASK 0x0007e000 -#define PHY_BB_TXIQCAL_CONTROL_0_MIN_TX_TONE_GAIN_GET(x) (((x) & 0x0007e000) >> 13) -#define PHY_BB_TXIQCAL_CONTROL_0_MIN_TX_TONE_GAIN_SET(x) (((x) << 13) & 0x0007e000) -#define PHY_BB_TXIQCAL_CONTROL_0_CALTXSHIFT_DELAY_MSB 22 -#define PHY_BB_TXIQCAL_CONTROL_0_CALTXSHIFT_DELAY_LSB 19 -#define PHY_BB_TXIQCAL_CONTROL_0_CALTXSHIFT_DELAY_MASK 0x00780000 -#define PHY_BB_TXIQCAL_CONTROL_0_CALTXSHIFT_DELAY_GET(x) (((x) & 0x00780000) >> 19) -#define PHY_BB_TXIQCAL_CONTROL_0_CALTXSHIFT_DELAY_SET(x) (((x) << 19) & 0x00780000) -#define PHY_BB_TXIQCAL_CONTROL_0_LOOPBACK_DELAY_MSB 29 -#define PHY_BB_TXIQCAL_CONTROL_0_LOOPBACK_DELAY_LSB 23 -#define PHY_BB_TXIQCAL_CONTROL_0_LOOPBACK_DELAY_MASK 0x3f800000 -#define PHY_BB_TXIQCAL_CONTROL_0_LOOPBACK_DELAY_GET(x) (((x) & 0x3f800000) >> 23) -#define PHY_BB_TXIQCAL_CONTROL_0_LOOPBACK_DELAY_SET(x) (((x) << 23) & 0x3f800000) - -/* macros for BB_txiqcal_control_1 */ -#define PHY_BB_TXIQCAL_CONTROL_1_ADDRESS 0x0000a6e0 -#define PHY_BB_TXIQCAL_CONTROL_1_OFFSET 0x0000a6e0 -#define PHY_BB_TXIQCAL_CONTROL_1_RX_INIT_GAIN_DB_MSB 5 -#define PHY_BB_TXIQCAL_CONTROL_1_RX_INIT_GAIN_DB_LSB 0 -#define PHY_BB_TXIQCAL_CONTROL_1_RX_INIT_GAIN_DB_MASK 0x0000003f -#define PHY_BB_TXIQCAL_CONTROL_1_RX_INIT_GAIN_DB_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_TXIQCAL_CONTROL_1_RX_INIT_GAIN_DB_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_TXIQCAL_CONTROL_1_MAX_RX_GAIN_DB_MSB 11 -#define PHY_BB_TXIQCAL_CONTROL_1_MAX_RX_GAIN_DB_LSB 6 -#define PHY_BB_TXIQCAL_CONTROL_1_MAX_RX_GAIN_DB_MASK 0x00000fc0 -#define PHY_BB_TXIQCAL_CONTROL_1_MAX_RX_GAIN_DB_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_TXIQCAL_CONTROL_1_MAX_RX_GAIN_DB_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_TXIQCAL_CONTROL_1_MIN_RX_GAIN_DB_MSB 17 -#define PHY_BB_TXIQCAL_CONTROL_1_MIN_RX_GAIN_DB_LSB 12 -#define PHY_BB_TXIQCAL_CONTROL_1_MIN_RX_GAIN_DB_MASK 0x0003f000 -#define PHY_BB_TXIQCAL_CONTROL_1_MIN_RX_GAIN_DB_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_BB_TXIQCAL_CONTROL_1_MIN_RX_GAIN_DB_SET(x) (((x) << 12) & 0x0003f000) -#define PHY_BB_TXIQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_MSB 24 -#define PHY_BB_TXIQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_LSB 18 -#define PHY_BB_TXIQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_MASK 0x01fc0000 -#define PHY_BB_TXIQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_GET(x) (((x) & 0x01fc0000) >> 18) -#define PHY_BB_TXIQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_SET(x) (((x) << 18) & 0x01fc0000) - -/* macros for BB_txiqcal_control_2 */ -#define PHY_BB_TXIQCAL_CONTROL_2_ADDRESS 0x0000a6e4 -#define PHY_BB_TXIQCAL_CONTROL_2_OFFSET 0x0000a6e4 -#define PHY_BB_TXIQCAL_CONTROL_2_IQC_FORCED_PAGAIN_MSB 3 -#define PHY_BB_TXIQCAL_CONTROL_2_IQC_FORCED_PAGAIN_LSB 0 -#define PHY_BB_TXIQCAL_CONTROL_2_IQC_FORCED_PAGAIN_MASK 0x0000000f -#define PHY_BB_TXIQCAL_CONTROL_2_IQC_FORCED_PAGAIN_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_BB_TXIQCAL_CONTROL_2_IQC_FORCED_PAGAIN_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_BB_TXIQCAL_CONTROL_2_IQCAL_MIN_TX_GAIN_MSB 8 -#define PHY_BB_TXIQCAL_CONTROL_2_IQCAL_MIN_TX_GAIN_LSB 4 -#define PHY_BB_TXIQCAL_CONTROL_2_IQCAL_MIN_TX_GAIN_MASK 0x000001f0 -#define PHY_BB_TXIQCAL_CONTROL_2_IQCAL_MIN_TX_GAIN_GET(x) (((x) & 0x000001f0) >> 4) -#define PHY_BB_TXIQCAL_CONTROL_2_IQCAL_MIN_TX_GAIN_SET(x) (((x) << 4) & 0x000001f0) -#define PHY_BB_TXIQCAL_CONTROL_2_IQCAL_MAX_TX_GAIN_MSB 13 -#define PHY_BB_TXIQCAL_CONTROL_2_IQCAL_MAX_TX_GAIN_LSB 9 -#define PHY_BB_TXIQCAL_CONTROL_2_IQCAL_MAX_TX_GAIN_MASK 0x00003e00 -#define PHY_BB_TXIQCAL_CONTROL_2_IQCAL_MAX_TX_GAIN_GET(x) (((x) & 0x00003e00) >> 9) -#define PHY_BB_TXIQCAL_CONTROL_2_IQCAL_MAX_TX_GAIN_SET(x) (((x) << 9) & 0x00003e00) - -/* macros for BB_txiqcal_control_3 */ -#define PHY_BB_TXIQCAL_CONTROL_3_ADDRESS 0x0000a6e8 -#define PHY_BB_TXIQCAL_CONTROL_3_OFFSET 0x0000a6e8 -#define PHY_BB_TXIQCAL_CONTROL_3_PWR_HIGH_DB_MSB 5 -#define PHY_BB_TXIQCAL_CONTROL_3_PWR_HIGH_DB_LSB 0 -#define PHY_BB_TXIQCAL_CONTROL_3_PWR_HIGH_DB_MASK 0x0000003f -#define PHY_BB_TXIQCAL_CONTROL_3_PWR_HIGH_DB_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_TXIQCAL_CONTROL_3_PWR_HIGH_DB_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_TXIQCAL_CONTROL_3_PWR_LOW_DB_MSB 11 -#define PHY_BB_TXIQCAL_CONTROL_3_PWR_LOW_DB_LSB 6 -#define PHY_BB_TXIQCAL_CONTROL_3_PWR_LOW_DB_MASK 0x00000fc0 -#define PHY_BB_TXIQCAL_CONTROL_3_PWR_LOW_DB_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_TXIQCAL_CONTROL_3_PWR_LOW_DB_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_TXIQCAL_CONTROL_3_IQCAL_TONE_PHS_STEP_MSB 21 -#define PHY_BB_TXIQCAL_CONTROL_3_IQCAL_TONE_PHS_STEP_LSB 12 -#define PHY_BB_TXIQCAL_CONTROL_3_IQCAL_TONE_PHS_STEP_MASK 0x003ff000 -#define PHY_BB_TXIQCAL_CONTROL_3_IQCAL_TONE_PHS_STEP_GET(x) (((x) & 0x003ff000) >> 12) -#define PHY_BB_TXIQCAL_CONTROL_3_IQCAL_TONE_PHS_STEP_SET(x) (((x) << 12) & 0x003ff000) -#define PHY_BB_TXIQCAL_CONTROL_3_DC_EST_LEN_MSB 23 -#define PHY_BB_TXIQCAL_CONTROL_3_DC_EST_LEN_LSB 22 -#define PHY_BB_TXIQCAL_CONTROL_3_DC_EST_LEN_MASK 0x00c00000 -#define PHY_BB_TXIQCAL_CONTROL_3_DC_EST_LEN_GET(x) (((x) & 0x00c00000) >> 22) -#define PHY_BB_TXIQCAL_CONTROL_3_DC_EST_LEN_SET(x) (((x) << 22) & 0x00c00000) -#define PHY_BB_TXIQCAL_CONTROL_3_ADC_SAT_LEN_MSB 24 -#define PHY_BB_TXIQCAL_CONTROL_3_ADC_SAT_LEN_LSB 24 -#define PHY_BB_TXIQCAL_CONTROL_3_ADC_SAT_LEN_MASK 0x01000000 -#define PHY_BB_TXIQCAL_CONTROL_3_ADC_SAT_LEN_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_BB_TXIQCAL_CONTROL_3_ADC_SAT_LEN_SET(x) (((x) << 24) & 0x01000000) -#define PHY_BB_TXIQCAL_CONTROL_3_ADC_SAT_SEL_MSB 26 -#define PHY_BB_TXIQCAL_CONTROL_3_ADC_SAT_SEL_LSB 25 -#define PHY_BB_TXIQCAL_CONTROL_3_ADC_SAT_SEL_MASK 0x06000000 -#define PHY_BB_TXIQCAL_CONTROL_3_ADC_SAT_SEL_GET(x) (((x) & 0x06000000) >> 25) -#define PHY_BB_TXIQCAL_CONTROL_3_ADC_SAT_SEL_SET(x) (((x) << 25) & 0x06000000) -#define PHY_BB_TXIQCAL_CONTROL_3_IQCAL_MEAS_LEN_MSB 28 -#define PHY_BB_TXIQCAL_CONTROL_3_IQCAL_MEAS_LEN_LSB 27 -#define PHY_BB_TXIQCAL_CONTROL_3_IQCAL_MEAS_LEN_MASK 0x18000000 -#define PHY_BB_TXIQCAL_CONTROL_3_IQCAL_MEAS_LEN_GET(x) (((x) & 0x18000000) >> 27) -#define PHY_BB_TXIQCAL_CONTROL_3_IQCAL_MEAS_LEN_SET(x) (((x) << 27) & 0x18000000) -#define PHY_BB_TXIQCAL_CONTROL_3_DESIRED_SIZE_DB_MSB 30 -#define PHY_BB_TXIQCAL_CONTROL_3_DESIRED_SIZE_DB_LSB 29 -#define PHY_BB_TXIQCAL_CONTROL_3_DESIRED_SIZE_DB_MASK 0x60000000 -#define PHY_BB_TXIQCAL_CONTROL_3_DESIRED_SIZE_DB_GET(x) (((x) & 0x60000000) >> 29) -#define PHY_BB_TXIQCAL_CONTROL_3_DESIRED_SIZE_DB_SET(x) (((x) << 29) & 0x60000000) -#define PHY_BB_TXIQCAL_CONTROL_3_TX_IQCORR_EN_MSB 31 -#define PHY_BB_TXIQCAL_CONTROL_3_TX_IQCORR_EN_LSB 31 -#define PHY_BB_TXIQCAL_CONTROL_3_TX_IQCORR_EN_MASK 0x80000000 -#define PHY_BB_TXIQCAL_CONTROL_3_TX_IQCORR_EN_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_BB_TXIQCAL_CONTROL_3_TX_IQCORR_EN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB_txiq_corr_coeff_01_b0 */ -#define PHY_BB_TXIQ_CORR_COEFF_01_B0_ADDRESS 0x0000a6ec -#define PHY_BB_TXIQ_CORR_COEFF_01_B0_OFFSET 0x0000a6ec -#define PHY_BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_0_0_MSB 13 -#define PHY_BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_0_0_LSB 0 -#define PHY_BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_0_0_MASK 0x00003fff -#define PHY_BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_0_0_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_0_0_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_1_0_MSB 27 -#define PHY_BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_1_0_LSB 14 -#define PHY_BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_1_0_MASK 0x0fffc000 -#define PHY_BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_1_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_1_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_txiq_corr_coeff_23_b0 */ -#define PHY_BB_TXIQ_CORR_COEFF_23_B0_ADDRESS 0x0000a6f0 -#define PHY_BB_TXIQ_CORR_COEFF_23_B0_OFFSET 0x0000a6f0 -#define PHY_BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_2_0_MSB 13 -#define PHY_BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_2_0_LSB 0 -#define PHY_BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_2_0_MASK 0x00003fff -#define PHY_BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_2_0_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_2_0_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_3_0_MSB 27 -#define PHY_BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_3_0_LSB 14 -#define PHY_BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_3_0_MASK 0x0fffc000 -#define PHY_BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_3_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_3_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_txiq_corr_coeff_45_b0 */ -#define PHY_BB_TXIQ_CORR_COEFF_45_B0_ADDRESS 0x0000a6f4 -#define PHY_BB_TXIQ_CORR_COEFF_45_B0_OFFSET 0x0000a6f4 -#define PHY_BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_4_0_MSB 13 -#define PHY_BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_4_0_LSB 0 -#define PHY_BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_4_0_MASK 0x00003fff -#define PHY_BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_4_0_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_4_0_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_5_0_MSB 27 -#define PHY_BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_5_0_LSB 14 -#define PHY_BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_5_0_MASK 0x0fffc000 -#define PHY_BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_5_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_5_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_txiq_corr_coeff_67_b0 */ -#define PHY_BB_TXIQ_CORR_COEFF_67_B0_ADDRESS 0x0000a6f8 -#define PHY_BB_TXIQ_CORR_COEFF_67_B0_OFFSET 0x0000a6f8 -#define PHY_BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_6_0_MSB 13 -#define PHY_BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_6_0_LSB 0 -#define PHY_BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_6_0_MASK 0x00003fff -#define PHY_BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_6_0_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_6_0_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_7_0_MSB 27 -#define PHY_BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_7_0_LSB 14 -#define PHY_BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_7_0_MASK 0x0fffc000 -#define PHY_BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_7_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_7_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_txiq_corr_coeff_89_b0 */ -#define PHY_BB_TXIQ_CORR_COEFF_89_B0_ADDRESS 0x0000a6fc -#define PHY_BB_TXIQ_CORR_COEFF_89_B0_OFFSET 0x0000a6fc -#define PHY_BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_8_0_MSB 13 -#define PHY_BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_8_0_LSB 0 -#define PHY_BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_8_0_MASK 0x00003fff -#define PHY_BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_8_0_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_8_0_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_9_0_MSB 27 -#define PHY_BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_9_0_LSB 14 -#define PHY_BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_9_0_MASK 0x0fffc000 -#define PHY_BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_9_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_9_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_txiq_corr_coeff_ab_b0 */ -#define PHY_BB_TXIQ_CORR_COEFF_AB_B0_ADDRESS 0x0000a700 -#define PHY_BB_TXIQ_CORR_COEFF_AB_B0_OFFSET 0x0000a700 -#define PHY_BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_A_0_MSB 13 -#define PHY_BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_A_0_LSB 0 -#define PHY_BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_A_0_MASK 0x00003fff -#define PHY_BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_A_0_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_A_0_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_B_0_MSB 27 -#define PHY_BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_B_0_LSB 14 -#define PHY_BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_B_0_MASK 0x0fffc000 -#define PHY_BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_B_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_B_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_txiq_corr_coeff_cd_b0 */ -#define PHY_BB_TXIQ_CORR_COEFF_CD_B0_ADDRESS 0x0000a704 -#define PHY_BB_TXIQ_CORR_COEFF_CD_B0_OFFSET 0x0000a704 -#define PHY_BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_C_0_MSB 13 -#define PHY_BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_C_0_LSB 0 -#define PHY_BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_C_0_MASK 0x00003fff -#define PHY_BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_C_0_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_C_0_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_D_0_MSB 27 -#define PHY_BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_D_0_LSB 14 -#define PHY_BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_D_0_MASK 0x0fffc000 -#define PHY_BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_D_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_D_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_txiq_corr_coeff_ef_b0 */ -#define PHY_BB_TXIQ_CORR_COEFF_EF_B0_ADDRESS 0x0000a708 -#define PHY_BB_TXIQ_CORR_COEFF_EF_B0_OFFSET 0x0000a708 -#define PHY_BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_E_0_MSB 13 -#define PHY_BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_E_0_LSB 0 -#define PHY_BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_E_0_MASK 0x00003fff -#define PHY_BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_E_0_GET(x) (((x) & 0x00003fff) >> 0) -#define PHY_BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_E_0_SET(x) (((x) << 0) & 0x00003fff) -#define PHY_BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_F_0_MSB 27 -#define PHY_BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_F_0_LSB 14 -#define PHY_BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_F_0_MASK 0x0fffc000 -#define PHY_BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_F_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define PHY_BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_F_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for BB_cal_rxbb_gain_tbl_0 */ -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_ADDRESS 0x0000a70c -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_OFFSET 0x0000a70c -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_0_MSB 5 -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_0_LSB 0 -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_0_MASK 0x0000003f -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_0_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_0_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_1_MSB 11 -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_1_LSB 6 -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_1_MASK 0x00000fc0 -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_1_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_1_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_2_MSB 17 -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_2_LSB 12 -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_2_MASK 0x0003f000 -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_2_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_2_SET(x) (((x) << 12) & 0x0003f000) -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_3_MSB 23 -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_3_LSB 18 -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_3_MASK 0x00fc0000 -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_3_GET(x) (((x) & 0x00fc0000) >> 18) -#define PHY_BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_3_SET(x) (((x) << 18) & 0x00fc0000) - -/* macros for BB_cal_rxbb_gain_tbl_4 */ -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_ADDRESS 0x0000a710 -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_OFFSET 0x0000a710 -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_4_MSB 5 -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_4_LSB 0 -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_4_MASK 0x0000003f -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_4_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_4_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_5_MSB 11 -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_5_LSB 6 -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_5_MASK 0x00000fc0 -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_5_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_5_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_6_MSB 17 -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_6_LSB 12 -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_6_MASK 0x0003f000 -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_6_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_6_SET(x) (((x) << 12) & 0x0003f000) -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_7_MSB 23 -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_7_LSB 18 -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_7_MASK 0x00fc0000 -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_7_GET(x) (((x) & 0x00fc0000) >> 18) -#define PHY_BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_7_SET(x) (((x) << 18) & 0x00fc0000) - -/* macros for BB_cal_rxbb_gain_tbl_8 */ -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_ADDRESS 0x0000a714 -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_OFFSET 0x0000a714 -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_8_MSB 5 -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_8_LSB 0 -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_8_MASK 0x0000003f -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_8_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_8_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_9_MSB 11 -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_9_LSB 6 -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_9_MASK 0x00000fc0 -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_9_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_9_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_10_MSB 17 -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_10_LSB 12 -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_10_MASK 0x0003f000 -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_10_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_10_SET(x) (((x) << 12) & 0x0003f000) -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_11_MSB 23 -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_11_LSB 18 -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_11_MASK 0x00fc0000 -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_11_GET(x) (((x) & 0x00fc0000) >> 18) -#define PHY_BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_11_SET(x) (((x) << 18) & 0x00fc0000) - -/* macros for BB_cal_rxbb_gain_tbl_12 */ -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_ADDRESS 0x0000a718 -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_OFFSET 0x0000a718 -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_12_MSB 5 -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_12_LSB 0 -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_12_MASK 0x0000003f -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_12_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_12_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_13_MSB 11 -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_13_LSB 6 -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_13_MASK 0x00000fc0 -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_13_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_13_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_14_MSB 17 -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_14_LSB 12 -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_14_MASK 0x0003f000 -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_14_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_14_SET(x) (((x) << 12) & 0x0003f000) -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_15_MSB 23 -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_15_LSB 18 -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_15_MASK 0x00fc0000 -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_15_GET(x) (((x) & 0x00fc0000) >> 18) -#define PHY_BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_15_SET(x) (((x) << 18) & 0x00fc0000) - -/* macros for BB_cal_rxbb_gain_tbl_16 */ -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_ADDRESS 0x0000a71c -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_OFFSET 0x0000a71c -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_16_MSB 5 -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_16_LSB 0 -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_16_MASK 0x0000003f -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_16_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_16_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_17_MSB 11 -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_17_LSB 6 -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_17_MASK 0x00000fc0 -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_17_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_17_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_18_MSB 17 -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_18_LSB 12 -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_18_MASK 0x0003f000 -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_18_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_18_SET(x) (((x) << 12) & 0x0003f000) -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_19_MSB 23 -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_19_LSB 18 -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_19_MASK 0x00fc0000 -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_19_GET(x) (((x) & 0x00fc0000) >> 18) -#define PHY_BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_19_SET(x) (((x) << 18) & 0x00fc0000) - -/* macros for BB_cal_rxbb_gain_tbl_20 */ -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_ADDRESS 0x0000a720 -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_OFFSET 0x0000a720 -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_20_MSB 5 -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_20_LSB 0 -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_20_MASK 0x0000003f -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_20_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_20_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_21_MSB 11 -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_21_LSB 6 -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_21_MASK 0x00000fc0 -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_21_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_21_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_22_MSB 17 -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_22_LSB 12 -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_22_MASK 0x0003f000 -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_22_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_22_SET(x) (((x) << 12) & 0x0003f000) -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_23_MSB 23 -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_23_LSB 18 -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_23_MASK 0x00fc0000 -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_23_GET(x) (((x) & 0x00fc0000) >> 18) -#define PHY_BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_23_SET(x) (((x) << 18) & 0x00fc0000) - -/* macros for BB_cal_rxbb_gain_tbl_24 */ -#define PHY_BB_CAL_RXBB_GAIN_TBL_24_ADDRESS 0x0000a724 -#define PHY_BB_CAL_RXBB_GAIN_TBL_24_OFFSET 0x0000a724 -#define PHY_BB_CAL_RXBB_GAIN_TBL_24_TXCAL_RX_BB_GAIN_TABLE_24_MSB 5 -#define PHY_BB_CAL_RXBB_GAIN_TBL_24_TXCAL_RX_BB_GAIN_TABLE_24_LSB 0 -#define PHY_BB_CAL_RXBB_GAIN_TBL_24_TXCAL_RX_BB_GAIN_TABLE_24_MASK 0x0000003f -#define PHY_BB_CAL_RXBB_GAIN_TBL_24_TXCAL_RX_BB_GAIN_TABLE_24_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_CAL_RXBB_GAIN_TBL_24_TXCAL_RX_BB_GAIN_TABLE_24_SET(x) (((x) << 0) & 0x0000003f) - -/* macros for BB_txiqcal_status_b0 */ -#define PHY_BB_TXIQCAL_STATUS_B0_ADDRESS 0x0000a728 -#define PHY_BB_TXIQCAL_STATUS_B0_OFFSET 0x0000a728 -#define PHY_BB_TXIQCAL_STATUS_B0_TXIQCAL_FAILED_0_MSB 0 -#define PHY_BB_TXIQCAL_STATUS_B0_TXIQCAL_FAILED_0_LSB 0 -#define PHY_BB_TXIQCAL_STATUS_B0_TXIQCAL_FAILED_0_MASK 0x00000001 -#define PHY_BB_TXIQCAL_STATUS_B0_TXIQCAL_FAILED_0_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_TXIQCAL_STATUS_B0_CALIBRATED_GAINS_0_MSB 5 -#define PHY_BB_TXIQCAL_STATUS_B0_CALIBRATED_GAINS_0_LSB 1 -#define PHY_BB_TXIQCAL_STATUS_B0_CALIBRATED_GAINS_0_MASK 0x0000003e -#define PHY_BB_TXIQCAL_STATUS_B0_CALIBRATED_GAINS_0_GET(x) (((x) & 0x0000003e) >> 1) -#define PHY_BB_TXIQCAL_STATUS_B0_TONE_GAIN_USED_0_MSB 11 -#define PHY_BB_TXIQCAL_STATUS_B0_TONE_GAIN_USED_0_LSB 6 -#define PHY_BB_TXIQCAL_STATUS_B0_TONE_GAIN_USED_0_MASK 0x00000fc0 -#define PHY_BB_TXIQCAL_STATUS_B0_TONE_GAIN_USED_0_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_TXIQCAL_STATUS_B0_RX_GAIN_USED_0_MSB 17 -#define PHY_BB_TXIQCAL_STATUS_B0_RX_GAIN_USED_0_LSB 12 -#define PHY_BB_TXIQCAL_STATUS_B0_RX_GAIN_USED_0_MASK 0x0003f000 -#define PHY_BB_TXIQCAL_STATUS_B0_RX_GAIN_USED_0_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_BB_TXIQCAL_STATUS_B0_LAST_MEAS_ADDR_0_MSB 24 -#define PHY_BB_TXIQCAL_STATUS_B0_LAST_MEAS_ADDR_0_LSB 18 -#define PHY_BB_TXIQCAL_STATUS_B0_LAST_MEAS_ADDR_0_MASK 0x01fc0000 -#define PHY_BB_TXIQCAL_STATUS_B0_LAST_MEAS_ADDR_0_GET(x) (((x) & 0x01fc0000) >> 18) - -/* macros for BB_paprd_trainer_cntl1 */ -#define PHY_BB_PAPRD_TRAINER_CNTL1_ADDRESS 0x0000a72c -#define PHY_BB_PAPRD_TRAINER_CNTL1_OFFSET 0x0000a72c -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TRAIN_ENABLE_MSB 0 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TRAIN_ENABLE_LSB 0 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TRAIN_ENABLE_MASK 0x00000001 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TRAIN_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TRAIN_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING_MSB 7 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING_LSB 1 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING_MASK 0x000000fe -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING_GET(x) (((x) & 0x000000fe) >> 1) -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING_SET(x) (((x) << 1) & 0x000000fe) -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE_MSB 8 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE_LSB 8 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE_MASK 0x00000100 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE_SET(x) (((x) << 8) & 0x00000100) -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE_MSB 9 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE_LSB 9 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE_MASK 0x00000200 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE_SET(x) (((x) << 9) & 0x00000200) -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE_MSB 10 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE_LSB 10 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE_MASK 0x00000400 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE_SET(x) (((x) << 10) & 0x00000400) -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE_MSB 11 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE_LSB 11 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE_MASK 0x00000800 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE_SET(x) (((x) << 11) & 0x00000800) -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_MSB 18 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_LSB 12 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_MASK 0x0007f000 -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_GET(x) (((x) & 0x0007f000) >> 12) -#define PHY_BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_SET(x) (((x) << 12) & 0x0007f000) - -/* macros for BB_paprd_trainer_cntl2 */ -#define PHY_BB_PAPRD_TRAINER_CNTL2_ADDRESS 0x0000a730 -#define PHY_BB_PAPRD_TRAINER_CNTL2_OFFSET 0x0000a730 -#define PHY_BB_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_MSB 31 -#define PHY_BB_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_LSB 0 -#define PHY_BB_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_MASK 0xffffffff -#define PHY_BB_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_BB_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_paprd_trainer_cntl3 */ -#define PHY_BB_PAPRD_TRAINER_CNTL3_ADDRESS 0x0000a734 -#define PHY_BB_PAPRD_TRAINER_CNTL3_OFFSET 0x0000a734 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_MSB 5 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_LSB 0 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_MASK 0x0000003f -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP_MSB 11 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP_LSB 6 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP_MASK 0x00000fc0 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL_MSB 16 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL_LSB 12 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL_MASK 0x0001f000 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES_MSB 19 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES_LSB 17 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES_MASK 0x000e0000 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN_MSB 23 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN_LSB 20 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN_MASK 0x00f00000 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN_GET(x) (((x) & 0x00f00000) >> 20) -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN_SET(x) (((x) << 20) & 0x00f00000) -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN_MSB 27 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN_LSB 24 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN_MASK 0x0f000000 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN_GET(x) (((x) & 0x0f000000) >> 24) -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN_SET(x) (((x) << 24) & 0x0f000000) -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_MSB 28 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_LSB 28 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_MASK 0x10000000 -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_SET(x) (((x) << 28) & 0x10000000) - -/* macros for BB_paprd_trainer_cntl4 */ -#define PHY_BB_PAPRD_TRAINER_CNTL4_ADDRESS 0x0000a738 -#define PHY_BB_PAPRD_TRAINER_CNTL4_OFFSET 0x0000a738 -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR_MSB 11 -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR_LSB 0 -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR_MASK 0x00000fff -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR_GET(x) (((x) & 0x00000fff) >> 0) -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR_SET(x) (((x) << 0) & 0x00000fff) -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA_MSB 15 -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA_LSB 12 -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA_MASK 0x0000f000 -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA_GET(x) (((x) & 0x0000f000) >> 12) -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA_SET(x) (((x) << 12) & 0x0000f000) -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_MSB 25 -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_LSB 16 -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_MASK 0x03ff0000 -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_GET(x) (((x) & 0x03ff0000) >> 16) -#define PHY_BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_SET(x) (((x) << 16) & 0x03ff0000) - -/* macros for BB_paprd_trainer_stat1 */ -#define PHY_BB_PAPRD_TRAINER_STAT1_ADDRESS 0x0000a73c -#define PHY_BB_PAPRD_TRAINER_STAT1_OFFSET 0x0000a73c -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE_MSB 0 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE_LSB 0 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE_MASK 0x00000001 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_INCOMPLETE_MSB 1 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_INCOMPLETE_LSB 1 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_INCOMPLETE_MASK 0x00000002 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_INCOMPLETE_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_CORR_ERR_MSB 2 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_CORR_ERR_LSB 2 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_CORR_ERR_MASK 0x00000004 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_CORR_ERR_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_ACTIVE_MSB 3 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_ACTIVE_LSB 3 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_ACTIVE_MASK 0x00000008 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_ACTIVE_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_RX_GAIN_IDX_MSB 8 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_RX_GAIN_IDX_LSB 4 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_RX_GAIN_IDX_MASK 0x000001f0 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_RX_GAIN_IDX_GET(x) (((x) & 0x000001f0) >> 4) -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR_MSB 16 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR_LSB 9 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR_MASK 0x0001fe00 -#define PHY_BB_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR_GET(x) (((x) & 0x0001fe00) >> 9) - -/* macros for BB_paprd_trainer_stat2 */ -#define PHY_BB_PAPRD_TRAINER_STAT2_ADDRESS 0x0000a740 -#define PHY_BB_PAPRD_TRAINER_STAT2_OFFSET 0x0000a740 -#define PHY_BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL_MSB 15 -#define PHY_BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL_LSB 0 -#define PHY_BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL_MASK 0x0000ffff -#define PHY_BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL_GET(x) (((x) & 0x0000ffff) >> 0) -#define PHY_BB_PAPRD_TRAINER_STAT2_PAPRD_COARSE_IDX_MSB 20 -#define PHY_BB_PAPRD_TRAINER_STAT2_PAPRD_COARSE_IDX_LSB 16 -#define PHY_BB_PAPRD_TRAINER_STAT2_PAPRD_COARSE_IDX_MASK 0x001f0000 -#define PHY_BB_PAPRD_TRAINER_STAT2_PAPRD_COARSE_IDX_GET(x) (((x) & 0x001f0000) >> 16) -#define PHY_BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX_MSB 22 -#define PHY_BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX_LSB 21 -#define PHY_BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX_MASK 0x00600000 -#define PHY_BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX_GET(x) (((x) & 0x00600000) >> 21) - -/* macros for BB_paprd_trainer_stat3 */ -#define PHY_BB_PAPRD_TRAINER_STAT3_ADDRESS 0x0000a744 -#define PHY_BB_PAPRD_TRAINER_STAT3_OFFSET 0x0000a744 -#define PHY_BB_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT_MSB 19 -#define PHY_BB_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT_LSB 0 -#define PHY_BB_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT_MASK 0x000fffff -#define PHY_BB_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT_GET(x) (((x) & 0x000fffff) >> 0) - -/* macros for BB_fcal_1 */ -#define PHY_BB_FCAL_1_ADDRESS 0x0000a7d8 -#define PHY_BB_FCAL_1_OFFSET 0x0000a7d8 -#define PHY_BB_FCAL_1_FLC_PB_FSTEP_MSB 9 -#define PHY_BB_FCAL_1_FLC_PB_FSTEP_LSB 0 -#define PHY_BB_FCAL_1_FLC_PB_FSTEP_MASK 0x000003ff -#define PHY_BB_FCAL_1_FLC_PB_FSTEP_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_BB_FCAL_1_FLC_PB_FSTEP_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_BB_FCAL_1_FLC_SB_FSTEP_MSB 19 -#define PHY_BB_FCAL_1_FLC_SB_FSTEP_LSB 10 -#define PHY_BB_FCAL_1_FLC_SB_FSTEP_MASK 0x000ffc00 -#define PHY_BB_FCAL_1_FLC_SB_FSTEP_GET(x) (((x) & 0x000ffc00) >> 10) -#define PHY_BB_FCAL_1_FLC_SB_FSTEP_SET(x) (((x) << 10) & 0x000ffc00) -#define PHY_BB_FCAL_1_FLC_PB_ATTEN_MSB 24 -#define PHY_BB_FCAL_1_FLC_PB_ATTEN_LSB 20 -#define PHY_BB_FCAL_1_FLC_PB_ATTEN_MASK 0x01f00000 -#define PHY_BB_FCAL_1_FLC_PB_ATTEN_GET(x) (((x) & 0x01f00000) >> 20) -#define PHY_BB_FCAL_1_FLC_PB_ATTEN_SET(x) (((x) << 20) & 0x01f00000) -#define PHY_BB_FCAL_1_FLC_SB_ATTEN_MSB 29 -#define PHY_BB_FCAL_1_FLC_SB_ATTEN_LSB 25 -#define PHY_BB_FCAL_1_FLC_SB_ATTEN_MASK 0x3e000000 -#define PHY_BB_FCAL_1_FLC_SB_ATTEN_GET(x) (((x) & 0x3e000000) >> 25) -#define PHY_BB_FCAL_1_FLC_SB_ATTEN_SET(x) (((x) << 25) & 0x3e000000) - -/* macros for BB_fcal_2_b0 */ -#define PHY_BB_FCAL_2_B0_ADDRESS 0x0000a7dc -#define PHY_BB_FCAL_2_B0_OFFSET 0x0000a7dc -#define PHY_BB_FCAL_2_B0_FLC_PWR_THRESH_MSB 2 -#define PHY_BB_FCAL_2_B0_FLC_PWR_THRESH_LSB 0 -#define PHY_BB_FCAL_2_B0_FLC_PWR_THRESH_MASK 0x00000007 -#define PHY_BB_FCAL_2_B0_FLC_PWR_THRESH_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_BB_FCAL_2_B0_FLC_PWR_THRESH_SET(x) (((x) << 0) & 0x00000007) -#define PHY_BB_FCAL_2_B0_FLC_SW_CAP_VAL_0_MSB 7 -#define PHY_BB_FCAL_2_B0_FLC_SW_CAP_VAL_0_LSB 3 -#define PHY_BB_FCAL_2_B0_FLC_SW_CAP_VAL_0_MASK 0x000000f8 -#define PHY_BB_FCAL_2_B0_FLC_SW_CAP_VAL_0_GET(x) (((x) & 0x000000f8) >> 3) -#define PHY_BB_FCAL_2_B0_FLC_SW_CAP_VAL_0_SET(x) (((x) << 3) & 0x000000f8) -#define PHY_BB_FCAL_2_B0_FLC_BBMISCGAIN_MSB 9 -#define PHY_BB_FCAL_2_B0_FLC_BBMISCGAIN_LSB 8 -#define PHY_BB_FCAL_2_B0_FLC_BBMISCGAIN_MASK 0x00000300 -#define PHY_BB_FCAL_2_B0_FLC_BBMISCGAIN_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_BB_FCAL_2_B0_FLC_BBMISCGAIN_SET(x) (((x) << 8) & 0x00000300) -#define PHY_BB_FCAL_2_B0_FLC_BB1DBGAIN_MSB 12 -#define PHY_BB_FCAL_2_B0_FLC_BB1DBGAIN_LSB 10 -#define PHY_BB_FCAL_2_B0_FLC_BB1DBGAIN_MASK 0x00001c00 -#define PHY_BB_FCAL_2_B0_FLC_BB1DBGAIN_GET(x) (((x) & 0x00001c00) >> 10) -#define PHY_BB_FCAL_2_B0_FLC_BB1DBGAIN_SET(x) (((x) << 10) & 0x00001c00) -#define PHY_BB_FCAL_2_B0_FLC_BB6DBGAIN_MSB 14 -#define PHY_BB_FCAL_2_B0_FLC_BB6DBGAIN_LSB 13 -#define PHY_BB_FCAL_2_B0_FLC_BB6DBGAIN_MASK 0x00006000 -#define PHY_BB_FCAL_2_B0_FLC_BB6DBGAIN_GET(x) (((x) & 0x00006000) >> 13) -#define PHY_BB_FCAL_2_B0_FLC_BB6DBGAIN_SET(x) (((x) << 13) & 0x00006000) -#define PHY_BB_FCAL_2_B0_FLC_SW_CAP_SET_MSB 15 -#define PHY_BB_FCAL_2_B0_FLC_SW_CAP_SET_LSB 15 -#define PHY_BB_FCAL_2_B0_FLC_SW_CAP_SET_MASK 0x00008000 -#define PHY_BB_FCAL_2_B0_FLC_SW_CAP_SET_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_BB_FCAL_2_B0_FLC_SW_CAP_SET_SET(x) (((x) << 15) & 0x00008000) -#define PHY_BB_FCAL_2_B0_FLC_MEAS_WIN_MSB 18 -#define PHY_BB_FCAL_2_B0_FLC_MEAS_WIN_LSB 16 -#define PHY_BB_FCAL_2_B0_FLC_MEAS_WIN_MASK 0x00070000 -#define PHY_BB_FCAL_2_B0_FLC_MEAS_WIN_GET(x) (((x) & 0x00070000) >> 16) -#define PHY_BB_FCAL_2_B0_FLC_MEAS_WIN_SET(x) (((x) << 16) & 0x00070000) -#define PHY_BB_FCAL_2_B0_FLC_CAP_VAL_STATUS_0_MSB 24 -#define PHY_BB_FCAL_2_B0_FLC_CAP_VAL_STATUS_0_LSB 20 -#define PHY_BB_FCAL_2_B0_FLC_CAP_VAL_STATUS_0_MASK 0x01f00000 -#define PHY_BB_FCAL_2_B0_FLC_CAP_VAL_STATUS_0_GET(x) (((x) & 0x01f00000) >> 20) - -/* macros for BB_radar_bw_filter */ -#define PHY_BB_RADAR_BW_FILTER_ADDRESS 0x0000a7e0 -#define PHY_BB_RADAR_BW_FILTER_OFFSET 0x0000a7e0 -#define PHY_BB_RADAR_BW_FILTER_RADAR_AVG_BW_CHECK_MSB 0 -#define PHY_BB_RADAR_BW_FILTER_RADAR_AVG_BW_CHECK_LSB 0 -#define PHY_BB_RADAR_BW_FILTER_RADAR_AVG_BW_CHECK_MASK 0x00000001 -#define PHY_BB_RADAR_BW_FILTER_RADAR_AVG_BW_CHECK_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_RADAR_BW_FILTER_RADAR_AVG_BW_CHECK_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_SRC_SEL_MSB 1 -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_SRC_SEL_LSB 1 -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_SRC_SEL_MASK 0x00000002 -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_SRC_SEL_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_SRC_SEL_SET(x) (((x) << 1) & 0x00000002) -#define PHY_BB_RADAR_BW_FILTER_RADAR_FIRPWR_SEL_MSB 3 -#define PHY_BB_RADAR_BW_FILTER_RADAR_FIRPWR_SEL_LSB 2 -#define PHY_BB_RADAR_BW_FILTER_RADAR_FIRPWR_SEL_MASK 0x0000000c -#define PHY_BB_RADAR_BW_FILTER_RADAR_FIRPWR_SEL_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_BB_RADAR_BW_FILTER_RADAR_FIRPWR_SEL_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_BB_RADAR_BW_FILTER_RADAR_PULSE_WIDTH_SEL_MSB 5 -#define PHY_BB_RADAR_BW_FILTER_RADAR_PULSE_WIDTH_SEL_LSB 4 -#define PHY_BB_RADAR_BW_FILTER_RADAR_PULSE_WIDTH_SEL_MASK 0x00000030 -#define PHY_BB_RADAR_BW_FILTER_RADAR_PULSE_WIDTH_SEL_GET(x) (((x) & 0x00000030) >> 4) -#define PHY_BB_RADAR_BW_FILTER_RADAR_PULSE_WIDTH_SEL_SET(x) (((x) << 4) & 0x00000030) -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_FIRPWR_THRESH_MSB 14 -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_FIRPWR_THRESH_LSB 8 -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_FIRPWR_THRESH_MASK 0x00007f00 -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_FIRPWR_THRESH_GET(x) (((x) & 0x00007f00) >> 8) -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_FIRPWR_THRESH_SET(x) (((x) << 8) & 0x00007f00) -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_PWR_BIAS_MSB 20 -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_PWR_BIAS_LSB 15 -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_PWR_BIAS_MASK 0x001f8000 -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_PWR_BIAS_GET(x) (((x) & 0x001f8000) >> 15) -#define PHY_BB_RADAR_BW_FILTER_RADAR_DC_PWR_BIAS_SET(x) (((x) << 15) & 0x001f8000) -#define PHY_BB_RADAR_BW_FILTER_RADAR_BIN_MAX_BW_MSB 26 -#define PHY_BB_RADAR_BW_FILTER_RADAR_BIN_MAX_BW_LSB 21 -#define PHY_BB_RADAR_BW_FILTER_RADAR_BIN_MAX_BW_MASK 0x07e00000 -#define PHY_BB_RADAR_BW_FILTER_RADAR_BIN_MAX_BW_GET(x) (((x) & 0x07e00000) >> 21) -#define PHY_BB_RADAR_BW_FILTER_RADAR_BIN_MAX_BW_SET(x) (((x) << 21) & 0x07e00000) - -/* macros for BB_dft_tone_ctrl_b0 */ -#define PHY_BB_DFT_TONE_CTRL_B0_ADDRESS 0x0000a7e4 -#define PHY_BB_DFT_TONE_CTRL_B0_OFFSET 0x0000a7e4 -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_EN_0_MSB 0 -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_EN_0_LSB 0 -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_EN_0_MASK 0x00000001 -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_EN_0_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_EN_0_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_AMP_SEL_0_MSB 3 -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_AMP_SEL_0_LSB 2 -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_AMP_SEL_0_MASK 0x0000000c -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_AMP_SEL_0_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_AMP_SEL_0_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_FREQ_ANG_0_MSB 12 -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_FREQ_ANG_0_LSB 4 -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_FREQ_ANG_0_MASK 0x00001ff0 -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_FREQ_ANG_0_GET(x) (((x) & 0x00001ff0) >> 4) -#define PHY_BB_DFT_TONE_CTRL_B0_DFT_TONE_FREQ_ANG_0_SET(x) (((x) << 4) & 0x00001ff0) - -/* macros for BB_therm_adc_1 */ -#define PHY_BB_THERM_ADC_1_ADDRESS 0x0000a7e8 -#define PHY_BB_THERM_ADC_1_OFFSET 0x0000a7e8 -#define PHY_BB_THERM_ADC_1_INIT_THERM_SETTING_MSB 7 -#define PHY_BB_THERM_ADC_1_INIT_THERM_SETTING_LSB 0 -#define PHY_BB_THERM_ADC_1_INIT_THERM_SETTING_MASK 0x000000ff -#define PHY_BB_THERM_ADC_1_INIT_THERM_SETTING_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_THERM_ADC_1_INIT_THERM_SETTING_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_THERM_ADC_1_INIT_VOLT_SETTING_MSB 15 -#define PHY_BB_THERM_ADC_1_INIT_VOLT_SETTING_LSB 8 -#define PHY_BB_THERM_ADC_1_INIT_VOLT_SETTING_MASK 0x0000ff00 -#define PHY_BB_THERM_ADC_1_INIT_VOLT_SETTING_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_THERM_ADC_1_INIT_VOLT_SETTING_SET(x) (((x) << 8) & 0x0000ff00) -#define PHY_BB_THERM_ADC_1_INIT_ATB_SETTING_MSB 23 -#define PHY_BB_THERM_ADC_1_INIT_ATB_SETTING_LSB 16 -#define PHY_BB_THERM_ADC_1_INIT_ATB_SETTING_MASK 0x00ff0000 -#define PHY_BB_THERM_ADC_1_INIT_ATB_SETTING_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_BB_THERM_ADC_1_INIT_ATB_SETTING_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_BB_THERM_ADC_1_SAMPLES_CNT_CODING_MSB 25 -#define PHY_BB_THERM_ADC_1_SAMPLES_CNT_CODING_LSB 24 -#define PHY_BB_THERM_ADC_1_SAMPLES_CNT_CODING_MASK 0x03000000 -#define PHY_BB_THERM_ADC_1_SAMPLES_CNT_CODING_GET(x) (((x) & 0x03000000) >> 24) -#define PHY_BB_THERM_ADC_1_SAMPLES_CNT_CODING_SET(x) (((x) << 24) & 0x03000000) -#define PHY_BB_THERM_ADC_1_USE_INIT_THERM_VOLT_ATB_AFTER_WARM_RESET_MSB 26 -#define PHY_BB_THERM_ADC_1_USE_INIT_THERM_VOLT_ATB_AFTER_WARM_RESET_LSB 26 -#define PHY_BB_THERM_ADC_1_USE_INIT_THERM_VOLT_ATB_AFTER_WARM_RESET_MASK 0x04000000 -#define PHY_BB_THERM_ADC_1_USE_INIT_THERM_VOLT_ATB_AFTER_WARM_RESET_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_BB_THERM_ADC_1_USE_INIT_THERM_VOLT_ATB_AFTER_WARM_RESET_SET(x) (((x) << 26) & 0x04000000) -#define PHY_BB_THERM_ADC_1_FORCE_THERM_VOLT_ATB_TO_INIT_SETTINGS_MSB 27 -#define PHY_BB_THERM_ADC_1_FORCE_THERM_VOLT_ATB_TO_INIT_SETTINGS_LSB 27 -#define PHY_BB_THERM_ADC_1_FORCE_THERM_VOLT_ATB_TO_INIT_SETTINGS_MASK 0x08000000 -#define PHY_BB_THERM_ADC_1_FORCE_THERM_VOLT_ATB_TO_INIT_SETTINGS_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_BB_THERM_ADC_1_FORCE_THERM_VOLT_ATB_TO_INIT_SETTINGS_SET(x) (((x) << 27) & 0x08000000) - -/* macros for BB_therm_adc_2 */ -#define PHY_BB_THERM_ADC_2_ADDRESS 0x0000a7ec -#define PHY_BB_THERM_ADC_2_OFFSET 0x0000a7ec -#define PHY_BB_THERM_ADC_2_MEASURE_THERM_FREQ_MSB 11 -#define PHY_BB_THERM_ADC_2_MEASURE_THERM_FREQ_LSB 0 -#define PHY_BB_THERM_ADC_2_MEASURE_THERM_FREQ_MASK 0x00000fff -#define PHY_BB_THERM_ADC_2_MEASURE_THERM_FREQ_GET(x) (((x) & 0x00000fff) >> 0) -#define PHY_BB_THERM_ADC_2_MEASURE_THERM_FREQ_SET(x) (((x) << 0) & 0x00000fff) -#define PHY_BB_THERM_ADC_2_MEASURE_VOLT_FREQ_MSB 21 -#define PHY_BB_THERM_ADC_2_MEASURE_VOLT_FREQ_LSB 12 -#define PHY_BB_THERM_ADC_2_MEASURE_VOLT_FREQ_MASK 0x003ff000 -#define PHY_BB_THERM_ADC_2_MEASURE_VOLT_FREQ_GET(x) (((x) & 0x003ff000) >> 12) -#define PHY_BB_THERM_ADC_2_MEASURE_VOLT_FREQ_SET(x) (((x) << 12) & 0x003ff000) -#define PHY_BB_THERM_ADC_2_MEASURE_ATB_FREQ_MSB 31 -#define PHY_BB_THERM_ADC_2_MEASURE_ATB_FREQ_LSB 22 -#define PHY_BB_THERM_ADC_2_MEASURE_ATB_FREQ_MASK 0xffc00000 -#define PHY_BB_THERM_ADC_2_MEASURE_ATB_FREQ_GET(x) (((x) & 0xffc00000) >> 22) -#define PHY_BB_THERM_ADC_2_MEASURE_ATB_FREQ_SET(x) (((x) << 22) & 0xffc00000) - -/* macros for BB_therm_adc_3 */ -#define PHY_BB_THERM_ADC_3_ADDRESS 0x0000a7f0 -#define PHY_BB_THERM_ADC_3_OFFSET 0x0000a7f0 -#define PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET_MSB 7 -#define PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET_LSB 0 -#define PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET_MASK 0x000000ff -#define PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_BB_THERM_ADC_3_THERM_ADC_SCALED_GAIN_MSB 16 -#define PHY_BB_THERM_ADC_3_THERM_ADC_SCALED_GAIN_LSB 8 -#define PHY_BB_THERM_ADC_3_THERM_ADC_SCALED_GAIN_MASK 0x0001ff00 -#define PHY_BB_THERM_ADC_3_THERM_ADC_SCALED_GAIN_GET(x) (((x) & 0x0001ff00) >> 8) -#define PHY_BB_THERM_ADC_3_THERM_ADC_SCALED_GAIN_SET(x) (((x) << 8) & 0x0001ff00) -#define PHY_BB_THERM_ADC_3_ADC_INTERVAL_MSB 29 -#define PHY_BB_THERM_ADC_3_ADC_INTERVAL_LSB 17 -#define PHY_BB_THERM_ADC_3_ADC_INTERVAL_MASK 0x3ffe0000 -#define PHY_BB_THERM_ADC_3_ADC_INTERVAL_GET(x) (((x) & 0x3ffe0000) >> 17) -#define PHY_BB_THERM_ADC_3_ADC_INTERVAL_SET(x) (((x) << 17) & 0x3ffe0000) - -/* macros for BB_therm_adc_4 */ -#define PHY_BB_THERM_ADC_4_ADDRESS 0x0000a7f4 -#define PHY_BB_THERM_ADC_4_OFFSET 0x0000a7f4 -#define PHY_BB_THERM_ADC_4_LATEST_THERM_VALUE_MSB 7 -#define PHY_BB_THERM_ADC_4_LATEST_THERM_VALUE_LSB 0 -#define PHY_BB_THERM_ADC_4_LATEST_THERM_VALUE_MASK 0x000000ff -#define PHY_BB_THERM_ADC_4_LATEST_THERM_VALUE_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_THERM_ADC_4_LATEST_VOLT_VALUE_MSB 15 -#define PHY_BB_THERM_ADC_4_LATEST_VOLT_VALUE_LSB 8 -#define PHY_BB_THERM_ADC_4_LATEST_VOLT_VALUE_MASK 0x0000ff00 -#define PHY_BB_THERM_ADC_4_LATEST_VOLT_VALUE_GET(x) (((x) & 0x0000ff00) >> 8) -#define PHY_BB_THERM_ADC_4_LATEST_ATB_VALUE_MSB 23 -#define PHY_BB_THERM_ADC_4_LATEST_ATB_VALUE_LSB 16 -#define PHY_BB_THERM_ADC_4_LATEST_ATB_VALUE_MASK 0x00ff0000 -#define PHY_BB_THERM_ADC_4_LATEST_ATB_VALUE_GET(x) (((x) & 0x00ff0000) >> 16) - -/* macros for BB_tx_forced_gain */ -#define PHY_BB_TX_FORCED_GAIN_ADDRESS 0x0000a7f8 -#define PHY_BB_TX_FORCED_GAIN_OFFSET 0x0000a7f8 -#define PHY_BB_TX_FORCED_GAIN_FORCE_TX_GAIN_MSB 0 -#define PHY_BB_TX_FORCED_GAIN_FORCE_TX_GAIN_LSB 0 -#define PHY_BB_TX_FORCED_GAIN_FORCE_TX_GAIN_MASK 0x00000001 -#define PHY_BB_TX_FORCED_GAIN_FORCE_TX_GAIN_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_BB_TX_FORCED_GAIN_FORCE_TX_GAIN_SET(x) (((x) << 0) & 0x00000001) -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN_MSB 3 -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN_LSB 1 -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN_MASK 0x0000000e -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN_MSB 5 -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN_LSB 4 -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN_MASK 0x00000030 -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN_GET(x) (((x) & 0x00000030) >> 4) -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN_SET(x) (((x) << 4) & 0x00000030) -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXMXRGAIN_MSB 9 -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXMXRGAIN_LSB 6 -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXMXRGAIN_MASK 0x000003c0 -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXMXRGAIN_GET(x) (((x) & 0x000003c0) >> 6) -#define PHY_BB_TX_FORCED_GAIN_FORCED_TXMXRGAIN_SET(x) (((x) << 6) & 0x000003c0) -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNA_MSB 13 -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNA_LSB 10 -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNA_MASK 0x00003c00 -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNA_GET(x) (((x) & 0x00003c00) >> 10) -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNA_SET(x) (((x) << 10) & 0x00003c00) -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNB_MSB 17 -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNB_LSB 14 -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNB_MASK 0x0003c000 -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNB_GET(x) (((x) & 0x0003c000) >> 14) -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNB_SET(x) (((x) << 14) & 0x0003c000) -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNC_MSB 21 -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNC_LSB 18 -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNC_MASK 0x003c0000 -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNC_GET(x) (((x) & 0x003c0000) >> 18) -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGNC_SET(x) (((x) << 18) & 0x003c0000) -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGND_MSB 23 -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGND_LSB 22 -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGND_MASK 0x00c00000 -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGND_GET(x) (((x) & 0x00c00000) >> 22) -#define PHY_BB_TX_FORCED_GAIN_FORCED_PADRVGND_SET(x) (((x) << 22) & 0x00c00000) -#define PHY_BB_TX_FORCED_GAIN_FORCED_ENABLE_PAL_MSB 24 -#define PHY_BB_TX_FORCED_GAIN_FORCED_ENABLE_PAL_LSB 24 -#define PHY_BB_TX_FORCED_GAIN_FORCED_ENABLE_PAL_MASK 0x01000000 -#define PHY_BB_TX_FORCED_GAIN_FORCED_ENABLE_PAL_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_BB_TX_FORCED_GAIN_FORCED_ENABLE_PAL_SET(x) (((x) << 24) & 0x01000000) - -/* macros for BB_eco_ctrl */ -#define PHY_BB_ECO_CTRL_ADDRESS 0x0000a7fc -#define PHY_BB_ECO_CTRL_OFFSET 0x0000a7fc -#define PHY_BB_ECO_CTRL_ECO_CTRL_MSB 7 -#define PHY_BB_ECO_CTRL_ECO_CTRL_LSB 0 -#define PHY_BB_ECO_CTRL_ECO_CTRL_MASK 0x000000ff -#define PHY_BB_ECO_CTRL_ECO_CTRL_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_BB_ECO_CTRL_ECO_CTRL_SET(x) (((x) << 0) & 0x000000ff) - -/* macros for BB_gain_force_max_gains_b1 */ -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B1_ADDRESS 0x0000a848 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B1_OFFSET 0x0000a848 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_HYST_MARGIN_1_MSB 13 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_HYST_MARGIN_1_LSB 7 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_HYST_MARGIN_1_MASK 0x00003f80 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_HYST_MARGIN_1_GET(x) (((x) & 0x00003f80) >> 7) -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_HYST_MARGIN_1_SET(x) (((x) << 7) & 0x00003f80) -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_HYST_MARGIN_1_MSB 20 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_HYST_MARGIN_1_LSB 14 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_HYST_MARGIN_1_MASK 0x001fc000 -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_HYST_MARGIN_1_GET(x) (((x) & 0x001fc000) >> 14) -#define PHY_BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_HYST_MARGIN_1_SET(x) (((x) << 14) & 0x001fc000) - -/* macros for BB_gains_min_offsets_b1 */ -#define PHY_BB_GAINS_MIN_OFFSETS_B1_ADDRESS 0x0000a84c -#define PHY_BB_GAINS_MIN_OFFSETS_B1_OFFSET 0x0000a84c -#define PHY_BB_GAINS_MIN_OFFSETS_B1_RF_GAIN_F_1_MSB 24 -#define PHY_BB_GAINS_MIN_OFFSETS_B1_RF_GAIN_F_1_LSB 17 -#define PHY_BB_GAINS_MIN_OFFSETS_B1_RF_GAIN_F_1_MASK 0x01fe0000 -#define PHY_BB_GAINS_MIN_OFFSETS_B1_RF_GAIN_F_1_GET(x) (((x) & 0x01fe0000) >> 17) -#define PHY_BB_GAINS_MIN_OFFSETS_B1_RF_GAIN_F_1_SET(x) (((x) << 17) & 0x01fe0000) -#define PHY_BB_GAINS_MIN_OFFSETS_B1_XATTEN1_SW_F_1_MSB 25 -#define PHY_BB_GAINS_MIN_OFFSETS_B1_XATTEN1_SW_F_1_LSB 25 -#define PHY_BB_GAINS_MIN_OFFSETS_B1_XATTEN1_SW_F_1_MASK 0x02000000 -#define PHY_BB_GAINS_MIN_OFFSETS_B1_XATTEN1_SW_F_1_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_BB_GAINS_MIN_OFFSETS_B1_XATTEN1_SW_F_1_SET(x) (((x) << 25) & 0x02000000) -#define PHY_BB_GAINS_MIN_OFFSETS_B1_XATTEN2_SW_F_1_MSB 26 -#define PHY_BB_GAINS_MIN_OFFSETS_B1_XATTEN2_SW_F_1_LSB 26 -#define PHY_BB_GAINS_MIN_OFFSETS_B1_XATTEN2_SW_F_1_MASK 0x04000000 -#define PHY_BB_GAINS_MIN_OFFSETS_B1_XATTEN2_SW_F_1_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_BB_GAINS_MIN_OFFSETS_B1_XATTEN2_SW_F_1_SET(x) (((x) << 26) & 0x04000000) - -/* macros for BB_rx_ocgain2 */ -#define PHY_BB_RX_OCGAIN2_ADDRESS 0x0000aa00 -#define PHY_BB_RX_OCGAIN2_OFFSET 0x0000aa00 -#define PHY_BB_RX_OCGAIN2_GAIN_ENTRY2_MSB 31 -#define PHY_BB_RX_OCGAIN2_GAIN_ENTRY2_LSB 0 -#define PHY_BB_RX_OCGAIN2_GAIN_ENTRY2_MASK 0xffffffff -#define PHY_BB_RX_OCGAIN2_GAIN_ENTRY2_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_ext_atten_switch_ctl_b1 */ -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_ADDRESS 0x0000b20c -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_OFFSET 0x0000b20c -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_DB_1_MSB 5 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_DB_1_LSB 0 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_DB_1_MASK 0x0000003f -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_DB_1_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_DB_1_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_DB_1_MSB 11 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_DB_1_LSB 6 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_DB_1_MASK 0x00000fc0 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_DB_1_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_DB_1_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_MARGIN_1_MSB 16 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_MARGIN_1_LSB 12 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_MARGIN_1_MASK 0x0001f000 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_MARGIN_1_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_MARGIN_1_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_MARGIN_1_MSB 21 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_MARGIN_1_LSB 17 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_MARGIN_1_MASK 0x003e0000 -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_MARGIN_1_GET(x) (((x) & 0x003e0000) >> 17) -#define PHY_BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_MARGIN_1_SET(x) (((x) << 17) & 0x003e0000) - - -#ifndef __ASSEMBLER__ - -typedef struct bb_lc_reg_reg_s { - volatile char pad__0[0x9800]; /* 0x0 - 0x9800 */ - volatile unsigned int BB_test_controls; /* 0x9800 - 0x9804 */ - volatile unsigned int BB_gen_controls; /* 0x9804 - 0x9808 */ - volatile unsigned int BB_test_controls_status; /* 0x9808 - 0x980c */ - volatile unsigned int BB_timing_controls_1; /* 0x980c - 0x9810 */ - volatile unsigned int BB_timing_controls_2; /* 0x9810 - 0x9814 */ - volatile unsigned int BB_timing_controls_3; /* 0x9814 - 0x9818 */ - volatile unsigned int BB_D2_chip_id; /* 0x9818 - 0x981c */ - volatile unsigned int BB_active; /* 0x981c - 0x9820 */ - volatile unsigned int BB_tx_timing_1; /* 0x9820 - 0x9824 */ - volatile unsigned int BB_tx_timing_2; /* 0x9824 - 0x9828 */ - volatile unsigned int BB_tx_timing_3; /* 0x9828 - 0x982c */ - volatile unsigned int BB_addac_parallel_control; /* 0x982c - 0x9830 */ - volatile char pad__1[0x4]; /* 0x9830 - 0x9834 */ - volatile unsigned int BB_xpa_timing_control; /* 0x9834 - 0x9838 */ - volatile unsigned int BB_misc_pa_control; /* 0x9838 - 0x983c */ - volatile unsigned int BB_tstdac_constant; /* 0x983c - 0x9840 */ - volatile unsigned int BB_find_signal_low; /* 0x9840 - 0x9844 */ - volatile unsigned int BB_settling_time; /* 0x9844 - 0x9848 */ - volatile unsigned int BB_gain_force_max_gains_b0; /* 0x9848 - 0x984c */ - volatile unsigned int BB_gains_min_offsets_b0; /* 0x984c - 0x9850 */ - volatile unsigned int BB_desired_sigsize; /* 0x9850 - 0x9854 */ - volatile unsigned int BB_timing_control_3a; /* 0x9854 - 0x9858 */ - volatile unsigned int BB_find_signal; /* 0x9858 - 0x985c */ - volatile unsigned int BB_agc; /* 0x985c - 0x9860 */ - volatile unsigned int BB_agc_control; /* 0x9860 - 0x9864 */ - volatile unsigned int BB_cca_b0; /* 0x9864 - 0x9868 */ - volatile unsigned int BB_sfcorr; /* 0x9868 - 0x986c */ - volatile unsigned int BB_self_corr_low; /* 0x986c - 0x9870 */ - volatile char pad__2[0x4]; /* 0x9870 - 0x9874 */ - volatile unsigned int BB_synth_control; /* 0x9874 - 0x9878 */ - volatile unsigned int BB_addac_clk_select; /* 0x9878 - 0x987c */ - volatile unsigned int BB_pll_cntl; /* 0x987c - 0x9880 */ - volatile char pad__3[0x80]; /* 0x9880 - 0x9900 */ - volatile unsigned int BB_vit_spur_mask_A; /* 0x9900 - 0x9904 */ - volatile unsigned int BB_vit_spur_mask_B; /* 0x9904 - 0x9908 */ - volatile unsigned int BB_pilot_spur_mask; /* 0x9908 - 0x990c */ - volatile unsigned int BB_chan_spur_mask; /* 0x990c - 0x9910 */ - volatile unsigned int BB_spectral_scan; /* 0x9910 - 0x9914 */ - volatile unsigned int BB_analog_power_on_time; /* 0x9914 - 0x9918 */ - volatile unsigned int BB_search_start_delay; /* 0x9918 - 0x991c */ - volatile unsigned int BB_max_rx_length; /* 0x991c - 0x9920 */ - volatile unsigned int BB_timing_control_4; /* 0x9920 - 0x9924 */ - volatile unsigned int BB_timing_control_5; /* 0x9924 - 0x9928 */ - volatile unsigned int BB_phyonly_warm_reset; /* 0x9928 - 0x992c */ - volatile unsigned int BB_phyonly_control; /* 0x992c - 0x9930 */ - volatile char pad__4[0x4]; /* 0x9930 - 0x9934 */ - volatile unsigned int BB_powertx_rate1; /* 0x9934 - 0x9938 */ - volatile unsigned int BB_powertx_rate2; /* 0x9938 - 0x993c */ - volatile unsigned int BB_powertx_max; /* 0x993c - 0x9940 */ - volatile unsigned int BB_extension_radar; /* 0x9940 - 0x9944 */ - volatile unsigned int BB_frame_control; /* 0x9944 - 0x9948 */ - volatile unsigned int BB_timing_control_6; /* 0x9948 - 0x994c */ - volatile unsigned int BB_spur_mask_controls; /* 0x994c - 0x9950 */ - volatile unsigned int BB_rx_iq_corr_b0; /* 0x9950 - 0x9954 */ - volatile unsigned int BB_radar_detection; /* 0x9954 - 0x9958 */ - volatile unsigned int BB_radar_detection_2; /* 0x9958 - 0x995c */ - volatile unsigned int BB_tx_phase_ramp_b0; /* 0x995c - 0x9960 */ - volatile unsigned int BB_switch_table_chn_b0; /* 0x9960 - 0x9964 */ - volatile unsigned int BB_switch_table_com1; /* 0x9964 - 0x9968 */ - volatile unsigned int BB_cca_ctrl_2_b0; /* 0x9968 - 0x996c */ - volatile unsigned int BB_switch_table_com2; /* 0x996c - 0x9970 */ - volatile unsigned int BB_restart; /* 0x9970 - 0x9974 */ - volatile char pad__5[0x4]; /* 0x9974 - 0x9978 */ - volatile unsigned int BB_scrambler_seed; /* 0x9978 - 0x997c */ - volatile unsigned int BB_rfbus_request; /* 0x997c - 0x9980 */ - volatile char pad__6[0x20]; /* 0x9980 - 0x99a0 */ - volatile unsigned int BB_timing_control_11; /* 0x99a0 - 0x99a4 */ - volatile unsigned int BB_multichain_enable; /* 0x99a4 - 0x99a8 */ - volatile unsigned int BB_multichain_control; /* 0x99a8 - 0x99ac */ - volatile unsigned int BB_multichain_gain_ctrl; /* 0x99ac - 0x99b0 */ - volatile char pad__7[0x4]; /* 0x99b0 - 0x99b4 */ - volatile unsigned int BB_adc_gain_dc_corr_b0; /* 0x99b4 - 0x99b8 */ - volatile unsigned int BB_ext_chan_pwr_thr_1; /* 0x99b8 - 0x99bc */ - volatile unsigned int BB_ext_chan_pwr_thr_2_b0; /* 0x99bc - 0x99c0 */ - volatile unsigned int BB_ext_chan_scorr_thr; /* 0x99c0 - 0x99c4 */ - volatile unsigned int BB_ext_chan_detect_win; /* 0x99c4 - 0x99c8 */ - volatile unsigned int BB_pwr_thr_20_40_det; /* 0x99c8 - 0x99cc */ - volatile char pad__8[0x4]; /* 0x99cc - 0x99d0 */ - volatile unsigned int BB_short_gi_delta_slope; /* 0x99d0 - 0x99d4 */ - volatile char pad__9[0x8]; /* 0x99d4 - 0x99dc */ - volatile unsigned int BB_chaninfo_ctrl; /* 0x99dc - 0x99e0 */ - volatile unsigned int BB_heavy_clip_ctrl; /* 0x99e0 - 0x99e4 */ - volatile unsigned int BB_heavy_clip_20; /* 0x99e4 - 0x99e8 */ - volatile unsigned int BB_heavy_clip_40; /* 0x99e8 - 0x99ec */ - volatile unsigned int BB_rifs_srch; /* 0x99ec - 0x99f0 */ - volatile unsigned int BB_iq_adc_cal_mode; /* 0x99f0 - 0x99f4 */ - volatile char pad__10[0x8]; /* 0x99f4 - 0x99fc */ - volatile unsigned int BB_per_chain_csd; /* 0x99fc - 0x9a00 */ - volatile unsigned int BB_rx_ocgain[128]; /* 0x9a00 - 0x9c00 */ - volatile unsigned int BB_tx_crc; /* 0x9c00 - 0x9c04 */ - volatile char pad__11[0xc]; /* 0x9c04 - 0x9c10 */ - volatile unsigned int BB_iq_adc_meas_0_b0; /* 0x9c10 - 0x9c14 */ - volatile unsigned int BB_iq_adc_meas_1_b0; /* 0x9c14 - 0x9c18 */ - volatile unsigned int BB_iq_adc_meas_2_b0; /* 0x9c18 - 0x9c1c */ - volatile unsigned int BB_iq_adc_meas_3_b0; /* 0x9c1c - 0x9c20 */ - volatile unsigned int BB_rfbus_grant; /* 0x9c20 - 0x9c24 */ - volatile unsigned int BB_tstadc; /* 0x9c24 - 0x9c28 */ - volatile unsigned int BB_tstdac; /* 0x9c28 - 0x9c2c */ - volatile char pad__12[0x4]; /* 0x9c2c - 0x9c30 */ - volatile unsigned int BB_illegal_tx_rate; /* 0x9c30 - 0x9c34 */ - volatile unsigned int BB_spur_report_b0; /* 0x9c34 - 0x9c38 */ - volatile unsigned int BB_channel_status; /* 0x9c38 - 0x9c3c */ - volatile unsigned int BB_rssi_b0; /* 0x9c3c - 0x9c40 */ - volatile unsigned int BB_spur_est_cck_report_b0; /* 0x9c40 - 0x9c44 */ - volatile char pad__13[0x68]; /* 0x9c44 - 0x9cac */ - volatile unsigned int BB_chan_info_noise_pwr; /* 0x9cac - 0x9cb0 */ - volatile unsigned int BB_chan_info_gain_diff; /* 0x9cb0 - 0x9cb4 */ - volatile unsigned int BB_chan_info_fine_timing; /* 0x9cb4 - 0x9cb8 */ - volatile unsigned int BB_chan_info_gain_b0; /* 0x9cb8 - 0x9cbc */ - volatile unsigned int BB_chan_info_chan_tab_b0[60]; /* 0x9cbc - 0x9dac */ - volatile char pad__14[0x38]; /* 0x9dac - 0x9de4 */ - volatile unsigned int BB_paprd_am2am_mask; /* 0x9de4 - 0x9de8 */ - volatile unsigned int BB_paprd_am2pm_mask; /* 0x9de8 - 0x9dec */ - volatile unsigned int BB_paprd_ht40_mask; /* 0x9dec - 0x9df0 */ - volatile unsigned int BB_paprd_ctrl0; /* 0x9df0 - 0x9df4 */ - volatile unsigned int BB_paprd_ctrl1; /* 0x9df4 - 0x9df8 */ - volatile unsigned int BB_pa_gain123; /* 0x9df8 - 0x9dfc */ - volatile unsigned int BB_pa_gain45; /* 0x9dfc - 0x9e00 */ - volatile unsigned int BB_paprd_pre_post_scale_0; /* 0x9e00 - 0x9e04 */ - volatile unsigned int BB_paprd_pre_post_scale_1; /* 0x9e04 - 0x9e08 */ - volatile unsigned int BB_paprd_pre_post_scale_2; /* 0x9e08 - 0x9e0c */ - volatile unsigned int BB_paprd_pre_post_scale_3; /* 0x9e0c - 0x9e10 */ - volatile unsigned int BB_paprd_pre_post_scale_4; /* 0x9e10 - 0x9e14 */ - volatile unsigned int BB_paprd_pre_post_scale_5; /* 0x9e14 - 0x9e18 */ - volatile unsigned int BB_paprd_pre_post_scale_6; /* 0x9e18 - 0x9e1c */ - volatile unsigned int BB_paprd_pre_post_scale_7; /* 0x9e1c - 0x9e20 */ - volatile unsigned int BB_paprd_mem_tab[120]; /* 0x9e20 - 0xa000 */ - volatile unsigned int BB_peak_det_ctrl_1; /* 0xa000 - 0xa004 */ - volatile unsigned int BB_peak_det_ctrl_2; /* 0xa004 - 0xa008 */ - volatile unsigned int BB_rx_gain_bounds_1; /* 0xa008 - 0xa00c */ - volatile unsigned int BB_rx_gain_bounds_2; /* 0xa00c - 0xa010 */ - volatile unsigned int BB_peak_det_cal_ctrl; /* 0xa010 - 0xa014 */ - volatile unsigned int BB_agc_dig_dc_ctrl; /* 0xa014 - 0xa018 */ - volatile unsigned int BB_agc_dig_dc_status_i_b0; /* 0xa018 - 0xa01c */ - volatile unsigned int BB_agc_dig_dc_status_q_b0; /* 0xa01c - 0xa020 */ - volatile char pad__15[0x1d4]; /* 0xa020 - 0xa1f4 */ - volatile unsigned int BB_bbb_txfir_0; /* 0xa1f4 - 0xa1f8 */ - volatile unsigned int BB_bbb_txfir_1; /* 0xa1f8 - 0xa1fc */ - volatile unsigned int BB_bbb_txfir_2; /* 0xa1fc - 0xa200 */ - volatile unsigned int BB_modes_select; /* 0xa200 - 0xa204 */ - volatile unsigned int BB_bbb_tx_ctrl; /* 0xa204 - 0xa208 */ - volatile unsigned int BB_bbb_sig_detect; /* 0xa208 - 0xa20c */ - volatile unsigned int BB_ext_atten_switch_ctl_b0; /* 0xa20c - 0xa210 */ - volatile unsigned int BB_bbb_rx_ctrl_1; /* 0xa210 - 0xa214 */ - volatile unsigned int BB_bbb_rx_ctrl_2; /* 0xa214 - 0xa218 */ - volatile unsigned int BB_bbb_rx_ctrl_3; /* 0xa218 - 0xa21c */ - volatile unsigned int BB_bbb_rx_ctrl_4; /* 0xa21c - 0xa220 */ - volatile unsigned int BB_bbb_rx_ctrl_5; /* 0xa220 - 0xa224 */ - volatile unsigned int BB_bbb_rx_ctrl_6; /* 0xa224 - 0xa228 */ - volatile unsigned int BB_bbb_dagc_ctrl; /* 0xa228 - 0xa22c */ - volatile unsigned int BB_force_clken_cck; /* 0xa22c - 0xa230 */ - volatile unsigned int BB_rx_clear_delay; /* 0xa230 - 0xa234 */ - volatile unsigned int BB_powertx_rate3; /* 0xa234 - 0xa238 */ - volatile unsigned int BB_powertx_rate4; /* 0xa238 - 0xa23c */ - volatile char pad__16[0x4]; /* 0xa23c - 0xa240 */ - volatile unsigned int BB_cck_spur_mit; /* 0xa240 - 0xa244 */ - volatile unsigned int BB_panic_watchdog_status; /* 0xa244 - 0xa248 */ - volatile unsigned int BB_panic_watchdog_ctrl_1; /* 0xa248 - 0xa24c */ - volatile unsigned int BB_panic_watchdog_ctrl_2; /* 0xa24c - 0xa250 */ - volatile unsigned int BB_iqcorr_ctrl_cck; /* 0xa250 - 0xa254 */ - volatile unsigned int BB_bluetooth_cntl; /* 0xa254 - 0xa258 */ - volatile unsigned int BB_tpc_1; /* 0xa258 - 0xa25c */ - volatile unsigned int BB_tpc_2; /* 0xa25c - 0xa260 */ - volatile unsigned int BB_tpc_3; /* 0xa260 - 0xa264 */ - volatile unsigned int BB_tpc_4_b0; /* 0xa264 - 0xa268 */ - volatile unsigned int BB_analog_swap; /* 0xa268 - 0xa26c */ - volatile unsigned int BB_tpc_5_b0; /* 0xa26c - 0xa270 */ - volatile unsigned int BB_tpc_6_b0; /* 0xa270 - 0xa274 */ - volatile unsigned int BB_tpc_7; /* 0xa274 - 0xa278 */ - volatile unsigned int BB_tpc_8; /* 0xa278 - 0xa27c */ - volatile unsigned int BB_tpc_9; /* 0xa27c - 0xa280 */ - volatile unsigned int BB_pdadc_tab_b0[32]; /* 0xa280 - 0xa300 */ - volatile unsigned int BB_cl_tab_b0[16]; /* 0xa300 - 0xa340 */ - volatile unsigned int BB_cl_map_0_b0; /* 0xa340 - 0xa344 */ - volatile unsigned int BB_cl_map_1_b0; /* 0xa344 - 0xa348 */ - volatile unsigned int BB_cl_map_2_b0; /* 0xa348 - 0xa34c */ - volatile unsigned int BB_cl_map_3_b0; /* 0xa34c - 0xa350 */ - volatile char pad__17[0x8]; /* 0xa350 - 0xa358 */ - volatile unsigned int BB_cl_cal_ctrl; /* 0xa358 - 0xa35c */ - volatile unsigned int BB_cl_map_pal_0_b0; /* 0xa35c - 0xa360 */ - volatile unsigned int BB_cl_map_pal_1_b0; /* 0xa360 - 0xa364 */ - volatile unsigned int BB_cl_map_pal_2_b0; /* 0xa364 - 0xa368 */ - volatile unsigned int BB_cl_map_pal_3_b0; /* 0xa368 - 0xa36c */ - volatile char pad__18[0x1c]; /* 0xa36c - 0xa388 */ - volatile unsigned int BB_rifs; /* 0xa388 - 0xa38c */ - volatile unsigned int BB_powertx_rate5; /* 0xa38c - 0xa390 */ - volatile unsigned int BB_powertx_rate6; /* 0xa390 - 0xa394 */ - volatile unsigned int BB_tpc_10; /* 0xa394 - 0xa398 */ - volatile unsigned int BB_tpc_11_b0; /* 0xa398 - 0xa39c */ - volatile unsigned int BB_cal_chain_mask; /* 0xa39c - 0xa3a0 */ - volatile char pad__19[0x1c]; /* 0xa3a0 - 0xa3bc */ - volatile unsigned int BB_powertx_sub; /* 0xa3bc - 0xa3c0 */ - volatile unsigned int BB_powertx_rate7; /* 0xa3c0 - 0xa3c4 */ - volatile unsigned int BB_powertx_rate8; /* 0xa3c4 - 0xa3c8 */ - volatile unsigned int BB_powertx_rate9; /* 0xa3c8 - 0xa3cc */ - volatile unsigned int BB_powertx_rate10; /* 0xa3cc - 0xa3d0 */ - volatile unsigned int BB_powertx_rate11; /* 0xa3d0 - 0xa3d4 */ - volatile unsigned int BB_powertx_rate12; /* 0xa3d4 - 0xa3d8 */ - volatile unsigned int BB_force_analog; /* 0xa3d8 - 0xa3dc */ - volatile unsigned int BB_tpc_12; /* 0xa3dc - 0xa3e0 */ - volatile unsigned int BB_tpc_13; /* 0xa3e0 - 0xa3e4 */ - volatile unsigned int BB_tpc_14; /* 0xa3e4 - 0xa3e8 */ - volatile unsigned int BB_tpc_15; /* 0xa3e8 - 0xa3ec */ - volatile unsigned int BB_tpc_16; /* 0xa3ec - 0xa3f0 */ - volatile unsigned int BB_tpc_17; /* 0xa3f0 - 0xa3f4 */ - volatile unsigned int BB_tpc_18; /* 0xa3f4 - 0xa3f8 */ - volatile unsigned int BB_tpc_19; /* 0xa3f8 - 0xa3fc */ - volatile unsigned int BB_tpc_20; /* 0xa3fc - 0xa400 */ - volatile unsigned int BB_tx_gain_tab_1; /* 0xa400 - 0xa404 */ - volatile unsigned int BB_tx_gain_tab_2; /* 0xa404 - 0xa408 */ - volatile unsigned int BB_tx_gain_tab_3; /* 0xa408 - 0xa40c */ - volatile unsigned int BB_tx_gain_tab_4; /* 0xa40c - 0xa410 */ - volatile unsigned int BB_tx_gain_tab_5; /* 0xa410 - 0xa414 */ - volatile unsigned int BB_tx_gain_tab_6; /* 0xa414 - 0xa418 */ - volatile unsigned int BB_tx_gain_tab_7; /* 0xa418 - 0xa41c */ - volatile unsigned int BB_tx_gain_tab_8; /* 0xa41c - 0xa420 */ - volatile unsigned int BB_tx_gain_tab_9; /* 0xa420 - 0xa424 */ - volatile unsigned int BB_tx_gain_tab_10; /* 0xa424 - 0xa428 */ - volatile unsigned int BB_tx_gain_tab_11; /* 0xa428 - 0xa42c */ - volatile unsigned int BB_tx_gain_tab_12; /* 0xa42c - 0xa430 */ - volatile unsigned int BB_tx_gain_tab_13; /* 0xa430 - 0xa434 */ - volatile unsigned int BB_tx_gain_tab_14; /* 0xa434 - 0xa438 */ - volatile unsigned int BB_tx_gain_tab_15; /* 0xa438 - 0xa43c */ - volatile unsigned int BB_tx_gain_tab_16; /* 0xa43c - 0xa440 */ - volatile unsigned int BB_tx_gain_tab_17; /* 0xa440 - 0xa444 */ - volatile unsigned int BB_tx_gain_tab_18; /* 0xa444 - 0xa448 */ - volatile unsigned int BB_tx_gain_tab_19; /* 0xa448 - 0xa44c */ - volatile unsigned int BB_tx_gain_tab_20; /* 0xa44c - 0xa450 */ - volatile unsigned int BB_tx_gain_tab_21; /* 0xa450 - 0xa454 */ - volatile unsigned int BB_tx_gain_tab_22; /* 0xa454 - 0xa458 */ - volatile unsigned int BB_tx_gain_tab_23; /* 0xa458 - 0xa45c */ - volatile unsigned int BB_tx_gain_tab_24; /* 0xa45c - 0xa460 */ - volatile unsigned int BB_tx_gain_tab_25; /* 0xa460 - 0xa464 */ - volatile unsigned int BB_tx_gain_tab_26; /* 0xa464 - 0xa468 */ - volatile unsigned int BB_tx_gain_tab_27; /* 0xa468 - 0xa46c */ - volatile unsigned int BB_tx_gain_tab_28; /* 0xa46c - 0xa470 */ - volatile unsigned int BB_tx_gain_tab_29; /* 0xa470 - 0xa474 */ - volatile unsigned int BB_tx_gain_tab_30; /* 0xa474 - 0xa478 */ - volatile unsigned int BB_tx_gain_tab_31; /* 0xa478 - 0xa47c */ - volatile unsigned int BB_tx_gain_tab_32; /* 0xa47c - 0xa480 */ - volatile unsigned int BB_tx_gain_tab_pal_1; /* 0xa480 - 0xa484 */ - volatile unsigned int BB_tx_gain_tab_pal_2; /* 0xa484 - 0xa488 */ - volatile unsigned int BB_tx_gain_tab_pal_3; /* 0xa488 - 0xa48c */ - volatile unsigned int BB_tx_gain_tab_pal_4; /* 0xa48c - 0xa490 */ - volatile unsigned int BB_tx_gain_tab_pal_5; /* 0xa490 - 0xa494 */ - volatile unsigned int BB_tx_gain_tab_pal_6; /* 0xa494 - 0xa498 */ - volatile unsigned int BB_tx_gain_tab_pal_7; /* 0xa498 - 0xa49c */ - volatile unsigned int BB_tx_gain_tab_pal_8; /* 0xa49c - 0xa4a0 */ - volatile unsigned int BB_tx_gain_tab_pal_9; /* 0xa4a0 - 0xa4a4 */ - volatile unsigned int BB_tx_gain_tab_pal_10; /* 0xa4a4 - 0xa4a8 */ - volatile unsigned int BB_tx_gain_tab_pal_11; /* 0xa4a8 - 0xa4ac */ - volatile unsigned int BB_tx_gain_tab_pal_12; /* 0xa4ac - 0xa4b0 */ - volatile unsigned int BB_tx_gain_tab_pal_13; /* 0xa4b0 - 0xa4b4 */ - volatile unsigned int BB_tx_gain_tab_pal_14; /* 0xa4b4 - 0xa4b8 */ - volatile unsigned int BB_tx_gain_tab_pal_15; /* 0xa4b8 - 0xa4bc */ - volatile unsigned int BB_tx_gain_tab_pal_16; /* 0xa4bc - 0xa4c0 */ - volatile unsigned int BB_tx_gain_tab_pal_17; /* 0xa4c0 - 0xa4c4 */ - volatile unsigned int BB_tx_gain_tab_pal_18; /* 0xa4c4 - 0xa4c8 */ - volatile unsigned int BB_tx_gain_tab_pal_19; /* 0xa4c8 - 0xa4cc */ - volatile unsigned int BB_tx_gain_tab_pal_20; /* 0xa4cc - 0xa4d0 */ - volatile unsigned int BB_tx_gain_tab_pal_21; /* 0xa4d0 - 0xa4d4 */ - volatile unsigned int BB_tx_gain_tab_pal_22; /* 0xa4d4 - 0xa4d8 */ - volatile unsigned int BB_tx_gain_tab_pal_23; /* 0xa4d8 - 0xa4dc */ - volatile unsigned int BB_tx_gain_tab_pal_24; /* 0xa4dc - 0xa4e0 */ - volatile unsigned int BB_tx_gain_tab_pal_25; /* 0xa4e0 - 0xa4e4 */ - volatile unsigned int BB_tx_gain_tab_pal_26; /* 0xa4e4 - 0xa4e8 */ - volatile unsigned int BB_tx_gain_tab_pal_27; /* 0xa4e8 - 0xa4ec */ - volatile unsigned int BB_tx_gain_tab_pal_28; /* 0xa4ec - 0xa4f0 */ - volatile unsigned int BB_tx_gain_tab_pal_29; /* 0xa4f0 - 0xa4f4 */ - volatile unsigned int BB_tx_gain_tab_pal_30; /* 0xa4f4 - 0xa4f8 */ - volatile unsigned int BB_tx_gain_tab_pal_31; /* 0xa4f8 - 0xa4fc */ - volatile unsigned int BB_tx_gain_tab_pal_32; /* 0xa4fc - 0xa500 */ - volatile char pad__20[0x18]; /* 0xa500 - 0xa518 */ - volatile unsigned int BB_caltx_gain_set_0; /* 0xa518 - 0xa51c */ - volatile unsigned int BB_caltx_gain_set_2; /* 0xa51c - 0xa520 */ - volatile unsigned int BB_caltx_gain_set_4; /* 0xa520 - 0xa524 */ - volatile unsigned int BB_caltx_gain_set_6; /* 0xa524 - 0xa528 */ - volatile unsigned int BB_caltx_gain_set_8; /* 0xa528 - 0xa52c */ - volatile unsigned int BB_caltx_gain_set_10; /* 0xa52c - 0xa530 */ - volatile unsigned int BB_caltx_gain_set_12; /* 0xa530 - 0xa534 */ - volatile unsigned int BB_caltx_gain_set_14; /* 0xa534 - 0xa538 */ - volatile unsigned int BB_caltx_gain_set_16; /* 0xa538 - 0xa53c */ - volatile unsigned int BB_caltx_gain_set_18; /* 0xa53c - 0xa540 */ - volatile unsigned int BB_caltx_gain_set_20; /* 0xa540 - 0xa544 */ - volatile unsigned int BB_caltx_gain_set_22; /* 0xa544 - 0xa548 */ - volatile unsigned int BB_caltx_gain_set_24; /* 0xa548 - 0xa54c */ - volatile unsigned int BB_caltx_gain_set_26; /* 0xa54c - 0xa550 */ - volatile unsigned int BB_caltx_gain_set_28; /* 0xa550 - 0xa554 */ - volatile unsigned int BB_caltx_gain_set_30; /* 0xa554 - 0xa558 */ - volatile unsigned int BB_txiqcal_meas_b0[96]; /* 0xa558 - 0xa6d8 */ - volatile unsigned int BB_txiqcal_start; /* 0xa6d8 - 0xa6dc */ - volatile unsigned int BB_txiqcal_control_0; /* 0xa6dc - 0xa6e0 */ - volatile unsigned int BB_txiqcal_control_1; /* 0xa6e0 - 0xa6e4 */ - volatile unsigned int BB_txiqcal_control_2; /* 0xa6e4 - 0xa6e8 */ - volatile unsigned int BB_txiqcal_control_3; /* 0xa6e8 - 0xa6ec */ - volatile unsigned int BB_txiq_corr_coeff_01_b0; /* 0xa6ec - 0xa6f0 */ - volatile unsigned int BB_txiq_corr_coeff_23_b0; /* 0xa6f0 - 0xa6f4 */ - volatile unsigned int BB_txiq_corr_coeff_45_b0; /* 0xa6f4 - 0xa6f8 */ - volatile unsigned int BB_txiq_corr_coeff_67_b0; /* 0xa6f8 - 0xa6fc */ - volatile unsigned int BB_txiq_corr_coeff_89_b0; /* 0xa6fc - 0xa700 */ - volatile unsigned int BB_txiq_corr_coeff_ab_b0; /* 0xa700 - 0xa704 */ - volatile unsigned int BB_txiq_corr_coeff_cd_b0; /* 0xa704 - 0xa708 */ - volatile unsigned int BB_txiq_corr_coeff_ef_b0; /* 0xa708 - 0xa70c */ - volatile unsigned int BB_cal_rxbb_gain_tbl_0; /* 0xa70c - 0xa710 */ - volatile unsigned int BB_cal_rxbb_gain_tbl_4; /* 0xa710 - 0xa714 */ - volatile unsigned int BB_cal_rxbb_gain_tbl_8; /* 0xa714 - 0xa718 */ - volatile unsigned int BB_cal_rxbb_gain_tbl_12; /* 0xa718 - 0xa71c */ - volatile unsigned int BB_cal_rxbb_gain_tbl_16; /* 0xa71c - 0xa720 */ - volatile unsigned int BB_cal_rxbb_gain_tbl_20; /* 0xa720 - 0xa724 */ - volatile unsigned int BB_cal_rxbb_gain_tbl_24; /* 0xa724 - 0xa728 */ - volatile unsigned int BB_txiqcal_status_b0; /* 0xa728 - 0xa72c */ - volatile unsigned int BB_paprd_trainer_cntl1; /* 0xa72c - 0xa730 */ - volatile unsigned int BB_paprd_trainer_cntl2; /* 0xa730 - 0xa734 */ - volatile unsigned int BB_paprd_trainer_cntl3; /* 0xa734 - 0xa738 */ - volatile unsigned int BB_paprd_trainer_cntl4; /* 0xa738 - 0xa73c */ - volatile unsigned int BB_paprd_trainer_stat1; /* 0xa73c - 0xa740 */ - volatile unsigned int BB_paprd_trainer_stat2; /* 0xa740 - 0xa744 */ - volatile unsigned int BB_paprd_trainer_stat3; /* 0xa744 - 0xa748 */ - volatile char pad__21[0x90]; /* 0xa748 - 0xa7d8 */ - volatile unsigned int BB_fcal_1; /* 0xa7d8 - 0xa7dc */ - volatile unsigned int BB_fcal_2_b0; /* 0xa7dc - 0xa7e0 */ - volatile unsigned int BB_radar_bw_filter; /* 0xa7e0 - 0xa7e4 */ - volatile unsigned int BB_dft_tone_ctrl_b0; /* 0xa7e4 - 0xa7e8 */ - volatile unsigned int BB_therm_adc_1; /* 0xa7e8 - 0xa7ec */ - volatile unsigned int BB_therm_adc_2; /* 0xa7ec - 0xa7f0 */ - volatile unsigned int BB_therm_adc_3; /* 0xa7f0 - 0xa7f4 */ - volatile unsigned int BB_therm_adc_4; /* 0xa7f4 - 0xa7f8 */ - volatile unsigned int BB_tx_forced_gain; /* 0xa7f8 - 0xa7fc */ - volatile unsigned int BB_eco_ctrl; /* 0xa7fc - 0xa800 */ - volatile char pad__22[0x48]; /* 0xa800 - 0xa848 */ - volatile unsigned int BB_gain_force_max_gains_b1; /* 0xa848 - 0xa84c */ - volatile unsigned int BB_gains_min_offsets_b1; /* 0xa84c - 0xa850 */ - volatile char pad__23[0x1b0]; /* 0xa850 - 0xaa00 */ - volatile unsigned int BB_rx_ocgain2[128]; /* 0xaa00 - 0xac00 */ - volatile char pad__24[0x60c]; /* 0xac00 - 0xb20c */ - volatile unsigned int BB_ext_atten_switch_ctl_b1; /* 0xb20c - 0xb210 */ -} bb_lc_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _BB_LC_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/efuse_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/efuse_reg.h deleted file mode 100644 index d0fe104ca5ef..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/efuse_reg.h +++ /dev/null @@ -1,108 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _EFUSE_REG_REG_H_ -#define _EFUSE_REG_REG_H_ - -#define EFUSE_WR_ENABLE_REG_ADDRESS 0x00000000 -#define EFUSE_WR_ENABLE_REG_OFFSET 0x00000000 -#define EFUSE_WR_ENABLE_REG_V_MSB 0 -#define EFUSE_WR_ENABLE_REG_V_LSB 0 -#define EFUSE_WR_ENABLE_REG_V_MASK 0x00000001 -#define EFUSE_WR_ENABLE_REG_V_GET(x) (((x) & EFUSE_WR_ENABLE_REG_V_MASK) >> EFUSE_WR_ENABLE_REG_V_LSB) -#define EFUSE_WR_ENABLE_REG_V_SET(x) (((x) << EFUSE_WR_ENABLE_REG_V_LSB) & EFUSE_WR_ENABLE_REG_V_MASK) - -#define EFUSE_INT_ENABLE_REG_ADDRESS 0x00000004 -#define EFUSE_INT_ENABLE_REG_OFFSET 0x00000004 -#define EFUSE_INT_ENABLE_REG_V_MSB 0 -#define EFUSE_INT_ENABLE_REG_V_LSB 0 -#define EFUSE_INT_ENABLE_REG_V_MASK 0x00000001 -#define EFUSE_INT_ENABLE_REG_V_GET(x) (((x) & EFUSE_INT_ENABLE_REG_V_MASK) >> EFUSE_INT_ENABLE_REG_V_LSB) -#define EFUSE_INT_ENABLE_REG_V_SET(x) (((x) << EFUSE_INT_ENABLE_REG_V_LSB) & EFUSE_INT_ENABLE_REG_V_MASK) - -#define EFUSE_INT_STATUS_REG_ADDRESS 0x00000008 -#define EFUSE_INT_STATUS_REG_OFFSET 0x00000008 -#define EFUSE_INT_STATUS_REG_V_MSB 0 -#define EFUSE_INT_STATUS_REG_V_LSB 0 -#define EFUSE_INT_STATUS_REG_V_MASK 0x00000001 -#define EFUSE_INT_STATUS_REG_V_GET(x) (((x) & EFUSE_INT_STATUS_REG_V_MASK) >> EFUSE_INT_STATUS_REG_V_LSB) -#define EFUSE_INT_STATUS_REG_V_SET(x) (((x) << EFUSE_INT_STATUS_REG_V_LSB) & EFUSE_INT_STATUS_REG_V_MASK) - -#define BITMASK_WR_REG_ADDRESS 0x0000000c -#define BITMASK_WR_REG_OFFSET 0x0000000c -#define BITMASK_WR_REG_V_MSB 31 -#define BITMASK_WR_REG_V_LSB 0 -#define BITMASK_WR_REG_V_MASK 0xffffffff -#define BITMASK_WR_REG_V_GET(x) (((x) & BITMASK_WR_REG_V_MASK) >> BITMASK_WR_REG_V_LSB) -#define BITMASK_WR_REG_V_SET(x) (((x) << BITMASK_WR_REG_V_LSB) & BITMASK_WR_REG_V_MASK) - -#define VDDQ_SETTLE_TIME_REG_ADDRESS 0x00000010 -#define VDDQ_SETTLE_TIME_REG_OFFSET 0x00000010 -#define VDDQ_SETTLE_TIME_REG_V_MSB 31 -#define VDDQ_SETTLE_TIME_REG_V_LSB 0 -#define VDDQ_SETTLE_TIME_REG_V_MASK 0xffffffff -#define VDDQ_SETTLE_TIME_REG_V_GET(x) (((x) & VDDQ_SETTLE_TIME_REG_V_MASK) >> VDDQ_SETTLE_TIME_REG_V_LSB) -#define VDDQ_SETTLE_TIME_REG_V_SET(x) (((x) << VDDQ_SETTLE_TIME_REG_V_LSB) & VDDQ_SETTLE_TIME_REG_V_MASK) - -#define RD_STROBE_PW_REG_ADDRESS 0x00000014 -#define RD_STROBE_PW_REG_OFFSET 0x00000014 -#define RD_STROBE_PW_REG_V_MSB 31 -#define RD_STROBE_PW_REG_V_LSB 0 -#define RD_STROBE_PW_REG_V_MASK 0xffffffff -#define RD_STROBE_PW_REG_V_GET(x) (((x) & RD_STROBE_PW_REG_V_MASK) >> RD_STROBE_PW_REG_V_LSB) -#define RD_STROBE_PW_REG_V_SET(x) (((x) << RD_STROBE_PW_REG_V_LSB) & RD_STROBE_PW_REG_V_MASK) - -#define PG_STROBE_PW_REG_ADDRESS 0x00000018 -#define PG_STROBE_PW_REG_OFFSET 0x00000018 -#define PG_STROBE_PW_REG_V_MSB 31 -#define PG_STROBE_PW_REG_V_LSB 0 -#define PG_STROBE_PW_REG_V_MASK 0xffffffff -#define PG_STROBE_PW_REG_V_GET(x) (((x) & PG_STROBE_PW_REG_V_MASK) >> PG_STROBE_PW_REG_V_LSB) -#define PG_STROBE_PW_REG_V_SET(x) (((x) << PG_STROBE_PW_REG_V_LSB) & PG_STROBE_PW_REG_V_MASK) - -#define EFUSE_INTF_ADDRESS 0x00000800 -#define EFUSE_INTF_OFFSET 0x00000800 -#define EFUSE_INTF_R_MSB 31 -#define EFUSE_INTF_R_LSB 0 -#define EFUSE_INTF_R_MASK 0xffffffff -#define EFUSE_INTF_R_GET(x) (((x) & EFUSE_INTF_R_MASK) >> EFUSE_INTF_R_LSB) -#define EFUSE_INTF_R_SET(x) (((x) << EFUSE_INTF_R_LSB) & EFUSE_INTF_R_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct efuse_reg_reg_s { - volatile unsigned int efuse_wr_enable_reg; - volatile unsigned int efuse_int_enable_reg; - volatile unsigned int efuse_int_status_reg; - volatile unsigned int bitmask_wr_reg; - volatile unsigned int vddq_settle_time_reg; - volatile unsigned int rd_strobe_pw_reg; - volatile unsigned int pg_strobe_pw_reg; - unsigned char pad0[2020]; /* pad to 0x800 */ - volatile unsigned int efuse_intf[512]; -} efuse_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _EFUSE_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/gpio_athr_wlan_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/gpio_athr_wlan_reg.h deleted file mode 100644 index 99e28885f337..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/gpio_athr_wlan_reg.h +++ /dev/null @@ -1,1253 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _GPIO_ATHR_WLAN_REG_REG_H_ -#define _GPIO_ATHR_WLAN_REG_REG_H_ - -#define WLAN_GPIO_OUT_ADDRESS 0x00000000 -#define WLAN_GPIO_OUT_OFFSET 0x00000000 -#define WLAN_GPIO_OUT_DATA_MSB 25 -#define WLAN_GPIO_OUT_DATA_LSB 0 -#define WLAN_GPIO_OUT_DATA_MASK 0x03ffffff -#define WLAN_GPIO_OUT_DATA_GET(x) (((x) & WLAN_GPIO_OUT_DATA_MASK) >> WLAN_GPIO_OUT_DATA_LSB) -#define WLAN_GPIO_OUT_DATA_SET(x) (((x) << WLAN_GPIO_OUT_DATA_LSB) & WLAN_GPIO_OUT_DATA_MASK) - -#define WLAN_GPIO_OUT_W1TS_ADDRESS 0x00000004 -#define WLAN_GPIO_OUT_W1TS_OFFSET 0x00000004 -#define WLAN_GPIO_OUT_W1TS_DATA_MSB 25 -#define WLAN_GPIO_OUT_W1TS_DATA_LSB 0 -#define WLAN_GPIO_OUT_W1TS_DATA_MASK 0x03ffffff -#define WLAN_GPIO_OUT_W1TS_DATA_GET(x) (((x) & WLAN_GPIO_OUT_W1TS_DATA_MASK) >> WLAN_GPIO_OUT_W1TS_DATA_LSB) -#define WLAN_GPIO_OUT_W1TS_DATA_SET(x) (((x) << WLAN_GPIO_OUT_W1TS_DATA_LSB) & WLAN_GPIO_OUT_W1TS_DATA_MASK) - -#define WLAN_GPIO_OUT_W1TC_ADDRESS 0x00000008 -#define WLAN_GPIO_OUT_W1TC_OFFSET 0x00000008 -#define WLAN_GPIO_OUT_W1TC_DATA_MSB 25 -#define WLAN_GPIO_OUT_W1TC_DATA_LSB 0 -#define WLAN_GPIO_OUT_W1TC_DATA_MASK 0x03ffffff -#define WLAN_GPIO_OUT_W1TC_DATA_GET(x) (((x) & WLAN_GPIO_OUT_W1TC_DATA_MASK) >> WLAN_GPIO_OUT_W1TC_DATA_LSB) -#define WLAN_GPIO_OUT_W1TC_DATA_SET(x) (((x) << WLAN_GPIO_OUT_W1TC_DATA_LSB) & WLAN_GPIO_OUT_W1TC_DATA_MASK) - -#define WLAN_GPIO_ENABLE_ADDRESS 0x0000000c -#define WLAN_GPIO_ENABLE_OFFSET 0x0000000c -#define WLAN_GPIO_ENABLE_DATA_MSB 25 -#define WLAN_GPIO_ENABLE_DATA_LSB 0 -#define WLAN_GPIO_ENABLE_DATA_MASK 0x03ffffff -#define WLAN_GPIO_ENABLE_DATA_GET(x) (((x) & WLAN_GPIO_ENABLE_DATA_MASK) >> WLAN_GPIO_ENABLE_DATA_LSB) -#define WLAN_GPIO_ENABLE_DATA_SET(x) (((x) << WLAN_GPIO_ENABLE_DATA_LSB) & WLAN_GPIO_ENABLE_DATA_MASK) - -#define WLAN_GPIO_ENABLE_W1TS_ADDRESS 0x00000010 -#define WLAN_GPIO_ENABLE_W1TS_OFFSET 0x00000010 -#define WLAN_GPIO_ENABLE_W1TS_DATA_MSB 25 -#define WLAN_GPIO_ENABLE_W1TS_DATA_LSB 0 -#define WLAN_GPIO_ENABLE_W1TS_DATA_MASK 0x03ffffff -#define WLAN_GPIO_ENABLE_W1TS_DATA_GET(x) (((x) & WLAN_GPIO_ENABLE_W1TS_DATA_MASK) >> WLAN_GPIO_ENABLE_W1TS_DATA_LSB) -#define WLAN_GPIO_ENABLE_W1TS_DATA_SET(x) (((x) << WLAN_GPIO_ENABLE_W1TS_DATA_LSB) & WLAN_GPIO_ENABLE_W1TS_DATA_MASK) - -#define WLAN_GPIO_ENABLE_W1TC_ADDRESS 0x00000014 -#define WLAN_GPIO_ENABLE_W1TC_OFFSET 0x00000014 -#define WLAN_GPIO_ENABLE_W1TC_DATA_MSB 25 -#define WLAN_GPIO_ENABLE_W1TC_DATA_LSB 0 -#define WLAN_GPIO_ENABLE_W1TC_DATA_MASK 0x03ffffff -#define WLAN_GPIO_ENABLE_W1TC_DATA_GET(x) (((x) & WLAN_GPIO_ENABLE_W1TC_DATA_MASK) >> WLAN_GPIO_ENABLE_W1TC_DATA_LSB) -#define WLAN_GPIO_ENABLE_W1TC_DATA_SET(x) (((x) << WLAN_GPIO_ENABLE_W1TC_DATA_LSB) & WLAN_GPIO_ENABLE_W1TC_DATA_MASK) - -#define WLAN_GPIO_IN_ADDRESS 0x00000018 -#define WLAN_GPIO_IN_OFFSET 0x00000018 -#define WLAN_GPIO_IN_DATA_MSB 25 -#define WLAN_GPIO_IN_DATA_LSB 0 -#define WLAN_GPIO_IN_DATA_MASK 0x03ffffff -#define WLAN_GPIO_IN_DATA_GET(x) (((x) & WLAN_GPIO_IN_DATA_MASK) >> WLAN_GPIO_IN_DATA_LSB) -#define WLAN_GPIO_IN_DATA_SET(x) (((x) << WLAN_GPIO_IN_DATA_LSB) & WLAN_GPIO_IN_DATA_MASK) - -#define WLAN_GPIO_STATUS_ADDRESS 0x0000001c -#define WLAN_GPIO_STATUS_OFFSET 0x0000001c -#define WLAN_GPIO_STATUS_INTERRUPT_MSB 25 -#define WLAN_GPIO_STATUS_INTERRUPT_LSB 0 -#define WLAN_GPIO_STATUS_INTERRUPT_MASK 0x03ffffff -#define WLAN_GPIO_STATUS_INTERRUPT_GET(x) (((x) & WLAN_GPIO_STATUS_INTERRUPT_MASK) >> WLAN_GPIO_STATUS_INTERRUPT_LSB) -#define WLAN_GPIO_STATUS_INTERRUPT_SET(x) (((x) << WLAN_GPIO_STATUS_INTERRUPT_LSB) & WLAN_GPIO_STATUS_INTERRUPT_MASK) - -#define WLAN_GPIO_STATUS_W1TS_ADDRESS 0x00000020 -#define WLAN_GPIO_STATUS_W1TS_OFFSET 0x00000020 -#define WLAN_GPIO_STATUS_W1TS_INTERRUPT_MSB 25 -#define WLAN_GPIO_STATUS_W1TS_INTERRUPT_LSB 0 -#define WLAN_GPIO_STATUS_W1TS_INTERRUPT_MASK 0x03ffffff -#define WLAN_GPIO_STATUS_W1TS_INTERRUPT_GET(x) (((x) & WLAN_GPIO_STATUS_W1TS_INTERRUPT_MASK) >> WLAN_GPIO_STATUS_W1TS_INTERRUPT_LSB) -#define WLAN_GPIO_STATUS_W1TS_INTERRUPT_SET(x) (((x) << WLAN_GPIO_STATUS_W1TS_INTERRUPT_LSB) & WLAN_GPIO_STATUS_W1TS_INTERRUPT_MASK) - -#define WLAN_GPIO_STATUS_W1TC_ADDRESS 0x00000024 -#define WLAN_GPIO_STATUS_W1TC_OFFSET 0x00000024 -#define WLAN_GPIO_STATUS_W1TC_INTERRUPT_MSB 25 -#define WLAN_GPIO_STATUS_W1TC_INTERRUPT_LSB 0 -#define WLAN_GPIO_STATUS_W1TC_INTERRUPT_MASK 0x03ffffff -#define WLAN_GPIO_STATUS_W1TC_INTERRUPT_GET(x) (((x) & WLAN_GPIO_STATUS_W1TC_INTERRUPT_MASK) >> WLAN_GPIO_STATUS_W1TC_INTERRUPT_LSB) -#define WLAN_GPIO_STATUS_W1TC_INTERRUPT_SET(x) (((x) << WLAN_GPIO_STATUS_W1TC_INTERRUPT_LSB) & WLAN_GPIO_STATUS_W1TC_INTERRUPT_MASK) - -#define WLAN_GPIO_PIN0_ADDRESS 0x00000028 -#define WLAN_GPIO_PIN0_OFFSET 0x00000028 -#define WLAN_GPIO_PIN0_CONFIG_MSB 13 -#define WLAN_GPIO_PIN0_CONFIG_LSB 11 -#define WLAN_GPIO_PIN0_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN0_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN0_CONFIG_MASK) >> WLAN_GPIO_PIN0_CONFIG_LSB) -#define WLAN_GPIO_PIN0_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN0_CONFIG_LSB) & WLAN_GPIO_PIN0_CONFIG_MASK) -#define WLAN_GPIO_PIN0_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN0_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN0_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN0_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN0_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN0_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN0_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN0_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN0_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN0_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN0_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN0_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN0_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN0_INT_TYPE_MASK) >> WLAN_GPIO_PIN0_INT_TYPE_LSB) -#define WLAN_GPIO_PIN0_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN0_INT_TYPE_LSB) & WLAN_GPIO_PIN0_INT_TYPE_MASK) -#define WLAN_GPIO_PIN0_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN0_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN0_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN0_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN0_PAD_PULL_MASK) >> WLAN_GPIO_PIN0_PAD_PULL_LSB) -#define WLAN_GPIO_PIN0_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN0_PAD_PULL_LSB) & WLAN_GPIO_PIN0_PAD_PULL_MASK) -#define WLAN_GPIO_PIN0_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN0_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN0_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN0_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN0_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN0_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN0_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN0_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN0_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN0_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN0_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN0_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN0_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN0_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN0_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN0_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN0_PAD_DRIVER_LSB) & WLAN_GPIO_PIN0_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN0_SOURCE_MSB 0 -#define WLAN_GPIO_PIN0_SOURCE_LSB 0 -#define WLAN_GPIO_PIN0_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN0_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN0_SOURCE_MASK) >> WLAN_GPIO_PIN0_SOURCE_LSB) -#define WLAN_GPIO_PIN0_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN0_SOURCE_LSB) & WLAN_GPIO_PIN0_SOURCE_MASK) - -#define WLAN_GPIO_PIN1_ADDRESS 0x0000002c -#define WLAN_GPIO_PIN1_OFFSET 0x0000002c -#define WLAN_GPIO_PIN1_CONFIG_MSB 13 -#define WLAN_GPIO_PIN1_CONFIG_LSB 11 -#define WLAN_GPIO_PIN1_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN1_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN1_CONFIG_MASK) >> WLAN_GPIO_PIN1_CONFIG_LSB) -#define WLAN_GPIO_PIN1_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN1_CONFIG_LSB) & WLAN_GPIO_PIN1_CONFIG_MASK) -#define WLAN_GPIO_PIN1_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN1_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN1_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN1_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN1_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN1_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN1_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN1_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN1_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN1_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN1_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN1_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN1_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN1_INT_TYPE_MASK) >> WLAN_GPIO_PIN1_INT_TYPE_LSB) -#define WLAN_GPIO_PIN1_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN1_INT_TYPE_LSB) & WLAN_GPIO_PIN1_INT_TYPE_MASK) -#define WLAN_GPIO_PIN1_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN1_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN1_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN1_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN1_PAD_PULL_MASK) >> WLAN_GPIO_PIN1_PAD_PULL_LSB) -#define WLAN_GPIO_PIN1_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN1_PAD_PULL_LSB) & WLAN_GPIO_PIN1_PAD_PULL_MASK) -#define WLAN_GPIO_PIN1_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN1_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN1_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN1_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN1_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN1_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN1_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN1_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN1_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN1_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN1_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN1_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN1_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN1_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN1_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN1_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN1_PAD_DRIVER_LSB) & WLAN_GPIO_PIN1_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN1_SOURCE_MSB 0 -#define WLAN_GPIO_PIN1_SOURCE_LSB 0 -#define WLAN_GPIO_PIN1_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN1_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN1_SOURCE_MASK) >> WLAN_GPIO_PIN1_SOURCE_LSB) -#define WLAN_GPIO_PIN1_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN1_SOURCE_LSB) & WLAN_GPIO_PIN1_SOURCE_MASK) - -#define WLAN_GPIO_PIN2_ADDRESS 0x00000030 -#define WLAN_GPIO_PIN2_OFFSET 0x00000030 -#define WLAN_GPIO_PIN2_CONFIG_MSB 13 -#define WLAN_GPIO_PIN2_CONFIG_LSB 11 -#define WLAN_GPIO_PIN2_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN2_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN2_CONFIG_MASK) >> WLAN_GPIO_PIN2_CONFIG_LSB) -#define WLAN_GPIO_PIN2_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN2_CONFIG_LSB) & WLAN_GPIO_PIN2_CONFIG_MASK) -#define WLAN_GPIO_PIN2_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN2_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN2_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN2_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN2_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN2_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN2_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN2_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN2_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN2_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN2_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN2_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN2_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN2_INT_TYPE_MASK) >> WLAN_GPIO_PIN2_INT_TYPE_LSB) -#define WLAN_GPIO_PIN2_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN2_INT_TYPE_LSB) & WLAN_GPIO_PIN2_INT_TYPE_MASK) -#define WLAN_GPIO_PIN2_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN2_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN2_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN2_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN2_PAD_PULL_MASK) >> WLAN_GPIO_PIN2_PAD_PULL_LSB) -#define WLAN_GPIO_PIN2_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN2_PAD_PULL_LSB) & WLAN_GPIO_PIN2_PAD_PULL_MASK) -#define WLAN_GPIO_PIN2_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN2_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN2_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN2_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN2_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN2_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN2_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN2_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN2_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN2_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN2_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN2_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN2_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN2_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN2_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN2_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN2_PAD_DRIVER_LSB) & WLAN_GPIO_PIN2_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN2_SOURCE_MSB 0 -#define WLAN_GPIO_PIN2_SOURCE_LSB 0 -#define WLAN_GPIO_PIN2_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN2_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN2_SOURCE_MASK) >> WLAN_GPIO_PIN2_SOURCE_LSB) -#define WLAN_GPIO_PIN2_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN2_SOURCE_LSB) & WLAN_GPIO_PIN2_SOURCE_MASK) - -#define WLAN_GPIO_PIN3_ADDRESS 0x00000034 -#define WLAN_GPIO_PIN3_OFFSET 0x00000034 -#define WLAN_GPIO_PIN3_CONFIG_MSB 13 -#define WLAN_GPIO_PIN3_CONFIG_LSB 11 -#define WLAN_GPIO_PIN3_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN3_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN3_CONFIG_MASK) >> WLAN_GPIO_PIN3_CONFIG_LSB) -#define WLAN_GPIO_PIN3_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN3_CONFIG_LSB) & WLAN_GPIO_PIN3_CONFIG_MASK) -#define WLAN_GPIO_PIN3_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN3_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN3_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN3_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN3_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN3_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN3_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN3_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN3_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN3_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN3_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN3_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN3_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN3_INT_TYPE_MASK) >> WLAN_GPIO_PIN3_INT_TYPE_LSB) -#define WLAN_GPIO_PIN3_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN3_INT_TYPE_LSB) & WLAN_GPIO_PIN3_INT_TYPE_MASK) -#define WLAN_GPIO_PIN3_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN3_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN3_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN3_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN3_PAD_PULL_MASK) >> WLAN_GPIO_PIN3_PAD_PULL_LSB) -#define WLAN_GPIO_PIN3_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN3_PAD_PULL_LSB) & WLAN_GPIO_PIN3_PAD_PULL_MASK) -#define WLAN_GPIO_PIN3_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN3_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN3_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN3_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN3_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN3_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN3_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN3_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN3_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN3_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN3_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN3_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN3_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN3_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN3_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN3_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN3_PAD_DRIVER_LSB) & WLAN_GPIO_PIN3_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN3_SOURCE_MSB 0 -#define WLAN_GPIO_PIN3_SOURCE_LSB 0 -#define WLAN_GPIO_PIN3_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN3_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN3_SOURCE_MASK) >> WLAN_GPIO_PIN3_SOURCE_LSB) -#define WLAN_GPIO_PIN3_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN3_SOURCE_LSB) & WLAN_GPIO_PIN3_SOURCE_MASK) - -#define WLAN_GPIO_PIN4_ADDRESS 0x00000038 -#define WLAN_GPIO_PIN4_OFFSET 0x00000038 -#define WLAN_GPIO_PIN4_CONFIG_MSB 13 -#define WLAN_GPIO_PIN4_CONFIG_LSB 11 -#define WLAN_GPIO_PIN4_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN4_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN4_CONFIG_MASK) >> WLAN_GPIO_PIN4_CONFIG_LSB) -#define WLAN_GPIO_PIN4_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN4_CONFIG_LSB) & WLAN_GPIO_PIN4_CONFIG_MASK) -#define WLAN_GPIO_PIN4_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN4_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN4_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN4_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN4_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN4_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN4_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN4_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN4_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN4_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN4_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN4_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN4_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN4_INT_TYPE_MASK) >> WLAN_GPIO_PIN4_INT_TYPE_LSB) -#define WLAN_GPIO_PIN4_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN4_INT_TYPE_LSB) & WLAN_GPIO_PIN4_INT_TYPE_MASK) -#define WLAN_GPIO_PIN4_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN4_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN4_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN4_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN4_PAD_PULL_MASK) >> WLAN_GPIO_PIN4_PAD_PULL_LSB) -#define WLAN_GPIO_PIN4_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN4_PAD_PULL_LSB) & WLAN_GPIO_PIN4_PAD_PULL_MASK) -#define WLAN_GPIO_PIN4_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN4_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN4_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN4_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN4_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN4_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN4_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN4_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN4_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN4_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN4_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN4_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN4_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN4_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN4_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN4_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN4_PAD_DRIVER_LSB) & WLAN_GPIO_PIN4_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN4_SOURCE_MSB 0 -#define WLAN_GPIO_PIN4_SOURCE_LSB 0 -#define WLAN_GPIO_PIN4_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN4_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN4_SOURCE_MASK) >> WLAN_GPIO_PIN4_SOURCE_LSB) -#define WLAN_GPIO_PIN4_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN4_SOURCE_LSB) & WLAN_GPIO_PIN4_SOURCE_MASK) - -#define WLAN_GPIO_PIN5_ADDRESS 0x0000003c -#define WLAN_GPIO_PIN5_OFFSET 0x0000003c -#define WLAN_GPIO_PIN5_CONFIG_MSB 13 -#define WLAN_GPIO_PIN5_CONFIG_LSB 11 -#define WLAN_GPIO_PIN5_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN5_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN5_CONFIG_MASK) >> WLAN_GPIO_PIN5_CONFIG_LSB) -#define WLAN_GPIO_PIN5_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN5_CONFIG_LSB) & WLAN_GPIO_PIN5_CONFIG_MASK) -#define WLAN_GPIO_PIN5_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN5_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN5_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN5_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN5_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN5_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN5_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN5_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN5_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN5_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN5_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN5_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN5_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN5_INT_TYPE_MASK) >> WLAN_GPIO_PIN5_INT_TYPE_LSB) -#define WLAN_GPIO_PIN5_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN5_INT_TYPE_LSB) & WLAN_GPIO_PIN5_INT_TYPE_MASK) -#define WLAN_GPIO_PIN5_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN5_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN5_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN5_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN5_PAD_PULL_MASK) >> WLAN_GPIO_PIN5_PAD_PULL_LSB) -#define WLAN_GPIO_PIN5_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN5_PAD_PULL_LSB) & WLAN_GPIO_PIN5_PAD_PULL_MASK) -#define WLAN_GPIO_PIN5_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN5_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN5_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN5_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN5_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN5_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN5_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN5_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN5_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN5_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN5_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN5_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN5_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN5_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN5_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN5_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN5_PAD_DRIVER_LSB) & WLAN_GPIO_PIN5_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN5_SOURCE_MSB 0 -#define WLAN_GPIO_PIN5_SOURCE_LSB 0 -#define WLAN_GPIO_PIN5_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN5_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN5_SOURCE_MASK) >> WLAN_GPIO_PIN5_SOURCE_LSB) -#define WLAN_GPIO_PIN5_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN5_SOURCE_LSB) & WLAN_GPIO_PIN5_SOURCE_MASK) - -#define WLAN_GPIO_PIN6_ADDRESS 0x00000040 -#define WLAN_GPIO_PIN6_OFFSET 0x00000040 -#define WLAN_GPIO_PIN6_CONFIG_MSB 13 -#define WLAN_GPIO_PIN6_CONFIG_LSB 11 -#define WLAN_GPIO_PIN6_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN6_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN6_CONFIG_MASK) >> WLAN_GPIO_PIN6_CONFIG_LSB) -#define WLAN_GPIO_PIN6_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN6_CONFIG_LSB) & WLAN_GPIO_PIN6_CONFIG_MASK) -#define WLAN_GPIO_PIN6_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN6_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN6_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN6_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN6_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN6_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN6_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN6_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN6_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN6_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN6_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN6_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN6_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN6_INT_TYPE_MASK) >> WLAN_GPIO_PIN6_INT_TYPE_LSB) -#define WLAN_GPIO_PIN6_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN6_INT_TYPE_LSB) & WLAN_GPIO_PIN6_INT_TYPE_MASK) -#define WLAN_GPIO_PIN6_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN6_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN6_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN6_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN6_PAD_PULL_MASK) >> WLAN_GPIO_PIN6_PAD_PULL_LSB) -#define WLAN_GPIO_PIN6_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN6_PAD_PULL_LSB) & WLAN_GPIO_PIN6_PAD_PULL_MASK) -#define WLAN_GPIO_PIN6_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN6_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN6_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN6_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN6_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN6_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN6_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN6_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN6_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN6_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN6_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN6_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN6_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN6_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN6_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN6_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN6_PAD_DRIVER_LSB) & WLAN_GPIO_PIN6_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN6_SOURCE_MSB 0 -#define WLAN_GPIO_PIN6_SOURCE_LSB 0 -#define WLAN_GPIO_PIN6_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN6_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN6_SOURCE_MASK) >> WLAN_GPIO_PIN6_SOURCE_LSB) -#define WLAN_GPIO_PIN6_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN6_SOURCE_LSB) & WLAN_GPIO_PIN6_SOURCE_MASK) - -#define WLAN_GPIO_PIN7_ADDRESS 0x00000044 -#define WLAN_GPIO_PIN7_OFFSET 0x00000044 -#define WLAN_GPIO_PIN7_CONFIG_MSB 13 -#define WLAN_GPIO_PIN7_CONFIG_LSB 11 -#define WLAN_GPIO_PIN7_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN7_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN7_CONFIG_MASK) >> WLAN_GPIO_PIN7_CONFIG_LSB) -#define WLAN_GPIO_PIN7_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN7_CONFIG_LSB) & WLAN_GPIO_PIN7_CONFIG_MASK) -#define WLAN_GPIO_PIN7_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN7_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN7_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN7_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN7_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN7_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN7_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN7_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN7_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN7_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN7_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN7_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN7_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN7_INT_TYPE_MASK) >> WLAN_GPIO_PIN7_INT_TYPE_LSB) -#define WLAN_GPIO_PIN7_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN7_INT_TYPE_LSB) & WLAN_GPIO_PIN7_INT_TYPE_MASK) -#define WLAN_GPIO_PIN7_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN7_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN7_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN7_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN7_PAD_PULL_MASK) >> WLAN_GPIO_PIN7_PAD_PULL_LSB) -#define WLAN_GPIO_PIN7_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN7_PAD_PULL_LSB) & WLAN_GPIO_PIN7_PAD_PULL_MASK) -#define WLAN_GPIO_PIN7_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN7_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN7_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN7_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN7_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN7_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN7_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN7_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN7_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN7_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN7_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN7_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN7_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN7_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN7_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN7_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN7_PAD_DRIVER_LSB) & WLAN_GPIO_PIN7_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN7_SOURCE_MSB 0 -#define WLAN_GPIO_PIN7_SOURCE_LSB 0 -#define WLAN_GPIO_PIN7_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN7_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN7_SOURCE_MASK) >> WLAN_GPIO_PIN7_SOURCE_LSB) -#define WLAN_GPIO_PIN7_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN7_SOURCE_LSB) & WLAN_GPIO_PIN7_SOURCE_MASK) - -#define WLAN_GPIO_PIN8_ADDRESS 0x00000048 -#define WLAN_GPIO_PIN8_OFFSET 0x00000048 -#define WLAN_GPIO_PIN8_CONFIG_MSB 13 -#define WLAN_GPIO_PIN8_CONFIG_LSB 11 -#define WLAN_GPIO_PIN8_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN8_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN8_CONFIG_MASK) >> WLAN_GPIO_PIN8_CONFIG_LSB) -#define WLAN_GPIO_PIN8_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN8_CONFIG_LSB) & WLAN_GPIO_PIN8_CONFIG_MASK) -#define WLAN_GPIO_PIN8_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN8_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN8_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN8_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN8_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN8_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN8_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN8_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN8_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN8_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN8_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN8_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN8_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN8_INT_TYPE_MASK) >> WLAN_GPIO_PIN8_INT_TYPE_LSB) -#define WLAN_GPIO_PIN8_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN8_INT_TYPE_LSB) & WLAN_GPIO_PIN8_INT_TYPE_MASK) -#define WLAN_GPIO_PIN8_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN8_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN8_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN8_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN8_PAD_PULL_MASK) >> WLAN_GPIO_PIN8_PAD_PULL_LSB) -#define WLAN_GPIO_PIN8_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN8_PAD_PULL_LSB) & WLAN_GPIO_PIN8_PAD_PULL_MASK) -#define WLAN_GPIO_PIN8_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN8_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN8_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN8_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN8_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN8_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN8_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN8_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN8_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN8_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN8_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN8_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN8_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN8_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN8_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN8_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN8_PAD_DRIVER_LSB) & WLAN_GPIO_PIN8_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN8_SOURCE_MSB 0 -#define WLAN_GPIO_PIN8_SOURCE_LSB 0 -#define WLAN_GPIO_PIN8_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN8_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN8_SOURCE_MASK) >> WLAN_GPIO_PIN8_SOURCE_LSB) -#define WLAN_GPIO_PIN8_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN8_SOURCE_LSB) & WLAN_GPIO_PIN8_SOURCE_MASK) - -#define WLAN_GPIO_PIN9_ADDRESS 0x0000004c -#define WLAN_GPIO_PIN9_OFFSET 0x0000004c -#define WLAN_GPIO_PIN9_CONFIG_MSB 13 -#define WLAN_GPIO_PIN9_CONFIG_LSB 11 -#define WLAN_GPIO_PIN9_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN9_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN9_CONFIG_MASK) >> WLAN_GPIO_PIN9_CONFIG_LSB) -#define WLAN_GPIO_PIN9_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN9_CONFIG_LSB) & WLAN_GPIO_PIN9_CONFIG_MASK) -#define WLAN_GPIO_PIN9_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN9_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN9_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN9_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN9_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN9_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN9_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN9_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN9_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN9_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN9_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN9_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN9_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN9_INT_TYPE_MASK) >> WLAN_GPIO_PIN9_INT_TYPE_LSB) -#define WLAN_GPIO_PIN9_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN9_INT_TYPE_LSB) & WLAN_GPIO_PIN9_INT_TYPE_MASK) -#define WLAN_GPIO_PIN9_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN9_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN9_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN9_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN9_PAD_PULL_MASK) >> WLAN_GPIO_PIN9_PAD_PULL_LSB) -#define WLAN_GPIO_PIN9_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN9_PAD_PULL_LSB) & WLAN_GPIO_PIN9_PAD_PULL_MASK) -#define WLAN_GPIO_PIN9_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN9_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN9_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN9_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN9_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN9_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN9_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN9_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN9_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN9_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN9_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN9_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN9_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN9_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN9_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN9_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN9_PAD_DRIVER_LSB) & WLAN_GPIO_PIN9_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN9_SOURCE_MSB 0 -#define WLAN_GPIO_PIN9_SOURCE_LSB 0 -#define WLAN_GPIO_PIN9_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN9_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN9_SOURCE_MASK) >> WLAN_GPIO_PIN9_SOURCE_LSB) -#define WLAN_GPIO_PIN9_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN9_SOURCE_LSB) & WLAN_GPIO_PIN9_SOURCE_MASK) - -#define WLAN_GPIO_PIN10_ADDRESS 0x00000050 -#define WLAN_GPIO_PIN10_OFFSET 0x00000050 -#define WLAN_GPIO_PIN10_CONFIG_MSB 13 -#define WLAN_GPIO_PIN10_CONFIG_LSB 11 -#define WLAN_GPIO_PIN10_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN10_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN10_CONFIG_MASK) >> WLAN_GPIO_PIN10_CONFIG_LSB) -#define WLAN_GPIO_PIN10_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN10_CONFIG_LSB) & WLAN_GPIO_PIN10_CONFIG_MASK) -#define WLAN_GPIO_PIN10_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN10_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN10_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN10_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN10_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN10_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN10_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN10_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN10_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN10_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN10_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN10_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN10_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN10_INT_TYPE_MASK) >> WLAN_GPIO_PIN10_INT_TYPE_LSB) -#define WLAN_GPIO_PIN10_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN10_INT_TYPE_LSB) & WLAN_GPIO_PIN10_INT_TYPE_MASK) -#define WLAN_GPIO_PIN10_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN10_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN10_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN10_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN10_PAD_PULL_MASK) >> WLAN_GPIO_PIN10_PAD_PULL_LSB) -#define WLAN_GPIO_PIN10_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN10_PAD_PULL_LSB) & WLAN_GPIO_PIN10_PAD_PULL_MASK) -#define WLAN_GPIO_PIN10_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN10_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN10_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN10_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN10_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN10_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN10_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN10_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN10_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN10_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN10_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN10_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN10_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN10_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN10_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN10_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN10_PAD_DRIVER_LSB) & WLAN_GPIO_PIN10_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN10_SOURCE_MSB 0 -#define WLAN_GPIO_PIN10_SOURCE_LSB 0 -#define WLAN_GPIO_PIN10_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN10_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN10_SOURCE_MASK) >> WLAN_GPIO_PIN10_SOURCE_LSB) -#define WLAN_GPIO_PIN10_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN10_SOURCE_LSB) & WLAN_GPIO_PIN10_SOURCE_MASK) - -#define WLAN_GPIO_PIN11_ADDRESS 0x00000054 -#define WLAN_GPIO_PIN11_OFFSET 0x00000054 -#define WLAN_GPIO_PIN11_CONFIG_MSB 13 -#define WLAN_GPIO_PIN11_CONFIG_LSB 11 -#define WLAN_GPIO_PIN11_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN11_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN11_CONFIG_MASK) >> WLAN_GPIO_PIN11_CONFIG_LSB) -#define WLAN_GPIO_PIN11_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN11_CONFIG_LSB) & WLAN_GPIO_PIN11_CONFIG_MASK) -#define WLAN_GPIO_PIN11_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN11_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN11_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN11_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN11_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN11_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN11_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN11_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN11_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN11_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN11_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN11_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN11_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN11_INT_TYPE_MASK) >> WLAN_GPIO_PIN11_INT_TYPE_LSB) -#define WLAN_GPIO_PIN11_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN11_INT_TYPE_LSB) & WLAN_GPIO_PIN11_INT_TYPE_MASK) -#define WLAN_GPIO_PIN11_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN11_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN11_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN11_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN11_PAD_PULL_MASK) >> WLAN_GPIO_PIN11_PAD_PULL_LSB) -#define WLAN_GPIO_PIN11_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN11_PAD_PULL_LSB) & WLAN_GPIO_PIN11_PAD_PULL_MASK) -#define WLAN_GPIO_PIN11_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN11_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN11_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN11_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN11_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN11_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN11_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN11_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN11_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN11_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN11_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN11_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN11_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN11_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN11_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN11_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN11_PAD_DRIVER_LSB) & WLAN_GPIO_PIN11_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN11_SOURCE_MSB 0 -#define WLAN_GPIO_PIN11_SOURCE_LSB 0 -#define WLAN_GPIO_PIN11_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN11_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN11_SOURCE_MASK) >> WLAN_GPIO_PIN11_SOURCE_LSB) -#define WLAN_GPIO_PIN11_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN11_SOURCE_LSB) & WLAN_GPIO_PIN11_SOURCE_MASK) - -#define WLAN_GPIO_PIN12_ADDRESS 0x00000058 -#define WLAN_GPIO_PIN12_OFFSET 0x00000058 -#define WLAN_GPIO_PIN12_CONFIG_MSB 13 -#define WLAN_GPIO_PIN12_CONFIG_LSB 11 -#define WLAN_GPIO_PIN12_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN12_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN12_CONFIG_MASK) >> WLAN_GPIO_PIN12_CONFIG_LSB) -#define WLAN_GPIO_PIN12_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN12_CONFIG_LSB) & WLAN_GPIO_PIN12_CONFIG_MASK) -#define WLAN_GPIO_PIN12_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN12_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN12_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN12_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN12_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN12_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN12_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN12_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN12_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN12_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN12_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN12_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN12_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN12_INT_TYPE_MASK) >> WLAN_GPIO_PIN12_INT_TYPE_LSB) -#define WLAN_GPIO_PIN12_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN12_INT_TYPE_LSB) & WLAN_GPIO_PIN12_INT_TYPE_MASK) -#define WLAN_GPIO_PIN12_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN12_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN12_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN12_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN12_PAD_PULL_MASK) >> WLAN_GPIO_PIN12_PAD_PULL_LSB) -#define WLAN_GPIO_PIN12_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN12_PAD_PULL_LSB) & WLAN_GPIO_PIN12_PAD_PULL_MASK) -#define WLAN_GPIO_PIN12_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN12_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN12_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN12_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN12_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN12_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN12_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN12_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN12_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN12_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN12_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN12_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN12_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN12_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN12_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN12_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN12_PAD_DRIVER_LSB) & WLAN_GPIO_PIN12_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN12_SOURCE_MSB 0 -#define WLAN_GPIO_PIN12_SOURCE_LSB 0 -#define WLAN_GPIO_PIN12_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN12_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN12_SOURCE_MASK) >> WLAN_GPIO_PIN12_SOURCE_LSB) -#define WLAN_GPIO_PIN12_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN12_SOURCE_LSB) & WLAN_GPIO_PIN12_SOURCE_MASK) - -#define WLAN_GPIO_PIN13_ADDRESS 0x0000005c -#define WLAN_GPIO_PIN13_OFFSET 0x0000005c -#define WLAN_GPIO_PIN13_CONFIG_MSB 13 -#define WLAN_GPIO_PIN13_CONFIG_LSB 11 -#define WLAN_GPIO_PIN13_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN13_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN13_CONFIG_MASK) >> WLAN_GPIO_PIN13_CONFIG_LSB) -#define WLAN_GPIO_PIN13_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN13_CONFIG_LSB) & WLAN_GPIO_PIN13_CONFIG_MASK) -#define WLAN_GPIO_PIN13_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN13_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN13_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN13_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN13_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN13_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN13_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN13_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN13_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN13_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN13_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN13_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN13_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN13_INT_TYPE_MASK) >> WLAN_GPIO_PIN13_INT_TYPE_LSB) -#define WLAN_GPIO_PIN13_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN13_INT_TYPE_LSB) & WLAN_GPIO_PIN13_INT_TYPE_MASK) -#define WLAN_GPIO_PIN13_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN13_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN13_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN13_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN13_PAD_PULL_MASK) >> WLAN_GPIO_PIN13_PAD_PULL_LSB) -#define WLAN_GPIO_PIN13_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN13_PAD_PULL_LSB) & WLAN_GPIO_PIN13_PAD_PULL_MASK) -#define WLAN_GPIO_PIN13_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN13_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN13_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN13_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN13_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN13_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN13_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN13_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN13_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN13_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN13_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN13_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN13_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN13_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN13_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN13_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN13_PAD_DRIVER_LSB) & WLAN_GPIO_PIN13_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN13_SOURCE_MSB 0 -#define WLAN_GPIO_PIN13_SOURCE_LSB 0 -#define WLAN_GPIO_PIN13_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN13_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN13_SOURCE_MASK) >> WLAN_GPIO_PIN13_SOURCE_LSB) -#define WLAN_GPIO_PIN13_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN13_SOURCE_LSB) & WLAN_GPIO_PIN13_SOURCE_MASK) - -#define WLAN_GPIO_PIN14_ADDRESS 0x00000060 -#define WLAN_GPIO_PIN14_OFFSET 0x00000060 -#define WLAN_GPIO_PIN14_CONFIG_MSB 13 -#define WLAN_GPIO_PIN14_CONFIG_LSB 11 -#define WLAN_GPIO_PIN14_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN14_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN14_CONFIG_MASK) >> WLAN_GPIO_PIN14_CONFIG_LSB) -#define WLAN_GPIO_PIN14_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN14_CONFIG_LSB) & WLAN_GPIO_PIN14_CONFIG_MASK) -#define WLAN_GPIO_PIN14_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN14_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN14_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN14_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN14_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN14_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN14_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN14_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN14_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN14_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN14_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN14_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN14_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN14_INT_TYPE_MASK) >> WLAN_GPIO_PIN14_INT_TYPE_LSB) -#define WLAN_GPIO_PIN14_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN14_INT_TYPE_LSB) & WLAN_GPIO_PIN14_INT_TYPE_MASK) -#define WLAN_GPIO_PIN14_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN14_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN14_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN14_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN14_PAD_PULL_MASK) >> WLAN_GPIO_PIN14_PAD_PULL_LSB) -#define WLAN_GPIO_PIN14_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN14_PAD_PULL_LSB) & WLAN_GPIO_PIN14_PAD_PULL_MASK) -#define WLAN_GPIO_PIN14_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN14_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN14_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN14_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN14_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN14_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN14_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN14_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN14_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN14_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN14_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN14_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN14_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN14_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN14_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN14_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN14_PAD_DRIVER_LSB) & WLAN_GPIO_PIN14_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN14_SOURCE_MSB 0 -#define WLAN_GPIO_PIN14_SOURCE_LSB 0 -#define WLAN_GPIO_PIN14_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN14_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN14_SOURCE_MASK) >> WLAN_GPIO_PIN14_SOURCE_LSB) -#define WLAN_GPIO_PIN14_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN14_SOURCE_LSB) & WLAN_GPIO_PIN14_SOURCE_MASK) - -#define WLAN_GPIO_PIN15_ADDRESS 0x00000064 -#define WLAN_GPIO_PIN15_OFFSET 0x00000064 -#define WLAN_GPIO_PIN15_CONFIG_MSB 13 -#define WLAN_GPIO_PIN15_CONFIG_LSB 11 -#define WLAN_GPIO_PIN15_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN15_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN15_CONFIG_MASK) >> WLAN_GPIO_PIN15_CONFIG_LSB) -#define WLAN_GPIO_PIN15_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN15_CONFIG_LSB) & WLAN_GPIO_PIN15_CONFIG_MASK) -#define WLAN_GPIO_PIN15_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN15_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN15_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN15_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN15_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN15_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN15_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN15_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN15_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN15_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN15_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN15_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN15_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN15_INT_TYPE_MASK) >> WLAN_GPIO_PIN15_INT_TYPE_LSB) -#define WLAN_GPIO_PIN15_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN15_INT_TYPE_LSB) & WLAN_GPIO_PIN15_INT_TYPE_MASK) -#define WLAN_GPIO_PIN15_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN15_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN15_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN15_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN15_PAD_PULL_MASK) >> WLAN_GPIO_PIN15_PAD_PULL_LSB) -#define WLAN_GPIO_PIN15_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN15_PAD_PULL_LSB) & WLAN_GPIO_PIN15_PAD_PULL_MASK) -#define WLAN_GPIO_PIN15_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN15_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN15_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN15_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN15_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN15_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN15_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN15_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN15_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN15_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN15_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN15_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN15_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN15_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN15_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN15_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN15_PAD_DRIVER_LSB) & WLAN_GPIO_PIN15_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN15_SOURCE_MSB 0 -#define WLAN_GPIO_PIN15_SOURCE_LSB 0 -#define WLAN_GPIO_PIN15_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN15_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN15_SOURCE_MASK) >> WLAN_GPIO_PIN15_SOURCE_LSB) -#define WLAN_GPIO_PIN15_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN15_SOURCE_LSB) & WLAN_GPIO_PIN15_SOURCE_MASK) - -#define WLAN_GPIO_PIN16_ADDRESS 0x00000068 -#define WLAN_GPIO_PIN16_OFFSET 0x00000068 -#define WLAN_GPIO_PIN16_CONFIG_MSB 13 -#define WLAN_GPIO_PIN16_CONFIG_LSB 11 -#define WLAN_GPIO_PIN16_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN16_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN16_CONFIG_MASK) >> WLAN_GPIO_PIN16_CONFIG_LSB) -#define WLAN_GPIO_PIN16_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN16_CONFIG_LSB) & WLAN_GPIO_PIN16_CONFIG_MASK) -#define WLAN_GPIO_PIN16_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN16_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN16_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN16_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN16_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN16_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN16_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN16_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN16_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN16_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN16_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN16_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN16_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN16_INT_TYPE_MASK) >> WLAN_GPIO_PIN16_INT_TYPE_LSB) -#define WLAN_GPIO_PIN16_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN16_INT_TYPE_LSB) & WLAN_GPIO_PIN16_INT_TYPE_MASK) -#define WLAN_GPIO_PIN16_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN16_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN16_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN16_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN16_PAD_PULL_MASK) >> WLAN_GPIO_PIN16_PAD_PULL_LSB) -#define WLAN_GPIO_PIN16_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN16_PAD_PULL_LSB) & WLAN_GPIO_PIN16_PAD_PULL_MASK) -#define WLAN_GPIO_PIN16_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN16_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN16_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN16_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN16_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN16_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN16_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN16_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN16_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN16_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN16_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN16_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN16_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN16_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN16_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN16_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN16_PAD_DRIVER_LSB) & WLAN_GPIO_PIN16_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN16_SOURCE_MSB 0 -#define WLAN_GPIO_PIN16_SOURCE_LSB 0 -#define WLAN_GPIO_PIN16_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN16_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN16_SOURCE_MASK) >> WLAN_GPIO_PIN16_SOURCE_LSB) -#define WLAN_GPIO_PIN16_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN16_SOURCE_LSB) & WLAN_GPIO_PIN16_SOURCE_MASK) - -#define WLAN_GPIO_PIN17_ADDRESS 0x0000006c -#define WLAN_GPIO_PIN17_OFFSET 0x0000006c -#define WLAN_GPIO_PIN17_CONFIG_MSB 13 -#define WLAN_GPIO_PIN17_CONFIG_LSB 11 -#define WLAN_GPIO_PIN17_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN17_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN17_CONFIG_MASK) >> WLAN_GPIO_PIN17_CONFIG_LSB) -#define WLAN_GPIO_PIN17_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN17_CONFIG_LSB) & WLAN_GPIO_PIN17_CONFIG_MASK) -#define WLAN_GPIO_PIN17_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN17_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN17_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN17_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN17_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN17_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN17_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN17_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN17_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN17_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN17_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN17_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN17_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN17_INT_TYPE_MASK) >> WLAN_GPIO_PIN17_INT_TYPE_LSB) -#define WLAN_GPIO_PIN17_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN17_INT_TYPE_LSB) & WLAN_GPIO_PIN17_INT_TYPE_MASK) -#define WLAN_GPIO_PIN17_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN17_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN17_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN17_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN17_PAD_PULL_MASK) >> WLAN_GPIO_PIN17_PAD_PULL_LSB) -#define WLAN_GPIO_PIN17_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN17_PAD_PULL_LSB) & WLAN_GPIO_PIN17_PAD_PULL_MASK) -#define WLAN_GPIO_PIN17_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN17_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN17_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN17_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN17_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN17_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN17_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN17_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN17_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN17_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN17_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN17_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN17_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN17_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN17_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN17_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN17_PAD_DRIVER_LSB) & WLAN_GPIO_PIN17_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN17_SOURCE_MSB 0 -#define WLAN_GPIO_PIN17_SOURCE_LSB 0 -#define WLAN_GPIO_PIN17_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN17_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN17_SOURCE_MASK) >> WLAN_GPIO_PIN17_SOURCE_LSB) -#define WLAN_GPIO_PIN17_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN17_SOURCE_LSB) & WLAN_GPIO_PIN17_SOURCE_MASK) - -#define WLAN_GPIO_PIN18_ADDRESS 0x00000070 -#define WLAN_GPIO_PIN18_OFFSET 0x00000070 -#define WLAN_GPIO_PIN18_CONFIG_MSB 13 -#define WLAN_GPIO_PIN18_CONFIG_LSB 11 -#define WLAN_GPIO_PIN18_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN18_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN18_CONFIG_MASK) >> WLAN_GPIO_PIN18_CONFIG_LSB) -#define WLAN_GPIO_PIN18_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN18_CONFIG_LSB) & WLAN_GPIO_PIN18_CONFIG_MASK) -#define WLAN_GPIO_PIN18_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN18_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN18_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN18_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN18_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN18_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN18_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN18_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN18_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN18_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN18_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN18_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN18_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN18_INT_TYPE_MASK) >> WLAN_GPIO_PIN18_INT_TYPE_LSB) -#define WLAN_GPIO_PIN18_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN18_INT_TYPE_LSB) & WLAN_GPIO_PIN18_INT_TYPE_MASK) -#define WLAN_GPIO_PIN18_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN18_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN18_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN18_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN18_PAD_PULL_MASK) >> WLAN_GPIO_PIN18_PAD_PULL_LSB) -#define WLAN_GPIO_PIN18_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN18_PAD_PULL_LSB) & WLAN_GPIO_PIN18_PAD_PULL_MASK) -#define WLAN_GPIO_PIN18_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN18_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN18_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN18_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN18_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN18_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN18_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN18_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN18_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN18_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN18_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN18_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN18_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN18_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN18_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN18_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN18_PAD_DRIVER_LSB) & WLAN_GPIO_PIN18_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN18_SOURCE_MSB 0 -#define WLAN_GPIO_PIN18_SOURCE_LSB 0 -#define WLAN_GPIO_PIN18_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN18_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN18_SOURCE_MASK) >> WLAN_GPIO_PIN18_SOURCE_LSB) -#define WLAN_GPIO_PIN18_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN18_SOURCE_LSB) & WLAN_GPIO_PIN18_SOURCE_MASK) - -#define WLAN_GPIO_PIN19_ADDRESS 0x00000074 -#define WLAN_GPIO_PIN19_OFFSET 0x00000074 -#define WLAN_GPIO_PIN19_CONFIG_MSB 13 -#define WLAN_GPIO_PIN19_CONFIG_LSB 11 -#define WLAN_GPIO_PIN19_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN19_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN19_CONFIG_MASK) >> WLAN_GPIO_PIN19_CONFIG_LSB) -#define WLAN_GPIO_PIN19_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN19_CONFIG_LSB) & WLAN_GPIO_PIN19_CONFIG_MASK) -#define WLAN_GPIO_PIN19_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN19_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN19_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN19_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN19_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN19_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN19_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN19_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN19_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN19_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN19_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN19_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN19_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN19_INT_TYPE_MASK) >> WLAN_GPIO_PIN19_INT_TYPE_LSB) -#define WLAN_GPIO_PIN19_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN19_INT_TYPE_LSB) & WLAN_GPIO_PIN19_INT_TYPE_MASK) -#define WLAN_GPIO_PIN19_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN19_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN19_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN19_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN19_PAD_PULL_MASK) >> WLAN_GPIO_PIN19_PAD_PULL_LSB) -#define WLAN_GPIO_PIN19_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN19_PAD_PULL_LSB) & WLAN_GPIO_PIN19_PAD_PULL_MASK) -#define WLAN_GPIO_PIN19_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN19_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN19_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN19_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN19_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN19_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN19_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN19_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN19_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN19_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN19_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN19_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN19_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN19_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN19_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN19_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN19_PAD_DRIVER_LSB) & WLAN_GPIO_PIN19_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN19_SOURCE_MSB 0 -#define WLAN_GPIO_PIN19_SOURCE_LSB 0 -#define WLAN_GPIO_PIN19_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN19_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN19_SOURCE_MASK) >> WLAN_GPIO_PIN19_SOURCE_LSB) -#define WLAN_GPIO_PIN19_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN19_SOURCE_LSB) & WLAN_GPIO_PIN19_SOURCE_MASK) - -#define WLAN_GPIO_PIN20_ADDRESS 0x00000078 -#define WLAN_GPIO_PIN20_OFFSET 0x00000078 -#define WLAN_GPIO_PIN20_CONFIG_MSB 13 -#define WLAN_GPIO_PIN20_CONFIG_LSB 11 -#define WLAN_GPIO_PIN20_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN20_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN20_CONFIG_MASK) >> WLAN_GPIO_PIN20_CONFIG_LSB) -#define WLAN_GPIO_PIN20_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN20_CONFIG_LSB) & WLAN_GPIO_PIN20_CONFIG_MASK) -#define WLAN_GPIO_PIN20_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN20_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN20_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN20_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN20_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN20_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN20_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN20_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN20_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN20_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN20_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN20_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN20_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN20_INT_TYPE_MASK) >> WLAN_GPIO_PIN20_INT_TYPE_LSB) -#define WLAN_GPIO_PIN20_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN20_INT_TYPE_LSB) & WLAN_GPIO_PIN20_INT_TYPE_MASK) -#define WLAN_GPIO_PIN20_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN20_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN20_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN20_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN20_PAD_PULL_MASK) >> WLAN_GPIO_PIN20_PAD_PULL_LSB) -#define WLAN_GPIO_PIN20_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN20_PAD_PULL_LSB) & WLAN_GPIO_PIN20_PAD_PULL_MASK) -#define WLAN_GPIO_PIN20_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN20_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN20_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN20_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN20_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN20_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN20_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN20_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN20_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN20_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN20_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN20_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN20_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN20_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN20_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN20_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN20_PAD_DRIVER_LSB) & WLAN_GPIO_PIN20_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN20_SOURCE_MSB 0 -#define WLAN_GPIO_PIN20_SOURCE_LSB 0 -#define WLAN_GPIO_PIN20_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN20_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN20_SOURCE_MASK) >> WLAN_GPIO_PIN20_SOURCE_LSB) -#define WLAN_GPIO_PIN20_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN20_SOURCE_LSB) & WLAN_GPIO_PIN20_SOURCE_MASK) - -#define WLAN_GPIO_PIN21_ADDRESS 0x0000007c -#define WLAN_GPIO_PIN21_OFFSET 0x0000007c -#define WLAN_GPIO_PIN21_CONFIG_MSB 13 -#define WLAN_GPIO_PIN21_CONFIG_LSB 11 -#define WLAN_GPIO_PIN21_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN21_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN21_CONFIG_MASK) >> WLAN_GPIO_PIN21_CONFIG_LSB) -#define WLAN_GPIO_PIN21_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN21_CONFIG_LSB) & WLAN_GPIO_PIN21_CONFIG_MASK) -#define WLAN_GPIO_PIN21_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN21_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN21_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN21_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN21_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN21_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN21_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN21_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN21_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN21_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN21_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN21_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN21_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN21_INT_TYPE_MASK) >> WLAN_GPIO_PIN21_INT_TYPE_LSB) -#define WLAN_GPIO_PIN21_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN21_INT_TYPE_LSB) & WLAN_GPIO_PIN21_INT_TYPE_MASK) -#define WLAN_GPIO_PIN21_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN21_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN21_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN21_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN21_PAD_PULL_MASK) >> WLAN_GPIO_PIN21_PAD_PULL_LSB) -#define WLAN_GPIO_PIN21_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN21_PAD_PULL_LSB) & WLAN_GPIO_PIN21_PAD_PULL_MASK) -#define WLAN_GPIO_PIN21_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN21_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN21_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN21_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN21_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN21_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN21_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN21_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN21_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN21_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN21_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN21_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN21_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN21_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN21_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN21_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN21_PAD_DRIVER_LSB) & WLAN_GPIO_PIN21_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN21_SOURCE_MSB 0 -#define WLAN_GPIO_PIN21_SOURCE_LSB 0 -#define WLAN_GPIO_PIN21_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN21_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN21_SOURCE_MASK) >> WLAN_GPIO_PIN21_SOURCE_LSB) -#define WLAN_GPIO_PIN21_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN21_SOURCE_LSB) & WLAN_GPIO_PIN21_SOURCE_MASK) - -#define WLAN_GPIO_PIN22_ADDRESS 0x00000080 -#define WLAN_GPIO_PIN22_OFFSET 0x00000080 -#define WLAN_GPIO_PIN22_CONFIG_MSB 13 -#define WLAN_GPIO_PIN22_CONFIG_LSB 11 -#define WLAN_GPIO_PIN22_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN22_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN22_CONFIG_MASK) >> WLAN_GPIO_PIN22_CONFIG_LSB) -#define WLAN_GPIO_PIN22_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN22_CONFIG_LSB) & WLAN_GPIO_PIN22_CONFIG_MASK) -#define WLAN_GPIO_PIN22_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN22_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN22_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN22_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN22_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN22_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN22_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN22_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN22_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN22_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN22_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN22_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN22_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN22_INT_TYPE_MASK) >> WLAN_GPIO_PIN22_INT_TYPE_LSB) -#define WLAN_GPIO_PIN22_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN22_INT_TYPE_LSB) & WLAN_GPIO_PIN22_INT_TYPE_MASK) -#define WLAN_GPIO_PIN22_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN22_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN22_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN22_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN22_PAD_PULL_MASK) >> WLAN_GPIO_PIN22_PAD_PULL_LSB) -#define WLAN_GPIO_PIN22_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN22_PAD_PULL_LSB) & WLAN_GPIO_PIN22_PAD_PULL_MASK) -#define WLAN_GPIO_PIN22_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN22_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN22_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN22_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN22_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN22_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN22_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN22_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN22_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN22_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN22_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN22_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN22_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN22_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN22_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN22_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN22_PAD_DRIVER_LSB) & WLAN_GPIO_PIN22_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN22_SOURCE_MSB 0 -#define WLAN_GPIO_PIN22_SOURCE_LSB 0 -#define WLAN_GPIO_PIN22_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN22_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN22_SOURCE_MASK) >> WLAN_GPIO_PIN22_SOURCE_LSB) -#define WLAN_GPIO_PIN22_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN22_SOURCE_LSB) & WLAN_GPIO_PIN22_SOURCE_MASK) - -#define WLAN_GPIO_PIN23_ADDRESS 0x00000084 -#define WLAN_GPIO_PIN23_OFFSET 0x00000084 -#define WLAN_GPIO_PIN23_CONFIG_MSB 13 -#define WLAN_GPIO_PIN23_CONFIG_LSB 11 -#define WLAN_GPIO_PIN23_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN23_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN23_CONFIG_MASK) >> WLAN_GPIO_PIN23_CONFIG_LSB) -#define WLAN_GPIO_PIN23_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN23_CONFIG_LSB) & WLAN_GPIO_PIN23_CONFIG_MASK) -#define WLAN_GPIO_PIN23_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN23_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN23_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN23_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN23_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN23_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN23_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN23_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN23_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN23_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN23_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN23_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN23_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN23_INT_TYPE_MASK) >> WLAN_GPIO_PIN23_INT_TYPE_LSB) -#define WLAN_GPIO_PIN23_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN23_INT_TYPE_LSB) & WLAN_GPIO_PIN23_INT_TYPE_MASK) -#define WLAN_GPIO_PIN23_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN23_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN23_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN23_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN23_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN23_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN23_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN23_PAD_DRIVER_LSB) & WLAN_GPIO_PIN23_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN23_SOURCE_MSB 0 -#define WLAN_GPIO_PIN23_SOURCE_LSB 0 -#define WLAN_GPIO_PIN23_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN23_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN23_SOURCE_MASK) >> WLAN_GPIO_PIN23_SOURCE_LSB) -#define WLAN_GPIO_PIN23_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN23_SOURCE_LSB) & WLAN_GPIO_PIN23_SOURCE_MASK) - -#define WLAN_GPIO_PIN24_ADDRESS 0x00000088 -#define WLAN_GPIO_PIN24_OFFSET 0x00000088 -#define WLAN_GPIO_PIN24_CONFIG_MSB 13 -#define WLAN_GPIO_PIN24_CONFIG_LSB 11 -#define WLAN_GPIO_PIN24_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN24_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN24_CONFIG_MASK) >> WLAN_GPIO_PIN24_CONFIG_LSB) -#define WLAN_GPIO_PIN24_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN24_CONFIG_LSB) & WLAN_GPIO_PIN24_CONFIG_MASK) -#define WLAN_GPIO_PIN24_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN24_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN24_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN24_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN24_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN24_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN24_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN24_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN24_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN24_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN24_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN24_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN24_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN24_INT_TYPE_MASK) >> WLAN_GPIO_PIN24_INT_TYPE_LSB) -#define WLAN_GPIO_PIN24_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN24_INT_TYPE_LSB) & WLAN_GPIO_PIN24_INT_TYPE_MASK) -#define WLAN_GPIO_PIN24_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN24_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN24_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN24_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN24_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN24_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN24_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN24_PAD_DRIVER_LSB) & WLAN_GPIO_PIN24_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN24_SOURCE_MSB 0 -#define WLAN_GPIO_PIN24_SOURCE_LSB 0 -#define WLAN_GPIO_PIN24_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN24_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN24_SOURCE_MASK) >> WLAN_GPIO_PIN24_SOURCE_LSB) -#define WLAN_GPIO_PIN24_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN24_SOURCE_LSB) & WLAN_GPIO_PIN24_SOURCE_MASK) - -#define WLAN_GPIO_PIN25_ADDRESS 0x0000008c -#define WLAN_GPIO_PIN25_OFFSET 0x0000008c -#define WLAN_GPIO_PIN25_CONFIG_MSB 13 -#define WLAN_GPIO_PIN25_CONFIG_LSB 11 -#define WLAN_GPIO_PIN25_CONFIG_MASK 0x00003800 -#define WLAN_GPIO_PIN25_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN25_CONFIG_MASK) >> WLAN_GPIO_PIN25_CONFIG_LSB) -#define WLAN_GPIO_PIN25_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN25_CONFIG_LSB) & WLAN_GPIO_PIN25_CONFIG_MASK) -#define WLAN_GPIO_PIN25_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN25_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN25_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN25_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN25_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN25_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN25_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN25_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN25_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN25_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN25_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN25_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN25_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN25_INT_TYPE_MASK) >> WLAN_GPIO_PIN25_INT_TYPE_LSB) -#define WLAN_GPIO_PIN25_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN25_INT_TYPE_LSB) & WLAN_GPIO_PIN25_INT_TYPE_MASK) -#define WLAN_GPIO_PIN25_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN25_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN25_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN25_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN25_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN25_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN25_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN25_PAD_DRIVER_LSB) & WLAN_GPIO_PIN25_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN25_SOURCE_MSB 0 -#define WLAN_GPIO_PIN25_SOURCE_LSB 0 -#define WLAN_GPIO_PIN25_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN25_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN25_SOURCE_MASK) >> WLAN_GPIO_PIN25_SOURCE_LSB) -#define WLAN_GPIO_PIN25_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN25_SOURCE_LSB) & WLAN_GPIO_PIN25_SOURCE_MASK) - -#define SDIO_ADDRESS 0x00000090 -#define SDIO_OFFSET 0x00000090 -#define SDIO_PINS_EN_MSB 0 -#define SDIO_PINS_EN_LSB 0 -#define SDIO_PINS_EN_MASK 0x00000001 -#define SDIO_PINS_EN_GET(x) (((x) & SDIO_PINS_EN_MASK) >> SDIO_PINS_EN_LSB) -#define SDIO_PINS_EN_SET(x) (((x) << SDIO_PINS_EN_LSB) & SDIO_PINS_EN_MASK) - -#define FUNC_BUS_ADDRESS 0x00000094 -#define FUNC_BUS_OFFSET 0x00000094 -#define FUNC_BUS_GPIO_MODE_MSB 22 -#define FUNC_BUS_GPIO_MODE_LSB 22 -#define FUNC_BUS_GPIO_MODE_MASK 0x00400000 -#define FUNC_BUS_GPIO_MODE_GET(x) (((x) & FUNC_BUS_GPIO_MODE_MASK) >> FUNC_BUS_GPIO_MODE_LSB) -#define FUNC_BUS_GPIO_MODE_SET(x) (((x) << FUNC_BUS_GPIO_MODE_LSB) & FUNC_BUS_GPIO_MODE_MASK) -#define FUNC_BUS_OE_L_MSB 21 -#define FUNC_BUS_OE_L_LSB 0 -#define FUNC_BUS_OE_L_MASK 0x003fffff -#define FUNC_BUS_OE_L_GET(x) (((x) & FUNC_BUS_OE_L_MASK) >> FUNC_BUS_OE_L_LSB) -#define FUNC_BUS_OE_L_SET(x) (((x) << FUNC_BUS_OE_L_LSB) & FUNC_BUS_OE_L_MASK) - -#define WL_SOC_APB_ADDRESS 0x00000098 -#define WL_SOC_APB_OFFSET 0x00000098 -#define WL_SOC_APB_TOGGLE_MSB 0 -#define WL_SOC_APB_TOGGLE_LSB 0 -#define WL_SOC_APB_TOGGLE_MASK 0x00000001 -#define WL_SOC_APB_TOGGLE_GET(x) (((x) & WL_SOC_APB_TOGGLE_MASK) >> WL_SOC_APB_TOGGLE_LSB) -#define WL_SOC_APB_TOGGLE_SET(x) (((x) << WL_SOC_APB_TOGGLE_LSB) & WL_SOC_APB_TOGGLE_MASK) - -#define WLAN_SIGMA_DELTA_ADDRESS 0x0000009c -#define WLAN_SIGMA_DELTA_OFFSET 0x0000009c -#define WLAN_SIGMA_DELTA_ENABLE_MSB 16 -#define WLAN_SIGMA_DELTA_ENABLE_LSB 16 -#define WLAN_SIGMA_DELTA_ENABLE_MASK 0x00010000 -#define WLAN_SIGMA_DELTA_ENABLE_GET(x) (((x) & WLAN_SIGMA_DELTA_ENABLE_MASK) >> WLAN_SIGMA_DELTA_ENABLE_LSB) -#define WLAN_SIGMA_DELTA_ENABLE_SET(x) (((x) << WLAN_SIGMA_DELTA_ENABLE_LSB) & WLAN_SIGMA_DELTA_ENABLE_MASK) -#define WLAN_SIGMA_DELTA_PRESCALAR_MSB 15 -#define WLAN_SIGMA_DELTA_PRESCALAR_LSB 8 -#define WLAN_SIGMA_DELTA_PRESCALAR_MASK 0x0000ff00 -#define WLAN_SIGMA_DELTA_PRESCALAR_GET(x) (((x) & WLAN_SIGMA_DELTA_PRESCALAR_MASK) >> WLAN_SIGMA_DELTA_PRESCALAR_LSB) -#define WLAN_SIGMA_DELTA_PRESCALAR_SET(x) (((x) << WLAN_SIGMA_DELTA_PRESCALAR_LSB) & WLAN_SIGMA_DELTA_PRESCALAR_MASK) -#define WLAN_SIGMA_DELTA_TARGET_MSB 7 -#define WLAN_SIGMA_DELTA_TARGET_LSB 0 -#define WLAN_SIGMA_DELTA_TARGET_MASK 0x000000ff -#define WLAN_SIGMA_DELTA_TARGET_GET(x) (((x) & WLAN_SIGMA_DELTA_TARGET_MASK) >> WLAN_SIGMA_DELTA_TARGET_LSB) -#define WLAN_SIGMA_DELTA_TARGET_SET(x) (((x) << WLAN_SIGMA_DELTA_TARGET_LSB) & WLAN_SIGMA_DELTA_TARGET_MASK) - -#define WL_BOOTSTRAP_ADDRESS 0x000000a0 -#define WL_BOOTSTRAP_OFFSET 0x000000a0 -#define WL_BOOTSTRAP_STATUS_MSB 22 -#define WL_BOOTSTRAP_STATUS_LSB 0 -#define WL_BOOTSTRAP_STATUS_MASK 0x007fffff -#define WL_BOOTSTRAP_STATUS_GET(x) (((x) & WL_BOOTSTRAP_STATUS_MASK) >> WL_BOOTSTRAP_STATUS_LSB) -#define WL_BOOTSTRAP_STATUS_SET(x) (((x) << WL_BOOTSTRAP_STATUS_LSB) & WL_BOOTSTRAP_STATUS_MASK) - -#define CLOCK_GPIO_ADDRESS 0x000000a4 -#define CLOCK_GPIO_OFFSET 0x000000a4 -#define CLOCK_GPIO_CLK_REQ_OUT_EN_MSB 2 -#define CLOCK_GPIO_CLK_REQ_OUT_EN_LSB 2 -#define CLOCK_GPIO_CLK_REQ_OUT_EN_MASK 0x00000004 -#define CLOCK_GPIO_CLK_REQ_OUT_EN_GET(x) (((x) & CLOCK_GPIO_CLK_REQ_OUT_EN_MASK) >> CLOCK_GPIO_CLK_REQ_OUT_EN_LSB) -#define CLOCK_GPIO_CLK_REQ_OUT_EN_SET(x) (((x) << CLOCK_GPIO_CLK_REQ_OUT_EN_LSB) & CLOCK_GPIO_CLK_REQ_OUT_EN_MASK) -#define CLOCK_GPIO_BT_CLK_REQ_EN_MSB 1 -#define CLOCK_GPIO_BT_CLK_REQ_EN_LSB 1 -#define CLOCK_GPIO_BT_CLK_REQ_EN_MASK 0x00000002 -#define CLOCK_GPIO_BT_CLK_REQ_EN_GET(x) (((x) & CLOCK_GPIO_BT_CLK_REQ_EN_MASK) >> CLOCK_GPIO_BT_CLK_REQ_EN_LSB) -#define CLOCK_GPIO_BT_CLK_REQ_EN_SET(x) (((x) << CLOCK_GPIO_BT_CLK_REQ_EN_LSB) & CLOCK_GPIO_BT_CLK_REQ_EN_MASK) -#define CLOCK_GPIO_BT_CLK_OUT_EN_MSB 0 -#define CLOCK_GPIO_BT_CLK_OUT_EN_LSB 0 -#define CLOCK_GPIO_BT_CLK_OUT_EN_MASK 0x00000001 -#define CLOCK_GPIO_BT_CLK_OUT_EN_GET(x) (((x) & CLOCK_GPIO_BT_CLK_OUT_EN_MASK) >> CLOCK_GPIO_BT_CLK_OUT_EN_LSB) -#define CLOCK_GPIO_BT_CLK_OUT_EN_SET(x) (((x) << CLOCK_GPIO_BT_CLK_OUT_EN_LSB) & CLOCK_GPIO_BT_CLK_OUT_EN_MASK) - -#define WLAN_DEBUG_CONTROL_ADDRESS 0x000000a8 -#define WLAN_DEBUG_CONTROL_OFFSET 0x000000a8 -#define WLAN_DEBUG_CONTROL_ENABLE_MSB 0 -#define WLAN_DEBUG_CONTROL_ENABLE_LSB 0 -#define WLAN_DEBUG_CONTROL_ENABLE_MASK 0x00000001 -#define WLAN_DEBUG_CONTROL_ENABLE_GET(x) (((x) & WLAN_DEBUG_CONTROL_ENABLE_MASK) >> WLAN_DEBUG_CONTROL_ENABLE_LSB) -#define WLAN_DEBUG_CONTROL_ENABLE_SET(x) (((x) << WLAN_DEBUG_CONTROL_ENABLE_LSB) & WLAN_DEBUG_CONTROL_ENABLE_MASK) - -#define WLAN_DEBUG_INPUT_SEL_ADDRESS 0x000000ac -#define WLAN_DEBUG_INPUT_SEL_OFFSET 0x000000ac -#define WLAN_DEBUG_INPUT_SEL_SHIFT_MSB 5 -#define WLAN_DEBUG_INPUT_SEL_SHIFT_LSB 4 -#define WLAN_DEBUG_INPUT_SEL_SHIFT_MASK 0x00000030 -#define WLAN_DEBUG_INPUT_SEL_SHIFT_GET(x) (((x) & WLAN_DEBUG_INPUT_SEL_SHIFT_MASK) >> WLAN_DEBUG_INPUT_SEL_SHIFT_LSB) -#define WLAN_DEBUG_INPUT_SEL_SHIFT_SET(x) (((x) << WLAN_DEBUG_INPUT_SEL_SHIFT_LSB) & WLAN_DEBUG_INPUT_SEL_SHIFT_MASK) -#define WLAN_DEBUG_INPUT_SEL_SRC_MSB 3 -#define WLAN_DEBUG_INPUT_SEL_SRC_LSB 0 -#define WLAN_DEBUG_INPUT_SEL_SRC_MASK 0x0000000f -#define WLAN_DEBUG_INPUT_SEL_SRC_GET(x) (((x) & WLAN_DEBUG_INPUT_SEL_SRC_MASK) >> WLAN_DEBUG_INPUT_SEL_SRC_LSB) -#define WLAN_DEBUG_INPUT_SEL_SRC_SET(x) (((x) << WLAN_DEBUG_INPUT_SEL_SRC_LSB) & WLAN_DEBUG_INPUT_SEL_SRC_MASK) - -#define WLAN_DEBUG_OUT_ADDRESS 0x000000b0 -#define WLAN_DEBUG_OUT_OFFSET 0x000000b0 -#define WLAN_DEBUG_OUT_DATA_MSB 17 -#define WLAN_DEBUG_OUT_DATA_LSB 0 -#define WLAN_DEBUG_OUT_DATA_MASK 0x0003ffff -#define WLAN_DEBUG_OUT_DATA_GET(x) (((x) & WLAN_DEBUG_OUT_DATA_MASK) >> WLAN_DEBUG_OUT_DATA_LSB) -#define WLAN_DEBUG_OUT_DATA_SET(x) (((x) << WLAN_DEBUG_OUT_DATA_LSB) & WLAN_DEBUG_OUT_DATA_MASK) - -#define WLAN_RESET_TUPLE_STATUS_ADDRESS 0x000000b4 -#define WLAN_RESET_TUPLE_STATUS_OFFSET 0x000000b4 -#define WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MSB 11 -#define WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB 8 -#define WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK 0x00000f00 -#define WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_GET(x) (((x) & WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK) >> WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB) -#define WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_SET(x) (((x) << WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB) & WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK) -#define WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MSB 7 -#define WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB 0 -#define WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK 0x000000ff -#define WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_GET(x) (((x) & WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK) >> WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB) -#define WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_SET(x) (((x) << WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB) & WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK) - -#define ANTENNA_SLEEP_CONTROL_ADDRESS 0x000000b8 -#define ANTENNA_SLEEP_CONTROL_OFFSET 0x000000b8 -#define ANTENNA_SLEEP_CONTROL_OVERRIDE_MSB 14 -#define ANTENNA_SLEEP_CONTROL_OVERRIDE_LSB 10 -#define ANTENNA_SLEEP_CONTROL_OVERRIDE_MASK 0x00007c00 -#define ANTENNA_SLEEP_CONTROL_OVERRIDE_GET(x) (((x) & ANTENNA_SLEEP_CONTROL_OVERRIDE_MASK) >> ANTENNA_SLEEP_CONTROL_OVERRIDE_LSB) -#define ANTENNA_SLEEP_CONTROL_OVERRIDE_SET(x) (((x) << ANTENNA_SLEEP_CONTROL_OVERRIDE_LSB) & ANTENNA_SLEEP_CONTROL_OVERRIDE_MASK) -#define ANTENNA_SLEEP_CONTROL_VALUE_MSB 9 -#define ANTENNA_SLEEP_CONTROL_VALUE_LSB 5 -#define ANTENNA_SLEEP_CONTROL_VALUE_MASK 0x000003e0 -#define ANTENNA_SLEEP_CONTROL_VALUE_GET(x) (((x) & ANTENNA_SLEEP_CONTROL_VALUE_MASK) >> ANTENNA_SLEEP_CONTROL_VALUE_LSB) -#define ANTENNA_SLEEP_CONTROL_VALUE_SET(x) (((x) << ANTENNA_SLEEP_CONTROL_VALUE_LSB) & ANTENNA_SLEEP_CONTROL_VALUE_MASK) -#define ANTENNA_SLEEP_CONTROL_ENABLE_MSB 4 -#define ANTENNA_SLEEP_CONTROL_ENABLE_LSB 0 -#define ANTENNA_SLEEP_CONTROL_ENABLE_MASK 0x0000001f -#define ANTENNA_SLEEP_CONTROL_ENABLE_GET(x) (((x) & ANTENNA_SLEEP_CONTROL_ENABLE_MASK) >> ANTENNA_SLEEP_CONTROL_ENABLE_LSB) -#define ANTENNA_SLEEP_CONTROL_ENABLE_SET(x) (((x) << ANTENNA_SLEEP_CONTROL_ENABLE_LSB) & ANTENNA_SLEEP_CONTROL_ENABLE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct gpio_athr_wlan_reg_reg_s { - volatile unsigned int wlan_gpio_out; - volatile unsigned int wlan_gpio_out_w1ts; - volatile unsigned int wlan_gpio_out_w1tc; - volatile unsigned int wlan_gpio_enable; - volatile unsigned int wlan_gpio_enable_w1ts; - volatile unsigned int wlan_gpio_enable_w1tc; - volatile unsigned int wlan_gpio_in; - volatile unsigned int wlan_gpio_status; - volatile unsigned int wlan_gpio_status_w1ts; - volatile unsigned int wlan_gpio_status_w1tc; - volatile unsigned int wlan_gpio_pin0; - volatile unsigned int wlan_gpio_pin1; - volatile unsigned int wlan_gpio_pin2; - volatile unsigned int wlan_gpio_pin3; - volatile unsigned int wlan_gpio_pin4; - volatile unsigned int wlan_gpio_pin5; - volatile unsigned int wlan_gpio_pin6; - volatile unsigned int wlan_gpio_pin7; - volatile unsigned int wlan_gpio_pin8; - volatile unsigned int wlan_gpio_pin9; - volatile unsigned int wlan_gpio_pin10; - volatile unsigned int wlan_gpio_pin11; - volatile unsigned int wlan_gpio_pin12; - volatile unsigned int wlan_gpio_pin13; - volatile unsigned int wlan_gpio_pin14; - volatile unsigned int wlan_gpio_pin15; - volatile unsigned int wlan_gpio_pin16; - volatile unsigned int wlan_gpio_pin17; - volatile unsigned int wlan_gpio_pin18; - volatile unsigned int wlan_gpio_pin19; - volatile unsigned int wlan_gpio_pin20; - volatile unsigned int wlan_gpio_pin21; - volatile unsigned int wlan_gpio_pin22; - volatile unsigned int wlan_gpio_pin23; - volatile unsigned int wlan_gpio_pin24; - volatile unsigned int wlan_gpio_pin25; - volatile unsigned int sdio; - volatile unsigned int func_bus; - volatile unsigned int wl_soc_apb; - volatile unsigned int wlan_sigma_delta; - volatile unsigned int wl_bootstrap; - volatile unsigned int clock_gpio; - volatile unsigned int wlan_debug_control; - volatile unsigned int wlan_debug_input_sel; - volatile unsigned int wlan_debug_out; - volatile unsigned int wlan_reset_tuple_status; - volatile unsigned int antenna_sleep_control; -} gpio_athr_wlan_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _GPIO_ATHR_WLAN_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/gpio_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/gpio_reg.h deleted file mode 100644 index b204f1d43933..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/gpio_reg.h +++ /dev/null @@ -1,1094 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "gpio_athr_wlan_reg.h" - - -#ifndef BT_HEADERS - -#define GPIO_OUT_ADDRESS WLAN_GPIO_OUT_ADDRESS -#define GPIO_OUT_OFFSET WLAN_GPIO_OUT_OFFSET -#define GPIO_OUT_DATA_MSB WLAN_GPIO_OUT_DATA_MSB -#define GPIO_OUT_DATA_LSB WLAN_GPIO_OUT_DATA_LSB -#define GPIO_OUT_DATA_MASK WLAN_GPIO_OUT_DATA_MASK -#define GPIO_OUT_DATA_GET(x) WLAN_GPIO_OUT_DATA_GET(x) -#define GPIO_OUT_DATA_SET(x) WLAN_GPIO_OUT_DATA_SET(x) -#define GPIO_OUT_W1TS_ADDRESS WLAN_GPIO_OUT_W1TS_ADDRESS -#define GPIO_OUT_W1TS_OFFSET WLAN_GPIO_OUT_W1TS_OFFSET -#define GPIO_OUT_W1TS_DATA_MSB WLAN_GPIO_OUT_W1TS_DATA_MSB -#define GPIO_OUT_W1TS_DATA_LSB WLAN_GPIO_OUT_W1TS_DATA_LSB -#define GPIO_OUT_W1TS_DATA_MASK WLAN_GPIO_OUT_W1TS_DATA_MASK -#define GPIO_OUT_W1TS_DATA_GET(x) WLAN_GPIO_OUT_W1TS_DATA_GET(x) -#define GPIO_OUT_W1TS_DATA_SET(x) WLAN_GPIO_OUT_W1TS_DATA_SET(x) -#define GPIO_OUT_W1TC_ADDRESS WLAN_GPIO_OUT_W1TC_ADDRESS -#define GPIO_OUT_W1TC_OFFSET WLAN_GPIO_OUT_W1TC_OFFSET -#define GPIO_OUT_W1TC_DATA_MSB WLAN_GPIO_OUT_W1TC_DATA_MSB -#define GPIO_OUT_W1TC_DATA_LSB WLAN_GPIO_OUT_W1TC_DATA_LSB -#define GPIO_OUT_W1TC_DATA_MASK WLAN_GPIO_OUT_W1TC_DATA_MASK -#define GPIO_OUT_W1TC_DATA_GET(x) WLAN_GPIO_OUT_W1TC_DATA_GET(x) -#define GPIO_OUT_W1TC_DATA_SET(x) WLAN_GPIO_OUT_W1TC_DATA_SET(x) -#define GPIO_ENABLE_ADDRESS WLAN_GPIO_ENABLE_ADDRESS -#define GPIO_ENABLE_OFFSET WLAN_GPIO_ENABLE_OFFSET -#define GPIO_ENABLE_DATA_MSB WLAN_GPIO_ENABLE_DATA_MSB -#define GPIO_ENABLE_DATA_LSB WLAN_GPIO_ENABLE_DATA_LSB -#define GPIO_ENABLE_DATA_MASK WLAN_GPIO_ENABLE_DATA_MASK -#define GPIO_ENABLE_DATA_GET(x) WLAN_GPIO_ENABLE_DATA_GET(x) -#define GPIO_ENABLE_DATA_SET(x) WLAN_GPIO_ENABLE_DATA_SET(x) -#define GPIO_ENABLE_W1TS_ADDRESS WLAN_GPIO_ENABLE_W1TS_ADDRESS -#define GPIO_ENABLE_W1TS_OFFSET WLAN_GPIO_ENABLE_W1TS_OFFSET -#define GPIO_ENABLE_W1TS_DATA_MSB WLAN_GPIO_ENABLE_W1TS_DATA_MSB -#define GPIO_ENABLE_W1TS_DATA_LSB WLAN_GPIO_ENABLE_W1TS_DATA_LSB -#define GPIO_ENABLE_W1TS_DATA_MASK WLAN_GPIO_ENABLE_W1TS_DATA_MASK -#define GPIO_ENABLE_W1TS_DATA_GET(x) WLAN_GPIO_ENABLE_W1TS_DATA_GET(x) -#define GPIO_ENABLE_W1TS_DATA_SET(x) WLAN_GPIO_ENABLE_W1TS_DATA_SET(x) -#define GPIO_ENABLE_W1TC_ADDRESS WLAN_GPIO_ENABLE_W1TC_ADDRESS -#define GPIO_ENABLE_W1TC_OFFSET WLAN_GPIO_ENABLE_W1TC_OFFSET -#define GPIO_ENABLE_W1TC_DATA_MSB WLAN_GPIO_ENABLE_W1TC_DATA_MSB -#define GPIO_ENABLE_W1TC_DATA_LSB WLAN_GPIO_ENABLE_W1TC_DATA_LSB -#define GPIO_ENABLE_W1TC_DATA_MASK WLAN_GPIO_ENABLE_W1TC_DATA_MASK -#define GPIO_ENABLE_W1TC_DATA_GET(x) WLAN_GPIO_ENABLE_W1TC_DATA_GET(x) -#define GPIO_ENABLE_W1TC_DATA_SET(x) WLAN_GPIO_ENABLE_W1TC_DATA_SET(x) -#define GPIO_IN_ADDRESS WLAN_GPIO_IN_ADDRESS -#define GPIO_IN_OFFSET WLAN_GPIO_IN_OFFSET -#define GPIO_IN_DATA_MSB WLAN_GPIO_IN_DATA_MSB -#define GPIO_IN_DATA_LSB WLAN_GPIO_IN_DATA_LSB -#define GPIO_IN_DATA_MASK WLAN_GPIO_IN_DATA_MASK -#define GPIO_IN_DATA_GET(x) WLAN_GPIO_IN_DATA_GET(x) -#define GPIO_IN_DATA_SET(x) WLAN_GPIO_IN_DATA_SET(x) -#define GPIO_STATUS_ADDRESS WLAN_GPIO_STATUS_ADDRESS -#define GPIO_STATUS_OFFSET WLAN_GPIO_STATUS_OFFSET -#define GPIO_STATUS_INTERRUPT_MSB WLAN_GPIO_STATUS_INTERRUPT_MSB -#define GPIO_STATUS_INTERRUPT_LSB WLAN_GPIO_STATUS_INTERRUPT_LSB -#define GPIO_STATUS_INTERRUPT_MASK WLAN_GPIO_STATUS_INTERRUPT_MASK -#define GPIO_STATUS_INTERRUPT_GET(x) WLAN_GPIO_STATUS_INTERRUPT_GET(x) -#define GPIO_STATUS_INTERRUPT_SET(x) WLAN_GPIO_STATUS_INTERRUPT_SET(x) -#define GPIO_STATUS_W1TS_ADDRESS WLAN_GPIO_STATUS_W1TS_ADDRESS -#define GPIO_STATUS_W1TS_OFFSET WLAN_GPIO_STATUS_W1TS_OFFSET -#define GPIO_STATUS_W1TS_INTERRUPT_MSB WLAN_GPIO_STATUS_W1TS_INTERRUPT_MSB -#define GPIO_STATUS_W1TS_INTERRUPT_LSB WLAN_GPIO_STATUS_W1TS_INTERRUPT_LSB -#define GPIO_STATUS_W1TS_INTERRUPT_MASK WLAN_GPIO_STATUS_W1TS_INTERRUPT_MASK -#define GPIO_STATUS_W1TS_INTERRUPT_GET(x) WLAN_GPIO_STATUS_W1TS_INTERRUPT_GET(x) -#define GPIO_STATUS_W1TS_INTERRUPT_SET(x) WLAN_GPIO_STATUS_W1TS_INTERRUPT_SET(x) -#define GPIO_STATUS_W1TC_ADDRESS WLAN_GPIO_STATUS_W1TC_ADDRESS -#define GPIO_STATUS_W1TC_OFFSET WLAN_GPIO_STATUS_W1TC_OFFSET -#define GPIO_STATUS_W1TC_INTERRUPT_MSB WLAN_GPIO_STATUS_W1TC_INTERRUPT_MSB -#define GPIO_STATUS_W1TC_INTERRUPT_LSB WLAN_GPIO_STATUS_W1TC_INTERRUPT_LSB -#define GPIO_STATUS_W1TC_INTERRUPT_MASK WLAN_GPIO_STATUS_W1TC_INTERRUPT_MASK -#define GPIO_STATUS_W1TC_INTERRUPT_GET(x) WLAN_GPIO_STATUS_W1TC_INTERRUPT_GET(x) -#define GPIO_STATUS_W1TC_INTERRUPT_SET(x) WLAN_GPIO_STATUS_W1TC_INTERRUPT_SET(x) -#define GPIO_PIN0_ADDRESS WLAN_GPIO_PIN0_ADDRESS -#define GPIO_PIN0_OFFSET WLAN_GPIO_PIN0_OFFSET -#define GPIO_PIN0_CONFIG_MSB WLAN_GPIO_PIN0_CONFIG_MSB -#define GPIO_PIN0_CONFIG_LSB WLAN_GPIO_PIN0_CONFIG_LSB -#define GPIO_PIN0_CONFIG_MASK WLAN_GPIO_PIN0_CONFIG_MASK -#define GPIO_PIN0_CONFIG_GET(x) WLAN_GPIO_PIN0_CONFIG_GET(x) -#define GPIO_PIN0_CONFIG_SET(x) WLAN_GPIO_PIN0_CONFIG_SET(x) -#define GPIO_PIN0_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN0_WAKEUP_ENABLE_MSB -#define GPIO_PIN0_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN0_WAKEUP_ENABLE_LSB -#define GPIO_PIN0_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN0_WAKEUP_ENABLE_MASK -#define GPIO_PIN0_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN0_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN0_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN0_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN0_INT_TYPE_MSB WLAN_GPIO_PIN0_INT_TYPE_MSB -#define GPIO_PIN0_INT_TYPE_LSB WLAN_GPIO_PIN0_INT_TYPE_LSB -#define GPIO_PIN0_INT_TYPE_MASK WLAN_GPIO_PIN0_INT_TYPE_MASK -#define GPIO_PIN0_INT_TYPE_GET(x) WLAN_GPIO_PIN0_INT_TYPE_GET(x) -#define GPIO_PIN0_INT_TYPE_SET(x) WLAN_GPIO_PIN0_INT_TYPE_SET(x) -#define GPIO_PIN0_PAD_PULL_MSB WLAN_GPIO_PIN0_PAD_PULL_MSB -#define GPIO_PIN0_PAD_PULL_LSB WLAN_GPIO_PIN0_PAD_PULL_LSB -#define GPIO_PIN0_PAD_PULL_MASK WLAN_GPIO_PIN0_PAD_PULL_MASK -#define GPIO_PIN0_PAD_PULL_GET(x) WLAN_GPIO_PIN0_PAD_PULL_GET(x) -#define GPIO_PIN0_PAD_PULL_SET(x) WLAN_GPIO_PIN0_PAD_PULL_SET(x) -#define GPIO_PIN0_PAD_STRENGTH_MSB WLAN_GPIO_PIN0_PAD_STRENGTH_MSB -#define GPIO_PIN0_PAD_STRENGTH_LSB WLAN_GPIO_PIN0_PAD_STRENGTH_LSB -#define GPIO_PIN0_PAD_STRENGTH_MASK WLAN_GPIO_PIN0_PAD_STRENGTH_MASK -#define GPIO_PIN0_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN0_PAD_STRENGTH_GET(x) -#define GPIO_PIN0_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN0_PAD_STRENGTH_SET(x) -#define GPIO_PIN0_PAD_DRIVER_MSB WLAN_GPIO_PIN0_PAD_DRIVER_MSB -#define GPIO_PIN0_PAD_DRIVER_LSB WLAN_GPIO_PIN0_PAD_DRIVER_LSB -#define GPIO_PIN0_PAD_DRIVER_MASK WLAN_GPIO_PIN0_PAD_DRIVER_MASK -#define GPIO_PIN0_PAD_DRIVER_GET(x) WLAN_GPIO_PIN0_PAD_DRIVER_GET(x) -#define GPIO_PIN0_PAD_DRIVER_SET(x) WLAN_GPIO_PIN0_PAD_DRIVER_SET(x) -#define GPIO_PIN0_SOURCE_MSB WLAN_GPIO_PIN0_SOURCE_MSB -#define GPIO_PIN0_SOURCE_LSB WLAN_GPIO_PIN0_SOURCE_LSB -#define GPIO_PIN0_SOURCE_MASK WLAN_GPIO_PIN0_SOURCE_MASK -#define GPIO_PIN0_SOURCE_GET(x) WLAN_GPIO_PIN0_SOURCE_GET(x) -#define GPIO_PIN0_SOURCE_SET(x) WLAN_GPIO_PIN0_SOURCE_SET(x) -#define GPIO_PIN1_ADDRESS WLAN_GPIO_PIN1_ADDRESS -#define GPIO_PIN1_OFFSET WLAN_GPIO_PIN1_OFFSET -#define GPIO_PIN1_CONFIG_MSB WLAN_GPIO_PIN1_CONFIG_MSB -#define GPIO_PIN1_CONFIG_LSB WLAN_GPIO_PIN1_CONFIG_LSB -#define GPIO_PIN1_CONFIG_MASK WLAN_GPIO_PIN1_CONFIG_MASK -#define GPIO_PIN1_CONFIG_GET(x) WLAN_GPIO_PIN1_CONFIG_GET(x) -#define GPIO_PIN1_CONFIG_SET(x) WLAN_GPIO_PIN1_CONFIG_SET(x) -#define GPIO_PIN1_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN1_WAKEUP_ENABLE_MSB -#define GPIO_PIN1_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN1_WAKEUP_ENABLE_LSB -#define GPIO_PIN1_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN1_WAKEUP_ENABLE_MASK -#define GPIO_PIN1_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN1_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN1_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN1_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN1_INT_TYPE_MSB WLAN_GPIO_PIN1_INT_TYPE_MSB -#define GPIO_PIN1_INT_TYPE_LSB WLAN_GPIO_PIN1_INT_TYPE_LSB -#define GPIO_PIN1_INT_TYPE_MASK WLAN_GPIO_PIN1_INT_TYPE_MASK -#define GPIO_PIN1_INT_TYPE_GET(x) WLAN_GPIO_PIN1_INT_TYPE_GET(x) -#define GPIO_PIN1_INT_TYPE_SET(x) WLAN_GPIO_PIN1_INT_TYPE_SET(x) -#define GPIO_PIN1_PAD_PULL_MSB WLAN_GPIO_PIN1_PAD_PULL_MSB -#define GPIO_PIN1_PAD_PULL_LSB WLAN_GPIO_PIN1_PAD_PULL_LSB -#define GPIO_PIN1_PAD_PULL_MASK WLAN_GPIO_PIN1_PAD_PULL_MASK -#define GPIO_PIN1_PAD_PULL_GET(x) WLAN_GPIO_PIN1_PAD_PULL_GET(x) -#define GPIO_PIN1_PAD_PULL_SET(x) WLAN_GPIO_PIN1_PAD_PULL_SET(x) -#define GPIO_PIN1_PAD_STRENGTH_MSB WLAN_GPIO_PIN1_PAD_STRENGTH_MSB -#define GPIO_PIN1_PAD_STRENGTH_LSB WLAN_GPIO_PIN1_PAD_STRENGTH_LSB -#define GPIO_PIN1_PAD_STRENGTH_MASK WLAN_GPIO_PIN1_PAD_STRENGTH_MASK -#define GPIO_PIN1_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN1_PAD_STRENGTH_GET(x) -#define GPIO_PIN1_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN1_PAD_STRENGTH_SET(x) -#define GPIO_PIN1_PAD_DRIVER_MSB WLAN_GPIO_PIN1_PAD_DRIVER_MSB -#define GPIO_PIN1_PAD_DRIVER_LSB WLAN_GPIO_PIN1_PAD_DRIVER_LSB -#define GPIO_PIN1_PAD_DRIVER_MASK WLAN_GPIO_PIN1_PAD_DRIVER_MASK -#define GPIO_PIN1_PAD_DRIVER_GET(x) WLAN_GPIO_PIN1_PAD_DRIVER_GET(x) -#define GPIO_PIN1_PAD_DRIVER_SET(x) WLAN_GPIO_PIN1_PAD_DRIVER_SET(x) -#define GPIO_PIN1_SOURCE_MSB WLAN_GPIO_PIN1_SOURCE_MSB -#define GPIO_PIN1_SOURCE_LSB WLAN_GPIO_PIN1_SOURCE_LSB -#define GPIO_PIN1_SOURCE_MASK WLAN_GPIO_PIN1_SOURCE_MASK -#define GPIO_PIN1_SOURCE_GET(x) WLAN_GPIO_PIN1_SOURCE_GET(x) -#define GPIO_PIN1_SOURCE_SET(x) WLAN_GPIO_PIN1_SOURCE_SET(x) -#define GPIO_PIN2_ADDRESS WLAN_GPIO_PIN2_ADDRESS -#define GPIO_PIN2_OFFSET WLAN_GPIO_PIN2_OFFSET -#define GPIO_PIN2_CONFIG_MSB WLAN_GPIO_PIN2_CONFIG_MSB -#define GPIO_PIN2_CONFIG_LSB WLAN_GPIO_PIN2_CONFIG_LSB -#define GPIO_PIN2_CONFIG_MASK WLAN_GPIO_PIN2_CONFIG_MASK -#define GPIO_PIN2_CONFIG_GET(x) WLAN_GPIO_PIN2_CONFIG_GET(x) -#define GPIO_PIN2_CONFIG_SET(x) WLAN_GPIO_PIN2_CONFIG_SET(x) -#define GPIO_PIN2_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN2_WAKEUP_ENABLE_MSB -#define GPIO_PIN2_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN2_WAKEUP_ENABLE_LSB -#define GPIO_PIN2_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN2_WAKEUP_ENABLE_MASK -#define GPIO_PIN2_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN2_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN2_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN2_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN2_INT_TYPE_MSB WLAN_GPIO_PIN2_INT_TYPE_MSB -#define GPIO_PIN2_INT_TYPE_LSB WLAN_GPIO_PIN2_INT_TYPE_LSB -#define GPIO_PIN2_INT_TYPE_MASK WLAN_GPIO_PIN2_INT_TYPE_MASK -#define GPIO_PIN2_INT_TYPE_GET(x) WLAN_GPIO_PIN2_INT_TYPE_GET(x) -#define GPIO_PIN2_INT_TYPE_SET(x) WLAN_GPIO_PIN2_INT_TYPE_SET(x) -#define GPIO_PIN2_PAD_PULL_MSB WLAN_GPIO_PIN2_PAD_PULL_MSB -#define GPIO_PIN2_PAD_PULL_LSB WLAN_GPIO_PIN2_PAD_PULL_LSB -#define GPIO_PIN2_PAD_PULL_MASK WLAN_GPIO_PIN2_PAD_PULL_MASK -#define GPIO_PIN2_PAD_PULL_GET(x) WLAN_GPIO_PIN2_PAD_PULL_GET(x) -#define GPIO_PIN2_PAD_PULL_SET(x) WLAN_GPIO_PIN2_PAD_PULL_SET(x) -#define GPIO_PIN2_PAD_STRENGTH_MSB WLAN_GPIO_PIN2_PAD_STRENGTH_MSB -#define GPIO_PIN2_PAD_STRENGTH_LSB WLAN_GPIO_PIN2_PAD_STRENGTH_LSB -#define GPIO_PIN2_PAD_STRENGTH_MASK WLAN_GPIO_PIN2_PAD_STRENGTH_MASK -#define GPIO_PIN2_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN2_PAD_STRENGTH_GET(x) -#define GPIO_PIN2_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN2_PAD_STRENGTH_SET(x) -#define GPIO_PIN2_PAD_DRIVER_MSB WLAN_GPIO_PIN2_PAD_DRIVER_MSB -#define GPIO_PIN2_PAD_DRIVER_LSB WLAN_GPIO_PIN2_PAD_DRIVER_LSB -#define GPIO_PIN2_PAD_DRIVER_MASK WLAN_GPIO_PIN2_PAD_DRIVER_MASK -#define GPIO_PIN2_PAD_DRIVER_GET(x) WLAN_GPIO_PIN2_PAD_DRIVER_GET(x) -#define GPIO_PIN2_PAD_DRIVER_SET(x) WLAN_GPIO_PIN2_PAD_DRIVER_SET(x) -#define GPIO_PIN2_SOURCE_MSB WLAN_GPIO_PIN2_SOURCE_MSB -#define GPIO_PIN2_SOURCE_LSB WLAN_GPIO_PIN2_SOURCE_LSB -#define GPIO_PIN2_SOURCE_MASK WLAN_GPIO_PIN2_SOURCE_MASK -#define GPIO_PIN2_SOURCE_GET(x) WLAN_GPIO_PIN2_SOURCE_GET(x) -#define GPIO_PIN2_SOURCE_SET(x) WLAN_GPIO_PIN2_SOURCE_SET(x) -#define GPIO_PIN3_ADDRESS WLAN_GPIO_PIN3_ADDRESS -#define GPIO_PIN3_OFFSET WLAN_GPIO_PIN3_OFFSET -#define GPIO_PIN3_CONFIG_MSB WLAN_GPIO_PIN3_CONFIG_MSB -#define GPIO_PIN3_CONFIG_LSB WLAN_GPIO_PIN3_CONFIG_LSB -#define GPIO_PIN3_CONFIG_MASK WLAN_GPIO_PIN3_CONFIG_MASK -#define GPIO_PIN3_CONFIG_GET(x) WLAN_GPIO_PIN3_CONFIG_GET(x) -#define GPIO_PIN3_CONFIG_SET(x) WLAN_GPIO_PIN3_CONFIG_SET(x) -#define GPIO_PIN3_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN3_WAKEUP_ENABLE_MSB -#define GPIO_PIN3_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN3_WAKEUP_ENABLE_LSB -#define GPIO_PIN3_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN3_WAKEUP_ENABLE_MASK -#define GPIO_PIN3_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN3_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN3_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN3_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN3_INT_TYPE_MSB WLAN_GPIO_PIN3_INT_TYPE_MSB -#define GPIO_PIN3_INT_TYPE_LSB WLAN_GPIO_PIN3_INT_TYPE_LSB -#define GPIO_PIN3_INT_TYPE_MASK WLAN_GPIO_PIN3_INT_TYPE_MASK -#define GPIO_PIN3_INT_TYPE_GET(x) WLAN_GPIO_PIN3_INT_TYPE_GET(x) -#define GPIO_PIN3_INT_TYPE_SET(x) WLAN_GPIO_PIN3_INT_TYPE_SET(x) -#define GPIO_PIN3_PAD_PULL_MSB WLAN_GPIO_PIN3_PAD_PULL_MSB -#define GPIO_PIN3_PAD_PULL_LSB WLAN_GPIO_PIN3_PAD_PULL_LSB -#define GPIO_PIN3_PAD_PULL_MASK WLAN_GPIO_PIN3_PAD_PULL_MASK -#define GPIO_PIN3_PAD_PULL_GET(x) WLAN_GPIO_PIN3_PAD_PULL_GET(x) -#define GPIO_PIN3_PAD_PULL_SET(x) WLAN_GPIO_PIN3_PAD_PULL_SET(x) -#define GPIO_PIN3_PAD_STRENGTH_MSB WLAN_GPIO_PIN3_PAD_STRENGTH_MSB -#define GPIO_PIN3_PAD_STRENGTH_LSB WLAN_GPIO_PIN3_PAD_STRENGTH_LSB -#define GPIO_PIN3_PAD_STRENGTH_MASK WLAN_GPIO_PIN3_PAD_STRENGTH_MASK -#define GPIO_PIN3_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN3_PAD_STRENGTH_GET(x) -#define GPIO_PIN3_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN3_PAD_STRENGTH_SET(x) -#define GPIO_PIN3_PAD_DRIVER_MSB WLAN_GPIO_PIN3_PAD_DRIVER_MSB -#define GPIO_PIN3_PAD_DRIVER_LSB WLAN_GPIO_PIN3_PAD_DRIVER_LSB -#define GPIO_PIN3_PAD_DRIVER_MASK WLAN_GPIO_PIN3_PAD_DRIVER_MASK -#define GPIO_PIN3_PAD_DRIVER_GET(x) WLAN_GPIO_PIN3_PAD_DRIVER_GET(x) -#define GPIO_PIN3_PAD_DRIVER_SET(x) WLAN_GPIO_PIN3_PAD_DRIVER_SET(x) -#define GPIO_PIN3_SOURCE_MSB WLAN_GPIO_PIN3_SOURCE_MSB -#define GPIO_PIN3_SOURCE_LSB WLAN_GPIO_PIN3_SOURCE_LSB -#define GPIO_PIN3_SOURCE_MASK WLAN_GPIO_PIN3_SOURCE_MASK -#define GPIO_PIN3_SOURCE_GET(x) WLAN_GPIO_PIN3_SOURCE_GET(x) -#define GPIO_PIN3_SOURCE_SET(x) WLAN_GPIO_PIN3_SOURCE_SET(x) -#define GPIO_PIN4_ADDRESS WLAN_GPIO_PIN4_ADDRESS -#define GPIO_PIN4_OFFSET WLAN_GPIO_PIN4_OFFSET -#define GPIO_PIN4_CONFIG_MSB WLAN_GPIO_PIN4_CONFIG_MSB -#define GPIO_PIN4_CONFIG_LSB WLAN_GPIO_PIN4_CONFIG_LSB -#define GPIO_PIN4_CONFIG_MASK WLAN_GPIO_PIN4_CONFIG_MASK -#define GPIO_PIN4_CONFIG_GET(x) WLAN_GPIO_PIN4_CONFIG_GET(x) -#define GPIO_PIN4_CONFIG_SET(x) WLAN_GPIO_PIN4_CONFIG_SET(x) -#define GPIO_PIN4_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN4_WAKEUP_ENABLE_MSB -#define GPIO_PIN4_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN4_WAKEUP_ENABLE_LSB -#define GPIO_PIN4_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN4_WAKEUP_ENABLE_MASK -#define GPIO_PIN4_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN4_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN4_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN4_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN4_INT_TYPE_MSB WLAN_GPIO_PIN4_INT_TYPE_MSB -#define GPIO_PIN4_INT_TYPE_LSB WLAN_GPIO_PIN4_INT_TYPE_LSB -#define GPIO_PIN4_INT_TYPE_MASK WLAN_GPIO_PIN4_INT_TYPE_MASK -#define GPIO_PIN4_INT_TYPE_GET(x) WLAN_GPIO_PIN4_INT_TYPE_GET(x) -#define GPIO_PIN4_INT_TYPE_SET(x) WLAN_GPIO_PIN4_INT_TYPE_SET(x) -#define GPIO_PIN4_PAD_PULL_MSB WLAN_GPIO_PIN4_PAD_PULL_MSB -#define GPIO_PIN4_PAD_PULL_LSB WLAN_GPIO_PIN4_PAD_PULL_LSB -#define GPIO_PIN4_PAD_PULL_MASK WLAN_GPIO_PIN4_PAD_PULL_MASK -#define GPIO_PIN4_PAD_PULL_GET(x) WLAN_GPIO_PIN4_PAD_PULL_GET(x) -#define GPIO_PIN4_PAD_PULL_SET(x) WLAN_GPIO_PIN4_PAD_PULL_SET(x) -#define GPIO_PIN4_PAD_STRENGTH_MSB WLAN_GPIO_PIN4_PAD_STRENGTH_MSB -#define GPIO_PIN4_PAD_STRENGTH_LSB WLAN_GPIO_PIN4_PAD_STRENGTH_LSB -#define GPIO_PIN4_PAD_STRENGTH_MASK WLAN_GPIO_PIN4_PAD_STRENGTH_MASK -#define GPIO_PIN4_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN4_PAD_STRENGTH_GET(x) -#define GPIO_PIN4_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN4_PAD_STRENGTH_SET(x) -#define GPIO_PIN4_PAD_DRIVER_MSB WLAN_GPIO_PIN4_PAD_DRIVER_MSB -#define GPIO_PIN4_PAD_DRIVER_LSB WLAN_GPIO_PIN4_PAD_DRIVER_LSB -#define GPIO_PIN4_PAD_DRIVER_MASK WLAN_GPIO_PIN4_PAD_DRIVER_MASK -#define GPIO_PIN4_PAD_DRIVER_GET(x) WLAN_GPIO_PIN4_PAD_DRIVER_GET(x) -#define GPIO_PIN4_PAD_DRIVER_SET(x) WLAN_GPIO_PIN4_PAD_DRIVER_SET(x) -#define GPIO_PIN4_SOURCE_MSB WLAN_GPIO_PIN4_SOURCE_MSB -#define GPIO_PIN4_SOURCE_LSB WLAN_GPIO_PIN4_SOURCE_LSB -#define GPIO_PIN4_SOURCE_MASK WLAN_GPIO_PIN4_SOURCE_MASK -#define GPIO_PIN4_SOURCE_GET(x) WLAN_GPIO_PIN4_SOURCE_GET(x) -#define GPIO_PIN4_SOURCE_SET(x) WLAN_GPIO_PIN4_SOURCE_SET(x) -#define GPIO_PIN5_ADDRESS WLAN_GPIO_PIN5_ADDRESS -#define GPIO_PIN5_OFFSET WLAN_GPIO_PIN5_OFFSET -#define GPIO_PIN5_CONFIG_MSB WLAN_GPIO_PIN5_CONFIG_MSB -#define GPIO_PIN5_CONFIG_LSB WLAN_GPIO_PIN5_CONFIG_LSB -#define GPIO_PIN5_CONFIG_MASK WLAN_GPIO_PIN5_CONFIG_MASK -#define GPIO_PIN5_CONFIG_GET(x) WLAN_GPIO_PIN5_CONFIG_GET(x) -#define GPIO_PIN5_CONFIG_SET(x) WLAN_GPIO_PIN5_CONFIG_SET(x) -#define GPIO_PIN5_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN5_WAKEUP_ENABLE_MSB -#define GPIO_PIN5_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN5_WAKEUP_ENABLE_LSB -#define GPIO_PIN5_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN5_WAKEUP_ENABLE_MASK -#define GPIO_PIN5_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN5_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN5_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN5_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN5_INT_TYPE_MSB WLAN_GPIO_PIN5_INT_TYPE_MSB -#define GPIO_PIN5_INT_TYPE_LSB WLAN_GPIO_PIN5_INT_TYPE_LSB -#define GPIO_PIN5_INT_TYPE_MASK WLAN_GPIO_PIN5_INT_TYPE_MASK -#define GPIO_PIN5_INT_TYPE_GET(x) WLAN_GPIO_PIN5_INT_TYPE_GET(x) -#define GPIO_PIN5_INT_TYPE_SET(x) WLAN_GPIO_PIN5_INT_TYPE_SET(x) -#define GPIO_PIN5_PAD_PULL_MSB WLAN_GPIO_PIN5_PAD_PULL_MSB -#define GPIO_PIN5_PAD_PULL_LSB WLAN_GPIO_PIN5_PAD_PULL_LSB -#define GPIO_PIN5_PAD_PULL_MASK WLAN_GPIO_PIN5_PAD_PULL_MASK -#define GPIO_PIN5_PAD_PULL_GET(x) WLAN_GPIO_PIN5_PAD_PULL_GET(x) -#define GPIO_PIN5_PAD_PULL_SET(x) WLAN_GPIO_PIN5_PAD_PULL_SET(x) -#define GPIO_PIN5_PAD_STRENGTH_MSB WLAN_GPIO_PIN5_PAD_STRENGTH_MSB -#define GPIO_PIN5_PAD_STRENGTH_LSB WLAN_GPIO_PIN5_PAD_STRENGTH_LSB -#define GPIO_PIN5_PAD_STRENGTH_MASK WLAN_GPIO_PIN5_PAD_STRENGTH_MASK -#define GPIO_PIN5_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN5_PAD_STRENGTH_GET(x) -#define GPIO_PIN5_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN5_PAD_STRENGTH_SET(x) -#define GPIO_PIN5_PAD_DRIVER_MSB WLAN_GPIO_PIN5_PAD_DRIVER_MSB -#define GPIO_PIN5_PAD_DRIVER_LSB WLAN_GPIO_PIN5_PAD_DRIVER_LSB -#define GPIO_PIN5_PAD_DRIVER_MASK WLAN_GPIO_PIN5_PAD_DRIVER_MASK -#define GPIO_PIN5_PAD_DRIVER_GET(x) WLAN_GPIO_PIN5_PAD_DRIVER_GET(x) -#define GPIO_PIN5_PAD_DRIVER_SET(x) WLAN_GPIO_PIN5_PAD_DRIVER_SET(x) -#define GPIO_PIN5_SOURCE_MSB WLAN_GPIO_PIN5_SOURCE_MSB -#define GPIO_PIN5_SOURCE_LSB WLAN_GPIO_PIN5_SOURCE_LSB -#define GPIO_PIN5_SOURCE_MASK WLAN_GPIO_PIN5_SOURCE_MASK -#define GPIO_PIN5_SOURCE_GET(x) WLAN_GPIO_PIN5_SOURCE_GET(x) -#define GPIO_PIN5_SOURCE_SET(x) WLAN_GPIO_PIN5_SOURCE_SET(x) -#define GPIO_PIN6_ADDRESS WLAN_GPIO_PIN6_ADDRESS -#define GPIO_PIN6_OFFSET WLAN_GPIO_PIN6_OFFSET -#define GPIO_PIN6_CONFIG_MSB WLAN_GPIO_PIN6_CONFIG_MSB -#define GPIO_PIN6_CONFIG_LSB WLAN_GPIO_PIN6_CONFIG_LSB -#define GPIO_PIN6_CONFIG_MASK WLAN_GPIO_PIN6_CONFIG_MASK -#define GPIO_PIN6_CONFIG_GET(x) WLAN_GPIO_PIN6_CONFIG_GET(x) -#define GPIO_PIN6_CONFIG_SET(x) WLAN_GPIO_PIN6_CONFIG_SET(x) -#define GPIO_PIN6_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN6_WAKEUP_ENABLE_MSB -#define GPIO_PIN6_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN6_WAKEUP_ENABLE_LSB -#define GPIO_PIN6_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN6_WAKEUP_ENABLE_MASK -#define GPIO_PIN6_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN6_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN6_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN6_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN6_INT_TYPE_MSB WLAN_GPIO_PIN6_INT_TYPE_MSB -#define GPIO_PIN6_INT_TYPE_LSB WLAN_GPIO_PIN6_INT_TYPE_LSB -#define GPIO_PIN6_INT_TYPE_MASK WLAN_GPIO_PIN6_INT_TYPE_MASK -#define GPIO_PIN6_INT_TYPE_GET(x) WLAN_GPIO_PIN6_INT_TYPE_GET(x) -#define GPIO_PIN6_INT_TYPE_SET(x) WLAN_GPIO_PIN6_INT_TYPE_SET(x) -#define GPIO_PIN6_PAD_PULL_MSB WLAN_GPIO_PIN6_PAD_PULL_MSB -#define GPIO_PIN6_PAD_PULL_LSB WLAN_GPIO_PIN6_PAD_PULL_LSB -#define GPIO_PIN6_PAD_PULL_MASK WLAN_GPIO_PIN6_PAD_PULL_MASK -#define GPIO_PIN6_PAD_PULL_GET(x) WLAN_GPIO_PIN6_PAD_PULL_GET(x) -#define GPIO_PIN6_PAD_PULL_SET(x) WLAN_GPIO_PIN6_PAD_PULL_SET(x) -#define GPIO_PIN6_PAD_STRENGTH_MSB WLAN_GPIO_PIN6_PAD_STRENGTH_MSB -#define GPIO_PIN6_PAD_STRENGTH_LSB WLAN_GPIO_PIN6_PAD_STRENGTH_LSB -#define GPIO_PIN6_PAD_STRENGTH_MASK WLAN_GPIO_PIN6_PAD_STRENGTH_MASK -#define GPIO_PIN6_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN6_PAD_STRENGTH_GET(x) -#define GPIO_PIN6_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN6_PAD_STRENGTH_SET(x) -#define GPIO_PIN6_PAD_DRIVER_MSB WLAN_GPIO_PIN6_PAD_DRIVER_MSB -#define GPIO_PIN6_PAD_DRIVER_LSB WLAN_GPIO_PIN6_PAD_DRIVER_LSB -#define GPIO_PIN6_PAD_DRIVER_MASK WLAN_GPIO_PIN6_PAD_DRIVER_MASK -#define GPIO_PIN6_PAD_DRIVER_GET(x) WLAN_GPIO_PIN6_PAD_DRIVER_GET(x) -#define GPIO_PIN6_PAD_DRIVER_SET(x) WLAN_GPIO_PIN6_PAD_DRIVER_SET(x) -#define GPIO_PIN6_SOURCE_MSB WLAN_GPIO_PIN6_SOURCE_MSB -#define GPIO_PIN6_SOURCE_LSB WLAN_GPIO_PIN6_SOURCE_LSB -#define GPIO_PIN6_SOURCE_MASK WLAN_GPIO_PIN6_SOURCE_MASK -#define GPIO_PIN6_SOURCE_GET(x) WLAN_GPIO_PIN6_SOURCE_GET(x) -#define GPIO_PIN6_SOURCE_SET(x) WLAN_GPIO_PIN6_SOURCE_SET(x) -#define GPIO_PIN7_ADDRESS WLAN_GPIO_PIN7_ADDRESS -#define GPIO_PIN7_OFFSET WLAN_GPIO_PIN7_OFFSET -#define GPIO_PIN7_CONFIG_MSB WLAN_GPIO_PIN7_CONFIG_MSB -#define GPIO_PIN7_CONFIG_LSB WLAN_GPIO_PIN7_CONFIG_LSB -#define GPIO_PIN7_CONFIG_MASK WLAN_GPIO_PIN7_CONFIG_MASK -#define GPIO_PIN7_CONFIG_GET(x) WLAN_GPIO_PIN7_CONFIG_GET(x) -#define GPIO_PIN7_CONFIG_SET(x) WLAN_GPIO_PIN7_CONFIG_SET(x) -#define GPIO_PIN7_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN7_WAKEUP_ENABLE_MSB -#define GPIO_PIN7_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN7_WAKEUP_ENABLE_LSB -#define GPIO_PIN7_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN7_WAKEUP_ENABLE_MASK -#define GPIO_PIN7_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN7_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN7_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN7_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN7_INT_TYPE_MSB WLAN_GPIO_PIN7_INT_TYPE_MSB -#define GPIO_PIN7_INT_TYPE_LSB WLAN_GPIO_PIN7_INT_TYPE_LSB -#define GPIO_PIN7_INT_TYPE_MASK WLAN_GPIO_PIN7_INT_TYPE_MASK -#define GPIO_PIN7_INT_TYPE_GET(x) WLAN_GPIO_PIN7_INT_TYPE_GET(x) -#define GPIO_PIN7_INT_TYPE_SET(x) WLAN_GPIO_PIN7_INT_TYPE_SET(x) -#define GPIO_PIN7_PAD_PULL_MSB WLAN_GPIO_PIN7_PAD_PULL_MSB -#define GPIO_PIN7_PAD_PULL_LSB WLAN_GPIO_PIN7_PAD_PULL_LSB -#define GPIO_PIN7_PAD_PULL_MASK WLAN_GPIO_PIN7_PAD_PULL_MASK -#define GPIO_PIN7_PAD_PULL_GET(x) WLAN_GPIO_PIN7_PAD_PULL_GET(x) -#define GPIO_PIN7_PAD_PULL_SET(x) WLAN_GPIO_PIN7_PAD_PULL_SET(x) -#define GPIO_PIN7_PAD_STRENGTH_MSB WLAN_GPIO_PIN7_PAD_STRENGTH_MSB -#define GPIO_PIN7_PAD_STRENGTH_LSB WLAN_GPIO_PIN7_PAD_STRENGTH_LSB -#define GPIO_PIN7_PAD_STRENGTH_MASK WLAN_GPIO_PIN7_PAD_STRENGTH_MASK -#define GPIO_PIN7_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN7_PAD_STRENGTH_GET(x) -#define GPIO_PIN7_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN7_PAD_STRENGTH_SET(x) -#define GPIO_PIN7_PAD_DRIVER_MSB WLAN_GPIO_PIN7_PAD_DRIVER_MSB -#define GPIO_PIN7_PAD_DRIVER_LSB WLAN_GPIO_PIN7_PAD_DRIVER_LSB -#define GPIO_PIN7_PAD_DRIVER_MASK WLAN_GPIO_PIN7_PAD_DRIVER_MASK -#define GPIO_PIN7_PAD_DRIVER_GET(x) WLAN_GPIO_PIN7_PAD_DRIVER_GET(x) -#define GPIO_PIN7_PAD_DRIVER_SET(x) WLAN_GPIO_PIN7_PAD_DRIVER_SET(x) -#define GPIO_PIN7_SOURCE_MSB WLAN_GPIO_PIN7_SOURCE_MSB -#define GPIO_PIN7_SOURCE_LSB WLAN_GPIO_PIN7_SOURCE_LSB -#define GPIO_PIN7_SOURCE_MASK WLAN_GPIO_PIN7_SOURCE_MASK -#define GPIO_PIN7_SOURCE_GET(x) WLAN_GPIO_PIN7_SOURCE_GET(x) -#define GPIO_PIN7_SOURCE_SET(x) WLAN_GPIO_PIN7_SOURCE_SET(x) -#define GPIO_PIN8_ADDRESS WLAN_GPIO_PIN8_ADDRESS -#define GPIO_PIN8_OFFSET WLAN_GPIO_PIN8_OFFSET -#define GPIO_PIN8_CONFIG_MSB WLAN_GPIO_PIN8_CONFIG_MSB -#define GPIO_PIN8_CONFIG_LSB WLAN_GPIO_PIN8_CONFIG_LSB -#define GPIO_PIN8_CONFIG_MASK WLAN_GPIO_PIN8_CONFIG_MASK -#define GPIO_PIN8_CONFIG_GET(x) WLAN_GPIO_PIN8_CONFIG_GET(x) -#define GPIO_PIN8_CONFIG_SET(x) WLAN_GPIO_PIN8_CONFIG_SET(x) -#define GPIO_PIN8_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN8_WAKEUP_ENABLE_MSB -#define GPIO_PIN8_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN8_WAKEUP_ENABLE_LSB -#define GPIO_PIN8_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN8_WAKEUP_ENABLE_MASK -#define GPIO_PIN8_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN8_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN8_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN8_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN8_INT_TYPE_MSB WLAN_GPIO_PIN8_INT_TYPE_MSB -#define GPIO_PIN8_INT_TYPE_LSB WLAN_GPIO_PIN8_INT_TYPE_LSB -#define GPIO_PIN8_INT_TYPE_MASK WLAN_GPIO_PIN8_INT_TYPE_MASK -#define GPIO_PIN8_INT_TYPE_GET(x) WLAN_GPIO_PIN8_INT_TYPE_GET(x) -#define GPIO_PIN8_INT_TYPE_SET(x) WLAN_GPIO_PIN8_INT_TYPE_SET(x) -#define GPIO_PIN8_PAD_PULL_MSB WLAN_GPIO_PIN8_PAD_PULL_MSB -#define GPIO_PIN8_PAD_PULL_LSB WLAN_GPIO_PIN8_PAD_PULL_LSB -#define GPIO_PIN8_PAD_PULL_MASK WLAN_GPIO_PIN8_PAD_PULL_MASK -#define GPIO_PIN8_PAD_PULL_GET(x) WLAN_GPIO_PIN8_PAD_PULL_GET(x) -#define GPIO_PIN8_PAD_PULL_SET(x) WLAN_GPIO_PIN8_PAD_PULL_SET(x) -#define GPIO_PIN8_PAD_STRENGTH_MSB WLAN_GPIO_PIN8_PAD_STRENGTH_MSB -#define GPIO_PIN8_PAD_STRENGTH_LSB WLAN_GPIO_PIN8_PAD_STRENGTH_LSB -#define GPIO_PIN8_PAD_STRENGTH_MASK WLAN_GPIO_PIN8_PAD_STRENGTH_MASK -#define GPIO_PIN8_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN8_PAD_STRENGTH_GET(x) -#define GPIO_PIN8_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN8_PAD_STRENGTH_SET(x) -#define GPIO_PIN8_PAD_DRIVER_MSB WLAN_GPIO_PIN8_PAD_DRIVER_MSB -#define GPIO_PIN8_PAD_DRIVER_LSB WLAN_GPIO_PIN8_PAD_DRIVER_LSB -#define GPIO_PIN8_PAD_DRIVER_MASK WLAN_GPIO_PIN8_PAD_DRIVER_MASK -#define GPIO_PIN8_PAD_DRIVER_GET(x) WLAN_GPIO_PIN8_PAD_DRIVER_GET(x) -#define GPIO_PIN8_PAD_DRIVER_SET(x) WLAN_GPIO_PIN8_PAD_DRIVER_SET(x) -#define GPIO_PIN8_SOURCE_MSB WLAN_GPIO_PIN8_SOURCE_MSB -#define GPIO_PIN8_SOURCE_LSB WLAN_GPIO_PIN8_SOURCE_LSB -#define GPIO_PIN8_SOURCE_MASK WLAN_GPIO_PIN8_SOURCE_MASK -#define GPIO_PIN8_SOURCE_GET(x) WLAN_GPIO_PIN8_SOURCE_GET(x) -#define GPIO_PIN8_SOURCE_SET(x) WLAN_GPIO_PIN8_SOURCE_SET(x) -#define GPIO_PIN9_ADDRESS WLAN_GPIO_PIN9_ADDRESS -#define GPIO_PIN9_OFFSET WLAN_GPIO_PIN9_OFFSET -#define GPIO_PIN9_CONFIG_MSB WLAN_GPIO_PIN9_CONFIG_MSB -#define GPIO_PIN9_CONFIG_LSB WLAN_GPIO_PIN9_CONFIG_LSB -#define GPIO_PIN9_CONFIG_MASK WLAN_GPIO_PIN9_CONFIG_MASK -#define GPIO_PIN9_CONFIG_GET(x) WLAN_GPIO_PIN9_CONFIG_GET(x) -#define GPIO_PIN9_CONFIG_SET(x) WLAN_GPIO_PIN9_CONFIG_SET(x) -#define GPIO_PIN9_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN9_WAKEUP_ENABLE_MSB -#define GPIO_PIN9_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN9_WAKEUP_ENABLE_LSB -#define GPIO_PIN9_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN9_WAKEUP_ENABLE_MASK -#define GPIO_PIN9_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN9_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN9_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN9_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN9_INT_TYPE_MSB WLAN_GPIO_PIN9_INT_TYPE_MSB -#define GPIO_PIN9_INT_TYPE_LSB WLAN_GPIO_PIN9_INT_TYPE_LSB -#define GPIO_PIN9_INT_TYPE_MASK WLAN_GPIO_PIN9_INT_TYPE_MASK -#define GPIO_PIN9_INT_TYPE_GET(x) WLAN_GPIO_PIN9_INT_TYPE_GET(x) -#define GPIO_PIN9_INT_TYPE_SET(x) WLAN_GPIO_PIN9_INT_TYPE_SET(x) -#define GPIO_PIN9_PAD_PULL_MSB WLAN_GPIO_PIN9_PAD_PULL_MSB -#define GPIO_PIN9_PAD_PULL_LSB WLAN_GPIO_PIN9_PAD_PULL_LSB -#define GPIO_PIN9_PAD_PULL_MASK WLAN_GPIO_PIN9_PAD_PULL_MASK -#define GPIO_PIN9_PAD_PULL_GET(x) WLAN_GPIO_PIN9_PAD_PULL_GET(x) -#define GPIO_PIN9_PAD_PULL_SET(x) WLAN_GPIO_PIN9_PAD_PULL_SET(x) -#define GPIO_PIN9_PAD_STRENGTH_MSB WLAN_GPIO_PIN9_PAD_STRENGTH_MSB -#define GPIO_PIN9_PAD_STRENGTH_LSB WLAN_GPIO_PIN9_PAD_STRENGTH_LSB -#define GPIO_PIN9_PAD_STRENGTH_MASK WLAN_GPIO_PIN9_PAD_STRENGTH_MASK -#define GPIO_PIN9_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN9_PAD_STRENGTH_GET(x) -#define GPIO_PIN9_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN9_PAD_STRENGTH_SET(x) -#define GPIO_PIN9_PAD_DRIVER_MSB WLAN_GPIO_PIN9_PAD_DRIVER_MSB -#define GPIO_PIN9_PAD_DRIVER_LSB WLAN_GPIO_PIN9_PAD_DRIVER_LSB -#define GPIO_PIN9_PAD_DRIVER_MASK WLAN_GPIO_PIN9_PAD_DRIVER_MASK -#define GPIO_PIN9_PAD_DRIVER_GET(x) WLAN_GPIO_PIN9_PAD_DRIVER_GET(x) -#define GPIO_PIN9_PAD_DRIVER_SET(x) WLAN_GPIO_PIN9_PAD_DRIVER_SET(x) -#define GPIO_PIN9_SOURCE_MSB WLAN_GPIO_PIN9_SOURCE_MSB -#define GPIO_PIN9_SOURCE_LSB WLAN_GPIO_PIN9_SOURCE_LSB -#define GPIO_PIN9_SOURCE_MASK WLAN_GPIO_PIN9_SOURCE_MASK -#define GPIO_PIN9_SOURCE_GET(x) WLAN_GPIO_PIN9_SOURCE_GET(x) -#define GPIO_PIN9_SOURCE_SET(x) WLAN_GPIO_PIN9_SOURCE_SET(x) -#define GPIO_PIN10_ADDRESS WLAN_GPIO_PIN10_ADDRESS -#define GPIO_PIN10_OFFSET WLAN_GPIO_PIN10_OFFSET -#define GPIO_PIN10_CONFIG_MSB WLAN_GPIO_PIN10_CONFIG_MSB -#define GPIO_PIN10_CONFIG_LSB WLAN_GPIO_PIN10_CONFIG_LSB -#define GPIO_PIN10_CONFIG_MASK WLAN_GPIO_PIN10_CONFIG_MASK -#define GPIO_PIN10_CONFIG_GET(x) WLAN_GPIO_PIN10_CONFIG_GET(x) -#define GPIO_PIN10_CONFIG_SET(x) WLAN_GPIO_PIN10_CONFIG_SET(x) -#define GPIO_PIN10_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN10_WAKEUP_ENABLE_MSB -#define GPIO_PIN10_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN10_WAKEUP_ENABLE_LSB -#define GPIO_PIN10_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN10_WAKEUP_ENABLE_MASK -#define GPIO_PIN10_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN10_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN10_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN10_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN10_INT_TYPE_MSB WLAN_GPIO_PIN10_INT_TYPE_MSB -#define GPIO_PIN10_INT_TYPE_LSB WLAN_GPIO_PIN10_INT_TYPE_LSB -#define GPIO_PIN10_INT_TYPE_MASK WLAN_GPIO_PIN10_INT_TYPE_MASK -#define GPIO_PIN10_INT_TYPE_GET(x) WLAN_GPIO_PIN10_INT_TYPE_GET(x) -#define GPIO_PIN10_INT_TYPE_SET(x) WLAN_GPIO_PIN10_INT_TYPE_SET(x) -#define GPIO_PIN10_PAD_PULL_MSB WLAN_GPIO_PIN10_PAD_PULL_MSB -#define GPIO_PIN10_PAD_PULL_LSB WLAN_GPIO_PIN10_PAD_PULL_LSB -#define GPIO_PIN10_PAD_PULL_MASK WLAN_GPIO_PIN10_PAD_PULL_MASK -#define GPIO_PIN10_PAD_PULL_GET(x) WLAN_GPIO_PIN10_PAD_PULL_GET(x) -#define GPIO_PIN10_PAD_PULL_SET(x) WLAN_GPIO_PIN10_PAD_PULL_SET(x) -#define GPIO_PIN10_PAD_STRENGTH_MSB WLAN_GPIO_PIN10_PAD_STRENGTH_MSB -#define GPIO_PIN10_PAD_STRENGTH_LSB WLAN_GPIO_PIN10_PAD_STRENGTH_LSB -#define GPIO_PIN10_PAD_STRENGTH_MASK WLAN_GPIO_PIN10_PAD_STRENGTH_MASK -#define GPIO_PIN10_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN10_PAD_STRENGTH_GET(x) -#define GPIO_PIN10_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN10_PAD_STRENGTH_SET(x) -#define GPIO_PIN10_PAD_DRIVER_MSB WLAN_GPIO_PIN10_PAD_DRIVER_MSB -#define GPIO_PIN10_PAD_DRIVER_LSB WLAN_GPIO_PIN10_PAD_DRIVER_LSB -#define GPIO_PIN10_PAD_DRIVER_MASK WLAN_GPIO_PIN10_PAD_DRIVER_MASK -#define GPIO_PIN10_PAD_DRIVER_GET(x) WLAN_GPIO_PIN10_PAD_DRIVER_GET(x) -#define GPIO_PIN10_PAD_DRIVER_SET(x) WLAN_GPIO_PIN10_PAD_DRIVER_SET(x) -#define GPIO_PIN10_SOURCE_MSB WLAN_GPIO_PIN10_SOURCE_MSB -#define GPIO_PIN10_SOURCE_LSB WLAN_GPIO_PIN10_SOURCE_LSB -#define GPIO_PIN10_SOURCE_MASK WLAN_GPIO_PIN10_SOURCE_MASK -#define GPIO_PIN10_SOURCE_GET(x) WLAN_GPIO_PIN10_SOURCE_GET(x) -#define GPIO_PIN10_SOURCE_SET(x) WLAN_GPIO_PIN10_SOURCE_SET(x) -#define GPIO_PIN11_ADDRESS WLAN_GPIO_PIN11_ADDRESS -#define GPIO_PIN11_OFFSET WLAN_GPIO_PIN11_OFFSET -#define GPIO_PIN11_CONFIG_MSB WLAN_GPIO_PIN11_CONFIG_MSB -#define GPIO_PIN11_CONFIG_LSB WLAN_GPIO_PIN11_CONFIG_LSB -#define GPIO_PIN11_CONFIG_MASK WLAN_GPIO_PIN11_CONFIG_MASK -#define GPIO_PIN11_CONFIG_GET(x) WLAN_GPIO_PIN11_CONFIG_GET(x) -#define GPIO_PIN11_CONFIG_SET(x) WLAN_GPIO_PIN11_CONFIG_SET(x) -#define GPIO_PIN11_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN11_WAKEUP_ENABLE_MSB -#define GPIO_PIN11_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN11_WAKEUP_ENABLE_LSB -#define GPIO_PIN11_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN11_WAKEUP_ENABLE_MASK -#define GPIO_PIN11_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN11_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN11_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN11_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN11_INT_TYPE_MSB WLAN_GPIO_PIN11_INT_TYPE_MSB -#define GPIO_PIN11_INT_TYPE_LSB WLAN_GPIO_PIN11_INT_TYPE_LSB -#define GPIO_PIN11_INT_TYPE_MASK WLAN_GPIO_PIN11_INT_TYPE_MASK -#define GPIO_PIN11_INT_TYPE_GET(x) WLAN_GPIO_PIN11_INT_TYPE_GET(x) -#define GPIO_PIN11_INT_TYPE_SET(x) WLAN_GPIO_PIN11_INT_TYPE_SET(x) -#define GPIO_PIN11_PAD_PULL_MSB WLAN_GPIO_PIN11_PAD_PULL_MSB -#define GPIO_PIN11_PAD_PULL_LSB WLAN_GPIO_PIN11_PAD_PULL_LSB -#define GPIO_PIN11_PAD_PULL_MASK WLAN_GPIO_PIN11_PAD_PULL_MASK -#define GPIO_PIN11_PAD_PULL_GET(x) WLAN_GPIO_PIN11_PAD_PULL_GET(x) -#define GPIO_PIN11_PAD_PULL_SET(x) WLAN_GPIO_PIN11_PAD_PULL_SET(x) -#define GPIO_PIN11_PAD_STRENGTH_MSB WLAN_GPIO_PIN11_PAD_STRENGTH_MSB -#define GPIO_PIN11_PAD_STRENGTH_LSB WLAN_GPIO_PIN11_PAD_STRENGTH_LSB -#define GPIO_PIN11_PAD_STRENGTH_MASK WLAN_GPIO_PIN11_PAD_STRENGTH_MASK -#define GPIO_PIN11_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN11_PAD_STRENGTH_GET(x) -#define GPIO_PIN11_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN11_PAD_STRENGTH_SET(x) -#define GPIO_PIN11_PAD_DRIVER_MSB WLAN_GPIO_PIN11_PAD_DRIVER_MSB -#define GPIO_PIN11_PAD_DRIVER_LSB WLAN_GPIO_PIN11_PAD_DRIVER_LSB -#define GPIO_PIN11_PAD_DRIVER_MASK WLAN_GPIO_PIN11_PAD_DRIVER_MASK -#define GPIO_PIN11_PAD_DRIVER_GET(x) WLAN_GPIO_PIN11_PAD_DRIVER_GET(x) -#define GPIO_PIN11_PAD_DRIVER_SET(x) WLAN_GPIO_PIN11_PAD_DRIVER_SET(x) -#define GPIO_PIN11_SOURCE_MSB WLAN_GPIO_PIN11_SOURCE_MSB -#define GPIO_PIN11_SOURCE_LSB WLAN_GPIO_PIN11_SOURCE_LSB -#define GPIO_PIN11_SOURCE_MASK WLAN_GPIO_PIN11_SOURCE_MASK -#define GPIO_PIN11_SOURCE_GET(x) WLAN_GPIO_PIN11_SOURCE_GET(x) -#define GPIO_PIN11_SOURCE_SET(x) WLAN_GPIO_PIN11_SOURCE_SET(x) -#define GPIO_PIN12_ADDRESS WLAN_GPIO_PIN12_ADDRESS -#define GPIO_PIN12_OFFSET WLAN_GPIO_PIN12_OFFSET -#define GPIO_PIN12_CONFIG_MSB WLAN_GPIO_PIN12_CONFIG_MSB -#define GPIO_PIN12_CONFIG_LSB WLAN_GPIO_PIN12_CONFIG_LSB -#define GPIO_PIN12_CONFIG_MASK WLAN_GPIO_PIN12_CONFIG_MASK -#define GPIO_PIN12_CONFIG_GET(x) WLAN_GPIO_PIN12_CONFIG_GET(x) -#define GPIO_PIN12_CONFIG_SET(x) WLAN_GPIO_PIN12_CONFIG_SET(x) -#define GPIO_PIN12_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN12_WAKEUP_ENABLE_MSB -#define GPIO_PIN12_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN12_WAKEUP_ENABLE_LSB -#define GPIO_PIN12_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN12_WAKEUP_ENABLE_MASK -#define GPIO_PIN12_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN12_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN12_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN12_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN12_INT_TYPE_MSB WLAN_GPIO_PIN12_INT_TYPE_MSB -#define GPIO_PIN12_INT_TYPE_LSB WLAN_GPIO_PIN12_INT_TYPE_LSB -#define GPIO_PIN12_INT_TYPE_MASK WLAN_GPIO_PIN12_INT_TYPE_MASK -#define GPIO_PIN12_INT_TYPE_GET(x) WLAN_GPIO_PIN12_INT_TYPE_GET(x) -#define GPIO_PIN12_INT_TYPE_SET(x) WLAN_GPIO_PIN12_INT_TYPE_SET(x) -#define GPIO_PIN12_PAD_PULL_MSB WLAN_GPIO_PIN12_PAD_PULL_MSB -#define GPIO_PIN12_PAD_PULL_LSB WLAN_GPIO_PIN12_PAD_PULL_LSB -#define GPIO_PIN12_PAD_PULL_MASK WLAN_GPIO_PIN12_PAD_PULL_MASK -#define GPIO_PIN12_PAD_PULL_GET(x) WLAN_GPIO_PIN12_PAD_PULL_GET(x) -#define GPIO_PIN12_PAD_PULL_SET(x) WLAN_GPIO_PIN12_PAD_PULL_SET(x) -#define GPIO_PIN12_PAD_STRENGTH_MSB WLAN_GPIO_PIN12_PAD_STRENGTH_MSB -#define GPIO_PIN12_PAD_STRENGTH_LSB WLAN_GPIO_PIN12_PAD_STRENGTH_LSB -#define GPIO_PIN12_PAD_STRENGTH_MASK WLAN_GPIO_PIN12_PAD_STRENGTH_MASK -#define GPIO_PIN12_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN12_PAD_STRENGTH_GET(x) -#define GPIO_PIN12_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN12_PAD_STRENGTH_SET(x) -#define GPIO_PIN12_PAD_DRIVER_MSB WLAN_GPIO_PIN12_PAD_DRIVER_MSB -#define GPIO_PIN12_PAD_DRIVER_LSB WLAN_GPIO_PIN12_PAD_DRIVER_LSB -#define GPIO_PIN12_PAD_DRIVER_MASK WLAN_GPIO_PIN12_PAD_DRIVER_MASK -#define GPIO_PIN12_PAD_DRIVER_GET(x) WLAN_GPIO_PIN12_PAD_DRIVER_GET(x) -#define GPIO_PIN12_PAD_DRIVER_SET(x) WLAN_GPIO_PIN12_PAD_DRIVER_SET(x) -#define GPIO_PIN12_SOURCE_MSB WLAN_GPIO_PIN12_SOURCE_MSB -#define GPIO_PIN12_SOURCE_LSB WLAN_GPIO_PIN12_SOURCE_LSB -#define GPIO_PIN12_SOURCE_MASK WLAN_GPIO_PIN12_SOURCE_MASK -#define GPIO_PIN12_SOURCE_GET(x) WLAN_GPIO_PIN12_SOURCE_GET(x) -#define GPIO_PIN12_SOURCE_SET(x) WLAN_GPIO_PIN12_SOURCE_SET(x) -#define GPIO_PIN13_ADDRESS WLAN_GPIO_PIN13_ADDRESS -#define GPIO_PIN13_OFFSET WLAN_GPIO_PIN13_OFFSET -#define GPIO_PIN13_CONFIG_MSB WLAN_GPIO_PIN13_CONFIG_MSB -#define GPIO_PIN13_CONFIG_LSB WLAN_GPIO_PIN13_CONFIG_LSB -#define GPIO_PIN13_CONFIG_MASK WLAN_GPIO_PIN13_CONFIG_MASK -#define GPIO_PIN13_CONFIG_GET(x) WLAN_GPIO_PIN13_CONFIG_GET(x) -#define GPIO_PIN13_CONFIG_SET(x) WLAN_GPIO_PIN13_CONFIG_SET(x) -#define GPIO_PIN13_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN13_WAKEUP_ENABLE_MSB -#define GPIO_PIN13_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN13_WAKEUP_ENABLE_LSB -#define GPIO_PIN13_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN13_WAKEUP_ENABLE_MASK -#define GPIO_PIN13_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN13_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN13_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN13_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN13_INT_TYPE_MSB WLAN_GPIO_PIN13_INT_TYPE_MSB -#define GPIO_PIN13_INT_TYPE_LSB WLAN_GPIO_PIN13_INT_TYPE_LSB -#define GPIO_PIN13_INT_TYPE_MASK WLAN_GPIO_PIN13_INT_TYPE_MASK -#define GPIO_PIN13_INT_TYPE_GET(x) WLAN_GPIO_PIN13_INT_TYPE_GET(x) -#define GPIO_PIN13_INT_TYPE_SET(x) WLAN_GPIO_PIN13_INT_TYPE_SET(x) -#define GPIO_PIN13_PAD_PULL_MSB WLAN_GPIO_PIN13_PAD_PULL_MSB -#define GPIO_PIN13_PAD_PULL_LSB WLAN_GPIO_PIN13_PAD_PULL_LSB -#define GPIO_PIN13_PAD_PULL_MASK WLAN_GPIO_PIN13_PAD_PULL_MASK -#define GPIO_PIN13_PAD_PULL_GET(x) WLAN_GPIO_PIN13_PAD_PULL_GET(x) -#define GPIO_PIN13_PAD_PULL_SET(x) WLAN_GPIO_PIN13_PAD_PULL_SET(x) -#define GPIO_PIN13_PAD_STRENGTH_MSB WLAN_GPIO_PIN13_PAD_STRENGTH_MSB -#define GPIO_PIN13_PAD_STRENGTH_LSB WLAN_GPIO_PIN13_PAD_STRENGTH_LSB -#define GPIO_PIN13_PAD_STRENGTH_MASK WLAN_GPIO_PIN13_PAD_STRENGTH_MASK -#define GPIO_PIN13_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN13_PAD_STRENGTH_GET(x) -#define GPIO_PIN13_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN13_PAD_STRENGTH_SET(x) -#define GPIO_PIN13_PAD_DRIVER_MSB WLAN_GPIO_PIN13_PAD_DRIVER_MSB -#define GPIO_PIN13_PAD_DRIVER_LSB WLAN_GPIO_PIN13_PAD_DRIVER_LSB -#define GPIO_PIN13_PAD_DRIVER_MASK WLAN_GPIO_PIN13_PAD_DRIVER_MASK -#define GPIO_PIN13_PAD_DRIVER_GET(x) WLAN_GPIO_PIN13_PAD_DRIVER_GET(x) -#define GPIO_PIN13_PAD_DRIVER_SET(x) WLAN_GPIO_PIN13_PAD_DRIVER_SET(x) -#define GPIO_PIN13_SOURCE_MSB WLAN_GPIO_PIN13_SOURCE_MSB -#define GPIO_PIN13_SOURCE_LSB WLAN_GPIO_PIN13_SOURCE_LSB -#define GPIO_PIN13_SOURCE_MASK WLAN_GPIO_PIN13_SOURCE_MASK -#define GPIO_PIN13_SOURCE_GET(x) WLAN_GPIO_PIN13_SOURCE_GET(x) -#define GPIO_PIN13_SOURCE_SET(x) WLAN_GPIO_PIN13_SOURCE_SET(x) -#define GPIO_PIN14_ADDRESS WLAN_GPIO_PIN14_ADDRESS -#define GPIO_PIN14_OFFSET WLAN_GPIO_PIN14_OFFSET -#define GPIO_PIN14_CONFIG_MSB WLAN_GPIO_PIN14_CONFIG_MSB -#define GPIO_PIN14_CONFIG_LSB WLAN_GPIO_PIN14_CONFIG_LSB -#define GPIO_PIN14_CONFIG_MASK WLAN_GPIO_PIN14_CONFIG_MASK -#define GPIO_PIN14_CONFIG_GET(x) WLAN_GPIO_PIN14_CONFIG_GET(x) -#define GPIO_PIN14_CONFIG_SET(x) WLAN_GPIO_PIN14_CONFIG_SET(x) -#define GPIO_PIN14_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN14_WAKEUP_ENABLE_MSB -#define GPIO_PIN14_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN14_WAKEUP_ENABLE_LSB -#define GPIO_PIN14_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN14_WAKEUP_ENABLE_MASK -#define GPIO_PIN14_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN14_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN14_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN14_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN14_INT_TYPE_MSB WLAN_GPIO_PIN14_INT_TYPE_MSB -#define GPIO_PIN14_INT_TYPE_LSB WLAN_GPIO_PIN14_INT_TYPE_LSB -#define GPIO_PIN14_INT_TYPE_MASK WLAN_GPIO_PIN14_INT_TYPE_MASK -#define GPIO_PIN14_INT_TYPE_GET(x) WLAN_GPIO_PIN14_INT_TYPE_GET(x) -#define GPIO_PIN14_INT_TYPE_SET(x) WLAN_GPIO_PIN14_INT_TYPE_SET(x) -#define GPIO_PIN14_PAD_PULL_MSB WLAN_GPIO_PIN14_PAD_PULL_MSB -#define GPIO_PIN14_PAD_PULL_LSB WLAN_GPIO_PIN14_PAD_PULL_LSB -#define GPIO_PIN14_PAD_PULL_MASK WLAN_GPIO_PIN14_PAD_PULL_MASK -#define GPIO_PIN14_PAD_PULL_GET(x) WLAN_GPIO_PIN14_PAD_PULL_GET(x) -#define GPIO_PIN14_PAD_PULL_SET(x) WLAN_GPIO_PIN14_PAD_PULL_SET(x) -#define GPIO_PIN14_PAD_STRENGTH_MSB WLAN_GPIO_PIN14_PAD_STRENGTH_MSB -#define GPIO_PIN14_PAD_STRENGTH_LSB WLAN_GPIO_PIN14_PAD_STRENGTH_LSB -#define GPIO_PIN14_PAD_STRENGTH_MASK WLAN_GPIO_PIN14_PAD_STRENGTH_MASK -#define GPIO_PIN14_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN14_PAD_STRENGTH_GET(x) -#define GPIO_PIN14_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN14_PAD_STRENGTH_SET(x) -#define GPIO_PIN14_PAD_DRIVER_MSB WLAN_GPIO_PIN14_PAD_DRIVER_MSB -#define GPIO_PIN14_PAD_DRIVER_LSB WLAN_GPIO_PIN14_PAD_DRIVER_LSB -#define GPIO_PIN14_PAD_DRIVER_MASK WLAN_GPIO_PIN14_PAD_DRIVER_MASK -#define GPIO_PIN14_PAD_DRIVER_GET(x) WLAN_GPIO_PIN14_PAD_DRIVER_GET(x) -#define GPIO_PIN14_PAD_DRIVER_SET(x) WLAN_GPIO_PIN14_PAD_DRIVER_SET(x) -#define GPIO_PIN14_SOURCE_MSB WLAN_GPIO_PIN14_SOURCE_MSB -#define GPIO_PIN14_SOURCE_LSB WLAN_GPIO_PIN14_SOURCE_LSB -#define GPIO_PIN14_SOURCE_MASK WLAN_GPIO_PIN14_SOURCE_MASK -#define GPIO_PIN14_SOURCE_GET(x) WLAN_GPIO_PIN14_SOURCE_GET(x) -#define GPIO_PIN14_SOURCE_SET(x) WLAN_GPIO_PIN14_SOURCE_SET(x) -#define GPIO_PIN15_ADDRESS WLAN_GPIO_PIN15_ADDRESS -#define GPIO_PIN15_OFFSET WLAN_GPIO_PIN15_OFFSET -#define GPIO_PIN15_CONFIG_MSB WLAN_GPIO_PIN15_CONFIG_MSB -#define GPIO_PIN15_CONFIG_LSB WLAN_GPIO_PIN15_CONFIG_LSB -#define GPIO_PIN15_CONFIG_MASK WLAN_GPIO_PIN15_CONFIG_MASK -#define GPIO_PIN15_CONFIG_GET(x) WLAN_GPIO_PIN15_CONFIG_GET(x) -#define GPIO_PIN15_CONFIG_SET(x) WLAN_GPIO_PIN15_CONFIG_SET(x) -#define GPIO_PIN15_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN15_WAKEUP_ENABLE_MSB -#define GPIO_PIN15_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN15_WAKEUP_ENABLE_LSB -#define GPIO_PIN15_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN15_WAKEUP_ENABLE_MASK -#define GPIO_PIN15_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN15_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN15_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN15_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN15_INT_TYPE_MSB WLAN_GPIO_PIN15_INT_TYPE_MSB -#define GPIO_PIN15_INT_TYPE_LSB WLAN_GPIO_PIN15_INT_TYPE_LSB -#define GPIO_PIN15_INT_TYPE_MASK WLAN_GPIO_PIN15_INT_TYPE_MASK -#define GPIO_PIN15_INT_TYPE_GET(x) WLAN_GPIO_PIN15_INT_TYPE_GET(x) -#define GPIO_PIN15_INT_TYPE_SET(x) WLAN_GPIO_PIN15_INT_TYPE_SET(x) -#define GPIO_PIN15_PAD_PULL_MSB WLAN_GPIO_PIN15_PAD_PULL_MSB -#define GPIO_PIN15_PAD_PULL_LSB WLAN_GPIO_PIN15_PAD_PULL_LSB -#define GPIO_PIN15_PAD_PULL_MASK WLAN_GPIO_PIN15_PAD_PULL_MASK -#define GPIO_PIN15_PAD_PULL_GET(x) WLAN_GPIO_PIN15_PAD_PULL_GET(x) -#define GPIO_PIN15_PAD_PULL_SET(x) WLAN_GPIO_PIN15_PAD_PULL_SET(x) -#define GPIO_PIN15_PAD_STRENGTH_MSB WLAN_GPIO_PIN15_PAD_STRENGTH_MSB -#define GPIO_PIN15_PAD_STRENGTH_LSB WLAN_GPIO_PIN15_PAD_STRENGTH_LSB -#define GPIO_PIN15_PAD_STRENGTH_MASK WLAN_GPIO_PIN15_PAD_STRENGTH_MASK -#define GPIO_PIN15_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN15_PAD_STRENGTH_GET(x) -#define GPIO_PIN15_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN15_PAD_STRENGTH_SET(x) -#define GPIO_PIN15_PAD_DRIVER_MSB WLAN_GPIO_PIN15_PAD_DRIVER_MSB -#define GPIO_PIN15_PAD_DRIVER_LSB WLAN_GPIO_PIN15_PAD_DRIVER_LSB -#define GPIO_PIN15_PAD_DRIVER_MASK WLAN_GPIO_PIN15_PAD_DRIVER_MASK -#define GPIO_PIN15_PAD_DRIVER_GET(x) WLAN_GPIO_PIN15_PAD_DRIVER_GET(x) -#define GPIO_PIN15_PAD_DRIVER_SET(x) WLAN_GPIO_PIN15_PAD_DRIVER_SET(x) -#define GPIO_PIN15_SOURCE_MSB WLAN_GPIO_PIN15_SOURCE_MSB -#define GPIO_PIN15_SOURCE_LSB WLAN_GPIO_PIN15_SOURCE_LSB -#define GPIO_PIN15_SOURCE_MASK WLAN_GPIO_PIN15_SOURCE_MASK -#define GPIO_PIN15_SOURCE_GET(x) WLAN_GPIO_PIN15_SOURCE_GET(x) -#define GPIO_PIN15_SOURCE_SET(x) WLAN_GPIO_PIN15_SOURCE_SET(x) -#define GPIO_PIN16_ADDRESS WLAN_GPIO_PIN16_ADDRESS -#define GPIO_PIN16_OFFSET WLAN_GPIO_PIN16_OFFSET -#define GPIO_PIN16_CONFIG_MSB WLAN_GPIO_PIN16_CONFIG_MSB -#define GPIO_PIN16_CONFIG_LSB WLAN_GPIO_PIN16_CONFIG_LSB -#define GPIO_PIN16_CONFIG_MASK WLAN_GPIO_PIN16_CONFIG_MASK -#define GPIO_PIN16_CONFIG_GET(x) WLAN_GPIO_PIN16_CONFIG_GET(x) -#define GPIO_PIN16_CONFIG_SET(x) WLAN_GPIO_PIN16_CONFIG_SET(x) -#define GPIO_PIN16_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN16_WAKEUP_ENABLE_MSB -#define GPIO_PIN16_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN16_WAKEUP_ENABLE_LSB -#define GPIO_PIN16_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN16_WAKEUP_ENABLE_MASK -#define GPIO_PIN16_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN16_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN16_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN16_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN16_INT_TYPE_MSB WLAN_GPIO_PIN16_INT_TYPE_MSB -#define GPIO_PIN16_INT_TYPE_LSB WLAN_GPIO_PIN16_INT_TYPE_LSB -#define GPIO_PIN16_INT_TYPE_MASK WLAN_GPIO_PIN16_INT_TYPE_MASK -#define GPIO_PIN16_INT_TYPE_GET(x) WLAN_GPIO_PIN16_INT_TYPE_GET(x) -#define GPIO_PIN16_INT_TYPE_SET(x) WLAN_GPIO_PIN16_INT_TYPE_SET(x) -#define GPIO_PIN16_PAD_PULL_MSB WLAN_GPIO_PIN16_PAD_PULL_MSB -#define GPIO_PIN16_PAD_PULL_LSB WLAN_GPIO_PIN16_PAD_PULL_LSB -#define GPIO_PIN16_PAD_PULL_MASK WLAN_GPIO_PIN16_PAD_PULL_MASK -#define GPIO_PIN16_PAD_PULL_GET(x) WLAN_GPIO_PIN16_PAD_PULL_GET(x) -#define GPIO_PIN16_PAD_PULL_SET(x) WLAN_GPIO_PIN16_PAD_PULL_SET(x) -#define GPIO_PIN16_PAD_STRENGTH_MSB WLAN_GPIO_PIN16_PAD_STRENGTH_MSB -#define GPIO_PIN16_PAD_STRENGTH_LSB WLAN_GPIO_PIN16_PAD_STRENGTH_LSB -#define GPIO_PIN16_PAD_STRENGTH_MASK WLAN_GPIO_PIN16_PAD_STRENGTH_MASK -#define GPIO_PIN16_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN16_PAD_STRENGTH_GET(x) -#define GPIO_PIN16_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN16_PAD_STRENGTH_SET(x) -#define GPIO_PIN16_PAD_DRIVER_MSB WLAN_GPIO_PIN16_PAD_DRIVER_MSB -#define GPIO_PIN16_PAD_DRIVER_LSB WLAN_GPIO_PIN16_PAD_DRIVER_LSB -#define GPIO_PIN16_PAD_DRIVER_MASK WLAN_GPIO_PIN16_PAD_DRIVER_MASK -#define GPIO_PIN16_PAD_DRIVER_GET(x) WLAN_GPIO_PIN16_PAD_DRIVER_GET(x) -#define GPIO_PIN16_PAD_DRIVER_SET(x) WLAN_GPIO_PIN16_PAD_DRIVER_SET(x) -#define GPIO_PIN16_SOURCE_MSB WLAN_GPIO_PIN16_SOURCE_MSB -#define GPIO_PIN16_SOURCE_LSB WLAN_GPIO_PIN16_SOURCE_LSB -#define GPIO_PIN16_SOURCE_MASK WLAN_GPIO_PIN16_SOURCE_MASK -#define GPIO_PIN16_SOURCE_GET(x) WLAN_GPIO_PIN16_SOURCE_GET(x) -#define GPIO_PIN16_SOURCE_SET(x) WLAN_GPIO_PIN16_SOURCE_SET(x) -#define GPIO_PIN17_ADDRESS WLAN_GPIO_PIN17_ADDRESS -#define GPIO_PIN17_OFFSET WLAN_GPIO_PIN17_OFFSET -#define GPIO_PIN17_CONFIG_MSB WLAN_GPIO_PIN17_CONFIG_MSB -#define GPIO_PIN17_CONFIG_LSB WLAN_GPIO_PIN17_CONFIG_LSB -#define GPIO_PIN17_CONFIG_MASK WLAN_GPIO_PIN17_CONFIG_MASK -#define GPIO_PIN17_CONFIG_GET(x) WLAN_GPIO_PIN17_CONFIG_GET(x) -#define GPIO_PIN17_CONFIG_SET(x) WLAN_GPIO_PIN17_CONFIG_SET(x) -#define GPIO_PIN17_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN17_WAKEUP_ENABLE_MSB -#define GPIO_PIN17_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN17_WAKEUP_ENABLE_LSB -#define GPIO_PIN17_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN17_WAKEUP_ENABLE_MASK -#define GPIO_PIN17_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN17_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN17_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN17_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN17_INT_TYPE_MSB WLAN_GPIO_PIN17_INT_TYPE_MSB -#define GPIO_PIN17_INT_TYPE_LSB WLAN_GPIO_PIN17_INT_TYPE_LSB -#define GPIO_PIN17_INT_TYPE_MASK WLAN_GPIO_PIN17_INT_TYPE_MASK -#define GPIO_PIN17_INT_TYPE_GET(x) WLAN_GPIO_PIN17_INT_TYPE_GET(x) -#define GPIO_PIN17_INT_TYPE_SET(x) WLAN_GPIO_PIN17_INT_TYPE_SET(x) -#define GPIO_PIN17_PAD_PULL_MSB WLAN_GPIO_PIN17_PAD_PULL_MSB -#define GPIO_PIN17_PAD_PULL_LSB WLAN_GPIO_PIN17_PAD_PULL_LSB -#define GPIO_PIN17_PAD_PULL_MASK WLAN_GPIO_PIN17_PAD_PULL_MASK -#define GPIO_PIN17_PAD_PULL_GET(x) WLAN_GPIO_PIN17_PAD_PULL_GET(x) -#define GPIO_PIN17_PAD_PULL_SET(x) WLAN_GPIO_PIN17_PAD_PULL_SET(x) -#define GPIO_PIN17_PAD_STRENGTH_MSB WLAN_GPIO_PIN17_PAD_STRENGTH_MSB -#define GPIO_PIN17_PAD_STRENGTH_LSB WLAN_GPIO_PIN17_PAD_STRENGTH_LSB -#define GPIO_PIN17_PAD_STRENGTH_MASK WLAN_GPIO_PIN17_PAD_STRENGTH_MASK -#define GPIO_PIN17_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN17_PAD_STRENGTH_GET(x) -#define GPIO_PIN17_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN17_PAD_STRENGTH_SET(x) -#define GPIO_PIN17_PAD_DRIVER_MSB WLAN_GPIO_PIN17_PAD_DRIVER_MSB -#define GPIO_PIN17_PAD_DRIVER_LSB WLAN_GPIO_PIN17_PAD_DRIVER_LSB -#define GPIO_PIN17_PAD_DRIVER_MASK WLAN_GPIO_PIN17_PAD_DRIVER_MASK -#define GPIO_PIN17_PAD_DRIVER_GET(x) WLAN_GPIO_PIN17_PAD_DRIVER_GET(x) -#define GPIO_PIN17_PAD_DRIVER_SET(x) WLAN_GPIO_PIN17_PAD_DRIVER_SET(x) -#define GPIO_PIN17_SOURCE_MSB WLAN_GPIO_PIN17_SOURCE_MSB -#define GPIO_PIN17_SOURCE_LSB WLAN_GPIO_PIN17_SOURCE_LSB -#define GPIO_PIN17_SOURCE_MASK WLAN_GPIO_PIN17_SOURCE_MASK -#define GPIO_PIN17_SOURCE_GET(x) WLAN_GPIO_PIN17_SOURCE_GET(x) -#define GPIO_PIN17_SOURCE_SET(x) WLAN_GPIO_PIN17_SOURCE_SET(x) -#define GPIO_PIN18_ADDRESS WLAN_GPIO_PIN18_ADDRESS -#define GPIO_PIN18_OFFSET WLAN_GPIO_PIN18_OFFSET -#define GPIO_PIN18_CONFIG_MSB WLAN_GPIO_PIN18_CONFIG_MSB -#define GPIO_PIN18_CONFIG_LSB WLAN_GPIO_PIN18_CONFIG_LSB -#define GPIO_PIN18_CONFIG_MASK WLAN_GPIO_PIN18_CONFIG_MASK -#define GPIO_PIN18_CONFIG_GET(x) WLAN_GPIO_PIN18_CONFIG_GET(x) -#define GPIO_PIN18_CONFIG_SET(x) WLAN_GPIO_PIN18_CONFIG_SET(x) -#define GPIO_PIN18_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN18_WAKEUP_ENABLE_MSB -#define GPIO_PIN18_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN18_WAKEUP_ENABLE_LSB -#define GPIO_PIN18_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN18_WAKEUP_ENABLE_MASK -#define GPIO_PIN18_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN18_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN18_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN18_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN18_INT_TYPE_MSB WLAN_GPIO_PIN18_INT_TYPE_MSB -#define GPIO_PIN18_INT_TYPE_LSB WLAN_GPIO_PIN18_INT_TYPE_LSB -#define GPIO_PIN18_INT_TYPE_MASK WLAN_GPIO_PIN18_INT_TYPE_MASK -#define GPIO_PIN18_INT_TYPE_GET(x) WLAN_GPIO_PIN18_INT_TYPE_GET(x) -#define GPIO_PIN18_INT_TYPE_SET(x) WLAN_GPIO_PIN18_INT_TYPE_SET(x) -#define GPIO_PIN18_PAD_PULL_MSB WLAN_GPIO_PIN18_PAD_PULL_MSB -#define GPIO_PIN18_PAD_PULL_LSB WLAN_GPIO_PIN18_PAD_PULL_LSB -#define GPIO_PIN18_PAD_PULL_MASK WLAN_GPIO_PIN18_PAD_PULL_MASK -#define GPIO_PIN18_PAD_PULL_GET(x) WLAN_GPIO_PIN18_PAD_PULL_GET(x) -#define GPIO_PIN18_PAD_PULL_SET(x) WLAN_GPIO_PIN18_PAD_PULL_SET(x) -#define GPIO_PIN18_PAD_STRENGTH_MSB WLAN_GPIO_PIN18_PAD_STRENGTH_MSB -#define GPIO_PIN18_PAD_STRENGTH_LSB WLAN_GPIO_PIN18_PAD_STRENGTH_LSB -#define GPIO_PIN18_PAD_STRENGTH_MASK WLAN_GPIO_PIN18_PAD_STRENGTH_MASK -#define GPIO_PIN18_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN18_PAD_STRENGTH_GET(x) -#define GPIO_PIN18_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN18_PAD_STRENGTH_SET(x) -#define GPIO_PIN18_PAD_DRIVER_MSB WLAN_GPIO_PIN18_PAD_DRIVER_MSB -#define GPIO_PIN18_PAD_DRIVER_LSB WLAN_GPIO_PIN18_PAD_DRIVER_LSB -#define GPIO_PIN18_PAD_DRIVER_MASK WLAN_GPIO_PIN18_PAD_DRIVER_MASK -#define GPIO_PIN18_PAD_DRIVER_GET(x) WLAN_GPIO_PIN18_PAD_DRIVER_GET(x) -#define GPIO_PIN18_PAD_DRIVER_SET(x) WLAN_GPIO_PIN18_PAD_DRIVER_SET(x) -#define GPIO_PIN18_SOURCE_MSB WLAN_GPIO_PIN18_SOURCE_MSB -#define GPIO_PIN18_SOURCE_LSB WLAN_GPIO_PIN18_SOURCE_LSB -#define GPIO_PIN18_SOURCE_MASK WLAN_GPIO_PIN18_SOURCE_MASK -#define GPIO_PIN18_SOURCE_GET(x) WLAN_GPIO_PIN18_SOURCE_GET(x) -#define GPIO_PIN18_SOURCE_SET(x) WLAN_GPIO_PIN18_SOURCE_SET(x) -#define GPIO_PIN19_ADDRESS WLAN_GPIO_PIN19_ADDRESS -#define GPIO_PIN19_OFFSET WLAN_GPIO_PIN19_OFFSET -#define GPIO_PIN19_CONFIG_MSB WLAN_GPIO_PIN19_CONFIG_MSB -#define GPIO_PIN19_CONFIG_LSB WLAN_GPIO_PIN19_CONFIG_LSB -#define GPIO_PIN19_CONFIG_MASK WLAN_GPIO_PIN19_CONFIG_MASK -#define GPIO_PIN19_CONFIG_GET(x) WLAN_GPIO_PIN19_CONFIG_GET(x) -#define GPIO_PIN19_CONFIG_SET(x) WLAN_GPIO_PIN19_CONFIG_SET(x) -#define GPIO_PIN19_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN19_WAKEUP_ENABLE_MSB -#define GPIO_PIN19_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN19_WAKEUP_ENABLE_LSB -#define GPIO_PIN19_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN19_WAKEUP_ENABLE_MASK -#define GPIO_PIN19_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN19_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN19_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN19_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN19_INT_TYPE_MSB WLAN_GPIO_PIN19_INT_TYPE_MSB -#define GPIO_PIN19_INT_TYPE_LSB WLAN_GPIO_PIN19_INT_TYPE_LSB -#define GPIO_PIN19_INT_TYPE_MASK WLAN_GPIO_PIN19_INT_TYPE_MASK -#define GPIO_PIN19_INT_TYPE_GET(x) WLAN_GPIO_PIN19_INT_TYPE_GET(x) -#define GPIO_PIN19_INT_TYPE_SET(x) WLAN_GPIO_PIN19_INT_TYPE_SET(x) -#define GPIO_PIN19_PAD_PULL_MSB WLAN_GPIO_PIN19_PAD_PULL_MSB -#define GPIO_PIN19_PAD_PULL_LSB WLAN_GPIO_PIN19_PAD_PULL_LSB -#define GPIO_PIN19_PAD_PULL_MASK WLAN_GPIO_PIN19_PAD_PULL_MASK -#define GPIO_PIN19_PAD_PULL_GET(x) WLAN_GPIO_PIN19_PAD_PULL_GET(x) -#define GPIO_PIN19_PAD_PULL_SET(x) WLAN_GPIO_PIN19_PAD_PULL_SET(x) -#define GPIO_PIN19_PAD_STRENGTH_MSB WLAN_GPIO_PIN19_PAD_STRENGTH_MSB -#define GPIO_PIN19_PAD_STRENGTH_LSB WLAN_GPIO_PIN19_PAD_STRENGTH_LSB -#define GPIO_PIN19_PAD_STRENGTH_MASK WLAN_GPIO_PIN19_PAD_STRENGTH_MASK -#define GPIO_PIN19_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN19_PAD_STRENGTH_GET(x) -#define GPIO_PIN19_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN19_PAD_STRENGTH_SET(x) -#define GPIO_PIN19_PAD_DRIVER_MSB WLAN_GPIO_PIN19_PAD_DRIVER_MSB -#define GPIO_PIN19_PAD_DRIVER_LSB WLAN_GPIO_PIN19_PAD_DRIVER_LSB -#define GPIO_PIN19_PAD_DRIVER_MASK WLAN_GPIO_PIN19_PAD_DRIVER_MASK -#define GPIO_PIN19_PAD_DRIVER_GET(x) WLAN_GPIO_PIN19_PAD_DRIVER_GET(x) -#define GPIO_PIN19_PAD_DRIVER_SET(x) WLAN_GPIO_PIN19_PAD_DRIVER_SET(x) -#define GPIO_PIN19_SOURCE_MSB WLAN_GPIO_PIN19_SOURCE_MSB -#define GPIO_PIN19_SOURCE_LSB WLAN_GPIO_PIN19_SOURCE_LSB -#define GPIO_PIN19_SOURCE_MASK WLAN_GPIO_PIN19_SOURCE_MASK -#define GPIO_PIN19_SOURCE_GET(x) WLAN_GPIO_PIN19_SOURCE_GET(x) -#define GPIO_PIN19_SOURCE_SET(x) WLAN_GPIO_PIN19_SOURCE_SET(x) -#define GPIO_PIN20_ADDRESS WLAN_GPIO_PIN20_ADDRESS -#define GPIO_PIN20_OFFSET WLAN_GPIO_PIN20_OFFSET -#define GPIO_PIN20_CONFIG_MSB WLAN_GPIO_PIN20_CONFIG_MSB -#define GPIO_PIN20_CONFIG_LSB WLAN_GPIO_PIN20_CONFIG_LSB -#define GPIO_PIN20_CONFIG_MASK WLAN_GPIO_PIN20_CONFIG_MASK -#define GPIO_PIN20_CONFIG_GET(x) WLAN_GPIO_PIN20_CONFIG_GET(x) -#define GPIO_PIN20_CONFIG_SET(x) WLAN_GPIO_PIN20_CONFIG_SET(x) -#define GPIO_PIN20_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN20_WAKEUP_ENABLE_MSB -#define GPIO_PIN20_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN20_WAKEUP_ENABLE_LSB -#define GPIO_PIN20_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN20_WAKEUP_ENABLE_MASK -#define GPIO_PIN20_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN20_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN20_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN20_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN20_INT_TYPE_MSB WLAN_GPIO_PIN20_INT_TYPE_MSB -#define GPIO_PIN20_INT_TYPE_LSB WLAN_GPIO_PIN20_INT_TYPE_LSB -#define GPIO_PIN20_INT_TYPE_MASK WLAN_GPIO_PIN20_INT_TYPE_MASK -#define GPIO_PIN20_INT_TYPE_GET(x) WLAN_GPIO_PIN20_INT_TYPE_GET(x) -#define GPIO_PIN20_INT_TYPE_SET(x) WLAN_GPIO_PIN20_INT_TYPE_SET(x) -#define GPIO_PIN20_PAD_PULL_MSB WLAN_GPIO_PIN20_PAD_PULL_MSB -#define GPIO_PIN20_PAD_PULL_LSB WLAN_GPIO_PIN20_PAD_PULL_LSB -#define GPIO_PIN20_PAD_PULL_MASK WLAN_GPIO_PIN20_PAD_PULL_MASK -#define GPIO_PIN20_PAD_PULL_GET(x) WLAN_GPIO_PIN20_PAD_PULL_GET(x) -#define GPIO_PIN20_PAD_PULL_SET(x) WLAN_GPIO_PIN20_PAD_PULL_SET(x) -#define GPIO_PIN20_PAD_STRENGTH_MSB WLAN_GPIO_PIN20_PAD_STRENGTH_MSB -#define GPIO_PIN20_PAD_STRENGTH_LSB WLAN_GPIO_PIN20_PAD_STRENGTH_LSB -#define GPIO_PIN20_PAD_STRENGTH_MASK WLAN_GPIO_PIN20_PAD_STRENGTH_MASK -#define GPIO_PIN20_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN20_PAD_STRENGTH_GET(x) -#define GPIO_PIN20_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN20_PAD_STRENGTH_SET(x) -#define GPIO_PIN20_PAD_DRIVER_MSB WLAN_GPIO_PIN20_PAD_DRIVER_MSB -#define GPIO_PIN20_PAD_DRIVER_LSB WLAN_GPIO_PIN20_PAD_DRIVER_LSB -#define GPIO_PIN20_PAD_DRIVER_MASK WLAN_GPIO_PIN20_PAD_DRIVER_MASK -#define GPIO_PIN20_PAD_DRIVER_GET(x) WLAN_GPIO_PIN20_PAD_DRIVER_GET(x) -#define GPIO_PIN20_PAD_DRIVER_SET(x) WLAN_GPIO_PIN20_PAD_DRIVER_SET(x) -#define GPIO_PIN20_SOURCE_MSB WLAN_GPIO_PIN20_SOURCE_MSB -#define GPIO_PIN20_SOURCE_LSB WLAN_GPIO_PIN20_SOURCE_LSB -#define GPIO_PIN20_SOURCE_MASK WLAN_GPIO_PIN20_SOURCE_MASK -#define GPIO_PIN20_SOURCE_GET(x) WLAN_GPIO_PIN20_SOURCE_GET(x) -#define GPIO_PIN20_SOURCE_SET(x) WLAN_GPIO_PIN20_SOURCE_SET(x) -#define GPIO_PIN21_ADDRESS WLAN_GPIO_PIN21_ADDRESS -#define GPIO_PIN21_OFFSET WLAN_GPIO_PIN21_OFFSET -#define GPIO_PIN21_CONFIG_MSB WLAN_GPIO_PIN21_CONFIG_MSB -#define GPIO_PIN21_CONFIG_LSB WLAN_GPIO_PIN21_CONFIG_LSB -#define GPIO_PIN21_CONFIG_MASK WLAN_GPIO_PIN21_CONFIG_MASK -#define GPIO_PIN21_CONFIG_GET(x) WLAN_GPIO_PIN21_CONFIG_GET(x) -#define GPIO_PIN21_CONFIG_SET(x) WLAN_GPIO_PIN21_CONFIG_SET(x) -#define GPIO_PIN21_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN21_WAKEUP_ENABLE_MSB -#define GPIO_PIN21_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN21_WAKEUP_ENABLE_LSB -#define GPIO_PIN21_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN21_WAKEUP_ENABLE_MASK -#define GPIO_PIN21_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN21_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN21_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN21_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN21_INT_TYPE_MSB WLAN_GPIO_PIN21_INT_TYPE_MSB -#define GPIO_PIN21_INT_TYPE_LSB WLAN_GPIO_PIN21_INT_TYPE_LSB -#define GPIO_PIN21_INT_TYPE_MASK WLAN_GPIO_PIN21_INT_TYPE_MASK -#define GPIO_PIN21_INT_TYPE_GET(x) WLAN_GPIO_PIN21_INT_TYPE_GET(x) -#define GPIO_PIN21_INT_TYPE_SET(x) WLAN_GPIO_PIN21_INT_TYPE_SET(x) -#define GPIO_PIN21_PAD_PULL_MSB WLAN_GPIO_PIN21_PAD_PULL_MSB -#define GPIO_PIN21_PAD_PULL_LSB WLAN_GPIO_PIN21_PAD_PULL_LSB -#define GPIO_PIN21_PAD_PULL_MASK WLAN_GPIO_PIN21_PAD_PULL_MASK -#define GPIO_PIN21_PAD_PULL_GET(x) WLAN_GPIO_PIN21_PAD_PULL_GET(x) -#define GPIO_PIN21_PAD_PULL_SET(x) WLAN_GPIO_PIN21_PAD_PULL_SET(x) -#define GPIO_PIN21_PAD_STRENGTH_MSB WLAN_GPIO_PIN21_PAD_STRENGTH_MSB -#define GPIO_PIN21_PAD_STRENGTH_LSB WLAN_GPIO_PIN21_PAD_STRENGTH_LSB -#define GPIO_PIN21_PAD_STRENGTH_MASK WLAN_GPIO_PIN21_PAD_STRENGTH_MASK -#define GPIO_PIN21_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN21_PAD_STRENGTH_GET(x) -#define GPIO_PIN21_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN21_PAD_STRENGTH_SET(x) -#define GPIO_PIN21_PAD_DRIVER_MSB WLAN_GPIO_PIN21_PAD_DRIVER_MSB -#define GPIO_PIN21_PAD_DRIVER_LSB WLAN_GPIO_PIN21_PAD_DRIVER_LSB -#define GPIO_PIN21_PAD_DRIVER_MASK WLAN_GPIO_PIN21_PAD_DRIVER_MASK -#define GPIO_PIN21_PAD_DRIVER_GET(x) WLAN_GPIO_PIN21_PAD_DRIVER_GET(x) -#define GPIO_PIN21_PAD_DRIVER_SET(x) WLAN_GPIO_PIN21_PAD_DRIVER_SET(x) -#define GPIO_PIN21_SOURCE_MSB WLAN_GPIO_PIN21_SOURCE_MSB -#define GPIO_PIN21_SOURCE_LSB WLAN_GPIO_PIN21_SOURCE_LSB -#define GPIO_PIN21_SOURCE_MASK WLAN_GPIO_PIN21_SOURCE_MASK -#define GPIO_PIN21_SOURCE_GET(x) WLAN_GPIO_PIN21_SOURCE_GET(x) -#define GPIO_PIN21_SOURCE_SET(x) WLAN_GPIO_PIN21_SOURCE_SET(x) -#define GPIO_PIN22_ADDRESS WLAN_GPIO_PIN22_ADDRESS -#define GPIO_PIN22_OFFSET WLAN_GPIO_PIN22_OFFSET -#define GPIO_PIN22_CONFIG_MSB WLAN_GPIO_PIN22_CONFIG_MSB -#define GPIO_PIN22_CONFIG_LSB WLAN_GPIO_PIN22_CONFIG_LSB -#define GPIO_PIN22_CONFIG_MASK WLAN_GPIO_PIN22_CONFIG_MASK -#define GPIO_PIN22_CONFIG_GET(x) WLAN_GPIO_PIN22_CONFIG_GET(x) -#define GPIO_PIN22_CONFIG_SET(x) WLAN_GPIO_PIN22_CONFIG_SET(x) -#define GPIO_PIN22_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN22_WAKEUP_ENABLE_MSB -#define GPIO_PIN22_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN22_WAKEUP_ENABLE_LSB -#define GPIO_PIN22_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN22_WAKEUP_ENABLE_MASK -#define GPIO_PIN22_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN22_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN22_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN22_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN22_INT_TYPE_MSB WLAN_GPIO_PIN22_INT_TYPE_MSB -#define GPIO_PIN22_INT_TYPE_LSB WLAN_GPIO_PIN22_INT_TYPE_LSB -#define GPIO_PIN22_INT_TYPE_MASK WLAN_GPIO_PIN22_INT_TYPE_MASK -#define GPIO_PIN22_INT_TYPE_GET(x) WLAN_GPIO_PIN22_INT_TYPE_GET(x) -#define GPIO_PIN22_INT_TYPE_SET(x) WLAN_GPIO_PIN22_INT_TYPE_SET(x) -#define GPIO_PIN22_PAD_PULL_MSB WLAN_GPIO_PIN22_PAD_PULL_MSB -#define GPIO_PIN22_PAD_PULL_LSB WLAN_GPIO_PIN22_PAD_PULL_LSB -#define GPIO_PIN22_PAD_PULL_MASK WLAN_GPIO_PIN22_PAD_PULL_MASK -#define GPIO_PIN22_PAD_PULL_GET(x) WLAN_GPIO_PIN22_PAD_PULL_GET(x) -#define GPIO_PIN22_PAD_PULL_SET(x) WLAN_GPIO_PIN22_PAD_PULL_SET(x) -#define GPIO_PIN22_PAD_STRENGTH_MSB WLAN_GPIO_PIN22_PAD_STRENGTH_MSB -#define GPIO_PIN22_PAD_STRENGTH_LSB WLAN_GPIO_PIN22_PAD_STRENGTH_LSB -#define GPIO_PIN22_PAD_STRENGTH_MASK WLAN_GPIO_PIN22_PAD_STRENGTH_MASK -#define GPIO_PIN22_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN22_PAD_STRENGTH_GET(x) -#define GPIO_PIN22_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN22_PAD_STRENGTH_SET(x) -#define GPIO_PIN22_PAD_DRIVER_MSB WLAN_GPIO_PIN22_PAD_DRIVER_MSB -#define GPIO_PIN22_PAD_DRIVER_LSB WLAN_GPIO_PIN22_PAD_DRIVER_LSB -#define GPIO_PIN22_PAD_DRIVER_MASK WLAN_GPIO_PIN22_PAD_DRIVER_MASK -#define GPIO_PIN22_PAD_DRIVER_GET(x) WLAN_GPIO_PIN22_PAD_DRIVER_GET(x) -#define GPIO_PIN22_PAD_DRIVER_SET(x) WLAN_GPIO_PIN22_PAD_DRIVER_SET(x) -#define GPIO_PIN22_SOURCE_MSB WLAN_GPIO_PIN22_SOURCE_MSB -#define GPIO_PIN22_SOURCE_LSB WLAN_GPIO_PIN22_SOURCE_LSB -#define GPIO_PIN22_SOURCE_MASK WLAN_GPIO_PIN22_SOURCE_MASK -#define GPIO_PIN22_SOURCE_GET(x) WLAN_GPIO_PIN22_SOURCE_GET(x) -#define GPIO_PIN22_SOURCE_SET(x) WLAN_GPIO_PIN22_SOURCE_SET(x) -#define GPIO_PIN23_ADDRESS WLAN_GPIO_PIN23_ADDRESS -#define GPIO_PIN23_OFFSET WLAN_GPIO_PIN23_OFFSET -#define GPIO_PIN23_CONFIG_MSB WLAN_GPIO_PIN23_CONFIG_MSB -#define GPIO_PIN23_CONFIG_LSB WLAN_GPIO_PIN23_CONFIG_LSB -#define GPIO_PIN23_CONFIG_MASK WLAN_GPIO_PIN23_CONFIG_MASK -#define GPIO_PIN23_CONFIG_GET(x) WLAN_GPIO_PIN23_CONFIG_GET(x) -#define GPIO_PIN23_CONFIG_SET(x) WLAN_GPIO_PIN23_CONFIG_SET(x) -#define GPIO_PIN23_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN23_WAKEUP_ENABLE_MSB -#define GPIO_PIN23_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN23_WAKEUP_ENABLE_LSB -#define GPIO_PIN23_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN23_WAKEUP_ENABLE_MASK -#define GPIO_PIN23_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN23_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN23_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN23_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN23_INT_TYPE_MSB WLAN_GPIO_PIN23_INT_TYPE_MSB -#define GPIO_PIN23_INT_TYPE_LSB WLAN_GPIO_PIN23_INT_TYPE_LSB -#define GPIO_PIN23_INT_TYPE_MASK WLAN_GPIO_PIN23_INT_TYPE_MASK -#define GPIO_PIN23_INT_TYPE_GET(x) WLAN_GPIO_PIN23_INT_TYPE_GET(x) -#define GPIO_PIN23_INT_TYPE_SET(x) WLAN_GPIO_PIN23_INT_TYPE_SET(x) -#define GPIO_PIN23_PAD_DRIVER_MSB WLAN_GPIO_PIN23_PAD_DRIVER_MSB -#define GPIO_PIN23_PAD_DRIVER_LSB WLAN_GPIO_PIN23_PAD_DRIVER_LSB -#define GPIO_PIN23_PAD_DRIVER_MASK WLAN_GPIO_PIN23_PAD_DRIVER_MASK -#define GPIO_PIN23_PAD_DRIVER_GET(x) WLAN_GPIO_PIN23_PAD_DRIVER_GET(x) -#define GPIO_PIN23_PAD_DRIVER_SET(x) WLAN_GPIO_PIN23_PAD_DRIVER_SET(x) -#define GPIO_PIN23_SOURCE_MSB WLAN_GPIO_PIN23_SOURCE_MSB -#define GPIO_PIN23_SOURCE_LSB WLAN_GPIO_PIN23_SOURCE_LSB -#define GPIO_PIN23_SOURCE_MASK WLAN_GPIO_PIN23_SOURCE_MASK -#define GPIO_PIN23_SOURCE_GET(x) WLAN_GPIO_PIN23_SOURCE_GET(x) -#define GPIO_PIN23_SOURCE_SET(x) WLAN_GPIO_PIN23_SOURCE_SET(x) -#define GPIO_PIN24_ADDRESS WLAN_GPIO_PIN24_ADDRESS -#define GPIO_PIN24_OFFSET WLAN_GPIO_PIN24_OFFSET -#define GPIO_PIN24_CONFIG_MSB WLAN_GPIO_PIN24_CONFIG_MSB -#define GPIO_PIN24_CONFIG_LSB WLAN_GPIO_PIN24_CONFIG_LSB -#define GPIO_PIN24_CONFIG_MASK WLAN_GPIO_PIN24_CONFIG_MASK -#define GPIO_PIN24_CONFIG_GET(x) WLAN_GPIO_PIN24_CONFIG_GET(x) -#define GPIO_PIN24_CONFIG_SET(x) WLAN_GPIO_PIN24_CONFIG_SET(x) -#define GPIO_PIN24_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN24_WAKEUP_ENABLE_MSB -#define GPIO_PIN24_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN24_WAKEUP_ENABLE_LSB -#define GPIO_PIN24_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN24_WAKEUP_ENABLE_MASK -#define GPIO_PIN24_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN24_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN24_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN24_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN24_INT_TYPE_MSB WLAN_GPIO_PIN24_INT_TYPE_MSB -#define GPIO_PIN24_INT_TYPE_LSB WLAN_GPIO_PIN24_INT_TYPE_LSB -#define GPIO_PIN24_INT_TYPE_MASK WLAN_GPIO_PIN24_INT_TYPE_MASK -#define GPIO_PIN24_INT_TYPE_GET(x) WLAN_GPIO_PIN24_INT_TYPE_GET(x) -#define GPIO_PIN24_INT_TYPE_SET(x) WLAN_GPIO_PIN24_INT_TYPE_SET(x) -#define GPIO_PIN24_PAD_DRIVER_MSB WLAN_GPIO_PIN24_PAD_DRIVER_MSB -#define GPIO_PIN24_PAD_DRIVER_LSB WLAN_GPIO_PIN24_PAD_DRIVER_LSB -#define GPIO_PIN24_PAD_DRIVER_MASK WLAN_GPIO_PIN24_PAD_DRIVER_MASK -#define GPIO_PIN24_PAD_DRIVER_GET(x) WLAN_GPIO_PIN24_PAD_DRIVER_GET(x) -#define GPIO_PIN24_PAD_DRIVER_SET(x) WLAN_GPIO_PIN24_PAD_DRIVER_SET(x) -#define GPIO_PIN24_SOURCE_MSB WLAN_GPIO_PIN24_SOURCE_MSB -#define GPIO_PIN24_SOURCE_LSB WLAN_GPIO_PIN24_SOURCE_LSB -#define GPIO_PIN24_SOURCE_MASK WLAN_GPIO_PIN24_SOURCE_MASK -#define GPIO_PIN24_SOURCE_GET(x) WLAN_GPIO_PIN24_SOURCE_GET(x) -#define GPIO_PIN24_SOURCE_SET(x) WLAN_GPIO_PIN24_SOURCE_SET(x) -#define GPIO_PIN25_ADDRESS WLAN_GPIO_PIN25_ADDRESS -#define GPIO_PIN25_OFFSET WLAN_GPIO_PIN25_OFFSET -#define GPIO_PIN25_CONFIG_MSB WLAN_GPIO_PIN25_CONFIG_MSB -#define GPIO_PIN25_CONFIG_LSB WLAN_GPIO_PIN25_CONFIG_LSB -#define GPIO_PIN25_CONFIG_MASK WLAN_GPIO_PIN25_CONFIG_MASK -#define GPIO_PIN25_CONFIG_GET(x) WLAN_GPIO_PIN25_CONFIG_GET(x) -#define GPIO_PIN25_CONFIG_SET(x) WLAN_GPIO_PIN25_CONFIG_SET(x) -#define GPIO_PIN25_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN25_WAKEUP_ENABLE_MSB -#define GPIO_PIN25_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN25_WAKEUP_ENABLE_LSB -#define GPIO_PIN25_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN25_WAKEUP_ENABLE_MASK -#define GPIO_PIN25_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN25_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN25_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN25_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN25_INT_TYPE_MSB WLAN_GPIO_PIN25_INT_TYPE_MSB -#define GPIO_PIN25_INT_TYPE_LSB WLAN_GPIO_PIN25_INT_TYPE_LSB -#define GPIO_PIN25_INT_TYPE_MASK WLAN_GPIO_PIN25_INT_TYPE_MASK -#define GPIO_PIN25_INT_TYPE_GET(x) WLAN_GPIO_PIN25_INT_TYPE_GET(x) -#define GPIO_PIN25_INT_TYPE_SET(x) WLAN_GPIO_PIN25_INT_TYPE_SET(x) -#define GPIO_PIN25_PAD_DRIVER_MSB WLAN_GPIO_PIN25_PAD_DRIVER_MSB -#define GPIO_PIN25_PAD_DRIVER_LSB WLAN_GPIO_PIN25_PAD_DRIVER_LSB -#define GPIO_PIN25_PAD_DRIVER_MASK WLAN_GPIO_PIN25_PAD_DRIVER_MASK -#define GPIO_PIN25_PAD_DRIVER_GET(x) WLAN_GPIO_PIN25_PAD_DRIVER_GET(x) -#define GPIO_PIN25_PAD_DRIVER_SET(x) WLAN_GPIO_PIN25_PAD_DRIVER_SET(x) -#define GPIO_PIN25_SOURCE_MSB WLAN_GPIO_PIN25_SOURCE_MSB -#define GPIO_PIN25_SOURCE_LSB WLAN_GPIO_PIN25_SOURCE_LSB -#define GPIO_PIN25_SOURCE_MASK WLAN_GPIO_PIN25_SOURCE_MASK -#define GPIO_PIN25_SOURCE_GET(x) WLAN_GPIO_PIN25_SOURCE_GET(x) -#define GPIO_PIN25_SOURCE_SET(x) WLAN_GPIO_PIN25_SOURCE_SET(x) -#define SIGMA_DELTA_ADDRESS WLAN_SIGMA_DELTA_ADDRESS -#define SIGMA_DELTA_OFFSET WLAN_SIGMA_DELTA_OFFSET -#define SIGMA_DELTA_ENABLE_MSB WLAN_SIGMA_DELTA_ENABLE_MSB -#define SIGMA_DELTA_ENABLE_LSB WLAN_SIGMA_DELTA_ENABLE_LSB -#define SIGMA_DELTA_ENABLE_MASK WLAN_SIGMA_DELTA_ENABLE_MASK -#define SIGMA_DELTA_ENABLE_GET(x) WLAN_SIGMA_DELTA_ENABLE_GET(x) -#define SIGMA_DELTA_ENABLE_SET(x) WLAN_SIGMA_DELTA_ENABLE_SET(x) -#define SIGMA_DELTA_PRESCALAR_MSB WLAN_SIGMA_DELTA_PRESCALAR_MSB -#define SIGMA_DELTA_PRESCALAR_LSB WLAN_SIGMA_DELTA_PRESCALAR_LSB -#define SIGMA_DELTA_PRESCALAR_MASK WLAN_SIGMA_DELTA_PRESCALAR_MASK -#define SIGMA_DELTA_PRESCALAR_GET(x) WLAN_SIGMA_DELTA_PRESCALAR_GET(x) -#define SIGMA_DELTA_PRESCALAR_SET(x) WLAN_SIGMA_DELTA_PRESCALAR_SET(x) -#define SIGMA_DELTA_TARGET_MSB WLAN_SIGMA_DELTA_TARGET_MSB -#define SIGMA_DELTA_TARGET_LSB WLAN_SIGMA_DELTA_TARGET_LSB -#define SIGMA_DELTA_TARGET_MASK WLAN_SIGMA_DELTA_TARGET_MASK -#define SIGMA_DELTA_TARGET_GET(x) WLAN_SIGMA_DELTA_TARGET_GET(x) -#define SIGMA_DELTA_TARGET_SET(x) WLAN_SIGMA_DELTA_TARGET_SET(x) -#define DEBUG_CONTROL_ADDRESS WLAN_DEBUG_CONTROL_ADDRESS -#define DEBUG_CONTROL_OFFSET WLAN_DEBUG_CONTROL_OFFSET -#define DEBUG_CONTROL_ENABLE_MSB WLAN_DEBUG_CONTROL_ENABLE_MSB -#define DEBUG_CONTROL_ENABLE_LSB WLAN_DEBUG_CONTROL_ENABLE_LSB -#define DEBUG_CONTROL_ENABLE_MASK WLAN_DEBUG_CONTROL_ENABLE_MASK -#define DEBUG_CONTROL_ENABLE_GET(x) WLAN_DEBUG_CONTROL_ENABLE_GET(x) -#define DEBUG_CONTROL_ENABLE_SET(x) WLAN_DEBUG_CONTROL_ENABLE_SET(x) -#define DEBUG_INPUT_SEL_ADDRESS WLAN_DEBUG_INPUT_SEL_ADDRESS -#define DEBUG_INPUT_SEL_OFFSET WLAN_DEBUG_INPUT_SEL_OFFSET -#define DEBUG_INPUT_SEL_SHIFT_MSB WLAN_DEBUG_INPUT_SEL_SHIFT_MSB -#define DEBUG_INPUT_SEL_SHIFT_LSB WLAN_DEBUG_INPUT_SEL_SHIFT_LSB -#define DEBUG_INPUT_SEL_SHIFT_MASK WLAN_DEBUG_INPUT_SEL_SHIFT_MASK -#define DEBUG_INPUT_SEL_SHIFT_GET(x) WLAN_DEBUG_INPUT_SEL_SHIFT_GET(x) -#define DEBUG_INPUT_SEL_SHIFT_SET(x) WLAN_DEBUG_INPUT_SEL_SHIFT_SET(x) -#define DEBUG_INPUT_SEL_SRC_MSB WLAN_DEBUG_INPUT_SEL_SRC_MSB -#define DEBUG_INPUT_SEL_SRC_LSB WLAN_DEBUG_INPUT_SEL_SRC_LSB -#define DEBUG_INPUT_SEL_SRC_MASK WLAN_DEBUG_INPUT_SEL_SRC_MASK -#define DEBUG_INPUT_SEL_SRC_GET(x) WLAN_DEBUG_INPUT_SEL_SRC_GET(x) -#define DEBUG_INPUT_SEL_SRC_SET(x) WLAN_DEBUG_INPUT_SEL_SRC_SET(x) -#define DEBUG_OUT_ADDRESS WLAN_DEBUG_OUT_ADDRESS -#define DEBUG_OUT_OFFSET WLAN_DEBUG_OUT_OFFSET -#define DEBUG_OUT_DATA_MSB WLAN_DEBUG_OUT_DATA_MSB -#define DEBUG_OUT_DATA_LSB WLAN_DEBUG_OUT_DATA_LSB -#define DEBUG_OUT_DATA_MASK WLAN_DEBUG_OUT_DATA_MASK -#define DEBUG_OUT_DATA_GET(x) WLAN_DEBUG_OUT_DATA_GET(x) -#define DEBUG_OUT_DATA_SET(x) WLAN_DEBUG_OUT_DATA_SET(x) -#define RESET_TUPLE_STATUS_ADDRESS WLAN_RESET_TUPLE_STATUS_ADDRESS -#define RESET_TUPLE_STATUS_OFFSET WLAN_RESET_TUPLE_STATUS_OFFSET -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MSB WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MSB -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_GET(x) WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_GET(x) -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_SET(x) WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_SET(x) -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MSB WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MSB -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_GET(x) WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_GET(x) -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_SET(x) WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_SET(x) - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mac_dma_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mac_dma_reg.h deleted file mode 100644 index d8d67f5c1c39..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mac_dma_reg.h +++ /dev/null @@ -1,601 +0,0 @@ -// -// Copyright (c) 2002-2009 Atheros Communications Inc. -// All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// - -/*****************************************************************************/ -/* AR6003 WLAN MAC DMA register definitions */ -/*****************************************************************************/ - -#ifndef _AR6000_DMAREG_H_ -#define _AR6000_DMAREG_H_ - -/* - * Definitions for the Atheros AR6003 chipset. - */ - -/* DMA Control and Interrupt Registers */ -#define MAC_DMA_CR_ADDRESS 0x00000008 /* MAC control register */ -#define MAC_DMA_CR_RXE_MASK 0x00000004 /* Receive enable */ -#define MAC_DMA_CR_RXD_MASK 0x00000020 /* Receive disable */ -#define MAC_DMA_CR_SWI_MASK 0x00000040 /* One-shot software interrupt */ - -#define MAC_DMA_RXDP_ADDRESS 0x0000000C /* MAC receive queue descriptor pointer */ - -#define MAC_DMA_CFG_ADDRESS 0x00000014 /* MAC configuration and status register */ -#define MAC_DMA_CFG_SWTD_MASK 0x00000001 /* byteswap tx descriptor words */ -#define MAC_DMA_CFG_SWTB_MASK 0x00000002 /* byteswap tx data buffer words */ -#define MAC_DMA_CFG_SWRD_MASK 0x00000004 /* byteswap rx descriptor words */ -#define MAC_DMA_CFG_SWRB_MASK 0x00000008 /* byteswap rx data buffer words */ -#define MAC_DMA_CFG_SWRG_MASK 0x00000010 /* byteswap register access data words */ -#define MAC_DMA_CFG_AP_ADHOC_INDICATION_MASK 0x00000020 /* AP/adhoc indication (0-AP, 1-Adhoc) */ -#define MAC_DMA_CFG_PHOK_MASK 0x00000100 /* PHY OK status */ -#define MAC_DMA_CFG_CLK_GATE_DIS_MASK 0x00000400 /* Clock gating disable */ - -#define MAC_DMA_MIRT_ADDRESS 0x00000020 /* Maximum rate threshold register */ -#define MAC_DMA_MIRT_THRESH_MASK 0x0000FFFF - -#define MAC_DMA_IER_ADDRESS 0x00000024 /* MAC Interrupt enable register */ -#define MAC_DMA_IER_ENABLE_MASK 0x00000001 /* Global interrupt enable */ -#define MAC_DMA_IER_DISABLE_MASK 0x00000000 /* Global interrupt disable */ - -#define MAC_DMA_TIMT_ADDRESS 0x00000028 /* Transmit Interrupt Mitigation Threshold */ -#define MAC_DMA_TIMT_LAST_PACKER_THRESH_MASK 0x0000FFFF /* Last packet threshold mask */ -#define MAC_DMA_TIMT_FIRST_PACKER_THRESH_MASK 0xFFFF0000 /* First packet threshold mask */ - -#define MAC_DMA_RIMT_ADDRESS 0x0000002C /* Receive Interrupt Mitigation Threshold */ -#define MAC_DMA_RIMT_LAST_PACKER_THRESH_MASK 0x0000FFFF /* Last packet threshold mask */ -#define MAC_DMA_RIMT_FIRST_PACKER_THRESH_MASK 0xFFFF0000 /* First packet threshold mask */ - -#define MAC_DMA_TXCFG_ADDRESS 0x00000030 /* MAC tx DMA size config register */ -#define MAC_DMA_FTRIG_MASK 0x000003F0 /* Mask for Frame trigger level */ -#define MAC_DMA_FTRIG_LSB 4 /* Shift for Frame trigger level */ -#define MAC_DMA_FTRIG_IMMED 0x00000000 /* bytes in PCU TX FIFO before air */ -#define MAC_DMA_FTRIG_64B 0x00000010 /* default */ -#define MAC_DMA_FTRIG_128B 0x00000020 -#define MAC_DMA_FTRIG_192B 0x00000030 -#define MAC_DMA_FTRIG_256B 0x00000040 /* 5 bits total */ -#define MAC_DMA_TXCFG_ADHOC_BEACON_ATIM_TX_POLICY_MASK 0x00000800 - -#define MAC_DMA_RXCFG_ADDRESS 0x00000034 /* MAC rx DMA size config register */ -#define MAC_DMA_RXCFG_ZLFDMA_MASK 0x00000010 /* Enable DMA of zero-length frame */ -#define MAC_DMA_RXCFG_DMASIZE_4B 0x00000000 /* DMA size 4 bytes (TXCFG + RXCFG) */ -#define MAC_DMA_RXCFG_DMASIZE_8B 0x00000001 /* DMA size 8 bytes */ -#define MAC_DMA_RXCFG_DMASIZE_16B 0x00000002 /* DMA size 16 bytes */ -#define MAC_DMA_RXCFG_DMASIZE_32B 0x00000003 /* DMA size 32 bytes */ -#define MAC_DMA_RXCFG_DMASIZE_64B 0x00000004 /* DMA size 64 bytes */ -#define MAC_DMA_RXCFG_DMASIZE_128B 0x00000005 /* DMA size 128 bytes */ -#define MAC_DMA_RXCFG_DMASIZE_256B 0x00000006 /* DMA size 256 bytes */ -#define MAC_DMA_RXCFG_DMASIZE_512B 0x00000007 /* DMA size 512 bytes */ - -#define MAC_DMA_MIBC_ADDRESS 0x00000040 /* MAC MIB control register */ -#define MAC_DMA_MIBC_COW_MASK 0x00000001 /* counter overflow warning */ -#define MAC_DMA_MIBC_FMC_MASK 0x00000002 /* freeze MIB counters */ -#define MAC_DMA_MIBC_CMC_MASK 0x00000004 /* clear MIB counters */ -#define MAC_DMA_MIBC_MCS_MASK 0x00000008 /* MIB counter strobe, increment all */ - -#define MAC_DMA_TOPS_ADDRESS 0x00000044 /* MAC timeout prescale count */ -#define MAC_DMA_TOPS_MASK 0x0000FFFF /* Mask for timeout prescale */ - -#define MAC_DMA_RXNPTO_ADDRESS 0x00000048 /* MAC no frame received timeout */ -#define MAC_DMA_RXNPTO_MASK 0x000003FF /* Mask for no frame received timeout */ - -#define MAC_DMA_TXNPTO_ADDRESS 0x0000004C /* MAC no frame trasmitted timeout */ -#define MAC_DMA_TXNPTO_MASK 0x000003FF /* Mask for no frame transmitted timeout */ -#define MAC_DMA_TXNPTO_QCU_MASK 0x000FFC00 /* Mask indicating the set of QCUs */ - /* for which frame completions will cause */ - /* a reset of the no frame xmit'd timeout */ - -#define MAC_DMA_RPGTO_ADDRESS 0x00000050 /* MAC receive frame gap timeout */ -#define MAC_DMA_RPGTO_MASK 0x000003FF /* Mask for receive frame gap timeout */ - -#define MAC_DMA_RPCNT_ADDRESS 0x00000054 /* MAC receive frame count limit */ -#define MAC_DMA_RPCNT_MASK 0x0000001F /* Mask for receive frame count limit */ - -#define MAC_DMA_MACMISC_ADDRESS 0x00000058 /* MAC miscellaneous control/status register */ -#define MAC_DMA_MACMISC_DMA_OBS_MASK 0x000001E0 /* Mask for DMA observation bus mux select */ -#define MAC_DMA_MACMISC_DMA_OBS_LSB 5 /* Shift for DMA observation bus mux select */ -#define MAC_DMA_MACMISC_MISC_OBS 0x00000E00 /* Mask for MISC observation bus mux select */ -#define MAC_DMA_MACMISC_MISC_OBS_LSB 9 /* Shift for MISC observation bus mux select */ -#define MAC_DMA_MACMISC_MAC_OBS_BUS_LSB 0x00007000 /* Mask for MAC observation bus mux select (lsb) */ -#define MAC_DMA_MACMISC_MAC_OBS_BUS_LSB_LSB 12 /* Shift for MAC observation bus mux select (lsb) */ -#define MAC_DMA_MACMISC_MAC_OBS_BUS_MSB 0x00038000 /* Mask for MAC observation bus mux select (msb) */ -#define MAC_DMA_MACMISC_MAC_OBS_BUS_MSB_LSB 15 /* Shift for MAC observation bus mux select (msb) */ - - -#define MAC_DMA_ISR_ADDRESS 0x00000080 /* MAC Primary interrupt status register */ -/* - * Interrupt Status Registers - * - * Only the bits in the ISR_P register and the IMR_P registers - * control whether the MAC's INTA# output is asserted. The bits in - * the secondary interrupt status/mask registers control what bits - * are set in the primary interrupt status register; however the - * IMR_S* registers DO NOT determine whether INTA# is asserted. - * That is INTA# is asserted only when the logical AND of ISR_P - * and IMR_P is non-zero. The secondary interrupt mask/status - * registers affect what bits are set in ISR_P but they do not - * directly affect whether INTA# is asserted. - */ -#define MAC_DMA_ISR_RXOK_MASK 0x00000001 /* At least one frame received sans errors */ -#define MAC_DMA_ISR_RXDESC_MASK 0x00000002 /* Receive interrupt request */ -#define MAC_DMA_ISR_RXERR_MASK 0x00000004 /* Receive error interrupt */ -#define MAC_DMA_ISR_RXNOPKT_MASK 0x00000008 /* No frame received within timeout clock */ -#define MAC_DMA_ISR_RXEOL_MASK 0x00000010 /* Received descriptor empty interrupt */ -#define MAC_DMA_ISR_RXORN_MASK 0x00000020 /* Receive FIFO overrun interrupt */ -#define MAC_DMA_ISR_TXOK_MASK 0x00000040 /* Transmit okay interrupt */ -#define MAC_DMA_ISR_TXDESC_MASK 0x00000080 /* Transmit interrupt request */ -#define MAC_DMA_ISR_TXERR_MASK 0x00000100 /* Transmit error interrupt */ -#define MAC_DMA_ISR_TXNOPKT_MASK 0x00000200 /* No frame transmitted interrupt */ -#define MAC_DMA_ISR_TXEOL_MASK 0x00000400 /* Transmit descriptor empty interrupt */ -#define MAC_DMA_ISR_TXURN_MASK 0x00000800 /* Transmit FIFO underrun interrupt */ -#define MAC_DMA_ISR_MIB_MASK 0x00001000 /* MIB interrupt - see MIBC */ -#define MAC_DMA_ISR_SWI_MASK 0x00002000 /* Software interrupt */ -#define MAC_DMA_ISR_RXPHY_MASK 0x00004000 /* PHY receive error interrupt */ -#define MAC_DMA_ISR_RXKCM_MASK 0x00008000 /* Key-cache miss interrupt */ -#define MAC_DMA_ISR_BRSSI_HI_MASK 0x00010000 /* Beacon rssi high threshold interrupt */ -#define MAC_DMA_ISR_BRSSI_LO_MASK 0x00020000 /* Beacon threshold interrupt */ -#define MAC_DMA_ISR_BMISS_MASK 0x00040000 /* Beacon missed interrupt */ -#define MAC_DMA_ISR_TXMINTR_MASK 0x00080000 /* Maximum transmit interrupt rate */ -#define MAC_DMA_ISR_BNR_MASK 0x00100000 /* Beacon not ready interrupt */ -#define MAC_DMA_ISR_HIUERR_MASK 0x00200000 /* An unexpected bus error has occurred */ -#define MAC_DMA_ISR_BCNMISC_MASK 0x00800000 /* 'or' of TIM, CABEND, DTIMSYNC, BCNTO */ -#define MAC_DMA_ISR_RXMINTR_MASK 0x01000000 /* Maximum receive interrupt rate */ -#define MAC_DMA_ISR_QCBROVF_MASK 0x02000000 /* QCU CBR overflow interrupt */ -#define MAC_DMA_ISR_QCBRURN_MASK 0x04000000 /* QCU CBR underrun interrupt */ -#define MAC_DMA_ISR_QTRIG_MASK 0x08000000 /* QCU scheduling trigger interrupt */ -#define MAC_DMA_ISR_TIMER_MASK 0x10000000 /* GENTMR interrupt */ -#define MAC_DMA_ISR_HCFTO_MASK 0x20000000 /* HCFTO interrupt */ -#define MAC_DMA_ISR_TXINTM_MASK 0x40000000 /* Transmit completion mitigation interrupt */ -#define MAC_DMA_ISR_RXINTM_MASK 0x80000000 /* Receive completion mitigation interrupt */ - -#define MAC_DMA_ISR_S0_ADDRESS 0x00000084 /* MAC Secondary interrupt status register 0 */ -#define MAC_DMA_ISR_S0_QCU_TXOK_MASK 0x000003FF /* Mask for TXOK (QCU 0-9) */ -#define MAC_DMA_ISR_S0_QCU_TXOK_LSB 0 -#define MAC_DMA_ISR_S0_QCU_TXDESC_MASK 0x03FF0000 /* Mask for TXDESC (QCU 0-9) */ -#define MAC_DMA_ISR_S0_QCU_TXDESC_LSB 16 - -#define MAC_DMA_ISR_S1_ADDRESS 0x00000088 /* MAC Secondary interrupt status register 1 */ -#define MAC_DMA_ISR_S1_QCU_TXERR_MASK 0x000003FF /* Mask for TXERR (QCU 0-9) */ -#define MAC_DMA_ISR_S1_QCU_TXERR_LSB 0 -#define MAC_DMA_ISR_S1_QCU_TXEOL_MASK 0x03FF0000 /* Mask for TXEOL (QCU 0-9) */ -#define MAC_DMA_ISR_S1_QCU_TXEOL_LSB 16 - -#define MAC_DMA_ISR_S2_ADDRESS 0x0000008c /* MAC Secondary interrupt status register 2 */ -#define MAC_DMA_ISR_S2_QCU_TXURN_MASK 0x000003FF /* Mask for TXURN (QCU 0-9) */ -#define MAC_DMA_ISR_S2_QCU_TXURN_LSB 0 /* Shift for TXURN (QCU 0-9) */ -#define MAC_DMA_ISR_S2_RX_INT_MASK 0x00000800 -#define MAC_DMA_ISR_S2_WL_STOMPED_MASK 0x00001000 -#define MAC_DMA_ISR_S2_RX_PTR_BAD_MASK 0x00002000 -#define MAC_DMA_ISR_S2_BT_LOW_PRIORITY_RISING_MASK 0x00004000 -#define MAC_DMA_ISR_S2_BT_LOW_PRIORITY_FALLING_MASK 0x00008000 -#define MAC_DMA_ISR_S2_BB_PANIC_IRQ_MASK 0x00010000 -#define MAC_DMA_ISR_S2_BT_STOMPED_MASK 0x00020000 -#define MAC_DMA_ISR_S2_BT_ACTIVE_RISING_MASK 0x00040000 -#define MAC_DMA_ISR_S2_BT_ACTIVE_FALLING_MASK 0x00080000 -#define MAC_DMA_ISR_S2_BT_PRIORITY_RISING_MASK 0x00100000 -#define MAC_DMA_ISR_S2_BT_PRIORITY_FALLING_MASK 0x00200000 -#define MAC_DMA_ISR_S2_CST_MASK 0x00400000 -#define MAC_DMA_ISR_S2_GTT_MASK 0x00800000 -#define MAC_DMA_ISR_S2_TIM_MASK 0x01000000 /* TIM */ -#define MAC_DMA_ISR_S2_CABEND_MASK 0x02000000 /* CABEND */ -#define MAC_DMA_ISR_S2_DTIMSYNC_MASK 0x04000000 /* DTIMSYNC */ -#define MAC_DMA_ISR_S2_BCNTO_MASK 0x08000000 /* BCNTO */ -#define MAC_DMA_ISR_S2_CABTO_MASK 0x10000000 /* CABTO */ -#define MAC_DMA_ISR_S2_DTIM_MASK 0x20000000 /* DTIM */ -#define MAC_DMA_ISR_S2_TSFOOR_MASK 0x40000000 /* TSFOOR */ - -#define MAC_DMA_ISR_S3_ADDRESS 0x00000090 /* MAC Secondary interrupt status register 3 */ -#define MAC_DMA_ISR_S3_QCU_QCBROVF_MASK 0x000003FF /* Mask for QCBROVF (QCU 0-9) */ -#define MAC_DMA_ISR_S3_QCU_QCBRURN_MASK 0x03FF0000 /* Mask for QCBRURN (QCU 0-9) */ - -#define MAC_DMA_ISR_S4_ADDRESS 0x00000094 /* MAC Secondary interrupt status register 4 */ -#define MAC_DMA_ISR_S4_QCU_QTRIG_MASK 0x000003FF /* Mask for QTRIG (QCU 0-9) */ - -#define MAC_DMA_ISR_S5_ADDRESS 0x00000098 /* MAC Secondary interrupt status register 5 */ -#define MAC_DMA_ISR_S5_TBTT_TIMER_TRIGGER_MASK 0x00000001 -#define MAC_DMA_ISR_S5_DBA_TIMER_TRIGGER_MASK 0x00000002 -#define MAC_DMA_ISR_S5_SBA_TIMER_TRIGGER_MASK 0x00000004 -#define MAC_DMA_ISR_S5_HCF_TIMER_TRIGGER_MASK 0x00000008 -#define MAC_DMA_ISR_S5_TIM_TIMER_TRIGGER_MASK 0x00000010 -#define MAC_DMA_ISR_S5_DTIM_TIMER_TRIGGER_MASK 0x00000020 -#define MAC_DMA_ISR_S5_QUIET_TIMER_TRIGGER_MASK 0x00000040 -#define MAC_DMA_ISR_S5_NDP_TIMER_TRIGGER_MASK 0x00000080 -#define MAC_DMA_ISR_S5_GENERIC_TIMER2_TRIGGER_MASK 0x0000FF00 -#define MAC_DMA_ISR_S5_GENERIC_TIMER2_TRIGGER_LSB 8 -#define MAC_DMA_ISR_S5_GENERIC_TIMER2_TRIGGER(_i) (0x00000100 << (_i)) -#define MAC_DMA_ISR_S5_TIMER_OVERFLOW_MASK 0x00010000 -#define MAC_DMA_ISR_S5_DBA_TIMER_THRESHOLD_MASK 0x00020000 -#define MAC_DMA_ISR_S5_SBA_TIMER_THRESHOLD_MASK 0x00040000 -#define MAC_DMA_ISR_S5_HCF_TIMER_THRESHOLD_MASK 0x00080000 -#define MAC_DMA_ISR_S5_TIM_TIMER_THRESHOLD_MASK 0x00100000 -#define MAC_DMA_ISR_S5_DTIM_TIMER_THRESHOLD_MASK 0x00200000 -#define MAC_DMA_ISR_S5_QUIET_TIMER_THRESHOLD_MASK 0x00400000 -#define MAC_DMA_ISR_S5_NDP_TIMER_THRESHOLD_MASK 0x00800000 -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_THRESHOLD_MASK 0xFF000000 -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_THRESHOLD_LSB 24 -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_THRESHOLD(_i) (0x01000000 << (_i)) - -#define MAC_DMA_IMR_ADDRESS 0x000000A0 /* MAC Primary interrupt mask register */ -/* - * Interrupt Mask Registers - * - * Only the bits in the IMR control whether the MAC's INTA# - * output will be asserted. The bits in the secondary interrupt - * mask registers control what bits get set in the primary - * interrupt status register; however the IMR_S* registers - * DO NOT determine whether INTA# is asserted. - */ -#define MAC_DMA_IMR_RXOK_MASK 0x00000001 /* At least one frame received sans errors */ -#define MAC_DMA_IMR_RXDESC_MASK 0x00000002 /* Receive interrupt request */ -#define MAC_DMA_IMR_RXERR_MASK 0x00000004 /* Receive error interrupt */ -#define MAC_DMA_IMR_RXNOPKT_MASK 0x00000008 /* No frame received within timeout clock */ -#define MAC_DMA_IMR_RXEOL_MASK 0x00000010 /* Received descriptor empty interrupt */ -#define MAC_DMA_IMR_RXORN_MASK 0x00000020 /* Receive FIFO overrun interrupt */ -#define MAC_DMA_IMR_TXOK_MASK 0x00000040 /* Transmit okay interrupt */ -#define MAC_DMA_IMR_TXDESC_MASK 0x00000080 /* Transmit interrupt request */ -#define MAC_DMA_IMR_TXERR_MASK 0x00000100 /* Transmit error interrupt */ -#define MAC_DMA_IMR_TXNOPKT_MASK 0x00000200 /* No frame transmitted interrupt */ -#define MAC_DMA_IMR_TXEOL_MASK 0x00000400 /* Transmit descriptor empty interrupt */ -#define MAC_DMA_IMR_TXURN_MASK 0x00000800 /* Transmit FIFO underrun interrupt */ -#define MAC_DMA_IMR_MIB_MASK 0x00001000 /* MIB interrupt - see MIBC */ -#define MAC_DMA_IMR_SWI_MASK 0x00002000 /* Software interrupt */ -#define MAC_DMA_IMR_RXPHY_MASK 0x00004000 /* PHY receive error interrupt */ -#define MAC_DMA_IMR_RXKCM_MASK 0x00008000 /* Key-cache miss interrupt */ -#define MAC_DMA_IMR_BRSSI_HI_MASK 0x00010000 /* Beacon rssi hi threshold interrupt */ -#define MAC_DMA_IMR_BRSSI_LO_MASK 0x00020000 /* Beacon rssi lo threshold interrupt */ -#define MAC_DMA_IMR_BMISS_MASK 0x00040000 /* Beacon missed interrupt */ -#define MAC_DMA_IMR_TXMINTR_MASK 0x00080000 /* Maximum transmit interrupt rate */ -#define MAC_DMA_IMR_BNR_MASK 0x00100000 /* BNR interrupt */ -#define MAC_DMA_IMR_HIUERR_MASK 0x00200000 /* An unexpected bus error has occurred */ -#define MAC_DMA_IMR_BCNMISC_MASK 0x00800000 /* Beacon Misc */ -#define MAC_DMA_IMR_RXMINTR_MASK 0x01000000 /* Maximum receive interrupt rate */ -#define MAC_DMA_IMR_QCBROVF_MASK 0x02000000 /* QCU CBR overflow interrupt */ -#define MAC_DMA_IMR_QCBRURN_MASK 0x04000000 /* QCU CBR underrun interrupt */ -#define MAC_DMA_IMR_QTRIG_MASK 0x08000000 /* QCU scheduling trigger interrupt */ -#define MAC_DMA_IMR_TIMER_MASK 0x10000000 /* GENTMR interrupt */ -#define MAC_DMA_IMR_HCFTO_MASK 0x20000000 /* HCFTO interrupt*/ -#define MAC_DMA_IMR_TXINTM_MASK 0x40000000 /* Transmit completion mitigation interrupt */ -#define MAC_DMA_IMR_RXINTM_MASK 0x80000000 /* Receive completion mitigation interrupt */ - -#define MAC_DMA_IMR_S0_ADDRESS 0x000000A4 /* MAC Secondary interrupt mask register 0 */ -#define MAC_DMA_IMR_S0_QCU_TXOK_MASK 0x000003FF /* TXOK (QCU 0-9) */ -#define MAC_DMA_IMR_S0_QCU_TXOK_LSB 0 -#define MAC_DMA_IMR_S0_QCU_TXDESC_MASK 0x03FF0000 /* TXDESC (QCU 0-9) */ -#define MAC_DMA_IMR_S0_QCU_TXDESC_LSB 16 - -#define MAC_DMA_IMR_S1_ADDRESS 0x000000A8 /* MAC Secondary interrupt mask register 1 */ -#define MAC_DMA_IMR_S1_QCU_TXERR_MASK 0x000003FF /* TXERR (QCU 0-9) */ -#define MAC_DMA_IMR_S1_QCU_TXERR_LSB 0 -#define MAC_DMA_IMR_S1_QCU_TXEOL_MASK 0x03FF0000 /* TXEOL (QCU 0-9) */ -#define MAC_DMA_IMR_S1_QCU_TXEOL_LSB 16 - -#define MAC_DMA_IMR_S2_ADDRESS 0x000000AC /* MAC Secondary interrupt mask register 2 */ -#define MAC_DMA_IMR_S2_QCU_TXURN_MASK 0x000003FF /* Mask for TXURN (QCU 0-9) */ -#define MAC_DMA_IMR_S2_QCU_TXURN_LSB 0 -#define MAC_DMA_IMR_S2_RX_INT_MASK 0x00000800 -#define MAC_DMA_IMR_S2_WL_STOMPED_MASK 0x00001000 -#define MAC_DMA_IMR_S2_RX_PTR_BAD_MASK 0x00002000 -#define MAC_DMA_IMR_S2_BT_LOW_PRIORITY_RISING_MASK 0x00004000 -#define MAC_DMA_IMR_S2_BT_LOW_PRIORITY_FALLING_MASK 0x00008000 -#define MAC_DMA_IMR_S2_BB_PANIC_IRQ_MASK 0x00010000 -#define MAC_DMA_IMR_S2_BT_STOMPED_MASK 0x00020000 -#define MAC_DMA_IMR_S2_BT_ACTIVE_RISING_MASK 0x00040000 -#define MAC_DMA_IMR_S2_BT_ACTIVE_FALLING_MASK 0x00080000 -#define MAC_DMA_IMR_S2_BT_PRIORITY_RISING_MASK 0x00100000 -#define MAC_DMA_IMR_S2_BT_PRIORITY_FALLING_MASK 0x00200000 -#define MAC_DMA_IMR_S2_CST_MASK 0x00400000 -#define MAC_DMA_IMR_S2_GTT_MASK 0x00800000 -#define MAC_DMA_IMR_S2_TIM_MASK 0x01000000 /* TIM */ -#define MAC_DMA_IMR_S2_CABEND_MASK 0x02000000 /* CABEND */ -#define MAC_DMA_IMR_S2_DTIMSYNC_MASK 0x04000000 /* DTIMSYNC */ -#define MAC_DMA_IMR_S2_BCNTO_MASK 0x08000000 /* BCNTO */ -#define MAC_DMA_IMR_S2_CABTO_MASK 0x10000000 /* CABTO */ -#define MAC_DMA_IMR_S2_DTIM_MASK 0x20000000 /* DTIM */ -#define MAC_DMA_IMR_S2_TSFOOR_MASK 0x40000000 /* TSFOOR */ - -#define MAC_DMA_IMR_S3_ADDRESS 0x000000B0 /* MAC Secondary interrupt mask register 3 */ -#define MAC_DMA_IMR_S3_QCU_QCBROVF_MASK 0x000003FF /* Mask for QCBROVF (QCU 0-9) */ -#define MAC_DMA_IMR_S3_QCU_QCBRURN_MASK 0x03FF0000 /* Mask for QCBRURN (QCU 0-9) */ -#define MAC_DMA_IMR_S3_QCU_QCBRURN_LSB 16 - -#define MAC_DMA_IMR_S4_ADDRESS 0x000000B4 /* MAC Secondary interrupt mask register 4 */ -#define MAC_DMA_IMR_S4_QCU_QTRIG_MASK 0x000003FF /* Mask for QTRIG (QCU 0-9) */ - -#define MAC_DMA_IMR_S5_ADDRESS 0x000000B8 /* MAC Secondary interrupt mask register 5 */ -#define MAC_DMA_IMR_S5_TBTT_TIMER_TRIGGER_MASK 0x00000001 -#define MAC_DMA_IMR_S5_DBA_TIMER_TRIGGER_MASK 0x00000002 -#define MAC_DMA_IMR_S5_SBA_TIMER_TRIGGER_MASK 0x00000004 -#define MAC_DMA_IMR_S5_HCF_TIMER_TRIGGER_MASK 0x00000008 -#define MAC_DMA_IMR_S5_TIM_TIMER_TRIGGER_MASK 0x00000010 -#define MAC_DMA_IMR_S5_DTIM_TIMER_TRIGGER_MASK 0x00000020 -#define MAC_DMA_IMR_S5_QUIET_TIMER_TRIGGER_MASK 0x00000040 -#define MAC_DMA_IMR_S5_NDP_TIMER_TRIGGER_MASK 0x00000080 -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_TRIGGER_MASK 0x0000FF00 -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_TRIGGER_LSB 8 -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_TRIGGER(_i) (0x100 << (_i)) -#define MAC_DMA_IMR_S5_TIMER_OVERFLOW_MASK 0x00010000 -#define MAC_DMA_IMR_S5_DBA_TIMER_THRESHOLD_MASK 0x00020000 -#define MAC_DMA_IMR_S5_SBA_TIMER_THRESHOLD_MASK 0x00040000 -#define MAC_DMA_IMR_S5_HCF_TIMER_THRESHOLD_MASK 0x00080000 -#define MAC_DMA_IMR_S5_TIM_TIMER_THRESHOLD_MASK 0x00100000 -#define MAC_DMA_IMR_S5_DTIM_TIMER_THRESHOLD_MASK 0x00200000 -#define MAC_DMA_IMR_S5_QUIET_TIMER_THRESHOLD_MASK 0000400000 -#define MAC_DMA_IMR_S5_NDP_TIMER_THRESHOLD_MASK 0x00800000 -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_THRESHOLD_MASK 0xFF000000 -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_THRESHOLD_LSB 24 -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_THRESHOLD(_i) (0x01000000 << (_i)) - -#define MAC_DMA_ISR_RAC_ADDRESS 0x000000C0 /* ISR read-and-clear access */ - -/* Shadow copies with read-and-clear access */ -#define MAC_DMA_ISR_S0_S_ADDRESS 0x000000C4 /* ISR_S0 shadow copy */ -#define MAC_DMA_ISR_S1_S_ADDRESS 0x000000C8 /* ISR_S1 shadow copy */ -#define MAC_DMA_ISR_S2_S_ADDRESS 0x000000Cc /* ISR_S2 shadow copy */ -#define MAC_DMA_ISR_S3_S_ADDRESS 0x000000D0 /* ISR_S3 shadow copy */ -#define MAC_DMA_ISR_S4_S_ADDRESS 0x000000D4 /* ISR_S4 shadow copy */ -#define MAC_DMA_ISR_S5_S_ADDRESS 0x000000D8 /* ISR_S5 shadow copy */ - -#define MAC_DMA_Q0_TXDP_ADDRESS 0x00000800 /* MAC Transmit Queue descriptor pointer */ -#define MAC_DMA_Q1_TXDP_ADDRESS 0x00000804 /* MAC Transmit Queue descriptor pointer */ -#define MAC_DMA_Q2_TXDP_ADDRESS 0x00000808 /* MAC Transmit Queue descriptor pointer */ -#define MAC_DMA_Q3_TXDP_ADDRESS 0x0000080C /* MAC Transmit Queue descriptor pointer */ -#define MAC_DMA_Q4_TXDP_ADDRESS 0x00000810 /* MAC Transmit Queue descriptor pointer */ -#define MAC_DMA_Q5_TXDP_ADDRESS 0x00000814 /* MAC Transmit Queue descriptor pointer */ -#define MAC_DMA_Q6_TXDP_ADDRESS 0x00000818 /* MAC Transmit Queue descriptor pointer */ -#define MAC_DMA_Q7_TXDP_ADDRESS 0x0000081C /* MAC Transmit Queue descriptor pointer */ -#define MAC_DMA_Q8_TXDP_ADDRESS 0x00000820 /* MAC Transmit Queue descriptor pointer */ -#define MAC_DMA_Q9_TXDP_ADDRESS 0x00000824 /* MAC Transmit Queue descriptor pointer */ -#define MAC_DMA_QTXDP_ADDRESS(_i) (MAC_DMA_Q0_TXDP_ADDRESS + ((_i)<<2)) - -#define MAC_DMA_Q_TXE_ADDRESS 0x00000840 /* MAC Transmit Queue enable */ -#define MAC_DMA_Q_TXD_ADDRESS 0x00000880 /* MAC Transmit Queue disable */ -/* QCU registers */ - -#define MAC_DMA_Q0_CBRCFG_ADDRESS 0x000008C0 /* MAC CBR configuration */ -#define MAC_DMA_Q1_CBRCFG_ADDRESS 0x000008C4 /* MAC CBR configuration */ -#define MAC_DMA_Q2_CBRCFG_ADDRESS 0x000008C8 /* MAC CBR configuration */ -#define MAC_DMA_Q3_CBRCFG_ADDRESS 0x000008CC /* MAC CBR configuration */ -#define MAC_DMA_Q4_CBRCFG_ADDRESS 0x000008D0 /* MAC CBR configuration */ -#define MAC_DMA_Q5_CBRCFG_ADDRESS 0x000008D4 /* MAC CBR configuration */ -#define MAC_DMA_Q6_CBRCFG_ADDRESS 0x000008D8 /* MAC CBR configuration */ -#define MAC_DMA_Q7_CBRCFG_ADDRESS 0x000008DC /* MAC CBR configuration */ -#define MAC_DMA_Q8_CBRCFG_ADDRESS 0x000008E0 /* MAC CBR configuration */ -#define MAC_DMA_Q9_CBRCFG_ADDRESS 0x000008E4 /* MAC CBR configuration */ -#define MAC_DMA_QCBRCFG_ADDRESS(_i) (MAC_DMA_Q0_CBRCFG_ADDRESS + ((_i)<<2)) - -#define MAC_DMA_Q_CBRCFG_CBR_INTERVAL_MASK 0x00FFFFFF /* Mask for CBR interval (us) */ -#define MAC_DMA_Q_CBRCFG_CBR_INTERVAL_LSB 0 /* Shift for CBR interval */ -#define MAC_DMA_Q_CBRCFG_CBR_OVF_THRESH_MASK 0xFF000000 /* Mask for CBR overflow threshold */ -#define MAC_DMA_Q_CBRCFG_CBR_OVF_THRESH_LSB 24 /* Shift for CBR overflow thresh */ - - -#define MAC_DMA_Q0_RDYTIMECFG_ADDRESS 0x00000900 /* MAC ReadyTime configuration */ -#define MAC_DMA_Q1_RDYTIMECFG_ADDRESS 0x00000904 /* MAC ReadyTime configuration */ -#define MAC_DMA_Q2_RDYTIMECFG_ADDRESS 0x00000908 /* MAC ReadyTime configuration */ -#define MAC_DMA_Q3_RDYTIMECFG_ADDRESS 0x0000090C /* MAC ReadyTime configuration */ -#define MAC_DMA_Q4_RDYTIMECFG_ADDRESS 0x00000910 /* MAC ReadyTime configuration */ -#define MAC_DMA_Q5_RDYTIMECFG_ADDRESS 0x00000914 /* MAC ReadyTime configuration */ -#define MAC_DMA_Q6_RDYTIMECFG_ADDRESS 0x00000918 /* MAC ReadyTime configuration */ -#define MAC_DMA_Q7_RDYTIMECFG_ADDRESS 0x0000091C /* MAC ReadyTime configuration */ -#define MAC_DMA_Q8_RDYTIMECFG_ADDRESS 0x00000920 /* MAC ReadyTime configuration */ -#define MAC_DMA_Q9_RDYTIMECFG_ADDRESS 0x00000924 /* MAC ReadyTime configuration */ -#define MAC_DMA_QRDYTIMECFG_ADDRESS(_i) (MAC_DMA_Q0_RDYTIMECFG_ADDRESS + ((_i)<<2)) - -#define MAC_DMA_Q_RDYTIMECFG_INT_MASK 0x00FFFFFF /* CBR interval (us) */ -#define MAC_DMA_Q_RDYTIMECFG_INT_LSB 0 /* Shift for ReadyTime Interval (us) */ -#define MAC_DMA_Q_RDYTIMECFG_ENA_MASK 0x01000000 /* CBR enable */ - -#define MAC_DMA_Q_ONESHOTMAC_DMAM_SC_ADDRESS 0x00000940 /* MAC OneShotArm set control */ -#define MAC_DMA_Q_ONESHOTMAC_DMAM_CC_ADDRESS 0x00000980 /* MAC OneShotArm clear control */ - -#define MAC_DMA_Q0_MISC_ADDRESS 0x000009C0 /* MAC Miscellaneous QCU settings */ -#define MAC_DMA_Q1_MISC_ADDRESS 0x000009C4 /* MAC Miscellaneous QCU settings */ -#define MAC_DMA_Q2_MISC_ADDRESS 0x000009C8 /* MAC Miscellaneous QCU settings */ -#define MAC_DMA_Q3_MISC_ADDRESS 0x000009CC /* MAC Miscellaneous QCU settings */ -#define MAC_DMA_Q4_MISC_ADDRESS 0x000009D0 /* MAC Miscellaneous QCU settings */ -#define MAC_DMA_Q5_MISC_ADDRESS 0x000009D4 /* MAC Miscellaneous QCU settings */ -#define MAC_DMA_Q6_MISC_ADDRESS 0x000009D8 /* MAC Miscellaneous QCU settings */ -#define MAC_DMA_Q7_MISC_ADDRESS 0x000009DC /* MAC Miscellaneous QCU settings */ -#define MAC_DMA_Q8_MISC_ADDRESS 0x000009E0 /* MAC Miscellaneous QCU settings */ -#define MAC_DMA_Q9_MISC_ADDRESS 0x000009E4 /* MAC Miscellaneous QCU settings */ -#define MAC_DMA_QMISC_ADDRESS(_i) (MAC_DMA_Q0_MISC_ADDRESS + ((_i)<<2)) - -#define MAC_DMA_Q_MISC_FSP_MASK 0x0000000F /* Frame Scheduling Policy mask */ -#define MAC_DMA_Q_MISC_FSP_ASAP 0 /* ASAP */ -#define MAC_DMA_Q_MISC_FSP_CBR 1 /* CBR */ -#define MAC_DMA_Q_MISC_FSP_DBA_GATED 2 /* DMA Beacon Alert gated */ -#define MAC_DMA_Q_MISC_FSP_TIM_GATED 3 /* TIM gated */ -#define MAC_DMA_Q_MISC_FSP_BEACON_SENT_GATED 4 /* Beacon-sent-gated */ -#define MAC_DMA_Q_MISC_ONE_SHOT_EN_MASK 0x00000010 /* OneShot enable */ -#define MAC_DMA_Q_MISC_CBR_INCR_DIS1_MASK 0x00000020 /* Disable CBR expired counter incr - (empty q) */ -#define MAC_DMA_Q_MISC_CBR_INCR_DIS0_MASK 0x00000040 /* Disable CBR expired counter incr - (empty beacon q) */ -#define MAC_DMA_Q_MISC_BEACON_USE_MASK 0x00000080 /* Beacon use indication */ -#define MAC_DMA_Q_MISC_CBR_EXP_CNTR_LIMIT_MASK 0x00000100 /* CBR expired counter limit enable */ -#define MAC_DMA_Q_MISC_RDYTIME_EXP_POLICY_MASK 0x00000200 /* Enable TXE cleared on ReadyTime expired or VEOL */ -#define MAC_DMA_Q_MISC_RESET_CBR_EXP_CTR_MASK 0x00000400 /* Reset CBR expired counter */ -#define MAC_DMA_Q_MISC_DCU_EARLY_TERM_REQ_MASK 0x00000800 /* DCU frame early termination request control */ - -#define MAC_DMA_Q0_STS_ADDRESS 0x00000A00 /* MAC Miscellaneous QCU status */ -#define MAC_DMA_Q1_STS_ADDRESS 0x00000A04 /* MAC Miscellaneous QCU status */ -#define MAC_DMA_Q2_STS_ADDRESS 0x00000A08 /* MAC Miscellaneous QCU status */ -#define MAC_DMA_Q3_STS_ADDRESS 0x00000A0C /* MAC Miscellaneous QCU status */ -#define MAC_DMA_Q4_STS_ADDRESS 0x00000A10 /* MAC Miscellaneous QCU status */ -#define MAC_DMA_Q5_STS_ADDRESS 0x00000A14 /* MAC Miscellaneous QCU status */ -#define MAC_DMA_Q6_STS_ADDRESS 0x00000A18 /* MAC Miscellaneous QCU status */ -#define MAC_DMA_Q7_STS_ADDRESS 0x00000A1C /* MAC Miscellaneous QCU status */ -#define MAC_DMA_Q8_STS_ADDRESS 0x00000A20 /* MAC Miscellaneous QCU status */ -#define MAC_DMA_Q9_STS_ADDRESS 0x00000A24 /* MAC Miscellaneous QCU status */ -#define MAC_DMA_QSTS_ADDRESS(_i) (MAC_DMA_Q0_STS_ADDRESS + ((_i)<<2)) - -#define MAC_DMA_Q_STS_PEND_FR_CNT_MASK 0x00000003 /* Mask for Pending Frame Count */ -#define MAC_DMA_Q_STS_CBR_EXP_CNT_MASK 0x0000FF00 /* Mask for CBR expired counter */ - -#define MAC_DMA_Q_RDYTIMESHDN_ADDRESS 0x00000A40 /* MAC ReadyTimeShutdown status */ - -/* DCU registers */ - -#define MAC_DMA_D0_QCUMASK_ADDRESS 0x00001000 /* MAC QCU Mask */ -#define MAC_DMA_D1_QCUMASK_ADDRESS 0x00001004 /* MAC QCU Mask */ -#define MAC_DMA_D2_QCUMASK_ADDRESS 0x00001008 /* MAC QCU Mask */ -#define MAC_DMA_D3_QCUMASK_ADDRESS 0x0000100C /* MAC QCU Mask */ -#define MAC_DMA_D4_QCUMASK_ADDRESS 0x00001010 /* MAC QCU Mask */ -#define MAC_DMA_D5_QCUMASK_ADDRESS 0x00001014 /* MAC QCU Mask */ -#define MAC_DMA_D6_QCUMASK_ADDRESS 0x00001018 /* MAC QCU Mask */ -#define MAC_DMA_D7_QCUMASK_ADDRESS 0x0000101C /* MAC QCU Mask */ -#define MAC_DMA_D8_QCUMASK_ADDRESS 0x00001020 /* MAC QCU Mask */ -#define MAC_DMA_D9_QCUMASK_ADDRESS 0x00001024 /* MAC QCU Mask */ -#define MAC_DMA_DQCUMASK_ADDRESS(_i) (MAC_DMA_D0_QCUMASK_ADDRESS + ((_i)<<2)) - -#define MAC_DMA_D_QCUMASK_MASK 0x000003FF /* Mask for QCU Mask (QCU 0-9) */ - -#define MAC_DMA_D_GBL_IFS_SIFS_ADDRESS 0x00001030 /* DCU global SIFS settings */ - - -#define MAC_DMA_D0_LCL_IFS_ADDRESS 0x00001040 /* MAC DCU-specific IFS settings */ -#define MAC_DMA_D1_LCL_IFS_ADDRESS 0x00001044 /* MAC DCU-specific IFS settings */ -#define MAC_DMA_D2_LCL_IFS_ADDRESS 0x00001048 /* MAC DCU-specific IFS settings */ -#define MAC_DMA_D3_LCL_IFS_ADDRESS 0x0000104C /* MAC DCU-specific IFS settings */ -#define MAC_DMA_D4_LCL_IFS_ADDRESS 0x00001050 /* MAC DCU-specific IFS settings */ -#define MAC_DMA_D5_LCL_IFS_ADDRESS 0x00001054 /* MAC DCU-specific IFS settings */ -#define MAC_DMA_D6_LCL_IFS_ADDRESS 0x00001058 /* MAC DCU-specific IFS settings */ -#define MAC_DMA_D7_LCL_IFS_ADDRESS 0x0000105C /* MAC DCU-specific IFS settings */ -#define MAC_DMA_D8_LCL_IFS_ADDRESS 0x00001060 /* MAC DCU-specific IFS settings */ -#define MAC_DMA_D9_LCL_IFS_ADDRESS 0x00001064 /* MAC DCU-specific IFS settings */ -#define MAC_DMA_DLCL_IFS_ADDRESS(_i) (MAC_DMA_D0_LCL_IFS_ADDRESS + ((_i)<<2)) -#define MAC_DMA_D_LCL_IFS_CWMIN_MASK 0x000003FF /* Mask for CW_MIN */ -#define MAC_DMA_D_LCL_IFS_CWMIN_LSB 0 -#define MAC_DMA_D_LCL_IFS_CWMAX_MASK 0x000FFC00 /* Mask for CW_MAX */ -#define MAC_DMA_D_LCL_IFS_CWMAX_LSB 10 -#define MAC_DMA_D_LCL_IFS_AIFS_MASK 0x0FF00000 /* Mask for AIFS */ -#define MAC_DMA_D_LCL_IFS_AIFS_LSB 20 -/* - * Note: even though this field is 8 bits wide the - * maximum supported AIFS value is 0xFc. Setting the AIFS value - * to 0xFd 0xFe, or 0xFf will not work correctly and will cause - * the DCU to hang. - */ -#define MAC_DMA_D_GBL_IFS_SLOT_ADDRESS 0x00001070 /* DC global slot interval */ - -#define MAC_DMA_D0_RETRY_LIMIT_ADDRESS 0x00001080 /* MAC Retry limits */ -#define MAC_DMA_D1_RETRY_LIMIT_ADDRESS 0x00001084 /* MAC Retry limits */ -#define MAC_DMA_D2_RETRY_LIMIT_ADDRESS 0x00001088 /* MAC Retry limits */ -#define MAC_DMA_D3_RETRY_LIMIT_ADDRESS 0x0000108C /* MAC Retry limits */ -#define MAC_DMA_D4_RETRY_LIMIT_ADDRESS 0x00001090 /* MAC Retry limits */ -#define MAC_DMA_D5_RETRY_LIMIT_ADDRESS 0x00001094 /* MAC Retry limits */ -#define MAC_DMA_D6_RETRY_LIMIT_ADDRESS 0x00001098 /* MAC Retry limits */ -#define MAC_DMA_D7_RETRY_LIMIT_ADDRESS 0x0000109C /* MAC Retry limits */ -#define MAC_DMA_D8_RETRY_LIMIT_ADDRESS 0x000010A0 /* MAC Retry limits */ -#define MAC_DMA_D9_RETRY_LIMIT_ADDRESS 0x000010A4 /* MAC Retry limits */ -#define MAC_DMA_DRETRY_LIMIT_ADDRESS(_i) (MAC_DMA_D0_RETRY_LIMIT_ADDRESS + ((_i)<<2)) - -#define MAC_DMA_D_RETRY_LIMIT_FR_RTS_MASK 0x0000000F /* frame RTS failure limit */ -#define MAC_DMA_D_RETRY_LIMIT_FR_RTS_LSB 0 -#define MAC_DMA_D_RETRY_LIMIT_STA_RTS_MASK 0x00003F00 /* station RTS failure limit */ -#define MAC_DMA_D_RETRY_LIMIT_STA_RTS_LSB 8 -#define MAC_DMA_D_RETRY_LIMIT_STA_DATA_MASK 0x000FC000 /* station short retry limit */ -#define MAC_DMA_D_RETRY_LIMIT_STA_DATA_LSB 14 - -#define MAC_DMA_D_GBL_IFS_EIFS_ADDRESS 0x000010B0 /* DCU global EIFS setting */ - -#define MAC_DMA_D0_CHNTIME_ADDRESS 0x000010C0 /* MAC ChannelTime settings */ -#define MAC_DMA_D1_CHNTIME_ADDRESS 0x000010C4 /* MAC ChannelTime settings */ -#define MAC_DMA_D2_CHNTIME_ADDRESS 0x000010C8 /* MAC ChannelTime settings */ -#define MAC_DMA_D3_CHNTIME_ADDRESS 0x000010CC /* MAC ChannelTime settings */ -#define MAC_DMA_D4_CHNTIME_ADDRESS 0x000010D0 /* MAC ChannelTime settings */ -#define MAC_DMA_D5_CHNTIME_ADDRESS 0x000010D4 /* MAC ChannelTime settings */ -#define MAC_DMA_D6_CHNTIME_ADDRESS 0x000010D8 /* MAC ChannelTime settings */ -#define MAC_DMA_D7_CHNTIME_ADDRESS 0x000010DC /* MAC ChannelTime settings */ -#define MAC_DMA_D8_CHNTIME_ADDRESS 0x000010E0 /* MAC ChannelTime settings */ -#define MAC_DMA_D9_CHNTIME_ADDRESS 0x000010E4 /* MAC ChannelTime settings */ -#define MAC_DMA_DCHNTIME_ADDRESS(_i) (MAC_DMA_D0_CHNTIME_ADDRESS + ((_i)<<2)) - -#define MAC_DMA_D_CHNTIME_DUR_MASK 0x000FFFFF /* ChannelTime duration (us) */ -#define MAC_DMA_D_CHNTIME_DUR_LSB 0 /* Shift for ChannelTime duration */ -#define MAC_DMA_D_CHNTIME_EN_MASK 0x00100000 /* ChannelTime enable */ - -#define MAC_DMA_D_GBL_IFS_MISC_ADDRESS 0x000010f0 /* DCU global misc. IFS settings */ -#define MAC_DMA_D_GBL_IFS_MISC_LFSR_SLICE_SEL_MASK 0x00000007 /* LFSR slice select */ -#define MAC_DMA_D_GBL_IFS_MISC_TURBO_MODE_MASK 0x00000008 /* Turbo mode indication */ -#define MAC_DMA_D_GBL_IFS_MISC_DCU_ARBITER_DLY_MASK 0x00300000 /* DCU arbiter delay */ -#define MAC_DMA_D_GBL_IFS_IGNORE_BACKOFF_MASK 0x10000000 - -#define MAC_DMA_D0_MISC_ADDRESS 0x00001100 /* MAC Miscellaneous DCU-specific settings */ -#define MAC_DMA_D1_MISC_ADDRESS 0x00001104 /* MAC Miscellaneous DCU-specific settings */ -#define MAC_DMA_D2_MISC_ADDRESS 0x00001108 /* MAC Miscellaneous DCU-specific settings */ -#define MAC_DMA_D3_MISC_ADDRESS 0x0000110C /* MAC Miscellaneous DCU-specific settings */ -#define MAC_DMA_D4_MISC_ADDRESS 0x00001110 /* MAC Miscellaneous DCU-specific settings */ -#define MAC_DMA_D5_MISC_ADDRESS 0x00001114 /* MAC Miscellaneous DCU-specific settings */ -#define MAC_DMA_D6_MISC_ADDRESS 0x00001118 /* MAC Miscellaneous DCU-specific settings */ -#define MAC_DMA_D7_MISC_ADDRESS 0x0000111C /* MAC Miscellaneous DCU-specific settings */ -#define MAC_DMA_D8_MISC_ADDRESS 0x00001120 /* MAC Miscellaneous DCU-specific settings */ -#define MAC_DMA_D9_MISC_ADDRESS 0x00001124 /* MAC Miscellaneous DCU-specific settings */ -#define MAC_DMA_DMISC_ADDRESS(_i) (MAC_DMA_D0_MISC_ADDRESS + ((_i)<<2)) - -#define MAC_DMA_D0_EOL_ADDRESS 0x00001180 -#define MAC_DMA_D1_EOL_ADDRESS 0x00001184 -#define MAC_DMA_D2_EOL_ADDRESS 0x00001188 -#define MAC_DMA_D3_EOL_ADDRESS 0x0000118C -#define MAC_DMA_D4_EOL_ADDRESS 0x00001190 -#define MAC_DMA_D5_EOL_ADDRESS 0x00001194 -#define MAC_DMA_D6_EOL_ADDRESS 0x00001198 -#define MAC_DMA_D7_EOL_ADDRESS 0x0000119C -#define MAC_DMA_D8_EOL_ADDRESS 0x00001200 -#define MAC_DMA_D9_EOL_ADDRESS 0x00001204 -#define MAC_DMA_DEOL_ADDRESS(_i) (MAC_DMA_D0_EOL_ADDRESS + ((_i)<<2)) - -#define MAC_DMA_D_MISC_BKOFF_THRESH_MASK 0x0000003F /* Backoff threshold */ -#define MAC_DMA_D_MISC_BACK_OFF_THRESH_LSB 0 -#define MAC_DMA_D_MISC_ETS_RTS_MASK 0x00000040 /* End of transmission series - station RTS/data failure - count reset policy */ -#define MAC_DMA_D_MISC_ETS_CW_MASK 0x00000080 /* End of transmission series - CW reset policy */ -#define MAC_DMA_D_MISC_FRAG_WAIT_EN_MASK 0x00000100 /* Fragment Starvation Policy */ - -#define MAC_DMA_D_MISC_FRAG_BKOFF_EN_MASK 0x00000200 /* Backoff during a frag burst */ -#define MAC_DMA_D_MISC_HCF_POLL_EN_MASK 0x00000800 /* HFC poll enable */ -#define MAC_DMA_D_MISC_BKOFF_PERSISTENCE_MASK 0x00001000 /* Backoff persistence factor - setting */ -#define MAC_DMA_D_MISC_VIR_COL_HANDLING_MASK 0x0000C000 /* Mask for Virtual collision - handling policy */ -#define MAC_DMA_D_MISC_VIR_COL_HANDLING_LSB 14 -#define MAC_DMA_D_MISC_VIR_COL_HANDLING_DEFAULT 0 /* Normal */ -#define MAC_DMA_D_MISC_VIR_COL_HANDLING_IGNORE 1 /* Ignore */ -#define MAC_DMA_D_MISC_BEACON_USE_MASK 0x00010000 /* Beacon use indication */ -#define MAC_DMA_D_MISC_ARB_LOCKOUT_CNTRL_MASK 0x00060000 /* Mask for DCU arbiter lockout control */ -#define MAC_DMA_D_MISC_ARB_LOCKOUT_CNTRL_LSB 17 -#define MAC_DMA_D_MISC_ARB_LOCKOUT_CNTRL_NONE 0 /* No lockout*/ -#define MAC_DMA_D_MISC_ARB_LOCKOUT_CNTRL_INTRA_FR 1 /* Intra-frame*/ -#define MAC_DMA_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL 2 /* Global */ -#define MAC_DMA_D_MISC_ARB_LOCKOUT_IGNORE_MASK 0x00080000 /* DCU arbiter lockout ignore control */ -#define MAC_DMA_D_MISC_SEQ_NUM_INCR_DIS_MASK 0x00100000 /* Sequence number increment disable */ -#define MAC_DMA_D_MISC_POST_FR_BKOFF_DIS_MASK 0x00200000 /* Post-frame backoff disable */ -#define MAC_DMA_D_MISC_VIRT_COLL_POLICY_MASK 0x00400000 /* Virtual coll. handling policy */ -#define MAC_DMA_D_MISC_BLOWN_IFS_POLICY_MASK 0x00800000 /* Blown IFS handling policy */ - -#define MAC_DMA_D_SEQNUM_ADDRESS 0x00001140 /* MAC Frame sequence number */ - - - -#define MAC_DMA_D_FPCTL_ADDRESS 0x00001230 /* DCU frame prefetch settings */ -#define MAC_DMA_D_TXPSE_ADDRESS 0x00001270 /* DCU transmit pause control/status */ - -#endif /* _AR6000_DMMAEG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mac_pcu_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mac_pcu_reg.h deleted file mode 100644 index 0d039bb4c994..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mac_pcu_reg.h +++ /dev/null @@ -1,3065 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _MAC_PCU_REG_H_ -#define _MAC_PCU_REG_H_ - -#define MAC_PCU_STA_ADDR_L32_ADDRESS 0x00008000 -#define MAC_PCU_STA_ADDR_L32_OFFSET 0x00000000 -#define MAC_PCU_STA_ADDR_L32_ADDR_31_0_MSB 31 -#define MAC_PCU_STA_ADDR_L32_ADDR_31_0_LSB 0 -#define MAC_PCU_STA_ADDR_L32_ADDR_31_0_MASK 0xffffffff -#define MAC_PCU_STA_ADDR_L32_ADDR_31_0_GET(x) (((x) & MAC_PCU_STA_ADDR_L32_ADDR_31_0_MASK) >> MAC_PCU_STA_ADDR_L32_ADDR_31_0_LSB) -#define MAC_PCU_STA_ADDR_L32_ADDR_31_0_SET(x) (((x) << MAC_PCU_STA_ADDR_L32_ADDR_31_0_LSB) & MAC_PCU_STA_ADDR_L32_ADDR_31_0_MASK) - -#define MAC_PCU_STA_ADDR_U16_ADDRESS 0x00008004 -#define MAC_PCU_STA_ADDR_U16_OFFSET 0x00000004 -#define MAC_PCU_STA_ADDR_U16_ADHOC_MCAST_SEARCH_MSB 31 -#define MAC_PCU_STA_ADDR_U16_ADHOC_MCAST_SEARCH_LSB 31 -#define MAC_PCU_STA_ADDR_U16_ADHOC_MCAST_SEARCH_MASK 0x80000000 -#define MAC_PCU_STA_ADDR_U16_ADHOC_MCAST_SEARCH_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_ADHOC_MCAST_SEARCH_MASK) >> MAC_PCU_STA_ADDR_U16_ADHOC_MCAST_SEARCH_LSB) -#define MAC_PCU_STA_ADDR_U16_ADHOC_MCAST_SEARCH_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_ADHOC_MCAST_SEARCH_LSB) & MAC_PCU_STA_ADDR_U16_ADHOC_MCAST_SEARCH_MASK) -#define MAC_PCU_STA_ADDR_U16_CBCIV_ENDIAN_MSB 30 -#define MAC_PCU_STA_ADDR_U16_CBCIV_ENDIAN_LSB 30 -#define MAC_PCU_STA_ADDR_U16_CBCIV_ENDIAN_MASK 0x40000000 -#define MAC_PCU_STA_ADDR_U16_CBCIV_ENDIAN_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_CBCIV_ENDIAN_MASK) >> MAC_PCU_STA_ADDR_U16_CBCIV_ENDIAN_LSB) -#define MAC_PCU_STA_ADDR_U16_CBCIV_ENDIAN_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_CBCIV_ENDIAN_LSB) & MAC_PCU_STA_ADDR_U16_CBCIV_ENDIAN_MASK) -#define MAC_PCU_STA_ADDR_U16_PRESERVE_SEQNUM_MSB 29 -#define MAC_PCU_STA_ADDR_U16_PRESERVE_SEQNUM_LSB 29 -#define MAC_PCU_STA_ADDR_U16_PRESERVE_SEQNUM_MASK 0x20000000 -#define MAC_PCU_STA_ADDR_U16_PRESERVE_SEQNUM_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_PRESERVE_SEQNUM_MASK) >> MAC_PCU_STA_ADDR_U16_PRESERVE_SEQNUM_LSB) -#define MAC_PCU_STA_ADDR_U16_PRESERVE_SEQNUM_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_PRESERVE_SEQNUM_LSB) & MAC_PCU_STA_ADDR_U16_PRESERVE_SEQNUM_MASK) -#define MAC_PCU_STA_ADDR_U16_KSRCH_MODE_MSB 28 -#define MAC_PCU_STA_ADDR_U16_KSRCH_MODE_LSB 28 -#define MAC_PCU_STA_ADDR_U16_KSRCH_MODE_MASK 0x10000000 -#define MAC_PCU_STA_ADDR_U16_KSRCH_MODE_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_KSRCH_MODE_MASK) >> MAC_PCU_STA_ADDR_U16_KSRCH_MODE_LSB) -#define MAC_PCU_STA_ADDR_U16_KSRCH_MODE_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_KSRCH_MODE_LSB) & MAC_PCU_STA_ADDR_U16_KSRCH_MODE_MASK) -#define MAC_PCU_STA_ADDR_U16_CRPT_MIC_ENABLE_MSB 27 -#define MAC_PCU_STA_ADDR_U16_CRPT_MIC_ENABLE_LSB 27 -#define MAC_PCU_STA_ADDR_U16_CRPT_MIC_ENABLE_MASK 0x08000000 -#define MAC_PCU_STA_ADDR_U16_CRPT_MIC_ENABLE_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_CRPT_MIC_ENABLE_MASK) >> MAC_PCU_STA_ADDR_U16_CRPT_MIC_ENABLE_LSB) -#define MAC_PCU_STA_ADDR_U16_CRPT_MIC_ENABLE_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_CRPT_MIC_ENABLE_LSB) & MAC_PCU_STA_ADDR_U16_CRPT_MIC_ENABLE_MASK) -#define MAC_PCU_STA_ADDR_U16_SECTOR_SELF_GEN_MSB 26 -#define MAC_PCU_STA_ADDR_U16_SECTOR_SELF_GEN_LSB 26 -#define MAC_PCU_STA_ADDR_U16_SECTOR_SELF_GEN_MASK 0x04000000 -#define MAC_PCU_STA_ADDR_U16_SECTOR_SELF_GEN_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_SECTOR_SELF_GEN_MASK) >> MAC_PCU_STA_ADDR_U16_SECTOR_SELF_GEN_LSB) -#define MAC_PCU_STA_ADDR_U16_SECTOR_SELF_GEN_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_SECTOR_SELF_GEN_LSB) & MAC_PCU_STA_ADDR_U16_SECTOR_SELF_GEN_MASK) -#define MAC_PCU_STA_ADDR_U16_BASE_RATE_11B_MSB 25 -#define MAC_PCU_STA_ADDR_U16_BASE_RATE_11B_LSB 25 -#define MAC_PCU_STA_ADDR_U16_BASE_RATE_11B_MASK 0x02000000 -#define MAC_PCU_STA_ADDR_U16_BASE_RATE_11B_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_BASE_RATE_11B_MASK) >> MAC_PCU_STA_ADDR_U16_BASE_RATE_11B_LSB) -#define MAC_PCU_STA_ADDR_U16_BASE_RATE_11B_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_BASE_RATE_11B_LSB) & MAC_PCU_STA_ADDR_U16_BASE_RATE_11B_MASK) -#define MAC_PCU_STA_ADDR_U16_ACKCTS_6MB_MSB 24 -#define MAC_PCU_STA_ADDR_U16_ACKCTS_6MB_LSB 24 -#define MAC_PCU_STA_ADDR_U16_ACKCTS_6MB_MASK 0x01000000 -#define MAC_PCU_STA_ADDR_U16_ACKCTS_6MB_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_ACKCTS_6MB_MASK) >> MAC_PCU_STA_ADDR_U16_ACKCTS_6MB_LSB) -#define MAC_PCU_STA_ADDR_U16_ACKCTS_6MB_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_ACKCTS_6MB_LSB) & MAC_PCU_STA_ADDR_U16_ACKCTS_6MB_MASK) -#define MAC_PCU_STA_ADDR_U16_RTS_USE_DEF_MSB 23 -#define MAC_PCU_STA_ADDR_U16_RTS_USE_DEF_LSB 23 -#define MAC_PCU_STA_ADDR_U16_RTS_USE_DEF_MASK 0x00800000 -#define MAC_PCU_STA_ADDR_U16_RTS_USE_DEF_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_RTS_USE_DEF_MASK) >> MAC_PCU_STA_ADDR_U16_RTS_USE_DEF_LSB) -#define MAC_PCU_STA_ADDR_U16_RTS_USE_DEF_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_RTS_USE_DEF_LSB) & MAC_PCU_STA_ADDR_U16_RTS_USE_DEF_MASK) -#define MAC_PCU_STA_ADDR_U16_DEFANT_UPDATE_MSB 22 -#define MAC_PCU_STA_ADDR_U16_DEFANT_UPDATE_LSB 22 -#define MAC_PCU_STA_ADDR_U16_DEFANT_UPDATE_MASK 0x00400000 -#define MAC_PCU_STA_ADDR_U16_DEFANT_UPDATE_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_DEFANT_UPDATE_MASK) >> MAC_PCU_STA_ADDR_U16_DEFANT_UPDATE_LSB) -#define MAC_PCU_STA_ADDR_U16_DEFANT_UPDATE_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_DEFANT_UPDATE_LSB) & MAC_PCU_STA_ADDR_U16_DEFANT_UPDATE_MASK) -#define MAC_PCU_STA_ADDR_U16_USE_DEFANT_MSB 21 -#define MAC_PCU_STA_ADDR_U16_USE_DEFANT_LSB 21 -#define MAC_PCU_STA_ADDR_U16_USE_DEFANT_MASK 0x00200000 -#define MAC_PCU_STA_ADDR_U16_USE_DEFANT_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_USE_DEFANT_MASK) >> MAC_PCU_STA_ADDR_U16_USE_DEFANT_LSB) -#define MAC_PCU_STA_ADDR_U16_USE_DEFANT_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_USE_DEFANT_LSB) & MAC_PCU_STA_ADDR_U16_USE_DEFANT_MASK) -#define MAC_PCU_STA_ADDR_U16_PCF_MSB 20 -#define MAC_PCU_STA_ADDR_U16_PCF_LSB 20 -#define MAC_PCU_STA_ADDR_U16_PCF_MASK 0x00100000 -#define MAC_PCU_STA_ADDR_U16_PCF_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_PCF_MASK) >> MAC_PCU_STA_ADDR_U16_PCF_LSB) -#define MAC_PCU_STA_ADDR_U16_PCF_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_PCF_LSB) & MAC_PCU_STA_ADDR_U16_PCF_MASK) -#define MAC_PCU_STA_ADDR_U16_KEYSRCH_DIS_MSB 19 -#define MAC_PCU_STA_ADDR_U16_KEYSRCH_DIS_LSB 19 -#define MAC_PCU_STA_ADDR_U16_KEYSRCH_DIS_MASK 0x00080000 -#define MAC_PCU_STA_ADDR_U16_KEYSRCH_DIS_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_KEYSRCH_DIS_MASK) >> MAC_PCU_STA_ADDR_U16_KEYSRCH_DIS_LSB) -#define MAC_PCU_STA_ADDR_U16_KEYSRCH_DIS_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_KEYSRCH_DIS_LSB) & MAC_PCU_STA_ADDR_U16_KEYSRCH_DIS_MASK) -#define MAC_PCU_STA_ADDR_U16_PW_SAVE_MSB 18 -#define MAC_PCU_STA_ADDR_U16_PW_SAVE_LSB 18 -#define MAC_PCU_STA_ADDR_U16_PW_SAVE_MASK 0x00040000 -#define MAC_PCU_STA_ADDR_U16_PW_SAVE_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_PW_SAVE_MASK) >> MAC_PCU_STA_ADDR_U16_PW_SAVE_LSB) -#define MAC_PCU_STA_ADDR_U16_PW_SAVE_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_PW_SAVE_LSB) & MAC_PCU_STA_ADDR_U16_PW_SAVE_MASK) -#define MAC_PCU_STA_ADDR_U16_ADHOC_MSB 17 -#define MAC_PCU_STA_ADDR_U16_ADHOC_LSB 17 -#define MAC_PCU_STA_ADDR_U16_ADHOC_MASK 0x00020000 -#define MAC_PCU_STA_ADDR_U16_ADHOC_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_ADHOC_MASK) >> MAC_PCU_STA_ADDR_U16_ADHOC_LSB) -#define MAC_PCU_STA_ADDR_U16_ADHOC_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_ADHOC_LSB) & MAC_PCU_STA_ADDR_U16_ADHOC_MASK) -#define MAC_PCU_STA_ADDR_U16_STA_AP_MSB 16 -#define MAC_PCU_STA_ADDR_U16_STA_AP_LSB 16 -#define MAC_PCU_STA_ADDR_U16_STA_AP_MASK 0x00010000 -#define MAC_PCU_STA_ADDR_U16_STA_AP_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_STA_AP_MASK) >> MAC_PCU_STA_ADDR_U16_STA_AP_LSB) -#define MAC_PCU_STA_ADDR_U16_STA_AP_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_STA_AP_LSB) & MAC_PCU_STA_ADDR_U16_STA_AP_MASK) -#define MAC_PCU_STA_ADDR_U16_ADDR_47_32_MSB 15 -#define MAC_PCU_STA_ADDR_U16_ADDR_47_32_LSB 0 -#define MAC_PCU_STA_ADDR_U16_ADDR_47_32_MASK 0x0000ffff -#define MAC_PCU_STA_ADDR_U16_ADDR_47_32_GET(x) (((x) & MAC_PCU_STA_ADDR_U16_ADDR_47_32_MASK) >> MAC_PCU_STA_ADDR_U16_ADDR_47_32_LSB) -#define MAC_PCU_STA_ADDR_U16_ADDR_47_32_SET(x) (((x) << MAC_PCU_STA_ADDR_U16_ADDR_47_32_LSB) & MAC_PCU_STA_ADDR_U16_ADDR_47_32_MASK) - -#define MAC_PCU_BSSID_L32_ADDRESS 0x00008008 -#define MAC_PCU_BSSID_L32_OFFSET 0x00000008 -#define MAC_PCU_BSSID_L32_ADDR_MSB 31 -#define MAC_PCU_BSSID_L32_ADDR_LSB 0 -#define MAC_PCU_BSSID_L32_ADDR_MASK 0xffffffff -#define MAC_PCU_BSSID_L32_ADDR_GET(x) (((x) & MAC_PCU_BSSID_L32_ADDR_MASK) >> MAC_PCU_BSSID_L32_ADDR_LSB) -#define MAC_PCU_BSSID_L32_ADDR_SET(x) (((x) << MAC_PCU_BSSID_L32_ADDR_LSB) & MAC_PCU_BSSID_L32_ADDR_MASK) - -#define MAC_PCU_BSSID_U16_ADDRESS 0x0000800c -#define MAC_PCU_BSSID_U16_OFFSET 0x0000000c -#define MAC_PCU_BSSID_U16_AID_MSB 26 -#define MAC_PCU_BSSID_U16_AID_LSB 16 -#define MAC_PCU_BSSID_U16_AID_MASK 0x07ff0000 -#define MAC_PCU_BSSID_U16_AID_GET(x) (((x) & MAC_PCU_BSSID_U16_AID_MASK) >> MAC_PCU_BSSID_U16_AID_LSB) -#define MAC_PCU_BSSID_U16_AID_SET(x) (((x) << MAC_PCU_BSSID_U16_AID_LSB) & MAC_PCU_BSSID_U16_AID_MASK) -#define MAC_PCU_BSSID_U16_ADDR_MSB 15 -#define MAC_PCU_BSSID_U16_ADDR_LSB 0 -#define MAC_PCU_BSSID_U16_ADDR_MASK 0x0000ffff -#define MAC_PCU_BSSID_U16_ADDR_GET(x) (((x) & MAC_PCU_BSSID_U16_ADDR_MASK) >> MAC_PCU_BSSID_U16_ADDR_LSB) -#define MAC_PCU_BSSID_U16_ADDR_SET(x) (((x) << MAC_PCU_BSSID_U16_ADDR_LSB) & MAC_PCU_BSSID_U16_ADDR_MASK) - -#define MAC_PCU_BCN_RSSI_AVE_ADDRESS 0x00008010 -#define MAC_PCU_BCN_RSSI_AVE_OFFSET 0x00000010 -#define MAC_PCU_BCN_RSSI_AVE_VALUE_MSB 11 -#define MAC_PCU_BCN_RSSI_AVE_VALUE_LSB 0 -#define MAC_PCU_BCN_RSSI_AVE_VALUE_MASK 0x00000fff -#define MAC_PCU_BCN_RSSI_AVE_VALUE_GET(x) (((x) & MAC_PCU_BCN_RSSI_AVE_VALUE_MASK) >> MAC_PCU_BCN_RSSI_AVE_VALUE_LSB) -#define MAC_PCU_BCN_RSSI_AVE_VALUE_SET(x) (((x) << MAC_PCU_BCN_RSSI_AVE_VALUE_LSB) & MAC_PCU_BCN_RSSI_AVE_VALUE_MASK) - -#define MAC_PCU_ACK_CTS_TIMEOUT_ADDRESS 0x00008014 -#define MAC_PCU_ACK_CTS_TIMEOUT_OFFSET 0x00000014 -#define MAC_PCU_ACK_CTS_TIMEOUT_CTS_TIMEOUT_MSB 29 -#define MAC_PCU_ACK_CTS_TIMEOUT_CTS_TIMEOUT_LSB 16 -#define MAC_PCU_ACK_CTS_TIMEOUT_CTS_TIMEOUT_MASK 0x3fff0000 -#define MAC_PCU_ACK_CTS_TIMEOUT_CTS_TIMEOUT_GET(x) (((x) & MAC_PCU_ACK_CTS_TIMEOUT_CTS_TIMEOUT_MASK) >> MAC_PCU_ACK_CTS_TIMEOUT_CTS_TIMEOUT_LSB) -#define MAC_PCU_ACK_CTS_TIMEOUT_CTS_TIMEOUT_SET(x) (((x) << MAC_PCU_ACK_CTS_TIMEOUT_CTS_TIMEOUT_LSB) & MAC_PCU_ACK_CTS_TIMEOUT_CTS_TIMEOUT_MASK) -#define MAC_PCU_ACK_CTS_TIMEOUT_ACK_TIMEOUT_MSB 13 -#define MAC_PCU_ACK_CTS_TIMEOUT_ACK_TIMEOUT_LSB 0 -#define MAC_PCU_ACK_CTS_TIMEOUT_ACK_TIMEOUT_MASK 0x00003fff -#define MAC_PCU_ACK_CTS_TIMEOUT_ACK_TIMEOUT_GET(x) (((x) & MAC_PCU_ACK_CTS_TIMEOUT_ACK_TIMEOUT_MASK) >> MAC_PCU_ACK_CTS_TIMEOUT_ACK_TIMEOUT_LSB) -#define MAC_PCU_ACK_CTS_TIMEOUT_ACK_TIMEOUT_SET(x) (((x) << MAC_PCU_ACK_CTS_TIMEOUT_ACK_TIMEOUT_LSB) & MAC_PCU_ACK_CTS_TIMEOUT_ACK_TIMEOUT_MASK) - -#define MAC_PCU_BCN_RSSI_CTL_ADDRESS 0x00008018 -#define MAC_PCU_BCN_RSSI_CTL_OFFSET 0x00000018 -#define MAC_PCU_BCN_RSSI_CTL_RESET_MSB 29 -#define MAC_PCU_BCN_RSSI_CTL_RESET_LSB 29 -#define MAC_PCU_BCN_RSSI_CTL_RESET_MASK 0x20000000 -#define MAC_PCU_BCN_RSSI_CTL_RESET_GET(x) (((x) & MAC_PCU_BCN_RSSI_CTL_RESET_MASK) >> MAC_PCU_BCN_RSSI_CTL_RESET_LSB) -#define MAC_PCU_BCN_RSSI_CTL_RESET_SET(x) (((x) << MAC_PCU_BCN_RSSI_CTL_RESET_LSB) & MAC_PCU_BCN_RSSI_CTL_RESET_MASK) -#define MAC_PCU_BCN_RSSI_CTL_WEIGHT_MSB 28 -#define MAC_PCU_BCN_RSSI_CTL_WEIGHT_LSB 24 -#define MAC_PCU_BCN_RSSI_CTL_WEIGHT_MASK 0x1f000000 -#define MAC_PCU_BCN_RSSI_CTL_WEIGHT_GET(x) (((x) & MAC_PCU_BCN_RSSI_CTL_WEIGHT_MASK) >> MAC_PCU_BCN_RSSI_CTL_WEIGHT_LSB) -#define MAC_PCU_BCN_RSSI_CTL_WEIGHT_SET(x) (((x) << MAC_PCU_BCN_RSSI_CTL_WEIGHT_LSB) & MAC_PCU_BCN_RSSI_CTL_WEIGHT_MASK) -#define MAC_PCU_BCN_RSSI_CTL_RSSI_HIGH_THRESH_MSB 23 -#define MAC_PCU_BCN_RSSI_CTL_RSSI_HIGH_THRESH_LSB 16 -#define MAC_PCU_BCN_RSSI_CTL_RSSI_HIGH_THRESH_MASK 0x00ff0000 -#define MAC_PCU_BCN_RSSI_CTL_RSSI_HIGH_THRESH_GET(x) (((x) & MAC_PCU_BCN_RSSI_CTL_RSSI_HIGH_THRESH_MASK) >> MAC_PCU_BCN_RSSI_CTL_RSSI_HIGH_THRESH_LSB) -#define MAC_PCU_BCN_RSSI_CTL_RSSI_HIGH_THRESH_SET(x) (((x) << MAC_PCU_BCN_RSSI_CTL_RSSI_HIGH_THRESH_LSB) & MAC_PCU_BCN_RSSI_CTL_RSSI_HIGH_THRESH_MASK) -#define MAC_PCU_BCN_RSSI_CTL_MISS_THRESH_MSB 15 -#define MAC_PCU_BCN_RSSI_CTL_MISS_THRESH_LSB 8 -#define MAC_PCU_BCN_RSSI_CTL_MISS_THRESH_MASK 0x0000ff00 -#define MAC_PCU_BCN_RSSI_CTL_MISS_THRESH_GET(x) (((x) & MAC_PCU_BCN_RSSI_CTL_MISS_THRESH_MASK) >> MAC_PCU_BCN_RSSI_CTL_MISS_THRESH_LSB) -#define MAC_PCU_BCN_RSSI_CTL_MISS_THRESH_SET(x) (((x) << MAC_PCU_BCN_RSSI_CTL_MISS_THRESH_LSB) & MAC_PCU_BCN_RSSI_CTL_MISS_THRESH_MASK) -#define MAC_PCU_BCN_RSSI_CTL_RSSI_LOW_THRESH_MSB 7 -#define MAC_PCU_BCN_RSSI_CTL_RSSI_LOW_THRESH_LSB 0 -#define MAC_PCU_BCN_RSSI_CTL_RSSI_LOW_THRESH_MASK 0x000000ff -#define MAC_PCU_BCN_RSSI_CTL_RSSI_LOW_THRESH_GET(x) (((x) & MAC_PCU_BCN_RSSI_CTL_RSSI_LOW_THRESH_MASK) >> MAC_PCU_BCN_RSSI_CTL_RSSI_LOW_THRESH_LSB) -#define MAC_PCU_BCN_RSSI_CTL_RSSI_LOW_THRESH_SET(x) (((x) << MAC_PCU_BCN_RSSI_CTL_RSSI_LOW_THRESH_LSB) & MAC_PCU_BCN_RSSI_CTL_RSSI_LOW_THRESH_MASK) - -#define MAC_PCU_USEC_LATENCY_ADDRESS 0x0000801c -#define MAC_PCU_USEC_LATENCY_OFFSET 0x0000001c -#define MAC_PCU_USEC_LATENCY_RX_LATENCY_MSB 28 -#define MAC_PCU_USEC_LATENCY_RX_LATENCY_LSB 23 -#define MAC_PCU_USEC_LATENCY_RX_LATENCY_MASK 0x1f800000 -#define MAC_PCU_USEC_LATENCY_RX_LATENCY_GET(x) (((x) & MAC_PCU_USEC_LATENCY_RX_LATENCY_MASK) >> MAC_PCU_USEC_LATENCY_RX_LATENCY_LSB) -#define MAC_PCU_USEC_LATENCY_RX_LATENCY_SET(x) (((x) << MAC_PCU_USEC_LATENCY_RX_LATENCY_LSB) & MAC_PCU_USEC_LATENCY_RX_LATENCY_MASK) -#define MAC_PCU_USEC_LATENCY_TX_LATENCY_MSB 22 -#define MAC_PCU_USEC_LATENCY_TX_LATENCY_LSB 14 -#define MAC_PCU_USEC_LATENCY_TX_LATENCY_MASK 0x007fc000 -#define MAC_PCU_USEC_LATENCY_TX_LATENCY_GET(x) (((x) & MAC_PCU_USEC_LATENCY_TX_LATENCY_MASK) >> MAC_PCU_USEC_LATENCY_TX_LATENCY_LSB) -#define MAC_PCU_USEC_LATENCY_TX_LATENCY_SET(x) (((x) << MAC_PCU_USEC_LATENCY_TX_LATENCY_LSB) & MAC_PCU_USEC_LATENCY_TX_LATENCY_MASK) -#define MAC_PCU_USEC_LATENCY_USEC_MSB 7 -#define MAC_PCU_USEC_LATENCY_USEC_LSB 0 -#define MAC_PCU_USEC_LATENCY_USEC_MASK 0x000000ff -#define MAC_PCU_USEC_LATENCY_USEC_GET(x) (((x) & MAC_PCU_USEC_LATENCY_USEC_MASK) >> MAC_PCU_USEC_LATENCY_USEC_LSB) -#define MAC_PCU_USEC_LATENCY_USEC_SET(x) (((x) << MAC_PCU_USEC_LATENCY_USEC_LSB) & MAC_PCU_USEC_LATENCY_USEC_MASK) - -#define PCU_MAX_CFP_DUR_ADDRESS 0x00008020 -#define PCU_MAX_CFP_DUR_OFFSET 0x00000020 -#define PCU_MAX_CFP_DUR_VALUE_MSB 15 -#define PCU_MAX_CFP_DUR_VALUE_LSB 0 -#define PCU_MAX_CFP_DUR_VALUE_MASK 0x0000ffff -#define PCU_MAX_CFP_DUR_VALUE_GET(x) (((x) & PCU_MAX_CFP_DUR_VALUE_MASK) >> PCU_MAX_CFP_DUR_VALUE_LSB) -#define PCU_MAX_CFP_DUR_VALUE_SET(x) (((x) << PCU_MAX_CFP_DUR_VALUE_LSB) & PCU_MAX_CFP_DUR_VALUE_MASK) - -#define MAC_PCU_RX_FILTER_ADDRESS 0x00008024 -#define MAC_PCU_RX_FILTER_OFFSET 0x00000024 -#define MAC_PCU_RX_FILTER_GENERIC_FILTER_MSB 25 -#define MAC_PCU_RX_FILTER_GENERIC_FILTER_LSB 24 -#define MAC_PCU_RX_FILTER_GENERIC_FILTER_MASK 0x03000000 -#define MAC_PCU_RX_FILTER_GENERIC_FILTER_GET(x) (((x) & MAC_PCU_RX_FILTER_GENERIC_FILTER_MASK) >> MAC_PCU_RX_FILTER_GENERIC_FILTER_LSB) -#define MAC_PCU_RX_FILTER_GENERIC_FILTER_SET(x) (((x) << MAC_PCU_RX_FILTER_GENERIC_FILTER_LSB) & MAC_PCU_RX_FILTER_GENERIC_FILTER_MASK) -#define MAC_PCU_RX_FILTER_GENERIC_FTYPE_MSB 23 -#define MAC_PCU_RX_FILTER_GENERIC_FTYPE_LSB 18 -#define MAC_PCU_RX_FILTER_GENERIC_FTYPE_MASK 0x00fc0000 -#define MAC_PCU_RX_FILTER_GENERIC_FTYPE_GET(x) (((x) & MAC_PCU_RX_FILTER_GENERIC_FTYPE_MASK) >> MAC_PCU_RX_FILTER_GENERIC_FTYPE_LSB) -#define MAC_PCU_RX_FILTER_GENERIC_FTYPE_SET(x) (((x) << MAC_PCU_RX_FILTER_GENERIC_FTYPE_LSB) & MAC_PCU_RX_FILTER_GENERIC_FTYPE_MASK) -#define MAC_PCU_RX_FILTER_FROM_TO_DS_MSB 17 -#define MAC_PCU_RX_FILTER_FROM_TO_DS_LSB 17 -#define MAC_PCU_RX_FILTER_FROM_TO_DS_MASK 0x00020000 -#define MAC_PCU_RX_FILTER_FROM_TO_DS_GET(x) (((x) & MAC_PCU_RX_FILTER_FROM_TO_DS_MASK) >> MAC_PCU_RX_FILTER_FROM_TO_DS_LSB) -#define MAC_PCU_RX_FILTER_FROM_TO_DS_SET(x) (((x) << MAC_PCU_RX_FILTER_FROM_TO_DS_LSB) & MAC_PCU_RX_FILTER_FROM_TO_DS_MASK) -#define MAC_PCU_RX_FILTER_RST_DLMTR_CNT_DISABLE_MSB 16 -#define MAC_PCU_RX_FILTER_RST_DLMTR_CNT_DISABLE_LSB 16 -#define MAC_PCU_RX_FILTER_RST_DLMTR_CNT_DISABLE_MASK 0x00010000 -#define MAC_PCU_RX_FILTER_RST_DLMTR_CNT_DISABLE_GET(x) (((x) & MAC_PCU_RX_FILTER_RST_DLMTR_CNT_DISABLE_MASK) >> MAC_PCU_RX_FILTER_RST_DLMTR_CNT_DISABLE_LSB) -#define MAC_PCU_RX_FILTER_RST_DLMTR_CNT_DISABLE_SET(x) (((x) << MAC_PCU_RX_FILTER_RST_DLMTR_CNT_DISABLE_LSB) & MAC_PCU_RX_FILTER_RST_DLMTR_CNT_DISABLE_MASK) -#define MAC_PCU_RX_FILTER_MCAST_BCAST_ALL_MSB 15 -#define MAC_PCU_RX_FILTER_MCAST_BCAST_ALL_LSB 15 -#define MAC_PCU_RX_FILTER_MCAST_BCAST_ALL_MASK 0x00008000 -#define MAC_PCU_RX_FILTER_MCAST_BCAST_ALL_GET(x) (((x) & MAC_PCU_RX_FILTER_MCAST_BCAST_ALL_MASK) >> MAC_PCU_RX_FILTER_MCAST_BCAST_ALL_LSB) -#define MAC_PCU_RX_FILTER_MCAST_BCAST_ALL_SET(x) (((x) << MAC_PCU_RX_FILTER_MCAST_BCAST_ALL_LSB) & MAC_PCU_RX_FILTER_MCAST_BCAST_ALL_MASK) -#define MAC_PCU_RX_FILTER_PS_POLL_MSB 14 -#define MAC_PCU_RX_FILTER_PS_POLL_LSB 14 -#define MAC_PCU_RX_FILTER_PS_POLL_MASK 0x00004000 -#define MAC_PCU_RX_FILTER_PS_POLL_GET(x) (((x) & MAC_PCU_RX_FILTER_PS_POLL_MASK) >> MAC_PCU_RX_FILTER_PS_POLL_LSB) -#define MAC_PCU_RX_FILTER_PS_POLL_SET(x) (((x) << MAC_PCU_RX_FILTER_PS_POLL_LSB) & MAC_PCU_RX_FILTER_PS_POLL_MASK) -#define MAC_PCU_RX_FILTER_ASSUME_RADAR_MSB 13 -#define MAC_PCU_RX_FILTER_ASSUME_RADAR_LSB 13 -#define MAC_PCU_RX_FILTER_ASSUME_RADAR_MASK 0x00002000 -#define MAC_PCU_RX_FILTER_ASSUME_RADAR_GET(x) (((x) & MAC_PCU_RX_FILTER_ASSUME_RADAR_MASK) >> MAC_PCU_RX_FILTER_ASSUME_RADAR_LSB) -#define MAC_PCU_RX_FILTER_ASSUME_RADAR_SET(x) (((x) << MAC_PCU_RX_FILTER_ASSUME_RADAR_LSB) & MAC_PCU_RX_FILTER_ASSUME_RADAR_MASK) -#define MAC_PCU_RX_FILTER_UNCOMPRESSED_BA_BAR_MSB 12 -#define MAC_PCU_RX_FILTER_UNCOMPRESSED_BA_BAR_LSB 12 -#define MAC_PCU_RX_FILTER_UNCOMPRESSED_BA_BAR_MASK 0x00001000 -#define MAC_PCU_RX_FILTER_UNCOMPRESSED_BA_BAR_GET(x) (((x) & MAC_PCU_RX_FILTER_UNCOMPRESSED_BA_BAR_MASK) >> MAC_PCU_RX_FILTER_UNCOMPRESSED_BA_BAR_LSB) -#define MAC_PCU_RX_FILTER_UNCOMPRESSED_BA_BAR_SET(x) (((x) << MAC_PCU_RX_FILTER_UNCOMPRESSED_BA_BAR_LSB) & MAC_PCU_RX_FILTER_UNCOMPRESSED_BA_BAR_MASK) -#define MAC_PCU_RX_FILTER_COMPRESSED_BA_MSB 11 -#define MAC_PCU_RX_FILTER_COMPRESSED_BA_LSB 11 -#define MAC_PCU_RX_FILTER_COMPRESSED_BA_MASK 0x00000800 -#define MAC_PCU_RX_FILTER_COMPRESSED_BA_GET(x) (((x) & MAC_PCU_RX_FILTER_COMPRESSED_BA_MASK) >> MAC_PCU_RX_FILTER_COMPRESSED_BA_LSB) -#define MAC_PCU_RX_FILTER_COMPRESSED_BA_SET(x) (((x) << MAC_PCU_RX_FILTER_COMPRESSED_BA_LSB) & MAC_PCU_RX_FILTER_COMPRESSED_BA_MASK) -#define MAC_PCU_RX_FILTER_COMPRESSED_BAR_MSB 10 -#define MAC_PCU_RX_FILTER_COMPRESSED_BAR_LSB 10 -#define MAC_PCU_RX_FILTER_COMPRESSED_BAR_MASK 0x00000400 -#define MAC_PCU_RX_FILTER_COMPRESSED_BAR_GET(x) (((x) & MAC_PCU_RX_FILTER_COMPRESSED_BAR_MASK) >> MAC_PCU_RX_FILTER_COMPRESSED_BAR_LSB) -#define MAC_PCU_RX_FILTER_COMPRESSED_BAR_SET(x) (((x) << MAC_PCU_RX_FILTER_COMPRESSED_BAR_LSB) & MAC_PCU_RX_FILTER_COMPRESSED_BAR_MASK) -#define MAC_PCU_RX_FILTER_MY_BEACON_MSB 9 -#define MAC_PCU_RX_FILTER_MY_BEACON_LSB 9 -#define MAC_PCU_RX_FILTER_MY_BEACON_MASK 0x00000200 -#define MAC_PCU_RX_FILTER_MY_BEACON_GET(x) (((x) & MAC_PCU_RX_FILTER_MY_BEACON_MASK) >> MAC_PCU_RX_FILTER_MY_BEACON_LSB) -#define MAC_PCU_RX_FILTER_MY_BEACON_SET(x) (((x) << MAC_PCU_RX_FILTER_MY_BEACON_LSB) & MAC_PCU_RX_FILTER_MY_BEACON_MASK) -#define MAC_PCU_RX_FILTER_SYNC_FRAME_MSB 8 -#define MAC_PCU_RX_FILTER_SYNC_FRAME_LSB 8 -#define MAC_PCU_RX_FILTER_SYNC_FRAME_MASK 0x00000100 -#define MAC_PCU_RX_FILTER_SYNC_FRAME_GET(x) (((x) & MAC_PCU_RX_FILTER_SYNC_FRAME_MASK) >> MAC_PCU_RX_FILTER_SYNC_FRAME_LSB) -#define MAC_PCU_RX_FILTER_SYNC_FRAME_SET(x) (((x) << MAC_PCU_RX_FILTER_SYNC_FRAME_LSB) & MAC_PCU_RX_FILTER_SYNC_FRAME_MASK) -#define MAC_PCU_RX_FILTER_PROBE_REQ_MSB 7 -#define MAC_PCU_RX_FILTER_PROBE_REQ_LSB 7 -#define MAC_PCU_RX_FILTER_PROBE_REQ_MASK 0x00000080 -#define MAC_PCU_RX_FILTER_PROBE_REQ_GET(x) (((x) & MAC_PCU_RX_FILTER_PROBE_REQ_MASK) >> MAC_PCU_RX_FILTER_PROBE_REQ_LSB) -#define MAC_PCU_RX_FILTER_PROBE_REQ_SET(x) (((x) << MAC_PCU_RX_FILTER_PROBE_REQ_LSB) & MAC_PCU_RX_FILTER_PROBE_REQ_MASK) -#define MAC_PCU_RX_FILTER_XR_POLL_MSB 6 -#define MAC_PCU_RX_FILTER_XR_POLL_LSB 6 -#define MAC_PCU_RX_FILTER_XR_POLL_MASK 0x00000040 -#define MAC_PCU_RX_FILTER_XR_POLL_GET(x) (((x) & MAC_PCU_RX_FILTER_XR_POLL_MASK) >> MAC_PCU_RX_FILTER_XR_POLL_LSB) -#define MAC_PCU_RX_FILTER_XR_POLL_SET(x) (((x) << MAC_PCU_RX_FILTER_XR_POLL_LSB) & MAC_PCU_RX_FILTER_XR_POLL_MASK) -#define MAC_PCU_RX_FILTER_PROMISCUOUS_MSB 5 -#define MAC_PCU_RX_FILTER_PROMISCUOUS_LSB 5 -#define MAC_PCU_RX_FILTER_PROMISCUOUS_MASK 0x00000020 -#define MAC_PCU_RX_FILTER_PROMISCUOUS_GET(x) (((x) & MAC_PCU_RX_FILTER_PROMISCUOUS_MASK) >> MAC_PCU_RX_FILTER_PROMISCUOUS_LSB) -#define MAC_PCU_RX_FILTER_PROMISCUOUS_SET(x) (((x) << MAC_PCU_RX_FILTER_PROMISCUOUS_LSB) & MAC_PCU_RX_FILTER_PROMISCUOUS_MASK) -#define MAC_PCU_RX_FILTER_BEACON_MSB 4 -#define MAC_PCU_RX_FILTER_BEACON_LSB 4 -#define MAC_PCU_RX_FILTER_BEACON_MASK 0x00000010 -#define MAC_PCU_RX_FILTER_BEACON_GET(x) (((x) & MAC_PCU_RX_FILTER_BEACON_MASK) >> MAC_PCU_RX_FILTER_BEACON_LSB) -#define MAC_PCU_RX_FILTER_BEACON_SET(x) (((x) << MAC_PCU_RX_FILTER_BEACON_LSB) & MAC_PCU_RX_FILTER_BEACON_MASK) -#define MAC_PCU_RX_FILTER_CONTROL_MSB 3 -#define MAC_PCU_RX_FILTER_CONTROL_LSB 3 -#define MAC_PCU_RX_FILTER_CONTROL_MASK 0x00000008 -#define MAC_PCU_RX_FILTER_CONTROL_GET(x) (((x) & MAC_PCU_RX_FILTER_CONTROL_MASK) >> MAC_PCU_RX_FILTER_CONTROL_LSB) -#define MAC_PCU_RX_FILTER_CONTROL_SET(x) (((x) << MAC_PCU_RX_FILTER_CONTROL_LSB) & MAC_PCU_RX_FILTER_CONTROL_MASK) -#define MAC_PCU_RX_FILTER_BROADCAST_MSB 2 -#define MAC_PCU_RX_FILTER_BROADCAST_LSB 2 -#define MAC_PCU_RX_FILTER_BROADCAST_MASK 0x00000004 -#define MAC_PCU_RX_FILTER_BROADCAST_GET(x) (((x) & MAC_PCU_RX_FILTER_BROADCAST_MASK) >> MAC_PCU_RX_FILTER_BROADCAST_LSB) -#define MAC_PCU_RX_FILTER_BROADCAST_SET(x) (((x) << MAC_PCU_RX_FILTER_BROADCAST_LSB) & MAC_PCU_RX_FILTER_BROADCAST_MASK) -#define MAC_PCU_RX_FILTER_MULTICAST_MSB 1 -#define MAC_PCU_RX_FILTER_MULTICAST_LSB 1 -#define MAC_PCU_RX_FILTER_MULTICAST_MASK 0x00000002 -#define MAC_PCU_RX_FILTER_MULTICAST_GET(x) (((x) & MAC_PCU_RX_FILTER_MULTICAST_MASK) >> MAC_PCU_RX_FILTER_MULTICAST_LSB) -#define MAC_PCU_RX_FILTER_MULTICAST_SET(x) (((x) << MAC_PCU_RX_FILTER_MULTICAST_LSB) & MAC_PCU_RX_FILTER_MULTICAST_MASK) -#define MAC_PCU_RX_FILTER_UNICAST_MSB 0 -#define MAC_PCU_RX_FILTER_UNICAST_LSB 0 -#define MAC_PCU_RX_FILTER_UNICAST_MASK 0x00000001 -#define MAC_PCU_RX_FILTER_UNICAST_GET(x) (((x) & MAC_PCU_RX_FILTER_UNICAST_MASK) >> MAC_PCU_RX_FILTER_UNICAST_LSB) -#define MAC_PCU_RX_FILTER_UNICAST_SET(x) (((x) << MAC_PCU_RX_FILTER_UNICAST_LSB) & MAC_PCU_RX_FILTER_UNICAST_MASK) - -#define MAC_PCU_MCAST_FILTER_L32_ADDRESS 0x00008028 -#define MAC_PCU_MCAST_FILTER_L32_OFFSET 0x00000028 -#define MAC_PCU_MCAST_FILTER_L32_VALUE_MSB 31 -#define MAC_PCU_MCAST_FILTER_L32_VALUE_LSB 0 -#define MAC_PCU_MCAST_FILTER_L32_VALUE_MASK 0xffffffff -#define MAC_PCU_MCAST_FILTER_L32_VALUE_GET(x) (((x) & MAC_PCU_MCAST_FILTER_L32_VALUE_MASK) >> MAC_PCU_MCAST_FILTER_L32_VALUE_LSB) -#define MAC_PCU_MCAST_FILTER_L32_VALUE_SET(x) (((x) << MAC_PCU_MCAST_FILTER_L32_VALUE_LSB) & MAC_PCU_MCAST_FILTER_L32_VALUE_MASK) - -#define MAC_PCU_MCAST_FILTER_U32_ADDRESS 0x0000802c -#define MAC_PCU_MCAST_FILTER_U32_OFFSET 0x0000002c -#define MAC_PCU_MCAST_FILTER_U32_VALUE_MSB 31 -#define MAC_PCU_MCAST_FILTER_U32_VALUE_LSB 0 -#define MAC_PCU_MCAST_FILTER_U32_VALUE_MASK 0xffffffff -#define MAC_PCU_MCAST_FILTER_U32_VALUE_GET(x) (((x) & MAC_PCU_MCAST_FILTER_U32_VALUE_MASK) >> MAC_PCU_MCAST_FILTER_U32_VALUE_LSB) -#define MAC_PCU_MCAST_FILTER_U32_VALUE_SET(x) (((x) << MAC_PCU_MCAST_FILTER_U32_VALUE_LSB) & MAC_PCU_MCAST_FILTER_U32_VALUE_MASK) - -#define MAC_PCU_DIAG_SW_ADDRESS 0x00008030 -#define MAC_PCU_DIAG_SW_OFFSET 0x00000030 -#define MAC_PCU_DIAG_SW_DEBUG_MODE_MSB 31 -#define MAC_PCU_DIAG_SW_DEBUG_MODE_LSB 30 -#define MAC_PCU_DIAG_SW_DEBUG_MODE_MASK 0xc0000000 -#define MAC_PCU_DIAG_SW_DEBUG_MODE_GET(x) (((x) & MAC_PCU_DIAG_SW_DEBUG_MODE_MASK) >> MAC_PCU_DIAG_SW_DEBUG_MODE_LSB) -#define MAC_PCU_DIAG_SW_DEBUG_MODE_SET(x) (((x) << MAC_PCU_DIAG_SW_DEBUG_MODE_LSB) & MAC_PCU_DIAG_SW_DEBUG_MODE_MASK) -#define MAC_PCU_DIAG_SW_RX_CLEAR_EXT_LOW_MSB 29 -#define MAC_PCU_DIAG_SW_RX_CLEAR_EXT_LOW_LSB 29 -#define MAC_PCU_DIAG_SW_RX_CLEAR_EXT_LOW_MASK 0x20000000 -#define MAC_PCU_DIAG_SW_RX_CLEAR_EXT_LOW_GET(x) (((x) & MAC_PCU_DIAG_SW_RX_CLEAR_EXT_LOW_MASK) >> MAC_PCU_DIAG_SW_RX_CLEAR_EXT_LOW_LSB) -#define MAC_PCU_DIAG_SW_RX_CLEAR_EXT_LOW_SET(x) (((x) << MAC_PCU_DIAG_SW_RX_CLEAR_EXT_LOW_LSB) & MAC_PCU_DIAG_SW_RX_CLEAR_EXT_LOW_MASK) -#define MAC_PCU_DIAG_SW_RX_CLEAR_CTL_LOW_MSB 28 -#define MAC_PCU_DIAG_SW_RX_CLEAR_CTL_LOW_LSB 28 -#define MAC_PCU_DIAG_SW_RX_CLEAR_CTL_LOW_MASK 0x10000000 -#define MAC_PCU_DIAG_SW_RX_CLEAR_CTL_LOW_GET(x) (((x) & MAC_PCU_DIAG_SW_RX_CLEAR_CTL_LOW_MASK) >> MAC_PCU_DIAG_SW_RX_CLEAR_CTL_LOW_LSB) -#define MAC_PCU_DIAG_SW_RX_CLEAR_CTL_LOW_SET(x) (((x) << MAC_PCU_DIAG_SW_RX_CLEAR_CTL_LOW_LSB) & MAC_PCU_DIAG_SW_RX_CLEAR_CTL_LOW_MASK) -#define MAC_PCU_DIAG_SW_OBS_SEL_2_MSB 27 -#define MAC_PCU_DIAG_SW_OBS_SEL_2_LSB 27 -#define MAC_PCU_DIAG_SW_OBS_SEL_2_MASK 0x08000000 -#define MAC_PCU_DIAG_SW_OBS_SEL_2_GET(x) (((x) & MAC_PCU_DIAG_SW_OBS_SEL_2_MASK) >> MAC_PCU_DIAG_SW_OBS_SEL_2_LSB) -#define MAC_PCU_DIAG_SW_OBS_SEL_2_SET(x) (((x) << MAC_PCU_DIAG_SW_OBS_SEL_2_LSB) & MAC_PCU_DIAG_SW_OBS_SEL_2_MASK) -#define MAC_PCU_DIAG_SW_SATURATE_CYCLE_CNT_MSB 26 -#define MAC_PCU_DIAG_SW_SATURATE_CYCLE_CNT_LSB 26 -#define MAC_PCU_DIAG_SW_SATURATE_CYCLE_CNT_MASK 0x04000000 -#define MAC_PCU_DIAG_SW_SATURATE_CYCLE_CNT_GET(x) (((x) & MAC_PCU_DIAG_SW_SATURATE_CYCLE_CNT_MASK) >> MAC_PCU_DIAG_SW_SATURATE_CYCLE_CNT_LSB) -#define MAC_PCU_DIAG_SW_SATURATE_CYCLE_CNT_SET(x) (((x) << MAC_PCU_DIAG_SW_SATURATE_CYCLE_CNT_LSB) & MAC_PCU_DIAG_SW_SATURATE_CYCLE_CNT_MASK) -#define MAC_PCU_DIAG_SW_FORCE_RX_ABORT_MSB 25 -#define MAC_PCU_DIAG_SW_FORCE_RX_ABORT_LSB 25 -#define MAC_PCU_DIAG_SW_FORCE_RX_ABORT_MASK 0x02000000 -#define MAC_PCU_DIAG_SW_FORCE_RX_ABORT_GET(x) (((x) & MAC_PCU_DIAG_SW_FORCE_RX_ABORT_MASK) >> MAC_PCU_DIAG_SW_FORCE_RX_ABORT_LSB) -#define MAC_PCU_DIAG_SW_FORCE_RX_ABORT_SET(x) (((x) << MAC_PCU_DIAG_SW_FORCE_RX_ABORT_LSB) & MAC_PCU_DIAG_SW_FORCE_RX_ABORT_MASK) -#define MAC_PCU_DIAG_SW_DUAL_CHAIN_CHAN_INFO_MSB 24 -#define MAC_PCU_DIAG_SW_DUAL_CHAIN_CHAN_INFO_LSB 24 -#define MAC_PCU_DIAG_SW_DUAL_CHAIN_CHAN_INFO_MASK 0x01000000 -#define MAC_PCU_DIAG_SW_DUAL_CHAIN_CHAN_INFO_GET(x) (((x) & MAC_PCU_DIAG_SW_DUAL_CHAIN_CHAN_INFO_MASK) >> MAC_PCU_DIAG_SW_DUAL_CHAIN_CHAN_INFO_LSB) -#define MAC_PCU_DIAG_SW_DUAL_CHAIN_CHAN_INFO_SET(x) (((x) << MAC_PCU_DIAG_SW_DUAL_CHAIN_CHAN_INFO_LSB) & MAC_PCU_DIAG_SW_DUAL_CHAIN_CHAN_INFO_MASK) -#define MAC_PCU_DIAG_SW_PHYERR_ENABLE_EIFS_CTL_MSB 23 -#define MAC_PCU_DIAG_SW_PHYERR_ENABLE_EIFS_CTL_LSB 23 -#define MAC_PCU_DIAG_SW_PHYERR_ENABLE_EIFS_CTL_MASK 0x00800000 -#define MAC_PCU_DIAG_SW_PHYERR_ENABLE_EIFS_CTL_GET(x) (((x) & MAC_PCU_DIAG_SW_PHYERR_ENABLE_EIFS_CTL_MASK) >> MAC_PCU_DIAG_SW_PHYERR_ENABLE_EIFS_CTL_LSB) -#define MAC_PCU_DIAG_SW_PHYERR_ENABLE_EIFS_CTL_SET(x) (((x) << MAC_PCU_DIAG_SW_PHYERR_ENABLE_EIFS_CTL_LSB) & MAC_PCU_DIAG_SW_PHYERR_ENABLE_EIFS_CTL_MASK) -#define MAC_PCU_DIAG_SW_CHAN_IDLE_HIGH_MSB 22 -#define MAC_PCU_DIAG_SW_CHAN_IDLE_HIGH_LSB 22 -#define MAC_PCU_DIAG_SW_CHAN_IDLE_HIGH_MASK 0x00400000 -#define MAC_PCU_DIAG_SW_CHAN_IDLE_HIGH_GET(x) (((x) & MAC_PCU_DIAG_SW_CHAN_IDLE_HIGH_MASK) >> MAC_PCU_DIAG_SW_CHAN_IDLE_HIGH_LSB) -#define MAC_PCU_DIAG_SW_CHAN_IDLE_HIGH_SET(x) (((x) << MAC_PCU_DIAG_SW_CHAN_IDLE_HIGH_LSB) & MAC_PCU_DIAG_SW_CHAN_IDLE_HIGH_MASK) -#define MAC_PCU_DIAG_SW_IGNORE_NAV_MSB 21 -#define MAC_PCU_DIAG_SW_IGNORE_NAV_LSB 21 -#define MAC_PCU_DIAG_SW_IGNORE_NAV_MASK 0x00200000 -#define MAC_PCU_DIAG_SW_IGNORE_NAV_GET(x) (((x) & MAC_PCU_DIAG_SW_IGNORE_NAV_MASK) >> MAC_PCU_DIAG_SW_IGNORE_NAV_LSB) -#define MAC_PCU_DIAG_SW_IGNORE_NAV_SET(x) (((x) << MAC_PCU_DIAG_SW_IGNORE_NAV_LSB) & MAC_PCU_DIAG_SW_IGNORE_NAV_MASK) -#define MAC_PCU_DIAG_SW_RX_CLEAR_HIGH_MSB 20 -#define MAC_PCU_DIAG_SW_RX_CLEAR_HIGH_LSB 20 -#define MAC_PCU_DIAG_SW_RX_CLEAR_HIGH_MASK 0x00100000 -#define MAC_PCU_DIAG_SW_RX_CLEAR_HIGH_GET(x) (((x) & MAC_PCU_DIAG_SW_RX_CLEAR_HIGH_MASK) >> MAC_PCU_DIAG_SW_RX_CLEAR_HIGH_LSB) -#define MAC_PCU_DIAG_SW_RX_CLEAR_HIGH_SET(x) (((x) << MAC_PCU_DIAG_SW_RX_CLEAR_HIGH_LSB) & MAC_PCU_DIAG_SW_RX_CLEAR_HIGH_MASK) -#define MAC_PCU_DIAG_SW_OBS_SEL_1_0_MSB 19 -#define MAC_PCU_DIAG_SW_OBS_SEL_1_0_LSB 18 -#define MAC_PCU_DIAG_SW_OBS_SEL_1_0_MASK 0x000c0000 -#define MAC_PCU_DIAG_SW_OBS_SEL_1_0_GET(x) (((x) & MAC_PCU_DIAG_SW_OBS_SEL_1_0_MASK) >> MAC_PCU_DIAG_SW_OBS_SEL_1_0_LSB) -#define MAC_PCU_DIAG_SW_OBS_SEL_1_0_SET(x) (((x) << MAC_PCU_DIAG_SW_OBS_SEL_1_0_LSB) & MAC_PCU_DIAG_SW_OBS_SEL_1_0_MASK) -#define MAC_PCU_DIAG_SW_ACCEPT_NON_V0_MSB 17 -#define MAC_PCU_DIAG_SW_ACCEPT_NON_V0_LSB 17 -#define MAC_PCU_DIAG_SW_ACCEPT_NON_V0_MASK 0x00020000 -#define MAC_PCU_DIAG_SW_ACCEPT_NON_V0_GET(x) (((x) & MAC_PCU_DIAG_SW_ACCEPT_NON_V0_MASK) >> MAC_PCU_DIAG_SW_ACCEPT_NON_V0_LSB) -#define MAC_PCU_DIAG_SW_ACCEPT_NON_V0_SET(x) (((x) << MAC_PCU_DIAG_SW_ACCEPT_NON_V0_LSB) & MAC_PCU_DIAG_SW_ACCEPT_NON_V0_MASK) -#define MAC_PCU_DIAG_SW_DUMP_CHAN_INFO_MSB 8 -#define MAC_PCU_DIAG_SW_DUMP_CHAN_INFO_LSB 8 -#define MAC_PCU_DIAG_SW_DUMP_CHAN_INFO_MASK 0x00000100 -#define MAC_PCU_DIAG_SW_DUMP_CHAN_INFO_GET(x) (((x) & MAC_PCU_DIAG_SW_DUMP_CHAN_INFO_MASK) >> MAC_PCU_DIAG_SW_DUMP_CHAN_INFO_LSB) -#define MAC_PCU_DIAG_SW_DUMP_CHAN_INFO_SET(x) (((x) << MAC_PCU_DIAG_SW_DUMP_CHAN_INFO_LSB) & MAC_PCU_DIAG_SW_DUMP_CHAN_INFO_MASK) -#define MAC_PCU_DIAG_SW_CORRUPT_FCS_MSB 7 -#define MAC_PCU_DIAG_SW_CORRUPT_FCS_LSB 7 -#define MAC_PCU_DIAG_SW_CORRUPT_FCS_MASK 0x00000080 -#define MAC_PCU_DIAG_SW_CORRUPT_FCS_GET(x) (((x) & MAC_PCU_DIAG_SW_CORRUPT_FCS_MASK) >> MAC_PCU_DIAG_SW_CORRUPT_FCS_LSB) -#define MAC_PCU_DIAG_SW_CORRUPT_FCS_SET(x) (((x) << MAC_PCU_DIAG_SW_CORRUPT_FCS_LSB) & MAC_PCU_DIAG_SW_CORRUPT_FCS_MASK) -#define MAC_PCU_DIAG_SW_LOOP_BACK_MSB 6 -#define MAC_PCU_DIAG_SW_LOOP_BACK_LSB 6 -#define MAC_PCU_DIAG_SW_LOOP_BACK_MASK 0x00000040 -#define MAC_PCU_DIAG_SW_LOOP_BACK_GET(x) (((x) & MAC_PCU_DIAG_SW_LOOP_BACK_MASK) >> MAC_PCU_DIAG_SW_LOOP_BACK_LSB) -#define MAC_PCU_DIAG_SW_LOOP_BACK_SET(x) (((x) << MAC_PCU_DIAG_SW_LOOP_BACK_LSB) & MAC_PCU_DIAG_SW_LOOP_BACK_MASK) -#define MAC_PCU_DIAG_SW_HALT_RX_MSB 5 -#define MAC_PCU_DIAG_SW_HALT_RX_LSB 5 -#define MAC_PCU_DIAG_SW_HALT_RX_MASK 0x00000020 -#define MAC_PCU_DIAG_SW_HALT_RX_GET(x) (((x) & MAC_PCU_DIAG_SW_HALT_RX_MASK) >> MAC_PCU_DIAG_SW_HALT_RX_LSB) -#define MAC_PCU_DIAG_SW_HALT_RX_SET(x) (((x) << MAC_PCU_DIAG_SW_HALT_RX_LSB) & MAC_PCU_DIAG_SW_HALT_RX_MASK) -#define MAC_PCU_DIAG_SW_NO_DECRYPT_MSB 4 -#define MAC_PCU_DIAG_SW_NO_DECRYPT_LSB 4 -#define MAC_PCU_DIAG_SW_NO_DECRYPT_MASK 0x00000010 -#define MAC_PCU_DIAG_SW_NO_DECRYPT_GET(x) (((x) & MAC_PCU_DIAG_SW_NO_DECRYPT_MASK) >> MAC_PCU_DIAG_SW_NO_DECRYPT_LSB) -#define MAC_PCU_DIAG_SW_NO_DECRYPT_SET(x) (((x) << MAC_PCU_DIAG_SW_NO_DECRYPT_LSB) & MAC_PCU_DIAG_SW_NO_DECRYPT_MASK) -#define MAC_PCU_DIAG_SW_NO_ENCRYPT_MSB 3 -#define MAC_PCU_DIAG_SW_NO_ENCRYPT_LSB 3 -#define MAC_PCU_DIAG_SW_NO_ENCRYPT_MASK 0x00000008 -#define MAC_PCU_DIAG_SW_NO_ENCRYPT_GET(x) (((x) & MAC_PCU_DIAG_SW_NO_ENCRYPT_MASK) >> MAC_PCU_DIAG_SW_NO_ENCRYPT_LSB) -#define MAC_PCU_DIAG_SW_NO_ENCRYPT_SET(x) (((x) << MAC_PCU_DIAG_SW_NO_ENCRYPT_LSB) & MAC_PCU_DIAG_SW_NO_ENCRYPT_MASK) -#define MAC_PCU_DIAG_SW_NO_CTS_MSB 2 -#define MAC_PCU_DIAG_SW_NO_CTS_LSB 2 -#define MAC_PCU_DIAG_SW_NO_CTS_MASK 0x00000004 -#define MAC_PCU_DIAG_SW_NO_CTS_GET(x) (((x) & MAC_PCU_DIAG_SW_NO_CTS_MASK) >> MAC_PCU_DIAG_SW_NO_CTS_LSB) -#define MAC_PCU_DIAG_SW_NO_CTS_SET(x) (((x) << MAC_PCU_DIAG_SW_NO_CTS_LSB) & MAC_PCU_DIAG_SW_NO_CTS_MASK) -#define MAC_PCU_DIAG_SW_NO_ACK_MSB 1 -#define MAC_PCU_DIAG_SW_NO_ACK_LSB 1 -#define MAC_PCU_DIAG_SW_NO_ACK_MASK 0x00000002 -#define MAC_PCU_DIAG_SW_NO_ACK_GET(x) (((x) & MAC_PCU_DIAG_SW_NO_ACK_MASK) >> MAC_PCU_DIAG_SW_NO_ACK_LSB) -#define MAC_PCU_DIAG_SW_NO_ACK_SET(x) (((x) << MAC_PCU_DIAG_SW_NO_ACK_LSB) & MAC_PCU_DIAG_SW_NO_ACK_MASK) -#define MAC_PCU_DIAG_SW_INVALID_KEY_NO_ACK_MSB 0 -#define MAC_PCU_DIAG_SW_INVALID_KEY_NO_ACK_LSB 0 -#define MAC_PCU_DIAG_SW_INVALID_KEY_NO_ACK_MASK 0x00000001 -#define MAC_PCU_DIAG_SW_INVALID_KEY_NO_ACK_GET(x) (((x) & MAC_PCU_DIAG_SW_INVALID_KEY_NO_ACK_MASK) >> MAC_PCU_DIAG_SW_INVALID_KEY_NO_ACK_LSB) -#define MAC_PCU_DIAG_SW_INVALID_KEY_NO_ACK_SET(x) (((x) << MAC_PCU_DIAG_SW_INVALID_KEY_NO_ACK_LSB) & MAC_PCU_DIAG_SW_INVALID_KEY_NO_ACK_MASK) - -#define MAC_PCU_TST_ADDAC_ADDRESS 0x00008034 -#define MAC_PCU_TST_ADDAC_OFFSET 0x00000034 -#define MAC_PCU_TST_ADDAC_TEST_ARM_MSB 20 -#define MAC_PCU_TST_ADDAC_TEST_ARM_LSB 20 -#define MAC_PCU_TST_ADDAC_TEST_ARM_MASK 0x00100000 -#define MAC_PCU_TST_ADDAC_TEST_ARM_GET(x) (((x) & MAC_PCU_TST_ADDAC_TEST_ARM_MASK) >> MAC_PCU_TST_ADDAC_TEST_ARM_LSB) -#define MAC_PCU_TST_ADDAC_TEST_ARM_SET(x) (((x) << MAC_PCU_TST_ADDAC_TEST_ARM_LSB) & MAC_PCU_TST_ADDAC_TEST_ARM_MASK) -#define MAC_PCU_TST_ADDAC_TEST_CAPTURE_MSB 19 -#define MAC_PCU_TST_ADDAC_TEST_CAPTURE_LSB 19 -#define MAC_PCU_TST_ADDAC_TEST_CAPTURE_MASK 0x00080000 -#define MAC_PCU_TST_ADDAC_TEST_CAPTURE_GET(x) (((x) & MAC_PCU_TST_ADDAC_TEST_CAPTURE_MASK) >> MAC_PCU_TST_ADDAC_TEST_CAPTURE_LSB) -#define MAC_PCU_TST_ADDAC_TEST_CAPTURE_SET(x) (((x) << MAC_PCU_TST_ADDAC_TEST_CAPTURE_LSB) & MAC_PCU_TST_ADDAC_TEST_CAPTURE_MASK) -#define MAC_PCU_TST_ADDAC_CONT_TEST_MSB 18 -#define MAC_PCU_TST_ADDAC_CONT_TEST_LSB 18 -#define MAC_PCU_TST_ADDAC_CONT_TEST_MASK 0x00040000 -#define MAC_PCU_TST_ADDAC_CONT_TEST_GET(x) (((x) & MAC_PCU_TST_ADDAC_CONT_TEST_MASK) >> MAC_PCU_TST_ADDAC_CONT_TEST_LSB) -#define MAC_PCU_TST_ADDAC_CONT_TEST_SET(x) (((x) << MAC_PCU_TST_ADDAC_CONT_TEST_LSB) & MAC_PCU_TST_ADDAC_CONT_TEST_MASK) -#define MAC_PCU_TST_ADDAC_TRIG_POLARITY_MSB 17 -#define MAC_PCU_TST_ADDAC_TRIG_POLARITY_LSB 17 -#define MAC_PCU_TST_ADDAC_TRIG_POLARITY_MASK 0x00020000 -#define MAC_PCU_TST_ADDAC_TRIG_POLARITY_GET(x) (((x) & MAC_PCU_TST_ADDAC_TRIG_POLARITY_MASK) >> MAC_PCU_TST_ADDAC_TRIG_POLARITY_LSB) -#define MAC_PCU_TST_ADDAC_TRIG_POLARITY_SET(x) (((x) << MAC_PCU_TST_ADDAC_TRIG_POLARITY_LSB) & MAC_PCU_TST_ADDAC_TRIG_POLARITY_MASK) -#define MAC_PCU_TST_ADDAC_TRIG_SEL_MSB 16 -#define MAC_PCU_TST_ADDAC_TRIG_SEL_LSB 16 -#define MAC_PCU_TST_ADDAC_TRIG_SEL_MASK 0x00010000 -#define MAC_PCU_TST_ADDAC_TRIG_SEL_GET(x) (((x) & MAC_PCU_TST_ADDAC_TRIG_SEL_MASK) >> MAC_PCU_TST_ADDAC_TRIG_SEL_LSB) -#define MAC_PCU_TST_ADDAC_TRIG_SEL_SET(x) (((x) << MAC_PCU_TST_ADDAC_TRIG_SEL_LSB) & MAC_PCU_TST_ADDAC_TRIG_SEL_MASK) -#define MAC_PCU_TST_ADDAC_UPPER_8B_MSB 14 -#define MAC_PCU_TST_ADDAC_UPPER_8B_LSB 14 -#define MAC_PCU_TST_ADDAC_UPPER_8B_MASK 0x00004000 -#define MAC_PCU_TST_ADDAC_UPPER_8B_GET(x) (((x) & MAC_PCU_TST_ADDAC_UPPER_8B_MASK) >> MAC_PCU_TST_ADDAC_UPPER_8B_LSB) -#define MAC_PCU_TST_ADDAC_UPPER_8B_SET(x) (((x) << MAC_PCU_TST_ADDAC_UPPER_8B_LSB) & MAC_PCU_TST_ADDAC_UPPER_8B_MASK) -#define MAC_PCU_TST_ADDAC_LOOP_LEN_MSB 13 -#define MAC_PCU_TST_ADDAC_LOOP_LEN_LSB 3 -#define MAC_PCU_TST_ADDAC_LOOP_LEN_MASK 0x00003ff8 -#define MAC_PCU_TST_ADDAC_LOOP_LEN_GET(x) (((x) & MAC_PCU_TST_ADDAC_LOOP_LEN_MASK) >> MAC_PCU_TST_ADDAC_LOOP_LEN_LSB) -#define MAC_PCU_TST_ADDAC_LOOP_LEN_SET(x) (((x) << MAC_PCU_TST_ADDAC_LOOP_LEN_LSB) & MAC_PCU_TST_ADDAC_LOOP_LEN_MASK) -#define MAC_PCU_TST_ADDAC_LOOP_MSB 2 -#define MAC_PCU_TST_ADDAC_LOOP_LSB 2 -#define MAC_PCU_TST_ADDAC_LOOP_MASK 0x00000004 -#define MAC_PCU_TST_ADDAC_LOOP_GET(x) (((x) & MAC_PCU_TST_ADDAC_LOOP_MASK) >> MAC_PCU_TST_ADDAC_LOOP_LSB) -#define MAC_PCU_TST_ADDAC_LOOP_SET(x) (((x) << MAC_PCU_TST_ADDAC_LOOP_LSB) & MAC_PCU_TST_ADDAC_LOOP_MASK) -#define MAC_PCU_TST_ADDAC_TESTMODE_MSB 1 -#define MAC_PCU_TST_ADDAC_TESTMODE_LSB 1 -#define MAC_PCU_TST_ADDAC_TESTMODE_MASK 0x00000002 -#define MAC_PCU_TST_ADDAC_TESTMODE_GET(x) (((x) & MAC_PCU_TST_ADDAC_TESTMODE_MASK) >> MAC_PCU_TST_ADDAC_TESTMODE_LSB) -#define MAC_PCU_TST_ADDAC_TESTMODE_SET(x) (((x) << MAC_PCU_TST_ADDAC_TESTMODE_LSB) & MAC_PCU_TST_ADDAC_TESTMODE_MASK) -#define MAC_PCU_TST_ADDAC_CONT_TX_MSB 0 -#define MAC_PCU_TST_ADDAC_CONT_TX_LSB 0 -#define MAC_PCU_TST_ADDAC_CONT_TX_MASK 0x00000001 -#define MAC_PCU_TST_ADDAC_CONT_TX_GET(x) (((x) & MAC_PCU_TST_ADDAC_CONT_TX_MASK) >> MAC_PCU_TST_ADDAC_CONT_TX_LSB) -#define MAC_PCU_TST_ADDAC_CONT_TX_SET(x) (((x) << MAC_PCU_TST_ADDAC_CONT_TX_LSB) & MAC_PCU_TST_ADDAC_CONT_TX_MASK) - -#define MAC_PCU_DEF_ANTENNA_ADDRESS 0x00008038 -#define MAC_PCU_DEF_ANTENNA_OFFSET 0x00000038 -#define MAC_PCU_DEF_ANTENNA_RX_LNA_CONFIG_SEL_MSB 28 -#define MAC_PCU_DEF_ANTENNA_RX_LNA_CONFIG_SEL_LSB 28 -#define MAC_PCU_DEF_ANTENNA_RX_LNA_CONFIG_SEL_MASK 0x10000000 -#define MAC_PCU_DEF_ANTENNA_RX_LNA_CONFIG_SEL_GET(x) (((x) & MAC_PCU_DEF_ANTENNA_RX_LNA_CONFIG_SEL_MASK) >> MAC_PCU_DEF_ANTENNA_RX_LNA_CONFIG_SEL_LSB) -#define MAC_PCU_DEF_ANTENNA_RX_LNA_CONFIG_SEL_SET(x) (((x) << MAC_PCU_DEF_ANTENNA_RX_LNA_CONFIG_SEL_LSB) & MAC_PCU_DEF_ANTENNA_RX_LNA_CONFIG_SEL_MASK) -#define MAC_PCU_DEF_ANTENNA_TX_DEF_ANT_SEL_MSB 24 -#define MAC_PCU_DEF_ANTENNA_TX_DEF_ANT_SEL_LSB 24 -#define MAC_PCU_DEF_ANTENNA_TX_DEF_ANT_SEL_MASK 0x01000000 -#define MAC_PCU_DEF_ANTENNA_TX_DEF_ANT_SEL_GET(x) (((x) & MAC_PCU_DEF_ANTENNA_TX_DEF_ANT_SEL_MASK) >> MAC_PCU_DEF_ANTENNA_TX_DEF_ANT_SEL_LSB) -#define MAC_PCU_DEF_ANTENNA_TX_DEF_ANT_SEL_SET(x) (((x) << MAC_PCU_DEF_ANTENNA_TX_DEF_ANT_SEL_LSB) & MAC_PCU_DEF_ANTENNA_TX_DEF_ANT_SEL_MASK) -#define MAC_PCU_DEF_ANTENNA_VALUE_MSB 23 -#define MAC_PCU_DEF_ANTENNA_VALUE_LSB 0 -#define MAC_PCU_DEF_ANTENNA_VALUE_MASK 0x00ffffff -#define MAC_PCU_DEF_ANTENNA_VALUE_GET(x) (((x) & MAC_PCU_DEF_ANTENNA_VALUE_MASK) >> MAC_PCU_DEF_ANTENNA_VALUE_LSB) -#define MAC_PCU_DEF_ANTENNA_VALUE_SET(x) (((x) << MAC_PCU_DEF_ANTENNA_VALUE_LSB) & MAC_PCU_DEF_ANTENNA_VALUE_MASK) - -#define MAC_PCU_AES_MUTE_MASK_0_ADDRESS 0x0000803c -#define MAC_PCU_AES_MUTE_MASK_0_OFFSET 0x0000003c -#define MAC_PCU_AES_MUTE_MASK_0_QOS_MSB 31 -#define MAC_PCU_AES_MUTE_MASK_0_QOS_LSB 16 -#define MAC_PCU_AES_MUTE_MASK_0_QOS_MASK 0xffff0000 -#define MAC_PCU_AES_MUTE_MASK_0_QOS_GET(x) (((x) & MAC_PCU_AES_MUTE_MASK_0_QOS_MASK) >> MAC_PCU_AES_MUTE_MASK_0_QOS_LSB) -#define MAC_PCU_AES_MUTE_MASK_0_QOS_SET(x) (((x) << MAC_PCU_AES_MUTE_MASK_0_QOS_LSB) & MAC_PCU_AES_MUTE_MASK_0_QOS_MASK) -#define MAC_PCU_AES_MUTE_MASK_0_FC_MSB 15 -#define MAC_PCU_AES_MUTE_MASK_0_FC_LSB 0 -#define MAC_PCU_AES_MUTE_MASK_0_FC_MASK 0x0000ffff -#define MAC_PCU_AES_MUTE_MASK_0_FC_GET(x) (((x) & MAC_PCU_AES_MUTE_MASK_0_FC_MASK) >> MAC_PCU_AES_MUTE_MASK_0_FC_LSB) -#define MAC_PCU_AES_MUTE_MASK_0_FC_SET(x) (((x) << MAC_PCU_AES_MUTE_MASK_0_FC_LSB) & MAC_PCU_AES_MUTE_MASK_0_FC_MASK) - -#define MAC_PCU_AES_MUTE_MASK_1_ADDRESS 0x00008040 -#define MAC_PCU_AES_MUTE_MASK_1_OFFSET 0x00000040 -#define MAC_PCU_AES_MUTE_MASK_1_FC_MGMT_MSB 31 -#define MAC_PCU_AES_MUTE_MASK_1_FC_MGMT_LSB 16 -#define MAC_PCU_AES_MUTE_MASK_1_FC_MGMT_MASK 0xffff0000 -#define MAC_PCU_AES_MUTE_MASK_1_FC_MGMT_GET(x) (((x) & MAC_PCU_AES_MUTE_MASK_1_FC_MGMT_MASK) >> MAC_PCU_AES_MUTE_MASK_1_FC_MGMT_LSB) -#define MAC_PCU_AES_MUTE_MASK_1_FC_MGMT_SET(x) (((x) << MAC_PCU_AES_MUTE_MASK_1_FC_MGMT_LSB) & MAC_PCU_AES_MUTE_MASK_1_FC_MGMT_MASK) -#define MAC_PCU_AES_MUTE_MASK_1_SEQ_MSB 15 -#define MAC_PCU_AES_MUTE_MASK_1_SEQ_LSB 0 -#define MAC_PCU_AES_MUTE_MASK_1_SEQ_MASK 0x0000ffff -#define MAC_PCU_AES_MUTE_MASK_1_SEQ_GET(x) (((x) & MAC_PCU_AES_MUTE_MASK_1_SEQ_MASK) >> MAC_PCU_AES_MUTE_MASK_1_SEQ_LSB) -#define MAC_PCU_AES_MUTE_MASK_1_SEQ_SET(x) (((x) << MAC_PCU_AES_MUTE_MASK_1_SEQ_LSB) & MAC_PCU_AES_MUTE_MASK_1_SEQ_MASK) - -#define MAC_PCU_GATED_CLKS_ADDRESS 0x00008044 -#define MAC_PCU_GATED_CLKS_OFFSET 0x00000044 -#define MAC_PCU_GATED_CLKS_GATED_REG_MSB 3 -#define MAC_PCU_GATED_CLKS_GATED_REG_LSB 3 -#define MAC_PCU_GATED_CLKS_GATED_REG_MASK 0x00000008 -#define MAC_PCU_GATED_CLKS_GATED_REG_GET(x) (((x) & MAC_PCU_GATED_CLKS_GATED_REG_MASK) >> MAC_PCU_GATED_CLKS_GATED_REG_LSB) -#define MAC_PCU_GATED_CLKS_GATED_REG_SET(x) (((x) << MAC_PCU_GATED_CLKS_GATED_REG_LSB) & MAC_PCU_GATED_CLKS_GATED_REG_MASK) -#define MAC_PCU_GATED_CLKS_GATED_RX_MSB 2 -#define MAC_PCU_GATED_CLKS_GATED_RX_LSB 2 -#define MAC_PCU_GATED_CLKS_GATED_RX_MASK 0x00000004 -#define MAC_PCU_GATED_CLKS_GATED_RX_GET(x) (((x) & MAC_PCU_GATED_CLKS_GATED_RX_MASK) >> MAC_PCU_GATED_CLKS_GATED_RX_LSB) -#define MAC_PCU_GATED_CLKS_GATED_RX_SET(x) (((x) << MAC_PCU_GATED_CLKS_GATED_RX_LSB) & MAC_PCU_GATED_CLKS_GATED_RX_MASK) -#define MAC_PCU_GATED_CLKS_GATED_TX_MSB 1 -#define MAC_PCU_GATED_CLKS_GATED_TX_LSB 1 -#define MAC_PCU_GATED_CLKS_GATED_TX_MASK 0x00000002 -#define MAC_PCU_GATED_CLKS_GATED_TX_GET(x) (((x) & MAC_PCU_GATED_CLKS_GATED_TX_MASK) >> MAC_PCU_GATED_CLKS_GATED_TX_LSB) -#define MAC_PCU_GATED_CLKS_GATED_TX_SET(x) (((x) << MAC_PCU_GATED_CLKS_GATED_TX_LSB) & MAC_PCU_GATED_CLKS_GATED_TX_MASK) - -#define MAC_PCU_OBS_BUS_2_ADDRESS 0x00008048 -#define MAC_PCU_OBS_BUS_2_OFFSET 0x00000048 -#define MAC_PCU_OBS_BUS_2_VALUE_MSB 17 -#define MAC_PCU_OBS_BUS_2_VALUE_LSB 0 -#define MAC_PCU_OBS_BUS_2_VALUE_MASK 0x0003ffff -#define MAC_PCU_OBS_BUS_2_VALUE_GET(x) (((x) & MAC_PCU_OBS_BUS_2_VALUE_MASK) >> MAC_PCU_OBS_BUS_2_VALUE_LSB) -#define MAC_PCU_OBS_BUS_2_VALUE_SET(x) (((x) << MAC_PCU_OBS_BUS_2_VALUE_LSB) & MAC_PCU_OBS_BUS_2_VALUE_MASK) - -#define MAC_PCU_OBS_BUS_1_ADDRESS 0x0000804c -#define MAC_PCU_OBS_BUS_1_OFFSET 0x0000004c -#define MAC_PCU_OBS_BUS_1_TX_STATE_MSB 30 -#define MAC_PCU_OBS_BUS_1_TX_STATE_LSB 25 -#define MAC_PCU_OBS_BUS_1_TX_STATE_MASK 0x7e000000 -#define MAC_PCU_OBS_BUS_1_TX_STATE_GET(x) (((x) & MAC_PCU_OBS_BUS_1_TX_STATE_MASK) >> MAC_PCU_OBS_BUS_1_TX_STATE_LSB) -#define MAC_PCU_OBS_BUS_1_TX_STATE_SET(x) (((x) << MAC_PCU_OBS_BUS_1_TX_STATE_LSB) & MAC_PCU_OBS_BUS_1_TX_STATE_MASK) -#define MAC_PCU_OBS_BUS_1_RX_STATE_MSB 24 -#define MAC_PCU_OBS_BUS_1_RX_STATE_LSB 20 -#define MAC_PCU_OBS_BUS_1_RX_STATE_MASK 0x01f00000 -#define MAC_PCU_OBS_BUS_1_RX_STATE_GET(x) (((x) & MAC_PCU_OBS_BUS_1_RX_STATE_MASK) >> MAC_PCU_OBS_BUS_1_RX_STATE_LSB) -#define MAC_PCU_OBS_BUS_1_RX_STATE_SET(x) (((x) << MAC_PCU_OBS_BUS_1_RX_STATE_LSB) & MAC_PCU_OBS_BUS_1_RX_STATE_MASK) -#define MAC_PCU_OBS_BUS_1_WEP_STATE_MSB 17 -#define MAC_PCU_OBS_BUS_1_WEP_STATE_LSB 12 -#define MAC_PCU_OBS_BUS_1_WEP_STATE_MASK 0x0003f000 -#define MAC_PCU_OBS_BUS_1_WEP_STATE_GET(x) (((x) & MAC_PCU_OBS_BUS_1_WEP_STATE_MASK) >> MAC_PCU_OBS_BUS_1_WEP_STATE_LSB) -#define MAC_PCU_OBS_BUS_1_WEP_STATE_SET(x) (((x) << MAC_PCU_OBS_BUS_1_WEP_STATE_LSB) & MAC_PCU_OBS_BUS_1_WEP_STATE_MASK) -#define MAC_PCU_OBS_BUS_1_RX_CLEAR_MSB 11 -#define MAC_PCU_OBS_BUS_1_RX_CLEAR_LSB 11 -#define MAC_PCU_OBS_BUS_1_RX_CLEAR_MASK 0x00000800 -#define MAC_PCU_OBS_BUS_1_RX_CLEAR_GET(x) (((x) & MAC_PCU_OBS_BUS_1_RX_CLEAR_MASK) >> MAC_PCU_OBS_BUS_1_RX_CLEAR_LSB) -#define MAC_PCU_OBS_BUS_1_RX_CLEAR_SET(x) (((x) << MAC_PCU_OBS_BUS_1_RX_CLEAR_LSB) & MAC_PCU_OBS_BUS_1_RX_CLEAR_MASK) -#define MAC_PCU_OBS_BUS_1_RX_FRAME_MSB 10 -#define MAC_PCU_OBS_BUS_1_RX_FRAME_LSB 10 -#define MAC_PCU_OBS_BUS_1_RX_FRAME_MASK 0x00000400 -#define MAC_PCU_OBS_BUS_1_RX_FRAME_GET(x) (((x) & MAC_PCU_OBS_BUS_1_RX_FRAME_MASK) >> MAC_PCU_OBS_BUS_1_RX_FRAME_LSB) -#define MAC_PCU_OBS_BUS_1_RX_FRAME_SET(x) (((x) << MAC_PCU_OBS_BUS_1_RX_FRAME_LSB) & MAC_PCU_OBS_BUS_1_RX_FRAME_MASK) -#define MAC_PCU_OBS_BUS_1_TX_FRAME_MSB 9 -#define MAC_PCU_OBS_BUS_1_TX_FRAME_LSB 9 -#define MAC_PCU_OBS_BUS_1_TX_FRAME_MASK 0x00000200 -#define MAC_PCU_OBS_BUS_1_TX_FRAME_GET(x) (((x) & MAC_PCU_OBS_BUS_1_TX_FRAME_MASK) >> MAC_PCU_OBS_BUS_1_TX_FRAME_LSB) -#define MAC_PCU_OBS_BUS_1_TX_FRAME_SET(x) (((x) << MAC_PCU_OBS_BUS_1_TX_FRAME_LSB) & MAC_PCU_OBS_BUS_1_TX_FRAME_MASK) -#define MAC_PCU_OBS_BUS_1_TX_HOLD_MSB 8 -#define MAC_PCU_OBS_BUS_1_TX_HOLD_LSB 8 -#define MAC_PCU_OBS_BUS_1_TX_HOLD_MASK 0x00000100 -#define MAC_PCU_OBS_BUS_1_TX_HOLD_GET(x) (((x) & MAC_PCU_OBS_BUS_1_TX_HOLD_MASK) >> MAC_PCU_OBS_BUS_1_TX_HOLD_LSB) -#define MAC_PCU_OBS_BUS_1_TX_HOLD_SET(x) (((x) << MAC_PCU_OBS_BUS_1_TX_HOLD_LSB) & MAC_PCU_OBS_BUS_1_TX_HOLD_MASK) -#define MAC_PCU_OBS_BUS_1_PCU_CHANNEL_IDLE_MSB 7 -#define MAC_PCU_OBS_BUS_1_PCU_CHANNEL_IDLE_LSB 7 -#define MAC_PCU_OBS_BUS_1_PCU_CHANNEL_IDLE_MASK 0x00000080 -#define MAC_PCU_OBS_BUS_1_PCU_CHANNEL_IDLE_GET(x) (((x) & MAC_PCU_OBS_BUS_1_PCU_CHANNEL_IDLE_MASK) >> MAC_PCU_OBS_BUS_1_PCU_CHANNEL_IDLE_LSB) -#define MAC_PCU_OBS_BUS_1_PCU_CHANNEL_IDLE_SET(x) (((x) << MAC_PCU_OBS_BUS_1_PCU_CHANNEL_IDLE_LSB) & MAC_PCU_OBS_BUS_1_PCU_CHANNEL_IDLE_MASK) -#define MAC_PCU_OBS_BUS_1_TM_QUIET_TIME_MSB 6 -#define MAC_PCU_OBS_BUS_1_TM_QUIET_TIME_LSB 6 -#define MAC_PCU_OBS_BUS_1_TM_QUIET_TIME_MASK 0x00000040 -#define MAC_PCU_OBS_BUS_1_TM_QUIET_TIME_GET(x) (((x) & MAC_PCU_OBS_BUS_1_TM_QUIET_TIME_MASK) >> MAC_PCU_OBS_BUS_1_TM_QUIET_TIME_LSB) -#define MAC_PCU_OBS_BUS_1_TM_QUIET_TIME_SET(x) (((x) << MAC_PCU_OBS_BUS_1_TM_QUIET_TIME_LSB) & MAC_PCU_OBS_BUS_1_TM_QUIET_TIME_MASK) -#define MAC_PCU_OBS_BUS_1_TX_HCF_MSB 5 -#define MAC_PCU_OBS_BUS_1_TX_HCF_LSB 5 -#define MAC_PCU_OBS_BUS_1_TX_HCF_MASK 0x00000020 -#define MAC_PCU_OBS_BUS_1_TX_HCF_GET(x) (((x) & MAC_PCU_OBS_BUS_1_TX_HCF_MASK) >> MAC_PCU_OBS_BUS_1_TX_HCF_LSB) -#define MAC_PCU_OBS_BUS_1_TX_HCF_SET(x) (((x) << MAC_PCU_OBS_BUS_1_TX_HCF_LSB) & MAC_PCU_OBS_BUS_1_TX_HCF_MASK) -#define MAC_PCU_OBS_BUS_1_FILTER_PASS_MSB 4 -#define MAC_PCU_OBS_BUS_1_FILTER_PASS_LSB 4 -#define MAC_PCU_OBS_BUS_1_FILTER_PASS_MASK 0x00000010 -#define MAC_PCU_OBS_BUS_1_FILTER_PASS_GET(x) (((x) & MAC_PCU_OBS_BUS_1_FILTER_PASS_MASK) >> MAC_PCU_OBS_BUS_1_FILTER_PASS_LSB) -#define MAC_PCU_OBS_BUS_1_FILTER_PASS_SET(x) (((x) << MAC_PCU_OBS_BUS_1_FILTER_PASS_LSB) & MAC_PCU_OBS_BUS_1_FILTER_PASS_MASK) -#define MAC_PCU_OBS_BUS_1_RX_MY_BEACON_MSB 3 -#define MAC_PCU_OBS_BUS_1_RX_MY_BEACON_LSB 3 -#define MAC_PCU_OBS_BUS_1_RX_MY_BEACON_MASK 0x00000008 -#define MAC_PCU_OBS_BUS_1_RX_MY_BEACON_GET(x) (((x) & MAC_PCU_OBS_BUS_1_RX_MY_BEACON_MASK) >> MAC_PCU_OBS_BUS_1_RX_MY_BEACON_LSB) -#define MAC_PCU_OBS_BUS_1_RX_MY_BEACON_SET(x) (((x) << MAC_PCU_OBS_BUS_1_RX_MY_BEACON_LSB) & MAC_PCU_OBS_BUS_1_RX_MY_BEACON_MASK) -#define MAC_PCU_OBS_BUS_1_RX_WEP_MSB 2 -#define MAC_PCU_OBS_BUS_1_RX_WEP_LSB 2 -#define MAC_PCU_OBS_BUS_1_RX_WEP_MASK 0x00000004 -#define MAC_PCU_OBS_BUS_1_RX_WEP_GET(x) (((x) & MAC_PCU_OBS_BUS_1_RX_WEP_MASK) >> MAC_PCU_OBS_BUS_1_RX_WEP_LSB) -#define MAC_PCU_OBS_BUS_1_RX_WEP_SET(x) (((x) << MAC_PCU_OBS_BUS_1_RX_WEP_LSB) & MAC_PCU_OBS_BUS_1_RX_WEP_MASK) -#define MAC_PCU_OBS_BUS_1_PCU_RX_END_MSB 1 -#define MAC_PCU_OBS_BUS_1_PCU_RX_END_LSB 1 -#define MAC_PCU_OBS_BUS_1_PCU_RX_END_MASK 0x00000002 -#define MAC_PCU_OBS_BUS_1_PCU_RX_END_GET(x) (((x) & MAC_PCU_OBS_BUS_1_PCU_RX_END_MASK) >> MAC_PCU_OBS_BUS_1_PCU_RX_END_LSB) -#define MAC_PCU_OBS_BUS_1_PCU_RX_END_SET(x) (((x) << MAC_PCU_OBS_BUS_1_PCU_RX_END_LSB) & MAC_PCU_OBS_BUS_1_PCU_RX_END_MASK) -#define MAC_PCU_OBS_BUS_1_PCU_DIRECTED_MSB 0 -#define MAC_PCU_OBS_BUS_1_PCU_DIRECTED_LSB 0 -#define MAC_PCU_OBS_BUS_1_PCU_DIRECTED_MASK 0x00000001 -#define MAC_PCU_OBS_BUS_1_PCU_DIRECTED_GET(x) (((x) & MAC_PCU_OBS_BUS_1_PCU_DIRECTED_MASK) >> MAC_PCU_OBS_BUS_1_PCU_DIRECTED_LSB) -#define MAC_PCU_OBS_BUS_1_PCU_DIRECTED_SET(x) (((x) << MAC_PCU_OBS_BUS_1_PCU_DIRECTED_LSB) & MAC_PCU_OBS_BUS_1_PCU_DIRECTED_MASK) - -#define MAC_PCU_DYM_MIMO_PWR_SAVE_ADDRESS 0x00008050 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_OFFSET 0x00000050 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HI_PWR_CHAIN_MASK_MSB 10 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HI_PWR_CHAIN_MASK_LSB 8 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HI_PWR_CHAIN_MASK_MASK 0x00000700 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HI_PWR_CHAIN_MASK_GET(x) (((x) & MAC_PCU_DYM_MIMO_PWR_SAVE_HI_PWR_CHAIN_MASK_MASK) >> MAC_PCU_DYM_MIMO_PWR_SAVE_HI_PWR_CHAIN_MASK_LSB) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HI_PWR_CHAIN_MASK_SET(x) (((x) << MAC_PCU_DYM_MIMO_PWR_SAVE_HI_PWR_CHAIN_MASK_LSB) & MAC_PCU_DYM_MIMO_PWR_SAVE_HI_PWR_CHAIN_MASK_MASK) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_LOW_PWR_CHAIN_MASK_MSB 6 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_LOW_PWR_CHAIN_MASK_LSB 4 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_LOW_PWR_CHAIN_MASK_MASK 0x00000070 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_LOW_PWR_CHAIN_MASK_GET(x) (((x) & MAC_PCU_DYM_MIMO_PWR_SAVE_LOW_PWR_CHAIN_MASK_MASK) >> MAC_PCU_DYM_MIMO_PWR_SAVE_LOW_PWR_CHAIN_MASK_LSB) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_LOW_PWR_CHAIN_MASK_SET(x) (((x) << MAC_PCU_DYM_MIMO_PWR_SAVE_LOW_PWR_CHAIN_MASK_LSB) & MAC_PCU_DYM_MIMO_PWR_SAVE_LOW_PWR_CHAIN_MASK_MASK) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_SW_CHAIN_MASK_SEL_MSB 2 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_SW_CHAIN_MASK_SEL_LSB 2 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_SW_CHAIN_MASK_SEL_MASK 0x00000004 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_SW_CHAIN_MASK_SEL_GET(x) (((x) & MAC_PCU_DYM_MIMO_PWR_SAVE_SW_CHAIN_MASK_SEL_MASK) >> MAC_PCU_DYM_MIMO_PWR_SAVE_SW_CHAIN_MASK_SEL_LSB) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_SW_CHAIN_MASK_SEL_SET(x) (((x) << MAC_PCU_DYM_MIMO_PWR_SAVE_SW_CHAIN_MASK_SEL_LSB) & MAC_PCU_DYM_MIMO_PWR_SAVE_SW_CHAIN_MASK_SEL_MASK) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HW_CTRL_EN_MSB 1 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HW_CTRL_EN_LSB 1 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HW_CTRL_EN_MASK 0x00000002 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HW_CTRL_EN_GET(x) (((x) & MAC_PCU_DYM_MIMO_PWR_SAVE_HW_CTRL_EN_MASK) >> MAC_PCU_DYM_MIMO_PWR_SAVE_HW_CTRL_EN_LSB) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HW_CTRL_EN_SET(x) (((x) << MAC_PCU_DYM_MIMO_PWR_SAVE_HW_CTRL_EN_LSB) & MAC_PCU_DYM_MIMO_PWR_SAVE_HW_CTRL_EN_MASK) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_USE_MAC_CTRL_MSB 0 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_USE_MAC_CTRL_LSB 0 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_USE_MAC_CTRL_MASK 0x00000001 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_USE_MAC_CTRL_GET(x) (((x) & MAC_PCU_DYM_MIMO_PWR_SAVE_USE_MAC_CTRL_MASK) >> MAC_PCU_DYM_MIMO_PWR_SAVE_USE_MAC_CTRL_LSB) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_USE_MAC_CTRL_SET(x) (((x) << MAC_PCU_DYM_MIMO_PWR_SAVE_USE_MAC_CTRL_LSB) & MAC_PCU_DYM_MIMO_PWR_SAVE_USE_MAC_CTRL_MASK) - -#define MAC_PCU_LAST_BEACON_TSF_ADDRESS 0x00008054 -#define MAC_PCU_LAST_BEACON_TSF_OFFSET 0x00000054 -#define MAC_PCU_LAST_BEACON_TSF_VALUE_MSB 31 -#define MAC_PCU_LAST_BEACON_TSF_VALUE_LSB 0 -#define MAC_PCU_LAST_BEACON_TSF_VALUE_MASK 0xffffffff -#define MAC_PCU_LAST_BEACON_TSF_VALUE_GET(x) (((x) & MAC_PCU_LAST_BEACON_TSF_VALUE_MASK) >> MAC_PCU_LAST_BEACON_TSF_VALUE_LSB) -#define MAC_PCU_LAST_BEACON_TSF_VALUE_SET(x) (((x) << MAC_PCU_LAST_BEACON_TSF_VALUE_LSB) & MAC_PCU_LAST_BEACON_TSF_VALUE_MASK) - -#define MAC_PCU_NAV_ADDRESS 0x00008058 -#define MAC_PCU_NAV_OFFSET 0x00000058 -#define MAC_PCU_NAV_VALUE_MSB 25 -#define MAC_PCU_NAV_VALUE_LSB 0 -#define MAC_PCU_NAV_VALUE_MASK 0x03ffffff -#define MAC_PCU_NAV_VALUE_GET(x) (((x) & MAC_PCU_NAV_VALUE_MASK) >> MAC_PCU_NAV_VALUE_LSB) -#define MAC_PCU_NAV_VALUE_SET(x) (((x) << MAC_PCU_NAV_VALUE_LSB) & MAC_PCU_NAV_VALUE_MASK) - -#define MAC_PCU_RTS_SUCCESS_CNT_ADDRESS 0x0000805c -#define MAC_PCU_RTS_SUCCESS_CNT_OFFSET 0x0000005c -#define MAC_PCU_RTS_SUCCESS_CNT_VALUE_MSB 15 -#define MAC_PCU_RTS_SUCCESS_CNT_VALUE_LSB 0 -#define MAC_PCU_RTS_SUCCESS_CNT_VALUE_MASK 0x0000ffff -#define MAC_PCU_RTS_SUCCESS_CNT_VALUE_GET(x) (((x) & MAC_PCU_RTS_SUCCESS_CNT_VALUE_MASK) >> MAC_PCU_RTS_SUCCESS_CNT_VALUE_LSB) -#define MAC_PCU_RTS_SUCCESS_CNT_VALUE_SET(x) (((x) << MAC_PCU_RTS_SUCCESS_CNT_VALUE_LSB) & MAC_PCU_RTS_SUCCESS_CNT_VALUE_MASK) - -#define MAC_PCU_RTS_FAIL_CNT_ADDRESS 0x00008060 -#define MAC_PCU_RTS_FAIL_CNT_OFFSET 0x00000060 -#define MAC_PCU_RTS_FAIL_CNT_VALUE_MSB 15 -#define MAC_PCU_RTS_FAIL_CNT_VALUE_LSB 0 -#define MAC_PCU_RTS_FAIL_CNT_VALUE_MASK 0x0000ffff -#define MAC_PCU_RTS_FAIL_CNT_VALUE_GET(x) (((x) & MAC_PCU_RTS_FAIL_CNT_VALUE_MASK) >> MAC_PCU_RTS_FAIL_CNT_VALUE_LSB) -#define MAC_PCU_RTS_FAIL_CNT_VALUE_SET(x) (((x) << MAC_PCU_RTS_FAIL_CNT_VALUE_LSB) & MAC_PCU_RTS_FAIL_CNT_VALUE_MASK) - -#define MAC_PCU_ACK_FAIL_CNT_ADDRESS 0x00008064 -#define MAC_PCU_ACK_FAIL_CNT_OFFSET 0x00000064 -#define MAC_PCU_ACK_FAIL_CNT_VALUE_MSB 15 -#define MAC_PCU_ACK_FAIL_CNT_VALUE_LSB 0 -#define MAC_PCU_ACK_FAIL_CNT_VALUE_MASK 0x0000ffff -#define MAC_PCU_ACK_FAIL_CNT_VALUE_GET(x) (((x) & MAC_PCU_ACK_FAIL_CNT_VALUE_MASK) >> MAC_PCU_ACK_FAIL_CNT_VALUE_LSB) -#define MAC_PCU_ACK_FAIL_CNT_VALUE_SET(x) (((x) << MAC_PCU_ACK_FAIL_CNT_VALUE_LSB) & MAC_PCU_ACK_FAIL_CNT_VALUE_MASK) - -#define MAC_PCU_FCS_FAIL_CNT_ADDRESS 0x00008068 -#define MAC_PCU_FCS_FAIL_CNT_OFFSET 0x00000068 -#define MAC_PCU_FCS_FAIL_CNT_VALUE_MSB 15 -#define MAC_PCU_FCS_FAIL_CNT_VALUE_LSB 0 -#define MAC_PCU_FCS_FAIL_CNT_VALUE_MASK 0x0000ffff -#define MAC_PCU_FCS_FAIL_CNT_VALUE_GET(x) (((x) & MAC_PCU_FCS_FAIL_CNT_VALUE_MASK) >> MAC_PCU_FCS_FAIL_CNT_VALUE_LSB) -#define MAC_PCU_FCS_FAIL_CNT_VALUE_SET(x) (((x) << MAC_PCU_FCS_FAIL_CNT_VALUE_LSB) & MAC_PCU_FCS_FAIL_CNT_VALUE_MASK) - -#define MAC_PCU_BEACON_CNT_ADDRESS 0x0000806c -#define MAC_PCU_BEACON_CNT_OFFSET 0x0000006c -#define MAC_PCU_BEACON_CNT_VALUE_MSB 15 -#define MAC_PCU_BEACON_CNT_VALUE_LSB 0 -#define MAC_PCU_BEACON_CNT_VALUE_MASK 0x0000ffff -#define MAC_PCU_BEACON_CNT_VALUE_GET(x) (((x) & MAC_PCU_BEACON_CNT_VALUE_MASK) >> MAC_PCU_BEACON_CNT_VALUE_LSB) -#define MAC_PCU_BEACON_CNT_VALUE_SET(x) (((x) << MAC_PCU_BEACON_CNT_VALUE_LSB) & MAC_PCU_BEACON_CNT_VALUE_MASK) - -#define MAC_PCU_XRMODE_ADDRESS 0x00008070 -#define MAC_PCU_XRMODE_OFFSET 0x00000070 -#define MAC_PCU_XRMODE_FRAME_HOLD_MSB 31 -#define MAC_PCU_XRMODE_FRAME_HOLD_LSB 20 -#define MAC_PCU_XRMODE_FRAME_HOLD_MASK 0xfff00000 -#define MAC_PCU_XRMODE_FRAME_HOLD_GET(x) (((x) & MAC_PCU_XRMODE_FRAME_HOLD_MASK) >> MAC_PCU_XRMODE_FRAME_HOLD_LSB) -#define MAC_PCU_XRMODE_FRAME_HOLD_SET(x) (((x) << MAC_PCU_XRMODE_FRAME_HOLD_LSB) & MAC_PCU_XRMODE_FRAME_HOLD_MASK) -#define MAC_PCU_XRMODE_WAIT_FOR_POLL_MSB 7 -#define MAC_PCU_XRMODE_WAIT_FOR_POLL_LSB 7 -#define MAC_PCU_XRMODE_WAIT_FOR_POLL_MASK 0x00000080 -#define MAC_PCU_XRMODE_WAIT_FOR_POLL_GET(x) (((x) & MAC_PCU_XRMODE_WAIT_FOR_POLL_MASK) >> MAC_PCU_XRMODE_WAIT_FOR_POLL_LSB) -#define MAC_PCU_XRMODE_WAIT_FOR_POLL_SET(x) (((x) << MAC_PCU_XRMODE_WAIT_FOR_POLL_LSB) & MAC_PCU_XRMODE_WAIT_FOR_POLL_MASK) -#define MAC_PCU_XRMODE_POLL_TYPE_MSB 5 -#define MAC_PCU_XRMODE_POLL_TYPE_LSB 0 -#define MAC_PCU_XRMODE_POLL_TYPE_MASK 0x0000003f -#define MAC_PCU_XRMODE_POLL_TYPE_GET(x) (((x) & MAC_PCU_XRMODE_POLL_TYPE_MASK) >> MAC_PCU_XRMODE_POLL_TYPE_LSB) -#define MAC_PCU_XRMODE_POLL_TYPE_SET(x) (((x) << MAC_PCU_XRMODE_POLL_TYPE_LSB) & MAC_PCU_XRMODE_POLL_TYPE_MASK) - -#define MAC_PCU_XRDEL_ADDRESS 0x00008074 -#define MAC_PCU_XRDEL_OFFSET 0x00000074 -#define MAC_PCU_XRDEL_CHIRP_DATA_DELAY_MSB 31 -#define MAC_PCU_XRDEL_CHIRP_DATA_DELAY_LSB 16 -#define MAC_PCU_XRDEL_CHIRP_DATA_DELAY_MASK 0xffff0000 -#define MAC_PCU_XRDEL_CHIRP_DATA_DELAY_GET(x) (((x) & MAC_PCU_XRDEL_CHIRP_DATA_DELAY_MASK) >> MAC_PCU_XRDEL_CHIRP_DATA_DELAY_LSB) -#define MAC_PCU_XRDEL_CHIRP_DATA_DELAY_SET(x) (((x) << MAC_PCU_XRDEL_CHIRP_DATA_DELAY_LSB) & MAC_PCU_XRDEL_CHIRP_DATA_DELAY_MASK) -#define MAC_PCU_XRDEL_SLOT_DELAY_MSB 15 -#define MAC_PCU_XRDEL_SLOT_DELAY_LSB 0 -#define MAC_PCU_XRDEL_SLOT_DELAY_MASK 0x0000ffff -#define MAC_PCU_XRDEL_SLOT_DELAY_GET(x) (((x) & MAC_PCU_XRDEL_SLOT_DELAY_MASK) >> MAC_PCU_XRDEL_SLOT_DELAY_LSB) -#define MAC_PCU_XRDEL_SLOT_DELAY_SET(x) (((x) << MAC_PCU_XRDEL_SLOT_DELAY_LSB) & MAC_PCU_XRDEL_SLOT_DELAY_MASK) - -#define MAC_PCU_XRTO_ADDRESS 0x00008078 -#define MAC_PCU_XRTO_OFFSET 0x00000078 -#define MAC_PCU_XRTO_POLL_TIMEOUT_MSB 31 -#define MAC_PCU_XRTO_POLL_TIMEOUT_LSB 16 -#define MAC_PCU_XRTO_POLL_TIMEOUT_MASK 0xffff0000 -#define MAC_PCU_XRTO_POLL_TIMEOUT_GET(x) (((x) & MAC_PCU_XRTO_POLL_TIMEOUT_MASK) >> MAC_PCU_XRTO_POLL_TIMEOUT_LSB) -#define MAC_PCU_XRTO_POLL_TIMEOUT_SET(x) (((x) << MAC_PCU_XRTO_POLL_TIMEOUT_LSB) & MAC_PCU_XRTO_POLL_TIMEOUT_MASK) -#define MAC_PCU_XRTO_CHIRP_TIMEOUT_MSB 15 -#define MAC_PCU_XRTO_CHIRP_TIMEOUT_LSB 0 -#define MAC_PCU_XRTO_CHIRP_TIMEOUT_MASK 0x0000ffff -#define MAC_PCU_XRTO_CHIRP_TIMEOUT_GET(x) (((x) & MAC_PCU_XRTO_CHIRP_TIMEOUT_MASK) >> MAC_PCU_XRTO_CHIRP_TIMEOUT_LSB) -#define MAC_PCU_XRTO_CHIRP_TIMEOUT_SET(x) (((x) << MAC_PCU_XRTO_CHIRP_TIMEOUT_LSB) & MAC_PCU_XRTO_CHIRP_TIMEOUT_MASK) - -#define MAC_PCU_XRCRP_ADDRESS 0x0000807c -#define MAC_PCU_XRCRP_OFFSET 0x0000007c -#define MAC_PCU_XRCRP_CHIRP_GAP_MSB 31 -#define MAC_PCU_XRCRP_CHIRP_GAP_LSB 16 -#define MAC_PCU_XRCRP_CHIRP_GAP_MASK 0xffff0000 -#define MAC_PCU_XRCRP_CHIRP_GAP_GET(x) (((x) & MAC_PCU_XRCRP_CHIRP_GAP_MASK) >> MAC_PCU_XRCRP_CHIRP_GAP_LSB) -#define MAC_PCU_XRCRP_CHIRP_GAP_SET(x) (((x) << MAC_PCU_XRCRP_CHIRP_GAP_LSB) & MAC_PCU_XRCRP_CHIRP_GAP_MASK) -#define MAC_PCU_XRCRP_SEND_CHIRP_MSB 0 -#define MAC_PCU_XRCRP_SEND_CHIRP_LSB 0 -#define MAC_PCU_XRCRP_SEND_CHIRP_MASK 0x00000001 -#define MAC_PCU_XRCRP_SEND_CHIRP_GET(x) (((x) & MAC_PCU_XRCRP_SEND_CHIRP_MASK) >> MAC_PCU_XRCRP_SEND_CHIRP_LSB) -#define MAC_PCU_XRCRP_SEND_CHIRP_SET(x) (((x) << MAC_PCU_XRCRP_SEND_CHIRP_LSB) & MAC_PCU_XRCRP_SEND_CHIRP_MASK) - -#define MAC_PCU_XRSTMP_ADDRESS 0x00008080 -#define MAC_PCU_XRSTMP_OFFSET 0x00000080 -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_THRESH_MSB 23 -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_THRESH_LSB 16 -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_THRESH_MASK 0x00ff0000 -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_THRESH_GET(x) (((x) & MAC_PCU_XRSTMP_RX_ABORT_RSSI_THRESH_MASK) >> MAC_PCU_XRSTMP_RX_ABORT_RSSI_THRESH_LSB) -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_THRESH_SET(x) (((x) << MAC_PCU_XRSTMP_RX_ABORT_RSSI_THRESH_LSB) & MAC_PCU_XRSTMP_RX_ABORT_RSSI_THRESH_MASK) -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_THRESH_MSB 15 -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_THRESH_LSB 8 -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_THRESH_MASK 0x0000ff00 -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_THRESH_GET(x) (((x) & MAC_PCU_XRSTMP_TX_STOMP_RSSI_THRESH_MASK) >> MAC_PCU_XRSTMP_TX_STOMP_RSSI_THRESH_LSB) -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_THRESH_SET(x) (((x) << MAC_PCU_XRSTMP_TX_STOMP_RSSI_THRESH_LSB) & MAC_PCU_XRSTMP_TX_STOMP_RSSI_THRESH_MASK) -#define MAC_PCU_XRSTMP_RX_ABORT_DATA_MSB 5 -#define MAC_PCU_XRSTMP_RX_ABORT_DATA_LSB 5 -#define MAC_PCU_XRSTMP_RX_ABORT_DATA_MASK 0x00000020 -#define MAC_PCU_XRSTMP_RX_ABORT_DATA_GET(x) (((x) & MAC_PCU_XRSTMP_RX_ABORT_DATA_MASK) >> MAC_PCU_XRSTMP_RX_ABORT_DATA_LSB) -#define MAC_PCU_XRSTMP_RX_ABORT_DATA_SET(x) (((x) << MAC_PCU_XRSTMP_RX_ABORT_DATA_LSB) & MAC_PCU_XRSTMP_RX_ABORT_DATA_MASK) -#define MAC_PCU_XRSTMP_TX_STOMP_DATA_MSB 4 -#define MAC_PCU_XRSTMP_TX_STOMP_DATA_LSB 4 -#define MAC_PCU_XRSTMP_TX_STOMP_DATA_MASK 0x00000010 -#define MAC_PCU_XRSTMP_TX_STOMP_DATA_GET(x) (((x) & MAC_PCU_XRSTMP_TX_STOMP_DATA_MASK) >> MAC_PCU_XRSTMP_TX_STOMP_DATA_LSB) -#define MAC_PCU_XRSTMP_TX_STOMP_DATA_SET(x) (((x) << MAC_PCU_XRSTMP_TX_STOMP_DATA_LSB) & MAC_PCU_XRSTMP_TX_STOMP_DATA_MASK) -#define MAC_PCU_XRSTMP_TX_STOMP_BSSID_MSB 3 -#define MAC_PCU_XRSTMP_TX_STOMP_BSSID_LSB 3 -#define MAC_PCU_XRSTMP_TX_STOMP_BSSID_MASK 0x00000008 -#define MAC_PCU_XRSTMP_TX_STOMP_BSSID_GET(x) (((x) & MAC_PCU_XRSTMP_TX_STOMP_BSSID_MASK) >> MAC_PCU_XRSTMP_TX_STOMP_BSSID_LSB) -#define MAC_PCU_XRSTMP_TX_STOMP_BSSID_SET(x) (((x) << MAC_PCU_XRSTMP_TX_STOMP_BSSID_LSB) & MAC_PCU_XRSTMP_TX_STOMP_BSSID_MASK) -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_MSB 2 -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_LSB 2 -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_MASK 0x00000004 -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_GET(x) (((x) & MAC_PCU_XRSTMP_TX_STOMP_RSSI_MASK) >> MAC_PCU_XRSTMP_TX_STOMP_RSSI_LSB) -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_SET(x) (((x) << MAC_PCU_XRSTMP_TX_STOMP_RSSI_LSB) & MAC_PCU_XRSTMP_TX_STOMP_RSSI_MASK) -#define MAC_PCU_XRSTMP_RX_ABORT_BSSID_MSB 1 -#define MAC_PCU_XRSTMP_RX_ABORT_BSSID_LSB 1 -#define MAC_PCU_XRSTMP_RX_ABORT_BSSID_MASK 0x00000002 -#define MAC_PCU_XRSTMP_RX_ABORT_BSSID_GET(x) (((x) & MAC_PCU_XRSTMP_RX_ABORT_BSSID_MASK) >> MAC_PCU_XRSTMP_RX_ABORT_BSSID_LSB) -#define MAC_PCU_XRSTMP_RX_ABORT_BSSID_SET(x) (((x) << MAC_PCU_XRSTMP_RX_ABORT_BSSID_LSB) & MAC_PCU_XRSTMP_RX_ABORT_BSSID_MASK) -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_MSB 0 -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_LSB 0 -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_MASK 0x00000001 -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_GET(x) (((x) & MAC_PCU_XRSTMP_RX_ABORT_RSSI_MASK) >> MAC_PCU_XRSTMP_RX_ABORT_RSSI_LSB) -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_SET(x) (((x) << MAC_PCU_XRSTMP_RX_ABORT_RSSI_LSB) & MAC_PCU_XRSTMP_RX_ABORT_RSSI_MASK) - -#define MAC_PCU_ADDR1_MASK_L32_ADDRESS 0x00008084 -#define MAC_PCU_ADDR1_MASK_L32_OFFSET 0x00000084 -#define MAC_PCU_ADDR1_MASK_L32_VALUE_MSB 31 -#define MAC_PCU_ADDR1_MASK_L32_VALUE_LSB 0 -#define MAC_PCU_ADDR1_MASK_L32_VALUE_MASK 0xffffffff -#define MAC_PCU_ADDR1_MASK_L32_VALUE_GET(x) (((x) & MAC_PCU_ADDR1_MASK_L32_VALUE_MASK) >> MAC_PCU_ADDR1_MASK_L32_VALUE_LSB) -#define MAC_PCU_ADDR1_MASK_L32_VALUE_SET(x) (((x) << MAC_PCU_ADDR1_MASK_L32_VALUE_LSB) & MAC_PCU_ADDR1_MASK_L32_VALUE_MASK) - -#define MAC_PCU_ADDR1_MASK_U16_ADDRESS 0x00008088 -#define MAC_PCU_ADDR1_MASK_U16_OFFSET 0x00000088 -#define MAC_PCU_ADDR1_MASK_U16_VALUE_MSB 15 -#define MAC_PCU_ADDR1_MASK_U16_VALUE_LSB 0 -#define MAC_PCU_ADDR1_MASK_U16_VALUE_MASK 0x0000ffff -#define MAC_PCU_ADDR1_MASK_U16_VALUE_GET(x) (((x) & MAC_PCU_ADDR1_MASK_U16_VALUE_MASK) >> MAC_PCU_ADDR1_MASK_U16_VALUE_LSB) -#define MAC_PCU_ADDR1_MASK_U16_VALUE_SET(x) (((x) << MAC_PCU_ADDR1_MASK_U16_VALUE_LSB) & MAC_PCU_ADDR1_MASK_U16_VALUE_MASK) - -#define MAC_PCU_TPC_ADDRESS 0x0000808c -#define MAC_PCU_TPC_OFFSET 0x0000008c -#define MAC_PCU_TPC_CHIRP_PWR_MSB 21 -#define MAC_PCU_TPC_CHIRP_PWR_LSB 16 -#define MAC_PCU_TPC_CHIRP_PWR_MASK 0x003f0000 -#define MAC_PCU_TPC_CHIRP_PWR_GET(x) (((x) & MAC_PCU_TPC_CHIRP_PWR_MASK) >> MAC_PCU_TPC_CHIRP_PWR_LSB) -#define MAC_PCU_TPC_CHIRP_PWR_SET(x) (((x) << MAC_PCU_TPC_CHIRP_PWR_LSB) & MAC_PCU_TPC_CHIRP_PWR_MASK) -#define MAC_PCU_TPC_CTS_PWR_MSB 13 -#define MAC_PCU_TPC_CTS_PWR_LSB 8 -#define MAC_PCU_TPC_CTS_PWR_MASK 0x00003f00 -#define MAC_PCU_TPC_CTS_PWR_GET(x) (((x) & MAC_PCU_TPC_CTS_PWR_MASK) >> MAC_PCU_TPC_CTS_PWR_LSB) -#define MAC_PCU_TPC_CTS_PWR_SET(x) (((x) << MAC_PCU_TPC_CTS_PWR_LSB) & MAC_PCU_TPC_CTS_PWR_MASK) -#define MAC_PCU_TPC_ACK_PWR_MSB 5 -#define MAC_PCU_TPC_ACK_PWR_LSB 0 -#define MAC_PCU_TPC_ACK_PWR_MASK 0x0000003f -#define MAC_PCU_TPC_ACK_PWR_GET(x) (((x) & MAC_PCU_TPC_ACK_PWR_MASK) >> MAC_PCU_TPC_ACK_PWR_LSB) -#define MAC_PCU_TPC_ACK_PWR_SET(x) (((x) << MAC_PCU_TPC_ACK_PWR_LSB) & MAC_PCU_TPC_ACK_PWR_MASK) - -#define MAC_PCU_TX_FRAME_CNT_ADDRESS 0x00008090 -#define MAC_PCU_TX_FRAME_CNT_OFFSET 0x00000090 -#define MAC_PCU_TX_FRAME_CNT_VALUE_MSB 31 -#define MAC_PCU_TX_FRAME_CNT_VALUE_LSB 0 -#define MAC_PCU_TX_FRAME_CNT_VALUE_MASK 0xffffffff -#define MAC_PCU_TX_FRAME_CNT_VALUE_GET(x) (((x) & MAC_PCU_TX_FRAME_CNT_VALUE_MASK) >> MAC_PCU_TX_FRAME_CNT_VALUE_LSB) -#define MAC_PCU_TX_FRAME_CNT_VALUE_SET(x) (((x) << MAC_PCU_TX_FRAME_CNT_VALUE_LSB) & MAC_PCU_TX_FRAME_CNT_VALUE_MASK) - -#define MAC_PCU_RX_FRAME_CNT_ADDRESS 0x00008094 -#define MAC_PCU_RX_FRAME_CNT_OFFSET 0x00000094 -#define MAC_PCU_RX_FRAME_CNT_VALUE_MSB 31 -#define MAC_PCU_RX_FRAME_CNT_VALUE_LSB 0 -#define MAC_PCU_RX_FRAME_CNT_VALUE_MASK 0xffffffff -#define MAC_PCU_RX_FRAME_CNT_VALUE_GET(x) (((x) & MAC_PCU_RX_FRAME_CNT_VALUE_MASK) >> MAC_PCU_RX_FRAME_CNT_VALUE_LSB) -#define MAC_PCU_RX_FRAME_CNT_VALUE_SET(x) (((x) << MAC_PCU_RX_FRAME_CNT_VALUE_LSB) & MAC_PCU_RX_FRAME_CNT_VALUE_MASK) - -#define MAC_PCU_RX_CLEAR_CNT_ADDRESS 0x00008098 -#define MAC_PCU_RX_CLEAR_CNT_OFFSET 0x00000098 -#define MAC_PCU_RX_CLEAR_CNT_VALUE_MSB 31 -#define MAC_PCU_RX_CLEAR_CNT_VALUE_LSB 0 -#define MAC_PCU_RX_CLEAR_CNT_VALUE_MASK 0xffffffff -#define MAC_PCU_RX_CLEAR_CNT_VALUE_GET(x) (((x) & MAC_PCU_RX_CLEAR_CNT_VALUE_MASK) >> MAC_PCU_RX_CLEAR_CNT_VALUE_LSB) -#define MAC_PCU_RX_CLEAR_CNT_VALUE_SET(x) (((x) << MAC_PCU_RX_CLEAR_CNT_VALUE_LSB) & MAC_PCU_RX_CLEAR_CNT_VALUE_MASK) - -#define MAC_PCU_CYCLE_CNT_ADDRESS 0x0000809c -#define MAC_PCU_CYCLE_CNT_OFFSET 0x0000009c -#define MAC_PCU_CYCLE_CNT_VALUE_MSB 31 -#define MAC_PCU_CYCLE_CNT_VALUE_LSB 0 -#define MAC_PCU_CYCLE_CNT_VALUE_MASK 0xffffffff -#define MAC_PCU_CYCLE_CNT_VALUE_GET(x) (((x) & MAC_PCU_CYCLE_CNT_VALUE_MASK) >> MAC_PCU_CYCLE_CNT_VALUE_LSB) -#define MAC_PCU_CYCLE_CNT_VALUE_SET(x) (((x) << MAC_PCU_CYCLE_CNT_VALUE_LSB) & MAC_PCU_CYCLE_CNT_VALUE_MASK) - -#define MAC_PCU_QUIET_TIME_1_ADDRESS 0x000080a0 -#define MAC_PCU_QUIET_TIME_1_OFFSET 0x000000a0 -#define MAC_PCU_QUIET_TIME_1_ACK_CTS_ENABLE_MSB 17 -#define MAC_PCU_QUIET_TIME_1_ACK_CTS_ENABLE_LSB 17 -#define MAC_PCU_QUIET_TIME_1_ACK_CTS_ENABLE_MASK 0x00020000 -#define MAC_PCU_QUIET_TIME_1_ACK_CTS_ENABLE_GET(x) (((x) & MAC_PCU_QUIET_TIME_1_ACK_CTS_ENABLE_MASK) >> MAC_PCU_QUIET_TIME_1_ACK_CTS_ENABLE_LSB) -#define MAC_PCU_QUIET_TIME_1_ACK_CTS_ENABLE_SET(x) (((x) << MAC_PCU_QUIET_TIME_1_ACK_CTS_ENABLE_LSB) & MAC_PCU_QUIET_TIME_1_ACK_CTS_ENABLE_MASK) - -#define MAC_PCU_QUIET_TIME_2_ADDRESS 0x000080a4 -#define MAC_PCU_QUIET_TIME_2_OFFSET 0x000000a4 -#define MAC_PCU_QUIET_TIME_2_DURATION_MSB 31 -#define MAC_PCU_QUIET_TIME_2_DURATION_LSB 16 -#define MAC_PCU_QUIET_TIME_2_DURATION_MASK 0xffff0000 -#define MAC_PCU_QUIET_TIME_2_DURATION_GET(x) (((x) & MAC_PCU_QUIET_TIME_2_DURATION_MASK) >> MAC_PCU_QUIET_TIME_2_DURATION_LSB) -#define MAC_PCU_QUIET_TIME_2_DURATION_SET(x) (((x) << MAC_PCU_QUIET_TIME_2_DURATION_LSB) & MAC_PCU_QUIET_TIME_2_DURATION_MASK) - -#define MAC_PCU_QOS_NO_ACK_ADDRESS 0x000080a8 -#define MAC_PCU_QOS_NO_ACK_OFFSET 0x000000a8 -#define MAC_PCU_QOS_NO_ACK_BYTE_OFFSET_MSB 8 -#define MAC_PCU_QOS_NO_ACK_BYTE_OFFSET_LSB 7 -#define MAC_PCU_QOS_NO_ACK_BYTE_OFFSET_MASK 0x00000180 -#define MAC_PCU_QOS_NO_ACK_BYTE_OFFSET_GET(x) (((x) & MAC_PCU_QOS_NO_ACK_BYTE_OFFSET_MASK) >> MAC_PCU_QOS_NO_ACK_BYTE_OFFSET_LSB) -#define MAC_PCU_QOS_NO_ACK_BYTE_OFFSET_SET(x) (((x) << MAC_PCU_QOS_NO_ACK_BYTE_OFFSET_LSB) & MAC_PCU_QOS_NO_ACK_BYTE_OFFSET_MASK) -#define MAC_PCU_QOS_NO_ACK_BIT_OFFSET_MSB 6 -#define MAC_PCU_QOS_NO_ACK_BIT_OFFSET_LSB 4 -#define MAC_PCU_QOS_NO_ACK_BIT_OFFSET_MASK 0x00000070 -#define MAC_PCU_QOS_NO_ACK_BIT_OFFSET_GET(x) (((x) & MAC_PCU_QOS_NO_ACK_BIT_OFFSET_MASK) >> MAC_PCU_QOS_NO_ACK_BIT_OFFSET_LSB) -#define MAC_PCU_QOS_NO_ACK_BIT_OFFSET_SET(x) (((x) << MAC_PCU_QOS_NO_ACK_BIT_OFFSET_LSB) & MAC_PCU_QOS_NO_ACK_BIT_OFFSET_MASK) -#define MAC_PCU_QOS_NO_ACK_TWO_BIT_VALUES_MSB 3 -#define MAC_PCU_QOS_NO_ACK_TWO_BIT_VALUES_LSB 0 -#define MAC_PCU_QOS_NO_ACK_TWO_BIT_VALUES_MASK 0x0000000f -#define MAC_PCU_QOS_NO_ACK_TWO_BIT_VALUES_GET(x) (((x) & MAC_PCU_QOS_NO_ACK_TWO_BIT_VALUES_MASK) >> MAC_PCU_QOS_NO_ACK_TWO_BIT_VALUES_LSB) -#define MAC_PCU_QOS_NO_ACK_TWO_BIT_VALUES_SET(x) (((x) << MAC_PCU_QOS_NO_ACK_TWO_BIT_VALUES_LSB) & MAC_PCU_QOS_NO_ACK_TWO_BIT_VALUES_MASK) - -#define MAC_PCU_PHY_ERROR_MASK_ADDRESS 0x000080ac -#define MAC_PCU_PHY_ERROR_MASK_OFFSET 0x000000ac -#define MAC_PCU_PHY_ERROR_MASK_VALUE_MSB 31 -#define MAC_PCU_PHY_ERROR_MASK_VALUE_LSB 0 -#define MAC_PCU_PHY_ERROR_MASK_VALUE_MASK 0xffffffff -#define MAC_PCU_PHY_ERROR_MASK_VALUE_GET(x) (((x) & MAC_PCU_PHY_ERROR_MASK_VALUE_MASK) >> MAC_PCU_PHY_ERROR_MASK_VALUE_LSB) -#define MAC_PCU_PHY_ERROR_MASK_VALUE_SET(x) (((x) << MAC_PCU_PHY_ERROR_MASK_VALUE_LSB) & MAC_PCU_PHY_ERROR_MASK_VALUE_MASK) - -#define MAC_PCU_XRLAT_ADDRESS 0x000080b0 -#define MAC_PCU_XRLAT_OFFSET 0x000000b0 -#define MAC_PCU_XRLAT_VALUE_MSB 11 -#define MAC_PCU_XRLAT_VALUE_LSB 0 -#define MAC_PCU_XRLAT_VALUE_MASK 0x00000fff -#define MAC_PCU_XRLAT_VALUE_GET(x) (((x) & MAC_PCU_XRLAT_VALUE_MASK) >> MAC_PCU_XRLAT_VALUE_LSB) -#define MAC_PCU_XRLAT_VALUE_SET(x) (((x) << MAC_PCU_XRLAT_VALUE_LSB) & MAC_PCU_XRLAT_VALUE_MASK) - -#define MAC_PCU_RXBUF_ADDRESS 0x000080b4 -#define MAC_PCU_RXBUF_OFFSET 0x000000b4 -#define MAC_PCU_RXBUF_REG_RD_ENABLE_MSB 11 -#define MAC_PCU_RXBUF_REG_RD_ENABLE_LSB 11 -#define MAC_PCU_RXBUF_REG_RD_ENABLE_MASK 0x00000800 -#define MAC_PCU_RXBUF_REG_RD_ENABLE_GET(x) (((x) & MAC_PCU_RXBUF_REG_RD_ENABLE_MASK) >> MAC_PCU_RXBUF_REG_RD_ENABLE_LSB) -#define MAC_PCU_RXBUF_REG_RD_ENABLE_SET(x) (((x) << MAC_PCU_RXBUF_REG_RD_ENABLE_LSB) & MAC_PCU_RXBUF_REG_RD_ENABLE_MASK) -#define MAC_PCU_RXBUF_HIGH_PRIORITY_THRSHD_MSB 10 -#define MAC_PCU_RXBUF_HIGH_PRIORITY_THRSHD_LSB 0 -#define MAC_PCU_RXBUF_HIGH_PRIORITY_THRSHD_MASK 0x000007ff -#define MAC_PCU_RXBUF_HIGH_PRIORITY_THRSHD_GET(x) (((x) & MAC_PCU_RXBUF_HIGH_PRIORITY_THRSHD_MASK) >> MAC_PCU_RXBUF_HIGH_PRIORITY_THRSHD_LSB) -#define MAC_PCU_RXBUF_HIGH_PRIORITY_THRSHD_SET(x) (((x) << MAC_PCU_RXBUF_HIGH_PRIORITY_THRSHD_LSB) & MAC_PCU_RXBUF_HIGH_PRIORITY_THRSHD_MASK) - -#define MAC_PCU_MIC_QOS_CONTROL_ADDRESS 0x000080b8 -#define MAC_PCU_MIC_QOS_CONTROL_OFFSET 0x000000b8 -#define MAC_PCU_MIC_QOS_CONTROL_ENABLE_MSB 16 -#define MAC_PCU_MIC_QOS_CONTROL_ENABLE_LSB 16 -#define MAC_PCU_MIC_QOS_CONTROL_ENABLE_MASK 0x00010000 -#define MAC_PCU_MIC_QOS_CONTROL_ENABLE_GET(x) (((x) & MAC_PCU_MIC_QOS_CONTROL_ENABLE_MASK) >> MAC_PCU_MIC_QOS_CONTROL_ENABLE_LSB) -#define MAC_PCU_MIC_QOS_CONTROL_ENABLE_SET(x) (((x) << MAC_PCU_MIC_QOS_CONTROL_ENABLE_LSB) & MAC_PCU_MIC_QOS_CONTROL_ENABLE_MASK) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_7_MSB 15 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_7_LSB 14 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_7_MASK 0x0000c000 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_7_GET(x) (((x) & MAC_PCU_MIC_QOS_CONTROL_VALUE_7_MASK) >> MAC_PCU_MIC_QOS_CONTROL_VALUE_7_LSB) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_7_SET(x) (((x) << MAC_PCU_MIC_QOS_CONTROL_VALUE_7_LSB) & MAC_PCU_MIC_QOS_CONTROL_VALUE_7_MASK) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_6_MSB 13 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_6_LSB 12 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_6_MASK 0x00003000 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_6_GET(x) (((x) & MAC_PCU_MIC_QOS_CONTROL_VALUE_6_MASK) >> MAC_PCU_MIC_QOS_CONTROL_VALUE_6_LSB) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_6_SET(x) (((x) << MAC_PCU_MIC_QOS_CONTROL_VALUE_6_LSB) & MAC_PCU_MIC_QOS_CONTROL_VALUE_6_MASK) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_5_MSB 11 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_5_LSB 10 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_5_MASK 0x00000c00 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_5_GET(x) (((x) & MAC_PCU_MIC_QOS_CONTROL_VALUE_5_MASK) >> MAC_PCU_MIC_QOS_CONTROL_VALUE_5_LSB) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_5_SET(x) (((x) << MAC_PCU_MIC_QOS_CONTROL_VALUE_5_LSB) & MAC_PCU_MIC_QOS_CONTROL_VALUE_5_MASK) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_4_MSB 9 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_4_LSB 8 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_4_MASK 0x00000300 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_4_GET(x) (((x) & MAC_PCU_MIC_QOS_CONTROL_VALUE_4_MASK) >> MAC_PCU_MIC_QOS_CONTROL_VALUE_4_LSB) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_4_SET(x) (((x) << MAC_PCU_MIC_QOS_CONTROL_VALUE_4_LSB) & MAC_PCU_MIC_QOS_CONTROL_VALUE_4_MASK) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_3_MSB 7 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_3_LSB 6 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_3_MASK 0x000000c0 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_3_GET(x) (((x) & MAC_PCU_MIC_QOS_CONTROL_VALUE_3_MASK) >> MAC_PCU_MIC_QOS_CONTROL_VALUE_3_LSB) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_3_SET(x) (((x) << MAC_PCU_MIC_QOS_CONTROL_VALUE_3_LSB) & MAC_PCU_MIC_QOS_CONTROL_VALUE_3_MASK) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_2_MSB 5 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_2_LSB 4 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_2_MASK 0x00000030 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_2_GET(x) (((x) & MAC_PCU_MIC_QOS_CONTROL_VALUE_2_MASK) >> MAC_PCU_MIC_QOS_CONTROL_VALUE_2_LSB) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_2_SET(x) (((x) << MAC_PCU_MIC_QOS_CONTROL_VALUE_2_LSB) & MAC_PCU_MIC_QOS_CONTROL_VALUE_2_MASK) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_1_MSB 3 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_1_LSB 2 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_1_MASK 0x0000000c -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_1_GET(x) (((x) & MAC_PCU_MIC_QOS_CONTROL_VALUE_1_MASK) >> MAC_PCU_MIC_QOS_CONTROL_VALUE_1_LSB) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_1_SET(x) (((x) << MAC_PCU_MIC_QOS_CONTROL_VALUE_1_LSB) & MAC_PCU_MIC_QOS_CONTROL_VALUE_1_MASK) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_0_MSB 1 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_0_LSB 0 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_0_MASK 0x00000003 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_0_GET(x) (((x) & MAC_PCU_MIC_QOS_CONTROL_VALUE_0_MASK) >> MAC_PCU_MIC_QOS_CONTROL_VALUE_0_LSB) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_0_SET(x) (((x) << MAC_PCU_MIC_QOS_CONTROL_VALUE_0_LSB) & MAC_PCU_MIC_QOS_CONTROL_VALUE_0_MASK) - -#define MAC_PCU_MIC_QOS_SELECT_ADDRESS 0x000080bc -#define MAC_PCU_MIC_QOS_SELECT_OFFSET 0x000000bc -#define MAC_PCU_MIC_QOS_SELECT_VALUE_7_MSB 31 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_7_LSB 28 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_7_MASK 0xf0000000 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_7_GET(x) (((x) & MAC_PCU_MIC_QOS_SELECT_VALUE_7_MASK) >> MAC_PCU_MIC_QOS_SELECT_VALUE_7_LSB) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_7_SET(x) (((x) << MAC_PCU_MIC_QOS_SELECT_VALUE_7_LSB) & MAC_PCU_MIC_QOS_SELECT_VALUE_7_MASK) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_6_MSB 27 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_6_LSB 24 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_6_MASK 0x0f000000 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_6_GET(x) (((x) & MAC_PCU_MIC_QOS_SELECT_VALUE_6_MASK) >> MAC_PCU_MIC_QOS_SELECT_VALUE_6_LSB) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_6_SET(x) (((x) << MAC_PCU_MIC_QOS_SELECT_VALUE_6_LSB) & MAC_PCU_MIC_QOS_SELECT_VALUE_6_MASK) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_5_MSB 23 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_5_LSB 20 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_5_MASK 0x00f00000 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_5_GET(x) (((x) & MAC_PCU_MIC_QOS_SELECT_VALUE_5_MASK) >> MAC_PCU_MIC_QOS_SELECT_VALUE_5_LSB) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_5_SET(x) (((x) << MAC_PCU_MIC_QOS_SELECT_VALUE_5_LSB) & MAC_PCU_MIC_QOS_SELECT_VALUE_5_MASK) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_4_MSB 19 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_4_LSB 16 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_4_MASK 0x000f0000 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_4_GET(x) (((x) & MAC_PCU_MIC_QOS_SELECT_VALUE_4_MASK) >> MAC_PCU_MIC_QOS_SELECT_VALUE_4_LSB) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_4_SET(x) (((x) << MAC_PCU_MIC_QOS_SELECT_VALUE_4_LSB) & MAC_PCU_MIC_QOS_SELECT_VALUE_4_MASK) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_3_MSB 15 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_3_LSB 12 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_3_MASK 0x0000f000 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_3_GET(x) (((x) & MAC_PCU_MIC_QOS_SELECT_VALUE_3_MASK) >> MAC_PCU_MIC_QOS_SELECT_VALUE_3_LSB) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_3_SET(x) (((x) << MAC_PCU_MIC_QOS_SELECT_VALUE_3_LSB) & MAC_PCU_MIC_QOS_SELECT_VALUE_3_MASK) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_2_MSB 11 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_2_LSB 8 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_2_MASK 0x00000f00 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_2_GET(x) (((x) & MAC_PCU_MIC_QOS_SELECT_VALUE_2_MASK) >> MAC_PCU_MIC_QOS_SELECT_VALUE_2_LSB) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_2_SET(x) (((x) << MAC_PCU_MIC_QOS_SELECT_VALUE_2_LSB) & MAC_PCU_MIC_QOS_SELECT_VALUE_2_MASK) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_1_MSB 7 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_1_LSB 4 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_1_MASK 0x000000f0 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_1_GET(x) (((x) & MAC_PCU_MIC_QOS_SELECT_VALUE_1_MASK) >> MAC_PCU_MIC_QOS_SELECT_VALUE_1_LSB) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_1_SET(x) (((x) << MAC_PCU_MIC_QOS_SELECT_VALUE_1_LSB) & MAC_PCU_MIC_QOS_SELECT_VALUE_1_MASK) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_0_MSB 3 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_0_LSB 0 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_0_MASK 0x0000000f -#define MAC_PCU_MIC_QOS_SELECT_VALUE_0_GET(x) (((x) & MAC_PCU_MIC_QOS_SELECT_VALUE_0_MASK) >> MAC_PCU_MIC_QOS_SELECT_VALUE_0_LSB) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_0_SET(x) (((x) << MAC_PCU_MIC_QOS_SELECT_VALUE_0_LSB) & MAC_PCU_MIC_QOS_SELECT_VALUE_0_MASK) - -#define MAC_PCU_MISC_MODE_ADDRESS 0x000080c0 -#define MAC_PCU_MISC_MODE_OFFSET 0x000000c0 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_MSB 31 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_LSB 30 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_MASK 0xc0000000 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_GET(x) (((x) & MAC_PCU_MISC_MODE_DEBUG_MODE_MASK) >> MAC_PCU_MISC_MODE_DEBUG_MODE_LSB) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_SET(x) (((x) << MAC_PCU_MISC_MODE_DEBUG_MODE_LSB) & MAC_PCU_MISC_MODE_DEBUG_MODE_MASK) -#define MAC_PCU_MISC_MODE_USE_EOP_PTR_FOR_DMA_WR_MSB 29 -#define MAC_PCU_MISC_MODE_USE_EOP_PTR_FOR_DMA_WR_LSB 29 -#define MAC_PCU_MISC_MODE_USE_EOP_PTR_FOR_DMA_WR_MASK 0x20000000 -#define MAC_PCU_MISC_MODE_USE_EOP_PTR_FOR_DMA_WR_GET(x) (((x) & MAC_PCU_MISC_MODE_USE_EOP_PTR_FOR_DMA_WR_MASK) >> MAC_PCU_MISC_MODE_USE_EOP_PTR_FOR_DMA_WR_LSB) -#define MAC_PCU_MISC_MODE_USE_EOP_PTR_FOR_DMA_WR_SET(x) (((x) << MAC_PCU_MISC_MODE_USE_EOP_PTR_FOR_DMA_WR_LSB) & MAC_PCU_MISC_MODE_USE_EOP_PTR_FOR_DMA_WR_MASK) -#define MAC_PCU_MISC_MODE_ALWAYS_PERFORM_KEY_SEARCH_MSB 28 -#define MAC_PCU_MISC_MODE_ALWAYS_PERFORM_KEY_SEARCH_LSB 28 -#define MAC_PCU_MISC_MODE_ALWAYS_PERFORM_KEY_SEARCH_MASK 0x10000000 -#define MAC_PCU_MISC_MODE_ALWAYS_PERFORM_KEY_SEARCH_GET(x) (((x) & MAC_PCU_MISC_MODE_ALWAYS_PERFORM_KEY_SEARCH_MASK) >> MAC_PCU_MISC_MODE_ALWAYS_PERFORM_KEY_SEARCH_LSB) -#define MAC_PCU_MISC_MODE_ALWAYS_PERFORM_KEY_SEARCH_SET(x) (((x) << MAC_PCU_MISC_MODE_ALWAYS_PERFORM_KEY_SEARCH_LSB) & MAC_PCU_MISC_MODE_ALWAYS_PERFORM_KEY_SEARCH_MASK) -#define MAC_PCU_MISC_MODE_SEL_EVM_MSB 27 -#define MAC_PCU_MISC_MODE_SEL_EVM_LSB 27 -#define MAC_PCU_MISC_MODE_SEL_EVM_MASK 0x08000000 -#define MAC_PCU_MISC_MODE_SEL_EVM_GET(x) (((x) & MAC_PCU_MISC_MODE_SEL_EVM_MASK) >> MAC_PCU_MISC_MODE_SEL_EVM_LSB) -#define MAC_PCU_MISC_MODE_SEL_EVM_SET(x) (((x) << MAC_PCU_MISC_MODE_SEL_EVM_LSB) & MAC_PCU_MISC_MODE_SEL_EVM_MASK) -#define MAC_PCU_MISC_MODE_CLEAR_BA_VALID_MSB 26 -#define MAC_PCU_MISC_MODE_CLEAR_BA_VALID_LSB 26 -#define MAC_PCU_MISC_MODE_CLEAR_BA_VALID_MASK 0x04000000 -#define MAC_PCU_MISC_MODE_CLEAR_BA_VALID_GET(x) (((x) & MAC_PCU_MISC_MODE_CLEAR_BA_VALID_MASK) >> MAC_PCU_MISC_MODE_CLEAR_BA_VALID_LSB) -#define MAC_PCU_MISC_MODE_CLEAR_BA_VALID_SET(x) (((x) << MAC_PCU_MISC_MODE_CLEAR_BA_VALID_LSB) & MAC_PCU_MISC_MODE_CLEAR_BA_VALID_MASK) -#define MAC_PCU_MISC_MODE_CLEAR_FIRST_HCF_MSB 25 -#define MAC_PCU_MISC_MODE_CLEAR_FIRST_HCF_LSB 25 -#define MAC_PCU_MISC_MODE_CLEAR_FIRST_HCF_MASK 0x02000000 -#define MAC_PCU_MISC_MODE_CLEAR_FIRST_HCF_GET(x) (((x) & MAC_PCU_MISC_MODE_CLEAR_FIRST_HCF_MASK) >> MAC_PCU_MISC_MODE_CLEAR_FIRST_HCF_LSB) -#define MAC_PCU_MISC_MODE_CLEAR_FIRST_HCF_SET(x) (((x) << MAC_PCU_MISC_MODE_CLEAR_FIRST_HCF_LSB) & MAC_PCU_MISC_MODE_CLEAR_FIRST_HCF_MASK) -#define MAC_PCU_MISC_MODE_CLEAR_VMF_MSB 24 -#define MAC_PCU_MISC_MODE_CLEAR_VMF_LSB 24 -#define MAC_PCU_MISC_MODE_CLEAR_VMF_MASK 0x01000000 -#define MAC_PCU_MISC_MODE_CLEAR_VMF_GET(x) (((x) & MAC_PCU_MISC_MODE_CLEAR_VMF_MASK) >> MAC_PCU_MISC_MODE_CLEAR_VMF_LSB) -#define MAC_PCU_MISC_MODE_CLEAR_VMF_SET(x) (((x) << MAC_PCU_MISC_MODE_CLEAR_VMF_LSB) & MAC_PCU_MISC_MODE_CLEAR_VMF_MASK) -#define MAC_PCU_MISC_MODE_RX_HCF_POLL_ENABLE_MSB 23 -#define MAC_PCU_MISC_MODE_RX_HCF_POLL_ENABLE_LSB 23 -#define MAC_PCU_MISC_MODE_RX_HCF_POLL_ENABLE_MASK 0x00800000 -#define MAC_PCU_MISC_MODE_RX_HCF_POLL_ENABLE_GET(x) (((x) & MAC_PCU_MISC_MODE_RX_HCF_POLL_ENABLE_MASK) >> MAC_PCU_MISC_MODE_RX_HCF_POLL_ENABLE_LSB) -#define MAC_PCU_MISC_MODE_RX_HCF_POLL_ENABLE_SET(x) (((x) << MAC_PCU_MISC_MODE_RX_HCF_POLL_ENABLE_LSB) & MAC_PCU_MISC_MODE_RX_HCF_POLL_ENABLE_MASK) -#define MAC_PCU_MISC_MODE_HCF_POLL_CANCELS_NAV_MSB 22 -#define MAC_PCU_MISC_MODE_HCF_POLL_CANCELS_NAV_LSB 22 -#define MAC_PCU_MISC_MODE_HCF_POLL_CANCELS_NAV_MASK 0x00400000 -#define MAC_PCU_MISC_MODE_HCF_POLL_CANCELS_NAV_GET(x) (((x) & MAC_PCU_MISC_MODE_HCF_POLL_CANCELS_NAV_MASK) >> MAC_PCU_MISC_MODE_HCF_POLL_CANCELS_NAV_LSB) -#define MAC_PCU_MISC_MODE_HCF_POLL_CANCELS_NAV_SET(x) (((x) << MAC_PCU_MISC_MODE_HCF_POLL_CANCELS_NAV_LSB) & MAC_PCU_MISC_MODE_HCF_POLL_CANCELS_NAV_MASK) -#define MAC_PCU_MISC_MODE_TBTT_PROTECT_MSB 21 -#define MAC_PCU_MISC_MODE_TBTT_PROTECT_LSB 21 -#define MAC_PCU_MISC_MODE_TBTT_PROTECT_MASK 0x00200000 -#define MAC_PCU_MISC_MODE_TBTT_PROTECT_GET(x) (((x) & MAC_PCU_MISC_MODE_TBTT_PROTECT_MASK) >> MAC_PCU_MISC_MODE_TBTT_PROTECT_LSB) -#define MAC_PCU_MISC_MODE_TBTT_PROTECT_SET(x) (((x) << MAC_PCU_MISC_MODE_TBTT_PROTECT_LSB) & MAC_PCU_MISC_MODE_TBTT_PROTECT_MASK) -#define MAC_PCU_MISC_MODE_BT_ANT_PREVENTS_RX_MSB 20 -#define MAC_PCU_MISC_MODE_BT_ANT_PREVENTS_RX_LSB 20 -#define MAC_PCU_MISC_MODE_BT_ANT_PREVENTS_RX_MASK 0x00100000 -#define MAC_PCU_MISC_MODE_BT_ANT_PREVENTS_RX_GET(x) (((x) & MAC_PCU_MISC_MODE_BT_ANT_PREVENTS_RX_MASK) >> MAC_PCU_MISC_MODE_BT_ANT_PREVENTS_RX_LSB) -#define MAC_PCU_MISC_MODE_BT_ANT_PREVENTS_RX_SET(x) (((x) << MAC_PCU_MISC_MODE_BT_ANT_PREVENTS_RX_LSB) & MAC_PCU_MISC_MODE_BT_ANT_PREVENTS_RX_MASK) -#define MAC_PCU_MISC_MODE_FORCE_QUIET_COLLISION_MSB 18 -#define MAC_PCU_MISC_MODE_FORCE_QUIET_COLLISION_LSB 18 -#define MAC_PCU_MISC_MODE_FORCE_QUIET_COLLISION_MASK 0x00040000 -#define MAC_PCU_MISC_MODE_FORCE_QUIET_COLLISION_GET(x) (((x) & MAC_PCU_MISC_MODE_FORCE_QUIET_COLLISION_MASK) >> MAC_PCU_MISC_MODE_FORCE_QUIET_COLLISION_LSB) -#define MAC_PCU_MISC_MODE_FORCE_QUIET_COLLISION_SET(x) (((x) << MAC_PCU_MISC_MODE_FORCE_QUIET_COLLISION_LSB) & MAC_PCU_MISC_MODE_FORCE_QUIET_COLLISION_MASK) -#define MAC_PCU_MISC_MODE_MISS_BEACON_IN_SLEEP_MSB 14 -#define MAC_PCU_MISC_MODE_MISS_BEACON_IN_SLEEP_LSB 14 -#define MAC_PCU_MISC_MODE_MISS_BEACON_IN_SLEEP_MASK 0x00004000 -#define MAC_PCU_MISC_MODE_MISS_BEACON_IN_SLEEP_GET(x) (((x) & MAC_PCU_MISC_MODE_MISS_BEACON_IN_SLEEP_MASK) >> MAC_PCU_MISC_MODE_MISS_BEACON_IN_SLEEP_LSB) -#define MAC_PCU_MISC_MODE_MISS_BEACON_IN_SLEEP_SET(x) (((x) << MAC_PCU_MISC_MODE_MISS_BEACON_IN_SLEEP_LSB) & MAC_PCU_MISC_MODE_MISS_BEACON_IN_SLEEP_MASK) -#define MAC_PCU_MISC_MODE_TXOP_TBTT_LIMIT_ENABLE_MSB 12 -#define MAC_PCU_MISC_MODE_TXOP_TBTT_LIMIT_ENABLE_LSB 12 -#define MAC_PCU_MISC_MODE_TXOP_TBTT_LIMIT_ENABLE_MASK 0x00001000 -#define MAC_PCU_MISC_MODE_TXOP_TBTT_LIMIT_ENABLE_GET(x) (((x) & MAC_PCU_MISC_MODE_TXOP_TBTT_LIMIT_ENABLE_MASK) >> MAC_PCU_MISC_MODE_TXOP_TBTT_LIMIT_ENABLE_LSB) -#define MAC_PCU_MISC_MODE_TXOP_TBTT_LIMIT_ENABLE_SET(x) (((x) << MAC_PCU_MISC_MODE_TXOP_TBTT_LIMIT_ENABLE_LSB) & MAC_PCU_MISC_MODE_TXOP_TBTT_LIMIT_ENABLE_MASK) -#define MAC_PCU_MISC_MODE_KC_RX_ANT_UPDATE_MSB 11 -#define MAC_PCU_MISC_MODE_KC_RX_ANT_UPDATE_LSB 11 -#define MAC_PCU_MISC_MODE_KC_RX_ANT_UPDATE_MASK 0x00000800 -#define MAC_PCU_MISC_MODE_KC_RX_ANT_UPDATE_GET(x) (((x) & MAC_PCU_MISC_MODE_KC_RX_ANT_UPDATE_MASK) >> MAC_PCU_MISC_MODE_KC_RX_ANT_UPDATE_LSB) -#define MAC_PCU_MISC_MODE_KC_RX_ANT_UPDATE_SET(x) (((x) << MAC_PCU_MISC_MODE_KC_RX_ANT_UPDATE_LSB) & MAC_PCU_MISC_MODE_KC_RX_ANT_UPDATE_MASK) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_SIFS_MSB 10 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_SIFS_LSB 10 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_SIFS_MASK 0x00000400 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_SIFS_GET(x) (((x) & MAC_PCU_MISC_MODE_DEBUG_MODE_SIFS_MASK) >> MAC_PCU_MISC_MODE_DEBUG_MODE_SIFS_LSB) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_SIFS_SET(x) (((x) << MAC_PCU_MISC_MODE_DEBUG_MODE_SIFS_LSB) & MAC_PCU_MISC_MODE_DEBUG_MODE_SIFS_MASK) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_BA_BITMAP_MSB 9 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_BA_BITMAP_LSB 9 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_BA_BITMAP_MASK 0x00000200 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_BA_BITMAP_GET(x) (((x) & MAC_PCU_MISC_MODE_DEBUG_MODE_BA_BITMAP_MASK) >> MAC_PCU_MISC_MODE_DEBUG_MODE_BA_BITMAP_LSB) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_BA_BITMAP_SET(x) (((x) << MAC_PCU_MISC_MODE_DEBUG_MODE_BA_BITMAP_LSB) & MAC_PCU_MISC_MODE_DEBUG_MODE_BA_BITMAP_MASK) -#define MAC_PCU_MISC_MODE_CCK_SIFS_MODE_MSB 4 -#define MAC_PCU_MISC_MODE_CCK_SIFS_MODE_LSB 4 -#define MAC_PCU_MISC_MODE_CCK_SIFS_MODE_MASK 0x00000010 -#define MAC_PCU_MISC_MODE_CCK_SIFS_MODE_GET(x) (((x) & MAC_PCU_MISC_MODE_CCK_SIFS_MODE_MASK) >> MAC_PCU_MISC_MODE_CCK_SIFS_MODE_LSB) -#define MAC_PCU_MISC_MODE_CCK_SIFS_MODE_SET(x) (((x) << MAC_PCU_MISC_MODE_CCK_SIFS_MODE_LSB) & MAC_PCU_MISC_MODE_CCK_SIFS_MODE_MASK) -#define MAC_PCU_MISC_MODE_TX_ADD_TSF_MSB 3 -#define MAC_PCU_MISC_MODE_TX_ADD_TSF_LSB 3 -#define MAC_PCU_MISC_MODE_TX_ADD_TSF_MASK 0x00000008 -#define MAC_PCU_MISC_MODE_TX_ADD_TSF_GET(x) (((x) & MAC_PCU_MISC_MODE_TX_ADD_TSF_MASK) >> MAC_PCU_MISC_MODE_TX_ADD_TSF_LSB) -#define MAC_PCU_MISC_MODE_TX_ADD_TSF_SET(x) (((x) << MAC_PCU_MISC_MODE_TX_ADD_TSF_LSB) & MAC_PCU_MISC_MODE_TX_ADD_TSF_MASK) -#define MAC_PCU_MISC_MODE_MIC_NEW_LOCATION_ENABLE_MSB 2 -#define MAC_PCU_MISC_MODE_MIC_NEW_LOCATION_ENABLE_LSB 2 -#define MAC_PCU_MISC_MODE_MIC_NEW_LOCATION_ENABLE_MASK 0x00000004 -#define MAC_PCU_MISC_MODE_MIC_NEW_LOCATION_ENABLE_GET(x) (((x) & MAC_PCU_MISC_MODE_MIC_NEW_LOCATION_ENABLE_MASK) >> MAC_PCU_MISC_MODE_MIC_NEW_LOCATION_ENABLE_LSB) -#define MAC_PCU_MISC_MODE_MIC_NEW_LOCATION_ENABLE_SET(x) (((x) << MAC_PCU_MISC_MODE_MIC_NEW_LOCATION_ENABLE_LSB) & MAC_PCU_MISC_MODE_MIC_NEW_LOCATION_ENABLE_MASK) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_AD_MSB 1 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_AD_LSB 1 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_AD_MASK 0x00000002 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_AD_GET(x) (((x) & MAC_PCU_MISC_MODE_DEBUG_MODE_AD_MASK) >> MAC_PCU_MISC_MODE_DEBUG_MODE_AD_LSB) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_AD_SET(x) (((x) << MAC_PCU_MISC_MODE_DEBUG_MODE_AD_LSB) & MAC_PCU_MISC_MODE_DEBUG_MODE_AD_MASK) -#define MAC_PCU_MISC_MODE_BSSID_MATCH_FORCE_MSB 0 -#define MAC_PCU_MISC_MODE_BSSID_MATCH_FORCE_LSB 0 -#define MAC_PCU_MISC_MODE_BSSID_MATCH_FORCE_MASK 0x00000001 -#define MAC_PCU_MISC_MODE_BSSID_MATCH_FORCE_GET(x) (((x) & MAC_PCU_MISC_MODE_BSSID_MATCH_FORCE_MASK) >> MAC_PCU_MISC_MODE_BSSID_MATCH_FORCE_LSB) -#define MAC_PCU_MISC_MODE_BSSID_MATCH_FORCE_SET(x) (((x) << MAC_PCU_MISC_MODE_BSSID_MATCH_FORCE_LSB) & MAC_PCU_MISC_MODE_BSSID_MATCH_FORCE_MASK) - -#define MAC_PCU_FILTER_OFDM_CNT_ADDRESS 0x000080c4 -#define MAC_PCU_FILTER_OFDM_CNT_OFFSET 0x000000c4 -#define MAC_PCU_FILTER_OFDM_CNT_VALUE_MSB 23 -#define MAC_PCU_FILTER_OFDM_CNT_VALUE_LSB 0 -#define MAC_PCU_FILTER_OFDM_CNT_VALUE_MASK 0x00ffffff -#define MAC_PCU_FILTER_OFDM_CNT_VALUE_GET(x) (((x) & MAC_PCU_FILTER_OFDM_CNT_VALUE_MASK) >> MAC_PCU_FILTER_OFDM_CNT_VALUE_LSB) -#define MAC_PCU_FILTER_OFDM_CNT_VALUE_SET(x) (((x) << MAC_PCU_FILTER_OFDM_CNT_VALUE_LSB) & MAC_PCU_FILTER_OFDM_CNT_VALUE_MASK) - -#define MAC_PCU_FILTER_CCK_CNT_ADDRESS 0x000080c8 -#define MAC_PCU_FILTER_CCK_CNT_OFFSET 0x000000c8 -#define MAC_PCU_FILTER_CCK_CNT_VALUE_MSB 23 -#define MAC_PCU_FILTER_CCK_CNT_VALUE_LSB 0 -#define MAC_PCU_FILTER_CCK_CNT_VALUE_MASK 0x00ffffff -#define MAC_PCU_FILTER_CCK_CNT_VALUE_GET(x) (((x) & MAC_PCU_FILTER_CCK_CNT_VALUE_MASK) >> MAC_PCU_FILTER_CCK_CNT_VALUE_LSB) -#define MAC_PCU_FILTER_CCK_CNT_VALUE_SET(x) (((x) << MAC_PCU_FILTER_CCK_CNT_VALUE_LSB) & MAC_PCU_FILTER_CCK_CNT_VALUE_MASK) - -#define MAC_PCU_PHY_ERR_CNT_1_ADDRESS 0x000080cc -#define MAC_PCU_PHY_ERR_CNT_1_OFFSET 0x000000cc -#define MAC_PCU_PHY_ERR_CNT_1_VALUE_MSB 23 -#define MAC_PCU_PHY_ERR_CNT_1_VALUE_LSB 0 -#define MAC_PCU_PHY_ERR_CNT_1_VALUE_MASK 0x00ffffff -#define MAC_PCU_PHY_ERR_CNT_1_VALUE_GET(x) (((x) & MAC_PCU_PHY_ERR_CNT_1_VALUE_MASK) >> MAC_PCU_PHY_ERR_CNT_1_VALUE_LSB) -#define MAC_PCU_PHY_ERR_CNT_1_VALUE_SET(x) (((x) << MAC_PCU_PHY_ERR_CNT_1_VALUE_LSB) & MAC_PCU_PHY_ERR_CNT_1_VALUE_MASK) - -#define MAC_PCU_PHY_ERR_CNT_1_MASK_ADDRESS 0x000080d0 -#define MAC_PCU_PHY_ERR_CNT_1_MASK_OFFSET 0x000000d0 -#define MAC_PCU_PHY_ERR_CNT_1_MASK_VALUE_MSB 31 -#define MAC_PCU_PHY_ERR_CNT_1_MASK_VALUE_LSB 0 -#define MAC_PCU_PHY_ERR_CNT_1_MASK_VALUE_MASK 0xffffffff -#define MAC_PCU_PHY_ERR_CNT_1_MASK_VALUE_GET(x) (((x) & MAC_PCU_PHY_ERR_CNT_1_MASK_VALUE_MASK) >> MAC_PCU_PHY_ERR_CNT_1_MASK_VALUE_LSB) -#define MAC_PCU_PHY_ERR_CNT_1_MASK_VALUE_SET(x) (((x) << MAC_PCU_PHY_ERR_CNT_1_MASK_VALUE_LSB) & MAC_PCU_PHY_ERR_CNT_1_MASK_VALUE_MASK) - -#define MAC_PCU_PHY_ERR_CNT_2_ADDRESS 0x000080d4 -#define MAC_PCU_PHY_ERR_CNT_2_OFFSET 0x000000d4 -#define MAC_PCU_PHY_ERR_CNT_2_VALUE_MSB 23 -#define MAC_PCU_PHY_ERR_CNT_2_VALUE_LSB 0 -#define MAC_PCU_PHY_ERR_CNT_2_VALUE_MASK 0x00ffffff -#define MAC_PCU_PHY_ERR_CNT_2_VALUE_GET(x) (((x) & MAC_PCU_PHY_ERR_CNT_2_VALUE_MASK) >> MAC_PCU_PHY_ERR_CNT_2_VALUE_LSB) -#define MAC_PCU_PHY_ERR_CNT_2_VALUE_SET(x) (((x) << MAC_PCU_PHY_ERR_CNT_2_VALUE_LSB) & MAC_PCU_PHY_ERR_CNT_2_VALUE_MASK) - -#define MAC_PCU_PHY_ERR_CNT_2_MASK_ADDRESS 0x000080d8 -#define MAC_PCU_PHY_ERR_CNT_2_MASK_OFFSET 0x000000d8 -#define MAC_PCU_PHY_ERR_CNT_2_MASK_VALUE_MSB 31 -#define MAC_PCU_PHY_ERR_CNT_2_MASK_VALUE_LSB 0 -#define MAC_PCU_PHY_ERR_CNT_2_MASK_VALUE_MASK 0xffffffff -#define MAC_PCU_PHY_ERR_CNT_2_MASK_VALUE_GET(x) (((x) & MAC_PCU_PHY_ERR_CNT_2_MASK_VALUE_MASK) >> MAC_PCU_PHY_ERR_CNT_2_MASK_VALUE_LSB) -#define MAC_PCU_PHY_ERR_CNT_2_MASK_VALUE_SET(x) (((x) << MAC_PCU_PHY_ERR_CNT_2_MASK_VALUE_LSB) & MAC_PCU_PHY_ERR_CNT_2_MASK_VALUE_MASK) - -#define MAC_PCU_TSF_THRESHOLD_ADDRESS 0x000080dc -#define MAC_PCU_TSF_THRESHOLD_OFFSET 0x000000dc -#define MAC_PCU_TSF_THRESHOLD_VALUE_MSB 15 -#define MAC_PCU_TSF_THRESHOLD_VALUE_LSB 0 -#define MAC_PCU_TSF_THRESHOLD_VALUE_MASK 0x0000ffff -#define MAC_PCU_TSF_THRESHOLD_VALUE_GET(x) (((x) & MAC_PCU_TSF_THRESHOLD_VALUE_MASK) >> MAC_PCU_TSF_THRESHOLD_VALUE_LSB) -#define MAC_PCU_TSF_THRESHOLD_VALUE_SET(x) (((x) << MAC_PCU_TSF_THRESHOLD_VALUE_LSB) & MAC_PCU_TSF_THRESHOLD_VALUE_MASK) - -#define MAC_PCU_PHY_ERROR_EIFS_MASK_ADDRESS 0x000080e0 -#define MAC_PCU_PHY_ERROR_EIFS_MASK_OFFSET 0x000000e0 -#define MAC_PCU_PHY_ERROR_EIFS_MASK_VALUE_MSB 31 -#define MAC_PCU_PHY_ERROR_EIFS_MASK_VALUE_LSB 0 -#define MAC_PCU_PHY_ERROR_EIFS_MASK_VALUE_MASK 0xffffffff -#define MAC_PCU_PHY_ERROR_EIFS_MASK_VALUE_GET(x) (((x) & MAC_PCU_PHY_ERROR_EIFS_MASK_VALUE_MASK) >> MAC_PCU_PHY_ERROR_EIFS_MASK_VALUE_LSB) -#define MAC_PCU_PHY_ERROR_EIFS_MASK_VALUE_SET(x) (((x) << MAC_PCU_PHY_ERROR_EIFS_MASK_VALUE_LSB) & MAC_PCU_PHY_ERROR_EIFS_MASK_VALUE_MASK) - -#define MAC_PCU_PHY_ERR_CNT_3_ADDRESS 0x000080e4 -#define MAC_PCU_PHY_ERR_CNT_3_OFFSET 0x000000e4 -#define MAC_PCU_PHY_ERR_CNT_3_VALUE_MSB 23 -#define MAC_PCU_PHY_ERR_CNT_3_VALUE_LSB 0 -#define MAC_PCU_PHY_ERR_CNT_3_VALUE_MASK 0x00ffffff -#define MAC_PCU_PHY_ERR_CNT_3_VALUE_GET(x) (((x) & MAC_PCU_PHY_ERR_CNT_3_VALUE_MASK) >> MAC_PCU_PHY_ERR_CNT_3_VALUE_LSB) -#define MAC_PCU_PHY_ERR_CNT_3_VALUE_SET(x) (((x) << MAC_PCU_PHY_ERR_CNT_3_VALUE_LSB) & MAC_PCU_PHY_ERR_CNT_3_VALUE_MASK) - -#define MAC_PCU_PHY_ERR_CNT_3_MASK_ADDRESS 0x000080e8 -#define MAC_PCU_PHY_ERR_CNT_3_MASK_OFFSET 0x000000e8 -#define MAC_PCU_PHY_ERR_CNT_3_MASK_VALUE_MSB 31 -#define MAC_PCU_PHY_ERR_CNT_3_MASK_VALUE_LSB 0 -#define MAC_PCU_PHY_ERR_CNT_3_MASK_VALUE_MASK 0xffffffff -#define MAC_PCU_PHY_ERR_CNT_3_MASK_VALUE_GET(x) (((x) & MAC_PCU_PHY_ERR_CNT_3_MASK_VALUE_MASK) >> MAC_PCU_PHY_ERR_CNT_3_MASK_VALUE_LSB) -#define MAC_PCU_PHY_ERR_CNT_3_MASK_VALUE_SET(x) (((x) << MAC_PCU_PHY_ERR_CNT_3_MASK_VALUE_LSB) & MAC_PCU_PHY_ERR_CNT_3_MASK_VALUE_MASK) - -#define MAC_PCU_BLUETOOTH_MODE_ADDRESS 0x000080ec -#define MAC_PCU_BLUETOOTH_MODE_OFFSET 0x000000ec -#define MAC_PCU_BLUETOOTH_MODE_FIRST_SLOT_TIME_MSB 31 -#define MAC_PCU_BLUETOOTH_MODE_FIRST_SLOT_TIME_LSB 24 -#define MAC_PCU_BLUETOOTH_MODE_FIRST_SLOT_TIME_MASK 0xff000000 -#define MAC_PCU_BLUETOOTH_MODE_FIRST_SLOT_TIME_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE_FIRST_SLOT_TIME_MASK) >> MAC_PCU_BLUETOOTH_MODE_FIRST_SLOT_TIME_LSB) -#define MAC_PCU_BLUETOOTH_MODE_FIRST_SLOT_TIME_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE_FIRST_SLOT_TIME_LSB) & MAC_PCU_BLUETOOTH_MODE_FIRST_SLOT_TIME_MASK) -#define MAC_PCU_BLUETOOTH_MODE_PRIORITY_TIME_MSB 23 -#define MAC_PCU_BLUETOOTH_MODE_PRIORITY_TIME_LSB 18 -#define MAC_PCU_BLUETOOTH_MODE_PRIORITY_TIME_MASK 0x00fc0000 -#define MAC_PCU_BLUETOOTH_MODE_PRIORITY_TIME_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE_PRIORITY_TIME_MASK) >> MAC_PCU_BLUETOOTH_MODE_PRIORITY_TIME_LSB) -#define MAC_PCU_BLUETOOTH_MODE_PRIORITY_TIME_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE_PRIORITY_TIME_LSB) & MAC_PCU_BLUETOOTH_MODE_PRIORITY_TIME_MASK) -#define MAC_PCU_BLUETOOTH_MODE_RX_CLEAR_POLARITY_MSB 17 -#define MAC_PCU_BLUETOOTH_MODE_RX_CLEAR_POLARITY_LSB 17 -#define MAC_PCU_BLUETOOTH_MODE_RX_CLEAR_POLARITY_MASK 0x00020000 -#define MAC_PCU_BLUETOOTH_MODE_RX_CLEAR_POLARITY_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE_RX_CLEAR_POLARITY_MASK) >> MAC_PCU_BLUETOOTH_MODE_RX_CLEAR_POLARITY_LSB) -#define MAC_PCU_BLUETOOTH_MODE_RX_CLEAR_POLARITY_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE_RX_CLEAR_POLARITY_LSB) & MAC_PCU_BLUETOOTH_MODE_RX_CLEAR_POLARITY_MASK) -#define MAC_PCU_BLUETOOTH_MODE_QCU_THRESH_MSB 16 -#define MAC_PCU_BLUETOOTH_MODE_QCU_THRESH_LSB 13 -#define MAC_PCU_BLUETOOTH_MODE_QCU_THRESH_MASK 0x0001e000 -#define MAC_PCU_BLUETOOTH_MODE_QCU_THRESH_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE_QCU_THRESH_MASK) >> MAC_PCU_BLUETOOTH_MODE_QCU_THRESH_LSB) -#define MAC_PCU_BLUETOOTH_MODE_QCU_THRESH_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE_QCU_THRESH_LSB) & MAC_PCU_BLUETOOTH_MODE_QCU_THRESH_MASK) -#define MAC_PCU_BLUETOOTH_MODE_QUIET_MSB 12 -#define MAC_PCU_BLUETOOTH_MODE_QUIET_LSB 12 -#define MAC_PCU_BLUETOOTH_MODE_QUIET_MASK 0x00001000 -#define MAC_PCU_BLUETOOTH_MODE_QUIET_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE_QUIET_MASK) >> MAC_PCU_BLUETOOTH_MODE_QUIET_LSB) -#define MAC_PCU_BLUETOOTH_MODE_QUIET_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE_QUIET_LSB) & MAC_PCU_BLUETOOTH_MODE_QUIET_MASK) -#define MAC_PCU_BLUETOOTH_MODE_MODE_MSB 11 -#define MAC_PCU_BLUETOOTH_MODE_MODE_LSB 10 -#define MAC_PCU_BLUETOOTH_MODE_MODE_MASK 0x00000c00 -#define MAC_PCU_BLUETOOTH_MODE_MODE_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE_MODE_MASK) >> MAC_PCU_BLUETOOTH_MODE_MODE_LSB) -#define MAC_PCU_BLUETOOTH_MODE_MODE_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE_MODE_LSB) & MAC_PCU_BLUETOOTH_MODE_MODE_MASK) -#define MAC_PCU_BLUETOOTH_MODE_TX_FRAME_EXTEND_MSB 9 -#define MAC_PCU_BLUETOOTH_MODE_TX_FRAME_EXTEND_LSB 9 -#define MAC_PCU_BLUETOOTH_MODE_TX_FRAME_EXTEND_MASK 0x00000200 -#define MAC_PCU_BLUETOOTH_MODE_TX_FRAME_EXTEND_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE_TX_FRAME_EXTEND_MASK) >> MAC_PCU_BLUETOOTH_MODE_TX_FRAME_EXTEND_LSB) -#define MAC_PCU_BLUETOOTH_MODE_TX_FRAME_EXTEND_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE_TX_FRAME_EXTEND_LSB) & MAC_PCU_BLUETOOTH_MODE_TX_FRAME_EXTEND_MASK) -#define MAC_PCU_BLUETOOTH_MODE_TX_STATE_EXTEND_MSB 8 -#define MAC_PCU_BLUETOOTH_MODE_TX_STATE_EXTEND_LSB 8 -#define MAC_PCU_BLUETOOTH_MODE_TX_STATE_EXTEND_MASK 0x00000100 -#define MAC_PCU_BLUETOOTH_MODE_TX_STATE_EXTEND_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE_TX_STATE_EXTEND_MASK) >> MAC_PCU_BLUETOOTH_MODE_TX_STATE_EXTEND_LSB) -#define MAC_PCU_BLUETOOTH_MODE_TX_STATE_EXTEND_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE_TX_STATE_EXTEND_LSB) & MAC_PCU_BLUETOOTH_MODE_TX_STATE_EXTEND_MASK) -#define MAC_PCU_BLUETOOTH_MODE_TIME_EXTEND_MSB 7 -#define MAC_PCU_BLUETOOTH_MODE_TIME_EXTEND_LSB 0 -#define MAC_PCU_BLUETOOTH_MODE_TIME_EXTEND_MASK 0x000000ff -#define MAC_PCU_BLUETOOTH_MODE_TIME_EXTEND_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE_TIME_EXTEND_MASK) >> MAC_PCU_BLUETOOTH_MODE_TIME_EXTEND_LSB) -#define MAC_PCU_BLUETOOTH_MODE_TIME_EXTEND_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE_TIME_EXTEND_LSB) & MAC_PCU_BLUETOOTH_MODE_TIME_EXTEND_MASK) - -#define MAC_PCU_BLUETOOTH_WEIGHTS_ADDRESS 0x000080f0 -#define MAC_PCU_BLUETOOTH_WEIGHTS_OFFSET 0x000000f0 -#define MAC_PCU_BLUETOOTH_WEIGHTS_WL_WEIGHT_MSB 31 -#define MAC_PCU_BLUETOOTH_WEIGHTS_WL_WEIGHT_LSB 16 -#define MAC_PCU_BLUETOOTH_WEIGHTS_WL_WEIGHT_MASK 0xffff0000 -#define MAC_PCU_BLUETOOTH_WEIGHTS_WL_WEIGHT_GET(x) (((x) & MAC_PCU_BLUETOOTH_WEIGHTS_WL_WEIGHT_MASK) >> MAC_PCU_BLUETOOTH_WEIGHTS_WL_WEIGHT_LSB) -#define MAC_PCU_BLUETOOTH_WEIGHTS_WL_WEIGHT_SET(x) (((x) << MAC_PCU_BLUETOOTH_WEIGHTS_WL_WEIGHT_LSB) & MAC_PCU_BLUETOOTH_WEIGHTS_WL_WEIGHT_MASK) -#define MAC_PCU_BLUETOOTH_WEIGHTS_BT_WEIGHT_MSB 15 -#define MAC_PCU_BLUETOOTH_WEIGHTS_BT_WEIGHT_LSB 0 -#define MAC_PCU_BLUETOOTH_WEIGHTS_BT_WEIGHT_MASK 0x0000ffff -#define MAC_PCU_BLUETOOTH_WEIGHTS_BT_WEIGHT_GET(x) (((x) & MAC_PCU_BLUETOOTH_WEIGHTS_BT_WEIGHT_MASK) >> MAC_PCU_BLUETOOTH_WEIGHTS_BT_WEIGHT_LSB) -#define MAC_PCU_BLUETOOTH_WEIGHTS_BT_WEIGHT_SET(x) (((x) << MAC_PCU_BLUETOOTH_WEIGHTS_BT_WEIGHT_LSB) & MAC_PCU_BLUETOOTH_WEIGHTS_BT_WEIGHT_MASK) - -#define MAC_PCU_BLUETOOTH_MODE2_ADDRESS 0x000080f4 -#define MAC_PCU_BLUETOOTH_MODE2_OFFSET 0x000000f4 -#define MAC_PCU_BLUETOOTH_MODE2_PHY_ERR_BT_COLL_ENABLE_MSB 31 -#define MAC_PCU_BLUETOOTH_MODE2_PHY_ERR_BT_COLL_ENABLE_LSB 31 -#define MAC_PCU_BLUETOOTH_MODE2_PHY_ERR_BT_COLL_ENABLE_MASK 0x80000000 -#define MAC_PCU_BLUETOOTH_MODE2_PHY_ERR_BT_COLL_ENABLE_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE2_PHY_ERR_BT_COLL_ENABLE_MASK) >> MAC_PCU_BLUETOOTH_MODE2_PHY_ERR_BT_COLL_ENABLE_LSB) -#define MAC_PCU_BLUETOOTH_MODE2_PHY_ERR_BT_COLL_ENABLE_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE2_PHY_ERR_BT_COLL_ENABLE_LSB) & MAC_PCU_BLUETOOTH_MODE2_PHY_ERR_BT_COLL_ENABLE_MASK) -#define MAC_PCU_BLUETOOTH_MODE2_INTERRUPT_ENABLE_MSB 30 -#define MAC_PCU_BLUETOOTH_MODE2_INTERRUPT_ENABLE_LSB 30 -#define MAC_PCU_BLUETOOTH_MODE2_INTERRUPT_ENABLE_MASK 0x40000000 -#define MAC_PCU_BLUETOOTH_MODE2_INTERRUPT_ENABLE_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE2_INTERRUPT_ENABLE_MASK) >> MAC_PCU_BLUETOOTH_MODE2_INTERRUPT_ENABLE_LSB) -#define MAC_PCU_BLUETOOTH_MODE2_INTERRUPT_ENABLE_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE2_INTERRUPT_ENABLE_LSB) & MAC_PCU_BLUETOOTH_MODE2_INTERRUPT_ENABLE_MASK) -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_PRIORITY_CTRL_MSB 29 -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_PRIORITY_CTRL_LSB 28 -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_PRIORITY_CTRL_MASK 0x30000000 -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_PRIORITY_CTRL_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE2_TSF_BT_PRIORITY_CTRL_MASK) >> MAC_PCU_BLUETOOTH_MODE2_TSF_BT_PRIORITY_CTRL_LSB) -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_PRIORITY_CTRL_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE2_TSF_BT_PRIORITY_CTRL_LSB) & MAC_PCU_BLUETOOTH_MODE2_TSF_BT_PRIORITY_CTRL_MASK) -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_ACTIVE_CTRL_MSB 27 -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_ACTIVE_CTRL_LSB 26 -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_ACTIVE_CTRL_MASK 0x0c000000 -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_ACTIVE_CTRL_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE2_TSF_BT_ACTIVE_CTRL_MASK) >> MAC_PCU_BLUETOOTH_MODE2_TSF_BT_ACTIVE_CTRL_LSB) -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_ACTIVE_CTRL_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE2_TSF_BT_ACTIVE_CTRL_LSB) & MAC_PCU_BLUETOOTH_MODE2_TSF_BT_ACTIVE_CTRL_MASK) -#define MAC_PCU_BLUETOOTH_MODE2_RS_DISCARD_EXTEND_MSB 25 -#define MAC_PCU_BLUETOOTH_MODE2_RS_DISCARD_EXTEND_LSB 25 -#define MAC_PCU_BLUETOOTH_MODE2_RS_DISCARD_EXTEND_MASK 0x02000000 -#define MAC_PCU_BLUETOOTH_MODE2_RS_DISCARD_EXTEND_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE2_RS_DISCARD_EXTEND_MASK) >> MAC_PCU_BLUETOOTH_MODE2_RS_DISCARD_EXTEND_LSB) -#define MAC_PCU_BLUETOOTH_MODE2_RS_DISCARD_EXTEND_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE2_RS_DISCARD_EXTEND_LSB) & MAC_PCU_BLUETOOTH_MODE2_RS_DISCARD_EXTEND_MASK) -#define MAC_PCU_BLUETOOTH_MODE2_WL_TXRX_SEPARATE_MSB 24 -#define MAC_PCU_BLUETOOTH_MODE2_WL_TXRX_SEPARATE_LSB 24 -#define MAC_PCU_BLUETOOTH_MODE2_WL_TXRX_SEPARATE_MASK 0x01000000 -#define MAC_PCU_BLUETOOTH_MODE2_WL_TXRX_SEPARATE_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE2_WL_TXRX_SEPARATE_MASK) >> MAC_PCU_BLUETOOTH_MODE2_WL_TXRX_SEPARATE_LSB) -#define MAC_PCU_BLUETOOTH_MODE2_WL_TXRX_SEPARATE_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE2_WL_TXRX_SEPARATE_LSB) & MAC_PCU_BLUETOOTH_MODE2_WL_TXRX_SEPARATE_MASK) -#define MAC_PCU_BLUETOOTH_MODE2_WL_ACTIVE_MODE_MSB 23 -#define MAC_PCU_BLUETOOTH_MODE2_WL_ACTIVE_MODE_LSB 22 -#define MAC_PCU_BLUETOOTH_MODE2_WL_ACTIVE_MODE_MASK 0x00c00000 -#define MAC_PCU_BLUETOOTH_MODE2_WL_ACTIVE_MODE_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE2_WL_ACTIVE_MODE_MASK) >> MAC_PCU_BLUETOOTH_MODE2_WL_ACTIVE_MODE_LSB) -#define MAC_PCU_BLUETOOTH_MODE2_WL_ACTIVE_MODE_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE2_WL_ACTIVE_MODE_LSB) & MAC_PCU_BLUETOOTH_MODE2_WL_ACTIVE_MODE_MASK) -#define MAC_PCU_BLUETOOTH_MODE2_QUIET_2_WIRE_MSB 21 -#define MAC_PCU_BLUETOOTH_MODE2_QUIET_2_WIRE_LSB 21 -#define MAC_PCU_BLUETOOTH_MODE2_QUIET_2_WIRE_MASK 0x00200000 -#define MAC_PCU_BLUETOOTH_MODE2_QUIET_2_WIRE_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE2_QUIET_2_WIRE_MASK) >> MAC_PCU_BLUETOOTH_MODE2_QUIET_2_WIRE_LSB) -#define MAC_PCU_BLUETOOTH_MODE2_QUIET_2_WIRE_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE2_QUIET_2_WIRE_LSB) & MAC_PCU_BLUETOOTH_MODE2_QUIET_2_WIRE_MASK) -#define MAC_PCU_BLUETOOTH_MODE2_DISABLE_BT_ANT_MSB 20 -#define MAC_PCU_BLUETOOTH_MODE2_DISABLE_BT_ANT_LSB 20 -#define MAC_PCU_BLUETOOTH_MODE2_DISABLE_BT_ANT_MASK 0x00100000 -#define MAC_PCU_BLUETOOTH_MODE2_DISABLE_BT_ANT_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE2_DISABLE_BT_ANT_MASK) >> MAC_PCU_BLUETOOTH_MODE2_DISABLE_BT_ANT_LSB) -#define MAC_PCU_BLUETOOTH_MODE2_DISABLE_BT_ANT_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE2_DISABLE_BT_ANT_LSB) & MAC_PCU_BLUETOOTH_MODE2_DISABLE_BT_ANT_MASK) -#define MAC_PCU_BLUETOOTH_MODE2_PROTECT_BT_AFTER_WAKEUP_MSB 19 -#define MAC_PCU_BLUETOOTH_MODE2_PROTECT_BT_AFTER_WAKEUP_LSB 19 -#define MAC_PCU_BLUETOOTH_MODE2_PROTECT_BT_AFTER_WAKEUP_MASK 0x00080000 -#define MAC_PCU_BLUETOOTH_MODE2_PROTECT_BT_AFTER_WAKEUP_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE2_PROTECT_BT_AFTER_WAKEUP_MASK) >> MAC_PCU_BLUETOOTH_MODE2_PROTECT_BT_AFTER_WAKEUP_LSB) -#define MAC_PCU_BLUETOOTH_MODE2_PROTECT_BT_AFTER_WAKEUP_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE2_PROTECT_BT_AFTER_WAKEUP_LSB) & MAC_PCU_BLUETOOTH_MODE2_PROTECT_BT_AFTER_WAKEUP_MASK) -#define MAC_PCU_BLUETOOTH_MODE2_SLEEP_ALLOW_BT_ACCESS_MSB 17 -#define MAC_PCU_BLUETOOTH_MODE2_SLEEP_ALLOW_BT_ACCESS_LSB 17 -#define MAC_PCU_BLUETOOTH_MODE2_SLEEP_ALLOW_BT_ACCESS_MASK 0x00020000 -#define MAC_PCU_BLUETOOTH_MODE2_SLEEP_ALLOW_BT_ACCESS_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE2_SLEEP_ALLOW_BT_ACCESS_MASK) >> MAC_PCU_BLUETOOTH_MODE2_SLEEP_ALLOW_BT_ACCESS_LSB) -#define MAC_PCU_BLUETOOTH_MODE2_SLEEP_ALLOW_BT_ACCESS_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE2_SLEEP_ALLOW_BT_ACCESS_LSB) & MAC_PCU_BLUETOOTH_MODE2_SLEEP_ALLOW_BT_ACCESS_MASK) -#define MAC_PCU_BLUETOOTH_MODE2_HOLD_RX_CLEAR_MSB 16 -#define MAC_PCU_BLUETOOTH_MODE2_HOLD_RX_CLEAR_LSB 16 -#define MAC_PCU_BLUETOOTH_MODE2_HOLD_RX_CLEAR_MASK 0x00010000 -#define MAC_PCU_BLUETOOTH_MODE2_HOLD_RX_CLEAR_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE2_HOLD_RX_CLEAR_MASK) >> MAC_PCU_BLUETOOTH_MODE2_HOLD_RX_CLEAR_LSB) -#define MAC_PCU_BLUETOOTH_MODE2_HOLD_RX_CLEAR_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE2_HOLD_RX_CLEAR_LSB) & MAC_PCU_BLUETOOTH_MODE2_HOLD_RX_CLEAR_MASK) -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_CNT_MSB 15 -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_CNT_LSB 8 -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_CNT_MASK 0x0000ff00 -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_CNT_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_CNT_MASK) >> MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_CNT_LSB) -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_CNT_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_CNT_LSB) & MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_CNT_MASK) -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_THRESH_MSB 7 -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_THRESH_LSB 0 -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_THRESH_MASK 0x000000ff -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_THRESH_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_THRESH_MASK) >> MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_THRESH_LSB) -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_THRESH_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_THRESH_LSB) & MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_THRESH_MASK) - -#define MAC_PCU_TXSIFS_ADDRESS 0x000080f8 -#define MAC_PCU_TXSIFS_OFFSET 0x000000f8 -#define MAC_PCU_TXSIFS_ACK_SHIFT_MSB 14 -#define MAC_PCU_TXSIFS_ACK_SHIFT_LSB 12 -#define MAC_PCU_TXSIFS_ACK_SHIFT_MASK 0x00007000 -#define MAC_PCU_TXSIFS_ACK_SHIFT_GET(x) (((x) & MAC_PCU_TXSIFS_ACK_SHIFT_MASK) >> MAC_PCU_TXSIFS_ACK_SHIFT_LSB) -#define MAC_PCU_TXSIFS_ACK_SHIFT_SET(x) (((x) << MAC_PCU_TXSIFS_ACK_SHIFT_LSB) & MAC_PCU_TXSIFS_ACK_SHIFT_MASK) -#define MAC_PCU_TXSIFS_TX_LATENCY_MSB 11 -#define MAC_PCU_TXSIFS_TX_LATENCY_LSB 8 -#define MAC_PCU_TXSIFS_TX_LATENCY_MASK 0x00000f00 -#define MAC_PCU_TXSIFS_TX_LATENCY_GET(x) (((x) & MAC_PCU_TXSIFS_TX_LATENCY_MASK) >> MAC_PCU_TXSIFS_TX_LATENCY_LSB) -#define MAC_PCU_TXSIFS_TX_LATENCY_SET(x) (((x) << MAC_PCU_TXSIFS_TX_LATENCY_LSB) & MAC_PCU_TXSIFS_TX_LATENCY_MASK) -#define MAC_PCU_TXSIFS_SIFS_TIME_MSB 7 -#define MAC_PCU_TXSIFS_SIFS_TIME_LSB 0 -#define MAC_PCU_TXSIFS_SIFS_TIME_MASK 0x000000ff -#define MAC_PCU_TXSIFS_SIFS_TIME_GET(x) (((x) & MAC_PCU_TXSIFS_SIFS_TIME_MASK) >> MAC_PCU_TXSIFS_SIFS_TIME_LSB) -#define MAC_PCU_TXSIFS_SIFS_TIME_SET(x) (((x) << MAC_PCU_TXSIFS_SIFS_TIME_LSB) & MAC_PCU_TXSIFS_SIFS_TIME_MASK) - -#define MAC_PCU_TXOP_X_ADDRESS 0x000080fc -#define MAC_PCU_TXOP_X_OFFSET 0x000000fc -#define MAC_PCU_TXOP_X_VALUE_MSB 7 -#define MAC_PCU_TXOP_X_VALUE_LSB 0 -#define MAC_PCU_TXOP_X_VALUE_MASK 0x000000ff -#define MAC_PCU_TXOP_X_VALUE_GET(x) (((x) & MAC_PCU_TXOP_X_VALUE_MASK) >> MAC_PCU_TXOP_X_VALUE_LSB) -#define MAC_PCU_TXOP_X_VALUE_SET(x) (((x) << MAC_PCU_TXOP_X_VALUE_LSB) & MAC_PCU_TXOP_X_VALUE_MASK) - -#define MAC_PCU_TXOP_0_3_ADDRESS 0x00008100 -#define MAC_PCU_TXOP_0_3_OFFSET 0x00000100 -#define MAC_PCU_TXOP_0_3_VALUE_3_MSB 31 -#define MAC_PCU_TXOP_0_3_VALUE_3_LSB 24 -#define MAC_PCU_TXOP_0_3_VALUE_3_MASK 0xff000000 -#define MAC_PCU_TXOP_0_3_VALUE_3_GET(x) (((x) & MAC_PCU_TXOP_0_3_VALUE_3_MASK) >> MAC_PCU_TXOP_0_3_VALUE_3_LSB) -#define MAC_PCU_TXOP_0_3_VALUE_3_SET(x) (((x) << MAC_PCU_TXOP_0_3_VALUE_3_LSB) & MAC_PCU_TXOP_0_3_VALUE_3_MASK) -#define MAC_PCU_TXOP_0_3_VALUE_2_MSB 23 -#define MAC_PCU_TXOP_0_3_VALUE_2_LSB 16 -#define MAC_PCU_TXOP_0_3_VALUE_2_MASK 0x00ff0000 -#define MAC_PCU_TXOP_0_3_VALUE_2_GET(x) (((x) & MAC_PCU_TXOP_0_3_VALUE_2_MASK) >> MAC_PCU_TXOP_0_3_VALUE_2_LSB) -#define MAC_PCU_TXOP_0_3_VALUE_2_SET(x) (((x) << MAC_PCU_TXOP_0_3_VALUE_2_LSB) & MAC_PCU_TXOP_0_3_VALUE_2_MASK) -#define MAC_PCU_TXOP_0_3_VALUE_1_MSB 15 -#define MAC_PCU_TXOP_0_3_VALUE_1_LSB 8 -#define MAC_PCU_TXOP_0_3_VALUE_1_MASK 0x0000ff00 -#define MAC_PCU_TXOP_0_3_VALUE_1_GET(x) (((x) & MAC_PCU_TXOP_0_3_VALUE_1_MASK) >> MAC_PCU_TXOP_0_3_VALUE_1_LSB) -#define MAC_PCU_TXOP_0_3_VALUE_1_SET(x) (((x) << MAC_PCU_TXOP_0_3_VALUE_1_LSB) & MAC_PCU_TXOP_0_3_VALUE_1_MASK) -#define MAC_PCU_TXOP_0_3_VALUE_0_MSB 7 -#define MAC_PCU_TXOP_0_3_VALUE_0_LSB 0 -#define MAC_PCU_TXOP_0_3_VALUE_0_MASK 0x000000ff -#define MAC_PCU_TXOP_0_3_VALUE_0_GET(x) (((x) & MAC_PCU_TXOP_0_3_VALUE_0_MASK) >> MAC_PCU_TXOP_0_3_VALUE_0_LSB) -#define MAC_PCU_TXOP_0_3_VALUE_0_SET(x) (((x) << MAC_PCU_TXOP_0_3_VALUE_0_LSB) & MAC_PCU_TXOP_0_3_VALUE_0_MASK) - -#define MAC_PCU_TXOP_4_7_ADDRESS 0x00008104 -#define MAC_PCU_TXOP_4_7_OFFSET 0x00000104 -#define MAC_PCU_TXOP_4_7_VALUE_7_MSB 31 -#define MAC_PCU_TXOP_4_7_VALUE_7_LSB 24 -#define MAC_PCU_TXOP_4_7_VALUE_7_MASK 0xff000000 -#define MAC_PCU_TXOP_4_7_VALUE_7_GET(x) (((x) & MAC_PCU_TXOP_4_7_VALUE_7_MASK) >> MAC_PCU_TXOP_4_7_VALUE_7_LSB) -#define MAC_PCU_TXOP_4_7_VALUE_7_SET(x) (((x) << MAC_PCU_TXOP_4_7_VALUE_7_LSB) & MAC_PCU_TXOP_4_7_VALUE_7_MASK) -#define MAC_PCU_TXOP_4_7_VALUE_6_MSB 23 -#define MAC_PCU_TXOP_4_7_VALUE_6_LSB 16 -#define MAC_PCU_TXOP_4_7_VALUE_6_MASK 0x00ff0000 -#define MAC_PCU_TXOP_4_7_VALUE_6_GET(x) (((x) & MAC_PCU_TXOP_4_7_VALUE_6_MASK) >> MAC_PCU_TXOP_4_7_VALUE_6_LSB) -#define MAC_PCU_TXOP_4_7_VALUE_6_SET(x) (((x) << MAC_PCU_TXOP_4_7_VALUE_6_LSB) & MAC_PCU_TXOP_4_7_VALUE_6_MASK) -#define MAC_PCU_TXOP_4_7_VALUE_5_MSB 15 -#define MAC_PCU_TXOP_4_7_VALUE_5_LSB 8 -#define MAC_PCU_TXOP_4_7_VALUE_5_MASK 0x0000ff00 -#define MAC_PCU_TXOP_4_7_VALUE_5_GET(x) (((x) & MAC_PCU_TXOP_4_7_VALUE_5_MASK) >> MAC_PCU_TXOP_4_7_VALUE_5_LSB) -#define MAC_PCU_TXOP_4_7_VALUE_5_SET(x) (((x) << MAC_PCU_TXOP_4_7_VALUE_5_LSB) & MAC_PCU_TXOP_4_7_VALUE_5_MASK) -#define MAC_PCU_TXOP_4_7_VALUE_4_MSB 7 -#define MAC_PCU_TXOP_4_7_VALUE_4_LSB 0 -#define MAC_PCU_TXOP_4_7_VALUE_4_MASK 0x000000ff -#define MAC_PCU_TXOP_4_7_VALUE_4_GET(x) (((x) & MAC_PCU_TXOP_4_7_VALUE_4_MASK) >> MAC_PCU_TXOP_4_7_VALUE_4_LSB) -#define MAC_PCU_TXOP_4_7_VALUE_4_SET(x) (((x) << MAC_PCU_TXOP_4_7_VALUE_4_LSB) & MAC_PCU_TXOP_4_7_VALUE_4_MASK) - -#define MAC_PCU_TXOP_8_11_ADDRESS 0x00008108 -#define MAC_PCU_TXOP_8_11_OFFSET 0x00000108 -#define MAC_PCU_TXOP_8_11_VALUE_11_MSB 31 -#define MAC_PCU_TXOP_8_11_VALUE_11_LSB 24 -#define MAC_PCU_TXOP_8_11_VALUE_11_MASK 0xff000000 -#define MAC_PCU_TXOP_8_11_VALUE_11_GET(x) (((x) & MAC_PCU_TXOP_8_11_VALUE_11_MASK) >> MAC_PCU_TXOP_8_11_VALUE_11_LSB) -#define MAC_PCU_TXOP_8_11_VALUE_11_SET(x) (((x) << MAC_PCU_TXOP_8_11_VALUE_11_LSB) & MAC_PCU_TXOP_8_11_VALUE_11_MASK) -#define MAC_PCU_TXOP_8_11_VALUE_10_MSB 23 -#define MAC_PCU_TXOP_8_11_VALUE_10_LSB 16 -#define MAC_PCU_TXOP_8_11_VALUE_10_MASK 0x00ff0000 -#define MAC_PCU_TXOP_8_11_VALUE_10_GET(x) (((x) & MAC_PCU_TXOP_8_11_VALUE_10_MASK) >> MAC_PCU_TXOP_8_11_VALUE_10_LSB) -#define MAC_PCU_TXOP_8_11_VALUE_10_SET(x) (((x) << MAC_PCU_TXOP_8_11_VALUE_10_LSB) & MAC_PCU_TXOP_8_11_VALUE_10_MASK) -#define MAC_PCU_TXOP_8_11_VALUE_9_MSB 15 -#define MAC_PCU_TXOP_8_11_VALUE_9_LSB 8 -#define MAC_PCU_TXOP_8_11_VALUE_9_MASK 0x0000ff00 -#define MAC_PCU_TXOP_8_11_VALUE_9_GET(x) (((x) & MAC_PCU_TXOP_8_11_VALUE_9_MASK) >> MAC_PCU_TXOP_8_11_VALUE_9_LSB) -#define MAC_PCU_TXOP_8_11_VALUE_9_SET(x) (((x) << MAC_PCU_TXOP_8_11_VALUE_9_LSB) & MAC_PCU_TXOP_8_11_VALUE_9_MASK) -#define MAC_PCU_TXOP_8_11_VALUE_8_MSB 7 -#define MAC_PCU_TXOP_8_11_VALUE_8_LSB 0 -#define MAC_PCU_TXOP_8_11_VALUE_8_MASK 0x000000ff -#define MAC_PCU_TXOP_8_11_VALUE_8_GET(x) (((x) & MAC_PCU_TXOP_8_11_VALUE_8_MASK) >> MAC_PCU_TXOP_8_11_VALUE_8_LSB) -#define MAC_PCU_TXOP_8_11_VALUE_8_SET(x) (((x) << MAC_PCU_TXOP_8_11_VALUE_8_LSB) & MAC_PCU_TXOP_8_11_VALUE_8_MASK) - -#define MAC_PCU_TXOP_12_15_ADDRESS 0x0000810c -#define MAC_PCU_TXOP_12_15_OFFSET 0x0000010c -#define MAC_PCU_TXOP_12_15_VALUE_15_MSB 31 -#define MAC_PCU_TXOP_12_15_VALUE_15_LSB 24 -#define MAC_PCU_TXOP_12_15_VALUE_15_MASK 0xff000000 -#define MAC_PCU_TXOP_12_15_VALUE_15_GET(x) (((x) & MAC_PCU_TXOP_12_15_VALUE_15_MASK) >> MAC_PCU_TXOP_12_15_VALUE_15_LSB) -#define MAC_PCU_TXOP_12_15_VALUE_15_SET(x) (((x) << MAC_PCU_TXOP_12_15_VALUE_15_LSB) & MAC_PCU_TXOP_12_15_VALUE_15_MASK) -#define MAC_PCU_TXOP_12_15_VALUE_14_MSB 23 -#define MAC_PCU_TXOP_12_15_VALUE_14_LSB 16 -#define MAC_PCU_TXOP_12_15_VALUE_14_MASK 0x00ff0000 -#define MAC_PCU_TXOP_12_15_VALUE_14_GET(x) (((x) & MAC_PCU_TXOP_12_15_VALUE_14_MASK) >> MAC_PCU_TXOP_12_15_VALUE_14_LSB) -#define MAC_PCU_TXOP_12_15_VALUE_14_SET(x) (((x) << MAC_PCU_TXOP_12_15_VALUE_14_LSB) & MAC_PCU_TXOP_12_15_VALUE_14_MASK) -#define MAC_PCU_TXOP_12_15_VALUE_13_MSB 15 -#define MAC_PCU_TXOP_12_15_VALUE_13_LSB 8 -#define MAC_PCU_TXOP_12_15_VALUE_13_MASK 0x0000ff00 -#define MAC_PCU_TXOP_12_15_VALUE_13_GET(x) (((x) & MAC_PCU_TXOP_12_15_VALUE_13_MASK) >> MAC_PCU_TXOP_12_15_VALUE_13_LSB) -#define MAC_PCU_TXOP_12_15_VALUE_13_SET(x) (((x) << MAC_PCU_TXOP_12_15_VALUE_13_LSB) & MAC_PCU_TXOP_12_15_VALUE_13_MASK) -#define MAC_PCU_TXOP_12_15_VALUE_12_MSB 7 -#define MAC_PCU_TXOP_12_15_VALUE_12_LSB 0 -#define MAC_PCU_TXOP_12_15_VALUE_12_MASK 0x000000ff -#define MAC_PCU_TXOP_12_15_VALUE_12_GET(x) (((x) & MAC_PCU_TXOP_12_15_VALUE_12_MASK) >> MAC_PCU_TXOP_12_15_VALUE_12_LSB) -#define MAC_PCU_TXOP_12_15_VALUE_12_SET(x) (((x) << MAC_PCU_TXOP_12_15_VALUE_12_LSB) & MAC_PCU_TXOP_12_15_VALUE_12_MASK) - -#define MAC_PCU_LOGIC_ANALYZER_ADDRESS 0x00008110 -#define MAC_PCU_LOGIC_ANALYZER_OFFSET 0x00000110 -#define MAC_PCU_LOGIC_ANALYZER_DIAG_MODE_MSB 31 -#define MAC_PCU_LOGIC_ANALYZER_DIAG_MODE_LSB 18 -#define MAC_PCU_LOGIC_ANALYZER_DIAG_MODE_MASK 0xfffc0000 -#define MAC_PCU_LOGIC_ANALYZER_DIAG_MODE_GET(x) (((x) & MAC_PCU_LOGIC_ANALYZER_DIAG_MODE_MASK) >> MAC_PCU_LOGIC_ANALYZER_DIAG_MODE_LSB) -#define MAC_PCU_LOGIC_ANALYZER_DIAG_MODE_SET(x) (((x) << MAC_PCU_LOGIC_ANALYZER_DIAG_MODE_LSB) & MAC_PCU_LOGIC_ANALYZER_DIAG_MODE_MASK) -#define MAC_PCU_LOGIC_ANALYZER_INT_ADDR_MSB 17 -#define MAC_PCU_LOGIC_ANALYZER_INT_ADDR_LSB 8 -#define MAC_PCU_LOGIC_ANALYZER_INT_ADDR_MASK 0x0003ff00 -#define MAC_PCU_LOGIC_ANALYZER_INT_ADDR_GET(x) (((x) & MAC_PCU_LOGIC_ANALYZER_INT_ADDR_MASK) >> MAC_PCU_LOGIC_ANALYZER_INT_ADDR_LSB) -#define MAC_PCU_LOGIC_ANALYZER_INT_ADDR_SET(x) (((x) << MAC_PCU_LOGIC_ANALYZER_INT_ADDR_LSB) & MAC_PCU_LOGIC_ANALYZER_INT_ADDR_MASK) -#define MAC_PCU_LOGIC_ANALYZER_QCU_SEL_MSB 7 -#define MAC_PCU_LOGIC_ANALYZER_QCU_SEL_LSB 4 -#define MAC_PCU_LOGIC_ANALYZER_QCU_SEL_MASK 0x000000f0 -#define MAC_PCU_LOGIC_ANALYZER_QCU_SEL_GET(x) (((x) & MAC_PCU_LOGIC_ANALYZER_QCU_SEL_MASK) >> MAC_PCU_LOGIC_ANALYZER_QCU_SEL_LSB) -#define MAC_PCU_LOGIC_ANALYZER_QCU_SEL_SET(x) (((x) << MAC_PCU_LOGIC_ANALYZER_QCU_SEL_LSB) & MAC_PCU_LOGIC_ANALYZER_QCU_SEL_MASK) -#define MAC_PCU_LOGIC_ANALYZER_ENABLE_MSB 3 -#define MAC_PCU_LOGIC_ANALYZER_ENABLE_LSB 3 -#define MAC_PCU_LOGIC_ANALYZER_ENABLE_MASK 0x00000008 -#define MAC_PCU_LOGIC_ANALYZER_ENABLE_GET(x) (((x) & MAC_PCU_LOGIC_ANALYZER_ENABLE_MASK) >> MAC_PCU_LOGIC_ANALYZER_ENABLE_LSB) -#define MAC_PCU_LOGIC_ANALYZER_ENABLE_SET(x) (((x) << MAC_PCU_LOGIC_ANALYZER_ENABLE_LSB) & MAC_PCU_LOGIC_ANALYZER_ENABLE_MASK) -#define MAC_PCU_LOGIC_ANALYZER_STATE_MSB 2 -#define MAC_PCU_LOGIC_ANALYZER_STATE_LSB 2 -#define MAC_PCU_LOGIC_ANALYZER_STATE_MASK 0x00000004 -#define MAC_PCU_LOGIC_ANALYZER_STATE_GET(x) (((x) & MAC_PCU_LOGIC_ANALYZER_STATE_MASK) >> MAC_PCU_LOGIC_ANALYZER_STATE_LSB) -#define MAC_PCU_LOGIC_ANALYZER_STATE_SET(x) (((x) << MAC_PCU_LOGIC_ANALYZER_STATE_LSB) & MAC_PCU_LOGIC_ANALYZER_STATE_MASK) -#define MAC_PCU_LOGIC_ANALYZER_CLEAR_MSB 1 -#define MAC_PCU_LOGIC_ANALYZER_CLEAR_LSB 1 -#define MAC_PCU_LOGIC_ANALYZER_CLEAR_MASK 0x00000002 -#define MAC_PCU_LOGIC_ANALYZER_CLEAR_GET(x) (((x) & MAC_PCU_LOGIC_ANALYZER_CLEAR_MASK) >> MAC_PCU_LOGIC_ANALYZER_CLEAR_LSB) -#define MAC_PCU_LOGIC_ANALYZER_CLEAR_SET(x) (((x) << MAC_PCU_LOGIC_ANALYZER_CLEAR_LSB) & MAC_PCU_LOGIC_ANALYZER_CLEAR_MASK) -#define MAC_PCU_LOGIC_ANALYZER_HOLD_MSB 0 -#define MAC_PCU_LOGIC_ANALYZER_HOLD_LSB 0 -#define MAC_PCU_LOGIC_ANALYZER_HOLD_MASK 0x00000001 -#define MAC_PCU_LOGIC_ANALYZER_HOLD_GET(x) (((x) & MAC_PCU_LOGIC_ANALYZER_HOLD_MASK) >> MAC_PCU_LOGIC_ANALYZER_HOLD_LSB) -#define MAC_PCU_LOGIC_ANALYZER_HOLD_SET(x) (((x) << MAC_PCU_LOGIC_ANALYZER_HOLD_LSB) & MAC_PCU_LOGIC_ANALYZER_HOLD_MASK) - -#define MAC_PCU_LOGIC_ANALYZER_32L_ADDRESS 0x00008114 -#define MAC_PCU_LOGIC_ANALYZER_32L_OFFSET 0x00000114 -#define MAC_PCU_LOGIC_ANALYZER_32L_MASK_MSB 31 -#define MAC_PCU_LOGIC_ANALYZER_32L_MASK_LSB 0 -#define MAC_PCU_LOGIC_ANALYZER_32L_MASK_MASK 0xffffffff -#define MAC_PCU_LOGIC_ANALYZER_32L_MASK_GET(x) (((x) & MAC_PCU_LOGIC_ANALYZER_32L_MASK_MASK) >> MAC_PCU_LOGIC_ANALYZER_32L_MASK_LSB) -#define MAC_PCU_LOGIC_ANALYZER_32L_MASK_SET(x) (((x) << MAC_PCU_LOGIC_ANALYZER_32L_MASK_LSB) & MAC_PCU_LOGIC_ANALYZER_32L_MASK_MASK) - -#define MAC_PCU_LOGIC_ANALYZER_16U_ADDRESS 0x00008118 -#define MAC_PCU_LOGIC_ANALYZER_16U_OFFSET 0x00000118 -#define MAC_PCU_LOGIC_ANALYZER_16U_MASK_MSB 15 -#define MAC_PCU_LOGIC_ANALYZER_16U_MASK_LSB 0 -#define MAC_PCU_LOGIC_ANALYZER_16U_MASK_MASK 0x0000ffff -#define MAC_PCU_LOGIC_ANALYZER_16U_MASK_GET(x) (((x) & MAC_PCU_LOGIC_ANALYZER_16U_MASK_MASK) >> MAC_PCU_LOGIC_ANALYZER_16U_MASK_LSB) -#define MAC_PCU_LOGIC_ANALYZER_16U_MASK_SET(x) (((x) << MAC_PCU_LOGIC_ANALYZER_16U_MASK_LSB) & MAC_PCU_LOGIC_ANALYZER_16U_MASK_MASK) - -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_ADDRESS 0x0000811c -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_OFFSET 0x0000011c -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK3_MSB 23 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK3_LSB 16 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK3_MASK 0x00ff0000 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK3_GET(x) (((x) & MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK3_MASK) >> MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK3_LSB) -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK3_SET(x) (((x) << MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK3_LSB) & MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK3_MASK) -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK2_MSB 15 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK2_LSB 8 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK2_MASK 0x0000ff00 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK2_GET(x) (((x) & MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK2_MASK) >> MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK2_LSB) -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK2_SET(x) (((x) << MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK2_LSB) & MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK2_MASK) -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK1_MSB 7 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK1_LSB 0 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK1_MASK 0x000000ff -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK1_GET(x) (((x) & MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK1_MASK) >> MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK1_LSB) -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK1_SET(x) (((x) << MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK1_LSB) & MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK1_MASK) - -#define MAC_PCU_AZIMUTH_MODE_ADDRESS 0x00008120 -#define MAC_PCU_AZIMUTH_MODE_OFFSET 0x00000120 -#define MAC_PCU_AZIMUTH_MODE_BA_USES_AD1_MSB 7 -#define MAC_PCU_AZIMUTH_MODE_BA_USES_AD1_LSB 7 -#define MAC_PCU_AZIMUTH_MODE_BA_USES_AD1_MASK 0x00000080 -#define MAC_PCU_AZIMUTH_MODE_BA_USES_AD1_GET(x) (((x) & MAC_PCU_AZIMUTH_MODE_BA_USES_AD1_MASK) >> MAC_PCU_AZIMUTH_MODE_BA_USES_AD1_LSB) -#define MAC_PCU_AZIMUTH_MODE_BA_USES_AD1_SET(x) (((x) << MAC_PCU_AZIMUTH_MODE_BA_USES_AD1_LSB) & MAC_PCU_AZIMUTH_MODE_BA_USES_AD1_MASK) -#define MAC_PCU_AZIMUTH_MODE_ACK_CTS_MATCH_TX_AD2_MSB 6 -#define MAC_PCU_AZIMUTH_MODE_ACK_CTS_MATCH_TX_AD2_LSB 6 -#define MAC_PCU_AZIMUTH_MODE_ACK_CTS_MATCH_TX_AD2_MASK 0x00000040 -#define MAC_PCU_AZIMUTH_MODE_ACK_CTS_MATCH_TX_AD2_GET(x) (((x) & MAC_PCU_AZIMUTH_MODE_ACK_CTS_MATCH_TX_AD2_MASK) >> MAC_PCU_AZIMUTH_MODE_ACK_CTS_MATCH_TX_AD2_LSB) -#define MAC_PCU_AZIMUTH_MODE_ACK_CTS_MATCH_TX_AD2_SET(x) (((x) << MAC_PCU_AZIMUTH_MODE_ACK_CTS_MATCH_TX_AD2_LSB) & MAC_PCU_AZIMUTH_MODE_ACK_CTS_MATCH_TX_AD2_MASK) -#define MAC_PCU_AZIMUTH_MODE_TX_DESC_EN_MSB 5 -#define MAC_PCU_AZIMUTH_MODE_TX_DESC_EN_LSB 5 -#define MAC_PCU_AZIMUTH_MODE_TX_DESC_EN_MASK 0x00000020 -#define MAC_PCU_AZIMUTH_MODE_TX_DESC_EN_GET(x) (((x) & MAC_PCU_AZIMUTH_MODE_TX_DESC_EN_MASK) >> MAC_PCU_AZIMUTH_MODE_TX_DESC_EN_LSB) -#define MAC_PCU_AZIMUTH_MODE_TX_DESC_EN_SET(x) (((x) << MAC_PCU_AZIMUTH_MODE_TX_DESC_EN_LSB) & MAC_PCU_AZIMUTH_MODE_TX_DESC_EN_MASK) -#define MAC_PCU_AZIMUTH_MODE_CLK_EN_MSB 4 -#define MAC_PCU_AZIMUTH_MODE_CLK_EN_LSB 4 -#define MAC_PCU_AZIMUTH_MODE_CLK_EN_MASK 0x00000010 -#define MAC_PCU_AZIMUTH_MODE_CLK_EN_GET(x) (((x) & MAC_PCU_AZIMUTH_MODE_CLK_EN_MASK) >> MAC_PCU_AZIMUTH_MODE_CLK_EN_LSB) -#define MAC_PCU_AZIMUTH_MODE_CLK_EN_SET(x) (((x) << MAC_PCU_AZIMUTH_MODE_CLK_EN_LSB) & MAC_PCU_AZIMUTH_MODE_CLK_EN_MASK) -#define MAC_PCU_AZIMUTH_MODE_RX_TSF_STATUS_SEL_MSB 3 -#define MAC_PCU_AZIMUTH_MODE_RX_TSF_STATUS_SEL_LSB 3 -#define MAC_PCU_AZIMUTH_MODE_RX_TSF_STATUS_SEL_MASK 0x00000008 -#define MAC_PCU_AZIMUTH_MODE_RX_TSF_STATUS_SEL_GET(x) (((x) & MAC_PCU_AZIMUTH_MODE_RX_TSF_STATUS_SEL_MASK) >> MAC_PCU_AZIMUTH_MODE_RX_TSF_STATUS_SEL_LSB) -#define MAC_PCU_AZIMUTH_MODE_RX_TSF_STATUS_SEL_SET(x) (((x) << MAC_PCU_AZIMUTH_MODE_RX_TSF_STATUS_SEL_LSB) & MAC_PCU_AZIMUTH_MODE_RX_TSF_STATUS_SEL_MASK) -#define MAC_PCU_AZIMUTH_MODE_TX_TSF_STATUS_SEL_MSB 2 -#define MAC_PCU_AZIMUTH_MODE_TX_TSF_STATUS_SEL_LSB 2 -#define MAC_PCU_AZIMUTH_MODE_TX_TSF_STATUS_SEL_MASK 0x00000004 -#define MAC_PCU_AZIMUTH_MODE_TX_TSF_STATUS_SEL_GET(x) (((x) & MAC_PCU_AZIMUTH_MODE_TX_TSF_STATUS_SEL_MASK) >> MAC_PCU_AZIMUTH_MODE_TX_TSF_STATUS_SEL_LSB) -#define MAC_PCU_AZIMUTH_MODE_TX_TSF_STATUS_SEL_SET(x) (((x) << MAC_PCU_AZIMUTH_MODE_TX_TSF_STATUS_SEL_LSB) & MAC_PCU_AZIMUTH_MODE_TX_TSF_STATUS_SEL_MASK) -#define MAC_PCU_AZIMUTH_MODE_KEY_SEARCH_AD1_MSB 1 -#define MAC_PCU_AZIMUTH_MODE_KEY_SEARCH_AD1_LSB 1 -#define MAC_PCU_AZIMUTH_MODE_KEY_SEARCH_AD1_MASK 0x00000002 -#define MAC_PCU_AZIMUTH_MODE_KEY_SEARCH_AD1_GET(x) (((x) & MAC_PCU_AZIMUTH_MODE_KEY_SEARCH_AD1_MASK) >> MAC_PCU_AZIMUTH_MODE_KEY_SEARCH_AD1_LSB) -#define MAC_PCU_AZIMUTH_MODE_KEY_SEARCH_AD1_SET(x) (((x) << MAC_PCU_AZIMUTH_MODE_KEY_SEARCH_AD1_LSB) & MAC_PCU_AZIMUTH_MODE_KEY_SEARCH_AD1_MASK) -#define MAC_PCU_AZIMUTH_MODE_DISABLE_TSF_UPDATE_MSB 0 -#define MAC_PCU_AZIMUTH_MODE_DISABLE_TSF_UPDATE_LSB 0 -#define MAC_PCU_AZIMUTH_MODE_DISABLE_TSF_UPDATE_MASK 0x00000001 -#define MAC_PCU_AZIMUTH_MODE_DISABLE_TSF_UPDATE_GET(x) (((x) & MAC_PCU_AZIMUTH_MODE_DISABLE_TSF_UPDATE_MASK) >> MAC_PCU_AZIMUTH_MODE_DISABLE_TSF_UPDATE_LSB) -#define MAC_PCU_AZIMUTH_MODE_DISABLE_TSF_UPDATE_SET(x) (((x) << MAC_PCU_AZIMUTH_MODE_DISABLE_TSF_UPDATE_LSB) & MAC_PCU_AZIMUTH_MODE_DISABLE_TSF_UPDATE_MASK) - -#define MAC_PCU_20_40_MODE_ADDRESS 0x00008124 -#define MAC_PCU_20_40_MODE_OFFSET 0x00000124 -#define MAC_PCU_20_40_MODE_PIFS_CYCLES_MSB 15 -#define MAC_PCU_20_40_MODE_PIFS_CYCLES_LSB 4 -#define MAC_PCU_20_40_MODE_PIFS_CYCLES_MASK 0x0000fff0 -#define MAC_PCU_20_40_MODE_PIFS_CYCLES_GET(x) (((x) & MAC_PCU_20_40_MODE_PIFS_CYCLES_MASK) >> MAC_PCU_20_40_MODE_PIFS_CYCLES_LSB) -#define MAC_PCU_20_40_MODE_PIFS_CYCLES_SET(x) (((x) << MAC_PCU_20_40_MODE_PIFS_CYCLES_LSB) & MAC_PCU_20_40_MODE_PIFS_CYCLES_MASK) -#define MAC_PCU_20_40_MODE_SWAMPED_FORCES_RX_CLEAR_CTL_IDLE_MSB 3 -#define MAC_PCU_20_40_MODE_SWAMPED_FORCES_RX_CLEAR_CTL_IDLE_LSB 3 -#define MAC_PCU_20_40_MODE_SWAMPED_FORCES_RX_CLEAR_CTL_IDLE_MASK 0x00000008 -#define MAC_PCU_20_40_MODE_SWAMPED_FORCES_RX_CLEAR_CTL_IDLE_GET(x) (((x) & MAC_PCU_20_40_MODE_SWAMPED_FORCES_RX_CLEAR_CTL_IDLE_MASK) >> MAC_PCU_20_40_MODE_SWAMPED_FORCES_RX_CLEAR_CTL_IDLE_LSB) -#define MAC_PCU_20_40_MODE_SWAMPED_FORCES_RX_CLEAR_CTL_IDLE_SET(x) (((x) << MAC_PCU_20_40_MODE_SWAMPED_FORCES_RX_CLEAR_CTL_IDLE_LSB) & MAC_PCU_20_40_MODE_SWAMPED_FORCES_RX_CLEAR_CTL_IDLE_MASK) -#define MAC_PCU_20_40_MODE_TX_HT20_ON_EXT_BUSY_MSB 2 -#define MAC_PCU_20_40_MODE_TX_HT20_ON_EXT_BUSY_LSB 2 -#define MAC_PCU_20_40_MODE_TX_HT20_ON_EXT_BUSY_MASK 0x00000004 -#define MAC_PCU_20_40_MODE_TX_HT20_ON_EXT_BUSY_GET(x) (((x) & MAC_PCU_20_40_MODE_TX_HT20_ON_EXT_BUSY_MASK) >> MAC_PCU_20_40_MODE_TX_HT20_ON_EXT_BUSY_LSB) -#define MAC_PCU_20_40_MODE_TX_HT20_ON_EXT_BUSY_SET(x) (((x) << MAC_PCU_20_40_MODE_TX_HT20_ON_EXT_BUSY_LSB) & MAC_PCU_20_40_MODE_TX_HT20_ON_EXT_BUSY_MASK) -#define MAC_PCU_20_40_MODE_EXT_PIFS_ENABLE_MSB 1 -#define MAC_PCU_20_40_MODE_EXT_PIFS_ENABLE_LSB 1 -#define MAC_PCU_20_40_MODE_EXT_PIFS_ENABLE_MASK 0x00000002 -#define MAC_PCU_20_40_MODE_EXT_PIFS_ENABLE_GET(x) (((x) & MAC_PCU_20_40_MODE_EXT_PIFS_ENABLE_MASK) >> MAC_PCU_20_40_MODE_EXT_PIFS_ENABLE_LSB) -#define MAC_PCU_20_40_MODE_EXT_PIFS_ENABLE_SET(x) (((x) << MAC_PCU_20_40_MODE_EXT_PIFS_ENABLE_LSB) & MAC_PCU_20_40_MODE_EXT_PIFS_ENABLE_MASK) -#define MAC_PCU_20_40_MODE_JOINED_RX_CLEAR_MSB 0 -#define MAC_PCU_20_40_MODE_JOINED_RX_CLEAR_LSB 0 -#define MAC_PCU_20_40_MODE_JOINED_RX_CLEAR_MASK 0x00000001 -#define MAC_PCU_20_40_MODE_JOINED_RX_CLEAR_GET(x) (((x) & MAC_PCU_20_40_MODE_JOINED_RX_CLEAR_MASK) >> MAC_PCU_20_40_MODE_JOINED_RX_CLEAR_LSB) -#define MAC_PCU_20_40_MODE_JOINED_RX_CLEAR_SET(x) (((x) << MAC_PCU_20_40_MODE_JOINED_RX_CLEAR_LSB) & MAC_PCU_20_40_MODE_JOINED_RX_CLEAR_MASK) - -#define MAC_PCU_RX_CLEAR_DIFF_CNT_ADDRESS 0x00008128 -#define MAC_PCU_RX_CLEAR_DIFF_CNT_OFFSET 0x00000128 -#define MAC_PCU_RX_CLEAR_DIFF_CNT_VALUE_MSB 31 -#define MAC_PCU_RX_CLEAR_DIFF_CNT_VALUE_LSB 0 -#define MAC_PCU_RX_CLEAR_DIFF_CNT_VALUE_MASK 0xffffffff -#define MAC_PCU_RX_CLEAR_DIFF_CNT_VALUE_GET(x) (((x) & MAC_PCU_RX_CLEAR_DIFF_CNT_VALUE_MASK) >> MAC_PCU_RX_CLEAR_DIFF_CNT_VALUE_LSB) -#define MAC_PCU_RX_CLEAR_DIFF_CNT_VALUE_SET(x) (((x) << MAC_PCU_RX_CLEAR_DIFF_CNT_VALUE_LSB) & MAC_PCU_RX_CLEAR_DIFF_CNT_VALUE_MASK) - -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_ADDRESS 0x0000812c -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_OFFSET 0x0000012c -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_VALUE_MSB 2 -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_VALUE_LSB 0 -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_VALUE_MASK 0x00000007 -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_VALUE_GET(x) (((x) & MAC_PCU_SELF_GEN_ANTENNA_MASK_VALUE_MASK) >> MAC_PCU_SELF_GEN_ANTENNA_MASK_VALUE_LSB) -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_VALUE_SET(x) (((x) << MAC_PCU_SELF_GEN_ANTENNA_MASK_VALUE_LSB) & MAC_PCU_SELF_GEN_ANTENNA_MASK_VALUE_MASK) - -#define MAC_PCU_BA_BAR_CONTROL_ADDRESS 0x00008130 -#define MAC_PCU_BA_BAR_CONTROL_OFFSET 0x00000130 -#define MAC_PCU_BA_BAR_CONTROL_UPDATE_BA_BITMAP_QOS_NULL_MSB 12 -#define MAC_PCU_BA_BAR_CONTROL_UPDATE_BA_BITMAP_QOS_NULL_LSB 12 -#define MAC_PCU_BA_BAR_CONTROL_UPDATE_BA_BITMAP_QOS_NULL_MASK 0x00001000 -#define MAC_PCU_BA_BAR_CONTROL_UPDATE_BA_BITMAP_QOS_NULL_GET(x) (((x) & MAC_PCU_BA_BAR_CONTROL_UPDATE_BA_BITMAP_QOS_NULL_MASK) >> MAC_PCU_BA_BAR_CONTROL_UPDATE_BA_BITMAP_QOS_NULL_LSB) -#define MAC_PCU_BA_BAR_CONTROL_UPDATE_BA_BITMAP_QOS_NULL_SET(x) (((x) << MAC_PCU_BA_BAR_CONTROL_UPDATE_BA_BITMAP_QOS_NULL_LSB) & MAC_PCU_BA_BAR_CONTROL_UPDATE_BA_BITMAP_QOS_NULL_MASK) -#define MAC_PCU_BA_BAR_CONTROL_TX_BA_CLEAR_BA_VALID_MSB 11 -#define MAC_PCU_BA_BAR_CONTROL_TX_BA_CLEAR_BA_VALID_LSB 11 -#define MAC_PCU_BA_BAR_CONTROL_TX_BA_CLEAR_BA_VALID_MASK 0x00000800 -#define MAC_PCU_BA_BAR_CONTROL_TX_BA_CLEAR_BA_VALID_GET(x) (((x) & MAC_PCU_BA_BAR_CONTROL_TX_BA_CLEAR_BA_VALID_MASK) >> MAC_PCU_BA_BAR_CONTROL_TX_BA_CLEAR_BA_VALID_LSB) -#define MAC_PCU_BA_BAR_CONTROL_TX_BA_CLEAR_BA_VALID_SET(x) (((x) << MAC_PCU_BA_BAR_CONTROL_TX_BA_CLEAR_BA_VALID_LSB) & MAC_PCU_BA_BAR_CONTROL_TX_BA_CLEAR_BA_VALID_MASK) -#define MAC_PCU_BA_BAR_CONTROL_FORCE_NO_MATCH_MSB 10 -#define MAC_PCU_BA_BAR_CONTROL_FORCE_NO_MATCH_LSB 10 -#define MAC_PCU_BA_BAR_CONTROL_FORCE_NO_MATCH_MASK 0x00000400 -#define MAC_PCU_BA_BAR_CONTROL_FORCE_NO_MATCH_GET(x) (((x) & MAC_PCU_BA_BAR_CONTROL_FORCE_NO_MATCH_MASK) >> MAC_PCU_BA_BAR_CONTROL_FORCE_NO_MATCH_LSB) -#define MAC_PCU_BA_BAR_CONTROL_FORCE_NO_MATCH_SET(x) (((x) << MAC_PCU_BA_BAR_CONTROL_FORCE_NO_MATCH_LSB) & MAC_PCU_BA_BAR_CONTROL_FORCE_NO_MATCH_MASK) -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_VALUE_MSB 9 -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_VALUE_LSB 9 -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_VALUE_MASK 0x00000200 -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_VALUE_GET(x) (((x) & MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_VALUE_MASK) >> MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_VALUE_LSB) -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_VALUE_SET(x) (((x) << MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_VALUE_LSB) & MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_VALUE_MASK) -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_VALUE_MSB 8 -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_VALUE_LSB 8 -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_VALUE_MASK 0x00000100 -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_VALUE_GET(x) (((x) & MAC_PCU_BA_BAR_CONTROL_COMPRESSED_VALUE_MASK) >> MAC_PCU_BA_BAR_CONTROL_COMPRESSED_VALUE_LSB) -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_VALUE_SET(x) (((x) << MAC_PCU_BA_BAR_CONTROL_COMPRESSED_VALUE_LSB) & MAC_PCU_BA_BAR_CONTROL_COMPRESSED_VALUE_MASK) -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_OFFSET_MSB 7 -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_OFFSET_LSB 4 -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_OFFSET_MASK 0x000000f0 -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_OFFSET_GET(x) (((x) & MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_OFFSET_MASK) >> MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_OFFSET_LSB) -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_OFFSET_SET(x) (((x) << MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_OFFSET_LSB) & MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_OFFSET_MASK) -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_OFFSET_MSB 3 -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_OFFSET_LSB 0 -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_OFFSET_MASK 0x0000000f -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_OFFSET_GET(x) (((x) & MAC_PCU_BA_BAR_CONTROL_COMPRESSED_OFFSET_MASK) >> MAC_PCU_BA_BAR_CONTROL_COMPRESSED_OFFSET_LSB) -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_OFFSET_SET(x) (((x) << MAC_PCU_BA_BAR_CONTROL_COMPRESSED_OFFSET_LSB) & MAC_PCU_BA_BAR_CONTROL_COMPRESSED_OFFSET_MASK) - -#define MAC_PCU_LEGACY_PLCP_SPOOF_ADDRESS 0x00008134 -#define MAC_PCU_LEGACY_PLCP_SPOOF_OFFSET 0x00000134 -#define MAC_PCU_LEGACY_PLCP_SPOOF_MIN_LENGTH_MSB 12 -#define MAC_PCU_LEGACY_PLCP_SPOOF_MIN_LENGTH_LSB 8 -#define MAC_PCU_LEGACY_PLCP_SPOOF_MIN_LENGTH_MASK 0x00001f00 -#define MAC_PCU_LEGACY_PLCP_SPOOF_MIN_LENGTH_GET(x) (((x) & MAC_PCU_LEGACY_PLCP_SPOOF_MIN_LENGTH_MASK) >> MAC_PCU_LEGACY_PLCP_SPOOF_MIN_LENGTH_LSB) -#define MAC_PCU_LEGACY_PLCP_SPOOF_MIN_LENGTH_SET(x) (((x) << MAC_PCU_LEGACY_PLCP_SPOOF_MIN_LENGTH_LSB) & MAC_PCU_LEGACY_PLCP_SPOOF_MIN_LENGTH_MASK) -#define MAC_PCU_LEGACY_PLCP_SPOOF_EIFS_MINUS_DIFS_MSB 7 -#define MAC_PCU_LEGACY_PLCP_SPOOF_EIFS_MINUS_DIFS_LSB 0 -#define MAC_PCU_LEGACY_PLCP_SPOOF_EIFS_MINUS_DIFS_MASK 0x000000ff -#define MAC_PCU_LEGACY_PLCP_SPOOF_EIFS_MINUS_DIFS_GET(x) (((x) & MAC_PCU_LEGACY_PLCP_SPOOF_EIFS_MINUS_DIFS_MASK) >> MAC_PCU_LEGACY_PLCP_SPOOF_EIFS_MINUS_DIFS_LSB) -#define MAC_PCU_LEGACY_PLCP_SPOOF_EIFS_MINUS_DIFS_SET(x) (((x) << MAC_PCU_LEGACY_PLCP_SPOOF_EIFS_MINUS_DIFS_LSB) & MAC_PCU_LEGACY_PLCP_SPOOF_EIFS_MINUS_DIFS_MASK) - -#define MAC_PCU_PHY_ERROR_MASK_CONT_ADDRESS 0x00008138 -#define MAC_PCU_PHY_ERROR_MASK_CONT_OFFSET 0x00000138 -#define MAC_PCU_PHY_ERROR_MASK_CONT_EIFS_VALUE_MSB 23 -#define MAC_PCU_PHY_ERROR_MASK_CONT_EIFS_VALUE_LSB 16 -#define MAC_PCU_PHY_ERROR_MASK_CONT_EIFS_VALUE_MASK 0x00ff0000 -#define MAC_PCU_PHY_ERROR_MASK_CONT_EIFS_VALUE_GET(x) (((x) & MAC_PCU_PHY_ERROR_MASK_CONT_EIFS_VALUE_MASK) >> MAC_PCU_PHY_ERROR_MASK_CONT_EIFS_VALUE_LSB) -#define MAC_PCU_PHY_ERROR_MASK_CONT_EIFS_VALUE_SET(x) (((x) << MAC_PCU_PHY_ERROR_MASK_CONT_EIFS_VALUE_LSB) & MAC_PCU_PHY_ERROR_MASK_CONT_EIFS_VALUE_MASK) -#define MAC_PCU_PHY_ERROR_MASK_CONT_MASK_VALUE_MSB 7 -#define MAC_PCU_PHY_ERROR_MASK_CONT_MASK_VALUE_LSB 0 -#define MAC_PCU_PHY_ERROR_MASK_CONT_MASK_VALUE_MASK 0x000000ff -#define MAC_PCU_PHY_ERROR_MASK_CONT_MASK_VALUE_GET(x) (((x) & MAC_PCU_PHY_ERROR_MASK_CONT_MASK_VALUE_MASK) >> MAC_PCU_PHY_ERROR_MASK_CONT_MASK_VALUE_LSB) -#define MAC_PCU_PHY_ERROR_MASK_CONT_MASK_VALUE_SET(x) (((x) << MAC_PCU_PHY_ERROR_MASK_CONT_MASK_VALUE_LSB) & MAC_PCU_PHY_ERROR_MASK_CONT_MASK_VALUE_MASK) - -#define MAC_PCU_TX_TIMER_ADDRESS 0x0000813c -#define MAC_PCU_TX_TIMER_OFFSET 0x0000013c -#define MAC_PCU_TX_TIMER_QUIET_TIMER_ENABLE_MSB 25 -#define MAC_PCU_TX_TIMER_QUIET_TIMER_ENABLE_LSB 25 -#define MAC_PCU_TX_TIMER_QUIET_TIMER_ENABLE_MASK 0x02000000 -#define MAC_PCU_TX_TIMER_QUIET_TIMER_ENABLE_GET(x) (((x) & MAC_PCU_TX_TIMER_QUIET_TIMER_ENABLE_MASK) >> MAC_PCU_TX_TIMER_QUIET_TIMER_ENABLE_LSB) -#define MAC_PCU_TX_TIMER_QUIET_TIMER_ENABLE_SET(x) (((x) << MAC_PCU_TX_TIMER_QUIET_TIMER_ENABLE_LSB) & MAC_PCU_TX_TIMER_QUIET_TIMER_ENABLE_MASK) -#define MAC_PCU_TX_TIMER_QUIET_TIMER_MSB 24 -#define MAC_PCU_TX_TIMER_QUIET_TIMER_LSB 20 -#define MAC_PCU_TX_TIMER_QUIET_TIMER_MASK 0x01f00000 -#define MAC_PCU_TX_TIMER_QUIET_TIMER_GET(x) (((x) & MAC_PCU_TX_TIMER_QUIET_TIMER_MASK) >> MAC_PCU_TX_TIMER_QUIET_TIMER_LSB) -#define MAC_PCU_TX_TIMER_QUIET_TIMER_SET(x) (((x) << MAC_PCU_TX_TIMER_QUIET_TIMER_LSB) & MAC_PCU_TX_TIMER_QUIET_TIMER_MASK) -#define MAC_PCU_TX_TIMER_RIFS_TIMER_MSB 19 -#define MAC_PCU_TX_TIMER_RIFS_TIMER_LSB 16 -#define MAC_PCU_TX_TIMER_RIFS_TIMER_MASK 0x000f0000 -#define MAC_PCU_TX_TIMER_RIFS_TIMER_GET(x) (((x) & MAC_PCU_TX_TIMER_RIFS_TIMER_MASK) >> MAC_PCU_TX_TIMER_RIFS_TIMER_LSB) -#define MAC_PCU_TX_TIMER_RIFS_TIMER_SET(x) (((x) << MAC_PCU_TX_TIMER_RIFS_TIMER_LSB) & MAC_PCU_TX_TIMER_RIFS_TIMER_MASK) -#define MAC_PCU_TX_TIMER_TX_TIMER_ENABLE_MSB 15 -#define MAC_PCU_TX_TIMER_TX_TIMER_ENABLE_LSB 15 -#define MAC_PCU_TX_TIMER_TX_TIMER_ENABLE_MASK 0x00008000 -#define MAC_PCU_TX_TIMER_TX_TIMER_ENABLE_GET(x) (((x) & MAC_PCU_TX_TIMER_TX_TIMER_ENABLE_MASK) >> MAC_PCU_TX_TIMER_TX_TIMER_ENABLE_LSB) -#define MAC_PCU_TX_TIMER_TX_TIMER_ENABLE_SET(x) (((x) << MAC_PCU_TX_TIMER_TX_TIMER_ENABLE_LSB) & MAC_PCU_TX_TIMER_TX_TIMER_ENABLE_MASK) -#define MAC_PCU_TX_TIMER_TX_TIMER_MSB 14 -#define MAC_PCU_TX_TIMER_TX_TIMER_LSB 0 -#define MAC_PCU_TX_TIMER_TX_TIMER_MASK 0x00007fff -#define MAC_PCU_TX_TIMER_TX_TIMER_GET(x) (((x) & MAC_PCU_TX_TIMER_TX_TIMER_MASK) >> MAC_PCU_TX_TIMER_TX_TIMER_LSB) -#define MAC_PCU_TX_TIMER_TX_TIMER_SET(x) (((x) << MAC_PCU_TX_TIMER_TX_TIMER_LSB) & MAC_PCU_TX_TIMER_TX_TIMER_MASK) - -#define MAC_PCU_TXBUF_CTRL_ADDRESS 0x00008140 -#define MAC_PCU_TXBUF_CTRL_OFFSET 0x00000140 -#define MAC_PCU_TXBUF_CTRL_TX_FIFO_WRAP_ENABLE_MSB 16 -#define MAC_PCU_TXBUF_CTRL_TX_FIFO_WRAP_ENABLE_LSB 16 -#define MAC_PCU_TXBUF_CTRL_TX_FIFO_WRAP_ENABLE_MASK 0x00010000 -#define MAC_PCU_TXBUF_CTRL_TX_FIFO_WRAP_ENABLE_GET(x) (((x) & MAC_PCU_TXBUF_CTRL_TX_FIFO_WRAP_ENABLE_MASK) >> MAC_PCU_TXBUF_CTRL_TX_FIFO_WRAP_ENABLE_LSB) -#define MAC_PCU_TXBUF_CTRL_TX_FIFO_WRAP_ENABLE_SET(x) (((x) << MAC_PCU_TXBUF_CTRL_TX_FIFO_WRAP_ENABLE_LSB) & MAC_PCU_TXBUF_CTRL_TX_FIFO_WRAP_ENABLE_MASK) -#define MAC_PCU_TXBUF_CTRL_USABLE_ENTRIES_MSB 11 -#define MAC_PCU_TXBUF_CTRL_USABLE_ENTRIES_LSB 0 -#define MAC_PCU_TXBUF_CTRL_USABLE_ENTRIES_MASK 0x00000fff -#define MAC_PCU_TXBUF_CTRL_USABLE_ENTRIES_GET(x) (((x) & MAC_PCU_TXBUF_CTRL_USABLE_ENTRIES_MASK) >> MAC_PCU_TXBUF_CTRL_USABLE_ENTRIES_LSB) -#define MAC_PCU_TXBUF_CTRL_USABLE_ENTRIES_SET(x) (((x) << MAC_PCU_TXBUF_CTRL_USABLE_ENTRIES_LSB) & MAC_PCU_TXBUF_CTRL_USABLE_ENTRIES_MASK) - -#define MAC_PCU_MISC_MODE2_ADDRESS 0x00008144 -#define MAC_PCU_MISC_MODE2_OFFSET 0x00000144 -#define MAC_PCU_MISC_MODE2_RESERVED_1_MSB 31 -#define MAC_PCU_MISC_MODE2_RESERVED_1_LSB 28 -#define MAC_PCU_MISC_MODE2_RESERVED_1_MASK 0xf0000000 -#define MAC_PCU_MISC_MODE2_RESERVED_1_GET(x) (((x) & MAC_PCU_MISC_MODE2_RESERVED_1_MASK) >> MAC_PCU_MISC_MODE2_RESERVED_1_LSB) -#define MAC_PCU_MISC_MODE2_RESERVED_1_SET(x) (((x) << MAC_PCU_MISC_MODE2_RESERVED_1_LSB) & MAC_PCU_MISC_MODE2_RESERVED_1_MASK) -#define MAC_PCU_MISC_MODE2_RCV_TIMESTAMP_FIX_MSB 27 -#define MAC_PCU_MISC_MODE2_RCV_TIMESTAMP_FIX_LSB 27 -#define MAC_PCU_MISC_MODE2_RCV_TIMESTAMP_FIX_MASK 0x08000000 -#define MAC_PCU_MISC_MODE2_RCV_TIMESTAMP_FIX_GET(x) (((x) & MAC_PCU_MISC_MODE2_RCV_TIMESTAMP_FIX_MASK) >> MAC_PCU_MISC_MODE2_RCV_TIMESTAMP_FIX_LSB) -#define MAC_PCU_MISC_MODE2_RCV_TIMESTAMP_FIX_SET(x) (((x) << MAC_PCU_MISC_MODE2_RCV_TIMESTAMP_FIX_LSB) & MAC_PCU_MISC_MODE2_RCV_TIMESTAMP_FIX_MASK) -#define MAC_PCU_MISC_MODE2_BEACON_FROM_TO_DS_MSB 26 -#define MAC_PCU_MISC_MODE2_BEACON_FROM_TO_DS_LSB 26 -#define MAC_PCU_MISC_MODE2_BEACON_FROM_TO_DS_MASK 0x04000000 -#define MAC_PCU_MISC_MODE2_BEACON_FROM_TO_DS_GET(x) (((x) & MAC_PCU_MISC_MODE2_BEACON_FROM_TO_DS_MASK) >> MAC_PCU_MISC_MODE2_BEACON_FROM_TO_DS_LSB) -#define MAC_PCU_MISC_MODE2_BEACON_FROM_TO_DS_SET(x) (((x) << MAC_PCU_MISC_MODE2_BEACON_FROM_TO_DS_LSB) & MAC_PCU_MISC_MODE2_BEACON_FROM_TO_DS_MASK) -#define MAC_PCU_MISC_MODE2_PM_FIELD_FOR_MGMT_MSB 25 -#define MAC_PCU_MISC_MODE2_PM_FIELD_FOR_MGMT_LSB 25 -#define MAC_PCU_MISC_MODE2_PM_FIELD_FOR_MGMT_MASK 0x02000000 -#define MAC_PCU_MISC_MODE2_PM_FIELD_FOR_MGMT_GET(x) (((x) & MAC_PCU_MISC_MODE2_PM_FIELD_FOR_MGMT_MASK) >> MAC_PCU_MISC_MODE2_PM_FIELD_FOR_MGMT_LSB) -#define MAC_PCU_MISC_MODE2_PM_FIELD_FOR_MGMT_SET(x) (((x) << MAC_PCU_MISC_MODE2_PM_FIELD_FOR_MGMT_LSB) & MAC_PCU_MISC_MODE2_PM_FIELD_FOR_MGMT_MASK) -#define MAC_PCU_MISC_MODE2_PM_FIELD_FOR_DAT_MSB 24 -#define MAC_PCU_MISC_MODE2_PM_FIELD_FOR_DAT_LSB 24 -#define MAC_PCU_MISC_MODE2_PM_FIELD_FOR_DAT_MASK 0x01000000 -#define MAC_PCU_MISC_MODE2_PM_FIELD_FOR_DAT_GET(x) (((x) & MAC_PCU_MISC_MODE2_PM_FIELD_FOR_DAT_MASK) >> MAC_PCU_MISC_MODE2_PM_FIELD_FOR_DAT_LSB) -#define MAC_PCU_MISC_MODE2_PM_FIELD_FOR_DAT_SET(x) (((x) << MAC_PCU_MISC_MODE2_PM_FIELD_FOR_DAT_LSB) & MAC_PCU_MISC_MODE2_PM_FIELD_FOR_DAT_MASK) -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_IF_ZERO_MSB 23 -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_IF_ZERO_LSB 23 -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_IF_ZERO_MASK 0x00800000 -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_IF_ZERO_GET(x) (((x) & MAC_PCU_MISC_MODE2_IGNORE_TXOP_IF_ZERO_MASK) >> MAC_PCU_MISC_MODE2_IGNORE_TXOP_IF_ZERO_LSB) -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_IF_ZERO_SET(x) (((x) << MAC_PCU_MISC_MODE2_IGNORE_TXOP_IF_ZERO_LSB) & MAC_PCU_MISC_MODE2_IGNORE_TXOP_IF_ZERO_MASK) -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_1ST_PKT_MSB 22 -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_1ST_PKT_LSB 22 -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_1ST_PKT_MASK 0x00400000 -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_1ST_PKT_GET(x) (((x) & MAC_PCU_MISC_MODE2_IGNORE_TXOP_1ST_PKT_MASK) >> MAC_PCU_MISC_MODE2_IGNORE_TXOP_1ST_PKT_LSB) -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_1ST_PKT_SET(x) (((x) << MAC_PCU_MISC_MODE2_IGNORE_TXOP_1ST_PKT_LSB) & MAC_PCU_MISC_MODE2_IGNORE_TXOP_1ST_PKT_MASK) -#define MAC_PCU_MISC_MODE2_CLEAR_MORE_FRAG_MSB 21 -#define MAC_PCU_MISC_MODE2_CLEAR_MORE_FRAG_LSB 21 -#define MAC_PCU_MISC_MODE2_CLEAR_MORE_FRAG_MASK 0x00200000 -#define MAC_PCU_MISC_MODE2_CLEAR_MORE_FRAG_GET(x) (((x) & MAC_PCU_MISC_MODE2_CLEAR_MORE_FRAG_MASK) >> MAC_PCU_MISC_MODE2_CLEAR_MORE_FRAG_LSB) -#define MAC_PCU_MISC_MODE2_CLEAR_MORE_FRAG_SET(x) (((x) << MAC_PCU_MISC_MODE2_CLEAR_MORE_FRAG_LSB) & MAC_PCU_MISC_MODE2_CLEAR_MORE_FRAG_MASK) -#define MAC_PCU_MISC_MODE2_BUG_28676_MSB 20 -#define MAC_PCU_MISC_MODE2_BUG_28676_LSB 20 -#define MAC_PCU_MISC_MODE2_BUG_28676_MASK 0x00100000 -#define MAC_PCU_MISC_MODE2_BUG_28676_GET(x) (((x) & MAC_PCU_MISC_MODE2_BUG_28676_MASK) >> MAC_PCU_MISC_MODE2_BUG_28676_LSB) -#define MAC_PCU_MISC_MODE2_BUG_28676_SET(x) (((x) << MAC_PCU_MISC_MODE2_BUG_28676_LSB) & MAC_PCU_MISC_MODE2_BUG_28676_MASK) -#define MAC_PCU_MISC_MODE2_DUR_ACCOUNT_BY_BA_MSB 19 -#define MAC_PCU_MISC_MODE2_DUR_ACCOUNT_BY_BA_LSB 19 -#define MAC_PCU_MISC_MODE2_DUR_ACCOUNT_BY_BA_MASK 0x00080000 -#define MAC_PCU_MISC_MODE2_DUR_ACCOUNT_BY_BA_GET(x) (((x) & MAC_PCU_MISC_MODE2_DUR_ACCOUNT_BY_BA_MASK) >> MAC_PCU_MISC_MODE2_DUR_ACCOUNT_BY_BA_LSB) -#define MAC_PCU_MISC_MODE2_DUR_ACCOUNT_BY_BA_SET(x) (((x) << MAC_PCU_MISC_MODE2_DUR_ACCOUNT_BY_BA_LSB) & MAC_PCU_MISC_MODE2_DUR_ACCOUNT_BY_BA_MASK) -#define MAC_PCU_MISC_MODE2_BC_MC_WAPI_MODE_MSB 18 -#define MAC_PCU_MISC_MODE2_BC_MC_WAPI_MODE_LSB 18 -#define MAC_PCU_MISC_MODE2_BC_MC_WAPI_MODE_MASK 0x00040000 -#define MAC_PCU_MISC_MODE2_BC_MC_WAPI_MODE_GET(x) (((x) & MAC_PCU_MISC_MODE2_BC_MC_WAPI_MODE_MASK) >> MAC_PCU_MISC_MODE2_BC_MC_WAPI_MODE_LSB) -#define MAC_PCU_MISC_MODE2_BC_MC_WAPI_MODE_SET(x) (((x) << MAC_PCU_MISC_MODE2_BC_MC_WAPI_MODE_LSB) & MAC_PCU_MISC_MODE2_BC_MC_WAPI_MODE_MASK) -#define MAC_PCU_MISC_MODE2_AGG_WEP_MSB 17 -#define MAC_PCU_MISC_MODE2_AGG_WEP_LSB 17 -#define MAC_PCU_MISC_MODE2_AGG_WEP_MASK 0x00020000 -#define MAC_PCU_MISC_MODE2_AGG_WEP_GET(x) (((x) & MAC_PCU_MISC_MODE2_AGG_WEP_MASK) >> MAC_PCU_MISC_MODE2_AGG_WEP_LSB) -#define MAC_PCU_MISC_MODE2_AGG_WEP_SET(x) (((x) << MAC_PCU_MISC_MODE2_AGG_WEP_LSB) & MAC_PCU_MISC_MODE2_AGG_WEP_MASK) -#define MAC_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION_MSB 16 -#define MAC_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION_LSB 16 -#define MAC_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION_MASK 0x00010000 -#define MAC_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION_GET(x) (((x) & MAC_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION_MASK) >> MAC_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION_LSB) -#define MAC_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION_SET(x) (((x) << MAC_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION_LSB) & MAC_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION_MASK) -#define MAC_PCU_MISC_MODE2_MGMT_QOS_MSB 15 -#define MAC_PCU_MISC_MODE2_MGMT_QOS_LSB 8 -#define MAC_PCU_MISC_MODE2_MGMT_QOS_MASK 0x0000ff00 -#define MAC_PCU_MISC_MODE2_MGMT_QOS_GET(x) (((x) & MAC_PCU_MISC_MODE2_MGMT_QOS_MASK) >> MAC_PCU_MISC_MODE2_MGMT_QOS_LSB) -#define MAC_PCU_MISC_MODE2_MGMT_QOS_SET(x) (((x) << MAC_PCU_MISC_MODE2_MGMT_QOS_LSB) & MAC_PCU_MISC_MODE2_MGMT_QOS_MASK) -#define MAC_PCU_MISC_MODE2_CFP_IGNORE_MSB 7 -#define MAC_PCU_MISC_MODE2_CFP_IGNORE_LSB 7 -#define MAC_PCU_MISC_MODE2_CFP_IGNORE_MASK 0x00000080 -#define MAC_PCU_MISC_MODE2_CFP_IGNORE_GET(x) (((x) & MAC_PCU_MISC_MODE2_CFP_IGNORE_MASK) >> MAC_PCU_MISC_MODE2_CFP_IGNORE_LSB) -#define MAC_PCU_MISC_MODE2_CFP_IGNORE_SET(x) (((x) << MAC_PCU_MISC_MODE2_CFP_IGNORE_LSB) & MAC_PCU_MISC_MODE2_CFP_IGNORE_MASK) -#define MAC_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE_MSB 6 -#define MAC_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE_LSB 6 -#define MAC_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE_MASK 0x00000040 -#define MAC_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE_GET(x) (((x) & MAC_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE_MASK) >> MAC_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE_LSB) -#define MAC_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE_SET(x) (((x) << MAC_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE_LSB) & MAC_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE_MASK) -#define MAC_PCU_MISC_MODE2_RESERVED_2_MSB 5 -#define MAC_PCU_MISC_MODE2_RESERVED_2_LSB 5 -#define MAC_PCU_MISC_MODE2_RESERVED_2_MASK 0x00000020 -#define MAC_PCU_MISC_MODE2_RESERVED_2_GET(x) (((x) & MAC_PCU_MISC_MODE2_RESERVED_2_MASK) >> MAC_PCU_MISC_MODE2_RESERVED_2_LSB) -#define MAC_PCU_MISC_MODE2_RESERVED_2_SET(x) (((x) << MAC_PCU_MISC_MODE2_RESERVED_2_LSB) & MAC_PCU_MISC_MODE2_RESERVED_2_MASK) -#define MAC_PCU_MISC_MODE2_BUG_58057_FIX_ENABLE_MSB 4 -#define MAC_PCU_MISC_MODE2_BUG_58057_FIX_ENABLE_LSB 4 -#define MAC_PCU_MISC_MODE2_BUG_58057_FIX_ENABLE_MASK 0x00000010 -#define MAC_PCU_MISC_MODE2_BUG_58057_FIX_ENABLE_GET(x) (((x) & MAC_PCU_MISC_MODE2_BUG_58057_FIX_ENABLE_MASK) >> MAC_PCU_MISC_MODE2_BUG_58057_FIX_ENABLE_LSB) -#define MAC_PCU_MISC_MODE2_BUG_58057_FIX_ENABLE_SET(x) (((x) << MAC_PCU_MISC_MODE2_BUG_58057_FIX_ENABLE_LSB) & MAC_PCU_MISC_MODE2_BUG_58057_FIX_ENABLE_MASK) -#define MAC_PCU_MISC_MODE2_RESERVED_0_MSB 3 -#define MAC_PCU_MISC_MODE2_RESERVED_0_LSB 3 -#define MAC_PCU_MISC_MODE2_RESERVED_0_MASK 0x00000008 -#define MAC_PCU_MISC_MODE2_RESERVED_0_GET(x) (((x) & MAC_PCU_MISC_MODE2_RESERVED_0_MASK) >> MAC_PCU_MISC_MODE2_RESERVED_0_LSB) -#define MAC_PCU_MISC_MODE2_RESERVED_0_SET(x) (((x) << MAC_PCU_MISC_MODE2_RESERVED_0_LSB) & MAC_PCU_MISC_MODE2_RESERVED_0_MASK) -#define MAC_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT_MSB 2 -#define MAC_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT_LSB 2 -#define MAC_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT_MASK 0x00000004 -#define MAC_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT_GET(x) (((x) & MAC_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT_MASK) >> MAC_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT_LSB) -#define MAC_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT_SET(x) (((x) << MAC_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT_LSB) & MAC_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT_MASK) -#define MAC_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE_MSB 1 -#define MAC_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE_LSB 1 -#define MAC_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE_MASK 0x00000002 -#define MAC_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE_GET(x) (((x) & MAC_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE_MASK) >> MAC_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE_LSB) -#define MAC_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE_SET(x) (((x) << MAC_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE_LSB) & MAC_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE_MASK) -#define MAC_PCU_MISC_MODE2_BUG_21532_FIX_ENABLE_MSB 0 -#define MAC_PCU_MISC_MODE2_BUG_21532_FIX_ENABLE_LSB 0 -#define MAC_PCU_MISC_MODE2_BUG_21532_FIX_ENABLE_MASK 0x00000001 -#define MAC_PCU_MISC_MODE2_BUG_21532_FIX_ENABLE_GET(x) (((x) & MAC_PCU_MISC_MODE2_BUG_21532_FIX_ENABLE_MASK) >> MAC_PCU_MISC_MODE2_BUG_21532_FIX_ENABLE_LSB) -#define MAC_PCU_MISC_MODE2_BUG_21532_FIX_ENABLE_SET(x) (((x) << MAC_PCU_MISC_MODE2_BUG_21532_FIX_ENABLE_LSB) & MAC_PCU_MISC_MODE2_BUG_21532_FIX_ENABLE_MASK) - -#define MAC_PCU_ALT_AES_MUTE_MASK_ADDRESS 0x00008148 -#define MAC_PCU_ALT_AES_MUTE_MASK_OFFSET 0x00000148 -#define MAC_PCU_ALT_AES_MUTE_MASK_QOS_MSB 31 -#define MAC_PCU_ALT_AES_MUTE_MASK_QOS_LSB 16 -#define MAC_PCU_ALT_AES_MUTE_MASK_QOS_MASK 0xffff0000 -#define MAC_PCU_ALT_AES_MUTE_MASK_QOS_GET(x) (((x) & MAC_PCU_ALT_AES_MUTE_MASK_QOS_MASK) >> MAC_PCU_ALT_AES_MUTE_MASK_QOS_LSB) -#define MAC_PCU_ALT_AES_MUTE_MASK_QOS_SET(x) (((x) << MAC_PCU_ALT_AES_MUTE_MASK_QOS_LSB) & MAC_PCU_ALT_AES_MUTE_MASK_QOS_MASK) - -#define MAC_PCU_AZIMUTH_TIME_STAMP_ADDRESS 0x0000814c -#define MAC_PCU_AZIMUTH_TIME_STAMP_OFFSET 0x0000014c -#define MAC_PCU_AZIMUTH_TIME_STAMP_VALUE_MSB 31 -#define MAC_PCU_AZIMUTH_TIME_STAMP_VALUE_LSB 0 -#define MAC_PCU_AZIMUTH_TIME_STAMP_VALUE_MASK 0xffffffff -#define MAC_PCU_AZIMUTH_TIME_STAMP_VALUE_GET(x) (((x) & MAC_PCU_AZIMUTH_TIME_STAMP_VALUE_MASK) >> MAC_PCU_AZIMUTH_TIME_STAMP_VALUE_LSB) -#define MAC_PCU_AZIMUTH_TIME_STAMP_VALUE_SET(x) (((x) << MAC_PCU_AZIMUTH_TIME_STAMP_VALUE_LSB) & MAC_PCU_AZIMUTH_TIME_STAMP_VALUE_MASK) - -#define MAC_PCU_MAX_CFP_DUR_ADDRESS 0x00008150 -#define MAC_PCU_MAX_CFP_DUR_OFFSET 0x00000150 -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_DENOMINATOR_MSB 7 -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_DENOMINATOR_LSB 4 -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_DENOMINATOR_MASK 0x000000f0 -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_DENOMINATOR_GET(x) (((x) & MAC_PCU_MAX_CFP_DUR_USEC_FRAC_DENOMINATOR_MASK) >> MAC_PCU_MAX_CFP_DUR_USEC_FRAC_DENOMINATOR_LSB) -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_DENOMINATOR_SET(x) (((x) << MAC_PCU_MAX_CFP_DUR_USEC_FRAC_DENOMINATOR_LSB) & MAC_PCU_MAX_CFP_DUR_USEC_FRAC_DENOMINATOR_MASK) -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_NUMERATOR_MSB 3 -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_NUMERATOR_LSB 0 -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_NUMERATOR_MASK 0x0000000f -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_NUMERATOR_GET(x) (((x) & MAC_PCU_MAX_CFP_DUR_USEC_FRAC_NUMERATOR_MASK) >> MAC_PCU_MAX_CFP_DUR_USEC_FRAC_NUMERATOR_LSB) -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_NUMERATOR_SET(x) (((x) << MAC_PCU_MAX_CFP_DUR_USEC_FRAC_NUMERATOR_LSB) & MAC_PCU_MAX_CFP_DUR_USEC_FRAC_NUMERATOR_MASK) - -#define MAC_PCU_HCF_TIMEOUT_ADDRESS 0x00008154 -#define MAC_PCU_HCF_TIMEOUT_OFFSET 0x00000154 -#define MAC_PCU_HCF_TIMEOUT_VALUE_MSB 15 -#define MAC_PCU_HCF_TIMEOUT_VALUE_LSB 0 -#define MAC_PCU_HCF_TIMEOUT_VALUE_MASK 0x0000ffff -#define MAC_PCU_HCF_TIMEOUT_VALUE_GET(x) (((x) & MAC_PCU_HCF_TIMEOUT_VALUE_MASK) >> MAC_PCU_HCF_TIMEOUT_VALUE_LSB) -#define MAC_PCU_HCF_TIMEOUT_VALUE_SET(x) (((x) << MAC_PCU_HCF_TIMEOUT_VALUE_LSB) & MAC_PCU_HCF_TIMEOUT_VALUE_MASK) - -#define MAC_PCU_BLUETOOTH_WEIGHTS2_ADDRESS 0x00008158 -#define MAC_PCU_BLUETOOTH_WEIGHTS2_OFFSET 0x00000158 -#define MAC_PCU_BLUETOOTH_WEIGHTS2_WL_WEIGHT_CONTD_MSB 31 -#define MAC_PCU_BLUETOOTH_WEIGHTS2_WL_WEIGHT_CONTD_LSB 16 -#define MAC_PCU_BLUETOOTH_WEIGHTS2_WL_WEIGHT_CONTD_MASK 0xffff0000 -#define MAC_PCU_BLUETOOTH_WEIGHTS2_WL_WEIGHT_CONTD_GET(x) (((x) & MAC_PCU_BLUETOOTH_WEIGHTS2_WL_WEIGHT_CONTD_MASK) >> MAC_PCU_BLUETOOTH_WEIGHTS2_WL_WEIGHT_CONTD_LSB) -#define MAC_PCU_BLUETOOTH_WEIGHTS2_WL_WEIGHT_CONTD_SET(x) (((x) << MAC_PCU_BLUETOOTH_WEIGHTS2_WL_WEIGHT_CONTD_LSB) & MAC_PCU_BLUETOOTH_WEIGHTS2_WL_WEIGHT_CONTD_MASK) - -#define MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_ADDRESS 0x0000815c -#define MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_OFFSET 0x0000015c -#define MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_VALUE_MSB 31 -#define MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_VALUE_LSB 0 -#define MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_VALUE_MASK 0xffffffff -#define MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_VALUE_GET(x) (((x) & MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_VALUE_MASK) >> MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_VALUE_LSB) -#define MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_VALUE_SET(x) (((x) << MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_VALUE_LSB) & MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_VALUE_MASK) - -#define MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_ADDRESS 0x00008160 -#define MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_OFFSET 0x00000160 -#define MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_VALUE_MSB 31 -#define MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_VALUE_LSB 0 -#define MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_VALUE_MASK 0xffffffff -#define MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_VALUE_GET(x) (((x) & MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_VALUE_MASK) >> MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_VALUE_LSB) -#define MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_VALUE_SET(x) (((x) << MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_VALUE_LSB) & MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_VALUE_MASK) - -#define MAC_PCU_BLUETOOTH_MODE3_ADDRESS 0x00008164 -#define MAC_PCU_BLUETOOTH_MODE3_OFFSET 0x00000164 -#define MAC_PCU_BLUETOOTH_MODE3_BT_PRIORITY_EXTEND_THRES_MSB 31 -#define MAC_PCU_BLUETOOTH_MODE3_BT_PRIORITY_EXTEND_THRES_LSB 28 -#define MAC_PCU_BLUETOOTH_MODE3_BT_PRIORITY_EXTEND_THRES_MASK 0xf0000000 -#define MAC_PCU_BLUETOOTH_MODE3_BT_PRIORITY_EXTEND_THRES_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE3_BT_PRIORITY_EXTEND_THRES_MASK) >> MAC_PCU_BLUETOOTH_MODE3_BT_PRIORITY_EXTEND_THRES_LSB) -#define MAC_PCU_BLUETOOTH_MODE3_BT_PRIORITY_EXTEND_THRES_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE3_BT_PRIORITY_EXTEND_THRES_LSB) & MAC_PCU_BLUETOOTH_MODE3_BT_PRIORITY_EXTEND_THRES_MASK) -#define MAC_PCU_BLUETOOTH_MODE3_BT_TX_ON_EN_MSB 27 -#define MAC_PCU_BLUETOOTH_MODE3_BT_TX_ON_EN_LSB 27 -#define MAC_PCU_BLUETOOTH_MODE3_BT_TX_ON_EN_MASK 0x08000000 -#define MAC_PCU_BLUETOOTH_MODE3_BT_TX_ON_EN_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE3_BT_TX_ON_EN_MASK) >> MAC_PCU_BLUETOOTH_MODE3_BT_TX_ON_EN_LSB) -#define MAC_PCU_BLUETOOTH_MODE3_BT_TX_ON_EN_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE3_BT_TX_ON_EN_LSB) & MAC_PCU_BLUETOOTH_MODE3_BT_TX_ON_EN_MASK) -#define MAC_PCU_BLUETOOTH_MODE3_SLOT_SLOP_MSB 26 -#define MAC_PCU_BLUETOOTH_MODE3_SLOT_SLOP_LSB 25 -#define MAC_PCU_BLUETOOTH_MODE3_SLOT_SLOP_MASK 0x06000000 -#define MAC_PCU_BLUETOOTH_MODE3_SLOT_SLOP_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE3_SLOT_SLOP_MASK) >> MAC_PCU_BLUETOOTH_MODE3_SLOT_SLOP_LSB) -#define MAC_PCU_BLUETOOTH_MODE3_SLOT_SLOP_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE3_SLOT_SLOP_LSB) & MAC_PCU_BLUETOOTH_MODE3_SLOT_SLOP_MASK) -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_TOGGLE_WLA_EN_MSB 24 -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_TOGGLE_WLA_EN_LSB 24 -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_TOGGLE_WLA_EN_MASK 0x01000000 -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_TOGGLE_WLA_EN_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_TOGGLE_WLA_EN_MASK) >> MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_TOGGLE_WLA_EN_LSB) -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_TOGGLE_WLA_EN_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_TOGGLE_WLA_EN_LSB) & MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_TOGGLE_WLA_EN_MASK) -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_PRI_EN_MSB 23 -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_PRI_EN_LSB 23 -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_PRI_EN_MASK 0x00800000 -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_PRI_EN_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_PRI_EN_MASK) >> MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_PRI_EN_LSB) -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_PRI_EN_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_PRI_EN_LSB) & MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_PRI_EN_MASK) -#define MAC_PCU_BLUETOOTH_MODE3_RFGAIN_LOCK_SRC_MSB 22 -#define MAC_PCU_BLUETOOTH_MODE3_RFGAIN_LOCK_SRC_LSB 22 -#define MAC_PCU_BLUETOOTH_MODE3_RFGAIN_LOCK_SRC_MASK 0x00400000 -#define MAC_PCU_BLUETOOTH_MODE3_RFGAIN_LOCK_SRC_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE3_RFGAIN_LOCK_SRC_MASK) >> MAC_PCU_BLUETOOTH_MODE3_RFGAIN_LOCK_SRC_LSB) -#define MAC_PCU_BLUETOOTH_MODE3_RFGAIN_LOCK_SRC_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE3_RFGAIN_LOCK_SRC_LSB) & MAC_PCU_BLUETOOTH_MODE3_RFGAIN_LOCK_SRC_MASK) -#define MAC_PCU_BLUETOOTH_MODE3_WL_PRIORITY_OFFSET_EN_MSB 21 -#define MAC_PCU_BLUETOOTH_MODE3_WL_PRIORITY_OFFSET_EN_LSB 21 -#define MAC_PCU_BLUETOOTH_MODE3_WL_PRIORITY_OFFSET_EN_MASK 0x00200000 -#define MAC_PCU_BLUETOOTH_MODE3_WL_PRIORITY_OFFSET_EN_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE3_WL_PRIORITY_OFFSET_EN_MASK) >> MAC_PCU_BLUETOOTH_MODE3_WL_PRIORITY_OFFSET_EN_LSB) -#define MAC_PCU_BLUETOOTH_MODE3_WL_PRIORITY_OFFSET_EN_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE3_WL_PRIORITY_OFFSET_EN_LSB) & MAC_PCU_BLUETOOTH_MODE3_WL_PRIORITY_OFFSET_EN_MASK) -#define MAC_PCU_BLUETOOTH_MODE3_SHARED_RX_MSB 20 -#define MAC_PCU_BLUETOOTH_MODE3_SHARED_RX_LSB 20 -#define MAC_PCU_BLUETOOTH_MODE3_SHARED_RX_MASK 0x00100000 -#define MAC_PCU_BLUETOOTH_MODE3_SHARED_RX_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE3_SHARED_RX_MASK) >> MAC_PCU_BLUETOOTH_MODE3_SHARED_RX_LSB) -#define MAC_PCU_BLUETOOTH_MODE3_SHARED_RX_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE3_SHARED_RX_LSB) & MAC_PCU_BLUETOOTH_MODE3_SHARED_RX_MASK) -#define MAC_PCU_BLUETOOTH_MODE3_ALLOW_CONCURRENT_ACCESS_MSB 19 -#define MAC_PCU_BLUETOOTH_MODE3_ALLOW_CONCURRENT_ACCESS_LSB 16 -#define MAC_PCU_BLUETOOTH_MODE3_ALLOW_CONCURRENT_ACCESS_MASK 0x000f0000 -#define MAC_PCU_BLUETOOTH_MODE3_ALLOW_CONCURRENT_ACCESS_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE3_ALLOW_CONCURRENT_ACCESS_MASK) >> MAC_PCU_BLUETOOTH_MODE3_ALLOW_CONCURRENT_ACCESS_LSB) -#define MAC_PCU_BLUETOOTH_MODE3_ALLOW_CONCURRENT_ACCESS_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE3_ALLOW_CONCURRENT_ACCESS_LSB) & MAC_PCU_BLUETOOTH_MODE3_ALLOW_CONCURRENT_ACCESS_MASK) -#define MAC_PCU_BLUETOOTH_MODE3_WL_QC_TIME_MSB 15 -#define MAC_PCU_BLUETOOTH_MODE3_WL_QC_TIME_LSB 8 -#define MAC_PCU_BLUETOOTH_MODE3_WL_QC_TIME_MASK 0x0000ff00 -#define MAC_PCU_BLUETOOTH_MODE3_WL_QC_TIME_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE3_WL_QC_TIME_MASK) >> MAC_PCU_BLUETOOTH_MODE3_WL_QC_TIME_LSB) -#define MAC_PCU_BLUETOOTH_MODE3_WL_QC_TIME_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE3_WL_QC_TIME_LSB) & MAC_PCU_BLUETOOTH_MODE3_WL_QC_TIME_MASK) -#define MAC_PCU_BLUETOOTH_MODE3_WL_ACTIVE_TIME_MSB 7 -#define MAC_PCU_BLUETOOTH_MODE3_WL_ACTIVE_TIME_LSB 0 -#define MAC_PCU_BLUETOOTH_MODE3_WL_ACTIVE_TIME_MASK 0x000000ff -#define MAC_PCU_BLUETOOTH_MODE3_WL_ACTIVE_TIME_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE3_WL_ACTIVE_TIME_MASK) >> MAC_PCU_BLUETOOTH_MODE3_WL_ACTIVE_TIME_LSB) -#define MAC_PCU_BLUETOOTH_MODE3_WL_ACTIVE_TIME_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE3_WL_ACTIVE_TIME_LSB) & MAC_PCU_BLUETOOTH_MODE3_WL_ACTIVE_TIME_MASK) - -#define MAC_PCU_BLUETOOTH_MODE4_ADDRESS 0x00008168 -#define MAC_PCU_BLUETOOTH_MODE4_OFFSET 0x00000168 -#define MAC_PCU_BLUETOOTH_MODE4_BT_PRIORITY_EXTEND_MSB 31 -#define MAC_PCU_BLUETOOTH_MODE4_BT_PRIORITY_EXTEND_LSB 16 -#define MAC_PCU_BLUETOOTH_MODE4_BT_PRIORITY_EXTEND_MASK 0xffff0000 -#define MAC_PCU_BLUETOOTH_MODE4_BT_PRIORITY_EXTEND_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE4_BT_PRIORITY_EXTEND_MASK) >> MAC_PCU_BLUETOOTH_MODE4_BT_PRIORITY_EXTEND_LSB) -#define MAC_PCU_BLUETOOTH_MODE4_BT_PRIORITY_EXTEND_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE4_BT_PRIORITY_EXTEND_LSB) & MAC_PCU_BLUETOOTH_MODE4_BT_PRIORITY_EXTEND_MASK) -#define MAC_PCU_BLUETOOTH_MODE4_BT_ACTIVE_EXTEND_MSB 15 -#define MAC_PCU_BLUETOOTH_MODE4_BT_ACTIVE_EXTEND_LSB 0 -#define MAC_PCU_BLUETOOTH_MODE4_BT_ACTIVE_EXTEND_MASK 0x0000ffff -#define MAC_PCU_BLUETOOTH_MODE4_BT_ACTIVE_EXTEND_GET(x) (((x) & MAC_PCU_BLUETOOTH_MODE4_BT_ACTIVE_EXTEND_MASK) >> MAC_PCU_BLUETOOTH_MODE4_BT_ACTIVE_EXTEND_LSB) -#define MAC_PCU_BLUETOOTH_MODE4_BT_ACTIVE_EXTEND_SET(x) (((x) << MAC_PCU_BLUETOOTH_MODE4_BT_ACTIVE_EXTEND_LSB) & MAC_PCU_BLUETOOTH_MODE4_BT_ACTIVE_EXTEND_MASK) - -#define MAC_PCU_BT_BT_ADDRESS 0x00008200 -#define MAC_PCU_BT_BT_OFFSET 0x00000200 -#define MAC_PCU_BT_BT_WEIGHT_MSB 31 -#define MAC_PCU_BT_BT_WEIGHT_LSB 0 -#define MAC_PCU_BT_BT_WEIGHT_MASK 0xffffffff -#define MAC_PCU_BT_BT_WEIGHT_GET(x) (((x) & MAC_PCU_BT_BT_WEIGHT_MASK) >> MAC_PCU_BT_BT_WEIGHT_LSB) -#define MAC_PCU_BT_BT_WEIGHT_SET(x) (((x) << MAC_PCU_BT_BT_WEIGHT_LSB) & MAC_PCU_BT_BT_WEIGHT_MASK) - -#define MAC_PCU_BT_BT_ASYNC_ADDRESS 0x00008300 -#define MAC_PCU_BT_BT_ASYNC_OFFSET 0x00000300 -#define MAC_PCU_BT_BT_ASYNC_RXLP_WEIGHT_MSB 15 -#define MAC_PCU_BT_BT_ASYNC_RXLP_WEIGHT_LSB 12 -#define MAC_PCU_BT_BT_ASYNC_RXLP_WEIGHT_MASK 0x0000f000 -#define MAC_PCU_BT_BT_ASYNC_RXLP_WEIGHT_GET(x) (((x) & MAC_PCU_BT_BT_ASYNC_RXLP_WEIGHT_MASK) >> MAC_PCU_BT_BT_ASYNC_RXLP_WEIGHT_LSB) -#define MAC_PCU_BT_BT_ASYNC_RXLP_WEIGHT_SET(x) (((x) << MAC_PCU_BT_BT_ASYNC_RXLP_WEIGHT_LSB) & MAC_PCU_BT_BT_ASYNC_RXLP_WEIGHT_MASK) -#define MAC_PCU_BT_BT_ASYNC_RXHP_WEIGHT_MSB 11 -#define MAC_PCU_BT_BT_ASYNC_RXHP_WEIGHT_LSB 8 -#define MAC_PCU_BT_BT_ASYNC_RXHP_WEIGHT_MASK 0x00000f00 -#define MAC_PCU_BT_BT_ASYNC_RXHP_WEIGHT_GET(x) (((x) & MAC_PCU_BT_BT_ASYNC_RXHP_WEIGHT_MASK) >> MAC_PCU_BT_BT_ASYNC_RXHP_WEIGHT_LSB) -#define MAC_PCU_BT_BT_ASYNC_RXHP_WEIGHT_SET(x) (((x) << MAC_PCU_BT_BT_ASYNC_RXHP_WEIGHT_LSB) & MAC_PCU_BT_BT_ASYNC_RXHP_WEIGHT_MASK) -#define MAC_PCU_BT_BT_ASYNC_TXLP_WEIGHT_MSB 7 -#define MAC_PCU_BT_BT_ASYNC_TXLP_WEIGHT_LSB 4 -#define MAC_PCU_BT_BT_ASYNC_TXLP_WEIGHT_MASK 0x000000f0 -#define MAC_PCU_BT_BT_ASYNC_TXLP_WEIGHT_GET(x) (((x) & MAC_PCU_BT_BT_ASYNC_TXLP_WEIGHT_MASK) >> MAC_PCU_BT_BT_ASYNC_TXLP_WEIGHT_LSB) -#define MAC_PCU_BT_BT_ASYNC_TXLP_WEIGHT_SET(x) (((x) << MAC_PCU_BT_BT_ASYNC_TXLP_WEIGHT_LSB) & MAC_PCU_BT_BT_ASYNC_TXLP_WEIGHT_MASK) -#define MAC_PCU_BT_BT_ASYNC_TXHP_WEIGHT_MSB 3 -#define MAC_PCU_BT_BT_ASYNC_TXHP_WEIGHT_LSB 0 -#define MAC_PCU_BT_BT_ASYNC_TXHP_WEIGHT_MASK 0x0000000f -#define MAC_PCU_BT_BT_ASYNC_TXHP_WEIGHT_GET(x) (((x) & MAC_PCU_BT_BT_ASYNC_TXHP_WEIGHT_MASK) >> MAC_PCU_BT_BT_ASYNC_TXHP_WEIGHT_LSB) -#define MAC_PCU_BT_BT_ASYNC_TXHP_WEIGHT_SET(x) (((x) << MAC_PCU_BT_BT_ASYNC_TXHP_WEIGHT_LSB) & MAC_PCU_BT_BT_ASYNC_TXHP_WEIGHT_MASK) - -#define MAC_PCU_BT_WL_1_ADDRESS 0x00008304 -#define MAC_PCU_BT_WL_1_OFFSET 0x00000304 -#define MAC_PCU_BT_WL_1_WEIGHT_MSB 31 -#define MAC_PCU_BT_WL_1_WEIGHT_LSB 0 -#define MAC_PCU_BT_WL_1_WEIGHT_MASK 0xffffffff -#define MAC_PCU_BT_WL_1_WEIGHT_GET(x) (((x) & MAC_PCU_BT_WL_1_WEIGHT_MASK) >> MAC_PCU_BT_WL_1_WEIGHT_LSB) -#define MAC_PCU_BT_WL_1_WEIGHT_SET(x) (((x) << MAC_PCU_BT_WL_1_WEIGHT_LSB) & MAC_PCU_BT_WL_1_WEIGHT_MASK) - -#define MAC_PCU_BT_WL_2_ADDRESS 0x00008308 -#define MAC_PCU_BT_WL_2_OFFSET 0x00000308 -#define MAC_PCU_BT_WL_2_WEIGHT_MSB 31 -#define MAC_PCU_BT_WL_2_WEIGHT_LSB 0 -#define MAC_PCU_BT_WL_2_WEIGHT_MASK 0xffffffff -#define MAC_PCU_BT_WL_2_WEIGHT_GET(x) (((x) & MAC_PCU_BT_WL_2_WEIGHT_MASK) >> MAC_PCU_BT_WL_2_WEIGHT_LSB) -#define MAC_PCU_BT_WL_2_WEIGHT_SET(x) (((x) << MAC_PCU_BT_WL_2_WEIGHT_LSB) & MAC_PCU_BT_WL_2_WEIGHT_MASK) - -#define MAC_PCU_BT_WL_3_ADDRESS 0x0000830c -#define MAC_PCU_BT_WL_3_OFFSET 0x0000030c -#define MAC_PCU_BT_WL_3_WEIGHT_MSB 31 -#define MAC_PCU_BT_WL_3_WEIGHT_LSB 0 -#define MAC_PCU_BT_WL_3_WEIGHT_MASK 0xffffffff -#define MAC_PCU_BT_WL_3_WEIGHT_GET(x) (((x) & MAC_PCU_BT_WL_3_WEIGHT_MASK) >> MAC_PCU_BT_WL_3_WEIGHT_LSB) -#define MAC_PCU_BT_WL_3_WEIGHT_SET(x) (((x) << MAC_PCU_BT_WL_3_WEIGHT_LSB) & MAC_PCU_BT_WL_3_WEIGHT_MASK) - -#define MAC_PCU_BT_WL_4_ADDRESS 0x00008310 -#define MAC_PCU_BT_WL_4_OFFSET 0x00000310 -#define MAC_PCU_BT_WL_4_WEIGHT_MSB 31 -#define MAC_PCU_BT_WL_4_WEIGHT_LSB 0 -#define MAC_PCU_BT_WL_4_WEIGHT_MASK 0xffffffff -#define MAC_PCU_BT_WL_4_WEIGHT_GET(x) (((x) & MAC_PCU_BT_WL_4_WEIGHT_MASK) >> MAC_PCU_BT_WL_4_WEIGHT_LSB) -#define MAC_PCU_BT_WL_4_WEIGHT_SET(x) (((x) << MAC_PCU_BT_WL_4_WEIGHT_LSB) & MAC_PCU_BT_WL_4_WEIGHT_MASK) - -#define MAC_PCU_COEX_EPTA_ADDRESS 0x00008314 -#define MAC_PCU_COEX_EPTA_OFFSET 0x00000314 -#define MAC_PCU_COEX_EPTA_WT_IDX_MSB 12 -#define MAC_PCU_COEX_EPTA_WT_IDX_LSB 6 -#define MAC_PCU_COEX_EPTA_WT_IDX_MASK 0x00001fc0 -#define MAC_PCU_COEX_EPTA_WT_IDX_GET(x) (((x) & MAC_PCU_COEX_EPTA_WT_IDX_MASK) >> MAC_PCU_COEX_EPTA_WT_IDX_LSB) -#define MAC_PCU_COEX_EPTA_WT_IDX_SET(x) (((x) << MAC_PCU_COEX_EPTA_WT_IDX_LSB) & MAC_PCU_COEX_EPTA_WT_IDX_MASK) -#define MAC_PCU_COEX_EPTA_LINKID_MSB 5 -#define MAC_PCU_COEX_EPTA_LINKID_LSB 0 -#define MAC_PCU_COEX_EPTA_LINKID_MASK 0x0000003f -#define MAC_PCU_COEX_EPTA_LINKID_GET(x) (((x) & MAC_PCU_COEX_EPTA_LINKID_MASK) >> MAC_PCU_COEX_EPTA_LINKID_LSB) -#define MAC_PCU_COEX_EPTA_LINKID_SET(x) (((x) << MAC_PCU_COEX_EPTA_LINKID_LSB) & MAC_PCU_COEX_EPTA_LINKID_MASK) - -#define MAC_PCU_COEX_LNAMAXGAIN1_ADDRESS 0x00008318 -#define MAC_PCU_COEX_LNAMAXGAIN1_OFFSET 0x00000318 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN4_MSB 31 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN4_LSB 24 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN4_MASK 0xff000000 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN4_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN4_MASK) >> MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN4_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN4_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN4_LSB) & MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN4_MASK) -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN3_MSB 23 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN3_LSB 16 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN3_MASK 0x00ff0000 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN3_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN3_MASK) >> MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN3_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN3_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN3_LSB) & MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN3_MASK) -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN2_MSB 15 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN2_LSB 8 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN2_MASK 0x0000ff00 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN2_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN2_MASK) >> MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN2_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN2_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN2_LSB) & MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN2_MASK) -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN1_MSB 7 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN1_LSB 0 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN1_MASK 0x000000ff -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN1_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN1_MASK) >> MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN1_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN1_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN1_LSB) & MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN1_MASK) - -#define MAC_PCU_COEX_LNAMAXGAIN2_ADDRESS 0x0000831c -#define MAC_PCU_COEX_LNAMAXGAIN2_OFFSET 0x0000031c -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN4_MSB 31 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN4_LSB 24 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN4_MASK 0xff000000 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN4_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN4_MASK) >> MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN4_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN4_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN4_LSB) & MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN4_MASK) -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN3_MSB 23 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN3_LSB 16 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN3_MASK 0x00ff0000 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN3_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN3_MASK) >> MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN3_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN3_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN3_LSB) & MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN3_MASK) -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN2_MSB 15 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN2_LSB 8 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN2_MASK 0x0000ff00 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN2_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN2_MASK) >> MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN2_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN2_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN2_LSB) & MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN2_MASK) -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN1_MSB 7 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN1_LSB 0 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN1_MASK 0x000000ff -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN1_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN1_MASK) >> MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN1_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN1_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN1_LSB) & MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN1_MASK) - -#define MAC_PCU_COEX_LNAMAXGAIN3_ADDRESS 0x00008320 -#define MAC_PCU_COEX_LNAMAXGAIN3_OFFSET 0x00000320 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN4_MSB 31 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN4_LSB 24 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN4_MASK 0xff000000 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN4_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN4_MASK) >> MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN4_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN4_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN4_LSB) & MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN4_MASK) -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN3_MSB 23 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN3_LSB 16 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN3_MASK 0x00ff0000 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN3_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN3_MASK) >> MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN3_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN3_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN3_LSB) & MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN3_MASK) -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN2_MSB 15 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN2_LSB 8 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN2_MASK 0x0000ff00 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN2_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN2_MASK) >> MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN2_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN2_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN2_LSB) & MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN2_MASK) -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN1_MSB 7 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN1_LSB 0 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN1_MASK 0x000000ff -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN1_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN1_MASK) >> MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN1_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN1_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN1_LSB) & MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN1_MASK) - -#define MAC_PCU_COEX_LNAMAXGAIN4_ADDRESS 0x00008324 -#define MAC_PCU_COEX_LNAMAXGAIN4_OFFSET 0x00000324 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN4_MSB 31 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN4_LSB 24 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN4_MASK 0xff000000 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN4_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN4_MASK) >> MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN4_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN4_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN4_LSB) & MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN4_MASK) -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN3_MSB 23 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN3_LSB 16 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN3_MASK 0x00ff0000 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN3_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN3_MASK) >> MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN3_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN3_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN3_LSB) & MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN3_MASK) -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN2_MSB 15 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN2_LSB 8 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN2_MASK 0x0000ff00 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN2_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN2_MASK) >> MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN2_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN2_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN2_LSB) & MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN2_MASK) -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN1_MSB 7 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN1_LSB 0 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN1_MASK 0x000000ff -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN1_GET(x) (((x) & MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN1_MASK) >> MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN1_LSB) -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN1_SET(x) (((x) << MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN1_LSB) & MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN1_MASK) - -#define MAC_PCU_BASIC_RATE_SET0_ADDRESS 0x00008328 -#define MAC_PCU_BASIC_RATE_SET0_OFFSET 0x00000328 -#define MAC_PCU_BASIC_RATE_SET0_VALUE_MSB 29 -#define MAC_PCU_BASIC_RATE_SET0_VALUE_LSB 0 -#define MAC_PCU_BASIC_RATE_SET0_VALUE_MASK 0x3fffffff -#define MAC_PCU_BASIC_RATE_SET0_VALUE_GET(x) (((x) & MAC_PCU_BASIC_RATE_SET0_VALUE_MASK) >> MAC_PCU_BASIC_RATE_SET0_VALUE_LSB) -#define MAC_PCU_BASIC_RATE_SET0_VALUE_SET(x) (((x) << MAC_PCU_BASIC_RATE_SET0_VALUE_LSB) & MAC_PCU_BASIC_RATE_SET0_VALUE_MASK) - -#define MAC_PCU_BASIC_RATE_SET1_ADDRESS 0x0000832c -#define MAC_PCU_BASIC_RATE_SET1_OFFSET 0x0000032c -#define MAC_PCU_BASIC_RATE_SET1_VALUE_MSB 29 -#define MAC_PCU_BASIC_RATE_SET1_VALUE_LSB 0 -#define MAC_PCU_BASIC_RATE_SET1_VALUE_MASK 0x3fffffff -#define MAC_PCU_BASIC_RATE_SET1_VALUE_GET(x) (((x) & MAC_PCU_BASIC_RATE_SET1_VALUE_MASK) >> MAC_PCU_BASIC_RATE_SET1_VALUE_LSB) -#define MAC_PCU_BASIC_RATE_SET1_VALUE_SET(x) (((x) << MAC_PCU_BASIC_RATE_SET1_VALUE_LSB) & MAC_PCU_BASIC_RATE_SET1_VALUE_MASK) - -#define MAC_PCU_BASIC_RATE_SET2_ADDRESS 0x00008330 -#define MAC_PCU_BASIC_RATE_SET2_OFFSET 0x00000330 -#define MAC_PCU_BASIC_RATE_SET2_VALUE_MSB 29 -#define MAC_PCU_BASIC_RATE_SET2_VALUE_LSB 0 -#define MAC_PCU_BASIC_RATE_SET2_VALUE_MASK 0x3fffffff -#define MAC_PCU_BASIC_RATE_SET2_VALUE_GET(x) (((x) & MAC_PCU_BASIC_RATE_SET2_VALUE_MASK) >> MAC_PCU_BASIC_RATE_SET2_VALUE_LSB) -#define MAC_PCU_BASIC_RATE_SET2_VALUE_SET(x) (((x) << MAC_PCU_BASIC_RATE_SET2_VALUE_LSB) & MAC_PCU_BASIC_RATE_SET2_VALUE_MASK) - -#define MAC_PCU_BASIC_RATE_SET3_ADDRESS 0x00008334 -#define MAC_PCU_BASIC_RATE_SET3_OFFSET 0x00000334 -#define MAC_PCU_BASIC_RATE_SET3_VALUE_MSB 24 -#define MAC_PCU_BASIC_RATE_SET3_VALUE_LSB 0 -#define MAC_PCU_BASIC_RATE_SET3_VALUE_MASK 0x01ffffff -#define MAC_PCU_BASIC_RATE_SET3_VALUE_GET(x) (((x) & MAC_PCU_BASIC_RATE_SET3_VALUE_MASK) >> MAC_PCU_BASIC_RATE_SET3_VALUE_LSB) -#define MAC_PCU_BASIC_RATE_SET3_VALUE_SET(x) (((x) << MAC_PCU_BASIC_RATE_SET3_VALUE_LSB) & MAC_PCU_BASIC_RATE_SET3_VALUE_MASK) - -#define MAC_PCU_RX_INT_STATUS0_ADDRESS 0x00008338 -#define MAC_PCU_RX_INT_STATUS0_OFFSET 0x00000338 -#define MAC_PCU_RX_INT_STATUS0_DURATION_H_MSB 31 -#define MAC_PCU_RX_INT_STATUS0_DURATION_H_LSB 24 -#define MAC_PCU_RX_INT_STATUS0_DURATION_H_MASK 0xff000000 -#define MAC_PCU_RX_INT_STATUS0_DURATION_H_GET(x) (((x) & MAC_PCU_RX_INT_STATUS0_DURATION_H_MASK) >> MAC_PCU_RX_INT_STATUS0_DURATION_H_LSB) -#define MAC_PCU_RX_INT_STATUS0_DURATION_H_SET(x) (((x) << MAC_PCU_RX_INT_STATUS0_DURATION_H_LSB) & MAC_PCU_RX_INT_STATUS0_DURATION_H_MASK) -#define MAC_PCU_RX_INT_STATUS0_DURATION_L_MSB 23 -#define MAC_PCU_RX_INT_STATUS0_DURATION_L_LSB 16 -#define MAC_PCU_RX_INT_STATUS0_DURATION_L_MASK 0x00ff0000 -#define MAC_PCU_RX_INT_STATUS0_DURATION_L_GET(x) (((x) & MAC_PCU_RX_INT_STATUS0_DURATION_L_MASK) >> MAC_PCU_RX_INT_STATUS0_DURATION_L_LSB) -#define MAC_PCU_RX_INT_STATUS0_DURATION_L_SET(x) (((x) << MAC_PCU_RX_INT_STATUS0_DURATION_L_LSB) & MAC_PCU_RX_INT_STATUS0_DURATION_L_MASK) -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_H_MSB 15 -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_H_LSB 8 -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_H_MASK 0x0000ff00 -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_H_GET(x) (((x) & MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_H_MASK) >> MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_H_LSB) -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_H_SET(x) (((x) << MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_H_LSB) & MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_H_MASK) -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_L_MSB 7 -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_L_LSB 0 -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_L_MASK 0x000000ff -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_L_GET(x) (((x) & MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_L_MASK) >> MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_L_LSB) -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_L_SET(x) (((x) << MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_L_LSB) & MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_L_MASK) - -#define MAC_PCU_RX_INT_STATUS1_ADDRESS 0x0000833c -#define MAC_PCU_RX_INT_STATUS1_OFFSET 0x0000033c -#define MAC_PCU_RX_INT_STATUS1_VALUE_MSB 17 -#define MAC_PCU_RX_INT_STATUS1_VALUE_LSB 0 -#define MAC_PCU_RX_INT_STATUS1_VALUE_MASK 0x0003ffff -#define MAC_PCU_RX_INT_STATUS1_VALUE_GET(x) (((x) & MAC_PCU_RX_INT_STATUS1_VALUE_MASK) >> MAC_PCU_RX_INT_STATUS1_VALUE_LSB) -#define MAC_PCU_RX_INT_STATUS1_VALUE_SET(x) (((x) << MAC_PCU_RX_INT_STATUS1_VALUE_LSB) & MAC_PCU_RX_INT_STATUS1_VALUE_MASK) - -#define MAC_PCU_RX_INT_STATUS2_ADDRESS 0x00008340 -#define MAC_PCU_RX_INT_STATUS2_OFFSET 0x00000340 -#define MAC_PCU_RX_INT_STATUS2_VALUE_MSB 26 -#define MAC_PCU_RX_INT_STATUS2_VALUE_LSB 0 -#define MAC_PCU_RX_INT_STATUS2_VALUE_MASK 0x07ffffff -#define MAC_PCU_RX_INT_STATUS2_VALUE_GET(x) (((x) & MAC_PCU_RX_INT_STATUS2_VALUE_MASK) >> MAC_PCU_RX_INT_STATUS2_VALUE_LSB) -#define MAC_PCU_RX_INT_STATUS2_VALUE_SET(x) (((x) << MAC_PCU_RX_INT_STATUS2_VALUE_LSB) & MAC_PCU_RX_INT_STATUS2_VALUE_MASK) - -#define MAC_PCU_RX_INT_STATUS3_ADDRESS 0x00008344 -#define MAC_PCU_RX_INT_STATUS3_OFFSET 0x00000344 -#define MAC_PCU_RX_INT_STATUS3_VALUE_MSB 23 -#define MAC_PCU_RX_INT_STATUS3_VALUE_LSB 0 -#define MAC_PCU_RX_INT_STATUS3_VALUE_MASK 0x00ffffff -#define MAC_PCU_RX_INT_STATUS3_VALUE_GET(x) (((x) & MAC_PCU_RX_INT_STATUS3_VALUE_MASK) >> MAC_PCU_RX_INT_STATUS3_VALUE_LSB) -#define MAC_PCU_RX_INT_STATUS3_VALUE_SET(x) (((x) << MAC_PCU_RX_INT_STATUS3_VALUE_LSB) & MAC_PCU_RX_INT_STATUS3_VALUE_MASK) - -#define HT_HALF_GI_RATE1_ADDRESS 0x00008348 -#define HT_HALF_GI_RATE1_OFFSET 0x00000348 -#define HT_HALF_GI_RATE1_MCS3_MSB 31 -#define HT_HALF_GI_RATE1_MCS3_LSB 24 -#define HT_HALF_GI_RATE1_MCS3_MASK 0xff000000 -#define HT_HALF_GI_RATE1_MCS3_GET(x) (((x) & HT_HALF_GI_RATE1_MCS3_MASK) >> HT_HALF_GI_RATE1_MCS3_LSB) -#define HT_HALF_GI_RATE1_MCS3_SET(x) (((x) << HT_HALF_GI_RATE1_MCS3_LSB) & HT_HALF_GI_RATE1_MCS3_MASK) -#define HT_HALF_GI_RATE1_MCS2_MSB 23 -#define HT_HALF_GI_RATE1_MCS2_LSB 16 -#define HT_HALF_GI_RATE1_MCS2_MASK 0x00ff0000 -#define HT_HALF_GI_RATE1_MCS2_GET(x) (((x) & HT_HALF_GI_RATE1_MCS2_MASK) >> HT_HALF_GI_RATE1_MCS2_LSB) -#define HT_HALF_GI_RATE1_MCS2_SET(x) (((x) << HT_HALF_GI_RATE1_MCS2_LSB) & HT_HALF_GI_RATE1_MCS2_MASK) -#define HT_HALF_GI_RATE1_MCS1_MSB 15 -#define HT_HALF_GI_RATE1_MCS1_LSB 8 -#define HT_HALF_GI_RATE1_MCS1_MASK 0x0000ff00 -#define HT_HALF_GI_RATE1_MCS1_GET(x) (((x) & HT_HALF_GI_RATE1_MCS1_MASK) >> HT_HALF_GI_RATE1_MCS1_LSB) -#define HT_HALF_GI_RATE1_MCS1_SET(x) (((x) << HT_HALF_GI_RATE1_MCS1_LSB) & HT_HALF_GI_RATE1_MCS1_MASK) -#define HT_HALF_GI_RATE1_MCS0_MSB 7 -#define HT_HALF_GI_RATE1_MCS0_LSB 0 -#define HT_HALF_GI_RATE1_MCS0_MASK 0x000000ff -#define HT_HALF_GI_RATE1_MCS0_GET(x) (((x) & HT_HALF_GI_RATE1_MCS0_MASK) >> HT_HALF_GI_RATE1_MCS0_LSB) -#define HT_HALF_GI_RATE1_MCS0_SET(x) (((x) << HT_HALF_GI_RATE1_MCS0_LSB) & HT_HALF_GI_RATE1_MCS0_MASK) - -#define HT_HALF_GI_RATE2_ADDRESS 0x0000834c -#define HT_HALF_GI_RATE2_OFFSET 0x0000034c -#define HT_HALF_GI_RATE2_MCS7_MSB 31 -#define HT_HALF_GI_RATE2_MCS7_LSB 24 -#define HT_HALF_GI_RATE2_MCS7_MASK 0xff000000 -#define HT_HALF_GI_RATE2_MCS7_GET(x) (((x) & HT_HALF_GI_RATE2_MCS7_MASK) >> HT_HALF_GI_RATE2_MCS7_LSB) -#define HT_HALF_GI_RATE2_MCS7_SET(x) (((x) << HT_HALF_GI_RATE2_MCS7_LSB) & HT_HALF_GI_RATE2_MCS7_MASK) -#define HT_HALF_GI_RATE2_MCS6_MSB 23 -#define HT_HALF_GI_RATE2_MCS6_LSB 16 -#define HT_HALF_GI_RATE2_MCS6_MASK 0x00ff0000 -#define HT_HALF_GI_RATE2_MCS6_GET(x) (((x) & HT_HALF_GI_RATE2_MCS6_MASK) >> HT_HALF_GI_RATE2_MCS6_LSB) -#define HT_HALF_GI_RATE2_MCS6_SET(x) (((x) << HT_HALF_GI_RATE2_MCS6_LSB) & HT_HALF_GI_RATE2_MCS6_MASK) -#define HT_HALF_GI_RATE2_MCS5_MSB 15 -#define HT_HALF_GI_RATE2_MCS5_LSB 8 -#define HT_HALF_GI_RATE2_MCS5_MASK 0x0000ff00 -#define HT_HALF_GI_RATE2_MCS5_GET(x) (((x) & HT_HALF_GI_RATE2_MCS5_MASK) >> HT_HALF_GI_RATE2_MCS5_LSB) -#define HT_HALF_GI_RATE2_MCS5_SET(x) (((x) << HT_HALF_GI_RATE2_MCS5_LSB) & HT_HALF_GI_RATE2_MCS5_MASK) -#define HT_HALF_GI_RATE2_MCS4_MSB 7 -#define HT_HALF_GI_RATE2_MCS4_LSB 0 -#define HT_HALF_GI_RATE2_MCS4_MASK 0x000000ff -#define HT_HALF_GI_RATE2_MCS4_GET(x) (((x) & HT_HALF_GI_RATE2_MCS4_MASK) >> HT_HALF_GI_RATE2_MCS4_LSB) -#define HT_HALF_GI_RATE2_MCS4_SET(x) (((x) << HT_HALF_GI_RATE2_MCS4_LSB) & HT_HALF_GI_RATE2_MCS4_MASK) - -#define HT_FULL_GI_RATE1_ADDRESS 0x00008350 -#define HT_FULL_GI_RATE1_OFFSET 0x00000350 -#define HT_FULL_GI_RATE1_MCS3_MSB 31 -#define HT_FULL_GI_RATE1_MCS3_LSB 24 -#define HT_FULL_GI_RATE1_MCS3_MASK 0xff000000 -#define HT_FULL_GI_RATE1_MCS3_GET(x) (((x) & HT_FULL_GI_RATE1_MCS3_MASK) >> HT_FULL_GI_RATE1_MCS3_LSB) -#define HT_FULL_GI_RATE1_MCS3_SET(x) (((x) << HT_FULL_GI_RATE1_MCS3_LSB) & HT_FULL_GI_RATE1_MCS3_MASK) -#define HT_FULL_GI_RATE1_MCS2_MSB 23 -#define HT_FULL_GI_RATE1_MCS2_LSB 16 -#define HT_FULL_GI_RATE1_MCS2_MASK 0x00ff0000 -#define HT_FULL_GI_RATE1_MCS2_GET(x) (((x) & HT_FULL_GI_RATE1_MCS2_MASK) >> HT_FULL_GI_RATE1_MCS2_LSB) -#define HT_FULL_GI_RATE1_MCS2_SET(x) (((x) << HT_FULL_GI_RATE1_MCS2_LSB) & HT_FULL_GI_RATE1_MCS2_MASK) -#define HT_FULL_GI_RATE1_MCS1_MSB 15 -#define HT_FULL_GI_RATE1_MCS1_LSB 8 -#define HT_FULL_GI_RATE1_MCS1_MASK 0x0000ff00 -#define HT_FULL_GI_RATE1_MCS1_GET(x) (((x) & HT_FULL_GI_RATE1_MCS1_MASK) >> HT_FULL_GI_RATE1_MCS1_LSB) -#define HT_FULL_GI_RATE1_MCS1_SET(x) (((x) << HT_FULL_GI_RATE1_MCS1_LSB) & HT_FULL_GI_RATE1_MCS1_MASK) -#define HT_FULL_GI_RATE1_MCS0_MSB 7 -#define HT_FULL_GI_RATE1_MCS0_LSB 0 -#define HT_FULL_GI_RATE1_MCS0_MASK 0x000000ff -#define HT_FULL_GI_RATE1_MCS0_GET(x) (((x) & HT_FULL_GI_RATE1_MCS0_MASK) >> HT_FULL_GI_RATE1_MCS0_LSB) -#define HT_FULL_GI_RATE1_MCS0_SET(x) (((x) << HT_FULL_GI_RATE1_MCS0_LSB) & HT_FULL_GI_RATE1_MCS0_MASK) - -#define HT_FULL_GI_RATE2_ADDRESS 0x00008354 -#define HT_FULL_GI_RATE2_OFFSET 0x00000354 -#define HT_FULL_GI_RATE2_MCS7_MSB 31 -#define HT_FULL_GI_RATE2_MCS7_LSB 24 -#define HT_FULL_GI_RATE2_MCS7_MASK 0xff000000 -#define HT_FULL_GI_RATE2_MCS7_GET(x) (((x) & HT_FULL_GI_RATE2_MCS7_MASK) >> HT_FULL_GI_RATE2_MCS7_LSB) -#define HT_FULL_GI_RATE2_MCS7_SET(x) (((x) << HT_FULL_GI_RATE2_MCS7_LSB) & HT_FULL_GI_RATE2_MCS7_MASK) -#define HT_FULL_GI_RATE2_MCS6_MSB 23 -#define HT_FULL_GI_RATE2_MCS6_LSB 16 -#define HT_FULL_GI_RATE2_MCS6_MASK 0x00ff0000 -#define HT_FULL_GI_RATE2_MCS6_GET(x) (((x) & HT_FULL_GI_RATE2_MCS6_MASK) >> HT_FULL_GI_RATE2_MCS6_LSB) -#define HT_FULL_GI_RATE2_MCS6_SET(x) (((x) << HT_FULL_GI_RATE2_MCS6_LSB) & HT_FULL_GI_RATE2_MCS6_MASK) -#define HT_FULL_GI_RATE2_MCS5_MSB 15 -#define HT_FULL_GI_RATE2_MCS5_LSB 8 -#define HT_FULL_GI_RATE2_MCS5_MASK 0x0000ff00 -#define HT_FULL_GI_RATE2_MCS5_GET(x) (((x) & HT_FULL_GI_RATE2_MCS5_MASK) >> HT_FULL_GI_RATE2_MCS5_LSB) -#define HT_FULL_GI_RATE2_MCS5_SET(x) (((x) << HT_FULL_GI_RATE2_MCS5_LSB) & HT_FULL_GI_RATE2_MCS5_MASK) -#define HT_FULL_GI_RATE2_MCS4_MSB 7 -#define HT_FULL_GI_RATE2_MCS4_LSB 0 -#define HT_FULL_GI_RATE2_MCS4_MASK 0x000000ff -#define HT_FULL_GI_RATE2_MCS4_GET(x) (((x) & HT_FULL_GI_RATE2_MCS4_MASK) >> HT_FULL_GI_RATE2_MCS4_LSB) -#define HT_FULL_GI_RATE2_MCS4_SET(x) (((x) << HT_FULL_GI_RATE2_MCS4_LSB) & HT_FULL_GI_RATE2_MCS4_MASK) - -#define LEGACY_RATE1_ADDRESS 0x00008358 -#define LEGACY_RATE1_OFFSET 0x00000358 -#define LEGACY_RATE1_RATE12_MSB 29 -#define LEGACY_RATE1_RATE12_LSB 24 -#define LEGACY_RATE1_RATE12_MASK 0x3f000000 -#define LEGACY_RATE1_RATE12_GET(x) (((x) & LEGACY_RATE1_RATE12_MASK) >> LEGACY_RATE1_RATE12_LSB) -#define LEGACY_RATE1_RATE12_SET(x) (((x) << LEGACY_RATE1_RATE12_LSB) & LEGACY_RATE1_RATE12_MASK) -#define LEGACY_RATE1_RATE11_MSB 23 -#define LEGACY_RATE1_RATE11_LSB 18 -#define LEGACY_RATE1_RATE11_MASK 0x00fc0000 -#define LEGACY_RATE1_RATE11_GET(x) (((x) & LEGACY_RATE1_RATE11_MASK) >> LEGACY_RATE1_RATE11_LSB) -#define LEGACY_RATE1_RATE11_SET(x) (((x) << LEGACY_RATE1_RATE11_LSB) & LEGACY_RATE1_RATE11_MASK) -#define LEGACY_RATE1_RATE10_MSB 17 -#define LEGACY_RATE1_RATE10_LSB 12 -#define LEGACY_RATE1_RATE10_MASK 0x0003f000 -#define LEGACY_RATE1_RATE10_GET(x) (((x) & LEGACY_RATE1_RATE10_MASK) >> LEGACY_RATE1_RATE10_LSB) -#define LEGACY_RATE1_RATE10_SET(x) (((x) << LEGACY_RATE1_RATE10_LSB) & LEGACY_RATE1_RATE10_MASK) -#define LEGACY_RATE1_RATE9_MSB 11 -#define LEGACY_RATE1_RATE9_LSB 6 -#define LEGACY_RATE1_RATE9_MASK 0x00000fc0 -#define LEGACY_RATE1_RATE9_GET(x) (((x) & LEGACY_RATE1_RATE9_MASK) >> LEGACY_RATE1_RATE9_LSB) -#define LEGACY_RATE1_RATE9_SET(x) (((x) << LEGACY_RATE1_RATE9_LSB) & LEGACY_RATE1_RATE9_MASK) -#define LEGACY_RATE1_RATE8_MSB 5 -#define LEGACY_RATE1_RATE8_LSB 0 -#define LEGACY_RATE1_RATE8_MASK 0x0000003f -#define LEGACY_RATE1_RATE8_GET(x) (((x) & LEGACY_RATE1_RATE8_MASK) >> LEGACY_RATE1_RATE8_LSB) -#define LEGACY_RATE1_RATE8_SET(x) (((x) << LEGACY_RATE1_RATE8_LSB) & LEGACY_RATE1_RATE8_MASK) - -#define LEGACY_RATE2_ADDRESS 0x0000835c -#define LEGACY_RATE2_OFFSET 0x0000035c -#define LEGACY_RATE2_RATE25_MSB 29 -#define LEGACY_RATE2_RATE25_LSB 24 -#define LEGACY_RATE2_RATE25_MASK 0x3f000000 -#define LEGACY_RATE2_RATE25_GET(x) (((x) & LEGACY_RATE2_RATE25_MASK) >> LEGACY_RATE2_RATE25_LSB) -#define LEGACY_RATE2_RATE25_SET(x) (((x) << LEGACY_RATE2_RATE25_LSB) & LEGACY_RATE2_RATE25_MASK) -#define LEGACY_RATE2_RATE24_MSB 23 -#define LEGACY_RATE2_RATE24_LSB 18 -#define LEGACY_RATE2_RATE24_MASK 0x00fc0000 -#define LEGACY_RATE2_RATE24_GET(x) (((x) & LEGACY_RATE2_RATE24_MASK) >> LEGACY_RATE2_RATE24_LSB) -#define LEGACY_RATE2_RATE24_SET(x) (((x) << LEGACY_RATE2_RATE24_LSB) & LEGACY_RATE2_RATE24_MASK) -#define LEGACY_RATE2_RATE15_MSB 17 -#define LEGACY_RATE2_RATE15_LSB 12 -#define LEGACY_RATE2_RATE15_MASK 0x0003f000 -#define LEGACY_RATE2_RATE15_GET(x) (((x) & LEGACY_RATE2_RATE15_MASK) >> LEGACY_RATE2_RATE15_LSB) -#define LEGACY_RATE2_RATE15_SET(x) (((x) << LEGACY_RATE2_RATE15_LSB) & LEGACY_RATE2_RATE15_MASK) -#define LEGACY_RATE2_RATE14_MSB 11 -#define LEGACY_RATE2_RATE14_LSB 6 -#define LEGACY_RATE2_RATE14_MASK 0x00000fc0 -#define LEGACY_RATE2_RATE14_GET(x) (((x) & LEGACY_RATE2_RATE14_MASK) >> LEGACY_RATE2_RATE14_LSB) -#define LEGACY_RATE2_RATE14_SET(x) (((x) << LEGACY_RATE2_RATE14_LSB) & LEGACY_RATE2_RATE14_MASK) -#define LEGACY_RATE2_RATE13_MSB 5 -#define LEGACY_RATE2_RATE13_LSB 0 -#define LEGACY_RATE2_RATE13_MASK 0x0000003f -#define LEGACY_RATE2_RATE13_GET(x) (((x) & LEGACY_RATE2_RATE13_MASK) >> LEGACY_RATE2_RATE13_LSB) -#define LEGACY_RATE2_RATE13_SET(x) (((x) << LEGACY_RATE2_RATE13_LSB) & LEGACY_RATE2_RATE13_MASK) - -#define LEGACY_RATE3_ADDRESS 0x00008360 -#define LEGACY_RATE3_OFFSET 0x00000360 -#define LEGACY_RATE3_RATE30_MSB 29 -#define LEGACY_RATE3_RATE30_LSB 24 -#define LEGACY_RATE3_RATE30_MASK 0x3f000000 -#define LEGACY_RATE3_RATE30_GET(x) (((x) & LEGACY_RATE3_RATE30_MASK) >> LEGACY_RATE3_RATE30_LSB) -#define LEGACY_RATE3_RATE30_SET(x) (((x) << LEGACY_RATE3_RATE30_LSB) & LEGACY_RATE3_RATE30_MASK) -#define LEGACY_RATE3_RATE29_MSB 23 -#define LEGACY_RATE3_RATE29_LSB 18 -#define LEGACY_RATE3_RATE29_MASK 0x00fc0000 -#define LEGACY_RATE3_RATE29_GET(x) (((x) & LEGACY_RATE3_RATE29_MASK) >> LEGACY_RATE3_RATE29_LSB) -#define LEGACY_RATE3_RATE29_SET(x) (((x) << LEGACY_RATE3_RATE29_LSB) & LEGACY_RATE3_RATE29_MASK) -#define LEGACY_RATE3_RATE28_MSB 17 -#define LEGACY_RATE3_RATE28_LSB 12 -#define LEGACY_RATE3_RATE28_MASK 0x0003f000 -#define LEGACY_RATE3_RATE28_GET(x) (((x) & LEGACY_RATE3_RATE28_MASK) >> LEGACY_RATE3_RATE28_LSB) -#define LEGACY_RATE3_RATE28_SET(x) (((x) << LEGACY_RATE3_RATE28_LSB) & LEGACY_RATE3_RATE28_MASK) -#define LEGACY_RATE3_RATE27_MSB 11 -#define LEGACY_RATE3_RATE27_LSB 6 -#define LEGACY_RATE3_RATE27_MASK 0x00000fc0 -#define LEGACY_RATE3_RATE27_GET(x) (((x) & LEGACY_RATE3_RATE27_MASK) >> LEGACY_RATE3_RATE27_LSB) -#define LEGACY_RATE3_RATE27_SET(x) (((x) << LEGACY_RATE3_RATE27_LSB) & LEGACY_RATE3_RATE27_MASK) -#define LEGACY_RATE3_RATE26_MSB 5 -#define LEGACY_RATE3_RATE26_LSB 0 -#define LEGACY_RATE3_RATE26_MASK 0x0000003f -#define LEGACY_RATE3_RATE26_GET(x) (((x) & LEGACY_RATE3_RATE26_MASK) >> LEGACY_RATE3_RATE26_LSB) -#define LEGACY_RATE3_RATE26_SET(x) (((x) << LEGACY_RATE3_RATE26_LSB) & LEGACY_RATE3_RATE26_MASK) - -#define RX_INT_FILTER_ADDRESS 0x00008364 -#define RX_INT_FILTER_OFFSET 0x00000364 -#define RX_INT_FILTER_BEACON_MSB 17 -#define RX_INT_FILTER_BEACON_LSB 17 -#define RX_INT_FILTER_BEACON_MASK 0x00020000 -#define RX_INT_FILTER_BEACON_GET(x) (((x) & RX_INT_FILTER_BEACON_MASK) >> RX_INT_FILTER_BEACON_LSB) -#define RX_INT_FILTER_BEACON_SET(x) (((x) << RX_INT_FILTER_BEACON_LSB) & RX_INT_FILTER_BEACON_MASK) -#define RX_INT_FILTER_AMPDU_MSB 16 -#define RX_INT_FILTER_AMPDU_LSB 16 -#define RX_INT_FILTER_AMPDU_MASK 0x00010000 -#define RX_INT_FILTER_AMPDU_GET(x) (((x) & RX_INT_FILTER_AMPDU_MASK) >> RX_INT_FILTER_AMPDU_LSB) -#define RX_INT_FILTER_AMPDU_SET(x) (((x) << RX_INT_FILTER_AMPDU_LSB) & RX_INT_FILTER_AMPDU_MASK) -#define RX_INT_FILTER_EOSP_MSB 15 -#define RX_INT_FILTER_EOSP_LSB 15 -#define RX_INT_FILTER_EOSP_MASK 0x00008000 -#define RX_INT_FILTER_EOSP_GET(x) (((x) & RX_INT_FILTER_EOSP_MASK) >> RX_INT_FILTER_EOSP_LSB) -#define RX_INT_FILTER_EOSP_SET(x) (((x) << RX_INT_FILTER_EOSP_LSB) & RX_INT_FILTER_EOSP_MASK) -#define RX_INT_FILTER_LENGTH_LOW_MSB 14 -#define RX_INT_FILTER_LENGTH_LOW_LSB 14 -#define RX_INT_FILTER_LENGTH_LOW_MASK 0x00004000 -#define RX_INT_FILTER_LENGTH_LOW_GET(x) (((x) & RX_INT_FILTER_LENGTH_LOW_MASK) >> RX_INT_FILTER_LENGTH_LOW_LSB) -#define RX_INT_FILTER_LENGTH_LOW_SET(x) (((x) << RX_INT_FILTER_LENGTH_LOW_LSB) & RX_INT_FILTER_LENGTH_LOW_MASK) -#define RX_INT_FILTER_LENGTH_HIGH_MSB 13 -#define RX_INT_FILTER_LENGTH_HIGH_LSB 13 -#define RX_INT_FILTER_LENGTH_HIGH_MASK 0x00002000 -#define RX_INT_FILTER_LENGTH_HIGH_GET(x) (((x) & RX_INT_FILTER_LENGTH_HIGH_MASK) >> RX_INT_FILTER_LENGTH_HIGH_LSB) -#define RX_INT_FILTER_LENGTH_HIGH_SET(x) (((x) << RX_INT_FILTER_LENGTH_HIGH_LSB) & RX_INT_FILTER_LENGTH_HIGH_MASK) -#define RX_INT_FILTER_RSSI_MSB 12 -#define RX_INT_FILTER_RSSI_LSB 12 -#define RX_INT_FILTER_RSSI_MASK 0x00001000 -#define RX_INT_FILTER_RSSI_GET(x) (((x) & RX_INT_FILTER_RSSI_MASK) >> RX_INT_FILTER_RSSI_LSB) -#define RX_INT_FILTER_RSSI_SET(x) (((x) << RX_INT_FILTER_RSSI_LSB) & RX_INT_FILTER_RSSI_MASK) -#define RX_INT_FILTER_RATE_LOW_MSB 11 -#define RX_INT_FILTER_RATE_LOW_LSB 11 -#define RX_INT_FILTER_RATE_LOW_MASK 0x00000800 -#define RX_INT_FILTER_RATE_LOW_GET(x) (((x) & RX_INT_FILTER_RATE_LOW_MASK) >> RX_INT_FILTER_RATE_LOW_LSB) -#define RX_INT_FILTER_RATE_LOW_SET(x) (((x) << RX_INT_FILTER_RATE_LOW_LSB) & RX_INT_FILTER_RATE_LOW_MASK) -#define RX_INT_FILTER_RATE_HIGH_MSB 10 -#define RX_INT_FILTER_RATE_HIGH_LSB 10 -#define RX_INT_FILTER_RATE_HIGH_MASK 0x00000400 -#define RX_INT_FILTER_RATE_HIGH_GET(x) (((x) & RX_INT_FILTER_RATE_HIGH_MASK) >> RX_INT_FILTER_RATE_HIGH_LSB) -#define RX_INT_FILTER_RATE_HIGH_SET(x) (((x) << RX_INT_FILTER_RATE_HIGH_LSB) & RX_INT_FILTER_RATE_HIGH_MASK) -#define RX_INT_FILTER_MORE_FRAG_MSB 9 -#define RX_INT_FILTER_MORE_FRAG_LSB 9 -#define RX_INT_FILTER_MORE_FRAG_MASK 0x00000200 -#define RX_INT_FILTER_MORE_FRAG_GET(x) (((x) & RX_INT_FILTER_MORE_FRAG_MASK) >> RX_INT_FILTER_MORE_FRAG_LSB) -#define RX_INT_FILTER_MORE_FRAG_SET(x) (((x) << RX_INT_FILTER_MORE_FRAG_LSB) & RX_INT_FILTER_MORE_FRAG_MASK) -#define RX_INT_FILTER_MORE_DATA_MSB 8 -#define RX_INT_FILTER_MORE_DATA_LSB 8 -#define RX_INT_FILTER_MORE_DATA_MASK 0x00000100 -#define RX_INT_FILTER_MORE_DATA_GET(x) (((x) & RX_INT_FILTER_MORE_DATA_MASK) >> RX_INT_FILTER_MORE_DATA_LSB) -#define RX_INT_FILTER_MORE_DATA_SET(x) (((x) << RX_INT_FILTER_MORE_DATA_LSB) & RX_INT_FILTER_MORE_DATA_MASK) -#define RX_INT_FILTER_RETRY_MSB 7 -#define RX_INT_FILTER_RETRY_LSB 7 -#define RX_INT_FILTER_RETRY_MASK 0x00000080 -#define RX_INT_FILTER_RETRY_GET(x) (((x) & RX_INT_FILTER_RETRY_MASK) >> RX_INT_FILTER_RETRY_LSB) -#define RX_INT_FILTER_RETRY_SET(x) (((x) << RX_INT_FILTER_RETRY_LSB) & RX_INT_FILTER_RETRY_MASK) -#define RX_INT_FILTER_CTS_MSB 6 -#define RX_INT_FILTER_CTS_LSB 6 -#define RX_INT_FILTER_CTS_MASK 0x00000040 -#define RX_INT_FILTER_CTS_GET(x) (((x) & RX_INT_FILTER_CTS_MASK) >> RX_INT_FILTER_CTS_LSB) -#define RX_INT_FILTER_CTS_SET(x) (((x) << RX_INT_FILTER_CTS_LSB) & RX_INT_FILTER_CTS_MASK) -#define RX_INT_FILTER_ACK_MSB 5 -#define RX_INT_FILTER_ACK_LSB 5 -#define RX_INT_FILTER_ACK_MASK 0x00000020 -#define RX_INT_FILTER_ACK_GET(x) (((x) & RX_INT_FILTER_ACK_MASK) >> RX_INT_FILTER_ACK_LSB) -#define RX_INT_FILTER_ACK_SET(x) (((x) << RX_INT_FILTER_ACK_LSB) & RX_INT_FILTER_ACK_MASK) -#define RX_INT_FILTER_RTS_MSB 4 -#define RX_INT_FILTER_RTS_LSB 4 -#define RX_INT_FILTER_RTS_MASK 0x00000010 -#define RX_INT_FILTER_RTS_GET(x) (((x) & RX_INT_FILTER_RTS_MASK) >> RX_INT_FILTER_RTS_LSB) -#define RX_INT_FILTER_RTS_SET(x) (((x) << RX_INT_FILTER_RTS_LSB) & RX_INT_FILTER_RTS_MASK) -#define RX_INT_FILTER_MCAST_MSB 3 -#define RX_INT_FILTER_MCAST_LSB 3 -#define RX_INT_FILTER_MCAST_MASK 0x00000008 -#define RX_INT_FILTER_MCAST_GET(x) (((x) & RX_INT_FILTER_MCAST_MASK) >> RX_INT_FILTER_MCAST_LSB) -#define RX_INT_FILTER_MCAST_SET(x) (((x) << RX_INT_FILTER_MCAST_LSB) & RX_INT_FILTER_MCAST_MASK) -#define RX_INT_FILTER_BCAST_MSB 2 -#define RX_INT_FILTER_BCAST_LSB 2 -#define RX_INT_FILTER_BCAST_MASK 0x00000004 -#define RX_INT_FILTER_BCAST_GET(x) (((x) & RX_INT_FILTER_BCAST_MASK) >> RX_INT_FILTER_BCAST_LSB) -#define RX_INT_FILTER_BCAST_SET(x) (((x) << RX_INT_FILTER_BCAST_LSB) & RX_INT_FILTER_BCAST_MASK) -#define RX_INT_FILTER_DIRECTED_MSB 1 -#define RX_INT_FILTER_DIRECTED_LSB 1 -#define RX_INT_FILTER_DIRECTED_MASK 0x00000002 -#define RX_INT_FILTER_DIRECTED_GET(x) (((x) & RX_INT_FILTER_DIRECTED_MASK) >> RX_INT_FILTER_DIRECTED_LSB) -#define RX_INT_FILTER_DIRECTED_SET(x) (((x) << RX_INT_FILTER_DIRECTED_LSB) & RX_INT_FILTER_DIRECTED_MASK) -#define RX_INT_FILTER_ENABLE_MSB 0 -#define RX_INT_FILTER_ENABLE_LSB 0 -#define RX_INT_FILTER_ENABLE_MASK 0x00000001 -#define RX_INT_FILTER_ENABLE_GET(x) (((x) & RX_INT_FILTER_ENABLE_MASK) >> RX_INT_FILTER_ENABLE_LSB) -#define RX_INT_FILTER_ENABLE_SET(x) (((x) << RX_INT_FILTER_ENABLE_LSB) & RX_INT_FILTER_ENABLE_MASK) - -#define RX_INT_OVERFLOW_ADDRESS 0x00008368 -#define RX_INT_OVERFLOW_OFFSET 0x00000368 -#define RX_INT_OVERFLOW_STATUS_MSB 0 -#define RX_INT_OVERFLOW_STATUS_LSB 0 -#define RX_INT_OVERFLOW_STATUS_MASK 0x00000001 -#define RX_INT_OVERFLOW_STATUS_GET(x) (((x) & RX_INT_OVERFLOW_STATUS_MASK) >> RX_INT_OVERFLOW_STATUS_LSB) -#define RX_INT_OVERFLOW_STATUS_SET(x) (((x) << RX_INT_OVERFLOW_STATUS_LSB) & RX_INT_OVERFLOW_STATUS_MASK) - -#define RX_FILTER_THRESH_ADDRESS 0x0000836c -#define RX_FILTER_THRESH_OFFSET 0x0000036c -#define RX_FILTER_THRESH_RSSI_LOW_MSB 23 -#define RX_FILTER_THRESH_RSSI_LOW_LSB 16 -#define RX_FILTER_THRESH_RSSI_LOW_MASK 0x00ff0000 -#define RX_FILTER_THRESH_RSSI_LOW_GET(x) (((x) & RX_FILTER_THRESH_RSSI_LOW_MASK) >> RX_FILTER_THRESH_RSSI_LOW_LSB) -#define RX_FILTER_THRESH_RSSI_LOW_SET(x) (((x) << RX_FILTER_THRESH_RSSI_LOW_LSB) & RX_FILTER_THRESH_RSSI_LOW_MASK) -#define RX_FILTER_THRESH_RATE_LOW_MSB 15 -#define RX_FILTER_THRESH_RATE_LOW_LSB 8 -#define RX_FILTER_THRESH_RATE_LOW_MASK 0x0000ff00 -#define RX_FILTER_THRESH_RATE_LOW_GET(x) (((x) & RX_FILTER_THRESH_RATE_LOW_MASK) >> RX_FILTER_THRESH_RATE_LOW_LSB) -#define RX_FILTER_THRESH_RATE_LOW_SET(x) (((x) << RX_FILTER_THRESH_RATE_LOW_LSB) & RX_FILTER_THRESH_RATE_LOW_MASK) -#define RX_FILTER_THRESH_RATE_HIGH_MSB 7 -#define RX_FILTER_THRESH_RATE_HIGH_LSB 0 -#define RX_FILTER_THRESH_RATE_HIGH_MASK 0x000000ff -#define RX_FILTER_THRESH_RATE_HIGH_GET(x) (((x) & RX_FILTER_THRESH_RATE_HIGH_MASK) >> RX_FILTER_THRESH_RATE_HIGH_LSB) -#define RX_FILTER_THRESH_RATE_HIGH_SET(x) (((x) << RX_FILTER_THRESH_RATE_HIGH_LSB) & RX_FILTER_THRESH_RATE_HIGH_MASK) - -#define RX_FILTER_THRESH1_ADDRESS 0x00008370 -#define RX_FILTER_THRESH1_OFFSET 0x00000370 -#define RX_FILTER_THRESH1_LENGTH_LOW_MSB 23 -#define RX_FILTER_THRESH1_LENGTH_LOW_LSB 12 -#define RX_FILTER_THRESH1_LENGTH_LOW_MASK 0x00fff000 -#define RX_FILTER_THRESH1_LENGTH_LOW_GET(x) (((x) & RX_FILTER_THRESH1_LENGTH_LOW_MASK) >> RX_FILTER_THRESH1_LENGTH_LOW_LSB) -#define RX_FILTER_THRESH1_LENGTH_LOW_SET(x) (((x) << RX_FILTER_THRESH1_LENGTH_LOW_LSB) & RX_FILTER_THRESH1_LENGTH_LOW_MASK) -#define RX_FILTER_THRESH1_LENGTH_HIGH_MSB 11 -#define RX_FILTER_THRESH1_LENGTH_HIGH_LSB 0 -#define RX_FILTER_THRESH1_LENGTH_HIGH_MASK 0x00000fff -#define RX_FILTER_THRESH1_LENGTH_HIGH_GET(x) (((x) & RX_FILTER_THRESH1_LENGTH_HIGH_MASK) >> RX_FILTER_THRESH1_LENGTH_HIGH_LSB) -#define RX_FILTER_THRESH1_LENGTH_HIGH_SET(x) (((x) << RX_FILTER_THRESH1_LENGTH_HIGH_LSB) & RX_FILTER_THRESH1_LENGTH_HIGH_MASK) - -#define RX_PRIORITY_THRESH0_ADDRESS 0x00008374 -#define RX_PRIORITY_THRESH0_OFFSET 0x00000374 -#define RX_PRIORITY_THRESH0_RSSI_LOW_MSB 31 -#define RX_PRIORITY_THRESH0_RSSI_LOW_LSB 24 -#define RX_PRIORITY_THRESH0_RSSI_LOW_MASK 0xff000000 -#define RX_PRIORITY_THRESH0_RSSI_LOW_GET(x) (((x) & RX_PRIORITY_THRESH0_RSSI_LOW_MASK) >> RX_PRIORITY_THRESH0_RSSI_LOW_LSB) -#define RX_PRIORITY_THRESH0_RSSI_LOW_SET(x) (((x) << RX_PRIORITY_THRESH0_RSSI_LOW_LSB) & RX_PRIORITY_THRESH0_RSSI_LOW_MASK) -#define RX_PRIORITY_THRESH0_RSSI_HIGH_MSB 23 -#define RX_PRIORITY_THRESH0_RSSI_HIGH_LSB 16 -#define RX_PRIORITY_THRESH0_RSSI_HIGH_MASK 0x00ff0000 -#define RX_PRIORITY_THRESH0_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_THRESH0_RSSI_HIGH_MASK) >> RX_PRIORITY_THRESH0_RSSI_HIGH_LSB) -#define RX_PRIORITY_THRESH0_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_THRESH0_RSSI_HIGH_LSB) & RX_PRIORITY_THRESH0_RSSI_HIGH_MASK) -#define RX_PRIORITY_THRESH0_RATE_LOW_MSB 15 -#define RX_PRIORITY_THRESH0_RATE_LOW_LSB 8 -#define RX_PRIORITY_THRESH0_RATE_LOW_MASK 0x0000ff00 -#define RX_PRIORITY_THRESH0_RATE_LOW_GET(x) (((x) & RX_PRIORITY_THRESH0_RATE_LOW_MASK) >> RX_PRIORITY_THRESH0_RATE_LOW_LSB) -#define RX_PRIORITY_THRESH0_RATE_LOW_SET(x) (((x) << RX_PRIORITY_THRESH0_RATE_LOW_LSB) & RX_PRIORITY_THRESH0_RATE_LOW_MASK) -#define RX_PRIORITY_THRESH0_RATE_HIGH_MSB 7 -#define RX_PRIORITY_THRESH0_RATE_HIGH_LSB 0 -#define RX_PRIORITY_THRESH0_RATE_HIGH_MASK 0x000000ff -#define RX_PRIORITY_THRESH0_RATE_HIGH_GET(x) (((x) & RX_PRIORITY_THRESH0_RATE_HIGH_MASK) >> RX_PRIORITY_THRESH0_RATE_HIGH_LSB) -#define RX_PRIORITY_THRESH0_RATE_HIGH_SET(x) (((x) << RX_PRIORITY_THRESH0_RATE_HIGH_LSB) & RX_PRIORITY_THRESH0_RATE_HIGH_MASK) - -#define RX_PRIORITY_THRESH1_ADDRESS 0x00008378 -#define RX_PRIORITY_THRESH1_OFFSET 0x00000378 -#define RX_PRIORITY_THRESH1_XCAST_RSSI_HIGH_MSB 31 -#define RX_PRIORITY_THRESH1_XCAST_RSSI_HIGH_LSB 24 -#define RX_PRIORITY_THRESH1_XCAST_RSSI_HIGH_MASK 0xff000000 -#define RX_PRIORITY_THRESH1_XCAST_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_THRESH1_XCAST_RSSI_HIGH_MASK) >> RX_PRIORITY_THRESH1_XCAST_RSSI_HIGH_LSB) -#define RX_PRIORITY_THRESH1_XCAST_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_THRESH1_XCAST_RSSI_HIGH_LSB) & RX_PRIORITY_THRESH1_XCAST_RSSI_HIGH_MASK) -#define RX_PRIORITY_THRESH1_LENGTH_LOW_MSB 23 -#define RX_PRIORITY_THRESH1_LENGTH_LOW_LSB 12 -#define RX_PRIORITY_THRESH1_LENGTH_LOW_MASK 0x00fff000 -#define RX_PRIORITY_THRESH1_LENGTH_LOW_GET(x) (((x) & RX_PRIORITY_THRESH1_LENGTH_LOW_MASK) >> RX_PRIORITY_THRESH1_LENGTH_LOW_LSB) -#define RX_PRIORITY_THRESH1_LENGTH_LOW_SET(x) (((x) << RX_PRIORITY_THRESH1_LENGTH_LOW_LSB) & RX_PRIORITY_THRESH1_LENGTH_LOW_MASK) -#define RX_PRIORITY_THRESH1_LENGTH_HIGH_MSB 11 -#define RX_PRIORITY_THRESH1_LENGTH_HIGH_LSB 0 -#define RX_PRIORITY_THRESH1_LENGTH_HIGH_MASK 0x00000fff -#define RX_PRIORITY_THRESH1_LENGTH_HIGH_GET(x) (((x) & RX_PRIORITY_THRESH1_LENGTH_HIGH_MASK) >> RX_PRIORITY_THRESH1_LENGTH_HIGH_LSB) -#define RX_PRIORITY_THRESH1_LENGTH_HIGH_SET(x) (((x) << RX_PRIORITY_THRESH1_LENGTH_HIGH_LSB) & RX_PRIORITY_THRESH1_LENGTH_HIGH_MASK) - -#define RX_PRIORITY_THRESH2_ADDRESS 0x0000837c -#define RX_PRIORITY_THRESH2_OFFSET 0x0000037c -#define RX_PRIORITY_THRESH2_NULL_RSSI_HIGH_MSB 31 -#define RX_PRIORITY_THRESH2_NULL_RSSI_HIGH_LSB 24 -#define RX_PRIORITY_THRESH2_NULL_RSSI_HIGH_MASK 0xff000000 -#define RX_PRIORITY_THRESH2_NULL_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_THRESH2_NULL_RSSI_HIGH_MASK) >> RX_PRIORITY_THRESH2_NULL_RSSI_HIGH_LSB) -#define RX_PRIORITY_THRESH2_NULL_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_THRESH2_NULL_RSSI_HIGH_LSB) & RX_PRIORITY_THRESH2_NULL_RSSI_HIGH_MASK) -#define RX_PRIORITY_THRESH2_BEACON_RSSI_HIGH_MSB 23 -#define RX_PRIORITY_THRESH2_BEACON_RSSI_HIGH_LSB 16 -#define RX_PRIORITY_THRESH2_BEACON_RSSI_HIGH_MASK 0x00ff0000 -#define RX_PRIORITY_THRESH2_BEACON_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_THRESH2_BEACON_RSSI_HIGH_MASK) >> RX_PRIORITY_THRESH2_BEACON_RSSI_HIGH_LSB) -#define RX_PRIORITY_THRESH2_BEACON_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_THRESH2_BEACON_RSSI_HIGH_LSB) & RX_PRIORITY_THRESH2_BEACON_RSSI_HIGH_MASK) -#define RX_PRIORITY_THRESH2_MGMT_RSSI_HIGH_MSB 15 -#define RX_PRIORITY_THRESH2_MGMT_RSSI_HIGH_LSB 8 -#define RX_PRIORITY_THRESH2_MGMT_RSSI_HIGH_MASK 0x0000ff00 -#define RX_PRIORITY_THRESH2_MGMT_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_THRESH2_MGMT_RSSI_HIGH_MASK) >> RX_PRIORITY_THRESH2_MGMT_RSSI_HIGH_LSB) -#define RX_PRIORITY_THRESH2_MGMT_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_THRESH2_MGMT_RSSI_HIGH_LSB) & RX_PRIORITY_THRESH2_MGMT_RSSI_HIGH_MASK) -#define RX_PRIORITY_THRESH2_PRESP_RSSI_HIGH_MSB 7 -#define RX_PRIORITY_THRESH2_PRESP_RSSI_HIGH_LSB 0 -#define RX_PRIORITY_THRESH2_PRESP_RSSI_HIGH_MASK 0x000000ff -#define RX_PRIORITY_THRESH2_PRESP_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_THRESH2_PRESP_RSSI_HIGH_MASK) >> RX_PRIORITY_THRESH2_PRESP_RSSI_HIGH_LSB) -#define RX_PRIORITY_THRESH2_PRESP_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_THRESH2_PRESP_RSSI_HIGH_LSB) & RX_PRIORITY_THRESH2_PRESP_RSSI_HIGH_MASK) - -#define RX_PRIORITY_THRESH3_ADDRESS 0x00008380 -#define RX_PRIORITY_THRESH3_OFFSET 0x00000380 -#define RX_PRIORITY_THRESH3_PS_POLL_RSSI_HIGH_MSB 15 -#define RX_PRIORITY_THRESH3_PS_POLL_RSSI_HIGH_LSB 8 -#define RX_PRIORITY_THRESH3_PS_POLL_RSSI_HIGH_MASK 0x0000ff00 -#define RX_PRIORITY_THRESH3_PS_POLL_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_THRESH3_PS_POLL_RSSI_HIGH_MASK) >> RX_PRIORITY_THRESH3_PS_POLL_RSSI_HIGH_LSB) -#define RX_PRIORITY_THRESH3_PS_POLL_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_THRESH3_PS_POLL_RSSI_HIGH_LSB) & RX_PRIORITY_THRESH3_PS_POLL_RSSI_HIGH_MASK) -#define RX_PRIORITY_THRESH3_PREQ_RSSI_HIGH_MSB 7 -#define RX_PRIORITY_THRESH3_PREQ_RSSI_HIGH_LSB 0 -#define RX_PRIORITY_THRESH3_PREQ_RSSI_HIGH_MASK 0x000000ff -#define RX_PRIORITY_THRESH3_PREQ_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_THRESH3_PREQ_RSSI_HIGH_MASK) >> RX_PRIORITY_THRESH3_PREQ_RSSI_HIGH_LSB) -#define RX_PRIORITY_THRESH3_PREQ_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_THRESH3_PREQ_RSSI_HIGH_LSB) & RX_PRIORITY_THRESH3_PREQ_RSSI_HIGH_MASK) - -#define RX_PRIORITY_OFFSET0_ADDRESS 0x00008384 -#define RX_PRIORITY_OFFSET0_OFFSET 0x00000384 -#define RX_PRIORITY_OFFSET0_XCAST_RSSI_HIGH_MSB 29 -#define RX_PRIORITY_OFFSET0_XCAST_RSSI_HIGH_LSB 24 -#define RX_PRIORITY_OFFSET0_XCAST_RSSI_HIGH_MASK 0x3f000000 -#define RX_PRIORITY_OFFSET0_XCAST_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_OFFSET0_XCAST_RSSI_HIGH_MASK) >> RX_PRIORITY_OFFSET0_XCAST_RSSI_HIGH_LSB) -#define RX_PRIORITY_OFFSET0_XCAST_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_OFFSET0_XCAST_RSSI_HIGH_LSB) & RX_PRIORITY_OFFSET0_XCAST_RSSI_HIGH_MASK) -#define RX_PRIORITY_OFFSET0_RSSI_LOW_MSB 23 -#define RX_PRIORITY_OFFSET0_RSSI_LOW_LSB 18 -#define RX_PRIORITY_OFFSET0_RSSI_LOW_MASK 0x00fc0000 -#define RX_PRIORITY_OFFSET0_RSSI_LOW_GET(x) (((x) & RX_PRIORITY_OFFSET0_RSSI_LOW_MASK) >> RX_PRIORITY_OFFSET0_RSSI_LOW_LSB) -#define RX_PRIORITY_OFFSET0_RSSI_LOW_SET(x) (((x) << RX_PRIORITY_OFFSET0_RSSI_LOW_LSB) & RX_PRIORITY_OFFSET0_RSSI_LOW_MASK) -#define RX_PRIORITY_OFFSET0_RSSI_HIGH_MSB 17 -#define RX_PRIORITY_OFFSET0_RSSI_HIGH_LSB 12 -#define RX_PRIORITY_OFFSET0_RSSI_HIGH_MASK 0x0003f000 -#define RX_PRIORITY_OFFSET0_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_OFFSET0_RSSI_HIGH_MASK) >> RX_PRIORITY_OFFSET0_RSSI_HIGH_LSB) -#define RX_PRIORITY_OFFSET0_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_OFFSET0_RSSI_HIGH_LSB) & RX_PRIORITY_OFFSET0_RSSI_HIGH_MASK) -#define RX_PRIORITY_OFFSET0_PHY_RATE_LOW_MSB 11 -#define RX_PRIORITY_OFFSET0_PHY_RATE_LOW_LSB 6 -#define RX_PRIORITY_OFFSET0_PHY_RATE_LOW_MASK 0x00000fc0 -#define RX_PRIORITY_OFFSET0_PHY_RATE_LOW_GET(x) (((x) & RX_PRIORITY_OFFSET0_PHY_RATE_LOW_MASK) >> RX_PRIORITY_OFFSET0_PHY_RATE_LOW_LSB) -#define RX_PRIORITY_OFFSET0_PHY_RATE_LOW_SET(x) (((x) << RX_PRIORITY_OFFSET0_PHY_RATE_LOW_LSB) & RX_PRIORITY_OFFSET0_PHY_RATE_LOW_MASK) -#define RX_PRIORITY_OFFSET0_PHY_RATE_HIGH_MSB 5 -#define RX_PRIORITY_OFFSET0_PHY_RATE_HIGH_LSB 0 -#define RX_PRIORITY_OFFSET0_PHY_RATE_HIGH_MASK 0x0000003f -#define RX_PRIORITY_OFFSET0_PHY_RATE_HIGH_GET(x) (((x) & RX_PRIORITY_OFFSET0_PHY_RATE_HIGH_MASK) >> RX_PRIORITY_OFFSET0_PHY_RATE_HIGH_LSB) -#define RX_PRIORITY_OFFSET0_PHY_RATE_HIGH_SET(x) (((x) << RX_PRIORITY_OFFSET0_PHY_RATE_HIGH_LSB) & RX_PRIORITY_OFFSET0_PHY_RATE_HIGH_MASK) - -#define RX_PRIORITY_OFFSET1_ADDRESS 0x00008388 -#define RX_PRIORITY_OFFSET1_OFFSET 0x00000388 -#define RX_PRIORITY_OFFSET1_RTS_MSB 29 -#define RX_PRIORITY_OFFSET1_RTS_LSB 24 -#define RX_PRIORITY_OFFSET1_RTS_MASK 0x3f000000 -#define RX_PRIORITY_OFFSET1_RTS_GET(x) (((x) & RX_PRIORITY_OFFSET1_RTS_MASK) >> RX_PRIORITY_OFFSET1_RTS_LSB) -#define RX_PRIORITY_OFFSET1_RTS_SET(x) (((x) << RX_PRIORITY_OFFSET1_RTS_LSB) & RX_PRIORITY_OFFSET1_RTS_MASK) -#define RX_PRIORITY_OFFSET1_RETX_MSB 23 -#define RX_PRIORITY_OFFSET1_RETX_LSB 18 -#define RX_PRIORITY_OFFSET1_RETX_MASK 0x00fc0000 -#define RX_PRIORITY_OFFSET1_RETX_GET(x) (((x) & RX_PRIORITY_OFFSET1_RETX_MASK) >> RX_PRIORITY_OFFSET1_RETX_LSB) -#define RX_PRIORITY_OFFSET1_RETX_SET(x) (((x) << RX_PRIORITY_OFFSET1_RETX_LSB) & RX_PRIORITY_OFFSET1_RETX_MASK) -#define RX_PRIORITY_OFFSET1_PRESP_RSSI_HIGH_MSB 17 -#define RX_PRIORITY_OFFSET1_PRESP_RSSI_HIGH_LSB 12 -#define RX_PRIORITY_OFFSET1_PRESP_RSSI_HIGH_MASK 0x0003f000 -#define RX_PRIORITY_OFFSET1_PRESP_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_OFFSET1_PRESP_RSSI_HIGH_MASK) >> RX_PRIORITY_OFFSET1_PRESP_RSSI_HIGH_LSB) -#define RX_PRIORITY_OFFSET1_PRESP_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_OFFSET1_PRESP_RSSI_HIGH_LSB) & RX_PRIORITY_OFFSET1_PRESP_RSSI_HIGH_MASK) -#define RX_PRIORITY_OFFSET1_LENGTH_LOW_MSB 11 -#define RX_PRIORITY_OFFSET1_LENGTH_LOW_LSB 6 -#define RX_PRIORITY_OFFSET1_LENGTH_LOW_MASK 0x00000fc0 -#define RX_PRIORITY_OFFSET1_LENGTH_LOW_GET(x) (((x) & RX_PRIORITY_OFFSET1_LENGTH_LOW_MASK) >> RX_PRIORITY_OFFSET1_LENGTH_LOW_LSB) -#define RX_PRIORITY_OFFSET1_LENGTH_LOW_SET(x) (((x) << RX_PRIORITY_OFFSET1_LENGTH_LOW_LSB) & RX_PRIORITY_OFFSET1_LENGTH_LOW_MASK) -#define RX_PRIORITY_OFFSET1_LENGTH_HIGH_MSB 5 -#define RX_PRIORITY_OFFSET1_LENGTH_HIGH_LSB 0 -#define RX_PRIORITY_OFFSET1_LENGTH_HIGH_MASK 0x0000003f -#define RX_PRIORITY_OFFSET1_LENGTH_HIGH_GET(x) (((x) & RX_PRIORITY_OFFSET1_LENGTH_HIGH_MASK) >> RX_PRIORITY_OFFSET1_LENGTH_HIGH_LSB) -#define RX_PRIORITY_OFFSET1_LENGTH_HIGH_SET(x) (((x) << RX_PRIORITY_OFFSET1_LENGTH_HIGH_LSB) & RX_PRIORITY_OFFSET1_LENGTH_HIGH_MASK) - -#define RX_PRIORITY_OFFSET2_ADDRESS 0x0000838c -#define RX_PRIORITY_OFFSET2_OFFSET 0x0000038c -#define RX_PRIORITY_OFFSET2_BEACON_MSB 29 -#define RX_PRIORITY_OFFSET2_BEACON_LSB 24 -#define RX_PRIORITY_OFFSET2_BEACON_MASK 0x3f000000 -#define RX_PRIORITY_OFFSET2_BEACON_GET(x) (((x) & RX_PRIORITY_OFFSET2_BEACON_MASK) >> RX_PRIORITY_OFFSET2_BEACON_LSB) -#define RX_PRIORITY_OFFSET2_BEACON_SET(x) (((x) << RX_PRIORITY_OFFSET2_BEACON_LSB) & RX_PRIORITY_OFFSET2_BEACON_MASK) -#define RX_PRIORITY_OFFSET2_MGMT_MSB 23 -#define RX_PRIORITY_OFFSET2_MGMT_LSB 18 -#define RX_PRIORITY_OFFSET2_MGMT_MASK 0x00fc0000 -#define RX_PRIORITY_OFFSET2_MGMT_GET(x) (((x) & RX_PRIORITY_OFFSET2_MGMT_MASK) >> RX_PRIORITY_OFFSET2_MGMT_LSB) -#define RX_PRIORITY_OFFSET2_MGMT_SET(x) (((x) << RX_PRIORITY_OFFSET2_MGMT_LSB) & RX_PRIORITY_OFFSET2_MGMT_MASK) -#define RX_PRIORITY_OFFSET2_ATIM_MSB 17 -#define RX_PRIORITY_OFFSET2_ATIM_LSB 12 -#define RX_PRIORITY_OFFSET2_ATIM_MASK 0x0003f000 -#define RX_PRIORITY_OFFSET2_ATIM_GET(x) (((x) & RX_PRIORITY_OFFSET2_ATIM_MASK) >> RX_PRIORITY_OFFSET2_ATIM_LSB) -#define RX_PRIORITY_OFFSET2_ATIM_SET(x) (((x) << RX_PRIORITY_OFFSET2_ATIM_LSB) & RX_PRIORITY_OFFSET2_ATIM_MASK) -#define RX_PRIORITY_OFFSET2_PRESP_MSB 11 -#define RX_PRIORITY_OFFSET2_PRESP_LSB 6 -#define RX_PRIORITY_OFFSET2_PRESP_MASK 0x00000fc0 -#define RX_PRIORITY_OFFSET2_PRESP_GET(x) (((x) & RX_PRIORITY_OFFSET2_PRESP_MASK) >> RX_PRIORITY_OFFSET2_PRESP_LSB) -#define RX_PRIORITY_OFFSET2_PRESP_SET(x) (((x) << RX_PRIORITY_OFFSET2_PRESP_LSB) & RX_PRIORITY_OFFSET2_PRESP_MASK) -#define RX_PRIORITY_OFFSET2_XCAST_MSB 5 -#define RX_PRIORITY_OFFSET2_XCAST_LSB 0 -#define RX_PRIORITY_OFFSET2_XCAST_MASK 0x0000003f -#define RX_PRIORITY_OFFSET2_XCAST_GET(x) (((x) & RX_PRIORITY_OFFSET2_XCAST_MASK) >> RX_PRIORITY_OFFSET2_XCAST_LSB) -#define RX_PRIORITY_OFFSET2_XCAST_SET(x) (((x) << RX_PRIORITY_OFFSET2_XCAST_LSB) & RX_PRIORITY_OFFSET2_XCAST_MASK) - -#define RX_PRIORITY_OFFSET3_ADDRESS 0x00008390 -#define RX_PRIORITY_OFFSET3_OFFSET 0x00000390 -#define RX_PRIORITY_OFFSET3_PS_POLL_MSB 29 -#define RX_PRIORITY_OFFSET3_PS_POLL_LSB 24 -#define RX_PRIORITY_OFFSET3_PS_POLL_MASK 0x3f000000 -#define RX_PRIORITY_OFFSET3_PS_POLL_GET(x) (((x) & RX_PRIORITY_OFFSET3_PS_POLL_MASK) >> RX_PRIORITY_OFFSET3_PS_POLL_LSB) -#define RX_PRIORITY_OFFSET3_PS_POLL_SET(x) (((x) << RX_PRIORITY_OFFSET3_PS_POLL_LSB) & RX_PRIORITY_OFFSET3_PS_POLL_MASK) -#define RX_PRIORITY_OFFSET3_AMSDU_MSB 23 -#define RX_PRIORITY_OFFSET3_AMSDU_LSB 18 -#define RX_PRIORITY_OFFSET3_AMSDU_MASK 0x00fc0000 -#define RX_PRIORITY_OFFSET3_AMSDU_GET(x) (((x) & RX_PRIORITY_OFFSET3_AMSDU_MASK) >> RX_PRIORITY_OFFSET3_AMSDU_LSB) -#define RX_PRIORITY_OFFSET3_AMSDU_SET(x) (((x) << RX_PRIORITY_OFFSET3_AMSDU_LSB) & RX_PRIORITY_OFFSET3_AMSDU_MASK) -#define RX_PRIORITY_OFFSET3_AMPDU_MSB 17 -#define RX_PRIORITY_OFFSET3_AMPDU_LSB 12 -#define RX_PRIORITY_OFFSET3_AMPDU_MASK 0x0003f000 -#define RX_PRIORITY_OFFSET3_AMPDU_GET(x) (((x) & RX_PRIORITY_OFFSET3_AMPDU_MASK) >> RX_PRIORITY_OFFSET3_AMPDU_LSB) -#define RX_PRIORITY_OFFSET3_AMPDU_SET(x) (((x) << RX_PRIORITY_OFFSET3_AMPDU_LSB) & RX_PRIORITY_OFFSET3_AMPDU_MASK) -#define RX_PRIORITY_OFFSET3_EOSP_MSB 11 -#define RX_PRIORITY_OFFSET3_EOSP_LSB 6 -#define RX_PRIORITY_OFFSET3_EOSP_MASK 0x00000fc0 -#define RX_PRIORITY_OFFSET3_EOSP_GET(x) (((x) & RX_PRIORITY_OFFSET3_EOSP_MASK) >> RX_PRIORITY_OFFSET3_EOSP_LSB) -#define RX_PRIORITY_OFFSET3_EOSP_SET(x) (((x) << RX_PRIORITY_OFFSET3_EOSP_LSB) & RX_PRIORITY_OFFSET3_EOSP_MASK) -#define RX_PRIORITY_OFFSET3_MORE_MSB 5 -#define RX_PRIORITY_OFFSET3_MORE_LSB 0 -#define RX_PRIORITY_OFFSET3_MORE_MASK 0x0000003f -#define RX_PRIORITY_OFFSET3_MORE_GET(x) (((x) & RX_PRIORITY_OFFSET3_MORE_MASK) >> RX_PRIORITY_OFFSET3_MORE_LSB) -#define RX_PRIORITY_OFFSET3_MORE_SET(x) (((x) << RX_PRIORITY_OFFSET3_MORE_LSB) & RX_PRIORITY_OFFSET3_MORE_MASK) - -#define RX_PRIORITY_OFFSET4_ADDRESS 0x00008394 -#define RX_PRIORITY_OFFSET4_OFFSET 0x00000394 -#define RX_PRIORITY_OFFSET4_BEACON_RSSI_HIGH_MSB 29 -#define RX_PRIORITY_OFFSET4_BEACON_RSSI_HIGH_LSB 24 -#define RX_PRIORITY_OFFSET4_BEACON_RSSI_HIGH_MASK 0x3f000000 -#define RX_PRIORITY_OFFSET4_BEACON_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_OFFSET4_BEACON_RSSI_HIGH_MASK) >> RX_PRIORITY_OFFSET4_BEACON_RSSI_HIGH_LSB) -#define RX_PRIORITY_OFFSET4_BEACON_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_OFFSET4_BEACON_RSSI_HIGH_LSB) & RX_PRIORITY_OFFSET4_BEACON_RSSI_HIGH_MASK) -#define RX_PRIORITY_OFFSET4_MGMT_RSSI_HIGH_MSB 23 -#define RX_PRIORITY_OFFSET4_MGMT_RSSI_HIGH_LSB 18 -#define RX_PRIORITY_OFFSET4_MGMT_RSSI_HIGH_MASK 0x00fc0000 -#define RX_PRIORITY_OFFSET4_MGMT_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_OFFSET4_MGMT_RSSI_HIGH_MASK) >> RX_PRIORITY_OFFSET4_MGMT_RSSI_HIGH_LSB) -#define RX_PRIORITY_OFFSET4_MGMT_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_OFFSET4_MGMT_RSSI_HIGH_LSB) & RX_PRIORITY_OFFSET4_MGMT_RSSI_HIGH_MASK) -#define RX_PRIORITY_OFFSET4_BEACON_SSID_MSB 17 -#define RX_PRIORITY_OFFSET4_BEACON_SSID_LSB 12 -#define RX_PRIORITY_OFFSET4_BEACON_SSID_MASK 0x0003f000 -#define RX_PRIORITY_OFFSET4_BEACON_SSID_GET(x) (((x) & RX_PRIORITY_OFFSET4_BEACON_SSID_MASK) >> RX_PRIORITY_OFFSET4_BEACON_SSID_LSB) -#define RX_PRIORITY_OFFSET4_BEACON_SSID_SET(x) (((x) << RX_PRIORITY_OFFSET4_BEACON_SSID_LSB) & RX_PRIORITY_OFFSET4_BEACON_SSID_MASK) -#define RX_PRIORITY_OFFSET4_NULL_MSB 11 -#define RX_PRIORITY_OFFSET4_NULL_LSB 6 -#define RX_PRIORITY_OFFSET4_NULL_MASK 0x00000fc0 -#define RX_PRIORITY_OFFSET4_NULL_GET(x) (((x) & RX_PRIORITY_OFFSET4_NULL_MASK) >> RX_PRIORITY_OFFSET4_NULL_LSB) -#define RX_PRIORITY_OFFSET4_NULL_SET(x) (((x) << RX_PRIORITY_OFFSET4_NULL_LSB) & RX_PRIORITY_OFFSET4_NULL_MASK) -#define RX_PRIORITY_OFFSET4_PREQ_MSB 5 -#define RX_PRIORITY_OFFSET4_PREQ_LSB 0 -#define RX_PRIORITY_OFFSET4_PREQ_MASK 0x0000003f -#define RX_PRIORITY_OFFSET4_PREQ_GET(x) (((x) & RX_PRIORITY_OFFSET4_PREQ_MASK) >> RX_PRIORITY_OFFSET4_PREQ_LSB) -#define RX_PRIORITY_OFFSET4_PREQ_SET(x) (((x) << RX_PRIORITY_OFFSET4_PREQ_LSB) & RX_PRIORITY_OFFSET4_PREQ_MASK) - -#define RX_PRIORITY_OFFSET5_ADDRESS 0x00008398 -#define RX_PRIORITY_OFFSET5_OFFSET 0x00000398 -#define RX_PRIORITY_OFFSET5_PS_POLL_RSSI_HIGH_MSB 17 -#define RX_PRIORITY_OFFSET5_PS_POLL_RSSI_HIGH_LSB 12 -#define RX_PRIORITY_OFFSET5_PS_POLL_RSSI_HIGH_MASK 0x0003f000 -#define RX_PRIORITY_OFFSET5_PS_POLL_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_OFFSET5_PS_POLL_RSSI_HIGH_MASK) >> RX_PRIORITY_OFFSET5_PS_POLL_RSSI_HIGH_LSB) -#define RX_PRIORITY_OFFSET5_PS_POLL_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_OFFSET5_PS_POLL_RSSI_HIGH_LSB) & RX_PRIORITY_OFFSET5_PS_POLL_RSSI_HIGH_MASK) -#define RX_PRIORITY_OFFSET5_PREQ_RSSI_HIGH_MSB 11 -#define RX_PRIORITY_OFFSET5_PREQ_RSSI_HIGH_LSB 6 -#define RX_PRIORITY_OFFSET5_PREQ_RSSI_HIGH_MASK 0x00000fc0 -#define RX_PRIORITY_OFFSET5_PREQ_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_OFFSET5_PREQ_RSSI_HIGH_MASK) >> RX_PRIORITY_OFFSET5_PREQ_RSSI_HIGH_LSB) -#define RX_PRIORITY_OFFSET5_PREQ_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_OFFSET5_PREQ_RSSI_HIGH_LSB) & RX_PRIORITY_OFFSET5_PREQ_RSSI_HIGH_MASK) -#define RX_PRIORITY_OFFSET5_NULL_RSSI_HIGH_MSB 5 -#define RX_PRIORITY_OFFSET5_NULL_RSSI_HIGH_LSB 0 -#define RX_PRIORITY_OFFSET5_NULL_RSSI_HIGH_MASK 0x0000003f -#define RX_PRIORITY_OFFSET5_NULL_RSSI_HIGH_GET(x) (((x) & RX_PRIORITY_OFFSET5_NULL_RSSI_HIGH_MASK) >> RX_PRIORITY_OFFSET5_NULL_RSSI_HIGH_LSB) -#define RX_PRIORITY_OFFSET5_NULL_RSSI_HIGH_SET(x) (((x) << RX_PRIORITY_OFFSET5_NULL_RSSI_HIGH_LSB) & RX_PRIORITY_OFFSET5_NULL_RSSI_HIGH_MASK) - -#define MAC_PCU_BSSID2_L32_ADDRESS 0x0000839c -#define MAC_PCU_BSSID2_L32_OFFSET 0x0000039c -#define MAC_PCU_BSSID2_L32_ADDR_MSB 31 -#define MAC_PCU_BSSID2_L32_ADDR_LSB 0 -#define MAC_PCU_BSSID2_L32_ADDR_MASK 0xffffffff -#define MAC_PCU_BSSID2_L32_ADDR_GET(x) (((x) & MAC_PCU_BSSID2_L32_ADDR_MASK) >> MAC_PCU_BSSID2_L32_ADDR_LSB) -#define MAC_PCU_BSSID2_L32_ADDR_SET(x) (((x) << MAC_PCU_BSSID2_L32_ADDR_LSB) & MAC_PCU_BSSID2_L32_ADDR_MASK) - -#define MAC_PCU_BSSID2_U16_ADDRESS 0x000083a0 -#define MAC_PCU_BSSID2_U16_OFFSET 0x000003a0 -#define MAC_PCU_BSSID2_U16_ENABLE_MSB 16 -#define MAC_PCU_BSSID2_U16_ENABLE_LSB 16 -#define MAC_PCU_BSSID2_U16_ENABLE_MASK 0x00010000 -#define MAC_PCU_BSSID2_U16_ENABLE_GET(x) (((x) & MAC_PCU_BSSID2_U16_ENABLE_MASK) >> MAC_PCU_BSSID2_U16_ENABLE_LSB) -#define MAC_PCU_BSSID2_U16_ENABLE_SET(x) (((x) << MAC_PCU_BSSID2_U16_ENABLE_LSB) & MAC_PCU_BSSID2_U16_ENABLE_MASK) -#define MAC_PCU_BSSID2_U16_ADDR_MSB 15 -#define MAC_PCU_BSSID2_U16_ADDR_LSB 0 -#define MAC_PCU_BSSID2_U16_ADDR_MASK 0x0000ffff -#define MAC_PCU_BSSID2_U16_ADDR_GET(x) (((x) & MAC_PCU_BSSID2_U16_ADDR_MASK) >> MAC_PCU_BSSID2_U16_ADDR_LSB) -#define MAC_PCU_BSSID2_U16_ADDR_SET(x) (((x) << MAC_PCU_BSSID2_U16_ADDR_LSB) & MAC_PCU_BSSID2_U16_ADDR_MASK) - -#define MAC_PCU_TSF1_STATUS_L32_ADDRESS 0x000083a4 -#define MAC_PCU_TSF1_STATUS_L32_OFFSET 0x000003a4 -#define MAC_PCU_TSF1_STATUS_L32_VALUE_MSB 31 -#define MAC_PCU_TSF1_STATUS_L32_VALUE_LSB 0 -#define MAC_PCU_TSF1_STATUS_L32_VALUE_MASK 0xffffffff -#define MAC_PCU_TSF1_STATUS_L32_VALUE_GET(x) (((x) & MAC_PCU_TSF1_STATUS_L32_VALUE_MASK) >> MAC_PCU_TSF1_STATUS_L32_VALUE_LSB) -#define MAC_PCU_TSF1_STATUS_L32_VALUE_SET(x) (((x) << MAC_PCU_TSF1_STATUS_L32_VALUE_LSB) & MAC_PCU_TSF1_STATUS_L32_VALUE_MASK) - -#define MAC_PCU_TSF1_STATUS_U32_ADDRESS 0x000083a8 -#define MAC_PCU_TSF1_STATUS_U32_OFFSET 0x000003a8 -#define MAC_PCU_TSF1_STATUS_U32_VALUE_MSB 31 -#define MAC_PCU_TSF1_STATUS_U32_VALUE_LSB 0 -#define MAC_PCU_TSF1_STATUS_U32_VALUE_MASK 0xffffffff -#define MAC_PCU_TSF1_STATUS_U32_VALUE_GET(x) (((x) & MAC_PCU_TSF1_STATUS_U32_VALUE_MASK) >> MAC_PCU_TSF1_STATUS_U32_VALUE_LSB) -#define MAC_PCU_TSF1_STATUS_U32_VALUE_SET(x) (((x) << MAC_PCU_TSF1_STATUS_U32_VALUE_LSB) & MAC_PCU_TSF1_STATUS_U32_VALUE_MASK) - -#define MAC_PCU_TSF2_STATUS_L32_ADDRESS 0x000083ac -#define MAC_PCU_TSF2_STATUS_L32_OFFSET 0x000003ac -#define MAC_PCU_TSF2_STATUS_L32_VALUE_MSB 31 -#define MAC_PCU_TSF2_STATUS_L32_VALUE_LSB 0 -#define MAC_PCU_TSF2_STATUS_L32_VALUE_MASK 0xffffffff -#define MAC_PCU_TSF2_STATUS_L32_VALUE_GET(x) (((x) & MAC_PCU_TSF2_STATUS_L32_VALUE_MASK) >> MAC_PCU_TSF2_STATUS_L32_VALUE_LSB) -#define MAC_PCU_TSF2_STATUS_L32_VALUE_SET(x) (((x) << MAC_PCU_TSF2_STATUS_L32_VALUE_LSB) & MAC_PCU_TSF2_STATUS_L32_VALUE_MASK) - -#define MAC_PCU_TSF2_STATUS_U32_ADDRESS 0x000083b0 -#define MAC_PCU_TSF2_STATUS_U32_OFFSET 0x000003b0 -#define MAC_PCU_TSF2_STATUS_U32_VALUE_MSB 31 -#define MAC_PCU_TSF2_STATUS_U32_VALUE_LSB 0 -#define MAC_PCU_TSF2_STATUS_U32_VALUE_MASK 0xffffffff -#define MAC_PCU_TSF2_STATUS_U32_VALUE_GET(x) (((x) & MAC_PCU_TSF2_STATUS_U32_VALUE_MASK) >> MAC_PCU_TSF2_STATUS_U32_VALUE_LSB) -#define MAC_PCU_TSF2_STATUS_U32_VALUE_SET(x) (((x) << MAC_PCU_TSF2_STATUS_U32_VALUE_LSB) & MAC_PCU_TSF2_STATUS_U32_VALUE_MASK) - -#define MAC_PCU_TXBUF_BA_ADDRESS 0x00008400 -#define MAC_PCU_TXBUF_BA_OFFSET 0x00000400 -#define MAC_PCU_TXBUF_BA_DATA_MSB 31 -#define MAC_PCU_TXBUF_BA_DATA_LSB 0 -#define MAC_PCU_TXBUF_BA_DATA_MASK 0xffffffff -#define MAC_PCU_TXBUF_BA_DATA_GET(x) (((x) & MAC_PCU_TXBUF_BA_DATA_MASK) >> MAC_PCU_TXBUF_BA_DATA_LSB) -#define MAC_PCU_TXBUF_BA_DATA_SET(x) (((x) << MAC_PCU_TXBUF_BA_DATA_LSB) & MAC_PCU_TXBUF_BA_DATA_MASK) - -#define MAC_PCU_KEY_CACHE_1_ADDRESS 0x00008800 -#define MAC_PCU_KEY_CACHE_1_OFFSET 0x00000800 -#define MAC_PCU_KEY_CACHE_1_DATA_MSB 31 -#define MAC_PCU_KEY_CACHE_1_DATA_LSB 0 -#define MAC_PCU_KEY_CACHE_1_DATA_MASK 0xffffffff -#define MAC_PCU_KEY_CACHE_1_DATA_GET(x) (((x) & MAC_PCU_KEY_CACHE_1_DATA_MASK) >> MAC_PCU_KEY_CACHE_1_DATA_LSB) -#define MAC_PCU_KEY_CACHE_1_DATA_SET(x) (((x) << MAC_PCU_KEY_CACHE_1_DATA_LSB) & MAC_PCU_KEY_CACHE_1_DATA_MASK) - -#define MAC_PCU_BASEBAND_0_ADDRESS 0x00009800 -#define MAC_PCU_BASEBAND_0_OFFSET 0x00001800 -#define MAC_PCU_BASEBAND_0_DATA_MSB 31 -#define MAC_PCU_BASEBAND_0_DATA_LSB 0 -#define MAC_PCU_BASEBAND_0_DATA_MASK 0xffffffff -#define MAC_PCU_BASEBAND_0_DATA_GET(x) (((x) & MAC_PCU_BASEBAND_0_DATA_MASK) >> MAC_PCU_BASEBAND_0_DATA_LSB) -#define MAC_PCU_BASEBAND_0_DATA_SET(x) (((x) << MAC_PCU_BASEBAND_0_DATA_LSB) & MAC_PCU_BASEBAND_0_DATA_MASK) - -#define MAC_PCU_BASEBAND_1_ADDRESS 0x0000a000 -#define MAC_PCU_BASEBAND_1_OFFSET 0x00002000 -#define MAC_PCU_BASEBAND_1_DATA_MSB 31 -#define MAC_PCU_BASEBAND_1_DATA_LSB 0 -#define MAC_PCU_BASEBAND_1_DATA_MASK 0xffffffff -#define MAC_PCU_BASEBAND_1_DATA_GET(x) (((x) & MAC_PCU_BASEBAND_1_DATA_MASK) >> MAC_PCU_BASEBAND_1_DATA_LSB) -#define MAC_PCU_BASEBAND_1_DATA_SET(x) (((x) << MAC_PCU_BASEBAND_1_DATA_LSB) & MAC_PCU_BASEBAND_1_DATA_MASK) - -#define MAC_PCU_BASEBAND_2_ADDRESS 0x0000c000 -#define MAC_PCU_BASEBAND_2_OFFSET 0x00004000 -#define MAC_PCU_BASEBAND_2_DATA_MSB 31 -#define MAC_PCU_BASEBAND_2_DATA_LSB 0 -#define MAC_PCU_BASEBAND_2_DATA_MASK 0xffffffff -#define MAC_PCU_BASEBAND_2_DATA_GET(x) (((x) & MAC_PCU_BASEBAND_2_DATA_MASK) >> MAC_PCU_BASEBAND_2_DATA_LSB) -#define MAC_PCU_BASEBAND_2_DATA_SET(x) (((x) << MAC_PCU_BASEBAND_2_DATA_LSB) & MAC_PCU_BASEBAND_2_DATA_MASK) - -#define MAC_PCU_BASEBAND_3_ADDRESS 0x0000d000 -#define MAC_PCU_BASEBAND_3_OFFSET 0x00005000 -#define MAC_PCU_BASEBAND_3_DATA_MSB 31 -#define MAC_PCU_BASEBAND_3_DATA_LSB 0 -#define MAC_PCU_BASEBAND_3_DATA_MASK 0xffffffff -#define MAC_PCU_BASEBAND_3_DATA_GET(x) (((x) & MAC_PCU_BASEBAND_3_DATA_MASK) >> MAC_PCU_BASEBAND_3_DATA_LSB) -#define MAC_PCU_BASEBAND_3_DATA_SET(x) (((x) << MAC_PCU_BASEBAND_3_DATA_LSB) & MAC_PCU_BASEBAND_3_DATA_MASK) - -#define MAC_PCU_BUF_ADDRESS 0x0000e000 -#define MAC_PCU_BUF_OFFSET 0x00006000 -#define MAC_PCU_BUF_DATA_MSB 31 -#define MAC_PCU_BUF_DATA_LSB 0 -#define MAC_PCU_BUF_DATA_MASK 0xffffffff -#define MAC_PCU_BUF_DATA_GET(x) (((x) & MAC_PCU_BUF_DATA_MASK) >> MAC_PCU_BUF_DATA_LSB) -#define MAC_PCU_BUF_DATA_SET(x) (((x) << MAC_PCU_BUF_DATA_LSB) & MAC_PCU_BUF_DATA_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct mac_pcu_reg_s { - volatile unsigned int mac_pcu_sta_addr_l32; - volatile unsigned int mac_pcu_sta_addr_u16; - volatile unsigned int mac_pcu_bssid_l32; - volatile unsigned int mac_pcu_bssid_u16; - volatile unsigned int mac_pcu_bcn_rssi_ave; - volatile unsigned int mac_pcu_ack_cts_timeout; - volatile unsigned int mac_pcu_bcn_rssi_ctl; - volatile unsigned int mac_pcu_usec_latency; - volatile unsigned int pcu_max_cfp_dur; - volatile unsigned int mac_pcu_rx_filter; - volatile unsigned int mac_pcu_mcast_filter_l32; - volatile unsigned int mac_pcu_mcast_filter_u32; - volatile unsigned int mac_pcu_diag_sw; - volatile unsigned int mac_pcu_tst_addac; - volatile unsigned int mac_pcu_def_antenna; - volatile unsigned int mac_pcu_aes_mute_mask_0; - volatile unsigned int mac_pcu_aes_mute_mask_1; - volatile unsigned int mac_pcu_gated_clks; - volatile unsigned int mac_pcu_obs_bus_2; - volatile unsigned int mac_pcu_obs_bus_1; - volatile unsigned int mac_pcu_dym_mimo_pwr_save; - volatile unsigned int mac_pcu_last_beacon_tsf; - volatile unsigned int mac_pcu_nav; - volatile unsigned int mac_pcu_rts_success_cnt; - volatile unsigned int mac_pcu_rts_fail_cnt; - volatile unsigned int mac_pcu_ack_fail_cnt; - volatile unsigned int mac_pcu_fcs_fail_cnt; - volatile unsigned int mac_pcu_beacon_cnt; - volatile unsigned int mac_pcu_xrmode; - volatile unsigned int mac_pcu_xrdel; - volatile unsigned int mac_pcu_xrto; - volatile unsigned int mac_pcu_xrcrp; - volatile unsigned int mac_pcu_xrstmp; - volatile unsigned int mac_pcu_addr1_mask_l32; - volatile unsigned int mac_pcu_addr1_mask_u16; - volatile unsigned int mac_pcu_tpc; - volatile unsigned int mac_pcu_tx_frame_cnt; - volatile unsigned int mac_pcu_rx_frame_cnt; - volatile unsigned int mac_pcu_rx_clear_cnt; - volatile unsigned int mac_pcu_cycle_cnt; - volatile unsigned int mac_pcu_quiet_time_1; - volatile unsigned int mac_pcu_quiet_time_2; - volatile unsigned int mac_pcu_qos_no_ack; - volatile unsigned int mac_pcu_phy_error_mask; - volatile unsigned int mac_pcu_xrlat; - volatile unsigned int mac_pcu_rxbuf; - volatile unsigned int mac_pcu_mic_qos_control; - volatile unsigned int mac_pcu_mic_qos_select; - volatile unsigned int mac_pcu_misc_mode; - volatile unsigned int mac_pcu_filter_ofdm_cnt; - volatile unsigned int mac_pcu_filter_cck_cnt; - volatile unsigned int mac_pcu_phy_err_cnt_1; - volatile unsigned int mac_pcu_phy_err_cnt_1_mask; - volatile unsigned int mac_pcu_phy_err_cnt_2; - volatile unsigned int mac_pcu_phy_err_cnt_2_mask; - volatile unsigned int mac_pcu_tsf_threshold; - volatile unsigned int mac_pcu_phy_error_eifs_mask; - volatile unsigned int mac_pcu_phy_err_cnt_3; - volatile unsigned int mac_pcu_phy_err_cnt_3_mask; - volatile unsigned int mac_pcu_bluetooth_mode; - volatile unsigned int mac_pcu_bluetooth_weights; - volatile unsigned int mac_pcu_bluetooth_mode2; - volatile unsigned int mac_pcu_txsifs; - volatile unsigned int mac_pcu_txop_x; - volatile unsigned int mac_pcu_txop_0_3; - volatile unsigned int mac_pcu_txop_4_7; - volatile unsigned int mac_pcu_txop_8_11; - volatile unsigned int mac_pcu_txop_12_15; - volatile unsigned int mac_pcu_logic_analyzer; - volatile unsigned int mac_pcu_logic_analyzer_32l; - volatile unsigned int mac_pcu_logic_analyzer_16u; - volatile unsigned int mac_pcu_phy_err_cnt_mask_cont; - volatile unsigned int mac_pcu_azimuth_mode; - volatile unsigned int mac_pcu_20_40_mode; - volatile unsigned int mac_pcu_rx_clear_diff_cnt; - volatile unsigned int mac_pcu_self_gen_antenna_mask; - volatile unsigned int mac_pcu_ba_bar_control; - volatile unsigned int mac_pcu_legacy_plcp_spoof; - volatile unsigned int mac_pcu_phy_error_mask_cont; - volatile unsigned int mac_pcu_tx_timer; - volatile unsigned int mac_pcu_txbuf_ctrl; - volatile unsigned int mac_pcu_misc_mode2; - volatile unsigned int mac_pcu_alt_aes_mute_mask; - volatile unsigned int mac_pcu_azimuth_time_stamp; - volatile unsigned int mac_pcu_max_cfp_dur; - volatile unsigned int mac_pcu_hcf_timeout; - volatile unsigned int mac_pcu_bluetooth_weights2; - volatile unsigned int mac_pcu_bluetooth_tsf_bt_active; - volatile unsigned int mac_pcu_bluetooth_tsf_bt_priority; - volatile unsigned int mac_pcu_bluetooth_mode3; - volatile unsigned int mac_pcu_bluetooth_mode4; - unsigned char pad0[148]; /* pad to 0x200 */ - volatile unsigned int mac_pcu_bt_bt[64]; - volatile unsigned int mac_pcu_bt_bt_async; - volatile unsigned int mac_pcu_bt_wl_1; - volatile unsigned int mac_pcu_bt_wl_2; - volatile unsigned int mac_pcu_bt_wl_3; - volatile unsigned int mac_pcu_bt_wl_4; - volatile unsigned int mac_pcu_coex_epta; - volatile unsigned int mac_pcu_coex_lnamaxgain1; - volatile unsigned int mac_pcu_coex_lnamaxgain2; - volatile unsigned int mac_pcu_coex_lnamaxgain3; - volatile unsigned int mac_pcu_coex_lnamaxgain4; - volatile unsigned int mac_pcu_basic_rate_set0; - volatile unsigned int mac_pcu_basic_rate_set1; - volatile unsigned int mac_pcu_basic_rate_set2; - volatile unsigned int mac_pcu_basic_rate_set3; - volatile unsigned int mac_pcu_rx_int_status0; - volatile unsigned int mac_pcu_rx_int_status1; - volatile unsigned int mac_pcu_rx_int_status2; - volatile unsigned int mac_pcu_rx_int_status3; - volatile unsigned int ht_half_gi_rate1; - volatile unsigned int ht_half_gi_rate2; - volatile unsigned int ht_full_gi_rate1; - volatile unsigned int ht_full_gi_rate2; - volatile unsigned int legacy_rate1; - volatile unsigned int legacy_rate2; - volatile unsigned int legacy_rate3; - volatile unsigned int rx_int_filter; - volatile unsigned int rx_int_overflow; - volatile unsigned int rx_filter_thresh; - volatile unsigned int rx_filter_thresh1; - volatile unsigned int rx_priority_thresh0; - volatile unsigned int rx_priority_thresh1; - volatile unsigned int rx_priority_thresh2; - volatile unsigned int rx_priority_thresh3; - volatile unsigned int rx_priority_offset0; - volatile unsigned int rx_priority_offset1; - volatile unsigned int rx_priority_offset2; - volatile unsigned int rx_priority_offset3; - volatile unsigned int rx_priority_offset4; - volatile unsigned int rx_priority_offset5; - volatile unsigned int mac_pcu_bssid2_l32; - volatile unsigned int mac_pcu_bssid2_u16; - volatile unsigned int mac_pcu_tsf1_status_l32; - volatile unsigned int mac_pcu_tsf1_status_u32; - volatile unsigned int mac_pcu_tsf2_status_l32; - volatile unsigned int mac_pcu_tsf2_status_u32; - unsigned char pad1[76]; /* pad to 0x400 */ - volatile unsigned int mac_pcu_txbuf_ba[64]; - unsigned char pad2[768]; /* pad to 0x800 */ - volatile unsigned int mac_pcu_key_cache_1[256]; - unsigned char pad3[3072]; /* pad to 0x1800 */ - volatile unsigned int mac_pcu_baseband_0[512]; - volatile unsigned int mac_pcu_baseband_1[2048]; - volatile unsigned int mac_pcu_baseband_2[1024]; - volatile unsigned int mac_pcu_baseband_3[1024]; - volatile unsigned int mac_pcu_buf[512]; -} mac_pcu_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _MAC_PCU_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_host_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_host_reg.h deleted file mode 100644 index 7460d94fa39e..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_host_reg.h +++ /dev/null @@ -1,37 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "mbox_wlan_host_reg.h" - - -#ifndef BT_HEADERS - - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_reg.h deleted file mode 100644 index 22bd7d795d09..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_reg.h +++ /dev/null @@ -1,560 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "mbox_wlan_reg.h" - - -#ifndef BT_HEADERS - -#define MBOX_FIFO_ADDRESS WLAN_MBOX_FIFO_ADDRESS -#define MBOX_FIFO_OFFSET WLAN_MBOX_FIFO_OFFSET -#define MBOX_FIFO_DATA_MSB WLAN_MBOX_FIFO_DATA_MSB -#define MBOX_FIFO_DATA_LSB WLAN_MBOX_FIFO_DATA_LSB -#define MBOX_FIFO_DATA_MASK WLAN_MBOX_FIFO_DATA_MASK -#define MBOX_FIFO_DATA_GET(x) WLAN_MBOX_FIFO_DATA_GET(x) -#define MBOX_FIFO_DATA_SET(x) WLAN_MBOX_FIFO_DATA_SET(x) -#define MBOX_FIFO_STATUS_ADDRESS WLAN_MBOX_FIFO_STATUS_ADDRESS -#define MBOX_FIFO_STATUS_OFFSET WLAN_MBOX_FIFO_STATUS_OFFSET -#define MBOX_FIFO_STATUS_EMPTY_MSB WLAN_MBOX_FIFO_STATUS_EMPTY_MSB -#define MBOX_FIFO_STATUS_EMPTY_LSB WLAN_MBOX_FIFO_STATUS_EMPTY_LSB -#define MBOX_FIFO_STATUS_EMPTY_MASK WLAN_MBOX_FIFO_STATUS_EMPTY_MASK -#define MBOX_FIFO_STATUS_EMPTY_GET(x) WLAN_MBOX_FIFO_STATUS_EMPTY_GET(x) -#define MBOX_FIFO_STATUS_EMPTY_SET(x) WLAN_MBOX_FIFO_STATUS_EMPTY_SET(x) -#define MBOX_FIFO_STATUS_FULL_MSB WLAN_MBOX_FIFO_STATUS_FULL_MSB -#define MBOX_FIFO_STATUS_FULL_LSB WLAN_MBOX_FIFO_STATUS_FULL_LSB -#define MBOX_FIFO_STATUS_FULL_MASK WLAN_MBOX_FIFO_STATUS_FULL_MASK -#define MBOX_FIFO_STATUS_FULL_GET(x) WLAN_MBOX_FIFO_STATUS_FULL_GET(x) -#define MBOX_FIFO_STATUS_FULL_SET(x) WLAN_MBOX_FIFO_STATUS_FULL_SET(x) -#define MBOX_DMA_POLICY_ADDRESS WLAN_MBOX_DMA_POLICY_ADDRESS -#define MBOX_DMA_POLICY_OFFSET WLAN_MBOX_DMA_POLICY_OFFSET -#define MBOX_DMA_POLICY_TX_QUANTUM_MSB WLAN_MBOX_DMA_POLICY_TX_QUANTUM_MSB -#define MBOX_DMA_POLICY_TX_QUANTUM_LSB WLAN_MBOX_DMA_POLICY_TX_QUANTUM_LSB -#define MBOX_DMA_POLICY_TX_QUANTUM_MASK WLAN_MBOX_DMA_POLICY_TX_QUANTUM_MASK -#define MBOX_DMA_POLICY_TX_QUANTUM_GET(x) WLAN_MBOX_DMA_POLICY_TX_QUANTUM_GET(x) -#define MBOX_DMA_POLICY_TX_QUANTUM_SET(x) WLAN_MBOX_DMA_POLICY_TX_QUANTUM_SET(x) -#define MBOX_DMA_POLICY_TX_ORDER_MSB WLAN_MBOX_DMA_POLICY_TX_ORDER_MSB -#define MBOX_DMA_POLICY_TX_ORDER_LSB WLAN_MBOX_DMA_POLICY_TX_ORDER_LSB -#define MBOX_DMA_POLICY_TX_ORDER_MASK WLAN_MBOX_DMA_POLICY_TX_ORDER_MASK -#define MBOX_DMA_POLICY_TX_ORDER_GET(x) WLAN_MBOX_DMA_POLICY_TX_ORDER_GET(x) -#define MBOX_DMA_POLICY_TX_ORDER_SET(x) WLAN_MBOX_DMA_POLICY_TX_ORDER_SET(x) -#define MBOX_DMA_POLICY_RX_QUANTUM_MSB WLAN_MBOX_DMA_POLICY_RX_QUANTUM_MSB -#define MBOX_DMA_POLICY_RX_QUANTUM_LSB WLAN_MBOX_DMA_POLICY_RX_QUANTUM_LSB -#define MBOX_DMA_POLICY_RX_QUANTUM_MASK WLAN_MBOX_DMA_POLICY_RX_QUANTUM_MASK -#define MBOX_DMA_POLICY_RX_QUANTUM_GET(x) WLAN_MBOX_DMA_POLICY_RX_QUANTUM_GET(x) -#define MBOX_DMA_POLICY_RX_QUANTUM_SET(x) WLAN_MBOX_DMA_POLICY_RX_QUANTUM_SET(x) -#define MBOX_DMA_POLICY_RX_ORDER_MSB WLAN_MBOX_DMA_POLICY_RX_ORDER_MSB -#define MBOX_DMA_POLICY_RX_ORDER_LSB WLAN_MBOX_DMA_POLICY_RX_ORDER_LSB -#define MBOX_DMA_POLICY_RX_ORDER_MASK WLAN_MBOX_DMA_POLICY_RX_ORDER_MASK -#define MBOX_DMA_POLICY_RX_ORDER_GET(x) WLAN_MBOX_DMA_POLICY_RX_ORDER_GET(x) -#define MBOX_DMA_POLICY_RX_ORDER_SET(x) WLAN_MBOX_DMA_POLICY_RX_ORDER_SET(x) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX0_DMA_RX_CONTROL_ADDRESS WLAN_MBOX0_DMA_RX_CONTROL_ADDRESS -#define MBOX0_DMA_RX_CONTROL_OFFSET WLAN_MBOX0_DMA_RX_CONTROL_OFFSET -#define MBOX0_DMA_RX_CONTROL_RESUME_MSB WLAN_MBOX0_DMA_RX_CONTROL_RESUME_MSB -#define MBOX0_DMA_RX_CONTROL_RESUME_LSB WLAN_MBOX0_DMA_RX_CONTROL_RESUME_LSB -#define MBOX0_DMA_RX_CONTROL_RESUME_MASK WLAN_MBOX0_DMA_RX_CONTROL_RESUME_MASK -#define MBOX0_DMA_RX_CONTROL_RESUME_GET(x) WLAN_MBOX0_DMA_RX_CONTROL_RESUME_GET(x) -#define MBOX0_DMA_RX_CONTROL_RESUME_SET(x) WLAN_MBOX0_DMA_RX_CONTROL_RESUME_SET(x) -#define MBOX0_DMA_RX_CONTROL_START_MSB WLAN_MBOX0_DMA_RX_CONTROL_START_MSB -#define MBOX0_DMA_RX_CONTROL_START_LSB WLAN_MBOX0_DMA_RX_CONTROL_START_LSB -#define MBOX0_DMA_RX_CONTROL_START_MASK WLAN_MBOX0_DMA_RX_CONTROL_START_MASK -#define MBOX0_DMA_RX_CONTROL_START_GET(x) WLAN_MBOX0_DMA_RX_CONTROL_START_GET(x) -#define MBOX0_DMA_RX_CONTROL_START_SET(x) WLAN_MBOX0_DMA_RX_CONTROL_START_SET(x) -#define MBOX0_DMA_RX_CONTROL_STOP_MSB WLAN_MBOX0_DMA_RX_CONTROL_STOP_MSB -#define MBOX0_DMA_RX_CONTROL_STOP_LSB WLAN_MBOX0_DMA_RX_CONTROL_STOP_LSB -#define MBOX0_DMA_RX_CONTROL_STOP_MASK WLAN_MBOX0_DMA_RX_CONTROL_STOP_MASK -#define MBOX0_DMA_RX_CONTROL_STOP_GET(x) WLAN_MBOX0_DMA_RX_CONTROL_STOP_GET(x) -#define MBOX0_DMA_RX_CONTROL_STOP_SET(x) WLAN_MBOX0_DMA_RX_CONTROL_STOP_SET(x) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX0_DMA_TX_CONTROL_ADDRESS WLAN_MBOX0_DMA_TX_CONTROL_ADDRESS -#define MBOX0_DMA_TX_CONTROL_OFFSET WLAN_MBOX0_DMA_TX_CONTROL_OFFSET -#define MBOX0_DMA_TX_CONTROL_RESUME_MSB WLAN_MBOX0_DMA_TX_CONTROL_RESUME_MSB -#define MBOX0_DMA_TX_CONTROL_RESUME_LSB WLAN_MBOX0_DMA_TX_CONTROL_RESUME_LSB -#define MBOX0_DMA_TX_CONTROL_RESUME_MASK WLAN_MBOX0_DMA_TX_CONTROL_RESUME_MASK -#define MBOX0_DMA_TX_CONTROL_RESUME_GET(x) WLAN_MBOX0_DMA_TX_CONTROL_RESUME_GET(x) -#define MBOX0_DMA_TX_CONTROL_RESUME_SET(x) WLAN_MBOX0_DMA_TX_CONTROL_RESUME_SET(x) -#define MBOX0_DMA_TX_CONTROL_START_MSB WLAN_MBOX0_DMA_TX_CONTROL_START_MSB -#define MBOX0_DMA_TX_CONTROL_START_LSB WLAN_MBOX0_DMA_TX_CONTROL_START_LSB -#define MBOX0_DMA_TX_CONTROL_START_MASK WLAN_MBOX0_DMA_TX_CONTROL_START_MASK -#define MBOX0_DMA_TX_CONTROL_START_GET(x) WLAN_MBOX0_DMA_TX_CONTROL_START_GET(x) -#define MBOX0_DMA_TX_CONTROL_START_SET(x) WLAN_MBOX0_DMA_TX_CONTROL_START_SET(x) -#define MBOX0_DMA_TX_CONTROL_STOP_MSB WLAN_MBOX0_DMA_TX_CONTROL_STOP_MSB -#define MBOX0_DMA_TX_CONTROL_STOP_LSB WLAN_MBOX0_DMA_TX_CONTROL_STOP_LSB -#define MBOX0_DMA_TX_CONTROL_STOP_MASK WLAN_MBOX0_DMA_TX_CONTROL_STOP_MASK -#define MBOX0_DMA_TX_CONTROL_STOP_GET(x) WLAN_MBOX0_DMA_TX_CONTROL_STOP_GET(x) -#define MBOX0_DMA_TX_CONTROL_STOP_SET(x) WLAN_MBOX0_DMA_TX_CONTROL_STOP_SET(x) -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_OFFSET -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX1_DMA_RX_CONTROL_ADDRESS WLAN_MBOX1_DMA_RX_CONTROL_ADDRESS -#define MBOX1_DMA_RX_CONTROL_OFFSET WLAN_MBOX1_DMA_RX_CONTROL_OFFSET -#define MBOX1_DMA_RX_CONTROL_RESUME_MSB WLAN_MBOX1_DMA_RX_CONTROL_RESUME_MSB -#define MBOX1_DMA_RX_CONTROL_RESUME_LSB WLAN_MBOX1_DMA_RX_CONTROL_RESUME_LSB -#define MBOX1_DMA_RX_CONTROL_RESUME_MASK WLAN_MBOX1_DMA_RX_CONTROL_RESUME_MASK -#define MBOX1_DMA_RX_CONTROL_RESUME_GET(x) WLAN_MBOX1_DMA_RX_CONTROL_RESUME_GET(x) -#define MBOX1_DMA_RX_CONTROL_RESUME_SET(x) WLAN_MBOX1_DMA_RX_CONTROL_RESUME_SET(x) -#define MBOX1_DMA_RX_CONTROL_START_MSB WLAN_MBOX1_DMA_RX_CONTROL_START_MSB -#define MBOX1_DMA_RX_CONTROL_START_LSB WLAN_MBOX1_DMA_RX_CONTROL_START_LSB -#define MBOX1_DMA_RX_CONTROL_START_MASK WLAN_MBOX1_DMA_RX_CONTROL_START_MASK -#define MBOX1_DMA_RX_CONTROL_START_GET(x) WLAN_MBOX1_DMA_RX_CONTROL_START_GET(x) -#define MBOX1_DMA_RX_CONTROL_START_SET(x) WLAN_MBOX1_DMA_RX_CONTROL_START_SET(x) -#define MBOX1_DMA_RX_CONTROL_STOP_MSB WLAN_MBOX1_DMA_RX_CONTROL_STOP_MSB -#define MBOX1_DMA_RX_CONTROL_STOP_LSB WLAN_MBOX1_DMA_RX_CONTROL_STOP_LSB -#define MBOX1_DMA_RX_CONTROL_STOP_MASK WLAN_MBOX1_DMA_RX_CONTROL_STOP_MASK -#define MBOX1_DMA_RX_CONTROL_STOP_GET(x) WLAN_MBOX1_DMA_RX_CONTROL_STOP_GET(x) -#define MBOX1_DMA_RX_CONTROL_STOP_SET(x) WLAN_MBOX1_DMA_RX_CONTROL_STOP_SET(x) -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_OFFSET -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX1_DMA_TX_CONTROL_ADDRESS WLAN_MBOX1_DMA_TX_CONTROL_ADDRESS -#define MBOX1_DMA_TX_CONTROL_OFFSET WLAN_MBOX1_DMA_TX_CONTROL_OFFSET -#define MBOX1_DMA_TX_CONTROL_RESUME_MSB WLAN_MBOX1_DMA_TX_CONTROL_RESUME_MSB -#define MBOX1_DMA_TX_CONTROL_RESUME_LSB WLAN_MBOX1_DMA_TX_CONTROL_RESUME_LSB -#define MBOX1_DMA_TX_CONTROL_RESUME_MASK WLAN_MBOX1_DMA_TX_CONTROL_RESUME_MASK -#define MBOX1_DMA_TX_CONTROL_RESUME_GET(x) WLAN_MBOX1_DMA_TX_CONTROL_RESUME_GET(x) -#define MBOX1_DMA_TX_CONTROL_RESUME_SET(x) WLAN_MBOX1_DMA_TX_CONTROL_RESUME_SET(x) -#define MBOX1_DMA_TX_CONTROL_START_MSB WLAN_MBOX1_DMA_TX_CONTROL_START_MSB -#define MBOX1_DMA_TX_CONTROL_START_LSB WLAN_MBOX1_DMA_TX_CONTROL_START_LSB -#define MBOX1_DMA_TX_CONTROL_START_MASK WLAN_MBOX1_DMA_TX_CONTROL_START_MASK -#define MBOX1_DMA_TX_CONTROL_START_GET(x) WLAN_MBOX1_DMA_TX_CONTROL_START_GET(x) -#define MBOX1_DMA_TX_CONTROL_START_SET(x) WLAN_MBOX1_DMA_TX_CONTROL_START_SET(x) -#define MBOX1_DMA_TX_CONTROL_STOP_MSB WLAN_MBOX1_DMA_TX_CONTROL_STOP_MSB -#define MBOX1_DMA_TX_CONTROL_STOP_LSB WLAN_MBOX1_DMA_TX_CONTROL_STOP_LSB -#define MBOX1_DMA_TX_CONTROL_STOP_MASK WLAN_MBOX1_DMA_TX_CONTROL_STOP_MASK -#define MBOX1_DMA_TX_CONTROL_STOP_GET(x) WLAN_MBOX1_DMA_TX_CONTROL_STOP_GET(x) -#define MBOX1_DMA_TX_CONTROL_STOP_SET(x) WLAN_MBOX1_DMA_TX_CONTROL_STOP_SET(x) -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_OFFSET -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX2_DMA_RX_CONTROL_ADDRESS WLAN_MBOX2_DMA_RX_CONTROL_ADDRESS -#define MBOX2_DMA_RX_CONTROL_OFFSET WLAN_MBOX2_DMA_RX_CONTROL_OFFSET -#define MBOX2_DMA_RX_CONTROL_RESUME_MSB WLAN_MBOX2_DMA_RX_CONTROL_RESUME_MSB -#define MBOX2_DMA_RX_CONTROL_RESUME_LSB WLAN_MBOX2_DMA_RX_CONTROL_RESUME_LSB -#define MBOX2_DMA_RX_CONTROL_RESUME_MASK WLAN_MBOX2_DMA_RX_CONTROL_RESUME_MASK -#define MBOX2_DMA_RX_CONTROL_RESUME_GET(x) WLAN_MBOX2_DMA_RX_CONTROL_RESUME_GET(x) -#define MBOX2_DMA_RX_CONTROL_RESUME_SET(x) WLAN_MBOX2_DMA_RX_CONTROL_RESUME_SET(x) -#define MBOX2_DMA_RX_CONTROL_START_MSB WLAN_MBOX2_DMA_RX_CONTROL_START_MSB -#define MBOX2_DMA_RX_CONTROL_START_LSB WLAN_MBOX2_DMA_RX_CONTROL_START_LSB -#define MBOX2_DMA_RX_CONTROL_START_MASK WLAN_MBOX2_DMA_RX_CONTROL_START_MASK -#define MBOX2_DMA_RX_CONTROL_START_GET(x) WLAN_MBOX2_DMA_RX_CONTROL_START_GET(x) -#define MBOX2_DMA_RX_CONTROL_START_SET(x) WLAN_MBOX2_DMA_RX_CONTROL_START_SET(x) -#define MBOX2_DMA_RX_CONTROL_STOP_MSB WLAN_MBOX2_DMA_RX_CONTROL_STOP_MSB -#define MBOX2_DMA_RX_CONTROL_STOP_LSB WLAN_MBOX2_DMA_RX_CONTROL_STOP_LSB -#define MBOX2_DMA_RX_CONTROL_STOP_MASK WLAN_MBOX2_DMA_RX_CONTROL_STOP_MASK -#define MBOX2_DMA_RX_CONTROL_STOP_GET(x) WLAN_MBOX2_DMA_RX_CONTROL_STOP_GET(x) -#define MBOX2_DMA_RX_CONTROL_STOP_SET(x) WLAN_MBOX2_DMA_RX_CONTROL_STOP_SET(x) -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_OFFSET -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX2_DMA_TX_CONTROL_ADDRESS WLAN_MBOX2_DMA_TX_CONTROL_ADDRESS -#define MBOX2_DMA_TX_CONTROL_OFFSET WLAN_MBOX2_DMA_TX_CONTROL_OFFSET -#define MBOX2_DMA_TX_CONTROL_RESUME_MSB WLAN_MBOX2_DMA_TX_CONTROL_RESUME_MSB -#define MBOX2_DMA_TX_CONTROL_RESUME_LSB WLAN_MBOX2_DMA_TX_CONTROL_RESUME_LSB -#define MBOX2_DMA_TX_CONTROL_RESUME_MASK WLAN_MBOX2_DMA_TX_CONTROL_RESUME_MASK -#define MBOX2_DMA_TX_CONTROL_RESUME_GET(x) WLAN_MBOX2_DMA_TX_CONTROL_RESUME_GET(x) -#define MBOX2_DMA_TX_CONTROL_RESUME_SET(x) WLAN_MBOX2_DMA_TX_CONTROL_RESUME_SET(x) -#define MBOX2_DMA_TX_CONTROL_START_MSB WLAN_MBOX2_DMA_TX_CONTROL_START_MSB -#define MBOX2_DMA_TX_CONTROL_START_LSB WLAN_MBOX2_DMA_TX_CONTROL_START_LSB -#define MBOX2_DMA_TX_CONTROL_START_MASK WLAN_MBOX2_DMA_TX_CONTROL_START_MASK -#define MBOX2_DMA_TX_CONTROL_START_GET(x) WLAN_MBOX2_DMA_TX_CONTROL_START_GET(x) -#define MBOX2_DMA_TX_CONTROL_START_SET(x) WLAN_MBOX2_DMA_TX_CONTROL_START_SET(x) -#define MBOX2_DMA_TX_CONTROL_STOP_MSB WLAN_MBOX2_DMA_TX_CONTROL_STOP_MSB -#define MBOX2_DMA_TX_CONTROL_STOP_LSB WLAN_MBOX2_DMA_TX_CONTROL_STOP_LSB -#define MBOX2_DMA_TX_CONTROL_STOP_MASK WLAN_MBOX2_DMA_TX_CONTROL_STOP_MASK -#define MBOX2_DMA_TX_CONTROL_STOP_GET(x) WLAN_MBOX2_DMA_TX_CONTROL_STOP_GET(x) -#define MBOX2_DMA_TX_CONTROL_STOP_SET(x) WLAN_MBOX2_DMA_TX_CONTROL_STOP_SET(x) -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_OFFSET -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX3_DMA_RX_CONTROL_ADDRESS WLAN_MBOX3_DMA_RX_CONTROL_ADDRESS -#define MBOX3_DMA_RX_CONTROL_OFFSET WLAN_MBOX3_DMA_RX_CONTROL_OFFSET -#define MBOX3_DMA_RX_CONTROL_RESUME_MSB WLAN_MBOX3_DMA_RX_CONTROL_RESUME_MSB -#define MBOX3_DMA_RX_CONTROL_RESUME_LSB WLAN_MBOX3_DMA_RX_CONTROL_RESUME_LSB -#define MBOX3_DMA_RX_CONTROL_RESUME_MASK WLAN_MBOX3_DMA_RX_CONTROL_RESUME_MASK -#define MBOX3_DMA_RX_CONTROL_RESUME_GET(x) WLAN_MBOX3_DMA_RX_CONTROL_RESUME_GET(x) -#define MBOX3_DMA_RX_CONTROL_RESUME_SET(x) WLAN_MBOX3_DMA_RX_CONTROL_RESUME_SET(x) -#define MBOX3_DMA_RX_CONTROL_START_MSB WLAN_MBOX3_DMA_RX_CONTROL_START_MSB -#define MBOX3_DMA_RX_CONTROL_START_LSB WLAN_MBOX3_DMA_RX_CONTROL_START_LSB -#define MBOX3_DMA_RX_CONTROL_START_MASK WLAN_MBOX3_DMA_RX_CONTROL_START_MASK -#define MBOX3_DMA_RX_CONTROL_START_GET(x) WLAN_MBOX3_DMA_RX_CONTROL_START_GET(x) -#define MBOX3_DMA_RX_CONTROL_START_SET(x) WLAN_MBOX3_DMA_RX_CONTROL_START_SET(x) -#define MBOX3_DMA_RX_CONTROL_STOP_MSB WLAN_MBOX3_DMA_RX_CONTROL_STOP_MSB -#define MBOX3_DMA_RX_CONTROL_STOP_LSB WLAN_MBOX3_DMA_RX_CONTROL_STOP_LSB -#define MBOX3_DMA_RX_CONTROL_STOP_MASK WLAN_MBOX3_DMA_RX_CONTROL_STOP_MASK -#define MBOX3_DMA_RX_CONTROL_STOP_GET(x) WLAN_MBOX3_DMA_RX_CONTROL_STOP_GET(x) -#define MBOX3_DMA_RX_CONTROL_STOP_SET(x) WLAN_MBOX3_DMA_RX_CONTROL_STOP_SET(x) -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_OFFSET -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX3_DMA_TX_CONTROL_ADDRESS WLAN_MBOX3_DMA_TX_CONTROL_ADDRESS -#define MBOX3_DMA_TX_CONTROL_OFFSET WLAN_MBOX3_DMA_TX_CONTROL_OFFSET -#define MBOX3_DMA_TX_CONTROL_RESUME_MSB WLAN_MBOX3_DMA_TX_CONTROL_RESUME_MSB -#define MBOX3_DMA_TX_CONTROL_RESUME_LSB WLAN_MBOX3_DMA_TX_CONTROL_RESUME_LSB -#define MBOX3_DMA_TX_CONTROL_RESUME_MASK WLAN_MBOX3_DMA_TX_CONTROL_RESUME_MASK -#define MBOX3_DMA_TX_CONTROL_RESUME_GET(x) WLAN_MBOX3_DMA_TX_CONTROL_RESUME_GET(x) -#define MBOX3_DMA_TX_CONTROL_RESUME_SET(x) WLAN_MBOX3_DMA_TX_CONTROL_RESUME_SET(x) -#define MBOX3_DMA_TX_CONTROL_START_MSB WLAN_MBOX3_DMA_TX_CONTROL_START_MSB -#define MBOX3_DMA_TX_CONTROL_START_LSB WLAN_MBOX3_DMA_TX_CONTROL_START_LSB -#define MBOX3_DMA_TX_CONTROL_START_MASK WLAN_MBOX3_DMA_TX_CONTROL_START_MASK -#define MBOX3_DMA_TX_CONTROL_START_GET(x) WLAN_MBOX3_DMA_TX_CONTROL_START_GET(x) -#define MBOX3_DMA_TX_CONTROL_START_SET(x) WLAN_MBOX3_DMA_TX_CONTROL_START_SET(x) -#define MBOX3_DMA_TX_CONTROL_STOP_MSB WLAN_MBOX3_DMA_TX_CONTROL_STOP_MSB -#define MBOX3_DMA_TX_CONTROL_STOP_LSB WLAN_MBOX3_DMA_TX_CONTROL_STOP_LSB -#define MBOX3_DMA_TX_CONTROL_STOP_MASK WLAN_MBOX3_DMA_TX_CONTROL_STOP_MASK -#define MBOX3_DMA_TX_CONTROL_STOP_GET(x) WLAN_MBOX3_DMA_TX_CONTROL_STOP_GET(x) -#define MBOX3_DMA_TX_CONTROL_STOP_SET(x) WLAN_MBOX3_DMA_TX_CONTROL_STOP_SET(x) -#define MBOX_INT_STATUS_ADDRESS WLAN_MBOX_INT_STATUS_ADDRESS -#define MBOX_INT_STATUS_OFFSET WLAN_MBOX_INT_STATUS_OFFSET -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_MSB WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_MSB -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_MSB WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_MSB -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) -#define MBOX_INT_STATUS_TX_OVERFLOW_MSB WLAN_MBOX_INT_STATUS_TX_OVERFLOW_MSB -#define MBOX_INT_STATUS_TX_OVERFLOW_LSB WLAN_MBOX_INT_STATUS_TX_OVERFLOW_LSB -#define MBOX_INT_STATUS_TX_OVERFLOW_MASK WLAN_MBOX_INT_STATUS_TX_OVERFLOW_MASK -#define MBOX_INT_STATUS_TX_OVERFLOW_GET(x) WLAN_MBOX_INT_STATUS_TX_OVERFLOW_GET(x) -#define MBOX_INT_STATUS_TX_OVERFLOW_SET(x) WLAN_MBOX_INT_STATUS_TX_OVERFLOW_SET(x) -#define MBOX_INT_STATUS_RX_UNDERFLOW_MSB WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_MSB -#define MBOX_INT_STATUS_RX_UNDERFLOW_LSB WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_LSB -#define MBOX_INT_STATUS_RX_UNDERFLOW_MASK WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_MASK -#define MBOX_INT_STATUS_RX_UNDERFLOW_GET(x) WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_GET(x) -#define MBOX_INT_STATUS_RX_UNDERFLOW_SET(x) WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_SET(x) -#define MBOX_INT_STATUS_TX_NOT_EMPTY_MSB WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_MSB -#define MBOX_INT_STATUS_TX_NOT_EMPTY_LSB WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_LSB -#define MBOX_INT_STATUS_TX_NOT_EMPTY_MASK WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_MASK -#define MBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) -#define MBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) -#define MBOX_INT_STATUS_RX_NOT_FULL_MSB WLAN_MBOX_INT_STATUS_RX_NOT_FULL_MSB -#define MBOX_INT_STATUS_RX_NOT_FULL_LSB WLAN_MBOX_INT_STATUS_RX_NOT_FULL_LSB -#define MBOX_INT_STATUS_RX_NOT_FULL_MASK WLAN_MBOX_INT_STATUS_RX_NOT_FULL_MASK -#define MBOX_INT_STATUS_RX_NOT_FULL_GET(x) WLAN_MBOX_INT_STATUS_RX_NOT_FULL_GET(x) -#define MBOX_INT_STATUS_RX_NOT_FULL_SET(x) WLAN_MBOX_INT_STATUS_RX_NOT_FULL_SET(x) -#define MBOX_INT_STATUS_HOST_MSB WLAN_MBOX_INT_STATUS_HOST_MSB -#define MBOX_INT_STATUS_HOST_LSB WLAN_MBOX_INT_STATUS_HOST_LSB -#define MBOX_INT_STATUS_HOST_MASK WLAN_MBOX_INT_STATUS_HOST_MASK -#define MBOX_INT_STATUS_HOST_GET(x) WLAN_MBOX_INT_STATUS_HOST_GET(x) -#define MBOX_INT_STATUS_HOST_SET(x) WLAN_MBOX_INT_STATUS_HOST_SET(x) -#define MBOX_INT_ENABLE_ADDRESS WLAN_MBOX_INT_ENABLE_ADDRESS -#define MBOX_INT_ENABLE_OFFSET WLAN_MBOX_INT_ENABLE_OFFSET -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) -#define MBOX_INT_ENABLE_TX_OVERFLOW_MSB WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_MSB -#define MBOX_INT_ENABLE_TX_OVERFLOW_LSB WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_LSB -#define MBOX_INT_ENABLE_TX_OVERFLOW_MASK WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_MASK -#define MBOX_INT_ENABLE_TX_OVERFLOW_GET(x) WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_GET(x) -#define MBOX_INT_ENABLE_TX_OVERFLOW_SET(x) WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_SET(x) -#define MBOX_INT_ENABLE_RX_UNDERFLOW_MSB WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_MSB -#define MBOX_INT_ENABLE_RX_UNDERFLOW_LSB WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_LSB -#define MBOX_INT_ENABLE_RX_UNDERFLOW_MASK WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_MASK -#define MBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) -#define MBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_MSB WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_MSB -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) -#define MBOX_INT_ENABLE_RX_NOT_FULL_MSB WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_MSB -#define MBOX_INT_ENABLE_RX_NOT_FULL_LSB WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_LSB -#define MBOX_INT_ENABLE_RX_NOT_FULL_MASK WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_MASK -#define MBOX_INT_ENABLE_RX_NOT_FULL_GET(x) WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_GET(x) -#define MBOX_INT_ENABLE_RX_NOT_FULL_SET(x) WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_SET(x) -#define MBOX_INT_ENABLE_HOST_MSB WLAN_MBOX_INT_ENABLE_HOST_MSB -#define MBOX_INT_ENABLE_HOST_LSB WLAN_MBOX_INT_ENABLE_HOST_LSB -#define MBOX_INT_ENABLE_HOST_MASK WLAN_MBOX_INT_ENABLE_HOST_MASK -#define MBOX_INT_ENABLE_HOST_GET(x) WLAN_MBOX_INT_ENABLE_HOST_GET(x) -#define MBOX_INT_ENABLE_HOST_SET(x) WLAN_MBOX_INT_ENABLE_HOST_SET(x) -#define INT_HOST_ADDRESS WLAN_INT_HOST_ADDRESS -#define INT_HOST_OFFSET WLAN_INT_HOST_OFFSET -#define INT_HOST_VECTOR_MSB WLAN_INT_HOST_VECTOR_MSB -#define INT_HOST_VECTOR_LSB WLAN_INT_HOST_VECTOR_LSB -#define INT_HOST_VECTOR_MASK WLAN_INT_HOST_VECTOR_MASK -#define INT_HOST_VECTOR_GET(x) WLAN_INT_HOST_VECTOR_GET(x) -#define INT_HOST_VECTOR_SET(x) WLAN_INT_HOST_VECTOR_SET(x) -#define LOCAL_COUNT_ADDRESS WLAN_LOCAL_COUNT_ADDRESS -#define LOCAL_COUNT_OFFSET WLAN_LOCAL_COUNT_OFFSET -#define LOCAL_COUNT_VALUE_MSB WLAN_LOCAL_COUNT_VALUE_MSB -#define LOCAL_COUNT_VALUE_LSB WLAN_LOCAL_COUNT_VALUE_LSB -#define LOCAL_COUNT_VALUE_MASK WLAN_LOCAL_COUNT_VALUE_MASK -#define LOCAL_COUNT_VALUE_GET(x) WLAN_LOCAL_COUNT_VALUE_GET(x) -#define LOCAL_COUNT_VALUE_SET(x) WLAN_LOCAL_COUNT_VALUE_SET(x) -#define COUNT_INC_ADDRESS WLAN_COUNT_INC_ADDRESS -#define COUNT_INC_OFFSET WLAN_COUNT_INC_OFFSET -#define COUNT_INC_VALUE_MSB WLAN_COUNT_INC_VALUE_MSB -#define COUNT_INC_VALUE_LSB WLAN_COUNT_INC_VALUE_LSB -#define COUNT_INC_VALUE_MASK WLAN_COUNT_INC_VALUE_MASK -#define COUNT_INC_VALUE_GET(x) WLAN_COUNT_INC_VALUE_GET(x) -#define COUNT_INC_VALUE_SET(x) WLAN_COUNT_INC_VALUE_SET(x) -#define LOCAL_SCRATCH_ADDRESS WLAN_LOCAL_SCRATCH_ADDRESS -#define LOCAL_SCRATCH_OFFSET WLAN_LOCAL_SCRATCH_OFFSET -#define LOCAL_SCRATCH_VALUE_MSB WLAN_LOCAL_SCRATCH_VALUE_MSB -#define LOCAL_SCRATCH_VALUE_LSB WLAN_LOCAL_SCRATCH_VALUE_LSB -#define LOCAL_SCRATCH_VALUE_MASK WLAN_LOCAL_SCRATCH_VALUE_MASK -#define LOCAL_SCRATCH_VALUE_GET(x) WLAN_LOCAL_SCRATCH_VALUE_GET(x) -#define LOCAL_SCRATCH_VALUE_SET(x) WLAN_LOCAL_SCRATCH_VALUE_SET(x) -#define USE_LOCAL_BUS_ADDRESS WLAN_USE_LOCAL_BUS_ADDRESS -#define USE_LOCAL_BUS_OFFSET WLAN_USE_LOCAL_BUS_OFFSET -#define USE_LOCAL_BUS_PIN_INIT_MSB WLAN_USE_LOCAL_BUS_PIN_INIT_MSB -#define USE_LOCAL_BUS_PIN_INIT_LSB WLAN_USE_LOCAL_BUS_PIN_INIT_LSB -#define USE_LOCAL_BUS_PIN_INIT_MASK WLAN_USE_LOCAL_BUS_PIN_INIT_MASK -#define USE_LOCAL_BUS_PIN_INIT_GET(x) WLAN_USE_LOCAL_BUS_PIN_INIT_GET(x) -#define USE_LOCAL_BUS_PIN_INIT_SET(x) WLAN_USE_LOCAL_BUS_PIN_INIT_SET(x) -#define SDIO_CONFIG_ADDRESS WLAN_SDIO_CONFIG_ADDRESS -#define SDIO_CONFIG_OFFSET WLAN_SDIO_CONFIG_OFFSET -#define SDIO_CONFIG_CCCR_IOR1_MSB WLAN_SDIO_CONFIG_CCCR_IOR1_MSB -#define SDIO_CONFIG_CCCR_IOR1_LSB WLAN_SDIO_CONFIG_CCCR_IOR1_LSB -#define SDIO_CONFIG_CCCR_IOR1_MASK WLAN_SDIO_CONFIG_CCCR_IOR1_MASK -#define SDIO_CONFIG_CCCR_IOR1_GET(x) WLAN_SDIO_CONFIG_CCCR_IOR1_GET(x) -#define SDIO_CONFIG_CCCR_IOR1_SET(x) WLAN_SDIO_CONFIG_CCCR_IOR1_SET(x) -#define MBOX_DEBUG_ADDRESS WLAN_MBOX_DEBUG_ADDRESS -#define MBOX_DEBUG_OFFSET WLAN_MBOX_DEBUG_OFFSET -#define MBOX_DEBUG_SEL_MSB WLAN_MBOX_DEBUG_SEL_MSB -#define MBOX_DEBUG_SEL_LSB WLAN_MBOX_DEBUG_SEL_LSB -#define MBOX_DEBUG_SEL_MASK WLAN_MBOX_DEBUG_SEL_MASK -#define MBOX_DEBUG_SEL_GET(x) WLAN_MBOX_DEBUG_SEL_GET(x) -#define MBOX_DEBUG_SEL_SET(x) WLAN_MBOX_DEBUG_SEL_SET(x) -#define MBOX_FIFO_RESET_ADDRESS WLAN_MBOX_FIFO_RESET_ADDRESS -#define MBOX_FIFO_RESET_OFFSET WLAN_MBOX_FIFO_RESET_OFFSET -#define MBOX_FIFO_RESET_INIT_MSB WLAN_MBOX_FIFO_RESET_INIT_MSB -#define MBOX_FIFO_RESET_INIT_LSB WLAN_MBOX_FIFO_RESET_INIT_LSB -#define MBOX_FIFO_RESET_INIT_MASK WLAN_MBOX_FIFO_RESET_INIT_MASK -#define MBOX_FIFO_RESET_INIT_GET(x) WLAN_MBOX_FIFO_RESET_INIT_GET(x) -#define MBOX_FIFO_RESET_INIT_SET(x) WLAN_MBOX_FIFO_RESET_INIT_SET(x) -#define MBOX_TXFIFO_POP_ADDRESS WLAN_MBOX_TXFIFO_POP_ADDRESS -#define MBOX_TXFIFO_POP_OFFSET WLAN_MBOX_TXFIFO_POP_OFFSET -#define MBOX_TXFIFO_POP_DATA_MSB WLAN_MBOX_TXFIFO_POP_DATA_MSB -#define MBOX_TXFIFO_POP_DATA_LSB WLAN_MBOX_TXFIFO_POP_DATA_LSB -#define MBOX_TXFIFO_POP_DATA_MASK WLAN_MBOX_TXFIFO_POP_DATA_MASK -#define MBOX_TXFIFO_POP_DATA_GET(x) WLAN_MBOX_TXFIFO_POP_DATA_GET(x) -#define MBOX_TXFIFO_POP_DATA_SET(x) WLAN_MBOX_TXFIFO_POP_DATA_SET(x) -#define MBOX_RXFIFO_POP_ADDRESS WLAN_MBOX_RXFIFO_POP_ADDRESS -#define MBOX_RXFIFO_POP_OFFSET WLAN_MBOX_RXFIFO_POP_OFFSET -#define MBOX_RXFIFO_POP_DATA_MSB WLAN_MBOX_RXFIFO_POP_DATA_MSB -#define MBOX_RXFIFO_POP_DATA_LSB WLAN_MBOX_RXFIFO_POP_DATA_LSB -#define MBOX_RXFIFO_POP_DATA_MASK WLAN_MBOX_RXFIFO_POP_DATA_MASK -#define MBOX_RXFIFO_POP_DATA_GET(x) WLAN_MBOX_RXFIFO_POP_DATA_GET(x) -#define MBOX_RXFIFO_POP_DATA_SET(x) WLAN_MBOX_RXFIFO_POP_DATA_SET(x) -#define SDIO_DEBUG_ADDRESS WLAN_SDIO_DEBUG_ADDRESS -#define SDIO_DEBUG_OFFSET WLAN_SDIO_DEBUG_OFFSET -#define SDIO_DEBUG_SEL_MSB WLAN_SDIO_DEBUG_SEL_MSB -#define SDIO_DEBUG_SEL_LSB WLAN_SDIO_DEBUG_SEL_LSB -#define SDIO_DEBUG_SEL_MASK WLAN_SDIO_DEBUG_SEL_MASK -#define SDIO_DEBUG_SEL_GET(x) WLAN_SDIO_DEBUG_SEL_GET(x) -#define SDIO_DEBUG_SEL_SET(x) WLAN_SDIO_DEBUG_SEL_SET(x) -#define GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS -#define GMBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET -#define GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB -#define GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB -#define GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK -#define GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define GMBOX0_DMA_RX_CONTROL_ADDRESS WLAN_GMBOX0_DMA_RX_CONTROL_ADDRESS -#define GMBOX0_DMA_RX_CONTROL_OFFSET WLAN_GMBOX0_DMA_RX_CONTROL_OFFSET -#define GMBOX0_DMA_RX_CONTROL_RESUME_MSB WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_MSB -#define GMBOX0_DMA_RX_CONTROL_RESUME_LSB WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_LSB -#define GMBOX0_DMA_RX_CONTROL_RESUME_MASK WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_MASK -#define GMBOX0_DMA_RX_CONTROL_RESUME_GET(x) WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_GET(x) -#define GMBOX0_DMA_RX_CONTROL_RESUME_SET(x) WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_SET(x) -#define GMBOX0_DMA_RX_CONTROL_START_MSB WLAN_GMBOX0_DMA_RX_CONTROL_START_MSB -#define GMBOX0_DMA_RX_CONTROL_START_LSB WLAN_GMBOX0_DMA_RX_CONTROL_START_LSB -#define GMBOX0_DMA_RX_CONTROL_START_MASK WLAN_GMBOX0_DMA_RX_CONTROL_START_MASK -#define GMBOX0_DMA_RX_CONTROL_START_GET(x) WLAN_GMBOX0_DMA_RX_CONTROL_START_GET(x) -#define GMBOX0_DMA_RX_CONTROL_START_SET(x) WLAN_GMBOX0_DMA_RX_CONTROL_START_SET(x) -#define GMBOX0_DMA_RX_CONTROL_STOP_MSB WLAN_GMBOX0_DMA_RX_CONTROL_STOP_MSB -#define GMBOX0_DMA_RX_CONTROL_STOP_LSB WLAN_GMBOX0_DMA_RX_CONTROL_STOP_LSB -#define GMBOX0_DMA_RX_CONTROL_STOP_MASK WLAN_GMBOX0_DMA_RX_CONTROL_STOP_MASK -#define GMBOX0_DMA_RX_CONTROL_STOP_GET(x) WLAN_GMBOX0_DMA_RX_CONTROL_STOP_GET(x) -#define GMBOX0_DMA_RX_CONTROL_STOP_SET(x) WLAN_GMBOX0_DMA_RX_CONTROL_STOP_SET(x) -#define GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS -#define GMBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET -#define GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB -#define GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB -#define GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK -#define GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define GMBOX0_DMA_TX_CONTROL_ADDRESS WLAN_GMBOX0_DMA_TX_CONTROL_ADDRESS -#define GMBOX0_DMA_TX_CONTROL_OFFSET WLAN_GMBOX0_DMA_TX_CONTROL_OFFSET -#define GMBOX0_DMA_TX_CONTROL_RESUME_MSB WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_MSB -#define GMBOX0_DMA_TX_CONTROL_RESUME_LSB WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_LSB -#define GMBOX0_DMA_TX_CONTROL_RESUME_MASK WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_MASK -#define GMBOX0_DMA_TX_CONTROL_RESUME_GET(x) WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_GET(x) -#define GMBOX0_DMA_TX_CONTROL_RESUME_SET(x) WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_SET(x) -#define GMBOX0_DMA_TX_CONTROL_START_MSB WLAN_GMBOX0_DMA_TX_CONTROL_START_MSB -#define GMBOX0_DMA_TX_CONTROL_START_LSB WLAN_GMBOX0_DMA_TX_CONTROL_START_LSB -#define GMBOX0_DMA_TX_CONTROL_START_MASK WLAN_GMBOX0_DMA_TX_CONTROL_START_MASK -#define GMBOX0_DMA_TX_CONTROL_START_GET(x) WLAN_GMBOX0_DMA_TX_CONTROL_START_GET(x) -#define GMBOX0_DMA_TX_CONTROL_START_SET(x) WLAN_GMBOX0_DMA_TX_CONTROL_START_SET(x) -#define GMBOX0_DMA_TX_CONTROL_STOP_MSB WLAN_GMBOX0_DMA_TX_CONTROL_STOP_MSB -#define GMBOX0_DMA_TX_CONTROL_STOP_LSB WLAN_GMBOX0_DMA_TX_CONTROL_STOP_LSB -#define GMBOX0_DMA_TX_CONTROL_STOP_MASK WLAN_GMBOX0_DMA_TX_CONTROL_STOP_MASK -#define GMBOX0_DMA_TX_CONTROL_STOP_GET(x) WLAN_GMBOX0_DMA_TX_CONTROL_STOP_GET(x) -#define GMBOX0_DMA_TX_CONTROL_STOP_SET(x) WLAN_GMBOX0_DMA_TX_CONTROL_STOP_SET(x) -#define GMBOX_INT_STATUS_ADDRESS WLAN_GMBOX_INT_STATUS_ADDRESS -#define GMBOX_INT_STATUS_OFFSET WLAN_GMBOX_INT_STATUS_OFFSET -#define GMBOX_INT_STATUS_TX_OVERFLOW_MSB WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_MSB -#define GMBOX_INT_STATUS_TX_OVERFLOW_LSB WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_LSB -#define GMBOX_INT_STATUS_TX_OVERFLOW_MASK WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_MASK -#define GMBOX_INT_STATUS_TX_OVERFLOW_GET(x) WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_GET(x) -#define GMBOX_INT_STATUS_TX_OVERFLOW_SET(x) WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_SET(x) -#define GMBOX_INT_STATUS_RX_UNDERFLOW_MSB WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_MSB -#define GMBOX_INT_STATUS_RX_UNDERFLOW_LSB WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_LSB -#define GMBOX_INT_STATUS_RX_UNDERFLOW_MASK WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_MASK -#define GMBOX_INT_STATUS_RX_UNDERFLOW_GET(x) WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_GET(x) -#define GMBOX_INT_STATUS_RX_UNDERFLOW_SET(x) WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_SET(x) -#define GMBOX_INT_STATUS_RX_DMA_COMPLETE_MSB WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_MSB -#define GMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB -#define GMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK -#define GMBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) -#define GMBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) -#define GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB -#define GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB -#define GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK -#define GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) -#define GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) -#define GMBOX_INT_STATUS_TX_DMA_COMPLETE_MSB WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_MSB -#define GMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB -#define GMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK -#define GMBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) -#define GMBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) -#define GMBOX_INT_STATUS_TX_NOT_EMPTY_MSB WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_MSB -#define GMBOX_INT_STATUS_TX_NOT_EMPTY_LSB WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_LSB -#define GMBOX_INT_STATUS_TX_NOT_EMPTY_MASK WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_MASK -#define GMBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) -#define GMBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) -#define GMBOX_INT_STATUS_RX_NOT_FULL_MSB WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_MSB -#define GMBOX_INT_STATUS_RX_NOT_FULL_LSB WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_LSB -#define GMBOX_INT_STATUS_RX_NOT_FULL_MASK WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_MASK -#define GMBOX_INT_STATUS_RX_NOT_FULL_GET(x) WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_GET(x) -#define GMBOX_INT_STATUS_RX_NOT_FULL_SET(x) WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_SET(x) -#define GMBOX_INT_ENABLE_ADDRESS WLAN_GMBOX_INT_ENABLE_ADDRESS -#define GMBOX_INT_ENABLE_OFFSET WLAN_GMBOX_INT_ENABLE_OFFSET -#define GMBOX_INT_ENABLE_TX_OVERFLOW_MSB WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_MSB -#define GMBOX_INT_ENABLE_TX_OVERFLOW_LSB WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_LSB -#define GMBOX_INT_ENABLE_TX_OVERFLOW_MASK WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_MASK -#define GMBOX_INT_ENABLE_TX_OVERFLOW_GET(x) WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_GET(x) -#define GMBOX_INT_ENABLE_TX_OVERFLOW_SET(x) WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_SET(x) -#define GMBOX_INT_ENABLE_RX_UNDERFLOW_MSB WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_MSB -#define GMBOX_INT_ENABLE_RX_UNDERFLOW_LSB WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_LSB -#define GMBOX_INT_ENABLE_RX_UNDERFLOW_MASK WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_MASK -#define GMBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) -#define GMBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) -#define GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB -#define GMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB -#define GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK -#define GMBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) -#define GMBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) -#define GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB -#define GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB -#define GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK -#define GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) -#define GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) -#define GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB -#define GMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB -#define GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK -#define GMBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) -#define GMBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) -#define GMBOX_INT_ENABLE_TX_NOT_EMPTY_MSB WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_MSB -#define GMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB -#define GMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK -#define GMBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) -#define GMBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) -#define GMBOX_INT_ENABLE_RX_NOT_FULL_MSB WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_MSB -#define GMBOX_INT_ENABLE_RX_NOT_FULL_LSB WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_LSB -#define GMBOX_INT_ENABLE_RX_NOT_FULL_MASK WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_MASK -#define GMBOX_INT_ENABLE_RX_NOT_FULL_GET(x) WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_GET(x) -#define GMBOX_INT_ENABLE_RX_NOT_FULL_SET(x) WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_SET(x) -#define HOST_IF_WINDOW_ADDRESS WLAN_HOST_IF_WINDOW_ADDRESS -#define HOST_IF_WINDOW_OFFSET WLAN_HOST_IF_WINDOW_OFFSET -#define HOST_IF_WINDOW_DATA_MSB WLAN_HOST_IF_WINDOW_DATA_MSB -#define HOST_IF_WINDOW_DATA_LSB WLAN_HOST_IF_WINDOW_DATA_LSB -#define HOST_IF_WINDOW_DATA_MASK WLAN_HOST_IF_WINDOW_DATA_MASK -#define HOST_IF_WINDOW_DATA_GET(x) WLAN_HOST_IF_WINDOW_DATA_GET(x) -#define HOST_IF_WINDOW_DATA_SET(x) WLAN_HOST_IF_WINDOW_DATA_SET(x) - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_wlan_host_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_wlan_host_reg.h deleted file mode 100644 index ba03a4876cd7..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_wlan_host_reg.h +++ /dev/null @@ -1,522 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _MBOX_WLAN_HOST_REG_REG_H_ -#define _MBOX_WLAN_HOST_REG_REG_H_ - -#define HOST_INT_STATUS_ADDRESS 0x00000400 -#define HOST_INT_STATUS_OFFSET 0x00000400 -#define HOST_INT_STATUS_ERROR_MSB 7 -#define HOST_INT_STATUS_ERROR_LSB 7 -#define HOST_INT_STATUS_ERROR_MASK 0x00000080 -#define HOST_INT_STATUS_ERROR_GET(x) (((x) & HOST_INT_STATUS_ERROR_MASK) >> HOST_INT_STATUS_ERROR_LSB) -#define HOST_INT_STATUS_ERROR_SET(x) (((x) << HOST_INT_STATUS_ERROR_LSB) & HOST_INT_STATUS_ERROR_MASK) -#define HOST_INT_STATUS_CPU_MSB 6 -#define HOST_INT_STATUS_CPU_LSB 6 -#define HOST_INT_STATUS_CPU_MASK 0x00000040 -#define HOST_INT_STATUS_CPU_GET(x) (((x) & HOST_INT_STATUS_CPU_MASK) >> HOST_INT_STATUS_CPU_LSB) -#define HOST_INT_STATUS_CPU_SET(x) (((x) << HOST_INT_STATUS_CPU_LSB) & HOST_INT_STATUS_CPU_MASK) -#define HOST_INT_STATUS_INT_MSB 5 -#define HOST_INT_STATUS_INT_LSB 5 -#define HOST_INT_STATUS_INT_MASK 0x00000020 -#define HOST_INT_STATUS_INT_GET(x) (((x) & HOST_INT_STATUS_INT_MASK) >> HOST_INT_STATUS_INT_LSB) -#define HOST_INT_STATUS_INT_SET(x) (((x) << HOST_INT_STATUS_INT_LSB) & HOST_INT_STATUS_INT_MASK) -#define HOST_INT_STATUS_COUNTER_MSB 4 -#define HOST_INT_STATUS_COUNTER_LSB 4 -#define HOST_INT_STATUS_COUNTER_MASK 0x00000010 -#define HOST_INT_STATUS_COUNTER_GET(x) (((x) & HOST_INT_STATUS_COUNTER_MASK) >> HOST_INT_STATUS_COUNTER_LSB) -#define HOST_INT_STATUS_COUNTER_SET(x) (((x) << HOST_INT_STATUS_COUNTER_LSB) & HOST_INT_STATUS_COUNTER_MASK) -#define HOST_INT_STATUS_MBOX_DATA_MSB 3 -#define HOST_INT_STATUS_MBOX_DATA_LSB 0 -#define HOST_INT_STATUS_MBOX_DATA_MASK 0x0000000f -#define HOST_INT_STATUS_MBOX_DATA_GET(x) (((x) & HOST_INT_STATUS_MBOX_DATA_MASK) >> HOST_INT_STATUS_MBOX_DATA_LSB) -#define HOST_INT_STATUS_MBOX_DATA_SET(x) (((x) << HOST_INT_STATUS_MBOX_DATA_LSB) & HOST_INT_STATUS_MBOX_DATA_MASK) - -#define CPU_INT_STATUS_ADDRESS 0x00000401 -#define CPU_INT_STATUS_OFFSET 0x00000401 -#define CPU_INT_STATUS_BIT_MSB 7 -#define CPU_INT_STATUS_BIT_LSB 0 -#define CPU_INT_STATUS_BIT_MASK 0x000000ff -#define CPU_INT_STATUS_BIT_GET(x) (((x) & CPU_INT_STATUS_BIT_MASK) >> CPU_INT_STATUS_BIT_LSB) -#define CPU_INT_STATUS_BIT_SET(x) (((x) << CPU_INT_STATUS_BIT_LSB) & CPU_INT_STATUS_BIT_MASK) - -#define ERROR_INT_STATUS_ADDRESS 0x00000402 -#define ERROR_INT_STATUS_OFFSET 0x00000402 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_MSB 6 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_LSB 6 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_MASK 0x00000040 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_GET(x) (((x) & ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_MASK) >> ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_LSB) -#define ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_SET(x) (((x) << ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_LSB) & ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_MASK) -#define ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_MSB 5 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_LSB 5 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_MASK 0x00000020 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_GET(x) (((x) & ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_MASK) >> ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_LSB) -#define ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_SET(x) (((x) << ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_LSB) & ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_MASK) -#define ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_MSB 4 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_LSB 4 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_MASK 0x00000010 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_GET(x) (((x) & ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_MASK) >> ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_LSB) -#define ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_SET(x) (((x) << ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_LSB) & ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_MASK) -#define ERROR_INT_STATUS_SPI_MSB 3 -#define ERROR_INT_STATUS_SPI_LSB 3 -#define ERROR_INT_STATUS_SPI_MASK 0x00000008 -#define ERROR_INT_STATUS_SPI_GET(x) (((x) & ERROR_INT_STATUS_SPI_MASK) >> ERROR_INT_STATUS_SPI_LSB) -#define ERROR_INT_STATUS_SPI_SET(x) (((x) << ERROR_INT_STATUS_SPI_LSB) & ERROR_INT_STATUS_SPI_MASK) -#define ERROR_INT_STATUS_WAKEUP_MSB 2 -#define ERROR_INT_STATUS_WAKEUP_LSB 2 -#define ERROR_INT_STATUS_WAKEUP_MASK 0x00000004 -#define ERROR_INT_STATUS_WAKEUP_GET(x) (((x) & ERROR_INT_STATUS_WAKEUP_MASK) >> ERROR_INT_STATUS_WAKEUP_LSB) -#define ERROR_INT_STATUS_WAKEUP_SET(x) (((x) << ERROR_INT_STATUS_WAKEUP_LSB) & ERROR_INT_STATUS_WAKEUP_MASK) -#define ERROR_INT_STATUS_RX_UNDERFLOW_MSB 1 -#define ERROR_INT_STATUS_RX_UNDERFLOW_LSB 1 -#define ERROR_INT_STATUS_RX_UNDERFLOW_MASK 0x00000002 -#define ERROR_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & ERROR_INT_STATUS_RX_UNDERFLOW_MASK) >> ERROR_INT_STATUS_RX_UNDERFLOW_LSB) -#define ERROR_INT_STATUS_RX_UNDERFLOW_SET(x) (((x) << ERROR_INT_STATUS_RX_UNDERFLOW_LSB) & ERROR_INT_STATUS_RX_UNDERFLOW_MASK) -#define ERROR_INT_STATUS_TX_OVERFLOW_MSB 0 -#define ERROR_INT_STATUS_TX_OVERFLOW_LSB 0 -#define ERROR_INT_STATUS_TX_OVERFLOW_MASK 0x00000001 -#define ERROR_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & ERROR_INT_STATUS_TX_OVERFLOW_MASK) >> ERROR_INT_STATUS_TX_OVERFLOW_LSB) -#define ERROR_INT_STATUS_TX_OVERFLOW_SET(x) (((x) << ERROR_INT_STATUS_TX_OVERFLOW_LSB) & ERROR_INT_STATUS_TX_OVERFLOW_MASK) - -#define COUNTER_INT_STATUS_ADDRESS 0x00000403 -#define COUNTER_INT_STATUS_OFFSET 0x00000403 -#define COUNTER_INT_STATUS_COUNTER_MSB 7 -#define COUNTER_INT_STATUS_COUNTER_LSB 0 -#define COUNTER_INT_STATUS_COUNTER_MASK 0x000000ff -#define COUNTER_INT_STATUS_COUNTER_GET(x) (((x) & COUNTER_INT_STATUS_COUNTER_MASK) >> COUNTER_INT_STATUS_COUNTER_LSB) -#define COUNTER_INT_STATUS_COUNTER_SET(x) (((x) << COUNTER_INT_STATUS_COUNTER_LSB) & COUNTER_INT_STATUS_COUNTER_MASK) - -#define MBOX_FRAME_ADDRESS 0x00000404 -#define MBOX_FRAME_OFFSET 0x00000404 -#define MBOX_FRAME_RX_EOM_MSB 7 -#define MBOX_FRAME_RX_EOM_LSB 4 -#define MBOX_FRAME_RX_EOM_MASK 0x000000f0 -#define MBOX_FRAME_RX_EOM_GET(x) (((x) & MBOX_FRAME_RX_EOM_MASK) >> MBOX_FRAME_RX_EOM_LSB) -#define MBOX_FRAME_RX_EOM_SET(x) (((x) << MBOX_FRAME_RX_EOM_LSB) & MBOX_FRAME_RX_EOM_MASK) -#define MBOX_FRAME_RX_SOM_MSB 3 -#define MBOX_FRAME_RX_SOM_LSB 0 -#define MBOX_FRAME_RX_SOM_MASK 0x0000000f -#define MBOX_FRAME_RX_SOM_GET(x) (((x) & MBOX_FRAME_RX_SOM_MASK) >> MBOX_FRAME_RX_SOM_LSB) -#define MBOX_FRAME_RX_SOM_SET(x) (((x) << MBOX_FRAME_RX_SOM_LSB) & MBOX_FRAME_RX_SOM_MASK) - -#define RX_LOOKAHEAD_VALID_ADDRESS 0x00000405 -#define RX_LOOKAHEAD_VALID_OFFSET 0x00000405 -#define RX_LOOKAHEAD_VALID_MBOX_MSB 3 -#define RX_LOOKAHEAD_VALID_MBOX_LSB 0 -#define RX_LOOKAHEAD_VALID_MBOX_MASK 0x0000000f -#define RX_LOOKAHEAD_VALID_MBOX_GET(x) (((x) & RX_LOOKAHEAD_VALID_MBOX_MASK) >> RX_LOOKAHEAD_VALID_MBOX_LSB) -#define RX_LOOKAHEAD_VALID_MBOX_SET(x) (((x) << RX_LOOKAHEAD_VALID_MBOX_LSB) & RX_LOOKAHEAD_VALID_MBOX_MASK) - -#define HOST_INT_STATUS2_ADDRESS 0x00000406 -#define HOST_INT_STATUS2_OFFSET 0x00000406 -#define HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_MSB 2 -#define HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_LSB 2 -#define HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_MASK 0x00000004 -#define HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_GET(x) (((x) & HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_MASK) >> HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_LSB) -#define HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_SET(x) (((x) << HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_LSB) & HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_MASK) -#define HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_MSB 1 -#define HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_LSB 1 -#define HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_MASK 0x00000002 -#define HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_GET(x) (((x) & HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_MASK) >> HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_LSB) -#define HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_SET(x) (((x) << HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_LSB) & HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_MASK) -#define HOST_INT_STATUS2_GMBOX_DATA_MSB 0 -#define HOST_INT_STATUS2_GMBOX_DATA_LSB 0 -#define HOST_INT_STATUS2_GMBOX_DATA_MASK 0x00000001 -#define HOST_INT_STATUS2_GMBOX_DATA_GET(x) (((x) & HOST_INT_STATUS2_GMBOX_DATA_MASK) >> HOST_INT_STATUS2_GMBOX_DATA_LSB) -#define HOST_INT_STATUS2_GMBOX_DATA_SET(x) (((x) << HOST_INT_STATUS2_GMBOX_DATA_LSB) & HOST_INT_STATUS2_GMBOX_DATA_MASK) - -#define GMBOX_RX_AVAIL_ADDRESS 0x00000407 -#define GMBOX_RX_AVAIL_OFFSET 0x00000407 -#define GMBOX_RX_AVAIL_BYTE_MSB 6 -#define GMBOX_RX_AVAIL_BYTE_LSB 0 -#define GMBOX_RX_AVAIL_BYTE_MASK 0x0000007f -#define GMBOX_RX_AVAIL_BYTE_GET(x) (((x) & GMBOX_RX_AVAIL_BYTE_MASK) >> GMBOX_RX_AVAIL_BYTE_LSB) -#define GMBOX_RX_AVAIL_BYTE_SET(x) (((x) << GMBOX_RX_AVAIL_BYTE_LSB) & GMBOX_RX_AVAIL_BYTE_MASK) - -#define RX_LOOKAHEAD0_ADDRESS 0x00000408 -#define RX_LOOKAHEAD0_OFFSET 0x00000408 -#define RX_LOOKAHEAD0_DATA_MSB 7 -#define RX_LOOKAHEAD0_DATA_LSB 0 -#define RX_LOOKAHEAD0_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD0_DATA_GET(x) (((x) & RX_LOOKAHEAD0_DATA_MASK) >> RX_LOOKAHEAD0_DATA_LSB) -#define RX_LOOKAHEAD0_DATA_SET(x) (((x) << RX_LOOKAHEAD0_DATA_LSB) & RX_LOOKAHEAD0_DATA_MASK) - -#define RX_LOOKAHEAD1_ADDRESS 0x0000040c -#define RX_LOOKAHEAD1_OFFSET 0x0000040c -#define RX_LOOKAHEAD1_DATA_MSB 7 -#define RX_LOOKAHEAD1_DATA_LSB 0 -#define RX_LOOKAHEAD1_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD1_DATA_GET(x) (((x) & RX_LOOKAHEAD1_DATA_MASK) >> RX_LOOKAHEAD1_DATA_LSB) -#define RX_LOOKAHEAD1_DATA_SET(x) (((x) << RX_LOOKAHEAD1_DATA_LSB) & RX_LOOKAHEAD1_DATA_MASK) - -#define RX_LOOKAHEAD2_ADDRESS 0x00000410 -#define RX_LOOKAHEAD2_OFFSET 0x00000410 -#define RX_LOOKAHEAD2_DATA_MSB 7 -#define RX_LOOKAHEAD2_DATA_LSB 0 -#define RX_LOOKAHEAD2_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD2_DATA_GET(x) (((x) & RX_LOOKAHEAD2_DATA_MASK) >> RX_LOOKAHEAD2_DATA_LSB) -#define RX_LOOKAHEAD2_DATA_SET(x) (((x) << RX_LOOKAHEAD2_DATA_LSB) & RX_LOOKAHEAD2_DATA_MASK) - -#define RX_LOOKAHEAD3_ADDRESS 0x00000414 -#define RX_LOOKAHEAD3_OFFSET 0x00000414 -#define RX_LOOKAHEAD3_DATA_MSB 7 -#define RX_LOOKAHEAD3_DATA_LSB 0 -#define RX_LOOKAHEAD3_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD3_DATA_GET(x) (((x) & RX_LOOKAHEAD3_DATA_MASK) >> RX_LOOKAHEAD3_DATA_LSB) -#define RX_LOOKAHEAD3_DATA_SET(x) (((x) << RX_LOOKAHEAD3_DATA_LSB) & RX_LOOKAHEAD3_DATA_MASK) - -#define INT_STATUS_ENABLE_ADDRESS 0x00000418 -#define INT_STATUS_ENABLE_OFFSET 0x00000418 -#define INT_STATUS_ENABLE_ERROR_MSB 7 -#define INT_STATUS_ENABLE_ERROR_LSB 7 -#define INT_STATUS_ENABLE_ERROR_MASK 0x00000080 -#define INT_STATUS_ENABLE_ERROR_GET(x) (((x) & INT_STATUS_ENABLE_ERROR_MASK) >> INT_STATUS_ENABLE_ERROR_LSB) -#define INT_STATUS_ENABLE_ERROR_SET(x) (((x) << INT_STATUS_ENABLE_ERROR_LSB) & INT_STATUS_ENABLE_ERROR_MASK) -#define INT_STATUS_ENABLE_CPU_MSB 6 -#define INT_STATUS_ENABLE_CPU_LSB 6 -#define INT_STATUS_ENABLE_CPU_MASK 0x00000040 -#define INT_STATUS_ENABLE_CPU_GET(x) (((x) & INT_STATUS_ENABLE_CPU_MASK) >> INT_STATUS_ENABLE_CPU_LSB) -#define INT_STATUS_ENABLE_CPU_SET(x) (((x) << INT_STATUS_ENABLE_CPU_LSB) & INT_STATUS_ENABLE_CPU_MASK) -#define INT_STATUS_ENABLE_INT_MSB 5 -#define INT_STATUS_ENABLE_INT_LSB 5 -#define INT_STATUS_ENABLE_INT_MASK 0x00000020 -#define INT_STATUS_ENABLE_INT_GET(x) (((x) & INT_STATUS_ENABLE_INT_MASK) >> INT_STATUS_ENABLE_INT_LSB) -#define INT_STATUS_ENABLE_INT_SET(x) (((x) << INT_STATUS_ENABLE_INT_LSB) & INT_STATUS_ENABLE_INT_MASK) -#define INT_STATUS_ENABLE_COUNTER_MSB 4 -#define INT_STATUS_ENABLE_COUNTER_LSB 4 -#define INT_STATUS_ENABLE_COUNTER_MASK 0x00000010 -#define INT_STATUS_ENABLE_COUNTER_GET(x) (((x) & INT_STATUS_ENABLE_COUNTER_MASK) >> INT_STATUS_ENABLE_COUNTER_LSB) -#define INT_STATUS_ENABLE_COUNTER_SET(x) (((x) << INT_STATUS_ENABLE_COUNTER_LSB) & INT_STATUS_ENABLE_COUNTER_MASK) -#define INT_STATUS_ENABLE_MBOX_DATA_MSB 3 -#define INT_STATUS_ENABLE_MBOX_DATA_LSB 0 -#define INT_STATUS_ENABLE_MBOX_DATA_MASK 0x0000000f -#define INT_STATUS_ENABLE_MBOX_DATA_GET(x) (((x) & INT_STATUS_ENABLE_MBOX_DATA_MASK) >> INT_STATUS_ENABLE_MBOX_DATA_LSB) -#define INT_STATUS_ENABLE_MBOX_DATA_SET(x) (((x) << INT_STATUS_ENABLE_MBOX_DATA_LSB) & INT_STATUS_ENABLE_MBOX_DATA_MASK) - -#define CPU_INT_STATUS_ENABLE_ADDRESS 0x00000419 -#define CPU_INT_STATUS_ENABLE_OFFSET 0x00000419 -#define CPU_INT_STATUS_ENABLE_BIT_MSB 7 -#define CPU_INT_STATUS_ENABLE_BIT_LSB 0 -#define CPU_INT_STATUS_ENABLE_BIT_MASK 0x000000ff -#define CPU_INT_STATUS_ENABLE_BIT_GET(x) (((x) & CPU_INT_STATUS_ENABLE_BIT_MASK) >> CPU_INT_STATUS_ENABLE_BIT_LSB) -#define CPU_INT_STATUS_ENABLE_BIT_SET(x) (((x) << CPU_INT_STATUS_ENABLE_BIT_LSB) & CPU_INT_STATUS_ENABLE_BIT_MASK) - -#define ERROR_STATUS_ENABLE_ADDRESS 0x0000041a -#define ERROR_STATUS_ENABLE_OFFSET 0x0000041a -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_MSB 6 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_LSB 6 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_MASK 0x00000040 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_GET(x) (((x) & ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_MASK) >> ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_LSB) -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_SET(x) (((x) << ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_LSB) & ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_MASK) -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_MSB 5 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_LSB 5 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_MASK 0x00000020 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_MASK) >> ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_LSB) -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_SET(x) (((x) << ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_LSB) & ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_MASK) -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_MSB 4 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_LSB 4 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_MASK 0x00000010 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_MASK) >> ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_LSB) -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_SET(x) (((x) << ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_LSB) & ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_MASK) -#define ERROR_STATUS_ENABLE_WAKEUP_MSB 2 -#define ERROR_STATUS_ENABLE_WAKEUP_LSB 2 -#define ERROR_STATUS_ENABLE_WAKEUP_MASK 0x00000004 -#define ERROR_STATUS_ENABLE_WAKEUP_GET(x) (((x) & ERROR_STATUS_ENABLE_WAKEUP_MASK) >> ERROR_STATUS_ENABLE_WAKEUP_LSB) -#define ERROR_STATUS_ENABLE_WAKEUP_SET(x) (((x) << ERROR_STATUS_ENABLE_WAKEUP_LSB) & ERROR_STATUS_ENABLE_WAKEUP_MASK) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MSB 1 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB 1 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 0x00000002 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK) >> ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_SET(x) (((x) << ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) & ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_MSB 0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB 0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK 0x00000001 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) >> ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_SET(x) (((x) << ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) & ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) - -#define COUNTER_INT_STATUS_ENABLE_ADDRESS 0x0000041b -#define COUNTER_INT_STATUS_ENABLE_OFFSET 0x0000041b -#define COUNTER_INT_STATUS_ENABLE_BIT_MSB 7 -#define COUNTER_INT_STATUS_ENABLE_BIT_LSB 0 -#define COUNTER_INT_STATUS_ENABLE_BIT_MASK 0x000000ff -#define COUNTER_INT_STATUS_ENABLE_BIT_GET(x) (((x) & COUNTER_INT_STATUS_ENABLE_BIT_MASK) >> COUNTER_INT_STATUS_ENABLE_BIT_LSB) -#define COUNTER_INT_STATUS_ENABLE_BIT_SET(x) (((x) << COUNTER_INT_STATUS_ENABLE_BIT_LSB) & COUNTER_INT_STATUS_ENABLE_BIT_MASK) - -#define COUNT_ADDRESS 0x00000420 -#define COUNT_OFFSET 0x00000420 -#define COUNT_VALUE_MSB 7 -#define COUNT_VALUE_LSB 0 -#define COUNT_VALUE_MASK 0x000000ff -#define COUNT_VALUE_GET(x) (((x) & COUNT_VALUE_MASK) >> COUNT_VALUE_LSB) -#define COUNT_VALUE_SET(x) (((x) << COUNT_VALUE_LSB) & COUNT_VALUE_MASK) - -#define COUNT_DEC_ADDRESS 0x00000440 -#define COUNT_DEC_OFFSET 0x00000440 -#define COUNT_DEC_VALUE_MSB 7 -#define COUNT_DEC_VALUE_LSB 0 -#define COUNT_DEC_VALUE_MASK 0x000000ff -#define COUNT_DEC_VALUE_GET(x) (((x) & COUNT_DEC_VALUE_MASK) >> COUNT_DEC_VALUE_LSB) -#define COUNT_DEC_VALUE_SET(x) (((x) << COUNT_DEC_VALUE_LSB) & COUNT_DEC_VALUE_MASK) - -#define SCRATCH_ADDRESS 0x00000460 -#define SCRATCH_OFFSET 0x00000460 -#define SCRATCH_VALUE_MSB 7 -#define SCRATCH_VALUE_LSB 0 -#define SCRATCH_VALUE_MASK 0x000000ff -#define SCRATCH_VALUE_GET(x) (((x) & SCRATCH_VALUE_MASK) >> SCRATCH_VALUE_LSB) -#define SCRATCH_VALUE_SET(x) (((x) << SCRATCH_VALUE_LSB) & SCRATCH_VALUE_MASK) - -#define FIFO_TIMEOUT_ADDRESS 0x00000468 -#define FIFO_TIMEOUT_OFFSET 0x00000468 -#define FIFO_TIMEOUT_VALUE_MSB 7 -#define FIFO_TIMEOUT_VALUE_LSB 0 -#define FIFO_TIMEOUT_VALUE_MASK 0x000000ff -#define FIFO_TIMEOUT_VALUE_GET(x) (((x) & FIFO_TIMEOUT_VALUE_MASK) >> FIFO_TIMEOUT_VALUE_LSB) -#define FIFO_TIMEOUT_VALUE_SET(x) (((x) << FIFO_TIMEOUT_VALUE_LSB) & FIFO_TIMEOUT_VALUE_MASK) - -#define FIFO_TIMEOUT_ENABLE_ADDRESS 0x00000469 -#define FIFO_TIMEOUT_ENABLE_OFFSET 0x00000469 -#define FIFO_TIMEOUT_ENABLE_SET_MSB 0 -#define FIFO_TIMEOUT_ENABLE_SET_LSB 0 -#define FIFO_TIMEOUT_ENABLE_SET_MASK 0x00000001 -#define FIFO_TIMEOUT_ENABLE_SET_GET(x) (((x) & FIFO_TIMEOUT_ENABLE_SET_MASK) >> FIFO_TIMEOUT_ENABLE_SET_LSB) -#define FIFO_TIMEOUT_ENABLE_SET_SET(x) (((x) << FIFO_TIMEOUT_ENABLE_SET_LSB) & FIFO_TIMEOUT_ENABLE_SET_MASK) - -#define DISABLE_SLEEP_ADDRESS 0x0000046a -#define DISABLE_SLEEP_OFFSET 0x0000046a -#define DISABLE_SLEEP_FOR_INT_MSB 1 -#define DISABLE_SLEEP_FOR_INT_LSB 1 -#define DISABLE_SLEEP_FOR_INT_MASK 0x00000002 -#define DISABLE_SLEEP_FOR_INT_GET(x) (((x) & DISABLE_SLEEP_FOR_INT_MASK) >> DISABLE_SLEEP_FOR_INT_LSB) -#define DISABLE_SLEEP_FOR_INT_SET(x) (((x) << DISABLE_SLEEP_FOR_INT_LSB) & DISABLE_SLEEP_FOR_INT_MASK) -#define DISABLE_SLEEP_ON_MSB 0 -#define DISABLE_SLEEP_ON_LSB 0 -#define DISABLE_SLEEP_ON_MASK 0x00000001 -#define DISABLE_SLEEP_ON_GET(x) (((x) & DISABLE_SLEEP_ON_MASK) >> DISABLE_SLEEP_ON_LSB) -#define DISABLE_SLEEP_ON_SET(x) (((x) << DISABLE_SLEEP_ON_LSB) & DISABLE_SLEEP_ON_MASK) - -#define LOCAL_BUS_ADDRESS 0x00000470 -#define LOCAL_BUS_OFFSET 0x00000470 -#define LOCAL_BUS_STATE_MSB 1 -#define LOCAL_BUS_STATE_LSB 0 -#define LOCAL_BUS_STATE_MASK 0x00000003 -#define LOCAL_BUS_STATE_GET(x) (((x) & LOCAL_BUS_STATE_MASK) >> LOCAL_BUS_STATE_LSB) -#define LOCAL_BUS_STATE_SET(x) (((x) << LOCAL_BUS_STATE_LSB) & LOCAL_BUS_STATE_MASK) - -#define INT_WLAN_ADDRESS 0x00000472 -#define INT_WLAN_OFFSET 0x00000472 -#define INT_WLAN_VECTOR_MSB 7 -#define INT_WLAN_VECTOR_LSB 0 -#define INT_WLAN_VECTOR_MASK 0x000000ff -#define INT_WLAN_VECTOR_GET(x) (((x) & INT_WLAN_VECTOR_MASK) >> INT_WLAN_VECTOR_LSB) -#define INT_WLAN_VECTOR_SET(x) (((x) << INT_WLAN_VECTOR_LSB) & INT_WLAN_VECTOR_MASK) - -#define WINDOW_DATA_ADDRESS 0x00000474 -#define WINDOW_DATA_OFFSET 0x00000474 -#define WINDOW_DATA_DATA_MSB 7 -#define WINDOW_DATA_DATA_LSB 0 -#define WINDOW_DATA_DATA_MASK 0x000000ff -#define WINDOW_DATA_DATA_GET(x) (((x) & WINDOW_DATA_DATA_MASK) >> WINDOW_DATA_DATA_LSB) -#define WINDOW_DATA_DATA_SET(x) (((x) << WINDOW_DATA_DATA_LSB) & WINDOW_DATA_DATA_MASK) - -#define WINDOW_WRITE_ADDR_ADDRESS 0x00000478 -#define WINDOW_WRITE_ADDR_OFFSET 0x00000478 -#define WINDOW_WRITE_ADDR_ADDR_MSB 7 -#define WINDOW_WRITE_ADDR_ADDR_LSB 0 -#define WINDOW_WRITE_ADDR_ADDR_MASK 0x000000ff -#define WINDOW_WRITE_ADDR_ADDR_GET(x) (((x) & WINDOW_WRITE_ADDR_ADDR_MASK) >> WINDOW_WRITE_ADDR_ADDR_LSB) -#define WINDOW_WRITE_ADDR_ADDR_SET(x) (((x) << WINDOW_WRITE_ADDR_ADDR_LSB) & WINDOW_WRITE_ADDR_ADDR_MASK) - -#define WINDOW_READ_ADDR_ADDRESS 0x0000047c -#define WINDOW_READ_ADDR_OFFSET 0x0000047c -#define WINDOW_READ_ADDR_ADDR_MSB 7 -#define WINDOW_READ_ADDR_ADDR_LSB 0 -#define WINDOW_READ_ADDR_ADDR_MASK 0x000000ff -#define WINDOW_READ_ADDR_ADDR_GET(x) (((x) & WINDOW_READ_ADDR_ADDR_MASK) >> WINDOW_READ_ADDR_ADDR_LSB) -#define WINDOW_READ_ADDR_ADDR_SET(x) (((x) << WINDOW_READ_ADDR_ADDR_LSB) & WINDOW_READ_ADDR_ADDR_MASK) - -#define HOST_CTRL_SPI_CONFIG_ADDRESS 0x00000480 -#define HOST_CTRL_SPI_CONFIG_OFFSET 0x00000480 -#define HOST_CTRL_SPI_CONFIG_SPI_RESET_MSB 4 -#define HOST_CTRL_SPI_CONFIG_SPI_RESET_LSB 4 -#define HOST_CTRL_SPI_CONFIG_SPI_RESET_MASK 0x00000010 -#define HOST_CTRL_SPI_CONFIG_SPI_RESET_GET(x) (((x) & HOST_CTRL_SPI_CONFIG_SPI_RESET_MASK) >> HOST_CTRL_SPI_CONFIG_SPI_RESET_LSB) -#define HOST_CTRL_SPI_CONFIG_SPI_RESET_SET(x) (((x) << HOST_CTRL_SPI_CONFIG_SPI_RESET_LSB) & HOST_CTRL_SPI_CONFIG_SPI_RESET_MASK) -#define HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_MSB 3 -#define HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_LSB 3 -#define HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_MASK 0x00000008 -#define HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_GET(x) (((x) & HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_MASK) >> HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_LSB) -#define HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_SET(x) (((x) << HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_LSB) & HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_MASK) -#define HOST_CTRL_SPI_CONFIG_TEST_MODE_MSB 2 -#define HOST_CTRL_SPI_CONFIG_TEST_MODE_LSB 2 -#define HOST_CTRL_SPI_CONFIG_TEST_MODE_MASK 0x00000004 -#define HOST_CTRL_SPI_CONFIG_TEST_MODE_GET(x) (((x) & HOST_CTRL_SPI_CONFIG_TEST_MODE_MASK) >> HOST_CTRL_SPI_CONFIG_TEST_MODE_LSB) -#define HOST_CTRL_SPI_CONFIG_TEST_MODE_SET(x) (((x) << HOST_CTRL_SPI_CONFIG_TEST_MODE_LSB) & HOST_CTRL_SPI_CONFIG_TEST_MODE_MASK) -#define HOST_CTRL_SPI_CONFIG_DATA_SIZE_MSB 1 -#define HOST_CTRL_SPI_CONFIG_DATA_SIZE_LSB 0 -#define HOST_CTRL_SPI_CONFIG_DATA_SIZE_MASK 0x00000003 -#define HOST_CTRL_SPI_CONFIG_DATA_SIZE_GET(x) (((x) & HOST_CTRL_SPI_CONFIG_DATA_SIZE_MASK) >> HOST_CTRL_SPI_CONFIG_DATA_SIZE_LSB) -#define HOST_CTRL_SPI_CONFIG_DATA_SIZE_SET(x) (((x) << HOST_CTRL_SPI_CONFIG_DATA_SIZE_LSB) & HOST_CTRL_SPI_CONFIG_DATA_SIZE_MASK) - -#define HOST_CTRL_SPI_STATUS_ADDRESS 0x00000481 -#define HOST_CTRL_SPI_STATUS_OFFSET 0x00000481 -#define HOST_CTRL_SPI_STATUS_ADDR_ERR_MSB 3 -#define HOST_CTRL_SPI_STATUS_ADDR_ERR_LSB 3 -#define HOST_CTRL_SPI_STATUS_ADDR_ERR_MASK 0x00000008 -#define HOST_CTRL_SPI_STATUS_ADDR_ERR_GET(x) (((x) & HOST_CTRL_SPI_STATUS_ADDR_ERR_MASK) >> HOST_CTRL_SPI_STATUS_ADDR_ERR_LSB) -#define HOST_CTRL_SPI_STATUS_ADDR_ERR_SET(x) (((x) << HOST_CTRL_SPI_STATUS_ADDR_ERR_LSB) & HOST_CTRL_SPI_STATUS_ADDR_ERR_MASK) -#define HOST_CTRL_SPI_STATUS_RD_ERR_MSB 2 -#define HOST_CTRL_SPI_STATUS_RD_ERR_LSB 2 -#define HOST_CTRL_SPI_STATUS_RD_ERR_MASK 0x00000004 -#define HOST_CTRL_SPI_STATUS_RD_ERR_GET(x) (((x) & HOST_CTRL_SPI_STATUS_RD_ERR_MASK) >> HOST_CTRL_SPI_STATUS_RD_ERR_LSB) -#define HOST_CTRL_SPI_STATUS_RD_ERR_SET(x) (((x) << HOST_CTRL_SPI_STATUS_RD_ERR_LSB) & HOST_CTRL_SPI_STATUS_RD_ERR_MASK) -#define HOST_CTRL_SPI_STATUS_WR_ERR_MSB 1 -#define HOST_CTRL_SPI_STATUS_WR_ERR_LSB 1 -#define HOST_CTRL_SPI_STATUS_WR_ERR_MASK 0x00000002 -#define HOST_CTRL_SPI_STATUS_WR_ERR_GET(x) (((x) & HOST_CTRL_SPI_STATUS_WR_ERR_MASK) >> HOST_CTRL_SPI_STATUS_WR_ERR_LSB) -#define HOST_CTRL_SPI_STATUS_WR_ERR_SET(x) (((x) << HOST_CTRL_SPI_STATUS_WR_ERR_LSB) & HOST_CTRL_SPI_STATUS_WR_ERR_MASK) -#define HOST_CTRL_SPI_STATUS_READY_MSB 0 -#define HOST_CTRL_SPI_STATUS_READY_LSB 0 -#define HOST_CTRL_SPI_STATUS_READY_MASK 0x00000001 -#define HOST_CTRL_SPI_STATUS_READY_GET(x) (((x) & HOST_CTRL_SPI_STATUS_READY_MASK) >> HOST_CTRL_SPI_STATUS_READY_LSB) -#define HOST_CTRL_SPI_STATUS_READY_SET(x) (((x) << HOST_CTRL_SPI_STATUS_READY_LSB) & HOST_CTRL_SPI_STATUS_READY_MASK) - -#define NON_ASSOC_SLEEP_EN_ADDRESS 0x00000482 -#define NON_ASSOC_SLEEP_EN_OFFSET 0x00000482 -#define NON_ASSOC_SLEEP_EN_BIT_MSB 0 -#define NON_ASSOC_SLEEP_EN_BIT_LSB 0 -#define NON_ASSOC_SLEEP_EN_BIT_MASK 0x00000001 -#define NON_ASSOC_SLEEP_EN_BIT_GET(x) (((x) & NON_ASSOC_SLEEP_EN_BIT_MASK) >> NON_ASSOC_SLEEP_EN_BIT_LSB) -#define NON_ASSOC_SLEEP_EN_BIT_SET(x) (((x) << NON_ASSOC_SLEEP_EN_BIT_LSB) & NON_ASSOC_SLEEP_EN_BIT_MASK) - -#define CPU_DBG_SEL_ADDRESS 0x00000483 -#define CPU_DBG_SEL_OFFSET 0x00000483 -#define CPU_DBG_SEL_BIT_MSB 5 -#define CPU_DBG_SEL_BIT_LSB 0 -#define CPU_DBG_SEL_BIT_MASK 0x0000003f -#define CPU_DBG_SEL_BIT_GET(x) (((x) & CPU_DBG_SEL_BIT_MASK) >> CPU_DBG_SEL_BIT_LSB) -#define CPU_DBG_SEL_BIT_SET(x) (((x) << CPU_DBG_SEL_BIT_LSB) & CPU_DBG_SEL_BIT_MASK) - -#define CPU_DBG_ADDRESS 0x00000484 -#define CPU_DBG_OFFSET 0x00000484 -#define CPU_DBG_DATA_MSB 7 -#define CPU_DBG_DATA_LSB 0 -#define CPU_DBG_DATA_MASK 0x000000ff -#define CPU_DBG_DATA_GET(x) (((x) & CPU_DBG_DATA_MASK) >> CPU_DBG_DATA_LSB) -#define CPU_DBG_DATA_SET(x) (((x) << CPU_DBG_DATA_LSB) & CPU_DBG_DATA_MASK) - -#define INT_STATUS2_ENABLE_ADDRESS 0x00000488 -#define INT_STATUS2_ENABLE_OFFSET 0x00000488 -#define INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_MSB 2 -#define INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_LSB 2 -#define INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_MASK 0x00000004 -#define INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_GET(x) (((x) & INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_MASK) >> INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_LSB) -#define INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_SET(x) (((x) << INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_LSB) & INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_MASK) -#define INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_MSB 1 -#define INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_LSB 1 -#define INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_MASK 0x00000002 -#define INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_GET(x) (((x) & INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_MASK) >> INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_LSB) -#define INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_SET(x) (((x) << INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_LSB) & INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_MASK) -#define INT_STATUS2_ENABLE_GMBOX_DATA_MSB 0 -#define INT_STATUS2_ENABLE_GMBOX_DATA_LSB 0 -#define INT_STATUS2_ENABLE_GMBOX_DATA_MASK 0x00000001 -#define INT_STATUS2_ENABLE_GMBOX_DATA_GET(x) (((x) & INT_STATUS2_ENABLE_GMBOX_DATA_MASK) >> INT_STATUS2_ENABLE_GMBOX_DATA_LSB) -#define INT_STATUS2_ENABLE_GMBOX_DATA_SET(x) (((x) << INT_STATUS2_ENABLE_GMBOX_DATA_LSB) & INT_STATUS2_ENABLE_GMBOX_DATA_MASK) - -#define GMBOX_RX_LOOKAHEAD_ADDRESS 0x00000490 -#define GMBOX_RX_LOOKAHEAD_OFFSET 0x00000490 -#define GMBOX_RX_LOOKAHEAD_DATA_MSB 7 -#define GMBOX_RX_LOOKAHEAD_DATA_LSB 0 -#define GMBOX_RX_LOOKAHEAD_DATA_MASK 0x000000ff -#define GMBOX_RX_LOOKAHEAD_DATA_GET(x) (((x) & GMBOX_RX_LOOKAHEAD_DATA_MASK) >> GMBOX_RX_LOOKAHEAD_DATA_LSB) -#define GMBOX_RX_LOOKAHEAD_DATA_SET(x) (((x) << GMBOX_RX_LOOKAHEAD_DATA_LSB) & GMBOX_RX_LOOKAHEAD_DATA_MASK) - -#define GMBOX_RX_LOOKAHEAD_MUX_ADDRESS 0x00000498 -#define GMBOX_RX_LOOKAHEAD_MUX_OFFSET 0x00000498 -#define GMBOX_RX_LOOKAHEAD_MUX_SEL_MSB 0 -#define GMBOX_RX_LOOKAHEAD_MUX_SEL_LSB 0 -#define GMBOX_RX_LOOKAHEAD_MUX_SEL_MASK 0x00000001 -#define GMBOX_RX_LOOKAHEAD_MUX_SEL_GET(x) (((x) & GMBOX_RX_LOOKAHEAD_MUX_SEL_MASK) >> GMBOX_RX_LOOKAHEAD_MUX_SEL_LSB) -#define GMBOX_RX_LOOKAHEAD_MUX_SEL_SET(x) (((x) << GMBOX_RX_LOOKAHEAD_MUX_SEL_LSB) & GMBOX_RX_LOOKAHEAD_MUX_SEL_MASK) - -#define CIS_WINDOW_ADDRESS 0x00000600 -#define CIS_WINDOW_OFFSET 0x00000600 -#define CIS_WINDOW_DATA_MSB 7 -#define CIS_WINDOW_DATA_LSB 0 -#define CIS_WINDOW_DATA_MASK 0x000000ff -#define CIS_WINDOW_DATA_GET(x) (((x) & CIS_WINDOW_DATA_MASK) >> CIS_WINDOW_DATA_LSB) -#define CIS_WINDOW_DATA_SET(x) (((x) << CIS_WINDOW_DATA_LSB) & CIS_WINDOW_DATA_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct mbox_wlan_host_reg_reg_s { - unsigned char pad0[1024]; /* pad to 0x400 */ - volatile unsigned char host_int_status; - volatile unsigned char cpu_int_status; - volatile unsigned char error_int_status; - volatile unsigned char counter_int_status; - volatile unsigned char mbox_frame; - volatile unsigned char rx_lookahead_valid; - volatile unsigned char host_int_status2; - volatile unsigned char gmbox_rx_avail; - volatile unsigned char rx_lookahead0[4]; - volatile unsigned char rx_lookahead1[4]; - volatile unsigned char rx_lookahead2[4]; - volatile unsigned char rx_lookahead3[4]; - volatile unsigned char int_status_enable; - volatile unsigned char cpu_int_status_enable; - volatile unsigned char error_status_enable; - volatile unsigned char counter_int_status_enable; - unsigned char pad1[4]; /* pad to 0x420 */ - volatile unsigned char count[8]; - unsigned char pad2[24]; /* pad to 0x440 */ - volatile unsigned char count_dec[32]; - volatile unsigned char scratch[8]; - volatile unsigned char fifo_timeout; - volatile unsigned char fifo_timeout_enable; - volatile unsigned char disable_sleep; - unsigned char pad3[5]; /* pad to 0x470 */ - volatile unsigned char local_bus; - unsigned char pad4[1]; /* pad to 0x472 */ - volatile unsigned char int_wlan; - unsigned char pad5[1]; /* pad to 0x474 */ - volatile unsigned char window_data[4]; - volatile unsigned char window_write_addr[4]; - volatile unsigned char window_read_addr[4]; - volatile unsigned char host_ctrl_spi_config; - volatile unsigned char host_ctrl_spi_status; - volatile unsigned char non_assoc_sleep_en; - volatile unsigned char cpu_dbg_sel; - volatile unsigned char cpu_dbg[4]; - volatile unsigned char int_status2_enable; - unsigned char pad6[7]; /* pad to 0x490 */ - volatile unsigned char gmbox_rx_lookahead[8]; - volatile unsigned char gmbox_rx_lookahead_mux; - unsigned char pad7[359]; /* pad to 0x600 */ - volatile unsigned char cis_window[512]; -} mbox_wlan_host_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _MBOX_WLAN_HOST_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_wlan_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_wlan_reg.h deleted file mode 100644 index dc66a171c8c1..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/mbox_wlan_reg.h +++ /dev/null @@ -1,638 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _MBOX_WLAN_REG_REG_H_ -#define _MBOX_WLAN_REG_REG_H_ - -#define WLAN_MBOX_FIFO_ADDRESS 0x00000000 -#define WLAN_MBOX_FIFO_OFFSET 0x00000000 -#define WLAN_MBOX_FIFO_DATA_MSB 19 -#define WLAN_MBOX_FIFO_DATA_LSB 0 -#define WLAN_MBOX_FIFO_DATA_MASK 0x000fffff -#define WLAN_MBOX_FIFO_DATA_GET(x) (((x) & WLAN_MBOX_FIFO_DATA_MASK) >> WLAN_MBOX_FIFO_DATA_LSB) -#define WLAN_MBOX_FIFO_DATA_SET(x) (((x) << WLAN_MBOX_FIFO_DATA_LSB) & WLAN_MBOX_FIFO_DATA_MASK) - -#define WLAN_MBOX_FIFO_STATUS_ADDRESS 0x00000010 -#define WLAN_MBOX_FIFO_STATUS_OFFSET 0x00000010 -#define WLAN_MBOX_FIFO_STATUS_EMPTY_MSB 19 -#define WLAN_MBOX_FIFO_STATUS_EMPTY_LSB 16 -#define WLAN_MBOX_FIFO_STATUS_EMPTY_MASK 0x000f0000 -#define WLAN_MBOX_FIFO_STATUS_EMPTY_GET(x) (((x) & WLAN_MBOX_FIFO_STATUS_EMPTY_MASK) >> WLAN_MBOX_FIFO_STATUS_EMPTY_LSB) -#define WLAN_MBOX_FIFO_STATUS_EMPTY_SET(x) (((x) << WLAN_MBOX_FIFO_STATUS_EMPTY_LSB) & WLAN_MBOX_FIFO_STATUS_EMPTY_MASK) -#define WLAN_MBOX_FIFO_STATUS_FULL_MSB 15 -#define WLAN_MBOX_FIFO_STATUS_FULL_LSB 12 -#define WLAN_MBOX_FIFO_STATUS_FULL_MASK 0x0000f000 -#define WLAN_MBOX_FIFO_STATUS_FULL_GET(x) (((x) & WLAN_MBOX_FIFO_STATUS_FULL_MASK) >> WLAN_MBOX_FIFO_STATUS_FULL_LSB) -#define WLAN_MBOX_FIFO_STATUS_FULL_SET(x) (((x) << WLAN_MBOX_FIFO_STATUS_FULL_LSB) & WLAN_MBOX_FIFO_STATUS_FULL_MASK) - -#define WLAN_MBOX_DMA_POLICY_ADDRESS 0x00000014 -#define WLAN_MBOX_DMA_POLICY_OFFSET 0x00000014 -#define WLAN_MBOX_DMA_POLICY_TX_QUANTUM_MSB 3 -#define WLAN_MBOX_DMA_POLICY_TX_QUANTUM_LSB 3 -#define WLAN_MBOX_DMA_POLICY_TX_QUANTUM_MASK 0x00000008 -#define WLAN_MBOX_DMA_POLICY_TX_QUANTUM_GET(x) (((x) & WLAN_MBOX_DMA_POLICY_TX_QUANTUM_MASK) >> WLAN_MBOX_DMA_POLICY_TX_QUANTUM_LSB) -#define WLAN_MBOX_DMA_POLICY_TX_QUANTUM_SET(x) (((x) << WLAN_MBOX_DMA_POLICY_TX_QUANTUM_LSB) & WLAN_MBOX_DMA_POLICY_TX_QUANTUM_MASK) -#define WLAN_MBOX_DMA_POLICY_TX_ORDER_MSB 2 -#define WLAN_MBOX_DMA_POLICY_TX_ORDER_LSB 2 -#define WLAN_MBOX_DMA_POLICY_TX_ORDER_MASK 0x00000004 -#define WLAN_MBOX_DMA_POLICY_TX_ORDER_GET(x) (((x) & WLAN_MBOX_DMA_POLICY_TX_ORDER_MASK) >> WLAN_MBOX_DMA_POLICY_TX_ORDER_LSB) -#define WLAN_MBOX_DMA_POLICY_TX_ORDER_SET(x) (((x) << WLAN_MBOX_DMA_POLICY_TX_ORDER_LSB) & WLAN_MBOX_DMA_POLICY_TX_ORDER_MASK) -#define WLAN_MBOX_DMA_POLICY_RX_QUANTUM_MSB 1 -#define WLAN_MBOX_DMA_POLICY_RX_QUANTUM_LSB 1 -#define WLAN_MBOX_DMA_POLICY_RX_QUANTUM_MASK 0x00000002 -#define WLAN_MBOX_DMA_POLICY_RX_QUANTUM_GET(x) (((x) & WLAN_MBOX_DMA_POLICY_RX_QUANTUM_MASK) >> WLAN_MBOX_DMA_POLICY_RX_QUANTUM_LSB) -#define WLAN_MBOX_DMA_POLICY_RX_QUANTUM_SET(x) (((x) << WLAN_MBOX_DMA_POLICY_RX_QUANTUM_LSB) & WLAN_MBOX_DMA_POLICY_RX_QUANTUM_MASK) -#define WLAN_MBOX_DMA_POLICY_RX_ORDER_MSB 0 -#define WLAN_MBOX_DMA_POLICY_RX_ORDER_LSB 0 -#define WLAN_MBOX_DMA_POLICY_RX_ORDER_MASK 0x00000001 -#define WLAN_MBOX_DMA_POLICY_RX_ORDER_GET(x) (((x) & WLAN_MBOX_DMA_POLICY_RX_ORDER_MASK) >> WLAN_MBOX_DMA_POLICY_RX_ORDER_LSB) -#define WLAN_MBOX_DMA_POLICY_RX_ORDER_SET(x) (((x) << WLAN_MBOX_DMA_POLICY_RX_ORDER_LSB) & WLAN_MBOX_DMA_POLICY_RX_ORDER_MASK) - -#define WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000018 -#define WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000018 -#define WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX0_DMA_RX_CONTROL_ADDRESS 0x0000001c -#define WLAN_MBOX0_DMA_RX_CONTROL_OFFSET 0x0000001c -#define WLAN_MBOX0_DMA_RX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX0_DMA_RX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX0_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX0_DMA_RX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX0_DMA_RX_CONTROL_RESUME_MASK) >> WLAN_MBOX0_DMA_RX_CONTROL_RESUME_LSB) -#define WLAN_MBOX0_DMA_RX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX0_DMA_RX_CONTROL_RESUME_LSB) & WLAN_MBOX0_DMA_RX_CONTROL_RESUME_MASK) -#define WLAN_MBOX0_DMA_RX_CONTROL_START_MSB 1 -#define WLAN_MBOX0_DMA_RX_CONTROL_START_LSB 1 -#define WLAN_MBOX0_DMA_RX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX0_DMA_RX_CONTROL_START_GET(x) (((x) & WLAN_MBOX0_DMA_RX_CONTROL_START_MASK) >> WLAN_MBOX0_DMA_RX_CONTROL_START_LSB) -#define WLAN_MBOX0_DMA_RX_CONTROL_START_SET(x) (((x) << WLAN_MBOX0_DMA_RX_CONTROL_START_LSB) & WLAN_MBOX0_DMA_RX_CONTROL_START_MASK) -#define WLAN_MBOX0_DMA_RX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX0_DMA_RX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX0_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX0_DMA_RX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX0_DMA_RX_CONTROL_STOP_MASK) >> WLAN_MBOX0_DMA_RX_CONTROL_STOP_LSB) -#define WLAN_MBOX0_DMA_RX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX0_DMA_RX_CONTROL_STOP_LSB) & WLAN_MBOX0_DMA_RX_CONTROL_STOP_MASK) - -#define WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000020 -#define WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000020 -#define WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX0_DMA_TX_CONTROL_ADDRESS 0x00000024 -#define WLAN_MBOX0_DMA_TX_CONTROL_OFFSET 0x00000024 -#define WLAN_MBOX0_DMA_TX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX0_DMA_TX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX0_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX0_DMA_TX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX0_DMA_TX_CONTROL_RESUME_MASK) >> WLAN_MBOX0_DMA_TX_CONTROL_RESUME_LSB) -#define WLAN_MBOX0_DMA_TX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX0_DMA_TX_CONTROL_RESUME_LSB) & WLAN_MBOX0_DMA_TX_CONTROL_RESUME_MASK) -#define WLAN_MBOX0_DMA_TX_CONTROL_START_MSB 1 -#define WLAN_MBOX0_DMA_TX_CONTROL_START_LSB 1 -#define WLAN_MBOX0_DMA_TX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX0_DMA_TX_CONTROL_START_GET(x) (((x) & WLAN_MBOX0_DMA_TX_CONTROL_START_MASK) >> WLAN_MBOX0_DMA_TX_CONTROL_START_LSB) -#define WLAN_MBOX0_DMA_TX_CONTROL_START_SET(x) (((x) << WLAN_MBOX0_DMA_TX_CONTROL_START_LSB) & WLAN_MBOX0_DMA_TX_CONTROL_START_MASK) -#define WLAN_MBOX0_DMA_TX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX0_DMA_TX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX0_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX0_DMA_TX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX0_DMA_TX_CONTROL_STOP_MASK) >> WLAN_MBOX0_DMA_TX_CONTROL_STOP_LSB) -#define WLAN_MBOX0_DMA_TX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX0_DMA_TX_CONTROL_STOP_LSB) & WLAN_MBOX0_DMA_TX_CONTROL_STOP_MASK) - -#define WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000028 -#define WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000028 -#define WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX1_DMA_RX_CONTROL_ADDRESS 0x0000002c -#define WLAN_MBOX1_DMA_RX_CONTROL_OFFSET 0x0000002c -#define WLAN_MBOX1_DMA_RX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX1_DMA_RX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX1_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX1_DMA_RX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX1_DMA_RX_CONTROL_RESUME_MASK) >> WLAN_MBOX1_DMA_RX_CONTROL_RESUME_LSB) -#define WLAN_MBOX1_DMA_RX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX1_DMA_RX_CONTROL_RESUME_LSB) & WLAN_MBOX1_DMA_RX_CONTROL_RESUME_MASK) -#define WLAN_MBOX1_DMA_RX_CONTROL_START_MSB 1 -#define WLAN_MBOX1_DMA_RX_CONTROL_START_LSB 1 -#define WLAN_MBOX1_DMA_RX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX1_DMA_RX_CONTROL_START_GET(x) (((x) & WLAN_MBOX1_DMA_RX_CONTROL_START_MASK) >> WLAN_MBOX1_DMA_RX_CONTROL_START_LSB) -#define WLAN_MBOX1_DMA_RX_CONTROL_START_SET(x) (((x) << WLAN_MBOX1_DMA_RX_CONTROL_START_LSB) & WLAN_MBOX1_DMA_RX_CONTROL_START_MASK) -#define WLAN_MBOX1_DMA_RX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX1_DMA_RX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX1_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX1_DMA_RX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX1_DMA_RX_CONTROL_STOP_MASK) >> WLAN_MBOX1_DMA_RX_CONTROL_STOP_LSB) -#define WLAN_MBOX1_DMA_RX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX1_DMA_RX_CONTROL_STOP_LSB) & WLAN_MBOX1_DMA_RX_CONTROL_STOP_MASK) - -#define WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000030 -#define WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000030 -#define WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX1_DMA_TX_CONTROL_ADDRESS 0x00000034 -#define WLAN_MBOX1_DMA_TX_CONTROL_OFFSET 0x00000034 -#define WLAN_MBOX1_DMA_TX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX1_DMA_TX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX1_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX1_DMA_TX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX1_DMA_TX_CONTROL_RESUME_MASK) >> WLAN_MBOX1_DMA_TX_CONTROL_RESUME_LSB) -#define WLAN_MBOX1_DMA_TX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX1_DMA_TX_CONTROL_RESUME_LSB) & WLAN_MBOX1_DMA_TX_CONTROL_RESUME_MASK) -#define WLAN_MBOX1_DMA_TX_CONTROL_START_MSB 1 -#define WLAN_MBOX1_DMA_TX_CONTROL_START_LSB 1 -#define WLAN_MBOX1_DMA_TX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX1_DMA_TX_CONTROL_START_GET(x) (((x) & WLAN_MBOX1_DMA_TX_CONTROL_START_MASK) >> WLAN_MBOX1_DMA_TX_CONTROL_START_LSB) -#define WLAN_MBOX1_DMA_TX_CONTROL_START_SET(x) (((x) << WLAN_MBOX1_DMA_TX_CONTROL_START_LSB) & WLAN_MBOX1_DMA_TX_CONTROL_START_MASK) -#define WLAN_MBOX1_DMA_TX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX1_DMA_TX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX1_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX1_DMA_TX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX1_DMA_TX_CONTROL_STOP_MASK) >> WLAN_MBOX1_DMA_TX_CONTROL_STOP_LSB) -#define WLAN_MBOX1_DMA_TX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX1_DMA_TX_CONTROL_STOP_LSB) & WLAN_MBOX1_DMA_TX_CONTROL_STOP_MASK) - -#define WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000038 -#define WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000038 -#define WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX2_DMA_RX_CONTROL_ADDRESS 0x0000003c -#define WLAN_MBOX2_DMA_RX_CONTROL_OFFSET 0x0000003c -#define WLAN_MBOX2_DMA_RX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX2_DMA_RX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX2_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX2_DMA_RX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX2_DMA_RX_CONTROL_RESUME_MASK) >> WLAN_MBOX2_DMA_RX_CONTROL_RESUME_LSB) -#define WLAN_MBOX2_DMA_RX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX2_DMA_RX_CONTROL_RESUME_LSB) & WLAN_MBOX2_DMA_RX_CONTROL_RESUME_MASK) -#define WLAN_MBOX2_DMA_RX_CONTROL_START_MSB 1 -#define WLAN_MBOX2_DMA_RX_CONTROL_START_LSB 1 -#define WLAN_MBOX2_DMA_RX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX2_DMA_RX_CONTROL_START_GET(x) (((x) & WLAN_MBOX2_DMA_RX_CONTROL_START_MASK) >> WLAN_MBOX2_DMA_RX_CONTROL_START_LSB) -#define WLAN_MBOX2_DMA_RX_CONTROL_START_SET(x) (((x) << WLAN_MBOX2_DMA_RX_CONTROL_START_LSB) & WLAN_MBOX2_DMA_RX_CONTROL_START_MASK) -#define WLAN_MBOX2_DMA_RX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX2_DMA_RX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX2_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX2_DMA_RX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX2_DMA_RX_CONTROL_STOP_MASK) >> WLAN_MBOX2_DMA_RX_CONTROL_STOP_LSB) -#define WLAN_MBOX2_DMA_RX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX2_DMA_RX_CONTROL_STOP_LSB) & WLAN_MBOX2_DMA_RX_CONTROL_STOP_MASK) - -#define WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000040 -#define WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000040 -#define WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX2_DMA_TX_CONTROL_ADDRESS 0x00000044 -#define WLAN_MBOX2_DMA_TX_CONTROL_OFFSET 0x00000044 -#define WLAN_MBOX2_DMA_TX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX2_DMA_TX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX2_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX2_DMA_TX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX2_DMA_TX_CONTROL_RESUME_MASK) >> WLAN_MBOX2_DMA_TX_CONTROL_RESUME_LSB) -#define WLAN_MBOX2_DMA_TX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX2_DMA_TX_CONTROL_RESUME_LSB) & WLAN_MBOX2_DMA_TX_CONTROL_RESUME_MASK) -#define WLAN_MBOX2_DMA_TX_CONTROL_START_MSB 1 -#define WLAN_MBOX2_DMA_TX_CONTROL_START_LSB 1 -#define WLAN_MBOX2_DMA_TX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX2_DMA_TX_CONTROL_START_GET(x) (((x) & WLAN_MBOX2_DMA_TX_CONTROL_START_MASK) >> WLAN_MBOX2_DMA_TX_CONTROL_START_LSB) -#define WLAN_MBOX2_DMA_TX_CONTROL_START_SET(x) (((x) << WLAN_MBOX2_DMA_TX_CONTROL_START_LSB) & WLAN_MBOX2_DMA_TX_CONTROL_START_MASK) -#define WLAN_MBOX2_DMA_TX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX2_DMA_TX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX2_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX2_DMA_TX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX2_DMA_TX_CONTROL_STOP_MASK) >> WLAN_MBOX2_DMA_TX_CONTROL_STOP_LSB) -#define WLAN_MBOX2_DMA_TX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX2_DMA_TX_CONTROL_STOP_LSB) & WLAN_MBOX2_DMA_TX_CONTROL_STOP_MASK) - -#define WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000048 -#define WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000048 -#define WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX3_DMA_RX_CONTROL_ADDRESS 0x0000004c -#define WLAN_MBOX3_DMA_RX_CONTROL_OFFSET 0x0000004c -#define WLAN_MBOX3_DMA_RX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX3_DMA_RX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX3_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX3_DMA_RX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX3_DMA_RX_CONTROL_RESUME_MASK) >> WLAN_MBOX3_DMA_RX_CONTROL_RESUME_LSB) -#define WLAN_MBOX3_DMA_RX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX3_DMA_RX_CONTROL_RESUME_LSB) & WLAN_MBOX3_DMA_RX_CONTROL_RESUME_MASK) -#define WLAN_MBOX3_DMA_RX_CONTROL_START_MSB 1 -#define WLAN_MBOX3_DMA_RX_CONTROL_START_LSB 1 -#define WLAN_MBOX3_DMA_RX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX3_DMA_RX_CONTROL_START_GET(x) (((x) & WLAN_MBOX3_DMA_RX_CONTROL_START_MASK) >> WLAN_MBOX3_DMA_RX_CONTROL_START_LSB) -#define WLAN_MBOX3_DMA_RX_CONTROL_START_SET(x) (((x) << WLAN_MBOX3_DMA_RX_CONTROL_START_LSB) & WLAN_MBOX3_DMA_RX_CONTROL_START_MASK) -#define WLAN_MBOX3_DMA_RX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX3_DMA_RX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX3_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX3_DMA_RX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX3_DMA_RX_CONTROL_STOP_MASK) >> WLAN_MBOX3_DMA_RX_CONTROL_STOP_LSB) -#define WLAN_MBOX3_DMA_RX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX3_DMA_RX_CONTROL_STOP_LSB) & WLAN_MBOX3_DMA_RX_CONTROL_STOP_MASK) - -#define WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000050 -#define WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000050 -#define WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX3_DMA_TX_CONTROL_ADDRESS 0x00000054 -#define WLAN_MBOX3_DMA_TX_CONTROL_OFFSET 0x00000054 -#define WLAN_MBOX3_DMA_TX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX3_DMA_TX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX3_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX3_DMA_TX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX3_DMA_TX_CONTROL_RESUME_MASK) >> WLAN_MBOX3_DMA_TX_CONTROL_RESUME_LSB) -#define WLAN_MBOX3_DMA_TX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX3_DMA_TX_CONTROL_RESUME_LSB) & WLAN_MBOX3_DMA_TX_CONTROL_RESUME_MASK) -#define WLAN_MBOX3_DMA_TX_CONTROL_START_MSB 1 -#define WLAN_MBOX3_DMA_TX_CONTROL_START_LSB 1 -#define WLAN_MBOX3_DMA_TX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX3_DMA_TX_CONTROL_START_GET(x) (((x) & WLAN_MBOX3_DMA_TX_CONTROL_START_MASK) >> WLAN_MBOX3_DMA_TX_CONTROL_START_LSB) -#define WLAN_MBOX3_DMA_TX_CONTROL_START_SET(x) (((x) << WLAN_MBOX3_DMA_TX_CONTROL_START_LSB) & WLAN_MBOX3_DMA_TX_CONTROL_START_MASK) -#define WLAN_MBOX3_DMA_TX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX3_DMA_TX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX3_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX3_DMA_TX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX3_DMA_TX_CONTROL_STOP_MASK) >> WLAN_MBOX3_DMA_TX_CONTROL_STOP_LSB) -#define WLAN_MBOX3_DMA_TX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX3_DMA_TX_CONTROL_STOP_LSB) & WLAN_MBOX3_DMA_TX_CONTROL_STOP_MASK) - -#define WLAN_MBOX_INT_STATUS_ADDRESS 0x00000058 -#define WLAN_MBOX_INT_STATUS_OFFSET 0x00000058 -#define WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_MSB 31 -#define WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB 28 -#define WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK 0xf0000000 -#define WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) (((x) & WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) >> WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) -#define WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) (((x) << WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) & WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) -#define WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB 27 -#define WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB 24 -#define WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK 0x0f000000 -#define WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) (((x) & WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) >> WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) -#define WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) (((x) << WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) & WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) -#define WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_MSB 23 -#define WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB 20 -#define WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK 0x00f00000 -#define WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) (((x) & WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) >> WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) -#define WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) (((x) << WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) & WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) -#define WLAN_MBOX_INT_STATUS_TX_OVERFLOW_MSB 17 -#define WLAN_MBOX_INT_STATUS_TX_OVERFLOW_LSB 17 -#define WLAN_MBOX_INT_STATUS_TX_OVERFLOW_MASK 0x00020000 -#define WLAN_MBOX_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & WLAN_MBOX_INT_STATUS_TX_OVERFLOW_MASK) >> WLAN_MBOX_INT_STATUS_TX_OVERFLOW_LSB) -#define WLAN_MBOX_INT_STATUS_TX_OVERFLOW_SET(x) (((x) << WLAN_MBOX_INT_STATUS_TX_OVERFLOW_LSB) & WLAN_MBOX_INT_STATUS_TX_OVERFLOW_MASK) -#define WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_MSB 16 -#define WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_LSB 16 -#define WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_MASK 0x00010000 -#define WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_MASK) >> WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_LSB) -#define WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_SET(x) (((x) << WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_LSB) & WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_MASK) -#define WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_MSB 15 -#define WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_LSB 12 -#define WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_MASK 0x0000f000 -#define WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) (((x) & WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_MASK) >> WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_LSB) -#define WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) (((x) << WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_LSB) & WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_MASK) -#define WLAN_MBOX_INT_STATUS_RX_NOT_FULL_MSB 11 -#define WLAN_MBOX_INT_STATUS_RX_NOT_FULL_LSB 8 -#define WLAN_MBOX_INT_STATUS_RX_NOT_FULL_MASK 0x00000f00 -#define WLAN_MBOX_INT_STATUS_RX_NOT_FULL_GET(x) (((x) & WLAN_MBOX_INT_STATUS_RX_NOT_FULL_MASK) >> WLAN_MBOX_INT_STATUS_RX_NOT_FULL_LSB) -#define WLAN_MBOX_INT_STATUS_RX_NOT_FULL_SET(x) (((x) << WLAN_MBOX_INT_STATUS_RX_NOT_FULL_LSB) & WLAN_MBOX_INT_STATUS_RX_NOT_FULL_MASK) -#define WLAN_MBOX_INT_STATUS_HOST_MSB 7 -#define WLAN_MBOX_INT_STATUS_HOST_LSB 0 -#define WLAN_MBOX_INT_STATUS_HOST_MASK 0x000000ff -#define WLAN_MBOX_INT_STATUS_HOST_GET(x) (((x) & WLAN_MBOX_INT_STATUS_HOST_MASK) >> WLAN_MBOX_INT_STATUS_HOST_LSB) -#define WLAN_MBOX_INT_STATUS_HOST_SET(x) (((x) << WLAN_MBOX_INT_STATUS_HOST_LSB) & WLAN_MBOX_INT_STATUS_HOST_MASK) - -#define WLAN_MBOX_INT_ENABLE_ADDRESS 0x0000005c -#define WLAN_MBOX_INT_ENABLE_OFFSET 0x0000005c -#define WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB 31 -#define WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB 28 -#define WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK 0xf0000000 -#define WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) >> WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) -#define WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) & WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) -#define WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB 27 -#define WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB 24 -#define WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK 0x0f000000 -#define WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) >> WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) -#define WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) & WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) -#define WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB 23 -#define WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB 20 -#define WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK 0x00f00000 -#define WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) >> WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) -#define WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) & WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) -#define WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_MSB 17 -#define WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_LSB 17 -#define WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_MASK 0x00020000 -#define WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_MASK) >> WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_LSB) -#define WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_LSB) & WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_MASK) -#define WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_MSB 16 -#define WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_LSB 16 -#define WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_MASK 0x00010000 -#define WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_MASK) >> WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_LSB) -#define WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_LSB) & WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_MASK) -#define WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_MSB 15 -#define WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB 12 -#define WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK 0x0000f000 -#define WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) >> WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) -#define WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) & WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) -#define WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_MSB 11 -#define WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_LSB 8 -#define WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_MASK 0x00000f00 -#define WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_MASK) >> WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_LSB) -#define WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_LSB) & WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_MASK) -#define WLAN_MBOX_INT_ENABLE_HOST_MSB 7 -#define WLAN_MBOX_INT_ENABLE_HOST_LSB 0 -#define WLAN_MBOX_INT_ENABLE_HOST_MASK 0x000000ff -#define WLAN_MBOX_INT_ENABLE_HOST_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_HOST_MASK) >> WLAN_MBOX_INT_ENABLE_HOST_LSB) -#define WLAN_MBOX_INT_ENABLE_HOST_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_HOST_LSB) & WLAN_MBOX_INT_ENABLE_HOST_MASK) - -#define WLAN_INT_HOST_ADDRESS 0x00000060 -#define WLAN_INT_HOST_OFFSET 0x00000060 -#define WLAN_INT_HOST_VECTOR_MSB 7 -#define WLAN_INT_HOST_VECTOR_LSB 0 -#define WLAN_INT_HOST_VECTOR_MASK 0x000000ff -#define WLAN_INT_HOST_VECTOR_GET(x) (((x) & WLAN_INT_HOST_VECTOR_MASK) >> WLAN_INT_HOST_VECTOR_LSB) -#define WLAN_INT_HOST_VECTOR_SET(x) (((x) << WLAN_INT_HOST_VECTOR_LSB) & WLAN_INT_HOST_VECTOR_MASK) - -#define WLAN_LOCAL_COUNT_ADDRESS 0x00000080 -#define WLAN_LOCAL_COUNT_OFFSET 0x00000080 -#define WLAN_LOCAL_COUNT_VALUE_MSB 7 -#define WLAN_LOCAL_COUNT_VALUE_LSB 0 -#define WLAN_LOCAL_COUNT_VALUE_MASK 0x000000ff -#define WLAN_LOCAL_COUNT_VALUE_GET(x) (((x) & WLAN_LOCAL_COUNT_VALUE_MASK) >> WLAN_LOCAL_COUNT_VALUE_LSB) -#define WLAN_LOCAL_COUNT_VALUE_SET(x) (((x) << WLAN_LOCAL_COUNT_VALUE_LSB) & WLAN_LOCAL_COUNT_VALUE_MASK) - -#define WLAN_COUNT_INC_ADDRESS 0x000000a0 -#define WLAN_COUNT_INC_OFFSET 0x000000a0 -#define WLAN_COUNT_INC_VALUE_MSB 7 -#define WLAN_COUNT_INC_VALUE_LSB 0 -#define WLAN_COUNT_INC_VALUE_MASK 0x000000ff -#define WLAN_COUNT_INC_VALUE_GET(x) (((x) & WLAN_COUNT_INC_VALUE_MASK) >> WLAN_COUNT_INC_VALUE_LSB) -#define WLAN_COUNT_INC_VALUE_SET(x) (((x) << WLAN_COUNT_INC_VALUE_LSB) & WLAN_COUNT_INC_VALUE_MASK) - -#define WLAN_LOCAL_SCRATCH_ADDRESS 0x000000c0 -#define WLAN_LOCAL_SCRATCH_OFFSET 0x000000c0 -#define WLAN_LOCAL_SCRATCH_VALUE_MSB 7 -#define WLAN_LOCAL_SCRATCH_VALUE_LSB 0 -#define WLAN_LOCAL_SCRATCH_VALUE_MASK 0x000000ff -#define WLAN_LOCAL_SCRATCH_VALUE_GET(x) (((x) & WLAN_LOCAL_SCRATCH_VALUE_MASK) >> WLAN_LOCAL_SCRATCH_VALUE_LSB) -#define WLAN_LOCAL_SCRATCH_VALUE_SET(x) (((x) << WLAN_LOCAL_SCRATCH_VALUE_LSB) & WLAN_LOCAL_SCRATCH_VALUE_MASK) - -#define WLAN_USE_LOCAL_BUS_ADDRESS 0x000000e0 -#define WLAN_USE_LOCAL_BUS_OFFSET 0x000000e0 -#define WLAN_USE_LOCAL_BUS_PIN_INIT_MSB 0 -#define WLAN_USE_LOCAL_BUS_PIN_INIT_LSB 0 -#define WLAN_USE_LOCAL_BUS_PIN_INIT_MASK 0x00000001 -#define WLAN_USE_LOCAL_BUS_PIN_INIT_GET(x) (((x) & WLAN_USE_LOCAL_BUS_PIN_INIT_MASK) >> WLAN_USE_LOCAL_BUS_PIN_INIT_LSB) -#define WLAN_USE_LOCAL_BUS_PIN_INIT_SET(x) (((x) << WLAN_USE_LOCAL_BUS_PIN_INIT_LSB) & WLAN_USE_LOCAL_BUS_PIN_INIT_MASK) - -#define WLAN_SDIO_CONFIG_ADDRESS 0x000000e4 -#define WLAN_SDIO_CONFIG_OFFSET 0x000000e4 -#define WLAN_SDIO_CONFIG_CCCR_IOR1_MSB 0 -#define WLAN_SDIO_CONFIG_CCCR_IOR1_LSB 0 -#define WLAN_SDIO_CONFIG_CCCR_IOR1_MASK 0x00000001 -#define WLAN_SDIO_CONFIG_CCCR_IOR1_GET(x) (((x) & WLAN_SDIO_CONFIG_CCCR_IOR1_MASK) >> WLAN_SDIO_CONFIG_CCCR_IOR1_LSB) -#define WLAN_SDIO_CONFIG_CCCR_IOR1_SET(x) (((x) << WLAN_SDIO_CONFIG_CCCR_IOR1_LSB) & WLAN_SDIO_CONFIG_CCCR_IOR1_MASK) - -#define WLAN_MBOX_DEBUG_ADDRESS 0x000000e8 -#define WLAN_MBOX_DEBUG_OFFSET 0x000000e8 -#define WLAN_MBOX_DEBUG_SEL_MSB 2 -#define WLAN_MBOX_DEBUG_SEL_LSB 0 -#define WLAN_MBOX_DEBUG_SEL_MASK 0x00000007 -#define WLAN_MBOX_DEBUG_SEL_GET(x) (((x) & WLAN_MBOX_DEBUG_SEL_MASK) >> WLAN_MBOX_DEBUG_SEL_LSB) -#define WLAN_MBOX_DEBUG_SEL_SET(x) (((x) << WLAN_MBOX_DEBUG_SEL_LSB) & WLAN_MBOX_DEBUG_SEL_MASK) - -#define WLAN_MBOX_FIFO_RESET_ADDRESS 0x000000ec -#define WLAN_MBOX_FIFO_RESET_OFFSET 0x000000ec -#define WLAN_MBOX_FIFO_RESET_INIT_MSB 0 -#define WLAN_MBOX_FIFO_RESET_INIT_LSB 0 -#define WLAN_MBOX_FIFO_RESET_INIT_MASK 0x00000001 -#define WLAN_MBOX_FIFO_RESET_INIT_GET(x) (((x) & WLAN_MBOX_FIFO_RESET_INIT_MASK) >> WLAN_MBOX_FIFO_RESET_INIT_LSB) -#define WLAN_MBOX_FIFO_RESET_INIT_SET(x) (((x) << WLAN_MBOX_FIFO_RESET_INIT_LSB) & WLAN_MBOX_FIFO_RESET_INIT_MASK) - -#define WLAN_MBOX_TXFIFO_POP_ADDRESS 0x000000f0 -#define WLAN_MBOX_TXFIFO_POP_OFFSET 0x000000f0 -#define WLAN_MBOX_TXFIFO_POP_DATA_MSB 0 -#define WLAN_MBOX_TXFIFO_POP_DATA_LSB 0 -#define WLAN_MBOX_TXFIFO_POP_DATA_MASK 0x00000001 -#define WLAN_MBOX_TXFIFO_POP_DATA_GET(x) (((x) & WLAN_MBOX_TXFIFO_POP_DATA_MASK) >> WLAN_MBOX_TXFIFO_POP_DATA_LSB) -#define WLAN_MBOX_TXFIFO_POP_DATA_SET(x) (((x) << WLAN_MBOX_TXFIFO_POP_DATA_LSB) & WLAN_MBOX_TXFIFO_POP_DATA_MASK) - -#define WLAN_MBOX_RXFIFO_POP_ADDRESS 0x00000100 -#define WLAN_MBOX_RXFIFO_POP_OFFSET 0x00000100 -#define WLAN_MBOX_RXFIFO_POP_DATA_MSB 0 -#define WLAN_MBOX_RXFIFO_POP_DATA_LSB 0 -#define WLAN_MBOX_RXFIFO_POP_DATA_MASK 0x00000001 -#define WLAN_MBOX_RXFIFO_POP_DATA_GET(x) (((x) & WLAN_MBOX_RXFIFO_POP_DATA_MASK) >> WLAN_MBOX_RXFIFO_POP_DATA_LSB) -#define WLAN_MBOX_RXFIFO_POP_DATA_SET(x) (((x) << WLAN_MBOX_RXFIFO_POP_DATA_LSB) & WLAN_MBOX_RXFIFO_POP_DATA_MASK) - -#define WLAN_SDIO_DEBUG_ADDRESS 0x00000110 -#define WLAN_SDIO_DEBUG_OFFSET 0x00000110 -#define WLAN_SDIO_DEBUG_SEL_MSB 3 -#define WLAN_SDIO_DEBUG_SEL_LSB 0 -#define WLAN_SDIO_DEBUG_SEL_MASK 0x0000000f -#define WLAN_SDIO_DEBUG_SEL_GET(x) (((x) & WLAN_SDIO_DEBUG_SEL_MASK) >> WLAN_SDIO_DEBUG_SEL_LSB) -#define WLAN_SDIO_DEBUG_SEL_SET(x) (((x) << WLAN_SDIO_DEBUG_SEL_LSB) & WLAN_SDIO_DEBUG_SEL_MASK) - -#define WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000114 -#define WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000114 -#define WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_GMBOX0_DMA_RX_CONTROL_ADDRESS 0x00000118 -#define WLAN_GMBOX0_DMA_RX_CONTROL_OFFSET 0x00000118 -#define WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_MSB 2 -#define WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_LSB 2 -#define WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_GET(x) (((x) & WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_MASK) >> WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_LSB) -#define WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_SET(x) (((x) << WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_LSB) & WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_MASK) -#define WLAN_GMBOX0_DMA_RX_CONTROL_START_MSB 1 -#define WLAN_GMBOX0_DMA_RX_CONTROL_START_LSB 1 -#define WLAN_GMBOX0_DMA_RX_CONTROL_START_MASK 0x00000002 -#define WLAN_GMBOX0_DMA_RX_CONTROL_START_GET(x) (((x) & WLAN_GMBOX0_DMA_RX_CONTROL_START_MASK) >> WLAN_GMBOX0_DMA_RX_CONTROL_START_LSB) -#define WLAN_GMBOX0_DMA_RX_CONTROL_START_SET(x) (((x) << WLAN_GMBOX0_DMA_RX_CONTROL_START_LSB) & WLAN_GMBOX0_DMA_RX_CONTROL_START_MASK) -#define WLAN_GMBOX0_DMA_RX_CONTROL_STOP_MSB 0 -#define WLAN_GMBOX0_DMA_RX_CONTROL_STOP_LSB 0 -#define WLAN_GMBOX0_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_GMBOX0_DMA_RX_CONTROL_STOP_GET(x) (((x) & WLAN_GMBOX0_DMA_RX_CONTROL_STOP_MASK) >> WLAN_GMBOX0_DMA_RX_CONTROL_STOP_LSB) -#define WLAN_GMBOX0_DMA_RX_CONTROL_STOP_SET(x) (((x) << WLAN_GMBOX0_DMA_RX_CONTROL_STOP_LSB) & WLAN_GMBOX0_DMA_RX_CONTROL_STOP_MASK) - -#define WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x0000011c -#define WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x0000011c -#define WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_GMBOX0_DMA_TX_CONTROL_ADDRESS 0x00000120 -#define WLAN_GMBOX0_DMA_TX_CONTROL_OFFSET 0x00000120 -#define WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_MSB 2 -#define WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_LSB 2 -#define WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_GET(x) (((x) & WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_MASK) >> WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_LSB) -#define WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_SET(x) (((x) << WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_LSB) & WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_MASK) -#define WLAN_GMBOX0_DMA_TX_CONTROL_START_MSB 1 -#define WLAN_GMBOX0_DMA_TX_CONTROL_START_LSB 1 -#define WLAN_GMBOX0_DMA_TX_CONTROL_START_MASK 0x00000002 -#define WLAN_GMBOX0_DMA_TX_CONTROL_START_GET(x) (((x) & WLAN_GMBOX0_DMA_TX_CONTROL_START_MASK) >> WLAN_GMBOX0_DMA_TX_CONTROL_START_LSB) -#define WLAN_GMBOX0_DMA_TX_CONTROL_START_SET(x) (((x) << WLAN_GMBOX0_DMA_TX_CONTROL_START_LSB) & WLAN_GMBOX0_DMA_TX_CONTROL_START_MASK) -#define WLAN_GMBOX0_DMA_TX_CONTROL_STOP_MSB 0 -#define WLAN_GMBOX0_DMA_TX_CONTROL_STOP_LSB 0 -#define WLAN_GMBOX0_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_GMBOX0_DMA_TX_CONTROL_STOP_GET(x) (((x) & WLAN_GMBOX0_DMA_TX_CONTROL_STOP_MASK) >> WLAN_GMBOX0_DMA_TX_CONTROL_STOP_LSB) -#define WLAN_GMBOX0_DMA_TX_CONTROL_STOP_SET(x) (((x) << WLAN_GMBOX0_DMA_TX_CONTROL_STOP_LSB) & WLAN_GMBOX0_DMA_TX_CONTROL_STOP_MASK) - -#define WLAN_GMBOX_INT_STATUS_ADDRESS 0x00000124 -#define WLAN_GMBOX_INT_STATUS_OFFSET 0x00000124 -#define WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_MSB 6 -#define WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_LSB 6 -#define WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_MASK 0x00000040 -#define WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_MASK) >> WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_LSB) -#define WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_SET(x) (((x) << WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_LSB) & WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_MASK) -#define WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_MSB 5 -#define WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_LSB 5 -#define WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_MASK 0x00000020 -#define WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_MASK) >> WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_LSB) -#define WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_SET(x) (((x) << WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_LSB) & WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_MASK) -#define WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_MSB 4 -#define WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB 4 -#define WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK 0x00000010 -#define WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) (((x) & WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) >> WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) -#define WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) (((x) << WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) & WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) -#define WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB 3 -#define WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB 3 -#define WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK 0x00000008 -#define WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) (((x) & WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) >> WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) -#define WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) (((x) << WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) & WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) -#define WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_MSB 2 -#define WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB 2 -#define WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK 0x00000004 -#define WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) (((x) & WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) >> WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) -#define WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) (((x) << WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) & WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) -#define WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_MSB 1 -#define WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_LSB 1 -#define WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_MASK 0x00000002 -#define WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) (((x) & WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_MASK) >> WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_LSB) -#define WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) (((x) << WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_LSB) & WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_MASK) -#define WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_MSB 0 -#define WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_LSB 0 -#define WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_MASK 0x00000001 -#define WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_GET(x) (((x) & WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_MASK) >> WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_LSB) -#define WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_SET(x) (((x) << WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_LSB) & WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_MASK) - -#define WLAN_GMBOX_INT_ENABLE_ADDRESS 0x00000128 -#define WLAN_GMBOX_INT_ENABLE_OFFSET 0x00000128 -#define WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_MSB 6 -#define WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_LSB 6 -#define WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_MASK 0x00000040 -#define WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_GET(x) (((x) & WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_MASK) >> WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_LSB) -#define WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_SET(x) (((x) << WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_LSB) & WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_MASK) -#define WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_MSB 5 -#define WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_LSB 5 -#define WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_MASK 0x00000020 -#define WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) (((x) & WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_MASK) >> WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_LSB) -#define WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) (((x) << WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_LSB) & WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_MASK) -#define WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB 4 -#define WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB 4 -#define WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK 0x00000010 -#define WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) (((x) & WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) >> WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) -#define WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) (((x) << WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) & WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB 3 -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB 3 -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK 0x00000008 -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) (((x) & WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) >> WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) (((x) << WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) & WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB 2 -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB 2 -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK 0x00000004 -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) (((x) & WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) >> WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) (((x) << WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) & WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) -#define WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_MSB 1 -#define WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB 1 -#define WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK 0x00000002 -#define WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) (((x) & WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) >> WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) -#define WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) (((x) << WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) & WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) -#define WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_MSB 0 -#define WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_LSB 0 -#define WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_MASK 0x00000001 -#define WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_GET(x) (((x) & WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_MASK) >> WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_LSB) -#define WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_SET(x) (((x) << WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_LSB) & WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_MASK) - -#define WLAN_HOST_IF_WINDOW_ADDRESS 0x00002000 -#define WLAN_HOST_IF_WINDOW_OFFSET 0x00002000 -#define WLAN_HOST_IF_WINDOW_DATA_MSB 7 -#define WLAN_HOST_IF_WINDOW_DATA_LSB 0 -#define WLAN_HOST_IF_WINDOW_DATA_MASK 0x000000ff -#define WLAN_HOST_IF_WINDOW_DATA_GET(x) (((x) & WLAN_HOST_IF_WINDOW_DATA_MASK) >> WLAN_HOST_IF_WINDOW_DATA_LSB) -#define WLAN_HOST_IF_WINDOW_DATA_SET(x) (((x) << WLAN_HOST_IF_WINDOW_DATA_LSB) & WLAN_HOST_IF_WINDOW_DATA_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct mbox_wlan_reg_reg_s { - volatile unsigned int wlan_mbox_fifo[4]; - volatile unsigned int wlan_mbox_fifo_status; - volatile unsigned int wlan_mbox_dma_policy; - volatile unsigned int wlan_mbox0_dma_rx_descriptor_base; - volatile unsigned int wlan_mbox0_dma_rx_control; - volatile unsigned int wlan_mbox0_dma_tx_descriptor_base; - volatile unsigned int wlan_mbox0_dma_tx_control; - volatile unsigned int wlan_mbox1_dma_rx_descriptor_base; - volatile unsigned int wlan_mbox1_dma_rx_control; - volatile unsigned int wlan_mbox1_dma_tx_descriptor_base; - volatile unsigned int wlan_mbox1_dma_tx_control; - volatile unsigned int wlan_mbox2_dma_rx_descriptor_base; - volatile unsigned int wlan_mbox2_dma_rx_control; - volatile unsigned int wlan_mbox2_dma_tx_descriptor_base; - volatile unsigned int wlan_mbox2_dma_tx_control; - volatile unsigned int wlan_mbox3_dma_rx_descriptor_base; - volatile unsigned int wlan_mbox3_dma_rx_control; - volatile unsigned int wlan_mbox3_dma_tx_descriptor_base; - volatile unsigned int wlan_mbox3_dma_tx_control; - volatile unsigned int wlan_mbox_int_status; - volatile unsigned int wlan_mbox_int_enable; - volatile unsigned int wlan_int_host; - unsigned char pad0[28]; /* pad to 0x80 */ - volatile unsigned int wlan_local_count[8]; - volatile unsigned int wlan_count_inc[8]; - volatile unsigned int wlan_local_scratch[8]; - volatile unsigned int wlan_use_local_bus; - volatile unsigned int wlan_sdio_config; - volatile unsigned int wlan_mbox_debug; - volatile unsigned int wlan_mbox_fifo_reset; - volatile unsigned int wlan_mbox_txfifo_pop[4]; - volatile unsigned int wlan_mbox_rxfifo_pop[4]; - volatile unsigned int wlan_sdio_debug; - volatile unsigned int wlan_gmbox0_dma_rx_descriptor_base; - volatile unsigned int wlan_gmbox0_dma_rx_control; - volatile unsigned int wlan_gmbox0_dma_tx_descriptor_base; - volatile unsigned int wlan_gmbox0_dma_tx_control; - volatile unsigned int wlan_gmbox_int_status; - volatile unsigned int wlan_gmbox_int_enable; - unsigned char pad1[7892]; /* pad to 0x2000 */ - volatile unsigned int wlan_host_if_window[2048]; -} mbox_wlan_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _MBOX_WLAN_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/rdma_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/rdma_reg.h deleted file mode 100644 index a169a6cc9136..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/rdma_reg.h +++ /dev/null @@ -1,564 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _RDMA_REG_REG_H_ -#define _RDMA_REG_REG_H_ - -#define DMA_CONFIG_ADDRESS 0x00000000 -#define DMA_CONFIG_OFFSET 0x00000000 -#define DMA_CONFIG_WLBB_PWD_EN_MSB 4 -#define DMA_CONFIG_WLBB_PWD_EN_LSB 4 -#define DMA_CONFIG_WLBB_PWD_EN_MASK 0x00000010 -#define DMA_CONFIG_WLBB_PWD_EN_GET(x) (((x) & DMA_CONFIG_WLBB_PWD_EN_MASK) >> DMA_CONFIG_WLBB_PWD_EN_LSB) -#define DMA_CONFIG_WLBB_PWD_EN_SET(x) (((x) << DMA_CONFIG_WLBB_PWD_EN_LSB) & DMA_CONFIG_WLBB_PWD_EN_MASK) -#define DMA_CONFIG_WLMAC_PWD_EN_MSB 3 -#define DMA_CONFIG_WLMAC_PWD_EN_LSB 3 -#define DMA_CONFIG_WLMAC_PWD_EN_MASK 0x00000008 -#define DMA_CONFIG_WLMAC_PWD_EN_GET(x) (((x) & DMA_CONFIG_WLMAC_PWD_EN_MASK) >> DMA_CONFIG_WLMAC_PWD_EN_LSB) -#define DMA_CONFIG_WLMAC_PWD_EN_SET(x) (((x) << DMA_CONFIG_WLMAC_PWD_EN_LSB) & DMA_CONFIG_WLMAC_PWD_EN_MASK) -#define DMA_CONFIG_ENABLE_RETENTION_MSB 2 -#define DMA_CONFIG_ENABLE_RETENTION_LSB 2 -#define DMA_CONFIG_ENABLE_RETENTION_MASK 0x00000004 -#define DMA_CONFIG_ENABLE_RETENTION_GET(x) (((x) & DMA_CONFIG_ENABLE_RETENTION_MASK) >> DMA_CONFIG_ENABLE_RETENTION_LSB) -#define DMA_CONFIG_ENABLE_RETENTION_SET(x) (((x) << DMA_CONFIG_ENABLE_RETENTION_LSB) & DMA_CONFIG_ENABLE_RETENTION_MASK) -#define DMA_CONFIG_RTC_PRIORITY_MSB 1 -#define DMA_CONFIG_RTC_PRIORITY_LSB 1 -#define DMA_CONFIG_RTC_PRIORITY_MASK 0x00000002 -#define DMA_CONFIG_RTC_PRIORITY_GET(x) (((x) & DMA_CONFIG_RTC_PRIORITY_MASK) >> DMA_CONFIG_RTC_PRIORITY_LSB) -#define DMA_CONFIG_RTC_PRIORITY_SET(x) (((x) << DMA_CONFIG_RTC_PRIORITY_LSB) & DMA_CONFIG_RTC_PRIORITY_MASK) -#define DMA_CONFIG_DMA_TYPE_MSB 0 -#define DMA_CONFIG_DMA_TYPE_LSB 0 -#define DMA_CONFIG_DMA_TYPE_MASK 0x00000001 -#define DMA_CONFIG_DMA_TYPE_GET(x) (((x) & DMA_CONFIG_DMA_TYPE_MASK) >> DMA_CONFIG_DMA_TYPE_LSB) -#define DMA_CONFIG_DMA_TYPE_SET(x) (((x) << DMA_CONFIG_DMA_TYPE_LSB) & DMA_CONFIG_DMA_TYPE_MASK) - -#define DMA_CONTROL_ADDRESS 0x00000004 -#define DMA_CONTROL_OFFSET 0x00000004 -#define DMA_CONTROL_START_MSB 1 -#define DMA_CONTROL_START_LSB 1 -#define DMA_CONTROL_START_MASK 0x00000002 -#define DMA_CONTROL_START_GET(x) (((x) & DMA_CONTROL_START_MASK) >> DMA_CONTROL_START_LSB) -#define DMA_CONTROL_START_SET(x) (((x) << DMA_CONTROL_START_LSB) & DMA_CONTROL_START_MASK) -#define DMA_CONTROL_STOP_MSB 0 -#define DMA_CONTROL_STOP_LSB 0 -#define DMA_CONTROL_STOP_MASK 0x00000001 -#define DMA_CONTROL_STOP_GET(x) (((x) & DMA_CONTROL_STOP_MASK) >> DMA_CONTROL_STOP_LSB) -#define DMA_CONTROL_STOP_SET(x) (((x) << DMA_CONTROL_STOP_LSB) & DMA_CONTROL_STOP_MASK) - -#define DMA_SRC_ADDRESS 0x00000008 -#define DMA_SRC_OFFSET 0x00000008 -#define DMA_SRC_ADDR_MSB 31 -#define DMA_SRC_ADDR_LSB 2 -#define DMA_SRC_ADDR_MASK 0xfffffffc -#define DMA_SRC_ADDR_GET(x) (((x) & DMA_SRC_ADDR_MASK) >> DMA_SRC_ADDR_LSB) -#define DMA_SRC_ADDR_SET(x) (((x) << DMA_SRC_ADDR_LSB) & DMA_SRC_ADDR_MASK) - -#define DMA_DEST_ADDRESS 0x0000000c -#define DMA_DEST_OFFSET 0x0000000c -#define DMA_DEST_ADDR_MSB 31 -#define DMA_DEST_ADDR_LSB 2 -#define DMA_DEST_ADDR_MASK 0xfffffffc -#define DMA_DEST_ADDR_GET(x) (((x) & DMA_DEST_ADDR_MASK) >> DMA_DEST_ADDR_LSB) -#define DMA_DEST_ADDR_SET(x) (((x) << DMA_DEST_ADDR_LSB) & DMA_DEST_ADDR_MASK) - -#define DMA_LENGTH_ADDRESS 0x00000010 -#define DMA_LENGTH_OFFSET 0x00000010 -#define DMA_LENGTH_WORDS_MSB 11 -#define DMA_LENGTH_WORDS_LSB 0 -#define DMA_LENGTH_WORDS_MASK 0x00000fff -#define DMA_LENGTH_WORDS_GET(x) (((x) & DMA_LENGTH_WORDS_MASK) >> DMA_LENGTH_WORDS_LSB) -#define DMA_LENGTH_WORDS_SET(x) (((x) << DMA_LENGTH_WORDS_LSB) & DMA_LENGTH_WORDS_MASK) - -#define VMC_BASE_ADDRESS 0x00000014 -#define VMC_BASE_OFFSET 0x00000014 -#define VMC_BASE_ADDR_MSB 31 -#define VMC_BASE_ADDR_LSB 2 -#define VMC_BASE_ADDR_MASK 0xfffffffc -#define VMC_BASE_ADDR_GET(x) (((x) & VMC_BASE_ADDR_MASK) >> VMC_BASE_ADDR_LSB) -#define VMC_BASE_ADDR_SET(x) (((x) << VMC_BASE_ADDR_LSB) & VMC_BASE_ADDR_MASK) - -#define INDIRECT_REG_ADDRESS 0x00000018 -#define INDIRECT_REG_OFFSET 0x00000018 -#define INDIRECT_REG_ID_MSB 31 -#define INDIRECT_REG_ID_LSB 2 -#define INDIRECT_REG_ID_MASK 0xfffffffc -#define INDIRECT_REG_ID_GET(x) (((x) & INDIRECT_REG_ID_MASK) >> INDIRECT_REG_ID_LSB) -#define INDIRECT_REG_ID_SET(x) (((x) << INDIRECT_REG_ID_LSB) & INDIRECT_REG_ID_MASK) - -#define INDIRECT_RETURN_ADDRESS 0x0000001c -#define INDIRECT_RETURN_OFFSET 0x0000001c -#define INDIRECT_RETURN_ADDR_MSB 31 -#define INDIRECT_RETURN_ADDR_LSB 2 -#define INDIRECT_RETURN_ADDR_MASK 0xfffffffc -#define INDIRECT_RETURN_ADDR_GET(x) (((x) & INDIRECT_RETURN_ADDR_MASK) >> INDIRECT_RETURN_ADDR_LSB) -#define INDIRECT_RETURN_ADDR_SET(x) (((x) << INDIRECT_RETURN_ADDR_LSB) & INDIRECT_RETURN_ADDR_MASK) - -#define RDMA_REGION_0__ADDRESS 0x00000020 -#define RDMA_REGION_0__OFFSET 0x00000020 -#define RDMA_REGION_0__ADDR_MSB 31 -#define RDMA_REGION_0__ADDR_LSB 13 -#define RDMA_REGION_0__ADDR_MASK 0xffffe000 -#define RDMA_REGION_0__ADDR_GET(x) (((x) & RDMA_REGION_0__ADDR_MASK) >> RDMA_REGION_0__ADDR_LSB) -#define RDMA_REGION_0__ADDR_SET(x) (((x) << RDMA_REGION_0__ADDR_LSB) & RDMA_REGION_0__ADDR_MASK) -#define RDMA_REGION_0__LENGTH_MSB 12 -#define RDMA_REGION_0__LENGTH_LSB 2 -#define RDMA_REGION_0__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_0__LENGTH_GET(x) (((x) & RDMA_REGION_0__LENGTH_MASK) >> RDMA_REGION_0__LENGTH_LSB) -#define RDMA_REGION_0__LENGTH_SET(x) (((x) << RDMA_REGION_0__LENGTH_LSB) & RDMA_REGION_0__LENGTH_MASK) -#define RDMA_REGION_0__INDI_MSB 1 -#define RDMA_REGION_0__INDI_LSB 1 -#define RDMA_REGION_0__INDI_MASK 0x00000002 -#define RDMA_REGION_0__INDI_GET(x) (((x) & RDMA_REGION_0__INDI_MASK) >> RDMA_REGION_0__INDI_LSB) -#define RDMA_REGION_0__INDI_SET(x) (((x) << RDMA_REGION_0__INDI_LSB) & RDMA_REGION_0__INDI_MASK) -#define RDMA_REGION_0__NEXT_MSB 0 -#define RDMA_REGION_0__NEXT_LSB 0 -#define RDMA_REGION_0__NEXT_MASK 0x00000001 -#define RDMA_REGION_0__NEXT_GET(x) (((x) & RDMA_REGION_0__NEXT_MASK) >> RDMA_REGION_0__NEXT_LSB) -#define RDMA_REGION_0__NEXT_SET(x) (((x) << RDMA_REGION_0__NEXT_LSB) & RDMA_REGION_0__NEXT_MASK) - -#define RDMA_REGION_1__ADDRESS 0x00000024 -#define RDMA_REGION_1__OFFSET 0x00000024 -#define RDMA_REGION_1__ADDR_MSB 31 -#define RDMA_REGION_1__ADDR_LSB 13 -#define RDMA_REGION_1__ADDR_MASK 0xffffe000 -#define RDMA_REGION_1__ADDR_GET(x) (((x) & RDMA_REGION_1__ADDR_MASK) >> RDMA_REGION_1__ADDR_LSB) -#define RDMA_REGION_1__ADDR_SET(x) (((x) << RDMA_REGION_1__ADDR_LSB) & RDMA_REGION_1__ADDR_MASK) -#define RDMA_REGION_1__LENGTH_MSB 12 -#define RDMA_REGION_1__LENGTH_LSB 2 -#define RDMA_REGION_1__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_1__LENGTH_GET(x) (((x) & RDMA_REGION_1__LENGTH_MASK) >> RDMA_REGION_1__LENGTH_LSB) -#define RDMA_REGION_1__LENGTH_SET(x) (((x) << RDMA_REGION_1__LENGTH_LSB) & RDMA_REGION_1__LENGTH_MASK) -#define RDMA_REGION_1__INDI_MSB 1 -#define RDMA_REGION_1__INDI_LSB 1 -#define RDMA_REGION_1__INDI_MASK 0x00000002 -#define RDMA_REGION_1__INDI_GET(x) (((x) & RDMA_REGION_1__INDI_MASK) >> RDMA_REGION_1__INDI_LSB) -#define RDMA_REGION_1__INDI_SET(x) (((x) << RDMA_REGION_1__INDI_LSB) & RDMA_REGION_1__INDI_MASK) -#define RDMA_REGION_1__NEXT_MSB 0 -#define RDMA_REGION_1__NEXT_LSB 0 -#define RDMA_REGION_1__NEXT_MASK 0x00000001 -#define RDMA_REGION_1__NEXT_GET(x) (((x) & RDMA_REGION_1__NEXT_MASK) >> RDMA_REGION_1__NEXT_LSB) -#define RDMA_REGION_1__NEXT_SET(x) (((x) << RDMA_REGION_1__NEXT_LSB) & RDMA_REGION_1__NEXT_MASK) - -#define RDMA_REGION_2__ADDRESS 0x00000028 -#define RDMA_REGION_2__OFFSET 0x00000028 -#define RDMA_REGION_2__ADDR_MSB 31 -#define RDMA_REGION_2__ADDR_LSB 13 -#define RDMA_REGION_2__ADDR_MASK 0xffffe000 -#define RDMA_REGION_2__ADDR_GET(x) (((x) & RDMA_REGION_2__ADDR_MASK) >> RDMA_REGION_2__ADDR_LSB) -#define RDMA_REGION_2__ADDR_SET(x) (((x) << RDMA_REGION_2__ADDR_LSB) & RDMA_REGION_2__ADDR_MASK) -#define RDMA_REGION_2__LENGTH_MSB 12 -#define RDMA_REGION_2__LENGTH_LSB 2 -#define RDMA_REGION_2__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_2__LENGTH_GET(x) (((x) & RDMA_REGION_2__LENGTH_MASK) >> RDMA_REGION_2__LENGTH_LSB) -#define RDMA_REGION_2__LENGTH_SET(x) (((x) << RDMA_REGION_2__LENGTH_LSB) & RDMA_REGION_2__LENGTH_MASK) -#define RDMA_REGION_2__INDI_MSB 1 -#define RDMA_REGION_2__INDI_LSB 1 -#define RDMA_REGION_2__INDI_MASK 0x00000002 -#define RDMA_REGION_2__INDI_GET(x) (((x) & RDMA_REGION_2__INDI_MASK) >> RDMA_REGION_2__INDI_LSB) -#define RDMA_REGION_2__INDI_SET(x) (((x) << RDMA_REGION_2__INDI_LSB) & RDMA_REGION_2__INDI_MASK) -#define RDMA_REGION_2__NEXT_MSB 0 -#define RDMA_REGION_2__NEXT_LSB 0 -#define RDMA_REGION_2__NEXT_MASK 0x00000001 -#define RDMA_REGION_2__NEXT_GET(x) (((x) & RDMA_REGION_2__NEXT_MASK) >> RDMA_REGION_2__NEXT_LSB) -#define RDMA_REGION_2__NEXT_SET(x) (((x) << RDMA_REGION_2__NEXT_LSB) & RDMA_REGION_2__NEXT_MASK) - -#define RDMA_REGION_3__ADDRESS 0x0000002c -#define RDMA_REGION_3__OFFSET 0x0000002c -#define RDMA_REGION_3__ADDR_MSB 31 -#define RDMA_REGION_3__ADDR_LSB 13 -#define RDMA_REGION_3__ADDR_MASK 0xffffe000 -#define RDMA_REGION_3__ADDR_GET(x) (((x) & RDMA_REGION_3__ADDR_MASK) >> RDMA_REGION_3__ADDR_LSB) -#define RDMA_REGION_3__ADDR_SET(x) (((x) << RDMA_REGION_3__ADDR_LSB) & RDMA_REGION_3__ADDR_MASK) -#define RDMA_REGION_3__LENGTH_MSB 12 -#define RDMA_REGION_3__LENGTH_LSB 2 -#define RDMA_REGION_3__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_3__LENGTH_GET(x) (((x) & RDMA_REGION_3__LENGTH_MASK) >> RDMA_REGION_3__LENGTH_LSB) -#define RDMA_REGION_3__LENGTH_SET(x) (((x) << RDMA_REGION_3__LENGTH_LSB) & RDMA_REGION_3__LENGTH_MASK) -#define RDMA_REGION_3__INDI_MSB 1 -#define RDMA_REGION_3__INDI_LSB 1 -#define RDMA_REGION_3__INDI_MASK 0x00000002 -#define RDMA_REGION_3__INDI_GET(x) (((x) & RDMA_REGION_3__INDI_MASK) >> RDMA_REGION_3__INDI_LSB) -#define RDMA_REGION_3__INDI_SET(x) (((x) << RDMA_REGION_3__INDI_LSB) & RDMA_REGION_3__INDI_MASK) -#define RDMA_REGION_3__NEXT_MSB 0 -#define RDMA_REGION_3__NEXT_LSB 0 -#define RDMA_REGION_3__NEXT_MASK 0x00000001 -#define RDMA_REGION_3__NEXT_GET(x) (((x) & RDMA_REGION_3__NEXT_MASK) >> RDMA_REGION_3__NEXT_LSB) -#define RDMA_REGION_3__NEXT_SET(x) (((x) << RDMA_REGION_3__NEXT_LSB) & RDMA_REGION_3__NEXT_MASK) - -#define RDMA_REGION_4__ADDRESS 0x00000030 -#define RDMA_REGION_4__OFFSET 0x00000030 -#define RDMA_REGION_4__ADDR_MSB 31 -#define RDMA_REGION_4__ADDR_LSB 13 -#define RDMA_REGION_4__ADDR_MASK 0xffffe000 -#define RDMA_REGION_4__ADDR_GET(x) (((x) & RDMA_REGION_4__ADDR_MASK) >> RDMA_REGION_4__ADDR_LSB) -#define RDMA_REGION_4__ADDR_SET(x) (((x) << RDMA_REGION_4__ADDR_LSB) & RDMA_REGION_4__ADDR_MASK) -#define RDMA_REGION_4__LENGTH_MSB 12 -#define RDMA_REGION_4__LENGTH_LSB 2 -#define RDMA_REGION_4__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_4__LENGTH_GET(x) (((x) & RDMA_REGION_4__LENGTH_MASK) >> RDMA_REGION_4__LENGTH_LSB) -#define RDMA_REGION_4__LENGTH_SET(x) (((x) << RDMA_REGION_4__LENGTH_LSB) & RDMA_REGION_4__LENGTH_MASK) -#define RDMA_REGION_4__INDI_MSB 1 -#define RDMA_REGION_4__INDI_LSB 1 -#define RDMA_REGION_4__INDI_MASK 0x00000002 -#define RDMA_REGION_4__INDI_GET(x) (((x) & RDMA_REGION_4__INDI_MASK) >> RDMA_REGION_4__INDI_LSB) -#define RDMA_REGION_4__INDI_SET(x) (((x) << RDMA_REGION_4__INDI_LSB) & RDMA_REGION_4__INDI_MASK) -#define RDMA_REGION_4__NEXT_MSB 0 -#define RDMA_REGION_4__NEXT_LSB 0 -#define RDMA_REGION_4__NEXT_MASK 0x00000001 -#define RDMA_REGION_4__NEXT_GET(x) (((x) & RDMA_REGION_4__NEXT_MASK) >> RDMA_REGION_4__NEXT_LSB) -#define RDMA_REGION_4__NEXT_SET(x) (((x) << RDMA_REGION_4__NEXT_LSB) & RDMA_REGION_4__NEXT_MASK) - -#define RDMA_REGION_5__ADDRESS 0x00000034 -#define RDMA_REGION_5__OFFSET 0x00000034 -#define RDMA_REGION_5__ADDR_MSB 31 -#define RDMA_REGION_5__ADDR_LSB 13 -#define RDMA_REGION_5__ADDR_MASK 0xffffe000 -#define RDMA_REGION_5__ADDR_GET(x) (((x) & RDMA_REGION_5__ADDR_MASK) >> RDMA_REGION_5__ADDR_LSB) -#define RDMA_REGION_5__ADDR_SET(x) (((x) << RDMA_REGION_5__ADDR_LSB) & RDMA_REGION_5__ADDR_MASK) -#define RDMA_REGION_5__LENGTH_MSB 12 -#define RDMA_REGION_5__LENGTH_LSB 2 -#define RDMA_REGION_5__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_5__LENGTH_GET(x) (((x) & RDMA_REGION_5__LENGTH_MASK) >> RDMA_REGION_5__LENGTH_LSB) -#define RDMA_REGION_5__LENGTH_SET(x) (((x) << RDMA_REGION_5__LENGTH_LSB) & RDMA_REGION_5__LENGTH_MASK) -#define RDMA_REGION_5__INDI_MSB 1 -#define RDMA_REGION_5__INDI_LSB 1 -#define RDMA_REGION_5__INDI_MASK 0x00000002 -#define RDMA_REGION_5__INDI_GET(x) (((x) & RDMA_REGION_5__INDI_MASK) >> RDMA_REGION_5__INDI_LSB) -#define RDMA_REGION_5__INDI_SET(x) (((x) << RDMA_REGION_5__INDI_LSB) & RDMA_REGION_5__INDI_MASK) -#define RDMA_REGION_5__NEXT_MSB 0 -#define RDMA_REGION_5__NEXT_LSB 0 -#define RDMA_REGION_5__NEXT_MASK 0x00000001 -#define RDMA_REGION_5__NEXT_GET(x) (((x) & RDMA_REGION_5__NEXT_MASK) >> RDMA_REGION_5__NEXT_LSB) -#define RDMA_REGION_5__NEXT_SET(x) (((x) << RDMA_REGION_5__NEXT_LSB) & RDMA_REGION_5__NEXT_MASK) - -#define RDMA_REGION_6__ADDRESS 0x00000038 -#define RDMA_REGION_6__OFFSET 0x00000038 -#define RDMA_REGION_6__ADDR_MSB 31 -#define RDMA_REGION_6__ADDR_LSB 13 -#define RDMA_REGION_6__ADDR_MASK 0xffffe000 -#define RDMA_REGION_6__ADDR_GET(x) (((x) & RDMA_REGION_6__ADDR_MASK) >> RDMA_REGION_6__ADDR_LSB) -#define RDMA_REGION_6__ADDR_SET(x) (((x) << RDMA_REGION_6__ADDR_LSB) & RDMA_REGION_6__ADDR_MASK) -#define RDMA_REGION_6__LENGTH_MSB 12 -#define RDMA_REGION_6__LENGTH_LSB 2 -#define RDMA_REGION_6__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_6__LENGTH_GET(x) (((x) & RDMA_REGION_6__LENGTH_MASK) >> RDMA_REGION_6__LENGTH_LSB) -#define RDMA_REGION_6__LENGTH_SET(x) (((x) << RDMA_REGION_6__LENGTH_LSB) & RDMA_REGION_6__LENGTH_MASK) -#define RDMA_REGION_6__INDI_MSB 1 -#define RDMA_REGION_6__INDI_LSB 1 -#define RDMA_REGION_6__INDI_MASK 0x00000002 -#define RDMA_REGION_6__INDI_GET(x) (((x) & RDMA_REGION_6__INDI_MASK) >> RDMA_REGION_6__INDI_LSB) -#define RDMA_REGION_6__INDI_SET(x) (((x) << RDMA_REGION_6__INDI_LSB) & RDMA_REGION_6__INDI_MASK) -#define RDMA_REGION_6__NEXT_MSB 0 -#define RDMA_REGION_6__NEXT_LSB 0 -#define RDMA_REGION_6__NEXT_MASK 0x00000001 -#define RDMA_REGION_6__NEXT_GET(x) (((x) & RDMA_REGION_6__NEXT_MASK) >> RDMA_REGION_6__NEXT_LSB) -#define RDMA_REGION_6__NEXT_SET(x) (((x) << RDMA_REGION_6__NEXT_LSB) & RDMA_REGION_6__NEXT_MASK) - -#define RDMA_REGION_7__ADDRESS 0x0000003c -#define RDMA_REGION_7__OFFSET 0x0000003c -#define RDMA_REGION_7__ADDR_MSB 31 -#define RDMA_REGION_7__ADDR_LSB 13 -#define RDMA_REGION_7__ADDR_MASK 0xffffe000 -#define RDMA_REGION_7__ADDR_GET(x) (((x) & RDMA_REGION_7__ADDR_MASK) >> RDMA_REGION_7__ADDR_LSB) -#define RDMA_REGION_7__ADDR_SET(x) (((x) << RDMA_REGION_7__ADDR_LSB) & RDMA_REGION_7__ADDR_MASK) -#define RDMA_REGION_7__LENGTH_MSB 12 -#define RDMA_REGION_7__LENGTH_LSB 2 -#define RDMA_REGION_7__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_7__LENGTH_GET(x) (((x) & RDMA_REGION_7__LENGTH_MASK) >> RDMA_REGION_7__LENGTH_LSB) -#define RDMA_REGION_7__LENGTH_SET(x) (((x) << RDMA_REGION_7__LENGTH_LSB) & RDMA_REGION_7__LENGTH_MASK) -#define RDMA_REGION_7__INDI_MSB 1 -#define RDMA_REGION_7__INDI_LSB 1 -#define RDMA_REGION_7__INDI_MASK 0x00000002 -#define RDMA_REGION_7__INDI_GET(x) (((x) & RDMA_REGION_7__INDI_MASK) >> RDMA_REGION_7__INDI_LSB) -#define RDMA_REGION_7__INDI_SET(x) (((x) << RDMA_REGION_7__INDI_LSB) & RDMA_REGION_7__INDI_MASK) -#define RDMA_REGION_7__NEXT_MSB 0 -#define RDMA_REGION_7__NEXT_LSB 0 -#define RDMA_REGION_7__NEXT_MASK 0x00000001 -#define RDMA_REGION_7__NEXT_GET(x) (((x) & RDMA_REGION_7__NEXT_MASK) >> RDMA_REGION_7__NEXT_LSB) -#define RDMA_REGION_7__NEXT_SET(x) (((x) << RDMA_REGION_7__NEXT_LSB) & RDMA_REGION_7__NEXT_MASK) - -#define RDMA_REGION_8__ADDRESS 0x00000040 -#define RDMA_REGION_8__OFFSET 0x00000040 -#define RDMA_REGION_8__ADDR_MSB 31 -#define RDMA_REGION_8__ADDR_LSB 13 -#define RDMA_REGION_8__ADDR_MASK 0xffffe000 -#define RDMA_REGION_8__ADDR_GET(x) (((x) & RDMA_REGION_8__ADDR_MASK) >> RDMA_REGION_8__ADDR_LSB) -#define RDMA_REGION_8__ADDR_SET(x) (((x) << RDMA_REGION_8__ADDR_LSB) & RDMA_REGION_8__ADDR_MASK) -#define RDMA_REGION_8__LENGTH_MSB 12 -#define RDMA_REGION_8__LENGTH_LSB 2 -#define RDMA_REGION_8__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_8__LENGTH_GET(x) (((x) & RDMA_REGION_8__LENGTH_MASK) >> RDMA_REGION_8__LENGTH_LSB) -#define RDMA_REGION_8__LENGTH_SET(x) (((x) << RDMA_REGION_8__LENGTH_LSB) & RDMA_REGION_8__LENGTH_MASK) -#define RDMA_REGION_8__INDI_MSB 1 -#define RDMA_REGION_8__INDI_LSB 1 -#define RDMA_REGION_8__INDI_MASK 0x00000002 -#define RDMA_REGION_8__INDI_GET(x) (((x) & RDMA_REGION_8__INDI_MASK) >> RDMA_REGION_8__INDI_LSB) -#define RDMA_REGION_8__INDI_SET(x) (((x) << RDMA_REGION_8__INDI_LSB) & RDMA_REGION_8__INDI_MASK) -#define RDMA_REGION_8__NEXT_MSB 0 -#define RDMA_REGION_8__NEXT_LSB 0 -#define RDMA_REGION_8__NEXT_MASK 0x00000001 -#define RDMA_REGION_8__NEXT_GET(x) (((x) & RDMA_REGION_8__NEXT_MASK) >> RDMA_REGION_8__NEXT_LSB) -#define RDMA_REGION_8__NEXT_SET(x) (((x) << RDMA_REGION_8__NEXT_LSB) & RDMA_REGION_8__NEXT_MASK) - -#define RDMA_REGION_9__ADDRESS 0x00000044 -#define RDMA_REGION_9__OFFSET 0x00000044 -#define RDMA_REGION_9__ADDR_MSB 31 -#define RDMA_REGION_9__ADDR_LSB 13 -#define RDMA_REGION_9__ADDR_MASK 0xffffe000 -#define RDMA_REGION_9__ADDR_GET(x) (((x) & RDMA_REGION_9__ADDR_MASK) >> RDMA_REGION_9__ADDR_LSB) -#define RDMA_REGION_9__ADDR_SET(x) (((x) << RDMA_REGION_9__ADDR_LSB) & RDMA_REGION_9__ADDR_MASK) -#define RDMA_REGION_9__LENGTH_MSB 12 -#define RDMA_REGION_9__LENGTH_LSB 2 -#define RDMA_REGION_9__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_9__LENGTH_GET(x) (((x) & RDMA_REGION_9__LENGTH_MASK) >> RDMA_REGION_9__LENGTH_LSB) -#define RDMA_REGION_9__LENGTH_SET(x) (((x) << RDMA_REGION_9__LENGTH_LSB) & RDMA_REGION_9__LENGTH_MASK) -#define RDMA_REGION_9__INDI_MSB 1 -#define RDMA_REGION_9__INDI_LSB 1 -#define RDMA_REGION_9__INDI_MASK 0x00000002 -#define RDMA_REGION_9__INDI_GET(x) (((x) & RDMA_REGION_9__INDI_MASK) >> RDMA_REGION_9__INDI_LSB) -#define RDMA_REGION_9__INDI_SET(x) (((x) << RDMA_REGION_9__INDI_LSB) & RDMA_REGION_9__INDI_MASK) -#define RDMA_REGION_9__NEXT_MSB 0 -#define RDMA_REGION_9__NEXT_LSB 0 -#define RDMA_REGION_9__NEXT_MASK 0x00000001 -#define RDMA_REGION_9__NEXT_GET(x) (((x) & RDMA_REGION_9__NEXT_MASK) >> RDMA_REGION_9__NEXT_LSB) -#define RDMA_REGION_9__NEXT_SET(x) (((x) << RDMA_REGION_9__NEXT_LSB) & RDMA_REGION_9__NEXT_MASK) - -#define RDMA_REGION_10__ADDRESS 0x00000048 -#define RDMA_REGION_10__OFFSET 0x00000048 -#define RDMA_REGION_10__ADDR_MSB 31 -#define RDMA_REGION_10__ADDR_LSB 13 -#define RDMA_REGION_10__ADDR_MASK 0xffffe000 -#define RDMA_REGION_10__ADDR_GET(x) (((x) & RDMA_REGION_10__ADDR_MASK) >> RDMA_REGION_10__ADDR_LSB) -#define RDMA_REGION_10__ADDR_SET(x) (((x) << RDMA_REGION_10__ADDR_LSB) & RDMA_REGION_10__ADDR_MASK) -#define RDMA_REGION_10__LENGTH_MSB 12 -#define RDMA_REGION_10__LENGTH_LSB 2 -#define RDMA_REGION_10__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_10__LENGTH_GET(x) (((x) & RDMA_REGION_10__LENGTH_MASK) >> RDMA_REGION_10__LENGTH_LSB) -#define RDMA_REGION_10__LENGTH_SET(x) (((x) << RDMA_REGION_10__LENGTH_LSB) & RDMA_REGION_10__LENGTH_MASK) -#define RDMA_REGION_10__INDI_MSB 1 -#define RDMA_REGION_10__INDI_LSB 1 -#define RDMA_REGION_10__INDI_MASK 0x00000002 -#define RDMA_REGION_10__INDI_GET(x) (((x) & RDMA_REGION_10__INDI_MASK) >> RDMA_REGION_10__INDI_LSB) -#define RDMA_REGION_10__INDI_SET(x) (((x) << RDMA_REGION_10__INDI_LSB) & RDMA_REGION_10__INDI_MASK) -#define RDMA_REGION_10__NEXT_MSB 0 -#define RDMA_REGION_10__NEXT_LSB 0 -#define RDMA_REGION_10__NEXT_MASK 0x00000001 -#define RDMA_REGION_10__NEXT_GET(x) (((x) & RDMA_REGION_10__NEXT_MASK) >> RDMA_REGION_10__NEXT_LSB) -#define RDMA_REGION_10__NEXT_SET(x) (((x) << RDMA_REGION_10__NEXT_LSB) & RDMA_REGION_10__NEXT_MASK) - -#define RDMA_REGION_11__ADDRESS 0x0000004c -#define RDMA_REGION_11__OFFSET 0x0000004c -#define RDMA_REGION_11__ADDR_MSB 31 -#define RDMA_REGION_11__ADDR_LSB 13 -#define RDMA_REGION_11__ADDR_MASK 0xffffe000 -#define RDMA_REGION_11__ADDR_GET(x) (((x) & RDMA_REGION_11__ADDR_MASK) >> RDMA_REGION_11__ADDR_LSB) -#define RDMA_REGION_11__ADDR_SET(x) (((x) << RDMA_REGION_11__ADDR_LSB) & RDMA_REGION_11__ADDR_MASK) -#define RDMA_REGION_11__LENGTH_MSB 12 -#define RDMA_REGION_11__LENGTH_LSB 2 -#define RDMA_REGION_11__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_11__LENGTH_GET(x) (((x) & RDMA_REGION_11__LENGTH_MASK) >> RDMA_REGION_11__LENGTH_LSB) -#define RDMA_REGION_11__LENGTH_SET(x) (((x) << RDMA_REGION_11__LENGTH_LSB) & RDMA_REGION_11__LENGTH_MASK) -#define RDMA_REGION_11__INDI_MSB 1 -#define RDMA_REGION_11__INDI_LSB 1 -#define RDMA_REGION_11__INDI_MASK 0x00000002 -#define RDMA_REGION_11__INDI_GET(x) (((x) & RDMA_REGION_11__INDI_MASK) >> RDMA_REGION_11__INDI_LSB) -#define RDMA_REGION_11__INDI_SET(x) (((x) << RDMA_REGION_11__INDI_LSB) & RDMA_REGION_11__INDI_MASK) -#define RDMA_REGION_11__NEXT_MSB 0 -#define RDMA_REGION_11__NEXT_LSB 0 -#define RDMA_REGION_11__NEXT_MASK 0x00000001 -#define RDMA_REGION_11__NEXT_GET(x) (((x) & RDMA_REGION_11__NEXT_MASK) >> RDMA_REGION_11__NEXT_LSB) -#define RDMA_REGION_11__NEXT_SET(x) (((x) << RDMA_REGION_11__NEXT_LSB) & RDMA_REGION_11__NEXT_MASK) - -#define RDMA_REGION_12__ADDRESS 0x00000050 -#define RDMA_REGION_12__OFFSET 0x00000050 -#define RDMA_REGION_12__ADDR_MSB 31 -#define RDMA_REGION_12__ADDR_LSB 13 -#define RDMA_REGION_12__ADDR_MASK 0xffffe000 -#define RDMA_REGION_12__ADDR_GET(x) (((x) & RDMA_REGION_12__ADDR_MASK) >> RDMA_REGION_12__ADDR_LSB) -#define RDMA_REGION_12__ADDR_SET(x) (((x) << RDMA_REGION_12__ADDR_LSB) & RDMA_REGION_12__ADDR_MASK) -#define RDMA_REGION_12__LENGTH_MSB 12 -#define RDMA_REGION_12__LENGTH_LSB 2 -#define RDMA_REGION_12__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_12__LENGTH_GET(x) (((x) & RDMA_REGION_12__LENGTH_MASK) >> RDMA_REGION_12__LENGTH_LSB) -#define RDMA_REGION_12__LENGTH_SET(x) (((x) << RDMA_REGION_12__LENGTH_LSB) & RDMA_REGION_12__LENGTH_MASK) -#define RDMA_REGION_12__INDI_MSB 1 -#define RDMA_REGION_12__INDI_LSB 1 -#define RDMA_REGION_12__INDI_MASK 0x00000002 -#define RDMA_REGION_12__INDI_GET(x) (((x) & RDMA_REGION_12__INDI_MASK) >> RDMA_REGION_12__INDI_LSB) -#define RDMA_REGION_12__INDI_SET(x) (((x) << RDMA_REGION_12__INDI_LSB) & RDMA_REGION_12__INDI_MASK) -#define RDMA_REGION_12__NEXT_MSB 0 -#define RDMA_REGION_12__NEXT_LSB 0 -#define RDMA_REGION_12__NEXT_MASK 0x00000001 -#define RDMA_REGION_12__NEXT_GET(x) (((x) & RDMA_REGION_12__NEXT_MASK) >> RDMA_REGION_12__NEXT_LSB) -#define RDMA_REGION_12__NEXT_SET(x) (((x) << RDMA_REGION_12__NEXT_LSB) & RDMA_REGION_12__NEXT_MASK) - -#define RDMA_REGION_13__ADDRESS 0x00000054 -#define RDMA_REGION_13__OFFSET 0x00000054 -#define RDMA_REGION_13__ADDR_MSB 31 -#define RDMA_REGION_13__ADDR_LSB 13 -#define RDMA_REGION_13__ADDR_MASK 0xffffe000 -#define RDMA_REGION_13__ADDR_GET(x) (((x) & RDMA_REGION_13__ADDR_MASK) >> RDMA_REGION_13__ADDR_LSB) -#define RDMA_REGION_13__ADDR_SET(x) (((x) << RDMA_REGION_13__ADDR_LSB) & RDMA_REGION_13__ADDR_MASK) -#define RDMA_REGION_13__LENGTH_MSB 12 -#define RDMA_REGION_13__LENGTH_LSB 2 -#define RDMA_REGION_13__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_13__LENGTH_GET(x) (((x) & RDMA_REGION_13__LENGTH_MASK) >> RDMA_REGION_13__LENGTH_LSB) -#define RDMA_REGION_13__LENGTH_SET(x) (((x) << RDMA_REGION_13__LENGTH_LSB) & RDMA_REGION_13__LENGTH_MASK) -#define RDMA_REGION_13__INDI_MSB 1 -#define RDMA_REGION_13__INDI_LSB 1 -#define RDMA_REGION_13__INDI_MASK 0x00000002 -#define RDMA_REGION_13__INDI_GET(x) (((x) & RDMA_REGION_13__INDI_MASK) >> RDMA_REGION_13__INDI_LSB) -#define RDMA_REGION_13__INDI_SET(x) (((x) << RDMA_REGION_13__INDI_LSB) & RDMA_REGION_13__INDI_MASK) -#define RDMA_REGION_13__NEXT_MSB 0 -#define RDMA_REGION_13__NEXT_LSB 0 -#define RDMA_REGION_13__NEXT_MASK 0x00000001 -#define RDMA_REGION_13__NEXT_GET(x) (((x) & RDMA_REGION_13__NEXT_MASK) >> RDMA_REGION_13__NEXT_LSB) -#define RDMA_REGION_13__NEXT_SET(x) (((x) << RDMA_REGION_13__NEXT_LSB) & RDMA_REGION_13__NEXT_MASK) - -#define RDMA_REGION_14__ADDRESS 0x00000058 -#define RDMA_REGION_14__OFFSET 0x00000058 -#define RDMA_REGION_14__ADDR_MSB 31 -#define RDMA_REGION_14__ADDR_LSB 13 -#define RDMA_REGION_14__ADDR_MASK 0xffffe000 -#define RDMA_REGION_14__ADDR_GET(x) (((x) & RDMA_REGION_14__ADDR_MASK) >> RDMA_REGION_14__ADDR_LSB) -#define RDMA_REGION_14__ADDR_SET(x) (((x) << RDMA_REGION_14__ADDR_LSB) & RDMA_REGION_14__ADDR_MASK) -#define RDMA_REGION_14__LENGTH_MSB 12 -#define RDMA_REGION_14__LENGTH_LSB 2 -#define RDMA_REGION_14__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_14__LENGTH_GET(x) (((x) & RDMA_REGION_14__LENGTH_MASK) >> RDMA_REGION_14__LENGTH_LSB) -#define RDMA_REGION_14__LENGTH_SET(x) (((x) << RDMA_REGION_14__LENGTH_LSB) & RDMA_REGION_14__LENGTH_MASK) -#define RDMA_REGION_14__INDI_MSB 1 -#define RDMA_REGION_14__INDI_LSB 1 -#define RDMA_REGION_14__INDI_MASK 0x00000002 -#define RDMA_REGION_14__INDI_GET(x) (((x) & RDMA_REGION_14__INDI_MASK) >> RDMA_REGION_14__INDI_LSB) -#define RDMA_REGION_14__INDI_SET(x) (((x) << RDMA_REGION_14__INDI_LSB) & RDMA_REGION_14__INDI_MASK) -#define RDMA_REGION_14__NEXT_MSB 0 -#define RDMA_REGION_14__NEXT_LSB 0 -#define RDMA_REGION_14__NEXT_MASK 0x00000001 -#define RDMA_REGION_14__NEXT_GET(x) (((x) & RDMA_REGION_14__NEXT_MASK) >> RDMA_REGION_14__NEXT_LSB) -#define RDMA_REGION_14__NEXT_SET(x) (((x) << RDMA_REGION_14__NEXT_LSB) & RDMA_REGION_14__NEXT_MASK) - -#define RDMA_REGION_15__ADDRESS 0x0000005c -#define RDMA_REGION_15__OFFSET 0x0000005c -#define RDMA_REGION_15__ADDR_MSB 31 -#define RDMA_REGION_15__ADDR_LSB 13 -#define RDMA_REGION_15__ADDR_MASK 0xffffe000 -#define RDMA_REGION_15__ADDR_GET(x) (((x) & RDMA_REGION_15__ADDR_MASK) >> RDMA_REGION_15__ADDR_LSB) -#define RDMA_REGION_15__ADDR_SET(x) (((x) << RDMA_REGION_15__ADDR_LSB) & RDMA_REGION_15__ADDR_MASK) -#define RDMA_REGION_15__LENGTH_MSB 12 -#define RDMA_REGION_15__LENGTH_LSB 2 -#define RDMA_REGION_15__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_15__LENGTH_GET(x) (((x) & RDMA_REGION_15__LENGTH_MASK) >> RDMA_REGION_15__LENGTH_LSB) -#define RDMA_REGION_15__LENGTH_SET(x) (((x) << RDMA_REGION_15__LENGTH_LSB) & RDMA_REGION_15__LENGTH_MASK) -#define RDMA_REGION_15__INDI_MSB 1 -#define RDMA_REGION_15__INDI_LSB 1 -#define RDMA_REGION_15__INDI_MASK 0x00000002 -#define RDMA_REGION_15__INDI_GET(x) (((x) & RDMA_REGION_15__INDI_MASK) >> RDMA_REGION_15__INDI_LSB) -#define RDMA_REGION_15__INDI_SET(x) (((x) << RDMA_REGION_15__INDI_LSB) & RDMA_REGION_15__INDI_MASK) -#define RDMA_REGION_15__NEXT_MSB 0 -#define RDMA_REGION_15__NEXT_LSB 0 -#define RDMA_REGION_15__NEXT_MASK 0x00000001 -#define RDMA_REGION_15__NEXT_GET(x) (((x) & RDMA_REGION_15__NEXT_MASK) >> RDMA_REGION_15__NEXT_LSB) -#define RDMA_REGION_15__NEXT_SET(x) (((x) << RDMA_REGION_15__NEXT_LSB) & RDMA_REGION_15__NEXT_MASK) - -#define DMA_STATUS_ADDRESS 0x00000060 -#define DMA_STATUS_OFFSET 0x00000060 -#define DMA_STATUS_ERROR_CODE_MSB 14 -#define DMA_STATUS_ERROR_CODE_LSB 4 -#define DMA_STATUS_ERROR_CODE_MASK 0x00007ff0 -#define DMA_STATUS_ERROR_CODE_GET(x) (((x) & DMA_STATUS_ERROR_CODE_MASK) >> DMA_STATUS_ERROR_CODE_LSB) -#define DMA_STATUS_ERROR_CODE_SET(x) (((x) << DMA_STATUS_ERROR_CODE_LSB) & DMA_STATUS_ERROR_CODE_MASK) -#define DMA_STATUS_ERROR_MSB 3 -#define DMA_STATUS_ERROR_LSB 3 -#define DMA_STATUS_ERROR_MASK 0x00000008 -#define DMA_STATUS_ERROR_GET(x) (((x) & DMA_STATUS_ERROR_MASK) >> DMA_STATUS_ERROR_LSB) -#define DMA_STATUS_ERROR_SET(x) (((x) << DMA_STATUS_ERROR_LSB) & DMA_STATUS_ERROR_MASK) -#define DMA_STATUS_DONE_MSB 2 -#define DMA_STATUS_DONE_LSB 2 -#define DMA_STATUS_DONE_MASK 0x00000004 -#define DMA_STATUS_DONE_GET(x) (((x) & DMA_STATUS_DONE_MASK) >> DMA_STATUS_DONE_LSB) -#define DMA_STATUS_DONE_SET(x) (((x) << DMA_STATUS_DONE_LSB) & DMA_STATUS_DONE_MASK) -#define DMA_STATUS_STOPPED_MSB 1 -#define DMA_STATUS_STOPPED_LSB 1 -#define DMA_STATUS_STOPPED_MASK 0x00000002 -#define DMA_STATUS_STOPPED_GET(x) (((x) & DMA_STATUS_STOPPED_MASK) >> DMA_STATUS_STOPPED_LSB) -#define DMA_STATUS_STOPPED_SET(x) (((x) << DMA_STATUS_STOPPED_LSB) & DMA_STATUS_STOPPED_MASK) -#define DMA_STATUS_RUNNING_MSB 0 -#define DMA_STATUS_RUNNING_LSB 0 -#define DMA_STATUS_RUNNING_MASK 0x00000001 -#define DMA_STATUS_RUNNING_GET(x) (((x) & DMA_STATUS_RUNNING_MASK) >> DMA_STATUS_RUNNING_LSB) -#define DMA_STATUS_RUNNING_SET(x) (((x) << DMA_STATUS_RUNNING_LSB) & DMA_STATUS_RUNNING_MASK) - -#define DMA_INT_EN_ADDRESS 0x00000064 -#define DMA_INT_EN_OFFSET 0x00000064 -#define DMA_INT_EN_ERROR_ENA_MSB 3 -#define DMA_INT_EN_ERROR_ENA_LSB 3 -#define DMA_INT_EN_ERROR_ENA_MASK 0x00000008 -#define DMA_INT_EN_ERROR_ENA_GET(x) (((x) & DMA_INT_EN_ERROR_ENA_MASK) >> DMA_INT_EN_ERROR_ENA_LSB) -#define DMA_INT_EN_ERROR_ENA_SET(x) (((x) << DMA_INT_EN_ERROR_ENA_LSB) & DMA_INT_EN_ERROR_ENA_MASK) -#define DMA_INT_EN_DONE_ENA_MSB 2 -#define DMA_INT_EN_DONE_ENA_LSB 2 -#define DMA_INT_EN_DONE_ENA_MASK 0x00000004 -#define DMA_INT_EN_DONE_ENA_GET(x) (((x) & DMA_INT_EN_DONE_ENA_MASK) >> DMA_INT_EN_DONE_ENA_LSB) -#define DMA_INT_EN_DONE_ENA_SET(x) (((x) << DMA_INT_EN_DONE_ENA_LSB) & DMA_INT_EN_DONE_ENA_MASK) -#define DMA_INT_EN_STOPPED_ENA_MSB 1 -#define DMA_INT_EN_STOPPED_ENA_LSB 1 -#define DMA_INT_EN_STOPPED_ENA_MASK 0x00000002 -#define DMA_INT_EN_STOPPED_ENA_GET(x) (((x) & DMA_INT_EN_STOPPED_ENA_MASK) >> DMA_INT_EN_STOPPED_ENA_LSB) -#define DMA_INT_EN_STOPPED_ENA_SET(x) (((x) << DMA_INT_EN_STOPPED_ENA_LSB) & DMA_INT_EN_STOPPED_ENA_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct rdma_reg_reg_s { - volatile unsigned int dma_config; - volatile unsigned int dma_control; - volatile unsigned int dma_src; - volatile unsigned int dma_dest; - volatile unsigned int dma_length; - volatile unsigned int vmc_base; - volatile unsigned int indirect_reg; - volatile unsigned int indirect_return; - volatile unsigned int rdma_region_0_; - volatile unsigned int rdma_region_1_; - volatile unsigned int rdma_region_2_; - volatile unsigned int rdma_region_3_; - volatile unsigned int rdma_region_4_; - volatile unsigned int rdma_region_5_; - volatile unsigned int rdma_region_6_; - volatile unsigned int rdma_region_7_; - volatile unsigned int rdma_region_8_; - volatile unsigned int rdma_region_9_; - volatile unsigned int rdma_region_10_; - volatile unsigned int rdma_region_11_; - volatile unsigned int rdma_region_12_; - volatile unsigned int rdma_region_13_; - volatile unsigned int rdma_region_14_; - volatile unsigned int rdma_region_15_; - volatile unsigned int dma_status; - volatile unsigned int dma_int_en; -} rdma_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _RDMA_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/rtc_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/rtc_reg.h deleted file mode 100644 index 7067fcea3c9c..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/rtc_reg.h +++ /dev/null @@ -1,975 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "rtc_wlan_reg.h" - - -#ifndef BT_HEADERS - -#define RESET_CONTROL_ADDRESS WLAN_RESET_CONTROL_ADDRESS -#define RESET_CONTROL_OFFSET WLAN_RESET_CONTROL_OFFSET -#define RESET_CONTROL_DEBUG_UART_RST_MSB WLAN_RESET_CONTROL_DEBUG_UART_RST_MSB -#define RESET_CONTROL_DEBUG_UART_RST_LSB WLAN_RESET_CONTROL_DEBUG_UART_RST_LSB -#define RESET_CONTROL_DEBUG_UART_RST_MASK WLAN_RESET_CONTROL_DEBUG_UART_RST_MASK -#define RESET_CONTROL_DEBUG_UART_RST_GET(x) WLAN_RESET_CONTROL_DEBUG_UART_RST_GET(x) -#define RESET_CONTROL_DEBUG_UART_RST_SET(x) WLAN_RESET_CONTROL_DEBUG_UART_RST_SET(x) -#define RESET_CONTROL_BB_COLD_RST_MSB WLAN_RESET_CONTROL_BB_COLD_RST_MSB -#define RESET_CONTROL_BB_COLD_RST_LSB WLAN_RESET_CONTROL_BB_COLD_RST_LSB -#define RESET_CONTROL_BB_COLD_RST_MASK WLAN_RESET_CONTROL_BB_COLD_RST_MASK -#define RESET_CONTROL_BB_COLD_RST_GET(x) WLAN_RESET_CONTROL_BB_COLD_RST_GET(x) -#define RESET_CONTROL_BB_COLD_RST_SET(x) WLAN_RESET_CONTROL_BB_COLD_RST_SET(x) -#define RESET_CONTROL_BB_WARM_RST_MSB WLAN_RESET_CONTROL_BB_WARM_RST_MSB -#define RESET_CONTROL_BB_WARM_RST_LSB WLAN_RESET_CONTROL_BB_WARM_RST_LSB -#define RESET_CONTROL_BB_WARM_RST_MASK WLAN_RESET_CONTROL_BB_WARM_RST_MASK -#define RESET_CONTROL_BB_WARM_RST_GET(x) WLAN_RESET_CONTROL_BB_WARM_RST_GET(x) -#define RESET_CONTROL_BB_WARM_RST_SET(x) WLAN_RESET_CONTROL_BB_WARM_RST_SET(x) -#define RESET_CONTROL_CPU_INIT_RESET_MSB WLAN_RESET_CONTROL_CPU_INIT_RESET_MSB -#define RESET_CONTROL_CPU_INIT_RESET_LSB WLAN_RESET_CONTROL_CPU_INIT_RESET_LSB -#define RESET_CONTROL_CPU_INIT_RESET_MASK WLAN_RESET_CONTROL_CPU_INIT_RESET_MASK -#define RESET_CONTROL_CPU_INIT_RESET_GET(x) WLAN_RESET_CONTROL_CPU_INIT_RESET_GET(x) -#define RESET_CONTROL_CPU_INIT_RESET_SET(x) WLAN_RESET_CONTROL_CPU_INIT_RESET_SET(x) -#define RESET_CONTROL_VMC_REMAP_RESET_MSB WLAN_RESET_CONTROL_VMC_REMAP_RESET_MSB -#define RESET_CONTROL_VMC_REMAP_RESET_LSB WLAN_RESET_CONTROL_VMC_REMAP_RESET_LSB -#define RESET_CONTROL_VMC_REMAP_RESET_MASK WLAN_RESET_CONTROL_VMC_REMAP_RESET_MASK -#define RESET_CONTROL_VMC_REMAP_RESET_GET(x) WLAN_RESET_CONTROL_VMC_REMAP_RESET_GET(x) -#define RESET_CONTROL_VMC_REMAP_RESET_SET(x) WLAN_RESET_CONTROL_VMC_REMAP_RESET_SET(x) -#define RESET_CONTROL_RST_OUT_MSB WLAN_RESET_CONTROL_RST_OUT_MSB -#define RESET_CONTROL_RST_OUT_LSB WLAN_RESET_CONTROL_RST_OUT_LSB -#define RESET_CONTROL_RST_OUT_MASK WLAN_RESET_CONTROL_RST_OUT_MASK -#define RESET_CONTROL_RST_OUT_GET(x) WLAN_RESET_CONTROL_RST_OUT_GET(x) -#define RESET_CONTROL_RST_OUT_SET(x) WLAN_RESET_CONTROL_RST_OUT_SET(x) -#define RESET_CONTROL_COLD_RST_MSB WLAN_RESET_CONTROL_COLD_RST_MSB -#define RESET_CONTROL_COLD_RST_LSB WLAN_RESET_CONTROL_COLD_RST_LSB -#define RESET_CONTROL_COLD_RST_MASK WLAN_RESET_CONTROL_COLD_RST_MASK -#define RESET_CONTROL_COLD_RST_GET(x) WLAN_RESET_CONTROL_COLD_RST_GET(x) -#define RESET_CONTROL_COLD_RST_SET(x) WLAN_RESET_CONTROL_COLD_RST_SET(x) -#define RESET_CONTROL_WARM_RST_MSB WLAN_RESET_CONTROL_WARM_RST_MSB -#define RESET_CONTROL_WARM_RST_LSB WLAN_RESET_CONTROL_WARM_RST_LSB -#define RESET_CONTROL_WARM_RST_MASK WLAN_RESET_CONTROL_WARM_RST_MASK -#define RESET_CONTROL_WARM_RST_GET(x) WLAN_RESET_CONTROL_WARM_RST_GET(x) -#define RESET_CONTROL_WARM_RST_SET(x) WLAN_RESET_CONTROL_WARM_RST_SET(x) -#define RESET_CONTROL_CPU_WARM_RST_MSB WLAN_RESET_CONTROL_CPU_WARM_RST_MSB -#define RESET_CONTROL_CPU_WARM_RST_LSB WLAN_RESET_CONTROL_CPU_WARM_RST_LSB -#define RESET_CONTROL_CPU_WARM_RST_MASK WLAN_RESET_CONTROL_CPU_WARM_RST_MASK -#define RESET_CONTROL_CPU_WARM_RST_GET(x) WLAN_RESET_CONTROL_CPU_WARM_RST_GET(x) -#define RESET_CONTROL_CPU_WARM_RST_SET(x) WLAN_RESET_CONTROL_CPU_WARM_RST_SET(x) -#define RESET_CONTROL_MAC_COLD_RST_MSB WLAN_RESET_CONTROL_MAC_COLD_RST_MSB -#define RESET_CONTROL_MAC_COLD_RST_LSB WLAN_RESET_CONTROL_MAC_COLD_RST_LSB -#define RESET_CONTROL_MAC_COLD_RST_MASK WLAN_RESET_CONTROL_MAC_COLD_RST_MASK -#define RESET_CONTROL_MAC_COLD_RST_GET(x) WLAN_RESET_CONTROL_MAC_COLD_RST_GET(x) -#define RESET_CONTROL_MAC_COLD_RST_SET(x) WLAN_RESET_CONTROL_MAC_COLD_RST_SET(x) -#define RESET_CONTROL_MAC_WARM_RST_MSB WLAN_RESET_CONTROL_MAC_WARM_RST_MSB -#define RESET_CONTROL_MAC_WARM_RST_LSB WLAN_RESET_CONTROL_MAC_WARM_RST_LSB -#define RESET_CONTROL_MAC_WARM_RST_MASK WLAN_RESET_CONTROL_MAC_WARM_RST_MASK -#define RESET_CONTROL_MAC_WARM_RST_GET(x) WLAN_RESET_CONTROL_MAC_WARM_RST_GET(x) -#define RESET_CONTROL_MAC_WARM_RST_SET(x) WLAN_RESET_CONTROL_MAC_WARM_RST_SET(x) -#define RESET_CONTROL_MBOX_RST_MSB WLAN_RESET_CONTROL_MBOX_RST_MSB -#define RESET_CONTROL_MBOX_RST_LSB WLAN_RESET_CONTROL_MBOX_RST_LSB -#define RESET_CONTROL_MBOX_RST_MASK WLAN_RESET_CONTROL_MBOX_RST_MASK -#define RESET_CONTROL_MBOX_RST_GET(x) WLAN_RESET_CONTROL_MBOX_RST_GET(x) -#define RESET_CONTROL_MBOX_RST_SET(x) WLAN_RESET_CONTROL_MBOX_RST_SET(x) -#define RESET_CONTROL_UART_RST_MSB WLAN_RESET_CONTROL_UART_RST_MSB -#define RESET_CONTROL_UART_RST_LSB WLAN_RESET_CONTROL_UART_RST_LSB -#define RESET_CONTROL_UART_RST_MASK WLAN_RESET_CONTROL_UART_RST_MASK -#define RESET_CONTROL_UART_RST_GET(x) WLAN_RESET_CONTROL_UART_RST_GET(x) -#define RESET_CONTROL_UART_RST_SET(x) WLAN_RESET_CONTROL_UART_RST_SET(x) -#define RESET_CONTROL_SI0_RST_MSB WLAN_RESET_CONTROL_SI0_RST_MSB -#define RESET_CONTROL_SI0_RST_LSB WLAN_RESET_CONTROL_SI0_RST_LSB -#define RESET_CONTROL_SI0_RST_MASK WLAN_RESET_CONTROL_SI0_RST_MASK -#define RESET_CONTROL_SI0_RST_GET(x) WLAN_RESET_CONTROL_SI0_RST_GET(x) -#define RESET_CONTROL_SI0_RST_SET(x) WLAN_RESET_CONTROL_SI0_RST_SET(x) -#define XTAL_CONTROL_ADDRESS WLAN_XTAL_CONTROL_ADDRESS -#define XTAL_CONTROL_OFFSET WLAN_XTAL_CONTROL_OFFSET -#define XTAL_CONTROL_TCXO_MSB WLAN_XTAL_CONTROL_TCXO_MSB -#define XTAL_CONTROL_TCXO_LSB WLAN_XTAL_CONTROL_TCXO_LSB -#define XTAL_CONTROL_TCXO_MASK WLAN_XTAL_CONTROL_TCXO_MASK -#define XTAL_CONTROL_TCXO_GET(x) WLAN_XTAL_CONTROL_TCXO_GET(x) -#define XTAL_CONTROL_TCXO_SET(x) WLAN_XTAL_CONTROL_TCXO_SET(x) -#define TCXO_DETECT_ADDRESS WLAN_TCXO_DETECT_ADDRESS -#define TCXO_DETECT_OFFSET WLAN_TCXO_DETECT_OFFSET -#define TCXO_DETECT_PRESENT_MSB WLAN_TCXO_DETECT_PRESENT_MSB -#define TCXO_DETECT_PRESENT_LSB WLAN_TCXO_DETECT_PRESENT_LSB -#define TCXO_DETECT_PRESENT_MASK WLAN_TCXO_DETECT_PRESENT_MASK -#define TCXO_DETECT_PRESENT_GET(x) WLAN_TCXO_DETECT_PRESENT_GET(x) -#define TCXO_DETECT_PRESENT_SET(x) WLAN_TCXO_DETECT_PRESENT_SET(x) -#define XTAL_TEST_ADDRESS WLAN_XTAL_TEST_ADDRESS -#define XTAL_TEST_OFFSET WLAN_XTAL_TEST_OFFSET -#define XTAL_TEST_NOTCXODET_MSB WLAN_XTAL_TEST_NOTCXODET_MSB -#define XTAL_TEST_NOTCXODET_LSB WLAN_XTAL_TEST_NOTCXODET_LSB -#define XTAL_TEST_NOTCXODET_MASK WLAN_XTAL_TEST_NOTCXODET_MASK -#define XTAL_TEST_NOTCXODET_GET(x) WLAN_XTAL_TEST_NOTCXODET_GET(x) -#define XTAL_TEST_NOTCXODET_SET(x) WLAN_XTAL_TEST_NOTCXODET_SET(x) -#define QUADRATURE_ADDRESS WLAN_QUADRATURE_ADDRESS -#define QUADRATURE_OFFSET WLAN_QUADRATURE_OFFSET -#define QUADRATURE_ADC_MSB WLAN_QUADRATURE_ADC_MSB -#define QUADRATURE_ADC_LSB WLAN_QUADRATURE_ADC_LSB -#define QUADRATURE_ADC_MASK WLAN_QUADRATURE_ADC_MASK -#define QUADRATURE_ADC_GET(x) WLAN_QUADRATURE_ADC_GET(x) -#define QUADRATURE_ADC_SET(x) WLAN_QUADRATURE_ADC_SET(x) -#define QUADRATURE_SEL_MSB WLAN_QUADRATURE_SEL_MSB -#define QUADRATURE_SEL_LSB WLAN_QUADRATURE_SEL_LSB -#define QUADRATURE_SEL_MASK WLAN_QUADRATURE_SEL_MASK -#define QUADRATURE_SEL_GET(x) WLAN_QUADRATURE_SEL_GET(x) -#define QUADRATURE_SEL_SET(x) WLAN_QUADRATURE_SEL_SET(x) -#define QUADRATURE_DAC_MSB WLAN_QUADRATURE_DAC_MSB -#define QUADRATURE_DAC_LSB WLAN_QUADRATURE_DAC_LSB -#define QUADRATURE_DAC_MASK WLAN_QUADRATURE_DAC_MASK -#define QUADRATURE_DAC_GET(x) WLAN_QUADRATURE_DAC_GET(x) -#define QUADRATURE_DAC_SET(x) WLAN_QUADRATURE_DAC_SET(x) -#define PLL_CONTROL_ADDRESS WLAN_PLL_CONTROL_ADDRESS -#define PLL_CONTROL_OFFSET WLAN_PLL_CONTROL_OFFSET -#define PLL_CONTROL_DIG_TEST_CLK_MSB WLAN_PLL_CONTROL_DIG_TEST_CLK_MSB -#define PLL_CONTROL_DIG_TEST_CLK_LSB WLAN_PLL_CONTROL_DIG_TEST_CLK_LSB -#define PLL_CONTROL_DIG_TEST_CLK_MASK WLAN_PLL_CONTROL_DIG_TEST_CLK_MASK -#define PLL_CONTROL_DIG_TEST_CLK_GET(x) WLAN_PLL_CONTROL_DIG_TEST_CLK_GET(x) -#define PLL_CONTROL_DIG_TEST_CLK_SET(x) WLAN_PLL_CONTROL_DIG_TEST_CLK_SET(x) -#define PLL_CONTROL_MAC_OVERRIDE_MSB WLAN_PLL_CONTROL_MAC_OVERRIDE_MSB -#define PLL_CONTROL_MAC_OVERRIDE_LSB WLAN_PLL_CONTROL_MAC_OVERRIDE_LSB -#define PLL_CONTROL_MAC_OVERRIDE_MASK WLAN_PLL_CONTROL_MAC_OVERRIDE_MASK -#define PLL_CONTROL_MAC_OVERRIDE_GET(x) WLAN_PLL_CONTROL_MAC_OVERRIDE_GET(x) -#define PLL_CONTROL_MAC_OVERRIDE_SET(x) WLAN_PLL_CONTROL_MAC_OVERRIDE_SET(x) -#define PLL_CONTROL_NOPWD_MSB WLAN_PLL_CONTROL_NOPWD_MSB -#define PLL_CONTROL_NOPWD_LSB WLAN_PLL_CONTROL_NOPWD_LSB -#define PLL_CONTROL_NOPWD_MASK WLAN_PLL_CONTROL_NOPWD_MASK -#define PLL_CONTROL_NOPWD_GET(x) WLAN_PLL_CONTROL_NOPWD_GET(x) -#define PLL_CONTROL_NOPWD_SET(x) WLAN_PLL_CONTROL_NOPWD_SET(x) -#define PLL_CONTROL_UPDATING_MSB WLAN_PLL_CONTROL_UPDATING_MSB -#define PLL_CONTROL_UPDATING_LSB WLAN_PLL_CONTROL_UPDATING_LSB -#define PLL_CONTROL_UPDATING_MASK WLAN_PLL_CONTROL_UPDATING_MASK -#define PLL_CONTROL_UPDATING_GET(x) WLAN_PLL_CONTROL_UPDATING_GET(x) -#define PLL_CONTROL_UPDATING_SET(x) WLAN_PLL_CONTROL_UPDATING_SET(x) -#define PLL_CONTROL_BYPASS_MSB WLAN_PLL_CONTROL_BYPASS_MSB -#define PLL_CONTROL_BYPASS_LSB WLAN_PLL_CONTROL_BYPASS_LSB -#define PLL_CONTROL_BYPASS_MASK WLAN_PLL_CONTROL_BYPASS_MASK -#define PLL_CONTROL_BYPASS_GET(x) WLAN_PLL_CONTROL_BYPASS_GET(x) -#define PLL_CONTROL_BYPASS_SET(x) WLAN_PLL_CONTROL_BYPASS_SET(x) -#define PLL_CONTROL_REFDIV_MSB WLAN_PLL_CONTROL_REFDIV_MSB -#define PLL_CONTROL_REFDIV_LSB WLAN_PLL_CONTROL_REFDIV_LSB -#define PLL_CONTROL_REFDIV_MASK WLAN_PLL_CONTROL_REFDIV_MASK -#define PLL_CONTROL_REFDIV_GET(x) WLAN_PLL_CONTROL_REFDIV_GET(x) -#define PLL_CONTROL_REFDIV_SET(x) WLAN_PLL_CONTROL_REFDIV_SET(x) -#define PLL_CONTROL_DIV_MSB WLAN_PLL_CONTROL_DIV_MSB -#define PLL_CONTROL_DIV_LSB WLAN_PLL_CONTROL_DIV_LSB -#define PLL_CONTROL_DIV_MASK WLAN_PLL_CONTROL_DIV_MASK -#define PLL_CONTROL_DIV_GET(x) WLAN_PLL_CONTROL_DIV_GET(x) -#define PLL_CONTROL_DIV_SET(x) WLAN_PLL_CONTROL_DIV_SET(x) -#define PLL_SETTLE_ADDRESS WLAN_PLL_SETTLE_ADDRESS -#define PLL_SETTLE_OFFSET WLAN_PLL_SETTLE_OFFSET -#define PLL_SETTLE_TIME_MSB WLAN_PLL_SETTLE_TIME_MSB -#define PLL_SETTLE_TIME_LSB WLAN_PLL_SETTLE_TIME_LSB -#define PLL_SETTLE_TIME_MASK WLAN_PLL_SETTLE_TIME_MASK -#define PLL_SETTLE_TIME_GET(x) WLAN_PLL_SETTLE_TIME_GET(x) -#define PLL_SETTLE_TIME_SET(x) WLAN_PLL_SETTLE_TIME_SET(x) -#define XTAL_SETTLE_ADDRESS WLAN_XTAL_SETTLE_ADDRESS -#define XTAL_SETTLE_OFFSET WLAN_XTAL_SETTLE_OFFSET -#define XTAL_SETTLE_TIME_MSB WLAN_XTAL_SETTLE_TIME_MSB -#define XTAL_SETTLE_TIME_LSB WLAN_XTAL_SETTLE_TIME_LSB -#define XTAL_SETTLE_TIME_MASK WLAN_XTAL_SETTLE_TIME_MASK -#define XTAL_SETTLE_TIME_GET(x) WLAN_XTAL_SETTLE_TIME_GET(x) -#define XTAL_SETTLE_TIME_SET(x) WLAN_XTAL_SETTLE_TIME_SET(x) -#define CPU_CLOCK_ADDRESS WLAN_CPU_CLOCK_ADDRESS -#define CPU_CLOCK_OFFSET WLAN_CPU_CLOCK_OFFSET -#define CPU_CLOCK_STANDARD_MSB WLAN_CPU_CLOCK_STANDARD_MSB -#define CPU_CLOCK_STANDARD_LSB WLAN_CPU_CLOCK_STANDARD_LSB -#define CPU_CLOCK_STANDARD_MASK WLAN_CPU_CLOCK_STANDARD_MASK -#define CPU_CLOCK_STANDARD_GET(x) WLAN_CPU_CLOCK_STANDARD_GET(x) -#define CPU_CLOCK_STANDARD_SET(x) WLAN_CPU_CLOCK_STANDARD_SET(x) -#define CLOCK_OUT_ADDRESS WLAN_CLOCK_OUT_ADDRESS -#define CLOCK_OUT_OFFSET WLAN_CLOCK_OUT_OFFSET -#define CLOCK_OUT_SELECT_MSB WLAN_CLOCK_OUT_SELECT_MSB -#define CLOCK_OUT_SELECT_LSB WLAN_CLOCK_OUT_SELECT_LSB -#define CLOCK_OUT_SELECT_MASK WLAN_CLOCK_OUT_SELECT_MASK -#define CLOCK_OUT_SELECT_GET(x) WLAN_CLOCK_OUT_SELECT_GET(x) -#define CLOCK_OUT_SELECT_SET(x) WLAN_CLOCK_OUT_SELECT_SET(x) -#define CLOCK_CONTROL_ADDRESS WLAN_CLOCK_CONTROL_ADDRESS -#define CLOCK_CONTROL_OFFSET WLAN_CLOCK_CONTROL_OFFSET -#define CLOCK_CONTROL_LF_CLK32_MSB WLAN_CLOCK_CONTROL_LF_CLK32_MSB -#define CLOCK_CONTROL_LF_CLK32_LSB WLAN_CLOCK_CONTROL_LF_CLK32_LSB -#define CLOCK_CONTROL_LF_CLK32_MASK WLAN_CLOCK_CONTROL_LF_CLK32_MASK -#define CLOCK_CONTROL_LF_CLK32_GET(x) WLAN_CLOCK_CONTROL_LF_CLK32_GET(x) -#define CLOCK_CONTROL_LF_CLK32_SET(x) WLAN_CLOCK_CONTROL_LF_CLK32_SET(x) -#define CLOCK_CONTROL_SI0_CLK_MSB WLAN_CLOCK_CONTROL_SI0_CLK_MSB -#define CLOCK_CONTROL_SI0_CLK_LSB WLAN_CLOCK_CONTROL_SI0_CLK_LSB -#define CLOCK_CONTROL_SI0_CLK_MASK WLAN_CLOCK_CONTROL_SI0_CLK_MASK -#define CLOCK_CONTROL_SI0_CLK_GET(x) WLAN_CLOCK_CONTROL_SI0_CLK_GET(x) -#define CLOCK_CONTROL_SI0_CLK_SET(x) WLAN_CLOCK_CONTROL_SI0_CLK_SET(x) -#define BIAS_OVERRIDE_ADDRESS WLAN_BIAS_OVERRIDE_ADDRESS -#define BIAS_OVERRIDE_OFFSET WLAN_BIAS_OVERRIDE_OFFSET -#define BIAS_OVERRIDE_ON_MSB WLAN_BIAS_OVERRIDE_ON_MSB -#define BIAS_OVERRIDE_ON_LSB WLAN_BIAS_OVERRIDE_ON_LSB -#define BIAS_OVERRIDE_ON_MASK WLAN_BIAS_OVERRIDE_ON_MASK -#define BIAS_OVERRIDE_ON_GET(x) WLAN_BIAS_OVERRIDE_ON_GET(x) -#define BIAS_OVERRIDE_ON_SET(x) WLAN_BIAS_OVERRIDE_ON_SET(x) -#define WDT_CONTROL_ADDRESS WLAN_WDT_CONTROL_ADDRESS -#define WDT_CONTROL_OFFSET WLAN_WDT_CONTROL_OFFSET -#define WDT_CONTROL_ACTION_MSB WLAN_WDT_CONTROL_ACTION_MSB -#define WDT_CONTROL_ACTION_LSB WLAN_WDT_CONTROL_ACTION_LSB -#define WDT_CONTROL_ACTION_MASK WLAN_WDT_CONTROL_ACTION_MASK -#define WDT_CONTROL_ACTION_GET(x) WLAN_WDT_CONTROL_ACTION_GET(x) -#define WDT_CONTROL_ACTION_SET(x) WLAN_WDT_CONTROL_ACTION_SET(x) -#define WDT_STATUS_ADDRESS WLAN_WDT_STATUS_ADDRESS -#define WDT_STATUS_OFFSET WLAN_WDT_STATUS_OFFSET -#define WDT_STATUS_INTERRUPT_MSB WLAN_WDT_STATUS_INTERRUPT_MSB -#define WDT_STATUS_INTERRUPT_LSB WLAN_WDT_STATUS_INTERRUPT_LSB -#define WDT_STATUS_INTERRUPT_MASK WLAN_WDT_STATUS_INTERRUPT_MASK -#define WDT_STATUS_INTERRUPT_GET(x) WLAN_WDT_STATUS_INTERRUPT_GET(x) -#define WDT_STATUS_INTERRUPT_SET(x) WLAN_WDT_STATUS_INTERRUPT_SET(x) -#define WDT_ADDRESS WLAN_WDT_ADDRESS -#define WDT_OFFSET WLAN_WDT_OFFSET -#define WDT_TARGET_MSB WLAN_WDT_TARGET_MSB -#define WDT_TARGET_LSB WLAN_WDT_TARGET_LSB -#define WDT_TARGET_MASK WLAN_WDT_TARGET_MASK -#define WDT_TARGET_GET(x) WLAN_WDT_TARGET_GET(x) -#define WDT_TARGET_SET(x) WLAN_WDT_TARGET_SET(x) -#define WDT_COUNT_ADDRESS WLAN_WDT_COUNT_ADDRESS -#define WDT_COUNT_OFFSET WLAN_WDT_COUNT_OFFSET -#define WDT_COUNT_VALUE_MSB WLAN_WDT_COUNT_VALUE_MSB -#define WDT_COUNT_VALUE_LSB WLAN_WDT_COUNT_VALUE_LSB -#define WDT_COUNT_VALUE_MASK WLAN_WDT_COUNT_VALUE_MASK -#define WDT_COUNT_VALUE_GET(x) WLAN_WDT_COUNT_VALUE_GET(x) -#define WDT_COUNT_VALUE_SET(x) WLAN_WDT_COUNT_VALUE_SET(x) -#define WDT_RESET_ADDRESS WLAN_WDT_RESET_ADDRESS -#define WDT_RESET_OFFSET WLAN_WDT_RESET_OFFSET -#define WDT_RESET_VALUE_MSB WLAN_WDT_RESET_VALUE_MSB -#define WDT_RESET_VALUE_LSB WLAN_WDT_RESET_VALUE_LSB -#define WDT_RESET_VALUE_MASK WLAN_WDT_RESET_VALUE_MASK -#define WDT_RESET_VALUE_GET(x) WLAN_WDT_RESET_VALUE_GET(x) -#define WDT_RESET_VALUE_SET(x) WLAN_WDT_RESET_VALUE_SET(x) -#define INT_STATUS_ADDRESS WLAN_INT_STATUS_ADDRESS -#define INT_STATUS_OFFSET WLAN_INT_STATUS_OFFSET -#define INT_STATUS_HCI_UART_MSB WLAN_INT_STATUS_HCI_UART_MSB -#define INT_STATUS_HCI_UART_LSB WLAN_INT_STATUS_HCI_UART_LSB -#define INT_STATUS_HCI_UART_MASK WLAN_INT_STATUS_HCI_UART_MASK -#define INT_STATUS_HCI_UART_GET(x) WLAN_INT_STATUS_HCI_UART_GET(x) -#define INT_STATUS_HCI_UART_SET(x) WLAN_INT_STATUS_HCI_UART_SET(x) -#define INT_STATUS_THERM_MSB WLAN_INT_STATUS_THERM_MSB -#define INT_STATUS_THERM_LSB WLAN_INT_STATUS_THERM_LSB -#define INT_STATUS_THERM_MASK WLAN_INT_STATUS_THERM_MASK -#define INT_STATUS_THERM_GET(x) WLAN_INT_STATUS_THERM_GET(x) -#define INT_STATUS_THERM_SET(x) WLAN_INT_STATUS_THERM_SET(x) -#define INT_STATUS_EFUSE_OVERWRITE_MSB WLAN_INT_STATUS_EFUSE_OVERWRITE_MSB -#define INT_STATUS_EFUSE_OVERWRITE_LSB WLAN_INT_STATUS_EFUSE_OVERWRITE_LSB -#define INT_STATUS_EFUSE_OVERWRITE_MASK WLAN_INT_STATUS_EFUSE_OVERWRITE_MASK -#define INT_STATUS_EFUSE_OVERWRITE_GET(x) WLAN_INT_STATUS_EFUSE_OVERWRITE_GET(x) -#define INT_STATUS_EFUSE_OVERWRITE_SET(x) WLAN_INT_STATUS_EFUSE_OVERWRITE_SET(x) -#define INT_STATUS_UART_MBOX_MSB WLAN_INT_STATUS_UART_MBOX_MSB -#define INT_STATUS_UART_MBOX_LSB WLAN_INT_STATUS_UART_MBOX_LSB -#define INT_STATUS_UART_MBOX_MASK WLAN_INT_STATUS_UART_MBOX_MASK -#define INT_STATUS_UART_MBOX_GET(x) WLAN_INT_STATUS_UART_MBOX_GET(x) -#define INT_STATUS_UART_MBOX_SET(x) WLAN_INT_STATUS_UART_MBOX_SET(x) -#define INT_STATUS_GENERIC_MBOX_MSB WLAN_INT_STATUS_GENERIC_MBOX_MSB -#define INT_STATUS_GENERIC_MBOX_LSB WLAN_INT_STATUS_GENERIC_MBOX_LSB -#define INT_STATUS_GENERIC_MBOX_MASK WLAN_INT_STATUS_GENERIC_MBOX_MASK -#define INT_STATUS_GENERIC_MBOX_GET(x) WLAN_INT_STATUS_GENERIC_MBOX_GET(x) -#define INT_STATUS_GENERIC_MBOX_SET(x) WLAN_INT_STATUS_GENERIC_MBOX_SET(x) -#define INT_STATUS_RDMA_MSB WLAN_INT_STATUS_RDMA_MSB -#define INT_STATUS_RDMA_LSB WLAN_INT_STATUS_RDMA_LSB -#define INT_STATUS_RDMA_MASK WLAN_INT_STATUS_RDMA_MASK -#define INT_STATUS_RDMA_GET(x) WLAN_INT_STATUS_RDMA_GET(x) -#define INT_STATUS_RDMA_SET(x) WLAN_INT_STATUS_RDMA_SET(x) -#define INT_STATUS_BTCOEX_MSB WLAN_INT_STATUS_BTCOEX_MSB -#define INT_STATUS_BTCOEX_LSB WLAN_INT_STATUS_BTCOEX_LSB -#define INT_STATUS_BTCOEX_MASK WLAN_INT_STATUS_BTCOEX_MASK -#define INT_STATUS_BTCOEX_GET(x) WLAN_INT_STATUS_BTCOEX_GET(x) -#define INT_STATUS_BTCOEX_SET(x) WLAN_INT_STATUS_BTCOEX_SET(x) -#define INT_STATUS_RTC_POWER_MSB WLAN_INT_STATUS_RTC_POWER_MSB -#define INT_STATUS_RTC_POWER_LSB WLAN_INT_STATUS_RTC_POWER_LSB -#define INT_STATUS_RTC_POWER_MASK WLAN_INT_STATUS_RTC_POWER_MASK -#define INT_STATUS_RTC_POWER_GET(x) WLAN_INT_STATUS_RTC_POWER_GET(x) -#define INT_STATUS_RTC_POWER_SET(x) WLAN_INT_STATUS_RTC_POWER_SET(x) -#define INT_STATUS_MAC_MSB WLAN_INT_STATUS_MAC_MSB -#define INT_STATUS_MAC_LSB WLAN_INT_STATUS_MAC_LSB -#define INT_STATUS_MAC_MASK WLAN_INT_STATUS_MAC_MASK -#define INT_STATUS_MAC_GET(x) WLAN_INT_STATUS_MAC_GET(x) -#define INT_STATUS_MAC_SET(x) WLAN_INT_STATUS_MAC_SET(x) -#define INT_STATUS_MAILBOX_MSB WLAN_INT_STATUS_MAILBOX_MSB -#define INT_STATUS_MAILBOX_LSB WLAN_INT_STATUS_MAILBOX_LSB -#define INT_STATUS_MAILBOX_MASK WLAN_INT_STATUS_MAILBOX_MASK -#define INT_STATUS_MAILBOX_GET(x) WLAN_INT_STATUS_MAILBOX_GET(x) -#define INT_STATUS_MAILBOX_SET(x) WLAN_INT_STATUS_MAILBOX_SET(x) -#define INT_STATUS_RTC_ALARM_MSB WLAN_INT_STATUS_RTC_ALARM_MSB -#define INT_STATUS_RTC_ALARM_LSB WLAN_INT_STATUS_RTC_ALARM_LSB -#define INT_STATUS_RTC_ALARM_MASK WLAN_INT_STATUS_RTC_ALARM_MASK -#define INT_STATUS_RTC_ALARM_GET(x) WLAN_INT_STATUS_RTC_ALARM_GET(x) -#define INT_STATUS_RTC_ALARM_SET(x) WLAN_INT_STATUS_RTC_ALARM_SET(x) -#define INT_STATUS_HF_TIMER_MSB WLAN_INT_STATUS_HF_TIMER_MSB -#define INT_STATUS_HF_TIMER_LSB WLAN_INT_STATUS_HF_TIMER_LSB -#define INT_STATUS_HF_TIMER_MASK WLAN_INT_STATUS_HF_TIMER_MASK -#define INT_STATUS_HF_TIMER_GET(x) WLAN_INT_STATUS_HF_TIMER_GET(x) -#define INT_STATUS_HF_TIMER_SET(x) WLAN_INT_STATUS_HF_TIMER_SET(x) -#define INT_STATUS_LF_TIMER3_MSB WLAN_INT_STATUS_LF_TIMER3_MSB -#define INT_STATUS_LF_TIMER3_LSB WLAN_INT_STATUS_LF_TIMER3_LSB -#define INT_STATUS_LF_TIMER3_MASK WLAN_INT_STATUS_LF_TIMER3_MASK -#define INT_STATUS_LF_TIMER3_GET(x) WLAN_INT_STATUS_LF_TIMER3_GET(x) -#define INT_STATUS_LF_TIMER3_SET(x) WLAN_INT_STATUS_LF_TIMER3_SET(x) -#define INT_STATUS_LF_TIMER2_MSB WLAN_INT_STATUS_LF_TIMER2_MSB -#define INT_STATUS_LF_TIMER2_LSB WLAN_INT_STATUS_LF_TIMER2_LSB -#define INT_STATUS_LF_TIMER2_MASK WLAN_INT_STATUS_LF_TIMER2_MASK -#define INT_STATUS_LF_TIMER2_GET(x) WLAN_INT_STATUS_LF_TIMER2_GET(x) -#define INT_STATUS_LF_TIMER2_SET(x) WLAN_INT_STATUS_LF_TIMER2_SET(x) -#define INT_STATUS_LF_TIMER1_MSB WLAN_INT_STATUS_LF_TIMER1_MSB -#define INT_STATUS_LF_TIMER1_LSB WLAN_INT_STATUS_LF_TIMER1_LSB -#define INT_STATUS_LF_TIMER1_MASK WLAN_INT_STATUS_LF_TIMER1_MASK -#define INT_STATUS_LF_TIMER1_GET(x) WLAN_INT_STATUS_LF_TIMER1_GET(x) -#define INT_STATUS_LF_TIMER1_SET(x) WLAN_INT_STATUS_LF_TIMER1_SET(x) -#define INT_STATUS_LF_TIMER0_MSB WLAN_INT_STATUS_LF_TIMER0_MSB -#define INT_STATUS_LF_TIMER0_LSB WLAN_INT_STATUS_LF_TIMER0_LSB -#define INT_STATUS_LF_TIMER0_MASK WLAN_INT_STATUS_LF_TIMER0_MASK -#define INT_STATUS_LF_TIMER0_GET(x) WLAN_INT_STATUS_LF_TIMER0_GET(x) -#define INT_STATUS_LF_TIMER0_SET(x) WLAN_INT_STATUS_LF_TIMER0_SET(x) -#define INT_STATUS_KEYPAD_MSB WLAN_INT_STATUS_KEYPAD_MSB -#define INT_STATUS_KEYPAD_LSB WLAN_INT_STATUS_KEYPAD_LSB -#define INT_STATUS_KEYPAD_MASK WLAN_INT_STATUS_KEYPAD_MASK -#define INT_STATUS_KEYPAD_GET(x) WLAN_INT_STATUS_KEYPAD_GET(x) -#define INT_STATUS_KEYPAD_SET(x) WLAN_INT_STATUS_KEYPAD_SET(x) -#define INT_STATUS_SI_MSB WLAN_INT_STATUS_SI_MSB -#define INT_STATUS_SI_LSB WLAN_INT_STATUS_SI_LSB -#define INT_STATUS_SI_MASK WLAN_INT_STATUS_SI_MASK -#define INT_STATUS_SI_GET(x) WLAN_INT_STATUS_SI_GET(x) -#define INT_STATUS_SI_SET(x) WLAN_INT_STATUS_SI_SET(x) -#define INT_STATUS_GPIO_MSB WLAN_INT_STATUS_GPIO_MSB -#define INT_STATUS_GPIO_LSB WLAN_INT_STATUS_GPIO_LSB -#define INT_STATUS_GPIO_MASK WLAN_INT_STATUS_GPIO_MASK -#define INT_STATUS_GPIO_GET(x) WLAN_INT_STATUS_GPIO_GET(x) -#define INT_STATUS_GPIO_SET(x) WLAN_INT_STATUS_GPIO_SET(x) -#define INT_STATUS_UART_MSB WLAN_INT_STATUS_UART_MSB -#define INT_STATUS_UART_LSB WLAN_INT_STATUS_UART_LSB -#define INT_STATUS_UART_MASK WLAN_INT_STATUS_UART_MASK -#define INT_STATUS_UART_GET(x) WLAN_INT_STATUS_UART_GET(x) -#define INT_STATUS_UART_SET(x) WLAN_INT_STATUS_UART_SET(x) -#define INT_STATUS_ERROR_MSB WLAN_INT_STATUS_ERROR_MSB -#define INT_STATUS_ERROR_LSB WLAN_INT_STATUS_ERROR_LSB -#define INT_STATUS_ERROR_MASK WLAN_INT_STATUS_ERROR_MASK -#define INT_STATUS_ERROR_GET(x) WLAN_INT_STATUS_ERROR_GET(x) -#define INT_STATUS_ERROR_SET(x) WLAN_INT_STATUS_ERROR_SET(x) -#define INT_STATUS_WDT_INT_MSB WLAN_INT_STATUS_WDT_INT_MSB -#define INT_STATUS_WDT_INT_LSB WLAN_INT_STATUS_WDT_INT_LSB -#define INT_STATUS_WDT_INT_MASK WLAN_INT_STATUS_WDT_INT_MASK -#define INT_STATUS_WDT_INT_GET(x) WLAN_INT_STATUS_WDT_INT_GET(x) -#define INT_STATUS_WDT_INT_SET(x) WLAN_INT_STATUS_WDT_INT_SET(x) -#define LF_TIMER0_ADDRESS WLAN_LF_TIMER0_ADDRESS -#define LF_TIMER0_OFFSET WLAN_LF_TIMER0_OFFSET -#define LF_TIMER0_TARGET_MSB WLAN_LF_TIMER0_TARGET_MSB -#define LF_TIMER0_TARGET_LSB WLAN_LF_TIMER0_TARGET_LSB -#define LF_TIMER0_TARGET_MASK WLAN_LF_TIMER0_TARGET_MASK -#define LF_TIMER0_TARGET_GET(x) WLAN_LF_TIMER0_TARGET_GET(x) -#define LF_TIMER0_TARGET_SET(x) WLAN_LF_TIMER0_TARGET_SET(x) -#define LF_TIMER_COUNT0_ADDRESS WLAN_LF_TIMER_COUNT0_ADDRESS -#define LF_TIMER_COUNT0_OFFSET WLAN_LF_TIMER_COUNT0_OFFSET -#define LF_TIMER_COUNT0_VALUE_MSB WLAN_LF_TIMER_COUNT0_VALUE_MSB -#define LF_TIMER_COUNT0_VALUE_LSB WLAN_LF_TIMER_COUNT0_VALUE_LSB -#define LF_TIMER_COUNT0_VALUE_MASK WLAN_LF_TIMER_COUNT0_VALUE_MASK -#define LF_TIMER_COUNT0_VALUE_GET(x) WLAN_LF_TIMER_COUNT0_VALUE_GET(x) -#define LF_TIMER_COUNT0_VALUE_SET(x) WLAN_LF_TIMER_COUNT0_VALUE_SET(x) -#define LF_TIMER_CONTROL0_ADDRESS WLAN_LF_TIMER_CONTROL0_ADDRESS -#define LF_TIMER_CONTROL0_OFFSET WLAN_LF_TIMER_CONTROL0_OFFSET -#define LF_TIMER_CONTROL0_ENABLE_MSB WLAN_LF_TIMER_CONTROL0_ENABLE_MSB -#define LF_TIMER_CONTROL0_ENABLE_LSB WLAN_LF_TIMER_CONTROL0_ENABLE_LSB -#define LF_TIMER_CONTROL0_ENABLE_MASK WLAN_LF_TIMER_CONTROL0_ENABLE_MASK -#define LF_TIMER_CONTROL0_ENABLE_GET(x) WLAN_LF_TIMER_CONTROL0_ENABLE_GET(x) -#define LF_TIMER_CONTROL0_ENABLE_SET(x) WLAN_LF_TIMER_CONTROL0_ENABLE_SET(x) -#define LF_TIMER_CONTROL0_AUTO_RESTART_MSB WLAN_LF_TIMER_CONTROL0_AUTO_RESTART_MSB -#define LF_TIMER_CONTROL0_AUTO_RESTART_LSB WLAN_LF_TIMER_CONTROL0_AUTO_RESTART_LSB -#define LF_TIMER_CONTROL0_AUTO_RESTART_MASK WLAN_LF_TIMER_CONTROL0_AUTO_RESTART_MASK -#define LF_TIMER_CONTROL0_AUTO_RESTART_GET(x) WLAN_LF_TIMER_CONTROL0_AUTO_RESTART_GET(x) -#define LF_TIMER_CONTROL0_AUTO_RESTART_SET(x) WLAN_LF_TIMER_CONTROL0_AUTO_RESTART_SET(x) -#define LF_TIMER_CONTROL0_RESET_MSB WLAN_LF_TIMER_CONTROL0_RESET_MSB -#define LF_TIMER_CONTROL0_RESET_LSB WLAN_LF_TIMER_CONTROL0_RESET_LSB -#define LF_TIMER_CONTROL0_RESET_MASK WLAN_LF_TIMER_CONTROL0_RESET_MASK -#define LF_TIMER_CONTROL0_RESET_GET(x) WLAN_LF_TIMER_CONTROL0_RESET_GET(x) -#define LF_TIMER_CONTROL0_RESET_SET(x) WLAN_LF_TIMER_CONTROL0_RESET_SET(x) -#define LF_TIMER_STATUS0_ADDRESS WLAN_LF_TIMER_STATUS0_ADDRESS -#define LF_TIMER_STATUS0_OFFSET WLAN_LF_TIMER_STATUS0_OFFSET -#define LF_TIMER_STATUS0_INTERRUPT_MSB WLAN_LF_TIMER_STATUS0_INTERRUPT_MSB -#define LF_TIMER_STATUS0_INTERRUPT_LSB WLAN_LF_TIMER_STATUS0_INTERRUPT_LSB -#define LF_TIMER_STATUS0_INTERRUPT_MASK WLAN_LF_TIMER_STATUS0_INTERRUPT_MASK -#define LF_TIMER_STATUS0_INTERRUPT_GET(x) WLAN_LF_TIMER_STATUS0_INTERRUPT_GET(x) -#define LF_TIMER_STATUS0_INTERRUPT_SET(x) WLAN_LF_TIMER_STATUS0_INTERRUPT_SET(x) -#define LF_TIMER1_ADDRESS WLAN_LF_TIMER1_ADDRESS -#define LF_TIMER1_OFFSET WLAN_LF_TIMER1_OFFSET -#define LF_TIMER1_TARGET_MSB WLAN_LF_TIMER1_TARGET_MSB -#define LF_TIMER1_TARGET_LSB WLAN_LF_TIMER1_TARGET_LSB -#define LF_TIMER1_TARGET_MASK WLAN_LF_TIMER1_TARGET_MASK -#define LF_TIMER1_TARGET_GET(x) WLAN_LF_TIMER1_TARGET_GET(x) -#define LF_TIMER1_TARGET_SET(x) WLAN_LF_TIMER1_TARGET_SET(x) -#define LF_TIMER_COUNT1_ADDRESS WLAN_LF_TIMER_COUNT1_ADDRESS -#define LF_TIMER_COUNT1_OFFSET WLAN_LF_TIMER_COUNT1_OFFSET -#define LF_TIMER_COUNT1_VALUE_MSB WLAN_LF_TIMER_COUNT1_VALUE_MSB -#define LF_TIMER_COUNT1_VALUE_LSB WLAN_LF_TIMER_COUNT1_VALUE_LSB -#define LF_TIMER_COUNT1_VALUE_MASK WLAN_LF_TIMER_COUNT1_VALUE_MASK -#define LF_TIMER_COUNT1_VALUE_GET(x) WLAN_LF_TIMER_COUNT1_VALUE_GET(x) -#define LF_TIMER_COUNT1_VALUE_SET(x) WLAN_LF_TIMER_COUNT1_VALUE_SET(x) -#define LF_TIMER_CONTROL1_ADDRESS WLAN_LF_TIMER_CONTROL1_ADDRESS -#define LF_TIMER_CONTROL1_OFFSET WLAN_LF_TIMER_CONTROL1_OFFSET -#define LF_TIMER_CONTROL1_ENABLE_MSB WLAN_LF_TIMER_CONTROL1_ENABLE_MSB -#define LF_TIMER_CONTROL1_ENABLE_LSB WLAN_LF_TIMER_CONTROL1_ENABLE_LSB -#define LF_TIMER_CONTROL1_ENABLE_MASK WLAN_LF_TIMER_CONTROL1_ENABLE_MASK -#define LF_TIMER_CONTROL1_ENABLE_GET(x) WLAN_LF_TIMER_CONTROL1_ENABLE_GET(x) -#define LF_TIMER_CONTROL1_ENABLE_SET(x) WLAN_LF_TIMER_CONTROL1_ENABLE_SET(x) -#define LF_TIMER_CONTROL1_AUTO_RESTART_MSB WLAN_LF_TIMER_CONTROL1_AUTO_RESTART_MSB -#define LF_TIMER_CONTROL1_AUTO_RESTART_LSB WLAN_LF_TIMER_CONTROL1_AUTO_RESTART_LSB -#define LF_TIMER_CONTROL1_AUTO_RESTART_MASK WLAN_LF_TIMER_CONTROL1_AUTO_RESTART_MASK -#define LF_TIMER_CONTROL1_AUTO_RESTART_GET(x) WLAN_LF_TIMER_CONTROL1_AUTO_RESTART_GET(x) -#define LF_TIMER_CONTROL1_AUTO_RESTART_SET(x) WLAN_LF_TIMER_CONTROL1_AUTO_RESTART_SET(x) -#define LF_TIMER_CONTROL1_RESET_MSB WLAN_LF_TIMER_CONTROL1_RESET_MSB -#define LF_TIMER_CONTROL1_RESET_LSB WLAN_LF_TIMER_CONTROL1_RESET_LSB -#define LF_TIMER_CONTROL1_RESET_MASK WLAN_LF_TIMER_CONTROL1_RESET_MASK -#define LF_TIMER_CONTROL1_RESET_GET(x) WLAN_LF_TIMER_CONTROL1_RESET_GET(x) -#define LF_TIMER_CONTROL1_RESET_SET(x) WLAN_LF_TIMER_CONTROL1_RESET_SET(x) -#define LF_TIMER_STATUS1_ADDRESS WLAN_LF_TIMER_STATUS1_ADDRESS -#define LF_TIMER_STATUS1_OFFSET WLAN_LF_TIMER_STATUS1_OFFSET -#define LF_TIMER_STATUS1_INTERRUPT_MSB WLAN_LF_TIMER_STATUS1_INTERRUPT_MSB -#define LF_TIMER_STATUS1_INTERRUPT_LSB WLAN_LF_TIMER_STATUS1_INTERRUPT_LSB -#define LF_TIMER_STATUS1_INTERRUPT_MASK WLAN_LF_TIMER_STATUS1_INTERRUPT_MASK -#define LF_TIMER_STATUS1_INTERRUPT_GET(x) WLAN_LF_TIMER_STATUS1_INTERRUPT_GET(x) -#define LF_TIMER_STATUS1_INTERRUPT_SET(x) WLAN_LF_TIMER_STATUS1_INTERRUPT_SET(x) -#define LF_TIMER2_ADDRESS WLAN_LF_TIMER2_ADDRESS -#define LF_TIMER2_OFFSET WLAN_LF_TIMER2_OFFSET -#define LF_TIMER2_TARGET_MSB WLAN_LF_TIMER2_TARGET_MSB -#define LF_TIMER2_TARGET_LSB WLAN_LF_TIMER2_TARGET_LSB -#define LF_TIMER2_TARGET_MASK WLAN_LF_TIMER2_TARGET_MASK -#define LF_TIMER2_TARGET_GET(x) WLAN_LF_TIMER2_TARGET_GET(x) -#define LF_TIMER2_TARGET_SET(x) WLAN_LF_TIMER2_TARGET_SET(x) -#define LF_TIMER_COUNT2_ADDRESS WLAN_LF_TIMER_COUNT2_ADDRESS -#define LF_TIMER_COUNT2_OFFSET WLAN_LF_TIMER_COUNT2_OFFSET -#define LF_TIMER_COUNT2_VALUE_MSB WLAN_LF_TIMER_COUNT2_VALUE_MSB -#define LF_TIMER_COUNT2_VALUE_LSB WLAN_LF_TIMER_COUNT2_VALUE_LSB -#define LF_TIMER_COUNT2_VALUE_MASK WLAN_LF_TIMER_COUNT2_VALUE_MASK -#define LF_TIMER_COUNT2_VALUE_GET(x) WLAN_LF_TIMER_COUNT2_VALUE_GET(x) -#define LF_TIMER_COUNT2_VALUE_SET(x) WLAN_LF_TIMER_COUNT2_VALUE_SET(x) -#define LF_TIMER_CONTROL2_ADDRESS WLAN_LF_TIMER_CONTROL2_ADDRESS -#define LF_TIMER_CONTROL2_OFFSET WLAN_LF_TIMER_CONTROL2_OFFSET -#define LF_TIMER_CONTROL2_ENABLE_MSB WLAN_LF_TIMER_CONTROL2_ENABLE_MSB -#define LF_TIMER_CONTROL2_ENABLE_LSB WLAN_LF_TIMER_CONTROL2_ENABLE_LSB -#define LF_TIMER_CONTROL2_ENABLE_MASK WLAN_LF_TIMER_CONTROL2_ENABLE_MASK -#define LF_TIMER_CONTROL2_ENABLE_GET(x) WLAN_LF_TIMER_CONTROL2_ENABLE_GET(x) -#define LF_TIMER_CONTROL2_ENABLE_SET(x) WLAN_LF_TIMER_CONTROL2_ENABLE_SET(x) -#define LF_TIMER_CONTROL2_AUTO_RESTART_MSB WLAN_LF_TIMER_CONTROL2_AUTO_RESTART_MSB -#define LF_TIMER_CONTROL2_AUTO_RESTART_LSB WLAN_LF_TIMER_CONTROL2_AUTO_RESTART_LSB -#define LF_TIMER_CONTROL2_AUTO_RESTART_MASK WLAN_LF_TIMER_CONTROL2_AUTO_RESTART_MASK -#define LF_TIMER_CONTROL2_AUTO_RESTART_GET(x) WLAN_LF_TIMER_CONTROL2_AUTO_RESTART_GET(x) -#define LF_TIMER_CONTROL2_AUTO_RESTART_SET(x) WLAN_LF_TIMER_CONTROL2_AUTO_RESTART_SET(x) -#define LF_TIMER_CONTROL2_RESET_MSB WLAN_LF_TIMER_CONTROL2_RESET_MSB -#define LF_TIMER_CONTROL2_RESET_LSB WLAN_LF_TIMER_CONTROL2_RESET_LSB -#define LF_TIMER_CONTROL2_RESET_MASK WLAN_LF_TIMER_CONTROL2_RESET_MASK -#define LF_TIMER_CONTROL2_RESET_GET(x) WLAN_LF_TIMER_CONTROL2_RESET_GET(x) -#define LF_TIMER_CONTROL2_RESET_SET(x) WLAN_LF_TIMER_CONTROL2_RESET_SET(x) -#define LF_TIMER_STATUS2_ADDRESS WLAN_LF_TIMER_STATUS2_ADDRESS -#define LF_TIMER_STATUS2_OFFSET WLAN_LF_TIMER_STATUS2_OFFSET -#define LF_TIMER_STATUS2_INTERRUPT_MSB WLAN_LF_TIMER_STATUS2_INTERRUPT_MSB -#define LF_TIMER_STATUS2_INTERRUPT_LSB WLAN_LF_TIMER_STATUS2_INTERRUPT_LSB -#define LF_TIMER_STATUS2_INTERRUPT_MASK WLAN_LF_TIMER_STATUS2_INTERRUPT_MASK -#define LF_TIMER_STATUS2_INTERRUPT_GET(x) WLAN_LF_TIMER_STATUS2_INTERRUPT_GET(x) -#define LF_TIMER_STATUS2_INTERRUPT_SET(x) WLAN_LF_TIMER_STATUS2_INTERRUPT_SET(x) -#define LF_TIMER3_ADDRESS WLAN_LF_TIMER3_ADDRESS -#define LF_TIMER3_OFFSET WLAN_LF_TIMER3_OFFSET -#define LF_TIMER3_TARGET_MSB WLAN_LF_TIMER3_TARGET_MSB -#define LF_TIMER3_TARGET_LSB WLAN_LF_TIMER3_TARGET_LSB -#define LF_TIMER3_TARGET_MASK WLAN_LF_TIMER3_TARGET_MASK -#define LF_TIMER3_TARGET_GET(x) WLAN_LF_TIMER3_TARGET_GET(x) -#define LF_TIMER3_TARGET_SET(x) WLAN_LF_TIMER3_TARGET_SET(x) -#define LF_TIMER_COUNT3_ADDRESS WLAN_LF_TIMER_COUNT3_ADDRESS -#define LF_TIMER_COUNT3_OFFSET WLAN_LF_TIMER_COUNT3_OFFSET -#define LF_TIMER_COUNT3_VALUE_MSB WLAN_LF_TIMER_COUNT3_VALUE_MSB -#define LF_TIMER_COUNT3_VALUE_LSB WLAN_LF_TIMER_COUNT3_VALUE_LSB -#define LF_TIMER_COUNT3_VALUE_MASK WLAN_LF_TIMER_COUNT3_VALUE_MASK -#define LF_TIMER_COUNT3_VALUE_GET(x) WLAN_LF_TIMER_COUNT3_VALUE_GET(x) -#define LF_TIMER_COUNT3_VALUE_SET(x) WLAN_LF_TIMER_COUNT3_VALUE_SET(x) -#define LF_TIMER_CONTROL3_ADDRESS WLAN_LF_TIMER_CONTROL3_ADDRESS -#define LF_TIMER_CONTROL3_OFFSET WLAN_LF_TIMER_CONTROL3_OFFSET -#define LF_TIMER_CONTROL3_ENABLE_MSB WLAN_LF_TIMER_CONTROL3_ENABLE_MSB -#define LF_TIMER_CONTROL3_ENABLE_LSB WLAN_LF_TIMER_CONTROL3_ENABLE_LSB -#define LF_TIMER_CONTROL3_ENABLE_MASK WLAN_LF_TIMER_CONTROL3_ENABLE_MASK -#define LF_TIMER_CONTROL3_ENABLE_GET(x) WLAN_LF_TIMER_CONTROL3_ENABLE_GET(x) -#define LF_TIMER_CONTROL3_ENABLE_SET(x) WLAN_LF_TIMER_CONTROL3_ENABLE_SET(x) -#define LF_TIMER_CONTROL3_AUTO_RESTART_MSB WLAN_LF_TIMER_CONTROL3_AUTO_RESTART_MSB -#define LF_TIMER_CONTROL3_AUTO_RESTART_LSB WLAN_LF_TIMER_CONTROL3_AUTO_RESTART_LSB -#define LF_TIMER_CONTROL3_AUTO_RESTART_MASK WLAN_LF_TIMER_CONTROL3_AUTO_RESTART_MASK -#define LF_TIMER_CONTROL3_AUTO_RESTART_GET(x) WLAN_LF_TIMER_CONTROL3_AUTO_RESTART_GET(x) -#define LF_TIMER_CONTROL3_AUTO_RESTART_SET(x) WLAN_LF_TIMER_CONTROL3_AUTO_RESTART_SET(x) -#define LF_TIMER_CONTROL3_RESET_MSB WLAN_LF_TIMER_CONTROL3_RESET_MSB -#define LF_TIMER_CONTROL3_RESET_LSB WLAN_LF_TIMER_CONTROL3_RESET_LSB -#define LF_TIMER_CONTROL3_RESET_MASK WLAN_LF_TIMER_CONTROL3_RESET_MASK -#define LF_TIMER_CONTROL3_RESET_GET(x) WLAN_LF_TIMER_CONTROL3_RESET_GET(x) -#define LF_TIMER_CONTROL3_RESET_SET(x) WLAN_LF_TIMER_CONTROL3_RESET_SET(x) -#define LF_TIMER_STATUS3_ADDRESS WLAN_LF_TIMER_STATUS3_ADDRESS -#define LF_TIMER_STATUS3_OFFSET WLAN_LF_TIMER_STATUS3_OFFSET -#define LF_TIMER_STATUS3_INTERRUPT_MSB WLAN_LF_TIMER_STATUS3_INTERRUPT_MSB -#define LF_TIMER_STATUS3_INTERRUPT_LSB WLAN_LF_TIMER_STATUS3_INTERRUPT_LSB -#define LF_TIMER_STATUS3_INTERRUPT_MASK WLAN_LF_TIMER_STATUS3_INTERRUPT_MASK -#define LF_TIMER_STATUS3_INTERRUPT_GET(x) WLAN_LF_TIMER_STATUS3_INTERRUPT_GET(x) -#define LF_TIMER_STATUS3_INTERRUPT_SET(x) WLAN_LF_TIMER_STATUS3_INTERRUPT_SET(x) -#define HF_TIMER_ADDRESS WLAN_HF_TIMER_ADDRESS -#define HF_TIMER_OFFSET WLAN_HF_TIMER_OFFSET -#define HF_TIMER_TARGET_MSB WLAN_HF_TIMER_TARGET_MSB -#define HF_TIMER_TARGET_LSB WLAN_HF_TIMER_TARGET_LSB -#define HF_TIMER_TARGET_MASK WLAN_HF_TIMER_TARGET_MASK -#define HF_TIMER_TARGET_GET(x) WLAN_HF_TIMER_TARGET_GET(x) -#define HF_TIMER_TARGET_SET(x) WLAN_HF_TIMER_TARGET_SET(x) -#define HF_TIMER_COUNT_ADDRESS WLAN_HF_TIMER_COUNT_ADDRESS -#define HF_TIMER_COUNT_OFFSET WLAN_HF_TIMER_COUNT_OFFSET -#define HF_TIMER_COUNT_VALUE_MSB WLAN_HF_TIMER_COUNT_VALUE_MSB -#define HF_TIMER_COUNT_VALUE_LSB WLAN_HF_TIMER_COUNT_VALUE_LSB -#define HF_TIMER_COUNT_VALUE_MASK WLAN_HF_TIMER_COUNT_VALUE_MASK -#define HF_TIMER_COUNT_VALUE_GET(x) WLAN_HF_TIMER_COUNT_VALUE_GET(x) -#define HF_TIMER_COUNT_VALUE_SET(x) WLAN_HF_TIMER_COUNT_VALUE_SET(x) -#define HF_LF_COUNT_ADDRESS WLAN_HF_LF_COUNT_ADDRESS -#define HF_LF_COUNT_OFFSET WLAN_HF_LF_COUNT_OFFSET -#define HF_LF_COUNT_VALUE_MSB WLAN_HF_LF_COUNT_VALUE_MSB -#define HF_LF_COUNT_VALUE_LSB WLAN_HF_LF_COUNT_VALUE_LSB -#define HF_LF_COUNT_VALUE_MASK WLAN_HF_LF_COUNT_VALUE_MASK -#define HF_LF_COUNT_VALUE_GET(x) WLAN_HF_LF_COUNT_VALUE_GET(x) -#define HF_LF_COUNT_VALUE_SET(x) WLAN_HF_LF_COUNT_VALUE_SET(x) -#define HF_TIMER_CONTROL_ADDRESS WLAN_HF_TIMER_CONTROL_ADDRESS -#define HF_TIMER_CONTROL_OFFSET WLAN_HF_TIMER_CONTROL_OFFSET -#define HF_TIMER_CONTROL_ENABLE_MSB WLAN_HF_TIMER_CONTROL_ENABLE_MSB -#define HF_TIMER_CONTROL_ENABLE_LSB WLAN_HF_TIMER_CONTROL_ENABLE_LSB -#define HF_TIMER_CONTROL_ENABLE_MASK WLAN_HF_TIMER_CONTROL_ENABLE_MASK -#define HF_TIMER_CONTROL_ENABLE_GET(x) WLAN_HF_TIMER_CONTROL_ENABLE_GET(x) -#define HF_TIMER_CONTROL_ENABLE_SET(x) WLAN_HF_TIMER_CONTROL_ENABLE_SET(x) -#define HF_TIMER_CONTROL_ON_MSB WLAN_HF_TIMER_CONTROL_ON_MSB -#define HF_TIMER_CONTROL_ON_LSB WLAN_HF_TIMER_CONTROL_ON_LSB -#define HF_TIMER_CONTROL_ON_MASK WLAN_HF_TIMER_CONTROL_ON_MASK -#define HF_TIMER_CONTROL_ON_GET(x) WLAN_HF_TIMER_CONTROL_ON_GET(x) -#define HF_TIMER_CONTROL_ON_SET(x) WLAN_HF_TIMER_CONTROL_ON_SET(x) -#define HF_TIMER_CONTROL_AUTO_RESTART_MSB WLAN_HF_TIMER_CONTROL_AUTO_RESTART_MSB -#define HF_TIMER_CONTROL_AUTO_RESTART_LSB WLAN_HF_TIMER_CONTROL_AUTO_RESTART_LSB -#define HF_TIMER_CONTROL_AUTO_RESTART_MASK WLAN_HF_TIMER_CONTROL_AUTO_RESTART_MASK -#define HF_TIMER_CONTROL_AUTO_RESTART_GET(x) WLAN_HF_TIMER_CONTROL_AUTO_RESTART_GET(x) -#define HF_TIMER_CONTROL_AUTO_RESTART_SET(x) WLAN_HF_TIMER_CONTROL_AUTO_RESTART_SET(x) -#define HF_TIMER_CONTROL_RESET_MSB WLAN_HF_TIMER_CONTROL_RESET_MSB -#define HF_TIMER_CONTROL_RESET_LSB WLAN_HF_TIMER_CONTROL_RESET_LSB -#define HF_TIMER_CONTROL_RESET_MASK WLAN_HF_TIMER_CONTROL_RESET_MASK -#define HF_TIMER_CONTROL_RESET_GET(x) WLAN_HF_TIMER_CONTROL_RESET_GET(x) -#define HF_TIMER_CONTROL_RESET_SET(x) WLAN_HF_TIMER_CONTROL_RESET_SET(x) -#define HF_TIMER_STATUS_ADDRESS WLAN_HF_TIMER_STATUS_ADDRESS -#define HF_TIMER_STATUS_OFFSET WLAN_HF_TIMER_STATUS_OFFSET -#define HF_TIMER_STATUS_INTERRUPT_MSB WLAN_HF_TIMER_STATUS_INTERRUPT_MSB -#define HF_TIMER_STATUS_INTERRUPT_LSB WLAN_HF_TIMER_STATUS_INTERRUPT_LSB -#define HF_TIMER_STATUS_INTERRUPT_MASK WLAN_HF_TIMER_STATUS_INTERRUPT_MASK -#define HF_TIMER_STATUS_INTERRUPT_GET(x) WLAN_HF_TIMER_STATUS_INTERRUPT_GET(x) -#define HF_TIMER_STATUS_INTERRUPT_SET(x) WLAN_HF_TIMER_STATUS_INTERRUPT_SET(x) -#define RTC_CONTROL_ADDRESS WLAN_RTC_CONTROL_ADDRESS -#define RTC_CONTROL_OFFSET WLAN_RTC_CONTROL_OFFSET -#define RTC_CONTROL_ENABLE_MSB WLAN_RTC_CONTROL_ENABLE_MSB -#define RTC_CONTROL_ENABLE_LSB WLAN_RTC_CONTROL_ENABLE_LSB -#define RTC_CONTROL_ENABLE_MASK WLAN_RTC_CONTROL_ENABLE_MASK -#define RTC_CONTROL_ENABLE_GET(x) WLAN_RTC_CONTROL_ENABLE_GET(x) -#define RTC_CONTROL_ENABLE_SET(x) WLAN_RTC_CONTROL_ENABLE_SET(x) -#define RTC_CONTROL_LOAD_RTC_MSB WLAN_RTC_CONTROL_LOAD_RTC_MSB -#define RTC_CONTROL_LOAD_RTC_LSB WLAN_RTC_CONTROL_LOAD_RTC_LSB -#define RTC_CONTROL_LOAD_RTC_MASK WLAN_RTC_CONTROL_LOAD_RTC_MASK -#define RTC_CONTROL_LOAD_RTC_GET(x) WLAN_RTC_CONTROL_LOAD_RTC_GET(x) -#define RTC_CONTROL_LOAD_RTC_SET(x) WLAN_RTC_CONTROL_LOAD_RTC_SET(x) -#define RTC_CONTROL_LOAD_ALARM_MSB WLAN_RTC_CONTROL_LOAD_ALARM_MSB -#define RTC_CONTROL_LOAD_ALARM_LSB WLAN_RTC_CONTROL_LOAD_ALARM_LSB -#define RTC_CONTROL_LOAD_ALARM_MASK WLAN_RTC_CONTROL_LOAD_ALARM_MASK -#define RTC_CONTROL_LOAD_ALARM_GET(x) WLAN_RTC_CONTROL_LOAD_ALARM_GET(x) -#define RTC_CONTROL_LOAD_ALARM_SET(x) WLAN_RTC_CONTROL_LOAD_ALARM_SET(x) -#define RTC_TIME_ADDRESS WLAN_RTC_TIME_ADDRESS -#define RTC_TIME_OFFSET WLAN_RTC_TIME_OFFSET -#define RTC_TIME_WEEK_DAY_MSB WLAN_RTC_TIME_WEEK_DAY_MSB -#define RTC_TIME_WEEK_DAY_LSB WLAN_RTC_TIME_WEEK_DAY_LSB -#define RTC_TIME_WEEK_DAY_MASK WLAN_RTC_TIME_WEEK_DAY_MASK -#define RTC_TIME_WEEK_DAY_GET(x) WLAN_RTC_TIME_WEEK_DAY_GET(x) -#define RTC_TIME_WEEK_DAY_SET(x) WLAN_RTC_TIME_WEEK_DAY_SET(x) -#define RTC_TIME_HOUR_MSB WLAN_RTC_TIME_HOUR_MSB -#define RTC_TIME_HOUR_LSB WLAN_RTC_TIME_HOUR_LSB -#define RTC_TIME_HOUR_MASK WLAN_RTC_TIME_HOUR_MASK -#define RTC_TIME_HOUR_GET(x) WLAN_RTC_TIME_HOUR_GET(x) -#define RTC_TIME_HOUR_SET(x) WLAN_RTC_TIME_HOUR_SET(x) -#define RTC_TIME_MINUTE_MSB WLAN_RTC_TIME_MINUTE_MSB -#define RTC_TIME_MINUTE_LSB WLAN_RTC_TIME_MINUTE_LSB -#define RTC_TIME_MINUTE_MASK WLAN_RTC_TIME_MINUTE_MASK -#define RTC_TIME_MINUTE_GET(x) WLAN_RTC_TIME_MINUTE_GET(x) -#define RTC_TIME_MINUTE_SET(x) WLAN_RTC_TIME_MINUTE_SET(x) -#define RTC_TIME_SECOND_MSB WLAN_RTC_TIME_SECOND_MSB -#define RTC_TIME_SECOND_LSB WLAN_RTC_TIME_SECOND_LSB -#define RTC_TIME_SECOND_MASK WLAN_RTC_TIME_SECOND_MASK -#define RTC_TIME_SECOND_GET(x) WLAN_RTC_TIME_SECOND_GET(x) -#define RTC_TIME_SECOND_SET(x) WLAN_RTC_TIME_SECOND_SET(x) -#define RTC_DATE_ADDRESS WLAN_RTC_DATE_ADDRESS -#define RTC_DATE_OFFSET WLAN_RTC_DATE_OFFSET -#define RTC_DATE_YEAR_MSB WLAN_RTC_DATE_YEAR_MSB -#define RTC_DATE_YEAR_LSB WLAN_RTC_DATE_YEAR_LSB -#define RTC_DATE_YEAR_MASK WLAN_RTC_DATE_YEAR_MASK -#define RTC_DATE_YEAR_GET(x) WLAN_RTC_DATE_YEAR_GET(x) -#define RTC_DATE_YEAR_SET(x) WLAN_RTC_DATE_YEAR_SET(x) -#define RTC_DATE_MONTH_MSB WLAN_RTC_DATE_MONTH_MSB -#define RTC_DATE_MONTH_LSB WLAN_RTC_DATE_MONTH_LSB -#define RTC_DATE_MONTH_MASK WLAN_RTC_DATE_MONTH_MASK -#define RTC_DATE_MONTH_GET(x) WLAN_RTC_DATE_MONTH_GET(x) -#define RTC_DATE_MONTH_SET(x) WLAN_RTC_DATE_MONTH_SET(x) -#define RTC_DATE_MONTH_DAY_MSB WLAN_RTC_DATE_MONTH_DAY_MSB -#define RTC_DATE_MONTH_DAY_LSB WLAN_RTC_DATE_MONTH_DAY_LSB -#define RTC_DATE_MONTH_DAY_MASK WLAN_RTC_DATE_MONTH_DAY_MASK -#define RTC_DATE_MONTH_DAY_GET(x) WLAN_RTC_DATE_MONTH_DAY_GET(x) -#define RTC_DATE_MONTH_DAY_SET(x) WLAN_RTC_DATE_MONTH_DAY_SET(x) -#define RTC_SET_TIME_ADDRESS WLAN_RTC_SET_TIME_ADDRESS -#define RTC_SET_TIME_OFFSET WLAN_RTC_SET_TIME_OFFSET -#define RTC_SET_TIME_WEEK_DAY_MSB WLAN_RTC_SET_TIME_WEEK_DAY_MSB -#define RTC_SET_TIME_WEEK_DAY_LSB WLAN_RTC_SET_TIME_WEEK_DAY_LSB -#define RTC_SET_TIME_WEEK_DAY_MASK WLAN_RTC_SET_TIME_WEEK_DAY_MASK -#define RTC_SET_TIME_WEEK_DAY_GET(x) WLAN_RTC_SET_TIME_WEEK_DAY_GET(x) -#define RTC_SET_TIME_WEEK_DAY_SET(x) WLAN_RTC_SET_TIME_WEEK_DAY_SET(x) -#define RTC_SET_TIME_HOUR_MSB WLAN_RTC_SET_TIME_HOUR_MSB -#define RTC_SET_TIME_HOUR_LSB WLAN_RTC_SET_TIME_HOUR_LSB -#define RTC_SET_TIME_HOUR_MASK WLAN_RTC_SET_TIME_HOUR_MASK -#define RTC_SET_TIME_HOUR_GET(x) WLAN_RTC_SET_TIME_HOUR_GET(x) -#define RTC_SET_TIME_HOUR_SET(x) WLAN_RTC_SET_TIME_HOUR_SET(x) -#define RTC_SET_TIME_MINUTE_MSB WLAN_RTC_SET_TIME_MINUTE_MSB -#define RTC_SET_TIME_MINUTE_LSB WLAN_RTC_SET_TIME_MINUTE_LSB -#define RTC_SET_TIME_MINUTE_MASK WLAN_RTC_SET_TIME_MINUTE_MASK -#define RTC_SET_TIME_MINUTE_GET(x) WLAN_RTC_SET_TIME_MINUTE_GET(x) -#define RTC_SET_TIME_MINUTE_SET(x) WLAN_RTC_SET_TIME_MINUTE_SET(x) -#define RTC_SET_TIME_SECOND_MSB WLAN_RTC_SET_TIME_SECOND_MSB -#define RTC_SET_TIME_SECOND_LSB WLAN_RTC_SET_TIME_SECOND_LSB -#define RTC_SET_TIME_SECOND_MASK WLAN_RTC_SET_TIME_SECOND_MASK -#define RTC_SET_TIME_SECOND_GET(x) WLAN_RTC_SET_TIME_SECOND_GET(x) -#define RTC_SET_TIME_SECOND_SET(x) WLAN_RTC_SET_TIME_SECOND_SET(x) -#define RTC_SET_DATE_ADDRESS WLAN_RTC_SET_DATE_ADDRESS -#define RTC_SET_DATE_OFFSET WLAN_RTC_SET_DATE_OFFSET -#define RTC_SET_DATE_YEAR_MSB WLAN_RTC_SET_DATE_YEAR_MSB -#define RTC_SET_DATE_YEAR_LSB WLAN_RTC_SET_DATE_YEAR_LSB -#define RTC_SET_DATE_YEAR_MASK WLAN_RTC_SET_DATE_YEAR_MASK -#define RTC_SET_DATE_YEAR_GET(x) WLAN_RTC_SET_DATE_YEAR_GET(x) -#define RTC_SET_DATE_YEAR_SET(x) WLAN_RTC_SET_DATE_YEAR_SET(x) -#define RTC_SET_DATE_MONTH_MSB WLAN_RTC_SET_DATE_MONTH_MSB -#define RTC_SET_DATE_MONTH_LSB WLAN_RTC_SET_DATE_MONTH_LSB -#define RTC_SET_DATE_MONTH_MASK WLAN_RTC_SET_DATE_MONTH_MASK -#define RTC_SET_DATE_MONTH_GET(x) WLAN_RTC_SET_DATE_MONTH_GET(x) -#define RTC_SET_DATE_MONTH_SET(x) WLAN_RTC_SET_DATE_MONTH_SET(x) -#define RTC_SET_DATE_MONTH_DAY_MSB WLAN_RTC_SET_DATE_MONTH_DAY_MSB -#define RTC_SET_DATE_MONTH_DAY_LSB WLAN_RTC_SET_DATE_MONTH_DAY_LSB -#define RTC_SET_DATE_MONTH_DAY_MASK WLAN_RTC_SET_DATE_MONTH_DAY_MASK -#define RTC_SET_DATE_MONTH_DAY_GET(x) WLAN_RTC_SET_DATE_MONTH_DAY_GET(x) -#define RTC_SET_DATE_MONTH_DAY_SET(x) WLAN_RTC_SET_DATE_MONTH_DAY_SET(x) -#define RTC_SET_ALARM_ADDRESS WLAN_RTC_SET_ALARM_ADDRESS -#define RTC_SET_ALARM_OFFSET WLAN_RTC_SET_ALARM_OFFSET -#define RTC_SET_ALARM_HOUR_MSB WLAN_RTC_SET_ALARM_HOUR_MSB -#define RTC_SET_ALARM_HOUR_LSB WLAN_RTC_SET_ALARM_HOUR_LSB -#define RTC_SET_ALARM_HOUR_MASK WLAN_RTC_SET_ALARM_HOUR_MASK -#define RTC_SET_ALARM_HOUR_GET(x) WLAN_RTC_SET_ALARM_HOUR_GET(x) -#define RTC_SET_ALARM_HOUR_SET(x) WLAN_RTC_SET_ALARM_HOUR_SET(x) -#define RTC_SET_ALARM_MINUTE_MSB WLAN_RTC_SET_ALARM_MINUTE_MSB -#define RTC_SET_ALARM_MINUTE_LSB WLAN_RTC_SET_ALARM_MINUTE_LSB -#define RTC_SET_ALARM_MINUTE_MASK WLAN_RTC_SET_ALARM_MINUTE_MASK -#define RTC_SET_ALARM_MINUTE_GET(x) WLAN_RTC_SET_ALARM_MINUTE_GET(x) -#define RTC_SET_ALARM_MINUTE_SET(x) WLAN_RTC_SET_ALARM_MINUTE_SET(x) -#define RTC_SET_ALARM_SECOND_MSB WLAN_RTC_SET_ALARM_SECOND_MSB -#define RTC_SET_ALARM_SECOND_LSB WLAN_RTC_SET_ALARM_SECOND_LSB -#define RTC_SET_ALARM_SECOND_MASK WLAN_RTC_SET_ALARM_SECOND_MASK -#define RTC_SET_ALARM_SECOND_GET(x) WLAN_RTC_SET_ALARM_SECOND_GET(x) -#define RTC_SET_ALARM_SECOND_SET(x) WLAN_RTC_SET_ALARM_SECOND_SET(x) -#define RTC_CONFIG_ADDRESS WLAN_RTC_CONFIG_ADDRESS -#define RTC_CONFIG_OFFSET WLAN_RTC_CONFIG_OFFSET -#define RTC_CONFIG_BCD_MSB WLAN_RTC_CONFIG_BCD_MSB -#define RTC_CONFIG_BCD_LSB WLAN_RTC_CONFIG_BCD_LSB -#define RTC_CONFIG_BCD_MASK WLAN_RTC_CONFIG_BCD_MASK -#define RTC_CONFIG_BCD_GET(x) WLAN_RTC_CONFIG_BCD_GET(x) -#define RTC_CONFIG_BCD_SET(x) WLAN_RTC_CONFIG_BCD_SET(x) -#define RTC_CONFIG_TWELVE_HOUR_MSB WLAN_RTC_CONFIG_TWELVE_HOUR_MSB -#define RTC_CONFIG_TWELVE_HOUR_LSB WLAN_RTC_CONFIG_TWELVE_HOUR_LSB -#define RTC_CONFIG_TWELVE_HOUR_MASK WLAN_RTC_CONFIG_TWELVE_HOUR_MASK -#define RTC_CONFIG_TWELVE_HOUR_GET(x) WLAN_RTC_CONFIG_TWELVE_HOUR_GET(x) -#define RTC_CONFIG_TWELVE_HOUR_SET(x) WLAN_RTC_CONFIG_TWELVE_HOUR_SET(x) -#define RTC_CONFIG_DSE_MSB WLAN_RTC_CONFIG_DSE_MSB -#define RTC_CONFIG_DSE_LSB WLAN_RTC_CONFIG_DSE_LSB -#define RTC_CONFIG_DSE_MASK WLAN_RTC_CONFIG_DSE_MASK -#define RTC_CONFIG_DSE_GET(x) WLAN_RTC_CONFIG_DSE_GET(x) -#define RTC_CONFIG_DSE_SET(x) WLAN_RTC_CONFIG_DSE_SET(x) -#define RTC_ALARM_STATUS_ADDRESS WLAN_RTC_ALARM_STATUS_ADDRESS -#define RTC_ALARM_STATUS_OFFSET WLAN_RTC_ALARM_STATUS_OFFSET -#define RTC_ALARM_STATUS_ENABLE_MSB WLAN_RTC_ALARM_STATUS_ENABLE_MSB -#define RTC_ALARM_STATUS_ENABLE_LSB WLAN_RTC_ALARM_STATUS_ENABLE_LSB -#define RTC_ALARM_STATUS_ENABLE_MASK WLAN_RTC_ALARM_STATUS_ENABLE_MASK -#define RTC_ALARM_STATUS_ENABLE_GET(x) WLAN_RTC_ALARM_STATUS_ENABLE_GET(x) -#define RTC_ALARM_STATUS_ENABLE_SET(x) WLAN_RTC_ALARM_STATUS_ENABLE_SET(x) -#define RTC_ALARM_STATUS_INTERRUPT_MSB WLAN_RTC_ALARM_STATUS_INTERRUPT_MSB -#define RTC_ALARM_STATUS_INTERRUPT_LSB WLAN_RTC_ALARM_STATUS_INTERRUPT_LSB -#define RTC_ALARM_STATUS_INTERRUPT_MASK WLAN_RTC_ALARM_STATUS_INTERRUPT_MASK -#define RTC_ALARM_STATUS_INTERRUPT_GET(x) WLAN_RTC_ALARM_STATUS_INTERRUPT_GET(x) -#define RTC_ALARM_STATUS_INTERRUPT_SET(x) WLAN_RTC_ALARM_STATUS_INTERRUPT_SET(x) -#define UART_WAKEUP_ADDRESS WLAN_UART_WAKEUP_ADDRESS -#define UART_WAKEUP_OFFSET WLAN_UART_WAKEUP_OFFSET -#define UART_WAKEUP_ENABLE_MSB WLAN_UART_WAKEUP_ENABLE_MSB -#define UART_WAKEUP_ENABLE_LSB WLAN_UART_WAKEUP_ENABLE_LSB -#define UART_WAKEUP_ENABLE_MASK WLAN_UART_WAKEUP_ENABLE_MASK -#define UART_WAKEUP_ENABLE_GET(x) WLAN_UART_WAKEUP_ENABLE_GET(x) -#define UART_WAKEUP_ENABLE_SET(x) WLAN_UART_WAKEUP_ENABLE_SET(x) -#define RESET_CAUSE_ADDRESS WLAN_RESET_CAUSE_ADDRESS -#define RESET_CAUSE_OFFSET WLAN_RESET_CAUSE_OFFSET -#define RESET_CAUSE_LAST_MSB WLAN_RESET_CAUSE_LAST_MSB -#define RESET_CAUSE_LAST_LSB WLAN_RESET_CAUSE_LAST_LSB -#define RESET_CAUSE_LAST_MASK WLAN_RESET_CAUSE_LAST_MASK -#define RESET_CAUSE_LAST_GET(x) WLAN_RESET_CAUSE_LAST_GET(x) -#define RESET_CAUSE_LAST_SET(x) WLAN_RESET_CAUSE_LAST_SET(x) -#define SYSTEM_SLEEP_ADDRESS WLAN_SYSTEM_SLEEP_ADDRESS -#define SYSTEM_SLEEP_OFFSET WLAN_SYSTEM_SLEEP_OFFSET -#define SYSTEM_SLEEP_HOST_IF_MSB WLAN_SYSTEM_SLEEP_HOST_IF_MSB -#define SYSTEM_SLEEP_HOST_IF_LSB WLAN_SYSTEM_SLEEP_HOST_IF_LSB -#define SYSTEM_SLEEP_HOST_IF_MASK WLAN_SYSTEM_SLEEP_HOST_IF_MASK -#define SYSTEM_SLEEP_HOST_IF_GET(x) WLAN_SYSTEM_SLEEP_HOST_IF_GET(x) -#define SYSTEM_SLEEP_HOST_IF_SET(x) WLAN_SYSTEM_SLEEP_HOST_IF_SET(x) -#define SYSTEM_SLEEP_MBOX_MSB WLAN_SYSTEM_SLEEP_MBOX_MSB -#define SYSTEM_SLEEP_MBOX_LSB WLAN_SYSTEM_SLEEP_MBOX_LSB -#define SYSTEM_SLEEP_MBOX_MASK WLAN_SYSTEM_SLEEP_MBOX_MASK -#define SYSTEM_SLEEP_MBOX_GET(x) WLAN_SYSTEM_SLEEP_MBOX_GET(x) -#define SYSTEM_SLEEP_MBOX_SET(x) WLAN_SYSTEM_SLEEP_MBOX_SET(x) -#define SYSTEM_SLEEP_MAC_IF_MSB WLAN_SYSTEM_SLEEP_MAC_IF_MSB -#define SYSTEM_SLEEP_MAC_IF_LSB WLAN_SYSTEM_SLEEP_MAC_IF_LSB -#define SYSTEM_SLEEP_MAC_IF_MASK WLAN_SYSTEM_SLEEP_MAC_IF_MASK -#define SYSTEM_SLEEP_MAC_IF_GET(x) WLAN_SYSTEM_SLEEP_MAC_IF_GET(x) -#define SYSTEM_SLEEP_MAC_IF_SET(x) WLAN_SYSTEM_SLEEP_MAC_IF_SET(x) -#define SYSTEM_SLEEP_LIGHT_MSB WLAN_SYSTEM_SLEEP_LIGHT_MSB -#define SYSTEM_SLEEP_LIGHT_LSB WLAN_SYSTEM_SLEEP_LIGHT_LSB -#define SYSTEM_SLEEP_LIGHT_MASK WLAN_SYSTEM_SLEEP_LIGHT_MASK -#define SYSTEM_SLEEP_LIGHT_GET(x) WLAN_SYSTEM_SLEEP_LIGHT_GET(x) -#define SYSTEM_SLEEP_LIGHT_SET(x) WLAN_SYSTEM_SLEEP_LIGHT_SET(x) -#define SYSTEM_SLEEP_DISABLE_MSB WLAN_SYSTEM_SLEEP_DISABLE_MSB -#define SYSTEM_SLEEP_DISABLE_LSB WLAN_SYSTEM_SLEEP_DISABLE_LSB -#define SYSTEM_SLEEP_DISABLE_MASK WLAN_SYSTEM_SLEEP_DISABLE_MASK -#define SYSTEM_SLEEP_DISABLE_GET(x) WLAN_SYSTEM_SLEEP_DISABLE_GET(x) -#define SYSTEM_SLEEP_DISABLE_SET(x) WLAN_SYSTEM_SLEEP_DISABLE_SET(x) -#define SDIO_WRAPPER_ADDRESS WLAN_SDIO_WRAPPER_ADDRESS -#define SDIO_WRAPPER_OFFSET WLAN_SDIO_WRAPPER_OFFSET -#define SDIO_WRAPPER_SLEEP_MSB WLAN_SDIO_WRAPPER_SLEEP_MSB -#define SDIO_WRAPPER_SLEEP_LSB WLAN_SDIO_WRAPPER_SLEEP_LSB -#define SDIO_WRAPPER_SLEEP_MASK WLAN_SDIO_WRAPPER_SLEEP_MASK -#define SDIO_WRAPPER_SLEEP_GET(x) WLAN_SDIO_WRAPPER_SLEEP_GET(x) -#define SDIO_WRAPPER_SLEEP_SET(x) WLAN_SDIO_WRAPPER_SLEEP_SET(x) -#define SDIO_WRAPPER_WAKEUP_MSB WLAN_SDIO_WRAPPER_WAKEUP_MSB -#define SDIO_WRAPPER_WAKEUP_LSB WLAN_SDIO_WRAPPER_WAKEUP_LSB -#define SDIO_WRAPPER_WAKEUP_MASK WLAN_SDIO_WRAPPER_WAKEUP_MASK -#define SDIO_WRAPPER_WAKEUP_GET(x) WLAN_SDIO_WRAPPER_WAKEUP_GET(x) -#define SDIO_WRAPPER_WAKEUP_SET(x) WLAN_SDIO_WRAPPER_WAKEUP_SET(x) -#define SDIO_WRAPPER_SOC_ON_MSB WLAN_SDIO_WRAPPER_SOC_ON_MSB -#define SDIO_WRAPPER_SOC_ON_LSB WLAN_SDIO_WRAPPER_SOC_ON_LSB -#define SDIO_WRAPPER_SOC_ON_MASK WLAN_SDIO_WRAPPER_SOC_ON_MASK -#define SDIO_WRAPPER_SOC_ON_GET(x) WLAN_SDIO_WRAPPER_SOC_ON_GET(x) -#define SDIO_WRAPPER_SOC_ON_SET(x) WLAN_SDIO_WRAPPER_SOC_ON_SET(x) -#define SDIO_WRAPPER_ON_MSB WLAN_SDIO_WRAPPER_ON_MSB -#define SDIO_WRAPPER_ON_LSB WLAN_SDIO_WRAPPER_ON_LSB -#define SDIO_WRAPPER_ON_MASK WLAN_SDIO_WRAPPER_ON_MASK -#define SDIO_WRAPPER_ON_GET(x) WLAN_SDIO_WRAPPER_ON_GET(x) -#define SDIO_WRAPPER_ON_SET(x) WLAN_SDIO_WRAPPER_ON_SET(x) -#define MAC_SLEEP_CONTROL_ADDRESS WLAN_MAC_SLEEP_CONTROL_ADDRESS -#define MAC_SLEEP_CONTROL_OFFSET WLAN_MAC_SLEEP_CONTROL_OFFSET -#define MAC_SLEEP_CONTROL_ENABLE_MSB WLAN_MAC_SLEEP_CONTROL_ENABLE_MSB -#define MAC_SLEEP_CONTROL_ENABLE_LSB WLAN_MAC_SLEEP_CONTROL_ENABLE_LSB -#define MAC_SLEEP_CONTROL_ENABLE_MASK WLAN_MAC_SLEEP_CONTROL_ENABLE_MASK -#define MAC_SLEEP_CONTROL_ENABLE_GET(x) WLAN_MAC_SLEEP_CONTROL_ENABLE_GET(x) -#define MAC_SLEEP_CONTROL_ENABLE_SET(x) WLAN_MAC_SLEEP_CONTROL_ENABLE_SET(x) -#define KEEP_AWAKE_ADDRESS WLAN_KEEP_AWAKE_ADDRESS -#define KEEP_AWAKE_OFFSET WLAN_KEEP_AWAKE_OFFSET -#define KEEP_AWAKE_COUNT_MSB WLAN_KEEP_AWAKE_COUNT_MSB -#define KEEP_AWAKE_COUNT_LSB WLAN_KEEP_AWAKE_COUNT_LSB -#define KEEP_AWAKE_COUNT_MASK WLAN_KEEP_AWAKE_COUNT_MASK -#define KEEP_AWAKE_COUNT_GET(x) WLAN_KEEP_AWAKE_COUNT_GET(x) -#define KEEP_AWAKE_COUNT_SET(x) WLAN_KEEP_AWAKE_COUNT_SET(x) -#define LPO_CAL_TIME_ADDRESS WLAN_LPO_CAL_TIME_ADDRESS -#define LPO_CAL_TIME_OFFSET WLAN_LPO_CAL_TIME_OFFSET -#define LPO_CAL_TIME_LENGTH_MSB WLAN_LPO_CAL_TIME_LENGTH_MSB -#define LPO_CAL_TIME_LENGTH_LSB WLAN_LPO_CAL_TIME_LENGTH_LSB -#define LPO_CAL_TIME_LENGTH_MASK WLAN_LPO_CAL_TIME_LENGTH_MASK -#define LPO_CAL_TIME_LENGTH_GET(x) WLAN_LPO_CAL_TIME_LENGTH_GET(x) -#define LPO_CAL_TIME_LENGTH_SET(x) WLAN_LPO_CAL_TIME_LENGTH_SET(x) -#define LPO_INIT_DIVIDEND_INT_ADDRESS WLAN_LPO_INIT_DIVIDEND_INT_ADDRESS -#define LPO_INIT_DIVIDEND_INT_OFFSET WLAN_LPO_INIT_DIVIDEND_INT_OFFSET -#define LPO_INIT_DIVIDEND_INT_VALUE_MSB WLAN_LPO_INIT_DIVIDEND_INT_VALUE_MSB -#define LPO_INIT_DIVIDEND_INT_VALUE_LSB WLAN_LPO_INIT_DIVIDEND_INT_VALUE_LSB -#define LPO_INIT_DIVIDEND_INT_VALUE_MASK WLAN_LPO_INIT_DIVIDEND_INT_VALUE_MASK -#define LPO_INIT_DIVIDEND_INT_VALUE_GET(x) WLAN_LPO_INIT_DIVIDEND_INT_VALUE_GET(x) -#define LPO_INIT_DIVIDEND_INT_VALUE_SET(x) WLAN_LPO_INIT_DIVIDEND_INT_VALUE_SET(x) -#define LPO_INIT_DIVIDEND_FRACTION_ADDRESS WLAN_LPO_INIT_DIVIDEND_FRACTION_ADDRESS -#define LPO_INIT_DIVIDEND_FRACTION_OFFSET WLAN_LPO_INIT_DIVIDEND_FRACTION_OFFSET -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_MSB WLAN_LPO_INIT_DIVIDEND_FRACTION_VALUE_MSB -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB WLAN_LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK WLAN_LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_GET(x) WLAN_LPO_INIT_DIVIDEND_FRACTION_VALUE_GET(x) -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_SET(x) WLAN_LPO_INIT_DIVIDEND_FRACTION_VALUE_SET(x) -#define LPO_CAL_ADDRESS WLAN_LPO_CAL_ADDRESS -#define LPO_CAL_OFFSET WLAN_LPO_CAL_OFFSET -#define LPO_CAL_ENABLE_MSB WLAN_LPO_CAL_ENABLE_MSB -#define LPO_CAL_ENABLE_LSB WLAN_LPO_CAL_ENABLE_LSB -#define LPO_CAL_ENABLE_MASK WLAN_LPO_CAL_ENABLE_MASK -#define LPO_CAL_ENABLE_GET(x) WLAN_LPO_CAL_ENABLE_GET(x) -#define LPO_CAL_ENABLE_SET(x) WLAN_LPO_CAL_ENABLE_SET(x) -#define LPO_CAL_COUNT_MSB WLAN_LPO_CAL_COUNT_MSB -#define LPO_CAL_COUNT_LSB WLAN_LPO_CAL_COUNT_LSB -#define LPO_CAL_COUNT_MASK WLAN_LPO_CAL_COUNT_MASK -#define LPO_CAL_COUNT_GET(x) WLAN_LPO_CAL_COUNT_GET(x) -#define LPO_CAL_COUNT_SET(x) WLAN_LPO_CAL_COUNT_SET(x) -#define LPO_CAL_TEST_CONTROL_ADDRESS WLAN_LPO_CAL_TEST_CONTROL_ADDRESS -#define LPO_CAL_TEST_CONTROL_OFFSET WLAN_LPO_CAL_TEST_CONTROL_OFFSET -#define LPO_CAL_TEST_CONTROL_ENABLE_MSB WLAN_LPO_CAL_TEST_CONTROL_ENABLE_MSB -#define LPO_CAL_TEST_CONTROL_ENABLE_LSB WLAN_LPO_CAL_TEST_CONTROL_ENABLE_LSB -#define LPO_CAL_TEST_CONTROL_ENABLE_MASK WLAN_LPO_CAL_TEST_CONTROL_ENABLE_MASK -#define LPO_CAL_TEST_CONTROL_ENABLE_GET(x) WLAN_LPO_CAL_TEST_CONTROL_ENABLE_GET(x) -#define LPO_CAL_TEST_CONTROL_ENABLE_SET(x) WLAN_LPO_CAL_TEST_CONTROL_ENABLE_SET(x) -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_MSB WLAN_LPO_CAL_TEST_CONTROL_RTC_CYCLES_MSB -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB WLAN_LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK WLAN_LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_GET(x) WLAN_LPO_CAL_TEST_CONTROL_RTC_CYCLES_GET(x) -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_SET(x) WLAN_LPO_CAL_TEST_CONTROL_RTC_CYCLES_SET(x) -#define LPO_CAL_TEST_STATUS_ADDRESS WLAN_LPO_CAL_TEST_STATUS_ADDRESS -#define LPO_CAL_TEST_STATUS_OFFSET WLAN_LPO_CAL_TEST_STATUS_OFFSET -#define LPO_CAL_TEST_STATUS_READY_MSB WLAN_LPO_CAL_TEST_STATUS_READY_MSB -#define LPO_CAL_TEST_STATUS_READY_LSB WLAN_LPO_CAL_TEST_STATUS_READY_LSB -#define LPO_CAL_TEST_STATUS_READY_MASK WLAN_LPO_CAL_TEST_STATUS_READY_MASK -#define LPO_CAL_TEST_STATUS_READY_GET(x) WLAN_LPO_CAL_TEST_STATUS_READY_GET(x) -#define LPO_CAL_TEST_STATUS_READY_SET(x) WLAN_LPO_CAL_TEST_STATUS_READY_SET(x) -#define LPO_CAL_TEST_STATUS_COUNT_MSB WLAN_LPO_CAL_TEST_STATUS_COUNT_MSB -#define LPO_CAL_TEST_STATUS_COUNT_LSB WLAN_LPO_CAL_TEST_STATUS_COUNT_LSB -#define LPO_CAL_TEST_STATUS_COUNT_MASK WLAN_LPO_CAL_TEST_STATUS_COUNT_MASK -#define LPO_CAL_TEST_STATUS_COUNT_GET(x) WLAN_LPO_CAL_TEST_STATUS_COUNT_GET(x) -#define LPO_CAL_TEST_STATUS_COUNT_SET(x) WLAN_LPO_CAL_TEST_STATUS_COUNT_SET(x) -#define CHIP_ID_ADDRESS WLAN_CHIP_ID_ADDRESS -#define CHIP_ID_OFFSET WLAN_CHIP_ID_OFFSET -#define CHIP_ID_DEVICE_ID_MSB WLAN_CHIP_ID_DEVICE_ID_MSB -#define CHIP_ID_DEVICE_ID_LSB WLAN_CHIP_ID_DEVICE_ID_LSB -#define CHIP_ID_DEVICE_ID_MASK WLAN_CHIP_ID_DEVICE_ID_MASK -#define CHIP_ID_DEVICE_ID_GET(x) WLAN_CHIP_ID_DEVICE_ID_GET(x) -#define CHIP_ID_DEVICE_ID_SET(x) WLAN_CHIP_ID_DEVICE_ID_SET(x) -#define CHIP_ID_CONFIG_ID_MSB WLAN_CHIP_ID_CONFIG_ID_MSB -#define CHIP_ID_CONFIG_ID_LSB WLAN_CHIP_ID_CONFIG_ID_LSB -#define CHIP_ID_CONFIG_ID_MASK WLAN_CHIP_ID_CONFIG_ID_MASK -#define CHIP_ID_CONFIG_ID_GET(x) WLAN_CHIP_ID_CONFIG_ID_GET(x) -#define CHIP_ID_CONFIG_ID_SET(x) WLAN_CHIP_ID_CONFIG_ID_SET(x) -#define CHIP_ID_VERSION_ID_MSB WLAN_CHIP_ID_VERSION_ID_MSB -#define CHIP_ID_VERSION_ID_LSB WLAN_CHIP_ID_VERSION_ID_LSB -#define CHIP_ID_VERSION_ID_MASK WLAN_CHIP_ID_VERSION_ID_MASK -#define CHIP_ID_VERSION_ID_GET(x) WLAN_CHIP_ID_VERSION_ID_GET(x) -#define CHIP_ID_VERSION_ID_SET(x) WLAN_CHIP_ID_VERSION_ID_SET(x) -#define DERIVED_RTC_CLK_ADDRESS WLAN_DERIVED_RTC_CLK_ADDRESS -#define DERIVED_RTC_CLK_OFFSET WLAN_DERIVED_RTC_CLK_OFFSET -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MSB WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MSB -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_GET(x) WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_GET(x) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_SET(x) WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_SET(x) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_MSB WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_MSB -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_GET(x) WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_GET(x) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_SET(x) WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_SET(x) -#define DERIVED_RTC_CLK_FORCE_MSB WLAN_DERIVED_RTC_CLK_FORCE_MSB -#define DERIVED_RTC_CLK_FORCE_LSB WLAN_DERIVED_RTC_CLK_FORCE_LSB -#define DERIVED_RTC_CLK_FORCE_MASK WLAN_DERIVED_RTC_CLK_FORCE_MASK -#define DERIVED_RTC_CLK_FORCE_GET(x) WLAN_DERIVED_RTC_CLK_FORCE_GET(x) -#define DERIVED_RTC_CLK_FORCE_SET(x) WLAN_DERIVED_RTC_CLK_FORCE_SET(x) -#define DERIVED_RTC_CLK_PERIOD_MSB WLAN_DERIVED_RTC_CLK_PERIOD_MSB -#define DERIVED_RTC_CLK_PERIOD_LSB WLAN_DERIVED_RTC_CLK_PERIOD_LSB -#define DERIVED_RTC_CLK_PERIOD_MASK WLAN_DERIVED_RTC_CLK_PERIOD_MASK -#define DERIVED_RTC_CLK_PERIOD_GET(x) WLAN_DERIVED_RTC_CLK_PERIOD_GET(x) -#define DERIVED_RTC_CLK_PERIOD_SET(x) WLAN_DERIVED_RTC_CLK_PERIOD_SET(x) -#define POWER_REG_ADDRESS WLAN_POWER_REG_ADDRESS -#define POWER_REG_OFFSET WLAN_POWER_REG_OFFSET -#define POWER_REG_SLEEP_MAKE_N_BREAK_EN_MSB WLAN_POWER_REG_SLEEP_MAKE_N_BREAK_EN_MSB -#define POWER_REG_SLEEP_MAKE_N_BREAK_EN_LSB WLAN_POWER_REG_SLEEP_MAKE_N_BREAK_EN_LSB -#define POWER_REG_SLEEP_MAKE_N_BREAK_EN_MASK WLAN_POWER_REG_SLEEP_MAKE_N_BREAK_EN_MASK -#define POWER_REG_SLEEP_MAKE_N_BREAK_EN_GET(x) WLAN_POWER_REG_SLEEP_MAKE_N_BREAK_EN_GET(x) -#define POWER_REG_SLEEP_MAKE_N_BREAK_EN_SET(x) WLAN_POWER_REG_SLEEP_MAKE_N_BREAK_EN_SET(x) -#define POWER_REG_DEBUG_EN_MSB WLAN_POWER_REG_DEBUG_EN_MSB -#define POWER_REG_DEBUG_EN_LSB WLAN_POWER_REG_DEBUG_EN_LSB -#define POWER_REG_DEBUG_EN_MASK WLAN_POWER_REG_DEBUG_EN_MASK -#define POWER_REG_DEBUG_EN_GET(x) WLAN_POWER_REG_DEBUG_EN_GET(x) -#define POWER_REG_DEBUG_EN_SET(x) WLAN_POWER_REG_DEBUG_EN_SET(x) -#define POWER_REG_WLAN_BB_PWD_EN_MSB WLAN_POWER_REG_WLAN_BB_PWD_EN_MSB -#define POWER_REG_WLAN_BB_PWD_EN_LSB WLAN_POWER_REG_WLAN_BB_PWD_EN_LSB -#define POWER_REG_WLAN_BB_PWD_EN_MASK WLAN_POWER_REG_WLAN_BB_PWD_EN_MASK -#define POWER_REG_WLAN_BB_PWD_EN_GET(x) WLAN_POWER_REG_WLAN_BB_PWD_EN_GET(x) -#define POWER_REG_WLAN_BB_PWD_EN_SET(x) WLAN_POWER_REG_WLAN_BB_PWD_EN_SET(x) -#define POWER_REG_WLAN_MAC_PWD_EN_MSB WLAN_POWER_REG_WLAN_MAC_PWD_EN_MSB -#define POWER_REG_WLAN_MAC_PWD_EN_LSB WLAN_POWER_REG_WLAN_MAC_PWD_EN_LSB -#define POWER_REG_WLAN_MAC_PWD_EN_MASK WLAN_POWER_REG_WLAN_MAC_PWD_EN_MASK -#define POWER_REG_WLAN_MAC_PWD_EN_GET(x) WLAN_POWER_REG_WLAN_MAC_PWD_EN_GET(x) -#define POWER_REG_WLAN_MAC_PWD_EN_SET(x) WLAN_POWER_REG_WLAN_MAC_PWD_EN_SET(x) -#define POWER_REG_VLVL_MSB WLAN_POWER_REG_VLVL_MSB -#define POWER_REG_VLVL_LSB WLAN_POWER_REG_VLVL_LSB -#define POWER_REG_VLVL_MASK WLAN_POWER_REG_VLVL_MASK -#define POWER_REG_VLVL_GET(x) WLAN_POWER_REG_VLVL_GET(x) -#define POWER_REG_VLVL_SET(x) WLAN_POWER_REG_VLVL_SET(x) -#define POWER_REG_CPU_INT_ENABLE_MSB WLAN_POWER_REG_CPU_INT_ENABLE_MSB -#define POWER_REG_CPU_INT_ENABLE_LSB WLAN_POWER_REG_CPU_INT_ENABLE_LSB -#define POWER_REG_CPU_INT_ENABLE_MASK WLAN_POWER_REG_CPU_INT_ENABLE_MASK -#define POWER_REG_CPU_INT_ENABLE_GET(x) WLAN_POWER_REG_CPU_INT_ENABLE_GET(x) -#define POWER_REG_CPU_INT_ENABLE_SET(x) WLAN_POWER_REG_CPU_INT_ENABLE_SET(x) -#define POWER_REG_WLAN_ISO_DIS_MSB WLAN_POWER_REG_WLAN_ISO_DIS_MSB -#define POWER_REG_WLAN_ISO_DIS_LSB WLAN_POWER_REG_WLAN_ISO_DIS_LSB -#define POWER_REG_WLAN_ISO_DIS_MASK WLAN_POWER_REG_WLAN_ISO_DIS_MASK -#define POWER_REG_WLAN_ISO_DIS_GET(x) WLAN_POWER_REG_WLAN_ISO_DIS_GET(x) -#define POWER_REG_WLAN_ISO_DIS_SET(x) WLAN_POWER_REG_WLAN_ISO_DIS_SET(x) -#define POWER_REG_WLAN_ISO_CNTL_MSB WLAN_POWER_REG_WLAN_ISO_CNTL_MSB -#define POWER_REG_WLAN_ISO_CNTL_LSB WLAN_POWER_REG_WLAN_ISO_CNTL_LSB -#define POWER_REG_WLAN_ISO_CNTL_MASK WLAN_POWER_REG_WLAN_ISO_CNTL_MASK -#define POWER_REG_WLAN_ISO_CNTL_GET(x) WLAN_POWER_REG_WLAN_ISO_CNTL_GET(x) -#define POWER_REG_WLAN_ISO_CNTL_SET(x) WLAN_POWER_REG_WLAN_ISO_CNTL_SET(x) -#define POWER_REG_RADIO_PWD_EN_MSB WLAN_POWER_REG_RADIO_PWD_EN_MSB -#define POWER_REG_RADIO_PWD_EN_LSB WLAN_POWER_REG_RADIO_PWD_EN_LSB -#define POWER_REG_RADIO_PWD_EN_MASK WLAN_POWER_REG_RADIO_PWD_EN_MASK -#define POWER_REG_RADIO_PWD_EN_GET(x) WLAN_POWER_REG_RADIO_PWD_EN_GET(x) -#define POWER_REG_RADIO_PWD_EN_SET(x) WLAN_POWER_REG_RADIO_PWD_EN_SET(x) -#define POWER_REG_SOC_ISO_EN_MSB WLAN_POWER_REG_SOC_ISO_EN_MSB -#define POWER_REG_SOC_ISO_EN_LSB WLAN_POWER_REG_SOC_ISO_EN_LSB -#define POWER_REG_SOC_ISO_EN_MASK WLAN_POWER_REG_SOC_ISO_EN_MASK -#define POWER_REG_SOC_ISO_EN_GET(x) WLAN_POWER_REG_SOC_ISO_EN_GET(x) -#define POWER_REG_SOC_ISO_EN_SET(x) WLAN_POWER_REG_SOC_ISO_EN_SET(x) -#define POWER_REG_WLAN_ISO_EN_MSB WLAN_POWER_REG_WLAN_ISO_EN_MSB -#define POWER_REG_WLAN_ISO_EN_LSB WLAN_POWER_REG_WLAN_ISO_EN_LSB -#define POWER_REG_WLAN_ISO_EN_MASK WLAN_POWER_REG_WLAN_ISO_EN_MASK -#define POWER_REG_WLAN_ISO_EN_GET(x) WLAN_POWER_REG_WLAN_ISO_EN_GET(x) -#define POWER_REG_WLAN_ISO_EN_SET(x) WLAN_POWER_REG_WLAN_ISO_EN_SET(x) -#define POWER_REG_WLAN_PWD_EN_MSB WLAN_POWER_REG_WLAN_PWD_EN_MSB -#define POWER_REG_WLAN_PWD_EN_LSB WLAN_POWER_REG_WLAN_PWD_EN_LSB -#define POWER_REG_WLAN_PWD_EN_MASK WLAN_POWER_REG_WLAN_PWD_EN_MASK -#define POWER_REG_WLAN_PWD_EN_GET(x) WLAN_POWER_REG_WLAN_PWD_EN_GET(x) -#define POWER_REG_WLAN_PWD_EN_SET(x) WLAN_POWER_REG_WLAN_PWD_EN_SET(x) -#define POWER_REG_POWER_EN_MSB WLAN_POWER_REG_POWER_EN_MSB -#define POWER_REG_POWER_EN_LSB WLAN_POWER_REG_POWER_EN_LSB -#define POWER_REG_POWER_EN_MASK WLAN_POWER_REG_POWER_EN_MASK -#define POWER_REG_POWER_EN_GET(x) WLAN_POWER_REG_POWER_EN_GET(x) -#define POWER_REG_POWER_EN_SET(x) WLAN_POWER_REG_POWER_EN_SET(x) -#define CORE_CLK_CTRL_ADDRESS WLAN_CORE_CLK_CTRL_ADDRESS -#define CORE_CLK_CTRL_OFFSET WLAN_CORE_CLK_CTRL_OFFSET -#define CORE_CLK_CTRL_DIV_MSB WLAN_CORE_CLK_CTRL_DIV_MSB -#define CORE_CLK_CTRL_DIV_LSB WLAN_CORE_CLK_CTRL_DIV_LSB -#define CORE_CLK_CTRL_DIV_MASK WLAN_CORE_CLK_CTRL_DIV_MASK -#define CORE_CLK_CTRL_DIV_GET(x) WLAN_CORE_CLK_CTRL_DIV_GET(x) -#define CORE_CLK_CTRL_DIV_SET(x) WLAN_CORE_CLK_CTRL_DIV_SET(x) -#define GPIO_WAKEUP_CONTROL_ADDRESS WLAN_GPIO_WAKEUP_CONTROL_ADDRESS -#define GPIO_WAKEUP_CONTROL_OFFSET WLAN_GPIO_WAKEUP_CONTROL_OFFSET -#define GPIO_WAKEUP_CONTROL_ENABLE_MSB WLAN_GPIO_WAKEUP_CONTROL_ENABLE_MSB -#define GPIO_WAKEUP_CONTROL_ENABLE_LSB WLAN_GPIO_WAKEUP_CONTROL_ENABLE_LSB -#define GPIO_WAKEUP_CONTROL_ENABLE_MASK WLAN_GPIO_WAKEUP_CONTROL_ENABLE_MASK -#define GPIO_WAKEUP_CONTROL_ENABLE_GET(x) WLAN_GPIO_WAKEUP_CONTROL_ENABLE_GET(x) -#define GPIO_WAKEUP_CONTROL_ENABLE_SET(x) WLAN_GPIO_WAKEUP_CONTROL_ENABLE_SET(x) - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/rtc_wlan_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/rtc_wlan_reg.h deleted file mode 100644 index b7eb62d255fd..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/rtc_wlan_reg.h +++ /dev/null @@ -1,2065 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _RTC_WLAN_REG_REG_H_ -#define _RTC_WLAN_REG_REG_H_ - -#define WLAN_RESET_CONTROL_ADDRESS 0x00000000 -#define WLAN_RESET_CONTROL_OFFSET 0x00000000 -#define WLAN_RESET_CONTROL_DEBUG_UART_RST_MSB 14 -#define WLAN_RESET_CONTROL_DEBUG_UART_RST_LSB 14 -#define WLAN_RESET_CONTROL_DEBUG_UART_RST_MASK 0x00004000 -#define WLAN_RESET_CONTROL_DEBUG_UART_RST_GET(x) (((x) & WLAN_RESET_CONTROL_DEBUG_UART_RST_MASK) >> WLAN_RESET_CONTROL_DEBUG_UART_RST_LSB) -#define WLAN_RESET_CONTROL_DEBUG_UART_RST_SET(x) (((x) << WLAN_RESET_CONTROL_DEBUG_UART_RST_LSB) & WLAN_RESET_CONTROL_DEBUG_UART_RST_MASK) -#define WLAN_RESET_CONTROL_BB_COLD_RST_MSB 13 -#define WLAN_RESET_CONTROL_BB_COLD_RST_LSB 13 -#define WLAN_RESET_CONTROL_BB_COLD_RST_MASK 0x00002000 -#define WLAN_RESET_CONTROL_BB_COLD_RST_GET(x) (((x) & WLAN_RESET_CONTROL_BB_COLD_RST_MASK) >> WLAN_RESET_CONTROL_BB_COLD_RST_LSB) -#define WLAN_RESET_CONTROL_BB_COLD_RST_SET(x) (((x) << WLAN_RESET_CONTROL_BB_COLD_RST_LSB) & WLAN_RESET_CONTROL_BB_COLD_RST_MASK) -#define WLAN_RESET_CONTROL_BB_WARM_RST_MSB 12 -#define WLAN_RESET_CONTROL_BB_WARM_RST_LSB 12 -#define WLAN_RESET_CONTROL_BB_WARM_RST_MASK 0x00001000 -#define WLAN_RESET_CONTROL_BB_WARM_RST_GET(x) (((x) & WLAN_RESET_CONTROL_BB_WARM_RST_MASK) >> WLAN_RESET_CONTROL_BB_WARM_RST_LSB) -#define WLAN_RESET_CONTROL_BB_WARM_RST_SET(x) (((x) << WLAN_RESET_CONTROL_BB_WARM_RST_LSB) & WLAN_RESET_CONTROL_BB_WARM_RST_MASK) -#define WLAN_RESET_CONTROL_CPU_INIT_RESET_MSB 11 -#define WLAN_RESET_CONTROL_CPU_INIT_RESET_LSB 11 -#define WLAN_RESET_CONTROL_CPU_INIT_RESET_MASK 0x00000800 -#define WLAN_RESET_CONTROL_CPU_INIT_RESET_GET(x) (((x) & WLAN_RESET_CONTROL_CPU_INIT_RESET_MASK) >> WLAN_RESET_CONTROL_CPU_INIT_RESET_LSB) -#define WLAN_RESET_CONTROL_CPU_INIT_RESET_SET(x) (((x) << WLAN_RESET_CONTROL_CPU_INIT_RESET_LSB) & WLAN_RESET_CONTROL_CPU_INIT_RESET_MASK) -#define WLAN_RESET_CONTROL_VMC_REMAP_RESET_MSB 10 -#define WLAN_RESET_CONTROL_VMC_REMAP_RESET_LSB 10 -#define WLAN_RESET_CONTROL_VMC_REMAP_RESET_MASK 0x00000400 -#define WLAN_RESET_CONTROL_VMC_REMAP_RESET_GET(x) (((x) & WLAN_RESET_CONTROL_VMC_REMAP_RESET_MASK) >> WLAN_RESET_CONTROL_VMC_REMAP_RESET_LSB) -#define WLAN_RESET_CONTROL_VMC_REMAP_RESET_SET(x) (((x) << WLAN_RESET_CONTROL_VMC_REMAP_RESET_LSB) & WLAN_RESET_CONTROL_VMC_REMAP_RESET_MASK) -#define WLAN_RESET_CONTROL_RST_OUT_MSB 9 -#define WLAN_RESET_CONTROL_RST_OUT_LSB 9 -#define WLAN_RESET_CONTROL_RST_OUT_MASK 0x00000200 -#define WLAN_RESET_CONTROL_RST_OUT_GET(x) (((x) & WLAN_RESET_CONTROL_RST_OUT_MASK) >> WLAN_RESET_CONTROL_RST_OUT_LSB) -#define WLAN_RESET_CONTROL_RST_OUT_SET(x) (((x) << WLAN_RESET_CONTROL_RST_OUT_LSB) & WLAN_RESET_CONTROL_RST_OUT_MASK) -#define WLAN_RESET_CONTROL_COLD_RST_MSB 8 -#define WLAN_RESET_CONTROL_COLD_RST_LSB 8 -#define WLAN_RESET_CONTROL_COLD_RST_MASK 0x00000100 -#define WLAN_RESET_CONTROL_COLD_RST_GET(x) (((x) & WLAN_RESET_CONTROL_COLD_RST_MASK) >> WLAN_RESET_CONTROL_COLD_RST_LSB) -#define WLAN_RESET_CONTROL_COLD_RST_SET(x) (((x) << WLAN_RESET_CONTROL_COLD_RST_LSB) & WLAN_RESET_CONTROL_COLD_RST_MASK) -#define WLAN_RESET_CONTROL_WARM_RST_MSB 7 -#define WLAN_RESET_CONTROL_WARM_RST_LSB 7 -#define WLAN_RESET_CONTROL_WARM_RST_MASK 0x00000080 -#define WLAN_RESET_CONTROL_WARM_RST_GET(x) (((x) & WLAN_RESET_CONTROL_WARM_RST_MASK) >> WLAN_RESET_CONTROL_WARM_RST_LSB) -#define WLAN_RESET_CONTROL_WARM_RST_SET(x) (((x) << WLAN_RESET_CONTROL_WARM_RST_LSB) & WLAN_RESET_CONTROL_WARM_RST_MASK) -#define WLAN_RESET_CONTROL_CPU_WARM_RST_MSB 6 -#define WLAN_RESET_CONTROL_CPU_WARM_RST_LSB 6 -#define WLAN_RESET_CONTROL_CPU_WARM_RST_MASK 0x00000040 -#define WLAN_RESET_CONTROL_CPU_WARM_RST_GET(x) (((x) & WLAN_RESET_CONTROL_CPU_WARM_RST_MASK) >> WLAN_RESET_CONTROL_CPU_WARM_RST_LSB) -#define WLAN_RESET_CONTROL_CPU_WARM_RST_SET(x) (((x) << WLAN_RESET_CONTROL_CPU_WARM_RST_LSB) & WLAN_RESET_CONTROL_CPU_WARM_RST_MASK) -#define WLAN_RESET_CONTROL_MAC_COLD_RST_MSB 5 -#define WLAN_RESET_CONTROL_MAC_COLD_RST_LSB 5 -#define WLAN_RESET_CONTROL_MAC_COLD_RST_MASK 0x00000020 -#define WLAN_RESET_CONTROL_MAC_COLD_RST_GET(x) (((x) & WLAN_RESET_CONTROL_MAC_COLD_RST_MASK) >> WLAN_RESET_CONTROL_MAC_COLD_RST_LSB) -#define WLAN_RESET_CONTROL_MAC_COLD_RST_SET(x) (((x) << WLAN_RESET_CONTROL_MAC_COLD_RST_LSB) & WLAN_RESET_CONTROL_MAC_COLD_RST_MASK) -#define WLAN_RESET_CONTROL_MAC_WARM_RST_MSB 4 -#define WLAN_RESET_CONTROL_MAC_WARM_RST_LSB 4 -#define WLAN_RESET_CONTROL_MAC_WARM_RST_MASK 0x00000010 -#define WLAN_RESET_CONTROL_MAC_WARM_RST_GET(x) (((x) & WLAN_RESET_CONTROL_MAC_WARM_RST_MASK) >> WLAN_RESET_CONTROL_MAC_WARM_RST_LSB) -#define WLAN_RESET_CONTROL_MAC_WARM_RST_SET(x) (((x) << WLAN_RESET_CONTROL_MAC_WARM_RST_LSB) & WLAN_RESET_CONTROL_MAC_WARM_RST_MASK) -#define WLAN_RESET_CONTROL_MBOX_RST_MSB 2 -#define WLAN_RESET_CONTROL_MBOX_RST_LSB 2 -#define WLAN_RESET_CONTROL_MBOX_RST_MASK 0x00000004 -#define WLAN_RESET_CONTROL_MBOX_RST_GET(x) (((x) & WLAN_RESET_CONTROL_MBOX_RST_MASK) >> WLAN_RESET_CONTROL_MBOX_RST_LSB) -#define WLAN_RESET_CONTROL_MBOX_RST_SET(x) (((x) << WLAN_RESET_CONTROL_MBOX_RST_LSB) & WLAN_RESET_CONTROL_MBOX_RST_MASK) -#define WLAN_RESET_CONTROL_UART_RST_MSB 1 -#define WLAN_RESET_CONTROL_UART_RST_LSB 1 -#define WLAN_RESET_CONTROL_UART_RST_MASK 0x00000002 -#define WLAN_RESET_CONTROL_UART_RST_GET(x) (((x) & WLAN_RESET_CONTROL_UART_RST_MASK) >> WLAN_RESET_CONTROL_UART_RST_LSB) -#define WLAN_RESET_CONTROL_UART_RST_SET(x) (((x) << WLAN_RESET_CONTROL_UART_RST_LSB) & WLAN_RESET_CONTROL_UART_RST_MASK) -#define WLAN_RESET_CONTROL_SI0_RST_MSB 0 -#define WLAN_RESET_CONTROL_SI0_RST_LSB 0 -#define WLAN_RESET_CONTROL_SI0_RST_MASK 0x00000001 -#define WLAN_RESET_CONTROL_SI0_RST_GET(x) (((x) & WLAN_RESET_CONTROL_SI0_RST_MASK) >> WLAN_RESET_CONTROL_SI0_RST_LSB) -#define WLAN_RESET_CONTROL_SI0_RST_SET(x) (((x) << WLAN_RESET_CONTROL_SI0_RST_LSB) & WLAN_RESET_CONTROL_SI0_RST_MASK) - -#define WLAN_XTAL_CONTROL_ADDRESS 0x00000004 -#define WLAN_XTAL_CONTROL_OFFSET 0x00000004 -#define WLAN_XTAL_CONTROL_TCXO_MSB 0 -#define WLAN_XTAL_CONTROL_TCXO_LSB 0 -#define WLAN_XTAL_CONTROL_TCXO_MASK 0x00000001 -#define WLAN_XTAL_CONTROL_TCXO_GET(x) (((x) & WLAN_XTAL_CONTROL_TCXO_MASK) >> WLAN_XTAL_CONTROL_TCXO_LSB) -#define WLAN_XTAL_CONTROL_TCXO_SET(x) (((x) << WLAN_XTAL_CONTROL_TCXO_LSB) & WLAN_XTAL_CONTROL_TCXO_MASK) - -#define WLAN_TCXO_DETECT_ADDRESS 0x00000008 -#define WLAN_TCXO_DETECT_OFFSET 0x00000008 -#define WLAN_TCXO_DETECT_PRESENT_MSB 0 -#define WLAN_TCXO_DETECT_PRESENT_LSB 0 -#define WLAN_TCXO_DETECT_PRESENT_MASK 0x00000001 -#define WLAN_TCXO_DETECT_PRESENT_GET(x) (((x) & WLAN_TCXO_DETECT_PRESENT_MASK) >> WLAN_TCXO_DETECT_PRESENT_LSB) -#define WLAN_TCXO_DETECT_PRESENT_SET(x) (((x) << WLAN_TCXO_DETECT_PRESENT_LSB) & WLAN_TCXO_DETECT_PRESENT_MASK) - -#define WLAN_XTAL_TEST_ADDRESS 0x0000000c -#define WLAN_XTAL_TEST_OFFSET 0x0000000c -#define WLAN_XTAL_TEST_NOTCXODET_MSB 0 -#define WLAN_XTAL_TEST_NOTCXODET_LSB 0 -#define WLAN_XTAL_TEST_NOTCXODET_MASK 0x00000001 -#define WLAN_XTAL_TEST_NOTCXODET_GET(x) (((x) & WLAN_XTAL_TEST_NOTCXODET_MASK) >> WLAN_XTAL_TEST_NOTCXODET_LSB) -#define WLAN_XTAL_TEST_NOTCXODET_SET(x) (((x) << WLAN_XTAL_TEST_NOTCXODET_LSB) & WLAN_XTAL_TEST_NOTCXODET_MASK) - -#define WLAN_QUADRATURE_ADDRESS 0x00000010 -#define WLAN_QUADRATURE_OFFSET 0x00000010 -#define WLAN_QUADRATURE_ADC_MSB 7 -#define WLAN_QUADRATURE_ADC_LSB 4 -#define WLAN_QUADRATURE_ADC_MASK 0x000000f0 -#define WLAN_QUADRATURE_ADC_GET(x) (((x) & WLAN_QUADRATURE_ADC_MASK) >> WLAN_QUADRATURE_ADC_LSB) -#define WLAN_QUADRATURE_ADC_SET(x) (((x) << WLAN_QUADRATURE_ADC_LSB) & WLAN_QUADRATURE_ADC_MASK) -#define WLAN_QUADRATURE_SEL_MSB 2 -#define WLAN_QUADRATURE_SEL_LSB 2 -#define WLAN_QUADRATURE_SEL_MASK 0x00000004 -#define WLAN_QUADRATURE_SEL_GET(x) (((x) & WLAN_QUADRATURE_SEL_MASK) >> WLAN_QUADRATURE_SEL_LSB) -#define WLAN_QUADRATURE_SEL_SET(x) (((x) << WLAN_QUADRATURE_SEL_LSB) & WLAN_QUADRATURE_SEL_MASK) -#define WLAN_QUADRATURE_DAC_MSB 1 -#define WLAN_QUADRATURE_DAC_LSB 0 -#define WLAN_QUADRATURE_DAC_MASK 0x00000003 -#define WLAN_QUADRATURE_DAC_GET(x) (((x) & WLAN_QUADRATURE_DAC_MASK) >> WLAN_QUADRATURE_DAC_LSB) -#define WLAN_QUADRATURE_DAC_SET(x) (((x) << WLAN_QUADRATURE_DAC_LSB) & WLAN_QUADRATURE_DAC_MASK) - -#define WLAN_PLL_CONTROL_ADDRESS 0x00000014 -#define WLAN_PLL_CONTROL_OFFSET 0x00000014 -#define WLAN_PLL_CONTROL_DIG_TEST_CLK_MSB 20 -#define WLAN_PLL_CONTROL_DIG_TEST_CLK_LSB 20 -#define WLAN_PLL_CONTROL_DIG_TEST_CLK_MASK 0x00100000 -#define WLAN_PLL_CONTROL_DIG_TEST_CLK_GET(x) (((x) & WLAN_PLL_CONTROL_DIG_TEST_CLK_MASK) >> WLAN_PLL_CONTROL_DIG_TEST_CLK_LSB) -#define WLAN_PLL_CONTROL_DIG_TEST_CLK_SET(x) (((x) << WLAN_PLL_CONTROL_DIG_TEST_CLK_LSB) & WLAN_PLL_CONTROL_DIG_TEST_CLK_MASK) -#define WLAN_PLL_CONTROL_MAC_OVERRIDE_MSB 19 -#define WLAN_PLL_CONTROL_MAC_OVERRIDE_LSB 19 -#define WLAN_PLL_CONTROL_MAC_OVERRIDE_MASK 0x00080000 -#define WLAN_PLL_CONTROL_MAC_OVERRIDE_GET(x) (((x) & WLAN_PLL_CONTROL_MAC_OVERRIDE_MASK) >> WLAN_PLL_CONTROL_MAC_OVERRIDE_LSB) -#define WLAN_PLL_CONTROL_MAC_OVERRIDE_SET(x) (((x) << WLAN_PLL_CONTROL_MAC_OVERRIDE_LSB) & WLAN_PLL_CONTROL_MAC_OVERRIDE_MASK) -#define WLAN_PLL_CONTROL_NOPWD_MSB 18 -#define WLAN_PLL_CONTROL_NOPWD_LSB 18 -#define WLAN_PLL_CONTROL_NOPWD_MASK 0x00040000 -#define WLAN_PLL_CONTROL_NOPWD_GET(x) (((x) & WLAN_PLL_CONTROL_NOPWD_MASK) >> WLAN_PLL_CONTROL_NOPWD_LSB) -#define WLAN_PLL_CONTROL_NOPWD_SET(x) (((x) << WLAN_PLL_CONTROL_NOPWD_LSB) & WLAN_PLL_CONTROL_NOPWD_MASK) -#define WLAN_PLL_CONTROL_UPDATING_MSB 17 -#define WLAN_PLL_CONTROL_UPDATING_LSB 17 -#define WLAN_PLL_CONTROL_UPDATING_MASK 0x00020000 -#define WLAN_PLL_CONTROL_UPDATING_GET(x) (((x) & WLAN_PLL_CONTROL_UPDATING_MASK) >> WLAN_PLL_CONTROL_UPDATING_LSB) -#define WLAN_PLL_CONTROL_UPDATING_SET(x) (((x) << WLAN_PLL_CONTROL_UPDATING_LSB) & WLAN_PLL_CONTROL_UPDATING_MASK) -#define WLAN_PLL_CONTROL_BYPASS_MSB 16 -#define WLAN_PLL_CONTROL_BYPASS_LSB 16 -#define WLAN_PLL_CONTROL_BYPASS_MASK 0x00010000 -#define WLAN_PLL_CONTROL_BYPASS_GET(x) (((x) & WLAN_PLL_CONTROL_BYPASS_MASK) >> WLAN_PLL_CONTROL_BYPASS_LSB) -#define WLAN_PLL_CONTROL_BYPASS_SET(x) (((x) << WLAN_PLL_CONTROL_BYPASS_LSB) & WLAN_PLL_CONTROL_BYPASS_MASK) -#define WLAN_PLL_CONTROL_REFDIV_MSB 15 -#define WLAN_PLL_CONTROL_REFDIV_LSB 12 -#define WLAN_PLL_CONTROL_REFDIV_MASK 0x0000f000 -#define WLAN_PLL_CONTROL_REFDIV_GET(x) (((x) & WLAN_PLL_CONTROL_REFDIV_MASK) >> WLAN_PLL_CONTROL_REFDIV_LSB) -#define WLAN_PLL_CONTROL_REFDIV_SET(x) (((x) << WLAN_PLL_CONTROL_REFDIV_LSB) & WLAN_PLL_CONTROL_REFDIV_MASK) -#define WLAN_PLL_CONTROL_DIV_MSB 9 -#define WLAN_PLL_CONTROL_DIV_LSB 0 -#define WLAN_PLL_CONTROL_DIV_MASK 0x000003ff -#define WLAN_PLL_CONTROL_DIV_GET(x) (((x) & WLAN_PLL_CONTROL_DIV_MASK) >> WLAN_PLL_CONTROL_DIV_LSB) -#define WLAN_PLL_CONTROL_DIV_SET(x) (((x) << WLAN_PLL_CONTROL_DIV_LSB) & WLAN_PLL_CONTROL_DIV_MASK) - -#define WLAN_PLL_SETTLE_ADDRESS 0x00000018 -#define WLAN_PLL_SETTLE_OFFSET 0x00000018 -#define WLAN_PLL_SETTLE_TIME_MSB 11 -#define WLAN_PLL_SETTLE_TIME_LSB 0 -#define WLAN_PLL_SETTLE_TIME_MASK 0x00000fff -#define WLAN_PLL_SETTLE_TIME_GET(x) (((x) & WLAN_PLL_SETTLE_TIME_MASK) >> WLAN_PLL_SETTLE_TIME_LSB) -#define WLAN_PLL_SETTLE_TIME_SET(x) (((x) << WLAN_PLL_SETTLE_TIME_LSB) & WLAN_PLL_SETTLE_TIME_MASK) - -#define WLAN_XTAL_SETTLE_ADDRESS 0x0000001c -#define WLAN_XTAL_SETTLE_OFFSET 0x0000001c -#define WLAN_XTAL_SETTLE_TIME_MSB 7 -#define WLAN_XTAL_SETTLE_TIME_LSB 0 -#define WLAN_XTAL_SETTLE_TIME_MASK 0x000000ff -#define WLAN_XTAL_SETTLE_TIME_GET(x) (((x) & WLAN_XTAL_SETTLE_TIME_MASK) >> WLAN_XTAL_SETTLE_TIME_LSB) -#define WLAN_XTAL_SETTLE_TIME_SET(x) (((x) << WLAN_XTAL_SETTLE_TIME_LSB) & WLAN_XTAL_SETTLE_TIME_MASK) - -#define WLAN_CPU_CLOCK_ADDRESS 0x00000020 -#define WLAN_CPU_CLOCK_OFFSET 0x00000020 -#define WLAN_CPU_CLOCK_STANDARD_MSB 1 -#define WLAN_CPU_CLOCK_STANDARD_LSB 0 -#define WLAN_CPU_CLOCK_STANDARD_MASK 0x00000003 -#define WLAN_CPU_CLOCK_STANDARD_GET(x) (((x) & WLAN_CPU_CLOCK_STANDARD_MASK) >> WLAN_CPU_CLOCK_STANDARD_LSB) -#define WLAN_CPU_CLOCK_STANDARD_SET(x) (((x) << WLAN_CPU_CLOCK_STANDARD_LSB) & WLAN_CPU_CLOCK_STANDARD_MASK) - -#define WLAN_CLOCK_OUT_ADDRESS 0x00000024 -#define WLAN_CLOCK_OUT_OFFSET 0x00000024 -#define WLAN_CLOCK_OUT_SELECT_MSB 3 -#define WLAN_CLOCK_OUT_SELECT_LSB 0 -#define WLAN_CLOCK_OUT_SELECT_MASK 0x0000000f -#define WLAN_CLOCK_OUT_SELECT_GET(x) (((x) & WLAN_CLOCK_OUT_SELECT_MASK) >> WLAN_CLOCK_OUT_SELECT_LSB) -#define WLAN_CLOCK_OUT_SELECT_SET(x) (((x) << WLAN_CLOCK_OUT_SELECT_LSB) & WLAN_CLOCK_OUT_SELECT_MASK) - -#define WLAN_CLOCK_CONTROL_ADDRESS 0x00000028 -#define WLAN_CLOCK_CONTROL_OFFSET 0x00000028 -#define WLAN_CLOCK_CONTROL_LF_CLK32_MSB 2 -#define WLAN_CLOCK_CONTROL_LF_CLK32_LSB 2 -#define WLAN_CLOCK_CONTROL_LF_CLK32_MASK 0x00000004 -#define WLAN_CLOCK_CONTROL_LF_CLK32_GET(x) (((x) & WLAN_CLOCK_CONTROL_LF_CLK32_MASK) >> WLAN_CLOCK_CONTROL_LF_CLK32_LSB) -#define WLAN_CLOCK_CONTROL_LF_CLK32_SET(x) (((x) << WLAN_CLOCK_CONTROL_LF_CLK32_LSB) & WLAN_CLOCK_CONTROL_LF_CLK32_MASK) -#define WLAN_CLOCK_CONTROL_SI0_CLK_MSB 0 -#define WLAN_CLOCK_CONTROL_SI0_CLK_LSB 0 -#define WLAN_CLOCK_CONTROL_SI0_CLK_MASK 0x00000001 -#define WLAN_CLOCK_CONTROL_SI0_CLK_GET(x) (((x) & WLAN_CLOCK_CONTROL_SI0_CLK_MASK) >> WLAN_CLOCK_CONTROL_SI0_CLK_LSB) -#define WLAN_CLOCK_CONTROL_SI0_CLK_SET(x) (((x) << WLAN_CLOCK_CONTROL_SI0_CLK_LSB) & WLAN_CLOCK_CONTROL_SI0_CLK_MASK) - -#define WLAN_BIAS_OVERRIDE_ADDRESS 0x0000002c -#define WLAN_BIAS_OVERRIDE_OFFSET 0x0000002c -#define WLAN_BIAS_OVERRIDE_ON_MSB 0 -#define WLAN_BIAS_OVERRIDE_ON_LSB 0 -#define WLAN_BIAS_OVERRIDE_ON_MASK 0x00000001 -#define WLAN_BIAS_OVERRIDE_ON_GET(x) (((x) & WLAN_BIAS_OVERRIDE_ON_MASK) >> WLAN_BIAS_OVERRIDE_ON_LSB) -#define WLAN_BIAS_OVERRIDE_ON_SET(x) (((x) << WLAN_BIAS_OVERRIDE_ON_LSB) & WLAN_BIAS_OVERRIDE_ON_MASK) - -#define WLAN_WDT_CONTROL_ADDRESS 0x00000030 -#define WLAN_WDT_CONTROL_OFFSET 0x00000030 -#define WLAN_WDT_CONTROL_ACTION_MSB 2 -#define WLAN_WDT_CONTROL_ACTION_LSB 0 -#define WLAN_WDT_CONTROL_ACTION_MASK 0x00000007 -#define WLAN_WDT_CONTROL_ACTION_GET(x) (((x) & WLAN_WDT_CONTROL_ACTION_MASK) >> WLAN_WDT_CONTROL_ACTION_LSB) -#define WLAN_WDT_CONTROL_ACTION_SET(x) (((x) << WLAN_WDT_CONTROL_ACTION_LSB) & WLAN_WDT_CONTROL_ACTION_MASK) - -#define WLAN_WDT_STATUS_ADDRESS 0x00000034 -#define WLAN_WDT_STATUS_OFFSET 0x00000034 -#define WLAN_WDT_STATUS_INTERRUPT_MSB 0 -#define WLAN_WDT_STATUS_INTERRUPT_LSB 0 -#define WLAN_WDT_STATUS_INTERRUPT_MASK 0x00000001 -#define WLAN_WDT_STATUS_INTERRUPT_GET(x) (((x) & WLAN_WDT_STATUS_INTERRUPT_MASK) >> WLAN_WDT_STATUS_INTERRUPT_LSB) -#define WLAN_WDT_STATUS_INTERRUPT_SET(x) (((x) << WLAN_WDT_STATUS_INTERRUPT_LSB) & WLAN_WDT_STATUS_INTERRUPT_MASK) - -#define WLAN_WDT_ADDRESS 0x00000038 -#define WLAN_WDT_OFFSET 0x00000038 -#define WLAN_WDT_TARGET_MSB 21 -#define WLAN_WDT_TARGET_LSB 0 -#define WLAN_WDT_TARGET_MASK 0x003fffff -#define WLAN_WDT_TARGET_GET(x) (((x) & WLAN_WDT_TARGET_MASK) >> WLAN_WDT_TARGET_LSB) -#define WLAN_WDT_TARGET_SET(x) (((x) << WLAN_WDT_TARGET_LSB) & WLAN_WDT_TARGET_MASK) - -#define WLAN_WDT_COUNT_ADDRESS 0x0000003c -#define WLAN_WDT_COUNT_OFFSET 0x0000003c -#define WLAN_WDT_COUNT_VALUE_MSB 21 -#define WLAN_WDT_COUNT_VALUE_LSB 0 -#define WLAN_WDT_COUNT_VALUE_MASK 0x003fffff -#define WLAN_WDT_COUNT_VALUE_GET(x) (((x) & WLAN_WDT_COUNT_VALUE_MASK) >> WLAN_WDT_COUNT_VALUE_LSB) -#define WLAN_WDT_COUNT_VALUE_SET(x) (((x) << WLAN_WDT_COUNT_VALUE_LSB) & WLAN_WDT_COUNT_VALUE_MASK) - -#define WLAN_WDT_RESET_ADDRESS 0x00000040 -#define WLAN_WDT_RESET_OFFSET 0x00000040 -#define WLAN_WDT_RESET_VALUE_MSB 0 -#define WLAN_WDT_RESET_VALUE_LSB 0 -#define WLAN_WDT_RESET_VALUE_MASK 0x00000001 -#define WLAN_WDT_RESET_VALUE_GET(x) (((x) & WLAN_WDT_RESET_VALUE_MASK) >> WLAN_WDT_RESET_VALUE_LSB) -#define WLAN_WDT_RESET_VALUE_SET(x) (((x) << WLAN_WDT_RESET_VALUE_LSB) & WLAN_WDT_RESET_VALUE_MASK) - -#define WLAN_INT_STATUS_ADDRESS 0x00000044 -#define WLAN_INT_STATUS_OFFSET 0x00000044 -#define WLAN_INT_STATUS_HCI_UART_MSB 21 -#define WLAN_INT_STATUS_HCI_UART_LSB 21 -#define WLAN_INT_STATUS_HCI_UART_MASK 0x00200000 -#define WLAN_INT_STATUS_HCI_UART_GET(x) (((x) & WLAN_INT_STATUS_HCI_UART_MASK) >> WLAN_INT_STATUS_HCI_UART_LSB) -#define WLAN_INT_STATUS_HCI_UART_SET(x) (((x) << WLAN_INT_STATUS_HCI_UART_LSB) & WLAN_INT_STATUS_HCI_UART_MASK) -#define WLAN_INT_STATUS_THERM_MSB 20 -#define WLAN_INT_STATUS_THERM_LSB 20 -#define WLAN_INT_STATUS_THERM_MASK 0x00100000 -#define WLAN_INT_STATUS_THERM_GET(x) (((x) & WLAN_INT_STATUS_THERM_MASK) >> WLAN_INT_STATUS_THERM_LSB) -#define WLAN_INT_STATUS_THERM_SET(x) (((x) << WLAN_INT_STATUS_THERM_LSB) & WLAN_INT_STATUS_THERM_MASK) -#define WLAN_INT_STATUS_EFUSE_OVERWRITE_MSB 19 -#define WLAN_INT_STATUS_EFUSE_OVERWRITE_LSB 19 -#define WLAN_INT_STATUS_EFUSE_OVERWRITE_MASK 0x00080000 -#define WLAN_INT_STATUS_EFUSE_OVERWRITE_GET(x) (((x) & WLAN_INT_STATUS_EFUSE_OVERWRITE_MASK) >> WLAN_INT_STATUS_EFUSE_OVERWRITE_LSB) -#define WLAN_INT_STATUS_EFUSE_OVERWRITE_SET(x) (((x) << WLAN_INT_STATUS_EFUSE_OVERWRITE_LSB) & WLAN_INT_STATUS_EFUSE_OVERWRITE_MASK) -#define WLAN_INT_STATUS_UART_MBOX_MSB 18 -#define WLAN_INT_STATUS_UART_MBOX_LSB 18 -#define WLAN_INT_STATUS_UART_MBOX_MASK 0x00040000 -#define WLAN_INT_STATUS_UART_MBOX_GET(x) (((x) & WLAN_INT_STATUS_UART_MBOX_MASK) >> WLAN_INT_STATUS_UART_MBOX_LSB) -#define WLAN_INT_STATUS_UART_MBOX_SET(x) (((x) << WLAN_INT_STATUS_UART_MBOX_LSB) & WLAN_INT_STATUS_UART_MBOX_MASK) -#define WLAN_INT_STATUS_GENERIC_MBOX_MSB 17 -#define WLAN_INT_STATUS_GENERIC_MBOX_LSB 17 -#define WLAN_INT_STATUS_GENERIC_MBOX_MASK 0x00020000 -#define WLAN_INT_STATUS_GENERIC_MBOX_GET(x) (((x) & WLAN_INT_STATUS_GENERIC_MBOX_MASK) >> WLAN_INT_STATUS_GENERIC_MBOX_LSB) -#define WLAN_INT_STATUS_GENERIC_MBOX_SET(x) (((x) << WLAN_INT_STATUS_GENERIC_MBOX_LSB) & WLAN_INT_STATUS_GENERIC_MBOX_MASK) -#define WLAN_INT_STATUS_RDMA_MSB 16 -#define WLAN_INT_STATUS_RDMA_LSB 16 -#define WLAN_INT_STATUS_RDMA_MASK 0x00010000 -#define WLAN_INT_STATUS_RDMA_GET(x) (((x) & WLAN_INT_STATUS_RDMA_MASK) >> WLAN_INT_STATUS_RDMA_LSB) -#define WLAN_INT_STATUS_RDMA_SET(x) (((x) << WLAN_INT_STATUS_RDMA_LSB) & WLAN_INT_STATUS_RDMA_MASK) -#define WLAN_INT_STATUS_BTCOEX_MSB 15 -#define WLAN_INT_STATUS_BTCOEX_LSB 15 -#define WLAN_INT_STATUS_BTCOEX_MASK 0x00008000 -#define WLAN_INT_STATUS_BTCOEX_GET(x) (((x) & WLAN_INT_STATUS_BTCOEX_MASK) >> WLAN_INT_STATUS_BTCOEX_LSB) -#define WLAN_INT_STATUS_BTCOEX_SET(x) (((x) << WLAN_INT_STATUS_BTCOEX_LSB) & WLAN_INT_STATUS_BTCOEX_MASK) -#define WLAN_INT_STATUS_RTC_POWER_MSB 14 -#define WLAN_INT_STATUS_RTC_POWER_LSB 14 -#define WLAN_INT_STATUS_RTC_POWER_MASK 0x00004000 -#define WLAN_INT_STATUS_RTC_POWER_GET(x) (((x) & WLAN_INT_STATUS_RTC_POWER_MASK) >> WLAN_INT_STATUS_RTC_POWER_LSB) -#define WLAN_INT_STATUS_RTC_POWER_SET(x) (((x) << WLAN_INT_STATUS_RTC_POWER_LSB) & WLAN_INT_STATUS_RTC_POWER_MASK) -#define WLAN_INT_STATUS_MAC_MSB 13 -#define WLAN_INT_STATUS_MAC_LSB 13 -#define WLAN_INT_STATUS_MAC_MASK 0x00002000 -#define WLAN_INT_STATUS_MAC_GET(x) (((x) & WLAN_INT_STATUS_MAC_MASK) >> WLAN_INT_STATUS_MAC_LSB) -#define WLAN_INT_STATUS_MAC_SET(x) (((x) << WLAN_INT_STATUS_MAC_LSB) & WLAN_INT_STATUS_MAC_MASK) -#define WLAN_INT_STATUS_MAILBOX_MSB 12 -#define WLAN_INT_STATUS_MAILBOX_LSB 12 -#define WLAN_INT_STATUS_MAILBOX_MASK 0x00001000 -#define WLAN_INT_STATUS_MAILBOX_GET(x) (((x) & WLAN_INT_STATUS_MAILBOX_MASK) >> WLAN_INT_STATUS_MAILBOX_LSB) -#define WLAN_INT_STATUS_MAILBOX_SET(x) (((x) << WLAN_INT_STATUS_MAILBOX_LSB) & WLAN_INT_STATUS_MAILBOX_MASK) -#define WLAN_INT_STATUS_RTC_ALARM_MSB 11 -#define WLAN_INT_STATUS_RTC_ALARM_LSB 11 -#define WLAN_INT_STATUS_RTC_ALARM_MASK 0x00000800 -#define WLAN_INT_STATUS_RTC_ALARM_GET(x) (((x) & WLAN_INT_STATUS_RTC_ALARM_MASK) >> WLAN_INT_STATUS_RTC_ALARM_LSB) -#define WLAN_INT_STATUS_RTC_ALARM_SET(x) (((x) << WLAN_INT_STATUS_RTC_ALARM_LSB) & WLAN_INT_STATUS_RTC_ALARM_MASK) -#define WLAN_INT_STATUS_HF_TIMER_MSB 10 -#define WLAN_INT_STATUS_HF_TIMER_LSB 10 -#define WLAN_INT_STATUS_HF_TIMER_MASK 0x00000400 -#define WLAN_INT_STATUS_HF_TIMER_GET(x) (((x) & WLAN_INT_STATUS_HF_TIMER_MASK) >> WLAN_INT_STATUS_HF_TIMER_LSB) -#define WLAN_INT_STATUS_HF_TIMER_SET(x) (((x) << WLAN_INT_STATUS_HF_TIMER_LSB) & WLAN_INT_STATUS_HF_TIMER_MASK) -#define WLAN_INT_STATUS_LF_TIMER3_MSB 9 -#define WLAN_INT_STATUS_LF_TIMER3_LSB 9 -#define WLAN_INT_STATUS_LF_TIMER3_MASK 0x00000200 -#define WLAN_INT_STATUS_LF_TIMER3_GET(x) (((x) & WLAN_INT_STATUS_LF_TIMER3_MASK) >> WLAN_INT_STATUS_LF_TIMER3_LSB) -#define WLAN_INT_STATUS_LF_TIMER3_SET(x) (((x) << WLAN_INT_STATUS_LF_TIMER3_LSB) & WLAN_INT_STATUS_LF_TIMER3_MASK) -#define WLAN_INT_STATUS_LF_TIMER2_MSB 8 -#define WLAN_INT_STATUS_LF_TIMER2_LSB 8 -#define WLAN_INT_STATUS_LF_TIMER2_MASK 0x00000100 -#define WLAN_INT_STATUS_LF_TIMER2_GET(x) (((x) & WLAN_INT_STATUS_LF_TIMER2_MASK) >> WLAN_INT_STATUS_LF_TIMER2_LSB) -#define WLAN_INT_STATUS_LF_TIMER2_SET(x) (((x) << WLAN_INT_STATUS_LF_TIMER2_LSB) & WLAN_INT_STATUS_LF_TIMER2_MASK) -#define WLAN_INT_STATUS_LF_TIMER1_MSB 7 -#define WLAN_INT_STATUS_LF_TIMER1_LSB 7 -#define WLAN_INT_STATUS_LF_TIMER1_MASK 0x00000080 -#define WLAN_INT_STATUS_LF_TIMER1_GET(x) (((x) & WLAN_INT_STATUS_LF_TIMER1_MASK) >> WLAN_INT_STATUS_LF_TIMER1_LSB) -#define WLAN_INT_STATUS_LF_TIMER1_SET(x) (((x) << WLAN_INT_STATUS_LF_TIMER1_LSB) & WLAN_INT_STATUS_LF_TIMER1_MASK) -#define WLAN_INT_STATUS_LF_TIMER0_MSB 6 -#define WLAN_INT_STATUS_LF_TIMER0_LSB 6 -#define WLAN_INT_STATUS_LF_TIMER0_MASK 0x00000040 -#define WLAN_INT_STATUS_LF_TIMER0_GET(x) (((x) & WLAN_INT_STATUS_LF_TIMER0_MASK) >> WLAN_INT_STATUS_LF_TIMER0_LSB) -#define WLAN_INT_STATUS_LF_TIMER0_SET(x) (((x) << WLAN_INT_STATUS_LF_TIMER0_LSB) & WLAN_INT_STATUS_LF_TIMER0_MASK) -#define WLAN_INT_STATUS_KEYPAD_MSB 5 -#define WLAN_INT_STATUS_KEYPAD_LSB 5 -#define WLAN_INT_STATUS_KEYPAD_MASK 0x00000020 -#define WLAN_INT_STATUS_KEYPAD_GET(x) (((x) & WLAN_INT_STATUS_KEYPAD_MASK) >> WLAN_INT_STATUS_KEYPAD_LSB) -#define WLAN_INT_STATUS_KEYPAD_SET(x) (((x) << WLAN_INT_STATUS_KEYPAD_LSB) & WLAN_INT_STATUS_KEYPAD_MASK) -#define WLAN_INT_STATUS_SI_MSB 4 -#define WLAN_INT_STATUS_SI_LSB 4 -#define WLAN_INT_STATUS_SI_MASK 0x00000010 -#define WLAN_INT_STATUS_SI_GET(x) (((x) & WLAN_INT_STATUS_SI_MASK) >> WLAN_INT_STATUS_SI_LSB) -#define WLAN_INT_STATUS_SI_SET(x) (((x) << WLAN_INT_STATUS_SI_LSB) & WLAN_INT_STATUS_SI_MASK) -#define WLAN_INT_STATUS_GPIO_MSB 3 -#define WLAN_INT_STATUS_GPIO_LSB 3 -#define WLAN_INT_STATUS_GPIO_MASK 0x00000008 -#define WLAN_INT_STATUS_GPIO_GET(x) (((x) & WLAN_INT_STATUS_GPIO_MASK) >> WLAN_INT_STATUS_GPIO_LSB) -#define WLAN_INT_STATUS_GPIO_SET(x) (((x) << WLAN_INT_STATUS_GPIO_LSB) & WLAN_INT_STATUS_GPIO_MASK) -#define WLAN_INT_STATUS_UART_MSB 2 -#define WLAN_INT_STATUS_UART_LSB 2 -#define WLAN_INT_STATUS_UART_MASK 0x00000004 -#define WLAN_INT_STATUS_UART_GET(x) (((x) & WLAN_INT_STATUS_UART_MASK) >> WLAN_INT_STATUS_UART_LSB) -#define WLAN_INT_STATUS_UART_SET(x) (((x) << WLAN_INT_STATUS_UART_LSB) & WLAN_INT_STATUS_UART_MASK) -#define WLAN_INT_STATUS_ERROR_MSB 1 -#define WLAN_INT_STATUS_ERROR_LSB 1 -#define WLAN_INT_STATUS_ERROR_MASK 0x00000002 -#define WLAN_INT_STATUS_ERROR_GET(x) (((x) & WLAN_INT_STATUS_ERROR_MASK) >> WLAN_INT_STATUS_ERROR_LSB) -#define WLAN_INT_STATUS_ERROR_SET(x) (((x) << WLAN_INT_STATUS_ERROR_LSB) & WLAN_INT_STATUS_ERROR_MASK) -#define WLAN_INT_STATUS_WDT_INT_MSB 0 -#define WLAN_INT_STATUS_WDT_INT_LSB 0 -#define WLAN_INT_STATUS_WDT_INT_MASK 0x00000001 -#define WLAN_INT_STATUS_WDT_INT_GET(x) (((x) & WLAN_INT_STATUS_WDT_INT_MASK) >> WLAN_INT_STATUS_WDT_INT_LSB) -#define WLAN_INT_STATUS_WDT_INT_SET(x) (((x) << WLAN_INT_STATUS_WDT_INT_LSB) & WLAN_INT_STATUS_WDT_INT_MASK) - -#define WLAN_LF_TIMER0_ADDRESS 0x00000048 -#define WLAN_LF_TIMER0_OFFSET 0x00000048 -#define WLAN_LF_TIMER0_TARGET_MSB 31 -#define WLAN_LF_TIMER0_TARGET_LSB 0 -#define WLAN_LF_TIMER0_TARGET_MASK 0xffffffff -#define WLAN_LF_TIMER0_TARGET_GET(x) (((x) & WLAN_LF_TIMER0_TARGET_MASK) >> WLAN_LF_TIMER0_TARGET_LSB) -#define WLAN_LF_TIMER0_TARGET_SET(x) (((x) << WLAN_LF_TIMER0_TARGET_LSB) & WLAN_LF_TIMER0_TARGET_MASK) - -#define WLAN_LF_TIMER_COUNT0_ADDRESS 0x0000004c -#define WLAN_LF_TIMER_COUNT0_OFFSET 0x0000004c -#define WLAN_LF_TIMER_COUNT0_VALUE_MSB 31 -#define WLAN_LF_TIMER_COUNT0_VALUE_LSB 0 -#define WLAN_LF_TIMER_COUNT0_VALUE_MASK 0xffffffff -#define WLAN_LF_TIMER_COUNT0_VALUE_GET(x) (((x) & WLAN_LF_TIMER_COUNT0_VALUE_MASK) >> WLAN_LF_TIMER_COUNT0_VALUE_LSB) -#define WLAN_LF_TIMER_COUNT0_VALUE_SET(x) (((x) << WLAN_LF_TIMER_COUNT0_VALUE_LSB) & WLAN_LF_TIMER_COUNT0_VALUE_MASK) - -#define WLAN_LF_TIMER_CONTROL0_ADDRESS 0x00000050 -#define WLAN_LF_TIMER_CONTROL0_OFFSET 0x00000050 -#define WLAN_LF_TIMER_CONTROL0_ENABLE_MSB 2 -#define WLAN_LF_TIMER_CONTROL0_ENABLE_LSB 2 -#define WLAN_LF_TIMER_CONTROL0_ENABLE_MASK 0x00000004 -#define WLAN_LF_TIMER_CONTROL0_ENABLE_GET(x) (((x) & WLAN_LF_TIMER_CONTROL0_ENABLE_MASK) >> WLAN_LF_TIMER_CONTROL0_ENABLE_LSB) -#define WLAN_LF_TIMER_CONTROL0_ENABLE_SET(x) (((x) << WLAN_LF_TIMER_CONTROL0_ENABLE_LSB) & WLAN_LF_TIMER_CONTROL0_ENABLE_MASK) -#define WLAN_LF_TIMER_CONTROL0_AUTO_RESTART_MSB 1 -#define WLAN_LF_TIMER_CONTROL0_AUTO_RESTART_LSB 1 -#define WLAN_LF_TIMER_CONTROL0_AUTO_RESTART_MASK 0x00000002 -#define WLAN_LF_TIMER_CONTROL0_AUTO_RESTART_GET(x) (((x) & WLAN_LF_TIMER_CONTROL0_AUTO_RESTART_MASK) >> WLAN_LF_TIMER_CONTROL0_AUTO_RESTART_LSB) -#define WLAN_LF_TIMER_CONTROL0_AUTO_RESTART_SET(x) (((x) << WLAN_LF_TIMER_CONTROL0_AUTO_RESTART_LSB) & WLAN_LF_TIMER_CONTROL0_AUTO_RESTART_MASK) -#define WLAN_LF_TIMER_CONTROL0_RESET_MSB 0 -#define WLAN_LF_TIMER_CONTROL0_RESET_LSB 0 -#define WLAN_LF_TIMER_CONTROL0_RESET_MASK 0x00000001 -#define WLAN_LF_TIMER_CONTROL0_RESET_GET(x) (((x) & WLAN_LF_TIMER_CONTROL0_RESET_MASK) >> WLAN_LF_TIMER_CONTROL0_RESET_LSB) -#define WLAN_LF_TIMER_CONTROL0_RESET_SET(x) (((x) << WLAN_LF_TIMER_CONTROL0_RESET_LSB) & WLAN_LF_TIMER_CONTROL0_RESET_MASK) - -#define WLAN_LF_TIMER_STATUS0_ADDRESS 0x00000054 -#define WLAN_LF_TIMER_STATUS0_OFFSET 0x00000054 -#define WLAN_LF_TIMER_STATUS0_INTERRUPT_MSB 0 -#define WLAN_LF_TIMER_STATUS0_INTERRUPT_LSB 0 -#define WLAN_LF_TIMER_STATUS0_INTERRUPT_MASK 0x00000001 -#define WLAN_LF_TIMER_STATUS0_INTERRUPT_GET(x) (((x) & WLAN_LF_TIMER_STATUS0_INTERRUPT_MASK) >> WLAN_LF_TIMER_STATUS0_INTERRUPT_LSB) -#define WLAN_LF_TIMER_STATUS0_INTERRUPT_SET(x) (((x) << WLAN_LF_TIMER_STATUS0_INTERRUPT_LSB) & WLAN_LF_TIMER_STATUS0_INTERRUPT_MASK) - -#define WLAN_LF_TIMER1_ADDRESS 0x00000058 -#define WLAN_LF_TIMER1_OFFSET 0x00000058 -#define WLAN_LF_TIMER1_TARGET_MSB 31 -#define WLAN_LF_TIMER1_TARGET_LSB 0 -#define WLAN_LF_TIMER1_TARGET_MASK 0xffffffff -#define WLAN_LF_TIMER1_TARGET_GET(x) (((x) & WLAN_LF_TIMER1_TARGET_MASK) >> WLAN_LF_TIMER1_TARGET_LSB) -#define WLAN_LF_TIMER1_TARGET_SET(x) (((x) << WLAN_LF_TIMER1_TARGET_LSB) & WLAN_LF_TIMER1_TARGET_MASK) - -#define WLAN_LF_TIMER_COUNT1_ADDRESS 0x0000005c -#define WLAN_LF_TIMER_COUNT1_OFFSET 0x0000005c -#define WLAN_LF_TIMER_COUNT1_VALUE_MSB 31 -#define WLAN_LF_TIMER_COUNT1_VALUE_LSB 0 -#define WLAN_LF_TIMER_COUNT1_VALUE_MASK 0xffffffff -#define WLAN_LF_TIMER_COUNT1_VALUE_GET(x) (((x) & WLAN_LF_TIMER_COUNT1_VALUE_MASK) >> WLAN_LF_TIMER_COUNT1_VALUE_LSB) -#define WLAN_LF_TIMER_COUNT1_VALUE_SET(x) (((x) << WLAN_LF_TIMER_COUNT1_VALUE_LSB) & WLAN_LF_TIMER_COUNT1_VALUE_MASK) - -#define WLAN_LF_TIMER_CONTROL1_ADDRESS 0x00000060 -#define WLAN_LF_TIMER_CONTROL1_OFFSET 0x00000060 -#define WLAN_LF_TIMER_CONTROL1_ENABLE_MSB 2 -#define WLAN_LF_TIMER_CONTROL1_ENABLE_LSB 2 -#define WLAN_LF_TIMER_CONTROL1_ENABLE_MASK 0x00000004 -#define WLAN_LF_TIMER_CONTROL1_ENABLE_GET(x) (((x) & WLAN_LF_TIMER_CONTROL1_ENABLE_MASK) >> WLAN_LF_TIMER_CONTROL1_ENABLE_LSB) -#define WLAN_LF_TIMER_CONTROL1_ENABLE_SET(x) (((x) << WLAN_LF_TIMER_CONTROL1_ENABLE_LSB) & WLAN_LF_TIMER_CONTROL1_ENABLE_MASK) -#define WLAN_LF_TIMER_CONTROL1_AUTO_RESTART_MSB 1 -#define WLAN_LF_TIMER_CONTROL1_AUTO_RESTART_LSB 1 -#define WLAN_LF_TIMER_CONTROL1_AUTO_RESTART_MASK 0x00000002 -#define WLAN_LF_TIMER_CONTROL1_AUTO_RESTART_GET(x) (((x) & WLAN_LF_TIMER_CONTROL1_AUTO_RESTART_MASK) >> WLAN_LF_TIMER_CONTROL1_AUTO_RESTART_LSB) -#define WLAN_LF_TIMER_CONTROL1_AUTO_RESTART_SET(x) (((x) << WLAN_LF_TIMER_CONTROL1_AUTO_RESTART_LSB) & WLAN_LF_TIMER_CONTROL1_AUTO_RESTART_MASK) -#define WLAN_LF_TIMER_CONTROL1_RESET_MSB 0 -#define WLAN_LF_TIMER_CONTROL1_RESET_LSB 0 -#define WLAN_LF_TIMER_CONTROL1_RESET_MASK 0x00000001 -#define WLAN_LF_TIMER_CONTROL1_RESET_GET(x) (((x) & WLAN_LF_TIMER_CONTROL1_RESET_MASK) >> WLAN_LF_TIMER_CONTROL1_RESET_LSB) -#define WLAN_LF_TIMER_CONTROL1_RESET_SET(x) (((x) << WLAN_LF_TIMER_CONTROL1_RESET_LSB) & WLAN_LF_TIMER_CONTROL1_RESET_MASK) - -#define WLAN_LF_TIMER_STATUS1_ADDRESS 0x00000064 -#define WLAN_LF_TIMER_STATUS1_OFFSET 0x00000064 -#define WLAN_LF_TIMER_STATUS1_INTERRUPT_MSB 0 -#define WLAN_LF_TIMER_STATUS1_INTERRUPT_LSB 0 -#define WLAN_LF_TIMER_STATUS1_INTERRUPT_MASK 0x00000001 -#define WLAN_LF_TIMER_STATUS1_INTERRUPT_GET(x) (((x) & WLAN_LF_TIMER_STATUS1_INTERRUPT_MASK) >> WLAN_LF_TIMER_STATUS1_INTERRUPT_LSB) -#define WLAN_LF_TIMER_STATUS1_INTERRUPT_SET(x) (((x) << WLAN_LF_TIMER_STATUS1_INTERRUPT_LSB) & WLAN_LF_TIMER_STATUS1_INTERRUPT_MASK) - -#define WLAN_LF_TIMER2_ADDRESS 0x00000068 -#define WLAN_LF_TIMER2_OFFSET 0x00000068 -#define WLAN_LF_TIMER2_TARGET_MSB 31 -#define WLAN_LF_TIMER2_TARGET_LSB 0 -#define WLAN_LF_TIMER2_TARGET_MASK 0xffffffff -#define WLAN_LF_TIMER2_TARGET_GET(x) (((x) & WLAN_LF_TIMER2_TARGET_MASK) >> WLAN_LF_TIMER2_TARGET_LSB) -#define WLAN_LF_TIMER2_TARGET_SET(x) (((x) << WLAN_LF_TIMER2_TARGET_LSB) & WLAN_LF_TIMER2_TARGET_MASK) - -#define WLAN_LF_TIMER_COUNT2_ADDRESS 0x0000006c -#define WLAN_LF_TIMER_COUNT2_OFFSET 0x0000006c -#define WLAN_LF_TIMER_COUNT2_VALUE_MSB 31 -#define WLAN_LF_TIMER_COUNT2_VALUE_LSB 0 -#define WLAN_LF_TIMER_COUNT2_VALUE_MASK 0xffffffff -#define WLAN_LF_TIMER_COUNT2_VALUE_GET(x) (((x) & WLAN_LF_TIMER_COUNT2_VALUE_MASK) >> WLAN_LF_TIMER_COUNT2_VALUE_LSB) -#define WLAN_LF_TIMER_COUNT2_VALUE_SET(x) (((x) << WLAN_LF_TIMER_COUNT2_VALUE_LSB) & WLAN_LF_TIMER_COUNT2_VALUE_MASK) - -#define WLAN_LF_TIMER_CONTROL2_ADDRESS 0x00000070 -#define WLAN_LF_TIMER_CONTROL2_OFFSET 0x00000070 -#define WLAN_LF_TIMER_CONTROL2_ENABLE_MSB 2 -#define WLAN_LF_TIMER_CONTROL2_ENABLE_LSB 2 -#define WLAN_LF_TIMER_CONTROL2_ENABLE_MASK 0x00000004 -#define WLAN_LF_TIMER_CONTROL2_ENABLE_GET(x) (((x) & WLAN_LF_TIMER_CONTROL2_ENABLE_MASK) >> WLAN_LF_TIMER_CONTROL2_ENABLE_LSB) -#define WLAN_LF_TIMER_CONTROL2_ENABLE_SET(x) (((x) << WLAN_LF_TIMER_CONTROL2_ENABLE_LSB) & WLAN_LF_TIMER_CONTROL2_ENABLE_MASK) -#define WLAN_LF_TIMER_CONTROL2_AUTO_RESTART_MSB 1 -#define WLAN_LF_TIMER_CONTROL2_AUTO_RESTART_LSB 1 -#define WLAN_LF_TIMER_CONTROL2_AUTO_RESTART_MASK 0x00000002 -#define WLAN_LF_TIMER_CONTROL2_AUTO_RESTART_GET(x) (((x) & WLAN_LF_TIMER_CONTROL2_AUTO_RESTART_MASK) >> WLAN_LF_TIMER_CONTROL2_AUTO_RESTART_LSB) -#define WLAN_LF_TIMER_CONTROL2_AUTO_RESTART_SET(x) (((x) << WLAN_LF_TIMER_CONTROL2_AUTO_RESTART_LSB) & WLAN_LF_TIMER_CONTROL2_AUTO_RESTART_MASK) -#define WLAN_LF_TIMER_CONTROL2_RESET_MSB 0 -#define WLAN_LF_TIMER_CONTROL2_RESET_LSB 0 -#define WLAN_LF_TIMER_CONTROL2_RESET_MASK 0x00000001 -#define WLAN_LF_TIMER_CONTROL2_RESET_GET(x) (((x) & WLAN_LF_TIMER_CONTROL2_RESET_MASK) >> WLAN_LF_TIMER_CONTROL2_RESET_LSB) -#define WLAN_LF_TIMER_CONTROL2_RESET_SET(x) (((x) << WLAN_LF_TIMER_CONTROL2_RESET_LSB) & WLAN_LF_TIMER_CONTROL2_RESET_MASK) - -#define WLAN_LF_TIMER_STATUS2_ADDRESS 0x00000074 -#define WLAN_LF_TIMER_STATUS2_OFFSET 0x00000074 -#define WLAN_LF_TIMER_STATUS2_INTERRUPT_MSB 0 -#define WLAN_LF_TIMER_STATUS2_INTERRUPT_LSB 0 -#define WLAN_LF_TIMER_STATUS2_INTERRUPT_MASK 0x00000001 -#define WLAN_LF_TIMER_STATUS2_INTERRUPT_GET(x) (((x) & WLAN_LF_TIMER_STATUS2_INTERRUPT_MASK) >> WLAN_LF_TIMER_STATUS2_INTERRUPT_LSB) -#define WLAN_LF_TIMER_STATUS2_INTERRUPT_SET(x) (((x) << WLAN_LF_TIMER_STATUS2_INTERRUPT_LSB) & WLAN_LF_TIMER_STATUS2_INTERRUPT_MASK) - -#define WLAN_LF_TIMER3_ADDRESS 0x00000078 -#define WLAN_LF_TIMER3_OFFSET 0x00000078 -#define WLAN_LF_TIMER3_TARGET_MSB 31 -#define WLAN_LF_TIMER3_TARGET_LSB 0 -#define WLAN_LF_TIMER3_TARGET_MASK 0xffffffff -#define WLAN_LF_TIMER3_TARGET_GET(x) (((x) & WLAN_LF_TIMER3_TARGET_MASK) >> WLAN_LF_TIMER3_TARGET_LSB) -#define WLAN_LF_TIMER3_TARGET_SET(x) (((x) << WLAN_LF_TIMER3_TARGET_LSB) & WLAN_LF_TIMER3_TARGET_MASK) - -#define WLAN_LF_TIMER_COUNT3_ADDRESS 0x0000007c -#define WLAN_LF_TIMER_COUNT3_OFFSET 0x0000007c -#define WLAN_LF_TIMER_COUNT3_VALUE_MSB 31 -#define WLAN_LF_TIMER_COUNT3_VALUE_LSB 0 -#define WLAN_LF_TIMER_COUNT3_VALUE_MASK 0xffffffff -#define WLAN_LF_TIMER_COUNT3_VALUE_GET(x) (((x) & WLAN_LF_TIMER_COUNT3_VALUE_MASK) >> WLAN_LF_TIMER_COUNT3_VALUE_LSB) -#define WLAN_LF_TIMER_COUNT3_VALUE_SET(x) (((x) << WLAN_LF_TIMER_COUNT3_VALUE_LSB) & WLAN_LF_TIMER_COUNT3_VALUE_MASK) - -#define WLAN_LF_TIMER_CONTROL3_ADDRESS 0x00000080 -#define WLAN_LF_TIMER_CONTROL3_OFFSET 0x00000080 -#define WLAN_LF_TIMER_CONTROL3_ENABLE_MSB 2 -#define WLAN_LF_TIMER_CONTROL3_ENABLE_LSB 2 -#define WLAN_LF_TIMER_CONTROL3_ENABLE_MASK 0x00000004 -#define WLAN_LF_TIMER_CONTROL3_ENABLE_GET(x) (((x) & WLAN_LF_TIMER_CONTROL3_ENABLE_MASK) >> WLAN_LF_TIMER_CONTROL3_ENABLE_LSB) -#define WLAN_LF_TIMER_CONTROL3_ENABLE_SET(x) (((x) << WLAN_LF_TIMER_CONTROL3_ENABLE_LSB) & WLAN_LF_TIMER_CONTROL3_ENABLE_MASK) -#define WLAN_LF_TIMER_CONTROL3_AUTO_RESTART_MSB 1 -#define WLAN_LF_TIMER_CONTROL3_AUTO_RESTART_LSB 1 -#define WLAN_LF_TIMER_CONTROL3_AUTO_RESTART_MASK 0x00000002 -#define WLAN_LF_TIMER_CONTROL3_AUTO_RESTART_GET(x) (((x) & WLAN_LF_TIMER_CONTROL3_AUTO_RESTART_MASK) >> WLAN_LF_TIMER_CONTROL3_AUTO_RESTART_LSB) -#define WLAN_LF_TIMER_CONTROL3_AUTO_RESTART_SET(x) (((x) << WLAN_LF_TIMER_CONTROL3_AUTO_RESTART_LSB) & WLAN_LF_TIMER_CONTROL3_AUTO_RESTART_MASK) -#define WLAN_LF_TIMER_CONTROL3_RESET_MSB 0 -#define WLAN_LF_TIMER_CONTROL3_RESET_LSB 0 -#define WLAN_LF_TIMER_CONTROL3_RESET_MASK 0x00000001 -#define WLAN_LF_TIMER_CONTROL3_RESET_GET(x) (((x) & WLAN_LF_TIMER_CONTROL3_RESET_MASK) >> WLAN_LF_TIMER_CONTROL3_RESET_LSB) -#define WLAN_LF_TIMER_CONTROL3_RESET_SET(x) (((x) << WLAN_LF_TIMER_CONTROL3_RESET_LSB) & WLAN_LF_TIMER_CONTROL3_RESET_MASK) - -#define WLAN_LF_TIMER_STATUS3_ADDRESS 0x00000084 -#define WLAN_LF_TIMER_STATUS3_OFFSET 0x00000084 -#define WLAN_LF_TIMER_STATUS3_INTERRUPT_MSB 0 -#define WLAN_LF_TIMER_STATUS3_INTERRUPT_LSB 0 -#define WLAN_LF_TIMER_STATUS3_INTERRUPT_MASK 0x00000001 -#define WLAN_LF_TIMER_STATUS3_INTERRUPT_GET(x) (((x) & WLAN_LF_TIMER_STATUS3_INTERRUPT_MASK) >> WLAN_LF_TIMER_STATUS3_INTERRUPT_LSB) -#define WLAN_LF_TIMER_STATUS3_INTERRUPT_SET(x) (((x) << WLAN_LF_TIMER_STATUS3_INTERRUPT_LSB) & WLAN_LF_TIMER_STATUS3_INTERRUPT_MASK) - -#define WLAN_HF_TIMER_ADDRESS 0x00000088 -#define WLAN_HF_TIMER_OFFSET 0x00000088 -#define WLAN_HF_TIMER_TARGET_MSB 31 -#define WLAN_HF_TIMER_TARGET_LSB 12 -#define WLAN_HF_TIMER_TARGET_MASK 0xfffff000 -#define WLAN_HF_TIMER_TARGET_GET(x) (((x) & WLAN_HF_TIMER_TARGET_MASK) >> WLAN_HF_TIMER_TARGET_LSB) -#define WLAN_HF_TIMER_TARGET_SET(x) (((x) << WLAN_HF_TIMER_TARGET_LSB) & WLAN_HF_TIMER_TARGET_MASK) - -#define WLAN_HF_TIMER_COUNT_ADDRESS 0x0000008c -#define WLAN_HF_TIMER_COUNT_OFFSET 0x0000008c -#define WLAN_HF_TIMER_COUNT_VALUE_MSB 31 -#define WLAN_HF_TIMER_COUNT_VALUE_LSB 12 -#define WLAN_HF_TIMER_COUNT_VALUE_MASK 0xfffff000 -#define WLAN_HF_TIMER_COUNT_VALUE_GET(x) (((x) & WLAN_HF_TIMER_COUNT_VALUE_MASK) >> WLAN_HF_TIMER_COUNT_VALUE_LSB) -#define WLAN_HF_TIMER_COUNT_VALUE_SET(x) (((x) << WLAN_HF_TIMER_COUNT_VALUE_LSB) & WLAN_HF_TIMER_COUNT_VALUE_MASK) - -#define WLAN_HF_LF_COUNT_ADDRESS 0x00000090 -#define WLAN_HF_LF_COUNT_OFFSET 0x00000090 -#define WLAN_HF_LF_COUNT_VALUE_MSB 31 -#define WLAN_HF_LF_COUNT_VALUE_LSB 0 -#define WLAN_HF_LF_COUNT_VALUE_MASK 0xffffffff -#define WLAN_HF_LF_COUNT_VALUE_GET(x) (((x) & WLAN_HF_LF_COUNT_VALUE_MASK) >> WLAN_HF_LF_COUNT_VALUE_LSB) -#define WLAN_HF_LF_COUNT_VALUE_SET(x) (((x) << WLAN_HF_LF_COUNT_VALUE_LSB) & WLAN_HF_LF_COUNT_VALUE_MASK) - -#define WLAN_HF_TIMER_CONTROL_ADDRESS 0x00000094 -#define WLAN_HF_TIMER_CONTROL_OFFSET 0x00000094 -#define WLAN_HF_TIMER_CONTROL_ENABLE_MSB 3 -#define WLAN_HF_TIMER_CONTROL_ENABLE_LSB 3 -#define WLAN_HF_TIMER_CONTROL_ENABLE_MASK 0x00000008 -#define WLAN_HF_TIMER_CONTROL_ENABLE_GET(x) (((x) & WLAN_HF_TIMER_CONTROL_ENABLE_MASK) >> WLAN_HF_TIMER_CONTROL_ENABLE_LSB) -#define WLAN_HF_TIMER_CONTROL_ENABLE_SET(x) (((x) << WLAN_HF_TIMER_CONTROL_ENABLE_LSB) & WLAN_HF_TIMER_CONTROL_ENABLE_MASK) -#define WLAN_HF_TIMER_CONTROL_ON_MSB 2 -#define WLAN_HF_TIMER_CONTROL_ON_LSB 2 -#define WLAN_HF_TIMER_CONTROL_ON_MASK 0x00000004 -#define WLAN_HF_TIMER_CONTROL_ON_GET(x) (((x) & WLAN_HF_TIMER_CONTROL_ON_MASK) >> WLAN_HF_TIMER_CONTROL_ON_LSB) -#define WLAN_HF_TIMER_CONTROL_ON_SET(x) (((x) << WLAN_HF_TIMER_CONTROL_ON_LSB) & WLAN_HF_TIMER_CONTROL_ON_MASK) -#define WLAN_HF_TIMER_CONTROL_AUTO_RESTART_MSB 1 -#define WLAN_HF_TIMER_CONTROL_AUTO_RESTART_LSB 1 -#define WLAN_HF_TIMER_CONTROL_AUTO_RESTART_MASK 0x00000002 -#define WLAN_HF_TIMER_CONTROL_AUTO_RESTART_GET(x) (((x) & WLAN_HF_TIMER_CONTROL_AUTO_RESTART_MASK) >> WLAN_HF_TIMER_CONTROL_AUTO_RESTART_LSB) -#define WLAN_HF_TIMER_CONTROL_AUTO_RESTART_SET(x) (((x) << WLAN_HF_TIMER_CONTROL_AUTO_RESTART_LSB) & WLAN_HF_TIMER_CONTROL_AUTO_RESTART_MASK) -#define WLAN_HF_TIMER_CONTROL_RESET_MSB 0 -#define WLAN_HF_TIMER_CONTROL_RESET_LSB 0 -#define WLAN_HF_TIMER_CONTROL_RESET_MASK 0x00000001 -#define WLAN_HF_TIMER_CONTROL_RESET_GET(x) (((x) & WLAN_HF_TIMER_CONTROL_RESET_MASK) >> WLAN_HF_TIMER_CONTROL_RESET_LSB) -#define WLAN_HF_TIMER_CONTROL_RESET_SET(x) (((x) << WLAN_HF_TIMER_CONTROL_RESET_LSB) & WLAN_HF_TIMER_CONTROL_RESET_MASK) - -#define WLAN_HF_TIMER_STATUS_ADDRESS 0x00000098 -#define WLAN_HF_TIMER_STATUS_OFFSET 0x00000098 -#define WLAN_HF_TIMER_STATUS_INTERRUPT_MSB 0 -#define WLAN_HF_TIMER_STATUS_INTERRUPT_LSB 0 -#define WLAN_HF_TIMER_STATUS_INTERRUPT_MASK 0x00000001 -#define WLAN_HF_TIMER_STATUS_INTERRUPT_GET(x) (((x) & WLAN_HF_TIMER_STATUS_INTERRUPT_MASK) >> WLAN_HF_TIMER_STATUS_INTERRUPT_LSB) -#define WLAN_HF_TIMER_STATUS_INTERRUPT_SET(x) (((x) << WLAN_HF_TIMER_STATUS_INTERRUPT_LSB) & WLAN_HF_TIMER_STATUS_INTERRUPT_MASK) - -#define WLAN_RTC_CONTROL_ADDRESS 0x0000009c -#define WLAN_RTC_CONTROL_OFFSET 0x0000009c -#define WLAN_RTC_CONTROL_ENABLE_MSB 2 -#define WLAN_RTC_CONTROL_ENABLE_LSB 2 -#define WLAN_RTC_CONTROL_ENABLE_MASK 0x00000004 -#define WLAN_RTC_CONTROL_ENABLE_GET(x) (((x) & WLAN_RTC_CONTROL_ENABLE_MASK) >> WLAN_RTC_CONTROL_ENABLE_LSB) -#define WLAN_RTC_CONTROL_ENABLE_SET(x) (((x) << WLAN_RTC_CONTROL_ENABLE_LSB) & WLAN_RTC_CONTROL_ENABLE_MASK) -#define WLAN_RTC_CONTROL_LOAD_RTC_MSB 1 -#define WLAN_RTC_CONTROL_LOAD_RTC_LSB 1 -#define WLAN_RTC_CONTROL_LOAD_RTC_MASK 0x00000002 -#define WLAN_RTC_CONTROL_LOAD_RTC_GET(x) (((x) & WLAN_RTC_CONTROL_LOAD_RTC_MASK) >> WLAN_RTC_CONTROL_LOAD_RTC_LSB) -#define WLAN_RTC_CONTROL_LOAD_RTC_SET(x) (((x) << WLAN_RTC_CONTROL_LOAD_RTC_LSB) & WLAN_RTC_CONTROL_LOAD_RTC_MASK) -#define WLAN_RTC_CONTROL_LOAD_ALARM_MSB 0 -#define WLAN_RTC_CONTROL_LOAD_ALARM_LSB 0 -#define WLAN_RTC_CONTROL_LOAD_ALARM_MASK 0x00000001 -#define WLAN_RTC_CONTROL_LOAD_ALARM_GET(x) (((x) & WLAN_RTC_CONTROL_LOAD_ALARM_MASK) >> WLAN_RTC_CONTROL_LOAD_ALARM_LSB) -#define WLAN_RTC_CONTROL_LOAD_ALARM_SET(x) (((x) << WLAN_RTC_CONTROL_LOAD_ALARM_LSB) & WLAN_RTC_CONTROL_LOAD_ALARM_MASK) - -#define WLAN_RTC_TIME_ADDRESS 0x000000a0 -#define WLAN_RTC_TIME_OFFSET 0x000000a0 -#define WLAN_RTC_TIME_WEEK_DAY_MSB 26 -#define WLAN_RTC_TIME_WEEK_DAY_LSB 24 -#define WLAN_RTC_TIME_WEEK_DAY_MASK 0x07000000 -#define WLAN_RTC_TIME_WEEK_DAY_GET(x) (((x) & WLAN_RTC_TIME_WEEK_DAY_MASK) >> WLAN_RTC_TIME_WEEK_DAY_LSB) -#define WLAN_RTC_TIME_WEEK_DAY_SET(x) (((x) << WLAN_RTC_TIME_WEEK_DAY_LSB) & WLAN_RTC_TIME_WEEK_DAY_MASK) -#define WLAN_RTC_TIME_HOUR_MSB 21 -#define WLAN_RTC_TIME_HOUR_LSB 16 -#define WLAN_RTC_TIME_HOUR_MASK 0x003f0000 -#define WLAN_RTC_TIME_HOUR_GET(x) (((x) & WLAN_RTC_TIME_HOUR_MASK) >> WLAN_RTC_TIME_HOUR_LSB) -#define WLAN_RTC_TIME_HOUR_SET(x) (((x) << WLAN_RTC_TIME_HOUR_LSB) & WLAN_RTC_TIME_HOUR_MASK) -#define WLAN_RTC_TIME_MINUTE_MSB 14 -#define WLAN_RTC_TIME_MINUTE_LSB 8 -#define WLAN_RTC_TIME_MINUTE_MASK 0x00007f00 -#define WLAN_RTC_TIME_MINUTE_GET(x) (((x) & WLAN_RTC_TIME_MINUTE_MASK) >> WLAN_RTC_TIME_MINUTE_LSB) -#define WLAN_RTC_TIME_MINUTE_SET(x) (((x) << WLAN_RTC_TIME_MINUTE_LSB) & WLAN_RTC_TIME_MINUTE_MASK) -#define WLAN_RTC_TIME_SECOND_MSB 6 -#define WLAN_RTC_TIME_SECOND_LSB 0 -#define WLAN_RTC_TIME_SECOND_MASK 0x0000007f -#define WLAN_RTC_TIME_SECOND_GET(x) (((x) & WLAN_RTC_TIME_SECOND_MASK) >> WLAN_RTC_TIME_SECOND_LSB) -#define WLAN_RTC_TIME_SECOND_SET(x) (((x) << WLAN_RTC_TIME_SECOND_LSB) & WLAN_RTC_TIME_SECOND_MASK) - -#define WLAN_RTC_DATE_ADDRESS 0x000000a4 -#define WLAN_RTC_DATE_OFFSET 0x000000a4 -#define WLAN_RTC_DATE_YEAR_MSB 23 -#define WLAN_RTC_DATE_YEAR_LSB 16 -#define WLAN_RTC_DATE_YEAR_MASK 0x00ff0000 -#define WLAN_RTC_DATE_YEAR_GET(x) (((x) & WLAN_RTC_DATE_YEAR_MASK) >> WLAN_RTC_DATE_YEAR_LSB) -#define WLAN_RTC_DATE_YEAR_SET(x) (((x) << WLAN_RTC_DATE_YEAR_LSB) & WLAN_RTC_DATE_YEAR_MASK) -#define WLAN_RTC_DATE_MONTH_MSB 12 -#define WLAN_RTC_DATE_MONTH_LSB 8 -#define WLAN_RTC_DATE_MONTH_MASK 0x00001f00 -#define WLAN_RTC_DATE_MONTH_GET(x) (((x) & WLAN_RTC_DATE_MONTH_MASK) >> WLAN_RTC_DATE_MONTH_LSB) -#define WLAN_RTC_DATE_MONTH_SET(x) (((x) << WLAN_RTC_DATE_MONTH_LSB) & WLAN_RTC_DATE_MONTH_MASK) -#define WLAN_RTC_DATE_MONTH_DAY_MSB 5 -#define WLAN_RTC_DATE_MONTH_DAY_LSB 0 -#define WLAN_RTC_DATE_MONTH_DAY_MASK 0x0000003f -#define WLAN_RTC_DATE_MONTH_DAY_GET(x) (((x) & WLAN_RTC_DATE_MONTH_DAY_MASK) >> WLAN_RTC_DATE_MONTH_DAY_LSB) -#define WLAN_RTC_DATE_MONTH_DAY_SET(x) (((x) << WLAN_RTC_DATE_MONTH_DAY_LSB) & WLAN_RTC_DATE_MONTH_DAY_MASK) - -#define WLAN_RTC_SET_TIME_ADDRESS 0x000000a8 -#define WLAN_RTC_SET_TIME_OFFSET 0x000000a8 -#define WLAN_RTC_SET_TIME_WEEK_DAY_MSB 26 -#define WLAN_RTC_SET_TIME_WEEK_DAY_LSB 24 -#define WLAN_RTC_SET_TIME_WEEK_DAY_MASK 0x07000000 -#define WLAN_RTC_SET_TIME_WEEK_DAY_GET(x) (((x) & WLAN_RTC_SET_TIME_WEEK_DAY_MASK) >> WLAN_RTC_SET_TIME_WEEK_DAY_LSB) -#define WLAN_RTC_SET_TIME_WEEK_DAY_SET(x) (((x) << WLAN_RTC_SET_TIME_WEEK_DAY_LSB) & WLAN_RTC_SET_TIME_WEEK_DAY_MASK) -#define WLAN_RTC_SET_TIME_HOUR_MSB 21 -#define WLAN_RTC_SET_TIME_HOUR_LSB 16 -#define WLAN_RTC_SET_TIME_HOUR_MASK 0x003f0000 -#define WLAN_RTC_SET_TIME_HOUR_GET(x) (((x) & WLAN_RTC_SET_TIME_HOUR_MASK) >> WLAN_RTC_SET_TIME_HOUR_LSB) -#define WLAN_RTC_SET_TIME_HOUR_SET(x) (((x) << WLAN_RTC_SET_TIME_HOUR_LSB) & WLAN_RTC_SET_TIME_HOUR_MASK) -#define WLAN_RTC_SET_TIME_MINUTE_MSB 14 -#define WLAN_RTC_SET_TIME_MINUTE_LSB 8 -#define WLAN_RTC_SET_TIME_MINUTE_MASK 0x00007f00 -#define WLAN_RTC_SET_TIME_MINUTE_GET(x) (((x) & WLAN_RTC_SET_TIME_MINUTE_MASK) >> WLAN_RTC_SET_TIME_MINUTE_LSB) -#define WLAN_RTC_SET_TIME_MINUTE_SET(x) (((x) << WLAN_RTC_SET_TIME_MINUTE_LSB) & WLAN_RTC_SET_TIME_MINUTE_MASK) -#define WLAN_RTC_SET_TIME_SECOND_MSB 6 -#define WLAN_RTC_SET_TIME_SECOND_LSB 0 -#define WLAN_RTC_SET_TIME_SECOND_MASK 0x0000007f -#define WLAN_RTC_SET_TIME_SECOND_GET(x) (((x) & WLAN_RTC_SET_TIME_SECOND_MASK) >> WLAN_RTC_SET_TIME_SECOND_LSB) -#define WLAN_RTC_SET_TIME_SECOND_SET(x) (((x) << WLAN_RTC_SET_TIME_SECOND_LSB) & WLAN_RTC_SET_TIME_SECOND_MASK) - -#define WLAN_RTC_SET_DATE_ADDRESS 0x000000ac -#define WLAN_RTC_SET_DATE_OFFSET 0x000000ac -#define WLAN_RTC_SET_DATE_YEAR_MSB 23 -#define WLAN_RTC_SET_DATE_YEAR_LSB 16 -#define WLAN_RTC_SET_DATE_YEAR_MASK 0x00ff0000 -#define WLAN_RTC_SET_DATE_YEAR_GET(x) (((x) & WLAN_RTC_SET_DATE_YEAR_MASK) >> WLAN_RTC_SET_DATE_YEAR_LSB) -#define WLAN_RTC_SET_DATE_YEAR_SET(x) (((x) << WLAN_RTC_SET_DATE_YEAR_LSB) & WLAN_RTC_SET_DATE_YEAR_MASK) -#define WLAN_RTC_SET_DATE_MONTH_MSB 12 -#define WLAN_RTC_SET_DATE_MONTH_LSB 8 -#define WLAN_RTC_SET_DATE_MONTH_MASK 0x00001f00 -#define WLAN_RTC_SET_DATE_MONTH_GET(x) (((x) & WLAN_RTC_SET_DATE_MONTH_MASK) >> WLAN_RTC_SET_DATE_MONTH_LSB) -#define WLAN_RTC_SET_DATE_MONTH_SET(x) (((x) << WLAN_RTC_SET_DATE_MONTH_LSB) & WLAN_RTC_SET_DATE_MONTH_MASK) -#define WLAN_RTC_SET_DATE_MONTH_DAY_MSB 5 -#define WLAN_RTC_SET_DATE_MONTH_DAY_LSB 0 -#define WLAN_RTC_SET_DATE_MONTH_DAY_MASK 0x0000003f -#define WLAN_RTC_SET_DATE_MONTH_DAY_GET(x) (((x) & WLAN_RTC_SET_DATE_MONTH_DAY_MASK) >> WLAN_RTC_SET_DATE_MONTH_DAY_LSB) -#define WLAN_RTC_SET_DATE_MONTH_DAY_SET(x) (((x) << WLAN_RTC_SET_DATE_MONTH_DAY_LSB) & WLAN_RTC_SET_DATE_MONTH_DAY_MASK) - -#define WLAN_RTC_SET_ALARM_ADDRESS 0x000000b0 -#define WLAN_RTC_SET_ALARM_OFFSET 0x000000b0 -#define WLAN_RTC_SET_ALARM_HOUR_MSB 21 -#define WLAN_RTC_SET_ALARM_HOUR_LSB 16 -#define WLAN_RTC_SET_ALARM_HOUR_MASK 0x003f0000 -#define WLAN_RTC_SET_ALARM_HOUR_GET(x) (((x) & WLAN_RTC_SET_ALARM_HOUR_MASK) >> WLAN_RTC_SET_ALARM_HOUR_LSB) -#define WLAN_RTC_SET_ALARM_HOUR_SET(x) (((x) << WLAN_RTC_SET_ALARM_HOUR_LSB) & WLAN_RTC_SET_ALARM_HOUR_MASK) -#define WLAN_RTC_SET_ALARM_MINUTE_MSB 14 -#define WLAN_RTC_SET_ALARM_MINUTE_LSB 8 -#define WLAN_RTC_SET_ALARM_MINUTE_MASK 0x00007f00 -#define WLAN_RTC_SET_ALARM_MINUTE_GET(x) (((x) & WLAN_RTC_SET_ALARM_MINUTE_MASK) >> WLAN_RTC_SET_ALARM_MINUTE_LSB) -#define WLAN_RTC_SET_ALARM_MINUTE_SET(x) (((x) << WLAN_RTC_SET_ALARM_MINUTE_LSB) & WLAN_RTC_SET_ALARM_MINUTE_MASK) -#define WLAN_RTC_SET_ALARM_SECOND_MSB 6 -#define WLAN_RTC_SET_ALARM_SECOND_LSB 0 -#define WLAN_RTC_SET_ALARM_SECOND_MASK 0x0000007f -#define WLAN_RTC_SET_ALARM_SECOND_GET(x) (((x) & WLAN_RTC_SET_ALARM_SECOND_MASK) >> WLAN_RTC_SET_ALARM_SECOND_LSB) -#define WLAN_RTC_SET_ALARM_SECOND_SET(x) (((x) << WLAN_RTC_SET_ALARM_SECOND_LSB) & WLAN_RTC_SET_ALARM_SECOND_MASK) - -#define WLAN_RTC_CONFIG_ADDRESS 0x000000b4 -#define WLAN_RTC_CONFIG_OFFSET 0x000000b4 -#define WLAN_RTC_CONFIG_BCD_MSB 2 -#define WLAN_RTC_CONFIG_BCD_LSB 2 -#define WLAN_RTC_CONFIG_BCD_MASK 0x00000004 -#define WLAN_RTC_CONFIG_BCD_GET(x) (((x) & WLAN_RTC_CONFIG_BCD_MASK) >> WLAN_RTC_CONFIG_BCD_LSB) -#define WLAN_RTC_CONFIG_BCD_SET(x) (((x) << WLAN_RTC_CONFIG_BCD_LSB) & WLAN_RTC_CONFIG_BCD_MASK) -#define WLAN_RTC_CONFIG_TWELVE_HOUR_MSB 1 -#define WLAN_RTC_CONFIG_TWELVE_HOUR_LSB 1 -#define WLAN_RTC_CONFIG_TWELVE_HOUR_MASK 0x00000002 -#define WLAN_RTC_CONFIG_TWELVE_HOUR_GET(x) (((x) & WLAN_RTC_CONFIG_TWELVE_HOUR_MASK) >> WLAN_RTC_CONFIG_TWELVE_HOUR_LSB) -#define WLAN_RTC_CONFIG_TWELVE_HOUR_SET(x) (((x) << WLAN_RTC_CONFIG_TWELVE_HOUR_LSB) & WLAN_RTC_CONFIG_TWELVE_HOUR_MASK) -#define WLAN_RTC_CONFIG_DSE_MSB 0 -#define WLAN_RTC_CONFIG_DSE_LSB 0 -#define WLAN_RTC_CONFIG_DSE_MASK 0x00000001 -#define WLAN_RTC_CONFIG_DSE_GET(x) (((x) & WLAN_RTC_CONFIG_DSE_MASK) >> WLAN_RTC_CONFIG_DSE_LSB) -#define WLAN_RTC_CONFIG_DSE_SET(x) (((x) << WLAN_RTC_CONFIG_DSE_LSB) & WLAN_RTC_CONFIG_DSE_MASK) - -#define WLAN_RTC_ALARM_STATUS_ADDRESS 0x000000b8 -#define WLAN_RTC_ALARM_STATUS_OFFSET 0x000000b8 -#define WLAN_RTC_ALARM_STATUS_ENABLE_MSB 1 -#define WLAN_RTC_ALARM_STATUS_ENABLE_LSB 1 -#define WLAN_RTC_ALARM_STATUS_ENABLE_MASK 0x00000002 -#define WLAN_RTC_ALARM_STATUS_ENABLE_GET(x) (((x) & WLAN_RTC_ALARM_STATUS_ENABLE_MASK) >> WLAN_RTC_ALARM_STATUS_ENABLE_LSB) -#define WLAN_RTC_ALARM_STATUS_ENABLE_SET(x) (((x) << WLAN_RTC_ALARM_STATUS_ENABLE_LSB) & WLAN_RTC_ALARM_STATUS_ENABLE_MASK) -#define WLAN_RTC_ALARM_STATUS_INTERRUPT_MSB 0 -#define WLAN_RTC_ALARM_STATUS_INTERRUPT_LSB 0 -#define WLAN_RTC_ALARM_STATUS_INTERRUPT_MASK 0x00000001 -#define WLAN_RTC_ALARM_STATUS_INTERRUPT_GET(x) (((x) & WLAN_RTC_ALARM_STATUS_INTERRUPT_MASK) >> WLAN_RTC_ALARM_STATUS_INTERRUPT_LSB) -#define WLAN_RTC_ALARM_STATUS_INTERRUPT_SET(x) (((x) << WLAN_RTC_ALARM_STATUS_INTERRUPT_LSB) & WLAN_RTC_ALARM_STATUS_INTERRUPT_MASK) - -#define WLAN_UART_WAKEUP_ADDRESS 0x000000bc -#define WLAN_UART_WAKEUP_OFFSET 0x000000bc -#define WLAN_UART_WAKEUP_ENABLE_MSB 0 -#define WLAN_UART_WAKEUP_ENABLE_LSB 0 -#define WLAN_UART_WAKEUP_ENABLE_MASK 0x00000001 -#define WLAN_UART_WAKEUP_ENABLE_GET(x) (((x) & WLAN_UART_WAKEUP_ENABLE_MASK) >> WLAN_UART_WAKEUP_ENABLE_LSB) -#define WLAN_UART_WAKEUP_ENABLE_SET(x) (((x) << WLAN_UART_WAKEUP_ENABLE_LSB) & WLAN_UART_WAKEUP_ENABLE_MASK) - -#define WLAN_RESET_CAUSE_ADDRESS 0x000000c0 -#define WLAN_RESET_CAUSE_OFFSET 0x000000c0 -#define WLAN_RESET_CAUSE_LAST_MSB 2 -#define WLAN_RESET_CAUSE_LAST_LSB 0 -#define WLAN_RESET_CAUSE_LAST_MASK 0x00000007 -#define WLAN_RESET_CAUSE_LAST_GET(x) (((x) & WLAN_RESET_CAUSE_LAST_MASK) >> WLAN_RESET_CAUSE_LAST_LSB) -#define WLAN_RESET_CAUSE_LAST_SET(x) (((x) << WLAN_RESET_CAUSE_LAST_LSB) & WLAN_RESET_CAUSE_LAST_MASK) - -#define WLAN_SYSTEM_SLEEP_ADDRESS 0x000000c4 -#define WLAN_SYSTEM_SLEEP_OFFSET 0x000000c4 -#define WLAN_SYSTEM_SLEEP_HOST_IF_MSB 4 -#define WLAN_SYSTEM_SLEEP_HOST_IF_LSB 4 -#define WLAN_SYSTEM_SLEEP_HOST_IF_MASK 0x00000010 -#define WLAN_SYSTEM_SLEEP_HOST_IF_GET(x) (((x) & WLAN_SYSTEM_SLEEP_HOST_IF_MASK) >> WLAN_SYSTEM_SLEEP_HOST_IF_LSB) -#define WLAN_SYSTEM_SLEEP_HOST_IF_SET(x) (((x) << WLAN_SYSTEM_SLEEP_HOST_IF_LSB) & WLAN_SYSTEM_SLEEP_HOST_IF_MASK) -#define WLAN_SYSTEM_SLEEP_MBOX_MSB 3 -#define WLAN_SYSTEM_SLEEP_MBOX_LSB 3 -#define WLAN_SYSTEM_SLEEP_MBOX_MASK 0x00000008 -#define WLAN_SYSTEM_SLEEP_MBOX_GET(x) (((x) & WLAN_SYSTEM_SLEEP_MBOX_MASK) >> WLAN_SYSTEM_SLEEP_MBOX_LSB) -#define WLAN_SYSTEM_SLEEP_MBOX_SET(x) (((x) << WLAN_SYSTEM_SLEEP_MBOX_LSB) & WLAN_SYSTEM_SLEEP_MBOX_MASK) -#define WLAN_SYSTEM_SLEEP_MAC_IF_MSB 2 -#define WLAN_SYSTEM_SLEEP_MAC_IF_LSB 2 -#define WLAN_SYSTEM_SLEEP_MAC_IF_MASK 0x00000004 -#define WLAN_SYSTEM_SLEEP_MAC_IF_GET(x) (((x) & WLAN_SYSTEM_SLEEP_MAC_IF_MASK) >> WLAN_SYSTEM_SLEEP_MAC_IF_LSB) -#define WLAN_SYSTEM_SLEEP_MAC_IF_SET(x) (((x) << WLAN_SYSTEM_SLEEP_MAC_IF_LSB) & WLAN_SYSTEM_SLEEP_MAC_IF_MASK) -#define WLAN_SYSTEM_SLEEP_LIGHT_MSB 1 -#define WLAN_SYSTEM_SLEEP_LIGHT_LSB 1 -#define WLAN_SYSTEM_SLEEP_LIGHT_MASK 0x00000002 -#define WLAN_SYSTEM_SLEEP_LIGHT_GET(x) (((x) & WLAN_SYSTEM_SLEEP_LIGHT_MASK) >> WLAN_SYSTEM_SLEEP_LIGHT_LSB) -#define WLAN_SYSTEM_SLEEP_LIGHT_SET(x) (((x) << WLAN_SYSTEM_SLEEP_LIGHT_LSB) & WLAN_SYSTEM_SLEEP_LIGHT_MASK) -#define WLAN_SYSTEM_SLEEP_DISABLE_MSB 0 -#define WLAN_SYSTEM_SLEEP_DISABLE_LSB 0 -#define WLAN_SYSTEM_SLEEP_DISABLE_MASK 0x00000001 -#define WLAN_SYSTEM_SLEEP_DISABLE_GET(x) (((x) & WLAN_SYSTEM_SLEEP_DISABLE_MASK) >> WLAN_SYSTEM_SLEEP_DISABLE_LSB) -#define WLAN_SYSTEM_SLEEP_DISABLE_SET(x) (((x) << WLAN_SYSTEM_SLEEP_DISABLE_LSB) & WLAN_SYSTEM_SLEEP_DISABLE_MASK) - -#define WLAN_SDIO_WRAPPER_ADDRESS 0x000000c8 -#define WLAN_SDIO_WRAPPER_OFFSET 0x000000c8 -#define WLAN_SDIO_WRAPPER_SLEEP_MSB 3 -#define WLAN_SDIO_WRAPPER_SLEEP_LSB 3 -#define WLAN_SDIO_WRAPPER_SLEEP_MASK 0x00000008 -#define WLAN_SDIO_WRAPPER_SLEEP_GET(x) (((x) & WLAN_SDIO_WRAPPER_SLEEP_MASK) >> WLAN_SDIO_WRAPPER_SLEEP_LSB) -#define WLAN_SDIO_WRAPPER_SLEEP_SET(x) (((x) << WLAN_SDIO_WRAPPER_SLEEP_LSB) & WLAN_SDIO_WRAPPER_SLEEP_MASK) -#define WLAN_SDIO_WRAPPER_WAKEUP_MSB 2 -#define WLAN_SDIO_WRAPPER_WAKEUP_LSB 2 -#define WLAN_SDIO_WRAPPER_WAKEUP_MASK 0x00000004 -#define WLAN_SDIO_WRAPPER_WAKEUP_GET(x) (((x) & WLAN_SDIO_WRAPPER_WAKEUP_MASK) >> WLAN_SDIO_WRAPPER_WAKEUP_LSB) -#define WLAN_SDIO_WRAPPER_WAKEUP_SET(x) (((x) << WLAN_SDIO_WRAPPER_WAKEUP_LSB) & WLAN_SDIO_WRAPPER_WAKEUP_MASK) -#define WLAN_SDIO_WRAPPER_SOC_ON_MSB 1 -#define WLAN_SDIO_WRAPPER_SOC_ON_LSB 1 -#define WLAN_SDIO_WRAPPER_SOC_ON_MASK 0x00000002 -#define WLAN_SDIO_WRAPPER_SOC_ON_GET(x) (((x) & WLAN_SDIO_WRAPPER_SOC_ON_MASK) >> WLAN_SDIO_WRAPPER_SOC_ON_LSB) -#define WLAN_SDIO_WRAPPER_SOC_ON_SET(x) (((x) << WLAN_SDIO_WRAPPER_SOC_ON_LSB) & WLAN_SDIO_WRAPPER_SOC_ON_MASK) -#define WLAN_SDIO_WRAPPER_ON_MSB 0 -#define WLAN_SDIO_WRAPPER_ON_LSB 0 -#define WLAN_SDIO_WRAPPER_ON_MASK 0x00000001 -#define WLAN_SDIO_WRAPPER_ON_GET(x) (((x) & WLAN_SDIO_WRAPPER_ON_MASK) >> WLAN_SDIO_WRAPPER_ON_LSB) -#define WLAN_SDIO_WRAPPER_ON_SET(x) (((x) << WLAN_SDIO_WRAPPER_ON_LSB) & WLAN_SDIO_WRAPPER_ON_MASK) - -#define WLAN_MAC_SLEEP_CONTROL_ADDRESS 0x000000cc -#define WLAN_MAC_SLEEP_CONTROL_OFFSET 0x000000cc -#define WLAN_MAC_SLEEP_CONTROL_ENABLE_MSB 1 -#define WLAN_MAC_SLEEP_CONTROL_ENABLE_LSB 0 -#define WLAN_MAC_SLEEP_CONTROL_ENABLE_MASK 0x00000003 -#define WLAN_MAC_SLEEP_CONTROL_ENABLE_GET(x) (((x) & WLAN_MAC_SLEEP_CONTROL_ENABLE_MASK) >> WLAN_MAC_SLEEP_CONTROL_ENABLE_LSB) -#define WLAN_MAC_SLEEP_CONTROL_ENABLE_SET(x) (((x) << WLAN_MAC_SLEEP_CONTROL_ENABLE_LSB) & WLAN_MAC_SLEEP_CONTROL_ENABLE_MASK) - -#define WLAN_KEEP_AWAKE_ADDRESS 0x000000d0 -#define WLAN_KEEP_AWAKE_OFFSET 0x000000d0 -#define WLAN_KEEP_AWAKE_COUNT_MSB 7 -#define WLAN_KEEP_AWAKE_COUNT_LSB 0 -#define WLAN_KEEP_AWAKE_COUNT_MASK 0x000000ff -#define WLAN_KEEP_AWAKE_COUNT_GET(x) (((x) & WLAN_KEEP_AWAKE_COUNT_MASK) >> WLAN_KEEP_AWAKE_COUNT_LSB) -#define WLAN_KEEP_AWAKE_COUNT_SET(x) (((x) << WLAN_KEEP_AWAKE_COUNT_LSB) & WLAN_KEEP_AWAKE_COUNT_MASK) - -#define WLAN_LPO_CAL_TIME_ADDRESS 0x000000d4 -#define WLAN_LPO_CAL_TIME_OFFSET 0x000000d4 -#define WLAN_LPO_CAL_TIME_LENGTH_MSB 13 -#define WLAN_LPO_CAL_TIME_LENGTH_LSB 0 -#define WLAN_LPO_CAL_TIME_LENGTH_MASK 0x00003fff -#define WLAN_LPO_CAL_TIME_LENGTH_GET(x) (((x) & WLAN_LPO_CAL_TIME_LENGTH_MASK) >> WLAN_LPO_CAL_TIME_LENGTH_LSB) -#define WLAN_LPO_CAL_TIME_LENGTH_SET(x) (((x) << WLAN_LPO_CAL_TIME_LENGTH_LSB) & WLAN_LPO_CAL_TIME_LENGTH_MASK) - -#define WLAN_LPO_INIT_DIVIDEND_INT_ADDRESS 0x000000d8 -#define WLAN_LPO_INIT_DIVIDEND_INT_OFFSET 0x000000d8 -#define WLAN_LPO_INIT_DIVIDEND_INT_VALUE_MSB 23 -#define WLAN_LPO_INIT_DIVIDEND_INT_VALUE_LSB 0 -#define WLAN_LPO_INIT_DIVIDEND_INT_VALUE_MASK 0x00ffffff -#define WLAN_LPO_INIT_DIVIDEND_INT_VALUE_GET(x) (((x) & WLAN_LPO_INIT_DIVIDEND_INT_VALUE_MASK) >> WLAN_LPO_INIT_DIVIDEND_INT_VALUE_LSB) -#define WLAN_LPO_INIT_DIVIDEND_INT_VALUE_SET(x) (((x) << WLAN_LPO_INIT_DIVIDEND_INT_VALUE_LSB) & WLAN_LPO_INIT_DIVIDEND_INT_VALUE_MASK) - -#define WLAN_LPO_INIT_DIVIDEND_FRACTION_ADDRESS 0x000000dc -#define WLAN_LPO_INIT_DIVIDEND_FRACTION_OFFSET 0x000000dc -#define WLAN_LPO_INIT_DIVIDEND_FRACTION_VALUE_MSB 10 -#define WLAN_LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB 0 -#define WLAN_LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK 0x000007ff -#define WLAN_LPO_INIT_DIVIDEND_FRACTION_VALUE_GET(x) (((x) & WLAN_LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK) >> WLAN_LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB) -#define WLAN_LPO_INIT_DIVIDEND_FRACTION_VALUE_SET(x) (((x) << WLAN_LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB) & WLAN_LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK) - -#define WLAN_LPO_CAL_ADDRESS 0x000000e0 -#define WLAN_LPO_CAL_OFFSET 0x000000e0 -#define WLAN_LPO_CAL_ENABLE_MSB 20 -#define WLAN_LPO_CAL_ENABLE_LSB 20 -#define WLAN_LPO_CAL_ENABLE_MASK 0x00100000 -#define WLAN_LPO_CAL_ENABLE_GET(x) (((x) & WLAN_LPO_CAL_ENABLE_MASK) >> WLAN_LPO_CAL_ENABLE_LSB) -#define WLAN_LPO_CAL_ENABLE_SET(x) (((x) << WLAN_LPO_CAL_ENABLE_LSB) & WLAN_LPO_CAL_ENABLE_MASK) -#define WLAN_LPO_CAL_COUNT_MSB 19 -#define WLAN_LPO_CAL_COUNT_LSB 0 -#define WLAN_LPO_CAL_COUNT_MASK 0x000fffff -#define WLAN_LPO_CAL_COUNT_GET(x) (((x) & WLAN_LPO_CAL_COUNT_MASK) >> WLAN_LPO_CAL_COUNT_LSB) -#define WLAN_LPO_CAL_COUNT_SET(x) (((x) << WLAN_LPO_CAL_COUNT_LSB) & WLAN_LPO_CAL_COUNT_MASK) - -#define WLAN_LPO_CAL_TEST_CONTROL_ADDRESS 0x000000e4 -#define WLAN_LPO_CAL_TEST_CONTROL_OFFSET 0x000000e4 -#define WLAN_LPO_CAL_TEST_CONTROL_ENABLE_MSB 5 -#define WLAN_LPO_CAL_TEST_CONTROL_ENABLE_LSB 5 -#define WLAN_LPO_CAL_TEST_CONTROL_ENABLE_MASK 0x00000020 -#define WLAN_LPO_CAL_TEST_CONTROL_ENABLE_GET(x) (((x) & WLAN_LPO_CAL_TEST_CONTROL_ENABLE_MASK) >> WLAN_LPO_CAL_TEST_CONTROL_ENABLE_LSB) -#define WLAN_LPO_CAL_TEST_CONTROL_ENABLE_SET(x) (((x) << WLAN_LPO_CAL_TEST_CONTROL_ENABLE_LSB) & WLAN_LPO_CAL_TEST_CONTROL_ENABLE_MASK) -#define WLAN_LPO_CAL_TEST_CONTROL_RTC_CYCLES_MSB 4 -#define WLAN_LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB 0 -#define WLAN_LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK 0x0000001f -#define WLAN_LPO_CAL_TEST_CONTROL_RTC_CYCLES_GET(x) (((x) & WLAN_LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK) >> WLAN_LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB) -#define WLAN_LPO_CAL_TEST_CONTROL_RTC_CYCLES_SET(x) (((x) << WLAN_LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB) & WLAN_LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK) - -#define WLAN_LPO_CAL_TEST_STATUS_ADDRESS 0x000000e8 -#define WLAN_LPO_CAL_TEST_STATUS_OFFSET 0x000000e8 -#define WLAN_LPO_CAL_TEST_STATUS_READY_MSB 16 -#define WLAN_LPO_CAL_TEST_STATUS_READY_LSB 16 -#define WLAN_LPO_CAL_TEST_STATUS_READY_MASK 0x00010000 -#define WLAN_LPO_CAL_TEST_STATUS_READY_GET(x) (((x) & WLAN_LPO_CAL_TEST_STATUS_READY_MASK) >> WLAN_LPO_CAL_TEST_STATUS_READY_LSB) -#define WLAN_LPO_CAL_TEST_STATUS_READY_SET(x) (((x) << WLAN_LPO_CAL_TEST_STATUS_READY_LSB) & WLAN_LPO_CAL_TEST_STATUS_READY_MASK) -#define WLAN_LPO_CAL_TEST_STATUS_COUNT_MSB 15 -#define WLAN_LPO_CAL_TEST_STATUS_COUNT_LSB 0 -#define WLAN_LPO_CAL_TEST_STATUS_COUNT_MASK 0x0000ffff -#define WLAN_LPO_CAL_TEST_STATUS_COUNT_GET(x) (((x) & WLAN_LPO_CAL_TEST_STATUS_COUNT_MASK) >> WLAN_LPO_CAL_TEST_STATUS_COUNT_LSB) -#define WLAN_LPO_CAL_TEST_STATUS_COUNT_SET(x) (((x) << WLAN_LPO_CAL_TEST_STATUS_COUNT_LSB) & WLAN_LPO_CAL_TEST_STATUS_COUNT_MASK) - -#define WLAN_CHIP_ID_ADDRESS 0x000000ec -#define WLAN_CHIP_ID_OFFSET 0x000000ec -#define WLAN_CHIP_ID_DEVICE_ID_MSB 31 -#define WLAN_CHIP_ID_DEVICE_ID_LSB 16 -#define WLAN_CHIP_ID_DEVICE_ID_MASK 0xffff0000 -#define WLAN_CHIP_ID_DEVICE_ID_GET(x) (((x) & WLAN_CHIP_ID_DEVICE_ID_MASK) >> WLAN_CHIP_ID_DEVICE_ID_LSB) -#define WLAN_CHIP_ID_DEVICE_ID_SET(x) (((x) << WLAN_CHIP_ID_DEVICE_ID_LSB) & WLAN_CHIP_ID_DEVICE_ID_MASK) -#define WLAN_CHIP_ID_CONFIG_ID_MSB 15 -#define WLAN_CHIP_ID_CONFIG_ID_LSB 4 -#define WLAN_CHIP_ID_CONFIG_ID_MASK 0x0000fff0 -#define WLAN_CHIP_ID_CONFIG_ID_GET(x) (((x) & WLAN_CHIP_ID_CONFIG_ID_MASK) >> WLAN_CHIP_ID_CONFIG_ID_LSB) -#define WLAN_CHIP_ID_CONFIG_ID_SET(x) (((x) << WLAN_CHIP_ID_CONFIG_ID_LSB) & WLAN_CHIP_ID_CONFIG_ID_MASK) -#define WLAN_CHIP_ID_VERSION_ID_MSB 3 -#define WLAN_CHIP_ID_VERSION_ID_LSB 0 -#define WLAN_CHIP_ID_VERSION_ID_MASK 0x0000000f -#define WLAN_CHIP_ID_VERSION_ID_GET(x) (((x) & WLAN_CHIP_ID_VERSION_ID_MASK) >> WLAN_CHIP_ID_VERSION_ID_LSB) -#define WLAN_CHIP_ID_VERSION_ID_SET(x) (((x) << WLAN_CHIP_ID_VERSION_ID_LSB) & WLAN_CHIP_ID_VERSION_ID_MASK) - -#define WLAN_DERIVED_RTC_CLK_ADDRESS 0x000000f0 -#define WLAN_DERIVED_RTC_CLK_OFFSET 0x000000f0 -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MSB 20 -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB 20 -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK 0x00100000 -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_GET(x) (((x) & WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK) >> WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB) -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_SET(x) (((x) << WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB) & WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK) -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_MSB 18 -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB 18 -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK 0x00040000 -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_GET(x) (((x) & WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK) >> WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB) -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_SET(x) (((x) << WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB) & WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK) -#define WLAN_DERIVED_RTC_CLK_FORCE_MSB 17 -#define WLAN_DERIVED_RTC_CLK_FORCE_LSB 16 -#define WLAN_DERIVED_RTC_CLK_FORCE_MASK 0x00030000 -#define WLAN_DERIVED_RTC_CLK_FORCE_GET(x) (((x) & WLAN_DERIVED_RTC_CLK_FORCE_MASK) >> WLAN_DERIVED_RTC_CLK_FORCE_LSB) -#define WLAN_DERIVED_RTC_CLK_FORCE_SET(x) (((x) << WLAN_DERIVED_RTC_CLK_FORCE_LSB) & WLAN_DERIVED_RTC_CLK_FORCE_MASK) -#define WLAN_DERIVED_RTC_CLK_PERIOD_MSB 15 -#define WLAN_DERIVED_RTC_CLK_PERIOD_LSB 1 -#define WLAN_DERIVED_RTC_CLK_PERIOD_MASK 0x0000fffe -#define WLAN_DERIVED_RTC_CLK_PERIOD_GET(x) (((x) & WLAN_DERIVED_RTC_CLK_PERIOD_MASK) >> WLAN_DERIVED_RTC_CLK_PERIOD_LSB) -#define WLAN_DERIVED_RTC_CLK_PERIOD_SET(x) (((x) << WLAN_DERIVED_RTC_CLK_PERIOD_LSB) & WLAN_DERIVED_RTC_CLK_PERIOD_MASK) - -#define MAC_PCU_SLP32_MODE_ADDRESS 0x000000f4 -#define MAC_PCU_SLP32_MODE_OFFSET 0x000000f4 -#define MAC_PCU_SLP32_MODE_TSF2_WRITE_STATUS_MSB 24 -#define MAC_PCU_SLP32_MODE_TSF2_WRITE_STATUS_LSB 24 -#define MAC_PCU_SLP32_MODE_TSF2_WRITE_STATUS_MASK 0x01000000 -#define MAC_PCU_SLP32_MODE_TSF2_WRITE_STATUS_GET(x) (((x) & MAC_PCU_SLP32_MODE_TSF2_WRITE_STATUS_MASK) >> MAC_PCU_SLP32_MODE_TSF2_WRITE_STATUS_LSB) -#define MAC_PCU_SLP32_MODE_TSF2_WRITE_STATUS_SET(x) (((x) << MAC_PCU_SLP32_MODE_TSF2_WRITE_STATUS_LSB) & MAC_PCU_SLP32_MODE_TSF2_WRITE_STATUS_MASK) -#define MAC_PCU_SLP32_MODE_FORCE_BIAS_BLOCK_ON_MSB 23 -#define MAC_PCU_SLP32_MODE_FORCE_BIAS_BLOCK_ON_LSB 23 -#define MAC_PCU_SLP32_MODE_FORCE_BIAS_BLOCK_ON_MASK 0x00800000 -#define MAC_PCU_SLP32_MODE_FORCE_BIAS_BLOCK_ON_GET(x) (((x) & MAC_PCU_SLP32_MODE_FORCE_BIAS_BLOCK_ON_MASK) >> MAC_PCU_SLP32_MODE_FORCE_BIAS_BLOCK_ON_LSB) -#define MAC_PCU_SLP32_MODE_FORCE_BIAS_BLOCK_ON_SET(x) (((x) << MAC_PCU_SLP32_MODE_FORCE_BIAS_BLOCK_ON_LSB) & MAC_PCU_SLP32_MODE_FORCE_BIAS_BLOCK_ON_MASK) -#define MAC_PCU_SLP32_MODE_DISABLE_32KHZ_MSB 22 -#define MAC_PCU_SLP32_MODE_DISABLE_32KHZ_LSB 22 -#define MAC_PCU_SLP32_MODE_DISABLE_32KHZ_MASK 0x00400000 -#define MAC_PCU_SLP32_MODE_DISABLE_32KHZ_GET(x) (((x) & MAC_PCU_SLP32_MODE_DISABLE_32KHZ_MASK) >> MAC_PCU_SLP32_MODE_DISABLE_32KHZ_LSB) -#define MAC_PCU_SLP32_MODE_DISABLE_32KHZ_SET(x) (((x) << MAC_PCU_SLP32_MODE_DISABLE_32KHZ_LSB) & MAC_PCU_SLP32_MODE_DISABLE_32KHZ_MASK) -#define MAC_PCU_SLP32_MODE_TSF_WRITE_STATUS_MSB 21 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_STATUS_LSB 21 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_STATUS_MASK 0x00200000 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_STATUS_GET(x) (((x) & MAC_PCU_SLP32_MODE_TSF_WRITE_STATUS_MASK) >> MAC_PCU_SLP32_MODE_TSF_WRITE_STATUS_LSB) -#define MAC_PCU_SLP32_MODE_TSF_WRITE_STATUS_SET(x) (((x) << MAC_PCU_SLP32_MODE_TSF_WRITE_STATUS_LSB) & MAC_PCU_SLP32_MODE_TSF_WRITE_STATUS_MASK) -#define MAC_PCU_SLP32_MODE_ENABLE_MSB 20 -#define MAC_PCU_SLP32_MODE_ENABLE_LSB 20 -#define MAC_PCU_SLP32_MODE_ENABLE_MASK 0x00100000 -#define MAC_PCU_SLP32_MODE_ENABLE_GET(x) (((x) & MAC_PCU_SLP32_MODE_ENABLE_MASK) >> MAC_PCU_SLP32_MODE_ENABLE_LSB) -#define MAC_PCU_SLP32_MODE_ENABLE_SET(x) (((x) << MAC_PCU_SLP32_MODE_ENABLE_LSB) & MAC_PCU_SLP32_MODE_ENABLE_MASK) -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MSB 19 -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB 0 -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK 0x000fffff -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_GET(x) (((x) & MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK) >> MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB) -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_SET(x) (((x) << MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB) & MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK) - -#define MAC_PCU_SLP32_WAKE_ADDRESS 0x000000f8 -#define MAC_PCU_SLP32_WAKE_OFFSET 0x000000f8 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_MSB 15 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_LSB 0 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_MASK 0x0000ffff -#define MAC_PCU_SLP32_WAKE_XTL_TIME_GET(x) (((x) & MAC_PCU_SLP32_WAKE_XTL_TIME_MASK) >> MAC_PCU_SLP32_WAKE_XTL_TIME_LSB) -#define MAC_PCU_SLP32_WAKE_XTL_TIME_SET(x) (((x) << MAC_PCU_SLP32_WAKE_XTL_TIME_LSB) & MAC_PCU_SLP32_WAKE_XTL_TIME_MASK) - -#define MAC_PCU_SLP32_INC_ADDRESS 0x000000fc -#define MAC_PCU_SLP32_INC_OFFSET 0x000000fc -#define MAC_PCU_SLP32_INC_TSF_INC_MSB 19 -#define MAC_PCU_SLP32_INC_TSF_INC_LSB 0 -#define MAC_PCU_SLP32_INC_TSF_INC_MASK 0x000fffff -#define MAC_PCU_SLP32_INC_TSF_INC_GET(x) (((x) & MAC_PCU_SLP32_INC_TSF_INC_MASK) >> MAC_PCU_SLP32_INC_TSF_INC_LSB) -#define MAC_PCU_SLP32_INC_TSF_INC_SET(x) (((x) << MAC_PCU_SLP32_INC_TSF_INC_LSB) & MAC_PCU_SLP32_INC_TSF_INC_MASK) - -#define MAC_PCU_SLP_MIB1_ADDRESS 0x00000100 -#define MAC_PCU_SLP_MIB1_OFFSET 0x00000100 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_MSB 31 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB 0 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK 0xffffffff -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK) >> MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB) -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_SET(x) (((x) << MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB) & MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK) - -#define MAC_PCU_SLP_MIB2_ADDRESS 0x00000104 -#define MAC_PCU_SLP_MIB2_OFFSET 0x00000104 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_MSB 31 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB 0 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK 0xffffffff -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK) >> MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB) -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_SET(x) (((x) << MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB) & MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK) - -#define MAC_PCU_SLP_MIB3_ADDRESS 0x00000108 -#define MAC_PCU_SLP_MIB3_OFFSET 0x00000108 -#define MAC_PCU_SLP_MIB3_PENDING_MSB 1 -#define MAC_PCU_SLP_MIB3_PENDING_LSB 1 -#define MAC_PCU_SLP_MIB3_PENDING_MASK 0x00000002 -#define MAC_PCU_SLP_MIB3_PENDING_GET(x) (((x) & MAC_PCU_SLP_MIB3_PENDING_MASK) >> MAC_PCU_SLP_MIB3_PENDING_LSB) -#define MAC_PCU_SLP_MIB3_PENDING_SET(x) (((x) << MAC_PCU_SLP_MIB3_PENDING_LSB) & MAC_PCU_SLP_MIB3_PENDING_MASK) -#define MAC_PCU_SLP_MIB3_CLR_CNT_MSB 0 -#define MAC_PCU_SLP_MIB3_CLR_CNT_LSB 0 -#define MAC_PCU_SLP_MIB3_CLR_CNT_MASK 0x00000001 -#define MAC_PCU_SLP_MIB3_CLR_CNT_GET(x) (((x) & MAC_PCU_SLP_MIB3_CLR_CNT_MASK) >> MAC_PCU_SLP_MIB3_CLR_CNT_LSB) -#define MAC_PCU_SLP_MIB3_CLR_CNT_SET(x) (((x) << MAC_PCU_SLP_MIB3_CLR_CNT_LSB) & MAC_PCU_SLP_MIB3_CLR_CNT_MASK) - -#define WLAN_POWER_REG_ADDRESS 0x0000010c -#define WLAN_POWER_REG_OFFSET 0x0000010c -#define WLAN_POWER_REG_SLEEP_MAKE_N_BREAK_EN_MSB 15 -#define WLAN_POWER_REG_SLEEP_MAKE_N_BREAK_EN_LSB 15 -#define WLAN_POWER_REG_SLEEP_MAKE_N_BREAK_EN_MASK 0x00008000 -#define WLAN_POWER_REG_SLEEP_MAKE_N_BREAK_EN_GET(x) (((x) & WLAN_POWER_REG_SLEEP_MAKE_N_BREAK_EN_MASK) >> WLAN_POWER_REG_SLEEP_MAKE_N_BREAK_EN_LSB) -#define WLAN_POWER_REG_SLEEP_MAKE_N_BREAK_EN_SET(x) (((x) << WLAN_POWER_REG_SLEEP_MAKE_N_BREAK_EN_LSB) & WLAN_POWER_REG_SLEEP_MAKE_N_BREAK_EN_MASK) -#define WLAN_POWER_REG_DEBUG_EN_MSB 14 -#define WLAN_POWER_REG_DEBUG_EN_LSB 14 -#define WLAN_POWER_REG_DEBUG_EN_MASK 0x00004000 -#define WLAN_POWER_REG_DEBUG_EN_GET(x) (((x) & WLAN_POWER_REG_DEBUG_EN_MASK) >> WLAN_POWER_REG_DEBUG_EN_LSB) -#define WLAN_POWER_REG_DEBUG_EN_SET(x) (((x) << WLAN_POWER_REG_DEBUG_EN_LSB) & WLAN_POWER_REG_DEBUG_EN_MASK) -#define WLAN_POWER_REG_WLAN_BB_PWD_EN_MSB 13 -#define WLAN_POWER_REG_WLAN_BB_PWD_EN_LSB 13 -#define WLAN_POWER_REG_WLAN_BB_PWD_EN_MASK 0x00002000 -#define WLAN_POWER_REG_WLAN_BB_PWD_EN_GET(x) (((x) & WLAN_POWER_REG_WLAN_BB_PWD_EN_MASK) >> WLAN_POWER_REG_WLAN_BB_PWD_EN_LSB) -#define WLAN_POWER_REG_WLAN_BB_PWD_EN_SET(x) (((x) << WLAN_POWER_REG_WLAN_BB_PWD_EN_LSB) & WLAN_POWER_REG_WLAN_BB_PWD_EN_MASK) -#define WLAN_POWER_REG_WLAN_MAC_PWD_EN_MSB 12 -#define WLAN_POWER_REG_WLAN_MAC_PWD_EN_LSB 12 -#define WLAN_POWER_REG_WLAN_MAC_PWD_EN_MASK 0x00001000 -#define WLAN_POWER_REG_WLAN_MAC_PWD_EN_GET(x) (((x) & WLAN_POWER_REG_WLAN_MAC_PWD_EN_MASK) >> WLAN_POWER_REG_WLAN_MAC_PWD_EN_LSB) -#define WLAN_POWER_REG_WLAN_MAC_PWD_EN_SET(x) (((x) << WLAN_POWER_REG_WLAN_MAC_PWD_EN_LSB) & WLAN_POWER_REG_WLAN_MAC_PWD_EN_MASK) -#define WLAN_POWER_REG_VLVL_MSB 11 -#define WLAN_POWER_REG_VLVL_LSB 8 -#define WLAN_POWER_REG_VLVL_MASK 0x00000f00 -#define WLAN_POWER_REG_VLVL_GET(x) (((x) & WLAN_POWER_REG_VLVL_MASK) >> WLAN_POWER_REG_VLVL_LSB) -#define WLAN_POWER_REG_VLVL_SET(x) (((x) << WLAN_POWER_REG_VLVL_LSB) & WLAN_POWER_REG_VLVL_MASK) -#define WLAN_POWER_REG_CPU_INT_ENABLE_MSB 7 -#define WLAN_POWER_REG_CPU_INT_ENABLE_LSB 7 -#define WLAN_POWER_REG_CPU_INT_ENABLE_MASK 0x00000080 -#define WLAN_POWER_REG_CPU_INT_ENABLE_GET(x) (((x) & WLAN_POWER_REG_CPU_INT_ENABLE_MASK) >> WLAN_POWER_REG_CPU_INT_ENABLE_LSB) -#define WLAN_POWER_REG_CPU_INT_ENABLE_SET(x) (((x) << WLAN_POWER_REG_CPU_INT_ENABLE_LSB) & WLAN_POWER_REG_CPU_INT_ENABLE_MASK) -#define WLAN_POWER_REG_WLAN_ISO_DIS_MSB 6 -#define WLAN_POWER_REG_WLAN_ISO_DIS_LSB 6 -#define WLAN_POWER_REG_WLAN_ISO_DIS_MASK 0x00000040 -#define WLAN_POWER_REG_WLAN_ISO_DIS_GET(x) (((x) & WLAN_POWER_REG_WLAN_ISO_DIS_MASK) >> WLAN_POWER_REG_WLAN_ISO_DIS_LSB) -#define WLAN_POWER_REG_WLAN_ISO_DIS_SET(x) (((x) << WLAN_POWER_REG_WLAN_ISO_DIS_LSB) & WLAN_POWER_REG_WLAN_ISO_DIS_MASK) -#define WLAN_POWER_REG_WLAN_ISO_CNTL_MSB 5 -#define WLAN_POWER_REG_WLAN_ISO_CNTL_LSB 5 -#define WLAN_POWER_REG_WLAN_ISO_CNTL_MASK 0x00000020 -#define WLAN_POWER_REG_WLAN_ISO_CNTL_GET(x) (((x) & WLAN_POWER_REG_WLAN_ISO_CNTL_MASK) >> WLAN_POWER_REG_WLAN_ISO_CNTL_LSB) -#define WLAN_POWER_REG_WLAN_ISO_CNTL_SET(x) (((x) << WLAN_POWER_REG_WLAN_ISO_CNTL_LSB) & WLAN_POWER_REG_WLAN_ISO_CNTL_MASK) -#define WLAN_POWER_REG_RADIO_PWD_EN_MSB 4 -#define WLAN_POWER_REG_RADIO_PWD_EN_LSB 4 -#define WLAN_POWER_REG_RADIO_PWD_EN_MASK 0x00000010 -#define WLAN_POWER_REG_RADIO_PWD_EN_GET(x) (((x) & WLAN_POWER_REG_RADIO_PWD_EN_MASK) >> WLAN_POWER_REG_RADIO_PWD_EN_LSB) -#define WLAN_POWER_REG_RADIO_PWD_EN_SET(x) (((x) << WLAN_POWER_REG_RADIO_PWD_EN_LSB) & WLAN_POWER_REG_RADIO_PWD_EN_MASK) -#define WLAN_POWER_REG_SOC_ISO_EN_MSB 3 -#define WLAN_POWER_REG_SOC_ISO_EN_LSB 3 -#define WLAN_POWER_REG_SOC_ISO_EN_MASK 0x00000008 -#define WLAN_POWER_REG_SOC_ISO_EN_GET(x) (((x) & WLAN_POWER_REG_SOC_ISO_EN_MASK) >> WLAN_POWER_REG_SOC_ISO_EN_LSB) -#define WLAN_POWER_REG_SOC_ISO_EN_SET(x) (((x) << WLAN_POWER_REG_SOC_ISO_EN_LSB) & WLAN_POWER_REG_SOC_ISO_EN_MASK) -#define WLAN_POWER_REG_WLAN_ISO_EN_MSB 2 -#define WLAN_POWER_REG_WLAN_ISO_EN_LSB 2 -#define WLAN_POWER_REG_WLAN_ISO_EN_MASK 0x00000004 -#define WLAN_POWER_REG_WLAN_ISO_EN_GET(x) (((x) & WLAN_POWER_REG_WLAN_ISO_EN_MASK) >> WLAN_POWER_REG_WLAN_ISO_EN_LSB) -#define WLAN_POWER_REG_WLAN_ISO_EN_SET(x) (((x) << WLAN_POWER_REG_WLAN_ISO_EN_LSB) & WLAN_POWER_REG_WLAN_ISO_EN_MASK) -#define WLAN_POWER_REG_WLAN_PWD_EN_MSB 1 -#define WLAN_POWER_REG_WLAN_PWD_EN_LSB 1 -#define WLAN_POWER_REG_WLAN_PWD_EN_MASK 0x00000002 -#define WLAN_POWER_REG_WLAN_PWD_EN_GET(x) (((x) & WLAN_POWER_REG_WLAN_PWD_EN_MASK) >> WLAN_POWER_REG_WLAN_PWD_EN_LSB) -#define WLAN_POWER_REG_WLAN_PWD_EN_SET(x) (((x) << WLAN_POWER_REG_WLAN_PWD_EN_LSB) & WLAN_POWER_REG_WLAN_PWD_EN_MASK) -#define WLAN_POWER_REG_POWER_EN_MSB 0 -#define WLAN_POWER_REG_POWER_EN_LSB 0 -#define WLAN_POWER_REG_POWER_EN_MASK 0x00000001 -#define WLAN_POWER_REG_POWER_EN_GET(x) (((x) & WLAN_POWER_REG_POWER_EN_MASK) >> WLAN_POWER_REG_POWER_EN_LSB) -#define WLAN_POWER_REG_POWER_EN_SET(x) (((x) << WLAN_POWER_REG_POWER_EN_LSB) & WLAN_POWER_REG_POWER_EN_MASK) - -#define WLAN_CORE_CLK_CTRL_ADDRESS 0x00000110 -#define WLAN_CORE_CLK_CTRL_OFFSET 0x00000110 -#define WLAN_CORE_CLK_CTRL_DIV_MSB 2 -#define WLAN_CORE_CLK_CTRL_DIV_LSB 0 -#define WLAN_CORE_CLK_CTRL_DIV_MASK 0x00000007 -#define WLAN_CORE_CLK_CTRL_DIV_GET(x) (((x) & WLAN_CORE_CLK_CTRL_DIV_MASK) >> WLAN_CORE_CLK_CTRL_DIV_LSB) -#define WLAN_CORE_CLK_CTRL_DIV_SET(x) (((x) << WLAN_CORE_CLK_CTRL_DIV_LSB) & WLAN_CORE_CLK_CTRL_DIV_MASK) - -#define WLAN_GPIO_WAKEUP_CONTROL_ADDRESS 0x00000114 -#define WLAN_GPIO_WAKEUP_CONTROL_OFFSET 0x00000114 -#define WLAN_GPIO_WAKEUP_CONTROL_ENABLE_MSB 0 -#define WLAN_GPIO_WAKEUP_CONTROL_ENABLE_LSB 0 -#define WLAN_GPIO_WAKEUP_CONTROL_ENABLE_MASK 0x00000001 -#define WLAN_GPIO_WAKEUP_CONTROL_ENABLE_GET(x) (((x) & WLAN_GPIO_WAKEUP_CONTROL_ENABLE_MASK) >> WLAN_GPIO_WAKEUP_CONTROL_ENABLE_LSB) -#define WLAN_GPIO_WAKEUP_CONTROL_ENABLE_SET(x) (((x) << WLAN_GPIO_WAKEUP_CONTROL_ENABLE_LSB) & WLAN_GPIO_WAKEUP_CONTROL_ENABLE_MASK) - -#define HT_ADDRESS 0x00000118 -#define HT_OFFSET 0x00000118 -#define HT_MODE_MSB 0 -#define HT_MODE_LSB 0 -#define HT_MODE_MASK 0x00000001 -#define HT_MODE_GET(x) (((x) & HT_MODE_MASK) >> HT_MODE_LSB) -#define HT_MODE_SET(x) (((x) << HT_MODE_LSB) & HT_MODE_MASK) - -#define MAC_PCU_TSF_L32_ADDRESS 0x0000011c -#define MAC_PCU_TSF_L32_OFFSET 0x0000011c -#define MAC_PCU_TSF_L32_VALUE_MSB 31 -#define MAC_PCU_TSF_L32_VALUE_LSB 0 -#define MAC_PCU_TSF_L32_VALUE_MASK 0xffffffff -#define MAC_PCU_TSF_L32_VALUE_GET(x) (((x) & MAC_PCU_TSF_L32_VALUE_MASK) >> MAC_PCU_TSF_L32_VALUE_LSB) -#define MAC_PCU_TSF_L32_VALUE_SET(x) (((x) << MAC_PCU_TSF_L32_VALUE_LSB) & MAC_PCU_TSF_L32_VALUE_MASK) - -#define MAC_PCU_TSF_U32_ADDRESS 0x00000120 -#define MAC_PCU_TSF_U32_OFFSET 0x00000120 -#define MAC_PCU_TSF_U32_VALUE_MSB 31 -#define MAC_PCU_TSF_U32_VALUE_LSB 0 -#define MAC_PCU_TSF_U32_VALUE_MASK 0xffffffff -#define MAC_PCU_TSF_U32_VALUE_GET(x) (((x) & MAC_PCU_TSF_U32_VALUE_MASK) >> MAC_PCU_TSF_U32_VALUE_LSB) -#define MAC_PCU_TSF_U32_VALUE_SET(x) (((x) << MAC_PCU_TSF_U32_VALUE_LSB) & MAC_PCU_TSF_U32_VALUE_MASK) - -#define MAC_PCU_WBTIMER_ADDRESS 0x00000124 -#define MAC_PCU_WBTIMER_OFFSET 0x00000124 -#define MAC_PCU_WBTIMER_VALUE_MSB 31 -#define MAC_PCU_WBTIMER_VALUE_LSB 0 -#define MAC_PCU_WBTIMER_VALUE_MASK 0xffffffff -#define MAC_PCU_WBTIMER_VALUE_GET(x) (((x) & MAC_PCU_WBTIMER_VALUE_MASK) >> MAC_PCU_WBTIMER_VALUE_LSB) -#define MAC_PCU_WBTIMER_VALUE_SET(x) (((x) << MAC_PCU_WBTIMER_VALUE_LSB) & MAC_PCU_WBTIMER_VALUE_MASK) - -#define MAC_PCU_GENERIC_TIMERS_ADDRESS 0x00000140 -#define MAC_PCU_GENERIC_TIMERS_OFFSET 0x00000140 -#define MAC_PCU_GENERIC_TIMERS_DATA_MSB 31 -#define MAC_PCU_GENERIC_TIMERS_DATA_LSB 0 -#define MAC_PCU_GENERIC_TIMERS_DATA_MASK 0xffffffff -#define MAC_PCU_GENERIC_TIMERS_DATA_GET(x) (((x) & MAC_PCU_GENERIC_TIMERS_DATA_MASK) >> MAC_PCU_GENERIC_TIMERS_DATA_LSB) -#define MAC_PCU_GENERIC_TIMERS_DATA_SET(x) (((x) << MAC_PCU_GENERIC_TIMERS_DATA_LSB) & MAC_PCU_GENERIC_TIMERS_DATA_MASK) - -#define MAC_PCU_GENERIC_TIMERS_MODE_ADDRESS 0x00000180 -#define MAC_PCU_GENERIC_TIMERS_MODE_OFFSET 0x00000180 -#define MAC_PCU_GENERIC_TIMERS_MODE_ENABLE_MSB 15 -#define MAC_PCU_GENERIC_TIMERS_MODE_ENABLE_LSB 0 -#define MAC_PCU_GENERIC_TIMERS_MODE_ENABLE_MASK 0x0000ffff -#define MAC_PCU_GENERIC_TIMERS_MODE_ENABLE_GET(x) (((x) & MAC_PCU_GENERIC_TIMERS_MODE_ENABLE_MASK) >> MAC_PCU_GENERIC_TIMERS_MODE_ENABLE_LSB) -#define MAC_PCU_GENERIC_TIMERS_MODE_ENABLE_SET(x) (((x) << MAC_PCU_GENERIC_TIMERS_MODE_ENABLE_LSB) & MAC_PCU_GENERIC_TIMERS_MODE_ENABLE_MASK) - -#define MAC_PCU_GENERIC_TIMERS2_ADDRESS 0x000001c0 -#define MAC_PCU_GENERIC_TIMERS2_OFFSET 0x000001c0 -#define MAC_PCU_GENERIC_TIMERS2_DATA_MSB 31 -#define MAC_PCU_GENERIC_TIMERS2_DATA_LSB 0 -#define MAC_PCU_GENERIC_TIMERS2_DATA_MASK 0xffffffff -#define MAC_PCU_GENERIC_TIMERS2_DATA_GET(x) (((x) & MAC_PCU_GENERIC_TIMERS2_DATA_MASK) >> MAC_PCU_GENERIC_TIMERS2_DATA_LSB) -#define MAC_PCU_GENERIC_TIMERS2_DATA_SET(x) (((x) << MAC_PCU_GENERIC_TIMERS2_DATA_LSB) & MAC_PCU_GENERIC_TIMERS2_DATA_MASK) - -#define MAC_PCU_GENERIC_TIMERS_MODE2_ADDRESS 0x00000200 -#define MAC_PCU_GENERIC_TIMERS_MODE2_OFFSET 0x00000200 -#define MAC_PCU_GENERIC_TIMERS_MODE2_ENABLE_MSB 15 -#define MAC_PCU_GENERIC_TIMERS_MODE2_ENABLE_LSB 0 -#define MAC_PCU_GENERIC_TIMERS_MODE2_ENABLE_MASK 0x0000ffff -#define MAC_PCU_GENERIC_TIMERS_MODE2_ENABLE_GET(x) (((x) & MAC_PCU_GENERIC_TIMERS_MODE2_ENABLE_MASK) >> MAC_PCU_GENERIC_TIMERS_MODE2_ENABLE_LSB) -#define MAC_PCU_GENERIC_TIMERS_MODE2_ENABLE_SET(x) (((x) << MAC_PCU_GENERIC_TIMERS_MODE2_ENABLE_LSB) & MAC_PCU_GENERIC_TIMERS_MODE2_ENABLE_MASK) - -#define MAC_PCU_SLP1_ADDRESS 0x00000204 -#define MAC_PCU_SLP1_OFFSET 0x00000204 -#define MAC_PCU_SLP1_ASSUME_DTIM_MSB 19 -#define MAC_PCU_SLP1_ASSUME_DTIM_LSB 19 -#define MAC_PCU_SLP1_ASSUME_DTIM_MASK 0x00080000 -#define MAC_PCU_SLP1_ASSUME_DTIM_GET(x) (((x) & MAC_PCU_SLP1_ASSUME_DTIM_MASK) >> MAC_PCU_SLP1_ASSUME_DTIM_LSB) -#define MAC_PCU_SLP1_ASSUME_DTIM_SET(x) (((x) << MAC_PCU_SLP1_ASSUME_DTIM_LSB) & MAC_PCU_SLP1_ASSUME_DTIM_MASK) -#define MAC_PCU_SLP1_CAB_TIMEOUT_MSB 15 -#define MAC_PCU_SLP1_CAB_TIMEOUT_LSB 0 -#define MAC_PCU_SLP1_CAB_TIMEOUT_MASK 0x0000ffff -#define MAC_PCU_SLP1_CAB_TIMEOUT_GET(x) (((x) & MAC_PCU_SLP1_CAB_TIMEOUT_MASK) >> MAC_PCU_SLP1_CAB_TIMEOUT_LSB) -#define MAC_PCU_SLP1_CAB_TIMEOUT_SET(x) (((x) << MAC_PCU_SLP1_CAB_TIMEOUT_LSB) & MAC_PCU_SLP1_CAB_TIMEOUT_MASK) - -#define MAC_PCU_SLP2_ADDRESS 0x00000208 -#define MAC_PCU_SLP2_OFFSET 0x00000208 -#define MAC_PCU_SLP2_BEACON_TIMEOUT_MSB 15 -#define MAC_PCU_SLP2_BEACON_TIMEOUT_LSB 0 -#define MAC_PCU_SLP2_BEACON_TIMEOUT_MASK 0x0000ffff -#define MAC_PCU_SLP2_BEACON_TIMEOUT_GET(x) (((x) & MAC_PCU_SLP2_BEACON_TIMEOUT_MASK) >> MAC_PCU_SLP2_BEACON_TIMEOUT_LSB) -#define MAC_PCU_SLP2_BEACON_TIMEOUT_SET(x) (((x) << MAC_PCU_SLP2_BEACON_TIMEOUT_LSB) & MAC_PCU_SLP2_BEACON_TIMEOUT_MASK) - -#define MAC_PCU_RESET_TSF_ADDRESS 0x0000020c -#define MAC_PCU_RESET_TSF_OFFSET 0x0000020c -#define MAC_PCU_RESET_TSF_ONE_SHOT2_MSB 25 -#define MAC_PCU_RESET_TSF_ONE_SHOT2_LSB 25 -#define MAC_PCU_RESET_TSF_ONE_SHOT2_MASK 0x02000000 -#define MAC_PCU_RESET_TSF_ONE_SHOT2_GET(x) (((x) & MAC_PCU_RESET_TSF_ONE_SHOT2_MASK) >> MAC_PCU_RESET_TSF_ONE_SHOT2_LSB) -#define MAC_PCU_RESET_TSF_ONE_SHOT2_SET(x) (((x) << MAC_PCU_RESET_TSF_ONE_SHOT2_LSB) & MAC_PCU_RESET_TSF_ONE_SHOT2_MASK) -#define MAC_PCU_RESET_TSF_ONE_SHOT_MSB 24 -#define MAC_PCU_RESET_TSF_ONE_SHOT_LSB 24 -#define MAC_PCU_RESET_TSF_ONE_SHOT_MASK 0x01000000 -#define MAC_PCU_RESET_TSF_ONE_SHOT_GET(x) (((x) & MAC_PCU_RESET_TSF_ONE_SHOT_MASK) >> MAC_PCU_RESET_TSF_ONE_SHOT_LSB) -#define MAC_PCU_RESET_TSF_ONE_SHOT_SET(x) (((x) << MAC_PCU_RESET_TSF_ONE_SHOT_LSB) & MAC_PCU_RESET_TSF_ONE_SHOT_MASK) - -#define MAC_PCU_TSF_ADD_PLL_ADDRESS 0x00000210 -#define MAC_PCU_TSF_ADD_PLL_OFFSET 0x00000210 -#define MAC_PCU_TSF_ADD_PLL_VALUE_MSB 7 -#define MAC_PCU_TSF_ADD_PLL_VALUE_LSB 0 -#define MAC_PCU_TSF_ADD_PLL_VALUE_MASK 0x000000ff -#define MAC_PCU_TSF_ADD_PLL_VALUE_GET(x) (((x) & MAC_PCU_TSF_ADD_PLL_VALUE_MASK) >> MAC_PCU_TSF_ADD_PLL_VALUE_LSB) -#define MAC_PCU_TSF_ADD_PLL_VALUE_SET(x) (((x) << MAC_PCU_TSF_ADD_PLL_VALUE_LSB) & MAC_PCU_TSF_ADD_PLL_VALUE_MASK) - -#define SLEEP_RETENTION_ADDRESS 0x00000214 -#define SLEEP_RETENTION_OFFSET 0x00000214 -#define SLEEP_RETENTION_TIME_MSB 9 -#define SLEEP_RETENTION_TIME_LSB 2 -#define SLEEP_RETENTION_TIME_MASK 0x000003fc -#define SLEEP_RETENTION_TIME_GET(x) (((x) & SLEEP_RETENTION_TIME_MASK) >> SLEEP_RETENTION_TIME_LSB) -#define SLEEP_RETENTION_TIME_SET(x) (((x) << SLEEP_RETENTION_TIME_LSB) & SLEEP_RETENTION_TIME_MASK) -#define SLEEP_RETENTION_MODE_MSB 1 -#define SLEEP_RETENTION_MODE_LSB 1 -#define SLEEP_RETENTION_MODE_MASK 0x00000002 -#define SLEEP_RETENTION_MODE_GET(x) (((x) & SLEEP_RETENTION_MODE_MASK) >> SLEEP_RETENTION_MODE_LSB) -#define SLEEP_RETENTION_MODE_SET(x) (((x) << SLEEP_RETENTION_MODE_LSB) & SLEEP_RETENTION_MODE_MASK) -#define SLEEP_RETENTION_ENABLE_MSB 0 -#define SLEEP_RETENTION_ENABLE_LSB 0 -#define SLEEP_RETENTION_ENABLE_MASK 0x00000001 -#define SLEEP_RETENTION_ENABLE_GET(x) (((x) & SLEEP_RETENTION_ENABLE_MASK) >> SLEEP_RETENTION_ENABLE_LSB) -#define SLEEP_RETENTION_ENABLE_SET(x) (((x) << SLEEP_RETENTION_ENABLE_LSB) & SLEEP_RETENTION_ENABLE_MASK) - -#define BTCOEXCTRL_ADDRESS 0x00000218 -#define BTCOEXCTRL_OFFSET 0x00000218 -#define BTCOEXCTRL_WBTIMER_ENABLE_MSB 26 -#define BTCOEXCTRL_WBTIMER_ENABLE_LSB 26 -#define BTCOEXCTRL_WBTIMER_ENABLE_MASK 0x04000000 -#define BTCOEXCTRL_WBTIMER_ENABLE_GET(x) (((x) & BTCOEXCTRL_WBTIMER_ENABLE_MASK) >> BTCOEXCTRL_WBTIMER_ENABLE_LSB) -#define BTCOEXCTRL_WBTIMER_ENABLE_SET(x) (((x) << BTCOEXCTRL_WBTIMER_ENABLE_LSB) & BTCOEXCTRL_WBTIMER_ENABLE_MASK) -#define BTCOEXCTRL_WBSYNC_ON_BEACON_MSB 25 -#define BTCOEXCTRL_WBSYNC_ON_BEACON_LSB 25 -#define BTCOEXCTRL_WBSYNC_ON_BEACON_MASK 0x02000000 -#define BTCOEXCTRL_WBSYNC_ON_BEACON_GET(x) (((x) & BTCOEXCTRL_WBSYNC_ON_BEACON_MASK) >> BTCOEXCTRL_WBSYNC_ON_BEACON_LSB) -#define BTCOEXCTRL_WBSYNC_ON_BEACON_SET(x) (((x) << BTCOEXCTRL_WBSYNC_ON_BEACON_LSB) & BTCOEXCTRL_WBSYNC_ON_BEACON_MASK) -#define BTCOEXCTRL_PTA_MODE_MSB 24 -#define BTCOEXCTRL_PTA_MODE_LSB 23 -#define BTCOEXCTRL_PTA_MODE_MASK 0x01800000 -#define BTCOEXCTRL_PTA_MODE_GET(x) (((x) & BTCOEXCTRL_PTA_MODE_MASK) >> BTCOEXCTRL_PTA_MODE_LSB) -#define BTCOEXCTRL_PTA_MODE_SET(x) (((x) << BTCOEXCTRL_PTA_MODE_LSB) & BTCOEXCTRL_PTA_MODE_MASK) -#define BTCOEXCTRL_FREQ_TIME_MSB 22 -#define BTCOEXCTRL_FREQ_TIME_LSB 18 -#define BTCOEXCTRL_FREQ_TIME_MASK 0x007c0000 -#define BTCOEXCTRL_FREQ_TIME_GET(x) (((x) & BTCOEXCTRL_FREQ_TIME_MASK) >> BTCOEXCTRL_FREQ_TIME_LSB) -#define BTCOEXCTRL_FREQ_TIME_SET(x) (((x) << BTCOEXCTRL_FREQ_TIME_LSB) & BTCOEXCTRL_FREQ_TIME_MASK) -#define BTCOEXCTRL_PRIORITY_TIME_MSB 17 -#define BTCOEXCTRL_PRIORITY_TIME_LSB 12 -#define BTCOEXCTRL_PRIORITY_TIME_MASK 0x0003f000 -#define BTCOEXCTRL_PRIORITY_TIME_GET(x) (((x) & BTCOEXCTRL_PRIORITY_TIME_MASK) >> BTCOEXCTRL_PRIORITY_TIME_LSB) -#define BTCOEXCTRL_PRIORITY_TIME_SET(x) (((x) << BTCOEXCTRL_PRIORITY_TIME_LSB) & BTCOEXCTRL_PRIORITY_TIME_MASK) -#define BTCOEXCTRL_SYNC_DET_EN_MSB 11 -#define BTCOEXCTRL_SYNC_DET_EN_LSB 11 -#define BTCOEXCTRL_SYNC_DET_EN_MASK 0x00000800 -#define BTCOEXCTRL_SYNC_DET_EN_GET(x) (((x) & BTCOEXCTRL_SYNC_DET_EN_MASK) >> BTCOEXCTRL_SYNC_DET_EN_LSB) -#define BTCOEXCTRL_SYNC_DET_EN_SET(x) (((x) << BTCOEXCTRL_SYNC_DET_EN_LSB) & BTCOEXCTRL_SYNC_DET_EN_MASK) -#define BTCOEXCTRL_IDLE_CNT_EN_MSB 10 -#define BTCOEXCTRL_IDLE_CNT_EN_LSB 10 -#define BTCOEXCTRL_IDLE_CNT_EN_MASK 0x00000400 -#define BTCOEXCTRL_IDLE_CNT_EN_GET(x) (((x) & BTCOEXCTRL_IDLE_CNT_EN_MASK) >> BTCOEXCTRL_IDLE_CNT_EN_LSB) -#define BTCOEXCTRL_IDLE_CNT_EN_SET(x) (((x) << BTCOEXCTRL_IDLE_CNT_EN_LSB) & BTCOEXCTRL_IDLE_CNT_EN_MASK) -#define BTCOEXCTRL_FRAME_CNT_EN_MSB 9 -#define BTCOEXCTRL_FRAME_CNT_EN_LSB 9 -#define BTCOEXCTRL_FRAME_CNT_EN_MASK 0x00000200 -#define BTCOEXCTRL_FRAME_CNT_EN_GET(x) (((x) & BTCOEXCTRL_FRAME_CNT_EN_MASK) >> BTCOEXCTRL_FRAME_CNT_EN_LSB) -#define BTCOEXCTRL_FRAME_CNT_EN_SET(x) (((x) << BTCOEXCTRL_FRAME_CNT_EN_LSB) & BTCOEXCTRL_FRAME_CNT_EN_MASK) -#define BTCOEXCTRL_CLK_CNT_EN_MSB 8 -#define BTCOEXCTRL_CLK_CNT_EN_LSB 8 -#define BTCOEXCTRL_CLK_CNT_EN_MASK 0x00000100 -#define BTCOEXCTRL_CLK_CNT_EN_GET(x) (((x) & BTCOEXCTRL_CLK_CNT_EN_MASK) >> BTCOEXCTRL_CLK_CNT_EN_LSB) -#define BTCOEXCTRL_CLK_CNT_EN_SET(x) (((x) << BTCOEXCTRL_CLK_CNT_EN_LSB) & BTCOEXCTRL_CLK_CNT_EN_MASK) -#define BTCOEXCTRL_GAP_MSB 7 -#define BTCOEXCTRL_GAP_LSB 0 -#define BTCOEXCTRL_GAP_MASK 0x000000ff -#define BTCOEXCTRL_GAP_GET(x) (((x) & BTCOEXCTRL_GAP_MASK) >> BTCOEXCTRL_GAP_LSB) -#define BTCOEXCTRL_GAP_SET(x) (((x) << BTCOEXCTRL_GAP_LSB) & BTCOEXCTRL_GAP_MASK) - -#define WBSYNC_PRIORITY1_ADDRESS 0x0000021c -#define WBSYNC_PRIORITY1_OFFSET 0x0000021c -#define WBSYNC_PRIORITY1_BITMAP_MSB 31 -#define WBSYNC_PRIORITY1_BITMAP_LSB 0 -#define WBSYNC_PRIORITY1_BITMAP_MASK 0xffffffff -#define WBSYNC_PRIORITY1_BITMAP_GET(x) (((x) & WBSYNC_PRIORITY1_BITMAP_MASK) >> WBSYNC_PRIORITY1_BITMAP_LSB) -#define WBSYNC_PRIORITY1_BITMAP_SET(x) (((x) << WBSYNC_PRIORITY1_BITMAP_LSB) & WBSYNC_PRIORITY1_BITMAP_MASK) - -#define WBSYNC_PRIORITY2_ADDRESS 0x00000220 -#define WBSYNC_PRIORITY2_OFFSET 0x00000220 -#define WBSYNC_PRIORITY2_BITMAP_MSB 31 -#define WBSYNC_PRIORITY2_BITMAP_LSB 0 -#define WBSYNC_PRIORITY2_BITMAP_MASK 0xffffffff -#define WBSYNC_PRIORITY2_BITMAP_GET(x) (((x) & WBSYNC_PRIORITY2_BITMAP_MASK) >> WBSYNC_PRIORITY2_BITMAP_LSB) -#define WBSYNC_PRIORITY2_BITMAP_SET(x) (((x) << WBSYNC_PRIORITY2_BITMAP_LSB) & WBSYNC_PRIORITY2_BITMAP_MASK) - -#define WBSYNC_PRIORITY3_ADDRESS 0x00000224 -#define WBSYNC_PRIORITY3_OFFSET 0x00000224 -#define WBSYNC_PRIORITY3_BITMAP_MSB 31 -#define WBSYNC_PRIORITY3_BITMAP_LSB 0 -#define WBSYNC_PRIORITY3_BITMAP_MASK 0xffffffff -#define WBSYNC_PRIORITY3_BITMAP_GET(x) (((x) & WBSYNC_PRIORITY3_BITMAP_MASK) >> WBSYNC_PRIORITY3_BITMAP_LSB) -#define WBSYNC_PRIORITY3_BITMAP_SET(x) (((x) << WBSYNC_PRIORITY3_BITMAP_LSB) & WBSYNC_PRIORITY3_BITMAP_MASK) - -#define BTCOEX0_ADDRESS 0x00000228 -#define BTCOEX0_OFFSET 0x00000228 -#define BTCOEX0_SYNC_DUR_MSB 7 -#define BTCOEX0_SYNC_DUR_LSB 0 -#define BTCOEX0_SYNC_DUR_MASK 0x000000ff -#define BTCOEX0_SYNC_DUR_GET(x) (((x) & BTCOEX0_SYNC_DUR_MASK) >> BTCOEX0_SYNC_DUR_LSB) -#define BTCOEX0_SYNC_DUR_SET(x) (((x) << BTCOEX0_SYNC_DUR_LSB) & BTCOEX0_SYNC_DUR_MASK) - -#define BTCOEX1_ADDRESS 0x0000022c -#define BTCOEX1_OFFSET 0x0000022c -#define BTCOEX1_CLK_THRES_MSB 20 -#define BTCOEX1_CLK_THRES_LSB 0 -#define BTCOEX1_CLK_THRES_MASK 0x001fffff -#define BTCOEX1_CLK_THRES_GET(x) (((x) & BTCOEX1_CLK_THRES_MASK) >> BTCOEX1_CLK_THRES_LSB) -#define BTCOEX1_CLK_THRES_SET(x) (((x) << BTCOEX1_CLK_THRES_LSB) & BTCOEX1_CLK_THRES_MASK) - -#define BTCOEX2_ADDRESS 0x00000230 -#define BTCOEX2_OFFSET 0x00000230 -#define BTCOEX2_FRAME_THRES_MSB 7 -#define BTCOEX2_FRAME_THRES_LSB 0 -#define BTCOEX2_FRAME_THRES_MASK 0x000000ff -#define BTCOEX2_FRAME_THRES_GET(x) (((x) & BTCOEX2_FRAME_THRES_MASK) >> BTCOEX2_FRAME_THRES_LSB) -#define BTCOEX2_FRAME_THRES_SET(x) (((x) << BTCOEX2_FRAME_THRES_LSB) & BTCOEX2_FRAME_THRES_MASK) - -#define BTCOEX3_ADDRESS 0x00000234 -#define BTCOEX3_OFFSET 0x00000234 -#define BTCOEX3_CLK_CNT_MSB 20 -#define BTCOEX3_CLK_CNT_LSB 0 -#define BTCOEX3_CLK_CNT_MASK 0x001fffff -#define BTCOEX3_CLK_CNT_GET(x) (((x) & BTCOEX3_CLK_CNT_MASK) >> BTCOEX3_CLK_CNT_LSB) -#define BTCOEX3_CLK_CNT_SET(x) (((x) << BTCOEX3_CLK_CNT_LSB) & BTCOEX3_CLK_CNT_MASK) - -#define BTCOEX4_ADDRESS 0x00000238 -#define BTCOEX4_OFFSET 0x00000238 -#define BTCOEX4_FRAME_CNT_MSB 7 -#define BTCOEX4_FRAME_CNT_LSB 0 -#define BTCOEX4_FRAME_CNT_MASK 0x000000ff -#define BTCOEX4_FRAME_CNT_GET(x) (((x) & BTCOEX4_FRAME_CNT_MASK) >> BTCOEX4_FRAME_CNT_LSB) -#define BTCOEX4_FRAME_CNT_SET(x) (((x) << BTCOEX4_FRAME_CNT_LSB) & BTCOEX4_FRAME_CNT_MASK) - -#define BTCOEX5_ADDRESS 0x0000023c -#define BTCOEX5_OFFSET 0x0000023c -#define BTCOEX5_IDLE_CNT_MSB 15 -#define BTCOEX5_IDLE_CNT_LSB 0 -#define BTCOEX5_IDLE_CNT_MASK 0x0000ffff -#define BTCOEX5_IDLE_CNT_GET(x) (((x) & BTCOEX5_IDLE_CNT_MASK) >> BTCOEX5_IDLE_CNT_LSB) -#define BTCOEX5_IDLE_CNT_SET(x) (((x) << BTCOEX5_IDLE_CNT_LSB) & BTCOEX5_IDLE_CNT_MASK) - -#define BTCOEX6_ADDRESS 0x00000240 -#define BTCOEX6_OFFSET 0x00000240 -#define BTCOEX6_IDLE_RESET_LVL_BITMAP_MSB 31 -#define BTCOEX6_IDLE_RESET_LVL_BITMAP_LSB 0 -#define BTCOEX6_IDLE_RESET_LVL_BITMAP_MASK 0xffffffff -#define BTCOEX6_IDLE_RESET_LVL_BITMAP_GET(x) (((x) & BTCOEX6_IDLE_RESET_LVL_BITMAP_MASK) >> BTCOEX6_IDLE_RESET_LVL_BITMAP_LSB) -#define BTCOEX6_IDLE_RESET_LVL_BITMAP_SET(x) (((x) << BTCOEX6_IDLE_RESET_LVL_BITMAP_LSB) & BTCOEX6_IDLE_RESET_LVL_BITMAP_MASK) - -#define LOCK_ADDRESS 0x00000244 -#define LOCK_OFFSET 0x00000244 -#define LOCK_TLOCK_SLAVE_MSB 31 -#define LOCK_TLOCK_SLAVE_LSB 24 -#define LOCK_TLOCK_SLAVE_MASK 0xff000000 -#define LOCK_TLOCK_SLAVE_GET(x) (((x) & LOCK_TLOCK_SLAVE_MASK) >> LOCK_TLOCK_SLAVE_LSB) -#define LOCK_TLOCK_SLAVE_SET(x) (((x) << LOCK_TLOCK_SLAVE_LSB) & LOCK_TLOCK_SLAVE_MASK) -#define LOCK_TUNLOCK_SLAVE_MSB 23 -#define LOCK_TUNLOCK_SLAVE_LSB 16 -#define LOCK_TUNLOCK_SLAVE_MASK 0x00ff0000 -#define LOCK_TUNLOCK_SLAVE_GET(x) (((x) & LOCK_TUNLOCK_SLAVE_MASK) >> LOCK_TUNLOCK_SLAVE_LSB) -#define LOCK_TUNLOCK_SLAVE_SET(x) (((x) << LOCK_TUNLOCK_SLAVE_LSB) & LOCK_TUNLOCK_SLAVE_MASK) -#define LOCK_TLOCK_MASTER_MSB 15 -#define LOCK_TLOCK_MASTER_LSB 8 -#define LOCK_TLOCK_MASTER_MASK 0x0000ff00 -#define LOCK_TLOCK_MASTER_GET(x) (((x) & LOCK_TLOCK_MASTER_MASK) >> LOCK_TLOCK_MASTER_LSB) -#define LOCK_TLOCK_MASTER_SET(x) (((x) << LOCK_TLOCK_MASTER_LSB) & LOCK_TLOCK_MASTER_MASK) -#define LOCK_TUNLOCK_MASTER_MSB 7 -#define LOCK_TUNLOCK_MASTER_LSB 0 -#define LOCK_TUNLOCK_MASTER_MASK 0x000000ff -#define LOCK_TUNLOCK_MASTER_GET(x) (((x) & LOCK_TUNLOCK_MASTER_MASK) >> LOCK_TUNLOCK_MASTER_LSB) -#define LOCK_TUNLOCK_MASTER_SET(x) (((x) << LOCK_TUNLOCK_MASTER_LSB) & LOCK_TUNLOCK_MASTER_MASK) - -#define NOLOCK_PRIORITY_ADDRESS 0x00000248 -#define NOLOCK_PRIORITY_OFFSET 0x00000248 -#define NOLOCK_PRIORITY_BITMAP_MSB 31 -#define NOLOCK_PRIORITY_BITMAP_LSB 0 -#define NOLOCK_PRIORITY_BITMAP_MASK 0xffffffff -#define NOLOCK_PRIORITY_BITMAP_GET(x) (((x) & NOLOCK_PRIORITY_BITMAP_MASK) >> NOLOCK_PRIORITY_BITMAP_LSB) -#define NOLOCK_PRIORITY_BITMAP_SET(x) (((x) << NOLOCK_PRIORITY_BITMAP_LSB) & NOLOCK_PRIORITY_BITMAP_MASK) - -#define WBSYNC_ADDRESS 0x0000024c -#define WBSYNC_OFFSET 0x0000024c -#define WBSYNC_BTCLOCK_MSB 31 -#define WBSYNC_BTCLOCK_LSB 0 -#define WBSYNC_BTCLOCK_MASK 0xffffffff -#define WBSYNC_BTCLOCK_GET(x) (((x) & WBSYNC_BTCLOCK_MASK) >> WBSYNC_BTCLOCK_LSB) -#define WBSYNC_BTCLOCK_SET(x) (((x) << WBSYNC_BTCLOCK_LSB) & WBSYNC_BTCLOCK_MASK) - -#define WBSYNC1_ADDRESS 0x00000250 -#define WBSYNC1_OFFSET 0x00000250 -#define WBSYNC1_BTCLOCK_MSB 31 -#define WBSYNC1_BTCLOCK_LSB 0 -#define WBSYNC1_BTCLOCK_MASK 0xffffffff -#define WBSYNC1_BTCLOCK_GET(x) (((x) & WBSYNC1_BTCLOCK_MASK) >> WBSYNC1_BTCLOCK_LSB) -#define WBSYNC1_BTCLOCK_SET(x) (((x) << WBSYNC1_BTCLOCK_LSB) & WBSYNC1_BTCLOCK_MASK) - -#define WBSYNC2_ADDRESS 0x00000254 -#define WBSYNC2_OFFSET 0x00000254 -#define WBSYNC2_BTCLOCK_MSB 31 -#define WBSYNC2_BTCLOCK_LSB 0 -#define WBSYNC2_BTCLOCK_MASK 0xffffffff -#define WBSYNC2_BTCLOCK_GET(x) (((x) & WBSYNC2_BTCLOCK_MASK) >> WBSYNC2_BTCLOCK_LSB) -#define WBSYNC2_BTCLOCK_SET(x) (((x) << WBSYNC2_BTCLOCK_LSB) & WBSYNC2_BTCLOCK_MASK) - -#define WBSYNC3_ADDRESS 0x00000258 -#define WBSYNC3_OFFSET 0x00000258 -#define WBSYNC3_BTCLOCK_MSB 31 -#define WBSYNC3_BTCLOCK_LSB 0 -#define WBSYNC3_BTCLOCK_MASK 0xffffffff -#define WBSYNC3_BTCLOCK_GET(x) (((x) & WBSYNC3_BTCLOCK_MASK) >> WBSYNC3_BTCLOCK_LSB) -#define WBSYNC3_BTCLOCK_SET(x) (((x) << WBSYNC3_BTCLOCK_LSB) & WBSYNC3_BTCLOCK_MASK) - -#define WB_TIMER_TARGET_ADDRESS 0x0000025c -#define WB_TIMER_TARGET_OFFSET 0x0000025c -#define WB_TIMER_TARGET_VALUE_MSB 31 -#define WB_TIMER_TARGET_VALUE_LSB 0 -#define WB_TIMER_TARGET_VALUE_MASK 0xffffffff -#define WB_TIMER_TARGET_VALUE_GET(x) (((x) & WB_TIMER_TARGET_VALUE_MASK) >> WB_TIMER_TARGET_VALUE_LSB) -#define WB_TIMER_TARGET_VALUE_SET(x) (((x) << WB_TIMER_TARGET_VALUE_LSB) & WB_TIMER_TARGET_VALUE_MASK) - -#define WB_TIMER_SLOP_ADDRESS 0x00000260 -#define WB_TIMER_SLOP_OFFSET 0x00000260 -#define WB_TIMER_SLOP_VALUE_MSB 9 -#define WB_TIMER_SLOP_VALUE_LSB 0 -#define WB_TIMER_SLOP_VALUE_MASK 0x000003ff -#define WB_TIMER_SLOP_VALUE_GET(x) (((x) & WB_TIMER_SLOP_VALUE_MASK) >> WB_TIMER_SLOP_VALUE_LSB) -#define WB_TIMER_SLOP_VALUE_SET(x) (((x) << WB_TIMER_SLOP_VALUE_LSB) & WB_TIMER_SLOP_VALUE_MASK) - -#define BTCOEX_INT_EN_ADDRESS 0x00000264 -#define BTCOEX_INT_EN_OFFSET 0x00000264 -#define BTCOEX_INT_EN_I2C_RECV_OVERFLOW_MSB 11 -#define BTCOEX_INT_EN_I2C_RECV_OVERFLOW_LSB 11 -#define BTCOEX_INT_EN_I2C_RECV_OVERFLOW_MASK 0x00000800 -#define BTCOEX_INT_EN_I2C_RECV_OVERFLOW_GET(x) (((x) & BTCOEX_INT_EN_I2C_RECV_OVERFLOW_MASK) >> BTCOEX_INT_EN_I2C_RECV_OVERFLOW_LSB) -#define BTCOEX_INT_EN_I2C_RECV_OVERFLOW_SET(x) (((x) << BTCOEX_INT_EN_I2C_RECV_OVERFLOW_LSB) & BTCOEX_INT_EN_I2C_RECV_OVERFLOW_MASK) -#define BTCOEX_INT_EN_I2C_TX_FAILED_MSB 10 -#define BTCOEX_INT_EN_I2C_TX_FAILED_LSB 10 -#define BTCOEX_INT_EN_I2C_TX_FAILED_MASK 0x00000400 -#define BTCOEX_INT_EN_I2C_TX_FAILED_GET(x) (((x) & BTCOEX_INT_EN_I2C_TX_FAILED_MASK) >> BTCOEX_INT_EN_I2C_TX_FAILED_LSB) -#define BTCOEX_INT_EN_I2C_TX_FAILED_SET(x) (((x) << BTCOEX_INT_EN_I2C_TX_FAILED_LSB) & BTCOEX_INT_EN_I2C_TX_FAILED_MASK) -#define BTCOEX_INT_EN_I2C_MESG_SENT_MSB 9 -#define BTCOEX_INT_EN_I2C_MESG_SENT_LSB 9 -#define BTCOEX_INT_EN_I2C_MESG_SENT_MASK 0x00000200 -#define BTCOEX_INT_EN_I2C_MESG_SENT_GET(x) (((x) & BTCOEX_INT_EN_I2C_MESG_SENT_MASK) >> BTCOEX_INT_EN_I2C_MESG_SENT_LSB) -#define BTCOEX_INT_EN_I2C_MESG_SENT_SET(x) (((x) << BTCOEX_INT_EN_I2C_MESG_SENT_LSB) & BTCOEX_INT_EN_I2C_MESG_SENT_MASK) -#define BTCOEX_INT_EN_ST_MESG_RECV_MSB 8 -#define BTCOEX_INT_EN_ST_MESG_RECV_LSB 8 -#define BTCOEX_INT_EN_ST_MESG_RECV_MASK 0x00000100 -#define BTCOEX_INT_EN_ST_MESG_RECV_GET(x) (((x) & BTCOEX_INT_EN_ST_MESG_RECV_MASK) >> BTCOEX_INT_EN_ST_MESG_RECV_LSB) -#define BTCOEX_INT_EN_ST_MESG_RECV_SET(x) (((x) << BTCOEX_INT_EN_ST_MESG_RECV_LSB) & BTCOEX_INT_EN_ST_MESG_RECV_MASK) -#define BTCOEX_INT_EN_WB_TIMER_MSB 7 -#define BTCOEX_INT_EN_WB_TIMER_LSB 7 -#define BTCOEX_INT_EN_WB_TIMER_MASK 0x00000080 -#define BTCOEX_INT_EN_WB_TIMER_GET(x) (((x) & BTCOEX_INT_EN_WB_TIMER_MASK) >> BTCOEX_INT_EN_WB_TIMER_LSB) -#define BTCOEX_INT_EN_WB_TIMER_SET(x) (((x) << BTCOEX_INT_EN_WB_TIMER_LSB) & BTCOEX_INT_EN_WB_TIMER_MASK) -#define BTCOEX_INT_EN_NOSYNC_MSB 4 -#define BTCOEX_INT_EN_NOSYNC_LSB 4 -#define BTCOEX_INT_EN_NOSYNC_MASK 0x00000010 -#define BTCOEX_INT_EN_NOSYNC_GET(x) (((x) & BTCOEX_INT_EN_NOSYNC_MASK) >> BTCOEX_INT_EN_NOSYNC_LSB) -#define BTCOEX_INT_EN_NOSYNC_SET(x) (((x) << BTCOEX_INT_EN_NOSYNC_LSB) & BTCOEX_INT_EN_NOSYNC_MASK) -#define BTCOEX_INT_EN_SYNC_MSB 3 -#define BTCOEX_INT_EN_SYNC_LSB 3 -#define BTCOEX_INT_EN_SYNC_MASK 0x00000008 -#define BTCOEX_INT_EN_SYNC_GET(x) (((x) & BTCOEX_INT_EN_SYNC_MASK) >> BTCOEX_INT_EN_SYNC_LSB) -#define BTCOEX_INT_EN_SYNC_SET(x) (((x) << BTCOEX_INT_EN_SYNC_LSB) & BTCOEX_INT_EN_SYNC_MASK) -#define BTCOEX_INT_EN_END_MSB 2 -#define BTCOEX_INT_EN_END_LSB 2 -#define BTCOEX_INT_EN_END_MASK 0x00000004 -#define BTCOEX_INT_EN_END_GET(x) (((x) & BTCOEX_INT_EN_END_MASK) >> BTCOEX_INT_EN_END_LSB) -#define BTCOEX_INT_EN_END_SET(x) (((x) << BTCOEX_INT_EN_END_LSB) & BTCOEX_INT_EN_END_MASK) -#define BTCOEX_INT_EN_FRAME_CNT_MSB 1 -#define BTCOEX_INT_EN_FRAME_CNT_LSB 1 -#define BTCOEX_INT_EN_FRAME_CNT_MASK 0x00000002 -#define BTCOEX_INT_EN_FRAME_CNT_GET(x) (((x) & BTCOEX_INT_EN_FRAME_CNT_MASK) >> BTCOEX_INT_EN_FRAME_CNT_LSB) -#define BTCOEX_INT_EN_FRAME_CNT_SET(x) (((x) << BTCOEX_INT_EN_FRAME_CNT_LSB) & BTCOEX_INT_EN_FRAME_CNT_MASK) -#define BTCOEX_INT_EN_CLK_CNT_MSB 0 -#define BTCOEX_INT_EN_CLK_CNT_LSB 0 -#define BTCOEX_INT_EN_CLK_CNT_MASK 0x00000001 -#define BTCOEX_INT_EN_CLK_CNT_GET(x) (((x) & BTCOEX_INT_EN_CLK_CNT_MASK) >> BTCOEX_INT_EN_CLK_CNT_LSB) -#define BTCOEX_INT_EN_CLK_CNT_SET(x) (((x) << BTCOEX_INT_EN_CLK_CNT_LSB) & BTCOEX_INT_EN_CLK_CNT_MASK) - -#define BTCOEX_INT_STAT_ADDRESS 0x00000268 -#define BTCOEX_INT_STAT_OFFSET 0x00000268 -#define BTCOEX_INT_STAT_I2C_RECV_OVERFLOW_MSB 11 -#define BTCOEX_INT_STAT_I2C_RECV_OVERFLOW_LSB 11 -#define BTCOEX_INT_STAT_I2C_RECV_OVERFLOW_MASK 0x00000800 -#define BTCOEX_INT_STAT_I2C_RECV_OVERFLOW_GET(x) (((x) & BTCOEX_INT_STAT_I2C_RECV_OVERFLOW_MASK) >> BTCOEX_INT_STAT_I2C_RECV_OVERFLOW_LSB) -#define BTCOEX_INT_STAT_I2C_RECV_OVERFLOW_SET(x) (((x) << BTCOEX_INT_STAT_I2C_RECV_OVERFLOW_LSB) & BTCOEX_INT_STAT_I2C_RECV_OVERFLOW_MASK) -#define BTCOEX_INT_STAT_I2C_TX_FAILED_MSB 10 -#define BTCOEX_INT_STAT_I2C_TX_FAILED_LSB 10 -#define BTCOEX_INT_STAT_I2C_TX_FAILED_MASK 0x00000400 -#define BTCOEX_INT_STAT_I2C_TX_FAILED_GET(x) (((x) & BTCOEX_INT_STAT_I2C_TX_FAILED_MASK) >> BTCOEX_INT_STAT_I2C_TX_FAILED_LSB) -#define BTCOEX_INT_STAT_I2C_TX_FAILED_SET(x) (((x) << BTCOEX_INT_STAT_I2C_TX_FAILED_LSB) & BTCOEX_INT_STAT_I2C_TX_FAILED_MASK) -#define BTCOEX_INT_STAT_I2C_MESG_SENT_MSB 9 -#define BTCOEX_INT_STAT_I2C_MESG_SENT_LSB 9 -#define BTCOEX_INT_STAT_I2C_MESG_SENT_MASK 0x00000200 -#define BTCOEX_INT_STAT_I2C_MESG_SENT_GET(x) (((x) & BTCOEX_INT_STAT_I2C_MESG_SENT_MASK) >> BTCOEX_INT_STAT_I2C_MESG_SENT_LSB) -#define BTCOEX_INT_STAT_I2C_MESG_SENT_SET(x) (((x) << BTCOEX_INT_STAT_I2C_MESG_SENT_LSB) & BTCOEX_INT_STAT_I2C_MESG_SENT_MASK) -#define BTCOEX_INT_STAT_I2C_MESG_RECV_MSB 8 -#define BTCOEX_INT_STAT_I2C_MESG_RECV_LSB 8 -#define BTCOEX_INT_STAT_I2C_MESG_RECV_MASK 0x00000100 -#define BTCOEX_INT_STAT_I2C_MESG_RECV_GET(x) (((x) & BTCOEX_INT_STAT_I2C_MESG_RECV_MASK) >> BTCOEX_INT_STAT_I2C_MESG_RECV_LSB) -#define BTCOEX_INT_STAT_I2C_MESG_RECV_SET(x) (((x) << BTCOEX_INT_STAT_I2C_MESG_RECV_LSB) & BTCOEX_INT_STAT_I2C_MESG_RECV_MASK) -#define BTCOEX_INT_STAT_WB_TIMER_MSB 7 -#define BTCOEX_INT_STAT_WB_TIMER_LSB 7 -#define BTCOEX_INT_STAT_WB_TIMER_MASK 0x00000080 -#define BTCOEX_INT_STAT_WB_TIMER_GET(x) (((x) & BTCOEX_INT_STAT_WB_TIMER_MASK) >> BTCOEX_INT_STAT_WB_TIMER_LSB) -#define BTCOEX_INT_STAT_WB_TIMER_SET(x) (((x) << BTCOEX_INT_STAT_WB_TIMER_LSB) & BTCOEX_INT_STAT_WB_TIMER_MASK) -#define BTCOEX_INT_STAT_BTPRIORITY_STOMP_MSB 6 -#define BTCOEX_INT_STAT_BTPRIORITY_STOMP_LSB 6 -#define BTCOEX_INT_STAT_BTPRIORITY_STOMP_MASK 0x00000040 -#define BTCOEX_INT_STAT_BTPRIORITY_STOMP_GET(x) (((x) & BTCOEX_INT_STAT_BTPRIORITY_STOMP_MASK) >> BTCOEX_INT_STAT_BTPRIORITY_STOMP_LSB) -#define BTCOEX_INT_STAT_BTPRIORITY_STOMP_SET(x) (((x) << BTCOEX_INT_STAT_BTPRIORITY_STOMP_LSB) & BTCOEX_INT_STAT_BTPRIORITY_STOMP_MASK) -#define BTCOEX_INT_STAT_BTPRIORITY_MSB 5 -#define BTCOEX_INT_STAT_BTPRIORITY_LSB 5 -#define BTCOEX_INT_STAT_BTPRIORITY_MASK 0x00000020 -#define BTCOEX_INT_STAT_BTPRIORITY_GET(x) (((x) & BTCOEX_INT_STAT_BTPRIORITY_MASK) >> BTCOEX_INT_STAT_BTPRIORITY_LSB) -#define BTCOEX_INT_STAT_BTPRIORITY_SET(x) (((x) << BTCOEX_INT_STAT_BTPRIORITY_LSB) & BTCOEX_INT_STAT_BTPRIORITY_MASK) -#define BTCOEX_INT_STAT_NOSYNC_MSB 4 -#define BTCOEX_INT_STAT_NOSYNC_LSB 4 -#define BTCOEX_INT_STAT_NOSYNC_MASK 0x00000010 -#define BTCOEX_INT_STAT_NOSYNC_GET(x) (((x) & BTCOEX_INT_STAT_NOSYNC_MASK) >> BTCOEX_INT_STAT_NOSYNC_LSB) -#define BTCOEX_INT_STAT_NOSYNC_SET(x) (((x) << BTCOEX_INT_STAT_NOSYNC_LSB) & BTCOEX_INT_STAT_NOSYNC_MASK) -#define BTCOEX_INT_STAT_SYNC_MSB 3 -#define BTCOEX_INT_STAT_SYNC_LSB 3 -#define BTCOEX_INT_STAT_SYNC_MASK 0x00000008 -#define BTCOEX_INT_STAT_SYNC_GET(x) (((x) & BTCOEX_INT_STAT_SYNC_MASK) >> BTCOEX_INT_STAT_SYNC_LSB) -#define BTCOEX_INT_STAT_SYNC_SET(x) (((x) << BTCOEX_INT_STAT_SYNC_LSB) & BTCOEX_INT_STAT_SYNC_MASK) -#define BTCOEX_INT_STAT_END_MSB 2 -#define BTCOEX_INT_STAT_END_LSB 2 -#define BTCOEX_INT_STAT_END_MASK 0x00000004 -#define BTCOEX_INT_STAT_END_GET(x) (((x) & BTCOEX_INT_STAT_END_MASK) >> BTCOEX_INT_STAT_END_LSB) -#define BTCOEX_INT_STAT_END_SET(x) (((x) << BTCOEX_INT_STAT_END_LSB) & BTCOEX_INT_STAT_END_MASK) -#define BTCOEX_INT_STAT_FRAME_CNT_MSB 1 -#define BTCOEX_INT_STAT_FRAME_CNT_LSB 1 -#define BTCOEX_INT_STAT_FRAME_CNT_MASK 0x00000002 -#define BTCOEX_INT_STAT_FRAME_CNT_GET(x) (((x) & BTCOEX_INT_STAT_FRAME_CNT_MASK) >> BTCOEX_INT_STAT_FRAME_CNT_LSB) -#define BTCOEX_INT_STAT_FRAME_CNT_SET(x) (((x) << BTCOEX_INT_STAT_FRAME_CNT_LSB) & BTCOEX_INT_STAT_FRAME_CNT_MASK) -#define BTCOEX_INT_STAT_CLK_CNT_MSB 0 -#define BTCOEX_INT_STAT_CLK_CNT_LSB 0 -#define BTCOEX_INT_STAT_CLK_CNT_MASK 0x00000001 -#define BTCOEX_INT_STAT_CLK_CNT_GET(x) (((x) & BTCOEX_INT_STAT_CLK_CNT_MASK) >> BTCOEX_INT_STAT_CLK_CNT_LSB) -#define BTCOEX_INT_STAT_CLK_CNT_SET(x) (((x) << BTCOEX_INT_STAT_CLK_CNT_LSB) & BTCOEX_INT_STAT_CLK_CNT_MASK) - -#define BTPRIORITY_INT_EN_ADDRESS 0x0000026c -#define BTPRIORITY_INT_EN_OFFSET 0x0000026c -#define BTPRIORITY_INT_EN_BITMAP_MSB 31 -#define BTPRIORITY_INT_EN_BITMAP_LSB 0 -#define BTPRIORITY_INT_EN_BITMAP_MASK 0xffffffff -#define BTPRIORITY_INT_EN_BITMAP_GET(x) (((x) & BTPRIORITY_INT_EN_BITMAP_MASK) >> BTPRIORITY_INT_EN_BITMAP_LSB) -#define BTPRIORITY_INT_EN_BITMAP_SET(x) (((x) << BTPRIORITY_INT_EN_BITMAP_LSB) & BTPRIORITY_INT_EN_BITMAP_MASK) - -#define BTPRIORITY_INT_STAT_ADDRESS 0x00000270 -#define BTPRIORITY_INT_STAT_OFFSET 0x00000270 -#define BTPRIORITY_INT_STAT_BITMAP_MSB 31 -#define BTPRIORITY_INT_STAT_BITMAP_LSB 0 -#define BTPRIORITY_INT_STAT_BITMAP_MASK 0xffffffff -#define BTPRIORITY_INT_STAT_BITMAP_GET(x) (((x) & BTPRIORITY_INT_STAT_BITMAP_MASK) >> BTPRIORITY_INT_STAT_BITMAP_LSB) -#define BTPRIORITY_INT_STAT_BITMAP_SET(x) (((x) << BTPRIORITY_INT_STAT_BITMAP_LSB) & BTPRIORITY_INT_STAT_BITMAP_MASK) - -#define BTPRIORITY_STOMP_INT_EN_ADDRESS 0x00000274 -#define BTPRIORITY_STOMP_INT_EN_OFFSET 0x00000274 -#define BTPRIORITY_STOMP_INT_EN_BITMAP_MSB 31 -#define BTPRIORITY_STOMP_INT_EN_BITMAP_LSB 0 -#define BTPRIORITY_STOMP_INT_EN_BITMAP_MASK 0xffffffff -#define BTPRIORITY_STOMP_INT_EN_BITMAP_GET(x) (((x) & BTPRIORITY_STOMP_INT_EN_BITMAP_MASK) >> BTPRIORITY_STOMP_INT_EN_BITMAP_LSB) -#define BTPRIORITY_STOMP_INT_EN_BITMAP_SET(x) (((x) << BTPRIORITY_STOMP_INT_EN_BITMAP_LSB) & BTPRIORITY_STOMP_INT_EN_BITMAP_MASK) - -#define BTPRIORITY_STOMP_INT_STAT_ADDRESS 0x00000278 -#define BTPRIORITY_STOMP_INT_STAT_OFFSET 0x00000278 -#define BTPRIORITY_STOMP_INT_STAT_BITMAP_MSB 31 -#define BTPRIORITY_STOMP_INT_STAT_BITMAP_LSB 0 -#define BTPRIORITY_STOMP_INT_STAT_BITMAP_MASK 0xffffffff -#define BTPRIORITY_STOMP_INT_STAT_BITMAP_GET(x) (((x) & BTPRIORITY_STOMP_INT_STAT_BITMAP_MASK) >> BTPRIORITY_STOMP_INT_STAT_BITMAP_LSB) -#define BTPRIORITY_STOMP_INT_STAT_BITMAP_SET(x) (((x) << BTPRIORITY_STOMP_INT_STAT_BITMAP_LSB) & BTPRIORITY_STOMP_INT_STAT_BITMAP_MASK) - -#define MAC_PCU_BMISS_TIMEOUT_ADDRESS 0x0000027c -#define MAC_PCU_BMISS_TIMEOUT_OFFSET 0x0000027c -#define MAC_PCU_BMISS_TIMEOUT_ENABLE_MSB 24 -#define MAC_PCU_BMISS_TIMEOUT_ENABLE_LSB 24 -#define MAC_PCU_BMISS_TIMEOUT_ENABLE_MASK 0x01000000 -#define MAC_PCU_BMISS_TIMEOUT_ENABLE_GET(x) (((x) & MAC_PCU_BMISS_TIMEOUT_ENABLE_MASK) >> MAC_PCU_BMISS_TIMEOUT_ENABLE_LSB) -#define MAC_PCU_BMISS_TIMEOUT_ENABLE_SET(x) (((x) << MAC_PCU_BMISS_TIMEOUT_ENABLE_LSB) & MAC_PCU_BMISS_TIMEOUT_ENABLE_MASK) -#define MAC_PCU_BMISS_TIMEOUT_VALUE_MSB 23 -#define MAC_PCU_BMISS_TIMEOUT_VALUE_LSB 0 -#define MAC_PCU_BMISS_TIMEOUT_VALUE_MASK 0x00ffffff -#define MAC_PCU_BMISS_TIMEOUT_VALUE_GET(x) (((x) & MAC_PCU_BMISS_TIMEOUT_VALUE_MASK) >> MAC_PCU_BMISS_TIMEOUT_VALUE_LSB) -#define MAC_PCU_BMISS_TIMEOUT_VALUE_SET(x) (((x) << MAC_PCU_BMISS_TIMEOUT_VALUE_LSB) & MAC_PCU_BMISS_TIMEOUT_VALUE_MASK) - -#define MAC_PCU_CAB_AWAKE_ADDRESS 0x00000280 -#define MAC_PCU_CAB_AWAKE_OFFSET 0x00000280 -#define MAC_PCU_CAB_AWAKE_ENABLE_MSB 16 -#define MAC_PCU_CAB_AWAKE_ENABLE_LSB 16 -#define MAC_PCU_CAB_AWAKE_ENABLE_MASK 0x00010000 -#define MAC_PCU_CAB_AWAKE_ENABLE_GET(x) (((x) & MAC_PCU_CAB_AWAKE_ENABLE_MASK) >> MAC_PCU_CAB_AWAKE_ENABLE_LSB) -#define MAC_PCU_CAB_AWAKE_ENABLE_SET(x) (((x) << MAC_PCU_CAB_AWAKE_ENABLE_LSB) & MAC_PCU_CAB_AWAKE_ENABLE_MASK) -#define MAC_PCU_CAB_AWAKE_DURATION_MSB 15 -#define MAC_PCU_CAB_AWAKE_DURATION_LSB 0 -#define MAC_PCU_CAB_AWAKE_DURATION_MASK 0x0000ffff -#define MAC_PCU_CAB_AWAKE_DURATION_GET(x) (((x) & MAC_PCU_CAB_AWAKE_DURATION_MASK) >> MAC_PCU_CAB_AWAKE_DURATION_LSB) -#define MAC_PCU_CAB_AWAKE_DURATION_SET(x) (((x) << MAC_PCU_CAB_AWAKE_DURATION_LSB) & MAC_PCU_CAB_AWAKE_DURATION_MASK) - -#define LP_PERF_COUNTER_ADDRESS 0x00000284 -#define LP_PERF_COUNTER_OFFSET 0x00000284 -#define LP_PERF_COUNTER_EN_MSB 0 -#define LP_PERF_COUNTER_EN_LSB 0 -#define LP_PERF_COUNTER_EN_MASK 0x00000001 -#define LP_PERF_COUNTER_EN_GET(x) (((x) & LP_PERF_COUNTER_EN_MASK) >> LP_PERF_COUNTER_EN_LSB) -#define LP_PERF_COUNTER_EN_SET(x) (((x) << LP_PERF_COUNTER_EN_LSB) & LP_PERF_COUNTER_EN_MASK) - -#define LP_PERF_LIGHT_SLEEP_ADDRESS 0x00000288 -#define LP_PERF_LIGHT_SLEEP_OFFSET 0x00000288 -#define LP_PERF_LIGHT_SLEEP_CNT_MSB 31 -#define LP_PERF_LIGHT_SLEEP_CNT_LSB 0 -#define LP_PERF_LIGHT_SLEEP_CNT_MASK 0xffffffff -#define LP_PERF_LIGHT_SLEEP_CNT_GET(x) (((x) & LP_PERF_LIGHT_SLEEP_CNT_MASK) >> LP_PERF_LIGHT_SLEEP_CNT_LSB) -#define LP_PERF_LIGHT_SLEEP_CNT_SET(x) (((x) << LP_PERF_LIGHT_SLEEP_CNT_LSB) & LP_PERF_LIGHT_SLEEP_CNT_MASK) - -#define LP_PERF_DEEP_SLEEP_ADDRESS 0x0000028c -#define LP_PERF_DEEP_SLEEP_OFFSET 0x0000028c -#define LP_PERF_DEEP_SLEEP_CNT_MSB 31 -#define LP_PERF_DEEP_SLEEP_CNT_LSB 0 -#define LP_PERF_DEEP_SLEEP_CNT_MASK 0xffffffff -#define LP_PERF_DEEP_SLEEP_CNT_GET(x) (((x) & LP_PERF_DEEP_SLEEP_CNT_MASK) >> LP_PERF_DEEP_SLEEP_CNT_LSB) -#define LP_PERF_DEEP_SLEEP_CNT_SET(x) (((x) << LP_PERF_DEEP_SLEEP_CNT_LSB) & LP_PERF_DEEP_SLEEP_CNT_MASK) - -#define LP_PERF_ON_ADDRESS 0x00000290 -#define LP_PERF_ON_OFFSET 0x00000290 -#define LP_PERF_ON_CNT_MSB 31 -#define LP_PERF_ON_CNT_LSB 0 -#define LP_PERF_ON_CNT_MASK 0xffffffff -#define LP_PERF_ON_CNT_GET(x) (((x) & LP_PERF_ON_CNT_MASK) >> LP_PERF_ON_CNT_LSB) -#define LP_PERF_ON_CNT_SET(x) (((x) << LP_PERF_ON_CNT_LSB) & LP_PERF_ON_CNT_MASK) - -#define ST_64_BIT_ADDRESS 0x00000294 -#define ST_64_BIT_OFFSET 0x00000294 -#define ST_64_BIT_TIMEOUT_MSB 26 -#define ST_64_BIT_TIMEOUT_LSB 9 -#define ST_64_BIT_TIMEOUT_MASK 0x07fffe00 -#define ST_64_BIT_TIMEOUT_GET(x) (((x) & ST_64_BIT_TIMEOUT_MASK) >> ST_64_BIT_TIMEOUT_LSB) -#define ST_64_BIT_TIMEOUT_SET(x) (((x) << ST_64_BIT_TIMEOUT_LSB) & ST_64_BIT_TIMEOUT_MASK) -#define ST_64_BIT_REQ_ACK_NOT_PULLED_DOWN_MSB 8 -#define ST_64_BIT_REQ_ACK_NOT_PULLED_DOWN_LSB 8 -#define ST_64_BIT_REQ_ACK_NOT_PULLED_DOWN_MASK 0x00000100 -#define ST_64_BIT_REQ_ACK_NOT_PULLED_DOWN_GET(x) (((x) & ST_64_BIT_REQ_ACK_NOT_PULLED_DOWN_MASK) >> ST_64_BIT_REQ_ACK_NOT_PULLED_DOWN_LSB) -#define ST_64_BIT_REQ_ACK_NOT_PULLED_DOWN_SET(x) (((x) << ST_64_BIT_REQ_ACK_NOT_PULLED_DOWN_LSB) & ST_64_BIT_REQ_ACK_NOT_PULLED_DOWN_MASK) -#define ST_64_BIT_DRIVE_MODE_MSB 7 -#define ST_64_BIT_DRIVE_MODE_LSB 7 -#define ST_64_BIT_DRIVE_MODE_MASK 0x00000080 -#define ST_64_BIT_DRIVE_MODE_GET(x) (((x) & ST_64_BIT_DRIVE_MODE_MASK) >> ST_64_BIT_DRIVE_MODE_LSB) -#define ST_64_BIT_DRIVE_MODE_SET(x) (((x) << ST_64_BIT_DRIVE_MODE_LSB) & ST_64_BIT_DRIVE_MODE_MASK) -#define ST_64_BIT_CLOCK_GATE_MSB 6 -#define ST_64_BIT_CLOCK_GATE_LSB 6 -#define ST_64_BIT_CLOCK_GATE_MASK 0x00000040 -#define ST_64_BIT_CLOCK_GATE_GET(x) (((x) & ST_64_BIT_CLOCK_GATE_MASK) >> ST_64_BIT_CLOCK_GATE_LSB) -#define ST_64_BIT_CLOCK_GATE_SET(x) (((x) << ST_64_BIT_CLOCK_GATE_LSB) & ST_64_BIT_CLOCK_GATE_MASK) -#define ST_64_BIT_SOC_CLK_DIVIDE_RATIO_MSB 5 -#define ST_64_BIT_SOC_CLK_DIVIDE_RATIO_LSB 1 -#define ST_64_BIT_SOC_CLK_DIVIDE_RATIO_MASK 0x0000003e -#define ST_64_BIT_SOC_CLK_DIVIDE_RATIO_GET(x) (((x) & ST_64_BIT_SOC_CLK_DIVIDE_RATIO_MASK) >> ST_64_BIT_SOC_CLK_DIVIDE_RATIO_LSB) -#define ST_64_BIT_SOC_CLK_DIVIDE_RATIO_SET(x) (((x) << ST_64_BIT_SOC_CLK_DIVIDE_RATIO_LSB) & ST_64_BIT_SOC_CLK_DIVIDE_RATIO_MASK) -#define ST_64_BIT_MODE_MSB 0 -#define ST_64_BIT_MODE_LSB 0 -#define ST_64_BIT_MODE_MASK 0x00000001 -#define ST_64_BIT_MODE_GET(x) (((x) & ST_64_BIT_MODE_MASK) >> ST_64_BIT_MODE_LSB) -#define ST_64_BIT_MODE_SET(x) (((x) << ST_64_BIT_MODE_LSB) & ST_64_BIT_MODE_MASK) - -#define MESSAGE_WR_ADDRESS 0x00000298 -#define MESSAGE_WR_OFFSET 0x00000298 -#define MESSAGE_WR_TYPE_MSB 31 -#define MESSAGE_WR_TYPE_LSB 0 -#define MESSAGE_WR_TYPE_MASK 0xffffffff -#define MESSAGE_WR_TYPE_GET(x) (((x) & MESSAGE_WR_TYPE_MASK) >> MESSAGE_WR_TYPE_LSB) -#define MESSAGE_WR_TYPE_SET(x) (((x) << MESSAGE_WR_TYPE_LSB) & MESSAGE_WR_TYPE_MASK) - -#define MESSAGE_WR_P_ADDRESS 0x0000029c -#define MESSAGE_WR_P_OFFSET 0x0000029c -#define MESSAGE_WR_P_PARAMETER_MSB 31 -#define MESSAGE_WR_P_PARAMETER_LSB 0 -#define MESSAGE_WR_P_PARAMETER_MASK 0xffffffff -#define MESSAGE_WR_P_PARAMETER_GET(x) (((x) & MESSAGE_WR_P_PARAMETER_MASK) >> MESSAGE_WR_P_PARAMETER_LSB) -#define MESSAGE_WR_P_PARAMETER_SET(x) (((x) << MESSAGE_WR_P_PARAMETER_LSB) & MESSAGE_WR_P_PARAMETER_MASK) - -#define MESSAGE_RD_ADDRESS 0x000002a0 -#define MESSAGE_RD_OFFSET 0x000002a0 -#define MESSAGE_RD_TYPE_MSB 31 -#define MESSAGE_RD_TYPE_LSB 0 -#define MESSAGE_RD_TYPE_MASK 0xffffffff -#define MESSAGE_RD_TYPE_GET(x) (((x) & MESSAGE_RD_TYPE_MASK) >> MESSAGE_RD_TYPE_LSB) -#define MESSAGE_RD_TYPE_SET(x) (((x) << MESSAGE_RD_TYPE_LSB) & MESSAGE_RD_TYPE_MASK) - -#define MESSAGE_RD_P_ADDRESS 0x000002a4 -#define MESSAGE_RD_P_OFFSET 0x000002a4 -#define MESSAGE_RD_P_PARAMETER_MSB 31 -#define MESSAGE_RD_P_PARAMETER_LSB 0 -#define MESSAGE_RD_P_PARAMETER_MASK 0xffffffff -#define MESSAGE_RD_P_PARAMETER_GET(x) (((x) & MESSAGE_RD_P_PARAMETER_MASK) >> MESSAGE_RD_P_PARAMETER_LSB) -#define MESSAGE_RD_P_PARAMETER_SET(x) (((x) << MESSAGE_RD_P_PARAMETER_LSB) & MESSAGE_RD_P_PARAMETER_MASK) - -#define CHIP_MODE_ADDRESS 0x000002a8 -#define CHIP_MODE_OFFSET 0x000002a8 -#define CHIP_MODE_BIT_MSB 1 -#define CHIP_MODE_BIT_LSB 0 -#define CHIP_MODE_BIT_MASK 0x00000003 -#define CHIP_MODE_BIT_GET(x) (((x) & CHIP_MODE_BIT_MASK) >> CHIP_MODE_BIT_LSB) -#define CHIP_MODE_BIT_SET(x) (((x) << CHIP_MODE_BIT_LSB) & CHIP_MODE_BIT_MASK) - -#define CLK_REQ_FALL_EDGE_ADDRESS 0x000002ac -#define CLK_REQ_FALL_EDGE_OFFSET 0x000002ac -#define CLK_REQ_FALL_EDGE_EN_MSB 31 -#define CLK_REQ_FALL_EDGE_EN_LSB 31 -#define CLK_REQ_FALL_EDGE_EN_MASK 0x80000000 -#define CLK_REQ_FALL_EDGE_EN_GET(x) (((x) & CLK_REQ_FALL_EDGE_EN_MASK) >> CLK_REQ_FALL_EDGE_EN_LSB) -#define CLK_REQ_FALL_EDGE_EN_SET(x) (((x) << CLK_REQ_FALL_EDGE_EN_LSB) & CLK_REQ_FALL_EDGE_EN_MASK) -#define CLK_REQ_FALL_EDGE_DELAY_MSB 7 -#define CLK_REQ_FALL_EDGE_DELAY_LSB 0 -#define CLK_REQ_FALL_EDGE_DELAY_MASK 0x000000ff -#define CLK_REQ_FALL_EDGE_DELAY_GET(x) (((x) & CLK_REQ_FALL_EDGE_DELAY_MASK) >> CLK_REQ_FALL_EDGE_DELAY_LSB) -#define CLK_REQ_FALL_EDGE_DELAY_SET(x) (((x) << CLK_REQ_FALL_EDGE_DELAY_LSB) & CLK_REQ_FALL_EDGE_DELAY_MASK) - -#define OTP_ADDRESS 0x000002b0 -#define OTP_OFFSET 0x000002b0 -#define OTP_LDO25_EN_MSB 1 -#define OTP_LDO25_EN_LSB 1 -#define OTP_LDO25_EN_MASK 0x00000002 -#define OTP_LDO25_EN_GET(x) (((x) & OTP_LDO25_EN_MASK) >> OTP_LDO25_EN_LSB) -#define OTP_LDO25_EN_SET(x) (((x) << OTP_LDO25_EN_LSB) & OTP_LDO25_EN_MASK) -#define OTP_VDD12_EN_MSB 0 -#define OTP_VDD12_EN_LSB 0 -#define OTP_VDD12_EN_MASK 0x00000001 -#define OTP_VDD12_EN_GET(x) (((x) & OTP_VDD12_EN_MASK) >> OTP_VDD12_EN_LSB) -#define OTP_VDD12_EN_SET(x) (((x) << OTP_VDD12_EN_LSB) & OTP_VDD12_EN_MASK) - -#define OTP_STATUS_ADDRESS 0x000002b4 -#define OTP_STATUS_OFFSET 0x000002b4 -#define OTP_STATUS_LDO25_EN_READY_MSB 1 -#define OTP_STATUS_LDO25_EN_READY_LSB 1 -#define OTP_STATUS_LDO25_EN_READY_MASK 0x00000002 -#define OTP_STATUS_LDO25_EN_READY_GET(x) (((x) & OTP_STATUS_LDO25_EN_READY_MASK) >> OTP_STATUS_LDO25_EN_READY_LSB) -#define OTP_STATUS_LDO25_EN_READY_SET(x) (((x) << OTP_STATUS_LDO25_EN_READY_LSB) & OTP_STATUS_LDO25_EN_READY_MASK) -#define OTP_STATUS_VDD12_EN_READY_MSB 0 -#define OTP_STATUS_VDD12_EN_READY_LSB 0 -#define OTP_STATUS_VDD12_EN_READY_MASK 0x00000001 -#define OTP_STATUS_VDD12_EN_READY_GET(x) (((x) & OTP_STATUS_VDD12_EN_READY_MASK) >> OTP_STATUS_VDD12_EN_READY_LSB) -#define OTP_STATUS_VDD12_EN_READY_SET(x) (((x) << OTP_STATUS_VDD12_EN_READY_LSB) & OTP_STATUS_VDD12_EN_READY_MASK) - -#define PMU_ADDRESS 0x000002b8 -#define PMU_OFFSET 0x000002b8 -#define PMU_REG_WAKEUP_TIME_SEL_MSB 1 -#define PMU_REG_WAKEUP_TIME_SEL_LSB 0 -#define PMU_REG_WAKEUP_TIME_SEL_MASK 0x00000003 -#define PMU_REG_WAKEUP_TIME_SEL_GET(x) (((x) & PMU_REG_WAKEUP_TIME_SEL_MASK) >> PMU_REG_WAKEUP_TIME_SEL_LSB) -#define PMU_REG_WAKEUP_TIME_SEL_SET(x) (((x) << PMU_REG_WAKEUP_TIME_SEL_LSB) & PMU_REG_WAKEUP_TIME_SEL_MASK) - -#define PMU_CONFIG_ADDRESS 0x000002c0 -#define PMU_CONFIG_OFFSET 0x000002c0 -#define PMU_CONFIG_VALUE_MSB 15 -#define PMU_CONFIG_VALUE_LSB 0 -#define PMU_CONFIG_VALUE_MASK 0x0000ffff -#define PMU_CONFIG_VALUE_GET(x) (((x) & PMU_CONFIG_VALUE_MASK) >> PMU_CONFIG_VALUE_LSB) -#define PMU_CONFIG_VALUE_SET(x) (((x) << PMU_CONFIG_VALUE_LSB) & PMU_CONFIG_VALUE_MASK) - -#define PMU_BYPASS_ADDRESS 0x000002c8 -#define PMU_BYPASS_OFFSET 0x000002c8 -#define PMU_BYPASS_SWREG_MSB 2 -#define PMU_BYPASS_SWREG_LSB 2 -#define PMU_BYPASS_SWREG_MASK 0x00000004 -#define PMU_BYPASS_SWREG_GET(x) (((x) & PMU_BYPASS_SWREG_MASK) >> PMU_BYPASS_SWREG_LSB) -#define PMU_BYPASS_SWREG_SET(x) (((x) << PMU_BYPASS_SWREG_LSB) & PMU_BYPASS_SWREG_MASK) -#define PMU_BYPASS_DREG_MSB 1 -#define PMU_BYPASS_DREG_LSB 1 -#define PMU_BYPASS_DREG_MASK 0x00000002 -#define PMU_BYPASS_DREG_GET(x) (((x) & PMU_BYPASS_DREG_MASK) >> PMU_BYPASS_DREG_LSB) -#define PMU_BYPASS_DREG_SET(x) (((x) << PMU_BYPASS_DREG_LSB) & PMU_BYPASS_DREG_MASK) -#define PMU_BYPASS_PAREG_MSB 0 -#define PMU_BYPASS_PAREG_LSB 0 -#define PMU_BYPASS_PAREG_MASK 0x00000001 -#define PMU_BYPASS_PAREG_GET(x) (((x) & PMU_BYPASS_PAREG_MASK) >> PMU_BYPASS_PAREG_LSB) -#define PMU_BYPASS_PAREG_SET(x) (((x) << PMU_BYPASS_PAREG_LSB) & PMU_BYPASS_PAREG_MASK) - -#define MAC_PCU_TSF2_L32_ADDRESS 0x000002cc -#define MAC_PCU_TSF2_L32_OFFSET 0x000002cc -#define MAC_PCU_TSF2_L32_VALUE_MSB 31 -#define MAC_PCU_TSF2_L32_VALUE_LSB 0 -#define MAC_PCU_TSF2_L32_VALUE_MASK 0xffffffff -#define MAC_PCU_TSF2_L32_VALUE_GET(x) (((x) & MAC_PCU_TSF2_L32_VALUE_MASK) >> MAC_PCU_TSF2_L32_VALUE_LSB) -#define MAC_PCU_TSF2_L32_VALUE_SET(x) (((x) << MAC_PCU_TSF2_L32_VALUE_LSB) & MAC_PCU_TSF2_L32_VALUE_MASK) - -#define MAC_PCU_TSF2_U32_ADDRESS 0x000002d0 -#define MAC_PCU_TSF2_U32_OFFSET 0x000002d0 -#define MAC_PCU_TSF2_U32_VALUE_MSB 31 -#define MAC_PCU_TSF2_U32_VALUE_LSB 0 -#define MAC_PCU_TSF2_U32_VALUE_MASK 0xffffffff -#define MAC_PCU_TSF2_U32_VALUE_GET(x) (((x) & MAC_PCU_TSF2_U32_VALUE_MASK) >> MAC_PCU_TSF2_U32_VALUE_LSB) -#define MAC_PCU_TSF2_U32_VALUE_SET(x) (((x) << MAC_PCU_TSF2_U32_VALUE_LSB) & MAC_PCU_TSF2_U32_VALUE_MASK) - -#define MAC_PCU_GENERIC_TIMERS_MODE3_ADDRESS 0x000002d4 -#define MAC_PCU_GENERIC_TIMERS_MODE3_OFFSET 0x000002d4 -#define MAC_PCU_GENERIC_TIMERS_MODE3_OVERFLOW_INDEX_MSB 27 -#define MAC_PCU_GENERIC_TIMERS_MODE3_OVERFLOW_INDEX_LSB 24 -#define MAC_PCU_GENERIC_TIMERS_MODE3_OVERFLOW_INDEX_MASK 0x0f000000 -#define MAC_PCU_GENERIC_TIMERS_MODE3_OVERFLOW_INDEX_GET(x) (((x) & MAC_PCU_GENERIC_TIMERS_MODE3_OVERFLOW_INDEX_MASK) >> MAC_PCU_GENERIC_TIMERS_MODE3_OVERFLOW_INDEX_LSB) -#define MAC_PCU_GENERIC_TIMERS_MODE3_OVERFLOW_INDEX_SET(x) (((x) << MAC_PCU_GENERIC_TIMERS_MODE3_OVERFLOW_INDEX_LSB) & MAC_PCU_GENERIC_TIMERS_MODE3_OVERFLOW_INDEX_MASK) -#define MAC_PCU_GENERIC_TIMERS_MODE3_THRESH_MSB 19 -#define MAC_PCU_GENERIC_TIMERS_MODE3_THRESH_LSB 0 -#define MAC_PCU_GENERIC_TIMERS_MODE3_THRESH_MASK 0x000fffff -#define MAC_PCU_GENERIC_TIMERS_MODE3_THRESH_GET(x) (((x) & MAC_PCU_GENERIC_TIMERS_MODE3_THRESH_MASK) >> MAC_PCU_GENERIC_TIMERS_MODE3_THRESH_LSB) -#define MAC_PCU_GENERIC_TIMERS_MODE3_THRESH_SET(x) (((x) << MAC_PCU_GENERIC_TIMERS_MODE3_THRESH_LSB) & MAC_PCU_GENERIC_TIMERS_MODE3_THRESH_MASK) - -#define MAC_PCU_DIRECT_CONNECT_ADDRESS 0x000002d8 -#define MAC_PCU_DIRECT_CONNECT_OFFSET 0x000002d8 -#define MAC_PCU_DIRECT_CONNECT_STA_TSF_1_2_SEL_MSB 2 -#define MAC_PCU_DIRECT_CONNECT_STA_TSF_1_2_SEL_LSB 2 -#define MAC_PCU_DIRECT_CONNECT_STA_TSF_1_2_SEL_MASK 0x00000004 -#define MAC_PCU_DIRECT_CONNECT_STA_TSF_1_2_SEL_GET(x) (((x) & MAC_PCU_DIRECT_CONNECT_STA_TSF_1_2_SEL_MASK) >> MAC_PCU_DIRECT_CONNECT_STA_TSF_1_2_SEL_LSB) -#define MAC_PCU_DIRECT_CONNECT_STA_TSF_1_2_SEL_SET(x) (((x) << MAC_PCU_DIRECT_CONNECT_STA_TSF_1_2_SEL_LSB) & MAC_PCU_DIRECT_CONNECT_STA_TSF_1_2_SEL_MASK) -#define MAC_PCU_DIRECT_CONNECT_AP_TSF_1_2_SEL_MSB 1 -#define MAC_PCU_DIRECT_CONNECT_AP_TSF_1_2_SEL_LSB 1 -#define MAC_PCU_DIRECT_CONNECT_AP_TSF_1_2_SEL_MASK 0x00000002 -#define MAC_PCU_DIRECT_CONNECT_AP_TSF_1_2_SEL_GET(x) (((x) & MAC_PCU_DIRECT_CONNECT_AP_TSF_1_2_SEL_MASK) >> MAC_PCU_DIRECT_CONNECT_AP_TSF_1_2_SEL_LSB) -#define MAC_PCU_DIRECT_CONNECT_AP_TSF_1_2_SEL_SET(x) (((x) << MAC_PCU_DIRECT_CONNECT_AP_TSF_1_2_SEL_LSB) & MAC_PCU_DIRECT_CONNECT_AP_TSF_1_2_SEL_MASK) -#define MAC_PCU_DIRECT_CONNECT_AP_STA_ENABLE_MSB 0 -#define MAC_PCU_DIRECT_CONNECT_AP_STA_ENABLE_LSB 0 -#define MAC_PCU_DIRECT_CONNECT_AP_STA_ENABLE_MASK 0x00000001 -#define MAC_PCU_DIRECT_CONNECT_AP_STA_ENABLE_GET(x) (((x) & MAC_PCU_DIRECT_CONNECT_AP_STA_ENABLE_MASK) >> MAC_PCU_DIRECT_CONNECT_AP_STA_ENABLE_LSB) -#define MAC_PCU_DIRECT_CONNECT_AP_STA_ENABLE_SET(x) (((x) << MAC_PCU_DIRECT_CONNECT_AP_STA_ENABLE_LSB) & MAC_PCU_DIRECT_CONNECT_AP_STA_ENABLE_MASK) - -#define THERM_CTRL1_ADDRESS 0x000002dc -#define THERM_CTRL1_OFFSET 0x000002dc -#define THERM_CTRL1_BYPASS_MSB 16 -#define THERM_CTRL1_BYPASS_LSB 16 -#define THERM_CTRL1_BYPASS_MASK 0x00010000 -#define THERM_CTRL1_BYPASS_GET(x) (((x) & THERM_CTRL1_BYPASS_MASK) >> THERM_CTRL1_BYPASS_LSB) -#define THERM_CTRL1_BYPASS_SET(x) (((x) << THERM_CTRL1_BYPASS_LSB) & THERM_CTRL1_BYPASS_MASK) -#define THERM_CTRL1_WIDTH_ARBITOR_MSB 15 -#define THERM_CTRL1_WIDTH_ARBITOR_LSB 12 -#define THERM_CTRL1_WIDTH_ARBITOR_MASK 0x0000f000 -#define THERM_CTRL1_WIDTH_ARBITOR_GET(x) (((x) & THERM_CTRL1_WIDTH_ARBITOR_MASK) >> THERM_CTRL1_WIDTH_ARBITOR_LSB) -#define THERM_CTRL1_WIDTH_ARBITOR_SET(x) (((x) << THERM_CTRL1_WIDTH_ARBITOR_LSB) & THERM_CTRL1_WIDTH_ARBITOR_MASK) -#define THERM_CTRL1_WIDTH_MSB 11 -#define THERM_CTRL1_WIDTH_LSB 5 -#define THERM_CTRL1_WIDTH_MASK 0x00000fe0 -#define THERM_CTRL1_WIDTH_GET(x) (((x) & THERM_CTRL1_WIDTH_MASK) >> THERM_CTRL1_WIDTH_LSB) -#define THERM_CTRL1_WIDTH_SET(x) (((x) << THERM_CTRL1_WIDTH_LSB) & THERM_CTRL1_WIDTH_MASK) -#define THERM_CTRL1_TYPE_MSB 4 -#define THERM_CTRL1_TYPE_LSB 3 -#define THERM_CTRL1_TYPE_MASK 0x00000018 -#define THERM_CTRL1_TYPE_GET(x) (((x) & THERM_CTRL1_TYPE_MASK) >> THERM_CTRL1_TYPE_LSB) -#define THERM_CTRL1_TYPE_SET(x) (((x) << THERM_CTRL1_TYPE_LSB) & THERM_CTRL1_TYPE_MASK) -#define THERM_CTRL1_MEASURE_MSB 2 -#define THERM_CTRL1_MEASURE_LSB 2 -#define THERM_CTRL1_MEASURE_MASK 0x00000004 -#define THERM_CTRL1_MEASURE_GET(x) (((x) & THERM_CTRL1_MEASURE_MASK) >> THERM_CTRL1_MEASURE_LSB) -#define THERM_CTRL1_MEASURE_SET(x) (((x) << THERM_CTRL1_MEASURE_LSB) & THERM_CTRL1_MEASURE_MASK) -#define THERM_CTRL1_INT_EN_MSB 1 -#define THERM_CTRL1_INT_EN_LSB 1 -#define THERM_CTRL1_INT_EN_MASK 0x00000002 -#define THERM_CTRL1_INT_EN_GET(x) (((x) & THERM_CTRL1_INT_EN_MASK) >> THERM_CTRL1_INT_EN_LSB) -#define THERM_CTRL1_INT_EN_SET(x) (((x) << THERM_CTRL1_INT_EN_LSB) & THERM_CTRL1_INT_EN_MASK) -#define THERM_CTRL1_INT_STATUS_MSB 0 -#define THERM_CTRL1_INT_STATUS_LSB 0 -#define THERM_CTRL1_INT_STATUS_MASK 0x00000001 -#define THERM_CTRL1_INT_STATUS_GET(x) (((x) & THERM_CTRL1_INT_STATUS_MASK) >> THERM_CTRL1_INT_STATUS_LSB) -#define THERM_CTRL1_INT_STATUS_SET(x) (((x) << THERM_CTRL1_INT_STATUS_LSB) & THERM_CTRL1_INT_STATUS_MASK) - -#define THERM_CTRL2_ADDRESS 0x000002e0 -#define THERM_CTRL2_OFFSET 0x000002e0 -#define THERM_CTRL2_ADC_OFF_MSB 25 -#define THERM_CTRL2_ADC_OFF_LSB 25 -#define THERM_CTRL2_ADC_OFF_MASK 0x02000000 -#define THERM_CTRL2_ADC_OFF_GET(x) (((x) & THERM_CTRL2_ADC_OFF_MASK) >> THERM_CTRL2_ADC_OFF_LSB) -#define THERM_CTRL2_ADC_OFF_SET(x) (((x) << THERM_CTRL2_ADC_OFF_LSB) & THERM_CTRL2_ADC_OFF_MASK) -#define THERM_CTRL2_ADC_ON_MSB 24 -#define THERM_CTRL2_ADC_ON_LSB 24 -#define THERM_CTRL2_ADC_ON_MASK 0x01000000 -#define THERM_CTRL2_ADC_ON_GET(x) (((x) & THERM_CTRL2_ADC_ON_MASK) >> THERM_CTRL2_ADC_ON_LSB) -#define THERM_CTRL2_ADC_ON_SET(x) (((x) << THERM_CTRL2_ADC_ON_LSB) & THERM_CTRL2_ADC_ON_MASK) -#define THERM_CTRL2_SAMPLE_MSB 23 -#define THERM_CTRL2_SAMPLE_LSB 16 -#define THERM_CTRL2_SAMPLE_MASK 0x00ff0000 -#define THERM_CTRL2_SAMPLE_GET(x) (((x) & THERM_CTRL2_SAMPLE_MASK) >> THERM_CTRL2_SAMPLE_LSB) -#define THERM_CTRL2_SAMPLE_SET(x) (((x) << THERM_CTRL2_SAMPLE_LSB) & THERM_CTRL2_SAMPLE_MASK) -#define THERM_CTRL2_HIGH_MSB 15 -#define THERM_CTRL2_HIGH_LSB 8 -#define THERM_CTRL2_HIGH_MASK 0x0000ff00 -#define THERM_CTRL2_HIGH_GET(x) (((x) & THERM_CTRL2_HIGH_MASK) >> THERM_CTRL2_HIGH_LSB) -#define THERM_CTRL2_HIGH_SET(x) (((x) << THERM_CTRL2_HIGH_LSB) & THERM_CTRL2_HIGH_MASK) -#define THERM_CTRL2_LOW_MSB 7 -#define THERM_CTRL2_LOW_LSB 0 -#define THERM_CTRL2_LOW_MASK 0x000000ff -#define THERM_CTRL2_LOW_GET(x) (((x) & THERM_CTRL2_LOW_MASK) >> THERM_CTRL2_LOW_LSB) -#define THERM_CTRL2_LOW_SET(x) (((x) << THERM_CTRL2_LOW_LSB) & THERM_CTRL2_LOW_MASK) - -#define THERM_CTRL3_ADDRESS 0x000002e4 -#define THERM_CTRL3_OFFSET 0x000002e4 -#define THERM_CTRL3_ADC_GAIN_MSB 16 -#define THERM_CTRL3_ADC_GAIN_LSB 8 -#define THERM_CTRL3_ADC_GAIN_MASK 0x0001ff00 -#define THERM_CTRL3_ADC_GAIN_GET(x) (((x) & THERM_CTRL3_ADC_GAIN_MASK) >> THERM_CTRL3_ADC_GAIN_LSB) -#define THERM_CTRL3_ADC_GAIN_SET(x) (((x) << THERM_CTRL3_ADC_GAIN_LSB) & THERM_CTRL3_ADC_GAIN_MASK) -#define THERM_CTRL3_ADC_OFFSET_MSB 7 -#define THERM_CTRL3_ADC_OFFSET_LSB 0 -#define THERM_CTRL3_ADC_OFFSET_MASK 0x000000ff -#define THERM_CTRL3_ADC_OFFSET_GET(x) (((x) & THERM_CTRL3_ADC_OFFSET_MASK) >> THERM_CTRL3_ADC_OFFSET_LSB) -#define THERM_CTRL3_ADC_OFFSET_SET(x) (((x) << THERM_CTRL3_ADC_OFFSET_LSB) & THERM_CTRL3_ADC_OFFSET_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct rtc_wlan_reg_reg_s { - volatile unsigned int wlan_reset_control; - volatile unsigned int wlan_xtal_control; - volatile unsigned int wlan_tcxo_detect; - volatile unsigned int wlan_xtal_test; - volatile unsigned int wlan_quadrature; - volatile unsigned int wlan_pll_control; - volatile unsigned int wlan_pll_settle; - volatile unsigned int wlan_xtal_settle; - volatile unsigned int wlan_cpu_clock; - volatile unsigned int wlan_clock_out; - volatile unsigned int wlan_clock_control; - volatile unsigned int wlan_bias_override; - volatile unsigned int wlan_wdt_control; - volatile unsigned int wlan_wdt_status; - volatile unsigned int wlan_wdt; - volatile unsigned int wlan_wdt_count; - volatile unsigned int wlan_wdt_reset; - volatile unsigned int wlan_int_status; - volatile unsigned int wlan_lf_timer0; - volatile unsigned int wlan_lf_timer_count0; - volatile unsigned int wlan_lf_timer_control0; - volatile unsigned int wlan_lf_timer_status0; - volatile unsigned int wlan_lf_timer1; - volatile unsigned int wlan_lf_timer_count1; - volatile unsigned int wlan_lf_timer_control1; - volatile unsigned int wlan_lf_timer_status1; - volatile unsigned int wlan_lf_timer2; - volatile unsigned int wlan_lf_timer_count2; - volatile unsigned int wlan_lf_timer_control2; - volatile unsigned int wlan_lf_timer_status2; - volatile unsigned int wlan_lf_timer3; - volatile unsigned int wlan_lf_timer_count3; - volatile unsigned int wlan_lf_timer_control3; - volatile unsigned int wlan_lf_timer_status3; - volatile unsigned int wlan_hf_timer; - volatile unsigned int wlan_hf_timer_count; - volatile unsigned int wlan_hf_lf_count; - volatile unsigned int wlan_hf_timer_control; - volatile unsigned int wlan_hf_timer_status; - volatile unsigned int wlan_rtc_control; - volatile unsigned int wlan_rtc_time; - volatile unsigned int wlan_rtc_date; - volatile unsigned int wlan_rtc_set_time; - volatile unsigned int wlan_rtc_set_date; - volatile unsigned int wlan_rtc_set_alarm; - volatile unsigned int wlan_rtc_config; - volatile unsigned int wlan_rtc_alarm_status; - volatile unsigned int wlan_uart_wakeup; - volatile unsigned int wlan_reset_cause; - volatile unsigned int wlan_system_sleep; - volatile unsigned int wlan_sdio_wrapper; - volatile unsigned int wlan_mac_sleep_control; - volatile unsigned int wlan_keep_awake; - volatile unsigned int wlan_lpo_cal_time; - volatile unsigned int wlan_lpo_init_dividend_int; - volatile unsigned int wlan_lpo_init_dividend_fraction; - volatile unsigned int wlan_lpo_cal; - volatile unsigned int wlan_lpo_cal_test_control; - volatile unsigned int wlan_lpo_cal_test_status; - volatile unsigned int wlan_chip_id; - volatile unsigned int wlan_derived_rtc_clk; - volatile unsigned int mac_pcu_slp32_mode; - volatile unsigned int mac_pcu_slp32_wake; - volatile unsigned int mac_pcu_slp32_inc; - volatile unsigned int mac_pcu_slp_mib1; - volatile unsigned int mac_pcu_slp_mib2; - volatile unsigned int mac_pcu_slp_mib3; - volatile unsigned int wlan_power_reg; - volatile unsigned int wlan_core_clk_ctrl; - volatile unsigned int wlan_gpio_wakeup_control; - volatile unsigned int ht; - volatile unsigned int mac_pcu_tsf_l32; - volatile unsigned int mac_pcu_tsf_u32; - volatile unsigned int mac_pcu_wbtimer; - unsigned char pad0[24]; /* pad to 0x140 */ - volatile unsigned int mac_pcu_generic_timers[16]; - volatile unsigned int mac_pcu_generic_timers_mode; - unsigned char pad1[60]; /* pad to 0x1c0 */ - volatile unsigned int mac_pcu_generic_timers2[16]; - volatile unsigned int mac_pcu_generic_timers_mode2; - volatile unsigned int mac_pcu_slp1; - volatile unsigned int mac_pcu_slp2; - volatile unsigned int mac_pcu_reset_tsf; - volatile unsigned int mac_pcu_tsf_add_pll; - volatile unsigned int sleep_retention; - volatile unsigned int btcoexctrl; - volatile unsigned int wbsync_priority1; - volatile unsigned int wbsync_priority2; - volatile unsigned int wbsync_priority3; - volatile unsigned int btcoex0; - volatile unsigned int btcoex1; - volatile unsigned int btcoex2; - volatile unsigned int btcoex3; - volatile unsigned int btcoex4; - volatile unsigned int btcoex5; - volatile unsigned int btcoex6; - volatile unsigned int lock; - volatile unsigned int nolock_priority; - volatile unsigned int wbsync; - volatile unsigned int wbsync1; - volatile unsigned int wbsync2; - volatile unsigned int wbsync3; - volatile unsigned int wb_timer_target; - volatile unsigned int wb_timer_slop; - volatile unsigned int btcoex_int_en; - volatile unsigned int btcoex_int_stat; - volatile unsigned int btpriority_int_en; - volatile unsigned int btpriority_int_stat; - volatile unsigned int btpriority_stomp_int_en; - volatile unsigned int btpriority_stomp_int_stat; - volatile unsigned int mac_pcu_bmiss_timeout; - volatile unsigned int mac_pcu_cab_awake; - volatile unsigned int lp_perf_counter; - volatile unsigned int lp_perf_light_sleep; - volatile unsigned int lp_perf_deep_sleep; - volatile unsigned int lp_perf_on; - volatile unsigned int st_64_bit; - volatile unsigned int message_wr; - volatile unsigned int message_wr_p; - volatile unsigned int message_rd; - volatile unsigned int message_rd_p; - volatile unsigned int chip_mode; - volatile unsigned int clk_req_fall_edge; - volatile unsigned int otp; - volatile unsigned int otp_status; - volatile unsigned int pmu; - unsigned char pad2[4]; /* pad to 0x2c0 */ - volatile unsigned int pmu_config[2]; - volatile unsigned int pmu_bypass; - volatile unsigned int mac_pcu_tsf2_l32; - volatile unsigned int mac_pcu_tsf2_u32; - volatile unsigned int mac_pcu_generic_timers_mode3; - volatile unsigned int mac_pcu_direct_connect; - volatile unsigned int therm_ctrl1; - volatile unsigned int therm_ctrl2; - volatile unsigned int therm_ctrl3; -} rtc_wlan_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _RTC_WLAN_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/si_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/si_reg.h deleted file mode 100644 index f66796baee48..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/si_reg.h +++ /dev/null @@ -1,209 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _SI_REG_REG_H_ -#define _SI_REG_REG_H_ - -#define SI_CONFIG_ADDRESS 0x00000000 -#define SI_CONFIG_OFFSET 0x00000000 -#define SI_CONFIG_ERR_INT_MSB 19 -#define SI_CONFIG_ERR_INT_LSB 19 -#define SI_CONFIG_ERR_INT_MASK 0x00080000 -#define SI_CONFIG_ERR_INT_GET(x) (((x) & SI_CONFIG_ERR_INT_MASK) >> SI_CONFIG_ERR_INT_LSB) -#define SI_CONFIG_ERR_INT_SET(x) (((x) << SI_CONFIG_ERR_INT_LSB) & SI_CONFIG_ERR_INT_MASK) -#define SI_CONFIG_BIDIR_OD_DATA_MSB 18 -#define SI_CONFIG_BIDIR_OD_DATA_LSB 18 -#define SI_CONFIG_BIDIR_OD_DATA_MASK 0x00040000 -#define SI_CONFIG_BIDIR_OD_DATA_GET(x) (((x) & SI_CONFIG_BIDIR_OD_DATA_MASK) >> SI_CONFIG_BIDIR_OD_DATA_LSB) -#define SI_CONFIG_BIDIR_OD_DATA_SET(x) (((x) << SI_CONFIG_BIDIR_OD_DATA_LSB) & SI_CONFIG_BIDIR_OD_DATA_MASK) -#define SI_CONFIG_I2C_MSB 16 -#define SI_CONFIG_I2C_LSB 16 -#define SI_CONFIG_I2C_MASK 0x00010000 -#define SI_CONFIG_I2C_GET(x) (((x) & SI_CONFIG_I2C_MASK) >> SI_CONFIG_I2C_LSB) -#define SI_CONFIG_I2C_SET(x) (((x) << SI_CONFIG_I2C_LSB) & SI_CONFIG_I2C_MASK) -#define SI_CONFIG_POS_SAMPLE_MSB 7 -#define SI_CONFIG_POS_SAMPLE_LSB 7 -#define SI_CONFIG_POS_SAMPLE_MASK 0x00000080 -#define SI_CONFIG_POS_SAMPLE_GET(x) (((x) & SI_CONFIG_POS_SAMPLE_MASK) >> SI_CONFIG_POS_SAMPLE_LSB) -#define SI_CONFIG_POS_SAMPLE_SET(x) (((x) << SI_CONFIG_POS_SAMPLE_LSB) & SI_CONFIG_POS_SAMPLE_MASK) -#define SI_CONFIG_POS_DRIVE_MSB 6 -#define SI_CONFIG_POS_DRIVE_LSB 6 -#define SI_CONFIG_POS_DRIVE_MASK 0x00000040 -#define SI_CONFIG_POS_DRIVE_GET(x) (((x) & SI_CONFIG_POS_DRIVE_MASK) >> SI_CONFIG_POS_DRIVE_LSB) -#define SI_CONFIG_POS_DRIVE_SET(x) (((x) << SI_CONFIG_POS_DRIVE_LSB) & SI_CONFIG_POS_DRIVE_MASK) -#define SI_CONFIG_INACTIVE_DATA_MSB 5 -#define SI_CONFIG_INACTIVE_DATA_LSB 5 -#define SI_CONFIG_INACTIVE_DATA_MASK 0x00000020 -#define SI_CONFIG_INACTIVE_DATA_GET(x) (((x) & SI_CONFIG_INACTIVE_DATA_MASK) >> SI_CONFIG_INACTIVE_DATA_LSB) -#define SI_CONFIG_INACTIVE_DATA_SET(x) (((x) << SI_CONFIG_INACTIVE_DATA_LSB) & SI_CONFIG_INACTIVE_DATA_MASK) -#define SI_CONFIG_INACTIVE_CLK_MSB 4 -#define SI_CONFIG_INACTIVE_CLK_LSB 4 -#define SI_CONFIG_INACTIVE_CLK_MASK 0x00000010 -#define SI_CONFIG_INACTIVE_CLK_GET(x) (((x) & SI_CONFIG_INACTIVE_CLK_MASK) >> SI_CONFIG_INACTIVE_CLK_LSB) -#define SI_CONFIG_INACTIVE_CLK_SET(x) (((x) << SI_CONFIG_INACTIVE_CLK_LSB) & SI_CONFIG_INACTIVE_CLK_MASK) -#define SI_CONFIG_DIVIDER_MSB 3 -#define SI_CONFIG_DIVIDER_LSB 0 -#define SI_CONFIG_DIVIDER_MASK 0x0000000f -#define SI_CONFIG_DIVIDER_GET(x) (((x) & SI_CONFIG_DIVIDER_MASK) >> SI_CONFIG_DIVIDER_LSB) -#define SI_CONFIG_DIVIDER_SET(x) (((x) << SI_CONFIG_DIVIDER_LSB) & SI_CONFIG_DIVIDER_MASK) - -#define SI_CS_ADDRESS 0x00000004 -#define SI_CS_OFFSET 0x00000004 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_MSB 13 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_LSB 11 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_MASK 0x00003800 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_GET(x) (((x) & SI_CS_BIT_CNT_IN_LAST_BYTE_MASK) >> SI_CS_BIT_CNT_IN_LAST_BYTE_LSB) -#define SI_CS_BIT_CNT_IN_LAST_BYTE_SET(x) (((x) << SI_CS_BIT_CNT_IN_LAST_BYTE_LSB) & SI_CS_BIT_CNT_IN_LAST_BYTE_MASK) -#define SI_CS_DONE_ERR_MSB 10 -#define SI_CS_DONE_ERR_LSB 10 -#define SI_CS_DONE_ERR_MASK 0x00000400 -#define SI_CS_DONE_ERR_GET(x) (((x) & SI_CS_DONE_ERR_MASK) >> SI_CS_DONE_ERR_LSB) -#define SI_CS_DONE_ERR_SET(x) (((x) << SI_CS_DONE_ERR_LSB) & SI_CS_DONE_ERR_MASK) -#define SI_CS_DONE_INT_MSB 9 -#define SI_CS_DONE_INT_LSB 9 -#define SI_CS_DONE_INT_MASK 0x00000200 -#define SI_CS_DONE_INT_GET(x) (((x) & SI_CS_DONE_INT_MASK) >> SI_CS_DONE_INT_LSB) -#define SI_CS_DONE_INT_SET(x) (((x) << SI_CS_DONE_INT_LSB) & SI_CS_DONE_INT_MASK) -#define SI_CS_START_MSB 8 -#define SI_CS_START_LSB 8 -#define SI_CS_START_MASK 0x00000100 -#define SI_CS_START_GET(x) (((x) & SI_CS_START_MASK) >> SI_CS_START_LSB) -#define SI_CS_START_SET(x) (((x) << SI_CS_START_LSB) & SI_CS_START_MASK) -#define SI_CS_RX_CNT_MSB 7 -#define SI_CS_RX_CNT_LSB 4 -#define SI_CS_RX_CNT_MASK 0x000000f0 -#define SI_CS_RX_CNT_GET(x) (((x) & SI_CS_RX_CNT_MASK) >> SI_CS_RX_CNT_LSB) -#define SI_CS_RX_CNT_SET(x) (((x) << SI_CS_RX_CNT_LSB) & SI_CS_RX_CNT_MASK) -#define SI_CS_TX_CNT_MSB 3 -#define SI_CS_TX_CNT_LSB 0 -#define SI_CS_TX_CNT_MASK 0x0000000f -#define SI_CS_TX_CNT_GET(x) (((x) & SI_CS_TX_CNT_MASK) >> SI_CS_TX_CNT_LSB) -#define SI_CS_TX_CNT_SET(x) (((x) << SI_CS_TX_CNT_LSB) & SI_CS_TX_CNT_MASK) - -#define SI_TX_DATA0_ADDRESS 0x00000008 -#define SI_TX_DATA0_OFFSET 0x00000008 -#define SI_TX_DATA0_DATA3_MSB 31 -#define SI_TX_DATA0_DATA3_LSB 24 -#define SI_TX_DATA0_DATA3_MASK 0xff000000 -#define SI_TX_DATA0_DATA3_GET(x) (((x) & SI_TX_DATA0_DATA3_MASK) >> SI_TX_DATA0_DATA3_LSB) -#define SI_TX_DATA0_DATA3_SET(x) (((x) << SI_TX_DATA0_DATA3_LSB) & SI_TX_DATA0_DATA3_MASK) -#define SI_TX_DATA0_DATA2_MSB 23 -#define SI_TX_DATA0_DATA2_LSB 16 -#define SI_TX_DATA0_DATA2_MASK 0x00ff0000 -#define SI_TX_DATA0_DATA2_GET(x) (((x) & SI_TX_DATA0_DATA2_MASK) >> SI_TX_DATA0_DATA2_LSB) -#define SI_TX_DATA0_DATA2_SET(x) (((x) << SI_TX_DATA0_DATA2_LSB) & SI_TX_DATA0_DATA2_MASK) -#define SI_TX_DATA0_DATA1_MSB 15 -#define SI_TX_DATA0_DATA1_LSB 8 -#define SI_TX_DATA0_DATA1_MASK 0x0000ff00 -#define SI_TX_DATA0_DATA1_GET(x) (((x) & SI_TX_DATA0_DATA1_MASK) >> SI_TX_DATA0_DATA1_LSB) -#define SI_TX_DATA0_DATA1_SET(x) (((x) << SI_TX_DATA0_DATA1_LSB) & SI_TX_DATA0_DATA1_MASK) -#define SI_TX_DATA0_DATA0_MSB 7 -#define SI_TX_DATA0_DATA0_LSB 0 -#define SI_TX_DATA0_DATA0_MASK 0x000000ff -#define SI_TX_DATA0_DATA0_GET(x) (((x) & SI_TX_DATA0_DATA0_MASK) >> SI_TX_DATA0_DATA0_LSB) -#define SI_TX_DATA0_DATA0_SET(x) (((x) << SI_TX_DATA0_DATA0_LSB) & SI_TX_DATA0_DATA0_MASK) - -#define SI_TX_DATA1_ADDRESS 0x0000000c -#define SI_TX_DATA1_OFFSET 0x0000000c -#define SI_TX_DATA1_DATA7_MSB 31 -#define SI_TX_DATA1_DATA7_LSB 24 -#define SI_TX_DATA1_DATA7_MASK 0xff000000 -#define SI_TX_DATA1_DATA7_GET(x) (((x) & SI_TX_DATA1_DATA7_MASK) >> SI_TX_DATA1_DATA7_LSB) -#define SI_TX_DATA1_DATA7_SET(x) (((x) << SI_TX_DATA1_DATA7_LSB) & SI_TX_DATA1_DATA7_MASK) -#define SI_TX_DATA1_DATA6_MSB 23 -#define SI_TX_DATA1_DATA6_LSB 16 -#define SI_TX_DATA1_DATA6_MASK 0x00ff0000 -#define SI_TX_DATA1_DATA6_GET(x) (((x) & SI_TX_DATA1_DATA6_MASK) >> SI_TX_DATA1_DATA6_LSB) -#define SI_TX_DATA1_DATA6_SET(x) (((x) << SI_TX_DATA1_DATA6_LSB) & SI_TX_DATA1_DATA6_MASK) -#define SI_TX_DATA1_DATA5_MSB 15 -#define SI_TX_DATA1_DATA5_LSB 8 -#define SI_TX_DATA1_DATA5_MASK 0x0000ff00 -#define SI_TX_DATA1_DATA5_GET(x) (((x) & SI_TX_DATA1_DATA5_MASK) >> SI_TX_DATA1_DATA5_LSB) -#define SI_TX_DATA1_DATA5_SET(x) (((x) << SI_TX_DATA1_DATA5_LSB) & SI_TX_DATA1_DATA5_MASK) -#define SI_TX_DATA1_DATA4_MSB 7 -#define SI_TX_DATA1_DATA4_LSB 0 -#define SI_TX_DATA1_DATA4_MASK 0x000000ff -#define SI_TX_DATA1_DATA4_GET(x) (((x) & SI_TX_DATA1_DATA4_MASK) >> SI_TX_DATA1_DATA4_LSB) -#define SI_TX_DATA1_DATA4_SET(x) (((x) << SI_TX_DATA1_DATA4_LSB) & SI_TX_DATA1_DATA4_MASK) - -#define SI_RX_DATA0_ADDRESS 0x00000010 -#define SI_RX_DATA0_OFFSET 0x00000010 -#define SI_RX_DATA0_DATA3_MSB 31 -#define SI_RX_DATA0_DATA3_LSB 24 -#define SI_RX_DATA0_DATA3_MASK 0xff000000 -#define SI_RX_DATA0_DATA3_GET(x) (((x) & SI_RX_DATA0_DATA3_MASK) >> SI_RX_DATA0_DATA3_LSB) -#define SI_RX_DATA0_DATA3_SET(x) (((x) << SI_RX_DATA0_DATA3_LSB) & SI_RX_DATA0_DATA3_MASK) -#define SI_RX_DATA0_DATA2_MSB 23 -#define SI_RX_DATA0_DATA2_LSB 16 -#define SI_RX_DATA0_DATA2_MASK 0x00ff0000 -#define SI_RX_DATA0_DATA2_GET(x) (((x) & SI_RX_DATA0_DATA2_MASK) >> SI_RX_DATA0_DATA2_LSB) -#define SI_RX_DATA0_DATA2_SET(x) (((x) << SI_RX_DATA0_DATA2_LSB) & SI_RX_DATA0_DATA2_MASK) -#define SI_RX_DATA0_DATA1_MSB 15 -#define SI_RX_DATA0_DATA1_LSB 8 -#define SI_RX_DATA0_DATA1_MASK 0x0000ff00 -#define SI_RX_DATA0_DATA1_GET(x) (((x) & SI_RX_DATA0_DATA1_MASK) >> SI_RX_DATA0_DATA1_LSB) -#define SI_RX_DATA0_DATA1_SET(x) (((x) << SI_RX_DATA0_DATA1_LSB) & SI_RX_DATA0_DATA1_MASK) -#define SI_RX_DATA0_DATA0_MSB 7 -#define SI_RX_DATA0_DATA0_LSB 0 -#define SI_RX_DATA0_DATA0_MASK 0x000000ff -#define SI_RX_DATA0_DATA0_GET(x) (((x) & SI_RX_DATA0_DATA0_MASK) >> SI_RX_DATA0_DATA0_LSB) -#define SI_RX_DATA0_DATA0_SET(x) (((x) << SI_RX_DATA0_DATA0_LSB) & SI_RX_DATA0_DATA0_MASK) - -#define SI_RX_DATA1_ADDRESS 0x00000014 -#define SI_RX_DATA1_OFFSET 0x00000014 -#define SI_RX_DATA1_DATA7_MSB 31 -#define SI_RX_DATA1_DATA7_LSB 24 -#define SI_RX_DATA1_DATA7_MASK 0xff000000 -#define SI_RX_DATA1_DATA7_GET(x) (((x) & SI_RX_DATA1_DATA7_MASK) >> SI_RX_DATA1_DATA7_LSB) -#define SI_RX_DATA1_DATA7_SET(x) (((x) << SI_RX_DATA1_DATA7_LSB) & SI_RX_DATA1_DATA7_MASK) -#define SI_RX_DATA1_DATA6_MSB 23 -#define SI_RX_DATA1_DATA6_LSB 16 -#define SI_RX_DATA1_DATA6_MASK 0x00ff0000 -#define SI_RX_DATA1_DATA6_GET(x) (((x) & SI_RX_DATA1_DATA6_MASK) >> SI_RX_DATA1_DATA6_LSB) -#define SI_RX_DATA1_DATA6_SET(x) (((x) << SI_RX_DATA1_DATA6_LSB) & SI_RX_DATA1_DATA6_MASK) -#define SI_RX_DATA1_DATA5_MSB 15 -#define SI_RX_DATA1_DATA5_LSB 8 -#define SI_RX_DATA1_DATA5_MASK 0x0000ff00 -#define SI_RX_DATA1_DATA5_GET(x) (((x) & SI_RX_DATA1_DATA5_MASK) >> SI_RX_DATA1_DATA5_LSB) -#define SI_RX_DATA1_DATA5_SET(x) (((x) << SI_RX_DATA1_DATA5_LSB) & SI_RX_DATA1_DATA5_MASK) -#define SI_RX_DATA1_DATA4_MSB 7 -#define SI_RX_DATA1_DATA4_LSB 0 -#define SI_RX_DATA1_DATA4_MASK 0x000000ff -#define SI_RX_DATA1_DATA4_GET(x) (((x) & SI_RX_DATA1_DATA4_MASK) >> SI_RX_DATA1_DATA4_LSB) -#define SI_RX_DATA1_DATA4_SET(x) (((x) << SI_RX_DATA1_DATA4_LSB) & SI_RX_DATA1_DATA4_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct si_reg_reg_s { - volatile unsigned int si_config; - volatile unsigned int si_cs; - volatile unsigned int si_tx_data0; - volatile unsigned int si_tx_data1; - volatile unsigned int si_rx_data0; - volatile unsigned int si_rx_data1; -} si_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _SI_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/uart_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/uart_reg.h deleted file mode 100644 index 5aef4bad347b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/uart_reg.h +++ /dev/null @@ -1,260 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _UART_REG_REG_H_ -#define _UART_REG_REG_H_ - -#define UART_DATA_ADDRESS 0x00000000 -#define UART_DATA_OFFSET 0x00000000 -#define UART_DATA_TX_CSR_MSB 9 -#define UART_DATA_TX_CSR_LSB 9 -#define UART_DATA_TX_CSR_MASK 0x00000200 -#define UART_DATA_TX_CSR_GET(x) (((x) & UART_DATA_TX_CSR_MASK) >> UART_DATA_TX_CSR_LSB) -#define UART_DATA_TX_CSR_SET(x) (((x) << UART_DATA_TX_CSR_LSB) & UART_DATA_TX_CSR_MASK) -#define UART_DATA_RX_CSR_MSB 8 -#define UART_DATA_RX_CSR_LSB 8 -#define UART_DATA_RX_CSR_MASK 0x00000100 -#define UART_DATA_RX_CSR_GET(x) (((x) & UART_DATA_RX_CSR_MASK) >> UART_DATA_RX_CSR_LSB) -#define UART_DATA_RX_CSR_SET(x) (((x) << UART_DATA_RX_CSR_LSB) & UART_DATA_RX_CSR_MASK) -#define UART_DATA_TXRX_DATA_MSB 7 -#define UART_DATA_TXRX_DATA_LSB 0 -#define UART_DATA_TXRX_DATA_MASK 0x000000ff -#define UART_DATA_TXRX_DATA_GET(x) (((x) & UART_DATA_TXRX_DATA_MASK) >> UART_DATA_TXRX_DATA_LSB) -#define UART_DATA_TXRX_DATA_SET(x) (((x) << UART_DATA_TXRX_DATA_LSB) & UART_DATA_TXRX_DATA_MASK) - -#define UART_CONTROL_ADDRESS 0x00000004 -#define UART_CONTROL_OFFSET 0x00000004 -#define UART_CONTROL_RX_BUSY_MSB 15 -#define UART_CONTROL_RX_BUSY_LSB 15 -#define UART_CONTROL_RX_BUSY_MASK 0x00008000 -#define UART_CONTROL_RX_BUSY_GET(x) (((x) & UART_CONTROL_RX_BUSY_MASK) >> UART_CONTROL_RX_BUSY_LSB) -#define UART_CONTROL_RX_BUSY_SET(x) (((x) << UART_CONTROL_RX_BUSY_LSB) & UART_CONTROL_RX_BUSY_MASK) -#define UART_CONTROL_TX_BUSY_MSB 14 -#define UART_CONTROL_TX_BUSY_LSB 14 -#define UART_CONTROL_TX_BUSY_MASK 0x00004000 -#define UART_CONTROL_TX_BUSY_GET(x) (((x) & UART_CONTROL_TX_BUSY_MASK) >> UART_CONTROL_TX_BUSY_LSB) -#define UART_CONTROL_TX_BUSY_SET(x) (((x) << UART_CONTROL_TX_BUSY_LSB) & UART_CONTROL_TX_BUSY_MASK) -#define UART_CONTROL_HOST_INT_ENABLE_MSB 13 -#define UART_CONTROL_HOST_INT_ENABLE_LSB 13 -#define UART_CONTROL_HOST_INT_ENABLE_MASK 0x00002000 -#define UART_CONTROL_HOST_INT_ENABLE_GET(x) (((x) & UART_CONTROL_HOST_INT_ENABLE_MASK) >> UART_CONTROL_HOST_INT_ENABLE_LSB) -#define UART_CONTROL_HOST_INT_ENABLE_SET(x) (((x) << UART_CONTROL_HOST_INT_ENABLE_LSB) & UART_CONTROL_HOST_INT_ENABLE_MASK) -#define UART_CONTROL_HOST_INT_MSB 12 -#define UART_CONTROL_HOST_INT_LSB 12 -#define UART_CONTROL_HOST_INT_MASK 0x00001000 -#define UART_CONTROL_HOST_INT_GET(x) (((x) & UART_CONTROL_HOST_INT_MASK) >> UART_CONTROL_HOST_INT_LSB) -#define UART_CONTROL_HOST_INT_SET(x) (((x) << UART_CONTROL_HOST_INT_LSB) & UART_CONTROL_HOST_INT_MASK) -#define UART_CONTROL_TX_BREAK_MSB 11 -#define UART_CONTROL_TX_BREAK_LSB 11 -#define UART_CONTROL_TX_BREAK_MASK 0x00000800 -#define UART_CONTROL_TX_BREAK_GET(x) (((x) & UART_CONTROL_TX_BREAK_MASK) >> UART_CONTROL_TX_BREAK_LSB) -#define UART_CONTROL_TX_BREAK_SET(x) (((x) << UART_CONTROL_TX_BREAK_LSB) & UART_CONTROL_TX_BREAK_MASK) -#define UART_CONTROL_RX_BREAK_MSB 10 -#define UART_CONTROL_RX_BREAK_LSB 10 -#define UART_CONTROL_RX_BREAK_MASK 0x00000400 -#define UART_CONTROL_RX_BREAK_GET(x) (((x) & UART_CONTROL_RX_BREAK_MASK) >> UART_CONTROL_RX_BREAK_LSB) -#define UART_CONTROL_RX_BREAK_SET(x) (((x) << UART_CONTROL_RX_BREAK_LSB) & UART_CONTROL_RX_BREAK_MASK) -#define UART_CONTROL_SERIAL_TX_READY_MSB 9 -#define UART_CONTROL_SERIAL_TX_READY_LSB 9 -#define UART_CONTROL_SERIAL_TX_READY_MASK 0x00000200 -#define UART_CONTROL_SERIAL_TX_READY_GET(x) (((x) & UART_CONTROL_SERIAL_TX_READY_MASK) >> UART_CONTROL_SERIAL_TX_READY_LSB) -#define UART_CONTROL_SERIAL_TX_READY_SET(x) (((x) << UART_CONTROL_SERIAL_TX_READY_LSB) & UART_CONTROL_SERIAL_TX_READY_MASK) -#define UART_CONTROL_TX_READY_ORIDE_MSB 8 -#define UART_CONTROL_TX_READY_ORIDE_LSB 8 -#define UART_CONTROL_TX_READY_ORIDE_MASK 0x00000100 -#define UART_CONTROL_TX_READY_ORIDE_GET(x) (((x) & UART_CONTROL_TX_READY_ORIDE_MASK) >> UART_CONTROL_TX_READY_ORIDE_LSB) -#define UART_CONTROL_TX_READY_ORIDE_SET(x) (((x) << UART_CONTROL_TX_READY_ORIDE_LSB) & UART_CONTROL_TX_READY_ORIDE_MASK) -#define UART_CONTROL_RX_READY_ORIDE_MSB 7 -#define UART_CONTROL_RX_READY_ORIDE_LSB 7 -#define UART_CONTROL_RX_READY_ORIDE_MASK 0x00000080 -#define UART_CONTROL_RX_READY_ORIDE_GET(x) (((x) & UART_CONTROL_RX_READY_ORIDE_MASK) >> UART_CONTROL_RX_READY_ORIDE_LSB) -#define UART_CONTROL_RX_READY_ORIDE_SET(x) (((x) << UART_CONTROL_RX_READY_ORIDE_LSB) & UART_CONTROL_RX_READY_ORIDE_MASK) -#define UART_CONTROL_DMA_ENABLE_MSB 6 -#define UART_CONTROL_DMA_ENABLE_LSB 6 -#define UART_CONTROL_DMA_ENABLE_MASK 0x00000040 -#define UART_CONTROL_DMA_ENABLE_GET(x) (((x) & UART_CONTROL_DMA_ENABLE_MASK) >> UART_CONTROL_DMA_ENABLE_LSB) -#define UART_CONTROL_DMA_ENABLE_SET(x) (((x) << UART_CONTROL_DMA_ENABLE_LSB) & UART_CONTROL_DMA_ENABLE_MASK) -#define UART_CONTROL_FLOW_ENABLE_MSB 5 -#define UART_CONTROL_FLOW_ENABLE_LSB 5 -#define UART_CONTROL_FLOW_ENABLE_MASK 0x00000020 -#define UART_CONTROL_FLOW_ENABLE_GET(x) (((x) & UART_CONTROL_FLOW_ENABLE_MASK) >> UART_CONTROL_FLOW_ENABLE_LSB) -#define UART_CONTROL_FLOW_ENABLE_SET(x) (((x) << UART_CONTROL_FLOW_ENABLE_LSB) & UART_CONTROL_FLOW_ENABLE_MASK) -#define UART_CONTROL_FLOW_INVERT_MSB 4 -#define UART_CONTROL_FLOW_INVERT_LSB 4 -#define UART_CONTROL_FLOW_INVERT_MASK 0x00000010 -#define UART_CONTROL_FLOW_INVERT_GET(x) (((x) & UART_CONTROL_FLOW_INVERT_MASK) >> UART_CONTROL_FLOW_INVERT_LSB) -#define UART_CONTROL_FLOW_INVERT_SET(x) (((x) << UART_CONTROL_FLOW_INVERT_LSB) & UART_CONTROL_FLOW_INVERT_MASK) -#define UART_CONTROL_IFC_ENABLE_MSB 3 -#define UART_CONTROL_IFC_ENABLE_LSB 3 -#define UART_CONTROL_IFC_ENABLE_MASK 0x00000008 -#define UART_CONTROL_IFC_ENABLE_GET(x) (((x) & UART_CONTROL_IFC_ENABLE_MASK) >> UART_CONTROL_IFC_ENABLE_LSB) -#define UART_CONTROL_IFC_ENABLE_SET(x) (((x) << UART_CONTROL_IFC_ENABLE_LSB) & UART_CONTROL_IFC_ENABLE_MASK) -#define UART_CONTROL_IFC_DCE_MSB 2 -#define UART_CONTROL_IFC_DCE_LSB 2 -#define UART_CONTROL_IFC_DCE_MASK 0x00000004 -#define UART_CONTROL_IFC_DCE_GET(x) (((x) & UART_CONTROL_IFC_DCE_MASK) >> UART_CONTROL_IFC_DCE_LSB) -#define UART_CONTROL_IFC_DCE_SET(x) (((x) << UART_CONTROL_IFC_DCE_LSB) & UART_CONTROL_IFC_DCE_MASK) -#define UART_CONTROL_PARITY_ENABLE_MSB 1 -#define UART_CONTROL_PARITY_ENABLE_LSB 1 -#define UART_CONTROL_PARITY_ENABLE_MASK 0x00000002 -#define UART_CONTROL_PARITY_ENABLE_GET(x) (((x) & UART_CONTROL_PARITY_ENABLE_MASK) >> UART_CONTROL_PARITY_ENABLE_LSB) -#define UART_CONTROL_PARITY_ENABLE_SET(x) (((x) << UART_CONTROL_PARITY_ENABLE_LSB) & UART_CONTROL_PARITY_ENABLE_MASK) -#define UART_CONTROL_PARITY_EVEN_MSB 0 -#define UART_CONTROL_PARITY_EVEN_LSB 0 -#define UART_CONTROL_PARITY_EVEN_MASK 0x00000001 -#define UART_CONTROL_PARITY_EVEN_GET(x) (((x) & UART_CONTROL_PARITY_EVEN_MASK) >> UART_CONTROL_PARITY_EVEN_LSB) -#define UART_CONTROL_PARITY_EVEN_SET(x) (((x) << UART_CONTROL_PARITY_EVEN_LSB) & UART_CONTROL_PARITY_EVEN_MASK) - -#define UART_CLKDIV_ADDRESS 0x00000008 -#define UART_CLKDIV_OFFSET 0x00000008 -#define UART_CLKDIV_CLK_SCALE_MSB 23 -#define UART_CLKDIV_CLK_SCALE_LSB 16 -#define UART_CLKDIV_CLK_SCALE_MASK 0x00ff0000 -#define UART_CLKDIV_CLK_SCALE_GET(x) (((x) & UART_CLKDIV_CLK_SCALE_MASK) >> UART_CLKDIV_CLK_SCALE_LSB) -#define UART_CLKDIV_CLK_SCALE_SET(x) (((x) << UART_CLKDIV_CLK_SCALE_LSB) & UART_CLKDIV_CLK_SCALE_MASK) -#define UART_CLKDIV_CLK_STEP_MSB 15 -#define UART_CLKDIV_CLK_STEP_LSB 0 -#define UART_CLKDIV_CLK_STEP_MASK 0x0000ffff -#define UART_CLKDIV_CLK_STEP_GET(x) (((x) & UART_CLKDIV_CLK_STEP_MASK) >> UART_CLKDIV_CLK_STEP_LSB) -#define UART_CLKDIV_CLK_STEP_SET(x) (((x) << UART_CLKDIV_CLK_STEP_LSB) & UART_CLKDIV_CLK_STEP_MASK) - -#define UART_INT_ADDRESS 0x0000000c -#define UART_INT_OFFSET 0x0000000c -#define UART_INT_TX_EMPTY_INT_MSB 9 -#define UART_INT_TX_EMPTY_INT_LSB 9 -#define UART_INT_TX_EMPTY_INT_MASK 0x00000200 -#define UART_INT_TX_EMPTY_INT_GET(x) (((x) & UART_INT_TX_EMPTY_INT_MASK) >> UART_INT_TX_EMPTY_INT_LSB) -#define UART_INT_TX_EMPTY_INT_SET(x) (((x) << UART_INT_TX_EMPTY_INT_LSB) & UART_INT_TX_EMPTY_INT_MASK) -#define UART_INT_RX_FULL_INT_MSB 8 -#define UART_INT_RX_FULL_INT_LSB 8 -#define UART_INT_RX_FULL_INT_MASK 0x00000100 -#define UART_INT_RX_FULL_INT_GET(x) (((x) & UART_INT_RX_FULL_INT_MASK) >> UART_INT_RX_FULL_INT_LSB) -#define UART_INT_RX_FULL_INT_SET(x) (((x) << UART_INT_RX_FULL_INT_LSB) & UART_INT_RX_FULL_INT_MASK) -#define UART_INT_RX_BREAK_OFF_INT_MSB 7 -#define UART_INT_RX_BREAK_OFF_INT_LSB 7 -#define UART_INT_RX_BREAK_OFF_INT_MASK 0x00000080 -#define UART_INT_RX_BREAK_OFF_INT_GET(x) (((x) & UART_INT_RX_BREAK_OFF_INT_MASK) >> UART_INT_RX_BREAK_OFF_INT_LSB) -#define UART_INT_RX_BREAK_OFF_INT_SET(x) (((x) << UART_INT_RX_BREAK_OFF_INT_LSB) & UART_INT_RX_BREAK_OFF_INT_MASK) -#define UART_INT_RX_BREAK_ON_INT_MSB 6 -#define UART_INT_RX_BREAK_ON_INT_LSB 6 -#define UART_INT_RX_BREAK_ON_INT_MASK 0x00000040 -#define UART_INT_RX_BREAK_ON_INT_GET(x) (((x) & UART_INT_RX_BREAK_ON_INT_MASK) >> UART_INT_RX_BREAK_ON_INT_LSB) -#define UART_INT_RX_BREAK_ON_INT_SET(x) (((x) << UART_INT_RX_BREAK_ON_INT_LSB) & UART_INT_RX_BREAK_ON_INT_MASK) -#define UART_INT_RX_PARITY_ERR_INT_MSB 5 -#define UART_INT_RX_PARITY_ERR_INT_LSB 5 -#define UART_INT_RX_PARITY_ERR_INT_MASK 0x00000020 -#define UART_INT_RX_PARITY_ERR_INT_GET(x) (((x) & UART_INT_RX_PARITY_ERR_INT_MASK) >> UART_INT_RX_PARITY_ERR_INT_LSB) -#define UART_INT_RX_PARITY_ERR_INT_SET(x) (((x) << UART_INT_RX_PARITY_ERR_INT_LSB) & UART_INT_RX_PARITY_ERR_INT_MASK) -#define UART_INT_TX_OFLOW_ERR_INT_MSB 4 -#define UART_INT_TX_OFLOW_ERR_INT_LSB 4 -#define UART_INT_TX_OFLOW_ERR_INT_MASK 0x00000010 -#define UART_INT_TX_OFLOW_ERR_INT_GET(x) (((x) & UART_INT_TX_OFLOW_ERR_INT_MASK) >> UART_INT_TX_OFLOW_ERR_INT_LSB) -#define UART_INT_TX_OFLOW_ERR_INT_SET(x) (((x) << UART_INT_TX_OFLOW_ERR_INT_LSB) & UART_INT_TX_OFLOW_ERR_INT_MASK) -#define UART_INT_RX_OFLOW_ERR_INT_MSB 3 -#define UART_INT_RX_OFLOW_ERR_INT_LSB 3 -#define UART_INT_RX_OFLOW_ERR_INT_MASK 0x00000008 -#define UART_INT_RX_OFLOW_ERR_INT_GET(x) (((x) & UART_INT_RX_OFLOW_ERR_INT_MASK) >> UART_INT_RX_OFLOW_ERR_INT_LSB) -#define UART_INT_RX_OFLOW_ERR_INT_SET(x) (((x) << UART_INT_RX_OFLOW_ERR_INT_LSB) & UART_INT_RX_OFLOW_ERR_INT_MASK) -#define UART_INT_RX_FRAMING_ERR_INT_MSB 2 -#define UART_INT_RX_FRAMING_ERR_INT_LSB 2 -#define UART_INT_RX_FRAMING_ERR_INT_MASK 0x00000004 -#define UART_INT_RX_FRAMING_ERR_INT_GET(x) (((x) & UART_INT_RX_FRAMING_ERR_INT_MASK) >> UART_INT_RX_FRAMING_ERR_INT_LSB) -#define UART_INT_RX_FRAMING_ERR_INT_SET(x) (((x) << UART_INT_RX_FRAMING_ERR_INT_LSB) & UART_INT_RX_FRAMING_ERR_INT_MASK) -#define UART_INT_TX_READY_INT_MSB 1 -#define UART_INT_TX_READY_INT_LSB 1 -#define UART_INT_TX_READY_INT_MASK 0x00000002 -#define UART_INT_TX_READY_INT_GET(x) (((x) & UART_INT_TX_READY_INT_MASK) >> UART_INT_TX_READY_INT_LSB) -#define UART_INT_TX_READY_INT_SET(x) (((x) << UART_INT_TX_READY_INT_LSB) & UART_INT_TX_READY_INT_MASK) -#define UART_INT_RX_VALID_INT_MSB 0 -#define UART_INT_RX_VALID_INT_LSB 0 -#define UART_INT_RX_VALID_INT_MASK 0x00000001 -#define UART_INT_RX_VALID_INT_GET(x) (((x) & UART_INT_RX_VALID_INT_MASK) >> UART_INT_RX_VALID_INT_LSB) -#define UART_INT_RX_VALID_INT_SET(x) (((x) << UART_INT_RX_VALID_INT_LSB) & UART_INT_RX_VALID_INT_MASK) - -#define UART_INT_EN_ADDRESS 0x00000010 -#define UART_INT_EN_OFFSET 0x00000010 -#define UART_INT_EN_TX_EMPTY_INT_EN_MSB 9 -#define UART_INT_EN_TX_EMPTY_INT_EN_LSB 9 -#define UART_INT_EN_TX_EMPTY_INT_EN_MASK 0x00000200 -#define UART_INT_EN_TX_EMPTY_INT_EN_GET(x) (((x) & UART_INT_EN_TX_EMPTY_INT_EN_MASK) >> UART_INT_EN_TX_EMPTY_INT_EN_LSB) -#define UART_INT_EN_TX_EMPTY_INT_EN_SET(x) (((x) << UART_INT_EN_TX_EMPTY_INT_EN_LSB) & UART_INT_EN_TX_EMPTY_INT_EN_MASK) -#define UART_INT_EN_RX_FULL_INT_EN_MSB 8 -#define UART_INT_EN_RX_FULL_INT_EN_LSB 8 -#define UART_INT_EN_RX_FULL_INT_EN_MASK 0x00000100 -#define UART_INT_EN_RX_FULL_INT_EN_GET(x) (((x) & UART_INT_EN_RX_FULL_INT_EN_MASK) >> UART_INT_EN_RX_FULL_INT_EN_LSB) -#define UART_INT_EN_RX_FULL_INT_EN_SET(x) (((x) << UART_INT_EN_RX_FULL_INT_EN_LSB) & UART_INT_EN_RX_FULL_INT_EN_MASK) -#define UART_INT_EN_RX_BREAK_OFF_INT_EN_MSB 7 -#define UART_INT_EN_RX_BREAK_OFF_INT_EN_LSB 7 -#define UART_INT_EN_RX_BREAK_OFF_INT_EN_MASK 0x00000080 -#define UART_INT_EN_RX_BREAK_OFF_INT_EN_GET(x) (((x) & UART_INT_EN_RX_BREAK_OFF_INT_EN_MASK) >> UART_INT_EN_RX_BREAK_OFF_INT_EN_LSB) -#define UART_INT_EN_RX_BREAK_OFF_INT_EN_SET(x) (((x) << UART_INT_EN_RX_BREAK_OFF_INT_EN_LSB) & UART_INT_EN_RX_BREAK_OFF_INT_EN_MASK) -#define UART_INT_EN_RX_BREAK_ON_INT_EN_MSB 6 -#define UART_INT_EN_RX_BREAK_ON_INT_EN_LSB 6 -#define UART_INT_EN_RX_BREAK_ON_INT_EN_MASK 0x00000040 -#define UART_INT_EN_RX_BREAK_ON_INT_EN_GET(x) (((x) & UART_INT_EN_RX_BREAK_ON_INT_EN_MASK) >> UART_INT_EN_RX_BREAK_ON_INT_EN_LSB) -#define UART_INT_EN_RX_BREAK_ON_INT_EN_SET(x) (((x) << UART_INT_EN_RX_BREAK_ON_INT_EN_LSB) & UART_INT_EN_RX_BREAK_ON_INT_EN_MASK) -#define UART_INT_EN_RX_PARITY_ERR_INT_EN_MSB 5 -#define UART_INT_EN_RX_PARITY_ERR_INT_EN_LSB 5 -#define UART_INT_EN_RX_PARITY_ERR_INT_EN_MASK 0x00000020 -#define UART_INT_EN_RX_PARITY_ERR_INT_EN_GET(x) (((x) & UART_INT_EN_RX_PARITY_ERR_INT_EN_MASK) >> UART_INT_EN_RX_PARITY_ERR_INT_EN_LSB) -#define UART_INT_EN_RX_PARITY_ERR_INT_EN_SET(x) (((x) << UART_INT_EN_RX_PARITY_ERR_INT_EN_LSB) & UART_INT_EN_RX_PARITY_ERR_INT_EN_MASK) -#define UART_INT_EN_TX_OFLOW_ERR_INT_EN_MSB 4 -#define UART_INT_EN_TX_OFLOW_ERR_INT_EN_LSB 4 -#define UART_INT_EN_TX_OFLOW_ERR_INT_EN_MASK 0x00000010 -#define UART_INT_EN_TX_OFLOW_ERR_INT_EN_GET(x) (((x) & UART_INT_EN_TX_OFLOW_ERR_INT_EN_MASK) >> UART_INT_EN_TX_OFLOW_ERR_INT_EN_LSB) -#define UART_INT_EN_TX_OFLOW_ERR_INT_EN_SET(x) (((x) << UART_INT_EN_TX_OFLOW_ERR_INT_EN_LSB) & UART_INT_EN_TX_OFLOW_ERR_INT_EN_MASK) -#define UART_INT_EN_RX_OFLOW_ERR_INT_EN_MSB 3 -#define UART_INT_EN_RX_OFLOW_ERR_INT_EN_LSB 3 -#define UART_INT_EN_RX_OFLOW_ERR_INT_EN_MASK 0x00000008 -#define UART_INT_EN_RX_OFLOW_ERR_INT_EN_GET(x) (((x) & UART_INT_EN_RX_OFLOW_ERR_INT_EN_MASK) >> UART_INT_EN_RX_OFLOW_ERR_INT_EN_LSB) -#define UART_INT_EN_RX_OFLOW_ERR_INT_EN_SET(x) (((x) << UART_INT_EN_RX_OFLOW_ERR_INT_EN_LSB) & UART_INT_EN_RX_OFLOW_ERR_INT_EN_MASK) -#define UART_INT_EN_RX_FRAMING_ERR_INT_EN_MSB 2 -#define UART_INT_EN_RX_FRAMING_ERR_INT_EN_LSB 2 -#define UART_INT_EN_RX_FRAMING_ERR_INT_EN_MASK 0x00000004 -#define UART_INT_EN_RX_FRAMING_ERR_INT_EN_GET(x) (((x) & UART_INT_EN_RX_FRAMING_ERR_INT_EN_MASK) >> UART_INT_EN_RX_FRAMING_ERR_INT_EN_LSB) -#define UART_INT_EN_RX_FRAMING_ERR_INT_EN_SET(x) (((x) << UART_INT_EN_RX_FRAMING_ERR_INT_EN_LSB) & UART_INT_EN_RX_FRAMING_ERR_INT_EN_MASK) -#define UART_INT_EN_TX_READY_INT_EN_MSB 1 -#define UART_INT_EN_TX_READY_INT_EN_LSB 1 -#define UART_INT_EN_TX_READY_INT_EN_MASK 0x00000002 -#define UART_INT_EN_TX_READY_INT_EN_GET(x) (((x) & UART_INT_EN_TX_READY_INT_EN_MASK) >> UART_INT_EN_TX_READY_INT_EN_LSB) -#define UART_INT_EN_TX_READY_INT_EN_SET(x) (((x) << UART_INT_EN_TX_READY_INT_EN_LSB) & UART_INT_EN_TX_READY_INT_EN_MASK) -#define UART_INT_EN_RX_VALID_INT_EN_MSB 0 -#define UART_INT_EN_RX_VALID_INT_EN_LSB 0 -#define UART_INT_EN_RX_VALID_INT_EN_MASK 0x00000001 -#define UART_INT_EN_RX_VALID_INT_EN_GET(x) (((x) & UART_INT_EN_RX_VALID_INT_EN_MASK) >> UART_INT_EN_RX_VALID_INT_EN_LSB) -#define UART_INT_EN_RX_VALID_INT_EN_SET(x) (((x) << UART_INT_EN_RX_VALID_INT_EN_LSB) & UART_INT_EN_RX_VALID_INT_EN_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct uart_reg_reg_s { - volatile unsigned int uart_data; - volatile unsigned int uart_control; - volatile unsigned int uart_clkdiv; - volatile unsigned int uart_int; - volatile unsigned int uart_int_en; -} uart_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _UART_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/umbox_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/umbox_reg.h deleted file mode 100644 index 66ed47f44d9b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/umbox_reg.h +++ /dev/null @@ -1,37 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "umbox_wlan_reg.h" - - -#ifndef BT_HEADERS - - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/umbox_wlan_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/umbox_wlan_reg.h deleted file mode 100644 index 5c392f894126..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/umbox_wlan_reg.h +++ /dev/null @@ -1,322 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _UMBOX_WLAN_REG_REG_H_ -#define _UMBOX_WLAN_REG_REG_H_ - -#define UMBOX_FIFO_ADDRESS 0x00000000 -#define UMBOX_FIFO_OFFSET 0x00000000 -#define UMBOX_FIFO_DATA_MSB 8 -#define UMBOX_FIFO_DATA_LSB 0 -#define UMBOX_FIFO_DATA_MASK 0x000001ff -#define UMBOX_FIFO_DATA_GET(x) (((x) & UMBOX_FIFO_DATA_MASK) >> UMBOX_FIFO_DATA_LSB) -#define UMBOX_FIFO_DATA_SET(x) (((x) << UMBOX_FIFO_DATA_LSB) & UMBOX_FIFO_DATA_MASK) - -#define UMBOX_FIFO_STATUS_ADDRESS 0x00000008 -#define UMBOX_FIFO_STATUS_OFFSET 0x00000008 -#define UMBOX_FIFO_STATUS_TX_EMPTY_MSB 3 -#define UMBOX_FIFO_STATUS_TX_EMPTY_LSB 3 -#define UMBOX_FIFO_STATUS_TX_EMPTY_MASK 0x00000008 -#define UMBOX_FIFO_STATUS_TX_EMPTY_GET(x) (((x) & UMBOX_FIFO_STATUS_TX_EMPTY_MASK) >> UMBOX_FIFO_STATUS_TX_EMPTY_LSB) -#define UMBOX_FIFO_STATUS_TX_EMPTY_SET(x) (((x) << UMBOX_FIFO_STATUS_TX_EMPTY_LSB) & UMBOX_FIFO_STATUS_TX_EMPTY_MASK) -#define UMBOX_FIFO_STATUS_TX_FULL_MSB 2 -#define UMBOX_FIFO_STATUS_TX_FULL_LSB 2 -#define UMBOX_FIFO_STATUS_TX_FULL_MASK 0x00000004 -#define UMBOX_FIFO_STATUS_TX_FULL_GET(x) (((x) & UMBOX_FIFO_STATUS_TX_FULL_MASK) >> UMBOX_FIFO_STATUS_TX_FULL_LSB) -#define UMBOX_FIFO_STATUS_TX_FULL_SET(x) (((x) << UMBOX_FIFO_STATUS_TX_FULL_LSB) & UMBOX_FIFO_STATUS_TX_FULL_MASK) -#define UMBOX_FIFO_STATUS_RX_EMPTY_MSB 1 -#define UMBOX_FIFO_STATUS_RX_EMPTY_LSB 1 -#define UMBOX_FIFO_STATUS_RX_EMPTY_MASK 0x00000002 -#define UMBOX_FIFO_STATUS_RX_EMPTY_GET(x) (((x) & UMBOX_FIFO_STATUS_RX_EMPTY_MASK) >> UMBOX_FIFO_STATUS_RX_EMPTY_LSB) -#define UMBOX_FIFO_STATUS_RX_EMPTY_SET(x) (((x) << UMBOX_FIFO_STATUS_RX_EMPTY_LSB) & UMBOX_FIFO_STATUS_RX_EMPTY_MASK) -#define UMBOX_FIFO_STATUS_RX_FULL_MSB 0 -#define UMBOX_FIFO_STATUS_RX_FULL_LSB 0 -#define UMBOX_FIFO_STATUS_RX_FULL_MASK 0x00000001 -#define UMBOX_FIFO_STATUS_RX_FULL_GET(x) (((x) & UMBOX_FIFO_STATUS_RX_FULL_MASK) >> UMBOX_FIFO_STATUS_RX_FULL_LSB) -#define UMBOX_FIFO_STATUS_RX_FULL_SET(x) (((x) << UMBOX_FIFO_STATUS_RX_FULL_LSB) & UMBOX_FIFO_STATUS_RX_FULL_MASK) - -#define UMBOX_DMA_POLICY_ADDRESS 0x0000000c -#define UMBOX_DMA_POLICY_OFFSET 0x0000000c -#define UMBOX_DMA_POLICY_TX_QUANTUM_MSB 3 -#define UMBOX_DMA_POLICY_TX_QUANTUM_LSB 3 -#define UMBOX_DMA_POLICY_TX_QUANTUM_MASK 0x00000008 -#define UMBOX_DMA_POLICY_TX_QUANTUM_GET(x) (((x) & UMBOX_DMA_POLICY_TX_QUANTUM_MASK) >> UMBOX_DMA_POLICY_TX_QUANTUM_LSB) -#define UMBOX_DMA_POLICY_TX_QUANTUM_SET(x) (((x) << UMBOX_DMA_POLICY_TX_QUANTUM_LSB) & UMBOX_DMA_POLICY_TX_QUANTUM_MASK) -#define UMBOX_DMA_POLICY_TX_ORDER_MSB 2 -#define UMBOX_DMA_POLICY_TX_ORDER_LSB 2 -#define UMBOX_DMA_POLICY_TX_ORDER_MASK 0x00000004 -#define UMBOX_DMA_POLICY_TX_ORDER_GET(x) (((x) & UMBOX_DMA_POLICY_TX_ORDER_MASK) >> UMBOX_DMA_POLICY_TX_ORDER_LSB) -#define UMBOX_DMA_POLICY_TX_ORDER_SET(x) (((x) << UMBOX_DMA_POLICY_TX_ORDER_LSB) & UMBOX_DMA_POLICY_TX_ORDER_MASK) -#define UMBOX_DMA_POLICY_RX_QUANTUM_MSB 1 -#define UMBOX_DMA_POLICY_RX_QUANTUM_LSB 1 -#define UMBOX_DMA_POLICY_RX_QUANTUM_MASK 0x00000002 -#define UMBOX_DMA_POLICY_RX_QUANTUM_GET(x) (((x) & UMBOX_DMA_POLICY_RX_QUANTUM_MASK) >> UMBOX_DMA_POLICY_RX_QUANTUM_LSB) -#define UMBOX_DMA_POLICY_RX_QUANTUM_SET(x) (((x) << UMBOX_DMA_POLICY_RX_QUANTUM_LSB) & UMBOX_DMA_POLICY_RX_QUANTUM_MASK) -#define UMBOX_DMA_POLICY_RX_ORDER_MSB 0 -#define UMBOX_DMA_POLICY_RX_ORDER_LSB 0 -#define UMBOX_DMA_POLICY_RX_ORDER_MASK 0x00000001 -#define UMBOX_DMA_POLICY_RX_ORDER_GET(x) (((x) & UMBOX_DMA_POLICY_RX_ORDER_MASK) >> UMBOX_DMA_POLICY_RX_ORDER_LSB) -#define UMBOX_DMA_POLICY_RX_ORDER_SET(x) (((x) << UMBOX_DMA_POLICY_RX_ORDER_LSB) & UMBOX_DMA_POLICY_RX_ORDER_MASK) - -#define UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000010 -#define UMBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000010 -#define UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define UMBOX0_DMA_RX_CONTROL_ADDRESS 0x00000014 -#define UMBOX0_DMA_RX_CONTROL_OFFSET 0x00000014 -#define UMBOX0_DMA_RX_CONTROL_RESUME_MSB 2 -#define UMBOX0_DMA_RX_CONTROL_RESUME_LSB 2 -#define UMBOX0_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define UMBOX0_DMA_RX_CONTROL_RESUME_GET(x) (((x) & UMBOX0_DMA_RX_CONTROL_RESUME_MASK) >> UMBOX0_DMA_RX_CONTROL_RESUME_LSB) -#define UMBOX0_DMA_RX_CONTROL_RESUME_SET(x) (((x) << UMBOX0_DMA_RX_CONTROL_RESUME_LSB) & UMBOX0_DMA_RX_CONTROL_RESUME_MASK) -#define UMBOX0_DMA_RX_CONTROL_START_MSB 1 -#define UMBOX0_DMA_RX_CONTROL_START_LSB 1 -#define UMBOX0_DMA_RX_CONTROL_START_MASK 0x00000002 -#define UMBOX0_DMA_RX_CONTROL_START_GET(x) (((x) & UMBOX0_DMA_RX_CONTROL_START_MASK) >> UMBOX0_DMA_RX_CONTROL_START_LSB) -#define UMBOX0_DMA_RX_CONTROL_START_SET(x) (((x) << UMBOX0_DMA_RX_CONTROL_START_LSB) & UMBOX0_DMA_RX_CONTROL_START_MASK) -#define UMBOX0_DMA_RX_CONTROL_STOP_MSB 0 -#define UMBOX0_DMA_RX_CONTROL_STOP_LSB 0 -#define UMBOX0_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define UMBOX0_DMA_RX_CONTROL_STOP_GET(x) (((x) & UMBOX0_DMA_RX_CONTROL_STOP_MASK) >> UMBOX0_DMA_RX_CONTROL_STOP_LSB) -#define UMBOX0_DMA_RX_CONTROL_STOP_SET(x) (((x) << UMBOX0_DMA_RX_CONTROL_STOP_LSB) & UMBOX0_DMA_RX_CONTROL_STOP_MASK) - -#define UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000018 -#define UMBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000018 -#define UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define UMBOX0_DMA_TX_CONTROL_ADDRESS 0x0000001c -#define UMBOX0_DMA_TX_CONTROL_OFFSET 0x0000001c -#define UMBOX0_DMA_TX_CONTROL_RESUME_MSB 2 -#define UMBOX0_DMA_TX_CONTROL_RESUME_LSB 2 -#define UMBOX0_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define UMBOX0_DMA_TX_CONTROL_RESUME_GET(x) (((x) & UMBOX0_DMA_TX_CONTROL_RESUME_MASK) >> UMBOX0_DMA_TX_CONTROL_RESUME_LSB) -#define UMBOX0_DMA_TX_CONTROL_RESUME_SET(x) (((x) << UMBOX0_DMA_TX_CONTROL_RESUME_LSB) & UMBOX0_DMA_TX_CONTROL_RESUME_MASK) -#define UMBOX0_DMA_TX_CONTROL_START_MSB 1 -#define UMBOX0_DMA_TX_CONTROL_START_LSB 1 -#define UMBOX0_DMA_TX_CONTROL_START_MASK 0x00000002 -#define UMBOX0_DMA_TX_CONTROL_START_GET(x) (((x) & UMBOX0_DMA_TX_CONTROL_START_MASK) >> UMBOX0_DMA_TX_CONTROL_START_LSB) -#define UMBOX0_DMA_TX_CONTROL_START_SET(x) (((x) << UMBOX0_DMA_TX_CONTROL_START_LSB) & UMBOX0_DMA_TX_CONTROL_START_MASK) -#define UMBOX0_DMA_TX_CONTROL_STOP_MSB 0 -#define UMBOX0_DMA_TX_CONTROL_STOP_LSB 0 -#define UMBOX0_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define UMBOX0_DMA_TX_CONTROL_STOP_GET(x) (((x) & UMBOX0_DMA_TX_CONTROL_STOP_MASK) >> UMBOX0_DMA_TX_CONTROL_STOP_LSB) -#define UMBOX0_DMA_TX_CONTROL_STOP_SET(x) (((x) << UMBOX0_DMA_TX_CONTROL_STOP_LSB) & UMBOX0_DMA_TX_CONTROL_STOP_MASK) - -#define UMBOX_FIFO_TIMEOUT_ADDRESS 0x00000020 -#define UMBOX_FIFO_TIMEOUT_OFFSET 0x00000020 -#define UMBOX_FIFO_TIMEOUT_ENABLE_SET_MSB 8 -#define UMBOX_FIFO_TIMEOUT_ENABLE_SET_LSB 8 -#define UMBOX_FIFO_TIMEOUT_ENABLE_SET_MASK 0x00000100 -#define UMBOX_FIFO_TIMEOUT_ENABLE_SET_GET(x) (((x) & UMBOX_FIFO_TIMEOUT_ENABLE_SET_MASK) >> UMBOX_FIFO_TIMEOUT_ENABLE_SET_LSB) -#define UMBOX_FIFO_TIMEOUT_ENABLE_SET_SET(x) (((x) << UMBOX_FIFO_TIMEOUT_ENABLE_SET_LSB) & UMBOX_FIFO_TIMEOUT_ENABLE_SET_MASK) -#define UMBOX_FIFO_TIMEOUT_VALUE_MSB 7 -#define UMBOX_FIFO_TIMEOUT_VALUE_LSB 0 -#define UMBOX_FIFO_TIMEOUT_VALUE_MASK 0x000000ff -#define UMBOX_FIFO_TIMEOUT_VALUE_GET(x) (((x) & UMBOX_FIFO_TIMEOUT_VALUE_MASK) >> UMBOX_FIFO_TIMEOUT_VALUE_LSB) -#define UMBOX_FIFO_TIMEOUT_VALUE_SET(x) (((x) << UMBOX_FIFO_TIMEOUT_VALUE_LSB) & UMBOX_FIFO_TIMEOUT_VALUE_MASK) - -#define UMBOX_INT_STATUS_ADDRESS 0x00000024 -#define UMBOX_INT_STATUS_OFFSET 0x00000024 -#define UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_MSB 9 -#define UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_LSB 9 -#define UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_MASK 0x00000200 -#define UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_GET(x) (((x) & UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_MASK) >> UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_LSB) -#define UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_SET(x) (((x) << UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_LSB) & UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_MASK) -#define UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_MSB 8 -#define UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_LSB 8 -#define UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_MASK 0x00000100 -#define UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_GET(x) (((x) & UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_MASK) >> UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_LSB) -#define UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_SET(x) (((x) << UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_LSB) & UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_MASK) -#define UMBOX_INT_STATUS_RX_DMA_COMPLETE_MSB 7 -#define UMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB 7 -#define UMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK 0x00000080 -#define UMBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) (((x) & UMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) >> UMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) -#define UMBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) (((x) << UMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) & UMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) -#define UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB 6 -#define UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB 6 -#define UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK 0x00000040 -#define UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) (((x) & UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) >> UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) -#define UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) (((x) << UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) & UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) -#define UMBOX_INT_STATUS_TX_DMA_COMPLETE_MSB 5 -#define UMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB 5 -#define UMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK 0x00000020 -#define UMBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) (((x) & UMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) >> UMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) -#define UMBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) (((x) << UMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) & UMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) -#define UMBOX_INT_STATUS_HCI_SYNC_ERROR_MSB 4 -#define UMBOX_INT_STATUS_HCI_SYNC_ERROR_LSB 4 -#define UMBOX_INT_STATUS_HCI_SYNC_ERROR_MASK 0x00000010 -#define UMBOX_INT_STATUS_HCI_SYNC_ERROR_GET(x) (((x) & UMBOX_INT_STATUS_HCI_SYNC_ERROR_MASK) >> UMBOX_INT_STATUS_HCI_SYNC_ERROR_LSB) -#define UMBOX_INT_STATUS_HCI_SYNC_ERROR_SET(x) (((x) << UMBOX_INT_STATUS_HCI_SYNC_ERROR_LSB) & UMBOX_INT_STATUS_HCI_SYNC_ERROR_MASK) -#define UMBOX_INT_STATUS_TX_OVERFLOW_MSB 3 -#define UMBOX_INT_STATUS_TX_OVERFLOW_LSB 3 -#define UMBOX_INT_STATUS_TX_OVERFLOW_MASK 0x00000008 -#define UMBOX_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & UMBOX_INT_STATUS_TX_OVERFLOW_MASK) >> UMBOX_INT_STATUS_TX_OVERFLOW_LSB) -#define UMBOX_INT_STATUS_TX_OVERFLOW_SET(x) (((x) << UMBOX_INT_STATUS_TX_OVERFLOW_LSB) & UMBOX_INT_STATUS_TX_OVERFLOW_MASK) -#define UMBOX_INT_STATUS_RX_UNDERFLOW_MSB 2 -#define UMBOX_INT_STATUS_RX_UNDERFLOW_LSB 2 -#define UMBOX_INT_STATUS_RX_UNDERFLOW_MASK 0x00000004 -#define UMBOX_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & UMBOX_INT_STATUS_RX_UNDERFLOW_MASK) >> UMBOX_INT_STATUS_RX_UNDERFLOW_LSB) -#define UMBOX_INT_STATUS_RX_UNDERFLOW_SET(x) (((x) << UMBOX_INT_STATUS_RX_UNDERFLOW_LSB) & UMBOX_INT_STATUS_RX_UNDERFLOW_MASK) -#define UMBOX_INT_STATUS_TX_NOT_EMPTY_MSB 1 -#define UMBOX_INT_STATUS_TX_NOT_EMPTY_LSB 1 -#define UMBOX_INT_STATUS_TX_NOT_EMPTY_MASK 0x00000002 -#define UMBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) (((x) & UMBOX_INT_STATUS_TX_NOT_EMPTY_MASK) >> UMBOX_INT_STATUS_TX_NOT_EMPTY_LSB) -#define UMBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) (((x) << UMBOX_INT_STATUS_TX_NOT_EMPTY_LSB) & UMBOX_INT_STATUS_TX_NOT_EMPTY_MASK) -#define UMBOX_INT_STATUS_RX_NOT_FULL_MSB 0 -#define UMBOX_INT_STATUS_RX_NOT_FULL_LSB 0 -#define UMBOX_INT_STATUS_RX_NOT_FULL_MASK 0x00000001 -#define UMBOX_INT_STATUS_RX_NOT_FULL_GET(x) (((x) & UMBOX_INT_STATUS_RX_NOT_FULL_MASK) >> UMBOX_INT_STATUS_RX_NOT_FULL_LSB) -#define UMBOX_INT_STATUS_RX_NOT_FULL_SET(x) (((x) << UMBOX_INT_STATUS_RX_NOT_FULL_LSB) & UMBOX_INT_STATUS_RX_NOT_FULL_MASK) - -#define UMBOX_INT_ENABLE_ADDRESS 0x00000028 -#define UMBOX_INT_ENABLE_OFFSET 0x00000028 -#define UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_MSB 9 -#define UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_LSB 9 -#define UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_MASK 0x00000200 -#define UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_GET(x) (((x) & UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_MASK) >> UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_LSB) -#define UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_SET(x) (((x) << UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_LSB) & UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_MASK) -#define UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_MSB 8 -#define UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_LSB 8 -#define UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_MASK 0x00000100 -#define UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_GET(x) (((x) & UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_MASK) >> UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_LSB) -#define UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_SET(x) (((x) << UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_LSB) & UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_MASK) -#define UMBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB 7 -#define UMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB 7 -#define UMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK 0x00000080 -#define UMBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) (((x) & UMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) >> UMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) -#define UMBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) (((x) << UMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) & UMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) -#define UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB 6 -#define UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB 6 -#define UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK 0x00000040 -#define UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) (((x) & UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) >> UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) -#define UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) (((x) << UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) & UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) -#define UMBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB 5 -#define UMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB 5 -#define UMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK 0x00000020 -#define UMBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) (((x) & UMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) >> UMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) -#define UMBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) (((x) << UMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) & UMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) -#define UMBOX_INT_ENABLE_HCI_SYNC_ERROR_MSB 4 -#define UMBOX_INT_ENABLE_HCI_SYNC_ERROR_LSB 4 -#define UMBOX_INT_ENABLE_HCI_SYNC_ERROR_MASK 0x00000010 -#define UMBOX_INT_ENABLE_HCI_SYNC_ERROR_GET(x) (((x) & UMBOX_INT_ENABLE_HCI_SYNC_ERROR_MASK) >> UMBOX_INT_ENABLE_HCI_SYNC_ERROR_LSB) -#define UMBOX_INT_ENABLE_HCI_SYNC_ERROR_SET(x) (((x) << UMBOX_INT_ENABLE_HCI_SYNC_ERROR_LSB) & UMBOX_INT_ENABLE_HCI_SYNC_ERROR_MASK) -#define UMBOX_INT_ENABLE_TX_OVERFLOW_MSB 3 -#define UMBOX_INT_ENABLE_TX_OVERFLOW_LSB 3 -#define UMBOX_INT_ENABLE_TX_OVERFLOW_MASK 0x00000008 -#define UMBOX_INT_ENABLE_TX_OVERFLOW_GET(x) (((x) & UMBOX_INT_ENABLE_TX_OVERFLOW_MASK) >> UMBOX_INT_ENABLE_TX_OVERFLOW_LSB) -#define UMBOX_INT_ENABLE_TX_OVERFLOW_SET(x) (((x) << UMBOX_INT_ENABLE_TX_OVERFLOW_LSB) & UMBOX_INT_ENABLE_TX_OVERFLOW_MASK) -#define UMBOX_INT_ENABLE_RX_UNDERFLOW_MSB 2 -#define UMBOX_INT_ENABLE_RX_UNDERFLOW_LSB 2 -#define UMBOX_INT_ENABLE_RX_UNDERFLOW_MASK 0x00000004 -#define UMBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) (((x) & UMBOX_INT_ENABLE_RX_UNDERFLOW_MASK) >> UMBOX_INT_ENABLE_RX_UNDERFLOW_LSB) -#define UMBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) (((x) << UMBOX_INT_ENABLE_RX_UNDERFLOW_LSB) & UMBOX_INT_ENABLE_RX_UNDERFLOW_MASK) -#define UMBOX_INT_ENABLE_TX_NOT_EMPTY_MSB 1 -#define UMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB 1 -#define UMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK 0x00000002 -#define UMBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) (((x) & UMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) >> UMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) -#define UMBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) (((x) << UMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) & UMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) -#define UMBOX_INT_ENABLE_RX_NOT_FULL_MSB 0 -#define UMBOX_INT_ENABLE_RX_NOT_FULL_LSB 0 -#define UMBOX_INT_ENABLE_RX_NOT_FULL_MASK 0x00000001 -#define UMBOX_INT_ENABLE_RX_NOT_FULL_GET(x) (((x) & UMBOX_INT_ENABLE_RX_NOT_FULL_MASK) >> UMBOX_INT_ENABLE_RX_NOT_FULL_LSB) -#define UMBOX_INT_ENABLE_RX_NOT_FULL_SET(x) (((x) << UMBOX_INT_ENABLE_RX_NOT_FULL_LSB) & UMBOX_INT_ENABLE_RX_NOT_FULL_MASK) - -#define UMBOX_DEBUG_ADDRESS 0x0000002c -#define UMBOX_DEBUG_OFFSET 0x0000002c -#define UMBOX_DEBUG_SEL_MSB 2 -#define UMBOX_DEBUG_SEL_LSB 0 -#define UMBOX_DEBUG_SEL_MASK 0x00000007 -#define UMBOX_DEBUG_SEL_GET(x) (((x) & UMBOX_DEBUG_SEL_MASK) >> UMBOX_DEBUG_SEL_LSB) -#define UMBOX_DEBUG_SEL_SET(x) (((x) << UMBOX_DEBUG_SEL_LSB) & UMBOX_DEBUG_SEL_MASK) - -#define UMBOX_FIFO_RESET_ADDRESS 0x00000030 -#define UMBOX_FIFO_RESET_OFFSET 0x00000030 -#define UMBOX_FIFO_RESET_INIT_MSB 0 -#define UMBOX_FIFO_RESET_INIT_LSB 0 -#define UMBOX_FIFO_RESET_INIT_MASK 0x00000001 -#define UMBOX_FIFO_RESET_INIT_GET(x) (((x) & UMBOX_FIFO_RESET_INIT_MASK) >> UMBOX_FIFO_RESET_INIT_LSB) -#define UMBOX_FIFO_RESET_INIT_SET(x) (((x) << UMBOX_FIFO_RESET_INIT_LSB) & UMBOX_FIFO_RESET_INIT_MASK) - -#define UMBOX_HCI_FRAMER_ADDRESS 0x00000034 -#define UMBOX_HCI_FRAMER_OFFSET 0x00000034 -#define UMBOX_HCI_FRAMER_CRC_OVERRIDE_MSB 6 -#define UMBOX_HCI_FRAMER_CRC_OVERRIDE_LSB 6 -#define UMBOX_HCI_FRAMER_CRC_OVERRIDE_MASK 0x00000040 -#define UMBOX_HCI_FRAMER_CRC_OVERRIDE_GET(x) (((x) & UMBOX_HCI_FRAMER_CRC_OVERRIDE_MASK) >> UMBOX_HCI_FRAMER_CRC_OVERRIDE_LSB) -#define UMBOX_HCI_FRAMER_CRC_OVERRIDE_SET(x) (((x) << UMBOX_HCI_FRAMER_CRC_OVERRIDE_LSB) & UMBOX_HCI_FRAMER_CRC_OVERRIDE_MASK) -#define UMBOX_HCI_FRAMER_ENABLE_MSB 5 -#define UMBOX_HCI_FRAMER_ENABLE_LSB 5 -#define UMBOX_HCI_FRAMER_ENABLE_MASK 0x00000020 -#define UMBOX_HCI_FRAMER_ENABLE_GET(x) (((x) & UMBOX_HCI_FRAMER_ENABLE_MASK) >> UMBOX_HCI_FRAMER_ENABLE_LSB) -#define UMBOX_HCI_FRAMER_ENABLE_SET(x) (((x) << UMBOX_HCI_FRAMER_ENABLE_LSB) & UMBOX_HCI_FRAMER_ENABLE_MASK) -#define UMBOX_HCI_FRAMER_SYNC_ERROR_MSB 4 -#define UMBOX_HCI_FRAMER_SYNC_ERROR_LSB 4 -#define UMBOX_HCI_FRAMER_SYNC_ERROR_MASK 0x00000010 -#define UMBOX_HCI_FRAMER_SYNC_ERROR_GET(x) (((x) & UMBOX_HCI_FRAMER_SYNC_ERROR_MASK) >> UMBOX_HCI_FRAMER_SYNC_ERROR_LSB) -#define UMBOX_HCI_FRAMER_SYNC_ERROR_SET(x) (((x) << UMBOX_HCI_FRAMER_SYNC_ERROR_LSB) & UMBOX_HCI_FRAMER_SYNC_ERROR_MASK) -#define UMBOX_HCI_FRAMER_UNDERFLOW_MSB 3 -#define UMBOX_HCI_FRAMER_UNDERFLOW_LSB 3 -#define UMBOX_HCI_FRAMER_UNDERFLOW_MASK 0x00000008 -#define UMBOX_HCI_FRAMER_UNDERFLOW_GET(x) (((x) & UMBOX_HCI_FRAMER_UNDERFLOW_MASK) >> UMBOX_HCI_FRAMER_UNDERFLOW_LSB) -#define UMBOX_HCI_FRAMER_UNDERFLOW_SET(x) (((x) << UMBOX_HCI_FRAMER_UNDERFLOW_LSB) & UMBOX_HCI_FRAMER_UNDERFLOW_MASK) -#define UMBOX_HCI_FRAMER_OVERFLOW_MSB 2 -#define UMBOX_HCI_FRAMER_OVERFLOW_LSB 2 -#define UMBOX_HCI_FRAMER_OVERFLOW_MASK 0x00000004 -#define UMBOX_HCI_FRAMER_OVERFLOW_GET(x) (((x) & UMBOX_HCI_FRAMER_OVERFLOW_MASK) >> UMBOX_HCI_FRAMER_OVERFLOW_LSB) -#define UMBOX_HCI_FRAMER_OVERFLOW_SET(x) (((x) << UMBOX_HCI_FRAMER_OVERFLOW_LSB) & UMBOX_HCI_FRAMER_OVERFLOW_MASK) -#define UMBOX_HCI_FRAMER_CONFIG_MODE_MSB 1 -#define UMBOX_HCI_FRAMER_CONFIG_MODE_LSB 0 -#define UMBOX_HCI_FRAMER_CONFIG_MODE_MASK 0x00000003 -#define UMBOX_HCI_FRAMER_CONFIG_MODE_GET(x) (((x) & UMBOX_HCI_FRAMER_CONFIG_MODE_MASK) >> UMBOX_HCI_FRAMER_CONFIG_MODE_LSB) -#define UMBOX_HCI_FRAMER_CONFIG_MODE_SET(x) (((x) << UMBOX_HCI_FRAMER_CONFIG_MODE_LSB) & UMBOX_HCI_FRAMER_CONFIG_MODE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct umbox_wlan_reg_reg_s { - volatile unsigned int umbox_fifo[2]; - volatile unsigned int umbox_fifo_status; - volatile unsigned int umbox_dma_policy; - volatile unsigned int umbox0_dma_rx_descriptor_base; - volatile unsigned int umbox0_dma_rx_control; - volatile unsigned int umbox0_dma_tx_descriptor_base; - volatile unsigned int umbox0_dma_tx_control; - volatile unsigned int umbox_fifo_timeout; - volatile unsigned int umbox_int_status; - volatile unsigned int umbox_int_enable; - volatile unsigned int umbox_debug; - volatile unsigned int umbox_fifo_reset; - volatile unsigned int umbox_hci_framer; -} umbox_wlan_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _UMBOX_WLAN_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/vmc_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/vmc_reg.h deleted file mode 100644 index aef2977ff72f..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/vmc_reg.h +++ /dev/null @@ -1,167 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "vmc_wlan_reg.h" - - -#ifndef BT_HEADERS - -#define MC_BCAM_VALID_ADDRESS WLAN_MC_BCAM_VALID_ADDRESS -#define MC_BCAM_VALID_OFFSET WLAN_MC_BCAM_VALID_OFFSET -#define MC_BCAM_VALID_BIT_MSB WLAN_MC_BCAM_VALID_BIT_MSB -#define MC_BCAM_VALID_BIT_LSB WLAN_MC_BCAM_VALID_BIT_LSB -#define MC_BCAM_VALID_BIT_MASK WLAN_MC_BCAM_VALID_BIT_MASK -#define MC_BCAM_VALID_BIT_GET(x) WLAN_MC_BCAM_VALID_BIT_GET(x) -#define MC_BCAM_VALID_BIT_SET(x) WLAN_MC_BCAM_VALID_BIT_SET(x) -#define MC_BCAM_COMPARE_ADDRESS WLAN_MC_BCAM_COMPARE_ADDRESS -#define MC_BCAM_COMPARE_OFFSET WLAN_MC_BCAM_COMPARE_OFFSET -#define MC_BCAM_COMPARE_KEY_MSB WLAN_MC_BCAM_COMPARE_KEY_MSB -#define MC_BCAM_COMPARE_KEY_LSB WLAN_MC_BCAM_COMPARE_KEY_LSB -#define MC_BCAM_COMPARE_KEY_MASK WLAN_MC_BCAM_COMPARE_KEY_MASK -#define MC_BCAM_COMPARE_KEY_GET(x) WLAN_MC_BCAM_COMPARE_KEY_GET(x) -#define MC_BCAM_COMPARE_KEY_SET(x) WLAN_MC_BCAM_COMPARE_KEY_SET(x) -#define MC_BCAM_TARGET_ADDRESS WLAN_MC_BCAM_TARGET_ADDRESS -#define MC_BCAM_TARGET_OFFSET WLAN_MC_BCAM_TARGET_OFFSET -#define MC_BCAM_TARGET_INST_MSB WLAN_MC_BCAM_TARGET_INST_MSB -#define MC_BCAM_TARGET_INST_LSB WLAN_MC_BCAM_TARGET_INST_LSB -#define MC_BCAM_TARGET_INST_MASK WLAN_MC_BCAM_TARGET_INST_MASK -#define MC_BCAM_TARGET_INST_GET(x) WLAN_MC_BCAM_TARGET_INST_GET(x) -#define MC_BCAM_TARGET_INST_SET(x) WLAN_MC_BCAM_TARGET_INST_SET(x) -#define APB_ADDR_ERROR_CONTROL_ADDRESS WLAN_APB_ADDR_ERROR_CONTROL_ADDRESS -#define APB_ADDR_ERROR_CONTROL_OFFSET WLAN_APB_ADDR_ERROR_CONTROL_OFFSET -#define APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_MSB WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_MSB -#define APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB -#define APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK -#define APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_GET(x) WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_GET(x) -#define APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_SET(x) WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_SET(x) -#define APB_ADDR_ERROR_CONTROL_ENABLE_MSB WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_MSB -#define APB_ADDR_ERROR_CONTROL_ENABLE_LSB WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_LSB -#define APB_ADDR_ERROR_CONTROL_ENABLE_MASK WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_MASK -#define APB_ADDR_ERROR_CONTROL_ENABLE_GET(x) WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_GET(x) -#define APB_ADDR_ERROR_CONTROL_ENABLE_SET(x) WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_SET(x) -#define APB_ADDR_ERROR_STATUS_ADDRESS WLAN_APB_ADDR_ERROR_STATUS_ADDRESS -#define APB_ADDR_ERROR_STATUS_OFFSET WLAN_APB_ADDR_ERROR_STATUS_OFFSET -#define APB_ADDR_ERROR_STATUS_WRITE_MSB WLAN_APB_ADDR_ERROR_STATUS_WRITE_MSB -#define APB_ADDR_ERROR_STATUS_WRITE_LSB WLAN_APB_ADDR_ERROR_STATUS_WRITE_LSB -#define APB_ADDR_ERROR_STATUS_WRITE_MASK WLAN_APB_ADDR_ERROR_STATUS_WRITE_MASK -#define APB_ADDR_ERROR_STATUS_WRITE_GET(x) WLAN_APB_ADDR_ERROR_STATUS_WRITE_GET(x) -#define APB_ADDR_ERROR_STATUS_WRITE_SET(x) WLAN_APB_ADDR_ERROR_STATUS_WRITE_SET(x) -#define APB_ADDR_ERROR_STATUS_ADDRESS_MSB WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_MSB -#define APB_ADDR_ERROR_STATUS_ADDRESS_LSB WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_LSB -#define APB_ADDR_ERROR_STATUS_ADDRESS_MASK WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_MASK -#define APB_ADDR_ERROR_STATUS_ADDRESS_GET(x) WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_GET(x) -#define APB_ADDR_ERROR_STATUS_ADDRESS_SET(x) WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_SET(x) -#define AHB_ADDR_ERROR_CONTROL_ADDRESS WLAN_AHB_ADDR_ERROR_CONTROL_ADDRESS -#define AHB_ADDR_ERROR_CONTROL_OFFSET WLAN_AHB_ADDR_ERROR_CONTROL_OFFSET -#define AHB_ADDR_ERROR_CONTROL_ENABLE_MSB WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_MSB -#define AHB_ADDR_ERROR_CONTROL_ENABLE_LSB WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_LSB -#define AHB_ADDR_ERROR_CONTROL_ENABLE_MASK WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_MASK -#define AHB_ADDR_ERROR_CONTROL_ENABLE_GET(x) WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_GET(x) -#define AHB_ADDR_ERROR_CONTROL_ENABLE_SET(x) WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_SET(x) -#define AHB_ADDR_ERROR_STATUS_ADDRESS WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS -#define AHB_ADDR_ERROR_STATUS_OFFSET WLAN_AHB_ADDR_ERROR_STATUS_OFFSET -#define AHB_ADDR_ERROR_STATUS_MAC_MSB WLAN_AHB_ADDR_ERROR_STATUS_MAC_MSB -#define AHB_ADDR_ERROR_STATUS_MAC_LSB WLAN_AHB_ADDR_ERROR_STATUS_MAC_LSB -#define AHB_ADDR_ERROR_STATUS_MAC_MASK WLAN_AHB_ADDR_ERROR_STATUS_MAC_MASK -#define AHB_ADDR_ERROR_STATUS_MAC_GET(x) WLAN_AHB_ADDR_ERROR_STATUS_MAC_GET(x) -#define AHB_ADDR_ERROR_STATUS_MAC_SET(x) WLAN_AHB_ADDR_ERROR_STATUS_MAC_SET(x) -#define AHB_ADDR_ERROR_STATUS_MBOX_MSB WLAN_AHB_ADDR_ERROR_STATUS_MBOX_MSB -#define AHB_ADDR_ERROR_STATUS_MBOX_LSB WLAN_AHB_ADDR_ERROR_STATUS_MBOX_LSB -#define AHB_ADDR_ERROR_STATUS_MBOX_MASK WLAN_AHB_ADDR_ERROR_STATUS_MBOX_MASK -#define AHB_ADDR_ERROR_STATUS_MBOX_GET(x) WLAN_AHB_ADDR_ERROR_STATUS_MBOX_GET(x) -#define AHB_ADDR_ERROR_STATUS_MBOX_SET(x) WLAN_AHB_ADDR_ERROR_STATUS_MBOX_SET(x) -#define AHB_ADDR_ERROR_STATUS_ADDRESS_MSB WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_MSB -#define AHB_ADDR_ERROR_STATUS_ADDRESS_LSB WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_LSB -#define AHB_ADDR_ERROR_STATUS_ADDRESS_MASK WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_MASK -#define AHB_ADDR_ERROR_STATUS_ADDRESS_GET(x) WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_GET(x) -#define AHB_ADDR_ERROR_STATUS_ADDRESS_SET(x) WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_SET(x) -#define BCAM_CONFLICT_ERROR_ADDRESS WLAN_BCAM_CONFLICT_ERROR_ADDRESS -#define BCAM_CONFLICT_ERROR_OFFSET WLAN_BCAM_CONFLICT_ERROR_OFFSET -#define BCAM_CONFLICT_ERROR_IPORT_FLAG_MSB WLAN_BCAM_CONFLICT_ERROR_IPORT_FLAG_MSB -#define BCAM_CONFLICT_ERROR_IPORT_FLAG_LSB WLAN_BCAM_CONFLICT_ERROR_IPORT_FLAG_LSB -#define BCAM_CONFLICT_ERROR_IPORT_FLAG_MASK WLAN_BCAM_CONFLICT_ERROR_IPORT_FLAG_MASK -#define BCAM_CONFLICT_ERROR_IPORT_FLAG_GET(x) WLAN_BCAM_CONFLICT_ERROR_IPORT_FLAG_GET(x) -#define BCAM_CONFLICT_ERROR_IPORT_FLAG_SET(x) WLAN_BCAM_CONFLICT_ERROR_IPORT_FLAG_SET(x) -#define BCAM_CONFLICT_ERROR_DPORT_FLAG_MSB WLAN_BCAM_CONFLICT_ERROR_DPORT_FLAG_MSB -#define BCAM_CONFLICT_ERROR_DPORT_FLAG_LSB WLAN_BCAM_CONFLICT_ERROR_DPORT_FLAG_LSB -#define BCAM_CONFLICT_ERROR_DPORT_FLAG_MASK WLAN_BCAM_CONFLICT_ERROR_DPORT_FLAG_MASK -#define BCAM_CONFLICT_ERROR_DPORT_FLAG_GET(x) WLAN_BCAM_CONFLICT_ERROR_DPORT_FLAG_GET(x) -#define BCAM_CONFLICT_ERROR_DPORT_FLAG_SET(x) WLAN_BCAM_CONFLICT_ERROR_DPORT_FLAG_SET(x) -#define CPU_PERF_CNT_ADDRESS WLAN_CPU_PERF_CNT_ADDRESS -#define CPU_PERF_CNT_OFFSET WLAN_CPU_PERF_CNT_OFFSET -#define CPU_PERF_CNT_EN_MSB WLAN_CPU_PERF_CNT_EN_MSB -#define CPU_PERF_CNT_EN_LSB WLAN_CPU_PERF_CNT_EN_LSB -#define CPU_PERF_CNT_EN_MASK WLAN_CPU_PERF_CNT_EN_MASK -#define CPU_PERF_CNT_EN_GET(x) WLAN_CPU_PERF_CNT_EN_GET(x) -#define CPU_PERF_CNT_EN_SET(x) WLAN_CPU_PERF_CNT_EN_SET(x) -#define CPU_INST_FETCH_ADDRESS WLAN_CPU_INST_FETCH_ADDRESS -#define CPU_INST_FETCH_OFFSET WLAN_CPU_INST_FETCH_OFFSET -#define CPU_INST_FETCH_CNT_MSB WLAN_CPU_INST_FETCH_CNT_MSB -#define CPU_INST_FETCH_CNT_LSB WLAN_CPU_INST_FETCH_CNT_LSB -#define CPU_INST_FETCH_CNT_MASK WLAN_CPU_INST_FETCH_CNT_MASK -#define CPU_INST_FETCH_CNT_GET(x) WLAN_CPU_INST_FETCH_CNT_GET(x) -#define CPU_INST_FETCH_CNT_SET(x) WLAN_CPU_INST_FETCH_CNT_SET(x) -#define CPU_DATA_FETCH_ADDRESS WLAN_CPU_DATA_FETCH_ADDRESS -#define CPU_DATA_FETCH_OFFSET WLAN_CPU_DATA_FETCH_OFFSET -#define CPU_DATA_FETCH_CNT_MSB WLAN_CPU_DATA_FETCH_CNT_MSB -#define CPU_DATA_FETCH_CNT_LSB WLAN_CPU_DATA_FETCH_CNT_LSB -#define CPU_DATA_FETCH_CNT_MASK WLAN_CPU_DATA_FETCH_CNT_MASK -#define CPU_DATA_FETCH_CNT_GET(x) WLAN_CPU_DATA_FETCH_CNT_GET(x) -#define CPU_DATA_FETCH_CNT_SET(x) WLAN_CPU_DATA_FETCH_CNT_SET(x) -#define CPU_RAM1_CONFLICT_ADDRESS WLAN_CPU_RAM1_CONFLICT_ADDRESS -#define CPU_RAM1_CONFLICT_OFFSET WLAN_CPU_RAM1_CONFLICT_OFFSET -#define CPU_RAM1_CONFLICT_CNT_MSB WLAN_CPU_RAM1_CONFLICT_CNT_MSB -#define CPU_RAM1_CONFLICT_CNT_LSB WLAN_CPU_RAM1_CONFLICT_CNT_LSB -#define CPU_RAM1_CONFLICT_CNT_MASK WLAN_CPU_RAM1_CONFLICT_CNT_MASK -#define CPU_RAM1_CONFLICT_CNT_GET(x) WLAN_CPU_RAM1_CONFLICT_CNT_GET(x) -#define CPU_RAM1_CONFLICT_CNT_SET(x) WLAN_CPU_RAM1_CONFLICT_CNT_SET(x) -#define CPU_RAM2_CONFLICT_ADDRESS WLAN_CPU_RAM2_CONFLICT_ADDRESS -#define CPU_RAM2_CONFLICT_OFFSET WLAN_CPU_RAM2_CONFLICT_OFFSET -#define CPU_RAM2_CONFLICT_CNT_MSB WLAN_CPU_RAM2_CONFLICT_CNT_MSB -#define CPU_RAM2_CONFLICT_CNT_LSB WLAN_CPU_RAM2_CONFLICT_CNT_LSB -#define CPU_RAM2_CONFLICT_CNT_MASK WLAN_CPU_RAM2_CONFLICT_CNT_MASK -#define CPU_RAM2_CONFLICT_CNT_GET(x) WLAN_CPU_RAM2_CONFLICT_CNT_GET(x) -#define CPU_RAM2_CONFLICT_CNT_SET(x) WLAN_CPU_RAM2_CONFLICT_CNT_SET(x) -#define CPU_RAM3_CONFLICT_ADDRESS WLAN_CPU_RAM3_CONFLICT_ADDRESS -#define CPU_RAM3_CONFLICT_OFFSET WLAN_CPU_RAM3_CONFLICT_OFFSET -#define CPU_RAM3_CONFLICT_CNT_MSB WLAN_CPU_RAM3_CONFLICT_CNT_MSB -#define CPU_RAM3_CONFLICT_CNT_LSB WLAN_CPU_RAM3_CONFLICT_CNT_LSB -#define CPU_RAM3_CONFLICT_CNT_MASK WLAN_CPU_RAM3_CONFLICT_CNT_MASK -#define CPU_RAM3_CONFLICT_CNT_GET(x) WLAN_CPU_RAM3_CONFLICT_CNT_GET(x) -#define CPU_RAM3_CONFLICT_CNT_SET(x) WLAN_CPU_RAM3_CONFLICT_CNT_SET(x) -#define CPU_RAM4_CONFLICT_ADDRESS WLAN_CPU_RAM4_CONFLICT_ADDRESS -#define CPU_RAM4_CONFLICT_OFFSET WLAN_CPU_RAM4_CONFLICT_OFFSET -#define CPU_RAM4_CONFLICT_CNT_MSB WLAN_CPU_RAM4_CONFLICT_CNT_MSB -#define CPU_RAM4_CONFLICT_CNT_LSB WLAN_CPU_RAM4_CONFLICT_CNT_LSB -#define CPU_RAM4_CONFLICT_CNT_MASK WLAN_CPU_RAM4_CONFLICT_CNT_MASK -#define CPU_RAM4_CONFLICT_CNT_GET(x) WLAN_CPU_RAM4_CONFLICT_CNT_GET(x) -#define CPU_RAM4_CONFLICT_CNT_SET(x) WLAN_CPU_RAM4_CONFLICT_CNT_SET(x) - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/vmc_wlan_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/vmc_wlan_reg.h deleted file mode 100644 index 9364ef07f33b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw4.0/hw/vmc_wlan_reg.h +++ /dev/null @@ -1,195 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _VMC_WLAN_REG_REG_H_ -#define _VMC_WLAN_REG_REG_H_ - -#define WLAN_MC_BCAM_VALID_ADDRESS 0x00000000 -#define WLAN_MC_BCAM_VALID_OFFSET 0x00000000 -#define WLAN_MC_BCAM_VALID_BIT_MSB 0 -#define WLAN_MC_BCAM_VALID_BIT_LSB 0 -#define WLAN_MC_BCAM_VALID_BIT_MASK 0x00000001 -#define WLAN_MC_BCAM_VALID_BIT_GET(x) (((x) & WLAN_MC_BCAM_VALID_BIT_MASK) >> WLAN_MC_BCAM_VALID_BIT_LSB) -#define WLAN_MC_BCAM_VALID_BIT_SET(x) (((x) << WLAN_MC_BCAM_VALID_BIT_LSB) & WLAN_MC_BCAM_VALID_BIT_MASK) - -#define WLAN_MC_BCAM_COMPARE_ADDRESS 0x00000200 -#define WLAN_MC_BCAM_COMPARE_OFFSET 0x00000200 -#define WLAN_MC_BCAM_COMPARE_KEY_MSB 19 -#define WLAN_MC_BCAM_COMPARE_KEY_LSB 2 -#define WLAN_MC_BCAM_COMPARE_KEY_MASK 0x000ffffc -#define WLAN_MC_BCAM_COMPARE_KEY_GET(x) (((x) & WLAN_MC_BCAM_COMPARE_KEY_MASK) >> WLAN_MC_BCAM_COMPARE_KEY_LSB) -#define WLAN_MC_BCAM_COMPARE_KEY_SET(x) (((x) << WLAN_MC_BCAM_COMPARE_KEY_LSB) & WLAN_MC_BCAM_COMPARE_KEY_MASK) - -#define WLAN_MC_BCAM_TARGET_ADDRESS 0x00000400 -#define WLAN_MC_BCAM_TARGET_OFFSET 0x00000400 -#define WLAN_MC_BCAM_TARGET_INST_MSB 31 -#define WLAN_MC_BCAM_TARGET_INST_LSB 0 -#define WLAN_MC_BCAM_TARGET_INST_MASK 0xffffffff -#define WLAN_MC_BCAM_TARGET_INST_GET(x) (((x) & WLAN_MC_BCAM_TARGET_INST_MASK) >> WLAN_MC_BCAM_TARGET_INST_LSB) -#define WLAN_MC_BCAM_TARGET_INST_SET(x) (((x) << WLAN_MC_BCAM_TARGET_INST_LSB) & WLAN_MC_BCAM_TARGET_INST_MASK) - -#define WLAN_APB_ADDR_ERROR_CONTROL_ADDRESS 0x00000600 -#define WLAN_APB_ADDR_ERROR_CONTROL_OFFSET 0x00000600 -#define WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_MSB 1 -#define WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB 1 -#define WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK 0x00000002 -#define WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_GET(x) (((x) & WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK) >> WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB) -#define WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_SET(x) (((x) << WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB) & WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK) -#define WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_MSB 0 -#define WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_LSB 0 -#define WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_MASK 0x00000001 -#define WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_GET(x) (((x) & WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_MASK) >> WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_LSB) -#define WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_SET(x) (((x) << WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_LSB) & WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_MASK) - -#define WLAN_APB_ADDR_ERROR_STATUS_ADDRESS 0x00000604 -#define WLAN_APB_ADDR_ERROR_STATUS_OFFSET 0x00000604 -#define WLAN_APB_ADDR_ERROR_STATUS_WRITE_MSB 25 -#define WLAN_APB_ADDR_ERROR_STATUS_WRITE_LSB 25 -#define WLAN_APB_ADDR_ERROR_STATUS_WRITE_MASK 0x02000000 -#define WLAN_APB_ADDR_ERROR_STATUS_WRITE_GET(x) (((x) & WLAN_APB_ADDR_ERROR_STATUS_WRITE_MASK) >> WLAN_APB_ADDR_ERROR_STATUS_WRITE_LSB) -#define WLAN_APB_ADDR_ERROR_STATUS_WRITE_SET(x) (((x) << WLAN_APB_ADDR_ERROR_STATUS_WRITE_LSB) & WLAN_APB_ADDR_ERROR_STATUS_WRITE_MASK) -#define WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_MSB 24 -#define WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_LSB 0 -#define WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_MASK 0x01ffffff -#define WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_GET(x) (((x) & WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_MASK) >> WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_LSB) -#define WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_SET(x) (((x) << WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_LSB) & WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_MASK) - -#define WLAN_AHB_ADDR_ERROR_CONTROL_ADDRESS 0x00000608 -#define WLAN_AHB_ADDR_ERROR_CONTROL_OFFSET 0x00000608 -#define WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_MSB 0 -#define WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_LSB 0 -#define WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_MASK 0x00000001 -#define WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_GET(x) (((x) & WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_MASK) >> WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_LSB) -#define WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_SET(x) (((x) << WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_LSB) & WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_MASK) - -#define WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS 0x0000060c -#define WLAN_AHB_ADDR_ERROR_STATUS_OFFSET 0x0000060c -#define WLAN_AHB_ADDR_ERROR_STATUS_MAC_MSB 31 -#define WLAN_AHB_ADDR_ERROR_STATUS_MAC_LSB 31 -#define WLAN_AHB_ADDR_ERROR_STATUS_MAC_MASK 0x80000000 -#define WLAN_AHB_ADDR_ERROR_STATUS_MAC_GET(x) (((x) & WLAN_AHB_ADDR_ERROR_STATUS_MAC_MASK) >> WLAN_AHB_ADDR_ERROR_STATUS_MAC_LSB) -#define WLAN_AHB_ADDR_ERROR_STATUS_MAC_SET(x) (((x) << WLAN_AHB_ADDR_ERROR_STATUS_MAC_LSB) & WLAN_AHB_ADDR_ERROR_STATUS_MAC_MASK) -#define WLAN_AHB_ADDR_ERROR_STATUS_MBOX_MSB 30 -#define WLAN_AHB_ADDR_ERROR_STATUS_MBOX_LSB 30 -#define WLAN_AHB_ADDR_ERROR_STATUS_MBOX_MASK 0x40000000 -#define WLAN_AHB_ADDR_ERROR_STATUS_MBOX_GET(x) (((x) & WLAN_AHB_ADDR_ERROR_STATUS_MBOX_MASK) >> WLAN_AHB_ADDR_ERROR_STATUS_MBOX_LSB) -#define WLAN_AHB_ADDR_ERROR_STATUS_MBOX_SET(x) (((x) << WLAN_AHB_ADDR_ERROR_STATUS_MBOX_LSB) & WLAN_AHB_ADDR_ERROR_STATUS_MBOX_MASK) -#define WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_MSB 23 -#define WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_LSB 0 -#define WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_MASK 0x00ffffff -#define WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_GET(x) (((x) & WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_MASK) >> WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_LSB) -#define WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_SET(x) (((x) << WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_LSB) & WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_MASK) - -#define WLAN_BCAM_CONFLICT_ERROR_ADDRESS 0x00000610 -#define WLAN_BCAM_CONFLICT_ERROR_OFFSET 0x00000610 -#define WLAN_BCAM_CONFLICT_ERROR_IPORT_FLAG_MSB 1 -#define WLAN_BCAM_CONFLICT_ERROR_IPORT_FLAG_LSB 1 -#define WLAN_BCAM_CONFLICT_ERROR_IPORT_FLAG_MASK 0x00000002 -#define WLAN_BCAM_CONFLICT_ERROR_IPORT_FLAG_GET(x) (((x) & WLAN_BCAM_CONFLICT_ERROR_IPORT_FLAG_MASK) >> WLAN_BCAM_CONFLICT_ERROR_IPORT_FLAG_LSB) -#define WLAN_BCAM_CONFLICT_ERROR_IPORT_FLAG_SET(x) (((x) << WLAN_BCAM_CONFLICT_ERROR_IPORT_FLAG_LSB) & WLAN_BCAM_CONFLICT_ERROR_IPORT_FLAG_MASK) -#define WLAN_BCAM_CONFLICT_ERROR_DPORT_FLAG_MSB 0 -#define WLAN_BCAM_CONFLICT_ERROR_DPORT_FLAG_LSB 0 -#define WLAN_BCAM_CONFLICT_ERROR_DPORT_FLAG_MASK 0x00000001 -#define WLAN_BCAM_CONFLICT_ERROR_DPORT_FLAG_GET(x) (((x) & WLAN_BCAM_CONFLICT_ERROR_DPORT_FLAG_MASK) >> WLAN_BCAM_CONFLICT_ERROR_DPORT_FLAG_LSB) -#define WLAN_BCAM_CONFLICT_ERROR_DPORT_FLAG_SET(x) (((x) << WLAN_BCAM_CONFLICT_ERROR_DPORT_FLAG_LSB) & WLAN_BCAM_CONFLICT_ERROR_DPORT_FLAG_MASK) - -#define WLAN_CPU_PERF_CNT_ADDRESS 0x00000614 -#define WLAN_CPU_PERF_CNT_OFFSET 0x00000614 -#define WLAN_CPU_PERF_CNT_EN_MSB 0 -#define WLAN_CPU_PERF_CNT_EN_LSB 0 -#define WLAN_CPU_PERF_CNT_EN_MASK 0x00000001 -#define WLAN_CPU_PERF_CNT_EN_GET(x) (((x) & WLAN_CPU_PERF_CNT_EN_MASK) >> WLAN_CPU_PERF_CNT_EN_LSB) -#define WLAN_CPU_PERF_CNT_EN_SET(x) (((x) << WLAN_CPU_PERF_CNT_EN_LSB) & WLAN_CPU_PERF_CNT_EN_MASK) - -#define WLAN_CPU_INST_FETCH_ADDRESS 0x00000618 -#define WLAN_CPU_INST_FETCH_OFFSET 0x00000618 -#define WLAN_CPU_INST_FETCH_CNT_MSB 31 -#define WLAN_CPU_INST_FETCH_CNT_LSB 0 -#define WLAN_CPU_INST_FETCH_CNT_MASK 0xffffffff -#define WLAN_CPU_INST_FETCH_CNT_GET(x) (((x) & WLAN_CPU_INST_FETCH_CNT_MASK) >> WLAN_CPU_INST_FETCH_CNT_LSB) -#define WLAN_CPU_INST_FETCH_CNT_SET(x) (((x) << WLAN_CPU_INST_FETCH_CNT_LSB) & WLAN_CPU_INST_FETCH_CNT_MASK) - -#define WLAN_CPU_DATA_FETCH_ADDRESS 0x0000061c -#define WLAN_CPU_DATA_FETCH_OFFSET 0x0000061c -#define WLAN_CPU_DATA_FETCH_CNT_MSB 31 -#define WLAN_CPU_DATA_FETCH_CNT_LSB 0 -#define WLAN_CPU_DATA_FETCH_CNT_MASK 0xffffffff -#define WLAN_CPU_DATA_FETCH_CNT_GET(x) (((x) & WLAN_CPU_DATA_FETCH_CNT_MASK) >> WLAN_CPU_DATA_FETCH_CNT_LSB) -#define WLAN_CPU_DATA_FETCH_CNT_SET(x) (((x) << WLAN_CPU_DATA_FETCH_CNT_LSB) & WLAN_CPU_DATA_FETCH_CNT_MASK) - -#define WLAN_CPU_RAM1_CONFLICT_ADDRESS 0x00000620 -#define WLAN_CPU_RAM1_CONFLICT_OFFSET 0x00000620 -#define WLAN_CPU_RAM1_CONFLICT_CNT_MSB 11 -#define WLAN_CPU_RAM1_CONFLICT_CNT_LSB 0 -#define WLAN_CPU_RAM1_CONFLICT_CNT_MASK 0x00000fff -#define WLAN_CPU_RAM1_CONFLICT_CNT_GET(x) (((x) & WLAN_CPU_RAM1_CONFLICT_CNT_MASK) >> WLAN_CPU_RAM1_CONFLICT_CNT_LSB) -#define WLAN_CPU_RAM1_CONFLICT_CNT_SET(x) (((x) << WLAN_CPU_RAM1_CONFLICT_CNT_LSB) & WLAN_CPU_RAM1_CONFLICT_CNT_MASK) - -#define WLAN_CPU_RAM2_CONFLICT_ADDRESS 0x00000624 -#define WLAN_CPU_RAM2_CONFLICT_OFFSET 0x00000624 -#define WLAN_CPU_RAM2_CONFLICT_CNT_MSB 11 -#define WLAN_CPU_RAM2_CONFLICT_CNT_LSB 0 -#define WLAN_CPU_RAM2_CONFLICT_CNT_MASK 0x00000fff -#define WLAN_CPU_RAM2_CONFLICT_CNT_GET(x) (((x) & WLAN_CPU_RAM2_CONFLICT_CNT_MASK) >> WLAN_CPU_RAM2_CONFLICT_CNT_LSB) -#define WLAN_CPU_RAM2_CONFLICT_CNT_SET(x) (((x) << WLAN_CPU_RAM2_CONFLICT_CNT_LSB) & WLAN_CPU_RAM2_CONFLICT_CNT_MASK) - -#define WLAN_CPU_RAM3_CONFLICT_ADDRESS 0x00000628 -#define WLAN_CPU_RAM3_CONFLICT_OFFSET 0x00000628 -#define WLAN_CPU_RAM3_CONFLICT_CNT_MSB 11 -#define WLAN_CPU_RAM3_CONFLICT_CNT_LSB 0 -#define WLAN_CPU_RAM3_CONFLICT_CNT_MASK 0x00000fff -#define WLAN_CPU_RAM3_CONFLICT_CNT_GET(x) (((x) & WLAN_CPU_RAM3_CONFLICT_CNT_MASK) >> WLAN_CPU_RAM3_CONFLICT_CNT_LSB) -#define WLAN_CPU_RAM3_CONFLICT_CNT_SET(x) (((x) << WLAN_CPU_RAM3_CONFLICT_CNT_LSB) & WLAN_CPU_RAM3_CONFLICT_CNT_MASK) - -#define WLAN_CPU_RAM4_CONFLICT_ADDRESS 0x0000062c -#define WLAN_CPU_RAM4_CONFLICT_OFFSET 0x0000062c -#define WLAN_CPU_RAM4_CONFLICT_CNT_MSB 11 -#define WLAN_CPU_RAM4_CONFLICT_CNT_LSB 0 -#define WLAN_CPU_RAM4_CONFLICT_CNT_MASK 0x00000fff -#define WLAN_CPU_RAM4_CONFLICT_CNT_GET(x) (((x) & WLAN_CPU_RAM4_CONFLICT_CNT_MASK) >> WLAN_CPU_RAM4_CONFLICT_CNT_LSB) -#define WLAN_CPU_RAM4_CONFLICT_CNT_SET(x) (((x) << WLAN_CPU_RAM4_CONFLICT_CNT_LSB) & WLAN_CPU_RAM4_CONFLICT_CNT_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct vmc_wlan_reg_reg_s { - volatile unsigned int wlan_mc_bcam_valid[128]; - volatile unsigned int wlan_mc_bcam_compare[128]; - volatile unsigned int wlan_mc_bcam_target[128]; - volatile unsigned int wlan_apb_addr_error_control; - volatile unsigned int wlan_apb_addr_error_status; - volatile unsigned int wlan_ahb_addr_error_control; - volatile unsigned int wlan_ahb_addr_error_status; - volatile unsigned int wlan_bcam_conflict_error; - volatile unsigned int wlan_cpu_perf_cnt; - volatile unsigned int wlan_cpu_inst_fetch; - volatile unsigned int wlan_cpu_data_fetch; - volatile unsigned int wlan_cpu_ram1_conflict; - volatile unsigned int wlan_cpu_ram2_conflict; - volatile unsigned int wlan_cpu_ram3_conflict; - volatile unsigned int wlan_cpu_ram4_conflict; -} vmc_wlan_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _VMC_WLAN_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/analog_intf_athr_wlan_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/analog_intf_athr_wlan_reg.h deleted file mode 100644 index b75c79f80dd5..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/analog_intf_athr_wlan_reg.h +++ /dev/null @@ -1,3729 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _ANALOG_INTF_ATHR_WLAN_REG_REG_H_ -#define _ANALOG_INTF_ATHR_WLAN_REG_REG_H_ - - -/* macros for RXRF_BIAS1 */ -#define PHY_ANALOG_RXRF_BIAS1_ADDRESS 0x00000000 -#define PHY_ANALOG_RXRF_BIAS1_OFFSET 0x00000000 -#define PHY_ANALOG_RXRF_BIAS1_SPARE_MSB 0 -#define PHY_ANALOG_RXRF_BIAS1_SPARE_LSB 0 -#define PHY_ANALOG_RXRF_BIAS1_SPARE_MASK 0x00000001 -#define PHY_ANALOG_RXRF_BIAS1_SPARE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXRF_BIAS1_SPARE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_MSB 3 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_LSB 1 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_MASK 0x0000000e -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25SPARE_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_MSB 6 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_LSB 4 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_MASK 0x00000070 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_GET(x) (((x) & 0x00000070) >> 4) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO18_SET(x) (((x) << 4) & 0x00000070) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_MSB 9 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_LSB 7 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_MASK 0x00000380 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_GET(x) (((x) & 0x00000380) >> 7) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25LO36_SET(x) (((x) << 7) & 0x00000380) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_MSB 12 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_LSB 10 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_MASK 0x00001c00 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_GET(x) (((x) & 0x00001c00) >> 10) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2_5GH_SET(x) (((x) << 10) & 0x00001c00) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_MSB 15 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_LSB 13 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_MASK 0x0000e000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_GET(x) (((x) & 0x0000e000) >> 13) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR5GH_SET(x) (((x) << 13) & 0x0000e000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_MSB 18 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_LSB 16 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_MASK 0x00070000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_GET(x) (((x) & 0x00070000) >> 16) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25VGA5G_SET(x) (((x) << 16) & 0x00070000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_MSB 21 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_LSB 19 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_MASK 0x00380000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_GET(x) (((x) & 0x00380000) >> 19) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA5G_SET(x) (((x) << 19) & 0x00380000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_MSB 24 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_LSB 22 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_MASK 0x01c00000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_GET(x) (((x) & 0x01c00000) >> 22) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IR25LO24_SET(x) (((x) << 22) & 0x01c00000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_MSB 27 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_LSB 25 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_MASK 0x0e000000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_GET(x) (((x) & 0x0e000000) >> 25) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC25MXR2GH_SET(x) (((x) << 25) & 0x0e000000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_MSB 30 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_LSB 28 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_MASK 0x70000000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_GET(x) (((x) & 0x70000000) >> 28) -#define PHY_ANALOG_RXRF_BIAS1_PWD_IC75LNA2G_SET(x) (((x) << 28) & 0x70000000) -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_MSB 31 -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_LSB 31 -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_MASK 0x80000000 -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXRF_BIAS1_PWD_BIAS_SET(x) (((x) << 31) & 0x80000000) - -/* macros for RXRF_BIAS2 */ -#define PHY_ANALOG_RXRF_BIAS2_ADDRESS 0x00000004 -#define PHY_ANALOG_RXRF_BIAS2_OFFSET 0x00000004 -#define PHY_ANALOG_RXRF_BIAS2_SPARE_MSB 0 -#define PHY_ANALOG_RXRF_BIAS2_SPARE_LSB 0 -#define PHY_ANALOG_RXRF_BIAS2_SPARE_MASK 0x00000001 -#define PHY_ANALOG_RXRF_BIAS2_SPARE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXRF_BIAS2_SPARE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXRF_BIAS2_PKEN_MSB 3 -#define PHY_ANALOG_RXRF_BIAS2_PKEN_LSB 1 -#define PHY_ANALOG_RXRF_BIAS2_PKEN_MASK 0x0000000e -#define PHY_ANALOG_RXRF_BIAS2_PKEN_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_ANALOG_RXRF_BIAS2_PKEN_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_MSB 6 -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_LSB 4 -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_MASK 0x00000070 -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_GET(x) (((x) & 0x00000070) >> 4) -#define PHY_ANALOG_RXRF_BIAS2_VCMVALUE_SET(x) (((x) << 4) & 0x00000070) -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_MSB 7 -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_LSB 7 -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_MASK 0x00000080 -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXRF_BIAS2_PWD_VCMBUF_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPAREH_MSB 10 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPAREH_LSB 8 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPAREH_MASK 0x00000700 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPAREH_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPAREH_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPARE_MSB 13 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPARE_LSB 11 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPARE_MASK 0x00003800 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPARE_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25SPARE_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25LNABUF_MSB 16 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25LNABUF_LSB 14 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25LNABUF_MASK 0x0001c000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25LNABUF_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25LNABUF_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGCH_MSB 19 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGCH_LSB 17 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGCH_MASK 0x000e0000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGCH_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGCH_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC_MSB 22 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC_LSB 20 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC_MASK 0x00700000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25AGC_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC_MSB 25 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC_LSB 23 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC_MASK 0x03800000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25AGC_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_MSB 28 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_LSB 26 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_MASK 0x1c000000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IC25VCMBUF_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_MSB 31 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_LSB 29 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_MASK 0xe0000000 -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_RXRF_BIAS2_PWD_IR25VCM_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for RXRF_GAINSTAGES */ -#define PHY_ANALOG_RXRF_GAINSTAGES_ADDRESS 0x00000008 -#define PHY_ANALOG_RXRF_GAINSTAGES_OFFSET 0x00000008 -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_MSB 0 -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_LSB 0 -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_MASK 0x00000001 -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXRF_GAINSTAGES_SPARE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_MSB 1 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_LSB 1 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_MASK 0x00000002 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNAON_CALDC_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_MSB 3 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_LSB 2 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_MASK 0x0000000c -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_CAP_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_MSB 5 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_LSB 4 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_MASK 0x00000030 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_GET(x) (((x) & 0x00000030) >> 4) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_CAP_SET(x) (((x) << 4) & 0x00000030) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_MSB 6 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_LSB 6 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_MASK 0x00000040 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_SHORTINP_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_MSB 7 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_LSB 7 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_MASK 0x00000080 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO5G_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_MSB 8 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_LSB 8 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_MASK 0x00000100 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_VGA5G_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_MSB 9 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_LSB 9 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_MASK 0x00000200 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR5G_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_MSB 10 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_LSB 10 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_MASK 0x00000400 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA5G_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_MSB 12 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_LSB 11 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_MASK 0x00001800 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_GET(x) (((x) & 0x00001800) >> 11) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_CAP_SET(x) (((x) << 11) & 0x00001800) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_MSB 13 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_LSB 13 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_MASK 0x00002000 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_SHORTINP_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_MSB 14 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_LSB 14 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_MASK 0x00004000 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_LP_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_MSB 15 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_LSB 15 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_MASK 0x00008000 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LO2G_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_MSB 16 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_LSB 16 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_MASK 0x00010000 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_MXR2G_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_MSB 17 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_LSB 17 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_MASK 0x00020000 -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_RXRF_GAINSTAGES_PWD_LNA2G_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_MSB 19 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_LSB 18 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_MASK 0x000c0000 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_GET(x) (((x) & 0x000c0000) >> 18) -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR5G_GAIN_OVR_SET(x) (((x) << 18) & 0x000c0000) -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_MSB 22 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_LSB 20 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_MASK 0x00700000 -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_RXRF_GAINSTAGES_VGA5G_GAIN_OVR_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_MSB 25 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_LSB 23 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_MASK 0x03800000 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_MSB 27 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_LSB 26 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_MASK 0x0c000000 -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_GET(x) (((x) & 0x0c000000) >> 26) -#define PHY_ANALOG_RXRF_GAINSTAGES_MXR2G_GAIN_OVR_SET(x) (((x) << 26) & 0x0c000000) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_MSB 30 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_LSB 28 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_MASK 0x70000000 -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_GET(x) (((x) & 0x70000000) >> 28) -#define PHY_ANALOG_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_SET(x) (((x) << 28) & 0x70000000) -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_MSB 31 -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_LSB 31 -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_MASK 0x80000000 -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXRF_GAINSTAGES_RX_OVERRIDE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for RXRF_AGC */ -#define PHY_ANALOG_RXRF_AGC_ADDRESS 0x0000000c -#define PHY_ANALOG_RXRF_AGC_OFFSET 0x0000000c -#define PHY_ANALOG_RXRF_AGC_RF5G_ON_DURING_CALPA_MSB 0 -#define PHY_ANALOG_RXRF_AGC_RF5G_ON_DURING_CALPA_LSB 0 -#define PHY_ANALOG_RXRF_AGC_RF5G_ON_DURING_CALPA_MASK 0x00000001 -#define PHY_ANALOG_RXRF_AGC_RF5G_ON_DURING_CALPA_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXRF_AGC_RF5G_ON_DURING_CALPA_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXRF_AGC_RF2G_ON_DURING_CALPA_MSB 1 -#define PHY_ANALOG_RXRF_AGC_RF2G_ON_DURING_CALPA_LSB 1 -#define PHY_ANALOG_RXRF_AGC_RF2G_ON_DURING_CALPA_MASK 0x00000002 -#define PHY_ANALOG_RXRF_AGC_RF2G_ON_DURING_CALPA_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_RXRF_AGC_RF2G_ON_DURING_CALPA_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_RXRF_AGC_AGC_OUT_MSB 2 -#define PHY_ANALOG_RXRF_AGC_AGC_OUT_LSB 2 -#define PHY_ANALOG_RXRF_AGC_AGC_OUT_MASK 0x00000004 -#define PHY_ANALOG_RXRF_AGC_AGC_OUT_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_RXRF_AGC_LNABUFGAIN2X_MSB 3 -#define PHY_ANALOG_RXRF_AGC_LNABUFGAIN2X_LSB 3 -#define PHY_ANALOG_RXRF_AGC_LNABUFGAIN2X_MASK 0x00000008 -#define PHY_ANALOG_RXRF_AGC_LNABUFGAIN2X_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_RXRF_AGC_LNABUFGAIN2X_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_RXRF_AGC_LNABUF_PWD_OVR_MSB 4 -#define PHY_ANALOG_RXRF_AGC_LNABUF_PWD_OVR_LSB 4 -#define PHY_ANALOG_RXRF_AGC_LNABUF_PWD_OVR_MASK 0x00000010 -#define PHY_ANALOG_RXRF_AGC_LNABUF_PWD_OVR_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_RXRF_AGC_LNABUF_PWD_OVR_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_RXRF_AGC_PWD_LNABUF_MSB 5 -#define PHY_ANALOG_RXRF_AGC_PWD_LNABUF_LSB 5 -#define PHY_ANALOG_RXRF_AGC_PWD_LNABUF_MASK 0x00000020 -#define PHY_ANALOG_RXRF_AGC_PWD_LNABUF_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_RXRF_AGC_PWD_LNABUF_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_MSB 8 -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_LSB 6 -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_MASK 0x000001c0 -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_GET(x) (((x) & 0x000001c0) >> 6) -#define PHY_ANALOG_RXRF_AGC_AGC_FALL_CTRL_SET(x) (((x) << 6) & 0x000001c0) -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_MSB 14 -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_LSB 9 -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_MASK 0x00007e00 -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_GET(x) (((x) & 0x00007e00) >> 9) -#define PHY_ANALOG_RXRF_AGC_AGC5G_CALDAC_OVR_SET(x) (((x) << 9) & 0x00007e00) -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_MSB 18 -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_LSB 15 -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_MASK 0x00078000 -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_GET(x) (((x) & 0x00078000) >> 15) -#define PHY_ANALOG_RXRF_AGC_AGC5G_DBDAC_OVR_SET(x) (((x) << 15) & 0x00078000) -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_MSB 24 -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_LSB 19 -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_MASK 0x01f80000 -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_GET(x) (((x) & 0x01f80000) >> 19) -#define PHY_ANALOG_RXRF_AGC_AGC2G_CALDAC_OVR_SET(x) (((x) << 19) & 0x01f80000) -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_MSB 28 -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_LSB 25 -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_MASK 0x1e000000 -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_GET(x) (((x) & 0x1e000000) >> 25) -#define PHY_ANALOG_RXRF_AGC_AGC2G_DBDAC_OVR_SET(x) (((x) << 25) & 0x1e000000) -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_MSB 29 -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_LSB 29 -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_MASK 0x20000000 -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_RXRF_AGC_AGC_CAL_OVR_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_MSB 30 -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_LSB 30 -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_MASK 0x40000000 -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_RXRF_AGC_AGC_ON_OVR_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_MSB 31 -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_LSB 31 -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_MASK 0x80000000 -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXRF_AGC_AGC_OVERRIDE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TXRF1 */ -#define PHY_ANALOG_TXRF1_ADDRESS 0x00000040 -#define PHY_ANALOG_TXRF1_OFFSET 0x00000040 -#define PHY_ANALOG_TXRF1_PDLOBUF5G_MSB 0 -#define PHY_ANALOG_TXRF1_PDLOBUF5G_LSB 0 -#define PHY_ANALOG_TXRF1_PDLOBUF5G_MASK 0x00000001 -#define PHY_ANALOG_TXRF1_PDLOBUF5G_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_TXRF1_PDLOBUF5G_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_TXRF1_PDLODIV5G_MSB 1 -#define PHY_ANALOG_TXRF1_PDLODIV5G_LSB 1 -#define PHY_ANALOG_TXRF1_PDLODIV5G_MASK 0x00000002 -#define PHY_ANALOG_TXRF1_PDLODIV5G_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_TXRF1_PDLODIV5G_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_TXRF1_LOBUF5GFORCED_MSB 2 -#define PHY_ANALOG_TXRF1_LOBUF5GFORCED_LSB 2 -#define PHY_ANALOG_TXRF1_LOBUF5GFORCED_MASK 0x00000004 -#define PHY_ANALOG_TXRF1_LOBUF5GFORCED_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_TXRF1_LOBUF5GFORCED_SET(x) (((x) << 2) & 0x00000004) -#define PHY_ANALOG_TXRF1_LODIV5GFORCED_MSB 3 -#define PHY_ANALOG_TXRF1_LODIV5GFORCED_LSB 3 -#define PHY_ANALOG_TXRF1_LODIV5GFORCED_MASK 0x00000008 -#define PHY_ANALOG_TXRF1_LODIV5GFORCED_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_TXRF1_LODIV5GFORCED_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_TXRF1_PADRV2GN5G_MSB 7 -#define PHY_ANALOG_TXRF1_PADRV2GN5G_LSB 4 -#define PHY_ANALOG_TXRF1_PADRV2GN5G_MASK 0x000000f0 -#define PHY_ANALOG_TXRF1_PADRV2GN5G_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_TXRF1_PADRV2GN5G_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_ANALOG_TXRF1_PADRV3GN5G_MSB 11 -#define PHY_ANALOG_TXRF1_PADRV3GN5G_LSB 8 -#define PHY_ANALOG_TXRF1_PADRV3GN5G_MASK 0x00000f00 -#define PHY_ANALOG_TXRF1_PADRV3GN5G_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_TXRF1_PADRV3GN5G_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_TXRF1_PADRV4GN5G_MSB 15 -#define PHY_ANALOG_TXRF1_PADRV4GN5G_LSB 12 -#define PHY_ANALOG_TXRF1_PADRV4GN5G_MASK 0x0000f000 -#define PHY_ANALOG_TXRF1_PADRV4GN5G_GET(x) (((x) & 0x0000f000) >> 12) -#define PHY_ANALOG_TXRF1_PADRV4GN5G_SET(x) (((x) << 12) & 0x0000f000) -#define PHY_ANALOG_TXRF1_LOCALTXGAIN5G_MSB 16 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN5G_LSB 16 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN5G_MASK 0x00010000 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN5G_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_TXRF1_LOCALTXGAIN5G_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_TXRF1_PDOUT2G_MSB 17 -#define PHY_ANALOG_TXRF1_PDOUT2G_LSB 17 -#define PHY_ANALOG_TXRF1_PDOUT2G_MASK 0x00020000 -#define PHY_ANALOG_TXRF1_PDOUT2G_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_TXRF1_PDOUT2G_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_TXRF1_PDDR2G_MSB 18 -#define PHY_ANALOG_TXRF1_PDDR2G_LSB 18 -#define PHY_ANALOG_TXRF1_PDDR2G_MASK 0x00040000 -#define PHY_ANALOG_TXRF1_PDDR2G_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_TXRF1_PDDR2G_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_TXRF1_PDMXR2G_MSB 19 -#define PHY_ANALOG_TXRF1_PDMXR2G_LSB 19 -#define PHY_ANALOG_TXRF1_PDMXR2G_MASK 0x00080000 -#define PHY_ANALOG_TXRF1_PDMXR2G_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_ANALOG_TXRF1_PDMXR2G_SET(x) (((x) << 19) & 0x00080000) -#define PHY_ANALOG_TXRF1_PDLOBUF2G_MSB 20 -#define PHY_ANALOG_TXRF1_PDLOBUF2G_LSB 20 -#define PHY_ANALOG_TXRF1_PDLOBUF2G_MASK 0x00100000 -#define PHY_ANALOG_TXRF1_PDLOBUF2G_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_TXRF1_PDLOBUF2G_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_TXRF1_PDLODIV2G_MSB 21 -#define PHY_ANALOG_TXRF1_PDLODIV2G_LSB 21 -#define PHY_ANALOG_TXRF1_PDLODIV2G_MASK 0x00200000 -#define PHY_ANALOG_TXRF1_PDLODIV2G_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_TXRF1_PDLODIV2G_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_MSB 22 -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_LSB 22 -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_MASK 0x00400000 -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_TXRF1_LOBUF2GFORCED_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_MSB 23 -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_LSB 23 -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_MASK 0x00800000 -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_TXRF1_LODIV2GFORCED_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_TXRF1_PADRVGN2G_MSB 30 -#define PHY_ANALOG_TXRF1_PADRVGN2G_LSB 24 -#define PHY_ANALOG_TXRF1_PADRVGN2G_MASK 0x7f000000 -#define PHY_ANALOG_TXRF1_PADRVGN2G_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_ANALOG_TXRF1_PADRVGN2G_SET(x) (((x) << 24) & 0x7f000000) -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_MSB 31 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_LSB 31 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_MASK 0x80000000 -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_TXRF1_LOCALTXGAIN2G_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TXRF2 */ -#define PHY_ANALOG_TXRF2_ADDRESS 0x00000044 -#define PHY_ANALOG_TXRF2_OFFSET 0x00000044 -#define PHY_ANALOG_TXRF2_D3B5G_MSB 2 -#define PHY_ANALOG_TXRF2_D3B5G_LSB 0 -#define PHY_ANALOG_TXRF2_D3B5G_MASK 0x00000007 -#define PHY_ANALOG_TXRF2_D3B5G_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_TXRF2_D3B5G_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_TXRF2_D4B5G_MSB 5 -#define PHY_ANALOG_TXRF2_D4B5G_LSB 3 -#define PHY_ANALOG_TXRF2_D4B5G_MASK 0x00000038 -#define PHY_ANALOG_TXRF2_D4B5G_GET(x) (((x) & 0x00000038) >> 3) -#define PHY_ANALOG_TXRF2_D4B5G_SET(x) (((x) << 3) & 0x00000038) -#define PHY_ANALOG_TXRF2_OCAS2G_MSB 8 -#define PHY_ANALOG_TXRF2_OCAS2G_LSB 6 -#define PHY_ANALOG_TXRF2_OCAS2G_MASK 0x000001c0 -#define PHY_ANALOG_TXRF2_OCAS2G_GET(x) (((x) & 0x000001c0) >> 6) -#define PHY_ANALOG_TXRF2_OCAS2G_SET(x) (((x) << 6) & 0x000001c0) -#define PHY_ANALOG_TXRF2_DCAS2G_MSB 11 -#define PHY_ANALOG_TXRF2_DCAS2G_LSB 9 -#define PHY_ANALOG_TXRF2_DCAS2G_MASK 0x00000e00 -#define PHY_ANALOG_TXRF2_DCAS2G_GET(x) (((x) & 0x00000e00) >> 9) -#define PHY_ANALOG_TXRF2_DCAS2G_SET(x) (((x) << 9) & 0x00000e00) -#define PHY_ANALOG_TXRF2_OB2G_PALOFF_MSB 14 -#define PHY_ANALOG_TXRF2_OB2G_PALOFF_LSB 12 -#define PHY_ANALOG_TXRF2_OB2G_PALOFF_MASK 0x00007000 -#define PHY_ANALOG_TXRF2_OB2G_PALOFF_GET(x) (((x) & 0x00007000) >> 12) -#define PHY_ANALOG_TXRF2_OB2G_PALOFF_SET(x) (((x) << 12) & 0x00007000) -#define PHY_ANALOG_TXRF2_OB2G_QAM_MSB 17 -#define PHY_ANALOG_TXRF2_OB2G_QAM_LSB 15 -#define PHY_ANALOG_TXRF2_OB2G_QAM_MASK 0x00038000 -#define PHY_ANALOG_TXRF2_OB2G_QAM_GET(x) (((x) & 0x00038000) >> 15) -#define PHY_ANALOG_TXRF2_OB2G_QAM_SET(x) (((x) << 15) & 0x00038000) -#define PHY_ANALOG_TXRF2_OB2G_PSK_MSB 20 -#define PHY_ANALOG_TXRF2_OB2G_PSK_LSB 18 -#define PHY_ANALOG_TXRF2_OB2G_PSK_MASK 0x001c0000 -#define PHY_ANALOG_TXRF2_OB2G_PSK_GET(x) (((x) & 0x001c0000) >> 18) -#define PHY_ANALOG_TXRF2_OB2G_PSK_SET(x) (((x) << 18) & 0x001c0000) -#define PHY_ANALOG_TXRF2_OB2G_CCK_MSB 23 -#define PHY_ANALOG_TXRF2_OB2G_CCK_LSB 21 -#define PHY_ANALOG_TXRF2_OB2G_CCK_MASK 0x00e00000 -#define PHY_ANALOG_TXRF2_OB2G_CCK_GET(x) (((x) & 0x00e00000) >> 21) -#define PHY_ANALOG_TXRF2_OB2G_CCK_SET(x) (((x) << 21) & 0x00e00000) -#define PHY_ANALOG_TXRF2_DB2G_MSB 26 -#define PHY_ANALOG_TXRF2_DB2G_LSB 24 -#define PHY_ANALOG_TXRF2_DB2G_MASK 0x07000000 -#define PHY_ANALOG_TXRF2_DB2G_GET(x) (((x) & 0x07000000) >> 24) -#define PHY_ANALOG_TXRF2_DB2G_SET(x) (((x) << 24) & 0x07000000) -#define PHY_ANALOG_TXRF2_PDOUT5G_MSB 30 -#define PHY_ANALOG_TXRF2_PDOUT5G_LSB 27 -#define PHY_ANALOG_TXRF2_PDOUT5G_MASK 0x78000000 -#define PHY_ANALOG_TXRF2_PDOUT5G_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_ANALOG_TXRF2_PDOUT5G_SET(x) (((x) << 27) & 0x78000000) -#define PHY_ANALOG_TXRF2_PDMXR5G_MSB 31 -#define PHY_ANALOG_TXRF2_PDMXR5G_LSB 31 -#define PHY_ANALOG_TXRF2_PDMXR5G_MASK 0x80000000 -#define PHY_ANALOG_TXRF2_PDMXR5G_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_TXRF2_PDMXR5G_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TXRF3 */ -#define PHY_ANALOG_TXRF3_ADDRESS 0x00000048 -#define PHY_ANALOG_TXRF3_OFFSET 0x00000048 -#define PHY_ANALOG_TXRF3_FILTR2G_MSB 1 -#define PHY_ANALOG_TXRF3_FILTR2G_LSB 0 -#define PHY_ANALOG_TXRF3_FILTR2G_MASK 0x00000003 -#define PHY_ANALOG_TXRF3_FILTR2G_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF3_FILTR2G_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF3_PWDFB2_2G_MSB 2 -#define PHY_ANALOG_TXRF3_PWDFB2_2G_LSB 2 -#define PHY_ANALOG_TXRF3_PWDFB2_2G_MASK 0x00000004 -#define PHY_ANALOG_TXRF3_PWDFB2_2G_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_TXRF3_PWDFB2_2G_SET(x) (((x) << 2) & 0x00000004) -#define PHY_ANALOG_TXRF3_PWDFB1_2G_MSB 3 -#define PHY_ANALOG_TXRF3_PWDFB1_2G_LSB 3 -#define PHY_ANALOG_TXRF3_PWDFB1_2G_MASK 0x00000008 -#define PHY_ANALOG_TXRF3_PWDFB1_2G_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_TXRF3_PWDFB1_2G_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_TXRF3_PDFB2G_MSB 4 -#define PHY_ANALOG_TXRF3_PDFB2G_LSB 4 -#define PHY_ANALOG_TXRF3_PDFB2G_MASK 0x00000010 -#define PHY_ANALOG_TXRF3_PDFB2G_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_TXRF3_PDFB2G_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_TXRF3_RDIV5G_MSB 6 -#define PHY_ANALOG_TXRF3_RDIV5G_LSB 5 -#define PHY_ANALOG_TXRF3_RDIV5G_MASK 0x00000060 -#define PHY_ANALOG_TXRF3_RDIV5G_GET(x) (((x) & 0x00000060) >> 5) -#define PHY_ANALOG_TXRF3_RDIV5G_SET(x) (((x) << 5) & 0x00000060) -#define PHY_ANALOG_TXRF3_CAPDIV5G_MSB 9 -#define PHY_ANALOG_TXRF3_CAPDIV5G_LSB 7 -#define PHY_ANALOG_TXRF3_CAPDIV5G_MASK 0x00000380 -#define PHY_ANALOG_TXRF3_CAPDIV5G_GET(x) (((x) & 0x00000380) >> 7) -#define PHY_ANALOG_TXRF3_CAPDIV5G_SET(x) (((x) << 7) & 0x00000380) -#define PHY_ANALOG_TXRF3_PDPREDIST5G_MSB 10 -#define PHY_ANALOG_TXRF3_PDPREDIST5G_LSB 10 -#define PHY_ANALOG_TXRF3_PDPREDIST5G_MASK 0x00000400 -#define PHY_ANALOG_TXRF3_PDPREDIST5G_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_TXRF3_PDPREDIST5G_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_TXRF3_RDIV2G_MSB 12 -#define PHY_ANALOG_TXRF3_RDIV2G_LSB 11 -#define PHY_ANALOG_TXRF3_RDIV2G_MASK 0x00001800 -#define PHY_ANALOG_TXRF3_RDIV2G_GET(x) (((x) & 0x00001800) >> 11) -#define PHY_ANALOG_TXRF3_RDIV2G_SET(x) (((x) << 11) & 0x00001800) -#define PHY_ANALOG_TXRF3_PDPREDIST2G_MSB 13 -#define PHY_ANALOG_TXRF3_PDPREDIST2G_LSB 13 -#define PHY_ANALOG_TXRF3_PDPREDIST2G_MASK 0x00002000 -#define PHY_ANALOG_TXRF3_PDPREDIST2G_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_TXRF3_PDPREDIST2G_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_TXRF3_OCAS5G_MSB 16 -#define PHY_ANALOG_TXRF3_OCAS5G_LSB 14 -#define PHY_ANALOG_TXRF3_OCAS5G_MASK 0x0001c000 -#define PHY_ANALOG_TXRF3_OCAS5G_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_TXRF3_OCAS5G_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_TXRF3_D2CAS5G_MSB 19 -#define PHY_ANALOG_TXRF3_D2CAS5G_LSB 17 -#define PHY_ANALOG_TXRF3_D2CAS5G_MASK 0x000e0000 -#define PHY_ANALOG_TXRF3_D2CAS5G_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_TXRF3_D2CAS5G_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_TXRF3_D3CAS5G_MSB 22 -#define PHY_ANALOG_TXRF3_D3CAS5G_LSB 20 -#define PHY_ANALOG_TXRF3_D3CAS5G_MASK 0x00700000 -#define PHY_ANALOG_TXRF3_D3CAS5G_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_TXRF3_D3CAS5G_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_TXRF3_D4CAS5G_MSB 25 -#define PHY_ANALOG_TXRF3_D4CAS5G_LSB 23 -#define PHY_ANALOG_TXRF3_D4CAS5G_MASK 0x03800000 -#define PHY_ANALOG_TXRF3_D4CAS5G_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_TXRF3_D4CAS5G_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_TXRF3_OB5G_MSB 28 -#define PHY_ANALOG_TXRF3_OB5G_LSB 26 -#define PHY_ANALOG_TXRF3_OB5G_MASK 0x1c000000 -#define PHY_ANALOG_TXRF3_OB5G_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_TXRF3_OB5G_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_TXRF3_D2B5G_MSB 31 -#define PHY_ANALOG_TXRF3_D2B5G_LSB 29 -#define PHY_ANALOG_TXRF3_D2B5G_MASK 0xe0000000 -#define PHY_ANALOG_TXRF3_D2B5G_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_TXRF3_D2B5G_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for TXRF4 */ -#define PHY_ANALOG_TXRF4_ADDRESS 0x0000004c -#define PHY_ANALOG_TXRF4_OFFSET 0x0000004c -#define PHY_ANALOG_TXRF4_PK1B2G_CCK_MSB 1 -#define PHY_ANALOG_TXRF4_PK1B2G_CCK_LSB 0 -#define PHY_ANALOG_TXRF4_PK1B2G_CCK_MASK 0x00000003 -#define PHY_ANALOG_TXRF4_PK1B2G_CCK_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF4_PK1B2G_CCK_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF4_MIOB2G_QAM_MSB 4 -#define PHY_ANALOG_TXRF4_MIOB2G_QAM_LSB 2 -#define PHY_ANALOG_TXRF4_MIOB2G_QAM_MASK 0x0000001c -#define PHY_ANALOG_TXRF4_MIOB2G_QAM_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_ANALOG_TXRF4_MIOB2G_QAM_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_ANALOG_TXRF4_MIOB2G_PSK_MSB 7 -#define PHY_ANALOG_TXRF4_MIOB2G_PSK_LSB 5 -#define PHY_ANALOG_TXRF4_MIOB2G_PSK_MASK 0x000000e0 -#define PHY_ANALOG_TXRF4_MIOB2G_PSK_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_TXRF4_MIOB2G_PSK_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_TXRF4_MIOB2G_CCK_MSB 10 -#define PHY_ANALOG_TXRF4_MIOB2G_CCK_LSB 8 -#define PHY_ANALOG_TXRF4_MIOB2G_CCK_MASK 0x00000700 -#define PHY_ANALOG_TXRF4_MIOB2G_CCK_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_TXRF4_MIOB2G_CCK_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_TXRF4_COMP2G_QAM_MSB 13 -#define PHY_ANALOG_TXRF4_COMP2G_QAM_LSB 11 -#define PHY_ANALOG_TXRF4_COMP2G_QAM_MASK 0x00003800 -#define PHY_ANALOG_TXRF4_COMP2G_QAM_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_TXRF4_COMP2G_QAM_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_TXRF4_COMP2G_PSK_MSB 16 -#define PHY_ANALOG_TXRF4_COMP2G_PSK_LSB 14 -#define PHY_ANALOG_TXRF4_COMP2G_PSK_MASK 0x0001c000 -#define PHY_ANALOG_TXRF4_COMP2G_PSK_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_TXRF4_COMP2G_PSK_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_TXRF4_COMP2G_CCK_MSB 19 -#define PHY_ANALOG_TXRF4_COMP2G_CCK_LSB 17 -#define PHY_ANALOG_TXRF4_COMP2G_CCK_MASK 0x000e0000 -#define PHY_ANALOG_TXRF4_COMP2G_CCK_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_TXRF4_COMP2G_CCK_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_MSB 22 -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_LSB 20 -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_MASK 0x00700000 -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_TXRF4_AMP2B2G_QAM_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_MSB 25 -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_LSB 23 -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_MASK 0x03800000 -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_TXRF4_AMP2B2G_PSK_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_MSB 28 -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_LSB 26 -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_MASK 0x1c000000 -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_TXRF4_AMP2B2G_CCK_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_TXRF4_AMP2CAS2G_MSB 31 -#define PHY_ANALOG_TXRF4_AMP2CAS2G_LSB 29 -#define PHY_ANALOG_TXRF4_AMP2CAS2G_MASK 0xe0000000 -#define PHY_ANALOG_TXRF4_AMP2CAS2G_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_TXRF4_AMP2CAS2G_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for TXRF5 */ -#define PHY_ANALOG_TXRF5_ADDRESS 0x00000050 -#define PHY_ANALOG_TXRF5_OFFSET 0x00000050 -#define PHY_ANALOG_TXRF5_TXMODPALONLY_MSB 0 -#define PHY_ANALOG_TXRF5_TXMODPALONLY_LSB 0 -#define PHY_ANALOG_TXRF5_TXMODPALONLY_MASK 0x00000001 -#define PHY_ANALOG_TXRF5_TXMODPALONLY_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_TXRF5_TXMODPALONLY_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_TXRF5_PAL_LOCKED_MSB 1 -#define PHY_ANALOG_TXRF5_PAL_LOCKED_LSB 1 -#define PHY_ANALOG_TXRF5_PAL_LOCKED_MASK 0x00000002 -#define PHY_ANALOG_TXRF5_PAL_LOCKED_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_TXRF5_FBHI2G_MSB 2 -#define PHY_ANALOG_TXRF5_FBHI2G_LSB 2 -#define PHY_ANALOG_TXRF5_FBHI2G_MASK 0x00000004 -#define PHY_ANALOG_TXRF5_FBHI2G_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_TXRF5_FBLO2G_MSB 3 -#define PHY_ANALOG_TXRF5_FBLO2G_LSB 3 -#define PHY_ANALOG_TXRF5_FBLO2G_MASK 0x00000008 -#define PHY_ANALOG_TXRF5_FBLO2G_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_TXRF5_NOPALGAIN2G_MSB 4 -#define PHY_ANALOG_TXRF5_NOPALGAIN2G_LSB 4 -#define PHY_ANALOG_TXRF5_NOPALGAIN2G_MASK 0x00000010 -#define PHY_ANALOG_TXRF5_NOPALGAIN2G_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_TXRF5_NOPALGAIN2G_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_TXRF5_ENPACAL2G_MSB 5 -#define PHY_ANALOG_TXRF5_ENPACAL2G_LSB 5 -#define PHY_ANALOG_TXRF5_ENPACAL2G_MASK 0x00000020 -#define PHY_ANALOG_TXRF5_ENPACAL2G_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_TXRF5_ENPACAL2G_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_TXRF5_OFFSET2G_MSB 12 -#define PHY_ANALOG_TXRF5_OFFSET2G_LSB 6 -#define PHY_ANALOG_TXRF5_OFFSET2G_MASK 0x00001fc0 -#define PHY_ANALOG_TXRF5_OFFSET2G_GET(x) (((x) & 0x00001fc0) >> 6) -#define PHY_ANALOG_TXRF5_OFFSET2G_SET(x) (((x) << 6) & 0x00001fc0) -#define PHY_ANALOG_TXRF5_ENOFFSETCAL2G_MSB 13 -#define PHY_ANALOG_TXRF5_ENOFFSETCAL2G_LSB 13 -#define PHY_ANALOG_TXRF5_ENOFFSETCAL2G_MASK 0x00002000 -#define PHY_ANALOG_TXRF5_ENOFFSETCAL2G_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_TXRF5_ENOFFSETCAL2G_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_TXRF5_REFHI2G_MSB 16 -#define PHY_ANALOG_TXRF5_REFHI2G_LSB 14 -#define PHY_ANALOG_TXRF5_REFHI2G_MASK 0x0001c000 -#define PHY_ANALOG_TXRF5_REFHI2G_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_TXRF5_REFHI2G_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_TXRF5_REFLO2G_MSB 19 -#define PHY_ANALOG_TXRF5_REFLO2G_LSB 17 -#define PHY_ANALOG_TXRF5_REFLO2G_MASK 0x000e0000 -#define PHY_ANALOG_TXRF5_REFLO2G_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_TXRF5_REFLO2G_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_TXRF5_PALCLAMP2G_MSB 21 -#define PHY_ANALOG_TXRF5_PALCLAMP2G_LSB 20 -#define PHY_ANALOG_TXRF5_PALCLAMP2G_MASK 0x00300000 -#define PHY_ANALOG_TXRF5_PALCLAMP2G_GET(x) (((x) & 0x00300000) >> 20) -#define PHY_ANALOG_TXRF5_PALCLAMP2G_SET(x) (((x) << 20) & 0x00300000) -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_MSB 23 -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_LSB 22 -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_MASK 0x00c00000 -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_GET(x) (((x) & 0x00c00000) >> 22) -#define PHY_ANALOG_TXRF5_PK2B2G_QAM_SET(x) (((x) << 22) & 0x00c00000) -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_MSB 25 -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_LSB 24 -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_MASK 0x03000000 -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_GET(x) (((x) & 0x03000000) >> 24) -#define PHY_ANALOG_TXRF5_PK2B2G_PSK_SET(x) (((x) << 24) & 0x03000000) -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_MSB 27 -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_LSB 26 -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_MASK 0x0c000000 -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_GET(x) (((x) & 0x0c000000) >> 26) -#define PHY_ANALOG_TXRF5_PK2B2G_CCK_SET(x) (((x) << 26) & 0x0c000000) -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_MSB 29 -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_LSB 28 -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_MASK 0x30000000 -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_GET(x) (((x) & 0x30000000) >> 28) -#define PHY_ANALOG_TXRF5_PK1B2G_QAM_SET(x) (((x) << 28) & 0x30000000) -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_MSB 31 -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_LSB 30 -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_MASK 0xc0000000 -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_GET(x) (((x) & 0xc0000000) >> 30) -#define PHY_ANALOG_TXRF5_PK1B2G_PSK_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for TXRF6 */ -#define PHY_ANALOG_TXRF6_ADDRESS 0x00000054 -#define PHY_ANALOG_TXRF6_OFFSET 0x00000054 -#define PHY_ANALOG_TXRF6_PALCLKGATE2G_MSB 0 -#define PHY_ANALOG_TXRF6_PALCLKGATE2G_LSB 0 -#define PHY_ANALOG_TXRF6_PALCLKGATE2G_MASK 0x00000001 -#define PHY_ANALOG_TXRF6_PALCLKGATE2G_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_TXRF6_PALCLKGATE2G_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_TXRF6_PALFLUCTCOUNT2G_MSB 8 -#define PHY_ANALOG_TXRF6_PALFLUCTCOUNT2G_LSB 1 -#define PHY_ANALOG_TXRF6_PALFLUCTCOUNT2G_MASK 0x000001fe -#define PHY_ANALOG_TXRF6_PALFLUCTCOUNT2G_GET(x) (((x) & 0x000001fe) >> 1) -#define PHY_ANALOG_TXRF6_PALFLUCTCOUNT2G_SET(x) (((x) << 1) & 0x000001fe) -#define PHY_ANALOG_TXRF6_PALFLUCTGAIN2G_MSB 10 -#define PHY_ANALOG_TXRF6_PALFLUCTGAIN2G_LSB 9 -#define PHY_ANALOG_TXRF6_PALFLUCTGAIN2G_MASK 0x00000600 -#define PHY_ANALOG_TXRF6_PALFLUCTGAIN2G_GET(x) (((x) & 0x00000600) >> 9) -#define PHY_ANALOG_TXRF6_PALFLUCTGAIN2G_SET(x) (((x) << 9) & 0x00000600) -#define PHY_ANALOG_TXRF6_PALNOFLUCT2G_MSB 11 -#define PHY_ANALOG_TXRF6_PALNOFLUCT2G_LSB 11 -#define PHY_ANALOG_TXRF6_PALNOFLUCT2G_MASK 0x00000800 -#define PHY_ANALOG_TXRF6_PALNOFLUCT2G_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_TXRF6_PALNOFLUCT2G_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_TXRF6_GAINSTEP2G_MSB 14 -#define PHY_ANALOG_TXRF6_GAINSTEP2G_LSB 12 -#define PHY_ANALOG_TXRF6_GAINSTEP2G_MASK 0x00007000 -#define PHY_ANALOG_TXRF6_GAINSTEP2G_GET(x) (((x) & 0x00007000) >> 12) -#define PHY_ANALOG_TXRF6_GAINSTEP2G_SET(x) (((x) << 12) & 0x00007000) -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_MSB 15 -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_LSB 15 -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_MASK 0x00008000 -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_TXRF6_USE_GAIN_DELTA2G_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_TXRF6_CAPDIV_I2G_MSB 19 -#define PHY_ANALOG_TXRF6_CAPDIV_I2G_LSB 16 -#define PHY_ANALOG_TXRF6_CAPDIV_I2G_MASK 0x000f0000 -#define PHY_ANALOG_TXRF6_CAPDIV_I2G_GET(x) (((x) & 0x000f0000) >> 16) -#define PHY_ANALOG_TXRF6_CAPDIV_I2G_SET(x) (((x) << 16) & 0x000f0000) -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_MSB 23 -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_LSB 20 -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_MASK 0x00f00000 -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_GET(x) (((x) & 0x00f00000) >> 20) -#define PHY_ANALOG_TXRF6_PADRVGN_INDEX_I2G_SET(x) (((x) << 20) & 0x00f00000) -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_MSB 26 -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_LSB 24 -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_MASK 0x07000000 -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_GET(x) (((x) & 0x07000000) >> 24) -#define PHY_ANALOG_TXRF6_VCMONDELAY2G_SET(x) (((x) << 24) & 0x07000000) -#define PHY_ANALOG_TXRF6_CAPDIV2G_MSB 30 -#define PHY_ANALOG_TXRF6_CAPDIV2G_LSB 27 -#define PHY_ANALOG_TXRF6_CAPDIV2G_MASK 0x78000000 -#define PHY_ANALOG_TXRF6_CAPDIV2G_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_ANALOG_TXRF6_CAPDIV2G_SET(x) (((x) << 27) & 0x78000000) -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_MSB 31 -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_LSB 31 -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_MASK 0x80000000 -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_TXRF6_CAPDIV2GOVR_SET(x) (((x) << 31) & 0x80000000) - -/* macros for TXRF7 */ -#define PHY_ANALOG_TXRF7_ADDRESS 0x00000058 -#define PHY_ANALOG_TXRF7_OFFSET 0x00000058 -#define PHY_ANALOG_TXRF7_SPARE7_MSB 1 -#define PHY_ANALOG_TXRF7_SPARE7_LSB 0 -#define PHY_ANALOG_TXRF7_SPARE7_MASK 0x00000003 -#define PHY_ANALOG_TXRF7_SPARE7_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF7_SPARE7_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_MSB 7 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_LSB 2 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_MASK 0x000000fc -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_GET(x) (((x) & 0x000000fc) >> 2) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_4_SET(x) (((x) << 2) & 0x000000fc) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_MSB 13 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_LSB 8 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_MASK 0x00003f00 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_3_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_MSB 19 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_LSB 14 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_MASK 0x000fc000 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_GET(x) (((x) & 0x000fc000) >> 14) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_2_SET(x) (((x) << 14) & 0x000fc000) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_MSB 25 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_LSB 20 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_MASK 0x03f00000 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_GET(x) (((x) & 0x03f00000) >> 20) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_1_SET(x) (((x) << 20) & 0x03f00000) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_MSB 31 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_LSB 26 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_MASK 0xfc000000 -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_GET(x) (((x) & 0xfc000000) >> 26) -#define PHY_ANALOG_TXRF7_PADRVGNTAB_0_SET(x) (((x) << 26) & 0xfc000000) - -/* macros for TXRF8 */ -#define PHY_ANALOG_TXRF8_ADDRESS 0x0000005c -#define PHY_ANALOG_TXRF8_OFFSET 0x0000005c -#define PHY_ANALOG_TXRF8_SPARE8_MSB 1 -#define PHY_ANALOG_TXRF8_SPARE8_LSB 0 -#define PHY_ANALOG_TXRF8_SPARE8_MASK 0x00000003 -#define PHY_ANALOG_TXRF8_SPARE8_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF8_SPARE8_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_MSB 7 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_LSB 2 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_MASK 0x000000fc -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_GET(x) (((x) & 0x000000fc) >> 2) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_9_SET(x) (((x) << 2) & 0x000000fc) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_MSB 13 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_LSB 8 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_MASK 0x00003f00 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_8_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_MSB 19 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_LSB 14 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_MASK 0x000fc000 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_GET(x) (((x) & 0x000fc000) >> 14) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_7_SET(x) (((x) << 14) & 0x000fc000) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_MSB 25 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_LSB 20 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_MASK 0x03f00000 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_GET(x) (((x) & 0x03f00000) >> 20) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_6_SET(x) (((x) << 20) & 0x03f00000) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_MSB 31 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_LSB 26 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_MASK 0xfc000000 -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_GET(x) (((x) & 0xfc000000) >> 26) -#define PHY_ANALOG_TXRF8_PADRVGNTAB_5_SET(x) (((x) << 26) & 0xfc000000) - -/* macros for TXRF9 */ -#define PHY_ANALOG_TXRF9_ADDRESS 0x00000060 -#define PHY_ANALOG_TXRF9_OFFSET 0x00000060 -#define PHY_ANALOG_TXRF9_SPARE9_MSB 1 -#define PHY_ANALOG_TXRF9_SPARE9_LSB 0 -#define PHY_ANALOG_TXRF9_SPARE9_MASK 0x00000003 -#define PHY_ANALOG_TXRF9_SPARE9_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF9_SPARE9_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_MSB 7 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_LSB 2 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_MASK 0x000000fc -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_GET(x) (((x) & 0x000000fc) >> 2) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_14_SET(x) (((x) << 2) & 0x000000fc) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_MSB 13 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_LSB 8 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_MASK 0x00003f00 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_13_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_MSB 19 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_LSB 14 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_MASK 0x000fc000 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_GET(x) (((x) & 0x000fc000) >> 14) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_12_SET(x) (((x) << 14) & 0x000fc000) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_MSB 25 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_LSB 20 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_MASK 0x03f00000 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_GET(x) (((x) & 0x03f00000) >> 20) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_11_SET(x) (((x) << 20) & 0x03f00000) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_MSB 31 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_LSB 26 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_MASK 0xfc000000 -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_GET(x) (((x) & 0xfc000000) >> 26) -#define PHY_ANALOG_TXRF9_PADRVGNTAB_10_SET(x) (((x) << 26) & 0xfc000000) - -/* macros for TXRF10 */ -#define PHY_ANALOG_TXRF10_ADDRESS 0x00000064 -#define PHY_ANALOG_TXRF10_OFFSET 0x00000064 -#define PHY_ANALOG_TXRF10_SPARE10_MSB 2 -#define PHY_ANALOG_TXRF10_SPARE10_LSB 0 -#define PHY_ANALOG_TXRF10_SPARE10_MASK 0x00000007 -#define PHY_ANALOG_TXRF10_SPARE10_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_TXRF10_SPARE10_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_MSB 3 -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_LSB 3 -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_MASK 0x00000008 -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_TXRF10_PDOUT5G_3CALTX_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_TXRF10_D3B5GCALTX_MSB 6 -#define PHY_ANALOG_TXRF10_D3B5GCALTX_LSB 4 -#define PHY_ANALOG_TXRF10_D3B5GCALTX_MASK 0x00000070 -#define PHY_ANALOG_TXRF10_D3B5GCALTX_GET(x) (((x) & 0x00000070) >> 4) -#define PHY_ANALOG_TXRF10_D3B5GCALTX_SET(x) (((x) << 4) & 0x00000070) -#define PHY_ANALOG_TXRF10_D4B5GCALTX_MSB 9 -#define PHY_ANALOG_TXRF10_D4B5GCALTX_LSB 7 -#define PHY_ANALOG_TXRF10_D4B5GCALTX_MASK 0x00000380 -#define PHY_ANALOG_TXRF10_D4B5GCALTX_GET(x) (((x) & 0x00000380) >> 7) -#define PHY_ANALOG_TXRF10_D4B5GCALTX_SET(x) (((x) << 7) & 0x00000380) -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_MSB 16 -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_LSB 10 -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_MASK 0x0001fc00 -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_GET(x) (((x) & 0x0001fc00) >> 10) -#define PHY_ANALOG_TXRF10_PADRVGN2GCALTX_SET(x) (((x) << 10) & 0x0001fc00) -#define PHY_ANALOG_TXRF10_DB2GCALTX_MSB 19 -#define PHY_ANALOG_TXRF10_DB2GCALTX_LSB 17 -#define PHY_ANALOG_TXRF10_DB2GCALTX_MASK 0x000e0000 -#define PHY_ANALOG_TXRF10_DB2GCALTX_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_TXRF10_DB2GCALTX_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_TXRF10_CALTXSHIFT_MSB 20 -#define PHY_ANALOG_TXRF10_CALTXSHIFT_LSB 20 -#define PHY_ANALOG_TXRF10_CALTXSHIFT_MASK 0x00100000 -#define PHY_ANALOG_TXRF10_CALTXSHIFT_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_TXRF10_CALTXSHIFT_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_MSB 21 -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_LSB 21 -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_MASK 0x00200000 -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_TXRF10_CALTXSHIFTOVR_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_TXRF10_PADRVGN2G_SMOUT_MSB 27 -#define PHY_ANALOG_TXRF10_PADRVGN2G_SMOUT_LSB 22 -#define PHY_ANALOG_TXRF10_PADRVGN2G_SMOUT_MASK 0x0fc00000 -#define PHY_ANALOG_TXRF10_PADRVGN2G_SMOUT_GET(x) (((x) & 0x0fc00000) >> 22) -#define PHY_ANALOG_TXRF10_PADRVGN_INDEX2G_SMOUT_MSB 31 -#define PHY_ANALOG_TXRF10_PADRVGN_INDEX2G_SMOUT_LSB 28 -#define PHY_ANALOG_TXRF10_PADRVGN_INDEX2G_SMOUT_MASK 0xf0000000 -#define PHY_ANALOG_TXRF10_PADRVGN_INDEX2G_SMOUT_GET(x) (((x) & 0xf0000000) >> 28) - -/* macros for TXRF11 */ -#define PHY_ANALOG_TXRF11_ADDRESS 0x00000068 -#define PHY_ANALOG_TXRF11_OFFSET 0x00000068 -#define PHY_ANALOG_TXRF11_SPARE11_MSB 1 -#define PHY_ANALOG_TXRF11_SPARE11_LSB 0 -#define PHY_ANALOG_TXRF11_SPARE11_MASK 0x00000003 -#define PHY_ANALOG_TXRF11_SPARE11_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_TXRF11_SPARE11_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_MSB 4 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_LSB 2 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_MASK 0x0000001c -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV5G_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_MSB 7 -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_LSB 5 -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_MASK 0x000000e0 -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_TXRF11_PWD_IR25PA2G_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_MSB 10 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_LSB 8 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_MASK 0x00000700 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXBIAS2G_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_MSB 13 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_LSB 11 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_MASK 0x00003800 -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_TXRF11_PWD_IR25MIXDIV2G_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_MSB 16 -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_LSB 14 -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_MASK 0x0001c000 -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_TXRF11_PWD_ICSPARE_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_TXRF11_PWD_IC25TEMPSEN_MSB 19 -#define PHY_ANALOG_TXRF11_PWD_IC25TEMPSEN_LSB 17 -#define PHY_ANALOG_TXRF11_PWD_IC25TEMPSEN_MASK 0x000e0000 -#define PHY_ANALOG_TXRF11_PWD_IC25TEMPSEN_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_TXRF11_PWD_IC25TEMPSEN_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_MSB 22 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_LSB 20 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_MASK 0x00700000 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G2_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_MSB 25 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_LSB 23 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_MASK 0x03800000 -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_TXRF11_PWD_IC25PA5G1_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_MSB 28 -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_LSB 26 -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_MASK 0x1c000000 -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_TXRF11_PWD_IC25MIXBUF5G_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_MSB 31 -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_LSB 29 -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_MASK 0xe0000000 -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_TXRF11_PWD_IC25PA2G_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for TXRF12 */ -#define PHY_ANALOG_TXRF12_ADDRESS 0x0000006c -#define PHY_ANALOG_TXRF12_OFFSET 0x0000006c -#define PHY_ANALOG_TXRF12_SPARE12_2_MSB 7 -#define PHY_ANALOG_TXRF12_SPARE12_2_LSB 0 -#define PHY_ANALOG_TXRF12_SPARE12_2_MASK 0x000000ff -#define PHY_ANALOG_TXRF12_SPARE12_2_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_ANALOG_TXRF12_SPARE12_1_MSB 9 -#define PHY_ANALOG_TXRF12_SPARE12_1_LSB 8 -#define PHY_ANALOG_TXRF12_SPARE12_1_MASK 0x00000300 -#define PHY_ANALOG_TXRF12_SPARE12_1_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_ANALOG_TXRF12_SPARE12_1_SET(x) (((x) << 8) & 0x00000300) -#define PHY_ANALOG_TXRF12_ATBSEL5G_MSB 13 -#define PHY_ANALOG_TXRF12_ATBSEL5G_LSB 10 -#define PHY_ANALOG_TXRF12_ATBSEL5G_MASK 0x00003c00 -#define PHY_ANALOG_TXRF12_ATBSEL5G_GET(x) (((x) & 0x00003c00) >> 10) -#define PHY_ANALOG_TXRF12_ATBSEL5G_SET(x) (((x) << 10) & 0x00003c00) -#define PHY_ANALOG_TXRF12_ATBSEL2G_MSB 16 -#define PHY_ANALOG_TXRF12_ATBSEL2G_LSB 14 -#define PHY_ANALOG_TXRF12_ATBSEL2G_MASK 0x0001c000 -#define PHY_ANALOG_TXRF12_ATBSEL2G_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_TXRF12_ATBSEL2G_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_MSB 19 -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_LSB 17 -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_MASK 0x000e0000 -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_TXRF12_PWD_IRSPARE_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_TXRF12_PWD_IR25TEMPSEN_MSB 22 -#define PHY_ANALOG_TXRF12_PWD_IR25TEMPSEN_LSB 20 -#define PHY_ANALOG_TXRF12_PWD_IR25TEMPSEN_MASK 0x00700000 -#define PHY_ANALOG_TXRF12_PWD_IR25TEMPSEN_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_TXRF12_PWD_IR25TEMPSEN_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_MSB 25 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_LSB 23 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_MASK 0x03800000 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G2_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_MSB 28 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_LSB 26 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_MASK 0x1c000000 -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_TXRF12_PWD_IR25PA5G1_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_TXRF12_PWD_IR25MIXBIAS5G_MSB 31 -#define PHY_ANALOG_TXRF12_PWD_IR25MIXBIAS5G_LSB 29 -#define PHY_ANALOG_TXRF12_PWD_IR25MIXBIAS5G_MASK 0xe0000000 -#define PHY_ANALOG_TXRF12_PWD_IR25MIXBIAS5G_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_TXRF12_PWD_IR25MIXBIAS5G_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for SYNTH1 */ -#define PHY_ANALOG_SYNTH1_ADDRESS 0x00000080 -#define PHY_ANALOG_SYNTH1_OFFSET 0x00000080 -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_MSB 2 -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_LSB 0 -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_MASK 0x00000007 -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_SYNTH1_SEL_VCMONABUS_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_MSB 5 -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_LSB 3 -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_MASK 0x00000038 -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_GET(x) (((x) & 0x00000038) >> 3) -#define PHY_ANALOG_SYNTH1_SEL_VCOABUS_SET(x) (((x) << 3) & 0x00000038) -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_MSB 6 -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_LSB 6 -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_MASK 0x00000040 -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_SYNTH1_MONITOR_SYNTHLOCKVCOK_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_MSB 7 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_LSB 7 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_MASK 0x00000080 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_SYNTH1_MONITOR_VC2LOW_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_MSB 8 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_LSB 8 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_MASK 0x00000100 -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_SYNTH1_MONITOR_VC2HIGH_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_MSB 9 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_LSB 9 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_MASK 0x00000200 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_SYNTH1_MONITOR_FB_DIV2_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_SYNTH1_MONITOR_REF_MSB 10 -#define PHY_ANALOG_SYNTH1_MONITOR_REF_LSB 10 -#define PHY_ANALOG_SYNTH1_MONITOR_REF_MASK 0x00000400 -#define PHY_ANALOG_SYNTH1_MONITOR_REF_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_SYNTH1_MONITOR_REF_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_SYNTH1_MONITOR_FB_MSB 11 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_LSB 11 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_MASK 0x00000800 -#define PHY_ANALOG_SYNTH1_MONITOR_FB_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_SYNTH1_MONITOR_FB_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_MSB 12 -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_LSB 12 -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_MASK 0x00001000 -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_SYNTH1_SEVENBITVCOCAP_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_SYNTH1_PWUP_PD_MSB 15 -#define PHY_ANALOG_SYNTH1_PWUP_PD_LSB 13 -#define PHY_ANALOG_SYNTH1_PWUP_PD_MASK 0x0000e000 -#define PHY_ANALOG_SYNTH1_PWUP_PD_GET(x) (((x) & 0x0000e000) >> 13) -#define PHY_ANALOG_SYNTH1_PWUP_PD_SET(x) (((x) << 13) & 0x0000e000) -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_MSB 16 -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_LSB 16 -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_MASK 0x00010000 -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_SYNTH1_PWD_VCOBUF_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_MSB 18 -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_LSB 17 -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_MASK 0x00060000 -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_GET(x) (((x) & 0x00060000) >> 17) -#define PHY_ANALOG_SYNTH1_VCOBUFGAIN_SET(x) (((x) << 17) & 0x00060000) -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_MSB 20 -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_LSB 19 -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_MASK 0x00180000 -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_GET(x) (((x) & 0x00180000) >> 19) -#define PHY_ANALOG_SYNTH1_VCOREGLEVEL_SET(x) (((x) << 19) & 0x00180000) -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_MSB 21 -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_LSB 21 -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_MASK 0x00200000 -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_SYNTH1_VCOREGBYPASS_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_MSB 22 -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_LSB 22 -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_MASK 0x00400000 -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_SYNTH1_PWUP_LOREF_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_MSB 23 -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_LSB 23 -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_MASK 0x00800000 -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_SYNTH1_PWD_LOMIX_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_SYNTH1_PWD_LODIV_MSB 24 -#define PHY_ANALOG_SYNTH1_PWD_LODIV_LSB 24 -#define PHY_ANALOG_SYNTH1_PWD_LODIV_MASK 0x01000000 -#define PHY_ANALOG_SYNTH1_PWD_LODIV_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_ANALOG_SYNTH1_PWD_LODIV_SET(x) (((x) << 24) & 0x01000000) -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_MSB 25 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_LSB 25 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_MASK 0x02000000 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_ANALOG_SYNTH1_PWD_LOBUF5G_SET(x) (((x) << 25) & 0x02000000) -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_MSB 26 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_LSB 26 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_MASK 0x04000000 -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_SYNTH1_PWD_LOBUF2G_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_SYNTH1_PWD_PRESC_MSB 27 -#define PHY_ANALOG_SYNTH1_PWD_PRESC_LSB 27 -#define PHY_ANALOG_SYNTH1_PWD_PRESC_MASK 0x08000000 -#define PHY_ANALOG_SYNTH1_PWD_PRESC_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_SYNTH1_PWD_PRESC_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_SYNTH1_PWD_VCO_MSB 28 -#define PHY_ANALOG_SYNTH1_PWD_VCO_LSB 28 -#define PHY_ANALOG_SYNTH1_PWD_VCO_MASK 0x10000000 -#define PHY_ANALOG_SYNTH1_PWD_VCO_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_SYNTH1_PWD_VCO_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_SYNTH1_PWD_VCMON_MSB 29 -#define PHY_ANALOG_SYNTH1_PWD_VCMON_LSB 29 -#define PHY_ANALOG_SYNTH1_PWD_VCMON_MASK 0x20000000 -#define PHY_ANALOG_SYNTH1_PWD_VCMON_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_SYNTH1_PWD_VCMON_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_SYNTH1_PWD_CP_MSB 30 -#define PHY_ANALOG_SYNTH1_PWD_CP_LSB 30 -#define PHY_ANALOG_SYNTH1_PWD_CP_MASK 0x40000000 -#define PHY_ANALOG_SYNTH1_PWD_CP_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_SYNTH1_PWD_CP_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_SYNTH1_PWD_BIAS_MSB 31 -#define PHY_ANALOG_SYNTH1_PWD_BIAS_LSB 31 -#define PHY_ANALOG_SYNTH1_PWD_BIAS_MASK 0x80000000 -#define PHY_ANALOG_SYNTH1_PWD_BIAS_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH1_PWD_BIAS_SET(x) (((x) << 31) & 0x80000000) - -/* macros for SYNTH2 */ -#define PHY_ANALOG_SYNTH2_ADDRESS 0x00000084 -#define PHY_ANALOG_SYNTH2_OFFSET 0x00000084 -#define PHY_ANALOG_SYNTH2_CAPRANGE3_MSB 3 -#define PHY_ANALOG_SYNTH2_CAPRANGE3_LSB 0 -#define PHY_ANALOG_SYNTH2_CAPRANGE3_MASK 0x0000000f -#define PHY_ANALOG_SYNTH2_CAPRANGE3_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_SYNTH2_CAPRANGE3_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_ANALOG_SYNTH2_CAPRANGE2_MSB 7 -#define PHY_ANALOG_SYNTH2_CAPRANGE2_LSB 4 -#define PHY_ANALOG_SYNTH2_CAPRANGE2_MASK 0x000000f0 -#define PHY_ANALOG_SYNTH2_CAPRANGE2_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_SYNTH2_CAPRANGE2_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_ANALOG_SYNTH2_CAPRANGE1_MSB 11 -#define PHY_ANALOG_SYNTH2_CAPRANGE1_LSB 8 -#define PHY_ANALOG_SYNTH2_CAPRANGE1_MASK 0x00000f00 -#define PHY_ANALOG_SYNTH2_CAPRANGE1_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_SYNTH2_CAPRANGE1_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_INTN_MSB 15 -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_INTN_LSB 12 -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_INTN_MASK 0x0000f000 -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_INTN_GET(x) (((x) & 0x0000f000) >> 12) -#define PHY_ANALOG_SYNTH2_LOOPLEAKCUR_INTN_SET(x) (((x) << 12) & 0x0000f000) -#define PHY_ANALOG_SYNTH2_CPLOWLK_INTN_MSB 16 -#define PHY_ANALOG_SYNTH2_CPLOWLK_INTN_LSB 16 -#define PHY_ANALOG_SYNTH2_CPLOWLK_INTN_MASK 0x00010000 -#define PHY_ANALOG_SYNTH2_CPLOWLK_INTN_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_SYNTH2_CPLOWLK_INTN_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_MSB 17 -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_LSB 17 -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_MASK 0x00020000 -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_SYNTH2_CPSTEERING_EN_INTN_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_SYNTH2_CPBIAS_INTN_MSB 19 -#define PHY_ANALOG_SYNTH2_CPBIAS_INTN_LSB 18 -#define PHY_ANALOG_SYNTH2_CPBIAS_INTN_MASK 0x000c0000 -#define PHY_ANALOG_SYNTH2_CPBIAS_INTN_GET(x) (((x) & 0x000c0000) >> 18) -#define PHY_ANALOG_SYNTH2_CPBIAS_INTN_SET(x) (((x) << 18) & 0x000c0000) -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_MSB 22 -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_LSB 20 -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_MASK 0x00700000 -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_SYNTH2_VC_LOW_REF_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_SYNTH2_VC_MID_REF_MSB 25 -#define PHY_ANALOG_SYNTH2_VC_MID_REF_LSB 23 -#define PHY_ANALOG_SYNTH2_VC_MID_REF_MASK 0x03800000 -#define PHY_ANALOG_SYNTH2_VC_MID_REF_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_SYNTH2_VC_MID_REF_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_SYNTH2_VC_HI_REF_MSB 28 -#define PHY_ANALOG_SYNTH2_VC_HI_REF_LSB 26 -#define PHY_ANALOG_SYNTH2_VC_HI_REF_MASK 0x1c000000 -#define PHY_ANALOG_SYNTH2_VC_HI_REF_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_SYNTH2_VC_HI_REF_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_MSB 31 -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_LSB 29 -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_MASK 0xe0000000 -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_SYNTH2_VC_CAL_REF_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for SYNTH3 */ -#define PHY_ANALOG_SYNTH3_ADDRESS 0x00000088 -#define PHY_ANALOG_SYNTH3_OFFSET 0x00000088 -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_MSB 5 -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_LSB 0 -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_MASK 0x0000003f -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_ANALOG_SYNTH3_WAIT_VC_CHECK_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_MSB 11 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_LSB 6 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_MASK 0x00000fc0 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_GET(x) (((x) & 0x00000fc0) >> 6) -#define PHY_ANALOG_SYNTH3_WAIT_CAL_LIN_SET(x) (((x) << 6) & 0x00000fc0) -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_MSB 17 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_LSB 12 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_MASK 0x0003f000 -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_GET(x) (((x) & 0x0003f000) >> 12) -#define PHY_ANALOG_SYNTH3_WAIT_CAL_BIN_SET(x) (((x) << 12) & 0x0003f000) -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_MSB 23 -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_LSB 18 -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_MASK 0x00fc0000 -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_GET(x) (((x) & 0x00fc0000) >> 18) -#define PHY_ANALOG_SYNTH3_WAIT_PWRUP_SET(x) (((x) << 18) & 0x00fc0000) -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_MSB 29 -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_LSB 24 -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_MASK 0x3f000000 -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_ANALOG_SYNTH3_WAIT_SHORTR_PWRUP_SET(x) (((x) << 24) & 0x3f000000) -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_MSB 30 -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_LSB 30 -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_MASK 0x40000000 -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_SYNTH3_SEL_CLK_DIV2_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_MSB 31 -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_LSB 31 -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_MASK 0x80000000 -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH3_DIS_CLK_XTAL_SET(x) (((x) << 31) & 0x80000000) - -/* macros for SYNTH4 */ -#define PHY_ANALOG_SYNTH4_ADDRESS 0x0000008c -#define PHY_ANALOG_SYNTH4_OFFSET 0x0000008c -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_MSB 0 -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_LSB 0 -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_MASK 0x00000001 -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH4_PS_SINGLE_PULSE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_MSB 1 -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_LSB 1 -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_MASK 0x00000002 -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_SYNTH4_LONGSHIFTSEL_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_MSB 3 -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_LSB 2 -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_MASK 0x0000000c -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_ANALOG_SYNTH4_LOBUF5GTUNE_OVR_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_MSB 4 -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_LSB 4 -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_MASK 0x00000010 -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_SYNTH4_FORCE_LOBUF5GTUNE_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_MSB 5 -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_LSB 5 -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_MASK 0x00000020 -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_SYNTH4_PSCOUNT_FBSEL_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_SYNTH4_SDM_DITHER1_MSB 7 -#define PHY_ANALOG_SYNTH4_SDM_DITHER1_LSB 6 -#define PHY_ANALOG_SYNTH4_SDM_DITHER1_MASK 0x000000c0 -#define PHY_ANALOG_SYNTH4_SDM_DITHER1_GET(x) (((x) & 0x000000c0) >> 6) -#define PHY_ANALOG_SYNTH4_SDM_DITHER1_SET(x) (((x) << 6) & 0x000000c0) -#define PHY_ANALOG_SYNTH4_SDM_MODE_MSB 8 -#define PHY_ANALOG_SYNTH4_SDM_MODE_LSB 8 -#define PHY_ANALOG_SYNTH4_SDM_MODE_MASK 0x00000100 -#define PHY_ANALOG_SYNTH4_SDM_MODE_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_SYNTH4_SDM_MODE_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_MSB 9 -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_LSB 9 -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_MASK 0x00000200 -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_SYNTH4_SDM_DISABLE_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_SYNTH4_RESET_PRESC_MSB 10 -#define PHY_ANALOG_SYNTH4_RESET_PRESC_LSB 10 -#define PHY_ANALOG_SYNTH4_RESET_PRESC_MASK 0x00000400 -#define PHY_ANALOG_SYNTH4_RESET_PRESC_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_SYNTH4_RESET_PRESC_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_SYNTH4_PRESCSEL_MSB 12 -#define PHY_ANALOG_SYNTH4_PRESCSEL_LSB 11 -#define PHY_ANALOG_SYNTH4_PRESCSEL_MASK 0x00001800 -#define PHY_ANALOG_SYNTH4_PRESCSEL_GET(x) (((x) & 0x00001800) >> 11) -#define PHY_ANALOG_SYNTH4_PRESCSEL_SET(x) (((x) << 11) & 0x00001800) -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_MSB 13 -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_LSB 13 -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_MASK 0x00002000 -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_SYNTH4_PFD_DISABLE_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_MSB 14 -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_LSB 14 -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_MASK 0x00004000 -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_SYNTH4_PFDDELAY_FRACN_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_MSB 15 -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_LSB 15 -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_MASK 0x00008000 -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_SYNTH4_FORCE_LO_ON_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_MSB 16 -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_LSB 16 -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_MASK 0x00010000 -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_SYNTH4_CLKXTAL_EDGE_SEL_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_MSB 17 -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_LSB 17 -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_MASK 0x00020000 -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_SYNTH4_VCOCAPPULLUP_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_MSB 25 -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_LSB 18 -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_MASK 0x03fc0000 -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_GET(x) (((x) & 0x03fc0000) >> 18) -#define PHY_ANALOG_SYNTH4_VCOCAP_OVR_SET(x) (((x) << 18) & 0x03fc0000) -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_MSB 26 -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_LSB 26 -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_MASK 0x04000000 -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_SYNTH4_FORCE_VCOCAP_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_MSB 27 -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_LSB 27 -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_MASK 0x08000000 -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_SYNTH4_FORCE_PINVC_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_MSB 28 -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_LSB 28 -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_MASK 0x10000000 -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_SYNTH4_SHORTR_UNTIL_LOCKED_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_MSB 29 -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_LSB 29 -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_MASK 0x20000000 -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_SYNTH4_ALWAYS_SHORTR_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_MSB 30 -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_LSB 30 -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_MASK 0x40000000 -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_SYNTH4_DIS_LOSTVC_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_MSB 31 -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_LSB 31 -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_MASK 0x80000000 -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH4_DIS_LIN_CAPSEARCH_SET(x) (((x) << 31) & 0x80000000) - -/* macros for SYNTH5 */ -#define PHY_ANALOG_SYNTH5_ADDRESS 0x00000090 -#define PHY_ANALOG_SYNTH5_OFFSET 0x00000090 -#define PHY_ANALOG_SYNTH5_VCOBIAS_MSB 1 -#define PHY_ANALOG_SYNTH5_VCOBIAS_LSB 0 -#define PHY_ANALOG_SYNTH5_VCOBIAS_MASK 0x00000003 -#define PHY_ANALOG_SYNTH5_VCOBIAS_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_SYNTH5_VCOBIAS_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_MSB 4 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_LSB 2 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_MASK 0x0000001c -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF5G50_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_MSB 7 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_LSB 5 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_MASK 0x000000e0 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOBUF2G50_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_MSB 10 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_LSB 8 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_MASK 0x00000700 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_SYNTH5_PWDB_ICVCO25_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_MSB 13 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_LSB 11 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_MASK 0x00003800 -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_SYNTH5_PWDB_ICVCOREG25_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_MSB 14 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_LSB 14 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_MASK 0x00004000 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_SYNTH5_PWDB_IRVCOREG50_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_MSB 17 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_LSB 15 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_MASK 0x00038000 -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_GET(x) (((x) & 0x00038000) >> 15) -#define PHY_ANALOG_SYNTH5_PWDB_ICLOMIX_SET(x) (((x) << 15) & 0x00038000) -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_MSB 20 -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_LSB 18 -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_MASK 0x001c0000 -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_GET(x) (((x) & 0x001c0000) >> 18) -#define PHY_ANALOG_SYNTH5_PWDB_ICLODIV50_SET(x) (((x) << 18) & 0x001c0000) -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_MSB 23 -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_LSB 21 -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_MASK 0x00e00000 -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_GET(x) (((x) & 0x00e00000) >> 21) -#define PHY_ANALOG_SYNTH5_PWDB_ICPRESC50_SET(x) (((x) << 21) & 0x00e00000) -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_MSB 26 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_LSB 24 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_MASK 0x07000000 -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_GET(x) (((x) & 0x07000000) >> 24) -#define PHY_ANALOG_SYNTH5_PWDB_IRVCMON25_SET(x) (((x) << 24) & 0x07000000) -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_MSB 29 -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_LSB 27 -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_MASK 0x38000000 -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_GET(x) (((x) & 0x38000000) >> 27) -#define PHY_ANALOG_SYNTH5_PWDB_IRPFDCP_SET(x) (((x) << 27) & 0x38000000) -#define PHY_ANALOG_SYNTH5_SDM_DITHER2_MSB 31 -#define PHY_ANALOG_SYNTH5_SDM_DITHER2_LSB 30 -#define PHY_ANALOG_SYNTH5_SDM_DITHER2_MASK 0xc0000000 -#define PHY_ANALOG_SYNTH5_SDM_DITHER2_GET(x) (((x) & 0xc0000000) >> 30) -#define PHY_ANALOG_SYNTH5_SDM_DITHER2_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for SYNTH6 */ -#define PHY_ANALOG_SYNTH6_ADDRESS 0x00000094 -#define PHY_ANALOG_SYNTH6_OFFSET 0x00000094 -#define PHY_ANALOG_SYNTH6_LOBUF5GTUNE_MSB 1 -#define PHY_ANALOG_SYNTH6_LOBUF5GTUNE_LSB 0 -#define PHY_ANALOG_SYNTH6_LOBUF5GTUNE_MASK 0x00000003 -#define PHY_ANALOG_SYNTH6_LOBUF5GTUNE_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_SYNTH6_LOOP_IP_MSB 8 -#define PHY_ANALOG_SYNTH6_LOOP_IP_LSB 2 -#define PHY_ANALOG_SYNTH6_LOOP_IP_MASK 0x000001fc -#define PHY_ANALOG_SYNTH6_LOOP_IP_GET(x) (((x) & 0x000001fc) >> 2) -#define PHY_ANALOG_SYNTH6_VC2LOW_MSB 9 -#define PHY_ANALOG_SYNTH6_VC2LOW_LSB 9 -#define PHY_ANALOG_SYNTH6_VC2LOW_MASK 0x00000200 -#define PHY_ANALOG_SYNTH6_VC2LOW_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_SYNTH6_VC2HIGH_MSB 10 -#define PHY_ANALOG_SYNTH6_VC2HIGH_LSB 10 -#define PHY_ANALOG_SYNTH6_VC2HIGH_MASK 0x00000400 -#define PHY_ANALOG_SYNTH6_VC2HIGH_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_SYNTH6_RESET_SDM_B_MSB 11 -#define PHY_ANALOG_SYNTH6_RESET_SDM_B_LSB 11 -#define PHY_ANALOG_SYNTH6_RESET_SDM_B_MASK 0x00000800 -#define PHY_ANALOG_SYNTH6_RESET_SDM_B_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_SYNTH6_RESET_PSCOUNTERS_MSB 12 -#define PHY_ANALOG_SYNTH6_RESET_PSCOUNTERS_LSB 12 -#define PHY_ANALOG_SYNTH6_RESET_PSCOUNTERS_MASK 0x00001000 -#define PHY_ANALOG_SYNTH6_RESET_PSCOUNTERS_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_SYNTH6_RESET_PFD_MSB 13 -#define PHY_ANALOG_SYNTH6_RESET_PFD_LSB 13 -#define PHY_ANALOG_SYNTH6_RESET_PFD_MASK 0x00002000 -#define PHY_ANALOG_SYNTH6_RESET_PFD_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_SYNTH6_RESET_RFD_MSB 14 -#define PHY_ANALOG_SYNTH6_RESET_RFD_LSB 14 -#define PHY_ANALOG_SYNTH6_RESET_RFD_MASK 0x00004000 -#define PHY_ANALOG_SYNTH6_RESET_RFD_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_SYNTH6_SHORT_R_MSB 15 -#define PHY_ANALOG_SYNTH6_SHORT_R_LSB 15 -#define PHY_ANALOG_SYNTH6_SHORT_R_MASK 0x00008000 -#define PHY_ANALOG_SYNTH6_SHORT_R_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_SYNTH6_VCO_CAP_ST_MSB 23 -#define PHY_ANALOG_SYNTH6_VCO_CAP_ST_LSB 16 -#define PHY_ANALOG_SYNTH6_VCO_CAP_ST_MASK 0x00ff0000 -#define PHY_ANALOG_SYNTH6_VCO_CAP_ST_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_ANALOG_SYNTH6_PIN_VC_MSB 24 -#define PHY_ANALOG_SYNTH6_PIN_VC_LSB 24 -#define PHY_ANALOG_SYNTH6_PIN_VC_MASK 0x01000000 -#define PHY_ANALOG_SYNTH6_PIN_VC_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_ANALOG_SYNTH6_SYNTH_LOCK_VC_OK_MSB 25 -#define PHY_ANALOG_SYNTH6_SYNTH_LOCK_VC_OK_LSB 25 -#define PHY_ANALOG_SYNTH6_SYNTH_LOCK_VC_OK_MASK 0x02000000 -#define PHY_ANALOG_SYNTH6_SYNTH_LOCK_VC_OK_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_ANALOG_SYNTH6_CAP_SEARCH_MSB 26 -#define PHY_ANALOG_SYNTH6_CAP_SEARCH_LSB 26 -#define PHY_ANALOG_SYNTH6_CAP_SEARCH_MASK 0x04000000 -#define PHY_ANALOG_SYNTH6_CAP_SEARCH_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_SYNTH6_SYNTH_SM_STATE_MSB 30 -#define PHY_ANALOG_SYNTH6_SYNTH_SM_STATE_LSB 27 -#define PHY_ANALOG_SYNTH6_SYNTH_SM_STATE_MASK 0x78000000 -#define PHY_ANALOG_SYNTH6_SYNTH_SM_STATE_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_ANALOG_SYNTH6_SYNTH_ON_MSB 31 -#define PHY_ANALOG_SYNTH6_SYNTH_ON_LSB 31 -#define PHY_ANALOG_SYNTH6_SYNTH_ON_MASK 0x80000000 -#define PHY_ANALOG_SYNTH6_SYNTH_ON_GET(x) (((x) & 0x80000000) >> 31) - -/* macros for SYNTH7 */ -#define PHY_ANALOG_SYNTH7_ADDRESS 0x00000098 -#define PHY_ANALOG_SYNTH7_OFFSET 0x00000098 -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_MSB 0 -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_LSB 0 -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_MASK 0x00000001 -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH7_OVRCHANDECODER_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_MSB 1 -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_LSB 1 -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_MASK 0x00000002 -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_SYNTH7_FORCE_FRACLSB_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_SYNTH7_CHANFRAC_MSB 18 -#define PHY_ANALOG_SYNTH7_CHANFRAC_LSB 2 -#define PHY_ANALOG_SYNTH7_CHANFRAC_MASK 0x0007fffc -#define PHY_ANALOG_SYNTH7_CHANFRAC_GET(x) (((x) & 0x0007fffc) >> 2) -#define PHY_ANALOG_SYNTH7_CHANFRAC_SET(x) (((x) << 2) & 0x0007fffc) -#define PHY_ANALOG_SYNTH7_CHANSEL_MSB 27 -#define PHY_ANALOG_SYNTH7_CHANSEL_LSB 19 -#define PHY_ANALOG_SYNTH7_CHANSEL_MASK 0x0ff80000 -#define PHY_ANALOG_SYNTH7_CHANSEL_GET(x) (((x) & 0x0ff80000) >> 19) -#define PHY_ANALOG_SYNTH7_CHANSEL_SET(x) (((x) << 19) & 0x0ff80000) -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_MSB 29 -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_LSB 28 -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_MASK 0x30000000 -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_GET(x) (((x) & 0x30000000) >> 28) -#define PHY_ANALOG_SYNTH7_AMODEREFSEL_SET(x) (((x) << 28) & 0x30000000) -#define PHY_ANALOG_SYNTH7_FRACMODE_MSB 30 -#define PHY_ANALOG_SYNTH7_FRACMODE_LSB 30 -#define PHY_ANALOG_SYNTH7_FRACMODE_MASK 0x40000000 -#define PHY_ANALOG_SYNTH7_FRACMODE_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_SYNTH7_FRACMODE_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_MSB 31 -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_LSB 31 -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_MASK 0x80000000 -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH7_LOADSYNTHCHANNEL_SET(x) (((x) << 31) & 0x80000000) - -/* macros for SYNTH8 */ -#define PHY_ANALOG_SYNTH8_ADDRESS 0x0000009c -#define PHY_ANALOG_SYNTH8_OFFSET 0x0000009c -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_MSB 0 -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_LSB 0 -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_MASK 0x00000001 -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH8_CPSTEERING_EN_FRACN_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_MSB 7 -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_LSB 1 -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_MASK 0x000000fe -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_GET(x) (((x) & 0x000000fe) >> 1) -#define PHY_ANALOG_SYNTH8_LOOP_ICPB_SET(x) (((x) << 1) & 0x000000fe) -#define PHY_ANALOG_SYNTH8_LOOP_CSB_MSB 11 -#define PHY_ANALOG_SYNTH8_LOOP_CSB_LSB 8 -#define PHY_ANALOG_SYNTH8_LOOP_CSB_MASK 0x00000f00 -#define PHY_ANALOG_SYNTH8_LOOP_CSB_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_SYNTH8_LOOP_CSB_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_SYNTH8_LOOP_RSB_MSB 16 -#define PHY_ANALOG_SYNTH8_LOOP_RSB_LSB 12 -#define PHY_ANALOG_SYNTH8_LOOP_RSB_MASK 0x0001f000 -#define PHY_ANALOG_SYNTH8_LOOP_RSB_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_ANALOG_SYNTH8_LOOP_RSB_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_ANALOG_SYNTH8_LOOP_CPB_MSB 21 -#define PHY_ANALOG_SYNTH8_LOOP_CPB_LSB 17 -#define PHY_ANALOG_SYNTH8_LOOP_CPB_MASK 0x003e0000 -#define PHY_ANALOG_SYNTH8_LOOP_CPB_GET(x) (((x) & 0x003e0000) >> 17) -#define PHY_ANALOG_SYNTH8_LOOP_CPB_SET(x) (((x) << 17) & 0x003e0000) -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_MSB 26 -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_LSB 22 -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_MASK 0x07c00000 -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_GET(x) (((x) & 0x07c00000) >> 22) -#define PHY_ANALOG_SYNTH8_LOOP_3RD_ORDER_RB_SET(x) (((x) << 22) & 0x07c00000) -#define PHY_ANALOG_SYNTH8_REFDIVB_MSB 31 -#define PHY_ANALOG_SYNTH8_REFDIVB_LSB 27 -#define PHY_ANALOG_SYNTH8_REFDIVB_MASK 0xf8000000 -#define PHY_ANALOG_SYNTH8_REFDIVB_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_SYNTH8_REFDIVB_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for SYNTH9 */ -#define PHY_ANALOG_SYNTH9_ADDRESS 0x000000a0 -#define PHY_ANALOG_SYNTH9_OFFSET 0x000000a0 -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_MSB 0 -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_LSB 0 -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_MASK 0x00000001 -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH9_PFDDELAY_INTN_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_MSB 3 -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_LSB 1 -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_MASK 0x0000000e -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_ANALOG_SYNTH9_SLOPE_ICPA0_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_MSB 7 -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_LSB 4 -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_MASK 0x000000f0 -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_SYNTH9_LOOP_ICPA0_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_MSB 11 -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_LSB 8 -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_MASK 0x00000f00 -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_SYNTH9_LOOP_CSA0_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_MSB 16 -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_LSB 12 -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_MASK 0x0001f000 -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_ANALOG_SYNTH9_LOOP_RSA0_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_MSB 21 -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_LSB 17 -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_MASK 0x003e0000 -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_GET(x) (((x) & 0x003e0000) >> 17) -#define PHY_ANALOG_SYNTH9_LOOP_CPA0_SET(x) (((x) << 17) & 0x003e0000) -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_MSB 26 -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_LSB 22 -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_MASK 0x07c00000 -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_GET(x) (((x) & 0x07c00000) >> 22) -#define PHY_ANALOG_SYNTH9_LOOP_3RD_ORDER_RA_SET(x) (((x) << 22) & 0x07c00000) -#define PHY_ANALOG_SYNTH9_REFDIVA_MSB 31 -#define PHY_ANALOG_SYNTH9_REFDIVA_LSB 27 -#define PHY_ANALOG_SYNTH9_REFDIVA_MASK 0xf8000000 -#define PHY_ANALOG_SYNTH9_REFDIVA_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_SYNTH9_REFDIVA_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for SYNTH10 */ -#define PHY_ANALOG_SYNTH10_ADDRESS 0x000000a4 -#define PHY_ANALOG_SYNTH10_OFFSET 0x000000a4 -#define PHY_ANALOG_SYNTH10_SPARE10A_MSB 1 -#define PHY_ANALOG_SYNTH10_SPARE10A_LSB 0 -#define PHY_ANALOG_SYNTH10_SPARE10A_MASK 0x00000003 -#define PHY_ANALOG_SYNTH10_SPARE10A_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_SYNTH10_SPARE10A_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_MSB 4 -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_LSB 2 -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_MASK 0x0000001c -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_ANALOG_SYNTH10_PWDB_ICLOBIAS50_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_MSB 7 -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_LSB 5 -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_MASK 0x000000e0 -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_SYNTH10_PWDB_IRSPARE25_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_MSB 10 -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_LSB 8 -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_MASK 0x00000700 -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_SYNTH10_PWDB_ICSPARE25_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_MSB 13 -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_LSB 11 -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_MASK 0x00003800 -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_SYNTH10_SLOPE_ICPA1_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_MSB 17 -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_LSB 14 -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_MASK 0x0003c000 -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_GET(x) (((x) & 0x0003c000) >> 14) -#define PHY_ANALOG_SYNTH10_LOOP_ICPA1_SET(x) (((x) << 14) & 0x0003c000) -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_MSB 21 -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_LSB 18 -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_MASK 0x003c0000 -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_GET(x) (((x) & 0x003c0000) >> 18) -#define PHY_ANALOG_SYNTH10_LOOP_CSA1_SET(x) (((x) << 18) & 0x003c0000) -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_MSB 26 -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_LSB 22 -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_MASK 0x07c00000 -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_GET(x) (((x) & 0x07c00000) >> 22) -#define PHY_ANALOG_SYNTH10_LOOP_RSA1_SET(x) (((x) << 22) & 0x07c00000) -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_MSB 31 -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_LSB 27 -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_MASK 0xf8000000 -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_SYNTH10_LOOP_CPA1_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for SYNTH11 */ -#define PHY_ANALOG_SYNTH11_ADDRESS 0x000000a8 -#define PHY_ANALOG_SYNTH11_OFFSET 0x000000a8 -#define PHY_ANALOG_SYNTH11_SPARE11A_MSB 4 -#define PHY_ANALOG_SYNTH11_SPARE11A_LSB 0 -#define PHY_ANALOG_SYNTH11_SPARE11A_MASK 0x0000001f -#define PHY_ANALOG_SYNTH11_SPARE11A_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_SYNTH11_SPARE11A_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_MSB 5 -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_LSB 5 -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_MASK 0x00000020 -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_SYNTH11_FORCE_LOBUF5G_ON_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_SYNTH11_LOREFSEL_MSB 7 -#define PHY_ANALOG_SYNTH11_LOREFSEL_LSB 6 -#define PHY_ANALOG_SYNTH11_LOREFSEL_MASK 0x000000c0 -#define PHY_ANALOG_SYNTH11_LOREFSEL_GET(x) (((x) & 0x000000c0) >> 6) -#define PHY_ANALOG_SYNTH11_LOREFSEL_SET(x) (((x) << 6) & 0x000000c0) -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_MSB 9 -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_LSB 8 -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_MASK 0x00000300 -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_ANALOG_SYNTH11_LOBUF2GTUNE_SET(x) (((x) << 8) & 0x00000300) -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_MSB 10 -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_LSB 10 -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_MASK 0x00000400 -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_SYNTH11_CPSTEERING_MODE_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_MSB 13 -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_LSB 11 -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_MASK 0x00003800 -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_SYNTH11_SLOPE_ICPA2_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_MSB 17 -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_LSB 14 -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_MASK 0x0003c000 -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_GET(x) (((x) & 0x0003c000) >> 14) -#define PHY_ANALOG_SYNTH11_LOOP_ICPA2_SET(x) (((x) << 14) & 0x0003c000) -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_MSB 21 -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_LSB 18 -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_MASK 0x003c0000 -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_GET(x) (((x) & 0x003c0000) >> 18) -#define PHY_ANALOG_SYNTH11_LOOP_CSA2_SET(x) (((x) << 18) & 0x003c0000) -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_MSB 26 -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_LSB 22 -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_MASK 0x07c00000 -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_GET(x) (((x) & 0x07c00000) >> 22) -#define PHY_ANALOG_SYNTH11_LOOP_RSA2_SET(x) (((x) << 22) & 0x07c00000) -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_MSB 31 -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_LSB 27 -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_MASK 0xf8000000 -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_SYNTH11_LOOP_CPA2_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for SYNTH12 */ -#define PHY_ANALOG_SYNTH12_ADDRESS 0x000000ac -#define PHY_ANALOG_SYNTH12_OFFSET 0x000000ac -#define PHY_ANALOG_SYNTH12_SPARE12A_MSB 9 -#define PHY_ANALOG_SYNTH12_SPARE12A_LSB 0 -#define PHY_ANALOG_SYNTH12_SPARE12A_MASK 0x000003ff -#define PHY_ANALOG_SYNTH12_SPARE12A_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_ANALOG_SYNTH12_SPARE12A_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_ANALOG_SYNTH12_LOOPLEAKCUR_FRACN_MSB 13 -#define PHY_ANALOG_SYNTH12_LOOPLEAKCUR_FRACN_LSB 10 -#define PHY_ANALOG_SYNTH12_LOOPLEAKCUR_FRACN_MASK 0x00003c00 -#define PHY_ANALOG_SYNTH12_LOOPLEAKCUR_FRACN_GET(x) (((x) & 0x00003c00) >> 10) -#define PHY_ANALOG_SYNTH12_LOOPLEAKCUR_FRACN_SET(x) (((x) << 10) & 0x00003c00) -#define PHY_ANALOG_SYNTH12_CPLOWLK_FRACN_MSB 14 -#define PHY_ANALOG_SYNTH12_CPLOWLK_FRACN_LSB 14 -#define PHY_ANALOG_SYNTH12_CPLOWLK_FRACN_MASK 0x00004000 -#define PHY_ANALOG_SYNTH12_CPLOWLK_FRACN_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_SYNTH12_CPLOWLK_FRACN_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_SYNTH12_CPBIAS_FRACN_MSB 16 -#define PHY_ANALOG_SYNTH12_CPBIAS_FRACN_LSB 15 -#define PHY_ANALOG_SYNTH12_CPBIAS_FRACN_MASK 0x00018000 -#define PHY_ANALOG_SYNTH12_CPBIAS_FRACN_GET(x) (((x) & 0x00018000) >> 15) -#define PHY_ANALOG_SYNTH12_CPBIAS_FRACN_SET(x) (((x) << 15) & 0x00018000) -#define PHY_ANALOG_SYNTH12_SYNTHDIGOUTEN_MSB 17 -#define PHY_ANALOG_SYNTH12_SYNTHDIGOUTEN_LSB 17 -#define PHY_ANALOG_SYNTH12_SYNTHDIGOUTEN_MASK 0x00020000 -#define PHY_ANALOG_SYNTH12_SYNTHDIGOUTEN_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_SYNTH12_SYNTHDIGOUTEN_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_SYNTH12_STRCONT_MSB 18 -#define PHY_ANALOG_SYNTH12_STRCONT_LSB 18 -#define PHY_ANALOG_SYNTH12_STRCONT_MASK 0x00040000 -#define PHY_ANALOG_SYNTH12_STRCONT_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_SYNTH12_STRCONT_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_SYNTH12_VREFMUL3_MSB 22 -#define PHY_ANALOG_SYNTH12_VREFMUL3_LSB 19 -#define PHY_ANALOG_SYNTH12_VREFMUL3_MASK 0x00780000 -#define PHY_ANALOG_SYNTH12_VREFMUL3_GET(x) (((x) & 0x00780000) >> 19) -#define PHY_ANALOG_SYNTH12_VREFMUL3_SET(x) (((x) << 19) & 0x00780000) -#define PHY_ANALOG_SYNTH12_VREFMUL2_MSB 26 -#define PHY_ANALOG_SYNTH12_VREFMUL2_LSB 23 -#define PHY_ANALOG_SYNTH12_VREFMUL2_MASK 0x07800000 -#define PHY_ANALOG_SYNTH12_VREFMUL2_GET(x) (((x) & 0x07800000) >> 23) -#define PHY_ANALOG_SYNTH12_VREFMUL2_SET(x) (((x) << 23) & 0x07800000) -#define PHY_ANALOG_SYNTH12_VREFMUL1_MSB 30 -#define PHY_ANALOG_SYNTH12_VREFMUL1_LSB 27 -#define PHY_ANALOG_SYNTH12_VREFMUL1_MASK 0x78000000 -#define PHY_ANALOG_SYNTH12_VREFMUL1_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_ANALOG_SYNTH12_VREFMUL1_SET(x) (((x) << 27) & 0x78000000) -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_MSB 31 -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_LSB 31 -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_MASK 0x80000000 -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_SYNTH12_CLK_DOUBLER_EN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for SYNTH13 */ -#define PHY_ANALOG_SYNTH13_ADDRESS 0x000000b0 -#define PHY_ANALOG_SYNTH13_OFFSET 0x000000b0 -#define PHY_ANALOG_SYNTH13_SPARE13A_MSB 0 -#define PHY_ANALOG_SYNTH13_SPARE13A_LSB 0 -#define PHY_ANALOG_SYNTH13_SPARE13A_MASK 0x00000001 -#define PHY_ANALOG_SYNTH13_SPARE13A_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_SYNTH13_SPARE13A_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_SYNTH13_SLOPE_ICPA_FRACN_MSB 3 -#define PHY_ANALOG_SYNTH13_SLOPE_ICPA_FRACN_LSB 1 -#define PHY_ANALOG_SYNTH13_SLOPE_ICPA_FRACN_MASK 0x0000000e -#define PHY_ANALOG_SYNTH13_SLOPE_ICPA_FRACN_GET(x) (((x) & 0x0000000e) >> 1) -#define PHY_ANALOG_SYNTH13_SLOPE_ICPA_FRACN_SET(x) (((x) << 1) & 0x0000000e) -#define PHY_ANALOG_SYNTH13_LOOP_ICPA_FRACN_MSB 7 -#define PHY_ANALOG_SYNTH13_LOOP_ICPA_FRACN_LSB 4 -#define PHY_ANALOG_SYNTH13_LOOP_ICPA_FRACN_MASK 0x000000f0 -#define PHY_ANALOG_SYNTH13_LOOP_ICPA_FRACN_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_SYNTH13_LOOP_ICPA_FRACN_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_ANALOG_SYNTH13_LOOP_CSA_FRACN_MSB 11 -#define PHY_ANALOG_SYNTH13_LOOP_CSA_FRACN_LSB 8 -#define PHY_ANALOG_SYNTH13_LOOP_CSA_FRACN_MASK 0x00000f00 -#define PHY_ANALOG_SYNTH13_LOOP_CSA_FRACN_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_SYNTH13_LOOP_CSA_FRACN_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_SYNTH13_LOOP_RSA_FRACN_MSB 16 -#define PHY_ANALOG_SYNTH13_LOOP_RSA_FRACN_LSB 12 -#define PHY_ANALOG_SYNTH13_LOOP_RSA_FRACN_MASK 0x0001f000 -#define PHY_ANALOG_SYNTH13_LOOP_RSA_FRACN_GET(x) (((x) & 0x0001f000) >> 12) -#define PHY_ANALOG_SYNTH13_LOOP_RSA_FRACN_SET(x) (((x) << 12) & 0x0001f000) -#define PHY_ANALOG_SYNTH13_LOOP_CPA_FRACN_MSB 21 -#define PHY_ANALOG_SYNTH13_LOOP_CPA_FRACN_LSB 17 -#define PHY_ANALOG_SYNTH13_LOOP_CPA_FRACN_MASK 0x003e0000 -#define PHY_ANALOG_SYNTH13_LOOP_CPA_FRACN_GET(x) (((x) & 0x003e0000) >> 17) -#define PHY_ANALOG_SYNTH13_LOOP_CPA_FRACN_SET(x) (((x) << 17) & 0x003e0000) -#define PHY_ANALOG_SYNTH13_LOOP_3RD_ORDER_RA_FRACN_MSB 26 -#define PHY_ANALOG_SYNTH13_LOOP_3RD_ORDER_RA_FRACN_LSB 22 -#define PHY_ANALOG_SYNTH13_LOOP_3RD_ORDER_RA_FRACN_MASK 0x07c00000 -#define PHY_ANALOG_SYNTH13_LOOP_3RD_ORDER_RA_FRACN_GET(x) (((x) & 0x07c00000) >> 22) -#define PHY_ANALOG_SYNTH13_LOOP_3RD_ORDER_RA_FRACN_SET(x) (((x) << 22) & 0x07c00000) -#define PHY_ANALOG_SYNTH13_REFDIVA_FRACN_MSB 31 -#define PHY_ANALOG_SYNTH13_REFDIVA_FRACN_LSB 27 -#define PHY_ANALOG_SYNTH13_REFDIVA_FRACN_MASK 0xf8000000 -#define PHY_ANALOG_SYNTH13_REFDIVA_FRACN_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_SYNTH13_REFDIVA_FRACN_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for SYNTH14 */ -#define PHY_ANALOG_SYNTH14_ADDRESS 0x000000b4 -#define PHY_ANALOG_SYNTH14_OFFSET 0x000000b4 -#define PHY_ANALOG_SYNTH14_SPARE14A_MSB 1 -#define PHY_ANALOG_SYNTH14_SPARE14A_LSB 0 -#define PHY_ANALOG_SYNTH14_SPARE14A_MASK 0x00000003 -#define PHY_ANALOG_SYNTH14_SPARE14A_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_SYNTH14_SPARE14A_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_3_MSB 3 -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_3_LSB 2 -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_3_MASK 0x0000000c -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_3_GET(x) (((x) & 0x0000000c) >> 2) -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_3_SET(x) (((x) << 2) & 0x0000000c) -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_3_MSB 5 -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_3_LSB 4 -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_3_MASK 0x00000030 -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_3_GET(x) (((x) & 0x00000030) >> 4) -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_3_SET(x) (((x) << 4) & 0x00000030) -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_2_MSB 7 -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_2_LSB 6 -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_2_MASK 0x000000c0 -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_2_GET(x) (((x) & 0x000000c0) >> 6) -#define PHY_ANALOG_SYNTH14_LOBUF5GTUNE_2_SET(x) (((x) << 6) & 0x000000c0) -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_2_MSB 9 -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_2_LSB 8 -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_2_MASK 0x00000300 -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_2_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_ANALOG_SYNTH14_LOBUF2GTUNE_2_SET(x) (((x) << 8) & 0x00000300) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_3_MSB 10 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_3_LSB 10 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_3_MASK 0x00000400 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_3_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_3_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_3_MSB 11 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_3_LSB 11 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_3_MASK 0x00000800 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_3_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_3_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_2_MSB 12 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_2_LSB 12 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_2_MASK 0x00001000 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_2_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF5G_2_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_2_MSB 13 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_2_LSB 13 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_2_MASK 0x00002000 -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_2_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_SYNTH14_PWD_LOBUF2G_2_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_SYNTH14_PWUPLO23_PD_MSB 16 -#define PHY_ANALOG_SYNTH14_PWUPLO23_PD_LSB 14 -#define PHY_ANALOG_SYNTH14_PWUPLO23_PD_MASK 0x0001c000 -#define PHY_ANALOG_SYNTH14_PWUPLO23_PD_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_SYNTH14_PWUPLO23_PD_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_3_MSB 19 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_3_LSB 17 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_3_MASK 0x000e0000 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_3_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_3_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_3_MSB 22 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_3_LSB 20 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_3_MASK 0x00700000 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_3_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_3_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_2_MSB 25 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_2_LSB 23 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_2_MASK 0x03800000 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_2_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF5G50_2_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_2_MSB 28 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_2_LSB 26 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_2_MASK 0x1c000000 -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_2_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_SYNTH14_PWDB_ICLOBUF2G50_2_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_SYNTH14_PWDB_ICLVLSHFT_MSB 31 -#define PHY_ANALOG_SYNTH14_PWDB_ICLVLSHFT_LSB 29 -#define PHY_ANALOG_SYNTH14_PWDB_ICLVLSHFT_MASK 0xe0000000 -#define PHY_ANALOG_SYNTH14_PWDB_ICLVLSHFT_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_SYNTH14_PWDB_ICLVLSHFT_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for BIAS1 */ -#define PHY_ANALOG_BIAS1_ADDRESS 0x000000c0 -#define PHY_ANALOG_BIAS1_OFFSET 0x000000c0 -#define PHY_ANALOG_BIAS1_SPARE1_MSB 6 -#define PHY_ANALOG_BIAS1_SPARE1_LSB 0 -#define PHY_ANALOG_BIAS1_SPARE1_MASK 0x0000007f -#define PHY_ANALOG_BIAS1_SPARE1_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_ANALOG_BIAS1_SPARE1_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_MSB 9 -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_LSB 7 -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_MASK 0x00000380 -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_GET(x) (((x) & 0x00000380) >> 7) -#define PHY_ANALOG_BIAS1_PWD_IC25V2IQ_SET(x) (((x) << 7) & 0x00000380) -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_MSB 12 -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_LSB 10 -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_MASK 0x00001c00 -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_GET(x) (((x) & 0x00001c00) >> 10) -#define PHY_ANALOG_BIAS1_PWD_IC25V2II_SET(x) (((x) << 10) & 0x00001c00) -#define PHY_ANALOG_BIAS1_PWD_IC25BB_MSB 15 -#define PHY_ANALOG_BIAS1_PWD_IC25BB_LSB 13 -#define PHY_ANALOG_BIAS1_PWD_IC25BB_MASK 0x0000e000 -#define PHY_ANALOG_BIAS1_PWD_IC25BB_GET(x) (((x) & 0x0000e000) >> 13) -#define PHY_ANALOG_BIAS1_PWD_IC25BB_SET(x) (((x) << 13) & 0x0000e000) -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_MSB 18 -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_LSB 16 -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_MASK 0x00070000 -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_GET(x) (((x) & 0x00070000) >> 16) -#define PHY_ANALOG_BIAS1_PWD_IC25DAC_SET(x) (((x) << 16) & 0x00070000) -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_MSB 21 -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_LSB 19 -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_MASK 0x00380000 -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_GET(x) (((x) & 0x00380000) >> 19) -#define PHY_ANALOG_BIAS1_PWD_IC25FIR_SET(x) (((x) << 19) & 0x00380000) -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_MSB 24 -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_LSB 22 -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_MASK 0x01c00000 -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_GET(x) (((x) & 0x01c00000) >> 22) -#define PHY_ANALOG_BIAS1_PWD_IC25ADC_SET(x) (((x) << 22) & 0x01c00000) -#define PHY_ANALOG_BIAS1_BIAS_SEL_MSB 31 -#define PHY_ANALOG_BIAS1_BIAS_SEL_LSB 25 -#define PHY_ANALOG_BIAS1_BIAS_SEL_MASK 0xfe000000 -#define PHY_ANALOG_BIAS1_BIAS_SEL_GET(x) (((x) & 0xfe000000) >> 25) -#define PHY_ANALOG_BIAS1_BIAS_SEL_SET(x) (((x) << 25) & 0xfe000000) - -/* macros for BIAS2 */ -#define PHY_ANALOG_BIAS2_ADDRESS 0x000000c4 -#define PHY_ANALOG_BIAS2_OFFSET 0x000000c4 -#define PHY_ANALOG_BIAS2_SPARE2_MSB 4 -#define PHY_ANALOG_BIAS2_SPARE2_LSB 0 -#define PHY_ANALOG_BIAS2_SPARE2_MASK 0x0000001f -#define PHY_ANALOG_BIAS2_SPARE2_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_BIAS2_SPARE2_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_BIAS2_PWD_IC25XPA_MSB 7 -#define PHY_ANALOG_BIAS2_PWD_IC25XPA_LSB 5 -#define PHY_ANALOG_BIAS2_PWD_IC25XPA_MASK 0x000000e0 -#define PHY_ANALOG_BIAS2_PWD_IC25XPA_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_BIAS2_PWD_IC25XPA_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_MSB 10 -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_LSB 8 -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_MASK 0x00000700 -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_BIAS2_PWD_IC25XTAL_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_MSB 13 -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_LSB 11 -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_MASK 0x00003800 -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_BIAS2_PWD_IC25TXRF_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_MSB 16 -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_LSB 14 -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_MASK 0x0001c000 -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_BIAS2_PWD_IC25RXRF_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_BIAS2_PWD_IC25SYNTH_MSB 19 -#define PHY_ANALOG_BIAS2_PWD_IC25SYNTH_LSB 17 -#define PHY_ANALOG_BIAS2_PWD_IC25SYNTH_MASK 0x000e0000 -#define PHY_ANALOG_BIAS2_PWD_IC25SYNTH_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_BIAS2_PWD_IC25SYNTH_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_MSB 22 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_LSB 20 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_MASK 0x00700000 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLREG_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_MSB 25 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_LSB 23 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_MASK 0x03800000 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP2_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_MSB 28 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_LSB 26 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_MASK 0x1c000000 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLCP_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_MSB 31 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_LSB 29 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_MASK 0xe0000000 -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_BIAS2_PWD_IC25PLLGM_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for BIAS3 */ -#define PHY_ANALOG_BIAS3_ADDRESS 0x000000c8 -#define PHY_ANALOG_BIAS3_OFFSET 0x000000c8 -#define PHY_ANALOG_BIAS3_SPARE3_MSB 1 -#define PHY_ANALOG_BIAS3_SPARE3_LSB 0 -#define PHY_ANALOG_BIAS3_SPARE3_MASK 0x00000003 -#define PHY_ANALOG_BIAS3_SPARE3_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_BIAS3_SPARE3_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_BIAS3_PWD_IR25SAR_MSB 4 -#define PHY_ANALOG_BIAS3_PWD_IR25SAR_LSB 2 -#define PHY_ANALOG_BIAS3_PWD_IR25SAR_MASK 0x0000001c -#define PHY_ANALOG_BIAS3_PWD_IR25SAR_GET(x) (((x) & 0x0000001c) >> 2) -#define PHY_ANALOG_BIAS3_PWD_IR25SAR_SET(x) (((x) << 2) & 0x0000001c) -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_MSB 7 -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_LSB 5 -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_MASK 0x000000e0 -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_GET(x) (((x) & 0x000000e0) >> 5) -#define PHY_ANALOG_BIAS3_PWD_IR25TXRF_SET(x) (((x) << 5) & 0x000000e0) -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_MSB 10 -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_LSB 8 -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_MASK 0x00000700 -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_GET(x) (((x) & 0x00000700) >> 8) -#define PHY_ANALOG_BIAS3_PWD_IR25RXRF_SET(x) (((x) << 8) & 0x00000700) -#define PHY_ANALOG_BIAS3_PWD_IR25SYNTH_MSB 13 -#define PHY_ANALOG_BIAS3_PWD_IR25SYNTH_LSB 11 -#define PHY_ANALOG_BIAS3_PWD_IR25SYNTH_MASK 0x00003800 -#define PHY_ANALOG_BIAS3_PWD_IR25SYNTH_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_BIAS3_PWD_IR25SYNTH_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_MSB 16 -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_LSB 14 -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_MASK 0x0001c000 -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_BIAS3_PWD_IR25PLLREG_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_BIAS3_PWD_IR25BB_MSB 19 -#define PHY_ANALOG_BIAS3_PWD_IR25BB_LSB 17 -#define PHY_ANALOG_BIAS3_PWD_IR25BB_MASK 0x000e0000 -#define PHY_ANALOG_BIAS3_PWD_IR25BB_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_BIAS3_PWD_IR25BB_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_MSB 22 -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_LSB 20 -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_MASK 0x00700000 -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_BIAS3_PWD_IR50DAC_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_MSB 25 -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_LSB 23 -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_MASK 0x03800000 -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_BIAS3_PWD_IR25DAC_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_MSB 28 -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_LSB 26 -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_MASK 0x1c000000 -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_BIAS3_PWD_IR25FIR_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_MSB 31 -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_LSB 29 -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_MASK 0xe0000000 -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_BIAS3_PWD_IR50ADC_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for BIAS4 */ -#define PHY_ANALOG_BIAS4_ADDRESS 0x000000cc -#define PHY_ANALOG_BIAS4_OFFSET 0x000000cc -#define PHY_ANALOG_BIAS4_SPARE4_MSB 10 -#define PHY_ANALOG_BIAS4_SPARE4_LSB 0 -#define PHY_ANALOG_BIAS4_SPARE4_MASK 0x000007ff -#define PHY_ANALOG_BIAS4_SPARE4_GET(x) (((x) & 0x000007ff) >> 0) -#define PHY_ANALOG_BIAS4_SPARE4_SET(x) (((x) << 0) & 0x000007ff) -#define PHY_ANALOG_BIAS4_PWD_IR25SPARED_MSB 13 -#define PHY_ANALOG_BIAS4_PWD_IR25SPARED_LSB 11 -#define PHY_ANALOG_BIAS4_PWD_IR25SPARED_MASK 0x00003800 -#define PHY_ANALOG_BIAS4_PWD_IR25SPARED_GET(x) (((x) & 0x00003800) >> 11) -#define PHY_ANALOG_BIAS4_PWD_IR25SPARED_SET(x) (((x) << 11) & 0x00003800) -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_MSB 16 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_LSB 14 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_MASK 0x0001c000 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_GET(x) (((x) & 0x0001c000) >> 14) -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREC_SET(x) (((x) << 14) & 0x0001c000) -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_MSB 19 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_LSB 17 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_MASK 0x000e0000 -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_BIAS4_PWD_IR25SPAREB_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_BIAS4_PWD_IR25XPA_MSB 22 -#define PHY_ANALOG_BIAS4_PWD_IR25XPA_LSB 20 -#define PHY_ANALOG_BIAS4_PWD_IR25XPA_MASK 0x00700000 -#define PHY_ANALOG_BIAS4_PWD_IR25XPA_GET(x) (((x) & 0x00700000) >> 20) -#define PHY_ANALOG_BIAS4_PWD_IR25XPA_SET(x) (((x) << 20) & 0x00700000) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_MSB 25 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_LSB 23 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_MASK 0x03800000 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREC_SET(x) (((x) << 23) & 0x03800000) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_MSB 28 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_LSB 26 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_MASK 0x1c000000 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREB_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_MSB 31 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_LSB 29 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_MASK 0xe0000000 -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_BIAS4_PWD_IC25SPAREA_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for RXTX1 */ -#define PHY_ANALOG_RXTX1_ADDRESS 0x00000100 -#define PHY_ANALOG_RXTX1_OFFSET 0x00000100 -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_MSB 0 -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_LSB 0 -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_MASK 0x00000001 -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXTX1_SCFIR_GAIN_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXTX1_MANRXGAIN_MSB 1 -#define PHY_ANALOG_RXTX1_MANRXGAIN_LSB 1 -#define PHY_ANALOG_RXTX1_MANRXGAIN_MASK 0x00000002 -#define PHY_ANALOG_RXTX1_MANRXGAIN_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_RXTX1_MANRXGAIN_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_RXTX1_AGC_DBDAC_MSB 5 -#define PHY_ANALOG_RXTX1_AGC_DBDAC_LSB 2 -#define PHY_ANALOG_RXTX1_AGC_DBDAC_MASK 0x0000003c -#define PHY_ANALOG_RXTX1_AGC_DBDAC_GET(x) (((x) & 0x0000003c) >> 2) -#define PHY_ANALOG_RXTX1_AGC_DBDAC_SET(x) (((x) << 2) & 0x0000003c) -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_MSB 6 -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_LSB 6 -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_MASK 0x00000040 -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RXTX1_OVR_AGC_DBDAC_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RXTX1_ENABLE_PAL_MSB 7 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_LSB 7 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_MASK 0x00000080 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXTX1_ENABLE_PAL_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_MSB 8 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_LSB 8 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_MASK 0x00000100 -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RXTX1_ENABLE_PAL_OVR_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_MSB 11 -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_LSB 9 -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_MASK 0x00000e00 -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_GET(x) (((x) & 0x00000e00) >> 9) -#define PHY_ANALOG_RXTX1_TX1DB_BIQUAD_SET(x) (((x) << 9) & 0x00000e00) -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_MSB 13 -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_LSB 12 -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_MASK 0x00003000 -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_GET(x) (((x) & 0x00003000) >> 12) -#define PHY_ANALOG_RXTX1_TX6DB_BIQUAD_SET(x) (((x) << 12) & 0x00003000) -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_MSB 14 -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_LSB 14 -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_MASK 0x00004000 -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_RXTX1_PADRVHALFGN2G_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_RXTX1_PADRV2GN_MSB 18 -#define PHY_ANALOG_RXTX1_PADRV2GN_LSB 15 -#define PHY_ANALOG_RXTX1_PADRV2GN_MASK 0x00078000 -#define PHY_ANALOG_RXTX1_PADRV2GN_GET(x) (((x) & 0x00078000) >> 15) -#define PHY_ANALOG_RXTX1_PADRV2GN_SET(x) (((x) << 15) & 0x00078000) -#define PHY_ANALOG_RXTX1_PADRV3GN5G_MSB 22 -#define PHY_ANALOG_RXTX1_PADRV3GN5G_LSB 19 -#define PHY_ANALOG_RXTX1_PADRV3GN5G_MASK 0x00780000 -#define PHY_ANALOG_RXTX1_PADRV3GN5G_GET(x) (((x) & 0x00780000) >> 19) -#define PHY_ANALOG_RXTX1_PADRV3GN5G_SET(x) (((x) << 19) & 0x00780000) -#define PHY_ANALOG_RXTX1_PADRV4GN5G_MSB 26 -#define PHY_ANALOG_RXTX1_PADRV4GN5G_LSB 23 -#define PHY_ANALOG_RXTX1_PADRV4GN5G_MASK 0x07800000 -#define PHY_ANALOG_RXTX1_PADRV4GN5G_GET(x) (((x) & 0x07800000) >> 23) -#define PHY_ANALOG_RXTX1_PADRV4GN5G_SET(x) (((x) << 23) & 0x07800000) -#define PHY_ANALOG_RXTX1_TXBB_GC_MSB 30 -#define PHY_ANALOG_RXTX1_TXBB_GC_LSB 27 -#define PHY_ANALOG_RXTX1_TXBB_GC_MASK 0x78000000 -#define PHY_ANALOG_RXTX1_TXBB_GC_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_ANALOG_RXTX1_TXBB_GC_SET(x) (((x) << 27) & 0x78000000) -#define PHY_ANALOG_RXTX1_MANTXGAIN_MSB 31 -#define PHY_ANALOG_RXTX1_MANTXGAIN_LSB 31 -#define PHY_ANALOG_RXTX1_MANTXGAIN_MASK 0x80000000 -#define PHY_ANALOG_RXTX1_MANTXGAIN_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXTX1_MANTXGAIN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for RXTX2 */ -#define PHY_ANALOG_RXTX2_ADDRESS 0x00000104 -#define PHY_ANALOG_RXTX2_OFFSET 0x00000104 -#define PHY_ANALOG_RXTX2_BMODE_MSB 0 -#define PHY_ANALOG_RXTX2_BMODE_LSB 0 -#define PHY_ANALOG_RXTX2_BMODE_MASK 0x00000001 -#define PHY_ANALOG_RXTX2_BMODE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RXTX2_BMODE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RXTX2_BMODE_OVR_MSB 1 -#define PHY_ANALOG_RXTX2_BMODE_OVR_LSB 1 -#define PHY_ANALOG_RXTX2_BMODE_OVR_MASK 0x00000002 -#define PHY_ANALOG_RXTX2_BMODE_OVR_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_RXTX2_BMODE_OVR_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_RXTX2_SYNTHON_MSB 2 -#define PHY_ANALOG_RXTX2_SYNTHON_LSB 2 -#define PHY_ANALOG_RXTX2_SYNTHON_MASK 0x00000004 -#define PHY_ANALOG_RXTX2_SYNTHON_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_RXTX2_SYNTHON_SET(x) (((x) << 2) & 0x00000004) -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_MSB 3 -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_LSB 3 -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_MASK 0x00000008 -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_RXTX2_SYNTHON_OVR_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_RXTX2_BW_ST_MSB 5 -#define PHY_ANALOG_RXTX2_BW_ST_LSB 4 -#define PHY_ANALOG_RXTX2_BW_ST_MASK 0x00000030 -#define PHY_ANALOG_RXTX2_BW_ST_GET(x) (((x) & 0x00000030) >> 4) -#define PHY_ANALOG_RXTX2_BW_ST_SET(x) (((x) << 4) & 0x00000030) -#define PHY_ANALOG_RXTX2_BW_ST_OVR_MSB 6 -#define PHY_ANALOG_RXTX2_BW_ST_OVR_LSB 6 -#define PHY_ANALOG_RXTX2_BW_ST_OVR_MASK 0x00000040 -#define PHY_ANALOG_RXTX2_BW_ST_OVR_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RXTX2_BW_ST_OVR_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RXTX2_TXON_MSB 7 -#define PHY_ANALOG_RXTX2_TXON_LSB 7 -#define PHY_ANALOG_RXTX2_TXON_MASK 0x00000080 -#define PHY_ANALOG_RXTX2_TXON_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXTX2_TXON_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXTX2_TXON_OVR_MSB 8 -#define PHY_ANALOG_RXTX2_TXON_OVR_LSB 8 -#define PHY_ANALOG_RXTX2_TXON_OVR_MASK 0x00000100 -#define PHY_ANALOG_RXTX2_TXON_OVR_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RXTX2_TXON_OVR_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RXTX2_PAON_MSB 9 -#define PHY_ANALOG_RXTX2_PAON_LSB 9 -#define PHY_ANALOG_RXTX2_PAON_MASK 0x00000200 -#define PHY_ANALOG_RXTX2_PAON_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_RXTX2_PAON_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_RXTX2_PAON_OVR_MSB 10 -#define PHY_ANALOG_RXTX2_PAON_OVR_LSB 10 -#define PHY_ANALOG_RXTX2_PAON_OVR_MASK 0x00000400 -#define PHY_ANALOG_RXTX2_PAON_OVR_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_RXTX2_PAON_OVR_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_RXTX2_RXON_MSB 11 -#define PHY_ANALOG_RXTX2_RXON_LSB 11 -#define PHY_ANALOG_RXTX2_RXON_MASK 0x00000800 -#define PHY_ANALOG_RXTX2_RXON_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_RXTX2_RXON_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_RXTX2_RXON_OVR_MSB 12 -#define PHY_ANALOG_RXTX2_RXON_OVR_LSB 12 -#define PHY_ANALOG_RXTX2_RXON_OVR_MASK 0x00001000 -#define PHY_ANALOG_RXTX2_RXON_OVR_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_RXTX2_RXON_OVR_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_RXTX2_AGCON_MSB 13 -#define PHY_ANALOG_RXTX2_AGCON_LSB 13 -#define PHY_ANALOG_RXTX2_AGCON_MASK 0x00002000 -#define PHY_ANALOG_RXTX2_AGCON_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_RXTX2_AGCON_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_RXTX2_AGCON_OVR_MSB 14 -#define PHY_ANALOG_RXTX2_AGCON_OVR_LSB 14 -#define PHY_ANALOG_RXTX2_AGCON_OVR_MASK 0x00004000 -#define PHY_ANALOG_RXTX2_AGCON_OVR_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_RXTX2_AGCON_OVR_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_RXTX2_TXMOD_MSB 17 -#define PHY_ANALOG_RXTX2_TXMOD_LSB 15 -#define PHY_ANALOG_RXTX2_TXMOD_MASK 0x00038000 -#define PHY_ANALOG_RXTX2_TXMOD_GET(x) (((x) & 0x00038000) >> 15) -#define PHY_ANALOG_RXTX2_TXMOD_SET(x) (((x) << 15) & 0x00038000) -#define PHY_ANALOG_RXTX2_TXMOD_OVR_MSB 18 -#define PHY_ANALOG_RXTX2_TXMOD_OVR_LSB 18 -#define PHY_ANALOG_RXTX2_TXMOD_OVR_MASK 0x00040000 -#define PHY_ANALOG_RXTX2_TXMOD_OVR_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_RXTX2_TXMOD_OVR_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_MSB 21 -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_LSB 19 -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_MASK 0x00380000 -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_GET(x) (((x) & 0x00380000) >> 19) -#define PHY_ANALOG_RXTX2_RX1DB_BIQUAD_SET(x) (((x) << 19) & 0x00380000) -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_MSB 23 -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_LSB 22 -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_MASK 0x00c00000 -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_GET(x) (((x) & 0x00c00000) >> 22) -#define PHY_ANALOG_RXTX2_RX6DB_BIQUAD_SET(x) (((x) << 22) & 0x00c00000) -#define PHY_ANALOG_RXTX2_MXRGAIN_MSB 25 -#define PHY_ANALOG_RXTX2_MXRGAIN_LSB 24 -#define PHY_ANALOG_RXTX2_MXRGAIN_MASK 0x03000000 -#define PHY_ANALOG_RXTX2_MXRGAIN_GET(x) (((x) & 0x03000000) >> 24) -#define PHY_ANALOG_RXTX2_MXRGAIN_SET(x) (((x) << 24) & 0x03000000) -#define PHY_ANALOG_RXTX2_VGAGAIN_MSB 28 -#define PHY_ANALOG_RXTX2_VGAGAIN_LSB 26 -#define PHY_ANALOG_RXTX2_VGAGAIN_MASK 0x1c000000 -#define PHY_ANALOG_RXTX2_VGAGAIN_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_ANALOG_RXTX2_VGAGAIN_SET(x) (((x) << 26) & 0x1c000000) -#define PHY_ANALOG_RXTX2_LNAGAIN_MSB 31 -#define PHY_ANALOG_RXTX2_LNAGAIN_LSB 29 -#define PHY_ANALOG_RXTX2_LNAGAIN_MASK 0xe0000000 -#define PHY_ANALOG_RXTX2_LNAGAIN_GET(x) (((x) & 0xe0000000) >> 29) -#define PHY_ANALOG_RXTX2_LNAGAIN_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for RXTX3 */ -#define PHY_ANALOG_RXTX3_ADDRESS 0x00000108 -#define PHY_ANALOG_RXTX3_OFFSET 0x00000108 -#define PHY_ANALOG_RXTX3_SPARE3_MSB 2 -#define PHY_ANALOG_RXTX3_SPARE3_LSB 0 -#define PHY_ANALOG_RXTX3_SPARE3_MASK 0x00000007 -#define PHY_ANALOG_RXTX3_SPARE3_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_RXTX3_SPARE3_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_RXTX3_SPURON_MSB 3 -#define PHY_ANALOG_RXTX3_SPURON_LSB 3 -#define PHY_ANALOG_RXTX3_SPURON_MASK 0x00000008 -#define PHY_ANALOG_RXTX3_SPURON_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_RXTX3_SPURON_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_RXTX3_PAL_LOCKEDEN_MSB 4 -#define PHY_ANALOG_RXTX3_PAL_LOCKEDEN_LSB 4 -#define PHY_ANALOG_RXTX3_PAL_LOCKEDEN_MASK 0x00000010 -#define PHY_ANALOG_RXTX3_PAL_LOCKEDEN_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_RXTX3_PAL_LOCKEDEN_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_RXTX3_DACFULLSCALE_MSB 5 -#define PHY_ANALOG_RXTX3_DACFULLSCALE_LSB 5 -#define PHY_ANALOG_RXTX3_DACFULLSCALE_MASK 0x00000020 -#define PHY_ANALOG_RXTX3_DACFULLSCALE_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_RXTX3_DACFULLSCALE_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_RXTX3_ADCSHORT_MSB 6 -#define PHY_ANALOG_RXTX3_ADCSHORT_LSB 6 -#define PHY_ANALOG_RXTX3_ADCSHORT_MASK 0x00000040 -#define PHY_ANALOG_RXTX3_ADCSHORT_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RXTX3_ADCSHORT_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RXTX3_DACPWD_MSB 7 -#define PHY_ANALOG_RXTX3_DACPWD_LSB 7 -#define PHY_ANALOG_RXTX3_DACPWD_MASK 0x00000080 -#define PHY_ANALOG_RXTX3_DACPWD_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RXTX3_DACPWD_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RXTX3_DACPWD_OVR_MSB 8 -#define PHY_ANALOG_RXTX3_DACPWD_OVR_LSB 8 -#define PHY_ANALOG_RXTX3_DACPWD_OVR_MASK 0x00000100 -#define PHY_ANALOG_RXTX3_DACPWD_OVR_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RXTX3_DACPWD_OVR_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RXTX3_ADCPWD_MSB 9 -#define PHY_ANALOG_RXTX3_ADCPWD_LSB 9 -#define PHY_ANALOG_RXTX3_ADCPWD_MASK 0x00000200 -#define PHY_ANALOG_RXTX3_ADCPWD_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_RXTX3_ADCPWD_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_MSB 10 -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_LSB 10 -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_MASK 0x00000400 -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_RXTX3_ADCPWD_OVR_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_RXTX3_AGC_CALDAC_MSB 16 -#define PHY_ANALOG_RXTX3_AGC_CALDAC_LSB 11 -#define PHY_ANALOG_RXTX3_AGC_CALDAC_MASK 0x0001f800 -#define PHY_ANALOG_RXTX3_AGC_CALDAC_GET(x) (((x) & 0x0001f800) >> 11) -#define PHY_ANALOG_RXTX3_AGC_CALDAC_SET(x) (((x) << 11) & 0x0001f800) -#define PHY_ANALOG_RXTX3_AGC_CAL_MSB 17 -#define PHY_ANALOG_RXTX3_AGC_CAL_LSB 17 -#define PHY_ANALOG_RXTX3_AGC_CAL_MASK 0x00020000 -#define PHY_ANALOG_RXTX3_AGC_CAL_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_RXTX3_AGC_CAL_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_MSB 18 -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_LSB 18 -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_MASK 0x00040000 -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_RXTX3_AGC_CAL_OVR_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_RXTX3_LOFORCEDON_MSB 19 -#define PHY_ANALOG_RXTX3_LOFORCEDON_LSB 19 -#define PHY_ANALOG_RXTX3_LOFORCEDON_MASK 0x00080000 -#define PHY_ANALOG_RXTX3_LOFORCEDON_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_ANALOG_RXTX3_LOFORCEDON_SET(x) (((x) << 19) & 0x00080000) -#define PHY_ANALOG_RXTX3_CALRESIDUE_MSB 20 -#define PHY_ANALOG_RXTX3_CALRESIDUE_LSB 20 -#define PHY_ANALOG_RXTX3_CALRESIDUE_MASK 0x00100000 -#define PHY_ANALOG_RXTX3_CALRESIDUE_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_RXTX3_CALRESIDUE_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_MSB 21 -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_LSB 21 -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_MASK 0x00200000 -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_RXTX3_CALRESIDUE_OVR_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_RXTX3_CALFC_MSB 22 -#define PHY_ANALOG_RXTX3_CALFC_LSB 22 -#define PHY_ANALOG_RXTX3_CALFC_MASK 0x00400000 -#define PHY_ANALOG_RXTX3_CALFC_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_RXTX3_CALFC_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_RXTX3_CALFC_OVR_MSB 23 -#define PHY_ANALOG_RXTX3_CALFC_OVR_LSB 23 -#define PHY_ANALOG_RXTX3_CALFC_OVR_MASK 0x00800000 -#define PHY_ANALOG_RXTX3_CALFC_OVR_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_RXTX3_CALFC_OVR_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_RXTX3_CALTX_MSB 24 -#define PHY_ANALOG_RXTX3_CALTX_LSB 24 -#define PHY_ANALOG_RXTX3_CALTX_MASK 0x01000000 -#define PHY_ANALOG_RXTX3_CALTX_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_ANALOG_RXTX3_CALTX_SET(x) (((x) << 24) & 0x01000000) -#define PHY_ANALOG_RXTX3_CALTX_OVR_MSB 25 -#define PHY_ANALOG_RXTX3_CALTX_OVR_LSB 25 -#define PHY_ANALOG_RXTX3_CALTX_OVR_MASK 0x02000000 -#define PHY_ANALOG_RXTX3_CALTX_OVR_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_ANALOG_RXTX3_CALTX_OVR_SET(x) (((x) << 25) & 0x02000000) -#define PHY_ANALOG_RXTX3_CALTXSHIFT_MSB 26 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_LSB 26 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_MASK 0x04000000 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_RXTX3_CALTXSHIFT_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_MSB 27 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_LSB 27 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_MASK 0x08000000 -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_RXTX3_CALTXSHIFT_OVR_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_RXTX3_CALPA_MSB 28 -#define PHY_ANALOG_RXTX3_CALPA_LSB 28 -#define PHY_ANALOG_RXTX3_CALPA_MASK 0x10000000 -#define PHY_ANALOG_RXTX3_CALPA_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_RXTX3_CALPA_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_RXTX3_CALPA_OVR_MSB 29 -#define PHY_ANALOG_RXTX3_CALPA_OVR_LSB 29 -#define PHY_ANALOG_RXTX3_CALPA_OVR_MASK 0x20000000 -#define PHY_ANALOG_RXTX3_CALPA_OVR_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_RXTX3_CALPA_OVR_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_RXTX3_TURBOADC_MSB 30 -#define PHY_ANALOG_RXTX3_TURBOADC_LSB 30 -#define PHY_ANALOG_RXTX3_TURBOADC_MASK 0x40000000 -#define PHY_ANALOG_RXTX3_TURBOADC_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_RXTX3_TURBOADC_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_RXTX3_TURBOADC_OVR_MSB 31 -#define PHY_ANALOG_RXTX3_TURBOADC_OVR_LSB 31 -#define PHY_ANALOG_RXTX3_TURBOADC_OVR_MASK 0x80000000 -#define PHY_ANALOG_RXTX3_TURBOADC_OVR_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_RXTX3_TURBOADC_OVR_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB1 */ -#define PHY_ANALOG_BB1_ADDRESS 0x00000140 -#define PHY_ANALOG_BB1_OFFSET 0x00000140 -#define PHY_ANALOG_BB1_I2V_CURR2X_MSB 0 -#define PHY_ANALOG_BB1_I2V_CURR2X_LSB 0 -#define PHY_ANALOG_BB1_I2V_CURR2X_MASK 0x00000001 -#define PHY_ANALOG_BB1_I2V_CURR2X_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_BB1_I2V_CURR2X_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_BB1_ENABLE_LOQ_MSB 1 -#define PHY_ANALOG_BB1_ENABLE_LOQ_LSB 1 -#define PHY_ANALOG_BB1_ENABLE_LOQ_MASK 0x00000002 -#define PHY_ANALOG_BB1_ENABLE_LOQ_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_BB1_ENABLE_LOQ_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_BB1_FORCE_LOQ_MSB 2 -#define PHY_ANALOG_BB1_FORCE_LOQ_LSB 2 -#define PHY_ANALOG_BB1_FORCE_LOQ_MASK 0x00000004 -#define PHY_ANALOG_BB1_FORCE_LOQ_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_BB1_FORCE_LOQ_SET(x) (((x) << 2) & 0x00000004) -#define PHY_ANALOG_BB1_ENABLE_NOTCH_MSB 3 -#define PHY_ANALOG_BB1_ENABLE_NOTCH_LSB 3 -#define PHY_ANALOG_BB1_ENABLE_NOTCH_MASK 0x00000008 -#define PHY_ANALOG_BB1_ENABLE_NOTCH_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_BB1_ENABLE_NOTCH_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_BB1_FORCE_NOTCH_MSB 4 -#define PHY_ANALOG_BB1_FORCE_NOTCH_LSB 4 -#define PHY_ANALOG_BB1_FORCE_NOTCH_MASK 0x00000010 -#define PHY_ANALOG_BB1_FORCE_NOTCH_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_BB1_FORCE_NOTCH_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_MSB 5 -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_LSB 5 -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_MASK 0x00000020 -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_BB1_ENABLE_BIQUAD_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_BB1_FORCE_BIQUAD_MSB 6 -#define PHY_ANALOG_BB1_FORCE_BIQUAD_LSB 6 -#define PHY_ANALOG_BB1_FORCE_BIQUAD_MASK 0x00000040 -#define PHY_ANALOG_BB1_FORCE_BIQUAD_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_BB1_FORCE_BIQUAD_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_BB1_ENABLE_OSDAC_MSB 7 -#define PHY_ANALOG_BB1_ENABLE_OSDAC_LSB 7 -#define PHY_ANALOG_BB1_ENABLE_OSDAC_MASK 0x00000080 -#define PHY_ANALOG_BB1_ENABLE_OSDAC_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_BB1_ENABLE_OSDAC_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_BB1_FORCE_OSDAC_MSB 8 -#define PHY_ANALOG_BB1_FORCE_OSDAC_LSB 8 -#define PHY_ANALOG_BB1_FORCE_OSDAC_MASK 0x00000100 -#define PHY_ANALOG_BB1_FORCE_OSDAC_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_BB1_FORCE_OSDAC_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_BB1_ENABLE_V2I_MSB 9 -#define PHY_ANALOG_BB1_ENABLE_V2I_LSB 9 -#define PHY_ANALOG_BB1_ENABLE_V2I_MASK 0x00000200 -#define PHY_ANALOG_BB1_ENABLE_V2I_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_BB1_ENABLE_V2I_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_BB1_FORCE_V2I_MSB 10 -#define PHY_ANALOG_BB1_FORCE_V2I_LSB 10 -#define PHY_ANALOG_BB1_FORCE_V2I_MASK 0x00000400 -#define PHY_ANALOG_BB1_FORCE_V2I_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_BB1_FORCE_V2I_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_BB1_ENABLE_I2V_MSB 11 -#define PHY_ANALOG_BB1_ENABLE_I2V_LSB 11 -#define PHY_ANALOG_BB1_ENABLE_I2V_MASK 0x00000800 -#define PHY_ANALOG_BB1_ENABLE_I2V_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_BB1_ENABLE_I2V_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_BB1_FORCE_I2V_MSB 12 -#define PHY_ANALOG_BB1_FORCE_I2V_LSB 12 -#define PHY_ANALOG_BB1_FORCE_I2V_MASK 0x00001000 -#define PHY_ANALOG_BB1_FORCE_I2V_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_BB1_FORCE_I2V_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_BB1_CMSEL_MSB 15 -#define PHY_ANALOG_BB1_CMSEL_LSB 13 -#define PHY_ANALOG_BB1_CMSEL_MASK 0x0000e000 -#define PHY_ANALOG_BB1_CMSEL_GET(x) (((x) & 0x0000e000) >> 13) -#define PHY_ANALOG_BB1_CMSEL_SET(x) (((x) << 13) & 0x0000e000) -#define PHY_ANALOG_BB1_ATBSEL_MSB 17 -#define PHY_ANALOG_BB1_ATBSEL_LSB 16 -#define PHY_ANALOG_BB1_ATBSEL_MASK 0x00030000 -#define PHY_ANALOG_BB1_ATBSEL_GET(x) (((x) & 0x00030000) >> 16) -#define PHY_ANALOG_BB1_ATBSEL_SET(x) (((x) << 16) & 0x00030000) -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_MSB 18 -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_LSB 18 -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_MASK 0x00040000 -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_BB1_PD_OSDAC_CALTX_CALPA_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_MSB 23 -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_LSB 19 -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_MASK 0x00f80000 -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_GET(x) (((x) & 0x00f80000) >> 19) -#define PHY_ANALOG_BB1_OFSTCORRI2VQ_SET(x) (((x) << 19) & 0x00f80000) -#define PHY_ANALOG_BB1_OFSTCORRI2VI_MSB 28 -#define PHY_ANALOG_BB1_OFSTCORRI2VI_LSB 24 -#define PHY_ANALOG_BB1_OFSTCORRI2VI_MASK 0x1f000000 -#define PHY_ANALOG_BB1_OFSTCORRI2VI_GET(x) (((x) & 0x1f000000) >> 24) -#define PHY_ANALOG_BB1_OFSTCORRI2VI_SET(x) (((x) << 24) & 0x1f000000) -#define PHY_ANALOG_BB1_LOCALOFFSET_MSB 29 -#define PHY_ANALOG_BB1_LOCALOFFSET_LSB 29 -#define PHY_ANALOG_BB1_LOCALOFFSET_MASK 0x20000000 -#define PHY_ANALOG_BB1_LOCALOFFSET_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_BB1_LOCALOFFSET_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_BB1_RANGE_OSDAC_MSB 31 -#define PHY_ANALOG_BB1_RANGE_OSDAC_LSB 30 -#define PHY_ANALOG_BB1_RANGE_OSDAC_MASK 0xc0000000 -#define PHY_ANALOG_BB1_RANGE_OSDAC_GET(x) (((x) & 0xc0000000) >> 30) -#define PHY_ANALOG_BB1_RANGE_OSDAC_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for BB2 */ -#define PHY_ANALOG_BB2_ADDRESS 0x00000144 -#define PHY_ANALOG_BB2_OFFSET 0x00000144 -#define PHY_ANALOG_BB2_SPARE_MSB 3 -#define PHY_ANALOG_BB2_SPARE_LSB 0 -#define PHY_ANALOG_BB2_SPARE_MASK 0x0000000f -#define PHY_ANALOG_BB2_SPARE_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_BB2_SPARE_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_ANALOG_BB2_MXR_HIGHGAINMASK_MSB 7 -#define PHY_ANALOG_BB2_MXR_HIGHGAINMASK_LSB 4 -#define PHY_ANALOG_BB2_MXR_HIGHGAINMASK_MASK 0x000000f0 -#define PHY_ANALOG_BB2_MXR_HIGHGAINMASK_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_BB2_MXR_HIGHGAINMASK_SET(x) (((x) << 4) & 0x000000f0) -#define PHY_ANALOG_BB2_SEL_TEST_MSB 9 -#define PHY_ANALOG_BB2_SEL_TEST_LSB 8 -#define PHY_ANALOG_BB2_SEL_TEST_MASK 0x00000300 -#define PHY_ANALOG_BB2_SEL_TEST_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_ANALOG_BB2_SEL_TEST_SET(x) (((x) << 8) & 0x00000300) -#define PHY_ANALOG_BB2_RCFILTER_CAP_MSB 14 -#define PHY_ANALOG_BB2_RCFILTER_CAP_LSB 10 -#define PHY_ANALOG_BB2_RCFILTER_CAP_MASK 0x00007c00 -#define PHY_ANALOG_BB2_RCFILTER_CAP_GET(x) (((x) & 0x00007c00) >> 10) -#define PHY_ANALOG_BB2_RCFILTER_CAP_SET(x) (((x) << 10) & 0x00007c00) -#define PHY_ANALOG_BB2_OVERRIDE_RCFILTER_CAP_MSB 15 -#define PHY_ANALOG_BB2_OVERRIDE_RCFILTER_CAP_LSB 15 -#define PHY_ANALOG_BB2_OVERRIDE_RCFILTER_CAP_MASK 0x00008000 -#define PHY_ANALOG_BB2_OVERRIDE_RCFILTER_CAP_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_BB2_OVERRIDE_RCFILTER_CAP_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_BB2_FNOTCH_MSB 19 -#define PHY_ANALOG_BB2_FNOTCH_LSB 16 -#define PHY_ANALOG_BB2_FNOTCH_MASK 0x000f0000 -#define PHY_ANALOG_BB2_FNOTCH_GET(x) (((x) & 0x000f0000) >> 16) -#define PHY_ANALOG_BB2_FNOTCH_SET(x) (((x) << 16) & 0x000f0000) -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_MSB 20 -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_LSB 20 -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_MASK 0x00100000 -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_BB2_OVERRIDE_FNOTCH_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_BB2_FILTERFC_MSB 25 -#define PHY_ANALOG_BB2_FILTERFC_LSB 21 -#define PHY_ANALOG_BB2_FILTERFC_MASK 0x03e00000 -#define PHY_ANALOG_BB2_FILTERFC_GET(x) (((x) & 0x03e00000) >> 21) -#define PHY_ANALOG_BB2_FILTERFC_SET(x) (((x) << 21) & 0x03e00000) -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_MSB 26 -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_LSB 26 -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_MASK 0x04000000 -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_BB2_OVERRIDE_FILTERFC_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_MSB 27 -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_LSB 27 -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_MASK 0x08000000 -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_BB2_I2V2RXOUT_EN_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_MSB 28 -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_LSB 28 -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_MASK 0x10000000 -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_BB2_BQ2RXOUT_EN_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_BB2_RXIN2I2V_EN_MSB 29 -#define PHY_ANALOG_BB2_RXIN2I2V_EN_LSB 29 -#define PHY_ANALOG_BB2_RXIN2I2V_EN_MASK 0x20000000 -#define PHY_ANALOG_BB2_RXIN2I2V_EN_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_BB2_RXIN2I2V_EN_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_BB2_RXIN2BQ_EN_MSB 30 -#define PHY_ANALOG_BB2_RXIN2BQ_EN_LSB 30 -#define PHY_ANALOG_BB2_RXIN2BQ_EN_MASK 0x40000000 -#define PHY_ANALOG_BB2_RXIN2BQ_EN_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_BB2_RXIN2BQ_EN_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_MSB 31 -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_LSB 31 -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_MASK 0x80000000 -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_BB2_SWITCH_OVERRIDE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for BB3 */ -#define PHY_ANALOG_BB3_ADDRESS 0x00000148 -#define PHY_ANALOG_BB3_OFFSET 0x00000148 -#define PHY_ANALOG_BB3_SPARE_MSB 7 -#define PHY_ANALOG_BB3_SPARE_LSB 0 -#define PHY_ANALOG_BB3_SPARE_MASK 0x000000ff -#define PHY_ANALOG_BB3_SPARE_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_ANALOG_BB3_SPARE_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_ANALOG_BB3_SEL_OFST_READBK_MSB 9 -#define PHY_ANALOG_BB3_SEL_OFST_READBK_LSB 8 -#define PHY_ANALOG_BB3_SEL_OFST_READBK_MASK 0x00000300 -#define PHY_ANALOG_BB3_SEL_OFST_READBK_GET(x) (((x) & 0x00000300) >> 8) -#define PHY_ANALOG_BB3_SEL_OFST_READBK_SET(x) (((x) << 8) & 0x00000300) -#define PHY_ANALOG_BB3_OVERRIDE_RXONLY_FILTERFC_MSB 10 -#define PHY_ANALOG_BB3_OVERRIDE_RXONLY_FILTERFC_LSB 10 -#define PHY_ANALOG_BB3_OVERRIDE_RXONLY_FILTERFC_MASK 0x00000400 -#define PHY_ANALOG_BB3_OVERRIDE_RXONLY_FILTERFC_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_BB3_OVERRIDE_RXONLY_FILTERFC_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_BB3_RXONLY_FILTERFC_MSB 15 -#define PHY_ANALOG_BB3_RXONLY_FILTERFC_LSB 11 -#define PHY_ANALOG_BB3_RXONLY_FILTERFC_MASK 0x0000f800 -#define PHY_ANALOG_BB3_RXONLY_FILTERFC_GET(x) (((x) & 0x0000f800) >> 11) -#define PHY_ANALOG_BB3_RXONLY_FILTERFC_SET(x) (((x) << 11) & 0x0000f800) -#define PHY_ANALOG_BB3_FILTERFC_MSB 20 -#define PHY_ANALOG_BB3_FILTERFC_LSB 16 -#define PHY_ANALOG_BB3_FILTERFC_MASK 0x001f0000 -#define PHY_ANALOG_BB3_FILTERFC_GET(x) (((x) & 0x001f0000) >> 16) -#define PHY_ANALOG_BB3_OFSTCORRI2VQ_MSB 25 -#define PHY_ANALOG_BB3_OFSTCORRI2VQ_LSB 21 -#define PHY_ANALOG_BB3_OFSTCORRI2VQ_MASK 0x03e00000 -#define PHY_ANALOG_BB3_OFSTCORRI2VQ_GET(x) (((x) & 0x03e00000) >> 21) -#define PHY_ANALOG_BB3_OFSTCORRI2VI_MSB 30 -#define PHY_ANALOG_BB3_OFSTCORRI2VI_LSB 26 -#define PHY_ANALOG_BB3_OFSTCORRI2VI_MASK 0x7c000000 -#define PHY_ANALOG_BB3_OFSTCORRI2VI_GET(x) (((x) & 0x7c000000) >> 26) -#define PHY_ANALOG_BB3_EN_TXBBCONSTCUR_MSB 31 -#define PHY_ANALOG_BB3_EN_TXBBCONSTCUR_LSB 31 -#define PHY_ANALOG_BB3_EN_TXBBCONSTCUR_MASK 0x80000000 -#define PHY_ANALOG_BB3_EN_TXBBCONSTCUR_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_BB3_EN_TXBBCONSTCUR_SET(x) (((x) << 31) & 0x80000000) - -/* macros for PLLCLKMODA */ -#define PHY_ANALOG_PLLCLKMODA_ADDRESS 0x00000280 -#define PHY_ANALOG_PLLCLKMODA_OFFSET 0x00000280 -#define PHY_ANALOG_PLLCLKMODA_PWD_PLLSDM_MSB 0 -#define PHY_ANALOG_PLLCLKMODA_PWD_PLLSDM_LSB 0 -#define PHY_ANALOG_PLLCLKMODA_PWD_PLLSDM_MASK 0x00000001 -#define PHY_ANALOG_PLLCLKMODA_PWD_PLLSDM_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_PLLCLKMODA_PWD_PLLSDM_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_PLLCLKMODA_PWDPLL_MSB 1 -#define PHY_ANALOG_PLLCLKMODA_PWDPLL_LSB 1 -#define PHY_ANALOG_PLLCLKMODA_PWDPLL_MASK 0x00000002 -#define PHY_ANALOG_PLLCLKMODA_PWDPLL_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_PLLCLKMODA_PWDPLL_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_PLLCLKMODA_PLLFRAC_MSB 16 -#define PHY_ANALOG_PLLCLKMODA_PLLFRAC_LSB 2 -#define PHY_ANALOG_PLLCLKMODA_PLLFRAC_MASK 0x0001fffc -#define PHY_ANALOG_PLLCLKMODA_PLLFRAC_GET(x) (((x) & 0x0001fffc) >> 2) -#define PHY_ANALOG_PLLCLKMODA_PLLFRAC_SET(x) (((x) << 2) & 0x0001fffc) -#define PHY_ANALOG_PLLCLKMODA_REFDIV_MSB 20 -#define PHY_ANALOG_PLLCLKMODA_REFDIV_LSB 17 -#define PHY_ANALOG_PLLCLKMODA_REFDIV_MASK 0x001e0000 -#define PHY_ANALOG_PLLCLKMODA_REFDIV_GET(x) (((x) & 0x001e0000) >> 17) -#define PHY_ANALOG_PLLCLKMODA_REFDIV_SET(x) (((x) << 17) & 0x001e0000) -#define PHY_ANALOG_PLLCLKMODA_DIV_MSB 30 -#define PHY_ANALOG_PLLCLKMODA_DIV_LSB 21 -#define PHY_ANALOG_PLLCLKMODA_DIV_MASK 0x7fe00000 -#define PHY_ANALOG_PLLCLKMODA_DIV_GET(x) (((x) & 0x7fe00000) >> 21) -#define PHY_ANALOG_PLLCLKMODA_DIV_SET(x) (((x) << 21) & 0x7fe00000) -#define PHY_ANALOG_PLLCLKMODA_LOCAL_PLL_MSB 31 -#define PHY_ANALOG_PLLCLKMODA_LOCAL_PLL_LSB 31 -#define PHY_ANALOG_PLLCLKMODA_LOCAL_PLL_MASK 0x80000000 -#define PHY_ANALOG_PLLCLKMODA_LOCAL_PLL_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_PLLCLKMODA_LOCAL_PLL_SET(x) (((x) << 31) & 0x80000000) - -/* macros for PLLCLKMODA2 */ -#define PHY_ANALOG_PLLCLKMODA2_ADDRESS 0x00000284 -#define PHY_ANALOG_PLLCLKMODA2_OFFSET 0x00000284 -#define PHY_ANALOG_PLLCLKMODA2_SPARE_MSB 3 -#define PHY_ANALOG_PLLCLKMODA2_SPARE_LSB 0 -#define PHY_ANALOG_PLLCLKMODA2_SPARE_MASK 0x0000000f -#define PHY_ANALOG_PLLCLKMODA2_SPARE_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_PLLCLKMODA2_SPARE_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_ANALOG_PLLCLKMODA2_DACPWD_MSB 4 -#define PHY_ANALOG_PLLCLKMODA2_DACPWD_LSB 4 -#define PHY_ANALOG_PLLCLKMODA2_DACPWD_MASK 0x00000010 -#define PHY_ANALOG_PLLCLKMODA2_DACPWD_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_PLLCLKMODA2_DACPWD_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_PLLCLKMODA2_ADCPWD_MSB 5 -#define PHY_ANALOG_PLLCLKMODA2_ADCPWD_LSB 5 -#define PHY_ANALOG_PLLCLKMODA2_ADCPWD_MASK 0x00000020 -#define PHY_ANALOG_PLLCLKMODA2_ADCPWD_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_PLLCLKMODA2_ADCPWD_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_ADDAC_MSB 6 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_ADDAC_LSB 6 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_ADDAC_MASK 0x00000040 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_ADDAC_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_ADDAC_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_PLLCLKMODA2_DAC_CLK_SEL_MSB 8 -#define PHY_ANALOG_PLLCLKMODA2_DAC_CLK_SEL_LSB 7 -#define PHY_ANALOG_PLLCLKMODA2_DAC_CLK_SEL_MASK 0x00000180 -#define PHY_ANALOG_PLLCLKMODA2_DAC_CLK_SEL_GET(x) (((x) & 0x00000180) >> 7) -#define PHY_ANALOG_PLLCLKMODA2_DAC_CLK_SEL_SET(x) (((x) << 7) & 0x00000180) -#define PHY_ANALOG_PLLCLKMODA2_ADC_CLK_SEL_MSB 12 -#define PHY_ANALOG_PLLCLKMODA2_ADC_CLK_SEL_LSB 9 -#define PHY_ANALOG_PLLCLKMODA2_ADC_CLK_SEL_MASK 0x00001e00 -#define PHY_ANALOG_PLLCLKMODA2_ADC_CLK_SEL_GET(x) (((x) & 0x00001e00) >> 9) -#define PHY_ANALOG_PLLCLKMODA2_ADC_CLK_SEL_SET(x) (((x) << 9) & 0x00001e00) -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_CLKMODA_MSB 13 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_CLKMODA_LSB 13 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_CLKMODA_MASK 0x00002000 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_CLKMODA_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_CLKMODA_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_PLLCLKMODA2_PLLBYPASS_MSB 14 -#define PHY_ANALOG_PLLCLKMODA2_PLLBYPASS_LSB 14 -#define PHY_ANALOG_PLLCLKMODA2_PLLBYPASS_MASK 0x00004000 -#define PHY_ANALOG_PLLCLKMODA2_PLLBYPASS_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_PLLCLKMODA2_PLLBYPASS_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_PLLBYPASS_MSB 15 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_PLLBYPASS_LSB 15 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_PLLBYPASS_MASK 0x00008000 -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_PLLBYPASS_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_PLLCLKMODA2_LOCAL_PLLBYPASS_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_PLLCLKMODA2_PLLATB_MSB 17 -#define PHY_ANALOG_PLLCLKMODA2_PLLATB_LSB 16 -#define PHY_ANALOG_PLLCLKMODA2_PLLATB_MASK 0x00030000 -#define PHY_ANALOG_PLLCLKMODA2_PLLATB_GET(x) (((x) & 0x00030000) >> 16) -#define PHY_ANALOG_PLLCLKMODA2_PLLATB_SET(x) (((x) << 16) & 0x00030000) -#define PHY_ANALOG_PLLCLKMODA2_PLL_SVREG_MSB 18 -#define PHY_ANALOG_PLLCLKMODA2_PLL_SVREG_LSB 18 -#define PHY_ANALOG_PLLCLKMODA2_PLL_SVREG_MASK 0x00040000 -#define PHY_ANALOG_PLLCLKMODA2_PLL_SVREG_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_PLLCLKMODA2_PLL_SVREG_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_PLLCLKMODA2_HI_FREQ_EN_MSB 19 -#define PHY_ANALOG_PLLCLKMODA2_HI_FREQ_EN_LSB 19 -#define PHY_ANALOG_PLLCLKMODA2_HI_FREQ_EN_MASK 0x00080000 -#define PHY_ANALOG_PLLCLKMODA2_HI_FREQ_EN_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_ANALOG_PLLCLKMODA2_HI_FREQ_EN_SET(x) (((x) << 19) & 0x00080000) -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_INT_L_MSB 20 -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_INT_L_LSB 20 -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_INT_L_MASK 0x00100000 -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_INT_L_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_INT_L_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_OVR_MSB 21 -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_OVR_LSB 21 -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_OVR_MASK 0x00200000 -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_OVR_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_PLLCLKMODA2_RST_WARM_OVR_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_PLLCLKMODA2_PLL_KVCO_MSB 23 -#define PHY_ANALOG_PLLCLKMODA2_PLL_KVCO_LSB 22 -#define PHY_ANALOG_PLLCLKMODA2_PLL_KVCO_MASK 0x00c00000 -#define PHY_ANALOG_PLLCLKMODA2_PLL_KVCO_GET(x) (((x) & 0x00c00000) >> 22) -#define PHY_ANALOG_PLLCLKMODA2_PLL_KVCO_SET(x) (((x) << 22) & 0x00c00000) -#define PHY_ANALOG_PLLCLKMODA2_PLLICP_MSB 26 -#define PHY_ANALOG_PLLCLKMODA2_PLLICP_LSB 24 -#define PHY_ANALOG_PLLCLKMODA2_PLLICP_MASK 0x07000000 -#define PHY_ANALOG_PLLCLKMODA2_PLLICP_GET(x) (((x) & 0x07000000) >> 24) -#define PHY_ANALOG_PLLCLKMODA2_PLLICP_SET(x) (((x) << 24) & 0x07000000) -#define PHY_ANALOG_PLLCLKMODA2_PLLFILTER_MSB 31 -#define PHY_ANALOG_PLLCLKMODA2_PLLFILTER_LSB 27 -#define PHY_ANALOG_PLLCLKMODA2_PLLFILTER_MASK 0xf8000000 -#define PHY_ANALOG_PLLCLKMODA2_PLLFILTER_GET(x) (((x) & 0xf8000000) >> 27) -#define PHY_ANALOG_PLLCLKMODA2_PLLFILTER_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for TOP */ -#define PHY_ANALOG_TOP_ADDRESS 0x00000288 -#define PHY_ANALOG_TOP_OFFSET 0x00000288 -#define PHY_ANALOG_TOP_SPARE_MSB 2 -#define PHY_ANALOG_TOP_SPARE_LSB 0 -#define PHY_ANALOG_TOP_SPARE_MASK 0x00000007 -#define PHY_ANALOG_TOP_SPARE_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_TOP_SPARE_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_TOP_PWDBIAS_MSB 3 -#define PHY_ANALOG_TOP_PWDBIAS_LSB 3 -#define PHY_ANALOG_TOP_PWDBIAS_MASK 0x00000008 -#define PHY_ANALOG_TOP_PWDBIAS_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_TOP_PWDBIAS_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_TOP_FLIP_XPABIAS_MSB 4 -#define PHY_ANALOG_TOP_FLIP_XPABIAS_LSB 4 -#define PHY_ANALOG_TOP_FLIP_XPABIAS_MASK 0x00000010 -#define PHY_ANALOG_TOP_FLIP_XPABIAS_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_TOP_FLIP_XPABIAS_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_TOP_XPAON2_MSB 5 -#define PHY_ANALOG_TOP_XPAON2_LSB 5 -#define PHY_ANALOG_TOP_XPAON2_MASK 0x00000020 -#define PHY_ANALOG_TOP_XPAON2_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_TOP_XPAON2_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_TOP_XPAON5_MSB 6 -#define PHY_ANALOG_TOP_XPAON5_LSB 6 -#define PHY_ANALOG_TOP_XPAON5_MASK 0x00000040 -#define PHY_ANALOG_TOP_XPAON5_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_TOP_XPAON5_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_TOP_XPASHORT2GND_MSB 7 -#define PHY_ANALOG_TOP_XPASHORT2GND_LSB 7 -#define PHY_ANALOG_TOP_XPASHORT2GND_MASK 0x00000080 -#define PHY_ANALOG_TOP_XPASHORT2GND_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_TOP_XPASHORT2GND_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_TOP_XPABIASLVL_MSB 11 -#define PHY_ANALOG_TOP_XPABIASLVL_LSB 8 -#define PHY_ANALOG_TOP_XPABIASLVL_MASK 0x00000f00 -#define PHY_ANALOG_TOP_XPABIASLVL_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_TOP_XPABIASLVL_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_TOP_XPABIAS_EN_MSB 12 -#define PHY_ANALOG_TOP_XPABIAS_EN_LSB 12 -#define PHY_ANALOG_TOP_XPABIAS_EN_MASK 0x00001000 -#define PHY_ANALOG_TOP_XPABIAS_EN_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_TOP_XPABIAS_EN_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_TOP_ATBSELECT_MSB 13 -#define PHY_ANALOG_TOP_ATBSELECT_LSB 13 -#define PHY_ANALOG_TOP_ATBSELECT_MASK 0x00002000 -#define PHY_ANALOG_TOP_ATBSELECT_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_TOP_ATBSELECT_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_TOP_LOCAL_XPA_MSB 14 -#define PHY_ANALOG_TOP_LOCAL_XPA_LSB 14 -#define PHY_ANALOG_TOP_LOCAL_XPA_MASK 0x00004000 -#define PHY_ANALOG_TOP_LOCAL_XPA_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_TOP_LOCAL_XPA_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_TOP_XPABIAS_BYPASS_MSB 15 -#define PHY_ANALOG_TOP_XPABIAS_BYPASS_LSB 15 -#define PHY_ANALOG_TOP_XPABIAS_BYPASS_MASK 0x00008000 -#define PHY_ANALOG_TOP_XPABIAS_BYPASS_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_TOP_XPABIAS_BYPASS_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_TOP_TEST_PADQ_EN_MSB 16 -#define PHY_ANALOG_TOP_TEST_PADQ_EN_LSB 16 -#define PHY_ANALOG_TOP_TEST_PADQ_EN_MASK 0x00010000 -#define PHY_ANALOG_TOP_TEST_PADQ_EN_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_TOP_TEST_PADQ_EN_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_TOP_TEST_PADI_EN_MSB 17 -#define PHY_ANALOG_TOP_TEST_PADI_EN_LSB 17 -#define PHY_ANALOG_TOP_TEST_PADI_EN_MASK 0x00020000 -#define PHY_ANALOG_TOP_TEST_PADI_EN_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_TOP_TEST_PADI_EN_SET(x) (((x) << 17) & 0x00020000) -#define PHY_ANALOG_TOP_TESTIQ_RSEL_MSB 18 -#define PHY_ANALOG_TOP_TESTIQ_RSEL_LSB 18 -#define PHY_ANALOG_TOP_TESTIQ_RSEL_MASK 0x00040000 -#define PHY_ANALOG_TOP_TESTIQ_RSEL_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_ANALOG_TOP_TESTIQ_RSEL_SET(x) (((x) << 18) & 0x00040000) -#define PHY_ANALOG_TOP_TESTIQ_BUFEN_MSB 19 -#define PHY_ANALOG_TOP_TESTIQ_BUFEN_LSB 19 -#define PHY_ANALOG_TOP_TESTIQ_BUFEN_MASK 0x00080000 -#define PHY_ANALOG_TOP_TESTIQ_BUFEN_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_ANALOG_TOP_TESTIQ_BUFEN_SET(x) (((x) << 19) & 0x00080000) -#define PHY_ANALOG_TOP_PAD2GND_MSB 20 -#define PHY_ANALOG_TOP_PAD2GND_LSB 20 -#define PHY_ANALOG_TOP_PAD2GND_MASK 0x00100000 -#define PHY_ANALOG_TOP_PAD2GND_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_TOP_PAD2GND_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_TOP_INTH2PAD_MSB 21 -#define PHY_ANALOG_TOP_INTH2PAD_LSB 21 -#define PHY_ANALOG_TOP_INTH2PAD_MASK 0x00200000 -#define PHY_ANALOG_TOP_INTH2PAD_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_ANALOG_TOP_INTH2PAD_SET(x) (((x) << 21) & 0x00200000) -#define PHY_ANALOG_TOP_INTH2GND_MSB 22 -#define PHY_ANALOG_TOP_INTH2GND_LSB 22 -#define PHY_ANALOG_TOP_INTH2GND_MASK 0x00400000 -#define PHY_ANALOG_TOP_INTH2GND_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_TOP_INTH2GND_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_TOP_INT2PAD_MSB 23 -#define PHY_ANALOG_TOP_INT2PAD_LSB 23 -#define PHY_ANALOG_TOP_INT2PAD_MASK 0x00800000 -#define PHY_ANALOG_TOP_INT2PAD_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_TOP_INT2PAD_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_TOP_INT2GND_MSB 24 -#define PHY_ANALOG_TOP_INT2GND_LSB 24 -#define PHY_ANALOG_TOP_INT2GND_MASK 0x01000000 -#define PHY_ANALOG_TOP_INT2GND_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_ANALOG_TOP_INT2GND_SET(x) (((x) << 24) & 0x01000000) -#define PHY_ANALOG_TOP_PWDPALCLK_MSB 25 -#define PHY_ANALOG_TOP_PWDPALCLK_LSB 25 -#define PHY_ANALOG_TOP_PWDPALCLK_MASK 0x02000000 -#define PHY_ANALOG_TOP_PWDPALCLK_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_ANALOG_TOP_PWDPALCLK_SET(x) (((x) << 25) & 0x02000000) -#define PHY_ANALOG_TOP_INV_CLK320_ADC_MSB 26 -#define PHY_ANALOG_TOP_INV_CLK320_ADC_LSB 26 -#define PHY_ANALOG_TOP_INV_CLK320_ADC_MASK 0x04000000 -#define PHY_ANALOG_TOP_INV_CLK320_ADC_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_TOP_INV_CLK320_ADC_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_TOP_FLIP_REFCLK40_MSB 27 -#define PHY_ANALOG_TOP_FLIP_REFCLK40_LSB 27 -#define PHY_ANALOG_TOP_FLIP_REFCLK40_MASK 0x08000000 -#define PHY_ANALOG_TOP_FLIP_REFCLK40_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_TOP_FLIP_REFCLK40_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_TOP_FLIP_PLLCLK320_MSB 28 -#define PHY_ANALOG_TOP_FLIP_PLLCLK320_LSB 28 -#define PHY_ANALOG_TOP_FLIP_PLLCLK320_MASK 0x10000000 -#define PHY_ANALOG_TOP_FLIP_PLLCLK320_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_TOP_FLIP_PLLCLK320_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_TOP_FLIP_PLLCLK160_MSB 29 -#define PHY_ANALOG_TOP_FLIP_PLLCLK160_LSB 29 -#define PHY_ANALOG_TOP_FLIP_PLLCLK160_MASK 0x20000000 -#define PHY_ANALOG_TOP_FLIP_PLLCLK160_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_TOP_FLIP_PLLCLK160_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_TOP_CLK_SEL_MSB 31 -#define PHY_ANALOG_TOP_CLK_SEL_LSB 30 -#define PHY_ANALOG_TOP_CLK_SEL_MASK 0xc0000000 -#define PHY_ANALOG_TOP_CLK_SEL_GET(x) (((x) & 0xc0000000) >> 30) -#define PHY_ANALOG_TOP_CLK_SEL_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for THERM */ -#define PHY_ANALOG_THERM_ADDRESS 0x0000028c -#define PHY_ANALOG_THERM_OFFSET 0x0000028c -#define PHY_ANALOG_THERM_LOREG_LVL_MSB 2 -#define PHY_ANALOG_THERM_LOREG_LVL_LSB 0 -#define PHY_ANALOG_THERM_LOREG_LVL_MASK 0x00000007 -#define PHY_ANALOG_THERM_LOREG_LVL_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_ANALOG_THERM_LOREG_LVL_SET(x) (((x) << 0) & 0x00000007) -#define PHY_ANALOG_THERM_RFREG_LVL_MSB 5 -#define PHY_ANALOG_THERM_RFREG_LVL_LSB 3 -#define PHY_ANALOG_THERM_RFREG_LVL_MASK 0x00000038 -#define PHY_ANALOG_THERM_RFREG_LVL_GET(x) (((x) & 0x00000038) >> 3) -#define PHY_ANALOG_THERM_RFREG_LVL_SET(x) (((x) << 3) & 0x00000038) -#define PHY_ANALOG_THERM_SAR_ADC_DONE_MSB 6 -#define PHY_ANALOG_THERM_SAR_ADC_DONE_LSB 6 -#define PHY_ANALOG_THERM_SAR_ADC_DONE_MASK 0x00000040 -#define PHY_ANALOG_THERM_SAR_ADC_DONE_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_THERM_SAR_ADC_OUT_MSB 14 -#define PHY_ANALOG_THERM_SAR_ADC_OUT_LSB 7 -#define PHY_ANALOG_THERM_SAR_ADC_OUT_MASK 0x00007f80 -#define PHY_ANALOG_THERM_SAR_ADC_OUT_GET(x) (((x) & 0x00007f80) >> 7) -#define PHY_ANALOG_THERM_SAR_DACTEST_CODE_MSB 22 -#define PHY_ANALOG_THERM_SAR_DACTEST_CODE_LSB 15 -#define PHY_ANALOG_THERM_SAR_DACTEST_CODE_MASK 0x007f8000 -#define PHY_ANALOG_THERM_SAR_DACTEST_CODE_GET(x) (((x) & 0x007f8000) >> 15) -#define PHY_ANALOG_THERM_SAR_DACTEST_CODE_SET(x) (((x) << 15) & 0x007f8000) -#define PHY_ANALOG_THERM_SAR_DACTEST_EN_MSB 23 -#define PHY_ANALOG_THERM_SAR_DACTEST_EN_LSB 23 -#define PHY_ANALOG_THERM_SAR_DACTEST_EN_MASK 0x00800000 -#define PHY_ANALOG_THERM_SAR_DACTEST_EN_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_THERM_SAR_DACTEST_EN_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_THERM_SAR_ADCCAL_EN_MSB 24 -#define PHY_ANALOG_THERM_SAR_ADCCAL_EN_LSB 24 -#define PHY_ANALOG_THERM_SAR_ADCCAL_EN_MASK 0x01000000 -#define PHY_ANALOG_THERM_SAR_ADCCAL_EN_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_ANALOG_THERM_SAR_ADCCAL_EN_SET(x) (((x) << 24) & 0x01000000) -#define PHY_ANALOG_THERM_THERMSEL_MSB 26 -#define PHY_ANALOG_THERM_THERMSEL_LSB 25 -#define PHY_ANALOG_THERM_THERMSEL_MASK 0x06000000 -#define PHY_ANALOG_THERM_THERMSEL_GET(x) (((x) & 0x06000000) >> 25) -#define PHY_ANALOG_THERM_THERMSEL_SET(x) (((x) << 25) & 0x06000000) -#define PHY_ANALOG_THERM_SAR_SLOW_EN_MSB 27 -#define PHY_ANALOG_THERM_SAR_SLOW_EN_LSB 27 -#define PHY_ANALOG_THERM_SAR_SLOW_EN_MASK 0x08000000 -#define PHY_ANALOG_THERM_SAR_SLOW_EN_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_THERM_SAR_SLOW_EN_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_THERM_THERMSTART_MSB 28 -#define PHY_ANALOG_THERM_THERMSTART_LSB 28 -#define PHY_ANALOG_THERM_THERMSTART_MASK 0x10000000 -#define PHY_ANALOG_THERM_THERMSTART_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_THERM_THERMSTART_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_THERM_SAR_AUTOPWD_EN_MSB 29 -#define PHY_ANALOG_THERM_SAR_AUTOPWD_EN_LSB 29 -#define PHY_ANALOG_THERM_SAR_AUTOPWD_EN_MASK 0x20000000 -#define PHY_ANALOG_THERM_SAR_AUTOPWD_EN_GET(x) (((x) & 0x20000000) >> 29) -#define PHY_ANALOG_THERM_SAR_AUTOPWD_EN_SET(x) (((x) << 29) & 0x20000000) -#define PHY_ANALOG_THERM_THERMON_MSB 30 -#define PHY_ANALOG_THERM_THERMON_LSB 30 -#define PHY_ANALOG_THERM_THERMON_MASK 0x40000000 -#define PHY_ANALOG_THERM_THERMON_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_THERM_THERMON_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_THERM_LOCAL_THERM_MSB 31 -#define PHY_ANALOG_THERM_LOCAL_THERM_LSB 31 -#define PHY_ANALOG_THERM_LOCAL_THERM_MASK 0x80000000 -#define PHY_ANALOG_THERM_LOCAL_THERM_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_THERM_LOCAL_THERM_SET(x) (((x) << 31) & 0x80000000) - -/* macros for XTAL */ -#define PHY_ANALOG_XTAL_ADDRESS 0x00000290 -#define PHY_ANALOG_XTAL_OFFSET 0x00000290 -#define PHY_ANALOG_XTAL_SPARE_MSB 5 -#define PHY_ANALOG_XTAL_SPARE_LSB 0 -#define PHY_ANALOG_XTAL_SPARE_MASK 0x0000003f -#define PHY_ANALOG_XTAL_SPARE_GET(x) (((x) & 0x0000003f) >> 0) -#define PHY_ANALOG_XTAL_SPARE_SET(x) (((x) << 0) & 0x0000003f) -#define PHY_ANALOG_XTAL_XTAL_NOTCXODET_MSB 6 -#define PHY_ANALOG_XTAL_XTAL_NOTCXODET_LSB 6 -#define PHY_ANALOG_XTAL_XTAL_NOTCXODET_MASK 0x00000040 -#define PHY_ANALOG_XTAL_XTAL_NOTCXODET_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_XTAL_XTAL_NOTCXODET_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_XTAL_LOCALBIAS2X_MSB 7 -#define PHY_ANALOG_XTAL_LOCALBIAS2X_LSB 7 -#define PHY_ANALOG_XTAL_LOCALBIAS2X_MASK 0x00000080 -#define PHY_ANALOG_XTAL_LOCALBIAS2X_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_XTAL_LOCALBIAS2X_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_XTAL_LOCAL_XTAL_MSB 8 -#define PHY_ANALOG_XTAL_LOCAL_XTAL_LSB 8 -#define PHY_ANALOG_XTAL_LOCAL_XTAL_MASK 0x00000100 -#define PHY_ANALOG_XTAL_LOCAL_XTAL_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_XTAL_LOCAL_XTAL_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_XTAL_XTAL_PWDCLKIN_MSB 9 -#define PHY_ANALOG_XTAL_XTAL_PWDCLKIN_LSB 9 -#define PHY_ANALOG_XTAL_XTAL_PWDCLKIN_MASK 0x00000200 -#define PHY_ANALOG_XTAL_XTAL_PWDCLKIN_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_XTAL_XTAL_PWDCLKIN_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_XTAL_XTAL_OSCON_MSB 10 -#define PHY_ANALOG_XTAL_XTAL_OSCON_LSB 10 -#define PHY_ANALOG_XTAL_XTAL_OSCON_MASK 0x00000400 -#define PHY_ANALOG_XTAL_XTAL_OSCON_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_XTAL_XTAL_OSCON_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_XTAL_XTAL_PWDCLKD_MSB 11 -#define PHY_ANALOG_XTAL_XTAL_PWDCLKD_LSB 11 -#define PHY_ANALOG_XTAL_XTAL_PWDCLKD_MASK 0x00000800 -#define PHY_ANALOG_XTAL_XTAL_PWDCLKD_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_XTAL_XTAL_PWDCLKD_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_XTAL_XTAL_LOCALBIAS_MSB 12 -#define PHY_ANALOG_XTAL_XTAL_LOCALBIAS_LSB 12 -#define PHY_ANALOG_XTAL_XTAL_LOCALBIAS_MASK 0x00001000 -#define PHY_ANALOG_XTAL_XTAL_LOCALBIAS_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_XTAL_XTAL_LOCALBIAS_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_XTAL_XTAL_SHRTXIN_MSB 13 -#define PHY_ANALOG_XTAL_XTAL_SHRTXIN_LSB 13 -#define PHY_ANALOG_XTAL_XTAL_SHRTXIN_MASK 0x00002000 -#define PHY_ANALOG_XTAL_XTAL_SHRTXIN_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_XTAL_XTAL_SHRTXIN_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_XTAL_XTAL_DRVSTR_MSB 15 -#define PHY_ANALOG_XTAL_XTAL_DRVSTR_LSB 14 -#define PHY_ANALOG_XTAL_XTAL_DRVSTR_MASK 0x0000c000 -#define PHY_ANALOG_XTAL_XTAL_DRVSTR_GET(x) (((x) & 0x0000c000) >> 14) -#define PHY_ANALOG_XTAL_XTAL_DRVSTR_SET(x) (((x) << 14) & 0x0000c000) -#define PHY_ANALOG_XTAL_XTAL_CAPOUTDAC_MSB 22 -#define PHY_ANALOG_XTAL_XTAL_CAPOUTDAC_LSB 16 -#define PHY_ANALOG_XTAL_XTAL_CAPOUTDAC_MASK 0x007f0000 -#define PHY_ANALOG_XTAL_XTAL_CAPOUTDAC_GET(x) (((x) & 0x007f0000) >> 16) -#define PHY_ANALOG_XTAL_XTAL_CAPOUTDAC_SET(x) (((x) << 16) & 0x007f0000) -#define PHY_ANALOG_XTAL_XTAL_CAPINDAC_MSB 29 -#define PHY_ANALOG_XTAL_XTAL_CAPINDAC_LSB 23 -#define PHY_ANALOG_XTAL_XTAL_CAPINDAC_MASK 0x3f800000 -#define PHY_ANALOG_XTAL_XTAL_CAPINDAC_GET(x) (((x) & 0x3f800000) >> 23) -#define PHY_ANALOG_XTAL_XTAL_CAPINDAC_SET(x) (((x) << 23) & 0x3f800000) -#define PHY_ANALOG_XTAL_XTAL_BIAS2X_MSB 30 -#define PHY_ANALOG_XTAL_XTAL_BIAS2X_LSB 30 -#define PHY_ANALOG_XTAL_XTAL_BIAS2X_MASK 0x40000000 -#define PHY_ANALOG_XTAL_XTAL_BIAS2X_GET(x) (((x) & 0x40000000) >> 30) -#define PHY_ANALOG_XTAL_XTAL_BIAS2X_SET(x) (((x) << 30) & 0x40000000) -#define PHY_ANALOG_XTAL_TCXODET_MSB 31 -#define PHY_ANALOG_XTAL_TCXODET_LSB 31 -#define PHY_ANALOG_XTAL_TCXODET_MASK 0x80000000 -#define PHY_ANALOG_XTAL_TCXODET_GET(x) (((x) & 0x80000000) >> 31) - -/* macros for rbist_cntrl */ -#define PHY_ANALOG_RBIST_CNTRL_ADDRESS 0x00000380 -#define PHY_ANALOG_RBIST_CNTRL_OFFSET 0x00000380 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_MSB 0 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_LSB 0 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_MASK 0x00000001 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_DC_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_MSB 1 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_LSB 1 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_MASK 0x00000002 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE0_ENABLE_SET(x) (((x) << 1) & 0x00000002) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_MSB 2 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_LSB 2 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_MASK 0x00000004 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_TONE1_ENABLE_SET(x) (((x) << 2) & 0x00000004) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_MSB 3 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_LSB 3 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_MASK 0x00000008 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LFTONE0_ENABLE_SET(x) (((x) << 3) & 0x00000008) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_MSB 4 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_LSB 4 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_MASK 0x00000010 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_I_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_MSB 5 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_LSB 5 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_MASK 0x00000020 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_LINRAMP_ENABLE_Q_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_MSB 6 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_LSB 6 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_MASK 0x00000040 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_I_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_MSB 7 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_LSB 7 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_MASK 0x00000080 -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_RBIST_CNTRL_ATE_TONEGEN_PRBS_ENABLE_Q_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_MSB 8 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_LSB 8 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_MASK 0x00000100 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_WRITE_TO_CANCEL_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_MSB 9 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_LSB 9 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_MASK 0x00000200 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_DC_ENABLE_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_MSB 10 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_LSB 10 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_MASK 0x00000400 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_CORR_ENABLE_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_MSB 11 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_LSB 11 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_MASK 0x00000800 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_ENABLE_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_MSB 12 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_LSB 12 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_MASK 0x00001000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_IQ_ENABLE_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_MSB 13 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_LSB 13 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_MASK 0x00002000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_I2Q2_ENABLE_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_MSB 14 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_LSB 14 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_MASK 0x00004000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_RBIST_CNTRL_ATE_CMAC_POWER_HPF_ENABLE_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_MSB 15 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_LSB 15 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_MASK 0x00008000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_RBIST_CNTRL_ATE_RXDAC_CALIBRATE_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_MSB 16 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_LSB 16 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_MASK 0x00010000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_RBIST_CNTRL_ATE_RBIST_ENABLE_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_MSB 17 -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_LSB 17 -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_MASK 0x00020000 -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_ANALOG_RBIST_CNTRL_ATE_ADC_CLK_INVERT_SET(x) (((x) << 17) & 0x00020000) - -/* macros for tx_dc_offset */ -#define PHY_ANALOG_TX_DC_OFFSET_ADDRESS 0x00000384 -#define PHY_ANALOG_TX_DC_OFFSET_OFFSET 0x00000384 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_MSB 10 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_LSB 0 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_MASK 0x000007ff -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_GET(x) (((x) & 0x000007ff) >> 0) -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_I_SET(x) (((x) << 0) & 0x000007ff) -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_MSB 26 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_LSB 16 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_MASK 0x07ff0000 -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_GET(x) (((x) & 0x07ff0000) >> 16) -#define PHY_ANALOG_TX_DC_OFFSET_ATE_TONEGEN_DC_Q_SET(x) (((x) << 16) & 0x07ff0000) - -/* macros for tx_tonegen0 */ -#define PHY_ANALOG_TX_TONEGEN0_ADDRESS 0x00000388 -#define PHY_ANALOG_TX_TONEGEN0_OFFSET 0x00000388 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_MSB 6 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_LSB 0 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_MASK 0x0000007f -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_FREQ_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_MSB 11 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_LSB 8 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_MASK 0x00000f00 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_EXP_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_MSB 23 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_LSB 16 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_MASK 0x00ff0000 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_A_MAN_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_MSB 30 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_LSB 24 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_MASK 0x7f000000 -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_ANALOG_TX_TONEGEN0_ATE_TONEGEN_TONE_TAU_K_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for tx_tonegen1 */ -#define PHY_ANALOG_TX_TONEGEN1_ADDRESS 0x0000038c -#define PHY_ANALOG_TX_TONEGEN1_OFFSET 0x0000038c -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_MSB 6 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_LSB 0 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_MASK 0x0000007f -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_FREQ_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_MSB 11 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_LSB 8 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_MASK 0x00000f00 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_EXP_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_MSB 23 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_LSB 16 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_MASK 0x00ff0000 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_A_MAN_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_MSB 30 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_LSB 24 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_MASK 0x7f000000 -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_ANALOG_TX_TONEGEN1_ATE_TONEGEN_TONE_TAU_K_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for tx_lftonegen0 */ -#define PHY_ANALOG_TX_LFTONEGEN0_ADDRESS 0x00000390 -#define PHY_ANALOG_TX_LFTONEGEN0_OFFSET 0x00000390 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_MSB 6 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_LSB 0 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_MASK 0x0000007f -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_FREQ_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_MSB 11 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_LSB 8 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_MASK 0x00000f00 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_GET(x) (((x) & 0x00000f00) >> 8) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_EXP_SET(x) (((x) << 8) & 0x00000f00) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_MSB 23 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_LSB 16 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_MASK 0x00ff0000 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_GET(x) (((x) & 0x00ff0000) >> 16) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_A_MAN_SET(x) (((x) << 16) & 0x00ff0000) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_MSB 30 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_LSB 24 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_MASK 0x7f000000 -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_GET(x) (((x) & 0x7f000000) >> 24) -#define PHY_ANALOG_TX_LFTONEGEN0_ATE_TONEGEN_TONE_TAU_K_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for tx_linear_ramp_i */ -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ADDRESS 0x00000394 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_OFFSET 0x00000394 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_MSB 10 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_LSB 0 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_MASK 0x000007ff -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_GET(x) (((x) & 0x000007ff) >> 0) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_INIT_SET(x) (((x) << 0) & 0x000007ff) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_MSB 21 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_LSB 12 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_MASK 0x003ff000 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_GET(x) (((x) & 0x003ff000) >> 12) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_DWELL_SET(x) (((x) << 12) & 0x003ff000) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_MSB 29 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_LSB 24 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_MASK 0x3f000000 -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_ANALOG_TX_LINEAR_RAMP_I_ATE_TONEGEN_LINRAMP_STEP_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for tx_linear_ramp_q */ -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ADDRESS 0x00000398 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_OFFSET 0x00000398 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_MSB 10 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_LSB 0 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_MASK 0x000007ff -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_GET(x) (((x) & 0x000007ff) >> 0) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_INIT_SET(x) (((x) << 0) & 0x000007ff) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_MSB 21 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_LSB 12 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_MASK 0x003ff000 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_GET(x) (((x) & 0x003ff000) >> 12) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_DWELL_SET(x) (((x) << 12) & 0x003ff000) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_MSB 29 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_LSB 24 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_MASK 0x3f000000 -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_GET(x) (((x) & 0x3f000000) >> 24) -#define PHY_ANALOG_TX_LINEAR_RAMP_Q_ATE_TONEGEN_LINRAMP_STEP_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for tx_prbs_mag */ -#define PHY_ANALOG_TX_PRBS_MAG_ADDRESS 0x0000039c -#define PHY_ANALOG_TX_PRBS_MAG_OFFSET 0x0000039c -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_MSB 9 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_LSB 0 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_MASK 0x000003ff -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_I_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_MSB 25 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_LSB 16 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_MASK 0x03ff0000 -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_GET(x) (((x) & 0x03ff0000) >> 16) -#define PHY_ANALOG_TX_PRBS_MAG_ATE_TONEGEN_PRBS_MAGNITUDE_Q_SET(x) (((x) << 16) & 0x03ff0000) - -/* macros for tx_prbs_seed_i */ -#define PHY_ANALOG_TX_PRBS_SEED_I_ADDRESS 0x000003a0 -#define PHY_ANALOG_TX_PRBS_SEED_I_OFFSET 0x000003a0 -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_MSB 30 -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_LSB 0 -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_MASK 0x7fffffff -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_GET(x) (((x) & 0x7fffffff) >> 0) -#define PHY_ANALOG_TX_PRBS_SEED_I_ATE_TONEGEN_PRBS_SEED_SET(x) (((x) << 0) & 0x7fffffff) - -/* macros for tx_prbs_seed_q */ -#define PHY_ANALOG_TX_PRBS_SEED_Q_ADDRESS 0x000003a4 -#define PHY_ANALOG_TX_PRBS_SEED_Q_OFFSET 0x000003a4 -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_MSB 30 -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_LSB 0 -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_MASK 0x7fffffff -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_GET(x) (((x) & 0x7fffffff) >> 0) -#define PHY_ANALOG_TX_PRBS_SEED_Q_ATE_TONEGEN_PRBS_SEED_SET(x) (((x) << 0) & 0x7fffffff) - -/* macros for cmac_dc_cancel */ -#define PHY_ANALOG_CMAC_DC_CANCEL_ADDRESS 0x000003a8 -#define PHY_ANALOG_CMAC_DC_CANCEL_OFFSET 0x000003a8 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_MSB 9 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_LSB 0 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_MASK 0x000003ff -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_GET(x) (((x) & 0x000003ff) >> 0) -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_I_SET(x) (((x) << 0) & 0x000003ff) -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_MSB 25 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_LSB 16 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_MASK 0x03ff0000 -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_GET(x) (((x) & 0x03ff0000) >> 16) -#define PHY_ANALOG_CMAC_DC_CANCEL_ATE_CMAC_DC_CANCEL_Q_SET(x) (((x) << 16) & 0x03ff0000) - -/* macros for cmac_dc_offset */ -#define PHY_ANALOG_CMAC_DC_OFFSET_ADDRESS 0x000003ac -#define PHY_ANALOG_CMAC_DC_OFFSET_OFFSET 0x000003ac -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_DC_OFFSET_ATE_CMAC_DC_CYCLES_SET(x) (((x) << 0) & 0x0000000f) - -/* macros for cmac_corr */ -#define PHY_ANALOG_CMAC_CORR_ADDRESS 0x000003b0 -#define PHY_ANALOG_CMAC_CORR_OFFSET 0x000003b0 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_MSB 4 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_MASK 0x0000001f -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_CYCLES_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_MSB 13 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_LSB 8 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_MASK 0x00003f00 -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_CMAC_CORR_ATE_CMAC_CORR_FREQ_SET(x) (((x) << 8) & 0x00003f00) - -/* macros for cmac_power */ -#define PHY_ANALOG_CMAC_POWER_ADDRESS 0x000003b4 -#define PHY_ANALOG_CMAC_POWER_OFFSET 0x000003b4 -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_POWER_ATE_CMAC_POWER_CYCLES_SET(x) (((x) << 0) & 0x0000000f) - -/* macros for cmac_cross_corr */ -#define PHY_ANALOG_CMAC_CROSS_CORR_ADDRESS 0x000003b8 -#define PHY_ANALOG_CMAC_CROSS_CORR_OFFSET 0x000003b8 -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_CROSS_CORR_ATE_CMAC_IQ_CYCLES_SET(x) (((x) << 0) & 0x0000000f) - -/* macros for cmac_i2q2 */ -#define PHY_ANALOG_CMAC_I2Q2_ADDRESS 0x000003bc -#define PHY_ANALOG_CMAC_I2Q2_OFFSET 0x000003bc -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_I2Q2_ATE_CMAC_I2Q2_CYCLES_SET(x) (((x) << 0) & 0x0000000f) - -/* macros for cmac_power_hpf */ -#define PHY_ANALOG_CMAC_POWER_HPF_ADDRESS 0x000003c0 -#define PHY_ANALOG_CMAC_POWER_HPF_OFFSET 0x000003c0 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_MSB 3 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_LSB 0 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_MASK 0x0000000f -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_CYCLES_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_MSB 7 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_LSB 4 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_MASK 0x000000f0 -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_GET(x) (((x) & 0x000000f0) >> 4) -#define PHY_ANALOG_CMAC_POWER_HPF_ATE_CMAC_POWER_HPF_WAIT_SET(x) (((x) << 4) & 0x000000f0) - -/* macros for rxdac_set1 */ -#define PHY_ANALOG_RXDAC_SET1_ADDRESS 0x000003c4 -#define PHY_ANALOG_RXDAC_SET1_OFFSET 0x000003c4 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_MSB 1 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_LSB 0 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_MASK 0x00000003 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_MUX_SET(x) (((x) << 0) & 0x00000003) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_MSB 4 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_LSB 4 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_MASK 0x00000010 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_HI_GAIN_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_MSB 13 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_LSB 8 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_MASK 0x00003f00 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_WAIT_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_MSB 19 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_LSB 16 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_MASK 0x000f0000 -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_GET(x) (((x) & 0x000f0000) >> 16) -#define PHY_ANALOG_RXDAC_SET1_ATE_RXDAC_CAL_MEASURE_TIME_SET(x) (((x) << 16) & 0x000f0000) - -/* macros for rxdac_set2 */ -#define PHY_ANALOG_RXDAC_SET2_ADDRESS 0x000003c8 -#define PHY_ANALOG_RXDAC_SET2_OFFSET 0x000003c8 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_MSB 4 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_LSB 0 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_MASK 0x0000001f -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_HI_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_MSB 12 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_LSB 8 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_MASK 0x00001f00 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_GET(x) (((x) & 0x00001f00) >> 8) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_HI_SET(x) (((x) << 8) & 0x00001f00) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_MSB 20 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_LSB 16 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_MASK 0x001f0000 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_GET(x) (((x) & 0x001f0000) >> 16) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_I_LOW_SET(x) (((x) << 16) & 0x001f0000) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_MSB 28 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_LSB 24 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_MASK 0x1f000000 -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_GET(x) (((x) & 0x1f000000) >> 24) -#define PHY_ANALOG_RXDAC_SET2_ATE_RXDAC_Q_LOW_SET(x) (((x) << 24) & 0x1f000000) - -/* macros for rxdac_long_shift */ -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ADDRESS 0x000003cc -#define PHY_ANALOG_RXDAC_LONG_SHIFT_OFFSET 0x000003cc -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_MSB 4 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_LSB 0 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_MASK 0x0000001f -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_GET(x) (((x) & 0x0000001f) >> 0) -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_I_STATIC_SET(x) (((x) << 0) & 0x0000001f) -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_MSB 12 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_LSB 8 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_MASK 0x00001f00 -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_GET(x) (((x) & 0x00001f00) >> 8) -#define PHY_ANALOG_RXDAC_LONG_SHIFT_ATE_RXDAC_Q_STATIC_SET(x) (((x) << 8) & 0x00001f00) - -/* macros for cmac_results_i */ -#define PHY_ANALOG_CMAC_RESULTS_I_ADDRESS 0x000003d0 -#define PHY_ANALOG_CMAC_RESULTS_I_OFFSET 0x000003d0 -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_MSB 31 -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_LSB 0 -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_MASK 0xffffffff -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_ANALOG_CMAC_RESULTS_I_ATE_CMAC_RESULTS_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for cmac_results_q */ -#define PHY_ANALOG_CMAC_RESULTS_Q_ADDRESS 0x000003d4 -#define PHY_ANALOG_CMAC_RESULTS_Q_OFFSET 0x000003d4 -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_MSB 31 -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_LSB 0 -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_MASK 0xffffffff -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_GET(x) (((x) & 0xffffffff) >> 0) -#define PHY_ANALOG_CMAC_RESULTS_Q_ATE_CMAC_RESULTS_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for PMU1 */ -#define PHY_ANALOG_PMU1_ADDRESS 0x00000740 -#define PHY_ANALOG_PMU1_OFFSET 0x00000740 -#define PHY_ANALOG_PMU1_SPARE_MSB 3 -#define PHY_ANALOG_PMU1_SPARE_LSB 0 -#define PHY_ANALOG_PMU1_SPARE_MASK 0x0000000f -#define PHY_ANALOG_PMU1_SPARE_GET(x) (((x) & 0x0000000f) >> 0) -#define PHY_ANALOG_PMU1_SPARE_SET(x) (((x) << 0) & 0x0000000f) -#define PHY_ANALOG_PMU1_OTP_V25_PWD_MSB 4 -#define PHY_ANALOG_PMU1_OTP_V25_PWD_LSB 4 -#define PHY_ANALOG_PMU1_OTP_V25_PWD_MASK 0x00000010 -#define PHY_ANALOG_PMU1_OTP_V25_PWD_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_ANALOG_PMU1_OTP_V25_PWD_SET(x) (((x) << 4) & 0x00000010) -#define PHY_ANALOG_PMU1_PAREGON_MAN_MSB 5 -#define PHY_ANALOG_PMU1_PAREGON_MAN_LSB 5 -#define PHY_ANALOG_PMU1_PAREGON_MAN_MASK 0x00000020 -#define PHY_ANALOG_PMU1_PAREGON_MAN_GET(x) (((x) & 0x00000020) >> 5) -#define PHY_ANALOG_PMU1_PAREGON_MAN_SET(x) (((x) << 5) & 0x00000020) -#define PHY_ANALOG_PMU1_PAREGON_OVERRIDE_EN_MSB 6 -#define PHY_ANALOG_PMU1_PAREGON_OVERRIDE_EN_LSB 6 -#define PHY_ANALOG_PMU1_PAREGON_OVERRIDE_EN_MASK 0x00000040 -#define PHY_ANALOG_PMU1_PAREGON_OVERRIDE_EN_GET(x) (((x) & 0x00000040) >> 6) -#define PHY_ANALOG_PMU1_PAREGON_OVERRIDE_EN_SET(x) (((x) << 6) & 0x00000040) -#define PHY_ANALOG_PMU1_OTPREGON_MAN_MSB 7 -#define PHY_ANALOG_PMU1_OTPREGON_MAN_LSB 7 -#define PHY_ANALOG_PMU1_OTPREGON_MAN_MASK 0x00000080 -#define PHY_ANALOG_PMU1_OTPREGON_MAN_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_ANALOG_PMU1_OTPREGON_MAN_SET(x) (((x) << 7) & 0x00000080) -#define PHY_ANALOG_PMU1_OTPREGON_OVERRIDE_EN_MSB 8 -#define PHY_ANALOG_PMU1_OTPREGON_OVERRIDE_EN_LSB 8 -#define PHY_ANALOG_PMU1_OTPREGON_OVERRIDE_EN_MASK 0x00000100 -#define PHY_ANALOG_PMU1_OTPREGON_OVERRIDE_EN_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_PMU1_OTPREGON_OVERRIDE_EN_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_PMU1_DREGON_MAN_MSB 9 -#define PHY_ANALOG_PMU1_DREGON_MAN_LSB 9 -#define PHY_ANALOG_PMU1_DREGON_MAN_MASK 0x00000200 -#define PHY_ANALOG_PMU1_DREGON_MAN_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_PMU1_DREGON_MAN_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_PMU1_DREGON_OVERRIDE_EN_MSB 10 -#define PHY_ANALOG_PMU1_DREGON_OVERRIDE_EN_LSB 10 -#define PHY_ANALOG_PMU1_DREGON_OVERRIDE_EN_MASK 0x00000400 -#define PHY_ANALOG_PMU1_DREGON_OVERRIDE_EN_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_PMU1_DREGON_OVERRIDE_EN_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_PMU1_DISCONTMODEEN_MSB 11 -#define PHY_ANALOG_PMU1_DISCONTMODEEN_LSB 11 -#define PHY_ANALOG_PMU1_DISCONTMODEEN_MASK 0x00000800 -#define PHY_ANALOG_PMU1_DISCONTMODEEN_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_PMU1_DISCONTMODEEN_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_PMU1_SWREGDISCONT_OVERRIDE_EN_MSB 12 -#define PHY_ANALOG_PMU1_SWREGDISCONT_OVERRIDE_EN_LSB 12 -#define PHY_ANALOG_PMU1_SWREGDISCONT_OVERRIDE_EN_MASK 0x00001000 -#define PHY_ANALOG_PMU1_SWREGDISCONT_OVERRIDE_EN_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_PMU1_SWREGDISCONT_OVERRIDE_EN_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_PMU1_SWREGON_MAN_MSB 13 -#define PHY_ANALOG_PMU1_SWREGON_MAN_LSB 13 -#define PHY_ANALOG_PMU1_SWREGON_MAN_MASK 0x00002000 -#define PHY_ANALOG_PMU1_SWREGON_MAN_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_PMU1_SWREGON_MAN_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_PMU1_SWREGON_OVERRIDE_EN_MSB 14 -#define PHY_ANALOG_PMU1_SWREGON_OVERRIDE_EN_LSB 14 -#define PHY_ANALOG_PMU1_SWREGON_OVERRIDE_EN_MASK 0x00004000 -#define PHY_ANALOG_PMU1_SWREGON_OVERRIDE_EN_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_PMU1_SWREGON_OVERRIDE_EN_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_MSB 16 -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_LSB 15 -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_MASK 0x00018000 -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_GET(x) (((x) & 0x00018000) >> 15) -#define PHY_ANALOG_PMU1_SWREG_FREQCUR_SET(x) (((x) << 15) & 0x00018000) -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_MSB 19 -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_LSB 17 -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_MASK 0x000e0000 -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_GET(x) (((x) & 0x000e0000) >> 17) -#define PHY_ANALOG_PMU1_SWREG_FREQCAP_SET(x) (((x) << 17) & 0x000e0000) -#define PHY_ANALOG_PMU1_SWREGFREQ_OVERRIDE_EN_MSB 20 -#define PHY_ANALOG_PMU1_SWREGFREQ_OVERRIDE_EN_LSB 20 -#define PHY_ANALOG_PMU1_SWREGFREQ_OVERRIDE_EN_MASK 0x00100000 -#define PHY_ANALOG_PMU1_SWREGFREQ_OVERRIDE_EN_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_ANALOG_PMU1_SWREGFREQ_OVERRIDE_EN_SET(x) (((x) << 20) & 0x00100000) -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_MSB 22 -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_LSB 21 -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_MASK 0x00600000 -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_GET(x) (((x) & 0x00600000) >> 21) -#define PHY_ANALOG_PMU1_SWREG_LVLCTR_SET(x) (((x) << 21) & 0x00600000) -#define PHY_ANALOG_PMU1_SWREGLVL_OVERRIDE_EN_MSB 23 -#define PHY_ANALOG_PMU1_SWREGLVL_OVERRIDE_EN_LSB 23 -#define PHY_ANALOG_PMU1_SWREGLVL_OVERRIDE_EN_MASK 0x00800000 -#define PHY_ANALOG_PMU1_SWREGLVL_OVERRIDE_EN_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_ANALOG_PMU1_SWREGLVL_OVERRIDE_EN_SET(x) (((x) << 23) & 0x00800000) -#define PHY_ANALOG_PMU1_DREG_LVLCTR_MSB 25 -#define PHY_ANALOG_PMU1_DREG_LVLCTR_LSB 24 -#define PHY_ANALOG_PMU1_DREG_LVLCTR_MASK 0x03000000 -#define PHY_ANALOG_PMU1_DREG_LVLCTR_GET(x) (((x) & 0x03000000) >> 24) -#define PHY_ANALOG_PMU1_DREG_LVLCTR_SET(x) (((x) << 24) & 0x03000000) -#define PHY_ANALOG_PMU1_DREGLVL_OVERRIDE_EN_MSB 26 -#define PHY_ANALOG_PMU1_DREGLVL_OVERRIDE_EN_LSB 26 -#define PHY_ANALOG_PMU1_DREGLVL_OVERRIDE_EN_MASK 0x04000000 -#define PHY_ANALOG_PMU1_DREGLVL_OVERRIDE_EN_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_ANALOG_PMU1_DREGLVL_OVERRIDE_EN_SET(x) (((x) << 26) & 0x04000000) -#define PHY_ANALOG_PMU1_PAREG_XPNP_MSB 27 -#define PHY_ANALOG_PMU1_PAREG_XPNP_LSB 27 -#define PHY_ANALOG_PMU1_PAREG_XPNP_MASK 0x08000000 -#define PHY_ANALOG_PMU1_PAREG_XPNP_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_ANALOG_PMU1_PAREG_XPNP_SET(x) (((x) << 27) & 0x08000000) -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_MSB 30 -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_LSB 28 -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_MASK 0x70000000 -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_GET(x) (((x) & 0x70000000) >> 28) -#define PHY_ANALOG_PMU1_PAREG_LVLCTR_SET(x) (((x) << 28) & 0x70000000) -#define PHY_ANALOG_PMU1_PAREGLVL_OVERRIDE_EN_MSB 31 -#define PHY_ANALOG_PMU1_PAREGLVL_OVERRIDE_EN_LSB 31 -#define PHY_ANALOG_PMU1_PAREGLVL_OVERRIDE_EN_MASK 0x80000000 -#define PHY_ANALOG_PMU1_PAREGLVL_OVERRIDE_EN_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_PMU1_PAREGLVL_OVERRIDE_EN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for PMU2 */ -#define PHY_ANALOG_PMU2_ADDRESS 0x00000744 -#define PHY_ANALOG_PMU2_OFFSET 0x00000744 -#define PHY_ANALOG_PMU2_SPARE_MSB 7 -#define PHY_ANALOG_PMU2_SPARE_LSB 0 -#define PHY_ANALOG_PMU2_SPARE_MASK 0x000000ff -#define PHY_ANALOG_PMU2_SPARE_GET(x) (((x) & 0x000000ff) >> 0) -#define PHY_ANALOG_PMU2_SPARE_SET(x) (((x) << 0) & 0x000000ff) -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_MSB 8 -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_LSB 8 -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_MASK 0x00000100 -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_ANALOG_PMU2_VBATT_1_3TOATB_SET(x) (((x) << 8) & 0x00000100) -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_MSB 9 -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_LSB 9 -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_MASK 0x00000200 -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_GET(x) (((x) & 0x00000200) >> 9) -#define PHY_ANALOG_PMU2_VBATT_1_2TOATB_SET(x) (((x) << 9) & 0x00000200) -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_MSB 10 -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_LSB 10 -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_MASK 0x00000400 -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_GET(x) (((x) & 0x00000400) >> 10) -#define PHY_ANALOG_PMU2_VBATT_2_3TOATB_SET(x) (((x) << 10) & 0x00000400) -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_MSB 11 -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_LSB 11 -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_MASK 0x00000800 -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_GET(x) (((x) & 0x00000800) >> 11) -#define PHY_ANALOG_PMU2_PWD_BANDGAP_MAN_SET(x) (((x) << 11) & 0x00000800) -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_MSB 12 -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_LSB 12 -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_MASK 0x00001000 -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_ANALOG_PMU2_PWD_LFO_MAN_SET(x) (((x) << 12) & 0x00001000) -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_MSB 13 -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_LSB 13 -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_MASK 0x00002000 -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_ANALOG_PMU2_VBATT_LT_3P2_SET(x) (((x) << 13) & 0x00002000) -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_MSB 14 -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_LSB 14 -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_MASK 0x00004000 -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_ANALOG_PMU2_VBATT_LT_2P8_SET(x) (((x) << 14) & 0x00004000) -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_MSB 15 -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_LSB 15 -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_MASK 0x00008000 -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_ANALOG_PMU2_VBATT_GT_4P2_SET(x) (((x) << 15) & 0x00008000) -#define PHY_ANALOG_PMU2_PMU_XPNP_OVERRIDE_EN_MSB 16 -#define PHY_ANALOG_PMU2_PMU_XPNP_OVERRIDE_EN_LSB 16 -#define PHY_ANALOG_PMU2_PMU_XPNP_OVERRIDE_EN_MASK 0x00010000 -#define PHY_ANALOG_PMU2_PMU_XPNP_OVERRIDE_EN_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_ANALOG_PMU2_PMU_XPNP_OVERRIDE_EN_SET(x) (((x) << 16) & 0x00010000) -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_MSB 18 -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_LSB 17 -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_MASK 0x00060000 -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_GET(x) (((x) & 0x00060000) >> 17) -#define PHY_ANALOG_PMU2_VBATT_GT_LVLCTR_SET(x) (((x) << 17) & 0x00060000) -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_MSB 19 -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_LSB 19 -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_MASK 0x00080000 -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_ANALOG_PMU2_SWREGVSSL2ATB_SET(x) (((x) << 19) & 0x00080000) -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_MSB 21 -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_LSB 20 -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_MASK 0x00300000 -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_GET(x) (((x) & 0x00300000) >> 20) -#define PHY_ANALOG_PMU2_SWREGVSSL_LVLCTR_SET(x) (((x) << 20) & 0x00300000) -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_MSB 22 -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_LSB 22 -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_MASK 0x00400000 -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_ANALOG_PMU2_SWREGVDDH2ATB_SET(x) (((x) << 22) & 0x00400000) -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_MSB 24 -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_LSB 23 -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_MASK 0x01800000 -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_GET(x) (((x) & 0x01800000) >> 23) -#define PHY_ANALOG_PMU2_SWREGVDDH_LVLCTR_SET(x) (((x) << 23) & 0x01800000) -#define PHY_ANALOG_PMU2_SWREG2ATB_MSB 27 -#define PHY_ANALOG_PMU2_SWREG2ATB_LSB 25 -#define PHY_ANALOG_PMU2_SWREG2ATB_MASK 0x0e000000 -#define PHY_ANALOG_PMU2_SWREG2ATB_GET(x) (((x) & 0x0e000000) >> 25) -#define PHY_ANALOG_PMU2_SWREG2ATB_SET(x) (((x) << 25) & 0x0e000000) -#define PHY_ANALOG_PMU2_OTPREG2ATB_MSB 28 -#define PHY_ANALOG_PMU2_OTPREG2ATB_LSB 28 -#define PHY_ANALOG_PMU2_OTPREG2ATB_MASK 0x10000000 -#define PHY_ANALOG_PMU2_OTPREG2ATB_GET(x) (((x) & 0x10000000) >> 28) -#define PHY_ANALOG_PMU2_OTPREG2ATB_SET(x) (((x) << 28) & 0x10000000) -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_MSB 30 -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_LSB 29 -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_MASK 0x60000000 -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_GET(x) (((x) & 0x60000000) >> 29) -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_SET(x) (((x) << 29) & 0x60000000) -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_MANOVR_EN_MSB 31 -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_MANOVR_EN_LSB 31 -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_MANOVR_EN_MASK 0x80000000 -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_MANOVR_EN_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_ANALOG_PMU2_OTPREG_LVLCTR_MANOVR_EN_SET(x) (((x) << 31) & 0x80000000) - - -#ifndef __ASSEMBLER__ - -typedef struct analog_intf_athr_wlan_reg_reg_s { - volatile unsigned int RXRF_BIAS1; /* 0x0 - 0x4 */ - volatile unsigned int RXRF_BIAS2; /* 0x4 - 0x8 */ - volatile unsigned int RXRF_GAINSTAGES; /* 0x8 - 0xc */ - volatile unsigned int RXRF_AGC; /* 0xc - 0x10 */ - volatile char pad__0[0x30]; /* 0x10 - 0x40 */ - volatile unsigned int TXRF1; /* 0x40 - 0x44 */ - volatile unsigned int TXRF2; /* 0x44 - 0x48 */ - volatile unsigned int TXRF3; /* 0x48 - 0x4c */ - volatile unsigned int TXRF4; /* 0x4c - 0x50 */ - volatile unsigned int TXRF5; /* 0x50 - 0x54 */ - volatile unsigned int TXRF6; /* 0x54 - 0x58 */ - volatile unsigned int TXRF7; /* 0x58 - 0x5c */ - volatile unsigned int TXRF8; /* 0x5c - 0x60 */ - volatile unsigned int TXRF9; /* 0x60 - 0x64 */ - volatile unsigned int TXRF10; /* 0x64 - 0x68 */ - volatile unsigned int TXRF11; /* 0x68 - 0x6c */ - volatile unsigned int TXRF12; /* 0x6c - 0x70 */ - volatile char pad__1[0x10]; /* 0x70 - 0x80 */ - volatile unsigned int SYNTH1; /* 0x80 - 0x84 */ - volatile unsigned int SYNTH2; /* 0x84 - 0x88 */ - volatile unsigned int SYNTH3; /* 0x88 - 0x8c */ - volatile unsigned int SYNTH4; /* 0x8c - 0x90 */ - volatile unsigned int SYNTH5; /* 0x90 - 0x94 */ - volatile unsigned int SYNTH6; /* 0x94 - 0x98 */ - volatile unsigned int SYNTH7; /* 0x98 - 0x9c */ - volatile unsigned int SYNTH8; /* 0x9c - 0xa0 */ - volatile unsigned int SYNTH9; /* 0xa0 - 0xa4 */ - volatile unsigned int SYNTH10; /* 0xa4 - 0xa8 */ - volatile unsigned int SYNTH11; /* 0xa8 - 0xac */ - volatile unsigned int SYNTH12; /* 0xac - 0xb0 */ - volatile unsigned int SYNTH13; /* 0xb0 - 0xb4 */ - volatile unsigned int SYNTH14; /* 0xb4 - 0xb8 */ - volatile char pad__2[0x8]; /* 0xb8 - 0xc0 */ - volatile unsigned int BIAS1; /* 0xc0 - 0xc4 */ - volatile unsigned int BIAS2; /* 0xc4 - 0xc8 */ - volatile unsigned int BIAS3; /* 0xc8 - 0xcc */ - volatile unsigned int BIAS4; /* 0xcc - 0xd0 */ - volatile char pad__3[0x30]; /* 0xd0 - 0x100 */ - volatile unsigned int RXTX1; /* 0x100 - 0x104 */ - volatile unsigned int RXTX2; /* 0x104 - 0x108 */ - volatile unsigned int RXTX3; /* 0x108 - 0x10c */ - volatile char pad__4[0x34]; /* 0x10c - 0x140 */ - volatile unsigned int BB1; /* 0x140 - 0x144 */ - volatile unsigned int BB2; /* 0x144 - 0x148 */ - volatile unsigned int BB3; /* 0x148 - 0x14c */ - volatile char pad__5[0x134]; /* 0x14c - 0x280 */ - volatile unsigned int PLLCLKMODA; /* 0x280 - 0x284 */ - volatile unsigned int PLLCLKMODA2; /* 0x284 - 0x288 */ - volatile unsigned int TOP; /* 0x288 - 0x28c */ - volatile unsigned int THERM; /* 0x28c - 0x290 */ - volatile unsigned int XTAL; /* 0x290 - 0x294 */ - volatile char pad__6[0xec]; /* 0x294 - 0x380 */ - volatile unsigned int rbist_cntrl; /* 0x380 - 0x384 */ - volatile unsigned int tx_dc_offset; /* 0x384 - 0x388 */ - volatile unsigned int tx_tonegen0; /* 0x388 - 0x38c */ - volatile unsigned int tx_tonegen1; /* 0x38c - 0x390 */ - volatile unsigned int tx_lftonegen0; /* 0x390 - 0x394 */ - volatile unsigned int tx_linear_ramp_i; /* 0x394 - 0x398 */ - volatile unsigned int tx_linear_ramp_q; /* 0x398 - 0x39c */ - volatile unsigned int tx_prbs_mag; /* 0x39c - 0x3a0 */ - volatile unsigned int tx_prbs_seed_i; /* 0x3a0 - 0x3a4 */ - volatile unsigned int tx_prbs_seed_q; /* 0x3a4 - 0x3a8 */ - volatile unsigned int cmac_dc_cancel; /* 0x3a8 - 0x3ac */ - volatile unsigned int cmac_dc_offset; /* 0x3ac - 0x3b0 */ - volatile unsigned int cmac_corr; /* 0x3b0 - 0x3b4 */ - volatile unsigned int cmac_power; /* 0x3b4 - 0x3b8 */ - volatile unsigned int cmac_cross_corr; /* 0x3b8 - 0x3bc */ - volatile unsigned int cmac_i2q2; /* 0x3bc - 0x3c0 */ - volatile unsigned int cmac_power_hpf; /* 0x3c0 - 0x3c4 */ - volatile unsigned int rxdac_set1; /* 0x3c4 - 0x3c8 */ - volatile unsigned int rxdac_set2; /* 0x3c8 - 0x3cc */ - volatile unsigned int rxdac_long_shift; /* 0x3cc - 0x3d0 */ - volatile unsigned int cmac_results_i; /* 0x3d0 - 0x3d4 */ - volatile unsigned int cmac_results_q; /* 0x3d4 - 0x3d8 */ - volatile char pad__7[0x368]; /* 0x3d8 - 0x740 */ - volatile unsigned int PMU1; /* 0x740 - 0x744 */ - volatile unsigned int PMU2; /* 0x744 - 0x748 */ -} analog_intf_athr_wlan_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _ANALOG_INTF_ATHR_WLAN_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/analog_intf_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/analog_intf_reg.h deleted file mode 100644 index ab3e163e857f..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/analog_intf_reg.h +++ /dev/null @@ -1,37 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "analog_intf_athr_wlan_reg.h" - - -#ifndef BT_HEADERS - - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/apb_athr_wlan_map.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/apb_athr_wlan_map.h deleted file mode 100644 index 15637c1d0844..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/apb_athr_wlan_map.h +++ /dev/null @@ -1,72 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _APB_ATHR_WLAN_MAP_H_ -#define _APB_ATHR_WLAN_MAP_H_ - -#define RTC_SOC_BASE_ADDRESS 0x00004000 -#define RTC_WMAC_BASE_ADDRESS 0x00005000 -#define MAC_COEX_BASE_ADDRESS 0x00006000 -#define BT_COEX_BASE_ADDRESS 0x00007000 -#define MIT_BASE_ADDRESS 0x00008000 -#define WLAN_UART_BASE_ADDRESS 0x0000c000 -#define WLAN_DBG_UART_BASE_ADDRESS 0x0000d000 -#define WLAN_UMBOX_BASE_ADDRESS 0x0000e000 -#define WLAN_SI_BASE_ADDRESS 0x00010000 -#define WLAN_GPIO_BASE_ADDRESS 0x00014000 -#define WLAN_MBOX_BASE_ADDRESS 0x00018000 -#define WLAN_ANALOG_INTF_BASE_ADDRESS 0x0001c000 -#define WLAN_MAC_BASE_ADDRESS 0x00020000 -#define EFUSE_BASE_ADDRESS 0x00030000 -#define STEREO_BASE_ADDRESS 0x00034000 -#define CKSUM_ACC_BASE_ADDRESS 0x00035000 -#define STEREO_1_BASE_ADDRESS 0x00036000 -#define MMAC_BASE_ADDRESS 0x00038000 -#define FPGA_REG_BASE_ADDRESS 0x00039000 -#define GMAC_INTR_BASE_ADDRESS 0x00040000 -#define GMAC_RGMII_BASE_ADDRESS 0x00040100 -#define GMAC_MDIO_BASE_ADDRESS 0x00040200 -#define GMAC_CHAIN_0_RX_BASE_ADDRESS 0x00040800 -#define GMAC_CHAIN_0_TX_BASE_ADDRESS 0x00040c00 -#define SFMBOX_SDIO2_BASE_ADDRESS 0x00044000 -#define SFMBOX_SPI2_BASE_ADDRESS 0x00048000 -#define SVD_BASE_ADDRESS 0x00050000 -#define USB_INTR_BASE_ADDRESS 0x00054000 -#define USB_CHAIN_0_RX_BASE_ADDRESS 0x00054100 -#define USB_CHAIN_1_RX_BASE_ADDRESS 0x00054200 -#define USB_CHAIN_2_RX_BASE_ADDRESS 0x00054300 -#define USB_CHAIN_3_RX_BASE_ADDRESS 0x00054400 -#define USB_CHAIN_4_RX_BASE_ADDRESS 0x00054500 -#define USB_CHAIN_5_RX_BASE_ADDRESS 0x00054600 -#define USB_CHAIN_0_TX_BASE_ADDRESS 0x00054700 -#define USB_CHAIN_1_TX_BASE_ADDRESS 0x00054800 -#define USB_CHAIN_2_TX_BASE_ADDRESS 0x00054900 -#define USB_CHAIN_3_TX_BASE_ADDRESS 0x00054a00 -#define USB_CHAIN_4_TX_BASE_ADDRESS 0x00054b00 -#define WLAN_UART2_BASE_ADDRESS 0x00054c00 -#define WLAN_RDMA_BASE_ADDRESS 0x00054d00 -#define I2C_SLAVE_BASE_ADDRESS 0x00054e00 -#define MBOX_I2S_BASE_ADDRESS 0x00055000 -#define MBOX_I2S_1_BASE_ADDRESS 0x00056000 - -#endif /* _APB_ATHR_WLAN_MAP_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/apb_map.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/apb_map.h deleted file mode 100644 index d4894c0b12d6..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/apb_map.h +++ /dev/null @@ -1,47 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "apb_athr_wlan_map.h" - - -#ifndef BT_HEADERS - -#define UART_BASE_ADDRESS WLAN_UART_BASE_ADDRESS -#define DBG_UART_BASE_ADDRESS WLAN_DBG_UART_BASE_ADDRESS -#define UMBOX_BASE_ADDRESS WLAN_UMBOX_BASE_ADDRESS -#define SI_BASE_ADDRESS WLAN_SI_BASE_ADDRESS -#define GPIO_BASE_ADDRESS WLAN_GPIO_BASE_ADDRESS -#define MBOX_BASE_ADDRESS WLAN_MBOX_BASE_ADDRESS -#define ANALOG_INTF_BASE_ADDRESS WLAN_ANALOG_INTF_BASE_ADDRESS -#define MAC_BASE_ADDRESS WLAN_MAC_BASE_ADDRESS -#define UART2_BASE_ADDRESS WLAN_UART2_BASE_ADDRESS -#define RDMA_BASE_ADDRESS WLAN_RDMA_BASE_ADDRESS - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/athrI2cSlaveApbCsr.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/athrI2cSlaveApbCsr.h deleted file mode 100644 index 30ada999a274..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/athrI2cSlaveApbCsr.h +++ /dev/null @@ -1,474 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _ATHRI2CSLAVEAPBCSR_REG_H_ -#define _ATHRI2CSLAVEAPBCSR_REG_H_ - - -/* macros for I2cFifoControl */ -#define I2CFIFOCONTROL_ADDRESS 0x00000000 -#define I2CFIFOCONTROL_OFFSET 0x00000000 -#define I2CFIFOCONTROL_I2CFIFORESET_MSB 0 -#define I2CFIFOCONTROL_I2CFIFORESET_LSB 0 -#define I2CFIFOCONTROL_I2CFIFORESET_MASK 0x00000001 -#define I2CFIFOCONTROL_I2CFIFORESET_GET(x) (((x) & 0x00000001) >> 0) -#define I2CFIFOCONTROL_I2CFIFORESET_SET(x) (((x) << 0) & 0x00000001) -#define I2CFIFOCONTROL_I2CFIFOPREFETCH_MSB 1 -#define I2CFIFOCONTROL_I2CFIFOPREFETCH_LSB 1 -#define I2CFIFOCONTROL_I2CFIFOPREFETCH_MASK 0x00000002 -#define I2CFIFOCONTROL_I2CFIFOPREFETCH_GET(x) (((x) & 0x00000002) >> 1) -#define I2CFIFOCONTROL_I2CFIFOPREFETCH_SET(x) (((x) << 1) & 0x00000002) -#define I2CFIFOCONTROL_I2CFIFOREADLENGTH_MSB 4 -#define I2CFIFOCONTROL_I2CFIFOREADLENGTH_LSB 2 -#define I2CFIFOCONTROL_I2CFIFOREADLENGTH_MASK 0x0000001c -#define I2CFIFOCONTROL_I2CFIFOREADLENGTH_GET(x) (((x) & 0x0000001c) >> 2) -#define I2CFIFOCONTROL_I2CFIFOREADLENGTH_SET(x) (((x) << 2) & 0x0000001c) -#define I2CFIFOCONTROL_I2CFIFOREADTHRESHOLD_MSB 14 -#define I2CFIFOCONTROL_I2CFIFOREADTHRESHOLD_LSB 5 -#define I2CFIFOCONTROL_I2CFIFOREADTHRESHOLD_MASK 0x00007fe0 -#define I2CFIFOCONTROL_I2CFIFOREADTHRESHOLD_GET(x) (((x) & 0x00007fe0) >> 5) -#define I2CFIFOCONTROL_I2CFIFOREADTHRESHOLD_SET(x) (((x) << 5) & 0x00007fe0) -#define I2CFIFOCONTROL_I2CFIFOREADSTALL_MSB 15 -#define I2CFIFOCONTROL_I2CFIFOREADSTALL_LSB 15 -#define I2CFIFOCONTROL_I2CFIFOREADSTALL_MASK 0x00008000 -#define I2CFIFOCONTROL_I2CFIFOREADSTALL_GET(x) (((x) & 0x00008000) >> 15) -#define I2CFIFOCONTROL_I2CFIFOREADSTALL_SET(x) (((x) << 15) & 0x00008000) -#define I2CFIFOCONTROL_I2CFIFOWRITELENGTH_MSB 18 -#define I2CFIFOCONTROL_I2CFIFOWRITELENGTH_LSB 16 -#define I2CFIFOCONTROL_I2CFIFOWRITELENGTH_MASK 0x00070000 -#define I2CFIFOCONTROL_I2CFIFOWRITELENGTH_GET(x) (((x) & 0x00070000) >> 16) -#define I2CFIFOCONTROL_I2CFIFOWRITELENGTH_SET(x) (((x) << 16) & 0x00070000) -#define I2CFIFOCONTROL_I2CFIFOWRITETHRESHOLD_MSB 28 -#define I2CFIFOCONTROL_I2CFIFOWRITETHRESHOLD_LSB 19 -#define I2CFIFOCONTROL_I2CFIFOWRITETHRESHOLD_MASK 0x1ff80000 -#define I2CFIFOCONTROL_I2CFIFOWRITETHRESHOLD_GET(x) (((x) & 0x1ff80000) >> 19) -#define I2CFIFOCONTROL_I2CFIFOWRITETHRESHOLD_SET(x) (((x) << 19) & 0x1ff80000) -#define I2CFIFOCONTROL_I2CFIFOWRITESTALL_MSB 29 -#define I2CFIFOCONTROL_I2CFIFOWRITESTALL_LSB 29 -#define I2CFIFOCONTROL_I2CFIFOWRITESTALL_MASK 0x20000000 -#define I2CFIFOCONTROL_I2CFIFOWRITESTALL_GET(x) (((x) & 0x20000000) >> 29) -#define I2CFIFOCONTROL_I2CFIFOWRITESTALL_SET(x) (((x) << 29) & 0x20000000) - -/* macros for I2cFifoReadPtr */ -#define I2CFIFOREADPTR_ADDRESS 0x00000004 -#define I2CFIFOREADPTR_OFFSET 0x00000004 -#define I2CFIFOREADPTR_I2CFIFOREADWRPTR_MSB 9 -#define I2CFIFOREADPTR_I2CFIFOREADWRPTR_LSB 0 -#define I2CFIFOREADPTR_I2CFIFOREADWRPTR_MASK 0x000003ff -#define I2CFIFOREADPTR_I2CFIFOREADWRPTR_GET(x) (((x) & 0x000003ff) >> 0) -#define I2CFIFOREADPTR_I2CFIFOREADRDPTR_MSB 25 -#define I2CFIFOREADPTR_I2CFIFOREADRDPTR_LSB 16 -#define I2CFIFOREADPTR_I2CFIFOREADRDPTR_MASK 0x03ff0000 -#define I2CFIFOREADPTR_I2CFIFOREADRDPTR_GET(x) (((x) & 0x03ff0000) >> 16) - -/* macros for I2cFifoReadUpdate */ -#define I2CFIFOREADUPDATE_ADDRESS 0x00000008 -#define I2CFIFOREADUPDATE_OFFSET 0x00000008 -#define I2CFIFOREADUPDATE_I2CFIFOREADUPDATE_MSB 10 -#define I2CFIFOREADUPDATE_I2CFIFOREADUPDATE_LSB 0 -#define I2CFIFOREADUPDATE_I2CFIFOREADUPDATE_MASK 0x000007ff -#define I2CFIFOREADUPDATE_I2CFIFOREADUPDATE_GET(x) (((x) & 0x000007ff) >> 0) -#define I2CFIFOREADUPDATE_I2CFIFOREADUPDATE_SET(x) (((x) << 0) & 0x000007ff) - -/* macros for I2cFifoReadBaseAddr */ -#define I2CFIFOREADBASEADDR_ADDRESS 0x0000000c -#define I2CFIFOREADBASEADDR_OFFSET 0x0000000c -#define I2CFIFOREADBASEADDR_I2CFIFOREADBASEADDR_MSB 31 -#define I2CFIFOREADBASEADDR_I2CFIFOREADBASEADDR_LSB 0 -#define I2CFIFOREADBASEADDR_I2CFIFOREADBASEADDR_MASK 0xffffffff -#define I2CFIFOREADBASEADDR_I2CFIFOREADBASEADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define I2CFIFOREADBASEADDR_I2CFIFOREADBASEADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for I2cFifoWritePtr */ -#define I2CFIFOWRITEPTR_ADDRESS 0x00000010 -#define I2CFIFOWRITEPTR_OFFSET 0x00000010 -#define I2CFIFOWRITEPTR_I2CFIFOWRITEWRPTR_MSB 9 -#define I2CFIFOWRITEPTR_I2CFIFOWRITEWRPTR_LSB 0 -#define I2CFIFOWRITEPTR_I2CFIFOWRITEWRPTR_MASK 0x000003ff -#define I2CFIFOWRITEPTR_I2CFIFOWRITEWRPTR_GET(x) (((x) & 0x000003ff) >> 0) -#define I2CFIFOWRITEPTR_I2CFIFOWRITERDPTR_MSB 25 -#define I2CFIFOWRITEPTR_I2CFIFOWRITERDPTR_LSB 16 -#define I2CFIFOWRITEPTR_I2CFIFOWRITERDPTR_MASK 0x03ff0000 -#define I2CFIFOWRITEPTR_I2CFIFOWRITERDPTR_GET(x) (((x) & 0x03ff0000) >> 16) - -/* macros for I2cFifoWriteUpdate */ -#define I2CFIFOWRITEUPDATE_ADDRESS 0x00000014 -#define I2CFIFOWRITEUPDATE_OFFSET 0x00000014 -#define I2CFIFOWRITEUPDATE_I2CFIFOWRITEUPDATE_MSB 10 -#define I2CFIFOWRITEUPDATE_I2CFIFOWRITEUPDATE_LSB 0 -#define I2CFIFOWRITEUPDATE_I2CFIFOWRITEUPDATE_MASK 0x000007ff -#define I2CFIFOWRITEUPDATE_I2CFIFOWRITEUPDATE_GET(x) (((x) & 0x000007ff) >> 0) -#define I2CFIFOWRITEUPDATE_I2CFIFOWRITEUPDATE_SET(x) (((x) << 0) & 0x000007ff) - -/* macros for I2cFifoWriteBaseAddr */ -#define I2CFIFOWRITEBASEADDR_ADDRESS 0x00000018 -#define I2CFIFOWRITEBASEADDR_OFFSET 0x00000018 -#define I2CFIFOWRITEBASEADDR_I2CFIFOWRITEBASEADDR_MSB 31 -#define I2CFIFOWRITEBASEADDR_I2CFIFOWRITEBASEADDR_LSB 0 -#define I2CFIFOWRITEBASEADDR_I2CFIFOWRITEBASEADDR_MASK 0xffffffff -#define I2CFIFOWRITEBASEADDR_I2CFIFOWRITEBASEADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define I2CFIFOWRITEBASEADDR_I2CFIFOWRITEBASEADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for I2cMemControl */ -#define I2CMEMCONTROL_ADDRESS 0x0000001c -#define I2CMEMCONTROL_OFFSET 0x0000001c -#define I2CMEMCONTROL_I2CMEMRESET_MSB 0 -#define I2CMEMCONTROL_I2CMEMRESET_LSB 0 -#define I2CMEMCONTROL_I2CMEMRESET_MASK 0x00000001 -#define I2CMEMCONTROL_I2CMEMRESET_GET(x) (((x) & 0x00000001) >> 0) -#define I2CMEMCONTROL_I2CMEMRESET_SET(x) (((x) << 0) & 0x00000001) -#define I2CMEMCONTROL_I2CMEMFLUSH_MSB 1 -#define I2CMEMCONTROL_I2CMEMFLUSH_LSB 1 -#define I2CMEMCONTROL_I2CMEMFLUSH_MASK 0x00000002 -#define I2CMEMCONTROL_I2CMEMFLUSH_GET(x) (((x) & 0x00000002) >> 1) -#define I2CMEMCONTROL_I2CMEMFLUSH_SET(x) (((x) << 1) & 0x00000002) - -/* macros for I2cMemBaseAddr */ -#define I2CMEMBASEADDR_ADDRESS 0x00000020 -#define I2CMEMBASEADDR_OFFSET 0x00000020 -#define I2CMEMBASEADDR_I2CMEMBASEADDR_MSB 31 -#define I2CMEMBASEADDR_I2CMEMBASEADDR_LSB 0 -#define I2CMEMBASEADDR_I2CMEMBASEADDR_MASK 0xffffffff -#define I2CMEMBASEADDR_I2CMEMBASEADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define I2CMEMBASEADDR_I2CMEMBASEADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for I2cRegReadData */ -#define I2CREGREADDATA_ADDRESS 0x00000024 -#define I2CREGREADDATA_OFFSET 0x00000024 -#define I2CREGREADDATA_I2CREGREADDATA_MSB 31 -#define I2CREGREADDATA_I2CREGREADDATA_LSB 0 -#define I2CREGREADDATA_I2CREGREADDATA_MASK 0xffffffff -#define I2CREGREADDATA_I2CREGREADDATA_GET(x) (((x) & 0xffffffff) >> 0) -#define I2CREGREADDATA_I2CREGREADDATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for I2cRegWriteData */ -#define I2CREGWRITEDATA_ADDRESS 0x00000028 -#define I2CREGWRITEDATA_OFFSET 0x00000028 -#define I2CREGWRITEDATA_I2CREGWRITEDATA_MSB 31 -#define I2CREGWRITEDATA_I2CREGWRITEDATA_LSB 0 -#define I2CREGWRITEDATA_I2CREGWRITEDATA_MASK 0xffffffff -#define I2CREGWRITEDATA_I2CREGWRITEDATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for I2cRegControl */ -#define I2CREGCONTROL_ADDRESS 0x0000002c -#define I2CREGCONTROL_OFFSET 0x0000002c -#define I2CREGCONTROL_I2CREGRESET_MSB 0 -#define I2CREGCONTROL_I2CREGRESET_LSB 0 -#define I2CREGCONTROL_I2CREGRESET_MASK 0x00000001 -#define I2CREGCONTROL_I2CREGRESET_GET(x) (((x) & 0x00000001) >> 0) -#define I2CREGCONTROL_I2CREGRESET_SET(x) (((x) << 0) & 0x00000001) -#define I2CREGCONTROL_I2CREGREADSTALL_MSB 1 -#define I2CREGCONTROL_I2CREGREADSTALL_LSB 1 -#define I2CREGCONTROL_I2CREGREADSTALL_MASK 0x00000002 -#define I2CREGCONTROL_I2CREGREADSTALL_GET(x) (((x) & 0x00000002) >> 1) -#define I2CREGCONTROL_I2CREGREADSTALL_SET(x) (((x) << 1) & 0x00000002) -#define I2CREGCONTROL_I2CREGWRITESTALL_MSB 2 -#define I2CREGCONTROL_I2CREGWRITESTALL_LSB 2 -#define I2CREGCONTROL_I2CREGWRITESTALL_MASK 0x00000004 -#define I2CREGCONTROL_I2CREGWRITESTALL_GET(x) (((x) & 0x00000004) >> 2) -#define I2CREGCONTROL_I2CREGWRITESTALL_SET(x) (((x) << 2) & 0x00000004) -#define I2CREGCONTROL_I2CREGREADCOUNT_MSB 5 -#define I2CREGCONTROL_I2CREGREADCOUNT_LSB 3 -#define I2CREGCONTROL_I2CREGREADCOUNT_MASK 0x00000038 -#define I2CREGCONTROL_I2CREGREADCOUNT_GET(x) (((x) & 0x00000038) >> 3) -#define I2CREGCONTROL_I2CREGWRITECOUNT_MSB 8 -#define I2CREGCONTROL_I2CREGWRITECOUNT_LSB 6 -#define I2CREGCONTROL_I2CREGWRITECOUNT_MASK 0x000001c0 -#define I2CREGCONTROL_I2CREGWRITECOUNT_GET(x) (((x) & 0x000001c0) >> 6) -#define I2CREGCONTROL_I2CREGREADEMPTY_MSB 9 -#define I2CREGCONTROL_I2CREGREADEMPTY_LSB 9 -#define I2CREGCONTROL_I2CREGREADEMPTY_MASK 0x00000200 -#define I2CREGCONTROL_I2CREGREADEMPTY_GET(x) (((x) & 0x00000200) >> 9) -#define I2CREGCONTROL_I2CREGWRITEFULL_MSB 10 -#define I2CREGCONTROL_I2CREGWRITEFULL_LSB 10 -#define I2CREGCONTROL_I2CREGWRITEFULL_MASK 0x00000400 -#define I2CREGCONTROL_I2CREGWRITEFULL_GET(x) (((x) & 0x00000400) >> 10) - -/* macros for I2cCsrReadData */ -#define I2CCSRREADDATA_ADDRESS 0x00000030 -#define I2CCSRREADDATA_OFFSET 0x00000030 -#define I2CCSRREADDATA_I2CCSRREADDATA_MSB 5 -#define I2CCSRREADDATA_I2CCSRREADDATA_LSB 0 -#define I2CCSRREADDATA_I2CCSRREADDATA_MASK 0x0000003f -#define I2CCSRREADDATA_I2CCSRREADDATA_GET(x) (((x) & 0x0000003f) >> 0) -#define I2CCSRREADDATA_I2CCSRREADDATA_SET(x) (((x) << 0) & 0x0000003f) - -/* macros for I2cCsrWriteData */ -#define I2CCSRWRITEDATA_ADDRESS 0x00000034 -#define I2CCSRWRITEDATA_OFFSET 0x00000034 -#define I2CCSRWRITEDATA_I2CCSRWRITEDATA_MSB 5 -#define I2CCSRWRITEDATA_I2CCSRWRITEDATA_LSB 0 -#define I2CCSRWRITEDATA_I2CCSRWRITEDATA_MASK 0x0000003f -#define I2CCSRWRITEDATA_I2CCSRWRITEDATA_GET(x) (((x) & 0x0000003f) >> 0) - -/* macros for I2cCsrControl */ -#define I2CCSRCONTROL_ADDRESS 0x00000038 -#define I2CCSRCONTROL_OFFSET 0x00000038 -#define I2CCSRCONTROL_I2CCSRREADDELAY_MSB 7 -#define I2CCSRCONTROL_I2CCSRREADDELAY_LSB 0 -#define I2CCSRCONTROL_I2CCSRREADDELAY_MASK 0x000000ff -#define I2CCSRCONTROL_I2CCSRREADDELAY_GET(x) (((x) & 0x000000ff) >> 0) -#define I2CCSRCONTROL_I2CCSRREADDELAY_SET(x) (((x) << 0) & 0x000000ff) -#define I2CCSRCONTROL_I2CCSRCLOCKREQUESTENABLE_MSB 8 -#define I2CCSRCONTROL_I2CCSRCLOCKREQUESTENABLE_LSB 8 -#define I2CCSRCONTROL_I2CCSRCLOCKREQUESTENABLE_MASK 0x00000100 -#define I2CCSRCONTROL_I2CCSRCLOCKREQUESTENABLE_GET(x) (((x) & 0x00000100) >> 8) -#define I2CCSRCONTROL_I2CCSRCLOCKREQUESTENABLE_SET(x) (((x) << 8) & 0x00000100) -#define I2CCSRCONTROL_I2CCSRFILTERCLOCKSELECT_MSB 11 -#define I2CCSRCONTROL_I2CCSRFILTERCLOCKSELECT_LSB 9 -#define I2CCSRCONTROL_I2CCSRFILTERCLOCKSELECT_MASK 0x00000e00 -#define I2CCSRCONTROL_I2CCSRFILTERCLOCKSELECT_GET(x) (((x) & 0x00000e00) >> 9) -#define I2CCSRCONTROL_I2CCSRFILTERCLOCKSELECT_SET(x) (((x) << 9) & 0x00000e00) -#define I2CCSRCONTROL_I2CCSRFILTERCLOCKSCALE_MSB 14 -#define I2CCSRCONTROL_I2CCSRFILTERCLOCKSCALE_LSB 12 -#define I2CCSRCONTROL_I2CCSRFILTERCLOCKSCALE_MASK 0x00007000 -#define I2CCSRCONTROL_I2CCSRFILTERCLOCKSCALE_GET(x) (((x) & 0x00007000) >> 12) -#define I2CCSRCONTROL_I2CCSRFILTERCLOCKSCALE_SET(x) (((x) << 12) & 0x00007000) -#define I2CCSRCONTROL_I2CCSRFILTERSDARXSELECT_MSB 17 -#define I2CCSRCONTROL_I2CCSRFILTERSDARXSELECT_LSB 15 -#define I2CCSRCONTROL_I2CCSRFILTERSDARXSELECT_MASK 0x00038000 -#define I2CCSRCONTROL_I2CCSRFILTERSDARXSELECT_GET(x) (((x) & 0x00038000) >> 15) -#define I2CCSRCONTROL_I2CCSRFILTERSDARXSELECT_SET(x) (((x) << 15) & 0x00038000) -#define I2CCSRCONTROL_I2CCSRFILTERSCLRXSELECT_MSB 20 -#define I2CCSRCONTROL_I2CCSRFILTERSCLRXSELECT_LSB 18 -#define I2CCSRCONTROL_I2CCSRFILTERSCLRXSELECT_MASK 0x001c0000 -#define I2CCSRCONTROL_I2CCSRFILTERSCLRXSELECT_GET(x) (((x) & 0x001c0000) >> 18) -#define I2CCSRCONTROL_I2CCSRFILTERSCLRXSELECT_SET(x) (((x) << 18) & 0x001c0000) - -/* macros for I2cFilterSize */ -#define I2CFILTERSIZE_ADDRESS 0x0000003c -#define I2CFILTERSIZE_OFFSET 0x0000003c -#define I2CFILTERSIZE_I2CFILTERSDARXSIZE_MSB 7 -#define I2CFILTERSIZE_I2CFILTERSDARXSIZE_LSB 0 -#define I2CFILTERSIZE_I2CFILTERSDARXSIZE_MASK 0x000000ff -#define I2CFILTERSIZE_I2CFILTERSDARXSIZE_GET(x) (((x) & 0x000000ff) >> 0) -#define I2CFILTERSIZE_I2CFILTERSDARXSIZE_SET(x) (((x) << 0) & 0x000000ff) -#define I2CFILTERSIZE_I2CFILTERSCLRXSIZE_MSB 15 -#define I2CFILTERSIZE_I2CFILTERSCLRXSIZE_LSB 8 -#define I2CFILTERSIZE_I2CFILTERSCLRXSIZE_MASK 0x0000ff00 -#define I2CFILTERSIZE_I2CFILTERSCLRXSIZE_GET(x) (((x) & 0x0000ff00) >> 8) -#define I2CFILTERSIZE_I2CFILTERSCLRXSIZE_SET(x) (((x) << 8) & 0x0000ff00) - -/* macros for I2cAddr */ -#define I2CADDR_ADDRESS 0x00000040 -#define I2CADDR_OFFSET 0x00000040 -#define I2CADDR_I2CFIFOADDR_MSB 6 -#define I2CADDR_I2CFIFOADDR_LSB 0 -#define I2CADDR_I2CFIFOADDR_MASK 0x0000007f -#define I2CADDR_I2CFIFOADDR_GET(x) (((x) & 0x0000007f) >> 0) -#define I2CADDR_I2CFIFOADDR_SET(x) (((x) << 0) & 0x0000007f) -#define I2CADDR_I2CMEMADDR_MSB 14 -#define I2CADDR_I2CMEMADDR_LSB 8 -#define I2CADDR_I2CMEMADDR_MASK 0x00007f00 -#define I2CADDR_I2CMEMADDR_GET(x) (((x) & 0x00007f00) >> 8) -#define I2CADDR_I2CMEMADDR_SET(x) (((x) << 8) & 0x00007f00) -#define I2CADDR_I2CREGADDR_MSB 22 -#define I2CADDR_I2CREGADDR_LSB 16 -#define I2CADDR_I2CREGADDR_MASK 0x007f0000 -#define I2CADDR_I2CREGADDR_GET(x) (((x) & 0x007f0000) >> 16) -#define I2CADDR_I2CREGADDR_SET(x) (((x) << 16) & 0x007f0000) -#define I2CADDR_I2CCSRADDR_MSB 30 -#define I2CADDR_I2CCSRADDR_LSB 24 -#define I2CADDR_I2CCSRADDR_MASK 0x7f000000 -#define I2CADDR_I2CCSRADDR_GET(x) (((x) & 0x7f000000) >> 24) -#define I2CADDR_I2CCSRADDR_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for I2cInt */ -#define I2CINT_ADDRESS 0x00000044 -#define I2CINT_OFFSET 0x00000044 -#define I2CINT_I2CFIFOREADSTARTINT_MSB 0 -#define I2CINT_I2CFIFOREADSTARTINT_LSB 0 -#define I2CINT_I2CFIFOREADSTARTINT_MASK 0x00000001 -#define I2CINT_I2CFIFOREADSTARTINT_GET(x) (((x) & 0x00000001) >> 0) -#define I2CINT_I2CFIFOREADSTARTINT_SET(x) (((x) << 0) & 0x00000001) -#define I2CINT_I2CFIFOREADFINISHINT_MSB 1 -#define I2CINT_I2CFIFOREADFINISHINT_LSB 1 -#define I2CINT_I2CFIFOREADFINISHINT_MASK 0x00000002 -#define I2CINT_I2CFIFOREADFINISHINT_GET(x) (((x) & 0x00000002) >> 1) -#define I2CINT_I2CFIFOREADFINISHINT_SET(x) (((x) << 1) & 0x00000002) -#define I2CINT_I2CFIFOWRITESTARTINT_MSB 2 -#define I2CINT_I2CFIFOWRITESTARTINT_LSB 2 -#define I2CINT_I2CFIFOWRITESTARTINT_MASK 0x00000004 -#define I2CINT_I2CFIFOWRITESTARTINT_GET(x) (((x) & 0x00000004) >> 2) -#define I2CINT_I2CFIFOWRITESTARTINT_SET(x) (((x) << 2) & 0x00000004) -#define I2CINT_I2CFIFOWRITEFINISHINT_MSB 3 -#define I2CINT_I2CFIFOWRITEFINISHINT_LSB 3 -#define I2CINT_I2CFIFOWRITEFINISHINT_MASK 0x00000008 -#define I2CINT_I2CFIFOWRITEFINISHINT_GET(x) (((x) & 0x00000008) >> 3) -#define I2CINT_I2CFIFOWRITEFINISHINT_SET(x) (((x) << 3) & 0x00000008) -#define I2CINT_I2CREGREADSTARTINT_MSB 4 -#define I2CINT_I2CREGREADSTARTINT_LSB 4 -#define I2CINT_I2CREGREADSTARTINT_MASK 0x00000010 -#define I2CINT_I2CREGREADSTARTINT_GET(x) (((x) & 0x00000010) >> 4) -#define I2CINT_I2CREGREADSTARTINT_SET(x) (((x) << 4) & 0x00000010) -#define I2CINT_I2CREGREADFINISHINT_MSB 5 -#define I2CINT_I2CREGREADFINISHINT_LSB 5 -#define I2CINT_I2CREGREADFINISHINT_MASK 0x00000020 -#define I2CINT_I2CREGREADFINISHINT_GET(x) (((x) & 0x00000020) >> 5) -#define I2CINT_I2CREGREADFINISHINT_SET(x) (((x) << 5) & 0x00000020) -#define I2CINT_I2CREGWRITESTARTINT_MSB 6 -#define I2CINT_I2CREGWRITESTARTINT_LSB 6 -#define I2CINT_I2CREGWRITESTARTINT_MASK 0x00000040 -#define I2CINT_I2CREGWRITESTARTINT_GET(x) (((x) & 0x00000040) >> 6) -#define I2CINT_I2CREGWRITESTARTINT_SET(x) (((x) << 6) & 0x00000040) -#define I2CINT_I2CREGWRITEFINISHINT_MSB 7 -#define I2CINT_I2CREGWRITEFINISHINT_LSB 7 -#define I2CINT_I2CREGWRITEFINISHINT_MASK 0x00000080 -#define I2CINT_I2CREGWRITEFINISHINT_GET(x) (((x) & 0x00000080) >> 7) -#define I2CINT_I2CREGWRITEFINISHINT_SET(x) (((x) << 7) & 0x00000080) -#define I2CINT_I2CFIFOREADEMPTYINT_MSB 8 -#define I2CINT_I2CFIFOREADEMPTYINT_LSB 8 -#define I2CINT_I2CFIFOREADEMPTYINT_MASK 0x00000100 -#define I2CINT_I2CFIFOREADEMPTYINT_GET(x) (((x) & 0x00000100) >> 8) -#define I2CINT_I2CFIFOWRITEFULLINT_MSB 9 -#define I2CINT_I2CFIFOWRITEFULLINT_LSB 9 -#define I2CINT_I2CFIFOWRITEFULLINT_MASK 0x00000200 -#define I2CINT_I2CFIFOWRITEFULLINT_GET(x) (((x) & 0x00000200) >> 9) -#define I2CINT_I2CFIFOREADTHRESHOLDINT_MSB 10 -#define I2CINT_I2CFIFOREADTHRESHOLDINT_LSB 10 -#define I2CINT_I2CFIFOREADTHRESHOLDINT_MASK 0x00000400 -#define I2CINT_I2CFIFOREADTHRESHOLDINT_GET(x) (((x) & 0x00000400) >> 10) -#define I2CINT_I2CFIFOWRITETHRESHOLDINT_MSB 11 -#define I2CINT_I2CFIFOWRITETHRESHOLDINT_LSB 11 -#define I2CINT_I2CFIFOWRITETHRESHOLDINT_MASK 0x00000800 -#define I2CINT_I2CFIFOWRITETHRESHOLDINT_GET(x) (((x) & 0x00000800) >> 11) -#define I2CINT_I2CCSRINT_MSB 12 -#define I2CINT_I2CCSRINT_LSB 12 -#define I2CINT_I2CCSRINT_MASK 0x00001000 -#define I2CINT_I2CCSRINT_GET(x) (((x) & 0x00001000) >> 12) -#define I2CINT_I2CCSRINT_SET(x) (((x) << 12) & 0x00001000) - -/* macros for I2cIntEn */ -#define I2CINTEN_ADDRESS 0x00000048 -#define I2CINTEN_OFFSET 0x00000048 -#define I2CINTEN_I2CFIFOREADSTARTINTEN_MSB 0 -#define I2CINTEN_I2CFIFOREADSTARTINTEN_LSB 0 -#define I2CINTEN_I2CFIFOREADSTARTINTEN_MASK 0x00000001 -#define I2CINTEN_I2CFIFOREADSTARTINTEN_GET(x) (((x) & 0x00000001) >> 0) -#define I2CINTEN_I2CFIFOREADSTARTINTEN_SET(x) (((x) << 0) & 0x00000001) -#define I2CINTEN_I2CFIFOREADFINISHINTEN_MSB 1 -#define I2CINTEN_I2CFIFOREADFINISHINTEN_LSB 1 -#define I2CINTEN_I2CFIFOREADFINISHINTEN_MASK 0x00000002 -#define I2CINTEN_I2CFIFOREADFINISHINTEN_GET(x) (((x) & 0x00000002) >> 1) -#define I2CINTEN_I2CFIFOREADFINISHINTEN_SET(x) (((x) << 1) & 0x00000002) -#define I2CINTEN_I2CFIFOWRITESTARTINTEN_MSB 2 -#define I2CINTEN_I2CFIFOWRITESTARTINTEN_LSB 2 -#define I2CINTEN_I2CFIFOWRITESTARTINTEN_MASK 0x00000004 -#define I2CINTEN_I2CFIFOWRITESTARTINTEN_GET(x) (((x) & 0x00000004) >> 2) -#define I2CINTEN_I2CFIFOWRITESTARTINTEN_SET(x) (((x) << 2) & 0x00000004) -#define I2CINTEN_I2CFIFOWRITEFINISHINTEN_MSB 3 -#define I2CINTEN_I2CFIFOWRITEFINISHINTEN_LSB 3 -#define I2CINTEN_I2CFIFOWRITEFINISHINTEN_MASK 0x00000008 -#define I2CINTEN_I2CFIFOWRITEFINISHINTEN_GET(x) (((x) & 0x00000008) >> 3) -#define I2CINTEN_I2CFIFOWRITEFINISHINTEN_SET(x) (((x) << 3) & 0x00000008) -#define I2CINTEN_I2CREGREADSTARTINTEN_MSB 4 -#define I2CINTEN_I2CREGREADSTARTINTEN_LSB 4 -#define I2CINTEN_I2CREGREADSTARTINTEN_MASK 0x00000010 -#define I2CINTEN_I2CREGREADSTARTINTEN_GET(x) (((x) & 0x00000010) >> 4) -#define I2CINTEN_I2CREGREADSTARTINTEN_SET(x) (((x) << 4) & 0x00000010) -#define I2CINTEN_I2CREGREADFINISHINTEN_MSB 5 -#define I2CINTEN_I2CREGREADFINISHINTEN_LSB 5 -#define I2CINTEN_I2CREGREADFINISHINTEN_MASK 0x00000020 -#define I2CINTEN_I2CREGREADFINISHINTEN_GET(x) (((x) & 0x00000020) >> 5) -#define I2CINTEN_I2CREGREADFINISHINTEN_SET(x) (((x) << 5) & 0x00000020) -#define I2CINTEN_I2CREGWRITESTARTINTEN_MSB 6 -#define I2CINTEN_I2CREGWRITESTARTINTEN_LSB 6 -#define I2CINTEN_I2CREGWRITESTARTINTEN_MASK 0x00000040 -#define I2CINTEN_I2CREGWRITESTARTINTEN_GET(x) (((x) & 0x00000040) >> 6) -#define I2CINTEN_I2CREGWRITESTARTINTEN_SET(x) (((x) << 6) & 0x00000040) -#define I2CINTEN_I2CREGWRITEFINISHINTEN_MSB 7 -#define I2CINTEN_I2CREGWRITEFINISHINTEN_LSB 7 -#define I2CINTEN_I2CREGWRITEFINISHINTEN_MASK 0x00000080 -#define I2CINTEN_I2CREGWRITEFINISHINTEN_GET(x) (((x) & 0x00000080) >> 7) -#define I2CINTEN_I2CREGWRITEFINISHINTEN_SET(x) (((x) << 7) & 0x00000080) -#define I2CINTEN_I2CFIFOREADEMPTYINTEN_MSB 8 -#define I2CINTEN_I2CFIFOREADEMPTYINTEN_LSB 8 -#define I2CINTEN_I2CFIFOREADEMPTYINTEN_MASK 0x00000100 -#define I2CINTEN_I2CFIFOREADEMPTYINTEN_GET(x) (((x) & 0x00000100) >> 8) -#define I2CINTEN_I2CFIFOREADEMPTYINTEN_SET(x) (((x) << 8) & 0x00000100) -#define I2CINTEN_I2CFIFOWRITEFULLINTEN_MSB 9 -#define I2CINTEN_I2CFIFOWRITEFULLINTEN_LSB 9 -#define I2CINTEN_I2CFIFOWRITEFULLINTEN_MASK 0x00000200 -#define I2CINTEN_I2CFIFOWRITEFULLINTEN_GET(x) (((x) & 0x00000200) >> 9) -#define I2CINTEN_I2CFIFOWRITEFULLINTEN_SET(x) (((x) << 9) & 0x00000200) -#define I2CINTEN_I2CFIFOREADTHRESHOLDINTEN_MSB 10 -#define I2CINTEN_I2CFIFOREADTHRESHOLDINTEN_LSB 10 -#define I2CINTEN_I2CFIFOREADTHRESHOLDINTEN_MASK 0x00000400 -#define I2CINTEN_I2CFIFOREADTHRESHOLDINTEN_GET(x) (((x) & 0x00000400) >> 10) -#define I2CINTEN_I2CFIFOREADTHRESHOLDINTEN_SET(x) (((x) << 10) & 0x00000400) -#define I2CINTEN_I2CFIFOWRITETHRESHOLDINTEN_MSB 11 -#define I2CINTEN_I2CFIFOWRITETHRESHOLDINTEN_LSB 11 -#define I2CINTEN_I2CFIFOWRITETHRESHOLDINTEN_MASK 0x00000800 -#define I2CINTEN_I2CFIFOWRITETHRESHOLDINTEN_GET(x) (((x) & 0x00000800) >> 11) -#define I2CINTEN_I2CFIFOWRITETHRESHOLDINTEN_SET(x) (((x) << 11) & 0x00000800) -#define I2CINTEN_I2CCSRINTEN_MSB 12 -#define I2CINTEN_I2CCSRINTEN_LSB 12 -#define I2CINTEN_I2CCSRINTEN_MASK 0x00001000 -#define I2CINTEN_I2CCSRINTEN_GET(x) (((x) & 0x00001000) >> 12) -#define I2CINTEN_I2CCSRINTEN_SET(x) (((x) << 12) & 0x00001000) - -/* macros for I2cIntCsr */ -#define I2CINTCSR_ADDRESS 0x0000004c -#define I2CINTCSR_OFFSET 0x0000004c -#define I2CINTCSR_I2CINT_MSB 0 -#define I2CINTCSR_I2CINT_LSB 0 -#define I2CINTCSR_I2CINT_MASK 0x00000001 -#define I2CINTCSR_I2CINT_GET(x) (((x) & 0x00000001) >> 0) -#define I2CINTCSR_I2CINTEN_MSB 1 -#define I2CINTCSR_I2CINTEN_LSB 1 -#define I2CINTCSR_I2CINTEN_MASK 0x00000002 -#define I2CINTCSR_I2CINTEN_GET(x) (((x) & 0x00000002) >> 1) -#define I2CINTCSR_I2CINTEN_SET(x) (((x) << 1) & 0x00000002) - - -#ifndef __ASSEMBLER__ - -typedef struct athrI2cSlaveApbCsr_reg_s { - volatile unsigned int I2cFifoControl; /* 0x0 - 0x4 */ - volatile unsigned int I2cFifoReadPtr; /* 0x4 - 0x8 */ - volatile unsigned int I2cFifoReadUpdate; /* 0x8 - 0xc */ - volatile unsigned int I2cFifoReadBaseAddr; /* 0xc - 0x10 */ - volatile unsigned int I2cFifoWritePtr; /* 0x10 - 0x14 */ - volatile unsigned int I2cFifoWriteUpdate; /* 0x14 - 0x18 */ - volatile unsigned int I2cFifoWriteBaseAddr; /* 0x18 - 0x1c */ - volatile unsigned int I2cMemControl; /* 0x1c - 0x20 */ - volatile unsigned int I2cMemBaseAddr; /* 0x20 - 0x24 */ - volatile unsigned int I2cRegReadData; /* 0x24 - 0x28 */ - volatile unsigned int I2cRegWriteData; /* 0x28 - 0x2c */ - volatile unsigned int I2cRegControl; /* 0x2c - 0x30 */ - volatile unsigned int I2cCsrReadData; /* 0x30 - 0x34 */ - volatile unsigned int I2cCsrWriteData; /* 0x34 - 0x38 */ - volatile unsigned int I2cCsrControl; /* 0x38 - 0x3c */ - volatile unsigned int I2cFilterSize; /* 0x3c - 0x40 */ - volatile unsigned int I2cAddr; /* 0x40 - 0x44 */ - volatile unsigned int I2cInt; /* 0x44 - 0x48 */ - volatile unsigned int I2cIntEn; /* 0x48 - 0x4c */ - volatile unsigned int I2cIntCsr; /* 0x4c - 0x50 */ -} athrI2cSlaveApbCsr_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _ATHRI2CSLAVEAPBCSR_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bb_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bb_reg.h deleted file mode 100644 index 23c97741cb40..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bb_reg.h +++ /dev/null @@ -1,8970 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _BB_REG_REG_H_ -#define _BB_REG_REG_H_ - - -/* macros for bb_chn_reg_map.BB_timing_controls_1 */ -#define BB_TIMING_CONTROLS_1_ADDRESS 0x00000000 -#define BB_TIMING_CONTROLS_1_OFFSET 0x00000000 -#define BB_TIMING_CONTROLS_1_STE_THR_MSB 6 -#define BB_TIMING_CONTROLS_1_STE_THR_LSB 0 -#define BB_TIMING_CONTROLS_1_STE_THR_MASK 0x0000007f -#define BB_TIMING_CONTROLS_1_STE_THR_GET(x) (((x) & 0x0000007f) >> 0) -#define BB_TIMING_CONTROLS_1_STE_THR_SET(x) (((x) << 0) & 0x0000007f) -#define BB_TIMING_CONTROLS_1_STE_TO_LONG1_MSB 12 -#define BB_TIMING_CONTROLS_1_STE_TO_LONG1_LSB 7 -#define BB_TIMING_CONTROLS_1_STE_TO_LONG1_MASK 0x00001f80 -#define BB_TIMING_CONTROLS_1_STE_TO_LONG1_GET(x) (((x) & 0x00001f80) >> 7) -#define BB_TIMING_CONTROLS_1_STE_TO_LONG1_SET(x) (((x) << 7) & 0x00001f80) -#define BB_TIMING_CONTROLS_1_TIMING_BACKOFF_MSB 16 -#define BB_TIMING_CONTROLS_1_TIMING_BACKOFF_LSB 13 -#define BB_TIMING_CONTROLS_1_TIMING_BACKOFF_MASK 0x0001e000 -#define BB_TIMING_CONTROLS_1_TIMING_BACKOFF_GET(x) (((x) & 0x0001e000) >> 13) -#define BB_TIMING_CONTROLS_1_TIMING_BACKOFF_SET(x) (((x) << 13) & 0x0001e000) -#define BB_TIMING_CONTROLS_1_ENABLE_HT_FINE_PPM_MSB 17 -#define BB_TIMING_CONTROLS_1_ENABLE_HT_FINE_PPM_LSB 17 -#define BB_TIMING_CONTROLS_1_ENABLE_HT_FINE_PPM_MASK 0x00020000 -#define BB_TIMING_CONTROLS_1_ENABLE_HT_FINE_PPM_GET(x) (((x) & 0x00020000) >> 17) -#define BB_TIMING_CONTROLS_1_ENABLE_HT_FINE_PPM_SET(x) (((x) << 17) & 0x00020000) -#define BB_TIMING_CONTROLS_1_HT_FINE_PPM_STREAM_MSB 19 -#define BB_TIMING_CONTROLS_1_HT_FINE_PPM_STREAM_LSB 18 -#define BB_TIMING_CONTROLS_1_HT_FINE_PPM_STREAM_MASK 0x000c0000 -#define BB_TIMING_CONTROLS_1_HT_FINE_PPM_STREAM_GET(x) (((x) & 0x000c0000) >> 18) -#define BB_TIMING_CONTROLS_1_HT_FINE_PPM_STREAM_SET(x) (((x) << 18) & 0x000c0000) -#define BB_TIMING_CONTROLS_1_HT_FINE_PPM_QAM_MSB 21 -#define BB_TIMING_CONTROLS_1_HT_FINE_PPM_QAM_LSB 20 -#define BB_TIMING_CONTROLS_1_HT_FINE_PPM_QAM_MASK 0x00300000 -#define BB_TIMING_CONTROLS_1_HT_FINE_PPM_QAM_GET(x) (((x) & 0x00300000) >> 20) -#define BB_TIMING_CONTROLS_1_HT_FINE_PPM_QAM_SET(x) (((x) << 20) & 0x00300000) -#define BB_TIMING_CONTROLS_1_ENABLE_LONG_CHANFIL_MSB 22 -#define BB_TIMING_CONTROLS_1_ENABLE_LONG_CHANFIL_LSB 22 -#define BB_TIMING_CONTROLS_1_ENABLE_LONG_CHANFIL_MASK 0x00400000 -#define BB_TIMING_CONTROLS_1_ENABLE_LONG_CHANFIL_GET(x) (((x) & 0x00400000) >> 22) -#define BB_TIMING_CONTROLS_1_ENABLE_LONG_CHANFIL_SET(x) (((x) << 22) & 0x00400000) -#define BB_TIMING_CONTROLS_1_ENABLE_RX_STBC_MSB 23 -#define BB_TIMING_CONTROLS_1_ENABLE_RX_STBC_LSB 23 -#define BB_TIMING_CONTROLS_1_ENABLE_RX_STBC_MASK 0x00800000 -#define BB_TIMING_CONTROLS_1_ENABLE_RX_STBC_GET(x) (((x) & 0x00800000) >> 23) -#define BB_TIMING_CONTROLS_1_ENABLE_RX_STBC_SET(x) (((x) << 23) & 0x00800000) -#define BB_TIMING_CONTROLS_1_ENABLE_CHANNEL_FILTER_MSB 24 -#define BB_TIMING_CONTROLS_1_ENABLE_CHANNEL_FILTER_LSB 24 -#define BB_TIMING_CONTROLS_1_ENABLE_CHANNEL_FILTER_MASK 0x01000000 -#define BB_TIMING_CONTROLS_1_ENABLE_CHANNEL_FILTER_GET(x) (((x) & 0x01000000) >> 24) -#define BB_TIMING_CONTROLS_1_ENABLE_CHANNEL_FILTER_SET(x) (((x) << 24) & 0x01000000) -#define BB_TIMING_CONTROLS_1_FALSE_ALARM_MSB 26 -#define BB_TIMING_CONTROLS_1_FALSE_ALARM_LSB 25 -#define BB_TIMING_CONTROLS_1_FALSE_ALARM_MASK 0x06000000 -#define BB_TIMING_CONTROLS_1_FALSE_ALARM_GET(x) (((x) & 0x06000000) >> 25) -#define BB_TIMING_CONTROLS_1_FALSE_ALARM_SET(x) (((x) << 25) & 0x06000000) -#define BB_TIMING_CONTROLS_1_ENABLE_LONG_RESCALE_MSB 27 -#define BB_TIMING_CONTROLS_1_ENABLE_LONG_RESCALE_LSB 27 -#define BB_TIMING_CONTROLS_1_ENABLE_LONG_RESCALE_MASK 0x08000000 -#define BB_TIMING_CONTROLS_1_ENABLE_LONG_RESCALE_GET(x) (((x) & 0x08000000) >> 27) -#define BB_TIMING_CONTROLS_1_ENABLE_LONG_RESCALE_SET(x) (((x) << 27) & 0x08000000) -#define BB_TIMING_CONTROLS_1_TIMING_LEAK_ENABLE_MSB 28 -#define BB_TIMING_CONTROLS_1_TIMING_LEAK_ENABLE_LSB 28 -#define BB_TIMING_CONTROLS_1_TIMING_LEAK_ENABLE_MASK 0x10000000 -#define BB_TIMING_CONTROLS_1_TIMING_LEAK_ENABLE_GET(x) (((x) & 0x10000000) >> 28) -#define BB_TIMING_CONTROLS_1_TIMING_LEAK_ENABLE_SET(x) (((x) << 28) & 0x10000000) -#define BB_TIMING_CONTROLS_1_COARSE_PPM_SELECT_MSB 30 -#define BB_TIMING_CONTROLS_1_COARSE_PPM_SELECT_LSB 29 -#define BB_TIMING_CONTROLS_1_COARSE_PPM_SELECT_MASK 0x60000000 -#define BB_TIMING_CONTROLS_1_COARSE_PPM_SELECT_GET(x) (((x) & 0x60000000) >> 29) -#define BB_TIMING_CONTROLS_1_COARSE_PPM_SELECT_SET(x) (((x) << 29) & 0x60000000) -#define BB_TIMING_CONTROLS_1_FFT_SCALING_MSB 31 -#define BB_TIMING_CONTROLS_1_FFT_SCALING_LSB 31 -#define BB_TIMING_CONTROLS_1_FFT_SCALING_MASK 0x80000000 -#define BB_TIMING_CONTROLS_1_FFT_SCALING_GET(x) (((x) & 0x80000000) >> 31) -#define BB_TIMING_CONTROLS_1_FFT_SCALING_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_chn_reg_map.BB_timing_controls_2 */ -#define BB_TIMING_CONTROLS_2_ADDRESS 0x00000004 -#define BB_TIMING_CONTROLS_2_OFFSET 0x00000004 -#define BB_TIMING_CONTROLS_2_FORCED_DELTA_PHI_SYMBOL_MSB 11 -#define BB_TIMING_CONTROLS_2_FORCED_DELTA_PHI_SYMBOL_LSB 0 -#define BB_TIMING_CONTROLS_2_FORCED_DELTA_PHI_SYMBOL_MASK 0x00000fff -#define BB_TIMING_CONTROLS_2_FORCED_DELTA_PHI_SYMBOL_GET(x) (((x) & 0x00000fff) >> 0) -#define BB_TIMING_CONTROLS_2_FORCED_DELTA_PHI_SYMBOL_SET(x) (((x) << 0) & 0x00000fff) -#define BB_TIMING_CONTROLS_2_FORCE_DELTA_PHI_SYMBOL_MSB 12 -#define BB_TIMING_CONTROLS_2_FORCE_DELTA_PHI_SYMBOL_LSB 12 -#define BB_TIMING_CONTROLS_2_FORCE_DELTA_PHI_SYMBOL_MASK 0x00001000 -#define BB_TIMING_CONTROLS_2_FORCE_DELTA_PHI_SYMBOL_GET(x) (((x) & 0x00001000) >> 12) -#define BB_TIMING_CONTROLS_2_FORCE_DELTA_PHI_SYMBOL_SET(x) (((x) << 12) & 0x00001000) -#define BB_TIMING_CONTROLS_2_ENABLE_MAGNITUDE_TRACK_MSB 13 -#define BB_TIMING_CONTROLS_2_ENABLE_MAGNITUDE_TRACK_LSB 13 -#define BB_TIMING_CONTROLS_2_ENABLE_MAGNITUDE_TRACK_MASK 0x00002000 -#define BB_TIMING_CONTROLS_2_ENABLE_MAGNITUDE_TRACK_GET(x) (((x) & 0x00002000) >> 13) -#define BB_TIMING_CONTROLS_2_ENABLE_MAGNITUDE_TRACK_SET(x) (((x) << 13) & 0x00002000) -#define BB_TIMING_CONTROLS_2_ENABLE_SLOPE_FILTER_MSB 14 -#define BB_TIMING_CONTROLS_2_ENABLE_SLOPE_FILTER_LSB 14 -#define BB_TIMING_CONTROLS_2_ENABLE_SLOPE_FILTER_MASK 0x00004000 -#define BB_TIMING_CONTROLS_2_ENABLE_SLOPE_FILTER_GET(x) (((x) & 0x00004000) >> 14) -#define BB_TIMING_CONTROLS_2_ENABLE_SLOPE_FILTER_SET(x) (((x) << 14) & 0x00004000) -#define BB_TIMING_CONTROLS_2_ENABLE_OFFSET_FILTER_MSB 15 -#define BB_TIMING_CONTROLS_2_ENABLE_OFFSET_FILTER_LSB 15 -#define BB_TIMING_CONTROLS_2_ENABLE_OFFSET_FILTER_MASK 0x00008000 -#define BB_TIMING_CONTROLS_2_ENABLE_OFFSET_FILTER_GET(x) (((x) & 0x00008000) >> 15) -#define BB_TIMING_CONTROLS_2_ENABLE_OFFSET_FILTER_SET(x) (((x) << 15) & 0x00008000) -#define BB_TIMING_CONTROLS_2_DC_OFF_DELTAF_THRES_MSB 22 -#define BB_TIMING_CONTROLS_2_DC_OFF_DELTAF_THRES_LSB 16 -#define BB_TIMING_CONTROLS_2_DC_OFF_DELTAF_THRES_MASK 0x007f0000 -#define BB_TIMING_CONTROLS_2_DC_OFF_DELTAF_THRES_GET(x) (((x) & 0x007f0000) >> 16) -#define BB_TIMING_CONTROLS_2_DC_OFF_DELTAF_THRES_SET(x) (((x) << 16) & 0x007f0000) -#define BB_TIMING_CONTROLS_2_DC_OFF_TIM_CONST_MSB 26 -#define BB_TIMING_CONTROLS_2_DC_OFF_TIM_CONST_LSB 24 -#define BB_TIMING_CONTROLS_2_DC_OFF_TIM_CONST_MASK 0x07000000 -#define BB_TIMING_CONTROLS_2_DC_OFF_TIM_CONST_GET(x) (((x) & 0x07000000) >> 24) -#define BB_TIMING_CONTROLS_2_DC_OFF_TIM_CONST_SET(x) (((x) << 24) & 0x07000000) -#define BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_MSB 27 -#define BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_LSB 27 -#define BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_MASK 0x08000000 -#define BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_GET(x) (((x) & 0x08000000) >> 27) -#define BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_SET(x) (((x) << 27) & 0x08000000) -#define BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_TRACK_MSB 28 -#define BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_TRACK_LSB 28 -#define BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_TRACK_MASK 0x10000000 -#define BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_TRACK_GET(x) (((x) & 0x10000000) >> 28) -#define BB_TIMING_CONTROLS_2_ENABLE_DC_OFFSET_TRACK_SET(x) (((x) << 28) & 0x10000000) -#define BB_TIMING_CONTROLS_2_ENABLE_WEIGHTING_MSB 29 -#define BB_TIMING_CONTROLS_2_ENABLE_WEIGHTING_LSB 29 -#define BB_TIMING_CONTROLS_2_ENABLE_WEIGHTING_MASK 0x20000000 -#define BB_TIMING_CONTROLS_2_ENABLE_WEIGHTING_GET(x) (((x) & 0x20000000) >> 29) -#define BB_TIMING_CONTROLS_2_ENABLE_WEIGHTING_SET(x) (((x) << 29) & 0x20000000) -#define BB_TIMING_CONTROLS_2_TRACEBACK128_MSB 30 -#define BB_TIMING_CONTROLS_2_TRACEBACK128_LSB 30 -#define BB_TIMING_CONTROLS_2_TRACEBACK128_MASK 0x40000000 -#define BB_TIMING_CONTROLS_2_TRACEBACK128_GET(x) (((x) & 0x40000000) >> 30) -#define BB_TIMING_CONTROLS_2_TRACEBACK128_SET(x) (((x) << 30) & 0x40000000) -#define BB_TIMING_CONTROLS_2_ENABLE_HT_FINE_TIMING_MSB 31 -#define BB_TIMING_CONTROLS_2_ENABLE_HT_FINE_TIMING_LSB 31 -#define BB_TIMING_CONTROLS_2_ENABLE_HT_FINE_TIMING_MASK 0x80000000 -#define BB_TIMING_CONTROLS_2_ENABLE_HT_FINE_TIMING_GET(x) (((x) & 0x80000000) >> 31) -#define BB_TIMING_CONTROLS_2_ENABLE_HT_FINE_TIMING_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_chn_reg_map.BB_timing_controls_3 */ -#define BB_TIMING_CONTROLS_3_ADDRESS 0x00000008 -#define BB_TIMING_CONTROLS_3_OFFSET 0x00000008 -#define BB_TIMING_CONTROLS_3_PPM_RESCUE_INTERVAL_MSB 7 -#define BB_TIMING_CONTROLS_3_PPM_RESCUE_INTERVAL_LSB 0 -#define BB_TIMING_CONTROLS_3_PPM_RESCUE_INTERVAL_MASK 0x000000ff -#define BB_TIMING_CONTROLS_3_PPM_RESCUE_INTERVAL_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_TIMING_CONTROLS_3_PPM_RESCUE_INTERVAL_SET(x) (((x) << 0) & 0x000000ff) -#define BB_TIMING_CONTROLS_3_ENABLE_PPM_RESCUE_MSB 8 -#define BB_TIMING_CONTROLS_3_ENABLE_PPM_RESCUE_LSB 8 -#define BB_TIMING_CONTROLS_3_ENABLE_PPM_RESCUE_MASK 0x00000100 -#define BB_TIMING_CONTROLS_3_ENABLE_PPM_RESCUE_GET(x) (((x) & 0x00000100) >> 8) -#define BB_TIMING_CONTROLS_3_ENABLE_PPM_RESCUE_SET(x) (((x) << 8) & 0x00000100) -#define BB_TIMING_CONTROLS_3_ENABLE_FINE_PPM_MSB 9 -#define BB_TIMING_CONTROLS_3_ENABLE_FINE_PPM_LSB 9 -#define BB_TIMING_CONTROLS_3_ENABLE_FINE_PPM_MASK 0x00000200 -#define BB_TIMING_CONTROLS_3_ENABLE_FINE_PPM_GET(x) (((x) & 0x00000200) >> 9) -#define BB_TIMING_CONTROLS_3_ENABLE_FINE_PPM_SET(x) (((x) << 9) & 0x00000200) -#define BB_TIMING_CONTROLS_3_ENABLE_FINE_INTERP_MSB 10 -#define BB_TIMING_CONTROLS_3_ENABLE_FINE_INTERP_LSB 10 -#define BB_TIMING_CONTROLS_3_ENABLE_FINE_INTERP_MASK 0x00000400 -#define BB_TIMING_CONTROLS_3_ENABLE_FINE_INTERP_GET(x) (((x) & 0x00000400) >> 10) -#define BB_TIMING_CONTROLS_3_ENABLE_FINE_INTERP_SET(x) (((x) << 10) & 0x00000400) -#define BB_TIMING_CONTROLS_3_CONTINUOUS_PPM_RESCUE_MSB 11 -#define BB_TIMING_CONTROLS_3_CONTINUOUS_PPM_RESCUE_LSB 11 -#define BB_TIMING_CONTROLS_3_CONTINUOUS_PPM_RESCUE_MASK 0x00000800 -#define BB_TIMING_CONTROLS_3_CONTINUOUS_PPM_RESCUE_GET(x) (((x) & 0x00000800) >> 11) -#define BB_TIMING_CONTROLS_3_CONTINUOUS_PPM_RESCUE_SET(x) (((x) << 11) & 0x00000800) -#define BB_TIMING_CONTROLS_3_ENABLE_DF_CHANEST_MSB 12 -#define BB_TIMING_CONTROLS_3_ENABLE_DF_CHANEST_LSB 12 -#define BB_TIMING_CONTROLS_3_ENABLE_DF_CHANEST_MASK 0x00001000 -#define BB_TIMING_CONTROLS_3_ENABLE_DF_CHANEST_GET(x) (((x) & 0x00001000) >> 12) -#define BB_TIMING_CONTROLS_3_ENABLE_DF_CHANEST_SET(x) (((x) << 12) & 0x00001000) -#define BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_EXP_MSB 16 -#define BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_EXP_LSB 13 -#define BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_EXP_MASK 0x0001e000 -#define BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_EXP_GET(x) (((x) & 0x0001e000) >> 13) -#define BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_EXP_SET(x) (((x) << 13) & 0x0001e000) -#define BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_MAN_MSB 31 -#define BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_MAN_LSB 17 -#define BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_MAN_MASK 0xfffe0000 -#define BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_MAN_GET(x) (((x) & 0xfffe0000) >> 17) -#define BB_TIMING_CONTROLS_3_DELTA_SLOPE_COEF_MAN_SET(x) (((x) << 17) & 0xfffe0000) - -/* macros for bb_chn_reg_map.BB_timing_control_4 */ -#define BB_TIMING_CONTROL_4_ADDRESS 0x0000000c -#define BB_TIMING_CONTROL_4_OFFSET 0x0000000c -#define BB_TIMING_CONTROL_4_CAL_LG_COUNT_MAX_MSB 15 -#define BB_TIMING_CONTROL_4_CAL_LG_COUNT_MAX_LSB 12 -#define BB_TIMING_CONTROL_4_CAL_LG_COUNT_MAX_MASK 0x0000f000 -#define BB_TIMING_CONTROL_4_CAL_LG_COUNT_MAX_GET(x) (((x) & 0x0000f000) >> 12) -#define BB_TIMING_CONTROL_4_CAL_LG_COUNT_MAX_SET(x) (((x) << 12) & 0x0000f000) -#define BB_TIMING_CONTROL_4_DO_GAIN_DC_IQ_CAL_MSB 16 -#define BB_TIMING_CONTROL_4_DO_GAIN_DC_IQ_CAL_LSB 16 -#define BB_TIMING_CONTROL_4_DO_GAIN_DC_IQ_CAL_MASK 0x00010000 -#define BB_TIMING_CONTROL_4_DO_GAIN_DC_IQ_CAL_GET(x) (((x) & 0x00010000) >> 16) -#define BB_TIMING_CONTROL_4_DO_GAIN_DC_IQ_CAL_SET(x) (((x) << 16) & 0x00010000) -#define BB_TIMING_CONTROL_4_USE_PILOT_TRACK_DF_MSB 20 -#define BB_TIMING_CONTROL_4_USE_PILOT_TRACK_DF_LSB 17 -#define BB_TIMING_CONTROL_4_USE_PILOT_TRACK_DF_MASK 0x001e0000 -#define BB_TIMING_CONTROL_4_USE_PILOT_TRACK_DF_GET(x) (((x) & 0x001e0000) >> 17) -#define BB_TIMING_CONTROL_4_USE_PILOT_TRACK_DF_SET(x) (((x) << 17) & 0x001e0000) -#define BB_TIMING_CONTROL_4_EARLY_TRIGGER_THR_MSB 27 -#define BB_TIMING_CONTROL_4_EARLY_TRIGGER_THR_LSB 21 -#define BB_TIMING_CONTROL_4_EARLY_TRIGGER_THR_MASK 0x0fe00000 -#define BB_TIMING_CONTROL_4_EARLY_TRIGGER_THR_GET(x) (((x) & 0x0fe00000) >> 21) -#define BB_TIMING_CONTROL_4_EARLY_TRIGGER_THR_SET(x) (((x) << 21) & 0x0fe00000) -#define BB_TIMING_CONTROL_4_ENABLE_PILOT_MASK_MSB 28 -#define BB_TIMING_CONTROL_4_ENABLE_PILOT_MASK_LSB 28 -#define BB_TIMING_CONTROL_4_ENABLE_PILOT_MASK_MASK 0x10000000 -#define BB_TIMING_CONTROL_4_ENABLE_PILOT_MASK_GET(x) (((x) & 0x10000000) >> 28) -#define BB_TIMING_CONTROL_4_ENABLE_PILOT_MASK_SET(x) (((x) << 28) & 0x10000000) -#define BB_TIMING_CONTROL_4_ENABLE_CHAN_MASK_MSB 29 -#define BB_TIMING_CONTROL_4_ENABLE_CHAN_MASK_LSB 29 -#define BB_TIMING_CONTROL_4_ENABLE_CHAN_MASK_MASK 0x20000000 -#define BB_TIMING_CONTROL_4_ENABLE_CHAN_MASK_GET(x) (((x) & 0x20000000) >> 29) -#define BB_TIMING_CONTROL_4_ENABLE_CHAN_MASK_SET(x) (((x) << 29) & 0x20000000) -#define BB_TIMING_CONTROL_4_ENABLE_SPUR_FILTER_MSB 30 -#define BB_TIMING_CONTROL_4_ENABLE_SPUR_FILTER_LSB 30 -#define BB_TIMING_CONTROL_4_ENABLE_SPUR_FILTER_MASK 0x40000000 -#define BB_TIMING_CONTROL_4_ENABLE_SPUR_FILTER_GET(x) (((x) & 0x40000000) >> 30) -#define BB_TIMING_CONTROL_4_ENABLE_SPUR_FILTER_SET(x) (((x) << 30) & 0x40000000) -#define BB_TIMING_CONTROL_4_ENABLE_SPUR_RSSI_MSB 31 -#define BB_TIMING_CONTROL_4_ENABLE_SPUR_RSSI_LSB 31 -#define BB_TIMING_CONTROL_4_ENABLE_SPUR_RSSI_MASK 0x80000000 -#define BB_TIMING_CONTROL_4_ENABLE_SPUR_RSSI_GET(x) (((x) & 0x80000000) >> 31) -#define BB_TIMING_CONTROL_4_ENABLE_SPUR_RSSI_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_chn_reg_map.BB_timing_control_5 */ -#define BB_TIMING_CONTROL_5_ADDRESS 0x00000010 -#define BB_TIMING_CONTROL_5_OFFSET 0x00000010 -#define BB_TIMING_CONTROL_5_ENABLE_CYCPWR_THR1_MSB 0 -#define BB_TIMING_CONTROL_5_ENABLE_CYCPWR_THR1_LSB 0 -#define BB_TIMING_CONTROL_5_ENABLE_CYCPWR_THR1_MASK 0x00000001 -#define BB_TIMING_CONTROL_5_ENABLE_CYCPWR_THR1_GET(x) (((x) & 0x00000001) >> 0) -#define BB_TIMING_CONTROL_5_ENABLE_CYCPWR_THR1_SET(x) (((x) << 0) & 0x00000001) -#define BB_TIMING_CONTROL_5_CYCPWR_THR1_MSB 7 -#define BB_TIMING_CONTROL_5_CYCPWR_THR1_LSB 1 -#define BB_TIMING_CONTROL_5_CYCPWR_THR1_MASK 0x000000fe -#define BB_TIMING_CONTROL_5_CYCPWR_THR1_GET(x) (((x) & 0x000000fe) >> 1) -#define BB_TIMING_CONTROL_5_CYCPWR_THR1_SET(x) (((x) << 1) & 0x000000fe) -#define BB_TIMING_CONTROL_5_ENABLE_RSSI_THR1A_MSB 15 -#define BB_TIMING_CONTROL_5_ENABLE_RSSI_THR1A_LSB 15 -#define BB_TIMING_CONTROL_5_ENABLE_RSSI_THR1A_MASK 0x00008000 -#define BB_TIMING_CONTROL_5_ENABLE_RSSI_THR1A_GET(x) (((x) & 0x00008000) >> 15) -#define BB_TIMING_CONTROL_5_ENABLE_RSSI_THR1A_SET(x) (((x) << 15) & 0x00008000) -#define BB_TIMING_CONTROL_5_RSSI_THR1A_MSB 22 -#define BB_TIMING_CONTROL_5_RSSI_THR1A_LSB 16 -#define BB_TIMING_CONTROL_5_RSSI_THR1A_MASK 0x007f0000 -#define BB_TIMING_CONTROL_5_RSSI_THR1A_GET(x) (((x) & 0x007f0000) >> 16) -#define BB_TIMING_CONTROL_5_RSSI_THR1A_SET(x) (((x) << 16) & 0x007f0000) -#define BB_TIMING_CONTROL_5_LONG_SC_THRESH_HI_RSSI_MSB 29 -#define BB_TIMING_CONTROL_5_LONG_SC_THRESH_HI_RSSI_LSB 23 -#define BB_TIMING_CONTROL_5_LONG_SC_THRESH_HI_RSSI_MASK 0x3f800000 -#define BB_TIMING_CONTROL_5_LONG_SC_THRESH_HI_RSSI_GET(x) (((x) & 0x3f800000) >> 23) -#define BB_TIMING_CONTROL_5_LONG_SC_THRESH_HI_RSSI_SET(x) (((x) << 23) & 0x3f800000) -#define BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_MSB 30 -#define BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_LSB 30 -#define BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_MASK 0x40000000 -#define BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_GET(x) (((x) & 0x40000000) >> 30) -#define BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_SET(x) (((x) << 30) & 0x40000000) -#define BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_EN_MSB 31 -#define BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_EN_LSB 31 -#define BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_EN_MASK 0x80000000 -#define BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_EN_GET(x) (((x) & 0x80000000) >> 31) -#define BB_TIMING_CONTROL_5_FORCED_AGC_STR_PRI_EN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_chn_reg_map.BB_timing_control_6 */ -#define BB_TIMING_CONTROL_6_ADDRESS 0x00000014 -#define BB_TIMING_CONTROL_6_OFFSET 0x00000014 -#define BB_TIMING_CONTROL_6_HI_RSSI_THRESH_MSB 7 -#define BB_TIMING_CONTROL_6_HI_RSSI_THRESH_LSB 0 -#define BB_TIMING_CONTROL_6_HI_RSSI_THRESH_MASK 0x000000ff -#define BB_TIMING_CONTROL_6_HI_RSSI_THRESH_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_TIMING_CONTROL_6_HI_RSSI_THRESH_SET(x) (((x) << 0) & 0x000000ff) -#define BB_TIMING_CONTROL_6_EARLY_TRIGGER_THR_HI_RSSI_MSB 14 -#define BB_TIMING_CONTROL_6_EARLY_TRIGGER_THR_HI_RSSI_LSB 8 -#define BB_TIMING_CONTROL_6_EARLY_TRIGGER_THR_HI_RSSI_MASK 0x00007f00 -#define BB_TIMING_CONTROL_6_EARLY_TRIGGER_THR_HI_RSSI_GET(x) (((x) & 0x00007f00) >> 8) -#define BB_TIMING_CONTROL_6_EARLY_TRIGGER_THR_HI_RSSI_SET(x) (((x) << 8) & 0x00007f00) -#define BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_MSB 20 -#define BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_LSB 15 -#define BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_MASK 0x001f8000 -#define BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_GET(x) (((x) & 0x001f8000) >> 15) -#define BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_SET(x) (((x) << 15) & 0x001f8000) -#define BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_HI_RSSI_MSB 27 -#define BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_HI_RSSI_LSB 21 -#define BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_HI_RSSI_MASK 0x0fe00000 -#define BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_HI_RSSI_GET(x) (((x) & 0x0fe00000) >> 21) -#define BB_TIMING_CONTROL_6_OFDM_XCORR_THRESH_HI_RSSI_SET(x) (((x) << 21) & 0x0fe00000) -#define BB_TIMING_CONTROL_6_LONG_MEDIUM_RATIO_THR_MSB 31 -#define BB_TIMING_CONTROL_6_LONG_MEDIUM_RATIO_THR_LSB 28 -#define BB_TIMING_CONTROL_6_LONG_MEDIUM_RATIO_THR_MASK 0xf0000000 -#define BB_TIMING_CONTROL_6_LONG_MEDIUM_RATIO_THR_GET(x) (((x) & 0xf0000000) >> 28) -#define BB_TIMING_CONTROL_6_LONG_MEDIUM_RATIO_THR_SET(x) (((x) << 28) & 0xf0000000) - -/* macros for bb_chn_reg_map.BB_timing_control_11 */ -#define BB_TIMING_CONTROL_11_ADDRESS 0x00000018 -#define BB_TIMING_CONTROL_11_OFFSET 0x00000018 -#define BB_TIMING_CONTROL_11_SPUR_DELTA_PHASE_MSB 19 -#define BB_TIMING_CONTROL_11_SPUR_DELTA_PHASE_LSB 0 -#define BB_TIMING_CONTROL_11_SPUR_DELTA_PHASE_MASK 0x000fffff -#define BB_TIMING_CONTROL_11_SPUR_DELTA_PHASE_GET(x) (((x) & 0x000fffff) >> 0) -#define BB_TIMING_CONTROL_11_SPUR_DELTA_PHASE_SET(x) (((x) << 0) & 0x000fffff) -#define BB_TIMING_CONTROL_11_SPUR_FREQ_SD_MSB 29 -#define BB_TIMING_CONTROL_11_SPUR_FREQ_SD_LSB 20 -#define BB_TIMING_CONTROL_11_SPUR_FREQ_SD_MASK 0x3ff00000 -#define BB_TIMING_CONTROL_11_SPUR_FREQ_SD_GET(x) (((x) & 0x3ff00000) >> 20) -#define BB_TIMING_CONTROL_11_SPUR_FREQ_SD_SET(x) (((x) << 20) & 0x3ff00000) -#define BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_AGC_MSB 30 -#define BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_AGC_LSB 30 -#define BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_AGC_MASK 0x40000000 -#define BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_AGC_GET(x) (((x) & 0x40000000) >> 30) -#define BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_AGC_SET(x) (((x) << 30) & 0x40000000) -#define BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_SELFCOR_MSB 31 -#define BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_SELFCOR_LSB 31 -#define BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_SELFCOR_MASK 0x80000000 -#define BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_SELFCOR_GET(x) (((x) & 0x80000000) >> 31) -#define BB_TIMING_CONTROL_11_USE_SPUR_FILTER_IN_SELFCOR_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_chn_reg_map.BB_spur_mask_controls */ -#define BB_SPUR_MASK_CONTROLS_ADDRESS 0x0000001c -#define BB_SPUR_MASK_CONTROLS_OFFSET 0x0000001c -#define BB_SPUR_MASK_CONTROLS_SPUR_RSSI_THRESH_MSB 7 -#define BB_SPUR_MASK_CONTROLS_SPUR_RSSI_THRESH_LSB 0 -#define BB_SPUR_MASK_CONTROLS_SPUR_RSSI_THRESH_MASK 0x000000ff -#define BB_SPUR_MASK_CONTROLS_SPUR_RSSI_THRESH_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_SPUR_MASK_CONTROLS_SPUR_RSSI_THRESH_SET(x) (((x) << 0) & 0x000000ff) -#define BB_SPUR_MASK_CONTROLS_EN_VIT_SPUR_RSSI_MSB 8 -#define BB_SPUR_MASK_CONTROLS_EN_VIT_SPUR_RSSI_LSB 8 -#define BB_SPUR_MASK_CONTROLS_EN_VIT_SPUR_RSSI_MASK 0x00000100 -#define BB_SPUR_MASK_CONTROLS_EN_VIT_SPUR_RSSI_GET(x) (((x) & 0x00000100) >> 8) -#define BB_SPUR_MASK_CONTROLS_EN_VIT_SPUR_RSSI_SET(x) (((x) << 8) & 0x00000100) -#define BB_SPUR_MASK_CONTROLS_ENABLE_MASK_PPM_MSB 17 -#define BB_SPUR_MASK_CONTROLS_ENABLE_MASK_PPM_LSB 17 -#define BB_SPUR_MASK_CONTROLS_ENABLE_MASK_PPM_MASK 0x00020000 -#define BB_SPUR_MASK_CONTROLS_ENABLE_MASK_PPM_GET(x) (((x) & 0x00020000) >> 17) -#define BB_SPUR_MASK_CONTROLS_ENABLE_MASK_PPM_SET(x) (((x) << 17) & 0x00020000) -#define BB_SPUR_MASK_CONTROLS_MASK_RATE_CNTL_MSB 25 -#define BB_SPUR_MASK_CONTROLS_MASK_RATE_CNTL_LSB 18 -#define BB_SPUR_MASK_CONTROLS_MASK_RATE_CNTL_MASK 0x03fc0000 -#define BB_SPUR_MASK_CONTROLS_MASK_RATE_CNTL_GET(x) (((x) & 0x03fc0000) >> 18) -#define BB_SPUR_MASK_CONTROLS_MASK_RATE_CNTL_SET(x) (((x) << 18) & 0x03fc0000) -#define BB_SPUR_MASK_CONTROLS_ENABLE_NF_RSSI_SPUR_MIT_MSB 26 -#define BB_SPUR_MASK_CONTROLS_ENABLE_NF_RSSI_SPUR_MIT_LSB 26 -#define BB_SPUR_MASK_CONTROLS_ENABLE_NF_RSSI_SPUR_MIT_MASK 0x04000000 -#define BB_SPUR_MASK_CONTROLS_ENABLE_NF_RSSI_SPUR_MIT_GET(x) (((x) & 0x04000000) >> 26) -#define BB_SPUR_MASK_CONTROLS_ENABLE_NF_RSSI_SPUR_MIT_SET(x) (((x) << 26) & 0x04000000) - -/* macros for bb_chn_reg_map.BB_find_signal_low */ -#define BB_FIND_SIGNAL_LOW_ADDRESS 0x00000020 -#define BB_FIND_SIGNAL_LOW_OFFSET 0x00000020 -#define BB_FIND_SIGNAL_LOW_RELSTEP_LOW_MSB 5 -#define BB_FIND_SIGNAL_LOW_RELSTEP_LOW_LSB 0 -#define BB_FIND_SIGNAL_LOW_RELSTEP_LOW_MASK 0x0000003f -#define BB_FIND_SIGNAL_LOW_RELSTEP_LOW_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_FIND_SIGNAL_LOW_RELSTEP_LOW_SET(x) (((x) << 0) & 0x0000003f) -#define BB_FIND_SIGNAL_LOW_FIRSTEP_LOW_MSB 11 -#define BB_FIND_SIGNAL_LOW_FIRSTEP_LOW_LSB 6 -#define BB_FIND_SIGNAL_LOW_FIRSTEP_LOW_MASK 0x00000fc0 -#define BB_FIND_SIGNAL_LOW_FIRSTEP_LOW_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_FIND_SIGNAL_LOW_FIRSTEP_LOW_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_FIND_SIGNAL_LOW_FIRPWR_LOW_MSB 19 -#define BB_FIND_SIGNAL_LOW_FIRPWR_LOW_LSB 12 -#define BB_FIND_SIGNAL_LOW_FIRPWR_LOW_MASK 0x000ff000 -#define BB_FIND_SIGNAL_LOW_FIRPWR_LOW_GET(x) (((x) & 0x000ff000) >> 12) -#define BB_FIND_SIGNAL_LOW_FIRPWR_LOW_SET(x) (((x) << 12) & 0x000ff000) -#define BB_FIND_SIGNAL_LOW_YCOK_MAX_LOW_MSB 23 -#define BB_FIND_SIGNAL_LOW_YCOK_MAX_LOW_LSB 20 -#define BB_FIND_SIGNAL_LOW_YCOK_MAX_LOW_MASK 0x00f00000 -#define BB_FIND_SIGNAL_LOW_YCOK_MAX_LOW_GET(x) (((x) & 0x00f00000) >> 20) -#define BB_FIND_SIGNAL_LOW_YCOK_MAX_LOW_SET(x) (((x) << 20) & 0x00f00000) -#define BB_FIND_SIGNAL_LOW_LONG_SC_THRESH_MSB 30 -#define BB_FIND_SIGNAL_LOW_LONG_SC_THRESH_LSB 24 -#define BB_FIND_SIGNAL_LOW_LONG_SC_THRESH_MASK 0x7f000000 -#define BB_FIND_SIGNAL_LOW_LONG_SC_THRESH_GET(x) (((x) & 0x7f000000) >> 24) -#define BB_FIND_SIGNAL_LOW_LONG_SC_THRESH_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for bb_chn_reg_map.BB_sfcorr */ -#define BB_SFCORR_ADDRESS 0x00000024 -#define BB_SFCORR_OFFSET 0x00000024 -#define BB_SFCORR_M2COUNT_THR_MSB 4 -#define BB_SFCORR_M2COUNT_THR_LSB 0 -#define BB_SFCORR_M2COUNT_THR_MASK 0x0000001f -#define BB_SFCORR_M2COUNT_THR_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_SFCORR_M2COUNT_THR_SET(x) (((x) << 0) & 0x0000001f) -#define BB_SFCORR_ADCSAT_THRESH_MSB 10 -#define BB_SFCORR_ADCSAT_THRESH_LSB 5 -#define BB_SFCORR_ADCSAT_THRESH_MASK 0x000007e0 -#define BB_SFCORR_ADCSAT_THRESH_GET(x) (((x) & 0x000007e0) >> 5) -#define BB_SFCORR_ADCSAT_THRESH_SET(x) (((x) << 5) & 0x000007e0) -#define BB_SFCORR_ADCSAT_ICOUNT_MSB 16 -#define BB_SFCORR_ADCSAT_ICOUNT_LSB 11 -#define BB_SFCORR_ADCSAT_ICOUNT_MASK 0x0001f800 -#define BB_SFCORR_ADCSAT_ICOUNT_GET(x) (((x) & 0x0001f800) >> 11) -#define BB_SFCORR_ADCSAT_ICOUNT_SET(x) (((x) << 11) & 0x0001f800) -#define BB_SFCORR_M1_THRES_MSB 23 -#define BB_SFCORR_M1_THRES_LSB 17 -#define BB_SFCORR_M1_THRES_MASK 0x00fe0000 -#define BB_SFCORR_M1_THRES_GET(x) (((x) & 0x00fe0000) >> 17) -#define BB_SFCORR_M1_THRES_SET(x) (((x) << 17) & 0x00fe0000) -#define BB_SFCORR_M2_THRES_MSB 30 -#define BB_SFCORR_M2_THRES_LSB 24 -#define BB_SFCORR_M2_THRES_MASK 0x7f000000 -#define BB_SFCORR_M2_THRES_GET(x) (((x) & 0x7f000000) >> 24) -#define BB_SFCORR_M2_THRES_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for bb_chn_reg_map.BB_self_corr_low */ -#define BB_SELF_CORR_LOW_ADDRESS 0x00000028 -#define BB_SELF_CORR_LOW_OFFSET 0x00000028 -#define BB_SELF_CORR_LOW_USE_SELF_CORR_LOW_MSB 0 -#define BB_SELF_CORR_LOW_USE_SELF_CORR_LOW_LSB 0 -#define BB_SELF_CORR_LOW_USE_SELF_CORR_LOW_MASK 0x00000001 -#define BB_SELF_CORR_LOW_USE_SELF_CORR_LOW_GET(x) (((x) & 0x00000001) >> 0) -#define BB_SELF_CORR_LOW_USE_SELF_CORR_LOW_SET(x) (((x) << 0) & 0x00000001) -#define BB_SELF_CORR_LOW_M1COUNT_MAX_LOW_MSB 7 -#define BB_SELF_CORR_LOW_M1COUNT_MAX_LOW_LSB 1 -#define BB_SELF_CORR_LOW_M1COUNT_MAX_LOW_MASK 0x000000fe -#define BB_SELF_CORR_LOW_M1COUNT_MAX_LOW_GET(x) (((x) & 0x000000fe) >> 1) -#define BB_SELF_CORR_LOW_M1COUNT_MAX_LOW_SET(x) (((x) << 1) & 0x000000fe) -#define BB_SELF_CORR_LOW_M2COUNT_THR_LOW_MSB 13 -#define BB_SELF_CORR_LOW_M2COUNT_THR_LOW_LSB 8 -#define BB_SELF_CORR_LOW_M2COUNT_THR_LOW_MASK 0x00003f00 -#define BB_SELF_CORR_LOW_M2COUNT_THR_LOW_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_SELF_CORR_LOW_M2COUNT_THR_LOW_SET(x) (((x) << 8) & 0x00003f00) -#define BB_SELF_CORR_LOW_M1_THRESH_LOW_MSB 20 -#define BB_SELF_CORR_LOW_M1_THRESH_LOW_LSB 14 -#define BB_SELF_CORR_LOW_M1_THRESH_LOW_MASK 0x001fc000 -#define BB_SELF_CORR_LOW_M1_THRESH_LOW_GET(x) (((x) & 0x001fc000) >> 14) -#define BB_SELF_CORR_LOW_M1_THRESH_LOW_SET(x) (((x) << 14) & 0x001fc000) -#define BB_SELF_CORR_LOW_M2_THRESH_LOW_MSB 27 -#define BB_SELF_CORR_LOW_M2_THRESH_LOW_LSB 21 -#define BB_SELF_CORR_LOW_M2_THRESH_LOW_MASK 0x0fe00000 -#define BB_SELF_CORR_LOW_M2_THRESH_LOW_GET(x) (((x) & 0x0fe00000) >> 21) -#define BB_SELF_CORR_LOW_M2_THRESH_LOW_SET(x) (((x) << 21) & 0x0fe00000) - -/* macros for bb_chn_reg_map.BB_ext_chan_scorr_thr */ -#define BB_EXT_CHAN_SCORR_THR_ADDRESS 0x0000002c -#define BB_EXT_CHAN_SCORR_THR_OFFSET 0x0000002c -#define BB_EXT_CHAN_SCORR_THR_M1_THRES_EXT_MSB 6 -#define BB_EXT_CHAN_SCORR_THR_M1_THRES_EXT_LSB 0 -#define BB_EXT_CHAN_SCORR_THR_M1_THRES_EXT_MASK 0x0000007f -#define BB_EXT_CHAN_SCORR_THR_M1_THRES_EXT_GET(x) (((x) & 0x0000007f) >> 0) -#define BB_EXT_CHAN_SCORR_THR_M1_THRES_EXT_SET(x) (((x) << 0) & 0x0000007f) -#define BB_EXT_CHAN_SCORR_THR_M2_THRES_EXT_MSB 13 -#define BB_EXT_CHAN_SCORR_THR_M2_THRES_EXT_LSB 7 -#define BB_EXT_CHAN_SCORR_THR_M2_THRES_EXT_MASK 0x00003f80 -#define BB_EXT_CHAN_SCORR_THR_M2_THRES_EXT_GET(x) (((x) & 0x00003f80) >> 7) -#define BB_EXT_CHAN_SCORR_THR_M2_THRES_EXT_SET(x) (((x) << 7) & 0x00003f80) -#define BB_EXT_CHAN_SCORR_THR_M1_THRES_LOW_EXT_MSB 20 -#define BB_EXT_CHAN_SCORR_THR_M1_THRES_LOW_EXT_LSB 14 -#define BB_EXT_CHAN_SCORR_THR_M1_THRES_LOW_EXT_MASK 0x001fc000 -#define BB_EXT_CHAN_SCORR_THR_M1_THRES_LOW_EXT_GET(x) (((x) & 0x001fc000) >> 14) -#define BB_EXT_CHAN_SCORR_THR_M1_THRES_LOW_EXT_SET(x) (((x) << 14) & 0x001fc000) -#define BB_EXT_CHAN_SCORR_THR_M2_THRES_LOW_EXT_MSB 27 -#define BB_EXT_CHAN_SCORR_THR_M2_THRES_LOW_EXT_LSB 21 -#define BB_EXT_CHAN_SCORR_THR_M2_THRES_LOW_EXT_MASK 0x0fe00000 -#define BB_EXT_CHAN_SCORR_THR_M2_THRES_LOW_EXT_GET(x) (((x) & 0x0fe00000) >> 21) -#define BB_EXT_CHAN_SCORR_THR_M2_THRES_LOW_EXT_SET(x) (((x) << 21) & 0x0fe00000) -#define BB_EXT_CHAN_SCORR_THR_SPUR_SUBCHANNEL_SD_MSB 28 -#define BB_EXT_CHAN_SCORR_THR_SPUR_SUBCHANNEL_SD_LSB 28 -#define BB_EXT_CHAN_SCORR_THR_SPUR_SUBCHANNEL_SD_MASK 0x10000000 -#define BB_EXT_CHAN_SCORR_THR_SPUR_SUBCHANNEL_SD_GET(x) (((x) & 0x10000000) >> 28) -#define BB_EXT_CHAN_SCORR_THR_SPUR_SUBCHANNEL_SD_SET(x) (((x) << 28) & 0x10000000) - -/* macros for bb_chn_reg_map.BB_ext_chan_pwr_thr_2_b0 */ -#define BB_EXT_CHAN_PWR_THR_2_B0_ADDRESS 0x00000030 -#define BB_EXT_CHAN_PWR_THR_2_B0_OFFSET 0x00000030 -#define BB_EXT_CHAN_PWR_THR_2_B0_CF_MAXCCAPWR_EXT_0_MSB 8 -#define BB_EXT_CHAN_PWR_THR_2_B0_CF_MAXCCAPWR_EXT_0_LSB 0 -#define BB_EXT_CHAN_PWR_THR_2_B0_CF_MAXCCAPWR_EXT_0_MASK 0x000001ff -#define BB_EXT_CHAN_PWR_THR_2_B0_CF_MAXCCAPWR_EXT_0_GET(x) (((x) & 0x000001ff) >> 0) -#define BB_EXT_CHAN_PWR_THR_2_B0_CF_MAXCCAPWR_EXT_0_SET(x) (((x) << 0) & 0x000001ff) -#define BB_EXT_CHAN_PWR_THR_2_B0_CYCPWR_THR1_EXT_MSB 15 -#define BB_EXT_CHAN_PWR_THR_2_B0_CYCPWR_THR1_EXT_LSB 9 -#define BB_EXT_CHAN_PWR_THR_2_B0_CYCPWR_THR1_EXT_MASK 0x0000fe00 -#define BB_EXT_CHAN_PWR_THR_2_B0_CYCPWR_THR1_EXT_GET(x) (((x) & 0x0000fe00) >> 9) -#define BB_EXT_CHAN_PWR_THR_2_B0_CYCPWR_THR1_EXT_SET(x) (((x) << 9) & 0x0000fe00) -#define BB_EXT_CHAN_PWR_THR_2_B0_MINCCAPWR_EXT_0_MSB 24 -#define BB_EXT_CHAN_PWR_THR_2_B0_MINCCAPWR_EXT_0_LSB 16 -#define BB_EXT_CHAN_PWR_THR_2_B0_MINCCAPWR_EXT_0_MASK 0x01ff0000 -#define BB_EXT_CHAN_PWR_THR_2_B0_MINCCAPWR_EXT_0_GET(x) (((x) & 0x01ff0000) >> 16) - -/* macros for bb_chn_reg_map.BB_radar_detection */ -#define BB_RADAR_DETECTION_ADDRESS 0x00000034 -#define BB_RADAR_DETECTION_OFFSET 0x00000034 -#define BB_RADAR_DETECTION_PULSE_DETECT_ENABLE_MSB 0 -#define BB_RADAR_DETECTION_PULSE_DETECT_ENABLE_LSB 0 -#define BB_RADAR_DETECTION_PULSE_DETECT_ENABLE_MASK 0x00000001 -#define BB_RADAR_DETECTION_PULSE_DETECT_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define BB_RADAR_DETECTION_PULSE_DETECT_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define BB_RADAR_DETECTION_PULSE_IN_BAND_THRESH_MSB 5 -#define BB_RADAR_DETECTION_PULSE_IN_BAND_THRESH_LSB 1 -#define BB_RADAR_DETECTION_PULSE_IN_BAND_THRESH_MASK 0x0000003e -#define BB_RADAR_DETECTION_PULSE_IN_BAND_THRESH_GET(x) (((x) & 0x0000003e) >> 1) -#define BB_RADAR_DETECTION_PULSE_IN_BAND_THRESH_SET(x) (((x) << 1) & 0x0000003e) -#define BB_RADAR_DETECTION_PULSE_RSSI_THRESH_MSB 11 -#define BB_RADAR_DETECTION_PULSE_RSSI_THRESH_LSB 6 -#define BB_RADAR_DETECTION_PULSE_RSSI_THRESH_MASK 0x00000fc0 -#define BB_RADAR_DETECTION_PULSE_RSSI_THRESH_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_RADAR_DETECTION_PULSE_RSSI_THRESH_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_RADAR_DETECTION_PULSE_HEIGHT_THRESH_MSB 17 -#define BB_RADAR_DETECTION_PULSE_HEIGHT_THRESH_LSB 12 -#define BB_RADAR_DETECTION_PULSE_HEIGHT_THRESH_MASK 0x0003f000 -#define BB_RADAR_DETECTION_PULSE_HEIGHT_THRESH_GET(x) (((x) & 0x0003f000) >> 12) -#define BB_RADAR_DETECTION_PULSE_HEIGHT_THRESH_SET(x) (((x) << 12) & 0x0003f000) -#define BB_RADAR_DETECTION_RADAR_RSSI_THRESH_MSB 23 -#define BB_RADAR_DETECTION_RADAR_RSSI_THRESH_LSB 18 -#define BB_RADAR_DETECTION_RADAR_RSSI_THRESH_MASK 0x00fc0000 -#define BB_RADAR_DETECTION_RADAR_RSSI_THRESH_GET(x) (((x) & 0x00fc0000) >> 18) -#define BB_RADAR_DETECTION_RADAR_RSSI_THRESH_SET(x) (((x) << 18) & 0x00fc0000) -#define BB_RADAR_DETECTION_RADAR_FIRPWR_THRESH_MSB 30 -#define BB_RADAR_DETECTION_RADAR_FIRPWR_THRESH_LSB 24 -#define BB_RADAR_DETECTION_RADAR_FIRPWR_THRESH_MASK 0x7f000000 -#define BB_RADAR_DETECTION_RADAR_FIRPWR_THRESH_GET(x) (((x) & 0x7f000000) >> 24) -#define BB_RADAR_DETECTION_RADAR_FIRPWR_THRESH_SET(x) (((x) << 24) & 0x7f000000) -#define BB_RADAR_DETECTION_ENABLE_RADAR_FFT_MSB 31 -#define BB_RADAR_DETECTION_ENABLE_RADAR_FFT_LSB 31 -#define BB_RADAR_DETECTION_ENABLE_RADAR_FFT_MASK 0x80000000 -#define BB_RADAR_DETECTION_ENABLE_RADAR_FFT_GET(x) (((x) & 0x80000000) >> 31) -#define BB_RADAR_DETECTION_ENABLE_RADAR_FFT_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_chn_reg_map.BB_radar_detection_2 */ -#define BB_RADAR_DETECTION_2_ADDRESS 0x00000038 -#define BB_RADAR_DETECTION_2_OFFSET 0x00000038 -#define BB_RADAR_DETECTION_2_RADAR_LENGTH_MAX_MSB 7 -#define BB_RADAR_DETECTION_2_RADAR_LENGTH_MAX_LSB 0 -#define BB_RADAR_DETECTION_2_RADAR_LENGTH_MAX_MASK 0x000000ff -#define BB_RADAR_DETECTION_2_RADAR_LENGTH_MAX_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_RADAR_DETECTION_2_RADAR_LENGTH_MAX_SET(x) (((x) << 0) & 0x000000ff) -#define BB_RADAR_DETECTION_2_PULSE_RELSTEP_THRESH_MSB 12 -#define BB_RADAR_DETECTION_2_PULSE_RELSTEP_THRESH_LSB 8 -#define BB_RADAR_DETECTION_2_PULSE_RELSTEP_THRESH_MASK 0x00001f00 -#define BB_RADAR_DETECTION_2_PULSE_RELSTEP_THRESH_GET(x) (((x) & 0x00001f00) >> 8) -#define BB_RADAR_DETECTION_2_PULSE_RELSTEP_THRESH_SET(x) (((x) << 8) & 0x00001f00) -#define BB_RADAR_DETECTION_2_ENABLE_PULSE_RELSTEP_CHECK_MSB 13 -#define BB_RADAR_DETECTION_2_ENABLE_PULSE_RELSTEP_CHECK_LSB 13 -#define BB_RADAR_DETECTION_2_ENABLE_PULSE_RELSTEP_CHECK_MASK 0x00002000 -#define BB_RADAR_DETECTION_2_ENABLE_PULSE_RELSTEP_CHECK_GET(x) (((x) & 0x00002000) >> 13) -#define BB_RADAR_DETECTION_2_ENABLE_PULSE_RELSTEP_CHECK_SET(x) (((x) << 13) & 0x00002000) -#define BB_RADAR_DETECTION_2_ENABLE_MAX_RADAR_RSSI_MSB 14 -#define BB_RADAR_DETECTION_2_ENABLE_MAX_RADAR_RSSI_LSB 14 -#define BB_RADAR_DETECTION_2_ENABLE_MAX_RADAR_RSSI_MASK 0x00004000 -#define BB_RADAR_DETECTION_2_ENABLE_MAX_RADAR_RSSI_GET(x) (((x) & 0x00004000) >> 14) -#define BB_RADAR_DETECTION_2_ENABLE_MAX_RADAR_RSSI_SET(x) (((x) << 14) & 0x00004000) -#define BB_RADAR_DETECTION_2_ENABLE_BLOCK_RADAR_CHECK_MSB 15 -#define BB_RADAR_DETECTION_2_ENABLE_BLOCK_RADAR_CHECK_LSB 15 -#define BB_RADAR_DETECTION_2_ENABLE_BLOCK_RADAR_CHECK_MASK 0x00008000 -#define BB_RADAR_DETECTION_2_ENABLE_BLOCK_RADAR_CHECK_GET(x) (((x) & 0x00008000) >> 15) -#define BB_RADAR_DETECTION_2_ENABLE_BLOCK_RADAR_CHECK_SET(x) (((x) << 15) & 0x00008000) -#define BB_RADAR_DETECTION_2_RADAR_RELPWR_THRESH_MSB 21 -#define BB_RADAR_DETECTION_2_RADAR_RELPWR_THRESH_LSB 16 -#define BB_RADAR_DETECTION_2_RADAR_RELPWR_THRESH_MASK 0x003f0000 -#define BB_RADAR_DETECTION_2_RADAR_RELPWR_THRESH_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_RADAR_DETECTION_2_RADAR_RELPWR_THRESH_SET(x) (((x) << 16) & 0x003f0000) -#define BB_RADAR_DETECTION_2_RADAR_USE_FIRPWR_128_MSB 22 -#define BB_RADAR_DETECTION_2_RADAR_USE_FIRPWR_128_LSB 22 -#define BB_RADAR_DETECTION_2_RADAR_USE_FIRPWR_128_MASK 0x00400000 -#define BB_RADAR_DETECTION_2_RADAR_USE_FIRPWR_128_GET(x) (((x) & 0x00400000) >> 22) -#define BB_RADAR_DETECTION_2_RADAR_USE_FIRPWR_128_SET(x) (((x) << 22) & 0x00400000) -#define BB_RADAR_DETECTION_2_ENABLE_RADAR_RELPWR_CHECK_MSB 23 -#define BB_RADAR_DETECTION_2_ENABLE_RADAR_RELPWR_CHECK_LSB 23 -#define BB_RADAR_DETECTION_2_ENABLE_RADAR_RELPWR_CHECK_MASK 0x00800000 -#define BB_RADAR_DETECTION_2_ENABLE_RADAR_RELPWR_CHECK_GET(x) (((x) & 0x00800000) >> 23) -#define BB_RADAR_DETECTION_2_ENABLE_RADAR_RELPWR_CHECK_SET(x) (((x) << 23) & 0x00800000) -#define BB_RADAR_DETECTION_2_CF_RADAR_BIN_THRESH_SEL_MSB 26 -#define BB_RADAR_DETECTION_2_CF_RADAR_BIN_THRESH_SEL_LSB 24 -#define BB_RADAR_DETECTION_2_CF_RADAR_BIN_THRESH_SEL_MASK 0x07000000 -#define BB_RADAR_DETECTION_2_CF_RADAR_BIN_THRESH_SEL_GET(x) (((x) & 0x07000000) >> 24) -#define BB_RADAR_DETECTION_2_CF_RADAR_BIN_THRESH_SEL_SET(x) (((x) << 24) & 0x07000000) -#define BB_RADAR_DETECTION_2_ENABLE_PULSE_GC_COUNT_CHECK_MSB 27 -#define BB_RADAR_DETECTION_2_ENABLE_PULSE_GC_COUNT_CHECK_LSB 27 -#define BB_RADAR_DETECTION_2_ENABLE_PULSE_GC_COUNT_CHECK_MASK 0x08000000 -#define BB_RADAR_DETECTION_2_ENABLE_PULSE_GC_COUNT_CHECK_GET(x) (((x) & 0x08000000) >> 27) -#define BB_RADAR_DETECTION_2_ENABLE_PULSE_GC_COUNT_CHECK_SET(x) (((x) << 27) & 0x08000000) - -/* macros for bb_chn_reg_map.BB_extension_radar */ -#define BB_EXTENSION_RADAR_ADDRESS 0x0000003c -#define BB_EXTENSION_RADAR_OFFSET 0x0000003c -#define BB_EXTENSION_RADAR_BLOCKER40_MAX_RADAR_MSB 13 -#define BB_EXTENSION_RADAR_BLOCKER40_MAX_RADAR_LSB 8 -#define BB_EXTENSION_RADAR_BLOCKER40_MAX_RADAR_MASK 0x00003f00 -#define BB_EXTENSION_RADAR_BLOCKER40_MAX_RADAR_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_EXTENSION_RADAR_BLOCKER40_MAX_RADAR_SET(x) (((x) << 8) & 0x00003f00) -#define BB_EXTENSION_RADAR_ENABLE_EXT_RADAR_MSB 14 -#define BB_EXTENSION_RADAR_ENABLE_EXT_RADAR_LSB 14 -#define BB_EXTENSION_RADAR_ENABLE_EXT_RADAR_MASK 0x00004000 -#define BB_EXTENSION_RADAR_ENABLE_EXT_RADAR_GET(x) (((x) & 0x00004000) >> 14) -#define BB_EXTENSION_RADAR_ENABLE_EXT_RADAR_SET(x) (((x) << 14) & 0x00004000) -#define BB_EXTENSION_RADAR_RADAR_DC_PWR_THRESH_MSB 22 -#define BB_EXTENSION_RADAR_RADAR_DC_PWR_THRESH_LSB 15 -#define BB_EXTENSION_RADAR_RADAR_DC_PWR_THRESH_MASK 0x007f8000 -#define BB_EXTENSION_RADAR_RADAR_DC_PWR_THRESH_GET(x) (((x) & 0x007f8000) >> 15) -#define BB_EXTENSION_RADAR_RADAR_DC_PWR_THRESH_SET(x) (((x) << 15) & 0x007f8000) -#define BB_EXTENSION_RADAR_RADAR_LB_DC_CAP_MSB 30 -#define BB_EXTENSION_RADAR_RADAR_LB_DC_CAP_LSB 23 -#define BB_EXTENSION_RADAR_RADAR_LB_DC_CAP_MASK 0x7f800000 -#define BB_EXTENSION_RADAR_RADAR_LB_DC_CAP_GET(x) (((x) & 0x7f800000) >> 23) -#define BB_EXTENSION_RADAR_RADAR_LB_DC_CAP_SET(x) (((x) << 23) & 0x7f800000) -#define BB_EXTENSION_RADAR_DISABLE_ADCSAT_HOLD_MSB 31 -#define BB_EXTENSION_RADAR_DISABLE_ADCSAT_HOLD_LSB 31 -#define BB_EXTENSION_RADAR_DISABLE_ADCSAT_HOLD_MASK 0x80000000 -#define BB_EXTENSION_RADAR_DISABLE_ADCSAT_HOLD_GET(x) (((x) & 0x80000000) >> 31) -#define BB_EXTENSION_RADAR_DISABLE_ADCSAT_HOLD_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_chn_reg_map.BB_multichain_control */ -#define BB_MULTICHAIN_CONTROL_ADDRESS 0x00000080 -#define BB_MULTICHAIN_CONTROL_OFFSET 0x00000080 -#define BB_MULTICHAIN_CONTROL_FORCE_ANALOG_GAIN_DIFF_MSB 0 -#define BB_MULTICHAIN_CONTROL_FORCE_ANALOG_GAIN_DIFF_LSB 0 -#define BB_MULTICHAIN_CONTROL_FORCE_ANALOG_GAIN_DIFF_MASK 0x00000001 -#define BB_MULTICHAIN_CONTROL_FORCE_ANALOG_GAIN_DIFF_GET(x) (((x) & 0x00000001) >> 0) -#define BB_MULTICHAIN_CONTROL_FORCE_ANALOG_GAIN_DIFF_SET(x) (((x) << 0) & 0x00000001) -#define BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_01_MSB 7 -#define BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_01_LSB 1 -#define BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_01_MASK 0x000000fe -#define BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_01_GET(x) (((x) & 0x000000fe) >> 1) -#define BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_01_SET(x) (((x) << 1) & 0x000000fe) -#define BB_MULTICHAIN_CONTROL_SYNC_SYNTHON_MSB 8 -#define BB_MULTICHAIN_CONTROL_SYNC_SYNTHON_LSB 8 -#define BB_MULTICHAIN_CONTROL_SYNC_SYNTHON_MASK 0x00000100 -#define BB_MULTICHAIN_CONTROL_SYNC_SYNTHON_GET(x) (((x) & 0x00000100) >> 8) -#define BB_MULTICHAIN_CONTROL_SYNC_SYNTHON_SET(x) (((x) << 8) & 0x00000100) -#define BB_MULTICHAIN_CONTROL_USE_POSEDGE_REFCLK_MSB 9 -#define BB_MULTICHAIN_CONTROL_USE_POSEDGE_REFCLK_LSB 9 -#define BB_MULTICHAIN_CONTROL_USE_POSEDGE_REFCLK_MASK 0x00000200 -#define BB_MULTICHAIN_CONTROL_USE_POSEDGE_REFCLK_GET(x) (((x) & 0x00000200) >> 9) -#define BB_MULTICHAIN_CONTROL_USE_POSEDGE_REFCLK_SET(x) (((x) << 9) & 0x00000200) -#define BB_MULTICHAIN_CONTROL_CF_SHORT_SAT_MSB 20 -#define BB_MULTICHAIN_CONTROL_CF_SHORT_SAT_LSB 10 -#define BB_MULTICHAIN_CONTROL_CF_SHORT_SAT_MASK 0x001ffc00 -#define BB_MULTICHAIN_CONTROL_CF_SHORT_SAT_GET(x) (((x) & 0x001ffc00) >> 10) -#define BB_MULTICHAIN_CONTROL_CF_SHORT_SAT_SET(x) (((x) << 10) & 0x001ffc00) -#define BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_02_MSB 28 -#define BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_02_LSB 22 -#define BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_02_MASK 0x1fc00000 -#define BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_02_GET(x) (((x) & 0x1fc00000) >> 22) -#define BB_MULTICHAIN_CONTROL_FORCED_GAIN_DIFF_02_SET(x) (((x) << 22) & 0x1fc00000) -#define BB_MULTICHAIN_CONTROL_FORCE_SIGMA_ZERO_MSB 29 -#define BB_MULTICHAIN_CONTROL_FORCE_SIGMA_ZERO_LSB 29 -#define BB_MULTICHAIN_CONTROL_FORCE_SIGMA_ZERO_MASK 0x20000000 -#define BB_MULTICHAIN_CONTROL_FORCE_SIGMA_ZERO_GET(x) (((x) & 0x20000000) >> 29) -#define BB_MULTICHAIN_CONTROL_FORCE_SIGMA_ZERO_SET(x) (((x) << 29) & 0x20000000) - -/* macros for bb_chn_reg_map.BB_per_chain_csd */ -#define BB_PER_CHAIN_CSD_ADDRESS 0x00000084 -#define BB_PER_CHAIN_CSD_OFFSET 0x00000084 -#define BB_PER_CHAIN_CSD_CSD_CHN1_2CHAINS_MSB 4 -#define BB_PER_CHAIN_CSD_CSD_CHN1_2CHAINS_LSB 0 -#define BB_PER_CHAIN_CSD_CSD_CHN1_2CHAINS_MASK 0x0000001f -#define BB_PER_CHAIN_CSD_CSD_CHN1_2CHAINS_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_PER_CHAIN_CSD_CSD_CHN1_2CHAINS_SET(x) (((x) << 0) & 0x0000001f) -#define BB_PER_CHAIN_CSD_CSD_CHN1_3CHAINS_MSB 9 -#define BB_PER_CHAIN_CSD_CSD_CHN1_3CHAINS_LSB 5 -#define BB_PER_CHAIN_CSD_CSD_CHN1_3CHAINS_MASK 0x000003e0 -#define BB_PER_CHAIN_CSD_CSD_CHN1_3CHAINS_GET(x) (((x) & 0x000003e0) >> 5) -#define BB_PER_CHAIN_CSD_CSD_CHN1_3CHAINS_SET(x) (((x) << 5) & 0x000003e0) -#define BB_PER_CHAIN_CSD_CSD_CHN2_3CHAINS_MSB 14 -#define BB_PER_CHAIN_CSD_CSD_CHN2_3CHAINS_LSB 10 -#define BB_PER_CHAIN_CSD_CSD_CHN2_3CHAINS_MASK 0x00007c00 -#define BB_PER_CHAIN_CSD_CSD_CHN2_3CHAINS_GET(x) (((x) & 0x00007c00) >> 10) -#define BB_PER_CHAIN_CSD_CSD_CHN2_3CHAINS_SET(x) (((x) << 10) & 0x00007c00) - -/* macros for bb_chn_reg_map.BB_tx_crc */ -#define BB_TX_CRC_ADDRESS 0x000000a0 -#define BB_TX_CRC_OFFSET 0x000000a0 -#define BB_TX_CRC_TX_CRC_MSB 15 -#define BB_TX_CRC_TX_CRC_LSB 0 -#define BB_TX_CRC_TX_CRC_MASK 0x0000ffff -#define BB_TX_CRC_TX_CRC_GET(x) (((x) & 0x0000ffff) >> 0) - -/* macros for bb_chn_reg_map.BB_tstdac_constant */ -#define BB_TSTDAC_CONSTANT_ADDRESS 0x000000a4 -#define BB_TSTDAC_CONSTANT_OFFSET 0x000000a4 -#define BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_I_MSB 10 -#define BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_I_LSB 0 -#define BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_I_MASK 0x000007ff -#define BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_I_GET(x) (((x) & 0x000007ff) >> 0) -#define BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_I_SET(x) (((x) << 0) & 0x000007ff) -#define BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_Q_MSB 21 -#define BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_Q_LSB 11 -#define BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_Q_MASK 0x003ff800 -#define BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_Q_GET(x) (((x) & 0x003ff800) >> 11) -#define BB_TSTDAC_CONSTANT_CF_TSTDAC_CONSTANT_Q_SET(x) (((x) << 11) & 0x003ff800) - -/* macros for bb_chn_reg_map.BB_spur_report_b0 */ -#define BB_SPUR_REPORT_B0_ADDRESS 0x000000a8 -#define BB_SPUR_REPORT_B0_OFFSET 0x000000a8 -#define BB_SPUR_REPORT_B0_SPUR_EST_I_0_MSB 7 -#define BB_SPUR_REPORT_B0_SPUR_EST_I_0_LSB 0 -#define BB_SPUR_REPORT_B0_SPUR_EST_I_0_MASK 0x000000ff -#define BB_SPUR_REPORT_B0_SPUR_EST_I_0_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_SPUR_REPORT_B0_SPUR_EST_Q_0_MSB 15 -#define BB_SPUR_REPORT_B0_SPUR_EST_Q_0_LSB 8 -#define BB_SPUR_REPORT_B0_SPUR_EST_Q_0_MASK 0x0000ff00 -#define BB_SPUR_REPORT_B0_SPUR_EST_Q_0_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_SPUR_REPORT_B0_POWER_WITH_SPUR_REMOVED_0_MSB 31 -#define BB_SPUR_REPORT_B0_POWER_WITH_SPUR_REMOVED_0_LSB 16 -#define BB_SPUR_REPORT_B0_POWER_WITH_SPUR_REMOVED_0_MASK 0xffff0000 -#define BB_SPUR_REPORT_B0_POWER_WITH_SPUR_REMOVED_0_GET(x) (((x) & 0xffff0000) >> 16) - -/* macros for bb_chn_reg_map.BB_txiqcal_control_3 */ -#define BB_TXIQCAL_CONTROL_3_ADDRESS 0x000000b0 -#define BB_TXIQCAL_CONTROL_3_OFFSET 0x000000b0 -#define BB_TXIQCAL_CONTROL_3_PWR_HIGH_DB_MSB 5 -#define BB_TXIQCAL_CONTROL_3_PWR_HIGH_DB_LSB 0 -#define BB_TXIQCAL_CONTROL_3_PWR_HIGH_DB_MASK 0x0000003f -#define BB_TXIQCAL_CONTROL_3_PWR_HIGH_DB_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_TXIQCAL_CONTROL_3_PWR_HIGH_DB_SET(x) (((x) << 0) & 0x0000003f) -#define BB_TXIQCAL_CONTROL_3_PWR_LOW_DB_MSB 11 -#define BB_TXIQCAL_CONTROL_3_PWR_LOW_DB_LSB 6 -#define BB_TXIQCAL_CONTROL_3_PWR_LOW_DB_MASK 0x00000fc0 -#define BB_TXIQCAL_CONTROL_3_PWR_LOW_DB_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_TXIQCAL_CONTROL_3_PWR_LOW_DB_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_TXIQCAL_CONTROL_3_IQCAL_TONE_PHS_STEP_MSB 21 -#define BB_TXIQCAL_CONTROL_3_IQCAL_TONE_PHS_STEP_LSB 12 -#define BB_TXIQCAL_CONTROL_3_IQCAL_TONE_PHS_STEP_MASK 0x003ff000 -#define BB_TXIQCAL_CONTROL_3_IQCAL_TONE_PHS_STEP_GET(x) (((x) & 0x003ff000) >> 12) -#define BB_TXIQCAL_CONTROL_3_IQCAL_TONE_PHS_STEP_SET(x) (((x) << 12) & 0x003ff000) -#define BB_TXIQCAL_CONTROL_3_DC_EST_LEN_MSB 23 -#define BB_TXIQCAL_CONTROL_3_DC_EST_LEN_LSB 22 -#define BB_TXIQCAL_CONTROL_3_DC_EST_LEN_MASK 0x00c00000 -#define BB_TXIQCAL_CONTROL_3_DC_EST_LEN_GET(x) (((x) & 0x00c00000) >> 22) -#define BB_TXIQCAL_CONTROL_3_DC_EST_LEN_SET(x) (((x) << 22) & 0x00c00000) -#define BB_TXIQCAL_CONTROL_3_ADC_SAT_LEN_MSB 24 -#define BB_TXIQCAL_CONTROL_3_ADC_SAT_LEN_LSB 24 -#define BB_TXIQCAL_CONTROL_3_ADC_SAT_LEN_MASK 0x01000000 -#define BB_TXIQCAL_CONTROL_3_ADC_SAT_LEN_GET(x) (((x) & 0x01000000) >> 24) -#define BB_TXIQCAL_CONTROL_3_ADC_SAT_LEN_SET(x) (((x) << 24) & 0x01000000) -#define BB_TXIQCAL_CONTROL_3_ADC_SAT_SEL_MSB 26 -#define BB_TXIQCAL_CONTROL_3_ADC_SAT_SEL_LSB 25 -#define BB_TXIQCAL_CONTROL_3_ADC_SAT_SEL_MASK 0x06000000 -#define BB_TXIQCAL_CONTROL_3_ADC_SAT_SEL_GET(x) (((x) & 0x06000000) >> 25) -#define BB_TXIQCAL_CONTROL_3_ADC_SAT_SEL_SET(x) (((x) << 25) & 0x06000000) -#define BB_TXIQCAL_CONTROL_3_IQCAL_MEAS_LEN_MSB 28 -#define BB_TXIQCAL_CONTROL_3_IQCAL_MEAS_LEN_LSB 27 -#define BB_TXIQCAL_CONTROL_3_IQCAL_MEAS_LEN_MASK 0x18000000 -#define BB_TXIQCAL_CONTROL_3_IQCAL_MEAS_LEN_GET(x) (((x) & 0x18000000) >> 27) -#define BB_TXIQCAL_CONTROL_3_IQCAL_MEAS_LEN_SET(x) (((x) << 27) & 0x18000000) -#define BB_TXIQCAL_CONTROL_3_DESIRED_SIZE_DB_MSB 30 -#define BB_TXIQCAL_CONTROL_3_DESIRED_SIZE_DB_LSB 29 -#define BB_TXIQCAL_CONTROL_3_DESIRED_SIZE_DB_MASK 0x60000000 -#define BB_TXIQCAL_CONTROL_3_DESIRED_SIZE_DB_GET(x) (((x) & 0x60000000) >> 29) -#define BB_TXIQCAL_CONTROL_3_DESIRED_SIZE_DB_SET(x) (((x) << 29) & 0x60000000) -#define BB_TXIQCAL_CONTROL_3_TX_IQCORR_EN_MSB 31 -#define BB_TXIQCAL_CONTROL_3_TX_IQCORR_EN_LSB 31 -#define BB_TXIQCAL_CONTROL_3_TX_IQCORR_EN_MASK 0x80000000 -#define BB_TXIQCAL_CONTROL_3_TX_IQCORR_EN_GET(x) (((x) & 0x80000000) >> 31) -#define BB_TXIQCAL_CONTROL_3_TX_IQCORR_EN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_chn_reg_map.BB_green_tx_control_1 */ -#define BB_GREEN_TX_CONTROL_1_ADDRESS 0x000000bc -#define BB_GREEN_TX_CONTROL_1_OFFSET 0x000000bc -#define BB_GREEN_TX_CONTROL_1_GREEN_TX_ENABLE_MSB 0 -#define BB_GREEN_TX_CONTROL_1_GREEN_TX_ENABLE_LSB 0 -#define BB_GREEN_TX_CONTROL_1_GREEN_TX_ENABLE_MASK 0x00000001 -#define BB_GREEN_TX_CONTROL_1_GREEN_TX_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define BB_GREEN_TX_CONTROL_1_GREEN_TX_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define BB_GREEN_TX_CONTROL_1_GREEN_CASES_MSB 1 -#define BB_GREEN_TX_CONTROL_1_GREEN_CASES_LSB 1 -#define BB_GREEN_TX_CONTROL_1_GREEN_CASES_MASK 0x00000002 -#define BB_GREEN_TX_CONTROL_1_GREEN_CASES_GET(x) (((x) & 0x00000002) >> 1) -#define BB_GREEN_TX_CONTROL_1_GREEN_CASES_SET(x) (((x) << 1) & 0x00000002) - -/* macros for bb_chn_reg_map.BB_iq_adc_meas_0_b0 */ -#define BB_IQ_ADC_MEAS_0_B0_ADDRESS 0x000000c0 -#define BB_IQ_ADC_MEAS_0_B0_OFFSET 0x000000c0 -#define BB_IQ_ADC_MEAS_0_B0_GAIN_DC_IQ_CAL_MEAS_0_0_MSB 31 -#define BB_IQ_ADC_MEAS_0_B0_GAIN_DC_IQ_CAL_MEAS_0_0_LSB 0 -#define BB_IQ_ADC_MEAS_0_B0_GAIN_DC_IQ_CAL_MEAS_0_0_MASK 0xffffffff -#define BB_IQ_ADC_MEAS_0_B0_GAIN_DC_IQ_CAL_MEAS_0_0_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for bb_chn_reg_map.BB_iq_adc_meas_1_b0 */ -#define BB_IQ_ADC_MEAS_1_B0_ADDRESS 0x000000c4 -#define BB_IQ_ADC_MEAS_1_B0_OFFSET 0x000000c4 -#define BB_IQ_ADC_MEAS_1_B0_GAIN_DC_IQ_CAL_MEAS_1_0_MSB 31 -#define BB_IQ_ADC_MEAS_1_B0_GAIN_DC_IQ_CAL_MEAS_1_0_LSB 0 -#define BB_IQ_ADC_MEAS_1_B0_GAIN_DC_IQ_CAL_MEAS_1_0_MASK 0xffffffff -#define BB_IQ_ADC_MEAS_1_B0_GAIN_DC_IQ_CAL_MEAS_1_0_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for bb_chn_reg_map.BB_iq_adc_meas_2_b0 */ -#define BB_IQ_ADC_MEAS_2_B0_ADDRESS 0x000000c8 -#define BB_IQ_ADC_MEAS_2_B0_OFFSET 0x000000c8 -#define BB_IQ_ADC_MEAS_2_B0_GAIN_DC_IQ_CAL_MEAS_2_0_MSB 31 -#define BB_IQ_ADC_MEAS_2_B0_GAIN_DC_IQ_CAL_MEAS_2_0_LSB 0 -#define BB_IQ_ADC_MEAS_2_B0_GAIN_DC_IQ_CAL_MEAS_2_0_MASK 0xffffffff -#define BB_IQ_ADC_MEAS_2_B0_GAIN_DC_IQ_CAL_MEAS_2_0_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for bb_chn_reg_map.BB_iq_adc_meas_3_b0 */ -#define BB_IQ_ADC_MEAS_3_B0_ADDRESS 0x000000cc -#define BB_IQ_ADC_MEAS_3_B0_OFFSET 0x000000cc -#define BB_IQ_ADC_MEAS_3_B0_GAIN_DC_IQ_CAL_MEAS_3_0_MSB 31 -#define BB_IQ_ADC_MEAS_3_B0_GAIN_DC_IQ_CAL_MEAS_3_0_LSB 0 -#define BB_IQ_ADC_MEAS_3_B0_GAIN_DC_IQ_CAL_MEAS_3_0_MASK 0xffffffff -#define BB_IQ_ADC_MEAS_3_B0_GAIN_DC_IQ_CAL_MEAS_3_0_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for bb_chn_reg_map.BB_tx_phase_ramp_b0 */ -#define BB_TX_PHASE_RAMP_B0_ADDRESS 0x000000d0 -#define BB_TX_PHASE_RAMP_B0_OFFSET 0x000000d0 -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ENABLE_0_MSB 0 -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ENABLE_0_LSB 0 -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ENABLE_0_MASK 0x00000001 -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ENABLE_0_GET(x) (((x) & 0x00000001) >> 0) -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ENABLE_0_SET(x) (((x) << 0) & 0x00000001) -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_BIAS_0_MSB 6 -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_BIAS_0_LSB 1 -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_BIAS_0_MASK 0x0000007e -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_BIAS_0_GET(x) (((x) & 0x0000007e) >> 1) -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_BIAS_0_SET(x) (((x) << 1) & 0x0000007e) -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_INIT_0_MSB 16 -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_INIT_0_LSB 7 -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_INIT_0_MASK 0x0001ff80 -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_INIT_0_GET(x) (((x) & 0x0001ff80) >> 7) -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_INIT_0_SET(x) (((x) << 7) & 0x0001ff80) -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ALPHA_0_MSB 24 -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ALPHA_0_LSB 17 -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ALPHA_0_MASK 0x01fe0000 -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ALPHA_0_GET(x) (((x) & 0x01fe0000) >> 17) -#define BB_TX_PHASE_RAMP_B0_CF_PHASE_RAMP_ALPHA_0_SET(x) (((x) << 17) & 0x01fe0000) - -/* macros for bb_chn_reg_map.BB_adc_gain_dc_corr_b0 */ -#define BB_ADC_GAIN_DC_CORR_B0_ADDRESS 0x000000d4 -#define BB_ADC_GAIN_DC_CORR_B0_OFFSET 0x000000d4 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_Q_COEFF_0_MSB 5 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_Q_COEFF_0_LSB 0 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_Q_COEFF_0_MASK 0x0000003f -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_Q_COEFF_0_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_Q_COEFF_0_SET(x) (((x) << 0) & 0x0000003f) -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_I_COEFF_0_MSB 11 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_I_COEFF_0_LSB 6 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_I_COEFF_0_MASK 0x00000fc0 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_I_COEFF_0_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_I_COEFF_0_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_Q_COEFF_0_MSB 20 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_Q_COEFF_0_LSB 12 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_Q_COEFF_0_MASK 0x001ff000 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_Q_COEFF_0_GET(x) (((x) & 0x001ff000) >> 12) -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_Q_COEFF_0_SET(x) (((x) << 12) & 0x001ff000) -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_I_COEFF_0_MSB 29 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_I_COEFF_0_LSB 21 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_I_COEFF_0_MASK 0x3fe00000 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_I_COEFF_0_GET(x) (((x) & 0x3fe00000) >> 21) -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_I_COEFF_0_SET(x) (((x) << 21) & 0x3fe00000) -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_ENABLE_MSB 30 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_ENABLE_LSB 30 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_ENABLE_MASK 0x40000000 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_ENABLE_GET(x) (((x) & 0x40000000) >> 30) -#define BB_ADC_GAIN_DC_CORR_B0_ADC_GAIN_CORR_ENABLE_SET(x) (((x) << 30) & 0x40000000) -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_ENABLE_MSB 31 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_ENABLE_LSB 31 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_ENABLE_MASK 0x80000000 -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_ENABLE_GET(x) (((x) & 0x80000000) >> 31) -#define BB_ADC_GAIN_DC_CORR_B0_ADC_DC_CORR_ENABLE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_chn_reg_map.BB_rx_iq_corr_b0 */ -#define BB_RX_IQ_CORR_B0_ADDRESS 0x000000dc -#define BB_RX_IQ_CORR_B0_OFFSET 0x000000dc -#define BB_RX_IQ_CORR_B0_RX_IQCORR_Q_Q_COFF_0_MSB 6 -#define BB_RX_IQ_CORR_B0_RX_IQCORR_Q_Q_COFF_0_LSB 0 -#define BB_RX_IQ_CORR_B0_RX_IQCORR_Q_Q_COFF_0_MASK 0x0000007f -#define BB_RX_IQ_CORR_B0_RX_IQCORR_Q_Q_COFF_0_GET(x) (((x) & 0x0000007f) >> 0) -#define BB_RX_IQ_CORR_B0_RX_IQCORR_Q_Q_COFF_0_SET(x) (((x) << 0) & 0x0000007f) -#define BB_RX_IQ_CORR_B0_RX_IQCORR_Q_I_COFF_0_MSB 13 -#define BB_RX_IQ_CORR_B0_RX_IQCORR_Q_I_COFF_0_LSB 7 -#define BB_RX_IQ_CORR_B0_RX_IQCORR_Q_I_COFF_0_MASK 0x00003f80 -#define BB_RX_IQ_CORR_B0_RX_IQCORR_Q_I_COFF_0_GET(x) (((x) & 0x00003f80) >> 7) -#define BB_RX_IQ_CORR_B0_RX_IQCORR_Q_I_COFF_0_SET(x) (((x) << 7) & 0x00003f80) -#define BB_RX_IQ_CORR_B0_RX_IQCORR_ENABLE_MSB 14 -#define BB_RX_IQ_CORR_B0_RX_IQCORR_ENABLE_LSB 14 -#define BB_RX_IQ_CORR_B0_RX_IQCORR_ENABLE_MASK 0x00004000 -#define BB_RX_IQ_CORR_B0_RX_IQCORR_ENABLE_GET(x) (((x) & 0x00004000) >> 14) -#define BB_RX_IQ_CORR_B0_RX_IQCORR_ENABLE_SET(x) (((x) << 14) & 0x00004000) -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_Q_COFF_0_MSB 21 -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_Q_COFF_0_LSB 15 -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_Q_COFF_0_MASK 0x003f8000 -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_Q_COFF_0_GET(x) (((x) & 0x003f8000) >> 15) -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_Q_COFF_0_SET(x) (((x) << 15) & 0x003f8000) -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_I_COFF_0_MSB 28 -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_I_COFF_0_LSB 22 -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_I_COFF_0_MASK 0x1fc00000 -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_I_COFF_0_GET(x) (((x) & 0x1fc00000) >> 22) -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_Q_I_COFF_0_SET(x) (((x) << 22) & 0x1fc00000) -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_ENABLE_MSB 29 -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_ENABLE_LSB 29 -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_ENABLE_MASK 0x20000000 -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_ENABLE_GET(x) (((x) & 0x20000000) >> 29) -#define BB_RX_IQ_CORR_B0_LOOPBACK_IQCORR_ENABLE_SET(x) (((x) << 29) & 0x20000000) - -/* macros for bb_chn_reg_map.BB_paprd_am2am_mask */ -#define BB_PAPRD_AM2AM_MASK_ADDRESS 0x000000e4 -#define BB_PAPRD_AM2AM_MASK_OFFSET 0x000000e4 -#define BB_PAPRD_AM2AM_MASK_PAPRD_AM2AM_MASK_MSB 24 -#define BB_PAPRD_AM2AM_MASK_PAPRD_AM2AM_MASK_LSB 0 -#define BB_PAPRD_AM2AM_MASK_PAPRD_AM2AM_MASK_MASK 0x01ffffff -#define BB_PAPRD_AM2AM_MASK_PAPRD_AM2AM_MASK_GET(x) (((x) & 0x01ffffff) >> 0) -#define BB_PAPRD_AM2AM_MASK_PAPRD_AM2AM_MASK_SET(x) (((x) << 0) & 0x01ffffff) - -/* macros for bb_chn_reg_map.BB_paprd_am2pm_mask */ -#define BB_PAPRD_AM2PM_MASK_ADDRESS 0x000000e8 -#define BB_PAPRD_AM2PM_MASK_OFFSET 0x000000e8 -#define BB_PAPRD_AM2PM_MASK_PAPRD_AM2PM_MASK_MSB 24 -#define BB_PAPRD_AM2PM_MASK_PAPRD_AM2PM_MASK_LSB 0 -#define BB_PAPRD_AM2PM_MASK_PAPRD_AM2PM_MASK_MASK 0x01ffffff -#define BB_PAPRD_AM2PM_MASK_PAPRD_AM2PM_MASK_GET(x) (((x) & 0x01ffffff) >> 0) -#define BB_PAPRD_AM2PM_MASK_PAPRD_AM2PM_MASK_SET(x) (((x) << 0) & 0x01ffffff) - -/* macros for bb_chn_reg_map.BB_paprd_ht40_mask */ -#define BB_PAPRD_HT40_MASK_ADDRESS 0x000000ec -#define BB_PAPRD_HT40_MASK_OFFSET 0x000000ec -#define BB_PAPRD_HT40_MASK_PAPRD_HT40_MASK_MSB 24 -#define BB_PAPRD_HT40_MASK_PAPRD_HT40_MASK_LSB 0 -#define BB_PAPRD_HT40_MASK_PAPRD_HT40_MASK_MASK 0x01ffffff -#define BB_PAPRD_HT40_MASK_PAPRD_HT40_MASK_GET(x) (((x) & 0x01ffffff) >> 0) -#define BB_PAPRD_HT40_MASK_PAPRD_HT40_MASK_SET(x) (((x) << 0) & 0x01ffffff) - -/* macros for bb_chn_reg_map.BB_paprd_ctrl0_b0 */ -#define BB_PAPRD_CTRL0_B0_ADDRESS 0x000000f0 -#define BB_PAPRD_CTRL0_B0_OFFSET 0x000000f0 -#define BB_PAPRD_CTRL0_B0_PAPRD_ENABLE_0_MSB 0 -#define BB_PAPRD_CTRL0_B0_PAPRD_ENABLE_0_LSB 0 -#define BB_PAPRD_CTRL0_B0_PAPRD_ENABLE_0_MASK 0x00000001 -#define BB_PAPRD_CTRL0_B0_PAPRD_ENABLE_0_GET(x) (((x) & 0x00000001) >> 0) -#define BB_PAPRD_CTRL0_B0_PAPRD_ENABLE_0_SET(x) (((x) << 0) & 0x00000001) -#define BB_PAPRD_CTRL0_B0_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_0_MSB 1 -#define BB_PAPRD_CTRL0_B0_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_0_LSB 1 -#define BB_PAPRD_CTRL0_B0_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_0_MASK 0x00000002 -#define BB_PAPRD_CTRL0_B0_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_0_GET(x) (((x) & 0x00000002) >> 1) -#define BB_PAPRD_CTRL0_B0_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_0_SET(x) (((x) << 1) & 0x00000002) -#define BB_PAPRD_CTRL0_B0_PAPRD_VALID_GAIN_0_MSB 26 -#define BB_PAPRD_CTRL0_B0_PAPRD_VALID_GAIN_0_LSB 2 -#define BB_PAPRD_CTRL0_B0_PAPRD_VALID_GAIN_0_MASK 0x07fffffc -#define BB_PAPRD_CTRL0_B0_PAPRD_VALID_GAIN_0_GET(x) (((x) & 0x07fffffc) >> 2) -#define BB_PAPRD_CTRL0_B0_PAPRD_VALID_GAIN_0_SET(x) (((x) << 2) & 0x07fffffc) -#define BB_PAPRD_CTRL0_B0_PAPRD_MAG_THRSH_0_MSB 31 -#define BB_PAPRD_CTRL0_B0_PAPRD_MAG_THRSH_0_LSB 27 -#define BB_PAPRD_CTRL0_B0_PAPRD_MAG_THRSH_0_MASK 0xf8000000 -#define BB_PAPRD_CTRL0_B0_PAPRD_MAG_THRSH_0_GET(x) (((x) & 0xf8000000) >> 27) -#define BB_PAPRD_CTRL0_B0_PAPRD_MAG_THRSH_0_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for bb_chn_reg_map.BB_paprd_ctrl1_b0 */ -#define BB_PAPRD_CTRL1_B0_ADDRESS 0x000000f4 -#define BB_PAPRD_CTRL1_B0_OFFSET 0x000000f4 -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_SCALING_ENABLE_0_MSB 0 -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_SCALING_ENABLE_0_LSB 0 -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_SCALING_ENABLE_0_MASK 0x00000001 -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_SCALING_ENABLE_0_GET(x) (((x) & 0x00000001) >> 0) -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_SCALING_ENABLE_0_SET(x) (((x) << 0) & 0x00000001) -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_AM2AM_ENABLE_0_MSB 1 -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_AM2AM_ENABLE_0_LSB 1 -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_AM2AM_ENABLE_0_MASK 0x00000002 -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_AM2AM_ENABLE_0_GET(x) (((x) & 0x00000002) >> 1) -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_AM2AM_ENABLE_0_SET(x) (((x) << 1) & 0x00000002) -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_AM2PM_ENABLE_0_MSB 2 -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_AM2PM_ENABLE_0_LSB 2 -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_AM2PM_ENABLE_0_MASK 0x00000004 -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_AM2PM_ENABLE_0_GET(x) (((x) & 0x00000004) >> 2) -#define BB_PAPRD_CTRL1_B0_PAPRD_ADAPTIVE_AM2PM_ENABLE_0_SET(x) (((x) << 2) & 0x00000004) -#define BB_PAPRD_CTRL1_B0_PAPRD_POWER_AT_AM2AM_CAL_0_MSB 8 -#define BB_PAPRD_CTRL1_B0_PAPRD_POWER_AT_AM2AM_CAL_0_LSB 3 -#define BB_PAPRD_CTRL1_B0_PAPRD_POWER_AT_AM2AM_CAL_0_MASK 0x000001f8 -#define BB_PAPRD_CTRL1_B0_PAPRD_POWER_AT_AM2AM_CAL_0_GET(x) (((x) & 0x000001f8) >> 3) -#define BB_PAPRD_CTRL1_B0_PAPRD_POWER_AT_AM2AM_CAL_0_SET(x) (((x) << 3) & 0x000001f8) -#define BB_PAPRD_CTRL1_B0_PA_GAIN_SCALE_FACTOR_0_MSB 16 -#define BB_PAPRD_CTRL1_B0_PA_GAIN_SCALE_FACTOR_0_LSB 9 -#define BB_PAPRD_CTRL1_B0_PA_GAIN_SCALE_FACTOR_0_MASK 0x0001fe00 -#define BB_PAPRD_CTRL1_B0_PA_GAIN_SCALE_FACTOR_0_GET(x) (((x) & 0x0001fe00) >> 9) -#define BB_PAPRD_CTRL1_B0_PA_GAIN_SCALE_FACTOR_0_SET(x) (((x) << 9) & 0x0001fe00) -#define BB_PAPRD_CTRL1_B0_PAPRD_MAG_SCALE_FACTOR_0_MSB 26 -#define BB_PAPRD_CTRL1_B0_PAPRD_MAG_SCALE_FACTOR_0_LSB 17 -#define BB_PAPRD_CTRL1_B0_PAPRD_MAG_SCALE_FACTOR_0_MASK 0x07fe0000 -#define BB_PAPRD_CTRL1_B0_PAPRD_MAG_SCALE_FACTOR_0_GET(x) (((x) & 0x07fe0000) >> 17) -#define BB_PAPRD_CTRL1_B0_PAPRD_MAG_SCALE_FACTOR_0_SET(x) (((x) << 17) & 0x07fe0000) -#define BB_PAPRD_CTRL1_B0_PAPRD_TRAINER_IANDQ_SEL_0_MSB 27 -#define BB_PAPRD_CTRL1_B0_PAPRD_TRAINER_IANDQ_SEL_0_LSB 27 -#define BB_PAPRD_CTRL1_B0_PAPRD_TRAINER_IANDQ_SEL_0_MASK 0x08000000 -#define BB_PAPRD_CTRL1_B0_PAPRD_TRAINER_IANDQ_SEL_0_GET(x) (((x) & 0x08000000) >> 27) -#define BB_PAPRD_CTRL1_B0_PAPRD_TRAINER_IANDQ_SEL_0_SET(x) (((x) << 27) & 0x08000000) - -/* macros for bb_chn_reg_map.BB_pa_gain123_b0 */ -#define BB_PA_GAIN123_B0_ADDRESS 0x000000f8 -#define BB_PA_GAIN123_B0_OFFSET 0x000000f8 -#define BB_PA_GAIN123_B0_PA_GAIN1_0_MSB 9 -#define BB_PA_GAIN123_B0_PA_GAIN1_0_LSB 0 -#define BB_PA_GAIN123_B0_PA_GAIN1_0_MASK 0x000003ff -#define BB_PA_GAIN123_B0_PA_GAIN1_0_GET(x) (((x) & 0x000003ff) >> 0) -#define BB_PA_GAIN123_B0_PA_GAIN1_0_SET(x) (((x) << 0) & 0x000003ff) -#define BB_PA_GAIN123_B0_PA_GAIN2_0_MSB 19 -#define BB_PA_GAIN123_B0_PA_GAIN2_0_LSB 10 -#define BB_PA_GAIN123_B0_PA_GAIN2_0_MASK 0x000ffc00 -#define BB_PA_GAIN123_B0_PA_GAIN2_0_GET(x) (((x) & 0x000ffc00) >> 10) -#define BB_PA_GAIN123_B0_PA_GAIN2_0_SET(x) (((x) << 10) & 0x000ffc00) -#define BB_PA_GAIN123_B0_PA_GAIN3_0_MSB 29 -#define BB_PA_GAIN123_B0_PA_GAIN3_0_LSB 20 -#define BB_PA_GAIN123_B0_PA_GAIN3_0_MASK 0x3ff00000 -#define BB_PA_GAIN123_B0_PA_GAIN3_0_GET(x) (((x) & 0x3ff00000) >> 20) -#define BB_PA_GAIN123_B0_PA_GAIN3_0_SET(x) (((x) << 20) & 0x3ff00000) - -/* macros for bb_chn_reg_map.BB_pa_gain45_b0 */ -#define BB_PA_GAIN45_B0_ADDRESS 0x000000fc -#define BB_PA_GAIN45_B0_OFFSET 0x000000fc -#define BB_PA_GAIN45_B0_PA_GAIN4_0_MSB 9 -#define BB_PA_GAIN45_B0_PA_GAIN4_0_LSB 0 -#define BB_PA_GAIN45_B0_PA_GAIN4_0_MASK 0x000003ff -#define BB_PA_GAIN45_B0_PA_GAIN4_0_GET(x) (((x) & 0x000003ff) >> 0) -#define BB_PA_GAIN45_B0_PA_GAIN4_0_SET(x) (((x) << 0) & 0x000003ff) -#define BB_PA_GAIN45_B0_PA_GAIN5_0_MSB 19 -#define BB_PA_GAIN45_B0_PA_GAIN5_0_LSB 10 -#define BB_PA_GAIN45_B0_PA_GAIN5_0_MASK 0x000ffc00 -#define BB_PA_GAIN45_B0_PA_GAIN5_0_GET(x) (((x) & 0x000ffc00) >> 10) -#define BB_PA_GAIN45_B0_PA_GAIN5_0_SET(x) (((x) << 10) & 0x000ffc00) -#define BB_PA_GAIN45_B0_PAPRD_ADAPTIVE_TABLE_VALID_0_MSB 24 -#define BB_PA_GAIN45_B0_PAPRD_ADAPTIVE_TABLE_VALID_0_LSB 20 -#define BB_PA_GAIN45_B0_PAPRD_ADAPTIVE_TABLE_VALID_0_MASK 0x01f00000 -#define BB_PA_GAIN45_B0_PAPRD_ADAPTIVE_TABLE_VALID_0_GET(x) (((x) & 0x01f00000) >> 20) -#define BB_PA_GAIN45_B0_PAPRD_ADAPTIVE_TABLE_VALID_0_SET(x) (((x) << 20) & 0x01f00000) - -/* macros for bb_chn_reg_map.BB_paprd_pre_post_scale_0_b0 */ -#define BB_PAPRD_PRE_POST_SCALE_0_B0_ADDRESS 0x00000100 -#define BB_PAPRD_PRE_POST_SCALE_0_B0_OFFSET 0x00000100 -#define BB_PAPRD_PRE_POST_SCALE_0_B0_PAPRD_PRE_POST_SCALING_0_0_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_0_B0_PAPRD_PRE_POST_SCALING_0_0_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_0_B0_PAPRD_PRE_POST_SCALING_0_0_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_0_B0_PAPRD_PRE_POST_SCALING_0_0_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_0_B0_PAPRD_PRE_POST_SCALING_0_0_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn_reg_map.BB_paprd_pre_post_scale_1_b0 */ -#define BB_PAPRD_PRE_POST_SCALE_1_B0_ADDRESS 0x00000104 -#define BB_PAPRD_PRE_POST_SCALE_1_B0_OFFSET 0x00000104 -#define BB_PAPRD_PRE_POST_SCALE_1_B0_PAPRD_PRE_POST_SCALING_1_0_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_1_B0_PAPRD_PRE_POST_SCALING_1_0_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_1_B0_PAPRD_PRE_POST_SCALING_1_0_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_1_B0_PAPRD_PRE_POST_SCALING_1_0_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_1_B0_PAPRD_PRE_POST_SCALING_1_0_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn_reg_map.BB_paprd_pre_post_scale_2_b0 */ -#define BB_PAPRD_PRE_POST_SCALE_2_B0_ADDRESS 0x00000108 -#define BB_PAPRD_PRE_POST_SCALE_2_B0_OFFSET 0x00000108 -#define BB_PAPRD_PRE_POST_SCALE_2_B0_PAPRD_PRE_POST_SCALING_2_0_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_2_B0_PAPRD_PRE_POST_SCALING_2_0_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_2_B0_PAPRD_PRE_POST_SCALING_2_0_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_2_B0_PAPRD_PRE_POST_SCALING_2_0_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_2_B0_PAPRD_PRE_POST_SCALING_2_0_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn_reg_map.BB_paprd_pre_post_scale_3_b0 */ -#define BB_PAPRD_PRE_POST_SCALE_3_B0_ADDRESS 0x0000010c -#define BB_PAPRD_PRE_POST_SCALE_3_B0_OFFSET 0x0000010c -#define BB_PAPRD_PRE_POST_SCALE_3_B0_PAPRD_PRE_POST_SCALING_3_0_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_3_B0_PAPRD_PRE_POST_SCALING_3_0_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_3_B0_PAPRD_PRE_POST_SCALING_3_0_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_3_B0_PAPRD_PRE_POST_SCALING_3_0_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_3_B0_PAPRD_PRE_POST_SCALING_3_0_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn_reg_map.BB_paprd_pre_post_scale_4_b0 */ -#define BB_PAPRD_PRE_POST_SCALE_4_B0_ADDRESS 0x00000110 -#define BB_PAPRD_PRE_POST_SCALE_4_B0_OFFSET 0x00000110 -#define BB_PAPRD_PRE_POST_SCALE_4_B0_PAPRD_PRE_POST_SCALING_4_0_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_4_B0_PAPRD_PRE_POST_SCALING_4_0_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_4_B0_PAPRD_PRE_POST_SCALING_4_0_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_4_B0_PAPRD_PRE_POST_SCALING_4_0_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_4_B0_PAPRD_PRE_POST_SCALING_4_0_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn_reg_map.BB_paprd_pre_post_scale_5_b0 */ -#define BB_PAPRD_PRE_POST_SCALE_5_B0_ADDRESS 0x00000114 -#define BB_PAPRD_PRE_POST_SCALE_5_B0_OFFSET 0x00000114 -#define BB_PAPRD_PRE_POST_SCALE_5_B0_PAPRD_PRE_POST_SCALING_5_0_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_5_B0_PAPRD_PRE_POST_SCALING_5_0_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_5_B0_PAPRD_PRE_POST_SCALING_5_0_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_5_B0_PAPRD_PRE_POST_SCALING_5_0_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_5_B0_PAPRD_PRE_POST_SCALING_5_0_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn_reg_map.BB_paprd_pre_post_scale_6_b0 */ -#define BB_PAPRD_PRE_POST_SCALE_6_B0_ADDRESS 0x00000118 -#define BB_PAPRD_PRE_POST_SCALE_6_B0_OFFSET 0x00000118 -#define BB_PAPRD_PRE_POST_SCALE_6_B0_PAPRD_PRE_POST_SCALING_6_0_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_6_B0_PAPRD_PRE_POST_SCALING_6_0_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_6_B0_PAPRD_PRE_POST_SCALING_6_0_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_6_B0_PAPRD_PRE_POST_SCALING_6_0_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_6_B0_PAPRD_PRE_POST_SCALING_6_0_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn_reg_map.BB_paprd_pre_post_scale_7_b0 */ -#define BB_PAPRD_PRE_POST_SCALE_7_B0_ADDRESS 0x0000011c -#define BB_PAPRD_PRE_POST_SCALE_7_B0_OFFSET 0x0000011c -#define BB_PAPRD_PRE_POST_SCALE_7_B0_PAPRD_PRE_POST_SCALING_7_0_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_7_B0_PAPRD_PRE_POST_SCALING_7_0_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_7_B0_PAPRD_PRE_POST_SCALING_7_0_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_7_B0_PAPRD_PRE_POST_SCALING_7_0_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_7_B0_PAPRD_PRE_POST_SCALING_7_0_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn_reg_map.BB_paprd_mem_tab_b0 */ -#define BB_PAPRD_MEM_TAB_B0_ADDRESS 0x00000120 -#define BB_PAPRD_MEM_TAB_B0_OFFSET 0x00000120 -#define BB_PAPRD_MEM_TAB_B0_PAPRD_MEM_MSB 21 -#define BB_PAPRD_MEM_TAB_B0_PAPRD_MEM_LSB 0 -#define BB_PAPRD_MEM_TAB_B0_PAPRD_MEM_MASK 0x003fffff -#define BB_PAPRD_MEM_TAB_B0_PAPRD_MEM_GET(x) (((x) & 0x003fffff) >> 0) -#define BB_PAPRD_MEM_TAB_B0_PAPRD_MEM_SET(x) (((x) << 0) & 0x003fffff) - -/* macros for bb_chn_reg_map.BB_chan_info_chan_tab_b0 */ -#define BB_CHAN_INFO_CHAN_TAB_B0_ADDRESS 0x00000300 -#define BB_CHAN_INFO_CHAN_TAB_B0_OFFSET 0x00000300 -#define BB_CHAN_INFO_CHAN_TAB_B0_CHANINFO_WORD_MSB 31 -#define BB_CHAN_INFO_CHAN_TAB_B0_CHANINFO_WORD_LSB 0 -#define BB_CHAN_INFO_CHAN_TAB_B0_CHANINFO_WORD_MASK 0xffffffff -#define BB_CHAN_INFO_CHAN_TAB_B0_CHANINFO_WORD_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for bb_chn_reg_map.BB_chn_tables_intf_addr */ -#define BB_CHN_TABLES_INTF_ADDR_ADDRESS 0x000003f0 -#define BB_CHN_TABLES_INTF_ADDR_OFFSET 0x000003f0 -#define BB_CHN_TABLES_INTF_ADDR_CHN_TABLES_ADDR_MSB 17 -#define BB_CHN_TABLES_INTF_ADDR_CHN_TABLES_ADDR_LSB 2 -#define BB_CHN_TABLES_INTF_ADDR_CHN_TABLES_ADDR_MASK 0x0003fffc -#define BB_CHN_TABLES_INTF_ADDR_CHN_TABLES_ADDR_GET(x) (((x) & 0x0003fffc) >> 2) -#define BB_CHN_TABLES_INTF_ADDR_CHN_TABLES_ADDR_SET(x) (((x) << 2) & 0x0003fffc) -#define BB_CHN_TABLES_INTF_ADDR_CHN_ADDR_AUTO_INCR_MSB 31 -#define BB_CHN_TABLES_INTF_ADDR_CHN_ADDR_AUTO_INCR_LSB 31 -#define BB_CHN_TABLES_INTF_ADDR_CHN_ADDR_AUTO_INCR_MASK 0x80000000 -#define BB_CHN_TABLES_INTF_ADDR_CHN_ADDR_AUTO_INCR_GET(x) (((x) & 0x80000000) >> 31) -#define BB_CHN_TABLES_INTF_ADDR_CHN_ADDR_AUTO_INCR_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_chn_reg_map.BB_chn_tables_intf_data */ -#define BB_CHN_TABLES_INTF_DATA_ADDRESS 0x000003f4 -#define BB_CHN_TABLES_INTF_DATA_OFFSET 0x000003f4 -#define BB_CHN_TABLES_INTF_DATA_CHN_TABLES_DATA_MSB 31 -#define BB_CHN_TABLES_INTF_DATA_CHN_TABLES_DATA_LSB 0 -#define BB_CHN_TABLES_INTF_DATA_CHN_TABLES_DATA_MASK 0xffffffff -#define BB_CHN_TABLES_INTF_DATA_CHN_TABLES_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CHN_TABLES_INTF_DATA_CHN_TABLES_DATA_SET(x) (((x) << 0) & 0xffffffff) - -#ifndef __ASSEMBLER__ - -typedef struct bb_reg_reg_s_1 { - volatile unsigned int BB_timing_controls_1; /* 0x0 - 0x4 */ - volatile unsigned int BB_timing_controls_2; /* 0x4 - 0x8 */ - volatile unsigned int BB_timing_controls_3; /* 0x8 - 0xc */ - volatile unsigned int BB_timing_control_4; /* 0xc - 0x10 */ - volatile unsigned int BB_timing_control_5; /* 0x10 - 0x14 */ - volatile unsigned int BB_timing_control_6; /* 0x14 - 0x18 */ - volatile unsigned int BB_timing_control_11; /* 0x18 - 0x1c */ - volatile unsigned int BB_spur_mask_controls; /* 0x1c - 0x20 */ - volatile unsigned int BB_find_signal_low; /* 0x20 - 0x24 */ - volatile unsigned int BB_sfcorr; /* 0x24 - 0x28 */ - volatile unsigned int BB_self_corr_low; /* 0x28 - 0x2c */ - volatile unsigned int BB_ext_chan_scorr_thr; /* 0x2c - 0x30 */ - volatile unsigned int BB_ext_chan_pwr_thr_2_b0; /* 0x30 - 0x34 */ - volatile unsigned int BB_radar_detection; /* 0x34 - 0x38 */ - volatile unsigned int BB_radar_detection_2; /* 0x38 - 0x3c */ - volatile unsigned int BB_extension_radar; /* 0x3c - 0x40 */ - volatile char pad__0[0x40]; /* 0x40 - 0x80 */ - volatile unsigned int BB_multichain_control; /* 0x80 - 0x84 */ - volatile unsigned int BB_per_chain_csd; /* 0x84 - 0x88 */ - volatile char pad__1[0x18]; /* 0x88 - 0xa0 */ - volatile unsigned int BB_tx_crc; /* 0xa0 - 0xa4 */ - volatile unsigned int BB_tstdac_constant; /* 0xa4 - 0xa8 */ - volatile unsigned int BB_spur_report_b0; /* 0xa8 - 0xac */ - volatile char pad__2[0x4]; /* 0xac - 0xb0 */ - volatile unsigned int BB_txiqcal_control_3; /* 0xb0 - 0xb4 */ - volatile char pad__3[0x8]; /* 0xb4 - 0xbc */ - volatile unsigned int BB_green_tx_control_1; /* 0xbc - 0xc0 */ - volatile unsigned int BB_iq_adc_meas_0_b0; /* 0xc0 - 0xc4 */ - volatile unsigned int BB_iq_adc_meas_1_b0; /* 0xc4 - 0xc8 */ - volatile unsigned int BB_iq_adc_meas_2_b0; /* 0xc8 - 0xcc */ - volatile unsigned int BB_iq_adc_meas_3_b0; /* 0xcc - 0xd0 */ - volatile unsigned int BB_tx_phase_ramp_b0; /* 0xd0 - 0xd4 */ - volatile unsigned int BB_adc_gain_dc_corr_b0; /* 0xd4 - 0xd8 */ - volatile char pad__4[0x4]; /* 0xd8 - 0xdc */ - volatile unsigned int BB_rx_iq_corr_b0; /* 0xdc - 0xe0 */ - volatile char pad__5[0x4]; /* 0xe0 - 0xe4 */ - volatile unsigned int BB_paprd_am2am_mask; /* 0xe4 - 0xe8 */ - volatile unsigned int BB_paprd_am2pm_mask; /* 0xe8 - 0xec */ - volatile unsigned int BB_paprd_ht40_mask; /* 0xec - 0xf0 */ - volatile unsigned int BB_paprd_ctrl0_b0; /* 0xf0 - 0xf4 */ - volatile unsigned int BB_paprd_ctrl1_b0; /* 0xf4 - 0xf8 */ - volatile unsigned int BB_pa_gain123_b0; /* 0xf8 - 0xfc */ - volatile unsigned int BB_pa_gain45_b0; /* 0xfc - 0x100 */ - volatile unsigned int BB_paprd_pre_post_scale_0_b0; /* 0x100 - 0x104 */ - volatile unsigned int BB_paprd_pre_post_scale_1_b0; /* 0x104 - 0x108 */ - volatile unsigned int BB_paprd_pre_post_scale_2_b0; /* 0x108 - 0x10c */ - volatile unsigned int BB_paprd_pre_post_scale_3_b0; /* 0x10c - 0x110 */ - volatile unsigned int BB_paprd_pre_post_scale_4_b0; /* 0x110 - 0x114 */ - volatile unsigned int BB_paprd_pre_post_scale_5_b0; /* 0x114 - 0x118 */ - volatile unsigned int BB_paprd_pre_post_scale_6_b0; /* 0x118 - 0x11c */ - volatile unsigned int BB_paprd_pre_post_scale_7_b0; /* 0x11c - 0x120 */ - volatile unsigned int BB_paprd_mem_tab_b0[120]; /* 0x120 - 0x300 */ - volatile unsigned int BB_chan_info_chan_tab_b0[60]; /* 0x300 - 0x3f0 */ - volatile unsigned int BB_chn_tables_intf_addr; /* 0x3f0 - 0x3f4 */ - volatile unsigned int BB_chn_tables_intf_data; /* 0x3f4 - 0x3f8 */ -} bb_reg_reg_t_1; - -#endif /* __ASSEMBLER__ */ - - -/* macros for bb_mrc_reg_map.BB_timing_control_3a */ -#define BB_TIMING_CONTROL_3A_ADDRESS 0x00000000 -#define BB_TIMING_CONTROL_3A_OFFSET 0x00000000 -#define BB_TIMING_CONTROL_3A_STE_THR_HI_RSSI_MSB 6 -#define BB_TIMING_CONTROL_3A_STE_THR_HI_RSSI_LSB 0 -#define BB_TIMING_CONTROL_3A_STE_THR_HI_RSSI_MASK 0x0000007f -#define BB_TIMING_CONTROL_3A_STE_THR_HI_RSSI_GET(x) (((x) & 0x0000007f) >> 0) -#define BB_TIMING_CONTROL_3A_STE_THR_HI_RSSI_SET(x) (((x) << 0) & 0x0000007f) -#define BB_TIMING_CONTROL_3A_USE_HTSIG1_20_40_BW_VALUE_MSB 7 -#define BB_TIMING_CONTROL_3A_USE_HTSIG1_20_40_BW_VALUE_LSB 7 -#define BB_TIMING_CONTROL_3A_USE_HTSIG1_20_40_BW_VALUE_MASK 0x00000080 -#define BB_TIMING_CONTROL_3A_USE_HTSIG1_20_40_BW_VALUE_GET(x) (((x) & 0x00000080) >> 7) -#define BB_TIMING_CONTROL_3A_USE_HTSIG1_20_40_BW_VALUE_SET(x) (((x) << 7) & 0x00000080) - -/* macros for bb_mrc_reg_map.BB_ldpc_cntl1 */ -#define BB_LDPC_CNTL1_ADDRESS 0x00000004 -#define BB_LDPC_CNTL1_OFFSET 0x00000004 -#define BB_LDPC_CNTL1_LDPC_LLR_SCALING0_MSB 31 -#define BB_LDPC_CNTL1_LDPC_LLR_SCALING0_LSB 0 -#define BB_LDPC_CNTL1_LDPC_LLR_SCALING0_MASK 0xffffffff -#define BB_LDPC_CNTL1_LDPC_LLR_SCALING0_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_LDPC_CNTL1_LDPC_LLR_SCALING0_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_mrc_reg_map.BB_ldpc_cntl2 */ -#define BB_LDPC_CNTL2_ADDRESS 0x00000008 -#define BB_LDPC_CNTL2_OFFSET 0x00000008 -#define BB_LDPC_CNTL2_LDPC_LLR_SCALING1_MSB 15 -#define BB_LDPC_CNTL2_LDPC_LLR_SCALING1_LSB 0 -#define BB_LDPC_CNTL2_LDPC_LLR_SCALING1_MASK 0x0000ffff -#define BB_LDPC_CNTL2_LDPC_LLR_SCALING1_GET(x) (((x) & 0x0000ffff) >> 0) -#define BB_LDPC_CNTL2_LDPC_LLR_SCALING1_SET(x) (((x) << 0) & 0x0000ffff) -#define BB_LDPC_CNTL2_LDPC_LATENCY_MSB 26 -#define BB_LDPC_CNTL2_LDPC_LATENCY_LSB 16 -#define BB_LDPC_CNTL2_LDPC_LATENCY_MASK 0x07ff0000 -#define BB_LDPC_CNTL2_LDPC_LATENCY_GET(x) (((x) & 0x07ff0000) >> 16) -#define BB_LDPC_CNTL2_LDPC_LATENCY_SET(x) (((x) << 16) & 0x07ff0000) - -/* macros for bb_mrc_reg_map.BB_pilot_spur_mask */ -#define BB_PILOT_SPUR_MASK_ADDRESS 0x0000000c -#define BB_PILOT_SPUR_MASK_OFFSET 0x0000000c -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_A_MSB 4 -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_A_LSB 0 -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_A_MASK 0x0000001f -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_A_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_A_SET(x) (((x) << 0) & 0x0000001f) -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A_MSB 11 -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A_LSB 5 -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A_MASK 0x00000fe0 -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A_GET(x) (((x) & 0x00000fe0) >> 5) -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A_SET(x) (((x) << 5) & 0x00000fe0) -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_B_MSB 16 -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_B_LSB 12 -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_B_MASK 0x0001f000 -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_B_GET(x) (((x) & 0x0001f000) >> 12) -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_B_SET(x) (((x) << 12) & 0x0001f000) -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B_MSB 23 -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B_LSB 17 -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B_MASK 0x00fe0000 -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B_GET(x) (((x) & 0x00fe0000) >> 17) -#define BB_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B_SET(x) (((x) << 17) & 0x00fe0000) - -/* macros for bb_mrc_reg_map.BB_chan_spur_mask */ -#define BB_CHAN_SPUR_MASK_ADDRESS 0x00000010 -#define BB_CHAN_SPUR_MASK_OFFSET 0x00000010 -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_A_MSB 4 -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_A_LSB 0 -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_A_MASK 0x0000001f -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_A_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_A_SET(x) (((x) << 0) & 0x0000001f) -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A_MSB 11 -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A_LSB 5 -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A_MASK 0x00000fe0 -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A_GET(x) (((x) & 0x00000fe0) >> 5) -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A_SET(x) (((x) << 5) & 0x00000fe0) -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_B_MSB 16 -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_B_LSB 12 -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_B_MASK 0x0001f000 -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_B_GET(x) (((x) & 0x0001f000) >> 12) -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_B_SET(x) (((x) << 12) & 0x0001f000) -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B_MSB 23 -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B_LSB 17 -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B_MASK 0x00fe0000 -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B_GET(x) (((x) & 0x00fe0000) >> 17) -#define BB_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B_SET(x) (((x) << 17) & 0x00fe0000) - -/* macros for bb_mrc_reg_map.BB_short_gi_delta_slope */ -#define BB_SHORT_GI_DELTA_SLOPE_ADDRESS 0x00000014 -#define BB_SHORT_GI_DELTA_SLOPE_OFFSET 0x00000014 -#define BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_EXP_SHORT_GI_MSB 3 -#define BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_EXP_SHORT_GI_LSB 0 -#define BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_EXP_SHORT_GI_MASK 0x0000000f -#define BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_EXP_SHORT_GI_GET(x) (((x) & 0x0000000f) >> 0) -#define BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_EXP_SHORT_GI_SET(x) (((x) << 0) & 0x0000000f) -#define BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_MAN_SHORT_GI_MSB 18 -#define BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_MAN_SHORT_GI_LSB 4 -#define BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_MAN_SHORT_GI_MASK 0x0007fff0 -#define BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_MAN_SHORT_GI_GET(x) (((x) & 0x0007fff0) >> 4) -#define BB_SHORT_GI_DELTA_SLOPE_DELTA_SLOPE_COEF_MAN_SHORT_GI_SET(x) (((x) << 4) & 0x0007fff0) - -/* macros for bb_mrc_reg_map.BB_ml_cntl1 */ -#define BB_ML_CNTL1_ADDRESS 0x00000018 -#define BB_ML_CNTL1_OFFSET 0x00000018 -#define BB_ML_CNTL1_CF_ML_2S_WEIGHT_TABLE_MSB 23 -#define BB_ML_CNTL1_CF_ML_2S_WEIGHT_TABLE_LSB 0 -#define BB_ML_CNTL1_CF_ML_2S_WEIGHT_TABLE_MASK 0x00ffffff -#define BB_ML_CNTL1_CF_ML_2S_WEIGHT_TABLE_GET(x) (((x) & 0x00ffffff) >> 0) -#define BB_ML_CNTL1_CF_ML_2S_WEIGHT_TABLE_SET(x) (((x) << 0) & 0x00ffffff) -#define BB_ML_CNTL1_CF_IS_FLAT_CH_THR_ML_MSB 25 -#define BB_ML_CNTL1_CF_IS_FLAT_CH_THR_ML_LSB 24 -#define BB_ML_CNTL1_CF_IS_FLAT_CH_THR_ML_MASK 0x03000000 -#define BB_ML_CNTL1_CF_IS_FLAT_CH_THR_ML_GET(x) (((x) & 0x03000000) >> 24) -#define BB_ML_CNTL1_CF_IS_FLAT_CH_THR_ML_SET(x) (((x) << 24) & 0x03000000) -#define BB_ML_CNTL1_CF_IS_FLAT_CH_THR_ZF_MSB 27 -#define BB_ML_CNTL1_CF_IS_FLAT_CH_THR_ZF_LSB 26 -#define BB_ML_CNTL1_CF_IS_FLAT_CH_THR_ZF_MASK 0x0c000000 -#define BB_ML_CNTL1_CF_IS_FLAT_CH_THR_ZF_GET(x) (((x) & 0x0c000000) >> 26) -#define BB_ML_CNTL1_CF_IS_FLAT_CH_THR_ZF_SET(x) (((x) << 26) & 0x0c000000) - -/* macros for bb_mrc_reg_map.BB_ml_cntl2 */ -#define BB_ML_CNTL2_ADDRESS 0x0000001c -#define BB_ML_CNTL2_OFFSET 0x0000001c -#define BB_ML_CNTL2_CF_ML_3S_WEIGHT_TABLE_MSB 23 -#define BB_ML_CNTL2_CF_ML_3S_WEIGHT_TABLE_LSB 0 -#define BB_ML_CNTL2_CF_ML_3S_WEIGHT_TABLE_MASK 0x00ffffff -#define BB_ML_CNTL2_CF_ML_3S_WEIGHT_TABLE_GET(x) (((x) & 0x00ffffff) >> 0) -#define BB_ML_CNTL2_CF_ML_3S_WEIGHT_TABLE_SET(x) (((x) << 0) & 0x00ffffff) - -/* macros for bb_mrc_reg_map.BB_tstadc */ -#define BB_TSTADC_ADDRESS 0x00000020 -#define BB_TSTADC_OFFSET 0x00000020 -#define BB_TSTADC_TSTADC_OUT_Q_MSB 9 -#define BB_TSTADC_TSTADC_OUT_Q_LSB 0 -#define BB_TSTADC_TSTADC_OUT_Q_MASK 0x000003ff -#define BB_TSTADC_TSTADC_OUT_Q_GET(x) (((x) & 0x000003ff) >> 0) -#define BB_TSTADC_TSTADC_OUT_I_MSB 19 -#define BB_TSTADC_TSTADC_OUT_I_LSB 10 -#define BB_TSTADC_TSTADC_OUT_I_MASK 0x000ffc00 -#define BB_TSTADC_TSTADC_OUT_I_GET(x) (((x) & 0x000ffc00) >> 10) - -#ifndef __ASSEMBLER__ - -typedef struct bb_reg_reg_s_2 { - volatile unsigned int BB_timing_control_3a; /* 0x0 - 0x4 */ - volatile unsigned int BB_ldpc_cntl1; /* 0x4 - 0x8 */ - volatile unsigned int BB_ldpc_cntl2; /* 0x8 - 0xc */ - volatile unsigned int BB_pilot_spur_mask; /* 0xc - 0x10 */ - volatile unsigned int BB_chan_spur_mask; /* 0x10 - 0x14 */ - volatile unsigned int BB_short_gi_delta_slope; /* 0x14 - 0x18 */ - volatile unsigned int BB_ml_cntl1; /* 0x18 - 0x1c */ - volatile unsigned int BB_ml_cntl2; /* 0x1c - 0x20 */ - volatile unsigned int BB_tstadc; /* 0x20 - 0x24 */ -} bb_reg_reg_t2; - -#endif /* __ASSEMBLER__ */ - - -/* macros for bb_bbb_reg_map.BB_bbb_rx_ctrl_1 */ -#define BB_BBB_RX_CTRL_1_ADDRESS 0x00000000 -#define BB_BBB_RX_CTRL_1_OFFSET 0x00000000 -#define BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_2_MSB 2 -#define BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_2_LSB 0 -#define BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_2_MASK 0x00000007 -#define BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_2_GET(x) (((x) & 0x00000007) >> 0) -#define BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_2_SET(x) (((x) << 0) & 0x00000007) -#define BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_MSB 7 -#define BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_LSB 3 -#define BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_MASK 0x000000f8 -#define BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_GET(x) (((x) & 0x000000f8) >> 3) -#define BB_BBB_RX_CTRL_1_COARSE_TIM_THRESHOLD_SET(x) (((x) << 3) & 0x000000f8) -#define BB_BBB_RX_CTRL_1_COARSE_TIM_N_SYNC_MSB 10 -#define BB_BBB_RX_CTRL_1_COARSE_TIM_N_SYNC_LSB 8 -#define BB_BBB_RX_CTRL_1_COARSE_TIM_N_SYNC_MASK 0x00000700 -#define BB_BBB_RX_CTRL_1_COARSE_TIM_N_SYNC_GET(x) (((x) & 0x00000700) >> 8) -#define BB_BBB_RX_CTRL_1_COARSE_TIM_N_SYNC_SET(x) (((x) << 8) & 0x00000700) -#define BB_BBB_RX_CTRL_1_MAX_BAL_LONG_MSB 15 -#define BB_BBB_RX_CTRL_1_MAX_BAL_LONG_LSB 11 -#define BB_BBB_RX_CTRL_1_MAX_BAL_LONG_MASK 0x0000f800 -#define BB_BBB_RX_CTRL_1_MAX_BAL_LONG_GET(x) (((x) & 0x0000f800) >> 11) -#define BB_BBB_RX_CTRL_1_MAX_BAL_LONG_SET(x) (((x) << 11) & 0x0000f800) -#define BB_BBB_RX_CTRL_1_MAX_BAL_SHORT_MSB 20 -#define BB_BBB_RX_CTRL_1_MAX_BAL_SHORT_LSB 16 -#define BB_BBB_RX_CTRL_1_MAX_BAL_SHORT_MASK 0x001f0000 -#define BB_BBB_RX_CTRL_1_MAX_BAL_SHORT_GET(x) (((x) & 0x001f0000) >> 16) -#define BB_BBB_RX_CTRL_1_MAX_BAL_SHORT_SET(x) (((x) << 16) & 0x001f0000) -#define BB_BBB_RX_CTRL_1_RECON_LMS_STEP_MSB 23 -#define BB_BBB_RX_CTRL_1_RECON_LMS_STEP_LSB 21 -#define BB_BBB_RX_CTRL_1_RECON_LMS_STEP_MASK 0x00e00000 -#define BB_BBB_RX_CTRL_1_RECON_LMS_STEP_GET(x) (((x) & 0x00e00000) >> 21) -#define BB_BBB_RX_CTRL_1_RECON_LMS_STEP_SET(x) (((x) << 21) & 0x00e00000) -#define BB_BBB_RX_CTRL_1_SB_CHECK_WIN_MSB 30 -#define BB_BBB_RX_CTRL_1_SB_CHECK_WIN_LSB 24 -#define BB_BBB_RX_CTRL_1_SB_CHECK_WIN_MASK 0x7f000000 -#define BB_BBB_RX_CTRL_1_SB_CHECK_WIN_GET(x) (((x) & 0x7f000000) >> 24) -#define BB_BBB_RX_CTRL_1_SB_CHECK_WIN_SET(x) (((x) << 24) & 0x7f000000) -#define BB_BBB_RX_CTRL_1_EN_RX_ABORT_CCK_MSB 31 -#define BB_BBB_RX_CTRL_1_EN_RX_ABORT_CCK_LSB 31 -#define BB_BBB_RX_CTRL_1_EN_RX_ABORT_CCK_MASK 0x80000000 -#define BB_BBB_RX_CTRL_1_EN_RX_ABORT_CCK_GET(x) (((x) & 0x80000000) >> 31) -#define BB_BBB_RX_CTRL_1_EN_RX_ABORT_CCK_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_bbb_reg_map.BB_bbb_rx_ctrl_2 */ -#define BB_BBB_RX_CTRL_2_ADDRESS 0x00000004 -#define BB_BBB_RX_CTRL_2_OFFSET 0x00000004 -#define BB_BBB_RX_CTRL_2_FREQ_EST_N_AVG_LONG_MSB 5 -#define BB_BBB_RX_CTRL_2_FREQ_EST_N_AVG_LONG_LSB 0 -#define BB_BBB_RX_CTRL_2_FREQ_EST_N_AVG_LONG_MASK 0x0000003f -#define BB_BBB_RX_CTRL_2_FREQ_EST_N_AVG_LONG_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_BBB_RX_CTRL_2_FREQ_EST_N_AVG_LONG_SET(x) (((x) << 0) & 0x0000003f) -#define BB_BBB_RX_CTRL_2_CHAN_AVG_LONG_MSB 11 -#define BB_BBB_RX_CTRL_2_CHAN_AVG_LONG_LSB 6 -#define BB_BBB_RX_CTRL_2_CHAN_AVG_LONG_MASK 0x00000fc0 -#define BB_BBB_RX_CTRL_2_CHAN_AVG_LONG_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_BBB_RX_CTRL_2_CHAN_AVG_LONG_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_BBB_RX_CTRL_2_COARSE_TIM_THRESHOLD_3_MSB 16 -#define BB_BBB_RX_CTRL_2_COARSE_TIM_THRESHOLD_3_LSB 12 -#define BB_BBB_RX_CTRL_2_COARSE_TIM_THRESHOLD_3_MASK 0x0001f000 -#define BB_BBB_RX_CTRL_2_COARSE_TIM_THRESHOLD_3_GET(x) (((x) & 0x0001f000) >> 12) -#define BB_BBB_RX_CTRL_2_COARSE_TIM_THRESHOLD_3_SET(x) (((x) << 12) & 0x0001f000) -#define BB_BBB_RX_CTRL_2_FREQ_TRACK_UPDATE_PERIOD_MSB 21 -#define BB_BBB_RX_CTRL_2_FREQ_TRACK_UPDATE_PERIOD_LSB 17 -#define BB_BBB_RX_CTRL_2_FREQ_TRACK_UPDATE_PERIOD_MASK 0x003e0000 -#define BB_BBB_RX_CTRL_2_FREQ_TRACK_UPDATE_PERIOD_GET(x) (((x) & 0x003e0000) >> 17) -#define BB_BBB_RX_CTRL_2_FREQ_TRACK_UPDATE_PERIOD_SET(x) (((x) << 17) & 0x003e0000) -#define BB_BBB_RX_CTRL_2_FREQ_EST_SCALING_PERIOD_MSB 25 -#define BB_BBB_RX_CTRL_2_FREQ_EST_SCALING_PERIOD_LSB 22 -#define BB_BBB_RX_CTRL_2_FREQ_EST_SCALING_PERIOD_MASK 0x03c00000 -#define BB_BBB_RX_CTRL_2_FREQ_EST_SCALING_PERIOD_GET(x) (((x) & 0x03c00000) >> 22) -#define BB_BBB_RX_CTRL_2_FREQ_EST_SCALING_PERIOD_SET(x) (((x) << 22) & 0x03c00000) -#define BB_BBB_RX_CTRL_2_LOOP_COEF_DPSK_C2_DATA_MSB 31 -#define BB_BBB_RX_CTRL_2_LOOP_COEF_DPSK_C2_DATA_LSB 26 -#define BB_BBB_RX_CTRL_2_LOOP_COEF_DPSK_C2_DATA_MASK 0xfc000000 -#define BB_BBB_RX_CTRL_2_LOOP_COEF_DPSK_C2_DATA_GET(x) (((x) & 0xfc000000) >> 26) -#define BB_BBB_RX_CTRL_2_LOOP_COEF_DPSK_C2_DATA_SET(x) (((x) << 26) & 0xfc000000) - -/* macros for bb_bbb_reg_map.BB_bbb_rx_ctrl_3 */ -#define BB_BBB_RX_CTRL_3_ADDRESS 0x00000008 -#define BB_BBB_RX_CTRL_3_OFFSET 0x00000008 -#define BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_DPSK_MSB 7 -#define BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_DPSK_LSB 0 -#define BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_DPSK_MASK 0x000000ff -#define BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_DPSK_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_DPSK_SET(x) (((x) << 0) & 0x000000ff) -#define BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_CCK_MSB 15 -#define BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_CCK_LSB 8 -#define BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_CCK_MASK 0x0000ff00 -#define BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_CCK_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_BBB_RX_CTRL_3_TIM_ADJUST_FREQ_CCK_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_BBB_RX_CTRL_3_TIMER_N_SFD_MSB 23 -#define BB_BBB_RX_CTRL_3_TIMER_N_SFD_LSB 16 -#define BB_BBB_RX_CTRL_3_TIMER_N_SFD_MASK 0x00ff0000 -#define BB_BBB_RX_CTRL_3_TIMER_N_SFD_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_BBB_RX_CTRL_3_TIMER_N_SFD_SET(x) (((x) << 16) & 0x00ff0000) - -/* macros for bb_bbb_reg_map.BB_bbb_rx_ctrl_4 */ -#define BB_BBB_RX_CTRL_4_ADDRESS 0x0000000c -#define BB_BBB_RX_CTRL_4_OFFSET 0x0000000c -#define BB_BBB_RX_CTRL_4_TIMER_N_SYNC_MSB 3 -#define BB_BBB_RX_CTRL_4_TIMER_N_SYNC_LSB 0 -#define BB_BBB_RX_CTRL_4_TIMER_N_SYNC_MASK 0x0000000f -#define BB_BBB_RX_CTRL_4_TIMER_N_SYNC_GET(x) (((x) & 0x0000000f) >> 0) -#define BB_BBB_RX_CTRL_4_TIMER_N_SYNC_SET(x) (((x) << 0) & 0x0000000f) -#define BB_BBB_RX_CTRL_4_TIM_ADJUST_TIMER_EXP_MSB 15 -#define BB_BBB_RX_CTRL_4_TIM_ADJUST_TIMER_EXP_LSB 4 -#define BB_BBB_RX_CTRL_4_TIM_ADJUST_TIMER_EXP_MASK 0x0000fff0 -#define BB_BBB_RX_CTRL_4_TIM_ADJUST_TIMER_EXP_GET(x) (((x) & 0x0000fff0) >> 4) -#define BB_BBB_RX_CTRL_4_TIM_ADJUST_TIMER_EXP_SET(x) (((x) << 4) & 0x0000fff0) -#define BB_BBB_RX_CTRL_4_FORCE_UNLOCKED_CLOCKS_MSB 16 -#define BB_BBB_RX_CTRL_4_FORCE_UNLOCKED_CLOCKS_LSB 16 -#define BB_BBB_RX_CTRL_4_FORCE_UNLOCKED_CLOCKS_MASK 0x00010000 -#define BB_BBB_RX_CTRL_4_FORCE_UNLOCKED_CLOCKS_GET(x) (((x) & 0x00010000) >> 16) -#define BB_BBB_RX_CTRL_4_FORCE_UNLOCKED_CLOCKS_SET(x) (((x) << 16) & 0x00010000) -#define BB_BBB_RX_CTRL_4_DYNAMIC_PREAM_SEL_MSB 17 -#define BB_BBB_RX_CTRL_4_DYNAMIC_PREAM_SEL_LSB 17 -#define BB_BBB_RX_CTRL_4_DYNAMIC_PREAM_SEL_MASK 0x00020000 -#define BB_BBB_RX_CTRL_4_DYNAMIC_PREAM_SEL_GET(x) (((x) & 0x00020000) >> 17) -#define BB_BBB_RX_CTRL_4_DYNAMIC_PREAM_SEL_SET(x) (((x) << 17) & 0x00020000) -#define BB_BBB_RX_CTRL_4_SHORT_PREAMBLE_MSB 18 -#define BB_BBB_RX_CTRL_4_SHORT_PREAMBLE_LSB 18 -#define BB_BBB_RX_CTRL_4_SHORT_PREAMBLE_MASK 0x00040000 -#define BB_BBB_RX_CTRL_4_SHORT_PREAMBLE_GET(x) (((x) & 0x00040000) >> 18) -#define BB_BBB_RX_CTRL_4_SHORT_PREAMBLE_SET(x) (((x) << 18) & 0x00040000) -#define BB_BBB_RX_CTRL_4_FREQ_EST_N_AVG_SHORT_MSB 24 -#define BB_BBB_RX_CTRL_4_FREQ_EST_N_AVG_SHORT_LSB 19 -#define BB_BBB_RX_CTRL_4_FREQ_EST_N_AVG_SHORT_MASK 0x01f80000 -#define BB_BBB_RX_CTRL_4_FREQ_EST_N_AVG_SHORT_GET(x) (((x) & 0x01f80000) >> 19) -#define BB_BBB_RX_CTRL_4_FREQ_EST_N_AVG_SHORT_SET(x) (((x) << 19) & 0x01f80000) -#define BB_BBB_RX_CTRL_4_CHAN_AVG_SHORT_MSB 30 -#define BB_BBB_RX_CTRL_4_CHAN_AVG_SHORT_LSB 25 -#define BB_BBB_RX_CTRL_4_CHAN_AVG_SHORT_MASK 0x7e000000 -#define BB_BBB_RX_CTRL_4_CHAN_AVG_SHORT_GET(x) (((x) & 0x7e000000) >> 25) -#define BB_BBB_RX_CTRL_4_CHAN_AVG_SHORT_SET(x) (((x) << 25) & 0x7e000000) -#define BB_BBB_RX_CTRL_4_USE_MRC_WEIGHT_MSB 31 -#define BB_BBB_RX_CTRL_4_USE_MRC_WEIGHT_LSB 31 -#define BB_BBB_RX_CTRL_4_USE_MRC_WEIGHT_MASK 0x80000000 -#define BB_BBB_RX_CTRL_4_USE_MRC_WEIGHT_GET(x) (((x) & 0x80000000) >> 31) -#define BB_BBB_RX_CTRL_4_USE_MRC_WEIGHT_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_bbb_reg_map.BB_bbb_rx_ctrl_5 */ -#define BB_BBB_RX_CTRL_5_ADDRESS 0x00000010 -#define BB_BBB_RX_CTRL_5_OFFSET 0x00000010 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_DATA_MSB 4 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_DATA_LSB 0 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_DATA_MASK 0x0000001f -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_DATA_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_DATA_SET(x) (((x) << 0) & 0x0000001f) -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_HEAD_MSB 9 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_HEAD_LSB 5 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_HEAD_MASK 0x000003e0 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_HEAD_GET(x) (((x) & 0x000003e0) >> 5) -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C1_HEAD_SET(x) (((x) << 5) & 0x000003e0) -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C2_HEAD_MSB 15 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C2_HEAD_LSB 10 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C2_HEAD_MASK 0x0000fc00 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C2_HEAD_GET(x) (((x) & 0x0000fc00) >> 10) -#define BB_BBB_RX_CTRL_5_LOOP_COEF_DPSK_C2_HEAD_SET(x) (((x) << 10) & 0x0000fc00) -#define BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C1_MSB 20 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C1_LSB 16 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C1_MASK 0x001f0000 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C1_GET(x) (((x) & 0x001f0000) >> 16) -#define BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C1_SET(x) (((x) << 16) & 0x001f0000) -#define BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C2_MSB 26 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C2_LSB 21 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C2_MASK 0x07e00000 -#define BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C2_GET(x) (((x) & 0x07e00000) >> 21) -#define BB_BBB_RX_CTRL_5_LOOP_COEF_CCK_C2_SET(x) (((x) << 21) & 0x07e00000) - -/* macros for bb_bbb_reg_map.BB_bbb_rx_ctrl_6 */ -#define BB_BBB_RX_CTRL_6_ADDRESS 0x00000014 -#define BB_BBB_RX_CTRL_6_OFFSET 0x00000014 -#define BB_BBB_RX_CTRL_6_SYNC_START_DELAY_MSB 9 -#define BB_BBB_RX_CTRL_6_SYNC_START_DELAY_LSB 0 -#define BB_BBB_RX_CTRL_6_SYNC_START_DELAY_MASK 0x000003ff -#define BB_BBB_RX_CTRL_6_SYNC_START_DELAY_GET(x) (((x) & 0x000003ff) >> 0) -#define BB_BBB_RX_CTRL_6_SYNC_START_DELAY_SET(x) (((x) << 0) & 0x000003ff) -#define BB_BBB_RX_CTRL_6_MAP_1S_TO_2S_MSB 10 -#define BB_BBB_RX_CTRL_6_MAP_1S_TO_2S_LSB 10 -#define BB_BBB_RX_CTRL_6_MAP_1S_TO_2S_MASK 0x00000400 -#define BB_BBB_RX_CTRL_6_MAP_1S_TO_2S_GET(x) (((x) & 0x00000400) >> 10) -#define BB_BBB_RX_CTRL_6_MAP_1S_TO_2S_SET(x) (((x) << 10) & 0x00000400) -#define BB_BBB_RX_CTRL_6_START_IIR_DELAY_MSB 20 -#define BB_BBB_RX_CTRL_6_START_IIR_DELAY_LSB 11 -#define BB_BBB_RX_CTRL_6_START_IIR_DELAY_MASK 0x001ff800 -#define BB_BBB_RX_CTRL_6_START_IIR_DELAY_GET(x) (((x) & 0x001ff800) >> 11) -#define BB_BBB_RX_CTRL_6_START_IIR_DELAY_SET(x) (((x) << 11) & 0x001ff800) -#define BB_BBB_RX_CTRL_6_USE_MCORR_WEIGHT_MSB 21 -#define BB_BBB_RX_CTRL_6_USE_MCORR_WEIGHT_LSB 21 -#define BB_BBB_RX_CTRL_6_USE_MCORR_WEIGHT_MASK 0x00200000 -#define BB_BBB_RX_CTRL_6_USE_MCORR_WEIGHT_GET(x) (((x) & 0x00200000) >> 21) -#define BB_BBB_RX_CTRL_6_USE_MCORR_WEIGHT_SET(x) (((x) << 21) & 0x00200000) -#define BB_BBB_RX_CTRL_6_USE_BKPWR_FOR_CENTER_INDEX_MSB 22 -#define BB_BBB_RX_CTRL_6_USE_BKPWR_FOR_CENTER_INDEX_LSB 22 -#define BB_BBB_RX_CTRL_6_USE_BKPWR_FOR_CENTER_INDEX_MASK 0x00400000 -#define BB_BBB_RX_CTRL_6_USE_BKPWR_FOR_CENTER_INDEX_GET(x) (((x) & 0x00400000) >> 22) -#define BB_BBB_RX_CTRL_6_USE_BKPWR_FOR_CENTER_INDEX_SET(x) (((x) << 22) & 0x00400000) -#define BB_BBB_RX_CTRL_6_CCK_SEL_CHAIN_BY_EO_MSB 23 -#define BB_BBB_RX_CTRL_6_CCK_SEL_CHAIN_BY_EO_LSB 23 -#define BB_BBB_RX_CTRL_6_CCK_SEL_CHAIN_BY_EO_MASK 0x00800000 -#define BB_BBB_RX_CTRL_6_CCK_SEL_CHAIN_BY_EO_GET(x) (((x) & 0x00800000) >> 23) -#define BB_BBB_RX_CTRL_6_CCK_SEL_CHAIN_BY_EO_SET(x) (((x) << 23) & 0x00800000) -#define BB_BBB_RX_CTRL_6_FORCE_CCK_SEL_CHAIN_MSB 24 -#define BB_BBB_RX_CTRL_6_FORCE_CCK_SEL_CHAIN_LSB 24 -#define BB_BBB_RX_CTRL_6_FORCE_CCK_SEL_CHAIN_MASK 0x01000000 -#define BB_BBB_RX_CTRL_6_FORCE_CCK_SEL_CHAIN_GET(x) (((x) & 0x01000000) >> 24) -#define BB_BBB_RX_CTRL_6_FORCE_CCK_SEL_CHAIN_SET(x) (((x) << 24) & 0x01000000) -#define BB_BBB_RX_CTRL_6_FORCE_CENTER_INDEX_MSB 25 -#define BB_BBB_RX_CTRL_6_FORCE_CENTER_INDEX_LSB 25 -#define BB_BBB_RX_CTRL_6_FORCE_CENTER_INDEX_MASK 0x02000000 -#define BB_BBB_RX_CTRL_6_FORCE_CENTER_INDEX_GET(x) (((x) & 0x02000000) >> 25) -#define BB_BBB_RX_CTRL_6_FORCE_CENTER_INDEX_SET(x) (((x) << 25) & 0x02000000) - -/* macros for bb_bbb_reg_map.BB_force_clken_cck */ -#define BB_FORCE_CLKEN_CCK_ADDRESS 0x00000018 -#define BB_FORCE_CLKEN_CCK_OFFSET 0x00000018 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE0_MSB 0 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE0_LSB 0 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE0_MASK 0x00000001 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE0_GET(x) (((x) & 0x00000001) >> 0) -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE0_SET(x) (((x) << 0) & 0x00000001) -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE1_MSB 1 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE1_LSB 1 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE1_MASK 0x00000002 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE1_GET(x) (((x) & 0x00000002) >> 1) -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE1_SET(x) (((x) << 1) & 0x00000002) -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE2_MSB 2 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE2_LSB 2 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE2_MASK 0x00000004 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE2_GET(x) (((x) & 0x00000004) >> 2) -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE2_SET(x) (((x) << 2) & 0x00000004) -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE3_MSB 3 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE3_LSB 3 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE3_MASK 0x00000008 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE3_GET(x) (((x) & 0x00000008) >> 3) -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ENABLE3_SET(x) (((x) << 3) & 0x00000008) -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ALWAYS_MSB 4 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ALWAYS_LSB 4 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ALWAYS_MASK 0x00000010 -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ALWAYS_GET(x) (((x) & 0x00000010) >> 4) -#define BB_FORCE_CLKEN_CCK_FORCE_RX_ALWAYS_SET(x) (((x) << 4) & 0x00000010) -#define BB_FORCE_CLKEN_CCK_FORCE_TXSM_CLKEN_MSB 5 -#define BB_FORCE_CLKEN_CCK_FORCE_TXSM_CLKEN_LSB 5 -#define BB_FORCE_CLKEN_CCK_FORCE_TXSM_CLKEN_MASK 0x00000020 -#define BB_FORCE_CLKEN_CCK_FORCE_TXSM_CLKEN_GET(x) (((x) & 0x00000020) >> 5) -#define BB_FORCE_CLKEN_CCK_FORCE_TXSM_CLKEN_SET(x) (((x) << 5) & 0x00000020) - -#ifndef __ASSEMBLER__ - -typedef struct bb_reg_reg_s_3 { - volatile unsigned int BB_bbb_rx_ctrl_1; /* 0x0 - 0x4 */ - volatile unsigned int BB_bbb_rx_ctrl_2; /* 0x4 - 0x8 */ - volatile unsigned int BB_bbb_rx_ctrl_3; /* 0x8 - 0xc */ - volatile unsigned int BB_bbb_rx_ctrl_4; /* 0xc - 0x10 */ - volatile unsigned int BB_bbb_rx_ctrl_5; /* 0x10 - 0x14 */ - volatile unsigned int BB_bbb_rx_ctrl_6; /* 0x14 - 0x18 */ - volatile unsigned int BB_force_clken_cck; /* 0x18 - 0x1c */ -} bb_reg_reg_t_3; - -#endif /* __ASSEMBLER__ */ - - -/* macros for bb_agc_reg_map.BB_settling_time */ -#define BB_SETTLING_TIME_ADDRESS 0x00000000 -#define BB_SETTLING_TIME_OFFSET 0x00000000 -#define BB_SETTLING_TIME_AGC_SETTLING_MSB 6 -#define BB_SETTLING_TIME_AGC_SETTLING_LSB 0 -#define BB_SETTLING_TIME_AGC_SETTLING_MASK 0x0000007f -#define BB_SETTLING_TIME_AGC_SETTLING_GET(x) (((x) & 0x0000007f) >> 0) -#define BB_SETTLING_TIME_AGC_SETTLING_SET(x) (((x) << 0) & 0x0000007f) -#define BB_SETTLING_TIME_SWITCH_SETTLING_MSB 13 -#define BB_SETTLING_TIME_SWITCH_SETTLING_LSB 7 -#define BB_SETTLING_TIME_SWITCH_SETTLING_MASK 0x00003f80 -#define BB_SETTLING_TIME_SWITCH_SETTLING_GET(x) (((x) & 0x00003f80) >> 7) -#define BB_SETTLING_TIME_SWITCH_SETTLING_SET(x) (((x) << 7) & 0x00003f80) -#define BB_SETTLING_TIME_ADCSAT_THRL_MSB 19 -#define BB_SETTLING_TIME_ADCSAT_THRL_LSB 14 -#define BB_SETTLING_TIME_ADCSAT_THRL_MASK 0x000fc000 -#define BB_SETTLING_TIME_ADCSAT_THRL_GET(x) (((x) & 0x000fc000) >> 14) -#define BB_SETTLING_TIME_ADCSAT_THRL_SET(x) (((x) << 14) & 0x000fc000) -#define BB_SETTLING_TIME_ADCSAT_THRH_MSB 25 -#define BB_SETTLING_TIME_ADCSAT_THRH_LSB 20 -#define BB_SETTLING_TIME_ADCSAT_THRH_MASK 0x03f00000 -#define BB_SETTLING_TIME_ADCSAT_THRH_GET(x) (((x) & 0x03f00000) >> 20) -#define BB_SETTLING_TIME_ADCSAT_THRH_SET(x) (((x) << 20) & 0x03f00000) -#define BB_SETTLING_TIME_LBRESET_ADVANCE_MSB 29 -#define BB_SETTLING_TIME_LBRESET_ADVANCE_LSB 26 -#define BB_SETTLING_TIME_LBRESET_ADVANCE_MASK 0x3c000000 -#define BB_SETTLING_TIME_LBRESET_ADVANCE_GET(x) (((x) & 0x3c000000) >> 26) -#define BB_SETTLING_TIME_LBRESET_ADVANCE_SET(x) (((x) << 26) & 0x3c000000) - -/* macros for bb_agc_reg_map.BB_gain_force_max_gains_b0 */ -#define BB_GAIN_FORCE_MAX_GAINS_B0_ADDRESS 0x00000004 -#define BB_GAIN_FORCE_MAX_GAINS_B0_OFFSET 0x00000004 -#define BB_GAIN_FORCE_MAX_GAINS_B0_RF_GAIN_F_0_MSB 7 -#define BB_GAIN_FORCE_MAX_GAINS_B0_RF_GAIN_F_0_LSB 0 -#define BB_GAIN_FORCE_MAX_GAINS_B0_RF_GAIN_F_0_MASK 0x000000ff -#define BB_GAIN_FORCE_MAX_GAINS_B0_RF_GAIN_F_0_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_GAIN_FORCE_MAX_GAINS_B0_RF_GAIN_F_0_SET(x) (((x) << 0) & 0x000000ff) -#define BB_GAIN_FORCE_MAX_GAINS_B0_MB_GAIN_F_0_MSB 15 -#define BB_GAIN_FORCE_MAX_GAINS_B0_MB_GAIN_F_0_LSB 8 -#define BB_GAIN_FORCE_MAX_GAINS_B0_MB_GAIN_F_0_MASK 0x0000ff00 -#define BB_GAIN_FORCE_MAX_GAINS_B0_MB_GAIN_F_0_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_GAIN_FORCE_MAX_GAINS_B0_MB_GAIN_F_0_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_SW_F_0_MSB 16 -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_SW_F_0_LSB 16 -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_SW_F_0_MASK 0x00010000 -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_SW_F_0_GET(x) (((x) & 0x00010000) >> 16) -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_SW_F_0_SET(x) (((x) << 16) & 0x00010000) -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_SW_F_0_MSB 17 -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_SW_F_0_LSB 17 -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_SW_F_0_MASK 0x00020000 -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_SW_F_0_GET(x) (((x) & 0x00020000) >> 17) -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_SW_F_0_SET(x) (((x) << 17) & 0x00020000) -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_HYST_MARGIN_0_MSB 24 -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_HYST_MARGIN_0_LSB 18 -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_HYST_MARGIN_0_MASK 0x01fc0000 -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_HYST_MARGIN_0_GET(x) (((x) & 0x01fc0000) >> 18) -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN1_HYST_MARGIN_0_SET(x) (((x) << 18) & 0x01fc0000) -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_HYST_MARGIN_0_MSB 31 -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_HYST_MARGIN_0_LSB 25 -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_HYST_MARGIN_0_MASK 0xfe000000 -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_HYST_MARGIN_0_GET(x) (((x) & 0xfe000000) >> 25) -#define BB_GAIN_FORCE_MAX_GAINS_B0_XATTEN2_HYST_MARGIN_0_SET(x) (((x) << 25) & 0xfe000000) - -/* macros for bb_agc_reg_map.BB_gains_min_offsets */ -#define BB_GAINS_MIN_OFFSETS_ADDRESS 0x00000008 -#define BB_GAINS_MIN_OFFSETS_OFFSET 0x00000008 -#define BB_GAINS_MIN_OFFSETS_OFFSETC1_MSB 6 -#define BB_GAINS_MIN_OFFSETS_OFFSETC1_LSB 0 -#define BB_GAINS_MIN_OFFSETS_OFFSETC1_MASK 0x0000007f -#define BB_GAINS_MIN_OFFSETS_OFFSETC1_GET(x) (((x) & 0x0000007f) >> 0) -#define BB_GAINS_MIN_OFFSETS_OFFSETC1_SET(x) (((x) << 0) & 0x0000007f) -#define BB_GAINS_MIN_OFFSETS_OFFSETC2_MSB 11 -#define BB_GAINS_MIN_OFFSETS_OFFSETC2_LSB 7 -#define BB_GAINS_MIN_OFFSETS_OFFSETC2_MASK 0x00000f80 -#define BB_GAINS_MIN_OFFSETS_OFFSETC2_GET(x) (((x) & 0x00000f80) >> 7) -#define BB_GAINS_MIN_OFFSETS_OFFSETC2_SET(x) (((x) << 7) & 0x00000f80) -#define BB_GAINS_MIN_OFFSETS_OFFSETC3_MSB 16 -#define BB_GAINS_MIN_OFFSETS_OFFSETC3_LSB 12 -#define BB_GAINS_MIN_OFFSETS_OFFSETC3_MASK 0x0001f000 -#define BB_GAINS_MIN_OFFSETS_OFFSETC3_GET(x) (((x) & 0x0001f000) >> 12) -#define BB_GAINS_MIN_OFFSETS_OFFSETC3_SET(x) (((x) << 12) & 0x0001f000) -#define BB_GAINS_MIN_OFFSETS_GAIN_FORCE_MSB 17 -#define BB_GAINS_MIN_OFFSETS_GAIN_FORCE_LSB 17 -#define BB_GAINS_MIN_OFFSETS_GAIN_FORCE_MASK 0x00020000 -#define BB_GAINS_MIN_OFFSETS_GAIN_FORCE_GET(x) (((x) & 0x00020000) >> 17) -#define BB_GAINS_MIN_OFFSETS_GAIN_FORCE_SET(x) (((x) << 17) & 0x00020000) -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_ENABLE_MSB 18 -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_ENABLE_LSB 18 -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_ENABLE_MASK 0x00040000 -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_ENABLE_GET(x) (((x) & 0x00040000) >> 18) -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_ENABLE_SET(x) (((x) << 18) & 0x00040000) -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_GC_MSB 19 -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_GC_LSB 19 -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_GC_MASK 0x00080000 -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_GC_GET(x) (((x) & 0x00080000) >> 19) -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_GC_SET(x) (((x) << 19) & 0x00080000) -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_VOTING_MSB 20 -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_VOTING_LSB 20 -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_VOTING_MASK 0x00100000 -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_VOTING_GET(x) (((x) & 0x00100000) >> 20) -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_VOTING_SET(x) (((x) << 20) & 0x00100000) -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_PHY_ERR_MSB 21 -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_PHY_ERR_LSB 21 -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_PHY_ERR_MASK 0x00200000 -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_PHY_ERR_GET(x) (((x) & 0x00200000) >> 21) -#define BB_GAINS_MIN_OFFSETS_CF_AGC_HIST_PHY_ERR_SET(x) (((x) << 21) & 0x00200000) - -/* macros for bb_agc_reg_map.BB_desired_sigsize */ -#define BB_DESIRED_SIGSIZE_ADDRESS 0x0000000c -#define BB_DESIRED_SIGSIZE_OFFSET 0x0000000c -#define BB_DESIRED_SIGSIZE_ADC_DESIRED_SIZE_MSB 7 -#define BB_DESIRED_SIGSIZE_ADC_DESIRED_SIZE_LSB 0 -#define BB_DESIRED_SIGSIZE_ADC_DESIRED_SIZE_MASK 0x000000ff -#define BB_DESIRED_SIGSIZE_ADC_DESIRED_SIZE_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_DESIRED_SIGSIZE_ADC_DESIRED_SIZE_SET(x) (((x) << 0) & 0x000000ff) -#define BB_DESIRED_SIGSIZE_TOTAL_DESIRED_MSB 27 -#define BB_DESIRED_SIGSIZE_TOTAL_DESIRED_LSB 20 -#define BB_DESIRED_SIGSIZE_TOTAL_DESIRED_MASK 0x0ff00000 -#define BB_DESIRED_SIGSIZE_TOTAL_DESIRED_GET(x) (((x) & 0x0ff00000) >> 20) -#define BB_DESIRED_SIGSIZE_TOTAL_DESIRED_SET(x) (((x) << 20) & 0x0ff00000) -#define BB_DESIRED_SIGSIZE_INIT_GC_COUNT_MAX_MSB 29 -#define BB_DESIRED_SIGSIZE_INIT_GC_COUNT_MAX_LSB 28 -#define BB_DESIRED_SIGSIZE_INIT_GC_COUNT_MAX_MASK 0x30000000 -#define BB_DESIRED_SIGSIZE_INIT_GC_COUNT_MAX_GET(x) (((x) & 0x30000000) >> 28) -#define BB_DESIRED_SIGSIZE_INIT_GC_COUNT_MAX_SET(x) (((x) << 28) & 0x30000000) -#define BB_DESIRED_SIGSIZE_REDUCE_INIT_GC_COUNT_MSB 30 -#define BB_DESIRED_SIGSIZE_REDUCE_INIT_GC_COUNT_LSB 30 -#define BB_DESIRED_SIGSIZE_REDUCE_INIT_GC_COUNT_MASK 0x40000000 -#define BB_DESIRED_SIGSIZE_REDUCE_INIT_GC_COUNT_GET(x) (((x) & 0x40000000) >> 30) -#define BB_DESIRED_SIGSIZE_REDUCE_INIT_GC_COUNT_SET(x) (((x) << 30) & 0x40000000) -#define BB_DESIRED_SIGSIZE_ENA_INIT_GAIN_MSB 31 -#define BB_DESIRED_SIGSIZE_ENA_INIT_GAIN_LSB 31 -#define BB_DESIRED_SIGSIZE_ENA_INIT_GAIN_MASK 0x80000000 -#define BB_DESIRED_SIGSIZE_ENA_INIT_GAIN_GET(x) (((x) & 0x80000000) >> 31) -#define BB_DESIRED_SIGSIZE_ENA_INIT_GAIN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_agc_reg_map.BB_find_signal */ -#define BB_FIND_SIGNAL_ADDRESS 0x00000010 -#define BB_FIND_SIGNAL_OFFSET 0x00000010 -#define BB_FIND_SIGNAL_RELSTEP_MSB 5 -#define BB_FIND_SIGNAL_RELSTEP_LSB 0 -#define BB_FIND_SIGNAL_RELSTEP_MASK 0x0000003f -#define BB_FIND_SIGNAL_RELSTEP_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_FIND_SIGNAL_RELSTEP_SET(x) (((x) << 0) & 0x0000003f) -#define BB_FIND_SIGNAL_RELPWR_MSB 11 -#define BB_FIND_SIGNAL_RELPWR_LSB 6 -#define BB_FIND_SIGNAL_RELPWR_MASK 0x00000fc0 -#define BB_FIND_SIGNAL_RELPWR_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_FIND_SIGNAL_RELPWR_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_FIND_SIGNAL_FIRSTEP_MSB 17 -#define BB_FIND_SIGNAL_FIRSTEP_LSB 12 -#define BB_FIND_SIGNAL_FIRSTEP_MASK 0x0003f000 -#define BB_FIND_SIGNAL_FIRSTEP_GET(x) (((x) & 0x0003f000) >> 12) -#define BB_FIND_SIGNAL_FIRSTEP_SET(x) (((x) << 12) & 0x0003f000) -#define BB_FIND_SIGNAL_FIRPWR_MSB 25 -#define BB_FIND_SIGNAL_FIRPWR_LSB 18 -#define BB_FIND_SIGNAL_FIRPWR_MASK 0x03fc0000 -#define BB_FIND_SIGNAL_FIRPWR_GET(x) (((x) & 0x03fc0000) >> 18) -#define BB_FIND_SIGNAL_FIRPWR_SET(x) (((x) << 18) & 0x03fc0000) -#define BB_FIND_SIGNAL_M1COUNT_MAX_MSB 31 -#define BB_FIND_SIGNAL_M1COUNT_MAX_LSB 26 -#define BB_FIND_SIGNAL_M1COUNT_MAX_MASK 0xfc000000 -#define BB_FIND_SIGNAL_M1COUNT_MAX_GET(x) (((x) & 0xfc000000) >> 26) -#define BB_FIND_SIGNAL_M1COUNT_MAX_SET(x) (((x) << 26) & 0xfc000000) - -/* macros for bb_agc_reg_map.BB_agc */ -#define BB_AGC_ADDRESS 0x00000014 -#define BB_AGC_OFFSET 0x00000014 -#define BB_AGC_COARSEPWR_CONST_MSB 6 -#define BB_AGC_COARSEPWR_CONST_LSB 0 -#define BB_AGC_COARSEPWR_CONST_MASK 0x0000007f -#define BB_AGC_COARSEPWR_CONST_GET(x) (((x) & 0x0000007f) >> 0) -#define BB_AGC_COARSEPWR_CONST_SET(x) (((x) << 0) & 0x0000007f) -#define BB_AGC_COARSE_LOW_MSB 14 -#define BB_AGC_COARSE_LOW_LSB 7 -#define BB_AGC_COARSE_LOW_MASK 0x00007f80 -#define BB_AGC_COARSE_LOW_GET(x) (((x) & 0x00007f80) >> 7) -#define BB_AGC_COARSE_LOW_SET(x) (((x) << 7) & 0x00007f80) -#define BB_AGC_COARSE_HIGH_MSB 21 -#define BB_AGC_COARSE_HIGH_LSB 15 -#define BB_AGC_COARSE_HIGH_MASK 0x003f8000 -#define BB_AGC_COARSE_HIGH_GET(x) (((x) & 0x003f8000) >> 15) -#define BB_AGC_COARSE_HIGH_SET(x) (((x) << 15) & 0x003f8000) -#define BB_AGC_QUICK_DROP_MSB 29 -#define BB_AGC_QUICK_DROP_LSB 22 -#define BB_AGC_QUICK_DROP_MASK 0x3fc00000 -#define BB_AGC_QUICK_DROP_GET(x) (((x) & 0x3fc00000) >> 22) -#define BB_AGC_QUICK_DROP_SET(x) (((x) << 22) & 0x3fc00000) -#define BB_AGC_RSSI_OUT_SELECT_MSB 31 -#define BB_AGC_RSSI_OUT_SELECT_LSB 30 -#define BB_AGC_RSSI_OUT_SELECT_MASK 0xc0000000 -#define BB_AGC_RSSI_OUT_SELECT_GET(x) (((x) & 0xc0000000) >> 30) -#define BB_AGC_RSSI_OUT_SELECT_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for bb_agc_reg_map.BB_ext_atten_switch_ctl_b0 */ -#define BB_EXT_ATTEN_SWITCH_CTL_B0_ADDRESS 0x00000018 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_OFFSET 0x00000018 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_DB_0_MSB 5 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_DB_0_LSB 0 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_DB_0_MASK 0x0000003f -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_DB_0_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_DB_0_SET(x) (((x) << 0) & 0x0000003f) -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_DB_0_MSB 11 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_DB_0_LSB 6 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_DB_0_MASK 0x00000fc0 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_DB_0_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_DB_0_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_MARGIN_0_MSB 16 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_MARGIN_0_LSB 12 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_MARGIN_0_MASK 0x0001f000 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_MARGIN_0_GET(x) (((x) & 0x0001f000) >> 12) -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN1_MARGIN_0_SET(x) (((x) << 12) & 0x0001f000) -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_MARGIN_0_MSB 21 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_MARGIN_0_LSB 17 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_MARGIN_0_MASK 0x003e0000 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_MARGIN_0_GET(x) (((x) & 0x003e0000) >> 17) -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XATTEN2_MARGIN_0_SET(x) (((x) << 17) & 0x003e0000) -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XLNA_GAIN_DB_0_MSB 26 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XLNA_GAIN_DB_0_LSB 22 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XLNA_GAIN_DB_0_MASK 0x07c00000 -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XLNA_GAIN_DB_0_GET(x) (((x) & 0x07c00000) >> 22) -#define BB_EXT_ATTEN_SWITCH_CTL_B0_XLNA_GAIN_DB_0_SET(x) (((x) << 22) & 0x07c00000) - -/* macros for bb_agc_reg_map.BB_cca_b0 */ -#define BB_CCA_B0_ADDRESS 0x0000001c -#define BB_CCA_B0_OFFSET 0x0000001c -#define BB_CCA_B0_CF_MAXCCAPWR_0_MSB 8 -#define BB_CCA_B0_CF_MAXCCAPWR_0_LSB 0 -#define BB_CCA_B0_CF_MAXCCAPWR_0_MASK 0x000001ff -#define BB_CCA_B0_CF_MAXCCAPWR_0_GET(x) (((x) & 0x000001ff) >> 0) -#define BB_CCA_B0_CF_MAXCCAPWR_0_SET(x) (((x) << 0) & 0x000001ff) -#define BB_CCA_B0_CF_CCA_COUNT_MAXC_MSB 11 -#define BB_CCA_B0_CF_CCA_COUNT_MAXC_LSB 9 -#define BB_CCA_B0_CF_CCA_COUNT_MAXC_MASK 0x00000e00 -#define BB_CCA_B0_CF_CCA_COUNT_MAXC_GET(x) (((x) & 0x00000e00) >> 9) -#define BB_CCA_B0_CF_CCA_COUNT_MAXC_SET(x) (((x) << 9) & 0x00000e00) -#define BB_CCA_B0_CF_THRESH62_MSB 19 -#define BB_CCA_B0_CF_THRESH62_LSB 12 -#define BB_CCA_B0_CF_THRESH62_MASK 0x000ff000 -#define BB_CCA_B0_CF_THRESH62_GET(x) (((x) & 0x000ff000) >> 12) -#define BB_CCA_B0_CF_THRESH62_SET(x) (((x) << 12) & 0x000ff000) -#define BB_CCA_B0_MINCCAPWR_0_MSB 28 -#define BB_CCA_B0_MINCCAPWR_0_LSB 20 -#define BB_CCA_B0_MINCCAPWR_0_MASK 0x1ff00000 -#define BB_CCA_B0_MINCCAPWR_0_GET(x) (((x) & 0x1ff00000) >> 20) - -/* macros for bb_agc_reg_map.BB_cca_ctrl_2_b0 */ -#define BB_CCA_CTRL_2_B0_ADDRESS 0x00000020 -#define BB_CCA_CTRL_2_B0_OFFSET 0x00000020 -#define BB_CCA_CTRL_2_B0_MINCCAPWR_THR_0_MSB 8 -#define BB_CCA_CTRL_2_B0_MINCCAPWR_THR_0_LSB 0 -#define BB_CCA_CTRL_2_B0_MINCCAPWR_THR_0_MASK 0x000001ff -#define BB_CCA_CTRL_2_B0_MINCCAPWR_THR_0_GET(x) (((x) & 0x000001ff) >> 0) -#define BB_CCA_CTRL_2_B0_MINCCAPWR_THR_0_SET(x) (((x) << 0) & 0x000001ff) -#define BB_CCA_CTRL_2_B0_ENABLE_MINCCAPWR_THR_MSB 9 -#define BB_CCA_CTRL_2_B0_ENABLE_MINCCAPWR_THR_LSB 9 -#define BB_CCA_CTRL_2_B0_ENABLE_MINCCAPWR_THR_MASK 0x00000200 -#define BB_CCA_CTRL_2_B0_ENABLE_MINCCAPWR_THR_GET(x) (((x) & 0x00000200) >> 9) -#define BB_CCA_CTRL_2_B0_ENABLE_MINCCAPWR_THR_SET(x) (((x) << 9) & 0x00000200) -#define BB_CCA_CTRL_2_B0_NF_GAIN_COMP_0_MSB 17 -#define BB_CCA_CTRL_2_B0_NF_GAIN_COMP_0_LSB 10 -#define BB_CCA_CTRL_2_B0_NF_GAIN_COMP_0_MASK 0x0003fc00 -#define BB_CCA_CTRL_2_B0_NF_GAIN_COMP_0_GET(x) (((x) & 0x0003fc00) >> 10) -#define BB_CCA_CTRL_2_B0_NF_GAIN_COMP_0_SET(x) (((x) << 10) & 0x0003fc00) -#define BB_CCA_CTRL_2_B0_THRESH62_MODE_MSB 18 -#define BB_CCA_CTRL_2_B0_THRESH62_MODE_LSB 18 -#define BB_CCA_CTRL_2_B0_THRESH62_MODE_MASK 0x00040000 -#define BB_CCA_CTRL_2_B0_THRESH62_MODE_GET(x) (((x) & 0x00040000) >> 18) -#define BB_CCA_CTRL_2_B0_THRESH62_MODE_SET(x) (((x) << 18) & 0x00040000) - -/* macros for bb_agc_reg_map.BB_restart */ -#define BB_RESTART_ADDRESS 0x00000024 -#define BB_RESTART_OFFSET 0x00000024 -#define BB_RESTART_ENABLE_RESTART_MSB 0 -#define BB_RESTART_ENABLE_RESTART_LSB 0 -#define BB_RESTART_ENABLE_RESTART_MASK 0x00000001 -#define BB_RESTART_ENABLE_RESTART_GET(x) (((x) & 0x00000001) >> 0) -#define BB_RESTART_ENABLE_RESTART_SET(x) (((x) << 0) & 0x00000001) -#define BB_RESTART_RESTART_LGFIRPWR_DELTA_MSB 5 -#define BB_RESTART_RESTART_LGFIRPWR_DELTA_LSB 1 -#define BB_RESTART_RESTART_LGFIRPWR_DELTA_MASK 0x0000003e -#define BB_RESTART_RESTART_LGFIRPWR_DELTA_GET(x) (((x) & 0x0000003e) >> 1) -#define BB_RESTART_RESTART_LGFIRPWR_DELTA_SET(x) (((x) << 1) & 0x0000003e) -#define BB_RESTART_ENABLE_PWR_DROP_ERR_MSB 6 -#define BB_RESTART_ENABLE_PWR_DROP_ERR_LSB 6 -#define BB_RESTART_ENABLE_PWR_DROP_ERR_MASK 0x00000040 -#define BB_RESTART_ENABLE_PWR_DROP_ERR_GET(x) (((x) & 0x00000040) >> 6) -#define BB_RESTART_ENABLE_PWR_DROP_ERR_SET(x) (((x) << 6) & 0x00000040) -#define BB_RESTART_PWRDROP_LGFIRPWR_DELTA_MSB 11 -#define BB_RESTART_PWRDROP_LGFIRPWR_DELTA_LSB 7 -#define BB_RESTART_PWRDROP_LGFIRPWR_DELTA_MASK 0x00000f80 -#define BB_RESTART_PWRDROP_LGFIRPWR_DELTA_GET(x) (((x) & 0x00000f80) >> 7) -#define BB_RESTART_PWRDROP_LGFIRPWR_DELTA_SET(x) (((x) << 7) & 0x00000f80) -#define BB_RESTART_OFDM_CCK_RSSI_BIAS_MSB 17 -#define BB_RESTART_OFDM_CCK_RSSI_BIAS_LSB 12 -#define BB_RESTART_OFDM_CCK_RSSI_BIAS_MASK 0x0003f000 -#define BB_RESTART_OFDM_CCK_RSSI_BIAS_GET(x) (((x) & 0x0003f000) >> 12) -#define BB_RESTART_OFDM_CCK_RSSI_BIAS_SET(x) (((x) << 12) & 0x0003f000) -#define BB_RESTART_ANT_FAST_DIV_GC_LIMIT_MSB 20 -#define BB_RESTART_ANT_FAST_DIV_GC_LIMIT_LSB 18 -#define BB_RESTART_ANT_FAST_DIV_GC_LIMIT_MASK 0x001c0000 -#define BB_RESTART_ANT_FAST_DIV_GC_LIMIT_GET(x) (((x) & 0x001c0000) >> 18) -#define BB_RESTART_ANT_FAST_DIV_GC_LIMIT_SET(x) (((x) << 18) & 0x001c0000) -#define BB_RESTART_ENABLE_ANT_FAST_DIV_M2FLAG_MSB 21 -#define BB_RESTART_ENABLE_ANT_FAST_DIV_M2FLAG_LSB 21 -#define BB_RESTART_ENABLE_ANT_FAST_DIV_M2FLAG_MASK 0x00200000 -#define BB_RESTART_ENABLE_ANT_FAST_DIV_M2FLAG_GET(x) (((x) & 0x00200000) >> 21) -#define BB_RESTART_ENABLE_ANT_FAST_DIV_M2FLAG_SET(x) (((x) << 21) & 0x00200000) -#define BB_RESTART_WEAK_RSSI_VOTE_THR_MSB 28 -#define BB_RESTART_WEAK_RSSI_VOTE_THR_LSB 22 -#define BB_RESTART_WEAK_RSSI_VOTE_THR_MASK 0x1fc00000 -#define BB_RESTART_WEAK_RSSI_VOTE_THR_GET(x) (((x) & 0x1fc00000) >> 22) -#define BB_RESTART_WEAK_RSSI_VOTE_THR_SET(x) (((x) << 22) & 0x1fc00000) -#define BB_RESTART_ENABLE_PWR_DROP_ERR_CCK_MSB 29 -#define BB_RESTART_ENABLE_PWR_DROP_ERR_CCK_LSB 29 -#define BB_RESTART_ENABLE_PWR_DROP_ERR_CCK_MASK 0x20000000 -#define BB_RESTART_ENABLE_PWR_DROP_ERR_CCK_GET(x) (((x) & 0x20000000) >> 29) -#define BB_RESTART_ENABLE_PWR_DROP_ERR_CCK_SET(x) (((x) << 29) & 0x20000000) -#define BB_RESTART_DISABLE_DC_RESTART_MSB 30 -#define BB_RESTART_DISABLE_DC_RESTART_LSB 30 -#define BB_RESTART_DISABLE_DC_RESTART_MASK 0x40000000 -#define BB_RESTART_DISABLE_DC_RESTART_GET(x) (((x) & 0x40000000) >> 30) -#define BB_RESTART_DISABLE_DC_RESTART_SET(x) (((x) << 30) & 0x40000000) -#define BB_RESTART_RESTART_MODE_BW40_MSB 31 -#define BB_RESTART_RESTART_MODE_BW40_LSB 31 -#define BB_RESTART_RESTART_MODE_BW40_MASK 0x80000000 -#define BB_RESTART_RESTART_MODE_BW40_GET(x) (((x) & 0x80000000) >> 31) -#define BB_RESTART_RESTART_MODE_BW40_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_agc_reg_map.BB_multichain_gain_ctrl */ -#define BB_MULTICHAIN_GAIN_CTRL_ADDRESS 0x00000028 -#define BB_MULTICHAIN_GAIN_CTRL_OFFSET 0x00000028 -#define BB_MULTICHAIN_GAIN_CTRL_QUICKDROP_LOW_MSB 7 -#define BB_MULTICHAIN_GAIN_CTRL_QUICKDROP_LOW_LSB 0 -#define BB_MULTICHAIN_GAIN_CTRL_QUICKDROP_LOW_MASK 0x000000ff -#define BB_MULTICHAIN_GAIN_CTRL_QUICKDROP_LOW_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_MULTICHAIN_GAIN_CTRL_QUICKDROP_LOW_SET(x) (((x) << 0) & 0x000000ff) -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_CHECK_STRONG_ANT_MSB 8 -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_CHECK_STRONG_ANT_LSB 8 -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_CHECK_STRONG_ANT_MASK 0x00000100 -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_CHECK_STRONG_ANT_GET(x) (((x) & 0x00000100) >> 8) -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_CHECK_STRONG_ANT_SET(x) (((x) << 8) & 0x00000100) -#define BB_MULTICHAIN_GAIN_CTRL_ANT_FAST_DIV_BIAS_MSB 14 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_FAST_DIV_BIAS_LSB 9 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_FAST_DIV_BIAS_MASK 0x00007e00 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_FAST_DIV_BIAS_GET(x) (((x) & 0x00007e00) >> 9) -#define BB_MULTICHAIN_GAIN_CTRL_ANT_FAST_DIV_BIAS_SET(x) (((x) << 9) & 0x00007e00) -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_SNR_MSB 20 -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_SNR_LSB 15 -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_SNR_MASK 0x001f8000 -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_SNR_GET(x) (((x) & 0x001f8000) >> 15) -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_SNR_SET(x) (((x) << 15) & 0x001f8000) -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_ENA_MSB 21 -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_ENA_LSB 21 -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_ENA_MASK 0x00200000 -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_ENA_GET(x) (((x) & 0x00200000) >> 21) -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_ENA_SET(x) (((x) << 21) & 0x00200000) -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_MODE_MSB 22 -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_MODE_LSB 22 -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_MODE_MASK 0x00400000 -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_MODE_GET(x) (((x) & 0x00400000) >> 22) -#define BB_MULTICHAIN_GAIN_CTRL_CAP_GAIN_RATIO_MODE_SET(x) (((x) << 22) & 0x00400000) -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_SW_RX_PROT_MSB 23 -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_SW_RX_PROT_LSB 23 -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_SW_RX_PROT_MASK 0x00800000 -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_SW_RX_PROT_GET(x) (((x) & 0x00800000) >> 23) -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_SW_RX_PROT_SET(x) (((x) << 23) & 0x00800000) -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_DIV_LNADIV_MSB 24 -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_DIV_LNADIV_LSB 24 -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_DIV_LNADIV_MASK 0x01000000 -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_DIV_LNADIV_GET(x) (((x) & 0x01000000) >> 24) -#define BB_MULTICHAIN_GAIN_CTRL_ENABLE_ANT_DIV_LNADIV_SET(x) (((x) << 24) & 0x01000000) -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_LNACONF_MSB 26 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_LNACONF_LSB 25 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_LNACONF_MASK 0x06000000 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_LNACONF_GET(x) (((x) & 0x06000000) >> 25) -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_LNACONF_SET(x) (((x) << 25) & 0x06000000) -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_LNACONF_MSB 28 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_LNACONF_LSB 27 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_LNACONF_MASK 0x18000000 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_LNACONF_GET(x) (((x) & 0x18000000) >> 27) -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_LNACONF_SET(x) (((x) << 27) & 0x18000000) -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_GAINTB_MSB 29 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_GAINTB_LSB 29 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_GAINTB_MASK 0x20000000 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_GAINTB_GET(x) (((x) & 0x20000000) >> 29) -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_ALT_GAINTB_SET(x) (((x) << 29) & 0x20000000) -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_GAINTB_MSB 30 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_GAINTB_LSB 30 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_GAINTB_MASK 0x40000000 -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_GAINTB_GET(x) (((x) & 0x40000000) >> 30) -#define BB_MULTICHAIN_GAIN_CTRL_ANT_DIV_MAIN_GAINTB_SET(x) (((x) << 30) & 0x40000000) - -/* macros for bb_agc_reg_map.BB_ext_chan_pwr_thr_1 */ -#define BB_EXT_CHAN_PWR_THR_1_ADDRESS 0x0000002c -#define BB_EXT_CHAN_PWR_THR_1_OFFSET 0x0000002c -#define BB_EXT_CHAN_PWR_THR_1_THRESH62_EXT_MSB 7 -#define BB_EXT_CHAN_PWR_THR_1_THRESH62_EXT_LSB 0 -#define BB_EXT_CHAN_PWR_THR_1_THRESH62_EXT_MASK 0x000000ff -#define BB_EXT_CHAN_PWR_THR_1_THRESH62_EXT_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_EXT_CHAN_PWR_THR_1_THRESH62_EXT_SET(x) (((x) << 0) & 0x000000ff) -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_MINGAINIDX_MSB 15 -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_MINGAINIDX_LSB 8 -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_MINGAINIDX_MASK 0x0000ff00 -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_MINGAINIDX_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_MINGAINIDX_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTAGAINIDX_MSB 20 -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTAGAINIDX_LSB 16 -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTAGAINIDX_MASK 0x001f0000 -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTAGAINIDX_GET(x) (((x) & 0x001f0000) >> 16) -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTAGAINIDX_SET(x) (((x) << 16) & 0x001f0000) -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTANF_MSB 26 -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTANF_LSB 21 -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTANF_MASK 0x07e00000 -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTANF_GET(x) (((x) & 0x07e00000) >> 21) -#define BB_EXT_CHAN_PWR_THR_1_ANT_DIV_ALT_ANT_DELTANF_SET(x) (((x) << 21) & 0x07e00000) - -/* macros for bb_agc_reg_map.BB_ext_chan_detect_win */ -#define BB_EXT_CHAN_DETECT_WIN_ADDRESS 0x00000030 -#define BB_EXT_CHAN_DETECT_WIN_OFFSET 0x00000030 -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_MSB 3 -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_LSB 0 -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_MASK 0x0000000f -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_GET(x) (((x) & 0x0000000f) >> 0) -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_SET(x) (((x) << 0) & 0x0000000f) -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_LOW_MSB 7 -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_LOW_LSB 4 -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_LOW_MASK 0x000000f0 -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_LOW_GET(x) (((x) & 0x000000f0) >> 4) -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_LOW_SET(x) (((x) << 4) & 0x000000f0) -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_CCK_MSB 12 -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_CCK_LSB 8 -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_CCK_MASK 0x00001f00 -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_CCK_GET(x) (((x) & 0x00001f00) >> 8) -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_WEAK_CCK_SET(x) (((x) << 8) & 0x00001f00) -#define BB_EXT_CHAN_DETECT_WIN_DET_20H_COUNT_MSB 15 -#define BB_EXT_CHAN_DETECT_WIN_DET_20H_COUNT_LSB 13 -#define BB_EXT_CHAN_DETECT_WIN_DET_20H_COUNT_MASK 0x0000e000 -#define BB_EXT_CHAN_DETECT_WIN_DET_20H_COUNT_GET(x) (((x) & 0x0000e000) >> 13) -#define BB_EXT_CHAN_DETECT_WIN_DET_20H_COUNT_SET(x) (((x) << 13) & 0x0000e000) -#define BB_EXT_CHAN_DETECT_WIN_DET_EXT_BLK_COUNT_MSB 18 -#define BB_EXT_CHAN_DETECT_WIN_DET_EXT_BLK_COUNT_LSB 16 -#define BB_EXT_CHAN_DETECT_WIN_DET_EXT_BLK_COUNT_MASK 0x00070000 -#define BB_EXT_CHAN_DETECT_WIN_DET_EXT_BLK_COUNT_GET(x) (((x) & 0x00070000) >> 16) -#define BB_EXT_CHAN_DETECT_WIN_DET_EXT_BLK_COUNT_SET(x) (((x) << 16) & 0x00070000) -#define BB_EXT_CHAN_DETECT_WIN_WEAK_SIG_THR_CCK_EXT_MSB 24 -#define BB_EXT_CHAN_DETECT_WIN_WEAK_SIG_THR_CCK_EXT_LSB 19 -#define BB_EXT_CHAN_DETECT_WIN_WEAK_SIG_THR_CCK_EXT_MASK 0x01f80000 -#define BB_EXT_CHAN_DETECT_WIN_WEAK_SIG_THR_CCK_EXT_GET(x) (((x) & 0x01f80000) >> 19) -#define BB_EXT_CHAN_DETECT_WIN_WEAK_SIG_THR_CCK_EXT_SET(x) (((x) << 19) & 0x01f80000) -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_THRESH_MSB 28 -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_THRESH_LSB 25 -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_THRESH_MASK 0x1e000000 -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_THRESH_GET(x) (((x) & 0x1e000000) >> 25) -#define BB_EXT_CHAN_DETECT_WIN_DET_DIFF_WIN_THRESH_SET(x) (((x) << 25) & 0x1e000000) - -/* macros for bb_agc_reg_map.BB_pwr_thr_20_40_det */ -#define BB_PWR_THR_20_40_DET_ADDRESS 0x00000034 -#define BB_PWR_THR_20_40_DET_OFFSET 0x00000034 -#define BB_PWR_THR_20_40_DET_PWRDIFF40_THRSTR_MSB 4 -#define BB_PWR_THR_20_40_DET_PWRDIFF40_THRSTR_LSB 0 -#define BB_PWR_THR_20_40_DET_PWRDIFF40_THRSTR_MASK 0x0000001f -#define BB_PWR_THR_20_40_DET_PWRDIFF40_THRSTR_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_PWR_THR_20_40_DET_PWRDIFF40_THRSTR_SET(x) (((x) << 0) & 0x0000001f) -#define BB_PWR_THR_20_40_DET_BLOCKER40_MAX_MSB 10 -#define BB_PWR_THR_20_40_DET_BLOCKER40_MAX_LSB 5 -#define BB_PWR_THR_20_40_DET_BLOCKER40_MAX_MASK 0x000007e0 -#define BB_PWR_THR_20_40_DET_BLOCKER40_MAX_GET(x) (((x) & 0x000007e0) >> 5) -#define BB_PWR_THR_20_40_DET_BLOCKER40_MAX_SET(x) (((x) << 5) & 0x000007e0) -#define BB_PWR_THR_20_40_DET_DET40_PWRSTEP_MAX_MSB 15 -#define BB_PWR_THR_20_40_DET_DET40_PWRSTEP_MAX_LSB 11 -#define BB_PWR_THR_20_40_DET_DET40_PWRSTEP_MAX_MASK 0x0000f800 -#define BB_PWR_THR_20_40_DET_DET40_PWRSTEP_MAX_GET(x) (((x) & 0x0000f800) >> 11) -#define BB_PWR_THR_20_40_DET_DET40_PWRSTEP_MAX_SET(x) (((x) << 11) & 0x0000f800) -#define BB_PWR_THR_20_40_DET_DET40_THR_SNR_MSB 23 -#define BB_PWR_THR_20_40_DET_DET40_THR_SNR_LSB 16 -#define BB_PWR_THR_20_40_DET_DET40_THR_SNR_MASK 0x00ff0000 -#define BB_PWR_THR_20_40_DET_DET40_THR_SNR_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_PWR_THR_20_40_DET_DET40_THR_SNR_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_PWR_THR_20_40_DET_DET40_PRI_BIAS_MSB 28 -#define BB_PWR_THR_20_40_DET_DET40_PRI_BIAS_LSB 24 -#define BB_PWR_THR_20_40_DET_DET40_PRI_BIAS_MASK 0x1f000000 -#define BB_PWR_THR_20_40_DET_DET40_PRI_BIAS_GET(x) (((x) & 0x1f000000) >> 24) -#define BB_PWR_THR_20_40_DET_DET40_PRI_BIAS_SET(x) (((x) << 24) & 0x1f000000) -#define BB_PWR_THR_20_40_DET_PWRSTEP40_ENA_MSB 29 -#define BB_PWR_THR_20_40_DET_PWRSTEP40_ENA_LSB 29 -#define BB_PWR_THR_20_40_DET_PWRSTEP40_ENA_MASK 0x20000000 -#define BB_PWR_THR_20_40_DET_PWRSTEP40_ENA_GET(x) (((x) & 0x20000000) >> 29) -#define BB_PWR_THR_20_40_DET_PWRSTEP40_ENA_SET(x) (((x) << 29) & 0x20000000) -#define BB_PWR_THR_20_40_DET_LOWSNR40_ENA_MSB 30 -#define BB_PWR_THR_20_40_DET_LOWSNR40_ENA_LSB 30 -#define BB_PWR_THR_20_40_DET_LOWSNR40_ENA_MASK 0x40000000 -#define BB_PWR_THR_20_40_DET_LOWSNR40_ENA_GET(x) (((x) & 0x40000000) >> 30) -#define BB_PWR_THR_20_40_DET_LOWSNR40_ENA_SET(x) (((x) << 30) & 0x40000000) - -/* macros for bb_agc_reg_map.BB_rifs_srch */ -#define BB_RIFS_SRCH_ADDRESS 0x00000038 -#define BB_RIFS_SRCH_OFFSET 0x00000038 -#define BB_RIFS_SRCH_INIT_GAIN_DB_OFFSET_MSB 15 -#define BB_RIFS_SRCH_INIT_GAIN_DB_OFFSET_LSB 8 -#define BB_RIFS_SRCH_INIT_GAIN_DB_OFFSET_MASK 0x0000ff00 -#define BB_RIFS_SRCH_INIT_GAIN_DB_OFFSET_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_RIFS_SRCH_INIT_GAIN_DB_OFFSET_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_RIFS_SRCH_RIFS_INIT_DELAY_MSB 25 -#define BB_RIFS_SRCH_RIFS_INIT_DELAY_LSB 16 -#define BB_RIFS_SRCH_RIFS_INIT_DELAY_MASK 0x03ff0000 -#define BB_RIFS_SRCH_RIFS_INIT_DELAY_GET(x) (((x) & 0x03ff0000) >> 16) -#define BB_RIFS_SRCH_RIFS_INIT_DELAY_SET(x) (((x) << 16) & 0x03ff0000) -#define BB_RIFS_SRCH_RIFS_DISABLE_PWRLOW_GC_MSB 26 -#define BB_RIFS_SRCH_RIFS_DISABLE_PWRLOW_GC_LSB 26 -#define BB_RIFS_SRCH_RIFS_DISABLE_PWRLOW_GC_MASK 0x04000000 -#define BB_RIFS_SRCH_RIFS_DISABLE_PWRLOW_GC_GET(x) (((x) & 0x04000000) >> 26) -#define BB_RIFS_SRCH_RIFS_DISABLE_PWRLOW_GC_SET(x) (((x) << 26) & 0x04000000) -#define BB_RIFS_SRCH_RIFS_DISABLE_CCK_DET_MSB 27 -#define BB_RIFS_SRCH_RIFS_DISABLE_CCK_DET_LSB 27 -#define BB_RIFS_SRCH_RIFS_DISABLE_CCK_DET_MASK 0x08000000 -#define BB_RIFS_SRCH_RIFS_DISABLE_CCK_DET_GET(x) (((x) & 0x08000000) >> 27) -#define BB_RIFS_SRCH_RIFS_DISABLE_CCK_DET_SET(x) (((x) << 27) & 0x08000000) - -/* macros for bb_agc_reg_map.BB_peak_det_ctrl_1 */ -#define BB_PEAK_DET_CTRL_1_ADDRESS 0x0000003c -#define BB_PEAK_DET_CTRL_1_OFFSET 0x0000003c -#define BB_PEAK_DET_CTRL_1_USE_OC_GAIN_TABLE_MSB 0 -#define BB_PEAK_DET_CTRL_1_USE_OC_GAIN_TABLE_LSB 0 -#define BB_PEAK_DET_CTRL_1_USE_OC_GAIN_TABLE_MASK 0x00000001 -#define BB_PEAK_DET_CTRL_1_USE_OC_GAIN_TABLE_GET(x) (((x) & 0x00000001) >> 0) -#define BB_PEAK_DET_CTRL_1_USE_OC_GAIN_TABLE_SET(x) (((x) << 0) & 0x00000001) -#define BB_PEAK_DET_CTRL_1_USE_PEAK_DET_MSB 1 -#define BB_PEAK_DET_CTRL_1_USE_PEAK_DET_LSB 1 -#define BB_PEAK_DET_CTRL_1_USE_PEAK_DET_MASK 0x00000002 -#define BB_PEAK_DET_CTRL_1_USE_PEAK_DET_GET(x) (((x) & 0x00000002) >> 1) -#define BB_PEAK_DET_CTRL_1_USE_PEAK_DET_SET(x) (((x) << 1) & 0x00000002) -#define BB_PEAK_DET_CTRL_1_PEAK_DET_WIN_LEN_MSB 7 -#define BB_PEAK_DET_CTRL_1_PEAK_DET_WIN_LEN_LSB 2 -#define BB_PEAK_DET_CTRL_1_PEAK_DET_WIN_LEN_MASK 0x000000fc -#define BB_PEAK_DET_CTRL_1_PEAK_DET_WIN_LEN_GET(x) (((x) & 0x000000fc) >> 2) -#define BB_PEAK_DET_CTRL_1_PEAK_DET_WIN_LEN_SET(x) (((x) << 2) & 0x000000fc) -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_LOW_0_MSB 12 -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_LOW_0_LSB 8 -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_LOW_0_MASK 0x00001f00 -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_LOW_0_GET(x) (((x) & 0x00001f00) >> 8) -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_LOW_0_SET(x) (((x) << 8) & 0x00001f00) -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_MED_0_MSB 17 -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_MED_0_LSB 13 -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_MED_0_MASK 0x0003e000 -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_MED_0_GET(x) (((x) & 0x0003e000) >> 13) -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_MED_0_SET(x) (((x) << 13) & 0x0003e000) -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_HIGH_0_MSB 22 -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_HIGH_0_LSB 18 -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_HIGH_0_MASK 0x007c0000 -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_HIGH_0_GET(x) (((x) & 0x007c0000) >> 18) -#define BB_PEAK_DET_CTRL_1_PEAK_DET_TALLY_THR_HIGH_0_SET(x) (((x) << 18) & 0x007c0000) -#define BB_PEAK_DET_CTRL_1_PEAK_DET_SETTLING_MSB 29 -#define BB_PEAK_DET_CTRL_1_PEAK_DET_SETTLING_LSB 23 -#define BB_PEAK_DET_CTRL_1_PEAK_DET_SETTLING_MASK 0x3f800000 -#define BB_PEAK_DET_CTRL_1_PEAK_DET_SETTLING_GET(x) (((x) & 0x3f800000) >> 23) -#define BB_PEAK_DET_CTRL_1_PEAK_DET_SETTLING_SET(x) (((x) << 23) & 0x3f800000) -#define BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_CAL_MSB 30 -#define BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_CAL_LSB 30 -#define BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_CAL_MASK 0x40000000 -#define BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_CAL_GET(x) (((x) & 0x40000000) >> 30) -#define BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_CAL_SET(x) (((x) << 30) & 0x40000000) -#define BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_RX_MSB 31 -#define BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_RX_LSB 31 -#define BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_RX_MASK 0x80000000 -#define BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_RX_GET(x) (((x) & 0x80000000) >> 31) -#define BB_PEAK_DET_CTRL_1_PWD_PKDET_DURING_RX_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_agc_reg_map.BB_peak_det_ctrl_2 */ -#define BB_PEAK_DET_CTRL_2_ADDRESS 0x00000040 -#define BB_PEAK_DET_CTRL_2_OFFSET 0x00000040 -#define BB_PEAK_DET_CTRL_2_RFSAT_2_ADD_RFGAIN_DEL_MSB 9 -#define BB_PEAK_DET_CTRL_2_RFSAT_2_ADD_RFGAIN_DEL_LSB 0 -#define BB_PEAK_DET_CTRL_2_RFSAT_2_ADD_RFGAIN_DEL_MASK 0x000003ff -#define BB_PEAK_DET_CTRL_2_RFSAT_2_ADD_RFGAIN_DEL_GET(x) (((x) & 0x000003ff) >> 0) -#define BB_PEAK_DET_CTRL_2_RFSAT_2_ADD_RFGAIN_DEL_SET(x) (((x) << 0) & 0x000003ff) -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_LOW_0_MSB 14 -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_LOW_0_LSB 10 -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_LOW_0_MASK 0x00007c00 -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_LOW_0_GET(x) (((x) & 0x00007c00) >> 10) -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_LOW_0_SET(x) (((x) << 10) & 0x00007c00) -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_MED_0_MSB 19 -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_MED_0_LSB 15 -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_MED_0_MASK 0x000f8000 -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_MED_0_GET(x) (((x) & 0x000f8000) >> 15) -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_MED_0_SET(x) (((x) << 15) & 0x000f8000) -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_HIGH_0_MSB 24 -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_HIGH_0_LSB 20 -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_HIGH_0_MASK 0x01f00000 -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_HIGH_0_GET(x) (((x) & 0x01f00000) >> 20) -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_HIGH_0_SET(x) (((x) << 20) & 0x01f00000) -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_NON_0_MSB 29 -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_NON_0_LSB 25 -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_NON_0_MASK 0x3e000000 -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_NON_0_GET(x) (((x) & 0x3e000000) >> 25) -#define BB_PEAK_DET_CTRL_2_RF_GAIN_DROP_DB_NON_0_SET(x) (((x) << 25) & 0x3e000000) -#define BB_PEAK_DET_CTRL_2_ENABLE_RFSAT_RESTART_MSB 30 -#define BB_PEAK_DET_CTRL_2_ENABLE_RFSAT_RESTART_LSB 30 -#define BB_PEAK_DET_CTRL_2_ENABLE_RFSAT_RESTART_MASK 0x40000000 -#define BB_PEAK_DET_CTRL_2_ENABLE_RFSAT_RESTART_GET(x) (((x) & 0x40000000) >> 30) -#define BB_PEAK_DET_CTRL_2_ENABLE_RFSAT_RESTART_SET(x) (((x) << 30) & 0x40000000) - -/* macros for bb_agc_reg_map.BB_rx_gain_bounds_1 */ -#define BB_RX_GAIN_BOUNDS_1_ADDRESS 0x00000044 -#define BB_RX_GAIN_BOUNDS_1_OFFSET 0x00000044 -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_MB_GAIN_MSB 7 -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_MB_GAIN_LSB 0 -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_MB_GAIN_MASK 0x000000ff -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_MB_GAIN_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_MB_GAIN_SET(x) (((x) << 0) & 0x000000ff) -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_REF_MSB 15 -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_REF_LSB 8 -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_REF_MASK 0x0000ff00 -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_REF_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_REF_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_MSB 23 -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_LSB 16 -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_MASK 0x00ff0000 -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_RX_GAIN_BOUNDS_1_RX_MAX_RF_GAIN_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_2G_MSB 24 -#define BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_2G_LSB 24 -#define BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_2G_MASK 0x01000000 -#define BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_2G_GET(x) (((x) & 0x01000000) >> 24) -#define BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_2G_SET(x) (((x) << 24) & 0x01000000) -#define BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_5G_MSB 25 -#define BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_5G_LSB 25 -#define BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_5G_MASK 0x02000000 -#define BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_5G_GET(x) (((x) & 0x02000000) >> 25) -#define BB_RX_GAIN_BOUNDS_1_RX_OCGAIN_SEL_5G_SET(x) (((x) << 25) & 0x02000000) - -/* macros for bb_agc_reg_map.BB_rx_gain_bounds_2 */ -#define BB_RX_GAIN_BOUNDS_2_ADDRESS 0x00000048 -#define BB_RX_GAIN_BOUNDS_2_OFFSET 0x00000048 -#define BB_RX_GAIN_BOUNDS_2_GC_RSSI_LOW_DB_MSB 7 -#define BB_RX_GAIN_BOUNDS_2_GC_RSSI_LOW_DB_LSB 0 -#define BB_RX_GAIN_BOUNDS_2_GC_RSSI_LOW_DB_MASK 0x000000ff -#define BB_RX_GAIN_BOUNDS_2_GC_RSSI_LOW_DB_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_RX_GAIN_BOUNDS_2_GC_RSSI_LOW_DB_SET(x) (((x) << 0) & 0x000000ff) -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_REF_BASE_ADDR_MSB 15 -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_REF_BASE_ADDR_LSB 8 -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_REF_BASE_ADDR_MASK 0x0000ff00 -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_REF_BASE_ADDR_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_REF_BASE_ADDR_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_BASE_ADDR_MSB 23 -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_BASE_ADDR_LSB 16 -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_BASE_ADDR_MASK 0x00ff0000 -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_BASE_ADDR_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_BASE_ADDR_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_DIV_BASE_ADDR_MSB 31 -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_DIV_BASE_ADDR_LSB 24 -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_DIV_BASE_ADDR_MASK 0xff000000 -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_DIV_BASE_ADDR_GET(x) (((x) & 0xff000000) >> 24) -#define BB_RX_GAIN_BOUNDS_2_RF_GAIN_DIV_BASE_ADDR_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_agc_reg_map.BB_peak_det_cal_ctrl */ -#define BB_PEAK_DET_CAL_CTRL_ADDRESS 0x0000004c -#define BB_PEAK_DET_CAL_CTRL_OFFSET 0x0000004c -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_WIN_THR_MSB 5 -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_WIN_THR_LSB 0 -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_WIN_THR_MASK 0x0000003f -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_WIN_THR_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_WIN_THR_SET(x) (((x) << 0) & 0x0000003f) -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_BIAS_MSB 11 -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_BIAS_LSB 6 -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_BIAS_MASK 0x00000fc0 -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_BIAS_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_BIAS_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_MEAS_TIME_SEL_MSB 13 -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_MEAS_TIME_SEL_LSB 12 -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_MEAS_TIME_SEL_MASK 0x00003000 -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_MEAS_TIME_SEL_GET(x) (((x) & 0x00003000) >> 12) -#define BB_PEAK_DET_CAL_CTRL_PKDET_CAL_MEAS_TIME_SEL_SET(x) (((x) << 12) & 0x00003000) - -/* macros for bb_agc_reg_map.BB_agc_dig_dc_ctrl */ -#define BB_AGC_DIG_DC_CTRL_ADDRESS 0x00000050 -#define BB_AGC_DIG_DC_CTRL_OFFSET 0x00000050 -#define BB_AGC_DIG_DC_CTRL_USE_DIG_DC_MSB 0 -#define BB_AGC_DIG_DC_CTRL_USE_DIG_DC_LSB 0 -#define BB_AGC_DIG_DC_CTRL_USE_DIG_DC_MASK 0x00000001 -#define BB_AGC_DIG_DC_CTRL_USE_DIG_DC_GET(x) (((x) & 0x00000001) >> 0) -#define BB_AGC_DIG_DC_CTRL_USE_DIG_DC_SET(x) (((x) << 0) & 0x00000001) -#define BB_AGC_DIG_DC_CTRL_DIG_DC_SCALE_BIAS_MSB 3 -#define BB_AGC_DIG_DC_CTRL_DIG_DC_SCALE_BIAS_LSB 1 -#define BB_AGC_DIG_DC_CTRL_DIG_DC_SCALE_BIAS_MASK 0x0000000e -#define BB_AGC_DIG_DC_CTRL_DIG_DC_SCALE_BIAS_GET(x) (((x) & 0x0000000e) >> 1) -#define BB_AGC_DIG_DC_CTRL_DIG_DC_SCALE_BIAS_SET(x) (((x) << 1) & 0x0000000e) -#define BB_AGC_DIG_DC_CTRL_DIG_DC_CORRECT_CAP_MSB 9 -#define BB_AGC_DIG_DC_CTRL_DIG_DC_CORRECT_CAP_LSB 4 -#define BB_AGC_DIG_DC_CTRL_DIG_DC_CORRECT_CAP_MASK 0x000003f0 -#define BB_AGC_DIG_DC_CTRL_DIG_DC_CORRECT_CAP_GET(x) (((x) & 0x000003f0) >> 4) -#define BB_AGC_DIG_DC_CTRL_DIG_DC_CORRECT_CAP_SET(x) (((x) << 4) & 0x000003f0) -#define BB_AGC_DIG_DC_CTRL_DIG_DC_SWITCH_CCK_MSB 10 -#define BB_AGC_DIG_DC_CTRL_DIG_DC_SWITCH_CCK_LSB 10 -#define BB_AGC_DIG_DC_CTRL_DIG_DC_SWITCH_CCK_MASK 0x00000400 -#define BB_AGC_DIG_DC_CTRL_DIG_DC_SWITCH_CCK_GET(x) (((x) & 0x00000400) >> 10) -#define BB_AGC_DIG_DC_CTRL_DIG_DC_SWITCH_CCK_SET(x) (((x) << 10) & 0x00000400) -#define BB_AGC_DIG_DC_CTRL_DIG_DC_MIXER_SEL_MASK_MSB 31 -#define BB_AGC_DIG_DC_CTRL_DIG_DC_MIXER_SEL_MASK_LSB 16 -#define BB_AGC_DIG_DC_CTRL_DIG_DC_MIXER_SEL_MASK_MASK 0xffff0000 -#define BB_AGC_DIG_DC_CTRL_DIG_DC_MIXER_SEL_MASK_GET(x) (((x) & 0xffff0000) >> 16) -#define BB_AGC_DIG_DC_CTRL_DIG_DC_MIXER_SEL_MASK_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for bb_agc_reg_map.BB_bt_coex_1 */ -#define BB_BT_COEX_1_ADDRESS 0x00000054 -#define BB_BT_COEX_1_OFFSET 0x00000054 -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_LOW_1_MSB 4 -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_LOW_1_LSB 0 -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_LOW_1_MASK 0x0000001f -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_LOW_1_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_LOW_1_SET(x) (((x) << 0) & 0x0000001f) -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_MED_1_MSB 9 -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_MED_1_LSB 5 -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_MED_1_MASK 0x000003e0 -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_MED_1_GET(x) (((x) & 0x000003e0) >> 5) -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_MED_1_SET(x) (((x) << 5) & 0x000003e0) -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_HIGH_1_MSB 14 -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_HIGH_1_LSB 10 -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_HIGH_1_MASK 0x00007c00 -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_HIGH_1_GET(x) (((x) & 0x00007c00) >> 10) -#define BB_BT_COEX_1_PEAK_DET_TALLY_THR_HIGH_1_SET(x) (((x) << 10) & 0x00007c00) -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_LOW_1_MSB 19 -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_LOW_1_LSB 15 -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_LOW_1_MASK 0x000f8000 -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_LOW_1_GET(x) (((x) & 0x000f8000) >> 15) -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_LOW_1_SET(x) (((x) << 15) & 0x000f8000) -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_MED_1_MSB 24 -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_MED_1_LSB 20 -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_MED_1_MASK 0x01f00000 -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_MED_1_GET(x) (((x) & 0x01f00000) >> 20) -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_MED_1_SET(x) (((x) << 20) & 0x01f00000) -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_HIGH_1_MSB 29 -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_HIGH_1_LSB 25 -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_HIGH_1_MASK 0x3e000000 -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_HIGH_1_GET(x) (((x) & 0x3e000000) >> 25) -#define BB_BT_COEX_1_RF_GAIN_DROP_DB_HIGH_1_SET(x) (((x) << 25) & 0x3e000000) -#define BB_BT_COEX_1_BT_TX_DISABLE_NF_CAL_MSB 30 -#define BB_BT_COEX_1_BT_TX_DISABLE_NF_CAL_LSB 30 -#define BB_BT_COEX_1_BT_TX_DISABLE_NF_CAL_MASK 0x40000000 -#define BB_BT_COEX_1_BT_TX_DISABLE_NF_CAL_GET(x) (((x) & 0x40000000) >> 30) -#define BB_BT_COEX_1_BT_TX_DISABLE_NF_CAL_SET(x) (((x) << 30) & 0x40000000) - -/* macros for bb_agc_reg_map.BB_bt_coex_2 */ -#define BB_BT_COEX_2_ADDRESS 0x00000058 -#define BB_BT_COEX_2_OFFSET 0x00000058 -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_LOW_2_MSB 4 -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_LOW_2_LSB 0 -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_LOW_2_MASK 0x0000001f -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_LOW_2_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_LOW_2_SET(x) (((x) << 0) & 0x0000001f) -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_MED_2_MSB 9 -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_MED_2_LSB 5 -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_MED_2_MASK 0x000003e0 -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_MED_2_GET(x) (((x) & 0x000003e0) >> 5) -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_MED_2_SET(x) (((x) << 5) & 0x000003e0) -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_HIGH_2_MSB 14 -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_HIGH_2_LSB 10 -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_HIGH_2_MASK 0x00007c00 -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_HIGH_2_GET(x) (((x) & 0x00007c00) >> 10) -#define BB_BT_COEX_2_PEAK_DET_TALLY_THR_HIGH_2_SET(x) (((x) << 10) & 0x00007c00) -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_LOW_2_MSB 19 -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_LOW_2_LSB 15 -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_LOW_2_MASK 0x000f8000 -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_LOW_2_GET(x) (((x) & 0x000f8000) >> 15) -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_LOW_2_SET(x) (((x) << 15) & 0x000f8000) -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_MED_2_MSB 24 -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_MED_2_LSB 20 -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_MED_2_MASK 0x01f00000 -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_MED_2_GET(x) (((x) & 0x01f00000) >> 20) -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_MED_2_SET(x) (((x) << 20) & 0x01f00000) -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_HIGH_2_MSB 29 -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_HIGH_2_LSB 25 -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_HIGH_2_MASK 0x3e000000 -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_HIGH_2_GET(x) (((x) & 0x3e000000) >> 25) -#define BB_BT_COEX_2_RF_GAIN_DROP_DB_HIGH_2_SET(x) (((x) << 25) & 0x3e000000) -#define BB_BT_COEX_2_RFSAT_RX_RX_MSB 31 -#define BB_BT_COEX_2_RFSAT_RX_RX_LSB 30 -#define BB_BT_COEX_2_RFSAT_RX_RX_MASK 0xc0000000 -#define BB_BT_COEX_2_RFSAT_RX_RX_GET(x) (((x) & 0xc0000000) >> 30) -#define BB_BT_COEX_2_RFSAT_RX_RX_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for bb_agc_reg_map.BB_bt_coex_3 */ -#define BB_BT_COEX_3_ADDRESS 0x0000005c -#define BB_BT_COEX_3_OFFSET 0x0000005c -#define BB_BT_COEX_3_RFSAT_BT_SRCH_SRCH_MSB 1 -#define BB_BT_COEX_3_RFSAT_BT_SRCH_SRCH_LSB 0 -#define BB_BT_COEX_3_RFSAT_BT_SRCH_SRCH_MASK 0x00000003 -#define BB_BT_COEX_3_RFSAT_BT_SRCH_SRCH_GET(x) (((x) & 0x00000003) >> 0) -#define BB_BT_COEX_3_RFSAT_BT_SRCH_SRCH_SET(x) (((x) << 0) & 0x00000003) -#define BB_BT_COEX_3_RFSAT_BT_RX_SRCH_MSB 3 -#define BB_BT_COEX_3_RFSAT_BT_RX_SRCH_LSB 2 -#define BB_BT_COEX_3_RFSAT_BT_RX_SRCH_MASK 0x0000000c -#define BB_BT_COEX_3_RFSAT_BT_RX_SRCH_GET(x) (((x) & 0x0000000c) >> 2) -#define BB_BT_COEX_3_RFSAT_BT_RX_SRCH_SET(x) (((x) << 2) & 0x0000000c) -#define BB_BT_COEX_3_RFSAT_BT_SRCH_RX_MSB 5 -#define BB_BT_COEX_3_RFSAT_BT_SRCH_RX_LSB 4 -#define BB_BT_COEX_3_RFSAT_BT_SRCH_RX_MASK 0x00000030 -#define BB_BT_COEX_3_RFSAT_BT_SRCH_RX_GET(x) (((x) & 0x00000030) >> 4) -#define BB_BT_COEX_3_RFSAT_BT_SRCH_RX_SET(x) (((x) << 4) & 0x00000030) -#define BB_BT_COEX_3_RFSAT_WLAN_SRCH_SRCH_MSB 7 -#define BB_BT_COEX_3_RFSAT_WLAN_SRCH_SRCH_LSB 6 -#define BB_BT_COEX_3_RFSAT_WLAN_SRCH_SRCH_MASK 0x000000c0 -#define BB_BT_COEX_3_RFSAT_WLAN_SRCH_SRCH_GET(x) (((x) & 0x000000c0) >> 6) -#define BB_BT_COEX_3_RFSAT_WLAN_SRCH_SRCH_SET(x) (((x) << 6) & 0x000000c0) -#define BB_BT_COEX_3_RFSAT_WLAN_RX_SRCH_MSB 9 -#define BB_BT_COEX_3_RFSAT_WLAN_RX_SRCH_LSB 8 -#define BB_BT_COEX_3_RFSAT_WLAN_RX_SRCH_MASK 0x00000300 -#define BB_BT_COEX_3_RFSAT_WLAN_RX_SRCH_GET(x) (((x) & 0x00000300) >> 8) -#define BB_BT_COEX_3_RFSAT_WLAN_RX_SRCH_SET(x) (((x) << 8) & 0x00000300) -#define BB_BT_COEX_3_RFSAT_WLAN_SRCH_RX_MSB 11 -#define BB_BT_COEX_3_RFSAT_WLAN_SRCH_RX_LSB 10 -#define BB_BT_COEX_3_RFSAT_WLAN_SRCH_RX_MASK 0x00000c00 -#define BB_BT_COEX_3_RFSAT_WLAN_SRCH_RX_GET(x) (((x) & 0x00000c00) >> 10) -#define BB_BT_COEX_3_RFSAT_WLAN_SRCH_RX_SET(x) (((x) << 10) & 0x00000c00) -#define BB_BT_COEX_3_RFSAT_EQ_SRCH_SRCH_MSB 13 -#define BB_BT_COEX_3_RFSAT_EQ_SRCH_SRCH_LSB 12 -#define BB_BT_COEX_3_RFSAT_EQ_SRCH_SRCH_MASK 0x00003000 -#define BB_BT_COEX_3_RFSAT_EQ_SRCH_SRCH_GET(x) (((x) & 0x00003000) >> 12) -#define BB_BT_COEX_3_RFSAT_EQ_SRCH_SRCH_SET(x) (((x) << 12) & 0x00003000) -#define BB_BT_COEX_3_RFSAT_EQ_RX_SRCH_MSB 15 -#define BB_BT_COEX_3_RFSAT_EQ_RX_SRCH_LSB 14 -#define BB_BT_COEX_3_RFSAT_EQ_RX_SRCH_MASK 0x0000c000 -#define BB_BT_COEX_3_RFSAT_EQ_RX_SRCH_GET(x) (((x) & 0x0000c000) >> 14) -#define BB_BT_COEX_3_RFSAT_EQ_RX_SRCH_SET(x) (((x) << 14) & 0x0000c000) -#define BB_BT_COEX_3_RFSAT_EQ_SRCH_RX_MSB 17 -#define BB_BT_COEX_3_RFSAT_EQ_SRCH_RX_LSB 16 -#define BB_BT_COEX_3_RFSAT_EQ_SRCH_RX_MASK 0x00030000 -#define BB_BT_COEX_3_RFSAT_EQ_SRCH_RX_GET(x) (((x) & 0x00030000) >> 16) -#define BB_BT_COEX_3_RFSAT_EQ_SRCH_RX_SET(x) (((x) << 16) & 0x00030000) -#define BB_BT_COEX_3_RF_GAIN_DROP_DB_NON_1_MSB 22 -#define BB_BT_COEX_3_RF_GAIN_DROP_DB_NON_1_LSB 18 -#define BB_BT_COEX_3_RF_GAIN_DROP_DB_NON_1_MASK 0x007c0000 -#define BB_BT_COEX_3_RF_GAIN_DROP_DB_NON_1_GET(x) (((x) & 0x007c0000) >> 18) -#define BB_BT_COEX_3_RF_GAIN_DROP_DB_NON_1_SET(x) (((x) << 18) & 0x007c0000) -#define BB_BT_COEX_3_RF_GAIN_DROP_DB_NON_2_MSB 27 -#define BB_BT_COEX_3_RF_GAIN_DROP_DB_NON_2_LSB 23 -#define BB_BT_COEX_3_RF_GAIN_DROP_DB_NON_2_MASK 0x0f800000 -#define BB_BT_COEX_3_RF_GAIN_DROP_DB_NON_2_GET(x) (((x) & 0x0f800000) >> 23) -#define BB_BT_COEX_3_RF_GAIN_DROP_DB_NON_2_SET(x) (((x) << 23) & 0x0f800000) -#define BB_BT_COEX_3_BT_RX_FIRPWR_INCR_MSB 31 -#define BB_BT_COEX_3_BT_RX_FIRPWR_INCR_LSB 28 -#define BB_BT_COEX_3_BT_RX_FIRPWR_INCR_MASK 0xf0000000 -#define BB_BT_COEX_3_BT_RX_FIRPWR_INCR_GET(x) (((x) & 0xf0000000) >> 28) -#define BB_BT_COEX_3_BT_RX_FIRPWR_INCR_SET(x) (((x) << 28) & 0xf0000000) - -/* macros for bb_agc_reg_map.BB_bt_coex_4 */ -#define BB_BT_COEX_4_ADDRESS 0x00000060 -#define BB_BT_COEX_4_OFFSET 0x00000060 -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_0_MSB 7 -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_0_LSB 0 -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_0_MASK 0x000000ff -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_0_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_0_SET(x) (((x) << 0) & 0x000000ff) -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_1_MSB 15 -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_1_LSB 8 -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_1_MASK 0x0000ff00 -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_1_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_1_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_2_MSB 23 -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_2_LSB 16 -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_2_MASK 0x00ff0000 -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_2_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_2_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_3_MSB 31 -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_3_LSB 24 -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_3_MASK 0xff000000 -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_3_GET(x) (((x) & 0xff000000) >> 24) -#define BB_BT_COEX_4_RFGAIN_EQV_LNA_3_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_agc_reg_map.BB_bt_coex_5 */ -#define BB_BT_COEX_5_ADDRESS 0x00000064 -#define BB_BT_COEX_5_OFFSET 0x00000064 -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_4_MSB 7 -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_4_LSB 0 -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_4_MASK 0x000000ff -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_4_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_4_SET(x) (((x) << 0) & 0x000000ff) -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_5_MSB 15 -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_5_LSB 8 -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_5_MASK 0x0000ff00 -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_5_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_5_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_6_MSB 23 -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_6_LSB 16 -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_6_MASK 0x00ff0000 -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_6_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_6_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_7_MSB 31 -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_7_LSB 24 -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_7_MASK 0xff000000 -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_7_GET(x) (((x) & 0xff000000) >> 24) -#define BB_BT_COEX_5_RFGAIN_EQV_LNA_7_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_agc_reg_map.BB_redpwr_ctrl_1 */ -#define BB_REDPWR_CTRL_1_ADDRESS 0x00000068 -#define BB_REDPWR_CTRL_1_OFFSET 0x00000068 -#define BB_REDPWR_CTRL_1_REDPWR_MODE_MSB 1 -#define BB_REDPWR_CTRL_1_REDPWR_MODE_LSB 0 -#define BB_REDPWR_CTRL_1_REDPWR_MODE_MASK 0x00000003 -#define BB_REDPWR_CTRL_1_REDPWR_MODE_GET(x) (((x) & 0x00000003) >> 0) -#define BB_REDPWR_CTRL_1_REDPWR_MODE_SET(x) (((x) << 0) & 0x00000003) -#define BB_REDPWR_CTRL_1_REDPWR_MODE_CLR_MSB 2 -#define BB_REDPWR_CTRL_1_REDPWR_MODE_CLR_LSB 2 -#define BB_REDPWR_CTRL_1_REDPWR_MODE_CLR_MASK 0x00000004 -#define BB_REDPWR_CTRL_1_REDPWR_MODE_CLR_GET(x) (((x) & 0x00000004) >> 2) -#define BB_REDPWR_CTRL_1_REDPWR_MODE_CLR_SET(x) (((x) << 2) & 0x00000004) -#define BB_REDPWR_CTRL_1_REDPWR_MODE_SET_MSB 3 -#define BB_REDPWR_CTRL_1_REDPWR_MODE_SET_LSB 3 -#define BB_REDPWR_CTRL_1_REDPWR_MODE_SET_MASK 0x00000008 -#define BB_REDPWR_CTRL_1_REDPWR_MODE_SET_GET(x) (((x) & 0x00000008) >> 3) -#define BB_REDPWR_CTRL_1_REDPWR_MODE_SET_SET(x) (((x) << 3) & 0x00000008) -#define BB_REDPWR_CTRL_1_GAIN_CORR_DB2_MSB 8 -#define BB_REDPWR_CTRL_1_GAIN_CORR_DB2_LSB 4 -#define BB_REDPWR_CTRL_1_GAIN_CORR_DB2_MASK 0x000001f0 -#define BB_REDPWR_CTRL_1_GAIN_CORR_DB2_GET(x) (((x) & 0x000001f0) >> 4) -#define BB_REDPWR_CTRL_1_GAIN_CORR_DB2_SET(x) (((x) << 4) & 0x000001f0) -#define BB_REDPWR_CTRL_1_SCFIR_ADJ_GAIN_MSB 12 -#define BB_REDPWR_CTRL_1_SCFIR_ADJ_GAIN_LSB 9 -#define BB_REDPWR_CTRL_1_SCFIR_ADJ_GAIN_MASK 0x00001e00 -#define BB_REDPWR_CTRL_1_SCFIR_ADJ_GAIN_GET(x) (((x) & 0x00001e00) >> 9) -#define BB_REDPWR_CTRL_1_SCFIR_ADJ_GAIN_SET(x) (((x) << 9) & 0x00001e00) -#define BB_REDPWR_CTRL_1_QUICKDROP_RF_MSB 17 -#define BB_REDPWR_CTRL_1_QUICKDROP_RF_LSB 13 -#define BB_REDPWR_CTRL_1_QUICKDROP_RF_MASK 0x0003e000 -#define BB_REDPWR_CTRL_1_QUICKDROP_RF_GET(x) (((x) & 0x0003e000) >> 13) -#define BB_REDPWR_CTRL_1_QUICKDROP_RF_SET(x) (((x) << 13) & 0x0003e000) -#define BB_REDPWR_CTRL_1_BYPASS_FIR_F_MSB 18 -#define BB_REDPWR_CTRL_1_BYPASS_FIR_F_LSB 18 -#define BB_REDPWR_CTRL_1_BYPASS_FIR_F_MASK 0x00040000 -#define BB_REDPWR_CTRL_1_BYPASS_FIR_F_GET(x) (((x) & 0x00040000) >> 18) -#define BB_REDPWR_CTRL_1_BYPASS_FIR_F_SET(x) (((x) << 18) & 0x00040000) -#define BB_REDPWR_CTRL_1_ADC_HALF_REF_F_MSB 19 -#define BB_REDPWR_CTRL_1_ADC_HALF_REF_F_LSB 19 -#define BB_REDPWR_CTRL_1_ADC_HALF_REF_F_MASK 0x00080000 -#define BB_REDPWR_CTRL_1_ADC_HALF_REF_F_GET(x) (((x) & 0x00080000) >> 19) -#define BB_REDPWR_CTRL_1_ADC_HALF_REF_F_SET(x) (((x) << 19) & 0x00080000) - -/* macros for bb_agc_reg_map.BB_redpwr_ctrl_2 */ -#define BB_REDPWR_CTRL_2_ADDRESS 0x0000006c -#define BB_REDPWR_CTRL_2_OFFSET 0x0000006c -#define BB_REDPWR_CTRL_2_SC01_SW_INDEX_MSB 6 -#define BB_REDPWR_CTRL_2_SC01_SW_INDEX_LSB 0 -#define BB_REDPWR_CTRL_2_SC01_SW_INDEX_MASK 0x0000007f -#define BB_REDPWR_CTRL_2_SC01_SW_INDEX_GET(x) (((x) & 0x0000007f) >> 0) -#define BB_REDPWR_CTRL_2_SC01_SW_INDEX_SET(x) (((x) << 0) & 0x0000007f) -#define BB_REDPWR_CTRL_2_SC10_SW_INDEX_MSB 13 -#define BB_REDPWR_CTRL_2_SC10_SW_INDEX_LSB 7 -#define BB_REDPWR_CTRL_2_SC10_SW_INDEX_MASK 0x00003f80 -#define BB_REDPWR_CTRL_2_SC10_SW_INDEX_GET(x) (((x) & 0x00003f80) >> 7) -#define BB_REDPWR_CTRL_2_SC10_SW_INDEX_SET(x) (((x) << 7) & 0x00003f80) -#define BB_REDPWR_CTRL_2_LAST_SC0_INDEX_MSB 20 -#define BB_REDPWR_CTRL_2_LAST_SC0_INDEX_LSB 14 -#define BB_REDPWR_CTRL_2_LAST_SC0_INDEX_MASK 0x001fc000 -#define BB_REDPWR_CTRL_2_LAST_SC0_INDEX_GET(x) (((x) & 0x001fc000) >> 14) -#define BB_REDPWR_CTRL_2_LAST_SC0_INDEX_SET(x) (((x) << 14) & 0x001fc000) - -/* macros for bb_agc_reg_map.BB_rssi_b0 */ -#define BB_RSSI_B0_ADDRESS 0x00000180 -#define BB_RSSI_B0_OFFSET 0x00000180 -#define BB_RSSI_B0_RSSI_0_MSB 7 -#define BB_RSSI_B0_RSSI_0_LSB 0 -#define BB_RSSI_B0_RSSI_0_MASK 0x000000ff -#define BB_RSSI_B0_RSSI_0_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_RSSI_B0_RSSI_EXT_0_MSB 15 -#define BB_RSSI_B0_RSSI_EXT_0_LSB 8 -#define BB_RSSI_B0_RSSI_EXT_0_MASK 0x0000ff00 -#define BB_RSSI_B0_RSSI_EXT_0_GET(x) (((x) & 0x0000ff00) >> 8) - -/* macros for bb_agc_reg_map.BB_spur_est_cck_report_b0 */ -#define BB_SPUR_EST_CCK_REPORT_B0_ADDRESS 0x00000184 -#define BB_SPUR_EST_CCK_REPORT_B0_OFFSET 0x00000184 -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_I_0_CCK_MSB 7 -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_I_0_CCK_LSB 0 -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_I_0_CCK_MASK 0x000000ff -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_I_0_CCK_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_Q_0_CCK_MSB 15 -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_Q_0_CCK_LSB 8 -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_Q_0_CCK_MASK 0x0000ff00 -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_SD_Q_0_CCK_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_I_0_CCK_MSB 23 -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_I_0_CCK_LSB 16 -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_I_0_CCK_MASK 0x00ff0000 -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_I_0_CCK_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_Q_0_CCK_MSB 31 -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_Q_0_CCK_LSB 24 -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_Q_0_CCK_MASK 0xff000000 -#define BB_SPUR_EST_CCK_REPORT_B0_SPUR_EST_Q_0_CCK_GET(x) (((x) & 0xff000000) >> 24) - -/* macros for bb_agc_reg_map.BB_agc_dig_dc_status_i_b0 */ -#define BB_AGC_DIG_DC_STATUS_I_B0_ADDRESS 0x00000188 -#define BB_AGC_DIG_DC_STATUS_I_B0_OFFSET 0x00000188 -#define BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C1_RES_I_0_MSB 8 -#define BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C1_RES_I_0_LSB 0 -#define BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C1_RES_I_0_MASK 0x000001ff -#define BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C1_RES_I_0_GET(x) (((x) & 0x000001ff) >> 0) -#define BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C2_RES_I_0_MSB 17 -#define BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C2_RES_I_0_LSB 9 -#define BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C2_RES_I_0_MASK 0x0003fe00 -#define BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C2_RES_I_0_GET(x) (((x) & 0x0003fe00) >> 9) -#define BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C3_RES_I_0_MSB 26 -#define BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C3_RES_I_0_LSB 18 -#define BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C3_RES_I_0_MASK 0x07fc0000 -#define BB_AGC_DIG_DC_STATUS_I_B0_DIG_DC_C3_RES_I_0_GET(x) (((x) & 0x07fc0000) >> 18) - -/* macros for bb_agc_reg_map.BB_agc_dig_dc_status_q_b0 */ -#define BB_AGC_DIG_DC_STATUS_Q_B0_ADDRESS 0x0000018c -#define BB_AGC_DIG_DC_STATUS_Q_B0_OFFSET 0x0000018c -#define BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C1_RES_Q_0_MSB 8 -#define BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C1_RES_Q_0_LSB 0 -#define BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C1_RES_Q_0_MASK 0x000001ff -#define BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C1_RES_Q_0_GET(x) (((x) & 0x000001ff) >> 0) -#define BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C2_RES_Q_0_MSB 17 -#define BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C2_RES_Q_0_LSB 9 -#define BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C2_RES_Q_0_MASK 0x0003fe00 -#define BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C2_RES_Q_0_GET(x) (((x) & 0x0003fe00) >> 9) -#define BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C3_RES_Q_0_MSB 26 -#define BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C3_RES_Q_0_LSB 18 -#define BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C3_RES_Q_0_MASK 0x07fc0000 -#define BB_AGC_DIG_DC_STATUS_Q_B0_DIG_DC_C3_RES_Q_0_GET(x) (((x) & 0x07fc0000) >> 18) - -/* macros for bb_agc_reg_map.BB_dc_cal_status_b0 */ -#define BB_DC_CAL_STATUS_B0_ADDRESS 0x00000190 -#define BB_DC_CAL_STATUS_B0_OFFSET 0x00000190 -#define BB_DC_CAL_STATUS_B0_OFFSETC1I_0_MSB 4 -#define BB_DC_CAL_STATUS_B0_OFFSETC1I_0_LSB 0 -#define BB_DC_CAL_STATUS_B0_OFFSETC1I_0_MASK 0x0000001f -#define BB_DC_CAL_STATUS_B0_OFFSETC1I_0_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_DC_CAL_STATUS_B0_OFFSETC1Q_0_MSB 9 -#define BB_DC_CAL_STATUS_B0_OFFSETC1Q_0_LSB 5 -#define BB_DC_CAL_STATUS_B0_OFFSETC1Q_0_MASK 0x000003e0 -#define BB_DC_CAL_STATUS_B0_OFFSETC1Q_0_GET(x) (((x) & 0x000003e0) >> 5) -#define BB_DC_CAL_STATUS_B0_OFFSETC2I_0_MSB 14 -#define BB_DC_CAL_STATUS_B0_OFFSETC2I_0_LSB 10 -#define BB_DC_CAL_STATUS_B0_OFFSETC2I_0_MASK 0x00007c00 -#define BB_DC_CAL_STATUS_B0_OFFSETC2I_0_GET(x) (((x) & 0x00007c00) >> 10) -#define BB_DC_CAL_STATUS_B0_OFFSETC2Q_0_MSB 19 -#define BB_DC_CAL_STATUS_B0_OFFSETC2Q_0_LSB 15 -#define BB_DC_CAL_STATUS_B0_OFFSETC2Q_0_MASK 0x000f8000 -#define BB_DC_CAL_STATUS_B0_OFFSETC2Q_0_GET(x) (((x) & 0x000f8000) >> 15) -#define BB_DC_CAL_STATUS_B0_OFFSETC3I_0_MSB 24 -#define BB_DC_CAL_STATUS_B0_OFFSETC3I_0_LSB 20 -#define BB_DC_CAL_STATUS_B0_OFFSETC3I_0_MASK 0x01f00000 -#define BB_DC_CAL_STATUS_B0_OFFSETC3I_0_GET(x) (((x) & 0x01f00000) >> 20) -#define BB_DC_CAL_STATUS_B0_OFFSETC3Q_0_MSB 29 -#define BB_DC_CAL_STATUS_B0_OFFSETC3Q_0_LSB 25 -#define BB_DC_CAL_STATUS_B0_OFFSETC3Q_0_MASK 0x3e000000 -#define BB_DC_CAL_STATUS_B0_OFFSETC3Q_0_GET(x) (((x) & 0x3e000000) >> 25) - -/* macros for bb_agc_reg_map.BB_bbb_sig_detect */ -#define BB_BBB_SIG_DETECT_ADDRESS 0x000001c0 -#define BB_BBB_SIG_DETECT_OFFSET 0x000001c0 -#define BB_BBB_SIG_DETECT_WEAK_SIG_THR_CCK_MSB 5 -#define BB_BBB_SIG_DETECT_WEAK_SIG_THR_CCK_LSB 0 -#define BB_BBB_SIG_DETECT_WEAK_SIG_THR_CCK_MASK 0x0000003f -#define BB_BBB_SIG_DETECT_WEAK_SIG_THR_CCK_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_BBB_SIG_DETECT_WEAK_SIG_THR_CCK_SET(x) (((x) << 0) & 0x0000003f) -#define BB_BBB_SIG_DETECT_ANT_SWITCH_TIME_MSB 12 -#define BB_BBB_SIG_DETECT_ANT_SWITCH_TIME_LSB 6 -#define BB_BBB_SIG_DETECT_ANT_SWITCH_TIME_MASK 0x00001fc0 -#define BB_BBB_SIG_DETECT_ANT_SWITCH_TIME_GET(x) (((x) & 0x00001fc0) >> 6) -#define BB_BBB_SIG_DETECT_ANT_SWITCH_TIME_SET(x) (((x) << 6) & 0x00001fc0) -#define BB_BBB_SIG_DETECT_ENABLE_ANT_FAST_DIV_MSB 13 -#define BB_BBB_SIG_DETECT_ENABLE_ANT_FAST_DIV_LSB 13 -#define BB_BBB_SIG_DETECT_ENABLE_ANT_FAST_DIV_MASK 0x00002000 -#define BB_BBB_SIG_DETECT_ENABLE_ANT_FAST_DIV_GET(x) (((x) & 0x00002000) >> 13) -#define BB_BBB_SIG_DETECT_ENABLE_ANT_FAST_DIV_SET(x) (((x) << 13) & 0x00002000) -#define BB_BBB_SIG_DETECT_LB_ALPHA_128_CCK_MSB 14 -#define BB_BBB_SIG_DETECT_LB_ALPHA_128_CCK_LSB 14 -#define BB_BBB_SIG_DETECT_LB_ALPHA_128_CCK_MASK 0x00004000 -#define BB_BBB_SIG_DETECT_LB_ALPHA_128_CCK_GET(x) (((x) & 0x00004000) >> 14) -#define BB_BBB_SIG_DETECT_LB_ALPHA_128_CCK_SET(x) (((x) << 14) & 0x00004000) -#define BB_BBB_SIG_DETECT_LB_RX_ENABLE_CCK_MSB 15 -#define BB_BBB_SIG_DETECT_LB_RX_ENABLE_CCK_LSB 15 -#define BB_BBB_SIG_DETECT_LB_RX_ENABLE_CCK_MASK 0x00008000 -#define BB_BBB_SIG_DETECT_LB_RX_ENABLE_CCK_GET(x) (((x) & 0x00008000) >> 15) -#define BB_BBB_SIG_DETECT_LB_RX_ENABLE_CCK_SET(x) (((x) << 15) & 0x00008000) -#define BB_BBB_SIG_DETECT_CYC32_COARSE_DC_EST_CCK_MSB 16 -#define BB_BBB_SIG_DETECT_CYC32_COARSE_DC_EST_CCK_LSB 16 -#define BB_BBB_SIG_DETECT_CYC32_COARSE_DC_EST_CCK_MASK 0x00010000 -#define BB_BBB_SIG_DETECT_CYC32_COARSE_DC_EST_CCK_GET(x) (((x) & 0x00010000) >> 16) -#define BB_BBB_SIG_DETECT_CYC32_COARSE_DC_EST_CCK_SET(x) (((x) << 16) & 0x00010000) -#define BB_BBB_SIG_DETECT_CYC64_COARSE_DC_EST_CCK_MSB 17 -#define BB_BBB_SIG_DETECT_CYC64_COARSE_DC_EST_CCK_LSB 17 -#define BB_BBB_SIG_DETECT_CYC64_COARSE_DC_EST_CCK_MASK 0x00020000 -#define BB_BBB_SIG_DETECT_CYC64_COARSE_DC_EST_CCK_GET(x) (((x) & 0x00020000) >> 17) -#define BB_BBB_SIG_DETECT_CYC64_COARSE_DC_EST_CCK_SET(x) (((x) << 17) & 0x00020000) -#define BB_BBB_SIG_DETECT_ENABLE_COARSE_DC_CCK_MSB 18 -#define BB_BBB_SIG_DETECT_ENABLE_COARSE_DC_CCK_LSB 18 -#define BB_BBB_SIG_DETECT_ENABLE_COARSE_DC_CCK_MASK 0x00040000 -#define BB_BBB_SIG_DETECT_ENABLE_COARSE_DC_CCK_GET(x) (((x) & 0x00040000) >> 18) -#define BB_BBB_SIG_DETECT_ENABLE_COARSE_DC_CCK_SET(x) (((x) << 18) & 0x00040000) -#define BB_BBB_SIG_DETECT_CYC256_FINE_DC_EST_CCK_MSB 19 -#define BB_BBB_SIG_DETECT_CYC256_FINE_DC_EST_CCK_LSB 19 -#define BB_BBB_SIG_DETECT_CYC256_FINE_DC_EST_CCK_MASK 0x00080000 -#define BB_BBB_SIG_DETECT_CYC256_FINE_DC_EST_CCK_GET(x) (((x) & 0x00080000) >> 19) -#define BB_BBB_SIG_DETECT_CYC256_FINE_DC_EST_CCK_SET(x) (((x) << 19) & 0x00080000) -#define BB_BBB_SIG_DETECT_ENABLE_FINE_DC_CCK_MSB 20 -#define BB_BBB_SIG_DETECT_ENABLE_FINE_DC_CCK_LSB 20 -#define BB_BBB_SIG_DETECT_ENABLE_FINE_DC_CCK_MASK 0x00100000 -#define BB_BBB_SIG_DETECT_ENABLE_FINE_DC_CCK_GET(x) (((x) & 0x00100000) >> 20) -#define BB_BBB_SIG_DETECT_ENABLE_FINE_DC_CCK_SET(x) (((x) << 20) & 0x00100000) -#define BB_BBB_SIG_DETECT_DELAY_START_SYNC_CCK_MSB 21 -#define BB_BBB_SIG_DETECT_DELAY_START_SYNC_CCK_LSB 21 -#define BB_BBB_SIG_DETECT_DELAY_START_SYNC_CCK_MASK 0x00200000 -#define BB_BBB_SIG_DETECT_DELAY_START_SYNC_CCK_GET(x) (((x) & 0x00200000) >> 21) -#define BB_BBB_SIG_DETECT_DELAY_START_SYNC_CCK_SET(x) (((x) << 21) & 0x00200000) -#define BB_BBB_SIG_DETECT_USE_DC_EST_DURING_SRCH_MSB 22 -#define BB_BBB_SIG_DETECT_USE_DC_EST_DURING_SRCH_LSB 22 -#define BB_BBB_SIG_DETECT_USE_DC_EST_DURING_SRCH_MASK 0x00400000 -#define BB_BBB_SIG_DETECT_USE_DC_EST_DURING_SRCH_GET(x) (((x) & 0x00400000) >> 22) -#define BB_BBB_SIG_DETECT_USE_DC_EST_DURING_SRCH_SET(x) (((x) << 22) & 0x00400000) -#define BB_BBB_SIG_DETECT_BBB_MRC_OFF_NO_SWAP_MSB 23 -#define BB_BBB_SIG_DETECT_BBB_MRC_OFF_NO_SWAP_LSB 23 -#define BB_BBB_SIG_DETECT_BBB_MRC_OFF_NO_SWAP_MASK 0x00800000 -#define BB_BBB_SIG_DETECT_BBB_MRC_OFF_NO_SWAP_GET(x) (((x) & 0x00800000) >> 23) -#define BB_BBB_SIG_DETECT_BBB_MRC_OFF_NO_SWAP_SET(x) (((x) << 23) & 0x00800000) -#define BB_BBB_SIG_DETECT_SWAP_DEFAULT_CHAIN_CCK_MSB 24 -#define BB_BBB_SIG_DETECT_SWAP_DEFAULT_CHAIN_CCK_LSB 24 -#define BB_BBB_SIG_DETECT_SWAP_DEFAULT_CHAIN_CCK_MASK 0x01000000 -#define BB_BBB_SIG_DETECT_SWAP_DEFAULT_CHAIN_CCK_GET(x) (((x) & 0x01000000) >> 24) -#define BB_BBB_SIG_DETECT_SWAP_DEFAULT_CHAIN_CCK_SET(x) (((x) << 24) & 0x01000000) -#define BB_BBB_SIG_DETECT_ENABLE_BARKER_TWO_PHASE_MSB 31 -#define BB_BBB_SIG_DETECT_ENABLE_BARKER_TWO_PHASE_LSB 31 -#define BB_BBB_SIG_DETECT_ENABLE_BARKER_TWO_PHASE_MASK 0x80000000 -#define BB_BBB_SIG_DETECT_ENABLE_BARKER_TWO_PHASE_GET(x) (((x) & 0x80000000) >> 31) -#define BB_BBB_SIG_DETECT_ENABLE_BARKER_TWO_PHASE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_agc_reg_map.BB_bbb_dagc_ctrl */ -#define BB_BBB_DAGC_CTRL_ADDRESS 0x000001c4 -#define BB_BBB_DAGC_CTRL_OFFSET 0x000001c4 -#define BB_BBB_DAGC_CTRL_ENABLE_DAGC_CCK_MSB 0 -#define BB_BBB_DAGC_CTRL_ENABLE_DAGC_CCK_LSB 0 -#define BB_BBB_DAGC_CTRL_ENABLE_DAGC_CCK_MASK 0x00000001 -#define BB_BBB_DAGC_CTRL_ENABLE_DAGC_CCK_GET(x) (((x) & 0x00000001) >> 0) -#define BB_BBB_DAGC_CTRL_ENABLE_DAGC_CCK_SET(x) (((x) << 0) & 0x00000001) -#define BB_BBB_DAGC_CTRL_DAGC_TARGET_PWR_CCK_MSB 8 -#define BB_BBB_DAGC_CTRL_DAGC_TARGET_PWR_CCK_LSB 1 -#define BB_BBB_DAGC_CTRL_DAGC_TARGET_PWR_CCK_MASK 0x000001fe -#define BB_BBB_DAGC_CTRL_DAGC_TARGET_PWR_CCK_GET(x) (((x) & 0x000001fe) >> 1) -#define BB_BBB_DAGC_CTRL_DAGC_TARGET_PWR_CCK_SET(x) (((x) << 1) & 0x000001fe) -#define BB_BBB_DAGC_CTRL_ENABLE_BARKER_RSSI_THR_MSB 9 -#define BB_BBB_DAGC_CTRL_ENABLE_BARKER_RSSI_THR_LSB 9 -#define BB_BBB_DAGC_CTRL_ENABLE_BARKER_RSSI_THR_MASK 0x00000200 -#define BB_BBB_DAGC_CTRL_ENABLE_BARKER_RSSI_THR_GET(x) (((x) & 0x00000200) >> 9) -#define BB_BBB_DAGC_CTRL_ENABLE_BARKER_RSSI_THR_SET(x) (((x) << 9) & 0x00000200) -#define BB_BBB_DAGC_CTRL_BARKER_RSSI_THR_MSB 16 -#define BB_BBB_DAGC_CTRL_BARKER_RSSI_THR_LSB 10 -#define BB_BBB_DAGC_CTRL_BARKER_RSSI_THR_MASK 0x0001fc00 -#define BB_BBB_DAGC_CTRL_BARKER_RSSI_THR_GET(x) (((x) & 0x0001fc00) >> 10) -#define BB_BBB_DAGC_CTRL_BARKER_RSSI_THR_SET(x) (((x) << 10) & 0x0001fc00) -#define BB_BBB_DAGC_CTRL_ENABLE_FIRSTEP_SEL_MSB 17 -#define BB_BBB_DAGC_CTRL_ENABLE_FIRSTEP_SEL_LSB 17 -#define BB_BBB_DAGC_CTRL_ENABLE_FIRSTEP_SEL_MASK 0x00020000 -#define BB_BBB_DAGC_CTRL_ENABLE_FIRSTEP_SEL_GET(x) (((x) & 0x00020000) >> 17) -#define BB_BBB_DAGC_CTRL_ENABLE_FIRSTEP_SEL_SET(x) (((x) << 17) & 0x00020000) -#define BB_BBB_DAGC_CTRL_FIRSTEP_2_MSB 23 -#define BB_BBB_DAGC_CTRL_FIRSTEP_2_LSB 18 -#define BB_BBB_DAGC_CTRL_FIRSTEP_2_MASK 0x00fc0000 -#define BB_BBB_DAGC_CTRL_FIRSTEP_2_GET(x) (((x) & 0x00fc0000) >> 18) -#define BB_BBB_DAGC_CTRL_FIRSTEP_2_SET(x) (((x) << 18) & 0x00fc0000) -#define BB_BBB_DAGC_CTRL_FIRSTEP_COUNT_LGMAX_MSB 27 -#define BB_BBB_DAGC_CTRL_FIRSTEP_COUNT_LGMAX_LSB 24 -#define BB_BBB_DAGC_CTRL_FIRSTEP_COUNT_LGMAX_MASK 0x0f000000 -#define BB_BBB_DAGC_CTRL_FIRSTEP_COUNT_LGMAX_GET(x) (((x) & 0x0f000000) >> 24) -#define BB_BBB_DAGC_CTRL_FIRSTEP_COUNT_LGMAX_SET(x) (((x) << 24) & 0x0f000000) -#define BB_BBB_DAGC_CTRL_FORCE_RX_CHAIN_CCK_0_MSB 29 -#define BB_BBB_DAGC_CTRL_FORCE_RX_CHAIN_CCK_0_LSB 28 -#define BB_BBB_DAGC_CTRL_FORCE_RX_CHAIN_CCK_0_MASK 0x30000000 -#define BB_BBB_DAGC_CTRL_FORCE_RX_CHAIN_CCK_0_GET(x) (((x) & 0x30000000) >> 28) -#define BB_BBB_DAGC_CTRL_FORCE_RX_CHAIN_CCK_0_SET(x) (((x) << 28) & 0x30000000) -#define BB_BBB_DAGC_CTRL_FORCE_RX_CHAIN_CCK_1_MSB 31 -#define BB_BBB_DAGC_CTRL_FORCE_RX_CHAIN_CCK_1_LSB 30 -#define BB_BBB_DAGC_CTRL_FORCE_RX_CHAIN_CCK_1_MASK 0xc0000000 -#define BB_BBB_DAGC_CTRL_FORCE_RX_CHAIN_CCK_1_GET(x) (((x) & 0xc0000000) >> 30) -#define BB_BBB_DAGC_CTRL_FORCE_RX_CHAIN_CCK_1_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for bb_agc_reg_map.BB_iqcorr_ctrl_cck */ -#define BB_IQCORR_CTRL_CCK_ADDRESS 0x000001c8 -#define BB_IQCORR_CTRL_CCK_OFFSET 0x000001c8 -#define BB_IQCORR_CTRL_CCK_IQCORR_Q_Q_COFF_CCK_MSB 4 -#define BB_IQCORR_CTRL_CCK_IQCORR_Q_Q_COFF_CCK_LSB 0 -#define BB_IQCORR_CTRL_CCK_IQCORR_Q_Q_COFF_CCK_MASK 0x0000001f -#define BB_IQCORR_CTRL_CCK_IQCORR_Q_Q_COFF_CCK_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_IQCORR_CTRL_CCK_IQCORR_Q_Q_COFF_CCK_SET(x) (((x) << 0) & 0x0000001f) -#define BB_IQCORR_CTRL_CCK_IQCORR_Q_I_COFF_CCK_MSB 10 -#define BB_IQCORR_CTRL_CCK_IQCORR_Q_I_COFF_CCK_LSB 5 -#define BB_IQCORR_CTRL_CCK_IQCORR_Q_I_COFF_CCK_MASK 0x000007e0 -#define BB_IQCORR_CTRL_CCK_IQCORR_Q_I_COFF_CCK_GET(x) (((x) & 0x000007e0) >> 5) -#define BB_IQCORR_CTRL_CCK_IQCORR_Q_I_COFF_CCK_SET(x) (((x) << 5) & 0x000007e0) -#define BB_IQCORR_CTRL_CCK_ENABLE_IQCORR_CCK_MSB 11 -#define BB_IQCORR_CTRL_CCK_ENABLE_IQCORR_CCK_LSB 11 -#define BB_IQCORR_CTRL_CCK_ENABLE_IQCORR_CCK_MASK 0x00000800 -#define BB_IQCORR_CTRL_CCK_ENABLE_IQCORR_CCK_GET(x) (((x) & 0x00000800) >> 11) -#define BB_IQCORR_CTRL_CCK_ENABLE_IQCORR_CCK_SET(x) (((x) << 11) & 0x00000800) -#define BB_IQCORR_CTRL_CCK_RXCAL_MEAS_TIME_SEL_MSB 13 -#define BB_IQCORR_CTRL_CCK_RXCAL_MEAS_TIME_SEL_LSB 12 -#define BB_IQCORR_CTRL_CCK_RXCAL_MEAS_TIME_SEL_MASK 0x00003000 -#define BB_IQCORR_CTRL_CCK_RXCAL_MEAS_TIME_SEL_GET(x) (((x) & 0x00003000) >> 12) -#define BB_IQCORR_CTRL_CCK_RXCAL_MEAS_TIME_SEL_SET(x) (((x) << 12) & 0x00003000) -#define BB_IQCORR_CTRL_CCK_CLCAL_MEAS_TIME_SEL_MSB 15 -#define BB_IQCORR_CTRL_CCK_CLCAL_MEAS_TIME_SEL_LSB 14 -#define BB_IQCORR_CTRL_CCK_CLCAL_MEAS_TIME_SEL_MASK 0x0000c000 -#define BB_IQCORR_CTRL_CCK_CLCAL_MEAS_TIME_SEL_GET(x) (((x) & 0x0000c000) >> 14) -#define BB_IQCORR_CTRL_CCK_CLCAL_MEAS_TIME_SEL_SET(x) (((x) << 14) & 0x0000c000) -#define BB_IQCORR_CTRL_CCK_CF_CLC_INIT_RFGAIN_MSB 20 -#define BB_IQCORR_CTRL_CCK_CF_CLC_INIT_RFGAIN_LSB 16 -#define BB_IQCORR_CTRL_CCK_CF_CLC_INIT_RFGAIN_MASK 0x001f0000 -#define BB_IQCORR_CTRL_CCK_CF_CLC_INIT_RFGAIN_GET(x) (((x) & 0x001f0000) >> 16) -#define BB_IQCORR_CTRL_CCK_CF_CLC_INIT_RFGAIN_SET(x) (((x) << 16) & 0x001f0000) - -/* macros for bb_agc_reg_map.BB_cck_spur_mit */ -#define BB_CCK_SPUR_MIT_ADDRESS 0x000001cc -#define BB_CCK_SPUR_MIT_OFFSET 0x000001cc -#define BB_CCK_SPUR_MIT_USE_CCK_SPUR_MIT_MSB 0 -#define BB_CCK_SPUR_MIT_USE_CCK_SPUR_MIT_LSB 0 -#define BB_CCK_SPUR_MIT_USE_CCK_SPUR_MIT_MASK 0x00000001 -#define BB_CCK_SPUR_MIT_USE_CCK_SPUR_MIT_GET(x) (((x) & 0x00000001) >> 0) -#define BB_CCK_SPUR_MIT_USE_CCK_SPUR_MIT_SET(x) (((x) << 0) & 0x00000001) -#define BB_CCK_SPUR_MIT_SPUR_RSSI_THR_MSB 8 -#define BB_CCK_SPUR_MIT_SPUR_RSSI_THR_LSB 1 -#define BB_CCK_SPUR_MIT_SPUR_RSSI_THR_MASK 0x000001fe -#define BB_CCK_SPUR_MIT_SPUR_RSSI_THR_GET(x) (((x) & 0x000001fe) >> 1) -#define BB_CCK_SPUR_MIT_SPUR_RSSI_THR_SET(x) (((x) << 1) & 0x000001fe) -#define BB_CCK_SPUR_MIT_CCK_SPUR_FREQ_MSB 28 -#define BB_CCK_SPUR_MIT_CCK_SPUR_FREQ_LSB 9 -#define BB_CCK_SPUR_MIT_CCK_SPUR_FREQ_MASK 0x1ffffe00 -#define BB_CCK_SPUR_MIT_CCK_SPUR_FREQ_GET(x) (((x) & 0x1ffffe00) >> 9) -#define BB_CCK_SPUR_MIT_CCK_SPUR_FREQ_SET(x) (((x) << 9) & 0x1ffffe00) -#define BB_CCK_SPUR_MIT_SPUR_FILTER_TYPE_MSB 30 -#define BB_CCK_SPUR_MIT_SPUR_FILTER_TYPE_LSB 29 -#define BB_CCK_SPUR_MIT_SPUR_FILTER_TYPE_MASK 0x60000000 -#define BB_CCK_SPUR_MIT_SPUR_FILTER_TYPE_GET(x) (((x) & 0x60000000) >> 29) -#define BB_CCK_SPUR_MIT_SPUR_FILTER_TYPE_SET(x) (((x) << 29) & 0x60000000) - -/* macros for bb_agc_reg_map.BB_mrc_cck_ctrl */ -#define BB_MRC_CCK_CTRL_ADDRESS 0x000001d0 -#define BB_MRC_CCK_CTRL_OFFSET 0x000001d0 -#define BB_MRC_CCK_CTRL_BBB_MRC_EN_MSB 0 -#define BB_MRC_CCK_CTRL_BBB_MRC_EN_LSB 0 -#define BB_MRC_CCK_CTRL_BBB_MRC_EN_MASK 0x00000001 -#define BB_MRC_CCK_CTRL_BBB_MRC_EN_GET(x) (((x) & 0x00000001) >> 0) -#define BB_MRC_CCK_CTRL_BBB_MRC_EN_SET(x) (((x) << 0) & 0x00000001) -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_MUX_REG_MSB 1 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_MUX_REG_LSB 1 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_MUX_REG_MASK 0x00000002 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_MUX_REG_GET(x) (((x) & 0x00000002) >> 1) -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_MUX_REG_SET(x) (((x) << 1) & 0x00000002) -#define BB_MRC_CCK_CTRL_AGCDP_CCK_PD_ACCU_THR_HI_MSB 4 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_PD_ACCU_THR_HI_LSB 2 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_PD_ACCU_THR_HI_MASK 0x0000001c -#define BB_MRC_CCK_CTRL_AGCDP_CCK_PD_ACCU_THR_HI_GET(x) (((x) & 0x0000001c) >> 2) -#define BB_MRC_CCK_CTRL_AGCDP_CCK_PD_ACCU_THR_HI_SET(x) (((x) << 2) & 0x0000001c) -#define BB_MRC_CCK_CTRL_AGCDP_CCK_PD_ACCU_THR_LOW_MSB 7 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_PD_ACCU_THR_LOW_LSB 5 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_PD_ACCU_THR_LOW_MASK 0x000000e0 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_PD_ACCU_THR_LOW_GET(x) (((x) & 0x000000e0) >> 5) -#define BB_MRC_CCK_CTRL_AGCDP_CCK_PD_ACCU_THR_LOW_SET(x) (((x) << 5) & 0x000000e0) -#define BB_MRC_CCK_CTRL_AGCDP_CCK_BARKER_RSSI_THR_MSB 11 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_BARKER_RSSI_THR_LSB 8 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_BARKER_RSSI_THR_MASK 0x00000f00 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_BARKER_RSSI_THR_GET(x) (((x) & 0x00000f00) >> 8) -#define BB_MRC_CCK_CTRL_AGCDP_CCK_BARKER_RSSI_THR_SET(x) (((x) << 8) & 0x00000f00) -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_BK_THR_HI_MSB 16 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_BK_THR_HI_LSB 12 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_BK_THR_HI_MASK 0x0001f000 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_BK_THR_HI_GET(x) (((x) & 0x0001f000) >> 12) -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_BK_THR_HI_SET(x) (((x) << 12) & 0x0001f000) -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_BK_THR_LOW_MSB 21 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_BK_THR_LOW_LSB 17 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_BK_THR_LOW_MASK 0x003e0000 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_BK_THR_LOW_GET(x) (((x) & 0x003e0000) >> 17) -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MRC_BK_THR_LOW_SET(x) (((x) << 17) & 0x003e0000) -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MIN_VALUE_MSB 27 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MIN_VALUE_LSB 22 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MIN_VALUE_MASK 0x0fc00000 -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MIN_VALUE_GET(x) (((x) & 0x0fc00000) >> 22) -#define BB_MRC_CCK_CTRL_AGCDP_CCK_MIN_VALUE_SET(x) (((x) << 22) & 0x0fc00000) - -/* macros for bb_agc_reg_map.BB_cck_blocker_det */ -#define BB_CCK_BLOCKER_DET_ADDRESS 0x000001d4 -#define BB_CCK_BLOCKER_DET_OFFSET 0x000001d4 -#define BB_CCK_BLOCKER_DET_CCK_FREQ_SHIFT_BLOCKER_DETECTION_MSB 0 -#define BB_CCK_BLOCKER_DET_CCK_FREQ_SHIFT_BLOCKER_DETECTION_LSB 0 -#define BB_CCK_BLOCKER_DET_CCK_FREQ_SHIFT_BLOCKER_DETECTION_MASK 0x00000001 -#define BB_CCK_BLOCKER_DET_CCK_FREQ_SHIFT_BLOCKER_DETECTION_GET(x) (((x) & 0x00000001) >> 0) -#define BB_CCK_BLOCKER_DET_CCK_FREQ_SHIFT_BLOCKER_DETECTION_SET(x) (((x) << 0) & 0x00000001) -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_RESTART_WEAK_SIG_MSB 1 -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_RESTART_WEAK_SIG_LSB 1 -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_RESTART_WEAK_SIG_MASK 0x00000002 -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_RESTART_WEAK_SIG_GET(x) (((x) & 0x00000002) >> 1) -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_RESTART_WEAK_SIG_SET(x) (((x) << 1) & 0x00000002) -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_BKSUM_NUM_MSB 5 -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_BKSUM_NUM_LSB 2 -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_BKSUM_NUM_MASK 0x0000003c -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_BKSUM_NUM_GET(x) (((x) & 0x0000003c) >> 2) -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_BKSUM_NUM_SET(x) (((x) << 2) & 0x0000003c) -#define BB_CCK_BLOCKER_DET_BK_VALID_DELAY_MSB 8 -#define BB_CCK_BLOCKER_DET_BK_VALID_DELAY_LSB 6 -#define BB_CCK_BLOCKER_DET_BK_VALID_DELAY_MASK 0x000001c0 -#define BB_CCK_BLOCKER_DET_BK_VALID_DELAY_GET(x) (((x) & 0x000001c0) >> 6) -#define BB_CCK_BLOCKER_DET_BK_VALID_DELAY_SET(x) (((x) << 6) & 0x000001c0) -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_THR_MSB 13 -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_THR_LSB 9 -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_THR_MASK 0x00003e00 -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_THR_GET(x) (((x) & 0x00003e00) >> 9) -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_THR_SET(x) (((x) << 9) & 0x00003e00) -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_DELAY_THR_MSB 19 -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_DELAY_THR_LSB 14 -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_DELAY_THR_MASK 0x000fc000 -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_DELAY_THR_GET(x) (((x) & 0x000fc000) >> 14) -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_DET_DELAY_THR_SET(x) (((x) << 14) & 0x000fc000) -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_MONITOR_TIME_MSB 25 -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_MONITOR_TIME_LSB 20 -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_MONITOR_TIME_MASK 0x03f00000 -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_MONITOR_TIME_GET(x) (((x) & 0x03f00000) >> 20) -#define BB_CCK_BLOCKER_DET_CCK_BLOCKER_MONITOR_TIME_SET(x) (((x) << 20) & 0x03f00000) -#define BB_CCK_BLOCKER_DET_SKIP_RAMP_ENABLE_MSB 26 -#define BB_CCK_BLOCKER_DET_SKIP_RAMP_ENABLE_LSB 26 -#define BB_CCK_BLOCKER_DET_SKIP_RAMP_ENABLE_MASK 0x04000000 -#define BB_CCK_BLOCKER_DET_SKIP_RAMP_ENABLE_GET(x) (((x) & 0x04000000) >> 26) -#define BB_CCK_BLOCKER_DET_SKIP_RAMP_ENABLE_SET(x) (((x) << 26) & 0x04000000) -#define BB_CCK_BLOCKER_DET_CCK_DET_RAMP_THR_MSB 31 -#define BB_CCK_BLOCKER_DET_CCK_DET_RAMP_THR_LSB 27 -#define BB_CCK_BLOCKER_DET_CCK_DET_RAMP_THR_MASK 0xf8000000 -#define BB_CCK_BLOCKER_DET_CCK_DET_RAMP_THR_GET(x) (((x) & 0xf8000000) >> 27) -#define BB_CCK_BLOCKER_DET_CCK_DET_RAMP_THR_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for bb_agc_reg_map.BB_rx_ocgain */ -#define BB_RX_OCGAIN_ADDRESS 0x00000200 -#define BB_RX_OCGAIN_OFFSET 0x00000200 -#define BB_RX_OCGAIN_GAIN_ENTRY_MSB 31 -#define BB_RX_OCGAIN_GAIN_ENTRY_LSB 0 -#define BB_RX_OCGAIN_GAIN_ENTRY_MASK 0xffffffff -#define BB_RX_OCGAIN_GAIN_ENTRY_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_RX_OCGAIN_GAIN_ENTRY_SET(x) (((x) << 0) & 0xffffffff) - -#ifndef __ASSEMBLER__ - -typedef struct bb_reg_reg_s_4 { - volatile unsigned int BB_settling_time; /* 0x0 - 0x4 */ - volatile unsigned int BB_gain_force_max_gains_b0; /* 0x4 - 0x8 */ - volatile unsigned int BB_gains_min_offsets; /* 0x8 - 0xc */ - volatile unsigned int BB_desired_sigsize; /* 0xc - 0x10 */ - volatile unsigned int BB_find_signal; /* 0x10 - 0x14 */ - volatile unsigned int BB_agc; /* 0x14 - 0x18 */ - volatile unsigned int BB_ext_atten_switch_ctl_b0; /* 0x18 - 0x1c */ - volatile unsigned int BB_cca_b0; /* 0x1c - 0x20 */ - volatile unsigned int BB_cca_ctrl_2_b0; /* 0x20 - 0x24 */ - volatile unsigned int BB_restart; /* 0x24 - 0x28 */ - volatile unsigned int BB_multichain_gain_ctrl; /* 0x28 - 0x2c */ - volatile unsigned int BB_ext_chan_pwr_thr_1; /* 0x2c - 0x30 */ - volatile unsigned int BB_ext_chan_detect_win; /* 0x30 - 0x34 */ - volatile unsigned int BB_pwr_thr_20_40_det; /* 0x34 - 0x38 */ - volatile unsigned int BB_rifs_srch; /* 0x38 - 0x3c */ - volatile unsigned int BB_peak_det_ctrl_1; /* 0x3c - 0x40 */ - volatile unsigned int BB_peak_det_ctrl_2; /* 0x40 - 0x44 */ - volatile unsigned int BB_rx_gain_bounds_1; /* 0x44 - 0x48 */ - volatile unsigned int BB_rx_gain_bounds_2; /* 0x48 - 0x4c */ - volatile unsigned int BB_peak_det_cal_ctrl; /* 0x4c - 0x50 */ - volatile unsigned int BB_agc_dig_dc_ctrl; /* 0x50 - 0x54 */ - volatile unsigned int BB_bt_coex_1; /* 0x54 - 0x58 */ - volatile unsigned int BB_bt_coex_2; /* 0x58 - 0x5c */ - volatile unsigned int BB_bt_coex_3; /* 0x5c - 0x60 */ - volatile unsigned int BB_bt_coex_4; /* 0x60 - 0x64 */ - volatile unsigned int BB_bt_coex_5; /* 0x64 - 0x68 */ - volatile unsigned int BB_redpwr_ctrl_1; /* 0x68 - 0x6c */ - volatile unsigned int BB_redpwr_ctrl_2; /* 0x6c - 0x70 */ - volatile char pad__0[0x110]; /* 0x70 - 0x180 */ - volatile unsigned int BB_rssi_b0; /* 0x180 - 0x184 */ - volatile unsigned int BB_spur_est_cck_report_b0; /* 0x184 - 0x188 */ - volatile unsigned int BB_agc_dig_dc_status_i_b0; /* 0x188 - 0x18c */ - volatile unsigned int BB_agc_dig_dc_status_q_b0; /* 0x18c - 0x190 */ - volatile unsigned int BB_dc_cal_status_b0; /* 0x190 - 0x194 */ - volatile char pad__1[0x2c]; /* 0x194 - 0x1c0 */ - volatile unsigned int BB_bbb_sig_detect; /* 0x1c0 - 0x1c4 */ - volatile unsigned int BB_bbb_dagc_ctrl; /* 0x1c4 - 0x1c8 */ - volatile unsigned int BB_iqcorr_ctrl_cck; /* 0x1c8 - 0x1cc */ - volatile unsigned int BB_cck_spur_mit; /* 0x1cc - 0x1d0 */ - volatile unsigned int BB_mrc_cck_ctrl; /* 0x1d0 - 0x1d4 */ - volatile unsigned int BB_cck_blocker_det; /* 0x1d4 - 0x1d8 */ - volatile char pad__2[0x28]; /* 0x1d8 - 0x200 */ - volatile unsigned int BB_rx_ocgain[128]; /* 0x200 - 0x400 */ -} bb_reg_reg_t_4; - -#endif /* __ASSEMBLER__ */ - - -/* macros for bb_sm_reg_map.BB_D2_chip_id */ -#define BB_D2_CHIP_ID_ADDRESS 0x00000000 -#define BB_D2_CHIP_ID_OFFSET 0x00000000 -#define BB_D2_CHIP_ID_OLD_ID_MSB 7 -#define BB_D2_CHIP_ID_OLD_ID_LSB 0 -#define BB_D2_CHIP_ID_OLD_ID_MASK 0x000000ff -#define BB_D2_CHIP_ID_OLD_ID_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_D2_CHIP_ID_ID_MSB 31 -#define BB_D2_CHIP_ID_ID_LSB 8 -#define BB_D2_CHIP_ID_ID_MASK 0xffffff00 -#define BB_D2_CHIP_ID_ID_GET(x) (((x) & 0xffffff00) >> 8) - -/* macros for bb_sm_reg_map.BB_gen_controls */ -#define BB_GEN_CONTROLS_ADDRESS 0x00000004 -#define BB_GEN_CONTROLS_OFFSET 0x00000004 -#define BB_GEN_CONTROLS_TURBO_MSB 0 -#define BB_GEN_CONTROLS_TURBO_LSB 0 -#define BB_GEN_CONTROLS_TURBO_MASK 0x00000001 -#define BB_GEN_CONTROLS_TURBO_GET(x) (((x) & 0x00000001) >> 0) -#define BB_GEN_CONTROLS_TURBO_SET(x) (((x) << 0) & 0x00000001) -#define BB_GEN_CONTROLS_CF_SHORT20_MSB 1 -#define BB_GEN_CONTROLS_CF_SHORT20_LSB 1 -#define BB_GEN_CONTROLS_CF_SHORT20_MASK 0x00000002 -#define BB_GEN_CONTROLS_CF_SHORT20_GET(x) (((x) & 0x00000002) >> 1) -#define BB_GEN_CONTROLS_CF_SHORT20_SET(x) (((x) << 1) & 0x00000002) -#define BB_GEN_CONTROLS_DYN_20_40_MSB 2 -#define BB_GEN_CONTROLS_DYN_20_40_LSB 2 -#define BB_GEN_CONTROLS_DYN_20_40_MASK 0x00000004 -#define BB_GEN_CONTROLS_DYN_20_40_GET(x) (((x) & 0x00000004) >> 2) -#define BB_GEN_CONTROLS_DYN_20_40_SET(x) (((x) << 2) & 0x00000004) -#define BB_GEN_CONTROLS_DYN_20_40_PRI_ONLY_MSB 3 -#define BB_GEN_CONTROLS_DYN_20_40_PRI_ONLY_LSB 3 -#define BB_GEN_CONTROLS_DYN_20_40_PRI_ONLY_MASK 0x00000008 -#define BB_GEN_CONTROLS_DYN_20_40_PRI_ONLY_GET(x) (((x) & 0x00000008) >> 3) -#define BB_GEN_CONTROLS_DYN_20_40_PRI_ONLY_SET(x) (((x) << 3) & 0x00000008) -#define BB_GEN_CONTROLS_DYN_20_40_PRI_CHN_MSB 4 -#define BB_GEN_CONTROLS_DYN_20_40_PRI_CHN_LSB 4 -#define BB_GEN_CONTROLS_DYN_20_40_PRI_CHN_MASK 0x00000010 -#define BB_GEN_CONTROLS_DYN_20_40_PRI_CHN_GET(x) (((x) & 0x00000010) >> 4) -#define BB_GEN_CONTROLS_DYN_20_40_PRI_CHN_SET(x) (((x) << 4) & 0x00000010) -#define BB_GEN_CONTROLS_DYN_20_40_EXT_CHN_MSB 5 -#define BB_GEN_CONTROLS_DYN_20_40_EXT_CHN_LSB 5 -#define BB_GEN_CONTROLS_DYN_20_40_EXT_CHN_MASK 0x00000020 -#define BB_GEN_CONTROLS_DYN_20_40_EXT_CHN_GET(x) (((x) & 0x00000020) >> 5) -#define BB_GEN_CONTROLS_DYN_20_40_EXT_CHN_SET(x) (((x) << 5) & 0x00000020) -#define BB_GEN_CONTROLS_HT_ENABLE_MSB 6 -#define BB_GEN_CONTROLS_HT_ENABLE_LSB 6 -#define BB_GEN_CONTROLS_HT_ENABLE_MASK 0x00000040 -#define BB_GEN_CONTROLS_HT_ENABLE_GET(x) (((x) & 0x00000040) >> 6) -#define BB_GEN_CONTROLS_HT_ENABLE_SET(x) (((x) << 6) & 0x00000040) -#define BB_GEN_CONTROLS_ALLOW_SHORT_GI_MSB 7 -#define BB_GEN_CONTROLS_ALLOW_SHORT_GI_LSB 7 -#define BB_GEN_CONTROLS_ALLOW_SHORT_GI_MASK 0x00000080 -#define BB_GEN_CONTROLS_ALLOW_SHORT_GI_GET(x) (((x) & 0x00000080) >> 7) -#define BB_GEN_CONTROLS_ALLOW_SHORT_GI_SET(x) (((x) << 7) & 0x00000080) -#define BB_GEN_CONTROLS_CF_2_CHAINS_USE_WALSH_MSB 8 -#define BB_GEN_CONTROLS_CF_2_CHAINS_USE_WALSH_LSB 8 -#define BB_GEN_CONTROLS_CF_2_CHAINS_USE_WALSH_MASK 0x00000100 -#define BB_GEN_CONTROLS_CF_2_CHAINS_USE_WALSH_GET(x) (((x) & 0x00000100) >> 8) -#define BB_GEN_CONTROLS_CF_2_CHAINS_USE_WALSH_SET(x) (((x) << 8) & 0x00000100) -#define BB_GEN_CONTROLS_CF_3_CHAINS_USE_WALSH_MSB 9 -#define BB_GEN_CONTROLS_CF_3_CHAINS_USE_WALSH_LSB 9 -#define BB_GEN_CONTROLS_CF_3_CHAINS_USE_WALSH_MASK 0x00000200 -#define BB_GEN_CONTROLS_CF_3_CHAINS_USE_WALSH_GET(x) (((x) & 0x00000200) >> 9) -#define BB_GEN_CONTROLS_CF_3_CHAINS_USE_WALSH_SET(x) (((x) << 9) & 0x00000200) -#define BB_GEN_CONTROLS_GF_ENABLE_MSB 10 -#define BB_GEN_CONTROLS_GF_ENABLE_LSB 10 -#define BB_GEN_CONTROLS_GF_ENABLE_MASK 0x00000400 -#define BB_GEN_CONTROLS_GF_ENABLE_GET(x) (((x) & 0x00000400) >> 10) -#define BB_GEN_CONTROLS_GF_ENABLE_SET(x) (((x) << 10) & 0x00000400) -#define BB_GEN_CONTROLS_ENABLE_DAC_ASYNC_FIFO_MSB 11 -#define BB_GEN_CONTROLS_ENABLE_DAC_ASYNC_FIFO_LSB 11 -#define BB_GEN_CONTROLS_ENABLE_DAC_ASYNC_FIFO_MASK 0x00000800 -#define BB_GEN_CONTROLS_ENABLE_DAC_ASYNC_FIFO_GET(x) (((x) & 0x00000800) >> 11) -#define BB_GEN_CONTROLS_ENABLE_DAC_ASYNC_FIFO_SET(x) (((x) << 11) & 0x00000800) -#define BB_GEN_CONTROLS_BOND_OPT_CHAIN_SEL_MSB 14 -#define BB_GEN_CONTROLS_BOND_OPT_CHAIN_SEL_LSB 14 -#define BB_GEN_CONTROLS_BOND_OPT_CHAIN_SEL_MASK 0x00004000 -#define BB_GEN_CONTROLS_BOND_OPT_CHAIN_SEL_GET(x) (((x) & 0x00004000) >> 14) -#define BB_GEN_CONTROLS_BOND_OPT_CHAIN_SEL_SET(x) (((x) << 14) & 0x00004000) -#define BB_GEN_CONTROLS_STATIC20_MODE_HT40_PACKET_HANDLING_MSB 15 -#define BB_GEN_CONTROLS_STATIC20_MODE_HT40_PACKET_HANDLING_LSB 15 -#define BB_GEN_CONTROLS_STATIC20_MODE_HT40_PACKET_HANDLING_MASK 0x00008000 -#define BB_GEN_CONTROLS_STATIC20_MODE_HT40_PACKET_HANDLING_GET(x) (((x) & 0x00008000) >> 15) -#define BB_GEN_CONTROLS_STATIC20_MODE_HT40_PACKET_HANDLING_SET(x) (((x) << 15) & 0x00008000) -#define BB_GEN_CONTROLS_STATIC20_MODE_HT40_PACKET_ERROR_RPT_MSB 16 -#define BB_GEN_CONTROLS_STATIC20_MODE_HT40_PACKET_ERROR_RPT_LSB 16 -#define BB_GEN_CONTROLS_STATIC20_MODE_HT40_PACKET_ERROR_RPT_MASK 0x00010000 -#define BB_GEN_CONTROLS_STATIC20_MODE_HT40_PACKET_ERROR_RPT_GET(x) (((x) & 0x00010000) >> 16) -#define BB_GEN_CONTROLS_STATIC20_MODE_HT40_PACKET_ERROR_RPT_SET(x) (((x) << 16) & 0x00010000) -#define BB_GEN_CONTROLS_ENABLE_CSD_PHASE_DITHERING_MSB 17 -#define BB_GEN_CONTROLS_ENABLE_CSD_PHASE_DITHERING_LSB 17 -#define BB_GEN_CONTROLS_ENABLE_CSD_PHASE_DITHERING_MASK 0x00020000 -#define BB_GEN_CONTROLS_ENABLE_CSD_PHASE_DITHERING_GET(x) (((x) & 0x00020000) >> 17) -#define BB_GEN_CONTROLS_ENABLE_CSD_PHASE_DITHERING_SET(x) (((x) << 17) & 0x00020000) -#define BB_GEN_CONTROLS_UNSUPP_HT_RATE_THRESHOLD_MSB 24 -#define BB_GEN_CONTROLS_UNSUPP_HT_RATE_THRESHOLD_LSB 18 -#define BB_GEN_CONTROLS_UNSUPP_HT_RATE_THRESHOLD_MASK 0x01fc0000 -#define BB_GEN_CONTROLS_UNSUPP_HT_RATE_THRESHOLD_GET(x) (((x) & 0x01fc0000) >> 18) -#define BB_GEN_CONTROLS_UNSUPP_HT_RATE_THRESHOLD_SET(x) (((x) << 18) & 0x01fc0000) -#define BB_GEN_CONTROLS_EN_ERR_TX_CHAIN_MASK_ZERO_MSB 25 -#define BB_GEN_CONTROLS_EN_ERR_TX_CHAIN_MASK_ZERO_LSB 25 -#define BB_GEN_CONTROLS_EN_ERR_TX_CHAIN_MASK_ZERO_MASK 0x02000000 -#define BB_GEN_CONTROLS_EN_ERR_TX_CHAIN_MASK_ZERO_GET(x) (((x) & 0x02000000) >> 25) -#define BB_GEN_CONTROLS_EN_ERR_TX_CHAIN_MASK_ZERO_SET(x) (((x) << 25) & 0x02000000) -#define BB_GEN_CONTROLS_IS_MCKINLEY_TPC_MSB 26 -#define BB_GEN_CONTROLS_IS_MCKINLEY_TPC_LSB 26 -#define BB_GEN_CONTROLS_IS_MCKINLEY_TPC_MASK 0x04000000 -#define BB_GEN_CONTROLS_IS_MCKINLEY_TPC_GET(x) (((x) & 0x04000000) >> 26) -#define BB_GEN_CONTROLS_IS_MCKINLEY_TPC_SET(x) (((x) << 26) & 0x04000000) - -/* macros for bb_sm_reg_map.BB_modes_select */ -#define BB_MODES_SELECT_ADDRESS 0x00000008 -#define BB_MODES_SELECT_OFFSET 0x00000008 -#define BB_MODES_SELECT_CCK_MODE_MSB 0 -#define BB_MODES_SELECT_CCK_MODE_LSB 0 -#define BB_MODES_SELECT_CCK_MODE_MASK 0x00000001 -#define BB_MODES_SELECT_CCK_MODE_GET(x) (((x) & 0x00000001) >> 0) -#define BB_MODES_SELECT_CCK_MODE_SET(x) (((x) << 0) & 0x00000001) -#define BB_MODES_SELECT_DYN_OFDM_CCK_MODE_MSB 2 -#define BB_MODES_SELECT_DYN_OFDM_CCK_MODE_LSB 2 -#define BB_MODES_SELECT_DYN_OFDM_CCK_MODE_MASK 0x00000004 -#define BB_MODES_SELECT_DYN_OFDM_CCK_MODE_GET(x) (((x) & 0x00000004) >> 2) -#define BB_MODES_SELECT_DYN_OFDM_CCK_MODE_SET(x) (((x) << 2) & 0x00000004) -#define BB_MODES_SELECT_HALF_RATE_MODE_MSB 5 -#define BB_MODES_SELECT_HALF_RATE_MODE_LSB 5 -#define BB_MODES_SELECT_HALF_RATE_MODE_MASK 0x00000020 -#define BB_MODES_SELECT_HALF_RATE_MODE_GET(x) (((x) & 0x00000020) >> 5) -#define BB_MODES_SELECT_HALF_RATE_MODE_SET(x) (((x) << 5) & 0x00000020) -#define BB_MODES_SELECT_QUARTER_RATE_MODE_MSB 6 -#define BB_MODES_SELECT_QUARTER_RATE_MODE_LSB 6 -#define BB_MODES_SELECT_QUARTER_RATE_MODE_MASK 0x00000040 -#define BB_MODES_SELECT_QUARTER_RATE_MODE_GET(x) (((x) & 0x00000040) >> 6) -#define BB_MODES_SELECT_QUARTER_RATE_MODE_SET(x) (((x) << 6) & 0x00000040) -#define BB_MODES_SELECT_MAC_CLK_MODE_MSB 7 -#define BB_MODES_SELECT_MAC_CLK_MODE_LSB 7 -#define BB_MODES_SELECT_MAC_CLK_MODE_MASK 0x00000080 -#define BB_MODES_SELECT_MAC_CLK_MODE_GET(x) (((x) & 0x00000080) >> 7) -#define BB_MODES_SELECT_MAC_CLK_MODE_SET(x) (((x) << 7) & 0x00000080) -#define BB_MODES_SELECT_DISABLE_DYN_CCK_DET_MSB 8 -#define BB_MODES_SELECT_DISABLE_DYN_CCK_DET_LSB 8 -#define BB_MODES_SELECT_DISABLE_DYN_CCK_DET_MASK 0x00000100 -#define BB_MODES_SELECT_DISABLE_DYN_CCK_DET_GET(x) (((x) & 0x00000100) >> 8) -#define BB_MODES_SELECT_DISABLE_DYN_CCK_DET_SET(x) (((x) << 8) & 0x00000100) -#define BB_MODES_SELECT_SVD_HALF_RATE_MODE_MSB 9 -#define BB_MODES_SELECT_SVD_HALF_RATE_MODE_LSB 9 -#define BB_MODES_SELECT_SVD_HALF_RATE_MODE_MASK 0x00000200 -#define BB_MODES_SELECT_SVD_HALF_RATE_MODE_GET(x) (((x) & 0x00000200) >> 9) -#define BB_MODES_SELECT_SVD_HALF_RATE_MODE_SET(x) (((x) << 9) & 0x00000200) -#define BB_MODES_SELECT_DISABLE_DYN_FAST_ADC_MSB 10 -#define BB_MODES_SELECT_DISABLE_DYN_FAST_ADC_LSB 10 -#define BB_MODES_SELECT_DISABLE_DYN_FAST_ADC_MASK 0x00000400 -#define BB_MODES_SELECT_DISABLE_DYN_FAST_ADC_GET(x) (((x) & 0x00000400) >> 10) -#define BB_MODES_SELECT_DISABLE_DYN_FAST_ADC_SET(x) (((x) << 10) & 0x00000400) - -/* macros for bb_sm_reg_map.BB_active */ -#define BB_ACTIVE_ADDRESS 0x0000000c -#define BB_ACTIVE_OFFSET 0x0000000c -#define BB_ACTIVE_CF_ACTIVE_MSB 0 -#define BB_ACTIVE_CF_ACTIVE_LSB 0 -#define BB_ACTIVE_CF_ACTIVE_MASK 0x00000001 -#define BB_ACTIVE_CF_ACTIVE_GET(x) (((x) & 0x00000001) >> 0) -#define BB_ACTIVE_CF_ACTIVE_SET(x) (((x) << 0) & 0x00000001) - -/* macros for bb_sm_reg_map.BB_vit_spur_mask_A */ -#define BB_VIT_SPUR_MASK_A_ADDRESS 0x00000020 -#define BB_VIT_SPUR_MASK_A_OFFSET 0x00000020 -#define BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_A_MSB 9 -#define BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_A_LSB 0 -#define BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_A_MASK 0x000003ff -#define BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_A_GET(x) (((x) & 0x000003ff) >> 0) -#define BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_A_SET(x) (((x) << 0) & 0x000003ff) -#define BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_MSB 16 -#define BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_LSB 10 -#define BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_MASK 0x0001fc00 -#define BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_GET(x) (((x) & 0x0001fc00) >> 10) -#define BB_VIT_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_SET(x) (((x) << 10) & 0x0001fc00) - -/* macros for bb_sm_reg_map.BB_vit_spur_mask_B */ -#define BB_VIT_SPUR_MASK_B_ADDRESS 0x00000024 -#define BB_VIT_SPUR_MASK_B_OFFSET 0x00000024 -#define BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_B_MSB 9 -#define BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_B_LSB 0 -#define BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_B_MASK 0x000003ff -#define BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_B_GET(x) (((x) & 0x000003ff) >> 0) -#define BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_B_SET(x) (((x) << 0) & 0x000003ff) -#define BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_IDX_B_MSB 16 -#define BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_IDX_B_LSB 10 -#define BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_IDX_B_MASK 0x0001fc00 -#define BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_IDX_B_GET(x) (((x) & 0x0001fc00) >> 10) -#define BB_VIT_SPUR_MASK_B_CF_PUNC_MASK_IDX_B_SET(x) (((x) << 10) & 0x0001fc00) - -/* macros for bb_sm_reg_map.BB_spectral_scan */ -#define BB_SPECTRAL_SCAN_ADDRESS 0x00000028 -#define BB_SPECTRAL_SCAN_OFFSET 0x00000028 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ENA_MSB 0 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ENA_LSB 0 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ENA_MASK 0x00000001 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ENA_GET(x) (((x) & 0x00000001) >> 0) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ENA_SET(x) (((x) << 0) & 0x00000001) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ACTIVE_MSB 1 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ACTIVE_LSB 1 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ACTIVE_MASK 0x00000002 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ACTIVE_GET(x) (((x) & 0x00000002) >> 1) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_ACTIVE_SET(x) (((x) << 1) & 0x00000002) -#define BB_SPECTRAL_SCAN_DISABLE_RADAR_TCTL_RST_MSB 2 -#define BB_SPECTRAL_SCAN_DISABLE_RADAR_TCTL_RST_LSB 2 -#define BB_SPECTRAL_SCAN_DISABLE_RADAR_TCTL_RST_MASK 0x00000004 -#define BB_SPECTRAL_SCAN_DISABLE_RADAR_TCTL_RST_GET(x) (((x) & 0x00000004) >> 2) -#define BB_SPECTRAL_SCAN_DISABLE_RADAR_TCTL_RST_SET(x) (((x) << 2) & 0x00000004) -#define BB_SPECTRAL_SCAN_DISABLE_PULSE_COARSE_LOW_MSB 3 -#define BB_SPECTRAL_SCAN_DISABLE_PULSE_COARSE_LOW_LSB 3 -#define BB_SPECTRAL_SCAN_DISABLE_PULSE_COARSE_LOW_MASK 0x00000008 -#define BB_SPECTRAL_SCAN_DISABLE_PULSE_COARSE_LOW_GET(x) (((x) & 0x00000008) >> 3) -#define BB_SPECTRAL_SCAN_DISABLE_PULSE_COARSE_LOW_SET(x) (((x) << 3) & 0x00000008) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_FFT_PERIOD_MSB 7 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_FFT_PERIOD_LSB 4 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_FFT_PERIOD_MASK 0x000000f0 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_FFT_PERIOD_GET(x) (((x) & 0x000000f0) >> 4) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_FFT_PERIOD_SET(x) (((x) << 4) & 0x000000f0) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PERIOD_MSB 15 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PERIOD_LSB 8 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PERIOD_MASK 0x0000ff00 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PERIOD_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PERIOD_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COUNT_MSB 27 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COUNT_LSB 16 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COUNT_MASK 0x0fff0000 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COUNT_GET(x) (((x) & 0x0fff0000) >> 16) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COUNT_SET(x) (((x) << 16) & 0x0fff0000) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_SHORT_RPT_MSB 28 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_SHORT_RPT_LSB 28 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_SHORT_RPT_MASK 0x10000000 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_SHORT_RPT_GET(x) (((x) & 0x10000000) >> 28) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_SHORT_RPT_SET(x) (((x) << 28) & 0x10000000) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PRIORITY_MSB 29 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PRIORITY_LSB 29 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PRIORITY_MASK 0x20000000 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PRIORITY_GET(x) (((x) & 0x20000000) >> 29) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_PRIORITY_SET(x) (((x) << 29) & 0x20000000) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_USE_ERR5_MSB 30 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_USE_ERR5_LSB 30 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_USE_ERR5_MASK 0x40000000 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_USE_ERR5_GET(x) (((x) & 0x40000000) >> 30) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_USE_ERR5_SET(x) (((x) << 30) & 0x40000000) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COMPRESSED_RPT_MSB 31 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COMPRESSED_RPT_LSB 31 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COMPRESSED_RPT_MASK 0x80000000 -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COMPRESSED_RPT_GET(x) (((x) & 0x80000000) >> 31) -#define BB_SPECTRAL_SCAN_SPECTRAL_SCAN_COMPRESSED_RPT_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_sm_reg_map.BB_radar_bw_filter */ -#define BB_RADAR_BW_FILTER_ADDRESS 0x0000002c -#define BB_RADAR_BW_FILTER_OFFSET 0x0000002c -#define BB_RADAR_BW_FILTER_RADAR_AVG_BW_CHECK_MSB 0 -#define BB_RADAR_BW_FILTER_RADAR_AVG_BW_CHECK_LSB 0 -#define BB_RADAR_BW_FILTER_RADAR_AVG_BW_CHECK_MASK 0x00000001 -#define BB_RADAR_BW_FILTER_RADAR_AVG_BW_CHECK_GET(x) (((x) & 0x00000001) >> 0) -#define BB_RADAR_BW_FILTER_RADAR_AVG_BW_CHECK_SET(x) (((x) << 0) & 0x00000001) -#define BB_RADAR_BW_FILTER_RADAR_DC_SRC_SEL_MSB 1 -#define BB_RADAR_BW_FILTER_RADAR_DC_SRC_SEL_LSB 1 -#define BB_RADAR_BW_FILTER_RADAR_DC_SRC_SEL_MASK 0x00000002 -#define BB_RADAR_BW_FILTER_RADAR_DC_SRC_SEL_GET(x) (((x) & 0x00000002) >> 1) -#define BB_RADAR_BW_FILTER_RADAR_DC_SRC_SEL_SET(x) (((x) << 1) & 0x00000002) -#define BB_RADAR_BW_FILTER_RADAR_FIRPWR_SEL_MSB 3 -#define BB_RADAR_BW_FILTER_RADAR_FIRPWR_SEL_LSB 2 -#define BB_RADAR_BW_FILTER_RADAR_FIRPWR_SEL_MASK 0x0000000c -#define BB_RADAR_BW_FILTER_RADAR_FIRPWR_SEL_GET(x) (((x) & 0x0000000c) >> 2) -#define BB_RADAR_BW_FILTER_RADAR_FIRPWR_SEL_SET(x) (((x) << 2) & 0x0000000c) -#define BB_RADAR_BW_FILTER_RADAR_PULSE_WIDTH_SEL_MSB 5 -#define BB_RADAR_BW_FILTER_RADAR_PULSE_WIDTH_SEL_LSB 4 -#define BB_RADAR_BW_FILTER_RADAR_PULSE_WIDTH_SEL_MASK 0x00000030 -#define BB_RADAR_BW_FILTER_RADAR_PULSE_WIDTH_SEL_GET(x) (((x) & 0x00000030) >> 4) -#define BB_RADAR_BW_FILTER_RADAR_PULSE_WIDTH_SEL_SET(x) (((x) << 4) & 0x00000030) -#define BB_RADAR_BW_FILTER_RADAR_DC_FIRPWR_THRESH_MSB 14 -#define BB_RADAR_BW_FILTER_RADAR_DC_FIRPWR_THRESH_LSB 8 -#define BB_RADAR_BW_FILTER_RADAR_DC_FIRPWR_THRESH_MASK 0x00007f00 -#define BB_RADAR_BW_FILTER_RADAR_DC_FIRPWR_THRESH_GET(x) (((x) & 0x00007f00) >> 8) -#define BB_RADAR_BW_FILTER_RADAR_DC_FIRPWR_THRESH_SET(x) (((x) << 8) & 0x00007f00) -#define BB_RADAR_BW_FILTER_RADAR_DC_PWR_BIAS_MSB 20 -#define BB_RADAR_BW_FILTER_RADAR_DC_PWR_BIAS_LSB 15 -#define BB_RADAR_BW_FILTER_RADAR_DC_PWR_BIAS_MASK 0x001f8000 -#define BB_RADAR_BW_FILTER_RADAR_DC_PWR_BIAS_GET(x) (((x) & 0x001f8000) >> 15) -#define BB_RADAR_BW_FILTER_RADAR_DC_PWR_BIAS_SET(x) (((x) << 15) & 0x001f8000) -#define BB_RADAR_BW_FILTER_RADAR_BIN_MAX_BW_MSB 26 -#define BB_RADAR_BW_FILTER_RADAR_BIN_MAX_BW_LSB 21 -#define BB_RADAR_BW_FILTER_RADAR_BIN_MAX_BW_MASK 0x07e00000 -#define BB_RADAR_BW_FILTER_RADAR_BIN_MAX_BW_GET(x) (((x) & 0x07e00000) >> 21) -#define BB_RADAR_BW_FILTER_RADAR_BIN_MAX_BW_SET(x) (((x) << 21) & 0x07e00000) - -/* macros for bb_sm_reg_map.BB_search_start_delay */ -#define BB_SEARCH_START_DELAY_ADDRESS 0x00000030 -#define BB_SEARCH_START_DELAY_OFFSET 0x00000030 -#define BB_SEARCH_START_DELAY_SEARCH_START_DELAY_MSB 11 -#define BB_SEARCH_START_DELAY_SEARCH_START_DELAY_LSB 0 -#define BB_SEARCH_START_DELAY_SEARCH_START_DELAY_MASK 0x00000fff -#define BB_SEARCH_START_DELAY_SEARCH_START_DELAY_GET(x) (((x) & 0x00000fff) >> 0) -#define BB_SEARCH_START_DELAY_SEARCH_START_DELAY_SET(x) (((x) << 0) & 0x00000fff) -#define BB_SEARCH_START_DELAY_ENABLE_FLT_SVD_MSB 12 -#define BB_SEARCH_START_DELAY_ENABLE_FLT_SVD_LSB 12 -#define BB_SEARCH_START_DELAY_ENABLE_FLT_SVD_MASK 0x00001000 -#define BB_SEARCH_START_DELAY_ENABLE_FLT_SVD_GET(x) (((x) & 0x00001000) >> 12) -#define BB_SEARCH_START_DELAY_ENABLE_FLT_SVD_SET(x) (((x) << 12) & 0x00001000) -#define BB_SEARCH_START_DELAY_ENABLE_SEND_CHAN_MSB 13 -#define BB_SEARCH_START_DELAY_ENABLE_SEND_CHAN_LSB 13 -#define BB_SEARCH_START_DELAY_ENABLE_SEND_CHAN_MASK 0x00002000 -#define BB_SEARCH_START_DELAY_ENABLE_SEND_CHAN_GET(x) (((x) & 0x00002000) >> 13) -#define BB_SEARCH_START_DELAY_ENABLE_SEND_CHAN_SET(x) (((x) << 13) & 0x00002000) -#define BB_SEARCH_START_DELAY_RX_SOUNDING_ENABLE_MSB 14 -#define BB_SEARCH_START_DELAY_RX_SOUNDING_ENABLE_LSB 14 -#define BB_SEARCH_START_DELAY_RX_SOUNDING_ENABLE_MASK 0x00004000 -#define BB_SEARCH_START_DELAY_RX_SOUNDING_ENABLE_GET(x) (((x) & 0x00004000) >> 14) -#define BB_SEARCH_START_DELAY_RX_SOUNDING_ENABLE_SET(x) (((x) << 14) & 0x00004000) -#define BB_SEARCH_START_DELAY_RM_HCSD4SVD_MSB 15 -#define BB_SEARCH_START_DELAY_RM_HCSD4SVD_LSB 15 -#define BB_SEARCH_START_DELAY_RM_HCSD4SVD_MASK 0x00008000 -#define BB_SEARCH_START_DELAY_RM_HCSD4SVD_GET(x) (((x) & 0x00008000) >> 15) -#define BB_SEARCH_START_DELAY_RM_HCSD4SVD_SET(x) (((x) << 15) & 0x00008000) - -/* macros for bb_sm_reg_map.BB_max_rx_length */ -#define BB_MAX_RX_LENGTH_ADDRESS 0x00000034 -#define BB_MAX_RX_LENGTH_OFFSET 0x00000034 -#define BB_MAX_RX_LENGTH_MAX_RX_LENGTH_MSB 11 -#define BB_MAX_RX_LENGTH_MAX_RX_LENGTH_LSB 0 -#define BB_MAX_RX_LENGTH_MAX_RX_LENGTH_MASK 0x00000fff -#define BB_MAX_RX_LENGTH_MAX_RX_LENGTH_GET(x) (((x) & 0x00000fff) >> 0) -#define BB_MAX_RX_LENGTH_MAX_RX_LENGTH_SET(x) (((x) << 0) & 0x00000fff) -#define BB_MAX_RX_LENGTH_MAX_HT_LENGTH_MSB 29 -#define BB_MAX_RX_LENGTH_MAX_HT_LENGTH_LSB 12 -#define BB_MAX_RX_LENGTH_MAX_HT_LENGTH_MASK 0x3ffff000 -#define BB_MAX_RX_LENGTH_MAX_HT_LENGTH_GET(x) (((x) & 0x3ffff000) >> 12) -#define BB_MAX_RX_LENGTH_MAX_HT_LENGTH_SET(x) (((x) << 12) & 0x3ffff000) - -/* macros for bb_sm_reg_map.BB_frame_control */ -#define BB_FRAME_CONTROL_ADDRESS 0x00000038 -#define BB_FRAME_CONTROL_OFFSET 0x00000038 -#define BB_FRAME_CONTROL_CF_OVERLAP_WINDOW_MSB 1 -#define BB_FRAME_CONTROL_CF_OVERLAP_WINDOW_LSB 0 -#define BB_FRAME_CONTROL_CF_OVERLAP_WINDOW_MASK 0x00000003 -#define BB_FRAME_CONTROL_CF_OVERLAP_WINDOW_GET(x) (((x) & 0x00000003) >> 0) -#define BB_FRAME_CONTROL_CF_OVERLAP_WINDOW_SET(x) (((x) << 0) & 0x00000003) -#define BB_FRAME_CONTROL_CF_SCALE_SHORT_MSB 2 -#define BB_FRAME_CONTROL_CF_SCALE_SHORT_LSB 2 -#define BB_FRAME_CONTROL_CF_SCALE_SHORT_MASK 0x00000004 -#define BB_FRAME_CONTROL_CF_SCALE_SHORT_GET(x) (((x) & 0x00000004) >> 2) -#define BB_FRAME_CONTROL_CF_SCALE_SHORT_SET(x) (((x) << 2) & 0x00000004) -#define BB_FRAME_CONTROL_CF_TX_CLIP_MSB 5 -#define BB_FRAME_CONTROL_CF_TX_CLIP_LSB 3 -#define BB_FRAME_CONTROL_CF_TX_CLIP_MASK 0x00000038 -#define BB_FRAME_CONTROL_CF_TX_CLIP_GET(x) (((x) & 0x00000038) >> 3) -#define BB_FRAME_CONTROL_CF_TX_CLIP_SET(x) (((x) << 3) & 0x00000038) -#define BB_FRAME_CONTROL_CF_TX_DOUBLESAMP_DAC_MSB 7 -#define BB_FRAME_CONTROL_CF_TX_DOUBLESAMP_DAC_LSB 6 -#define BB_FRAME_CONTROL_CF_TX_DOUBLESAMP_DAC_MASK 0x000000c0 -#define BB_FRAME_CONTROL_CF_TX_DOUBLESAMP_DAC_GET(x) (((x) & 0x000000c0) >> 6) -#define BB_FRAME_CONTROL_CF_TX_DOUBLESAMP_DAC_SET(x) (((x) << 6) & 0x000000c0) -#define BB_FRAME_CONTROL_TX_END_ADJUST_MSB 15 -#define BB_FRAME_CONTROL_TX_END_ADJUST_LSB 8 -#define BB_FRAME_CONTROL_TX_END_ADJUST_MASK 0x0000ff00 -#define BB_FRAME_CONTROL_TX_END_ADJUST_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_FRAME_CONTROL_TX_END_ADJUST_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_FRAME_CONTROL_PREPEND_CHAN_INFO_MSB 16 -#define BB_FRAME_CONTROL_PREPEND_CHAN_INFO_LSB 16 -#define BB_FRAME_CONTROL_PREPEND_CHAN_INFO_MASK 0x00010000 -#define BB_FRAME_CONTROL_PREPEND_CHAN_INFO_GET(x) (((x) & 0x00010000) >> 16) -#define BB_FRAME_CONTROL_PREPEND_CHAN_INFO_SET(x) (((x) << 16) & 0x00010000) -#define BB_FRAME_CONTROL_SHORT_HIGH_PAR_NORM_MSB 17 -#define BB_FRAME_CONTROL_SHORT_HIGH_PAR_NORM_LSB 17 -#define BB_FRAME_CONTROL_SHORT_HIGH_PAR_NORM_MASK 0x00020000 -#define BB_FRAME_CONTROL_SHORT_HIGH_PAR_NORM_GET(x) (((x) & 0x00020000) >> 17) -#define BB_FRAME_CONTROL_SHORT_HIGH_PAR_NORM_SET(x) (((x) << 17) & 0x00020000) -#define BB_FRAME_CONTROL_EN_ERR_GREEN_FIELD_MSB 18 -#define BB_FRAME_CONTROL_EN_ERR_GREEN_FIELD_LSB 18 -#define BB_FRAME_CONTROL_EN_ERR_GREEN_FIELD_MASK 0x00040000 -#define BB_FRAME_CONTROL_EN_ERR_GREEN_FIELD_GET(x) (((x) & 0x00040000) >> 18) -#define BB_FRAME_CONTROL_EN_ERR_GREEN_FIELD_SET(x) (((x) << 18) & 0x00040000) -#define BB_FRAME_CONTROL_EN_ERR_STATIC20_MODE_HT40_PACKET_MSB 19 -#define BB_FRAME_CONTROL_EN_ERR_STATIC20_MODE_HT40_PACKET_LSB 19 -#define BB_FRAME_CONTROL_EN_ERR_STATIC20_MODE_HT40_PACKET_MASK 0x00080000 -#define BB_FRAME_CONTROL_EN_ERR_STATIC20_MODE_HT40_PACKET_GET(x) (((x) & 0x00080000) >> 19) -#define BB_FRAME_CONTROL_EN_ERR_STATIC20_MODE_HT40_PACKET_SET(x) (((x) << 19) & 0x00080000) -#define BB_FRAME_CONTROL_EN_ERR_OFDM_XCORR_MSB 20 -#define BB_FRAME_CONTROL_EN_ERR_OFDM_XCORR_LSB 20 -#define BB_FRAME_CONTROL_EN_ERR_OFDM_XCORR_MASK 0x00100000 -#define BB_FRAME_CONTROL_EN_ERR_OFDM_XCORR_GET(x) (((x) & 0x00100000) >> 20) -#define BB_FRAME_CONTROL_EN_ERR_OFDM_XCORR_SET(x) (((x) << 20) & 0x00100000) -#define BB_FRAME_CONTROL_EN_ERR_LONG_SC_THR_MSB 21 -#define BB_FRAME_CONTROL_EN_ERR_LONG_SC_THR_LSB 21 -#define BB_FRAME_CONTROL_EN_ERR_LONG_SC_THR_MASK 0x00200000 -#define BB_FRAME_CONTROL_EN_ERR_LONG_SC_THR_GET(x) (((x) & 0x00200000) >> 21) -#define BB_FRAME_CONTROL_EN_ERR_LONG_SC_THR_SET(x) (((x) << 21) & 0x00200000) -#define BB_FRAME_CONTROL_EN_ERR_TIM_LONG1_MSB 22 -#define BB_FRAME_CONTROL_EN_ERR_TIM_LONG1_LSB 22 -#define BB_FRAME_CONTROL_EN_ERR_TIM_LONG1_MASK 0x00400000 -#define BB_FRAME_CONTROL_EN_ERR_TIM_LONG1_GET(x) (((x) & 0x00400000) >> 22) -#define BB_FRAME_CONTROL_EN_ERR_TIM_LONG1_SET(x) (((x) << 22) & 0x00400000) -#define BB_FRAME_CONTROL_EN_ERR_TIM_EARLY_TRIG_MSB 23 -#define BB_FRAME_CONTROL_EN_ERR_TIM_EARLY_TRIG_LSB 23 -#define BB_FRAME_CONTROL_EN_ERR_TIM_EARLY_TRIG_MASK 0x00800000 -#define BB_FRAME_CONTROL_EN_ERR_TIM_EARLY_TRIG_GET(x) (((x) & 0x00800000) >> 23) -#define BB_FRAME_CONTROL_EN_ERR_TIM_EARLY_TRIG_SET(x) (((x) << 23) & 0x00800000) -#define BB_FRAME_CONTROL_EN_ERR_TIM_TIMEOUT_MSB 24 -#define BB_FRAME_CONTROL_EN_ERR_TIM_TIMEOUT_LSB 24 -#define BB_FRAME_CONTROL_EN_ERR_TIM_TIMEOUT_MASK 0x01000000 -#define BB_FRAME_CONTROL_EN_ERR_TIM_TIMEOUT_GET(x) (((x) & 0x01000000) >> 24) -#define BB_FRAME_CONTROL_EN_ERR_TIM_TIMEOUT_SET(x) (((x) << 24) & 0x01000000) -#define BB_FRAME_CONTROL_EN_ERR_SIGNAL_PARITY_MSB 25 -#define BB_FRAME_CONTROL_EN_ERR_SIGNAL_PARITY_LSB 25 -#define BB_FRAME_CONTROL_EN_ERR_SIGNAL_PARITY_MASK 0x02000000 -#define BB_FRAME_CONTROL_EN_ERR_SIGNAL_PARITY_GET(x) (((x) & 0x02000000) >> 25) -#define BB_FRAME_CONTROL_EN_ERR_SIGNAL_PARITY_SET(x) (((x) << 25) & 0x02000000) -#define BB_FRAME_CONTROL_EN_ERR_RATE_ILLEGAL_MSB 26 -#define BB_FRAME_CONTROL_EN_ERR_RATE_ILLEGAL_LSB 26 -#define BB_FRAME_CONTROL_EN_ERR_RATE_ILLEGAL_MASK 0x04000000 -#define BB_FRAME_CONTROL_EN_ERR_RATE_ILLEGAL_GET(x) (((x) & 0x04000000) >> 26) -#define BB_FRAME_CONTROL_EN_ERR_RATE_ILLEGAL_SET(x) (((x) << 26) & 0x04000000) -#define BB_FRAME_CONTROL_EN_ERR_LENGTH_ILLEGAL_MSB 27 -#define BB_FRAME_CONTROL_EN_ERR_LENGTH_ILLEGAL_LSB 27 -#define BB_FRAME_CONTROL_EN_ERR_LENGTH_ILLEGAL_MASK 0x08000000 -#define BB_FRAME_CONTROL_EN_ERR_LENGTH_ILLEGAL_GET(x) (((x) & 0x08000000) >> 27) -#define BB_FRAME_CONTROL_EN_ERR_LENGTH_ILLEGAL_SET(x) (((x) << 27) & 0x08000000) -#define BB_FRAME_CONTROL_NO_6MBPS_SERVICE_ERR_MSB 28 -#define BB_FRAME_CONTROL_NO_6MBPS_SERVICE_ERR_LSB 28 -#define BB_FRAME_CONTROL_NO_6MBPS_SERVICE_ERR_MASK 0x10000000 -#define BB_FRAME_CONTROL_NO_6MBPS_SERVICE_ERR_GET(x) (((x) & 0x10000000) >> 28) -#define BB_FRAME_CONTROL_NO_6MBPS_SERVICE_ERR_SET(x) (((x) << 28) & 0x10000000) -#define BB_FRAME_CONTROL_EN_ERR_SERVICE_MSB 29 -#define BB_FRAME_CONTROL_EN_ERR_SERVICE_LSB 29 -#define BB_FRAME_CONTROL_EN_ERR_SERVICE_MASK 0x20000000 -#define BB_FRAME_CONTROL_EN_ERR_SERVICE_GET(x) (((x) & 0x20000000) >> 29) -#define BB_FRAME_CONTROL_EN_ERR_SERVICE_SET(x) (((x) << 29) & 0x20000000) -#define BB_FRAME_CONTROL_EN_ERR_TX_UNDERRUN_MSB 30 -#define BB_FRAME_CONTROL_EN_ERR_TX_UNDERRUN_LSB 30 -#define BB_FRAME_CONTROL_EN_ERR_TX_UNDERRUN_MASK 0x40000000 -#define BB_FRAME_CONTROL_EN_ERR_TX_UNDERRUN_GET(x) (((x) & 0x40000000) >> 30) -#define BB_FRAME_CONTROL_EN_ERR_TX_UNDERRUN_SET(x) (((x) << 30) & 0x40000000) -#define BB_FRAME_CONTROL_EN_ERR_RX_ABORT_MSB 31 -#define BB_FRAME_CONTROL_EN_ERR_RX_ABORT_LSB 31 -#define BB_FRAME_CONTROL_EN_ERR_RX_ABORT_MASK 0x80000000 -#define BB_FRAME_CONTROL_EN_ERR_RX_ABORT_GET(x) (((x) & 0x80000000) >> 31) -#define BB_FRAME_CONTROL_EN_ERR_RX_ABORT_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_sm_reg_map.BB_rfbus_request */ -#define BB_RFBUS_REQUEST_ADDRESS 0x0000003c -#define BB_RFBUS_REQUEST_OFFSET 0x0000003c -#define BB_RFBUS_REQUEST_RFBUS_REQUEST_MSB 0 -#define BB_RFBUS_REQUEST_RFBUS_REQUEST_LSB 0 -#define BB_RFBUS_REQUEST_RFBUS_REQUEST_MASK 0x00000001 -#define BB_RFBUS_REQUEST_RFBUS_REQUEST_GET(x) (((x) & 0x00000001) >> 0) -#define BB_RFBUS_REQUEST_RFBUS_REQUEST_SET(x) (((x) << 0) & 0x00000001) - -/* macros for bb_sm_reg_map.BB_rfbus_grant */ -#define BB_RFBUS_GRANT_ADDRESS 0x00000040 -#define BB_RFBUS_GRANT_OFFSET 0x00000040 -#define BB_RFBUS_GRANT_RFBUS_GRANT_MSB 0 -#define BB_RFBUS_GRANT_RFBUS_GRANT_LSB 0 -#define BB_RFBUS_GRANT_RFBUS_GRANT_MASK 0x00000001 -#define BB_RFBUS_GRANT_RFBUS_GRANT_GET(x) (((x) & 0x00000001) >> 0) -#define BB_RFBUS_GRANT_BT_ANT_MSB 1 -#define BB_RFBUS_GRANT_BT_ANT_LSB 1 -#define BB_RFBUS_GRANT_BT_ANT_MASK 0x00000002 -#define BB_RFBUS_GRANT_BT_ANT_GET(x) (((x) & 0x00000002) >> 1) - -/* macros for bb_sm_reg_map.BB_rifs */ -#define BB_RIFS_ADDRESS 0x00000044 -#define BB_RIFS_OFFSET 0x00000044 -#define BB_RIFS_DISABLE_FCC_FIX_MSB 25 -#define BB_RIFS_DISABLE_FCC_FIX_LSB 25 -#define BB_RIFS_DISABLE_FCC_FIX_MASK 0x02000000 -#define BB_RIFS_DISABLE_FCC_FIX_GET(x) (((x) & 0x02000000) >> 25) -#define BB_RIFS_DISABLE_FCC_FIX_SET(x) (((x) << 25) & 0x02000000) -#define BB_RIFS_ENABLE_RESET_TDOMAIN_MSB 26 -#define BB_RIFS_ENABLE_RESET_TDOMAIN_LSB 26 -#define BB_RIFS_ENABLE_RESET_TDOMAIN_MASK 0x04000000 -#define BB_RIFS_ENABLE_RESET_TDOMAIN_GET(x) (((x) & 0x04000000) >> 26) -#define BB_RIFS_ENABLE_RESET_TDOMAIN_SET(x) (((x) << 26) & 0x04000000) -#define BB_RIFS_DISABLE_FCC_FIX2_MSB 27 -#define BB_RIFS_DISABLE_FCC_FIX2_LSB 27 -#define BB_RIFS_DISABLE_FCC_FIX2_MASK 0x08000000 -#define BB_RIFS_DISABLE_FCC_FIX2_GET(x) (((x) & 0x08000000) >> 27) -#define BB_RIFS_DISABLE_FCC_FIX2_SET(x) (((x) << 27) & 0x08000000) -#define BB_RIFS_DISABLE_RIFS_CCK_FIX_MSB 28 -#define BB_RIFS_DISABLE_RIFS_CCK_FIX_LSB 28 -#define BB_RIFS_DISABLE_RIFS_CCK_FIX_MASK 0x10000000 -#define BB_RIFS_DISABLE_RIFS_CCK_FIX_GET(x) (((x) & 0x10000000) >> 28) -#define BB_RIFS_DISABLE_RIFS_CCK_FIX_SET(x) (((x) << 28) & 0x10000000) -#define BB_RIFS_DISABLE_ERROR_RESET_FIX_MSB 29 -#define BB_RIFS_DISABLE_ERROR_RESET_FIX_LSB 29 -#define BB_RIFS_DISABLE_ERROR_RESET_FIX_MASK 0x20000000 -#define BB_RIFS_DISABLE_ERROR_RESET_FIX_GET(x) (((x) & 0x20000000) >> 29) -#define BB_RIFS_DISABLE_ERROR_RESET_FIX_SET(x) (((x) << 29) & 0x20000000) -#define BB_RIFS_RADAR_USE_FDOMAIN_RESET_MSB 30 -#define BB_RIFS_RADAR_USE_FDOMAIN_RESET_LSB 30 -#define BB_RIFS_RADAR_USE_FDOMAIN_RESET_MASK 0x40000000 -#define BB_RIFS_RADAR_USE_FDOMAIN_RESET_GET(x) (((x) & 0x40000000) >> 30) -#define BB_RIFS_RADAR_USE_FDOMAIN_RESET_SET(x) (((x) << 30) & 0x40000000) - -/* macros for bb_sm_reg_map.BB_spectral_scan_2 */ -#define BB_SPECTRAL_SCAN_2_ADDRESS 0x00000048 -#define BB_SPECTRAL_SCAN_2_OFFSET 0x00000048 -#define BB_SPECTRAL_SCAN_2_SPECTRAL_SCAN_RPT_MODE_MSB 0 -#define BB_SPECTRAL_SCAN_2_SPECTRAL_SCAN_RPT_MODE_LSB 0 -#define BB_SPECTRAL_SCAN_2_SPECTRAL_SCAN_RPT_MODE_MASK 0x00000001 -#define BB_SPECTRAL_SCAN_2_SPECTRAL_SCAN_RPT_MODE_GET(x) (((x) & 0x00000001) >> 0) -#define BB_SPECTRAL_SCAN_2_SPECTRAL_SCAN_RPT_MODE_SET(x) (((x) << 0) & 0x00000001) -#define BB_SPECTRAL_SCAN_2_SPECTRAL_SCAN_NOISE_FLOOR_REF_MSB 8 -#define BB_SPECTRAL_SCAN_2_SPECTRAL_SCAN_NOISE_FLOOR_REF_LSB 1 -#define BB_SPECTRAL_SCAN_2_SPECTRAL_SCAN_NOISE_FLOOR_REF_MASK 0x000001fe -#define BB_SPECTRAL_SCAN_2_SPECTRAL_SCAN_NOISE_FLOOR_REF_GET(x) (((x) & 0x000001fe) >> 1) -#define BB_SPECTRAL_SCAN_2_SPECTRAL_SCAN_NOISE_FLOOR_REF_SET(x) (((x) << 1) & 0x000001fe) - -/* macros for bb_sm_reg_map.BB_rx_clear_delay */ -#define BB_RX_CLEAR_DELAY_ADDRESS 0x00000050 -#define BB_RX_CLEAR_DELAY_OFFSET 0x00000050 -#define BB_RX_CLEAR_DELAY_OFDM_XR_RX_CLEAR_DELAY_MSB 9 -#define BB_RX_CLEAR_DELAY_OFDM_XR_RX_CLEAR_DELAY_LSB 0 -#define BB_RX_CLEAR_DELAY_OFDM_XR_RX_CLEAR_DELAY_MASK 0x000003ff -#define BB_RX_CLEAR_DELAY_OFDM_XR_RX_CLEAR_DELAY_GET(x) (((x) & 0x000003ff) >> 0) -#define BB_RX_CLEAR_DELAY_OFDM_XR_RX_CLEAR_DELAY_SET(x) (((x) << 0) & 0x000003ff) - -/* macros for bb_sm_reg_map.BB_analog_power_on_time */ -#define BB_ANALOG_POWER_ON_TIME_ADDRESS 0x00000054 -#define BB_ANALOG_POWER_ON_TIME_OFFSET 0x00000054 -#define BB_ANALOG_POWER_ON_TIME_ACTIVE_TO_RECEIVE_MSB 13 -#define BB_ANALOG_POWER_ON_TIME_ACTIVE_TO_RECEIVE_LSB 0 -#define BB_ANALOG_POWER_ON_TIME_ACTIVE_TO_RECEIVE_MASK 0x00003fff -#define BB_ANALOG_POWER_ON_TIME_ACTIVE_TO_RECEIVE_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_ANALOG_POWER_ON_TIME_ACTIVE_TO_RECEIVE_SET(x) (((x) << 0) & 0x00003fff) - -/* macros for bb_sm_reg_map.BB_tx_timing_1 */ -#define BB_TX_TIMING_1_ADDRESS 0x00000058 -#define BB_TX_TIMING_1_OFFSET 0x00000058 -#define BB_TX_TIMING_1_TX_FRAME_TO_ADC_OFF_MSB 7 -#define BB_TX_TIMING_1_TX_FRAME_TO_ADC_OFF_LSB 0 -#define BB_TX_TIMING_1_TX_FRAME_TO_ADC_OFF_MASK 0x000000ff -#define BB_TX_TIMING_1_TX_FRAME_TO_ADC_OFF_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_TX_TIMING_1_TX_FRAME_TO_ADC_OFF_SET(x) (((x) << 0) & 0x000000ff) -#define BB_TX_TIMING_1_TX_FRAME_TO_A2_RX_OFF_MSB 15 -#define BB_TX_TIMING_1_TX_FRAME_TO_A2_RX_OFF_LSB 8 -#define BB_TX_TIMING_1_TX_FRAME_TO_A2_RX_OFF_MASK 0x0000ff00 -#define BB_TX_TIMING_1_TX_FRAME_TO_A2_RX_OFF_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_TX_TIMING_1_TX_FRAME_TO_A2_RX_OFF_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_TX_TIMING_1_TX_FRAME_TO_DAC_ON_MSB 23 -#define BB_TX_TIMING_1_TX_FRAME_TO_DAC_ON_LSB 16 -#define BB_TX_TIMING_1_TX_FRAME_TO_DAC_ON_MASK 0x00ff0000 -#define BB_TX_TIMING_1_TX_FRAME_TO_DAC_ON_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_TX_TIMING_1_TX_FRAME_TO_DAC_ON_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_TX_TIMING_1_TX_FRAME_TO_A2_TX_ON_MSB 31 -#define BB_TX_TIMING_1_TX_FRAME_TO_A2_TX_ON_LSB 24 -#define BB_TX_TIMING_1_TX_FRAME_TO_A2_TX_ON_MASK 0xff000000 -#define BB_TX_TIMING_1_TX_FRAME_TO_A2_TX_ON_GET(x) (((x) & 0xff000000) >> 24) -#define BB_TX_TIMING_1_TX_FRAME_TO_A2_TX_ON_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_sm_reg_map.BB_tx_timing_2 */ -#define BB_TX_TIMING_2_ADDRESS 0x0000005c -#define BB_TX_TIMING_2_OFFSET 0x0000005c -#define BB_TX_TIMING_2_TX_FRAME_TO_TX_D_START_MSB 7 -#define BB_TX_TIMING_2_TX_FRAME_TO_TX_D_START_LSB 0 -#define BB_TX_TIMING_2_TX_FRAME_TO_TX_D_START_MASK 0x000000ff -#define BB_TX_TIMING_2_TX_FRAME_TO_TX_D_START_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_TX_TIMING_2_TX_FRAME_TO_TX_D_START_SET(x) (((x) << 0) & 0x000000ff) -#define BB_TX_TIMING_2_TX_FRAME_TO_PA_ON_MSB 15 -#define BB_TX_TIMING_2_TX_FRAME_TO_PA_ON_LSB 8 -#define BB_TX_TIMING_2_TX_FRAME_TO_PA_ON_MASK 0x0000ff00 -#define BB_TX_TIMING_2_TX_FRAME_TO_PA_ON_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_TX_TIMING_2_TX_FRAME_TO_PA_ON_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_TX_TIMING_2_TX_END_TO_PA_OFF_MSB 23 -#define BB_TX_TIMING_2_TX_END_TO_PA_OFF_LSB 16 -#define BB_TX_TIMING_2_TX_END_TO_PA_OFF_MASK 0x00ff0000 -#define BB_TX_TIMING_2_TX_END_TO_PA_OFF_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_TX_TIMING_2_TX_END_TO_PA_OFF_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_TX_TIMING_2_TX_END_TO_A2_TX_OFF_MSB 31 -#define BB_TX_TIMING_2_TX_END_TO_A2_TX_OFF_LSB 24 -#define BB_TX_TIMING_2_TX_END_TO_A2_TX_OFF_MASK 0xff000000 -#define BB_TX_TIMING_2_TX_END_TO_A2_TX_OFF_GET(x) (((x) & 0xff000000) >> 24) -#define BB_TX_TIMING_2_TX_END_TO_A2_TX_OFF_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_sm_reg_map.BB_tx_timing_3 */ -#define BB_TX_TIMING_3_ADDRESS 0x00000060 -#define BB_TX_TIMING_3_OFFSET 0x00000060 -#define BB_TX_TIMING_3_TX_END_TO_DAC_OFF_MSB 7 -#define BB_TX_TIMING_3_TX_END_TO_DAC_OFF_LSB 0 -#define BB_TX_TIMING_3_TX_END_TO_DAC_OFF_MASK 0x000000ff -#define BB_TX_TIMING_3_TX_END_TO_DAC_OFF_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_TX_TIMING_3_TX_END_TO_DAC_OFF_SET(x) (((x) << 0) & 0x000000ff) -#define BB_TX_TIMING_3_TX_FRAME_TO_THERM_CHAIN_ON_MSB 15 -#define BB_TX_TIMING_3_TX_FRAME_TO_THERM_CHAIN_ON_LSB 8 -#define BB_TX_TIMING_3_TX_FRAME_TO_THERM_CHAIN_ON_MASK 0x0000ff00 -#define BB_TX_TIMING_3_TX_FRAME_TO_THERM_CHAIN_ON_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_TX_TIMING_3_TX_FRAME_TO_THERM_CHAIN_ON_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_TX_TIMING_3_TX_END_TO_A2_RX_ON_MSB 23 -#define BB_TX_TIMING_3_TX_END_TO_A2_RX_ON_LSB 16 -#define BB_TX_TIMING_3_TX_END_TO_A2_RX_ON_MASK 0x00ff0000 -#define BB_TX_TIMING_3_TX_END_TO_A2_RX_ON_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_TX_TIMING_3_TX_END_TO_A2_RX_ON_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_TX_TIMING_3_TX_END_TO_ADC_ON_MSB 31 -#define BB_TX_TIMING_3_TX_END_TO_ADC_ON_LSB 24 -#define BB_TX_TIMING_3_TX_END_TO_ADC_ON_MASK 0xff000000 -#define BB_TX_TIMING_3_TX_END_TO_ADC_ON_GET(x) (((x) & 0xff000000) >> 24) -#define BB_TX_TIMING_3_TX_END_TO_ADC_ON_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_sm_reg_map.BB_xpa_timing_control */ -#define BB_XPA_TIMING_CONTROL_ADDRESS 0x00000064 -#define BB_XPA_TIMING_CONTROL_OFFSET 0x00000064 -#define BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAA_ON_MSB 7 -#define BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAA_ON_LSB 0 -#define BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAA_ON_MASK 0x000000ff -#define BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAA_ON_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAA_ON_SET(x) (((x) << 0) & 0x000000ff) -#define BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAB_ON_MSB 15 -#define BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAB_ON_LSB 8 -#define BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAB_ON_MASK 0x0000ff00 -#define BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAB_ON_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_XPA_TIMING_CONTROL_TX_FRAME_TO_XPAB_ON_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_XPA_TIMING_CONTROL_TX_END_TO_XPAA_OFF_MSB 23 -#define BB_XPA_TIMING_CONTROL_TX_END_TO_XPAA_OFF_LSB 16 -#define BB_XPA_TIMING_CONTROL_TX_END_TO_XPAA_OFF_MASK 0x00ff0000 -#define BB_XPA_TIMING_CONTROL_TX_END_TO_XPAA_OFF_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_XPA_TIMING_CONTROL_TX_END_TO_XPAA_OFF_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_XPA_TIMING_CONTROL_TX_END_TO_XPAB_OFF_MSB 31 -#define BB_XPA_TIMING_CONTROL_TX_END_TO_XPAB_OFF_LSB 24 -#define BB_XPA_TIMING_CONTROL_TX_END_TO_XPAB_OFF_MASK 0xff000000 -#define BB_XPA_TIMING_CONTROL_TX_END_TO_XPAB_OFF_GET(x) (((x) & 0xff000000) >> 24) -#define BB_XPA_TIMING_CONTROL_TX_END_TO_XPAB_OFF_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_sm_reg_map.BB_misc_pa_control */ -#define BB_MISC_PA_CONTROL_ADDRESS 0x00000080 -#define BB_MISC_PA_CONTROL_OFFSET 0x00000080 -#define BB_MISC_PA_CONTROL_XPAA_ACTIVE_HIGH_MSB 0 -#define BB_MISC_PA_CONTROL_XPAA_ACTIVE_HIGH_LSB 0 -#define BB_MISC_PA_CONTROL_XPAA_ACTIVE_HIGH_MASK 0x00000001 -#define BB_MISC_PA_CONTROL_XPAA_ACTIVE_HIGH_GET(x) (((x) & 0x00000001) >> 0) -#define BB_MISC_PA_CONTROL_XPAA_ACTIVE_HIGH_SET(x) (((x) << 0) & 0x00000001) -#define BB_MISC_PA_CONTROL_XPAB_ACTIVE_HIGH_MSB 1 -#define BB_MISC_PA_CONTROL_XPAB_ACTIVE_HIGH_LSB 1 -#define BB_MISC_PA_CONTROL_XPAB_ACTIVE_HIGH_MASK 0x00000002 -#define BB_MISC_PA_CONTROL_XPAB_ACTIVE_HIGH_GET(x) (((x) & 0x00000002) >> 1) -#define BB_MISC_PA_CONTROL_XPAB_ACTIVE_HIGH_SET(x) (((x) << 1) & 0x00000002) -#define BB_MISC_PA_CONTROL_ENABLE_XPAA_MSB 2 -#define BB_MISC_PA_CONTROL_ENABLE_XPAA_LSB 2 -#define BB_MISC_PA_CONTROL_ENABLE_XPAA_MASK 0x00000004 -#define BB_MISC_PA_CONTROL_ENABLE_XPAA_GET(x) (((x) & 0x00000004) >> 2) -#define BB_MISC_PA_CONTROL_ENABLE_XPAA_SET(x) (((x) << 2) & 0x00000004) -#define BB_MISC_PA_CONTROL_ENABLE_XPAB_MSB 3 -#define BB_MISC_PA_CONTROL_ENABLE_XPAB_LSB 3 -#define BB_MISC_PA_CONTROL_ENABLE_XPAB_MASK 0x00000008 -#define BB_MISC_PA_CONTROL_ENABLE_XPAB_GET(x) (((x) & 0x00000008) >> 3) -#define BB_MISC_PA_CONTROL_ENABLE_XPAB_SET(x) (((x) << 3) & 0x00000008) - -/* macros for bb_sm_reg_map.BB_switch_table_chn_b0 */ -#define BB_SWITCH_TABLE_CHN_B0_ADDRESS 0x00000084 -#define BB_SWITCH_TABLE_CHN_B0_OFFSET 0x00000084 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_IDLE_0_MSB 1 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_IDLE_0_LSB 0 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_IDLE_0_MASK 0x00000003 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_IDLE_0_GET(x) (((x) & 0x00000003) >> 0) -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_IDLE_0_SET(x) (((x) << 0) & 0x00000003) -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_T_0_MSB 3 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_T_0_LSB 2 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_T_0_MASK 0x0000000c -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_T_0_GET(x) (((x) & 0x0000000c) >> 2) -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_T_0_SET(x) (((x) << 2) & 0x0000000c) -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_R_0_MSB 5 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_R_0_LSB 4 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_R_0_MASK 0x00000030 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_R_0_GET(x) (((x) & 0x00000030) >> 4) -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_R_0_SET(x) (((x) << 4) & 0x00000030) -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX1_0_MSB 7 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX1_0_LSB 6 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX1_0_MASK 0x000000c0 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX1_0_GET(x) (((x) & 0x000000c0) >> 6) -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX1_0_SET(x) (((x) << 6) & 0x000000c0) -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX12_0_MSB 9 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX12_0_LSB 8 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX12_0_MASK 0x00000300 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX12_0_GET(x) (((x) & 0x00000300) >> 8) -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_RX12_0_SET(x) (((x) << 8) & 0x00000300) -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_B_0_MSB 11 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_B_0_LSB 10 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_B_0_MASK 0x00000c00 -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_B_0_GET(x) (((x) & 0x00000c00) >> 10) -#define BB_SWITCH_TABLE_CHN_B0_SWITCH_TABLE_B_0_SET(x) (((x) << 10) & 0x00000c00) - -/* macros for bb_sm_reg_map.BB_switch_table_com1 */ -#define BB_SWITCH_TABLE_COM1_ADDRESS 0x00000088 -#define BB_SWITCH_TABLE_COM1_OFFSET 0x00000088 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_MSB 3 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_LSB 0 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_MASK 0x0000000f -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_GET(x) (((x) & 0x0000000f) >> 0) -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_SET(x) (((x) << 0) & 0x0000000f) -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T1_MSB 7 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T1_LSB 4 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T1_MASK 0x000000f0 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T1_GET(x) (((x) & 0x000000f0) >> 4) -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T1_SET(x) (((x) << 4) & 0x000000f0) -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T2_MSB 11 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T2_LSB 8 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T2_MASK 0x00000f00 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T2_GET(x) (((x) & 0x00000f00) >> 8) -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_T2_SET(x) (((x) << 8) & 0x00000f00) -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_B_MSB 15 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_B_LSB 12 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_B_MASK 0x0000f000 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_B_GET(x) (((x) & 0x0000f000) >> 12) -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_B_SET(x) (((x) << 12) & 0x0000f000) -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_ALT_MSB 19 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_ALT_LSB 16 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_ALT_MASK 0x000f0000 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_ALT_GET(x) (((x) & 0x000f0000) >> 16) -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_IDLE_ALT_SET(x) (((x) << 16) & 0x000f0000) -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_SPDT_MSB 23 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_SPDT_LSB 20 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_SPDT_MASK 0x00f00000 -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_SPDT_GET(x) (((x) & 0x00f00000) >> 20) -#define BB_SWITCH_TABLE_COM1_SWITCH_TABLE_COM_SPDT_SET(x) (((x) << 20) & 0x00f00000) - -/* macros for bb_sm_reg_map.BB_switch_table_com2 */ -#define BB_SWITCH_TABLE_COM2_ADDRESS 0x0000008c -#define BB_SWITCH_TABLE_COM2_OFFSET 0x0000008c -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1L1_MSB 3 -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1L1_LSB 0 -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1L1_MASK 0x0000000f -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1L1_GET(x) (((x) & 0x0000000f) >> 0) -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1L1_SET(x) (((x) << 0) & 0x0000000f) -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2L1_MSB 7 -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2L1_LSB 4 -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2L1_MASK 0x000000f0 -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2L1_GET(x) (((x) & 0x000000f0) >> 4) -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2L1_SET(x) (((x) << 4) & 0x000000f0) -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1L2_MSB 11 -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1L2_LSB 8 -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1L2_MASK 0x00000f00 -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1L2_GET(x) (((x) & 0x00000f00) >> 8) -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA1L2_SET(x) (((x) << 8) & 0x00000f00) -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2L2_MSB 15 -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2L2_LSB 12 -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2L2_MASK 0x0000f000 -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2L2_GET(x) (((x) & 0x0000f000) >> 12) -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA2L2_SET(x) (((x) << 12) & 0x0000f000) -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA12_MSB 19 -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA12_LSB 16 -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA12_MASK 0x000f0000 -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA12_GET(x) (((x) & 0x000f0000) >> 16) -#define BB_SWITCH_TABLE_COM2_SWITCH_TABLE_COM_RA12_SET(x) (((x) << 16) & 0x000f0000) - -/* macros for bb_sm_reg_map.BB_multichain_enable */ -#define BB_MULTICHAIN_ENABLE_ADDRESS 0x000000a0 -#define BB_MULTICHAIN_ENABLE_OFFSET 0x000000a0 -#define BB_MULTICHAIN_ENABLE_RX_CHAIN_MASK_MSB 2 -#define BB_MULTICHAIN_ENABLE_RX_CHAIN_MASK_LSB 0 -#define BB_MULTICHAIN_ENABLE_RX_CHAIN_MASK_MASK 0x00000007 -#define BB_MULTICHAIN_ENABLE_RX_CHAIN_MASK_GET(x) (((x) & 0x00000007) >> 0) -#define BB_MULTICHAIN_ENABLE_RX_CHAIN_MASK_SET(x) (((x) << 0) & 0x00000007) - -/* macros for bb_sm_reg_map.BB_cal_chain_mask */ -#define BB_CAL_CHAIN_MASK_ADDRESS 0x000000c0 -#define BB_CAL_CHAIN_MASK_OFFSET 0x000000c0 -#define BB_CAL_CHAIN_MASK_CAL_CHAIN_MASK_MSB 2 -#define BB_CAL_CHAIN_MASK_CAL_CHAIN_MASK_LSB 0 -#define BB_CAL_CHAIN_MASK_CAL_CHAIN_MASK_MASK 0x00000007 -#define BB_CAL_CHAIN_MASK_CAL_CHAIN_MASK_GET(x) (((x) & 0x00000007) >> 0) -#define BB_CAL_CHAIN_MASK_CAL_CHAIN_MASK_SET(x) (((x) << 0) & 0x00000007) - -/* macros for bb_sm_reg_map.BB_agc_control */ -#define BB_AGC_CONTROL_ADDRESS 0x000000c4 -#define BB_AGC_CONTROL_OFFSET 0x000000c4 -#define BB_AGC_CONTROL_DO_CALIBRATE_MSB 0 -#define BB_AGC_CONTROL_DO_CALIBRATE_LSB 0 -#define BB_AGC_CONTROL_DO_CALIBRATE_MASK 0x00000001 -#define BB_AGC_CONTROL_DO_CALIBRATE_GET(x) (((x) & 0x00000001) >> 0) -#define BB_AGC_CONTROL_DO_CALIBRATE_SET(x) (((x) << 0) & 0x00000001) -#define BB_AGC_CONTROL_DO_NOISEFLOOR_MSB 1 -#define BB_AGC_CONTROL_DO_NOISEFLOOR_LSB 1 -#define BB_AGC_CONTROL_DO_NOISEFLOOR_MASK 0x00000002 -#define BB_AGC_CONTROL_DO_NOISEFLOOR_GET(x) (((x) & 0x00000002) >> 1) -#define BB_AGC_CONTROL_DO_NOISEFLOOR_SET(x) (((x) << 1) & 0x00000002) -#define BB_AGC_CONTROL_MIN_NUM_GAIN_CHANGE_MSB 5 -#define BB_AGC_CONTROL_MIN_NUM_GAIN_CHANGE_LSB 3 -#define BB_AGC_CONTROL_MIN_NUM_GAIN_CHANGE_MASK 0x00000038 -#define BB_AGC_CONTROL_MIN_NUM_GAIN_CHANGE_GET(x) (((x) & 0x00000038) >> 3) -#define BB_AGC_CONTROL_MIN_NUM_GAIN_CHANGE_SET(x) (((x) << 3) & 0x00000038) -#define BB_AGC_CONTROL_YCOK_MAX_MSB 9 -#define BB_AGC_CONTROL_YCOK_MAX_LSB 6 -#define BB_AGC_CONTROL_YCOK_MAX_MASK 0x000003c0 -#define BB_AGC_CONTROL_YCOK_MAX_GET(x) (((x) & 0x000003c0) >> 6) -#define BB_AGC_CONTROL_YCOK_MAX_SET(x) (((x) << 6) & 0x000003c0) -#define BB_AGC_CONTROL_LEAKY_BUCKET_ENABLE_MSB 10 -#define BB_AGC_CONTROL_LEAKY_BUCKET_ENABLE_LSB 10 -#define BB_AGC_CONTROL_LEAKY_BUCKET_ENABLE_MASK 0x00000400 -#define BB_AGC_CONTROL_LEAKY_BUCKET_ENABLE_GET(x) (((x) & 0x00000400) >> 10) -#define BB_AGC_CONTROL_LEAKY_BUCKET_ENABLE_SET(x) (((x) << 10) & 0x00000400) -#define BB_AGC_CONTROL_CAL_ENABLE_MSB 11 -#define BB_AGC_CONTROL_CAL_ENABLE_LSB 11 -#define BB_AGC_CONTROL_CAL_ENABLE_MASK 0x00000800 -#define BB_AGC_CONTROL_CAL_ENABLE_GET(x) (((x) & 0x00000800) >> 11) -#define BB_AGC_CONTROL_CAL_ENABLE_SET(x) (((x) << 11) & 0x00000800) -#define BB_AGC_CONTROL_USE_TABLE_SEED_MSB 12 -#define BB_AGC_CONTROL_USE_TABLE_SEED_LSB 12 -#define BB_AGC_CONTROL_USE_TABLE_SEED_MASK 0x00001000 -#define BB_AGC_CONTROL_USE_TABLE_SEED_GET(x) (((x) & 0x00001000) >> 12) -#define BB_AGC_CONTROL_USE_TABLE_SEED_SET(x) (((x) << 12) & 0x00001000) -#define BB_AGC_CONTROL_AGC_UPDATE_TABLE_SEED_MSB 13 -#define BB_AGC_CONTROL_AGC_UPDATE_TABLE_SEED_LSB 13 -#define BB_AGC_CONTROL_AGC_UPDATE_TABLE_SEED_MASK 0x00002000 -#define BB_AGC_CONTROL_AGC_UPDATE_TABLE_SEED_GET(x) (((x) & 0x00002000) >> 13) -#define BB_AGC_CONTROL_AGC_UPDATE_TABLE_SEED_SET(x) (((x) << 13) & 0x00002000) -#define BB_AGC_CONTROL_ENABLE_NOISEFLOOR_MSB 15 -#define BB_AGC_CONTROL_ENABLE_NOISEFLOOR_LSB 15 -#define BB_AGC_CONTROL_ENABLE_NOISEFLOOR_MASK 0x00008000 -#define BB_AGC_CONTROL_ENABLE_NOISEFLOOR_GET(x) (((x) & 0x00008000) >> 15) -#define BB_AGC_CONTROL_ENABLE_NOISEFLOOR_SET(x) (((x) << 15) & 0x00008000) -#define BB_AGC_CONTROL_ENABLE_FLTR_CAL_MSB 16 -#define BB_AGC_CONTROL_ENABLE_FLTR_CAL_LSB 16 -#define BB_AGC_CONTROL_ENABLE_FLTR_CAL_MASK 0x00010000 -#define BB_AGC_CONTROL_ENABLE_FLTR_CAL_GET(x) (((x) & 0x00010000) >> 16) -#define BB_AGC_CONTROL_ENABLE_FLTR_CAL_SET(x) (((x) << 16) & 0x00010000) -#define BB_AGC_CONTROL_NO_UPDATE_NOISEFLOOR_MSB 17 -#define BB_AGC_CONTROL_NO_UPDATE_NOISEFLOOR_LSB 17 -#define BB_AGC_CONTROL_NO_UPDATE_NOISEFLOOR_MASK 0x00020000 -#define BB_AGC_CONTROL_NO_UPDATE_NOISEFLOOR_GET(x) (((x) & 0x00020000) >> 17) -#define BB_AGC_CONTROL_NO_UPDATE_NOISEFLOOR_SET(x) (((x) << 17) & 0x00020000) -#define BB_AGC_CONTROL_EXTEND_NF_PWR_MEAS_MSB 18 -#define BB_AGC_CONTROL_EXTEND_NF_PWR_MEAS_LSB 18 -#define BB_AGC_CONTROL_EXTEND_NF_PWR_MEAS_MASK 0x00040000 -#define BB_AGC_CONTROL_EXTEND_NF_PWR_MEAS_GET(x) (((x) & 0x00040000) >> 18) -#define BB_AGC_CONTROL_EXTEND_NF_PWR_MEAS_SET(x) (((x) << 18) & 0x00040000) -#define BB_AGC_CONTROL_CLC_SUCCESS_MSB 19 -#define BB_AGC_CONTROL_CLC_SUCCESS_LSB 19 -#define BB_AGC_CONTROL_CLC_SUCCESS_MASK 0x00080000 -#define BB_AGC_CONTROL_CLC_SUCCESS_GET(x) (((x) & 0x00080000) >> 19) -#define BB_AGC_CONTROL_ENABLE_PKDET_CAL_MSB 20 -#define BB_AGC_CONTROL_ENABLE_PKDET_CAL_LSB 20 -#define BB_AGC_CONTROL_ENABLE_PKDET_CAL_MASK 0x00100000 -#define BB_AGC_CONTROL_ENABLE_PKDET_CAL_GET(x) (((x) & 0x00100000) >> 20) -#define BB_AGC_CONTROL_ENABLE_PKDET_CAL_SET(x) (((x) << 20) & 0x00100000) - -/* macros for bb_sm_reg_map.BB_iq_adc_cal_mode */ -#define BB_IQ_ADC_CAL_MODE_ADDRESS 0x000000c8 -#define BB_IQ_ADC_CAL_MODE_OFFSET 0x000000c8 -#define BB_IQ_ADC_CAL_MODE_GAIN_DC_IQ_CAL_MODE_MSB 1 -#define BB_IQ_ADC_CAL_MODE_GAIN_DC_IQ_CAL_MODE_LSB 0 -#define BB_IQ_ADC_CAL_MODE_GAIN_DC_IQ_CAL_MODE_MASK 0x00000003 -#define BB_IQ_ADC_CAL_MODE_GAIN_DC_IQ_CAL_MODE_GET(x) (((x) & 0x00000003) >> 0) -#define BB_IQ_ADC_CAL_MODE_GAIN_DC_IQ_CAL_MODE_SET(x) (((x) << 0) & 0x00000003) -#define BB_IQ_ADC_CAL_MODE_TEST_CALADCOFF_MSB 2 -#define BB_IQ_ADC_CAL_MODE_TEST_CALADCOFF_LSB 2 -#define BB_IQ_ADC_CAL_MODE_TEST_CALADCOFF_MASK 0x00000004 -#define BB_IQ_ADC_CAL_MODE_TEST_CALADCOFF_GET(x) (((x) & 0x00000004) >> 2) -#define BB_IQ_ADC_CAL_MODE_TEST_CALADCOFF_SET(x) (((x) << 2) & 0x00000004) - -/* macros for bb_sm_reg_map.BB_fcal_1 */ -#define BB_FCAL_1_ADDRESS 0x000000cc -#define BB_FCAL_1_OFFSET 0x000000cc -#define BB_FCAL_1_FLC_PB_FSTEP_MSB 9 -#define BB_FCAL_1_FLC_PB_FSTEP_LSB 0 -#define BB_FCAL_1_FLC_PB_FSTEP_MASK 0x000003ff -#define BB_FCAL_1_FLC_PB_FSTEP_GET(x) (((x) & 0x000003ff) >> 0) -#define BB_FCAL_1_FLC_PB_FSTEP_SET(x) (((x) << 0) & 0x000003ff) -#define BB_FCAL_1_FLC_SB_FSTEP_MSB 19 -#define BB_FCAL_1_FLC_SB_FSTEP_LSB 10 -#define BB_FCAL_1_FLC_SB_FSTEP_MASK 0x000ffc00 -#define BB_FCAL_1_FLC_SB_FSTEP_GET(x) (((x) & 0x000ffc00) >> 10) -#define BB_FCAL_1_FLC_SB_FSTEP_SET(x) (((x) << 10) & 0x000ffc00) -#define BB_FCAL_1_FLC_PB_ATTEN_MSB 24 -#define BB_FCAL_1_FLC_PB_ATTEN_LSB 20 -#define BB_FCAL_1_FLC_PB_ATTEN_MASK 0x01f00000 -#define BB_FCAL_1_FLC_PB_ATTEN_GET(x) (((x) & 0x01f00000) >> 20) -#define BB_FCAL_1_FLC_PB_ATTEN_SET(x) (((x) << 20) & 0x01f00000) -#define BB_FCAL_1_FLC_SB_ATTEN_MSB 29 -#define BB_FCAL_1_FLC_SB_ATTEN_LSB 25 -#define BB_FCAL_1_FLC_SB_ATTEN_MASK 0x3e000000 -#define BB_FCAL_1_FLC_SB_ATTEN_GET(x) (((x) & 0x3e000000) >> 25) -#define BB_FCAL_1_FLC_SB_ATTEN_SET(x) (((x) << 25) & 0x3e000000) - -/* macros for bb_sm_reg_map.BB_fcal_2_b0 */ -#define BB_FCAL_2_B0_ADDRESS 0x000000d0 -#define BB_FCAL_2_B0_OFFSET 0x000000d0 -#define BB_FCAL_2_B0_FLC_PWR_THRESH_MSB 2 -#define BB_FCAL_2_B0_FLC_PWR_THRESH_LSB 0 -#define BB_FCAL_2_B0_FLC_PWR_THRESH_MASK 0x00000007 -#define BB_FCAL_2_B0_FLC_PWR_THRESH_GET(x) (((x) & 0x00000007) >> 0) -#define BB_FCAL_2_B0_FLC_PWR_THRESH_SET(x) (((x) << 0) & 0x00000007) -#define BB_FCAL_2_B0_FLC_SW_CAP_VAL_0_MSB 7 -#define BB_FCAL_2_B0_FLC_SW_CAP_VAL_0_LSB 3 -#define BB_FCAL_2_B0_FLC_SW_CAP_VAL_0_MASK 0x000000f8 -#define BB_FCAL_2_B0_FLC_SW_CAP_VAL_0_GET(x) (((x) & 0x000000f8) >> 3) -#define BB_FCAL_2_B0_FLC_SW_CAP_VAL_0_SET(x) (((x) << 3) & 0x000000f8) -#define BB_FCAL_2_B0_FLC_BBMISCGAIN_MSB 9 -#define BB_FCAL_2_B0_FLC_BBMISCGAIN_LSB 8 -#define BB_FCAL_2_B0_FLC_BBMISCGAIN_MASK 0x00000300 -#define BB_FCAL_2_B0_FLC_BBMISCGAIN_GET(x) (((x) & 0x00000300) >> 8) -#define BB_FCAL_2_B0_FLC_BBMISCGAIN_SET(x) (((x) << 8) & 0x00000300) -#define BB_FCAL_2_B0_FLC_BB1DBGAIN_MSB 12 -#define BB_FCAL_2_B0_FLC_BB1DBGAIN_LSB 10 -#define BB_FCAL_2_B0_FLC_BB1DBGAIN_MASK 0x00001c00 -#define BB_FCAL_2_B0_FLC_BB1DBGAIN_GET(x) (((x) & 0x00001c00) >> 10) -#define BB_FCAL_2_B0_FLC_BB1DBGAIN_SET(x) (((x) << 10) & 0x00001c00) -#define BB_FCAL_2_B0_FLC_BB6DBGAIN_MSB 14 -#define BB_FCAL_2_B0_FLC_BB6DBGAIN_LSB 13 -#define BB_FCAL_2_B0_FLC_BB6DBGAIN_MASK 0x00006000 -#define BB_FCAL_2_B0_FLC_BB6DBGAIN_GET(x) (((x) & 0x00006000) >> 13) -#define BB_FCAL_2_B0_FLC_BB6DBGAIN_SET(x) (((x) << 13) & 0x00006000) -#define BB_FCAL_2_B0_FLC_SW_CAP_SET_MSB 15 -#define BB_FCAL_2_B0_FLC_SW_CAP_SET_LSB 15 -#define BB_FCAL_2_B0_FLC_SW_CAP_SET_MASK 0x00008000 -#define BB_FCAL_2_B0_FLC_SW_CAP_SET_GET(x) (((x) & 0x00008000) >> 15) -#define BB_FCAL_2_B0_FLC_SW_CAP_SET_SET(x) (((x) << 15) & 0x00008000) -#define BB_FCAL_2_B0_FLC_MEAS_WIN_MSB 18 -#define BB_FCAL_2_B0_FLC_MEAS_WIN_LSB 16 -#define BB_FCAL_2_B0_FLC_MEAS_WIN_MASK 0x00070000 -#define BB_FCAL_2_B0_FLC_MEAS_WIN_GET(x) (((x) & 0x00070000) >> 16) -#define BB_FCAL_2_B0_FLC_MEAS_WIN_SET(x) (((x) << 16) & 0x00070000) -#define BB_FCAL_2_B0_FLC_CAP_VAL_STATUS_0_MSB 24 -#define BB_FCAL_2_B0_FLC_CAP_VAL_STATUS_0_LSB 20 -#define BB_FCAL_2_B0_FLC_CAP_VAL_STATUS_0_MASK 0x01f00000 -#define BB_FCAL_2_B0_FLC_CAP_VAL_STATUS_0_GET(x) (((x) & 0x01f00000) >> 20) - -/* macros for bb_sm_reg_map.BB_dft_tone_ctrl_b0 */ -#define BB_DFT_TONE_CTRL_B0_ADDRESS 0x000000d4 -#define BB_DFT_TONE_CTRL_B0_OFFSET 0x000000d4 -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_EN_0_MSB 0 -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_EN_0_LSB 0 -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_EN_0_MASK 0x00000001 -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_EN_0_GET(x) (((x) & 0x00000001) >> 0) -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_EN_0_SET(x) (((x) << 0) & 0x00000001) -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_AMP_SEL_0_MSB 3 -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_AMP_SEL_0_LSB 2 -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_AMP_SEL_0_MASK 0x0000000c -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_AMP_SEL_0_GET(x) (((x) & 0x0000000c) >> 2) -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_AMP_SEL_0_SET(x) (((x) << 2) & 0x0000000c) -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_FREQ_ANG_0_MSB 12 -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_FREQ_ANG_0_LSB 4 -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_FREQ_ANG_0_MASK 0x00001ff0 -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_FREQ_ANG_0_GET(x) (((x) & 0x00001ff0) >> 4) -#define BB_DFT_TONE_CTRL_B0_DFT_TONE_FREQ_ANG_0_SET(x) (((x) << 4) & 0x00001ff0) - -/* macros for bb_sm_reg_map.BB_cl_cal_ctrl */ -#define BB_CL_CAL_CTRL_ADDRESS 0x000000d8 -#define BB_CL_CAL_CTRL_OFFSET 0x000000d8 -#define BB_CL_CAL_CTRL_ENABLE_PARALLEL_CAL_MSB 0 -#define BB_CL_CAL_CTRL_ENABLE_PARALLEL_CAL_LSB 0 -#define BB_CL_CAL_CTRL_ENABLE_PARALLEL_CAL_MASK 0x00000001 -#define BB_CL_CAL_CTRL_ENABLE_PARALLEL_CAL_GET(x) (((x) & 0x00000001) >> 0) -#define BB_CL_CAL_CTRL_ENABLE_PARALLEL_CAL_SET(x) (((x) << 0) & 0x00000001) -#define BB_CL_CAL_CTRL_ENABLE_CL_CALIBRATE_MSB 1 -#define BB_CL_CAL_CTRL_ENABLE_CL_CALIBRATE_LSB 1 -#define BB_CL_CAL_CTRL_ENABLE_CL_CALIBRATE_MASK 0x00000002 -#define BB_CL_CAL_CTRL_ENABLE_CL_CALIBRATE_GET(x) (((x) & 0x00000002) >> 1) -#define BB_CL_CAL_CTRL_ENABLE_CL_CALIBRATE_SET(x) (((x) << 1) & 0x00000002) -#define BB_CL_CAL_CTRL_CF_CLC_TEST_POINT_MSB 3 -#define BB_CL_CAL_CTRL_CF_CLC_TEST_POINT_LSB 2 -#define BB_CL_CAL_CTRL_CF_CLC_TEST_POINT_MASK 0x0000000c -#define BB_CL_CAL_CTRL_CF_CLC_TEST_POINT_GET(x) (((x) & 0x0000000c) >> 2) -#define BB_CL_CAL_CTRL_CF_CLC_TEST_POINT_SET(x) (((x) << 2) & 0x0000000c) -#define BB_CL_CAL_CTRL_CF_CLC_FORCED_PAGAIN_MSB 7 -#define BB_CL_CAL_CTRL_CF_CLC_FORCED_PAGAIN_LSB 4 -#define BB_CL_CAL_CTRL_CF_CLC_FORCED_PAGAIN_MASK 0x000000f0 -#define BB_CL_CAL_CTRL_CF_CLC_FORCED_PAGAIN_GET(x) (((x) & 0x000000f0) >> 4) -#define BB_CL_CAL_CTRL_CF_CLC_FORCED_PAGAIN_SET(x) (((x) << 4) & 0x000000f0) -#define BB_CL_CAL_CTRL_CARR_LEAK_MAX_OFFSET_MSB 15 -#define BB_CL_CAL_CTRL_CARR_LEAK_MAX_OFFSET_LSB 8 -#define BB_CL_CAL_CTRL_CARR_LEAK_MAX_OFFSET_MASK 0x0000ff00 -#define BB_CL_CAL_CTRL_CARR_LEAK_MAX_OFFSET_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_CL_CAL_CTRL_CARR_LEAK_MAX_OFFSET_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_CL_CAL_CTRL_CF_CLC_INIT_BBGAIN_MSB 21 -#define BB_CL_CAL_CTRL_CF_CLC_INIT_BBGAIN_LSB 16 -#define BB_CL_CAL_CTRL_CF_CLC_INIT_BBGAIN_MASK 0x003f0000 -#define BB_CL_CAL_CTRL_CF_CLC_INIT_BBGAIN_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_CL_CAL_CTRL_CF_CLC_INIT_BBGAIN_SET(x) (((x) << 16) & 0x003f0000) -#define BB_CL_CAL_CTRL_CF_ADC_BOUND_MSB 29 -#define BB_CL_CAL_CTRL_CF_ADC_BOUND_LSB 22 -#define BB_CL_CAL_CTRL_CF_ADC_BOUND_MASK 0x3fc00000 -#define BB_CL_CAL_CTRL_CF_ADC_BOUND_GET(x) (((x) & 0x3fc00000) >> 22) -#define BB_CL_CAL_CTRL_CF_ADC_BOUND_SET(x) (((x) << 22) & 0x3fc00000) -#define BB_CL_CAL_CTRL_USE_DAC_CL_CORRECTION_MSB 30 -#define BB_CL_CAL_CTRL_USE_DAC_CL_CORRECTION_LSB 30 -#define BB_CL_CAL_CTRL_USE_DAC_CL_CORRECTION_MASK 0x40000000 -#define BB_CL_CAL_CTRL_USE_DAC_CL_CORRECTION_GET(x) (((x) & 0x40000000) >> 30) -#define BB_CL_CAL_CTRL_USE_DAC_CL_CORRECTION_SET(x) (((x) << 30) & 0x40000000) -#define BB_CL_CAL_CTRL_CL_MAP_HW_GEN_MSB 31 -#define BB_CL_CAL_CTRL_CL_MAP_HW_GEN_LSB 31 -#define BB_CL_CAL_CTRL_CL_MAP_HW_GEN_MASK 0x80000000 -#define BB_CL_CAL_CTRL_CL_MAP_HW_GEN_GET(x) (((x) & 0x80000000) >> 31) -#define BB_CL_CAL_CTRL_CL_MAP_HW_GEN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_sm_reg_map.BB_cl_map_0_b0 */ -#define BB_CL_MAP_0_B0_ADDRESS 0x000000dc -#define BB_CL_MAP_0_B0_OFFSET 0x000000dc -#define BB_CL_MAP_0_B0_CL_MAP_0_MSB 31 -#define BB_CL_MAP_0_B0_CL_MAP_0_LSB 0 -#define BB_CL_MAP_0_B0_CL_MAP_0_MASK 0xffffffff -#define BB_CL_MAP_0_B0_CL_MAP_0_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_0_B0_CL_MAP_0_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_cl_map_1_b0 */ -#define BB_CL_MAP_1_B0_ADDRESS 0x000000e0 -#define BB_CL_MAP_1_B0_OFFSET 0x000000e0 -#define BB_CL_MAP_1_B0_CL_MAP_1_MSB 31 -#define BB_CL_MAP_1_B0_CL_MAP_1_LSB 0 -#define BB_CL_MAP_1_B0_CL_MAP_1_MASK 0xffffffff -#define BB_CL_MAP_1_B0_CL_MAP_1_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_1_B0_CL_MAP_1_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_cl_map_2_b0 */ -#define BB_CL_MAP_2_B0_ADDRESS 0x000000e4 -#define BB_CL_MAP_2_B0_OFFSET 0x000000e4 -#define BB_CL_MAP_2_B0_CL_MAP_2_MSB 31 -#define BB_CL_MAP_2_B0_CL_MAP_2_LSB 0 -#define BB_CL_MAP_2_B0_CL_MAP_2_MASK 0xffffffff -#define BB_CL_MAP_2_B0_CL_MAP_2_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_2_B0_CL_MAP_2_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_cl_map_3_b0 */ -#define BB_CL_MAP_3_B0_ADDRESS 0x000000e8 -#define BB_CL_MAP_3_B0_OFFSET 0x000000e8 -#define BB_CL_MAP_3_B0_CL_MAP_3_MSB 31 -#define BB_CL_MAP_3_B0_CL_MAP_3_LSB 0 -#define BB_CL_MAP_3_B0_CL_MAP_3_MASK 0xffffffff -#define BB_CL_MAP_3_B0_CL_MAP_3_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_3_B0_CL_MAP_3_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_cl_map_pal_0_b0 */ -#define BB_CL_MAP_PAL_0_B0_ADDRESS 0x000000ec -#define BB_CL_MAP_PAL_0_B0_OFFSET 0x000000ec -#define BB_CL_MAP_PAL_0_B0_CL_MAP_0_MSB 31 -#define BB_CL_MAP_PAL_0_B0_CL_MAP_0_LSB 0 -#define BB_CL_MAP_PAL_0_B0_CL_MAP_0_MASK 0xffffffff -#define BB_CL_MAP_PAL_0_B0_CL_MAP_0_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_PAL_0_B0_CL_MAP_0_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_cl_map_pal_1_b0 */ -#define BB_CL_MAP_PAL_1_B0_ADDRESS 0x000000f0 -#define BB_CL_MAP_PAL_1_B0_OFFSET 0x000000f0 -#define BB_CL_MAP_PAL_1_B0_CL_MAP_1_MSB 31 -#define BB_CL_MAP_PAL_1_B0_CL_MAP_1_LSB 0 -#define BB_CL_MAP_PAL_1_B0_CL_MAP_1_MASK 0xffffffff -#define BB_CL_MAP_PAL_1_B0_CL_MAP_1_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_PAL_1_B0_CL_MAP_1_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_cl_map_pal_2_b0 */ -#define BB_CL_MAP_PAL_2_B0_ADDRESS 0x000000f4 -#define BB_CL_MAP_PAL_2_B0_OFFSET 0x000000f4 -#define BB_CL_MAP_PAL_2_B0_CL_MAP_2_MSB 31 -#define BB_CL_MAP_PAL_2_B0_CL_MAP_2_LSB 0 -#define BB_CL_MAP_PAL_2_B0_CL_MAP_2_MASK 0xffffffff -#define BB_CL_MAP_PAL_2_B0_CL_MAP_2_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_PAL_2_B0_CL_MAP_2_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_cl_map_pal_3_b0 */ -#define BB_CL_MAP_PAL_3_B0_ADDRESS 0x000000f8 -#define BB_CL_MAP_PAL_3_B0_OFFSET 0x000000f8 -#define BB_CL_MAP_PAL_3_B0_CL_MAP_3_MSB 31 -#define BB_CL_MAP_PAL_3_B0_CL_MAP_3_LSB 0 -#define BB_CL_MAP_PAL_3_B0_CL_MAP_3_MASK 0xffffffff -#define BB_CL_MAP_PAL_3_B0_CL_MAP_3_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_PAL_3_B0_CL_MAP_3_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_cl_tab_b0 */ -#define BB_CL_TAB_B0_ADDRESS 0x00000100 -#define BB_CL_TAB_B0_OFFSET 0x00000100 -#define BB_CL_TAB_B0_CL_GAIN_MOD_MSB 4 -#define BB_CL_TAB_B0_CL_GAIN_MOD_LSB 0 -#define BB_CL_TAB_B0_CL_GAIN_MOD_MASK 0x0000001f -#define BB_CL_TAB_B0_CL_GAIN_MOD_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_CL_TAB_B0_CL_GAIN_MOD_SET(x) (((x) << 0) & 0x0000001f) -#define BB_CL_TAB_B0_CARR_LK_DC_ADD_Q_MSB 15 -#define BB_CL_TAB_B0_CARR_LK_DC_ADD_Q_LSB 5 -#define BB_CL_TAB_B0_CARR_LK_DC_ADD_Q_MASK 0x0000ffe0 -#define BB_CL_TAB_B0_CARR_LK_DC_ADD_Q_GET(x) (((x) & 0x0000ffe0) >> 5) -#define BB_CL_TAB_B0_CARR_LK_DC_ADD_Q_SET(x) (((x) << 5) & 0x0000ffe0) -#define BB_CL_TAB_B0_CARR_LK_DC_ADD_I_MSB 26 -#define BB_CL_TAB_B0_CARR_LK_DC_ADD_I_LSB 16 -#define BB_CL_TAB_B0_CARR_LK_DC_ADD_I_MASK 0x07ff0000 -#define BB_CL_TAB_B0_CARR_LK_DC_ADD_I_GET(x) (((x) & 0x07ff0000) >> 16) -#define BB_CL_TAB_B0_CARR_LK_DC_ADD_I_SET(x) (((x) << 16) & 0x07ff0000) -#define BB_CL_TAB_B0_BB_GAIN_MSB 30 -#define BB_CL_TAB_B0_BB_GAIN_LSB 27 -#define BB_CL_TAB_B0_BB_GAIN_MASK 0x78000000 -#define BB_CL_TAB_B0_BB_GAIN_GET(x) (((x) & 0x78000000) >> 27) -#define BB_CL_TAB_B0_BB_GAIN_SET(x) (((x) << 27) & 0x78000000) - -/* macros for bb_sm_reg_map.BB_synth_control */ -#define BB_SYNTH_CONTROL_ADDRESS 0x00000140 -#define BB_SYNTH_CONTROL_OFFSET 0x00000140 -#define BB_SYNTH_CONTROL_RFCHANFRAC_MSB 16 -#define BB_SYNTH_CONTROL_RFCHANFRAC_LSB 0 -#define BB_SYNTH_CONTROL_RFCHANFRAC_MASK 0x0001ffff -#define BB_SYNTH_CONTROL_RFCHANFRAC_GET(x) (((x) & 0x0001ffff) >> 0) -#define BB_SYNTH_CONTROL_RFCHANFRAC_SET(x) (((x) << 0) & 0x0001ffff) -#define BB_SYNTH_CONTROL_RFCHANNEL_MSB 25 -#define BB_SYNTH_CONTROL_RFCHANNEL_LSB 17 -#define BB_SYNTH_CONTROL_RFCHANNEL_MASK 0x03fe0000 -#define BB_SYNTH_CONTROL_RFCHANNEL_GET(x) (((x) & 0x03fe0000) >> 17) -#define BB_SYNTH_CONTROL_RFCHANNEL_SET(x) (((x) << 17) & 0x03fe0000) -#define BB_SYNTH_CONTROL_RFAMODEREFSEL_MSB 27 -#define BB_SYNTH_CONTROL_RFAMODEREFSEL_LSB 26 -#define BB_SYNTH_CONTROL_RFAMODEREFSEL_MASK 0x0c000000 -#define BB_SYNTH_CONTROL_RFAMODEREFSEL_GET(x) (((x) & 0x0c000000) >> 26) -#define BB_SYNTH_CONTROL_RFAMODEREFSEL_SET(x) (((x) << 26) & 0x0c000000) -#define BB_SYNTH_CONTROL_RFFRACMODE_MSB 28 -#define BB_SYNTH_CONTROL_RFFRACMODE_LSB 28 -#define BB_SYNTH_CONTROL_RFFRACMODE_MASK 0x10000000 -#define BB_SYNTH_CONTROL_RFFRACMODE_GET(x) (((x) & 0x10000000) >> 28) -#define BB_SYNTH_CONTROL_RFFRACMODE_SET(x) (((x) << 28) & 0x10000000) -#define BB_SYNTH_CONTROL_RFBMODE_MSB 29 -#define BB_SYNTH_CONTROL_RFBMODE_LSB 29 -#define BB_SYNTH_CONTROL_RFBMODE_MASK 0x20000000 -#define BB_SYNTH_CONTROL_RFBMODE_GET(x) (((x) & 0x20000000) >> 29) -#define BB_SYNTH_CONTROL_RFBMODE_SET(x) (((x) << 29) & 0x20000000) -#define BB_SYNTH_CONTROL_RFSYNTH_CTRL_SSHIFT_MSB 30 -#define BB_SYNTH_CONTROL_RFSYNTH_CTRL_SSHIFT_LSB 30 -#define BB_SYNTH_CONTROL_RFSYNTH_CTRL_SSHIFT_MASK 0x40000000 -#define BB_SYNTH_CONTROL_RFSYNTH_CTRL_SSHIFT_GET(x) (((x) & 0x40000000) >> 30) -#define BB_SYNTH_CONTROL_RFSYNTH_CTRL_SSHIFT_SET(x) (((x) << 30) & 0x40000000) - -/* macros for bb_sm_reg_map.BB_addac_clk_select */ -#define BB_ADDAC_CLK_SELECT_ADDRESS 0x00000144 -#define BB_ADDAC_CLK_SELECT_OFFSET 0x00000144 -#define BB_ADDAC_CLK_SELECT_BB_DAC_CLK_SELECT_MSB 3 -#define BB_ADDAC_CLK_SELECT_BB_DAC_CLK_SELECT_LSB 1 -#define BB_ADDAC_CLK_SELECT_BB_DAC_CLK_SELECT_MASK 0x0000000e -#define BB_ADDAC_CLK_SELECT_BB_DAC_CLK_SELECT_GET(x) (((x) & 0x0000000e) >> 1) -#define BB_ADDAC_CLK_SELECT_BB_DAC_CLK_SELECT_SET(x) (((x) << 1) & 0x0000000e) -#define BB_ADDAC_CLK_SELECT_BB_ADC_CLK_SELECT_MSB 7 -#define BB_ADDAC_CLK_SELECT_BB_ADC_CLK_SELECT_LSB 4 -#define BB_ADDAC_CLK_SELECT_BB_ADC_CLK_SELECT_MASK 0x000000f0 -#define BB_ADDAC_CLK_SELECT_BB_ADC_CLK_SELECT_GET(x) (((x) & 0x000000f0) >> 4) -#define BB_ADDAC_CLK_SELECT_BB_ADC_CLK_SELECT_SET(x) (((x) << 4) & 0x000000f0) - -/* macros for bb_sm_reg_map.BB_pll_cntl */ -#define BB_PLL_CNTL_ADDRESS 0x00000148 -#define BB_PLL_CNTL_OFFSET 0x00000148 -#define BB_PLL_CNTL_BB_PLL_DIV_MSB 9 -#define BB_PLL_CNTL_BB_PLL_DIV_LSB 0 -#define BB_PLL_CNTL_BB_PLL_DIV_MASK 0x000003ff -#define BB_PLL_CNTL_BB_PLL_DIV_GET(x) (((x) & 0x000003ff) >> 0) -#define BB_PLL_CNTL_BB_PLL_DIV_SET(x) (((x) << 0) & 0x000003ff) -#define BB_PLL_CNTL_BB_PLL_REFDIV_MSB 13 -#define BB_PLL_CNTL_BB_PLL_REFDIV_LSB 10 -#define BB_PLL_CNTL_BB_PLL_REFDIV_MASK 0x00003c00 -#define BB_PLL_CNTL_BB_PLL_REFDIV_GET(x) (((x) & 0x00003c00) >> 10) -#define BB_PLL_CNTL_BB_PLL_REFDIV_SET(x) (((x) << 10) & 0x00003c00) -#define BB_PLL_CNTL_BB_PLL_CLK_SEL_MSB 15 -#define BB_PLL_CNTL_BB_PLL_CLK_SEL_LSB 14 -#define BB_PLL_CNTL_BB_PLL_CLK_SEL_MASK 0x0000c000 -#define BB_PLL_CNTL_BB_PLL_CLK_SEL_GET(x) (((x) & 0x0000c000) >> 14) -#define BB_PLL_CNTL_BB_PLL_CLK_SEL_SET(x) (((x) << 14) & 0x0000c000) -#define BB_PLL_CNTL_BB_PLLBYPASS_MSB 16 -#define BB_PLL_CNTL_BB_PLLBYPASS_LSB 16 -#define BB_PLL_CNTL_BB_PLLBYPASS_MASK 0x00010000 -#define BB_PLL_CNTL_BB_PLLBYPASS_GET(x) (((x) & 0x00010000) >> 16) -#define BB_PLL_CNTL_BB_PLLBYPASS_SET(x) (((x) << 16) & 0x00010000) -#define BB_PLL_CNTL_BB_PLL_SETTLE_TIME_MSB 27 -#define BB_PLL_CNTL_BB_PLL_SETTLE_TIME_LSB 17 -#define BB_PLL_CNTL_BB_PLL_SETTLE_TIME_MASK 0x0ffe0000 -#define BB_PLL_CNTL_BB_PLL_SETTLE_TIME_GET(x) (((x) & 0x0ffe0000) >> 17) -#define BB_PLL_CNTL_BB_PLL_SETTLE_TIME_SET(x) (((x) << 17) & 0x0ffe0000) - -/* macros for bb_sm_reg_map.BB_analog_swap */ -#define BB_ANALOG_SWAP_ADDRESS 0x0000014c -#define BB_ANALOG_SWAP_OFFSET 0x0000014c -#define BB_ANALOG_SWAP_ANALOG_RX_SWAP_CNTL_MSB 2 -#define BB_ANALOG_SWAP_ANALOG_RX_SWAP_CNTL_LSB 0 -#define BB_ANALOG_SWAP_ANALOG_RX_SWAP_CNTL_MASK 0x00000007 -#define BB_ANALOG_SWAP_ANALOG_RX_SWAP_CNTL_GET(x) (((x) & 0x00000007) >> 0) -#define BB_ANALOG_SWAP_ANALOG_RX_SWAP_CNTL_SET(x) (((x) << 0) & 0x00000007) -#define BB_ANALOG_SWAP_ANALOG_TX_SWAP_CNTL_MSB 5 -#define BB_ANALOG_SWAP_ANALOG_TX_SWAP_CNTL_LSB 3 -#define BB_ANALOG_SWAP_ANALOG_TX_SWAP_CNTL_MASK 0x00000038 -#define BB_ANALOG_SWAP_ANALOG_TX_SWAP_CNTL_GET(x) (((x) & 0x00000038) >> 3) -#define BB_ANALOG_SWAP_ANALOG_TX_SWAP_CNTL_SET(x) (((x) << 3) & 0x00000038) -#define BB_ANALOG_SWAP_SWAP_ALT_CHN_MSB 6 -#define BB_ANALOG_SWAP_SWAP_ALT_CHN_LSB 6 -#define BB_ANALOG_SWAP_SWAP_ALT_CHN_MASK 0x00000040 -#define BB_ANALOG_SWAP_SWAP_ALT_CHN_GET(x) (((x) & 0x00000040) >> 6) -#define BB_ANALOG_SWAP_SWAP_ALT_CHN_SET(x) (((x) << 6) & 0x00000040) -#define BB_ANALOG_SWAP_ANALOG_DC_DAC_POLARITY_MSB 7 -#define BB_ANALOG_SWAP_ANALOG_DC_DAC_POLARITY_LSB 7 -#define BB_ANALOG_SWAP_ANALOG_DC_DAC_POLARITY_MASK 0x00000080 -#define BB_ANALOG_SWAP_ANALOG_DC_DAC_POLARITY_GET(x) (((x) & 0x00000080) >> 7) -#define BB_ANALOG_SWAP_ANALOG_DC_DAC_POLARITY_SET(x) (((x) << 7) & 0x00000080) -#define BB_ANALOG_SWAP_ANALOG_PKDET_DAC_POLARITY_MSB 8 -#define BB_ANALOG_SWAP_ANALOG_PKDET_DAC_POLARITY_LSB 8 -#define BB_ANALOG_SWAP_ANALOG_PKDET_DAC_POLARITY_MASK 0x00000100 -#define BB_ANALOG_SWAP_ANALOG_PKDET_DAC_POLARITY_GET(x) (((x) & 0x00000100) >> 8) -#define BB_ANALOG_SWAP_ANALOG_PKDET_DAC_POLARITY_SET(x) (((x) << 8) & 0x00000100) - -/* macros for bb_sm_reg_map.BB_addac_parallel_control */ -#define BB_ADDAC_PARALLEL_CONTROL_ADDRESS 0x00000150 -#define BB_ADDAC_PARALLEL_CONTROL_OFFSET 0x00000150 -#define BB_ADDAC_PARALLEL_CONTROL_OFF_DACLPMODE_MSB 12 -#define BB_ADDAC_PARALLEL_CONTROL_OFF_DACLPMODE_LSB 12 -#define BB_ADDAC_PARALLEL_CONTROL_OFF_DACLPMODE_MASK 0x00001000 -#define BB_ADDAC_PARALLEL_CONTROL_OFF_DACLPMODE_GET(x) (((x) & 0x00001000) >> 12) -#define BB_ADDAC_PARALLEL_CONTROL_OFF_DACLPMODE_SET(x) (((x) << 12) & 0x00001000) -#define BB_ADDAC_PARALLEL_CONTROL_OFF_PWDDAC_MSB 13 -#define BB_ADDAC_PARALLEL_CONTROL_OFF_PWDDAC_LSB 13 -#define BB_ADDAC_PARALLEL_CONTROL_OFF_PWDDAC_MASK 0x00002000 -#define BB_ADDAC_PARALLEL_CONTROL_OFF_PWDDAC_GET(x) (((x) & 0x00002000) >> 13) -#define BB_ADDAC_PARALLEL_CONTROL_OFF_PWDDAC_SET(x) (((x) << 13) & 0x00002000) -#define BB_ADDAC_PARALLEL_CONTROL_OFF_PWDADC_MSB 15 -#define BB_ADDAC_PARALLEL_CONTROL_OFF_PWDADC_LSB 15 -#define BB_ADDAC_PARALLEL_CONTROL_OFF_PWDADC_MASK 0x00008000 -#define BB_ADDAC_PARALLEL_CONTROL_OFF_PWDADC_GET(x) (((x) & 0x00008000) >> 15) -#define BB_ADDAC_PARALLEL_CONTROL_OFF_PWDADC_SET(x) (((x) << 15) & 0x00008000) -#define BB_ADDAC_PARALLEL_CONTROL_ON_DACLPMODE_MSB 28 -#define BB_ADDAC_PARALLEL_CONTROL_ON_DACLPMODE_LSB 28 -#define BB_ADDAC_PARALLEL_CONTROL_ON_DACLPMODE_MASK 0x10000000 -#define BB_ADDAC_PARALLEL_CONTROL_ON_DACLPMODE_GET(x) (((x) & 0x10000000) >> 28) -#define BB_ADDAC_PARALLEL_CONTROL_ON_DACLPMODE_SET(x) (((x) << 28) & 0x10000000) -#define BB_ADDAC_PARALLEL_CONTROL_ON_PWDDAC_MSB 29 -#define BB_ADDAC_PARALLEL_CONTROL_ON_PWDDAC_LSB 29 -#define BB_ADDAC_PARALLEL_CONTROL_ON_PWDDAC_MASK 0x20000000 -#define BB_ADDAC_PARALLEL_CONTROL_ON_PWDDAC_GET(x) (((x) & 0x20000000) >> 29) -#define BB_ADDAC_PARALLEL_CONTROL_ON_PWDDAC_SET(x) (((x) << 29) & 0x20000000) -#define BB_ADDAC_PARALLEL_CONTROL_ON_PWDADC_MSB 31 -#define BB_ADDAC_PARALLEL_CONTROL_ON_PWDADC_LSB 31 -#define BB_ADDAC_PARALLEL_CONTROL_ON_PWDADC_MASK 0x80000000 -#define BB_ADDAC_PARALLEL_CONTROL_ON_PWDADC_GET(x) (((x) & 0x80000000) >> 31) -#define BB_ADDAC_PARALLEL_CONTROL_ON_PWDADC_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_sm_reg_map.BB_force_analog */ -#define BB_FORCE_ANALOG_ADDRESS 0x00000158 -#define BB_FORCE_ANALOG_OFFSET 0x00000158 -#define BB_FORCE_ANALOG_FORCE_XPAON_MSB 0 -#define BB_FORCE_ANALOG_FORCE_XPAON_LSB 0 -#define BB_FORCE_ANALOG_FORCE_XPAON_MASK 0x00000001 -#define BB_FORCE_ANALOG_FORCE_XPAON_GET(x) (((x) & 0x00000001) >> 0) -#define BB_FORCE_ANALOG_FORCE_XPAON_SET(x) (((x) << 0) & 0x00000001) -#define BB_FORCE_ANALOG_FORCED_XPAON_MSB 3 -#define BB_FORCE_ANALOG_FORCED_XPAON_LSB 1 -#define BB_FORCE_ANALOG_FORCED_XPAON_MASK 0x0000000e -#define BB_FORCE_ANALOG_FORCED_XPAON_GET(x) (((x) & 0x0000000e) >> 1) -#define BB_FORCE_ANALOG_FORCED_XPAON_SET(x) (((x) << 1) & 0x0000000e) -#define BB_FORCE_ANALOG_FORCE_PDADC_PWD_MSB 4 -#define BB_FORCE_ANALOG_FORCE_PDADC_PWD_LSB 4 -#define BB_FORCE_ANALOG_FORCE_PDADC_PWD_MASK 0x00000010 -#define BB_FORCE_ANALOG_FORCE_PDADC_PWD_GET(x) (((x) & 0x00000010) >> 4) -#define BB_FORCE_ANALOG_FORCE_PDADC_PWD_SET(x) (((x) << 4) & 0x00000010) -#define BB_FORCE_ANALOG_FORCED_PDADC_PWD_MSB 7 -#define BB_FORCE_ANALOG_FORCED_PDADC_PWD_LSB 5 -#define BB_FORCE_ANALOG_FORCED_PDADC_PWD_MASK 0x000000e0 -#define BB_FORCE_ANALOG_FORCED_PDADC_PWD_GET(x) (((x) & 0x000000e0) >> 5) -#define BB_FORCE_ANALOG_FORCED_PDADC_PWD_SET(x) (((x) << 5) & 0x000000e0) - -/* macros for bb_sm_reg_map.BB_test_controls */ -#define BB_TEST_CONTROLS_ADDRESS 0x00000160 -#define BB_TEST_CONTROLS_OFFSET 0x00000160 -#define BB_TEST_CONTROLS_CF_TSTTRIG_SEL_MSB 3 -#define BB_TEST_CONTROLS_CF_TSTTRIG_SEL_LSB 0 -#define BB_TEST_CONTROLS_CF_TSTTRIG_SEL_MASK 0x0000000f -#define BB_TEST_CONTROLS_CF_TSTTRIG_SEL_GET(x) (((x) & 0x0000000f) >> 0) -#define BB_TEST_CONTROLS_CF_TSTTRIG_SEL_SET(x) (((x) << 0) & 0x0000000f) -#define BB_TEST_CONTROLS_CF_TSTTRIG_MSB 4 -#define BB_TEST_CONTROLS_CF_TSTTRIG_LSB 4 -#define BB_TEST_CONTROLS_CF_TSTTRIG_MASK 0x00000010 -#define BB_TEST_CONTROLS_CF_TSTTRIG_GET(x) (((x) & 0x00000010) >> 4) -#define BB_TEST_CONTROLS_CF_TSTTRIG_SET(x) (((x) << 4) & 0x00000010) -#define BB_TEST_CONTROLS_CF_RFSHIFT_SEL_MSB 6 -#define BB_TEST_CONTROLS_CF_RFSHIFT_SEL_LSB 5 -#define BB_TEST_CONTROLS_CF_RFSHIFT_SEL_MASK 0x00000060 -#define BB_TEST_CONTROLS_CF_RFSHIFT_SEL_GET(x) (((x) & 0x00000060) >> 5) -#define BB_TEST_CONTROLS_CF_RFSHIFT_SEL_SET(x) (((x) << 5) & 0x00000060) -#define BB_TEST_CONTROLS_CARDBUS_MODE_MSB 9 -#define BB_TEST_CONTROLS_CARDBUS_MODE_LSB 8 -#define BB_TEST_CONTROLS_CARDBUS_MODE_MASK 0x00000300 -#define BB_TEST_CONTROLS_CARDBUS_MODE_GET(x) (((x) & 0x00000300) >> 8) -#define BB_TEST_CONTROLS_CARDBUS_MODE_SET(x) (((x) << 8) & 0x00000300) -#define BB_TEST_CONTROLS_CLKOUT_IS_CLK32_MSB 10 -#define BB_TEST_CONTROLS_CLKOUT_IS_CLK32_LSB 10 -#define BB_TEST_CONTROLS_CLKOUT_IS_CLK32_MASK 0x00000400 -#define BB_TEST_CONTROLS_CLKOUT_IS_CLK32_GET(x) (((x) & 0x00000400) >> 10) -#define BB_TEST_CONTROLS_CLKOUT_IS_CLK32_SET(x) (((x) << 10) & 0x00000400) -#define BB_TEST_CONTROLS_ENABLE_RFSILENT_BB_MSB 13 -#define BB_TEST_CONTROLS_ENABLE_RFSILENT_BB_LSB 13 -#define BB_TEST_CONTROLS_ENABLE_RFSILENT_BB_MASK 0x00002000 -#define BB_TEST_CONTROLS_ENABLE_RFSILENT_BB_GET(x) (((x) & 0x00002000) >> 13) -#define BB_TEST_CONTROLS_ENABLE_RFSILENT_BB_SET(x) (((x) << 13) & 0x00002000) -#define BB_TEST_CONTROLS_ENABLE_MINI_OBS_MSB 15 -#define BB_TEST_CONTROLS_ENABLE_MINI_OBS_LSB 15 -#define BB_TEST_CONTROLS_ENABLE_MINI_OBS_MASK 0x00008000 -#define BB_TEST_CONTROLS_ENABLE_MINI_OBS_GET(x) (((x) & 0x00008000) >> 15) -#define BB_TEST_CONTROLS_ENABLE_MINI_OBS_SET(x) (((x) << 15) & 0x00008000) -#define BB_TEST_CONTROLS_SLOW_CLK160_MSB 17 -#define BB_TEST_CONTROLS_SLOW_CLK160_LSB 17 -#define BB_TEST_CONTROLS_SLOW_CLK160_MASK 0x00020000 -#define BB_TEST_CONTROLS_SLOW_CLK160_GET(x) (((x) & 0x00020000) >> 17) -#define BB_TEST_CONTROLS_SLOW_CLK160_SET(x) (((x) << 17) & 0x00020000) -#define BB_TEST_CONTROLS_AGC_OBS_SEL_3_MSB 18 -#define BB_TEST_CONTROLS_AGC_OBS_SEL_3_LSB 18 -#define BB_TEST_CONTROLS_AGC_OBS_SEL_3_MASK 0x00040000 -#define BB_TEST_CONTROLS_AGC_OBS_SEL_3_GET(x) (((x) & 0x00040000) >> 18) -#define BB_TEST_CONTROLS_AGC_OBS_SEL_3_SET(x) (((x) << 18) & 0x00040000) -#define BB_TEST_CONTROLS_CF_BBB_OBS_SEL_MSB 22 -#define BB_TEST_CONTROLS_CF_BBB_OBS_SEL_LSB 19 -#define BB_TEST_CONTROLS_CF_BBB_OBS_SEL_MASK 0x00780000 -#define BB_TEST_CONTROLS_CF_BBB_OBS_SEL_GET(x) (((x) & 0x00780000) >> 19) -#define BB_TEST_CONTROLS_CF_BBB_OBS_SEL_SET(x) (((x) << 19) & 0x00780000) -#define BB_TEST_CONTROLS_RX_OBS_SEL_5TH_BIT_MSB 23 -#define BB_TEST_CONTROLS_RX_OBS_SEL_5TH_BIT_LSB 23 -#define BB_TEST_CONTROLS_RX_OBS_SEL_5TH_BIT_MASK 0x00800000 -#define BB_TEST_CONTROLS_RX_OBS_SEL_5TH_BIT_GET(x) (((x) & 0x00800000) >> 23) -#define BB_TEST_CONTROLS_RX_OBS_SEL_5TH_BIT_SET(x) (((x) << 23) & 0x00800000) -#define BB_TEST_CONTROLS_AGC_OBS_SEL_4_MSB 24 -#define BB_TEST_CONTROLS_AGC_OBS_SEL_4_LSB 24 -#define BB_TEST_CONTROLS_AGC_OBS_SEL_4_MASK 0x01000000 -#define BB_TEST_CONTROLS_AGC_OBS_SEL_4_GET(x) (((x) & 0x01000000) >> 24) -#define BB_TEST_CONTROLS_AGC_OBS_SEL_4_SET(x) (((x) << 24) & 0x01000000) -#define BB_TEST_CONTROLS_FORCE_AGC_CLEAR_MSB 28 -#define BB_TEST_CONTROLS_FORCE_AGC_CLEAR_LSB 28 -#define BB_TEST_CONTROLS_FORCE_AGC_CLEAR_MASK 0x10000000 -#define BB_TEST_CONTROLS_FORCE_AGC_CLEAR_GET(x) (((x) & 0x10000000) >> 28) -#define BB_TEST_CONTROLS_FORCE_AGC_CLEAR_SET(x) (((x) << 28) & 0x10000000) -#define BB_TEST_CONTROLS_TSTDAC_OUT_SEL_MSB 31 -#define BB_TEST_CONTROLS_TSTDAC_OUT_SEL_LSB 30 -#define BB_TEST_CONTROLS_TSTDAC_OUT_SEL_MASK 0xc0000000 -#define BB_TEST_CONTROLS_TSTDAC_OUT_SEL_GET(x) (((x) & 0xc0000000) >> 30) -#define BB_TEST_CONTROLS_TSTDAC_OUT_SEL_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for bb_sm_reg_map.BB_test_controls_status */ -#define BB_TEST_CONTROLS_STATUS_ADDRESS 0x00000164 -#define BB_TEST_CONTROLS_STATUS_OFFSET 0x00000164 -#define BB_TEST_CONTROLS_STATUS_CF_TSTDAC_EN_MSB 0 -#define BB_TEST_CONTROLS_STATUS_CF_TSTDAC_EN_LSB 0 -#define BB_TEST_CONTROLS_STATUS_CF_TSTDAC_EN_MASK 0x00000001 -#define BB_TEST_CONTROLS_STATUS_CF_TSTDAC_EN_GET(x) (((x) & 0x00000001) >> 0) -#define BB_TEST_CONTROLS_STATUS_CF_TSTDAC_EN_SET(x) (((x) << 0) & 0x00000001) -#define BB_TEST_CONTROLS_STATUS_CF_TX_SRC_IS_TSTDAC_MSB 1 -#define BB_TEST_CONTROLS_STATUS_CF_TX_SRC_IS_TSTDAC_LSB 1 -#define BB_TEST_CONTROLS_STATUS_CF_TX_SRC_IS_TSTDAC_MASK 0x00000002 -#define BB_TEST_CONTROLS_STATUS_CF_TX_SRC_IS_TSTDAC_GET(x) (((x) & 0x00000002) >> 1) -#define BB_TEST_CONTROLS_STATUS_CF_TX_SRC_IS_TSTDAC_SET(x) (((x) << 1) & 0x00000002) -#define BB_TEST_CONTROLS_STATUS_CF_TX_OBS_SEL_MSB 4 -#define BB_TEST_CONTROLS_STATUS_CF_TX_OBS_SEL_LSB 2 -#define BB_TEST_CONTROLS_STATUS_CF_TX_OBS_SEL_MASK 0x0000001c -#define BB_TEST_CONTROLS_STATUS_CF_TX_OBS_SEL_GET(x) (((x) & 0x0000001c) >> 2) -#define BB_TEST_CONTROLS_STATUS_CF_TX_OBS_SEL_SET(x) (((x) << 2) & 0x0000001c) -#define BB_TEST_CONTROLS_STATUS_CF_TX_OBS_MUX_SEL_MSB 6 -#define BB_TEST_CONTROLS_STATUS_CF_TX_OBS_MUX_SEL_LSB 5 -#define BB_TEST_CONTROLS_STATUS_CF_TX_OBS_MUX_SEL_MASK 0x00000060 -#define BB_TEST_CONTROLS_STATUS_CF_TX_OBS_MUX_SEL_GET(x) (((x) & 0x00000060) >> 5) -#define BB_TEST_CONTROLS_STATUS_CF_TX_OBS_MUX_SEL_SET(x) (((x) << 5) & 0x00000060) -#define BB_TEST_CONTROLS_STATUS_CF_TX_SRC_ALTERNATE_MSB 7 -#define BB_TEST_CONTROLS_STATUS_CF_TX_SRC_ALTERNATE_LSB 7 -#define BB_TEST_CONTROLS_STATUS_CF_TX_SRC_ALTERNATE_MASK 0x00000080 -#define BB_TEST_CONTROLS_STATUS_CF_TX_SRC_ALTERNATE_GET(x) (((x) & 0x00000080) >> 7) -#define BB_TEST_CONTROLS_STATUS_CF_TX_SRC_ALTERNATE_SET(x) (((x) << 7) & 0x00000080) -#define BB_TEST_CONTROLS_STATUS_CF_TSTADC_EN_MSB 8 -#define BB_TEST_CONTROLS_STATUS_CF_TSTADC_EN_LSB 8 -#define BB_TEST_CONTROLS_STATUS_CF_TSTADC_EN_MASK 0x00000100 -#define BB_TEST_CONTROLS_STATUS_CF_TSTADC_EN_GET(x) (((x) & 0x00000100) >> 8) -#define BB_TEST_CONTROLS_STATUS_CF_TSTADC_EN_SET(x) (((x) << 8) & 0x00000100) -#define BB_TEST_CONTROLS_STATUS_CF_RX_SRC_IS_TSTADC_MSB 9 -#define BB_TEST_CONTROLS_STATUS_CF_RX_SRC_IS_TSTADC_LSB 9 -#define BB_TEST_CONTROLS_STATUS_CF_RX_SRC_IS_TSTADC_MASK 0x00000200 -#define BB_TEST_CONTROLS_STATUS_CF_RX_SRC_IS_TSTADC_GET(x) (((x) & 0x00000200) >> 9) -#define BB_TEST_CONTROLS_STATUS_CF_RX_SRC_IS_TSTADC_SET(x) (((x) << 9) & 0x00000200) -#define BB_TEST_CONTROLS_STATUS_RX_OBS_SEL_MSB 13 -#define BB_TEST_CONTROLS_STATUS_RX_OBS_SEL_LSB 10 -#define BB_TEST_CONTROLS_STATUS_RX_OBS_SEL_MASK 0x00003c00 -#define BB_TEST_CONTROLS_STATUS_RX_OBS_SEL_GET(x) (((x) & 0x00003c00) >> 10) -#define BB_TEST_CONTROLS_STATUS_RX_OBS_SEL_SET(x) (((x) << 10) & 0x00003c00) -#define BB_TEST_CONTROLS_STATUS_DISABLE_A2_WARM_RESET_MSB 14 -#define BB_TEST_CONTROLS_STATUS_DISABLE_A2_WARM_RESET_LSB 14 -#define BB_TEST_CONTROLS_STATUS_DISABLE_A2_WARM_RESET_MASK 0x00004000 -#define BB_TEST_CONTROLS_STATUS_DISABLE_A2_WARM_RESET_GET(x) (((x) & 0x00004000) >> 14) -#define BB_TEST_CONTROLS_STATUS_DISABLE_A2_WARM_RESET_SET(x) (((x) << 14) & 0x00004000) -#define BB_TEST_CONTROLS_STATUS_RESET_A2_MSB 15 -#define BB_TEST_CONTROLS_STATUS_RESET_A2_LSB 15 -#define BB_TEST_CONTROLS_STATUS_RESET_A2_MASK 0x00008000 -#define BB_TEST_CONTROLS_STATUS_RESET_A2_GET(x) (((x) & 0x00008000) >> 15) -#define BB_TEST_CONTROLS_STATUS_RESET_A2_SET(x) (((x) << 15) & 0x00008000) -#define BB_TEST_CONTROLS_STATUS_AGC_OBS_SEL_MSB 18 -#define BB_TEST_CONTROLS_STATUS_AGC_OBS_SEL_LSB 16 -#define BB_TEST_CONTROLS_STATUS_AGC_OBS_SEL_MASK 0x00070000 -#define BB_TEST_CONTROLS_STATUS_AGC_OBS_SEL_GET(x) (((x) & 0x00070000) >> 16) -#define BB_TEST_CONTROLS_STATUS_AGC_OBS_SEL_SET(x) (((x) << 16) & 0x00070000) -#define BB_TEST_CONTROLS_STATUS_CF_ENABLE_FFT_DUMP_MSB 19 -#define BB_TEST_CONTROLS_STATUS_CF_ENABLE_FFT_DUMP_LSB 19 -#define BB_TEST_CONTROLS_STATUS_CF_ENABLE_FFT_DUMP_MASK 0x00080000 -#define BB_TEST_CONTROLS_STATUS_CF_ENABLE_FFT_DUMP_GET(x) (((x) & 0x00080000) >> 19) -#define BB_TEST_CONTROLS_STATUS_CF_ENABLE_FFT_DUMP_SET(x) (((x) << 19) & 0x00080000) -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_IN_MSB 23 -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_IN_LSB 23 -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_IN_MASK 0x00800000 -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_IN_GET(x) (((x) & 0x00800000) >> 23) -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_IN_SET(x) (((x) << 23) & 0x00800000) -#define BB_TEST_CONTROLS_STATUS_DISABLE_AGC_TO_A2_MSB 27 -#define BB_TEST_CONTROLS_STATUS_DISABLE_AGC_TO_A2_LSB 27 -#define BB_TEST_CONTROLS_STATUS_DISABLE_AGC_TO_A2_MASK 0x08000000 -#define BB_TEST_CONTROLS_STATUS_DISABLE_AGC_TO_A2_GET(x) (((x) & 0x08000000) >> 27) -#define BB_TEST_CONTROLS_STATUS_DISABLE_AGC_TO_A2_SET(x) (((x) << 27) & 0x08000000) -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_EN_MSB 28 -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_EN_LSB 28 -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_EN_MASK 0x10000000 -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_EN_GET(x) (((x) & 0x10000000) >> 28) -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_EN_SET(x) (((x) << 28) & 0x10000000) -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_SEL_MSB 31 -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_SEL_LSB 29 -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_SEL_MASK 0xe0000000 -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_SEL_GET(x) (((x) & 0xe0000000) >> 29) -#define BB_TEST_CONTROLS_STATUS_CF_DEBUGPORT_SEL_SET(x) (((x) << 29) & 0xe0000000) - -/* macros for bb_sm_reg_map.BB_tstdac */ -#define BB_TSTDAC_ADDRESS 0x00000168 -#define BB_TSTDAC_OFFSET 0x00000168 -#define BB_TSTDAC_TSTDAC_OUT_Q_MSB 9 -#define BB_TSTDAC_TSTDAC_OUT_Q_LSB 0 -#define BB_TSTDAC_TSTDAC_OUT_Q_MASK 0x000003ff -#define BB_TSTDAC_TSTDAC_OUT_Q_GET(x) (((x) & 0x000003ff) >> 0) -#define BB_TSTDAC_TSTDAC_OUT_I_MSB 19 -#define BB_TSTDAC_TSTDAC_OUT_I_LSB 10 -#define BB_TSTDAC_TSTDAC_OUT_I_MASK 0x000ffc00 -#define BB_TSTDAC_TSTDAC_OUT_I_GET(x) (((x) & 0x000ffc00) >> 10) - -/* macros for bb_sm_reg_map.BB_channel_status */ -#define BB_CHANNEL_STATUS_ADDRESS 0x0000016c -#define BB_CHANNEL_STATUS_OFFSET 0x0000016c -#define BB_CHANNEL_STATUS_BT_ACTIVE_MSB 0 -#define BB_CHANNEL_STATUS_BT_ACTIVE_LSB 0 -#define BB_CHANNEL_STATUS_BT_ACTIVE_MASK 0x00000001 -#define BB_CHANNEL_STATUS_BT_ACTIVE_GET(x) (((x) & 0x00000001) >> 0) -#define BB_CHANNEL_STATUS_RX_CLEAR_RAW_MSB 1 -#define BB_CHANNEL_STATUS_RX_CLEAR_RAW_LSB 1 -#define BB_CHANNEL_STATUS_RX_CLEAR_RAW_MASK 0x00000002 -#define BB_CHANNEL_STATUS_RX_CLEAR_RAW_GET(x) (((x) & 0x00000002) >> 1) -#define BB_CHANNEL_STATUS_RX_CLEAR_MAC_MSB 2 -#define BB_CHANNEL_STATUS_RX_CLEAR_MAC_LSB 2 -#define BB_CHANNEL_STATUS_RX_CLEAR_MAC_MASK 0x00000004 -#define BB_CHANNEL_STATUS_RX_CLEAR_MAC_GET(x) (((x) & 0x00000004) >> 2) -#define BB_CHANNEL_STATUS_RX_CLEAR_PAD_MSB 3 -#define BB_CHANNEL_STATUS_RX_CLEAR_PAD_LSB 3 -#define BB_CHANNEL_STATUS_RX_CLEAR_PAD_MASK 0x00000008 -#define BB_CHANNEL_STATUS_RX_CLEAR_PAD_GET(x) (((x) & 0x00000008) >> 3) -#define BB_CHANNEL_STATUS_BB_SW_OUT_0_MSB 5 -#define BB_CHANNEL_STATUS_BB_SW_OUT_0_LSB 4 -#define BB_CHANNEL_STATUS_BB_SW_OUT_0_MASK 0x00000030 -#define BB_CHANNEL_STATUS_BB_SW_OUT_0_GET(x) (((x) & 0x00000030) >> 4) -#define BB_CHANNEL_STATUS_BB_SW_OUT_1_MSB 7 -#define BB_CHANNEL_STATUS_BB_SW_OUT_1_LSB 6 -#define BB_CHANNEL_STATUS_BB_SW_OUT_1_MASK 0x000000c0 -#define BB_CHANNEL_STATUS_BB_SW_OUT_1_GET(x) (((x) & 0x000000c0) >> 6) -#define BB_CHANNEL_STATUS_BB_SW_OUT_2_MSB 9 -#define BB_CHANNEL_STATUS_BB_SW_OUT_2_LSB 8 -#define BB_CHANNEL_STATUS_BB_SW_OUT_2_MASK 0x00000300 -#define BB_CHANNEL_STATUS_BB_SW_OUT_2_GET(x) (((x) & 0x00000300) >> 8) -#define BB_CHANNEL_STATUS_BB_SW_COM_OUT_MSB 13 -#define BB_CHANNEL_STATUS_BB_SW_COM_OUT_LSB 10 -#define BB_CHANNEL_STATUS_BB_SW_COM_OUT_MASK 0x00003c00 -#define BB_CHANNEL_STATUS_BB_SW_COM_OUT_GET(x) (((x) & 0x00003c00) >> 10) -#define BB_CHANNEL_STATUS_ANT_DIV_CFG_USED_MSB 16 -#define BB_CHANNEL_STATUS_ANT_DIV_CFG_USED_LSB 14 -#define BB_CHANNEL_STATUS_ANT_DIV_CFG_USED_MASK 0x0001c000 -#define BB_CHANNEL_STATUS_ANT_DIV_CFG_USED_GET(x) (((x) & 0x0001c000) >> 14) - -/* macros for bb_sm_reg_map.BB_chaninfo_ctrl */ -#define BB_CHANINFO_CTRL_ADDRESS 0x00000170 -#define BB_CHANINFO_CTRL_OFFSET 0x00000170 -#define BB_CHANINFO_CTRL_CAPTURE_CHAN_INFO_MSB 0 -#define BB_CHANINFO_CTRL_CAPTURE_CHAN_INFO_LSB 0 -#define BB_CHANINFO_CTRL_CAPTURE_CHAN_INFO_MASK 0x00000001 -#define BB_CHANINFO_CTRL_CAPTURE_CHAN_INFO_GET(x) (((x) & 0x00000001) >> 0) -#define BB_CHANINFO_CTRL_CAPTURE_CHAN_INFO_SET(x) (((x) << 0) & 0x00000001) -#define BB_CHANINFO_CTRL_DISABLE_CHANINFOMEM_MSB 1 -#define BB_CHANINFO_CTRL_DISABLE_CHANINFOMEM_LSB 1 -#define BB_CHANINFO_CTRL_DISABLE_CHANINFOMEM_MASK 0x00000002 -#define BB_CHANINFO_CTRL_DISABLE_CHANINFOMEM_GET(x) (((x) & 0x00000002) >> 1) -#define BB_CHANINFO_CTRL_DISABLE_CHANINFOMEM_SET(x) (((x) << 1) & 0x00000002) -#define BB_CHANINFO_CTRL_CAPTURE_SOUNDING_PACKET_MSB 2 -#define BB_CHANINFO_CTRL_CAPTURE_SOUNDING_PACKET_LSB 2 -#define BB_CHANINFO_CTRL_CAPTURE_SOUNDING_PACKET_MASK 0x00000004 -#define BB_CHANINFO_CTRL_CAPTURE_SOUNDING_PACKET_GET(x) (((x) & 0x00000004) >> 2) -#define BB_CHANINFO_CTRL_CAPTURE_SOUNDING_PACKET_SET(x) (((x) << 2) & 0x00000004) -#define BB_CHANINFO_CTRL_CHANINFOMEM_S2_READ_MSB 3 -#define BB_CHANINFO_CTRL_CHANINFOMEM_S2_READ_LSB 3 -#define BB_CHANINFO_CTRL_CHANINFOMEM_S2_READ_MASK 0x00000008 -#define BB_CHANINFO_CTRL_CHANINFOMEM_S2_READ_GET(x) (((x) & 0x00000008) >> 3) -#define BB_CHANINFO_CTRL_CHANINFOMEM_S2_READ_SET(x) (((x) << 3) & 0x00000008) - -/* macros for bb_sm_reg_map.BB_chan_info_noise_pwr */ -#define BB_CHAN_INFO_NOISE_PWR_ADDRESS 0x00000174 -#define BB_CHAN_INFO_NOISE_PWR_OFFSET 0x00000174 -#define BB_CHAN_INFO_NOISE_PWR_NOISE_POWER_MSB 11 -#define BB_CHAN_INFO_NOISE_PWR_NOISE_POWER_LSB 0 -#define BB_CHAN_INFO_NOISE_PWR_NOISE_POWER_MASK 0x00000fff -#define BB_CHAN_INFO_NOISE_PWR_NOISE_POWER_GET(x) (((x) & 0x00000fff) >> 0) - -/* macros for bb_sm_reg_map.BB_chan_info_gain_diff */ -#define BB_CHAN_INFO_GAIN_DIFF_ADDRESS 0x00000178 -#define BB_CHAN_INFO_GAIN_DIFF_OFFSET 0x00000178 -#define BB_CHAN_INFO_GAIN_DIFF_FINE_PPM_MSB 11 -#define BB_CHAN_INFO_GAIN_DIFF_FINE_PPM_LSB 0 -#define BB_CHAN_INFO_GAIN_DIFF_FINE_PPM_MASK 0x00000fff -#define BB_CHAN_INFO_GAIN_DIFF_FINE_PPM_GET(x) (((x) & 0x00000fff) >> 0) -#define BB_CHAN_INFO_GAIN_DIFF_ANALOG_GAIN_DIFF_01_MSB 18 -#define BB_CHAN_INFO_GAIN_DIFF_ANALOG_GAIN_DIFF_01_LSB 12 -#define BB_CHAN_INFO_GAIN_DIFF_ANALOG_GAIN_DIFF_01_MASK 0x0007f000 -#define BB_CHAN_INFO_GAIN_DIFF_ANALOG_GAIN_DIFF_01_GET(x) (((x) & 0x0007f000) >> 12) - -/* macros for bb_sm_reg_map.BB_chan_info_fine_timing */ -#define BB_CHAN_INFO_FINE_TIMING_ADDRESS 0x0000017c -#define BB_CHAN_INFO_FINE_TIMING_OFFSET 0x0000017c -#define BB_CHAN_INFO_FINE_TIMING_COARSE_PPM_MSB 11 -#define BB_CHAN_INFO_FINE_TIMING_COARSE_PPM_LSB 0 -#define BB_CHAN_INFO_FINE_TIMING_COARSE_PPM_MASK 0x00000fff -#define BB_CHAN_INFO_FINE_TIMING_COARSE_PPM_GET(x) (((x) & 0x00000fff) >> 0) -#define BB_CHAN_INFO_FINE_TIMING_FINE_TIMING_MSB 21 -#define BB_CHAN_INFO_FINE_TIMING_FINE_TIMING_LSB 12 -#define BB_CHAN_INFO_FINE_TIMING_FINE_TIMING_MASK 0x003ff000 -#define BB_CHAN_INFO_FINE_TIMING_FINE_TIMING_GET(x) (((x) & 0x003ff000) >> 12) - -/* macros for bb_sm_reg_map.BB_chan_info_gain_b0 */ -#define BB_CHAN_INFO_GAIN_B0_ADDRESS 0x00000180 -#define BB_CHAN_INFO_GAIN_B0_OFFSET 0x00000180 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RSSI_0_MSB 7 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RSSI_0_LSB 0 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RSSI_0_MASK 0x000000ff -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RSSI_0_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RF_GAIN_0_MSB 15 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RF_GAIN_0_LSB 8 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RF_GAIN_0_MASK 0x0000ff00 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_RF_GAIN_0_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_MB_GAIN_0_MSB 22 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_MB_GAIN_0_LSB 16 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_MB_GAIN_0_MASK 0x007f0000 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_MB_GAIN_0_GET(x) (((x) & 0x007f0000) >> 16) -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN1_SW_0_MSB 23 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN1_SW_0_LSB 23 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN1_SW_0_MASK 0x00800000 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN1_SW_0_GET(x) (((x) & 0x00800000) >> 23) -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN2_SW_0_MSB 24 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN2_SW_0_LSB 24 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN2_SW_0_MASK 0x01000000 -#define BB_CHAN_INFO_GAIN_B0_CHAN_INFO_XATTEN2_SW_0_GET(x) (((x) & 0x01000000) >> 24) - -/* macros for bb_sm_reg_map.BB_sm_hist */ -#define BB_SM_HIST_ADDRESS 0x00000184 -#define BB_SM_HIST_OFFSET 0x00000184 -#define BB_SM_HIST_SM_REC_EN_MSB 0 -#define BB_SM_HIST_SM_REC_EN_LSB 0 -#define BB_SM_HIST_SM_REC_EN_MASK 0x00000001 -#define BB_SM_HIST_SM_REC_EN_GET(x) (((x) & 0x00000001) >> 0) -#define BB_SM_HIST_SM_REC_EN_SET(x) (((x) << 0) & 0x00000001) -#define BB_SM_HIST_SM_REC_MODE_MSB 1 -#define BB_SM_HIST_SM_REC_MODE_LSB 1 -#define BB_SM_HIST_SM_REC_MODE_MASK 0x00000002 -#define BB_SM_HIST_SM_REC_MODE_GET(x) (((x) & 0x00000002) >> 1) -#define BB_SM_HIST_SM_REC_MODE_SET(x) (((x) << 1) & 0x00000002) -#define BB_SM_HIST_SM_REC_TIME_RES_MSB 3 -#define BB_SM_HIST_SM_REC_TIME_RES_LSB 2 -#define BB_SM_HIST_SM_REC_TIME_RES_MASK 0x0000000c -#define BB_SM_HIST_SM_REC_TIME_RES_GET(x) (((x) & 0x0000000c) >> 2) -#define BB_SM_HIST_SM_REC_TIME_RES_SET(x) (((x) << 2) & 0x0000000c) -#define BB_SM_HIST_SM_REC_PART_EN_MSB 11 -#define BB_SM_HIST_SM_REC_PART_EN_LSB 4 -#define BB_SM_HIST_SM_REC_PART_EN_MASK 0x00000ff0 -#define BB_SM_HIST_SM_REC_PART_EN_GET(x) (((x) & 0x00000ff0) >> 4) -#define BB_SM_HIST_SM_REC_PART_EN_SET(x) (((x) << 4) & 0x00000ff0) -#define BB_SM_HIST_SM_REC_CHN_EN_MSB 14 -#define BB_SM_HIST_SM_REC_CHN_EN_LSB 12 -#define BB_SM_HIST_SM_REC_CHN_EN_MASK 0x00007000 -#define BB_SM_HIST_SM_REC_CHN_EN_GET(x) (((x) & 0x00007000) >> 12) -#define BB_SM_HIST_SM_REC_CHN_EN_SET(x) (((x) << 12) & 0x00007000) -#define BB_SM_HIST_SM_REC_DATA_NUM_MSB 18 -#define BB_SM_HIST_SM_REC_DATA_NUM_LSB 15 -#define BB_SM_HIST_SM_REC_DATA_NUM_MASK 0x00078000 -#define BB_SM_HIST_SM_REC_DATA_NUM_GET(x) (((x) & 0x00078000) >> 15) -#define BB_SM_HIST_SM_REC_DATA_NUM_SET(x) (((x) << 15) & 0x00078000) -#define BB_SM_HIST_SM_REC_AGC_SEL_MSB 19 -#define BB_SM_HIST_SM_REC_AGC_SEL_LSB 19 -#define BB_SM_HIST_SM_REC_AGC_SEL_MASK 0x00080000 -#define BB_SM_HIST_SM_REC_AGC_SEL_GET(x) (((x) & 0x00080000) >> 19) -#define BB_SM_HIST_SM_REC_AGC_SEL_SET(x) (((x) << 19) & 0x00080000) -#define BB_SM_HIST_SM_REC_MAC_TRIG_MSB 22 -#define BB_SM_HIST_SM_REC_MAC_TRIG_LSB 20 -#define BB_SM_HIST_SM_REC_MAC_TRIG_MASK 0x00700000 -#define BB_SM_HIST_SM_REC_MAC_TRIG_GET(x) (((x) & 0x00700000) >> 20) -#define BB_SM_HIST_SM_REC_MAC_TRIG_SET(x) (((x) << 20) & 0x00700000) -#define BB_SM_HIST_SM_REC_LAST_ADDR_MSB 29 -#define BB_SM_HIST_SM_REC_LAST_ADDR_LSB 24 -#define BB_SM_HIST_SM_REC_LAST_ADDR_MASK 0x3f000000 -#define BB_SM_HIST_SM_REC_LAST_ADDR_GET(x) (((x) & 0x3f000000) >> 24) - -/* macros for bb_sm_reg_map.BB_scrambler_seed */ -#define BB_SCRAMBLER_SEED_ADDRESS 0x00000190 -#define BB_SCRAMBLER_SEED_OFFSET 0x00000190 -#define BB_SCRAMBLER_SEED_FIXED_SCRAMBLER_SEED_MSB 6 -#define BB_SCRAMBLER_SEED_FIXED_SCRAMBLER_SEED_LSB 0 -#define BB_SCRAMBLER_SEED_FIXED_SCRAMBLER_SEED_MASK 0x0000007f -#define BB_SCRAMBLER_SEED_FIXED_SCRAMBLER_SEED_GET(x) (((x) & 0x0000007f) >> 0) -#define BB_SCRAMBLER_SEED_FIXED_SCRAMBLER_SEED_SET(x) (((x) << 0) & 0x0000007f) - -/* macros for bb_sm_reg_map.BB_bbb_tx_ctrl */ -#define BB_BBB_TX_CTRL_ADDRESS 0x00000194 -#define BB_BBB_TX_CTRL_OFFSET 0x00000194 -#define BB_BBB_TX_CTRL_DISABLE_SCRAMBLER_MSB 0 -#define BB_BBB_TX_CTRL_DISABLE_SCRAMBLER_LSB 0 -#define BB_BBB_TX_CTRL_DISABLE_SCRAMBLER_MASK 0x00000001 -#define BB_BBB_TX_CTRL_DISABLE_SCRAMBLER_GET(x) (((x) & 0x00000001) >> 0) -#define BB_BBB_TX_CTRL_DISABLE_SCRAMBLER_SET(x) (((x) << 0) & 0x00000001) -#define BB_BBB_TX_CTRL_USE_SCRAMBLER_SEED_MSB 1 -#define BB_BBB_TX_CTRL_USE_SCRAMBLER_SEED_LSB 1 -#define BB_BBB_TX_CTRL_USE_SCRAMBLER_SEED_MASK 0x00000002 -#define BB_BBB_TX_CTRL_USE_SCRAMBLER_SEED_GET(x) (((x) & 0x00000002) >> 1) -#define BB_BBB_TX_CTRL_USE_SCRAMBLER_SEED_SET(x) (((x) << 1) & 0x00000002) -#define BB_BBB_TX_CTRL_TX_DAC_SCALE_CCK_MSB 3 -#define BB_BBB_TX_CTRL_TX_DAC_SCALE_CCK_LSB 2 -#define BB_BBB_TX_CTRL_TX_DAC_SCALE_CCK_MASK 0x0000000c -#define BB_BBB_TX_CTRL_TX_DAC_SCALE_CCK_GET(x) (((x) & 0x0000000c) >> 2) -#define BB_BBB_TX_CTRL_TX_DAC_SCALE_CCK_SET(x) (((x) << 2) & 0x0000000c) -#define BB_BBB_TX_CTRL_TXFIR_JAPAN_CCK_MSB 4 -#define BB_BBB_TX_CTRL_TXFIR_JAPAN_CCK_LSB 4 -#define BB_BBB_TX_CTRL_TXFIR_JAPAN_CCK_MASK 0x00000010 -#define BB_BBB_TX_CTRL_TXFIR_JAPAN_CCK_GET(x) (((x) & 0x00000010) >> 4) -#define BB_BBB_TX_CTRL_TXFIR_JAPAN_CCK_SET(x) (((x) << 4) & 0x00000010) -#define BB_BBB_TX_CTRL_ALLOW_1MBPS_SHORT_MSB 5 -#define BB_BBB_TX_CTRL_ALLOW_1MBPS_SHORT_LSB 5 -#define BB_BBB_TX_CTRL_ALLOW_1MBPS_SHORT_MASK 0x00000020 -#define BB_BBB_TX_CTRL_ALLOW_1MBPS_SHORT_GET(x) (((x) & 0x00000020) >> 5) -#define BB_BBB_TX_CTRL_ALLOW_1MBPS_SHORT_SET(x) (((x) << 5) & 0x00000020) -#define BB_BBB_TX_CTRL_TX_CCK_DELAY_1_MSB 8 -#define BB_BBB_TX_CTRL_TX_CCK_DELAY_1_LSB 6 -#define BB_BBB_TX_CTRL_TX_CCK_DELAY_1_MASK 0x000001c0 -#define BB_BBB_TX_CTRL_TX_CCK_DELAY_1_GET(x) (((x) & 0x000001c0) >> 6) -#define BB_BBB_TX_CTRL_TX_CCK_DELAY_1_SET(x) (((x) << 6) & 0x000001c0) -#define BB_BBB_TX_CTRL_TX_CCK_DELAY_2_MSB 11 -#define BB_BBB_TX_CTRL_TX_CCK_DELAY_2_LSB 9 -#define BB_BBB_TX_CTRL_TX_CCK_DELAY_2_MASK 0x00000e00 -#define BB_BBB_TX_CTRL_TX_CCK_DELAY_2_GET(x) (((x) & 0x00000e00) >> 9) -#define BB_BBB_TX_CTRL_TX_CCK_DELAY_2_SET(x) (((x) << 9) & 0x00000e00) - -/* macros for bb_sm_reg_map.BB_bbb_txfir_0 */ -#define BB_BBB_TXFIR_0_ADDRESS 0x00000198 -#define BB_BBB_TXFIR_0_OFFSET 0x00000198 -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H0_MSB 3 -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H0_LSB 0 -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H0_MASK 0x0000000f -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H0_GET(x) (((x) & 0x0000000f) >> 0) -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H0_SET(x) (((x) << 0) & 0x0000000f) -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H1_MSB 11 -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H1_LSB 8 -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H1_MASK 0x00000f00 -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H1_GET(x) (((x) & 0x00000f00) >> 8) -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H1_SET(x) (((x) << 8) & 0x00000f00) -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H2_MSB 20 -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H2_LSB 16 -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H2_MASK 0x001f0000 -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H2_GET(x) (((x) & 0x001f0000) >> 16) -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H2_SET(x) (((x) << 16) & 0x001f0000) -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H3_MSB 28 -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H3_LSB 24 -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H3_MASK 0x1f000000 -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H3_GET(x) (((x) & 0x1f000000) >> 24) -#define BB_BBB_TXFIR_0_TXFIR_COEFF_H3_SET(x) (((x) << 24) & 0x1f000000) - -/* macros for bb_sm_reg_map.BB_bbb_txfir_1 */ -#define BB_BBB_TXFIR_1_ADDRESS 0x0000019c -#define BB_BBB_TXFIR_1_OFFSET 0x0000019c -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H4_MSB 5 -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H4_LSB 0 -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H4_MASK 0x0000003f -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H4_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H4_SET(x) (((x) << 0) & 0x0000003f) -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H5_MSB 13 -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H5_LSB 8 -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H5_MASK 0x00003f00 -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H5_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H5_SET(x) (((x) << 8) & 0x00003f00) -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H6_MSB 22 -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H6_LSB 16 -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H6_MASK 0x007f0000 -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H6_GET(x) (((x) & 0x007f0000) >> 16) -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H6_SET(x) (((x) << 16) & 0x007f0000) -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H7_MSB 30 -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H7_LSB 24 -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H7_MASK 0x7f000000 -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H7_GET(x) (((x) & 0x7f000000) >> 24) -#define BB_BBB_TXFIR_1_TXFIR_COEFF_H7_SET(x) (((x) << 24) & 0x7f000000) - -/* macros for bb_sm_reg_map.BB_bbb_txfir_2 */ -#define BB_BBB_TXFIR_2_ADDRESS 0x000001a0 -#define BB_BBB_TXFIR_2_OFFSET 0x000001a0 -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H8_MSB 7 -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H8_LSB 0 -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H8_MASK 0x000000ff -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H8_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H8_SET(x) (((x) << 0) & 0x000000ff) -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H9_MSB 15 -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H9_LSB 8 -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H9_MASK 0x0000ff00 -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H9_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H9_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H10_MSB 23 -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H10_LSB 16 -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H10_MASK 0x00ff0000 -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H10_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H10_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H11_MSB 31 -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H11_LSB 24 -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H11_MASK 0xff000000 -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H11_GET(x) (((x) & 0xff000000) >> 24) -#define BB_BBB_TXFIR_2_TXFIR_COEFF_H11_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_sm_reg_map.BB_heavy_clip_ctrl */ -#define BB_HEAVY_CLIP_CTRL_ADDRESS 0x000001a4 -#define BB_HEAVY_CLIP_CTRL_OFFSET 0x000001a4 -#define BB_HEAVY_CLIP_CTRL_CF_HEAVY_CLIP_ENABLE_MSB 8 -#define BB_HEAVY_CLIP_CTRL_CF_HEAVY_CLIP_ENABLE_LSB 0 -#define BB_HEAVY_CLIP_CTRL_CF_HEAVY_CLIP_ENABLE_MASK 0x000001ff -#define BB_HEAVY_CLIP_CTRL_CF_HEAVY_CLIP_ENABLE_GET(x) (((x) & 0x000001ff) >> 0) -#define BB_HEAVY_CLIP_CTRL_CF_HEAVY_CLIP_ENABLE_SET(x) (((x) << 0) & 0x000001ff) -#define BB_HEAVY_CLIP_CTRL_PRE_EMP_HT40_ENABLE_MSB 9 -#define BB_HEAVY_CLIP_CTRL_PRE_EMP_HT40_ENABLE_LSB 9 -#define BB_HEAVY_CLIP_CTRL_PRE_EMP_HT40_ENABLE_MASK 0x00000200 -#define BB_HEAVY_CLIP_CTRL_PRE_EMP_HT40_ENABLE_GET(x) (((x) & 0x00000200) >> 9) -#define BB_HEAVY_CLIP_CTRL_PRE_EMP_HT40_ENABLE_SET(x) (((x) << 9) & 0x00000200) -#define BB_HEAVY_CLIP_CTRL_HEAVY_CLIP_FACTOR_XR_MSB 17 -#define BB_HEAVY_CLIP_CTRL_HEAVY_CLIP_FACTOR_XR_LSB 10 -#define BB_HEAVY_CLIP_CTRL_HEAVY_CLIP_FACTOR_XR_MASK 0x0003fc00 -#define BB_HEAVY_CLIP_CTRL_HEAVY_CLIP_FACTOR_XR_GET(x) (((x) & 0x0003fc00) >> 10) -#define BB_HEAVY_CLIP_CTRL_HEAVY_CLIP_FACTOR_XR_SET(x) (((x) << 10) & 0x0003fc00) - -/* macros for bb_sm_reg_map.BB_heavy_clip_20 */ -#define BB_HEAVY_CLIP_20_ADDRESS 0x000001a8 -#define BB_HEAVY_CLIP_20_OFFSET 0x000001a8 -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_0_MSB 7 -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_0_LSB 0 -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_0_MASK 0x000000ff -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_0_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_0_SET(x) (((x) << 0) & 0x000000ff) -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_1_MSB 15 -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_1_LSB 8 -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_1_MASK 0x0000ff00 -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_1_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_1_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_2_MSB 23 -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_2_LSB 16 -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_2_MASK 0x00ff0000 -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_2_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_2_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_3_MSB 31 -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_3_LSB 24 -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_3_MASK 0xff000000 -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_3_GET(x) (((x) & 0xff000000) >> 24) -#define BB_HEAVY_CLIP_20_HEAVY_CLIP_FACTOR_3_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_sm_reg_map.BB_heavy_clip_40 */ -#define BB_HEAVY_CLIP_40_ADDRESS 0x000001ac -#define BB_HEAVY_CLIP_40_OFFSET 0x000001ac -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_4_MSB 7 -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_4_LSB 0 -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_4_MASK 0x000000ff -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_4_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_4_SET(x) (((x) << 0) & 0x000000ff) -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_5_MSB 15 -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_5_LSB 8 -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_5_MASK 0x0000ff00 -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_5_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_5_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_6_MSB 23 -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_6_LSB 16 -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_6_MASK 0x00ff0000 -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_6_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_6_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_7_MSB 31 -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_7_LSB 24 -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_7_MASK 0xff000000 -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_7_GET(x) (((x) & 0xff000000) >> 24) -#define BB_HEAVY_CLIP_40_HEAVY_CLIP_FACTOR_7_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_sm_reg_map.BB_illegal_tx_rate */ -#define BB_ILLEGAL_TX_RATE_ADDRESS 0x000001b0 -#define BB_ILLEGAL_TX_RATE_OFFSET 0x000001b0 -#define BB_ILLEGAL_TX_RATE_ILLEGAL_TX_RATE_MSB 0 -#define BB_ILLEGAL_TX_RATE_ILLEGAL_TX_RATE_LSB 0 -#define BB_ILLEGAL_TX_RATE_ILLEGAL_TX_RATE_MASK 0x00000001 -#define BB_ILLEGAL_TX_RATE_ILLEGAL_TX_RATE_GET(x) (((x) & 0x00000001) >> 0) - -/* macros for bb_sm_reg_map.BB_powertx_rate1 */ -#define BB_POWERTX_RATE1_ADDRESS 0x000001c0 -#define BB_POWERTX_RATE1_OFFSET 0x000001c0 -#define BB_POWERTX_RATE1_POWERTX_0_MSB 5 -#define BB_POWERTX_RATE1_POWERTX_0_LSB 0 -#define BB_POWERTX_RATE1_POWERTX_0_MASK 0x0000003f -#define BB_POWERTX_RATE1_POWERTX_0_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_POWERTX_RATE1_POWERTX_0_SET(x) (((x) << 0) & 0x0000003f) -#define BB_POWERTX_RATE1_POWERTX_1_MSB 13 -#define BB_POWERTX_RATE1_POWERTX_1_LSB 8 -#define BB_POWERTX_RATE1_POWERTX_1_MASK 0x00003f00 -#define BB_POWERTX_RATE1_POWERTX_1_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_POWERTX_RATE1_POWERTX_1_SET(x) (((x) << 8) & 0x00003f00) -#define BB_POWERTX_RATE1_POWERTX_2_MSB 21 -#define BB_POWERTX_RATE1_POWERTX_2_LSB 16 -#define BB_POWERTX_RATE1_POWERTX_2_MASK 0x003f0000 -#define BB_POWERTX_RATE1_POWERTX_2_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_POWERTX_RATE1_POWERTX_2_SET(x) (((x) << 16) & 0x003f0000) -#define BB_POWERTX_RATE1_POWERTX_3_MSB 29 -#define BB_POWERTX_RATE1_POWERTX_3_LSB 24 -#define BB_POWERTX_RATE1_POWERTX_3_MASK 0x3f000000 -#define BB_POWERTX_RATE1_POWERTX_3_GET(x) (((x) & 0x3f000000) >> 24) -#define BB_POWERTX_RATE1_POWERTX_3_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for bb_sm_reg_map.BB_powertx_rate2 */ -#define BB_POWERTX_RATE2_ADDRESS 0x000001c4 -#define BB_POWERTX_RATE2_OFFSET 0x000001c4 -#define BB_POWERTX_RATE2_POWERTX_4_MSB 5 -#define BB_POWERTX_RATE2_POWERTX_4_LSB 0 -#define BB_POWERTX_RATE2_POWERTX_4_MASK 0x0000003f -#define BB_POWERTX_RATE2_POWERTX_4_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_POWERTX_RATE2_POWERTX_4_SET(x) (((x) << 0) & 0x0000003f) -#define BB_POWERTX_RATE2_POWERTX_5_MSB 13 -#define BB_POWERTX_RATE2_POWERTX_5_LSB 8 -#define BB_POWERTX_RATE2_POWERTX_5_MASK 0x00003f00 -#define BB_POWERTX_RATE2_POWERTX_5_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_POWERTX_RATE2_POWERTX_5_SET(x) (((x) << 8) & 0x00003f00) -#define BB_POWERTX_RATE2_POWERTX_6_MSB 21 -#define BB_POWERTX_RATE2_POWERTX_6_LSB 16 -#define BB_POWERTX_RATE2_POWERTX_6_MASK 0x003f0000 -#define BB_POWERTX_RATE2_POWERTX_6_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_POWERTX_RATE2_POWERTX_6_SET(x) (((x) << 16) & 0x003f0000) -#define BB_POWERTX_RATE2_POWERTX_7_MSB 29 -#define BB_POWERTX_RATE2_POWERTX_7_LSB 24 -#define BB_POWERTX_RATE2_POWERTX_7_MASK 0x3f000000 -#define BB_POWERTX_RATE2_POWERTX_7_GET(x) (((x) & 0x3f000000) >> 24) -#define BB_POWERTX_RATE2_POWERTX_7_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for bb_sm_reg_map.BB_powertx_rate3 */ -#define BB_POWERTX_RATE3_ADDRESS 0x000001c8 -#define BB_POWERTX_RATE3_OFFSET 0x000001c8 -#define BB_POWERTX_RATE3_POWERTX_1L_MSB 5 -#define BB_POWERTX_RATE3_POWERTX_1L_LSB 0 -#define BB_POWERTX_RATE3_POWERTX_1L_MASK 0x0000003f -#define BB_POWERTX_RATE3_POWERTX_1L_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_POWERTX_RATE3_POWERTX_1L_SET(x) (((x) << 0) & 0x0000003f) -#define BB_POWERTX_RATE3_POWERTX_2L_MSB 21 -#define BB_POWERTX_RATE3_POWERTX_2L_LSB 16 -#define BB_POWERTX_RATE3_POWERTX_2L_MASK 0x003f0000 -#define BB_POWERTX_RATE3_POWERTX_2L_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_POWERTX_RATE3_POWERTX_2L_SET(x) (((x) << 16) & 0x003f0000) -#define BB_POWERTX_RATE3_POWERTX_2S_MSB 29 -#define BB_POWERTX_RATE3_POWERTX_2S_LSB 24 -#define BB_POWERTX_RATE3_POWERTX_2S_MASK 0x3f000000 -#define BB_POWERTX_RATE3_POWERTX_2S_GET(x) (((x) & 0x3f000000) >> 24) -#define BB_POWERTX_RATE3_POWERTX_2S_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for bb_sm_reg_map.BB_powertx_rate4 */ -#define BB_POWERTX_RATE4_ADDRESS 0x000001cc -#define BB_POWERTX_RATE4_OFFSET 0x000001cc -#define BB_POWERTX_RATE4_POWERTX_55L_MSB 5 -#define BB_POWERTX_RATE4_POWERTX_55L_LSB 0 -#define BB_POWERTX_RATE4_POWERTX_55L_MASK 0x0000003f -#define BB_POWERTX_RATE4_POWERTX_55L_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_POWERTX_RATE4_POWERTX_55L_SET(x) (((x) << 0) & 0x0000003f) -#define BB_POWERTX_RATE4_POWERTX_55S_MSB 13 -#define BB_POWERTX_RATE4_POWERTX_55S_LSB 8 -#define BB_POWERTX_RATE4_POWERTX_55S_MASK 0x00003f00 -#define BB_POWERTX_RATE4_POWERTX_55S_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_POWERTX_RATE4_POWERTX_55S_SET(x) (((x) << 8) & 0x00003f00) -#define BB_POWERTX_RATE4_POWERTX_11L_MSB 21 -#define BB_POWERTX_RATE4_POWERTX_11L_LSB 16 -#define BB_POWERTX_RATE4_POWERTX_11L_MASK 0x003f0000 -#define BB_POWERTX_RATE4_POWERTX_11L_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_POWERTX_RATE4_POWERTX_11L_SET(x) (((x) << 16) & 0x003f0000) -#define BB_POWERTX_RATE4_POWERTX_11S_MSB 29 -#define BB_POWERTX_RATE4_POWERTX_11S_LSB 24 -#define BB_POWERTX_RATE4_POWERTX_11S_MASK 0x3f000000 -#define BB_POWERTX_RATE4_POWERTX_11S_GET(x) (((x) & 0x3f000000) >> 24) -#define BB_POWERTX_RATE4_POWERTX_11S_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for bb_sm_reg_map.BB_powertx_rate5 */ -#define BB_POWERTX_RATE5_ADDRESS 0x000001d0 -#define BB_POWERTX_RATE5_OFFSET 0x000001d0 -#define BB_POWERTX_RATE5_POWERTXHT20_0_MSB 5 -#define BB_POWERTX_RATE5_POWERTXHT20_0_LSB 0 -#define BB_POWERTX_RATE5_POWERTXHT20_0_MASK 0x0000003f -#define BB_POWERTX_RATE5_POWERTXHT20_0_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_POWERTX_RATE5_POWERTXHT20_0_SET(x) (((x) << 0) & 0x0000003f) -#define BB_POWERTX_RATE5_POWERTXHT20_1_MSB 13 -#define BB_POWERTX_RATE5_POWERTXHT20_1_LSB 8 -#define BB_POWERTX_RATE5_POWERTXHT20_1_MASK 0x00003f00 -#define BB_POWERTX_RATE5_POWERTXHT20_1_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_POWERTX_RATE5_POWERTXHT20_1_SET(x) (((x) << 8) & 0x00003f00) -#define BB_POWERTX_RATE5_POWERTXHT20_2_MSB 21 -#define BB_POWERTX_RATE5_POWERTXHT20_2_LSB 16 -#define BB_POWERTX_RATE5_POWERTXHT20_2_MASK 0x003f0000 -#define BB_POWERTX_RATE5_POWERTXHT20_2_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_POWERTX_RATE5_POWERTXHT20_2_SET(x) (((x) << 16) & 0x003f0000) -#define BB_POWERTX_RATE5_POWERTXHT20_3_MSB 29 -#define BB_POWERTX_RATE5_POWERTXHT20_3_LSB 24 -#define BB_POWERTX_RATE5_POWERTXHT20_3_MASK 0x3f000000 -#define BB_POWERTX_RATE5_POWERTXHT20_3_GET(x) (((x) & 0x3f000000) >> 24) -#define BB_POWERTX_RATE5_POWERTXHT20_3_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for bb_sm_reg_map.BB_powertx_rate6 */ -#define BB_POWERTX_RATE6_ADDRESS 0x000001d4 -#define BB_POWERTX_RATE6_OFFSET 0x000001d4 -#define BB_POWERTX_RATE6_POWERTXHT20_4_MSB 5 -#define BB_POWERTX_RATE6_POWERTXHT20_4_LSB 0 -#define BB_POWERTX_RATE6_POWERTXHT20_4_MASK 0x0000003f -#define BB_POWERTX_RATE6_POWERTXHT20_4_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_POWERTX_RATE6_POWERTXHT20_4_SET(x) (((x) << 0) & 0x0000003f) -#define BB_POWERTX_RATE6_POWERTXHT20_5_MSB 13 -#define BB_POWERTX_RATE6_POWERTXHT20_5_LSB 8 -#define BB_POWERTX_RATE6_POWERTXHT20_5_MASK 0x00003f00 -#define BB_POWERTX_RATE6_POWERTXHT20_5_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_POWERTX_RATE6_POWERTXHT20_5_SET(x) (((x) << 8) & 0x00003f00) -#define BB_POWERTX_RATE6_POWERTXHT20_6_MSB 21 -#define BB_POWERTX_RATE6_POWERTXHT20_6_LSB 16 -#define BB_POWERTX_RATE6_POWERTXHT20_6_MASK 0x003f0000 -#define BB_POWERTX_RATE6_POWERTXHT20_6_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_POWERTX_RATE6_POWERTXHT20_6_SET(x) (((x) << 16) & 0x003f0000) -#define BB_POWERTX_RATE6_POWERTXHT20_7_MSB 29 -#define BB_POWERTX_RATE6_POWERTXHT20_7_LSB 24 -#define BB_POWERTX_RATE6_POWERTXHT20_7_MASK 0x3f000000 -#define BB_POWERTX_RATE6_POWERTXHT20_7_GET(x) (((x) & 0x3f000000) >> 24) -#define BB_POWERTX_RATE6_POWERTXHT20_7_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for bb_sm_reg_map.BB_powertx_rate7 */ -#define BB_POWERTX_RATE7_ADDRESS 0x000001d8 -#define BB_POWERTX_RATE7_OFFSET 0x000001d8 -#define BB_POWERTX_RATE7_POWERTXHT40_0_MSB 5 -#define BB_POWERTX_RATE7_POWERTXHT40_0_LSB 0 -#define BB_POWERTX_RATE7_POWERTXHT40_0_MASK 0x0000003f -#define BB_POWERTX_RATE7_POWERTXHT40_0_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_POWERTX_RATE7_POWERTXHT40_0_SET(x) (((x) << 0) & 0x0000003f) -#define BB_POWERTX_RATE7_POWERTXHT40_1_MSB 13 -#define BB_POWERTX_RATE7_POWERTXHT40_1_LSB 8 -#define BB_POWERTX_RATE7_POWERTXHT40_1_MASK 0x00003f00 -#define BB_POWERTX_RATE7_POWERTXHT40_1_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_POWERTX_RATE7_POWERTXHT40_1_SET(x) (((x) << 8) & 0x00003f00) -#define BB_POWERTX_RATE7_POWERTXHT40_2_MSB 21 -#define BB_POWERTX_RATE7_POWERTXHT40_2_LSB 16 -#define BB_POWERTX_RATE7_POWERTXHT40_2_MASK 0x003f0000 -#define BB_POWERTX_RATE7_POWERTXHT40_2_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_POWERTX_RATE7_POWERTXHT40_2_SET(x) (((x) << 16) & 0x003f0000) -#define BB_POWERTX_RATE7_POWERTXHT40_3_MSB 29 -#define BB_POWERTX_RATE7_POWERTXHT40_3_LSB 24 -#define BB_POWERTX_RATE7_POWERTXHT40_3_MASK 0x3f000000 -#define BB_POWERTX_RATE7_POWERTXHT40_3_GET(x) (((x) & 0x3f000000) >> 24) -#define BB_POWERTX_RATE7_POWERTXHT40_3_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for bb_sm_reg_map.BB_powertx_rate8 */ -#define BB_POWERTX_RATE8_ADDRESS 0x000001dc -#define BB_POWERTX_RATE8_OFFSET 0x000001dc -#define BB_POWERTX_RATE8_POWERTXHT40_4_MSB 5 -#define BB_POWERTX_RATE8_POWERTXHT40_4_LSB 0 -#define BB_POWERTX_RATE8_POWERTXHT40_4_MASK 0x0000003f -#define BB_POWERTX_RATE8_POWERTXHT40_4_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_POWERTX_RATE8_POWERTXHT40_4_SET(x) (((x) << 0) & 0x0000003f) -#define BB_POWERTX_RATE8_POWERTXHT40_5_MSB 13 -#define BB_POWERTX_RATE8_POWERTXHT40_5_LSB 8 -#define BB_POWERTX_RATE8_POWERTXHT40_5_MASK 0x00003f00 -#define BB_POWERTX_RATE8_POWERTXHT40_5_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_POWERTX_RATE8_POWERTXHT40_5_SET(x) (((x) << 8) & 0x00003f00) -#define BB_POWERTX_RATE8_POWERTXHT40_6_MSB 21 -#define BB_POWERTX_RATE8_POWERTXHT40_6_LSB 16 -#define BB_POWERTX_RATE8_POWERTXHT40_6_MASK 0x003f0000 -#define BB_POWERTX_RATE8_POWERTXHT40_6_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_POWERTX_RATE8_POWERTXHT40_6_SET(x) (((x) << 16) & 0x003f0000) -#define BB_POWERTX_RATE8_POWERTXHT40_7_MSB 29 -#define BB_POWERTX_RATE8_POWERTXHT40_7_LSB 24 -#define BB_POWERTX_RATE8_POWERTXHT40_7_MASK 0x3f000000 -#define BB_POWERTX_RATE8_POWERTXHT40_7_GET(x) (((x) & 0x3f000000) >> 24) -#define BB_POWERTX_RATE8_POWERTXHT40_7_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for bb_sm_reg_map.BB_powertx_rate9 */ -#define BB_POWERTX_RATE9_ADDRESS 0x000001e0 -#define BB_POWERTX_RATE9_OFFSET 0x000001e0 -#define BB_POWERTX_RATE9_POWERTX_DUP40_CCK_MSB 5 -#define BB_POWERTX_RATE9_POWERTX_DUP40_CCK_LSB 0 -#define BB_POWERTX_RATE9_POWERTX_DUP40_CCK_MASK 0x0000003f -#define BB_POWERTX_RATE9_POWERTX_DUP40_CCK_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_POWERTX_RATE9_POWERTX_DUP40_CCK_SET(x) (((x) << 0) & 0x0000003f) -#define BB_POWERTX_RATE9_POWERTX_DUP40_OFDM_MSB 13 -#define BB_POWERTX_RATE9_POWERTX_DUP40_OFDM_LSB 8 -#define BB_POWERTX_RATE9_POWERTX_DUP40_OFDM_MASK 0x00003f00 -#define BB_POWERTX_RATE9_POWERTX_DUP40_OFDM_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_POWERTX_RATE9_POWERTX_DUP40_OFDM_SET(x) (((x) << 8) & 0x00003f00) -#define BB_POWERTX_RATE9_POWERTX_EXT20_CCK_MSB 21 -#define BB_POWERTX_RATE9_POWERTX_EXT20_CCK_LSB 16 -#define BB_POWERTX_RATE9_POWERTX_EXT20_CCK_MASK 0x003f0000 -#define BB_POWERTX_RATE9_POWERTX_EXT20_CCK_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_POWERTX_RATE9_POWERTX_EXT20_CCK_SET(x) (((x) << 16) & 0x003f0000) -#define BB_POWERTX_RATE9_POWERTX_EXT20_OFDM_MSB 29 -#define BB_POWERTX_RATE9_POWERTX_EXT20_OFDM_LSB 24 -#define BB_POWERTX_RATE9_POWERTX_EXT20_OFDM_MASK 0x3f000000 -#define BB_POWERTX_RATE9_POWERTX_EXT20_OFDM_GET(x) (((x) & 0x3f000000) >> 24) -#define BB_POWERTX_RATE9_POWERTX_EXT20_OFDM_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for bb_sm_reg_map.BB_powertx_rate10 */ -#define BB_POWERTX_RATE10_ADDRESS 0x000001e4 -#define BB_POWERTX_RATE10_OFFSET 0x000001e4 -#define BB_POWERTX_RATE10_POWERTXHT20_8_MSB 5 -#define BB_POWERTX_RATE10_POWERTXHT20_8_LSB 0 -#define BB_POWERTX_RATE10_POWERTXHT20_8_MASK 0x0000003f -#define BB_POWERTX_RATE10_POWERTXHT20_8_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_POWERTX_RATE10_POWERTXHT20_8_SET(x) (((x) << 0) & 0x0000003f) -#define BB_POWERTX_RATE10_POWERTXHT20_9_MSB 13 -#define BB_POWERTX_RATE10_POWERTXHT20_9_LSB 8 -#define BB_POWERTX_RATE10_POWERTXHT20_9_MASK 0x00003f00 -#define BB_POWERTX_RATE10_POWERTXHT20_9_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_POWERTX_RATE10_POWERTXHT20_9_SET(x) (((x) << 8) & 0x00003f00) -#define BB_POWERTX_RATE10_POWERTXHT20_10_MSB 21 -#define BB_POWERTX_RATE10_POWERTXHT20_10_LSB 16 -#define BB_POWERTX_RATE10_POWERTXHT20_10_MASK 0x003f0000 -#define BB_POWERTX_RATE10_POWERTXHT20_10_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_POWERTX_RATE10_POWERTXHT20_10_SET(x) (((x) << 16) & 0x003f0000) -#define BB_POWERTX_RATE10_POWERTXHT20_11_MSB 29 -#define BB_POWERTX_RATE10_POWERTXHT20_11_LSB 24 -#define BB_POWERTX_RATE10_POWERTXHT20_11_MASK 0x3f000000 -#define BB_POWERTX_RATE10_POWERTXHT20_11_GET(x) (((x) & 0x3f000000) >> 24) -#define BB_POWERTX_RATE10_POWERTXHT20_11_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for bb_sm_reg_map.BB_powertx_rate11 */ -#define BB_POWERTX_RATE11_ADDRESS 0x000001e8 -#define BB_POWERTX_RATE11_OFFSET 0x000001e8 -#define BB_POWERTX_RATE11_POWERTXHT20_12_MSB 5 -#define BB_POWERTX_RATE11_POWERTXHT20_12_LSB 0 -#define BB_POWERTX_RATE11_POWERTXHT20_12_MASK 0x0000003f -#define BB_POWERTX_RATE11_POWERTXHT20_12_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_POWERTX_RATE11_POWERTXHT20_12_SET(x) (((x) << 0) & 0x0000003f) -#define BB_POWERTX_RATE11_POWERTXHT20_13_MSB 13 -#define BB_POWERTX_RATE11_POWERTXHT20_13_LSB 8 -#define BB_POWERTX_RATE11_POWERTXHT20_13_MASK 0x00003f00 -#define BB_POWERTX_RATE11_POWERTXHT20_13_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_POWERTX_RATE11_POWERTXHT20_13_SET(x) (((x) << 8) & 0x00003f00) -#define BB_POWERTX_RATE11_POWERTXHT40_12_MSB 21 -#define BB_POWERTX_RATE11_POWERTXHT40_12_LSB 16 -#define BB_POWERTX_RATE11_POWERTXHT40_12_MASK 0x003f0000 -#define BB_POWERTX_RATE11_POWERTXHT40_12_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_POWERTX_RATE11_POWERTXHT40_12_SET(x) (((x) << 16) & 0x003f0000) -#define BB_POWERTX_RATE11_POWERTXHT40_13_MSB 29 -#define BB_POWERTX_RATE11_POWERTXHT40_13_LSB 24 -#define BB_POWERTX_RATE11_POWERTXHT40_13_MASK 0x3f000000 -#define BB_POWERTX_RATE11_POWERTXHT40_13_GET(x) (((x) & 0x3f000000) >> 24) -#define BB_POWERTX_RATE11_POWERTXHT40_13_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for bb_sm_reg_map.BB_powertx_rate12 */ -#define BB_POWERTX_RATE12_ADDRESS 0x000001ec -#define BB_POWERTX_RATE12_OFFSET 0x000001ec -#define BB_POWERTX_RATE12_POWERTXHT40_8_MSB 5 -#define BB_POWERTX_RATE12_POWERTXHT40_8_LSB 0 -#define BB_POWERTX_RATE12_POWERTXHT40_8_MASK 0x0000003f -#define BB_POWERTX_RATE12_POWERTXHT40_8_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_POWERTX_RATE12_POWERTXHT40_8_SET(x) (((x) << 0) & 0x0000003f) -#define BB_POWERTX_RATE12_POWERTXHT40_9_MSB 13 -#define BB_POWERTX_RATE12_POWERTXHT40_9_LSB 8 -#define BB_POWERTX_RATE12_POWERTXHT40_9_MASK 0x00003f00 -#define BB_POWERTX_RATE12_POWERTXHT40_9_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_POWERTX_RATE12_POWERTXHT40_9_SET(x) (((x) << 8) & 0x00003f00) -#define BB_POWERTX_RATE12_POWERTXHT40_10_MSB 21 -#define BB_POWERTX_RATE12_POWERTXHT40_10_LSB 16 -#define BB_POWERTX_RATE12_POWERTXHT40_10_MASK 0x003f0000 -#define BB_POWERTX_RATE12_POWERTXHT40_10_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_POWERTX_RATE12_POWERTXHT40_10_SET(x) (((x) << 16) & 0x003f0000) -#define BB_POWERTX_RATE12_POWERTXHT40_11_MSB 29 -#define BB_POWERTX_RATE12_POWERTXHT40_11_LSB 24 -#define BB_POWERTX_RATE12_POWERTXHT40_11_MASK 0x3f000000 -#define BB_POWERTX_RATE12_POWERTXHT40_11_GET(x) (((x) & 0x3f000000) >> 24) -#define BB_POWERTX_RATE12_POWERTXHT40_11_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for bb_sm_reg_map.BB_powertx_max */ -#define BB_POWERTX_MAX_ADDRESS 0x000001f0 -#define BB_POWERTX_MAX_OFFSET 0x000001f0 -#define BB_POWERTX_MAX_USE_PER_PACKET_POWERTX_MAX_MSB 6 -#define BB_POWERTX_MAX_USE_PER_PACKET_POWERTX_MAX_LSB 6 -#define BB_POWERTX_MAX_USE_PER_PACKET_POWERTX_MAX_MASK 0x00000040 -#define BB_POWERTX_MAX_USE_PER_PACKET_POWERTX_MAX_GET(x) (((x) & 0x00000040) >> 6) -#define BB_POWERTX_MAX_USE_PER_PACKET_POWERTX_MAX_SET(x) (((x) << 6) & 0x00000040) -#define BB_POWERTX_MAX_USE_PER_PACKET_OLPC_GAIN_DELTA_ADJ_MSB 7 -#define BB_POWERTX_MAX_USE_PER_PACKET_OLPC_GAIN_DELTA_ADJ_LSB 7 -#define BB_POWERTX_MAX_USE_PER_PACKET_OLPC_GAIN_DELTA_ADJ_MASK 0x00000080 -#define BB_POWERTX_MAX_USE_PER_PACKET_OLPC_GAIN_DELTA_ADJ_GET(x) (((x) & 0x00000080) >> 7) -#define BB_POWERTX_MAX_USE_PER_PACKET_OLPC_GAIN_DELTA_ADJ_SET(x) (((x) << 7) & 0x00000080) - -/* macros for bb_sm_reg_map.BB_powertx_sub */ -#define BB_POWERTX_SUB_ADDRESS 0x000001f4 -#define BB_POWERTX_SUB_OFFSET 0x000001f4 -#define BB_POWERTX_SUB_POWERTX_SUB_FOR_2CHAIN_MSB 5 -#define BB_POWERTX_SUB_POWERTX_SUB_FOR_2CHAIN_LSB 0 -#define BB_POWERTX_SUB_POWERTX_SUB_FOR_2CHAIN_MASK 0x0000003f -#define BB_POWERTX_SUB_POWERTX_SUB_FOR_2CHAIN_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_POWERTX_SUB_POWERTX_SUB_FOR_2CHAIN_SET(x) (((x) << 0) & 0x0000003f) - -/* macros for bb_sm_reg_map.BB_tpc_1 */ -#define BB_TPC_1_ADDRESS 0x000001f8 -#define BB_TPC_1_OFFSET 0x000001f8 -#define BB_TPC_1_FORCE_DAC_GAIN_MSB 0 -#define BB_TPC_1_FORCE_DAC_GAIN_LSB 0 -#define BB_TPC_1_FORCE_DAC_GAIN_MASK 0x00000001 -#define BB_TPC_1_FORCE_DAC_GAIN_GET(x) (((x) & 0x00000001) >> 0) -#define BB_TPC_1_FORCE_DAC_GAIN_SET(x) (((x) << 0) & 0x00000001) -#define BB_TPC_1_FORCED_DAC_GAIN_MSB 5 -#define BB_TPC_1_FORCED_DAC_GAIN_LSB 1 -#define BB_TPC_1_FORCED_DAC_GAIN_MASK 0x0000003e -#define BB_TPC_1_FORCED_DAC_GAIN_GET(x) (((x) & 0x0000003e) >> 1) -#define BB_TPC_1_FORCED_DAC_GAIN_SET(x) (((x) << 1) & 0x0000003e) -#define BB_TPC_1_PD_DC_OFFSET_TARGET_MSB 13 -#define BB_TPC_1_PD_DC_OFFSET_TARGET_LSB 6 -#define BB_TPC_1_PD_DC_OFFSET_TARGET_MASK 0x00003fc0 -#define BB_TPC_1_PD_DC_OFFSET_TARGET_GET(x) (((x) & 0x00003fc0) >> 6) -#define BB_TPC_1_PD_DC_OFFSET_TARGET_SET(x) (((x) << 6) & 0x00003fc0) -#define BB_TPC_1_NUM_PD_GAIN_MSB 15 -#define BB_TPC_1_NUM_PD_GAIN_LSB 14 -#define BB_TPC_1_NUM_PD_GAIN_MASK 0x0000c000 -#define BB_TPC_1_NUM_PD_GAIN_GET(x) (((x) & 0x0000c000) >> 14) -#define BB_TPC_1_NUM_PD_GAIN_SET(x) (((x) << 14) & 0x0000c000) -#define BB_TPC_1_PD_GAIN_SETTING1_MSB 17 -#define BB_TPC_1_PD_GAIN_SETTING1_LSB 16 -#define BB_TPC_1_PD_GAIN_SETTING1_MASK 0x00030000 -#define BB_TPC_1_PD_GAIN_SETTING1_GET(x) (((x) & 0x00030000) >> 16) -#define BB_TPC_1_PD_GAIN_SETTING1_SET(x) (((x) << 16) & 0x00030000) -#define BB_TPC_1_PD_GAIN_SETTING2_MSB 19 -#define BB_TPC_1_PD_GAIN_SETTING2_LSB 18 -#define BB_TPC_1_PD_GAIN_SETTING2_MASK 0x000c0000 -#define BB_TPC_1_PD_GAIN_SETTING2_GET(x) (((x) & 0x000c0000) >> 18) -#define BB_TPC_1_PD_GAIN_SETTING2_SET(x) (((x) << 18) & 0x000c0000) -#define BB_TPC_1_PD_GAIN_SETTING3_MSB 21 -#define BB_TPC_1_PD_GAIN_SETTING3_LSB 20 -#define BB_TPC_1_PD_GAIN_SETTING3_MASK 0x00300000 -#define BB_TPC_1_PD_GAIN_SETTING3_GET(x) (((x) & 0x00300000) >> 20) -#define BB_TPC_1_PD_GAIN_SETTING3_SET(x) (((x) << 20) & 0x00300000) -#define BB_TPC_1_ENABLE_PD_CALIBRATE_MSB 22 -#define BB_TPC_1_ENABLE_PD_CALIBRATE_LSB 22 -#define BB_TPC_1_ENABLE_PD_CALIBRATE_MASK 0x00400000 -#define BB_TPC_1_ENABLE_PD_CALIBRATE_GET(x) (((x) & 0x00400000) >> 22) -#define BB_TPC_1_ENABLE_PD_CALIBRATE_SET(x) (((x) << 22) & 0x00400000) -#define BB_TPC_1_PD_CALIBRATE_WAIT_MSB 28 -#define BB_TPC_1_PD_CALIBRATE_WAIT_LSB 23 -#define BB_TPC_1_PD_CALIBRATE_WAIT_MASK 0x1f800000 -#define BB_TPC_1_PD_CALIBRATE_WAIT_GET(x) (((x) & 0x1f800000) >> 23) -#define BB_TPC_1_PD_CALIBRATE_WAIT_SET(x) (((x) << 23) & 0x1f800000) -#define BB_TPC_1_FORCE_PDADC_GAIN_MSB 29 -#define BB_TPC_1_FORCE_PDADC_GAIN_LSB 29 -#define BB_TPC_1_FORCE_PDADC_GAIN_MASK 0x20000000 -#define BB_TPC_1_FORCE_PDADC_GAIN_GET(x) (((x) & 0x20000000) >> 29) -#define BB_TPC_1_FORCE_PDADC_GAIN_SET(x) (((x) << 29) & 0x20000000) -#define BB_TPC_1_FORCED_PDADC_GAIN_MSB 31 -#define BB_TPC_1_FORCED_PDADC_GAIN_LSB 30 -#define BB_TPC_1_FORCED_PDADC_GAIN_MASK 0xc0000000 -#define BB_TPC_1_FORCED_PDADC_GAIN_GET(x) (((x) & 0xc0000000) >> 30) -#define BB_TPC_1_FORCED_PDADC_GAIN_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for bb_sm_reg_map.BB_tpc_2 */ -#define BB_TPC_2_ADDRESS 0x000001fc -#define BB_TPC_2_OFFSET 0x000001fc -#define BB_TPC_2_TX_FRAME_TO_PDADC_ON_MSB 7 -#define BB_TPC_2_TX_FRAME_TO_PDADC_ON_LSB 0 -#define BB_TPC_2_TX_FRAME_TO_PDADC_ON_MASK 0x000000ff -#define BB_TPC_2_TX_FRAME_TO_PDADC_ON_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_TPC_2_TX_FRAME_TO_PDADC_ON_SET(x) (((x) << 0) & 0x000000ff) -#define BB_TPC_2_TX_FRAME_TO_PD_ACC_OFDM_MSB 15 -#define BB_TPC_2_TX_FRAME_TO_PD_ACC_OFDM_LSB 8 -#define BB_TPC_2_TX_FRAME_TO_PD_ACC_OFDM_MASK 0x0000ff00 -#define BB_TPC_2_TX_FRAME_TO_PD_ACC_OFDM_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_TPC_2_TX_FRAME_TO_PD_ACC_OFDM_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_TPC_2_TX_FRAME_TO_PD_ACC_CCK_MSB 23 -#define BB_TPC_2_TX_FRAME_TO_PD_ACC_CCK_LSB 16 -#define BB_TPC_2_TX_FRAME_TO_PD_ACC_CCK_MASK 0x00ff0000 -#define BB_TPC_2_TX_FRAME_TO_PD_ACC_CCK_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_TPC_2_TX_FRAME_TO_PD_ACC_CCK_SET(x) (((x) << 16) & 0x00ff0000) - -/* macros for bb_sm_reg_map.BB_tpc_3 */ -#define BB_TPC_3_ADDRESS 0x00000200 -#define BB_TPC_3_OFFSET 0x00000200 -#define BB_TPC_3_TX_END_TO_PDADC_ON_MSB 7 -#define BB_TPC_3_TX_END_TO_PDADC_ON_LSB 0 -#define BB_TPC_3_TX_END_TO_PDADC_ON_MASK 0x000000ff -#define BB_TPC_3_TX_END_TO_PDADC_ON_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_TPC_3_TX_END_TO_PDADC_ON_SET(x) (((x) << 0) & 0x000000ff) -#define BB_TPC_3_TX_END_TO_PD_ACC_ON_MSB 15 -#define BB_TPC_3_TX_END_TO_PD_ACC_ON_LSB 8 -#define BB_TPC_3_TX_END_TO_PD_ACC_ON_MASK 0x0000ff00 -#define BB_TPC_3_TX_END_TO_PD_ACC_ON_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_TPC_3_TX_END_TO_PD_ACC_ON_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_TPC_3_PD_ACC_WINDOW_DC_OFF_MSB 18 -#define BB_TPC_3_PD_ACC_WINDOW_DC_OFF_LSB 16 -#define BB_TPC_3_PD_ACC_WINDOW_DC_OFF_MASK 0x00070000 -#define BB_TPC_3_PD_ACC_WINDOW_DC_OFF_GET(x) (((x) & 0x00070000) >> 16) -#define BB_TPC_3_PD_ACC_WINDOW_DC_OFF_SET(x) (((x) << 16) & 0x00070000) -#define BB_TPC_3_PD_ACC_WINDOW_CAL_MSB 21 -#define BB_TPC_3_PD_ACC_WINDOW_CAL_LSB 19 -#define BB_TPC_3_PD_ACC_WINDOW_CAL_MASK 0x00380000 -#define BB_TPC_3_PD_ACC_WINDOW_CAL_GET(x) (((x) & 0x00380000) >> 19) -#define BB_TPC_3_PD_ACC_WINDOW_CAL_SET(x) (((x) << 19) & 0x00380000) -#define BB_TPC_3_PD_ACC_WINDOW_OFDM_MSB 24 -#define BB_TPC_3_PD_ACC_WINDOW_OFDM_LSB 22 -#define BB_TPC_3_PD_ACC_WINDOW_OFDM_MASK 0x01c00000 -#define BB_TPC_3_PD_ACC_WINDOW_OFDM_GET(x) (((x) & 0x01c00000) >> 22) -#define BB_TPC_3_PD_ACC_WINDOW_OFDM_SET(x) (((x) << 22) & 0x01c00000) -#define BB_TPC_3_PD_ACC_WINDOW_CCK_MSB 27 -#define BB_TPC_3_PD_ACC_WINDOW_CCK_LSB 25 -#define BB_TPC_3_PD_ACC_WINDOW_CCK_MASK 0x0e000000 -#define BB_TPC_3_PD_ACC_WINDOW_CCK_GET(x) (((x) & 0x0e000000) >> 25) -#define BB_TPC_3_PD_ACC_WINDOW_CCK_SET(x) (((x) << 25) & 0x0e000000) -#define BB_TPC_3_TPC_CLK_GATE_ENABLE_MSB 31 -#define BB_TPC_3_TPC_CLK_GATE_ENABLE_LSB 31 -#define BB_TPC_3_TPC_CLK_GATE_ENABLE_MASK 0x80000000 -#define BB_TPC_3_TPC_CLK_GATE_ENABLE_GET(x) (((x) & 0x80000000) >> 31) -#define BB_TPC_3_TPC_CLK_GATE_ENABLE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_sm_reg_map.BB_tpc_4_b0 */ -#define BB_TPC_4_B0_ADDRESS 0x00000204 -#define BB_TPC_4_B0_OFFSET 0x00000204 -#define BB_TPC_4_B0_PD_AVG_VALID_0_MSB 0 -#define BB_TPC_4_B0_PD_AVG_VALID_0_LSB 0 -#define BB_TPC_4_B0_PD_AVG_VALID_0_MASK 0x00000001 -#define BB_TPC_4_B0_PD_AVG_VALID_0_GET(x) (((x) & 0x00000001) >> 0) -#define BB_TPC_4_B0_PD_AVG_OUT_0_MSB 8 -#define BB_TPC_4_B0_PD_AVG_OUT_0_LSB 1 -#define BB_TPC_4_B0_PD_AVG_OUT_0_MASK 0x000001fe -#define BB_TPC_4_B0_PD_AVG_OUT_0_GET(x) (((x) & 0x000001fe) >> 1) -#define BB_TPC_4_B0_DAC_GAIN_0_MSB 13 -#define BB_TPC_4_B0_DAC_GAIN_0_LSB 9 -#define BB_TPC_4_B0_DAC_GAIN_0_MASK 0x00003e00 -#define BB_TPC_4_B0_DAC_GAIN_0_GET(x) (((x) & 0x00003e00) >> 9) -#define BB_TPC_4_B0_TX_GAIN_SETTING_0_MSB 19 -#define BB_TPC_4_B0_TX_GAIN_SETTING_0_LSB 14 -#define BB_TPC_4_B0_TX_GAIN_SETTING_0_MASK 0x000fc000 -#define BB_TPC_4_B0_TX_GAIN_SETTING_0_GET(x) (((x) & 0x000fc000) >> 14) -#define BB_TPC_4_B0_RATE_SENT_0_MSB 24 -#define BB_TPC_4_B0_RATE_SENT_0_LSB 20 -#define BB_TPC_4_B0_RATE_SENT_0_MASK 0x01f00000 -#define BB_TPC_4_B0_RATE_SENT_0_GET(x) (((x) & 0x01f00000) >> 20) -#define BB_TPC_4_B0_ERROR_EST_UPDATE_POWER_THRESH_MSB 30 -#define BB_TPC_4_B0_ERROR_EST_UPDATE_POWER_THRESH_LSB 25 -#define BB_TPC_4_B0_ERROR_EST_UPDATE_POWER_THRESH_MASK 0x7e000000 -#define BB_TPC_4_B0_ERROR_EST_UPDATE_POWER_THRESH_GET(x) (((x) & 0x7e000000) >> 25) -#define BB_TPC_4_B0_ERROR_EST_UPDATE_POWER_THRESH_SET(x) (((x) << 25) & 0x7e000000) - -/* macros for bb_sm_reg_map.BB_tpc_5_b0 */ -#define BB_TPC_5_B0_ADDRESS 0x00000208 -#define BB_TPC_5_B0_OFFSET 0x00000208 -#define BB_TPC_5_B0_PD_GAIN_OVERLAP_MSB 3 -#define BB_TPC_5_B0_PD_GAIN_OVERLAP_LSB 0 -#define BB_TPC_5_B0_PD_GAIN_OVERLAP_MASK 0x0000000f -#define BB_TPC_5_B0_PD_GAIN_OVERLAP_GET(x) (((x) & 0x0000000f) >> 0) -#define BB_TPC_5_B0_PD_GAIN_OVERLAP_SET(x) (((x) << 0) & 0x0000000f) -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_1_0_MSB 9 -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_1_0_LSB 4 -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_1_0_MASK 0x000003f0 -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_1_0_GET(x) (((x) & 0x000003f0) >> 4) -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_1_0_SET(x) (((x) << 4) & 0x000003f0) -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_2_0_MSB 15 -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_2_0_LSB 10 -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_2_0_MASK 0x0000fc00 -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_2_0_GET(x) (((x) & 0x0000fc00) >> 10) -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_2_0_SET(x) (((x) << 10) & 0x0000fc00) -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_3_0_MSB 21 -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_3_0_LSB 16 -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_3_0_MASK 0x003f0000 -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_3_0_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_3_0_SET(x) (((x) << 16) & 0x003f0000) -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_4_0_MSB 27 -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_4_0_LSB 22 -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_4_0_MASK 0x0fc00000 -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_4_0_GET(x) (((x) & 0x0fc00000) >> 22) -#define BB_TPC_5_B0_PD_GAIN_BOUNDARY_4_0_SET(x) (((x) << 22) & 0x0fc00000) - -/* macros for bb_sm_reg_map.BB_tpc_6_b0 */ -#define BB_TPC_6_B0_ADDRESS 0x0000020c -#define BB_TPC_6_B0_OFFSET 0x0000020c -#define BB_TPC_6_B0_PD_DAC_SETTING_1_0_MSB 5 -#define BB_TPC_6_B0_PD_DAC_SETTING_1_0_LSB 0 -#define BB_TPC_6_B0_PD_DAC_SETTING_1_0_MASK 0x0000003f -#define BB_TPC_6_B0_PD_DAC_SETTING_1_0_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_TPC_6_B0_PD_DAC_SETTING_1_0_SET(x) (((x) << 0) & 0x0000003f) -#define BB_TPC_6_B0_PD_DAC_SETTING_2_0_MSB 11 -#define BB_TPC_6_B0_PD_DAC_SETTING_2_0_LSB 6 -#define BB_TPC_6_B0_PD_DAC_SETTING_2_0_MASK 0x00000fc0 -#define BB_TPC_6_B0_PD_DAC_SETTING_2_0_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_TPC_6_B0_PD_DAC_SETTING_2_0_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_TPC_6_B0_PD_DAC_SETTING_3_0_MSB 17 -#define BB_TPC_6_B0_PD_DAC_SETTING_3_0_LSB 12 -#define BB_TPC_6_B0_PD_DAC_SETTING_3_0_MASK 0x0003f000 -#define BB_TPC_6_B0_PD_DAC_SETTING_3_0_GET(x) (((x) & 0x0003f000) >> 12) -#define BB_TPC_6_B0_PD_DAC_SETTING_3_0_SET(x) (((x) << 12) & 0x0003f000) -#define BB_TPC_6_B0_PD_DAC_SETTING_4_0_MSB 23 -#define BB_TPC_6_B0_PD_DAC_SETTING_4_0_LSB 18 -#define BB_TPC_6_B0_PD_DAC_SETTING_4_0_MASK 0x00fc0000 -#define BB_TPC_6_B0_PD_DAC_SETTING_4_0_GET(x) (((x) & 0x00fc0000) >> 18) -#define BB_TPC_6_B0_PD_DAC_SETTING_4_0_SET(x) (((x) << 18) & 0x00fc0000) -#define BB_TPC_6_B0_ERROR_EST_MODE_MSB 25 -#define BB_TPC_6_B0_ERROR_EST_MODE_LSB 24 -#define BB_TPC_6_B0_ERROR_EST_MODE_MASK 0x03000000 -#define BB_TPC_6_B0_ERROR_EST_MODE_GET(x) (((x) & 0x03000000) >> 24) -#define BB_TPC_6_B0_ERROR_EST_MODE_SET(x) (((x) << 24) & 0x03000000) -#define BB_TPC_6_B0_ERROR_EST_FILTER_COEFF_MSB 28 -#define BB_TPC_6_B0_ERROR_EST_FILTER_COEFF_LSB 26 -#define BB_TPC_6_B0_ERROR_EST_FILTER_COEFF_MASK 0x1c000000 -#define BB_TPC_6_B0_ERROR_EST_FILTER_COEFF_GET(x) (((x) & 0x1c000000) >> 26) -#define BB_TPC_6_B0_ERROR_EST_FILTER_COEFF_SET(x) (((x) << 26) & 0x1c000000) - -/* macros for bb_sm_reg_map.BB_tpc_7 */ -#define BB_TPC_7_ADDRESS 0x00000210 -#define BB_TPC_7_OFFSET 0x00000210 -#define BB_TPC_7_TX_GAIN_TABLE_MAX_MSB 5 -#define BB_TPC_7_TX_GAIN_TABLE_MAX_LSB 0 -#define BB_TPC_7_TX_GAIN_TABLE_MAX_MASK 0x0000003f -#define BB_TPC_7_TX_GAIN_TABLE_MAX_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_TPC_7_TX_GAIN_TABLE_MAX_SET(x) (((x) << 0) & 0x0000003f) -#define BB_TPC_7_INIT_TX_GAIN_SETTING_MSB 11 -#define BB_TPC_7_INIT_TX_GAIN_SETTING_LSB 6 -#define BB_TPC_7_INIT_TX_GAIN_SETTING_MASK 0x00000fc0 -#define BB_TPC_7_INIT_TX_GAIN_SETTING_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_TPC_7_INIT_TX_GAIN_SETTING_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_TPC_7_EN_CL_GAIN_MOD_MSB 12 -#define BB_TPC_7_EN_CL_GAIN_MOD_LSB 12 -#define BB_TPC_7_EN_CL_GAIN_MOD_MASK 0x00001000 -#define BB_TPC_7_EN_CL_GAIN_MOD_GET(x) (((x) & 0x00001000) >> 12) -#define BB_TPC_7_EN_CL_GAIN_MOD_SET(x) (((x) << 12) & 0x00001000) -#define BB_TPC_7_USE_TX_PD_IN_XPA_MSB 13 -#define BB_TPC_7_USE_TX_PD_IN_XPA_LSB 13 -#define BB_TPC_7_USE_TX_PD_IN_XPA_MASK 0x00002000 -#define BB_TPC_7_USE_TX_PD_IN_XPA_GET(x) (((x) & 0x00002000) >> 13) -#define BB_TPC_7_USE_TX_PD_IN_XPA_SET(x) (((x) << 13) & 0x00002000) -#define BB_TPC_7_EXTEND_TX_FRAME_FOR_TPC_MSB 14 -#define BB_TPC_7_EXTEND_TX_FRAME_FOR_TPC_LSB 14 -#define BB_TPC_7_EXTEND_TX_FRAME_FOR_TPC_MASK 0x00004000 -#define BB_TPC_7_EXTEND_TX_FRAME_FOR_TPC_GET(x) (((x) & 0x00004000) >> 14) -#define BB_TPC_7_EXTEND_TX_FRAME_FOR_TPC_SET(x) (((x) << 14) & 0x00004000) -#define BB_TPC_7_USE_INIT_TX_GAIN_SETTING_AFTER_WARM_RESET_MSB 15 -#define BB_TPC_7_USE_INIT_TX_GAIN_SETTING_AFTER_WARM_RESET_LSB 15 -#define BB_TPC_7_USE_INIT_TX_GAIN_SETTING_AFTER_WARM_RESET_MASK 0x00008000 -#define BB_TPC_7_USE_INIT_TX_GAIN_SETTING_AFTER_WARM_RESET_GET(x) (((x) & 0x00008000) >> 15) -#define BB_TPC_7_USE_INIT_TX_GAIN_SETTING_AFTER_WARM_RESET_SET(x) (((x) << 15) & 0x00008000) - -/* macros for bb_sm_reg_map.BB_tpc_8 */ -#define BB_TPC_8_ADDRESS 0x00000214 -#define BB_TPC_8_OFFSET 0x00000214 -#define BB_TPC_8_DESIRED_SCALE_0_MSB 4 -#define BB_TPC_8_DESIRED_SCALE_0_LSB 0 -#define BB_TPC_8_DESIRED_SCALE_0_MASK 0x0000001f -#define BB_TPC_8_DESIRED_SCALE_0_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_TPC_8_DESIRED_SCALE_0_SET(x) (((x) << 0) & 0x0000001f) -#define BB_TPC_8_DESIRED_SCALE_1_MSB 9 -#define BB_TPC_8_DESIRED_SCALE_1_LSB 5 -#define BB_TPC_8_DESIRED_SCALE_1_MASK 0x000003e0 -#define BB_TPC_8_DESIRED_SCALE_1_GET(x) (((x) & 0x000003e0) >> 5) -#define BB_TPC_8_DESIRED_SCALE_1_SET(x) (((x) << 5) & 0x000003e0) -#define BB_TPC_8_DESIRED_SCALE_2_MSB 14 -#define BB_TPC_8_DESIRED_SCALE_2_LSB 10 -#define BB_TPC_8_DESIRED_SCALE_2_MASK 0x00007c00 -#define BB_TPC_8_DESIRED_SCALE_2_GET(x) (((x) & 0x00007c00) >> 10) -#define BB_TPC_8_DESIRED_SCALE_2_SET(x) (((x) << 10) & 0x00007c00) -#define BB_TPC_8_DESIRED_SCALE_3_MSB 19 -#define BB_TPC_8_DESIRED_SCALE_3_LSB 15 -#define BB_TPC_8_DESIRED_SCALE_3_MASK 0x000f8000 -#define BB_TPC_8_DESIRED_SCALE_3_GET(x) (((x) & 0x000f8000) >> 15) -#define BB_TPC_8_DESIRED_SCALE_3_SET(x) (((x) << 15) & 0x000f8000) -#define BB_TPC_8_DESIRED_SCALE_4_MSB 24 -#define BB_TPC_8_DESIRED_SCALE_4_LSB 20 -#define BB_TPC_8_DESIRED_SCALE_4_MASK 0x01f00000 -#define BB_TPC_8_DESIRED_SCALE_4_GET(x) (((x) & 0x01f00000) >> 20) -#define BB_TPC_8_DESIRED_SCALE_4_SET(x) (((x) << 20) & 0x01f00000) -#define BB_TPC_8_DESIRED_SCALE_5_MSB 29 -#define BB_TPC_8_DESIRED_SCALE_5_LSB 25 -#define BB_TPC_8_DESIRED_SCALE_5_MASK 0x3e000000 -#define BB_TPC_8_DESIRED_SCALE_5_GET(x) (((x) & 0x3e000000) >> 25) -#define BB_TPC_8_DESIRED_SCALE_5_SET(x) (((x) << 25) & 0x3e000000) - -/* macros for bb_sm_reg_map.BB_tpc_9 */ -#define BB_TPC_9_ADDRESS 0x00000218 -#define BB_TPC_9_OFFSET 0x00000218 -#define BB_TPC_9_DESIRED_SCALE_6_MSB 4 -#define BB_TPC_9_DESIRED_SCALE_6_LSB 0 -#define BB_TPC_9_DESIRED_SCALE_6_MASK 0x0000001f -#define BB_TPC_9_DESIRED_SCALE_6_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_TPC_9_DESIRED_SCALE_6_SET(x) (((x) << 0) & 0x0000001f) -#define BB_TPC_9_DESIRED_SCALE_7_MSB 9 -#define BB_TPC_9_DESIRED_SCALE_7_LSB 5 -#define BB_TPC_9_DESIRED_SCALE_7_MASK 0x000003e0 -#define BB_TPC_9_DESIRED_SCALE_7_GET(x) (((x) & 0x000003e0) >> 5) -#define BB_TPC_9_DESIRED_SCALE_7_SET(x) (((x) << 5) & 0x000003e0) -#define BB_TPC_9_DESIRED_SCALE_CCK_MSB 14 -#define BB_TPC_9_DESIRED_SCALE_CCK_LSB 10 -#define BB_TPC_9_DESIRED_SCALE_CCK_MASK 0x00007c00 -#define BB_TPC_9_DESIRED_SCALE_CCK_GET(x) (((x) & 0x00007c00) >> 10) -#define BB_TPC_9_DESIRED_SCALE_CCK_SET(x) (((x) << 10) & 0x00007c00) -#define BB_TPC_9_EN_PD_DC_OFFSET_THR_MSB 20 -#define BB_TPC_9_EN_PD_DC_OFFSET_THR_LSB 20 -#define BB_TPC_9_EN_PD_DC_OFFSET_THR_MASK 0x00100000 -#define BB_TPC_9_EN_PD_DC_OFFSET_THR_GET(x) (((x) & 0x00100000) >> 20) -#define BB_TPC_9_EN_PD_DC_OFFSET_THR_SET(x) (((x) << 20) & 0x00100000) -#define BB_TPC_9_PD_DC_OFFSET_THR_MSB 26 -#define BB_TPC_9_PD_DC_OFFSET_THR_LSB 21 -#define BB_TPC_9_PD_DC_OFFSET_THR_MASK 0x07e00000 -#define BB_TPC_9_PD_DC_OFFSET_THR_GET(x) (((x) & 0x07e00000) >> 21) -#define BB_TPC_9_PD_DC_OFFSET_THR_SET(x) (((x) << 21) & 0x07e00000) -#define BB_TPC_9_WAIT_CALTX_SETTLE_MSB 30 -#define BB_TPC_9_WAIT_CALTX_SETTLE_LSB 27 -#define BB_TPC_9_WAIT_CALTX_SETTLE_MASK 0x78000000 -#define BB_TPC_9_WAIT_CALTX_SETTLE_GET(x) (((x) & 0x78000000) >> 27) -#define BB_TPC_9_WAIT_CALTX_SETTLE_SET(x) (((x) << 27) & 0x78000000) -#define BB_TPC_9_DISABLE_PDADC_RESIDUAL_DC_REMOVAL_MSB 31 -#define BB_TPC_9_DISABLE_PDADC_RESIDUAL_DC_REMOVAL_LSB 31 -#define BB_TPC_9_DISABLE_PDADC_RESIDUAL_DC_REMOVAL_MASK 0x80000000 -#define BB_TPC_9_DISABLE_PDADC_RESIDUAL_DC_REMOVAL_GET(x) (((x) & 0x80000000) >> 31) -#define BB_TPC_9_DISABLE_PDADC_RESIDUAL_DC_REMOVAL_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_sm_reg_map.BB_tpc_10 */ -#define BB_TPC_10_ADDRESS 0x0000021c -#define BB_TPC_10_OFFSET 0x0000021c -#define BB_TPC_10_DESIRED_SCALE_HT20_0_MSB 4 -#define BB_TPC_10_DESIRED_SCALE_HT20_0_LSB 0 -#define BB_TPC_10_DESIRED_SCALE_HT20_0_MASK 0x0000001f -#define BB_TPC_10_DESIRED_SCALE_HT20_0_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_TPC_10_DESIRED_SCALE_HT20_0_SET(x) (((x) << 0) & 0x0000001f) -#define BB_TPC_10_DESIRED_SCALE_HT20_1_MSB 9 -#define BB_TPC_10_DESIRED_SCALE_HT20_1_LSB 5 -#define BB_TPC_10_DESIRED_SCALE_HT20_1_MASK 0x000003e0 -#define BB_TPC_10_DESIRED_SCALE_HT20_1_GET(x) (((x) & 0x000003e0) >> 5) -#define BB_TPC_10_DESIRED_SCALE_HT20_1_SET(x) (((x) << 5) & 0x000003e0) -#define BB_TPC_10_DESIRED_SCALE_HT20_2_MSB 14 -#define BB_TPC_10_DESIRED_SCALE_HT20_2_LSB 10 -#define BB_TPC_10_DESIRED_SCALE_HT20_2_MASK 0x00007c00 -#define BB_TPC_10_DESIRED_SCALE_HT20_2_GET(x) (((x) & 0x00007c00) >> 10) -#define BB_TPC_10_DESIRED_SCALE_HT20_2_SET(x) (((x) << 10) & 0x00007c00) -#define BB_TPC_10_DESIRED_SCALE_HT20_3_MSB 19 -#define BB_TPC_10_DESIRED_SCALE_HT20_3_LSB 15 -#define BB_TPC_10_DESIRED_SCALE_HT20_3_MASK 0x000f8000 -#define BB_TPC_10_DESIRED_SCALE_HT20_3_GET(x) (((x) & 0x000f8000) >> 15) -#define BB_TPC_10_DESIRED_SCALE_HT20_3_SET(x) (((x) << 15) & 0x000f8000) -#define BB_TPC_10_DESIRED_SCALE_HT20_4_MSB 24 -#define BB_TPC_10_DESIRED_SCALE_HT20_4_LSB 20 -#define BB_TPC_10_DESIRED_SCALE_HT20_4_MASK 0x01f00000 -#define BB_TPC_10_DESIRED_SCALE_HT20_4_GET(x) (((x) & 0x01f00000) >> 20) -#define BB_TPC_10_DESIRED_SCALE_HT20_4_SET(x) (((x) << 20) & 0x01f00000) -#define BB_TPC_10_DESIRED_SCALE_HT20_5_MSB 29 -#define BB_TPC_10_DESIRED_SCALE_HT20_5_LSB 25 -#define BB_TPC_10_DESIRED_SCALE_HT20_5_MASK 0x3e000000 -#define BB_TPC_10_DESIRED_SCALE_HT20_5_GET(x) (((x) & 0x3e000000) >> 25) -#define BB_TPC_10_DESIRED_SCALE_HT20_5_SET(x) (((x) << 25) & 0x3e000000) - -/* macros for bb_sm_reg_map.BB_tpc_11_b0 */ -#define BB_TPC_11_B0_ADDRESS 0x00000220 -#define BB_TPC_11_B0_OFFSET 0x00000220 -#define BB_TPC_11_B0_DESIRED_SCALE_HT20_6_MSB 4 -#define BB_TPC_11_B0_DESIRED_SCALE_HT20_6_LSB 0 -#define BB_TPC_11_B0_DESIRED_SCALE_HT20_6_MASK 0x0000001f -#define BB_TPC_11_B0_DESIRED_SCALE_HT20_6_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_TPC_11_B0_DESIRED_SCALE_HT20_6_SET(x) (((x) << 0) & 0x0000001f) -#define BB_TPC_11_B0_DESIRED_SCALE_HT20_7_MSB 9 -#define BB_TPC_11_B0_DESIRED_SCALE_HT20_7_LSB 5 -#define BB_TPC_11_B0_DESIRED_SCALE_HT20_7_MASK 0x000003e0 -#define BB_TPC_11_B0_DESIRED_SCALE_HT20_7_GET(x) (((x) & 0x000003e0) >> 5) -#define BB_TPC_11_B0_DESIRED_SCALE_HT20_7_SET(x) (((x) << 5) & 0x000003e0) -#define BB_TPC_11_B0_OLPC_GAIN_DELTA_0_MSB 23 -#define BB_TPC_11_B0_OLPC_GAIN_DELTA_0_LSB 16 -#define BB_TPC_11_B0_OLPC_GAIN_DELTA_0_MASK 0x00ff0000 -#define BB_TPC_11_B0_OLPC_GAIN_DELTA_0_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_TPC_11_B0_OLPC_GAIN_DELTA_0_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_TPC_11_B0_OLPC_GAIN_DELTA_0_LSB_EXT_MSB 25 -#define BB_TPC_11_B0_OLPC_GAIN_DELTA_0_LSB_EXT_LSB 24 -#define BB_TPC_11_B0_OLPC_GAIN_DELTA_0_LSB_EXT_MASK 0x03000000 -#define BB_TPC_11_B0_OLPC_GAIN_DELTA_0_LSB_EXT_GET(x) (((x) & 0x03000000) >> 24) -#define BB_TPC_11_B0_OLPC_GAIN_DELTA_0_LSB_EXT_SET(x) (((x) << 24) & 0x03000000) - -/* macros for bb_sm_reg_map.BB_tpc_12 */ -#define BB_TPC_12_ADDRESS 0x00000224 -#define BB_TPC_12_OFFSET 0x00000224 -#define BB_TPC_12_DESIRED_SCALE_HT40_0_MSB 4 -#define BB_TPC_12_DESIRED_SCALE_HT40_0_LSB 0 -#define BB_TPC_12_DESIRED_SCALE_HT40_0_MASK 0x0000001f -#define BB_TPC_12_DESIRED_SCALE_HT40_0_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_TPC_12_DESIRED_SCALE_HT40_0_SET(x) (((x) << 0) & 0x0000001f) -#define BB_TPC_12_DESIRED_SCALE_HT40_1_MSB 9 -#define BB_TPC_12_DESIRED_SCALE_HT40_1_LSB 5 -#define BB_TPC_12_DESIRED_SCALE_HT40_1_MASK 0x000003e0 -#define BB_TPC_12_DESIRED_SCALE_HT40_1_GET(x) (((x) & 0x000003e0) >> 5) -#define BB_TPC_12_DESIRED_SCALE_HT40_1_SET(x) (((x) << 5) & 0x000003e0) -#define BB_TPC_12_DESIRED_SCALE_HT40_2_MSB 14 -#define BB_TPC_12_DESIRED_SCALE_HT40_2_LSB 10 -#define BB_TPC_12_DESIRED_SCALE_HT40_2_MASK 0x00007c00 -#define BB_TPC_12_DESIRED_SCALE_HT40_2_GET(x) (((x) & 0x00007c00) >> 10) -#define BB_TPC_12_DESIRED_SCALE_HT40_2_SET(x) (((x) << 10) & 0x00007c00) -#define BB_TPC_12_DESIRED_SCALE_HT40_3_MSB 19 -#define BB_TPC_12_DESIRED_SCALE_HT40_3_LSB 15 -#define BB_TPC_12_DESIRED_SCALE_HT40_3_MASK 0x000f8000 -#define BB_TPC_12_DESIRED_SCALE_HT40_3_GET(x) (((x) & 0x000f8000) >> 15) -#define BB_TPC_12_DESIRED_SCALE_HT40_3_SET(x) (((x) << 15) & 0x000f8000) -#define BB_TPC_12_DESIRED_SCALE_HT40_4_MSB 24 -#define BB_TPC_12_DESIRED_SCALE_HT40_4_LSB 20 -#define BB_TPC_12_DESIRED_SCALE_HT40_4_MASK 0x01f00000 -#define BB_TPC_12_DESIRED_SCALE_HT40_4_GET(x) (((x) & 0x01f00000) >> 20) -#define BB_TPC_12_DESIRED_SCALE_HT40_4_SET(x) (((x) << 20) & 0x01f00000) -#define BB_TPC_12_DESIRED_SCALE_HT40_5_MSB 29 -#define BB_TPC_12_DESIRED_SCALE_HT40_5_LSB 25 -#define BB_TPC_12_DESIRED_SCALE_HT40_5_MASK 0x3e000000 -#define BB_TPC_12_DESIRED_SCALE_HT40_5_GET(x) (((x) & 0x3e000000) >> 25) -#define BB_TPC_12_DESIRED_SCALE_HT40_5_SET(x) (((x) << 25) & 0x3e000000) - -/* macros for bb_sm_reg_map.BB_tpc_13 */ -#define BB_TPC_13_ADDRESS 0x00000228 -#define BB_TPC_13_OFFSET 0x00000228 -#define BB_TPC_13_DESIRED_SCALE_HT40_6_MSB 4 -#define BB_TPC_13_DESIRED_SCALE_HT40_6_LSB 0 -#define BB_TPC_13_DESIRED_SCALE_HT40_6_MASK 0x0000001f -#define BB_TPC_13_DESIRED_SCALE_HT40_6_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_TPC_13_DESIRED_SCALE_HT40_6_SET(x) (((x) << 0) & 0x0000001f) -#define BB_TPC_13_DESIRED_SCALE_HT40_7_MSB 9 -#define BB_TPC_13_DESIRED_SCALE_HT40_7_LSB 5 -#define BB_TPC_13_DESIRED_SCALE_HT40_7_MASK 0x000003e0 -#define BB_TPC_13_DESIRED_SCALE_HT40_7_GET(x) (((x) & 0x000003e0) >> 5) -#define BB_TPC_13_DESIRED_SCALE_HT40_7_SET(x) (((x) << 5) & 0x000003e0) - -/* macros for bb_sm_reg_map.BB_tpc_14 */ -#define BB_TPC_14_ADDRESS 0x0000022c -#define BB_TPC_14_OFFSET 0x0000022c -#define BB_TPC_14_DESIRED_SCALE_HT20_8_MSB 4 -#define BB_TPC_14_DESIRED_SCALE_HT20_8_LSB 0 -#define BB_TPC_14_DESIRED_SCALE_HT20_8_MASK 0x0000001f -#define BB_TPC_14_DESIRED_SCALE_HT20_8_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_TPC_14_DESIRED_SCALE_HT20_8_SET(x) (((x) << 0) & 0x0000001f) -#define BB_TPC_14_DESIRED_SCALE_HT20_9_MSB 9 -#define BB_TPC_14_DESIRED_SCALE_HT20_9_LSB 5 -#define BB_TPC_14_DESIRED_SCALE_HT20_9_MASK 0x000003e0 -#define BB_TPC_14_DESIRED_SCALE_HT20_9_GET(x) (((x) & 0x000003e0) >> 5) -#define BB_TPC_14_DESIRED_SCALE_HT20_9_SET(x) (((x) << 5) & 0x000003e0) -#define BB_TPC_14_DESIRED_SCALE_HT20_10_MSB 14 -#define BB_TPC_14_DESIRED_SCALE_HT20_10_LSB 10 -#define BB_TPC_14_DESIRED_SCALE_HT20_10_MASK 0x00007c00 -#define BB_TPC_14_DESIRED_SCALE_HT20_10_GET(x) (((x) & 0x00007c00) >> 10) -#define BB_TPC_14_DESIRED_SCALE_HT20_10_SET(x) (((x) << 10) & 0x00007c00) -#define BB_TPC_14_DESIRED_SCALE_HT20_11_MSB 19 -#define BB_TPC_14_DESIRED_SCALE_HT20_11_LSB 15 -#define BB_TPC_14_DESIRED_SCALE_HT20_11_MASK 0x000f8000 -#define BB_TPC_14_DESIRED_SCALE_HT20_11_GET(x) (((x) & 0x000f8000) >> 15) -#define BB_TPC_14_DESIRED_SCALE_HT20_11_SET(x) (((x) << 15) & 0x000f8000) -#define BB_TPC_14_DESIRED_SCALE_HT20_12_MSB 24 -#define BB_TPC_14_DESIRED_SCALE_HT20_12_LSB 20 -#define BB_TPC_14_DESIRED_SCALE_HT20_12_MASK 0x01f00000 -#define BB_TPC_14_DESIRED_SCALE_HT20_12_GET(x) (((x) & 0x01f00000) >> 20) -#define BB_TPC_14_DESIRED_SCALE_HT20_12_SET(x) (((x) << 20) & 0x01f00000) -#define BB_TPC_14_DESIRED_SCALE_HT20_13_MSB 29 -#define BB_TPC_14_DESIRED_SCALE_HT20_13_LSB 25 -#define BB_TPC_14_DESIRED_SCALE_HT20_13_MASK 0x3e000000 -#define BB_TPC_14_DESIRED_SCALE_HT20_13_GET(x) (((x) & 0x3e000000) >> 25) -#define BB_TPC_14_DESIRED_SCALE_HT20_13_SET(x) (((x) << 25) & 0x3e000000) - -/* macros for bb_sm_reg_map.BB_tpc_15 */ -#define BB_TPC_15_ADDRESS 0x00000230 -#define BB_TPC_15_OFFSET 0x00000230 -#define BB_TPC_15_DESIRED_SCALE_HT40_8_MSB 4 -#define BB_TPC_15_DESIRED_SCALE_HT40_8_LSB 0 -#define BB_TPC_15_DESIRED_SCALE_HT40_8_MASK 0x0000001f -#define BB_TPC_15_DESIRED_SCALE_HT40_8_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_TPC_15_DESIRED_SCALE_HT40_8_SET(x) (((x) << 0) & 0x0000001f) -#define BB_TPC_15_DESIRED_SCALE_HT40_9_MSB 9 -#define BB_TPC_15_DESIRED_SCALE_HT40_9_LSB 5 -#define BB_TPC_15_DESIRED_SCALE_HT40_9_MASK 0x000003e0 -#define BB_TPC_15_DESIRED_SCALE_HT40_9_GET(x) (((x) & 0x000003e0) >> 5) -#define BB_TPC_15_DESIRED_SCALE_HT40_9_SET(x) (((x) << 5) & 0x000003e0) -#define BB_TPC_15_DESIRED_SCALE_HT40_10_MSB 14 -#define BB_TPC_15_DESIRED_SCALE_HT40_10_LSB 10 -#define BB_TPC_15_DESIRED_SCALE_HT40_10_MASK 0x00007c00 -#define BB_TPC_15_DESIRED_SCALE_HT40_10_GET(x) (((x) & 0x00007c00) >> 10) -#define BB_TPC_15_DESIRED_SCALE_HT40_10_SET(x) (((x) << 10) & 0x00007c00) -#define BB_TPC_15_DESIRED_SCALE_HT40_11_MSB 19 -#define BB_TPC_15_DESIRED_SCALE_HT40_11_LSB 15 -#define BB_TPC_15_DESIRED_SCALE_HT40_11_MASK 0x000f8000 -#define BB_TPC_15_DESIRED_SCALE_HT40_11_GET(x) (((x) & 0x000f8000) >> 15) -#define BB_TPC_15_DESIRED_SCALE_HT40_11_SET(x) (((x) << 15) & 0x000f8000) -#define BB_TPC_15_DESIRED_SCALE_HT40_12_MSB 24 -#define BB_TPC_15_DESIRED_SCALE_HT40_12_LSB 20 -#define BB_TPC_15_DESIRED_SCALE_HT40_12_MASK 0x01f00000 -#define BB_TPC_15_DESIRED_SCALE_HT40_12_GET(x) (((x) & 0x01f00000) >> 20) -#define BB_TPC_15_DESIRED_SCALE_HT40_12_SET(x) (((x) << 20) & 0x01f00000) -#define BB_TPC_15_DESIRED_SCALE_HT40_13_MSB 29 -#define BB_TPC_15_DESIRED_SCALE_HT40_13_LSB 25 -#define BB_TPC_15_DESIRED_SCALE_HT40_13_MASK 0x3e000000 -#define BB_TPC_15_DESIRED_SCALE_HT40_13_GET(x) (((x) & 0x3e000000) >> 25) -#define BB_TPC_15_DESIRED_SCALE_HT40_13_SET(x) (((x) << 25) & 0x3e000000) - -/* macros for bb_sm_reg_map.BB_tpc_16 */ -#define BB_TPC_16_ADDRESS 0x00000234 -#define BB_TPC_16_OFFSET 0x00000234 -#define BB_TPC_16_PDADC_PAR_CORR_CCK_MSB 13 -#define BB_TPC_16_PDADC_PAR_CORR_CCK_LSB 8 -#define BB_TPC_16_PDADC_PAR_CORR_CCK_MASK 0x00003f00 -#define BB_TPC_16_PDADC_PAR_CORR_CCK_GET(x) (((x) & 0x00003f00) >> 8) -#define BB_TPC_16_PDADC_PAR_CORR_CCK_SET(x) (((x) << 8) & 0x00003f00) -#define BB_TPC_16_PDADC_PAR_CORR_OFDM_MSB 21 -#define BB_TPC_16_PDADC_PAR_CORR_OFDM_LSB 16 -#define BB_TPC_16_PDADC_PAR_CORR_OFDM_MASK 0x003f0000 -#define BB_TPC_16_PDADC_PAR_CORR_OFDM_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_TPC_16_PDADC_PAR_CORR_OFDM_SET(x) (((x) << 16) & 0x003f0000) -#define BB_TPC_16_PDADC_PAR_CORR_HT40_MSB 29 -#define BB_TPC_16_PDADC_PAR_CORR_HT40_LSB 24 -#define BB_TPC_16_PDADC_PAR_CORR_HT40_MASK 0x3f000000 -#define BB_TPC_16_PDADC_PAR_CORR_HT40_GET(x) (((x) & 0x3f000000) >> 24) -#define BB_TPC_16_PDADC_PAR_CORR_HT40_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for bb_sm_reg_map.BB_tpc_17 */ -#define BB_TPC_17_ADDRESS 0x00000238 -#define BB_TPC_17_OFFSET 0x00000238 -#define BB_TPC_17_ENABLE_PAL_MSB 0 -#define BB_TPC_17_ENABLE_PAL_LSB 0 -#define BB_TPC_17_ENABLE_PAL_MASK 0x00000001 -#define BB_TPC_17_ENABLE_PAL_GET(x) (((x) & 0x00000001) >> 0) -#define BB_TPC_17_ENABLE_PAL_SET(x) (((x) << 0) & 0x00000001) -#define BB_TPC_17_ENABLE_PAL_CCK_MSB 1 -#define BB_TPC_17_ENABLE_PAL_CCK_LSB 1 -#define BB_TPC_17_ENABLE_PAL_CCK_MASK 0x00000002 -#define BB_TPC_17_ENABLE_PAL_CCK_GET(x) (((x) & 0x00000002) >> 1) -#define BB_TPC_17_ENABLE_PAL_CCK_SET(x) (((x) << 1) & 0x00000002) -#define BB_TPC_17_ENABLE_PAL_OFDM_20_MSB 2 -#define BB_TPC_17_ENABLE_PAL_OFDM_20_LSB 2 -#define BB_TPC_17_ENABLE_PAL_OFDM_20_MASK 0x00000004 -#define BB_TPC_17_ENABLE_PAL_OFDM_20_GET(x) (((x) & 0x00000004) >> 2) -#define BB_TPC_17_ENABLE_PAL_OFDM_20_SET(x) (((x) << 2) & 0x00000004) -#define BB_TPC_17_ENABLE_PAL_OFDM_40_MSB 3 -#define BB_TPC_17_ENABLE_PAL_OFDM_40_LSB 3 -#define BB_TPC_17_ENABLE_PAL_OFDM_40_MASK 0x00000008 -#define BB_TPC_17_ENABLE_PAL_OFDM_40_GET(x) (((x) & 0x00000008) >> 3) -#define BB_TPC_17_ENABLE_PAL_OFDM_40_SET(x) (((x) << 3) & 0x00000008) -#define BB_TPC_17_PAL_POWER_THRESHOLD_MSB 9 -#define BB_TPC_17_PAL_POWER_THRESHOLD_LSB 4 -#define BB_TPC_17_PAL_POWER_THRESHOLD_MASK 0x000003f0 -#define BB_TPC_17_PAL_POWER_THRESHOLD_GET(x) (((x) & 0x000003f0) >> 4) -#define BB_TPC_17_PAL_POWER_THRESHOLD_SET(x) (((x) << 4) & 0x000003f0) -#define BB_TPC_17_FORCE_PAL_LOCKED_MSB 10 -#define BB_TPC_17_FORCE_PAL_LOCKED_LSB 10 -#define BB_TPC_17_FORCE_PAL_LOCKED_MASK 0x00000400 -#define BB_TPC_17_FORCE_PAL_LOCKED_GET(x) (((x) & 0x00000400) >> 10) -#define BB_TPC_17_FORCE_PAL_LOCKED_SET(x) (((x) << 10) & 0x00000400) -#define BB_TPC_17_INIT_TX_GAIN_SETTING_PAL_ON_MSB 16 -#define BB_TPC_17_INIT_TX_GAIN_SETTING_PAL_ON_LSB 11 -#define BB_TPC_17_INIT_TX_GAIN_SETTING_PAL_ON_MASK 0x0001f800 -#define BB_TPC_17_INIT_TX_GAIN_SETTING_PAL_ON_GET(x) (((x) & 0x0001f800) >> 11) -#define BB_TPC_17_INIT_TX_GAIN_SETTING_PAL_ON_SET(x) (((x) << 11) & 0x0001f800) - -/* macros for bb_sm_reg_map.BB_tpc_18 */ -#define BB_TPC_18_ADDRESS 0x0000023c -#define BB_TPC_18_OFFSET 0x0000023c -#define BB_TPC_18_THERM_CAL_VALUE_MSB 7 -#define BB_TPC_18_THERM_CAL_VALUE_LSB 0 -#define BB_TPC_18_THERM_CAL_VALUE_MASK 0x000000ff -#define BB_TPC_18_THERM_CAL_VALUE_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_TPC_18_THERM_CAL_VALUE_SET(x) (((x) << 0) & 0x000000ff) -#define BB_TPC_18_VOLT_CAL_VALUE_MSB 15 -#define BB_TPC_18_VOLT_CAL_VALUE_LSB 8 -#define BB_TPC_18_VOLT_CAL_VALUE_MASK 0x0000ff00 -#define BB_TPC_18_VOLT_CAL_VALUE_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_TPC_18_VOLT_CAL_VALUE_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_TPC_18_USE_LEGACY_TPC_MSB 16 -#define BB_TPC_18_USE_LEGACY_TPC_LSB 16 -#define BB_TPC_18_USE_LEGACY_TPC_MASK 0x00010000 -#define BB_TPC_18_USE_LEGACY_TPC_GET(x) (((x) & 0x00010000) >> 16) -#define BB_TPC_18_USE_LEGACY_TPC_SET(x) (((x) << 16) & 0x00010000) -#define BB_TPC_18_MIN_POWER_THERM_VOLT_GAIN_CORR_MSB 22 -#define BB_TPC_18_MIN_POWER_THERM_VOLT_GAIN_CORR_LSB 17 -#define BB_TPC_18_MIN_POWER_THERM_VOLT_GAIN_CORR_MASK 0x007e0000 -#define BB_TPC_18_MIN_POWER_THERM_VOLT_GAIN_CORR_GET(x) (((x) & 0x007e0000) >> 17) -#define BB_TPC_18_MIN_POWER_THERM_VOLT_GAIN_CORR_SET(x) (((x) << 17) & 0x007e0000) - -/* macros for bb_sm_reg_map.BB_tpc_19_b0 */ -#define BB_TPC_19_B0_ADDRESS 0x00000240 -#define BB_TPC_19_B0_OFFSET 0x00000240 -#define BB_TPC_19_B0_ALPHA_THERM_0_MSB 7 -#define BB_TPC_19_B0_ALPHA_THERM_0_LSB 0 -#define BB_TPC_19_B0_ALPHA_THERM_0_MASK 0x000000ff -#define BB_TPC_19_B0_ALPHA_THERM_0_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_TPC_19_B0_ALPHA_THERM_0_SET(x) (((x) << 0) & 0x000000ff) -#define BB_TPC_19_B0_ALPHA_THERM_PAL_ON_0_MSB 15 -#define BB_TPC_19_B0_ALPHA_THERM_PAL_ON_0_LSB 8 -#define BB_TPC_19_B0_ALPHA_THERM_PAL_ON_0_MASK 0x0000ff00 -#define BB_TPC_19_B0_ALPHA_THERM_PAL_ON_0_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_TPC_19_B0_ALPHA_THERM_PAL_ON_0_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_TPC_19_B0_ALPHA_VOLT_0_MSB 22 -#define BB_TPC_19_B0_ALPHA_VOLT_0_LSB 16 -#define BB_TPC_19_B0_ALPHA_VOLT_0_MASK 0x007f0000 -#define BB_TPC_19_B0_ALPHA_VOLT_0_GET(x) (((x) & 0x007f0000) >> 16) -#define BB_TPC_19_B0_ALPHA_VOLT_0_SET(x) (((x) << 16) & 0x007f0000) -#define BB_TPC_19_B0_ALPHA_VOLT_PAL_ON_0_MSB 29 -#define BB_TPC_19_B0_ALPHA_VOLT_PAL_ON_0_LSB 23 -#define BB_TPC_19_B0_ALPHA_VOLT_PAL_ON_0_MASK 0x3f800000 -#define BB_TPC_19_B0_ALPHA_VOLT_PAL_ON_0_GET(x) (((x) & 0x3f800000) >> 23) -#define BB_TPC_19_B0_ALPHA_VOLT_PAL_ON_0_SET(x) (((x) << 23) & 0x3f800000) - -/* macros for bb_sm_reg_map.BB_tpc_20 */ -#define BB_TPC_20_ADDRESS 0x00000244 -#define BB_TPC_20_OFFSET 0x00000244 -#define BB_TPC_20_ENABLE_PAL_MCS_0_MSB 0 -#define BB_TPC_20_ENABLE_PAL_MCS_0_LSB 0 -#define BB_TPC_20_ENABLE_PAL_MCS_0_MASK 0x00000001 -#define BB_TPC_20_ENABLE_PAL_MCS_0_GET(x) (((x) & 0x00000001) >> 0) -#define BB_TPC_20_ENABLE_PAL_MCS_0_SET(x) (((x) << 0) & 0x00000001) -#define BB_TPC_20_ENABLE_PAL_MCS_1_MSB 1 -#define BB_TPC_20_ENABLE_PAL_MCS_1_LSB 1 -#define BB_TPC_20_ENABLE_PAL_MCS_1_MASK 0x00000002 -#define BB_TPC_20_ENABLE_PAL_MCS_1_GET(x) (((x) & 0x00000002) >> 1) -#define BB_TPC_20_ENABLE_PAL_MCS_1_SET(x) (((x) << 1) & 0x00000002) -#define BB_TPC_20_ENABLE_PAL_MCS_2_MSB 2 -#define BB_TPC_20_ENABLE_PAL_MCS_2_LSB 2 -#define BB_TPC_20_ENABLE_PAL_MCS_2_MASK 0x00000004 -#define BB_TPC_20_ENABLE_PAL_MCS_2_GET(x) (((x) & 0x00000004) >> 2) -#define BB_TPC_20_ENABLE_PAL_MCS_2_SET(x) (((x) << 2) & 0x00000004) -#define BB_TPC_20_ENABLE_PAL_MCS_3_MSB 3 -#define BB_TPC_20_ENABLE_PAL_MCS_3_LSB 3 -#define BB_TPC_20_ENABLE_PAL_MCS_3_MASK 0x00000008 -#define BB_TPC_20_ENABLE_PAL_MCS_3_GET(x) (((x) & 0x00000008) >> 3) -#define BB_TPC_20_ENABLE_PAL_MCS_3_SET(x) (((x) << 3) & 0x00000008) -#define BB_TPC_20_ENABLE_PAL_MCS_4_MSB 4 -#define BB_TPC_20_ENABLE_PAL_MCS_4_LSB 4 -#define BB_TPC_20_ENABLE_PAL_MCS_4_MASK 0x00000010 -#define BB_TPC_20_ENABLE_PAL_MCS_4_GET(x) (((x) & 0x00000010) >> 4) -#define BB_TPC_20_ENABLE_PAL_MCS_4_SET(x) (((x) << 4) & 0x00000010) -#define BB_TPC_20_ENABLE_PAL_MCS_5_MSB 5 -#define BB_TPC_20_ENABLE_PAL_MCS_5_LSB 5 -#define BB_TPC_20_ENABLE_PAL_MCS_5_MASK 0x00000020 -#define BB_TPC_20_ENABLE_PAL_MCS_5_GET(x) (((x) & 0x00000020) >> 5) -#define BB_TPC_20_ENABLE_PAL_MCS_5_SET(x) (((x) << 5) & 0x00000020) -#define BB_TPC_20_ENABLE_PAL_MCS_6_MSB 6 -#define BB_TPC_20_ENABLE_PAL_MCS_6_LSB 6 -#define BB_TPC_20_ENABLE_PAL_MCS_6_MASK 0x00000040 -#define BB_TPC_20_ENABLE_PAL_MCS_6_GET(x) (((x) & 0x00000040) >> 6) -#define BB_TPC_20_ENABLE_PAL_MCS_6_SET(x) (((x) << 6) & 0x00000040) -#define BB_TPC_20_ENABLE_PAL_MCS_7_MSB 7 -#define BB_TPC_20_ENABLE_PAL_MCS_7_LSB 7 -#define BB_TPC_20_ENABLE_PAL_MCS_7_MASK 0x00000080 -#define BB_TPC_20_ENABLE_PAL_MCS_7_GET(x) (((x) & 0x00000080) >> 7) -#define BB_TPC_20_ENABLE_PAL_MCS_7_SET(x) (((x) << 7) & 0x00000080) -#define BB_TPC_20_ENABLE_PAL_MCS_8_MSB 8 -#define BB_TPC_20_ENABLE_PAL_MCS_8_LSB 8 -#define BB_TPC_20_ENABLE_PAL_MCS_8_MASK 0x00000100 -#define BB_TPC_20_ENABLE_PAL_MCS_8_GET(x) (((x) & 0x00000100) >> 8) -#define BB_TPC_20_ENABLE_PAL_MCS_8_SET(x) (((x) << 8) & 0x00000100) -#define BB_TPC_20_ENABLE_PAL_MCS_9_MSB 9 -#define BB_TPC_20_ENABLE_PAL_MCS_9_LSB 9 -#define BB_TPC_20_ENABLE_PAL_MCS_9_MASK 0x00000200 -#define BB_TPC_20_ENABLE_PAL_MCS_9_GET(x) (((x) & 0x00000200) >> 9) -#define BB_TPC_20_ENABLE_PAL_MCS_9_SET(x) (((x) << 9) & 0x00000200) -#define BB_TPC_20_ENABLE_PAL_MCS_10_MSB 10 -#define BB_TPC_20_ENABLE_PAL_MCS_10_LSB 10 -#define BB_TPC_20_ENABLE_PAL_MCS_10_MASK 0x00000400 -#define BB_TPC_20_ENABLE_PAL_MCS_10_GET(x) (((x) & 0x00000400) >> 10) -#define BB_TPC_20_ENABLE_PAL_MCS_10_SET(x) (((x) << 10) & 0x00000400) -#define BB_TPC_20_ENABLE_PAL_MCS_11_MSB 11 -#define BB_TPC_20_ENABLE_PAL_MCS_11_LSB 11 -#define BB_TPC_20_ENABLE_PAL_MCS_11_MASK 0x00000800 -#define BB_TPC_20_ENABLE_PAL_MCS_11_GET(x) (((x) & 0x00000800) >> 11) -#define BB_TPC_20_ENABLE_PAL_MCS_11_SET(x) (((x) << 11) & 0x00000800) -#define BB_TPC_20_ENABLE_PAL_MCS_12_MSB 12 -#define BB_TPC_20_ENABLE_PAL_MCS_12_LSB 12 -#define BB_TPC_20_ENABLE_PAL_MCS_12_MASK 0x00001000 -#define BB_TPC_20_ENABLE_PAL_MCS_12_GET(x) (((x) & 0x00001000) >> 12) -#define BB_TPC_20_ENABLE_PAL_MCS_12_SET(x) (((x) << 12) & 0x00001000) -#define BB_TPC_20_ENABLE_PAL_MCS_13_MSB 13 -#define BB_TPC_20_ENABLE_PAL_MCS_13_LSB 13 -#define BB_TPC_20_ENABLE_PAL_MCS_13_MASK 0x00002000 -#define BB_TPC_20_ENABLE_PAL_MCS_13_GET(x) (((x) & 0x00002000) >> 13) -#define BB_TPC_20_ENABLE_PAL_MCS_13_SET(x) (((x) << 13) & 0x00002000) -#define BB_TPC_20_ENABLE_PAL_MCS_14_MSB 14 -#define BB_TPC_20_ENABLE_PAL_MCS_14_LSB 14 -#define BB_TPC_20_ENABLE_PAL_MCS_14_MASK 0x00004000 -#define BB_TPC_20_ENABLE_PAL_MCS_14_GET(x) (((x) & 0x00004000) >> 14) -#define BB_TPC_20_ENABLE_PAL_MCS_14_SET(x) (((x) << 14) & 0x00004000) -#define BB_TPC_20_ENABLE_PAL_MCS_15_MSB 15 -#define BB_TPC_20_ENABLE_PAL_MCS_15_LSB 15 -#define BB_TPC_20_ENABLE_PAL_MCS_15_MASK 0x00008000 -#define BB_TPC_20_ENABLE_PAL_MCS_15_GET(x) (((x) & 0x00008000) >> 15) -#define BB_TPC_20_ENABLE_PAL_MCS_15_SET(x) (((x) << 15) & 0x00008000) -#define BB_TPC_20_ENABLE_PAL_MCS_16_MSB 16 -#define BB_TPC_20_ENABLE_PAL_MCS_16_LSB 16 -#define BB_TPC_20_ENABLE_PAL_MCS_16_MASK 0x00010000 -#define BB_TPC_20_ENABLE_PAL_MCS_16_GET(x) (((x) & 0x00010000) >> 16) -#define BB_TPC_20_ENABLE_PAL_MCS_16_SET(x) (((x) << 16) & 0x00010000) -#define BB_TPC_20_ENABLE_PAL_MCS_17_MSB 17 -#define BB_TPC_20_ENABLE_PAL_MCS_17_LSB 17 -#define BB_TPC_20_ENABLE_PAL_MCS_17_MASK 0x00020000 -#define BB_TPC_20_ENABLE_PAL_MCS_17_GET(x) (((x) & 0x00020000) >> 17) -#define BB_TPC_20_ENABLE_PAL_MCS_17_SET(x) (((x) << 17) & 0x00020000) -#define BB_TPC_20_ENABLE_PAL_MCS_18_MSB 18 -#define BB_TPC_20_ENABLE_PAL_MCS_18_LSB 18 -#define BB_TPC_20_ENABLE_PAL_MCS_18_MASK 0x00040000 -#define BB_TPC_20_ENABLE_PAL_MCS_18_GET(x) (((x) & 0x00040000) >> 18) -#define BB_TPC_20_ENABLE_PAL_MCS_18_SET(x) (((x) << 18) & 0x00040000) -#define BB_TPC_20_ENABLE_PAL_MCS_19_MSB 19 -#define BB_TPC_20_ENABLE_PAL_MCS_19_LSB 19 -#define BB_TPC_20_ENABLE_PAL_MCS_19_MASK 0x00080000 -#define BB_TPC_20_ENABLE_PAL_MCS_19_GET(x) (((x) & 0x00080000) >> 19) -#define BB_TPC_20_ENABLE_PAL_MCS_19_SET(x) (((x) << 19) & 0x00080000) -#define BB_TPC_20_ENABLE_PAL_MCS_20_MSB 20 -#define BB_TPC_20_ENABLE_PAL_MCS_20_LSB 20 -#define BB_TPC_20_ENABLE_PAL_MCS_20_MASK 0x00100000 -#define BB_TPC_20_ENABLE_PAL_MCS_20_GET(x) (((x) & 0x00100000) >> 20) -#define BB_TPC_20_ENABLE_PAL_MCS_20_SET(x) (((x) << 20) & 0x00100000) -#define BB_TPC_20_ENABLE_PAL_MCS_21_MSB 21 -#define BB_TPC_20_ENABLE_PAL_MCS_21_LSB 21 -#define BB_TPC_20_ENABLE_PAL_MCS_21_MASK 0x00200000 -#define BB_TPC_20_ENABLE_PAL_MCS_21_GET(x) (((x) & 0x00200000) >> 21) -#define BB_TPC_20_ENABLE_PAL_MCS_21_SET(x) (((x) << 21) & 0x00200000) -#define BB_TPC_20_ENABLE_PAL_MCS_22_MSB 22 -#define BB_TPC_20_ENABLE_PAL_MCS_22_LSB 22 -#define BB_TPC_20_ENABLE_PAL_MCS_22_MASK 0x00400000 -#define BB_TPC_20_ENABLE_PAL_MCS_22_GET(x) (((x) & 0x00400000) >> 22) -#define BB_TPC_20_ENABLE_PAL_MCS_22_SET(x) (((x) << 22) & 0x00400000) -#define BB_TPC_20_ENABLE_PAL_MCS_23_MSB 23 -#define BB_TPC_20_ENABLE_PAL_MCS_23_LSB 23 -#define BB_TPC_20_ENABLE_PAL_MCS_23_MASK 0x00800000 -#define BB_TPC_20_ENABLE_PAL_MCS_23_GET(x) (((x) & 0x00800000) >> 23) -#define BB_TPC_20_ENABLE_PAL_MCS_23_SET(x) (((x) << 23) & 0x00800000) - -/* macros for bb_sm_reg_map.BB_therm_adc_1 */ -#define BB_THERM_ADC_1_ADDRESS 0x00000248 -#define BB_THERM_ADC_1_OFFSET 0x00000248 -#define BB_THERM_ADC_1_INIT_THERM_SETTING_MSB 7 -#define BB_THERM_ADC_1_INIT_THERM_SETTING_LSB 0 -#define BB_THERM_ADC_1_INIT_THERM_SETTING_MASK 0x000000ff -#define BB_THERM_ADC_1_INIT_THERM_SETTING_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_THERM_ADC_1_INIT_THERM_SETTING_SET(x) (((x) << 0) & 0x000000ff) -#define BB_THERM_ADC_1_INIT_VOLT_SETTING_MSB 15 -#define BB_THERM_ADC_1_INIT_VOLT_SETTING_LSB 8 -#define BB_THERM_ADC_1_INIT_VOLT_SETTING_MASK 0x0000ff00 -#define BB_THERM_ADC_1_INIT_VOLT_SETTING_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_THERM_ADC_1_INIT_VOLT_SETTING_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_THERM_ADC_1_INIT_ATB_SETTING_MSB 23 -#define BB_THERM_ADC_1_INIT_ATB_SETTING_LSB 16 -#define BB_THERM_ADC_1_INIT_ATB_SETTING_MASK 0x00ff0000 -#define BB_THERM_ADC_1_INIT_ATB_SETTING_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_THERM_ADC_1_INIT_ATB_SETTING_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_THERM_ADC_1_SAMPLES_CNT_CODING_MSB 25 -#define BB_THERM_ADC_1_SAMPLES_CNT_CODING_LSB 24 -#define BB_THERM_ADC_1_SAMPLES_CNT_CODING_MASK 0x03000000 -#define BB_THERM_ADC_1_SAMPLES_CNT_CODING_GET(x) (((x) & 0x03000000) >> 24) -#define BB_THERM_ADC_1_SAMPLES_CNT_CODING_SET(x) (((x) << 24) & 0x03000000) -#define BB_THERM_ADC_1_USE_INIT_THERM_VOLT_ATB_AFTER_WARM_RESET_MSB 26 -#define BB_THERM_ADC_1_USE_INIT_THERM_VOLT_ATB_AFTER_WARM_RESET_LSB 26 -#define BB_THERM_ADC_1_USE_INIT_THERM_VOLT_ATB_AFTER_WARM_RESET_MASK 0x04000000 -#define BB_THERM_ADC_1_USE_INIT_THERM_VOLT_ATB_AFTER_WARM_RESET_GET(x) (((x) & 0x04000000) >> 26) -#define BB_THERM_ADC_1_USE_INIT_THERM_VOLT_ATB_AFTER_WARM_RESET_SET(x) (((x) << 26) & 0x04000000) -#define BB_THERM_ADC_1_FORCE_THERM_VOLT_ATB_TO_INIT_SETTINGS_MSB 27 -#define BB_THERM_ADC_1_FORCE_THERM_VOLT_ATB_TO_INIT_SETTINGS_LSB 27 -#define BB_THERM_ADC_1_FORCE_THERM_VOLT_ATB_TO_INIT_SETTINGS_MASK 0x08000000 -#define BB_THERM_ADC_1_FORCE_THERM_VOLT_ATB_TO_INIT_SETTINGS_GET(x) (((x) & 0x08000000) >> 27) -#define BB_THERM_ADC_1_FORCE_THERM_VOLT_ATB_TO_INIT_SETTINGS_SET(x) (((x) << 27) & 0x08000000) -#define BB_THERM_ADC_1_CHECK_DONE_FOR_1ST_ADC_MEAS_OF_EACH_FRAME_MSB 28 -#define BB_THERM_ADC_1_CHECK_DONE_FOR_1ST_ADC_MEAS_OF_EACH_FRAME_LSB 28 -#define BB_THERM_ADC_1_CHECK_DONE_FOR_1ST_ADC_MEAS_OF_EACH_FRAME_MASK 0x10000000 -#define BB_THERM_ADC_1_CHECK_DONE_FOR_1ST_ADC_MEAS_OF_EACH_FRAME_GET(x) (((x) & 0x10000000) >> 28) -#define BB_THERM_ADC_1_CHECK_DONE_FOR_1ST_ADC_MEAS_OF_EACH_FRAME_SET(x) (((x) << 28) & 0x10000000) -#define BB_THERM_ADC_1_THERM_MEASURE_RESET_MSB 29 -#define BB_THERM_ADC_1_THERM_MEASURE_RESET_LSB 29 -#define BB_THERM_ADC_1_THERM_MEASURE_RESET_MASK 0x20000000 -#define BB_THERM_ADC_1_THERM_MEASURE_RESET_GET(x) (((x) & 0x20000000) >> 29) -#define BB_THERM_ADC_1_THERM_MEASURE_RESET_SET(x) (((x) << 29) & 0x20000000) - -/* macros for bb_sm_reg_map.BB_therm_adc_2 */ -#define BB_THERM_ADC_2_ADDRESS 0x0000024c -#define BB_THERM_ADC_2_OFFSET 0x0000024c -#define BB_THERM_ADC_2_MEASURE_THERM_FREQ_MSB 11 -#define BB_THERM_ADC_2_MEASURE_THERM_FREQ_LSB 0 -#define BB_THERM_ADC_2_MEASURE_THERM_FREQ_MASK 0x00000fff -#define BB_THERM_ADC_2_MEASURE_THERM_FREQ_GET(x) (((x) & 0x00000fff) >> 0) -#define BB_THERM_ADC_2_MEASURE_THERM_FREQ_SET(x) (((x) << 0) & 0x00000fff) -#define BB_THERM_ADC_2_MEASURE_VOLT_FREQ_MSB 21 -#define BB_THERM_ADC_2_MEASURE_VOLT_FREQ_LSB 12 -#define BB_THERM_ADC_2_MEASURE_VOLT_FREQ_MASK 0x003ff000 -#define BB_THERM_ADC_2_MEASURE_VOLT_FREQ_GET(x) (((x) & 0x003ff000) >> 12) -#define BB_THERM_ADC_2_MEASURE_VOLT_FREQ_SET(x) (((x) << 12) & 0x003ff000) -#define BB_THERM_ADC_2_MEASURE_ATB_FREQ_MSB 31 -#define BB_THERM_ADC_2_MEASURE_ATB_FREQ_LSB 22 -#define BB_THERM_ADC_2_MEASURE_ATB_FREQ_MASK 0xffc00000 -#define BB_THERM_ADC_2_MEASURE_ATB_FREQ_GET(x) (((x) & 0xffc00000) >> 22) -#define BB_THERM_ADC_2_MEASURE_ATB_FREQ_SET(x) (((x) << 22) & 0xffc00000) - -/* macros for bb_sm_reg_map.BB_therm_adc_3 */ -#define BB_THERM_ADC_3_ADDRESS 0x00000250 -#define BB_THERM_ADC_3_OFFSET 0x00000250 -#define BB_THERM_ADC_3_THERM_ADC_OFFSET_MSB 7 -#define BB_THERM_ADC_3_THERM_ADC_OFFSET_LSB 0 -#define BB_THERM_ADC_3_THERM_ADC_OFFSET_MASK 0x000000ff -#define BB_THERM_ADC_3_THERM_ADC_OFFSET_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_THERM_ADC_3_THERM_ADC_OFFSET_SET(x) (((x) << 0) & 0x000000ff) -#define BB_THERM_ADC_3_THERM_ADC_SCALED_GAIN_MSB 16 -#define BB_THERM_ADC_3_THERM_ADC_SCALED_GAIN_LSB 8 -#define BB_THERM_ADC_3_THERM_ADC_SCALED_GAIN_MASK 0x0001ff00 -#define BB_THERM_ADC_3_THERM_ADC_SCALED_GAIN_GET(x) (((x) & 0x0001ff00) >> 8) -#define BB_THERM_ADC_3_THERM_ADC_SCALED_GAIN_SET(x) (((x) << 8) & 0x0001ff00) -#define BB_THERM_ADC_3_ADC_INTERVAL_MSB 29 -#define BB_THERM_ADC_3_ADC_INTERVAL_LSB 17 -#define BB_THERM_ADC_3_ADC_INTERVAL_MASK 0x3ffe0000 -#define BB_THERM_ADC_3_ADC_INTERVAL_GET(x) (((x) & 0x3ffe0000) >> 17) -#define BB_THERM_ADC_3_ADC_INTERVAL_SET(x) (((x) << 17) & 0x3ffe0000) - -/* macros for bb_sm_reg_map.BB_therm_adc_4 */ -#define BB_THERM_ADC_4_ADDRESS 0x00000254 -#define BB_THERM_ADC_4_OFFSET 0x00000254 -#define BB_THERM_ADC_4_LATEST_THERM_VALUE_MSB 7 -#define BB_THERM_ADC_4_LATEST_THERM_VALUE_LSB 0 -#define BB_THERM_ADC_4_LATEST_THERM_VALUE_MASK 0x000000ff -#define BB_THERM_ADC_4_LATEST_THERM_VALUE_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_THERM_ADC_4_LATEST_VOLT_VALUE_MSB 15 -#define BB_THERM_ADC_4_LATEST_VOLT_VALUE_LSB 8 -#define BB_THERM_ADC_4_LATEST_VOLT_VALUE_MASK 0x0000ff00 -#define BB_THERM_ADC_4_LATEST_VOLT_VALUE_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_THERM_ADC_4_LATEST_ATB_VALUE_MSB 23 -#define BB_THERM_ADC_4_LATEST_ATB_VALUE_LSB 16 -#define BB_THERM_ADC_4_LATEST_ATB_VALUE_MASK 0x00ff0000 -#define BB_THERM_ADC_4_LATEST_ATB_VALUE_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_THERM_ADC_4_FORCE_THERM_CHAIN_MSB 24 -#define BB_THERM_ADC_4_FORCE_THERM_CHAIN_LSB 24 -#define BB_THERM_ADC_4_FORCE_THERM_CHAIN_MASK 0x01000000 -#define BB_THERM_ADC_4_FORCE_THERM_CHAIN_GET(x) (((x) & 0x01000000) >> 24) -#define BB_THERM_ADC_4_FORCE_THERM_CHAIN_SET(x) (((x) << 24) & 0x01000000) -#define BB_THERM_ADC_4_PREFERRED_THERM_CHAIN_MSB 27 -#define BB_THERM_ADC_4_PREFERRED_THERM_CHAIN_LSB 25 -#define BB_THERM_ADC_4_PREFERRED_THERM_CHAIN_MASK 0x0e000000 -#define BB_THERM_ADC_4_PREFERRED_THERM_CHAIN_GET(x) (((x) & 0x0e000000) >> 25) -#define BB_THERM_ADC_4_PREFERRED_THERM_CHAIN_SET(x) (((x) << 25) & 0x0e000000) - -/* macros for bb_sm_reg_map.BB_tx_forced_gain */ -#define BB_TX_FORCED_GAIN_ADDRESS 0x00000258 -#define BB_TX_FORCED_GAIN_OFFSET 0x00000258 -#define BB_TX_FORCED_GAIN_FORCE_TX_GAIN_MSB 0 -#define BB_TX_FORCED_GAIN_FORCE_TX_GAIN_LSB 0 -#define BB_TX_FORCED_GAIN_FORCE_TX_GAIN_MASK 0x00000001 -#define BB_TX_FORCED_GAIN_FORCE_TX_GAIN_GET(x) (((x) & 0x00000001) >> 0) -#define BB_TX_FORCED_GAIN_FORCE_TX_GAIN_SET(x) (((x) << 0) & 0x00000001) -#define BB_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN_MSB 3 -#define BB_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN_LSB 1 -#define BB_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN_MASK 0x0000000e -#define BB_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN_GET(x) (((x) & 0x0000000e) >> 1) -#define BB_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN_SET(x) (((x) << 1) & 0x0000000e) -#define BB_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN_MSB 5 -#define BB_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN_LSB 4 -#define BB_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN_MASK 0x00000030 -#define BB_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN_GET(x) (((x) & 0x00000030) >> 4) -#define BB_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN_SET(x) (((x) << 4) & 0x00000030) -#define BB_TX_FORCED_GAIN_FORCED_TXMXRGAIN_MSB 9 -#define BB_TX_FORCED_GAIN_FORCED_TXMXRGAIN_LSB 6 -#define BB_TX_FORCED_GAIN_FORCED_TXMXRGAIN_MASK 0x000003c0 -#define BB_TX_FORCED_GAIN_FORCED_TXMXRGAIN_GET(x) (((x) & 0x000003c0) >> 6) -#define BB_TX_FORCED_GAIN_FORCED_TXMXRGAIN_SET(x) (((x) << 6) & 0x000003c0) -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNA_MSB 13 -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNA_LSB 10 -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNA_MASK 0x00003c00 -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNA_GET(x) (((x) & 0x00003c00) >> 10) -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNA_SET(x) (((x) << 10) & 0x00003c00) -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNB_MSB 17 -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNB_LSB 14 -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNB_MASK 0x0003c000 -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNB_GET(x) (((x) & 0x0003c000) >> 14) -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNB_SET(x) (((x) << 14) & 0x0003c000) -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNC_MSB 21 -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNC_LSB 18 -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNC_MASK 0x003c0000 -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNC_GET(x) (((x) & 0x003c0000) >> 18) -#define BB_TX_FORCED_GAIN_FORCED_PADRVGNC_SET(x) (((x) << 18) & 0x003c0000) -#define BB_TX_FORCED_GAIN_FORCED_PADRVGND_MSB 23 -#define BB_TX_FORCED_GAIN_FORCED_PADRVGND_LSB 22 -#define BB_TX_FORCED_GAIN_FORCED_PADRVGND_MASK 0x00c00000 -#define BB_TX_FORCED_GAIN_FORCED_PADRVGND_GET(x) (((x) & 0x00c00000) >> 22) -#define BB_TX_FORCED_GAIN_FORCED_PADRVGND_SET(x) (((x) << 22) & 0x00c00000) -#define BB_TX_FORCED_GAIN_FORCED_ENABLE_PAL_MSB 24 -#define BB_TX_FORCED_GAIN_FORCED_ENABLE_PAL_LSB 24 -#define BB_TX_FORCED_GAIN_FORCED_ENABLE_PAL_MASK 0x01000000 -#define BB_TX_FORCED_GAIN_FORCED_ENABLE_PAL_GET(x) (((x) & 0x01000000) >> 24) -#define BB_TX_FORCED_GAIN_FORCED_ENABLE_PAL_SET(x) (((x) << 24) & 0x01000000) -#define BB_TX_FORCED_GAIN_FORCED_OB_MSB 27 -#define BB_TX_FORCED_GAIN_FORCED_OB_LSB 25 -#define BB_TX_FORCED_GAIN_FORCED_OB_MASK 0x0e000000 -#define BB_TX_FORCED_GAIN_FORCED_OB_GET(x) (((x) & 0x0e000000) >> 25) -#define BB_TX_FORCED_GAIN_FORCED_OB_SET(x) (((x) << 25) & 0x0e000000) -#define BB_TX_FORCED_GAIN_FORCED_DB_MSB 30 -#define BB_TX_FORCED_GAIN_FORCED_DB_LSB 28 -#define BB_TX_FORCED_GAIN_FORCED_DB_MASK 0x70000000 -#define BB_TX_FORCED_GAIN_FORCED_DB_GET(x) (((x) & 0x70000000) >> 28) -#define BB_TX_FORCED_GAIN_FORCED_DB_SET(x) (((x) << 28) & 0x70000000) -#define BB_TX_FORCED_GAIN_FORCED_GREEN_PAPRD_ENABLE_MSB 31 -#define BB_TX_FORCED_GAIN_FORCED_GREEN_PAPRD_ENABLE_LSB 31 -#define BB_TX_FORCED_GAIN_FORCED_GREEN_PAPRD_ENABLE_MASK 0x80000000 -#define BB_TX_FORCED_GAIN_FORCED_GREEN_PAPRD_ENABLE_GET(x) (((x) & 0x80000000) >> 31) -#define BB_TX_FORCED_GAIN_FORCED_GREEN_PAPRD_ENABLE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_sm_reg_map.BB_pdadc_tab_b0 */ -#define BB_PDADC_TAB_B0_ADDRESS 0x00000280 -#define BB_PDADC_TAB_B0_OFFSET 0x00000280 -#define BB_PDADC_TAB_B0_TAB_ENTRY_MSB 31 -#define BB_PDADC_TAB_B0_TAB_ENTRY_LSB 0 -#define BB_PDADC_TAB_B0_TAB_ENTRY_MASK 0xffffffff -#define BB_PDADC_TAB_B0_TAB_ENTRY_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_1 */ -#define BB_TX_GAIN_TAB_1_ADDRESS 0x00000300 -#define BB_TX_GAIN_TAB_1_OFFSET 0x00000300 -#define BB_TX_GAIN_TAB_1_TG_TABLE1_MSB 31 -#define BB_TX_GAIN_TAB_1_TG_TABLE1_LSB 0 -#define BB_TX_GAIN_TAB_1_TG_TABLE1_MASK 0xffffffff -#define BB_TX_GAIN_TAB_1_TG_TABLE1_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_1_TG_TABLE1_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_2 */ -#define BB_TX_GAIN_TAB_2_ADDRESS 0x00000304 -#define BB_TX_GAIN_TAB_2_OFFSET 0x00000304 -#define BB_TX_GAIN_TAB_2_TG_TABLE2_MSB 31 -#define BB_TX_GAIN_TAB_2_TG_TABLE2_LSB 0 -#define BB_TX_GAIN_TAB_2_TG_TABLE2_MASK 0xffffffff -#define BB_TX_GAIN_TAB_2_TG_TABLE2_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_2_TG_TABLE2_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_3 */ -#define BB_TX_GAIN_TAB_3_ADDRESS 0x00000308 -#define BB_TX_GAIN_TAB_3_OFFSET 0x00000308 -#define BB_TX_GAIN_TAB_3_TG_TABLE3_MSB 31 -#define BB_TX_GAIN_TAB_3_TG_TABLE3_LSB 0 -#define BB_TX_GAIN_TAB_3_TG_TABLE3_MASK 0xffffffff -#define BB_TX_GAIN_TAB_3_TG_TABLE3_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_3_TG_TABLE3_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_4 */ -#define BB_TX_GAIN_TAB_4_ADDRESS 0x0000030c -#define BB_TX_GAIN_TAB_4_OFFSET 0x0000030c -#define BB_TX_GAIN_TAB_4_TG_TABLE4_MSB 31 -#define BB_TX_GAIN_TAB_4_TG_TABLE4_LSB 0 -#define BB_TX_GAIN_TAB_4_TG_TABLE4_MASK 0xffffffff -#define BB_TX_GAIN_TAB_4_TG_TABLE4_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_4_TG_TABLE4_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_5 */ -#define BB_TX_GAIN_TAB_5_ADDRESS 0x00000310 -#define BB_TX_GAIN_TAB_5_OFFSET 0x00000310 -#define BB_TX_GAIN_TAB_5_TG_TABLE5_MSB 31 -#define BB_TX_GAIN_TAB_5_TG_TABLE5_LSB 0 -#define BB_TX_GAIN_TAB_5_TG_TABLE5_MASK 0xffffffff -#define BB_TX_GAIN_TAB_5_TG_TABLE5_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_5_TG_TABLE5_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_6 */ -#define BB_TX_GAIN_TAB_6_ADDRESS 0x00000314 -#define BB_TX_GAIN_TAB_6_OFFSET 0x00000314 -#define BB_TX_GAIN_TAB_6_TG_TABLE6_MSB 31 -#define BB_TX_GAIN_TAB_6_TG_TABLE6_LSB 0 -#define BB_TX_GAIN_TAB_6_TG_TABLE6_MASK 0xffffffff -#define BB_TX_GAIN_TAB_6_TG_TABLE6_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_6_TG_TABLE6_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_7 */ -#define BB_TX_GAIN_TAB_7_ADDRESS 0x00000318 -#define BB_TX_GAIN_TAB_7_OFFSET 0x00000318 -#define BB_TX_GAIN_TAB_7_TG_TABLE7_MSB 31 -#define BB_TX_GAIN_TAB_7_TG_TABLE7_LSB 0 -#define BB_TX_GAIN_TAB_7_TG_TABLE7_MASK 0xffffffff -#define BB_TX_GAIN_TAB_7_TG_TABLE7_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_7_TG_TABLE7_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_8 */ -#define BB_TX_GAIN_TAB_8_ADDRESS 0x0000031c -#define BB_TX_GAIN_TAB_8_OFFSET 0x0000031c -#define BB_TX_GAIN_TAB_8_TG_TABLE8_MSB 31 -#define BB_TX_GAIN_TAB_8_TG_TABLE8_LSB 0 -#define BB_TX_GAIN_TAB_8_TG_TABLE8_MASK 0xffffffff -#define BB_TX_GAIN_TAB_8_TG_TABLE8_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_8_TG_TABLE8_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_9 */ -#define BB_TX_GAIN_TAB_9_ADDRESS 0x00000320 -#define BB_TX_GAIN_TAB_9_OFFSET 0x00000320 -#define BB_TX_GAIN_TAB_9_TG_TABLE9_MSB 31 -#define BB_TX_GAIN_TAB_9_TG_TABLE9_LSB 0 -#define BB_TX_GAIN_TAB_9_TG_TABLE9_MASK 0xffffffff -#define BB_TX_GAIN_TAB_9_TG_TABLE9_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_9_TG_TABLE9_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_10 */ -#define BB_TX_GAIN_TAB_10_ADDRESS 0x00000324 -#define BB_TX_GAIN_TAB_10_OFFSET 0x00000324 -#define BB_TX_GAIN_TAB_10_TG_TABLE10_MSB 31 -#define BB_TX_GAIN_TAB_10_TG_TABLE10_LSB 0 -#define BB_TX_GAIN_TAB_10_TG_TABLE10_MASK 0xffffffff -#define BB_TX_GAIN_TAB_10_TG_TABLE10_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_10_TG_TABLE10_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_11 */ -#define BB_TX_GAIN_TAB_11_ADDRESS 0x00000328 -#define BB_TX_GAIN_TAB_11_OFFSET 0x00000328 -#define BB_TX_GAIN_TAB_11_TG_TABLE11_MSB 31 -#define BB_TX_GAIN_TAB_11_TG_TABLE11_LSB 0 -#define BB_TX_GAIN_TAB_11_TG_TABLE11_MASK 0xffffffff -#define BB_TX_GAIN_TAB_11_TG_TABLE11_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_11_TG_TABLE11_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_12 */ -#define BB_TX_GAIN_TAB_12_ADDRESS 0x0000032c -#define BB_TX_GAIN_TAB_12_OFFSET 0x0000032c -#define BB_TX_GAIN_TAB_12_TG_TABLE12_MSB 31 -#define BB_TX_GAIN_TAB_12_TG_TABLE12_LSB 0 -#define BB_TX_GAIN_TAB_12_TG_TABLE12_MASK 0xffffffff -#define BB_TX_GAIN_TAB_12_TG_TABLE12_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_12_TG_TABLE12_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_13 */ -#define BB_TX_GAIN_TAB_13_ADDRESS 0x00000330 -#define BB_TX_GAIN_TAB_13_OFFSET 0x00000330 -#define BB_TX_GAIN_TAB_13_TG_TABLE13_MSB 31 -#define BB_TX_GAIN_TAB_13_TG_TABLE13_LSB 0 -#define BB_TX_GAIN_TAB_13_TG_TABLE13_MASK 0xffffffff -#define BB_TX_GAIN_TAB_13_TG_TABLE13_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_13_TG_TABLE13_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_14 */ -#define BB_TX_GAIN_TAB_14_ADDRESS 0x00000334 -#define BB_TX_GAIN_TAB_14_OFFSET 0x00000334 -#define BB_TX_GAIN_TAB_14_TG_TABLE14_MSB 31 -#define BB_TX_GAIN_TAB_14_TG_TABLE14_LSB 0 -#define BB_TX_GAIN_TAB_14_TG_TABLE14_MASK 0xffffffff -#define BB_TX_GAIN_TAB_14_TG_TABLE14_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_14_TG_TABLE14_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_15 */ -#define BB_TX_GAIN_TAB_15_ADDRESS 0x00000338 -#define BB_TX_GAIN_TAB_15_OFFSET 0x00000338 -#define BB_TX_GAIN_TAB_15_TG_TABLE15_MSB 31 -#define BB_TX_GAIN_TAB_15_TG_TABLE15_LSB 0 -#define BB_TX_GAIN_TAB_15_TG_TABLE15_MASK 0xffffffff -#define BB_TX_GAIN_TAB_15_TG_TABLE15_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_15_TG_TABLE15_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_16 */ -#define BB_TX_GAIN_TAB_16_ADDRESS 0x0000033c -#define BB_TX_GAIN_TAB_16_OFFSET 0x0000033c -#define BB_TX_GAIN_TAB_16_TG_TABLE16_MSB 31 -#define BB_TX_GAIN_TAB_16_TG_TABLE16_LSB 0 -#define BB_TX_GAIN_TAB_16_TG_TABLE16_MASK 0xffffffff -#define BB_TX_GAIN_TAB_16_TG_TABLE16_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_16_TG_TABLE16_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_17 */ -#define BB_TX_GAIN_TAB_17_ADDRESS 0x00000340 -#define BB_TX_GAIN_TAB_17_OFFSET 0x00000340 -#define BB_TX_GAIN_TAB_17_TG_TABLE17_MSB 31 -#define BB_TX_GAIN_TAB_17_TG_TABLE17_LSB 0 -#define BB_TX_GAIN_TAB_17_TG_TABLE17_MASK 0xffffffff -#define BB_TX_GAIN_TAB_17_TG_TABLE17_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_17_TG_TABLE17_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_18 */ -#define BB_TX_GAIN_TAB_18_ADDRESS 0x00000344 -#define BB_TX_GAIN_TAB_18_OFFSET 0x00000344 -#define BB_TX_GAIN_TAB_18_TG_TABLE18_MSB 31 -#define BB_TX_GAIN_TAB_18_TG_TABLE18_LSB 0 -#define BB_TX_GAIN_TAB_18_TG_TABLE18_MASK 0xffffffff -#define BB_TX_GAIN_TAB_18_TG_TABLE18_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_18_TG_TABLE18_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_19 */ -#define BB_TX_GAIN_TAB_19_ADDRESS 0x00000348 -#define BB_TX_GAIN_TAB_19_OFFSET 0x00000348 -#define BB_TX_GAIN_TAB_19_TG_TABLE19_MSB 31 -#define BB_TX_GAIN_TAB_19_TG_TABLE19_LSB 0 -#define BB_TX_GAIN_TAB_19_TG_TABLE19_MASK 0xffffffff -#define BB_TX_GAIN_TAB_19_TG_TABLE19_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_19_TG_TABLE19_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_20 */ -#define BB_TX_GAIN_TAB_20_ADDRESS 0x0000034c -#define BB_TX_GAIN_TAB_20_OFFSET 0x0000034c -#define BB_TX_GAIN_TAB_20_TG_TABLE20_MSB 31 -#define BB_TX_GAIN_TAB_20_TG_TABLE20_LSB 0 -#define BB_TX_GAIN_TAB_20_TG_TABLE20_MASK 0xffffffff -#define BB_TX_GAIN_TAB_20_TG_TABLE20_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_20_TG_TABLE20_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_21 */ -#define BB_TX_GAIN_TAB_21_ADDRESS 0x00000350 -#define BB_TX_GAIN_TAB_21_OFFSET 0x00000350 -#define BB_TX_GAIN_TAB_21_TG_TABLE21_MSB 31 -#define BB_TX_GAIN_TAB_21_TG_TABLE21_LSB 0 -#define BB_TX_GAIN_TAB_21_TG_TABLE21_MASK 0xffffffff -#define BB_TX_GAIN_TAB_21_TG_TABLE21_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_21_TG_TABLE21_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_22 */ -#define BB_TX_GAIN_TAB_22_ADDRESS 0x00000354 -#define BB_TX_GAIN_TAB_22_OFFSET 0x00000354 -#define BB_TX_GAIN_TAB_22_TG_TABLE22_MSB 31 -#define BB_TX_GAIN_TAB_22_TG_TABLE22_LSB 0 -#define BB_TX_GAIN_TAB_22_TG_TABLE22_MASK 0xffffffff -#define BB_TX_GAIN_TAB_22_TG_TABLE22_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_22_TG_TABLE22_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_23 */ -#define BB_TX_GAIN_TAB_23_ADDRESS 0x00000358 -#define BB_TX_GAIN_TAB_23_OFFSET 0x00000358 -#define BB_TX_GAIN_TAB_23_TG_TABLE23_MSB 31 -#define BB_TX_GAIN_TAB_23_TG_TABLE23_LSB 0 -#define BB_TX_GAIN_TAB_23_TG_TABLE23_MASK 0xffffffff -#define BB_TX_GAIN_TAB_23_TG_TABLE23_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_23_TG_TABLE23_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_24 */ -#define BB_TX_GAIN_TAB_24_ADDRESS 0x0000035c -#define BB_TX_GAIN_TAB_24_OFFSET 0x0000035c -#define BB_TX_GAIN_TAB_24_TG_TABLE24_MSB 31 -#define BB_TX_GAIN_TAB_24_TG_TABLE24_LSB 0 -#define BB_TX_GAIN_TAB_24_TG_TABLE24_MASK 0xffffffff -#define BB_TX_GAIN_TAB_24_TG_TABLE24_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_24_TG_TABLE24_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_25 */ -#define BB_TX_GAIN_TAB_25_ADDRESS 0x00000360 -#define BB_TX_GAIN_TAB_25_OFFSET 0x00000360 -#define BB_TX_GAIN_TAB_25_TG_TABLE25_MSB 31 -#define BB_TX_GAIN_TAB_25_TG_TABLE25_LSB 0 -#define BB_TX_GAIN_TAB_25_TG_TABLE25_MASK 0xffffffff -#define BB_TX_GAIN_TAB_25_TG_TABLE25_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_25_TG_TABLE25_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_26 */ -#define BB_TX_GAIN_TAB_26_ADDRESS 0x00000364 -#define BB_TX_GAIN_TAB_26_OFFSET 0x00000364 -#define BB_TX_GAIN_TAB_26_TG_TABLE26_MSB 31 -#define BB_TX_GAIN_TAB_26_TG_TABLE26_LSB 0 -#define BB_TX_GAIN_TAB_26_TG_TABLE26_MASK 0xffffffff -#define BB_TX_GAIN_TAB_26_TG_TABLE26_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_26_TG_TABLE26_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_27 */ -#define BB_TX_GAIN_TAB_27_ADDRESS 0x00000368 -#define BB_TX_GAIN_TAB_27_OFFSET 0x00000368 -#define BB_TX_GAIN_TAB_27_TG_TABLE27_MSB 31 -#define BB_TX_GAIN_TAB_27_TG_TABLE27_LSB 0 -#define BB_TX_GAIN_TAB_27_TG_TABLE27_MASK 0xffffffff -#define BB_TX_GAIN_TAB_27_TG_TABLE27_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_27_TG_TABLE27_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_28 */ -#define BB_TX_GAIN_TAB_28_ADDRESS 0x0000036c -#define BB_TX_GAIN_TAB_28_OFFSET 0x0000036c -#define BB_TX_GAIN_TAB_28_TG_TABLE28_MSB 31 -#define BB_TX_GAIN_TAB_28_TG_TABLE28_LSB 0 -#define BB_TX_GAIN_TAB_28_TG_TABLE28_MASK 0xffffffff -#define BB_TX_GAIN_TAB_28_TG_TABLE28_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_28_TG_TABLE28_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_29 */ -#define BB_TX_GAIN_TAB_29_ADDRESS 0x00000370 -#define BB_TX_GAIN_TAB_29_OFFSET 0x00000370 -#define BB_TX_GAIN_TAB_29_TG_TABLE29_MSB 31 -#define BB_TX_GAIN_TAB_29_TG_TABLE29_LSB 0 -#define BB_TX_GAIN_TAB_29_TG_TABLE29_MASK 0xffffffff -#define BB_TX_GAIN_TAB_29_TG_TABLE29_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_29_TG_TABLE29_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_30 */ -#define BB_TX_GAIN_TAB_30_ADDRESS 0x00000374 -#define BB_TX_GAIN_TAB_30_OFFSET 0x00000374 -#define BB_TX_GAIN_TAB_30_TG_TABLE30_MSB 31 -#define BB_TX_GAIN_TAB_30_TG_TABLE30_LSB 0 -#define BB_TX_GAIN_TAB_30_TG_TABLE30_MASK 0xffffffff -#define BB_TX_GAIN_TAB_30_TG_TABLE30_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_30_TG_TABLE30_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_31 */ -#define BB_TX_GAIN_TAB_31_ADDRESS 0x00000378 -#define BB_TX_GAIN_TAB_31_OFFSET 0x00000378 -#define BB_TX_GAIN_TAB_31_TG_TABLE31_MSB 31 -#define BB_TX_GAIN_TAB_31_TG_TABLE31_LSB 0 -#define BB_TX_GAIN_TAB_31_TG_TABLE31_MASK 0xffffffff -#define BB_TX_GAIN_TAB_31_TG_TABLE31_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_31_TG_TABLE31_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_32 */ -#define BB_TX_GAIN_TAB_32_ADDRESS 0x0000037c -#define BB_TX_GAIN_TAB_32_OFFSET 0x0000037c -#define BB_TX_GAIN_TAB_32_TG_TABLE32_MSB 31 -#define BB_TX_GAIN_TAB_32_TG_TABLE32_LSB 0 -#define BB_TX_GAIN_TAB_32_TG_TABLE32_MASK 0xffffffff -#define BB_TX_GAIN_TAB_32_TG_TABLE32_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_32_TG_TABLE32_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_rtt_ctrl */ -#define BB_RTT_CTRL_ADDRESS 0x00000380 -#define BB_RTT_CTRL_OFFSET 0x00000380 -#define BB_RTT_CTRL_ENA_RADIO_RETENTION_MSB 0 -#define BB_RTT_CTRL_ENA_RADIO_RETENTION_LSB 0 -#define BB_RTT_CTRL_ENA_RADIO_RETENTION_MASK 0x00000001 -#define BB_RTT_CTRL_ENA_RADIO_RETENTION_GET(x) (((x) & 0x00000001) >> 0) -#define BB_RTT_CTRL_ENA_RADIO_RETENTION_SET(x) (((x) << 0) & 0x00000001) -#define BB_RTT_CTRL_RESTORE_MASK_MSB 6 -#define BB_RTT_CTRL_RESTORE_MASK_LSB 1 -#define BB_RTT_CTRL_RESTORE_MASK_MASK 0x0000007e -#define BB_RTT_CTRL_RESTORE_MASK_GET(x) (((x) & 0x0000007e) >> 1) -#define BB_RTT_CTRL_RESTORE_MASK_SET(x) (((x) << 1) & 0x0000007e) -#define BB_RTT_CTRL_FORCE_RADIO_RESTORE_MSB 7 -#define BB_RTT_CTRL_FORCE_RADIO_RESTORE_LSB 7 -#define BB_RTT_CTRL_FORCE_RADIO_RESTORE_MASK 0x00000080 -#define BB_RTT_CTRL_FORCE_RADIO_RESTORE_GET(x) (((x) & 0x00000080) >> 7) -#define BB_RTT_CTRL_FORCE_RADIO_RESTORE_SET(x) (((x) << 7) & 0x00000080) - -/* macros for bb_sm_reg_map.BB_rtt_table_sw_intf_b0 */ -#define BB_RTT_TABLE_SW_INTF_B0_ADDRESS 0x00000384 -#define BB_RTT_TABLE_SW_INTF_B0_OFFSET 0x00000384 -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_ACCESS_0_MSB 0 -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_ACCESS_0_LSB 0 -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_ACCESS_0_MASK 0x00000001 -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_ACCESS_0_GET(x) (((x) & 0x00000001) >> 0) -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_ACCESS_0_SET(x) (((x) << 0) & 0x00000001) -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_WRITE_0_MSB 1 -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_WRITE_0_LSB 1 -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_WRITE_0_MASK 0x00000002 -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_WRITE_0_GET(x) (((x) & 0x00000002) >> 1) -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_WRITE_0_SET(x) (((x) << 1) & 0x00000002) -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_ADDR_0_MSB 4 -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_ADDR_0_LSB 2 -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_ADDR_0_MASK 0x0000001c -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_ADDR_0_GET(x) (((x) & 0x0000001c) >> 2) -#define BB_RTT_TABLE_SW_INTF_B0_SW_RTT_TABLE_ADDR_0_SET(x) (((x) << 2) & 0x0000001c) - -/* macros for bb_sm_reg_map.BB_rtt_table_sw_intf_1_b0 */ -#define BB_RTT_TABLE_SW_INTF_1_B0_ADDRESS 0x00000388 -#define BB_RTT_TABLE_SW_INTF_1_B0_OFFSET 0x00000388 -#define BB_RTT_TABLE_SW_INTF_1_B0_SW_RTT_TABLE_DATA_0_MSB 31 -#define BB_RTT_TABLE_SW_INTF_1_B0_SW_RTT_TABLE_DATA_0_LSB 4 -#define BB_RTT_TABLE_SW_INTF_1_B0_SW_RTT_TABLE_DATA_0_MASK 0xfffffff0 -#define BB_RTT_TABLE_SW_INTF_1_B0_SW_RTT_TABLE_DATA_0_GET(x) (((x) & 0xfffffff0) >> 4) -#define BB_RTT_TABLE_SW_INTF_1_B0_SW_RTT_TABLE_DATA_0_SET(x) (((x) << 4) & 0xfffffff0) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_1_16_lsb_ext */ -#define BB_TX_GAIN_TAB_1_16_LSB_EXT_ADDRESS 0x0000038c -#define BB_TX_GAIN_TAB_1_16_LSB_EXT_OFFSET 0x0000038c -#define BB_TX_GAIN_TAB_1_16_LSB_EXT_TG_TABLE1_16_LSB_EXT_MSB 31 -#define BB_TX_GAIN_TAB_1_16_LSB_EXT_TG_TABLE1_16_LSB_EXT_LSB 0 -#define BB_TX_GAIN_TAB_1_16_LSB_EXT_TG_TABLE1_16_LSB_EXT_MASK 0xffffffff -#define BB_TX_GAIN_TAB_1_16_LSB_EXT_TG_TABLE1_16_LSB_EXT_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_1_16_LSB_EXT_TG_TABLE1_16_LSB_EXT_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_tx_gain_tab_17_32_lsb_ext */ -#define BB_TX_GAIN_TAB_17_32_LSB_EXT_ADDRESS 0x00000390 -#define BB_TX_GAIN_TAB_17_32_LSB_EXT_OFFSET 0x00000390 -#define BB_TX_GAIN_TAB_17_32_LSB_EXT_TG_TABLE17_32_LSB_EXT_MSB 31 -#define BB_TX_GAIN_TAB_17_32_LSB_EXT_TG_TABLE17_32_LSB_EXT_LSB 0 -#define BB_TX_GAIN_TAB_17_32_LSB_EXT_TG_TABLE17_32_LSB_EXT_MASK 0xffffffff -#define BB_TX_GAIN_TAB_17_32_LSB_EXT_TG_TABLE17_32_LSB_EXT_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TX_GAIN_TAB_17_32_LSB_EXT_TG_TABLE17_32_LSB_EXT_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_0 */ -#define BB_CALTX_GAIN_SET_0_ADDRESS 0x00000400 -#define BB_CALTX_GAIN_SET_0_OFFSET 0x00000400 -#define BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_0_MSB 13 -#define BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_0_LSB 0 -#define BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_0_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_0_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_0_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_1_MSB 27 -#define BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_1_LSB 14 -#define BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_1_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_1_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_0_CALTX_GAIN_SET_1_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_2 */ -#define BB_CALTX_GAIN_SET_2_ADDRESS 0x00000404 -#define BB_CALTX_GAIN_SET_2_OFFSET 0x00000404 -#define BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_2_MSB 13 -#define BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_2_LSB 0 -#define BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_2_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_2_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_2_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_3_MSB 27 -#define BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_3_LSB 14 -#define BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_3_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_3_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_2_CALTX_GAIN_SET_3_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_4 */ -#define BB_CALTX_GAIN_SET_4_ADDRESS 0x00000408 -#define BB_CALTX_GAIN_SET_4_OFFSET 0x00000408 -#define BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_4_MSB 13 -#define BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_4_LSB 0 -#define BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_4_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_4_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_4_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_5_MSB 27 -#define BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_5_LSB 14 -#define BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_5_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_5_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_4_CALTX_GAIN_SET_5_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_6 */ -#define BB_CALTX_GAIN_SET_6_ADDRESS 0x0000040c -#define BB_CALTX_GAIN_SET_6_OFFSET 0x0000040c -#define BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_6_MSB 13 -#define BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_6_LSB 0 -#define BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_6_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_6_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_6_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_7_MSB 27 -#define BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_7_LSB 14 -#define BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_7_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_7_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_6_CALTX_GAIN_SET_7_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_8 */ -#define BB_CALTX_GAIN_SET_8_ADDRESS 0x00000410 -#define BB_CALTX_GAIN_SET_8_OFFSET 0x00000410 -#define BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_8_MSB 13 -#define BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_8_LSB 0 -#define BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_8_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_8_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_8_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_9_MSB 27 -#define BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_9_LSB 14 -#define BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_9_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_9_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_8_CALTX_GAIN_SET_9_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_10 */ -#define BB_CALTX_GAIN_SET_10_ADDRESS 0x00000414 -#define BB_CALTX_GAIN_SET_10_OFFSET 0x00000414 -#define BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_10_MSB 13 -#define BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_10_LSB 0 -#define BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_10_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_10_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_10_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_11_MSB 27 -#define BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_11_LSB 14 -#define BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_11_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_11_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_10_CALTX_GAIN_SET_11_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_12 */ -#define BB_CALTX_GAIN_SET_12_ADDRESS 0x00000418 -#define BB_CALTX_GAIN_SET_12_OFFSET 0x00000418 -#define BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_12_MSB 13 -#define BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_12_LSB 0 -#define BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_12_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_12_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_12_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_13_MSB 27 -#define BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_13_LSB 14 -#define BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_13_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_13_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_12_CALTX_GAIN_SET_13_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_14 */ -#define BB_CALTX_GAIN_SET_14_ADDRESS 0x0000041c -#define BB_CALTX_GAIN_SET_14_OFFSET 0x0000041c -#define BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_14_MSB 13 -#define BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_14_LSB 0 -#define BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_14_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_14_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_14_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_15_MSB 27 -#define BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_15_LSB 14 -#define BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_15_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_15_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_14_CALTX_GAIN_SET_15_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_16 */ -#define BB_CALTX_GAIN_SET_16_ADDRESS 0x00000420 -#define BB_CALTX_GAIN_SET_16_OFFSET 0x00000420 -#define BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_16_MSB 13 -#define BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_16_LSB 0 -#define BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_16_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_16_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_16_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_17_MSB 27 -#define BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_17_LSB 14 -#define BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_17_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_17_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_16_CALTX_GAIN_SET_17_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_18 */ -#define BB_CALTX_GAIN_SET_18_ADDRESS 0x00000424 -#define BB_CALTX_GAIN_SET_18_OFFSET 0x00000424 -#define BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_18_MSB 13 -#define BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_18_LSB 0 -#define BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_18_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_18_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_18_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_19_MSB 27 -#define BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_19_LSB 14 -#define BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_19_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_19_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_18_CALTX_GAIN_SET_19_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_20 */ -#define BB_CALTX_GAIN_SET_20_ADDRESS 0x00000428 -#define BB_CALTX_GAIN_SET_20_OFFSET 0x00000428 -#define BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_20_MSB 13 -#define BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_20_LSB 0 -#define BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_20_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_20_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_20_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_21_MSB 27 -#define BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_21_LSB 14 -#define BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_21_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_21_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_20_CALTX_GAIN_SET_21_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_22 */ -#define BB_CALTX_GAIN_SET_22_ADDRESS 0x0000042c -#define BB_CALTX_GAIN_SET_22_OFFSET 0x0000042c -#define BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_22_MSB 13 -#define BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_22_LSB 0 -#define BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_22_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_22_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_22_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_23_MSB 27 -#define BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_23_LSB 14 -#define BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_23_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_23_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_22_CALTX_GAIN_SET_23_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_24 */ -#define BB_CALTX_GAIN_SET_24_ADDRESS 0x00000430 -#define BB_CALTX_GAIN_SET_24_OFFSET 0x00000430 -#define BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_24_MSB 13 -#define BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_24_LSB 0 -#define BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_24_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_24_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_24_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_25_MSB 27 -#define BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_25_LSB 14 -#define BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_25_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_25_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_24_CALTX_GAIN_SET_25_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_26 */ -#define BB_CALTX_GAIN_SET_26_ADDRESS 0x00000434 -#define BB_CALTX_GAIN_SET_26_OFFSET 0x00000434 -#define BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_26_MSB 13 -#define BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_26_LSB 0 -#define BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_26_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_26_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_26_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_27_MSB 27 -#define BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_27_LSB 14 -#define BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_27_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_27_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_26_CALTX_GAIN_SET_27_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_28 */ -#define BB_CALTX_GAIN_SET_28_ADDRESS 0x00000438 -#define BB_CALTX_GAIN_SET_28_OFFSET 0x00000438 -#define BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_28_MSB 13 -#define BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_28_LSB 0 -#define BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_28_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_28_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_28_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_29_MSB 27 -#define BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_29_LSB 14 -#define BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_29_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_29_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_28_CALTX_GAIN_SET_29_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_caltx_gain_set_30 */ -#define BB_CALTX_GAIN_SET_30_ADDRESS 0x0000043c -#define BB_CALTX_GAIN_SET_30_OFFSET 0x0000043c -#define BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_30_MSB 13 -#define BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_30_LSB 0 -#define BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_30_MASK 0x00003fff -#define BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_30_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_30_SET(x) (((x) << 0) & 0x00003fff) -#define BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_31_MSB 27 -#define BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_31_LSB 14 -#define BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_31_MASK 0x0fffc000 -#define BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_31_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_CALTX_GAIN_SET_30_CALTX_GAIN_SET_31_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_txiqcal_control_0 */ -#define BB_TXIQCAL_CONTROL_0_ADDRESS 0x00000444 -#define BB_TXIQCAL_CONTROL_0_OFFSET 0x00000444 -#define BB_TXIQCAL_CONTROL_0_IQC_TX_TABLE_SEL_MSB 0 -#define BB_TXIQCAL_CONTROL_0_IQC_TX_TABLE_SEL_LSB 0 -#define BB_TXIQCAL_CONTROL_0_IQC_TX_TABLE_SEL_MASK 0x00000001 -#define BB_TXIQCAL_CONTROL_0_IQC_TX_TABLE_SEL_GET(x) (((x) & 0x00000001) >> 0) -#define BB_TXIQCAL_CONTROL_0_IQC_TX_TABLE_SEL_SET(x) (((x) << 0) & 0x00000001) -#define BB_TXIQCAL_CONTROL_0_BASE_TX_TONE_DB_MSB 6 -#define BB_TXIQCAL_CONTROL_0_BASE_TX_TONE_DB_LSB 1 -#define BB_TXIQCAL_CONTROL_0_BASE_TX_TONE_DB_MASK 0x0000007e -#define BB_TXIQCAL_CONTROL_0_BASE_TX_TONE_DB_GET(x) (((x) & 0x0000007e) >> 1) -#define BB_TXIQCAL_CONTROL_0_BASE_TX_TONE_DB_SET(x) (((x) << 1) & 0x0000007e) -#define BB_TXIQCAL_CONTROL_0_MAX_TX_TONE_GAIN_MSB 12 -#define BB_TXIQCAL_CONTROL_0_MAX_TX_TONE_GAIN_LSB 7 -#define BB_TXIQCAL_CONTROL_0_MAX_TX_TONE_GAIN_MASK 0x00001f80 -#define BB_TXIQCAL_CONTROL_0_MAX_TX_TONE_GAIN_GET(x) (((x) & 0x00001f80) >> 7) -#define BB_TXIQCAL_CONTROL_0_MAX_TX_TONE_GAIN_SET(x) (((x) << 7) & 0x00001f80) -#define BB_TXIQCAL_CONTROL_0_MIN_TX_TONE_GAIN_MSB 18 -#define BB_TXIQCAL_CONTROL_0_MIN_TX_TONE_GAIN_LSB 13 -#define BB_TXIQCAL_CONTROL_0_MIN_TX_TONE_GAIN_MASK 0x0007e000 -#define BB_TXIQCAL_CONTROL_0_MIN_TX_TONE_GAIN_GET(x) (((x) & 0x0007e000) >> 13) -#define BB_TXIQCAL_CONTROL_0_MIN_TX_TONE_GAIN_SET(x) (((x) << 13) & 0x0007e000) -#define BB_TXIQCAL_CONTROL_0_CALTXSHIFT_DELAY_MSB 22 -#define BB_TXIQCAL_CONTROL_0_CALTXSHIFT_DELAY_LSB 19 -#define BB_TXIQCAL_CONTROL_0_CALTXSHIFT_DELAY_MASK 0x00780000 -#define BB_TXIQCAL_CONTROL_0_CALTXSHIFT_DELAY_GET(x) (((x) & 0x00780000) >> 19) -#define BB_TXIQCAL_CONTROL_0_CALTXSHIFT_DELAY_SET(x) (((x) << 19) & 0x00780000) -#define BB_TXIQCAL_CONTROL_0_LOOPBACK_DELAY_MSB 29 -#define BB_TXIQCAL_CONTROL_0_LOOPBACK_DELAY_LSB 23 -#define BB_TXIQCAL_CONTROL_0_LOOPBACK_DELAY_MASK 0x3f800000 -#define BB_TXIQCAL_CONTROL_0_LOOPBACK_DELAY_GET(x) (((x) & 0x3f800000) >> 23) -#define BB_TXIQCAL_CONTROL_0_LOOPBACK_DELAY_SET(x) (((x) << 23) & 0x3f800000) -#define BB_TXIQCAL_CONTROL_0_ENABLE_COMBINED_CARR_IQ_CAL_MSB 30 -#define BB_TXIQCAL_CONTROL_0_ENABLE_COMBINED_CARR_IQ_CAL_LSB 30 -#define BB_TXIQCAL_CONTROL_0_ENABLE_COMBINED_CARR_IQ_CAL_MASK 0x40000000 -#define BB_TXIQCAL_CONTROL_0_ENABLE_COMBINED_CARR_IQ_CAL_GET(x) (((x) & 0x40000000) >> 30) -#define BB_TXIQCAL_CONTROL_0_ENABLE_COMBINED_CARR_IQ_CAL_SET(x) (((x) << 30) & 0x40000000) -#define BB_TXIQCAL_CONTROL_0_ENABLE_TXIQ_CALIBRATE_MSB 31 -#define BB_TXIQCAL_CONTROL_0_ENABLE_TXIQ_CALIBRATE_LSB 31 -#define BB_TXIQCAL_CONTROL_0_ENABLE_TXIQ_CALIBRATE_MASK 0x80000000 -#define BB_TXIQCAL_CONTROL_0_ENABLE_TXIQ_CALIBRATE_GET(x) (((x) & 0x80000000) >> 31) -#define BB_TXIQCAL_CONTROL_0_ENABLE_TXIQ_CALIBRATE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_sm_reg_map.BB_txiqcal_control_1 */ -#define BB_TXIQCAL_CONTROL_1_ADDRESS 0x00000448 -#define BB_TXIQCAL_CONTROL_1_OFFSET 0x00000448 -#define BB_TXIQCAL_CONTROL_1_RX_INIT_GAIN_DB_MSB 5 -#define BB_TXIQCAL_CONTROL_1_RX_INIT_GAIN_DB_LSB 0 -#define BB_TXIQCAL_CONTROL_1_RX_INIT_GAIN_DB_MASK 0x0000003f -#define BB_TXIQCAL_CONTROL_1_RX_INIT_GAIN_DB_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_TXIQCAL_CONTROL_1_RX_INIT_GAIN_DB_SET(x) (((x) << 0) & 0x0000003f) -#define BB_TXIQCAL_CONTROL_1_MAX_RX_GAIN_DB_MSB 11 -#define BB_TXIQCAL_CONTROL_1_MAX_RX_GAIN_DB_LSB 6 -#define BB_TXIQCAL_CONTROL_1_MAX_RX_GAIN_DB_MASK 0x00000fc0 -#define BB_TXIQCAL_CONTROL_1_MAX_RX_GAIN_DB_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_TXIQCAL_CONTROL_1_MAX_RX_GAIN_DB_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_TXIQCAL_CONTROL_1_MIN_RX_GAIN_DB_MSB 17 -#define BB_TXIQCAL_CONTROL_1_MIN_RX_GAIN_DB_LSB 12 -#define BB_TXIQCAL_CONTROL_1_MIN_RX_GAIN_DB_MASK 0x0003f000 -#define BB_TXIQCAL_CONTROL_1_MIN_RX_GAIN_DB_GET(x) (((x) & 0x0003f000) >> 12) -#define BB_TXIQCAL_CONTROL_1_MIN_RX_GAIN_DB_SET(x) (((x) << 12) & 0x0003f000) -#define BB_TXIQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_MSB 24 -#define BB_TXIQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_LSB 18 -#define BB_TXIQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_MASK 0x01fc0000 -#define BB_TXIQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_GET(x) (((x) & 0x01fc0000) >> 18) -#define BB_TXIQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_SET(x) (((x) << 18) & 0x01fc0000) - -/* macros for bb_sm_reg_map.BB_txiqcal_control_2 */ -#define BB_TXIQCAL_CONTROL_2_ADDRESS 0x0000044c -#define BB_TXIQCAL_CONTROL_2_OFFSET 0x0000044c -#define BB_TXIQCAL_CONTROL_2_IQC_FORCED_PAGAIN_MSB 3 -#define BB_TXIQCAL_CONTROL_2_IQC_FORCED_PAGAIN_LSB 0 -#define BB_TXIQCAL_CONTROL_2_IQC_FORCED_PAGAIN_MASK 0x0000000f -#define BB_TXIQCAL_CONTROL_2_IQC_FORCED_PAGAIN_GET(x) (((x) & 0x0000000f) >> 0) -#define BB_TXIQCAL_CONTROL_2_IQC_FORCED_PAGAIN_SET(x) (((x) << 0) & 0x0000000f) -#define BB_TXIQCAL_CONTROL_2_IQCAL_MIN_TX_GAIN_MSB 8 -#define BB_TXIQCAL_CONTROL_2_IQCAL_MIN_TX_GAIN_LSB 4 -#define BB_TXIQCAL_CONTROL_2_IQCAL_MIN_TX_GAIN_MASK 0x000001f0 -#define BB_TXIQCAL_CONTROL_2_IQCAL_MIN_TX_GAIN_GET(x) (((x) & 0x000001f0) >> 4) -#define BB_TXIQCAL_CONTROL_2_IQCAL_MIN_TX_GAIN_SET(x) (((x) << 4) & 0x000001f0) -#define BB_TXIQCAL_CONTROL_2_IQCAL_MAX_TX_GAIN_MSB 13 -#define BB_TXIQCAL_CONTROL_2_IQCAL_MAX_TX_GAIN_LSB 9 -#define BB_TXIQCAL_CONTROL_2_IQCAL_MAX_TX_GAIN_MASK 0x00003e00 -#define BB_TXIQCAL_CONTROL_2_IQCAL_MAX_TX_GAIN_GET(x) (((x) & 0x00003e00) >> 9) -#define BB_TXIQCAL_CONTROL_2_IQCAL_MAX_TX_GAIN_SET(x) (((x) << 9) & 0x00003e00) - -/* macros for bb_sm_reg_map.BB_txiq_corr_coeff_01_b0 */ -#define BB_TXIQ_CORR_COEFF_01_B0_ADDRESS 0x00000450 -#define BB_TXIQ_CORR_COEFF_01_B0_OFFSET 0x00000450 -#define BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_0_0_MSB 13 -#define BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_0_0_LSB 0 -#define BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_0_0_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_0_0_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_0_0_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_1_0_MSB 27 -#define BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_1_0_LSB 14 -#define BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_1_0_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_1_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_01_B0_IQC_COEFF_TABLE_1_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_txiq_corr_coeff_23_b0 */ -#define BB_TXIQ_CORR_COEFF_23_B0_ADDRESS 0x00000454 -#define BB_TXIQ_CORR_COEFF_23_B0_OFFSET 0x00000454 -#define BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_2_0_MSB 13 -#define BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_2_0_LSB 0 -#define BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_2_0_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_2_0_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_2_0_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_3_0_MSB 27 -#define BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_3_0_LSB 14 -#define BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_3_0_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_3_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_23_B0_IQC_COEFF_TABLE_3_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_txiq_corr_coeff_45_b0 */ -#define BB_TXIQ_CORR_COEFF_45_B0_ADDRESS 0x00000458 -#define BB_TXIQ_CORR_COEFF_45_B0_OFFSET 0x00000458 -#define BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_4_0_MSB 13 -#define BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_4_0_LSB 0 -#define BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_4_0_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_4_0_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_4_0_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_5_0_MSB 27 -#define BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_5_0_LSB 14 -#define BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_5_0_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_5_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_45_B0_IQC_COEFF_TABLE_5_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_txiq_corr_coeff_67_b0 */ -#define BB_TXIQ_CORR_COEFF_67_B0_ADDRESS 0x0000045c -#define BB_TXIQ_CORR_COEFF_67_B0_OFFSET 0x0000045c -#define BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_6_0_MSB 13 -#define BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_6_0_LSB 0 -#define BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_6_0_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_6_0_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_6_0_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_7_0_MSB 27 -#define BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_7_0_LSB 14 -#define BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_7_0_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_7_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_67_B0_IQC_COEFF_TABLE_7_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_txiq_corr_coeff_89_b0 */ -#define BB_TXIQ_CORR_COEFF_89_B0_ADDRESS 0x00000460 -#define BB_TXIQ_CORR_COEFF_89_B0_OFFSET 0x00000460 -#define BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_8_0_MSB 13 -#define BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_8_0_LSB 0 -#define BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_8_0_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_8_0_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_8_0_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_9_0_MSB 27 -#define BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_9_0_LSB 14 -#define BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_9_0_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_9_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_89_B0_IQC_COEFF_TABLE_9_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_txiq_corr_coeff_ab_b0 */ -#define BB_TXIQ_CORR_COEFF_AB_B0_ADDRESS 0x00000464 -#define BB_TXIQ_CORR_COEFF_AB_B0_OFFSET 0x00000464 -#define BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_A_0_MSB 13 -#define BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_A_0_LSB 0 -#define BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_A_0_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_A_0_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_A_0_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_B_0_MSB 27 -#define BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_B_0_LSB 14 -#define BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_B_0_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_B_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_AB_B0_IQC_COEFF_TABLE_B_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_txiq_corr_coeff_cd_b0 */ -#define BB_TXIQ_CORR_COEFF_CD_B0_ADDRESS 0x00000468 -#define BB_TXIQ_CORR_COEFF_CD_B0_OFFSET 0x00000468 -#define BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_C_0_MSB 13 -#define BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_C_0_LSB 0 -#define BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_C_0_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_C_0_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_C_0_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_D_0_MSB 27 -#define BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_D_0_LSB 14 -#define BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_D_0_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_D_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_CD_B0_IQC_COEFF_TABLE_D_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_txiq_corr_coeff_ef_b0 */ -#define BB_TXIQ_CORR_COEFF_EF_B0_ADDRESS 0x0000046c -#define BB_TXIQ_CORR_COEFF_EF_B0_OFFSET 0x0000046c -#define BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_E_0_MSB 13 -#define BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_E_0_LSB 0 -#define BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_E_0_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_E_0_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_E_0_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_F_0_MSB 27 -#define BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_F_0_LSB 14 -#define BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_F_0_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_F_0_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_EF_B0_IQC_COEFF_TABLE_F_0_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm_reg_map.BB_cal_rxbb_gain_tbl_0 */ -#define BB_CAL_RXBB_GAIN_TBL_0_ADDRESS 0x00000470 -#define BB_CAL_RXBB_GAIN_TBL_0_OFFSET 0x00000470 -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_0_MSB 7 -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_0_LSB 0 -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_0_MASK 0x000000ff -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_0_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_0_SET(x) (((x) << 0) & 0x000000ff) -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_1_MSB 15 -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_1_LSB 8 -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_1_MASK 0x0000ff00 -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_1_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_1_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_2_MSB 23 -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_2_LSB 16 -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_2_MASK 0x00ff0000 -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_2_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_2_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_3_MSB 31 -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_3_LSB 24 -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_3_MASK 0xff000000 -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_3_GET(x) (((x) & 0xff000000) >> 24) -#define BB_CAL_RXBB_GAIN_TBL_0_TXCAL_RX_BB_GAIN_TABLE_3_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_sm_reg_map.BB_cal_rxbb_gain_tbl_4 */ -#define BB_CAL_RXBB_GAIN_TBL_4_ADDRESS 0x00000474 -#define BB_CAL_RXBB_GAIN_TBL_4_OFFSET 0x00000474 -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_4_MSB 7 -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_4_LSB 0 -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_4_MASK 0x000000ff -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_4_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_4_SET(x) (((x) << 0) & 0x000000ff) -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_5_MSB 15 -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_5_LSB 8 -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_5_MASK 0x0000ff00 -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_5_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_5_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_6_MSB 23 -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_6_LSB 16 -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_6_MASK 0x00ff0000 -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_6_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_6_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_7_MSB 31 -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_7_LSB 24 -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_7_MASK 0xff000000 -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_7_GET(x) (((x) & 0xff000000) >> 24) -#define BB_CAL_RXBB_GAIN_TBL_4_TXCAL_RX_BB_GAIN_TABLE_7_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_sm_reg_map.BB_cal_rxbb_gain_tbl_8 */ -#define BB_CAL_RXBB_GAIN_TBL_8_ADDRESS 0x00000478 -#define BB_CAL_RXBB_GAIN_TBL_8_OFFSET 0x00000478 -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_8_MSB 7 -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_8_LSB 0 -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_8_MASK 0x000000ff -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_8_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_8_SET(x) (((x) << 0) & 0x000000ff) -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_9_MSB 15 -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_9_LSB 8 -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_9_MASK 0x0000ff00 -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_9_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_9_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_10_MSB 23 -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_10_LSB 16 -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_10_MASK 0x00ff0000 -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_10_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_10_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_11_MSB 31 -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_11_LSB 24 -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_11_MASK 0xff000000 -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_11_GET(x) (((x) & 0xff000000) >> 24) -#define BB_CAL_RXBB_GAIN_TBL_8_TXCAL_RX_BB_GAIN_TABLE_11_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_sm_reg_map.BB_cal_rxbb_gain_tbl_12 */ -#define BB_CAL_RXBB_GAIN_TBL_12_ADDRESS 0x0000047c -#define BB_CAL_RXBB_GAIN_TBL_12_OFFSET 0x0000047c -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_12_MSB 7 -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_12_LSB 0 -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_12_MASK 0x000000ff -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_12_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_12_SET(x) (((x) << 0) & 0x000000ff) -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_13_MSB 15 -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_13_LSB 8 -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_13_MASK 0x0000ff00 -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_13_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_13_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_14_MSB 23 -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_14_LSB 16 -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_14_MASK 0x00ff0000 -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_14_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_14_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_15_MSB 31 -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_15_LSB 24 -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_15_MASK 0xff000000 -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_15_GET(x) (((x) & 0xff000000) >> 24) -#define BB_CAL_RXBB_GAIN_TBL_12_TXCAL_RX_BB_GAIN_TABLE_15_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_sm_reg_map.BB_cal_rxbb_gain_tbl_16 */ -#define BB_CAL_RXBB_GAIN_TBL_16_ADDRESS 0x00000480 -#define BB_CAL_RXBB_GAIN_TBL_16_OFFSET 0x00000480 -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_16_MSB 7 -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_16_LSB 0 -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_16_MASK 0x000000ff -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_16_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_16_SET(x) (((x) << 0) & 0x000000ff) -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_17_MSB 15 -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_17_LSB 8 -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_17_MASK 0x0000ff00 -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_17_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_17_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_18_MSB 23 -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_18_LSB 16 -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_18_MASK 0x00ff0000 -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_18_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_18_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_19_MSB 31 -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_19_LSB 24 -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_19_MASK 0xff000000 -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_19_GET(x) (((x) & 0xff000000) >> 24) -#define BB_CAL_RXBB_GAIN_TBL_16_TXCAL_RX_BB_GAIN_TABLE_19_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_sm_reg_map.BB_cal_rxbb_gain_tbl_20 */ -#define BB_CAL_RXBB_GAIN_TBL_20_ADDRESS 0x00000484 -#define BB_CAL_RXBB_GAIN_TBL_20_OFFSET 0x00000484 -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_20_MSB 7 -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_20_LSB 0 -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_20_MASK 0x000000ff -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_20_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_20_SET(x) (((x) << 0) & 0x000000ff) -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_21_MSB 15 -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_21_LSB 8 -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_21_MASK 0x0000ff00 -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_21_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_21_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_22_MSB 23 -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_22_LSB 16 -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_22_MASK 0x00ff0000 -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_22_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_22_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_23_MSB 31 -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_23_LSB 24 -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_23_MASK 0xff000000 -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_23_GET(x) (((x) & 0xff000000) >> 24) -#define BB_CAL_RXBB_GAIN_TBL_20_TXCAL_RX_BB_GAIN_TABLE_23_SET(x) (((x) << 24) & 0xff000000) - -/* macros for bb_sm_reg_map.BB_cal_rxbb_gain_tbl_24 */ -#define BB_CAL_RXBB_GAIN_TBL_24_ADDRESS 0x00000488 -#define BB_CAL_RXBB_GAIN_TBL_24_OFFSET 0x00000488 -#define BB_CAL_RXBB_GAIN_TBL_24_TXCAL_RX_BB_GAIN_TABLE_24_MSB 7 -#define BB_CAL_RXBB_GAIN_TBL_24_TXCAL_RX_BB_GAIN_TABLE_24_LSB 0 -#define BB_CAL_RXBB_GAIN_TBL_24_TXCAL_RX_BB_GAIN_TABLE_24_MASK 0x000000ff -#define BB_CAL_RXBB_GAIN_TBL_24_TXCAL_RX_BB_GAIN_TABLE_24_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_CAL_RXBB_GAIN_TBL_24_TXCAL_RX_BB_GAIN_TABLE_24_SET(x) (((x) << 0) & 0x000000ff) - -/* macros for bb_sm_reg_map.BB_txiqcal_status_b0 */ -#define BB_TXIQCAL_STATUS_B0_ADDRESS 0x0000048c -#define BB_TXIQCAL_STATUS_B0_OFFSET 0x0000048c -#define BB_TXIQCAL_STATUS_B0_TXIQCAL_FAILED_0_MSB 0 -#define BB_TXIQCAL_STATUS_B0_TXIQCAL_FAILED_0_LSB 0 -#define BB_TXIQCAL_STATUS_B0_TXIQCAL_FAILED_0_MASK 0x00000001 -#define BB_TXIQCAL_STATUS_B0_TXIQCAL_FAILED_0_GET(x) (((x) & 0x00000001) >> 0) -#define BB_TXIQCAL_STATUS_B0_CALIBRATED_GAINS_0_MSB 5 -#define BB_TXIQCAL_STATUS_B0_CALIBRATED_GAINS_0_LSB 1 -#define BB_TXIQCAL_STATUS_B0_CALIBRATED_GAINS_0_MASK 0x0000003e -#define BB_TXIQCAL_STATUS_B0_CALIBRATED_GAINS_0_GET(x) (((x) & 0x0000003e) >> 1) -#define BB_TXIQCAL_STATUS_B0_TONE_GAIN_USED_0_MSB 11 -#define BB_TXIQCAL_STATUS_B0_TONE_GAIN_USED_0_LSB 6 -#define BB_TXIQCAL_STATUS_B0_TONE_GAIN_USED_0_MASK 0x00000fc0 -#define BB_TXIQCAL_STATUS_B0_TONE_GAIN_USED_0_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_TXIQCAL_STATUS_B0_RX_GAIN_USED_0_MSB 17 -#define BB_TXIQCAL_STATUS_B0_RX_GAIN_USED_0_LSB 12 -#define BB_TXIQCAL_STATUS_B0_RX_GAIN_USED_0_MASK 0x0003f000 -#define BB_TXIQCAL_STATUS_B0_RX_GAIN_USED_0_GET(x) (((x) & 0x0003f000) >> 12) -#define BB_TXIQCAL_STATUS_B0_LAST_MEAS_ADDR_0_MSB 23 -#define BB_TXIQCAL_STATUS_B0_LAST_MEAS_ADDR_0_LSB 18 -#define BB_TXIQCAL_STATUS_B0_LAST_MEAS_ADDR_0_MASK 0x00fc0000 -#define BB_TXIQCAL_STATUS_B0_LAST_MEAS_ADDR_0_GET(x) (((x) & 0x00fc0000) >> 18) - -/* macros for bb_sm_reg_map.BB_paprd_trainer_cntl1 */ -#define BB_PAPRD_TRAINER_CNTL1_ADDRESS 0x00000490 -#define BB_PAPRD_TRAINER_CNTL1_OFFSET 0x00000490 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TRAIN_ENABLE_MSB 0 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TRAIN_ENABLE_LSB 0 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TRAIN_ENABLE_MASK 0x00000001 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TRAIN_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TRAIN_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING_MSB 7 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING_LSB 1 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING_MASK 0x000000fe -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING_GET(x) (((x) & 0x000000fe) >> 1) -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING_SET(x) (((x) << 1) & 0x000000fe) -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE_MSB 8 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE_LSB 8 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE_MASK 0x00000100 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE_GET(x) (((x) & 0x00000100) >> 8) -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE_SET(x) (((x) << 8) & 0x00000100) -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE_MSB 9 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE_LSB 9 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE_MASK 0x00000200 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE_GET(x) (((x) & 0x00000200) >> 9) -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE_SET(x) (((x) << 9) & 0x00000200) -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE_MSB 10 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE_LSB 10 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE_MASK 0x00000400 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE_GET(x) (((x) & 0x00000400) >> 10) -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE_SET(x) (((x) << 10) & 0x00000400) -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE_MSB 11 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE_LSB 11 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE_MASK 0x00000800 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE_GET(x) (((x) & 0x00000800) >> 11) -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE_SET(x) (((x) << 11) & 0x00000800) -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_MSB 18 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_LSB 12 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_MASK 0x0007f000 -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_GET(x) (((x) & 0x0007f000) >> 12) -#define BB_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_SET(x) (((x) << 12) & 0x0007f000) - -/* macros for bb_sm_reg_map.BB_paprd_trainer_cntl2 */ -#define BB_PAPRD_TRAINER_CNTL2_ADDRESS 0x00000494 -#define BB_PAPRD_TRAINER_CNTL2_OFFSET 0x00000494 -#define BB_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_MSB 31 -#define BB_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_LSB 0 -#define BB_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_MASK 0xffffffff -#define BB_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm_reg_map.BB_paprd_trainer_cntl3 */ -#define BB_PAPRD_TRAINER_CNTL3_ADDRESS 0x00000498 -#define BB_PAPRD_TRAINER_CNTL3_OFFSET 0x00000498 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_MSB 5 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_LSB 0 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_MASK 0x0000003f -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_SET(x) (((x) << 0) & 0x0000003f) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP_MSB 11 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP_LSB 6 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP_MASK 0x00000fc0 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL_MSB 16 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL_LSB 12 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL_MASK 0x0001f000 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL_GET(x) (((x) & 0x0001f000) >> 12) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL_SET(x) (((x) << 12) & 0x0001f000) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES_MSB 19 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES_LSB 17 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES_MASK 0x000e0000 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES_GET(x) (((x) & 0x000e0000) >> 17) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES_SET(x) (((x) << 17) & 0x000e0000) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN_MSB 23 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN_LSB 20 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN_MASK 0x00f00000 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN_GET(x) (((x) & 0x00f00000) >> 20) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN_SET(x) (((x) << 20) & 0x00f00000) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN_MSB 27 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN_LSB 24 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN_MASK 0x0f000000 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN_GET(x) (((x) & 0x0f000000) >> 24) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN_SET(x) (((x) << 24) & 0x0f000000) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_REUSE_CORR_MSB 28 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_REUSE_CORR_LSB 28 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_REUSE_CORR_MASK 0x10000000 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_REUSE_CORR_GET(x) (((x) & 0x10000000) >> 28) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_REUSE_CORR_SET(x) (((x) << 28) & 0x10000000) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_MSB 29 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_LSB 29 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_MASK 0x20000000 -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_GET(x) (((x) & 0x20000000) >> 29) -#define BB_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_SET(x) (((x) << 29) & 0x20000000) - -/* macros for bb_sm_reg_map.BB_paprd_trainer_cntl4 */ -#define BB_PAPRD_TRAINER_CNTL4_ADDRESS 0x0000049c -#define BB_PAPRD_TRAINER_CNTL4_OFFSET 0x0000049c -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR_MSB 11 -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR_LSB 0 -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR_MASK 0x00000fff -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR_GET(x) (((x) & 0x00000fff) >> 0) -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR_SET(x) (((x) << 0) & 0x00000fff) -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA_MSB 15 -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA_LSB 12 -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA_MASK 0x0000f000 -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA_GET(x) (((x) & 0x0000f000) >> 12) -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA_SET(x) (((x) << 12) & 0x0000f000) -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_MSB 25 -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_LSB 16 -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_MASK 0x03ff0000 -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_GET(x) (((x) & 0x03ff0000) >> 16) -#define BB_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_SET(x) (((x) << 16) & 0x03ff0000) - -/* macros for bb_sm_reg_map.BB_paprd_trainer_stat1 */ -#define BB_PAPRD_TRAINER_STAT1_ADDRESS 0x000004a0 -#define BB_PAPRD_TRAINER_STAT1_OFFSET 0x000004a0 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE_MSB 0 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE_LSB 0 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE_MASK 0x00000001 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE_GET(x) (((x) & 0x00000001) >> 0) -#define BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE_SET(x) (((x) << 0) & 0x00000001) -#define BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_INCOMPLETE_MSB 1 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_INCOMPLETE_LSB 1 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_INCOMPLETE_MASK 0x00000002 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_INCOMPLETE_GET(x) (((x) & 0x00000002) >> 1) -#define BB_PAPRD_TRAINER_STAT1_PAPRD_CORR_ERR_MSB 2 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_CORR_ERR_LSB 2 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_CORR_ERR_MASK 0x00000004 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_CORR_ERR_GET(x) (((x) & 0x00000004) >> 2) -#define BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_ACTIVE_MSB 3 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_ACTIVE_LSB 3 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_ACTIVE_MASK 0x00000008 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_ACTIVE_GET(x) (((x) & 0x00000008) >> 3) -#define BB_PAPRD_TRAINER_STAT1_PAPRD_RX_GAIN_IDX_MSB 8 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_RX_GAIN_IDX_LSB 4 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_RX_GAIN_IDX_MASK 0x000001f0 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_RX_GAIN_IDX_GET(x) (((x) & 0x000001f0) >> 4) -#define BB_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR_MSB 16 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR_LSB 9 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR_MASK 0x0001fe00 -#define BB_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR_GET(x) (((x) & 0x0001fe00) >> 9) - -/* macros for bb_sm_reg_map.BB_paprd_trainer_stat2 */ -#define BB_PAPRD_TRAINER_STAT2_ADDRESS 0x000004a4 -#define BB_PAPRD_TRAINER_STAT2_OFFSET 0x000004a4 -#define BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL_MSB 15 -#define BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL_LSB 0 -#define BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL_MASK 0x0000ffff -#define BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL_GET(x) (((x) & 0x0000ffff) >> 0) -#define BB_PAPRD_TRAINER_STAT2_PAPRD_COARSE_IDX_MSB 20 -#define BB_PAPRD_TRAINER_STAT2_PAPRD_COARSE_IDX_LSB 16 -#define BB_PAPRD_TRAINER_STAT2_PAPRD_COARSE_IDX_MASK 0x001f0000 -#define BB_PAPRD_TRAINER_STAT2_PAPRD_COARSE_IDX_GET(x) (((x) & 0x001f0000) >> 16) -#define BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX_MSB 22 -#define BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX_LSB 21 -#define BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX_MASK 0x00600000 -#define BB_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX_GET(x) (((x) & 0x00600000) >> 21) - -/* macros for bb_sm_reg_map.BB_paprd_trainer_stat3 */ -#define BB_PAPRD_TRAINER_STAT3_ADDRESS 0x000004a8 -#define BB_PAPRD_TRAINER_STAT3_OFFSET 0x000004a8 -#define BB_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT_MSB 19 -#define BB_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT_LSB 0 -#define BB_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT_MASK 0x000fffff -#define BB_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT_GET(x) (((x) & 0x000fffff) >> 0) - -/* macros for bb_sm_reg_map.BB_watchdog_status */ -#define BB_WATCHDOG_STATUS_ADDRESS 0x000005c0 -#define BB_WATCHDOG_STATUS_OFFSET 0x000005c0 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_1_MSB 2 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_1_LSB 0 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_1_MASK 0x00000007 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_1_GET(x) (((x) & 0x00000007) >> 0) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_1_SET(x) (((x) << 0) & 0x00000007) -#define BB_WATCHDOG_STATUS_WATCHDOG_TIMEOUT_MSB 3 -#define BB_WATCHDOG_STATUS_WATCHDOG_TIMEOUT_LSB 3 -#define BB_WATCHDOG_STATUS_WATCHDOG_TIMEOUT_MASK 0x00000008 -#define BB_WATCHDOG_STATUS_WATCHDOG_TIMEOUT_GET(x) (((x) & 0x00000008) >> 3) -#define BB_WATCHDOG_STATUS_WATCHDOG_TIMEOUT_SET(x) (((x) << 3) & 0x00000008) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_2_MSB 7 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_2_LSB 4 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_2_MASK 0x000000f0 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_2_GET(x) (((x) & 0x000000f0) >> 4) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_2_SET(x) (((x) << 4) & 0x000000f0) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_3_MSB 11 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_3_LSB 8 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_3_MASK 0x00000f00 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_3_GET(x) (((x) & 0x00000f00) >> 8) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_3_SET(x) (((x) << 8) & 0x00000f00) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_4_MSB 15 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_4_LSB 12 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_4_MASK 0x0000f000 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_4_GET(x) (((x) & 0x0000f000) >> 12) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_4_SET(x) (((x) << 12) & 0x0000f000) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_5_MSB 19 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_5_LSB 16 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_5_MASK 0x000f0000 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_5_GET(x) (((x) & 0x000f0000) >> 16) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_5_SET(x) (((x) << 16) & 0x000f0000) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_6_MSB 23 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_6_LSB 20 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_6_MASK 0x00f00000 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_6_GET(x) (((x) & 0x00f00000) >> 20) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_6_SET(x) (((x) << 20) & 0x00f00000) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_7_MSB 27 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_7_LSB 24 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_7_MASK 0x0f000000 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_7_GET(x) (((x) & 0x0f000000) >> 24) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_7_SET(x) (((x) << 24) & 0x0f000000) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_8_MSB 31 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_8_LSB 28 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_8_MASK 0xf0000000 -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_8_GET(x) (((x) & 0xf0000000) >> 28) -#define BB_WATCHDOG_STATUS_WATCHDOG_STATUS_8_SET(x) (((x) << 28) & 0xf0000000) - -/* macros for bb_sm_reg_map.BB_watchdog_ctrl_1 */ -#define BB_WATCHDOG_CTRL_1_ADDRESS 0x000005c4 -#define BB_WATCHDOG_CTRL_1_OFFSET 0x000005c4 -#define BB_WATCHDOG_CTRL_1_ENABLE_WATCHDOG_TIMEOUT_RESET_NON_IDLE_MSB 0 -#define BB_WATCHDOG_CTRL_1_ENABLE_WATCHDOG_TIMEOUT_RESET_NON_IDLE_LSB 0 -#define BB_WATCHDOG_CTRL_1_ENABLE_WATCHDOG_TIMEOUT_RESET_NON_IDLE_MASK 0x00000001 -#define BB_WATCHDOG_CTRL_1_ENABLE_WATCHDOG_TIMEOUT_RESET_NON_IDLE_GET(x) (((x) & 0x00000001) >> 0) -#define BB_WATCHDOG_CTRL_1_ENABLE_WATCHDOG_TIMEOUT_RESET_NON_IDLE_SET(x) (((x) << 0) & 0x00000001) -#define BB_WATCHDOG_CTRL_1_ENABLE_WATCHDOG_TIMEOUT_RESET_IDLE_MSB 1 -#define BB_WATCHDOG_CTRL_1_ENABLE_WATCHDOG_TIMEOUT_RESET_IDLE_LSB 1 -#define BB_WATCHDOG_CTRL_1_ENABLE_WATCHDOG_TIMEOUT_RESET_IDLE_MASK 0x00000002 -#define BB_WATCHDOG_CTRL_1_ENABLE_WATCHDOG_TIMEOUT_RESET_IDLE_GET(x) (((x) & 0x00000002) >> 1) -#define BB_WATCHDOG_CTRL_1_ENABLE_WATCHDOG_TIMEOUT_RESET_IDLE_SET(x) (((x) << 1) & 0x00000002) -#define BB_WATCHDOG_CTRL_1_WATCHDOG_TIMEOUT_RESET_NON_IDLE_LIMIT_MSB 15 -#define BB_WATCHDOG_CTRL_1_WATCHDOG_TIMEOUT_RESET_NON_IDLE_LIMIT_LSB 2 -#define BB_WATCHDOG_CTRL_1_WATCHDOG_TIMEOUT_RESET_NON_IDLE_LIMIT_MASK 0x0000fffc -#define BB_WATCHDOG_CTRL_1_WATCHDOG_TIMEOUT_RESET_NON_IDLE_LIMIT_GET(x) (((x) & 0x0000fffc) >> 2) -#define BB_WATCHDOG_CTRL_1_WATCHDOG_TIMEOUT_RESET_NON_IDLE_LIMIT_SET(x) (((x) << 2) & 0x0000fffc) -#define BB_WATCHDOG_CTRL_1_WATCHDOG_TIMEOUT_RESET_IDLE_LIMIT_MSB 31 -#define BB_WATCHDOG_CTRL_1_WATCHDOG_TIMEOUT_RESET_IDLE_LIMIT_LSB 16 -#define BB_WATCHDOG_CTRL_1_WATCHDOG_TIMEOUT_RESET_IDLE_LIMIT_MASK 0xffff0000 -#define BB_WATCHDOG_CTRL_1_WATCHDOG_TIMEOUT_RESET_IDLE_LIMIT_GET(x) (((x) & 0xffff0000) >> 16) -#define BB_WATCHDOG_CTRL_1_WATCHDOG_TIMEOUT_RESET_IDLE_LIMIT_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for bb_sm_reg_map.BB_watchdog_ctrl_2 */ -#define BB_WATCHDOG_CTRL_2_ADDRESS 0x000005c8 -#define BB_WATCHDOG_CTRL_2_OFFSET 0x000005c8 -#define BB_WATCHDOG_CTRL_2_FORCE_FAST_ADC_CLK_MSB 0 -#define BB_WATCHDOG_CTRL_2_FORCE_FAST_ADC_CLK_LSB 0 -#define BB_WATCHDOG_CTRL_2_FORCE_FAST_ADC_CLK_MASK 0x00000001 -#define BB_WATCHDOG_CTRL_2_FORCE_FAST_ADC_CLK_GET(x) (((x) & 0x00000001) >> 0) -#define BB_WATCHDOG_CTRL_2_FORCE_FAST_ADC_CLK_SET(x) (((x) << 0) & 0x00000001) -#define BB_WATCHDOG_CTRL_2_WATCHDOG_TIMEOUT_RESET_ENA_MSB 1 -#define BB_WATCHDOG_CTRL_2_WATCHDOG_TIMEOUT_RESET_ENA_LSB 1 -#define BB_WATCHDOG_CTRL_2_WATCHDOG_TIMEOUT_RESET_ENA_MASK 0x00000002 -#define BB_WATCHDOG_CTRL_2_WATCHDOG_TIMEOUT_RESET_ENA_GET(x) (((x) & 0x00000002) >> 1) -#define BB_WATCHDOG_CTRL_2_WATCHDOG_TIMEOUT_RESET_ENA_SET(x) (((x) << 1) & 0x00000002) -#define BB_WATCHDOG_CTRL_2_WATCHDOG_IRQ_ENA_MSB 2 -#define BB_WATCHDOG_CTRL_2_WATCHDOG_IRQ_ENA_LSB 2 -#define BB_WATCHDOG_CTRL_2_WATCHDOG_IRQ_ENA_MASK 0x00000004 -#define BB_WATCHDOG_CTRL_2_WATCHDOG_IRQ_ENA_GET(x) (((x) & 0x00000004) >> 2) -#define BB_WATCHDOG_CTRL_2_WATCHDOG_IRQ_ENA_SET(x) (((x) << 2) & 0x00000004) - -/* macros for bb_sm_reg_map.BB_bluetooth_cntl */ -#define BB_BLUETOOTH_CNTL_ADDRESS 0x000005cc -#define BB_BLUETOOTH_CNTL_OFFSET 0x000005cc -#define BB_BLUETOOTH_CNTL_BT_BREAK_CCK_EN_MSB 0 -#define BB_BLUETOOTH_CNTL_BT_BREAK_CCK_EN_LSB 0 -#define BB_BLUETOOTH_CNTL_BT_BREAK_CCK_EN_MASK 0x00000001 -#define BB_BLUETOOTH_CNTL_BT_BREAK_CCK_EN_GET(x) (((x) & 0x00000001) >> 0) -#define BB_BLUETOOTH_CNTL_BT_BREAK_CCK_EN_SET(x) (((x) << 0) & 0x00000001) -#define BB_BLUETOOTH_CNTL_BT_ANT_HALT_WLAN_MSB 1 -#define BB_BLUETOOTH_CNTL_BT_ANT_HALT_WLAN_LSB 1 -#define BB_BLUETOOTH_CNTL_BT_ANT_HALT_WLAN_MASK 0x00000002 -#define BB_BLUETOOTH_CNTL_BT_ANT_HALT_WLAN_GET(x) (((x) & 0x00000002) >> 1) -#define BB_BLUETOOTH_CNTL_BT_ANT_HALT_WLAN_SET(x) (((x) << 1) & 0x00000002) -#define BB_BLUETOOTH_CNTL_ENABLE_RFBUS_GRANT_WAKEUP_MSB 2 -#define BB_BLUETOOTH_CNTL_ENABLE_RFBUS_GRANT_WAKEUP_LSB 2 -#define BB_BLUETOOTH_CNTL_ENABLE_RFBUS_GRANT_WAKEUP_MASK 0x00000004 -#define BB_BLUETOOTH_CNTL_ENABLE_RFBUS_GRANT_WAKEUP_GET(x) (((x) & 0x00000004) >> 2) -#define BB_BLUETOOTH_CNTL_ENABLE_RFBUS_GRANT_WAKEUP_SET(x) (((x) << 2) & 0x00000004) - -/* macros for bb_sm_reg_map.BB_phyonly_warm_reset */ -#define BB_PHYONLY_WARM_RESET_ADDRESS 0x000005d0 -#define BB_PHYONLY_WARM_RESET_OFFSET 0x000005d0 -#define BB_PHYONLY_WARM_RESET_PHYONLY_RST_WARM_L_MSB 0 -#define BB_PHYONLY_WARM_RESET_PHYONLY_RST_WARM_L_LSB 0 -#define BB_PHYONLY_WARM_RESET_PHYONLY_RST_WARM_L_MASK 0x00000001 -#define BB_PHYONLY_WARM_RESET_PHYONLY_RST_WARM_L_GET(x) (((x) & 0x00000001) >> 0) -#define BB_PHYONLY_WARM_RESET_PHYONLY_RST_WARM_L_SET(x) (((x) << 0) & 0x00000001) - -/* macros for bb_sm_reg_map.BB_phyonly_control */ -#define BB_PHYONLY_CONTROL_ADDRESS 0x000005d4 -#define BB_PHYONLY_CONTROL_OFFSET 0x000005d4 -#define BB_PHYONLY_CONTROL_RX_DRAIN_RATE_MSB 0 -#define BB_PHYONLY_CONTROL_RX_DRAIN_RATE_LSB 0 -#define BB_PHYONLY_CONTROL_RX_DRAIN_RATE_MASK 0x00000001 -#define BB_PHYONLY_CONTROL_RX_DRAIN_RATE_GET(x) (((x) & 0x00000001) >> 0) -#define BB_PHYONLY_CONTROL_RX_DRAIN_RATE_SET(x) (((x) << 0) & 0x00000001) -#define BB_PHYONLY_CONTROL_LATE_TX_SIGNAL_SYMBOL_MSB 1 -#define BB_PHYONLY_CONTROL_LATE_TX_SIGNAL_SYMBOL_LSB 1 -#define BB_PHYONLY_CONTROL_LATE_TX_SIGNAL_SYMBOL_MASK 0x00000002 -#define BB_PHYONLY_CONTROL_LATE_TX_SIGNAL_SYMBOL_GET(x) (((x) & 0x00000002) >> 1) -#define BB_PHYONLY_CONTROL_LATE_TX_SIGNAL_SYMBOL_SET(x) (((x) << 1) & 0x00000002) -#define BB_PHYONLY_CONTROL_GENERATE_SCRAMBLER_MSB 2 -#define BB_PHYONLY_CONTROL_GENERATE_SCRAMBLER_LSB 2 -#define BB_PHYONLY_CONTROL_GENERATE_SCRAMBLER_MASK 0x00000004 -#define BB_PHYONLY_CONTROL_GENERATE_SCRAMBLER_GET(x) (((x) & 0x00000004) >> 2) -#define BB_PHYONLY_CONTROL_GENERATE_SCRAMBLER_SET(x) (((x) << 2) & 0x00000004) -#define BB_PHYONLY_CONTROL_TX_ANTENNA_SELECT_MSB 3 -#define BB_PHYONLY_CONTROL_TX_ANTENNA_SELECT_LSB 3 -#define BB_PHYONLY_CONTROL_TX_ANTENNA_SELECT_MASK 0x00000008 -#define BB_PHYONLY_CONTROL_TX_ANTENNA_SELECT_GET(x) (((x) & 0x00000008) >> 3) -#define BB_PHYONLY_CONTROL_TX_ANTENNA_SELECT_SET(x) (((x) << 3) & 0x00000008) -#define BB_PHYONLY_CONTROL_STATIC_TX_ANTENNA_MSB 4 -#define BB_PHYONLY_CONTROL_STATIC_TX_ANTENNA_LSB 4 -#define BB_PHYONLY_CONTROL_STATIC_TX_ANTENNA_MASK 0x00000010 -#define BB_PHYONLY_CONTROL_STATIC_TX_ANTENNA_GET(x) (((x) & 0x00000010) >> 4) -#define BB_PHYONLY_CONTROL_STATIC_TX_ANTENNA_SET(x) (((x) << 4) & 0x00000010) -#define BB_PHYONLY_CONTROL_RX_ANTENNA_SELECT_MSB 5 -#define BB_PHYONLY_CONTROL_RX_ANTENNA_SELECT_LSB 5 -#define BB_PHYONLY_CONTROL_RX_ANTENNA_SELECT_MASK 0x00000020 -#define BB_PHYONLY_CONTROL_RX_ANTENNA_SELECT_GET(x) (((x) & 0x00000020) >> 5) -#define BB_PHYONLY_CONTROL_RX_ANTENNA_SELECT_SET(x) (((x) << 5) & 0x00000020) -#define BB_PHYONLY_CONTROL_STATIC_RX_ANTENNA_MSB 6 -#define BB_PHYONLY_CONTROL_STATIC_RX_ANTENNA_LSB 6 -#define BB_PHYONLY_CONTROL_STATIC_RX_ANTENNA_MASK 0x00000040 -#define BB_PHYONLY_CONTROL_STATIC_RX_ANTENNA_GET(x) (((x) & 0x00000040) >> 6) -#define BB_PHYONLY_CONTROL_STATIC_RX_ANTENNA_SET(x) (((x) << 6) & 0x00000040) -#define BB_PHYONLY_CONTROL_EN_LOW_FREQ_SLEEP_MSB 7 -#define BB_PHYONLY_CONTROL_EN_LOW_FREQ_SLEEP_LSB 7 -#define BB_PHYONLY_CONTROL_EN_LOW_FREQ_SLEEP_MASK 0x00000080 -#define BB_PHYONLY_CONTROL_EN_LOW_FREQ_SLEEP_GET(x) (((x) & 0x00000080) >> 7) -#define BB_PHYONLY_CONTROL_EN_LOW_FREQ_SLEEP_SET(x) (((x) << 7) & 0x00000080) - -/* macros for bb_sm_reg_map.BB_eco_ctrl */ -#define BB_ECO_CTRL_ADDRESS 0x000005dc -#define BB_ECO_CTRL_OFFSET 0x000005dc -#define BB_ECO_CTRL_ECO_CTRL_MSB 7 -#define BB_ECO_CTRL_ECO_CTRL_LSB 0 -#define BB_ECO_CTRL_ECO_CTRL_MASK 0x000000ff -#define BB_ECO_CTRL_ECO_CTRL_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_ECO_CTRL_ECO_CTRL_SET(x) (((x) << 0) & 0x000000ff) - -/* macros for bb_sm_reg_map.BB_tables_intf_addr_b0 */ -#define BB_TABLES_INTF_ADDR_B0_ADDRESS 0x000005f0 -#define BB_TABLES_INTF_ADDR_B0_OFFSET 0x000005f0 -#define BB_TABLES_INTF_ADDR_B0_TABLES_ADDR_0_MSB 17 -#define BB_TABLES_INTF_ADDR_B0_TABLES_ADDR_0_LSB 2 -#define BB_TABLES_INTF_ADDR_B0_TABLES_ADDR_0_MASK 0x0003fffc -#define BB_TABLES_INTF_ADDR_B0_TABLES_ADDR_0_GET(x) (((x) & 0x0003fffc) >> 2) -#define BB_TABLES_INTF_ADDR_B0_TABLES_ADDR_0_SET(x) (((x) << 2) & 0x0003fffc) -#define BB_TABLES_INTF_ADDR_B0_ADDR_AUTO_INCR_0_MSB 31 -#define BB_TABLES_INTF_ADDR_B0_ADDR_AUTO_INCR_0_LSB 31 -#define BB_TABLES_INTF_ADDR_B0_ADDR_AUTO_INCR_0_MASK 0x80000000 -#define BB_TABLES_INTF_ADDR_B0_ADDR_AUTO_INCR_0_GET(x) (((x) & 0x80000000) >> 31) -#define BB_TABLES_INTF_ADDR_B0_ADDR_AUTO_INCR_0_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_sm_reg_map.BB_tables_intf_data_b0 */ -#define BB_TABLES_INTF_DATA_B0_ADDRESS 0x000005f4 -#define BB_TABLES_INTF_DATA_B0_OFFSET 0x000005f4 -#define BB_TABLES_INTF_DATA_B0_TABLES_DATA_0_MSB 31 -#define BB_TABLES_INTF_DATA_B0_TABLES_DATA_0_LSB 0 -#define BB_TABLES_INTF_DATA_B0_TABLES_DATA_0_MASK 0xffffffff -#define BB_TABLES_INTF_DATA_B0_TABLES_DATA_0_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TABLES_INTF_DATA_B0_TABLES_DATA_0_SET(x) (((x) << 0) & 0xffffffff) - -#ifndef __ASSEMBLER__ - -typedef struct bb_reg_reg_s_5 { - volatile unsigned int BB_D2_chip_id; /* 0x0 - 0x4 */ - volatile unsigned int BB_gen_controls; /* 0x4 - 0x8 */ - volatile unsigned int BB_modes_select; /* 0x8 - 0xc */ - volatile unsigned int BB_active; /* 0xc - 0x10 */ - volatile char pad__0[0x10]; /* 0x10 - 0x20 */ - volatile unsigned int BB_vit_spur_mask_A; /* 0x20 - 0x24 */ - volatile unsigned int BB_vit_spur_mask_B; /* 0x24 - 0x28 */ - volatile unsigned int BB_spectral_scan; /* 0x28 - 0x2c */ - volatile unsigned int BB_radar_bw_filter; /* 0x2c - 0x30 */ - volatile unsigned int BB_search_start_delay; /* 0x30 - 0x34 */ - volatile unsigned int BB_max_rx_length; /* 0x34 - 0x38 */ - volatile unsigned int BB_frame_control; /* 0x38 - 0x3c */ - volatile unsigned int BB_rfbus_request; /* 0x3c - 0x40 */ - volatile unsigned int BB_rfbus_grant; /* 0x40 - 0x44 */ - volatile unsigned int BB_rifs; /* 0x44 - 0x48 */ - volatile unsigned int BB_spectral_scan_2; /* 0x48 - 0x4c */ - volatile char pad__1[0x4]; /* 0x4c - 0x50 */ - volatile unsigned int BB_rx_clear_delay; /* 0x50 - 0x54 */ - volatile unsigned int BB_analog_power_on_time; /* 0x54 - 0x58 */ - volatile unsigned int BB_tx_timing_1; /* 0x58 - 0x5c */ - volatile unsigned int BB_tx_timing_2; /* 0x5c - 0x60 */ - volatile unsigned int BB_tx_timing_3; /* 0x60 - 0x64 */ - volatile unsigned int BB_xpa_timing_control; /* 0x64 - 0x68 */ - volatile char pad__2[0x18]; /* 0x68 - 0x80 */ - volatile unsigned int BB_misc_pa_control; /* 0x80 - 0x84 */ - volatile unsigned int BB_switch_table_chn_b0; /* 0x84 - 0x88 */ - volatile unsigned int BB_switch_table_com1; /* 0x88 - 0x8c */ - volatile unsigned int BB_switch_table_com2; /* 0x8c - 0x90 */ - volatile char pad__3[0x10]; /* 0x90 - 0xa0 */ - volatile unsigned int BB_multichain_enable; /* 0xa0 - 0xa4 */ - volatile char pad__4[0x1c]; /* 0xa4 - 0xc0 */ - volatile unsigned int BB_cal_chain_mask; /* 0xc0 - 0xc4 */ - volatile unsigned int BB_agc_control; /* 0xc4 - 0xc8 */ - volatile unsigned int BB_iq_adc_cal_mode; /* 0xc8 - 0xcc */ - volatile unsigned int BB_fcal_1; /* 0xcc - 0xd0 */ - volatile unsigned int BB_fcal_2_b0; /* 0xd0 - 0xd4 */ - volatile unsigned int BB_dft_tone_ctrl_b0; /* 0xd4 - 0xd8 */ - volatile unsigned int BB_cl_cal_ctrl; /* 0xd8 - 0xdc */ - volatile unsigned int BB_cl_map_0_b0; /* 0xdc - 0xe0 */ - volatile unsigned int BB_cl_map_1_b0; /* 0xe0 - 0xe4 */ - volatile unsigned int BB_cl_map_2_b0; /* 0xe4 - 0xe8 */ - volatile unsigned int BB_cl_map_3_b0; /* 0xe8 - 0xec */ - volatile unsigned int BB_cl_map_pal_0_b0; /* 0xec - 0xf0 */ - volatile unsigned int BB_cl_map_pal_1_b0; /* 0xf0 - 0xf4 */ - volatile unsigned int BB_cl_map_pal_2_b0; /* 0xf4 - 0xf8 */ - volatile unsigned int BB_cl_map_pal_3_b0; /* 0xf8 - 0xfc */ - volatile char pad__5[0x4]; /* 0xfc - 0x100 */ - volatile unsigned int BB_cl_tab_b0[16]; /* 0x100 - 0x140 */ - volatile unsigned int BB_synth_control; /* 0x140 - 0x144 */ - volatile unsigned int BB_addac_clk_select; /* 0x144 - 0x148 */ - volatile unsigned int BB_pll_cntl; /* 0x148 - 0x14c */ - volatile unsigned int BB_analog_swap; /* 0x14c - 0x150 */ - volatile unsigned int BB_addac_parallel_control; /* 0x150 - 0x154 */ - volatile char pad__6[0x4]; /* 0x154 - 0x158 */ - volatile unsigned int BB_force_analog; /* 0x158 - 0x15c */ - volatile char pad__7[0x4]; /* 0x15c - 0x160 */ - volatile unsigned int BB_test_controls; /* 0x160 - 0x164 */ - volatile unsigned int BB_test_controls_status; /* 0x164 - 0x168 */ - volatile unsigned int BB_tstdac; /* 0x168 - 0x16c */ - volatile unsigned int BB_channel_status; /* 0x16c - 0x170 */ - volatile unsigned int BB_chaninfo_ctrl; /* 0x170 - 0x174 */ - volatile unsigned int BB_chan_info_noise_pwr; /* 0x174 - 0x178 */ - volatile unsigned int BB_chan_info_gain_diff; /* 0x178 - 0x17c */ - volatile unsigned int BB_chan_info_fine_timing; /* 0x17c - 0x180 */ - volatile unsigned int BB_chan_info_gain_b0; /* 0x180 - 0x184 */ - volatile unsigned int BB_sm_hist; /* 0x184 - 0x188 */ - volatile char pad__8[0x8]; /* 0x188 - 0x190 */ - volatile unsigned int BB_scrambler_seed; /* 0x190 - 0x194 */ - volatile unsigned int BB_bbb_tx_ctrl; /* 0x194 - 0x198 */ - volatile unsigned int BB_bbb_txfir_0; /* 0x198 - 0x19c */ - volatile unsigned int BB_bbb_txfir_1; /* 0x19c - 0x1a0 */ - volatile unsigned int BB_bbb_txfir_2; /* 0x1a0 - 0x1a4 */ - volatile unsigned int BB_heavy_clip_ctrl; /* 0x1a4 - 0x1a8 */ - volatile unsigned int BB_heavy_clip_20; /* 0x1a8 - 0x1ac */ - volatile unsigned int BB_heavy_clip_40; /* 0x1ac - 0x1b0 */ - volatile unsigned int BB_illegal_tx_rate; /* 0x1b0 - 0x1b4 */ - volatile char pad__9[0xc]; /* 0x1b4 - 0x1c0 */ - volatile unsigned int BB_powertx_rate1; /* 0x1c0 - 0x1c4 */ - volatile unsigned int BB_powertx_rate2; /* 0x1c4 - 0x1c8 */ - volatile unsigned int BB_powertx_rate3; /* 0x1c8 - 0x1cc */ - volatile unsigned int BB_powertx_rate4; /* 0x1cc - 0x1d0 */ - volatile unsigned int BB_powertx_rate5; /* 0x1d0 - 0x1d4 */ - volatile unsigned int BB_powertx_rate6; /* 0x1d4 - 0x1d8 */ - volatile unsigned int BB_powertx_rate7; /* 0x1d8 - 0x1dc */ - volatile unsigned int BB_powertx_rate8; /* 0x1dc - 0x1e0 */ - volatile unsigned int BB_powertx_rate9; /* 0x1e0 - 0x1e4 */ - volatile unsigned int BB_powertx_rate10; /* 0x1e4 - 0x1e8 */ - volatile unsigned int BB_powertx_rate11; /* 0x1e8 - 0x1ec */ - volatile unsigned int BB_powertx_rate12; /* 0x1ec - 0x1f0 */ - volatile unsigned int BB_powertx_max; /* 0x1f0 - 0x1f4 */ - volatile unsigned int BB_powertx_sub; /* 0x1f4 - 0x1f8 */ - volatile unsigned int BB_tpc_1; /* 0x1f8 - 0x1fc */ - volatile unsigned int BB_tpc_2; /* 0x1fc - 0x200 */ - volatile unsigned int BB_tpc_3; /* 0x200 - 0x204 */ - volatile unsigned int BB_tpc_4_b0; /* 0x204 - 0x208 */ - volatile unsigned int BB_tpc_5_b0; /* 0x208 - 0x20c */ - volatile unsigned int BB_tpc_6_b0; /* 0x20c - 0x210 */ - volatile unsigned int BB_tpc_7; /* 0x210 - 0x214 */ - volatile unsigned int BB_tpc_8; /* 0x214 - 0x218 */ - volatile unsigned int BB_tpc_9; /* 0x218 - 0x21c */ - volatile unsigned int BB_tpc_10; /* 0x21c - 0x220 */ - volatile unsigned int BB_tpc_11_b0; /* 0x220 - 0x224 */ - volatile unsigned int BB_tpc_12; /* 0x224 - 0x228 */ - volatile unsigned int BB_tpc_13; /* 0x228 - 0x22c */ - volatile unsigned int BB_tpc_14; /* 0x22c - 0x230 */ - volatile unsigned int BB_tpc_15; /* 0x230 - 0x234 */ - volatile unsigned int BB_tpc_16; /* 0x234 - 0x238 */ - volatile unsigned int BB_tpc_17; /* 0x238 - 0x23c */ - volatile unsigned int BB_tpc_18; /* 0x23c - 0x240 */ - volatile unsigned int BB_tpc_19_b0; /* 0x240 - 0x244 */ - volatile unsigned int BB_tpc_20; /* 0x244 - 0x248 */ - volatile unsigned int BB_therm_adc_1; /* 0x248 - 0x24c */ - volatile unsigned int BB_therm_adc_2; /* 0x24c - 0x250 */ - volatile unsigned int BB_therm_adc_3; /* 0x250 - 0x254 */ - volatile unsigned int BB_therm_adc_4; /* 0x254 - 0x258 */ - volatile unsigned int BB_tx_forced_gain; /* 0x258 - 0x25c */ - volatile char pad__10[0x24]; /* 0x25c - 0x280 */ - volatile unsigned int BB_pdadc_tab_b0[32]; /* 0x280 - 0x300 */ - volatile unsigned int BB_tx_gain_tab_1; /* 0x300 - 0x304 */ - volatile unsigned int BB_tx_gain_tab_2; /* 0x304 - 0x308 */ - volatile unsigned int BB_tx_gain_tab_3; /* 0x308 - 0x30c */ - volatile unsigned int BB_tx_gain_tab_4; /* 0x30c - 0x310 */ - volatile unsigned int BB_tx_gain_tab_5; /* 0x310 - 0x314 */ - volatile unsigned int BB_tx_gain_tab_6; /* 0x314 - 0x318 */ - volatile unsigned int BB_tx_gain_tab_7; /* 0x318 - 0x31c */ - volatile unsigned int BB_tx_gain_tab_8; /* 0x31c - 0x320 */ - volatile unsigned int BB_tx_gain_tab_9; /* 0x320 - 0x324 */ - volatile unsigned int BB_tx_gain_tab_10; /* 0x324 - 0x328 */ - volatile unsigned int BB_tx_gain_tab_11; /* 0x328 - 0x32c */ - volatile unsigned int BB_tx_gain_tab_12; /* 0x32c - 0x330 */ - volatile unsigned int BB_tx_gain_tab_13; /* 0x330 - 0x334 */ - volatile unsigned int BB_tx_gain_tab_14; /* 0x334 - 0x338 */ - volatile unsigned int BB_tx_gain_tab_15; /* 0x338 - 0x33c */ - volatile unsigned int BB_tx_gain_tab_16; /* 0x33c - 0x340 */ - volatile unsigned int BB_tx_gain_tab_17; /* 0x340 - 0x344 */ - volatile unsigned int BB_tx_gain_tab_18; /* 0x344 - 0x348 */ - volatile unsigned int BB_tx_gain_tab_19; /* 0x348 - 0x34c */ - volatile unsigned int BB_tx_gain_tab_20; /* 0x34c - 0x350 */ - volatile unsigned int BB_tx_gain_tab_21; /* 0x350 - 0x354 */ - volatile unsigned int BB_tx_gain_tab_22; /* 0x354 - 0x358 */ - volatile unsigned int BB_tx_gain_tab_23; /* 0x358 - 0x35c */ - volatile unsigned int BB_tx_gain_tab_24; /* 0x35c - 0x360 */ - volatile unsigned int BB_tx_gain_tab_25; /* 0x360 - 0x364 */ - volatile unsigned int BB_tx_gain_tab_26; /* 0x364 - 0x368 */ - volatile unsigned int BB_tx_gain_tab_27; /* 0x368 - 0x36c */ - volatile unsigned int BB_tx_gain_tab_28; /* 0x36c - 0x370 */ - volatile unsigned int BB_tx_gain_tab_29; /* 0x370 - 0x374 */ - volatile unsigned int BB_tx_gain_tab_30; /* 0x374 - 0x378 */ - volatile unsigned int BB_tx_gain_tab_31; /* 0x378 - 0x37c */ - volatile unsigned int BB_tx_gain_tab_32; /* 0x37c - 0x380 */ - volatile unsigned int BB_rtt_ctrl; /* 0x380 - 0x384 */ - volatile unsigned int BB_rtt_table_sw_intf_b0; /* 0x384 - 0x388 */ - volatile unsigned int BB_rtt_table_sw_intf_1_b0; /* 0x388 - 0x38c */ - volatile unsigned int BB_tx_gain_tab_1_16_lsb_ext; /* 0x38c - 0x390 */ - volatile unsigned int BB_tx_gain_tab_17_32_lsb_ext; /* 0x390 - 0x394 */ - volatile char pad__11[0x6c]; /* 0x394 - 0x400 */ - volatile unsigned int BB_caltx_gain_set_0; /* 0x400 - 0x404 */ - volatile unsigned int BB_caltx_gain_set_2; /* 0x404 - 0x408 */ - volatile unsigned int BB_caltx_gain_set_4; /* 0x408 - 0x40c */ - volatile unsigned int BB_caltx_gain_set_6; /* 0x40c - 0x410 */ - volatile unsigned int BB_caltx_gain_set_8; /* 0x410 - 0x414 */ - volatile unsigned int BB_caltx_gain_set_10; /* 0x414 - 0x418 */ - volatile unsigned int BB_caltx_gain_set_12; /* 0x418 - 0x41c */ - volatile unsigned int BB_caltx_gain_set_14; /* 0x41c - 0x420 */ - volatile unsigned int BB_caltx_gain_set_16; /* 0x420 - 0x424 */ - volatile unsigned int BB_caltx_gain_set_18; /* 0x424 - 0x428 */ - volatile unsigned int BB_caltx_gain_set_20; /* 0x428 - 0x42c */ - volatile unsigned int BB_caltx_gain_set_22; /* 0x42c - 0x430 */ - volatile unsigned int BB_caltx_gain_set_24; /* 0x430 - 0x434 */ - volatile unsigned int BB_caltx_gain_set_26; /* 0x434 - 0x438 */ - volatile unsigned int BB_caltx_gain_set_28; /* 0x438 - 0x43c */ - volatile unsigned int BB_caltx_gain_set_30; /* 0x43c - 0x440 */ - volatile char pad__12[0x4]; /* 0x440 - 0x444 */ - volatile unsigned int BB_txiqcal_control_0; /* 0x444 - 0x448 */ - volatile unsigned int BB_txiqcal_control_1; /* 0x448 - 0x44c */ - volatile unsigned int BB_txiqcal_control_2; /* 0x44c - 0x450 */ - volatile unsigned int BB_txiq_corr_coeff_01_b0; /* 0x450 - 0x454 */ - volatile unsigned int BB_txiq_corr_coeff_23_b0; /* 0x454 - 0x458 */ - volatile unsigned int BB_txiq_corr_coeff_45_b0; /* 0x458 - 0x45c */ - volatile unsigned int BB_txiq_corr_coeff_67_b0; /* 0x45c - 0x460 */ - volatile unsigned int BB_txiq_corr_coeff_89_b0; /* 0x460 - 0x464 */ - volatile unsigned int BB_txiq_corr_coeff_ab_b0; /* 0x464 - 0x468 */ - volatile unsigned int BB_txiq_corr_coeff_cd_b0; /* 0x468 - 0x46c */ - volatile unsigned int BB_txiq_corr_coeff_ef_b0; /* 0x46c - 0x470 */ - volatile unsigned int BB_cal_rxbb_gain_tbl_0; /* 0x470 - 0x474 */ - volatile unsigned int BB_cal_rxbb_gain_tbl_4; /* 0x474 - 0x478 */ - volatile unsigned int BB_cal_rxbb_gain_tbl_8; /* 0x478 - 0x47c */ - volatile unsigned int BB_cal_rxbb_gain_tbl_12; /* 0x47c - 0x480 */ - volatile unsigned int BB_cal_rxbb_gain_tbl_16; /* 0x480 - 0x484 */ - volatile unsigned int BB_cal_rxbb_gain_tbl_20; /* 0x484 - 0x488 */ - volatile unsigned int BB_cal_rxbb_gain_tbl_24; /* 0x488 - 0x48c */ - volatile unsigned int BB_txiqcal_status_b0; /* 0x48c - 0x490 */ - volatile unsigned int BB_paprd_trainer_cntl1; /* 0x490 - 0x494 */ - volatile unsigned int BB_paprd_trainer_cntl2; /* 0x494 - 0x498 */ - volatile unsigned int BB_paprd_trainer_cntl3; /* 0x498 - 0x49c */ - volatile unsigned int BB_paprd_trainer_cntl4; /* 0x49c - 0x4a0 */ - volatile unsigned int BB_paprd_trainer_stat1; /* 0x4a0 - 0x4a4 */ - volatile unsigned int BB_paprd_trainer_stat2; /* 0x4a4 - 0x4a8 */ - volatile unsigned int BB_paprd_trainer_stat3; /* 0x4a8 - 0x4ac */ - volatile char pad__13[0x114]; /* 0x4ac - 0x5c0 */ - volatile unsigned int BB_watchdog_status; /* 0x5c0 - 0x5c4 */ - volatile unsigned int BB_watchdog_ctrl_1; /* 0x5c4 - 0x5c8 */ - volatile unsigned int BB_watchdog_ctrl_2; /* 0x5c8 - 0x5cc */ - volatile unsigned int BB_bluetooth_cntl; /* 0x5cc - 0x5d0 */ - volatile unsigned int BB_phyonly_warm_reset; /* 0x5d0 - 0x5d4 */ - volatile unsigned int BB_phyonly_control; /* 0x5d4 - 0x5d8 */ - volatile char pad__14[0x4]; /* 0x5d8 - 0x5dc */ - volatile unsigned int BB_eco_ctrl; /* 0x5dc - 0x5e0 */ - volatile char pad__15[0x10]; /* 0x5e0 - 0x5f0 */ - volatile unsigned int BB_tables_intf_addr_b0; /* 0x5f0 - 0x5f4 */ - volatile unsigned int BB_tables_intf_data_b0; /* 0x5f4 - 0x5f8 */ -} bb_reg_reg_t_5; - -#endif /* __ASSEMBLER__ */ - - -/* macros for bb_chn1_reg_map.BB_ext_chan_pwr_thr_2_b1 */ -#define BB_EXT_CHAN_PWR_THR_2_B1_ADDRESS 0x00000030 -#define BB_EXT_CHAN_PWR_THR_2_B1_OFFSET 0x00000030 -#define BB_EXT_CHAN_PWR_THR_2_B1_CF_MAXCCAPWR_EXT_1_MSB 8 -#define BB_EXT_CHAN_PWR_THR_2_B1_CF_MAXCCAPWR_EXT_1_LSB 0 -#define BB_EXT_CHAN_PWR_THR_2_B1_CF_MAXCCAPWR_EXT_1_MASK 0x000001ff -#define BB_EXT_CHAN_PWR_THR_2_B1_CF_MAXCCAPWR_EXT_1_GET(x) (((x) & 0x000001ff) >> 0) -#define BB_EXT_CHAN_PWR_THR_2_B1_CF_MAXCCAPWR_EXT_1_SET(x) (((x) << 0) & 0x000001ff) -#define BB_EXT_CHAN_PWR_THR_2_B1_MINCCAPWR_EXT_1_MSB 24 -#define BB_EXT_CHAN_PWR_THR_2_B1_MINCCAPWR_EXT_1_LSB 16 -#define BB_EXT_CHAN_PWR_THR_2_B1_MINCCAPWR_EXT_1_MASK 0x01ff0000 -#define BB_EXT_CHAN_PWR_THR_2_B1_MINCCAPWR_EXT_1_GET(x) (((x) & 0x01ff0000) >> 16) - -/* macros for bb_chn1_reg_map.BB_spur_report_b1 */ -#define BB_SPUR_REPORT_B1_ADDRESS 0x000000a8 -#define BB_SPUR_REPORT_B1_OFFSET 0x000000a8 -#define BB_SPUR_REPORT_B1_SPUR_EST_I_1_MSB 7 -#define BB_SPUR_REPORT_B1_SPUR_EST_I_1_LSB 0 -#define BB_SPUR_REPORT_B1_SPUR_EST_I_1_MASK 0x000000ff -#define BB_SPUR_REPORT_B1_SPUR_EST_I_1_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_SPUR_REPORT_B1_SPUR_EST_Q_1_MSB 15 -#define BB_SPUR_REPORT_B1_SPUR_EST_Q_1_LSB 8 -#define BB_SPUR_REPORT_B1_SPUR_EST_Q_1_MASK 0x0000ff00 -#define BB_SPUR_REPORT_B1_SPUR_EST_Q_1_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_SPUR_REPORT_B1_POWER_WITH_SPUR_REMOVED_1_MSB 31 -#define BB_SPUR_REPORT_B1_POWER_WITH_SPUR_REMOVED_1_LSB 16 -#define BB_SPUR_REPORT_B1_POWER_WITH_SPUR_REMOVED_1_MASK 0xffff0000 -#define BB_SPUR_REPORT_B1_POWER_WITH_SPUR_REMOVED_1_GET(x) (((x) & 0xffff0000) >> 16) - -/* macros for bb_chn1_reg_map.BB_iq_adc_meas_0_b1 */ -#define BB_IQ_ADC_MEAS_0_B1_ADDRESS 0x000000c0 -#define BB_IQ_ADC_MEAS_0_B1_OFFSET 0x000000c0 -#define BB_IQ_ADC_MEAS_0_B1_GAIN_DC_IQ_CAL_MEAS_0_1_MSB 31 -#define BB_IQ_ADC_MEAS_0_B1_GAIN_DC_IQ_CAL_MEAS_0_1_LSB 0 -#define BB_IQ_ADC_MEAS_0_B1_GAIN_DC_IQ_CAL_MEAS_0_1_MASK 0xffffffff -#define BB_IQ_ADC_MEAS_0_B1_GAIN_DC_IQ_CAL_MEAS_0_1_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for bb_chn1_reg_map.BB_iq_adc_meas_1_b1 */ -#define BB_IQ_ADC_MEAS_1_B1_ADDRESS 0x000000c4 -#define BB_IQ_ADC_MEAS_1_B1_OFFSET 0x000000c4 -#define BB_IQ_ADC_MEAS_1_B1_GAIN_DC_IQ_CAL_MEAS_1_1_MSB 31 -#define BB_IQ_ADC_MEAS_1_B1_GAIN_DC_IQ_CAL_MEAS_1_1_LSB 0 -#define BB_IQ_ADC_MEAS_1_B1_GAIN_DC_IQ_CAL_MEAS_1_1_MASK 0xffffffff -#define BB_IQ_ADC_MEAS_1_B1_GAIN_DC_IQ_CAL_MEAS_1_1_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for bb_chn1_reg_map.BB_iq_adc_meas_2_b1 */ -#define BB_IQ_ADC_MEAS_2_B1_ADDRESS 0x000000c8 -#define BB_IQ_ADC_MEAS_2_B1_OFFSET 0x000000c8 -#define BB_IQ_ADC_MEAS_2_B1_GAIN_DC_IQ_CAL_MEAS_2_1_MSB 31 -#define BB_IQ_ADC_MEAS_2_B1_GAIN_DC_IQ_CAL_MEAS_2_1_LSB 0 -#define BB_IQ_ADC_MEAS_2_B1_GAIN_DC_IQ_CAL_MEAS_2_1_MASK 0xffffffff -#define BB_IQ_ADC_MEAS_2_B1_GAIN_DC_IQ_CAL_MEAS_2_1_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for bb_chn1_reg_map.BB_iq_adc_meas_3_b1 */ -#define BB_IQ_ADC_MEAS_3_B1_ADDRESS 0x000000cc -#define BB_IQ_ADC_MEAS_3_B1_OFFSET 0x000000cc -#define BB_IQ_ADC_MEAS_3_B1_GAIN_DC_IQ_CAL_MEAS_3_1_MSB 31 -#define BB_IQ_ADC_MEAS_3_B1_GAIN_DC_IQ_CAL_MEAS_3_1_LSB 0 -#define BB_IQ_ADC_MEAS_3_B1_GAIN_DC_IQ_CAL_MEAS_3_1_MASK 0xffffffff -#define BB_IQ_ADC_MEAS_3_B1_GAIN_DC_IQ_CAL_MEAS_3_1_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for bb_chn1_reg_map.BB_tx_phase_ramp_b1 */ -#define BB_TX_PHASE_RAMP_B1_ADDRESS 0x000000d0 -#define BB_TX_PHASE_RAMP_B1_OFFSET 0x000000d0 -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_ENABLE_1_MSB 0 -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_ENABLE_1_LSB 0 -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_ENABLE_1_MASK 0x00000001 -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_ENABLE_1_GET(x) (((x) & 0x00000001) >> 0) -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_ENABLE_1_SET(x) (((x) << 0) & 0x00000001) -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_BIAS_1_MSB 6 -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_BIAS_1_LSB 1 -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_BIAS_1_MASK 0x0000007e -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_BIAS_1_GET(x) (((x) & 0x0000007e) >> 1) -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_BIAS_1_SET(x) (((x) << 1) & 0x0000007e) -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_INIT_1_MSB 16 -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_INIT_1_LSB 7 -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_INIT_1_MASK 0x0001ff80 -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_INIT_1_GET(x) (((x) & 0x0001ff80) >> 7) -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_INIT_1_SET(x) (((x) << 7) & 0x0001ff80) -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_ALPHA_1_MSB 24 -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_ALPHA_1_LSB 17 -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_ALPHA_1_MASK 0x01fe0000 -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_ALPHA_1_GET(x) (((x) & 0x01fe0000) >> 17) -#define BB_TX_PHASE_RAMP_B1_CF_PHASE_RAMP_ALPHA_1_SET(x) (((x) << 17) & 0x01fe0000) - -/* macros for bb_chn1_reg_map.BB_adc_gain_dc_corr_b1 */ -#define BB_ADC_GAIN_DC_CORR_B1_ADDRESS 0x000000d4 -#define BB_ADC_GAIN_DC_CORR_B1_OFFSET 0x000000d4 -#define BB_ADC_GAIN_DC_CORR_B1_ADC_GAIN_CORR_Q_COEFF_1_MSB 5 -#define BB_ADC_GAIN_DC_CORR_B1_ADC_GAIN_CORR_Q_COEFF_1_LSB 0 -#define BB_ADC_GAIN_DC_CORR_B1_ADC_GAIN_CORR_Q_COEFF_1_MASK 0x0000003f -#define BB_ADC_GAIN_DC_CORR_B1_ADC_GAIN_CORR_Q_COEFF_1_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_ADC_GAIN_DC_CORR_B1_ADC_GAIN_CORR_Q_COEFF_1_SET(x) (((x) << 0) & 0x0000003f) -#define BB_ADC_GAIN_DC_CORR_B1_ADC_GAIN_CORR_I_COEFF_1_MSB 11 -#define BB_ADC_GAIN_DC_CORR_B1_ADC_GAIN_CORR_I_COEFF_1_LSB 6 -#define BB_ADC_GAIN_DC_CORR_B1_ADC_GAIN_CORR_I_COEFF_1_MASK 0x00000fc0 -#define BB_ADC_GAIN_DC_CORR_B1_ADC_GAIN_CORR_I_COEFF_1_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_ADC_GAIN_DC_CORR_B1_ADC_GAIN_CORR_I_COEFF_1_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_ADC_GAIN_DC_CORR_B1_ADC_DC_CORR_Q_COEFF_1_MSB 20 -#define BB_ADC_GAIN_DC_CORR_B1_ADC_DC_CORR_Q_COEFF_1_LSB 12 -#define BB_ADC_GAIN_DC_CORR_B1_ADC_DC_CORR_Q_COEFF_1_MASK 0x001ff000 -#define BB_ADC_GAIN_DC_CORR_B1_ADC_DC_CORR_Q_COEFF_1_GET(x) (((x) & 0x001ff000) >> 12) -#define BB_ADC_GAIN_DC_CORR_B1_ADC_DC_CORR_Q_COEFF_1_SET(x) (((x) << 12) & 0x001ff000) -#define BB_ADC_GAIN_DC_CORR_B1_ADC_DC_CORR_I_COEFF_1_MSB 29 -#define BB_ADC_GAIN_DC_CORR_B1_ADC_DC_CORR_I_COEFF_1_LSB 21 -#define BB_ADC_GAIN_DC_CORR_B1_ADC_DC_CORR_I_COEFF_1_MASK 0x3fe00000 -#define BB_ADC_GAIN_DC_CORR_B1_ADC_DC_CORR_I_COEFF_1_GET(x) (((x) & 0x3fe00000) >> 21) -#define BB_ADC_GAIN_DC_CORR_B1_ADC_DC_CORR_I_COEFF_1_SET(x) (((x) << 21) & 0x3fe00000) - -/* macros for bb_chn1_reg_map.BB_rx_iq_corr_b1 */ -#define BB_RX_IQ_CORR_B1_ADDRESS 0x000000dc -#define BB_RX_IQ_CORR_B1_OFFSET 0x000000dc -#define BB_RX_IQ_CORR_B1_RX_IQCORR_Q_Q_COFF_1_MSB 6 -#define BB_RX_IQ_CORR_B1_RX_IQCORR_Q_Q_COFF_1_LSB 0 -#define BB_RX_IQ_CORR_B1_RX_IQCORR_Q_Q_COFF_1_MASK 0x0000007f -#define BB_RX_IQ_CORR_B1_RX_IQCORR_Q_Q_COFF_1_GET(x) (((x) & 0x0000007f) >> 0) -#define BB_RX_IQ_CORR_B1_RX_IQCORR_Q_Q_COFF_1_SET(x) (((x) << 0) & 0x0000007f) -#define BB_RX_IQ_CORR_B1_RX_IQCORR_Q_I_COFF_1_MSB 13 -#define BB_RX_IQ_CORR_B1_RX_IQCORR_Q_I_COFF_1_LSB 7 -#define BB_RX_IQ_CORR_B1_RX_IQCORR_Q_I_COFF_1_MASK 0x00003f80 -#define BB_RX_IQ_CORR_B1_RX_IQCORR_Q_I_COFF_1_GET(x) (((x) & 0x00003f80) >> 7) -#define BB_RX_IQ_CORR_B1_RX_IQCORR_Q_I_COFF_1_SET(x) (((x) << 7) & 0x00003f80) -#define BB_RX_IQ_CORR_B1_LOOPBACK_IQCORR_Q_Q_COFF_1_MSB 21 -#define BB_RX_IQ_CORR_B1_LOOPBACK_IQCORR_Q_Q_COFF_1_LSB 15 -#define BB_RX_IQ_CORR_B1_LOOPBACK_IQCORR_Q_Q_COFF_1_MASK 0x003f8000 -#define BB_RX_IQ_CORR_B1_LOOPBACK_IQCORR_Q_Q_COFF_1_GET(x) (((x) & 0x003f8000) >> 15) -#define BB_RX_IQ_CORR_B1_LOOPBACK_IQCORR_Q_Q_COFF_1_SET(x) (((x) << 15) & 0x003f8000) -#define BB_RX_IQ_CORR_B1_LOOPBACK_IQCORR_Q_I_COFF_1_MSB 28 -#define BB_RX_IQ_CORR_B1_LOOPBACK_IQCORR_Q_I_COFF_1_LSB 22 -#define BB_RX_IQ_CORR_B1_LOOPBACK_IQCORR_Q_I_COFF_1_MASK 0x1fc00000 -#define BB_RX_IQ_CORR_B1_LOOPBACK_IQCORR_Q_I_COFF_1_GET(x) (((x) & 0x1fc00000) >> 22) -#define BB_RX_IQ_CORR_B1_LOOPBACK_IQCORR_Q_I_COFF_1_SET(x) (((x) << 22) & 0x1fc00000) - -/* macros for bb_chn1_reg_map.BB_paprd_ctrl0_b1 */ -#define BB_PAPRD_CTRL0_B1_ADDRESS 0x000000f0 -#define BB_PAPRD_CTRL0_B1_OFFSET 0x000000f0 -#define BB_PAPRD_CTRL0_B1_PAPRD_ENABLE_1_MSB 0 -#define BB_PAPRD_CTRL0_B1_PAPRD_ENABLE_1_LSB 0 -#define BB_PAPRD_CTRL0_B1_PAPRD_ENABLE_1_MASK 0x00000001 -#define BB_PAPRD_CTRL0_B1_PAPRD_ENABLE_1_GET(x) (((x) & 0x00000001) >> 0) -#define BB_PAPRD_CTRL0_B1_PAPRD_ENABLE_1_SET(x) (((x) << 0) & 0x00000001) -#define BB_PAPRD_CTRL0_B1_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_1_MSB 1 -#define BB_PAPRD_CTRL0_B1_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_1_LSB 1 -#define BB_PAPRD_CTRL0_B1_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_1_MASK 0x00000002 -#define BB_PAPRD_CTRL0_B1_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_1_GET(x) (((x) & 0x00000002) >> 1) -#define BB_PAPRD_CTRL0_B1_PAPRD_ADAPTIVE_USE_SINGLE_TABLE_1_SET(x) (((x) << 1) & 0x00000002) -#define BB_PAPRD_CTRL0_B1_PAPRD_VALID_GAIN_1_MSB 26 -#define BB_PAPRD_CTRL0_B1_PAPRD_VALID_GAIN_1_LSB 2 -#define BB_PAPRD_CTRL0_B1_PAPRD_VALID_GAIN_1_MASK 0x07fffffc -#define BB_PAPRD_CTRL0_B1_PAPRD_VALID_GAIN_1_GET(x) (((x) & 0x07fffffc) >> 2) -#define BB_PAPRD_CTRL0_B1_PAPRD_VALID_GAIN_1_SET(x) (((x) << 2) & 0x07fffffc) -#define BB_PAPRD_CTRL0_B1_PAPRD_MAG_THRSH_1_MSB 31 -#define BB_PAPRD_CTRL0_B1_PAPRD_MAG_THRSH_1_LSB 27 -#define BB_PAPRD_CTRL0_B1_PAPRD_MAG_THRSH_1_MASK 0xf8000000 -#define BB_PAPRD_CTRL0_B1_PAPRD_MAG_THRSH_1_GET(x) (((x) & 0xf8000000) >> 27) -#define BB_PAPRD_CTRL0_B1_PAPRD_MAG_THRSH_1_SET(x) (((x) << 27) & 0xf8000000) - -/* macros for bb_chn1_reg_map.BB_paprd_ctrl1_b1 */ -#define BB_PAPRD_CTRL1_B1_ADDRESS 0x000000f4 -#define BB_PAPRD_CTRL1_B1_OFFSET 0x000000f4 -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_SCALING_ENABLE_1_MSB 0 -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_SCALING_ENABLE_1_LSB 0 -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_SCALING_ENABLE_1_MASK 0x00000001 -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_SCALING_ENABLE_1_GET(x) (((x) & 0x00000001) >> 0) -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_SCALING_ENABLE_1_SET(x) (((x) << 0) & 0x00000001) -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_AM2AM_ENABLE_1_MSB 1 -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_AM2AM_ENABLE_1_LSB 1 -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_AM2AM_ENABLE_1_MASK 0x00000002 -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_AM2AM_ENABLE_1_GET(x) (((x) & 0x00000002) >> 1) -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_AM2AM_ENABLE_1_SET(x) (((x) << 1) & 0x00000002) -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_AM2PM_ENABLE_1_MSB 2 -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_AM2PM_ENABLE_1_LSB 2 -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_AM2PM_ENABLE_1_MASK 0x00000004 -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_AM2PM_ENABLE_1_GET(x) (((x) & 0x00000004) >> 2) -#define BB_PAPRD_CTRL1_B1_PAPRD_ADAPTIVE_AM2PM_ENABLE_1_SET(x) (((x) << 2) & 0x00000004) -#define BB_PAPRD_CTRL1_B1_PAPRD_POWER_AT_AM2AM_CAL_1_MSB 8 -#define BB_PAPRD_CTRL1_B1_PAPRD_POWER_AT_AM2AM_CAL_1_LSB 3 -#define BB_PAPRD_CTRL1_B1_PAPRD_POWER_AT_AM2AM_CAL_1_MASK 0x000001f8 -#define BB_PAPRD_CTRL1_B1_PAPRD_POWER_AT_AM2AM_CAL_1_GET(x) (((x) & 0x000001f8) >> 3) -#define BB_PAPRD_CTRL1_B1_PAPRD_POWER_AT_AM2AM_CAL_1_SET(x) (((x) << 3) & 0x000001f8) -#define BB_PAPRD_CTRL1_B1_PA_GAIN_SCALE_FACTOR_1_MSB 16 -#define BB_PAPRD_CTRL1_B1_PA_GAIN_SCALE_FACTOR_1_LSB 9 -#define BB_PAPRD_CTRL1_B1_PA_GAIN_SCALE_FACTOR_1_MASK 0x0001fe00 -#define BB_PAPRD_CTRL1_B1_PA_GAIN_SCALE_FACTOR_1_GET(x) (((x) & 0x0001fe00) >> 9) -#define BB_PAPRD_CTRL1_B1_PA_GAIN_SCALE_FACTOR_1_SET(x) (((x) << 9) & 0x0001fe00) -#define BB_PAPRD_CTRL1_B1_PAPRD_MAG_SCALE_FACTOR_1_MSB 26 -#define BB_PAPRD_CTRL1_B1_PAPRD_MAG_SCALE_FACTOR_1_LSB 17 -#define BB_PAPRD_CTRL1_B1_PAPRD_MAG_SCALE_FACTOR_1_MASK 0x07fe0000 -#define BB_PAPRD_CTRL1_B1_PAPRD_MAG_SCALE_FACTOR_1_GET(x) (((x) & 0x07fe0000) >> 17) -#define BB_PAPRD_CTRL1_B1_PAPRD_MAG_SCALE_FACTOR_1_SET(x) (((x) << 17) & 0x07fe0000) -#define BB_PAPRD_CTRL1_B1_PAPRD_TRAINER_IANDQ_SEL_1_MSB 27 -#define BB_PAPRD_CTRL1_B1_PAPRD_TRAINER_IANDQ_SEL_1_LSB 27 -#define BB_PAPRD_CTRL1_B1_PAPRD_TRAINER_IANDQ_SEL_1_MASK 0x08000000 -#define BB_PAPRD_CTRL1_B1_PAPRD_TRAINER_IANDQ_SEL_1_GET(x) (((x) & 0x08000000) >> 27) -#define BB_PAPRD_CTRL1_B1_PAPRD_TRAINER_IANDQ_SEL_1_SET(x) (((x) << 27) & 0x08000000) - -/* macros for bb_chn1_reg_map.BB_pa_gain123_b1 */ -#define BB_PA_GAIN123_B1_ADDRESS 0x000000f8 -#define BB_PA_GAIN123_B1_OFFSET 0x000000f8 -#define BB_PA_GAIN123_B1_PA_GAIN1_1_MSB 9 -#define BB_PA_GAIN123_B1_PA_GAIN1_1_LSB 0 -#define BB_PA_GAIN123_B1_PA_GAIN1_1_MASK 0x000003ff -#define BB_PA_GAIN123_B1_PA_GAIN1_1_GET(x) (((x) & 0x000003ff) >> 0) -#define BB_PA_GAIN123_B1_PA_GAIN1_1_SET(x) (((x) << 0) & 0x000003ff) -#define BB_PA_GAIN123_B1_PA_GAIN2_1_MSB 19 -#define BB_PA_GAIN123_B1_PA_GAIN2_1_LSB 10 -#define BB_PA_GAIN123_B1_PA_GAIN2_1_MASK 0x000ffc00 -#define BB_PA_GAIN123_B1_PA_GAIN2_1_GET(x) (((x) & 0x000ffc00) >> 10) -#define BB_PA_GAIN123_B1_PA_GAIN2_1_SET(x) (((x) << 10) & 0x000ffc00) -#define BB_PA_GAIN123_B1_PA_GAIN3_1_MSB 29 -#define BB_PA_GAIN123_B1_PA_GAIN3_1_LSB 20 -#define BB_PA_GAIN123_B1_PA_GAIN3_1_MASK 0x3ff00000 -#define BB_PA_GAIN123_B1_PA_GAIN3_1_GET(x) (((x) & 0x3ff00000) >> 20) -#define BB_PA_GAIN123_B1_PA_GAIN3_1_SET(x) (((x) << 20) & 0x3ff00000) - -/* macros for bb_chn1_reg_map.BB_pa_gain45_b1 */ -#define BB_PA_GAIN45_B1_ADDRESS 0x000000fc -#define BB_PA_GAIN45_B1_OFFSET 0x000000fc -#define BB_PA_GAIN45_B1_PA_GAIN4_1_MSB 9 -#define BB_PA_GAIN45_B1_PA_GAIN4_1_LSB 0 -#define BB_PA_GAIN45_B1_PA_GAIN4_1_MASK 0x000003ff -#define BB_PA_GAIN45_B1_PA_GAIN4_1_GET(x) (((x) & 0x000003ff) >> 0) -#define BB_PA_GAIN45_B1_PA_GAIN4_1_SET(x) (((x) << 0) & 0x000003ff) -#define BB_PA_GAIN45_B1_PA_GAIN5_1_MSB 19 -#define BB_PA_GAIN45_B1_PA_GAIN5_1_LSB 10 -#define BB_PA_GAIN45_B1_PA_GAIN5_1_MASK 0x000ffc00 -#define BB_PA_GAIN45_B1_PA_GAIN5_1_GET(x) (((x) & 0x000ffc00) >> 10) -#define BB_PA_GAIN45_B1_PA_GAIN5_1_SET(x) (((x) << 10) & 0x000ffc00) -#define BB_PA_GAIN45_B1_PAPRD_ADAPTIVE_TABLE_VALID_1_MSB 24 -#define BB_PA_GAIN45_B1_PAPRD_ADAPTIVE_TABLE_VALID_1_LSB 20 -#define BB_PA_GAIN45_B1_PAPRD_ADAPTIVE_TABLE_VALID_1_MASK 0x01f00000 -#define BB_PA_GAIN45_B1_PAPRD_ADAPTIVE_TABLE_VALID_1_GET(x) (((x) & 0x01f00000) >> 20) -#define BB_PA_GAIN45_B1_PAPRD_ADAPTIVE_TABLE_VALID_1_SET(x) (((x) << 20) & 0x01f00000) - -/* macros for bb_chn1_reg_map.BB_paprd_pre_post_scale_0_b1 */ -#define BB_PAPRD_PRE_POST_SCALE_0_B1_ADDRESS 0x00000100 -#define BB_PAPRD_PRE_POST_SCALE_0_B1_OFFSET 0x00000100 -#define BB_PAPRD_PRE_POST_SCALE_0_B1_PAPRD_PRE_POST_SCALING_0_1_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_0_B1_PAPRD_PRE_POST_SCALING_0_1_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_0_B1_PAPRD_PRE_POST_SCALING_0_1_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_0_B1_PAPRD_PRE_POST_SCALING_0_1_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_0_B1_PAPRD_PRE_POST_SCALING_0_1_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn1_reg_map.BB_paprd_pre_post_scale_1_b1 */ -#define BB_PAPRD_PRE_POST_SCALE_1_B1_ADDRESS 0x00000104 -#define BB_PAPRD_PRE_POST_SCALE_1_B1_OFFSET 0x00000104 -#define BB_PAPRD_PRE_POST_SCALE_1_B1_PAPRD_PRE_POST_SCALING_1_1_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_1_B1_PAPRD_PRE_POST_SCALING_1_1_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_1_B1_PAPRD_PRE_POST_SCALING_1_1_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_1_B1_PAPRD_PRE_POST_SCALING_1_1_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_1_B1_PAPRD_PRE_POST_SCALING_1_1_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn1_reg_map.BB_paprd_pre_post_scale_2_b1 */ -#define BB_PAPRD_PRE_POST_SCALE_2_B1_ADDRESS 0x00000108 -#define BB_PAPRD_PRE_POST_SCALE_2_B1_OFFSET 0x00000108 -#define BB_PAPRD_PRE_POST_SCALE_2_B1_PAPRD_PRE_POST_SCALING_2_1_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_2_B1_PAPRD_PRE_POST_SCALING_2_1_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_2_B1_PAPRD_PRE_POST_SCALING_2_1_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_2_B1_PAPRD_PRE_POST_SCALING_2_1_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_2_B1_PAPRD_PRE_POST_SCALING_2_1_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn1_reg_map.BB_paprd_pre_post_scale_3_b1 */ -#define BB_PAPRD_PRE_POST_SCALE_3_B1_ADDRESS 0x0000010c -#define BB_PAPRD_PRE_POST_SCALE_3_B1_OFFSET 0x0000010c -#define BB_PAPRD_PRE_POST_SCALE_3_B1_PAPRD_PRE_POST_SCALING_3_1_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_3_B1_PAPRD_PRE_POST_SCALING_3_1_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_3_B1_PAPRD_PRE_POST_SCALING_3_1_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_3_B1_PAPRD_PRE_POST_SCALING_3_1_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_3_B1_PAPRD_PRE_POST_SCALING_3_1_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn1_reg_map.BB_paprd_pre_post_scale_4_b1 */ -#define BB_PAPRD_PRE_POST_SCALE_4_B1_ADDRESS 0x00000110 -#define BB_PAPRD_PRE_POST_SCALE_4_B1_OFFSET 0x00000110 -#define BB_PAPRD_PRE_POST_SCALE_4_B1_PAPRD_PRE_POST_SCALING_4_1_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_4_B1_PAPRD_PRE_POST_SCALING_4_1_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_4_B1_PAPRD_PRE_POST_SCALING_4_1_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_4_B1_PAPRD_PRE_POST_SCALING_4_1_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_4_B1_PAPRD_PRE_POST_SCALING_4_1_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn1_reg_map.BB_paprd_pre_post_scale_5_b1 */ -#define BB_PAPRD_PRE_POST_SCALE_5_B1_ADDRESS 0x00000114 -#define BB_PAPRD_PRE_POST_SCALE_5_B1_OFFSET 0x00000114 -#define BB_PAPRD_PRE_POST_SCALE_5_B1_PAPRD_PRE_POST_SCALING_5_1_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_5_B1_PAPRD_PRE_POST_SCALING_5_1_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_5_B1_PAPRD_PRE_POST_SCALING_5_1_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_5_B1_PAPRD_PRE_POST_SCALING_5_1_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_5_B1_PAPRD_PRE_POST_SCALING_5_1_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn1_reg_map.BB_paprd_pre_post_scale_6_b1 */ -#define BB_PAPRD_PRE_POST_SCALE_6_B1_ADDRESS 0x00000118 -#define BB_PAPRD_PRE_POST_SCALE_6_B1_OFFSET 0x00000118 -#define BB_PAPRD_PRE_POST_SCALE_6_B1_PAPRD_PRE_POST_SCALING_6_1_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_6_B1_PAPRD_PRE_POST_SCALING_6_1_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_6_B1_PAPRD_PRE_POST_SCALING_6_1_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_6_B1_PAPRD_PRE_POST_SCALING_6_1_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_6_B1_PAPRD_PRE_POST_SCALING_6_1_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn1_reg_map.BB_paprd_pre_post_scale_7_b1 */ -#define BB_PAPRD_PRE_POST_SCALE_7_B1_ADDRESS 0x0000011c -#define BB_PAPRD_PRE_POST_SCALE_7_B1_OFFSET 0x0000011c -#define BB_PAPRD_PRE_POST_SCALE_7_B1_PAPRD_PRE_POST_SCALING_7_1_MSB 17 -#define BB_PAPRD_PRE_POST_SCALE_7_B1_PAPRD_PRE_POST_SCALING_7_1_LSB 0 -#define BB_PAPRD_PRE_POST_SCALE_7_B1_PAPRD_PRE_POST_SCALING_7_1_MASK 0x0003ffff -#define BB_PAPRD_PRE_POST_SCALE_7_B1_PAPRD_PRE_POST_SCALING_7_1_GET(x) (((x) & 0x0003ffff) >> 0) -#define BB_PAPRD_PRE_POST_SCALE_7_B1_PAPRD_PRE_POST_SCALING_7_1_SET(x) (((x) << 0) & 0x0003ffff) - -/* macros for bb_chn1_reg_map.BB_paprd_mem_tab_b1 */ -#define BB_PAPRD_MEM_TAB_B1_ADDRESS 0x00000120 -#define BB_PAPRD_MEM_TAB_B1_OFFSET 0x00000120 -#define BB_PAPRD_MEM_TAB_B1_PAPRD_MEM_MSB 21 -#define BB_PAPRD_MEM_TAB_B1_PAPRD_MEM_LSB 0 -#define BB_PAPRD_MEM_TAB_B1_PAPRD_MEM_MASK 0x003fffff -#define BB_PAPRD_MEM_TAB_B1_PAPRD_MEM_GET(x) (((x) & 0x003fffff) >> 0) -#define BB_PAPRD_MEM_TAB_B1_PAPRD_MEM_SET(x) (((x) << 0) & 0x003fffff) - -/* macros for bb_chn1_reg_map.BB_chan_info_chan_tab_b1 */ -#define BB_CHAN_INFO_CHAN_TAB_B1_ADDRESS 0x00000300 -#define BB_CHAN_INFO_CHAN_TAB_B1_OFFSET 0x00000300 -#define BB_CHAN_INFO_CHAN_TAB_B1_CHANINFO_WORD_MSB 31 -#define BB_CHAN_INFO_CHAN_TAB_B1_CHANINFO_WORD_LSB 0 -#define BB_CHAN_INFO_CHAN_TAB_B1_CHANINFO_WORD_MASK 0xffffffff -#define BB_CHAN_INFO_CHAN_TAB_B1_CHANINFO_WORD_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for bb_chn1_reg_map.BB_chn1_tables_intf_addr */ -#define BB_CHN1_TABLES_INTF_ADDR_ADDRESS 0x000003f0 -#define BB_CHN1_TABLES_INTF_ADDR_OFFSET 0x000003f0 -#define BB_CHN1_TABLES_INTF_ADDR_CHN1_TABLES_ADDR_MSB 17 -#define BB_CHN1_TABLES_INTF_ADDR_CHN1_TABLES_ADDR_LSB 2 -#define BB_CHN1_TABLES_INTF_ADDR_CHN1_TABLES_ADDR_MASK 0x0003fffc -#define BB_CHN1_TABLES_INTF_ADDR_CHN1_TABLES_ADDR_GET(x) (((x) & 0x0003fffc) >> 2) -#define BB_CHN1_TABLES_INTF_ADDR_CHN1_TABLES_ADDR_SET(x) (((x) << 2) & 0x0003fffc) -#define BB_CHN1_TABLES_INTF_ADDR_CHN1_ADDR_AUTO_INCR_MSB 31 -#define BB_CHN1_TABLES_INTF_ADDR_CHN1_ADDR_AUTO_INCR_LSB 31 -#define BB_CHN1_TABLES_INTF_ADDR_CHN1_ADDR_AUTO_INCR_MASK 0x80000000 -#define BB_CHN1_TABLES_INTF_ADDR_CHN1_ADDR_AUTO_INCR_GET(x) (((x) & 0x80000000) >> 31) -#define BB_CHN1_TABLES_INTF_ADDR_CHN1_ADDR_AUTO_INCR_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_chn1_reg_map.BB_chn1_tables_intf_data */ -#define BB_CHN1_TABLES_INTF_DATA_ADDRESS 0x000003f4 -#define BB_CHN1_TABLES_INTF_DATA_OFFSET 0x000003f4 -#define BB_CHN1_TABLES_INTF_DATA_CHN1_TABLES_DATA_MSB 31 -#define BB_CHN1_TABLES_INTF_DATA_CHN1_TABLES_DATA_LSB 0 -#define BB_CHN1_TABLES_INTF_DATA_CHN1_TABLES_DATA_MASK 0xffffffff -#define BB_CHN1_TABLES_INTF_DATA_CHN1_TABLES_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CHN1_TABLES_INTF_DATA_CHN1_TABLES_DATA_SET(x) (((x) << 0) & 0xffffffff) - -#ifndef __ASSEMBLER__ - -typedef struct bb_reg_reg_s_6 { - volatile char pad__0[0x30]; /* 0x0 - 0x30 */ - volatile unsigned int BB_ext_chan_pwr_thr_2_b1; /* 0x30 - 0x34 */ - volatile char pad__1[0x74]; /* 0x34 - 0xa8 */ - volatile unsigned int BB_spur_report_b1; /* 0xa8 - 0xac */ - volatile char pad__2[0x14]; /* 0xac - 0xc0 */ - volatile unsigned int BB_iq_adc_meas_0_b1; /* 0xc0 - 0xc4 */ - volatile unsigned int BB_iq_adc_meas_1_b1; /* 0xc4 - 0xc8 */ - volatile unsigned int BB_iq_adc_meas_2_b1; /* 0xc8 - 0xcc */ - volatile unsigned int BB_iq_adc_meas_3_b1; /* 0xcc - 0xd0 */ - volatile unsigned int BB_tx_phase_ramp_b1; /* 0xd0 - 0xd4 */ - volatile unsigned int BB_adc_gain_dc_corr_b1; /* 0xd4 - 0xd8 */ - volatile char pad__3[0x4]; /* 0xd8 - 0xdc */ - volatile unsigned int BB_rx_iq_corr_b1; /* 0xdc - 0xe0 */ - volatile char pad__4[0x10]; /* 0xe0 - 0xf0 */ - volatile unsigned int BB_paprd_ctrl0_b1; /* 0xf0 - 0xf4 */ - volatile unsigned int BB_paprd_ctrl1_b1; /* 0xf4 - 0xf8 */ - volatile unsigned int BB_pa_gain123_b1; /* 0xf8 - 0xfc */ - volatile unsigned int BB_pa_gain45_b1; /* 0xfc - 0x100 */ - volatile unsigned int BB_paprd_pre_post_scale_0_b1; /* 0x100 - 0x104 */ - volatile unsigned int BB_paprd_pre_post_scale_1_b1; /* 0x104 - 0x108 */ - volatile unsigned int BB_paprd_pre_post_scale_2_b1; /* 0x108 - 0x10c */ - volatile unsigned int BB_paprd_pre_post_scale_3_b1; /* 0x10c - 0x110 */ - volatile unsigned int BB_paprd_pre_post_scale_4_b1; /* 0x110 - 0x114 */ - volatile unsigned int BB_paprd_pre_post_scale_5_b1; /* 0x114 - 0x118 */ - volatile unsigned int BB_paprd_pre_post_scale_6_b1; /* 0x118 - 0x11c */ - volatile unsigned int BB_paprd_pre_post_scale_7_b1; /* 0x11c - 0x120 */ - volatile unsigned int BB_paprd_mem_tab_b1[120]; /* 0x120 - 0x300 */ - volatile unsigned int BB_chan_info_chan_tab_b1[60]; /* 0x300 - 0x3f0 */ - volatile unsigned int BB_chn1_tables_intf_addr; /* 0x3f0 - 0x3f4 */ - volatile unsigned int BB_chn1_tables_intf_data; /* 0x3f4 - 0x3f8 */ -} bb_reg_reg_t_6; - -#endif /* __ASSEMBLER__ */ - - -/* macros for bb_agc1_reg_map.BB_gain_force_max_gains_b1 */ -#define BB_GAIN_FORCE_MAX_GAINS_B1_ADDRESS 0x00000004 -#define BB_GAIN_FORCE_MAX_GAINS_B1_OFFSET 0x00000004 -#define BB_GAIN_FORCE_MAX_GAINS_B1_RF_GAIN_F_1_MSB 7 -#define BB_GAIN_FORCE_MAX_GAINS_B1_RF_GAIN_F_1_LSB 0 -#define BB_GAIN_FORCE_MAX_GAINS_B1_RF_GAIN_F_1_MASK 0x000000ff -#define BB_GAIN_FORCE_MAX_GAINS_B1_RF_GAIN_F_1_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_GAIN_FORCE_MAX_GAINS_B1_RF_GAIN_F_1_SET(x) (((x) << 0) & 0x000000ff) -#define BB_GAIN_FORCE_MAX_GAINS_B1_MB_GAIN_F_1_MSB 15 -#define BB_GAIN_FORCE_MAX_GAINS_B1_MB_GAIN_F_1_LSB 8 -#define BB_GAIN_FORCE_MAX_GAINS_B1_MB_GAIN_F_1_MASK 0x0000ff00 -#define BB_GAIN_FORCE_MAX_GAINS_B1_MB_GAIN_F_1_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_GAIN_FORCE_MAX_GAINS_B1_MB_GAIN_F_1_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_SW_F_1_MSB 16 -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_SW_F_1_LSB 16 -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_SW_F_1_MASK 0x00010000 -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_SW_F_1_GET(x) (((x) & 0x00010000) >> 16) -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_SW_F_1_SET(x) (((x) << 16) & 0x00010000) -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_SW_F_1_MSB 17 -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_SW_F_1_LSB 17 -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_SW_F_1_MASK 0x00020000 -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_SW_F_1_GET(x) (((x) & 0x00020000) >> 17) -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_SW_F_1_SET(x) (((x) << 17) & 0x00020000) -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_HYST_MARGIN_1_MSB 24 -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_HYST_MARGIN_1_LSB 18 -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_HYST_MARGIN_1_MASK 0x01fc0000 -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_HYST_MARGIN_1_GET(x) (((x) & 0x01fc0000) >> 18) -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN1_HYST_MARGIN_1_SET(x) (((x) << 18) & 0x01fc0000) -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_HYST_MARGIN_1_MSB 31 -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_HYST_MARGIN_1_LSB 25 -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_HYST_MARGIN_1_MASK 0xfe000000 -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_HYST_MARGIN_1_GET(x) (((x) & 0xfe000000) >> 25) -#define BB_GAIN_FORCE_MAX_GAINS_B1_XATTEN2_HYST_MARGIN_1_SET(x) (((x) << 25) & 0xfe000000) - -/* macros for bb_agc1_reg_map.BB_ext_atten_switch_ctl_b1 */ -#define BB_EXT_ATTEN_SWITCH_CTL_B1_ADDRESS 0x00000018 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_OFFSET 0x00000018 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_DB_1_MSB 5 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_DB_1_LSB 0 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_DB_1_MASK 0x0000003f -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_DB_1_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_DB_1_SET(x) (((x) << 0) & 0x0000003f) -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_DB_1_MSB 11 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_DB_1_LSB 6 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_DB_1_MASK 0x00000fc0 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_DB_1_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_DB_1_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_MARGIN_1_MSB 16 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_MARGIN_1_LSB 12 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_MARGIN_1_MASK 0x0001f000 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_MARGIN_1_GET(x) (((x) & 0x0001f000) >> 12) -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN1_MARGIN_1_SET(x) (((x) << 12) & 0x0001f000) -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_MARGIN_1_MSB 21 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_MARGIN_1_LSB 17 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_MARGIN_1_MASK 0x003e0000 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_MARGIN_1_GET(x) (((x) & 0x003e0000) >> 17) -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XATTEN2_MARGIN_1_SET(x) (((x) << 17) & 0x003e0000) -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XLNA_GAIN_DB_1_MSB 26 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XLNA_GAIN_DB_1_LSB 22 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XLNA_GAIN_DB_1_MASK 0x07c00000 -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XLNA_GAIN_DB_1_GET(x) (((x) & 0x07c00000) >> 22) -#define BB_EXT_ATTEN_SWITCH_CTL_B1_XLNA_GAIN_DB_1_SET(x) (((x) << 22) & 0x07c00000) - -/* macros for bb_agc1_reg_map.BB_cca_b1 */ -#define BB_CCA_B1_ADDRESS 0x0000001c -#define BB_CCA_B1_OFFSET 0x0000001c -#define BB_CCA_B1_CF_MAXCCAPWR_1_MSB 8 -#define BB_CCA_B1_CF_MAXCCAPWR_1_LSB 0 -#define BB_CCA_B1_CF_MAXCCAPWR_1_MASK 0x000001ff -#define BB_CCA_B1_CF_MAXCCAPWR_1_GET(x) (((x) & 0x000001ff) >> 0) -#define BB_CCA_B1_CF_MAXCCAPWR_1_SET(x) (((x) << 0) & 0x000001ff) -#define BB_CCA_B1_MINCCAPWR_1_MSB 28 -#define BB_CCA_B1_MINCCAPWR_1_LSB 20 -#define BB_CCA_B1_MINCCAPWR_1_MASK 0x1ff00000 -#define BB_CCA_B1_MINCCAPWR_1_GET(x) (((x) & 0x1ff00000) >> 20) - -/* macros for bb_agc1_reg_map.BB_cca_ctrl_2_b1 */ -#define BB_CCA_CTRL_2_B1_ADDRESS 0x00000020 -#define BB_CCA_CTRL_2_B1_OFFSET 0x00000020 -#define BB_CCA_CTRL_2_B1_MINCCAPWR_THR_1_MSB 8 -#define BB_CCA_CTRL_2_B1_MINCCAPWR_THR_1_LSB 0 -#define BB_CCA_CTRL_2_B1_MINCCAPWR_THR_1_MASK 0x000001ff -#define BB_CCA_CTRL_2_B1_MINCCAPWR_THR_1_GET(x) (((x) & 0x000001ff) >> 0) -#define BB_CCA_CTRL_2_B1_MINCCAPWR_THR_1_SET(x) (((x) << 0) & 0x000001ff) -#define BB_CCA_CTRL_2_B1_NF_GAIN_COMP_1_MSB 17 -#define BB_CCA_CTRL_2_B1_NF_GAIN_COMP_1_LSB 10 -#define BB_CCA_CTRL_2_B1_NF_GAIN_COMP_1_MASK 0x0003fc00 -#define BB_CCA_CTRL_2_B1_NF_GAIN_COMP_1_GET(x) (((x) & 0x0003fc00) >> 10) -#define BB_CCA_CTRL_2_B1_NF_GAIN_COMP_1_SET(x) (((x) << 10) & 0x0003fc00) - -/* macros for bb_agc1_reg_map.BB_rssi_b1 */ -#define BB_RSSI_B1_ADDRESS 0x00000180 -#define BB_RSSI_B1_OFFSET 0x00000180 -#define BB_RSSI_B1_RSSI_1_MSB 7 -#define BB_RSSI_B1_RSSI_1_LSB 0 -#define BB_RSSI_B1_RSSI_1_MASK 0x000000ff -#define BB_RSSI_B1_RSSI_1_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_RSSI_B1_RSSI_EXT_1_MSB 15 -#define BB_RSSI_B1_RSSI_EXT_1_LSB 8 -#define BB_RSSI_B1_RSSI_EXT_1_MASK 0x0000ff00 -#define BB_RSSI_B1_RSSI_EXT_1_GET(x) (((x) & 0x0000ff00) >> 8) - -/* macros for bb_agc1_reg_map.BB_spur_est_cck_report_b1 */ -#define BB_SPUR_EST_CCK_REPORT_B1_ADDRESS 0x00000184 -#define BB_SPUR_EST_CCK_REPORT_B1_OFFSET 0x00000184 -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_SD_I_1_CCK_MSB 7 -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_SD_I_1_CCK_LSB 0 -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_SD_I_1_CCK_MASK 0x000000ff -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_SD_I_1_CCK_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_SD_Q_1_CCK_MSB 15 -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_SD_Q_1_CCK_LSB 8 -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_SD_Q_1_CCK_MASK 0x0000ff00 -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_SD_Q_1_CCK_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_I_1_CCK_MSB 23 -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_I_1_CCK_LSB 16 -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_I_1_CCK_MASK 0x00ff0000 -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_I_1_CCK_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_Q_1_CCK_MSB 31 -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_Q_1_CCK_LSB 24 -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_Q_1_CCK_MASK 0xff000000 -#define BB_SPUR_EST_CCK_REPORT_B1_SPUR_EST_Q_1_CCK_GET(x) (((x) & 0xff000000) >> 24) - -/* macros for bb_agc1_reg_map.BB_agc_dig_dc_status_i_b1 */ -#define BB_AGC_DIG_DC_STATUS_I_B1_ADDRESS 0x00000188 -#define BB_AGC_DIG_DC_STATUS_I_B1_OFFSET 0x00000188 -#define BB_AGC_DIG_DC_STATUS_I_B1_DIG_DC_C1_RES_I_1_MSB 8 -#define BB_AGC_DIG_DC_STATUS_I_B1_DIG_DC_C1_RES_I_1_LSB 0 -#define BB_AGC_DIG_DC_STATUS_I_B1_DIG_DC_C1_RES_I_1_MASK 0x000001ff -#define BB_AGC_DIG_DC_STATUS_I_B1_DIG_DC_C1_RES_I_1_GET(x) (((x) & 0x000001ff) >> 0) -#define BB_AGC_DIG_DC_STATUS_I_B1_DIG_DC_C2_RES_I_1_MSB 17 -#define BB_AGC_DIG_DC_STATUS_I_B1_DIG_DC_C2_RES_I_1_LSB 9 -#define BB_AGC_DIG_DC_STATUS_I_B1_DIG_DC_C2_RES_I_1_MASK 0x0003fe00 -#define BB_AGC_DIG_DC_STATUS_I_B1_DIG_DC_C2_RES_I_1_GET(x) (((x) & 0x0003fe00) >> 9) -#define BB_AGC_DIG_DC_STATUS_I_B1_DIG_DC_C3_RES_I_1_MSB 26 -#define BB_AGC_DIG_DC_STATUS_I_B1_DIG_DC_C3_RES_I_1_LSB 18 -#define BB_AGC_DIG_DC_STATUS_I_B1_DIG_DC_C3_RES_I_1_MASK 0x07fc0000 -#define BB_AGC_DIG_DC_STATUS_I_B1_DIG_DC_C3_RES_I_1_GET(x) (((x) & 0x07fc0000) >> 18) - -/* macros for bb_agc1_reg_map.BB_agc_dig_dc_status_q_b1 */ -#define BB_AGC_DIG_DC_STATUS_Q_B1_ADDRESS 0x0000018c -#define BB_AGC_DIG_DC_STATUS_Q_B1_OFFSET 0x0000018c -#define BB_AGC_DIG_DC_STATUS_Q_B1_DIG_DC_C1_RES_Q_1_MSB 8 -#define BB_AGC_DIG_DC_STATUS_Q_B1_DIG_DC_C1_RES_Q_1_LSB 0 -#define BB_AGC_DIG_DC_STATUS_Q_B1_DIG_DC_C1_RES_Q_1_MASK 0x000001ff -#define BB_AGC_DIG_DC_STATUS_Q_B1_DIG_DC_C1_RES_Q_1_GET(x) (((x) & 0x000001ff) >> 0) -#define BB_AGC_DIG_DC_STATUS_Q_B1_DIG_DC_C2_RES_Q_1_MSB 17 -#define BB_AGC_DIG_DC_STATUS_Q_B1_DIG_DC_C2_RES_Q_1_LSB 9 -#define BB_AGC_DIG_DC_STATUS_Q_B1_DIG_DC_C2_RES_Q_1_MASK 0x0003fe00 -#define BB_AGC_DIG_DC_STATUS_Q_B1_DIG_DC_C2_RES_Q_1_GET(x) (((x) & 0x0003fe00) >> 9) -#define BB_AGC_DIG_DC_STATUS_Q_B1_DIG_DC_C3_RES_Q_1_MSB 26 -#define BB_AGC_DIG_DC_STATUS_Q_B1_DIG_DC_C3_RES_Q_1_LSB 18 -#define BB_AGC_DIG_DC_STATUS_Q_B1_DIG_DC_C3_RES_Q_1_MASK 0x07fc0000 -#define BB_AGC_DIG_DC_STATUS_Q_B1_DIG_DC_C3_RES_Q_1_GET(x) (((x) & 0x07fc0000) >> 18) - -/* macros for bb_agc1_reg_map.BB_dc_cal_status_b1 */ -#define BB_DC_CAL_STATUS_B1_ADDRESS 0x00000190 -#define BB_DC_CAL_STATUS_B1_OFFSET 0x00000190 -#define BB_DC_CAL_STATUS_B1_OFFSETC1I_1_MSB 4 -#define BB_DC_CAL_STATUS_B1_OFFSETC1I_1_LSB 0 -#define BB_DC_CAL_STATUS_B1_OFFSETC1I_1_MASK 0x0000001f -#define BB_DC_CAL_STATUS_B1_OFFSETC1I_1_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_DC_CAL_STATUS_B1_OFFSETC1Q_1_MSB 9 -#define BB_DC_CAL_STATUS_B1_OFFSETC1Q_1_LSB 5 -#define BB_DC_CAL_STATUS_B1_OFFSETC1Q_1_MASK 0x000003e0 -#define BB_DC_CAL_STATUS_B1_OFFSETC1Q_1_GET(x) (((x) & 0x000003e0) >> 5) -#define BB_DC_CAL_STATUS_B1_OFFSETC2I_1_MSB 14 -#define BB_DC_CAL_STATUS_B1_OFFSETC2I_1_LSB 10 -#define BB_DC_CAL_STATUS_B1_OFFSETC2I_1_MASK 0x00007c00 -#define BB_DC_CAL_STATUS_B1_OFFSETC2I_1_GET(x) (((x) & 0x00007c00) >> 10) -#define BB_DC_CAL_STATUS_B1_OFFSETC2Q_1_MSB 19 -#define BB_DC_CAL_STATUS_B1_OFFSETC2Q_1_LSB 15 -#define BB_DC_CAL_STATUS_B1_OFFSETC2Q_1_MASK 0x000f8000 -#define BB_DC_CAL_STATUS_B1_OFFSETC2Q_1_GET(x) (((x) & 0x000f8000) >> 15) -#define BB_DC_CAL_STATUS_B1_OFFSETC3I_1_MSB 24 -#define BB_DC_CAL_STATUS_B1_OFFSETC3I_1_LSB 20 -#define BB_DC_CAL_STATUS_B1_OFFSETC3I_1_MASK 0x01f00000 -#define BB_DC_CAL_STATUS_B1_OFFSETC3I_1_GET(x) (((x) & 0x01f00000) >> 20) -#define BB_DC_CAL_STATUS_B1_OFFSETC3Q_1_MSB 29 -#define BB_DC_CAL_STATUS_B1_OFFSETC3Q_1_LSB 25 -#define BB_DC_CAL_STATUS_B1_OFFSETC3Q_1_MASK 0x3e000000 -#define BB_DC_CAL_STATUS_B1_OFFSETC3Q_1_GET(x) (((x) & 0x3e000000) >> 25) - -/* macros for bb_agc1_reg_map.BB_rx_ocgain2 */ -#define BB_RX_OCGAIN2_ADDRESS 0x00000200 -#define BB_RX_OCGAIN2_OFFSET 0x00000200 -#define BB_RX_OCGAIN2_GAIN_ENTRY2_MSB 31 -#define BB_RX_OCGAIN2_GAIN_ENTRY2_LSB 0 -#define BB_RX_OCGAIN2_GAIN_ENTRY2_MASK 0xffffffff -#define BB_RX_OCGAIN2_GAIN_ENTRY2_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_RX_OCGAIN2_GAIN_ENTRY2_SET(x) (((x) << 0) & 0xffffffff) - -#ifndef __ASSEMBLER__ - -typedef struct bb_reg_reg_s_7 { - volatile char pad__0[0x4]; /* 0x0 - 0x4 */ - volatile unsigned int BB_gain_force_max_gains_b1; /* 0x4 - 0x8 */ - volatile char pad__1[0x10]; /* 0x8 - 0x18 */ - volatile unsigned int BB_ext_atten_switch_ctl_b1; /* 0x18 - 0x1c */ - volatile unsigned int BB_cca_b1; /* 0x1c - 0x20 */ - volatile unsigned int BB_cca_ctrl_2_b1; /* 0x20 - 0x24 */ - volatile char pad__2[0x15c]; /* 0x24 - 0x180 */ - volatile unsigned int BB_rssi_b1; /* 0x180 - 0x184 */ - volatile unsigned int BB_spur_est_cck_report_b1; /* 0x184 - 0x188 */ - volatile unsigned int BB_agc_dig_dc_status_i_b1; /* 0x188 - 0x18c */ - volatile unsigned int BB_agc_dig_dc_status_q_b1; /* 0x18c - 0x190 */ - volatile unsigned int BB_dc_cal_status_b1; /* 0x190 - 0x194 */ - volatile char pad__3[0x6c]; /* 0x194 - 0x200 */ - volatile unsigned int BB_rx_ocgain2[128]; /* 0x200 - 0x400 */ -} bb_reg_reg_t_7; - -#endif /* __ASSEMBLER__ */ - - -/* macros for bb_sm1_reg_map.BB_switch_table_chn_b1 */ -#define BB_SWITCH_TABLE_CHN_B1_ADDRESS 0x00000084 -#define BB_SWITCH_TABLE_CHN_B1_OFFSET 0x00000084 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_IDLE_1_MSB 1 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_IDLE_1_LSB 0 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_IDLE_1_MASK 0x00000003 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_IDLE_1_GET(x) (((x) & 0x00000003) >> 0) -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_IDLE_1_SET(x) (((x) << 0) & 0x00000003) -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_T_1_MSB 3 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_T_1_LSB 2 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_T_1_MASK 0x0000000c -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_T_1_GET(x) (((x) & 0x0000000c) >> 2) -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_T_1_SET(x) (((x) << 2) & 0x0000000c) -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_R_1_MSB 5 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_R_1_LSB 4 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_R_1_MASK 0x00000030 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_R_1_GET(x) (((x) & 0x00000030) >> 4) -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_R_1_SET(x) (((x) << 4) & 0x00000030) -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_RX1_1_MSB 7 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_RX1_1_LSB 6 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_RX1_1_MASK 0x000000c0 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_RX1_1_GET(x) (((x) & 0x000000c0) >> 6) -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_RX1_1_SET(x) (((x) << 6) & 0x000000c0) -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_RX12_1_MSB 9 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_RX12_1_LSB 8 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_RX12_1_MASK 0x00000300 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_RX12_1_GET(x) (((x) & 0x00000300) >> 8) -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_RX12_1_SET(x) (((x) << 8) & 0x00000300) -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_B_1_MSB 11 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_B_1_LSB 10 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_B_1_MASK 0x00000c00 -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_B_1_GET(x) (((x) & 0x00000c00) >> 10) -#define BB_SWITCH_TABLE_CHN_B1_SWITCH_TABLE_B_1_SET(x) (((x) << 10) & 0x00000c00) - -/* macros for bb_sm1_reg_map.BB_fcal_2_b1 */ -#define BB_FCAL_2_B1_ADDRESS 0x000000d0 -#define BB_FCAL_2_B1_OFFSET 0x000000d0 -#define BB_FCAL_2_B1_FLC_SW_CAP_VAL_1_MSB 7 -#define BB_FCAL_2_B1_FLC_SW_CAP_VAL_1_LSB 3 -#define BB_FCAL_2_B1_FLC_SW_CAP_VAL_1_MASK 0x000000f8 -#define BB_FCAL_2_B1_FLC_SW_CAP_VAL_1_GET(x) (((x) & 0x000000f8) >> 3) -#define BB_FCAL_2_B1_FLC_SW_CAP_VAL_1_SET(x) (((x) << 3) & 0x000000f8) -#define BB_FCAL_2_B1_FLC_CAP_VAL_STATUS_1_MSB 24 -#define BB_FCAL_2_B1_FLC_CAP_VAL_STATUS_1_LSB 20 -#define BB_FCAL_2_B1_FLC_CAP_VAL_STATUS_1_MASK 0x01f00000 -#define BB_FCAL_2_B1_FLC_CAP_VAL_STATUS_1_GET(x) (((x) & 0x01f00000) >> 20) - -/* macros for bb_sm1_reg_map.BB_dft_tone_ctrl_b1 */ -#define BB_DFT_TONE_CTRL_B1_ADDRESS 0x000000d4 -#define BB_DFT_TONE_CTRL_B1_OFFSET 0x000000d4 -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_EN_1_MSB 0 -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_EN_1_LSB 0 -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_EN_1_MASK 0x00000001 -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_EN_1_GET(x) (((x) & 0x00000001) >> 0) -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_EN_1_SET(x) (((x) << 0) & 0x00000001) -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_AMP_SEL_1_MSB 3 -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_AMP_SEL_1_LSB 2 -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_AMP_SEL_1_MASK 0x0000000c -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_AMP_SEL_1_GET(x) (((x) & 0x0000000c) >> 2) -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_AMP_SEL_1_SET(x) (((x) << 2) & 0x0000000c) -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_FREQ_ANG_1_MSB 12 -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_FREQ_ANG_1_LSB 4 -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_FREQ_ANG_1_MASK 0x00001ff0 -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_FREQ_ANG_1_GET(x) (((x) & 0x00001ff0) >> 4) -#define BB_DFT_TONE_CTRL_B1_DFT_TONE_FREQ_ANG_1_SET(x) (((x) << 4) & 0x00001ff0) - -/* macros for bb_sm1_reg_map.BB_cl_map_0_b1 */ -#define BB_CL_MAP_0_B1_ADDRESS 0x000000dc -#define BB_CL_MAP_0_B1_OFFSET 0x000000dc -#define BB_CL_MAP_0_B1_CL_MAP_0_MSB 31 -#define BB_CL_MAP_0_B1_CL_MAP_0_LSB 0 -#define BB_CL_MAP_0_B1_CL_MAP_0_MASK 0xffffffff -#define BB_CL_MAP_0_B1_CL_MAP_0_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_0_B1_CL_MAP_0_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm1_reg_map.BB_cl_map_1_b1 */ -#define BB_CL_MAP_1_B1_ADDRESS 0x000000e0 -#define BB_CL_MAP_1_B1_OFFSET 0x000000e0 -#define BB_CL_MAP_1_B1_CL_MAP_1_MSB 31 -#define BB_CL_MAP_1_B1_CL_MAP_1_LSB 0 -#define BB_CL_MAP_1_B1_CL_MAP_1_MASK 0xffffffff -#define BB_CL_MAP_1_B1_CL_MAP_1_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_1_B1_CL_MAP_1_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm1_reg_map.BB_cl_map_2_b1 */ -#define BB_CL_MAP_2_B1_ADDRESS 0x000000e4 -#define BB_CL_MAP_2_B1_OFFSET 0x000000e4 -#define BB_CL_MAP_2_B1_CL_MAP_2_MSB 31 -#define BB_CL_MAP_2_B1_CL_MAP_2_LSB 0 -#define BB_CL_MAP_2_B1_CL_MAP_2_MASK 0xffffffff -#define BB_CL_MAP_2_B1_CL_MAP_2_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_2_B1_CL_MAP_2_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm1_reg_map.BB_cl_map_3_b1 */ -#define BB_CL_MAP_3_B1_ADDRESS 0x000000e8 -#define BB_CL_MAP_3_B1_OFFSET 0x000000e8 -#define BB_CL_MAP_3_B1_CL_MAP_3_MSB 31 -#define BB_CL_MAP_3_B1_CL_MAP_3_LSB 0 -#define BB_CL_MAP_3_B1_CL_MAP_3_MASK 0xffffffff -#define BB_CL_MAP_3_B1_CL_MAP_3_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_3_B1_CL_MAP_3_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm1_reg_map.BB_cl_map_pal_0_b1 */ -#define BB_CL_MAP_PAL_0_B1_ADDRESS 0x000000ec -#define BB_CL_MAP_PAL_0_B1_OFFSET 0x000000ec -#define BB_CL_MAP_PAL_0_B1_CL_MAP_0_MSB 31 -#define BB_CL_MAP_PAL_0_B1_CL_MAP_0_LSB 0 -#define BB_CL_MAP_PAL_0_B1_CL_MAP_0_MASK 0xffffffff -#define BB_CL_MAP_PAL_0_B1_CL_MAP_0_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_PAL_0_B1_CL_MAP_0_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm1_reg_map.BB_cl_map_pal_1_b1 */ -#define BB_CL_MAP_PAL_1_B1_ADDRESS 0x000000f0 -#define BB_CL_MAP_PAL_1_B1_OFFSET 0x000000f0 -#define BB_CL_MAP_PAL_1_B1_CL_MAP_1_MSB 31 -#define BB_CL_MAP_PAL_1_B1_CL_MAP_1_LSB 0 -#define BB_CL_MAP_PAL_1_B1_CL_MAP_1_MASK 0xffffffff -#define BB_CL_MAP_PAL_1_B1_CL_MAP_1_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_PAL_1_B1_CL_MAP_1_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm1_reg_map.BB_cl_map_pal_2_b1 */ -#define BB_CL_MAP_PAL_2_B1_ADDRESS 0x000000f4 -#define BB_CL_MAP_PAL_2_B1_OFFSET 0x000000f4 -#define BB_CL_MAP_PAL_2_B1_CL_MAP_2_MSB 31 -#define BB_CL_MAP_PAL_2_B1_CL_MAP_2_LSB 0 -#define BB_CL_MAP_PAL_2_B1_CL_MAP_2_MASK 0xffffffff -#define BB_CL_MAP_PAL_2_B1_CL_MAP_2_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_PAL_2_B1_CL_MAP_2_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm1_reg_map.BB_cl_map_pal_3_b1 */ -#define BB_CL_MAP_PAL_3_B1_ADDRESS 0x000000f8 -#define BB_CL_MAP_PAL_3_B1_OFFSET 0x000000f8 -#define BB_CL_MAP_PAL_3_B1_CL_MAP_3_MSB 31 -#define BB_CL_MAP_PAL_3_B1_CL_MAP_3_LSB 0 -#define BB_CL_MAP_PAL_3_B1_CL_MAP_3_MASK 0xffffffff -#define BB_CL_MAP_PAL_3_B1_CL_MAP_3_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_CL_MAP_PAL_3_B1_CL_MAP_3_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm1_reg_map.BB_cl_tab_b1 */ -#define BB_CL_TAB_B1_ADDRESS 0x00000100 -#define BB_CL_TAB_B1_OFFSET 0x00000100 -#define BB_CL_TAB_B1_CL_GAIN_MOD_MSB 4 -#define BB_CL_TAB_B1_CL_GAIN_MOD_LSB 0 -#define BB_CL_TAB_B1_CL_GAIN_MOD_MASK 0x0000001f -#define BB_CL_TAB_B1_CL_GAIN_MOD_GET(x) (((x) & 0x0000001f) >> 0) -#define BB_CL_TAB_B1_CL_GAIN_MOD_SET(x) (((x) << 0) & 0x0000001f) -#define BB_CL_TAB_B1_CARR_LK_DC_ADD_Q_MSB 15 -#define BB_CL_TAB_B1_CARR_LK_DC_ADD_Q_LSB 5 -#define BB_CL_TAB_B1_CARR_LK_DC_ADD_Q_MASK 0x0000ffe0 -#define BB_CL_TAB_B1_CARR_LK_DC_ADD_Q_GET(x) (((x) & 0x0000ffe0) >> 5) -#define BB_CL_TAB_B1_CARR_LK_DC_ADD_Q_SET(x) (((x) << 5) & 0x0000ffe0) -#define BB_CL_TAB_B1_CARR_LK_DC_ADD_I_MSB 26 -#define BB_CL_TAB_B1_CARR_LK_DC_ADD_I_LSB 16 -#define BB_CL_TAB_B1_CARR_LK_DC_ADD_I_MASK 0x07ff0000 -#define BB_CL_TAB_B1_CARR_LK_DC_ADD_I_GET(x) (((x) & 0x07ff0000) >> 16) -#define BB_CL_TAB_B1_CARR_LK_DC_ADD_I_SET(x) (((x) << 16) & 0x07ff0000) -#define BB_CL_TAB_B1_BB_GAIN_MSB 30 -#define BB_CL_TAB_B1_BB_GAIN_LSB 27 -#define BB_CL_TAB_B1_BB_GAIN_MASK 0x78000000 -#define BB_CL_TAB_B1_BB_GAIN_GET(x) (((x) & 0x78000000) >> 27) -#define BB_CL_TAB_B1_BB_GAIN_SET(x) (((x) << 27) & 0x78000000) - -/* macros for bb_sm1_reg_map.BB_chan_info_gain_b1 */ -#define BB_CHAN_INFO_GAIN_B1_ADDRESS 0x00000180 -#define BB_CHAN_INFO_GAIN_B1_OFFSET 0x00000180 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_RSSI_1_MSB 7 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_RSSI_1_LSB 0 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_RSSI_1_MASK 0x000000ff -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_RSSI_1_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_RF_GAIN_1_MSB 15 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_RF_GAIN_1_LSB 8 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_RF_GAIN_1_MASK 0x0000ff00 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_RF_GAIN_1_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_MB_GAIN_1_MSB 22 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_MB_GAIN_1_LSB 16 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_MB_GAIN_1_MASK 0x007f0000 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_MB_GAIN_1_GET(x) (((x) & 0x007f0000) >> 16) -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_XATTEN1_SW_1_MSB 23 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_XATTEN1_SW_1_LSB 23 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_XATTEN1_SW_1_MASK 0x00800000 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_XATTEN1_SW_1_GET(x) (((x) & 0x00800000) >> 23) -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_XATTEN2_SW_1_MSB 24 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_XATTEN2_SW_1_LSB 24 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_XATTEN2_SW_1_MASK 0x01000000 -#define BB_CHAN_INFO_GAIN_B1_CHAN_INFO_XATTEN2_SW_1_GET(x) (((x) & 0x01000000) >> 24) - -/* macros for bb_sm1_reg_map.BB_tpc_4_b1 */ -#define BB_TPC_4_B1_ADDRESS 0x00000204 -#define BB_TPC_4_B1_OFFSET 0x00000204 -#define BB_TPC_4_B1_PD_AVG_VALID_1_MSB 0 -#define BB_TPC_4_B1_PD_AVG_VALID_1_LSB 0 -#define BB_TPC_4_B1_PD_AVG_VALID_1_MASK 0x00000001 -#define BB_TPC_4_B1_PD_AVG_VALID_1_GET(x) (((x) & 0x00000001) >> 0) -#define BB_TPC_4_B1_PD_AVG_OUT_1_MSB 8 -#define BB_TPC_4_B1_PD_AVG_OUT_1_LSB 1 -#define BB_TPC_4_B1_PD_AVG_OUT_1_MASK 0x000001fe -#define BB_TPC_4_B1_PD_AVG_OUT_1_GET(x) (((x) & 0x000001fe) >> 1) -#define BB_TPC_4_B1_DAC_GAIN_1_MSB 13 -#define BB_TPC_4_B1_DAC_GAIN_1_LSB 9 -#define BB_TPC_4_B1_DAC_GAIN_1_MASK 0x00003e00 -#define BB_TPC_4_B1_DAC_GAIN_1_GET(x) (((x) & 0x00003e00) >> 9) -#define BB_TPC_4_B1_TX_GAIN_SETTING_1_MSB 19 -#define BB_TPC_4_B1_TX_GAIN_SETTING_1_LSB 14 -#define BB_TPC_4_B1_TX_GAIN_SETTING_1_MASK 0x000fc000 -#define BB_TPC_4_B1_TX_GAIN_SETTING_1_GET(x) (((x) & 0x000fc000) >> 14) -#define BB_TPC_4_B1_RATE_SENT_1_MSB 24 -#define BB_TPC_4_B1_RATE_SENT_1_LSB 20 -#define BB_TPC_4_B1_RATE_SENT_1_MASK 0x01f00000 -#define BB_TPC_4_B1_RATE_SENT_1_GET(x) (((x) & 0x01f00000) >> 20) - -/* macros for bb_sm1_reg_map.BB_tpc_5_b1 */ -#define BB_TPC_5_B1_ADDRESS 0x00000208 -#define BB_TPC_5_B1_OFFSET 0x00000208 -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_1_1_MSB 9 -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_1_1_LSB 4 -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_1_1_MASK 0x000003f0 -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_1_1_GET(x) (((x) & 0x000003f0) >> 4) -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_1_1_SET(x) (((x) << 4) & 0x000003f0) -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_2_1_MSB 15 -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_2_1_LSB 10 -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_2_1_MASK 0x0000fc00 -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_2_1_GET(x) (((x) & 0x0000fc00) >> 10) -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_2_1_SET(x) (((x) << 10) & 0x0000fc00) -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_3_1_MSB 21 -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_3_1_LSB 16 -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_3_1_MASK 0x003f0000 -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_3_1_GET(x) (((x) & 0x003f0000) >> 16) -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_3_1_SET(x) (((x) << 16) & 0x003f0000) -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_4_1_MSB 27 -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_4_1_LSB 22 -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_4_1_MASK 0x0fc00000 -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_4_1_GET(x) (((x) & 0x0fc00000) >> 22) -#define BB_TPC_5_B1_PD_GAIN_BOUNDARY_4_1_SET(x) (((x) << 22) & 0x0fc00000) - -/* macros for bb_sm1_reg_map.BB_tpc_6_b1 */ -#define BB_TPC_6_B1_ADDRESS 0x0000020c -#define BB_TPC_6_B1_OFFSET 0x0000020c -#define BB_TPC_6_B1_PD_DAC_SETTING_1_1_MSB 5 -#define BB_TPC_6_B1_PD_DAC_SETTING_1_1_LSB 0 -#define BB_TPC_6_B1_PD_DAC_SETTING_1_1_MASK 0x0000003f -#define BB_TPC_6_B1_PD_DAC_SETTING_1_1_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_TPC_6_B1_PD_DAC_SETTING_1_1_SET(x) (((x) << 0) & 0x0000003f) -#define BB_TPC_6_B1_PD_DAC_SETTING_2_1_MSB 11 -#define BB_TPC_6_B1_PD_DAC_SETTING_2_1_LSB 6 -#define BB_TPC_6_B1_PD_DAC_SETTING_2_1_MASK 0x00000fc0 -#define BB_TPC_6_B1_PD_DAC_SETTING_2_1_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_TPC_6_B1_PD_DAC_SETTING_2_1_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_TPC_6_B1_PD_DAC_SETTING_3_1_MSB 17 -#define BB_TPC_6_B1_PD_DAC_SETTING_3_1_LSB 12 -#define BB_TPC_6_B1_PD_DAC_SETTING_3_1_MASK 0x0003f000 -#define BB_TPC_6_B1_PD_DAC_SETTING_3_1_GET(x) (((x) & 0x0003f000) >> 12) -#define BB_TPC_6_B1_PD_DAC_SETTING_3_1_SET(x) (((x) << 12) & 0x0003f000) -#define BB_TPC_6_B1_PD_DAC_SETTING_4_1_MSB 23 -#define BB_TPC_6_B1_PD_DAC_SETTING_4_1_LSB 18 -#define BB_TPC_6_B1_PD_DAC_SETTING_4_1_MASK 0x00fc0000 -#define BB_TPC_6_B1_PD_DAC_SETTING_4_1_GET(x) (((x) & 0x00fc0000) >> 18) -#define BB_TPC_6_B1_PD_DAC_SETTING_4_1_SET(x) (((x) << 18) & 0x00fc0000) -#define BB_TPC_6_B1_ERROR_EST_MODE_MSB 25 -#define BB_TPC_6_B1_ERROR_EST_MODE_LSB 24 -#define BB_TPC_6_B1_ERROR_EST_MODE_MASK 0x03000000 -#define BB_TPC_6_B1_ERROR_EST_MODE_GET(x) (((x) & 0x03000000) >> 24) -#define BB_TPC_6_B1_ERROR_EST_MODE_SET(x) (((x) << 24) & 0x03000000) -#define BB_TPC_6_B1_ERROR_EST_FILTER_COEFF_MSB 28 -#define BB_TPC_6_B1_ERROR_EST_FILTER_COEFF_LSB 26 -#define BB_TPC_6_B1_ERROR_EST_FILTER_COEFF_MASK 0x1c000000 -#define BB_TPC_6_B1_ERROR_EST_FILTER_COEFF_GET(x) (((x) & 0x1c000000) >> 26) -#define BB_TPC_6_B1_ERROR_EST_FILTER_COEFF_SET(x) (((x) << 26) & 0x1c000000) - -/* macros for bb_sm1_reg_map.BB_tpc_11_b1 */ -#define BB_TPC_11_B1_ADDRESS 0x00000220 -#define BB_TPC_11_B1_OFFSET 0x00000220 -#define BB_TPC_11_B1_OLPC_GAIN_DELTA_1_MSB 23 -#define BB_TPC_11_B1_OLPC_GAIN_DELTA_1_LSB 16 -#define BB_TPC_11_B1_OLPC_GAIN_DELTA_1_MASK 0x00ff0000 -#define BB_TPC_11_B1_OLPC_GAIN_DELTA_1_GET(x) (((x) & 0x00ff0000) >> 16) -#define BB_TPC_11_B1_OLPC_GAIN_DELTA_1_SET(x) (((x) << 16) & 0x00ff0000) -#define BB_TPC_11_B1_OLPC_GAIN_DELTA_1_LSB_EXT_MSB 25 -#define BB_TPC_11_B1_OLPC_GAIN_DELTA_1_LSB_EXT_LSB 24 -#define BB_TPC_11_B1_OLPC_GAIN_DELTA_1_LSB_EXT_MASK 0x03000000 -#define BB_TPC_11_B1_OLPC_GAIN_DELTA_1_LSB_EXT_GET(x) (((x) & 0x03000000) >> 24) -#define BB_TPC_11_B1_OLPC_GAIN_DELTA_1_LSB_EXT_SET(x) (((x) << 24) & 0x03000000) - -/* macros for bb_sm1_reg_map.BB_tpc_19_b1 */ -#define BB_TPC_19_B1_ADDRESS 0x00000240 -#define BB_TPC_19_B1_OFFSET 0x00000240 -#define BB_TPC_19_B1_ALPHA_THERM_1_MSB 7 -#define BB_TPC_19_B1_ALPHA_THERM_1_LSB 0 -#define BB_TPC_19_B1_ALPHA_THERM_1_MASK 0x000000ff -#define BB_TPC_19_B1_ALPHA_THERM_1_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_TPC_19_B1_ALPHA_THERM_1_SET(x) (((x) << 0) & 0x000000ff) -#define BB_TPC_19_B1_ALPHA_THERM_PAL_ON_1_MSB 15 -#define BB_TPC_19_B1_ALPHA_THERM_PAL_ON_1_LSB 8 -#define BB_TPC_19_B1_ALPHA_THERM_PAL_ON_1_MASK 0x0000ff00 -#define BB_TPC_19_B1_ALPHA_THERM_PAL_ON_1_GET(x) (((x) & 0x0000ff00) >> 8) -#define BB_TPC_19_B1_ALPHA_THERM_PAL_ON_1_SET(x) (((x) << 8) & 0x0000ff00) -#define BB_TPC_19_B1_ALPHA_VOLT_1_MSB 22 -#define BB_TPC_19_B1_ALPHA_VOLT_1_LSB 16 -#define BB_TPC_19_B1_ALPHA_VOLT_1_MASK 0x007f0000 -#define BB_TPC_19_B1_ALPHA_VOLT_1_GET(x) (((x) & 0x007f0000) >> 16) -#define BB_TPC_19_B1_ALPHA_VOLT_1_SET(x) (((x) << 16) & 0x007f0000) -#define BB_TPC_19_B1_ALPHA_VOLT_PAL_ON_1_MSB 29 -#define BB_TPC_19_B1_ALPHA_VOLT_PAL_ON_1_LSB 23 -#define BB_TPC_19_B1_ALPHA_VOLT_PAL_ON_1_MASK 0x3f800000 -#define BB_TPC_19_B1_ALPHA_VOLT_PAL_ON_1_GET(x) (((x) & 0x3f800000) >> 23) -#define BB_TPC_19_B1_ALPHA_VOLT_PAL_ON_1_SET(x) (((x) << 23) & 0x3f800000) - -/* macros for bb_sm1_reg_map.BB_pdadc_tab_b1 */ -#define BB_PDADC_TAB_B1_ADDRESS 0x00000280 -#define BB_PDADC_TAB_B1_OFFSET 0x00000280 -#define BB_PDADC_TAB_B1_TAB_ENTRY_MSB 31 -#define BB_PDADC_TAB_B1_TAB_ENTRY_LSB 0 -#define BB_PDADC_TAB_B1_TAB_ENTRY_MASK 0xffffffff -#define BB_PDADC_TAB_B1_TAB_ENTRY_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for bb_sm1_reg_map.BB_rtt_table_sw_intf_b1 */ -#define BB_RTT_TABLE_SW_INTF_B1_ADDRESS 0x00000384 -#define BB_RTT_TABLE_SW_INTF_B1_OFFSET 0x00000384 -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_ACCESS_1_MSB 0 -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_ACCESS_1_LSB 0 -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_ACCESS_1_MASK 0x00000001 -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_ACCESS_1_GET(x) (((x) & 0x00000001) >> 0) -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_ACCESS_1_SET(x) (((x) << 0) & 0x00000001) -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_WRITE_1_MSB 1 -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_WRITE_1_LSB 1 -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_WRITE_1_MASK 0x00000002 -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_WRITE_1_GET(x) (((x) & 0x00000002) >> 1) -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_WRITE_1_SET(x) (((x) << 1) & 0x00000002) -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_ADDR_1_MSB 4 -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_ADDR_1_LSB 2 -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_ADDR_1_MASK 0x0000001c -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_ADDR_1_GET(x) (((x) & 0x0000001c) >> 2) -#define BB_RTT_TABLE_SW_INTF_B1_SW_RTT_TABLE_ADDR_1_SET(x) (((x) << 2) & 0x0000001c) - -/* macros for bb_sm1_reg_map.BB_rtt_table_sw_intf_1_b1 */ -#define BB_RTT_TABLE_SW_INTF_1_B1_ADDRESS 0x00000388 -#define BB_RTT_TABLE_SW_INTF_1_B1_OFFSET 0x00000388 -#define BB_RTT_TABLE_SW_INTF_1_B1_SW_RTT_TABLE_DATA_1_MSB 31 -#define BB_RTT_TABLE_SW_INTF_1_B1_SW_RTT_TABLE_DATA_1_LSB 4 -#define BB_RTT_TABLE_SW_INTF_1_B1_SW_RTT_TABLE_DATA_1_MASK 0xfffffff0 -#define BB_RTT_TABLE_SW_INTF_1_B1_SW_RTT_TABLE_DATA_1_GET(x) (((x) & 0xfffffff0) >> 4) -#define BB_RTT_TABLE_SW_INTF_1_B1_SW_RTT_TABLE_DATA_1_SET(x) (((x) << 4) & 0xfffffff0) - -/* macros for bb_sm1_reg_map.BB_txiq_corr_coeff_01_b1 */ -#define BB_TXIQ_CORR_COEFF_01_B1_ADDRESS 0x00000450 -#define BB_TXIQ_CORR_COEFF_01_B1_OFFSET 0x00000450 -#define BB_TXIQ_CORR_COEFF_01_B1_IQC_COEFF_TABLE_0_1_MSB 13 -#define BB_TXIQ_CORR_COEFF_01_B1_IQC_COEFF_TABLE_0_1_LSB 0 -#define BB_TXIQ_CORR_COEFF_01_B1_IQC_COEFF_TABLE_0_1_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_01_B1_IQC_COEFF_TABLE_0_1_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_01_B1_IQC_COEFF_TABLE_0_1_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_01_B1_IQC_COEFF_TABLE_1_1_MSB 27 -#define BB_TXIQ_CORR_COEFF_01_B1_IQC_COEFF_TABLE_1_1_LSB 14 -#define BB_TXIQ_CORR_COEFF_01_B1_IQC_COEFF_TABLE_1_1_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_01_B1_IQC_COEFF_TABLE_1_1_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_01_B1_IQC_COEFF_TABLE_1_1_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm1_reg_map.BB_txiq_corr_coeff_23_b1 */ -#define BB_TXIQ_CORR_COEFF_23_B1_ADDRESS 0x00000454 -#define BB_TXIQ_CORR_COEFF_23_B1_OFFSET 0x00000454 -#define BB_TXIQ_CORR_COEFF_23_B1_IQC_COEFF_TABLE_2_1_MSB 13 -#define BB_TXIQ_CORR_COEFF_23_B1_IQC_COEFF_TABLE_2_1_LSB 0 -#define BB_TXIQ_CORR_COEFF_23_B1_IQC_COEFF_TABLE_2_1_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_23_B1_IQC_COEFF_TABLE_2_1_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_23_B1_IQC_COEFF_TABLE_2_1_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_23_B1_IQC_COEFF_TABLE_3_1_MSB 27 -#define BB_TXIQ_CORR_COEFF_23_B1_IQC_COEFF_TABLE_3_1_LSB 14 -#define BB_TXIQ_CORR_COEFF_23_B1_IQC_COEFF_TABLE_3_1_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_23_B1_IQC_COEFF_TABLE_3_1_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_23_B1_IQC_COEFF_TABLE_3_1_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm1_reg_map.BB_txiq_corr_coeff_45_b1 */ -#define BB_TXIQ_CORR_COEFF_45_B1_ADDRESS 0x00000458 -#define BB_TXIQ_CORR_COEFF_45_B1_OFFSET 0x00000458 -#define BB_TXIQ_CORR_COEFF_45_B1_IQC_COEFF_TABLE_4_1_MSB 13 -#define BB_TXIQ_CORR_COEFF_45_B1_IQC_COEFF_TABLE_4_1_LSB 0 -#define BB_TXIQ_CORR_COEFF_45_B1_IQC_COEFF_TABLE_4_1_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_45_B1_IQC_COEFF_TABLE_4_1_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_45_B1_IQC_COEFF_TABLE_4_1_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_45_B1_IQC_COEFF_TABLE_5_1_MSB 27 -#define BB_TXIQ_CORR_COEFF_45_B1_IQC_COEFF_TABLE_5_1_LSB 14 -#define BB_TXIQ_CORR_COEFF_45_B1_IQC_COEFF_TABLE_5_1_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_45_B1_IQC_COEFF_TABLE_5_1_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_45_B1_IQC_COEFF_TABLE_5_1_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm1_reg_map.BB_txiq_corr_coeff_67_b1 */ -#define BB_TXIQ_CORR_COEFF_67_B1_ADDRESS 0x0000045c -#define BB_TXIQ_CORR_COEFF_67_B1_OFFSET 0x0000045c -#define BB_TXIQ_CORR_COEFF_67_B1_IQC_COEFF_TABLE_6_1_MSB 13 -#define BB_TXIQ_CORR_COEFF_67_B1_IQC_COEFF_TABLE_6_1_LSB 0 -#define BB_TXIQ_CORR_COEFF_67_B1_IQC_COEFF_TABLE_6_1_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_67_B1_IQC_COEFF_TABLE_6_1_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_67_B1_IQC_COEFF_TABLE_6_1_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_67_B1_IQC_COEFF_TABLE_7_1_MSB 27 -#define BB_TXIQ_CORR_COEFF_67_B1_IQC_COEFF_TABLE_7_1_LSB 14 -#define BB_TXIQ_CORR_COEFF_67_B1_IQC_COEFF_TABLE_7_1_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_67_B1_IQC_COEFF_TABLE_7_1_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_67_B1_IQC_COEFF_TABLE_7_1_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm1_reg_map.BB_txiq_corr_coeff_89_b1 */ -#define BB_TXIQ_CORR_COEFF_89_B1_ADDRESS 0x00000460 -#define BB_TXIQ_CORR_COEFF_89_B1_OFFSET 0x00000460 -#define BB_TXIQ_CORR_COEFF_89_B1_IQC_COEFF_TABLE_8_1_MSB 13 -#define BB_TXIQ_CORR_COEFF_89_B1_IQC_COEFF_TABLE_8_1_LSB 0 -#define BB_TXIQ_CORR_COEFF_89_B1_IQC_COEFF_TABLE_8_1_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_89_B1_IQC_COEFF_TABLE_8_1_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_89_B1_IQC_COEFF_TABLE_8_1_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_89_B1_IQC_COEFF_TABLE_9_1_MSB 27 -#define BB_TXIQ_CORR_COEFF_89_B1_IQC_COEFF_TABLE_9_1_LSB 14 -#define BB_TXIQ_CORR_COEFF_89_B1_IQC_COEFF_TABLE_9_1_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_89_B1_IQC_COEFF_TABLE_9_1_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_89_B1_IQC_COEFF_TABLE_9_1_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm1_reg_map.BB_txiq_corr_coeff_ab_b1 */ -#define BB_TXIQ_CORR_COEFF_AB_B1_ADDRESS 0x00000464 -#define BB_TXIQ_CORR_COEFF_AB_B1_OFFSET 0x00000464 -#define BB_TXIQ_CORR_COEFF_AB_B1_IQC_COEFF_TABLE_A_1_MSB 13 -#define BB_TXIQ_CORR_COEFF_AB_B1_IQC_COEFF_TABLE_A_1_LSB 0 -#define BB_TXIQ_CORR_COEFF_AB_B1_IQC_COEFF_TABLE_A_1_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_AB_B1_IQC_COEFF_TABLE_A_1_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_AB_B1_IQC_COEFF_TABLE_A_1_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_AB_B1_IQC_COEFF_TABLE_B_1_MSB 27 -#define BB_TXIQ_CORR_COEFF_AB_B1_IQC_COEFF_TABLE_B_1_LSB 14 -#define BB_TXIQ_CORR_COEFF_AB_B1_IQC_COEFF_TABLE_B_1_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_AB_B1_IQC_COEFF_TABLE_B_1_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_AB_B1_IQC_COEFF_TABLE_B_1_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm1_reg_map.BB_txiq_corr_coeff_cd_b1 */ -#define BB_TXIQ_CORR_COEFF_CD_B1_ADDRESS 0x00000468 -#define BB_TXIQ_CORR_COEFF_CD_B1_OFFSET 0x00000468 -#define BB_TXIQ_CORR_COEFF_CD_B1_IQC_COEFF_TABLE_C_1_MSB 13 -#define BB_TXIQ_CORR_COEFF_CD_B1_IQC_COEFF_TABLE_C_1_LSB 0 -#define BB_TXIQ_CORR_COEFF_CD_B1_IQC_COEFF_TABLE_C_1_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_CD_B1_IQC_COEFF_TABLE_C_1_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_CD_B1_IQC_COEFF_TABLE_C_1_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_CD_B1_IQC_COEFF_TABLE_D_1_MSB 27 -#define BB_TXIQ_CORR_COEFF_CD_B1_IQC_COEFF_TABLE_D_1_LSB 14 -#define BB_TXIQ_CORR_COEFF_CD_B1_IQC_COEFF_TABLE_D_1_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_CD_B1_IQC_COEFF_TABLE_D_1_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_CD_B1_IQC_COEFF_TABLE_D_1_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm1_reg_map.BB_txiq_corr_coeff_ef_b1 */ -#define BB_TXIQ_CORR_COEFF_EF_B1_ADDRESS 0x0000046c -#define BB_TXIQ_CORR_COEFF_EF_B1_OFFSET 0x0000046c -#define BB_TXIQ_CORR_COEFF_EF_B1_IQC_COEFF_TABLE_E_1_MSB 13 -#define BB_TXIQ_CORR_COEFF_EF_B1_IQC_COEFF_TABLE_E_1_LSB 0 -#define BB_TXIQ_CORR_COEFF_EF_B1_IQC_COEFF_TABLE_E_1_MASK 0x00003fff -#define BB_TXIQ_CORR_COEFF_EF_B1_IQC_COEFF_TABLE_E_1_GET(x) (((x) & 0x00003fff) >> 0) -#define BB_TXIQ_CORR_COEFF_EF_B1_IQC_COEFF_TABLE_E_1_SET(x) (((x) << 0) & 0x00003fff) -#define BB_TXIQ_CORR_COEFF_EF_B1_IQC_COEFF_TABLE_F_1_MSB 27 -#define BB_TXIQ_CORR_COEFF_EF_B1_IQC_COEFF_TABLE_F_1_LSB 14 -#define BB_TXIQ_CORR_COEFF_EF_B1_IQC_COEFF_TABLE_F_1_MASK 0x0fffc000 -#define BB_TXIQ_CORR_COEFF_EF_B1_IQC_COEFF_TABLE_F_1_GET(x) (((x) & 0x0fffc000) >> 14) -#define BB_TXIQ_CORR_COEFF_EF_B1_IQC_COEFF_TABLE_F_1_SET(x) (((x) << 14) & 0x0fffc000) - -/* macros for bb_sm1_reg_map.BB_txiqcal_status_b1 */ -#define BB_TXIQCAL_STATUS_B1_ADDRESS 0x0000048c -#define BB_TXIQCAL_STATUS_B1_OFFSET 0x0000048c -#define BB_TXIQCAL_STATUS_B1_TXIQCAL_FAILED_1_MSB 0 -#define BB_TXIQCAL_STATUS_B1_TXIQCAL_FAILED_1_LSB 0 -#define BB_TXIQCAL_STATUS_B1_TXIQCAL_FAILED_1_MASK 0x00000001 -#define BB_TXIQCAL_STATUS_B1_TXIQCAL_FAILED_1_GET(x) (((x) & 0x00000001) >> 0) -#define BB_TXIQCAL_STATUS_B1_CALIBRATED_GAINS_1_MSB 5 -#define BB_TXIQCAL_STATUS_B1_CALIBRATED_GAINS_1_LSB 1 -#define BB_TXIQCAL_STATUS_B1_CALIBRATED_GAINS_1_MASK 0x0000003e -#define BB_TXIQCAL_STATUS_B1_CALIBRATED_GAINS_1_GET(x) (((x) & 0x0000003e) >> 1) -#define BB_TXIQCAL_STATUS_B1_TONE_GAIN_USED_1_MSB 11 -#define BB_TXIQCAL_STATUS_B1_TONE_GAIN_USED_1_LSB 6 -#define BB_TXIQCAL_STATUS_B1_TONE_GAIN_USED_1_MASK 0x00000fc0 -#define BB_TXIQCAL_STATUS_B1_TONE_GAIN_USED_1_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_TXIQCAL_STATUS_B1_RX_GAIN_USED_1_MSB 17 -#define BB_TXIQCAL_STATUS_B1_RX_GAIN_USED_1_LSB 12 -#define BB_TXIQCAL_STATUS_B1_RX_GAIN_USED_1_MASK 0x0003f000 -#define BB_TXIQCAL_STATUS_B1_RX_GAIN_USED_1_GET(x) (((x) & 0x0003f000) >> 12) -#define BB_TXIQCAL_STATUS_B1_LAST_MEAS_ADDR_1_MSB 23 -#define BB_TXIQCAL_STATUS_B1_LAST_MEAS_ADDR_1_LSB 18 -#define BB_TXIQCAL_STATUS_B1_LAST_MEAS_ADDR_1_MASK 0x00fc0000 -#define BB_TXIQCAL_STATUS_B1_LAST_MEAS_ADDR_1_GET(x) (((x) & 0x00fc0000) >> 18) - -/* macros for bb_sm1_reg_map.BB_tables_intf_addr_b1 */ -#define BB_TABLES_INTF_ADDR_B1_ADDRESS 0x000005f0 -#define BB_TABLES_INTF_ADDR_B1_OFFSET 0x000005f0 -#define BB_TABLES_INTF_ADDR_B1_TABLES_ADDR_1_MSB 17 -#define BB_TABLES_INTF_ADDR_B1_TABLES_ADDR_1_LSB 2 -#define BB_TABLES_INTF_ADDR_B1_TABLES_ADDR_1_MASK 0x0003fffc -#define BB_TABLES_INTF_ADDR_B1_TABLES_ADDR_1_GET(x) (((x) & 0x0003fffc) >> 2) -#define BB_TABLES_INTF_ADDR_B1_TABLES_ADDR_1_SET(x) (((x) << 2) & 0x0003fffc) -#define BB_TABLES_INTF_ADDR_B1_ADDR_AUTO_INCR_1_MSB 31 -#define BB_TABLES_INTF_ADDR_B1_ADDR_AUTO_INCR_1_LSB 31 -#define BB_TABLES_INTF_ADDR_B1_ADDR_AUTO_INCR_1_MASK 0x80000000 -#define BB_TABLES_INTF_ADDR_B1_ADDR_AUTO_INCR_1_GET(x) (((x) & 0x80000000) >> 31) -#define BB_TABLES_INTF_ADDR_B1_ADDR_AUTO_INCR_1_SET(x) (((x) << 31) & 0x80000000) - -/* macros for bb_sm1_reg_map.BB_tables_intf_data_b1 */ -#define BB_TABLES_INTF_DATA_B1_ADDRESS 0x000005f4 -#define BB_TABLES_INTF_DATA_B1_OFFSET 0x000005f4 -#define BB_TABLES_INTF_DATA_B1_TABLES_DATA_1_MSB 31 -#define BB_TABLES_INTF_DATA_B1_TABLES_DATA_1_LSB 0 -#define BB_TABLES_INTF_DATA_B1_TABLES_DATA_1_MASK 0xffffffff -#define BB_TABLES_INTF_DATA_B1_TABLES_DATA_1_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_TABLES_INTF_DATA_B1_TABLES_DATA_1_SET(x) (((x) << 0) & 0xffffffff) - -#ifndef __ASSEMBLER__ - -typedef struct bb_reg_reg_s_8 { - volatile char pad__0[0x84]; /* 0x0 - 0x84 */ - volatile unsigned int BB_switch_table_chn_b1; /* 0x84 - 0x88 */ - volatile char pad__1[0x48]; /* 0x88 - 0xd0 */ - volatile unsigned int BB_fcal_2_b1; /* 0xd0 - 0xd4 */ - volatile unsigned int BB_dft_tone_ctrl_b1; /* 0xd4 - 0xd8 */ - volatile char pad__2[0x4]; /* 0xd8 - 0xdc */ - volatile unsigned int BB_cl_map_0_b1; /* 0xdc - 0xe0 */ - volatile unsigned int BB_cl_map_1_b1; /* 0xe0 - 0xe4 */ - volatile unsigned int BB_cl_map_2_b1; /* 0xe4 - 0xe8 */ - volatile unsigned int BB_cl_map_3_b1; /* 0xe8 - 0xec */ - volatile unsigned int BB_cl_map_pal_0_b1; /* 0xec - 0xf0 */ - volatile unsigned int BB_cl_map_pal_1_b1; /* 0xf0 - 0xf4 */ - volatile unsigned int BB_cl_map_pal_2_b1; /* 0xf4 - 0xf8 */ - volatile unsigned int BB_cl_map_pal_3_b1; /* 0xf8 - 0xfc */ - volatile char pad__3[0x4]; /* 0xfc - 0x100 */ - volatile unsigned int BB_cl_tab_b1[16]; /* 0x100 - 0x140 */ - volatile char pad__4[0x40]; /* 0x140 - 0x180 */ - volatile unsigned int BB_chan_info_gain_b1; /* 0x180 - 0x184 */ - volatile char pad__5[0x80]; /* 0x184 - 0x204 */ - volatile unsigned int BB_tpc_4_b1; /* 0x204 - 0x208 */ - volatile unsigned int BB_tpc_5_b1; /* 0x208 - 0x20c */ - volatile unsigned int BB_tpc_6_b1; /* 0x20c - 0x210 */ - volatile char pad__6[0x10]; /* 0x210 - 0x220 */ - volatile unsigned int BB_tpc_11_b1; /* 0x220 - 0x224 */ - volatile char pad__7[0x1c]; /* 0x224 - 0x240 */ - volatile unsigned int BB_tpc_19_b1; /* 0x240 - 0x244 */ - volatile char pad__8[0x3c]; /* 0x244 - 0x280 */ - volatile unsigned int BB_pdadc_tab_b1[32]; /* 0x280 - 0x300 */ - volatile char pad__9[0x84]; /* 0x300 - 0x384 */ - volatile unsigned int BB_rtt_table_sw_intf_b1; /* 0x384 - 0x388 */ - volatile unsigned int BB_rtt_table_sw_intf_1_b1; /* 0x388 - 0x38c */ - volatile char pad__10[0xc4]; /* 0x38c - 0x450 */ - volatile unsigned int BB_txiq_corr_coeff_01_b1; /* 0x450 - 0x454 */ - volatile unsigned int BB_txiq_corr_coeff_23_b1; /* 0x454 - 0x458 */ - volatile unsigned int BB_txiq_corr_coeff_45_b1; /* 0x458 - 0x45c */ - volatile unsigned int BB_txiq_corr_coeff_67_b1; /* 0x45c - 0x460 */ - volatile unsigned int BB_txiq_corr_coeff_89_b1; /* 0x460 - 0x464 */ - volatile unsigned int BB_txiq_corr_coeff_ab_b1; /* 0x464 - 0x468 */ - volatile unsigned int BB_txiq_corr_coeff_cd_b1; /* 0x468 - 0x46c */ - volatile unsigned int BB_txiq_corr_coeff_ef_b1; /* 0x46c - 0x470 */ - volatile char pad__11[0x1c]; /* 0x470 - 0x48c */ - volatile unsigned int BB_txiqcal_status_b1; /* 0x48c - 0x490 */ - volatile char pad__12[0x160]; /* 0x490 - 0x5f0 */ - volatile unsigned int BB_tables_intf_addr_b1; /* 0x5f0 - 0x5f4 */ - volatile unsigned int BB_tables_intf_data_b1; /* 0x5f4 - 0x5f8 */ -} bb_reg_reg_t_8; - -#endif /* __ASSEMBLER__ */ - - -/* macros for bb_chn3_reg_map.BB_dummy1 */ -#define BB_DUMMY1_ADDRESS 0x00000000 -#define BB_DUMMY1_OFFSET 0x00000000 -#define BB_DUMMY1_DUMMY_MSB 0 -#define BB_DUMMY1_DUMMY_LSB 0 -#define BB_DUMMY1_DUMMY_MASK 0x00000001 -#define BB_DUMMY1_DUMMY_GET(x) (((x) & 0x00000001) >> 0) - -#ifndef __ASSEMBLER__ - -typedef struct bb_reg_reg_s_9 { - volatile unsigned int BB_dummy1[256]; /* 0x0 - 0x400 */ -} bb_reg_reg_t_9; - -#endif /* __ASSEMBLER__ */ - - -/* macros for bb_agc3_reg_map.BB_dummy */ -#define BB_DUMMY_ADDRESS 0x00000000 -#define BB_DUMMY_OFFSET 0x00000000 -#define BB_DUMMY_DUMMY_MSB 0 -#define BB_DUMMY_DUMMY_LSB 0 -#define BB_DUMMY_DUMMY_MASK 0x00000001 -#define BB_DUMMY_DUMMY_GET(x) (((x) & 0x00000001) >> 0) - -/* macros for bb_agc3_reg_map.BB_rssi_b3 */ -#define BB_RSSI_B3_ADDRESS 0x00000180 -#define BB_RSSI_B3_OFFSET 0x00000180 -#define BB_RSSI_B3_RSSI_3_MSB 7 -#define BB_RSSI_B3_RSSI_3_LSB 0 -#define BB_RSSI_B3_RSSI_3_MASK 0x000000ff -#define BB_RSSI_B3_RSSI_3_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_RSSI_B3_RSSI_EXT_3_MSB 15 -#define BB_RSSI_B3_RSSI_EXT_3_LSB 8 -#define BB_RSSI_B3_RSSI_EXT_3_MASK 0x0000ff00 -#define BB_RSSI_B3_RSSI_EXT_3_GET(x) (((x) & 0x0000ff00) >> 8) - -#ifndef __ASSEMBLER__ - -typedef struct bb_reg_reg_s_10 { - volatile unsigned int BB_dummy; /* 0x0 - 0x4 */ - volatile char pad__0[0x17c]; /* 0x4 - 0x180 */ - volatile unsigned int BB_rssi_b3; /* 0x180 - 0x184 */ -} bb_reg_reg_t_10; - -#endif /* __ASSEMBLER__ */ - - -/* macros for bb_sm3_reg_map.BB_dummy2 */ -#define BB_DUMMY2_ADDRESS 0x00000000 -#define BB_DUMMY2_OFFSET 0x00000000 -#define BB_DUMMY2_DUMMY_MSB 0 -#define BB_DUMMY2_DUMMY_LSB 0 -#define BB_DUMMY2_DUMMY_MASK 0x00000001 -#define BB_DUMMY2_DUMMY_GET(x) (((x) & 0x00000001) >> 0) - -#ifndef __ASSEMBLER__ - -typedef struct bb_reg_reg_s_11 { - volatile unsigned int BB_dummy2[384]; /* 0x0 - 0x600 */ -} bb_reg_reg_t_11; - -#endif /* __ASSEMBLER__ */ - - -/* macros for bb_mit_reg_map.BB_mit_rf_cntl */ -#define BB_MIT_RF_CNTL_ADDRESS 0x00000000 -#define BB_MIT_RF_CNTL_OFFSET 0x00000000 -#define BB_MIT_RF_CNTL_MIT_FORCE_SYNTH_ON_MSB 0 -#define BB_MIT_RF_CNTL_MIT_FORCE_SYNTH_ON_LSB 0 -#define BB_MIT_RF_CNTL_MIT_FORCE_SYNTH_ON_MASK 0x00000001 -#define BB_MIT_RF_CNTL_MIT_FORCE_SYNTH_ON_GET(x) (((x) & 0x00000001) >> 0) -#define BB_MIT_RF_CNTL_MIT_FORCE_SYNTH_ON_SET(x) (((x) << 0) & 0x00000001) -#define BB_MIT_RF_CNTL_MIT_FORCE_SYNTH_ON_EN_MSB 1 -#define BB_MIT_RF_CNTL_MIT_FORCE_SYNTH_ON_EN_LSB 1 -#define BB_MIT_RF_CNTL_MIT_FORCE_SYNTH_ON_EN_MASK 0x00000002 -#define BB_MIT_RF_CNTL_MIT_FORCE_SYNTH_ON_EN_GET(x) (((x) & 0x00000002) >> 1) -#define BB_MIT_RF_CNTL_MIT_FORCE_SYNTH_ON_EN_SET(x) (((x) << 1) & 0x00000002) -#define BB_MIT_RF_CNTL_MIT_FORCE_ACTIVE_ON_MSB 2 -#define BB_MIT_RF_CNTL_MIT_FORCE_ACTIVE_ON_LSB 2 -#define BB_MIT_RF_CNTL_MIT_FORCE_ACTIVE_ON_MASK 0x00000004 -#define BB_MIT_RF_CNTL_MIT_FORCE_ACTIVE_ON_GET(x) (((x) & 0x00000004) >> 2) -#define BB_MIT_RF_CNTL_MIT_FORCE_ACTIVE_ON_SET(x) (((x) << 2) & 0x00000004) - -/* macros for bb_mit_reg_map.BB_mit_cca_cntl */ -#define BB_MIT_CCA_CNTL_ADDRESS 0x00000004 -#define BB_MIT_CCA_CNTL_OFFSET 0x00000004 -#define BB_MIT_CCA_CNTL_MIT_CCA_MODE_SEL_MSB 2 -#define BB_MIT_CCA_CNTL_MIT_CCA_MODE_SEL_LSB 0 -#define BB_MIT_CCA_CNTL_MIT_CCA_MODE_SEL_MASK 0x00000007 -#define BB_MIT_CCA_CNTL_MIT_CCA_MODE_SEL_GET(x) (((x) & 0x00000007) >> 0) -#define BB_MIT_CCA_CNTL_MIT_CCA_MODE_SEL_SET(x) (((x) << 0) & 0x00000007) -#define BB_MIT_CCA_CNTL_MIT_CCA_COUNT_MSB 20 -#define BB_MIT_CCA_CNTL_MIT_CCA_COUNT_LSB 3 -#define BB_MIT_CCA_CNTL_MIT_CCA_COUNT_MASK 0x001ffff8 -#define BB_MIT_CCA_CNTL_MIT_CCA_COUNT_GET(x) (((x) & 0x001ffff8) >> 3) -#define BB_MIT_CCA_CNTL_MIT_CCA_COUNT_SET(x) (((x) << 3) & 0x001ffff8) - -/* macros for bb_mit_reg_map.BB_mit_rssi_cntl_1 */ -#define BB_MIT_RSSI_CNTL_1_ADDRESS 0x00000008 -#define BB_MIT_RSSI_CNTL_1_OFFSET 0x00000008 -#define BB_MIT_RSSI_CNTL_1_MIT_RSSI_TH_MSB 5 -#define BB_MIT_RSSI_CNTL_1_MIT_RSSI_TH_LSB 0 -#define BB_MIT_RSSI_CNTL_1_MIT_RSSI_TH_MASK 0x0000003f -#define BB_MIT_RSSI_CNTL_1_MIT_RSSI_TH_GET(x) (((x) & 0x0000003f) >> 0) -#define BB_MIT_RSSI_CNTL_1_MIT_RSSI_TH_SET(x) (((x) << 0) & 0x0000003f) -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_TH_H_MSB 11 -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_TH_H_LSB 6 -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_TH_H_MASK 0x00000fc0 -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_TH_H_GET(x) (((x) & 0x00000fc0) >> 6) -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_TH_H_SET(x) (((x) << 6) & 0x00000fc0) -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_TH_L_MSB 17 -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_TH_L_LSB 12 -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_TH_L_MASK 0x0003f000 -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_TH_L_GET(x) (((x) & 0x0003f000) >> 12) -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_TH_L_SET(x) (((x) << 12) & 0x0003f000) -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_OFFSET_MSB 23 -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_OFFSET_LSB 18 -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_OFFSET_MASK 0x00fc0000 -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_OFFSET_GET(x) (((x) & 0x00fc0000) >> 18) -#define BB_MIT_RSSI_CNTL_1_MIT_RX_RF_ATT_OFFSET_SET(x) (((x) << 18) & 0x00fc0000) -#define BB_MIT_RSSI_CNTL_1_MIT_AGC_LIMIT_MSB 29 -#define BB_MIT_RSSI_CNTL_1_MIT_AGC_LIMIT_LSB 24 -#define BB_MIT_RSSI_CNTL_1_MIT_AGC_LIMIT_MASK 0x3f000000 -#define BB_MIT_RSSI_CNTL_1_MIT_AGC_LIMIT_GET(x) (((x) & 0x3f000000) >> 24) -#define BB_MIT_RSSI_CNTL_1_MIT_AGC_LIMIT_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for bb_mit_reg_map.BB_mit_rssi_cntl_2 */ -#define BB_MIT_RSSI_CNTL_2_ADDRESS 0x0000000c -#define BB_MIT_RSSI_CNTL_2_OFFSET 0x0000000c -#define BB_MIT_RSSI_CNTL_2_MIT_AGC_SEL_MSB 0 -#define BB_MIT_RSSI_CNTL_2_MIT_AGC_SEL_LSB 0 -#define BB_MIT_RSSI_CNTL_2_MIT_AGC_SEL_MASK 0x00000001 -#define BB_MIT_RSSI_CNTL_2_MIT_AGC_SEL_GET(x) (((x) & 0x00000001) >> 0) -#define BB_MIT_RSSI_CNTL_2_MIT_AGC_SEL_SET(x) (((x) << 0) & 0x00000001) -#define BB_MIT_RSSI_CNTL_2_MIT_RSSI_BASE_MSB 11 -#define BB_MIT_RSSI_CNTL_2_MIT_RSSI_BASE_LSB 1 -#define BB_MIT_RSSI_CNTL_2_MIT_RSSI_BASE_MASK 0x00000ffe -#define BB_MIT_RSSI_CNTL_2_MIT_RSSI_BASE_GET(x) (((x) & 0x00000ffe) >> 1) -#define BB_MIT_RSSI_CNTL_2_MIT_RSSI_BASE_SET(x) (((x) << 1) & 0x00000ffe) - -/* macros for bb_mit_reg_map.BB_mit_tx_cntl */ -#define BB_MIT_TX_CNTL_ADDRESS 0x00000010 -#define BB_MIT_TX_CNTL_OFFSET 0x00000010 -#define BB_MIT_TX_CNTL_MIT_TX_STA_CNT_MSB 7 -#define BB_MIT_TX_CNTL_MIT_TX_STA_CNT_LSB 0 -#define BB_MIT_TX_CNTL_MIT_TX_STA_CNT_MASK 0x000000ff -#define BB_MIT_TX_CNTL_MIT_TX_STA_CNT_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_MIT_TX_CNTL_MIT_TX_STA_CNT_SET(x) (((x) << 0) & 0x000000ff) -#define BB_MIT_TX_CNTL_MIT_TX_END_DLY_CNT_MSB 21 -#define BB_MIT_TX_CNTL_MIT_TX_END_DLY_CNT_LSB 8 -#define BB_MIT_TX_CNTL_MIT_TX_END_DLY_CNT_MASK 0x003fff00 -#define BB_MIT_TX_CNTL_MIT_TX_END_DLY_CNT_GET(x) (((x) & 0x003fff00) >> 8) -#define BB_MIT_TX_CNTL_MIT_TX_END_DLY_CNT_SET(x) (((x) << 8) & 0x003fff00) -#define BB_MIT_TX_CNTL_MIT_TX_THROUGH_ENA_MSB 22 -#define BB_MIT_TX_CNTL_MIT_TX_THROUGH_ENA_LSB 22 -#define BB_MIT_TX_CNTL_MIT_TX_THROUGH_ENA_MASK 0x00400000 -#define BB_MIT_TX_CNTL_MIT_TX_THROUGH_ENA_GET(x) (((x) & 0x00400000) >> 22) -#define BB_MIT_TX_CNTL_MIT_TX_THROUGH_ENA_SET(x) (((x) << 22) & 0x00400000) -#define BB_MIT_TX_CNTL_MIT_TXHDR_CHAIN_MASK_CCK_MSB 25 -#define BB_MIT_TX_CNTL_MIT_TXHDR_CHAIN_MASK_CCK_LSB 23 -#define BB_MIT_TX_CNTL_MIT_TXHDR_CHAIN_MASK_CCK_MASK 0x03800000 -#define BB_MIT_TX_CNTL_MIT_TXHDR_CHAIN_MASK_CCK_GET(x) (((x) & 0x03800000) >> 23) -#define BB_MIT_TX_CNTL_MIT_TXHDR_CHAIN_MASK_CCK_SET(x) (((x) << 23) & 0x03800000) -#define BB_MIT_TX_CNTL_MIT_TXHDR_PAPRD_TRAIN_MASK_CCK_MSB 28 -#define BB_MIT_TX_CNTL_MIT_TXHDR_PAPRD_TRAIN_MASK_CCK_LSB 26 -#define BB_MIT_TX_CNTL_MIT_TXHDR_PAPRD_TRAIN_MASK_CCK_MASK 0x1c000000 -#define BB_MIT_TX_CNTL_MIT_TXHDR_PAPRD_TRAIN_MASK_CCK_GET(x) (((x) & 0x1c000000) >> 26) -#define BB_MIT_TX_CNTL_MIT_TXHDR_PAPRD_TRAIN_MASK_CCK_SET(x) (((x) << 26) & 0x1c000000) -#define BB_MIT_TX_CNTL_MIT_TXHDR_CHAN_MODE_CCK_MSB 30 -#define BB_MIT_TX_CNTL_MIT_TXHDR_CHAN_MODE_CCK_LSB 29 -#define BB_MIT_TX_CNTL_MIT_TXHDR_CHAN_MODE_CCK_MASK 0x60000000 -#define BB_MIT_TX_CNTL_MIT_TXHDR_CHAN_MODE_CCK_GET(x) (((x) & 0x60000000) >> 29) -#define BB_MIT_TX_CNTL_MIT_TXHDR_CHAN_MODE_CCK_SET(x) (((x) << 29) & 0x60000000) - -/* macros for bb_mit_reg_map.BB_mit_rx_cntl */ -#define BB_MIT_RX_CNTL_ADDRESS 0x00000014 -#define BB_MIT_RX_CNTL_OFFSET 0x00000014 -#define BB_MIT_RX_CNTL_MIT_RX_END_DLY_CNT_MSB 7 -#define BB_MIT_RX_CNTL_MIT_RX_END_DLY_CNT_LSB 0 -#define BB_MIT_RX_CNTL_MIT_RX_END_DLY_CNT_MASK 0x000000ff -#define BB_MIT_RX_CNTL_MIT_RX_END_DLY_CNT_GET(x) (((x) & 0x000000ff) >> 0) -#define BB_MIT_RX_CNTL_MIT_RX_END_DLY_CNT_SET(x) (((x) << 0) & 0x000000ff) -#define BB_MIT_RX_CNTL_MIT_RX_THROUGH_ENA_MSB 8 -#define BB_MIT_RX_CNTL_MIT_RX_THROUGH_ENA_LSB 8 -#define BB_MIT_RX_CNTL_MIT_RX_THROUGH_ENA_MASK 0x00000100 -#define BB_MIT_RX_CNTL_MIT_RX_THROUGH_ENA_GET(x) (((x) & 0x00000100) >> 8) -#define BB_MIT_RX_CNTL_MIT_RX_THROUGH_ENA_SET(x) (((x) << 8) & 0x00000100) - -/* macros for bb_mit_reg_map.BB_mit_out_cntl */ -#define BB_MIT_OUT_CNTL_ADDRESS 0x00000018 -#define BB_MIT_OUT_CNTL_OFFSET 0x00000018 -#define BB_MIT_OUT_CNTL_MIT_CLK_TUNE_MOD_MSB 1 -#define BB_MIT_OUT_CNTL_MIT_CLK_TUNE_MOD_LSB 0 -#define BB_MIT_OUT_CNTL_MIT_CLK_TUNE_MOD_MASK 0x00000003 -#define BB_MIT_OUT_CNTL_MIT_CLK_TUNE_MOD_GET(x) (((x) & 0x00000003) >> 0) -#define BB_MIT_OUT_CNTL_MIT_CLK_TUNE_MOD_SET(x) (((x) << 0) & 0x00000003) -#define BB_MIT_OUT_CNTL_MIT_NO_DATA_TO_ATH_MSB 2 -#define BB_MIT_OUT_CNTL_MIT_NO_DATA_TO_ATH_LSB 2 -#define BB_MIT_OUT_CNTL_MIT_NO_DATA_TO_ATH_MASK 0x00000004 -#define BB_MIT_OUT_CNTL_MIT_NO_DATA_TO_ATH_GET(x) (((x) & 0x00000004) >> 2) -#define BB_MIT_OUT_CNTL_MIT_NO_DATA_TO_ATH_SET(x) (((x) << 2) & 0x00000004) - -/* macros for bb_mit_reg_map.BB_mit_spare_cntl */ -#define BB_MIT_SPARE_CNTL_ADDRESS 0x0000001c -#define BB_MIT_SPARE_CNTL_OFFSET 0x0000001c -#define BB_MIT_SPARE_CNTL_MIT_SPARE_IN_MSB 30 -#define BB_MIT_SPARE_CNTL_MIT_SPARE_IN_LSB 0 -#define BB_MIT_SPARE_CNTL_MIT_SPARE_IN_MASK 0x7fffffff -#define BB_MIT_SPARE_CNTL_MIT_SPARE_IN_GET(x) (((x) & 0x7fffffff) >> 0) -#define BB_MIT_SPARE_CNTL_MIT_SPARE_IN_SET(x) (((x) << 0) & 0x7fffffff) -#define BB_MIT_SPARE_CNTL_MIT_SPARE_OUT_MSB 31 -#define BB_MIT_SPARE_CNTL_MIT_SPARE_OUT_LSB 31 -#define BB_MIT_SPARE_CNTL_MIT_SPARE_OUT_MASK 0x80000000 -#define BB_MIT_SPARE_CNTL_MIT_SPARE_OUT_GET(x) (((x) & 0x80000000) >> 31) - -#ifndef __ASSEMBLER__ - -typedef struct bb_reg_reg_s_12 { - volatile unsigned int BB_mit_rf_cntl; /* 0x0 - 0x4 */ - volatile unsigned int BB_mit_cca_cntl; /* 0x4 - 0x8 */ - volatile unsigned int BB_mit_rssi_cntl_1; /* 0x8 - 0xc */ - volatile unsigned int BB_mit_rssi_cntl_2; /* 0xc - 0x10 */ - volatile unsigned int BB_mit_tx_cntl; /* 0x10 - 0x14 */ - volatile unsigned int BB_mit_rx_cntl; /* 0x14 - 0x18 */ - volatile unsigned int BB_mit_out_cntl; /* 0x18 - 0x1c */ - volatile unsigned int BB_mit_spare_cntl; /* 0x1c - 0x20 */ -} bb_reg_reg_t_12; - -#endif /* __ASSEMBLER__ */ - -#define RFILE_INST_BB_CHN_REG_MAP__NUM 1 -#define RFILE_INST_BB_MRC_REG_MAP__NUM 1 -#define RFILE_INST_BB_BBB_REG_MAP__NUM 1 -#define RFILE_INST_BB_AGC_REG_MAP__NUM 1 -#define RFILE_INST_BB_SM_REG_MAP__NUM 1 -#define RFILE_INST_BB_CHN1_REG_MAP__NUM 1 -#define RFILE_INST_BB_AGC1_REG_MAP__NUM 1 -#define RFILE_INST_BB_SM1_REG_MAP__NUM 1 -#define RFILE_INST_BB_CHN3_REG_MAP__NUM 1 -#define RFILE_INST_BB_AGC3_REG_MAP__NUM 1 -#define RFILE_INST_BB_SM3_REG_MAP__NUM 1 -#define RFILE_INST_BB_MIT_REG_MAP__NUM 1 - - -#ifndef __ASSEMBLER__ - -#if 0 -typedef struct bb_reg_reg_s_13 { - volatile char pad__0[0x9800]; /* 0x0 - 0x9800 */ - struct chn_reg_map bb_chn_reg_map; /* 0x9800 - 0x9bf8 */ - volatile char pad__1[0x8]; /* 0x9bf8 - 0x9c00 */ - struct mrc_reg_map bb_mrc_reg_map; /* 0x9c00 - 0x9c24 */ - volatile char pad__2[0xdc]; /* 0x9c24 - 0x9d00 */ - struct bbb_reg_map bb_bbb_reg_map; /* 0x9d00 - 0x9d1c */ - volatile char pad__3[0xe4]; /* 0x9d1c - 0x9e00 */ - struct agc_reg_map bb_agc_reg_map; /* 0x9e00 - 0xa200 */ - struct sm_reg_map bb_sm_reg_map; /* 0xa200 - 0xa7f8 */ - volatile char pad__4[0x8]; /* 0xa7f8 - 0xa800 */ - struct chn1_reg_map bb_chn1_reg_map; /* 0xa800 - 0xabc8 */ - volatile char pad__5[0x238]; /* 0xabc8 - 0xae00 */ - struct agc1_reg_map bb_agc1_reg_map; /* 0xae00 - 0xb1fc */ - volatile char pad__6[0x4]; /* 0xb1fc - 0xb200 */ - struct sm1_reg_map bb_sm1_reg_map; /* 0xb200 - 0xb774 */ - volatile char pad__7[0x108c]; /* 0xb774 - 0xc800 */ - struct chn3_reg_map bb_chn3_reg_map; /* 0xc800 - 0xcc00 */ - volatile char pad__8[0x200]; /* 0xcc00 - 0xce00 */ - struct agc3_reg_map bb_agc3_reg_map; /* 0xce00 - 0xcf84 */ - volatile char pad__9[0x27c]; /* 0xcf84 - 0xd200 */ - struct sm3_reg_map bb_sm3_reg_map; /* 0xd200 - 0xd800 */ - struct mit_local_reg_map bb_mit_reg_map; /* 0xd800 - 0xd820 */ -} bb_reg_reg_t_13; -#endif //0 - -#endif /* __ASSEMBLER__ */ - -#endif /* _BB_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_gmac_0_rx_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_gmac_0_rx_reg.h deleted file mode 100644 index fc383d76a4d9..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_gmac_0_rx_reg.h +++ /dev/null @@ -1,122 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _BRIDGE_CHAIN_GMAC_0_RX_REG_REG_H_ -#define _BRIDGE_CHAIN_GMAC_0_RX_REG_REG_H_ - -#define GMAC_RX_0_DESC_START_ADDRESS_ADDRESS 0x00000000 -#define GMAC_RX_0_DESC_START_ADDRESS_OFFSET 0x00000000 -#define GMAC_RX_0_DESC_START_ADDRESS_ADDRESS_MSB 31 -#define GMAC_RX_0_DESC_START_ADDRESS_ADDRESS_LSB 0 -#define GMAC_RX_0_DESC_START_ADDRESS_ADDRESS_MASK 0xffffffff -#define GMAC_RX_0_DESC_START_ADDRESS_ADDRESS_GET(x) (((x) & GMAC_RX_0_DESC_START_ADDRESS_ADDRESS_MASK) >> GMAC_RX_0_DESC_START_ADDRESS_ADDRESS_LSB) -#define GMAC_RX_0_DESC_START_ADDRESS_ADDRESS_SET(x) (((x) << GMAC_RX_0_DESC_START_ADDRESS_ADDRESS_LSB) & GMAC_RX_0_DESC_START_ADDRESS_ADDRESS_MASK) - -#define GMAC_RX_0_DMA_START_ADDRESS 0x00000004 -#define GMAC_RX_0_DMA_START_OFFSET 0x00000004 -#define GMAC_RX_0_DMA_START_RESTART_MSB 4 -#define GMAC_RX_0_DMA_START_RESTART_LSB 4 -#define GMAC_RX_0_DMA_START_RESTART_MASK 0x00000010 -#define GMAC_RX_0_DMA_START_RESTART_GET(x) (((x) & GMAC_RX_0_DMA_START_RESTART_MASK) >> GMAC_RX_0_DMA_START_RESTART_LSB) -#define GMAC_RX_0_DMA_START_RESTART_SET(x) (((x) << GMAC_RX_0_DMA_START_RESTART_LSB) & GMAC_RX_0_DMA_START_RESTART_MASK) -#define GMAC_RX_0_DMA_START_START_MSB 0 -#define GMAC_RX_0_DMA_START_START_LSB 0 -#define GMAC_RX_0_DMA_START_START_MASK 0x00000001 -#define GMAC_RX_0_DMA_START_START_GET(x) (((x) & GMAC_RX_0_DMA_START_START_MASK) >> GMAC_RX_0_DMA_START_START_LSB) -#define GMAC_RX_0_DMA_START_START_SET(x) (((x) << GMAC_RX_0_DMA_START_START_LSB) & GMAC_RX_0_DMA_START_START_MASK) - -#define GMAC_RX_0_BURST_SIZE_ADDRESS 0x00000008 -#define GMAC_RX_0_BURST_SIZE_OFFSET 0x00000008 -#define GMAC_RX_0_BURST_SIZE_BURST_MSB 1 -#define GMAC_RX_0_BURST_SIZE_BURST_LSB 0 -#define GMAC_RX_0_BURST_SIZE_BURST_MASK 0x00000003 -#define GMAC_RX_0_BURST_SIZE_BURST_GET(x) (((x) & GMAC_RX_0_BURST_SIZE_BURST_MASK) >> GMAC_RX_0_BURST_SIZE_BURST_LSB) -#define GMAC_RX_0_BURST_SIZE_BURST_SET(x) (((x) << GMAC_RX_0_BURST_SIZE_BURST_LSB) & GMAC_RX_0_BURST_SIZE_BURST_MASK) - -#define GMAC_RX_0_PKT_OFFSET_ADDRESS 0x0000000c -#define GMAC_RX_0_PKT_OFFSET_OFFSET 0x0000000c -#define GMAC_RX_0_PKT_OFFSET_OFFSET_MSB 7 -#define GMAC_RX_0_PKT_OFFSET_OFFSET_LSB 0 -#define GMAC_RX_0_PKT_OFFSET_OFFSET_MASK 0x000000ff -#define GMAC_RX_0_PKT_OFFSET_OFFSET_GET(x) (((x) & GMAC_RX_0_PKT_OFFSET_OFFSET_MASK) >> GMAC_RX_0_PKT_OFFSET_OFFSET_LSB) -#define GMAC_RX_0_PKT_OFFSET_OFFSET_SET(x) (((x) << GMAC_RX_0_PKT_OFFSET_OFFSET_LSB) & GMAC_RX_0_PKT_OFFSET_OFFSET_MASK) - -#define GMAC_RX_0_CHECKSUM_ADDRESS 0x00000010 -#define GMAC_RX_0_CHECKSUM_OFFSET 0x00000010 -#define GMAC_RX_0_CHECKSUM_UDP_MSB 1 -#define GMAC_RX_0_CHECKSUM_UDP_LSB 1 -#define GMAC_RX_0_CHECKSUM_UDP_MASK 0x00000002 -#define GMAC_RX_0_CHECKSUM_UDP_GET(x) (((x) & GMAC_RX_0_CHECKSUM_UDP_MASK) >> GMAC_RX_0_CHECKSUM_UDP_LSB) -#define GMAC_RX_0_CHECKSUM_UDP_SET(x) (((x) << GMAC_RX_0_CHECKSUM_UDP_LSB) & GMAC_RX_0_CHECKSUM_UDP_MASK) -#define GMAC_RX_0_CHECKSUM_TCP_MSB 0 -#define GMAC_RX_0_CHECKSUM_TCP_LSB 0 -#define GMAC_RX_0_CHECKSUM_TCP_MASK 0x00000001 -#define GMAC_RX_0_CHECKSUM_TCP_GET(x) (((x) & GMAC_RX_0_CHECKSUM_TCP_MASK) >> GMAC_RX_0_CHECKSUM_TCP_LSB) -#define GMAC_RX_0_CHECKSUM_TCP_SET(x) (((x) << GMAC_RX_0_CHECKSUM_TCP_LSB) & GMAC_RX_0_CHECKSUM_TCP_MASK) - -#define GMAC_RX_0_DBG_RX_ADDRESS 0x00000014 -#define GMAC_RX_0_DBG_RX_OFFSET 0x00000014 -#define GMAC_RX_0_DBG_RX_STATE_MSB 3 -#define GMAC_RX_0_DBG_RX_STATE_LSB 0 -#define GMAC_RX_0_DBG_RX_STATE_MASK 0x0000000f -#define GMAC_RX_0_DBG_RX_STATE_GET(x) (((x) & GMAC_RX_0_DBG_RX_STATE_MASK) >> GMAC_RX_0_DBG_RX_STATE_LSB) -#define GMAC_RX_0_DBG_RX_STATE_SET(x) (((x) << GMAC_RX_0_DBG_RX_STATE_LSB) & GMAC_RX_0_DBG_RX_STATE_MASK) - -#define GMAC_RX_0_DBG_RX_CUR_ADDR_ADDRESS 0x00000018 -#define GMAC_RX_0_DBG_RX_CUR_ADDR_OFFSET 0x00000018 -#define GMAC_RX_0_DBG_RX_CUR_ADDR_ADDR_MSB 31 -#define GMAC_RX_0_DBG_RX_CUR_ADDR_ADDR_LSB 0 -#define GMAC_RX_0_DBG_RX_CUR_ADDR_ADDR_MASK 0xffffffff -#define GMAC_RX_0_DBG_RX_CUR_ADDR_ADDR_GET(x) (((x) & GMAC_RX_0_DBG_RX_CUR_ADDR_ADDR_MASK) >> GMAC_RX_0_DBG_RX_CUR_ADDR_ADDR_LSB) -#define GMAC_RX_0_DBG_RX_CUR_ADDR_ADDR_SET(x) (((x) << GMAC_RX_0_DBG_RX_CUR_ADDR_ADDR_LSB) & GMAC_RX_0_DBG_RX_CUR_ADDR_ADDR_MASK) - -#define GMAC_RX_0_DATA_SWAP_ADDRESS 0x0000001c -#define GMAC_RX_0_DATA_SWAP_OFFSET 0x0000001c -#define GMAC_RX_0_DATA_SWAP_SWAPD_MSB 1 -#define GMAC_RX_0_DATA_SWAP_SWAPD_LSB 1 -#define GMAC_RX_0_DATA_SWAP_SWAPD_MASK 0x00000002 -#define GMAC_RX_0_DATA_SWAP_SWAPD_GET(x) (((x) & GMAC_RX_0_DATA_SWAP_SWAPD_MASK) >> GMAC_RX_0_DATA_SWAP_SWAPD_LSB) -#define GMAC_RX_0_DATA_SWAP_SWAPD_SET(x) (((x) << GMAC_RX_0_DATA_SWAP_SWAPD_LSB) & GMAC_RX_0_DATA_SWAP_SWAPD_MASK) -#define GMAC_RX_0_DATA_SWAP_SWAP_MSB 0 -#define GMAC_RX_0_DATA_SWAP_SWAP_LSB 0 -#define GMAC_RX_0_DATA_SWAP_SWAP_MASK 0x00000001 -#define GMAC_RX_0_DATA_SWAP_SWAP_GET(x) (((x) & GMAC_RX_0_DATA_SWAP_SWAP_MASK) >> GMAC_RX_0_DATA_SWAP_SWAP_LSB) -#define GMAC_RX_0_DATA_SWAP_SWAP_SET(x) (((x) << GMAC_RX_0_DATA_SWAP_SWAP_LSB) & GMAC_RX_0_DATA_SWAP_SWAP_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct bridge_chain_gmac_0_rx_reg_reg_s { - volatile unsigned int gmac_rx_0_desc_start_address; - volatile unsigned int gmac_rx_0_dma_start; - volatile unsigned int gmac_rx_0_burst_size; - volatile unsigned int gmac_rx_0_pkt_offset; - volatile unsigned int gmac_rx_0_checksum; - volatile unsigned int gmac_rx_0_dbg_rx; - volatile unsigned int gmac_rx_0_dbg_rx_cur_addr; - volatile unsigned int gmac_rx_0_data_swap; -} bridge_chain_gmac_0_rx_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _BRIDGE_CHAIN_GMAC_0_RX_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_gmac_0_tx_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_gmac_0_tx_reg.h deleted file mode 100644 index 6a9a010b150d..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_gmac_0_tx_reg.h +++ /dev/null @@ -1,118 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _BRIDGE_CHAIN_GMAC_0_TX_REG_REG_H_ -#define _BRIDGE_CHAIN_GMAC_0_TX_REG_REG_H_ - -#define GMAC_TX_0_DESC_START_ADDRESS_ADDRESS 0x00000000 -#define GMAC_TX_0_DESC_START_ADDRESS_OFFSET 0x00000000 -#define GMAC_TX_0_DESC_START_ADDRESS_ADDRESS_MSB 31 -#define GMAC_TX_0_DESC_START_ADDRESS_ADDRESS_LSB 0 -#define GMAC_TX_0_DESC_START_ADDRESS_ADDRESS_MASK 0xffffffff -#define GMAC_TX_0_DESC_START_ADDRESS_ADDRESS_GET(x) (((x) & GMAC_TX_0_DESC_START_ADDRESS_ADDRESS_MASK) >> GMAC_TX_0_DESC_START_ADDRESS_ADDRESS_LSB) -#define GMAC_TX_0_DESC_START_ADDRESS_ADDRESS_SET(x) (((x) << GMAC_TX_0_DESC_START_ADDRESS_ADDRESS_LSB) & GMAC_TX_0_DESC_START_ADDRESS_ADDRESS_MASK) - -#define GMAC_TX_0_DMA_START_ADDRESS 0x00000004 -#define GMAC_TX_0_DMA_START_OFFSET 0x00000004 -#define GMAC_TX_0_DMA_START_RESTART_MSB 4 -#define GMAC_TX_0_DMA_START_RESTART_LSB 4 -#define GMAC_TX_0_DMA_START_RESTART_MASK 0x00000010 -#define GMAC_TX_0_DMA_START_RESTART_GET(x) (((x) & GMAC_TX_0_DMA_START_RESTART_MASK) >> GMAC_TX_0_DMA_START_RESTART_LSB) -#define GMAC_TX_0_DMA_START_RESTART_SET(x) (((x) << GMAC_TX_0_DMA_START_RESTART_LSB) & GMAC_TX_0_DMA_START_RESTART_MASK) -#define GMAC_TX_0_DMA_START_START_MSB 0 -#define GMAC_TX_0_DMA_START_START_LSB 0 -#define GMAC_TX_0_DMA_START_START_MASK 0x00000001 -#define GMAC_TX_0_DMA_START_START_GET(x) (((x) & GMAC_TX_0_DMA_START_START_MASK) >> GMAC_TX_0_DMA_START_START_LSB) -#define GMAC_TX_0_DMA_START_START_SET(x) (((x) << GMAC_TX_0_DMA_START_START_LSB) & GMAC_TX_0_DMA_START_START_MASK) - -#define GMAC_TX_0_INTERRUPT_LIMIT_ADDRESS 0x00000008 -#define GMAC_TX_0_INTERRUPT_LIMIT_OFFSET 0x00000008 -#define GMAC_TX_0_INTERRUPT_LIMIT_TIMEOUT_MSB 15 -#define GMAC_TX_0_INTERRUPT_LIMIT_TIMEOUT_LSB 4 -#define GMAC_TX_0_INTERRUPT_LIMIT_TIMEOUT_MASK 0x0000fff0 -#define GMAC_TX_0_INTERRUPT_LIMIT_TIMEOUT_GET(x) (((x) & GMAC_TX_0_INTERRUPT_LIMIT_TIMEOUT_MASK) >> GMAC_TX_0_INTERRUPT_LIMIT_TIMEOUT_LSB) -#define GMAC_TX_0_INTERRUPT_LIMIT_TIMEOUT_SET(x) (((x) << GMAC_TX_0_INTERRUPT_LIMIT_TIMEOUT_LSB) & GMAC_TX_0_INTERRUPT_LIMIT_TIMEOUT_MASK) -#define GMAC_TX_0_INTERRUPT_LIMIT_COUNT_MSB 3 -#define GMAC_TX_0_INTERRUPT_LIMIT_COUNT_LSB 0 -#define GMAC_TX_0_INTERRUPT_LIMIT_COUNT_MASK 0x0000000f -#define GMAC_TX_0_INTERRUPT_LIMIT_COUNT_GET(x) (((x) & GMAC_TX_0_INTERRUPT_LIMIT_COUNT_MASK) >> GMAC_TX_0_INTERRUPT_LIMIT_COUNT_LSB) -#define GMAC_TX_0_INTERRUPT_LIMIT_COUNT_SET(x) (((x) << GMAC_TX_0_INTERRUPT_LIMIT_COUNT_LSB) & GMAC_TX_0_INTERRUPT_LIMIT_COUNT_MASK) - -#define GMAC_TX_0_BURST_SIZE_ADDRESS 0x0000000c -#define GMAC_TX_0_BURST_SIZE_OFFSET 0x0000000c -#define GMAC_TX_0_BURST_SIZE_BURST_MSB 1 -#define GMAC_TX_0_BURST_SIZE_BURST_LSB 0 -#define GMAC_TX_0_BURST_SIZE_BURST_MASK 0x00000003 -#define GMAC_TX_0_BURST_SIZE_BURST_GET(x) (((x) & GMAC_TX_0_BURST_SIZE_BURST_MASK) >> GMAC_TX_0_BURST_SIZE_BURST_LSB) -#define GMAC_TX_0_BURST_SIZE_BURST_SET(x) (((x) << GMAC_TX_0_BURST_SIZE_BURST_LSB) & GMAC_TX_0_BURST_SIZE_BURST_MASK) - -#define GMAC_TX_0_DBG_TX_ADDRESS 0x00000010 -#define GMAC_TX_0_DBG_TX_OFFSET 0x00000010 -#define GMAC_TX_0_DBG_TX_FIFO_TOTAL_LEN_MSB 31 -#define GMAC_TX_0_DBG_TX_FIFO_TOTAL_LEN_LSB 16 -#define GMAC_TX_0_DBG_TX_FIFO_TOTAL_LEN_MASK 0xffff0000 -#define GMAC_TX_0_DBG_TX_FIFO_TOTAL_LEN_GET(x) (((x) & GMAC_TX_0_DBG_TX_FIFO_TOTAL_LEN_MASK) >> GMAC_TX_0_DBG_TX_FIFO_TOTAL_LEN_LSB) -#define GMAC_TX_0_DBG_TX_FIFO_TOTAL_LEN_SET(x) (((x) << GMAC_TX_0_DBG_TX_FIFO_TOTAL_LEN_LSB) & GMAC_TX_0_DBG_TX_FIFO_TOTAL_LEN_MASK) -#define GMAC_TX_0_DBG_TX_STATE_MSB 2 -#define GMAC_TX_0_DBG_TX_STATE_LSB 0 -#define GMAC_TX_0_DBG_TX_STATE_MASK 0x00000007 -#define GMAC_TX_0_DBG_TX_STATE_GET(x) (((x) & GMAC_TX_0_DBG_TX_STATE_MASK) >> GMAC_TX_0_DBG_TX_STATE_LSB) -#define GMAC_TX_0_DBG_TX_STATE_SET(x) (((x) << GMAC_TX_0_DBG_TX_STATE_LSB) & GMAC_TX_0_DBG_TX_STATE_MASK) - -#define GMAC_TX_0_DBG_TX_CUR_ADDR_ADDRESS 0x00000014 -#define GMAC_TX_0_DBG_TX_CUR_ADDR_OFFSET 0x00000014 -#define GMAC_TX_0_DBG_TX_CUR_ADDR_ADDR_MSB 31 -#define GMAC_TX_0_DBG_TX_CUR_ADDR_ADDR_LSB 0 -#define GMAC_TX_0_DBG_TX_CUR_ADDR_ADDR_MASK 0xffffffff -#define GMAC_TX_0_DBG_TX_CUR_ADDR_ADDR_GET(x) (((x) & GMAC_TX_0_DBG_TX_CUR_ADDR_ADDR_MASK) >> GMAC_TX_0_DBG_TX_CUR_ADDR_ADDR_LSB) -#define GMAC_TX_0_DBG_TX_CUR_ADDR_ADDR_SET(x) (((x) << GMAC_TX_0_DBG_TX_CUR_ADDR_ADDR_LSB) & GMAC_TX_0_DBG_TX_CUR_ADDR_ADDR_MASK) - -#define GMAC_TX_0_DATA_SWAP_ADDRESS 0x00000018 -#define GMAC_TX_0_DATA_SWAP_OFFSET 0x00000018 -#define GMAC_TX_0_DATA_SWAP_SWAPD_MSB 1 -#define GMAC_TX_0_DATA_SWAP_SWAPD_LSB 1 -#define GMAC_TX_0_DATA_SWAP_SWAPD_MASK 0x00000002 -#define GMAC_TX_0_DATA_SWAP_SWAPD_GET(x) (((x) & GMAC_TX_0_DATA_SWAP_SWAPD_MASK) >> GMAC_TX_0_DATA_SWAP_SWAPD_LSB) -#define GMAC_TX_0_DATA_SWAP_SWAPD_SET(x) (((x) << GMAC_TX_0_DATA_SWAP_SWAPD_LSB) & GMAC_TX_0_DATA_SWAP_SWAPD_MASK) -#define GMAC_TX_0_DATA_SWAP_SWAP_MSB 0 -#define GMAC_TX_0_DATA_SWAP_SWAP_LSB 0 -#define GMAC_TX_0_DATA_SWAP_SWAP_MASK 0x00000001 -#define GMAC_TX_0_DATA_SWAP_SWAP_GET(x) (((x) & GMAC_TX_0_DATA_SWAP_SWAP_MASK) >> GMAC_TX_0_DATA_SWAP_SWAP_LSB) -#define GMAC_TX_0_DATA_SWAP_SWAP_SET(x) (((x) << GMAC_TX_0_DATA_SWAP_SWAP_LSB) & GMAC_TX_0_DATA_SWAP_SWAP_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct bridge_chain_gmac_0_tx_reg_reg_s { - volatile unsigned int gmac_tx_0_desc_start_address; - volatile unsigned int gmac_tx_0_dma_start; - volatile unsigned int gmac_tx_0_interrupt_limit; - volatile unsigned int gmac_tx_0_burst_size; - volatile unsigned int gmac_tx_0_dbg_tx; - volatile unsigned int gmac_tx_0_dbg_tx_cur_addr; - volatile unsigned int gmac_tx_0_data_swap; -} bridge_chain_gmac_0_tx_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _BRIDGE_CHAIN_GMAC_0_TX_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_rx_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_rx_reg.h deleted file mode 100644 index 65de67f7b47c..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_rx_reg.h +++ /dev/null @@ -1,122 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _BRIDGE_CHAIN_RX_REG_REG_H_ -#define _BRIDGE_CHAIN_RX_REG_REG_H_ - -#define DESC_START_ADDRESS_ADDRESS 0x00000000 -#define DESC_START_ADDRESS_OFFSET 0x00000000 -#define DESC_START_ADDRESS_ADDRESS_MSB 31 -#define DESC_START_ADDRESS_ADDRESS_LSB 0 -#define DESC_START_ADDRESS_ADDRESS_MASK 0xffffffff -#define DESC_START_ADDRESS_ADDRESS_GET(x) (((x) & DESC_START_ADDRESS_ADDRESS_MASK) >> DESC_START_ADDRESS_ADDRESS_LSB) -#define DESC_START_ADDRESS_ADDRESS_SET(x) (((x) << DESC_START_ADDRESS_ADDRESS_LSB) & DESC_START_ADDRESS_ADDRESS_MASK) - -#define DMA_START_ADDRESS 0x00000004 -#define DMA_START_OFFSET 0x00000004 -#define DMA_START_RESTART_MSB 4 -#define DMA_START_RESTART_LSB 4 -#define DMA_START_RESTART_MASK 0x00000010 -#define DMA_START_RESTART_GET(x) (((x) & DMA_START_RESTART_MASK) >> DMA_START_RESTART_LSB) -#define DMA_START_RESTART_SET(x) (((x) << DMA_START_RESTART_LSB) & DMA_START_RESTART_MASK) -#define DMA_START_START_MSB 0 -#define DMA_START_START_LSB 0 -#define DMA_START_START_MASK 0x00000001 -#define DMA_START_START_GET(x) (((x) & DMA_START_START_MASK) >> DMA_START_START_LSB) -#define DMA_START_START_SET(x) (((x) << DMA_START_START_LSB) & DMA_START_START_MASK) - -#define BURST_SIZE_ADDRESS 0x00000008 -#define BURST_SIZE_OFFSET 0x00000008 -#define BURST_SIZE_BURST_MSB 1 -#define BURST_SIZE_BURST_LSB 0 -#define BURST_SIZE_BURST_MASK 0x00000003 -#define BURST_SIZE_BURST_GET(x) (((x) & BURST_SIZE_BURST_MASK) >> BURST_SIZE_BURST_LSB) -#define BURST_SIZE_BURST_SET(x) (((x) << BURST_SIZE_BURST_LSB) & BURST_SIZE_BURST_MASK) - -#define PKT_OFFSET_ADDRESS 0x0000000c -#define PKT_OFFSET_OFFSET 0x0000000c -#define PKT_OFFSET_OFFSET_MSB 7 -#define PKT_OFFSET_OFFSET_LSB 0 -#define PKT_OFFSET_OFFSET_MASK 0x000000ff -#define PKT_OFFSET_OFFSET_GET(x) (((x) & PKT_OFFSET_OFFSET_MASK) >> PKT_OFFSET_OFFSET_LSB) -#define PKT_OFFSET_OFFSET_SET(x) (((x) << PKT_OFFSET_OFFSET_LSB) & PKT_OFFSET_OFFSET_MASK) - -#define CHECKSUM_ADDRESS 0x00000010 -#define CHECKSUM_OFFSET 0x00000010 -#define CHECKSUM_UDP_MSB 1 -#define CHECKSUM_UDP_LSB 1 -#define CHECKSUM_UDP_MASK 0x00000002 -#define CHECKSUM_UDP_GET(x) (((x) & CHECKSUM_UDP_MASK) >> CHECKSUM_UDP_LSB) -#define CHECKSUM_UDP_SET(x) (((x) << CHECKSUM_UDP_LSB) & CHECKSUM_UDP_MASK) -#define CHECKSUM_TCP_MSB 0 -#define CHECKSUM_TCP_LSB 0 -#define CHECKSUM_TCP_MASK 0x00000001 -#define CHECKSUM_TCP_GET(x) (((x) & CHECKSUM_TCP_MASK) >> CHECKSUM_TCP_LSB) -#define CHECKSUM_TCP_SET(x) (((x) << CHECKSUM_TCP_LSB) & CHECKSUM_TCP_MASK) - -#define DBG_RX_ADDRESS 0x00000014 -#define DBG_RX_OFFSET 0x00000014 -#define DBG_RX_STATE_MSB 3 -#define DBG_RX_STATE_LSB 0 -#define DBG_RX_STATE_MASK 0x0000000f -#define DBG_RX_STATE_GET(x) (((x) & DBG_RX_STATE_MASK) >> DBG_RX_STATE_LSB) -#define DBG_RX_STATE_SET(x) (((x) << DBG_RX_STATE_LSB) & DBG_RX_STATE_MASK) - -#define DBG_RX_CUR_ADDR_ADDRESS 0x00000018 -#define DBG_RX_CUR_ADDR_OFFSET 0x00000018 -#define DBG_RX_CUR_ADDR_ADDR_MSB 31 -#define DBG_RX_CUR_ADDR_ADDR_LSB 0 -#define DBG_RX_CUR_ADDR_ADDR_MASK 0xffffffff -#define DBG_RX_CUR_ADDR_ADDR_GET(x) (((x) & DBG_RX_CUR_ADDR_ADDR_MASK) >> DBG_RX_CUR_ADDR_ADDR_LSB) -#define DBG_RX_CUR_ADDR_ADDR_SET(x) (((x) << DBG_RX_CUR_ADDR_ADDR_LSB) & DBG_RX_CUR_ADDR_ADDR_MASK) - -#define DATA_SWAP_ADDRESS 0x0000001c -#define DATA_SWAP_OFFSET 0x0000001c -#define DATA_SWAP_SWAPD_MSB 1 -#define DATA_SWAP_SWAPD_LSB 1 -#define DATA_SWAP_SWAPD_MASK 0x00000002 -#define DATA_SWAP_SWAPD_GET(x) (((x) & DATA_SWAP_SWAPD_MASK) >> DATA_SWAP_SWAPD_LSB) -#define DATA_SWAP_SWAPD_SET(x) (((x) << DATA_SWAP_SWAPD_LSB) & DATA_SWAP_SWAPD_MASK) -#define DATA_SWAP_SWAP_MSB 0 -#define DATA_SWAP_SWAP_LSB 0 -#define DATA_SWAP_SWAP_MASK 0x00000001 -#define DATA_SWAP_SWAP_GET(x) (((x) & DATA_SWAP_SWAP_MASK) >> DATA_SWAP_SWAP_LSB) -#define DATA_SWAP_SWAP_SET(x) (((x) << DATA_SWAP_SWAP_LSB) & DATA_SWAP_SWAP_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct bridge_chain_rx_reg_reg_s { - volatile unsigned int desc_start_address; - volatile unsigned int dma_start; - volatile unsigned int burst_size; - volatile unsigned int pkt_offset; - volatile unsigned int checksum; - volatile unsigned int dbg_rx; - volatile unsigned int dbg_rx_cur_addr; - volatile unsigned int data_swap; -} bridge_chain_rx_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _BRIDGE_CHAIN_RX_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_tx_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_tx_reg.h deleted file mode 100644 index b837bcc57745..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_chain_tx_reg.h +++ /dev/null @@ -1,118 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _BRIDGE_CHAIN_TX_REG_REG_H_ -#define _BRIDGE_CHAIN_TX_REG_REG_H_ - -#define DESC_START_ADDRESS_ADDRESS 0x00000000 -#define DESC_START_ADDRESS_OFFSET 0x00000000 -#define DESC_START_ADDRESS_ADDRESS_MSB 31 -#define DESC_START_ADDRESS_ADDRESS_LSB 0 -#define DESC_START_ADDRESS_ADDRESS_MASK 0xffffffff -#define DESC_START_ADDRESS_ADDRESS_GET(x) (((x) & DESC_START_ADDRESS_ADDRESS_MASK) >> DESC_START_ADDRESS_ADDRESS_LSB) -#define DESC_START_ADDRESS_ADDRESS_SET(x) (((x) << DESC_START_ADDRESS_ADDRESS_LSB) & DESC_START_ADDRESS_ADDRESS_MASK) - -#define DMA_START_ADDRESS 0x00000004 -#define DMA_START_OFFSET 0x00000004 -#define DMA_START_RESTART_MSB 4 -#define DMA_START_RESTART_LSB 4 -#define DMA_START_RESTART_MASK 0x00000010 -#define DMA_START_RESTART_GET(x) (((x) & DMA_START_RESTART_MASK) >> DMA_START_RESTART_LSB) -#define DMA_START_RESTART_SET(x) (((x) << DMA_START_RESTART_LSB) & DMA_START_RESTART_MASK) -#define DMA_START_START_MSB 0 -#define DMA_START_START_LSB 0 -#define DMA_START_START_MASK 0x00000001 -#define DMA_START_START_GET(x) (((x) & DMA_START_START_MASK) >> DMA_START_START_LSB) -#define DMA_START_START_SET(x) (((x) << DMA_START_START_LSB) & DMA_START_START_MASK) - -#define INTERRUPT_LIMIT_ADDRESS 0x00000008 -#define INTERRUPT_LIMIT_OFFSET 0x00000008 -#define INTERRUPT_LIMIT_TIMEOUT_MSB 15 -#define INTERRUPT_LIMIT_TIMEOUT_LSB 4 -#define INTERRUPT_LIMIT_TIMEOUT_MASK 0x0000fff0 -#define INTERRUPT_LIMIT_TIMEOUT_GET(x) (((x) & INTERRUPT_LIMIT_TIMEOUT_MASK) >> INTERRUPT_LIMIT_TIMEOUT_LSB) -#define INTERRUPT_LIMIT_TIMEOUT_SET(x) (((x) << INTERRUPT_LIMIT_TIMEOUT_LSB) & INTERRUPT_LIMIT_TIMEOUT_MASK) -#define INTERRUPT_LIMIT_COUNT_MSB 3 -#define INTERRUPT_LIMIT_COUNT_LSB 0 -#define INTERRUPT_LIMIT_COUNT_MASK 0x0000000f -#define INTERRUPT_LIMIT_COUNT_GET(x) (((x) & INTERRUPT_LIMIT_COUNT_MASK) >> INTERRUPT_LIMIT_COUNT_LSB) -#define INTERRUPT_LIMIT_COUNT_SET(x) (((x) << INTERRUPT_LIMIT_COUNT_LSB) & INTERRUPT_LIMIT_COUNT_MASK) - -#define BURST_SIZE_ADDRESS 0x0000000c -#define BURST_SIZE_OFFSET 0x0000000c -#define BURST_SIZE_BURST_MSB 1 -#define BURST_SIZE_BURST_LSB 0 -#define BURST_SIZE_BURST_MASK 0x00000003 -#define BURST_SIZE_BURST_GET(x) (((x) & BURST_SIZE_BURST_MASK) >> BURST_SIZE_BURST_LSB) -#define BURST_SIZE_BURST_SET(x) (((x) << BURST_SIZE_BURST_LSB) & BURST_SIZE_BURST_MASK) - -#define DBG_TX_ADDRESS 0x00000010 -#define DBG_TX_OFFSET 0x00000010 -#define DBG_TX_FIFO_TOTAL_LEN_MSB 31 -#define DBG_TX_FIFO_TOTAL_LEN_LSB 16 -#define DBG_TX_FIFO_TOTAL_LEN_MASK 0xffff0000 -#define DBG_TX_FIFO_TOTAL_LEN_GET(x) (((x) & DBG_TX_FIFO_TOTAL_LEN_MASK) >> DBG_TX_FIFO_TOTAL_LEN_LSB) -#define DBG_TX_FIFO_TOTAL_LEN_SET(x) (((x) << DBG_TX_FIFO_TOTAL_LEN_LSB) & DBG_TX_FIFO_TOTAL_LEN_MASK) -#define DBG_TX_STATE_MSB 2 -#define DBG_TX_STATE_LSB 0 -#define DBG_TX_STATE_MASK 0x00000007 -#define DBG_TX_STATE_GET(x) (((x) & DBG_TX_STATE_MASK) >> DBG_TX_STATE_LSB) -#define DBG_TX_STATE_SET(x) (((x) << DBG_TX_STATE_LSB) & DBG_TX_STATE_MASK) - -#define DBG_TX_CUR_ADDR_ADDRESS 0x00000014 -#define DBG_TX_CUR_ADDR_OFFSET 0x00000014 -#define DBG_TX_CUR_ADDR_ADDR_MSB 31 -#define DBG_TX_CUR_ADDR_ADDR_LSB 0 -#define DBG_TX_CUR_ADDR_ADDR_MASK 0xffffffff -#define DBG_TX_CUR_ADDR_ADDR_GET(x) (((x) & DBG_TX_CUR_ADDR_ADDR_MASK) >> DBG_TX_CUR_ADDR_ADDR_LSB) -#define DBG_TX_CUR_ADDR_ADDR_SET(x) (((x) << DBG_TX_CUR_ADDR_ADDR_LSB) & DBG_TX_CUR_ADDR_ADDR_MASK) - -#define DATA_SWAP_ADDRESS 0x00000018 -#define DATA_SWAP_OFFSET 0x00000018 -#define DATA_SWAP_SWAPD_MSB 1 -#define DATA_SWAP_SWAPD_LSB 1 -#define DATA_SWAP_SWAPD_MASK 0x00000002 -#define DATA_SWAP_SWAPD_GET(x) (((x) & DATA_SWAP_SWAPD_MASK) >> DATA_SWAP_SWAPD_LSB) -#define DATA_SWAP_SWAPD_SET(x) (((x) << DATA_SWAP_SWAPD_LSB) & DATA_SWAP_SWAPD_MASK) -#define DATA_SWAP_SWAP_MSB 0 -#define DATA_SWAP_SWAP_LSB 0 -#define DATA_SWAP_SWAP_MASK 0x00000001 -#define DATA_SWAP_SWAP_GET(x) (((x) & DATA_SWAP_SWAP_MASK) >> DATA_SWAP_SWAP_LSB) -#define DATA_SWAP_SWAP_SET(x) (((x) << DATA_SWAP_SWAP_LSB) & DATA_SWAP_SWAP_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct bridge_chain_tx_reg_reg_s { - volatile unsigned int desc_start_address; - volatile unsigned int dma_start; - volatile unsigned int interrupt_limit; - volatile unsigned int burst_size; - volatile unsigned int dbg_tx; - volatile unsigned int dbg_tx_cur_addr; - volatile unsigned int data_swap; -} bridge_chain_tx_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _BRIDGE_CHAIN_TX_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_intr_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_intr_reg.h deleted file mode 100644 index 905aaac640fd..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_intr_reg.h +++ /dev/null @@ -1,363 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _BRIDGE_INTR_REG_REG_H_ -#define _BRIDGE_INTR_REG_REG_H_ - -#define INTERRUPT_ADDRESS 0x00000000 -#define INTERRUPT_OFFSET 0x00000000 -#define INTERRUPT_TX_7_END_MSB 31 -#define INTERRUPT_TX_7_END_LSB 31 -#define INTERRUPT_TX_7_END_MASK 0x80000000 -#define INTERRUPT_TX_7_END_GET(x) (((x) & INTERRUPT_TX_7_END_MASK) >> INTERRUPT_TX_7_END_LSB) -#define INTERRUPT_TX_7_END_SET(x) (((x) << INTERRUPT_TX_7_END_LSB) & INTERRUPT_TX_7_END_MASK) -#define INTERRUPT_TX_6_END_MSB 30 -#define INTERRUPT_TX_6_END_LSB 30 -#define INTERRUPT_TX_6_END_MASK 0x40000000 -#define INTERRUPT_TX_6_END_GET(x) (((x) & INTERRUPT_TX_6_END_MASK) >> INTERRUPT_TX_6_END_LSB) -#define INTERRUPT_TX_6_END_SET(x) (((x) << INTERRUPT_TX_6_END_LSB) & INTERRUPT_TX_6_END_MASK) -#define INTERRUPT_TX_5_END_MSB 29 -#define INTERRUPT_TX_5_END_LSB 29 -#define INTERRUPT_TX_5_END_MASK 0x20000000 -#define INTERRUPT_TX_5_END_GET(x) (((x) & INTERRUPT_TX_5_END_MASK) >> INTERRUPT_TX_5_END_LSB) -#define INTERRUPT_TX_5_END_SET(x) (((x) << INTERRUPT_TX_5_END_LSB) & INTERRUPT_TX_5_END_MASK) -#define INTERRUPT_TX_4_END_MSB 28 -#define INTERRUPT_TX_4_END_LSB 28 -#define INTERRUPT_TX_4_END_MASK 0x10000000 -#define INTERRUPT_TX_4_END_GET(x) (((x) & INTERRUPT_TX_4_END_MASK) >> INTERRUPT_TX_4_END_LSB) -#define INTERRUPT_TX_4_END_SET(x) (((x) << INTERRUPT_TX_4_END_LSB) & INTERRUPT_TX_4_END_MASK) -#define INTERRUPT_TX_3_END_MSB 27 -#define INTERRUPT_TX_3_END_LSB 27 -#define INTERRUPT_TX_3_END_MASK 0x08000000 -#define INTERRUPT_TX_3_END_GET(x) (((x) & INTERRUPT_TX_3_END_MASK) >> INTERRUPT_TX_3_END_LSB) -#define INTERRUPT_TX_3_END_SET(x) (((x) << INTERRUPT_TX_3_END_LSB) & INTERRUPT_TX_3_END_MASK) -#define INTERRUPT_TX_2_END_MSB 26 -#define INTERRUPT_TX_2_END_LSB 26 -#define INTERRUPT_TX_2_END_MASK 0x04000000 -#define INTERRUPT_TX_2_END_GET(x) (((x) & INTERRUPT_TX_2_END_MASK) >> INTERRUPT_TX_2_END_LSB) -#define INTERRUPT_TX_2_END_SET(x) (((x) << INTERRUPT_TX_2_END_LSB) & INTERRUPT_TX_2_END_MASK) -#define INTERRUPT_TX_1_END_MSB 25 -#define INTERRUPT_TX_1_END_LSB 25 -#define INTERRUPT_TX_1_END_MASK 0x02000000 -#define INTERRUPT_TX_1_END_GET(x) (((x) & INTERRUPT_TX_1_END_MASK) >> INTERRUPT_TX_1_END_LSB) -#define INTERRUPT_TX_1_END_SET(x) (((x) << INTERRUPT_TX_1_END_LSB) & INTERRUPT_TX_1_END_MASK) -#define INTERRUPT_TX_0_END_MSB 24 -#define INTERRUPT_TX_0_END_LSB 24 -#define INTERRUPT_TX_0_END_MASK 0x01000000 -#define INTERRUPT_TX_0_END_GET(x) (((x) & INTERRUPT_TX_0_END_MASK) >> INTERRUPT_TX_0_END_LSB) -#define INTERRUPT_TX_0_END_SET(x) (((x) << INTERRUPT_TX_0_END_LSB) & INTERRUPT_TX_0_END_MASK) -#define INTERRUPT_TX_7_COMPLETE_MSB 23 -#define INTERRUPT_TX_7_COMPLETE_LSB 23 -#define INTERRUPT_TX_7_COMPLETE_MASK 0x00800000 -#define INTERRUPT_TX_7_COMPLETE_GET(x) (((x) & INTERRUPT_TX_7_COMPLETE_MASK) >> INTERRUPT_TX_7_COMPLETE_LSB) -#define INTERRUPT_TX_7_COMPLETE_SET(x) (((x) << INTERRUPT_TX_7_COMPLETE_LSB) & INTERRUPT_TX_7_COMPLETE_MASK) -#define INTERRUPT_TX_6_COMPLETE_MSB 22 -#define INTERRUPT_TX_6_COMPLETE_LSB 22 -#define INTERRUPT_TX_6_COMPLETE_MASK 0x00400000 -#define INTERRUPT_TX_6_COMPLETE_GET(x) (((x) & INTERRUPT_TX_6_COMPLETE_MASK) >> INTERRUPT_TX_6_COMPLETE_LSB) -#define INTERRUPT_TX_6_COMPLETE_SET(x) (((x) << INTERRUPT_TX_6_COMPLETE_LSB) & INTERRUPT_TX_6_COMPLETE_MASK) -#define INTERRUPT_TX_5_COMPLETE_MSB 21 -#define INTERRUPT_TX_5_COMPLETE_LSB 21 -#define INTERRUPT_TX_5_COMPLETE_MASK 0x00200000 -#define INTERRUPT_TX_5_COMPLETE_GET(x) (((x) & INTERRUPT_TX_5_COMPLETE_MASK) >> INTERRUPT_TX_5_COMPLETE_LSB) -#define INTERRUPT_TX_5_COMPLETE_SET(x) (((x) << INTERRUPT_TX_5_COMPLETE_LSB) & INTERRUPT_TX_5_COMPLETE_MASK) -#define INTERRUPT_TX_4_COMPLETE_MSB 20 -#define INTERRUPT_TX_4_COMPLETE_LSB 20 -#define INTERRUPT_TX_4_COMPLETE_MASK 0x00100000 -#define INTERRUPT_TX_4_COMPLETE_GET(x) (((x) & INTERRUPT_TX_4_COMPLETE_MASK) >> INTERRUPT_TX_4_COMPLETE_LSB) -#define INTERRUPT_TX_4_COMPLETE_SET(x) (((x) << INTERRUPT_TX_4_COMPLETE_LSB) & INTERRUPT_TX_4_COMPLETE_MASK) -#define INTERRUPT_TX_3_COMPLETE_MSB 19 -#define INTERRUPT_TX_3_COMPLETE_LSB 19 -#define INTERRUPT_TX_3_COMPLETE_MASK 0x00080000 -#define INTERRUPT_TX_3_COMPLETE_GET(x) (((x) & INTERRUPT_TX_3_COMPLETE_MASK) >> INTERRUPT_TX_3_COMPLETE_LSB) -#define INTERRUPT_TX_3_COMPLETE_SET(x) (((x) << INTERRUPT_TX_3_COMPLETE_LSB) & INTERRUPT_TX_3_COMPLETE_MASK) -#define INTERRUPT_TX_2_COMPLETE_MSB 18 -#define INTERRUPT_TX_2_COMPLETE_LSB 18 -#define INTERRUPT_TX_2_COMPLETE_MASK 0x00040000 -#define INTERRUPT_TX_2_COMPLETE_GET(x) (((x) & INTERRUPT_TX_2_COMPLETE_MASK) >> INTERRUPT_TX_2_COMPLETE_LSB) -#define INTERRUPT_TX_2_COMPLETE_SET(x) (((x) << INTERRUPT_TX_2_COMPLETE_LSB) & INTERRUPT_TX_2_COMPLETE_MASK) -#define INTERRUPT_TX_1_COMPLETE_MSB 17 -#define INTERRUPT_TX_1_COMPLETE_LSB 17 -#define INTERRUPT_TX_1_COMPLETE_MASK 0x00020000 -#define INTERRUPT_TX_1_COMPLETE_GET(x) (((x) & INTERRUPT_TX_1_COMPLETE_MASK) >> INTERRUPT_TX_1_COMPLETE_LSB) -#define INTERRUPT_TX_1_COMPLETE_SET(x) (((x) << INTERRUPT_TX_1_COMPLETE_LSB) & INTERRUPT_TX_1_COMPLETE_MASK) -#define INTERRUPT_TX_0_COMPLETE_MSB 16 -#define INTERRUPT_TX_0_COMPLETE_LSB 16 -#define INTERRUPT_TX_0_COMPLETE_MASK 0x00010000 -#define INTERRUPT_TX_0_COMPLETE_GET(x) (((x) & INTERRUPT_TX_0_COMPLETE_MASK) >> INTERRUPT_TX_0_COMPLETE_LSB) -#define INTERRUPT_TX_0_COMPLETE_SET(x) (((x) << INTERRUPT_TX_0_COMPLETE_LSB) & INTERRUPT_TX_0_COMPLETE_MASK) -#define INTERRUPT_RX_7_END_MSB 15 -#define INTERRUPT_RX_7_END_LSB 15 -#define INTERRUPT_RX_7_END_MASK 0x00008000 -#define INTERRUPT_RX_7_END_GET(x) (((x) & INTERRUPT_RX_7_END_MASK) >> INTERRUPT_RX_7_END_LSB) -#define INTERRUPT_RX_7_END_SET(x) (((x) << INTERRUPT_RX_7_END_LSB) & INTERRUPT_RX_7_END_MASK) -#define INTERRUPT_RX_6_END_MSB 14 -#define INTERRUPT_RX_6_END_LSB 14 -#define INTERRUPT_RX_6_END_MASK 0x00004000 -#define INTERRUPT_RX_6_END_GET(x) (((x) & INTERRUPT_RX_6_END_MASK) >> INTERRUPT_RX_6_END_LSB) -#define INTERRUPT_RX_6_END_SET(x) (((x) << INTERRUPT_RX_6_END_LSB) & INTERRUPT_RX_6_END_MASK) -#define INTERRUPT_RX_5_END_MSB 13 -#define INTERRUPT_RX_5_END_LSB 13 -#define INTERRUPT_RX_5_END_MASK 0x00002000 -#define INTERRUPT_RX_5_END_GET(x) (((x) & INTERRUPT_RX_5_END_MASK) >> INTERRUPT_RX_5_END_LSB) -#define INTERRUPT_RX_5_END_SET(x) (((x) << INTERRUPT_RX_5_END_LSB) & INTERRUPT_RX_5_END_MASK) -#define INTERRUPT_RX_4_END_MSB 12 -#define INTERRUPT_RX_4_END_LSB 12 -#define INTERRUPT_RX_4_END_MASK 0x00001000 -#define INTERRUPT_RX_4_END_GET(x) (((x) & INTERRUPT_RX_4_END_MASK) >> INTERRUPT_RX_4_END_LSB) -#define INTERRUPT_RX_4_END_SET(x) (((x) << INTERRUPT_RX_4_END_LSB) & INTERRUPT_RX_4_END_MASK) -#define INTERRUPT_RX_3_END_MSB 11 -#define INTERRUPT_RX_3_END_LSB 11 -#define INTERRUPT_RX_3_END_MASK 0x00000800 -#define INTERRUPT_RX_3_END_GET(x) (((x) & INTERRUPT_RX_3_END_MASK) >> INTERRUPT_RX_3_END_LSB) -#define INTERRUPT_RX_3_END_SET(x) (((x) << INTERRUPT_RX_3_END_LSB) & INTERRUPT_RX_3_END_MASK) -#define INTERRUPT_RX_2_END_MSB 10 -#define INTERRUPT_RX_2_END_LSB 10 -#define INTERRUPT_RX_2_END_MASK 0x00000400 -#define INTERRUPT_RX_2_END_GET(x) (((x) & INTERRUPT_RX_2_END_MASK) >> INTERRUPT_RX_2_END_LSB) -#define INTERRUPT_RX_2_END_SET(x) (((x) << INTERRUPT_RX_2_END_LSB) & INTERRUPT_RX_2_END_MASK) -#define INTERRUPT_RX_1_END_MSB 9 -#define INTERRUPT_RX_1_END_LSB 9 -#define INTERRUPT_RX_1_END_MASK 0x00000200 -#define INTERRUPT_RX_1_END_GET(x) (((x) & INTERRUPT_RX_1_END_MASK) >> INTERRUPT_RX_1_END_LSB) -#define INTERRUPT_RX_1_END_SET(x) (((x) << INTERRUPT_RX_1_END_LSB) & INTERRUPT_RX_1_END_MASK) -#define INTERRUPT_RX_0_END_MSB 8 -#define INTERRUPT_RX_0_END_LSB 8 -#define INTERRUPT_RX_0_END_MASK 0x00000100 -#define INTERRUPT_RX_0_END_GET(x) (((x) & INTERRUPT_RX_0_END_MASK) >> INTERRUPT_RX_0_END_LSB) -#define INTERRUPT_RX_0_END_SET(x) (((x) << INTERRUPT_RX_0_END_LSB) & INTERRUPT_RX_0_END_MASK) -#define INTERRUPT_RX_7_COMPLETE_MSB 7 -#define INTERRUPT_RX_7_COMPLETE_LSB 7 -#define INTERRUPT_RX_7_COMPLETE_MASK 0x00000080 -#define INTERRUPT_RX_7_COMPLETE_GET(x) (((x) & INTERRUPT_RX_7_COMPLETE_MASK) >> INTERRUPT_RX_7_COMPLETE_LSB) -#define INTERRUPT_RX_7_COMPLETE_SET(x) (((x) << INTERRUPT_RX_7_COMPLETE_LSB) & INTERRUPT_RX_7_COMPLETE_MASK) -#define INTERRUPT_RX_6_COMPLETE_MSB 6 -#define INTERRUPT_RX_6_COMPLETE_LSB 6 -#define INTERRUPT_RX_6_COMPLETE_MASK 0x00000040 -#define INTERRUPT_RX_6_COMPLETE_GET(x) (((x) & INTERRUPT_RX_6_COMPLETE_MASK) >> INTERRUPT_RX_6_COMPLETE_LSB) -#define INTERRUPT_RX_6_COMPLETE_SET(x) (((x) << INTERRUPT_RX_6_COMPLETE_LSB) & INTERRUPT_RX_6_COMPLETE_MASK) -#define INTERRUPT_RX_5_COMPLETE_MSB 5 -#define INTERRUPT_RX_5_COMPLETE_LSB 5 -#define INTERRUPT_RX_5_COMPLETE_MASK 0x00000020 -#define INTERRUPT_RX_5_COMPLETE_GET(x) (((x) & INTERRUPT_RX_5_COMPLETE_MASK) >> INTERRUPT_RX_5_COMPLETE_LSB) -#define INTERRUPT_RX_5_COMPLETE_SET(x) (((x) << INTERRUPT_RX_5_COMPLETE_LSB) & INTERRUPT_RX_5_COMPLETE_MASK) -#define INTERRUPT_RX_4_COMPLETE_MSB 4 -#define INTERRUPT_RX_4_COMPLETE_LSB 4 -#define INTERRUPT_RX_4_COMPLETE_MASK 0x00000010 -#define INTERRUPT_RX_4_COMPLETE_GET(x) (((x) & INTERRUPT_RX_4_COMPLETE_MASK) >> INTERRUPT_RX_4_COMPLETE_LSB) -#define INTERRUPT_RX_4_COMPLETE_SET(x) (((x) << INTERRUPT_RX_4_COMPLETE_LSB) & INTERRUPT_RX_4_COMPLETE_MASK) -#define INTERRUPT_RX_3_COMPLETE_MSB 3 -#define INTERRUPT_RX_3_COMPLETE_LSB 3 -#define INTERRUPT_RX_3_COMPLETE_MASK 0x00000008 -#define INTERRUPT_RX_3_COMPLETE_GET(x) (((x) & INTERRUPT_RX_3_COMPLETE_MASK) >> INTERRUPT_RX_3_COMPLETE_LSB) -#define INTERRUPT_RX_3_COMPLETE_SET(x) (((x) << INTERRUPT_RX_3_COMPLETE_LSB) & INTERRUPT_RX_3_COMPLETE_MASK) -#define INTERRUPT_RX_2_COMPLETE_MSB 2 -#define INTERRUPT_RX_2_COMPLETE_LSB 2 -#define INTERRUPT_RX_2_COMPLETE_MASK 0x00000004 -#define INTERRUPT_RX_2_COMPLETE_GET(x) (((x) & INTERRUPT_RX_2_COMPLETE_MASK) >> INTERRUPT_RX_2_COMPLETE_LSB) -#define INTERRUPT_RX_2_COMPLETE_SET(x) (((x) << INTERRUPT_RX_2_COMPLETE_LSB) & INTERRUPT_RX_2_COMPLETE_MASK) -#define INTERRUPT_RX_1_COMPLETE_MSB 1 -#define INTERRUPT_RX_1_COMPLETE_LSB 1 -#define INTERRUPT_RX_1_COMPLETE_MASK 0x00000002 -#define INTERRUPT_RX_1_COMPLETE_GET(x) (((x) & INTERRUPT_RX_1_COMPLETE_MASK) >> INTERRUPT_RX_1_COMPLETE_LSB) -#define INTERRUPT_RX_1_COMPLETE_SET(x) (((x) << INTERRUPT_RX_1_COMPLETE_LSB) & INTERRUPT_RX_1_COMPLETE_MASK) -#define INTERRUPT_RX_0_COMPLETE_MSB 0 -#define INTERRUPT_RX_0_COMPLETE_LSB 0 -#define INTERRUPT_RX_0_COMPLETE_MASK 0x00000001 -#define INTERRUPT_RX_0_COMPLETE_GET(x) (((x) & INTERRUPT_RX_0_COMPLETE_MASK) >> INTERRUPT_RX_0_COMPLETE_LSB) -#define INTERRUPT_RX_0_COMPLETE_SET(x) (((x) << INTERRUPT_RX_0_COMPLETE_LSB) & INTERRUPT_RX_0_COMPLETE_MASK) - -#define INTERRUPT_MASK_ADDRESS 0x00000004 -#define INTERRUPT_MASK_OFFSET 0x00000004 -#define INTERRUPT_MASK_TX_7_END_MASK_MSB 31 -#define INTERRUPT_MASK_TX_7_END_MASK_LSB 31 -#define INTERRUPT_MASK_TX_7_END_MASK_MASK 0x80000000 -#define INTERRUPT_MASK_TX_7_END_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_7_END_MASK_MASK) >> INTERRUPT_MASK_TX_7_END_MASK_LSB) -#define INTERRUPT_MASK_TX_7_END_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_7_END_MASK_LSB) & INTERRUPT_MASK_TX_7_END_MASK_MASK) -#define INTERRUPT_MASK_TX_6_END_MASK_MSB 30 -#define INTERRUPT_MASK_TX_6_END_MASK_LSB 30 -#define INTERRUPT_MASK_TX_6_END_MASK_MASK 0x40000000 -#define INTERRUPT_MASK_TX_6_END_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_6_END_MASK_MASK) >> INTERRUPT_MASK_TX_6_END_MASK_LSB) -#define INTERRUPT_MASK_TX_6_END_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_6_END_MASK_LSB) & INTERRUPT_MASK_TX_6_END_MASK_MASK) -#define INTERRUPT_MASK_TX_5_END_MASK_MSB 29 -#define INTERRUPT_MASK_TX_5_END_MASK_LSB 29 -#define INTERRUPT_MASK_TX_5_END_MASK_MASK 0x20000000 -#define INTERRUPT_MASK_TX_5_END_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_5_END_MASK_MASK) >> INTERRUPT_MASK_TX_5_END_MASK_LSB) -#define INTERRUPT_MASK_TX_5_END_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_5_END_MASK_LSB) & INTERRUPT_MASK_TX_5_END_MASK_MASK) -#define INTERRUPT_MASK_TX_4_END_MASK_MSB 28 -#define INTERRUPT_MASK_TX_4_END_MASK_LSB 28 -#define INTERRUPT_MASK_TX_4_END_MASK_MASK 0x10000000 -#define INTERRUPT_MASK_TX_4_END_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_4_END_MASK_MASK) >> INTERRUPT_MASK_TX_4_END_MASK_LSB) -#define INTERRUPT_MASK_TX_4_END_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_4_END_MASK_LSB) & INTERRUPT_MASK_TX_4_END_MASK_MASK) -#define INTERRUPT_MASK_TX_3_END_MASK_MSB 27 -#define INTERRUPT_MASK_TX_3_END_MASK_LSB 27 -#define INTERRUPT_MASK_TX_3_END_MASK_MASK 0x08000000 -#define INTERRUPT_MASK_TX_3_END_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_3_END_MASK_MASK) >> INTERRUPT_MASK_TX_3_END_MASK_LSB) -#define INTERRUPT_MASK_TX_3_END_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_3_END_MASK_LSB) & INTERRUPT_MASK_TX_3_END_MASK_MASK) -#define INTERRUPT_MASK_TX_2_END_MASK_MSB 26 -#define INTERRUPT_MASK_TX_2_END_MASK_LSB 26 -#define INTERRUPT_MASK_TX_2_END_MASK_MASK 0x04000000 -#define INTERRUPT_MASK_TX_2_END_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_2_END_MASK_MASK) >> INTERRUPT_MASK_TX_2_END_MASK_LSB) -#define INTERRUPT_MASK_TX_2_END_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_2_END_MASK_LSB) & INTERRUPT_MASK_TX_2_END_MASK_MASK) -#define INTERRUPT_MASK_TX_1_END_MASK_MSB 25 -#define INTERRUPT_MASK_TX_1_END_MASK_LSB 25 -#define INTERRUPT_MASK_TX_1_END_MASK_MASK 0x02000000 -#define INTERRUPT_MASK_TX_1_END_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_1_END_MASK_MASK) >> INTERRUPT_MASK_TX_1_END_MASK_LSB) -#define INTERRUPT_MASK_TX_1_END_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_1_END_MASK_LSB) & INTERRUPT_MASK_TX_1_END_MASK_MASK) -#define INTERRUPT_MASK_TX_0_END_MASK_MSB 24 -#define INTERRUPT_MASK_TX_0_END_MASK_LSB 24 -#define INTERRUPT_MASK_TX_0_END_MASK_MASK 0x01000000 -#define INTERRUPT_MASK_TX_0_END_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_0_END_MASK_MASK) >> INTERRUPT_MASK_TX_0_END_MASK_LSB) -#define INTERRUPT_MASK_TX_0_END_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_0_END_MASK_LSB) & INTERRUPT_MASK_TX_0_END_MASK_MASK) -#define INTERRUPT_MASK_TX_7_COMPLETE_MASK_MSB 23 -#define INTERRUPT_MASK_TX_7_COMPLETE_MASK_LSB 23 -#define INTERRUPT_MASK_TX_7_COMPLETE_MASK_MASK 0x00800000 -#define INTERRUPT_MASK_TX_7_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_7_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_TX_7_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_TX_7_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_7_COMPLETE_MASK_LSB) & INTERRUPT_MASK_TX_7_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_TX_6_COMPLETE_MASK_MSB 22 -#define INTERRUPT_MASK_TX_6_COMPLETE_MASK_LSB 22 -#define INTERRUPT_MASK_TX_6_COMPLETE_MASK_MASK 0x00400000 -#define INTERRUPT_MASK_TX_6_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_6_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_TX_6_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_TX_6_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_6_COMPLETE_MASK_LSB) & INTERRUPT_MASK_TX_6_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_TX_5_COMPLETE_MASK_MSB 21 -#define INTERRUPT_MASK_TX_5_COMPLETE_MASK_LSB 21 -#define INTERRUPT_MASK_TX_5_COMPLETE_MASK_MASK 0x00200000 -#define INTERRUPT_MASK_TX_5_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_5_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_TX_5_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_TX_5_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_5_COMPLETE_MASK_LSB) & INTERRUPT_MASK_TX_5_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_TX_4_COMPLETE_MASK_MSB 20 -#define INTERRUPT_MASK_TX_4_COMPLETE_MASK_LSB 20 -#define INTERRUPT_MASK_TX_4_COMPLETE_MASK_MASK 0x00100000 -#define INTERRUPT_MASK_TX_4_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_4_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_TX_4_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_TX_4_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_4_COMPLETE_MASK_LSB) & INTERRUPT_MASK_TX_4_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_TX_3_COMPLETE_MASK_MSB 19 -#define INTERRUPT_MASK_TX_3_COMPLETE_MASK_LSB 19 -#define INTERRUPT_MASK_TX_3_COMPLETE_MASK_MASK 0x00080000 -#define INTERRUPT_MASK_TX_3_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_3_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_TX_3_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_TX_3_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_3_COMPLETE_MASK_LSB) & INTERRUPT_MASK_TX_3_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_TX_2_COMPLETE_MASK_MSB 18 -#define INTERRUPT_MASK_TX_2_COMPLETE_MASK_LSB 18 -#define INTERRUPT_MASK_TX_2_COMPLETE_MASK_MASK 0x00040000 -#define INTERRUPT_MASK_TX_2_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_2_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_TX_2_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_TX_2_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_2_COMPLETE_MASK_LSB) & INTERRUPT_MASK_TX_2_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_TX_1_COMPLETE_MASK_MSB 17 -#define INTERRUPT_MASK_TX_1_COMPLETE_MASK_LSB 17 -#define INTERRUPT_MASK_TX_1_COMPLETE_MASK_MASK 0x00020000 -#define INTERRUPT_MASK_TX_1_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_1_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_TX_1_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_TX_1_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_1_COMPLETE_MASK_LSB) & INTERRUPT_MASK_TX_1_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_TX_0_COMPLETE_MASK_MSB 16 -#define INTERRUPT_MASK_TX_0_COMPLETE_MASK_LSB 16 -#define INTERRUPT_MASK_TX_0_COMPLETE_MASK_MASK 0x00010000 -#define INTERRUPT_MASK_TX_0_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_TX_0_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_TX_0_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_TX_0_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_TX_0_COMPLETE_MASK_LSB) & INTERRUPT_MASK_TX_0_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_RX_7_END_MASK_MSB 15 -#define INTERRUPT_MASK_RX_7_END_MASK_LSB 15 -#define INTERRUPT_MASK_RX_7_END_MASK_MASK 0x00008000 -#define INTERRUPT_MASK_RX_7_END_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_7_END_MASK_MASK) >> INTERRUPT_MASK_RX_7_END_MASK_LSB) -#define INTERRUPT_MASK_RX_7_END_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_7_END_MASK_LSB) & INTERRUPT_MASK_RX_7_END_MASK_MASK) -#define INTERRUPT_MASK_RX_6_END_MASK_MSB 14 -#define INTERRUPT_MASK_RX_6_END_MASK_LSB 14 -#define INTERRUPT_MASK_RX_6_END_MASK_MASK 0x00004000 -#define INTERRUPT_MASK_RX_6_END_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_6_END_MASK_MASK) >> INTERRUPT_MASK_RX_6_END_MASK_LSB) -#define INTERRUPT_MASK_RX_6_END_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_6_END_MASK_LSB) & INTERRUPT_MASK_RX_6_END_MASK_MASK) -#define INTERRUPT_MASK_RX_5_END_MASK_MSB 13 -#define INTERRUPT_MASK_RX_5_END_MASK_LSB 13 -#define INTERRUPT_MASK_RX_5_END_MASK_MASK 0x00002000 -#define INTERRUPT_MASK_RX_5_END_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_5_END_MASK_MASK) >> INTERRUPT_MASK_RX_5_END_MASK_LSB) -#define INTERRUPT_MASK_RX_5_END_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_5_END_MASK_LSB) & INTERRUPT_MASK_RX_5_END_MASK_MASK) -#define INTERRUPT_MASK_RX_4_END_MASK_MSB 12 -#define INTERRUPT_MASK_RX_4_END_MASK_LSB 12 -#define INTERRUPT_MASK_RX_4_END_MASK_MASK 0x00001000 -#define INTERRUPT_MASK_RX_4_END_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_4_END_MASK_MASK) >> INTERRUPT_MASK_RX_4_END_MASK_LSB) -#define INTERRUPT_MASK_RX_4_END_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_4_END_MASK_LSB) & INTERRUPT_MASK_RX_4_END_MASK_MASK) -#define INTERRUPT_MASK_RX_3_END_MASK_MSB 11 -#define INTERRUPT_MASK_RX_3_END_MASK_LSB 11 -#define INTERRUPT_MASK_RX_3_END_MASK_MASK 0x00000800 -#define INTERRUPT_MASK_RX_3_END_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_3_END_MASK_MASK) >> INTERRUPT_MASK_RX_3_END_MASK_LSB) -#define INTERRUPT_MASK_RX_3_END_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_3_END_MASK_LSB) & INTERRUPT_MASK_RX_3_END_MASK_MASK) -#define INTERRUPT_MASK_RX_2_END_MASK_MSB 10 -#define INTERRUPT_MASK_RX_2_END_MASK_LSB 10 -#define INTERRUPT_MASK_RX_2_END_MASK_MASK 0x00000400 -#define INTERRUPT_MASK_RX_2_END_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_2_END_MASK_MASK) >> INTERRUPT_MASK_RX_2_END_MASK_LSB) -#define INTERRUPT_MASK_RX_2_END_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_2_END_MASK_LSB) & INTERRUPT_MASK_RX_2_END_MASK_MASK) -#define INTERRUPT_MASK_RX_1_END_MASK_MSB 9 -#define INTERRUPT_MASK_RX_1_END_MASK_LSB 9 -#define INTERRUPT_MASK_RX_1_END_MASK_MASK 0x00000200 -#define INTERRUPT_MASK_RX_1_END_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_1_END_MASK_MASK) >> INTERRUPT_MASK_RX_1_END_MASK_LSB) -#define INTERRUPT_MASK_RX_1_END_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_1_END_MASK_LSB) & INTERRUPT_MASK_RX_1_END_MASK_MASK) -#define INTERRUPT_MASK_RX_0_END_MASK_MSB 8 -#define INTERRUPT_MASK_RX_0_END_MASK_LSB 8 -#define INTERRUPT_MASK_RX_0_END_MASK_MASK 0x00000100 -#define INTERRUPT_MASK_RX_0_END_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_0_END_MASK_MASK) >> INTERRUPT_MASK_RX_0_END_MASK_LSB) -#define INTERRUPT_MASK_RX_0_END_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_0_END_MASK_LSB) & INTERRUPT_MASK_RX_0_END_MASK_MASK) -#define INTERRUPT_MASK_RX_7_COMPLETE_MASK_MSB 7 -#define INTERRUPT_MASK_RX_7_COMPLETE_MASK_LSB 7 -#define INTERRUPT_MASK_RX_7_COMPLETE_MASK_MASK 0x00000080 -#define INTERRUPT_MASK_RX_7_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_7_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_RX_7_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_RX_7_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_7_COMPLETE_MASK_LSB) & INTERRUPT_MASK_RX_7_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_RX_6_COMPLETE_MASK_MSB 6 -#define INTERRUPT_MASK_RX_6_COMPLETE_MASK_LSB 6 -#define INTERRUPT_MASK_RX_6_COMPLETE_MASK_MASK 0x00000040 -#define INTERRUPT_MASK_RX_6_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_6_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_RX_6_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_RX_6_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_6_COMPLETE_MASK_LSB) & INTERRUPT_MASK_RX_6_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_RX_5_COMPLETE_MASK_MSB 5 -#define INTERRUPT_MASK_RX_5_COMPLETE_MASK_LSB 5 -#define INTERRUPT_MASK_RX_5_COMPLETE_MASK_MASK 0x00000020 -#define INTERRUPT_MASK_RX_5_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_5_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_RX_5_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_RX_5_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_5_COMPLETE_MASK_LSB) & INTERRUPT_MASK_RX_5_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_RX_4_COMPLETE_MASK_MSB 4 -#define INTERRUPT_MASK_RX_4_COMPLETE_MASK_LSB 4 -#define INTERRUPT_MASK_RX_4_COMPLETE_MASK_MASK 0x00000010 -#define INTERRUPT_MASK_RX_4_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_4_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_RX_4_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_RX_4_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_4_COMPLETE_MASK_LSB) & INTERRUPT_MASK_RX_4_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_RX_3_COMPLETE_MASK_MSB 3 -#define INTERRUPT_MASK_RX_3_COMPLETE_MASK_LSB 3 -#define INTERRUPT_MASK_RX_3_COMPLETE_MASK_MASK 0x00000008 -#define INTERRUPT_MASK_RX_3_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_3_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_RX_3_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_RX_3_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_3_COMPLETE_MASK_LSB) & INTERRUPT_MASK_RX_3_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_RX_2_COMPLETE_MASK_MSB 2 -#define INTERRUPT_MASK_RX_2_COMPLETE_MASK_LSB 2 -#define INTERRUPT_MASK_RX_2_COMPLETE_MASK_MASK 0x00000004 -#define INTERRUPT_MASK_RX_2_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_2_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_RX_2_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_RX_2_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_2_COMPLETE_MASK_LSB) & INTERRUPT_MASK_RX_2_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_RX_1_COMPLETE_MASK_MSB 1 -#define INTERRUPT_MASK_RX_1_COMPLETE_MASK_LSB 1 -#define INTERRUPT_MASK_RX_1_COMPLETE_MASK_MASK 0x00000002 -#define INTERRUPT_MASK_RX_1_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_1_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_RX_1_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_RX_1_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_1_COMPLETE_MASK_LSB) & INTERRUPT_MASK_RX_1_COMPLETE_MASK_MASK) -#define INTERRUPT_MASK_RX_0_COMPLETE_MASK_MSB 0 -#define INTERRUPT_MASK_RX_0_COMPLETE_MASK_LSB 0 -#define INTERRUPT_MASK_RX_0_COMPLETE_MASK_MASK 0x00000001 -#define INTERRUPT_MASK_RX_0_COMPLETE_MASK_GET(x) (((x) & INTERRUPT_MASK_RX_0_COMPLETE_MASK_MASK) >> INTERRUPT_MASK_RX_0_COMPLETE_MASK_LSB) -#define INTERRUPT_MASK_RX_0_COMPLETE_MASK_SET(x) (((x) << INTERRUPT_MASK_RX_0_COMPLETE_MASK_LSB) & INTERRUPT_MASK_RX_0_COMPLETE_MASK_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct bridge_intr_reg_reg_s { - volatile unsigned int interrupt; - volatile unsigned int interrupt_mask; -} bridge_intr_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _BRIDGE_INTR_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_intr_reg_gmac_1_1.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_intr_reg_gmac_1_1.h deleted file mode 100644 index c262d2b10535..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bridge_intr_reg_gmac_1_1.h +++ /dev/null @@ -1,83 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _BRIDGE_INTR_REG_GMAC_1_1_REG_H_ -#define _BRIDGE_INTR_REG_GMAC_1_1_REG_H_ - -#define GMAC_INTERRUPT_ADDRESS 0x00000000 -#define GMAC_INTERRUPT_OFFSET 0x00000000 -#define GMAC_INTERRUPT_TX_0_END_MSB 24 -#define GMAC_INTERRUPT_TX_0_END_LSB 24 -#define GMAC_INTERRUPT_TX_0_END_MASK 0x01000000 -#define GMAC_INTERRUPT_TX_0_END_GET(x) (((x) & GMAC_INTERRUPT_TX_0_END_MASK) >> GMAC_INTERRUPT_TX_0_END_LSB) -#define GMAC_INTERRUPT_TX_0_END_SET(x) (((x) << GMAC_INTERRUPT_TX_0_END_LSB) & GMAC_INTERRUPT_TX_0_END_MASK) -#define GMAC_INTERRUPT_TX_0_COMPLETE_MSB 16 -#define GMAC_INTERRUPT_TX_0_COMPLETE_LSB 16 -#define GMAC_INTERRUPT_TX_0_COMPLETE_MASK 0x00010000 -#define GMAC_INTERRUPT_TX_0_COMPLETE_GET(x) (((x) & GMAC_INTERRUPT_TX_0_COMPLETE_MASK) >> GMAC_INTERRUPT_TX_0_COMPLETE_LSB) -#define GMAC_INTERRUPT_TX_0_COMPLETE_SET(x) (((x) << GMAC_INTERRUPT_TX_0_COMPLETE_LSB) & GMAC_INTERRUPT_TX_0_COMPLETE_MASK) -#define GMAC_INTERRUPT_RX_0_END_MSB 8 -#define GMAC_INTERRUPT_RX_0_END_LSB 8 -#define GMAC_INTERRUPT_RX_0_END_MASK 0x00000100 -#define GMAC_INTERRUPT_RX_0_END_GET(x) (((x) & GMAC_INTERRUPT_RX_0_END_MASK) >> GMAC_INTERRUPT_RX_0_END_LSB) -#define GMAC_INTERRUPT_RX_0_END_SET(x) (((x) << GMAC_INTERRUPT_RX_0_END_LSB) & GMAC_INTERRUPT_RX_0_END_MASK) -#define GMAC_INTERRUPT_RX_0_COMPLETE_MSB 0 -#define GMAC_INTERRUPT_RX_0_COMPLETE_LSB 0 -#define GMAC_INTERRUPT_RX_0_COMPLETE_MASK 0x00000001 -#define GMAC_INTERRUPT_RX_0_COMPLETE_GET(x) (((x) & GMAC_INTERRUPT_RX_0_COMPLETE_MASK) >> GMAC_INTERRUPT_RX_0_COMPLETE_LSB) -#define GMAC_INTERRUPT_RX_0_COMPLETE_SET(x) (((x) << GMAC_INTERRUPT_RX_0_COMPLETE_LSB) & GMAC_INTERRUPT_RX_0_COMPLETE_MASK) - -#define GMAC_INTERRUPT_MASK_ADDRESS 0x00000004 -#define GMAC_INTERRUPT_MASK_OFFSET 0x00000004 -#define GMAC_INTERRUPT_MASK_TX_0_END_MASK_MSB 24 -#define GMAC_INTERRUPT_MASK_TX_0_END_MASK_LSB 24 -#define GMAC_INTERRUPT_MASK_TX_0_END_MASK_MASK 0x01000000 -#define GMAC_INTERRUPT_MASK_TX_0_END_MASK_GET(x) (((x) & GMAC_INTERRUPT_MASK_TX_0_END_MASK_MASK) >> GMAC_INTERRUPT_MASK_TX_0_END_MASK_LSB) -#define GMAC_INTERRUPT_MASK_TX_0_END_MASK_SET(x) (((x) << GMAC_INTERRUPT_MASK_TX_0_END_MASK_LSB) & GMAC_INTERRUPT_MASK_TX_0_END_MASK_MASK) -#define GMAC_INTERRUPT_MASK_TX_0_COMPLETE_MASK_MSB 16 -#define GMAC_INTERRUPT_MASK_TX_0_COMPLETE_MASK_LSB 16 -#define GMAC_INTERRUPT_MASK_TX_0_COMPLETE_MASK_MASK 0x00010000 -#define GMAC_INTERRUPT_MASK_TX_0_COMPLETE_MASK_GET(x) (((x) & GMAC_INTERRUPT_MASK_TX_0_COMPLETE_MASK_MASK) >> GMAC_INTERRUPT_MASK_TX_0_COMPLETE_MASK_LSB) -#define GMAC_INTERRUPT_MASK_TX_0_COMPLETE_MASK_SET(x) (((x) << GMAC_INTERRUPT_MASK_TX_0_COMPLETE_MASK_LSB) & GMAC_INTERRUPT_MASK_TX_0_COMPLETE_MASK_MASK) -#define GMAC_INTERRUPT_MASK_RX_0_END_MASK_MSB 8 -#define GMAC_INTERRUPT_MASK_RX_0_END_MASK_LSB 8 -#define GMAC_INTERRUPT_MASK_RX_0_END_MASK_MASK 0x00000100 -#define GMAC_INTERRUPT_MASK_RX_0_END_MASK_GET(x) (((x) & GMAC_INTERRUPT_MASK_RX_0_END_MASK_MASK) >> GMAC_INTERRUPT_MASK_RX_0_END_MASK_LSB) -#define GMAC_INTERRUPT_MASK_RX_0_END_MASK_SET(x) (((x) << GMAC_INTERRUPT_MASK_RX_0_END_MASK_LSB) & GMAC_INTERRUPT_MASK_RX_0_END_MASK_MASK) -#define GMAC_INTERRUPT_MASK_RX_0_COMPLETE_MASK_MSB 0 -#define GMAC_INTERRUPT_MASK_RX_0_COMPLETE_MASK_LSB 0 -#define GMAC_INTERRUPT_MASK_RX_0_COMPLETE_MASK_MASK 0x00000001 -#define GMAC_INTERRUPT_MASK_RX_0_COMPLETE_MASK_GET(x) (((x) & GMAC_INTERRUPT_MASK_RX_0_COMPLETE_MASK_MASK) >> GMAC_INTERRUPT_MASK_RX_0_COMPLETE_MASK_LSB) -#define GMAC_INTERRUPT_MASK_RX_0_COMPLETE_MASK_SET(x) (((x) << GMAC_INTERRUPT_MASK_RX_0_COMPLETE_MASK_LSB) & GMAC_INTERRUPT_MASK_RX_0_COMPLETE_MASK_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct bridge_intr_reg_gmac_1_1_reg_s { - volatile unsigned int gmac_interrupt; - volatile unsigned int gmac_interrupt_mask; -} bridge_intr_reg_gmac_1_1_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _BRIDGE_INTR_REG_GMAC_1_1_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bt_coex_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bt_coex_reg.h deleted file mode 100644 index 07aa14e97903..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/bt_coex_reg.h +++ /dev/null @@ -1,618 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _BT_COEX_REG_REG_H_ -#define _BT_COEX_REG_REG_H_ - - -/* macros for BTCOEXCTRL */ -#define BTCOEXCTRL_ADDRESS 0x00000000 -#define BTCOEXCTRL_OFFSET 0x00000000 -#define BTCOEXCTRL_GAP_MSB 7 -#define BTCOEXCTRL_GAP_LSB 0 -#define BTCOEXCTRL_GAP_MASK 0x000000ff -#define BTCOEXCTRL_GAP_GET(x) (((x) & 0x000000ff) >> 0) -#define BTCOEXCTRL_GAP_SET(x) (((x) << 0) & 0x000000ff) -#define BTCOEXCTRL_CLK_CNT_EN_MSB 8 -#define BTCOEXCTRL_CLK_CNT_EN_LSB 8 -#define BTCOEXCTRL_CLK_CNT_EN_MASK 0x00000100 -#define BTCOEXCTRL_CLK_CNT_EN_GET(x) (((x) & 0x00000100) >> 8) -#define BTCOEXCTRL_CLK_CNT_EN_SET(x) (((x) << 8) & 0x00000100) -#define BTCOEXCTRL_FRAME_CNT_EN_MSB 9 -#define BTCOEXCTRL_FRAME_CNT_EN_LSB 9 -#define BTCOEXCTRL_FRAME_CNT_EN_MASK 0x00000200 -#define BTCOEXCTRL_FRAME_CNT_EN_GET(x) (((x) & 0x00000200) >> 9) -#define BTCOEXCTRL_FRAME_CNT_EN_SET(x) (((x) << 9) & 0x00000200) -#define BTCOEXCTRL_IDLE_CNT_EN_MSB 10 -#define BTCOEXCTRL_IDLE_CNT_EN_LSB 10 -#define BTCOEXCTRL_IDLE_CNT_EN_MASK 0x00000400 -#define BTCOEXCTRL_IDLE_CNT_EN_GET(x) (((x) & 0x00000400) >> 10) -#define BTCOEXCTRL_IDLE_CNT_EN_SET(x) (((x) << 10) & 0x00000400) -#define BTCOEXCTRL_SYNC_DET_EN_MSB 11 -#define BTCOEXCTRL_SYNC_DET_EN_LSB 11 -#define BTCOEXCTRL_SYNC_DET_EN_MASK 0x00000800 -#define BTCOEXCTRL_SYNC_DET_EN_GET(x) (((x) & 0x00000800) >> 11) -#define BTCOEXCTRL_SYNC_DET_EN_SET(x) (((x) << 11) & 0x00000800) -#define BTCOEXCTRL_PRIORITY_TIME_MSB 17 -#define BTCOEXCTRL_PRIORITY_TIME_LSB 12 -#define BTCOEXCTRL_PRIORITY_TIME_MASK 0x0003f000 -#define BTCOEXCTRL_PRIORITY_TIME_GET(x) (((x) & 0x0003f000) >> 12) -#define BTCOEXCTRL_PRIORITY_TIME_SET(x) (((x) << 12) & 0x0003f000) -#define BTCOEXCTRL_FREQ_TIME_MSB 22 -#define BTCOEXCTRL_FREQ_TIME_LSB 18 -#define BTCOEXCTRL_FREQ_TIME_MASK 0x007c0000 -#define BTCOEXCTRL_FREQ_TIME_GET(x) (((x) & 0x007c0000) >> 18) -#define BTCOEXCTRL_FREQ_TIME_SET(x) (((x) << 18) & 0x007c0000) -#define BTCOEXCTRL_PTA_MODE_MSB 24 -#define BTCOEXCTRL_PTA_MODE_LSB 23 -#define BTCOEXCTRL_PTA_MODE_MASK 0x01800000 -#define BTCOEXCTRL_PTA_MODE_GET(x) (((x) & 0x01800000) >> 23) -#define BTCOEXCTRL_PTA_MODE_SET(x) (((x) << 23) & 0x01800000) -#define BTCOEXCTRL_WBSYNC_ON_BEACON_MSB 25 -#define BTCOEXCTRL_WBSYNC_ON_BEACON_LSB 25 -#define BTCOEXCTRL_WBSYNC_ON_BEACON_MASK 0x02000000 -#define BTCOEXCTRL_WBSYNC_ON_BEACON_GET(x) (((x) & 0x02000000) >> 25) -#define BTCOEXCTRL_WBSYNC_ON_BEACON_SET(x) (((x) << 25) & 0x02000000) -#define BTCOEXCTRL_RFGAIN_VALID_SRC_MSB 28 -#define BTCOEXCTRL_RFGAIN_VALID_SRC_LSB 28 -#define BTCOEXCTRL_RFGAIN_VALID_SRC_MASK 0x10000000 -#define BTCOEXCTRL_RFGAIN_VALID_SRC_GET(x) (((x) & 0x10000000) >> 28) -#define BTCOEXCTRL_RFGAIN_VALID_SRC_SET(x) (((x) << 28) & 0x10000000) - -/* macros for WBSYNC_PRIORITY1 */ -#define WBSYNC_PRIORITY1_ADDRESS 0x00000004 -#define WBSYNC_PRIORITY1_OFFSET 0x00000004 -#define WBSYNC_PRIORITY1_BITMAP_MSB 31 -#define WBSYNC_PRIORITY1_BITMAP_LSB 0 -#define WBSYNC_PRIORITY1_BITMAP_MASK 0xffffffff -#define WBSYNC_PRIORITY1_BITMAP_GET(x) (((x) & 0xffffffff) >> 0) -#define WBSYNC_PRIORITY1_BITMAP_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for WBSYNC_PRIORITY2 */ -#define WBSYNC_PRIORITY2_ADDRESS 0x00000008 -#define WBSYNC_PRIORITY2_OFFSET 0x00000008 -#define WBSYNC_PRIORITY2_BITMAP_MSB 31 -#define WBSYNC_PRIORITY2_BITMAP_LSB 0 -#define WBSYNC_PRIORITY2_BITMAP_MASK 0xffffffff -#define WBSYNC_PRIORITY2_BITMAP_GET(x) (((x) & 0xffffffff) >> 0) -#define WBSYNC_PRIORITY2_BITMAP_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for WBSYNC_PRIORITY3 */ -#define WBSYNC_PRIORITY3_ADDRESS 0x0000000c -#define WBSYNC_PRIORITY3_OFFSET 0x0000000c -#define WBSYNC_PRIORITY3_BITMAP_MSB 31 -#define WBSYNC_PRIORITY3_BITMAP_LSB 0 -#define WBSYNC_PRIORITY3_BITMAP_MASK 0xffffffff -#define WBSYNC_PRIORITY3_BITMAP_GET(x) (((x) & 0xffffffff) >> 0) -#define WBSYNC_PRIORITY3_BITMAP_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BTCOEX0 */ -#define BTCOEX0_ADDRESS 0x00000010 -#define BTCOEX0_OFFSET 0x00000010 -#define BTCOEX0_SYNC_DUR_MSB 7 -#define BTCOEX0_SYNC_DUR_LSB 0 -#define BTCOEX0_SYNC_DUR_MASK 0x000000ff -#define BTCOEX0_SYNC_DUR_GET(x) (((x) & 0x000000ff) >> 0) -#define BTCOEX0_SYNC_DUR_SET(x) (((x) << 0) & 0x000000ff) - -/* macros for BTCOEX1 */ -#define BTCOEX1_ADDRESS 0x00000014 -#define BTCOEX1_OFFSET 0x00000014 -#define BTCOEX1_CLK_THRES_MSB 20 -#define BTCOEX1_CLK_THRES_LSB 0 -#define BTCOEX1_CLK_THRES_MASK 0x001fffff -#define BTCOEX1_CLK_THRES_GET(x) (((x) & 0x001fffff) >> 0) -#define BTCOEX1_CLK_THRES_SET(x) (((x) << 0) & 0x001fffff) - -/* macros for BTCOEX2 */ -#define BTCOEX2_ADDRESS 0x00000018 -#define BTCOEX2_OFFSET 0x00000018 -#define BTCOEX2_FRAME_THRES_MSB 7 -#define BTCOEX2_FRAME_THRES_LSB 0 -#define BTCOEX2_FRAME_THRES_MASK 0x000000ff -#define BTCOEX2_FRAME_THRES_GET(x) (((x) & 0x000000ff) >> 0) -#define BTCOEX2_FRAME_THRES_SET(x) (((x) << 0) & 0x000000ff) - -/* macros for BTCOEX3 */ -#define BTCOEX3_ADDRESS 0x0000001c -#define BTCOEX3_OFFSET 0x0000001c -#define BTCOEX3_CLK_CNT_MSB 20 -#define BTCOEX3_CLK_CNT_LSB 0 -#define BTCOEX3_CLK_CNT_MASK 0x001fffff -#define BTCOEX3_CLK_CNT_GET(x) (((x) & 0x001fffff) >> 0) -#define BTCOEX3_CLK_CNT_SET(x) (((x) << 0) & 0x001fffff) - -/* macros for BTCOEX4 */ -#define BTCOEX4_ADDRESS 0x00000020 -#define BTCOEX4_OFFSET 0x00000020 -#define BTCOEX4_FRAME_CNT_MSB 7 -#define BTCOEX4_FRAME_CNT_LSB 0 -#define BTCOEX4_FRAME_CNT_MASK 0x000000ff -#define BTCOEX4_FRAME_CNT_GET(x) (((x) & 0x000000ff) >> 0) -#define BTCOEX4_FRAME_CNT_SET(x) (((x) << 0) & 0x000000ff) - -/* macros for BTCOEX5 */ -#define BTCOEX5_ADDRESS 0x00000024 -#define BTCOEX5_OFFSET 0x00000024 -#define BTCOEX5_IDLE_CNT_MSB 15 -#define BTCOEX5_IDLE_CNT_LSB 0 -#define BTCOEX5_IDLE_CNT_MASK 0x0000ffff -#define BTCOEX5_IDLE_CNT_GET(x) (((x) & 0x0000ffff) >> 0) -#define BTCOEX5_IDLE_CNT_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for BTCOEX6 */ -#define BTCOEX6_ADDRESS 0x00000028 -#define BTCOEX6_OFFSET 0x00000028 -#define BTCOEX6_IDLE_RESET_LVL_BITMAP_MSB 31 -#define BTCOEX6_IDLE_RESET_LVL_BITMAP_LSB 0 -#define BTCOEX6_IDLE_RESET_LVL_BITMAP_MASK 0xffffffff -#define BTCOEX6_IDLE_RESET_LVL_BITMAP_GET(x) (((x) & 0xffffffff) >> 0) -#define BTCOEX6_IDLE_RESET_LVL_BITMAP_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for LOCK */ -#define LOCK_ADDRESS 0x0000002c -#define LOCK_OFFSET 0x0000002c -#define LOCK_TUNLOCK_MASTER_MSB 7 -#define LOCK_TUNLOCK_MASTER_LSB 0 -#define LOCK_TUNLOCK_MASTER_MASK 0x000000ff -#define LOCK_TUNLOCK_MASTER_GET(x) (((x) & 0x000000ff) >> 0) -#define LOCK_TUNLOCK_MASTER_SET(x) (((x) << 0) & 0x000000ff) -#define LOCK_TLOCK_MASTER_MSB 15 -#define LOCK_TLOCK_MASTER_LSB 8 -#define LOCK_TLOCK_MASTER_MASK 0x0000ff00 -#define LOCK_TLOCK_MASTER_GET(x) (((x) & 0x0000ff00) >> 8) -#define LOCK_TLOCK_MASTER_SET(x) (((x) << 8) & 0x0000ff00) -#define LOCK_TUNLOCK_SLAVE_MSB 23 -#define LOCK_TUNLOCK_SLAVE_LSB 16 -#define LOCK_TUNLOCK_SLAVE_MASK 0x00ff0000 -#define LOCK_TUNLOCK_SLAVE_GET(x) (((x) & 0x00ff0000) >> 16) -#define LOCK_TUNLOCK_SLAVE_SET(x) (((x) << 16) & 0x00ff0000) -#define LOCK_TLOCK_SLAVE_MSB 31 -#define LOCK_TLOCK_SLAVE_LSB 24 -#define LOCK_TLOCK_SLAVE_MASK 0xff000000 -#define LOCK_TLOCK_SLAVE_GET(x) (((x) & 0xff000000) >> 24) -#define LOCK_TLOCK_SLAVE_SET(x) (((x) << 24) & 0xff000000) - -/* macros for NOLOCK_PRIORITY */ -#define NOLOCK_PRIORITY_ADDRESS 0x00000030 -#define NOLOCK_PRIORITY_OFFSET 0x00000030 -#define NOLOCK_PRIORITY_BITMAP_MSB 31 -#define NOLOCK_PRIORITY_BITMAP_LSB 0 -#define NOLOCK_PRIORITY_BITMAP_MASK 0xffffffff -#define NOLOCK_PRIORITY_BITMAP_GET(x) (((x) & 0xffffffff) >> 0) -#define NOLOCK_PRIORITY_BITMAP_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for WBSYNC */ -#define WBSYNC_ADDRESS 0x00000034 -#define WBSYNC_OFFSET 0x00000034 -#define WBSYNC_BTCLOCK_MSB 31 -#define WBSYNC_BTCLOCK_LSB 0 -#define WBSYNC_BTCLOCK_MASK 0xffffffff -#define WBSYNC_BTCLOCK_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for WBSYNC1 */ -#define WBSYNC1_ADDRESS 0x00000038 -#define WBSYNC1_OFFSET 0x00000038 -#define WBSYNC1_BTCLOCK_MSB 31 -#define WBSYNC1_BTCLOCK_LSB 0 -#define WBSYNC1_BTCLOCK_MASK 0xffffffff -#define WBSYNC1_BTCLOCK_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for WBSYNC2 */ -#define WBSYNC2_ADDRESS 0x0000003c -#define WBSYNC2_OFFSET 0x0000003c -#define WBSYNC2_BTCLOCK_MSB 31 -#define WBSYNC2_BTCLOCK_LSB 0 -#define WBSYNC2_BTCLOCK_MASK 0xffffffff -#define WBSYNC2_BTCLOCK_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for WBSYNC3 */ -#define WBSYNC3_ADDRESS 0x00000040 -#define WBSYNC3_OFFSET 0x00000040 -#define WBSYNC3_BTCLOCK_MSB 31 -#define WBSYNC3_BTCLOCK_LSB 0 -#define WBSYNC3_BTCLOCK_MASK 0xffffffff -#define WBSYNC3_BTCLOCK_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for WB_TIMER_TARGET */ -#define WB_TIMER_TARGET_ADDRESS 0x00000044 -#define WB_TIMER_TARGET_OFFSET 0x00000044 -#define WB_TIMER_TARGET_VALUE_MSB 31 -#define WB_TIMER_TARGET_VALUE_LSB 0 -#define WB_TIMER_TARGET_VALUE_MASK 0xffffffff -#define WB_TIMER_TARGET_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define WB_TIMER_TARGET_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for WB_TIMER_SLOP */ -#define WB_TIMER_SLOP_ADDRESS 0x00000048 -#define WB_TIMER_SLOP_OFFSET 0x00000048 -#define WB_TIMER_SLOP_VALUE_MSB 9 -#define WB_TIMER_SLOP_VALUE_LSB 0 -#define WB_TIMER_SLOP_VALUE_MASK 0x000003ff -#define WB_TIMER_SLOP_VALUE_GET(x) (((x) & 0x000003ff) >> 0) -#define WB_TIMER_SLOP_VALUE_SET(x) (((x) << 0) & 0x000003ff) - -/* macros for BTCOEX_INT_EN */ -#define BTCOEX_INT_EN_ADDRESS 0x0000004c -#define BTCOEX_INT_EN_OFFSET 0x0000004c -#define BTCOEX_INT_EN_CLK_CNT_MSB 0 -#define BTCOEX_INT_EN_CLK_CNT_LSB 0 -#define BTCOEX_INT_EN_CLK_CNT_MASK 0x00000001 -#define BTCOEX_INT_EN_CLK_CNT_GET(x) (((x) & 0x00000001) >> 0) -#define BTCOEX_INT_EN_CLK_CNT_SET(x) (((x) << 0) & 0x00000001) -#define BTCOEX_INT_EN_FRAME_CNT_MSB 1 -#define BTCOEX_INT_EN_FRAME_CNT_LSB 1 -#define BTCOEX_INT_EN_FRAME_CNT_MASK 0x00000002 -#define BTCOEX_INT_EN_FRAME_CNT_GET(x) (((x) & 0x00000002) >> 1) -#define BTCOEX_INT_EN_FRAME_CNT_SET(x) (((x) << 1) & 0x00000002) -#define BTCOEX_INT_EN_END_MSB 2 -#define BTCOEX_INT_EN_END_LSB 2 -#define BTCOEX_INT_EN_END_MASK 0x00000004 -#define BTCOEX_INT_EN_END_GET(x) (((x) & 0x00000004) >> 2) -#define BTCOEX_INT_EN_END_SET(x) (((x) << 2) & 0x00000004) -#define BTCOEX_INT_EN_SYNC_MSB 3 -#define BTCOEX_INT_EN_SYNC_LSB 3 -#define BTCOEX_INT_EN_SYNC_MASK 0x00000008 -#define BTCOEX_INT_EN_SYNC_GET(x) (((x) & 0x00000008) >> 3) -#define BTCOEX_INT_EN_SYNC_SET(x) (((x) << 3) & 0x00000008) -#define BTCOEX_INT_EN_NOSYNC_MSB 4 -#define BTCOEX_INT_EN_NOSYNC_LSB 4 -#define BTCOEX_INT_EN_NOSYNC_MASK 0x00000010 -#define BTCOEX_INT_EN_NOSYNC_GET(x) (((x) & 0x00000010) >> 4) -#define BTCOEX_INT_EN_NOSYNC_SET(x) (((x) << 4) & 0x00000010) -#define BTCOEX_INT_EN_WB_TIMER_MSB 7 -#define BTCOEX_INT_EN_WB_TIMER_LSB 7 -#define BTCOEX_INT_EN_WB_TIMER_MASK 0x00000080 -#define BTCOEX_INT_EN_WB_TIMER_GET(x) (((x) & 0x00000080) >> 7) -#define BTCOEX_INT_EN_WB_TIMER_SET(x) (((x) << 7) & 0x00000080) -#define BTCOEX_INT_EN_ST_MESG_RECV_MSB 8 -#define BTCOEX_INT_EN_ST_MESG_RECV_LSB 8 -#define BTCOEX_INT_EN_ST_MESG_RECV_MASK 0x00000100 -#define BTCOEX_INT_EN_ST_MESG_RECV_GET(x) (((x) & 0x00000100) >> 8) -#define BTCOEX_INT_EN_ST_MESG_RECV_SET(x) (((x) << 8) & 0x00000100) -#define BTCOEX_INT_EN_I2C_MESG_SENT_MSB 9 -#define BTCOEX_INT_EN_I2C_MESG_SENT_LSB 9 -#define BTCOEX_INT_EN_I2C_MESG_SENT_MASK 0x00000200 -#define BTCOEX_INT_EN_I2C_MESG_SENT_GET(x) (((x) & 0x00000200) >> 9) -#define BTCOEX_INT_EN_I2C_MESG_SENT_SET(x) (((x) << 9) & 0x00000200) -#define BTCOEX_INT_EN_I2C_TX_FAILED_MSB 10 -#define BTCOEX_INT_EN_I2C_TX_FAILED_LSB 10 -#define BTCOEX_INT_EN_I2C_TX_FAILED_MASK 0x00000400 -#define BTCOEX_INT_EN_I2C_TX_FAILED_GET(x) (((x) & 0x00000400) >> 10) -#define BTCOEX_INT_EN_I2C_TX_FAILED_SET(x) (((x) << 10) & 0x00000400) -#define BTCOEX_INT_EN_I2C_RECV_OVERFLOW_MSB 11 -#define BTCOEX_INT_EN_I2C_RECV_OVERFLOW_LSB 11 -#define BTCOEX_INT_EN_I2C_RECV_OVERFLOW_MASK 0x00000800 -#define BTCOEX_INT_EN_I2C_RECV_OVERFLOW_GET(x) (((x) & 0x00000800) >> 11) -#define BTCOEX_INT_EN_I2C_RECV_OVERFLOW_SET(x) (((x) << 11) & 0x00000800) - -/* macros for BTCOEX_INT_STAT */ -#define BTCOEX_INT_STAT_ADDRESS 0x00000050 -#define BTCOEX_INT_STAT_OFFSET 0x00000050 -#define BTCOEX_INT_STAT_CLK_CNT_MSB 0 -#define BTCOEX_INT_STAT_CLK_CNT_LSB 0 -#define BTCOEX_INT_STAT_CLK_CNT_MASK 0x00000001 -#define BTCOEX_INT_STAT_CLK_CNT_GET(x) (((x) & 0x00000001) >> 0) -#define BTCOEX_INT_STAT_CLK_CNT_SET(x) (((x) << 0) & 0x00000001) -#define BTCOEX_INT_STAT_FRAME_CNT_MSB 1 -#define BTCOEX_INT_STAT_FRAME_CNT_LSB 1 -#define BTCOEX_INT_STAT_FRAME_CNT_MASK 0x00000002 -#define BTCOEX_INT_STAT_FRAME_CNT_GET(x) (((x) & 0x00000002) >> 1) -#define BTCOEX_INT_STAT_FRAME_CNT_SET(x) (((x) << 1) & 0x00000002) -#define BTCOEX_INT_STAT_END_MSB 2 -#define BTCOEX_INT_STAT_END_LSB 2 -#define BTCOEX_INT_STAT_END_MASK 0x00000004 -#define BTCOEX_INT_STAT_END_GET(x) (((x) & 0x00000004) >> 2) -#define BTCOEX_INT_STAT_END_SET(x) (((x) << 2) & 0x00000004) -#define BTCOEX_INT_STAT_SYNC_MSB 3 -#define BTCOEX_INT_STAT_SYNC_LSB 3 -#define BTCOEX_INT_STAT_SYNC_MASK 0x00000008 -#define BTCOEX_INT_STAT_SYNC_GET(x) (((x) & 0x00000008) >> 3) -#define BTCOEX_INT_STAT_SYNC_SET(x) (((x) << 3) & 0x00000008) -#define BTCOEX_INT_STAT_NOSYNC_MSB 4 -#define BTCOEX_INT_STAT_NOSYNC_LSB 4 -#define BTCOEX_INT_STAT_NOSYNC_MASK 0x00000010 -#define BTCOEX_INT_STAT_NOSYNC_GET(x) (((x) & 0x00000010) >> 4) -#define BTCOEX_INT_STAT_NOSYNC_SET(x) (((x) << 4) & 0x00000010) -#define BTCOEX_INT_STAT_BTPRIORITY_MSB 5 -#define BTCOEX_INT_STAT_BTPRIORITY_LSB 5 -#define BTCOEX_INT_STAT_BTPRIORITY_MASK 0x00000020 -#define BTCOEX_INT_STAT_BTPRIORITY_GET(x) (((x) & 0x00000020) >> 5) -#define BTCOEX_INT_STAT_BTPRIORITY_STOMP_MSB 6 -#define BTCOEX_INT_STAT_BTPRIORITY_STOMP_LSB 6 -#define BTCOEX_INT_STAT_BTPRIORITY_STOMP_MASK 0x00000040 -#define BTCOEX_INT_STAT_BTPRIORITY_STOMP_GET(x) (((x) & 0x00000040) >> 6) -#define BTCOEX_INT_STAT_WB_TIMER_MSB 7 -#define BTCOEX_INT_STAT_WB_TIMER_LSB 7 -#define BTCOEX_INT_STAT_WB_TIMER_MASK 0x00000080 -#define BTCOEX_INT_STAT_WB_TIMER_GET(x) (((x) & 0x00000080) >> 7) -#define BTCOEX_INT_STAT_WB_TIMER_SET(x) (((x) << 7) & 0x00000080) -#define BTCOEX_INT_STAT_I2C_MESG_RECV_MSB 8 -#define BTCOEX_INT_STAT_I2C_MESG_RECV_LSB 8 -#define BTCOEX_INT_STAT_I2C_MESG_RECV_MASK 0x00000100 -#define BTCOEX_INT_STAT_I2C_MESG_RECV_GET(x) (((x) & 0x00000100) >> 8) -#define BTCOEX_INT_STAT_I2C_MESG_RECV_SET(x) (((x) << 8) & 0x00000100) -#define BTCOEX_INT_STAT_I2C_MESG_SENT_MSB 9 -#define BTCOEX_INT_STAT_I2C_MESG_SENT_LSB 9 -#define BTCOEX_INT_STAT_I2C_MESG_SENT_MASK 0x00000200 -#define BTCOEX_INT_STAT_I2C_MESG_SENT_GET(x) (((x) & 0x00000200) >> 9) -#define BTCOEX_INT_STAT_I2C_MESG_SENT_SET(x) (((x) << 9) & 0x00000200) -#define BTCOEX_INT_STAT_I2C_TX_FAILED_MSB 10 -#define BTCOEX_INT_STAT_I2C_TX_FAILED_LSB 10 -#define BTCOEX_INT_STAT_I2C_TX_FAILED_MASK 0x00000400 -#define BTCOEX_INT_STAT_I2C_TX_FAILED_GET(x) (((x) & 0x00000400) >> 10) -#define BTCOEX_INT_STAT_I2C_TX_FAILED_SET(x) (((x) << 10) & 0x00000400) -#define BTCOEX_INT_STAT_I2C_RECV_OVERFLOW_MSB 11 -#define BTCOEX_INT_STAT_I2C_RECV_OVERFLOW_LSB 11 -#define BTCOEX_INT_STAT_I2C_RECV_OVERFLOW_MASK 0x00000800 -#define BTCOEX_INT_STAT_I2C_RECV_OVERFLOW_GET(x) (((x) & 0x00000800) >> 11) -#define BTCOEX_INT_STAT_I2C_RECV_OVERFLOW_SET(x) (((x) << 11) & 0x00000800) - -/* macros for BTPRIORITY_INT_EN */ -#define BTPRIORITY_INT_EN_ADDRESS 0x00000054 -#define BTPRIORITY_INT_EN_OFFSET 0x00000054 -#define BTPRIORITY_INT_EN_BITMAP_MSB 31 -#define BTPRIORITY_INT_EN_BITMAP_LSB 0 -#define BTPRIORITY_INT_EN_BITMAP_MASK 0xffffffff -#define BTPRIORITY_INT_EN_BITMAP_GET(x) (((x) & 0xffffffff) >> 0) -#define BTPRIORITY_INT_EN_BITMAP_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BTPRIORITY_INT_STAT */ -#define BTPRIORITY_INT_STAT_ADDRESS 0x00000058 -#define BTPRIORITY_INT_STAT_OFFSET 0x00000058 -#define BTPRIORITY_INT_STAT_BITMAP_MSB 31 -#define BTPRIORITY_INT_STAT_BITMAP_LSB 0 -#define BTPRIORITY_INT_STAT_BITMAP_MASK 0xffffffff -#define BTPRIORITY_INT_STAT_BITMAP_GET(x) (((x) & 0xffffffff) >> 0) -#define BTPRIORITY_INT_STAT_BITMAP_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BTPRIORITY_STOMP_INT_EN */ -#define BTPRIORITY_STOMP_INT_EN_ADDRESS 0x0000005c -#define BTPRIORITY_STOMP_INT_EN_OFFSET 0x0000005c -#define BTPRIORITY_STOMP_INT_EN_BITMAP_MSB 31 -#define BTPRIORITY_STOMP_INT_EN_BITMAP_LSB 0 -#define BTPRIORITY_STOMP_INT_EN_BITMAP_MASK 0xffffffff -#define BTPRIORITY_STOMP_INT_EN_BITMAP_GET(x) (((x) & 0xffffffff) >> 0) -#define BTPRIORITY_STOMP_INT_EN_BITMAP_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BTPRIORITY_STOMP_INT_STAT */ -#define BTPRIORITY_STOMP_INT_STAT_ADDRESS 0x00000060 -#define BTPRIORITY_STOMP_INT_STAT_OFFSET 0x00000060 -#define BTPRIORITY_STOMP_INT_STAT_BITMAP_MSB 31 -#define BTPRIORITY_STOMP_INT_STAT_BITMAP_LSB 0 -#define BTPRIORITY_STOMP_INT_STAT_BITMAP_MASK 0xffffffff -#define BTPRIORITY_STOMP_INT_STAT_BITMAP_GET(x) (((x) & 0xffffffff) >> 0) -#define BTPRIORITY_STOMP_INT_STAT_BITMAP_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for ST_64_BIT */ -#define ST_64_BIT_ADDRESS 0x00000064 -#define ST_64_BIT_OFFSET 0x00000064 -#define ST_64_BIT_MODE_MSB 0 -#define ST_64_BIT_MODE_LSB 0 -#define ST_64_BIT_MODE_MASK 0x00000001 -#define ST_64_BIT_MODE_GET(x) (((x) & 0x00000001) >> 0) -#define ST_64_BIT_MODE_SET(x) (((x) << 0) & 0x00000001) -#define ST_64_BIT_SOC_CLK_DIVIDE_RATIO_MSB 5 -#define ST_64_BIT_SOC_CLK_DIVIDE_RATIO_LSB 1 -#define ST_64_BIT_SOC_CLK_DIVIDE_RATIO_MASK 0x0000003e -#define ST_64_BIT_SOC_CLK_DIVIDE_RATIO_GET(x) (((x) & 0x0000003e) >> 1) -#define ST_64_BIT_SOC_CLK_DIVIDE_RATIO_SET(x) (((x) << 1) & 0x0000003e) -#define ST_64_BIT_CLOCK_GATE_MSB 6 -#define ST_64_BIT_CLOCK_GATE_LSB 6 -#define ST_64_BIT_CLOCK_GATE_MASK 0x00000040 -#define ST_64_BIT_CLOCK_GATE_GET(x) (((x) & 0x00000040) >> 6) -#define ST_64_BIT_CLOCK_GATE_SET(x) (((x) << 6) & 0x00000040) -#define ST_64_BIT_DRIVE_MODE_MSB 7 -#define ST_64_BIT_DRIVE_MODE_LSB 7 -#define ST_64_BIT_DRIVE_MODE_MASK 0x00000080 -#define ST_64_BIT_DRIVE_MODE_GET(x) (((x) & 0x00000080) >> 7) -#define ST_64_BIT_DRIVE_MODE_SET(x) (((x) << 7) & 0x00000080) -#define ST_64_BIT_REQ_ACK_NOT_PULLED_DOWN_MSB 8 -#define ST_64_BIT_REQ_ACK_NOT_PULLED_DOWN_LSB 8 -#define ST_64_BIT_REQ_ACK_NOT_PULLED_DOWN_MASK 0x00000100 -#define ST_64_BIT_REQ_ACK_NOT_PULLED_DOWN_GET(x) (((x) & 0x00000100) >> 8) -#define ST_64_BIT_REQ_ACK_NOT_PULLED_DOWN_SET(x) (((x) << 8) & 0x00000100) -#define ST_64_BIT_TIMEOUT_MSB 26 -#define ST_64_BIT_TIMEOUT_LSB 9 -#define ST_64_BIT_TIMEOUT_MASK 0x07fffe00 -#define ST_64_BIT_TIMEOUT_GET(x) (((x) & 0x07fffe00) >> 9) -#define ST_64_BIT_TIMEOUT_SET(x) (((x) << 9) & 0x07fffe00) - -/* macros for MESSAGE_WR */ -#define MESSAGE_WR_ADDRESS 0x00000068 -#define MESSAGE_WR_OFFSET 0x00000068 -#define MESSAGE_WR_TYPE_MSB 31 -#define MESSAGE_WR_TYPE_LSB 0 -#define MESSAGE_WR_TYPE_MASK 0xffffffff -#define MESSAGE_WR_TYPE_GET(x) (((x) & 0xffffffff) >> 0) -#define MESSAGE_WR_TYPE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MESSAGE_WR_P */ -#define MESSAGE_WR_P_ADDRESS 0x0000006c -#define MESSAGE_WR_P_OFFSET 0x0000006c -#define MESSAGE_WR_P_PARAMETER_MSB 31 -#define MESSAGE_WR_P_PARAMETER_LSB 0 -#define MESSAGE_WR_P_PARAMETER_MASK 0xffffffff -#define MESSAGE_WR_P_PARAMETER_GET(x) (((x) & 0xffffffff) >> 0) -#define MESSAGE_WR_P_PARAMETER_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MESSAGE_RD */ -#define MESSAGE_RD_ADDRESS 0x00000070 -#define MESSAGE_RD_OFFSET 0x00000070 -#define MESSAGE_RD_TYPE_MSB 31 -#define MESSAGE_RD_TYPE_LSB 0 -#define MESSAGE_RD_TYPE_MASK 0xffffffff -#define MESSAGE_RD_TYPE_GET(x) (((x) & 0xffffffff) >> 0) -#define MESSAGE_RD_TYPE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MESSAGE_RD_P */ -#define MESSAGE_RD_P_ADDRESS 0x00000074 -#define MESSAGE_RD_P_OFFSET 0x00000074 -#define MESSAGE_RD_P_PARAMETER_MSB 31 -#define MESSAGE_RD_P_PARAMETER_LSB 0 -#define MESSAGE_RD_P_PARAMETER_MASK 0xffffffff -#define MESSAGE_RD_P_PARAMETER_GET(x) (((x) & 0xffffffff) >> 0) -#define MESSAGE_RD_P_PARAMETER_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BTPRIORITY_INT */ -#define BTPRIORITY_INT_ADDRESS 0x00000078 -#define BTPRIORITY_INT_OFFSET 0x00000078 -#define BTPRIORITY_INT_DELAY_MSB 7 -#define BTPRIORITY_INT_DELAY_LSB 0 -#define BTPRIORITY_INT_DELAY_MASK 0x000000ff -#define BTPRIORITY_INT_DELAY_GET(x) (((x) & 0x000000ff) >> 0) -#define BTPRIORITY_INT_DELAY_SET(x) (((x) << 0) & 0x000000ff) - -/* macros for SCO_PARAMS */ -#define SCO_PARAMS_ADDRESS 0x0000007c -#define SCO_PARAMS_OFFSET 0x0000007c -#define SCO_PARAMS_PERIOD_MSB 13 -#define SCO_PARAMS_PERIOD_LSB 0 -#define SCO_PARAMS_PERIOD_MASK 0x00003fff -#define SCO_PARAMS_PERIOD_GET(x) (((x) & 0x00003fff) >> 0) -#define SCO_PARAMS_PERIOD_SET(x) (((x) << 0) & 0x00003fff) -#define SCO_PARAMS_SLOP_MSB 23 -#define SCO_PARAMS_SLOP_LSB 14 -#define SCO_PARAMS_SLOP_MASK 0x00ffc000 -#define SCO_PARAMS_SLOP_GET(x) (((x) & 0x00ffc000) >> 14) -#define SCO_PARAMS_SLOP_SET(x) (((x) << 14) & 0x00ffc000) - -/* macros for SCO_PRIORITY */ -#define SCO_PRIORITY_ADDRESS 0x00000080 -#define SCO_PRIORITY_OFFSET 0x00000080 -#define SCO_PRIORITY_BITMAP_MSB 31 -#define SCO_PRIORITY_BITMAP_LSB 0 -#define SCO_PRIORITY_BITMAP_MASK 0xffffffff -#define SCO_PRIORITY_BITMAP_GET(x) (((x) & 0xffffffff) >> 0) -#define SCO_PRIORITY_BITMAP_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for SCO_SYNC */ -#define SCO_SYNC_ADDRESS 0x00000084 -#define SCO_SYNC_OFFSET 0x00000084 -#define SCO_SYNC_BTCLOCK_MSB 31 -#define SCO_SYNC_BTCLOCK_LSB 0 -#define SCO_SYNC_BTCLOCK_MASK 0xffffffff -#define SCO_SYNC_BTCLOCK_GET(x) (((x) & 0xffffffff) >> 0) -#define SCO_SYNC_BTCLOCK_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BTCOEX_RAW_STAT */ -#define BTCOEX_RAW_STAT_ADDRESS 0x00000088 -#define BTCOEX_RAW_STAT_OFFSET 0x00000088 -#define BTCOEX_RAW_STAT_CLK_CNT_MSB 0 -#define BTCOEX_RAW_STAT_CLK_CNT_LSB 0 -#define BTCOEX_RAW_STAT_CLK_CNT_MASK 0x00000001 -#define BTCOEX_RAW_STAT_CLK_CNT_GET(x) (((x) & 0x00000001) >> 0) -#define BTCOEX_RAW_STAT_CLK_CNT_SET(x) (((x) << 0) & 0x00000001) -#define BTCOEX_RAW_STAT_FRAME_CNT_MSB 1 -#define BTCOEX_RAW_STAT_FRAME_CNT_LSB 1 -#define BTCOEX_RAW_STAT_FRAME_CNT_MASK 0x00000002 -#define BTCOEX_RAW_STAT_FRAME_CNT_GET(x) (((x) & 0x00000002) >> 1) -#define BTCOEX_RAW_STAT_FRAME_CNT_SET(x) (((x) << 1) & 0x00000002) -#define BTCOEX_RAW_STAT_END_MSB 2 -#define BTCOEX_RAW_STAT_END_LSB 2 -#define BTCOEX_RAW_STAT_END_MASK 0x00000004 -#define BTCOEX_RAW_STAT_END_GET(x) (((x) & 0x00000004) >> 2) -#define BTCOEX_RAW_STAT_END_SET(x) (((x) << 2) & 0x00000004) -#define BTCOEX_RAW_STAT_SYNC_MSB 3 -#define BTCOEX_RAW_STAT_SYNC_LSB 3 -#define BTCOEX_RAW_STAT_SYNC_MASK 0x00000008 -#define BTCOEX_RAW_STAT_SYNC_GET(x) (((x) & 0x00000008) >> 3) -#define BTCOEX_RAW_STAT_SYNC_SET(x) (((x) << 3) & 0x00000008) -#define BTCOEX_RAW_STAT_NOSYNC_MSB 4 -#define BTCOEX_RAW_STAT_NOSYNC_LSB 4 -#define BTCOEX_RAW_STAT_NOSYNC_MASK 0x00000010 -#define BTCOEX_RAW_STAT_NOSYNC_GET(x) (((x) & 0x00000010) >> 4) -#define BTCOEX_RAW_STAT_NOSYNC_SET(x) (((x) << 4) & 0x00000010) -#define BTCOEX_RAW_STAT_WB_TIMER_MSB 7 -#define BTCOEX_RAW_STAT_WB_TIMER_LSB 7 -#define BTCOEX_RAW_STAT_WB_TIMER_MASK 0x00000080 -#define BTCOEX_RAW_STAT_WB_TIMER_GET(x) (((x) & 0x00000080) >> 7) -#define BTCOEX_RAW_STAT_WB_TIMER_SET(x) (((x) << 7) & 0x00000080) - -/* macros for BTPRIORITY_RAW_STAT */ -#define BTPRIORITY_RAW_STAT_ADDRESS 0x0000008c -#define BTPRIORITY_RAW_STAT_OFFSET 0x0000008c -#define BTPRIORITY_RAW_STAT_BITMAP_MSB 31 -#define BTPRIORITY_RAW_STAT_BITMAP_LSB 0 -#define BTPRIORITY_RAW_STAT_BITMAP_MASK 0xffffffff -#define BTPRIORITY_RAW_STAT_BITMAP_GET(x) (((x) & 0xffffffff) >> 0) -#define BTPRIORITY_RAW_STAT_BITMAP_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BTPRIORITY_STOMP_RAW_STAT */ -#define BTPRIORITY_STOMP_RAW_STAT_ADDRESS 0x00000090 -#define BTPRIORITY_STOMP_RAW_STAT_OFFSET 0x00000090 -#define BTPRIORITY_STOMP_RAW_STAT_BITMAP_MSB 31 -#define BTPRIORITY_STOMP_RAW_STAT_BITMAP_LSB 0 -#define BTPRIORITY_STOMP_RAW_STAT_BITMAP_MASK 0xffffffff -#define BTPRIORITY_STOMP_RAW_STAT_BITMAP_GET(x) (((x) & 0xffffffff) >> 0) -#define BTPRIORITY_STOMP_RAW_STAT_BITMAP_SET(x) (((x) << 0) & 0xffffffff) - - -#ifndef __ASSEMBLER__ - -typedef struct bt_coex_reg_reg_s { - volatile unsigned int BTCOEXCTRL; /* 0x0 - 0x4 */ - volatile unsigned int WBSYNC_PRIORITY1; /* 0x4 - 0x8 */ - volatile unsigned int WBSYNC_PRIORITY2; /* 0x8 - 0xc */ - volatile unsigned int WBSYNC_PRIORITY3; /* 0xc - 0x10 */ - volatile unsigned int BTCOEX0; /* 0x10 - 0x14 */ - volatile unsigned int BTCOEX1; /* 0x14 - 0x18 */ - volatile unsigned int BTCOEX2; /* 0x18 - 0x1c */ - volatile unsigned int BTCOEX3; /* 0x1c - 0x20 */ - volatile unsigned int BTCOEX4; /* 0x20 - 0x24 */ - volatile unsigned int BTCOEX5; /* 0x24 - 0x28 */ - volatile unsigned int BTCOEX6; /* 0x28 - 0x2c */ - volatile unsigned int LOCK; /* 0x2c - 0x30 */ - volatile unsigned int NOLOCK_PRIORITY; /* 0x30 - 0x34 */ - volatile unsigned int WBSYNC; /* 0x34 - 0x38 */ - volatile unsigned int WBSYNC1; /* 0x38 - 0x3c */ - volatile unsigned int WBSYNC2; /* 0x3c - 0x40 */ - volatile unsigned int WBSYNC3; /* 0x40 - 0x44 */ - volatile unsigned int WB_TIMER_TARGET; /* 0x44 - 0x48 */ - volatile unsigned int WB_TIMER_SLOP; /* 0x48 - 0x4c */ - volatile unsigned int BTCOEX_INT_EN; /* 0x4c - 0x50 */ - volatile unsigned int BTCOEX_INT_STAT; /* 0x50 - 0x54 */ - volatile unsigned int BTPRIORITY_INT_EN; /* 0x54 - 0x58 */ - volatile unsigned int BTPRIORITY_INT_STAT; /* 0x58 - 0x5c */ - volatile unsigned int BTPRIORITY_STOMP_INT_EN; /* 0x5c - 0x60 */ - volatile unsigned int BTPRIORITY_STOMP_INT_STAT; /* 0x60 - 0x64 */ - volatile unsigned int ST_64_BIT; /* 0x64 - 0x68 */ - volatile unsigned int MESSAGE_WR; /* 0x68 - 0x6c */ - volatile unsigned int MESSAGE_WR_P; /* 0x6c - 0x70 */ - volatile unsigned int MESSAGE_RD; /* 0x70 - 0x74 */ - volatile unsigned int MESSAGE_RD_P; /* 0x74 - 0x78 */ - volatile unsigned int BTPRIORITY_INT; /* 0x78 - 0x7c */ - volatile unsigned int SCO_PARAMS; /* 0x7c - 0x80 */ - volatile unsigned int SCO_PRIORITY; /* 0x80 - 0x84 */ - volatile unsigned int SCO_SYNC; /* 0x84 - 0x88 */ - volatile unsigned int BTCOEX_RAW_STAT; /* 0x88 - 0x8c */ - volatile unsigned int BTPRIORITY_RAW_STAT; /* 0x8c - 0x90 */ - volatile unsigned int BTPRIORITY_STOMP_RAW_STAT; /* 0x90 - 0x94 */ -} bt_coex_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _BT_COEX_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/chk_sum_seg_acc_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/chk_sum_seg_acc_reg.h deleted file mode 100644 index d1c44143317c..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/chk_sum_seg_acc_reg.h +++ /dev/null @@ -1,407 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _CHK_SUM_SEG_ACC_REG_REG_H_ -#define _CHK_SUM_SEG_ACC_REG_REG_H_ - - -/* macros for CHKSUM_ACC_DMATX_CONTROL0 */ -#define CHKSUM_ACC_DMATX_CONTROL0_ADDRESS 0x00000000 -#define CHKSUM_ACC_DMATX_CONTROL0_OFFSET 0x00000000 -#define CHKSUM_ACC_DMATX_CONTROL0_TXEN_MSB 0 -#define CHKSUM_ACC_DMATX_CONTROL0_TXEN_LSB 0 -#define CHKSUM_ACC_DMATX_CONTROL0_TXEN_MASK 0x00000001 -#define CHKSUM_ACC_DMATX_CONTROL0_TXEN_GET(x) (((x) & 0x00000001) >> 0) -#define CHKSUM_ACC_DMATX_CONTROL0_TXEN_SET(x) (((x) << 0) & 0x00000001) -#define CHKSUM_ACC_DMATX_CONTROL0_LITTLEENDIAN_MSB 1 -#define CHKSUM_ACC_DMATX_CONTROL0_LITTLEENDIAN_LSB 1 -#define CHKSUM_ACC_DMATX_CONTROL0_LITTLEENDIAN_MASK 0x00000002 -#define CHKSUM_ACC_DMATX_CONTROL0_LITTLEENDIAN_GET(x) (((x) & 0x00000002) >> 1) -#define CHKSUM_ACC_DMATX_CONTROL0_LITTLEENDIAN_SET(x) (((x) << 1) & 0x00000002) - -/* macros for CHKSUM_ACC_DMATX_CONTROL1 */ -#define CHKSUM_ACC_DMATX_CONTROL1_ADDRESS 0x00000004 -#define CHKSUM_ACC_DMATX_CONTROL1_OFFSET 0x00000004 -#define CHKSUM_ACC_DMATX_CONTROL1_TXEN_MSB 0 -#define CHKSUM_ACC_DMATX_CONTROL1_TXEN_LSB 0 -#define CHKSUM_ACC_DMATX_CONTROL1_TXEN_MASK 0x00000001 -#define CHKSUM_ACC_DMATX_CONTROL1_TXEN_GET(x) (((x) & 0x00000001) >> 0) -#define CHKSUM_ACC_DMATX_CONTROL1_TXEN_SET(x) (((x) << 0) & 0x00000001) -#define CHKSUM_ACC_DMATX_CONTROL1_LITTLEENDIAN_MSB 1 -#define CHKSUM_ACC_DMATX_CONTROL1_LITTLEENDIAN_LSB 1 -#define CHKSUM_ACC_DMATX_CONTROL1_LITTLEENDIAN_MASK 0x00000002 -#define CHKSUM_ACC_DMATX_CONTROL1_LITTLEENDIAN_GET(x) (((x) & 0x00000002) >> 1) -#define CHKSUM_ACC_DMATX_CONTROL1_LITTLEENDIAN_SET(x) (((x) << 1) & 0x00000002) - -/* macros for CHKSUM_ACC_DMATX_CONTROL2 */ -#define CHKSUM_ACC_DMATX_CONTROL2_ADDRESS 0x00000008 -#define CHKSUM_ACC_DMATX_CONTROL2_OFFSET 0x00000008 -#define CHKSUM_ACC_DMATX_CONTROL2_TXEN_MSB 0 -#define CHKSUM_ACC_DMATX_CONTROL2_TXEN_LSB 0 -#define CHKSUM_ACC_DMATX_CONTROL2_TXEN_MASK 0x00000001 -#define CHKSUM_ACC_DMATX_CONTROL2_TXEN_GET(x) (((x) & 0x00000001) >> 0) -#define CHKSUM_ACC_DMATX_CONTROL2_TXEN_SET(x) (((x) << 0) & 0x00000001) -#define CHKSUM_ACC_DMATX_CONTROL2_LITTLEENDIAN_MSB 1 -#define CHKSUM_ACC_DMATX_CONTROL2_LITTLEENDIAN_LSB 1 -#define CHKSUM_ACC_DMATX_CONTROL2_LITTLEENDIAN_MASK 0x00000002 -#define CHKSUM_ACC_DMATX_CONTROL2_LITTLEENDIAN_GET(x) (((x) & 0x00000002) >> 1) -#define CHKSUM_ACC_DMATX_CONTROL2_LITTLEENDIAN_SET(x) (((x) << 1) & 0x00000002) - -/* macros for CHKSUM_ACC_DMATX_CONTROL3 */ -#define CHKSUM_ACC_DMATX_CONTROL3_ADDRESS 0x0000000c -#define CHKSUM_ACC_DMATX_CONTROL3_OFFSET 0x0000000c -#define CHKSUM_ACC_DMATX_CONTROL3_TXEN_MSB 0 -#define CHKSUM_ACC_DMATX_CONTROL3_TXEN_LSB 0 -#define CHKSUM_ACC_DMATX_CONTROL3_TXEN_MASK 0x00000001 -#define CHKSUM_ACC_DMATX_CONTROL3_TXEN_GET(x) (((x) & 0x00000001) >> 0) -#define CHKSUM_ACC_DMATX_CONTROL3_TXEN_SET(x) (((x) << 0) & 0x00000001) -#define CHKSUM_ACC_DMATX_CONTROL3_LITTLEENDIAN_MSB 1 -#define CHKSUM_ACC_DMATX_CONTROL3_LITTLEENDIAN_LSB 1 -#define CHKSUM_ACC_DMATX_CONTROL3_LITTLEENDIAN_MASK 0x00000002 -#define CHKSUM_ACC_DMATX_CONTROL3_LITTLEENDIAN_GET(x) (((x) & 0x00000002) >> 1) -#define CHKSUM_ACC_DMATX_CONTROL3_LITTLEENDIAN_SET(x) (((x) << 1) & 0x00000002) - -/* macros for CHKSUM_ACC_DMATX_DESC0 */ -#define CHKSUM_ACC_DMATX_DESC0_ADDRESS 0x00000010 -#define CHKSUM_ACC_DMATX_DESC0_OFFSET 0x00000010 -#define CHKSUM_ACC_DMATX_DESC0_ADDR_MSB 31 -#define CHKSUM_ACC_DMATX_DESC0_ADDR_LSB 0 -#define CHKSUM_ACC_DMATX_DESC0_ADDR_MASK 0xffffffff -#define CHKSUM_ACC_DMATX_DESC0_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define CHKSUM_ACC_DMATX_DESC0_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for CHKSUM_ACC_DMATX_DESC1 */ -#define CHKSUM_ACC_DMATX_DESC1_ADDRESS 0x00000014 -#define CHKSUM_ACC_DMATX_DESC1_OFFSET 0x00000014 -#define CHKSUM_ACC_DMATX_DESC1_ADDR_MSB 31 -#define CHKSUM_ACC_DMATX_DESC1_ADDR_LSB 0 -#define CHKSUM_ACC_DMATX_DESC1_ADDR_MASK 0xffffffff -#define CHKSUM_ACC_DMATX_DESC1_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define CHKSUM_ACC_DMATX_DESC1_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for CHKSUM_ACC_DMATX_DESC2 */ -#define CHKSUM_ACC_DMATX_DESC2_ADDRESS 0x00000018 -#define CHKSUM_ACC_DMATX_DESC2_OFFSET 0x00000018 -#define CHKSUM_ACC_DMATX_DESC2_ADDR_MSB 31 -#define CHKSUM_ACC_DMATX_DESC2_ADDR_LSB 0 -#define CHKSUM_ACC_DMATX_DESC2_ADDR_MASK 0xffffffff -#define CHKSUM_ACC_DMATX_DESC2_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define CHKSUM_ACC_DMATX_DESC2_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for CHKSUM_ACC_DMATX_DESC3 */ -#define CHKSUM_ACC_DMATX_DESC3_ADDRESS 0x0000001c -#define CHKSUM_ACC_DMATX_DESC3_OFFSET 0x0000001c -#define CHKSUM_ACC_DMATX_DESC3_ADDR_MSB 31 -#define CHKSUM_ACC_DMATX_DESC3_ADDR_LSB 0 -#define CHKSUM_ACC_DMATX_DESC3_ADDR_MASK 0xffffffff -#define CHKSUM_ACC_DMATX_DESC3_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define CHKSUM_ACC_DMATX_DESC3_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for CHKSUM_ACC_DMATX_DESC_STATUS */ -#define CHKSUM_ACC_DMATX_DESC_STATUS_ADDRESS 0x00000020 -#define CHKSUM_ACC_DMATX_DESC_STATUS_OFFSET 0x00000020 -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN0_MSB 0 -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN0_LSB 0 -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN0_MASK 0x00000001 -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN0_GET(x) (((x) & 0x00000001) >> 0) -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN0_SET(x) (((x) << 0) & 0x00000001) -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN1_MSB 1 -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN1_LSB 1 -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN1_MASK 0x00000002 -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN1_GET(x) (((x) & 0x00000002) >> 1) -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN1_SET(x) (((x) << 1) & 0x00000002) -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN2_MSB 2 -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN2_LSB 2 -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN2_MASK 0x00000004 -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN2_GET(x) (((x) & 0x00000004) >> 2) -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN2_SET(x) (((x) << 2) & 0x00000004) -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN3_MSB 3 -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN3_LSB 3 -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN3_MASK 0x00000008 -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN3_GET(x) (((x) & 0x00000008) >> 3) -#define CHKSUM_ACC_DMATX_DESC_STATUS_UNDERRUN3_SET(x) (((x) << 3) & 0x00000008) -#define CHKSUM_ACC_DMATX_DESC_STATUS_BUSERROR_MSB 4 -#define CHKSUM_ACC_DMATX_DESC_STATUS_BUSERROR_LSB 4 -#define CHKSUM_ACC_DMATX_DESC_STATUS_BUSERROR_MASK 0x00000010 -#define CHKSUM_ACC_DMATX_DESC_STATUS_BUSERROR_GET(x) (((x) & 0x00000010) >> 4) -#define CHKSUM_ACC_DMATX_DESC_STATUS_BUSERROR_SET(x) (((x) << 4) & 0x00000010) -#define CHKSUM_ACC_DMATX_DESC_STATUS_DESC_INTR_MSB 8 -#define CHKSUM_ACC_DMATX_DESC_STATUS_DESC_INTR_LSB 5 -#define CHKSUM_ACC_DMATX_DESC_STATUS_DESC_INTR_MASK 0x000001e0 -#define CHKSUM_ACC_DMATX_DESC_STATUS_DESC_INTR_GET(x) (((x) & 0x000001e0) >> 5) -#define CHKSUM_ACC_DMATX_DESC_STATUS_DESC_INTR_SET(x) (((x) << 5) & 0x000001e0) -#define CHKSUM_ACC_DMATX_DESC_STATUS_PKTCNT0_MSB 23 -#define CHKSUM_ACC_DMATX_DESC_STATUS_PKTCNT0_LSB 16 -#define CHKSUM_ACC_DMATX_DESC_STATUS_PKTCNT0_MASK 0x00ff0000 -#define CHKSUM_ACC_DMATX_DESC_STATUS_PKTCNT0_GET(x) (((x) & 0x00ff0000) >> 16) -#define CHKSUM_ACC_DMATX_DESC_STATUS_PKTCNT0_SET(x) (((x) << 16) & 0x00ff0000) -#define CHKSUM_ACC_DMATX_DESC_STATUS_CHAIN_NUM_MSB 25 -#define CHKSUM_ACC_DMATX_DESC_STATUS_CHAIN_NUM_LSB 24 -#define CHKSUM_ACC_DMATX_DESC_STATUS_CHAIN_NUM_MASK 0x03000000 -#define CHKSUM_ACC_DMATX_DESC_STATUS_CHAIN_NUM_GET(x) (((x) & 0x03000000) >> 24) - -/* macros for CHKSUM_ACC_DMATX_ARB_CFG */ -#define CHKSUM_ACC_DMATX_ARB_CFG_ADDRESS 0x00000024 -#define CHKSUM_ACC_DMATX_ARB_CFG_OFFSET 0x00000024 -#define CHKSUM_ACC_DMATX_ARB_CFG_RRMODE_MSB 0 -#define CHKSUM_ACC_DMATX_ARB_CFG_RRMODE_LSB 0 -#define CHKSUM_ACC_DMATX_ARB_CFG_RRMODE_MASK 0x00000001 -#define CHKSUM_ACC_DMATX_ARB_CFG_RRMODE_GET(x) (((x) & 0x00000001) >> 0) -#define CHKSUM_ACC_DMATX_ARB_CFG_RRMODE_SET(x) (((x) << 0) & 0x00000001) -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT0_MSB 13 -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT0_LSB 8 -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT0_MASK 0x00003f00 -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT0_GET(x) (((x) & 0x00003f00) >> 8) -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT0_SET(x) (((x) << 8) & 0x00003f00) -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT1_MSB 19 -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT1_LSB 14 -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT1_MASK 0x000fc000 -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT1_GET(x) (((x) & 0x000fc000) >> 14) -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT1_SET(x) (((x) << 14) & 0x000fc000) -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT2_MSB 25 -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT2_LSB 20 -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT2_MASK 0x03f00000 -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT2_GET(x) (((x) & 0x03f00000) >> 20) -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT2_SET(x) (((x) << 20) & 0x03f00000) -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT3_MSB 31 -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT3_LSB 26 -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT3_MASK 0xfc000000 -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT3_GET(x) (((x) & 0xfc000000) >> 26) -#define CHKSUM_ACC_DMATX_ARB_CFG_WGT3_SET(x) (((x) << 26) & 0xfc000000) - -/* macros for CHKSUM_ACC_RR_PKTCNT01 */ -#define CHKSUM_ACC_RR_PKTCNT01_ADDRESS 0x00000028 -#define CHKSUM_ACC_RR_PKTCNT01_OFFSET 0x00000028 -#define CHKSUM_ACC_RR_PKTCNT01_PKTCNT0_MSB 8 -#define CHKSUM_ACC_RR_PKTCNT01_PKTCNT0_LSB 0 -#define CHKSUM_ACC_RR_PKTCNT01_PKTCNT0_MASK 0x000001ff -#define CHKSUM_ACC_RR_PKTCNT01_PKTCNT0_GET(x) (((x) & 0x000001ff) >> 0) -#define CHKSUM_ACC_RR_PKTCNT01_PKTCNT0_SET(x) (((x) << 0) & 0x000001ff) -#define CHKSUM_ACC_RR_PKTCNT01_PKTCNT1_MSB 24 -#define CHKSUM_ACC_RR_PKTCNT01_PKTCNT1_LSB 16 -#define CHKSUM_ACC_RR_PKTCNT01_PKTCNT1_MASK 0x01ff0000 -#define CHKSUM_ACC_RR_PKTCNT01_PKTCNT1_GET(x) (((x) & 0x01ff0000) >> 16) -#define CHKSUM_ACC_RR_PKTCNT01_PKTCNT1_SET(x) (((x) << 16) & 0x01ff0000) - -/* macros for CHKSUM_ACC_RR_PKTCNT23 */ -#define CHKSUM_ACC_RR_PKTCNT23_ADDRESS 0x0000002c -#define CHKSUM_ACC_RR_PKTCNT23_OFFSET 0x0000002c -#define CHKSUM_ACC_RR_PKTCNT23_PKTCNT2_MSB 8 -#define CHKSUM_ACC_RR_PKTCNT23_PKTCNT2_LSB 0 -#define CHKSUM_ACC_RR_PKTCNT23_PKTCNT2_MASK 0x000001ff -#define CHKSUM_ACC_RR_PKTCNT23_PKTCNT2_GET(x) (((x) & 0x000001ff) >> 0) -#define CHKSUM_ACC_RR_PKTCNT23_PKTCNT2_SET(x) (((x) << 0) & 0x000001ff) -#define CHKSUM_ACC_RR_PKTCNT23_PKTCNT3_MSB 24 -#define CHKSUM_ACC_RR_PKTCNT23_PKTCNT3_LSB 16 -#define CHKSUM_ACC_RR_PKTCNT23_PKTCNT3_MASK 0x01ff0000 -#define CHKSUM_ACC_RR_PKTCNT23_PKTCNT3_GET(x) (((x) & 0x01ff0000) >> 16) -#define CHKSUM_ACC_RR_PKTCNT23_PKTCNT3_SET(x) (((x) << 16) & 0x01ff0000) - -/* macros for CHKSUM_ACC_TXST_PKTCNT */ -#define CHKSUM_ACC_TXST_PKTCNT_ADDRESS 0x00000030 -#define CHKSUM_ACC_TXST_PKTCNT_OFFSET 0x00000030 -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT1_MSB 15 -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT1_LSB 8 -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT1_MASK 0x0000ff00 -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT1_GET(x) (((x) & 0x0000ff00) >> 8) -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT1_SET(x) (((x) << 8) & 0x0000ff00) -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT2_MSB 23 -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT2_LSB 16 -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT2_MASK 0x00ff0000 -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT2_GET(x) (((x) & 0x00ff0000) >> 16) -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT2_SET(x) (((x) << 16) & 0x00ff0000) -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT3_MSB 31 -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT3_LSB 24 -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT3_MASK 0xff000000 -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT3_GET(x) (((x) & 0xff000000) >> 24) -#define CHKSUM_ACC_TXST_PKTCNT_PKTCNT3_SET(x) (((x) << 24) & 0xff000000) - -/* macros for CHKSUM_ACC_DMARX_CONTROL */ -#define CHKSUM_ACC_DMARX_CONTROL_ADDRESS 0x00000034 -#define CHKSUM_ACC_DMARX_CONTROL_OFFSET 0x00000034 -#define CHKSUM_ACC_DMARX_CONTROL_RXEN_MSB 0 -#define CHKSUM_ACC_DMARX_CONTROL_RXEN_LSB 0 -#define CHKSUM_ACC_DMARX_CONTROL_RXEN_MASK 0x00000001 -#define CHKSUM_ACC_DMARX_CONTROL_RXEN_GET(x) (((x) & 0x00000001) >> 0) -#define CHKSUM_ACC_DMARX_CONTROL_RXEN_SET(x) (((x) << 0) & 0x00000001) -#define CHKSUM_ACC_DMARX_CONTROL_LITTLEENDIAN_MSB 1 -#define CHKSUM_ACC_DMARX_CONTROL_LITTLEENDIAN_LSB 1 -#define CHKSUM_ACC_DMARX_CONTROL_LITTLEENDIAN_MASK 0x00000002 -#define CHKSUM_ACC_DMARX_CONTROL_LITTLEENDIAN_GET(x) (((x) & 0x00000002) >> 1) -#define CHKSUM_ACC_DMARX_CONTROL_LITTLEENDIAN_SET(x) (((x) << 1) & 0x00000002) - -/* macros for CHKSUM_ACC_DMARX_DESC */ -#define CHKSUM_ACC_DMARX_DESC_ADDRESS 0x00000038 -#define CHKSUM_ACC_DMARX_DESC_OFFSET 0x00000038 -#define CHKSUM_ACC_DMARX_DESC_ADDR_MSB 31 -#define CHKSUM_ACC_DMARX_DESC_ADDR_LSB 0 -#define CHKSUM_ACC_DMARX_DESC_ADDR_MASK 0xffffffff -#define CHKSUM_ACC_DMARX_DESC_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define CHKSUM_ACC_DMARX_DESC_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for CHKSUM_ACC_DMARX_DESC_STATUS */ -#define CHKSUM_ACC_DMARX_DESC_STATUS_ADDRESS 0x0000003c -#define CHKSUM_ACC_DMARX_DESC_STATUS_OFFSET 0x0000003c -#define CHKSUM_ACC_DMARX_DESC_STATUS_OVERFLOW_MSB 0 -#define CHKSUM_ACC_DMARX_DESC_STATUS_OVERFLOW_LSB 0 -#define CHKSUM_ACC_DMARX_DESC_STATUS_OVERFLOW_MASK 0x00000001 -#define CHKSUM_ACC_DMARX_DESC_STATUS_OVERFLOW_GET(x) (((x) & 0x00000001) >> 0) -#define CHKSUM_ACC_DMARX_DESC_STATUS_OVERFLOW_SET(x) (((x) << 0) & 0x00000001) -#define CHKSUM_ACC_DMARX_DESC_STATUS_BUSERROR_MSB 1 -#define CHKSUM_ACC_DMARX_DESC_STATUS_BUSERROR_LSB 1 -#define CHKSUM_ACC_DMARX_DESC_STATUS_BUSERROR_MASK 0x00000002 -#define CHKSUM_ACC_DMARX_DESC_STATUS_BUSERROR_GET(x) (((x) & 0x00000002) >> 1) -#define CHKSUM_ACC_DMARX_DESC_STATUS_BUSERROR_SET(x) (((x) << 1) & 0x00000002) -#define CHKSUM_ACC_DMARX_DESC_STATUS_DESC_INTR_MSB 2 -#define CHKSUM_ACC_DMARX_DESC_STATUS_DESC_INTR_LSB 2 -#define CHKSUM_ACC_DMARX_DESC_STATUS_DESC_INTR_MASK 0x00000004 -#define CHKSUM_ACC_DMARX_DESC_STATUS_DESC_INTR_GET(x) (((x) & 0x00000004) >> 2) -#define CHKSUM_ACC_DMARX_DESC_STATUS_DESC_INTR_SET(x) (((x) << 2) & 0x00000004) -#define CHKSUM_ACC_DMARX_DESC_STATUS_PKTCNT_MSB 23 -#define CHKSUM_ACC_DMARX_DESC_STATUS_PKTCNT_LSB 16 -#define CHKSUM_ACC_DMARX_DESC_STATUS_PKTCNT_MASK 0x00ff0000 -#define CHKSUM_ACC_DMARX_DESC_STATUS_PKTCNT_GET(x) (((x) & 0x00ff0000) >> 16) -#define CHKSUM_ACC_DMARX_DESC_STATUS_PKTCNT_SET(x) (((x) << 16) & 0x00ff0000) - -/* macros for CHKSUM_ACC_INTR */ -#define CHKSUM_ACC_INTR_ADDRESS 0x00000040 -#define CHKSUM_ACC_INTR_OFFSET 0x00000040 -#define CHKSUM_ACC_INTR_RX_VAL_MSB 3 -#define CHKSUM_ACC_INTR_RX_VAL_LSB 0 -#define CHKSUM_ACC_INTR_RX_VAL_MASK 0x0000000f -#define CHKSUM_ACC_INTR_RX_VAL_GET(x) (((x) & 0x0000000f) >> 0) -#define CHKSUM_ACC_INTR_TX_VAL_MSB 16 -#define CHKSUM_ACC_INTR_TX_VAL_LSB 4 -#define CHKSUM_ACC_INTR_TX_VAL_MASK 0x0001fff0 -#define CHKSUM_ACC_INTR_TX_VAL_GET(x) (((x) & 0x0001fff0) >> 4) - -/* macros for CHKSUM_ACC_IMASK */ -#define CHKSUM_ACC_IMASK_ADDRESS 0x00000044 -#define CHKSUM_ACC_IMASK_OFFSET 0x00000044 -#define CHKSUM_ACC_IMASK_RX_VAL_MSB 3 -#define CHKSUM_ACC_IMASK_RX_VAL_LSB 0 -#define CHKSUM_ACC_IMASK_RX_VAL_MASK 0x0000000f -#define CHKSUM_ACC_IMASK_RX_VAL_GET(x) (((x) & 0x0000000f) >> 0) -#define CHKSUM_ACC_IMASK_RX_VAL_SET(x) (((x) << 0) & 0x0000000f) -#define CHKSUM_ACC_IMASK_TX_VAL_MSB 16 -#define CHKSUM_ACC_IMASK_TX_VAL_LSB 4 -#define CHKSUM_ACC_IMASK_TX_VAL_MASK 0x0001fff0 -#define CHKSUM_ACC_IMASK_TX_VAL_GET(x) (((x) & 0x0001fff0) >> 4) -#define CHKSUM_ACC_IMASK_TX_VAL_SET(x) (((x) << 4) & 0x0001fff0) - -/* macros for CHKSUM_ACC_ARB_BURST */ -#define CHKSUM_ACC_ARB_BURST_ADDRESS 0x00000048 -#define CHKSUM_ACC_ARB_BURST_OFFSET 0x00000048 -#define CHKSUM_ACC_ARB_BURST_MAX_TX_MSB 9 -#define CHKSUM_ACC_ARB_BURST_MAX_TX_LSB 0 -#define CHKSUM_ACC_ARB_BURST_MAX_TX_MASK 0x000003ff -#define CHKSUM_ACC_ARB_BURST_MAX_TX_GET(x) (((x) & 0x000003ff) >> 0) -#define CHKSUM_ACC_ARB_BURST_MAX_TX_SET(x) (((x) << 0) & 0x000003ff) -#define CHKSUM_ACC_ARB_BURST_INCR16_EN_MSB 10 -#define CHKSUM_ACC_ARB_BURST_INCR16_EN_LSB 10 -#define CHKSUM_ACC_ARB_BURST_INCR16_EN_MASK 0x00000400 -#define CHKSUM_ACC_ARB_BURST_INCR16_EN_GET(x) (((x) & 0x00000400) >> 10) -#define CHKSUM_ACC_ARB_BURST_INCR16_EN_SET(x) (((x) << 10) & 0x00000400) -#define CHKSUM_ACC_ARB_BURST_INCR8_EN_MSB 11 -#define CHKSUM_ACC_ARB_BURST_INCR8_EN_LSB 11 -#define CHKSUM_ACC_ARB_BURST_INCR8_EN_MASK 0x00000800 -#define CHKSUM_ACC_ARB_BURST_INCR8_EN_GET(x) (((x) & 0x00000800) >> 11) -#define CHKSUM_ACC_ARB_BURST_INCR8_EN_SET(x) (((x) << 11) & 0x00000800) -#define CHKSUM_ACC_ARB_BURST_MAX_RX_MSB 25 -#define CHKSUM_ACC_ARB_BURST_MAX_RX_LSB 16 -#define CHKSUM_ACC_ARB_BURST_MAX_RX_MASK 0x03ff0000 -#define CHKSUM_ACC_ARB_BURST_MAX_RX_GET(x) (((x) & 0x03ff0000) >> 16) -#define CHKSUM_ACC_ARB_BURST_MAX_RX_SET(x) (((x) << 16) & 0x03ff0000) - -/* macros for CHKSUM_ACC_RESET_DMA */ -#define CHKSUM_ACC_RESET_DMA_ADDRESS 0x00000050 -#define CHKSUM_ACC_RESET_DMA_OFFSET 0x00000050 -#define CHKSUM_ACC_RESET_DMA_TX_MSB 0 -#define CHKSUM_ACC_RESET_DMA_TX_LSB 0 -#define CHKSUM_ACC_RESET_DMA_TX_MASK 0x00000001 -#define CHKSUM_ACC_RESET_DMA_TX_GET(x) (((x) & 0x00000001) >> 0) -#define CHKSUM_ACC_RESET_DMA_TX_SET(x) (((x) << 0) & 0x00000001) -#define CHKSUM_ACC_RESET_DMA_RX_MSB 1 -#define CHKSUM_ACC_RESET_DMA_RX_LSB 1 -#define CHKSUM_ACC_RESET_DMA_RX_MASK 0x00000002 -#define CHKSUM_ACC_RESET_DMA_RX_GET(x) (((x) & 0x00000002) >> 1) -#define CHKSUM_ACC_RESET_DMA_RX_SET(x) (((x) << 1) & 0x00000002) - -/* macros for CHKSUM_CONFIG */ -#define CHKSUM_CONFIG_ADDRESS 0x00000054 -#define CHKSUM_CONFIG_OFFSET 0x00000054 -#define CHKSUM_CONFIG_CHKSUM_SWAP_MSB 0 -#define CHKSUM_CONFIG_CHKSUM_SWAP_LSB 0 -#define CHKSUM_CONFIG_CHKSUM_SWAP_MASK 0x00000001 -#define CHKSUM_CONFIG_CHKSUM_SWAP_GET(x) (((x) & 0x00000001) >> 0) -#define CHKSUM_CONFIG_CHKSUM_SWAP_SET(x) (((x) << 0) & 0x00000001) -#define CHKSUM_CONFIG_TXFIFO_MAX_TH_MSB 9 -#define CHKSUM_CONFIG_TXFIFO_MAX_TH_LSB 4 -#define CHKSUM_CONFIG_TXFIFO_MAX_TH_MASK 0x000003f0 -#define CHKSUM_CONFIG_TXFIFO_MAX_TH_GET(x) (((x) & 0x000003f0) >> 4) -#define CHKSUM_CONFIG_TXFIFO_MAX_TH_SET(x) (((x) << 4) & 0x000003f0) -#define CHKSUM_CONFIG_TXFIFO_MIN_TH_MSB 21 -#define CHKSUM_CONFIG_TXFIFO_MIN_TH_LSB 16 -#define CHKSUM_CONFIG_TXFIFO_MIN_TH_MASK 0x003f0000 -#define CHKSUM_CONFIG_TXFIFO_MIN_TH_GET(x) (((x) & 0x003f0000) >> 16) -#define CHKSUM_CONFIG_TXFIFO_MIN_TH_SET(x) (((x) << 16) & 0x003f0000) -#define CHKSUM_CONFIG_SPARE_MSB 31 -#define CHKSUM_CONFIG_SPARE_LSB 22 -#define CHKSUM_CONFIG_SPARE_MASK 0xffc00000 -#define CHKSUM_CONFIG_SPARE_GET(x) (((x) & 0xffc00000) >> 22) -#define CHKSUM_CONFIG_SPARE_SET(x) (((x) << 22) & 0xffc00000) - - -#ifndef __ASSEMBLER__ - -typedef struct chk_sum_seg_acc_reg_reg_s { - volatile unsigned int CHKSUM_ACC_DMATX_CONTROL0; /* 0x0 - 0x4 */ - volatile unsigned int CHKSUM_ACC_DMATX_CONTROL1; /* 0x4 - 0x8 */ - volatile unsigned int CHKSUM_ACC_DMATX_CONTROL2; /* 0x8 - 0xc */ - volatile unsigned int CHKSUM_ACC_DMATX_CONTROL3; /* 0xc - 0x10 */ - volatile unsigned int CHKSUM_ACC_DMATX_DESC0; /* 0x10 - 0x14 */ - volatile unsigned int CHKSUM_ACC_DMATX_DESC1; /* 0x14 - 0x18 */ - volatile unsigned int CHKSUM_ACC_DMATX_DESC2; /* 0x18 - 0x1c */ - volatile unsigned int CHKSUM_ACC_DMATX_DESC3; /* 0x1c - 0x20 */ - volatile unsigned int CHKSUM_ACC_DMATX_DESC_STATUS; /* 0x20 - 0x24 */ - volatile unsigned int CHKSUM_ACC_DMATX_ARB_CFG; /* 0x24 - 0x28 */ - volatile unsigned int CHKSUM_ACC_RR_PKTCNT01; /* 0x28 - 0x2c */ - volatile unsigned int CHKSUM_ACC_RR_PKTCNT23; /* 0x2c - 0x30 */ - volatile unsigned int CHKSUM_ACC_TXST_PKTCNT; /* 0x30 - 0x34 */ - volatile unsigned int CHKSUM_ACC_DMARX_CONTROL; /* 0x34 - 0x38 */ - volatile unsigned int CHKSUM_ACC_DMARX_DESC; /* 0x38 - 0x3c */ - volatile unsigned int CHKSUM_ACC_DMARX_DESC_STATUS; /* 0x3c - 0x40 */ - volatile unsigned int CHKSUM_ACC_INTR; /* 0x40 - 0x44 */ - volatile unsigned int CHKSUM_ACC_IMASK; /* 0x44 - 0x48 */ - volatile unsigned int CHKSUM_ACC_ARB_BURST; /* 0x48 - 0x4c */ - volatile char pad__0[0x4]; /* 0x4c - 0x50 */ - volatile unsigned int CHKSUM_ACC_RESET_DMA; /* 0x50 - 0x54 */ - volatile unsigned int CHKSUM_CONFIG; /* 0x54 - 0x58 */ -} chk_sum_seg_acc_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _CHK_SUM_SEG_ACC_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/efuse_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/efuse_reg.h deleted file mode 100644 index 9ee5e0d90605..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/efuse_reg.h +++ /dev/null @@ -1,44 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "efuse_wlan_reg.h" - - -#ifndef BT_HEADERS - -#define EFUSE_INTF_ADDRESS EFUSE_INTF0_ADDRESS -#define EFUSE_INTF_OFFSET EFUSE_INTF0_OFFSET -#define EFUSE_INTF_R_MSB EFUSE_INTF0_R_MSB -#define EFUSE_INTF_R_LSB EFUSE_INTF0_R_LSB -#define EFUSE_INTF_R_MASK EFUSE_INTF0_R_MASK -#define EFUSE_INTF_R_GET(x) EFUSE_INTF0_R_GET(x) -#define EFUSE_INTF_R_SET(x) EFUSE_INTF0_R_SET(x) - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/efuse_wlan_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/efuse_wlan_reg.h deleted file mode 100644 index 0575f4c9a080..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/efuse_wlan_reg.h +++ /dev/null @@ -1,153 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _EFUSE_REG_REG_H_ -#define _EFUSE_REG_REG_H_ - -#define EFUSE_WR_ENABLE_REG_ADDRESS 0x00000000 -#define EFUSE_WR_ENABLE_REG_OFFSET 0x00000000 -#define EFUSE_WR_ENABLE_REG_V_MSB 0 -#define EFUSE_WR_ENABLE_REG_V_LSB 0 -#define EFUSE_WR_ENABLE_REG_V_MASK 0x00000001 -#define EFUSE_WR_ENABLE_REG_V_GET(x) (((x) & EFUSE_WR_ENABLE_REG_V_MASK) >> EFUSE_WR_ENABLE_REG_V_LSB) -#define EFUSE_WR_ENABLE_REG_V_SET(x) (((x) << EFUSE_WR_ENABLE_REG_V_LSB) & EFUSE_WR_ENABLE_REG_V_MASK) - -#define EFUSE_INT_ENABLE_REG_ADDRESS 0x00000004 -#define EFUSE_INT_ENABLE_REG_OFFSET 0x00000004 -#define EFUSE_INT_ENABLE_REG_V_MSB 0 -#define EFUSE_INT_ENABLE_REG_V_LSB 0 -#define EFUSE_INT_ENABLE_REG_V_MASK 0x00000001 -#define EFUSE_INT_ENABLE_REG_V_GET(x) (((x) & EFUSE_INT_ENABLE_REG_V_MASK) >> EFUSE_INT_ENABLE_REG_V_LSB) -#define EFUSE_INT_ENABLE_REG_V_SET(x) (((x) << EFUSE_INT_ENABLE_REG_V_LSB) & EFUSE_INT_ENABLE_REG_V_MASK) - -#define EFUSE_INT_STATUS_REG_ADDRESS 0x00000008 -#define EFUSE_INT_STATUS_REG_OFFSET 0x00000008 -#define EFUSE_INT_STATUS_REG_V_MSB 0 -#define EFUSE_INT_STATUS_REG_V_LSB 0 -#define EFUSE_INT_STATUS_REG_V_MASK 0x00000001 -#define EFUSE_INT_STATUS_REG_V_GET(x) (((x) & EFUSE_INT_STATUS_REG_V_MASK) >> EFUSE_INT_STATUS_REG_V_LSB) -#define EFUSE_INT_STATUS_REG_V_SET(x) (((x) << EFUSE_INT_STATUS_REG_V_LSB) & EFUSE_INT_STATUS_REG_V_MASK) - -#define BITMASK_WR_REG_ADDRESS 0x0000000c -#define BITMASK_WR_REG_OFFSET 0x0000000c -#define BITMASK_WR_REG_V_MSB 31 -#define BITMASK_WR_REG_V_LSB 0 -#define BITMASK_WR_REG_V_MASK 0xffffffff -#define BITMASK_WR_REG_V_GET(x) (((x) & BITMASK_WR_REG_V_MASK) >> BITMASK_WR_REG_V_LSB) -#define BITMASK_WR_REG_V_SET(x) (((x) << BITMASK_WR_REG_V_LSB) & BITMASK_WR_REG_V_MASK) - -#define VDDQ_SETTLE_TIME_REG_ADDRESS 0x00000010 -#define VDDQ_SETTLE_TIME_REG_OFFSET 0x00000010 -#define VDDQ_SETTLE_TIME_REG_V_MSB 31 -#define VDDQ_SETTLE_TIME_REG_V_LSB 0 -#define VDDQ_SETTLE_TIME_REG_V_MASK 0xffffffff -#define VDDQ_SETTLE_TIME_REG_V_GET(x) (((x) & VDDQ_SETTLE_TIME_REG_V_MASK) >> VDDQ_SETTLE_TIME_REG_V_LSB) -#define VDDQ_SETTLE_TIME_REG_V_SET(x) (((x) << VDDQ_SETTLE_TIME_REG_V_LSB) & VDDQ_SETTLE_TIME_REG_V_MASK) - -#define VDDQ_HOLD_TIME_REG_ADDRESS 0x00000014 -#define VDDQ_HOLD_TIME_REG_OFFSET 0x00000014 -#define VDDQ_HOLD_TIME_REG_V_MSB 31 -#define VDDQ_HOLD_TIME_REG_V_LSB 0 -#define VDDQ_HOLD_TIME_REG_V_MASK 0xffffffff -#define VDDQ_HOLD_TIME_REG_V_GET(x) (((x) & VDDQ_HOLD_TIME_REG_V_MASK) >> VDDQ_HOLD_TIME_REG_V_LSB) -#define VDDQ_HOLD_TIME_REG_V_SET(x) (((x) << VDDQ_HOLD_TIME_REG_V_LSB) & VDDQ_HOLD_TIME_REG_V_MASK) - -#define RD_STROBE_PW_REG_ADDRESS 0x00000018 -#define RD_STROBE_PW_REG_OFFSET 0x00000018 -#define RD_STROBE_PW_REG_V_MSB 31 -#define RD_STROBE_PW_REG_V_LSB 0 -#define RD_STROBE_PW_REG_V_MASK 0xffffffff -#define RD_STROBE_PW_REG_V_GET(x) (((x) & RD_STROBE_PW_REG_V_MASK) >> RD_STROBE_PW_REG_V_LSB) -#define RD_STROBE_PW_REG_V_SET(x) (((x) << RD_STROBE_PW_REG_V_LSB) & RD_STROBE_PW_REG_V_MASK) - -#define PG_STROBE_PW_REG_ADDRESS 0x0000001c -#define PG_STROBE_PW_REG_OFFSET 0x0000001c -#define PG_STROBE_PW_REG_V_MSB 31 -#define PG_STROBE_PW_REG_V_LSB 0 -#define PG_STROBE_PW_REG_V_MASK 0xffffffff -#define PG_STROBE_PW_REG_V_GET(x) (((x) & PG_STROBE_PW_REG_V_MASK) >> PG_STROBE_PW_REG_V_LSB) -#define PG_STROBE_PW_REG_V_SET(x) (((x) << PG_STROBE_PW_REG_V_LSB) & PG_STROBE_PW_REG_V_MASK) - -#define PGENB_SETUP_HOLD_TIME_REG_ADDRESS 0x00000020 -#define PGENB_SETUP_HOLD_TIME_REG_OFFSET 0x00000020 -#define PGENB_SETUP_HOLD_TIME_REG_V_MSB 31 -#define PGENB_SETUP_HOLD_TIME_REG_V_LSB 0 -#define PGENB_SETUP_HOLD_TIME_REG_V_MASK 0xffffffff -#define PGENB_SETUP_HOLD_TIME_REG_V_GET(x) (((x) & PGENB_SETUP_HOLD_TIME_REG_V_MASK) >> PGENB_SETUP_HOLD_TIME_REG_V_LSB) -#define PGENB_SETUP_HOLD_TIME_REG_V_SET(x) (((x) << PGENB_SETUP_HOLD_TIME_REG_V_LSB) & PGENB_SETUP_HOLD_TIME_REG_V_MASK) - -#define STROBE_PULSE_INTERVAL_REG_ADDRESS 0x00000024 -#define STROBE_PULSE_INTERVAL_REG_OFFSET 0x00000024 -#define STROBE_PULSE_INTERVAL_REG_V_MSB 31 -#define STROBE_PULSE_INTERVAL_REG_V_LSB 0 -#define STROBE_PULSE_INTERVAL_REG_V_MASK 0xffffffff -#define STROBE_PULSE_INTERVAL_REG_V_GET(x) (((x) & STROBE_PULSE_INTERVAL_REG_V_MASK) >> STROBE_PULSE_INTERVAL_REG_V_LSB) -#define STROBE_PULSE_INTERVAL_REG_V_SET(x) (((x) << STROBE_PULSE_INTERVAL_REG_V_LSB) & STROBE_PULSE_INTERVAL_REG_V_MASK) - -#define CSB_ADDR_LOAD_SETUP_HOLD_REG_ADDRESS 0x00000028 -#define CSB_ADDR_LOAD_SETUP_HOLD_REG_OFFSET 0x00000028 -#define CSB_ADDR_LOAD_SETUP_HOLD_REG_V_MSB 31 -#define CSB_ADDR_LOAD_SETUP_HOLD_REG_V_LSB 0 -#define CSB_ADDR_LOAD_SETUP_HOLD_REG_V_MASK 0xffffffff -#define CSB_ADDR_LOAD_SETUP_HOLD_REG_V_GET(x) (((x) & CSB_ADDR_LOAD_SETUP_HOLD_REG_V_MASK) >> CSB_ADDR_LOAD_SETUP_HOLD_REG_V_LSB) -#define CSB_ADDR_LOAD_SETUP_HOLD_REG_V_SET(x) (((x) << CSB_ADDR_LOAD_SETUP_HOLD_REG_V_LSB) & CSB_ADDR_LOAD_SETUP_HOLD_REG_V_MASK) - -#define EFUSE_INTF0_ADDRESS 0x00000800 -#define EFUSE_INTF0_OFFSET 0x00000800 -#define EFUSE_INTF0_R_MSB 31 -#define EFUSE_INTF0_R_LSB 0 -#define EFUSE_INTF0_R_MASK 0xffffffff -#define EFUSE_INTF0_R_GET(x) (((x) & EFUSE_INTF0_R_MASK) >> EFUSE_INTF0_R_LSB) -#define EFUSE_INTF0_R_SET(x) (((x) << EFUSE_INTF0_R_LSB) & EFUSE_INTF0_R_MASK) - -#define EFUSE_INTF1_ADDRESS 0x00001000 -#define EFUSE_INTF1_OFFSET 0x00001000 -#define EFUSE_INTF1_R_MSB 31 -#define EFUSE_INTF1_R_LSB 0 -#define EFUSE_INTF1_R_MASK 0xffffffff -#define EFUSE_INTF1_R_GET(x) (((x) & EFUSE_INTF1_R_MASK) >> EFUSE_INTF1_R_LSB) -#define EFUSE_INTF1_R_SET(x) (((x) << EFUSE_INTF1_R_LSB) & EFUSE_INTF1_R_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct efuse_reg_reg_s { - volatile unsigned int efuse_wr_enable_reg; - volatile unsigned int efuse_int_enable_reg; - volatile unsigned int efuse_int_status_reg; - volatile unsigned int bitmask_wr_reg; - volatile unsigned int vddq_settle_time_reg; - volatile unsigned int vddq_hold_time_reg; - volatile unsigned int rd_strobe_pw_reg; - volatile unsigned int pg_strobe_pw_reg; - volatile unsigned int pgenb_setup_hold_time_reg; - volatile unsigned int strobe_pulse_interval_reg; - volatile unsigned int csb_addr_load_setup_hold_reg; - unsigned char pad0[2004]; /* pad to 0x800 */ - volatile unsigned int efuse_intf0[512]; - volatile unsigned int efuse_intf1[512]; -} efuse_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _EFUSE_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/fpga_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/fpga_reg.h deleted file mode 100644 index efb8f4afc1b8..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/fpga_reg.h +++ /dev/null @@ -1,137 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _FPGA_REG_REG_H_ -#define _FPGA_REG_REG_H_ - -#define FPGA_REG1_ADDRESS 0x00000000 -#define FPGA_REG1_OFFSET 0x00000000 -#define FPGA_REG1_FPGA_SRIF_DELAY_MSB 31 -#define FPGA_REG1_FPGA_SRIF_DELAY_LSB 31 -#define FPGA_REG1_FPGA_SRIF_DELAY_MASK 0x80000000 -#define FPGA_REG1_FPGA_SRIF_DELAY_GET(x) (((x) & FPGA_REG1_FPGA_SRIF_DELAY_MASK) >> FPGA_REG1_FPGA_SRIF_DELAY_LSB) -#define FPGA_REG1_FPGA_SRIF_DELAY_SET(x) (((x) << FPGA_REG1_FPGA_SRIF_DELAY_LSB) & FPGA_REG1_FPGA_SRIF_DELAY_MASK) -#define FPGA_REG1_SPARE_FPGA_REG1_MSB 30 -#define FPGA_REG1_SPARE_FPGA_REG1_LSB 21 -#define FPGA_REG1_SPARE_FPGA_REG1_MASK 0x7fe00000 -#define FPGA_REG1_SPARE_FPGA_REG1_GET(x) (((x) & FPGA_REG1_SPARE_FPGA_REG1_MASK) >> FPGA_REG1_SPARE_FPGA_REG1_LSB) -#define FPGA_REG1_SPARE_FPGA_REG1_SET(x) (((x) << FPGA_REG1_SPARE_FPGA_REG1_LSB) & FPGA_REG1_SPARE_FPGA_REG1_MASK) -#define FPGA_REG1_LONG_SHIFT_SAMPLE_PHASE_MSB 20 -#define FPGA_REG1_LONG_SHIFT_SAMPLE_PHASE_LSB 16 -#define FPGA_REG1_LONG_SHIFT_SAMPLE_PHASE_MASK 0x001f0000 -#define FPGA_REG1_LONG_SHIFT_SAMPLE_PHASE_GET(x) (((x) & FPGA_REG1_LONG_SHIFT_SAMPLE_PHASE_MASK) >> FPGA_REG1_LONG_SHIFT_SAMPLE_PHASE_LSB) -#define FPGA_REG1_LONG_SHIFT_SAMPLE_PHASE_SET(x) (((x) << FPGA_REG1_LONG_SHIFT_SAMPLE_PHASE_LSB) & FPGA_REG1_LONG_SHIFT_SAMPLE_PHASE_MASK) -#define FPGA_REG1_LONG_SHIFT_DRIVE_PHASE_MSB 15 -#define FPGA_REG1_LONG_SHIFT_DRIVE_PHASE_LSB 11 -#define FPGA_REG1_LONG_SHIFT_DRIVE_PHASE_MASK 0x0000f800 -#define FPGA_REG1_LONG_SHIFT_DRIVE_PHASE_GET(x) (((x) & FPGA_REG1_LONG_SHIFT_DRIVE_PHASE_MASK) >> FPGA_REG1_LONG_SHIFT_DRIVE_PHASE_LSB) -#define FPGA_REG1_LONG_SHIFT_DRIVE_PHASE_SET(x) (((x) << FPGA_REG1_LONG_SHIFT_DRIVE_PHASE_LSB) & FPGA_REG1_LONG_SHIFT_DRIVE_PHASE_MASK) -#define FPGA_REG1_ENABLE_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_MSB 10 -#define FPGA_REG1_ENABLE_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_LSB 10 -#define FPGA_REG1_ENABLE_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_MASK 0x00000400 -#define FPGA_REG1_ENABLE_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_GET(x) (((x) & FPGA_REG1_ENABLE_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_MASK) >> FPGA_REG1_ENABLE_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_LSB) -#define FPGA_REG1_ENABLE_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_SET(x) (((x) << FPGA_REG1_ENABLE_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_LSB) & FPGA_REG1_ENABLE_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_MASK) -#define FPGA_REG1_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_MSB 9 -#define FPGA_REG1_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_LSB 8 -#define FPGA_REG1_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_MASK 0x00000300 -#define FPGA_REG1_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_GET(x) (((x) & FPGA_REG1_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_MASK) >> FPGA_REG1_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_LSB) -#define FPGA_REG1_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_SET(x) (((x) << FPGA_REG1_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_LSB) & FPGA_REG1_LONG_SHIFT_CHAIN_OVERRIDE_INDEX_MASK) -#define FPGA_REG1_EMUL_RADIO_CLOCK_RATIO_MSB 7 -#define FPGA_REG1_EMUL_RADIO_CLOCK_RATIO_LSB 4 -#define FPGA_REG1_EMUL_RADIO_CLOCK_RATIO_MASK 0x000000f0 -#define FPGA_REG1_EMUL_RADIO_CLOCK_RATIO_GET(x) (((x) & FPGA_REG1_EMUL_RADIO_CLOCK_RATIO_MASK) >> FPGA_REG1_EMUL_RADIO_CLOCK_RATIO_LSB) -#define FPGA_REG1_EMUL_RADIO_CLOCK_RATIO_SET(x) (((x) << FPGA_REG1_EMUL_RADIO_CLOCK_RATIO_LSB) & FPGA_REG1_EMUL_RADIO_CLOCK_RATIO_MASK) -#define FPGA_REG1_DCM_RELEASE_MSB 2 -#define FPGA_REG1_DCM_RELEASE_LSB 2 -#define FPGA_REG1_DCM_RELEASE_MASK 0x00000004 -#define FPGA_REG1_DCM_RELEASE_GET(x) (((x) & FPGA_REG1_DCM_RELEASE_MASK) >> FPGA_REG1_DCM_RELEASE_LSB) -#define FPGA_REG1_DCM_RELEASE_SET(x) (((x) << FPGA_REG1_DCM_RELEASE_LSB) & FPGA_REG1_DCM_RELEASE_MASK) - -#define FPGA_REG2_ADDRESS 0x00000004 -#define FPGA_REG2_OFFSET 0x00000004 -#define FPGA_REG2_FPGA_SPARE_MSB 31 -#define FPGA_REG2_FPGA_SPARE_LSB 14 -#define FPGA_REG2_FPGA_SPARE_MASK 0xffffc000 -#define FPGA_REG2_FPGA_SPARE_GET(x) (((x) & FPGA_REG2_FPGA_SPARE_MASK) >> FPGA_REG2_FPGA_SPARE_LSB) -#define FPGA_REG2_FPGA_SPARE_SET(x) (((x) << FPGA_REG2_FPGA_SPARE_LSB) & FPGA_REG2_FPGA_SPARE_MASK) -#define FPGA_REG2_FPGA_LOOPBACK_I2C_MSB 13 -#define FPGA_REG2_FPGA_LOOPBACK_I2C_LSB 13 -#define FPGA_REG2_FPGA_LOOPBACK_I2C_MASK 0x00002000 -#define FPGA_REG2_FPGA_LOOPBACK_I2C_GET(x) (((x) & FPGA_REG2_FPGA_LOOPBACK_I2C_MASK) >> FPGA_REG2_FPGA_LOOPBACK_I2C_LSB) -#define FPGA_REG2_FPGA_LOOPBACK_I2C_SET(x) (((x) << FPGA_REG2_FPGA_LOOPBACK_I2C_LSB) & FPGA_REG2_FPGA_LOOPBACK_I2C_MASK) -#define FPGA_REG2_FPGA_OWL_PLL_ENABLED_MSB 12 -#define FPGA_REG2_FPGA_OWL_PLL_ENABLED_LSB 12 -#define FPGA_REG2_FPGA_OWL_PLL_ENABLED_MASK 0x00001000 -#define FPGA_REG2_FPGA_OWL_PLL_ENABLED_GET(x) (((x) & FPGA_REG2_FPGA_OWL_PLL_ENABLED_MASK) >> FPGA_REG2_FPGA_OWL_PLL_ENABLED_LSB) -#define FPGA_REG2_FPGA_OWL_PLL_ENABLED_SET(x) (((x) << FPGA_REG2_FPGA_OWL_PLL_ENABLED_LSB) & FPGA_REG2_FPGA_OWL_PLL_ENABLED_MASK) -#define FPGA_REG2_FPGA_IP_REVISION_MSB 11 -#define FPGA_REG2_FPGA_IP_REVISION_LSB 8 -#define FPGA_REG2_FPGA_IP_REVISION_MASK 0x00000f00 -#define FPGA_REG2_FPGA_IP_REVISION_GET(x) (((x) & FPGA_REG2_FPGA_IP_REVISION_MASK) >> FPGA_REG2_FPGA_IP_REVISION_LSB) -#define FPGA_REG2_FPGA_IP_REVISION_SET(x) (((x) << FPGA_REG2_FPGA_IP_REVISION_LSB) & FPGA_REG2_FPGA_IP_REVISION_MASK) -#define FPGA_REG2_FPGA_IP_RELEASE_VERSION_MSB 7 -#define FPGA_REG2_FPGA_IP_RELEASE_VERSION_LSB 4 -#define FPGA_REG2_FPGA_IP_RELEASE_VERSION_MASK 0x000000f0 -#define FPGA_REG2_FPGA_IP_RELEASE_VERSION_GET(x) (((x) & FPGA_REG2_FPGA_IP_RELEASE_VERSION_MASK) >> FPGA_REG2_FPGA_IP_RELEASE_VERSION_LSB) -#define FPGA_REG2_FPGA_IP_RELEASE_VERSION_SET(x) (((x) << FPGA_REG2_FPGA_IP_RELEASE_VERSION_LSB) & FPGA_REG2_FPGA_IP_RELEASE_VERSION_MASK) -#define FPGA_REG2_FPGA_PLATFORM_TYPE_MSB 3 -#define FPGA_REG2_FPGA_PLATFORM_TYPE_LSB 0 -#define FPGA_REG2_FPGA_PLATFORM_TYPE_MASK 0x0000000f -#define FPGA_REG2_FPGA_PLATFORM_TYPE_GET(x) (((x) & FPGA_REG2_FPGA_PLATFORM_TYPE_MASK) >> FPGA_REG2_FPGA_PLATFORM_TYPE_LSB) -#define FPGA_REG2_FPGA_PLATFORM_TYPE_SET(x) (((x) << FPGA_REG2_FPGA_PLATFORM_TYPE_LSB) & FPGA_REG2_FPGA_PLATFORM_TYPE_MASK) - -#define FPGA_REG4_ADDRESS 0x00000008 -#define FPGA_REG4_OFFSET 0x00000008 -#define FPGA_REG4_RADIO_0_TDO_MSB 3 -#define FPGA_REG4_RADIO_0_TDO_LSB 3 -#define FPGA_REG4_RADIO_0_TDO_MASK 0x00000008 -#define FPGA_REG4_RADIO_0_TDO_GET(x) (((x) & FPGA_REG4_RADIO_0_TDO_MASK) >> FPGA_REG4_RADIO_0_TDO_LSB) -#define FPGA_REG4_RADIO_0_TDO_SET(x) (((x) << FPGA_REG4_RADIO_0_TDO_LSB) & FPGA_REG4_RADIO_0_TDO_MASK) -#define FPGA_REG4_RADIO_0_TMS_MSB 2 -#define FPGA_REG4_RADIO_0_TMS_LSB 2 -#define FPGA_REG4_RADIO_0_TMS_MASK 0x00000004 -#define FPGA_REG4_RADIO_0_TMS_GET(x) (((x) & FPGA_REG4_RADIO_0_TMS_MASK) >> FPGA_REG4_RADIO_0_TMS_LSB) -#define FPGA_REG4_RADIO_0_TMS_SET(x) (((x) << FPGA_REG4_RADIO_0_TMS_LSB) & FPGA_REG4_RADIO_0_TMS_MASK) -#define FPGA_REG4_RADIO_0_TDI_MSB 1 -#define FPGA_REG4_RADIO_0_TDI_LSB 1 -#define FPGA_REG4_RADIO_0_TDI_MASK 0x00000002 -#define FPGA_REG4_RADIO_0_TDI_GET(x) (((x) & FPGA_REG4_RADIO_0_TDI_MASK) >> FPGA_REG4_RADIO_0_TDI_LSB) -#define FPGA_REG4_RADIO_0_TDI_SET(x) (((x) << FPGA_REG4_RADIO_0_TDI_LSB) & FPGA_REG4_RADIO_0_TDI_MASK) -#define FPGA_REG4_RADIO_0_TCK_MSB 0 -#define FPGA_REG4_RADIO_0_TCK_LSB 0 -#define FPGA_REG4_RADIO_0_TCK_MASK 0x00000001 -#define FPGA_REG4_RADIO_0_TCK_GET(x) (((x) & FPGA_REG4_RADIO_0_TCK_MASK) >> FPGA_REG4_RADIO_0_TCK_LSB) -#define FPGA_REG4_RADIO_0_TCK_SET(x) (((x) << FPGA_REG4_RADIO_0_TCK_LSB) & FPGA_REG4_RADIO_0_TCK_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct fpga_reg_reg_s { - volatile unsigned int fpga_reg1; - volatile unsigned int fpga_reg2; - volatile unsigned int fpga_reg4; -} fpga_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _FPGA_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/gpio_athr_wlan_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/gpio_athr_wlan_reg.h deleted file mode 100644 index dc61bc9178cb..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/gpio_athr_wlan_reg.h +++ /dev/null @@ -1,2638 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _GPIO_ATHR_WLAN_REG_REG_H_ -#define _GPIO_ATHR_WLAN_REG_REG_H_ - -#define WLAN_GPIO_OUT_LOW_ADDRESS 0x00000000 -#define WLAN_GPIO_OUT_LOW_OFFSET 0x00000000 -#define WLAN_GPIO_OUT_LOW_DATA_MSB 31 -#define WLAN_GPIO_OUT_LOW_DATA_LSB 0 -#define WLAN_GPIO_OUT_LOW_DATA_MASK 0xffffffff -#define WLAN_GPIO_OUT_LOW_DATA_GET(x) (((x) & WLAN_GPIO_OUT_LOW_DATA_MASK) >> WLAN_GPIO_OUT_LOW_DATA_LSB) -#define WLAN_GPIO_OUT_LOW_DATA_SET(x) (((x) << WLAN_GPIO_OUT_LOW_DATA_LSB) & WLAN_GPIO_OUT_LOW_DATA_MASK) - -#define WLAN_GPIO_OUT_W1TS_LOW_ADDRESS 0x00000004 -#define WLAN_GPIO_OUT_W1TS_LOW_OFFSET 0x00000004 -#define WLAN_GPIO_OUT_W1TS_LOW_DATA_MSB 31 -#define WLAN_GPIO_OUT_W1TS_LOW_DATA_LSB 0 -#define WLAN_GPIO_OUT_W1TS_LOW_DATA_MASK 0xffffffff -#define WLAN_GPIO_OUT_W1TS_LOW_DATA_GET(x) (((x) & WLAN_GPIO_OUT_W1TS_LOW_DATA_MASK) >> WLAN_GPIO_OUT_W1TS_LOW_DATA_LSB) -#define WLAN_GPIO_OUT_W1TS_LOW_DATA_SET(x) (((x) << WLAN_GPIO_OUT_W1TS_LOW_DATA_LSB) & WLAN_GPIO_OUT_W1TS_LOW_DATA_MASK) - -#define WLAN_GPIO_OUT_W1TC_LOW_ADDRESS 0x00000008 -#define WLAN_GPIO_OUT_W1TC_LOW_OFFSET 0x00000008 -#define WLAN_GPIO_OUT_W1TC_LOW_DATA_MSB 31 -#define WLAN_GPIO_OUT_W1TC_LOW_DATA_LSB 0 -#define WLAN_GPIO_OUT_W1TC_LOW_DATA_MASK 0xffffffff -#define WLAN_GPIO_OUT_W1TC_LOW_DATA_GET(x) (((x) & WLAN_GPIO_OUT_W1TC_LOW_DATA_MASK) >> WLAN_GPIO_OUT_W1TC_LOW_DATA_LSB) -#define WLAN_GPIO_OUT_W1TC_LOW_DATA_SET(x) (((x) << WLAN_GPIO_OUT_W1TC_LOW_DATA_LSB) & WLAN_GPIO_OUT_W1TC_LOW_DATA_MASK) - -#define WLAN_GPIO_OUT_HIGH_ADDRESS 0x0000000c -#define WLAN_GPIO_OUT_HIGH_OFFSET 0x0000000c -#define WLAN_GPIO_OUT_HIGH_DATA_MSB 31 -#define WLAN_GPIO_OUT_HIGH_DATA_LSB 0 -#define WLAN_GPIO_OUT_HIGH_DATA_MASK 0xffffffff -#define WLAN_GPIO_OUT_HIGH_DATA_GET(x) (((x) & WLAN_GPIO_OUT_HIGH_DATA_MASK) >> WLAN_GPIO_OUT_HIGH_DATA_LSB) -#define WLAN_GPIO_OUT_HIGH_DATA_SET(x) (((x) << WLAN_GPIO_OUT_HIGH_DATA_LSB) & WLAN_GPIO_OUT_HIGH_DATA_MASK) - -#define WLAN_GPIO_OUT_W1TS_HIGH_ADDRESS 0x00000010 -#define WLAN_GPIO_OUT_W1TS_HIGH_OFFSET 0x00000010 -#define WLAN_GPIO_OUT_W1TS_HIGH_DATA_MSB 31 -#define WLAN_GPIO_OUT_W1TS_HIGH_DATA_LSB 0 -#define WLAN_GPIO_OUT_W1TS_HIGH_DATA_MASK 0xffffffff -#define WLAN_GPIO_OUT_W1TS_HIGH_DATA_GET(x) (((x) & WLAN_GPIO_OUT_W1TS_HIGH_DATA_MASK) >> WLAN_GPIO_OUT_W1TS_HIGH_DATA_LSB) -#define WLAN_GPIO_OUT_W1TS_HIGH_DATA_SET(x) (((x) << WLAN_GPIO_OUT_W1TS_HIGH_DATA_LSB) & WLAN_GPIO_OUT_W1TS_HIGH_DATA_MASK) - -#define WLAN_GPIO_OUT_W1TC_HIGH_ADDRESS 0x00000014 -#define WLAN_GPIO_OUT_W1TC_HIGH_OFFSET 0x00000014 -#define WLAN_GPIO_OUT_W1TC_HIGH_DATA_MSB 31 -#define WLAN_GPIO_OUT_W1TC_HIGH_DATA_LSB 0 -#define WLAN_GPIO_OUT_W1TC_HIGH_DATA_MASK 0xffffffff -#define WLAN_GPIO_OUT_W1TC_HIGH_DATA_GET(x) (((x) & WLAN_GPIO_OUT_W1TC_HIGH_DATA_MASK) >> WLAN_GPIO_OUT_W1TC_HIGH_DATA_LSB) -#define WLAN_GPIO_OUT_W1TC_HIGH_DATA_SET(x) (((x) << WLAN_GPIO_OUT_W1TC_HIGH_DATA_LSB) & WLAN_GPIO_OUT_W1TC_HIGH_DATA_MASK) - -#define WLAN_GPIO_ENABLE_LOW_ADDRESS 0x00000018 -#define WLAN_GPIO_ENABLE_LOW_OFFSET 0x00000018 -#define WLAN_GPIO_ENABLE_LOW_DATA_MSB 31 -#define WLAN_GPIO_ENABLE_LOW_DATA_LSB 0 -#define WLAN_GPIO_ENABLE_LOW_DATA_MASK 0xffffffff -#define WLAN_GPIO_ENABLE_LOW_DATA_GET(x) (((x) & WLAN_GPIO_ENABLE_LOW_DATA_MASK) >> WLAN_GPIO_ENABLE_LOW_DATA_LSB) -#define WLAN_GPIO_ENABLE_LOW_DATA_SET(x) (((x) << WLAN_GPIO_ENABLE_LOW_DATA_LSB) & WLAN_GPIO_ENABLE_LOW_DATA_MASK) - -#define WLAN_GPIO_ENABLE_W1TS_LOW_ADDRESS 0x0000001c -#define WLAN_GPIO_ENABLE_W1TS_LOW_OFFSET 0x0000001c -#define WLAN_GPIO_ENABLE_W1TS_LOW_DATA_MSB 31 -#define WLAN_GPIO_ENABLE_W1TS_LOW_DATA_LSB 0 -#define WLAN_GPIO_ENABLE_W1TS_LOW_DATA_MASK 0xffffffff -#define WLAN_GPIO_ENABLE_W1TS_LOW_DATA_GET(x) (((x) & WLAN_GPIO_ENABLE_W1TS_LOW_DATA_MASK) >> WLAN_GPIO_ENABLE_W1TS_LOW_DATA_LSB) -#define WLAN_GPIO_ENABLE_W1TS_LOW_DATA_SET(x) (((x) << WLAN_GPIO_ENABLE_W1TS_LOW_DATA_LSB) & WLAN_GPIO_ENABLE_W1TS_LOW_DATA_MASK) - -#define WLAN_GPIO_ENABLE_W1TC_LOW_ADDRESS 0x00000020 -#define WLAN_GPIO_ENABLE_W1TC_LOW_OFFSET 0x00000020 -#define WLAN_GPIO_ENABLE_W1TC_LOW_DATA_MSB 31 -#define WLAN_GPIO_ENABLE_W1TC_LOW_DATA_LSB 0 -#define WLAN_GPIO_ENABLE_W1TC_LOW_DATA_MASK 0xffffffff -#define WLAN_GPIO_ENABLE_W1TC_LOW_DATA_GET(x) (((x) & WLAN_GPIO_ENABLE_W1TC_LOW_DATA_MASK) >> WLAN_GPIO_ENABLE_W1TC_LOW_DATA_LSB) -#define WLAN_GPIO_ENABLE_W1TC_LOW_DATA_SET(x) (((x) << WLAN_GPIO_ENABLE_W1TC_LOW_DATA_LSB) & WLAN_GPIO_ENABLE_W1TC_LOW_DATA_MASK) - -#define WLAN_GPIO_ENABLE_HIGH_ADDRESS 0x00000024 -#define WLAN_GPIO_ENABLE_HIGH_OFFSET 0x00000024 -#define WLAN_GPIO_ENABLE_HIGH_DATA_MSB 31 -#define WLAN_GPIO_ENABLE_HIGH_DATA_LSB 0 -#define WLAN_GPIO_ENABLE_HIGH_DATA_MASK 0xffffffff -#define WLAN_GPIO_ENABLE_HIGH_DATA_GET(x) (((x) & WLAN_GPIO_ENABLE_HIGH_DATA_MASK) >> WLAN_GPIO_ENABLE_HIGH_DATA_LSB) -#define WLAN_GPIO_ENABLE_HIGH_DATA_SET(x) (((x) << WLAN_GPIO_ENABLE_HIGH_DATA_LSB) & WLAN_GPIO_ENABLE_HIGH_DATA_MASK) - -#define WLAN_GPIO_ENABLE_W1TS_HIGH_ADDRESS 0x00000028 -#define WLAN_GPIO_ENABLE_W1TS_HIGH_OFFSET 0x00000028 -#define WLAN_GPIO_ENABLE_W1TS_HIGH_DATA_MSB 31 -#define WLAN_GPIO_ENABLE_W1TS_HIGH_DATA_LSB 0 -#define WLAN_GPIO_ENABLE_W1TS_HIGH_DATA_MASK 0xffffffff -#define WLAN_GPIO_ENABLE_W1TS_HIGH_DATA_GET(x) (((x) & WLAN_GPIO_ENABLE_W1TS_HIGH_DATA_MASK) >> WLAN_GPIO_ENABLE_W1TS_HIGH_DATA_LSB) -#define WLAN_GPIO_ENABLE_W1TS_HIGH_DATA_SET(x) (((x) << WLAN_GPIO_ENABLE_W1TS_HIGH_DATA_LSB) & WLAN_GPIO_ENABLE_W1TS_HIGH_DATA_MASK) - -#define WLAN_GPIO_ENABLE_W1TC_HIGH_ADDRESS 0x0000002c -#define WLAN_GPIO_ENABLE_W1TC_HIGH_OFFSET 0x0000002c -#define WLAN_GPIO_ENABLE_W1TC_HIGH_DATA_MSB 31 -#define WLAN_GPIO_ENABLE_W1TC_HIGH_DATA_LSB 0 -#define WLAN_GPIO_ENABLE_W1TC_HIGH_DATA_MASK 0xffffffff -#define WLAN_GPIO_ENABLE_W1TC_HIGH_DATA_GET(x) (((x) & WLAN_GPIO_ENABLE_W1TC_HIGH_DATA_MASK) >> WLAN_GPIO_ENABLE_W1TC_HIGH_DATA_LSB) -#define WLAN_GPIO_ENABLE_W1TC_HIGH_DATA_SET(x) (((x) << WLAN_GPIO_ENABLE_W1TC_HIGH_DATA_LSB) & WLAN_GPIO_ENABLE_W1TC_HIGH_DATA_MASK) - -#define WLAN_GPIO_IN_LOW_ADDRESS 0x00000030 -#define WLAN_GPIO_IN_LOW_OFFSET 0x00000030 -#define WLAN_GPIO_IN_LOW_DATA_MSB 31 -#define WLAN_GPIO_IN_LOW_DATA_LSB 0 -#define WLAN_GPIO_IN_LOW_DATA_MASK 0xffffffff -#define WLAN_GPIO_IN_LOW_DATA_GET(x) (((x) & WLAN_GPIO_IN_LOW_DATA_MASK) >> WLAN_GPIO_IN_LOW_DATA_LSB) -#define WLAN_GPIO_IN_LOW_DATA_SET(x) (((x) << WLAN_GPIO_IN_LOW_DATA_LSB) & WLAN_GPIO_IN_LOW_DATA_MASK) - -#define WLAN_GPIO_STATUS_LOW_ADDRESS 0x00000034 -#define WLAN_GPIO_STATUS_LOW_OFFSET 0x00000034 -#define WLAN_GPIO_STATUS_LOW_INTERRUPT_MSB 31 -#define WLAN_GPIO_STATUS_LOW_INTERRUPT_LSB 0 -#define WLAN_GPIO_STATUS_LOW_INTERRUPT_MASK 0xffffffff -#define WLAN_GPIO_STATUS_LOW_INTERRUPT_GET(x) (((x) & WLAN_GPIO_STATUS_LOW_INTERRUPT_MASK) >> WLAN_GPIO_STATUS_LOW_INTERRUPT_LSB) -#define WLAN_GPIO_STATUS_LOW_INTERRUPT_SET(x) (((x) << WLAN_GPIO_STATUS_LOW_INTERRUPT_LSB) & WLAN_GPIO_STATUS_LOW_INTERRUPT_MASK) - -#define WLAN_GPIO_IN_HIGH_ADDRESS 0x00000038 -#define WLAN_GPIO_IN_HIGH_OFFSET 0x00000038 -#define WLAN_GPIO_IN_HIGH_DATA_MSB 31 -#define WLAN_GPIO_IN_HIGH_DATA_LSB 0 -#define WLAN_GPIO_IN_HIGH_DATA_MASK 0xffffffff -#define WLAN_GPIO_IN_HIGH_DATA_GET(x) (((x) & WLAN_GPIO_IN_HIGH_DATA_MASK) >> WLAN_GPIO_IN_HIGH_DATA_LSB) -#define WLAN_GPIO_IN_HIGH_DATA_SET(x) (((x) << WLAN_GPIO_IN_HIGH_DATA_LSB) & WLAN_GPIO_IN_HIGH_DATA_MASK) - -#define WLAN_GPIO_STATUS_HIGH_ADDRESS 0x0000003c -#define WLAN_GPIO_STATUS_HIGH_OFFSET 0x0000003c -#define WLAN_GPIO_STATUS_HIGH_INTERRUPT_MSB 31 -#define WLAN_GPIO_STATUS_HIGH_INTERRUPT_LSB 0 -#define WLAN_GPIO_STATUS_HIGH_INTERRUPT_MASK 0xffffffff -#define WLAN_GPIO_STATUS_HIGH_INTERRUPT_GET(x) (((x) & WLAN_GPIO_STATUS_HIGH_INTERRUPT_MASK) >> WLAN_GPIO_STATUS_HIGH_INTERRUPT_LSB) -#define WLAN_GPIO_STATUS_HIGH_INTERRUPT_SET(x) (((x) << WLAN_GPIO_STATUS_HIGH_INTERRUPT_LSB) & WLAN_GPIO_STATUS_HIGH_INTERRUPT_MASK) - -#define WLAN_GPIO_STATUS_W1TS_LOW_ADDRESS 0x00000040 -#define WLAN_GPIO_STATUS_W1TS_LOW_OFFSET 0x00000040 -#define WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_MSB 31 -#define WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_LSB 0 -#define WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_MASK 0xffffffff -#define WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_GET(x) (((x) & WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_MASK) >> WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_LSB) -#define WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_SET(x) (((x) << WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_LSB) & WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_MASK) - -#define WLAN_GPIO_STATUS_W1TC_LOW_ADDRESS 0x00000044 -#define WLAN_GPIO_STATUS_W1TC_LOW_OFFSET 0x00000044 -#define WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_MSB 31 -#define WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_LSB 0 -#define WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_MASK 0xffffffff -#define WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_GET(x) (((x) & WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_MASK) >> WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_LSB) -#define WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_SET(x) (((x) << WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_LSB) & WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_MASK) - -#define WLAN_GPIO_STATUS_W1TS_HIGH_ADDRESS 0x00000048 -#define WLAN_GPIO_STATUS_W1TS_HIGH_OFFSET 0x00000048 -#define WLAN_GPIO_STATUS_W1TS_HIGH_INTERRUPT_MSB 31 -#define WLAN_GPIO_STATUS_W1TS_HIGH_INTERRUPT_LSB 0 -#define WLAN_GPIO_STATUS_W1TS_HIGH_INTERRUPT_MASK 0xffffffff -#define WLAN_GPIO_STATUS_W1TS_HIGH_INTERRUPT_GET(x) (((x) & WLAN_GPIO_STATUS_W1TS_HIGH_INTERRUPT_MASK) >> WLAN_GPIO_STATUS_W1TS_HIGH_INTERRUPT_LSB) -#define WLAN_GPIO_STATUS_W1TS_HIGH_INTERRUPT_SET(x) (((x) << WLAN_GPIO_STATUS_W1TS_HIGH_INTERRUPT_LSB) & WLAN_GPIO_STATUS_W1TS_HIGH_INTERRUPT_MASK) - -#define WLAN_GPIO_STATUS_W1TC_HIGH_ADDRESS 0x0000004c -#define WLAN_GPIO_STATUS_W1TC_HIGH_OFFSET 0x0000004c -#define WLAN_GPIO_STATUS_W1TC_HIGH_INTERRUPT_MSB 31 -#define WLAN_GPIO_STATUS_W1TC_HIGH_INTERRUPT_LSB 0 -#define WLAN_GPIO_STATUS_W1TC_HIGH_INTERRUPT_MASK 0xffffffff -#define WLAN_GPIO_STATUS_W1TC_HIGH_INTERRUPT_GET(x) (((x) & WLAN_GPIO_STATUS_W1TC_HIGH_INTERRUPT_MASK) >> WLAN_GPIO_STATUS_W1TC_HIGH_INTERRUPT_LSB) -#define WLAN_GPIO_STATUS_W1TC_HIGH_INTERRUPT_SET(x) (((x) << WLAN_GPIO_STATUS_W1TC_HIGH_INTERRUPT_LSB) & WLAN_GPIO_STATUS_W1TC_HIGH_INTERRUPT_MASK) - -#define WLAN_GPIO_PIN0_ADDRESS 0x00000050 -#define WLAN_GPIO_PIN0_OFFSET 0x00000050 -#define WLAN_GPIO_PIN0_CONFIG_MSB 14 -#define WLAN_GPIO_PIN0_CONFIG_LSB 11 -#define WLAN_GPIO_PIN0_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN0_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN0_CONFIG_MASK) >> WLAN_GPIO_PIN0_CONFIG_LSB) -#define WLAN_GPIO_PIN0_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN0_CONFIG_LSB) & WLAN_GPIO_PIN0_CONFIG_MASK) -#define WLAN_GPIO_PIN0_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN0_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN0_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN0_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN0_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN0_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN0_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN0_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN0_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN0_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN0_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN0_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN0_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN0_INT_TYPE_MASK) >> WLAN_GPIO_PIN0_INT_TYPE_LSB) -#define WLAN_GPIO_PIN0_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN0_INT_TYPE_LSB) & WLAN_GPIO_PIN0_INT_TYPE_MASK) -#define WLAN_GPIO_PIN0_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN0_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN0_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN0_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN0_PAD_PULL_MASK) >> WLAN_GPIO_PIN0_PAD_PULL_LSB) -#define WLAN_GPIO_PIN0_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN0_PAD_PULL_LSB) & WLAN_GPIO_PIN0_PAD_PULL_MASK) -#define WLAN_GPIO_PIN0_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN0_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN0_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN0_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN0_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN0_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN0_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN0_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN0_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN0_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN0_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN0_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN0_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN0_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN0_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN0_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN0_PAD_DRIVER_LSB) & WLAN_GPIO_PIN0_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN0_SOURCE_MSB 0 -#define WLAN_GPIO_PIN0_SOURCE_LSB 0 -#define WLAN_GPIO_PIN0_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN0_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN0_SOURCE_MASK) >> WLAN_GPIO_PIN0_SOURCE_LSB) -#define WLAN_GPIO_PIN0_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN0_SOURCE_LSB) & WLAN_GPIO_PIN0_SOURCE_MASK) - -#define WLAN_GPIO_PIN1_ADDRESS 0x00000054 -#define WLAN_GPIO_PIN1_OFFSET 0x00000054 -#define WLAN_GPIO_PIN1_CONFIG_MSB 14 -#define WLAN_GPIO_PIN1_CONFIG_LSB 11 -#define WLAN_GPIO_PIN1_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN1_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN1_CONFIG_MASK) >> WLAN_GPIO_PIN1_CONFIG_LSB) -#define WLAN_GPIO_PIN1_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN1_CONFIG_LSB) & WLAN_GPIO_PIN1_CONFIG_MASK) -#define WLAN_GPIO_PIN1_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN1_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN1_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN1_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN1_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN1_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN1_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN1_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN1_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN1_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN1_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN1_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN1_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN1_INT_TYPE_MASK) >> WLAN_GPIO_PIN1_INT_TYPE_LSB) -#define WLAN_GPIO_PIN1_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN1_INT_TYPE_LSB) & WLAN_GPIO_PIN1_INT_TYPE_MASK) -#define WLAN_GPIO_PIN1_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN1_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN1_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN1_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN1_PAD_PULL_MASK) >> WLAN_GPIO_PIN1_PAD_PULL_LSB) -#define WLAN_GPIO_PIN1_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN1_PAD_PULL_LSB) & WLAN_GPIO_PIN1_PAD_PULL_MASK) -#define WLAN_GPIO_PIN1_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN1_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN1_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN1_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN1_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN1_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN1_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN1_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN1_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN1_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN1_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN1_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN1_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN1_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN1_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN1_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN1_PAD_DRIVER_LSB) & WLAN_GPIO_PIN1_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN1_SOURCE_MSB 0 -#define WLAN_GPIO_PIN1_SOURCE_LSB 0 -#define WLAN_GPIO_PIN1_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN1_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN1_SOURCE_MASK) >> WLAN_GPIO_PIN1_SOURCE_LSB) -#define WLAN_GPIO_PIN1_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN1_SOURCE_LSB) & WLAN_GPIO_PIN1_SOURCE_MASK) - -#define WLAN_GPIO_PIN2_ADDRESS 0x00000058 -#define WLAN_GPIO_PIN2_OFFSET 0x00000058 -#define WLAN_GPIO_PIN2_CONFIG_MSB 14 -#define WLAN_GPIO_PIN2_CONFIG_LSB 11 -#define WLAN_GPIO_PIN2_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN2_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN2_CONFIG_MASK) >> WLAN_GPIO_PIN2_CONFIG_LSB) -#define WLAN_GPIO_PIN2_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN2_CONFIG_LSB) & WLAN_GPIO_PIN2_CONFIG_MASK) -#define WLAN_GPIO_PIN2_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN2_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN2_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN2_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN2_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN2_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN2_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN2_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN2_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN2_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN2_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN2_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN2_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN2_INT_TYPE_MASK) >> WLAN_GPIO_PIN2_INT_TYPE_LSB) -#define WLAN_GPIO_PIN2_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN2_INT_TYPE_LSB) & WLAN_GPIO_PIN2_INT_TYPE_MASK) -#define WLAN_GPIO_PIN2_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN2_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN2_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN2_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN2_PAD_PULL_MASK) >> WLAN_GPIO_PIN2_PAD_PULL_LSB) -#define WLAN_GPIO_PIN2_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN2_PAD_PULL_LSB) & WLAN_GPIO_PIN2_PAD_PULL_MASK) -#define WLAN_GPIO_PIN2_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN2_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN2_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN2_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN2_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN2_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN2_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN2_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN2_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN2_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN2_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN2_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN2_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN2_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN2_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN2_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN2_PAD_DRIVER_LSB) & WLAN_GPIO_PIN2_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN2_SOURCE_MSB 0 -#define WLAN_GPIO_PIN2_SOURCE_LSB 0 -#define WLAN_GPIO_PIN2_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN2_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN2_SOURCE_MASK) >> WLAN_GPIO_PIN2_SOURCE_LSB) -#define WLAN_GPIO_PIN2_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN2_SOURCE_LSB) & WLAN_GPIO_PIN2_SOURCE_MASK) - -#define WLAN_GPIO_PIN3_ADDRESS 0x0000005c -#define WLAN_GPIO_PIN3_OFFSET 0x0000005c -#define WLAN_GPIO_PIN3_CONFIG_MSB 14 -#define WLAN_GPIO_PIN3_CONFIG_LSB 11 -#define WLAN_GPIO_PIN3_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN3_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN3_CONFIG_MASK) >> WLAN_GPIO_PIN3_CONFIG_LSB) -#define WLAN_GPIO_PIN3_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN3_CONFIG_LSB) & WLAN_GPIO_PIN3_CONFIG_MASK) -#define WLAN_GPIO_PIN3_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN3_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN3_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN3_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN3_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN3_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN3_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN3_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN3_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN3_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN3_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN3_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN3_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN3_INT_TYPE_MASK) >> WLAN_GPIO_PIN3_INT_TYPE_LSB) -#define WLAN_GPIO_PIN3_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN3_INT_TYPE_LSB) & WLAN_GPIO_PIN3_INT_TYPE_MASK) -#define WLAN_GPIO_PIN3_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN3_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN3_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN3_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN3_PAD_PULL_MASK) >> WLAN_GPIO_PIN3_PAD_PULL_LSB) -#define WLAN_GPIO_PIN3_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN3_PAD_PULL_LSB) & WLAN_GPIO_PIN3_PAD_PULL_MASK) -#define WLAN_GPIO_PIN3_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN3_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN3_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN3_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN3_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN3_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN3_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN3_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN3_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN3_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN3_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN3_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN3_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN3_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN3_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN3_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN3_PAD_DRIVER_LSB) & WLAN_GPIO_PIN3_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN3_SOURCE_MSB 0 -#define WLAN_GPIO_PIN3_SOURCE_LSB 0 -#define WLAN_GPIO_PIN3_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN3_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN3_SOURCE_MASK) >> WLAN_GPIO_PIN3_SOURCE_LSB) -#define WLAN_GPIO_PIN3_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN3_SOURCE_LSB) & WLAN_GPIO_PIN3_SOURCE_MASK) - -#define WLAN_GPIO_PIN4_ADDRESS 0x00000060 -#define WLAN_GPIO_PIN4_OFFSET 0x00000060 -#define WLAN_GPIO_PIN4_CONFIG_MSB 14 -#define WLAN_GPIO_PIN4_CONFIG_LSB 11 -#define WLAN_GPIO_PIN4_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN4_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN4_CONFIG_MASK) >> WLAN_GPIO_PIN4_CONFIG_LSB) -#define WLAN_GPIO_PIN4_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN4_CONFIG_LSB) & WLAN_GPIO_PIN4_CONFIG_MASK) -#define WLAN_GPIO_PIN4_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN4_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN4_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN4_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN4_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN4_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN4_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN4_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN4_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN4_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN4_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN4_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN4_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN4_INT_TYPE_MASK) >> WLAN_GPIO_PIN4_INT_TYPE_LSB) -#define WLAN_GPIO_PIN4_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN4_INT_TYPE_LSB) & WLAN_GPIO_PIN4_INT_TYPE_MASK) -#define WLAN_GPIO_PIN4_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN4_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN4_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN4_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN4_PAD_PULL_MASK) >> WLAN_GPIO_PIN4_PAD_PULL_LSB) -#define WLAN_GPIO_PIN4_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN4_PAD_PULL_LSB) & WLAN_GPIO_PIN4_PAD_PULL_MASK) -#define WLAN_GPIO_PIN4_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN4_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN4_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN4_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN4_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN4_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN4_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN4_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN4_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN4_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN4_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN4_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN4_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN4_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN4_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN4_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN4_PAD_DRIVER_LSB) & WLAN_GPIO_PIN4_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN4_SOURCE_MSB 0 -#define WLAN_GPIO_PIN4_SOURCE_LSB 0 -#define WLAN_GPIO_PIN4_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN4_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN4_SOURCE_MASK) >> WLAN_GPIO_PIN4_SOURCE_LSB) -#define WLAN_GPIO_PIN4_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN4_SOURCE_LSB) & WLAN_GPIO_PIN4_SOURCE_MASK) - -#define WLAN_GPIO_PIN5_ADDRESS 0x00000064 -#define WLAN_GPIO_PIN5_OFFSET 0x00000064 -#define WLAN_GPIO_PIN5_CONFIG_MSB 14 -#define WLAN_GPIO_PIN5_CONFIG_LSB 11 -#define WLAN_GPIO_PIN5_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN5_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN5_CONFIG_MASK) >> WLAN_GPIO_PIN5_CONFIG_LSB) -#define WLAN_GPIO_PIN5_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN5_CONFIG_LSB) & WLAN_GPIO_PIN5_CONFIG_MASK) -#define WLAN_GPIO_PIN5_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN5_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN5_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN5_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN5_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN5_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN5_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN5_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN5_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN5_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN5_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN5_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN5_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN5_INT_TYPE_MASK) >> WLAN_GPIO_PIN5_INT_TYPE_LSB) -#define WLAN_GPIO_PIN5_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN5_INT_TYPE_LSB) & WLAN_GPIO_PIN5_INT_TYPE_MASK) -#define WLAN_GPIO_PIN5_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN5_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN5_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN5_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN5_PAD_PULL_MASK) >> WLAN_GPIO_PIN5_PAD_PULL_LSB) -#define WLAN_GPIO_PIN5_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN5_PAD_PULL_LSB) & WLAN_GPIO_PIN5_PAD_PULL_MASK) -#define WLAN_GPIO_PIN5_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN5_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN5_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN5_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN5_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN5_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN5_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN5_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN5_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN5_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN5_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN5_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN5_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN5_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN5_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN5_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN5_PAD_DRIVER_LSB) & WLAN_GPIO_PIN5_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN5_SOURCE_MSB 0 -#define WLAN_GPIO_PIN5_SOURCE_LSB 0 -#define WLAN_GPIO_PIN5_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN5_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN5_SOURCE_MASK) >> WLAN_GPIO_PIN5_SOURCE_LSB) -#define WLAN_GPIO_PIN5_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN5_SOURCE_LSB) & WLAN_GPIO_PIN5_SOURCE_MASK) - -#define WLAN_GPIO_PIN6_ADDRESS 0x00000068 -#define WLAN_GPIO_PIN6_OFFSET 0x00000068 -#define WLAN_GPIO_PIN6_CONFIG_MSB 14 -#define WLAN_GPIO_PIN6_CONFIG_LSB 11 -#define WLAN_GPIO_PIN6_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN6_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN6_CONFIG_MASK) >> WLAN_GPIO_PIN6_CONFIG_LSB) -#define WLAN_GPIO_PIN6_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN6_CONFIG_LSB) & WLAN_GPIO_PIN6_CONFIG_MASK) -#define WLAN_GPIO_PIN6_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN6_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN6_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN6_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN6_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN6_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN6_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN6_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN6_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN6_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN6_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN6_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN6_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN6_INT_TYPE_MASK) >> WLAN_GPIO_PIN6_INT_TYPE_LSB) -#define WLAN_GPIO_PIN6_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN6_INT_TYPE_LSB) & WLAN_GPIO_PIN6_INT_TYPE_MASK) -#define WLAN_GPIO_PIN6_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN6_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN6_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN6_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN6_PAD_PULL_MASK) >> WLAN_GPIO_PIN6_PAD_PULL_LSB) -#define WLAN_GPIO_PIN6_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN6_PAD_PULL_LSB) & WLAN_GPIO_PIN6_PAD_PULL_MASK) -#define WLAN_GPIO_PIN6_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN6_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN6_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN6_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN6_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN6_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN6_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN6_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN6_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN6_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN6_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN6_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN6_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN6_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN6_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN6_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN6_PAD_DRIVER_LSB) & WLAN_GPIO_PIN6_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN6_SOURCE_MSB 0 -#define WLAN_GPIO_PIN6_SOURCE_LSB 0 -#define WLAN_GPIO_PIN6_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN6_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN6_SOURCE_MASK) >> WLAN_GPIO_PIN6_SOURCE_LSB) -#define WLAN_GPIO_PIN6_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN6_SOURCE_LSB) & WLAN_GPIO_PIN6_SOURCE_MASK) - -#define WLAN_GPIO_PIN7_ADDRESS 0x0000006c -#define WLAN_GPIO_PIN7_OFFSET 0x0000006c -#define WLAN_GPIO_PIN7_CONFIG_MSB 14 -#define WLAN_GPIO_PIN7_CONFIG_LSB 11 -#define WLAN_GPIO_PIN7_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN7_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN7_CONFIG_MASK) >> WLAN_GPIO_PIN7_CONFIG_LSB) -#define WLAN_GPIO_PIN7_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN7_CONFIG_LSB) & WLAN_GPIO_PIN7_CONFIG_MASK) -#define WLAN_GPIO_PIN7_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN7_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN7_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN7_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN7_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN7_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN7_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN7_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN7_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN7_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN7_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN7_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN7_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN7_INT_TYPE_MASK) >> WLAN_GPIO_PIN7_INT_TYPE_LSB) -#define WLAN_GPIO_PIN7_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN7_INT_TYPE_LSB) & WLAN_GPIO_PIN7_INT_TYPE_MASK) -#define WLAN_GPIO_PIN7_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN7_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN7_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN7_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN7_PAD_PULL_MASK) >> WLAN_GPIO_PIN7_PAD_PULL_LSB) -#define WLAN_GPIO_PIN7_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN7_PAD_PULL_LSB) & WLAN_GPIO_PIN7_PAD_PULL_MASK) -#define WLAN_GPIO_PIN7_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN7_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN7_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN7_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN7_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN7_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN7_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN7_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN7_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN7_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN7_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN7_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN7_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN7_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN7_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN7_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN7_PAD_DRIVER_LSB) & WLAN_GPIO_PIN7_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN7_SOURCE_MSB 0 -#define WLAN_GPIO_PIN7_SOURCE_LSB 0 -#define WLAN_GPIO_PIN7_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN7_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN7_SOURCE_MASK) >> WLAN_GPIO_PIN7_SOURCE_LSB) -#define WLAN_GPIO_PIN7_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN7_SOURCE_LSB) & WLAN_GPIO_PIN7_SOURCE_MASK) - -#define WLAN_GPIO_PIN8_ADDRESS 0x00000070 -#define WLAN_GPIO_PIN8_OFFSET 0x00000070 -#define WLAN_GPIO_PIN8_CONFIG_MSB 14 -#define WLAN_GPIO_PIN8_CONFIG_LSB 11 -#define WLAN_GPIO_PIN8_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN8_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN8_CONFIG_MASK) >> WLAN_GPIO_PIN8_CONFIG_LSB) -#define WLAN_GPIO_PIN8_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN8_CONFIG_LSB) & WLAN_GPIO_PIN8_CONFIG_MASK) -#define WLAN_GPIO_PIN8_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN8_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN8_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN8_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN8_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN8_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN8_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN8_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN8_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN8_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN8_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN8_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN8_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN8_INT_TYPE_MASK) >> WLAN_GPIO_PIN8_INT_TYPE_LSB) -#define WLAN_GPIO_PIN8_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN8_INT_TYPE_LSB) & WLAN_GPIO_PIN8_INT_TYPE_MASK) -#define WLAN_GPIO_PIN8_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN8_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN8_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN8_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN8_PAD_PULL_MASK) >> WLAN_GPIO_PIN8_PAD_PULL_LSB) -#define WLAN_GPIO_PIN8_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN8_PAD_PULL_LSB) & WLAN_GPIO_PIN8_PAD_PULL_MASK) -#define WLAN_GPIO_PIN8_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN8_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN8_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN8_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN8_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN8_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN8_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN8_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN8_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN8_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN8_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN8_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN8_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN8_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN8_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN8_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN8_PAD_DRIVER_LSB) & WLAN_GPIO_PIN8_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN8_SOURCE_MSB 0 -#define WLAN_GPIO_PIN8_SOURCE_LSB 0 -#define WLAN_GPIO_PIN8_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN8_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN8_SOURCE_MASK) >> WLAN_GPIO_PIN8_SOURCE_LSB) -#define WLAN_GPIO_PIN8_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN8_SOURCE_LSB) & WLAN_GPIO_PIN8_SOURCE_MASK) - -#define WLAN_GPIO_PIN9_ADDRESS 0x00000074 -#define WLAN_GPIO_PIN9_OFFSET 0x00000074 -#define WLAN_GPIO_PIN9_CONFIG_MSB 14 -#define WLAN_GPIO_PIN9_CONFIG_LSB 11 -#define WLAN_GPIO_PIN9_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN9_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN9_CONFIG_MASK) >> WLAN_GPIO_PIN9_CONFIG_LSB) -#define WLAN_GPIO_PIN9_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN9_CONFIG_LSB) & WLAN_GPIO_PIN9_CONFIG_MASK) -#define WLAN_GPIO_PIN9_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN9_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN9_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN9_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN9_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN9_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN9_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN9_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN9_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN9_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN9_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN9_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN9_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN9_INT_TYPE_MASK) >> WLAN_GPIO_PIN9_INT_TYPE_LSB) -#define WLAN_GPIO_PIN9_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN9_INT_TYPE_LSB) & WLAN_GPIO_PIN9_INT_TYPE_MASK) -#define WLAN_GPIO_PIN9_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN9_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN9_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN9_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN9_PAD_PULL_MASK) >> WLAN_GPIO_PIN9_PAD_PULL_LSB) -#define WLAN_GPIO_PIN9_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN9_PAD_PULL_LSB) & WLAN_GPIO_PIN9_PAD_PULL_MASK) -#define WLAN_GPIO_PIN9_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN9_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN9_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN9_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN9_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN9_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN9_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN9_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN9_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN9_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN9_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN9_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN9_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN9_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN9_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN9_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN9_PAD_DRIVER_LSB) & WLAN_GPIO_PIN9_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN9_SOURCE_MSB 0 -#define WLAN_GPIO_PIN9_SOURCE_LSB 0 -#define WLAN_GPIO_PIN9_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN9_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN9_SOURCE_MASK) >> WLAN_GPIO_PIN9_SOURCE_LSB) -#define WLAN_GPIO_PIN9_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN9_SOURCE_LSB) & WLAN_GPIO_PIN9_SOURCE_MASK) - -#define WLAN_GPIO_PIN10_ADDRESS 0x00000078 -#define WLAN_GPIO_PIN10_OFFSET 0x00000078 -#define WLAN_GPIO_PIN10_CONFIG_MSB 14 -#define WLAN_GPIO_PIN10_CONFIG_LSB 11 -#define WLAN_GPIO_PIN10_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN10_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN10_CONFIG_MASK) >> WLAN_GPIO_PIN10_CONFIG_LSB) -#define WLAN_GPIO_PIN10_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN10_CONFIG_LSB) & WLAN_GPIO_PIN10_CONFIG_MASK) -#define WLAN_GPIO_PIN10_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN10_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN10_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN10_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN10_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN10_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN10_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN10_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN10_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN10_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN10_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN10_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN10_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN10_INT_TYPE_MASK) >> WLAN_GPIO_PIN10_INT_TYPE_LSB) -#define WLAN_GPIO_PIN10_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN10_INT_TYPE_LSB) & WLAN_GPIO_PIN10_INT_TYPE_MASK) -#define WLAN_GPIO_PIN10_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN10_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN10_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN10_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN10_PAD_PULL_MASK) >> WLAN_GPIO_PIN10_PAD_PULL_LSB) -#define WLAN_GPIO_PIN10_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN10_PAD_PULL_LSB) & WLAN_GPIO_PIN10_PAD_PULL_MASK) -#define WLAN_GPIO_PIN10_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN10_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN10_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN10_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN10_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN10_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN10_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN10_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN10_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN10_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN10_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN10_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN10_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN10_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN10_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN10_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN10_PAD_DRIVER_LSB) & WLAN_GPIO_PIN10_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN10_SOURCE_MSB 0 -#define WLAN_GPIO_PIN10_SOURCE_LSB 0 -#define WLAN_GPIO_PIN10_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN10_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN10_SOURCE_MASK) >> WLAN_GPIO_PIN10_SOURCE_LSB) -#define WLAN_GPIO_PIN10_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN10_SOURCE_LSB) & WLAN_GPIO_PIN10_SOURCE_MASK) - -#define WLAN_GPIO_PIN11_ADDRESS 0x0000007c -#define WLAN_GPIO_PIN11_OFFSET 0x0000007c -#define WLAN_GPIO_PIN11_CONFIG_MSB 14 -#define WLAN_GPIO_PIN11_CONFIG_LSB 11 -#define WLAN_GPIO_PIN11_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN11_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN11_CONFIG_MASK) >> WLAN_GPIO_PIN11_CONFIG_LSB) -#define WLAN_GPIO_PIN11_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN11_CONFIG_LSB) & WLAN_GPIO_PIN11_CONFIG_MASK) -#define WLAN_GPIO_PIN11_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN11_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN11_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN11_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN11_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN11_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN11_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN11_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN11_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN11_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN11_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN11_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN11_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN11_INT_TYPE_MASK) >> WLAN_GPIO_PIN11_INT_TYPE_LSB) -#define WLAN_GPIO_PIN11_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN11_INT_TYPE_LSB) & WLAN_GPIO_PIN11_INT_TYPE_MASK) -#define WLAN_GPIO_PIN11_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN11_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN11_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN11_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN11_PAD_PULL_MASK) >> WLAN_GPIO_PIN11_PAD_PULL_LSB) -#define WLAN_GPIO_PIN11_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN11_PAD_PULL_LSB) & WLAN_GPIO_PIN11_PAD_PULL_MASK) -#define WLAN_GPIO_PIN11_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN11_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN11_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN11_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN11_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN11_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN11_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN11_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN11_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN11_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN11_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN11_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN11_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN11_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN11_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN11_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN11_PAD_DRIVER_LSB) & WLAN_GPIO_PIN11_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN11_SOURCE_MSB 0 -#define WLAN_GPIO_PIN11_SOURCE_LSB 0 -#define WLAN_GPIO_PIN11_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN11_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN11_SOURCE_MASK) >> WLAN_GPIO_PIN11_SOURCE_LSB) -#define WLAN_GPIO_PIN11_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN11_SOURCE_LSB) & WLAN_GPIO_PIN11_SOURCE_MASK) - -#define WLAN_GPIO_PIN12_ADDRESS 0x00000080 -#define WLAN_GPIO_PIN12_OFFSET 0x00000080 -#define WLAN_GPIO_PIN12_CONFIG_MSB 14 -#define WLAN_GPIO_PIN12_CONFIG_LSB 11 -#define WLAN_GPIO_PIN12_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN12_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN12_CONFIG_MASK) >> WLAN_GPIO_PIN12_CONFIG_LSB) -#define WLAN_GPIO_PIN12_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN12_CONFIG_LSB) & WLAN_GPIO_PIN12_CONFIG_MASK) -#define WLAN_GPIO_PIN12_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN12_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN12_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN12_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN12_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN12_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN12_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN12_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN12_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN12_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN12_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN12_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN12_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN12_INT_TYPE_MASK) >> WLAN_GPIO_PIN12_INT_TYPE_LSB) -#define WLAN_GPIO_PIN12_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN12_INT_TYPE_LSB) & WLAN_GPIO_PIN12_INT_TYPE_MASK) -#define WLAN_GPIO_PIN12_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN12_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN12_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN12_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN12_PAD_PULL_MASK) >> WLAN_GPIO_PIN12_PAD_PULL_LSB) -#define WLAN_GPIO_PIN12_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN12_PAD_PULL_LSB) & WLAN_GPIO_PIN12_PAD_PULL_MASK) -#define WLAN_GPIO_PIN12_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN12_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN12_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN12_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN12_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN12_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN12_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN12_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN12_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN12_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN12_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN12_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN12_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN12_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN12_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN12_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN12_PAD_DRIVER_LSB) & WLAN_GPIO_PIN12_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN12_SOURCE_MSB 0 -#define WLAN_GPIO_PIN12_SOURCE_LSB 0 -#define WLAN_GPIO_PIN12_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN12_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN12_SOURCE_MASK) >> WLAN_GPIO_PIN12_SOURCE_LSB) -#define WLAN_GPIO_PIN12_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN12_SOURCE_LSB) & WLAN_GPIO_PIN12_SOURCE_MASK) - -#define WLAN_GPIO_PIN13_ADDRESS 0x00000084 -#define WLAN_GPIO_PIN13_OFFSET 0x00000084 -#define WLAN_GPIO_PIN13_CONFIG_MSB 14 -#define WLAN_GPIO_PIN13_CONFIG_LSB 11 -#define WLAN_GPIO_PIN13_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN13_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN13_CONFIG_MASK) >> WLAN_GPIO_PIN13_CONFIG_LSB) -#define WLAN_GPIO_PIN13_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN13_CONFIG_LSB) & WLAN_GPIO_PIN13_CONFIG_MASK) -#define WLAN_GPIO_PIN13_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN13_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN13_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN13_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN13_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN13_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN13_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN13_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN13_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN13_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN13_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN13_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN13_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN13_INT_TYPE_MASK) >> WLAN_GPIO_PIN13_INT_TYPE_LSB) -#define WLAN_GPIO_PIN13_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN13_INT_TYPE_LSB) & WLAN_GPIO_PIN13_INT_TYPE_MASK) -#define WLAN_GPIO_PIN13_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN13_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN13_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN13_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN13_PAD_PULL_MASK) >> WLAN_GPIO_PIN13_PAD_PULL_LSB) -#define WLAN_GPIO_PIN13_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN13_PAD_PULL_LSB) & WLAN_GPIO_PIN13_PAD_PULL_MASK) -#define WLAN_GPIO_PIN13_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN13_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN13_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN13_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN13_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN13_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN13_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN13_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN13_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN13_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN13_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN13_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN13_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN13_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN13_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN13_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN13_PAD_DRIVER_LSB) & WLAN_GPIO_PIN13_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN13_SOURCE_MSB 0 -#define WLAN_GPIO_PIN13_SOURCE_LSB 0 -#define WLAN_GPIO_PIN13_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN13_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN13_SOURCE_MASK) >> WLAN_GPIO_PIN13_SOURCE_LSB) -#define WLAN_GPIO_PIN13_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN13_SOURCE_LSB) & WLAN_GPIO_PIN13_SOURCE_MASK) - -#define WLAN_GPIO_PIN14_ADDRESS 0x00000088 -#define WLAN_GPIO_PIN14_OFFSET 0x00000088 -#define WLAN_GPIO_PIN14_CONFIG_MSB 14 -#define WLAN_GPIO_PIN14_CONFIG_LSB 11 -#define WLAN_GPIO_PIN14_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN14_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN14_CONFIG_MASK) >> WLAN_GPIO_PIN14_CONFIG_LSB) -#define WLAN_GPIO_PIN14_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN14_CONFIG_LSB) & WLAN_GPIO_PIN14_CONFIG_MASK) -#define WLAN_GPIO_PIN14_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN14_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN14_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN14_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN14_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN14_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN14_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN14_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN14_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN14_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN14_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN14_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN14_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN14_INT_TYPE_MASK) >> WLAN_GPIO_PIN14_INT_TYPE_LSB) -#define WLAN_GPIO_PIN14_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN14_INT_TYPE_LSB) & WLAN_GPIO_PIN14_INT_TYPE_MASK) -#define WLAN_GPIO_PIN14_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN14_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN14_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN14_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN14_PAD_PULL_MASK) >> WLAN_GPIO_PIN14_PAD_PULL_LSB) -#define WLAN_GPIO_PIN14_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN14_PAD_PULL_LSB) & WLAN_GPIO_PIN14_PAD_PULL_MASK) -#define WLAN_GPIO_PIN14_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN14_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN14_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN14_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN14_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN14_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN14_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN14_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN14_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN14_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN14_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN14_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN14_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN14_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN14_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN14_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN14_PAD_DRIVER_LSB) & WLAN_GPIO_PIN14_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN14_SOURCE_MSB 0 -#define WLAN_GPIO_PIN14_SOURCE_LSB 0 -#define WLAN_GPIO_PIN14_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN14_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN14_SOURCE_MASK) >> WLAN_GPIO_PIN14_SOURCE_LSB) -#define WLAN_GPIO_PIN14_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN14_SOURCE_LSB) & WLAN_GPIO_PIN14_SOURCE_MASK) - -#define WLAN_GPIO_PIN15_ADDRESS 0x0000008c -#define WLAN_GPIO_PIN15_OFFSET 0x0000008c -#define WLAN_GPIO_PIN15_CONFIG_MSB 14 -#define WLAN_GPIO_PIN15_CONFIG_LSB 11 -#define WLAN_GPIO_PIN15_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN15_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN15_CONFIG_MASK) >> WLAN_GPIO_PIN15_CONFIG_LSB) -#define WLAN_GPIO_PIN15_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN15_CONFIG_LSB) & WLAN_GPIO_PIN15_CONFIG_MASK) -#define WLAN_GPIO_PIN15_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN15_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN15_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN15_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN15_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN15_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN15_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN15_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN15_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN15_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN15_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN15_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN15_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN15_INT_TYPE_MASK) >> WLAN_GPIO_PIN15_INT_TYPE_LSB) -#define WLAN_GPIO_PIN15_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN15_INT_TYPE_LSB) & WLAN_GPIO_PIN15_INT_TYPE_MASK) -#define WLAN_GPIO_PIN15_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN15_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN15_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN15_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN15_PAD_PULL_MASK) >> WLAN_GPIO_PIN15_PAD_PULL_LSB) -#define WLAN_GPIO_PIN15_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN15_PAD_PULL_LSB) & WLAN_GPIO_PIN15_PAD_PULL_MASK) -#define WLAN_GPIO_PIN15_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN15_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN15_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN15_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN15_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN15_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN15_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN15_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN15_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN15_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN15_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN15_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN15_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN15_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN15_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN15_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN15_PAD_DRIVER_LSB) & WLAN_GPIO_PIN15_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN15_SOURCE_MSB 0 -#define WLAN_GPIO_PIN15_SOURCE_LSB 0 -#define WLAN_GPIO_PIN15_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN15_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN15_SOURCE_MASK) >> WLAN_GPIO_PIN15_SOURCE_LSB) -#define WLAN_GPIO_PIN15_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN15_SOURCE_LSB) & WLAN_GPIO_PIN15_SOURCE_MASK) - -#define WLAN_GPIO_PIN16_ADDRESS 0x00000090 -#define WLAN_GPIO_PIN16_OFFSET 0x00000090 -#define WLAN_GPIO_PIN16_CONFIG_MSB 14 -#define WLAN_GPIO_PIN16_CONFIG_LSB 11 -#define WLAN_GPIO_PIN16_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN16_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN16_CONFIG_MASK) >> WLAN_GPIO_PIN16_CONFIG_LSB) -#define WLAN_GPIO_PIN16_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN16_CONFIG_LSB) & WLAN_GPIO_PIN16_CONFIG_MASK) -#define WLAN_GPIO_PIN16_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN16_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN16_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN16_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN16_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN16_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN16_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN16_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN16_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN16_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN16_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN16_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN16_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN16_INT_TYPE_MASK) >> WLAN_GPIO_PIN16_INT_TYPE_LSB) -#define WLAN_GPIO_PIN16_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN16_INT_TYPE_LSB) & WLAN_GPIO_PIN16_INT_TYPE_MASK) -#define WLAN_GPIO_PIN16_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN16_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN16_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN16_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN16_PAD_PULL_MASK) >> WLAN_GPIO_PIN16_PAD_PULL_LSB) -#define WLAN_GPIO_PIN16_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN16_PAD_PULL_LSB) & WLAN_GPIO_PIN16_PAD_PULL_MASK) -#define WLAN_GPIO_PIN16_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN16_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN16_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN16_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN16_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN16_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN16_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN16_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN16_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN16_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN16_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN16_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN16_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN16_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN16_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN16_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN16_PAD_DRIVER_LSB) & WLAN_GPIO_PIN16_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN16_SOURCE_MSB 0 -#define WLAN_GPIO_PIN16_SOURCE_LSB 0 -#define WLAN_GPIO_PIN16_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN16_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN16_SOURCE_MASK) >> WLAN_GPIO_PIN16_SOURCE_LSB) -#define WLAN_GPIO_PIN16_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN16_SOURCE_LSB) & WLAN_GPIO_PIN16_SOURCE_MASK) - -#define WLAN_GPIO_PIN17_ADDRESS 0x00000094 -#define WLAN_GPIO_PIN17_OFFSET 0x00000094 -#define WLAN_GPIO_PIN17_CONFIG_MSB 14 -#define WLAN_GPIO_PIN17_CONFIG_LSB 11 -#define WLAN_GPIO_PIN17_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN17_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN17_CONFIG_MASK) >> WLAN_GPIO_PIN17_CONFIG_LSB) -#define WLAN_GPIO_PIN17_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN17_CONFIG_LSB) & WLAN_GPIO_PIN17_CONFIG_MASK) -#define WLAN_GPIO_PIN17_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN17_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN17_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN17_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN17_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN17_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN17_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN17_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN17_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN17_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN17_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN17_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN17_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN17_INT_TYPE_MASK) >> WLAN_GPIO_PIN17_INT_TYPE_LSB) -#define WLAN_GPIO_PIN17_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN17_INT_TYPE_LSB) & WLAN_GPIO_PIN17_INT_TYPE_MASK) -#define WLAN_GPIO_PIN17_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN17_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN17_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN17_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN17_PAD_PULL_MASK) >> WLAN_GPIO_PIN17_PAD_PULL_LSB) -#define WLAN_GPIO_PIN17_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN17_PAD_PULL_LSB) & WLAN_GPIO_PIN17_PAD_PULL_MASK) -#define WLAN_GPIO_PIN17_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN17_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN17_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN17_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN17_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN17_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN17_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN17_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN17_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN17_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN17_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN17_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN17_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN17_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN17_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN17_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN17_PAD_DRIVER_LSB) & WLAN_GPIO_PIN17_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN17_SOURCE_MSB 0 -#define WLAN_GPIO_PIN17_SOURCE_LSB 0 -#define WLAN_GPIO_PIN17_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN17_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN17_SOURCE_MASK) >> WLAN_GPIO_PIN17_SOURCE_LSB) -#define WLAN_GPIO_PIN17_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN17_SOURCE_LSB) & WLAN_GPIO_PIN17_SOURCE_MASK) - -#define WLAN_GPIO_PIN18_ADDRESS 0x00000098 -#define WLAN_GPIO_PIN18_OFFSET 0x00000098 -#define WLAN_GPIO_PIN18_CONFIG_MSB 14 -#define WLAN_GPIO_PIN18_CONFIG_LSB 11 -#define WLAN_GPIO_PIN18_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN18_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN18_CONFIG_MASK) >> WLAN_GPIO_PIN18_CONFIG_LSB) -#define WLAN_GPIO_PIN18_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN18_CONFIG_LSB) & WLAN_GPIO_PIN18_CONFIG_MASK) -#define WLAN_GPIO_PIN18_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN18_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN18_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN18_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN18_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN18_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN18_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN18_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN18_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN18_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN18_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN18_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN18_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN18_INT_TYPE_MASK) >> WLAN_GPIO_PIN18_INT_TYPE_LSB) -#define WLAN_GPIO_PIN18_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN18_INT_TYPE_LSB) & WLAN_GPIO_PIN18_INT_TYPE_MASK) -#define WLAN_GPIO_PIN18_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN18_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN18_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN18_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN18_PAD_PULL_MASK) >> WLAN_GPIO_PIN18_PAD_PULL_LSB) -#define WLAN_GPIO_PIN18_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN18_PAD_PULL_LSB) & WLAN_GPIO_PIN18_PAD_PULL_MASK) -#define WLAN_GPIO_PIN18_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN18_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN18_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN18_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN18_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN18_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN18_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN18_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN18_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN18_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN18_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN18_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN18_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN18_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN18_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN18_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN18_PAD_DRIVER_LSB) & WLAN_GPIO_PIN18_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN18_SOURCE_MSB 0 -#define WLAN_GPIO_PIN18_SOURCE_LSB 0 -#define WLAN_GPIO_PIN18_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN18_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN18_SOURCE_MASK) >> WLAN_GPIO_PIN18_SOURCE_LSB) -#define WLAN_GPIO_PIN18_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN18_SOURCE_LSB) & WLAN_GPIO_PIN18_SOURCE_MASK) - -#define WLAN_GPIO_PIN19_ADDRESS 0x0000009c -#define WLAN_GPIO_PIN19_OFFSET 0x0000009c -#define WLAN_GPIO_PIN19_CONFIG_MSB 14 -#define WLAN_GPIO_PIN19_CONFIG_LSB 11 -#define WLAN_GPIO_PIN19_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN19_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN19_CONFIG_MASK) >> WLAN_GPIO_PIN19_CONFIG_LSB) -#define WLAN_GPIO_PIN19_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN19_CONFIG_LSB) & WLAN_GPIO_PIN19_CONFIG_MASK) -#define WLAN_GPIO_PIN19_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN19_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN19_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN19_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN19_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN19_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN19_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN19_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN19_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN19_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN19_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN19_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN19_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN19_INT_TYPE_MASK) >> WLAN_GPIO_PIN19_INT_TYPE_LSB) -#define WLAN_GPIO_PIN19_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN19_INT_TYPE_LSB) & WLAN_GPIO_PIN19_INT_TYPE_MASK) -#define WLAN_GPIO_PIN19_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN19_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN19_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN19_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN19_PAD_PULL_MASK) >> WLAN_GPIO_PIN19_PAD_PULL_LSB) -#define WLAN_GPIO_PIN19_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN19_PAD_PULL_LSB) & WLAN_GPIO_PIN19_PAD_PULL_MASK) -#define WLAN_GPIO_PIN19_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN19_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN19_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN19_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN19_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN19_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN19_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN19_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN19_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN19_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN19_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN19_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN19_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN19_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN19_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN19_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN19_PAD_DRIVER_LSB) & WLAN_GPIO_PIN19_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN19_SOURCE_MSB 0 -#define WLAN_GPIO_PIN19_SOURCE_LSB 0 -#define WLAN_GPIO_PIN19_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN19_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN19_SOURCE_MASK) >> WLAN_GPIO_PIN19_SOURCE_LSB) -#define WLAN_GPIO_PIN19_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN19_SOURCE_LSB) & WLAN_GPIO_PIN19_SOURCE_MASK) - -#define WLAN_GPIO_PIN20_ADDRESS 0x000000a0 -#define WLAN_GPIO_PIN20_OFFSET 0x000000a0 -#define WLAN_GPIO_PIN20_CONFIG_MSB 14 -#define WLAN_GPIO_PIN20_CONFIG_LSB 11 -#define WLAN_GPIO_PIN20_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN20_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN20_CONFIG_MASK) >> WLAN_GPIO_PIN20_CONFIG_LSB) -#define WLAN_GPIO_PIN20_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN20_CONFIG_LSB) & WLAN_GPIO_PIN20_CONFIG_MASK) -#define WLAN_GPIO_PIN20_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN20_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN20_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN20_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN20_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN20_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN20_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN20_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN20_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN20_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN20_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN20_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN20_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN20_INT_TYPE_MASK) >> WLAN_GPIO_PIN20_INT_TYPE_LSB) -#define WLAN_GPIO_PIN20_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN20_INT_TYPE_LSB) & WLAN_GPIO_PIN20_INT_TYPE_MASK) -#define WLAN_GPIO_PIN20_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN20_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN20_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN20_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN20_PAD_PULL_MASK) >> WLAN_GPIO_PIN20_PAD_PULL_LSB) -#define WLAN_GPIO_PIN20_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN20_PAD_PULL_LSB) & WLAN_GPIO_PIN20_PAD_PULL_MASK) -#define WLAN_GPIO_PIN20_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN20_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN20_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN20_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN20_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN20_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN20_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN20_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN20_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN20_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN20_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN20_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN20_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN20_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN20_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN20_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN20_PAD_DRIVER_LSB) & WLAN_GPIO_PIN20_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN20_SOURCE_MSB 0 -#define WLAN_GPIO_PIN20_SOURCE_LSB 0 -#define WLAN_GPIO_PIN20_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN20_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN20_SOURCE_MASK) >> WLAN_GPIO_PIN20_SOURCE_LSB) -#define WLAN_GPIO_PIN20_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN20_SOURCE_LSB) & WLAN_GPIO_PIN20_SOURCE_MASK) - -#define WLAN_GPIO_PIN21_ADDRESS 0x000000a4 -#define WLAN_GPIO_PIN21_OFFSET 0x000000a4 -#define WLAN_GPIO_PIN21_CONFIG_MSB 14 -#define WLAN_GPIO_PIN21_CONFIG_LSB 11 -#define WLAN_GPIO_PIN21_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN21_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN21_CONFIG_MASK) >> WLAN_GPIO_PIN21_CONFIG_LSB) -#define WLAN_GPIO_PIN21_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN21_CONFIG_LSB) & WLAN_GPIO_PIN21_CONFIG_MASK) -#define WLAN_GPIO_PIN21_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN21_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN21_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN21_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN21_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN21_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN21_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN21_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN21_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN21_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN21_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN21_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN21_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN21_INT_TYPE_MASK) >> WLAN_GPIO_PIN21_INT_TYPE_LSB) -#define WLAN_GPIO_PIN21_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN21_INT_TYPE_LSB) & WLAN_GPIO_PIN21_INT_TYPE_MASK) -#define WLAN_GPIO_PIN21_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN21_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN21_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN21_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN21_PAD_PULL_MASK) >> WLAN_GPIO_PIN21_PAD_PULL_LSB) -#define WLAN_GPIO_PIN21_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN21_PAD_PULL_LSB) & WLAN_GPIO_PIN21_PAD_PULL_MASK) -#define WLAN_GPIO_PIN21_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN21_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN21_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN21_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN21_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN21_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN21_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN21_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN21_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN21_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN21_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN21_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN21_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN21_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN21_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN21_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN21_PAD_DRIVER_LSB) & WLAN_GPIO_PIN21_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN21_SOURCE_MSB 0 -#define WLAN_GPIO_PIN21_SOURCE_LSB 0 -#define WLAN_GPIO_PIN21_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN21_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN21_SOURCE_MASK) >> WLAN_GPIO_PIN21_SOURCE_LSB) -#define WLAN_GPIO_PIN21_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN21_SOURCE_LSB) & WLAN_GPIO_PIN21_SOURCE_MASK) - -#define WLAN_GPIO_PIN22_ADDRESS 0x000000a8 -#define WLAN_GPIO_PIN22_OFFSET 0x000000a8 -#define WLAN_GPIO_PIN22_CONFIG_MSB 14 -#define WLAN_GPIO_PIN22_CONFIG_LSB 11 -#define WLAN_GPIO_PIN22_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN22_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN22_CONFIG_MASK) >> WLAN_GPIO_PIN22_CONFIG_LSB) -#define WLAN_GPIO_PIN22_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN22_CONFIG_LSB) & WLAN_GPIO_PIN22_CONFIG_MASK) -#define WLAN_GPIO_PIN22_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN22_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN22_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN22_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN22_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN22_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN22_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN22_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN22_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN22_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN22_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN22_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN22_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN22_INT_TYPE_MASK) >> WLAN_GPIO_PIN22_INT_TYPE_LSB) -#define WLAN_GPIO_PIN22_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN22_INT_TYPE_LSB) & WLAN_GPIO_PIN22_INT_TYPE_MASK) -#define WLAN_GPIO_PIN22_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN22_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN22_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN22_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN22_PAD_PULL_MASK) >> WLAN_GPIO_PIN22_PAD_PULL_LSB) -#define WLAN_GPIO_PIN22_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN22_PAD_PULL_LSB) & WLAN_GPIO_PIN22_PAD_PULL_MASK) -#define WLAN_GPIO_PIN22_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN22_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN22_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN22_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN22_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN22_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN22_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN22_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN22_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN22_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN22_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN22_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN22_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN22_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN22_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN22_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN22_PAD_DRIVER_LSB) & WLAN_GPIO_PIN22_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN22_SOURCE_MSB 0 -#define WLAN_GPIO_PIN22_SOURCE_LSB 0 -#define WLAN_GPIO_PIN22_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN22_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN22_SOURCE_MASK) >> WLAN_GPIO_PIN22_SOURCE_LSB) -#define WLAN_GPIO_PIN22_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN22_SOURCE_LSB) & WLAN_GPIO_PIN22_SOURCE_MASK) - -#define WLAN_GPIO_PIN23_ADDRESS 0x000000ac -#define WLAN_GPIO_PIN23_OFFSET 0x000000ac -#define WLAN_GPIO_PIN23_CONFIG_MSB 14 -#define WLAN_GPIO_PIN23_CONFIG_LSB 11 -#define WLAN_GPIO_PIN23_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN23_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN23_CONFIG_MASK) >> WLAN_GPIO_PIN23_CONFIG_LSB) -#define WLAN_GPIO_PIN23_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN23_CONFIG_LSB) & WLAN_GPIO_PIN23_CONFIG_MASK) -#define WLAN_GPIO_PIN23_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN23_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN23_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN23_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN23_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN23_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN23_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN23_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN23_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN23_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN23_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN23_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN23_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN23_INT_TYPE_MASK) >> WLAN_GPIO_PIN23_INT_TYPE_LSB) -#define WLAN_GPIO_PIN23_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN23_INT_TYPE_LSB) & WLAN_GPIO_PIN23_INT_TYPE_MASK) -#define WLAN_GPIO_PIN23_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN23_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN23_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN23_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN23_PAD_PULL_MASK) >> WLAN_GPIO_PIN23_PAD_PULL_LSB) -#define WLAN_GPIO_PIN23_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN23_PAD_PULL_LSB) & WLAN_GPIO_PIN23_PAD_PULL_MASK) -#define WLAN_GPIO_PIN23_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN23_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN23_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN23_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN23_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN23_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN23_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN23_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN23_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN23_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN23_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN23_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN23_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN23_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN23_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN23_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN23_PAD_DRIVER_LSB) & WLAN_GPIO_PIN23_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN23_SOURCE_MSB 0 -#define WLAN_GPIO_PIN23_SOURCE_LSB 0 -#define WLAN_GPIO_PIN23_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN23_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN23_SOURCE_MASK) >> WLAN_GPIO_PIN23_SOURCE_LSB) -#define WLAN_GPIO_PIN23_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN23_SOURCE_LSB) & WLAN_GPIO_PIN23_SOURCE_MASK) - -#define WLAN_GPIO_PIN24_ADDRESS 0x000000b0 -#define WLAN_GPIO_PIN24_OFFSET 0x000000b0 -#define WLAN_GPIO_PIN24_CONFIG_MSB 14 -#define WLAN_GPIO_PIN24_CONFIG_LSB 11 -#define WLAN_GPIO_PIN24_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN24_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN24_CONFIG_MASK) >> WLAN_GPIO_PIN24_CONFIG_LSB) -#define WLAN_GPIO_PIN24_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN24_CONFIG_LSB) & WLAN_GPIO_PIN24_CONFIG_MASK) -#define WLAN_GPIO_PIN24_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN24_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN24_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN24_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN24_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN24_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN24_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN24_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN24_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN24_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN24_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN24_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN24_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN24_INT_TYPE_MASK) >> WLAN_GPIO_PIN24_INT_TYPE_LSB) -#define WLAN_GPIO_PIN24_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN24_INT_TYPE_LSB) & WLAN_GPIO_PIN24_INT_TYPE_MASK) -#define WLAN_GPIO_PIN24_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN24_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN24_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN24_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN24_PAD_PULL_MASK) >> WLAN_GPIO_PIN24_PAD_PULL_LSB) -#define WLAN_GPIO_PIN24_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN24_PAD_PULL_LSB) & WLAN_GPIO_PIN24_PAD_PULL_MASK) -#define WLAN_GPIO_PIN24_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN24_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN24_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN24_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN24_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN24_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN24_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN24_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN24_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN24_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN24_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN24_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN24_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN24_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN24_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN24_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN24_PAD_DRIVER_LSB) & WLAN_GPIO_PIN24_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN24_SOURCE_MSB 0 -#define WLAN_GPIO_PIN24_SOURCE_LSB 0 -#define WLAN_GPIO_PIN24_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN24_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN24_SOURCE_MASK) >> WLAN_GPIO_PIN24_SOURCE_LSB) -#define WLAN_GPIO_PIN24_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN24_SOURCE_LSB) & WLAN_GPIO_PIN24_SOURCE_MASK) - -#define WLAN_GPIO_PIN25_ADDRESS 0x000000b4 -#define WLAN_GPIO_PIN25_OFFSET 0x000000b4 -#define WLAN_GPIO_PIN25_CONFIG_MSB 14 -#define WLAN_GPIO_PIN25_CONFIG_LSB 11 -#define WLAN_GPIO_PIN25_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN25_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN25_CONFIG_MASK) >> WLAN_GPIO_PIN25_CONFIG_LSB) -#define WLAN_GPIO_PIN25_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN25_CONFIG_LSB) & WLAN_GPIO_PIN25_CONFIG_MASK) -#define WLAN_GPIO_PIN25_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN25_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN25_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN25_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN25_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN25_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN25_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN25_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN25_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN25_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN25_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN25_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN25_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN25_INT_TYPE_MASK) >> WLAN_GPIO_PIN25_INT_TYPE_LSB) -#define WLAN_GPIO_PIN25_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN25_INT_TYPE_LSB) & WLAN_GPIO_PIN25_INT_TYPE_MASK) -#define WLAN_GPIO_PIN25_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN25_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN25_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN25_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN25_PAD_PULL_MASK) >> WLAN_GPIO_PIN25_PAD_PULL_LSB) -#define WLAN_GPIO_PIN25_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN25_PAD_PULL_LSB) & WLAN_GPIO_PIN25_PAD_PULL_MASK) -#define WLAN_GPIO_PIN25_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN25_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN25_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN25_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN25_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN25_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN25_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN25_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN25_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN25_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN25_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN25_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN25_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN25_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN25_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN25_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN25_PAD_DRIVER_LSB) & WLAN_GPIO_PIN25_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN25_SOURCE_MSB 0 -#define WLAN_GPIO_PIN25_SOURCE_LSB 0 -#define WLAN_GPIO_PIN25_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN25_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN25_SOURCE_MASK) >> WLAN_GPIO_PIN25_SOURCE_LSB) -#define WLAN_GPIO_PIN25_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN25_SOURCE_LSB) & WLAN_GPIO_PIN25_SOURCE_MASK) - -#define WLAN_GPIO_PIN26_ADDRESS 0x000000b8 -#define WLAN_GPIO_PIN26_OFFSET 0x000000b8 -#define WLAN_GPIO_PIN26_CONFIG_MSB 14 -#define WLAN_GPIO_PIN26_CONFIG_LSB 11 -#define WLAN_GPIO_PIN26_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN26_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN26_CONFIG_MASK) >> WLAN_GPIO_PIN26_CONFIG_LSB) -#define WLAN_GPIO_PIN26_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN26_CONFIG_LSB) & WLAN_GPIO_PIN26_CONFIG_MASK) -#define WLAN_GPIO_PIN26_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN26_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN26_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN26_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN26_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN26_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN26_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN26_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN26_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN26_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN26_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN26_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN26_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN26_INT_TYPE_MASK) >> WLAN_GPIO_PIN26_INT_TYPE_LSB) -#define WLAN_GPIO_PIN26_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN26_INT_TYPE_LSB) & WLAN_GPIO_PIN26_INT_TYPE_MASK) -#define WLAN_GPIO_PIN26_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN26_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN26_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN26_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN26_PAD_PULL_MASK) >> WLAN_GPIO_PIN26_PAD_PULL_LSB) -#define WLAN_GPIO_PIN26_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN26_PAD_PULL_LSB) & WLAN_GPIO_PIN26_PAD_PULL_MASK) -#define WLAN_GPIO_PIN26_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN26_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN26_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN26_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN26_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN26_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN26_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN26_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN26_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN26_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN26_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN26_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN26_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN26_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN26_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN26_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN26_PAD_DRIVER_LSB) & WLAN_GPIO_PIN26_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN26_SOURCE_MSB 0 -#define WLAN_GPIO_PIN26_SOURCE_LSB 0 -#define WLAN_GPIO_PIN26_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN26_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN26_SOURCE_MASK) >> WLAN_GPIO_PIN26_SOURCE_LSB) -#define WLAN_GPIO_PIN26_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN26_SOURCE_LSB) & WLAN_GPIO_PIN26_SOURCE_MASK) - -#define WLAN_GPIO_PIN27_ADDRESS 0x000000bc -#define WLAN_GPIO_PIN27_OFFSET 0x000000bc -#define WLAN_GPIO_PIN27_CONFIG_MSB 14 -#define WLAN_GPIO_PIN27_CONFIG_LSB 11 -#define WLAN_GPIO_PIN27_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN27_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN27_CONFIG_MASK) >> WLAN_GPIO_PIN27_CONFIG_LSB) -#define WLAN_GPIO_PIN27_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN27_CONFIG_LSB) & WLAN_GPIO_PIN27_CONFIG_MASK) -#define WLAN_GPIO_PIN27_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN27_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN27_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN27_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN27_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN27_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN27_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN27_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN27_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN27_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN27_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN27_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN27_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN27_INT_TYPE_MASK) >> WLAN_GPIO_PIN27_INT_TYPE_LSB) -#define WLAN_GPIO_PIN27_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN27_INT_TYPE_LSB) & WLAN_GPIO_PIN27_INT_TYPE_MASK) -#define WLAN_GPIO_PIN27_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN27_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN27_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN27_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN27_PAD_PULL_MASK) >> WLAN_GPIO_PIN27_PAD_PULL_LSB) -#define WLAN_GPIO_PIN27_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN27_PAD_PULL_LSB) & WLAN_GPIO_PIN27_PAD_PULL_MASK) -#define WLAN_GPIO_PIN27_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN27_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN27_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN27_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN27_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN27_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN27_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN27_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN27_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN27_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN27_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN27_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN27_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN27_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN27_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN27_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN27_PAD_DRIVER_LSB) & WLAN_GPIO_PIN27_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN27_SOURCE_MSB 0 -#define WLAN_GPIO_PIN27_SOURCE_LSB 0 -#define WLAN_GPIO_PIN27_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN27_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN27_SOURCE_MASK) >> WLAN_GPIO_PIN27_SOURCE_LSB) -#define WLAN_GPIO_PIN27_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN27_SOURCE_LSB) & WLAN_GPIO_PIN27_SOURCE_MASK) - -#define WLAN_GPIO_PIN28_ADDRESS 0x000000c0 -#define WLAN_GPIO_PIN28_OFFSET 0x000000c0 -#define WLAN_GPIO_PIN28_CONFIG_MSB 14 -#define WLAN_GPIO_PIN28_CONFIG_LSB 11 -#define WLAN_GPIO_PIN28_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN28_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN28_CONFIG_MASK) >> WLAN_GPIO_PIN28_CONFIG_LSB) -#define WLAN_GPIO_PIN28_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN28_CONFIG_LSB) & WLAN_GPIO_PIN28_CONFIG_MASK) -#define WLAN_GPIO_PIN28_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN28_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN28_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN28_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN28_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN28_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN28_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN28_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN28_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN28_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN28_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN28_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN28_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN28_INT_TYPE_MASK) >> WLAN_GPIO_PIN28_INT_TYPE_LSB) -#define WLAN_GPIO_PIN28_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN28_INT_TYPE_LSB) & WLAN_GPIO_PIN28_INT_TYPE_MASK) -#define WLAN_GPIO_PIN28_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN28_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN28_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN28_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN28_PAD_PULL_MASK) >> WLAN_GPIO_PIN28_PAD_PULL_LSB) -#define WLAN_GPIO_PIN28_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN28_PAD_PULL_LSB) & WLAN_GPIO_PIN28_PAD_PULL_MASK) -#define WLAN_GPIO_PIN28_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN28_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN28_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN28_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN28_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN28_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN28_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN28_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN28_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN28_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN28_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN28_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN28_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN28_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN28_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN28_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN28_PAD_DRIVER_LSB) & WLAN_GPIO_PIN28_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN28_SOURCE_MSB 0 -#define WLAN_GPIO_PIN28_SOURCE_LSB 0 -#define WLAN_GPIO_PIN28_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN28_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN28_SOURCE_MASK) >> WLAN_GPIO_PIN28_SOURCE_LSB) -#define WLAN_GPIO_PIN28_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN28_SOURCE_LSB) & WLAN_GPIO_PIN28_SOURCE_MASK) - -#define WLAN_GPIO_PIN29_ADDRESS 0x000000c4 -#define WLAN_GPIO_PIN29_OFFSET 0x000000c4 -#define WLAN_GPIO_PIN29_CONFIG_MSB 14 -#define WLAN_GPIO_PIN29_CONFIG_LSB 11 -#define WLAN_GPIO_PIN29_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN29_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN29_CONFIG_MASK) >> WLAN_GPIO_PIN29_CONFIG_LSB) -#define WLAN_GPIO_PIN29_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN29_CONFIG_LSB) & WLAN_GPIO_PIN29_CONFIG_MASK) -#define WLAN_GPIO_PIN29_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN29_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN29_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN29_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN29_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN29_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN29_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN29_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN29_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN29_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN29_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN29_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN29_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN29_INT_TYPE_MASK) >> WLAN_GPIO_PIN29_INT_TYPE_LSB) -#define WLAN_GPIO_PIN29_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN29_INT_TYPE_LSB) & WLAN_GPIO_PIN29_INT_TYPE_MASK) -#define WLAN_GPIO_PIN29_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN29_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN29_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN29_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN29_PAD_PULL_MASK) >> WLAN_GPIO_PIN29_PAD_PULL_LSB) -#define WLAN_GPIO_PIN29_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN29_PAD_PULL_LSB) & WLAN_GPIO_PIN29_PAD_PULL_MASK) -#define WLAN_GPIO_PIN29_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN29_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN29_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN29_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN29_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN29_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN29_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN29_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN29_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN29_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN29_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN29_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN29_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN29_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN29_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN29_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN29_PAD_DRIVER_LSB) & WLAN_GPIO_PIN29_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN29_SOURCE_MSB 0 -#define WLAN_GPIO_PIN29_SOURCE_LSB 0 -#define WLAN_GPIO_PIN29_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN29_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN29_SOURCE_MASK) >> WLAN_GPIO_PIN29_SOURCE_LSB) -#define WLAN_GPIO_PIN29_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN29_SOURCE_LSB) & WLAN_GPIO_PIN29_SOURCE_MASK) - -#define WLAN_GPIO_PIN30_ADDRESS 0x000000c8 -#define WLAN_GPIO_PIN30_OFFSET 0x000000c8 -#define WLAN_GPIO_PIN30_CONFIG_MSB 14 -#define WLAN_GPIO_PIN30_CONFIG_LSB 11 -#define WLAN_GPIO_PIN30_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN30_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN30_CONFIG_MASK) >> WLAN_GPIO_PIN30_CONFIG_LSB) -#define WLAN_GPIO_PIN30_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN30_CONFIG_LSB) & WLAN_GPIO_PIN30_CONFIG_MASK) -#define WLAN_GPIO_PIN30_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN30_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN30_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN30_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN30_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN30_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN30_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN30_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN30_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN30_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN30_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN30_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN30_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN30_INT_TYPE_MASK) >> WLAN_GPIO_PIN30_INT_TYPE_LSB) -#define WLAN_GPIO_PIN30_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN30_INT_TYPE_LSB) & WLAN_GPIO_PIN30_INT_TYPE_MASK) -#define WLAN_GPIO_PIN30_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN30_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN30_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN30_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN30_PAD_PULL_MASK) >> WLAN_GPIO_PIN30_PAD_PULL_LSB) -#define WLAN_GPIO_PIN30_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN30_PAD_PULL_LSB) & WLAN_GPIO_PIN30_PAD_PULL_MASK) -#define WLAN_GPIO_PIN30_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN30_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN30_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN30_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN30_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN30_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN30_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN30_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN30_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN30_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN30_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN30_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN30_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN30_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN30_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN30_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN30_PAD_DRIVER_LSB) & WLAN_GPIO_PIN30_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN30_SOURCE_MSB 0 -#define WLAN_GPIO_PIN30_SOURCE_LSB 0 -#define WLAN_GPIO_PIN30_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN30_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN30_SOURCE_MASK) >> WLAN_GPIO_PIN30_SOURCE_LSB) -#define WLAN_GPIO_PIN30_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN30_SOURCE_LSB) & WLAN_GPIO_PIN30_SOURCE_MASK) - -#define WLAN_GPIO_PIN31_ADDRESS 0x000000cc -#define WLAN_GPIO_PIN31_OFFSET 0x000000cc -#define WLAN_GPIO_PIN31_CONFIG_MSB 14 -#define WLAN_GPIO_PIN31_CONFIG_LSB 11 -#define WLAN_GPIO_PIN31_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN31_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN31_CONFIG_MASK) >> WLAN_GPIO_PIN31_CONFIG_LSB) -#define WLAN_GPIO_PIN31_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN31_CONFIG_LSB) & WLAN_GPIO_PIN31_CONFIG_MASK) -#define WLAN_GPIO_PIN31_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN31_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN31_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN31_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN31_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN31_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN31_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN31_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN31_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN31_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN31_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN31_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN31_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN31_INT_TYPE_MASK) >> WLAN_GPIO_PIN31_INT_TYPE_LSB) -#define WLAN_GPIO_PIN31_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN31_INT_TYPE_LSB) & WLAN_GPIO_PIN31_INT_TYPE_MASK) -#define WLAN_GPIO_PIN31_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN31_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN31_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN31_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN31_PAD_PULL_MASK) >> WLAN_GPIO_PIN31_PAD_PULL_LSB) -#define WLAN_GPIO_PIN31_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN31_PAD_PULL_LSB) & WLAN_GPIO_PIN31_PAD_PULL_MASK) -#define WLAN_GPIO_PIN31_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN31_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN31_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN31_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN31_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN31_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN31_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN31_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN31_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN31_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN31_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN31_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN31_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN31_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN31_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN31_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN31_PAD_DRIVER_LSB) & WLAN_GPIO_PIN31_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN31_SOURCE_MSB 0 -#define WLAN_GPIO_PIN31_SOURCE_LSB 0 -#define WLAN_GPIO_PIN31_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN31_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN31_SOURCE_MASK) >> WLAN_GPIO_PIN31_SOURCE_LSB) -#define WLAN_GPIO_PIN31_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN31_SOURCE_LSB) & WLAN_GPIO_PIN31_SOURCE_MASK) - -#define WLAN_GPIO_PIN32_ADDRESS 0x000000d0 -#define WLAN_GPIO_PIN32_OFFSET 0x000000d0 -#define WLAN_GPIO_PIN32_CONFIG_MSB 14 -#define WLAN_GPIO_PIN32_CONFIG_LSB 11 -#define WLAN_GPIO_PIN32_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN32_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN32_CONFIG_MASK) >> WLAN_GPIO_PIN32_CONFIG_LSB) -#define WLAN_GPIO_PIN32_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN32_CONFIG_LSB) & WLAN_GPIO_PIN32_CONFIG_MASK) -#define WLAN_GPIO_PIN32_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN32_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN32_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN32_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN32_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN32_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN32_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN32_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN32_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN32_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN32_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN32_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN32_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN32_INT_TYPE_MASK) >> WLAN_GPIO_PIN32_INT_TYPE_LSB) -#define WLAN_GPIO_PIN32_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN32_INT_TYPE_LSB) & WLAN_GPIO_PIN32_INT_TYPE_MASK) -#define WLAN_GPIO_PIN32_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN32_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN32_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN32_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN32_PAD_PULL_MASK) >> WLAN_GPIO_PIN32_PAD_PULL_LSB) -#define WLAN_GPIO_PIN32_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN32_PAD_PULL_LSB) & WLAN_GPIO_PIN32_PAD_PULL_MASK) -#define WLAN_GPIO_PIN32_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN32_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN32_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN32_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN32_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN32_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN32_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN32_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN32_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN32_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN32_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN32_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN32_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN32_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN32_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN32_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN32_PAD_DRIVER_LSB) & WLAN_GPIO_PIN32_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN32_SOURCE_MSB 0 -#define WLAN_GPIO_PIN32_SOURCE_LSB 0 -#define WLAN_GPIO_PIN32_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN32_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN32_SOURCE_MASK) >> WLAN_GPIO_PIN32_SOURCE_LSB) -#define WLAN_GPIO_PIN32_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN32_SOURCE_LSB) & WLAN_GPIO_PIN32_SOURCE_MASK) - -#define WLAN_GPIO_PIN33_ADDRESS 0x000000d4 -#define WLAN_GPIO_PIN33_OFFSET 0x000000d4 -#define WLAN_GPIO_PIN33_CONFIG_MSB 14 -#define WLAN_GPIO_PIN33_CONFIG_LSB 11 -#define WLAN_GPIO_PIN33_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN33_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN33_CONFIG_MASK) >> WLAN_GPIO_PIN33_CONFIG_LSB) -#define WLAN_GPIO_PIN33_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN33_CONFIG_LSB) & WLAN_GPIO_PIN33_CONFIG_MASK) -#define WLAN_GPIO_PIN33_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN33_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN33_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN33_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN33_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN33_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN33_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN33_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN33_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN33_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN33_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN33_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN33_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN33_INT_TYPE_MASK) >> WLAN_GPIO_PIN33_INT_TYPE_LSB) -#define WLAN_GPIO_PIN33_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN33_INT_TYPE_LSB) & WLAN_GPIO_PIN33_INT_TYPE_MASK) -#define WLAN_GPIO_PIN33_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN33_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN33_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN33_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN33_PAD_PULL_MASK) >> WLAN_GPIO_PIN33_PAD_PULL_LSB) -#define WLAN_GPIO_PIN33_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN33_PAD_PULL_LSB) & WLAN_GPIO_PIN33_PAD_PULL_MASK) -#define WLAN_GPIO_PIN33_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN33_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN33_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN33_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN33_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN33_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN33_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN33_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN33_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN33_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN33_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN33_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN33_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN33_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN33_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN33_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN33_PAD_DRIVER_LSB) & WLAN_GPIO_PIN33_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN33_SOURCE_MSB 0 -#define WLAN_GPIO_PIN33_SOURCE_LSB 0 -#define WLAN_GPIO_PIN33_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN33_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN33_SOURCE_MASK) >> WLAN_GPIO_PIN33_SOURCE_LSB) -#define WLAN_GPIO_PIN33_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN33_SOURCE_LSB) & WLAN_GPIO_PIN33_SOURCE_MASK) - -#define WLAN_GPIO_PIN34_ADDRESS 0x000000d8 -#define WLAN_GPIO_PIN34_OFFSET 0x000000d8 -#define WLAN_GPIO_PIN34_CONFIG_MSB 14 -#define WLAN_GPIO_PIN34_CONFIG_LSB 11 -#define WLAN_GPIO_PIN34_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN34_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN34_CONFIG_MASK) >> WLAN_GPIO_PIN34_CONFIG_LSB) -#define WLAN_GPIO_PIN34_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN34_CONFIG_LSB) & WLAN_GPIO_PIN34_CONFIG_MASK) -#define WLAN_GPIO_PIN34_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN34_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN34_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN34_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN34_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN34_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN34_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN34_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN34_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN34_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN34_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN34_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN34_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN34_INT_TYPE_MASK) >> WLAN_GPIO_PIN34_INT_TYPE_LSB) -#define WLAN_GPIO_PIN34_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN34_INT_TYPE_LSB) & WLAN_GPIO_PIN34_INT_TYPE_MASK) -#define WLAN_GPIO_PIN34_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN34_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN34_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN34_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN34_PAD_PULL_MASK) >> WLAN_GPIO_PIN34_PAD_PULL_LSB) -#define WLAN_GPIO_PIN34_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN34_PAD_PULL_LSB) & WLAN_GPIO_PIN34_PAD_PULL_MASK) -#define WLAN_GPIO_PIN34_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN34_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN34_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN34_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN34_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN34_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN34_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN34_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN34_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN34_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN34_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN34_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN34_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN34_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN34_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN34_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN34_PAD_DRIVER_LSB) & WLAN_GPIO_PIN34_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN34_SOURCE_MSB 0 -#define WLAN_GPIO_PIN34_SOURCE_LSB 0 -#define WLAN_GPIO_PIN34_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN34_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN34_SOURCE_MASK) >> WLAN_GPIO_PIN34_SOURCE_LSB) -#define WLAN_GPIO_PIN34_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN34_SOURCE_LSB) & WLAN_GPIO_PIN34_SOURCE_MASK) - -#define WLAN_GPIO_PIN35_ADDRESS 0x000000dc -#define WLAN_GPIO_PIN35_OFFSET 0x000000dc -#define WLAN_GPIO_PIN35_CONFIG_MSB 14 -#define WLAN_GPIO_PIN35_CONFIG_LSB 11 -#define WLAN_GPIO_PIN35_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN35_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN35_CONFIG_MASK) >> WLAN_GPIO_PIN35_CONFIG_LSB) -#define WLAN_GPIO_PIN35_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN35_CONFIG_LSB) & WLAN_GPIO_PIN35_CONFIG_MASK) -#define WLAN_GPIO_PIN35_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN35_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN35_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN35_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN35_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN35_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN35_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN35_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN35_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN35_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN35_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN35_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN35_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN35_INT_TYPE_MASK) >> WLAN_GPIO_PIN35_INT_TYPE_LSB) -#define WLAN_GPIO_PIN35_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN35_INT_TYPE_LSB) & WLAN_GPIO_PIN35_INT_TYPE_MASK) -#define WLAN_GPIO_PIN35_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN35_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN35_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN35_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN35_PAD_PULL_MASK) >> WLAN_GPIO_PIN35_PAD_PULL_LSB) -#define WLAN_GPIO_PIN35_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN35_PAD_PULL_LSB) & WLAN_GPIO_PIN35_PAD_PULL_MASK) -#define WLAN_GPIO_PIN35_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN35_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN35_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN35_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN35_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN35_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN35_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN35_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN35_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN35_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN35_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN35_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN35_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN35_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN35_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN35_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN35_PAD_DRIVER_LSB) & WLAN_GPIO_PIN35_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN35_SOURCE_MSB 0 -#define WLAN_GPIO_PIN35_SOURCE_LSB 0 -#define WLAN_GPIO_PIN35_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN35_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN35_SOURCE_MASK) >> WLAN_GPIO_PIN35_SOURCE_LSB) -#define WLAN_GPIO_PIN35_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN35_SOURCE_LSB) & WLAN_GPIO_PIN35_SOURCE_MASK) - -#define WLAN_GPIO_PIN36_ADDRESS 0x000000e0 -#define WLAN_GPIO_PIN36_OFFSET 0x000000e0 -#define WLAN_GPIO_PIN36_CONFIG_MSB 14 -#define WLAN_GPIO_PIN36_CONFIG_LSB 11 -#define WLAN_GPIO_PIN36_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN36_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN36_CONFIG_MASK) >> WLAN_GPIO_PIN36_CONFIG_LSB) -#define WLAN_GPIO_PIN36_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN36_CONFIG_LSB) & WLAN_GPIO_PIN36_CONFIG_MASK) -#define WLAN_GPIO_PIN36_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN36_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN36_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN36_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN36_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN36_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN36_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN36_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN36_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN36_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN36_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN36_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN36_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN36_INT_TYPE_MASK) >> WLAN_GPIO_PIN36_INT_TYPE_LSB) -#define WLAN_GPIO_PIN36_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN36_INT_TYPE_LSB) & WLAN_GPIO_PIN36_INT_TYPE_MASK) -#define WLAN_GPIO_PIN36_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN36_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN36_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN36_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN36_PAD_PULL_MASK) >> WLAN_GPIO_PIN36_PAD_PULL_LSB) -#define WLAN_GPIO_PIN36_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN36_PAD_PULL_LSB) & WLAN_GPIO_PIN36_PAD_PULL_MASK) -#define WLAN_GPIO_PIN36_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN36_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN36_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN36_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN36_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN36_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN36_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN36_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN36_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN36_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN36_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN36_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN36_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN36_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN36_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN36_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN36_PAD_DRIVER_LSB) & WLAN_GPIO_PIN36_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN36_SOURCE_MSB 0 -#define WLAN_GPIO_PIN36_SOURCE_LSB 0 -#define WLAN_GPIO_PIN36_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN36_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN36_SOURCE_MASK) >> WLAN_GPIO_PIN36_SOURCE_LSB) -#define WLAN_GPIO_PIN36_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN36_SOURCE_LSB) & WLAN_GPIO_PIN36_SOURCE_MASK) - -#define WLAN_GPIO_PIN37_ADDRESS 0x000000e4 -#define WLAN_GPIO_PIN37_OFFSET 0x000000e4 -#define WLAN_GPIO_PIN37_CONFIG_MSB 14 -#define WLAN_GPIO_PIN37_CONFIG_LSB 11 -#define WLAN_GPIO_PIN37_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN37_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN37_CONFIG_MASK) >> WLAN_GPIO_PIN37_CONFIG_LSB) -#define WLAN_GPIO_PIN37_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN37_CONFIG_LSB) & WLAN_GPIO_PIN37_CONFIG_MASK) -#define WLAN_GPIO_PIN37_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN37_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN37_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN37_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN37_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN37_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN37_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN37_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN37_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN37_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN37_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN37_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN37_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN37_INT_TYPE_MASK) >> WLAN_GPIO_PIN37_INT_TYPE_LSB) -#define WLAN_GPIO_PIN37_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN37_INT_TYPE_LSB) & WLAN_GPIO_PIN37_INT_TYPE_MASK) -#define WLAN_GPIO_PIN37_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN37_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN37_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN37_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN37_PAD_PULL_MASK) >> WLAN_GPIO_PIN37_PAD_PULL_LSB) -#define WLAN_GPIO_PIN37_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN37_PAD_PULL_LSB) & WLAN_GPIO_PIN37_PAD_PULL_MASK) -#define WLAN_GPIO_PIN37_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN37_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN37_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN37_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN37_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN37_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN37_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN37_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN37_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN37_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN37_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN37_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN37_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN37_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN37_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN37_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN37_PAD_DRIVER_LSB) & WLAN_GPIO_PIN37_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN37_SOURCE_MSB 0 -#define WLAN_GPIO_PIN37_SOURCE_LSB 0 -#define WLAN_GPIO_PIN37_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN37_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN37_SOURCE_MASK) >> WLAN_GPIO_PIN37_SOURCE_LSB) -#define WLAN_GPIO_PIN37_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN37_SOURCE_LSB) & WLAN_GPIO_PIN37_SOURCE_MASK) - -#define WLAN_GPIO_PIN38_ADDRESS 0x000000e8 -#define WLAN_GPIO_PIN38_OFFSET 0x000000e8 -#define WLAN_GPIO_PIN38_CONFIG_MSB 14 -#define WLAN_GPIO_PIN38_CONFIG_LSB 11 -#define WLAN_GPIO_PIN38_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN38_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN38_CONFIG_MASK) >> WLAN_GPIO_PIN38_CONFIG_LSB) -#define WLAN_GPIO_PIN38_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN38_CONFIG_LSB) & WLAN_GPIO_PIN38_CONFIG_MASK) -#define WLAN_GPIO_PIN38_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN38_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN38_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN38_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN38_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN38_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN38_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN38_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN38_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN38_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN38_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN38_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN38_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN38_INT_TYPE_MASK) >> WLAN_GPIO_PIN38_INT_TYPE_LSB) -#define WLAN_GPIO_PIN38_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN38_INT_TYPE_LSB) & WLAN_GPIO_PIN38_INT_TYPE_MASK) -#define WLAN_GPIO_PIN38_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN38_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN38_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN38_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN38_PAD_PULL_MASK) >> WLAN_GPIO_PIN38_PAD_PULL_LSB) -#define WLAN_GPIO_PIN38_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN38_PAD_PULL_LSB) & WLAN_GPIO_PIN38_PAD_PULL_MASK) -#define WLAN_GPIO_PIN38_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN38_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN38_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN38_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN38_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN38_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN38_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN38_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN38_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN38_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN38_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN38_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN38_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN38_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN38_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN38_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN38_PAD_DRIVER_LSB) & WLAN_GPIO_PIN38_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN38_SOURCE_MSB 0 -#define WLAN_GPIO_PIN38_SOURCE_LSB 0 -#define WLAN_GPIO_PIN38_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN38_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN38_SOURCE_MASK) >> WLAN_GPIO_PIN38_SOURCE_LSB) -#define WLAN_GPIO_PIN38_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN38_SOURCE_LSB) & WLAN_GPIO_PIN38_SOURCE_MASK) - -#define WLAN_GPIO_PIN39_ADDRESS 0x000000ec -#define WLAN_GPIO_PIN39_OFFSET 0x000000ec -#define WLAN_GPIO_PIN39_CONFIG_MSB 14 -#define WLAN_GPIO_PIN39_CONFIG_LSB 11 -#define WLAN_GPIO_PIN39_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN39_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN39_CONFIG_MASK) >> WLAN_GPIO_PIN39_CONFIG_LSB) -#define WLAN_GPIO_PIN39_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN39_CONFIG_LSB) & WLAN_GPIO_PIN39_CONFIG_MASK) -#define WLAN_GPIO_PIN39_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN39_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN39_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN39_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN39_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN39_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN39_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN39_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN39_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN39_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN39_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN39_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN39_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN39_INT_TYPE_MASK) >> WLAN_GPIO_PIN39_INT_TYPE_LSB) -#define WLAN_GPIO_PIN39_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN39_INT_TYPE_LSB) & WLAN_GPIO_PIN39_INT_TYPE_MASK) -#define WLAN_GPIO_PIN39_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN39_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN39_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN39_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN39_PAD_PULL_MASK) >> WLAN_GPIO_PIN39_PAD_PULL_LSB) -#define WLAN_GPIO_PIN39_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN39_PAD_PULL_LSB) & WLAN_GPIO_PIN39_PAD_PULL_MASK) -#define WLAN_GPIO_PIN39_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN39_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN39_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN39_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN39_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN39_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN39_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN39_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN39_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN39_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN39_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN39_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN39_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN39_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN39_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN39_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN39_PAD_DRIVER_LSB) & WLAN_GPIO_PIN39_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN39_SOURCE_MSB 0 -#define WLAN_GPIO_PIN39_SOURCE_LSB 0 -#define WLAN_GPIO_PIN39_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN39_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN39_SOURCE_MASK) >> WLAN_GPIO_PIN39_SOURCE_LSB) -#define WLAN_GPIO_PIN39_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN39_SOURCE_LSB) & WLAN_GPIO_PIN39_SOURCE_MASK) - -#define WLAN_GPIO_PIN40_ADDRESS 0x000000f0 -#define WLAN_GPIO_PIN40_OFFSET 0x000000f0 -#define WLAN_GPIO_PIN40_CONFIG_MSB 14 -#define WLAN_GPIO_PIN40_CONFIG_LSB 11 -#define WLAN_GPIO_PIN40_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN40_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN40_CONFIG_MASK) >> WLAN_GPIO_PIN40_CONFIG_LSB) -#define WLAN_GPIO_PIN40_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN40_CONFIG_LSB) & WLAN_GPIO_PIN40_CONFIG_MASK) -#define WLAN_GPIO_PIN40_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN40_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN40_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN40_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN40_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN40_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN40_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN40_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN40_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN40_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN40_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN40_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN40_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN40_INT_TYPE_MASK) >> WLAN_GPIO_PIN40_INT_TYPE_LSB) -#define WLAN_GPIO_PIN40_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN40_INT_TYPE_LSB) & WLAN_GPIO_PIN40_INT_TYPE_MASK) -#define WLAN_GPIO_PIN40_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN40_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN40_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN40_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN40_PAD_PULL_MASK) >> WLAN_GPIO_PIN40_PAD_PULL_LSB) -#define WLAN_GPIO_PIN40_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN40_PAD_PULL_LSB) & WLAN_GPIO_PIN40_PAD_PULL_MASK) -#define WLAN_GPIO_PIN40_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN40_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN40_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN40_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN40_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN40_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN40_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN40_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN40_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN40_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN40_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN40_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN40_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN40_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN40_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN40_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN40_PAD_DRIVER_LSB) & WLAN_GPIO_PIN40_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN40_SOURCE_MSB 0 -#define WLAN_GPIO_PIN40_SOURCE_LSB 0 -#define WLAN_GPIO_PIN40_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN40_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN40_SOURCE_MASK) >> WLAN_GPIO_PIN40_SOURCE_LSB) -#define WLAN_GPIO_PIN40_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN40_SOURCE_LSB) & WLAN_GPIO_PIN40_SOURCE_MASK) - -#define WLAN_GPIO_PIN41_ADDRESS 0x000000f4 -#define WLAN_GPIO_PIN41_OFFSET 0x000000f4 -#define WLAN_GPIO_PIN41_CONFIG_MSB 14 -#define WLAN_GPIO_PIN41_CONFIG_LSB 11 -#define WLAN_GPIO_PIN41_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN41_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN41_CONFIG_MASK) >> WLAN_GPIO_PIN41_CONFIG_LSB) -#define WLAN_GPIO_PIN41_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN41_CONFIG_LSB) & WLAN_GPIO_PIN41_CONFIG_MASK) -#define WLAN_GPIO_PIN41_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN41_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN41_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN41_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN41_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN41_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN41_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN41_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN41_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN41_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN41_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN41_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN41_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN41_INT_TYPE_MASK) >> WLAN_GPIO_PIN41_INT_TYPE_LSB) -#define WLAN_GPIO_PIN41_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN41_INT_TYPE_LSB) & WLAN_GPIO_PIN41_INT_TYPE_MASK) -#define WLAN_GPIO_PIN41_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN41_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN41_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN41_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN41_PAD_PULL_MASK) >> WLAN_GPIO_PIN41_PAD_PULL_LSB) -#define WLAN_GPIO_PIN41_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN41_PAD_PULL_LSB) & WLAN_GPIO_PIN41_PAD_PULL_MASK) -#define WLAN_GPIO_PIN41_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN41_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN41_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN41_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN41_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN41_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN41_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN41_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN41_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN41_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN41_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN41_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN41_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN41_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN41_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN41_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN41_PAD_DRIVER_LSB) & WLAN_GPIO_PIN41_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN41_SOURCE_MSB 0 -#define WLAN_GPIO_PIN41_SOURCE_LSB 0 -#define WLAN_GPIO_PIN41_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN41_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN41_SOURCE_MASK) >> WLAN_GPIO_PIN41_SOURCE_LSB) -#define WLAN_GPIO_PIN41_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN41_SOURCE_LSB) & WLAN_GPIO_PIN41_SOURCE_MASK) - -#define WLAN_GPIO_PIN42_ADDRESS 0x000000f8 -#define WLAN_GPIO_PIN42_OFFSET 0x000000f8 -#define WLAN_GPIO_PIN42_CONFIG_MSB 14 -#define WLAN_GPIO_PIN42_CONFIG_LSB 11 -#define WLAN_GPIO_PIN42_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN42_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN42_CONFIG_MASK) >> WLAN_GPIO_PIN42_CONFIG_LSB) -#define WLAN_GPIO_PIN42_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN42_CONFIG_LSB) & WLAN_GPIO_PIN42_CONFIG_MASK) -#define WLAN_GPIO_PIN42_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN42_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN42_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN42_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN42_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN42_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN42_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN42_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN42_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN42_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN42_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN42_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN42_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN42_INT_TYPE_MASK) >> WLAN_GPIO_PIN42_INT_TYPE_LSB) -#define WLAN_GPIO_PIN42_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN42_INT_TYPE_LSB) & WLAN_GPIO_PIN42_INT_TYPE_MASK) -#define WLAN_GPIO_PIN42_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN42_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN42_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN42_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN42_PAD_PULL_MASK) >> WLAN_GPIO_PIN42_PAD_PULL_LSB) -#define WLAN_GPIO_PIN42_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN42_PAD_PULL_LSB) & WLAN_GPIO_PIN42_PAD_PULL_MASK) -#define WLAN_GPIO_PIN42_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN42_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN42_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN42_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN42_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN42_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN42_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN42_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN42_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN42_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN42_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN42_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN42_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN42_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN42_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN42_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN42_PAD_DRIVER_LSB) & WLAN_GPIO_PIN42_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN42_SOURCE_MSB 0 -#define WLAN_GPIO_PIN42_SOURCE_LSB 0 -#define WLAN_GPIO_PIN42_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN42_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN42_SOURCE_MASK) >> WLAN_GPIO_PIN42_SOURCE_LSB) -#define WLAN_GPIO_PIN42_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN42_SOURCE_LSB) & WLAN_GPIO_PIN42_SOURCE_MASK) - -#define WLAN_GPIO_PIN43_ADDRESS 0x000000fc -#define WLAN_GPIO_PIN43_OFFSET 0x000000fc -#define WLAN_GPIO_PIN43_CONFIG_MSB 14 -#define WLAN_GPIO_PIN43_CONFIG_LSB 11 -#define WLAN_GPIO_PIN43_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN43_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN43_CONFIG_MASK) >> WLAN_GPIO_PIN43_CONFIG_LSB) -#define WLAN_GPIO_PIN43_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN43_CONFIG_LSB) & WLAN_GPIO_PIN43_CONFIG_MASK) -#define WLAN_GPIO_PIN43_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN43_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN43_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN43_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN43_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN43_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN43_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN43_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN43_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN43_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN43_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN43_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN43_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN43_INT_TYPE_MASK) >> WLAN_GPIO_PIN43_INT_TYPE_LSB) -#define WLAN_GPIO_PIN43_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN43_INT_TYPE_LSB) & WLAN_GPIO_PIN43_INT_TYPE_MASK) -#define WLAN_GPIO_PIN43_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN43_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN43_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN43_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN43_PAD_PULL_MASK) >> WLAN_GPIO_PIN43_PAD_PULL_LSB) -#define WLAN_GPIO_PIN43_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN43_PAD_PULL_LSB) & WLAN_GPIO_PIN43_PAD_PULL_MASK) -#define WLAN_GPIO_PIN43_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN43_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN43_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN43_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN43_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN43_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN43_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN43_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN43_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN43_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN43_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN43_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN43_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN43_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN43_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN43_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN43_PAD_DRIVER_LSB) & WLAN_GPIO_PIN43_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN43_SOURCE_MSB 0 -#define WLAN_GPIO_PIN43_SOURCE_LSB 0 -#define WLAN_GPIO_PIN43_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN43_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN43_SOURCE_MASK) >> WLAN_GPIO_PIN43_SOURCE_LSB) -#define WLAN_GPIO_PIN43_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN43_SOURCE_LSB) & WLAN_GPIO_PIN43_SOURCE_MASK) - -#define WLAN_GPIO_PIN44_ADDRESS 0x00000100 -#define WLAN_GPIO_PIN44_OFFSET 0x00000100 -#define WLAN_GPIO_PIN44_CONFIG_MSB 14 -#define WLAN_GPIO_PIN44_CONFIG_LSB 11 -#define WLAN_GPIO_PIN44_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN44_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN44_CONFIG_MASK) >> WLAN_GPIO_PIN44_CONFIG_LSB) -#define WLAN_GPIO_PIN44_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN44_CONFIG_LSB) & WLAN_GPIO_PIN44_CONFIG_MASK) -#define WLAN_GPIO_PIN44_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN44_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN44_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN44_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN44_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN44_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN44_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN44_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN44_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN44_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN44_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN44_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN44_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN44_INT_TYPE_MASK) >> WLAN_GPIO_PIN44_INT_TYPE_LSB) -#define WLAN_GPIO_PIN44_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN44_INT_TYPE_LSB) & WLAN_GPIO_PIN44_INT_TYPE_MASK) -#define WLAN_GPIO_PIN44_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN44_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN44_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN44_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN44_PAD_PULL_MASK) >> WLAN_GPIO_PIN44_PAD_PULL_LSB) -#define WLAN_GPIO_PIN44_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN44_PAD_PULL_LSB) & WLAN_GPIO_PIN44_PAD_PULL_MASK) -#define WLAN_GPIO_PIN44_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN44_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN44_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN44_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN44_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN44_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN44_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN44_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN44_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN44_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN44_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN44_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN44_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN44_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN44_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN44_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN44_PAD_DRIVER_LSB) & WLAN_GPIO_PIN44_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN44_SOURCE_MSB 0 -#define WLAN_GPIO_PIN44_SOURCE_LSB 0 -#define WLAN_GPIO_PIN44_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN44_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN44_SOURCE_MASK) >> WLAN_GPIO_PIN44_SOURCE_LSB) -#define WLAN_GPIO_PIN44_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN44_SOURCE_LSB) & WLAN_GPIO_PIN44_SOURCE_MASK) - -#define WLAN_GPIO_PIN45_ADDRESS 0x00000104 -#define WLAN_GPIO_PIN45_OFFSET 0x00000104 -#define WLAN_GPIO_PIN45_CONFIG_MSB 14 -#define WLAN_GPIO_PIN45_CONFIG_LSB 11 -#define WLAN_GPIO_PIN45_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN45_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN45_CONFIG_MASK) >> WLAN_GPIO_PIN45_CONFIG_LSB) -#define WLAN_GPIO_PIN45_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN45_CONFIG_LSB) & WLAN_GPIO_PIN45_CONFIG_MASK) -#define WLAN_GPIO_PIN45_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN45_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN45_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN45_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN45_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN45_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN45_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN45_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN45_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN45_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN45_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN45_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN45_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN45_INT_TYPE_MASK) >> WLAN_GPIO_PIN45_INT_TYPE_LSB) -#define WLAN_GPIO_PIN45_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN45_INT_TYPE_LSB) & WLAN_GPIO_PIN45_INT_TYPE_MASK) -#define WLAN_GPIO_PIN45_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN45_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN45_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN45_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN45_PAD_PULL_MASK) >> WLAN_GPIO_PIN45_PAD_PULL_LSB) -#define WLAN_GPIO_PIN45_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN45_PAD_PULL_LSB) & WLAN_GPIO_PIN45_PAD_PULL_MASK) -#define WLAN_GPIO_PIN45_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN45_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN45_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN45_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN45_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN45_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN45_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN45_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN45_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN45_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN45_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN45_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN45_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN45_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN45_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN45_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN45_PAD_DRIVER_LSB) & WLAN_GPIO_PIN45_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN45_SOURCE_MSB 0 -#define WLAN_GPIO_PIN45_SOURCE_LSB 0 -#define WLAN_GPIO_PIN45_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN45_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN45_SOURCE_MASK) >> WLAN_GPIO_PIN45_SOURCE_LSB) -#define WLAN_GPIO_PIN45_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN45_SOURCE_LSB) & WLAN_GPIO_PIN45_SOURCE_MASK) - -#define WLAN_GPIO_PIN46_ADDRESS 0x00000108 -#define WLAN_GPIO_PIN46_OFFSET 0x00000108 -#define WLAN_GPIO_PIN46_CONFIG_MSB 14 -#define WLAN_GPIO_PIN46_CONFIG_LSB 11 -#define WLAN_GPIO_PIN46_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN46_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN46_CONFIG_MASK) >> WLAN_GPIO_PIN46_CONFIG_LSB) -#define WLAN_GPIO_PIN46_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN46_CONFIG_LSB) & WLAN_GPIO_PIN46_CONFIG_MASK) -#define WLAN_GPIO_PIN46_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN46_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN46_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN46_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN46_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN46_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN46_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN46_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN46_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN46_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN46_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN46_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN46_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN46_INT_TYPE_MASK) >> WLAN_GPIO_PIN46_INT_TYPE_LSB) -#define WLAN_GPIO_PIN46_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN46_INT_TYPE_LSB) & WLAN_GPIO_PIN46_INT_TYPE_MASK) -#define WLAN_GPIO_PIN46_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN46_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN46_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN46_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN46_PAD_PULL_MASK) >> WLAN_GPIO_PIN46_PAD_PULL_LSB) -#define WLAN_GPIO_PIN46_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN46_PAD_PULL_LSB) & WLAN_GPIO_PIN46_PAD_PULL_MASK) -#define WLAN_GPIO_PIN46_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN46_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN46_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN46_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN46_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN46_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN46_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN46_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN46_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN46_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN46_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN46_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN46_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN46_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN46_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN46_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN46_PAD_DRIVER_LSB) & WLAN_GPIO_PIN46_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN46_SOURCE_MSB 0 -#define WLAN_GPIO_PIN46_SOURCE_LSB 0 -#define WLAN_GPIO_PIN46_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN46_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN46_SOURCE_MASK) >> WLAN_GPIO_PIN46_SOURCE_LSB) -#define WLAN_GPIO_PIN46_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN46_SOURCE_LSB) & WLAN_GPIO_PIN46_SOURCE_MASK) - -#define WLAN_GPIO_PIN47_ADDRESS 0x0000010c -#define WLAN_GPIO_PIN47_OFFSET 0x0000010c -#define WLAN_GPIO_PIN47_CONFIG_MSB 14 -#define WLAN_GPIO_PIN47_CONFIG_LSB 11 -#define WLAN_GPIO_PIN47_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN47_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN47_CONFIG_MASK) >> WLAN_GPIO_PIN47_CONFIG_LSB) -#define WLAN_GPIO_PIN47_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN47_CONFIG_LSB) & WLAN_GPIO_PIN47_CONFIG_MASK) -#define WLAN_GPIO_PIN47_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN47_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN47_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN47_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN47_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN47_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN47_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN47_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN47_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN47_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN47_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN47_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN47_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN47_INT_TYPE_MASK) >> WLAN_GPIO_PIN47_INT_TYPE_LSB) -#define WLAN_GPIO_PIN47_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN47_INT_TYPE_LSB) & WLAN_GPIO_PIN47_INT_TYPE_MASK) -#define WLAN_GPIO_PIN47_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN47_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN47_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN47_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN47_PAD_PULL_MASK) >> WLAN_GPIO_PIN47_PAD_PULL_LSB) -#define WLAN_GPIO_PIN47_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN47_PAD_PULL_LSB) & WLAN_GPIO_PIN47_PAD_PULL_MASK) -#define WLAN_GPIO_PIN47_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN47_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN47_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN47_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN47_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN47_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN47_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN47_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN47_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN47_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN47_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN47_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN47_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN47_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN47_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN47_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN47_PAD_DRIVER_LSB) & WLAN_GPIO_PIN47_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN47_SOURCE_MSB 0 -#define WLAN_GPIO_PIN47_SOURCE_LSB 0 -#define WLAN_GPIO_PIN47_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN47_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN47_SOURCE_MASK) >> WLAN_GPIO_PIN47_SOURCE_LSB) -#define WLAN_GPIO_PIN47_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN47_SOURCE_LSB) & WLAN_GPIO_PIN47_SOURCE_MASK) - -#define WLAN_GPIO_PIN48_ADDRESS 0x00000110 -#define WLAN_GPIO_PIN48_OFFSET 0x00000110 -#define WLAN_GPIO_PIN48_CONFIG_MSB 14 -#define WLAN_GPIO_PIN48_CONFIG_LSB 11 -#define WLAN_GPIO_PIN48_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN48_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN48_CONFIG_MASK) >> WLAN_GPIO_PIN48_CONFIG_LSB) -#define WLAN_GPIO_PIN48_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN48_CONFIG_LSB) & WLAN_GPIO_PIN48_CONFIG_MASK) -#define WLAN_GPIO_PIN48_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN48_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN48_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN48_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN48_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN48_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN48_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN48_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN48_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN48_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN48_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN48_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN48_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN48_INT_TYPE_MASK) >> WLAN_GPIO_PIN48_INT_TYPE_LSB) -#define WLAN_GPIO_PIN48_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN48_INT_TYPE_LSB) & WLAN_GPIO_PIN48_INT_TYPE_MASK) -#define WLAN_GPIO_PIN48_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN48_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN48_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN48_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN48_PAD_PULL_MASK) >> WLAN_GPIO_PIN48_PAD_PULL_LSB) -#define WLAN_GPIO_PIN48_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN48_PAD_PULL_LSB) & WLAN_GPIO_PIN48_PAD_PULL_MASK) -#define WLAN_GPIO_PIN48_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN48_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN48_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN48_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN48_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN48_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN48_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN48_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN48_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN48_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN48_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN48_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN48_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN48_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN48_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN48_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN48_PAD_DRIVER_LSB) & WLAN_GPIO_PIN48_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN48_SOURCE_MSB 0 -#define WLAN_GPIO_PIN48_SOURCE_LSB 0 -#define WLAN_GPIO_PIN48_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN48_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN48_SOURCE_MASK) >> WLAN_GPIO_PIN48_SOURCE_LSB) -#define WLAN_GPIO_PIN48_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN48_SOURCE_LSB) & WLAN_GPIO_PIN48_SOURCE_MASK) - -#define WLAN_GPIO_PIN49_ADDRESS 0x00000114 -#define WLAN_GPIO_PIN49_OFFSET 0x00000114 -#define WLAN_GPIO_PIN49_CONFIG_MSB 14 -#define WLAN_GPIO_PIN49_CONFIG_LSB 11 -#define WLAN_GPIO_PIN49_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN49_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN49_CONFIG_MASK) >> WLAN_GPIO_PIN49_CONFIG_LSB) -#define WLAN_GPIO_PIN49_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN49_CONFIG_LSB) & WLAN_GPIO_PIN49_CONFIG_MASK) -#define WLAN_GPIO_PIN49_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN49_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN49_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN49_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN49_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN49_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN49_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN49_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN49_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN49_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN49_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN49_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN49_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN49_INT_TYPE_MASK) >> WLAN_GPIO_PIN49_INT_TYPE_LSB) -#define WLAN_GPIO_PIN49_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN49_INT_TYPE_LSB) & WLAN_GPIO_PIN49_INT_TYPE_MASK) -#define WLAN_GPIO_PIN49_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN49_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN49_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN49_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN49_PAD_PULL_MASK) >> WLAN_GPIO_PIN49_PAD_PULL_LSB) -#define WLAN_GPIO_PIN49_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN49_PAD_PULL_LSB) & WLAN_GPIO_PIN49_PAD_PULL_MASK) -#define WLAN_GPIO_PIN49_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN49_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN49_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN49_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN49_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN49_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN49_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN49_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN49_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN49_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN49_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN49_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN49_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN49_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN49_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN49_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN49_PAD_DRIVER_LSB) & WLAN_GPIO_PIN49_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN49_SOURCE_MSB 0 -#define WLAN_GPIO_PIN49_SOURCE_LSB 0 -#define WLAN_GPIO_PIN49_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN49_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN49_SOURCE_MASK) >> WLAN_GPIO_PIN49_SOURCE_LSB) -#define WLAN_GPIO_PIN49_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN49_SOURCE_LSB) & WLAN_GPIO_PIN49_SOURCE_MASK) - -#define WLAN_GPIO_PIN50_ADDRESS 0x00000118 -#define WLAN_GPIO_PIN50_OFFSET 0x00000118 -#define WLAN_GPIO_PIN50_CONFIG_MSB 14 -#define WLAN_GPIO_PIN50_CONFIG_LSB 11 -#define WLAN_GPIO_PIN50_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN50_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN50_CONFIG_MASK) >> WLAN_GPIO_PIN50_CONFIG_LSB) -#define WLAN_GPIO_PIN50_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN50_CONFIG_LSB) & WLAN_GPIO_PIN50_CONFIG_MASK) -#define WLAN_GPIO_PIN50_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN50_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN50_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN50_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN50_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN50_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN50_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN50_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN50_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN50_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN50_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN50_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN50_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN50_INT_TYPE_MASK) >> WLAN_GPIO_PIN50_INT_TYPE_LSB) -#define WLAN_GPIO_PIN50_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN50_INT_TYPE_LSB) & WLAN_GPIO_PIN50_INT_TYPE_MASK) -#define WLAN_GPIO_PIN50_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN50_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN50_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN50_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN50_PAD_PULL_MASK) >> WLAN_GPIO_PIN50_PAD_PULL_LSB) -#define WLAN_GPIO_PIN50_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN50_PAD_PULL_LSB) & WLAN_GPIO_PIN50_PAD_PULL_MASK) -#define WLAN_GPIO_PIN50_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN50_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN50_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN50_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN50_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN50_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN50_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN50_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN50_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN50_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN50_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN50_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN50_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN50_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN50_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN50_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN50_PAD_DRIVER_LSB) & WLAN_GPIO_PIN50_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN50_SOURCE_MSB 0 -#define WLAN_GPIO_PIN50_SOURCE_LSB 0 -#define WLAN_GPIO_PIN50_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN50_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN50_SOURCE_MASK) >> WLAN_GPIO_PIN50_SOURCE_LSB) -#define WLAN_GPIO_PIN50_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN50_SOURCE_LSB) & WLAN_GPIO_PIN50_SOURCE_MASK) - -#define WLAN_GPIO_PIN51_ADDRESS 0x0000011c -#define WLAN_GPIO_PIN51_OFFSET 0x0000011c -#define WLAN_GPIO_PIN51_CONFIG_MSB 14 -#define WLAN_GPIO_PIN51_CONFIG_LSB 11 -#define WLAN_GPIO_PIN51_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN51_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN51_CONFIG_MASK) >> WLAN_GPIO_PIN51_CONFIG_LSB) -#define WLAN_GPIO_PIN51_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN51_CONFIG_LSB) & WLAN_GPIO_PIN51_CONFIG_MASK) -#define WLAN_GPIO_PIN51_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN51_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN51_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN51_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN51_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN51_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN51_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN51_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN51_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN51_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN51_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN51_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN51_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN51_INT_TYPE_MASK) >> WLAN_GPIO_PIN51_INT_TYPE_LSB) -#define WLAN_GPIO_PIN51_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN51_INT_TYPE_LSB) & WLAN_GPIO_PIN51_INT_TYPE_MASK) -#define WLAN_GPIO_PIN51_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN51_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN51_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN51_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN51_PAD_PULL_MASK) >> WLAN_GPIO_PIN51_PAD_PULL_LSB) -#define WLAN_GPIO_PIN51_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN51_PAD_PULL_LSB) & WLAN_GPIO_PIN51_PAD_PULL_MASK) -#define WLAN_GPIO_PIN51_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN51_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN51_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN51_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN51_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN51_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN51_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN51_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN51_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN51_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN51_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN51_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN51_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN51_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN51_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN51_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN51_PAD_DRIVER_LSB) & WLAN_GPIO_PIN51_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN51_SOURCE_MSB 0 -#define WLAN_GPIO_PIN51_SOURCE_LSB 0 -#define WLAN_GPIO_PIN51_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN51_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN51_SOURCE_MASK) >> WLAN_GPIO_PIN51_SOURCE_LSB) -#define WLAN_GPIO_PIN51_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN51_SOURCE_LSB) & WLAN_GPIO_PIN51_SOURCE_MASK) - -#define WLAN_GPIO_PIN52_ADDRESS 0x00000120 -#define WLAN_GPIO_PIN52_OFFSET 0x00000120 -#define WLAN_GPIO_PIN52_CONFIG_MSB 14 -#define WLAN_GPIO_PIN52_CONFIG_LSB 11 -#define WLAN_GPIO_PIN52_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN52_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN52_CONFIG_MASK) >> WLAN_GPIO_PIN52_CONFIG_LSB) -#define WLAN_GPIO_PIN52_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN52_CONFIG_LSB) & WLAN_GPIO_PIN52_CONFIG_MASK) -#define WLAN_GPIO_PIN52_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN52_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN52_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN52_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN52_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN52_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN52_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN52_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN52_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN52_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN52_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN52_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN52_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN52_INT_TYPE_MASK) >> WLAN_GPIO_PIN52_INT_TYPE_LSB) -#define WLAN_GPIO_PIN52_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN52_INT_TYPE_LSB) & WLAN_GPIO_PIN52_INT_TYPE_MASK) -#define WLAN_GPIO_PIN52_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN52_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN52_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN52_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN52_PAD_PULL_MASK) >> WLAN_GPIO_PIN52_PAD_PULL_LSB) -#define WLAN_GPIO_PIN52_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN52_PAD_PULL_LSB) & WLAN_GPIO_PIN52_PAD_PULL_MASK) -#define WLAN_GPIO_PIN52_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN52_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN52_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN52_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN52_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN52_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN52_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN52_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN52_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN52_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN52_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN52_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN52_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN52_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN52_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN52_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN52_PAD_DRIVER_LSB) & WLAN_GPIO_PIN52_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN52_SOURCE_MSB 0 -#define WLAN_GPIO_PIN52_SOURCE_LSB 0 -#define WLAN_GPIO_PIN52_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN52_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN52_SOURCE_MASK) >> WLAN_GPIO_PIN52_SOURCE_LSB) -#define WLAN_GPIO_PIN52_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN52_SOURCE_LSB) & WLAN_GPIO_PIN52_SOURCE_MASK) - -#define WLAN_GPIO_PIN53_ADDRESS 0x00000124 -#define WLAN_GPIO_PIN53_OFFSET 0x00000124 -#define WLAN_GPIO_PIN53_CONFIG_MSB 14 -#define WLAN_GPIO_PIN53_CONFIG_LSB 11 -#define WLAN_GPIO_PIN53_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN53_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN53_CONFIG_MASK) >> WLAN_GPIO_PIN53_CONFIG_LSB) -#define WLAN_GPIO_PIN53_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN53_CONFIG_LSB) & WLAN_GPIO_PIN53_CONFIG_MASK) -#define WLAN_GPIO_PIN53_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN53_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN53_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN53_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN53_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN53_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN53_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN53_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN53_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN53_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN53_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN53_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN53_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN53_INT_TYPE_MASK) >> WLAN_GPIO_PIN53_INT_TYPE_LSB) -#define WLAN_GPIO_PIN53_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN53_INT_TYPE_LSB) & WLAN_GPIO_PIN53_INT_TYPE_MASK) -#define WLAN_GPIO_PIN53_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN53_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN53_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN53_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN53_PAD_PULL_MASK) >> WLAN_GPIO_PIN53_PAD_PULL_LSB) -#define WLAN_GPIO_PIN53_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN53_PAD_PULL_LSB) & WLAN_GPIO_PIN53_PAD_PULL_MASK) -#define WLAN_GPIO_PIN53_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN53_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN53_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN53_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN53_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN53_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN53_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN53_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN53_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN53_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN53_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN53_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN53_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN53_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN53_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN53_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN53_PAD_DRIVER_LSB) & WLAN_GPIO_PIN53_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN53_SOURCE_MSB 0 -#define WLAN_GPIO_PIN53_SOURCE_LSB 0 -#define WLAN_GPIO_PIN53_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN53_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN53_SOURCE_MASK) >> WLAN_GPIO_PIN53_SOURCE_LSB) -#define WLAN_GPIO_PIN53_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN53_SOURCE_LSB) & WLAN_GPIO_PIN53_SOURCE_MASK) - -#define WLAN_GPIO_PIN54_ADDRESS 0x00000128 -#define WLAN_GPIO_PIN54_OFFSET 0x00000128 -#define WLAN_GPIO_PIN54_CONFIG_MSB 14 -#define WLAN_GPIO_PIN54_CONFIG_LSB 11 -#define WLAN_GPIO_PIN54_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN54_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN54_CONFIG_MASK) >> WLAN_GPIO_PIN54_CONFIG_LSB) -#define WLAN_GPIO_PIN54_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN54_CONFIG_LSB) & WLAN_GPIO_PIN54_CONFIG_MASK) -#define WLAN_GPIO_PIN54_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN54_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN54_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN54_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN54_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN54_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN54_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN54_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN54_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN54_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN54_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN54_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN54_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN54_INT_TYPE_MASK) >> WLAN_GPIO_PIN54_INT_TYPE_LSB) -#define WLAN_GPIO_PIN54_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN54_INT_TYPE_LSB) & WLAN_GPIO_PIN54_INT_TYPE_MASK) -#define WLAN_GPIO_PIN54_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN54_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN54_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN54_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN54_PAD_PULL_MASK) >> WLAN_GPIO_PIN54_PAD_PULL_LSB) -#define WLAN_GPIO_PIN54_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN54_PAD_PULL_LSB) & WLAN_GPIO_PIN54_PAD_PULL_MASK) -#define WLAN_GPIO_PIN54_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN54_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN54_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN54_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN54_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN54_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN54_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN54_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN54_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN54_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN54_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN54_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN54_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN54_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN54_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN54_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN54_PAD_DRIVER_LSB) & WLAN_GPIO_PIN54_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN54_SOURCE_MSB 0 -#define WLAN_GPIO_PIN54_SOURCE_LSB 0 -#define WLAN_GPIO_PIN54_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN54_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN54_SOURCE_MASK) >> WLAN_GPIO_PIN54_SOURCE_LSB) -#define WLAN_GPIO_PIN54_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN54_SOURCE_LSB) & WLAN_GPIO_PIN54_SOURCE_MASK) - -#define WLAN_GPIO_PIN55_ADDRESS 0x0000012c -#define WLAN_GPIO_PIN55_OFFSET 0x0000012c -#define WLAN_GPIO_PIN55_CONFIG_MSB 14 -#define WLAN_GPIO_PIN55_CONFIG_LSB 11 -#define WLAN_GPIO_PIN55_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN55_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN55_CONFIG_MASK) >> WLAN_GPIO_PIN55_CONFIG_LSB) -#define WLAN_GPIO_PIN55_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN55_CONFIG_LSB) & WLAN_GPIO_PIN55_CONFIG_MASK) -#define WLAN_GPIO_PIN55_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN55_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN55_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN55_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN55_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN55_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN55_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN55_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN55_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN55_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN55_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN55_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN55_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN55_INT_TYPE_MASK) >> WLAN_GPIO_PIN55_INT_TYPE_LSB) -#define WLAN_GPIO_PIN55_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN55_INT_TYPE_LSB) & WLAN_GPIO_PIN55_INT_TYPE_MASK) -#define WLAN_GPIO_PIN55_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN55_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN55_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN55_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN55_PAD_PULL_MASK) >> WLAN_GPIO_PIN55_PAD_PULL_LSB) -#define WLAN_GPIO_PIN55_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN55_PAD_PULL_LSB) & WLAN_GPIO_PIN55_PAD_PULL_MASK) -#define WLAN_GPIO_PIN55_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN55_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN55_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN55_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN55_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN55_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN55_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN55_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN55_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN55_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN55_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN55_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN55_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN55_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN55_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN55_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN55_PAD_DRIVER_LSB) & WLAN_GPIO_PIN55_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN55_SOURCE_MSB 0 -#define WLAN_GPIO_PIN55_SOURCE_LSB 0 -#define WLAN_GPIO_PIN55_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN55_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN55_SOURCE_MASK) >> WLAN_GPIO_PIN55_SOURCE_LSB) -#define WLAN_GPIO_PIN55_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN55_SOURCE_LSB) & WLAN_GPIO_PIN55_SOURCE_MASK) - -#define WLAN_GPIO_PIN56_ADDRESS 0x00000130 -#define WLAN_GPIO_PIN56_OFFSET 0x00000130 -#define WLAN_GPIO_PIN56_CONFIG_MSB 14 -#define WLAN_GPIO_PIN56_CONFIG_LSB 11 -#define WLAN_GPIO_PIN56_CONFIG_MASK 0x00007800 -#define WLAN_GPIO_PIN56_CONFIG_GET(x) (((x) & WLAN_GPIO_PIN56_CONFIG_MASK) >> WLAN_GPIO_PIN56_CONFIG_LSB) -#define WLAN_GPIO_PIN56_CONFIG_SET(x) (((x) << WLAN_GPIO_PIN56_CONFIG_LSB) & WLAN_GPIO_PIN56_CONFIG_MASK) -#define WLAN_GPIO_PIN56_WAKEUP_ENABLE_MSB 10 -#define WLAN_GPIO_PIN56_WAKEUP_ENABLE_LSB 10 -#define WLAN_GPIO_PIN56_WAKEUP_ENABLE_MASK 0x00000400 -#define WLAN_GPIO_PIN56_WAKEUP_ENABLE_GET(x) (((x) & WLAN_GPIO_PIN56_WAKEUP_ENABLE_MASK) >> WLAN_GPIO_PIN56_WAKEUP_ENABLE_LSB) -#define WLAN_GPIO_PIN56_WAKEUP_ENABLE_SET(x) (((x) << WLAN_GPIO_PIN56_WAKEUP_ENABLE_LSB) & WLAN_GPIO_PIN56_WAKEUP_ENABLE_MASK) -#define WLAN_GPIO_PIN56_INT_TYPE_MSB 9 -#define WLAN_GPIO_PIN56_INT_TYPE_LSB 7 -#define WLAN_GPIO_PIN56_INT_TYPE_MASK 0x00000380 -#define WLAN_GPIO_PIN56_INT_TYPE_GET(x) (((x) & WLAN_GPIO_PIN56_INT_TYPE_MASK) >> WLAN_GPIO_PIN56_INT_TYPE_LSB) -#define WLAN_GPIO_PIN56_INT_TYPE_SET(x) (((x) << WLAN_GPIO_PIN56_INT_TYPE_LSB) & WLAN_GPIO_PIN56_INT_TYPE_MASK) -#define WLAN_GPIO_PIN56_PAD_PULL_MSB 6 -#define WLAN_GPIO_PIN56_PAD_PULL_LSB 5 -#define WLAN_GPIO_PIN56_PAD_PULL_MASK 0x00000060 -#define WLAN_GPIO_PIN56_PAD_PULL_GET(x) (((x) & WLAN_GPIO_PIN56_PAD_PULL_MASK) >> WLAN_GPIO_PIN56_PAD_PULL_LSB) -#define WLAN_GPIO_PIN56_PAD_PULL_SET(x) (((x) << WLAN_GPIO_PIN56_PAD_PULL_LSB) & WLAN_GPIO_PIN56_PAD_PULL_MASK) -#define WLAN_GPIO_PIN56_PAD_STRENGTH_MSB 4 -#define WLAN_GPIO_PIN56_PAD_STRENGTH_LSB 3 -#define WLAN_GPIO_PIN56_PAD_STRENGTH_MASK 0x00000018 -#define WLAN_GPIO_PIN56_PAD_STRENGTH_GET(x) (((x) & WLAN_GPIO_PIN56_PAD_STRENGTH_MASK) >> WLAN_GPIO_PIN56_PAD_STRENGTH_LSB) -#define WLAN_GPIO_PIN56_PAD_STRENGTH_SET(x) (((x) << WLAN_GPIO_PIN56_PAD_STRENGTH_LSB) & WLAN_GPIO_PIN56_PAD_STRENGTH_MASK) -#define WLAN_GPIO_PIN56_PAD_DRIVER_MSB 2 -#define WLAN_GPIO_PIN56_PAD_DRIVER_LSB 2 -#define WLAN_GPIO_PIN56_PAD_DRIVER_MASK 0x00000004 -#define WLAN_GPIO_PIN56_PAD_DRIVER_GET(x) (((x) & WLAN_GPIO_PIN56_PAD_DRIVER_MASK) >> WLAN_GPIO_PIN56_PAD_DRIVER_LSB) -#define WLAN_GPIO_PIN56_PAD_DRIVER_SET(x) (((x) << WLAN_GPIO_PIN56_PAD_DRIVER_LSB) & WLAN_GPIO_PIN56_PAD_DRIVER_MASK) -#define WLAN_GPIO_PIN56_SOURCE_MSB 0 -#define WLAN_GPIO_PIN56_SOURCE_LSB 0 -#define WLAN_GPIO_PIN56_SOURCE_MASK 0x00000001 -#define WLAN_GPIO_PIN56_SOURCE_GET(x) (((x) & WLAN_GPIO_PIN56_SOURCE_MASK) >> WLAN_GPIO_PIN56_SOURCE_LSB) -#define WLAN_GPIO_PIN56_SOURCE_SET(x) (((x) << WLAN_GPIO_PIN56_SOURCE_LSB) & WLAN_GPIO_PIN56_SOURCE_MASK) - -#define SDIO_ADDRESS 0x00000134 -#define SDIO_OFFSET 0x00000134 -#define SDIO_PINS_EN_MSB 0 -#define SDIO_PINS_EN_LSB 0 -#define SDIO_PINS_EN_MASK 0x00000001 -#define SDIO_PINS_EN_GET(x) (((x) & SDIO_PINS_EN_MASK) >> SDIO_PINS_EN_LSB) -#define SDIO_PINS_EN_SET(x) (((x) << SDIO_PINS_EN_LSB) & SDIO_PINS_EN_MASK) - -#define WL_SOC_APB_ADDRESS 0x00000138 -#define WL_SOC_APB_OFFSET 0x00000138 -#define WL_SOC_APB_TOGGLE_MSB 0 -#define WL_SOC_APB_TOGGLE_LSB 0 -#define WL_SOC_APB_TOGGLE_MASK 0x00000001 -#define WL_SOC_APB_TOGGLE_GET(x) (((x) & WL_SOC_APB_TOGGLE_MASK) >> WL_SOC_APB_TOGGLE_LSB) -#define WL_SOC_APB_TOGGLE_SET(x) (((x) << WL_SOC_APB_TOGGLE_LSB) & WL_SOC_APB_TOGGLE_MASK) - -#define WLAN_SIGMA_DELTA_ADDRESS 0x0000013c -#define WLAN_SIGMA_DELTA_OFFSET 0x0000013c -#define WLAN_SIGMA_DELTA_ENABLE_MSB 16 -#define WLAN_SIGMA_DELTA_ENABLE_LSB 16 -#define WLAN_SIGMA_DELTA_ENABLE_MASK 0x00010000 -#define WLAN_SIGMA_DELTA_ENABLE_GET(x) (((x) & WLAN_SIGMA_DELTA_ENABLE_MASK) >> WLAN_SIGMA_DELTA_ENABLE_LSB) -#define WLAN_SIGMA_DELTA_ENABLE_SET(x) (((x) << WLAN_SIGMA_DELTA_ENABLE_LSB) & WLAN_SIGMA_DELTA_ENABLE_MASK) -#define WLAN_SIGMA_DELTA_PRESCALAR_MSB 15 -#define WLAN_SIGMA_DELTA_PRESCALAR_LSB 8 -#define WLAN_SIGMA_DELTA_PRESCALAR_MASK 0x0000ff00 -#define WLAN_SIGMA_DELTA_PRESCALAR_GET(x) (((x) & WLAN_SIGMA_DELTA_PRESCALAR_MASK) >> WLAN_SIGMA_DELTA_PRESCALAR_LSB) -#define WLAN_SIGMA_DELTA_PRESCALAR_SET(x) (((x) << WLAN_SIGMA_DELTA_PRESCALAR_LSB) & WLAN_SIGMA_DELTA_PRESCALAR_MASK) -#define WLAN_SIGMA_DELTA_TARGET_MSB 7 -#define WLAN_SIGMA_DELTA_TARGET_LSB 0 -#define WLAN_SIGMA_DELTA_TARGET_MASK 0x000000ff -#define WLAN_SIGMA_DELTA_TARGET_GET(x) (((x) & WLAN_SIGMA_DELTA_TARGET_MASK) >> WLAN_SIGMA_DELTA_TARGET_LSB) -#define WLAN_SIGMA_DELTA_TARGET_SET(x) (((x) << WLAN_SIGMA_DELTA_TARGET_LSB) & WLAN_SIGMA_DELTA_TARGET_MASK) - -#define WL_BOOTSTRAP_ADDRESS 0x00000140 -#define WL_BOOTSTRAP_OFFSET 0x00000140 -#define WL_BOOTSTRAP_CPU_MBIST_EN_MSB 12 -#define WL_BOOTSTRAP_CPU_MBIST_EN_LSB 12 -#define WL_BOOTSTRAP_CPU_MBIST_EN_MASK 0x00001000 -#define WL_BOOTSTRAP_CPU_MBIST_EN_GET(x) (((x) & WL_BOOTSTRAP_CPU_MBIST_EN_MASK) >> WL_BOOTSTRAP_CPU_MBIST_EN_LSB) -#define WL_BOOTSTRAP_CPU_MBIST_EN_SET(x) (((x) << WL_BOOTSTRAP_CPU_MBIST_EN_LSB) & WL_BOOTSTRAP_CPU_MBIST_EN_MASK) -#define WL_BOOTSTRAP_STATUS_MSB 11 -#define WL_BOOTSTRAP_STATUS_LSB 0 -#define WL_BOOTSTRAP_STATUS_MASK 0x00000fff -#define WL_BOOTSTRAP_STATUS_GET(x) (((x) & WL_BOOTSTRAP_STATUS_MASK) >> WL_BOOTSTRAP_STATUS_LSB) -#define WL_BOOTSTRAP_STATUS_SET(x) (((x) << WL_BOOTSTRAP_STATUS_LSB) & WL_BOOTSTRAP_STATUS_MASK) - -#define CORE_BOOTSTRAP_LOW_ADDRESS 0x00000144 -#define CORE_BOOTSTRAP_LOW_OFFSET 0x00000144 -#define CORE_BOOTSTRAP_LOW_STATUS_MSB 31 -#define CORE_BOOTSTRAP_LOW_STATUS_LSB 0 -#define CORE_BOOTSTRAP_LOW_STATUS_MASK 0xffffffff -#define CORE_BOOTSTRAP_LOW_STATUS_GET(x) (((x) & CORE_BOOTSTRAP_LOW_STATUS_MASK) >> CORE_BOOTSTRAP_LOW_STATUS_LSB) -#define CORE_BOOTSTRAP_LOW_STATUS_SET(x) (((x) << CORE_BOOTSTRAP_LOW_STATUS_LSB) & CORE_BOOTSTRAP_LOW_STATUS_MASK) - -#define CORE_BOOTSTRAP_HIGH_ADDRESS 0x00000148 -#define CORE_BOOTSTRAP_HIGH_OFFSET 0x00000148 -#define CORE_BOOTSTRAP_HIGH_STATUS_MSB 12 -#define CORE_BOOTSTRAP_HIGH_STATUS_LSB 0 -#define CORE_BOOTSTRAP_HIGH_STATUS_MASK 0x00001fff -#define CORE_BOOTSTRAP_HIGH_STATUS_GET(x) (((x) & CORE_BOOTSTRAP_HIGH_STATUS_MASK) >> CORE_BOOTSTRAP_HIGH_STATUS_LSB) -#define CORE_BOOTSTRAP_HIGH_STATUS_SET(x) (((x) << CORE_BOOTSTRAP_HIGH_STATUS_LSB) & CORE_BOOTSTRAP_HIGH_STATUS_MASK) - -#define WLAN_DEBUG_CONTROL_ADDRESS 0x0000014c -#define WLAN_DEBUG_CONTROL_OFFSET 0x0000014c -#define WLAN_DEBUG_CONTROL_ENABLE_MSB 0 -#define WLAN_DEBUG_CONTROL_ENABLE_LSB 0 -#define WLAN_DEBUG_CONTROL_ENABLE_MASK 0x00000001 -#define WLAN_DEBUG_CONTROL_ENABLE_GET(x) (((x) & WLAN_DEBUG_CONTROL_ENABLE_MASK) >> WLAN_DEBUG_CONTROL_ENABLE_LSB) -#define WLAN_DEBUG_CONTROL_ENABLE_SET(x) (((x) << WLAN_DEBUG_CONTROL_ENABLE_LSB) & WLAN_DEBUG_CONTROL_ENABLE_MASK) - -#define WLAN_DEBUG_INPUT_SEL_ADDRESS 0x00000150 -#define WLAN_DEBUG_INPUT_SEL_OFFSET 0x00000150 -#define WLAN_DEBUG_INPUT_SEL_SHIFT_MSB 5 -#define WLAN_DEBUG_INPUT_SEL_SHIFT_LSB 4 -#define WLAN_DEBUG_INPUT_SEL_SHIFT_MASK 0x00000030 -#define WLAN_DEBUG_INPUT_SEL_SHIFT_GET(x) (((x) & WLAN_DEBUG_INPUT_SEL_SHIFT_MASK) >> WLAN_DEBUG_INPUT_SEL_SHIFT_LSB) -#define WLAN_DEBUG_INPUT_SEL_SHIFT_SET(x) (((x) << WLAN_DEBUG_INPUT_SEL_SHIFT_LSB) & WLAN_DEBUG_INPUT_SEL_SHIFT_MASK) -#define WLAN_DEBUG_INPUT_SEL_SRC_MSB 3 -#define WLAN_DEBUG_INPUT_SEL_SRC_LSB 0 -#define WLAN_DEBUG_INPUT_SEL_SRC_MASK 0x0000000f -#define WLAN_DEBUG_INPUT_SEL_SRC_GET(x) (((x) & WLAN_DEBUG_INPUT_SEL_SRC_MASK) >> WLAN_DEBUG_INPUT_SEL_SRC_LSB) -#define WLAN_DEBUG_INPUT_SEL_SRC_SET(x) (((x) << WLAN_DEBUG_INPUT_SEL_SRC_LSB) & WLAN_DEBUG_INPUT_SEL_SRC_MASK) - -#define WLAN_DEBUG_OUT_ADDRESS 0x00000154 -#define WLAN_DEBUG_OUT_OFFSET 0x00000154 -#define WLAN_DEBUG_OUT_DATA_MSB 17 -#define WLAN_DEBUG_OUT_DATA_LSB 0 -#define WLAN_DEBUG_OUT_DATA_MASK 0x0003ffff -#define WLAN_DEBUG_OUT_DATA_GET(x) (((x) & WLAN_DEBUG_OUT_DATA_MASK) >> WLAN_DEBUG_OUT_DATA_LSB) -#define WLAN_DEBUG_OUT_DATA_SET(x) (((x) << WLAN_DEBUG_OUT_DATA_LSB) & WLAN_DEBUG_OUT_DATA_MASK) - -#define WLAN_RESET_TUPLE_STATUS_ADDRESS 0x00000158 -#define WLAN_RESET_TUPLE_STATUS_OFFSET 0x00000158 -#define WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MSB 11 -#define WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB 8 -#define WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK 0x00000f00 -#define WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_GET(x) (((x) & WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK) >> WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB) -#define WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_SET(x) (((x) << WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB) & WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK) -#define WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MSB 7 -#define WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB 0 -#define WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK 0x000000ff -#define WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_GET(x) (((x) & WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK) >> WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB) -#define WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_SET(x) (((x) << WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB) & WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK) - -#define ANTENNA_CONTROL_ADDRESS 0x0000015c -#define ANTENNA_CONTROL_OFFSET 0x0000015c -#define ANTENNA_CONTROL_RX_CLEAR_MSB 16 -#define ANTENNA_CONTROL_RX_CLEAR_LSB 16 -#define ANTENNA_CONTROL_RX_CLEAR_MASK 0x00010000 -#define ANTENNA_CONTROL_RX_CLEAR_GET(x) (((x) & ANTENNA_CONTROL_RX_CLEAR_MASK) >> ANTENNA_CONTROL_RX_CLEAR_LSB) -#define ANTENNA_CONTROL_RX_CLEAR_SET(x) (((x) << ANTENNA_CONTROL_RX_CLEAR_LSB) & ANTENNA_CONTROL_RX_CLEAR_MASK) -#define ANTENNA_CONTROL_SPI_CS_MSB 15 -#define ANTENNA_CONTROL_SPI_CS_LSB 15 -#define ANTENNA_CONTROL_SPI_CS_MASK 0x00008000 -#define ANTENNA_CONTROL_SPI_CS_GET(x) (((x) & ANTENNA_CONTROL_SPI_CS_MASK) >> ANTENNA_CONTROL_SPI_CS_LSB) -#define ANTENNA_CONTROL_SPI_CS_SET(x) (((x) << ANTENNA_CONTROL_SPI_CS_LSB) & ANTENNA_CONTROL_SPI_CS_MASK) -#define ANTENNA_CONTROL_SPI_MODE_MSB 14 -#define ANTENNA_CONTROL_SPI_MODE_LSB 14 -#define ANTENNA_CONTROL_SPI_MODE_MASK 0x00004000 -#define ANTENNA_CONTROL_SPI_MODE_GET(x) (((x) & ANTENNA_CONTROL_SPI_MODE_MASK) >> ANTENNA_CONTROL_SPI_MODE_LSB) -#define ANTENNA_CONTROL_SPI_MODE_SET(x) (((x) << ANTENNA_CONTROL_SPI_MODE_LSB) & ANTENNA_CONTROL_SPI_MODE_MASK) -#define ANTENNA_CONTROL_LED_SEL_MSB 13 -#define ANTENNA_CONTROL_LED_SEL_LSB 12 -#define ANTENNA_CONTROL_LED_SEL_MASK 0x00003000 -#define ANTENNA_CONTROL_LED_SEL_GET(x) (((x) & ANTENNA_CONTROL_LED_SEL_MASK) >> ANTENNA_CONTROL_LED_SEL_LSB) -#define ANTENNA_CONTROL_LED_SEL_SET(x) (((x) << ANTENNA_CONTROL_LED_SEL_LSB) & ANTENNA_CONTROL_LED_SEL_MASK) -#define ANTENNA_CONTROL_OVERRIDE_MSB 11 -#define ANTENNA_CONTROL_OVERRIDE_LSB 8 -#define ANTENNA_CONTROL_OVERRIDE_MASK 0x00000f00 -#define ANTENNA_CONTROL_OVERRIDE_GET(x) (((x) & ANTENNA_CONTROL_OVERRIDE_MASK) >> ANTENNA_CONTROL_OVERRIDE_LSB) -#define ANTENNA_CONTROL_OVERRIDE_SET(x) (((x) << ANTENNA_CONTROL_OVERRIDE_LSB) & ANTENNA_CONTROL_OVERRIDE_MASK) -#define ANTENNA_CONTROL_VALUE_MSB 7 -#define ANTENNA_CONTROL_VALUE_LSB 4 -#define ANTENNA_CONTROL_VALUE_MASK 0x000000f0 -#define ANTENNA_CONTROL_VALUE_GET(x) (((x) & ANTENNA_CONTROL_VALUE_MASK) >> ANTENNA_CONTROL_VALUE_LSB) -#define ANTENNA_CONTROL_VALUE_SET(x) (((x) << ANTENNA_CONTROL_VALUE_LSB) & ANTENNA_CONTROL_VALUE_MASK) -#define ANTENNA_CONTROL_ENABLE_MSB 3 -#define ANTENNA_CONTROL_ENABLE_LSB 0 -#define ANTENNA_CONTROL_ENABLE_MASK 0x0000000f -#define ANTENNA_CONTROL_ENABLE_GET(x) (((x) & ANTENNA_CONTROL_ENABLE_MASK) >> ANTENNA_CONTROL_ENABLE_LSB) -#define ANTENNA_CONTROL_ENABLE_SET(x) (((x) << ANTENNA_CONTROL_ENABLE_LSB) & ANTENNA_CONTROL_ENABLE_MASK) - -#define SDIO2_ADDRESS 0x00000160 -#define SDIO2_OFFSET 0x00000160 -#define SDIO2_PINS_EN_MSB 0 -#define SDIO2_PINS_EN_LSB 0 -#define SDIO2_PINS_EN_MASK 0x00000001 -#define SDIO2_PINS_EN_GET(x) (((x) & SDIO2_PINS_EN_MASK) >> SDIO2_PINS_EN_LSB) -#define SDIO2_PINS_EN_SET(x) (((x) << SDIO2_PINS_EN_LSB) & SDIO2_PINS_EN_MASK) - -#define SDHC_ADDRESS 0x00000164 -#define SDHC_OFFSET 0x00000164 -#define SDHC_PINS_EN_MSB 0 -#define SDHC_PINS_EN_LSB 0 -#define SDHC_PINS_EN_MASK 0x00000001 -#define SDHC_PINS_EN_GET(x) (((x) & SDHC_PINS_EN_MASK) >> SDHC_PINS_EN_LSB) -#define SDHC_PINS_EN_SET(x) (((x) << SDHC_PINS_EN_LSB) & SDHC_PINS_EN_MASK) - -#define AMBA_DEBUG_BUS_ADDRESS 0x00000168 -#define AMBA_DEBUG_BUS_OFFSET 0x00000168 -#define AMBA_DEBUG_BUS_SEL_MSB 4 -#define AMBA_DEBUG_BUS_SEL_LSB 0 -#define AMBA_DEBUG_BUS_SEL_MASK 0x0000001f -#define AMBA_DEBUG_BUS_SEL_GET(x) (((x) & AMBA_DEBUG_BUS_SEL_MASK) >> AMBA_DEBUG_BUS_SEL_LSB) -#define AMBA_DEBUG_BUS_SEL_SET(x) (((x) << AMBA_DEBUG_BUS_SEL_LSB) & AMBA_DEBUG_BUS_SEL_MASK) - -#define CPU_MBIST_ADDRESS 0x0000016c -#define CPU_MBIST_OFFSET 0x0000016c -#define CPU_MBIST_BLOCK_FAIL_MSB 10 -#define CPU_MBIST_BLOCK_FAIL_LSB 2 -#define CPU_MBIST_BLOCK_FAIL_MASK 0x000007fc -#define CPU_MBIST_BLOCK_FAIL_GET(x) (((x) & CPU_MBIST_BLOCK_FAIL_MASK) >> CPU_MBIST_BLOCK_FAIL_LSB) -#define CPU_MBIST_BLOCK_FAIL_SET(x) (((x) << CPU_MBIST_BLOCK_FAIL_LSB) & CPU_MBIST_BLOCK_FAIL_MASK) -#define CPU_MBIST_GLOBAL_FAIL_MSB 1 -#define CPU_MBIST_GLOBAL_FAIL_LSB 1 -#define CPU_MBIST_GLOBAL_FAIL_MASK 0x00000002 -#define CPU_MBIST_GLOBAL_FAIL_GET(x) (((x) & CPU_MBIST_GLOBAL_FAIL_MASK) >> CPU_MBIST_GLOBAL_FAIL_LSB) -#define CPU_MBIST_GLOBAL_FAIL_SET(x) (((x) << CPU_MBIST_GLOBAL_FAIL_LSB) & CPU_MBIST_GLOBAL_FAIL_MASK) -#define CPU_MBIST_DONE_MSB 0 -#define CPU_MBIST_DONE_LSB 0 -#define CPU_MBIST_DONE_MASK 0x00000001 -#define CPU_MBIST_DONE_GET(x) (((x) & CPU_MBIST_DONE_MASK) >> CPU_MBIST_DONE_LSB) -#define CPU_MBIST_DONE_SET(x) (((x) << CPU_MBIST_DONE_LSB) & CPU_MBIST_DONE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct gpio_athr_wlan_reg_reg_s { - volatile unsigned int wlan_gpio_out_low; - volatile unsigned int wlan_gpio_out_w1ts_low; - volatile unsigned int wlan_gpio_out_w1tc_low; - volatile unsigned int wlan_gpio_out_high; - volatile unsigned int wlan_gpio_out_w1ts_high; - volatile unsigned int wlan_gpio_out_w1tc_high; - volatile unsigned int wlan_gpio_enable_low; - volatile unsigned int wlan_gpio_enable_w1ts_low; - volatile unsigned int wlan_gpio_enable_w1tc_low; - volatile unsigned int wlan_gpio_enable_high; - volatile unsigned int wlan_gpio_enable_w1ts_high; - volatile unsigned int wlan_gpio_enable_w1tc_high; - volatile unsigned int wlan_gpio_in_low; - volatile unsigned int wlan_gpio_status_low; - volatile unsigned int wlan_gpio_in_high; - volatile unsigned int wlan_gpio_status_high; - volatile unsigned int wlan_gpio_status_w1ts_low; - volatile unsigned int wlan_gpio_status_w1tc_low; - volatile unsigned int wlan_gpio_status_w1ts_high; - volatile unsigned int wlan_gpio_status_w1tc_high; - volatile unsigned int wlan_gpio_pin0; - volatile unsigned int wlan_gpio_pin1; - volatile unsigned int wlan_gpio_pin2; - volatile unsigned int wlan_gpio_pin3; - volatile unsigned int wlan_gpio_pin4; - volatile unsigned int wlan_gpio_pin5; - volatile unsigned int wlan_gpio_pin6; - volatile unsigned int wlan_gpio_pin7; - volatile unsigned int wlan_gpio_pin8; - volatile unsigned int wlan_gpio_pin9; - volatile unsigned int wlan_gpio_pin10; - volatile unsigned int wlan_gpio_pin11; - volatile unsigned int wlan_gpio_pin12; - volatile unsigned int wlan_gpio_pin13; - volatile unsigned int wlan_gpio_pin14; - volatile unsigned int wlan_gpio_pin15; - volatile unsigned int wlan_gpio_pin16; - volatile unsigned int wlan_gpio_pin17; - volatile unsigned int wlan_gpio_pin18; - volatile unsigned int wlan_gpio_pin19; - volatile unsigned int wlan_gpio_pin20; - volatile unsigned int wlan_gpio_pin21; - volatile unsigned int wlan_gpio_pin22; - volatile unsigned int wlan_gpio_pin23; - volatile unsigned int wlan_gpio_pin24; - volatile unsigned int wlan_gpio_pin25; - volatile unsigned int wlan_gpio_pin26; - volatile unsigned int wlan_gpio_pin27; - volatile unsigned int wlan_gpio_pin28; - volatile unsigned int wlan_gpio_pin29; - volatile unsigned int wlan_gpio_pin30; - volatile unsigned int wlan_gpio_pin31; - volatile unsigned int wlan_gpio_pin32; - volatile unsigned int wlan_gpio_pin33; - volatile unsigned int wlan_gpio_pin34; - volatile unsigned int wlan_gpio_pin35; - volatile unsigned int wlan_gpio_pin36; - volatile unsigned int wlan_gpio_pin37; - volatile unsigned int wlan_gpio_pin38; - volatile unsigned int wlan_gpio_pin39; - volatile unsigned int wlan_gpio_pin40; - volatile unsigned int wlan_gpio_pin41; - volatile unsigned int wlan_gpio_pin42; - volatile unsigned int wlan_gpio_pin43; - volatile unsigned int wlan_gpio_pin44; - volatile unsigned int wlan_gpio_pin45; - volatile unsigned int wlan_gpio_pin46; - volatile unsigned int wlan_gpio_pin47; - volatile unsigned int wlan_gpio_pin48; - volatile unsigned int wlan_gpio_pin49; - volatile unsigned int wlan_gpio_pin50; - volatile unsigned int wlan_gpio_pin51; - volatile unsigned int wlan_gpio_pin52; - volatile unsigned int wlan_gpio_pin53; - volatile unsigned int wlan_gpio_pin54; - volatile unsigned int wlan_gpio_pin55; - volatile unsigned int wlan_gpio_pin56; - volatile unsigned int sdio; - volatile unsigned int wl_soc_apb; - volatile unsigned int wlan_sigma_delta; - volatile unsigned int wl_bootstrap; - volatile unsigned int core_bootstrap_low; - volatile unsigned int core_bootstrap_high; - volatile unsigned int wlan_debug_control; - volatile unsigned int wlan_debug_input_sel; - volatile unsigned int wlan_debug_out; - volatile unsigned int wlan_reset_tuple_status; - volatile unsigned int antenna_control; - volatile unsigned int sdio2; - volatile unsigned int sdhc; - volatile unsigned int amba_debug_bus; - volatile unsigned int cpu_mbist; -} gpio_athr_wlan_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _GPIO_ATHR_WLAN_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/gpio_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/gpio_reg.h deleted file mode 100644 index 5a82a65ab19d..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/gpio_reg.h +++ /dev/null @@ -1,2411 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "gpio_athr_wlan_reg.h" - - -#ifndef BT_HEADERS - -#define GPIO_OUT_ADDRESS WLAN_GPIO_OUT_LOW_ADDRESS -#define WLAN_GPIO_OUT_ADDRESS WLAN_GPIO_OUT_LOW_ADDRESS -#define GPIO_OUT_OFFSET WLAN_GPIO_OUT_LOW_OFFSET -#define WLAN_GPIO_OUT_OFFSET WLAN_GPIO_OUT_LOW_OFFSET -#define GPIO_OUT_DATA_MSB WLAN_GPIO_OUT_LOW_DATA_MSB -#define WLAN_GPIO_OUT_DATA_MSB WLAN_GPIO_OUT_LOW_DATA_MSB -#define GPIO_OUT_DATA_LSB WLAN_GPIO_OUT_LOW_DATA_LSB -#define WLAN_GPIO_OUT_DATA_LSB WLAN_GPIO_OUT_LOW_DATA_LSB -#define GPIO_OUT_DATA_MASK WLAN_GPIO_OUT_LOW_DATA_MASK -#define WLAN_GPIO_OUT_DATA_MASK WLAN_GPIO_OUT_LOW_DATA_MASK -#define GPIO_OUT_DATA_GET(x) WLAN_GPIO_OUT_LOW_DATA_GET(x) -#define WLAN_GPIO_OUT_DATA_GET(x) WLAN_GPIO_OUT_LOW_DATA_GET(x) -#define GPIO_OUT_DATA_SET(x) WLAN_GPIO_OUT_LOW_DATA_SET(x) -#define WLAN_GPIO_OUT_DATA_SET(x) WLAN_GPIO_OUT_LOW_DATA_SET(x) -#define GPIO_OUT_W1TS_ADDRESS WLAN_GPIO_OUT_W1TS_LOW_ADDRESS -#define WLAN_GPIO_OUT_W1TS_ADDRESS WLAN_GPIO_OUT_W1TS_LOW_ADDRESS -#define GPIO_OUT_W1TS_OFFSET WLAN_GPIO_OUT_W1TS_LOW_OFFSET -#define WLAN_GPIO_OUT_W1TS_OFFSET WLAN_GPIO_OUT_W1TS_LOW_OFFSET -#define GPIO_OUT_W1TS_DATA_MSB WLAN_GPIO_OUT_W1TS_LOW_DATA_MSB -#define WLAN_GPIO_OUT_W1TS_DATA_MSB WLAN_GPIO_OUT_W1TS_LOW_DATA_MSB -#define GPIO_OUT_W1TS_DATA_LSB WLAN_GPIO_OUT_W1TS_LOW_DATA_LSB -#define WLAN_GPIO_OUT_W1TS_DATA_LSB WLAN_GPIO_OUT_W1TS_LOW_DATA_LSB -#define GPIO_OUT_W1TS_DATA_MASK WLAN_GPIO_OUT_W1TS_LOW_DATA_MASK -#define WLAN_GPIO_OUT_W1TS_DATA_MASK WLAN_GPIO_OUT_W1TS_LOW_DATA_MASK -#define GPIO_OUT_W1TS_DATA_GET(x) WLAN_GPIO_OUT_W1TS_LOW_DATA_GET(x) -#define WLAN_GPIO_OUT_W1TS_DATA_GET(x) WLAN_GPIO_OUT_W1TS_LOW_DATA_GET(x) -#define GPIO_OUT_W1TS_DATA_SET(x) WLAN_GPIO_OUT_W1TS_LOW_DATA_SET(x) -#define WLAN_GPIO_OUT_W1TS_DATA_SET(x) WLAN_GPIO_OUT_W1TS_LOW_DATA_SET(x) -#define GPIO_OUT_W1TC_ADDRESS WLAN_GPIO_OUT_W1TC_LOW_ADDRESS -#define WLAN_GPIO_OUT_W1TC_ADDRESS WLAN_GPIO_OUT_W1TC_LOW_ADDRESS -#define GPIO_OUT_W1TC_OFFSET WLAN_GPIO_OUT_W1TC_LOW_OFFSET -#define WLAN_GPIO_OUT_W1TC_OFFSET WLAN_GPIO_OUT_W1TC_LOW_OFFSET -#define GPIO_OUT_W1TC_DATA_MSB WLAN_GPIO_OUT_W1TC_LOW_DATA_MSB -#define WLAN_GPIO_OUT_W1TC_DATA_MSB WLAN_GPIO_OUT_W1TC_LOW_DATA_MSB -#define GPIO_OUT_W1TC_DATA_LSB WLAN_GPIO_OUT_W1TC_LOW_DATA_LSB -#define WLAN_GPIO_OUT_W1TC_DATA_LSB WLAN_GPIO_OUT_W1TC_LOW_DATA_LSB -#define GPIO_OUT_W1TC_DATA_MASK WLAN_GPIO_OUT_W1TC_LOW_DATA_MASK -#define WLAN_GPIO_OUT_W1TC_DATA_MASK WLAN_GPIO_OUT_W1TC_LOW_DATA_MASK -#define GPIO_OUT_W1TC_DATA_GET(x) WLAN_GPIO_OUT_W1TC_LOW_DATA_GET(x) -#define WLAN_GPIO_OUT_W1TC_DATA_GET(x) WLAN_GPIO_OUT_W1TC_LOW_DATA_GET(x) -#define GPIO_OUT_W1TC_DATA_SET(x) WLAN_GPIO_OUT_W1TC_LOW_DATA_SET(x) -#define WLAN_GPIO_OUT_W1TC_DATA_SET(x) WLAN_GPIO_OUT_W1TC_LOW_DATA_SET(x) -#define GPIO_OUT_HIGH_ADDRESS WLAN_GPIO_OUT_HIGH_ADDRESS -#define GPIO_OUT_HIGH_OFFSET WLAN_GPIO_OUT_HIGH_OFFSET -#define GPIO_OUT_HIGH_DATA_MSB WLAN_GPIO_OUT_HIGH_DATA_MSB -#define GPIO_OUT_HIGH_DATA_LSB WLAN_GPIO_OUT_HIGH_DATA_LSB -#define GPIO_OUT_HIGH_DATA_MASK WLAN_GPIO_OUT_HIGH_DATA_MASK -#define GPIO_OUT_HIGH_DATA_GET(x) WLAN_GPIO_OUT_HIGH_DATA_GET(x) -#define GPIO_OUT_HIGH_DATA_SET(x) WLAN_GPIO_OUT_HIGH_DATA_SET(x) -#define GPIO_OUT_W1TS_HIGH_ADDRESS WLAN_GPIO_OUT_W1TS_HIGH_ADDRESS -#define GPIO_OUT_W1TS_HIGH_OFFSET WLAN_GPIO_OUT_W1TS_HIGH_OFFSET -#define GPIO_OUT_W1TS_HIGH_DATA_MSB WLAN_GPIO_OUT_W1TS_HIGH_DATA_MSB -#define GPIO_OUT_W1TS_HIGH_DATA_LSB WLAN_GPIO_OUT_W1TS_HIGH_DATA_LSB -#define GPIO_OUT_W1TS_HIGH_DATA_MASK WLAN_GPIO_OUT_W1TS_HIGH_DATA_MASK -#define GPIO_OUT_W1TS_HIGH_DATA_GET(x) WLAN_GPIO_OUT_W1TS_HIGH_DATA_GET(x) -#define GPIO_OUT_W1TS_HIGH_DATA_SET(x) WLAN_GPIO_OUT_W1TS_HIGH_DATA_SET(x) -#define GPIO_OUT_W1TC_HIGH_ADDRESS WLAN_GPIO_OUT_W1TC_HIGH_ADDRESS -#define GPIO_OUT_W1TC_HIGH_OFFSET WLAN_GPIO_OUT_W1TC_HIGH_OFFSET -#define GPIO_OUT_W1TC_HIGH_DATA_MSB WLAN_GPIO_OUT_W1TC_HIGH_DATA_MSB -#define GPIO_OUT_W1TC_HIGH_DATA_LSB WLAN_GPIO_OUT_W1TC_HIGH_DATA_LSB -#define GPIO_OUT_W1TC_HIGH_DATA_MASK WLAN_GPIO_OUT_W1TC_HIGH_DATA_MASK -#define GPIO_OUT_W1TC_HIGH_DATA_GET(x) WLAN_GPIO_OUT_W1TC_HIGH_DATA_GET(x) -#define GPIO_OUT_W1TC_HIGH_DATA_SET(x) WLAN_GPIO_OUT_W1TC_HIGH_DATA_SET(x) -#define GPIO_ENABLE_ADDRESS WLAN_GPIO_ENABLE_LOW_ADDRESS -#define WLAN_GPIO_ENABLE_ADDRESS WLAN_GPIO_ENABLE_LOW_ADDRESS -#define GPIO_ENABLE_OFFSET WLAN_GPIO_ENABLE_LOW_OFFSET -#define WLAN_GPIO_ENABLE_OFFSET WLAN_GPIO_ENABLE_LOW_OFFSET -#define GPIO_ENABLE_DATA_MSB WLAN_GPIO_ENABLE_LOW_DATA_MSB -#define WLAN_GPIO_ENABLE_DATA_MSB WLAN_GPIO_ENABLE_LOW_DATA_MSB -#define GPIO_ENABLE_DATA_LSB WLAN_GPIO_ENABLE_LOW_DATA_LSB -#define WLAN_GPIO_ENABLE_DATA_LSB WLAN_GPIO_ENABLE_LOW_DATA_LSB -#define GPIO_ENABLE_DATA_MASK WLAN_GPIO_ENABLE_LOW_DATA_MASK -#define WLAN_GPIO_ENABLE_DATA_MASK WLAN_GPIO_ENABLE_LOW_DATA_MASK -#define GPIO_ENABLE_DATA_GET(x) WLAN_GPIO_ENABLE_LOW_DATA_GET(x) -#define WLAN_GPIO_ENABLE_DATA_GET(x) WLAN_GPIO_ENABLE_LOW_DATA_GET(x) -#define GPIO_ENABLE_DATA_SET(x) WLAN_GPIO_ENABLE_LOW_DATA_SET(x) -#define WLAN_GPIO_ENABLE_DATA_SET(x) WLAN_GPIO_ENABLE_LOW_DATA_SET(x) -#define GPIO_ENABLE_W1TS_ADDRESS WLAN_GPIO_ENABLE_W1TS_LOW_ADDRESS -#define WLAN_GPIO_ENABLE_W1TS_ADDRESS WLAN_GPIO_ENABLE_W1TS_LOW_ADDRESS -#define GPIO_ENABLE_W1TS_OFFSET WLAN_GPIO_ENABLE_W1TS_LOW_OFFSET -#define WLAN_GPIO_ENABLE_W1TS_OFFSET WLAN_GPIO_ENABLE_W1TS_LOW_OFFSET -#define GPIO_ENABLE_W1TS_DATA_MSB WLAN_GPIO_ENABLE_W1TS_LOW_DATA_MSB -#define WLAN_GPIO_ENABLE_W1TS_DATA_MSB WLAN_GPIO_ENABLE_W1TS_LOW_DATA_MSB -#define GPIO_ENABLE_W1TS_DATA_LSB WLAN_GPIO_ENABLE_W1TS_LOW_DATA_LSB -#define WLAN_GPIO_ENABLE_W1TS_DATA_LSB WLAN_GPIO_ENABLE_W1TS_LOW_DATA_LSB -#define GPIO_ENABLE_W1TS_DATA_MASK WLAN_GPIO_ENABLE_W1TS_LOW_DATA_MASK -#define WLAN_GPIO_ENABLE_W1TS_DATA_MASK WLAN_GPIO_ENABLE_W1TS_LOW_DATA_MASK -#define GPIO_ENABLE_W1TS_DATA_GET(x) WLAN_GPIO_ENABLE_W1TS_LOW_DATA_GET(x) -#define WLAN_GPIO_ENABLE_W1TS_DATA_GET(x) WLAN_GPIO_ENABLE_W1TS_LOW_DATA_GET(x) -#define GPIO_ENABLE_W1TS_DATA_SET(x) WLAN_GPIO_ENABLE_W1TS_LOW_DATA_SET(x) -#define WLAN_GPIO_ENABLE_W1TS_DATA_SET(x) WLAN_GPIO_ENABLE_W1TS_LOW_DATA_SET(x) -#define GPIO_ENABLE_W1TC_ADDRESS WLAN_GPIO_ENABLE_W1TC_LOW_ADDRESS -#define WLAN_GPIO_ENABLE_W1TC_ADDRESS WLAN_GPIO_ENABLE_W1TC_LOW_ADDRESS -#define GPIO_ENABLE_W1TC_OFFSET WLAN_GPIO_ENABLE_W1TC_LOW_OFFSET -#define WLAN_GPIO_ENABLE_W1TC_OFFSET WLAN_GPIO_ENABLE_W1TC_LOW_OFFSET -#define GPIO_ENABLE_W1TC_DATA_MSB WLAN_GPIO_ENABLE_W1TC_LOW_DATA_MSB -#define WLAN_GPIO_ENABLE_W1TC_DATA_MSB WLAN_GPIO_ENABLE_W1TC_LOW_DATA_MSB -#define GPIO_ENABLE_W1TC_DATA_LSB WLAN_GPIO_ENABLE_W1TC_LOW_DATA_LSB -#define WLAN_GPIO_ENABLE_W1TC_DATA_LSB WLAN_GPIO_ENABLE_W1TC_LOW_DATA_LSB -#define GPIO_ENABLE_W1TC_DATA_MASK WLAN_GPIO_ENABLE_W1TC_LOW_DATA_MASK -#define WLAN_GPIO_ENABLE_W1TC_DATA_MASK WLAN_GPIO_ENABLE_W1TC_LOW_DATA_MASK -#define GPIO_ENABLE_W1TC_DATA_GET(x) WLAN_GPIO_ENABLE_W1TC_LOW_DATA_GET(x) -#define WLAN_GPIO_ENABLE_W1TC_DATA_GET(x) WLAN_GPIO_ENABLE_W1TC_LOW_DATA_GET(x) -#define GPIO_ENABLE_W1TC_DATA_SET(x) WLAN_GPIO_ENABLE_W1TC_LOW_DATA_SET(x) -#define WLAN_GPIO_ENABLE_W1TC_DATA_SET(x) WLAN_GPIO_ENABLE_W1TC_LOW_DATA_SET(x) -#define GPIO_ENABLE_HIGH_ADDRESS WLAN_GPIO_ENABLE_HIGH_ADDRESS -#define GPIO_ENABLE_HIGH_OFFSET WLAN_GPIO_ENABLE_HIGH_OFFSET -#define GPIO_ENABLE_HIGH_DATA_MSB WLAN_GPIO_ENABLE_HIGH_DATA_MSB -#define GPIO_ENABLE_HIGH_DATA_LSB WLAN_GPIO_ENABLE_HIGH_DATA_LSB -#define GPIO_ENABLE_HIGH_DATA_MASK WLAN_GPIO_ENABLE_HIGH_DATA_MASK -#define GPIO_ENABLE_HIGH_DATA_GET(x) WLAN_GPIO_ENABLE_HIGH_DATA_GET(x) -#define GPIO_ENABLE_HIGH_DATA_SET(x) WLAN_GPIO_ENABLE_HIGH_DATA_SET(x) -#define GPIO_ENABLE_W1TS_HIGH_ADDRESS WLAN_GPIO_ENABLE_W1TS_HIGH_ADDRESS -#define GPIO_ENABLE_W1TS_HIGH_OFFSET WLAN_GPIO_ENABLE_W1TS_HIGH_OFFSET -#define GPIO_ENABLE_W1TS_HIGH_DATA_MSB WLAN_GPIO_ENABLE_W1TS_HIGH_DATA_MSB -#define GPIO_ENABLE_W1TS_HIGH_DATA_LSB WLAN_GPIO_ENABLE_W1TS_HIGH_DATA_LSB -#define GPIO_ENABLE_W1TS_HIGH_DATA_MASK WLAN_GPIO_ENABLE_W1TS_HIGH_DATA_MASK -#define GPIO_ENABLE_W1TS_HIGH_DATA_GET(x) WLAN_GPIO_ENABLE_W1TS_HIGH_DATA_GET(x) -#define GPIO_ENABLE_W1TS_HIGH_DATA_SET(x) WLAN_GPIO_ENABLE_W1TS_HIGH_DATA_SET(x) -#define GPIO_ENABLE_W1TC_HIGH_ADDRESS WLAN_GPIO_ENABLE_W1TC_HIGH_ADDRESS -#define GPIO_ENABLE_W1TC_HIGH_OFFSET WLAN_GPIO_ENABLE_W1TC_HIGH_OFFSET -#define GPIO_ENABLE_W1TC_HIGH_DATA_MSB WLAN_GPIO_ENABLE_W1TC_HIGH_DATA_MSB -#define GPIO_ENABLE_W1TC_HIGH_DATA_LSB WLAN_GPIO_ENABLE_W1TC_HIGH_DATA_LSB -#define GPIO_ENABLE_W1TC_HIGH_DATA_MASK WLAN_GPIO_ENABLE_W1TC_HIGH_DATA_MASK -#define GPIO_ENABLE_W1TC_HIGH_DATA_GET(x) WLAN_GPIO_ENABLE_W1TC_HIGH_DATA_GET(x) -#define GPIO_ENABLE_W1TC_HIGH_DATA_SET(x) WLAN_GPIO_ENABLE_W1TC_HIGH_DATA_SET(x) -#define GPIO_IN_ADDRESS WLAN_GPIO_IN_LOW_ADDRESS -#define WLAN_GPIO_IN_ADDRESS WLAN_GPIO_IN_LOW_ADDRESS -#define GPIO_IN_OFFSET WLAN_GPIO_IN_LOW_OFFSET -#define WLAN_GPIO_IN_OFFSET WLAN_GPIO_IN_LOW_OFFSET -#define GPIO_IN_DATA_MSB WLAN_GPIO_IN_LOW_DATA_MSB -#define WLAN_GPIO_IN_DATA_MSB WLAN_GPIO_IN_LOW_DATA_MSB -#define GPIO_IN_DATA_LSB WLAN_GPIO_IN_LOW_DATA_LSB -#define WLAN_GPIO_IN_DATA_LSB WLAN_GPIO_IN_LOW_DATA_LSB -#define GPIO_IN_DATA_MASK WLAN_GPIO_IN_LOW_DATA_MASK -#define WLAN_GPIO_IN_DATA_MASK WLAN_GPIO_IN_LOW_DATA_MASK -#define GPIO_IN_DATA_GET(x) WLAN_GPIO_IN_LOW_DATA_GET(x) -#define WLAN_GPIO_IN_DATA_GET(x) WLAN_GPIO_IN_LOW_DATA_GET(x) -#define GPIO_IN_DATA_SET(x) WLAN_GPIO_IN_LOW_DATA_SET(x) -#define WLAN_GPIO_IN_DATA_SET(x) WLAN_GPIO_IN_LOW_DATA_SET(x) -#define GPIO_STATUS_ADDRESS WLAN_GPIO_STATUS_LOW_ADDRESS -#define WLAN_GPIO_STATUS_ADDRESS WLAN_GPIO_STATUS_LOW_ADDRESS -#define GPIO_STATUS_OFFSET WLAN_GPIO_STATUS_LOW_OFFSET -#define WLAN_GPIO_STATUS_OFFSET WLAN_GPIO_STATUS_LOW_OFFSET -#define GPIO_STATUS_INTERRUPT_MSB WLAN_GPIO_STATUS_LOW_INTERRUPT_MSB -#define WLAN_GPIO_STATUS_INTERRUPT_MSB WLAN_GPIO_STATUS_LOW_INTERRUPT_MSB -#define GPIO_STATUS_INTERRUPT_LSB WLAN_GPIO_STATUS_LOW_INTERRUPT_LSB -#define WLAN_GPIO_STATUS_INTERRUPT_LSB WLAN_GPIO_STATUS_LOW_INTERRUPT_LSB -#define GPIO_STATUS_INTERRUPT_MASK WLAN_GPIO_STATUS_LOW_INTERRUPT_MASK -#define WLAN_GPIO_STATUS_INTERRUPT_MASK WLAN_GPIO_STATUS_LOW_INTERRUPT_MASK -#define GPIO_STATUS_INTERRUPT_GET(x) WLAN_GPIO_STATUS_LOW_INTERRUPT_GET(x) -#define WLAN_GPIO_STATUS_INTERRUPT_GET(x) WLAN_GPIO_STATUS_LOW_INTERRUPT_GET(x) -#define GPIO_STATUS_INTERRUPT_SET(x) WLAN_GPIO_STATUS_LOW_INTERRUPT_SET(x) -#define WLAN_GPIO_STATUS_INTERRUPT_SET(x) WLAN_GPIO_STATUS_LOW_INTERRUPT_SET(x) -#define GPIO_IN_HIGH_ADDRESS WLAN_GPIO_IN_HIGH_ADDRESS -#define GPIO_IN_HIGH_OFFSET WLAN_GPIO_IN_HIGH_OFFSET -#define GPIO_IN_HIGH_DATA_MSB WLAN_GPIO_IN_HIGH_DATA_MSB -#define GPIO_IN_HIGH_DATA_LSB WLAN_GPIO_IN_HIGH_DATA_LSB -#define GPIO_IN_HIGH_DATA_MASK WLAN_GPIO_IN_HIGH_DATA_MASK -#define GPIO_IN_HIGH_DATA_GET(x) WLAN_GPIO_IN_HIGH_DATA_GET(x) -#define GPIO_IN_HIGH_DATA_SET(x) WLAN_GPIO_IN_HIGH_DATA_SET(x) -#define GPIO_STATUS_HIGH_ADDRESS WLAN_GPIO_STATUS_HIGH_ADDRESS -#define GPIO_STATUS_HIGH_OFFSET WLAN_GPIO_STATUS_HIGH_OFFSET -#define GPIO_STATUS_HIGH_INTERRUPT_MSB WLAN_GPIO_STATUS_HIGH_INTERRUPT_MSB -#define GPIO_STATUS_HIGH_INTERRUPT_LSB WLAN_GPIO_STATUS_HIGH_INTERRUPT_LSB -#define GPIO_STATUS_HIGH_INTERRUPT_MASK WLAN_GPIO_STATUS_HIGH_INTERRUPT_MASK -#define GPIO_STATUS_HIGH_INTERRUPT_GET(x) WLAN_GPIO_STATUS_HIGH_INTERRUPT_GET(x) -#define GPIO_STATUS_HIGH_INTERRUPT_SET(x) WLAN_GPIO_STATUS_HIGH_INTERRUPT_SET(x) -#define GPIO_STATUS_W1TS_ADDRESS WLAN_GPIO_STATUS_W1TS_LOW_ADDRESS -#define WLAN_GPIO_STATUS_W1TS_ADDRESS WLAN_GPIO_STATUS_W1TS_LOW_ADDRESS -#define GPIO_STATUS_W1TS_OFFSET WLAN_GPIO_STATUS_W1TS_LOW_OFFSET -#define WLAN_GPIO_STATUS_W1TS_OFFSET WLAN_GPIO_STATUS_W1TS_LOW_OFFSET -#define GPIO_STATUS_W1TS_INTERRUPT_MSB WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_MSB -#define WLAN_GPIO_STATUS_W1TS_INTERRUPT_MSB WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_MSB -#define GPIO_STATUS_W1TS_INTERRUPT_LSB WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_LSB -#define WLAN_GPIO_STATUS_W1TS_INTERRUPT_LSB WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_LSB -#define GPIO_STATUS_W1TS_INTERRUPT_MASK WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_MASK -#define WLAN_GPIO_STATUS_W1TS_INTERRUPT_MASK WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_MASK -#define GPIO_STATUS_W1TS_INTERRUPT_GET(x) WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_GET(x) -#define WLAN_GPIO_STATUS_W1TS_INTERRUPT_GET(x) WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_GET(x) -#define GPIO_STATUS_W1TS_INTERRUPT_SET(x) WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_SET(x) -#define WLAN_GPIO_STATUS_W1TS_INTERRUPT_SET(x) WLAN_GPIO_STATUS_W1TS_LOW_INTERRUPT_SET(x) -#define GPIO_STATUS_W1TC_ADDRESS WLAN_GPIO_STATUS_W1TC_LOW_ADDRESS -#define WLAN_GPIO_STATUS_W1TC_ADDRESS WLAN_GPIO_STATUS_W1TC_LOW_ADDRESS -#define GPIO_STATUS_W1TC_OFFSET WLAN_GPIO_STATUS_W1TC_LOW_OFFSET -#define WLAN_GPIO_STATUS_W1TC_OFFSET WLAN_GPIO_STATUS_W1TC_LOW_OFFSET -#define GPIO_STATUS_W1TC_INTERRUPT_MSB WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_MSB -#define WLAN_GPIO_STATUS_W1TC_INTERRUPT_MSB WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_MSB -#define GPIO_STATUS_W1TC_INTERRUPT_LSB WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_LSB -#define WLAN_GPIO_STATUS_W1TC_INTERRUPT_LSB WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_LSB -#define GPIO_STATUS_W1TC_INTERRUPT_MASK WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_MASK -#define WLAN_GPIO_STATUS_W1TC_INTERRUPT_MASK WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_MASK -#define GPIO_STATUS_W1TC_INTERRUPT_GET(x) WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_GET(x) -#define WLAN_GPIO_STATUS_W1TC_INTERRUPT_GET(x) WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_GET(x) -#define GPIO_STATUS_W1TC_INTERRUPT_SET(x) WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_SET(x) -#define WLAN_GPIO_STATUS_W1TC_INTERRUPT_SET(x) WLAN_GPIO_STATUS_W1TC_LOW_INTERRUPT_SET(x) -#define GPIO_STATUS_W1TS_HIGH_ADDRESS WLAN_GPIO_STATUS_W1TS_HIGH_ADDRESS -#define GPIO_STATUS_W1TS_HIGH_OFFSET WLAN_GPIO_STATUS_W1TS_HIGH_OFFSET -#define GPIO_STATUS_W1TS_HIGH_INTERRUPT_MSB WLAN_GPIO_STATUS_W1TS_HIGH_INTERRUPT_MSB -#define GPIO_STATUS_W1TS_HIGH_INTERRUPT_LSB WLAN_GPIO_STATUS_W1TS_HIGH_INTERRUPT_LSB -#define GPIO_STATUS_W1TS_HIGH_INTERRUPT_MASK WLAN_GPIO_STATUS_W1TS_HIGH_INTERRUPT_MASK -#define GPIO_STATUS_W1TS_HIGH_INTERRUPT_GET(x) WLAN_GPIO_STATUS_W1TS_HIGH_INTERRUPT_GET(x) -#define GPIO_STATUS_W1TS_HIGH_INTERRUPT_SET(x) WLAN_GPIO_STATUS_W1TS_HIGH_INTERRUPT_SET(x) -#define GPIO_STATUS_W1TC_HIGH_ADDRESS WLAN_GPIO_STATUS_W1TC_HIGH_ADDRESS -#define GPIO_STATUS_W1TC_HIGH_OFFSET WLAN_GPIO_STATUS_W1TC_HIGH_OFFSET -#define GPIO_STATUS_W1TC_HIGH_INTERRUPT_MSB WLAN_GPIO_STATUS_W1TC_HIGH_INTERRUPT_MSB -#define GPIO_STATUS_W1TC_HIGH_INTERRUPT_LSB WLAN_GPIO_STATUS_W1TC_HIGH_INTERRUPT_LSB -#define GPIO_STATUS_W1TC_HIGH_INTERRUPT_MASK WLAN_GPIO_STATUS_W1TC_HIGH_INTERRUPT_MASK -#define GPIO_STATUS_W1TC_HIGH_INTERRUPT_GET(x) WLAN_GPIO_STATUS_W1TC_HIGH_INTERRUPT_GET(x) -#define GPIO_STATUS_W1TC_HIGH_INTERRUPT_SET(x) WLAN_GPIO_STATUS_W1TC_HIGH_INTERRUPT_SET(x) -#define GPIO_PIN0_ADDRESS WLAN_GPIO_PIN0_ADDRESS -#define GPIO_PIN0_OFFSET WLAN_GPIO_PIN0_OFFSET -#define GPIO_PIN0_CONFIG_MSB WLAN_GPIO_PIN0_CONFIG_MSB -#define GPIO_PIN0_CONFIG_LSB WLAN_GPIO_PIN0_CONFIG_LSB -#define GPIO_PIN0_CONFIG_MASK WLAN_GPIO_PIN0_CONFIG_MASK -#define GPIO_PIN0_CONFIG_GET(x) WLAN_GPIO_PIN0_CONFIG_GET(x) -#define GPIO_PIN0_CONFIG_SET(x) WLAN_GPIO_PIN0_CONFIG_SET(x) -#define GPIO_PIN0_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN0_WAKEUP_ENABLE_MSB -#define GPIO_PIN0_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN0_WAKEUP_ENABLE_LSB -#define GPIO_PIN0_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN0_WAKEUP_ENABLE_MASK -#define GPIO_PIN0_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN0_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN0_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN0_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN0_INT_TYPE_MSB WLAN_GPIO_PIN0_INT_TYPE_MSB -#define GPIO_PIN0_INT_TYPE_LSB WLAN_GPIO_PIN0_INT_TYPE_LSB -#define GPIO_PIN0_INT_TYPE_MASK WLAN_GPIO_PIN0_INT_TYPE_MASK -#define GPIO_PIN0_INT_TYPE_GET(x) WLAN_GPIO_PIN0_INT_TYPE_GET(x) -#define GPIO_PIN0_INT_TYPE_SET(x) WLAN_GPIO_PIN0_INT_TYPE_SET(x) -#define GPIO_PIN0_PAD_PULL_MSB WLAN_GPIO_PIN0_PAD_PULL_MSB -#define GPIO_PIN0_PAD_PULL_LSB WLAN_GPIO_PIN0_PAD_PULL_LSB -#define GPIO_PIN0_PAD_PULL_MASK WLAN_GPIO_PIN0_PAD_PULL_MASK -#define GPIO_PIN0_PAD_PULL_GET(x) WLAN_GPIO_PIN0_PAD_PULL_GET(x) -#define GPIO_PIN0_PAD_PULL_SET(x) WLAN_GPIO_PIN0_PAD_PULL_SET(x) -#define GPIO_PIN0_PAD_STRENGTH_MSB WLAN_GPIO_PIN0_PAD_STRENGTH_MSB -#define GPIO_PIN0_PAD_STRENGTH_LSB WLAN_GPIO_PIN0_PAD_STRENGTH_LSB -#define GPIO_PIN0_PAD_STRENGTH_MASK WLAN_GPIO_PIN0_PAD_STRENGTH_MASK -#define GPIO_PIN0_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN0_PAD_STRENGTH_GET(x) -#define GPIO_PIN0_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN0_PAD_STRENGTH_SET(x) -#define GPIO_PIN0_PAD_DRIVER_MSB WLAN_GPIO_PIN0_PAD_DRIVER_MSB -#define GPIO_PIN0_PAD_DRIVER_LSB WLAN_GPIO_PIN0_PAD_DRIVER_LSB -#define GPIO_PIN0_PAD_DRIVER_MASK WLAN_GPIO_PIN0_PAD_DRIVER_MASK -#define GPIO_PIN0_PAD_DRIVER_GET(x) WLAN_GPIO_PIN0_PAD_DRIVER_GET(x) -#define GPIO_PIN0_PAD_DRIVER_SET(x) WLAN_GPIO_PIN0_PAD_DRIVER_SET(x) -#define GPIO_PIN0_SOURCE_MSB WLAN_GPIO_PIN0_SOURCE_MSB -#define GPIO_PIN0_SOURCE_LSB WLAN_GPIO_PIN0_SOURCE_LSB -#define GPIO_PIN0_SOURCE_MASK WLAN_GPIO_PIN0_SOURCE_MASK -#define GPIO_PIN0_SOURCE_GET(x) WLAN_GPIO_PIN0_SOURCE_GET(x) -#define GPIO_PIN0_SOURCE_SET(x) WLAN_GPIO_PIN0_SOURCE_SET(x) -#define GPIO_PIN1_ADDRESS WLAN_GPIO_PIN1_ADDRESS -#define GPIO_PIN1_OFFSET WLAN_GPIO_PIN1_OFFSET -#define GPIO_PIN1_CONFIG_MSB WLAN_GPIO_PIN1_CONFIG_MSB -#define GPIO_PIN1_CONFIG_LSB WLAN_GPIO_PIN1_CONFIG_LSB -#define GPIO_PIN1_CONFIG_MASK WLAN_GPIO_PIN1_CONFIG_MASK -#define GPIO_PIN1_CONFIG_GET(x) WLAN_GPIO_PIN1_CONFIG_GET(x) -#define GPIO_PIN1_CONFIG_SET(x) WLAN_GPIO_PIN1_CONFIG_SET(x) -#define GPIO_PIN1_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN1_WAKEUP_ENABLE_MSB -#define GPIO_PIN1_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN1_WAKEUP_ENABLE_LSB -#define GPIO_PIN1_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN1_WAKEUP_ENABLE_MASK -#define GPIO_PIN1_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN1_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN1_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN1_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN1_INT_TYPE_MSB WLAN_GPIO_PIN1_INT_TYPE_MSB -#define GPIO_PIN1_INT_TYPE_LSB WLAN_GPIO_PIN1_INT_TYPE_LSB -#define GPIO_PIN1_INT_TYPE_MASK WLAN_GPIO_PIN1_INT_TYPE_MASK -#define GPIO_PIN1_INT_TYPE_GET(x) WLAN_GPIO_PIN1_INT_TYPE_GET(x) -#define GPIO_PIN1_INT_TYPE_SET(x) WLAN_GPIO_PIN1_INT_TYPE_SET(x) -#define GPIO_PIN1_PAD_PULL_MSB WLAN_GPIO_PIN1_PAD_PULL_MSB -#define GPIO_PIN1_PAD_PULL_LSB WLAN_GPIO_PIN1_PAD_PULL_LSB -#define GPIO_PIN1_PAD_PULL_MASK WLAN_GPIO_PIN1_PAD_PULL_MASK -#define GPIO_PIN1_PAD_PULL_GET(x) WLAN_GPIO_PIN1_PAD_PULL_GET(x) -#define GPIO_PIN1_PAD_PULL_SET(x) WLAN_GPIO_PIN1_PAD_PULL_SET(x) -#define GPIO_PIN1_PAD_STRENGTH_MSB WLAN_GPIO_PIN1_PAD_STRENGTH_MSB -#define GPIO_PIN1_PAD_STRENGTH_LSB WLAN_GPIO_PIN1_PAD_STRENGTH_LSB -#define GPIO_PIN1_PAD_STRENGTH_MASK WLAN_GPIO_PIN1_PAD_STRENGTH_MASK -#define GPIO_PIN1_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN1_PAD_STRENGTH_GET(x) -#define GPIO_PIN1_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN1_PAD_STRENGTH_SET(x) -#define GPIO_PIN1_PAD_DRIVER_MSB WLAN_GPIO_PIN1_PAD_DRIVER_MSB -#define GPIO_PIN1_PAD_DRIVER_LSB WLAN_GPIO_PIN1_PAD_DRIVER_LSB -#define GPIO_PIN1_PAD_DRIVER_MASK WLAN_GPIO_PIN1_PAD_DRIVER_MASK -#define GPIO_PIN1_PAD_DRIVER_GET(x) WLAN_GPIO_PIN1_PAD_DRIVER_GET(x) -#define GPIO_PIN1_PAD_DRIVER_SET(x) WLAN_GPIO_PIN1_PAD_DRIVER_SET(x) -#define GPIO_PIN1_SOURCE_MSB WLAN_GPIO_PIN1_SOURCE_MSB -#define GPIO_PIN1_SOURCE_LSB WLAN_GPIO_PIN1_SOURCE_LSB -#define GPIO_PIN1_SOURCE_MASK WLAN_GPIO_PIN1_SOURCE_MASK -#define GPIO_PIN1_SOURCE_GET(x) WLAN_GPIO_PIN1_SOURCE_GET(x) -#define GPIO_PIN1_SOURCE_SET(x) WLAN_GPIO_PIN1_SOURCE_SET(x) -#define GPIO_PIN2_ADDRESS WLAN_GPIO_PIN2_ADDRESS -#define GPIO_PIN2_OFFSET WLAN_GPIO_PIN2_OFFSET -#define GPIO_PIN2_CONFIG_MSB WLAN_GPIO_PIN2_CONFIG_MSB -#define GPIO_PIN2_CONFIG_LSB WLAN_GPIO_PIN2_CONFIG_LSB -#define GPIO_PIN2_CONFIG_MASK WLAN_GPIO_PIN2_CONFIG_MASK -#define GPIO_PIN2_CONFIG_GET(x) WLAN_GPIO_PIN2_CONFIG_GET(x) -#define GPIO_PIN2_CONFIG_SET(x) WLAN_GPIO_PIN2_CONFIG_SET(x) -#define GPIO_PIN2_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN2_WAKEUP_ENABLE_MSB -#define GPIO_PIN2_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN2_WAKEUP_ENABLE_LSB -#define GPIO_PIN2_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN2_WAKEUP_ENABLE_MASK -#define GPIO_PIN2_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN2_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN2_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN2_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN2_INT_TYPE_MSB WLAN_GPIO_PIN2_INT_TYPE_MSB -#define GPIO_PIN2_INT_TYPE_LSB WLAN_GPIO_PIN2_INT_TYPE_LSB -#define GPIO_PIN2_INT_TYPE_MASK WLAN_GPIO_PIN2_INT_TYPE_MASK -#define GPIO_PIN2_INT_TYPE_GET(x) WLAN_GPIO_PIN2_INT_TYPE_GET(x) -#define GPIO_PIN2_INT_TYPE_SET(x) WLAN_GPIO_PIN2_INT_TYPE_SET(x) -#define GPIO_PIN2_PAD_PULL_MSB WLAN_GPIO_PIN2_PAD_PULL_MSB -#define GPIO_PIN2_PAD_PULL_LSB WLAN_GPIO_PIN2_PAD_PULL_LSB -#define GPIO_PIN2_PAD_PULL_MASK WLAN_GPIO_PIN2_PAD_PULL_MASK -#define GPIO_PIN2_PAD_PULL_GET(x) WLAN_GPIO_PIN2_PAD_PULL_GET(x) -#define GPIO_PIN2_PAD_PULL_SET(x) WLAN_GPIO_PIN2_PAD_PULL_SET(x) -#define GPIO_PIN2_PAD_STRENGTH_MSB WLAN_GPIO_PIN2_PAD_STRENGTH_MSB -#define GPIO_PIN2_PAD_STRENGTH_LSB WLAN_GPIO_PIN2_PAD_STRENGTH_LSB -#define GPIO_PIN2_PAD_STRENGTH_MASK WLAN_GPIO_PIN2_PAD_STRENGTH_MASK -#define GPIO_PIN2_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN2_PAD_STRENGTH_GET(x) -#define GPIO_PIN2_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN2_PAD_STRENGTH_SET(x) -#define GPIO_PIN2_PAD_DRIVER_MSB WLAN_GPIO_PIN2_PAD_DRIVER_MSB -#define GPIO_PIN2_PAD_DRIVER_LSB WLAN_GPIO_PIN2_PAD_DRIVER_LSB -#define GPIO_PIN2_PAD_DRIVER_MASK WLAN_GPIO_PIN2_PAD_DRIVER_MASK -#define GPIO_PIN2_PAD_DRIVER_GET(x) WLAN_GPIO_PIN2_PAD_DRIVER_GET(x) -#define GPIO_PIN2_PAD_DRIVER_SET(x) WLAN_GPIO_PIN2_PAD_DRIVER_SET(x) -#define GPIO_PIN2_SOURCE_MSB WLAN_GPIO_PIN2_SOURCE_MSB -#define GPIO_PIN2_SOURCE_LSB WLAN_GPIO_PIN2_SOURCE_LSB -#define GPIO_PIN2_SOURCE_MASK WLAN_GPIO_PIN2_SOURCE_MASK -#define GPIO_PIN2_SOURCE_GET(x) WLAN_GPIO_PIN2_SOURCE_GET(x) -#define GPIO_PIN2_SOURCE_SET(x) WLAN_GPIO_PIN2_SOURCE_SET(x) -#define GPIO_PIN3_ADDRESS WLAN_GPIO_PIN3_ADDRESS -#define GPIO_PIN3_OFFSET WLAN_GPIO_PIN3_OFFSET -#define GPIO_PIN3_CONFIG_MSB WLAN_GPIO_PIN3_CONFIG_MSB -#define GPIO_PIN3_CONFIG_LSB WLAN_GPIO_PIN3_CONFIG_LSB -#define GPIO_PIN3_CONFIG_MASK WLAN_GPIO_PIN3_CONFIG_MASK -#define GPIO_PIN3_CONFIG_GET(x) WLAN_GPIO_PIN3_CONFIG_GET(x) -#define GPIO_PIN3_CONFIG_SET(x) WLAN_GPIO_PIN3_CONFIG_SET(x) -#define GPIO_PIN3_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN3_WAKEUP_ENABLE_MSB -#define GPIO_PIN3_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN3_WAKEUP_ENABLE_LSB -#define GPIO_PIN3_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN3_WAKEUP_ENABLE_MASK -#define GPIO_PIN3_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN3_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN3_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN3_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN3_INT_TYPE_MSB WLAN_GPIO_PIN3_INT_TYPE_MSB -#define GPIO_PIN3_INT_TYPE_LSB WLAN_GPIO_PIN3_INT_TYPE_LSB -#define GPIO_PIN3_INT_TYPE_MASK WLAN_GPIO_PIN3_INT_TYPE_MASK -#define GPIO_PIN3_INT_TYPE_GET(x) WLAN_GPIO_PIN3_INT_TYPE_GET(x) -#define GPIO_PIN3_INT_TYPE_SET(x) WLAN_GPIO_PIN3_INT_TYPE_SET(x) -#define GPIO_PIN3_PAD_PULL_MSB WLAN_GPIO_PIN3_PAD_PULL_MSB -#define GPIO_PIN3_PAD_PULL_LSB WLAN_GPIO_PIN3_PAD_PULL_LSB -#define GPIO_PIN3_PAD_PULL_MASK WLAN_GPIO_PIN3_PAD_PULL_MASK -#define GPIO_PIN3_PAD_PULL_GET(x) WLAN_GPIO_PIN3_PAD_PULL_GET(x) -#define GPIO_PIN3_PAD_PULL_SET(x) WLAN_GPIO_PIN3_PAD_PULL_SET(x) -#define GPIO_PIN3_PAD_STRENGTH_MSB WLAN_GPIO_PIN3_PAD_STRENGTH_MSB -#define GPIO_PIN3_PAD_STRENGTH_LSB WLAN_GPIO_PIN3_PAD_STRENGTH_LSB -#define GPIO_PIN3_PAD_STRENGTH_MASK WLAN_GPIO_PIN3_PAD_STRENGTH_MASK -#define GPIO_PIN3_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN3_PAD_STRENGTH_GET(x) -#define GPIO_PIN3_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN3_PAD_STRENGTH_SET(x) -#define GPIO_PIN3_PAD_DRIVER_MSB WLAN_GPIO_PIN3_PAD_DRIVER_MSB -#define GPIO_PIN3_PAD_DRIVER_LSB WLAN_GPIO_PIN3_PAD_DRIVER_LSB -#define GPIO_PIN3_PAD_DRIVER_MASK WLAN_GPIO_PIN3_PAD_DRIVER_MASK -#define GPIO_PIN3_PAD_DRIVER_GET(x) WLAN_GPIO_PIN3_PAD_DRIVER_GET(x) -#define GPIO_PIN3_PAD_DRIVER_SET(x) WLAN_GPIO_PIN3_PAD_DRIVER_SET(x) -#define GPIO_PIN3_SOURCE_MSB WLAN_GPIO_PIN3_SOURCE_MSB -#define GPIO_PIN3_SOURCE_LSB WLAN_GPIO_PIN3_SOURCE_LSB -#define GPIO_PIN3_SOURCE_MASK WLAN_GPIO_PIN3_SOURCE_MASK -#define GPIO_PIN3_SOURCE_GET(x) WLAN_GPIO_PIN3_SOURCE_GET(x) -#define GPIO_PIN3_SOURCE_SET(x) WLAN_GPIO_PIN3_SOURCE_SET(x) -#define GPIO_PIN4_ADDRESS WLAN_GPIO_PIN4_ADDRESS -#define GPIO_PIN4_OFFSET WLAN_GPIO_PIN4_OFFSET -#define GPIO_PIN4_CONFIG_MSB WLAN_GPIO_PIN4_CONFIG_MSB -#define GPIO_PIN4_CONFIG_LSB WLAN_GPIO_PIN4_CONFIG_LSB -#define GPIO_PIN4_CONFIG_MASK WLAN_GPIO_PIN4_CONFIG_MASK -#define GPIO_PIN4_CONFIG_GET(x) WLAN_GPIO_PIN4_CONFIG_GET(x) -#define GPIO_PIN4_CONFIG_SET(x) WLAN_GPIO_PIN4_CONFIG_SET(x) -#define GPIO_PIN4_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN4_WAKEUP_ENABLE_MSB -#define GPIO_PIN4_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN4_WAKEUP_ENABLE_LSB -#define GPIO_PIN4_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN4_WAKEUP_ENABLE_MASK -#define GPIO_PIN4_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN4_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN4_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN4_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN4_INT_TYPE_MSB WLAN_GPIO_PIN4_INT_TYPE_MSB -#define GPIO_PIN4_INT_TYPE_LSB WLAN_GPIO_PIN4_INT_TYPE_LSB -#define GPIO_PIN4_INT_TYPE_MASK WLAN_GPIO_PIN4_INT_TYPE_MASK -#define GPIO_PIN4_INT_TYPE_GET(x) WLAN_GPIO_PIN4_INT_TYPE_GET(x) -#define GPIO_PIN4_INT_TYPE_SET(x) WLAN_GPIO_PIN4_INT_TYPE_SET(x) -#define GPIO_PIN4_PAD_PULL_MSB WLAN_GPIO_PIN4_PAD_PULL_MSB -#define GPIO_PIN4_PAD_PULL_LSB WLAN_GPIO_PIN4_PAD_PULL_LSB -#define GPIO_PIN4_PAD_PULL_MASK WLAN_GPIO_PIN4_PAD_PULL_MASK -#define GPIO_PIN4_PAD_PULL_GET(x) WLAN_GPIO_PIN4_PAD_PULL_GET(x) -#define GPIO_PIN4_PAD_PULL_SET(x) WLAN_GPIO_PIN4_PAD_PULL_SET(x) -#define GPIO_PIN4_PAD_STRENGTH_MSB WLAN_GPIO_PIN4_PAD_STRENGTH_MSB -#define GPIO_PIN4_PAD_STRENGTH_LSB WLAN_GPIO_PIN4_PAD_STRENGTH_LSB -#define GPIO_PIN4_PAD_STRENGTH_MASK WLAN_GPIO_PIN4_PAD_STRENGTH_MASK -#define GPIO_PIN4_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN4_PAD_STRENGTH_GET(x) -#define GPIO_PIN4_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN4_PAD_STRENGTH_SET(x) -#define GPIO_PIN4_PAD_DRIVER_MSB WLAN_GPIO_PIN4_PAD_DRIVER_MSB -#define GPIO_PIN4_PAD_DRIVER_LSB WLAN_GPIO_PIN4_PAD_DRIVER_LSB -#define GPIO_PIN4_PAD_DRIVER_MASK WLAN_GPIO_PIN4_PAD_DRIVER_MASK -#define GPIO_PIN4_PAD_DRIVER_GET(x) WLAN_GPIO_PIN4_PAD_DRIVER_GET(x) -#define GPIO_PIN4_PAD_DRIVER_SET(x) WLAN_GPIO_PIN4_PAD_DRIVER_SET(x) -#define GPIO_PIN4_SOURCE_MSB WLAN_GPIO_PIN4_SOURCE_MSB -#define GPIO_PIN4_SOURCE_LSB WLAN_GPIO_PIN4_SOURCE_LSB -#define GPIO_PIN4_SOURCE_MASK WLAN_GPIO_PIN4_SOURCE_MASK -#define GPIO_PIN4_SOURCE_GET(x) WLAN_GPIO_PIN4_SOURCE_GET(x) -#define GPIO_PIN4_SOURCE_SET(x) WLAN_GPIO_PIN4_SOURCE_SET(x) -#define GPIO_PIN5_ADDRESS WLAN_GPIO_PIN5_ADDRESS -#define GPIO_PIN5_OFFSET WLAN_GPIO_PIN5_OFFSET -#define GPIO_PIN5_CONFIG_MSB WLAN_GPIO_PIN5_CONFIG_MSB -#define GPIO_PIN5_CONFIG_LSB WLAN_GPIO_PIN5_CONFIG_LSB -#define GPIO_PIN5_CONFIG_MASK WLAN_GPIO_PIN5_CONFIG_MASK -#define GPIO_PIN5_CONFIG_GET(x) WLAN_GPIO_PIN5_CONFIG_GET(x) -#define GPIO_PIN5_CONFIG_SET(x) WLAN_GPIO_PIN5_CONFIG_SET(x) -#define GPIO_PIN5_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN5_WAKEUP_ENABLE_MSB -#define GPIO_PIN5_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN5_WAKEUP_ENABLE_LSB -#define GPIO_PIN5_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN5_WAKEUP_ENABLE_MASK -#define GPIO_PIN5_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN5_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN5_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN5_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN5_INT_TYPE_MSB WLAN_GPIO_PIN5_INT_TYPE_MSB -#define GPIO_PIN5_INT_TYPE_LSB WLAN_GPIO_PIN5_INT_TYPE_LSB -#define GPIO_PIN5_INT_TYPE_MASK WLAN_GPIO_PIN5_INT_TYPE_MASK -#define GPIO_PIN5_INT_TYPE_GET(x) WLAN_GPIO_PIN5_INT_TYPE_GET(x) -#define GPIO_PIN5_INT_TYPE_SET(x) WLAN_GPIO_PIN5_INT_TYPE_SET(x) -#define GPIO_PIN5_PAD_PULL_MSB WLAN_GPIO_PIN5_PAD_PULL_MSB -#define GPIO_PIN5_PAD_PULL_LSB WLAN_GPIO_PIN5_PAD_PULL_LSB -#define GPIO_PIN5_PAD_PULL_MASK WLAN_GPIO_PIN5_PAD_PULL_MASK -#define GPIO_PIN5_PAD_PULL_GET(x) WLAN_GPIO_PIN5_PAD_PULL_GET(x) -#define GPIO_PIN5_PAD_PULL_SET(x) WLAN_GPIO_PIN5_PAD_PULL_SET(x) -#define GPIO_PIN5_PAD_STRENGTH_MSB WLAN_GPIO_PIN5_PAD_STRENGTH_MSB -#define GPIO_PIN5_PAD_STRENGTH_LSB WLAN_GPIO_PIN5_PAD_STRENGTH_LSB -#define GPIO_PIN5_PAD_STRENGTH_MASK WLAN_GPIO_PIN5_PAD_STRENGTH_MASK -#define GPIO_PIN5_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN5_PAD_STRENGTH_GET(x) -#define GPIO_PIN5_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN5_PAD_STRENGTH_SET(x) -#define GPIO_PIN5_PAD_DRIVER_MSB WLAN_GPIO_PIN5_PAD_DRIVER_MSB -#define GPIO_PIN5_PAD_DRIVER_LSB WLAN_GPIO_PIN5_PAD_DRIVER_LSB -#define GPIO_PIN5_PAD_DRIVER_MASK WLAN_GPIO_PIN5_PAD_DRIVER_MASK -#define GPIO_PIN5_PAD_DRIVER_GET(x) WLAN_GPIO_PIN5_PAD_DRIVER_GET(x) -#define GPIO_PIN5_PAD_DRIVER_SET(x) WLAN_GPIO_PIN5_PAD_DRIVER_SET(x) -#define GPIO_PIN5_SOURCE_MSB WLAN_GPIO_PIN5_SOURCE_MSB -#define GPIO_PIN5_SOURCE_LSB WLAN_GPIO_PIN5_SOURCE_LSB -#define GPIO_PIN5_SOURCE_MASK WLAN_GPIO_PIN5_SOURCE_MASK -#define GPIO_PIN5_SOURCE_GET(x) WLAN_GPIO_PIN5_SOURCE_GET(x) -#define GPIO_PIN5_SOURCE_SET(x) WLAN_GPIO_PIN5_SOURCE_SET(x) -#define GPIO_PIN6_ADDRESS WLAN_GPIO_PIN6_ADDRESS -#define GPIO_PIN6_OFFSET WLAN_GPIO_PIN6_OFFSET -#define GPIO_PIN6_CONFIG_MSB WLAN_GPIO_PIN6_CONFIG_MSB -#define GPIO_PIN6_CONFIG_LSB WLAN_GPIO_PIN6_CONFIG_LSB -#define GPIO_PIN6_CONFIG_MASK WLAN_GPIO_PIN6_CONFIG_MASK -#define GPIO_PIN6_CONFIG_GET(x) WLAN_GPIO_PIN6_CONFIG_GET(x) -#define GPIO_PIN6_CONFIG_SET(x) WLAN_GPIO_PIN6_CONFIG_SET(x) -#define GPIO_PIN6_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN6_WAKEUP_ENABLE_MSB -#define GPIO_PIN6_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN6_WAKEUP_ENABLE_LSB -#define GPIO_PIN6_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN6_WAKEUP_ENABLE_MASK -#define GPIO_PIN6_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN6_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN6_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN6_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN6_INT_TYPE_MSB WLAN_GPIO_PIN6_INT_TYPE_MSB -#define GPIO_PIN6_INT_TYPE_LSB WLAN_GPIO_PIN6_INT_TYPE_LSB -#define GPIO_PIN6_INT_TYPE_MASK WLAN_GPIO_PIN6_INT_TYPE_MASK -#define GPIO_PIN6_INT_TYPE_GET(x) WLAN_GPIO_PIN6_INT_TYPE_GET(x) -#define GPIO_PIN6_INT_TYPE_SET(x) WLAN_GPIO_PIN6_INT_TYPE_SET(x) -#define GPIO_PIN6_PAD_PULL_MSB WLAN_GPIO_PIN6_PAD_PULL_MSB -#define GPIO_PIN6_PAD_PULL_LSB WLAN_GPIO_PIN6_PAD_PULL_LSB -#define GPIO_PIN6_PAD_PULL_MASK WLAN_GPIO_PIN6_PAD_PULL_MASK -#define GPIO_PIN6_PAD_PULL_GET(x) WLAN_GPIO_PIN6_PAD_PULL_GET(x) -#define GPIO_PIN6_PAD_PULL_SET(x) WLAN_GPIO_PIN6_PAD_PULL_SET(x) -#define GPIO_PIN6_PAD_STRENGTH_MSB WLAN_GPIO_PIN6_PAD_STRENGTH_MSB -#define GPIO_PIN6_PAD_STRENGTH_LSB WLAN_GPIO_PIN6_PAD_STRENGTH_LSB -#define GPIO_PIN6_PAD_STRENGTH_MASK WLAN_GPIO_PIN6_PAD_STRENGTH_MASK -#define GPIO_PIN6_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN6_PAD_STRENGTH_GET(x) -#define GPIO_PIN6_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN6_PAD_STRENGTH_SET(x) -#define GPIO_PIN6_PAD_DRIVER_MSB WLAN_GPIO_PIN6_PAD_DRIVER_MSB -#define GPIO_PIN6_PAD_DRIVER_LSB WLAN_GPIO_PIN6_PAD_DRIVER_LSB -#define GPIO_PIN6_PAD_DRIVER_MASK WLAN_GPIO_PIN6_PAD_DRIVER_MASK -#define GPIO_PIN6_PAD_DRIVER_GET(x) WLAN_GPIO_PIN6_PAD_DRIVER_GET(x) -#define GPIO_PIN6_PAD_DRIVER_SET(x) WLAN_GPIO_PIN6_PAD_DRIVER_SET(x) -#define GPIO_PIN6_SOURCE_MSB WLAN_GPIO_PIN6_SOURCE_MSB -#define GPIO_PIN6_SOURCE_LSB WLAN_GPIO_PIN6_SOURCE_LSB -#define GPIO_PIN6_SOURCE_MASK WLAN_GPIO_PIN6_SOURCE_MASK -#define GPIO_PIN6_SOURCE_GET(x) WLAN_GPIO_PIN6_SOURCE_GET(x) -#define GPIO_PIN6_SOURCE_SET(x) WLAN_GPIO_PIN6_SOURCE_SET(x) -#define GPIO_PIN7_ADDRESS WLAN_GPIO_PIN7_ADDRESS -#define GPIO_PIN7_OFFSET WLAN_GPIO_PIN7_OFFSET -#define GPIO_PIN7_CONFIG_MSB WLAN_GPIO_PIN7_CONFIG_MSB -#define GPIO_PIN7_CONFIG_LSB WLAN_GPIO_PIN7_CONFIG_LSB -#define GPIO_PIN7_CONFIG_MASK WLAN_GPIO_PIN7_CONFIG_MASK -#define GPIO_PIN7_CONFIG_GET(x) WLAN_GPIO_PIN7_CONFIG_GET(x) -#define GPIO_PIN7_CONFIG_SET(x) WLAN_GPIO_PIN7_CONFIG_SET(x) -#define GPIO_PIN7_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN7_WAKEUP_ENABLE_MSB -#define GPIO_PIN7_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN7_WAKEUP_ENABLE_LSB -#define GPIO_PIN7_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN7_WAKEUP_ENABLE_MASK -#define GPIO_PIN7_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN7_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN7_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN7_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN7_INT_TYPE_MSB WLAN_GPIO_PIN7_INT_TYPE_MSB -#define GPIO_PIN7_INT_TYPE_LSB WLAN_GPIO_PIN7_INT_TYPE_LSB -#define GPIO_PIN7_INT_TYPE_MASK WLAN_GPIO_PIN7_INT_TYPE_MASK -#define GPIO_PIN7_INT_TYPE_GET(x) WLAN_GPIO_PIN7_INT_TYPE_GET(x) -#define GPIO_PIN7_INT_TYPE_SET(x) WLAN_GPIO_PIN7_INT_TYPE_SET(x) -#define GPIO_PIN7_PAD_PULL_MSB WLAN_GPIO_PIN7_PAD_PULL_MSB -#define GPIO_PIN7_PAD_PULL_LSB WLAN_GPIO_PIN7_PAD_PULL_LSB -#define GPIO_PIN7_PAD_PULL_MASK WLAN_GPIO_PIN7_PAD_PULL_MASK -#define GPIO_PIN7_PAD_PULL_GET(x) WLAN_GPIO_PIN7_PAD_PULL_GET(x) -#define GPIO_PIN7_PAD_PULL_SET(x) WLAN_GPIO_PIN7_PAD_PULL_SET(x) -#define GPIO_PIN7_PAD_STRENGTH_MSB WLAN_GPIO_PIN7_PAD_STRENGTH_MSB -#define GPIO_PIN7_PAD_STRENGTH_LSB WLAN_GPIO_PIN7_PAD_STRENGTH_LSB -#define GPIO_PIN7_PAD_STRENGTH_MASK WLAN_GPIO_PIN7_PAD_STRENGTH_MASK -#define GPIO_PIN7_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN7_PAD_STRENGTH_GET(x) -#define GPIO_PIN7_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN7_PAD_STRENGTH_SET(x) -#define GPIO_PIN7_PAD_DRIVER_MSB WLAN_GPIO_PIN7_PAD_DRIVER_MSB -#define GPIO_PIN7_PAD_DRIVER_LSB WLAN_GPIO_PIN7_PAD_DRIVER_LSB -#define GPIO_PIN7_PAD_DRIVER_MASK WLAN_GPIO_PIN7_PAD_DRIVER_MASK -#define GPIO_PIN7_PAD_DRIVER_GET(x) WLAN_GPIO_PIN7_PAD_DRIVER_GET(x) -#define GPIO_PIN7_PAD_DRIVER_SET(x) WLAN_GPIO_PIN7_PAD_DRIVER_SET(x) -#define GPIO_PIN7_SOURCE_MSB WLAN_GPIO_PIN7_SOURCE_MSB -#define GPIO_PIN7_SOURCE_LSB WLAN_GPIO_PIN7_SOURCE_LSB -#define GPIO_PIN7_SOURCE_MASK WLAN_GPIO_PIN7_SOURCE_MASK -#define GPIO_PIN7_SOURCE_GET(x) WLAN_GPIO_PIN7_SOURCE_GET(x) -#define GPIO_PIN7_SOURCE_SET(x) WLAN_GPIO_PIN7_SOURCE_SET(x) -#define GPIO_PIN8_ADDRESS WLAN_GPIO_PIN8_ADDRESS -#define GPIO_PIN8_OFFSET WLAN_GPIO_PIN8_OFFSET -#define GPIO_PIN8_CONFIG_MSB WLAN_GPIO_PIN8_CONFIG_MSB -#define GPIO_PIN8_CONFIG_LSB WLAN_GPIO_PIN8_CONFIG_LSB -#define GPIO_PIN8_CONFIG_MASK WLAN_GPIO_PIN8_CONFIG_MASK -#define GPIO_PIN8_CONFIG_GET(x) WLAN_GPIO_PIN8_CONFIG_GET(x) -#define GPIO_PIN8_CONFIG_SET(x) WLAN_GPIO_PIN8_CONFIG_SET(x) -#define GPIO_PIN8_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN8_WAKEUP_ENABLE_MSB -#define GPIO_PIN8_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN8_WAKEUP_ENABLE_LSB -#define GPIO_PIN8_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN8_WAKEUP_ENABLE_MASK -#define GPIO_PIN8_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN8_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN8_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN8_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN8_INT_TYPE_MSB WLAN_GPIO_PIN8_INT_TYPE_MSB -#define GPIO_PIN8_INT_TYPE_LSB WLAN_GPIO_PIN8_INT_TYPE_LSB -#define GPIO_PIN8_INT_TYPE_MASK WLAN_GPIO_PIN8_INT_TYPE_MASK -#define GPIO_PIN8_INT_TYPE_GET(x) WLAN_GPIO_PIN8_INT_TYPE_GET(x) -#define GPIO_PIN8_INT_TYPE_SET(x) WLAN_GPIO_PIN8_INT_TYPE_SET(x) -#define GPIO_PIN8_PAD_PULL_MSB WLAN_GPIO_PIN8_PAD_PULL_MSB -#define GPIO_PIN8_PAD_PULL_LSB WLAN_GPIO_PIN8_PAD_PULL_LSB -#define GPIO_PIN8_PAD_PULL_MASK WLAN_GPIO_PIN8_PAD_PULL_MASK -#define GPIO_PIN8_PAD_PULL_GET(x) WLAN_GPIO_PIN8_PAD_PULL_GET(x) -#define GPIO_PIN8_PAD_PULL_SET(x) WLAN_GPIO_PIN8_PAD_PULL_SET(x) -#define GPIO_PIN8_PAD_STRENGTH_MSB WLAN_GPIO_PIN8_PAD_STRENGTH_MSB -#define GPIO_PIN8_PAD_STRENGTH_LSB WLAN_GPIO_PIN8_PAD_STRENGTH_LSB -#define GPIO_PIN8_PAD_STRENGTH_MASK WLAN_GPIO_PIN8_PAD_STRENGTH_MASK -#define GPIO_PIN8_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN8_PAD_STRENGTH_GET(x) -#define GPIO_PIN8_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN8_PAD_STRENGTH_SET(x) -#define GPIO_PIN8_PAD_DRIVER_MSB WLAN_GPIO_PIN8_PAD_DRIVER_MSB -#define GPIO_PIN8_PAD_DRIVER_LSB WLAN_GPIO_PIN8_PAD_DRIVER_LSB -#define GPIO_PIN8_PAD_DRIVER_MASK WLAN_GPIO_PIN8_PAD_DRIVER_MASK -#define GPIO_PIN8_PAD_DRIVER_GET(x) WLAN_GPIO_PIN8_PAD_DRIVER_GET(x) -#define GPIO_PIN8_PAD_DRIVER_SET(x) WLAN_GPIO_PIN8_PAD_DRIVER_SET(x) -#define GPIO_PIN8_SOURCE_MSB WLAN_GPIO_PIN8_SOURCE_MSB -#define GPIO_PIN8_SOURCE_LSB WLAN_GPIO_PIN8_SOURCE_LSB -#define GPIO_PIN8_SOURCE_MASK WLAN_GPIO_PIN8_SOURCE_MASK -#define GPIO_PIN8_SOURCE_GET(x) WLAN_GPIO_PIN8_SOURCE_GET(x) -#define GPIO_PIN8_SOURCE_SET(x) WLAN_GPIO_PIN8_SOURCE_SET(x) -#define GPIO_PIN9_ADDRESS WLAN_GPIO_PIN9_ADDRESS -#define GPIO_PIN9_OFFSET WLAN_GPIO_PIN9_OFFSET -#define GPIO_PIN9_CONFIG_MSB WLAN_GPIO_PIN9_CONFIG_MSB -#define GPIO_PIN9_CONFIG_LSB WLAN_GPIO_PIN9_CONFIG_LSB -#define GPIO_PIN9_CONFIG_MASK WLAN_GPIO_PIN9_CONFIG_MASK -#define GPIO_PIN9_CONFIG_GET(x) WLAN_GPIO_PIN9_CONFIG_GET(x) -#define GPIO_PIN9_CONFIG_SET(x) WLAN_GPIO_PIN9_CONFIG_SET(x) -#define GPIO_PIN9_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN9_WAKEUP_ENABLE_MSB -#define GPIO_PIN9_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN9_WAKEUP_ENABLE_LSB -#define GPIO_PIN9_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN9_WAKEUP_ENABLE_MASK -#define GPIO_PIN9_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN9_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN9_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN9_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN9_INT_TYPE_MSB WLAN_GPIO_PIN9_INT_TYPE_MSB -#define GPIO_PIN9_INT_TYPE_LSB WLAN_GPIO_PIN9_INT_TYPE_LSB -#define GPIO_PIN9_INT_TYPE_MASK WLAN_GPIO_PIN9_INT_TYPE_MASK -#define GPIO_PIN9_INT_TYPE_GET(x) WLAN_GPIO_PIN9_INT_TYPE_GET(x) -#define GPIO_PIN9_INT_TYPE_SET(x) WLAN_GPIO_PIN9_INT_TYPE_SET(x) -#define GPIO_PIN9_PAD_PULL_MSB WLAN_GPIO_PIN9_PAD_PULL_MSB -#define GPIO_PIN9_PAD_PULL_LSB WLAN_GPIO_PIN9_PAD_PULL_LSB -#define GPIO_PIN9_PAD_PULL_MASK WLAN_GPIO_PIN9_PAD_PULL_MASK -#define GPIO_PIN9_PAD_PULL_GET(x) WLAN_GPIO_PIN9_PAD_PULL_GET(x) -#define GPIO_PIN9_PAD_PULL_SET(x) WLAN_GPIO_PIN9_PAD_PULL_SET(x) -#define GPIO_PIN9_PAD_STRENGTH_MSB WLAN_GPIO_PIN9_PAD_STRENGTH_MSB -#define GPIO_PIN9_PAD_STRENGTH_LSB WLAN_GPIO_PIN9_PAD_STRENGTH_LSB -#define GPIO_PIN9_PAD_STRENGTH_MASK WLAN_GPIO_PIN9_PAD_STRENGTH_MASK -#define GPIO_PIN9_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN9_PAD_STRENGTH_GET(x) -#define GPIO_PIN9_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN9_PAD_STRENGTH_SET(x) -#define GPIO_PIN9_PAD_DRIVER_MSB WLAN_GPIO_PIN9_PAD_DRIVER_MSB -#define GPIO_PIN9_PAD_DRIVER_LSB WLAN_GPIO_PIN9_PAD_DRIVER_LSB -#define GPIO_PIN9_PAD_DRIVER_MASK WLAN_GPIO_PIN9_PAD_DRIVER_MASK -#define GPIO_PIN9_PAD_DRIVER_GET(x) WLAN_GPIO_PIN9_PAD_DRIVER_GET(x) -#define GPIO_PIN9_PAD_DRIVER_SET(x) WLAN_GPIO_PIN9_PAD_DRIVER_SET(x) -#define GPIO_PIN9_SOURCE_MSB WLAN_GPIO_PIN9_SOURCE_MSB -#define GPIO_PIN9_SOURCE_LSB WLAN_GPIO_PIN9_SOURCE_LSB -#define GPIO_PIN9_SOURCE_MASK WLAN_GPIO_PIN9_SOURCE_MASK -#define GPIO_PIN9_SOURCE_GET(x) WLAN_GPIO_PIN9_SOURCE_GET(x) -#define GPIO_PIN9_SOURCE_SET(x) WLAN_GPIO_PIN9_SOURCE_SET(x) -#define GPIO_PIN10_ADDRESS WLAN_GPIO_PIN10_ADDRESS -#define GPIO_PIN10_OFFSET WLAN_GPIO_PIN10_OFFSET -#define GPIO_PIN10_CONFIG_MSB WLAN_GPIO_PIN10_CONFIG_MSB -#define GPIO_PIN10_CONFIG_LSB WLAN_GPIO_PIN10_CONFIG_LSB -#define GPIO_PIN10_CONFIG_MASK WLAN_GPIO_PIN10_CONFIG_MASK -#define GPIO_PIN10_CONFIG_GET(x) WLAN_GPIO_PIN10_CONFIG_GET(x) -#define GPIO_PIN10_CONFIG_SET(x) WLAN_GPIO_PIN10_CONFIG_SET(x) -#define GPIO_PIN10_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN10_WAKEUP_ENABLE_MSB -#define GPIO_PIN10_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN10_WAKEUP_ENABLE_LSB -#define GPIO_PIN10_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN10_WAKEUP_ENABLE_MASK -#define GPIO_PIN10_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN10_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN10_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN10_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN10_INT_TYPE_MSB WLAN_GPIO_PIN10_INT_TYPE_MSB -#define GPIO_PIN10_INT_TYPE_LSB WLAN_GPIO_PIN10_INT_TYPE_LSB -#define GPIO_PIN10_INT_TYPE_MASK WLAN_GPIO_PIN10_INT_TYPE_MASK -#define GPIO_PIN10_INT_TYPE_GET(x) WLAN_GPIO_PIN10_INT_TYPE_GET(x) -#define GPIO_PIN10_INT_TYPE_SET(x) WLAN_GPIO_PIN10_INT_TYPE_SET(x) -#define GPIO_PIN10_PAD_PULL_MSB WLAN_GPIO_PIN10_PAD_PULL_MSB -#define GPIO_PIN10_PAD_PULL_LSB WLAN_GPIO_PIN10_PAD_PULL_LSB -#define GPIO_PIN10_PAD_PULL_MASK WLAN_GPIO_PIN10_PAD_PULL_MASK -#define GPIO_PIN10_PAD_PULL_GET(x) WLAN_GPIO_PIN10_PAD_PULL_GET(x) -#define GPIO_PIN10_PAD_PULL_SET(x) WLAN_GPIO_PIN10_PAD_PULL_SET(x) -#define GPIO_PIN10_PAD_STRENGTH_MSB WLAN_GPIO_PIN10_PAD_STRENGTH_MSB -#define GPIO_PIN10_PAD_STRENGTH_LSB WLAN_GPIO_PIN10_PAD_STRENGTH_LSB -#define GPIO_PIN10_PAD_STRENGTH_MASK WLAN_GPIO_PIN10_PAD_STRENGTH_MASK -#define GPIO_PIN10_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN10_PAD_STRENGTH_GET(x) -#define GPIO_PIN10_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN10_PAD_STRENGTH_SET(x) -#define GPIO_PIN10_PAD_DRIVER_MSB WLAN_GPIO_PIN10_PAD_DRIVER_MSB -#define GPIO_PIN10_PAD_DRIVER_LSB WLAN_GPIO_PIN10_PAD_DRIVER_LSB -#define GPIO_PIN10_PAD_DRIVER_MASK WLAN_GPIO_PIN10_PAD_DRIVER_MASK -#define GPIO_PIN10_PAD_DRIVER_GET(x) WLAN_GPIO_PIN10_PAD_DRIVER_GET(x) -#define GPIO_PIN10_PAD_DRIVER_SET(x) WLAN_GPIO_PIN10_PAD_DRIVER_SET(x) -#define GPIO_PIN10_SOURCE_MSB WLAN_GPIO_PIN10_SOURCE_MSB -#define GPIO_PIN10_SOURCE_LSB WLAN_GPIO_PIN10_SOURCE_LSB -#define GPIO_PIN10_SOURCE_MASK WLAN_GPIO_PIN10_SOURCE_MASK -#define GPIO_PIN10_SOURCE_GET(x) WLAN_GPIO_PIN10_SOURCE_GET(x) -#define GPIO_PIN10_SOURCE_SET(x) WLAN_GPIO_PIN10_SOURCE_SET(x) -#define GPIO_PIN11_ADDRESS WLAN_GPIO_PIN11_ADDRESS -#define GPIO_PIN11_OFFSET WLAN_GPIO_PIN11_OFFSET -#define GPIO_PIN11_CONFIG_MSB WLAN_GPIO_PIN11_CONFIG_MSB -#define GPIO_PIN11_CONFIG_LSB WLAN_GPIO_PIN11_CONFIG_LSB -#define GPIO_PIN11_CONFIG_MASK WLAN_GPIO_PIN11_CONFIG_MASK -#define GPIO_PIN11_CONFIG_GET(x) WLAN_GPIO_PIN11_CONFIG_GET(x) -#define GPIO_PIN11_CONFIG_SET(x) WLAN_GPIO_PIN11_CONFIG_SET(x) -#define GPIO_PIN11_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN11_WAKEUP_ENABLE_MSB -#define GPIO_PIN11_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN11_WAKEUP_ENABLE_LSB -#define GPIO_PIN11_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN11_WAKEUP_ENABLE_MASK -#define GPIO_PIN11_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN11_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN11_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN11_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN11_INT_TYPE_MSB WLAN_GPIO_PIN11_INT_TYPE_MSB -#define GPIO_PIN11_INT_TYPE_LSB WLAN_GPIO_PIN11_INT_TYPE_LSB -#define GPIO_PIN11_INT_TYPE_MASK WLAN_GPIO_PIN11_INT_TYPE_MASK -#define GPIO_PIN11_INT_TYPE_GET(x) WLAN_GPIO_PIN11_INT_TYPE_GET(x) -#define GPIO_PIN11_INT_TYPE_SET(x) WLAN_GPIO_PIN11_INT_TYPE_SET(x) -#define GPIO_PIN11_PAD_PULL_MSB WLAN_GPIO_PIN11_PAD_PULL_MSB -#define GPIO_PIN11_PAD_PULL_LSB WLAN_GPIO_PIN11_PAD_PULL_LSB -#define GPIO_PIN11_PAD_PULL_MASK WLAN_GPIO_PIN11_PAD_PULL_MASK -#define GPIO_PIN11_PAD_PULL_GET(x) WLAN_GPIO_PIN11_PAD_PULL_GET(x) -#define GPIO_PIN11_PAD_PULL_SET(x) WLAN_GPIO_PIN11_PAD_PULL_SET(x) -#define GPIO_PIN11_PAD_STRENGTH_MSB WLAN_GPIO_PIN11_PAD_STRENGTH_MSB -#define GPIO_PIN11_PAD_STRENGTH_LSB WLAN_GPIO_PIN11_PAD_STRENGTH_LSB -#define GPIO_PIN11_PAD_STRENGTH_MASK WLAN_GPIO_PIN11_PAD_STRENGTH_MASK -#define GPIO_PIN11_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN11_PAD_STRENGTH_GET(x) -#define GPIO_PIN11_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN11_PAD_STRENGTH_SET(x) -#define GPIO_PIN11_PAD_DRIVER_MSB WLAN_GPIO_PIN11_PAD_DRIVER_MSB -#define GPIO_PIN11_PAD_DRIVER_LSB WLAN_GPIO_PIN11_PAD_DRIVER_LSB -#define GPIO_PIN11_PAD_DRIVER_MASK WLAN_GPIO_PIN11_PAD_DRIVER_MASK -#define GPIO_PIN11_PAD_DRIVER_GET(x) WLAN_GPIO_PIN11_PAD_DRIVER_GET(x) -#define GPIO_PIN11_PAD_DRIVER_SET(x) WLAN_GPIO_PIN11_PAD_DRIVER_SET(x) -#define GPIO_PIN11_SOURCE_MSB WLAN_GPIO_PIN11_SOURCE_MSB -#define GPIO_PIN11_SOURCE_LSB WLAN_GPIO_PIN11_SOURCE_LSB -#define GPIO_PIN11_SOURCE_MASK WLAN_GPIO_PIN11_SOURCE_MASK -#define GPIO_PIN11_SOURCE_GET(x) WLAN_GPIO_PIN11_SOURCE_GET(x) -#define GPIO_PIN11_SOURCE_SET(x) WLAN_GPIO_PIN11_SOURCE_SET(x) -#define GPIO_PIN12_ADDRESS WLAN_GPIO_PIN12_ADDRESS -#define GPIO_PIN12_OFFSET WLAN_GPIO_PIN12_OFFSET -#define GPIO_PIN12_CONFIG_MSB WLAN_GPIO_PIN12_CONFIG_MSB -#define GPIO_PIN12_CONFIG_LSB WLAN_GPIO_PIN12_CONFIG_LSB -#define GPIO_PIN12_CONFIG_MASK WLAN_GPIO_PIN12_CONFIG_MASK -#define GPIO_PIN12_CONFIG_GET(x) WLAN_GPIO_PIN12_CONFIG_GET(x) -#define GPIO_PIN12_CONFIG_SET(x) WLAN_GPIO_PIN12_CONFIG_SET(x) -#define GPIO_PIN12_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN12_WAKEUP_ENABLE_MSB -#define GPIO_PIN12_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN12_WAKEUP_ENABLE_LSB -#define GPIO_PIN12_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN12_WAKEUP_ENABLE_MASK -#define GPIO_PIN12_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN12_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN12_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN12_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN12_INT_TYPE_MSB WLAN_GPIO_PIN12_INT_TYPE_MSB -#define GPIO_PIN12_INT_TYPE_LSB WLAN_GPIO_PIN12_INT_TYPE_LSB -#define GPIO_PIN12_INT_TYPE_MASK WLAN_GPIO_PIN12_INT_TYPE_MASK -#define GPIO_PIN12_INT_TYPE_GET(x) WLAN_GPIO_PIN12_INT_TYPE_GET(x) -#define GPIO_PIN12_INT_TYPE_SET(x) WLAN_GPIO_PIN12_INT_TYPE_SET(x) -#define GPIO_PIN12_PAD_PULL_MSB WLAN_GPIO_PIN12_PAD_PULL_MSB -#define GPIO_PIN12_PAD_PULL_LSB WLAN_GPIO_PIN12_PAD_PULL_LSB -#define GPIO_PIN12_PAD_PULL_MASK WLAN_GPIO_PIN12_PAD_PULL_MASK -#define GPIO_PIN12_PAD_PULL_GET(x) WLAN_GPIO_PIN12_PAD_PULL_GET(x) -#define GPIO_PIN12_PAD_PULL_SET(x) WLAN_GPIO_PIN12_PAD_PULL_SET(x) -#define GPIO_PIN12_PAD_STRENGTH_MSB WLAN_GPIO_PIN12_PAD_STRENGTH_MSB -#define GPIO_PIN12_PAD_STRENGTH_LSB WLAN_GPIO_PIN12_PAD_STRENGTH_LSB -#define GPIO_PIN12_PAD_STRENGTH_MASK WLAN_GPIO_PIN12_PAD_STRENGTH_MASK -#define GPIO_PIN12_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN12_PAD_STRENGTH_GET(x) -#define GPIO_PIN12_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN12_PAD_STRENGTH_SET(x) -#define GPIO_PIN12_PAD_DRIVER_MSB WLAN_GPIO_PIN12_PAD_DRIVER_MSB -#define GPIO_PIN12_PAD_DRIVER_LSB WLAN_GPIO_PIN12_PAD_DRIVER_LSB -#define GPIO_PIN12_PAD_DRIVER_MASK WLAN_GPIO_PIN12_PAD_DRIVER_MASK -#define GPIO_PIN12_PAD_DRIVER_GET(x) WLAN_GPIO_PIN12_PAD_DRIVER_GET(x) -#define GPIO_PIN12_PAD_DRIVER_SET(x) WLAN_GPIO_PIN12_PAD_DRIVER_SET(x) -#define GPIO_PIN12_SOURCE_MSB WLAN_GPIO_PIN12_SOURCE_MSB -#define GPIO_PIN12_SOURCE_LSB WLAN_GPIO_PIN12_SOURCE_LSB -#define GPIO_PIN12_SOURCE_MASK WLAN_GPIO_PIN12_SOURCE_MASK -#define GPIO_PIN12_SOURCE_GET(x) WLAN_GPIO_PIN12_SOURCE_GET(x) -#define GPIO_PIN12_SOURCE_SET(x) WLAN_GPIO_PIN12_SOURCE_SET(x) -#define GPIO_PIN13_ADDRESS WLAN_GPIO_PIN13_ADDRESS -#define GPIO_PIN13_OFFSET WLAN_GPIO_PIN13_OFFSET -#define GPIO_PIN13_CONFIG_MSB WLAN_GPIO_PIN13_CONFIG_MSB -#define GPIO_PIN13_CONFIG_LSB WLAN_GPIO_PIN13_CONFIG_LSB -#define GPIO_PIN13_CONFIG_MASK WLAN_GPIO_PIN13_CONFIG_MASK -#define GPIO_PIN13_CONFIG_GET(x) WLAN_GPIO_PIN13_CONFIG_GET(x) -#define GPIO_PIN13_CONFIG_SET(x) WLAN_GPIO_PIN13_CONFIG_SET(x) -#define GPIO_PIN13_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN13_WAKEUP_ENABLE_MSB -#define GPIO_PIN13_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN13_WAKEUP_ENABLE_LSB -#define GPIO_PIN13_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN13_WAKEUP_ENABLE_MASK -#define GPIO_PIN13_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN13_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN13_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN13_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN13_INT_TYPE_MSB WLAN_GPIO_PIN13_INT_TYPE_MSB -#define GPIO_PIN13_INT_TYPE_LSB WLAN_GPIO_PIN13_INT_TYPE_LSB -#define GPIO_PIN13_INT_TYPE_MASK WLAN_GPIO_PIN13_INT_TYPE_MASK -#define GPIO_PIN13_INT_TYPE_GET(x) WLAN_GPIO_PIN13_INT_TYPE_GET(x) -#define GPIO_PIN13_INT_TYPE_SET(x) WLAN_GPIO_PIN13_INT_TYPE_SET(x) -#define GPIO_PIN13_PAD_PULL_MSB WLAN_GPIO_PIN13_PAD_PULL_MSB -#define GPIO_PIN13_PAD_PULL_LSB WLAN_GPIO_PIN13_PAD_PULL_LSB -#define GPIO_PIN13_PAD_PULL_MASK WLAN_GPIO_PIN13_PAD_PULL_MASK -#define GPIO_PIN13_PAD_PULL_GET(x) WLAN_GPIO_PIN13_PAD_PULL_GET(x) -#define GPIO_PIN13_PAD_PULL_SET(x) WLAN_GPIO_PIN13_PAD_PULL_SET(x) -#define GPIO_PIN13_PAD_STRENGTH_MSB WLAN_GPIO_PIN13_PAD_STRENGTH_MSB -#define GPIO_PIN13_PAD_STRENGTH_LSB WLAN_GPIO_PIN13_PAD_STRENGTH_LSB -#define GPIO_PIN13_PAD_STRENGTH_MASK WLAN_GPIO_PIN13_PAD_STRENGTH_MASK -#define GPIO_PIN13_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN13_PAD_STRENGTH_GET(x) -#define GPIO_PIN13_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN13_PAD_STRENGTH_SET(x) -#define GPIO_PIN13_PAD_DRIVER_MSB WLAN_GPIO_PIN13_PAD_DRIVER_MSB -#define GPIO_PIN13_PAD_DRIVER_LSB WLAN_GPIO_PIN13_PAD_DRIVER_LSB -#define GPIO_PIN13_PAD_DRIVER_MASK WLAN_GPIO_PIN13_PAD_DRIVER_MASK -#define GPIO_PIN13_PAD_DRIVER_GET(x) WLAN_GPIO_PIN13_PAD_DRIVER_GET(x) -#define GPIO_PIN13_PAD_DRIVER_SET(x) WLAN_GPIO_PIN13_PAD_DRIVER_SET(x) -#define GPIO_PIN13_SOURCE_MSB WLAN_GPIO_PIN13_SOURCE_MSB -#define GPIO_PIN13_SOURCE_LSB WLAN_GPIO_PIN13_SOURCE_LSB -#define GPIO_PIN13_SOURCE_MASK WLAN_GPIO_PIN13_SOURCE_MASK -#define GPIO_PIN13_SOURCE_GET(x) WLAN_GPIO_PIN13_SOURCE_GET(x) -#define GPIO_PIN13_SOURCE_SET(x) WLAN_GPIO_PIN13_SOURCE_SET(x) -#define GPIO_PIN14_ADDRESS WLAN_GPIO_PIN14_ADDRESS -#define GPIO_PIN14_OFFSET WLAN_GPIO_PIN14_OFFSET -#define GPIO_PIN14_CONFIG_MSB WLAN_GPIO_PIN14_CONFIG_MSB -#define GPIO_PIN14_CONFIG_LSB WLAN_GPIO_PIN14_CONFIG_LSB -#define GPIO_PIN14_CONFIG_MASK WLAN_GPIO_PIN14_CONFIG_MASK -#define GPIO_PIN14_CONFIG_GET(x) WLAN_GPIO_PIN14_CONFIG_GET(x) -#define GPIO_PIN14_CONFIG_SET(x) WLAN_GPIO_PIN14_CONFIG_SET(x) -#define GPIO_PIN14_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN14_WAKEUP_ENABLE_MSB -#define GPIO_PIN14_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN14_WAKEUP_ENABLE_LSB -#define GPIO_PIN14_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN14_WAKEUP_ENABLE_MASK -#define GPIO_PIN14_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN14_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN14_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN14_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN14_INT_TYPE_MSB WLAN_GPIO_PIN14_INT_TYPE_MSB -#define GPIO_PIN14_INT_TYPE_LSB WLAN_GPIO_PIN14_INT_TYPE_LSB -#define GPIO_PIN14_INT_TYPE_MASK WLAN_GPIO_PIN14_INT_TYPE_MASK -#define GPIO_PIN14_INT_TYPE_GET(x) WLAN_GPIO_PIN14_INT_TYPE_GET(x) -#define GPIO_PIN14_INT_TYPE_SET(x) WLAN_GPIO_PIN14_INT_TYPE_SET(x) -#define GPIO_PIN14_PAD_PULL_MSB WLAN_GPIO_PIN14_PAD_PULL_MSB -#define GPIO_PIN14_PAD_PULL_LSB WLAN_GPIO_PIN14_PAD_PULL_LSB -#define GPIO_PIN14_PAD_PULL_MASK WLAN_GPIO_PIN14_PAD_PULL_MASK -#define GPIO_PIN14_PAD_PULL_GET(x) WLAN_GPIO_PIN14_PAD_PULL_GET(x) -#define GPIO_PIN14_PAD_PULL_SET(x) WLAN_GPIO_PIN14_PAD_PULL_SET(x) -#define GPIO_PIN14_PAD_STRENGTH_MSB WLAN_GPIO_PIN14_PAD_STRENGTH_MSB -#define GPIO_PIN14_PAD_STRENGTH_LSB WLAN_GPIO_PIN14_PAD_STRENGTH_LSB -#define GPIO_PIN14_PAD_STRENGTH_MASK WLAN_GPIO_PIN14_PAD_STRENGTH_MASK -#define GPIO_PIN14_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN14_PAD_STRENGTH_GET(x) -#define GPIO_PIN14_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN14_PAD_STRENGTH_SET(x) -#define GPIO_PIN14_PAD_DRIVER_MSB WLAN_GPIO_PIN14_PAD_DRIVER_MSB -#define GPIO_PIN14_PAD_DRIVER_LSB WLAN_GPIO_PIN14_PAD_DRIVER_LSB -#define GPIO_PIN14_PAD_DRIVER_MASK WLAN_GPIO_PIN14_PAD_DRIVER_MASK -#define GPIO_PIN14_PAD_DRIVER_GET(x) WLAN_GPIO_PIN14_PAD_DRIVER_GET(x) -#define GPIO_PIN14_PAD_DRIVER_SET(x) WLAN_GPIO_PIN14_PAD_DRIVER_SET(x) -#define GPIO_PIN14_SOURCE_MSB WLAN_GPIO_PIN14_SOURCE_MSB -#define GPIO_PIN14_SOURCE_LSB WLAN_GPIO_PIN14_SOURCE_LSB -#define GPIO_PIN14_SOURCE_MASK WLAN_GPIO_PIN14_SOURCE_MASK -#define GPIO_PIN14_SOURCE_GET(x) WLAN_GPIO_PIN14_SOURCE_GET(x) -#define GPIO_PIN14_SOURCE_SET(x) WLAN_GPIO_PIN14_SOURCE_SET(x) -#define GPIO_PIN15_ADDRESS WLAN_GPIO_PIN15_ADDRESS -#define GPIO_PIN15_OFFSET WLAN_GPIO_PIN15_OFFSET -#define GPIO_PIN15_CONFIG_MSB WLAN_GPIO_PIN15_CONFIG_MSB -#define GPIO_PIN15_CONFIG_LSB WLAN_GPIO_PIN15_CONFIG_LSB -#define GPIO_PIN15_CONFIG_MASK WLAN_GPIO_PIN15_CONFIG_MASK -#define GPIO_PIN15_CONFIG_GET(x) WLAN_GPIO_PIN15_CONFIG_GET(x) -#define GPIO_PIN15_CONFIG_SET(x) WLAN_GPIO_PIN15_CONFIG_SET(x) -#define GPIO_PIN15_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN15_WAKEUP_ENABLE_MSB -#define GPIO_PIN15_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN15_WAKEUP_ENABLE_LSB -#define GPIO_PIN15_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN15_WAKEUP_ENABLE_MASK -#define GPIO_PIN15_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN15_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN15_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN15_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN15_INT_TYPE_MSB WLAN_GPIO_PIN15_INT_TYPE_MSB -#define GPIO_PIN15_INT_TYPE_LSB WLAN_GPIO_PIN15_INT_TYPE_LSB -#define GPIO_PIN15_INT_TYPE_MASK WLAN_GPIO_PIN15_INT_TYPE_MASK -#define GPIO_PIN15_INT_TYPE_GET(x) WLAN_GPIO_PIN15_INT_TYPE_GET(x) -#define GPIO_PIN15_INT_TYPE_SET(x) WLAN_GPIO_PIN15_INT_TYPE_SET(x) -#define GPIO_PIN15_PAD_PULL_MSB WLAN_GPIO_PIN15_PAD_PULL_MSB -#define GPIO_PIN15_PAD_PULL_LSB WLAN_GPIO_PIN15_PAD_PULL_LSB -#define GPIO_PIN15_PAD_PULL_MASK WLAN_GPIO_PIN15_PAD_PULL_MASK -#define GPIO_PIN15_PAD_PULL_GET(x) WLAN_GPIO_PIN15_PAD_PULL_GET(x) -#define GPIO_PIN15_PAD_PULL_SET(x) WLAN_GPIO_PIN15_PAD_PULL_SET(x) -#define GPIO_PIN15_PAD_STRENGTH_MSB WLAN_GPIO_PIN15_PAD_STRENGTH_MSB -#define GPIO_PIN15_PAD_STRENGTH_LSB WLAN_GPIO_PIN15_PAD_STRENGTH_LSB -#define GPIO_PIN15_PAD_STRENGTH_MASK WLAN_GPIO_PIN15_PAD_STRENGTH_MASK -#define GPIO_PIN15_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN15_PAD_STRENGTH_GET(x) -#define GPIO_PIN15_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN15_PAD_STRENGTH_SET(x) -#define GPIO_PIN15_PAD_DRIVER_MSB WLAN_GPIO_PIN15_PAD_DRIVER_MSB -#define GPIO_PIN15_PAD_DRIVER_LSB WLAN_GPIO_PIN15_PAD_DRIVER_LSB -#define GPIO_PIN15_PAD_DRIVER_MASK WLAN_GPIO_PIN15_PAD_DRIVER_MASK -#define GPIO_PIN15_PAD_DRIVER_GET(x) WLAN_GPIO_PIN15_PAD_DRIVER_GET(x) -#define GPIO_PIN15_PAD_DRIVER_SET(x) WLAN_GPIO_PIN15_PAD_DRIVER_SET(x) -#define GPIO_PIN15_SOURCE_MSB WLAN_GPIO_PIN15_SOURCE_MSB -#define GPIO_PIN15_SOURCE_LSB WLAN_GPIO_PIN15_SOURCE_LSB -#define GPIO_PIN15_SOURCE_MASK WLAN_GPIO_PIN15_SOURCE_MASK -#define GPIO_PIN15_SOURCE_GET(x) WLAN_GPIO_PIN15_SOURCE_GET(x) -#define GPIO_PIN15_SOURCE_SET(x) WLAN_GPIO_PIN15_SOURCE_SET(x) -#define GPIO_PIN16_ADDRESS WLAN_GPIO_PIN16_ADDRESS -#define GPIO_PIN16_OFFSET WLAN_GPIO_PIN16_OFFSET -#define GPIO_PIN16_CONFIG_MSB WLAN_GPIO_PIN16_CONFIG_MSB -#define GPIO_PIN16_CONFIG_LSB WLAN_GPIO_PIN16_CONFIG_LSB -#define GPIO_PIN16_CONFIG_MASK WLAN_GPIO_PIN16_CONFIG_MASK -#define GPIO_PIN16_CONFIG_GET(x) WLAN_GPIO_PIN16_CONFIG_GET(x) -#define GPIO_PIN16_CONFIG_SET(x) WLAN_GPIO_PIN16_CONFIG_SET(x) -#define GPIO_PIN16_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN16_WAKEUP_ENABLE_MSB -#define GPIO_PIN16_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN16_WAKEUP_ENABLE_LSB -#define GPIO_PIN16_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN16_WAKEUP_ENABLE_MASK -#define GPIO_PIN16_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN16_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN16_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN16_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN16_INT_TYPE_MSB WLAN_GPIO_PIN16_INT_TYPE_MSB -#define GPIO_PIN16_INT_TYPE_LSB WLAN_GPIO_PIN16_INT_TYPE_LSB -#define GPIO_PIN16_INT_TYPE_MASK WLAN_GPIO_PIN16_INT_TYPE_MASK -#define GPIO_PIN16_INT_TYPE_GET(x) WLAN_GPIO_PIN16_INT_TYPE_GET(x) -#define GPIO_PIN16_INT_TYPE_SET(x) WLAN_GPIO_PIN16_INT_TYPE_SET(x) -#define GPIO_PIN16_PAD_PULL_MSB WLAN_GPIO_PIN16_PAD_PULL_MSB -#define GPIO_PIN16_PAD_PULL_LSB WLAN_GPIO_PIN16_PAD_PULL_LSB -#define GPIO_PIN16_PAD_PULL_MASK WLAN_GPIO_PIN16_PAD_PULL_MASK -#define GPIO_PIN16_PAD_PULL_GET(x) WLAN_GPIO_PIN16_PAD_PULL_GET(x) -#define GPIO_PIN16_PAD_PULL_SET(x) WLAN_GPIO_PIN16_PAD_PULL_SET(x) -#define GPIO_PIN16_PAD_STRENGTH_MSB WLAN_GPIO_PIN16_PAD_STRENGTH_MSB -#define GPIO_PIN16_PAD_STRENGTH_LSB WLAN_GPIO_PIN16_PAD_STRENGTH_LSB -#define GPIO_PIN16_PAD_STRENGTH_MASK WLAN_GPIO_PIN16_PAD_STRENGTH_MASK -#define GPIO_PIN16_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN16_PAD_STRENGTH_GET(x) -#define GPIO_PIN16_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN16_PAD_STRENGTH_SET(x) -#define GPIO_PIN16_PAD_DRIVER_MSB WLAN_GPIO_PIN16_PAD_DRIVER_MSB -#define GPIO_PIN16_PAD_DRIVER_LSB WLAN_GPIO_PIN16_PAD_DRIVER_LSB -#define GPIO_PIN16_PAD_DRIVER_MASK WLAN_GPIO_PIN16_PAD_DRIVER_MASK -#define GPIO_PIN16_PAD_DRIVER_GET(x) WLAN_GPIO_PIN16_PAD_DRIVER_GET(x) -#define GPIO_PIN16_PAD_DRIVER_SET(x) WLAN_GPIO_PIN16_PAD_DRIVER_SET(x) -#define GPIO_PIN16_SOURCE_MSB WLAN_GPIO_PIN16_SOURCE_MSB -#define GPIO_PIN16_SOURCE_LSB WLAN_GPIO_PIN16_SOURCE_LSB -#define GPIO_PIN16_SOURCE_MASK WLAN_GPIO_PIN16_SOURCE_MASK -#define GPIO_PIN16_SOURCE_GET(x) WLAN_GPIO_PIN16_SOURCE_GET(x) -#define GPIO_PIN16_SOURCE_SET(x) WLAN_GPIO_PIN16_SOURCE_SET(x) -#define GPIO_PIN17_ADDRESS WLAN_GPIO_PIN17_ADDRESS -#define GPIO_PIN17_OFFSET WLAN_GPIO_PIN17_OFFSET -#define GPIO_PIN17_CONFIG_MSB WLAN_GPIO_PIN17_CONFIG_MSB -#define GPIO_PIN17_CONFIG_LSB WLAN_GPIO_PIN17_CONFIG_LSB -#define GPIO_PIN17_CONFIG_MASK WLAN_GPIO_PIN17_CONFIG_MASK -#define GPIO_PIN17_CONFIG_GET(x) WLAN_GPIO_PIN17_CONFIG_GET(x) -#define GPIO_PIN17_CONFIG_SET(x) WLAN_GPIO_PIN17_CONFIG_SET(x) -#define GPIO_PIN17_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN17_WAKEUP_ENABLE_MSB -#define GPIO_PIN17_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN17_WAKEUP_ENABLE_LSB -#define GPIO_PIN17_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN17_WAKEUP_ENABLE_MASK -#define GPIO_PIN17_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN17_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN17_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN17_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN17_INT_TYPE_MSB WLAN_GPIO_PIN17_INT_TYPE_MSB -#define GPIO_PIN17_INT_TYPE_LSB WLAN_GPIO_PIN17_INT_TYPE_LSB -#define GPIO_PIN17_INT_TYPE_MASK WLAN_GPIO_PIN17_INT_TYPE_MASK -#define GPIO_PIN17_INT_TYPE_GET(x) WLAN_GPIO_PIN17_INT_TYPE_GET(x) -#define GPIO_PIN17_INT_TYPE_SET(x) WLAN_GPIO_PIN17_INT_TYPE_SET(x) -#define GPIO_PIN17_PAD_PULL_MSB WLAN_GPIO_PIN17_PAD_PULL_MSB -#define GPIO_PIN17_PAD_PULL_LSB WLAN_GPIO_PIN17_PAD_PULL_LSB -#define GPIO_PIN17_PAD_PULL_MASK WLAN_GPIO_PIN17_PAD_PULL_MASK -#define GPIO_PIN17_PAD_PULL_GET(x) WLAN_GPIO_PIN17_PAD_PULL_GET(x) -#define GPIO_PIN17_PAD_PULL_SET(x) WLAN_GPIO_PIN17_PAD_PULL_SET(x) -#define GPIO_PIN17_PAD_STRENGTH_MSB WLAN_GPIO_PIN17_PAD_STRENGTH_MSB -#define GPIO_PIN17_PAD_STRENGTH_LSB WLAN_GPIO_PIN17_PAD_STRENGTH_LSB -#define GPIO_PIN17_PAD_STRENGTH_MASK WLAN_GPIO_PIN17_PAD_STRENGTH_MASK -#define GPIO_PIN17_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN17_PAD_STRENGTH_GET(x) -#define GPIO_PIN17_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN17_PAD_STRENGTH_SET(x) -#define GPIO_PIN17_PAD_DRIVER_MSB WLAN_GPIO_PIN17_PAD_DRIVER_MSB -#define GPIO_PIN17_PAD_DRIVER_LSB WLAN_GPIO_PIN17_PAD_DRIVER_LSB -#define GPIO_PIN17_PAD_DRIVER_MASK WLAN_GPIO_PIN17_PAD_DRIVER_MASK -#define GPIO_PIN17_PAD_DRIVER_GET(x) WLAN_GPIO_PIN17_PAD_DRIVER_GET(x) -#define GPIO_PIN17_PAD_DRIVER_SET(x) WLAN_GPIO_PIN17_PAD_DRIVER_SET(x) -#define GPIO_PIN17_SOURCE_MSB WLAN_GPIO_PIN17_SOURCE_MSB -#define GPIO_PIN17_SOURCE_LSB WLAN_GPIO_PIN17_SOURCE_LSB -#define GPIO_PIN17_SOURCE_MASK WLAN_GPIO_PIN17_SOURCE_MASK -#define GPIO_PIN17_SOURCE_GET(x) WLAN_GPIO_PIN17_SOURCE_GET(x) -#define GPIO_PIN17_SOURCE_SET(x) WLAN_GPIO_PIN17_SOURCE_SET(x) -#define GPIO_PIN18_ADDRESS WLAN_GPIO_PIN18_ADDRESS -#define GPIO_PIN18_OFFSET WLAN_GPIO_PIN18_OFFSET -#define GPIO_PIN18_CONFIG_MSB WLAN_GPIO_PIN18_CONFIG_MSB -#define GPIO_PIN18_CONFIG_LSB WLAN_GPIO_PIN18_CONFIG_LSB -#define GPIO_PIN18_CONFIG_MASK WLAN_GPIO_PIN18_CONFIG_MASK -#define GPIO_PIN18_CONFIG_GET(x) WLAN_GPIO_PIN18_CONFIG_GET(x) -#define GPIO_PIN18_CONFIG_SET(x) WLAN_GPIO_PIN18_CONFIG_SET(x) -#define GPIO_PIN18_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN18_WAKEUP_ENABLE_MSB -#define GPIO_PIN18_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN18_WAKEUP_ENABLE_LSB -#define GPIO_PIN18_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN18_WAKEUP_ENABLE_MASK -#define GPIO_PIN18_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN18_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN18_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN18_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN18_INT_TYPE_MSB WLAN_GPIO_PIN18_INT_TYPE_MSB -#define GPIO_PIN18_INT_TYPE_LSB WLAN_GPIO_PIN18_INT_TYPE_LSB -#define GPIO_PIN18_INT_TYPE_MASK WLAN_GPIO_PIN18_INT_TYPE_MASK -#define GPIO_PIN18_INT_TYPE_GET(x) WLAN_GPIO_PIN18_INT_TYPE_GET(x) -#define GPIO_PIN18_INT_TYPE_SET(x) WLAN_GPIO_PIN18_INT_TYPE_SET(x) -#define GPIO_PIN18_PAD_PULL_MSB WLAN_GPIO_PIN18_PAD_PULL_MSB -#define GPIO_PIN18_PAD_PULL_LSB WLAN_GPIO_PIN18_PAD_PULL_LSB -#define GPIO_PIN18_PAD_PULL_MASK WLAN_GPIO_PIN18_PAD_PULL_MASK -#define GPIO_PIN18_PAD_PULL_GET(x) WLAN_GPIO_PIN18_PAD_PULL_GET(x) -#define GPIO_PIN18_PAD_PULL_SET(x) WLAN_GPIO_PIN18_PAD_PULL_SET(x) -#define GPIO_PIN18_PAD_STRENGTH_MSB WLAN_GPIO_PIN18_PAD_STRENGTH_MSB -#define GPIO_PIN18_PAD_STRENGTH_LSB WLAN_GPIO_PIN18_PAD_STRENGTH_LSB -#define GPIO_PIN18_PAD_STRENGTH_MASK WLAN_GPIO_PIN18_PAD_STRENGTH_MASK -#define GPIO_PIN18_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN18_PAD_STRENGTH_GET(x) -#define GPIO_PIN18_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN18_PAD_STRENGTH_SET(x) -#define GPIO_PIN18_PAD_DRIVER_MSB WLAN_GPIO_PIN18_PAD_DRIVER_MSB -#define GPIO_PIN18_PAD_DRIVER_LSB WLAN_GPIO_PIN18_PAD_DRIVER_LSB -#define GPIO_PIN18_PAD_DRIVER_MASK WLAN_GPIO_PIN18_PAD_DRIVER_MASK -#define GPIO_PIN18_PAD_DRIVER_GET(x) WLAN_GPIO_PIN18_PAD_DRIVER_GET(x) -#define GPIO_PIN18_PAD_DRIVER_SET(x) WLAN_GPIO_PIN18_PAD_DRIVER_SET(x) -#define GPIO_PIN18_SOURCE_MSB WLAN_GPIO_PIN18_SOURCE_MSB -#define GPIO_PIN18_SOURCE_LSB WLAN_GPIO_PIN18_SOURCE_LSB -#define GPIO_PIN18_SOURCE_MASK WLAN_GPIO_PIN18_SOURCE_MASK -#define GPIO_PIN18_SOURCE_GET(x) WLAN_GPIO_PIN18_SOURCE_GET(x) -#define GPIO_PIN18_SOURCE_SET(x) WLAN_GPIO_PIN18_SOURCE_SET(x) -#define GPIO_PIN19_ADDRESS WLAN_GPIO_PIN19_ADDRESS -#define GPIO_PIN19_OFFSET WLAN_GPIO_PIN19_OFFSET -#define GPIO_PIN19_CONFIG_MSB WLAN_GPIO_PIN19_CONFIG_MSB -#define GPIO_PIN19_CONFIG_LSB WLAN_GPIO_PIN19_CONFIG_LSB -#define GPIO_PIN19_CONFIG_MASK WLAN_GPIO_PIN19_CONFIG_MASK -#define GPIO_PIN19_CONFIG_GET(x) WLAN_GPIO_PIN19_CONFIG_GET(x) -#define GPIO_PIN19_CONFIG_SET(x) WLAN_GPIO_PIN19_CONFIG_SET(x) -#define GPIO_PIN19_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN19_WAKEUP_ENABLE_MSB -#define GPIO_PIN19_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN19_WAKEUP_ENABLE_LSB -#define GPIO_PIN19_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN19_WAKEUP_ENABLE_MASK -#define GPIO_PIN19_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN19_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN19_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN19_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN19_INT_TYPE_MSB WLAN_GPIO_PIN19_INT_TYPE_MSB -#define GPIO_PIN19_INT_TYPE_LSB WLAN_GPIO_PIN19_INT_TYPE_LSB -#define GPIO_PIN19_INT_TYPE_MASK WLAN_GPIO_PIN19_INT_TYPE_MASK -#define GPIO_PIN19_INT_TYPE_GET(x) WLAN_GPIO_PIN19_INT_TYPE_GET(x) -#define GPIO_PIN19_INT_TYPE_SET(x) WLAN_GPIO_PIN19_INT_TYPE_SET(x) -#define GPIO_PIN19_PAD_PULL_MSB WLAN_GPIO_PIN19_PAD_PULL_MSB -#define GPIO_PIN19_PAD_PULL_LSB WLAN_GPIO_PIN19_PAD_PULL_LSB -#define GPIO_PIN19_PAD_PULL_MASK WLAN_GPIO_PIN19_PAD_PULL_MASK -#define GPIO_PIN19_PAD_PULL_GET(x) WLAN_GPIO_PIN19_PAD_PULL_GET(x) -#define GPIO_PIN19_PAD_PULL_SET(x) WLAN_GPIO_PIN19_PAD_PULL_SET(x) -#define GPIO_PIN19_PAD_STRENGTH_MSB WLAN_GPIO_PIN19_PAD_STRENGTH_MSB -#define GPIO_PIN19_PAD_STRENGTH_LSB WLAN_GPIO_PIN19_PAD_STRENGTH_LSB -#define GPIO_PIN19_PAD_STRENGTH_MASK WLAN_GPIO_PIN19_PAD_STRENGTH_MASK -#define GPIO_PIN19_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN19_PAD_STRENGTH_GET(x) -#define GPIO_PIN19_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN19_PAD_STRENGTH_SET(x) -#define GPIO_PIN19_PAD_DRIVER_MSB WLAN_GPIO_PIN19_PAD_DRIVER_MSB -#define GPIO_PIN19_PAD_DRIVER_LSB WLAN_GPIO_PIN19_PAD_DRIVER_LSB -#define GPIO_PIN19_PAD_DRIVER_MASK WLAN_GPIO_PIN19_PAD_DRIVER_MASK -#define GPIO_PIN19_PAD_DRIVER_GET(x) WLAN_GPIO_PIN19_PAD_DRIVER_GET(x) -#define GPIO_PIN19_PAD_DRIVER_SET(x) WLAN_GPIO_PIN19_PAD_DRIVER_SET(x) -#define GPIO_PIN19_SOURCE_MSB WLAN_GPIO_PIN19_SOURCE_MSB -#define GPIO_PIN19_SOURCE_LSB WLAN_GPIO_PIN19_SOURCE_LSB -#define GPIO_PIN19_SOURCE_MASK WLAN_GPIO_PIN19_SOURCE_MASK -#define GPIO_PIN19_SOURCE_GET(x) WLAN_GPIO_PIN19_SOURCE_GET(x) -#define GPIO_PIN19_SOURCE_SET(x) WLAN_GPIO_PIN19_SOURCE_SET(x) -#define GPIO_PIN20_ADDRESS WLAN_GPIO_PIN20_ADDRESS -#define GPIO_PIN20_OFFSET WLAN_GPIO_PIN20_OFFSET -#define GPIO_PIN20_CONFIG_MSB WLAN_GPIO_PIN20_CONFIG_MSB -#define GPIO_PIN20_CONFIG_LSB WLAN_GPIO_PIN20_CONFIG_LSB -#define GPIO_PIN20_CONFIG_MASK WLAN_GPIO_PIN20_CONFIG_MASK -#define GPIO_PIN20_CONFIG_GET(x) WLAN_GPIO_PIN20_CONFIG_GET(x) -#define GPIO_PIN20_CONFIG_SET(x) WLAN_GPIO_PIN20_CONFIG_SET(x) -#define GPIO_PIN20_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN20_WAKEUP_ENABLE_MSB -#define GPIO_PIN20_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN20_WAKEUP_ENABLE_LSB -#define GPIO_PIN20_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN20_WAKEUP_ENABLE_MASK -#define GPIO_PIN20_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN20_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN20_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN20_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN20_INT_TYPE_MSB WLAN_GPIO_PIN20_INT_TYPE_MSB -#define GPIO_PIN20_INT_TYPE_LSB WLAN_GPIO_PIN20_INT_TYPE_LSB -#define GPIO_PIN20_INT_TYPE_MASK WLAN_GPIO_PIN20_INT_TYPE_MASK -#define GPIO_PIN20_INT_TYPE_GET(x) WLAN_GPIO_PIN20_INT_TYPE_GET(x) -#define GPIO_PIN20_INT_TYPE_SET(x) WLAN_GPIO_PIN20_INT_TYPE_SET(x) -#define GPIO_PIN20_PAD_PULL_MSB WLAN_GPIO_PIN20_PAD_PULL_MSB -#define GPIO_PIN20_PAD_PULL_LSB WLAN_GPIO_PIN20_PAD_PULL_LSB -#define GPIO_PIN20_PAD_PULL_MASK WLAN_GPIO_PIN20_PAD_PULL_MASK -#define GPIO_PIN20_PAD_PULL_GET(x) WLAN_GPIO_PIN20_PAD_PULL_GET(x) -#define GPIO_PIN20_PAD_PULL_SET(x) WLAN_GPIO_PIN20_PAD_PULL_SET(x) -#define GPIO_PIN20_PAD_STRENGTH_MSB WLAN_GPIO_PIN20_PAD_STRENGTH_MSB -#define GPIO_PIN20_PAD_STRENGTH_LSB WLAN_GPIO_PIN20_PAD_STRENGTH_LSB -#define GPIO_PIN20_PAD_STRENGTH_MASK WLAN_GPIO_PIN20_PAD_STRENGTH_MASK -#define GPIO_PIN20_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN20_PAD_STRENGTH_GET(x) -#define GPIO_PIN20_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN20_PAD_STRENGTH_SET(x) -#define GPIO_PIN20_PAD_DRIVER_MSB WLAN_GPIO_PIN20_PAD_DRIVER_MSB -#define GPIO_PIN20_PAD_DRIVER_LSB WLAN_GPIO_PIN20_PAD_DRIVER_LSB -#define GPIO_PIN20_PAD_DRIVER_MASK WLAN_GPIO_PIN20_PAD_DRIVER_MASK -#define GPIO_PIN20_PAD_DRIVER_GET(x) WLAN_GPIO_PIN20_PAD_DRIVER_GET(x) -#define GPIO_PIN20_PAD_DRIVER_SET(x) WLAN_GPIO_PIN20_PAD_DRIVER_SET(x) -#define GPIO_PIN20_SOURCE_MSB WLAN_GPIO_PIN20_SOURCE_MSB -#define GPIO_PIN20_SOURCE_LSB WLAN_GPIO_PIN20_SOURCE_LSB -#define GPIO_PIN20_SOURCE_MASK WLAN_GPIO_PIN20_SOURCE_MASK -#define GPIO_PIN20_SOURCE_GET(x) WLAN_GPIO_PIN20_SOURCE_GET(x) -#define GPIO_PIN20_SOURCE_SET(x) WLAN_GPIO_PIN20_SOURCE_SET(x) -#define GPIO_PIN21_ADDRESS WLAN_GPIO_PIN21_ADDRESS -#define GPIO_PIN21_OFFSET WLAN_GPIO_PIN21_OFFSET -#define GPIO_PIN21_CONFIG_MSB WLAN_GPIO_PIN21_CONFIG_MSB -#define GPIO_PIN21_CONFIG_LSB WLAN_GPIO_PIN21_CONFIG_LSB -#define GPIO_PIN21_CONFIG_MASK WLAN_GPIO_PIN21_CONFIG_MASK -#define GPIO_PIN21_CONFIG_GET(x) WLAN_GPIO_PIN21_CONFIG_GET(x) -#define GPIO_PIN21_CONFIG_SET(x) WLAN_GPIO_PIN21_CONFIG_SET(x) -#define GPIO_PIN21_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN21_WAKEUP_ENABLE_MSB -#define GPIO_PIN21_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN21_WAKEUP_ENABLE_LSB -#define GPIO_PIN21_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN21_WAKEUP_ENABLE_MASK -#define GPIO_PIN21_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN21_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN21_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN21_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN21_INT_TYPE_MSB WLAN_GPIO_PIN21_INT_TYPE_MSB -#define GPIO_PIN21_INT_TYPE_LSB WLAN_GPIO_PIN21_INT_TYPE_LSB -#define GPIO_PIN21_INT_TYPE_MASK WLAN_GPIO_PIN21_INT_TYPE_MASK -#define GPIO_PIN21_INT_TYPE_GET(x) WLAN_GPIO_PIN21_INT_TYPE_GET(x) -#define GPIO_PIN21_INT_TYPE_SET(x) WLAN_GPIO_PIN21_INT_TYPE_SET(x) -#define GPIO_PIN21_PAD_PULL_MSB WLAN_GPIO_PIN21_PAD_PULL_MSB -#define GPIO_PIN21_PAD_PULL_LSB WLAN_GPIO_PIN21_PAD_PULL_LSB -#define GPIO_PIN21_PAD_PULL_MASK WLAN_GPIO_PIN21_PAD_PULL_MASK -#define GPIO_PIN21_PAD_PULL_GET(x) WLAN_GPIO_PIN21_PAD_PULL_GET(x) -#define GPIO_PIN21_PAD_PULL_SET(x) WLAN_GPIO_PIN21_PAD_PULL_SET(x) -#define GPIO_PIN21_PAD_STRENGTH_MSB WLAN_GPIO_PIN21_PAD_STRENGTH_MSB -#define GPIO_PIN21_PAD_STRENGTH_LSB WLAN_GPIO_PIN21_PAD_STRENGTH_LSB -#define GPIO_PIN21_PAD_STRENGTH_MASK WLAN_GPIO_PIN21_PAD_STRENGTH_MASK -#define GPIO_PIN21_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN21_PAD_STRENGTH_GET(x) -#define GPIO_PIN21_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN21_PAD_STRENGTH_SET(x) -#define GPIO_PIN21_PAD_DRIVER_MSB WLAN_GPIO_PIN21_PAD_DRIVER_MSB -#define GPIO_PIN21_PAD_DRIVER_LSB WLAN_GPIO_PIN21_PAD_DRIVER_LSB -#define GPIO_PIN21_PAD_DRIVER_MASK WLAN_GPIO_PIN21_PAD_DRIVER_MASK -#define GPIO_PIN21_PAD_DRIVER_GET(x) WLAN_GPIO_PIN21_PAD_DRIVER_GET(x) -#define GPIO_PIN21_PAD_DRIVER_SET(x) WLAN_GPIO_PIN21_PAD_DRIVER_SET(x) -#define GPIO_PIN21_SOURCE_MSB WLAN_GPIO_PIN21_SOURCE_MSB -#define GPIO_PIN21_SOURCE_LSB WLAN_GPIO_PIN21_SOURCE_LSB -#define GPIO_PIN21_SOURCE_MASK WLAN_GPIO_PIN21_SOURCE_MASK -#define GPIO_PIN21_SOURCE_GET(x) WLAN_GPIO_PIN21_SOURCE_GET(x) -#define GPIO_PIN21_SOURCE_SET(x) WLAN_GPIO_PIN21_SOURCE_SET(x) -#define GPIO_PIN22_ADDRESS WLAN_GPIO_PIN22_ADDRESS -#define GPIO_PIN22_OFFSET WLAN_GPIO_PIN22_OFFSET -#define GPIO_PIN22_CONFIG_MSB WLAN_GPIO_PIN22_CONFIG_MSB -#define GPIO_PIN22_CONFIG_LSB WLAN_GPIO_PIN22_CONFIG_LSB -#define GPIO_PIN22_CONFIG_MASK WLAN_GPIO_PIN22_CONFIG_MASK -#define GPIO_PIN22_CONFIG_GET(x) WLAN_GPIO_PIN22_CONFIG_GET(x) -#define GPIO_PIN22_CONFIG_SET(x) WLAN_GPIO_PIN22_CONFIG_SET(x) -#define GPIO_PIN22_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN22_WAKEUP_ENABLE_MSB -#define GPIO_PIN22_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN22_WAKEUP_ENABLE_LSB -#define GPIO_PIN22_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN22_WAKEUP_ENABLE_MASK -#define GPIO_PIN22_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN22_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN22_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN22_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN22_INT_TYPE_MSB WLAN_GPIO_PIN22_INT_TYPE_MSB -#define GPIO_PIN22_INT_TYPE_LSB WLAN_GPIO_PIN22_INT_TYPE_LSB -#define GPIO_PIN22_INT_TYPE_MASK WLAN_GPIO_PIN22_INT_TYPE_MASK -#define GPIO_PIN22_INT_TYPE_GET(x) WLAN_GPIO_PIN22_INT_TYPE_GET(x) -#define GPIO_PIN22_INT_TYPE_SET(x) WLAN_GPIO_PIN22_INT_TYPE_SET(x) -#define GPIO_PIN22_PAD_PULL_MSB WLAN_GPIO_PIN22_PAD_PULL_MSB -#define GPIO_PIN22_PAD_PULL_LSB WLAN_GPIO_PIN22_PAD_PULL_LSB -#define GPIO_PIN22_PAD_PULL_MASK WLAN_GPIO_PIN22_PAD_PULL_MASK -#define GPIO_PIN22_PAD_PULL_GET(x) WLAN_GPIO_PIN22_PAD_PULL_GET(x) -#define GPIO_PIN22_PAD_PULL_SET(x) WLAN_GPIO_PIN22_PAD_PULL_SET(x) -#define GPIO_PIN22_PAD_STRENGTH_MSB WLAN_GPIO_PIN22_PAD_STRENGTH_MSB -#define GPIO_PIN22_PAD_STRENGTH_LSB WLAN_GPIO_PIN22_PAD_STRENGTH_LSB -#define GPIO_PIN22_PAD_STRENGTH_MASK WLAN_GPIO_PIN22_PAD_STRENGTH_MASK -#define GPIO_PIN22_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN22_PAD_STRENGTH_GET(x) -#define GPIO_PIN22_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN22_PAD_STRENGTH_SET(x) -#define GPIO_PIN22_PAD_DRIVER_MSB WLAN_GPIO_PIN22_PAD_DRIVER_MSB -#define GPIO_PIN22_PAD_DRIVER_LSB WLAN_GPIO_PIN22_PAD_DRIVER_LSB -#define GPIO_PIN22_PAD_DRIVER_MASK WLAN_GPIO_PIN22_PAD_DRIVER_MASK -#define GPIO_PIN22_PAD_DRIVER_GET(x) WLAN_GPIO_PIN22_PAD_DRIVER_GET(x) -#define GPIO_PIN22_PAD_DRIVER_SET(x) WLAN_GPIO_PIN22_PAD_DRIVER_SET(x) -#define GPIO_PIN22_SOURCE_MSB WLAN_GPIO_PIN22_SOURCE_MSB -#define GPIO_PIN22_SOURCE_LSB WLAN_GPIO_PIN22_SOURCE_LSB -#define GPIO_PIN22_SOURCE_MASK WLAN_GPIO_PIN22_SOURCE_MASK -#define GPIO_PIN22_SOURCE_GET(x) WLAN_GPIO_PIN22_SOURCE_GET(x) -#define GPIO_PIN22_SOURCE_SET(x) WLAN_GPIO_PIN22_SOURCE_SET(x) -#define GPIO_PIN23_ADDRESS WLAN_GPIO_PIN23_ADDRESS -#define GPIO_PIN23_OFFSET WLAN_GPIO_PIN23_OFFSET -#define GPIO_PIN23_CONFIG_MSB WLAN_GPIO_PIN23_CONFIG_MSB -#define GPIO_PIN23_CONFIG_LSB WLAN_GPIO_PIN23_CONFIG_LSB -#define GPIO_PIN23_CONFIG_MASK WLAN_GPIO_PIN23_CONFIG_MASK -#define GPIO_PIN23_CONFIG_GET(x) WLAN_GPIO_PIN23_CONFIG_GET(x) -#define GPIO_PIN23_CONFIG_SET(x) WLAN_GPIO_PIN23_CONFIG_SET(x) -#define GPIO_PIN23_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN23_WAKEUP_ENABLE_MSB -#define GPIO_PIN23_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN23_WAKEUP_ENABLE_LSB -#define GPIO_PIN23_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN23_WAKEUP_ENABLE_MASK -#define GPIO_PIN23_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN23_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN23_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN23_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN23_INT_TYPE_MSB WLAN_GPIO_PIN23_INT_TYPE_MSB -#define GPIO_PIN23_INT_TYPE_LSB WLAN_GPIO_PIN23_INT_TYPE_LSB -#define GPIO_PIN23_INT_TYPE_MASK WLAN_GPIO_PIN23_INT_TYPE_MASK -#define GPIO_PIN23_INT_TYPE_GET(x) WLAN_GPIO_PIN23_INT_TYPE_GET(x) -#define GPIO_PIN23_INT_TYPE_SET(x) WLAN_GPIO_PIN23_INT_TYPE_SET(x) -#define GPIO_PIN23_PAD_PULL_MSB WLAN_GPIO_PIN23_PAD_PULL_MSB -#define GPIO_PIN23_PAD_PULL_LSB WLAN_GPIO_PIN23_PAD_PULL_LSB -#define GPIO_PIN23_PAD_PULL_MASK WLAN_GPIO_PIN23_PAD_PULL_MASK -#define GPIO_PIN23_PAD_PULL_GET(x) WLAN_GPIO_PIN23_PAD_PULL_GET(x) -#define GPIO_PIN23_PAD_PULL_SET(x) WLAN_GPIO_PIN23_PAD_PULL_SET(x) -#define GPIO_PIN23_PAD_STRENGTH_MSB WLAN_GPIO_PIN23_PAD_STRENGTH_MSB -#define GPIO_PIN23_PAD_STRENGTH_LSB WLAN_GPIO_PIN23_PAD_STRENGTH_LSB -#define GPIO_PIN23_PAD_STRENGTH_MASK WLAN_GPIO_PIN23_PAD_STRENGTH_MASK -#define GPIO_PIN23_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN23_PAD_STRENGTH_GET(x) -#define GPIO_PIN23_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN23_PAD_STRENGTH_SET(x) -#define GPIO_PIN23_PAD_DRIVER_MSB WLAN_GPIO_PIN23_PAD_DRIVER_MSB -#define GPIO_PIN23_PAD_DRIVER_LSB WLAN_GPIO_PIN23_PAD_DRIVER_LSB -#define GPIO_PIN23_PAD_DRIVER_MASK WLAN_GPIO_PIN23_PAD_DRIVER_MASK -#define GPIO_PIN23_PAD_DRIVER_GET(x) WLAN_GPIO_PIN23_PAD_DRIVER_GET(x) -#define GPIO_PIN23_PAD_DRIVER_SET(x) WLAN_GPIO_PIN23_PAD_DRIVER_SET(x) -#define GPIO_PIN23_SOURCE_MSB WLAN_GPIO_PIN23_SOURCE_MSB -#define GPIO_PIN23_SOURCE_LSB WLAN_GPIO_PIN23_SOURCE_LSB -#define GPIO_PIN23_SOURCE_MASK WLAN_GPIO_PIN23_SOURCE_MASK -#define GPIO_PIN23_SOURCE_GET(x) WLAN_GPIO_PIN23_SOURCE_GET(x) -#define GPIO_PIN23_SOURCE_SET(x) WLAN_GPIO_PIN23_SOURCE_SET(x) -#define GPIO_PIN24_ADDRESS WLAN_GPIO_PIN24_ADDRESS -#define GPIO_PIN24_OFFSET WLAN_GPIO_PIN24_OFFSET -#define GPIO_PIN24_CONFIG_MSB WLAN_GPIO_PIN24_CONFIG_MSB -#define GPIO_PIN24_CONFIG_LSB WLAN_GPIO_PIN24_CONFIG_LSB -#define GPIO_PIN24_CONFIG_MASK WLAN_GPIO_PIN24_CONFIG_MASK -#define GPIO_PIN24_CONFIG_GET(x) WLAN_GPIO_PIN24_CONFIG_GET(x) -#define GPIO_PIN24_CONFIG_SET(x) WLAN_GPIO_PIN24_CONFIG_SET(x) -#define GPIO_PIN24_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN24_WAKEUP_ENABLE_MSB -#define GPIO_PIN24_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN24_WAKEUP_ENABLE_LSB -#define GPIO_PIN24_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN24_WAKEUP_ENABLE_MASK -#define GPIO_PIN24_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN24_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN24_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN24_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN24_INT_TYPE_MSB WLAN_GPIO_PIN24_INT_TYPE_MSB -#define GPIO_PIN24_INT_TYPE_LSB WLAN_GPIO_PIN24_INT_TYPE_LSB -#define GPIO_PIN24_INT_TYPE_MASK WLAN_GPIO_PIN24_INT_TYPE_MASK -#define GPIO_PIN24_INT_TYPE_GET(x) WLAN_GPIO_PIN24_INT_TYPE_GET(x) -#define GPIO_PIN24_INT_TYPE_SET(x) WLAN_GPIO_PIN24_INT_TYPE_SET(x) -#define GPIO_PIN24_PAD_PULL_MSB WLAN_GPIO_PIN24_PAD_PULL_MSB -#define GPIO_PIN24_PAD_PULL_LSB WLAN_GPIO_PIN24_PAD_PULL_LSB -#define GPIO_PIN24_PAD_PULL_MASK WLAN_GPIO_PIN24_PAD_PULL_MASK -#define GPIO_PIN24_PAD_PULL_GET(x) WLAN_GPIO_PIN24_PAD_PULL_GET(x) -#define GPIO_PIN24_PAD_PULL_SET(x) WLAN_GPIO_PIN24_PAD_PULL_SET(x) -#define GPIO_PIN24_PAD_STRENGTH_MSB WLAN_GPIO_PIN24_PAD_STRENGTH_MSB -#define GPIO_PIN24_PAD_STRENGTH_LSB WLAN_GPIO_PIN24_PAD_STRENGTH_LSB -#define GPIO_PIN24_PAD_STRENGTH_MASK WLAN_GPIO_PIN24_PAD_STRENGTH_MASK -#define GPIO_PIN24_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN24_PAD_STRENGTH_GET(x) -#define GPIO_PIN24_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN24_PAD_STRENGTH_SET(x) -#define GPIO_PIN24_PAD_DRIVER_MSB WLAN_GPIO_PIN24_PAD_DRIVER_MSB -#define GPIO_PIN24_PAD_DRIVER_LSB WLAN_GPIO_PIN24_PAD_DRIVER_LSB -#define GPIO_PIN24_PAD_DRIVER_MASK WLAN_GPIO_PIN24_PAD_DRIVER_MASK -#define GPIO_PIN24_PAD_DRIVER_GET(x) WLAN_GPIO_PIN24_PAD_DRIVER_GET(x) -#define GPIO_PIN24_PAD_DRIVER_SET(x) WLAN_GPIO_PIN24_PAD_DRIVER_SET(x) -#define GPIO_PIN24_SOURCE_MSB WLAN_GPIO_PIN24_SOURCE_MSB -#define GPIO_PIN24_SOURCE_LSB WLAN_GPIO_PIN24_SOURCE_LSB -#define GPIO_PIN24_SOURCE_MASK WLAN_GPIO_PIN24_SOURCE_MASK -#define GPIO_PIN24_SOURCE_GET(x) WLAN_GPIO_PIN24_SOURCE_GET(x) -#define GPIO_PIN24_SOURCE_SET(x) WLAN_GPIO_PIN24_SOURCE_SET(x) -#define GPIO_PIN25_ADDRESS WLAN_GPIO_PIN25_ADDRESS -#define GPIO_PIN25_OFFSET WLAN_GPIO_PIN25_OFFSET -#define GPIO_PIN25_CONFIG_MSB WLAN_GPIO_PIN25_CONFIG_MSB -#define GPIO_PIN25_CONFIG_LSB WLAN_GPIO_PIN25_CONFIG_LSB -#define GPIO_PIN25_CONFIG_MASK WLAN_GPIO_PIN25_CONFIG_MASK -#define GPIO_PIN25_CONFIG_GET(x) WLAN_GPIO_PIN25_CONFIG_GET(x) -#define GPIO_PIN25_CONFIG_SET(x) WLAN_GPIO_PIN25_CONFIG_SET(x) -#define GPIO_PIN25_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN25_WAKEUP_ENABLE_MSB -#define GPIO_PIN25_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN25_WAKEUP_ENABLE_LSB -#define GPIO_PIN25_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN25_WAKEUP_ENABLE_MASK -#define GPIO_PIN25_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN25_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN25_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN25_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN25_INT_TYPE_MSB WLAN_GPIO_PIN25_INT_TYPE_MSB -#define GPIO_PIN25_INT_TYPE_LSB WLAN_GPIO_PIN25_INT_TYPE_LSB -#define GPIO_PIN25_INT_TYPE_MASK WLAN_GPIO_PIN25_INT_TYPE_MASK -#define GPIO_PIN25_INT_TYPE_GET(x) WLAN_GPIO_PIN25_INT_TYPE_GET(x) -#define GPIO_PIN25_INT_TYPE_SET(x) WLAN_GPIO_PIN25_INT_TYPE_SET(x) -#define GPIO_PIN25_PAD_PULL_MSB WLAN_GPIO_PIN25_PAD_PULL_MSB -#define GPIO_PIN25_PAD_PULL_LSB WLAN_GPIO_PIN25_PAD_PULL_LSB -#define GPIO_PIN25_PAD_PULL_MASK WLAN_GPIO_PIN25_PAD_PULL_MASK -#define GPIO_PIN25_PAD_PULL_GET(x) WLAN_GPIO_PIN25_PAD_PULL_GET(x) -#define GPIO_PIN25_PAD_PULL_SET(x) WLAN_GPIO_PIN25_PAD_PULL_SET(x) -#define GPIO_PIN25_PAD_STRENGTH_MSB WLAN_GPIO_PIN25_PAD_STRENGTH_MSB -#define GPIO_PIN25_PAD_STRENGTH_LSB WLAN_GPIO_PIN25_PAD_STRENGTH_LSB -#define GPIO_PIN25_PAD_STRENGTH_MASK WLAN_GPIO_PIN25_PAD_STRENGTH_MASK -#define GPIO_PIN25_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN25_PAD_STRENGTH_GET(x) -#define GPIO_PIN25_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN25_PAD_STRENGTH_SET(x) -#define GPIO_PIN25_PAD_DRIVER_MSB WLAN_GPIO_PIN25_PAD_DRIVER_MSB -#define GPIO_PIN25_PAD_DRIVER_LSB WLAN_GPIO_PIN25_PAD_DRIVER_LSB -#define GPIO_PIN25_PAD_DRIVER_MASK WLAN_GPIO_PIN25_PAD_DRIVER_MASK -#define GPIO_PIN25_PAD_DRIVER_GET(x) WLAN_GPIO_PIN25_PAD_DRIVER_GET(x) -#define GPIO_PIN25_PAD_DRIVER_SET(x) WLAN_GPIO_PIN25_PAD_DRIVER_SET(x) -#define GPIO_PIN25_SOURCE_MSB WLAN_GPIO_PIN25_SOURCE_MSB -#define GPIO_PIN25_SOURCE_LSB WLAN_GPIO_PIN25_SOURCE_LSB -#define GPIO_PIN25_SOURCE_MASK WLAN_GPIO_PIN25_SOURCE_MASK -#define GPIO_PIN25_SOURCE_GET(x) WLAN_GPIO_PIN25_SOURCE_GET(x) -#define GPIO_PIN25_SOURCE_SET(x) WLAN_GPIO_PIN25_SOURCE_SET(x) -#define GPIO_PIN26_ADDRESS WLAN_GPIO_PIN26_ADDRESS -#define GPIO_PIN26_OFFSET WLAN_GPIO_PIN26_OFFSET -#define GPIO_PIN26_CONFIG_MSB WLAN_GPIO_PIN26_CONFIG_MSB -#define GPIO_PIN26_CONFIG_LSB WLAN_GPIO_PIN26_CONFIG_LSB -#define GPIO_PIN26_CONFIG_MASK WLAN_GPIO_PIN26_CONFIG_MASK -#define GPIO_PIN26_CONFIG_GET(x) WLAN_GPIO_PIN26_CONFIG_GET(x) -#define GPIO_PIN26_CONFIG_SET(x) WLAN_GPIO_PIN26_CONFIG_SET(x) -#define GPIO_PIN26_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN26_WAKEUP_ENABLE_MSB -#define GPIO_PIN26_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN26_WAKEUP_ENABLE_LSB -#define GPIO_PIN26_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN26_WAKEUP_ENABLE_MASK -#define GPIO_PIN26_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN26_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN26_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN26_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN26_INT_TYPE_MSB WLAN_GPIO_PIN26_INT_TYPE_MSB -#define GPIO_PIN26_INT_TYPE_LSB WLAN_GPIO_PIN26_INT_TYPE_LSB -#define GPIO_PIN26_INT_TYPE_MASK WLAN_GPIO_PIN26_INT_TYPE_MASK -#define GPIO_PIN26_INT_TYPE_GET(x) WLAN_GPIO_PIN26_INT_TYPE_GET(x) -#define GPIO_PIN26_INT_TYPE_SET(x) WLAN_GPIO_PIN26_INT_TYPE_SET(x) -#define GPIO_PIN26_PAD_PULL_MSB WLAN_GPIO_PIN26_PAD_PULL_MSB -#define GPIO_PIN26_PAD_PULL_LSB WLAN_GPIO_PIN26_PAD_PULL_LSB -#define GPIO_PIN26_PAD_PULL_MASK WLAN_GPIO_PIN26_PAD_PULL_MASK -#define GPIO_PIN26_PAD_PULL_GET(x) WLAN_GPIO_PIN26_PAD_PULL_GET(x) -#define GPIO_PIN26_PAD_PULL_SET(x) WLAN_GPIO_PIN26_PAD_PULL_SET(x) -#define GPIO_PIN26_PAD_STRENGTH_MSB WLAN_GPIO_PIN26_PAD_STRENGTH_MSB -#define GPIO_PIN26_PAD_STRENGTH_LSB WLAN_GPIO_PIN26_PAD_STRENGTH_LSB -#define GPIO_PIN26_PAD_STRENGTH_MASK WLAN_GPIO_PIN26_PAD_STRENGTH_MASK -#define GPIO_PIN26_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN26_PAD_STRENGTH_GET(x) -#define GPIO_PIN26_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN26_PAD_STRENGTH_SET(x) -#define GPIO_PIN26_PAD_DRIVER_MSB WLAN_GPIO_PIN26_PAD_DRIVER_MSB -#define GPIO_PIN26_PAD_DRIVER_LSB WLAN_GPIO_PIN26_PAD_DRIVER_LSB -#define GPIO_PIN26_PAD_DRIVER_MASK WLAN_GPIO_PIN26_PAD_DRIVER_MASK -#define GPIO_PIN26_PAD_DRIVER_GET(x) WLAN_GPIO_PIN26_PAD_DRIVER_GET(x) -#define GPIO_PIN26_PAD_DRIVER_SET(x) WLAN_GPIO_PIN26_PAD_DRIVER_SET(x) -#define GPIO_PIN26_SOURCE_MSB WLAN_GPIO_PIN26_SOURCE_MSB -#define GPIO_PIN26_SOURCE_LSB WLAN_GPIO_PIN26_SOURCE_LSB -#define GPIO_PIN26_SOURCE_MASK WLAN_GPIO_PIN26_SOURCE_MASK -#define GPIO_PIN26_SOURCE_GET(x) WLAN_GPIO_PIN26_SOURCE_GET(x) -#define GPIO_PIN26_SOURCE_SET(x) WLAN_GPIO_PIN26_SOURCE_SET(x) -#define GPIO_PIN27_ADDRESS WLAN_GPIO_PIN27_ADDRESS -#define GPIO_PIN27_OFFSET WLAN_GPIO_PIN27_OFFSET -#define GPIO_PIN27_CONFIG_MSB WLAN_GPIO_PIN27_CONFIG_MSB -#define GPIO_PIN27_CONFIG_LSB WLAN_GPIO_PIN27_CONFIG_LSB -#define GPIO_PIN27_CONFIG_MASK WLAN_GPIO_PIN27_CONFIG_MASK -#define GPIO_PIN27_CONFIG_GET(x) WLAN_GPIO_PIN27_CONFIG_GET(x) -#define GPIO_PIN27_CONFIG_SET(x) WLAN_GPIO_PIN27_CONFIG_SET(x) -#define GPIO_PIN27_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN27_WAKEUP_ENABLE_MSB -#define GPIO_PIN27_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN27_WAKEUP_ENABLE_LSB -#define GPIO_PIN27_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN27_WAKEUP_ENABLE_MASK -#define GPIO_PIN27_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN27_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN27_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN27_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN27_INT_TYPE_MSB WLAN_GPIO_PIN27_INT_TYPE_MSB -#define GPIO_PIN27_INT_TYPE_LSB WLAN_GPIO_PIN27_INT_TYPE_LSB -#define GPIO_PIN27_INT_TYPE_MASK WLAN_GPIO_PIN27_INT_TYPE_MASK -#define GPIO_PIN27_INT_TYPE_GET(x) WLAN_GPIO_PIN27_INT_TYPE_GET(x) -#define GPIO_PIN27_INT_TYPE_SET(x) WLAN_GPIO_PIN27_INT_TYPE_SET(x) -#define GPIO_PIN27_PAD_PULL_MSB WLAN_GPIO_PIN27_PAD_PULL_MSB -#define GPIO_PIN27_PAD_PULL_LSB WLAN_GPIO_PIN27_PAD_PULL_LSB -#define GPIO_PIN27_PAD_PULL_MASK WLAN_GPIO_PIN27_PAD_PULL_MASK -#define GPIO_PIN27_PAD_PULL_GET(x) WLAN_GPIO_PIN27_PAD_PULL_GET(x) -#define GPIO_PIN27_PAD_PULL_SET(x) WLAN_GPIO_PIN27_PAD_PULL_SET(x) -#define GPIO_PIN27_PAD_STRENGTH_MSB WLAN_GPIO_PIN27_PAD_STRENGTH_MSB -#define GPIO_PIN27_PAD_STRENGTH_LSB WLAN_GPIO_PIN27_PAD_STRENGTH_LSB -#define GPIO_PIN27_PAD_STRENGTH_MASK WLAN_GPIO_PIN27_PAD_STRENGTH_MASK -#define GPIO_PIN27_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN27_PAD_STRENGTH_GET(x) -#define GPIO_PIN27_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN27_PAD_STRENGTH_SET(x) -#define GPIO_PIN27_PAD_DRIVER_MSB WLAN_GPIO_PIN27_PAD_DRIVER_MSB -#define GPIO_PIN27_PAD_DRIVER_LSB WLAN_GPIO_PIN27_PAD_DRIVER_LSB -#define GPIO_PIN27_PAD_DRIVER_MASK WLAN_GPIO_PIN27_PAD_DRIVER_MASK -#define GPIO_PIN27_PAD_DRIVER_GET(x) WLAN_GPIO_PIN27_PAD_DRIVER_GET(x) -#define GPIO_PIN27_PAD_DRIVER_SET(x) WLAN_GPIO_PIN27_PAD_DRIVER_SET(x) -#define GPIO_PIN27_SOURCE_MSB WLAN_GPIO_PIN27_SOURCE_MSB -#define GPIO_PIN27_SOURCE_LSB WLAN_GPIO_PIN27_SOURCE_LSB -#define GPIO_PIN27_SOURCE_MASK WLAN_GPIO_PIN27_SOURCE_MASK -#define GPIO_PIN27_SOURCE_GET(x) WLAN_GPIO_PIN27_SOURCE_GET(x) -#define GPIO_PIN27_SOURCE_SET(x) WLAN_GPIO_PIN27_SOURCE_SET(x) -#define GPIO_PIN28_ADDRESS WLAN_GPIO_PIN28_ADDRESS -#define GPIO_PIN28_OFFSET WLAN_GPIO_PIN28_OFFSET -#define GPIO_PIN28_CONFIG_MSB WLAN_GPIO_PIN28_CONFIG_MSB -#define GPIO_PIN28_CONFIG_LSB WLAN_GPIO_PIN28_CONFIG_LSB -#define GPIO_PIN28_CONFIG_MASK WLAN_GPIO_PIN28_CONFIG_MASK -#define GPIO_PIN28_CONFIG_GET(x) WLAN_GPIO_PIN28_CONFIG_GET(x) -#define GPIO_PIN28_CONFIG_SET(x) WLAN_GPIO_PIN28_CONFIG_SET(x) -#define GPIO_PIN28_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN28_WAKEUP_ENABLE_MSB -#define GPIO_PIN28_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN28_WAKEUP_ENABLE_LSB -#define GPIO_PIN28_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN28_WAKEUP_ENABLE_MASK -#define GPIO_PIN28_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN28_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN28_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN28_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN28_INT_TYPE_MSB WLAN_GPIO_PIN28_INT_TYPE_MSB -#define GPIO_PIN28_INT_TYPE_LSB WLAN_GPIO_PIN28_INT_TYPE_LSB -#define GPIO_PIN28_INT_TYPE_MASK WLAN_GPIO_PIN28_INT_TYPE_MASK -#define GPIO_PIN28_INT_TYPE_GET(x) WLAN_GPIO_PIN28_INT_TYPE_GET(x) -#define GPIO_PIN28_INT_TYPE_SET(x) WLAN_GPIO_PIN28_INT_TYPE_SET(x) -#define GPIO_PIN28_PAD_PULL_MSB WLAN_GPIO_PIN28_PAD_PULL_MSB -#define GPIO_PIN28_PAD_PULL_LSB WLAN_GPIO_PIN28_PAD_PULL_LSB -#define GPIO_PIN28_PAD_PULL_MASK WLAN_GPIO_PIN28_PAD_PULL_MASK -#define GPIO_PIN28_PAD_PULL_GET(x) WLAN_GPIO_PIN28_PAD_PULL_GET(x) -#define GPIO_PIN28_PAD_PULL_SET(x) WLAN_GPIO_PIN28_PAD_PULL_SET(x) -#define GPIO_PIN28_PAD_STRENGTH_MSB WLAN_GPIO_PIN28_PAD_STRENGTH_MSB -#define GPIO_PIN28_PAD_STRENGTH_LSB WLAN_GPIO_PIN28_PAD_STRENGTH_LSB -#define GPIO_PIN28_PAD_STRENGTH_MASK WLAN_GPIO_PIN28_PAD_STRENGTH_MASK -#define GPIO_PIN28_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN28_PAD_STRENGTH_GET(x) -#define GPIO_PIN28_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN28_PAD_STRENGTH_SET(x) -#define GPIO_PIN28_PAD_DRIVER_MSB WLAN_GPIO_PIN28_PAD_DRIVER_MSB -#define GPIO_PIN28_PAD_DRIVER_LSB WLAN_GPIO_PIN28_PAD_DRIVER_LSB -#define GPIO_PIN28_PAD_DRIVER_MASK WLAN_GPIO_PIN28_PAD_DRIVER_MASK -#define GPIO_PIN28_PAD_DRIVER_GET(x) WLAN_GPIO_PIN28_PAD_DRIVER_GET(x) -#define GPIO_PIN28_PAD_DRIVER_SET(x) WLAN_GPIO_PIN28_PAD_DRIVER_SET(x) -#define GPIO_PIN28_SOURCE_MSB WLAN_GPIO_PIN28_SOURCE_MSB -#define GPIO_PIN28_SOURCE_LSB WLAN_GPIO_PIN28_SOURCE_LSB -#define GPIO_PIN28_SOURCE_MASK WLAN_GPIO_PIN28_SOURCE_MASK -#define GPIO_PIN28_SOURCE_GET(x) WLAN_GPIO_PIN28_SOURCE_GET(x) -#define GPIO_PIN28_SOURCE_SET(x) WLAN_GPIO_PIN28_SOURCE_SET(x) -#define GPIO_PIN29_ADDRESS WLAN_GPIO_PIN29_ADDRESS -#define GPIO_PIN29_OFFSET WLAN_GPIO_PIN29_OFFSET -#define GPIO_PIN29_CONFIG_MSB WLAN_GPIO_PIN29_CONFIG_MSB -#define GPIO_PIN29_CONFIG_LSB WLAN_GPIO_PIN29_CONFIG_LSB -#define GPIO_PIN29_CONFIG_MASK WLAN_GPIO_PIN29_CONFIG_MASK -#define GPIO_PIN29_CONFIG_GET(x) WLAN_GPIO_PIN29_CONFIG_GET(x) -#define GPIO_PIN29_CONFIG_SET(x) WLAN_GPIO_PIN29_CONFIG_SET(x) -#define GPIO_PIN29_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN29_WAKEUP_ENABLE_MSB -#define GPIO_PIN29_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN29_WAKEUP_ENABLE_LSB -#define GPIO_PIN29_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN29_WAKEUP_ENABLE_MASK -#define GPIO_PIN29_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN29_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN29_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN29_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN29_INT_TYPE_MSB WLAN_GPIO_PIN29_INT_TYPE_MSB -#define GPIO_PIN29_INT_TYPE_LSB WLAN_GPIO_PIN29_INT_TYPE_LSB -#define GPIO_PIN29_INT_TYPE_MASK WLAN_GPIO_PIN29_INT_TYPE_MASK -#define GPIO_PIN29_INT_TYPE_GET(x) WLAN_GPIO_PIN29_INT_TYPE_GET(x) -#define GPIO_PIN29_INT_TYPE_SET(x) WLAN_GPIO_PIN29_INT_TYPE_SET(x) -#define GPIO_PIN29_PAD_PULL_MSB WLAN_GPIO_PIN29_PAD_PULL_MSB -#define GPIO_PIN29_PAD_PULL_LSB WLAN_GPIO_PIN29_PAD_PULL_LSB -#define GPIO_PIN29_PAD_PULL_MASK WLAN_GPIO_PIN29_PAD_PULL_MASK -#define GPIO_PIN29_PAD_PULL_GET(x) WLAN_GPIO_PIN29_PAD_PULL_GET(x) -#define GPIO_PIN29_PAD_PULL_SET(x) WLAN_GPIO_PIN29_PAD_PULL_SET(x) -#define GPIO_PIN29_PAD_STRENGTH_MSB WLAN_GPIO_PIN29_PAD_STRENGTH_MSB -#define GPIO_PIN29_PAD_STRENGTH_LSB WLAN_GPIO_PIN29_PAD_STRENGTH_LSB -#define GPIO_PIN29_PAD_STRENGTH_MASK WLAN_GPIO_PIN29_PAD_STRENGTH_MASK -#define GPIO_PIN29_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN29_PAD_STRENGTH_GET(x) -#define GPIO_PIN29_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN29_PAD_STRENGTH_SET(x) -#define GPIO_PIN29_PAD_DRIVER_MSB WLAN_GPIO_PIN29_PAD_DRIVER_MSB -#define GPIO_PIN29_PAD_DRIVER_LSB WLAN_GPIO_PIN29_PAD_DRIVER_LSB -#define GPIO_PIN29_PAD_DRIVER_MASK WLAN_GPIO_PIN29_PAD_DRIVER_MASK -#define GPIO_PIN29_PAD_DRIVER_GET(x) WLAN_GPIO_PIN29_PAD_DRIVER_GET(x) -#define GPIO_PIN29_PAD_DRIVER_SET(x) WLAN_GPIO_PIN29_PAD_DRIVER_SET(x) -#define GPIO_PIN29_SOURCE_MSB WLAN_GPIO_PIN29_SOURCE_MSB -#define GPIO_PIN29_SOURCE_LSB WLAN_GPIO_PIN29_SOURCE_LSB -#define GPIO_PIN29_SOURCE_MASK WLAN_GPIO_PIN29_SOURCE_MASK -#define GPIO_PIN29_SOURCE_GET(x) WLAN_GPIO_PIN29_SOURCE_GET(x) -#define GPIO_PIN29_SOURCE_SET(x) WLAN_GPIO_PIN29_SOURCE_SET(x) -#define GPIO_PIN30_ADDRESS WLAN_GPIO_PIN30_ADDRESS -#define GPIO_PIN30_OFFSET WLAN_GPIO_PIN30_OFFSET -#define GPIO_PIN30_CONFIG_MSB WLAN_GPIO_PIN30_CONFIG_MSB -#define GPIO_PIN30_CONFIG_LSB WLAN_GPIO_PIN30_CONFIG_LSB -#define GPIO_PIN30_CONFIG_MASK WLAN_GPIO_PIN30_CONFIG_MASK -#define GPIO_PIN30_CONFIG_GET(x) WLAN_GPIO_PIN30_CONFIG_GET(x) -#define GPIO_PIN30_CONFIG_SET(x) WLAN_GPIO_PIN30_CONFIG_SET(x) -#define GPIO_PIN30_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN30_WAKEUP_ENABLE_MSB -#define GPIO_PIN30_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN30_WAKEUP_ENABLE_LSB -#define GPIO_PIN30_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN30_WAKEUP_ENABLE_MASK -#define GPIO_PIN30_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN30_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN30_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN30_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN30_INT_TYPE_MSB WLAN_GPIO_PIN30_INT_TYPE_MSB -#define GPIO_PIN30_INT_TYPE_LSB WLAN_GPIO_PIN30_INT_TYPE_LSB -#define GPIO_PIN30_INT_TYPE_MASK WLAN_GPIO_PIN30_INT_TYPE_MASK -#define GPIO_PIN30_INT_TYPE_GET(x) WLAN_GPIO_PIN30_INT_TYPE_GET(x) -#define GPIO_PIN30_INT_TYPE_SET(x) WLAN_GPIO_PIN30_INT_TYPE_SET(x) -#define GPIO_PIN30_PAD_PULL_MSB WLAN_GPIO_PIN30_PAD_PULL_MSB -#define GPIO_PIN30_PAD_PULL_LSB WLAN_GPIO_PIN30_PAD_PULL_LSB -#define GPIO_PIN30_PAD_PULL_MASK WLAN_GPIO_PIN30_PAD_PULL_MASK -#define GPIO_PIN30_PAD_PULL_GET(x) WLAN_GPIO_PIN30_PAD_PULL_GET(x) -#define GPIO_PIN30_PAD_PULL_SET(x) WLAN_GPIO_PIN30_PAD_PULL_SET(x) -#define GPIO_PIN30_PAD_STRENGTH_MSB WLAN_GPIO_PIN30_PAD_STRENGTH_MSB -#define GPIO_PIN30_PAD_STRENGTH_LSB WLAN_GPIO_PIN30_PAD_STRENGTH_LSB -#define GPIO_PIN30_PAD_STRENGTH_MASK WLAN_GPIO_PIN30_PAD_STRENGTH_MASK -#define GPIO_PIN30_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN30_PAD_STRENGTH_GET(x) -#define GPIO_PIN30_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN30_PAD_STRENGTH_SET(x) -#define GPIO_PIN30_PAD_DRIVER_MSB WLAN_GPIO_PIN30_PAD_DRIVER_MSB -#define GPIO_PIN30_PAD_DRIVER_LSB WLAN_GPIO_PIN30_PAD_DRIVER_LSB -#define GPIO_PIN30_PAD_DRIVER_MASK WLAN_GPIO_PIN30_PAD_DRIVER_MASK -#define GPIO_PIN30_PAD_DRIVER_GET(x) WLAN_GPIO_PIN30_PAD_DRIVER_GET(x) -#define GPIO_PIN30_PAD_DRIVER_SET(x) WLAN_GPIO_PIN30_PAD_DRIVER_SET(x) -#define GPIO_PIN30_SOURCE_MSB WLAN_GPIO_PIN30_SOURCE_MSB -#define GPIO_PIN30_SOURCE_LSB WLAN_GPIO_PIN30_SOURCE_LSB -#define GPIO_PIN30_SOURCE_MASK WLAN_GPIO_PIN30_SOURCE_MASK -#define GPIO_PIN30_SOURCE_GET(x) WLAN_GPIO_PIN30_SOURCE_GET(x) -#define GPIO_PIN30_SOURCE_SET(x) WLAN_GPIO_PIN30_SOURCE_SET(x) -#define GPIO_PIN31_ADDRESS WLAN_GPIO_PIN31_ADDRESS -#define GPIO_PIN31_OFFSET WLAN_GPIO_PIN31_OFFSET -#define GPIO_PIN31_CONFIG_MSB WLAN_GPIO_PIN31_CONFIG_MSB -#define GPIO_PIN31_CONFIG_LSB WLAN_GPIO_PIN31_CONFIG_LSB -#define GPIO_PIN31_CONFIG_MASK WLAN_GPIO_PIN31_CONFIG_MASK -#define GPIO_PIN31_CONFIG_GET(x) WLAN_GPIO_PIN31_CONFIG_GET(x) -#define GPIO_PIN31_CONFIG_SET(x) WLAN_GPIO_PIN31_CONFIG_SET(x) -#define GPIO_PIN31_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN31_WAKEUP_ENABLE_MSB -#define GPIO_PIN31_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN31_WAKEUP_ENABLE_LSB -#define GPIO_PIN31_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN31_WAKEUP_ENABLE_MASK -#define GPIO_PIN31_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN31_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN31_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN31_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN31_INT_TYPE_MSB WLAN_GPIO_PIN31_INT_TYPE_MSB -#define GPIO_PIN31_INT_TYPE_LSB WLAN_GPIO_PIN31_INT_TYPE_LSB -#define GPIO_PIN31_INT_TYPE_MASK WLAN_GPIO_PIN31_INT_TYPE_MASK -#define GPIO_PIN31_INT_TYPE_GET(x) WLAN_GPIO_PIN31_INT_TYPE_GET(x) -#define GPIO_PIN31_INT_TYPE_SET(x) WLAN_GPIO_PIN31_INT_TYPE_SET(x) -#define GPIO_PIN31_PAD_PULL_MSB WLAN_GPIO_PIN31_PAD_PULL_MSB -#define GPIO_PIN31_PAD_PULL_LSB WLAN_GPIO_PIN31_PAD_PULL_LSB -#define GPIO_PIN31_PAD_PULL_MASK WLAN_GPIO_PIN31_PAD_PULL_MASK -#define GPIO_PIN31_PAD_PULL_GET(x) WLAN_GPIO_PIN31_PAD_PULL_GET(x) -#define GPIO_PIN31_PAD_PULL_SET(x) WLAN_GPIO_PIN31_PAD_PULL_SET(x) -#define GPIO_PIN31_PAD_STRENGTH_MSB WLAN_GPIO_PIN31_PAD_STRENGTH_MSB -#define GPIO_PIN31_PAD_STRENGTH_LSB WLAN_GPIO_PIN31_PAD_STRENGTH_LSB -#define GPIO_PIN31_PAD_STRENGTH_MASK WLAN_GPIO_PIN31_PAD_STRENGTH_MASK -#define GPIO_PIN31_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN31_PAD_STRENGTH_GET(x) -#define GPIO_PIN31_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN31_PAD_STRENGTH_SET(x) -#define GPIO_PIN31_PAD_DRIVER_MSB WLAN_GPIO_PIN31_PAD_DRIVER_MSB -#define GPIO_PIN31_PAD_DRIVER_LSB WLAN_GPIO_PIN31_PAD_DRIVER_LSB -#define GPIO_PIN31_PAD_DRIVER_MASK WLAN_GPIO_PIN31_PAD_DRIVER_MASK -#define GPIO_PIN31_PAD_DRIVER_GET(x) WLAN_GPIO_PIN31_PAD_DRIVER_GET(x) -#define GPIO_PIN31_PAD_DRIVER_SET(x) WLAN_GPIO_PIN31_PAD_DRIVER_SET(x) -#define GPIO_PIN31_SOURCE_MSB WLAN_GPIO_PIN31_SOURCE_MSB -#define GPIO_PIN31_SOURCE_LSB WLAN_GPIO_PIN31_SOURCE_LSB -#define GPIO_PIN31_SOURCE_MASK WLAN_GPIO_PIN31_SOURCE_MASK -#define GPIO_PIN31_SOURCE_GET(x) WLAN_GPIO_PIN31_SOURCE_GET(x) -#define GPIO_PIN31_SOURCE_SET(x) WLAN_GPIO_PIN31_SOURCE_SET(x) -#define GPIO_PIN32_ADDRESS WLAN_GPIO_PIN32_ADDRESS -#define GPIO_PIN32_OFFSET WLAN_GPIO_PIN32_OFFSET -#define GPIO_PIN32_CONFIG_MSB WLAN_GPIO_PIN32_CONFIG_MSB -#define GPIO_PIN32_CONFIG_LSB WLAN_GPIO_PIN32_CONFIG_LSB -#define GPIO_PIN32_CONFIG_MASK WLAN_GPIO_PIN32_CONFIG_MASK -#define GPIO_PIN32_CONFIG_GET(x) WLAN_GPIO_PIN32_CONFIG_GET(x) -#define GPIO_PIN32_CONFIG_SET(x) WLAN_GPIO_PIN32_CONFIG_SET(x) -#define GPIO_PIN32_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN32_WAKEUP_ENABLE_MSB -#define GPIO_PIN32_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN32_WAKEUP_ENABLE_LSB -#define GPIO_PIN32_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN32_WAKEUP_ENABLE_MASK -#define GPIO_PIN32_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN32_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN32_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN32_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN32_INT_TYPE_MSB WLAN_GPIO_PIN32_INT_TYPE_MSB -#define GPIO_PIN32_INT_TYPE_LSB WLAN_GPIO_PIN32_INT_TYPE_LSB -#define GPIO_PIN32_INT_TYPE_MASK WLAN_GPIO_PIN32_INT_TYPE_MASK -#define GPIO_PIN32_INT_TYPE_GET(x) WLAN_GPIO_PIN32_INT_TYPE_GET(x) -#define GPIO_PIN32_INT_TYPE_SET(x) WLAN_GPIO_PIN32_INT_TYPE_SET(x) -#define GPIO_PIN32_PAD_PULL_MSB WLAN_GPIO_PIN32_PAD_PULL_MSB -#define GPIO_PIN32_PAD_PULL_LSB WLAN_GPIO_PIN32_PAD_PULL_LSB -#define GPIO_PIN32_PAD_PULL_MASK WLAN_GPIO_PIN32_PAD_PULL_MASK -#define GPIO_PIN32_PAD_PULL_GET(x) WLAN_GPIO_PIN32_PAD_PULL_GET(x) -#define GPIO_PIN32_PAD_PULL_SET(x) WLAN_GPIO_PIN32_PAD_PULL_SET(x) -#define GPIO_PIN32_PAD_STRENGTH_MSB WLAN_GPIO_PIN32_PAD_STRENGTH_MSB -#define GPIO_PIN32_PAD_STRENGTH_LSB WLAN_GPIO_PIN32_PAD_STRENGTH_LSB -#define GPIO_PIN32_PAD_STRENGTH_MASK WLAN_GPIO_PIN32_PAD_STRENGTH_MASK -#define GPIO_PIN32_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN32_PAD_STRENGTH_GET(x) -#define GPIO_PIN32_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN32_PAD_STRENGTH_SET(x) -#define GPIO_PIN32_PAD_DRIVER_MSB WLAN_GPIO_PIN32_PAD_DRIVER_MSB -#define GPIO_PIN32_PAD_DRIVER_LSB WLAN_GPIO_PIN32_PAD_DRIVER_LSB -#define GPIO_PIN32_PAD_DRIVER_MASK WLAN_GPIO_PIN32_PAD_DRIVER_MASK -#define GPIO_PIN32_PAD_DRIVER_GET(x) WLAN_GPIO_PIN32_PAD_DRIVER_GET(x) -#define GPIO_PIN32_PAD_DRIVER_SET(x) WLAN_GPIO_PIN32_PAD_DRIVER_SET(x) -#define GPIO_PIN32_SOURCE_MSB WLAN_GPIO_PIN32_SOURCE_MSB -#define GPIO_PIN32_SOURCE_LSB WLAN_GPIO_PIN32_SOURCE_LSB -#define GPIO_PIN32_SOURCE_MASK WLAN_GPIO_PIN32_SOURCE_MASK -#define GPIO_PIN32_SOURCE_GET(x) WLAN_GPIO_PIN32_SOURCE_GET(x) -#define GPIO_PIN32_SOURCE_SET(x) WLAN_GPIO_PIN32_SOURCE_SET(x) -#define GPIO_PIN33_ADDRESS WLAN_GPIO_PIN33_ADDRESS -#define GPIO_PIN33_OFFSET WLAN_GPIO_PIN33_OFFSET -#define GPIO_PIN33_CONFIG_MSB WLAN_GPIO_PIN33_CONFIG_MSB -#define GPIO_PIN33_CONFIG_LSB WLAN_GPIO_PIN33_CONFIG_LSB -#define GPIO_PIN33_CONFIG_MASK WLAN_GPIO_PIN33_CONFIG_MASK -#define GPIO_PIN33_CONFIG_GET(x) WLAN_GPIO_PIN33_CONFIG_GET(x) -#define GPIO_PIN33_CONFIG_SET(x) WLAN_GPIO_PIN33_CONFIG_SET(x) -#define GPIO_PIN33_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN33_WAKEUP_ENABLE_MSB -#define GPIO_PIN33_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN33_WAKEUP_ENABLE_LSB -#define GPIO_PIN33_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN33_WAKEUP_ENABLE_MASK -#define GPIO_PIN33_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN33_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN33_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN33_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN33_INT_TYPE_MSB WLAN_GPIO_PIN33_INT_TYPE_MSB -#define GPIO_PIN33_INT_TYPE_LSB WLAN_GPIO_PIN33_INT_TYPE_LSB -#define GPIO_PIN33_INT_TYPE_MASK WLAN_GPIO_PIN33_INT_TYPE_MASK -#define GPIO_PIN33_INT_TYPE_GET(x) WLAN_GPIO_PIN33_INT_TYPE_GET(x) -#define GPIO_PIN33_INT_TYPE_SET(x) WLAN_GPIO_PIN33_INT_TYPE_SET(x) -#define GPIO_PIN33_PAD_PULL_MSB WLAN_GPIO_PIN33_PAD_PULL_MSB -#define GPIO_PIN33_PAD_PULL_LSB WLAN_GPIO_PIN33_PAD_PULL_LSB -#define GPIO_PIN33_PAD_PULL_MASK WLAN_GPIO_PIN33_PAD_PULL_MASK -#define GPIO_PIN33_PAD_PULL_GET(x) WLAN_GPIO_PIN33_PAD_PULL_GET(x) -#define GPIO_PIN33_PAD_PULL_SET(x) WLAN_GPIO_PIN33_PAD_PULL_SET(x) -#define GPIO_PIN33_PAD_STRENGTH_MSB WLAN_GPIO_PIN33_PAD_STRENGTH_MSB -#define GPIO_PIN33_PAD_STRENGTH_LSB WLAN_GPIO_PIN33_PAD_STRENGTH_LSB -#define GPIO_PIN33_PAD_STRENGTH_MASK WLAN_GPIO_PIN33_PAD_STRENGTH_MASK -#define GPIO_PIN33_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN33_PAD_STRENGTH_GET(x) -#define GPIO_PIN33_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN33_PAD_STRENGTH_SET(x) -#define GPIO_PIN33_PAD_DRIVER_MSB WLAN_GPIO_PIN33_PAD_DRIVER_MSB -#define GPIO_PIN33_PAD_DRIVER_LSB WLAN_GPIO_PIN33_PAD_DRIVER_LSB -#define GPIO_PIN33_PAD_DRIVER_MASK WLAN_GPIO_PIN33_PAD_DRIVER_MASK -#define GPIO_PIN33_PAD_DRIVER_GET(x) WLAN_GPIO_PIN33_PAD_DRIVER_GET(x) -#define GPIO_PIN33_PAD_DRIVER_SET(x) WLAN_GPIO_PIN33_PAD_DRIVER_SET(x) -#define GPIO_PIN33_SOURCE_MSB WLAN_GPIO_PIN33_SOURCE_MSB -#define GPIO_PIN33_SOURCE_LSB WLAN_GPIO_PIN33_SOURCE_LSB -#define GPIO_PIN33_SOURCE_MASK WLAN_GPIO_PIN33_SOURCE_MASK -#define GPIO_PIN33_SOURCE_GET(x) WLAN_GPIO_PIN33_SOURCE_GET(x) -#define GPIO_PIN33_SOURCE_SET(x) WLAN_GPIO_PIN33_SOURCE_SET(x) -#define GPIO_PIN34_ADDRESS WLAN_GPIO_PIN34_ADDRESS -#define GPIO_PIN34_OFFSET WLAN_GPIO_PIN34_OFFSET -#define GPIO_PIN34_CONFIG_MSB WLAN_GPIO_PIN34_CONFIG_MSB -#define GPIO_PIN34_CONFIG_LSB WLAN_GPIO_PIN34_CONFIG_LSB -#define GPIO_PIN34_CONFIG_MASK WLAN_GPIO_PIN34_CONFIG_MASK -#define GPIO_PIN34_CONFIG_GET(x) WLAN_GPIO_PIN34_CONFIG_GET(x) -#define GPIO_PIN34_CONFIG_SET(x) WLAN_GPIO_PIN34_CONFIG_SET(x) -#define GPIO_PIN34_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN34_WAKEUP_ENABLE_MSB -#define GPIO_PIN34_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN34_WAKEUP_ENABLE_LSB -#define GPIO_PIN34_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN34_WAKEUP_ENABLE_MASK -#define GPIO_PIN34_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN34_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN34_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN34_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN34_INT_TYPE_MSB WLAN_GPIO_PIN34_INT_TYPE_MSB -#define GPIO_PIN34_INT_TYPE_LSB WLAN_GPIO_PIN34_INT_TYPE_LSB -#define GPIO_PIN34_INT_TYPE_MASK WLAN_GPIO_PIN34_INT_TYPE_MASK -#define GPIO_PIN34_INT_TYPE_GET(x) WLAN_GPIO_PIN34_INT_TYPE_GET(x) -#define GPIO_PIN34_INT_TYPE_SET(x) WLAN_GPIO_PIN34_INT_TYPE_SET(x) -#define GPIO_PIN34_PAD_PULL_MSB WLAN_GPIO_PIN34_PAD_PULL_MSB -#define GPIO_PIN34_PAD_PULL_LSB WLAN_GPIO_PIN34_PAD_PULL_LSB -#define GPIO_PIN34_PAD_PULL_MASK WLAN_GPIO_PIN34_PAD_PULL_MASK -#define GPIO_PIN34_PAD_PULL_GET(x) WLAN_GPIO_PIN34_PAD_PULL_GET(x) -#define GPIO_PIN34_PAD_PULL_SET(x) WLAN_GPIO_PIN34_PAD_PULL_SET(x) -#define GPIO_PIN34_PAD_STRENGTH_MSB WLAN_GPIO_PIN34_PAD_STRENGTH_MSB -#define GPIO_PIN34_PAD_STRENGTH_LSB WLAN_GPIO_PIN34_PAD_STRENGTH_LSB -#define GPIO_PIN34_PAD_STRENGTH_MASK WLAN_GPIO_PIN34_PAD_STRENGTH_MASK -#define GPIO_PIN34_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN34_PAD_STRENGTH_GET(x) -#define GPIO_PIN34_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN34_PAD_STRENGTH_SET(x) -#define GPIO_PIN34_PAD_DRIVER_MSB WLAN_GPIO_PIN34_PAD_DRIVER_MSB -#define GPIO_PIN34_PAD_DRIVER_LSB WLAN_GPIO_PIN34_PAD_DRIVER_LSB -#define GPIO_PIN34_PAD_DRIVER_MASK WLAN_GPIO_PIN34_PAD_DRIVER_MASK -#define GPIO_PIN34_PAD_DRIVER_GET(x) WLAN_GPIO_PIN34_PAD_DRIVER_GET(x) -#define GPIO_PIN34_PAD_DRIVER_SET(x) WLAN_GPIO_PIN34_PAD_DRIVER_SET(x) -#define GPIO_PIN34_SOURCE_MSB WLAN_GPIO_PIN34_SOURCE_MSB -#define GPIO_PIN34_SOURCE_LSB WLAN_GPIO_PIN34_SOURCE_LSB -#define GPIO_PIN34_SOURCE_MASK WLAN_GPIO_PIN34_SOURCE_MASK -#define GPIO_PIN34_SOURCE_GET(x) WLAN_GPIO_PIN34_SOURCE_GET(x) -#define GPIO_PIN34_SOURCE_SET(x) WLAN_GPIO_PIN34_SOURCE_SET(x) -#define GPIO_PIN35_ADDRESS WLAN_GPIO_PIN35_ADDRESS -#define GPIO_PIN35_OFFSET WLAN_GPIO_PIN35_OFFSET -#define GPIO_PIN35_CONFIG_MSB WLAN_GPIO_PIN35_CONFIG_MSB -#define GPIO_PIN35_CONFIG_LSB WLAN_GPIO_PIN35_CONFIG_LSB -#define GPIO_PIN35_CONFIG_MASK WLAN_GPIO_PIN35_CONFIG_MASK -#define GPIO_PIN35_CONFIG_GET(x) WLAN_GPIO_PIN35_CONFIG_GET(x) -#define GPIO_PIN35_CONFIG_SET(x) WLAN_GPIO_PIN35_CONFIG_SET(x) -#define GPIO_PIN35_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN35_WAKEUP_ENABLE_MSB -#define GPIO_PIN35_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN35_WAKEUP_ENABLE_LSB -#define GPIO_PIN35_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN35_WAKEUP_ENABLE_MASK -#define GPIO_PIN35_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN35_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN35_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN35_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN35_INT_TYPE_MSB WLAN_GPIO_PIN35_INT_TYPE_MSB -#define GPIO_PIN35_INT_TYPE_LSB WLAN_GPIO_PIN35_INT_TYPE_LSB -#define GPIO_PIN35_INT_TYPE_MASK WLAN_GPIO_PIN35_INT_TYPE_MASK -#define GPIO_PIN35_INT_TYPE_GET(x) WLAN_GPIO_PIN35_INT_TYPE_GET(x) -#define GPIO_PIN35_INT_TYPE_SET(x) WLAN_GPIO_PIN35_INT_TYPE_SET(x) -#define GPIO_PIN35_PAD_PULL_MSB WLAN_GPIO_PIN35_PAD_PULL_MSB -#define GPIO_PIN35_PAD_PULL_LSB WLAN_GPIO_PIN35_PAD_PULL_LSB -#define GPIO_PIN35_PAD_PULL_MASK WLAN_GPIO_PIN35_PAD_PULL_MASK -#define GPIO_PIN35_PAD_PULL_GET(x) WLAN_GPIO_PIN35_PAD_PULL_GET(x) -#define GPIO_PIN35_PAD_PULL_SET(x) WLAN_GPIO_PIN35_PAD_PULL_SET(x) -#define GPIO_PIN35_PAD_STRENGTH_MSB WLAN_GPIO_PIN35_PAD_STRENGTH_MSB -#define GPIO_PIN35_PAD_STRENGTH_LSB WLAN_GPIO_PIN35_PAD_STRENGTH_LSB -#define GPIO_PIN35_PAD_STRENGTH_MASK WLAN_GPIO_PIN35_PAD_STRENGTH_MASK -#define GPIO_PIN35_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN35_PAD_STRENGTH_GET(x) -#define GPIO_PIN35_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN35_PAD_STRENGTH_SET(x) -#define GPIO_PIN35_PAD_DRIVER_MSB WLAN_GPIO_PIN35_PAD_DRIVER_MSB -#define GPIO_PIN35_PAD_DRIVER_LSB WLAN_GPIO_PIN35_PAD_DRIVER_LSB -#define GPIO_PIN35_PAD_DRIVER_MASK WLAN_GPIO_PIN35_PAD_DRIVER_MASK -#define GPIO_PIN35_PAD_DRIVER_GET(x) WLAN_GPIO_PIN35_PAD_DRIVER_GET(x) -#define GPIO_PIN35_PAD_DRIVER_SET(x) WLAN_GPIO_PIN35_PAD_DRIVER_SET(x) -#define GPIO_PIN35_SOURCE_MSB WLAN_GPIO_PIN35_SOURCE_MSB -#define GPIO_PIN35_SOURCE_LSB WLAN_GPIO_PIN35_SOURCE_LSB -#define GPIO_PIN35_SOURCE_MASK WLAN_GPIO_PIN35_SOURCE_MASK -#define GPIO_PIN35_SOURCE_GET(x) WLAN_GPIO_PIN35_SOURCE_GET(x) -#define GPIO_PIN35_SOURCE_SET(x) WLAN_GPIO_PIN35_SOURCE_SET(x) -#define GPIO_PIN36_ADDRESS WLAN_GPIO_PIN36_ADDRESS -#define GPIO_PIN36_OFFSET WLAN_GPIO_PIN36_OFFSET -#define GPIO_PIN36_CONFIG_MSB WLAN_GPIO_PIN36_CONFIG_MSB -#define GPIO_PIN36_CONFIG_LSB WLAN_GPIO_PIN36_CONFIG_LSB -#define GPIO_PIN36_CONFIG_MASK WLAN_GPIO_PIN36_CONFIG_MASK -#define GPIO_PIN36_CONFIG_GET(x) WLAN_GPIO_PIN36_CONFIG_GET(x) -#define GPIO_PIN36_CONFIG_SET(x) WLAN_GPIO_PIN36_CONFIG_SET(x) -#define GPIO_PIN36_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN36_WAKEUP_ENABLE_MSB -#define GPIO_PIN36_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN36_WAKEUP_ENABLE_LSB -#define GPIO_PIN36_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN36_WAKEUP_ENABLE_MASK -#define GPIO_PIN36_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN36_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN36_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN36_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN36_INT_TYPE_MSB WLAN_GPIO_PIN36_INT_TYPE_MSB -#define GPIO_PIN36_INT_TYPE_LSB WLAN_GPIO_PIN36_INT_TYPE_LSB -#define GPIO_PIN36_INT_TYPE_MASK WLAN_GPIO_PIN36_INT_TYPE_MASK -#define GPIO_PIN36_INT_TYPE_GET(x) WLAN_GPIO_PIN36_INT_TYPE_GET(x) -#define GPIO_PIN36_INT_TYPE_SET(x) WLAN_GPIO_PIN36_INT_TYPE_SET(x) -#define GPIO_PIN36_PAD_PULL_MSB WLAN_GPIO_PIN36_PAD_PULL_MSB -#define GPIO_PIN36_PAD_PULL_LSB WLAN_GPIO_PIN36_PAD_PULL_LSB -#define GPIO_PIN36_PAD_PULL_MASK WLAN_GPIO_PIN36_PAD_PULL_MASK -#define GPIO_PIN36_PAD_PULL_GET(x) WLAN_GPIO_PIN36_PAD_PULL_GET(x) -#define GPIO_PIN36_PAD_PULL_SET(x) WLAN_GPIO_PIN36_PAD_PULL_SET(x) -#define GPIO_PIN36_PAD_STRENGTH_MSB WLAN_GPIO_PIN36_PAD_STRENGTH_MSB -#define GPIO_PIN36_PAD_STRENGTH_LSB WLAN_GPIO_PIN36_PAD_STRENGTH_LSB -#define GPIO_PIN36_PAD_STRENGTH_MASK WLAN_GPIO_PIN36_PAD_STRENGTH_MASK -#define GPIO_PIN36_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN36_PAD_STRENGTH_GET(x) -#define GPIO_PIN36_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN36_PAD_STRENGTH_SET(x) -#define GPIO_PIN36_PAD_DRIVER_MSB WLAN_GPIO_PIN36_PAD_DRIVER_MSB -#define GPIO_PIN36_PAD_DRIVER_LSB WLAN_GPIO_PIN36_PAD_DRIVER_LSB -#define GPIO_PIN36_PAD_DRIVER_MASK WLAN_GPIO_PIN36_PAD_DRIVER_MASK -#define GPIO_PIN36_PAD_DRIVER_GET(x) WLAN_GPIO_PIN36_PAD_DRIVER_GET(x) -#define GPIO_PIN36_PAD_DRIVER_SET(x) WLAN_GPIO_PIN36_PAD_DRIVER_SET(x) -#define GPIO_PIN36_SOURCE_MSB WLAN_GPIO_PIN36_SOURCE_MSB -#define GPIO_PIN36_SOURCE_LSB WLAN_GPIO_PIN36_SOURCE_LSB -#define GPIO_PIN36_SOURCE_MASK WLAN_GPIO_PIN36_SOURCE_MASK -#define GPIO_PIN36_SOURCE_GET(x) WLAN_GPIO_PIN36_SOURCE_GET(x) -#define GPIO_PIN36_SOURCE_SET(x) WLAN_GPIO_PIN36_SOURCE_SET(x) -#define GPIO_PIN37_ADDRESS WLAN_GPIO_PIN37_ADDRESS -#define GPIO_PIN37_OFFSET WLAN_GPIO_PIN37_OFFSET -#define GPIO_PIN37_CONFIG_MSB WLAN_GPIO_PIN37_CONFIG_MSB -#define GPIO_PIN37_CONFIG_LSB WLAN_GPIO_PIN37_CONFIG_LSB -#define GPIO_PIN37_CONFIG_MASK WLAN_GPIO_PIN37_CONFIG_MASK -#define GPIO_PIN37_CONFIG_GET(x) WLAN_GPIO_PIN37_CONFIG_GET(x) -#define GPIO_PIN37_CONFIG_SET(x) WLAN_GPIO_PIN37_CONFIG_SET(x) -#define GPIO_PIN37_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN37_WAKEUP_ENABLE_MSB -#define GPIO_PIN37_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN37_WAKEUP_ENABLE_LSB -#define GPIO_PIN37_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN37_WAKEUP_ENABLE_MASK -#define GPIO_PIN37_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN37_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN37_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN37_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN37_INT_TYPE_MSB WLAN_GPIO_PIN37_INT_TYPE_MSB -#define GPIO_PIN37_INT_TYPE_LSB WLAN_GPIO_PIN37_INT_TYPE_LSB -#define GPIO_PIN37_INT_TYPE_MASK WLAN_GPIO_PIN37_INT_TYPE_MASK -#define GPIO_PIN37_INT_TYPE_GET(x) WLAN_GPIO_PIN37_INT_TYPE_GET(x) -#define GPIO_PIN37_INT_TYPE_SET(x) WLAN_GPIO_PIN37_INT_TYPE_SET(x) -#define GPIO_PIN37_PAD_PULL_MSB WLAN_GPIO_PIN37_PAD_PULL_MSB -#define GPIO_PIN37_PAD_PULL_LSB WLAN_GPIO_PIN37_PAD_PULL_LSB -#define GPIO_PIN37_PAD_PULL_MASK WLAN_GPIO_PIN37_PAD_PULL_MASK -#define GPIO_PIN37_PAD_PULL_GET(x) WLAN_GPIO_PIN37_PAD_PULL_GET(x) -#define GPIO_PIN37_PAD_PULL_SET(x) WLAN_GPIO_PIN37_PAD_PULL_SET(x) -#define GPIO_PIN37_PAD_STRENGTH_MSB WLAN_GPIO_PIN37_PAD_STRENGTH_MSB -#define GPIO_PIN37_PAD_STRENGTH_LSB WLAN_GPIO_PIN37_PAD_STRENGTH_LSB -#define GPIO_PIN37_PAD_STRENGTH_MASK WLAN_GPIO_PIN37_PAD_STRENGTH_MASK -#define GPIO_PIN37_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN37_PAD_STRENGTH_GET(x) -#define GPIO_PIN37_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN37_PAD_STRENGTH_SET(x) -#define GPIO_PIN37_PAD_DRIVER_MSB WLAN_GPIO_PIN37_PAD_DRIVER_MSB -#define GPIO_PIN37_PAD_DRIVER_LSB WLAN_GPIO_PIN37_PAD_DRIVER_LSB -#define GPIO_PIN37_PAD_DRIVER_MASK WLAN_GPIO_PIN37_PAD_DRIVER_MASK -#define GPIO_PIN37_PAD_DRIVER_GET(x) WLAN_GPIO_PIN37_PAD_DRIVER_GET(x) -#define GPIO_PIN37_PAD_DRIVER_SET(x) WLAN_GPIO_PIN37_PAD_DRIVER_SET(x) -#define GPIO_PIN37_SOURCE_MSB WLAN_GPIO_PIN37_SOURCE_MSB -#define GPIO_PIN37_SOURCE_LSB WLAN_GPIO_PIN37_SOURCE_LSB -#define GPIO_PIN37_SOURCE_MASK WLAN_GPIO_PIN37_SOURCE_MASK -#define GPIO_PIN37_SOURCE_GET(x) WLAN_GPIO_PIN37_SOURCE_GET(x) -#define GPIO_PIN37_SOURCE_SET(x) WLAN_GPIO_PIN37_SOURCE_SET(x) -#define GPIO_PIN38_ADDRESS WLAN_GPIO_PIN38_ADDRESS -#define GPIO_PIN38_OFFSET WLAN_GPIO_PIN38_OFFSET -#define GPIO_PIN38_CONFIG_MSB WLAN_GPIO_PIN38_CONFIG_MSB -#define GPIO_PIN38_CONFIG_LSB WLAN_GPIO_PIN38_CONFIG_LSB -#define GPIO_PIN38_CONFIG_MASK WLAN_GPIO_PIN38_CONFIG_MASK -#define GPIO_PIN38_CONFIG_GET(x) WLAN_GPIO_PIN38_CONFIG_GET(x) -#define GPIO_PIN38_CONFIG_SET(x) WLAN_GPIO_PIN38_CONFIG_SET(x) -#define GPIO_PIN38_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN38_WAKEUP_ENABLE_MSB -#define GPIO_PIN38_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN38_WAKEUP_ENABLE_LSB -#define GPIO_PIN38_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN38_WAKEUP_ENABLE_MASK -#define GPIO_PIN38_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN38_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN38_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN38_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN38_INT_TYPE_MSB WLAN_GPIO_PIN38_INT_TYPE_MSB -#define GPIO_PIN38_INT_TYPE_LSB WLAN_GPIO_PIN38_INT_TYPE_LSB -#define GPIO_PIN38_INT_TYPE_MASK WLAN_GPIO_PIN38_INT_TYPE_MASK -#define GPIO_PIN38_INT_TYPE_GET(x) WLAN_GPIO_PIN38_INT_TYPE_GET(x) -#define GPIO_PIN38_INT_TYPE_SET(x) WLAN_GPIO_PIN38_INT_TYPE_SET(x) -#define GPIO_PIN38_PAD_PULL_MSB WLAN_GPIO_PIN38_PAD_PULL_MSB -#define GPIO_PIN38_PAD_PULL_LSB WLAN_GPIO_PIN38_PAD_PULL_LSB -#define GPIO_PIN38_PAD_PULL_MASK WLAN_GPIO_PIN38_PAD_PULL_MASK -#define GPIO_PIN38_PAD_PULL_GET(x) WLAN_GPIO_PIN38_PAD_PULL_GET(x) -#define GPIO_PIN38_PAD_PULL_SET(x) WLAN_GPIO_PIN38_PAD_PULL_SET(x) -#define GPIO_PIN38_PAD_STRENGTH_MSB WLAN_GPIO_PIN38_PAD_STRENGTH_MSB -#define GPIO_PIN38_PAD_STRENGTH_LSB WLAN_GPIO_PIN38_PAD_STRENGTH_LSB -#define GPIO_PIN38_PAD_STRENGTH_MASK WLAN_GPIO_PIN38_PAD_STRENGTH_MASK -#define GPIO_PIN38_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN38_PAD_STRENGTH_GET(x) -#define GPIO_PIN38_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN38_PAD_STRENGTH_SET(x) -#define GPIO_PIN38_PAD_DRIVER_MSB WLAN_GPIO_PIN38_PAD_DRIVER_MSB -#define GPIO_PIN38_PAD_DRIVER_LSB WLAN_GPIO_PIN38_PAD_DRIVER_LSB -#define GPIO_PIN38_PAD_DRIVER_MASK WLAN_GPIO_PIN38_PAD_DRIVER_MASK -#define GPIO_PIN38_PAD_DRIVER_GET(x) WLAN_GPIO_PIN38_PAD_DRIVER_GET(x) -#define GPIO_PIN38_PAD_DRIVER_SET(x) WLAN_GPIO_PIN38_PAD_DRIVER_SET(x) -#define GPIO_PIN38_SOURCE_MSB WLAN_GPIO_PIN38_SOURCE_MSB -#define GPIO_PIN38_SOURCE_LSB WLAN_GPIO_PIN38_SOURCE_LSB -#define GPIO_PIN38_SOURCE_MASK WLAN_GPIO_PIN38_SOURCE_MASK -#define GPIO_PIN38_SOURCE_GET(x) WLAN_GPIO_PIN38_SOURCE_GET(x) -#define GPIO_PIN38_SOURCE_SET(x) WLAN_GPIO_PIN38_SOURCE_SET(x) -#define GPIO_PIN39_ADDRESS WLAN_GPIO_PIN39_ADDRESS -#define GPIO_PIN39_OFFSET WLAN_GPIO_PIN39_OFFSET -#define GPIO_PIN39_CONFIG_MSB WLAN_GPIO_PIN39_CONFIG_MSB -#define GPIO_PIN39_CONFIG_LSB WLAN_GPIO_PIN39_CONFIG_LSB -#define GPIO_PIN39_CONFIG_MASK WLAN_GPIO_PIN39_CONFIG_MASK -#define GPIO_PIN39_CONFIG_GET(x) WLAN_GPIO_PIN39_CONFIG_GET(x) -#define GPIO_PIN39_CONFIG_SET(x) WLAN_GPIO_PIN39_CONFIG_SET(x) -#define GPIO_PIN39_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN39_WAKEUP_ENABLE_MSB -#define GPIO_PIN39_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN39_WAKEUP_ENABLE_LSB -#define GPIO_PIN39_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN39_WAKEUP_ENABLE_MASK -#define GPIO_PIN39_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN39_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN39_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN39_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN39_INT_TYPE_MSB WLAN_GPIO_PIN39_INT_TYPE_MSB -#define GPIO_PIN39_INT_TYPE_LSB WLAN_GPIO_PIN39_INT_TYPE_LSB -#define GPIO_PIN39_INT_TYPE_MASK WLAN_GPIO_PIN39_INT_TYPE_MASK -#define GPIO_PIN39_INT_TYPE_GET(x) WLAN_GPIO_PIN39_INT_TYPE_GET(x) -#define GPIO_PIN39_INT_TYPE_SET(x) WLAN_GPIO_PIN39_INT_TYPE_SET(x) -#define GPIO_PIN39_PAD_PULL_MSB WLAN_GPIO_PIN39_PAD_PULL_MSB -#define GPIO_PIN39_PAD_PULL_LSB WLAN_GPIO_PIN39_PAD_PULL_LSB -#define GPIO_PIN39_PAD_PULL_MASK WLAN_GPIO_PIN39_PAD_PULL_MASK -#define GPIO_PIN39_PAD_PULL_GET(x) WLAN_GPIO_PIN39_PAD_PULL_GET(x) -#define GPIO_PIN39_PAD_PULL_SET(x) WLAN_GPIO_PIN39_PAD_PULL_SET(x) -#define GPIO_PIN39_PAD_STRENGTH_MSB WLAN_GPIO_PIN39_PAD_STRENGTH_MSB -#define GPIO_PIN39_PAD_STRENGTH_LSB WLAN_GPIO_PIN39_PAD_STRENGTH_LSB -#define GPIO_PIN39_PAD_STRENGTH_MASK WLAN_GPIO_PIN39_PAD_STRENGTH_MASK -#define GPIO_PIN39_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN39_PAD_STRENGTH_GET(x) -#define GPIO_PIN39_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN39_PAD_STRENGTH_SET(x) -#define GPIO_PIN39_PAD_DRIVER_MSB WLAN_GPIO_PIN39_PAD_DRIVER_MSB -#define GPIO_PIN39_PAD_DRIVER_LSB WLAN_GPIO_PIN39_PAD_DRIVER_LSB -#define GPIO_PIN39_PAD_DRIVER_MASK WLAN_GPIO_PIN39_PAD_DRIVER_MASK -#define GPIO_PIN39_PAD_DRIVER_GET(x) WLAN_GPIO_PIN39_PAD_DRIVER_GET(x) -#define GPIO_PIN39_PAD_DRIVER_SET(x) WLAN_GPIO_PIN39_PAD_DRIVER_SET(x) -#define GPIO_PIN39_SOURCE_MSB WLAN_GPIO_PIN39_SOURCE_MSB -#define GPIO_PIN39_SOURCE_LSB WLAN_GPIO_PIN39_SOURCE_LSB -#define GPIO_PIN39_SOURCE_MASK WLAN_GPIO_PIN39_SOURCE_MASK -#define GPIO_PIN39_SOURCE_GET(x) WLAN_GPIO_PIN39_SOURCE_GET(x) -#define GPIO_PIN39_SOURCE_SET(x) WLAN_GPIO_PIN39_SOURCE_SET(x) -#define GPIO_PIN40_ADDRESS WLAN_GPIO_PIN40_ADDRESS -#define GPIO_PIN40_OFFSET WLAN_GPIO_PIN40_OFFSET -#define GPIO_PIN40_CONFIG_MSB WLAN_GPIO_PIN40_CONFIG_MSB -#define GPIO_PIN40_CONFIG_LSB WLAN_GPIO_PIN40_CONFIG_LSB -#define GPIO_PIN40_CONFIG_MASK WLAN_GPIO_PIN40_CONFIG_MASK -#define GPIO_PIN40_CONFIG_GET(x) WLAN_GPIO_PIN40_CONFIG_GET(x) -#define GPIO_PIN40_CONFIG_SET(x) WLAN_GPIO_PIN40_CONFIG_SET(x) -#define GPIO_PIN40_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN40_WAKEUP_ENABLE_MSB -#define GPIO_PIN40_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN40_WAKEUP_ENABLE_LSB -#define GPIO_PIN40_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN40_WAKEUP_ENABLE_MASK -#define GPIO_PIN40_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN40_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN40_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN40_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN40_INT_TYPE_MSB WLAN_GPIO_PIN40_INT_TYPE_MSB -#define GPIO_PIN40_INT_TYPE_LSB WLAN_GPIO_PIN40_INT_TYPE_LSB -#define GPIO_PIN40_INT_TYPE_MASK WLAN_GPIO_PIN40_INT_TYPE_MASK -#define GPIO_PIN40_INT_TYPE_GET(x) WLAN_GPIO_PIN40_INT_TYPE_GET(x) -#define GPIO_PIN40_INT_TYPE_SET(x) WLAN_GPIO_PIN40_INT_TYPE_SET(x) -#define GPIO_PIN40_PAD_PULL_MSB WLAN_GPIO_PIN40_PAD_PULL_MSB -#define GPIO_PIN40_PAD_PULL_LSB WLAN_GPIO_PIN40_PAD_PULL_LSB -#define GPIO_PIN40_PAD_PULL_MASK WLAN_GPIO_PIN40_PAD_PULL_MASK -#define GPIO_PIN40_PAD_PULL_GET(x) WLAN_GPIO_PIN40_PAD_PULL_GET(x) -#define GPIO_PIN40_PAD_PULL_SET(x) WLAN_GPIO_PIN40_PAD_PULL_SET(x) -#define GPIO_PIN40_PAD_STRENGTH_MSB WLAN_GPIO_PIN40_PAD_STRENGTH_MSB -#define GPIO_PIN40_PAD_STRENGTH_LSB WLAN_GPIO_PIN40_PAD_STRENGTH_LSB -#define GPIO_PIN40_PAD_STRENGTH_MASK WLAN_GPIO_PIN40_PAD_STRENGTH_MASK -#define GPIO_PIN40_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN40_PAD_STRENGTH_GET(x) -#define GPIO_PIN40_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN40_PAD_STRENGTH_SET(x) -#define GPIO_PIN40_PAD_DRIVER_MSB WLAN_GPIO_PIN40_PAD_DRIVER_MSB -#define GPIO_PIN40_PAD_DRIVER_LSB WLAN_GPIO_PIN40_PAD_DRIVER_LSB -#define GPIO_PIN40_PAD_DRIVER_MASK WLAN_GPIO_PIN40_PAD_DRIVER_MASK -#define GPIO_PIN40_PAD_DRIVER_GET(x) WLAN_GPIO_PIN40_PAD_DRIVER_GET(x) -#define GPIO_PIN40_PAD_DRIVER_SET(x) WLAN_GPIO_PIN40_PAD_DRIVER_SET(x) -#define GPIO_PIN40_SOURCE_MSB WLAN_GPIO_PIN40_SOURCE_MSB -#define GPIO_PIN40_SOURCE_LSB WLAN_GPIO_PIN40_SOURCE_LSB -#define GPIO_PIN40_SOURCE_MASK WLAN_GPIO_PIN40_SOURCE_MASK -#define GPIO_PIN40_SOURCE_GET(x) WLAN_GPIO_PIN40_SOURCE_GET(x) -#define GPIO_PIN40_SOURCE_SET(x) WLAN_GPIO_PIN40_SOURCE_SET(x) -#define GPIO_PIN41_ADDRESS WLAN_GPIO_PIN41_ADDRESS -#define GPIO_PIN41_OFFSET WLAN_GPIO_PIN41_OFFSET -#define GPIO_PIN41_CONFIG_MSB WLAN_GPIO_PIN41_CONFIG_MSB -#define GPIO_PIN41_CONFIG_LSB WLAN_GPIO_PIN41_CONFIG_LSB -#define GPIO_PIN41_CONFIG_MASK WLAN_GPIO_PIN41_CONFIG_MASK -#define GPIO_PIN41_CONFIG_GET(x) WLAN_GPIO_PIN41_CONFIG_GET(x) -#define GPIO_PIN41_CONFIG_SET(x) WLAN_GPIO_PIN41_CONFIG_SET(x) -#define GPIO_PIN41_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN41_WAKEUP_ENABLE_MSB -#define GPIO_PIN41_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN41_WAKEUP_ENABLE_LSB -#define GPIO_PIN41_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN41_WAKEUP_ENABLE_MASK -#define GPIO_PIN41_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN41_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN41_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN41_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN41_INT_TYPE_MSB WLAN_GPIO_PIN41_INT_TYPE_MSB -#define GPIO_PIN41_INT_TYPE_LSB WLAN_GPIO_PIN41_INT_TYPE_LSB -#define GPIO_PIN41_INT_TYPE_MASK WLAN_GPIO_PIN41_INT_TYPE_MASK -#define GPIO_PIN41_INT_TYPE_GET(x) WLAN_GPIO_PIN41_INT_TYPE_GET(x) -#define GPIO_PIN41_INT_TYPE_SET(x) WLAN_GPIO_PIN41_INT_TYPE_SET(x) -#define GPIO_PIN41_PAD_PULL_MSB WLAN_GPIO_PIN41_PAD_PULL_MSB -#define GPIO_PIN41_PAD_PULL_LSB WLAN_GPIO_PIN41_PAD_PULL_LSB -#define GPIO_PIN41_PAD_PULL_MASK WLAN_GPIO_PIN41_PAD_PULL_MASK -#define GPIO_PIN41_PAD_PULL_GET(x) WLAN_GPIO_PIN41_PAD_PULL_GET(x) -#define GPIO_PIN41_PAD_PULL_SET(x) WLAN_GPIO_PIN41_PAD_PULL_SET(x) -#define GPIO_PIN41_PAD_STRENGTH_MSB WLAN_GPIO_PIN41_PAD_STRENGTH_MSB -#define GPIO_PIN41_PAD_STRENGTH_LSB WLAN_GPIO_PIN41_PAD_STRENGTH_LSB -#define GPIO_PIN41_PAD_STRENGTH_MASK WLAN_GPIO_PIN41_PAD_STRENGTH_MASK -#define GPIO_PIN41_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN41_PAD_STRENGTH_GET(x) -#define GPIO_PIN41_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN41_PAD_STRENGTH_SET(x) -#define GPIO_PIN41_PAD_DRIVER_MSB WLAN_GPIO_PIN41_PAD_DRIVER_MSB -#define GPIO_PIN41_PAD_DRIVER_LSB WLAN_GPIO_PIN41_PAD_DRIVER_LSB -#define GPIO_PIN41_PAD_DRIVER_MASK WLAN_GPIO_PIN41_PAD_DRIVER_MASK -#define GPIO_PIN41_PAD_DRIVER_GET(x) WLAN_GPIO_PIN41_PAD_DRIVER_GET(x) -#define GPIO_PIN41_PAD_DRIVER_SET(x) WLAN_GPIO_PIN41_PAD_DRIVER_SET(x) -#define GPIO_PIN41_SOURCE_MSB WLAN_GPIO_PIN41_SOURCE_MSB -#define GPIO_PIN41_SOURCE_LSB WLAN_GPIO_PIN41_SOURCE_LSB -#define GPIO_PIN41_SOURCE_MASK WLAN_GPIO_PIN41_SOURCE_MASK -#define GPIO_PIN41_SOURCE_GET(x) WLAN_GPIO_PIN41_SOURCE_GET(x) -#define GPIO_PIN41_SOURCE_SET(x) WLAN_GPIO_PIN41_SOURCE_SET(x) -#define GPIO_PIN42_ADDRESS WLAN_GPIO_PIN42_ADDRESS -#define GPIO_PIN42_OFFSET WLAN_GPIO_PIN42_OFFSET -#define GPIO_PIN42_CONFIG_MSB WLAN_GPIO_PIN42_CONFIG_MSB -#define GPIO_PIN42_CONFIG_LSB WLAN_GPIO_PIN42_CONFIG_LSB -#define GPIO_PIN42_CONFIG_MASK WLAN_GPIO_PIN42_CONFIG_MASK -#define GPIO_PIN42_CONFIG_GET(x) WLAN_GPIO_PIN42_CONFIG_GET(x) -#define GPIO_PIN42_CONFIG_SET(x) WLAN_GPIO_PIN42_CONFIG_SET(x) -#define GPIO_PIN42_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN42_WAKEUP_ENABLE_MSB -#define GPIO_PIN42_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN42_WAKEUP_ENABLE_LSB -#define GPIO_PIN42_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN42_WAKEUP_ENABLE_MASK -#define GPIO_PIN42_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN42_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN42_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN42_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN42_INT_TYPE_MSB WLAN_GPIO_PIN42_INT_TYPE_MSB -#define GPIO_PIN42_INT_TYPE_LSB WLAN_GPIO_PIN42_INT_TYPE_LSB -#define GPIO_PIN42_INT_TYPE_MASK WLAN_GPIO_PIN42_INT_TYPE_MASK -#define GPIO_PIN42_INT_TYPE_GET(x) WLAN_GPIO_PIN42_INT_TYPE_GET(x) -#define GPIO_PIN42_INT_TYPE_SET(x) WLAN_GPIO_PIN42_INT_TYPE_SET(x) -#define GPIO_PIN42_PAD_PULL_MSB WLAN_GPIO_PIN42_PAD_PULL_MSB -#define GPIO_PIN42_PAD_PULL_LSB WLAN_GPIO_PIN42_PAD_PULL_LSB -#define GPIO_PIN42_PAD_PULL_MASK WLAN_GPIO_PIN42_PAD_PULL_MASK -#define GPIO_PIN42_PAD_PULL_GET(x) WLAN_GPIO_PIN42_PAD_PULL_GET(x) -#define GPIO_PIN42_PAD_PULL_SET(x) WLAN_GPIO_PIN42_PAD_PULL_SET(x) -#define GPIO_PIN42_PAD_STRENGTH_MSB WLAN_GPIO_PIN42_PAD_STRENGTH_MSB -#define GPIO_PIN42_PAD_STRENGTH_LSB WLAN_GPIO_PIN42_PAD_STRENGTH_LSB -#define GPIO_PIN42_PAD_STRENGTH_MASK WLAN_GPIO_PIN42_PAD_STRENGTH_MASK -#define GPIO_PIN42_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN42_PAD_STRENGTH_GET(x) -#define GPIO_PIN42_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN42_PAD_STRENGTH_SET(x) -#define GPIO_PIN42_PAD_DRIVER_MSB WLAN_GPIO_PIN42_PAD_DRIVER_MSB -#define GPIO_PIN42_PAD_DRIVER_LSB WLAN_GPIO_PIN42_PAD_DRIVER_LSB -#define GPIO_PIN42_PAD_DRIVER_MASK WLAN_GPIO_PIN42_PAD_DRIVER_MASK -#define GPIO_PIN42_PAD_DRIVER_GET(x) WLAN_GPIO_PIN42_PAD_DRIVER_GET(x) -#define GPIO_PIN42_PAD_DRIVER_SET(x) WLAN_GPIO_PIN42_PAD_DRIVER_SET(x) -#define GPIO_PIN42_SOURCE_MSB WLAN_GPIO_PIN42_SOURCE_MSB -#define GPIO_PIN42_SOURCE_LSB WLAN_GPIO_PIN42_SOURCE_LSB -#define GPIO_PIN42_SOURCE_MASK WLAN_GPIO_PIN42_SOURCE_MASK -#define GPIO_PIN42_SOURCE_GET(x) WLAN_GPIO_PIN42_SOURCE_GET(x) -#define GPIO_PIN42_SOURCE_SET(x) WLAN_GPIO_PIN42_SOURCE_SET(x) -#define GPIO_PIN43_ADDRESS WLAN_GPIO_PIN43_ADDRESS -#define GPIO_PIN43_OFFSET WLAN_GPIO_PIN43_OFFSET -#define GPIO_PIN43_CONFIG_MSB WLAN_GPIO_PIN43_CONFIG_MSB -#define GPIO_PIN43_CONFIG_LSB WLAN_GPIO_PIN43_CONFIG_LSB -#define GPIO_PIN43_CONFIG_MASK WLAN_GPIO_PIN43_CONFIG_MASK -#define GPIO_PIN43_CONFIG_GET(x) WLAN_GPIO_PIN43_CONFIG_GET(x) -#define GPIO_PIN43_CONFIG_SET(x) WLAN_GPIO_PIN43_CONFIG_SET(x) -#define GPIO_PIN43_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN43_WAKEUP_ENABLE_MSB -#define GPIO_PIN43_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN43_WAKEUP_ENABLE_LSB -#define GPIO_PIN43_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN43_WAKEUP_ENABLE_MASK -#define GPIO_PIN43_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN43_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN43_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN43_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN43_INT_TYPE_MSB WLAN_GPIO_PIN43_INT_TYPE_MSB -#define GPIO_PIN43_INT_TYPE_LSB WLAN_GPIO_PIN43_INT_TYPE_LSB -#define GPIO_PIN43_INT_TYPE_MASK WLAN_GPIO_PIN43_INT_TYPE_MASK -#define GPIO_PIN43_INT_TYPE_GET(x) WLAN_GPIO_PIN43_INT_TYPE_GET(x) -#define GPIO_PIN43_INT_TYPE_SET(x) WLAN_GPIO_PIN43_INT_TYPE_SET(x) -#define GPIO_PIN43_PAD_PULL_MSB WLAN_GPIO_PIN43_PAD_PULL_MSB -#define GPIO_PIN43_PAD_PULL_LSB WLAN_GPIO_PIN43_PAD_PULL_LSB -#define GPIO_PIN43_PAD_PULL_MASK WLAN_GPIO_PIN43_PAD_PULL_MASK -#define GPIO_PIN43_PAD_PULL_GET(x) WLAN_GPIO_PIN43_PAD_PULL_GET(x) -#define GPIO_PIN43_PAD_PULL_SET(x) WLAN_GPIO_PIN43_PAD_PULL_SET(x) -#define GPIO_PIN43_PAD_STRENGTH_MSB WLAN_GPIO_PIN43_PAD_STRENGTH_MSB -#define GPIO_PIN43_PAD_STRENGTH_LSB WLAN_GPIO_PIN43_PAD_STRENGTH_LSB -#define GPIO_PIN43_PAD_STRENGTH_MASK WLAN_GPIO_PIN43_PAD_STRENGTH_MASK -#define GPIO_PIN43_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN43_PAD_STRENGTH_GET(x) -#define GPIO_PIN43_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN43_PAD_STRENGTH_SET(x) -#define GPIO_PIN43_PAD_DRIVER_MSB WLAN_GPIO_PIN43_PAD_DRIVER_MSB -#define GPIO_PIN43_PAD_DRIVER_LSB WLAN_GPIO_PIN43_PAD_DRIVER_LSB -#define GPIO_PIN43_PAD_DRIVER_MASK WLAN_GPIO_PIN43_PAD_DRIVER_MASK -#define GPIO_PIN43_PAD_DRIVER_GET(x) WLAN_GPIO_PIN43_PAD_DRIVER_GET(x) -#define GPIO_PIN43_PAD_DRIVER_SET(x) WLAN_GPIO_PIN43_PAD_DRIVER_SET(x) -#define GPIO_PIN43_SOURCE_MSB WLAN_GPIO_PIN43_SOURCE_MSB -#define GPIO_PIN43_SOURCE_LSB WLAN_GPIO_PIN43_SOURCE_LSB -#define GPIO_PIN43_SOURCE_MASK WLAN_GPIO_PIN43_SOURCE_MASK -#define GPIO_PIN43_SOURCE_GET(x) WLAN_GPIO_PIN43_SOURCE_GET(x) -#define GPIO_PIN43_SOURCE_SET(x) WLAN_GPIO_PIN43_SOURCE_SET(x) -#define GPIO_PIN44_ADDRESS WLAN_GPIO_PIN44_ADDRESS -#define GPIO_PIN44_OFFSET WLAN_GPIO_PIN44_OFFSET -#define GPIO_PIN44_CONFIG_MSB WLAN_GPIO_PIN44_CONFIG_MSB -#define GPIO_PIN44_CONFIG_LSB WLAN_GPIO_PIN44_CONFIG_LSB -#define GPIO_PIN44_CONFIG_MASK WLAN_GPIO_PIN44_CONFIG_MASK -#define GPIO_PIN44_CONFIG_GET(x) WLAN_GPIO_PIN44_CONFIG_GET(x) -#define GPIO_PIN44_CONFIG_SET(x) WLAN_GPIO_PIN44_CONFIG_SET(x) -#define GPIO_PIN44_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN44_WAKEUP_ENABLE_MSB -#define GPIO_PIN44_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN44_WAKEUP_ENABLE_LSB -#define GPIO_PIN44_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN44_WAKEUP_ENABLE_MASK -#define GPIO_PIN44_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN44_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN44_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN44_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN44_INT_TYPE_MSB WLAN_GPIO_PIN44_INT_TYPE_MSB -#define GPIO_PIN44_INT_TYPE_LSB WLAN_GPIO_PIN44_INT_TYPE_LSB -#define GPIO_PIN44_INT_TYPE_MASK WLAN_GPIO_PIN44_INT_TYPE_MASK -#define GPIO_PIN44_INT_TYPE_GET(x) WLAN_GPIO_PIN44_INT_TYPE_GET(x) -#define GPIO_PIN44_INT_TYPE_SET(x) WLAN_GPIO_PIN44_INT_TYPE_SET(x) -#define GPIO_PIN44_PAD_PULL_MSB WLAN_GPIO_PIN44_PAD_PULL_MSB -#define GPIO_PIN44_PAD_PULL_LSB WLAN_GPIO_PIN44_PAD_PULL_LSB -#define GPIO_PIN44_PAD_PULL_MASK WLAN_GPIO_PIN44_PAD_PULL_MASK -#define GPIO_PIN44_PAD_PULL_GET(x) WLAN_GPIO_PIN44_PAD_PULL_GET(x) -#define GPIO_PIN44_PAD_PULL_SET(x) WLAN_GPIO_PIN44_PAD_PULL_SET(x) -#define GPIO_PIN44_PAD_STRENGTH_MSB WLAN_GPIO_PIN44_PAD_STRENGTH_MSB -#define GPIO_PIN44_PAD_STRENGTH_LSB WLAN_GPIO_PIN44_PAD_STRENGTH_LSB -#define GPIO_PIN44_PAD_STRENGTH_MASK WLAN_GPIO_PIN44_PAD_STRENGTH_MASK -#define GPIO_PIN44_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN44_PAD_STRENGTH_GET(x) -#define GPIO_PIN44_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN44_PAD_STRENGTH_SET(x) -#define GPIO_PIN44_PAD_DRIVER_MSB WLAN_GPIO_PIN44_PAD_DRIVER_MSB -#define GPIO_PIN44_PAD_DRIVER_LSB WLAN_GPIO_PIN44_PAD_DRIVER_LSB -#define GPIO_PIN44_PAD_DRIVER_MASK WLAN_GPIO_PIN44_PAD_DRIVER_MASK -#define GPIO_PIN44_PAD_DRIVER_GET(x) WLAN_GPIO_PIN44_PAD_DRIVER_GET(x) -#define GPIO_PIN44_PAD_DRIVER_SET(x) WLAN_GPIO_PIN44_PAD_DRIVER_SET(x) -#define GPIO_PIN44_SOURCE_MSB WLAN_GPIO_PIN44_SOURCE_MSB -#define GPIO_PIN44_SOURCE_LSB WLAN_GPIO_PIN44_SOURCE_LSB -#define GPIO_PIN44_SOURCE_MASK WLAN_GPIO_PIN44_SOURCE_MASK -#define GPIO_PIN44_SOURCE_GET(x) WLAN_GPIO_PIN44_SOURCE_GET(x) -#define GPIO_PIN44_SOURCE_SET(x) WLAN_GPIO_PIN44_SOURCE_SET(x) -#define GPIO_PIN45_ADDRESS WLAN_GPIO_PIN45_ADDRESS -#define GPIO_PIN45_OFFSET WLAN_GPIO_PIN45_OFFSET -#define GPIO_PIN45_CONFIG_MSB WLAN_GPIO_PIN45_CONFIG_MSB -#define GPIO_PIN45_CONFIG_LSB WLAN_GPIO_PIN45_CONFIG_LSB -#define GPIO_PIN45_CONFIG_MASK WLAN_GPIO_PIN45_CONFIG_MASK -#define GPIO_PIN45_CONFIG_GET(x) WLAN_GPIO_PIN45_CONFIG_GET(x) -#define GPIO_PIN45_CONFIG_SET(x) WLAN_GPIO_PIN45_CONFIG_SET(x) -#define GPIO_PIN45_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN45_WAKEUP_ENABLE_MSB -#define GPIO_PIN45_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN45_WAKEUP_ENABLE_LSB -#define GPIO_PIN45_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN45_WAKEUP_ENABLE_MASK -#define GPIO_PIN45_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN45_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN45_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN45_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN45_INT_TYPE_MSB WLAN_GPIO_PIN45_INT_TYPE_MSB -#define GPIO_PIN45_INT_TYPE_LSB WLAN_GPIO_PIN45_INT_TYPE_LSB -#define GPIO_PIN45_INT_TYPE_MASK WLAN_GPIO_PIN45_INT_TYPE_MASK -#define GPIO_PIN45_INT_TYPE_GET(x) WLAN_GPIO_PIN45_INT_TYPE_GET(x) -#define GPIO_PIN45_INT_TYPE_SET(x) WLAN_GPIO_PIN45_INT_TYPE_SET(x) -#define GPIO_PIN45_PAD_PULL_MSB WLAN_GPIO_PIN45_PAD_PULL_MSB -#define GPIO_PIN45_PAD_PULL_LSB WLAN_GPIO_PIN45_PAD_PULL_LSB -#define GPIO_PIN45_PAD_PULL_MASK WLAN_GPIO_PIN45_PAD_PULL_MASK -#define GPIO_PIN45_PAD_PULL_GET(x) WLAN_GPIO_PIN45_PAD_PULL_GET(x) -#define GPIO_PIN45_PAD_PULL_SET(x) WLAN_GPIO_PIN45_PAD_PULL_SET(x) -#define GPIO_PIN45_PAD_STRENGTH_MSB WLAN_GPIO_PIN45_PAD_STRENGTH_MSB -#define GPIO_PIN45_PAD_STRENGTH_LSB WLAN_GPIO_PIN45_PAD_STRENGTH_LSB -#define GPIO_PIN45_PAD_STRENGTH_MASK WLAN_GPIO_PIN45_PAD_STRENGTH_MASK -#define GPIO_PIN45_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN45_PAD_STRENGTH_GET(x) -#define GPIO_PIN45_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN45_PAD_STRENGTH_SET(x) -#define GPIO_PIN45_PAD_DRIVER_MSB WLAN_GPIO_PIN45_PAD_DRIVER_MSB -#define GPIO_PIN45_PAD_DRIVER_LSB WLAN_GPIO_PIN45_PAD_DRIVER_LSB -#define GPIO_PIN45_PAD_DRIVER_MASK WLAN_GPIO_PIN45_PAD_DRIVER_MASK -#define GPIO_PIN45_PAD_DRIVER_GET(x) WLAN_GPIO_PIN45_PAD_DRIVER_GET(x) -#define GPIO_PIN45_PAD_DRIVER_SET(x) WLAN_GPIO_PIN45_PAD_DRIVER_SET(x) -#define GPIO_PIN45_SOURCE_MSB WLAN_GPIO_PIN45_SOURCE_MSB -#define GPIO_PIN45_SOURCE_LSB WLAN_GPIO_PIN45_SOURCE_LSB -#define GPIO_PIN45_SOURCE_MASK WLAN_GPIO_PIN45_SOURCE_MASK -#define GPIO_PIN45_SOURCE_GET(x) WLAN_GPIO_PIN45_SOURCE_GET(x) -#define GPIO_PIN45_SOURCE_SET(x) WLAN_GPIO_PIN45_SOURCE_SET(x) -#define GPIO_PIN46_ADDRESS WLAN_GPIO_PIN46_ADDRESS -#define GPIO_PIN46_OFFSET WLAN_GPIO_PIN46_OFFSET -#define GPIO_PIN46_CONFIG_MSB WLAN_GPIO_PIN46_CONFIG_MSB -#define GPIO_PIN46_CONFIG_LSB WLAN_GPIO_PIN46_CONFIG_LSB -#define GPIO_PIN46_CONFIG_MASK WLAN_GPIO_PIN46_CONFIG_MASK -#define GPIO_PIN46_CONFIG_GET(x) WLAN_GPIO_PIN46_CONFIG_GET(x) -#define GPIO_PIN46_CONFIG_SET(x) WLAN_GPIO_PIN46_CONFIG_SET(x) -#define GPIO_PIN46_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN46_WAKEUP_ENABLE_MSB -#define GPIO_PIN46_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN46_WAKEUP_ENABLE_LSB -#define GPIO_PIN46_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN46_WAKEUP_ENABLE_MASK -#define GPIO_PIN46_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN46_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN46_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN46_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN46_INT_TYPE_MSB WLAN_GPIO_PIN46_INT_TYPE_MSB -#define GPIO_PIN46_INT_TYPE_LSB WLAN_GPIO_PIN46_INT_TYPE_LSB -#define GPIO_PIN46_INT_TYPE_MASK WLAN_GPIO_PIN46_INT_TYPE_MASK -#define GPIO_PIN46_INT_TYPE_GET(x) WLAN_GPIO_PIN46_INT_TYPE_GET(x) -#define GPIO_PIN46_INT_TYPE_SET(x) WLAN_GPIO_PIN46_INT_TYPE_SET(x) -#define GPIO_PIN46_PAD_PULL_MSB WLAN_GPIO_PIN46_PAD_PULL_MSB -#define GPIO_PIN46_PAD_PULL_LSB WLAN_GPIO_PIN46_PAD_PULL_LSB -#define GPIO_PIN46_PAD_PULL_MASK WLAN_GPIO_PIN46_PAD_PULL_MASK -#define GPIO_PIN46_PAD_PULL_GET(x) WLAN_GPIO_PIN46_PAD_PULL_GET(x) -#define GPIO_PIN46_PAD_PULL_SET(x) WLAN_GPIO_PIN46_PAD_PULL_SET(x) -#define GPIO_PIN46_PAD_STRENGTH_MSB WLAN_GPIO_PIN46_PAD_STRENGTH_MSB -#define GPIO_PIN46_PAD_STRENGTH_LSB WLAN_GPIO_PIN46_PAD_STRENGTH_LSB -#define GPIO_PIN46_PAD_STRENGTH_MASK WLAN_GPIO_PIN46_PAD_STRENGTH_MASK -#define GPIO_PIN46_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN46_PAD_STRENGTH_GET(x) -#define GPIO_PIN46_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN46_PAD_STRENGTH_SET(x) -#define GPIO_PIN46_PAD_DRIVER_MSB WLAN_GPIO_PIN46_PAD_DRIVER_MSB -#define GPIO_PIN46_PAD_DRIVER_LSB WLAN_GPIO_PIN46_PAD_DRIVER_LSB -#define GPIO_PIN46_PAD_DRIVER_MASK WLAN_GPIO_PIN46_PAD_DRIVER_MASK -#define GPIO_PIN46_PAD_DRIVER_GET(x) WLAN_GPIO_PIN46_PAD_DRIVER_GET(x) -#define GPIO_PIN46_PAD_DRIVER_SET(x) WLAN_GPIO_PIN46_PAD_DRIVER_SET(x) -#define GPIO_PIN46_SOURCE_MSB WLAN_GPIO_PIN46_SOURCE_MSB -#define GPIO_PIN46_SOURCE_LSB WLAN_GPIO_PIN46_SOURCE_LSB -#define GPIO_PIN46_SOURCE_MASK WLAN_GPIO_PIN46_SOURCE_MASK -#define GPIO_PIN46_SOURCE_GET(x) WLAN_GPIO_PIN46_SOURCE_GET(x) -#define GPIO_PIN46_SOURCE_SET(x) WLAN_GPIO_PIN46_SOURCE_SET(x) -#define GPIO_PIN47_ADDRESS WLAN_GPIO_PIN47_ADDRESS -#define GPIO_PIN47_OFFSET WLAN_GPIO_PIN47_OFFSET -#define GPIO_PIN47_CONFIG_MSB WLAN_GPIO_PIN47_CONFIG_MSB -#define GPIO_PIN47_CONFIG_LSB WLAN_GPIO_PIN47_CONFIG_LSB -#define GPIO_PIN47_CONFIG_MASK WLAN_GPIO_PIN47_CONFIG_MASK -#define GPIO_PIN47_CONFIG_GET(x) WLAN_GPIO_PIN47_CONFIG_GET(x) -#define GPIO_PIN47_CONFIG_SET(x) WLAN_GPIO_PIN47_CONFIG_SET(x) -#define GPIO_PIN47_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN47_WAKEUP_ENABLE_MSB -#define GPIO_PIN47_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN47_WAKEUP_ENABLE_LSB -#define GPIO_PIN47_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN47_WAKEUP_ENABLE_MASK -#define GPIO_PIN47_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN47_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN47_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN47_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN47_INT_TYPE_MSB WLAN_GPIO_PIN47_INT_TYPE_MSB -#define GPIO_PIN47_INT_TYPE_LSB WLAN_GPIO_PIN47_INT_TYPE_LSB -#define GPIO_PIN47_INT_TYPE_MASK WLAN_GPIO_PIN47_INT_TYPE_MASK -#define GPIO_PIN47_INT_TYPE_GET(x) WLAN_GPIO_PIN47_INT_TYPE_GET(x) -#define GPIO_PIN47_INT_TYPE_SET(x) WLAN_GPIO_PIN47_INT_TYPE_SET(x) -#define GPIO_PIN47_PAD_PULL_MSB WLAN_GPIO_PIN47_PAD_PULL_MSB -#define GPIO_PIN47_PAD_PULL_LSB WLAN_GPIO_PIN47_PAD_PULL_LSB -#define GPIO_PIN47_PAD_PULL_MASK WLAN_GPIO_PIN47_PAD_PULL_MASK -#define GPIO_PIN47_PAD_PULL_GET(x) WLAN_GPIO_PIN47_PAD_PULL_GET(x) -#define GPIO_PIN47_PAD_PULL_SET(x) WLAN_GPIO_PIN47_PAD_PULL_SET(x) -#define GPIO_PIN47_PAD_STRENGTH_MSB WLAN_GPIO_PIN47_PAD_STRENGTH_MSB -#define GPIO_PIN47_PAD_STRENGTH_LSB WLAN_GPIO_PIN47_PAD_STRENGTH_LSB -#define GPIO_PIN47_PAD_STRENGTH_MASK WLAN_GPIO_PIN47_PAD_STRENGTH_MASK -#define GPIO_PIN47_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN47_PAD_STRENGTH_GET(x) -#define GPIO_PIN47_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN47_PAD_STRENGTH_SET(x) -#define GPIO_PIN47_PAD_DRIVER_MSB WLAN_GPIO_PIN47_PAD_DRIVER_MSB -#define GPIO_PIN47_PAD_DRIVER_LSB WLAN_GPIO_PIN47_PAD_DRIVER_LSB -#define GPIO_PIN47_PAD_DRIVER_MASK WLAN_GPIO_PIN47_PAD_DRIVER_MASK -#define GPIO_PIN47_PAD_DRIVER_GET(x) WLAN_GPIO_PIN47_PAD_DRIVER_GET(x) -#define GPIO_PIN47_PAD_DRIVER_SET(x) WLAN_GPIO_PIN47_PAD_DRIVER_SET(x) -#define GPIO_PIN47_SOURCE_MSB WLAN_GPIO_PIN47_SOURCE_MSB -#define GPIO_PIN47_SOURCE_LSB WLAN_GPIO_PIN47_SOURCE_LSB -#define GPIO_PIN47_SOURCE_MASK WLAN_GPIO_PIN47_SOURCE_MASK -#define GPIO_PIN47_SOURCE_GET(x) WLAN_GPIO_PIN47_SOURCE_GET(x) -#define GPIO_PIN47_SOURCE_SET(x) WLAN_GPIO_PIN47_SOURCE_SET(x) -#define GPIO_PIN48_ADDRESS WLAN_GPIO_PIN48_ADDRESS -#define GPIO_PIN48_OFFSET WLAN_GPIO_PIN48_OFFSET -#define GPIO_PIN48_CONFIG_MSB WLAN_GPIO_PIN48_CONFIG_MSB -#define GPIO_PIN48_CONFIG_LSB WLAN_GPIO_PIN48_CONFIG_LSB -#define GPIO_PIN48_CONFIG_MASK WLAN_GPIO_PIN48_CONFIG_MASK -#define GPIO_PIN48_CONFIG_GET(x) WLAN_GPIO_PIN48_CONFIG_GET(x) -#define GPIO_PIN48_CONFIG_SET(x) WLAN_GPIO_PIN48_CONFIG_SET(x) -#define GPIO_PIN48_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN48_WAKEUP_ENABLE_MSB -#define GPIO_PIN48_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN48_WAKEUP_ENABLE_LSB -#define GPIO_PIN48_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN48_WAKEUP_ENABLE_MASK -#define GPIO_PIN48_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN48_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN48_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN48_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN48_INT_TYPE_MSB WLAN_GPIO_PIN48_INT_TYPE_MSB -#define GPIO_PIN48_INT_TYPE_LSB WLAN_GPIO_PIN48_INT_TYPE_LSB -#define GPIO_PIN48_INT_TYPE_MASK WLAN_GPIO_PIN48_INT_TYPE_MASK -#define GPIO_PIN48_INT_TYPE_GET(x) WLAN_GPIO_PIN48_INT_TYPE_GET(x) -#define GPIO_PIN48_INT_TYPE_SET(x) WLAN_GPIO_PIN48_INT_TYPE_SET(x) -#define GPIO_PIN48_PAD_PULL_MSB WLAN_GPIO_PIN48_PAD_PULL_MSB -#define GPIO_PIN48_PAD_PULL_LSB WLAN_GPIO_PIN48_PAD_PULL_LSB -#define GPIO_PIN48_PAD_PULL_MASK WLAN_GPIO_PIN48_PAD_PULL_MASK -#define GPIO_PIN48_PAD_PULL_GET(x) WLAN_GPIO_PIN48_PAD_PULL_GET(x) -#define GPIO_PIN48_PAD_PULL_SET(x) WLAN_GPIO_PIN48_PAD_PULL_SET(x) -#define GPIO_PIN48_PAD_STRENGTH_MSB WLAN_GPIO_PIN48_PAD_STRENGTH_MSB -#define GPIO_PIN48_PAD_STRENGTH_LSB WLAN_GPIO_PIN48_PAD_STRENGTH_LSB -#define GPIO_PIN48_PAD_STRENGTH_MASK WLAN_GPIO_PIN48_PAD_STRENGTH_MASK -#define GPIO_PIN48_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN48_PAD_STRENGTH_GET(x) -#define GPIO_PIN48_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN48_PAD_STRENGTH_SET(x) -#define GPIO_PIN48_PAD_DRIVER_MSB WLAN_GPIO_PIN48_PAD_DRIVER_MSB -#define GPIO_PIN48_PAD_DRIVER_LSB WLAN_GPIO_PIN48_PAD_DRIVER_LSB -#define GPIO_PIN48_PAD_DRIVER_MASK WLAN_GPIO_PIN48_PAD_DRIVER_MASK -#define GPIO_PIN48_PAD_DRIVER_GET(x) WLAN_GPIO_PIN48_PAD_DRIVER_GET(x) -#define GPIO_PIN48_PAD_DRIVER_SET(x) WLAN_GPIO_PIN48_PAD_DRIVER_SET(x) -#define GPIO_PIN48_SOURCE_MSB WLAN_GPIO_PIN48_SOURCE_MSB -#define GPIO_PIN48_SOURCE_LSB WLAN_GPIO_PIN48_SOURCE_LSB -#define GPIO_PIN48_SOURCE_MASK WLAN_GPIO_PIN48_SOURCE_MASK -#define GPIO_PIN48_SOURCE_GET(x) WLAN_GPIO_PIN48_SOURCE_GET(x) -#define GPIO_PIN48_SOURCE_SET(x) WLAN_GPIO_PIN48_SOURCE_SET(x) -#define GPIO_PIN49_ADDRESS WLAN_GPIO_PIN49_ADDRESS -#define GPIO_PIN49_OFFSET WLAN_GPIO_PIN49_OFFSET -#define GPIO_PIN49_CONFIG_MSB WLAN_GPIO_PIN49_CONFIG_MSB -#define GPIO_PIN49_CONFIG_LSB WLAN_GPIO_PIN49_CONFIG_LSB -#define GPIO_PIN49_CONFIG_MASK WLAN_GPIO_PIN49_CONFIG_MASK -#define GPIO_PIN49_CONFIG_GET(x) WLAN_GPIO_PIN49_CONFIG_GET(x) -#define GPIO_PIN49_CONFIG_SET(x) WLAN_GPIO_PIN49_CONFIG_SET(x) -#define GPIO_PIN49_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN49_WAKEUP_ENABLE_MSB -#define GPIO_PIN49_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN49_WAKEUP_ENABLE_LSB -#define GPIO_PIN49_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN49_WAKEUP_ENABLE_MASK -#define GPIO_PIN49_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN49_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN49_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN49_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN49_INT_TYPE_MSB WLAN_GPIO_PIN49_INT_TYPE_MSB -#define GPIO_PIN49_INT_TYPE_LSB WLAN_GPIO_PIN49_INT_TYPE_LSB -#define GPIO_PIN49_INT_TYPE_MASK WLAN_GPIO_PIN49_INT_TYPE_MASK -#define GPIO_PIN49_INT_TYPE_GET(x) WLAN_GPIO_PIN49_INT_TYPE_GET(x) -#define GPIO_PIN49_INT_TYPE_SET(x) WLAN_GPIO_PIN49_INT_TYPE_SET(x) -#define GPIO_PIN49_PAD_PULL_MSB WLAN_GPIO_PIN49_PAD_PULL_MSB -#define GPIO_PIN49_PAD_PULL_LSB WLAN_GPIO_PIN49_PAD_PULL_LSB -#define GPIO_PIN49_PAD_PULL_MASK WLAN_GPIO_PIN49_PAD_PULL_MASK -#define GPIO_PIN49_PAD_PULL_GET(x) WLAN_GPIO_PIN49_PAD_PULL_GET(x) -#define GPIO_PIN49_PAD_PULL_SET(x) WLAN_GPIO_PIN49_PAD_PULL_SET(x) -#define GPIO_PIN49_PAD_STRENGTH_MSB WLAN_GPIO_PIN49_PAD_STRENGTH_MSB -#define GPIO_PIN49_PAD_STRENGTH_LSB WLAN_GPIO_PIN49_PAD_STRENGTH_LSB -#define GPIO_PIN49_PAD_STRENGTH_MASK WLAN_GPIO_PIN49_PAD_STRENGTH_MASK -#define GPIO_PIN49_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN49_PAD_STRENGTH_GET(x) -#define GPIO_PIN49_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN49_PAD_STRENGTH_SET(x) -#define GPIO_PIN49_PAD_DRIVER_MSB WLAN_GPIO_PIN49_PAD_DRIVER_MSB -#define GPIO_PIN49_PAD_DRIVER_LSB WLAN_GPIO_PIN49_PAD_DRIVER_LSB -#define GPIO_PIN49_PAD_DRIVER_MASK WLAN_GPIO_PIN49_PAD_DRIVER_MASK -#define GPIO_PIN49_PAD_DRIVER_GET(x) WLAN_GPIO_PIN49_PAD_DRIVER_GET(x) -#define GPIO_PIN49_PAD_DRIVER_SET(x) WLAN_GPIO_PIN49_PAD_DRIVER_SET(x) -#define GPIO_PIN49_SOURCE_MSB WLAN_GPIO_PIN49_SOURCE_MSB -#define GPIO_PIN49_SOURCE_LSB WLAN_GPIO_PIN49_SOURCE_LSB -#define GPIO_PIN49_SOURCE_MASK WLAN_GPIO_PIN49_SOURCE_MASK -#define GPIO_PIN49_SOURCE_GET(x) WLAN_GPIO_PIN49_SOURCE_GET(x) -#define GPIO_PIN49_SOURCE_SET(x) WLAN_GPIO_PIN49_SOURCE_SET(x) -#define GPIO_PIN50_ADDRESS WLAN_GPIO_PIN50_ADDRESS -#define GPIO_PIN50_OFFSET WLAN_GPIO_PIN50_OFFSET -#define GPIO_PIN50_CONFIG_MSB WLAN_GPIO_PIN50_CONFIG_MSB -#define GPIO_PIN50_CONFIG_LSB WLAN_GPIO_PIN50_CONFIG_LSB -#define GPIO_PIN50_CONFIG_MASK WLAN_GPIO_PIN50_CONFIG_MASK -#define GPIO_PIN50_CONFIG_GET(x) WLAN_GPIO_PIN50_CONFIG_GET(x) -#define GPIO_PIN50_CONFIG_SET(x) WLAN_GPIO_PIN50_CONFIG_SET(x) -#define GPIO_PIN50_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN50_WAKEUP_ENABLE_MSB -#define GPIO_PIN50_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN50_WAKEUP_ENABLE_LSB -#define GPIO_PIN50_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN50_WAKEUP_ENABLE_MASK -#define GPIO_PIN50_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN50_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN50_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN50_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN50_INT_TYPE_MSB WLAN_GPIO_PIN50_INT_TYPE_MSB -#define GPIO_PIN50_INT_TYPE_LSB WLAN_GPIO_PIN50_INT_TYPE_LSB -#define GPIO_PIN50_INT_TYPE_MASK WLAN_GPIO_PIN50_INT_TYPE_MASK -#define GPIO_PIN50_INT_TYPE_GET(x) WLAN_GPIO_PIN50_INT_TYPE_GET(x) -#define GPIO_PIN50_INT_TYPE_SET(x) WLAN_GPIO_PIN50_INT_TYPE_SET(x) -#define GPIO_PIN50_PAD_PULL_MSB WLAN_GPIO_PIN50_PAD_PULL_MSB -#define GPIO_PIN50_PAD_PULL_LSB WLAN_GPIO_PIN50_PAD_PULL_LSB -#define GPIO_PIN50_PAD_PULL_MASK WLAN_GPIO_PIN50_PAD_PULL_MASK -#define GPIO_PIN50_PAD_PULL_GET(x) WLAN_GPIO_PIN50_PAD_PULL_GET(x) -#define GPIO_PIN50_PAD_PULL_SET(x) WLAN_GPIO_PIN50_PAD_PULL_SET(x) -#define GPIO_PIN50_PAD_STRENGTH_MSB WLAN_GPIO_PIN50_PAD_STRENGTH_MSB -#define GPIO_PIN50_PAD_STRENGTH_LSB WLAN_GPIO_PIN50_PAD_STRENGTH_LSB -#define GPIO_PIN50_PAD_STRENGTH_MASK WLAN_GPIO_PIN50_PAD_STRENGTH_MASK -#define GPIO_PIN50_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN50_PAD_STRENGTH_GET(x) -#define GPIO_PIN50_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN50_PAD_STRENGTH_SET(x) -#define GPIO_PIN50_PAD_DRIVER_MSB WLAN_GPIO_PIN50_PAD_DRIVER_MSB -#define GPIO_PIN50_PAD_DRIVER_LSB WLAN_GPIO_PIN50_PAD_DRIVER_LSB -#define GPIO_PIN50_PAD_DRIVER_MASK WLAN_GPIO_PIN50_PAD_DRIVER_MASK -#define GPIO_PIN50_PAD_DRIVER_GET(x) WLAN_GPIO_PIN50_PAD_DRIVER_GET(x) -#define GPIO_PIN50_PAD_DRIVER_SET(x) WLAN_GPIO_PIN50_PAD_DRIVER_SET(x) -#define GPIO_PIN50_SOURCE_MSB WLAN_GPIO_PIN50_SOURCE_MSB -#define GPIO_PIN50_SOURCE_LSB WLAN_GPIO_PIN50_SOURCE_LSB -#define GPIO_PIN50_SOURCE_MASK WLAN_GPIO_PIN50_SOURCE_MASK -#define GPIO_PIN50_SOURCE_GET(x) WLAN_GPIO_PIN50_SOURCE_GET(x) -#define GPIO_PIN50_SOURCE_SET(x) WLAN_GPIO_PIN50_SOURCE_SET(x) -#define GPIO_PIN51_ADDRESS WLAN_GPIO_PIN51_ADDRESS -#define GPIO_PIN51_OFFSET WLAN_GPIO_PIN51_OFFSET -#define GPIO_PIN51_CONFIG_MSB WLAN_GPIO_PIN51_CONFIG_MSB -#define GPIO_PIN51_CONFIG_LSB WLAN_GPIO_PIN51_CONFIG_LSB -#define GPIO_PIN51_CONFIG_MASK WLAN_GPIO_PIN51_CONFIG_MASK -#define GPIO_PIN51_CONFIG_GET(x) WLAN_GPIO_PIN51_CONFIG_GET(x) -#define GPIO_PIN51_CONFIG_SET(x) WLAN_GPIO_PIN51_CONFIG_SET(x) -#define GPIO_PIN51_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN51_WAKEUP_ENABLE_MSB -#define GPIO_PIN51_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN51_WAKEUP_ENABLE_LSB -#define GPIO_PIN51_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN51_WAKEUP_ENABLE_MASK -#define GPIO_PIN51_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN51_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN51_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN51_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN51_INT_TYPE_MSB WLAN_GPIO_PIN51_INT_TYPE_MSB -#define GPIO_PIN51_INT_TYPE_LSB WLAN_GPIO_PIN51_INT_TYPE_LSB -#define GPIO_PIN51_INT_TYPE_MASK WLAN_GPIO_PIN51_INT_TYPE_MASK -#define GPIO_PIN51_INT_TYPE_GET(x) WLAN_GPIO_PIN51_INT_TYPE_GET(x) -#define GPIO_PIN51_INT_TYPE_SET(x) WLAN_GPIO_PIN51_INT_TYPE_SET(x) -#define GPIO_PIN51_PAD_PULL_MSB WLAN_GPIO_PIN51_PAD_PULL_MSB -#define GPIO_PIN51_PAD_PULL_LSB WLAN_GPIO_PIN51_PAD_PULL_LSB -#define GPIO_PIN51_PAD_PULL_MASK WLAN_GPIO_PIN51_PAD_PULL_MASK -#define GPIO_PIN51_PAD_PULL_GET(x) WLAN_GPIO_PIN51_PAD_PULL_GET(x) -#define GPIO_PIN51_PAD_PULL_SET(x) WLAN_GPIO_PIN51_PAD_PULL_SET(x) -#define GPIO_PIN51_PAD_STRENGTH_MSB WLAN_GPIO_PIN51_PAD_STRENGTH_MSB -#define GPIO_PIN51_PAD_STRENGTH_LSB WLAN_GPIO_PIN51_PAD_STRENGTH_LSB -#define GPIO_PIN51_PAD_STRENGTH_MASK WLAN_GPIO_PIN51_PAD_STRENGTH_MASK -#define GPIO_PIN51_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN51_PAD_STRENGTH_GET(x) -#define GPIO_PIN51_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN51_PAD_STRENGTH_SET(x) -#define GPIO_PIN51_PAD_DRIVER_MSB WLAN_GPIO_PIN51_PAD_DRIVER_MSB -#define GPIO_PIN51_PAD_DRIVER_LSB WLAN_GPIO_PIN51_PAD_DRIVER_LSB -#define GPIO_PIN51_PAD_DRIVER_MASK WLAN_GPIO_PIN51_PAD_DRIVER_MASK -#define GPIO_PIN51_PAD_DRIVER_GET(x) WLAN_GPIO_PIN51_PAD_DRIVER_GET(x) -#define GPIO_PIN51_PAD_DRIVER_SET(x) WLAN_GPIO_PIN51_PAD_DRIVER_SET(x) -#define GPIO_PIN51_SOURCE_MSB WLAN_GPIO_PIN51_SOURCE_MSB -#define GPIO_PIN51_SOURCE_LSB WLAN_GPIO_PIN51_SOURCE_LSB -#define GPIO_PIN51_SOURCE_MASK WLAN_GPIO_PIN51_SOURCE_MASK -#define GPIO_PIN51_SOURCE_GET(x) WLAN_GPIO_PIN51_SOURCE_GET(x) -#define GPIO_PIN51_SOURCE_SET(x) WLAN_GPIO_PIN51_SOURCE_SET(x) -#define GPIO_PIN52_ADDRESS WLAN_GPIO_PIN52_ADDRESS -#define GPIO_PIN52_OFFSET WLAN_GPIO_PIN52_OFFSET -#define GPIO_PIN52_CONFIG_MSB WLAN_GPIO_PIN52_CONFIG_MSB -#define GPIO_PIN52_CONFIG_LSB WLAN_GPIO_PIN52_CONFIG_LSB -#define GPIO_PIN52_CONFIG_MASK WLAN_GPIO_PIN52_CONFIG_MASK -#define GPIO_PIN52_CONFIG_GET(x) WLAN_GPIO_PIN52_CONFIG_GET(x) -#define GPIO_PIN52_CONFIG_SET(x) WLAN_GPIO_PIN52_CONFIG_SET(x) -#define GPIO_PIN52_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN52_WAKEUP_ENABLE_MSB -#define GPIO_PIN52_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN52_WAKEUP_ENABLE_LSB -#define GPIO_PIN52_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN52_WAKEUP_ENABLE_MASK -#define GPIO_PIN52_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN52_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN52_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN52_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN52_INT_TYPE_MSB WLAN_GPIO_PIN52_INT_TYPE_MSB -#define GPIO_PIN52_INT_TYPE_LSB WLAN_GPIO_PIN52_INT_TYPE_LSB -#define GPIO_PIN52_INT_TYPE_MASK WLAN_GPIO_PIN52_INT_TYPE_MASK -#define GPIO_PIN52_INT_TYPE_GET(x) WLAN_GPIO_PIN52_INT_TYPE_GET(x) -#define GPIO_PIN52_INT_TYPE_SET(x) WLAN_GPIO_PIN52_INT_TYPE_SET(x) -#define GPIO_PIN52_PAD_PULL_MSB WLAN_GPIO_PIN52_PAD_PULL_MSB -#define GPIO_PIN52_PAD_PULL_LSB WLAN_GPIO_PIN52_PAD_PULL_LSB -#define GPIO_PIN52_PAD_PULL_MASK WLAN_GPIO_PIN52_PAD_PULL_MASK -#define GPIO_PIN52_PAD_PULL_GET(x) WLAN_GPIO_PIN52_PAD_PULL_GET(x) -#define GPIO_PIN52_PAD_PULL_SET(x) WLAN_GPIO_PIN52_PAD_PULL_SET(x) -#define GPIO_PIN52_PAD_STRENGTH_MSB WLAN_GPIO_PIN52_PAD_STRENGTH_MSB -#define GPIO_PIN52_PAD_STRENGTH_LSB WLAN_GPIO_PIN52_PAD_STRENGTH_LSB -#define GPIO_PIN52_PAD_STRENGTH_MASK WLAN_GPIO_PIN52_PAD_STRENGTH_MASK -#define GPIO_PIN52_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN52_PAD_STRENGTH_GET(x) -#define GPIO_PIN52_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN52_PAD_STRENGTH_SET(x) -#define GPIO_PIN52_PAD_DRIVER_MSB WLAN_GPIO_PIN52_PAD_DRIVER_MSB -#define GPIO_PIN52_PAD_DRIVER_LSB WLAN_GPIO_PIN52_PAD_DRIVER_LSB -#define GPIO_PIN52_PAD_DRIVER_MASK WLAN_GPIO_PIN52_PAD_DRIVER_MASK -#define GPIO_PIN52_PAD_DRIVER_GET(x) WLAN_GPIO_PIN52_PAD_DRIVER_GET(x) -#define GPIO_PIN52_PAD_DRIVER_SET(x) WLAN_GPIO_PIN52_PAD_DRIVER_SET(x) -#define GPIO_PIN52_SOURCE_MSB WLAN_GPIO_PIN52_SOURCE_MSB -#define GPIO_PIN52_SOURCE_LSB WLAN_GPIO_PIN52_SOURCE_LSB -#define GPIO_PIN52_SOURCE_MASK WLAN_GPIO_PIN52_SOURCE_MASK -#define GPIO_PIN52_SOURCE_GET(x) WLAN_GPIO_PIN52_SOURCE_GET(x) -#define GPIO_PIN52_SOURCE_SET(x) WLAN_GPIO_PIN52_SOURCE_SET(x) -#define GPIO_PIN53_ADDRESS WLAN_GPIO_PIN53_ADDRESS -#define GPIO_PIN53_OFFSET WLAN_GPIO_PIN53_OFFSET -#define GPIO_PIN53_CONFIG_MSB WLAN_GPIO_PIN53_CONFIG_MSB -#define GPIO_PIN53_CONFIG_LSB WLAN_GPIO_PIN53_CONFIG_LSB -#define GPIO_PIN53_CONFIG_MASK WLAN_GPIO_PIN53_CONFIG_MASK -#define GPIO_PIN53_CONFIG_GET(x) WLAN_GPIO_PIN53_CONFIG_GET(x) -#define GPIO_PIN53_CONFIG_SET(x) WLAN_GPIO_PIN53_CONFIG_SET(x) -#define GPIO_PIN53_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN53_WAKEUP_ENABLE_MSB -#define GPIO_PIN53_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN53_WAKEUP_ENABLE_LSB -#define GPIO_PIN53_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN53_WAKEUP_ENABLE_MASK -#define GPIO_PIN53_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN53_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN53_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN53_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN53_INT_TYPE_MSB WLAN_GPIO_PIN53_INT_TYPE_MSB -#define GPIO_PIN53_INT_TYPE_LSB WLAN_GPIO_PIN53_INT_TYPE_LSB -#define GPIO_PIN53_INT_TYPE_MASK WLAN_GPIO_PIN53_INT_TYPE_MASK -#define GPIO_PIN53_INT_TYPE_GET(x) WLAN_GPIO_PIN53_INT_TYPE_GET(x) -#define GPIO_PIN53_INT_TYPE_SET(x) WLAN_GPIO_PIN53_INT_TYPE_SET(x) -#define GPIO_PIN53_PAD_PULL_MSB WLAN_GPIO_PIN53_PAD_PULL_MSB -#define GPIO_PIN53_PAD_PULL_LSB WLAN_GPIO_PIN53_PAD_PULL_LSB -#define GPIO_PIN53_PAD_PULL_MASK WLAN_GPIO_PIN53_PAD_PULL_MASK -#define GPIO_PIN53_PAD_PULL_GET(x) WLAN_GPIO_PIN53_PAD_PULL_GET(x) -#define GPIO_PIN53_PAD_PULL_SET(x) WLAN_GPIO_PIN53_PAD_PULL_SET(x) -#define GPIO_PIN53_PAD_STRENGTH_MSB WLAN_GPIO_PIN53_PAD_STRENGTH_MSB -#define GPIO_PIN53_PAD_STRENGTH_LSB WLAN_GPIO_PIN53_PAD_STRENGTH_LSB -#define GPIO_PIN53_PAD_STRENGTH_MASK WLAN_GPIO_PIN53_PAD_STRENGTH_MASK -#define GPIO_PIN53_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN53_PAD_STRENGTH_GET(x) -#define GPIO_PIN53_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN53_PAD_STRENGTH_SET(x) -#define GPIO_PIN53_PAD_DRIVER_MSB WLAN_GPIO_PIN53_PAD_DRIVER_MSB -#define GPIO_PIN53_PAD_DRIVER_LSB WLAN_GPIO_PIN53_PAD_DRIVER_LSB -#define GPIO_PIN53_PAD_DRIVER_MASK WLAN_GPIO_PIN53_PAD_DRIVER_MASK -#define GPIO_PIN53_PAD_DRIVER_GET(x) WLAN_GPIO_PIN53_PAD_DRIVER_GET(x) -#define GPIO_PIN53_PAD_DRIVER_SET(x) WLAN_GPIO_PIN53_PAD_DRIVER_SET(x) -#define GPIO_PIN53_SOURCE_MSB WLAN_GPIO_PIN53_SOURCE_MSB -#define GPIO_PIN53_SOURCE_LSB WLAN_GPIO_PIN53_SOURCE_LSB -#define GPIO_PIN53_SOURCE_MASK WLAN_GPIO_PIN53_SOURCE_MASK -#define GPIO_PIN53_SOURCE_GET(x) WLAN_GPIO_PIN53_SOURCE_GET(x) -#define GPIO_PIN53_SOURCE_SET(x) WLAN_GPIO_PIN53_SOURCE_SET(x) -#define GPIO_PIN54_ADDRESS WLAN_GPIO_PIN54_ADDRESS -#define GPIO_PIN54_OFFSET WLAN_GPIO_PIN54_OFFSET -#define GPIO_PIN54_CONFIG_MSB WLAN_GPIO_PIN54_CONFIG_MSB -#define GPIO_PIN54_CONFIG_LSB WLAN_GPIO_PIN54_CONFIG_LSB -#define GPIO_PIN54_CONFIG_MASK WLAN_GPIO_PIN54_CONFIG_MASK -#define GPIO_PIN54_CONFIG_GET(x) WLAN_GPIO_PIN54_CONFIG_GET(x) -#define GPIO_PIN54_CONFIG_SET(x) WLAN_GPIO_PIN54_CONFIG_SET(x) -#define GPIO_PIN54_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN54_WAKEUP_ENABLE_MSB -#define GPIO_PIN54_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN54_WAKEUP_ENABLE_LSB -#define GPIO_PIN54_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN54_WAKEUP_ENABLE_MASK -#define GPIO_PIN54_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN54_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN54_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN54_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN54_INT_TYPE_MSB WLAN_GPIO_PIN54_INT_TYPE_MSB -#define GPIO_PIN54_INT_TYPE_LSB WLAN_GPIO_PIN54_INT_TYPE_LSB -#define GPIO_PIN54_INT_TYPE_MASK WLAN_GPIO_PIN54_INT_TYPE_MASK -#define GPIO_PIN54_INT_TYPE_GET(x) WLAN_GPIO_PIN54_INT_TYPE_GET(x) -#define GPIO_PIN54_INT_TYPE_SET(x) WLAN_GPIO_PIN54_INT_TYPE_SET(x) -#define GPIO_PIN54_PAD_PULL_MSB WLAN_GPIO_PIN54_PAD_PULL_MSB -#define GPIO_PIN54_PAD_PULL_LSB WLAN_GPIO_PIN54_PAD_PULL_LSB -#define GPIO_PIN54_PAD_PULL_MASK WLAN_GPIO_PIN54_PAD_PULL_MASK -#define GPIO_PIN54_PAD_PULL_GET(x) WLAN_GPIO_PIN54_PAD_PULL_GET(x) -#define GPIO_PIN54_PAD_PULL_SET(x) WLAN_GPIO_PIN54_PAD_PULL_SET(x) -#define GPIO_PIN54_PAD_STRENGTH_MSB WLAN_GPIO_PIN54_PAD_STRENGTH_MSB -#define GPIO_PIN54_PAD_STRENGTH_LSB WLAN_GPIO_PIN54_PAD_STRENGTH_LSB -#define GPIO_PIN54_PAD_STRENGTH_MASK WLAN_GPIO_PIN54_PAD_STRENGTH_MASK -#define GPIO_PIN54_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN54_PAD_STRENGTH_GET(x) -#define GPIO_PIN54_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN54_PAD_STRENGTH_SET(x) -#define GPIO_PIN54_PAD_DRIVER_MSB WLAN_GPIO_PIN54_PAD_DRIVER_MSB -#define GPIO_PIN54_PAD_DRIVER_LSB WLAN_GPIO_PIN54_PAD_DRIVER_LSB -#define GPIO_PIN54_PAD_DRIVER_MASK WLAN_GPIO_PIN54_PAD_DRIVER_MASK -#define GPIO_PIN54_PAD_DRIVER_GET(x) WLAN_GPIO_PIN54_PAD_DRIVER_GET(x) -#define GPIO_PIN54_PAD_DRIVER_SET(x) WLAN_GPIO_PIN54_PAD_DRIVER_SET(x) -#define GPIO_PIN54_SOURCE_MSB WLAN_GPIO_PIN54_SOURCE_MSB -#define GPIO_PIN54_SOURCE_LSB WLAN_GPIO_PIN54_SOURCE_LSB -#define GPIO_PIN54_SOURCE_MASK WLAN_GPIO_PIN54_SOURCE_MASK -#define GPIO_PIN54_SOURCE_GET(x) WLAN_GPIO_PIN54_SOURCE_GET(x) -#define GPIO_PIN54_SOURCE_SET(x) WLAN_GPIO_PIN54_SOURCE_SET(x) -#define GPIO_PIN55_ADDRESS WLAN_GPIO_PIN55_ADDRESS -#define GPIO_PIN55_OFFSET WLAN_GPIO_PIN55_OFFSET -#define GPIO_PIN55_CONFIG_MSB WLAN_GPIO_PIN55_CONFIG_MSB -#define GPIO_PIN55_CONFIG_LSB WLAN_GPIO_PIN55_CONFIG_LSB -#define GPIO_PIN55_CONFIG_MASK WLAN_GPIO_PIN55_CONFIG_MASK -#define GPIO_PIN55_CONFIG_GET(x) WLAN_GPIO_PIN55_CONFIG_GET(x) -#define GPIO_PIN55_CONFIG_SET(x) WLAN_GPIO_PIN55_CONFIG_SET(x) -#define GPIO_PIN55_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN55_WAKEUP_ENABLE_MSB -#define GPIO_PIN55_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN55_WAKEUP_ENABLE_LSB -#define GPIO_PIN55_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN55_WAKEUP_ENABLE_MASK -#define GPIO_PIN55_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN55_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN55_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN55_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN55_INT_TYPE_MSB WLAN_GPIO_PIN55_INT_TYPE_MSB -#define GPIO_PIN55_INT_TYPE_LSB WLAN_GPIO_PIN55_INT_TYPE_LSB -#define GPIO_PIN55_INT_TYPE_MASK WLAN_GPIO_PIN55_INT_TYPE_MASK -#define GPIO_PIN55_INT_TYPE_GET(x) WLAN_GPIO_PIN55_INT_TYPE_GET(x) -#define GPIO_PIN55_INT_TYPE_SET(x) WLAN_GPIO_PIN55_INT_TYPE_SET(x) -#define GPIO_PIN55_PAD_PULL_MSB WLAN_GPIO_PIN55_PAD_PULL_MSB -#define GPIO_PIN55_PAD_PULL_LSB WLAN_GPIO_PIN55_PAD_PULL_LSB -#define GPIO_PIN55_PAD_PULL_MASK WLAN_GPIO_PIN55_PAD_PULL_MASK -#define GPIO_PIN55_PAD_PULL_GET(x) WLAN_GPIO_PIN55_PAD_PULL_GET(x) -#define GPIO_PIN55_PAD_PULL_SET(x) WLAN_GPIO_PIN55_PAD_PULL_SET(x) -#define GPIO_PIN55_PAD_STRENGTH_MSB WLAN_GPIO_PIN55_PAD_STRENGTH_MSB -#define GPIO_PIN55_PAD_STRENGTH_LSB WLAN_GPIO_PIN55_PAD_STRENGTH_LSB -#define GPIO_PIN55_PAD_STRENGTH_MASK WLAN_GPIO_PIN55_PAD_STRENGTH_MASK -#define GPIO_PIN55_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN55_PAD_STRENGTH_GET(x) -#define GPIO_PIN55_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN55_PAD_STRENGTH_SET(x) -#define GPIO_PIN55_PAD_DRIVER_MSB WLAN_GPIO_PIN55_PAD_DRIVER_MSB -#define GPIO_PIN55_PAD_DRIVER_LSB WLAN_GPIO_PIN55_PAD_DRIVER_LSB -#define GPIO_PIN55_PAD_DRIVER_MASK WLAN_GPIO_PIN55_PAD_DRIVER_MASK -#define GPIO_PIN55_PAD_DRIVER_GET(x) WLAN_GPIO_PIN55_PAD_DRIVER_GET(x) -#define GPIO_PIN55_PAD_DRIVER_SET(x) WLAN_GPIO_PIN55_PAD_DRIVER_SET(x) -#define GPIO_PIN55_SOURCE_MSB WLAN_GPIO_PIN55_SOURCE_MSB -#define GPIO_PIN55_SOURCE_LSB WLAN_GPIO_PIN55_SOURCE_LSB -#define GPIO_PIN55_SOURCE_MASK WLAN_GPIO_PIN55_SOURCE_MASK -#define GPIO_PIN55_SOURCE_GET(x) WLAN_GPIO_PIN55_SOURCE_GET(x) -#define GPIO_PIN55_SOURCE_SET(x) WLAN_GPIO_PIN55_SOURCE_SET(x) -#define GPIO_PIN56_ADDRESS WLAN_GPIO_PIN56_ADDRESS -#define GPIO_PIN56_OFFSET WLAN_GPIO_PIN56_OFFSET -#define GPIO_PIN56_CONFIG_MSB WLAN_GPIO_PIN56_CONFIG_MSB -#define GPIO_PIN56_CONFIG_LSB WLAN_GPIO_PIN56_CONFIG_LSB -#define GPIO_PIN56_CONFIG_MASK WLAN_GPIO_PIN56_CONFIG_MASK -#define GPIO_PIN56_CONFIG_GET(x) WLAN_GPIO_PIN56_CONFIG_GET(x) -#define GPIO_PIN56_CONFIG_SET(x) WLAN_GPIO_PIN56_CONFIG_SET(x) -#define GPIO_PIN56_WAKEUP_ENABLE_MSB WLAN_GPIO_PIN56_WAKEUP_ENABLE_MSB -#define GPIO_PIN56_WAKEUP_ENABLE_LSB WLAN_GPIO_PIN56_WAKEUP_ENABLE_LSB -#define GPIO_PIN56_WAKEUP_ENABLE_MASK WLAN_GPIO_PIN56_WAKEUP_ENABLE_MASK -#define GPIO_PIN56_WAKEUP_ENABLE_GET(x) WLAN_GPIO_PIN56_WAKEUP_ENABLE_GET(x) -#define GPIO_PIN56_WAKEUP_ENABLE_SET(x) WLAN_GPIO_PIN56_WAKEUP_ENABLE_SET(x) -#define GPIO_PIN56_INT_TYPE_MSB WLAN_GPIO_PIN56_INT_TYPE_MSB -#define GPIO_PIN56_INT_TYPE_LSB WLAN_GPIO_PIN56_INT_TYPE_LSB -#define GPIO_PIN56_INT_TYPE_MASK WLAN_GPIO_PIN56_INT_TYPE_MASK -#define GPIO_PIN56_INT_TYPE_GET(x) WLAN_GPIO_PIN56_INT_TYPE_GET(x) -#define GPIO_PIN56_INT_TYPE_SET(x) WLAN_GPIO_PIN56_INT_TYPE_SET(x) -#define GPIO_PIN56_PAD_PULL_MSB WLAN_GPIO_PIN56_PAD_PULL_MSB -#define GPIO_PIN56_PAD_PULL_LSB WLAN_GPIO_PIN56_PAD_PULL_LSB -#define GPIO_PIN56_PAD_PULL_MASK WLAN_GPIO_PIN56_PAD_PULL_MASK -#define GPIO_PIN56_PAD_PULL_GET(x) WLAN_GPIO_PIN56_PAD_PULL_GET(x) -#define GPIO_PIN56_PAD_PULL_SET(x) WLAN_GPIO_PIN56_PAD_PULL_SET(x) -#define GPIO_PIN56_PAD_STRENGTH_MSB WLAN_GPIO_PIN56_PAD_STRENGTH_MSB -#define GPIO_PIN56_PAD_STRENGTH_LSB WLAN_GPIO_PIN56_PAD_STRENGTH_LSB -#define GPIO_PIN56_PAD_STRENGTH_MASK WLAN_GPIO_PIN56_PAD_STRENGTH_MASK -#define GPIO_PIN56_PAD_STRENGTH_GET(x) WLAN_GPIO_PIN56_PAD_STRENGTH_GET(x) -#define GPIO_PIN56_PAD_STRENGTH_SET(x) WLAN_GPIO_PIN56_PAD_STRENGTH_SET(x) -#define GPIO_PIN56_PAD_DRIVER_MSB WLAN_GPIO_PIN56_PAD_DRIVER_MSB -#define GPIO_PIN56_PAD_DRIVER_LSB WLAN_GPIO_PIN56_PAD_DRIVER_LSB -#define GPIO_PIN56_PAD_DRIVER_MASK WLAN_GPIO_PIN56_PAD_DRIVER_MASK -#define GPIO_PIN56_PAD_DRIVER_GET(x) WLAN_GPIO_PIN56_PAD_DRIVER_GET(x) -#define GPIO_PIN56_PAD_DRIVER_SET(x) WLAN_GPIO_PIN56_PAD_DRIVER_SET(x) -#define GPIO_PIN56_SOURCE_MSB WLAN_GPIO_PIN56_SOURCE_MSB -#define GPIO_PIN56_SOURCE_LSB WLAN_GPIO_PIN56_SOURCE_LSB -#define GPIO_PIN56_SOURCE_MASK WLAN_GPIO_PIN56_SOURCE_MASK -#define GPIO_PIN56_SOURCE_GET(x) WLAN_GPIO_PIN56_SOURCE_GET(x) -#define GPIO_PIN56_SOURCE_SET(x) WLAN_GPIO_PIN56_SOURCE_SET(x) -#define SIGMA_DELTA_ADDRESS WLAN_SIGMA_DELTA_ADDRESS -#define SIGMA_DELTA_OFFSET WLAN_SIGMA_DELTA_OFFSET -#define SIGMA_DELTA_ENABLE_MSB WLAN_SIGMA_DELTA_ENABLE_MSB -#define SIGMA_DELTA_ENABLE_LSB WLAN_SIGMA_DELTA_ENABLE_LSB -#define SIGMA_DELTA_ENABLE_MASK WLAN_SIGMA_DELTA_ENABLE_MASK -#define SIGMA_DELTA_ENABLE_GET(x) WLAN_SIGMA_DELTA_ENABLE_GET(x) -#define SIGMA_DELTA_ENABLE_SET(x) WLAN_SIGMA_DELTA_ENABLE_SET(x) -#define SIGMA_DELTA_PRESCALAR_MSB WLAN_SIGMA_DELTA_PRESCALAR_MSB -#define SIGMA_DELTA_PRESCALAR_LSB WLAN_SIGMA_DELTA_PRESCALAR_LSB -#define SIGMA_DELTA_PRESCALAR_MASK WLAN_SIGMA_DELTA_PRESCALAR_MASK -#define SIGMA_DELTA_PRESCALAR_GET(x) WLAN_SIGMA_DELTA_PRESCALAR_GET(x) -#define SIGMA_DELTA_PRESCALAR_SET(x) WLAN_SIGMA_DELTA_PRESCALAR_SET(x) -#define SIGMA_DELTA_TARGET_MSB WLAN_SIGMA_DELTA_TARGET_MSB -#define SIGMA_DELTA_TARGET_LSB WLAN_SIGMA_DELTA_TARGET_LSB -#define SIGMA_DELTA_TARGET_MASK WLAN_SIGMA_DELTA_TARGET_MASK -#define SIGMA_DELTA_TARGET_GET(x) WLAN_SIGMA_DELTA_TARGET_GET(x) -#define SIGMA_DELTA_TARGET_SET(x) WLAN_SIGMA_DELTA_TARGET_SET(x) -#define DEBUG_CONTROL_ADDRESS WLAN_DEBUG_CONTROL_ADDRESS -#define DEBUG_CONTROL_OFFSET WLAN_DEBUG_CONTROL_OFFSET -#define DEBUG_CONTROL_ENABLE_MSB WLAN_DEBUG_CONTROL_ENABLE_MSB -#define DEBUG_CONTROL_ENABLE_LSB WLAN_DEBUG_CONTROL_ENABLE_LSB -#define DEBUG_CONTROL_ENABLE_MASK WLAN_DEBUG_CONTROL_ENABLE_MASK -#define DEBUG_CONTROL_ENABLE_GET(x) WLAN_DEBUG_CONTROL_ENABLE_GET(x) -#define DEBUG_CONTROL_ENABLE_SET(x) WLAN_DEBUG_CONTROL_ENABLE_SET(x) -#define DEBUG_INPUT_SEL_ADDRESS WLAN_DEBUG_INPUT_SEL_ADDRESS -#define DEBUG_INPUT_SEL_OFFSET WLAN_DEBUG_INPUT_SEL_OFFSET -#define DEBUG_INPUT_SEL_SHIFT_MSB WLAN_DEBUG_INPUT_SEL_SHIFT_MSB -#define DEBUG_INPUT_SEL_SHIFT_LSB WLAN_DEBUG_INPUT_SEL_SHIFT_LSB -#define DEBUG_INPUT_SEL_SHIFT_MASK WLAN_DEBUG_INPUT_SEL_SHIFT_MASK -#define DEBUG_INPUT_SEL_SHIFT_GET(x) WLAN_DEBUG_INPUT_SEL_SHIFT_GET(x) -#define DEBUG_INPUT_SEL_SHIFT_SET(x) WLAN_DEBUG_INPUT_SEL_SHIFT_SET(x) -#define DEBUG_INPUT_SEL_SRC_MSB WLAN_DEBUG_INPUT_SEL_SRC_MSB -#define DEBUG_INPUT_SEL_SRC_LSB WLAN_DEBUG_INPUT_SEL_SRC_LSB -#define DEBUG_INPUT_SEL_SRC_MASK WLAN_DEBUG_INPUT_SEL_SRC_MASK -#define DEBUG_INPUT_SEL_SRC_GET(x) WLAN_DEBUG_INPUT_SEL_SRC_GET(x) -#define DEBUG_INPUT_SEL_SRC_SET(x) WLAN_DEBUG_INPUT_SEL_SRC_SET(x) -#define DEBUG_OUT_ADDRESS WLAN_DEBUG_OUT_ADDRESS -#define DEBUG_OUT_OFFSET WLAN_DEBUG_OUT_OFFSET -#define DEBUG_OUT_DATA_MSB WLAN_DEBUG_OUT_DATA_MSB -#define DEBUG_OUT_DATA_LSB WLAN_DEBUG_OUT_DATA_LSB -#define DEBUG_OUT_DATA_MASK WLAN_DEBUG_OUT_DATA_MASK -#define DEBUG_OUT_DATA_GET(x) WLAN_DEBUG_OUT_DATA_GET(x) -#define DEBUG_OUT_DATA_SET(x) WLAN_DEBUG_OUT_DATA_SET(x) -#define RESET_TUPLE_STATUS_ADDRESS WLAN_RESET_TUPLE_STATUS_ADDRESS -#define RESET_TUPLE_STATUS_OFFSET WLAN_RESET_TUPLE_STATUS_OFFSET -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MSB WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MSB -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_LSB -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_MASK -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_GET(x) WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_GET(x) -#define RESET_TUPLE_STATUS_TEST_RESET_TUPLE_SET(x) WLAN_RESET_TUPLE_STATUS_TEST_RESET_TUPLE_SET(x) -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MSB WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MSB -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_LSB -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_MASK -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_GET(x) WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_GET(x) -#define RESET_TUPLE_STATUS_PIN_RESET_TUPLE_SET(x) WLAN_RESET_TUPLE_STATUS_PIN_RESET_TUPLE_SET(x) - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mac_dma_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mac_dma_reg.h deleted file mode 100644 index 3824a7e71ac2..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mac_dma_reg.h +++ /dev/null @@ -1,347 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -#ifndef __MAC_DMA_REG_SW_H -#define __MAC_DMA_REG_SW_H -// THIS IS A SOFTWARE WRAPPER HEADER FILE -#include "wmac_dma_reg.h" -#include "wmac_dcu_reg.h" -#include "wmac_qcu_reg.h" - -/* Primary Interrupt Status Register */ -#define MAC_DMA_ISR_ADDRESS MAC_DMA_ISR_P_ADDRESS -#define MAC_DMA_ISR_HP_RXOK_MASK 0x00000001 // At least one frame rx on high-priority queue sans errors -#define MAC_DMA_ISR_LP_RXOK_MASK 0x00000002 // At least one frame rx on low-priority queue sans errors -#define MAC_DMA_ISR_RXERR_MASK 0x00000004 // Receive error interrupt -#define MAC_DMA_ISR_RXNOPKT_MASK 0x00000008 // No frame received within timeout clock -#define MAC_DMA_ISR_RXEOL_MASK 0x00000010 // Received descriptor empty interrupt -#define MAC_DMA_ISR_RXORN_MASK 0x00000020 // Receive FIFO overrun interrupt -#define MAC_DMA_ISR_TXOK_MASK 0x00000040 // Transmit okay interrupt -#define MAC_DMA_ISR_BTINT_MASK 0x00000080 // BT interrupt -#define MAC_DMA_ISR_TXERR_MASK 0x00000100 // Transmit error interrupt -#define MAC_DMA_ISR_TXNOPKT_MASK 0x00000200 // No frame transmitted interrupt -#define MAC_DMA_ISR_TXEOL_MASK 0x00000400 // Transmit descriptor empty interrupt -#define MAC_DMA_ISR_TXURN_MASK 0x00000800 // Transmit FIFO underrun interrupt -#define MAC_DMA_ISR_MIB_MASK 0x00001000 // MIB interrupt - see MIBC -#define MAC_DMA_ISR_SWI_MASK 0x00002000 // Software interrupt -#define MAC_DMA_ISR_RXPHY_MASK 0x00004000 // PHY receive error interrupt -#define MAC_DMA_ISR_RXKCM_MASK 0x00008000 // Key-cache miss interrupt -#define MAC_DMA_ISR_SWBA_MASK 0x00010000 // Software beacon alert interrupt -#define MAC_DMA_ISR_BRSSI_MASK 0x00020000 // Beacon threshold interrupt -#define MAC_DMA_ISR_BMISS_MASK 0x00040000 // Beacon missed interrupt -#define MAC_DMA_ISR_TXMINTR_MASK 0x00080000 // Maximum interrupt transmit rate -#define MAC_DMA_ISR_BNR_MASK 0x00100000 // Beacon not ready interrupt -#define MAC_DMA_ISR_RXINT_MASK 0x00200000 // Rx interrupt directly from PCU -#define MAC_DMA_ISR_HCFPOLL_MASK 0x00400000 // Received directed HCF poll -#define MAC_DMA_ISR_BCNMISC_MASK 0x00800000 // CST, GTT, TIM, CABEND, DTIMSYNC, BCNTO, CABTO, -// TSFOOR, DTIM, and TBTT_TIME bits bits from ISR_S2 -#define MAC_DMA_ISR_TIM_MASK 0x00800000 // TIM interrupt -#define MAC_DMA_ISR_RXMINTR_MASK 0x01000000 // Maximum interrupt receive rate -#define MAC_DMA_ISR_QCBROVF_MASK 0x02000000 // QCU CBR overflow interrupt -#define MAC_DMA_ISR_QCBRURN_MASK 0x04000000 // QCU CBR underrun interrupt -#define MAC_DMA_ISR_QTRIG_MASK 0x08000000 // QCU scheduling trigger interrupt -#define MAC_DMA_ISR_TIMER_MASK 0x10000000 // OR of generic timer bits in ISR 5 -#define MAC_DMA_ISR_HCFTO_MASK 0x20000000 // HCF poll timeout -#define MAC_DMA_ISR_TXINTM_MASK 0x40000000 // Tx interrupt after mitigation -#define MAC_DMA_ISR_RXINTM_MASK 0x80000000 // Rx interrupt after mitigation - -/* MAC Secondary interrupt status register 0 */ -#define MAC_DMA_ISR_S0_QCU_TXOK_MASK 0x000003FF // Mask for TXOK (QCU 0-9) -#define MAC_DMA_ISR_S0_QCU_TXOK_LSB 0 // Shift for TXOK (QCU 0-9) - -/* MAC Secondary interrupt status register 1 */ -#define MAC_DMA_ISR_S1_QCU_TXERR_MASK 0x000003FF // Mask for TXERR (QCU 0-9) -#define MAC_DMA_ISR_S1_QCU_TXERR_LSB 0 // Shift for TXERR (QCU 0-9) -#define MAC_DMA_ISR_S1_QCU_TXEOL_MASK 0x03FF0000 // Mask for TXEOL (QCU 0-9) -#define MAC_DMA_ISR_S1_QCU_TXEOL_LSB 16 // Shift for TXEOL (QCU 0-9) - -/* MAC Secondary interrupt status register 2 */ -#define MAC_DMA_ISR_S2_QCU_TXURN_MASK 0x000003FF // Mask for TXURN (QCU 0-9) -#define MAC_DMA_ISR_S2_QCU_TXURN_LSB 0 // Shift for TXURN (QCU 0-9) -#define MAC_DMA_ISR_S2_TDMA_START_ERR_MASK 0x00000400 // TDMA start time error interrupt -#define MAC_DMA_ISR_S2_TDMA_TX_AP_PULSE_MASK 0x00000800 // TDMA Tx AP SYNC PULSE -#define MAC_DMA_ISR_S2_RX_PTR_BAD_MASK 0x00001000 // If PCU RX FIFO read pointer crosses PCU RX FIFO write pointer -#define MAC_DMA_ISR_S2_TIM2_MASK 0x00002000 // TIM2 -#define MAC_DMA_ISR_S2_CAB2END_MASK 0x00004000 // CAB2END -#define MAC_DMA_ISR_S2_DTIM2SYNC_MASK 0x00008000 // DTIM2SYNC -#define MAC_DMA_ISR_S2_BCN2TO_MASK 0x00010000 // BCN2TO -#define MAC_DMA_ISR_S2_CAB2TO_MASK 0x00020000 // CAB2TO -#define MAC_DMA_ISR_S2_DTIM2_MASK 0x00040000 // DTIM2 -#define MAC_DMA_ISR_S2_TSF2OOR_MASK 0x00080000 // Rx TSF2 out of range -#define MAC_DMA_ISR_S2_TBTT2_TIME_MASK 0x00100000 // TBTT2-referenced timer -#define MAC_DMA_ISR_S2_CST_MASK 0x00200000 // Carrier sense timeout -#define MAC_DMA_ISR_S2_GTT_MASK 0x00400000 // Global transmit timeout -#define MAC_DMA_ISR_S2_TIM_MASK 0x00800000 // TIM -#define MAC_DMA_ISR_S2_CABEND_MASK 0x01000000 // CABEND -#define MAC_DMA_ISR_S2_DTIMSYNC_MASK 0x02000000 // DTIMSYNC -#define MAC_DMA_ISR_S2_BCNTO_MASK 0x04000000 // BCNTO -#define MAC_DMA_ISR_S2_CABTO_MASK 0x08000000 // CABTO -#define MAC_DMA_ISR_S2_DTIM_MASK 0x10000000 // DTIM -#define MAC_DMA_ISR_S2_TSFOOR_MASK 0x20000000 // Rx TSF out of range -#define MAC_DMA_ISR_S2_TBTT_TIME_MASK 0x40000000 // TBTT-referenced timer - -/* MAC Secondary interrupt status register 3 */ -#define MAC_DMA_ISR_S3_QCU_QCBROVF_MASK 0x000003FF // Mask for QCBROVF (QCU 0-9) -#define MAC_DMA_ISR_S3_RX_LP_Q_OVF_MASK 0x00004000 // Rxdp LPQ overflow -#define MAC_DMA_ISR_S3_RX_HP_Q_OVF_MASK 0x00008000 // Rxdp HPQ overflow -#define MAC_DMA_ISR_S3_QCU_QCBRURN_MASK 0x03FF0000 // Mask for QCBRURN (QCU 0-9) -#define MAC_DMA_ISR_S3_BRSSI_LO_MASK 0x04000000 // RSSI HI of a beacon threshold -#define MAC_DMA_ISR_S3_BRSSI_HI_MASK 0x08000000 // RSSI LO of a beacon threshold -#define MAC_DMA_ISR_S3_BRSSI_LO2_MASK 0x10000000 // RSSI HI2 of a beacon threshold -#define MAC_DMA_ISR_S3_BRSSI_HI2_MASK 0x20000000 // RSSI LO2 of a beacon threshold -#define MAC_DMA_ISR_S3_BMISS_MASK 0x40000000 // Beacon miss -#define MAC_DMA_ISR_S3_BMISS2_MASK 0x80000000 // Beacon miss2 - -/* MAC Secondary interrupt status register 4 */ -#define MAC_DMA_ISR_S4_QCU_QTRIG_MASK 0x000003FF // Mask for QTRIG (QCU 0-9) -#define MAC_DMA_ISR_S4_QCU_QTXDP_OVF_MASK 0x03FF0000 // Mask for QTXDP Overflow (QCU 0-9) -#define MAC_DMA_ISR_S4_QCU_TXDP_TH_INT_MASK 0x04000000 // TXDP threshold interrupt - -/* MAC Secondary interrupt status register 5 */ -#define MAC_DMA_ISR_S5_TBTT_TIMER_TRIGGER_MASK 0x00000001 -#define MAC_DMA_ISR_S5_DBA_TIMER_TRIGGER_MASK 0x00000002 -#define MAC_DMA_ISR_S5_SBA_TIMER_TRIGGER_MASK 0x00000004 -#define MAC_DMA_ISR_S5_HCF_TIMER_TRIGGER_MASK 0x00000008 -#define MAC_DMA_ISR_S5_TIM_TIMER_TRIGGER_MASK 0x00000010 -#define MAC_DMA_ISR_S5_DTIM_TIMER_TRIGGER_MASK 0x00000020 -#define MAC_DMA_ISR_S5_QUIET_TIMER_TRIGGER_MASK 0x00000040 -#define MAC_DMA_ISR_S5_NDP_TIMER_TRIGGER_MASK 0x00000080 -#define MAC_DMA_ISR_S5_GENERIC_TIMER2_TRIGGER_MASK 0x0000FF00 -#define MAC_DMA_ISR_S5_GENERIC_TIMER2_TRIGGER_LSB 8 -#define MAC_DMA_ISR_S5_GENERIC_TIMER2_TRIGGER(_i) (0x00000100 << (_i)) -#define MAC_DMA_ISR_S5_TIMER_OVERFLOW_MASK 0x00010000 -#define MAC_DMA_ISR_S5_DBA_TIMER_THRESHOLD_MASK 0x00020000 -#define MAC_DMA_ISR_S5_SBA_TIMER_THRESHOLD_MASK 0x00040000 -#define MAC_DMA_ISR_S5_HCF_TIMER_THRESHOLD_MASK 0x00080000 -#define MAC_DMA_ISR_S5_TIM_TIMER_THRESHOLD_MASK 0x00100000 -#define MAC_DMA_ISR_S5_DTIM_TIMER_THRESHOLD_MASK 0x00200000 -#define MAC_DMA_ISR_S5_QUIET_TIMER_THRESHOLD_MASK 0x00400000 -#define MAC_DMA_ISR_S5_NDP_TIMER_THRESHOLD_MASK 0x00800000 -#define MAC_DMA_ISR_S5_GENERIC_TIMER2_THRESHOLD_MASK 0xFF000000 -#define MAC_DMA_ISR_S5_GENERIC_TIMER2_THRESHOLD_LSB 24 -#define MAC_DMA_ISR_S5_GENERIC_TIMER2_THRESHOLD(_i) (0x01000000 << (_i)) - -/* MAC Secondary interrupt status register 6 */ -#define MAC_DMA_ISR_S6_BB_MAC_TEMP_SENSOR_MASK 0x00000001 -#define MAC_DMA_ISR_S6_BB_PANIC_IRQ_MASK 0x00000002 -#define MAC_DMA_ISR_S6_BT_LOW_PRIORITY_RISING_MASK 0x00000004 -#define MAC_DMA_ISR_S6_BT_LOW_PRIORITY_FALLING_MASK 0x00000008 -#define MAC_DMA_ISR_S6_BT_STOMPED_MASK 0x00000010 -#define MAC_DMA_ISR_S6_WL_STOMPED_MASK 0x00000020 -#define MAC_DMA_ISR_S6_BT_ACTIVE_RISING_MASK 0x00000040 -#define MAC_DMA_ISR_S6_BT_ACTIVE_FALLING_MASK 0x00000080 -#define MAC_DMA_ISR_S6_BT_PRIORITY_RISING_MASK 0x00000100 -#define MAC_DMA_ISR_S6_BT_PRIORITY_FALLING_MASK 0x00000200 -#define MAC_DMA_ISR_S6_MBZ_MASK 0xfffffc00 - -#define MAC_DMA_IMR_MASK_MSB MAC_DMA_IMR_P_MASK_MSB -#define MAC_DMA_IMR_MASK_LSB MAC_DMA_IMR_P_MASK_LSB -#define MAC_DMA_IMR_MASK_MASK MAC_DMA_IMR_P_MASK_MASK -#define MAC_DMA_IMR_MASK_GET(x) MAC_DMA_IMR_P_MASK_GET(x) -#define MAC_DMA_IMR_MASK_SET(x) MAC_DMA_IMR_P_MASK_SET(x) -#define MAC_DMA_IMR_ADDRESS MAC_DMA_IMR_P_ADDRESS - -/* Primary Interrupt mask Register */ -#define MAC_DMA_IMR_HP_RXOK_MASK MAC_DMA_ISR_HP_RXOK_MASK -#define MAC_DMA_IMR_LP_RXOK_MASK MAC_DMA_ISR_LP_RXOK_MASK -#define MAC_DMA_IMR_RXERR_MASK MAC_DMA_ISR_RXERR_MASK -#define MAC_DMA_IMR_RXNOPKT_MASK MAC_DMA_ISR_RXNOPKT_MASK -#define MAC_DMA_IMR_RXEOL_MASK MAC_DMA_ISR_RXEOL_MASK -#define MAC_DMA_IMR_RXORN_MASK MAC_DMA_ISR_RXORN_MASK -#define MAC_DMA_IMR_TXOK_MASK MAC_DMA_ISR_TXOK_MASK -#define MAC_DMA_IMR_BTINT_MASK MAC_DMA_ISR_BTINT_MASK -#define MAC_DMA_IMR_TXERR_MASK MAC_DMA_ISR_TXERR_MASK -#define MAC_DMA_IMR_TXNOPKT_MASK MAC_DMA_ISR_TXNOPKT_MASK -#define MAC_DMA_IMR_TXEOL_MASK MAC_DMA_ISR_TXEOL_MASK -#define MAC_DMA_IMR_TXURN_MASK MAC_DMA_ISR_TXURN_MASK -#define MAC_DMA_IMR_MIB_MASK MAC_DMA_ISR_MIB_MASK -#define MAC_DMA_IMR_SWI_MASK MAC_DMA_ISR_SWI_MASK -#define MAC_DMA_IMR_RXPHY_MASK MAC_DMA_ISR_RXPHY_MASK -#define MAC_DMA_IMR_RXKCM_MASK MAC_DMA_ISR_RXKCM_MASK -#define MAC_DMA_IMR_SWBA_MASK MAC_DMA_ISR_SWBA_MASK -#define MAC_DMA_IMR_BRSSI_MASK MAC_DMA_ISR_BRSSI_MASK -#define MAC_DMA_IMR_BMISS_MASK MAC_DMA_ISR_BMISS_MASK -#define MAC_DMA_IMR_TXMINTR_MASK MAC_DMA_ISR_TXMINTR_MASK -#define MAC_DMA_IMR_BNR_MASK MAC_DMA_ISR_BNR_MASK -#define MAC_DMA_IMR_RXINT_MASK MAC_DMA_ISR_RXINT_MASK -#define MAC_DMA_IMR_HCFPOLL_MASK MAC_DMA_ISR_HCFPOLL_MASK -#define MAC_DMA_IMR_BCNMISC_MASK MAC_DMA_ISR_BCNMISC_MASK -#define MAC_DMA_IMR_TIM_MASK MAC_DMA_ISR_TIM_MASK -#define MAC_DMA_IMR_RXMINTR_MASK MAC_DMA_ISR_RXMINTR_MASK -#define MAC_DMA_IMR_QCBROVF_MASK MAC_DMA_ISR_QCBROVF_MASK -#define MAC_DMA_IMR_QCBRURN_MASK MAC_DMA_ISR_QCBRURN_MASK -#define MAC_DMA_IMR_QTRIG_MASK MAC_DMA_ISR_QTRIG_MASK -#define MAC_DMA_IMR_TIMER_MASK MAC_DMA_ISR_TIMER_MASK -#define MAC_DMA_IMR_HCFTO_MASK MAC_DMA_ISR_HCFTO_MASK -#define MAC_DMA_IMR_TXINTM_MASK MAC_DMA_ISR_TXINTM_MASK -#define MAC_DMA_IMR_RXINTM_MASK MAC_DMA_ISR_RXINTM_MASK - -/* MAC Secondary interrupt mask register 0 */ -#define MAC_DMA_IMR_S0_QCU_TXOK_MASK MAC_DMA_ISR_S0_QCU_TXOK_MASK -#define MAC_DMA_IMR_S0_QCU_TXOK_LSB MAC_DMA_ISR_S0_QCU_TXOK_LSB - -/* MAC Secondary interrupt mask register 1 */ -#define MAC_DMA_IMR_S1_QCU_TXERR_MASK MAC_DMA_ISR_S1_QCU_TXERR_MASK -#define MAC_DMA_IMR_S1_QCU_TXERR_LSB MAC_DMA_ISR_S1_QCU_TXERR_LSB -#define MAC_DMA_IMR_S1_QCU_TXEOL_MASK MAC_DMA_ISR_S1_QCU_TXEOL_MASK -#define MAC_DMA_IMR_S1_QCU_TXEOL_LSB MAC_DMA_ISR_S1_QCU_TXEOL_LSB - -/* MAC Secondary interrupt mask register 2 */ -#define MAC_DMA_IMR_S2_QCU_TXURN_MASK MAC_DMA_ISR_S2_QCU_TXURN_MASK -#define MAC_DMA_IMR_S2_QCU_TXURN_LSB MAC_DMA_ISR_S2_QCU_TXURN_LSB -#define MAC_DMA_IMR_S2_TDMA_START_ERR_MASK MAC_DMA_ISR_S2_TDMA_START_ERR_MASK -#define MAC_DMA_IMR_S2_TDMA_TX_AP_PULSE_MASK MAC_DMA_ISR_S2_TDMA_TX_AP_PULSE_MASK -#define MAC_DMA_IMR_S2_RX_PTR_BAD_MASK MAC_DMA_ISR_S2_RX_PTR_BAD_MASK -#define MAC_DMA_IMR_S2_TIM2_MASK MAC_DMA_ISR_S2_TIM2_MASK -#define MAC_DMA_IMR_S2_CAB2END_MASK MAC_DMA_ISR_S2_CAB2END_MASK -#define MAC_DMA_IMR_S2_DTIM2SYNC_MASK MAC_DMA_ISR_S2_DTIM2SYNC_MASK -#define MAC_DMA_IMR_S2_BCN2TO_MASK MAC_DMA_ISR_S2_BCN2TO_MASK -#define MAC_DMA_IMR_S2_CAB2TO_MASK MAC_DMA_ISR_S2_CAB2TO_MASK -#define MAC_DMA_IMR_S2_DTIM2_MASK MAC_DMA_ISR_S2_DTIM2_MASK -#define MAC_DMA_IMR_S2_TSF2OOR_MASK MAC_DMA_ISR_S2_TSF2OOR_MASK -#define MAC_DMA_IMR_S2_TBTT2_TIME_MASK MAC_DMA_ISR_S2_TBTT2_TIME_MASK -#define MAC_DMA_IMR_S2_CST_MASK MAC_DMA_ISR_S2_CST_MASK -#define MAC_DMA_IMR_S2_GTT_MASK MAC_DMA_ISR_S2_GTT_MASK -#define MAC_DMA_IMR_S2_TIM_MASK MAC_DMA_ISR_S2_TIM_MASK -#define MAC_DMA_IMR_S2_CABEND_MASK MAC_DMA_ISR_S2_CABEND_MASK -#define MAC_DMA_IMR_S2_DTIMSYNC_MASK MAC_DMA_ISR_S2_DTIMSYNC_MASK -#define MAC_DMA_IMR_S2_BCNTO_MASK MAC_DMA_ISR_S2_BCNTO_MASK -#define MAC_DMA_IMR_S2_CABTO_MASK MAC_DMA_ISR_S2_CABTO_MASK -#define MAC_DMA_IMR_S2_DTIM_MASK MAC_DMA_ISR_S2_DTIM_MASK -#define MAC_DMA_IMR_S2_TSFOOR_MASK MAC_DMA_ISR_S2_TSFOOR_MASK -#define MAC_DMA_IMR_S2_TBTT_TIME_MASK MAC_DMA_ISR_S2_TBTT_TIME_MASK - -/* MAC Secondary interrupt mask register 3 */ -#define MAC_DMA_IMR_S3_QCU_QCBROVF_MASK MAC_DMA_ISR_S3_QCU_QCBROVF_MASK -#define MAC_DMA_IMR_S3_RX_LP_Q_OVF_MASK MAC_DMA_ISR_S3_RX_LP_Q_OVF_MASK -#define MAC_DMA_IMR_S3_RX_HP_Q_OVF_MASK MAC_DMA_ISR_S3_RX_HP_Q_OVF_MASK -#define MAC_DMA_IMR_S3_QCU_QCBRURN_MASK MAC_DMA_ISR_S3_QCU_QCBRURN_MASK -#define MAC_DMA_IMR_S3_BRSSI_LO_MASK MAC_DMA_ISR_S3_BRSSI_LO_MASK -#define MAC_DMA_IMR_S3_BRSSI_HI_MASK MAC_DMA_ISR_S3_BRSSI_HI_MASK -#define MAC_DMA_IMR_S3_BRSSI_LO2_MASK MAC_DMA_ISR_S3_BRSSI_LO2_MASK -#define MAC_DMA_IMR_S3_BRSSI_HI2_MASK MAC_DMA_ISR_S3_BRSSI_HI2_MASK -#define MAC_DMA_IMR_S3_BMISS_MASK MAC_DMA_ISR_S3_BMISS_MASK -#define MAC_DMA_IMR_S3_BMISS2_MASK MAC_DMA_ISR_S3_BMISS2_MASK - -/* MAC Secondary interrupt mask register 4 */ -#define MAC_DMA_IMR_S4_QCU_QTRIG_MASK MAC_DMA_ISR_S4_QCU_QTRIG_MASK -#define MAC_DMA_IMR_S4_QCU_QTXDP_OVF_MASK MAC_DMA_ISR_S4_QCU_QTXDP_OVF_MASK -#define MAC_DMA_IMR_S4_QCU_TXDP_TH_INT_MASK MAC_DMA_ISR_S4_QCU_TXDP_TH_INT_MASK - -/* MAC Secondary interrupt mask register 5 */ -#define MAC_DMA_IMR_S5_TBTT_TIMER_TRIGGER_MASK MAC_DMA_ISR_S5_TBTT_TIMER_TRIGGER_MASK -#define MAC_DMA_IMR_S5_DBA_TIMER_TRIGGER_MASK MAC_DMA_ISR_S5_DBA_TIMER_TRIGGER_MASK -#define MAC_DMA_IMR_S5_SBA_TIMER_TRIGGER_MASK MAC_DMA_ISR_S5_SBA_TIMER_TRIGGER_MASK -#define MAC_DMA_IMR_S5_HCF_TIMER_TRIGGER_MASK MAC_DMA_ISR_S5_HCF_TIMER_TRIGGER_MASK -#define MAC_DMA_IMR_S5_TIM_TIMER_TRIGGER_MASK MAC_DMA_ISR_S5_TIM_TIMER_TRIGGER_MASK -#define MAC_DMA_IMR_S5_DTIM_TIMER_TRIGGER_MASK MAC_DMA_ISR_S5_DTIM_TIMER_TRIGGER_MASK -#define MAC_DMA_IMR_S5_QUIET_TIMER_TRIGGER_MASK MAC_DMA_ISR_S5_QUIET_TIMER_TRIGGER_MASK -#define MAC_DMA_IMR_S5_NDP_TIMER_TRIGGER_MASK MAC_DMA_ISR_S5_NDP_TIMER_TRIGGER_MASK -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_TRIGGER_MASK MAC_DMA_ISR_S5_GENERIC_TIMER2_TRIGGER_MASK -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_TRIGGER_LSB MAC_DMA_ISR_S5_GENERIC_TIMER2_TRIGGER_LSB -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_TRIGGER(_i) MAC_DMA_ISR_S5_GENERIC_TIMER2_TRIGGER(_i) -#define MAC_DMA_IMR_S5_TIMER_OVERFLOW_MASK MAC_DMA_ISR_S5_TIMER_OVERFLOW_MASK -#define MAC_DMA_IMR_S5_DBA_TIMER_THRESHOLD_MASK MAC_DMA_ISR_S5_DBA_TIMER_THRESHOLD_MASK -#define MAC_DMA_IMR_S5_SBA_TIMER_THRESHOLD_MASK MAC_DMA_ISR_S5_SBA_TIMER_THRESHOLD_MASK -#define MAC_DMA_IMR_S5_HCF_TIMER_THRESHOLD_MASK MAC_DMA_ISR_S5_HCF_TIMER_THRESHOLD_MASK -#define MAC_DMA_IMR_S5_TIM_TIMER_THRESHOLD_MASK MAC_DMA_ISR_S5_TIM_TIMER_THRESHOLD_MASK -#define MAC_DMA_IMR_S5_DTIM_TIMER_THRESHOLD_MASK MAC_DMA_ISR_S5_DTIM_TIMER_THRESHOLD_MASK -#define MAC_DMA_IMR_S5_QUIET_TIMER_THRESHOLD_MASK MAC_DMA_ISR_S5_QUIET_TIMER_THRESHOLD_MASK -#define MAC_DMA_IMR_S5_NDP_TIMER_THRESHOLD_MASK MAC_DMA_ISR_S5_NDP_TIMER_THRESHOLD_MASK -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_THRESHOLD_MASK MAC_DMA_ISR_S5_GENERIC_TIMER2_THRESHOLD_MASK -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_THRESHOLD_LSB MAC_DMA_ISR_S5_GENERIC_TIMER2_THRESHOLD_LSB -#define MAC_DMA_IMR_S5_GENERIC_TIMER2_THRESHOLD(_i) MAC_DMA_ISR_S5_GENERIC_TIMER2_THRESHOLD(_i) - -/* MAC Secondary interrupt mask register 6 */ -#define MAC_DMA_IMR_S6_BB_MAC_TEMP_SENSOR_MASK MAC_DMA_ISR_S6_BB_MAC_TEMP_SENSOR_MASK -#define MAC_DMA_IMR_S6_BB_PANIC_IRQ_MASK MAC_DMA_ISR_S6_BB_PANIC_IRQ_MASK -#define MAC_DMA_IMR_S6_BT_LOW_PRIORITY_RISING_MASK MAC_DMA_ISR_S6_BT_LOW_PRIORITY_RISING_MASK -#define MAC_DMA_IMR_S6_BT_LOW_PRIORITY_FALLING_MASK MAC_DMA_ISR_S6_BT_LOW_PRIORITY_FALLING_MASK -#define MAC_DMA_IMR_S6_BT_STOMPED_MASK MAC_DMA_ISR_S6_BT_STOMPED_MASK -#define MAC_DMA_IMR_S6_WL_STOMPED_MASK MAC_DMA_ISR_S6_WL_STOMPED_MASK -#define MAC_DMA_IMR_S6_BT_ACTIVE_RISING_MASK MAC_DMA_ISR_S6_BT_ACTIVE_RISING_MASK -#define MAC_DMA_IMR_S6_BT_ACTIVE_FALLING_MASK MAC_DMA_ISR_S6_BT_ACTIVE_FALLING_MASK -#define MAC_DMA_IMR_S6_BT_PRIORITY_RISING_MASK MAC_DMA_ISR_S6_BT_PRIORITY_RISING_MASK -#define MAC_DMA_IMR_S6_BT_PRIORITY_FALLING_MASK MAC_DMA_ISR_S6_BT_PRIORITY_FALLING_MASK -#define MAC_DMA_IMR_S6_MBZ_MASK MAC_DMA_ISR_S6_MBZ_MASK - -#define MAC_DMA_TIMT_TX_FIRST_PKT_THRESH_LSB MAC_DMA_TIMT_0_TX_FIRST_PKT_THRESH_LSB -#define MAC_DMA_TIMT_TX_FIRST_PKT_THRESH_MASK MAC_DMA_TIMT_0_TX_FIRST_PKT_THRESH_MASK -#define MAC_DMA_TIMT_TX_LAST_PKT_THRESH_LSB MAC_DMA_TIMT_0_TX_LAST_PKT_THRESH_LSB -#define MAC_DMA_TIMT_TX_LAST_PKT_THRESH_MASK MAC_DMA_TIMT_0_TX_LAST_PKT_THRESH_MASK -#define MAC_DMA_TIMT_ADDRESS MAC_DMA_TIMT_0_ADDRESS -#define MAC_DMA_TIMT_ADDR(_i) (MAC_DMA_TIMT_0_ADDRESS + ((_i)<<2)) - -#define MAC_QCU_CNT_ADDR(_i) (MAC_QCU_CNT_ADDRESS + ((_i)<<2)) - -#define MAC_DCU_MISC_ADDR(_i) (MAC_DCU_MISC_ADDRESS + ((_i)<<2)) -#define MAC_DCU_MISC_FRAG_BURST_WAIT_EN_MASK MAC_DCU_MISC_FRAG_BURST_WAIT_QCU_EN_MASK - -#define MAC_QCU_TXDP_ADDR(_i) (MAC_QCU_TXDP_ADDRESS + ((_i)<<2)) - -#define MAC_DCU_QCUMASK_ADDR(_i) (MAC_DCU_QCUMASK_ADDRESS + ((_i)<<2)) - -#define MAC_DCU_LCL_IFS_ADDR(_i) (MAC_DCU_LCL_IFS_ADDRESS + ((_i)<<2)) - -#define MAC_DCU_RETRY_LIMIT_ADDR(_i) (MAC_DCU_RETRY_LIMIT_ADDRESS + ((_i)<<2)) - -#define MAC_QCU_MISC_ADDR(_i) (MAC_QCU_MISC_ADDRESS + ((_i)<<2)) -#define MAC_QCU_MISC_FSP_ASAP 0 // ASAP -#define MAC_QCU_MISC_FSP_CBR 1 // CBR -#define MAC_QCU_MISC_FSP_DBA_GATED 2 // DMA Beacon Alert gated -#define MAC_QCU_MISC_FSP_TIM_GATED 3 // TIM gated -#define MAC_QCU_MISC_FSP_BEACON_SENT_GATED 4 // Beacon-sent-gated -#define MAC_QCU_MISC_FSP_BEACON_RCVD_GATED 5 // Beacon-received-gated - -#define MAC_DCU_MISC_ADDR(_i) (MAC_DCU_MISC_ADDRESS + ((_i)<<2)) -#define MAC_DCU_MISC_VIR_COL_HANDLING_DEFAULT 0 // Normal -#define MAC_DCU_MISC_VIR_COL_HANDLING_IGNORE 1 // Ignore - -#define MAC_QCU_CBR_ADDR(_i) (MAC_QCU_CBR_ADDRESS + ((_i)<<2)) - -#define MAC_QCU_RDYTIME_ADDR(_i) (MAC_QCU_RDYTIME_ADDRESS + ((_i)<<2)) - -#define MAC_DMA_MIBC_MCS_MSB MAC_DMA_MIBC_STROBE_MSB -#define MAC_DMA_MIBC_MCS_LSB MAC_DMA_MIBC_STROBE_LSB -#define MAC_DMA_MIBC_MCS_MASK MAC_DMA_MIBC_STROBE_MASK -#define MAC_DMA_MIBC_MCS_GET(x) MAC_DMA_MIBC_STROBE_GET(x) -#define MAC_DMA_MIBC_MCS_SET(x) MAC_DMA_MIBC_STROBE_SET(x) -#define MAC_DMA_MIBC_CMC_MSB MAC_DMA_MIBC_CLEAR_MSB -#define MAC_DMA_MIBC_CMC_LSB MAC_DMA_MIBC_CLEAR_LSB -#define MAC_DMA_MIBC_CMC_MASK MAC_DMA_MIBC_CLEAR_MASK -#define MAC_DMA_MIBC_CMC_GET(x) MAC_DMA_MIBC_CLEAR_GET(x) -#define MAC_DMA_MIBC_CMC_SET(x) MAC_DMA_MIBC_CLEAR_SET(x) -#define MAC_DMA_MIBC_FMC_MSB MAC_DMA_MIBC_FREEZE_MSB -#define MAC_DMA_MIBC_FMC_LSB MAC_DMA_MIBC_FREEZE_LSB -#define MAC_DMA_MIBC_FMC_MASK MAC_DMA_MIBC_FREEZE_MASK -#define MAC_DMA_MIBC_FMC_GET(x) MAC_DMA_MIBC_FREEZE_GET(x) -#define MAC_DMA_MIBC_FMC_SET(x) MAC_DMA_MIBC_FREEZE_SET(x) -#define MAC_DMA_MIBC_COW_MSB MAC_DMA_MIBC_WARNING_MSB -#define MAC_DMA_MIBC_COW_LSB MAC_DMA_MIBC_WARNING_LSB -#define MAC_DMA_MIBC_COW_MASK MAC_DMA_MIBC_WARNING_MASK -#define MAC_DMA_MIBC_COW_GET(x) MAC_DMA_MIBC_WARNING_GET(x) -#define MAC_DMA_MIBC_COW_SET(x) MAC_DMA_MIBC_WARNING_SET(x) - -#endif /*__MAC_DMA_REG_SW_H */ - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mac_pcu_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mac_pcu_reg.h deleted file mode 100644 index 0a3e2c6cbea0..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mac_pcu_reg.h +++ /dev/null @@ -1,40 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -#ifndef __MAC_PCU_REG_SW_H -#define __MAC_PCU_REG_SW_H -#include "wmac_pcu_reg.h" - -// THIS IS A SOFTWARE WRAPPER HEADER FILE - - -#define MAC_PCU_BCN_RSSI_AVE_VALUE_MSB MAC_PCU_BCN_RSSI_AVE_AVE_VALUE_MSB -#define MAC_PCU_BCN_RSSI_AVE_VALUE_LSB MAC_PCU_BCN_RSSI_AVE_AVE_VALUE_LSB -#define MAC_PCU_BCN_RSSI_AVE_VALUE_MASK MAC_PCU_BCN_RSSI_AVE_AVE_VALUE_MASK -#define MAC_PCU_BCN_RSSI_AVE_VALUE_GET(x) MAC_PCU_BCN_RSSI_AVE_AVE_VALUE_GET(x) -#define MAC_PCU_BCN_RSSI_AVE_VALUE_SET(x) MAC_PCU_BCN_RSSI_AVE_AVE_VALUE_SET(x) - - -#endif /*__MAC_PCU_REG_SW_H */ - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/map_rf_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/map_rf_reg.h deleted file mode 100644 index 3bc99167c30d..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/map_rf_reg.h +++ /dev/null @@ -1,199 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _MAP_RF_REG_REG_H_ -#define _MAP_RF_REG_REG_H_ - - -/* macros for RAM1 */ -#define RAM1_ADDRESS 0x00000000 -#define RAM1_OFFSET 0x00000000 -#define RAM1_DATA_MSB 7 -#define RAM1_DATA_LSB 0 -#define RAM1_DATA_MASK 0x000000ff -#define RAM1_DATA_GET(x) (((x) & 0x000000ff) >> 0) -#define RAM1_DATA_SET(x) (((x) << 0) & 0x000000ff) - -/* macros for INT_PENDING */ -#define INT_PENDING_ADDRESS 0x00000400 -#define INT_PENDING_OFFSET 0x00000400 -#define INT_PENDING_REG_MSB 31 -#define INT_PENDING_REG_LSB 0 -#define INT_PENDING_REG_MASK 0xffffffff -#define INT_PENDING_REG_GET(x) (((x) & 0xffffffff) >> 0) -#define INT_PENDING_REG_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_WR_MASK_0 */ -#define BB_WR_MASK_0_ADDRESS 0x00000430 -#define BB_WR_MASK_0_OFFSET 0x00000430 -#define BB_WR_MASK_0_REG_MSB 31 -#define BB_WR_MASK_0_REG_LSB 0 -#define BB_WR_MASK_0_REG_MASK 0xffffffff -#define BB_WR_MASK_0_REG_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_WR_MASK_0_REG_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_WR_MASK_1 */ -#define BB_WR_MASK_1_ADDRESS 0x00000434 -#define BB_WR_MASK_1_OFFSET 0x00000434 -#define BB_WR_MASK_1_REG_MSB 31 -#define BB_WR_MASK_1_REG_LSB 0 -#define BB_WR_MASK_1_REG_MASK 0xffffffff -#define BB_WR_MASK_1_REG_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_WR_MASK_1_REG_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_WR_MASK_2 */ -#define BB_WR_MASK_2_ADDRESS 0x00000438 -#define BB_WR_MASK_2_OFFSET 0x00000438 -#define BB_WR_MASK_2_REG_MSB 31 -#define BB_WR_MASK_2_REG_LSB 0 -#define BB_WR_MASK_2_REG_MASK 0xffffffff -#define BB_WR_MASK_2_REG_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_WR_MASK_2_REG_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_WR_MASK_3 */ -#define BB_WR_MASK_3_ADDRESS 0x0000043c -#define BB_WR_MASK_3_OFFSET 0x0000043c -#define BB_WR_MASK_3_REG_MSB 10 -#define BB_WR_MASK_3_REG_LSB 0 -#define BB_WR_MASK_3_REG_MASK 0x000007ff -#define BB_WR_MASK_3_REG_GET(x) (((x) & 0x000007ff) >> 0) -#define BB_WR_MASK_3_REG_SET(x) (((x) << 0) & 0x000007ff) - -/* macros for RF_WR_MASK_0 */ -#define RF_WR_MASK_0_ADDRESS 0x00000440 -#define RF_WR_MASK_0_OFFSET 0x00000440 -#define RF_WR_MASK_0_REG_MSB 31 -#define RF_WR_MASK_0_REG_LSB 0 -#define RF_WR_MASK_0_REG_MASK 0xffffffff -#define RF_WR_MASK_0_REG_GET(x) (((x) & 0xffffffff) >> 0) -#define RF_WR_MASK_0_REG_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for RF_WR_MASK_1 */ -#define RF_WR_MASK_1_ADDRESS 0x00000444 -#define RF_WR_MASK_1_OFFSET 0x00000444 -#define RF_WR_MASK_1_REG_MSB 8 -#define RF_WR_MASK_1_REG_LSB 0 -#define RF_WR_MASK_1_REG_MASK 0x000001ff -#define RF_WR_MASK_1_REG_GET(x) (((x) & 0x000001ff) >> 0) -#define RF_WR_MASK_1_REG_SET(x) (((x) << 0) & 0x000001ff) - -/* macros for BB_RD_MASK_0 */ -#define BB_RD_MASK_0_ADDRESS 0x00000448 -#define BB_RD_MASK_0_OFFSET 0x00000448 -#define BB_RD_MASK_0_REG_MSB 31 -#define BB_RD_MASK_0_REG_LSB 0 -#define BB_RD_MASK_0_REG_MASK 0xffffffff -#define BB_RD_MASK_0_REG_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_RD_MASK_0_REG_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_RD_MASK_1 */ -#define BB_RD_MASK_1_ADDRESS 0x0000044c -#define BB_RD_MASK_1_OFFSET 0x0000044c -#define BB_RD_MASK_1_REG_MSB 31 -#define BB_RD_MASK_1_REG_LSB 0 -#define BB_RD_MASK_1_REG_MASK 0xffffffff -#define BB_RD_MASK_1_REG_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_RD_MASK_1_REG_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_RD_MASK_2 */ -#define BB_RD_MASK_2_ADDRESS 0x00000450 -#define BB_RD_MASK_2_OFFSET 0x00000450 -#define BB_RD_MASK_2_REG_MSB 31 -#define BB_RD_MASK_2_REG_LSB 0 -#define BB_RD_MASK_2_REG_MASK 0xffffffff -#define BB_RD_MASK_2_REG_GET(x) (((x) & 0xffffffff) >> 0) -#define BB_RD_MASK_2_REG_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for BB_RD_MASK_3 */ -#define BB_RD_MASK_3_ADDRESS 0x00000454 -#define BB_RD_MASK_3_OFFSET 0x00000454 -#define BB_RD_MASK_3_REG_MSB 10 -#define BB_RD_MASK_3_REG_LSB 0 -#define BB_RD_MASK_3_REG_MASK 0x000007ff -#define BB_RD_MASK_3_REG_GET(x) (((x) & 0x000007ff) >> 0) -#define BB_RD_MASK_3_REG_SET(x) (((x) << 0) & 0x000007ff) - -/* macros for RF_RD_MASK_0 */ -#define RF_RD_MASK_0_ADDRESS 0x00000458 -#define RF_RD_MASK_0_OFFSET 0x00000458 -#define RF_RD_MASK_0_REG_MSB 31 -#define RF_RD_MASK_0_REG_LSB 0 -#define RF_RD_MASK_0_REG_MASK 0xffffffff -#define RF_RD_MASK_0_REG_GET(x) (((x) & 0xffffffff) >> 0) -#define RF_RD_MASK_0_REG_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for RF_RD_MASK_1 */ -#define RF_RD_MASK_1_ADDRESS 0x0000045c -#define RF_RD_MASK_1_OFFSET 0x0000045c -#define RF_RD_MASK_1_REG_MSB 8 -#define RF_RD_MASK_1_REG_LSB 0 -#define RF_RD_MASK_1_REG_MASK 0x000001ff -#define RF_RD_MASK_1_REG_GET(x) (((x) & 0x000001ff) >> 0) -#define RF_RD_MASK_1_REG_SET(x) (((x) << 0) & 0x000001ff) - -/* macros for INT_SRC */ -#define INT_SRC_ADDRESS 0x00000460 -#define INT_SRC_OFFSET 0x00000460 -#define INT_SRC_REG_MSB 11 -#define INT_SRC_REG_LSB 0 -#define INT_SRC_REG_MASK 0x00000fff -#define INT_SRC_REG_GET(x) (((x) & 0x00000fff) >> 0) - -/* macros for RAM2 */ -#define RAM2_ADDRESS 0x00000800 -#define RAM2_OFFSET 0x00000800 -#define RAM2_DATA_MSB 6 -#define RAM2_DATA_LSB 0 -#define RAM2_DATA_MASK 0x0000007f -#define RAM2_DATA_GET(x) (((x) & 0x0000007f) >> 0) -#define RAM2_DATA_SET(x) (((x) << 0) & 0x0000007f) - - -#ifndef __ASSEMBLER__ - -typedef struct map_rf_reg_reg_s { - volatile unsigned int RAM1[256]; /* 0x0 - 0x400 */ - volatile unsigned int INT_PENDING[12]; /* 0x400 - 0x430 */ - volatile unsigned int BB_WR_MASK_0; /* 0x430 - 0x434 */ - volatile unsigned int BB_WR_MASK_1; /* 0x434 - 0x438 */ - volatile unsigned int BB_WR_MASK_2; /* 0x438 - 0x43c */ - volatile unsigned int BB_WR_MASK_3; /* 0x43c - 0x440 */ - volatile unsigned int RF_WR_MASK_0; /* 0x440 - 0x444 */ - volatile unsigned int RF_WR_MASK_1; /* 0x444 - 0x448 */ - volatile unsigned int BB_RD_MASK_0; /* 0x448 - 0x44c */ - volatile unsigned int BB_RD_MASK_1; /* 0x44c - 0x450 */ - volatile unsigned int BB_RD_MASK_2; /* 0x450 - 0x454 */ - volatile unsigned int BB_RD_MASK_3; /* 0x454 - 0x458 */ - volatile unsigned int RF_RD_MASK_0; /* 0x458 - 0x45c */ - volatile unsigned int RF_RD_MASK_1; /* 0x45c - 0x460 */ - volatile unsigned int INT_SRC; /* 0x460 - 0x464 */ - volatile char pad__0[0x39c]; /* 0x464 - 0x800 */ - volatile unsigned int RAM2[128]; /* 0x800 - 0xa00 */ -} map_rf_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _MAP_RF_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_host_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_host_reg.h deleted file mode 100644 index 7460d94fa39e..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_host_reg.h +++ /dev/null @@ -1,37 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "mbox_wlan_host_reg.h" - - -#ifndef BT_HEADERS - - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_i2s_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_i2s_reg.h deleted file mode 100644 index 51365262b461..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_i2s_reg.h +++ /dev/null @@ -1,299 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _MBOX_REG_REG_H_ -#define _MBOX_REG_REG_H_ - -#define MBOX_FIFO_ADDRESS 0x00000000 -#define MBOX_FIFO_OFFSET 0x00000000 -#define MBOX_FIFO_DATA_MSB 19 -#define MBOX_FIFO_DATA_LSB 0 -#define MBOX_FIFO_DATA_MASK 0x000fffff -#define MBOX_FIFO_DATA_GET(x) (((x) & MBOX_FIFO_DATA_MASK) >> MBOX_FIFO_DATA_LSB) -#define MBOX_FIFO_DATA_SET(x) (((x) << MBOX_FIFO_DATA_LSB) & MBOX_FIFO_DATA_MASK) - -#define MBOX_FIFO_STATUS_ADDRESS 0x00000004 -#define MBOX_FIFO_STATUS_OFFSET 0x00000004 -#define MBOX_FIFO_STATUS_EMPTY_MSB 2 -#define MBOX_FIFO_STATUS_EMPTY_LSB 2 -#define MBOX_FIFO_STATUS_EMPTY_MASK 0x00000004 -#define MBOX_FIFO_STATUS_EMPTY_GET(x) (((x) & MBOX_FIFO_STATUS_EMPTY_MASK) >> MBOX_FIFO_STATUS_EMPTY_LSB) -#define MBOX_FIFO_STATUS_EMPTY_SET(x) (((x) << MBOX_FIFO_STATUS_EMPTY_LSB) & MBOX_FIFO_STATUS_EMPTY_MASK) -#define MBOX_FIFO_STATUS_FULL_MSB 0 -#define MBOX_FIFO_STATUS_FULL_LSB 0 -#define MBOX_FIFO_STATUS_FULL_MASK 0x00000001 -#define MBOX_FIFO_STATUS_FULL_GET(x) (((x) & MBOX_FIFO_STATUS_FULL_MASK) >> MBOX_FIFO_STATUS_FULL_LSB) -#define MBOX_FIFO_STATUS_FULL_SET(x) (((x) << MBOX_FIFO_STATUS_FULL_LSB) & MBOX_FIFO_STATUS_FULL_MASK) - -#define MBOX_DMA_POLICY_ADDRESS 0x00000008 -#define MBOX_DMA_POLICY_OFFSET 0x00000008 -#define MBOX_DMA_POLICY_TX_FIFO_THRESH0_MSB 7 -#define MBOX_DMA_POLICY_TX_FIFO_THRESH0_LSB 4 -#define MBOX_DMA_POLICY_TX_FIFO_THRESH0_MASK 0x000000f0 -#define MBOX_DMA_POLICY_TX_FIFO_THRESH0_GET(x) (((x) & MBOX_DMA_POLICY_TX_FIFO_THRESH0_MASK) >> MBOX_DMA_POLICY_TX_FIFO_THRESH0_LSB) -#define MBOX_DMA_POLICY_TX_FIFO_THRESH0_SET(x) (((x) << MBOX_DMA_POLICY_TX_FIFO_THRESH0_LSB) & MBOX_DMA_POLICY_TX_FIFO_THRESH0_MASK) -#define MBOX_DMA_POLICY_TX_QUANTUM_MSB 3 -#define MBOX_DMA_POLICY_TX_QUANTUM_LSB 3 -#define MBOX_DMA_POLICY_TX_QUANTUM_MASK 0x00000008 -#define MBOX_DMA_POLICY_TX_QUANTUM_GET(x) (((x) & MBOX_DMA_POLICY_TX_QUANTUM_MASK) >> MBOX_DMA_POLICY_TX_QUANTUM_LSB) -#define MBOX_DMA_POLICY_TX_QUANTUM_SET(x) (((x) << MBOX_DMA_POLICY_TX_QUANTUM_LSB) & MBOX_DMA_POLICY_TX_QUANTUM_MASK) -#define MBOX_DMA_POLICY_TX_ORDER_MSB 2 -#define MBOX_DMA_POLICY_TX_ORDER_LSB 2 -#define MBOX_DMA_POLICY_TX_ORDER_MASK 0x00000004 -#define MBOX_DMA_POLICY_TX_ORDER_GET(x) (((x) & MBOX_DMA_POLICY_TX_ORDER_MASK) >> MBOX_DMA_POLICY_TX_ORDER_LSB) -#define MBOX_DMA_POLICY_TX_ORDER_SET(x) (((x) << MBOX_DMA_POLICY_TX_ORDER_LSB) & MBOX_DMA_POLICY_TX_ORDER_MASK) -#define MBOX_DMA_POLICY_RX_QUANTUM_MSB 1 -#define MBOX_DMA_POLICY_RX_QUANTUM_LSB 1 -#define MBOX_DMA_POLICY_RX_QUANTUM_MASK 0x00000002 -#define MBOX_DMA_POLICY_RX_QUANTUM_GET(x) (((x) & MBOX_DMA_POLICY_RX_QUANTUM_MASK) >> MBOX_DMA_POLICY_RX_QUANTUM_LSB) -#define MBOX_DMA_POLICY_RX_QUANTUM_SET(x) (((x) << MBOX_DMA_POLICY_RX_QUANTUM_LSB) & MBOX_DMA_POLICY_RX_QUANTUM_MASK) -#define MBOX_DMA_POLICY_RX_ORDER_MSB 0 -#define MBOX_DMA_POLICY_RX_ORDER_LSB 0 -#define MBOX_DMA_POLICY_RX_ORDER_MASK 0x00000001 -#define MBOX_DMA_POLICY_RX_ORDER_GET(x) (((x) & MBOX_DMA_POLICY_RX_ORDER_MASK) >> MBOX_DMA_POLICY_RX_ORDER_LSB) -#define MBOX_DMA_POLICY_RX_ORDER_SET(x) (((x) << MBOX_DMA_POLICY_RX_ORDER_LSB) & MBOX_DMA_POLICY_RX_ORDER_MASK) - -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x0000000c -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x0000000c -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX0_DMA_RX_CONTROL_ADDRESS 0x00000010 -#define MBOX0_DMA_RX_CONTROL_OFFSET 0x00000010 -#define MBOX0_DMA_RX_CONTROL_RESUME_MSB 2 -#define MBOX0_DMA_RX_CONTROL_RESUME_LSB 2 -#define MBOX0_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX0_DMA_RX_CONTROL_RESUME_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_RESUME_MASK) >> MBOX0_DMA_RX_CONTROL_RESUME_LSB) -#define MBOX0_DMA_RX_CONTROL_RESUME_SET(x) (((x) << MBOX0_DMA_RX_CONTROL_RESUME_LSB) & MBOX0_DMA_RX_CONTROL_RESUME_MASK) -#define MBOX0_DMA_RX_CONTROL_START_MSB 1 -#define MBOX0_DMA_RX_CONTROL_START_LSB 1 -#define MBOX0_DMA_RX_CONTROL_START_MASK 0x00000002 -#define MBOX0_DMA_RX_CONTROL_START_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_START_MASK) >> MBOX0_DMA_RX_CONTROL_START_LSB) -#define MBOX0_DMA_RX_CONTROL_START_SET(x) (((x) << MBOX0_DMA_RX_CONTROL_START_LSB) & MBOX0_DMA_RX_CONTROL_START_MASK) -#define MBOX0_DMA_RX_CONTROL_STOP_MSB 0 -#define MBOX0_DMA_RX_CONTROL_STOP_LSB 0 -#define MBOX0_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define MBOX0_DMA_RX_CONTROL_STOP_GET(x) (((x) & MBOX0_DMA_RX_CONTROL_STOP_MASK) >> MBOX0_DMA_RX_CONTROL_STOP_LSB) -#define MBOX0_DMA_RX_CONTROL_STOP_SET(x) (((x) << MBOX0_DMA_RX_CONTROL_STOP_LSB) & MBOX0_DMA_RX_CONTROL_STOP_MASK) - -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000014 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000014 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define MBOX0_DMA_TX_CONTROL_ADDRESS 0x00000018 -#define MBOX0_DMA_TX_CONTROL_OFFSET 0x00000018 -#define MBOX0_DMA_TX_CONTROL_RESUME_MSB 2 -#define MBOX0_DMA_TX_CONTROL_RESUME_LSB 2 -#define MBOX0_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define MBOX0_DMA_TX_CONTROL_RESUME_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_RESUME_MASK) >> MBOX0_DMA_TX_CONTROL_RESUME_LSB) -#define MBOX0_DMA_TX_CONTROL_RESUME_SET(x) (((x) << MBOX0_DMA_TX_CONTROL_RESUME_LSB) & MBOX0_DMA_TX_CONTROL_RESUME_MASK) -#define MBOX0_DMA_TX_CONTROL_START_MSB 1 -#define MBOX0_DMA_TX_CONTROL_START_LSB 1 -#define MBOX0_DMA_TX_CONTROL_START_MASK 0x00000002 -#define MBOX0_DMA_TX_CONTROL_START_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_START_MASK) >> MBOX0_DMA_TX_CONTROL_START_LSB) -#define MBOX0_DMA_TX_CONTROL_START_SET(x) (((x) << MBOX0_DMA_TX_CONTROL_START_LSB) & MBOX0_DMA_TX_CONTROL_START_MASK) -#define MBOX0_DMA_TX_CONTROL_STOP_MSB 0 -#define MBOX0_DMA_TX_CONTROL_STOP_LSB 0 -#define MBOX0_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define MBOX0_DMA_TX_CONTROL_STOP_GET(x) (((x) & MBOX0_DMA_TX_CONTROL_STOP_MASK) >> MBOX0_DMA_TX_CONTROL_STOP_LSB) -#define MBOX0_DMA_TX_CONTROL_STOP_SET(x) (((x) << MBOX0_DMA_TX_CONTROL_STOP_LSB) & MBOX0_DMA_TX_CONTROL_STOP_MASK) - -#define MBOX_FRAME_ADDRESS 0x0000001c -#define MBOX_FRAME_OFFSET 0x0000001c -#define MBOX_FRAME_RX_EOM_MSB 2 -#define MBOX_FRAME_RX_EOM_LSB 2 -#define MBOX_FRAME_RX_EOM_MASK 0x00000004 -#define MBOX_FRAME_RX_EOM_GET(x) (((x) & MBOX_FRAME_RX_EOM_MASK) >> MBOX_FRAME_RX_EOM_LSB) -#define MBOX_FRAME_RX_EOM_SET(x) (((x) << MBOX_FRAME_RX_EOM_LSB) & MBOX_FRAME_RX_EOM_MASK) -#define MBOX_FRAME_RX_SOM_MSB 0 -#define MBOX_FRAME_RX_SOM_LSB 0 -#define MBOX_FRAME_RX_SOM_MASK 0x00000001 -#define MBOX_FRAME_RX_SOM_GET(x) (((x) & MBOX_FRAME_RX_SOM_MASK) >> MBOX_FRAME_RX_SOM_LSB) -#define MBOX_FRAME_RX_SOM_SET(x) (((x) << MBOX_FRAME_RX_SOM_LSB) & MBOX_FRAME_RX_SOM_MASK) - -#define FIFO_TIMEOUT_ADDRESS 0x00000020 -#define FIFO_TIMEOUT_OFFSET 0x00000020 -#define FIFO_TIMEOUT_ENABLE_MSB 8 -#define FIFO_TIMEOUT_ENABLE_LSB 8 -#define FIFO_TIMEOUT_ENABLE_MASK 0x00000100 -#define FIFO_TIMEOUT_ENABLE_GET(x) (((x) & FIFO_TIMEOUT_ENABLE_MASK) >> FIFO_TIMEOUT_ENABLE_LSB) -#define FIFO_TIMEOUT_ENABLE_SET(x) (((x) << FIFO_TIMEOUT_ENABLE_LSB) & FIFO_TIMEOUT_ENABLE_MASK) -#define FIFO_TIMEOUT_VALUE_MSB 7 -#define FIFO_TIMEOUT_VALUE_LSB 0 -#define FIFO_TIMEOUT_VALUE_MASK 0x000000ff -#define FIFO_TIMEOUT_VALUE_GET(x) (((x) & FIFO_TIMEOUT_VALUE_MASK) >> FIFO_TIMEOUT_VALUE_LSB) -#define FIFO_TIMEOUT_VALUE_SET(x) (((x) << FIFO_TIMEOUT_VALUE_LSB) & FIFO_TIMEOUT_VALUE_MASK) - -#define MBOX_INT_STATUS_ADDRESS 0x00000024 -#define MBOX_INT_STATUS_OFFSET 0x00000024 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_MSB 10 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB 10 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK 0x00000400 -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) >> MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) (((x) << MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) & MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB 8 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB 8 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK 0x00000100 -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) >> MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) (((x) << MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) & MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_MSB 6 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB 6 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK 0x00000040 -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) >> MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) (((x) << MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) & MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) -#define MBOX_INT_STATUS_TX_OVERFLOW_MSB 5 -#define MBOX_INT_STATUS_TX_OVERFLOW_LSB 5 -#define MBOX_INT_STATUS_TX_OVERFLOW_MASK 0x00000020 -#define MBOX_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & MBOX_INT_STATUS_TX_OVERFLOW_MASK) >> MBOX_INT_STATUS_TX_OVERFLOW_LSB) -#define MBOX_INT_STATUS_TX_OVERFLOW_SET(x) (((x) << MBOX_INT_STATUS_TX_OVERFLOW_LSB) & MBOX_INT_STATUS_TX_OVERFLOW_MASK) -#define MBOX_INT_STATUS_RX_UNDERFLOW_MSB 4 -#define MBOX_INT_STATUS_RX_UNDERFLOW_LSB 4 -#define MBOX_INT_STATUS_RX_UNDERFLOW_MASK 0x00000010 -#define MBOX_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & MBOX_INT_STATUS_RX_UNDERFLOW_MASK) >> MBOX_INT_STATUS_RX_UNDERFLOW_LSB) -#define MBOX_INT_STATUS_RX_UNDERFLOW_SET(x) (((x) << MBOX_INT_STATUS_RX_UNDERFLOW_LSB) & MBOX_INT_STATUS_RX_UNDERFLOW_MASK) -#define MBOX_INT_STATUS_TX_NOT_EMPTY_MSB 2 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_LSB 2 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_MASK 0x00000004 -#define MBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) (((x) & MBOX_INT_STATUS_TX_NOT_EMPTY_MASK) >> MBOX_INT_STATUS_TX_NOT_EMPTY_LSB) -#define MBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) (((x) << MBOX_INT_STATUS_TX_NOT_EMPTY_LSB) & MBOX_INT_STATUS_TX_NOT_EMPTY_MASK) -#define MBOX_INT_STATUS_RX_NOT_FULL_MSB 0 -#define MBOX_INT_STATUS_RX_NOT_FULL_LSB 0 -#define MBOX_INT_STATUS_RX_NOT_FULL_MASK 0x00000001 -#define MBOX_INT_STATUS_RX_NOT_FULL_GET(x) (((x) & MBOX_INT_STATUS_RX_NOT_FULL_MASK) >> MBOX_INT_STATUS_RX_NOT_FULL_LSB) -#define MBOX_INT_STATUS_RX_NOT_FULL_SET(x) (((x) << MBOX_INT_STATUS_RX_NOT_FULL_LSB) & MBOX_INT_STATUS_RX_NOT_FULL_MASK) - -#define MBOX_INT_ENABLE_ADDRESS 0x00000028 -#define MBOX_INT_ENABLE_OFFSET 0x00000028 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB 10 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB 10 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK 0x00000400 -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) >> MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) (((x) << MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) & MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB 8 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB 8 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK 0x00000100 -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) >> MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) (((x) << MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) & MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB 6 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB 6 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK 0x00000040 -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) (((x) & MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) >> MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) (((x) << MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) & MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) -#define MBOX_INT_ENABLE_TX_OVERFLOW_MSB 5 -#define MBOX_INT_ENABLE_TX_OVERFLOW_LSB 5 -#define MBOX_INT_ENABLE_TX_OVERFLOW_MASK 0x00000020 -#define MBOX_INT_ENABLE_TX_OVERFLOW_GET(x) (((x) & MBOX_INT_ENABLE_TX_OVERFLOW_MASK) >> MBOX_INT_ENABLE_TX_OVERFLOW_LSB) -#define MBOX_INT_ENABLE_TX_OVERFLOW_SET(x) (((x) << MBOX_INT_ENABLE_TX_OVERFLOW_LSB) & MBOX_INT_ENABLE_TX_OVERFLOW_MASK) -#define MBOX_INT_ENABLE_RX_UNDERFLOW_MSB 4 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_LSB 4 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_MASK 0x00000010 -#define MBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) (((x) & MBOX_INT_ENABLE_RX_UNDERFLOW_MASK) >> MBOX_INT_ENABLE_RX_UNDERFLOW_LSB) -#define MBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) (((x) << MBOX_INT_ENABLE_RX_UNDERFLOW_LSB) & MBOX_INT_ENABLE_RX_UNDERFLOW_MASK) -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_MSB 2 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB 2 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK 0x00000004 -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) (((x) & MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) >> MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) (((x) << MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) & MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) -#define MBOX_INT_ENABLE_RX_NOT_FULL_MSB 0 -#define MBOX_INT_ENABLE_RX_NOT_FULL_LSB 0 -#define MBOX_INT_ENABLE_RX_NOT_FULL_MASK 0x00000001 -#define MBOX_INT_ENABLE_RX_NOT_FULL_GET(x) (((x) & MBOX_INT_ENABLE_RX_NOT_FULL_MASK) >> MBOX_INT_ENABLE_RX_NOT_FULL_LSB) -#define MBOX_INT_ENABLE_RX_NOT_FULL_SET(x) (((x) << MBOX_INT_ENABLE_RX_NOT_FULL_LSB) & MBOX_INT_ENABLE_RX_NOT_FULL_MASK) - -#define MBOX_FIFO_RESET_ADDRESS 0x0000002c -#define MBOX_FIFO_RESET_OFFSET 0x0000002c -#define MBOX_FIFO_RESET_RX_INIT_MSB 2 -#define MBOX_FIFO_RESET_RX_INIT_LSB 2 -#define MBOX_FIFO_RESET_RX_INIT_MASK 0x00000004 -#define MBOX_FIFO_RESET_RX_INIT_GET(x) (((x) & MBOX_FIFO_RESET_RX_INIT_MASK) >> MBOX_FIFO_RESET_RX_INIT_LSB) -#define MBOX_FIFO_RESET_RX_INIT_SET(x) (((x) << MBOX_FIFO_RESET_RX_INIT_LSB) & MBOX_FIFO_RESET_RX_INIT_MASK) -#define MBOX_FIFO_RESET_TX_INIT_MSB 0 -#define MBOX_FIFO_RESET_TX_INIT_LSB 0 -#define MBOX_FIFO_RESET_TX_INIT_MASK 0x00000001 -#define MBOX_FIFO_RESET_TX_INIT_GET(x) (((x) & MBOX_FIFO_RESET_TX_INIT_MASK) >> MBOX_FIFO_RESET_TX_INIT_LSB) -#define MBOX_FIFO_RESET_TX_INIT_SET(x) (((x) << MBOX_FIFO_RESET_TX_INIT_LSB) & MBOX_FIFO_RESET_TX_INIT_MASK) - -#define MBOX_DEBUG_CHAIN0_ADDRESS 0x00000030 -#define MBOX_DEBUG_CHAIN0_OFFSET 0x00000030 -#define MBOX_DEBUG_CHAIN0_ADDRESS_MSB 31 -#define MBOX_DEBUG_CHAIN0_ADDRESS_LSB 0 -#define MBOX_DEBUG_CHAIN0_ADDRESS_MASK 0xffffffff -#define MBOX_DEBUG_CHAIN0_ADDRESS_GET(x) (((x) & MBOX_DEBUG_CHAIN0_ADDRESS_MASK) >> MBOX_DEBUG_CHAIN0_ADDRESS_LSB) -#define MBOX_DEBUG_CHAIN0_ADDRESS_SET(x) (((x) << MBOX_DEBUG_CHAIN0_ADDRESS_LSB) & MBOX_DEBUG_CHAIN0_ADDRESS_MASK) - -#define MBOX_DEBUG_CHAIN1_ADDRESS 0x00000034 -#define MBOX_DEBUG_CHAIN1_OFFSET 0x00000034 -#define MBOX_DEBUG_CHAIN1_ADDRESS_MSB 31 -#define MBOX_DEBUG_CHAIN1_ADDRESS_LSB 0 -#define MBOX_DEBUG_CHAIN1_ADDRESS_MASK 0xffffffff -#define MBOX_DEBUG_CHAIN1_ADDRESS_GET(x) (((x) & MBOX_DEBUG_CHAIN1_ADDRESS_MASK) >> MBOX_DEBUG_CHAIN1_ADDRESS_LSB) -#define MBOX_DEBUG_CHAIN1_ADDRESS_SET(x) (((x) << MBOX_DEBUG_CHAIN1_ADDRESS_LSB) & MBOX_DEBUG_CHAIN1_ADDRESS_MASK) - -#define MBOX_DEBUG_CHAIN0_SIGNALS_ADDRESS 0x00000038 -#define MBOX_DEBUG_CHAIN0_SIGNALS_OFFSET 0x00000038 -#define MBOX_DEBUG_CHAIN0_SIGNALS_COLLECTION_MSB 31 -#define MBOX_DEBUG_CHAIN0_SIGNALS_COLLECTION_LSB 0 -#define MBOX_DEBUG_CHAIN0_SIGNALS_COLLECTION_MASK 0xffffffff -#define MBOX_DEBUG_CHAIN0_SIGNALS_COLLECTION_GET(x) (((x) & MBOX_DEBUG_CHAIN0_SIGNALS_COLLECTION_MASK) >> MBOX_DEBUG_CHAIN0_SIGNALS_COLLECTION_LSB) -#define MBOX_DEBUG_CHAIN0_SIGNALS_COLLECTION_SET(x) (((x) << MBOX_DEBUG_CHAIN0_SIGNALS_COLLECTION_LSB) & MBOX_DEBUG_CHAIN0_SIGNALS_COLLECTION_MASK) - -#define MBOX_DEBUG_CHAIN1_SIGNALS_ADDRESS 0x0000003c -#define MBOX_DEBUG_CHAIN1_SIGNALS_OFFSET 0x0000003c -#define MBOX_DEBUG_CHAIN1_SIGNALS_COLLECTION_MSB 31 -#define MBOX_DEBUG_CHAIN1_SIGNALS_COLLECTION_LSB 0 -#define MBOX_DEBUG_CHAIN1_SIGNALS_COLLECTION_MASK 0xffffffff -#define MBOX_DEBUG_CHAIN1_SIGNALS_COLLECTION_GET(x) (((x) & MBOX_DEBUG_CHAIN1_SIGNALS_COLLECTION_MASK) >> MBOX_DEBUG_CHAIN1_SIGNALS_COLLECTION_LSB) -#define MBOX_DEBUG_CHAIN1_SIGNALS_COLLECTION_SET(x) (((x) << MBOX_DEBUG_CHAIN1_SIGNALS_COLLECTION_LSB) & MBOX_DEBUG_CHAIN1_SIGNALS_COLLECTION_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct mbox_reg_reg_s { - volatile unsigned int mbox_fifo[1]; - volatile unsigned int mbox_fifo_status; - volatile unsigned int mbox_dma_policy; - volatile unsigned int mbox0_dma_rx_descriptor_base; - volatile unsigned int mbox0_dma_rx_control; - volatile unsigned int mbox0_dma_tx_descriptor_base; - volatile unsigned int mbox0_dma_tx_control; - volatile unsigned int mbox_frame; - volatile unsigned int fifo_timeout; - volatile unsigned int mbox_int_status; - volatile unsigned int mbox_int_enable; - volatile unsigned int mbox_fifo_reset; - volatile unsigned int mbox_debug_chain0; - volatile unsigned int mbox_debug_chain1; - volatile unsigned int mbox_debug_chain0_signals; - volatile unsigned int mbox_debug_chain1_signals; -} mbox_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _MBOX_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_reg.h deleted file mode 100644 index ef74f9b2ca20..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_reg.h +++ /dev/null @@ -1,580 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "mbox_wlan_reg.h" - - -#ifndef BT_HEADERS - -#define MBOX_FIFO_ADDRESS WLAN_MBOX_FIFO_ADDRESS -#define MBOX_FIFO_OFFSET WLAN_MBOX_FIFO_OFFSET -#define MBOX_FIFO_DATA_MSB WLAN_MBOX_FIFO_DATA_MSB -#define MBOX_FIFO_DATA_LSB WLAN_MBOX_FIFO_DATA_LSB -#define MBOX_FIFO_DATA_MASK WLAN_MBOX_FIFO_DATA_MASK -#define MBOX_FIFO_DATA_GET(x) WLAN_MBOX_FIFO_DATA_GET(x) -#define MBOX_FIFO_DATA_SET(x) WLAN_MBOX_FIFO_DATA_SET(x) -#define MBOX_FIFO_STATUS_ADDRESS WLAN_MBOX_FIFO_STATUS_ADDRESS -#define MBOX_FIFO_STATUS_OFFSET WLAN_MBOX_FIFO_STATUS_OFFSET -#define MBOX_FIFO_STATUS_EMPTY_MSB WLAN_MBOX_FIFO_STATUS_EMPTY_MSB -#define MBOX_FIFO_STATUS_EMPTY_LSB WLAN_MBOX_FIFO_STATUS_EMPTY_LSB -#define MBOX_FIFO_STATUS_EMPTY_MASK WLAN_MBOX_FIFO_STATUS_EMPTY_MASK -#define MBOX_FIFO_STATUS_EMPTY_GET(x) WLAN_MBOX_FIFO_STATUS_EMPTY_GET(x) -#define MBOX_FIFO_STATUS_EMPTY_SET(x) WLAN_MBOX_FIFO_STATUS_EMPTY_SET(x) -#define MBOX_FIFO_STATUS_FULL_MSB WLAN_MBOX_FIFO_STATUS_FULL_MSB -#define MBOX_FIFO_STATUS_FULL_LSB WLAN_MBOX_FIFO_STATUS_FULL_LSB -#define MBOX_FIFO_STATUS_FULL_MASK WLAN_MBOX_FIFO_STATUS_FULL_MASK -#define MBOX_FIFO_STATUS_FULL_GET(x) WLAN_MBOX_FIFO_STATUS_FULL_GET(x) -#define MBOX_FIFO_STATUS_FULL_SET(x) WLAN_MBOX_FIFO_STATUS_FULL_SET(x) -#define MBOX_DMA_POLICY_ADDRESS WLAN_MBOX_DMA_POLICY_ADDRESS -#define MBOX_DMA_POLICY_OFFSET WLAN_MBOX_DMA_POLICY_OFFSET -#define MBOX_DMA_POLICY_TX_QUANTUM_MSB WLAN_MBOX_DMA_POLICY_TX_QUANTUM_MSB -#define MBOX_DMA_POLICY_TX_QUANTUM_LSB WLAN_MBOX_DMA_POLICY_TX_QUANTUM_LSB -#define MBOX_DMA_POLICY_TX_QUANTUM_MASK WLAN_MBOX_DMA_POLICY_TX_QUANTUM_MASK -#define MBOX_DMA_POLICY_TX_QUANTUM_GET(x) WLAN_MBOX_DMA_POLICY_TX_QUANTUM_GET(x) -#define MBOX_DMA_POLICY_TX_QUANTUM_SET(x) WLAN_MBOX_DMA_POLICY_TX_QUANTUM_SET(x) -#define MBOX_DMA_POLICY_TX_ORDER_MSB WLAN_MBOX_DMA_POLICY_TX_ORDER_MSB -#define MBOX_DMA_POLICY_TX_ORDER_LSB WLAN_MBOX_DMA_POLICY_TX_ORDER_LSB -#define MBOX_DMA_POLICY_TX_ORDER_MASK WLAN_MBOX_DMA_POLICY_TX_ORDER_MASK -#define MBOX_DMA_POLICY_TX_ORDER_GET(x) WLAN_MBOX_DMA_POLICY_TX_ORDER_GET(x) -#define MBOX_DMA_POLICY_TX_ORDER_SET(x) WLAN_MBOX_DMA_POLICY_TX_ORDER_SET(x) -#define MBOX_DMA_POLICY_RX_QUANTUM_MSB WLAN_MBOX_DMA_POLICY_RX_QUANTUM_MSB -#define MBOX_DMA_POLICY_RX_QUANTUM_LSB WLAN_MBOX_DMA_POLICY_RX_QUANTUM_LSB -#define MBOX_DMA_POLICY_RX_QUANTUM_MASK WLAN_MBOX_DMA_POLICY_RX_QUANTUM_MASK -#define MBOX_DMA_POLICY_RX_QUANTUM_GET(x) WLAN_MBOX_DMA_POLICY_RX_QUANTUM_GET(x) -#define MBOX_DMA_POLICY_RX_QUANTUM_SET(x) WLAN_MBOX_DMA_POLICY_RX_QUANTUM_SET(x) -#define MBOX_DMA_POLICY_RX_ORDER_MSB WLAN_MBOX_DMA_POLICY_RX_ORDER_MSB -#define MBOX_DMA_POLICY_RX_ORDER_LSB WLAN_MBOX_DMA_POLICY_RX_ORDER_LSB -#define MBOX_DMA_POLICY_RX_ORDER_MASK WLAN_MBOX_DMA_POLICY_RX_ORDER_MASK -#define MBOX_DMA_POLICY_RX_ORDER_GET(x) WLAN_MBOX_DMA_POLICY_RX_ORDER_GET(x) -#define MBOX_DMA_POLICY_RX_ORDER_SET(x) WLAN_MBOX_DMA_POLICY_RX_ORDER_SET(x) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX0_DMA_RX_CONTROL_ADDRESS WLAN_MBOX0_DMA_RX_CONTROL_ADDRESS -#define MBOX0_DMA_RX_CONTROL_OFFSET WLAN_MBOX0_DMA_RX_CONTROL_OFFSET -#define MBOX0_DMA_RX_CONTROL_RESUME_MSB WLAN_MBOX0_DMA_RX_CONTROL_RESUME_MSB -#define MBOX0_DMA_RX_CONTROL_RESUME_LSB WLAN_MBOX0_DMA_RX_CONTROL_RESUME_LSB -#define MBOX0_DMA_RX_CONTROL_RESUME_MASK WLAN_MBOX0_DMA_RX_CONTROL_RESUME_MASK -#define MBOX0_DMA_RX_CONTROL_RESUME_GET(x) WLAN_MBOX0_DMA_RX_CONTROL_RESUME_GET(x) -#define MBOX0_DMA_RX_CONTROL_RESUME_SET(x) WLAN_MBOX0_DMA_RX_CONTROL_RESUME_SET(x) -#define MBOX0_DMA_RX_CONTROL_START_MSB WLAN_MBOX0_DMA_RX_CONTROL_START_MSB -#define MBOX0_DMA_RX_CONTROL_START_LSB WLAN_MBOX0_DMA_RX_CONTROL_START_LSB -#define MBOX0_DMA_RX_CONTROL_START_MASK WLAN_MBOX0_DMA_RX_CONTROL_START_MASK -#define MBOX0_DMA_RX_CONTROL_START_GET(x) WLAN_MBOX0_DMA_RX_CONTROL_START_GET(x) -#define MBOX0_DMA_RX_CONTROL_START_SET(x) WLAN_MBOX0_DMA_RX_CONTROL_START_SET(x) -#define MBOX0_DMA_RX_CONTROL_STOP_MSB WLAN_MBOX0_DMA_RX_CONTROL_STOP_MSB -#define MBOX0_DMA_RX_CONTROL_STOP_LSB WLAN_MBOX0_DMA_RX_CONTROL_STOP_LSB -#define MBOX0_DMA_RX_CONTROL_STOP_MASK WLAN_MBOX0_DMA_RX_CONTROL_STOP_MASK -#define MBOX0_DMA_RX_CONTROL_STOP_GET(x) WLAN_MBOX0_DMA_RX_CONTROL_STOP_GET(x) -#define MBOX0_DMA_RX_CONTROL_STOP_SET(x) WLAN_MBOX0_DMA_RX_CONTROL_STOP_SET(x) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX0_DMA_TX_CONTROL_ADDRESS WLAN_MBOX0_DMA_TX_CONTROL_ADDRESS -#define MBOX0_DMA_TX_CONTROL_OFFSET WLAN_MBOX0_DMA_TX_CONTROL_OFFSET -#define MBOX0_DMA_TX_CONTROL_RESUME_MSB WLAN_MBOX0_DMA_TX_CONTROL_RESUME_MSB -#define MBOX0_DMA_TX_CONTROL_RESUME_LSB WLAN_MBOX0_DMA_TX_CONTROL_RESUME_LSB -#define MBOX0_DMA_TX_CONTROL_RESUME_MASK WLAN_MBOX0_DMA_TX_CONTROL_RESUME_MASK -#define MBOX0_DMA_TX_CONTROL_RESUME_GET(x) WLAN_MBOX0_DMA_TX_CONTROL_RESUME_GET(x) -#define MBOX0_DMA_TX_CONTROL_RESUME_SET(x) WLAN_MBOX0_DMA_TX_CONTROL_RESUME_SET(x) -#define MBOX0_DMA_TX_CONTROL_START_MSB WLAN_MBOX0_DMA_TX_CONTROL_START_MSB -#define MBOX0_DMA_TX_CONTROL_START_LSB WLAN_MBOX0_DMA_TX_CONTROL_START_LSB -#define MBOX0_DMA_TX_CONTROL_START_MASK WLAN_MBOX0_DMA_TX_CONTROL_START_MASK -#define MBOX0_DMA_TX_CONTROL_START_GET(x) WLAN_MBOX0_DMA_TX_CONTROL_START_GET(x) -#define MBOX0_DMA_TX_CONTROL_START_SET(x) WLAN_MBOX0_DMA_TX_CONTROL_START_SET(x) -#define MBOX0_DMA_TX_CONTROL_STOP_MSB WLAN_MBOX0_DMA_TX_CONTROL_STOP_MSB -#define MBOX0_DMA_TX_CONTROL_STOP_LSB WLAN_MBOX0_DMA_TX_CONTROL_STOP_LSB -#define MBOX0_DMA_TX_CONTROL_STOP_MASK WLAN_MBOX0_DMA_TX_CONTROL_STOP_MASK -#define MBOX0_DMA_TX_CONTROL_STOP_GET(x) WLAN_MBOX0_DMA_TX_CONTROL_STOP_GET(x) -#define MBOX0_DMA_TX_CONTROL_STOP_SET(x) WLAN_MBOX0_DMA_TX_CONTROL_STOP_SET(x) -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_OFFSET -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX1_DMA_RX_CONTROL_ADDRESS WLAN_MBOX1_DMA_RX_CONTROL_ADDRESS -#define MBOX1_DMA_RX_CONTROL_OFFSET WLAN_MBOX1_DMA_RX_CONTROL_OFFSET -#define MBOX1_DMA_RX_CONTROL_RESUME_MSB WLAN_MBOX1_DMA_RX_CONTROL_RESUME_MSB -#define MBOX1_DMA_RX_CONTROL_RESUME_LSB WLAN_MBOX1_DMA_RX_CONTROL_RESUME_LSB -#define MBOX1_DMA_RX_CONTROL_RESUME_MASK WLAN_MBOX1_DMA_RX_CONTROL_RESUME_MASK -#define MBOX1_DMA_RX_CONTROL_RESUME_GET(x) WLAN_MBOX1_DMA_RX_CONTROL_RESUME_GET(x) -#define MBOX1_DMA_RX_CONTROL_RESUME_SET(x) WLAN_MBOX1_DMA_RX_CONTROL_RESUME_SET(x) -#define MBOX1_DMA_RX_CONTROL_START_MSB WLAN_MBOX1_DMA_RX_CONTROL_START_MSB -#define MBOX1_DMA_RX_CONTROL_START_LSB WLAN_MBOX1_DMA_RX_CONTROL_START_LSB -#define MBOX1_DMA_RX_CONTROL_START_MASK WLAN_MBOX1_DMA_RX_CONTROL_START_MASK -#define MBOX1_DMA_RX_CONTROL_START_GET(x) WLAN_MBOX1_DMA_RX_CONTROL_START_GET(x) -#define MBOX1_DMA_RX_CONTROL_START_SET(x) WLAN_MBOX1_DMA_RX_CONTROL_START_SET(x) -#define MBOX1_DMA_RX_CONTROL_STOP_MSB WLAN_MBOX1_DMA_RX_CONTROL_STOP_MSB -#define MBOX1_DMA_RX_CONTROL_STOP_LSB WLAN_MBOX1_DMA_RX_CONTROL_STOP_LSB -#define MBOX1_DMA_RX_CONTROL_STOP_MASK WLAN_MBOX1_DMA_RX_CONTROL_STOP_MASK -#define MBOX1_DMA_RX_CONTROL_STOP_GET(x) WLAN_MBOX1_DMA_RX_CONTROL_STOP_GET(x) -#define MBOX1_DMA_RX_CONTROL_STOP_SET(x) WLAN_MBOX1_DMA_RX_CONTROL_STOP_SET(x) -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_OFFSET -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX1_DMA_TX_CONTROL_ADDRESS WLAN_MBOX1_DMA_TX_CONTROL_ADDRESS -#define MBOX1_DMA_TX_CONTROL_OFFSET WLAN_MBOX1_DMA_TX_CONTROL_OFFSET -#define MBOX1_DMA_TX_CONTROL_RESUME_MSB WLAN_MBOX1_DMA_TX_CONTROL_RESUME_MSB -#define MBOX1_DMA_TX_CONTROL_RESUME_LSB WLAN_MBOX1_DMA_TX_CONTROL_RESUME_LSB -#define MBOX1_DMA_TX_CONTROL_RESUME_MASK WLAN_MBOX1_DMA_TX_CONTROL_RESUME_MASK -#define MBOX1_DMA_TX_CONTROL_RESUME_GET(x) WLAN_MBOX1_DMA_TX_CONTROL_RESUME_GET(x) -#define MBOX1_DMA_TX_CONTROL_RESUME_SET(x) WLAN_MBOX1_DMA_TX_CONTROL_RESUME_SET(x) -#define MBOX1_DMA_TX_CONTROL_START_MSB WLAN_MBOX1_DMA_TX_CONTROL_START_MSB -#define MBOX1_DMA_TX_CONTROL_START_LSB WLAN_MBOX1_DMA_TX_CONTROL_START_LSB -#define MBOX1_DMA_TX_CONTROL_START_MASK WLAN_MBOX1_DMA_TX_CONTROL_START_MASK -#define MBOX1_DMA_TX_CONTROL_START_GET(x) WLAN_MBOX1_DMA_TX_CONTROL_START_GET(x) -#define MBOX1_DMA_TX_CONTROL_START_SET(x) WLAN_MBOX1_DMA_TX_CONTROL_START_SET(x) -#define MBOX1_DMA_TX_CONTROL_STOP_MSB WLAN_MBOX1_DMA_TX_CONTROL_STOP_MSB -#define MBOX1_DMA_TX_CONTROL_STOP_LSB WLAN_MBOX1_DMA_TX_CONTROL_STOP_LSB -#define MBOX1_DMA_TX_CONTROL_STOP_MASK WLAN_MBOX1_DMA_TX_CONTROL_STOP_MASK -#define MBOX1_DMA_TX_CONTROL_STOP_GET(x) WLAN_MBOX1_DMA_TX_CONTROL_STOP_GET(x) -#define MBOX1_DMA_TX_CONTROL_STOP_SET(x) WLAN_MBOX1_DMA_TX_CONTROL_STOP_SET(x) -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_OFFSET -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX2_DMA_RX_CONTROL_ADDRESS WLAN_MBOX2_DMA_RX_CONTROL_ADDRESS -#define MBOX2_DMA_RX_CONTROL_OFFSET WLAN_MBOX2_DMA_RX_CONTROL_OFFSET -#define MBOX2_DMA_RX_CONTROL_RESUME_MSB WLAN_MBOX2_DMA_RX_CONTROL_RESUME_MSB -#define MBOX2_DMA_RX_CONTROL_RESUME_LSB WLAN_MBOX2_DMA_RX_CONTROL_RESUME_LSB -#define MBOX2_DMA_RX_CONTROL_RESUME_MASK WLAN_MBOX2_DMA_RX_CONTROL_RESUME_MASK -#define MBOX2_DMA_RX_CONTROL_RESUME_GET(x) WLAN_MBOX2_DMA_RX_CONTROL_RESUME_GET(x) -#define MBOX2_DMA_RX_CONTROL_RESUME_SET(x) WLAN_MBOX2_DMA_RX_CONTROL_RESUME_SET(x) -#define MBOX2_DMA_RX_CONTROL_START_MSB WLAN_MBOX2_DMA_RX_CONTROL_START_MSB -#define MBOX2_DMA_RX_CONTROL_START_LSB WLAN_MBOX2_DMA_RX_CONTROL_START_LSB -#define MBOX2_DMA_RX_CONTROL_START_MASK WLAN_MBOX2_DMA_RX_CONTROL_START_MASK -#define MBOX2_DMA_RX_CONTROL_START_GET(x) WLAN_MBOX2_DMA_RX_CONTROL_START_GET(x) -#define MBOX2_DMA_RX_CONTROL_START_SET(x) WLAN_MBOX2_DMA_RX_CONTROL_START_SET(x) -#define MBOX2_DMA_RX_CONTROL_STOP_MSB WLAN_MBOX2_DMA_RX_CONTROL_STOP_MSB -#define MBOX2_DMA_RX_CONTROL_STOP_LSB WLAN_MBOX2_DMA_RX_CONTROL_STOP_LSB -#define MBOX2_DMA_RX_CONTROL_STOP_MASK WLAN_MBOX2_DMA_RX_CONTROL_STOP_MASK -#define MBOX2_DMA_RX_CONTROL_STOP_GET(x) WLAN_MBOX2_DMA_RX_CONTROL_STOP_GET(x) -#define MBOX2_DMA_RX_CONTROL_STOP_SET(x) WLAN_MBOX2_DMA_RX_CONTROL_STOP_SET(x) -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_OFFSET -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX2_DMA_TX_CONTROL_ADDRESS WLAN_MBOX2_DMA_TX_CONTROL_ADDRESS -#define MBOX2_DMA_TX_CONTROL_OFFSET WLAN_MBOX2_DMA_TX_CONTROL_OFFSET -#define MBOX2_DMA_TX_CONTROL_RESUME_MSB WLAN_MBOX2_DMA_TX_CONTROL_RESUME_MSB -#define MBOX2_DMA_TX_CONTROL_RESUME_LSB WLAN_MBOX2_DMA_TX_CONTROL_RESUME_LSB -#define MBOX2_DMA_TX_CONTROL_RESUME_MASK WLAN_MBOX2_DMA_TX_CONTROL_RESUME_MASK -#define MBOX2_DMA_TX_CONTROL_RESUME_GET(x) WLAN_MBOX2_DMA_TX_CONTROL_RESUME_GET(x) -#define MBOX2_DMA_TX_CONTROL_RESUME_SET(x) WLAN_MBOX2_DMA_TX_CONTROL_RESUME_SET(x) -#define MBOX2_DMA_TX_CONTROL_START_MSB WLAN_MBOX2_DMA_TX_CONTROL_START_MSB -#define MBOX2_DMA_TX_CONTROL_START_LSB WLAN_MBOX2_DMA_TX_CONTROL_START_LSB -#define MBOX2_DMA_TX_CONTROL_START_MASK WLAN_MBOX2_DMA_TX_CONTROL_START_MASK -#define MBOX2_DMA_TX_CONTROL_START_GET(x) WLAN_MBOX2_DMA_TX_CONTROL_START_GET(x) -#define MBOX2_DMA_TX_CONTROL_START_SET(x) WLAN_MBOX2_DMA_TX_CONTROL_START_SET(x) -#define MBOX2_DMA_TX_CONTROL_STOP_MSB WLAN_MBOX2_DMA_TX_CONTROL_STOP_MSB -#define MBOX2_DMA_TX_CONTROL_STOP_LSB WLAN_MBOX2_DMA_TX_CONTROL_STOP_LSB -#define MBOX2_DMA_TX_CONTROL_STOP_MASK WLAN_MBOX2_DMA_TX_CONTROL_STOP_MASK -#define MBOX2_DMA_TX_CONTROL_STOP_GET(x) WLAN_MBOX2_DMA_TX_CONTROL_STOP_GET(x) -#define MBOX2_DMA_TX_CONTROL_STOP_SET(x) WLAN_MBOX2_DMA_TX_CONTROL_STOP_SET(x) -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_OFFSET -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX3_DMA_RX_CONTROL_ADDRESS WLAN_MBOX3_DMA_RX_CONTROL_ADDRESS -#define MBOX3_DMA_RX_CONTROL_OFFSET WLAN_MBOX3_DMA_RX_CONTROL_OFFSET -#define MBOX3_DMA_RX_CONTROL_RESUME_MSB WLAN_MBOX3_DMA_RX_CONTROL_RESUME_MSB -#define MBOX3_DMA_RX_CONTROL_RESUME_LSB WLAN_MBOX3_DMA_RX_CONTROL_RESUME_LSB -#define MBOX3_DMA_RX_CONTROL_RESUME_MASK WLAN_MBOX3_DMA_RX_CONTROL_RESUME_MASK -#define MBOX3_DMA_RX_CONTROL_RESUME_GET(x) WLAN_MBOX3_DMA_RX_CONTROL_RESUME_GET(x) -#define MBOX3_DMA_RX_CONTROL_RESUME_SET(x) WLAN_MBOX3_DMA_RX_CONTROL_RESUME_SET(x) -#define MBOX3_DMA_RX_CONTROL_START_MSB WLAN_MBOX3_DMA_RX_CONTROL_START_MSB -#define MBOX3_DMA_RX_CONTROL_START_LSB WLAN_MBOX3_DMA_RX_CONTROL_START_LSB -#define MBOX3_DMA_RX_CONTROL_START_MASK WLAN_MBOX3_DMA_RX_CONTROL_START_MASK -#define MBOX3_DMA_RX_CONTROL_START_GET(x) WLAN_MBOX3_DMA_RX_CONTROL_START_GET(x) -#define MBOX3_DMA_RX_CONTROL_START_SET(x) WLAN_MBOX3_DMA_RX_CONTROL_START_SET(x) -#define MBOX3_DMA_RX_CONTROL_STOP_MSB WLAN_MBOX3_DMA_RX_CONTROL_STOP_MSB -#define MBOX3_DMA_RX_CONTROL_STOP_LSB WLAN_MBOX3_DMA_RX_CONTROL_STOP_LSB -#define MBOX3_DMA_RX_CONTROL_STOP_MASK WLAN_MBOX3_DMA_RX_CONTROL_STOP_MASK -#define MBOX3_DMA_RX_CONTROL_STOP_GET(x) WLAN_MBOX3_DMA_RX_CONTROL_STOP_GET(x) -#define MBOX3_DMA_RX_CONTROL_STOP_SET(x) WLAN_MBOX3_DMA_RX_CONTROL_STOP_SET(x) -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_OFFSET WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_OFFSET -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define MBOX3_DMA_TX_CONTROL_ADDRESS WLAN_MBOX3_DMA_TX_CONTROL_ADDRESS -#define MBOX3_DMA_TX_CONTROL_OFFSET WLAN_MBOX3_DMA_TX_CONTROL_OFFSET -#define MBOX3_DMA_TX_CONTROL_RESUME_MSB WLAN_MBOX3_DMA_TX_CONTROL_RESUME_MSB -#define MBOX3_DMA_TX_CONTROL_RESUME_LSB WLAN_MBOX3_DMA_TX_CONTROL_RESUME_LSB -#define MBOX3_DMA_TX_CONTROL_RESUME_MASK WLAN_MBOX3_DMA_TX_CONTROL_RESUME_MASK -#define MBOX3_DMA_TX_CONTROL_RESUME_GET(x) WLAN_MBOX3_DMA_TX_CONTROL_RESUME_GET(x) -#define MBOX3_DMA_TX_CONTROL_RESUME_SET(x) WLAN_MBOX3_DMA_TX_CONTROL_RESUME_SET(x) -#define MBOX3_DMA_TX_CONTROL_START_MSB WLAN_MBOX3_DMA_TX_CONTROL_START_MSB -#define MBOX3_DMA_TX_CONTROL_START_LSB WLAN_MBOX3_DMA_TX_CONTROL_START_LSB -#define MBOX3_DMA_TX_CONTROL_START_MASK WLAN_MBOX3_DMA_TX_CONTROL_START_MASK -#define MBOX3_DMA_TX_CONTROL_START_GET(x) WLAN_MBOX3_DMA_TX_CONTROL_START_GET(x) -#define MBOX3_DMA_TX_CONTROL_START_SET(x) WLAN_MBOX3_DMA_TX_CONTROL_START_SET(x) -#define MBOX3_DMA_TX_CONTROL_STOP_MSB WLAN_MBOX3_DMA_TX_CONTROL_STOP_MSB -#define MBOX3_DMA_TX_CONTROL_STOP_LSB WLAN_MBOX3_DMA_TX_CONTROL_STOP_LSB -#define MBOX3_DMA_TX_CONTROL_STOP_MASK WLAN_MBOX3_DMA_TX_CONTROL_STOP_MASK -#define MBOX3_DMA_TX_CONTROL_STOP_GET(x) WLAN_MBOX3_DMA_TX_CONTROL_STOP_GET(x) -#define MBOX3_DMA_TX_CONTROL_STOP_SET(x) WLAN_MBOX3_DMA_TX_CONTROL_STOP_SET(x) -#define MBOX_INT_STATUS_ADDRESS WLAN_MBOX_INT_STATUS_ADDRESS -#define MBOX_INT_STATUS_OFFSET WLAN_MBOX_INT_STATUS_OFFSET -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_MSB WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_MSB -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) -#define MBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) -#define MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_MSB WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_MSB -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) -#define MBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) -#define MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_MSB WLAN_MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_MSB -#define MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_LSB WLAN_MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_LSB -#define MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_MASK WLAN_MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_MASK -#define MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_GET(x) WLAN_MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_GET(x) -#define MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_SET(x) WLAN_MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_SET(x) -#define MBOX_INT_STATUS_FRAME_DONE_MSB WLAN_MBOX_INT_STATUS_FRAME_DONE_MSB -#define MBOX_INT_STATUS_FRAME_DONE_LSB WLAN_MBOX_INT_STATUS_FRAME_DONE_LSB -#define MBOX_INT_STATUS_FRAME_DONE_MASK WLAN_MBOX_INT_STATUS_FRAME_DONE_MASK -#define MBOX_INT_STATUS_FRAME_DONE_GET(x) WLAN_MBOX_INT_STATUS_FRAME_DONE_GET(x) -#define MBOX_INT_STATUS_FRAME_DONE_SET(x) WLAN_MBOX_INT_STATUS_FRAME_DONE_SET(x) -#define MBOX_INT_STATUS_TX_OVERFLOW_MSB WLAN_MBOX_INT_STATUS_TX_OVERFLOW_MSB -#define MBOX_INT_STATUS_TX_OVERFLOW_LSB WLAN_MBOX_INT_STATUS_TX_OVERFLOW_LSB -#define MBOX_INT_STATUS_TX_OVERFLOW_MASK WLAN_MBOX_INT_STATUS_TX_OVERFLOW_MASK -#define MBOX_INT_STATUS_TX_OVERFLOW_GET(x) WLAN_MBOX_INT_STATUS_TX_OVERFLOW_GET(x) -#define MBOX_INT_STATUS_TX_OVERFLOW_SET(x) WLAN_MBOX_INT_STATUS_TX_OVERFLOW_SET(x) -#define MBOX_INT_STATUS_RX_UNDERFLOW_MSB WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_MSB -#define MBOX_INT_STATUS_RX_UNDERFLOW_LSB WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_LSB -#define MBOX_INT_STATUS_RX_UNDERFLOW_MASK WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_MASK -#define MBOX_INT_STATUS_RX_UNDERFLOW_GET(x) WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_GET(x) -#define MBOX_INT_STATUS_RX_UNDERFLOW_SET(x) WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_SET(x) -#define MBOX_INT_STATUS_TX_NOT_EMPTY_MSB WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_MSB -#define MBOX_INT_STATUS_TX_NOT_EMPTY_LSB WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_LSB -#define MBOX_INT_STATUS_TX_NOT_EMPTY_MASK WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_MASK -#define MBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) -#define MBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) -#define MBOX_INT_STATUS_RX_NOT_FULL_MSB WLAN_MBOX_INT_STATUS_RX_NOT_FULL_MSB -#define MBOX_INT_STATUS_RX_NOT_FULL_LSB WLAN_MBOX_INT_STATUS_RX_NOT_FULL_LSB -#define MBOX_INT_STATUS_RX_NOT_FULL_MASK WLAN_MBOX_INT_STATUS_RX_NOT_FULL_MASK -#define MBOX_INT_STATUS_RX_NOT_FULL_GET(x) WLAN_MBOX_INT_STATUS_RX_NOT_FULL_GET(x) -#define MBOX_INT_STATUS_RX_NOT_FULL_SET(x) WLAN_MBOX_INT_STATUS_RX_NOT_FULL_SET(x) -#define MBOX_INT_STATUS_HOST_MSB WLAN_MBOX_INT_STATUS_HOST_MSB -#define MBOX_INT_STATUS_HOST_LSB WLAN_MBOX_INT_STATUS_HOST_LSB -#define MBOX_INT_STATUS_HOST_MASK WLAN_MBOX_INT_STATUS_HOST_MASK -#define MBOX_INT_STATUS_HOST_GET(x) WLAN_MBOX_INT_STATUS_HOST_GET(x) -#define MBOX_INT_STATUS_HOST_SET(x) WLAN_MBOX_INT_STATUS_HOST_SET(x) -#define MBOX_INT_ENABLE_ADDRESS WLAN_MBOX_INT_ENABLE_ADDRESS -#define MBOX_INT_ENABLE_OFFSET WLAN_MBOX_INT_ENABLE_OFFSET -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) -#define MBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) -#define MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) -#define MBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) -#define MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_MSB WLAN_MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_MSB -#define MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_LSB WLAN_MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_LSB -#define MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_MASK WLAN_MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_MASK -#define MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_GET(x) WLAN_MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_GET(x) -#define MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_SET(x) WLAN_MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_SET(x) -#define MBOX_INT_ENABLE_FRAME_DONE_MSB WLAN_MBOX_INT_ENABLE_FRAME_DONE_MSB -#define MBOX_INT_ENABLE_FRAME_DONE_LSB WLAN_MBOX_INT_ENABLE_FRAME_DONE_LSB -#define MBOX_INT_ENABLE_FRAME_DONE_MASK WLAN_MBOX_INT_ENABLE_FRAME_DONE_MASK -#define MBOX_INT_ENABLE_FRAME_DONE_GET(x) WLAN_MBOX_INT_ENABLE_FRAME_DONE_GET(x) -#define MBOX_INT_ENABLE_FRAME_DONE_SET(x) WLAN_MBOX_INT_ENABLE_FRAME_DONE_SET(x) -#define MBOX_INT_ENABLE_TX_OVERFLOW_MSB WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_MSB -#define MBOX_INT_ENABLE_TX_OVERFLOW_LSB WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_LSB -#define MBOX_INT_ENABLE_TX_OVERFLOW_MASK WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_MASK -#define MBOX_INT_ENABLE_TX_OVERFLOW_GET(x) WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_GET(x) -#define MBOX_INT_ENABLE_TX_OVERFLOW_SET(x) WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_SET(x) -#define MBOX_INT_ENABLE_RX_UNDERFLOW_MSB WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_MSB -#define MBOX_INT_ENABLE_RX_UNDERFLOW_LSB WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_LSB -#define MBOX_INT_ENABLE_RX_UNDERFLOW_MASK WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_MASK -#define MBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) -#define MBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_MSB WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_MSB -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) -#define MBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) -#define MBOX_INT_ENABLE_RX_NOT_FULL_MSB WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_MSB -#define MBOX_INT_ENABLE_RX_NOT_FULL_LSB WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_LSB -#define MBOX_INT_ENABLE_RX_NOT_FULL_MASK WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_MASK -#define MBOX_INT_ENABLE_RX_NOT_FULL_GET(x) WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_GET(x) -#define MBOX_INT_ENABLE_RX_NOT_FULL_SET(x) WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_SET(x) -#define MBOX_INT_ENABLE_HOST_MSB WLAN_MBOX_INT_ENABLE_HOST_MSB -#define MBOX_INT_ENABLE_HOST_LSB WLAN_MBOX_INT_ENABLE_HOST_LSB -#define MBOX_INT_ENABLE_HOST_MASK WLAN_MBOX_INT_ENABLE_HOST_MASK -#define MBOX_INT_ENABLE_HOST_GET(x) WLAN_MBOX_INT_ENABLE_HOST_GET(x) -#define MBOX_INT_ENABLE_HOST_SET(x) WLAN_MBOX_INT_ENABLE_HOST_SET(x) -#define INT_HOST_ADDRESS WLAN_INT_HOST_ADDRESS -#define INT_HOST_OFFSET WLAN_INT_HOST_OFFSET -#define INT_HOST_VECTOR_MSB WLAN_INT_HOST_VECTOR_MSB -#define INT_HOST_VECTOR_LSB WLAN_INT_HOST_VECTOR_LSB -#define INT_HOST_VECTOR_MASK WLAN_INT_HOST_VECTOR_MASK -#define INT_HOST_VECTOR_GET(x) WLAN_INT_HOST_VECTOR_GET(x) -#define INT_HOST_VECTOR_SET(x) WLAN_INT_HOST_VECTOR_SET(x) -#define LOCAL_COUNT_ADDRESS WLAN_LOCAL_COUNT_ADDRESS -#define LOCAL_COUNT_OFFSET WLAN_LOCAL_COUNT_OFFSET -#define LOCAL_COUNT_VALUE_MSB WLAN_LOCAL_COUNT_VALUE_MSB -#define LOCAL_COUNT_VALUE_LSB WLAN_LOCAL_COUNT_VALUE_LSB -#define LOCAL_COUNT_VALUE_MASK WLAN_LOCAL_COUNT_VALUE_MASK -#define LOCAL_COUNT_VALUE_GET(x) WLAN_LOCAL_COUNT_VALUE_GET(x) -#define LOCAL_COUNT_VALUE_SET(x) WLAN_LOCAL_COUNT_VALUE_SET(x) -#define COUNT_INC_ADDRESS WLAN_COUNT_INC_ADDRESS -#define COUNT_INC_OFFSET WLAN_COUNT_INC_OFFSET -#define COUNT_INC_VALUE_MSB WLAN_COUNT_INC_VALUE_MSB -#define COUNT_INC_VALUE_LSB WLAN_COUNT_INC_VALUE_LSB -#define COUNT_INC_VALUE_MASK WLAN_COUNT_INC_VALUE_MASK -#define COUNT_INC_VALUE_GET(x) WLAN_COUNT_INC_VALUE_GET(x) -#define COUNT_INC_VALUE_SET(x) WLAN_COUNT_INC_VALUE_SET(x) -#define LOCAL_SCRATCH_ADDRESS WLAN_LOCAL_SCRATCH_ADDRESS -#define LOCAL_SCRATCH_OFFSET WLAN_LOCAL_SCRATCH_OFFSET -#define LOCAL_SCRATCH_VALUE_MSB WLAN_LOCAL_SCRATCH_VALUE_MSB -#define LOCAL_SCRATCH_VALUE_LSB WLAN_LOCAL_SCRATCH_VALUE_LSB -#define LOCAL_SCRATCH_VALUE_MASK WLAN_LOCAL_SCRATCH_VALUE_MASK -#define LOCAL_SCRATCH_VALUE_GET(x) WLAN_LOCAL_SCRATCH_VALUE_GET(x) -#define LOCAL_SCRATCH_VALUE_SET(x) WLAN_LOCAL_SCRATCH_VALUE_SET(x) -#define USE_LOCAL_BUS_ADDRESS WLAN_USE_LOCAL_BUS_ADDRESS -#define USE_LOCAL_BUS_OFFSET WLAN_USE_LOCAL_BUS_OFFSET -#define USE_LOCAL_BUS_PIN_INIT_MSB WLAN_USE_LOCAL_BUS_PIN_INIT_MSB -#define USE_LOCAL_BUS_PIN_INIT_LSB WLAN_USE_LOCAL_BUS_PIN_INIT_LSB -#define USE_LOCAL_BUS_PIN_INIT_MASK WLAN_USE_LOCAL_BUS_PIN_INIT_MASK -#define USE_LOCAL_BUS_PIN_INIT_GET(x) WLAN_USE_LOCAL_BUS_PIN_INIT_GET(x) -#define USE_LOCAL_BUS_PIN_INIT_SET(x) WLAN_USE_LOCAL_BUS_PIN_INIT_SET(x) -#define SDIO_CONFIG_ADDRESS WLAN_SDIO_CONFIG_ADDRESS -#define SDIO_CONFIG_OFFSET WLAN_SDIO_CONFIG_OFFSET -#define SDIO_CONFIG_CCCR_IOR1_MSB WLAN_SDIO_CONFIG_CCCR_IOR1_MSB -#define SDIO_CONFIG_CCCR_IOR1_LSB WLAN_SDIO_CONFIG_CCCR_IOR1_LSB -#define SDIO_CONFIG_CCCR_IOR1_MASK WLAN_SDIO_CONFIG_CCCR_IOR1_MASK -#define SDIO_CONFIG_CCCR_IOR1_GET(x) WLAN_SDIO_CONFIG_CCCR_IOR1_GET(x) -#define SDIO_CONFIG_CCCR_IOR1_SET(x) WLAN_SDIO_CONFIG_CCCR_IOR1_SET(x) -#define MBOX_DEBUG_ADDRESS WLAN_MBOX_DEBUG_ADDRESS -#define MBOX_DEBUG_OFFSET WLAN_MBOX_DEBUG_OFFSET -#define MBOX_DEBUG_SEL_MSB WLAN_MBOX_DEBUG_SEL_MSB -#define MBOX_DEBUG_SEL_LSB WLAN_MBOX_DEBUG_SEL_LSB -#define MBOX_DEBUG_SEL_MASK WLAN_MBOX_DEBUG_SEL_MASK -#define MBOX_DEBUG_SEL_GET(x) WLAN_MBOX_DEBUG_SEL_GET(x) -#define MBOX_DEBUG_SEL_SET(x) WLAN_MBOX_DEBUG_SEL_SET(x) -#define MBOX_FIFO_RESET_ADDRESS WLAN_MBOX_FIFO_RESET_ADDRESS -#define MBOX_FIFO_RESET_OFFSET WLAN_MBOX_FIFO_RESET_OFFSET -#define MBOX_FIFO_RESET_INIT_MSB WLAN_MBOX_FIFO_RESET_INIT_MSB -#define MBOX_FIFO_RESET_INIT_LSB WLAN_MBOX_FIFO_RESET_INIT_LSB -#define MBOX_FIFO_RESET_INIT_MASK WLAN_MBOX_FIFO_RESET_INIT_MASK -#define MBOX_FIFO_RESET_INIT_GET(x) WLAN_MBOX_FIFO_RESET_INIT_GET(x) -#define MBOX_FIFO_RESET_INIT_SET(x) WLAN_MBOX_FIFO_RESET_INIT_SET(x) -#define MBOX_TXFIFO_POP_ADDRESS WLAN_MBOX_TXFIFO_POP_ADDRESS -#define MBOX_TXFIFO_POP_OFFSET WLAN_MBOX_TXFIFO_POP_OFFSET -#define MBOX_TXFIFO_POP_DATA_MSB WLAN_MBOX_TXFIFO_POP_DATA_MSB -#define MBOX_TXFIFO_POP_DATA_LSB WLAN_MBOX_TXFIFO_POP_DATA_LSB -#define MBOX_TXFIFO_POP_DATA_MASK WLAN_MBOX_TXFIFO_POP_DATA_MASK -#define MBOX_TXFIFO_POP_DATA_GET(x) WLAN_MBOX_TXFIFO_POP_DATA_GET(x) -#define MBOX_TXFIFO_POP_DATA_SET(x) WLAN_MBOX_TXFIFO_POP_DATA_SET(x) -#define MBOX_RXFIFO_POP_ADDRESS WLAN_MBOX_RXFIFO_POP_ADDRESS -#define MBOX_RXFIFO_POP_OFFSET WLAN_MBOX_RXFIFO_POP_OFFSET -#define MBOX_RXFIFO_POP_DATA_MSB WLAN_MBOX_RXFIFO_POP_DATA_MSB -#define MBOX_RXFIFO_POP_DATA_LSB WLAN_MBOX_RXFIFO_POP_DATA_LSB -#define MBOX_RXFIFO_POP_DATA_MASK WLAN_MBOX_RXFIFO_POP_DATA_MASK -#define MBOX_RXFIFO_POP_DATA_GET(x) WLAN_MBOX_RXFIFO_POP_DATA_GET(x) -#define MBOX_RXFIFO_POP_DATA_SET(x) WLAN_MBOX_RXFIFO_POP_DATA_SET(x) -#define SDIO_DEBUG_ADDRESS WLAN_SDIO_DEBUG_ADDRESS -#define SDIO_DEBUG_OFFSET WLAN_SDIO_DEBUG_OFFSET -#define SDIO_DEBUG_SEL_MSB WLAN_SDIO_DEBUG_SEL_MSB -#define SDIO_DEBUG_SEL_LSB WLAN_SDIO_DEBUG_SEL_LSB -#define SDIO_DEBUG_SEL_MASK WLAN_SDIO_DEBUG_SEL_MASK -#define SDIO_DEBUG_SEL_GET(x) WLAN_SDIO_DEBUG_SEL_GET(x) -#define SDIO_DEBUG_SEL_SET(x) WLAN_SDIO_DEBUG_SEL_SET(x) -#define GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS -#define GMBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET -#define GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB -#define GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB -#define GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK -#define GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define GMBOX0_DMA_RX_CONTROL_ADDRESS WLAN_GMBOX0_DMA_RX_CONTROL_ADDRESS -#define GMBOX0_DMA_RX_CONTROL_OFFSET WLAN_GMBOX0_DMA_RX_CONTROL_OFFSET -#define GMBOX0_DMA_RX_CONTROL_RESUME_MSB WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_MSB -#define GMBOX0_DMA_RX_CONTROL_RESUME_LSB WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_LSB -#define GMBOX0_DMA_RX_CONTROL_RESUME_MASK WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_MASK -#define GMBOX0_DMA_RX_CONTROL_RESUME_GET(x) WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_GET(x) -#define GMBOX0_DMA_RX_CONTROL_RESUME_SET(x) WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_SET(x) -#define GMBOX0_DMA_RX_CONTROL_START_MSB WLAN_GMBOX0_DMA_RX_CONTROL_START_MSB -#define GMBOX0_DMA_RX_CONTROL_START_LSB WLAN_GMBOX0_DMA_RX_CONTROL_START_LSB -#define GMBOX0_DMA_RX_CONTROL_START_MASK WLAN_GMBOX0_DMA_RX_CONTROL_START_MASK -#define GMBOX0_DMA_RX_CONTROL_START_GET(x) WLAN_GMBOX0_DMA_RX_CONTROL_START_GET(x) -#define GMBOX0_DMA_RX_CONTROL_START_SET(x) WLAN_GMBOX0_DMA_RX_CONTROL_START_SET(x) -#define GMBOX0_DMA_RX_CONTROL_STOP_MSB WLAN_GMBOX0_DMA_RX_CONTROL_STOP_MSB -#define GMBOX0_DMA_RX_CONTROL_STOP_LSB WLAN_GMBOX0_DMA_RX_CONTROL_STOP_LSB -#define GMBOX0_DMA_RX_CONTROL_STOP_MASK WLAN_GMBOX0_DMA_RX_CONTROL_STOP_MASK -#define GMBOX0_DMA_RX_CONTROL_STOP_GET(x) WLAN_GMBOX0_DMA_RX_CONTROL_STOP_GET(x) -#define GMBOX0_DMA_RX_CONTROL_STOP_SET(x) WLAN_GMBOX0_DMA_RX_CONTROL_STOP_SET(x) -#define GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS -#define GMBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET -#define GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB -#define GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB -#define GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK -#define GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) -#define GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) -#define GMBOX0_DMA_TX_CONTROL_ADDRESS WLAN_GMBOX0_DMA_TX_CONTROL_ADDRESS -#define GMBOX0_DMA_TX_CONTROL_OFFSET WLAN_GMBOX0_DMA_TX_CONTROL_OFFSET -#define GMBOX0_DMA_TX_CONTROL_RESUME_MSB WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_MSB -#define GMBOX0_DMA_TX_CONTROL_RESUME_LSB WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_LSB -#define GMBOX0_DMA_TX_CONTROL_RESUME_MASK WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_MASK -#define GMBOX0_DMA_TX_CONTROL_RESUME_GET(x) WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_GET(x) -#define GMBOX0_DMA_TX_CONTROL_RESUME_SET(x) WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_SET(x) -#define GMBOX0_DMA_TX_CONTROL_START_MSB WLAN_GMBOX0_DMA_TX_CONTROL_START_MSB -#define GMBOX0_DMA_TX_CONTROL_START_LSB WLAN_GMBOX0_DMA_TX_CONTROL_START_LSB -#define GMBOX0_DMA_TX_CONTROL_START_MASK WLAN_GMBOX0_DMA_TX_CONTROL_START_MASK -#define GMBOX0_DMA_TX_CONTROL_START_GET(x) WLAN_GMBOX0_DMA_TX_CONTROL_START_GET(x) -#define GMBOX0_DMA_TX_CONTROL_START_SET(x) WLAN_GMBOX0_DMA_TX_CONTROL_START_SET(x) -#define GMBOX0_DMA_TX_CONTROL_STOP_MSB WLAN_GMBOX0_DMA_TX_CONTROL_STOP_MSB -#define GMBOX0_DMA_TX_CONTROL_STOP_LSB WLAN_GMBOX0_DMA_TX_CONTROL_STOP_LSB -#define GMBOX0_DMA_TX_CONTROL_STOP_MASK WLAN_GMBOX0_DMA_TX_CONTROL_STOP_MASK -#define GMBOX0_DMA_TX_CONTROL_STOP_GET(x) WLAN_GMBOX0_DMA_TX_CONTROL_STOP_GET(x) -#define GMBOX0_DMA_TX_CONTROL_STOP_SET(x) WLAN_GMBOX0_DMA_TX_CONTROL_STOP_SET(x) -#define GMBOX_INT_STATUS_ADDRESS WLAN_GMBOX_INT_STATUS_ADDRESS -#define GMBOX_INT_STATUS_OFFSET WLAN_GMBOX_INT_STATUS_OFFSET -#define GMBOX_INT_STATUS_TX_OVERFLOW_MSB WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_MSB -#define GMBOX_INT_STATUS_TX_OVERFLOW_LSB WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_LSB -#define GMBOX_INT_STATUS_TX_OVERFLOW_MASK WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_MASK -#define GMBOX_INT_STATUS_TX_OVERFLOW_GET(x) WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_GET(x) -#define GMBOX_INT_STATUS_TX_OVERFLOW_SET(x) WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_SET(x) -#define GMBOX_INT_STATUS_RX_UNDERFLOW_MSB WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_MSB -#define GMBOX_INT_STATUS_RX_UNDERFLOW_LSB WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_LSB -#define GMBOX_INT_STATUS_RX_UNDERFLOW_MASK WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_MASK -#define GMBOX_INT_STATUS_RX_UNDERFLOW_GET(x) WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_GET(x) -#define GMBOX_INT_STATUS_RX_UNDERFLOW_SET(x) WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_SET(x) -#define GMBOX_INT_STATUS_RX_DMA_COMPLETE_MSB WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_MSB -#define GMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB -#define GMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK -#define GMBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) -#define GMBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) -#define GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB -#define GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB -#define GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK -#define GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) -#define GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) -#define GMBOX_INT_STATUS_TX_DMA_COMPLETE_MSB WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_MSB -#define GMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB -#define GMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK -#define GMBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) -#define GMBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) -#define GMBOX_INT_STATUS_TX_NOT_EMPTY_MSB WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_MSB -#define GMBOX_INT_STATUS_TX_NOT_EMPTY_LSB WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_LSB -#define GMBOX_INT_STATUS_TX_NOT_EMPTY_MASK WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_MASK -#define GMBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) -#define GMBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) -#define GMBOX_INT_STATUS_RX_NOT_FULL_MSB WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_MSB -#define GMBOX_INT_STATUS_RX_NOT_FULL_LSB WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_LSB -#define GMBOX_INT_STATUS_RX_NOT_FULL_MASK WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_MASK -#define GMBOX_INT_STATUS_RX_NOT_FULL_GET(x) WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_GET(x) -#define GMBOX_INT_STATUS_RX_NOT_FULL_SET(x) WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_SET(x) -#define GMBOX_INT_ENABLE_ADDRESS WLAN_GMBOX_INT_ENABLE_ADDRESS -#define GMBOX_INT_ENABLE_OFFSET WLAN_GMBOX_INT_ENABLE_OFFSET -#define GMBOX_INT_ENABLE_TX_OVERFLOW_MSB WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_MSB -#define GMBOX_INT_ENABLE_TX_OVERFLOW_LSB WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_LSB -#define GMBOX_INT_ENABLE_TX_OVERFLOW_MASK WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_MASK -#define GMBOX_INT_ENABLE_TX_OVERFLOW_GET(x) WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_GET(x) -#define GMBOX_INT_ENABLE_TX_OVERFLOW_SET(x) WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_SET(x) -#define GMBOX_INT_ENABLE_RX_UNDERFLOW_MSB WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_MSB -#define GMBOX_INT_ENABLE_RX_UNDERFLOW_LSB WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_LSB -#define GMBOX_INT_ENABLE_RX_UNDERFLOW_MASK WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_MASK -#define GMBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) -#define GMBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) -#define GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB -#define GMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB -#define GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK -#define GMBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) -#define GMBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) -#define GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB -#define GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB -#define GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK -#define GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) -#define GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) -#define GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB -#define GMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB -#define GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK -#define GMBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) -#define GMBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) -#define GMBOX_INT_ENABLE_TX_NOT_EMPTY_MSB WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_MSB -#define GMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB -#define GMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK -#define GMBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) -#define GMBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) -#define GMBOX_INT_ENABLE_RX_NOT_FULL_MSB WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_MSB -#define GMBOX_INT_ENABLE_RX_NOT_FULL_LSB WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_LSB -#define GMBOX_INT_ENABLE_RX_NOT_FULL_MASK WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_MASK -#define GMBOX_INT_ENABLE_RX_NOT_FULL_GET(x) WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_GET(x) -#define GMBOX_INT_ENABLE_RX_NOT_FULL_SET(x) WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_SET(x) -#define HOST_IF_WINDOW_ADDRESS WLAN_HOST_IF_WINDOW_ADDRESS -#define HOST_IF_WINDOW_OFFSET WLAN_HOST_IF_WINDOW_OFFSET -#define HOST_IF_WINDOW_DATA_MSB WLAN_HOST_IF_WINDOW_DATA_MSB -#define HOST_IF_WINDOW_DATA_LSB WLAN_HOST_IF_WINDOW_DATA_LSB -#define HOST_IF_WINDOW_DATA_MASK WLAN_HOST_IF_WINDOW_DATA_MASK -#define HOST_IF_WINDOW_DATA_GET(x) WLAN_HOST_IF_WINDOW_DATA_GET(x) -#define HOST_IF_WINDOW_DATA_SET(x) WLAN_HOST_IF_WINDOW_DATA_SET(x) - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_wlan_host_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_wlan_host_reg.h deleted file mode 100644 index ba03a4876cd7..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_wlan_host_reg.h +++ /dev/null @@ -1,522 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _MBOX_WLAN_HOST_REG_REG_H_ -#define _MBOX_WLAN_HOST_REG_REG_H_ - -#define HOST_INT_STATUS_ADDRESS 0x00000400 -#define HOST_INT_STATUS_OFFSET 0x00000400 -#define HOST_INT_STATUS_ERROR_MSB 7 -#define HOST_INT_STATUS_ERROR_LSB 7 -#define HOST_INT_STATUS_ERROR_MASK 0x00000080 -#define HOST_INT_STATUS_ERROR_GET(x) (((x) & HOST_INT_STATUS_ERROR_MASK) >> HOST_INT_STATUS_ERROR_LSB) -#define HOST_INT_STATUS_ERROR_SET(x) (((x) << HOST_INT_STATUS_ERROR_LSB) & HOST_INT_STATUS_ERROR_MASK) -#define HOST_INT_STATUS_CPU_MSB 6 -#define HOST_INT_STATUS_CPU_LSB 6 -#define HOST_INT_STATUS_CPU_MASK 0x00000040 -#define HOST_INT_STATUS_CPU_GET(x) (((x) & HOST_INT_STATUS_CPU_MASK) >> HOST_INT_STATUS_CPU_LSB) -#define HOST_INT_STATUS_CPU_SET(x) (((x) << HOST_INT_STATUS_CPU_LSB) & HOST_INT_STATUS_CPU_MASK) -#define HOST_INT_STATUS_INT_MSB 5 -#define HOST_INT_STATUS_INT_LSB 5 -#define HOST_INT_STATUS_INT_MASK 0x00000020 -#define HOST_INT_STATUS_INT_GET(x) (((x) & HOST_INT_STATUS_INT_MASK) >> HOST_INT_STATUS_INT_LSB) -#define HOST_INT_STATUS_INT_SET(x) (((x) << HOST_INT_STATUS_INT_LSB) & HOST_INT_STATUS_INT_MASK) -#define HOST_INT_STATUS_COUNTER_MSB 4 -#define HOST_INT_STATUS_COUNTER_LSB 4 -#define HOST_INT_STATUS_COUNTER_MASK 0x00000010 -#define HOST_INT_STATUS_COUNTER_GET(x) (((x) & HOST_INT_STATUS_COUNTER_MASK) >> HOST_INT_STATUS_COUNTER_LSB) -#define HOST_INT_STATUS_COUNTER_SET(x) (((x) << HOST_INT_STATUS_COUNTER_LSB) & HOST_INT_STATUS_COUNTER_MASK) -#define HOST_INT_STATUS_MBOX_DATA_MSB 3 -#define HOST_INT_STATUS_MBOX_DATA_LSB 0 -#define HOST_INT_STATUS_MBOX_DATA_MASK 0x0000000f -#define HOST_INT_STATUS_MBOX_DATA_GET(x) (((x) & HOST_INT_STATUS_MBOX_DATA_MASK) >> HOST_INT_STATUS_MBOX_DATA_LSB) -#define HOST_INT_STATUS_MBOX_DATA_SET(x) (((x) << HOST_INT_STATUS_MBOX_DATA_LSB) & HOST_INT_STATUS_MBOX_DATA_MASK) - -#define CPU_INT_STATUS_ADDRESS 0x00000401 -#define CPU_INT_STATUS_OFFSET 0x00000401 -#define CPU_INT_STATUS_BIT_MSB 7 -#define CPU_INT_STATUS_BIT_LSB 0 -#define CPU_INT_STATUS_BIT_MASK 0x000000ff -#define CPU_INT_STATUS_BIT_GET(x) (((x) & CPU_INT_STATUS_BIT_MASK) >> CPU_INT_STATUS_BIT_LSB) -#define CPU_INT_STATUS_BIT_SET(x) (((x) << CPU_INT_STATUS_BIT_LSB) & CPU_INT_STATUS_BIT_MASK) - -#define ERROR_INT_STATUS_ADDRESS 0x00000402 -#define ERROR_INT_STATUS_OFFSET 0x00000402 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_MSB 6 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_LSB 6 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_MASK 0x00000040 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_GET(x) (((x) & ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_MASK) >> ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_LSB) -#define ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_SET(x) (((x) << ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_LSB) & ERROR_INT_STATUS_UART_HCI_FRAMER_SYNC_ERROR_MASK) -#define ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_MSB 5 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_LSB 5 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_MASK 0x00000020 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_GET(x) (((x) & ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_MASK) >> ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_LSB) -#define ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_SET(x) (((x) << ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_LSB) & ERROR_INT_STATUS_UART_HCI_FRAMER_OVERFLOW_MASK) -#define ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_MSB 4 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_LSB 4 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_MASK 0x00000010 -#define ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_GET(x) (((x) & ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_MASK) >> ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_LSB) -#define ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_SET(x) (((x) << ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_LSB) & ERROR_INT_STATUS_UART_HCI_FRAMER_UNDERFLOW_MASK) -#define ERROR_INT_STATUS_SPI_MSB 3 -#define ERROR_INT_STATUS_SPI_LSB 3 -#define ERROR_INT_STATUS_SPI_MASK 0x00000008 -#define ERROR_INT_STATUS_SPI_GET(x) (((x) & ERROR_INT_STATUS_SPI_MASK) >> ERROR_INT_STATUS_SPI_LSB) -#define ERROR_INT_STATUS_SPI_SET(x) (((x) << ERROR_INT_STATUS_SPI_LSB) & ERROR_INT_STATUS_SPI_MASK) -#define ERROR_INT_STATUS_WAKEUP_MSB 2 -#define ERROR_INT_STATUS_WAKEUP_LSB 2 -#define ERROR_INT_STATUS_WAKEUP_MASK 0x00000004 -#define ERROR_INT_STATUS_WAKEUP_GET(x) (((x) & ERROR_INT_STATUS_WAKEUP_MASK) >> ERROR_INT_STATUS_WAKEUP_LSB) -#define ERROR_INT_STATUS_WAKEUP_SET(x) (((x) << ERROR_INT_STATUS_WAKEUP_LSB) & ERROR_INT_STATUS_WAKEUP_MASK) -#define ERROR_INT_STATUS_RX_UNDERFLOW_MSB 1 -#define ERROR_INT_STATUS_RX_UNDERFLOW_LSB 1 -#define ERROR_INT_STATUS_RX_UNDERFLOW_MASK 0x00000002 -#define ERROR_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & ERROR_INT_STATUS_RX_UNDERFLOW_MASK) >> ERROR_INT_STATUS_RX_UNDERFLOW_LSB) -#define ERROR_INT_STATUS_RX_UNDERFLOW_SET(x) (((x) << ERROR_INT_STATUS_RX_UNDERFLOW_LSB) & ERROR_INT_STATUS_RX_UNDERFLOW_MASK) -#define ERROR_INT_STATUS_TX_OVERFLOW_MSB 0 -#define ERROR_INT_STATUS_TX_OVERFLOW_LSB 0 -#define ERROR_INT_STATUS_TX_OVERFLOW_MASK 0x00000001 -#define ERROR_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & ERROR_INT_STATUS_TX_OVERFLOW_MASK) >> ERROR_INT_STATUS_TX_OVERFLOW_LSB) -#define ERROR_INT_STATUS_TX_OVERFLOW_SET(x) (((x) << ERROR_INT_STATUS_TX_OVERFLOW_LSB) & ERROR_INT_STATUS_TX_OVERFLOW_MASK) - -#define COUNTER_INT_STATUS_ADDRESS 0x00000403 -#define COUNTER_INT_STATUS_OFFSET 0x00000403 -#define COUNTER_INT_STATUS_COUNTER_MSB 7 -#define COUNTER_INT_STATUS_COUNTER_LSB 0 -#define COUNTER_INT_STATUS_COUNTER_MASK 0x000000ff -#define COUNTER_INT_STATUS_COUNTER_GET(x) (((x) & COUNTER_INT_STATUS_COUNTER_MASK) >> COUNTER_INT_STATUS_COUNTER_LSB) -#define COUNTER_INT_STATUS_COUNTER_SET(x) (((x) << COUNTER_INT_STATUS_COUNTER_LSB) & COUNTER_INT_STATUS_COUNTER_MASK) - -#define MBOX_FRAME_ADDRESS 0x00000404 -#define MBOX_FRAME_OFFSET 0x00000404 -#define MBOX_FRAME_RX_EOM_MSB 7 -#define MBOX_FRAME_RX_EOM_LSB 4 -#define MBOX_FRAME_RX_EOM_MASK 0x000000f0 -#define MBOX_FRAME_RX_EOM_GET(x) (((x) & MBOX_FRAME_RX_EOM_MASK) >> MBOX_FRAME_RX_EOM_LSB) -#define MBOX_FRAME_RX_EOM_SET(x) (((x) << MBOX_FRAME_RX_EOM_LSB) & MBOX_FRAME_RX_EOM_MASK) -#define MBOX_FRAME_RX_SOM_MSB 3 -#define MBOX_FRAME_RX_SOM_LSB 0 -#define MBOX_FRAME_RX_SOM_MASK 0x0000000f -#define MBOX_FRAME_RX_SOM_GET(x) (((x) & MBOX_FRAME_RX_SOM_MASK) >> MBOX_FRAME_RX_SOM_LSB) -#define MBOX_FRAME_RX_SOM_SET(x) (((x) << MBOX_FRAME_RX_SOM_LSB) & MBOX_FRAME_RX_SOM_MASK) - -#define RX_LOOKAHEAD_VALID_ADDRESS 0x00000405 -#define RX_LOOKAHEAD_VALID_OFFSET 0x00000405 -#define RX_LOOKAHEAD_VALID_MBOX_MSB 3 -#define RX_LOOKAHEAD_VALID_MBOX_LSB 0 -#define RX_LOOKAHEAD_VALID_MBOX_MASK 0x0000000f -#define RX_LOOKAHEAD_VALID_MBOX_GET(x) (((x) & RX_LOOKAHEAD_VALID_MBOX_MASK) >> RX_LOOKAHEAD_VALID_MBOX_LSB) -#define RX_LOOKAHEAD_VALID_MBOX_SET(x) (((x) << RX_LOOKAHEAD_VALID_MBOX_LSB) & RX_LOOKAHEAD_VALID_MBOX_MASK) - -#define HOST_INT_STATUS2_ADDRESS 0x00000406 -#define HOST_INT_STATUS2_OFFSET 0x00000406 -#define HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_MSB 2 -#define HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_LSB 2 -#define HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_MASK 0x00000004 -#define HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_GET(x) (((x) & HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_MASK) >> HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_LSB) -#define HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_SET(x) (((x) << HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_LSB) & HOST_INT_STATUS2_GMBOX_RX_UNDERFLOW_MASK) -#define HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_MSB 1 -#define HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_LSB 1 -#define HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_MASK 0x00000002 -#define HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_GET(x) (((x) & HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_MASK) >> HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_LSB) -#define HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_SET(x) (((x) << HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_LSB) & HOST_INT_STATUS2_GMBOX_TX_OVERFLOW_MASK) -#define HOST_INT_STATUS2_GMBOX_DATA_MSB 0 -#define HOST_INT_STATUS2_GMBOX_DATA_LSB 0 -#define HOST_INT_STATUS2_GMBOX_DATA_MASK 0x00000001 -#define HOST_INT_STATUS2_GMBOX_DATA_GET(x) (((x) & HOST_INT_STATUS2_GMBOX_DATA_MASK) >> HOST_INT_STATUS2_GMBOX_DATA_LSB) -#define HOST_INT_STATUS2_GMBOX_DATA_SET(x) (((x) << HOST_INT_STATUS2_GMBOX_DATA_LSB) & HOST_INT_STATUS2_GMBOX_DATA_MASK) - -#define GMBOX_RX_AVAIL_ADDRESS 0x00000407 -#define GMBOX_RX_AVAIL_OFFSET 0x00000407 -#define GMBOX_RX_AVAIL_BYTE_MSB 6 -#define GMBOX_RX_AVAIL_BYTE_LSB 0 -#define GMBOX_RX_AVAIL_BYTE_MASK 0x0000007f -#define GMBOX_RX_AVAIL_BYTE_GET(x) (((x) & GMBOX_RX_AVAIL_BYTE_MASK) >> GMBOX_RX_AVAIL_BYTE_LSB) -#define GMBOX_RX_AVAIL_BYTE_SET(x) (((x) << GMBOX_RX_AVAIL_BYTE_LSB) & GMBOX_RX_AVAIL_BYTE_MASK) - -#define RX_LOOKAHEAD0_ADDRESS 0x00000408 -#define RX_LOOKAHEAD0_OFFSET 0x00000408 -#define RX_LOOKAHEAD0_DATA_MSB 7 -#define RX_LOOKAHEAD0_DATA_LSB 0 -#define RX_LOOKAHEAD0_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD0_DATA_GET(x) (((x) & RX_LOOKAHEAD0_DATA_MASK) >> RX_LOOKAHEAD0_DATA_LSB) -#define RX_LOOKAHEAD0_DATA_SET(x) (((x) << RX_LOOKAHEAD0_DATA_LSB) & RX_LOOKAHEAD0_DATA_MASK) - -#define RX_LOOKAHEAD1_ADDRESS 0x0000040c -#define RX_LOOKAHEAD1_OFFSET 0x0000040c -#define RX_LOOKAHEAD1_DATA_MSB 7 -#define RX_LOOKAHEAD1_DATA_LSB 0 -#define RX_LOOKAHEAD1_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD1_DATA_GET(x) (((x) & RX_LOOKAHEAD1_DATA_MASK) >> RX_LOOKAHEAD1_DATA_LSB) -#define RX_LOOKAHEAD1_DATA_SET(x) (((x) << RX_LOOKAHEAD1_DATA_LSB) & RX_LOOKAHEAD1_DATA_MASK) - -#define RX_LOOKAHEAD2_ADDRESS 0x00000410 -#define RX_LOOKAHEAD2_OFFSET 0x00000410 -#define RX_LOOKAHEAD2_DATA_MSB 7 -#define RX_LOOKAHEAD2_DATA_LSB 0 -#define RX_LOOKAHEAD2_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD2_DATA_GET(x) (((x) & RX_LOOKAHEAD2_DATA_MASK) >> RX_LOOKAHEAD2_DATA_LSB) -#define RX_LOOKAHEAD2_DATA_SET(x) (((x) << RX_LOOKAHEAD2_DATA_LSB) & RX_LOOKAHEAD2_DATA_MASK) - -#define RX_LOOKAHEAD3_ADDRESS 0x00000414 -#define RX_LOOKAHEAD3_OFFSET 0x00000414 -#define RX_LOOKAHEAD3_DATA_MSB 7 -#define RX_LOOKAHEAD3_DATA_LSB 0 -#define RX_LOOKAHEAD3_DATA_MASK 0x000000ff -#define RX_LOOKAHEAD3_DATA_GET(x) (((x) & RX_LOOKAHEAD3_DATA_MASK) >> RX_LOOKAHEAD3_DATA_LSB) -#define RX_LOOKAHEAD3_DATA_SET(x) (((x) << RX_LOOKAHEAD3_DATA_LSB) & RX_LOOKAHEAD3_DATA_MASK) - -#define INT_STATUS_ENABLE_ADDRESS 0x00000418 -#define INT_STATUS_ENABLE_OFFSET 0x00000418 -#define INT_STATUS_ENABLE_ERROR_MSB 7 -#define INT_STATUS_ENABLE_ERROR_LSB 7 -#define INT_STATUS_ENABLE_ERROR_MASK 0x00000080 -#define INT_STATUS_ENABLE_ERROR_GET(x) (((x) & INT_STATUS_ENABLE_ERROR_MASK) >> INT_STATUS_ENABLE_ERROR_LSB) -#define INT_STATUS_ENABLE_ERROR_SET(x) (((x) << INT_STATUS_ENABLE_ERROR_LSB) & INT_STATUS_ENABLE_ERROR_MASK) -#define INT_STATUS_ENABLE_CPU_MSB 6 -#define INT_STATUS_ENABLE_CPU_LSB 6 -#define INT_STATUS_ENABLE_CPU_MASK 0x00000040 -#define INT_STATUS_ENABLE_CPU_GET(x) (((x) & INT_STATUS_ENABLE_CPU_MASK) >> INT_STATUS_ENABLE_CPU_LSB) -#define INT_STATUS_ENABLE_CPU_SET(x) (((x) << INT_STATUS_ENABLE_CPU_LSB) & INT_STATUS_ENABLE_CPU_MASK) -#define INT_STATUS_ENABLE_INT_MSB 5 -#define INT_STATUS_ENABLE_INT_LSB 5 -#define INT_STATUS_ENABLE_INT_MASK 0x00000020 -#define INT_STATUS_ENABLE_INT_GET(x) (((x) & INT_STATUS_ENABLE_INT_MASK) >> INT_STATUS_ENABLE_INT_LSB) -#define INT_STATUS_ENABLE_INT_SET(x) (((x) << INT_STATUS_ENABLE_INT_LSB) & INT_STATUS_ENABLE_INT_MASK) -#define INT_STATUS_ENABLE_COUNTER_MSB 4 -#define INT_STATUS_ENABLE_COUNTER_LSB 4 -#define INT_STATUS_ENABLE_COUNTER_MASK 0x00000010 -#define INT_STATUS_ENABLE_COUNTER_GET(x) (((x) & INT_STATUS_ENABLE_COUNTER_MASK) >> INT_STATUS_ENABLE_COUNTER_LSB) -#define INT_STATUS_ENABLE_COUNTER_SET(x) (((x) << INT_STATUS_ENABLE_COUNTER_LSB) & INT_STATUS_ENABLE_COUNTER_MASK) -#define INT_STATUS_ENABLE_MBOX_DATA_MSB 3 -#define INT_STATUS_ENABLE_MBOX_DATA_LSB 0 -#define INT_STATUS_ENABLE_MBOX_DATA_MASK 0x0000000f -#define INT_STATUS_ENABLE_MBOX_DATA_GET(x) (((x) & INT_STATUS_ENABLE_MBOX_DATA_MASK) >> INT_STATUS_ENABLE_MBOX_DATA_LSB) -#define INT_STATUS_ENABLE_MBOX_DATA_SET(x) (((x) << INT_STATUS_ENABLE_MBOX_DATA_LSB) & INT_STATUS_ENABLE_MBOX_DATA_MASK) - -#define CPU_INT_STATUS_ENABLE_ADDRESS 0x00000419 -#define CPU_INT_STATUS_ENABLE_OFFSET 0x00000419 -#define CPU_INT_STATUS_ENABLE_BIT_MSB 7 -#define CPU_INT_STATUS_ENABLE_BIT_LSB 0 -#define CPU_INT_STATUS_ENABLE_BIT_MASK 0x000000ff -#define CPU_INT_STATUS_ENABLE_BIT_GET(x) (((x) & CPU_INT_STATUS_ENABLE_BIT_MASK) >> CPU_INT_STATUS_ENABLE_BIT_LSB) -#define CPU_INT_STATUS_ENABLE_BIT_SET(x) (((x) << CPU_INT_STATUS_ENABLE_BIT_LSB) & CPU_INT_STATUS_ENABLE_BIT_MASK) - -#define ERROR_STATUS_ENABLE_ADDRESS 0x0000041a -#define ERROR_STATUS_ENABLE_OFFSET 0x0000041a -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_MSB 6 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_LSB 6 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_MASK 0x00000040 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_GET(x) (((x) & ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_MASK) >> ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_LSB) -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_SET(x) (((x) << ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_LSB) & ERROR_STATUS_ENABLE_UART_HCI_FRAMER_SYNC_ERROR_MASK) -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_MSB 5 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_LSB 5 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_MASK 0x00000020 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_MASK) >> ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_LSB) -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_SET(x) (((x) << ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_LSB) & ERROR_STATUS_ENABLE_UART_HCI_FRAMER_OVERFLOW_MASK) -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_MSB 4 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_LSB 4 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_MASK 0x00000010 -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_MASK) >> ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_LSB) -#define ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_SET(x) (((x) << ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_LSB) & ERROR_STATUS_ENABLE_UART_HCI_FRAMER_UNDERFLOW_MASK) -#define ERROR_STATUS_ENABLE_WAKEUP_MSB 2 -#define ERROR_STATUS_ENABLE_WAKEUP_LSB 2 -#define ERROR_STATUS_ENABLE_WAKEUP_MASK 0x00000004 -#define ERROR_STATUS_ENABLE_WAKEUP_GET(x) (((x) & ERROR_STATUS_ENABLE_WAKEUP_MASK) >> ERROR_STATUS_ENABLE_WAKEUP_LSB) -#define ERROR_STATUS_ENABLE_WAKEUP_SET(x) (((x) << ERROR_STATUS_ENABLE_WAKEUP_LSB) & ERROR_STATUS_ENABLE_WAKEUP_MASK) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MSB 1 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB 1 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 0x00000002 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK) >> ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_SET(x) (((x) << ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) & ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_MSB 0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB 0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK 0x00000001 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_GET(x) (((x) & ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) >> ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_SET(x) (((x) << ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) & ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK) - -#define COUNTER_INT_STATUS_ENABLE_ADDRESS 0x0000041b -#define COUNTER_INT_STATUS_ENABLE_OFFSET 0x0000041b -#define COUNTER_INT_STATUS_ENABLE_BIT_MSB 7 -#define COUNTER_INT_STATUS_ENABLE_BIT_LSB 0 -#define COUNTER_INT_STATUS_ENABLE_BIT_MASK 0x000000ff -#define COUNTER_INT_STATUS_ENABLE_BIT_GET(x) (((x) & COUNTER_INT_STATUS_ENABLE_BIT_MASK) >> COUNTER_INT_STATUS_ENABLE_BIT_LSB) -#define COUNTER_INT_STATUS_ENABLE_BIT_SET(x) (((x) << COUNTER_INT_STATUS_ENABLE_BIT_LSB) & COUNTER_INT_STATUS_ENABLE_BIT_MASK) - -#define COUNT_ADDRESS 0x00000420 -#define COUNT_OFFSET 0x00000420 -#define COUNT_VALUE_MSB 7 -#define COUNT_VALUE_LSB 0 -#define COUNT_VALUE_MASK 0x000000ff -#define COUNT_VALUE_GET(x) (((x) & COUNT_VALUE_MASK) >> COUNT_VALUE_LSB) -#define COUNT_VALUE_SET(x) (((x) << COUNT_VALUE_LSB) & COUNT_VALUE_MASK) - -#define COUNT_DEC_ADDRESS 0x00000440 -#define COUNT_DEC_OFFSET 0x00000440 -#define COUNT_DEC_VALUE_MSB 7 -#define COUNT_DEC_VALUE_LSB 0 -#define COUNT_DEC_VALUE_MASK 0x000000ff -#define COUNT_DEC_VALUE_GET(x) (((x) & COUNT_DEC_VALUE_MASK) >> COUNT_DEC_VALUE_LSB) -#define COUNT_DEC_VALUE_SET(x) (((x) << COUNT_DEC_VALUE_LSB) & COUNT_DEC_VALUE_MASK) - -#define SCRATCH_ADDRESS 0x00000460 -#define SCRATCH_OFFSET 0x00000460 -#define SCRATCH_VALUE_MSB 7 -#define SCRATCH_VALUE_LSB 0 -#define SCRATCH_VALUE_MASK 0x000000ff -#define SCRATCH_VALUE_GET(x) (((x) & SCRATCH_VALUE_MASK) >> SCRATCH_VALUE_LSB) -#define SCRATCH_VALUE_SET(x) (((x) << SCRATCH_VALUE_LSB) & SCRATCH_VALUE_MASK) - -#define FIFO_TIMEOUT_ADDRESS 0x00000468 -#define FIFO_TIMEOUT_OFFSET 0x00000468 -#define FIFO_TIMEOUT_VALUE_MSB 7 -#define FIFO_TIMEOUT_VALUE_LSB 0 -#define FIFO_TIMEOUT_VALUE_MASK 0x000000ff -#define FIFO_TIMEOUT_VALUE_GET(x) (((x) & FIFO_TIMEOUT_VALUE_MASK) >> FIFO_TIMEOUT_VALUE_LSB) -#define FIFO_TIMEOUT_VALUE_SET(x) (((x) << FIFO_TIMEOUT_VALUE_LSB) & FIFO_TIMEOUT_VALUE_MASK) - -#define FIFO_TIMEOUT_ENABLE_ADDRESS 0x00000469 -#define FIFO_TIMEOUT_ENABLE_OFFSET 0x00000469 -#define FIFO_TIMEOUT_ENABLE_SET_MSB 0 -#define FIFO_TIMEOUT_ENABLE_SET_LSB 0 -#define FIFO_TIMEOUT_ENABLE_SET_MASK 0x00000001 -#define FIFO_TIMEOUT_ENABLE_SET_GET(x) (((x) & FIFO_TIMEOUT_ENABLE_SET_MASK) >> FIFO_TIMEOUT_ENABLE_SET_LSB) -#define FIFO_TIMEOUT_ENABLE_SET_SET(x) (((x) << FIFO_TIMEOUT_ENABLE_SET_LSB) & FIFO_TIMEOUT_ENABLE_SET_MASK) - -#define DISABLE_SLEEP_ADDRESS 0x0000046a -#define DISABLE_SLEEP_OFFSET 0x0000046a -#define DISABLE_SLEEP_FOR_INT_MSB 1 -#define DISABLE_SLEEP_FOR_INT_LSB 1 -#define DISABLE_SLEEP_FOR_INT_MASK 0x00000002 -#define DISABLE_SLEEP_FOR_INT_GET(x) (((x) & DISABLE_SLEEP_FOR_INT_MASK) >> DISABLE_SLEEP_FOR_INT_LSB) -#define DISABLE_SLEEP_FOR_INT_SET(x) (((x) << DISABLE_SLEEP_FOR_INT_LSB) & DISABLE_SLEEP_FOR_INT_MASK) -#define DISABLE_SLEEP_ON_MSB 0 -#define DISABLE_SLEEP_ON_LSB 0 -#define DISABLE_SLEEP_ON_MASK 0x00000001 -#define DISABLE_SLEEP_ON_GET(x) (((x) & DISABLE_SLEEP_ON_MASK) >> DISABLE_SLEEP_ON_LSB) -#define DISABLE_SLEEP_ON_SET(x) (((x) << DISABLE_SLEEP_ON_LSB) & DISABLE_SLEEP_ON_MASK) - -#define LOCAL_BUS_ADDRESS 0x00000470 -#define LOCAL_BUS_OFFSET 0x00000470 -#define LOCAL_BUS_STATE_MSB 1 -#define LOCAL_BUS_STATE_LSB 0 -#define LOCAL_BUS_STATE_MASK 0x00000003 -#define LOCAL_BUS_STATE_GET(x) (((x) & LOCAL_BUS_STATE_MASK) >> LOCAL_BUS_STATE_LSB) -#define LOCAL_BUS_STATE_SET(x) (((x) << LOCAL_BUS_STATE_LSB) & LOCAL_BUS_STATE_MASK) - -#define INT_WLAN_ADDRESS 0x00000472 -#define INT_WLAN_OFFSET 0x00000472 -#define INT_WLAN_VECTOR_MSB 7 -#define INT_WLAN_VECTOR_LSB 0 -#define INT_WLAN_VECTOR_MASK 0x000000ff -#define INT_WLAN_VECTOR_GET(x) (((x) & INT_WLAN_VECTOR_MASK) >> INT_WLAN_VECTOR_LSB) -#define INT_WLAN_VECTOR_SET(x) (((x) << INT_WLAN_VECTOR_LSB) & INT_WLAN_VECTOR_MASK) - -#define WINDOW_DATA_ADDRESS 0x00000474 -#define WINDOW_DATA_OFFSET 0x00000474 -#define WINDOW_DATA_DATA_MSB 7 -#define WINDOW_DATA_DATA_LSB 0 -#define WINDOW_DATA_DATA_MASK 0x000000ff -#define WINDOW_DATA_DATA_GET(x) (((x) & WINDOW_DATA_DATA_MASK) >> WINDOW_DATA_DATA_LSB) -#define WINDOW_DATA_DATA_SET(x) (((x) << WINDOW_DATA_DATA_LSB) & WINDOW_DATA_DATA_MASK) - -#define WINDOW_WRITE_ADDR_ADDRESS 0x00000478 -#define WINDOW_WRITE_ADDR_OFFSET 0x00000478 -#define WINDOW_WRITE_ADDR_ADDR_MSB 7 -#define WINDOW_WRITE_ADDR_ADDR_LSB 0 -#define WINDOW_WRITE_ADDR_ADDR_MASK 0x000000ff -#define WINDOW_WRITE_ADDR_ADDR_GET(x) (((x) & WINDOW_WRITE_ADDR_ADDR_MASK) >> WINDOW_WRITE_ADDR_ADDR_LSB) -#define WINDOW_WRITE_ADDR_ADDR_SET(x) (((x) << WINDOW_WRITE_ADDR_ADDR_LSB) & WINDOW_WRITE_ADDR_ADDR_MASK) - -#define WINDOW_READ_ADDR_ADDRESS 0x0000047c -#define WINDOW_READ_ADDR_OFFSET 0x0000047c -#define WINDOW_READ_ADDR_ADDR_MSB 7 -#define WINDOW_READ_ADDR_ADDR_LSB 0 -#define WINDOW_READ_ADDR_ADDR_MASK 0x000000ff -#define WINDOW_READ_ADDR_ADDR_GET(x) (((x) & WINDOW_READ_ADDR_ADDR_MASK) >> WINDOW_READ_ADDR_ADDR_LSB) -#define WINDOW_READ_ADDR_ADDR_SET(x) (((x) << WINDOW_READ_ADDR_ADDR_LSB) & WINDOW_READ_ADDR_ADDR_MASK) - -#define HOST_CTRL_SPI_CONFIG_ADDRESS 0x00000480 -#define HOST_CTRL_SPI_CONFIG_OFFSET 0x00000480 -#define HOST_CTRL_SPI_CONFIG_SPI_RESET_MSB 4 -#define HOST_CTRL_SPI_CONFIG_SPI_RESET_LSB 4 -#define HOST_CTRL_SPI_CONFIG_SPI_RESET_MASK 0x00000010 -#define HOST_CTRL_SPI_CONFIG_SPI_RESET_GET(x) (((x) & HOST_CTRL_SPI_CONFIG_SPI_RESET_MASK) >> HOST_CTRL_SPI_CONFIG_SPI_RESET_LSB) -#define HOST_CTRL_SPI_CONFIG_SPI_RESET_SET(x) (((x) << HOST_CTRL_SPI_CONFIG_SPI_RESET_LSB) & HOST_CTRL_SPI_CONFIG_SPI_RESET_MASK) -#define HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_MSB 3 -#define HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_LSB 3 -#define HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_MASK 0x00000008 -#define HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_GET(x) (((x) & HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_MASK) >> HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_LSB) -#define HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_SET(x) (((x) << HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_LSB) & HOST_CTRL_SPI_CONFIG_INTERRUPT_ENABLE_MASK) -#define HOST_CTRL_SPI_CONFIG_TEST_MODE_MSB 2 -#define HOST_CTRL_SPI_CONFIG_TEST_MODE_LSB 2 -#define HOST_CTRL_SPI_CONFIG_TEST_MODE_MASK 0x00000004 -#define HOST_CTRL_SPI_CONFIG_TEST_MODE_GET(x) (((x) & HOST_CTRL_SPI_CONFIG_TEST_MODE_MASK) >> HOST_CTRL_SPI_CONFIG_TEST_MODE_LSB) -#define HOST_CTRL_SPI_CONFIG_TEST_MODE_SET(x) (((x) << HOST_CTRL_SPI_CONFIG_TEST_MODE_LSB) & HOST_CTRL_SPI_CONFIG_TEST_MODE_MASK) -#define HOST_CTRL_SPI_CONFIG_DATA_SIZE_MSB 1 -#define HOST_CTRL_SPI_CONFIG_DATA_SIZE_LSB 0 -#define HOST_CTRL_SPI_CONFIG_DATA_SIZE_MASK 0x00000003 -#define HOST_CTRL_SPI_CONFIG_DATA_SIZE_GET(x) (((x) & HOST_CTRL_SPI_CONFIG_DATA_SIZE_MASK) >> HOST_CTRL_SPI_CONFIG_DATA_SIZE_LSB) -#define HOST_CTRL_SPI_CONFIG_DATA_SIZE_SET(x) (((x) << HOST_CTRL_SPI_CONFIG_DATA_SIZE_LSB) & HOST_CTRL_SPI_CONFIG_DATA_SIZE_MASK) - -#define HOST_CTRL_SPI_STATUS_ADDRESS 0x00000481 -#define HOST_CTRL_SPI_STATUS_OFFSET 0x00000481 -#define HOST_CTRL_SPI_STATUS_ADDR_ERR_MSB 3 -#define HOST_CTRL_SPI_STATUS_ADDR_ERR_LSB 3 -#define HOST_CTRL_SPI_STATUS_ADDR_ERR_MASK 0x00000008 -#define HOST_CTRL_SPI_STATUS_ADDR_ERR_GET(x) (((x) & HOST_CTRL_SPI_STATUS_ADDR_ERR_MASK) >> HOST_CTRL_SPI_STATUS_ADDR_ERR_LSB) -#define HOST_CTRL_SPI_STATUS_ADDR_ERR_SET(x) (((x) << HOST_CTRL_SPI_STATUS_ADDR_ERR_LSB) & HOST_CTRL_SPI_STATUS_ADDR_ERR_MASK) -#define HOST_CTRL_SPI_STATUS_RD_ERR_MSB 2 -#define HOST_CTRL_SPI_STATUS_RD_ERR_LSB 2 -#define HOST_CTRL_SPI_STATUS_RD_ERR_MASK 0x00000004 -#define HOST_CTRL_SPI_STATUS_RD_ERR_GET(x) (((x) & HOST_CTRL_SPI_STATUS_RD_ERR_MASK) >> HOST_CTRL_SPI_STATUS_RD_ERR_LSB) -#define HOST_CTRL_SPI_STATUS_RD_ERR_SET(x) (((x) << HOST_CTRL_SPI_STATUS_RD_ERR_LSB) & HOST_CTRL_SPI_STATUS_RD_ERR_MASK) -#define HOST_CTRL_SPI_STATUS_WR_ERR_MSB 1 -#define HOST_CTRL_SPI_STATUS_WR_ERR_LSB 1 -#define HOST_CTRL_SPI_STATUS_WR_ERR_MASK 0x00000002 -#define HOST_CTRL_SPI_STATUS_WR_ERR_GET(x) (((x) & HOST_CTRL_SPI_STATUS_WR_ERR_MASK) >> HOST_CTRL_SPI_STATUS_WR_ERR_LSB) -#define HOST_CTRL_SPI_STATUS_WR_ERR_SET(x) (((x) << HOST_CTRL_SPI_STATUS_WR_ERR_LSB) & HOST_CTRL_SPI_STATUS_WR_ERR_MASK) -#define HOST_CTRL_SPI_STATUS_READY_MSB 0 -#define HOST_CTRL_SPI_STATUS_READY_LSB 0 -#define HOST_CTRL_SPI_STATUS_READY_MASK 0x00000001 -#define HOST_CTRL_SPI_STATUS_READY_GET(x) (((x) & HOST_CTRL_SPI_STATUS_READY_MASK) >> HOST_CTRL_SPI_STATUS_READY_LSB) -#define HOST_CTRL_SPI_STATUS_READY_SET(x) (((x) << HOST_CTRL_SPI_STATUS_READY_LSB) & HOST_CTRL_SPI_STATUS_READY_MASK) - -#define NON_ASSOC_SLEEP_EN_ADDRESS 0x00000482 -#define NON_ASSOC_SLEEP_EN_OFFSET 0x00000482 -#define NON_ASSOC_SLEEP_EN_BIT_MSB 0 -#define NON_ASSOC_SLEEP_EN_BIT_LSB 0 -#define NON_ASSOC_SLEEP_EN_BIT_MASK 0x00000001 -#define NON_ASSOC_SLEEP_EN_BIT_GET(x) (((x) & NON_ASSOC_SLEEP_EN_BIT_MASK) >> NON_ASSOC_SLEEP_EN_BIT_LSB) -#define NON_ASSOC_SLEEP_EN_BIT_SET(x) (((x) << NON_ASSOC_SLEEP_EN_BIT_LSB) & NON_ASSOC_SLEEP_EN_BIT_MASK) - -#define CPU_DBG_SEL_ADDRESS 0x00000483 -#define CPU_DBG_SEL_OFFSET 0x00000483 -#define CPU_DBG_SEL_BIT_MSB 5 -#define CPU_DBG_SEL_BIT_LSB 0 -#define CPU_DBG_SEL_BIT_MASK 0x0000003f -#define CPU_DBG_SEL_BIT_GET(x) (((x) & CPU_DBG_SEL_BIT_MASK) >> CPU_DBG_SEL_BIT_LSB) -#define CPU_DBG_SEL_BIT_SET(x) (((x) << CPU_DBG_SEL_BIT_LSB) & CPU_DBG_SEL_BIT_MASK) - -#define CPU_DBG_ADDRESS 0x00000484 -#define CPU_DBG_OFFSET 0x00000484 -#define CPU_DBG_DATA_MSB 7 -#define CPU_DBG_DATA_LSB 0 -#define CPU_DBG_DATA_MASK 0x000000ff -#define CPU_DBG_DATA_GET(x) (((x) & CPU_DBG_DATA_MASK) >> CPU_DBG_DATA_LSB) -#define CPU_DBG_DATA_SET(x) (((x) << CPU_DBG_DATA_LSB) & CPU_DBG_DATA_MASK) - -#define INT_STATUS2_ENABLE_ADDRESS 0x00000488 -#define INT_STATUS2_ENABLE_OFFSET 0x00000488 -#define INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_MSB 2 -#define INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_LSB 2 -#define INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_MASK 0x00000004 -#define INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_GET(x) (((x) & INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_MASK) >> INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_LSB) -#define INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_SET(x) (((x) << INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_LSB) & INT_STATUS2_ENABLE_GMBOX_RX_UNDERFLOW_MASK) -#define INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_MSB 1 -#define INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_LSB 1 -#define INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_MASK 0x00000002 -#define INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_GET(x) (((x) & INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_MASK) >> INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_LSB) -#define INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_SET(x) (((x) << INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_LSB) & INT_STATUS2_ENABLE_GMBOX_TX_OVERFLOW_MASK) -#define INT_STATUS2_ENABLE_GMBOX_DATA_MSB 0 -#define INT_STATUS2_ENABLE_GMBOX_DATA_LSB 0 -#define INT_STATUS2_ENABLE_GMBOX_DATA_MASK 0x00000001 -#define INT_STATUS2_ENABLE_GMBOX_DATA_GET(x) (((x) & INT_STATUS2_ENABLE_GMBOX_DATA_MASK) >> INT_STATUS2_ENABLE_GMBOX_DATA_LSB) -#define INT_STATUS2_ENABLE_GMBOX_DATA_SET(x) (((x) << INT_STATUS2_ENABLE_GMBOX_DATA_LSB) & INT_STATUS2_ENABLE_GMBOX_DATA_MASK) - -#define GMBOX_RX_LOOKAHEAD_ADDRESS 0x00000490 -#define GMBOX_RX_LOOKAHEAD_OFFSET 0x00000490 -#define GMBOX_RX_LOOKAHEAD_DATA_MSB 7 -#define GMBOX_RX_LOOKAHEAD_DATA_LSB 0 -#define GMBOX_RX_LOOKAHEAD_DATA_MASK 0x000000ff -#define GMBOX_RX_LOOKAHEAD_DATA_GET(x) (((x) & GMBOX_RX_LOOKAHEAD_DATA_MASK) >> GMBOX_RX_LOOKAHEAD_DATA_LSB) -#define GMBOX_RX_LOOKAHEAD_DATA_SET(x) (((x) << GMBOX_RX_LOOKAHEAD_DATA_LSB) & GMBOX_RX_LOOKAHEAD_DATA_MASK) - -#define GMBOX_RX_LOOKAHEAD_MUX_ADDRESS 0x00000498 -#define GMBOX_RX_LOOKAHEAD_MUX_OFFSET 0x00000498 -#define GMBOX_RX_LOOKAHEAD_MUX_SEL_MSB 0 -#define GMBOX_RX_LOOKAHEAD_MUX_SEL_LSB 0 -#define GMBOX_RX_LOOKAHEAD_MUX_SEL_MASK 0x00000001 -#define GMBOX_RX_LOOKAHEAD_MUX_SEL_GET(x) (((x) & GMBOX_RX_LOOKAHEAD_MUX_SEL_MASK) >> GMBOX_RX_LOOKAHEAD_MUX_SEL_LSB) -#define GMBOX_RX_LOOKAHEAD_MUX_SEL_SET(x) (((x) << GMBOX_RX_LOOKAHEAD_MUX_SEL_LSB) & GMBOX_RX_LOOKAHEAD_MUX_SEL_MASK) - -#define CIS_WINDOW_ADDRESS 0x00000600 -#define CIS_WINDOW_OFFSET 0x00000600 -#define CIS_WINDOW_DATA_MSB 7 -#define CIS_WINDOW_DATA_LSB 0 -#define CIS_WINDOW_DATA_MASK 0x000000ff -#define CIS_WINDOW_DATA_GET(x) (((x) & CIS_WINDOW_DATA_MASK) >> CIS_WINDOW_DATA_LSB) -#define CIS_WINDOW_DATA_SET(x) (((x) << CIS_WINDOW_DATA_LSB) & CIS_WINDOW_DATA_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct mbox_wlan_host_reg_reg_s { - unsigned char pad0[1024]; /* pad to 0x400 */ - volatile unsigned char host_int_status; - volatile unsigned char cpu_int_status; - volatile unsigned char error_int_status; - volatile unsigned char counter_int_status; - volatile unsigned char mbox_frame; - volatile unsigned char rx_lookahead_valid; - volatile unsigned char host_int_status2; - volatile unsigned char gmbox_rx_avail; - volatile unsigned char rx_lookahead0[4]; - volatile unsigned char rx_lookahead1[4]; - volatile unsigned char rx_lookahead2[4]; - volatile unsigned char rx_lookahead3[4]; - volatile unsigned char int_status_enable; - volatile unsigned char cpu_int_status_enable; - volatile unsigned char error_status_enable; - volatile unsigned char counter_int_status_enable; - unsigned char pad1[4]; /* pad to 0x420 */ - volatile unsigned char count[8]; - unsigned char pad2[24]; /* pad to 0x440 */ - volatile unsigned char count_dec[32]; - volatile unsigned char scratch[8]; - volatile unsigned char fifo_timeout; - volatile unsigned char fifo_timeout_enable; - volatile unsigned char disable_sleep; - unsigned char pad3[5]; /* pad to 0x470 */ - volatile unsigned char local_bus; - unsigned char pad4[1]; /* pad to 0x472 */ - volatile unsigned char int_wlan; - unsigned char pad5[1]; /* pad to 0x474 */ - volatile unsigned char window_data[4]; - volatile unsigned char window_write_addr[4]; - volatile unsigned char window_read_addr[4]; - volatile unsigned char host_ctrl_spi_config; - volatile unsigned char host_ctrl_spi_status; - volatile unsigned char non_assoc_sleep_en; - volatile unsigned char cpu_dbg_sel; - volatile unsigned char cpu_dbg[4]; - volatile unsigned char int_status2_enable; - unsigned char pad6[7]; /* pad to 0x490 */ - volatile unsigned char gmbox_rx_lookahead[8]; - volatile unsigned char gmbox_rx_lookahead_mux; - unsigned char pad7[359]; /* pad to 0x600 */ - volatile unsigned char cis_window[512]; -} mbox_wlan_host_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _MBOX_WLAN_HOST_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_wlan_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_wlan_reg.h deleted file mode 100644 index 34a50b788b91..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mbox_wlan_reg.h +++ /dev/null @@ -1,692 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _MBOX_WLAN_REG_REG_H_ -#define _MBOX_WLAN_REG_REG_H_ - -#define WLAN_MBOX_FIFO_ADDRESS 0x00000000 -#define WLAN_MBOX_FIFO_OFFSET 0x00000000 -#define WLAN_MBOX_FIFO_DATA_MSB 19 -#define WLAN_MBOX_FIFO_DATA_LSB 0 -#define WLAN_MBOX_FIFO_DATA_MASK 0x000fffff -#define WLAN_MBOX_FIFO_DATA_GET(x) (((x) & WLAN_MBOX_FIFO_DATA_MASK) >> WLAN_MBOX_FIFO_DATA_LSB) -#define WLAN_MBOX_FIFO_DATA_SET(x) (((x) << WLAN_MBOX_FIFO_DATA_LSB) & WLAN_MBOX_FIFO_DATA_MASK) - -#define WLAN_MBOX_FIFO_STATUS_ADDRESS 0x00000010 -#define WLAN_MBOX_FIFO_STATUS_OFFSET 0x00000010 -#define WLAN_MBOX_FIFO_STATUS_EMPTY_MSB 19 -#define WLAN_MBOX_FIFO_STATUS_EMPTY_LSB 16 -#define WLAN_MBOX_FIFO_STATUS_EMPTY_MASK 0x000f0000 -#define WLAN_MBOX_FIFO_STATUS_EMPTY_GET(x) (((x) & WLAN_MBOX_FIFO_STATUS_EMPTY_MASK) >> WLAN_MBOX_FIFO_STATUS_EMPTY_LSB) -#define WLAN_MBOX_FIFO_STATUS_EMPTY_SET(x) (((x) << WLAN_MBOX_FIFO_STATUS_EMPTY_LSB) & WLAN_MBOX_FIFO_STATUS_EMPTY_MASK) -#define WLAN_MBOX_FIFO_STATUS_FULL_MSB 15 -#define WLAN_MBOX_FIFO_STATUS_FULL_LSB 12 -#define WLAN_MBOX_FIFO_STATUS_FULL_MASK 0x0000f000 -#define WLAN_MBOX_FIFO_STATUS_FULL_GET(x) (((x) & WLAN_MBOX_FIFO_STATUS_FULL_MASK) >> WLAN_MBOX_FIFO_STATUS_FULL_LSB) -#define WLAN_MBOX_FIFO_STATUS_FULL_SET(x) (((x) << WLAN_MBOX_FIFO_STATUS_FULL_LSB) & WLAN_MBOX_FIFO_STATUS_FULL_MASK) - -#define WLAN_MBOX_DMA_POLICY_ADDRESS 0x00000014 -#define WLAN_MBOX_DMA_POLICY_OFFSET 0x00000014 -#define WLAN_MBOX_DMA_POLICY_TX_QUANTUM_MSB 3 -#define WLAN_MBOX_DMA_POLICY_TX_QUANTUM_LSB 3 -#define WLAN_MBOX_DMA_POLICY_TX_QUANTUM_MASK 0x00000008 -#define WLAN_MBOX_DMA_POLICY_TX_QUANTUM_GET(x) (((x) & WLAN_MBOX_DMA_POLICY_TX_QUANTUM_MASK) >> WLAN_MBOX_DMA_POLICY_TX_QUANTUM_LSB) -#define WLAN_MBOX_DMA_POLICY_TX_QUANTUM_SET(x) (((x) << WLAN_MBOX_DMA_POLICY_TX_QUANTUM_LSB) & WLAN_MBOX_DMA_POLICY_TX_QUANTUM_MASK) -#define WLAN_MBOX_DMA_POLICY_TX_ORDER_MSB 2 -#define WLAN_MBOX_DMA_POLICY_TX_ORDER_LSB 2 -#define WLAN_MBOX_DMA_POLICY_TX_ORDER_MASK 0x00000004 -#define WLAN_MBOX_DMA_POLICY_TX_ORDER_GET(x) (((x) & WLAN_MBOX_DMA_POLICY_TX_ORDER_MASK) >> WLAN_MBOX_DMA_POLICY_TX_ORDER_LSB) -#define WLAN_MBOX_DMA_POLICY_TX_ORDER_SET(x) (((x) << WLAN_MBOX_DMA_POLICY_TX_ORDER_LSB) & WLAN_MBOX_DMA_POLICY_TX_ORDER_MASK) -#define WLAN_MBOX_DMA_POLICY_RX_QUANTUM_MSB 1 -#define WLAN_MBOX_DMA_POLICY_RX_QUANTUM_LSB 1 -#define WLAN_MBOX_DMA_POLICY_RX_QUANTUM_MASK 0x00000002 -#define WLAN_MBOX_DMA_POLICY_RX_QUANTUM_GET(x) (((x) & WLAN_MBOX_DMA_POLICY_RX_QUANTUM_MASK) >> WLAN_MBOX_DMA_POLICY_RX_QUANTUM_LSB) -#define WLAN_MBOX_DMA_POLICY_RX_QUANTUM_SET(x) (((x) << WLAN_MBOX_DMA_POLICY_RX_QUANTUM_LSB) & WLAN_MBOX_DMA_POLICY_RX_QUANTUM_MASK) -#define WLAN_MBOX_DMA_POLICY_RX_ORDER_MSB 0 -#define WLAN_MBOX_DMA_POLICY_RX_ORDER_LSB 0 -#define WLAN_MBOX_DMA_POLICY_RX_ORDER_MASK 0x00000001 -#define WLAN_MBOX_DMA_POLICY_RX_ORDER_GET(x) (((x) & WLAN_MBOX_DMA_POLICY_RX_ORDER_MASK) >> WLAN_MBOX_DMA_POLICY_RX_ORDER_LSB) -#define WLAN_MBOX_DMA_POLICY_RX_ORDER_SET(x) (((x) << WLAN_MBOX_DMA_POLICY_RX_ORDER_LSB) & WLAN_MBOX_DMA_POLICY_RX_ORDER_MASK) - -#define WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000018 -#define WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000018 -#define WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX0_DMA_RX_CONTROL_ADDRESS 0x0000001c -#define WLAN_MBOX0_DMA_RX_CONTROL_OFFSET 0x0000001c -#define WLAN_MBOX0_DMA_RX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX0_DMA_RX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX0_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX0_DMA_RX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX0_DMA_RX_CONTROL_RESUME_MASK) >> WLAN_MBOX0_DMA_RX_CONTROL_RESUME_LSB) -#define WLAN_MBOX0_DMA_RX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX0_DMA_RX_CONTROL_RESUME_LSB) & WLAN_MBOX0_DMA_RX_CONTROL_RESUME_MASK) -#define WLAN_MBOX0_DMA_RX_CONTROL_START_MSB 1 -#define WLAN_MBOX0_DMA_RX_CONTROL_START_LSB 1 -#define WLAN_MBOX0_DMA_RX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX0_DMA_RX_CONTROL_START_GET(x) (((x) & WLAN_MBOX0_DMA_RX_CONTROL_START_MASK) >> WLAN_MBOX0_DMA_RX_CONTROL_START_LSB) -#define WLAN_MBOX0_DMA_RX_CONTROL_START_SET(x) (((x) << WLAN_MBOX0_DMA_RX_CONTROL_START_LSB) & WLAN_MBOX0_DMA_RX_CONTROL_START_MASK) -#define WLAN_MBOX0_DMA_RX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX0_DMA_RX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX0_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX0_DMA_RX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX0_DMA_RX_CONTROL_STOP_MASK) >> WLAN_MBOX0_DMA_RX_CONTROL_STOP_LSB) -#define WLAN_MBOX0_DMA_RX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX0_DMA_RX_CONTROL_STOP_LSB) & WLAN_MBOX0_DMA_RX_CONTROL_STOP_MASK) - -#define WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000020 -#define WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000020 -#define WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX0_DMA_TX_CONTROL_ADDRESS 0x00000024 -#define WLAN_MBOX0_DMA_TX_CONTROL_OFFSET 0x00000024 -#define WLAN_MBOX0_DMA_TX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX0_DMA_TX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX0_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX0_DMA_TX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX0_DMA_TX_CONTROL_RESUME_MASK) >> WLAN_MBOX0_DMA_TX_CONTROL_RESUME_LSB) -#define WLAN_MBOX0_DMA_TX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX0_DMA_TX_CONTROL_RESUME_LSB) & WLAN_MBOX0_DMA_TX_CONTROL_RESUME_MASK) -#define WLAN_MBOX0_DMA_TX_CONTROL_START_MSB 1 -#define WLAN_MBOX0_DMA_TX_CONTROL_START_LSB 1 -#define WLAN_MBOX0_DMA_TX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX0_DMA_TX_CONTROL_START_GET(x) (((x) & WLAN_MBOX0_DMA_TX_CONTROL_START_MASK) >> WLAN_MBOX0_DMA_TX_CONTROL_START_LSB) -#define WLAN_MBOX0_DMA_TX_CONTROL_START_SET(x) (((x) << WLAN_MBOX0_DMA_TX_CONTROL_START_LSB) & WLAN_MBOX0_DMA_TX_CONTROL_START_MASK) -#define WLAN_MBOX0_DMA_TX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX0_DMA_TX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX0_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX0_DMA_TX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX0_DMA_TX_CONTROL_STOP_MASK) >> WLAN_MBOX0_DMA_TX_CONTROL_STOP_LSB) -#define WLAN_MBOX0_DMA_TX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX0_DMA_TX_CONTROL_STOP_LSB) & WLAN_MBOX0_DMA_TX_CONTROL_STOP_MASK) - -#define WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000028 -#define WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000028 -#define WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX1_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX1_DMA_RX_CONTROL_ADDRESS 0x0000002c -#define WLAN_MBOX1_DMA_RX_CONTROL_OFFSET 0x0000002c -#define WLAN_MBOX1_DMA_RX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX1_DMA_RX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX1_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX1_DMA_RX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX1_DMA_RX_CONTROL_RESUME_MASK) >> WLAN_MBOX1_DMA_RX_CONTROL_RESUME_LSB) -#define WLAN_MBOX1_DMA_RX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX1_DMA_RX_CONTROL_RESUME_LSB) & WLAN_MBOX1_DMA_RX_CONTROL_RESUME_MASK) -#define WLAN_MBOX1_DMA_RX_CONTROL_START_MSB 1 -#define WLAN_MBOX1_DMA_RX_CONTROL_START_LSB 1 -#define WLAN_MBOX1_DMA_RX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX1_DMA_RX_CONTROL_START_GET(x) (((x) & WLAN_MBOX1_DMA_RX_CONTROL_START_MASK) >> WLAN_MBOX1_DMA_RX_CONTROL_START_LSB) -#define WLAN_MBOX1_DMA_RX_CONTROL_START_SET(x) (((x) << WLAN_MBOX1_DMA_RX_CONTROL_START_LSB) & WLAN_MBOX1_DMA_RX_CONTROL_START_MASK) -#define WLAN_MBOX1_DMA_RX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX1_DMA_RX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX1_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX1_DMA_RX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX1_DMA_RX_CONTROL_STOP_MASK) >> WLAN_MBOX1_DMA_RX_CONTROL_STOP_LSB) -#define WLAN_MBOX1_DMA_RX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX1_DMA_RX_CONTROL_STOP_LSB) & WLAN_MBOX1_DMA_RX_CONTROL_STOP_MASK) - -#define WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000030 -#define WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000030 -#define WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX1_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX1_DMA_TX_CONTROL_ADDRESS 0x00000034 -#define WLAN_MBOX1_DMA_TX_CONTROL_OFFSET 0x00000034 -#define WLAN_MBOX1_DMA_TX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX1_DMA_TX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX1_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX1_DMA_TX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX1_DMA_TX_CONTROL_RESUME_MASK) >> WLAN_MBOX1_DMA_TX_CONTROL_RESUME_LSB) -#define WLAN_MBOX1_DMA_TX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX1_DMA_TX_CONTROL_RESUME_LSB) & WLAN_MBOX1_DMA_TX_CONTROL_RESUME_MASK) -#define WLAN_MBOX1_DMA_TX_CONTROL_START_MSB 1 -#define WLAN_MBOX1_DMA_TX_CONTROL_START_LSB 1 -#define WLAN_MBOX1_DMA_TX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX1_DMA_TX_CONTROL_START_GET(x) (((x) & WLAN_MBOX1_DMA_TX_CONTROL_START_MASK) >> WLAN_MBOX1_DMA_TX_CONTROL_START_LSB) -#define WLAN_MBOX1_DMA_TX_CONTROL_START_SET(x) (((x) << WLAN_MBOX1_DMA_TX_CONTROL_START_LSB) & WLAN_MBOX1_DMA_TX_CONTROL_START_MASK) -#define WLAN_MBOX1_DMA_TX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX1_DMA_TX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX1_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX1_DMA_TX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX1_DMA_TX_CONTROL_STOP_MASK) >> WLAN_MBOX1_DMA_TX_CONTROL_STOP_LSB) -#define WLAN_MBOX1_DMA_TX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX1_DMA_TX_CONTROL_STOP_LSB) & WLAN_MBOX1_DMA_TX_CONTROL_STOP_MASK) - -#define WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000038 -#define WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000038 -#define WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX2_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX2_DMA_RX_CONTROL_ADDRESS 0x0000003c -#define WLAN_MBOX2_DMA_RX_CONTROL_OFFSET 0x0000003c -#define WLAN_MBOX2_DMA_RX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX2_DMA_RX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX2_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX2_DMA_RX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX2_DMA_RX_CONTROL_RESUME_MASK) >> WLAN_MBOX2_DMA_RX_CONTROL_RESUME_LSB) -#define WLAN_MBOX2_DMA_RX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX2_DMA_RX_CONTROL_RESUME_LSB) & WLAN_MBOX2_DMA_RX_CONTROL_RESUME_MASK) -#define WLAN_MBOX2_DMA_RX_CONTROL_START_MSB 1 -#define WLAN_MBOX2_DMA_RX_CONTROL_START_LSB 1 -#define WLAN_MBOX2_DMA_RX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX2_DMA_RX_CONTROL_START_GET(x) (((x) & WLAN_MBOX2_DMA_RX_CONTROL_START_MASK) >> WLAN_MBOX2_DMA_RX_CONTROL_START_LSB) -#define WLAN_MBOX2_DMA_RX_CONTROL_START_SET(x) (((x) << WLAN_MBOX2_DMA_RX_CONTROL_START_LSB) & WLAN_MBOX2_DMA_RX_CONTROL_START_MASK) -#define WLAN_MBOX2_DMA_RX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX2_DMA_RX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX2_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX2_DMA_RX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX2_DMA_RX_CONTROL_STOP_MASK) >> WLAN_MBOX2_DMA_RX_CONTROL_STOP_LSB) -#define WLAN_MBOX2_DMA_RX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX2_DMA_RX_CONTROL_STOP_LSB) & WLAN_MBOX2_DMA_RX_CONTROL_STOP_MASK) - -#define WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000040 -#define WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000040 -#define WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX2_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX2_DMA_TX_CONTROL_ADDRESS 0x00000044 -#define WLAN_MBOX2_DMA_TX_CONTROL_OFFSET 0x00000044 -#define WLAN_MBOX2_DMA_TX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX2_DMA_TX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX2_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX2_DMA_TX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX2_DMA_TX_CONTROL_RESUME_MASK) >> WLAN_MBOX2_DMA_TX_CONTROL_RESUME_LSB) -#define WLAN_MBOX2_DMA_TX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX2_DMA_TX_CONTROL_RESUME_LSB) & WLAN_MBOX2_DMA_TX_CONTROL_RESUME_MASK) -#define WLAN_MBOX2_DMA_TX_CONTROL_START_MSB 1 -#define WLAN_MBOX2_DMA_TX_CONTROL_START_LSB 1 -#define WLAN_MBOX2_DMA_TX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX2_DMA_TX_CONTROL_START_GET(x) (((x) & WLAN_MBOX2_DMA_TX_CONTROL_START_MASK) >> WLAN_MBOX2_DMA_TX_CONTROL_START_LSB) -#define WLAN_MBOX2_DMA_TX_CONTROL_START_SET(x) (((x) << WLAN_MBOX2_DMA_TX_CONTROL_START_LSB) & WLAN_MBOX2_DMA_TX_CONTROL_START_MASK) -#define WLAN_MBOX2_DMA_TX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX2_DMA_TX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX2_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX2_DMA_TX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX2_DMA_TX_CONTROL_STOP_MASK) >> WLAN_MBOX2_DMA_TX_CONTROL_STOP_LSB) -#define WLAN_MBOX2_DMA_TX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX2_DMA_TX_CONTROL_STOP_LSB) & WLAN_MBOX2_DMA_TX_CONTROL_STOP_MASK) - -#define WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000048 -#define WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000048 -#define WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX3_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX3_DMA_RX_CONTROL_ADDRESS 0x0000004c -#define WLAN_MBOX3_DMA_RX_CONTROL_OFFSET 0x0000004c -#define WLAN_MBOX3_DMA_RX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX3_DMA_RX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX3_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX3_DMA_RX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX3_DMA_RX_CONTROL_RESUME_MASK) >> WLAN_MBOX3_DMA_RX_CONTROL_RESUME_LSB) -#define WLAN_MBOX3_DMA_RX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX3_DMA_RX_CONTROL_RESUME_LSB) & WLAN_MBOX3_DMA_RX_CONTROL_RESUME_MASK) -#define WLAN_MBOX3_DMA_RX_CONTROL_START_MSB 1 -#define WLAN_MBOX3_DMA_RX_CONTROL_START_LSB 1 -#define WLAN_MBOX3_DMA_RX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX3_DMA_RX_CONTROL_START_GET(x) (((x) & WLAN_MBOX3_DMA_RX_CONTROL_START_MASK) >> WLAN_MBOX3_DMA_RX_CONTROL_START_LSB) -#define WLAN_MBOX3_DMA_RX_CONTROL_START_SET(x) (((x) << WLAN_MBOX3_DMA_RX_CONTROL_START_LSB) & WLAN_MBOX3_DMA_RX_CONTROL_START_MASK) -#define WLAN_MBOX3_DMA_RX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX3_DMA_RX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX3_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX3_DMA_RX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX3_DMA_RX_CONTROL_STOP_MASK) >> WLAN_MBOX3_DMA_RX_CONTROL_STOP_LSB) -#define WLAN_MBOX3_DMA_RX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX3_DMA_RX_CONTROL_STOP_LSB) & WLAN_MBOX3_DMA_RX_CONTROL_STOP_MASK) - -#define WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000050 -#define WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000050 -#define WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_MBOX3_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_MBOX3_DMA_TX_CONTROL_ADDRESS 0x00000054 -#define WLAN_MBOX3_DMA_TX_CONTROL_OFFSET 0x00000054 -#define WLAN_MBOX3_DMA_TX_CONTROL_RESUME_MSB 2 -#define WLAN_MBOX3_DMA_TX_CONTROL_RESUME_LSB 2 -#define WLAN_MBOX3_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_MBOX3_DMA_TX_CONTROL_RESUME_GET(x) (((x) & WLAN_MBOX3_DMA_TX_CONTROL_RESUME_MASK) >> WLAN_MBOX3_DMA_TX_CONTROL_RESUME_LSB) -#define WLAN_MBOX3_DMA_TX_CONTROL_RESUME_SET(x) (((x) << WLAN_MBOX3_DMA_TX_CONTROL_RESUME_LSB) & WLAN_MBOX3_DMA_TX_CONTROL_RESUME_MASK) -#define WLAN_MBOX3_DMA_TX_CONTROL_START_MSB 1 -#define WLAN_MBOX3_DMA_TX_CONTROL_START_LSB 1 -#define WLAN_MBOX3_DMA_TX_CONTROL_START_MASK 0x00000002 -#define WLAN_MBOX3_DMA_TX_CONTROL_START_GET(x) (((x) & WLAN_MBOX3_DMA_TX_CONTROL_START_MASK) >> WLAN_MBOX3_DMA_TX_CONTROL_START_LSB) -#define WLAN_MBOX3_DMA_TX_CONTROL_START_SET(x) (((x) << WLAN_MBOX3_DMA_TX_CONTROL_START_LSB) & WLAN_MBOX3_DMA_TX_CONTROL_START_MASK) -#define WLAN_MBOX3_DMA_TX_CONTROL_STOP_MSB 0 -#define WLAN_MBOX3_DMA_TX_CONTROL_STOP_LSB 0 -#define WLAN_MBOX3_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_MBOX3_DMA_TX_CONTROL_STOP_GET(x) (((x) & WLAN_MBOX3_DMA_TX_CONTROL_STOP_MASK) >> WLAN_MBOX3_DMA_TX_CONTROL_STOP_LSB) -#define WLAN_MBOX3_DMA_TX_CONTROL_STOP_SET(x) (((x) << WLAN_MBOX3_DMA_TX_CONTROL_STOP_LSB) & WLAN_MBOX3_DMA_TX_CONTROL_STOP_MASK) - -#define WLAN_MBOX_INT_STATUS_ADDRESS 0x00000058 -#define WLAN_MBOX_INT_STATUS_OFFSET 0x00000058 -#define WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_MSB 31 -#define WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB 28 -#define WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK 0xf0000000 -#define WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) (((x) & WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) >> WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) -#define WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) (((x) << WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) & WLAN_MBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) -#define WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB 27 -#define WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB 24 -#define WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK 0x0f000000 -#define WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) (((x) & WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) >> WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) -#define WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) (((x) << WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) & WLAN_MBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) -#define WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_MSB 23 -#define WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB 20 -#define WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK 0x00f00000 -#define WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) (((x) & WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) >> WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) -#define WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) (((x) << WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) & WLAN_MBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) -#define WLAN_MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_MSB 19 -#define WLAN_MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_LSB 19 -#define WLAN_MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_MASK 0x00080000 -#define WLAN_MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_GET(x) (((x) & WLAN_MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_MASK) >> WLAN_MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_LSB) -#define WLAN_MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_SET(x) (((x) << WLAN_MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_LSB) & WLAN_MBOX_INT_STATUS_NO_RX_MBOX_DATA_AVA_MASK) -#define WLAN_MBOX_INT_STATUS_FRAME_DONE_MSB 18 -#define WLAN_MBOX_INT_STATUS_FRAME_DONE_LSB 18 -#define WLAN_MBOX_INT_STATUS_FRAME_DONE_MASK 0x00040000 -#define WLAN_MBOX_INT_STATUS_FRAME_DONE_GET(x) (((x) & WLAN_MBOX_INT_STATUS_FRAME_DONE_MASK) >> WLAN_MBOX_INT_STATUS_FRAME_DONE_LSB) -#define WLAN_MBOX_INT_STATUS_FRAME_DONE_SET(x) (((x) << WLAN_MBOX_INT_STATUS_FRAME_DONE_LSB) & WLAN_MBOX_INT_STATUS_FRAME_DONE_MASK) -#define WLAN_MBOX_INT_STATUS_TX_OVERFLOW_MSB 17 -#define WLAN_MBOX_INT_STATUS_TX_OVERFLOW_LSB 17 -#define WLAN_MBOX_INT_STATUS_TX_OVERFLOW_MASK 0x00020000 -#define WLAN_MBOX_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & WLAN_MBOX_INT_STATUS_TX_OVERFLOW_MASK) >> WLAN_MBOX_INT_STATUS_TX_OVERFLOW_LSB) -#define WLAN_MBOX_INT_STATUS_TX_OVERFLOW_SET(x) (((x) << WLAN_MBOX_INT_STATUS_TX_OVERFLOW_LSB) & WLAN_MBOX_INT_STATUS_TX_OVERFLOW_MASK) -#define WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_MSB 16 -#define WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_LSB 16 -#define WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_MASK 0x00010000 -#define WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_MASK) >> WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_LSB) -#define WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_SET(x) (((x) << WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_LSB) & WLAN_MBOX_INT_STATUS_RX_UNDERFLOW_MASK) -#define WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_MSB 15 -#define WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_LSB 12 -#define WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_MASK 0x0000f000 -#define WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) (((x) & WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_MASK) >> WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_LSB) -#define WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) (((x) << WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_LSB) & WLAN_MBOX_INT_STATUS_TX_NOT_EMPTY_MASK) -#define WLAN_MBOX_INT_STATUS_RX_NOT_FULL_MSB 11 -#define WLAN_MBOX_INT_STATUS_RX_NOT_FULL_LSB 8 -#define WLAN_MBOX_INT_STATUS_RX_NOT_FULL_MASK 0x00000f00 -#define WLAN_MBOX_INT_STATUS_RX_NOT_FULL_GET(x) (((x) & WLAN_MBOX_INT_STATUS_RX_NOT_FULL_MASK) >> WLAN_MBOX_INT_STATUS_RX_NOT_FULL_LSB) -#define WLAN_MBOX_INT_STATUS_RX_NOT_FULL_SET(x) (((x) << WLAN_MBOX_INT_STATUS_RX_NOT_FULL_LSB) & WLAN_MBOX_INT_STATUS_RX_NOT_FULL_MASK) -#define WLAN_MBOX_INT_STATUS_HOST_MSB 7 -#define WLAN_MBOX_INT_STATUS_HOST_LSB 0 -#define WLAN_MBOX_INT_STATUS_HOST_MASK 0x000000ff -#define WLAN_MBOX_INT_STATUS_HOST_GET(x) (((x) & WLAN_MBOX_INT_STATUS_HOST_MASK) >> WLAN_MBOX_INT_STATUS_HOST_LSB) -#define WLAN_MBOX_INT_STATUS_HOST_SET(x) (((x) << WLAN_MBOX_INT_STATUS_HOST_LSB) & WLAN_MBOX_INT_STATUS_HOST_MASK) - -#define WLAN_MBOX_INT_ENABLE_ADDRESS 0x0000005c -#define WLAN_MBOX_INT_ENABLE_OFFSET 0x0000005c -#define WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB 31 -#define WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB 28 -#define WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK 0xf0000000 -#define WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) >> WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) -#define WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) & WLAN_MBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) -#define WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB 27 -#define WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB 24 -#define WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK 0x0f000000 -#define WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) >> WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) -#define WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) & WLAN_MBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) -#define WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB 23 -#define WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB 20 -#define WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK 0x00f00000 -#define WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) >> WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) -#define WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) & WLAN_MBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) -#define WLAN_MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_MSB 19 -#define WLAN_MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_LSB 19 -#define WLAN_MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_MASK 0x00080000 -#define WLAN_MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_MASK) >> WLAN_MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_LSB) -#define WLAN_MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_LSB) & WLAN_MBOX_INT_ENABLE_NO_RX_MBOX_DATA_AVA_MASK) -#define WLAN_MBOX_INT_ENABLE_FRAME_DONE_MSB 18 -#define WLAN_MBOX_INT_ENABLE_FRAME_DONE_LSB 18 -#define WLAN_MBOX_INT_ENABLE_FRAME_DONE_MASK 0x00040000 -#define WLAN_MBOX_INT_ENABLE_FRAME_DONE_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_FRAME_DONE_MASK) >> WLAN_MBOX_INT_ENABLE_FRAME_DONE_LSB) -#define WLAN_MBOX_INT_ENABLE_FRAME_DONE_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_FRAME_DONE_LSB) & WLAN_MBOX_INT_ENABLE_FRAME_DONE_MASK) -#define WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_MSB 17 -#define WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_LSB 17 -#define WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_MASK 0x00020000 -#define WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_MASK) >> WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_LSB) -#define WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_LSB) & WLAN_MBOX_INT_ENABLE_TX_OVERFLOW_MASK) -#define WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_MSB 16 -#define WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_LSB 16 -#define WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_MASK 0x00010000 -#define WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_MASK) >> WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_LSB) -#define WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_LSB) & WLAN_MBOX_INT_ENABLE_RX_UNDERFLOW_MASK) -#define WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_MSB 15 -#define WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB 12 -#define WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK 0x0000f000 -#define WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) >> WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) -#define WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) & WLAN_MBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) -#define WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_MSB 11 -#define WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_LSB 8 -#define WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_MASK 0x00000f00 -#define WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_MASK) >> WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_LSB) -#define WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_LSB) & WLAN_MBOX_INT_ENABLE_RX_NOT_FULL_MASK) -#define WLAN_MBOX_INT_ENABLE_HOST_MSB 7 -#define WLAN_MBOX_INT_ENABLE_HOST_LSB 0 -#define WLAN_MBOX_INT_ENABLE_HOST_MASK 0x000000ff -#define WLAN_MBOX_INT_ENABLE_HOST_GET(x) (((x) & WLAN_MBOX_INT_ENABLE_HOST_MASK) >> WLAN_MBOX_INT_ENABLE_HOST_LSB) -#define WLAN_MBOX_INT_ENABLE_HOST_SET(x) (((x) << WLAN_MBOX_INT_ENABLE_HOST_LSB) & WLAN_MBOX_INT_ENABLE_HOST_MASK) - -#define WLAN_INT_HOST_ADDRESS 0x00000060 -#define WLAN_INT_HOST_OFFSET 0x00000060 -#define WLAN_INT_HOST_VECTOR_MSB 7 -#define WLAN_INT_HOST_VECTOR_LSB 0 -#define WLAN_INT_HOST_VECTOR_MASK 0x000000ff -#define WLAN_INT_HOST_VECTOR_GET(x) (((x) & WLAN_INT_HOST_VECTOR_MASK) >> WLAN_INT_HOST_VECTOR_LSB) -#define WLAN_INT_HOST_VECTOR_SET(x) (((x) << WLAN_INT_HOST_VECTOR_LSB) & WLAN_INT_HOST_VECTOR_MASK) - -#define WLAN_LOCAL_COUNT_ADDRESS 0x00000080 -#define WLAN_LOCAL_COUNT_OFFSET 0x00000080 -#define WLAN_LOCAL_COUNT_VALUE_MSB 7 -#define WLAN_LOCAL_COUNT_VALUE_LSB 0 -#define WLAN_LOCAL_COUNT_VALUE_MASK 0x000000ff -#define WLAN_LOCAL_COUNT_VALUE_GET(x) (((x) & WLAN_LOCAL_COUNT_VALUE_MASK) >> WLAN_LOCAL_COUNT_VALUE_LSB) -#define WLAN_LOCAL_COUNT_VALUE_SET(x) (((x) << WLAN_LOCAL_COUNT_VALUE_LSB) & WLAN_LOCAL_COUNT_VALUE_MASK) - -#define WLAN_COUNT_INC_ADDRESS 0x000000a0 -#define WLAN_COUNT_INC_OFFSET 0x000000a0 -#define WLAN_COUNT_INC_VALUE_MSB 7 -#define WLAN_COUNT_INC_VALUE_LSB 0 -#define WLAN_COUNT_INC_VALUE_MASK 0x000000ff -#define WLAN_COUNT_INC_VALUE_GET(x) (((x) & WLAN_COUNT_INC_VALUE_MASK) >> WLAN_COUNT_INC_VALUE_LSB) -#define WLAN_COUNT_INC_VALUE_SET(x) (((x) << WLAN_COUNT_INC_VALUE_LSB) & WLAN_COUNT_INC_VALUE_MASK) - -#define WLAN_LOCAL_SCRATCH_ADDRESS 0x000000c0 -#define WLAN_LOCAL_SCRATCH_OFFSET 0x000000c0 -#define WLAN_LOCAL_SCRATCH_VALUE_MSB 7 -#define WLAN_LOCAL_SCRATCH_VALUE_LSB 0 -#define WLAN_LOCAL_SCRATCH_VALUE_MASK 0x000000ff -#define WLAN_LOCAL_SCRATCH_VALUE_GET(x) (((x) & WLAN_LOCAL_SCRATCH_VALUE_MASK) >> WLAN_LOCAL_SCRATCH_VALUE_LSB) -#define WLAN_LOCAL_SCRATCH_VALUE_SET(x) (((x) << WLAN_LOCAL_SCRATCH_VALUE_LSB) & WLAN_LOCAL_SCRATCH_VALUE_MASK) - -#define WLAN_USE_LOCAL_BUS_ADDRESS 0x000000e0 -#define WLAN_USE_LOCAL_BUS_OFFSET 0x000000e0 -#define WLAN_USE_LOCAL_BUS_PIN_INIT_MSB 0 -#define WLAN_USE_LOCAL_BUS_PIN_INIT_LSB 0 -#define WLAN_USE_LOCAL_BUS_PIN_INIT_MASK 0x00000001 -#define WLAN_USE_LOCAL_BUS_PIN_INIT_GET(x) (((x) & WLAN_USE_LOCAL_BUS_PIN_INIT_MASK) >> WLAN_USE_LOCAL_BUS_PIN_INIT_LSB) -#define WLAN_USE_LOCAL_BUS_PIN_INIT_SET(x) (((x) << WLAN_USE_LOCAL_BUS_PIN_INIT_LSB) & WLAN_USE_LOCAL_BUS_PIN_INIT_MASK) - -#define WLAN_SDIO_CONFIG_ADDRESS 0x000000e4 -#define WLAN_SDIO_CONFIG_OFFSET 0x000000e4 -#define WLAN_SDIO_CONFIG_CCCR_IOR1_MSB 0 -#define WLAN_SDIO_CONFIG_CCCR_IOR1_LSB 0 -#define WLAN_SDIO_CONFIG_CCCR_IOR1_MASK 0x00000001 -#define WLAN_SDIO_CONFIG_CCCR_IOR1_GET(x) (((x) & WLAN_SDIO_CONFIG_CCCR_IOR1_MASK) >> WLAN_SDIO_CONFIG_CCCR_IOR1_LSB) -#define WLAN_SDIO_CONFIG_CCCR_IOR1_SET(x) (((x) << WLAN_SDIO_CONFIG_CCCR_IOR1_LSB) & WLAN_SDIO_CONFIG_CCCR_IOR1_MASK) - -#define WLAN_MBOX_DEBUG_ADDRESS 0x000000e8 -#define WLAN_MBOX_DEBUG_OFFSET 0x000000e8 -#define WLAN_MBOX_DEBUG_SEL_MSB 2 -#define WLAN_MBOX_DEBUG_SEL_LSB 0 -#define WLAN_MBOX_DEBUG_SEL_MASK 0x00000007 -#define WLAN_MBOX_DEBUG_SEL_GET(x) (((x) & WLAN_MBOX_DEBUG_SEL_MASK) >> WLAN_MBOX_DEBUG_SEL_LSB) -#define WLAN_MBOX_DEBUG_SEL_SET(x) (((x) << WLAN_MBOX_DEBUG_SEL_LSB) & WLAN_MBOX_DEBUG_SEL_MASK) - -#define WLAN_MBOX_FIFO_RESET_ADDRESS 0x000000ec -#define WLAN_MBOX_FIFO_RESET_OFFSET 0x000000ec -#define WLAN_MBOX_FIFO_RESET_INIT_MSB 0 -#define WLAN_MBOX_FIFO_RESET_INIT_LSB 0 -#define WLAN_MBOX_FIFO_RESET_INIT_MASK 0x00000001 -#define WLAN_MBOX_FIFO_RESET_INIT_GET(x) (((x) & WLAN_MBOX_FIFO_RESET_INIT_MASK) >> WLAN_MBOX_FIFO_RESET_INIT_LSB) -#define WLAN_MBOX_FIFO_RESET_INIT_SET(x) (((x) << WLAN_MBOX_FIFO_RESET_INIT_LSB) & WLAN_MBOX_FIFO_RESET_INIT_MASK) - -#define WLAN_MBOX_TXFIFO_POP_ADDRESS 0x000000f0 -#define WLAN_MBOX_TXFIFO_POP_OFFSET 0x000000f0 -#define WLAN_MBOX_TXFIFO_POP_DATA_MSB 0 -#define WLAN_MBOX_TXFIFO_POP_DATA_LSB 0 -#define WLAN_MBOX_TXFIFO_POP_DATA_MASK 0x00000001 -#define WLAN_MBOX_TXFIFO_POP_DATA_GET(x) (((x) & WLAN_MBOX_TXFIFO_POP_DATA_MASK) >> WLAN_MBOX_TXFIFO_POP_DATA_LSB) -#define WLAN_MBOX_TXFIFO_POP_DATA_SET(x) (((x) << WLAN_MBOX_TXFIFO_POP_DATA_LSB) & WLAN_MBOX_TXFIFO_POP_DATA_MASK) - -#define WLAN_MBOX_RXFIFO_POP_ADDRESS 0x00000100 -#define WLAN_MBOX_RXFIFO_POP_OFFSET 0x00000100 -#define WLAN_MBOX_RXFIFO_POP_DATA_MSB 0 -#define WLAN_MBOX_RXFIFO_POP_DATA_LSB 0 -#define WLAN_MBOX_RXFIFO_POP_DATA_MASK 0x00000001 -#define WLAN_MBOX_RXFIFO_POP_DATA_GET(x) (((x) & WLAN_MBOX_RXFIFO_POP_DATA_MASK) >> WLAN_MBOX_RXFIFO_POP_DATA_LSB) -#define WLAN_MBOX_RXFIFO_POP_DATA_SET(x) (((x) << WLAN_MBOX_RXFIFO_POP_DATA_LSB) & WLAN_MBOX_RXFIFO_POP_DATA_MASK) - -#define WLAN_SDIO_DEBUG_ADDRESS 0x00000110 -#define WLAN_SDIO_DEBUG_OFFSET 0x00000110 -#define WLAN_SDIO_DEBUG_SEL_MSB 3 -#define WLAN_SDIO_DEBUG_SEL_LSB 0 -#define WLAN_SDIO_DEBUG_SEL_MASK 0x0000000f -#define WLAN_SDIO_DEBUG_SEL_GET(x) (((x) & WLAN_SDIO_DEBUG_SEL_MASK) >> WLAN_SDIO_DEBUG_SEL_LSB) -#define WLAN_SDIO_DEBUG_SEL_SET(x) (((x) << WLAN_SDIO_DEBUG_SEL_LSB) & WLAN_SDIO_DEBUG_SEL_MASK) - -#define WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000114 -#define WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000114 -#define WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_GMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_GMBOX0_DMA_RX_CONTROL_ADDRESS 0x00000118 -#define WLAN_GMBOX0_DMA_RX_CONTROL_OFFSET 0x00000118 -#define WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_MSB 2 -#define WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_LSB 2 -#define WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_GET(x) (((x) & WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_MASK) >> WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_LSB) -#define WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_SET(x) (((x) << WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_LSB) & WLAN_GMBOX0_DMA_RX_CONTROL_RESUME_MASK) -#define WLAN_GMBOX0_DMA_RX_CONTROL_START_MSB 1 -#define WLAN_GMBOX0_DMA_RX_CONTROL_START_LSB 1 -#define WLAN_GMBOX0_DMA_RX_CONTROL_START_MASK 0x00000002 -#define WLAN_GMBOX0_DMA_RX_CONTROL_START_GET(x) (((x) & WLAN_GMBOX0_DMA_RX_CONTROL_START_MASK) >> WLAN_GMBOX0_DMA_RX_CONTROL_START_LSB) -#define WLAN_GMBOX0_DMA_RX_CONTROL_START_SET(x) (((x) << WLAN_GMBOX0_DMA_RX_CONTROL_START_LSB) & WLAN_GMBOX0_DMA_RX_CONTROL_START_MASK) -#define WLAN_GMBOX0_DMA_RX_CONTROL_STOP_MSB 0 -#define WLAN_GMBOX0_DMA_RX_CONTROL_STOP_LSB 0 -#define WLAN_GMBOX0_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_GMBOX0_DMA_RX_CONTROL_STOP_GET(x) (((x) & WLAN_GMBOX0_DMA_RX_CONTROL_STOP_MASK) >> WLAN_GMBOX0_DMA_RX_CONTROL_STOP_LSB) -#define WLAN_GMBOX0_DMA_RX_CONTROL_STOP_SET(x) (((x) << WLAN_GMBOX0_DMA_RX_CONTROL_STOP_LSB) & WLAN_GMBOX0_DMA_RX_CONTROL_STOP_MASK) - -#define WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x0000011c -#define WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x0000011c -#define WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & WLAN_GMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define WLAN_GMBOX0_DMA_TX_CONTROL_ADDRESS 0x00000120 -#define WLAN_GMBOX0_DMA_TX_CONTROL_OFFSET 0x00000120 -#define WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_MSB 2 -#define WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_LSB 2 -#define WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_GET(x) (((x) & WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_MASK) >> WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_LSB) -#define WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_SET(x) (((x) << WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_LSB) & WLAN_GMBOX0_DMA_TX_CONTROL_RESUME_MASK) -#define WLAN_GMBOX0_DMA_TX_CONTROL_START_MSB 1 -#define WLAN_GMBOX0_DMA_TX_CONTROL_START_LSB 1 -#define WLAN_GMBOX0_DMA_TX_CONTROL_START_MASK 0x00000002 -#define WLAN_GMBOX0_DMA_TX_CONTROL_START_GET(x) (((x) & WLAN_GMBOX0_DMA_TX_CONTROL_START_MASK) >> WLAN_GMBOX0_DMA_TX_CONTROL_START_LSB) -#define WLAN_GMBOX0_DMA_TX_CONTROL_START_SET(x) (((x) << WLAN_GMBOX0_DMA_TX_CONTROL_START_LSB) & WLAN_GMBOX0_DMA_TX_CONTROL_START_MASK) -#define WLAN_GMBOX0_DMA_TX_CONTROL_STOP_MSB 0 -#define WLAN_GMBOX0_DMA_TX_CONTROL_STOP_LSB 0 -#define WLAN_GMBOX0_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define WLAN_GMBOX0_DMA_TX_CONTROL_STOP_GET(x) (((x) & WLAN_GMBOX0_DMA_TX_CONTROL_STOP_MASK) >> WLAN_GMBOX0_DMA_TX_CONTROL_STOP_LSB) -#define WLAN_GMBOX0_DMA_TX_CONTROL_STOP_SET(x) (((x) << WLAN_GMBOX0_DMA_TX_CONTROL_STOP_LSB) & WLAN_GMBOX0_DMA_TX_CONTROL_STOP_MASK) - -#define WLAN_GMBOX_INT_STATUS_ADDRESS 0x00000124 -#define WLAN_GMBOX_INT_STATUS_OFFSET 0x00000124 -#define WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_MSB 6 -#define WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_LSB 6 -#define WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_MASK 0x00000040 -#define WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_MASK) >> WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_LSB) -#define WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_SET(x) (((x) << WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_LSB) & WLAN_GMBOX_INT_STATUS_TX_OVERFLOW_MASK) -#define WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_MSB 5 -#define WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_LSB 5 -#define WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_MASK 0x00000020 -#define WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_MASK) >> WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_LSB) -#define WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_SET(x) (((x) << WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_LSB) & WLAN_GMBOX_INT_STATUS_RX_UNDERFLOW_MASK) -#define WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_MSB 4 -#define WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB 4 -#define WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK 0x00000010 -#define WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) (((x) & WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) >> WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) -#define WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) (((x) << WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) & WLAN_GMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) -#define WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB 3 -#define WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB 3 -#define WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK 0x00000008 -#define WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) (((x) & WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) >> WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) -#define WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) (((x) << WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) & WLAN_GMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) -#define WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_MSB 2 -#define WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB 2 -#define WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK 0x00000004 -#define WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) (((x) & WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) >> WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) -#define WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) (((x) << WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) & WLAN_GMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) -#define WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_MSB 1 -#define WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_LSB 1 -#define WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_MASK 0x00000002 -#define WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) (((x) & WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_MASK) >> WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_LSB) -#define WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) (((x) << WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_LSB) & WLAN_GMBOX_INT_STATUS_TX_NOT_EMPTY_MASK) -#define WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_MSB 0 -#define WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_LSB 0 -#define WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_MASK 0x00000001 -#define WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_GET(x) (((x) & WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_MASK) >> WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_LSB) -#define WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_SET(x) (((x) << WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_LSB) & WLAN_GMBOX_INT_STATUS_RX_NOT_FULL_MASK) - -#define WLAN_GMBOX_INT_ENABLE_ADDRESS 0x00000128 -#define WLAN_GMBOX_INT_ENABLE_OFFSET 0x00000128 -#define WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_MSB 6 -#define WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_LSB 6 -#define WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_MASK 0x00000040 -#define WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_GET(x) (((x) & WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_MASK) >> WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_LSB) -#define WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_SET(x) (((x) << WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_LSB) & WLAN_GMBOX_INT_ENABLE_TX_OVERFLOW_MASK) -#define WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_MSB 5 -#define WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_LSB 5 -#define WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_MASK 0x00000020 -#define WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) (((x) & WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_MASK) >> WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_LSB) -#define WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) (((x) << WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_LSB) & WLAN_GMBOX_INT_ENABLE_RX_UNDERFLOW_MASK) -#define WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB 4 -#define WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB 4 -#define WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK 0x00000010 -#define WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) (((x) & WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) >> WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) -#define WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) (((x) << WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) & WLAN_GMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB 3 -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB 3 -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK 0x00000008 -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) (((x) & WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) >> WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) (((x) << WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) & WLAN_GMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB 2 -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB 2 -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK 0x00000004 -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) (((x) & WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) >> WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) -#define WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) (((x) << WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) & WLAN_GMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) -#define WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_MSB 1 -#define WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB 1 -#define WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK 0x00000002 -#define WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) (((x) & WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) >> WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) -#define WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) (((x) << WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) & WLAN_GMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) -#define WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_MSB 0 -#define WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_LSB 0 -#define WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_MASK 0x00000001 -#define WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_GET(x) (((x) & WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_MASK) >> WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_LSB) -#define WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_SET(x) (((x) << WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_LSB) & WLAN_GMBOX_INT_ENABLE_RX_NOT_FULL_MASK) - -#define STE_MODE_ADDRESS 0x0000012c -#define STE_MODE_OFFSET 0x0000012c -#define STE_MODE_SPI_CTRL_EN_MSB 6 -#define STE_MODE_SPI_CTRL_EN_LSB 6 -#define STE_MODE_SPI_CTRL_EN_MASK 0x00000040 -#define STE_MODE_SPI_CTRL_EN_GET(x) (((x) & STE_MODE_SPI_CTRL_EN_MASK) >> STE_MODE_SPI_CTRL_EN_LSB) -#define STE_MODE_SPI_CTRL_EN_SET(x) (((x) << STE_MODE_SPI_CTRL_EN_LSB) & STE_MODE_SPI_CTRL_EN_MASK) -#define STE_MODE_RST_MSB 5 -#define STE_MODE_RST_LSB 5 -#define STE_MODE_RST_MASK 0x00000020 -#define STE_MODE_RST_GET(x) (((x) & STE_MODE_RST_MASK) >> STE_MODE_RST_LSB) -#define STE_MODE_RST_SET(x) (((x) << STE_MODE_RST_LSB) & STE_MODE_RST_MASK) -#define STE_MODE_SWAP_MSB 4 -#define STE_MODE_SWAP_LSB 4 -#define STE_MODE_SWAP_MASK 0x00000010 -#define STE_MODE_SWAP_GET(x) (((x) & STE_MODE_SWAP_MASK) >> STE_MODE_SWAP_LSB) -#define STE_MODE_SWAP_SET(x) (((x) << STE_MODE_SWAP_LSB) & STE_MODE_SWAP_MASK) -#define STE_MODE_SEL_16BIT_MSB 3 -#define STE_MODE_SEL_16BIT_LSB 3 -#define STE_MODE_SEL_16BIT_MASK 0x00000008 -#define STE_MODE_SEL_16BIT_GET(x) (((x) & STE_MODE_SEL_16BIT_MASK) >> STE_MODE_SEL_16BIT_LSB) -#define STE_MODE_SEL_16BIT_SET(x) (((x) << STE_MODE_SEL_16BIT_LSB) & STE_MODE_SEL_16BIT_MASK) -#define STE_MODE_PHA_POL_MSB 2 -#define STE_MODE_PHA_POL_LSB 1 -#define STE_MODE_PHA_POL_MASK 0x00000006 -#define STE_MODE_PHA_POL_GET(x) (((x) & STE_MODE_PHA_POL_MASK) >> STE_MODE_PHA_POL_LSB) -#define STE_MODE_PHA_POL_SET(x) (((x) << STE_MODE_PHA_POL_LSB) & STE_MODE_PHA_POL_MASK) -#define STE_MODE_SEL_MSB 0 -#define STE_MODE_SEL_LSB 0 -#define STE_MODE_SEL_MASK 0x00000001 -#define STE_MODE_SEL_GET(x) (((x) & STE_MODE_SEL_MASK) >> STE_MODE_SEL_LSB) -#define STE_MODE_SEL_SET(x) (((x) << STE_MODE_SEL_LSB) & STE_MODE_SEL_MASK) - -#define WLAN_HOST_IF_WINDOW_ADDRESS 0x00002000 -#define WLAN_HOST_IF_WINDOW_OFFSET 0x00002000 -#define WLAN_HOST_IF_WINDOW_DATA_MSB 7 -#define WLAN_HOST_IF_WINDOW_DATA_LSB 0 -#define WLAN_HOST_IF_WINDOW_DATA_MASK 0x000000ff -#define WLAN_HOST_IF_WINDOW_DATA_GET(x) (((x) & WLAN_HOST_IF_WINDOW_DATA_MASK) >> WLAN_HOST_IF_WINDOW_DATA_LSB) -#define WLAN_HOST_IF_WINDOW_DATA_SET(x) (((x) << WLAN_HOST_IF_WINDOW_DATA_LSB) & WLAN_HOST_IF_WINDOW_DATA_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct mbox_wlan_reg_reg_s { - volatile unsigned int wlan_mbox_fifo[4]; - volatile unsigned int wlan_mbox_fifo_status; - volatile unsigned int wlan_mbox_dma_policy; - volatile unsigned int wlan_mbox0_dma_rx_descriptor_base; - volatile unsigned int wlan_mbox0_dma_rx_control; - volatile unsigned int wlan_mbox0_dma_tx_descriptor_base; - volatile unsigned int wlan_mbox0_dma_tx_control; - volatile unsigned int wlan_mbox1_dma_rx_descriptor_base; - volatile unsigned int wlan_mbox1_dma_rx_control; - volatile unsigned int wlan_mbox1_dma_tx_descriptor_base; - volatile unsigned int wlan_mbox1_dma_tx_control; - volatile unsigned int wlan_mbox2_dma_rx_descriptor_base; - volatile unsigned int wlan_mbox2_dma_rx_control; - volatile unsigned int wlan_mbox2_dma_tx_descriptor_base; - volatile unsigned int wlan_mbox2_dma_tx_control; - volatile unsigned int wlan_mbox3_dma_rx_descriptor_base; - volatile unsigned int wlan_mbox3_dma_rx_control; - volatile unsigned int wlan_mbox3_dma_tx_descriptor_base; - volatile unsigned int wlan_mbox3_dma_tx_control; - volatile unsigned int wlan_mbox_int_status; - volatile unsigned int wlan_mbox_int_enable; - volatile unsigned int wlan_int_host; - unsigned char pad0[28]; /* pad to 0x80 */ - volatile unsigned int wlan_local_count[8]; - volatile unsigned int wlan_count_inc[8]; - volatile unsigned int wlan_local_scratch[8]; - volatile unsigned int wlan_use_local_bus; - volatile unsigned int wlan_sdio_config; - volatile unsigned int wlan_mbox_debug; - volatile unsigned int wlan_mbox_fifo_reset; - volatile unsigned int wlan_mbox_txfifo_pop[4]; - volatile unsigned int wlan_mbox_rxfifo_pop[4]; - volatile unsigned int wlan_sdio_debug; - volatile unsigned int wlan_gmbox0_dma_rx_descriptor_base; - volatile unsigned int wlan_gmbox0_dma_rx_control; - volatile unsigned int wlan_gmbox0_dma_tx_descriptor_base; - volatile unsigned int wlan_gmbox0_dma_tx_control; - volatile unsigned int wlan_gmbox_int_status; - volatile unsigned int wlan_gmbox_int_enable; - volatile unsigned int ste_mode; - unsigned char pad1[7888]; /* pad to 0x2000 */ - volatile unsigned int wlan_host_if_window[2048]; -} mbox_wlan_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _MBOX_WLAN_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mdio_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mdio_reg.h deleted file mode 100644 index c98d36c59706..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mdio_reg.h +++ /dev/null @@ -1,67 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _MDIO_REG_REG_H_ -#define _MDIO_REG_REG_H_ - -#define MDIO_REG_ADDRESS 0x00000000 -#define MDIO_REG_OFFSET 0x00000000 -#define MDIO_REG_VALUE_MSB 15 -#define MDIO_REG_VALUE_LSB 0 -#define MDIO_REG_VALUE_MASK 0x0000ffff -#define MDIO_REG_VALUE_GET(x) (((x) & MDIO_REG_VALUE_MASK) >> MDIO_REG_VALUE_LSB) -#define MDIO_REG_VALUE_SET(x) (((x) << MDIO_REG_VALUE_LSB) & MDIO_REG_VALUE_MASK) - -#define MDIO_ISR_ADDRESS 0x00000020 -#define MDIO_ISR_OFFSET 0x00000020 -#define MDIO_ISR_MASK_MSB 15 -#define MDIO_ISR_MASK_LSB 8 -#define MDIO_ISR_MASK_MASK 0x0000ff00 -#define MDIO_ISR_MASK_GET(x) (((x) & MDIO_ISR_MASK_MASK) >> MDIO_ISR_MASK_LSB) -#define MDIO_ISR_MASK_SET(x) (((x) << MDIO_ISR_MASK_LSB) & MDIO_ISR_MASK_MASK) -#define MDIO_ISR_REGS_MSB 7 -#define MDIO_ISR_REGS_LSB 0 -#define MDIO_ISR_REGS_MASK 0x000000ff -#define MDIO_ISR_REGS_GET(x) (((x) & MDIO_ISR_REGS_MASK) >> MDIO_ISR_REGS_LSB) -#define MDIO_ISR_REGS_SET(x) (((x) << MDIO_ISR_REGS_LSB) & MDIO_ISR_REGS_MASK) - -#define PHY_ADDR_ADDRESS 0x00000024 -#define PHY_ADDR_OFFSET 0x00000024 -#define PHY_ADDR_VAL_MSB 2 -#define PHY_ADDR_VAL_LSB 0 -#define PHY_ADDR_VAL_MASK 0x00000007 -#define PHY_ADDR_VAL_GET(x) (((x) & PHY_ADDR_VAL_MASK) >> PHY_ADDR_VAL_LSB) -#define PHY_ADDR_VAL_SET(x) (((x) << PHY_ADDR_VAL_LSB) & PHY_ADDR_VAL_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct mdio_reg_reg_s { - volatile unsigned int mdio_reg[8]; - volatile unsigned int mdio_isr; - volatile unsigned int phy_addr; -} mdio_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _MDIO_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mii_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mii_reg.h deleted file mode 100644 index eefd4419f8e0..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mii_reg.h +++ /dev/null @@ -1,83 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _MII_REG_REG_H_ -#define _MII_REG_REG_H_ - -#define MII0_CNTL_ADDRESS 0x00000000 -#define MII0_CNTL_OFFSET 0x00000000 -#define MII0_CNTL_RGMII_DELAY_MSB 9 -#define MII0_CNTL_RGMII_DELAY_LSB 8 -#define MII0_CNTL_RGMII_DELAY_MASK 0x00000300 -#define MII0_CNTL_RGMII_DELAY_GET(x) (((x) & MII0_CNTL_RGMII_DELAY_MASK) >> MII0_CNTL_RGMII_DELAY_LSB) -#define MII0_CNTL_RGMII_DELAY_SET(x) (((x) << MII0_CNTL_RGMII_DELAY_LSB) & MII0_CNTL_RGMII_DELAY_MASK) -#define MII0_CNTL_SPEED_MSB 5 -#define MII0_CNTL_SPEED_LSB 4 -#define MII0_CNTL_SPEED_MASK 0x00000030 -#define MII0_CNTL_SPEED_GET(x) (((x) & MII0_CNTL_SPEED_MASK) >> MII0_CNTL_SPEED_LSB) -#define MII0_CNTL_SPEED_SET(x) (((x) << MII0_CNTL_SPEED_LSB) & MII0_CNTL_SPEED_MASK) -#define MII0_CNTL_MASTER_MSB 2 -#define MII0_CNTL_MASTER_LSB 2 -#define MII0_CNTL_MASTER_MASK 0x00000004 -#define MII0_CNTL_MASTER_GET(x) (((x) & MII0_CNTL_MASTER_MASK) >> MII0_CNTL_MASTER_LSB) -#define MII0_CNTL_MASTER_SET(x) (((x) << MII0_CNTL_MASTER_LSB) & MII0_CNTL_MASTER_MASK) -#define MII0_CNTL_SELECT_MSB 1 -#define MII0_CNTL_SELECT_LSB 0 -#define MII0_CNTL_SELECT_MASK 0x00000003 -#define MII0_CNTL_SELECT_GET(x) (((x) & MII0_CNTL_SELECT_MASK) >> MII0_CNTL_SELECT_LSB) -#define MII0_CNTL_SELECT_SET(x) (((x) << MII0_CNTL_SELECT_LSB) & MII0_CNTL_SELECT_MASK) - -#define STAT_CNTL_ADDRESS 0x00000004 -#define STAT_CNTL_OFFSET 0x00000004 -#define STAT_CNTL_GIG_MSB 3 -#define STAT_CNTL_GIG_LSB 3 -#define STAT_CNTL_GIG_MASK 0x00000008 -#define STAT_CNTL_GIG_GET(x) (((x) & STAT_CNTL_GIG_MASK) >> STAT_CNTL_GIG_LSB) -#define STAT_CNTL_GIG_SET(x) (((x) << STAT_CNTL_GIG_LSB) & STAT_CNTL_GIG_MASK) -#define STAT_CNTL_STEN_MSB 2 -#define STAT_CNTL_STEN_LSB 2 -#define STAT_CNTL_STEN_MASK 0x00000004 -#define STAT_CNTL_STEN_GET(x) (((x) & STAT_CNTL_STEN_MASK) >> STAT_CNTL_STEN_LSB) -#define STAT_CNTL_STEN_SET(x) (((x) << STAT_CNTL_STEN_LSB) & STAT_CNTL_STEN_MASK) -#define STAT_CNTL_CLRCNT_MSB 1 -#define STAT_CNTL_CLRCNT_LSB 1 -#define STAT_CNTL_CLRCNT_MASK 0x00000002 -#define STAT_CNTL_CLRCNT_GET(x) (((x) & STAT_CNTL_CLRCNT_MASK) >> STAT_CNTL_CLRCNT_LSB) -#define STAT_CNTL_CLRCNT_SET(x) (((x) << STAT_CNTL_CLRCNT_LSB) & STAT_CNTL_CLRCNT_MASK) -#define STAT_CNTL_AUTOZ_MSB 0 -#define STAT_CNTL_AUTOZ_LSB 0 -#define STAT_CNTL_AUTOZ_MASK 0x00000001 -#define STAT_CNTL_AUTOZ_GET(x) (((x) & STAT_CNTL_AUTOZ_MASK) >> STAT_CNTL_AUTOZ_LSB) -#define STAT_CNTL_AUTOZ_SET(x) (((x) << STAT_CNTL_AUTOZ_LSB) & STAT_CNTL_AUTOZ_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct mii_reg_reg_s { - volatile unsigned int mii0_cntl; - volatile unsigned int stat_cntl; -} mii_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _MII_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mmac_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mmac_reg.h deleted file mode 100644 index 91ccccae31b7..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/mmac_reg.h +++ /dev/null @@ -1,375 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _MMAC_REG_REG_H_ -#define _MMAC_REG_REG_H_ - - -/* macros for RX_FRAME0 */ -#define RX_FRAME0_ADDRESS 0x00000000 -#define RX_FRAME0_OFFSET 0x00000000 -#define RX_FRAME0_OWN_MSB 0 -#define RX_FRAME0_OWN_LSB 0 -#define RX_FRAME0_OWN_MASK 0x00000001 -#define RX_FRAME0_OWN_GET(x) (((x) & 0x00000001) >> 0) -#define RX_FRAME0_OWN_SET(x) (((x) << 0) & 0x00000001) -#define RX_FRAME0_LEN_MSB 12 -#define RX_FRAME0_LEN_LSB 1 -#define RX_FRAME0_LEN_MASK 0x00001ffe -#define RX_FRAME0_LEN_GET(x) (((x) & 0x00001ffe) >> 1) -#define RX_FRAME0_SEQ_NUM_MSB 14 -#define RX_FRAME0_SEQ_NUM_LSB 13 -#define RX_FRAME0_SEQ_NUM_MASK 0x00006000 -#define RX_FRAME0_SEQ_NUM_GET(x) (((x) & 0x00006000) >> 13) - -/* macros for RX_FRAME_0 */ -#define RX_FRAME_0_ADDRESS 0x00000004 -#define RX_FRAME_0_OFFSET 0x00000004 -#define RX_FRAME_0_ADDR_MSB 31 -#define RX_FRAME_0_ADDR_LSB 0 -#define RX_FRAME_0_ADDR_MASK 0xffffffff -#define RX_FRAME_0_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define RX_FRAME_0_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for RX_FRAME1 */ -#define RX_FRAME1_ADDRESS 0x00000008 -#define RX_FRAME1_OFFSET 0x00000008 -#define RX_FRAME1_OWN_MSB 0 -#define RX_FRAME1_OWN_LSB 0 -#define RX_FRAME1_OWN_MASK 0x00000001 -#define RX_FRAME1_OWN_GET(x) (((x) & 0x00000001) >> 0) -#define RX_FRAME1_OWN_SET(x) (((x) << 0) & 0x00000001) -#define RX_FRAME1_LEN_MSB 12 -#define RX_FRAME1_LEN_LSB 1 -#define RX_FRAME1_LEN_MASK 0x00001ffe -#define RX_FRAME1_LEN_GET(x) (((x) & 0x00001ffe) >> 1) -#define RX_FRAME1_SEQ_NUM_MSB 14 -#define RX_FRAME1_SEQ_NUM_LSB 13 -#define RX_FRAME1_SEQ_NUM_MASK 0x00006000 -#define RX_FRAME1_SEQ_NUM_GET(x) (((x) & 0x00006000) >> 13) - -/* macros for RX_FRAME_1 */ -#define RX_FRAME_1_ADDRESS 0x0000000c -#define RX_FRAME_1_OFFSET 0x0000000c -#define RX_FRAME_1_ADDR_MSB 31 -#define RX_FRAME_1_ADDR_LSB 0 -#define RX_FRAME_1_ADDR_MASK 0xffffffff -#define RX_FRAME_1_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define RX_FRAME_1_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MMAC_INTERRUPT_RAW */ -#define MMAC_INTERRUPT_RAW_ADDRESS 0x00000010 -#define MMAC_INTERRUPT_RAW_OFFSET 0x00000010 -#define MMAC_INTERRUPT_RAW_RX_DONE0_MSB 0 -#define MMAC_INTERRUPT_RAW_RX_DONE0_LSB 0 -#define MMAC_INTERRUPT_RAW_RX_DONE0_MASK 0x00000001 -#define MMAC_INTERRUPT_RAW_RX_DONE0_GET(x) (((x) & 0x00000001) >> 0) -#define MMAC_INTERRUPT_RAW_RX_DONE0_SET(x) (((x) << 0) & 0x00000001) -#define MMAC_INTERRUPT_RAW_RX_CRC_FAIL0_MSB 1 -#define MMAC_INTERRUPT_RAW_RX_CRC_FAIL0_LSB 1 -#define MMAC_INTERRUPT_RAW_RX_CRC_FAIL0_MASK 0x00000002 -#define MMAC_INTERRUPT_RAW_RX_CRC_FAIL0_GET(x) (((x) & 0x00000002) >> 1) -#define MMAC_INTERRUPT_RAW_RX_CRC_FAIL0_SET(x) (((x) << 1) & 0x00000002) -#define MMAC_INTERRUPT_RAW_ACK_RESP_FAIL0_MSB 2 -#define MMAC_INTERRUPT_RAW_ACK_RESP_FAIL0_LSB 2 -#define MMAC_INTERRUPT_RAW_ACK_RESP_FAIL0_MASK 0x00000004 -#define MMAC_INTERRUPT_RAW_ACK_RESP_FAIL0_GET(x) (((x) & 0x00000004) >> 2) -#define MMAC_INTERRUPT_RAW_ACK_RESP_FAIL0_SET(x) (((x) << 2) & 0x00000004) -#define MMAC_INTERRUPT_RAW_RX_DONE1_MSB 3 -#define MMAC_INTERRUPT_RAW_RX_DONE1_LSB 3 -#define MMAC_INTERRUPT_RAW_RX_DONE1_MASK 0x00000008 -#define MMAC_INTERRUPT_RAW_RX_DONE1_GET(x) (((x) & 0x00000008) >> 3) -#define MMAC_INTERRUPT_RAW_RX_DONE1_SET(x) (((x) << 3) & 0x00000008) -#define MMAC_INTERRUPT_RAW_RX_CRC_FAIL1_MSB 4 -#define MMAC_INTERRUPT_RAW_RX_CRC_FAIL1_LSB 4 -#define MMAC_INTERRUPT_RAW_RX_CRC_FAIL1_MASK 0x00000010 -#define MMAC_INTERRUPT_RAW_RX_CRC_FAIL1_GET(x) (((x) & 0x00000010) >> 4) -#define MMAC_INTERRUPT_RAW_RX_CRC_FAIL1_SET(x) (((x) << 4) & 0x00000010) -#define MMAC_INTERRUPT_RAW_ACK_RESP_FAIL1_MSB 5 -#define MMAC_INTERRUPT_RAW_ACK_RESP_FAIL1_LSB 5 -#define MMAC_INTERRUPT_RAW_ACK_RESP_FAIL1_MASK 0x00000020 -#define MMAC_INTERRUPT_RAW_ACK_RESP_FAIL1_GET(x) (((x) & 0x00000020) >> 5) -#define MMAC_INTERRUPT_RAW_ACK_RESP_FAIL1_SET(x) (((x) << 5) & 0x00000020) -#define MMAC_INTERRUPT_RAW_RX_ERR_OVERFLOW_MSB 6 -#define MMAC_INTERRUPT_RAW_RX_ERR_OVERFLOW_LSB 6 -#define MMAC_INTERRUPT_RAW_RX_ERR_OVERFLOW_MASK 0x00000040 -#define MMAC_INTERRUPT_RAW_RX_ERR_OVERFLOW_GET(x) (((x) & 0x00000040) >> 6) -#define MMAC_INTERRUPT_RAW_RX_ERR_OVERFLOW_SET(x) (((x) << 6) & 0x00000040) -#define MMAC_INTERRUPT_RAW_TX_DONE_MSB 7 -#define MMAC_INTERRUPT_RAW_TX_DONE_LSB 7 -#define MMAC_INTERRUPT_RAW_TX_DONE_MASK 0x00000080 -#define MMAC_INTERRUPT_RAW_TX_DONE_GET(x) (((x) & 0x00000080) >> 7) -#define MMAC_INTERRUPT_RAW_TX_DONE_SET(x) (((x) << 7) & 0x00000080) -#define MMAC_INTERRUPT_RAW_TX_DONE_ACK_MISSING_MSB 8 -#define MMAC_INTERRUPT_RAW_TX_DONE_ACK_MISSING_LSB 8 -#define MMAC_INTERRUPT_RAW_TX_DONE_ACK_MISSING_MASK 0x00000100 -#define MMAC_INTERRUPT_RAW_TX_DONE_ACK_MISSING_GET(x) (((x) & 0x00000100) >> 8) -#define MMAC_INTERRUPT_RAW_TX_DONE_ACK_MISSING_SET(x) (((x) << 8) & 0x00000100) -#define MMAC_INTERRUPT_RAW_TX_DONE_ACK_RECEIVED_MSB 9 -#define MMAC_INTERRUPT_RAW_TX_DONE_ACK_RECEIVED_LSB 9 -#define MMAC_INTERRUPT_RAW_TX_DONE_ACK_RECEIVED_MASK 0x00000200 -#define MMAC_INTERRUPT_RAW_TX_DONE_ACK_RECEIVED_GET(x) (((x) & 0x00000200) >> 9) -#define MMAC_INTERRUPT_RAW_TX_DONE_ACK_RECEIVED_SET(x) (((x) << 9) & 0x00000200) -#define MMAC_INTERRUPT_RAW_TX_ERROR_MSB 10 -#define MMAC_INTERRUPT_RAW_TX_ERROR_LSB 10 -#define MMAC_INTERRUPT_RAW_TX_ERROR_MASK 0x00000400 -#define MMAC_INTERRUPT_RAW_TX_ERROR_GET(x) (((x) & 0x00000400) >> 10) -#define MMAC_INTERRUPT_RAW_TX_ERROR_SET(x) (((x) << 10) & 0x00000400) - -/* macros for MMAC_INTERRUPT_EN */ -#define MMAC_INTERRUPT_EN_ADDRESS 0x00000014 -#define MMAC_INTERRUPT_EN_OFFSET 0x00000014 -#define MMAC_INTERRUPT_EN_RX_DONE0_MSB 0 -#define MMAC_INTERRUPT_EN_RX_DONE0_LSB 0 -#define MMAC_INTERRUPT_EN_RX_DONE0_MASK 0x00000001 -#define MMAC_INTERRUPT_EN_RX_DONE0_GET(x) (((x) & 0x00000001) >> 0) -#define MMAC_INTERRUPT_EN_RX_DONE0_SET(x) (((x) << 0) & 0x00000001) -#define MMAC_INTERRUPT_EN_RX_CRC_FAIL0_MSB 1 -#define MMAC_INTERRUPT_EN_RX_CRC_FAIL0_LSB 1 -#define MMAC_INTERRUPT_EN_RX_CRC_FAIL0_MASK 0x00000002 -#define MMAC_INTERRUPT_EN_RX_CRC_FAIL0_GET(x) (((x) & 0x00000002) >> 1) -#define MMAC_INTERRUPT_EN_RX_CRC_FAIL0_SET(x) (((x) << 1) & 0x00000002) -#define MMAC_INTERRUPT_EN_ACK_RESP_FAIL0_MSB 2 -#define MMAC_INTERRUPT_EN_ACK_RESP_FAIL0_LSB 2 -#define MMAC_INTERRUPT_EN_ACK_RESP_FAIL0_MASK 0x00000004 -#define MMAC_INTERRUPT_EN_ACK_RESP_FAIL0_GET(x) (((x) & 0x00000004) >> 2) -#define MMAC_INTERRUPT_EN_ACK_RESP_FAIL0_SET(x) (((x) << 2) & 0x00000004) -#define MMAC_INTERRUPT_EN_RX_DONE1_MSB 3 -#define MMAC_INTERRUPT_EN_RX_DONE1_LSB 3 -#define MMAC_INTERRUPT_EN_RX_DONE1_MASK 0x00000008 -#define MMAC_INTERRUPT_EN_RX_DONE1_GET(x) (((x) & 0x00000008) >> 3) -#define MMAC_INTERRUPT_EN_RX_DONE1_SET(x) (((x) << 3) & 0x00000008) -#define MMAC_INTERRUPT_EN_RX_CRC_FAIL1_MSB 4 -#define MMAC_INTERRUPT_EN_RX_CRC_FAIL1_LSB 4 -#define MMAC_INTERRUPT_EN_RX_CRC_FAIL1_MASK 0x00000010 -#define MMAC_INTERRUPT_EN_RX_CRC_FAIL1_GET(x) (((x) & 0x00000010) >> 4) -#define MMAC_INTERRUPT_EN_RX_CRC_FAIL1_SET(x) (((x) << 4) & 0x00000010) -#define MMAC_INTERRUPT_EN_ACK_RESP_FAIL1_MSB 5 -#define MMAC_INTERRUPT_EN_ACK_RESP_FAIL1_LSB 5 -#define MMAC_INTERRUPT_EN_ACK_RESP_FAIL1_MASK 0x00000020 -#define MMAC_INTERRUPT_EN_ACK_RESP_FAIL1_GET(x) (((x) & 0x00000020) >> 5) -#define MMAC_INTERRUPT_EN_ACK_RESP_FAIL1_SET(x) (((x) << 5) & 0x00000020) -#define MMAC_INTERRUPT_EN_RX_ERR_OVERFLOW_MSB 6 -#define MMAC_INTERRUPT_EN_RX_ERR_OVERFLOW_LSB 6 -#define MMAC_INTERRUPT_EN_RX_ERR_OVERFLOW_MASK 0x00000040 -#define MMAC_INTERRUPT_EN_RX_ERR_OVERFLOW_GET(x) (((x) & 0x00000040) >> 6) -#define MMAC_INTERRUPT_EN_RX_ERR_OVERFLOW_SET(x) (((x) << 6) & 0x00000040) -#define MMAC_INTERRUPT_EN_TX_DONE_MSB 7 -#define MMAC_INTERRUPT_EN_TX_DONE_LSB 7 -#define MMAC_INTERRUPT_EN_TX_DONE_MASK 0x00000080 -#define MMAC_INTERRUPT_EN_TX_DONE_GET(x) (((x) & 0x00000080) >> 7) -#define MMAC_INTERRUPT_EN_TX_DONE_SET(x) (((x) << 7) & 0x00000080) -#define MMAC_INTERRUPT_EN_TX_DONE_ACK_MISSING_MSB 8 -#define MMAC_INTERRUPT_EN_TX_DONE_ACK_MISSING_LSB 8 -#define MMAC_INTERRUPT_EN_TX_DONE_ACK_MISSING_MASK 0x00000100 -#define MMAC_INTERRUPT_EN_TX_DONE_ACK_MISSING_GET(x) (((x) & 0x00000100) >> 8) -#define MMAC_INTERRUPT_EN_TX_DONE_ACK_MISSING_SET(x) (((x) << 8) & 0x00000100) -#define MMAC_INTERRUPT_EN_TX_DONE_ACK_RECEIVED_MSB 9 -#define MMAC_INTERRUPT_EN_TX_DONE_ACK_RECEIVED_LSB 9 -#define MMAC_INTERRUPT_EN_TX_DONE_ACK_RECEIVED_MASK 0x00000200 -#define MMAC_INTERRUPT_EN_TX_DONE_ACK_RECEIVED_GET(x) (((x) & 0x00000200) >> 9) -#define MMAC_INTERRUPT_EN_TX_DONE_ACK_RECEIVED_SET(x) (((x) << 9) & 0x00000200) -#define MMAC_INTERRUPT_EN_TX_ERROR_MSB 10 -#define MMAC_INTERRUPT_EN_TX_ERROR_LSB 10 -#define MMAC_INTERRUPT_EN_TX_ERROR_MASK 0x00000400 -#define MMAC_INTERRUPT_EN_TX_ERROR_GET(x) (((x) & 0x00000400) >> 10) -#define MMAC_INTERRUPT_EN_TX_ERROR_SET(x) (((x) << 10) & 0x00000400) - -/* macros for RX_PARAM1 */ -#define RX_PARAM1_ADDRESS 0x00000018 -#define RX_PARAM1_OFFSET 0x00000018 -#define RX_PARAM1_VAP_ADDR_L_MSB 31 -#define RX_PARAM1_VAP_ADDR_L_LSB 0 -#define RX_PARAM1_VAP_ADDR_L_MASK 0xffffffff -#define RX_PARAM1_VAP_ADDR_L_GET(x) (((x) & 0xffffffff) >> 0) -#define RX_PARAM1_VAP_ADDR_L_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for RX_PARAM0 */ -#define RX_PARAM0_ADDRESS 0x0000001c -#define RX_PARAM0_OFFSET 0x0000001c -#define RX_PARAM0_VAP_ADDR_U_MSB 15 -#define RX_PARAM0_VAP_ADDR_U_LSB 0 -#define RX_PARAM0_VAP_ADDR_U_MASK 0x0000ffff -#define RX_PARAM0_VAP_ADDR_U_GET(x) (((x) & 0x0000ffff) >> 0) -#define RX_PARAM0_VAP_ADDR_U_SET(x) (((x) << 0) & 0x0000ffff) -#define RX_PARAM0_SIFS_MSB 21 -#define RX_PARAM0_SIFS_LSB 16 -#define RX_PARAM0_SIFS_MASK 0x003f0000 -#define RX_PARAM0_SIFS_GET(x) (((x) & 0x003f0000) >> 16) -#define RX_PARAM0_SIFS_SET(x) (((x) << 16) & 0x003f0000) -#define RX_PARAM0_CAPTURE_MODE_MSB 23 -#define RX_PARAM0_CAPTURE_MODE_LSB 22 -#define RX_PARAM0_CAPTURE_MODE_MASK 0x00c00000 -#define RX_PARAM0_CAPTURE_MODE_GET(x) (((x) & 0x00c00000) >> 22) -#define RX_PARAM0_CAPTURE_MODE_SET(x) (((x) << 22) & 0x00c00000) -#define RX_PARAM0_TYPE_FILTER_MSB 26 -#define RX_PARAM0_TYPE_FILTER_LSB 24 -#define RX_PARAM0_TYPE_FILTER_MASK 0x07000000 -#define RX_PARAM0_TYPE_FILTER_GET(x) (((x) & 0x07000000) >> 24) -#define RX_PARAM0_TYPE_FILTER_SET(x) (((x) << 24) & 0x07000000) -#define RX_PARAM0_LIVE_MODE_MSB 27 -#define RX_PARAM0_LIVE_MODE_LSB 27 -#define RX_PARAM0_LIVE_MODE_MASK 0x08000000 -#define RX_PARAM0_LIVE_MODE_GET(x) (((x) & 0x08000000) >> 27) -#define RX_PARAM0_LIVE_MODE_SET(x) (((x) << 27) & 0x08000000) - -/* macros for TX_COMMAND0 */ -#define TX_COMMAND0_ADDRESS 0x00000020 -#define TX_COMMAND0_OFFSET 0x00000020 -#define TX_COMMAND0_LEN_MSB 11 -#define TX_COMMAND0_LEN_LSB 0 -#define TX_COMMAND0_LEN_MASK 0x00000fff -#define TX_COMMAND0_LEN_GET(x) (((x) & 0x00000fff) >> 0) -#define TX_COMMAND0_LEN_SET(x) (((x) << 0) & 0x00000fff) -#define TX_COMMAND0_CRC_MSB 12 -#define TX_COMMAND0_CRC_LSB 12 -#define TX_COMMAND0_CRC_MASK 0x00001000 -#define TX_COMMAND0_CRC_GET(x) (((x) & 0x00001000) >> 12) -#define TX_COMMAND0_CRC_SET(x) (((x) << 12) & 0x00001000) -#define TX_COMMAND0_EXP_ACK_MSB 13 -#define TX_COMMAND0_EXP_ACK_LSB 13 -#define TX_COMMAND0_EXP_ACK_MASK 0x00002000 -#define TX_COMMAND0_EXP_ACK_GET(x) (((x) & 0x00002000) >> 13) -#define TX_COMMAND0_EXP_ACK_SET(x) (((x) << 13) & 0x00002000) - -/* macros for TX_COMMAND */ -#define TX_COMMAND_ADDRESS 0x00000024 -#define TX_COMMAND_OFFSET 0x00000024 -#define TX_COMMAND_ADDR_MSB 31 -#define TX_COMMAND_ADDR_LSB 0 -#define TX_COMMAND_ADDR_MASK 0xffffffff -#define TX_COMMAND_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define TX_COMMAND_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for TX_PARAM */ -#define TX_PARAM_ADDRESS 0x00000028 -#define TX_PARAM_OFFSET 0x00000028 -#define TX_PARAM_ACK_MODE_EN_MSB 0 -#define TX_PARAM_ACK_MODE_EN_LSB 0 -#define TX_PARAM_ACK_MODE_EN_MASK 0x00000001 -#define TX_PARAM_ACK_MODE_EN_GET(x) (((x) & 0x00000001) >> 0) -#define TX_PARAM_ACK_MODE_EN_SET(x) (((x) << 0) & 0x00000001) -#define TX_PARAM_ACK_TIMEOUT_MSB 6 -#define TX_PARAM_ACK_TIMEOUT_LSB 1 -#define TX_PARAM_ACK_TIMEOUT_MASK 0x0000007e -#define TX_PARAM_ACK_TIMEOUT_GET(x) (((x) & 0x0000007e) >> 1) -#define TX_PARAM_ACK_TIMEOUT_SET(x) (((x) << 1) & 0x0000007e) -#define TX_PARAM_BACKOFF_MSB 14 -#define TX_PARAM_BACKOFF_LSB 7 -#define TX_PARAM_BACKOFF_MASK 0x00007f80 -#define TX_PARAM_BACKOFF_GET(x) (((x) & 0x00007f80) >> 7) -#define TX_PARAM_BACKOFF_SET(x) (((x) << 7) & 0x00007f80) -#define TX_PARAM_FORCE_ACKF_RSSI_MSB 15 -#define TX_PARAM_FORCE_ACKF_RSSI_LSB 15 -#define TX_PARAM_FORCE_ACKF_RSSI_MASK 0x00008000 -#define TX_PARAM_FORCE_ACKF_RSSI_GET(x) (((x) & 0x00008000) >> 15) -#define TX_PARAM_FORCE_ACKF_RSSI_SET(x) (((x) << 15) & 0x00008000) -#define TX_PARAM_ACKF_RSSI_MSB 23 -#define TX_PARAM_ACKF_RSSI_LSB 16 -#define TX_PARAM_ACKF_RSSI_MASK 0x00ff0000 -#define TX_PARAM_ACKF_RSSI_GET(x) (((x) & 0x00ff0000) >> 16) -#define TX_PARAM_ACKF_RSSI_SET(x) (((x) << 16) & 0x00ff0000) - -/* macros for BEACON_PARAM */ -#define BEACON_PARAM_ADDRESS 0x0000002c -#define BEACON_PARAM_OFFSET 0x0000002c -#define BEACON_PARAM_INTERVAL_MSB 15 -#define BEACON_PARAM_INTERVAL_LSB 0 -#define BEACON_PARAM_INTERVAL_MASK 0x0000ffff -#define BEACON_PARAM_INTERVAL_GET(x) (((x) & 0x0000ffff) >> 0) -#define BEACON_PARAM_INTERVAL_SET(x) (((x) << 0) & 0x0000ffff) -#define BEACON_PARAM_LEN_MSB 27 -#define BEACON_PARAM_LEN_LSB 16 -#define BEACON_PARAM_LEN_MASK 0x0fff0000 -#define BEACON_PARAM_LEN_GET(x) (((x) & 0x0fff0000) >> 16) -#define BEACON_PARAM_LEN_SET(x) (((x) << 16) & 0x0fff0000) -#define BEACON_PARAM_EN_MSB 28 -#define BEACON_PARAM_EN_LSB 28 -#define BEACON_PARAM_EN_MASK 0x10000000 -#define BEACON_PARAM_EN_GET(x) (((x) & 0x10000000) >> 28) -#define BEACON_PARAM_EN_SET(x) (((x) << 28) & 0x10000000) -#define BEACON_PARAM_CRC_MSB 29 -#define BEACON_PARAM_CRC_LSB 29 -#define BEACON_PARAM_CRC_MASK 0x20000000 -#define BEACON_PARAM_CRC_GET(x) (((x) & 0x20000000) >> 29) -#define BEACON_PARAM_CRC_SET(x) (((x) << 29) & 0x20000000) -#define BEACON_PARAM_RESET_TS_MSB 30 -#define BEACON_PARAM_RESET_TS_LSB 30 -#define BEACON_PARAM_RESET_TS_MASK 0x40000000 -#define BEACON_PARAM_RESET_TS_GET(x) (((x) & 0x40000000) >> 30) -#define BEACON_PARAM_RESET_TS_SET(x) (((x) << 30) & 0x40000000) - -/* macros for BEACON */ -#define BEACON_ADDRESS 0x00000030 -#define BEACON_OFFSET 0x00000030 -#define BEACON_ADDR_MSB 31 -#define BEACON_ADDR_LSB 0 -#define BEACON_ADDR_MASK 0xffffffff -#define BEACON_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define BEACON_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for TSF_L */ -#define TSF_L_ADDRESS 0x00000034 -#define TSF_L_OFFSET 0x00000034 -#define TSF_L_COUNT_MSB 31 -#define TSF_L_COUNT_LSB 0 -#define TSF_L_COUNT_MASK 0xffffffff -#define TSF_L_COUNT_GET(x) (((x) & 0xffffffff) >> 0) -#define TSF_L_COUNT_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for TSF_U */ -#define TSF_U_ADDRESS 0x00000038 -#define TSF_U_OFFSET 0x00000038 -#define TSF_U_COUNT_MSB 31 -#define TSF_U_COUNT_LSB 0 -#define TSF_U_COUNT_MASK 0xffffffff -#define TSF_U_COUNT_GET(x) (((x) & 0xffffffff) >> 0) -#define TSF_U_COUNT_SET(x) (((x) << 0) & 0xffffffff) - - -#ifndef __ASSEMBLER__ - -typedef struct mmac_reg_reg_s { - volatile unsigned int RX_FRAME0; /* 0x0 - 0x4 */ - volatile unsigned int RX_FRAME_0; /* 0x4 - 0x8 */ - volatile unsigned int RX_FRAME1; /* 0x8 - 0xc */ - volatile unsigned int RX_FRAME_1; /* 0xc - 0x10 */ - volatile unsigned int MMAC_INTERRUPT_RAW; /* 0x10 - 0x14 */ - volatile unsigned int MMAC_INTERRUPT_EN; /* 0x14 - 0x18 */ - volatile unsigned int RX_PARAM1; /* 0x18 - 0x1c */ - volatile unsigned int RX_PARAM0; /* 0x1c - 0x20 */ - volatile unsigned int TX_COMMAND0; /* 0x20 - 0x24 */ - volatile unsigned int TX_COMMAND; /* 0x24 - 0x28 */ - volatile unsigned int TX_PARAM; /* 0x28 - 0x2c */ - volatile unsigned int BEACON_PARAM; /* 0x2c - 0x30 */ - volatile unsigned int BEACON; /* 0x30 - 0x34 */ - volatile unsigned int TSF_L; /* 0x34 - 0x38 */ - volatile unsigned int TSF_U; /* 0x38 - 0x3c */ -} mmac_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _MMAC_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/odin_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/odin_reg.h deleted file mode 100644 index f9af9bff29c8..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/odin_reg.h +++ /dev/null @@ -1,397 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _ODIN_REG_REG_H_ -#define _ODIN_REG_REG_H_ - - -/* macros for PHY_CTRL0 */ -#define PHY_CTRL0_ADDRESS 0x00000000 -#define PHY_CTRL0_OFFSET 0x00000000 -#define PHY_CTRL0_PLL_ICP_MSB 2 -#define PHY_CTRL0_PLL_ICP_LSB 0 -#define PHY_CTRL0_PLL_ICP_MASK 0x00000007 -#define PHY_CTRL0_PLL_ICP_GET(x) (((x) & 0x00000007) >> 0) -#define PHY_CTRL0_PLL_ICP_SET(x) (((x) << 0) & 0x00000007) -#define PHY_CTRL0_PLL_RS_MSB 5 -#define PHY_CTRL0_PLL_RS_LSB 3 -#define PHY_CTRL0_PLL_RS_MASK 0x00000038 -#define PHY_CTRL0_PLL_RS_GET(x) (((x) & 0x00000038) >> 3) -#define PHY_CTRL0_PLL_RS_SET(x) (((x) << 3) & 0x00000038) -#define PHY_CTRL0_PLL_DIV_MSB 14 -#define PHY_CTRL0_PLL_DIV_LSB 6 -#define PHY_CTRL0_PLL_DIV_MASK 0x00007fc0 -#define PHY_CTRL0_PLL_DIV_GET(x) (((x) & 0x00007fc0) >> 6) -#define PHY_CTRL0_PLL_DIV_SET(x) (((x) << 6) & 0x00007fc0) -#define PHY_CTRL0_PLL_MOD_MSB 17 -#define PHY_CTRL0_PLL_MOD_LSB 15 -#define PHY_CTRL0_PLL_MOD_MASK 0x00038000 -#define PHY_CTRL0_PLL_MOD_GET(x) (((x) & 0x00038000) >> 15) -#define PHY_CTRL0_PLL_MOD_SET(x) (((x) << 15) & 0x00038000) -#define PHY_CTRL0_PLL_OVERIDE_MSB 18 -#define PHY_CTRL0_PLL_OVERIDE_LSB 18 -#define PHY_CTRL0_PLL_OVERIDE_MASK 0x00040000 -#define PHY_CTRL0_PLL_OVERIDE_GET(x) (((x) & 0x00040000) >> 18) -#define PHY_CTRL0_PLL_OVERIDE_SET(x) (((x) << 18) & 0x00040000) -#define PHY_CTRL0_TEST_SPEED_SELECT_MSB 19 -#define PHY_CTRL0_TEST_SPEED_SELECT_LSB 19 -#define PHY_CTRL0_TEST_SPEED_SELECT_MASK 0x00080000 -#define PHY_CTRL0_TEST_SPEED_SELECT_GET(x) (((x) & 0x00080000) >> 19) -#define PHY_CTRL0_TEST_SPEED_SELECT_SET(x) (((x) << 19) & 0x00080000) -#define PHY_CTRL0_RX_PATTERN_EN_MSB 20 -#define PHY_CTRL0_RX_PATTERN_EN_LSB 20 -#define PHY_CTRL0_RX_PATTERN_EN_MASK 0x00100000 -#define PHY_CTRL0_RX_PATTERN_EN_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_CTRL0_RX_PATTERN_EN_SET(x) (((x) << 20) & 0x00100000) -#define PHY_CTRL0_TX_PATTERN_EN_MSB 21 -#define PHY_CTRL0_TX_PATTERN_EN_LSB 21 -#define PHY_CTRL0_TX_PATTERN_EN_MASK 0x00200000 -#define PHY_CTRL0_TX_PATTERN_EN_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_CTRL0_TX_PATTERN_EN_SET(x) (((x) << 21) & 0x00200000) -#define PHY_CTRL0_ANA_LOOPBACK_EN_MSB 22 -#define PHY_CTRL0_ANA_LOOPBACK_EN_LSB 22 -#define PHY_CTRL0_ANA_LOOPBACK_EN_MASK 0x00400000 -#define PHY_CTRL0_ANA_LOOPBACK_EN_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_CTRL0_ANA_LOOPBACK_EN_SET(x) (((x) << 22) & 0x00400000) -#define PHY_CTRL0_DIG_LOOPBACK_EN_MSB 23 -#define PHY_CTRL0_DIG_LOOPBACK_EN_LSB 23 -#define PHY_CTRL0_DIG_LOOPBACK_EN_MASK 0x00800000 -#define PHY_CTRL0_DIG_LOOPBACK_EN_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_CTRL0_DIG_LOOPBACK_EN_SET(x) (((x) << 23) & 0x00800000) -#define PHY_CTRL0_LOOPBACK_ERR_CNT_MSB 31 -#define PHY_CTRL0_LOOPBACK_ERR_CNT_LSB 24 -#define PHY_CTRL0_LOOPBACK_ERR_CNT_MASK 0xff000000 -#define PHY_CTRL0_LOOPBACK_ERR_CNT_GET(x) (((x) & 0xff000000) >> 24) - -/* macros for PHY_CTRL1 */ -#define PHY_CTRL1_ADDRESS 0x00000004 -#define PHY_CTRL1_OFFSET 0x00000004 -#define PHY_CTRL1_RX_FILBW_SEL_MSB 1 -#define PHY_CTRL1_RX_FILBW_SEL_LSB 0 -#define PHY_CTRL1_RX_FILBW_SEL_MASK 0x00000003 -#define PHY_CTRL1_RX_FILBW_SEL_GET(x) (((x) & 0x00000003) >> 0) -#define PHY_CTRL1_RX_FILBW_SEL_SET(x) (((x) << 0) & 0x00000003) -#define PHY_CTRL1_RX_FORCERXON_MSB 2 -#define PHY_CTRL1_RX_FORCERXON_LSB 2 -#define PHY_CTRL1_RX_FORCERXON_MASK 0x00000004 -#define PHY_CTRL1_RX_FORCERXON_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_CTRL1_RX_FORCERXON_SET(x) (((x) << 2) & 0x00000004) -#define PHY_CTRL1_RX_BYPASSEQ_MSB 3 -#define PHY_CTRL1_RX_BYPASSEQ_LSB 3 -#define PHY_CTRL1_RX_BYPASSEQ_MASK 0x00000008 -#define PHY_CTRL1_RX_BYPASSEQ_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_CTRL1_RX_BYPASSEQ_SET(x) (((x) << 3) & 0x00000008) -#define PHY_CTRL1_RX_LOWR_PDET_MSB 4 -#define PHY_CTRL1_RX_LOWR_PDET_LSB 4 -#define PHY_CTRL1_RX_LOWR_PDET_MASK 0x00000010 -#define PHY_CTRL1_RX_LOWR_PDET_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_CTRL1_RX_LOWR_PDET_SET(x) (((x) << 4) & 0x00000010) -#define PHY_CTRL1_RX_SELIR_100M_MSB 6 -#define PHY_CTRL1_RX_SELIR_100M_LSB 5 -#define PHY_CTRL1_RX_SELIR_100M_MASK 0x00000060 -#define PHY_CTRL1_RX_SELIR_100M_GET(x) (((x) & 0x00000060) >> 5) -#define PHY_CTRL1_RX_SELIR_100M_SET(x) (((x) << 5) & 0x00000060) -#define PHY_CTRL1_RX_SELVREF0P6_MSB 7 -#define PHY_CTRL1_RX_SELVREF0P6_LSB 7 -#define PHY_CTRL1_RX_SELVREF0P6_MASK 0x00000080 -#define PHY_CTRL1_RX_SELVREF0P6_GET(x) (((x) & 0x00000080) >> 7) -#define PHY_CTRL1_RX_SELVREF0P6_SET(x) (((x) << 7) & 0x00000080) -#define PHY_CTRL1_RX_SELVREF0P25_MSB 8 -#define PHY_CTRL1_RX_SELVREF0P25_LSB 8 -#define PHY_CTRL1_RX_SELVREF0P25_MASK 0x00000100 -#define PHY_CTRL1_RX_SELVREF0P25_GET(x) (((x) & 0x00000100) >> 8) -#define PHY_CTRL1_RX_SELVREF0P25_SET(x) (((x) << 8) & 0x00000100) -#define PHY_CTRL1_RX_RSVD_MSB 11 -#define PHY_CTRL1_RX_RSVD_LSB 9 -#define PHY_CTRL1_RX_RSVD_MASK 0x00000e00 -#define PHY_CTRL1_RX_RSVD_GET(x) (((x) & 0x00000e00) >> 9) -#define PHY_CTRL1_RX_RSVD_SET(x) (((x) << 9) & 0x00000e00) -#define PHY_CTRL1_NO_PLL_PWD_MSB 12 -#define PHY_CTRL1_NO_PLL_PWD_LSB 12 -#define PHY_CTRL1_NO_PLL_PWD_MASK 0x00001000 -#define PHY_CTRL1_NO_PLL_PWD_GET(x) (((x) & 0x00001000) >> 12) -#define PHY_CTRL1_NO_PLL_PWD_SET(x) (((x) << 12) & 0x00001000) -#define PHY_CTRL1_FORCE_SUSPEND_MSB 13 -#define PHY_CTRL1_FORCE_SUSPEND_LSB 13 -#define PHY_CTRL1_FORCE_SUSPEND_MASK 0x00002000 -#define PHY_CTRL1_FORCE_SUSPEND_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_CTRL1_FORCE_SUSPEND_SET(x) (((x) << 13) & 0x00002000) -#define PHY_CTRL1_TX_PATTERN_SEL_MSB 19 -#define PHY_CTRL1_TX_PATTERN_SEL_LSB 18 -#define PHY_CTRL1_TX_PATTERN_SEL_MASK 0x000c0000 -#define PHY_CTRL1_TX_PATTERN_SEL_GET(x) (((x) & 0x000c0000) >> 18) -#define PHY_CTRL1_TX_PATTERN_SEL_SET(x) (((x) << 18) & 0x000c0000) -#define PHY_CTRL1_USE_PLL_LOCKDETECT_MSB 20 -#define PHY_CTRL1_USE_PLL_LOCKDETECT_LSB 20 -#define PHY_CTRL1_USE_PLL_LOCKDETECT_MASK 0x00100000 -#define PHY_CTRL1_USE_PLL_LOCKDETECT_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_CTRL1_USE_PLL_LOCKDETECT_SET(x) (((x) << 20) & 0x00100000) -#define PHY_CTRL1_USE_PLL_LOCK_DLY_SEL_MSB 22 -#define PHY_CTRL1_USE_PLL_LOCK_DLY_SEL_LSB 21 -#define PHY_CTRL1_USE_PLL_LOCK_DLY_SEL_MASK 0x00600000 -#define PHY_CTRL1_USE_PLL_LOCK_DLY_SEL_GET(x) (((x) & 0x00600000) >> 21) -#define PHY_CTRL1_USE_PLL_LOCK_DLY_SEL_SET(x) (((x) << 21) & 0x00600000) -#define PHY_CTRL1_CLKOBS_SEL_MSB 25 -#define PHY_CTRL1_CLKOBS_SEL_LSB 23 -#define PHY_CTRL1_CLKOBS_SEL_MASK 0x03800000 -#define PHY_CTRL1_CLKOBS_SEL_GET(x) (((x) & 0x03800000) >> 23) -#define PHY_CTRL1_CLKOBS_SEL_SET(x) (((x) << 23) & 0x03800000) -#define PHY_CTRL1_ENABLE_REFCLK_GATE_MSB 26 -#define PHY_CTRL1_ENABLE_REFCLK_GATE_LSB 26 -#define PHY_CTRL1_ENABLE_REFCLK_GATE_MASK 0x04000000 -#define PHY_CTRL1_ENABLE_REFCLK_GATE_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_CTRL1_ENABLE_REFCLK_GATE_SET(x) (((x) << 26) & 0x04000000) -#define PHY_CTRL1_DISABLE_CLK_GATING_MSB 27 -#define PHY_CTRL1_DISABLE_CLK_GATING_LSB 27 -#define PHY_CTRL1_DISABLE_CLK_GATING_MASK 0x08000000 -#define PHY_CTRL1_DISABLE_CLK_GATING_GET(x) (((x) & 0x08000000) >> 27) -#define PHY_CTRL1_DISABLE_CLK_GATING_SET(x) (((x) << 27) & 0x08000000) -#define PHY_CTRL1_PLL_OBS_MODE_N_MSB 31 -#define PHY_CTRL1_PLL_OBS_MODE_N_LSB 31 -#define PHY_CTRL1_PLL_OBS_MODE_N_MASK 0x80000000 -#define PHY_CTRL1_PLL_OBS_MODE_N_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_CTRL1_PLL_OBS_MODE_N_SET(x) (((x) << 31) & 0x80000000) - -/* macros for PHY_CTRL2 */ -#define PHY_CTRL2_ADDRESS 0x00000008 -#define PHY_CTRL2_OFFSET 0x00000008 -#define PHY_CTRL2_HSTXBIAS_PS_EN_MSB 0 -#define PHY_CTRL2_HSTXBIAS_PS_EN_LSB 0 -#define PHY_CTRL2_HSTXBIAS_PS_EN_MASK 0x00000001 -#define PHY_CTRL2_HSTXBIAS_PS_EN_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_CTRL2_HSTXBIAS_PS_EN_SET(x) (((x) << 0) & 0x00000001) -#define PHY_CTRL2_HSRXPHASE_PS_EN_MSB 1 -#define PHY_CTRL2_HSRXPHASE_PS_EN_LSB 1 -#define PHY_CTRL2_HSRXPHASE_PS_EN_MASK 0x00000002 -#define PHY_CTRL2_HSRXPHASE_PS_EN_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_CTRL2_HSRXPHASE_PS_EN_SET(x) (((x) << 1) & 0x00000002) -#define PHY_CTRL2_PWD_IPLL_MSB 7 -#define PHY_CTRL2_PWD_IPLL_LSB 2 -#define PHY_CTRL2_PWD_IPLL_MASK 0x000000fc -#define PHY_CTRL2_PWD_IPLL_GET(x) (((x) & 0x000000fc) >> 2) -#define PHY_CTRL2_PWD_IPLL_SET(x) (((x) << 2) & 0x000000fc) -#define PHY_CTRL2_PWD_ISP_MSB 13 -#define PHY_CTRL2_PWD_ISP_LSB 8 -#define PHY_CTRL2_PWD_ISP_MASK 0x00003f00 -#define PHY_CTRL2_PWD_ISP_GET(x) (((x) & 0x00003f00) >> 8) -#define PHY_CTRL2_PWD_ISP_SET(x) (((x) << 8) & 0x00003f00) -#define PHY_CTRL2_TX_CAL_EN_MSB 20 -#define PHY_CTRL2_TX_CAL_EN_LSB 20 -#define PHY_CTRL2_TX_CAL_EN_MASK 0x00100000 -#define PHY_CTRL2_TX_CAL_EN_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_CTRL2_TX_CAL_EN_SET(x) (((x) << 20) & 0x00100000) -#define PHY_CTRL2_TX_CAL_SEL_MSB 21 -#define PHY_CTRL2_TX_CAL_SEL_LSB 21 -#define PHY_CTRL2_TX_CAL_SEL_MASK 0x00200000 -#define PHY_CTRL2_TX_CAL_SEL_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_CTRL2_TX_CAL_SEL_SET(x) (((x) << 21) & 0x00200000) -#define PHY_CTRL2_TX_MAN_CAL_MSB 25 -#define PHY_CTRL2_TX_MAN_CAL_LSB 22 -#define PHY_CTRL2_TX_MAN_CAL_MASK 0x03c00000 -#define PHY_CTRL2_TX_MAN_CAL_GET(x) (((x) & 0x03c00000) >> 22) -#define PHY_CTRL2_TX_MAN_CAL_SET(x) (((x) << 22) & 0x03c00000) -#define PHY_CTRL2_TX_LCKDET_OVR_MSB 26 -#define PHY_CTRL2_TX_LCKDET_OVR_LSB 26 -#define PHY_CTRL2_TX_LCKDET_OVR_MASK 0x04000000 -#define PHY_CTRL2_TX_LCKDET_OVR_GET(x) (((x) & 0x04000000) >> 26) -#define PHY_CTRL2_TX_LCKDET_OVR_SET(x) (((x) << 26) & 0x04000000) -#define PHY_CTRL2_TX_RSVD_MSB 30 -#define PHY_CTRL2_TX_RSVD_LSB 27 -#define PHY_CTRL2_TX_RSVD_MASK 0x78000000 -#define PHY_CTRL2_TX_RSVD_GET(x) (((x) & 0x78000000) >> 27) -#define PHY_CTRL2_TX_RSVD_SET(x) (((x) << 27) & 0x78000000) -#define PHY_CTRL2_PWD_EXTBIAS_MSB 31 -#define PHY_CTRL2_PWD_EXTBIAS_LSB 31 -#define PHY_CTRL2_PWD_EXTBIAS_MASK 0x80000000 -#define PHY_CTRL2_PWD_EXTBIAS_GET(x) (((x) & 0x80000000) >> 31) -#define PHY_CTRL2_PWD_EXTBIAS_SET(x) (((x) << 31) & 0x80000000) - -/* macros for PHY_CTRL3 */ -#define PHY_CTRL3_ADDRESS 0x0000000c -#define PHY_CTRL3_OFFSET 0x0000000c -#define PHY_CTRL3_PWD_ITX_MSB 18 -#define PHY_CTRL3_PWD_ITX_LSB 0 -#define PHY_CTRL3_PWD_ITX_MASK 0x0007ffff -#define PHY_CTRL3_PWD_ITX_GET(x) (((x) & 0x0007ffff) >> 0) -#define PHY_CTRL3_PWD_ITX_SET(x) (((x) << 0) & 0x0007ffff) -#define PHY_CTRL3_TX_DISABLE_SHORT_DET_MSB 21 -#define PHY_CTRL3_TX_DISABLE_SHORT_DET_LSB 21 -#define PHY_CTRL3_TX_DISABLE_SHORT_DET_MASK 0x00200000 -#define PHY_CTRL3_TX_DISABLE_SHORT_DET_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_CTRL3_TX_DISABLE_SHORT_DET_SET(x) (((x) << 21) & 0x00200000) -#define PHY_CTRL3_TX_SELTEST_MSB 24 -#define PHY_CTRL3_TX_SELTEST_LSB 22 -#define PHY_CTRL3_TX_SELTEST_MASK 0x01c00000 -#define PHY_CTRL3_TX_SELTEST_GET(x) (((x) & 0x01c00000) >> 22) -#define PHY_CTRL3_TX_SELTEST_SET(x) (((x) << 22) & 0x01c00000) -#define PHY_CTRL3_TX_STARTCAL_MSB 25 -#define PHY_CTRL3_TX_STARTCAL_LSB 25 -#define PHY_CTRL3_TX_STARTCAL_MASK 0x02000000 -#define PHY_CTRL3_TX_STARTCAL_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_CTRL3_TX_STARTCAL_SET(x) (((x) << 25) & 0x02000000) - -/* macros for PHY_CTRL4 */ -#define PHY_CTRL4_ADDRESS 0x00000010 -#define PHY_CTRL4_OFFSET 0x00000010 -#define PHY_CTRL4_PWD_IRX_MSB 11 -#define PHY_CTRL4_PWD_IRX_LSB 0 -#define PHY_CTRL4_PWD_IRX_MASK 0x00000fff -#define PHY_CTRL4_PWD_IRX_GET(x) (((x) & 0x00000fff) >> 0) -#define PHY_CTRL4_PWD_IRX_SET(x) (((x) << 0) & 0x00000fff) - -/* macros for PHY_CTRL5 */ -#define PHY_CTRL5_ADDRESS 0x00000014 -#define PHY_CTRL5_OFFSET 0x00000014 -#define PHY_CTRL5_TX_BIAS_DELAY_MSB 6 -#define PHY_CTRL5_TX_BIAS_DELAY_LSB 0 -#define PHY_CTRL5_TX_BIAS_DELAY_MASK 0x0000007f -#define PHY_CTRL5_TX_BIAS_DELAY_GET(x) (((x) & 0x0000007f) >> 0) -#define PHY_CTRL5_TX_BIAS_DELAY_SET(x) (((x) << 0) & 0x0000007f) -#define PHY_CTRL5_EB_WATERMARK_MSB 12 -#define PHY_CTRL5_EB_WATERMARK_LSB 7 -#define PHY_CTRL5_EB_WATERMARK_MASK 0x00001f80 -#define PHY_CTRL5_EB_WATERMARK_GET(x) (((x) & 0x00001f80) >> 7) -#define PHY_CTRL5_EB_WATERMARK_SET(x) (((x) << 7) & 0x00001f80) -#define PHY_CTRL5_FORCE_IDDQ_MSB 13 -#define PHY_CTRL5_FORCE_IDDQ_LSB 13 -#define PHY_CTRL5_FORCE_IDDQ_MASK 0x00002000 -#define PHY_CTRL5_FORCE_IDDQ_GET(x) (((x) & 0x00002000) >> 13) -#define PHY_CTRL5_FORCE_IDDQ_SET(x) (((x) << 13) & 0x00002000) -#define PHY_CTRL5_FORCE_TEST_J_MSB 14 -#define PHY_CTRL5_FORCE_TEST_J_LSB 14 -#define PHY_CTRL5_FORCE_TEST_J_MASK 0x00004000 -#define PHY_CTRL5_FORCE_TEST_J_GET(x) (((x) & 0x00004000) >> 14) -#define PHY_CTRL5_FORCE_TEST_J_SET(x) (((x) << 14) & 0x00004000) -#define PHY_CTRL5_FORCE_TEST_K_MSB 15 -#define PHY_CTRL5_FORCE_TEST_K_LSB 15 -#define PHY_CTRL5_FORCE_TEST_K_MASK 0x00008000 -#define PHY_CTRL5_FORCE_TEST_K_GET(x) (((x) & 0x00008000) >> 15) -#define PHY_CTRL5_FORCE_TEST_K_SET(x) (((x) << 15) & 0x00008000) -#define PHY_CTRL5_FORCE_TEST_SE0_NAK_MSB 16 -#define PHY_CTRL5_FORCE_TEST_SE0_NAK_LSB 16 -#define PHY_CTRL5_FORCE_TEST_SE0_NAK_MASK 0x00010000 -#define PHY_CTRL5_FORCE_TEST_SE0_NAK_GET(x) (((x) & 0x00010000) >> 16) -#define PHY_CTRL5_FORCE_TEST_SE0_NAK_SET(x) (((x) << 16) & 0x00010000) -#define PHY_CTRL5_TEST_JK_OVERRIDE_MSB 17 -#define PHY_CTRL5_TEST_JK_OVERRIDE_LSB 17 -#define PHY_CTRL5_TEST_JK_OVERRIDE_MASK 0x00020000 -#define PHY_CTRL5_TEST_JK_OVERRIDE_GET(x) (((x) & 0x00020000) >> 17) -#define PHY_CTRL5_TEST_JK_OVERRIDE_SET(x) (((x) << 17) & 0x00020000) -#define PHY_CTRL5_XCVR_SEL_MSB 19 -#define PHY_CTRL5_XCVR_SEL_LSB 18 -#define PHY_CTRL5_XCVR_SEL_MASK 0x000c0000 -#define PHY_CTRL5_XCVR_SEL_GET(x) (((x) & 0x000c0000) >> 18) -#define PHY_CTRL5_XCVR_SEL_SET(x) (((x) << 18) & 0x000c0000) -#define PHY_CTRL5_TERM_SEL_MSB 20 -#define PHY_CTRL5_TERM_SEL_LSB 20 -#define PHY_CTRL5_TERM_SEL_MASK 0x00100000 -#define PHY_CTRL5_TERM_SEL_GET(x) (((x) & 0x00100000) >> 20) -#define PHY_CTRL5_TERM_SEL_SET(x) (((x) << 20) & 0x00100000) -#define PHY_CTRL5_SUSPEND_N_MSB 21 -#define PHY_CTRL5_SUSPEND_N_LSB 21 -#define PHY_CTRL5_SUSPEND_N_MASK 0x00200000 -#define PHY_CTRL5_SUSPEND_N_GET(x) (((x) & 0x00200000) >> 21) -#define PHY_CTRL5_SUSPEND_N_SET(x) (((x) << 21) & 0x00200000) -#define PHY_CTRL5_DP_PULLDOWN_MSB 22 -#define PHY_CTRL5_DP_PULLDOWN_LSB 22 -#define PHY_CTRL5_DP_PULLDOWN_MASK 0x00400000 -#define PHY_CTRL5_DP_PULLDOWN_GET(x) (((x) & 0x00400000) >> 22) -#define PHY_CTRL5_DP_PULLDOWN_SET(x) (((x) << 22) & 0x00400000) -#define PHY_CTRL5_DM_PULLDOWN_MSB 23 -#define PHY_CTRL5_DM_PULLDOWN_LSB 23 -#define PHY_CTRL5_DM_PULLDOWN_MASK 0x00800000 -#define PHY_CTRL5_DM_PULLDOWN_GET(x) (((x) & 0x00800000) >> 23) -#define PHY_CTRL5_DM_PULLDOWN_SET(x) (((x) << 23) & 0x00800000) -#define PHY_CTRL5_HOST_DISCON_FIX_ON_MSB 24 -#define PHY_CTRL5_HOST_DISCON_FIX_ON_LSB 24 -#define PHY_CTRL5_HOST_DISCON_FIX_ON_MASK 0x01000000 -#define PHY_CTRL5_HOST_DISCON_FIX_ON_GET(x) (((x) & 0x01000000) >> 24) -#define PHY_CTRL5_HOST_DISCON_FIX_ON_SET(x) (((x) << 24) & 0x01000000) -#define PHY_CTRL5_HOST_DISCON_DETECT_ON_MSB 25 -#define PHY_CTRL5_HOST_DISCON_DETECT_ON_LSB 25 -#define PHY_CTRL5_HOST_DISCON_DETECT_ON_MASK 0x02000000 -#define PHY_CTRL5_HOST_DISCON_DETECT_ON_GET(x) (((x) & 0x02000000) >> 25) -#define PHY_CTRL5_HOST_DISCON_DETECT_ON_SET(x) (((x) << 25) & 0x02000000) -#define PHY_CTRL5_HOST_DISCON_SAMPLE_WIDTH_MSB 28 -#define PHY_CTRL5_HOST_DISCON_SAMPLE_WIDTH_LSB 26 -#define PHY_CTRL5_HOST_DISCON_SAMPLE_WIDTH_MASK 0x1c000000 -#define PHY_CTRL5_HOST_DISCON_SAMPLE_WIDTH_GET(x) (((x) & 0x1c000000) >> 26) -#define PHY_CTRL5_HOST_DISCON_SAMPLE_WIDTH_SET(x) (((x) << 26) & 0x1c000000) - -/* macros for PHY_CTRL6 */ -#define PHY_CTRL6_ADDRESS 0x00000018 -#define PHY_CTRL6_OFFSET 0x00000018 -#define PHY_CTRL6_AVALID_MSB 0 -#define PHY_CTRL6_AVALID_LSB 0 -#define PHY_CTRL6_AVALID_MASK 0x00000001 -#define PHY_CTRL6_AVALID_GET(x) (((x) & 0x00000001) >> 0) -#define PHY_CTRL6_AVALID_SET(x) (((x) << 0) & 0x00000001) -#define PHY_CTRL6_BVALID_MSB 1 -#define PHY_CTRL6_BVALID_LSB 1 -#define PHY_CTRL6_BVALID_MASK 0x00000002 -#define PHY_CTRL6_BVALID_GET(x) (((x) & 0x00000002) >> 1) -#define PHY_CTRL6_BVALID_SET(x) (((x) << 1) & 0x00000002) -#define PHY_CTRL6_VBUSVALID_MSB 2 -#define PHY_CTRL6_VBUSVALID_LSB 2 -#define PHY_CTRL6_VBUSVALID_MASK 0x00000004 -#define PHY_CTRL6_VBUSVALID_GET(x) (((x) & 0x00000004) >> 2) -#define PHY_CTRL6_VBUSVALID_SET(x) (((x) << 2) & 0x00000004) -#define PHY_CTRL6_SESSEND_MSB 3 -#define PHY_CTRL6_SESSEND_LSB 3 -#define PHY_CTRL6_SESSEND_MASK 0x00000008 -#define PHY_CTRL6_SESSEND_GET(x) (((x) & 0x00000008) >> 3) -#define PHY_CTRL6_SESSEND_SET(x) (((x) << 3) & 0x00000008) -#define PHY_CTRL6_IDDIG_MSB 4 -#define PHY_CTRL6_IDDIG_LSB 4 -#define PHY_CTRL6_IDDIG_MASK 0x00000010 -#define PHY_CTRL6_IDDIG_GET(x) (((x) & 0x00000010) >> 4) -#define PHY_CTRL6_IDDIG_SET(x) (((x) << 4) & 0x00000010) - -/* macros for PHY_STATUS */ -#define PHY_STATUS_ADDRESS 0x0000001c -#define PHY_STATUS_OFFSET 0x0000001c -#define PHY_STATUS_TX_CAL_MSB 3 -#define PHY_STATUS_TX_CAL_LSB 0 -#define PHY_STATUS_TX_CAL_MASK 0x0000000f -#define PHY_STATUS_TX_CAL_GET(x) (((x) & 0x0000000f) >> 0) - - -#ifndef __ASSEMBLER__ - -typedef struct odin_reg_reg_s { - volatile unsigned int PHY_CTRL0; /* 0x0 - 0x4 */ - volatile unsigned int PHY_CTRL1; /* 0x4 - 0x8 */ - volatile unsigned int PHY_CTRL2; /* 0x8 - 0xc */ - volatile unsigned int PHY_CTRL3; /* 0xc - 0x10 */ - volatile unsigned int PHY_CTRL4; /* 0x10 - 0x14 */ - volatile unsigned int PHY_CTRL5; /* 0x14 - 0x18 */ - volatile unsigned int PHY_CTRL6; /* 0x18 - 0x1c */ - volatile unsigned int PHY_STATUS; /* 0x1c - 0x20 */ -} odin_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _ODIN_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rdma_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rdma_reg.h deleted file mode 100644 index f21e8878ed3f..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rdma_reg.h +++ /dev/null @@ -1,948 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _RDMA_REG_REG_H_ -#define _RDMA_REG_REG_H_ - -#define DMA_CONFIG_ADDRESS 0x00000000 -#define DMA_CONFIG_OFFSET 0x00000000 -#define DMA_CONFIG_WLBB_PWD_EN_MSB 4 -#define DMA_CONFIG_WLBB_PWD_EN_LSB 4 -#define DMA_CONFIG_WLBB_PWD_EN_MASK 0x00000010 -#define DMA_CONFIG_WLBB_PWD_EN_GET(x) (((x) & DMA_CONFIG_WLBB_PWD_EN_MASK) >> DMA_CONFIG_WLBB_PWD_EN_LSB) -#define DMA_CONFIG_WLBB_PWD_EN_SET(x) (((x) << DMA_CONFIG_WLBB_PWD_EN_LSB) & DMA_CONFIG_WLBB_PWD_EN_MASK) -#define DMA_CONFIG_WLMAC_PWD_EN_MSB 3 -#define DMA_CONFIG_WLMAC_PWD_EN_LSB 3 -#define DMA_CONFIG_WLMAC_PWD_EN_MASK 0x00000008 -#define DMA_CONFIG_WLMAC_PWD_EN_GET(x) (((x) & DMA_CONFIG_WLMAC_PWD_EN_MASK) >> DMA_CONFIG_WLMAC_PWD_EN_LSB) -#define DMA_CONFIG_WLMAC_PWD_EN_SET(x) (((x) << DMA_CONFIG_WLMAC_PWD_EN_LSB) & DMA_CONFIG_WLMAC_PWD_EN_MASK) -#define DMA_CONFIG_ENABLE_RETENTION_MSB 2 -#define DMA_CONFIG_ENABLE_RETENTION_LSB 2 -#define DMA_CONFIG_ENABLE_RETENTION_MASK 0x00000004 -#define DMA_CONFIG_ENABLE_RETENTION_GET(x) (((x) & DMA_CONFIG_ENABLE_RETENTION_MASK) >> DMA_CONFIG_ENABLE_RETENTION_LSB) -#define DMA_CONFIG_ENABLE_RETENTION_SET(x) (((x) << DMA_CONFIG_ENABLE_RETENTION_LSB) & DMA_CONFIG_ENABLE_RETENTION_MASK) -#define DMA_CONFIG_RTC_PRIORITY_MSB 1 -#define DMA_CONFIG_RTC_PRIORITY_LSB 1 -#define DMA_CONFIG_RTC_PRIORITY_MASK 0x00000002 -#define DMA_CONFIG_RTC_PRIORITY_GET(x) (((x) & DMA_CONFIG_RTC_PRIORITY_MASK) >> DMA_CONFIG_RTC_PRIORITY_LSB) -#define DMA_CONFIG_RTC_PRIORITY_SET(x) (((x) << DMA_CONFIG_RTC_PRIORITY_LSB) & DMA_CONFIG_RTC_PRIORITY_MASK) -#define DMA_CONFIG_DMA_TYPE_MSB 0 -#define DMA_CONFIG_DMA_TYPE_LSB 0 -#define DMA_CONFIG_DMA_TYPE_MASK 0x00000001 -#define DMA_CONFIG_DMA_TYPE_GET(x) (((x) & DMA_CONFIG_DMA_TYPE_MASK) >> DMA_CONFIG_DMA_TYPE_LSB) -#define DMA_CONFIG_DMA_TYPE_SET(x) (((x) << DMA_CONFIG_DMA_TYPE_LSB) & DMA_CONFIG_DMA_TYPE_MASK) - -#define DMA_CONTROL_ADDRESS 0x00000004 -#define DMA_CONTROL_OFFSET 0x00000004 -#define DMA_CONTROL_START_MSB 1 -#define DMA_CONTROL_START_LSB 1 -#define DMA_CONTROL_START_MASK 0x00000002 -#define DMA_CONTROL_START_GET(x) (((x) & DMA_CONTROL_START_MASK) >> DMA_CONTROL_START_LSB) -#define DMA_CONTROL_START_SET(x) (((x) << DMA_CONTROL_START_LSB) & DMA_CONTROL_START_MASK) -#define DMA_CONTROL_STOP_MSB 0 -#define DMA_CONTROL_STOP_LSB 0 -#define DMA_CONTROL_STOP_MASK 0x00000001 -#define DMA_CONTROL_STOP_GET(x) (((x) & DMA_CONTROL_STOP_MASK) >> DMA_CONTROL_STOP_LSB) -#define DMA_CONTROL_STOP_SET(x) (((x) << DMA_CONTROL_STOP_LSB) & DMA_CONTROL_STOP_MASK) - -#define DMA_SRC_ADDRESS 0x00000008 -#define DMA_SRC_OFFSET 0x00000008 -#define DMA_SRC_ADDR_MSB 31 -#define DMA_SRC_ADDR_LSB 2 -#define DMA_SRC_ADDR_MASK 0xfffffffc -#define DMA_SRC_ADDR_GET(x) (((x) & DMA_SRC_ADDR_MASK) >> DMA_SRC_ADDR_LSB) -#define DMA_SRC_ADDR_SET(x) (((x) << DMA_SRC_ADDR_LSB) & DMA_SRC_ADDR_MASK) - -#define DMA_DEST_ADDRESS 0x0000000c -#define DMA_DEST_OFFSET 0x0000000c -#define DMA_DEST_ADDR_MSB 31 -#define DMA_DEST_ADDR_LSB 2 -#define DMA_DEST_ADDR_MASK 0xfffffffc -#define DMA_DEST_ADDR_GET(x) (((x) & DMA_DEST_ADDR_MASK) >> DMA_DEST_ADDR_LSB) -#define DMA_DEST_ADDR_SET(x) (((x) << DMA_DEST_ADDR_LSB) & DMA_DEST_ADDR_MASK) - -#define DMA_LENGTH_ADDRESS 0x00000010 -#define DMA_LENGTH_OFFSET 0x00000010 -#define DMA_LENGTH_WORDS_MSB 11 -#define DMA_LENGTH_WORDS_LSB 0 -#define DMA_LENGTH_WORDS_MASK 0x00000fff -#define DMA_LENGTH_WORDS_GET(x) (((x) & DMA_LENGTH_WORDS_MASK) >> DMA_LENGTH_WORDS_LSB) -#define DMA_LENGTH_WORDS_SET(x) (((x) << DMA_LENGTH_WORDS_LSB) & DMA_LENGTH_WORDS_MASK) - -#define VMC_BASE_ADDRESS 0x00000014 -#define VMC_BASE_OFFSET 0x00000014 -#define VMC_BASE_ADDR_MSB 31 -#define VMC_BASE_ADDR_LSB 2 -#define VMC_BASE_ADDR_MASK 0xfffffffc -#define VMC_BASE_ADDR_GET(x) (((x) & VMC_BASE_ADDR_MASK) >> VMC_BASE_ADDR_LSB) -#define VMC_BASE_ADDR_SET(x) (((x) << VMC_BASE_ADDR_LSB) & VMC_BASE_ADDR_MASK) - -#define INDIRECT_REG_ADDRESS 0x00000018 -#define INDIRECT_REG_OFFSET 0x00000018 -#define INDIRECT_REG_ID_MSB 31 -#define INDIRECT_REG_ID_LSB 2 -#define INDIRECT_REG_ID_MASK 0xfffffffc -#define INDIRECT_REG_ID_GET(x) (((x) & INDIRECT_REG_ID_MASK) >> INDIRECT_REG_ID_LSB) -#define INDIRECT_REG_ID_SET(x) (((x) << INDIRECT_REG_ID_LSB) & INDIRECT_REG_ID_MASK) - -#define INDIRECT_RETURN_ADDRESS 0x0000001c -#define INDIRECT_RETURN_OFFSET 0x0000001c -#define INDIRECT_RETURN_ADDR_MSB 31 -#define INDIRECT_RETURN_ADDR_LSB 2 -#define INDIRECT_RETURN_ADDR_MASK 0xfffffffc -#define INDIRECT_RETURN_ADDR_GET(x) (((x) & INDIRECT_RETURN_ADDR_MASK) >> INDIRECT_RETURN_ADDR_LSB) -#define INDIRECT_RETURN_ADDR_SET(x) (((x) << INDIRECT_RETURN_ADDR_LSB) & INDIRECT_RETURN_ADDR_MASK) - -#define RDMA_REGION_0__ADDRESS 0x00000020 -#define RDMA_REGION_0__OFFSET 0x00000020 -#define RDMA_REGION_0__ADDR_MSB 31 -#define RDMA_REGION_0__ADDR_LSB 13 -#define RDMA_REGION_0__ADDR_MASK 0xffffe000 -#define RDMA_REGION_0__ADDR_GET(x) (((x) & RDMA_REGION_0__ADDR_MASK) >> RDMA_REGION_0__ADDR_LSB) -#define RDMA_REGION_0__ADDR_SET(x) (((x) << RDMA_REGION_0__ADDR_LSB) & RDMA_REGION_0__ADDR_MASK) -#define RDMA_REGION_0__LENGTH_MSB 12 -#define RDMA_REGION_0__LENGTH_LSB 2 -#define RDMA_REGION_0__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_0__LENGTH_GET(x) (((x) & RDMA_REGION_0__LENGTH_MASK) >> RDMA_REGION_0__LENGTH_LSB) -#define RDMA_REGION_0__LENGTH_SET(x) (((x) << RDMA_REGION_0__LENGTH_LSB) & RDMA_REGION_0__LENGTH_MASK) -#define RDMA_REGION_0__INDI_MSB 1 -#define RDMA_REGION_0__INDI_LSB 1 -#define RDMA_REGION_0__INDI_MASK 0x00000002 -#define RDMA_REGION_0__INDI_GET(x) (((x) & RDMA_REGION_0__INDI_MASK) >> RDMA_REGION_0__INDI_LSB) -#define RDMA_REGION_0__INDI_SET(x) (((x) << RDMA_REGION_0__INDI_LSB) & RDMA_REGION_0__INDI_MASK) -#define RDMA_REGION_0__NEXT_MSB 0 -#define RDMA_REGION_0__NEXT_LSB 0 -#define RDMA_REGION_0__NEXT_MASK 0x00000001 -#define RDMA_REGION_0__NEXT_GET(x) (((x) & RDMA_REGION_0__NEXT_MASK) >> RDMA_REGION_0__NEXT_LSB) -#define RDMA_REGION_0__NEXT_SET(x) (((x) << RDMA_REGION_0__NEXT_LSB) & RDMA_REGION_0__NEXT_MASK) - -#define RDMA_REGION_1__ADDRESS 0x00000024 -#define RDMA_REGION_1__OFFSET 0x00000024 -#define RDMA_REGION_1__ADDR_MSB 31 -#define RDMA_REGION_1__ADDR_LSB 13 -#define RDMA_REGION_1__ADDR_MASK 0xffffe000 -#define RDMA_REGION_1__ADDR_GET(x) (((x) & RDMA_REGION_1__ADDR_MASK) >> RDMA_REGION_1__ADDR_LSB) -#define RDMA_REGION_1__ADDR_SET(x) (((x) << RDMA_REGION_1__ADDR_LSB) & RDMA_REGION_1__ADDR_MASK) -#define RDMA_REGION_1__LENGTH_MSB 12 -#define RDMA_REGION_1__LENGTH_LSB 2 -#define RDMA_REGION_1__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_1__LENGTH_GET(x) (((x) & RDMA_REGION_1__LENGTH_MASK) >> RDMA_REGION_1__LENGTH_LSB) -#define RDMA_REGION_1__LENGTH_SET(x) (((x) << RDMA_REGION_1__LENGTH_LSB) & RDMA_REGION_1__LENGTH_MASK) -#define RDMA_REGION_1__INDI_MSB 1 -#define RDMA_REGION_1__INDI_LSB 1 -#define RDMA_REGION_1__INDI_MASK 0x00000002 -#define RDMA_REGION_1__INDI_GET(x) (((x) & RDMA_REGION_1__INDI_MASK) >> RDMA_REGION_1__INDI_LSB) -#define RDMA_REGION_1__INDI_SET(x) (((x) << RDMA_REGION_1__INDI_LSB) & RDMA_REGION_1__INDI_MASK) -#define RDMA_REGION_1__NEXT_MSB 0 -#define RDMA_REGION_1__NEXT_LSB 0 -#define RDMA_REGION_1__NEXT_MASK 0x00000001 -#define RDMA_REGION_1__NEXT_GET(x) (((x) & RDMA_REGION_1__NEXT_MASK) >> RDMA_REGION_1__NEXT_LSB) -#define RDMA_REGION_1__NEXT_SET(x) (((x) << RDMA_REGION_1__NEXT_LSB) & RDMA_REGION_1__NEXT_MASK) - -#define RDMA_REGION_2__ADDRESS 0x00000028 -#define RDMA_REGION_2__OFFSET 0x00000028 -#define RDMA_REGION_2__ADDR_MSB 31 -#define RDMA_REGION_2__ADDR_LSB 13 -#define RDMA_REGION_2__ADDR_MASK 0xffffe000 -#define RDMA_REGION_2__ADDR_GET(x) (((x) & RDMA_REGION_2__ADDR_MASK) >> RDMA_REGION_2__ADDR_LSB) -#define RDMA_REGION_2__ADDR_SET(x) (((x) << RDMA_REGION_2__ADDR_LSB) & RDMA_REGION_2__ADDR_MASK) -#define RDMA_REGION_2__LENGTH_MSB 12 -#define RDMA_REGION_2__LENGTH_LSB 2 -#define RDMA_REGION_2__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_2__LENGTH_GET(x) (((x) & RDMA_REGION_2__LENGTH_MASK) >> RDMA_REGION_2__LENGTH_LSB) -#define RDMA_REGION_2__LENGTH_SET(x) (((x) << RDMA_REGION_2__LENGTH_LSB) & RDMA_REGION_2__LENGTH_MASK) -#define RDMA_REGION_2__INDI_MSB 1 -#define RDMA_REGION_2__INDI_LSB 1 -#define RDMA_REGION_2__INDI_MASK 0x00000002 -#define RDMA_REGION_2__INDI_GET(x) (((x) & RDMA_REGION_2__INDI_MASK) >> RDMA_REGION_2__INDI_LSB) -#define RDMA_REGION_2__INDI_SET(x) (((x) << RDMA_REGION_2__INDI_LSB) & RDMA_REGION_2__INDI_MASK) -#define RDMA_REGION_2__NEXT_MSB 0 -#define RDMA_REGION_2__NEXT_LSB 0 -#define RDMA_REGION_2__NEXT_MASK 0x00000001 -#define RDMA_REGION_2__NEXT_GET(x) (((x) & RDMA_REGION_2__NEXT_MASK) >> RDMA_REGION_2__NEXT_LSB) -#define RDMA_REGION_2__NEXT_SET(x) (((x) << RDMA_REGION_2__NEXT_LSB) & RDMA_REGION_2__NEXT_MASK) - -#define RDMA_REGION_3__ADDRESS 0x0000002c -#define RDMA_REGION_3__OFFSET 0x0000002c -#define RDMA_REGION_3__ADDR_MSB 31 -#define RDMA_REGION_3__ADDR_LSB 13 -#define RDMA_REGION_3__ADDR_MASK 0xffffe000 -#define RDMA_REGION_3__ADDR_GET(x) (((x) & RDMA_REGION_3__ADDR_MASK) >> RDMA_REGION_3__ADDR_LSB) -#define RDMA_REGION_3__ADDR_SET(x) (((x) << RDMA_REGION_3__ADDR_LSB) & RDMA_REGION_3__ADDR_MASK) -#define RDMA_REGION_3__LENGTH_MSB 12 -#define RDMA_REGION_3__LENGTH_LSB 2 -#define RDMA_REGION_3__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_3__LENGTH_GET(x) (((x) & RDMA_REGION_3__LENGTH_MASK) >> RDMA_REGION_3__LENGTH_LSB) -#define RDMA_REGION_3__LENGTH_SET(x) (((x) << RDMA_REGION_3__LENGTH_LSB) & RDMA_REGION_3__LENGTH_MASK) -#define RDMA_REGION_3__INDI_MSB 1 -#define RDMA_REGION_3__INDI_LSB 1 -#define RDMA_REGION_3__INDI_MASK 0x00000002 -#define RDMA_REGION_3__INDI_GET(x) (((x) & RDMA_REGION_3__INDI_MASK) >> RDMA_REGION_3__INDI_LSB) -#define RDMA_REGION_3__INDI_SET(x) (((x) << RDMA_REGION_3__INDI_LSB) & RDMA_REGION_3__INDI_MASK) -#define RDMA_REGION_3__NEXT_MSB 0 -#define RDMA_REGION_3__NEXT_LSB 0 -#define RDMA_REGION_3__NEXT_MASK 0x00000001 -#define RDMA_REGION_3__NEXT_GET(x) (((x) & RDMA_REGION_3__NEXT_MASK) >> RDMA_REGION_3__NEXT_LSB) -#define RDMA_REGION_3__NEXT_SET(x) (((x) << RDMA_REGION_3__NEXT_LSB) & RDMA_REGION_3__NEXT_MASK) - -#define RDMA_REGION_4__ADDRESS 0x00000030 -#define RDMA_REGION_4__OFFSET 0x00000030 -#define RDMA_REGION_4__ADDR_MSB 31 -#define RDMA_REGION_4__ADDR_LSB 13 -#define RDMA_REGION_4__ADDR_MASK 0xffffe000 -#define RDMA_REGION_4__ADDR_GET(x) (((x) & RDMA_REGION_4__ADDR_MASK) >> RDMA_REGION_4__ADDR_LSB) -#define RDMA_REGION_4__ADDR_SET(x) (((x) << RDMA_REGION_4__ADDR_LSB) & RDMA_REGION_4__ADDR_MASK) -#define RDMA_REGION_4__LENGTH_MSB 12 -#define RDMA_REGION_4__LENGTH_LSB 2 -#define RDMA_REGION_4__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_4__LENGTH_GET(x) (((x) & RDMA_REGION_4__LENGTH_MASK) >> RDMA_REGION_4__LENGTH_LSB) -#define RDMA_REGION_4__LENGTH_SET(x) (((x) << RDMA_REGION_4__LENGTH_LSB) & RDMA_REGION_4__LENGTH_MASK) -#define RDMA_REGION_4__INDI_MSB 1 -#define RDMA_REGION_4__INDI_LSB 1 -#define RDMA_REGION_4__INDI_MASK 0x00000002 -#define RDMA_REGION_4__INDI_GET(x) (((x) & RDMA_REGION_4__INDI_MASK) >> RDMA_REGION_4__INDI_LSB) -#define RDMA_REGION_4__INDI_SET(x) (((x) << RDMA_REGION_4__INDI_LSB) & RDMA_REGION_4__INDI_MASK) -#define RDMA_REGION_4__NEXT_MSB 0 -#define RDMA_REGION_4__NEXT_LSB 0 -#define RDMA_REGION_4__NEXT_MASK 0x00000001 -#define RDMA_REGION_4__NEXT_GET(x) (((x) & RDMA_REGION_4__NEXT_MASK) >> RDMA_REGION_4__NEXT_LSB) -#define RDMA_REGION_4__NEXT_SET(x) (((x) << RDMA_REGION_4__NEXT_LSB) & RDMA_REGION_4__NEXT_MASK) - -#define RDMA_REGION_5__ADDRESS 0x00000034 -#define RDMA_REGION_5__OFFSET 0x00000034 -#define RDMA_REGION_5__ADDR_MSB 31 -#define RDMA_REGION_5__ADDR_LSB 13 -#define RDMA_REGION_5__ADDR_MASK 0xffffe000 -#define RDMA_REGION_5__ADDR_GET(x) (((x) & RDMA_REGION_5__ADDR_MASK) >> RDMA_REGION_5__ADDR_LSB) -#define RDMA_REGION_5__ADDR_SET(x) (((x) << RDMA_REGION_5__ADDR_LSB) & RDMA_REGION_5__ADDR_MASK) -#define RDMA_REGION_5__LENGTH_MSB 12 -#define RDMA_REGION_5__LENGTH_LSB 2 -#define RDMA_REGION_5__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_5__LENGTH_GET(x) (((x) & RDMA_REGION_5__LENGTH_MASK) >> RDMA_REGION_5__LENGTH_LSB) -#define RDMA_REGION_5__LENGTH_SET(x) (((x) << RDMA_REGION_5__LENGTH_LSB) & RDMA_REGION_5__LENGTH_MASK) -#define RDMA_REGION_5__INDI_MSB 1 -#define RDMA_REGION_5__INDI_LSB 1 -#define RDMA_REGION_5__INDI_MASK 0x00000002 -#define RDMA_REGION_5__INDI_GET(x) (((x) & RDMA_REGION_5__INDI_MASK) >> RDMA_REGION_5__INDI_LSB) -#define RDMA_REGION_5__INDI_SET(x) (((x) << RDMA_REGION_5__INDI_LSB) & RDMA_REGION_5__INDI_MASK) -#define RDMA_REGION_5__NEXT_MSB 0 -#define RDMA_REGION_5__NEXT_LSB 0 -#define RDMA_REGION_5__NEXT_MASK 0x00000001 -#define RDMA_REGION_5__NEXT_GET(x) (((x) & RDMA_REGION_5__NEXT_MASK) >> RDMA_REGION_5__NEXT_LSB) -#define RDMA_REGION_5__NEXT_SET(x) (((x) << RDMA_REGION_5__NEXT_LSB) & RDMA_REGION_5__NEXT_MASK) - -#define RDMA_REGION_6__ADDRESS 0x00000038 -#define RDMA_REGION_6__OFFSET 0x00000038 -#define RDMA_REGION_6__ADDR_MSB 31 -#define RDMA_REGION_6__ADDR_LSB 13 -#define RDMA_REGION_6__ADDR_MASK 0xffffe000 -#define RDMA_REGION_6__ADDR_GET(x) (((x) & RDMA_REGION_6__ADDR_MASK) >> RDMA_REGION_6__ADDR_LSB) -#define RDMA_REGION_6__ADDR_SET(x) (((x) << RDMA_REGION_6__ADDR_LSB) & RDMA_REGION_6__ADDR_MASK) -#define RDMA_REGION_6__LENGTH_MSB 12 -#define RDMA_REGION_6__LENGTH_LSB 2 -#define RDMA_REGION_6__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_6__LENGTH_GET(x) (((x) & RDMA_REGION_6__LENGTH_MASK) >> RDMA_REGION_6__LENGTH_LSB) -#define RDMA_REGION_6__LENGTH_SET(x) (((x) << RDMA_REGION_6__LENGTH_LSB) & RDMA_REGION_6__LENGTH_MASK) -#define RDMA_REGION_6__INDI_MSB 1 -#define RDMA_REGION_6__INDI_LSB 1 -#define RDMA_REGION_6__INDI_MASK 0x00000002 -#define RDMA_REGION_6__INDI_GET(x) (((x) & RDMA_REGION_6__INDI_MASK) >> RDMA_REGION_6__INDI_LSB) -#define RDMA_REGION_6__INDI_SET(x) (((x) << RDMA_REGION_6__INDI_LSB) & RDMA_REGION_6__INDI_MASK) -#define RDMA_REGION_6__NEXT_MSB 0 -#define RDMA_REGION_6__NEXT_LSB 0 -#define RDMA_REGION_6__NEXT_MASK 0x00000001 -#define RDMA_REGION_6__NEXT_GET(x) (((x) & RDMA_REGION_6__NEXT_MASK) >> RDMA_REGION_6__NEXT_LSB) -#define RDMA_REGION_6__NEXT_SET(x) (((x) << RDMA_REGION_6__NEXT_LSB) & RDMA_REGION_6__NEXT_MASK) - -#define RDMA_REGION_7__ADDRESS 0x0000003c -#define RDMA_REGION_7__OFFSET 0x0000003c -#define RDMA_REGION_7__ADDR_MSB 31 -#define RDMA_REGION_7__ADDR_LSB 13 -#define RDMA_REGION_7__ADDR_MASK 0xffffe000 -#define RDMA_REGION_7__ADDR_GET(x) (((x) & RDMA_REGION_7__ADDR_MASK) >> RDMA_REGION_7__ADDR_LSB) -#define RDMA_REGION_7__ADDR_SET(x) (((x) << RDMA_REGION_7__ADDR_LSB) & RDMA_REGION_7__ADDR_MASK) -#define RDMA_REGION_7__LENGTH_MSB 12 -#define RDMA_REGION_7__LENGTH_LSB 2 -#define RDMA_REGION_7__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_7__LENGTH_GET(x) (((x) & RDMA_REGION_7__LENGTH_MASK) >> RDMA_REGION_7__LENGTH_LSB) -#define RDMA_REGION_7__LENGTH_SET(x) (((x) << RDMA_REGION_7__LENGTH_LSB) & RDMA_REGION_7__LENGTH_MASK) -#define RDMA_REGION_7__INDI_MSB 1 -#define RDMA_REGION_7__INDI_LSB 1 -#define RDMA_REGION_7__INDI_MASK 0x00000002 -#define RDMA_REGION_7__INDI_GET(x) (((x) & RDMA_REGION_7__INDI_MASK) >> RDMA_REGION_7__INDI_LSB) -#define RDMA_REGION_7__INDI_SET(x) (((x) << RDMA_REGION_7__INDI_LSB) & RDMA_REGION_7__INDI_MASK) -#define RDMA_REGION_7__NEXT_MSB 0 -#define RDMA_REGION_7__NEXT_LSB 0 -#define RDMA_REGION_7__NEXT_MASK 0x00000001 -#define RDMA_REGION_7__NEXT_GET(x) (((x) & RDMA_REGION_7__NEXT_MASK) >> RDMA_REGION_7__NEXT_LSB) -#define RDMA_REGION_7__NEXT_SET(x) (((x) << RDMA_REGION_7__NEXT_LSB) & RDMA_REGION_7__NEXT_MASK) - -#define RDMA_REGION_8__ADDRESS 0x00000040 -#define RDMA_REGION_8__OFFSET 0x00000040 -#define RDMA_REGION_8__ADDR_MSB 31 -#define RDMA_REGION_8__ADDR_LSB 13 -#define RDMA_REGION_8__ADDR_MASK 0xffffe000 -#define RDMA_REGION_8__ADDR_GET(x) (((x) & RDMA_REGION_8__ADDR_MASK) >> RDMA_REGION_8__ADDR_LSB) -#define RDMA_REGION_8__ADDR_SET(x) (((x) << RDMA_REGION_8__ADDR_LSB) & RDMA_REGION_8__ADDR_MASK) -#define RDMA_REGION_8__LENGTH_MSB 12 -#define RDMA_REGION_8__LENGTH_LSB 2 -#define RDMA_REGION_8__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_8__LENGTH_GET(x) (((x) & RDMA_REGION_8__LENGTH_MASK) >> RDMA_REGION_8__LENGTH_LSB) -#define RDMA_REGION_8__LENGTH_SET(x) (((x) << RDMA_REGION_8__LENGTH_LSB) & RDMA_REGION_8__LENGTH_MASK) -#define RDMA_REGION_8__INDI_MSB 1 -#define RDMA_REGION_8__INDI_LSB 1 -#define RDMA_REGION_8__INDI_MASK 0x00000002 -#define RDMA_REGION_8__INDI_GET(x) (((x) & RDMA_REGION_8__INDI_MASK) >> RDMA_REGION_8__INDI_LSB) -#define RDMA_REGION_8__INDI_SET(x) (((x) << RDMA_REGION_8__INDI_LSB) & RDMA_REGION_8__INDI_MASK) -#define RDMA_REGION_8__NEXT_MSB 0 -#define RDMA_REGION_8__NEXT_LSB 0 -#define RDMA_REGION_8__NEXT_MASK 0x00000001 -#define RDMA_REGION_8__NEXT_GET(x) (((x) & RDMA_REGION_8__NEXT_MASK) >> RDMA_REGION_8__NEXT_LSB) -#define RDMA_REGION_8__NEXT_SET(x) (((x) << RDMA_REGION_8__NEXT_LSB) & RDMA_REGION_8__NEXT_MASK) - -#define RDMA_REGION_9__ADDRESS 0x00000044 -#define RDMA_REGION_9__OFFSET 0x00000044 -#define RDMA_REGION_9__ADDR_MSB 31 -#define RDMA_REGION_9__ADDR_LSB 13 -#define RDMA_REGION_9__ADDR_MASK 0xffffe000 -#define RDMA_REGION_9__ADDR_GET(x) (((x) & RDMA_REGION_9__ADDR_MASK) >> RDMA_REGION_9__ADDR_LSB) -#define RDMA_REGION_9__ADDR_SET(x) (((x) << RDMA_REGION_9__ADDR_LSB) & RDMA_REGION_9__ADDR_MASK) -#define RDMA_REGION_9__LENGTH_MSB 12 -#define RDMA_REGION_9__LENGTH_LSB 2 -#define RDMA_REGION_9__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_9__LENGTH_GET(x) (((x) & RDMA_REGION_9__LENGTH_MASK) >> RDMA_REGION_9__LENGTH_LSB) -#define RDMA_REGION_9__LENGTH_SET(x) (((x) << RDMA_REGION_9__LENGTH_LSB) & RDMA_REGION_9__LENGTH_MASK) -#define RDMA_REGION_9__INDI_MSB 1 -#define RDMA_REGION_9__INDI_LSB 1 -#define RDMA_REGION_9__INDI_MASK 0x00000002 -#define RDMA_REGION_9__INDI_GET(x) (((x) & RDMA_REGION_9__INDI_MASK) >> RDMA_REGION_9__INDI_LSB) -#define RDMA_REGION_9__INDI_SET(x) (((x) << RDMA_REGION_9__INDI_LSB) & RDMA_REGION_9__INDI_MASK) -#define RDMA_REGION_9__NEXT_MSB 0 -#define RDMA_REGION_9__NEXT_LSB 0 -#define RDMA_REGION_9__NEXT_MASK 0x00000001 -#define RDMA_REGION_9__NEXT_GET(x) (((x) & RDMA_REGION_9__NEXT_MASK) >> RDMA_REGION_9__NEXT_LSB) -#define RDMA_REGION_9__NEXT_SET(x) (((x) << RDMA_REGION_9__NEXT_LSB) & RDMA_REGION_9__NEXT_MASK) - -#define RDMA_REGION_10__ADDRESS 0x00000048 -#define RDMA_REGION_10__OFFSET 0x00000048 -#define RDMA_REGION_10__ADDR_MSB 31 -#define RDMA_REGION_10__ADDR_LSB 13 -#define RDMA_REGION_10__ADDR_MASK 0xffffe000 -#define RDMA_REGION_10__ADDR_GET(x) (((x) & RDMA_REGION_10__ADDR_MASK) >> RDMA_REGION_10__ADDR_LSB) -#define RDMA_REGION_10__ADDR_SET(x) (((x) << RDMA_REGION_10__ADDR_LSB) & RDMA_REGION_10__ADDR_MASK) -#define RDMA_REGION_10__LENGTH_MSB 12 -#define RDMA_REGION_10__LENGTH_LSB 2 -#define RDMA_REGION_10__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_10__LENGTH_GET(x) (((x) & RDMA_REGION_10__LENGTH_MASK) >> RDMA_REGION_10__LENGTH_LSB) -#define RDMA_REGION_10__LENGTH_SET(x) (((x) << RDMA_REGION_10__LENGTH_LSB) & RDMA_REGION_10__LENGTH_MASK) -#define RDMA_REGION_10__INDI_MSB 1 -#define RDMA_REGION_10__INDI_LSB 1 -#define RDMA_REGION_10__INDI_MASK 0x00000002 -#define RDMA_REGION_10__INDI_GET(x) (((x) & RDMA_REGION_10__INDI_MASK) >> RDMA_REGION_10__INDI_LSB) -#define RDMA_REGION_10__INDI_SET(x) (((x) << RDMA_REGION_10__INDI_LSB) & RDMA_REGION_10__INDI_MASK) -#define RDMA_REGION_10__NEXT_MSB 0 -#define RDMA_REGION_10__NEXT_LSB 0 -#define RDMA_REGION_10__NEXT_MASK 0x00000001 -#define RDMA_REGION_10__NEXT_GET(x) (((x) & RDMA_REGION_10__NEXT_MASK) >> RDMA_REGION_10__NEXT_LSB) -#define RDMA_REGION_10__NEXT_SET(x) (((x) << RDMA_REGION_10__NEXT_LSB) & RDMA_REGION_10__NEXT_MASK) - -#define RDMA_REGION_11__ADDRESS 0x0000004c -#define RDMA_REGION_11__OFFSET 0x0000004c -#define RDMA_REGION_11__ADDR_MSB 31 -#define RDMA_REGION_11__ADDR_LSB 13 -#define RDMA_REGION_11__ADDR_MASK 0xffffe000 -#define RDMA_REGION_11__ADDR_GET(x) (((x) & RDMA_REGION_11__ADDR_MASK) >> RDMA_REGION_11__ADDR_LSB) -#define RDMA_REGION_11__ADDR_SET(x) (((x) << RDMA_REGION_11__ADDR_LSB) & RDMA_REGION_11__ADDR_MASK) -#define RDMA_REGION_11__LENGTH_MSB 12 -#define RDMA_REGION_11__LENGTH_LSB 2 -#define RDMA_REGION_11__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_11__LENGTH_GET(x) (((x) & RDMA_REGION_11__LENGTH_MASK) >> RDMA_REGION_11__LENGTH_LSB) -#define RDMA_REGION_11__LENGTH_SET(x) (((x) << RDMA_REGION_11__LENGTH_LSB) & RDMA_REGION_11__LENGTH_MASK) -#define RDMA_REGION_11__INDI_MSB 1 -#define RDMA_REGION_11__INDI_LSB 1 -#define RDMA_REGION_11__INDI_MASK 0x00000002 -#define RDMA_REGION_11__INDI_GET(x) (((x) & RDMA_REGION_11__INDI_MASK) >> RDMA_REGION_11__INDI_LSB) -#define RDMA_REGION_11__INDI_SET(x) (((x) << RDMA_REGION_11__INDI_LSB) & RDMA_REGION_11__INDI_MASK) -#define RDMA_REGION_11__NEXT_MSB 0 -#define RDMA_REGION_11__NEXT_LSB 0 -#define RDMA_REGION_11__NEXT_MASK 0x00000001 -#define RDMA_REGION_11__NEXT_GET(x) (((x) & RDMA_REGION_11__NEXT_MASK) >> RDMA_REGION_11__NEXT_LSB) -#define RDMA_REGION_11__NEXT_SET(x) (((x) << RDMA_REGION_11__NEXT_LSB) & RDMA_REGION_11__NEXT_MASK) - -#define RDMA_REGION_12__ADDRESS 0x00000050 -#define RDMA_REGION_12__OFFSET 0x00000050 -#define RDMA_REGION_12__ADDR_MSB 31 -#define RDMA_REGION_12__ADDR_LSB 13 -#define RDMA_REGION_12__ADDR_MASK 0xffffe000 -#define RDMA_REGION_12__ADDR_GET(x) (((x) & RDMA_REGION_12__ADDR_MASK) >> RDMA_REGION_12__ADDR_LSB) -#define RDMA_REGION_12__ADDR_SET(x) (((x) << RDMA_REGION_12__ADDR_LSB) & RDMA_REGION_12__ADDR_MASK) -#define RDMA_REGION_12__LENGTH_MSB 12 -#define RDMA_REGION_12__LENGTH_LSB 2 -#define RDMA_REGION_12__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_12__LENGTH_GET(x) (((x) & RDMA_REGION_12__LENGTH_MASK) >> RDMA_REGION_12__LENGTH_LSB) -#define RDMA_REGION_12__LENGTH_SET(x) (((x) << RDMA_REGION_12__LENGTH_LSB) & RDMA_REGION_12__LENGTH_MASK) -#define RDMA_REGION_12__INDI_MSB 1 -#define RDMA_REGION_12__INDI_LSB 1 -#define RDMA_REGION_12__INDI_MASK 0x00000002 -#define RDMA_REGION_12__INDI_GET(x) (((x) & RDMA_REGION_12__INDI_MASK) >> RDMA_REGION_12__INDI_LSB) -#define RDMA_REGION_12__INDI_SET(x) (((x) << RDMA_REGION_12__INDI_LSB) & RDMA_REGION_12__INDI_MASK) -#define RDMA_REGION_12__NEXT_MSB 0 -#define RDMA_REGION_12__NEXT_LSB 0 -#define RDMA_REGION_12__NEXT_MASK 0x00000001 -#define RDMA_REGION_12__NEXT_GET(x) (((x) & RDMA_REGION_12__NEXT_MASK) >> RDMA_REGION_12__NEXT_LSB) -#define RDMA_REGION_12__NEXT_SET(x) (((x) << RDMA_REGION_12__NEXT_LSB) & RDMA_REGION_12__NEXT_MASK) - -#define RDMA_REGION_13__ADDRESS 0x00000054 -#define RDMA_REGION_13__OFFSET 0x00000054 -#define RDMA_REGION_13__ADDR_MSB 31 -#define RDMA_REGION_13__ADDR_LSB 13 -#define RDMA_REGION_13__ADDR_MASK 0xffffe000 -#define RDMA_REGION_13__ADDR_GET(x) (((x) & RDMA_REGION_13__ADDR_MASK) >> RDMA_REGION_13__ADDR_LSB) -#define RDMA_REGION_13__ADDR_SET(x) (((x) << RDMA_REGION_13__ADDR_LSB) & RDMA_REGION_13__ADDR_MASK) -#define RDMA_REGION_13__LENGTH_MSB 12 -#define RDMA_REGION_13__LENGTH_LSB 2 -#define RDMA_REGION_13__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_13__LENGTH_GET(x) (((x) & RDMA_REGION_13__LENGTH_MASK) >> RDMA_REGION_13__LENGTH_LSB) -#define RDMA_REGION_13__LENGTH_SET(x) (((x) << RDMA_REGION_13__LENGTH_LSB) & RDMA_REGION_13__LENGTH_MASK) -#define RDMA_REGION_13__INDI_MSB 1 -#define RDMA_REGION_13__INDI_LSB 1 -#define RDMA_REGION_13__INDI_MASK 0x00000002 -#define RDMA_REGION_13__INDI_GET(x) (((x) & RDMA_REGION_13__INDI_MASK) >> RDMA_REGION_13__INDI_LSB) -#define RDMA_REGION_13__INDI_SET(x) (((x) << RDMA_REGION_13__INDI_LSB) & RDMA_REGION_13__INDI_MASK) -#define RDMA_REGION_13__NEXT_MSB 0 -#define RDMA_REGION_13__NEXT_LSB 0 -#define RDMA_REGION_13__NEXT_MASK 0x00000001 -#define RDMA_REGION_13__NEXT_GET(x) (((x) & RDMA_REGION_13__NEXT_MASK) >> RDMA_REGION_13__NEXT_LSB) -#define RDMA_REGION_13__NEXT_SET(x) (((x) << RDMA_REGION_13__NEXT_LSB) & RDMA_REGION_13__NEXT_MASK) - -#define RDMA_REGION_14__ADDRESS 0x00000058 -#define RDMA_REGION_14__OFFSET 0x00000058 -#define RDMA_REGION_14__ADDR_MSB 31 -#define RDMA_REGION_14__ADDR_LSB 13 -#define RDMA_REGION_14__ADDR_MASK 0xffffe000 -#define RDMA_REGION_14__ADDR_GET(x) (((x) & RDMA_REGION_14__ADDR_MASK) >> RDMA_REGION_14__ADDR_LSB) -#define RDMA_REGION_14__ADDR_SET(x) (((x) << RDMA_REGION_14__ADDR_LSB) & RDMA_REGION_14__ADDR_MASK) -#define RDMA_REGION_14__LENGTH_MSB 12 -#define RDMA_REGION_14__LENGTH_LSB 2 -#define RDMA_REGION_14__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_14__LENGTH_GET(x) (((x) & RDMA_REGION_14__LENGTH_MASK) >> RDMA_REGION_14__LENGTH_LSB) -#define RDMA_REGION_14__LENGTH_SET(x) (((x) << RDMA_REGION_14__LENGTH_LSB) & RDMA_REGION_14__LENGTH_MASK) -#define RDMA_REGION_14__INDI_MSB 1 -#define RDMA_REGION_14__INDI_LSB 1 -#define RDMA_REGION_14__INDI_MASK 0x00000002 -#define RDMA_REGION_14__INDI_GET(x) (((x) & RDMA_REGION_14__INDI_MASK) >> RDMA_REGION_14__INDI_LSB) -#define RDMA_REGION_14__INDI_SET(x) (((x) << RDMA_REGION_14__INDI_LSB) & RDMA_REGION_14__INDI_MASK) -#define RDMA_REGION_14__NEXT_MSB 0 -#define RDMA_REGION_14__NEXT_LSB 0 -#define RDMA_REGION_14__NEXT_MASK 0x00000001 -#define RDMA_REGION_14__NEXT_GET(x) (((x) & RDMA_REGION_14__NEXT_MASK) >> RDMA_REGION_14__NEXT_LSB) -#define RDMA_REGION_14__NEXT_SET(x) (((x) << RDMA_REGION_14__NEXT_LSB) & RDMA_REGION_14__NEXT_MASK) - -#define RDMA_REGION_15__ADDRESS 0x0000005c -#define RDMA_REGION_15__OFFSET 0x0000005c -#define RDMA_REGION_15__ADDR_MSB 31 -#define RDMA_REGION_15__ADDR_LSB 13 -#define RDMA_REGION_15__ADDR_MASK 0xffffe000 -#define RDMA_REGION_15__ADDR_GET(x) (((x) & RDMA_REGION_15__ADDR_MASK) >> RDMA_REGION_15__ADDR_LSB) -#define RDMA_REGION_15__ADDR_SET(x) (((x) << RDMA_REGION_15__ADDR_LSB) & RDMA_REGION_15__ADDR_MASK) -#define RDMA_REGION_15__LENGTH_MSB 12 -#define RDMA_REGION_15__LENGTH_LSB 2 -#define RDMA_REGION_15__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_15__LENGTH_GET(x) (((x) & RDMA_REGION_15__LENGTH_MASK) >> RDMA_REGION_15__LENGTH_LSB) -#define RDMA_REGION_15__LENGTH_SET(x) (((x) << RDMA_REGION_15__LENGTH_LSB) & RDMA_REGION_15__LENGTH_MASK) -#define RDMA_REGION_15__INDI_MSB 1 -#define RDMA_REGION_15__INDI_LSB 1 -#define RDMA_REGION_15__INDI_MASK 0x00000002 -#define RDMA_REGION_15__INDI_GET(x) (((x) & RDMA_REGION_15__INDI_MASK) >> RDMA_REGION_15__INDI_LSB) -#define RDMA_REGION_15__INDI_SET(x) (((x) << RDMA_REGION_15__INDI_LSB) & RDMA_REGION_15__INDI_MASK) -#define RDMA_REGION_15__NEXT_MSB 0 -#define RDMA_REGION_15__NEXT_LSB 0 -#define RDMA_REGION_15__NEXT_MASK 0x00000001 -#define RDMA_REGION_15__NEXT_GET(x) (((x) & RDMA_REGION_15__NEXT_MASK) >> RDMA_REGION_15__NEXT_LSB) -#define RDMA_REGION_15__NEXT_SET(x) (((x) << RDMA_REGION_15__NEXT_LSB) & RDMA_REGION_15__NEXT_MASK) - -#define RDMA_REGION_16__ADDRESS 0x00000060 -#define RDMA_REGION_16__OFFSET 0x00000060 -#define RDMA_REGION_16__ADDR_MSB 31 -#define RDMA_REGION_16__ADDR_LSB 13 -#define RDMA_REGION_16__ADDR_MASK 0xffffe000 -#define RDMA_REGION_16__ADDR_GET(x) (((x) & RDMA_REGION_16__ADDR_MASK) >> RDMA_REGION_16__ADDR_LSB) -#define RDMA_REGION_16__ADDR_SET(x) (((x) << RDMA_REGION_16__ADDR_LSB) & RDMA_REGION_16__ADDR_MASK) -#define RDMA_REGION_16__LENGTH_MSB 12 -#define RDMA_REGION_16__LENGTH_LSB 2 -#define RDMA_REGION_16__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_16__LENGTH_GET(x) (((x) & RDMA_REGION_16__LENGTH_MASK) >> RDMA_REGION_16__LENGTH_LSB) -#define RDMA_REGION_16__LENGTH_SET(x) (((x) << RDMA_REGION_16__LENGTH_LSB) & RDMA_REGION_16__LENGTH_MASK) -#define RDMA_REGION_16__INDI_MSB 1 -#define RDMA_REGION_16__INDI_LSB 1 -#define RDMA_REGION_16__INDI_MASK 0x00000002 -#define RDMA_REGION_16__INDI_GET(x) (((x) & RDMA_REGION_16__INDI_MASK) >> RDMA_REGION_16__INDI_LSB) -#define RDMA_REGION_16__INDI_SET(x) (((x) << RDMA_REGION_16__INDI_LSB) & RDMA_REGION_16__INDI_MASK) -#define RDMA_REGION_16__NEXT_MSB 0 -#define RDMA_REGION_16__NEXT_LSB 0 -#define RDMA_REGION_16__NEXT_MASK 0x00000001 -#define RDMA_REGION_16__NEXT_GET(x) (((x) & RDMA_REGION_16__NEXT_MASK) >> RDMA_REGION_16__NEXT_LSB) -#define RDMA_REGION_16__NEXT_SET(x) (((x) << RDMA_REGION_16__NEXT_LSB) & RDMA_REGION_16__NEXT_MASK) - -#define RDMA_REGION_17__ADDRESS 0x00000064 -#define RDMA_REGION_17__OFFSET 0x00000064 -#define RDMA_REGION_17__ADDR_MSB 31 -#define RDMA_REGION_17__ADDR_LSB 13 -#define RDMA_REGION_17__ADDR_MASK 0xffffe000 -#define RDMA_REGION_17__ADDR_GET(x) (((x) & RDMA_REGION_17__ADDR_MASK) >> RDMA_REGION_17__ADDR_LSB) -#define RDMA_REGION_17__ADDR_SET(x) (((x) << RDMA_REGION_17__ADDR_LSB) & RDMA_REGION_17__ADDR_MASK) -#define RDMA_REGION_17__LENGTH_MSB 12 -#define RDMA_REGION_17__LENGTH_LSB 2 -#define RDMA_REGION_17__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_17__LENGTH_GET(x) (((x) & RDMA_REGION_17__LENGTH_MASK) >> RDMA_REGION_17__LENGTH_LSB) -#define RDMA_REGION_17__LENGTH_SET(x) (((x) << RDMA_REGION_17__LENGTH_LSB) & RDMA_REGION_17__LENGTH_MASK) -#define RDMA_REGION_17__INDI_MSB 1 -#define RDMA_REGION_17__INDI_LSB 1 -#define RDMA_REGION_17__INDI_MASK 0x00000002 -#define RDMA_REGION_17__INDI_GET(x) (((x) & RDMA_REGION_17__INDI_MASK) >> RDMA_REGION_17__INDI_LSB) -#define RDMA_REGION_17__INDI_SET(x) (((x) << RDMA_REGION_17__INDI_LSB) & RDMA_REGION_17__INDI_MASK) -#define RDMA_REGION_17__NEXT_MSB 0 -#define RDMA_REGION_17__NEXT_LSB 0 -#define RDMA_REGION_17__NEXT_MASK 0x00000001 -#define RDMA_REGION_17__NEXT_GET(x) (((x) & RDMA_REGION_17__NEXT_MASK) >> RDMA_REGION_17__NEXT_LSB) -#define RDMA_REGION_17__NEXT_SET(x) (((x) << RDMA_REGION_17__NEXT_LSB) & RDMA_REGION_17__NEXT_MASK) - -#define RDMA_REGION_18__ADDRESS 0x00000068 -#define RDMA_REGION_18__OFFSET 0x00000068 -#define RDMA_REGION_18__ADDR_MSB 31 -#define RDMA_REGION_18__ADDR_LSB 13 -#define RDMA_REGION_18__ADDR_MASK 0xffffe000 -#define RDMA_REGION_18__ADDR_GET(x) (((x) & RDMA_REGION_18__ADDR_MASK) >> RDMA_REGION_18__ADDR_LSB) -#define RDMA_REGION_18__ADDR_SET(x) (((x) << RDMA_REGION_18__ADDR_LSB) & RDMA_REGION_18__ADDR_MASK) -#define RDMA_REGION_18__LENGTH_MSB 12 -#define RDMA_REGION_18__LENGTH_LSB 2 -#define RDMA_REGION_18__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_18__LENGTH_GET(x) (((x) & RDMA_REGION_18__LENGTH_MASK) >> RDMA_REGION_18__LENGTH_LSB) -#define RDMA_REGION_18__LENGTH_SET(x) (((x) << RDMA_REGION_18__LENGTH_LSB) & RDMA_REGION_18__LENGTH_MASK) -#define RDMA_REGION_18__INDI_MSB 1 -#define RDMA_REGION_18__INDI_LSB 1 -#define RDMA_REGION_18__INDI_MASK 0x00000002 -#define RDMA_REGION_18__INDI_GET(x) (((x) & RDMA_REGION_18__INDI_MASK) >> RDMA_REGION_18__INDI_LSB) -#define RDMA_REGION_18__INDI_SET(x) (((x) << RDMA_REGION_18__INDI_LSB) & RDMA_REGION_18__INDI_MASK) -#define RDMA_REGION_18__NEXT_MSB 0 -#define RDMA_REGION_18__NEXT_LSB 0 -#define RDMA_REGION_18__NEXT_MASK 0x00000001 -#define RDMA_REGION_18__NEXT_GET(x) (((x) & RDMA_REGION_18__NEXT_MASK) >> RDMA_REGION_18__NEXT_LSB) -#define RDMA_REGION_18__NEXT_SET(x) (((x) << RDMA_REGION_18__NEXT_LSB) & RDMA_REGION_18__NEXT_MASK) - -#define RDMA_REGION_19__ADDRESS 0x0000006c -#define RDMA_REGION_19__OFFSET 0x0000006c -#define RDMA_REGION_19__ADDR_MSB 31 -#define RDMA_REGION_19__ADDR_LSB 13 -#define RDMA_REGION_19__ADDR_MASK 0xffffe000 -#define RDMA_REGION_19__ADDR_GET(x) (((x) & RDMA_REGION_19__ADDR_MASK) >> RDMA_REGION_19__ADDR_LSB) -#define RDMA_REGION_19__ADDR_SET(x) (((x) << RDMA_REGION_19__ADDR_LSB) & RDMA_REGION_19__ADDR_MASK) -#define RDMA_REGION_19__LENGTH_MSB 12 -#define RDMA_REGION_19__LENGTH_LSB 2 -#define RDMA_REGION_19__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_19__LENGTH_GET(x) (((x) & RDMA_REGION_19__LENGTH_MASK) >> RDMA_REGION_19__LENGTH_LSB) -#define RDMA_REGION_19__LENGTH_SET(x) (((x) << RDMA_REGION_19__LENGTH_LSB) & RDMA_REGION_19__LENGTH_MASK) -#define RDMA_REGION_19__INDI_MSB 1 -#define RDMA_REGION_19__INDI_LSB 1 -#define RDMA_REGION_19__INDI_MASK 0x00000002 -#define RDMA_REGION_19__INDI_GET(x) (((x) & RDMA_REGION_19__INDI_MASK) >> RDMA_REGION_19__INDI_LSB) -#define RDMA_REGION_19__INDI_SET(x) (((x) << RDMA_REGION_19__INDI_LSB) & RDMA_REGION_19__INDI_MASK) -#define RDMA_REGION_19__NEXT_MSB 0 -#define RDMA_REGION_19__NEXT_LSB 0 -#define RDMA_REGION_19__NEXT_MASK 0x00000001 -#define RDMA_REGION_19__NEXT_GET(x) (((x) & RDMA_REGION_19__NEXT_MASK) >> RDMA_REGION_19__NEXT_LSB) -#define RDMA_REGION_19__NEXT_SET(x) (((x) << RDMA_REGION_19__NEXT_LSB) & RDMA_REGION_19__NEXT_MASK) - -#define RDMA_REGION_20__ADDRESS 0x00000070 -#define RDMA_REGION_20__OFFSET 0x00000070 -#define RDMA_REGION_20__ADDR_MSB 31 -#define RDMA_REGION_20__ADDR_LSB 13 -#define RDMA_REGION_20__ADDR_MASK 0xffffe000 -#define RDMA_REGION_20__ADDR_GET(x) (((x) & RDMA_REGION_20__ADDR_MASK) >> RDMA_REGION_20__ADDR_LSB) -#define RDMA_REGION_20__ADDR_SET(x) (((x) << RDMA_REGION_20__ADDR_LSB) & RDMA_REGION_20__ADDR_MASK) -#define RDMA_REGION_20__LENGTH_MSB 12 -#define RDMA_REGION_20__LENGTH_LSB 2 -#define RDMA_REGION_20__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_20__LENGTH_GET(x) (((x) & RDMA_REGION_20__LENGTH_MASK) >> RDMA_REGION_20__LENGTH_LSB) -#define RDMA_REGION_20__LENGTH_SET(x) (((x) << RDMA_REGION_20__LENGTH_LSB) & RDMA_REGION_20__LENGTH_MASK) -#define RDMA_REGION_20__INDI_MSB 1 -#define RDMA_REGION_20__INDI_LSB 1 -#define RDMA_REGION_20__INDI_MASK 0x00000002 -#define RDMA_REGION_20__INDI_GET(x) (((x) & RDMA_REGION_20__INDI_MASK) >> RDMA_REGION_20__INDI_LSB) -#define RDMA_REGION_20__INDI_SET(x) (((x) << RDMA_REGION_20__INDI_LSB) & RDMA_REGION_20__INDI_MASK) -#define RDMA_REGION_20__NEXT_MSB 0 -#define RDMA_REGION_20__NEXT_LSB 0 -#define RDMA_REGION_20__NEXT_MASK 0x00000001 -#define RDMA_REGION_20__NEXT_GET(x) (((x) & RDMA_REGION_20__NEXT_MASK) >> RDMA_REGION_20__NEXT_LSB) -#define RDMA_REGION_20__NEXT_SET(x) (((x) << RDMA_REGION_20__NEXT_LSB) & RDMA_REGION_20__NEXT_MASK) - -#define RDMA_REGION_21__ADDRESS 0x00000074 -#define RDMA_REGION_21__OFFSET 0x00000074 -#define RDMA_REGION_21__ADDR_MSB 31 -#define RDMA_REGION_21__ADDR_LSB 13 -#define RDMA_REGION_21__ADDR_MASK 0xffffe000 -#define RDMA_REGION_21__ADDR_GET(x) (((x) & RDMA_REGION_21__ADDR_MASK) >> RDMA_REGION_21__ADDR_LSB) -#define RDMA_REGION_21__ADDR_SET(x) (((x) << RDMA_REGION_21__ADDR_LSB) & RDMA_REGION_21__ADDR_MASK) -#define RDMA_REGION_21__LENGTH_MSB 12 -#define RDMA_REGION_21__LENGTH_LSB 2 -#define RDMA_REGION_21__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_21__LENGTH_GET(x) (((x) & RDMA_REGION_21__LENGTH_MASK) >> RDMA_REGION_21__LENGTH_LSB) -#define RDMA_REGION_21__LENGTH_SET(x) (((x) << RDMA_REGION_21__LENGTH_LSB) & RDMA_REGION_21__LENGTH_MASK) -#define RDMA_REGION_21__INDI_MSB 1 -#define RDMA_REGION_21__INDI_LSB 1 -#define RDMA_REGION_21__INDI_MASK 0x00000002 -#define RDMA_REGION_21__INDI_GET(x) (((x) & RDMA_REGION_21__INDI_MASK) >> RDMA_REGION_21__INDI_LSB) -#define RDMA_REGION_21__INDI_SET(x) (((x) << RDMA_REGION_21__INDI_LSB) & RDMA_REGION_21__INDI_MASK) -#define RDMA_REGION_21__NEXT_MSB 0 -#define RDMA_REGION_21__NEXT_LSB 0 -#define RDMA_REGION_21__NEXT_MASK 0x00000001 -#define RDMA_REGION_21__NEXT_GET(x) (((x) & RDMA_REGION_21__NEXT_MASK) >> RDMA_REGION_21__NEXT_LSB) -#define RDMA_REGION_21__NEXT_SET(x) (((x) << RDMA_REGION_21__NEXT_LSB) & RDMA_REGION_21__NEXT_MASK) - -#define RDMA_REGION_22__ADDRESS 0x00000078 -#define RDMA_REGION_22__OFFSET 0x00000078 -#define RDMA_REGION_22__ADDR_MSB 31 -#define RDMA_REGION_22__ADDR_LSB 13 -#define RDMA_REGION_22__ADDR_MASK 0xffffe000 -#define RDMA_REGION_22__ADDR_GET(x) (((x) & RDMA_REGION_22__ADDR_MASK) >> RDMA_REGION_22__ADDR_LSB) -#define RDMA_REGION_22__ADDR_SET(x) (((x) << RDMA_REGION_22__ADDR_LSB) & RDMA_REGION_22__ADDR_MASK) -#define RDMA_REGION_22__LENGTH_MSB 12 -#define RDMA_REGION_22__LENGTH_LSB 2 -#define RDMA_REGION_22__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_22__LENGTH_GET(x) (((x) & RDMA_REGION_22__LENGTH_MASK) >> RDMA_REGION_22__LENGTH_LSB) -#define RDMA_REGION_22__LENGTH_SET(x) (((x) << RDMA_REGION_22__LENGTH_LSB) & RDMA_REGION_22__LENGTH_MASK) -#define RDMA_REGION_22__INDI_MSB 1 -#define RDMA_REGION_22__INDI_LSB 1 -#define RDMA_REGION_22__INDI_MASK 0x00000002 -#define RDMA_REGION_22__INDI_GET(x) (((x) & RDMA_REGION_22__INDI_MASK) >> RDMA_REGION_22__INDI_LSB) -#define RDMA_REGION_22__INDI_SET(x) (((x) << RDMA_REGION_22__INDI_LSB) & RDMA_REGION_22__INDI_MASK) -#define RDMA_REGION_22__NEXT_MSB 0 -#define RDMA_REGION_22__NEXT_LSB 0 -#define RDMA_REGION_22__NEXT_MASK 0x00000001 -#define RDMA_REGION_22__NEXT_GET(x) (((x) & RDMA_REGION_22__NEXT_MASK) >> RDMA_REGION_22__NEXT_LSB) -#define RDMA_REGION_22__NEXT_SET(x) (((x) << RDMA_REGION_22__NEXT_LSB) & RDMA_REGION_22__NEXT_MASK) - -#define RDMA_REGION_23__ADDRESS 0x0000007c -#define RDMA_REGION_23__OFFSET 0x0000007c -#define RDMA_REGION_23__ADDR_MSB 31 -#define RDMA_REGION_23__ADDR_LSB 13 -#define RDMA_REGION_23__ADDR_MASK 0xffffe000 -#define RDMA_REGION_23__ADDR_GET(x) (((x) & RDMA_REGION_23__ADDR_MASK) >> RDMA_REGION_23__ADDR_LSB) -#define RDMA_REGION_23__ADDR_SET(x) (((x) << RDMA_REGION_23__ADDR_LSB) & RDMA_REGION_23__ADDR_MASK) -#define RDMA_REGION_23__LENGTH_MSB 12 -#define RDMA_REGION_23__LENGTH_LSB 2 -#define RDMA_REGION_23__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_23__LENGTH_GET(x) (((x) & RDMA_REGION_23__LENGTH_MASK) >> RDMA_REGION_23__LENGTH_LSB) -#define RDMA_REGION_23__LENGTH_SET(x) (((x) << RDMA_REGION_23__LENGTH_LSB) & RDMA_REGION_23__LENGTH_MASK) -#define RDMA_REGION_23__INDI_MSB 1 -#define RDMA_REGION_23__INDI_LSB 1 -#define RDMA_REGION_23__INDI_MASK 0x00000002 -#define RDMA_REGION_23__INDI_GET(x) (((x) & RDMA_REGION_23__INDI_MASK) >> RDMA_REGION_23__INDI_LSB) -#define RDMA_REGION_23__INDI_SET(x) (((x) << RDMA_REGION_23__INDI_LSB) & RDMA_REGION_23__INDI_MASK) -#define RDMA_REGION_23__NEXT_MSB 0 -#define RDMA_REGION_23__NEXT_LSB 0 -#define RDMA_REGION_23__NEXT_MASK 0x00000001 -#define RDMA_REGION_23__NEXT_GET(x) (((x) & RDMA_REGION_23__NEXT_MASK) >> RDMA_REGION_23__NEXT_LSB) -#define RDMA_REGION_23__NEXT_SET(x) (((x) << RDMA_REGION_23__NEXT_LSB) & RDMA_REGION_23__NEXT_MASK) - -#define RDMA_REGION_24__ADDRESS 0x00000080 -#define RDMA_REGION_24__OFFSET 0x00000080 -#define RDMA_REGION_24__ADDR_MSB 31 -#define RDMA_REGION_24__ADDR_LSB 13 -#define RDMA_REGION_24__ADDR_MASK 0xffffe000 -#define RDMA_REGION_24__ADDR_GET(x) (((x) & RDMA_REGION_24__ADDR_MASK) >> RDMA_REGION_24__ADDR_LSB) -#define RDMA_REGION_24__ADDR_SET(x) (((x) << RDMA_REGION_24__ADDR_LSB) & RDMA_REGION_24__ADDR_MASK) -#define RDMA_REGION_24__LENGTH_MSB 12 -#define RDMA_REGION_24__LENGTH_LSB 2 -#define RDMA_REGION_24__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_24__LENGTH_GET(x) (((x) & RDMA_REGION_24__LENGTH_MASK) >> RDMA_REGION_24__LENGTH_LSB) -#define RDMA_REGION_24__LENGTH_SET(x) (((x) << RDMA_REGION_24__LENGTH_LSB) & RDMA_REGION_24__LENGTH_MASK) -#define RDMA_REGION_24__INDI_MSB 1 -#define RDMA_REGION_24__INDI_LSB 1 -#define RDMA_REGION_24__INDI_MASK 0x00000002 -#define RDMA_REGION_24__INDI_GET(x) (((x) & RDMA_REGION_24__INDI_MASK) >> RDMA_REGION_24__INDI_LSB) -#define RDMA_REGION_24__INDI_SET(x) (((x) << RDMA_REGION_24__INDI_LSB) & RDMA_REGION_24__INDI_MASK) -#define RDMA_REGION_24__NEXT_MSB 0 -#define RDMA_REGION_24__NEXT_LSB 0 -#define RDMA_REGION_24__NEXT_MASK 0x00000001 -#define RDMA_REGION_24__NEXT_GET(x) (((x) & RDMA_REGION_24__NEXT_MASK) >> RDMA_REGION_24__NEXT_LSB) -#define RDMA_REGION_24__NEXT_SET(x) (((x) << RDMA_REGION_24__NEXT_LSB) & RDMA_REGION_24__NEXT_MASK) - -#define RDMA_REGION_25__ADDRESS 0x00000084 -#define RDMA_REGION_25__OFFSET 0x00000084 -#define RDMA_REGION_25__ADDR_MSB 31 -#define RDMA_REGION_25__ADDR_LSB 13 -#define RDMA_REGION_25__ADDR_MASK 0xffffe000 -#define RDMA_REGION_25__ADDR_GET(x) (((x) & RDMA_REGION_25__ADDR_MASK) >> RDMA_REGION_25__ADDR_LSB) -#define RDMA_REGION_25__ADDR_SET(x) (((x) << RDMA_REGION_25__ADDR_LSB) & RDMA_REGION_25__ADDR_MASK) -#define RDMA_REGION_25__LENGTH_MSB 12 -#define RDMA_REGION_25__LENGTH_LSB 2 -#define RDMA_REGION_25__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_25__LENGTH_GET(x) (((x) & RDMA_REGION_25__LENGTH_MASK) >> RDMA_REGION_25__LENGTH_LSB) -#define RDMA_REGION_25__LENGTH_SET(x) (((x) << RDMA_REGION_25__LENGTH_LSB) & RDMA_REGION_25__LENGTH_MASK) -#define RDMA_REGION_25__INDI_MSB 1 -#define RDMA_REGION_25__INDI_LSB 1 -#define RDMA_REGION_25__INDI_MASK 0x00000002 -#define RDMA_REGION_25__INDI_GET(x) (((x) & RDMA_REGION_25__INDI_MASK) >> RDMA_REGION_25__INDI_LSB) -#define RDMA_REGION_25__INDI_SET(x) (((x) << RDMA_REGION_25__INDI_LSB) & RDMA_REGION_25__INDI_MASK) -#define RDMA_REGION_25__NEXT_MSB 0 -#define RDMA_REGION_25__NEXT_LSB 0 -#define RDMA_REGION_25__NEXT_MASK 0x00000001 -#define RDMA_REGION_25__NEXT_GET(x) (((x) & RDMA_REGION_25__NEXT_MASK) >> RDMA_REGION_25__NEXT_LSB) -#define RDMA_REGION_25__NEXT_SET(x) (((x) << RDMA_REGION_25__NEXT_LSB) & RDMA_REGION_25__NEXT_MASK) - -#define RDMA_REGION_26__ADDRESS 0x00000088 -#define RDMA_REGION_26__OFFSET 0x00000088 -#define RDMA_REGION_26__ADDR_MSB 31 -#define RDMA_REGION_26__ADDR_LSB 13 -#define RDMA_REGION_26__ADDR_MASK 0xffffe000 -#define RDMA_REGION_26__ADDR_GET(x) (((x) & RDMA_REGION_26__ADDR_MASK) >> RDMA_REGION_26__ADDR_LSB) -#define RDMA_REGION_26__ADDR_SET(x) (((x) << RDMA_REGION_26__ADDR_LSB) & RDMA_REGION_26__ADDR_MASK) -#define RDMA_REGION_26__LENGTH_MSB 12 -#define RDMA_REGION_26__LENGTH_LSB 2 -#define RDMA_REGION_26__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_26__LENGTH_GET(x) (((x) & RDMA_REGION_26__LENGTH_MASK) >> RDMA_REGION_26__LENGTH_LSB) -#define RDMA_REGION_26__LENGTH_SET(x) (((x) << RDMA_REGION_26__LENGTH_LSB) & RDMA_REGION_26__LENGTH_MASK) -#define RDMA_REGION_26__INDI_MSB 1 -#define RDMA_REGION_26__INDI_LSB 1 -#define RDMA_REGION_26__INDI_MASK 0x00000002 -#define RDMA_REGION_26__INDI_GET(x) (((x) & RDMA_REGION_26__INDI_MASK) >> RDMA_REGION_26__INDI_LSB) -#define RDMA_REGION_26__INDI_SET(x) (((x) << RDMA_REGION_26__INDI_LSB) & RDMA_REGION_26__INDI_MASK) -#define RDMA_REGION_26__NEXT_MSB 0 -#define RDMA_REGION_26__NEXT_LSB 0 -#define RDMA_REGION_26__NEXT_MASK 0x00000001 -#define RDMA_REGION_26__NEXT_GET(x) (((x) & RDMA_REGION_26__NEXT_MASK) >> RDMA_REGION_26__NEXT_LSB) -#define RDMA_REGION_26__NEXT_SET(x) (((x) << RDMA_REGION_26__NEXT_LSB) & RDMA_REGION_26__NEXT_MASK) - -#define RDMA_REGION_27__ADDRESS 0x0000008c -#define RDMA_REGION_27__OFFSET 0x0000008c -#define RDMA_REGION_27__ADDR_MSB 31 -#define RDMA_REGION_27__ADDR_LSB 13 -#define RDMA_REGION_27__ADDR_MASK 0xffffe000 -#define RDMA_REGION_27__ADDR_GET(x) (((x) & RDMA_REGION_27__ADDR_MASK) >> RDMA_REGION_27__ADDR_LSB) -#define RDMA_REGION_27__ADDR_SET(x) (((x) << RDMA_REGION_27__ADDR_LSB) & RDMA_REGION_27__ADDR_MASK) -#define RDMA_REGION_27__LENGTH_MSB 12 -#define RDMA_REGION_27__LENGTH_LSB 2 -#define RDMA_REGION_27__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_27__LENGTH_GET(x) (((x) & RDMA_REGION_27__LENGTH_MASK) >> RDMA_REGION_27__LENGTH_LSB) -#define RDMA_REGION_27__LENGTH_SET(x) (((x) << RDMA_REGION_27__LENGTH_LSB) & RDMA_REGION_27__LENGTH_MASK) -#define RDMA_REGION_27__INDI_MSB 1 -#define RDMA_REGION_27__INDI_LSB 1 -#define RDMA_REGION_27__INDI_MASK 0x00000002 -#define RDMA_REGION_27__INDI_GET(x) (((x) & RDMA_REGION_27__INDI_MASK) >> RDMA_REGION_27__INDI_LSB) -#define RDMA_REGION_27__INDI_SET(x) (((x) << RDMA_REGION_27__INDI_LSB) & RDMA_REGION_27__INDI_MASK) -#define RDMA_REGION_27__NEXT_MSB 0 -#define RDMA_REGION_27__NEXT_LSB 0 -#define RDMA_REGION_27__NEXT_MASK 0x00000001 -#define RDMA_REGION_27__NEXT_GET(x) (((x) & RDMA_REGION_27__NEXT_MASK) >> RDMA_REGION_27__NEXT_LSB) -#define RDMA_REGION_27__NEXT_SET(x) (((x) << RDMA_REGION_27__NEXT_LSB) & RDMA_REGION_27__NEXT_MASK) - -#define RDMA_REGION_28__ADDRESS 0x00000090 -#define RDMA_REGION_28__OFFSET 0x00000090 -#define RDMA_REGION_28__ADDR_MSB 31 -#define RDMA_REGION_28__ADDR_LSB 13 -#define RDMA_REGION_28__ADDR_MASK 0xffffe000 -#define RDMA_REGION_28__ADDR_GET(x) (((x) & RDMA_REGION_28__ADDR_MASK) >> RDMA_REGION_28__ADDR_LSB) -#define RDMA_REGION_28__ADDR_SET(x) (((x) << RDMA_REGION_28__ADDR_LSB) & RDMA_REGION_28__ADDR_MASK) -#define RDMA_REGION_28__LENGTH_MSB 12 -#define RDMA_REGION_28__LENGTH_LSB 2 -#define RDMA_REGION_28__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_28__LENGTH_GET(x) (((x) & RDMA_REGION_28__LENGTH_MASK) >> RDMA_REGION_28__LENGTH_LSB) -#define RDMA_REGION_28__LENGTH_SET(x) (((x) << RDMA_REGION_28__LENGTH_LSB) & RDMA_REGION_28__LENGTH_MASK) -#define RDMA_REGION_28__INDI_MSB 1 -#define RDMA_REGION_28__INDI_LSB 1 -#define RDMA_REGION_28__INDI_MASK 0x00000002 -#define RDMA_REGION_28__INDI_GET(x) (((x) & RDMA_REGION_28__INDI_MASK) >> RDMA_REGION_28__INDI_LSB) -#define RDMA_REGION_28__INDI_SET(x) (((x) << RDMA_REGION_28__INDI_LSB) & RDMA_REGION_28__INDI_MASK) -#define RDMA_REGION_28__NEXT_MSB 0 -#define RDMA_REGION_28__NEXT_LSB 0 -#define RDMA_REGION_28__NEXT_MASK 0x00000001 -#define RDMA_REGION_28__NEXT_GET(x) (((x) & RDMA_REGION_28__NEXT_MASK) >> RDMA_REGION_28__NEXT_LSB) -#define RDMA_REGION_28__NEXT_SET(x) (((x) << RDMA_REGION_28__NEXT_LSB) & RDMA_REGION_28__NEXT_MASK) - -#define RDMA_REGION_29__ADDRESS 0x00000094 -#define RDMA_REGION_29__OFFSET 0x00000094 -#define RDMA_REGION_29__ADDR_MSB 31 -#define RDMA_REGION_29__ADDR_LSB 13 -#define RDMA_REGION_29__ADDR_MASK 0xffffe000 -#define RDMA_REGION_29__ADDR_GET(x) (((x) & RDMA_REGION_29__ADDR_MASK) >> RDMA_REGION_29__ADDR_LSB) -#define RDMA_REGION_29__ADDR_SET(x) (((x) << RDMA_REGION_29__ADDR_LSB) & RDMA_REGION_29__ADDR_MASK) -#define RDMA_REGION_29__LENGTH_MSB 12 -#define RDMA_REGION_29__LENGTH_LSB 2 -#define RDMA_REGION_29__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_29__LENGTH_GET(x) (((x) & RDMA_REGION_29__LENGTH_MASK) >> RDMA_REGION_29__LENGTH_LSB) -#define RDMA_REGION_29__LENGTH_SET(x) (((x) << RDMA_REGION_29__LENGTH_LSB) & RDMA_REGION_29__LENGTH_MASK) -#define RDMA_REGION_29__INDI_MSB 1 -#define RDMA_REGION_29__INDI_LSB 1 -#define RDMA_REGION_29__INDI_MASK 0x00000002 -#define RDMA_REGION_29__INDI_GET(x) (((x) & RDMA_REGION_29__INDI_MASK) >> RDMA_REGION_29__INDI_LSB) -#define RDMA_REGION_29__INDI_SET(x) (((x) << RDMA_REGION_29__INDI_LSB) & RDMA_REGION_29__INDI_MASK) -#define RDMA_REGION_29__NEXT_MSB 0 -#define RDMA_REGION_29__NEXT_LSB 0 -#define RDMA_REGION_29__NEXT_MASK 0x00000001 -#define RDMA_REGION_29__NEXT_GET(x) (((x) & RDMA_REGION_29__NEXT_MASK) >> RDMA_REGION_29__NEXT_LSB) -#define RDMA_REGION_29__NEXT_SET(x) (((x) << RDMA_REGION_29__NEXT_LSB) & RDMA_REGION_29__NEXT_MASK) - -#define RDMA_REGION_30__ADDRESS 0x00000098 -#define RDMA_REGION_30__OFFSET 0x00000098 -#define RDMA_REGION_30__ADDR_MSB 31 -#define RDMA_REGION_30__ADDR_LSB 13 -#define RDMA_REGION_30__ADDR_MASK 0xffffe000 -#define RDMA_REGION_30__ADDR_GET(x) (((x) & RDMA_REGION_30__ADDR_MASK) >> RDMA_REGION_30__ADDR_LSB) -#define RDMA_REGION_30__ADDR_SET(x) (((x) << RDMA_REGION_30__ADDR_LSB) & RDMA_REGION_30__ADDR_MASK) -#define RDMA_REGION_30__LENGTH_MSB 12 -#define RDMA_REGION_30__LENGTH_LSB 2 -#define RDMA_REGION_30__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_30__LENGTH_GET(x) (((x) & RDMA_REGION_30__LENGTH_MASK) >> RDMA_REGION_30__LENGTH_LSB) -#define RDMA_REGION_30__LENGTH_SET(x) (((x) << RDMA_REGION_30__LENGTH_LSB) & RDMA_REGION_30__LENGTH_MASK) -#define RDMA_REGION_30__INDI_MSB 1 -#define RDMA_REGION_30__INDI_LSB 1 -#define RDMA_REGION_30__INDI_MASK 0x00000002 -#define RDMA_REGION_30__INDI_GET(x) (((x) & RDMA_REGION_30__INDI_MASK) >> RDMA_REGION_30__INDI_LSB) -#define RDMA_REGION_30__INDI_SET(x) (((x) << RDMA_REGION_30__INDI_LSB) & RDMA_REGION_30__INDI_MASK) -#define RDMA_REGION_30__NEXT_MSB 0 -#define RDMA_REGION_30__NEXT_LSB 0 -#define RDMA_REGION_30__NEXT_MASK 0x00000001 -#define RDMA_REGION_30__NEXT_GET(x) (((x) & RDMA_REGION_30__NEXT_MASK) >> RDMA_REGION_30__NEXT_LSB) -#define RDMA_REGION_30__NEXT_SET(x) (((x) << RDMA_REGION_30__NEXT_LSB) & RDMA_REGION_30__NEXT_MASK) - -#define RDMA_REGION_31__ADDRESS 0x0000009c -#define RDMA_REGION_31__OFFSET 0x0000009c -#define RDMA_REGION_31__ADDR_MSB 31 -#define RDMA_REGION_31__ADDR_LSB 13 -#define RDMA_REGION_31__ADDR_MASK 0xffffe000 -#define RDMA_REGION_31__ADDR_GET(x) (((x) & RDMA_REGION_31__ADDR_MASK) >> RDMA_REGION_31__ADDR_LSB) -#define RDMA_REGION_31__ADDR_SET(x) (((x) << RDMA_REGION_31__ADDR_LSB) & RDMA_REGION_31__ADDR_MASK) -#define RDMA_REGION_31__LENGTH_MSB 12 -#define RDMA_REGION_31__LENGTH_LSB 2 -#define RDMA_REGION_31__LENGTH_MASK 0x00001ffc -#define RDMA_REGION_31__LENGTH_GET(x) (((x) & RDMA_REGION_31__LENGTH_MASK) >> RDMA_REGION_31__LENGTH_LSB) -#define RDMA_REGION_31__LENGTH_SET(x) (((x) << RDMA_REGION_31__LENGTH_LSB) & RDMA_REGION_31__LENGTH_MASK) -#define RDMA_REGION_31__INDI_MSB 1 -#define RDMA_REGION_31__INDI_LSB 1 -#define RDMA_REGION_31__INDI_MASK 0x00000002 -#define RDMA_REGION_31__INDI_GET(x) (((x) & RDMA_REGION_31__INDI_MASK) >> RDMA_REGION_31__INDI_LSB) -#define RDMA_REGION_31__INDI_SET(x) (((x) << RDMA_REGION_31__INDI_LSB) & RDMA_REGION_31__INDI_MASK) -#define RDMA_REGION_31__NEXT_MSB 0 -#define RDMA_REGION_31__NEXT_LSB 0 -#define RDMA_REGION_31__NEXT_MASK 0x00000001 -#define RDMA_REGION_31__NEXT_GET(x) (((x) & RDMA_REGION_31__NEXT_MASK) >> RDMA_REGION_31__NEXT_LSB) -#define RDMA_REGION_31__NEXT_SET(x) (((x) << RDMA_REGION_31__NEXT_LSB) & RDMA_REGION_31__NEXT_MASK) - -#define DMA_STATUS_ADDRESS 0x000000a0 -#define DMA_STATUS_OFFSET 0x000000a0 -#define DMA_STATUS_ERROR_CODE_MSB 14 -#define DMA_STATUS_ERROR_CODE_LSB 4 -#define DMA_STATUS_ERROR_CODE_MASK 0x00007ff0 -#define DMA_STATUS_ERROR_CODE_GET(x) (((x) & DMA_STATUS_ERROR_CODE_MASK) >> DMA_STATUS_ERROR_CODE_LSB) -#define DMA_STATUS_ERROR_CODE_SET(x) (((x) << DMA_STATUS_ERROR_CODE_LSB) & DMA_STATUS_ERROR_CODE_MASK) -#define DMA_STATUS_ERROR_MSB 3 -#define DMA_STATUS_ERROR_LSB 3 -#define DMA_STATUS_ERROR_MASK 0x00000008 -#define DMA_STATUS_ERROR_GET(x) (((x) & DMA_STATUS_ERROR_MASK) >> DMA_STATUS_ERROR_LSB) -#define DMA_STATUS_ERROR_SET(x) (((x) << DMA_STATUS_ERROR_LSB) & DMA_STATUS_ERROR_MASK) -#define DMA_STATUS_DONE_MSB 2 -#define DMA_STATUS_DONE_LSB 2 -#define DMA_STATUS_DONE_MASK 0x00000004 -#define DMA_STATUS_DONE_GET(x) (((x) & DMA_STATUS_DONE_MASK) >> DMA_STATUS_DONE_LSB) -#define DMA_STATUS_DONE_SET(x) (((x) << DMA_STATUS_DONE_LSB) & DMA_STATUS_DONE_MASK) -#define DMA_STATUS_STOPPED_MSB 1 -#define DMA_STATUS_STOPPED_LSB 1 -#define DMA_STATUS_STOPPED_MASK 0x00000002 -#define DMA_STATUS_STOPPED_GET(x) (((x) & DMA_STATUS_STOPPED_MASK) >> DMA_STATUS_STOPPED_LSB) -#define DMA_STATUS_STOPPED_SET(x) (((x) << DMA_STATUS_STOPPED_LSB) & DMA_STATUS_STOPPED_MASK) -#define DMA_STATUS_RUNNING_MSB 0 -#define DMA_STATUS_RUNNING_LSB 0 -#define DMA_STATUS_RUNNING_MASK 0x00000001 -#define DMA_STATUS_RUNNING_GET(x) (((x) & DMA_STATUS_RUNNING_MASK) >> DMA_STATUS_RUNNING_LSB) -#define DMA_STATUS_RUNNING_SET(x) (((x) << DMA_STATUS_RUNNING_LSB) & DMA_STATUS_RUNNING_MASK) - -#define DMA_INT_EN_ADDRESS 0x000000a4 -#define DMA_INT_EN_OFFSET 0x000000a4 -#define DMA_INT_EN_ERROR_ENA_MSB 3 -#define DMA_INT_EN_ERROR_ENA_LSB 3 -#define DMA_INT_EN_ERROR_ENA_MASK 0x00000008 -#define DMA_INT_EN_ERROR_ENA_GET(x) (((x) & DMA_INT_EN_ERROR_ENA_MASK) >> DMA_INT_EN_ERROR_ENA_LSB) -#define DMA_INT_EN_ERROR_ENA_SET(x) (((x) << DMA_INT_EN_ERROR_ENA_LSB) & DMA_INT_EN_ERROR_ENA_MASK) -#define DMA_INT_EN_DONE_ENA_MSB 2 -#define DMA_INT_EN_DONE_ENA_LSB 2 -#define DMA_INT_EN_DONE_ENA_MASK 0x00000004 -#define DMA_INT_EN_DONE_ENA_GET(x) (((x) & DMA_INT_EN_DONE_ENA_MASK) >> DMA_INT_EN_DONE_ENA_LSB) -#define DMA_INT_EN_DONE_ENA_SET(x) (((x) << DMA_INT_EN_DONE_ENA_LSB) & DMA_INT_EN_DONE_ENA_MASK) -#define DMA_INT_EN_STOPPED_ENA_MSB 1 -#define DMA_INT_EN_STOPPED_ENA_LSB 1 -#define DMA_INT_EN_STOPPED_ENA_MASK 0x00000002 -#define DMA_INT_EN_STOPPED_ENA_GET(x) (((x) & DMA_INT_EN_STOPPED_ENA_MASK) >> DMA_INT_EN_STOPPED_ENA_LSB) -#define DMA_INT_EN_STOPPED_ENA_SET(x) (((x) << DMA_INT_EN_STOPPED_ENA_LSB) & DMA_INT_EN_STOPPED_ENA_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct rdma_reg_reg_s { - volatile unsigned int dma_config; - volatile unsigned int dma_control; - volatile unsigned int dma_src; - volatile unsigned int dma_dest; - volatile unsigned int dma_length; - volatile unsigned int vmc_base; - volatile unsigned int indirect_reg; - volatile unsigned int indirect_return; - volatile unsigned int rdma_region_0_; - volatile unsigned int rdma_region_1_; - volatile unsigned int rdma_region_2_; - volatile unsigned int rdma_region_3_; - volatile unsigned int rdma_region_4_; - volatile unsigned int rdma_region_5_; - volatile unsigned int rdma_region_6_; - volatile unsigned int rdma_region_7_; - volatile unsigned int rdma_region_8_; - volatile unsigned int rdma_region_9_; - volatile unsigned int rdma_region_10_; - volatile unsigned int rdma_region_11_; - volatile unsigned int rdma_region_12_; - volatile unsigned int rdma_region_13_; - volatile unsigned int rdma_region_14_; - volatile unsigned int rdma_region_15_; - volatile unsigned int rdma_region_16_; - volatile unsigned int rdma_region_17_; - volatile unsigned int rdma_region_18_; - volatile unsigned int rdma_region_19_; - volatile unsigned int rdma_region_20_; - volatile unsigned int rdma_region_21_; - volatile unsigned int rdma_region_22_; - volatile unsigned int rdma_region_23_; - volatile unsigned int rdma_region_24_; - volatile unsigned int rdma_region_25_; - volatile unsigned int rdma_region_26_; - volatile unsigned int rdma_region_27_; - volatile unsigned int rdma_region_28_; - volatile unsigned int rdma_region_29_; - volatile unsigned int rdma_region_30_; - volatile unsigned int rdma_region_31_; - volatile unsigned int dma_status; - volatile unsigned int dma_int_en; -} rdma_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _RDMA_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_reg.h deleted file mode 100644 index 338bd42c0890..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_reg.h +++ /dev/null @@ -1,1189 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "rtc_wlan_reg.h" -#include "rtc_soc_reg.h" -#include "rtc_sync_reg.h" -#include "fpga_reg.h" - - -#ifndef BT_HEADERS - -#define RESET_CONTROL_MAC_WARM_RST_MSB WLAN_RESET_CONTROL_MAC_WARM_RST_MSB -#define RESET_CONTROL_MAC_WARM_RST_LSB WLAN_RESET_CONTROL_MAC_WARM_RST_LSB -#define RESET_CONTROL_MAC_WARM_RST_MASK WLAN_RESET_CONTROL_MAC_WARM_RST_MASK -#define RESET_CONTROL_MAC_WARM_RST_GET(x) WLAN_RESET_CONTROL_MAC_WARM_RST_GET(x) -#define RESET_CONTROL_MAC_WARM_RST_SET(x) WLAN_RESET_CONTROL_MAC_WARM_RST_SET(x) -#define RESET_CONTROL_MAC_COLD_RST_MSB WLAN_RESET_CONTROL_MAC_COLD_RST_MSB -#define RESET_CONTROL_MAC_COLD_RST_LSB WLAN_RESET_CONTROL_MAC_COLD_RST_LSB -#define RESET_CONTROL_MAC_COLD_RST_MASK WLAN_RESET_CONTROL_MAC_COLD_RST_MASK -#define RESET_CONTROL_MAC_COLD_RST_GET(x) WLAN_RESET_CONTROL_MAC_COLD_RST_GET(x) -#define RESET_CONTROL_MAC_COLD_RST_SET(x) WLAN_RESET_CONTROL_MAC_COLD_RST_SET(x) -#define RESET_CONTROL_WARM_RST_MSB WLAN_RESET_CONTROL_WARM_RST_MSB -#define RESET_CONTROL_WARM_RST_LSB WLAN_RESET_CONTROL_WARM_RST_LSB -#define RESET_CONTROL_WARM_RST_MASK WLAN_RESET_CONTROL_WARM_RST_MASK -#define RESET_CONTROL_WARM_RST_GET(x) WLAN_RESET_CONTROL_WARM_RST_GET(x) -#define RESET_CONTROL_WARM_RST_SET(x) WLAN_RESET_CONTROL_WARM_RST_SET(x) -#define RESET_CONTROL_BB_WARM_RST_MSB WLAN_RESET_CONTROL_BB_WARM_RST_MSB -#define RESET_CONTROL_BB_WARM_RST_LSB WLAN_RESET_CONTROL_BB_WARM_RST_LSB -#define RESET_CONTROL_BB_WARM_RST_MASK WLAN_RESET_CONTROL_BB_WARM_RST_MASK -#define RESET_CONTROL_BB_WARM_RST_GET(x) WLAN_RESET_CONTROL_BB_WARM_RST_GET(x) -#define RESET_CONTROL_BB_WARM_RST_SET(x) WLAN_RESET_CONTROL_BB_WARM_RST_SET(x) -#define RESET_CONTROL_BB_COLD_RST_MSB WLAN_RESET_CONTROL_BB_COLD_RST_MSB -#define RESET_CONTROL_BB_COLD_RST_LSB WLAN_RESET_CONTROL_BB_COLD_RST_LSB -#define RESET_CONTROL_BB_COLD_RST_MASK WLAN_RESET_CONTROL_BB_COLD_RST_MASK -#define RESET_CONTROL_BB_COLD_RST_GET(x) WLAN_RESET_CONTROL_BB_COLD_RST_GET(x) -#define RESET_CONTROL_BB_COLD_RST_SET(x) WLAN_RESET_CONTROL_BB_COLD_RST_SET(x) -#define RESET_CONTROL_RADIO_SRESET_MSB WLAN_RESET_CONTROL_RADIO_SRESET_MSB -#define RESET_CONTROL_RADIO_SRESET_LSB WLAN_RESET_CONTROL_RADIO_SRESET_LSB -#define RESET_CONTROL_RADIO_SRESET_MASK WLAN_RESET_CONTROL_RADIO_SRESET_MASK -#define RESET_CONTROL_RADIO_SRESET_GET(x) WLAN_RESET_CONTROL_RADIO_SRESET_GET(x) -#define RESET_CONTROL_RADIO_SRESET_SET(x) WLAN_RESET_CONTROL_RADIO_SRESET_SET(x) -#define RESET_CONTROL_MCI_RESET_MSB WLAN_RESET_CONTROL_MCI_RESET_MSB -#define RESET_CONTROL_MCI_RESET_LSB WLAN_RESET_CONTROL_MCI_RESET_LSB -#define RESET_CONTROL_MCI_RESET_MASK WLAN_RESET_CONTROL_MCI_RESET_MASK -#define RESET_CONTROL_MCI_RESET_GET(x) WLAN_RESET_CONTROL_MCI_RESET_GET(x) -#define RESET_CONTROL_MCI_RESET_SET(x) WLAN_RESET_CONTROL_MCI_RESET_SET(x) -#define XTAL_CONTROL_TCXO_MSB WLAN_XTAL_CONTROL_TCXO_MSB -#define XTAL_CONTROL_TCXO_LSB WLAN_XTAL_CONTROL_TCXO_LSB -#define XTAL_CONTROL_TCXO_MASK WLAN_XTAL_CONTROL_TCXO_MASK -#define XTAL_CONTROL_TCXO_GET(x) WLAN_XTAL_CONTROL_TCXO_GET(x) -#define XTAL_CONTROL_TCXO_SET(x) WLAN_XTAL_CONTROL_TCXO_SET(x) -#define REG_CONTROL0_SWREG_BITS_MSB WLAN_REG_CONTROL0_SWREG_BITS_MSB -#define REG_CONTROL0_SWREG_BITS_LSB WLAN_REG_CONTROL0_SWREG_BITS_LSB -#define REG_CONTROL0_SWREG_BITS_MASK WLAN_REG_CONTROL0_SWREG_BITS_MASK -#define REG_CONTROL0_SWREG_BITS_GET(x) WLAN_REG_CONTROL0_SWREG_BITS_GET(x) -#define REG_CONTROL0_SWREG_BITS_SET(x) WLAN_REG_CONTROL0_SWREG_BITS_SET(x) -#define REG_CONTROL1_SWREG_PROGRAM_MSB WLAN_REG_CONTROL1_SWREG_PROGRAM_MSB -#define REG_CONTROL1_SWREG_PROGRAM_LSB WLAN_REG_CONTROL1_SWREG_PROGRAM_LSB -#define REG_CONTROL1_SWREG_PROGRAM_MASK WLAN_REG_CONTROL1_SWREG_PROGRAM_MASK -#define REG_CONTROL1_SWREG_PROGRAM_GET(x) WLAN_REG_CONTROL1_SWREG_PROGRAM_GET(x) -#define REG_CONTROL1_SWREG_PROGRAM_SET(x) WLAN_REG_CONTROL1_SWREG_PROGRAM_SET(x) -#define REG_CONTROL1_OTPREG_LVL_MSB WLAN_REG_CONTROL1_OTPREG_LVL_MSB -#define REG_CONTROL1_OTPREG_LVL_LSB WLAN_REG_CONTROL1_OTPREG_LVL_LSB -#define REG_CONTROL1_OTPREG_LVL_MASK WLAN_REG_CONTROL1_OTPREG_LVL_MASK -#define REG_CONTROL1_OTPREG_LVL_GET(x) WLAN_REG_CONTROL1_OTPREG_LVL_GET(x) -#define REG_CONTROL1_OTPREG_LVL_SET(x) WLAN_REG_CONTROL1_OTPREG_LVL_SET(x) -#define QUADRATURE_DAC_MSB WLAN_QUADRATURE_DAC_MSB -#define QUADRATURE_DAC_LSB WLAN_QUADRATURE_DAC_LSB -#define QUADRATURE_DAC_MASK WLAN_QUADRATURE_DAC_MASK -#define QUADRATURE_DAC_GET(x) WLAN_QUADRATURE_DAC_GET(x) -#define QUADRATURE_DAC_SET(x) WLAN_QUADRATURE_DAC_SET(x) -#define QUADRATURE_ADC_MSB WLAN_QUADRATURE_ADC_MSB -#define QUADRATURE_ADC_LSB WLAN_QUADRATURE_ADC_LSB -#define QUADRATURE_ADC_MASK WLAN_QUADRATURE_ADC_MASK -#define QUADRATURE_ADC_GET(x) WLAN_QUADRATURE_ADC_GET(x) -#define QUADRATURE_ADC_SET(x) WLAN_QUADRATURE_ADC_SET(x) -#define PLL_CONTROL_DIV_MSB WLAN_PLL_CONTROL_DIV_MSB -#define PLL_CONTROL_DIV_LSB WLAN_PLL_CONTROL_DIV_LSB -#define PLL_CONTROL_DIV_MASK WLAN_PLL_CONTROL_DIV_MASK -#define PLL_CONTROL_DIV_GET(x) WLAN_PLL_CONTROL_DIV_GET(x) -#define PLL_CONTROL_DIV_SET(x) WLAN_PLL_CONTROL_DIV_SET(x) -#define PLL_CONTROL_REFDIV_MSB WLAN_PLL_CONTROL_REFDIV_MSB -#define PLL_CONTROL_REFDIV_LSB WLAN_PLL_CONTROL_REFDIV_LSB -#define PLL_CONTROL_REFDIV_MASK WLAN_PLL_CONTROL_REFDIV_MASK -#define PLL_CONTROL_REFDIV_GET(x) WLAN_PLL_CONTROL_REFDIV_GET(x) -#define PLL_CONTROL_REFDIV_SET(x) WLAN_PLL_CONTROL_REFDIV_SET(x) -#define PLL_CONTROL_CLK_SEL_MSB WLAN_PLL_CONTROL_CLK_SEL_MSB -#define PLL_CONTROL_CLK_SEL_LSB WLAN_PLL_CONTROL_CLK_SEL_LSB -#define PLL_CONTROL_CLK_SEL_MASK WLAN_PLL_CONTROL_CLK_SEL_MASK -#define PLL_CONTROL_CLK_SEL_GET(x) WLAN_PLL_CONTROL_CLK_SEL_GET(x) -#define PLL_CONTROL_CLK_SEL_SET(x) WLAN_PLL_CONTROL_CLK_SEL_SET(x) -#define PLL_CONTROL_BYPASS_MSB WLAN_PLL_CONTROL_BYPASS_MSB -#define PLL_CONTROL_BYPASS_LSB WLAN_PLL_CONTROL_BYPASS_LSB -#define PLL_CONTROL_BYPASS_MASK WLAN_PLL_CONTROL_BYPASS_MASK -#define PLL_CONTROL_BYPASS_GET(x) WLAN_PLL_CONTROL_BYPASS_GET(x) -#define PLL_CONTROL_BYPASS_SET(x) WLAN_PLL_CONTROL_BYPASS_SET(x) -#define PLL_CONTROL_UPDATING_MSB WLAN_PLL_CONTROL_UPDATING_MSB -#define PLL_CONTROL_UPDATING_LSB WLAN_PLL_CONTROL_UPDATING_LSB -#define PLL_CONTROL_UPDATING_MASK WLAN_PLL_CONTROL_UPDATING_MASK -#define PLL_CONTROL_UPDATING_GET(x) WLAN_PLL_CONTROL_UPDATING_GET(x) -#define PLL_CONTROL_NOPWD_MSB WLAN_PLL_CONTROL_NOPWD_MSB -#define PLL_CONTROL_NOPWD_LSB WLAN_PLL_CONTROL_NOPWD_LSB -#define PLL_CONTROL_NOPWD_MASK WLAN_PLL_CONTROL_NOPWD_MASK -#define PLL_CONTROL_NOPWD_GET(x) WLAN_PLL_CONTROL_NOPWD_GET(x) -#define PLL_CONTROL_NOPWD_SET(x) WLAN_PLL_CONTROL_NOPWD_SET(x) -#define PLL_CONTROL_MAC_OVERRIDE_MSB WLAN_PLL_CONTROL_MAC_OVERRIDE_MSB -#define PLL_CONTROL_MAC_OVERRIDE_LSB WLAN_PLL_CONTROL_MAC_OVERRIDE_LSB -#define PLL_CONTROL_MAC_OVERRIDE_MASK WLAN_PLL_CONTROL_MAC_OVERRIDE_MASK -#define PLL_CONTROL_MAC_OVERRIDE_GET(x) WLAN_PLL_CONTROL_MAC_OVERRIDE_GET(x) -#define PLL_CONTROL_MAC_OVERRIDE_SET(x) WLAN_PLL_CONTROL_MAC_OVERRIDE_SET(x) -#define PLL_CONTROL_DIG_TEST_CLK_MSB WLAN_PLL_CONTROL_DIG_TEST_CLK_MSB -#define PLL_CONTROL_DIG_TEST_CLK_LSB WLAN_PLL_CONTROL_DIG_TEST_CLK_LSB -#define PLL_CONTROL_DIG_TEST_CLK_MASK WLAN_PLL_CONTROL_DIG_TEST_CLK_MASK -#define PLL_CONTROL_DIG_TEST_CLK_GET(x) WLAN_PLL_CONTROL_DIG_TEST_CLK_GET(x) -#define PLL_CONTROL_DIG_TEST_CLK_SET(x) WLAN_PLL_CONTROL_DIG_TEST_CLK_SET(x) -#define PLL_SETTLE_TIME_MSB WLAN_PLL_SETTLE_TIME_MSB -#define PLL_SETTLE_TIME_LSB WLAN_PLL_SETTLE_TIME_LSB -#define PLL_SETTLE_TIME_MASK WLAN_PLL_SETTLE_TIME_MASK -#define PLL_SETTLE_TIME_GET(x) WLAN_PLL_SETTLE_TIME_GET(x) -#define PLL_SETTLE_TIME_SET(x) WLAN_PLL_SETTLE_TIME_SET(x) -#define XTAL_SETTLE_TIME_MSB WLAN_XTAL_SETTLE_TIME_MSB -#define XTAL_SETTLE_TIME_LSB WLAN_XTAL_SETTLE_TIME_LSB -#define XTAL_SETTLE_TIME_MASK WLAN_XTAL_SETTLE_TIME_MASK -#define XTAL_SETTLE_TIME_GET(x) WLAN_XTAL_SETTLE_TIME_GET(x) -#define XTAL_SETTLE_TIME_SET(x) WLAN_XTAL_SETTLE_TIME_SET(x) -#define CLOCK_OUT_SELECT_MSB WLAN_CLOCK_OUT_SELECT_MSB -#define CLOCK_OUT_SELECT_LSB WLAN_CLOCK_OUT_SELECT_LSB -#define CLOCK_OUT_SELECT_MASK WLAN_CLOCK_OUT_SELECT_MASK -#define CLOCK_OUT_SELECT_GET(x) WLAN_CLOCK_OUT_SELECT_GET(x) -#define CLOCK_OUT_SELECT_SET(x) WLAN_CLOCK_OUT_SELECT_SET(x) -#define CLOCK_OUT_DELAY_MSB WLAN_CLOCK_OUT_DELAY_MSB -#define CLOCK_OUT_DELAY_LSB WLAN_CLOCK_OUT_DELAY_LSB -#define CLOCK_OUT_DELAY_MASK WLAN_CLOCK_OUT_DELAY_MASK -#define CLOCK_OUT_DELAY_GET(x) WLAN_CLOCK_OUT_DELAY_GET(x) -#define CLOCK_OUT_DELAY_SET(x) WLAN_CLOCK_OUT_DELAY_SET(x) -#define BIAS_OVERRIDE_ON_MSB WLAN_BIAS_OVERRIDE_ON_MSB -#define BIAS_OVERRIDE_ON_LSB WLAN_BIAS_OVERRIDE_ON_LSB -#define BIAS_OVERRIDE_ON_MASK WLAN_BIAS_OVERRIDE_ON_MASK -#define BIAS_OVERRIDE_ON_GET(x) WLAN_BIAS_OVERRIDE_ON_GET(x) -#define BIAS_OVERRIDE_ON_SET(x) WLAN_BIAS_OVERRIDE_ON_SET(x) -#define MAC_SLEEP_CONTROL_ENABLE_MSB WLAN_MAC_SLEEP_CONTROL_ENABLE_MSB -#define MAC_SLEEP_CONTROL_ENABLE_LSB WLAN_MAC_SLEEP_CONTROL_ENABLE_LSB -#define MAC_SLEEP_CONTROL_ENABLE_MASK WLAN_MAC_SLEEP_CONTROL_ENABLE_MASK -#define MAC_SLEEP_CONTROL_ENABLE_GET(x) WLAN_MAC_SLEEP_CONTROL_ENABLE_GET(x) -#define MAC_SLEEP_CONTROL_ENABLE_SET(x) WLAN_MAC_SLEEP_CONTROL_ENABLE_SET(x) -#define MAC_SLEEP_CONTROL_RESERVED_MSB WLAN_MAC_SLEEP_CONTROL_RESERVED_MSB -#define MAC_SLEEP_CONTROL_RESERVED_LSB WLAN_MAC_SLEEP_CONTROL_RESERVED_LSB -#define MAC_SLEEP_CONTROL_RESERVED_MASK WLAN_MAC_SLEEP_CONTROL_RESERVED_MASK -#define MAC_SLEEP_CONTROL_RESERVED_GET(x) WLAN_MAC_SLEEP_CONTROL_RESERVED_GET(x) -#define MAC_SLEEP_CONTROL_RESERVED_SET(x) WLAN_MAC_SLEEP_CONTROL_RESERVED_SET(x) -#define MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_MSB WLAN_MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_MSB -#define MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_LSB WLAN_MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_LSB -#define MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_MASK WLAN_MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_MASK -#define MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_GET(x) WLAN_MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_GET(x) -#define MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_SET(x) WLAN_MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_SET(x) -#define KEEP_AWAKE_COUNT_MSB WLAN_KEEP_AWAKE_COUNT_MSB -#define KEEP_AWAKE_COUNT_LSB WLAN_KEEP_AWAKE_COUNT_LSB -#define KEEP_AWAKE_COUNT_MASK WLAN_KEEP_AWAKE_COUNT_MASK -#define KEEP_AWAKE_COUNT_GET(x) WLAN_KEEP_AWAKE_COUNT_GET(x) -#define KEEP_AWAKE_COUNT_SET(x) WLAN_KEEP_AWAKE_COUNT_SET(x) -#define DERIVED_RTC_CLK_PERIOD_MSB WLAN_DERIVED_RTC_CLK_PERIOD_MSB -#define DERIVED_RTC_CLK_PERIOD_LSB WLAN_DERIVED_RTC_CLK_PERIOD_LSB -#define DERIVED_RTC_CLK_PERIOD_MASK WLAN_DERIVED_RTC_CLK_PERIOD_MASK -#define DERIVED_RTC_CLK_PERIOD_GET(x) WLAN_DERIVED_RTC_CLK_PERIOD_GET(x) -#define DERIVED_RTC_CLK_PERIOD_SET(x) WLAN_DERIVED_RTC_CLK_PERIOD_SET(x) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_MSB WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_MSB -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_GET(x) WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_GET(x) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MSB WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MSB -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_GET(x) WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_GET(x) -#define DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_SET(x) WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_SET(x) -#define MAC_PCU_WBTIMER_ADDRESS MAC_PCU_WBTIMER_0_ADDRESS -#define MAC_PCU_WBTIMER_OFFSET MAC_PCU_WBTIMER_0_OFFSET -#define MAC_PCU_WBTIMER_ENABLE_MSB MAC_PCU_WBTIMER_0_ENABLE_MSB -#define MAC_PCU_WBTIMER_ENABLE_LSB MAC_PCU_WBTIMER_0_ENABLE_LSB -#define MAC_PCU_WBTIMER_ENABLE_MASK MAC_PCU_WBTIMER_0_ENABLE_MASK -#define MAC_PCU_WBTIMER_ENABLE_GET(x) MAC_PCU_WBTIMER_0_ENABLE_GET(x) -#define MAC_PCU_WBTIMER_ENABLE_SET(x) MAC_PCU_WBTIMER_0_ENABLE_SET(x) -#define MAC_PCU_CAB_AWAKE_ADDRESS MAC_PCU_SLP3_ADDRESS -#define MAC_PCU_CAB_AWAKE_OFFSET MAC_PCU_SLP3_OFFSET -#define MAC_PCU_CAB_AWAKE_DURATION_MSB MAC_PCU_SLP3_CAB_AWAKE_DUR_MSB -#define MAC_PCU_CAB_AWAKE_DURATION_LSB MAC_PCU_SLP3_CAB_AWAKE_DUR_LSB -#define MAC_PCU_CAB_AWAKE_DURATION_MASK MAC_PCU_SLP3_CAB_AWAKE_DUR_MASK -#define MAC_PCU_CAB_AWAKE_DURATION_GET(x) MAC_PCU_SLP3_CAB_AWAKE_DUR_GET(x) -#define MAC_PCU_CAB_AWAKE_DURATION_SET(x) MAC_PCU_SLP3_CAB_AWAKE_DUR_SET(x) -#define MAC_PCU_CAB_AWAKE_ENABLE_MSB MAC_PCU_SLP3_CAB_AWAKE_ENABLE_MSB -#define MAC_PCU_CAB_AWAKE_ENABLE_LSB MAC_PCU_SLP3_CAB_AWAKE_ENABLE_LSB -#define MAC_PCU_CAB_AWAKE_ENABLE_MASK MAC_PCU_SLP3_CAB_AWAKE_ENABLE_MASK -#define MAC_PCU_CAB_AWAKE_ENABLE_GET(x) MAC_PCU_SLP3_CAB_AWAKE_ENABLE_GET(x) -#define MAC_PCU_CAB_AWAKE_ENABLE_SET(x) MAC_PCU_SLP3_CAB_AWAKE_ENABLE_SET(x) -#define HT_ADDRESS WLAN_HT_ADDRESS -#define HT_OFFSET WLAN_HT_OFFSET -#define HT_MODE_MSB WLAN_HT_MODE_MSB -#define HT_MODE_LSB WLAN_HT_MODE_LSB -#define HT_MODE_MASK WLAN_HT_MODE_MASK -#define HT_MODE_GET(x) WLAN_HT_MODE_GET(x) -#define HT_MODE_SET(x) WLAN_HT_MODE_SET(x) -#define RESET_CONTROL_ADDRESS SOC_RESET_CONTROL_ADDRESS -#define RESET_CONTROL_OFFSET SOC_RESET_CONTROL_OFFSET -#define RESET_CONTROL_SDIO2_RST_MSB SOC_RESET_CONTROL_SDIO2_RST_MSB -#define RESET_CONTROL_SDIO2_RST_LSB SOC_RESET_CONTROL_SDIO2_RST_LSB -#define RESET_CONTROL_SDIO2_RST_MASK SOC_RESET_CONTROL_SDIO2_RST_MASK -#define RESET_CONTROL_SDIO2_RST_GET(x) SOC_RESET_CONTROL_SDIO2_RST_GET(x) -#define RESET_CONTROL_SDIO2_RST_SET(x) SOC_RESET_CONTROL_SDIO2_RST_SET(x) -#define RESET_CONTROL_SPI2_RST_MSB SOC_RESET_CONTROL_SPI2_RST_MSB -#define RESET_CONTROL_SPI2_RST_LSB SOC_RESET_CONTROL_SPI2_RST_LSB -#define RESET_CONTROL_SPI2_RST_MASK SOC_RESET_CONTROL_SPI2_RST_MASK -#define RESET_CONTROL_SPI2_RST_GET(x) SOC_RESET_CONTROL_SPI2_RST_GET(x) -#define RESET_CONTROL_SPI2_RST_SET(x) SOC_RESET_CONTROL_SPI2_RST_SET(x) -#define RESET_CONTROL_I2S_1_RST_MSB SOC_RESET_CONTROL_I2S_1_RST_MSB -#define RESET_CONTROL_I2S_1_RST_LSB SOC_RESET_CONTROL_I2S_1_RST_LSB -#define RESET_CONTROL_I2S_1_RST_MASK SOC_RESET_CONTROL_I2S_1_RST_MASK -#define RESET_CONTROL_I2S_1_RST_GET(x) SOC_RESET_CONTROL_I2S_1_RST_GET(x) -#define RESET_CONTROL_I2S_1_RST_SET(x) SOC_RESET_CONTROL_I2S_1_RST_SET(x) -#define RESET_CONTROL_I2S_1_MBOX_RST_MSB SOC_RESET_CONTROL_I2S_1_MBOX_RST_MSB -#define RESET_CONTROL_I2S_1_MBOX_RST_LSB SOC_RESET_CONTROL_I2S_1_MBOX_RST_LSB -#define RESET_CONTROL_I2S_1_MBOX_RST_MASK SOC_RESET_CONTROL_I2S_1_MBOX_RST_MASK -#define RESET_CONTROL_I2S_1_MBOX_RST_GET(x) SOC_RESET_CONTROL_I2S_1_MBOX_RST_GET(x) -#define RESET_CONTROL_I2S_1_MBOX_RST_SET(x) SOC_RESET_CONTROL_I2S_1_MBOX_RST_SET(x) -#define RESET_CONTROL_I2C_SLAVE_RST_MSB SOC_RESET_CONTROL_I2C_SLAVE_RST_MSB -#define RESET_CONTROL_I2C_SLAVE_RST_LSB SOC_RESET_CONTROL_I2C_SLAVE_RST_LSB -#define RESET_CONTROL_I2C_SLAVE_RST_MASK SOC_RESET_CONTROL_I2C_SLAVE_RST_MASK -#define RESET_CONTROL_I2C_SLAVE_RST_GET(x) SOC_RESET_CONTROL_I2C_SLAVE_RST_GET(x) -#define RESET_CONTROL_I2C_SLAVE_RST_SET(x) SOC_RESET_CONTROL_I2C_SLAVE_RST_SET(x) -#define RESET_CONTROL_USB_PHY_ARST_MSB SOC_RESET_CONTROL_USB_PHY_ARST_MSB -#define RESET_CONTROL_USB_PHY_ARST_LSB SOC_RESET_CONTROL_USB_PHY_ARST_LSB -#define RESET_CONTROL_USB_PHY_ARST_MASK SOC_RESET_CONTROL_USB_PHY_ARST_MASK -#define RESET_CONTROL_USB_PHY_ARST_GET(x) SOC_RESET_CONTROL_USB_PHY_ARST_GET(x) -#define RESET_CONTROL_USB_PHY_ARST_SET(x) SOC_RESET_CONTROL_USB_PHY_ARST_SET(x) -#define RESET_CONTROL_USB_PHY_RST_MSB SOC_RESET_CONTROL_USB_PHY_RST_MSB -#define RESET_CONTROL_USB_PHY_RST_LSB SOC_RESET_CONTROL_USB_PHY_RST_LSB -#define RESET_CONTROL_USB_PHY_RST_MASK SOC_RESET_CONTROL_USB_PHY_RST_MASK -#define RESET_CONTROL_USB_PHY_RST_GET(x) SOC_RESET_CONTROL_USB_PHY_RST_GET(x) -#define RESET_CONTROL_USB_PHY_RST_SET(x) SOC_RESET_CONTROL_USB_PHY_RST_SET(x) -#define RESET_CONTROL_USB_RST_MSB SOC_RESET_CONTROL_USB_RST_MSB -#define RESET_CONTROL_USB_RST_LSB SOC_RESET_CONTROL_USB_RST_LSB -#define RESET_CONTROL_USB_RST_MASK SOC_RESET_CONTROL_USB_RST_MASK -#define RESET_CONTROL_USB_RST_GET(x) SOC_RESET_CONTROL_USB_RST_GET(x) -#define RESET_CONTROL_USB_RST_SET(x) SOC_RESET_CONTROL_USB_RST_SET(x) -#define RESET_CONTROL_MMAC_RST_MSB SOC_RESET_CONTROL_MMAC_RST_MSB -#define RESET_CONTROL_MMAC_RST_LSB SOC_RESET_CONTROL_MMAC_RST_LSB -#define RESET_CONTROL_MMAC_RST_MASK SOC_RESET_CONTROL_MMAC_RST_MASK -#define RESET_CONTROL_MMAC_RST_GET(x) SOC_RESET_CONTROL_MMAC_RST_GET(x) -#define RESET_CONTROL_MMAC_RST_SET(x) SOC_RESET_CONTROL_MMAC_RST_SET(x) -#define RESET_CONTROL_MDIO_RST_MSB SOC_RESET_CONTROL_MDIO_RST_MSB -#define RESET_CONTROL_MDIO_RST_LSB SOC_RESET_CONTROL_MDIO_RST_LSB -#define RESET_CONTROL_MDIO_RST_MASK SOC_RESET_CONTROL_MDIO_RST_MASK -#define RESET_CONTROL_MDIO_RST_GET(x) SOC_RESET_CONTROL_MDIO_RST_GET(x) -#define RESET_CONTROL_MDIO_RST_SET(x) SOC_RESET_CONTROL_MDIO_RST_SET(x) -#define RESET_CONTROL_GE0_RST_MSB SOC_RESET_CONTROL_GE0_RST_MSB -#define RESET_CONTROL_GE0_RST_LSB SOC_RESET_CONTROL_GE0_RST_LSB -#define RESET_CONTROL_GE0_RST_MASK SOC_RESET_CONTROL_GE0_RST_MASK -#define RESET_CONTROL_GE0_RST_GET(x) SOC_RESET_CONTROL_GE0_RST_GET(x) -#define RESET_CONTROL_GE0_RST_SET(x) SOC_RESET_CONTROL_GE0_RST_SET(x) -#define RESET_CONTROL_I2S_RST_MSB SOC_RESET_CONTROL_I2S_RST_MSB -#define RESET_CONTROL_I2S_RST_LSB SOC_RESET_CONTROL_I2S_RST_LSB -#define RESET_CONTROL_I2S_RST_MASK SOC_RESET_CONTROL_I2S_RST_MASK -#define RESET_CONTROL_I2S_RST_GET(x) SOC_RESET_CONTROL_I2S_RST_GET(x) -#define RESET_CONTROL_I2S_RST_SET(x) SOC_RESET_CONTROL_I2S_RST_SET(x) -#define RESET_CONTROL_I2S_MBOX_RST_MSB SOC_RESET_CONTROL_I2S_MBOX_RST_MSB -#define RESET_CONTROL_I2S_MBOX_RST_LSB SOC_RESET_CONTROL_I2S_MBOX_RST_LSB -#define RESET_CONTROL_I2S_MBOX_RST_MASK SOC_RESET_CONTROL_I2S_MBOX_RST_MASK -#define RESET_CONTROL_I2S_MBOX_RST_GET(x) SOC_RESET_CONTROL_I2S_MBOX_RST_GET(x) -#define RESET_CONTROL_I2S_MBOX_RST_SET(x) SOC_RESET_CONTROL_I2S_MBOX_RST_SET(x) -#define RESET_CONTROL_CHECKSUM_ACC_RST_MSB SOC_RESET_CONTROL_CHECKSUM_ACC_RST_MSB -#define RESET_CONTROL_CHECKSUM_ACC_RST_LSB SOC_RESET_CONTROL_CHECKSUM_ACC_RST_LSB -#define RESET_CONTROL_CHECKSUM_ACC_RST_MASK SOC_RESET_CONTROL_CHECKSUM_ACC_RST_MASK -#define RESET_CONTROL_CHECKSUM_ACC_RST_GET(x) SOC_RESET_CONTROL_CHECKSUM_ACC_RST_GET(x) -#define RESET_CONTROL_CHECKSUM_ACC_RST_SET(x) SOC_RESET_CONTROL_CHECKSUM_ACC_RST_SET(x) -#define RESET_CONTROL_UART2_RST_MSB SOC_RESET_CONTROL_UART2_RST_MSB -#define RESET_CONTROL_UART2_RST_LSB SOC_RESET_CONTROL_UART2_RST_LSB -#define RESET_CONTROL_UART2_RST_MASK SOC_RESET_CONTROL_UART2_RST_MASK -#define RESET_CONTROL_UART2_RST_GET(x) SOC_RESET_CONTROL_UART2_RST_GET(x) -#define RESET_CONTROL_UART2_RST_SET(x) SOC_RESET_CONTROL_UART2_RST_SET(x) -#define RESET_CONTROL_DEBUG_UART_RST_MSB SOC_RESET_CONTROL_DEBUG_UART_RST_MSB -#define RESET_CONTROL_DEBUG_UART_RST_LSB SOC_RESET_CONTROL_DEBUG_UART_RST_LSB -#define RESET_CONTROL_DEBUG_UART_RST_MASK SOC_RESET_CONTROL_DEBUG_UART_RST_MASK -#define RESET_CONTROL_DEBUG_UART_RST_GET(x) SOC_RESET_CONTROL_DEBUG_UART_RST_GET(x) -#define RESET_CONTROL_DEBUG_UART_RST_SET(x) SOC_RESET_CONTROL_DEBUG_UART_RST_SET(x) -#define RESET_CONTROL_MIT_REG_MAPPING_RST_MSB SOC_RESET_CONTROL_MIT_REG_MAPPING_RST_MSB -#define RESET_CONTROL_MIT_REG_MAPPING_RST_LSB SOC_RESET_CONTROL_MIT_REG_MAPPING_RST_LSB -#define RESET_CONTROL_MIT_REG_MAPPING_RST_MASK SOC_RESET_CONTROL_MIT_REG_MAPPING_RST_MASK -#define RESET_CONTROL_MIT_REG_MAPPING_RST_GET(x) SOC_RESET_CONTROL_MIT_REG_MAPPING_RST_GET(x) -#define RESET_CONTROL_MIT_REG_MAPPING_RST_SET(x) SOC_RESET_CONTROL_MIT_REG_MAPPING_RST_SET(x) -#define RESET_CONTROL_MIT_ADAPTOR_RST_MSB SOC_RESET_CONTROL_MIT_ADAPTOR_RST_MSB -#define RESET_CONTROL_MIT_ADAPTOR_RST_LSB SOC_RESET_CONTROL_MIT_ADAPTOR_RST_LSB -#define RESET_CONTROL_MIT_ADAPTOR_RST_MASK SOC_RESET_CONTROL_MIT_ADAPTOR_RST_MASK -#define RESET_CONTROL_MIT_ADAPTOR_RST_GET(x) SOC_RESET_CONTROL_MIT_ADAPTOR_RST_GET(x) -#define RESET_CONTROL_MIT_ADAPTOR_RST_SET(x) SOC_RESET_CONTROL_MIT_ADAPTOR_RST_SET(x) -#define RESET_CONTROL_CPU_INIT_RESET_MSB SOC_RESET_CONTROL_CPU_INIT_RESET_MSB -#define RESET_CONTROL_CPU_INIT_RESET_LSB SOC_RESET_CONTROL_CPU_INIT_RESET_LSB -#define RESET_CONTROL_CPU_INIT_RESET_MASK SOC_RESET_CONTROL_CPU_INIT_RESET_MASK -#define RESET_CONTROL_CPU_INIT_RESET_GET(x) SOC_RESET_CONTROL_CPU_INIT_RESET_GET(x) -#define RESET_CONTROL_CPU_INIT_RESET_SET(x) SOC_RESET_CONTROL_CPU_INIT_RESET_SET(x) -#define RESET_CONTROL_RST_OUT_MSB SOC_RESET_CONTROL_RST_OUT_MSB -#define RESET_CONTROL_RST_OUT_LSB SOC_RESET_CONTROL_RST_OUT_LSB -#define RESET_CONTROL_RST_OUT_MASK SOC_RESET_CONTROL_RST_OUT_MASK -#define RESET_CONTROL_RST_OUT_GET(x) SOC_RESET_CONTROL_RST_OUT_GET(x) -#define RESET_CONTROL_RST_OUT_SET(x) SOC_RESET_CONTROL_RST_OUT_SET(x) -#define RESET_CONTROL_COLD_RST_MSB SOC_RESET_CONTROL_COLD_RST_MSB -#define RESET_CONTROL_COLD_RST_LSB SOC_RESET_CONTROL_COLD_RST_LSB -#define RESET_CONTROL_COLD_RST_MASK SOC_RESET_CONTROL_COLD_RST_MASK -#define RESET_CONTROL_COLD_RST_GET(x) SOC_RESET_CONTROL_COLD_RST_GET(x) -#define RESET_CONTROL_COLD_RST_SET(x) SOC_RESET_CONTROL_COLD_RST_SET(x) -#define RESET_CONTROL_CPU_WARM_RST_MSB SOC_RESET_CONTROL_CPU_WARM_RST_MSB -#define RESET_CONTROL_CPU_WARM_RST_LSB SOC_RESET_CONTROL_CPU_WARM_RST_LSB -#define RESET_CONTROL_CPU_WARM_RST_MASK SOC_RESET_CONTROL_CPU_WARM_RST_MASK -#define RESET_CONTROL_CPU_WARM_RST_GET(x) SOC_RESET_CONTROL_CPU_WARM_RST_GET(x) -#define RESET_CONTROL_CPU_WARM_RST_SET(x) SOC_RESET_CONTROL_CPU_WARM_RST_SET(x) -#define RESET_CONTROL_MBOX_RST_MSB SOC_RESET_CONTROL_MBOX_RST_MSB -#define RESET_CONTROL_MBOX_RST_LSB SOC_RESET_CONTROL_MBOX_RST_LSB -#define RESET_CONTROL_MBOX_RST_MASK SOC_RESET_CONTROL_MBOX_RST_MASK -#define RESET_CONTROL_MBOX_RST_GET(x) SOC_RESET_CONTROL_MBOX_RST_GET(x) -#define RESET_CONTROL_MBOX_RST_SET(x) SOC_RESET_CONTROL_MBOX_RST_SET(x) -#define RESET_CONTROL_UART_RST_MSB SOC_RESET_CONTROL_UART_RST_MSB -#define RESET_CONTROL_UART_RST_LSB SOC_RESET_CONTROL_UART_RST_LSB -#define RESET_CONTROL_UART_RST_MASK SOC_RESET_CONTROL_UART_RST_MASK -#define RESET_CONTROL_UART_RST_GET(x) SOC_RESET_CONTROL_UART_RST_GET(x) -#define RESET_CONTROL_UART_RST_SET(x) SOC_RESET_CONTROL_UART_RST_SET(x) -#define RESET_CONTROL_SI0_RST_MSB SOC_RESET_CONTROL_SI0_RST_MSB -#define RESET_CONTROL_SI0_RST_LSB SOC_RESET_CONTROL_SI0_RST_LSB -#define RESET_CONTROL_SI0_RST_MASK SOC_RESET_CONTROL_SI0_RST_MASK -#define RESET_CONTROL_SI0_RST_GET(x) SOC_RESET_CONTROL_SI0_RST_GET(x) -#define RESET_CONTROL_SI0_RST_SET(x) SOC_RESET_CONTROL_SI0_RST_SET(x) -#define TCXO_DETECT_ADDRESS SOC_TCXO_DETECT_ADDRESS -#define TCXO_DETECT_OFFSET SOC_TCXO_DETECT_OFFSET -#define TCXO_DETECT_PRESENT_MSB SOC_TCXO_DETECT_PRESENT_MSB -#define TCXO_DETECT_PRESENT_LSB SOC_TCXO_DETECT_PRESENT_LSB -#define TCXO_DETECT_PRESENT_MASK SOC_TCXO_DETECT_PRESENT_MASK -#define TCXO_DETECT_PRESENT_GET(x) SOC_TCXO_DETECT_PRESENT_GET(x) -#define TCXO_DETECT_PRESENT_SET(x) SOC_TCXO_DETECT_PRESENT_SET(x) -#define XTAL_TEST_ADDRESS SOC_XTAL_TEST_ADDRESS -#define XTAL_TEST_OFFSET SOC_XTAL_TEST_OFFSET -#define XTAL_TEST_NOTCXODET_MSB SOC_XTAL_TEST_NOTCXODET_MSB -#define XTAL_TEST_NOTCXODET_LSB SOC_XTAL_TEST_NOTCXODET_LSB -#define XTAL_TEST_NOTCXODET_MASK SOC_XTAL_TEST_NOTCXODET_MASK -#define XTAL_TEST_NOTCXODET_GET(x) SOC_XTAL_TEST_NOTCXODET_GET(x) -#define XTAL_TEST_NOTCXODET_SET(x) SOC_XTAL_TEST_NOTCXODET_SET(x) -#define CPU_CLOCK_ADDRESS SOC_CPU_CLOCK_ADDRESS -#define CPU_CLOCK_OFFSET SOC_CPU_CLOCK_OFFSET -#define CPU_CLOCK_STANDARD_MSB SOC_CPU_CLOCK_STANDARD_MSB -#define CPU_CLOCK_STANDARD_LSB SOC_CPU_CLOCK_STANDARD_LSB -#define CPU_CLOCK_STANDARD_MASK SOC_CPU_CLOCK_STANDARD_MASK -#define CPU_CLOCK_STANDARD_GET(x) SOC_CPU_CLOCK_STANDARD_GET(x) -#define CPU_CLOCK_STANDARD_SET(x) SOC_CPU_CLOCK_STANDARD_SET(x) -#define CLOCK_CONTROL_ADDRESS SOC_CLOCK_CONTROL_ADDRESS -#define CLOCK_CONTROL_OFFSET SOC_CLOCK_CONTROL_OFFSET -#define CLOCK_CONTROL_LF_CLK32_MSB SOC_CLOCK_CONTROL_LF_CLK32_MSB -#define CLOCK_CONTROL_LF_CLK32_LSB SOC_CLOCK_CONTROL_LF_CLK32_LSB -#define CLOCK_CONTROL_LF_CLK32_MASK SOC_CLOCK_CONTROL_LF_CLK32_MASK -#define CLOCK_CONTROL_LF_CLK32_GET(x) SOC_CLOCK_CONTROL_LF_CLK32_GET(x) -#define CLOCK_CONTROL_LF_CLK32_SET(x) SOC_CLOCK_CONTROL_LF_CLK32_SET(x) -#define CLOCK_CONTROL_SI0_CLK_MSB SOC_CLOCK_CONTROL_SI0_CLK_MSB -#define CLOCK_CONTROL_SI0_CLK_LSB SOC_CLOCK_CONTROL_SI0_CLK_LSB -#define CLOCK_CONTROL_SI0_CLK_MASK SOC_CLOCK_CONTROL_SI0_CLK_MASK -#define CLOCK_CONTROL_SI0_CLK_GET(x) SOC_CLOCK_CONTROL_SI0_CLK_GET(x) -#define CLOCK_CONTROL_SI0_CLK_SET(x) SOC_CLOCK_CONTROL_SI0_CLK_SET(x) -#define WDT_CONTROL_ADDRESS SOC_WDT_CONTROL_ADDRESS -#define WDT_CONTROL_OFFSET SOC_WDT_CONTROL_OFFSET -#define WDT_CONTROL_ACTION_MSB SOC_WDT_CONTROL_ACTION_MSB -#define WDT_CONTROL_ACTION_LSB SOC_WDT_CONTROL_ACTION_LSB -#define WDT_CONTROL_ACTION_MASK SOC_WDT_CONTROL_ACTION_MASK -#define WDT_CONTROL_ACTION_GET(x) SOC_WDT_CONTROL_ACTION_GET(x) -#define WDT_CONTROL_ACTION_SET(x) SOC_WDT_CONTROL_ACTION_SET(x) -#define WDT_STATUS_ADDRESS SOC_WDT_STATUS_ADDRESS -#define WDT_STATUS_OFFSET SOC_WDT_STATUS_OFFSET -#define WDT_STATUS_INTERRUPT_MSB SOC_WDT_STATUS_INTERRUPT_MSB -#define WDT_STATUS_INTERRUPT_LSB SOC_WDT_STATUS_INTERRUPT_LSB -#define WDT_STATUS_INTERRUPT_MASK SOC_WDT_STATUS_INTERRUPT_MASK -#define WDT_STATUS_INTERRUPT_GET(x) SOC_WDT_STATUS_INTERRUPT_GET(x) -#define WDT_STATUS_INTERRUPT_SET(x) SOC_WDT_STATUS_INTERRUPT_SET(x) -#define WDT_ADDRESS SOC_WDT_ADDRESS -#define WDT_OFFSET SOC_WDT_OFFSET -#define WDT_TARGET_MSB SOC_WDT_TARGET_MSB -#define WDT_TARGET_LSB SOC_WDT_TARGET_LSB -#define WDT_TARGET_MASK SOC_WDT_TARGET_MASK -#define WDT_TARGET_GET(x) SOC_WDT_TARGET_GET(x) -#define WDT_TARGET_SET(x) SOC_WDT_TARGET_SET(x) -#define WDT_COUNT_ADDRESS SOC_WDT_COUNT_ADDRESS -#define WDT_COUNT_OFFSET SOC_WDT_COUNT_OFFSET -#define WDT_COUNT_VALUE_MSB SOC_WDT_COUNT_VALUE_MSB -#define WDT_COUNT_VALUE_LSB SOC_WDT_COUNT_VALUE_LSB -#define WDT_COUNT_VALUE_MASK SOC_WDT_COUNT_VALUE_MASK -#define WDT_COUNT_VALUE_GET(x) SOC_WDT_COUNT_VALUE_GET(x) -#define WDT_COUNT_VALUE_SET(x) SOC_WDT_COUNT_VALUE_SET(x) -#define WDT_RESET_ADDRESS SOC_WDT_RESET_ADDRESS -#define WDT_RESET_OFFSET SOC_WDT_RESET_OFFSET -#define WDT_RESET_VALUE_MSB SOC_WDT_RESET_VALUE_MSB -#define WDT_RESET_VALUE_LSB SOC_WDT_RESET_VALUE_LSB -#define WDT_RESET_VALUE_MASK SOC_WDT_RESET_VALUE_MASK -#define WDT_RESET_VALUE_GET(x) SOC_WDT_RESET_VALUE_GET(x) -#define WDT_RESET_VALUE_SET(x) SOC_WDT_RESET_VALUE_SET(x) -#define INT_STATUS_ADDRESS SOC_INT_STATUS_ADDRESS -#define INT_STATUS_OFFSET SOC_INT_STATUS_OFFSET -#define INT_STATUS_STE_MBOX_MSB SOC_INT_STATUS_STE_MBOX_MSB -#define INT_STATUS_STE_MBOX_LSB SOC_INT_STATUS_STE_MBOX_LSB -#define INT_STATUS_STE_MBOX_MASK SOC_INT_STATUS_STE_MBOX_MASK -#define INT_STATUS_STE_MBOX_GET(x) SOC_INT_STATUS_STE_MBOX_GET(x) -#define INT_STATUS_STE_MBOX_SET(x) SOC_INT_STATUS_STE_MBOX_SET(x) -#define INT_STATUS_SDIO2_MBOX_MSB SOC_INT_STATUS_SDIO2_MBOX_MSB -#define INT_STATUS_SDIO2_MBOX_LSB SOC_INT_STATUS_SDIO2_MBOX_LSB -#define INT_STATUS_SDIO2_MBOX_MASK SOC_INT_STATUS_SDIO2_MBOX_MASK -#define INT_STATUS_SDIO2_MBOX_GET(x) SOC_INT_STATUS_SDIO2_MBOX_GET(x) -#define INT_STATUS_SDIO2_MBOX_SET(x) SOC_INT_STATUS_SDIO2_MBOX_SET(x) -#define INT_STATUS_USBDMA_MSB SOC_INT_STATUS_USBDMA_MSB -#define INT_STATUS_USBDMA_LSB SOC_INT_STATUS_USBDMA_LSB -#define INT_STATUS_USBDMA_MASK SOC_INT_STATUS_USBDMA_MASK -#define INT_STATUS_USBDMA_GET(x) SOC_INT_STATUS_USBDMA_GET(x) -#define INT_STATUS_USBDMA_SET(x) SOC_INT_STATUS_USBDMA_SET(x) -#define INT_STATUS_USBIP_MSB SOC_INT_STATUS_USBIP_MSB -#define INT_STATUS_USBIP_LSB SOC_INT_STATUS_USBIP_LSB -#define INT_STATUS_USBIP_MASK SOC_INT_STATUS_USBIP_MASK -#define INT_STATUS_USBIP_GET(x) SOC_INT_STATUS_USBIP_GET(x) -#define INT_STATUS_USBIP_SET(x) SOC_INT_STATUS_USBIP_SET(x) -#define INT_STATUS_MMAC_MSB SOC_INT_STATUS_MMAC_MSB -#define INT_STATUS_MMAC_LSB SOC_INT_STATUS_MMAC_LSB -#define INT_STATUS_MMAC_MASK SOC_INT_STATUS_MMAC_MASK -#define INT_STATUS_MMAC_GET(x) SOC_INT_STATUS_MMAC_GET(x) -#define INT_STATUS_MMAC_SET(x) SOC_INT_STATUS_MMAC_SET(x) -#define INT_STATUS_MIT_REG_ACCESS_MSB SOC_INT_STATUS_MIT_REG_ACCESS_MSB -#define INT_STATUS_MIT_REG_ACCESS_LSB SOC_INT_STATUS_MIT_REG_ACCESS_LSB -#define INT_STATUS_MIT_REG_ACCESS_MASK SOC_INT_STATUS_MIT_REG_ACCESS_MASK -#define INT_STATUS_MIT_REG_ACCESS_GET(x) SOC_INT_STATUS_MIT_REG_ACCESS_GET(x) -#define INT_STATUS_MIT_REG_ACCESS_SET(x) SOC_INT_STATUS_MIT_REG_ACCESS_SET(x) -#define INT_STATUS_FLIGHT_MODE_MSB SOC_INT_STATUS_FLIGHT_MODE_MSB -#define INT_STATUS_FLIGHT_MODE_LSB SOC_INT_STATUS_FLIGHT_MODE_LSB -#define INT_STATUS_FLIGHT_MODE_MASK SOC_INT_STATUS_FLIGHT_MODE_MASK -#define INT_STATUS_FLIGHT_MODE_GET(x) SOC_INT_STATUS_FLIGHT_MODE_GET(x) -#define INT_STATUS_FLIGHT_MODE_SET(x) SOC_INT_STATUS_FLIGHT_MODE_SET(x) -#define INT_STATUS_BBP_SLEEP_RISING_MSB SOC_INT_STATUS_BBP_SLEEP_RISING_MSB -#define INT_STATUS_BBP_SLEEP_RISING_LSB SOC_INT_STATUS_BBP_SLEEP_RISING_LSB -#define INT_STATUS_BBP_SLEEP_RISING_MASK SOC_INT_STATUS_BBP_SLEEP_RISING_MASK -#define INT_STATUS_BBP_SLEEP_RISING_GET(x) SOC_INT_STATUS_BBP_SLEEP_RISING_GET(x) -#define INT_STATUS_BBP_SLEEP_RISING_SET(x) SOC_INT_STATUS_BBP_SLEEP_RISING_SET(x) -#define INT_STATUS_RF_SLEEP_RISING_MSB SOC_INT_STATUS_RF_SLEEP_RISING_MSB -#define INT_STATUS_RF_SLEEP_RISING_LSB SOC_INT_STATUS_RF_SLEEP_RISING_LSB -#define INT_STATUS_RF_SLEEP_RISING_MASK SOC_INT_STATUS_RF_SLEEP_RISING_MASK -#define INT_STATUS_RF_SLEEP_RISING_GET(x) SOC_INT_STATUS_RF_SLEEP_RISING_GET(x) -#define INT_STATUS_RF_SLEEP_RISING_SET(x) SOC_INT_STATUS_RF_SLEEP_RISING_SET(x) -#define INT_STATUS_MODE_SWITCH_MSB SOC_INT_STATUS_MODE_SWITCH_MSB -#define INT_STATUS_MODE_SWITCH_LSB SOC_INT_STATUS_MODE_SWITCH_LSB -#define INT_STATUS_MODE_SWITCH_MASK SOC_INT_STATUS_MODE_SWITCH_MASK -#define INT_STATUS_MODE_SWITCH_GET(x) SOC_INT_STATUS_MODE_SWITCH_GET(x) -#define INT_STATUS_MODE_SWITCH_SET(x) SOC_INT_STATUS_MODE_SWITCH_SET(x) -#define INT_STATUS_HCI_UART_MSB SOC_INT_STATUS_HCI_UART_MSB -#define INT_STATUS_HCI_UART_LSB SOC_INT_STATUS_HCI_UART_LSB -#define INT_STATUS_HCI_UART_MASK SOC_INT_STATUS_HCI_UART_MASK -#define INT_STATUS_HCI_UART_GET(x) SOC_INT_STATUS_HCI_UART_GET(x) -#define INT_STATUS_HCI_UART_SET(x) SOC_INT_STATUS_HCI_UART_SET(x) -#define INT_STATUS_THERM_MSB SOC_INT_STATUS_THERM_MSB -#define INT_STATUS_THERM_LSB SOC_INT_STATUS_THERM_LSB -#define INT_STATUS_THERM_MASK SOC_INT_STATUS_THERM_MASK -#define INT_STATUS_THERM_GET(x) SOC_INT_STATUS_THERM_GET(x) -#define INT_STATUS_THERM_SET(x) SOC_INT_STATUS_THERM_SET(x) -#define INT_STATUS_EFUSE_OVERWRITE_MSB SOC_INT_STATUS_EFUSE_OVERWRITE_MSB -#define INT_STATUS_EFUSE_OVERWRITE_LSB SOC_INT_STATUS_EFUSE_OVERWRITE_LSB -#define INT_STATUS_EFUSE_OVERWRITE_MASK SOC_INT_STATUS_EFUSE_OVERWRITE_MASK -#define INT_STATUS_EFUSE_OVERWRITE_GET(x) SOC_INT_STATUS_EFUSE_OVERWRITE_GET(x) -#define INT_STATUS_EFUSE_OVERWRITE_SET(x) SOC_INT_STATUS_EFUSE_OVERWRITE_SET(x) -#define INT_STATUS_UART_MBOX_MSB SOC_INT_STATUS_UART_MBOX_MSB -#define INT_STATUS_UART_MBOX_LSB SOC_INT_STATUS_UART_MBOX_LSB -#define INT_STATUS_UART_MBOX_MASK SOC_INT_STATUS_UART_MBOX_MASK -#define INT_STATUS_UART_MBOX_GET(x) SOC_INT_STATUS_UART_MBOX_GET(x) -#define INT_STATUS_UART_MBOX_SET(x) SOC_INT_STATUS_UART_MBOX_SET(x) -#define INT_STATUS_GENERIC_MBOX_MSB SOC_INT_STATUS_GENERIC_MBOX_MSB -#define INT_STATUS_GENERIC_MBOX_LSB SOC_INT_STATUS_GENERIC_MBOX_LSB -#define INT_STATUS_GENERIC_MBOX_MASK SOC_INT_STATUS_GENERIC_MBOX_MASK -#define INT_STATUS_GENERIC_MBOX_GET(x) SOC_INT_STATUS_GENERIC_MBOX_GET(x) -#define INT_STATUS_GENERIC_MBOX_SET(x) SOC_INT_STATUS_GENERIC_MBOX_SET(x) -#define INT_STATUS_RDMA_MSB SOC_INT_STATUS_RDMA_MSB -#define INT_STATUS_RDMA_LSB SOC_INT_STATUS_RDMA_LSB -#define INT_STATUS_RDMA_MASK SOC_INT_STATUS_RDMA_MASK -#define INT_STATUS_RDMA_GET(x) SOC_INT_STATUS_RDMA_GET(x) -#define INT_STATUS_RDMA_SET(x) SOC_INT_STATUS_RDMA_SET(x) -#define INT_STATUS_BTCOEX_MSB SOC_INT_STATUS_BTCOEX_MSB -#define INT_STATUS_BTCOEX_LSB SOC_INT_STATUS_BTCOEX_LSB -#define INT_STATUS_BTCOEX_MASK SOC_INT_STATUS_BTCOEX_MASK -#define INT_STATUS_BTCOEX_GET(x) SOC_INT_STATUS_BTCOEX_GET(x) -#define INT_STATUS_BTCOEX_SET(x) SOC_INT_STATUS_BTCOEX_SET(x) -#define INT_STATUS_RTC_POWER_MSB SOC_INT_STATUS_RTC_POWER_MSB -#define INT_STATUS_RTC_POWER_LSB SOC_INT_STATUS_RTC_POWER_LSB -#define INT_STATUS_RTC_POWER_MASK SOC_INT_STATUS_RTC_POWER_MASK -#define INT_STATUS_RTC_POWER_GET(x) SOC_INT_STATUS_RTC_POWER_GET(x) -#define INT_STATUS_RTC_POWER_SET(x) SOC_INT_STATUS_RTC_POWER_SET(x) -#define INT_STATUS_MAC_MSB SOC_INT_STATUS_MAC_MSB -#define INT_STATUS_MAC_LSB SOC_INT_STATUS_MAC_LSB -#define INT_STATUS_MAC_MASK SOC_INT_STATUS_MAC_MASK -#define INT_STATUS_MAC_GET(x) SOC_INT_STATUS_MAC_GET(x) -#define INT_STATUS_MAC_SET(x) SOC_INT_STATUS_MAC_SET(x) -#define INT_STATUS_MAILBOX_MSB SOC_INT_STATUS_MAILBOX_MSB -#define INT_STATUS_MAILBOX_LSB SOC_INT_STATUS_MAILBOX_LSB -#define INT_STATUS_MAILBOX_MASK SOC_INT_STATUS_MAILBOX_MASK -#define INT_STATUS_MAILBOX_GET(x) SOC_INT_STATUS_MAILBOX_GET(x) -#define INT_STATUS_MAILBOX_SET(x) SOC_INT_STATUS_MAILBOX_SET(x) -#define INT_STATUS_RTC_ALARM_MSB SOC_INT_STATUS_RTC_ALARM_MSB -#define INT_STATUS_RTC_ALARM_LSB SOC_INT_STATUS_RTC_ALARM_LSB -#define INT_STATUS_RTC_ALARM_MASK SOC_INT_STATUS_RTC_ALARM_MASK -#define INT_STATUS_RTC_ALARM_GET(x) SOC_INT_STATUS_RTC_ALARM_GET(x) -#define INT_STATUS_RTC_ALARM_SET(x) SOC_INT_STATUS_RTC_ALARM_SET(x) -#define INT_STATUS_HF_TIMER_MSB SOC_INT_STATUS_HF_TIMER_MSB -#define INT_STATUS_HF_TIMER_LSB SOC_INT_STATUS_HF_TIMER_LSB -#define INT_STATUS_HF_TIMER_MASK SOC_INT_STATUS_HF_TIMER_MASK -#define INT_STATUS_HF_TIMER_GET(x) SOC_INT_STATUS_HF_TIMER_GET(x) -#define INT_STATUS_HF_TIMER_SET(x) SOC_INT_STATUS_HF_TIMER_SET(x) -#define INT_STATUS_LF_TIMER3_MSB SOC_INT_STATUS_LF_TIMER3_MSB -#define INT_STATUS_LF_TIMER3_LSB SOC_INT_STATUS_LF_TIMER3_LSB -#define INT_STATUS_LF_TIMER3_MASK SOC_INT_STATUS_LF_TIMER3_MASK -#define INT_STATUS_LF_TIMER3_GET(x) SOC_INT_STATUS_LF_TIMER3_GET(x) -#define INT_STATUS_LF_TIMER3_SET(x) SOC_INT_STATUS_LF_TIMER3_SET(x) -#define INT_STATUS_LF_TIMER2_MSB SOC_INT_STATUS_LF_TIMER2_MSB -#define INT_STATUS_LF_TIMER2_LSB SOC_INT_STATUS_LF_TIMER2_LSB -#define INT_STATUS_LF_TIMER2_MASK SOC_INT_STATUS_LF_TIMER2_MASK -#define INT_STATUS_LF_TIMER2_GET(x) SOC_INT_STATUS_LF_TIMER2_GET(x) -#define INT_STATUS_LF_TIMER2_SET(x) SOC_INT_STATUS_LF_TIMER2_SET(x) -#define INT_STATUS_LF_TIMER1_MSB SOC_INT_STATUS_LF_TIMER1_MSB -#define INT_STATUS_LF_TIMER1_LSB SOC_INT_STATUS_LF_TIMER1_LSB -#define INT_STATUS_LF_TIMER1_MASK SOC_INT_STATUS_LF_TIMER1_MASK -#define INT_STATUS_LF_TIMER1_GET(x) SOC_INT_STATUS_LF_TIMER1_GET(x) -#define INT_STATUS_LF_TIMER1_SET(x) SOC_INT_STATUS_LF_TIMER1_SET(x) -#define INT_STATUS_LF_TIMER0_MSB SOC_INT_STATUS_LF_TIMER0_MSB -#define INT_STATUS_LF_TIMER0_LSB SOC_INT_STATUS_LF_TIMER0_LSB -#define INT_STATUS_LF_TIMER0_MASK SOC_INT_STATUS_LF_TIMER0_MASK -#define INT_STATUS_LF_TIMER0_GET(x) SOC_INT_STATUS_LF_TIMER0_GET(x) -#define INT_STATUS_LF_TIMER0_SET(x) SOC_INT_STATUS_LF_TIMER0_SET(x) -#define INT_STATUS_KEYPAD_MSB SOC_INT_STATUS_KEYPAD_MSB -#define INT_STATUS_KEYPAD_LSB SOC_INT_STATUS_KEYPAD_LSB -#define INT_STATUS_KEYPAD_MASK SOC_INT_STATUS_KEYPAD_MASK -#define INT_STATUS_KEYPAD_GET(x) SOC_INT_STATUS_KEYPAD_GET(x) -#define INT_STATUS_KEYPAD_SET(x) SOC_INT_STATUS_KEYPAD_SET(x) -#define INT_STATUS_SI_MSB SOC_INT_STATUS_SI_MSB -#define INT_STATUS_SI_LSB SOC_INT_STATUS_SI_LSB -#define INT_STATUS_SI_MASK SOC_INT_STATUS_SI_MASK -#define INT_STATUS_SI_GET(x) SOC_INT_STATUS_SI_GET(x) -#define INT_STATUS_SI_SET(x) SOC_INT_STATUS_SI_SET(x) -#define INT_STATUS_GPIO_MSB SOC_INT_STATUS_GPIO_MSB -#define INT_STATUS_GPIO_LSB SOC_INT_STATUS_GPIO_LSB -#define INT_STATUS_GPIO_MASK SOC_INT_STATUS_GPIO_MASK -#define INT_STATUS_GPIO_GET(x) SOC_INT_STATUS_GPIO_GET(x) -#define INT_STATUS_GPIO_SET(x) SOC_INT_STATUS_GPIO_SET(x) -#define INT_STATUS_UART_MSB SOC_INT_STATUS_UART_MSB -#define INT_STATUS_UART_LSB SOC_INT_STATUS_UART_LSB -#define INT_STATUS_UART_MASK SOC_INT_STATUS_UART_MASK -#define INT_STATUS_UART_GET(x) SOC_INT_STATUS_UART_GET(x) -#define INT_STATUS_UART_SET(x) SOC_INT_STATUS_UART_SET(x) -#define INT_STATUS_ERROR_MSB SOC_INT_STATUS_ERROR_MSB -#define INT_STATUS_ERROR_LSB SOC_INT_STATUS_ERROR_LSB -#define INT_STATUS_ERROR_MASK SOC_INT_STATUS_ERROR_MASK -#define INT_STATUS_ERROR_GET(x) SOC_INT_STATUS_ERROR_GET(x) -#define INT_STATUS_ERROR_SET(x) SOC_INT_STATUS_ERROR_SET(x) -#define INT_STATUS_WDT_INT_MSB SOC_INT_STATUS_WDT_INT_MSB -#define INT_STATUS_WDT_INT_LSB SOC_INT_STATUS_WDT_INT_LSB -#define INT_STATUS_WDT_INT_MASK SOC_INT_STATUS_WDT_INT_MASK -#define INT_STATUS_WDT_INT_GET(x) SOC_INT_STATUS_WDT_INT_GET(x) -#define INT_STATUS_WDT_INT_SET(x) SOC_INT_STATUS_WDT_INT_SET(x) -#define LF_TIMER0_ADDRESS SOC_LF_TIMER0_ADDRESS -#define LF_TIMER0_OFFSET SOC_LF_TIMER0_OFFSET -#define LF_TIMER0_TARGET_MSB SOC_LF_TIMER0_TARGET_MSB -#define LF_TIMER0_TARGET_LSB SOC_LF_TIMER0_TARGET_LSB -#define LF_TIMER0_TARGET_MASK SOC_LF_TIMER0_TARGET_MASK -#define LF_TIMER0_TARGET_GET(x) SOC_LF_TIMER0_TARGET_GET(x) -#define LF_TIMER0_TARGET_SET(x) SOC_LF_TIMER0_TARGET_SET(x) -#define LF_TIMER_COUNT0_ADDRESS SOC_LF_TIMER_COUNT0_ADDRESS -#define LF_TIMER_COUNT0_OFFSET SOC_LF_TIMER_COUNT0_OFFSET -#define LF_TIMER_COUNT0_VALUE_MSB SOC_LF_TIMER_COUNT0_VALUE_MSB -#define LF_TIMER_COUNT0_VALUE_LSB SOC_LF_TIMER_COUNT0_VALUE_LSB -#define LF_TIMER_COUNT0_VALUE_MASK SOC_LF_TIMER_COUNT0_VALUE_MASK -#define LF_TIMER_COUNT0_VALUE_GET(x) SOC_LF_TIMER_COUNT0_VALUE_GET(x) -#define LF_TIMER_COUNT0_VALUE_SET(x) SOC_LF_TIMER_COUNT0_VALUE_SET(x) -#define LF_TIMER_CONTROL0_ADDRESS SOC_LF_TIMER_CONTROL0_ADDRESS -#define LF_TIMER_CONTROL0_OFFSET SOC_LF_TIMER_CONTROL0_OFFSET -#define LF_TIMER_CONTROL0_ENABLE_MSB SOC_LF_TIMER_CONTROL0_ENABLE_MSB -#define LF_TIMER_CONTROL0_ENABLE_LSB SOC_LF_TIMER_CONTROL0_ENABLE_LSB -#define LF_TIMER_CONTROL0_ENABLE_MASK SOC_LF_TIMER_CONTROL0_ENABLE_MASK -#define LF_TIMER_CONTROL0_ENABLE_GET(x) SOC_LF_TIMER_CONTROL0_ENABLE_GET(x) -#define LF_TIMER_CONTROL0_ENABLE_SET(x) SOC_LF_TIMER_CONTROL0_ENABLE_SET(x) -#define LF_TIMER_CONTROL0_AUTO_RESTART_MSB SOC_LF_TIMER_CONTROL0_AUTO_RESTART_MSB -#define LF_TIMER_CONTROL0_AUTO_RESTART_LSB SOC_LF_TIMER_CONTROL0_AUTO_RESTART_LSB -#define LF_TIMER_CONTROL0_AUTO_RESTART_MASK SOC_LF_TIMER_CONTROL0_AUTO_RESTART_MASK -#define LF_TIMER_CONTROL0_AUTO_RESTART_GET(x) SOC_LF_TIMER_CONTROL0_AUTO_RESTART_GET(x) -#define LF_TIMER_CONTROL0_AUTO_RESTART_SET(x) SOC_LF_TIMER_CONTROL0_AUTO_RESTART_SET(x) -#define LF_TIMER_CONTROL0_RESET_MSB SOC_LF_TIMER_CONTROL0_RESET_MSB -#define LF_TIMER_CONTROL0_RESET_LSB SOC_LF_TIMER_CONTROL0_RESET_LSB -#define LF_TIMER_CONTROL0_RESET_MASK SOC_LF_TIMER_CONTROL0_RESET_MASK -#define LF_TIMER_CONTROL0_RESET_GET(x) SOC_LF_TIMER_CONTROL0_RESET_GET(x) -#define LF_TIMER_CONTROL0_RESET_SET(x) SOC_LF_TIMER_CONTROL0_RESET_SET(x) -#define LF_TIMER_STATUS0_ADDRESS SOC_LF_TIMER_STATUS0_ADDRESS -#define LF_TIMER_STATUS0_OFFSET SOC_LF_TIMER_STATUS0_OFFSET -#define LF_TIMER_STATUS0_INTERRUPT_MSB SOC_LF_TIMER_STATUS0_INTERRUPT_MSB -#define LF_TIMER_STATUS0_INTERRUPT_LSB SOC_LF_TIMER_STATUS0_INTERRUPT_LSB -#define LF_TIMER_STATUS0_INTERRUPT_MASK SOC_LF_TIMER_STATUS0_INTERRUPT_MASK -#define LF_TIMER_STATUS0_INTERRUPT_GET(x) SOC_LF_TIMER_STATUS0_INTERRUPT_GET(x) -#define LF_TIMER_STATUS0_INTERRUPT_SET(x) SOC_LF_TIMER_STATUS0_INTERRUPT_SET(x) -#define LF_TIMER1_ADDRESS SOC_LF_TIMER1_ADDRESS -#define LF_TIMER1_OFFSET SOC_LF_TIMER1_OFFSET -#define LF_TIMER1_TARGET_MSB SOC_LF_TIMER1_TARGET_MSB -#define LF_TIMER1_TARGET_LSB SOC_LF_TIMER1_TARGET_LSB -#define LF_TIMER1_TARGET_MASK SOC_LF_TIMER1_TARGET_MASK -#define LF_TIMER1_TARGET_GET(x) SOC_LF_TIMER1_TARGET_GET(x) -#define LF_TIMER1_TARGET_SET(x) SOC_LF_TIMER1_TARGET_SET(x) -#define LF_TIMER_COUNT1_ADDRESS SOC_LF_TIMER_COUNT1_ADDRESS -#define LF_TIMER_COUNT1_OFFSET SOC_LF_TIMER_COUNT1_OFFSET -#define LF_TIMER_COUNT1_VALUE_MSB SOC_LF_TIMER_COUNT1_VALUE_MSB -#define LF_TIMER_COUNT1_VALUE_LSB SOC_LF_TIMER_COUNT1_VALUE_LSB -#define LF_TIMER_COUNT1_VALUE_MASK SOC_LF_TIMER_COUNT1_VALUE_MASK -#define LF_TIMER_COUNT1_VALUE_GET(x) SOC_LF_TIMER_COUNT1_VALUE_GET(x) -#define LF_TIMER_COUNT1_VALUE_SET(x) SOC_LF_TIMER_COUNT1_VALUE_SET(x) -#define LF_TIMER_CONTROL1_ADDRESS SOC_LF_TIMER_CONTROL1_ADDRESS -#define LF_TIMER_CONTROL1_OFFSET SOC_LF_TIMER_CONTROL1_OFFSET -#define LF_TIMER_CONTROL1_ENABLE_MSB SOC_LF_TIMER_CONTROL1_ENABLE_MSB -#define LF_TIMER_CONTROL1_ENABLE_LSB SOC_LF_TIMER_CONTROL1_ENABLE_LSB -#define LF_TIMER_CONTROL1_ENABLE_MASK SOC_LF_TIMER_CONTROL1_ENABLE_MASK -#define LF_TIMER_CONTROL1_ENABLE_GET(x) SOC_LF_TIMER_CONTROL1_ENABLE_GET(x) -#define LF_TIMER_CONTROL1_ENABLE_SET(x) SOC_LF_TIMER_CONTROL1_ENABLE_SET(x) -#define LF_TIMER_CONTROL1_AUTO_RESTART_MSB SOC_LF_TIMER_CONTROL1_AUTO_RESTART_MSB -#define LF_TIMER_CONTROL1_AUTO_RESTART_LSB SOC_LF_TIMER_CONTROL1_AUTO_RESTART_LSB -#define LF_TIMER_CONTROL1_AUTO_RESTART_MASK SOC_LF_TIMER_CONTROL1_AUTO_RESTART_MASK -#define LF_TIMER_CONTROL1_AUTO_RESTART_GET(x) SOC_LF_TIMER_CONTROL1_AUTO_RESTART_GET(x) -#define LF_TIMER_CONTROL1_AUTO_RESTART_SET(x) SOC_LF_TIMER_CONTROL1_AUTO_RESTART_SET(x) -#define LF_TIMER_CONTROL1_RESET_MSB SOC_LF_TIMER_CONTROL1_RESET_MSB -#define LF_TIMER_CONTROL1_RESET_LSB SOC_LF_TIMER_CONTROL1_RESET_LSB -#define LF_TIMER_CONTROL1_RESET_MASK SOC_LF_TIMER_CONTROL1_RESET_MASK -#define LF_TIMER_CONTROL1_RESET_GET(x) SOC_LF_TIMER_CONTROL1_RESET_GET(x) -#define LF_TIMER_CONTROL1_RESET_SET(x) SOC_LF_TIMER_CONTROL1_RESET_SET(x) -#define LF_TIMER_STATUS1_ADDRESS SOC_LF_TIMER_STATUS1_ADDRESS -#define LF_TIMER_STATUS1_OFFSET SOC_LF_TIMER_STATUS1_OFFSET -#define LF_TIMER_STATUS1_INTERRUPT_MSB SOC_LF_TIMER_STATUS1_INTERRUPT_MSB -#define LF_TIMER_STATUS1_INTERRUPT_LSB SOC_LF_TIMER_STATUS1_INTERRUPT_LSB -#define LF_TIMER_STATUS1_INTERRUPT_MASK SOC_LF_TIMER_STATUS1_INTERRUPT_MASK -#define LF_TIMER_STATUS1_INTERRUPT_GET(x) SOC_LF_TIMER_STATUS1_INTERRUPT_GET(x) -#define LF_TIMER_STATUS1_INTERRUPT_SET(x) SOC_LF_TIMER_STATUS1_INTERRUPT_SET(x) -#define LF_TIMER2_ADDRESS SOC_LF_TIMER2_ADDRESS -#define LF_TIMER2_OFFSET SOC_LF_TIMER2_OFFSET -#define LF_TIMER2_TARGET_MSB SOC_LF_TIMER2_TARGET_MSB -#define LF_TIMER2_TARGET_LSB SOC_LF_TIMER2_TARGET_LSB -#define LF_TIMER2_TARGET_MASK SOC_LF_TIMER2_TARGET_MASK -#define LF_TIMER2_TARGET_GET(x) SOC_LF_TIMER2_TARGET_GET(x) -#define LF_TIMER2_TARGET_SET(x) SOC_LF_TIMER2_TARGET_SET(x) -#define LF_TIMER_COUNT2_ADDRESS SOC_LF_TIMER_COUNT2_ADDRESS -#define LF_TIMER_COUNT2_OFFSET SOC_LF_TIMER_COUNT2_OFFSET -#define LF_TIMER_COUNT2_VALUE_MSB SOC_LF_TIMER_COUNT2_VALUE_MSB -#define LF_TIMER_COUNT2_VALUE_LSB SOC_LF_TIMER_COUNT2_VALUE_LSB -#define LF_TIMER_COUNT2_VALUE_MASK SOC_LF_TIMER_COUNT2_VALUE_MASK -#define LF_TIMER_COUNT2_VALUE_GET(x) SOC_LF_TIMER_COUNT2_VALUE_GET(x) -#define LF_TIMER_COUNT2_VALUE_SET(x) SOC_LF_TIMER_COUNT2_VALUE_SET(x) -#define LF_TIMER_CONTROL2_ADDRESS SOC_LF_TIMER_CONTROL2_ADDRESS -#define LF_TIMER_CONTROL2_OFFSET SOC_LF_TIMER_CONTROL2_OFFSET -#define LF_TIMER_CONTROL2_ENABLE_MSB SOC_LF_TIMER_CONTROL2_ENABLE_MSB -#define LF_TIMER_CONTROL2_ENABLE_LSB SOC_LF_TIMER_CONTROL2_ENABLE_LSB -#define LF_TIMER_CONTROL2_ENABLE_MASK SOC_LF_TIMER_CONTROL2_ENABLE_MASK -#define LF_TIMER_CONTROL2_ENABLE_GET(x) SOC_LF_TIMER_CONTROL2_ENABLE_GET(x) -#define LF_TIMER_CONTROL2_ENABLE_SET(x) SOC_LF_TIMER_CONTROL2_ENABLE_SET(x) -#define LF_TIMER_CONTROL2_AUTO_RESTART_MSB SOC_LF_TIMER_CONTROL2_AUTO_RESTART_MSB -#define LF_TIMER_CONTROL2_AUTO_RESTART_LSB SOC_LF_TIMER_CONTROL2_AUTO_RESTART_LSB -#define LF_TIMER_CONTROL2_AUTO_RESTART_MASK SOC_LF_TIMER_CONTROL2_AUTO_RESTART_MASK -#define LF_TIMER_CONTROL2_AUTO_RESTART_GET(x) SOC_LF_TIMER_CONTROL2_AUTO_RESTART_GET(x) -#define LF_TIMER_CONTROL2_AUTO_RESTART_SET(x) SOC_LF_TIMER_CONTROL2_AUTO_RESTART_SET(x) -#define LF_TIMER_CONTROL2_RESET_MSB SOC_LF_TIMER_CONTROL2_RESET_MSB -#define LF_TIMER_CONTROL2_RESET_LSB SOC_LF_TIMER_CONTROL2_RESET_LSB -#define LF_TIMER_CONTROL2_RESET_MASK SOC_LF_TIMER_CONTROL2_RESET_MASK -#define LF_TIMER_CONTROL2_RESET_GET(x) SOC_LF_TIMER_CONTROL2_RESET_GET(x) -#define LF_TIMER_CONTROL2_RESET_SET(x) SOC_LF_TIMER_CONTROL2_RESET_SET(x) -#define LF_TIMER_STATUS2_ADDRESS SOC_LF_TIMER_STATUS2_ADDRESS -#define LF_TIMER_STATUS2_OFFSET SOC_LF_TIMER_STATUS2_OFFSET -#define LF_TIMER_STATUS2_INTERRUPT_MSB SOC_LF_TIMER_STATUS2_INTERRUPT_MSB -#define LF_TIMER_STATUS2_INTERRUPT_LSB SOC_LF_TIMER_STATUS2_INTERRUPT_LSB -#define LF_TIMER_STATUS2_INTERRUPT_MASK SOC_LF_TIMER_STATUS2_INTERRUPT_MASK -#define LF_TIMER_STATUS2_INTERRUPT_GET(x) SOC_LF_TIMER_STATUS2_INTERRUPT_GET(x) -#define LF_TIMER_STATUS2_INTERRUPT_SET(x) SOC_LF_TIMER_STATUS2_INTERRUPT_SET(x) -#define LF_TIMER3_ADDRESS SOC_LF_TIMER3_ADDRESS -#define LF_TIMER3_OFFSET SOC_LF_TIMER3_OFFSET -#define LF_TIMER3_TARGET_MSB SOC_LF_TIMER3_TARGET_MSB -#define LF_TIMER3_TARGET_LSB SOC_LF_TIMER3_TARGET_LSB -#define LF_TIMER3_TARGET_MASK SOC_LF_TIMER3_TARGET_MASK -#define LF_TIMER3_TARGET_GET(x) SOC_LF_TIMER3_TARGET_GET(x) -#define LF_TIMER3_TARGET_SET(x) SOC_LF_TIMER3_TARGET_SET(x) -#define LF_TIMER_COUNT3_ADDRESS SOC_LF_TIMER_COUNT3_ADDRESS -#define LF_TIMER_COUNT3_OFFSET SOC_LF_TIMER_COUNT3_OFFSET -#define LF_TIMER_COUNT3_VALUE_MSB SOC_LF_TIMER_COUNT3_VALUE_MSB -#define LF_TIMER_COUNT3_VALUE_LSB SOC_LF_TIMER_COUNT3_VALUE_LSB -#define LF_TIMER_COUNT3_VALUE_MASK SOC_LF_TIMER_COUNT3_VALUE_MASK -#define LF_TIMER_COUNT3_VALUE_GET(x) SOC_LF_TIMER_COUNT3_VALUE_GET(x) -#define LF_TIMER_COUNT3_VALUE_SET(x) SOC_LF_TIMER_COUNT3_VALUE_SET(x) -#define LF_TIMER_CONTROL3_ADDRESS SOC_LF_TIMER_CONTROL3_ADDRESS -#define LF_TIMER_CONTROL3_OFFSET SOC_LF_TIMER_CONTROL3_OFFSET -#define LF_TIMER_CONTROL3_ENABLE_MSB SOC_LF_TIMER_CONTROL3_ENABLE_MSB -#define LF_TIMER_CONTROL3_ENABLE_LSB SOC_LF_TIMER_CONTROL3_ENABLE_LSB -#define LF_TIMER_CONTROL3_ENABLE_MASK SOC_LF_TIMER_CONTROL3_ENABLE_MASK -#define LF_TIMER_CONTROL3_ENABLE_GET(x) SOC_LF_TIMER_CONTROL3_ENABLE_GET(x) -#define LF_TIMER_CONTROL3_ENABLE_SET(x) SOC_LF_TIMER_CONTROL3_ENABLE_SET(x) -#define LF_TIMER_CONTROL3_AUTO_RESTART_MSB SOC_LF_TIMER_CONTROL3_AUTO_RESTART_MSB -#define LF_TIMER_CONTROL3_AUTO_RESTART_LSB SOC_LF_TIMER_CONTROL3_AUTO_RESTART_LSB -#define LF_TIMER_CONTROL3_AUTO_RESTART_MASK SOC_LF_TIMER_CONTROL3_AUTO_RESTART_MASK -#define LF_TIMER_CONTROL3_AUTO_RESTART_GET(x) SOC_LF_TIMER_CONTROL3_AUTO_RESTART_GET(x) -#define LF_TIMER_CONTROL3_AUTO_RESTART_SET(x) SOC_LF_TIMER_CONTROL3_AUTO_RESTART_SET(x) -#define LF_TIMER_CONTROL3_RESET_MSB SOC_LF_TIMER_CONTROL3_RESET_MSB -#define LF_TIMER_CONTROL3_RESET_LSB SOC_LF_TIMER_CONTROL3_RESET_LSB -#define LF_TIMER_CONTROL3_RESET_MASK SOC_LF_TIMER_CONTROL3_RESET_MASK -#define LF_TIMER_CONTROL3_RESET_GET(x) SOC_LF_TIMER_CONTROL3_RESET_GET(x) -#define LF_TIMER_CONTROL3_RESET_SET(x) SOC_LF_TIMER_CONTROL3_RESET_SET(x) -#define LF_TIMER_STATUS3_ADDRESS SOC_LF_TIMER_STATUS3_ADDRESS -#define LF_TIMER_STATUS3_OFFSET SOC_LF_TIMER_STATUS3_OFFSET -#define LF_TIMER_STATUS3_INTERRUPT_MSB SOC_LF_TIMER_STATUS3_INTERRUPT_MSB -#define LF_TIMER_STATUS3_INTERRUPT_LSB SOC_LF_TIMER_STATUS3_INTERRUPT_LSB -#define LF_TIMER_STATUS3_INTERRUPT_MASK SOC_LF_TIMER_STATUS3_INTERRUPT_MASK -#define LF_TIMER_STATUS3_INTERRUPT_GET(x) SOC_LF_TIMER_STATUS3_INTERRUPT_GET(x) -#define LF_TIMER_STATUS3_INTERRUPT_SET(x) SOC_LF_TIMER_STATUS3_INTERRUPT_SET(x) -#define HF_TIMER_ADDRESS SOC_HF_TIMER_ADDRESS -#define HF_TIMER_OFFSET SOC_HF_TIMER_OFFSET -#define HF_TIMER_TARGET_MSB SOC_HF_TIMER_TARGET_MSB -#define HF_TIMER_TARGET_LSB SOC_HF_TIMER_TARGET_LSB -#define HF_TIMER_TARGET_MASK SOC_HF_TIMER_TARGET_MASK -#define HF_TIMER_TARGET_GET(x) SOC_HF_TIMER_TARGET_GET(x) -#define HF_TIMER_TARGET_SET(x) SOC_HF_TIMER_TARGET_SET(x) -#define HF_TIMER_COUNT_ADDRESS SOC_HF_TIMER_COUNT_ADDRESS -#define HF_TIMER_COUNT_OFFSET SOC_HF_TIMER_COUNT_OFFSET -#define HF_TIMER_COUNT_VALUE_MSB SOC_HF_TIMER_COUNT_VALUE_MSB -#define HF_TIMER_COUNT_VALUE_LSB SOC_HF_TIMER_COUNT_VALUE_LSB -#define HF_TIMER_COUNT_VALUE_MASK SOC_HF_TIMER_COUNT_VALUE_MASK -#define HF_TIMER_COUNT_VALUE_GET(x) SOC_HF_TIMER_COUNT_VALUE_GET(x) -#define HF_TIMER_COUNT_VALUE_SET(x) SOC_HF_TIMER_COUNT_VALUE_SET(x) -#define HF_LF_COUNT_ADDRESS SOC_HF_LF_COUNT_ADDRESS -#define HF_LF_COUNT_OFFSET SOC_HF_LF_COUNT_OFFSET -#define HF_LF_COUNT_VALUE_MSB SOC_HF_LF_COUNT_VALUE_MSB -#define HF_LF_COUNT_VALUE_LSB SOC_HF_LF_COUNT_VALUE_LSB -#define HF_LF_COUNT_VALUE_MASK SOC_HF_LF_COUNT_VALUE_MASK -#define HF_LF_COUNT_VALUE_GET(x) SOC_HF_LF_COUNT_VALUE_GET(x) -#define HF_LF_COUNT_VALUE_SET(x) SOC_HF_LF_COUNT_VALUE_SET(x) -#define HF_TIMER_CONTROL_ADDRESS SOC_HF_TIMER_CONTROL_ADDRESS -#define HF_TIMER_CONTROL_OFFSET SOC_HF_TIMER_CONTROL_OFFSET -#define HF_TIMER_CONTROL_ENABLE_MSB SOC_HF_TIMER_CONTROL_ENABLE_MSB -#define HF_TIMER_CONTROL_ENABLE_LSB SOC_HF_TIMER_CONTROL_ENABLE_LSB -#define HF_TIMER_CONTROL_ENABLE_MASK SOC_HF_TIMER_CONTROL_ENABLE_MASK -#define HF_TIMER_CONTROL_ENABLE_GET(x) SOC_HF_TIMER_CONTROL_ENABLE_GET(x) -#define HF_TIMER_CONTROL_ENABLE_SET(x) SOC_HF_TIMER_CONTROL_ENABLE_SET(x) -#define HF_TIMER_CONTROL_ON_MSB SOC_HF_TIMER_CONTROL_ON_MSB -#define HF_TIMER_CONTROL_ON_LSB SOC_HF_TIMER_CONTROL_ON_LSB -#define HF_TIMER_CONTROL_ON_MASK SOC_HF_TIMER_CONTROL_ON_MASK -#define HF_TIMER_CONTROL_ON_GET(x) SOC_HF_TIMER_CONTROL_ON_GET(x) -#define HF_TIMER_CONTROL_ON_SET(x) SOC_HF_TIMER_CONTROL_ON_SET(x) -#define HF_TIMER_CONTROL_AUTO_RESTART_MSB SOC_HF_TIMER_CONTROL_AUTO_RESTART_MSB -#define HF_TIMER_CONTROL_AUTO_RESTART_LSB SOC_HF_TIMER_CONTROL_AUTO_RESTART_LSB -#define HF_TIMER_CONTROL_AUTO_RESTART_MASK SOC_HF_TIMER_CONTROL_AUTO_RESTART_MASK -#define HF_TIMER_CONTROL_AUTO_RESTART_GET(x) SOC_HF_TIMER_CONTROL_AUTO_RESTART_GET(x) -#define HF_TIMER_CONTROL_AUTO_RESTART_SET(x) SOC_HF_TIMER_CONTROL_AUTO_RESTART_SET(x) -#define HF_TIMER_CONTROL_RESET_MSB SOC_HF_TIMER_CONTROL_RESET_MSB -#define HF_TIMER_CONTROL_RESET_LSB SOC_HF_TIMER_CONTROL_RESET_LSB -#define HF_TIMER_CONTROL_RESET_MASK SOC_HF_TIMER_CONTROL_RESET_MASK -#define HF_TIMER_CONTROL_RESET_GET(x) SOC_HF_TIMER_CONTROL_RESET_GET(x) -#define HF_TIMER_CONTROL_RESET_SET(x) SOC_HF_TIMER_CONTROL_RESET_SET(x) -#define HF_TIMER_STATUS_ADDRESS SOC_HF_TIMER_STATUS_ADDRESS -#define HF_TIMER_STATUS_OFFSET SOC_HF_TIMER_STATUS_OFFSET -#define HF_TIMER_STATUS_INTERRUPT_MSB SOC_HF_TIMER_STATUS_INTERRUPT_MSB -#define HF_TIMER_STATUS_INTERRUPT_LSB SOC_HF_TIMER_STATUS_INTERRUPT_LSB -#define HF_TIMER_STATUS_INTERRUPT_MASK SOC_HF_TIMER_STATUS_INTERRUPT_MASK -#define HF_TIMER_STATUS_INTERRUPT_GET(x) SOC_HF_TIMER_STATUS_INTERRUPT_GET(x) -#define HF_TIMER_STATUS_INTERRUPT_SET(x) SOC_HF_TIMER_STATUS_INTERRUPT_SET(x) -#define RTC_CONTROL_ADDRESS SOC_RTC_CONTROL_ADDRESS -#define RTC_CONTROL_OFFSET SOC_RTC_CONTROL_OFFSET -#define RTC_CONTROL_ENABLE_MSB SOC_RTC_CONTROL_ENABLE_MSB -#define RTC_CONTROL_ENABLE_LSB SOC_RTC_CONTROL_ENABLE_LSB -#define RTC_CONTROL_ENABLE_MASK SOC_RTC_CONTROL_ENABLE_MASK -#define RTC_CONTROL_ENABLE_GET(x) SOC_RTC_CONTROL_ENABLE_GET(x) -#define RTC_CONTROL_ENABLE_SET(x) SOC_RTC_CONTROL_ENABLE_SET(x) -#define RTC_CONTROL_LOAD_RTC_MSB SOC_RTC_CONTROL_LOAD_RTC_MSB -#define RTC_CONTROL_LOAD_RTC_LSB SOC_RTC_CONTROL_LOAD_RTC_LSB -#define RTC_CONTROL_LOAD_RTC_MASK SOC_RTC_CONTROL_LOAD_RTC_MASK -#define RTC_CONTROL_LOAD_RTC_GET(x) SOC_RTC_CONTROL_LOAD_RTC_GET(x) -#define RTC_CONTROL_LOAD_RTC_SET(x) SOC_RTC_CONTROL_LOAD_RTC_SET(x) -#define RTC_CONTROL_LOAD_ALARM_MSB SOC_RTC_CONTROL_LOAD_ALARM_MSB -#define RTC_CONTROL_LOAD_ALARM_LSB SOC_RTC_CONTROL_LOAD_ALARM_LSB -#define RTC_CONTROL_LOAD_ALARM_MASK SOC_RTC_CONTROL_LOAD_ALARM_MASK -#define RTC_CONTROL_LOAD_ALARM_GET(x) SOC_RTC_CONTROL_LOAD_ALARM_GET(x) -#define RTC_CONTROL_LOAD_ALARM_SET(x) SOC_RTC_CONTROL_LOAD_ALARM_SET(x) -#define RTC_TIME_ADDRESS SOC_RTC_TIME_ADDRESS -#define RTC_TIME_OFFSET SOC_RTC_TIME_OFFSET -#define RTC_TIME_WEEK_DAY_MSB SOC_RTC_TIME_WEEK_DAY_MSB -#define RTC_TIME_WEEK_DAY_LSB SOC_RTC_TIME_WEEK_DAY_LSB -#define RTC_TIME_WEEK_DAY_MASK SOC_RTC_TIME_WEEK_DAY_MASK -#define RTC_TIME_WEEK_DAY_GET(x) SOC_RTC_TIME_WEEK_DAY_GET(x) -#define RTC_TIME_WEEK_DAY_SET(x) SOC_RTC_TIME_WEEK_DAY_SET(x) -#define RTC_TIME_HOUR_MSB SOC_RTC_TIME_HOUR_MSB -#define RTC_TIME_HOUR_LSB SOC_RTC_TIME_HOUR_LSB -#define RTC_TIME_HOUR_MASK SOC_RTC_TIME_HOUR_MASK -#define RTC_TIME_HOUR_GET(x) SOC_RTC_TIME_HOUR_GET(x) -#define RTC_TIME_HOUR_SET(x) SOC_RTC_TIME_HOUR_SET(x) -#define RTC_TIME_MINUTE_MSB SOC_RTC_TIME_MINUTE_MSB -#define RTC_TIME_MINUTE_LSB SOC_RTC_TIME_MINUTE_LSB -#define RTC_TIME_MINUTE_MASK SOC_RTC_TIME_MINUTE_MASK -#define RTC_TIME_MINUTE_GET(x) SOC_RTC_TIME_MINUTE_GET(x) -#define RTC_TIME_MINUTE_SET(x) SOC_RTC_TIME_MINUTE_SET(x) -#define RTC_TIME_SECOND_MSB SOC_RTC_TIME_SECOND_MSB -#define RTC_TIME_SECOND_LSB SOC_RTC_TIME_SECOND_LSB -#define RTC_TIME_SECOND_MASK SOC_RTC_TIME_SECOND_MASK -#define RTC_TIME_SECOND_GET(x) SOC_RTC_TIME_SECOND_GET(x) -#define RTC_TIME_SECOND_SET(x) SOC_RTC_TIME_SECOND_SET(x) -#define RTC_DATE_ADDRESS SOC_RTC_DATE_ADDRESS -#define RTC_DATE_OFFSET SOC_RTC_DATE_OFFSET -#define RTC_DATE_YEAR_MSB SOC_RTC_DATE_YEAR_MSB -#define RTC_DATE_YEAR_LSB SOC_RTC_DATE_YEAR_LSB -#define RTC_DATE_YEAR_MASK SOC_RTC_DATE_YEAR_MASK -#define RTC_DATE_YEAR_GET(x) SOC_RTC_DATE_YEAR_GET(x) -#define RTC_DATE_YEAR_SET(x) SOC_RTC_DATE_YEAR_SET(x) -#define RTC_DATE_MONTH_MSB SOC_RTC_DATE_MONTH_MSB -#define RTC_DATE_MONTH_LSB SOC_RTC_DATE_MONTH_LSB -#define RTC_DATE_MONTH_MASK SOC_RTC_DATE_MONTH_MASK -#define RTC_DATE_MONTH_GET(x) SOC_RTC_DATE_MONTH_GET(x) -#define RTC_DATE_MONTH_SET(x) SOC_RTC_DATE_MONTH_SET(x) -#define RTC_DATE_MONTH_DAY_MSB SOC_RTC_DATE_MONTH_DAY_MSB -#define RTC_DATE_MONTH_DAY_LSB SOC_RTC_DATE_MONTH_DAY_LSB -#define RTC_DATE_MONTH_DAY_MASK SOC_RTC_DATE_MONTH_DAY_MASK -#define RTC_DATE_MONTH_DAY_GET(x) SOC_RTC_DATE_MONTH_DAY_GET(x) -#define RTC_DATE_MONTH_DAY_SET(x) SOC_RTC_DATE_MONTH_DAY_SET(x) -#define RTC_SET_TIME_ADDRESS SOC_RTC_SET_TIME_ADDRESS -#define RTC_SET_TIME_OFFSET SOC_RTC_SET_TIME_OFFSET -#define RTC_SET_TIME_WEEK_DAY_MSB SOC_RTC_SET_TIME_WEEK_DAY_MSB -#define RTC_SET_TIME_WEEK_DAY_LSB SOC_RTC_SET_TIME_WEEK_DAY_LSB -#define RTC_SET_TIME_WEEK_DAY_MASK SOC_RTC_SET_TIME_WEEK_DAY_MASK -#define RTC_SET_TIME_WEEK_DAY_GET(x) SOC_RTC_SET_TIME_WEEK_DAY_GET(x) -#define RTC_SET_TIME_WEEK_DAY_SET(x) SOC_RTC_SET_TIME_WEEK_DAY_SET(x) -#define RTC_SET_TIME_HOUR_MSB SOC_RTC_SET_TIME_HOUR_MSB -#define RTC_SET_TIME_HOUR_LSB SOC_RTC_SET_TIME_HOUR_LSB -#define RTC_SET_TIME_HOUR_MASK SOC_RTC_SET_TIME_HOUR_MASK -#define RTC_SET_TIME_HOUR_GET(x) SOC_RTC_SET_TIME_HOUR_GET(x) -#define RTC_SET_TIME_HOUR_SET(x) SOC_RTC_SET_TIME_HOUR_SET(x) -#define RTC_SET_TIME_MINUTE_MSB SOC_RTC_SET_TIME_MINUTE_MSB -#define RTC_SET_TIME_MINUTE_LSB SOC_RTC_SET_TIME_MINUTE_LSB -#define RTC_SET_TIME_MINUTE_MASK SOC_RTC_SET_TIME_MINUTE_MASK -#define RTC_SET_TIME_MINUTE_GET(x) SOC_RTC_SET_TIME_MINUTE_GET(x) -#define RTC_SET_TIME_MINUTE_SET(x) SOC_RTC_SET_TIME_MINUTE_SET(x) -#define RTC_SET_TIME_SECOND_MSB SOC_RTC_SET_TIME_SECOND_MSB -#define RTC_SET_TIME_SECOND_LSB SOC_RTC_SET_TIME_SECOND_LSB -#define RTC_SET_TIME_SECOND_MASK SOC_RTC_SET_TIME_SECOND_MASK -#define RTC_SET_TIME_SECOND_GET(x) SOC_RTC_SET_TIME_SECOND_GET(x) -#define RTC_SET_TIME_SECOND_SET(x) SOC_RTC_SET_TIME_SECOND_SET(x) -#define RTC_SET_DATE_ADDRESS SOC_RTC_SET_DATE_ADDRESS -#define RTC_SET_DATE_OFFSET SOC_RTC_SET_DATE_OFFSET -#define RTC_SET_DATE_YEAR_MSB SOC_RTC_SET_DATE_YEAR_MSB -#define RTC_SET_DATE_YEAR_LSB SOC_RTC_SET_DATE_YEAR_LSB -#define RTC_SET_DATE_YEAR_MASK SOC_RTC_SET_DATE_YEAR_MASK -#define RTC_SET_DATE_YEAR_GET(x) SOC_RTC_SET_DATE_YEAR_GET(x) -#define RTC_SET_DATE_YEAR_SET(x) SOC_RTC_SET_DATE_YEAR_SET(x) -#define RTC_SET_DATE_MONTH_MSB SOC_RTC_SET_DATE_MONTH_MSB -#define RTC_SET_DATE_MONTH_LSB SOC_RTC_SET_DATE_MONTH_LSB -#define RTC_SET_DATE_MONTH_MASK SOC_RTC_SET_DATE_MONTH_MASK -#define RTC_SET_DATE_MONTH_GET(x) SOC_RTC_SET_DATE_MONTH_GET(x) -#define RTC_SET_DATE_MONTH_SET(x) SOC_RTC_SET_DATE_MONTH_SET(x) -#define RTC_SET_DATE_MONTH_DAY_MSB SOC_RTC_SET_DATE_MONTH_DAY_MSB -#define RTC_SET_DATE_MONTH_DAY_LSB SOC_RTC_SET_DATE_MONTH_DAY_LSB -#define RTC_SET_DATE_MONTH_DAY_MASK SOC_RTC_SET_DATE_MONTH_DAY_MASK -#define RTC_SET_DATE_MONTH_DAY_GET(x) SOC_RTC_SET_DATE_MONTH_DAY_GET(x) -#define RTC_SET_DATE_MONTH_DAY_SET(x) SOC_RTC_SET_DATE_MONTH_DAY_SET(x) -#define RTC_SET_ALARM_ADDRESS SOC_RTC_SET_ALARM_ADDRESS -#define RTC_SET_ALARM_OFFSET SOC_RTC_SET_ALARM_OFFSET -#define RTC_SET_ALARM_HOUR_MSB SOC_RTC_SET_ALARM_HOUR_MSB -#define RTC_SET_ALARM_HOUR_LSB SOC_RTC_SET_ALARM_HOUR_LSB -#define RTC_SET_ALARM_HOUR_MASK SOC_RTC_SET_ALARM_HOUR_MASK -#define RTC_SET_ALARM_HOUR_GET(x) SOC_RTC_SET_ALARM_HOUR_GET(x) -#define RTC_SET_ALARM_HOUR_SET(x) SOC_RTC_SET_ALARM_HOUR_SET(x) -#define RTC_SET_ALARM_MINUTE_MSB SOC_RTC_SET_ALARM_MINUTE_MSB -#define RTC_SET_ALARM_MINUTE_LSB SOC_RTC_SET_ALARM_MINUTE_LSB -#define RTC_SET_ALARM_MINUTE_MASK SOC_RTC_SET_ALARM_MINUTE_MASK -#define RTC_SET_ALARM_MINUTE_GET(x) SOC_RTC_SET_ALARM_MINUTE_GET(x) -#define RTC_SET_ALARM_MINUTE_SET(x) SOC_RTC_SET_ALARM_MINUTE_SET(x) -#define RTC_SET_ALARM_SECOND_MSB SOC_RTC_SET_ALARM_SECOND_MSB -#define RTC_SET_ALARM_SECOND_LSB SOC_RTC_SET_ALARM_SECOND_LSB -#define RTC_SET_ALARM_SECOND_MASK SOC_RTC_SET_ALARM_SECOND_MASK -#define RTC_SET_ALARM_SECOND_GET(x) SOC_RTC_SET_ALARM_SECOND_GET(x) -#define RTC_SET_ALARM_SECOND_SET(x) SOC_RTC_SET_ALARM_SECOND_SET(x) -#define RTC_CONFIG_ADDRESS SOC_RTC_CONFIG_ADDRESS -#define RTC_CONFIG_OFFSET SOC_RTC_CONFIG_OFFSET -#define RTC_CONFIG_BCD_MSB SOC_RTC_CONFIG_BCD_MSB -#define RTC_CONFIG_BCD_LSB SOC_RTC_CONFIG_BCD_LSB -#define RTC_CONFIG_BCD_MASK SOC_RTC_CONFIG_BCD_MASK -#define RTC_CONFIG_BCD_GET(x) SOC_RTC_CONFIG_BCD_GET(x) -#define RTC_CONFIG_BCD_SET(x) SOC_RTC_CONFIG_BCD_SET(x) -#define RTC_CONFIG_TWELVE_HOUR_MSB SOC_RTC_CONFIG_TWELVE_HOUR_MSB -#define RTC_CONFIG_TWELVE_HOUR_LSB SOC_RTC_CONFIG_TWELVE_HOUR_LSB -#define RTC_CONFIG_TWELVE_HOUR_MASK SOC_RTC_CONFIG_TWELVE_HOUR_MASK -#define RTC_CONFIG_TWELVE_HOUR_GET(x) SOC_RTC_CONFIG_TWELVE_HOUR_GET(x) -#define RTC_CONFIG_TWELVE_HOUR_SET(x) SOC_RTC_CONFIG_TWELVE_HOUR_SET(x) -#define RTC_CONFIG_DSE_MSB SOC_RTC_CONFIG_DSE_MSB -#define RTC_CONFIG_DSE_LSB SOC_RTC_CONFIG_DSE_LSB -#define RTC_CONFIG_DSE_MASK SOC_RTC_CONFIG_DSE_MASK -#define RTC_CONFIG_DSE_GET(x) SOC_RTC_CONFIG_DSE_GET(x) -#define RTC_CONFIG_DSE_SET(x) SOC_RTC_CONFIG_DSE_SET(x) -#define RTC_ALARM_STATUS_ADDRESS SOC_RTC_ALARM_STATUS_ADDRESS -#define RTC_ALARM_STATUS_OFFSET SOC_RTC_ALARM_STATUS_OFFSET -#define RTC_ALARM_STATUS_ENABLE_MSB SOC_RTC_ALARM_STATUS_ENABLE_MSB -#define RTC_ALARM_STATUS_ENABLE_LSB SOC_RTC_ALARM_STATUS_ENABLE_LSB -#define RTC_ALARM_STATUS_ENABLE_MASK SOC_RTC_ALARM_STATUS_ENABLE_MASK -#define RTC_ALARM_STATUS_ENABLE_GET(x) SOC_RTC_ALARM_STATUS_ENABLE_GET(x) -#define RTC_ALARM_STATUS_ENABLE_SET(x) SOC_RTC_ALARM_STATUS_ENABLE_SET(x) -#define RTC_ALARM_STATUS_INTERRUPT_MSB SOC_RTC_ALARM_STATUS_INTERRUPT_MSB -#define RTC_ALARM_STATUS_INTERRUPT_LSB SOC_RTC_ALARM_STATUS_INTERRUPT_LSB -#define RTC_ALARM_STATUS_INTERRUPT_MASK SOC_RTC_ALARM_STATUS_INTERRUPT_MASK -#define RTC_ALARM_STATUS_INTERRUPT_GET(x) SOC_RTC_ALARM_STATUS_INTERRUPT_GET(x) -#define RTC_ALARM_STATUS_INTERRUPT_SET(x) SOC_RTC_ALARM_STATUS_INTERRUPT_SET(x) -#define UART_WAKEUP_ADDRESS SOC_UART_WAKEUP_ADDRESS -#define UART_WAKEUP_OFFSET SOC_UART_WAKEUP_OFFSET -#define UART_WAKEUP_ENABLE_MSB SOC_UART_WAKEUP_ENABLE_MSB -#define UART_WAKEUP_ENABLE_LSB SOC_UART_WAKEUP_ENABLE_LSB -#define UART_WAKEUP_ENABLE_MASK SOC_UART_WAKEUP_ENABLE_MASK -#define UART_WAKEUP_ENABLE_GET(x) SOC_UART_WAKEUP_ENABLE_GET(x) -#define UART_WAKEUP_ENABLE_SET(x) SOC_UART_WAKEUP_ENABLE_SET(x) -#define RESET_CAUSE_ADDRESS SOC_RESET_CAUSE_ADDRESS -#define RESET_CAUSE_OFFSET SOC_RESET_CAUSE_OFFSET -#define RESET_CAUSE_LAST_MSB SOC_RESET_CAUSE_LAST_MSB -#define RESET_CAUSE_LAST_LSB SOC_RESET_CAUSE_LAST_LSB -#define RESET_CAUSE_LAST_MASK SOC_RESET_CAUSE_LAST_MASK -#define RESET_CAUSE_LAST_GET(x) SOC_RESET_CAUSE_LAST_GET(x) -#define RESET_CAUSE_LAST_SET(x) SOC_RESET_CAUSE_LAST_SET(x) -#define SYSTEM_SLEEP_ADDRESS SOC_SYSTEM_SLEEP_ADDRESS -#define SYSTEM_SLEEP_OFFSET SOC_SYSTEM_SLEEP_OFFSET -#define SYSTEM_SLEEP_MCI_MSB SOC_SYSTEM_SLEEP_MCI_MSB -#define SYSTEM_SLEEP_MCI_LSB SOC_SYSTEM_SLEEP_MCI_LSB -#define SYSTEM_SLEEP_MCI_MASK SOC_SYSTEM_SLEEP_MCI_MASK -#define SYSTEM_SLEEP_MCI_GET(x) SOC_SYSTEM_SLEEP_MCI_GET(x) -#define SYSTEM_SLEEP_MCI_SET(x) SOC_SYSTEM_SLEEP_MCI_SET(x) -#define SYSTEM_SLEEP_HOST_IF_MSB SOC_SYSTEM_SLEEP_HOST_IF_MSB -#define SYSTEM_SLEEP_HOST_IF_LSB SOC_SYSTEM_SLEEP_HOST_IF_LSB -#define SYSTEM_SLEEP_HOST_IF_MASK SOC_SYSTEM_SLEEP_HOST_IF_MASK -#define SYSTEM_SLEEP_HOST_IF_GET(x) SOC_SYSTEM_SLEEP_HOST_IF_GET(x) -#define SYSTEM_SLEEP_HOST_IF_SET(x) SOC_SYSTEM_SLEEP_HOST_IF_SET(x) -#define SYSTEM_SLEEP_MBOX_MSB SOC_SYSTEM_SLEEP_MBOX_MSB -#define SYSTEM_SLEEP_MBOX_LSB SOC_SYSTEM_SLEEP_MBOX_LSB -#define SYSTEM_SLEEP_MBOX_MASK SOC_SYSTEM_SLEEP_MBOX_MASK -#define SYSTEM_SLEEP_MBOX_GET(x) SOC_SYSTEM_SLEEP_MBOX_GET(x) -#define SYSTEM_SLEEP_MBOX_SET(x) SOC_SYSTEM_SLEEP_MBOX_SET(x) -#define SYSTEM_SLEEP_MAC_IF_MSB SOC_SYSTEM_SLEEP_MAC_IF_MSB -#define SYSTEM_SLEEP_MAC_IF_LSB SOC_SYSTEM_SLEEP_MAC_IF_LSB -#define SYSTEM_SLEEP_MAC_IF_MASK SOC_SYSTEM_SLEEP_MAC_IF_MASK -#define SYSTEM_SLEEP_MAC_IF_GET(x) SOC_SYSTEM_SLEEP_MAC_IF_GET(x) -#define SYSTEM_SLEEP_MAC_IF_SET(x) SOC_SYSTEM_SLEEP_MAC_IF_SET(x) -#define SYSTEM_SLEEP_LIGHT_MSB SOC_SYSTEM_SLEEP_LIGHT_MSB -#define SYSTEM_SLEEP_LIGHT_LSB SOC_SYSTEM_SLEEP_LIGHT_LSB -#define SYSTEM_SLEEP_LIGHT_MASK SOC_SYSTEM_SLEEP_LIGHT_MASK -#define SYSTEM_SLEEP_LIGHT_GET(x) SOC_SYSTEM_SLEEP_LIGHT_GET(x) -#define SYSTEM_SLEEP_LIGHT_SET(x) SOC_SYSTEM_SLEEP_LIGHT_SET(x) -#define SYSTEM_SLEEP_DISABLE_MSB SOC_SYSTEM_SLEEP_DISABLE_MSB -#define SYSTEM_SLEEP_DISABLE_LSB SOC_SYSTEM_SLEEP_DISABLE_LSB -#define SYSTEM_SLEEP_DISABLE_MASK SOC_SYSTEM_SLEEP_DISABLE_MASK -#define SYSTEM_SLEEP_DISABLE_GET(x) SOC_SYSTEM_SLEEP_DISABLE_GET(x) -#define SYSTEM_SLEEP_DISABLE_SET(x) SOC_SYSTEM_SLEEP_DISABLE_SET(x) -#define SDIO_WRAPPER_ADDRESS SOC_SDIO_WRAPPER_ADDRESS -#define SDIO_WRAPPER_OFFSET SOC_SDIO_WRAPPER_OFFSET -#define SDIO_WRAPPER_SLEEP_MSB SOC_SDIO_WRAPPER_SLEEP_MSB -#define SDIO_WRAPPER_SLEEP_LSB SOC_SDIO_WRAPPER_SLEEP_LSB -#define SDIO_WRAPPER_SLEEP_MASK SOC_SDIO_WRAPPER_SLEEP_MASK -#define SDIO_WRAPPER_SLEEP_GET(x) SOC_SDIO_WRAPPER_SLEEP_GET(x) -#define SDIO_WRAPPER_SLEEP_SET(x) SOC_SDIO_WRAPPER_SLEEP_SET(x) -#define SDIO_WRAPPER_WAKEUP_MSB SOC_SDIO_WRAPPER_WAKEUP_MSB -#define SDIO_WRAPPER_WAKEUP_LSB SOC_SDIO_WRAPPER_WAKEUP_LSB -#define SDIO_WRAPPER_WAKEUP_MASK SOC_SDIO_WRAPPER_WAKEUP_MASK -#define SDIO_WRAPPER_WAKEUP_GET(x) SOC_SDIO_WRAPPER_WAKEUP_GET(x) -#define SDIO_WRAPPER_WAKEUP_SET(x) SOC_SDIO_WRAPPER_WAKEUP_SET(x) -#define SDIO_WRAPPER_SOC_ON_MSB SOC_SDIO_WRAPPER_SOC_ON_MSB -#define SDIO_WRAPPER_SOC_ON_LSB SOC_SDIO_WRAPPER_SOC_ON_LSB -#define SDIO_WRAPPER_SOC_ON_MASK SOC_SDIO_WRAPPER_SOC_ON_MASK -#define SDIO_WRAPPER_SOC_ON_GET(x) SOC_SDIO_WRAPPER_SOC_ON_GET(x) -#define SDIO_WRAPPER_SOC_ON_SET(x) SOC_SDIO_WRAPPER_SOC_ON_SET(x) -#define SDIO_WRAPPER_ON_MSB SOC_SDIO_WRAPPER_ON_MSB -#define SDIO_WRAPPER_ON_LSB SOC_SDIO_WRAPPER_ON_LSB -#define SDIO_WRAPPER_ON_MASK SOC_SDIO_WRAPPER_ON_MASK -#define SDIO_WRAPPER_ON_GET(x) SOC_SDIO_WRAPPER_ON_GET(x) -#define SDIO_WRAPPER_ON_SET(x) SOC_SDIO_WRAPPER_ON_SET(x) -#define INT_STATUS1_ADDRESS SOC_INT_STATUS1_ADDRESS -#define INT_STATUS1_OFFSET SOC_INT_STATUS1_OFFSET -#define INT_STATUS1_I2S_1_MSB SOC_INT_STATUS1_I2S_1_MSB -#define INT_STATUS1_I2S_1_LSB SOC_INT_STATUS1_I2S_1_LSB -#define INT_STATUS1_I2S_1_MASK SOC_INT_STATUS1_I2S_1_MASK -#define INT_STATUS1_I2S_1_GET(x) SOC_INT_STATUS1_I2S_1_GET(x) -#define INT_STATUS1_I2S_1_SET(x) SOC_INT_STATUS1_I2S_1_SET(x) -#define INT_STATUS1_I2S_MSB SOC_INT_STATUS1_I2S_MSB -#define INT_STATUS1_I2S_LSB SOC_INT_STATUS1_I2S_LSB -#define INT_STATUS1_I2S_MASK SOC_INT_STATUS1_I2S_MASK -#define INT_STATUS1_I2S_GET(x) SOC_INT_STATUS1_I2S_GET(x) -#define INT_STATUS1_I2S_SET(x) SOC_INT_STATUS1_I2S_SET(x) -#define INT_STATUS1_MDIO_MSB SOC_INT_STATUS1_MDIO_MSB -#define INT_STATUS1_MDIO_LSB SOC_INT_STATUS1_MDIO_LSB -#define INT_STATUS1_MDIO_MASK SOC_INT_STATUS1_MDIO_MASK -#define INT_STATUS1_MDIO_GET(x) SOC_INT_STATUS1_MDIO_GET(x) -#define INT_STATUS1_MDIO_SET(x) SOC_INT_STATUS1_MDIO_SET(x) -#define INT_STATUS1_GMAC_MSB SOC_INT_STATUS1_GMAC_MSB -#define INT_STATUS1_GMAC_LSB SOC_INT_STATUS1_GMAC_LSB -#define INT_STATUS1_GMAC_MASK SOC_INT_STATUS1_GMAC_MASK -#define INT_STATUS1_GMAC_GET(x) SOC_INT_STATUS1_GMAC_GET(x) -#define INT_STATUS1_GMAC_SET(x) SOC_INT_STATUS1_GMAC_SET(x) -#define INT_STATUS1_I2C_S_MSB SOC_INT_STATUS1_I2C_S_MSB -#define INT_STATUS1_I2C_S_LSB SOC_INT_STATUS1_I2C_S_LSB -#define INT_STATUS1_I2C_S_MASK SOC_INT_STATUS1_I2C_S_MASK -#define INT_STATUS1_I2C_S_GET(x) SOC_INT_STATUS1_I2C_S_GET(x) -#define INT_STATUS1_I2C_S_SET(x) SOC_INT_STATUS1_I2C_S_SET(x) -#define INT_STATUS1_CKSUM_MSB SOC_INT_STATUS1_CKSUM_MSB -#define INT_STATUS1_CKSUM_LSB SOC_INT_STATUS1_CKSUM_LSB -#define INT_STATUS1_CKSUM_MASK SOC_INT_STATUS1_CKSUM_MASK -#define INT_STATUS1_CKSUM_GET(x) SOC_INT_STATUS1_CKSUM_GET(x) -#define INT_STATUS1_CKSUM_SET(x) SOC_INT_STATUS1_CKSUM_SET(x) -#define INT_STATUS1_MAC_4_MSB SOC_INT_STATUS1_MAC_4_MSB -#define INT_STATUS1_MAC_4_LSB SOC_INT_STATUS1_MAC_4_LSB -#define INT_STATUS1_MAC_4_MASK SOC_INT_STATUS1_MAC_4_MASK -#define INT_STATUS1_MAC_4_GET(x) SOC_INT_STATUS1_MAC_4_GET(x) -#define INT_STATUS1_MAC_4_SET(x) SOC_INT_STATUS1_MAC_4_SET(x) -#define INT_STATUS1_MAC_3_MSB SOC_INT_STATUS1_MAC_3_MSB -#define INT_STATUS1_MAC_3_LSB SOC_INT_STATUS1_MAC_3_LSB -#define INT_STATUS1_MAC_3_MASK SOC_INT_STATUS1_MAC_3_MASK -#define INT_STATUS1_MAC_3_GET(x) SOC_INT_STATUS1_MAC_3_GET(x) -#define INT_STATUS1_MAC_3_SET(x) SOC_INT_STATUS1_MAC_3_SET(x) -#define INT_STATUS1_MAC_2_MSB SOC_INT_STATUS1_MAC_2_MSB -#define INT_STATUS1_MAC_2_LSB SOC_INT_STATUS1_MAC_2_LSB -#define INT_STATUS1_MAC_2_MASK SOC_INT_STATUS1_MAC_2_MASK -#define INT_STATUS1_MAC_2_GET(x) SOC_INT_STATUS1_MAC_2_GET(x) -#define INT_STATUS1_MAC_2_SET(x) SOC_INT_STATUS1_MAC_2_SET(x) -#define INT_STATUS1_MAC_1_MSB SOC_INT_STATUS1_MAC_1_MSB -#define INT_STATUS1_MAC_1_LSB SOC_INT_STATUS1_MAC_1_LSB -#define INT_STATUS1_MAC_1_MASK SOC_INT_STATUS1_MAC_1_MASK -#define INT_STATUS1_MAC_1_GET(x) SOC_INT_STATUS1_MAC_1_GET(x) -#define INT_STATUS1_MAC_1_SET(x) SOC_INT_STATUS1_MAC_1_SET(x) -#define LPO_CAL_TIME_ADDRESS SOC_LPO_CAL_TIME_ADDRESS -#define LPO_CAL_TIME_OFFSET SOC_LPO_CAL_TIME_OFFSET -#define LPO_CAL_TIME_LENGTH_MSB SOC_LPO_CAL_TIME_LENGTH_MSB -#define LPO_CAL_TIME_LENGTH_LSB SOC_LPO_CAL_TIME_LENGTH_LSB -#define LPO_CAL_TIME_LENGTH_MASK SOC_LPO_CAL_TIME_LENGTH_MASK -#define LPO_CAL_TIME_LENGTH_GET(x) SOC_LPO_CAL_TIME_LENGTH_GET(x) -#define LPO_CAL_TIME_LENGTH_SET(x) SOC_LPO_CAL_TIME_LENGTH_SET(x) -#define LPO_INIT_DIVIDEND_INT_ADDRESS SOC_LPO_INIT_DIVIDEND_INT_ADDRESS -#define LPO_INIT_DIVIDEND_INT_OFFSET SOC_LPO_INIT_DIVIDEND_INT_OFFSET -#define LPO_INIT_DIVIDEND_INT_VALUE_MSB SOC_LPO_INIT_DIVIDEND_INT_VALUE_MSB -#define LPO_INIT_DIVIDEND_INT_VALUE_LSB SOC_LPO_INIT_DIVIDEND_INT_VALUE_LSB -#define LPO_INIT_DIVIDEND_INT_VALUE_MASK SOC_LPO_INIT_DIVIDEND_INT_VALUE_MASK -#define LPO_INIT_DIVIDEND_INT_VALUE_GET(x) SOC_LPO_INIT_DIVIDEND_INT_VALUE_GET(x) -#define LPO_INIT_DIVIDEND_INT_VALUE_SET(x) SOC_LPO_INIT_DIVIDEND_INT_VALUE_SET(x) -#define LPO_INIT_DIVIDEND_FRACTION_ADDRESS SOC_LPO_INIT_DIVIDEND_FRACTION_ADDRESS -#define LPO_INIT_DIVIDEND_FRACTION_OFFSET SOC_LPO_INIT_DIVIDEND_FRACTION_OFFSET -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_MSB SOC_LPO_INIT_DIVIDEND_FRACTION_VALUE_MSB -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB SOC_LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK SOC_LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_GET(x) SOC_LPO_INIT_DIVIDEND_FRACTION_VALUE_GET(x) -#define LPO_INIT_DIVIDEND_FRACTION_VALUE_SET(x) SOC_LPO_INIT_DIVIDEND_FRACTION_VALUE_SET(x) -#define LPO_CAL_ADDRESS SOC_LPO_CAL_ADDRESS -#define LPO_CAL_OFFSET SOC_LPO_CAL_OFFSET -#define LPO_CAL_ENABLE_MSB SOC_LPO_CAL_ENABLE_MSB -#define LPO_CAL_ENABLE_LSB SOC_LPO_CAL_ENABLE_LSB -#define LPO_CAL_ENABLE_MASK SOC_LPO_CAL_ENABLE_MASK -#define LPO_CAL_ENABLE_GET(x) SOC_LPO_CAL_ENABLE_GET(x) -#define LPO_CAL_ENABLE_SET(x) SOC_LPO_CAL_ENABLE_SET(x) -#define LPO_CAL_COUNT_MSB SOC_LPO_CAL_COUNT_MSB -#define LPO_CAL_COUNT_LSB SOC_LPO_CAL_COUNT_LSB -#define LPO_CAL_COUNT_MASK SOC_LPO_CAL_COUNT_MASK -#define LPO_CAL_COUNT_GET(x) SOC_LPO_CAL_COUNT_GET(x) -#define LPO_CAL_COUNT_SET(x) SOC_LPO_CAL_COUNT_SET(x) -#define LPO_CAL_TEST_CONTROL_ADDRESS SOC_LPO_CAL_TEST_CONTROL_ADDRESS -#define LPO_CAL_TEST_CONTROL_OFFSET SOC_LPO_CAL_TEST_CONTROL_OFFSET -#define LPO_CAL_TEST_CONTROL_ENABLE_MSB SOC_LPO_CAL_TEST_CONTROL_ENABLE_MSB -#define LPO_CAL_TEST_CONTROL_ENABLE_LSB SOC_LPO_CAL_TEST_CONTROL_ENABLE_LSB -#define LPO_CAL_TEST_CONTROL_ENABLE_MASK SOC_LPO_CAL_TEST_CONTROL_ENABLE_MASK -#define LPO_CAL_TEST_CONTROL_ENABLE_GET(x) SOC_LPO_CAL_TEST_CONTROL_ENABLE_GET(x) -#define LPO_CAL_TEST_CONTROL_ENABLE_SET(x) SOC_LPO_CAL_TEST_CONTROL_ENABLE_SET(x) -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_MSB SOC_LPO_CAL_TEST_CONTROL_RTC_CYCLES_MSB -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB SOC_LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK SOC_LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_GET(x) SOC_LPO_CAL_TEST_CONTROL_RTC_CYCLES_GET(x) -#define LPO_CAL_TEST_CONTROL_RTC_CYCLES_SET(x) SOC_LPO_CAL_TEST_CONTROL_RTC_CYCLES_SET(x) -#define LPO_CAL_TEST_STATUS_ADDRESS SOC_LPO_CAL_TEST_STATUS_ADDRESS -#define LPO_CAL_TEST_STATUS_OFFSET SOC_LPO_CAL_TEST_STATUS_OFFSET -#define LPO_CAL_TEST_STATUS_READY_MSB SOC_LPO_CAL_TEST_STATUS_READY_MSB -#define LPO_CAL_TEST_STATUS_READY_LSB SOC_LPO_CAL_TEST_STATUS_READY_LSB -#define LPO_CAL_TEST_STATUS_READY_MASK SOC_LPO_CAL_TEST_STATUS_READY_MASK -#define LPO_CAL_TEST_STATUS_READY_GET(x) SOC_LPO_CAL_TEST_STATUS_READY_GET(x) -#define LPO_CAL_TEST_STATUS_READY_SET(x) SOC_LPO_CAL_TEST_STATUS_READY_SET(x) -#define LPO_CAL_TEST_STATUS_COUNT_MSB SOC_LPO_CAL_TEST_STATUS_COUNT_MSB -#define LPO_CAL_TEST_STATUS_COUNT_LSB SOC_LPO_CAL_TEST_STATUS_COUNT_LSB -#define LPO_CAL_TEST_STATUS_COUNT_MASK SOC_LPO_CAL_TEST_STATUS_COUNT_MASK -#define LPO_CAL_TEST_STATUS_COUNT_GET(x) SOC_LPO_CAL_TEST_STATUS_COUNT_GET(x) -#define LPO_CAL_TEST_STATUS_COUNT_SET(x) SOC_LPO_CAL_TEST_STATUS_COUNT_SET(x) -#define CHIP_ID_ADDRESS SOC_CHIP_ID_ADDRESS -#define CHIP_ID_OFFSET SOC_CHIP_ID_OFFSET -#define CHIP_ID_DEVICE_ID_MSB SOC_CHIP_ID_DEVICE_ID_MSB -#define CHIP_ID_DEVICE_ID_LSB SOC_CHIP_ID_DEVICE_ID_LSB -#define CHIP_ID_DEVICE_ID_MASK SOC_CHIP_ID_DEVICE_ID_MASK -#define CHIP_ID_DEVICE_ID_GET(x) SOC_CHIP_ID_DEVICE_ID_GET(x) -#define CHIP_ID_DEVICE_ID_SET(x) SOC_CHIP_ID_DEVICE_ID_SET(x) -#define CHIP_ID_CONFIG_ID_MSB SOC_CHIP_ID_CONFIG_ID_MSB -#define CHIP_ID_CONFIG_ID_LSB SOC_CHIP_ID_CONFIG_ID_LSB -#define CHIP_ID_CONFIG_ID_MASK SOC_CHIP_ID_CONFIG_ID_MASK -#define CHIP_ID_CONFIG_ID_GET(x) SOC_CHIP_ID_CONFIG_ID_GET(x) -#define CHIP_ID_CONFIG_ID_SET(x) SOC_CHIP_ID_CONFIG_ID_SET(x) -#define CHIP_ID_VERSION_ID_MSB SOC_CHIP_ID_VERSION_ID_MSB -#define CHIP_ID_VERSION_ID_LSB SOC_CHIP_ID_VERSION_ID_LSB -#define CHIP_ID_VERSION_ID_MASK SOC_CHIP_ID_VERSION_ID_MASK -#define CHIP_ID_VERSION_ID_GET(x) SOC_CHIP_ID_VERSION_ID_GET(x) -#define CHIP_ID_VERSION_ID_SET(x) SOC_CHIP_ID_VERSION_ID_SET(x) -#define POWER_REG_ADDRESS SOC_POWER_REG_ADDRESS -#define POWER_REG_OFFSET SOC_POWER_REG_OFFSET -#define POWER_REG_SWREG_VS_EN_MSB SOC_POWER_REG_SWREG_VS_EN_MSB -#define POWER_REG_SWREG_VS_EN_LSB SOC_POWER_REG_SWREG_VS_EN_LSB -#define POWER_REG_SWREG_VS_EN_MASK SOC_POWER_REG_SWREG_VS_EN_MASK -#define POWER_REG_SWREG_VS_EN_GET(x) SOC_POWER_REG_SWREG_VS_EN_GET(x) -#define POWER_REG_SWREG_VS_EN_SET(x) SOC_POWER_REG_SWREG_VS_EN_SET(x) -#define POWER_REG_DISCON_MODE_EN_MSB SOC_POWER_REG_DISCON_MODE_EN_MSB -#define POWER_REG_DISCON_MODE_EN_LSB SOC_POWER_REG_DISCON_MODE_EN_LSB -#define POWER_REG_DISCON_MODE_EN_MASK SOC_POWER_REG_DISCON_MODE_EN_MASK -#define POWER_REG_DISCON_MODE_EN_GET(x) SOC_POWER_REG_DISCON_MODE_EN_GET(x) -#define POWER_REG_DISCON_MODE_EN_SET(x) SOC_POWER_REG_DISCON_MODE_EN_SET(x) -#define POWER_REG_DEEP_SLEEP_EN_MSB SOC_POWER_REG_DEEP_SLEEP_EN_MSB -#define POWER_REG_DEEP_SLEEP_EN_LSB SOC_POWER_REG_DEEP_SLEEP_EN_LSB -#define POWER_REG_DEEP_SLEEP_EN_MASK SOC_POWER_REG_DEEP_SLEEP_EN_MASK -#define POWER_REG_DEEP_SLEEP_EN_GET(x) SOC_POWER_REG_DEEP_SLEEP_EN_GET(x) -#define POWER_REG_DEEP_SLEEP_EN_SET(x) SOC_POWER_REG_DEEP_SLEEP_EN_SET(x) -#define POWER_REG_DEBUG_EN_MSB SOC_POWER_REG_DEBUG_EN_MSB -#define POWER_REG_DEBUG_EN_LSB SOC_POWER_REG_DEBUG_EN_LSB -#define POWER_REG_DEBUG_EN_MASK SOC_POWER_REG_DEBUG_EN_MASK -#define POWER_REG_DEBUG_EN_GET(x) SOC_POWER_REG_DEBUG_EN_GET(x) -#define POWER_REG_DEBUG_EN_SET(x) SOC_POWER_REG_DEBUG_EN_SET(x) -#define POWER_REG_WLAN_BB_PWD_EN_MSB SOC_POWER_REG_WLAN_BB_PWD_EN_MSB -#define POWER_REG_WLAN_BB_PWD_EN_LSB SOC_POWER_REG_WLAN_BB_PWD_EN_LSB -#define POWER_REG_WLAN_BB_PWD_EN_MASK SOC_POWER_REG_WLAN_BB_PWD_EN_MASK -#define POWER_REG_WLAN_BB_PWD_EN_GET(x) SOC_POWER_REG_WLAN_BB_PWD_EN_GET(x) -#define POWER_REG_WLAN_BB_PWD_EN_SET(x) SOC_POWER_REG_WLAN_BB_PWD_EN_SET(x) -#define POWER_REG_WLAN_MAC_PWD_EN_MSB SOC_POWER_REG_WLAN_MAC_PWD_EN_MSB -#define POWER_REG_WLAN_MAC_PWD_EN_LSB SOC_POWER_REG_WLAN_MAC_PWD_EN_LSB -#define POWER_REG_WLAN_MAC_PWD_EN_MASK SOC_POWER_REG_WLAN_MAC_PWD_EN_MASK -#define POWER_REG_WLAN_MAC_PWD_EN_GET(x) SOC_POWER_REG_WLAN_MAC_PWD_EN_GET(x) -#define POWER_REG_WLAN_MAC_PWD_EN_SET(x) SOC_POWER_REG_WLAN_MAC_PWD_EN_SET(x) -#define POWER_REG_CPU_INT_ENABLE_MSB SOC_POWER_REG_CPU_INT_ENABLE_MSB -#define POWER_REG_CPU_INT_ENABLE_LSB SOC_POWER_REG_CPU_INT_ENABLE_LSB -#define POWER_REG_CPU_INT_ENABLE_MASK SOC_POWER_REG_CPU_INT_ENABLE_MASK -#define POWER_REG_CPU_INT_ENABLE_GET(x) SOC_POWER_REG_CPU_INT_ENABLE_GET(x) -#define POWER_REG_CPU_INT_ENABLE_SET(x) SOC_POWER_REG_CPU_INT_ENABLE_SET(x) -#define POWER_REG_RADIO_PWD_EN_MSB SOC_POWER_REG_RADIO_PWD_EN_MSB -#define POWER_REG_RADIO_PWD_EN_LSB SOC_POWER_REG_RADIO_PWD_EN_LSB -#define POWER_REG_RADIO_PWD_EN_MASK SOC_POWER_REG_RADIO_PWD_EN_MASK -#define POWER_REG_RADIO_PWD_EN_GET(x) SOC_POWER_REG_RADIO_PWD_EN_GET(x) -#define POWER_REG_RADIO_PWD_EN_SET(x) SOC_POWER_REG_RADIO_PWD_EN_SET(x) -#define POWER_REG_WLAN_PWD_EN_MSB SOC_POWER_REG_WLAN_PWD_EN_MSB -#define POWER_REG_WLAN_PWD_EN_LSB SOC_POWER_REG_WLAN_PWD_EN_LSB -#define POWER_REG_WLAN_PWD_EN_MASK SOC_POWER_REG_WLAN_PWD_EN_MASK -#define POWER_REG_WLAN_PWD_EN_GET(x) SOC_POWER_REG_WLAN_PWD_EN_GET(x) -#define POWER_REG_WLAN_PWD_EN_SET(x) SOC_POWER_REG_WLAN_PWD_EN_SET(x) -#define POWER_REG_POWER_EN_MSB SOC_POWER_REG_POWER_EN_MSB -#define POWER_REG_POWER_EN_LSB SOC_POWER_REG_POWER_EN_LSB -#define POWER_REG_POWER_EN_MASK SOC_POWER_REG_POWER_EN_MASK -#define POWER_REG_POWER_EN_GET(x) SOC_POWER_REG_POWER_EN_GET(x) -#define POWER_REG_POWER_EN_SET(x) SOC_POWER_REG_POWER_EN_SET(x) -#define CORE_CLK_CTRL_ADDRESS SOC_CORE_CLK_CTRL_ADDRESS -#define CORE_CLK_CTRL_OFFSET SOC_CORE_CLK_CTRL_OFFSET -#define CORE_CLK_CTRL_DIV_MSB SOC_CORE_CLK_CTRL_DIV_MSB -#define CORE_CLK_CTRL_DIV_LSB SOC_CORE_CLK_CTRL_DIV_LSB -#define CORE_CLK_CTRL_DIV_MASK SOC_CORE_CLK_CTRL_DIV_MASK -#define CORE_CLK_CTRL_DIV_GET(x) SOC_CORE_CLK_CTRL_DIV_GET(x) -#define CORE_CLK_CTRL_DIV_SET(x) SOC_CORE_CLK_CTRL_DIV_SET(x) -#define GPIO_WAKEUP_CONTROL_ADDRESS SOC_GPIO_WAKEUP_CONTROL_ADDRESS -#define GPIO_WAKEUP_CONTROL_OFFSET SOC_GPIO_WAKEUP_CONTROL_OFFSET -#define GPIO_WAKEUP_CONTROL_ENABLE_MSB SOC_GPIO_WAKEUP_CONTROL_ENABLE_MSB -#define GPIO_WAKEUP_CONTROL_ENABLE_LSB SOC_GPIO_WAKEUP_CONTROL_ENABLE_LSB -#define GPIO_WAKEUP_CONTROL_ENABLE_MASK SOC_GPIO_WAKEUP_CONTROL_ENABLE_MASK -#define GPIO_WAKEUP_CONTROL_ENABLE_GET(x) SOC_GPIO_WAKEUP_CONTROL_ENABLE_GET(x) -#define GPIO_WAKEUP_CONTROL_ENABLE_SET(x) SOC_GPIO_WAKEUP_CONTROL_ENABLE_SET(x) - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_soc_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_soc_reg.h deleted file mode 100644 index 5c69d6d309cf..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_soc_reg.h +++ /dev/null @@ -1,1856 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _RTC_SOC_REG_REG_H_ -#define _RTC_SOC_REG_REG_H_ - -#define SOC_RESET_CONTROL_ADDRESS 0x00000000 -#define SOC_RESET_CONTROL_OFFSET 0x00000000 -#define SOC_RESET_CONTROL_SDIO2_RST_MSB 31 -#define SOC_RESET_CONTROL_SDIO2_RST_LSB 31 -#define SOC_RESET_CONTROL_SDIO2_RST_MASK 0x80000000 -#define SOC_RESET_CONTROL_SDIO2_RST_GET(x) (((x) & SOC_RESET_CONTROL_SDIO2_RST_MASK) >> SOC_RESET_CONTROL_SDIO2_RST_LSB) -#define SOC_RESET_CONTROL_SDIO2_RST_SET(x) (((x) << SOC_RESET_CONTROL_SDIO2_RST_LSB) & SOC_RESET_CONTROL_SDIO2_RST_MASK) -#define SOC_RESET_CONTROL_SPI2_RST_MSB 30 -#define SOC_RESET_CONTROL_SPI2_RST_LSB 30 -#define SOC_RESET_CONTROL_SPI2_RST_MASK 0x40000000 -#define SOC_RESET_CONTROL_SPI2_RST_GET(x) (((x) & SOC_RESET_CONTROL_SPI2_RST_MASK) >> SOC_RESET_CONTROL_SPI2_RST_LSB) -#define SOC_RESET_CONTROL_SPI2_RST_SET(x) (((x) << SOC_RESET_CONTROL_SPI2_RST_LSB) & SOC_RESET_CONTROL_SPI2_RST_MASK) -#define SOC_RESET_CONTROL_I2S_1_RST_MSB 29 -#define SOC_RESET_CONTROL_I2S_1_RST_LSB 29 -#define SOC_RESET_CONTROL_I2S_1_RST_MASK 0x20000000 -#define SOC_RESET_CONTROL_I2S_1_RST_GET(x) (((x) & SOC_RESET_CONTROL_I2S_1_RST_MASK) >> SOC_RESET_CONTROL_I2S_1_RST_LSB) -#define SOC_RESET_CONTROL_I2S_1_RST_SET(x) (((x) << SOC_RESET_CONTROL_I2S_1_RST_LSB) & SOC_RESET_CONTROL_I2S_1_RST_MASK) -#define SOC_RESET_CONTROL_I2S_1_MBOX_RST_MSB 28 -#define SOC_RESET_CONTROL_I2S_1_MBOX_RST_LSB 28 -#define SOC_RESET_CONTROL_I2S_1_MBOX_RST_MASK 0x10000000 -#define SOC_RESET_CONTROL_I2S_1_MBOX_RST_GET(x) (((x) & SOC_RESET_CONTROL_I2S_1_MBOX_RST_MASK) >> SOC_RESET_CONTROL_I2S_1_MBOX_RST_LSB) -#define SOC_RESET_CONTROL_I2S_1_MBOX_RST_SET(x) (((x) << SOC_RESET_CONTROL_I2S_1_MBOX_RST_LSB) & SOC_RESET_CONTROL_I2S_1_MBOX_RST_MASK) -#define SOC_RESET_CONTROL_I2C_SLAVE_RST_MSB 27 -#define SOC_RESET_CONTROL_I2C_SLAVE_RST_LSB 27 -#define SOC_RESET_CONTROL_I2C_SLAVE_RST_MASK 0x08000000 -#define SOC_RESET_CONTROL_I2C_SLAVE_RST_GET(x) (((x) & SOC_RESET_CONTROL_I2C_SLAVE_RST_MASK) >> SOC_RESET_CONTROL_I2C_SLAVE_RST_LSB) -#define SOC_RESET_CONTROL_I2C_SLAVE_RST_SET(x) (((x) << SOC_RESET_CONTROL_I2C_SLAVE_RST_LSB) & SOC_RESET_CONTROL_I2C_SLAVE_RST_MASK) -#define SOC_RESET_CONTROL_USB_PHY_ARST_MSB 26 -#define SOC_RESET_CONTROL_USB_PHY_ARST_LSB 26 -#define SOC_RESET_CONTROL_USB_PHY_ARST_MASK 0x04000000 -#define SOC_RESET_CONTROL_USB_PHY_ARST_GET(x) (((x) & SOC_RESET_CONTROL_USB_PHY_ARST_MASK) >> SOC_RESET_CONTROL_USB_PHY_ARST_LSB) -#define SOC_RESET_CONTROL_USB_PHY_ARST_SET(x) (((x) << SOC_RESET_CONTROL_USB_PHY_ARST_LSB) & SOC_RESET_CONTROL_USB_PHY_ARST_MASK) -#define SOC_RESET_CONTROL_USB_PHY_RST_MSB 25 -#define SOC_RESET_CONTROL_USB_PHY_RST_LSB 25 -#define SOC_RESET_CONTROL_USB_PHY_RST_MASK 0x02000000 -#define SOC_RESET_CONTROL_USB_PHY_RST_GET(x) (((x) & SOC_RESET_CONTROL_USB_PHY_RST_MASK) >> SOC_RESET_CONTROL_USB_PHY_RST_LSB) -#define SOC_RESET_CONTROL_USB_PHY_RST_SET(x) (((x) << SOC_RESET_CONTROL_USB_PHY_RST_LSB) & SOC_RESET_CONTROL_USB_PHY_RST_MASK) -#define SOC_RESET_CONTROL_USB_RST_MSB 24 -#define SOC_RESET_CONTROL_USB_RST_LSB 24 -#define SOC_RESET_CONTROL_USB_RST_MASK 0x01000000 -#define SOC_RESET_CONTROL_USB_RST_GET(x) (((x) & SOC_RESET_CONTROL_USB_RST_MASK) >> SOC_RESET_CONTROL_USB_RST_LSB) -#define SOC_RESET_CONTROL_USB_RST_SET(x) (((x) << SOC_RESET_CONTROL_USB_RST_LSB) & SOC_RESET_CONTROL_USB_RST_MASK) -#define SOC_RESET_CONTROL_MMAC_RST_MSB 23 -#define SOC_RESET_CONTROL_MMAC_RST_LSB 23 -#define SOC_RESET_CONTROL_MMAC_RST_MASK 0x00800000 -#define SOC_RESET_CONTROL_MMAC_RST_GET(x) (((x) & SOC_RESET_CONTROL_MMAC_RST_MASK) >> SOC_RESET_CONTROL_MMAC_RST_LSB) -#define SOC_RESET_CONTROL_MMAC_RST_SET(x) (((x) << SOC_RESET_CONTROL_MMAC_RST_LSB) & SOC_RESET_CONTROL_MMAC_RST_MASK) -#define SOC_RESET_CONTROL_MDIO_RST_MSB 22 -#define SOC_RESET_CONTROL_MDIO_RST_LSB 22 -#define SOC_RESET_CONTROL_MDIO_RST_MASK 0x00400000 -#define SOC_RESET_CONTROL_MDIO_RST_GET(x) (((x) & SOC_RESET_CONTROL_MDIO_RST_MASK) >> SOC_RESET_CONTROL_MDIO_RST_LSB) -#define SOC_RESET_CONTROL_MDIO_RST_SET(x) (((x) << SOC_RESET_CONTROL_MDIO_RST_LSB) & SOC_RESET_CONTROL_MDIO_RST_MASK) -#define SOC_RESET_CONTROL_GE0_RST_MSB 21 -#define SOC_RESET_CONTROL_GE0_RST_LSB 21 -#define SOC_RESET_CONTROL_GE0_RST_MASK 0x00200000 -#define SOC_RESET_CONTROL_GE0_RST_GET(x) (((x) & SOC_RESET_CONTROL_GE0_RST_MASK) >> SOC_RESET_CONTROL_GE0_RST_LSB) -#define SOC_RESET_CONTROL_GE0_RST_SET(x) (((x) << SOC_RESET_CONTROL_GE0_RST_LSB) & SOC_RESET_CONTROL_GE0_RST_MASK) -#define SOC_RESET_CONTROL_I2S_RST_MSB 20 -#define SOC_RESET_CONTROL_I2S_RST_LSB 20 -#define SOC_RESET_CONTROL_I2S_RST_MASK 0x00100000 -#define SOC_RESET_CONTROL_I2S_RST_GET(x) (((x) & SOC_RESET_CONTROL_I2S_RST_MASK) >> SOC_RESET_CONTROL_I2S_RST_LSB) -#define SOC_RESET_CONTROL_I2S_RST_SET(x) (((x) << SOC_RESET_CONTROL_I2S_RST_LSB) & SOC_RESET_CONTROL_I2S_RST_MASK) -#define SOC_RESET_CONTROL_I2S_MBOX_RST_MSB 19 -#define SOC_RESET_CONTROL_I2S_MBOX_RST_LSB 19 -#define SOC_RESET_CONTROL_I2S_MBOX_RST_MASK 0x00080000 -#define SOC_RESET_CONTROL_I2S_MBOX_RST_GET(x) (((x) & SOC_RESET_CONTROL_I2S_MBOX_RST_MASK) >> SOC_RESET_CONTROL_I2S_MBOX_RST_LSB) -#define SOC_RESET_CONTROL_I2S_MBOX_RST_SET(x) (((x) << SOC_RESET_CONTROL_I2S_MBOX_RST_LSB) & SOC_RESET_CONTROL_I2S_MBOX_RST_MASK) -#define SOC_RESET_CONTROL_CHECKSUM_ACC_RST_MSB 18 -#define SOC_RESET_CONTROL_CHECKSUM_ACC_RST_LSB 18 -#define SOC_RESET_CONTROL_CHECKSUM_ACC_RST_MASK 0x00040000 -#define SOC_RESET_CONTROL_CHECKSUM_ACC_RST_GET(x) (((x) & SOC_RESET_CONTROL_CHECKSUM_ACC_RST_MASK) >> SOC_RESET_CONTROL_CHECKSUM_ACC_RST_LSB) -#define SOC_RESET_CONTROL_CHECKSUM_ACC_RST_SET(x) (((x) << SOC_RESET_CONTROL_CHECKSUM_ACC_RST_LSB) & SOC_RESET_CONTROL_CHECKSUM_ACC_RST_MASK) -#define SOC_RESET_CONTROL_UART2_RST_MSB 17 -#define SOC_RESET_CONTROL_UART2_RST_LSB 17 -#define SOC_RESET_CONTROL_UART2_RST_MASK 0x00020000 -#define SOC_RESET_CONTROL_UART2_RST_GET(x) (((x) & SOC_RESET_CONTROL_UART2_RST_MASK) >> SOC_RESET_CONTROL_UART2_RST_LSB) -#define SOC_RESET_CONTROL_UART2_RST_SET(x) (((x) << SOC_RESET_CONTROL_UART2_RST_LSB) & SOC_RESET_CONTROL_UART2_RST_MASK) -#define SOC_RESET_CONTROL_DEBUG_UART_RST_MSB 16 -#define SOC_RESET_CONTROL_DEBUG_UART_RST_LSB 16 -#define SOC_RESET_CONTROL_DEBUG_UART_RST_MASK 0x00010000 -#define SOC_RESET_CONTROL_DEBUG_UART_RST_GET(x) (((x) & SOC_RESET_CONTROL_DEBUG_UART_RST_MASK) >> SOC_RESET_CONTROL_DEBUG_UART_RST_LSB) -#define SOC_RESET_CONTROL_DEBUG_UART_RST_SET(x) (((x) << SOC_RESET_CONTROL_DEBUG_UART_RST_LSB) & SOC_RESET_CONTROL_DEBUG_UART_RST_MASK) -#define SOC_RESET_CONTROL_MIT_REG_MAPPING_RST_MSB 13 -#define SOC_RESET_CONTROL_MIT_REG_MAPPING_RST_LSB 13 -#define SOC_RESET_CONTROL_MIT_REG_MAPPING_RST_MASK 0x00002000 -#define SOC_RESET_CONTROL_MIT_REG_MAPPING_RST_GET(x) (((x) & SOC_RESET_CONTROL_MIT_REG_MAPPING_RST_MASK) >> SOC_RESET_CONTROL_MIT_REG_MAPPING_RST_LSB) -#define SOC_RESET_CONTROL_MIT_REG_MAPPING_RST_SET(x) (((x) << SOC_RESET_CONTROL_MIT_REG_MAPPING_RST_LSB) & SOC_RESET_CONTROL_MIT_REG_MAPPING_RST_MASK) -#define SOC_RESET_CONTROL_MIT_ADAPTOR_RST_MSB 12 -#define SOC_RESET_CONTROL_MIT_ADAPTOR_RST_LSB 12 -#define SOC_RESET_CONTROL_MIT_ADAPTOR_RST_MASK 0x00001000 -#define SOC_RESET_CONTROL_MIT_ADAPTOR_RST_GET(x) (((x) & SOC_RESET_CONTROL_MIT_ADAPTOR_RST_MASK) >> SOC_RESET_CONTROL_MIT_ADAPTOR_RST_LSB) -#define SOC_RESET_CONTROL_MIT_ADAPTOR_RST_SET(x) (((x) << SOC_RESET_CONTROL_MIT_ADAPTOR_RST_LSB) & SOC_RESET_CONTROL_MIT_ADAPTOR_RST_MASK) -#define SOC_RESET_CONTROL_CPU_INIT_RESET_MSB 11 -#define SOC_RESET_CONTROL_CPU_INIT_RESET_LSB 11 -#define SOC_RESET_CONTROL_CPU_INIT_RESET_MASK 0x00000800 -#define SOC_RESET_CONTROL_CPU_INIT_RESET_GET(x) (((x) & SOC_RESET_CONTROL_CPU_INIT_RESET_MASK) >> SOC_RESET_CONTROL_CPU_INIT_RESET_LSB) -#define SOC_RESET_CONTROL_CPU_INIT_RESET_SET(x) (((x) << SOC_RESET_CONTROL_CPU_INIT_RESET_LSB) & SOC_RESET_CONTROL_CPU_INIT_RESET_MASK) -#define SOC_RESET_CONTROL_RST_OUT_MSB 9 -#define SOC_RESET_CONTROL_RST_OUT_LSB 9 -#define SOC_RESET_CONTROL_RST_OUT_MASK 0x00000200 -#define SOC_RESET_CONTROL_RST_OUT_GET(x) (((x) & SOC_RESET_CONTROL_RST_OUT_MASK) >> SOC_RESET_CONTROL_RST_OUT_LSB) -#define SOC_RESET_CONTROL_RST_OUT_SET(x) (((x) << SOC_RESET_CONTROL_RST_OUT_LSB) & SOC_RESET_CONTROL_RST_OUT_MASK) -#define SOC_RESET_CONTROL_COLD_RST_MSB 8 -#define SOC_RESET_CONTROL_COLD_RST_LSB 8 -#define SOC_RESET_CONTROL_COLD_RST_MASK 0x00000100 -#define SOC_RESET_CONTROL_COLD_RST_GET(x) (((x) & SOC_RESET_CONTROL_COLD_RST_MASK) >> SOC_RESET_CONTROL_COLD_RST_LSB) -#define SOC_RESET_CONTROL_COLD_RST_SET(x) (((x) << SOC_RESET_CONTROL_COLD_RST_LSB) & SOC_RESET_CONTROL_COLD_RST_MASK) -#define SOC_RESET_CONTROL_CPU_WARM_RST_MSB 6 -#define SOC_RESET_CONTROL_CPU_WARM_RST_LSB 6 -#define SOC_RESET_CONTROL_CPU_WARM_RST_MASK 0x00000040 -#define SOC_RESET_CONTROL_CPU_WARM_RST_GET(x) (((x) & SOC_RESET_CONTROL_CPU_WARM_RST_MASK) >> SOC_RESET_CONTROL_CPU_WARM_RST_LSB) -#define SOC_RESET_CONTROL_CPU_WARM_RST_SET(x) (((x) << SOC_RESET_CONTROL_CPU_WARM_RST_LSB) & SOC_RESET_CONTROL_CPU_WARM_RST_MASK) -#define SOC_RESET_CONTROL_MBOX_RST_MSB 2 -#define SOC_RESET_CONTROL_MBOX_RST_LSB 2 -#define SOC_RESET_CONTROL_MBOX_RST_MASK 0x00000004 -#define SOC_RESET_CONTROL_MBOX_RST_GET(x) (((x) & SOC_RESET_CONTROL_MBOX_RST_MASK) >> SOC_RESET_CONTROL_MBOX_RST_LSB) -#define SOC_RESET_CONTROL_MBOX_RST_SET(x) (((x) << SOC_RESET_CONTROL_MBOX_RST_LSB) & SOC_RESET_CONTROL_MBOX_RST_MASK) -#define SOC_RESET_CONTROL_UART_RST_MSB 1 -#define SOC_RESET_CONTROL_UART_RST_LSB 1 -#define SOC_RESET_CONTROL_UART_RST_MASK 0x00000002 -#define SOC_RESET_CONTROL_UART_RST_GET(x) (((x) & SOC_RESET_CONTROL_UART_RST_MASK) >> SOC_RESET_CONTROL_UART_RST_LSB) -#define SOC_RESET_CONTROL_UART_RST_SET(x) (((x) << SOC_RESET_CONTROL_UART_RST_LSB) & SOC_RESET_CONTROL_UART_RST_MASK) -#define SOC_RESET_CONTROL_SI0_RST_MSB 0 -#define SOC_RESET_CONTROL_SI0_RST_LSB 0 -#define SOC_RESET_CONTROL_SI0_RST_MASK 0x00000001 -#define SOC_RESET_CONTROL_SI0_RST_GET(x) (((x) & SOC_RESET_CONTROL_SI0_RST_MASK) >> SOC_RESET_CONTROL_SI0_RST_LSB) -#define SOC_RESET_CONTROL_SI0_RST_SET(x) (((x) << SOC_RESET_CONTROL_SI0_RST_LSB) & SOC_RESET_CONTROL_SI0_RST_MASK) - -#define SOC_TCXO_DETECT_ADDRESS 0x00000004 -#define SOC_TCXO_DETECT_OFFSET 0x00000004 -#define SOC_TCXO_DETECT_PRESENT_MSB 0 -#define SOC_TCXO_DETECT_PRESENT_LSB 0 -#define SOC_TCXO_DETECT_PRESENT_MASK 0x00000001 -#define SOC_TCXO_DETECT_PRESENT_GET(x) (((x) & SOC_TCXO_DETECT_PRESENT_MASK) >> SOC_TCXO_DETECT_PRESENT_LSB) -#define SOC_TCXO_DETECT_PRESENT_SET(x) (((x) << SOC_TCXO_DETECT_PRESENT_LSB) & SOC_TCXO_DETECT_PRESENT_MASK) - -#define SOC_XTAL_TEST_ADDRESS 0x00000008 -#define SOC_XTAL_TEST_OFFSET 0x00000008 -#define SOC_XTAL_TEST_NOTCXODET_MSB 0 -#define SOC_XTAL_TEST_NOTCXODET_LSB 0 -#define SOC_XTAL_TEST_NOTCXODET_MASK 0x00000001 -#define SOC_XTAL_TEST_NOTCXODET_GET(x) (((x) & SOC_XTAL_TEST_NOTCXODET_MASK) >> SOC_XTAL_TEST_NOTCXODET_LSB) -#define SOC_XTAL_TEST_NOTCXODET_SET(x) (((x) << SOC_XTAL_TEST_NOTCXODET_LSB) & SOC_XTAL_TEST_NOTCXODET_MASK) - -#define SOC_CPU_CLOCK_ADDRESS 0x00000020 -#define SOC_CPU_CLOCK_OFFSET 0x00000020 -#define SOC_CPU_CLOCK_STANDARD_MSB 1 -#define SOC_CPU_CLOCK_STANDARD_LSB 0 -#define SOC_CPU_CLOCK_STANDARD_MASK 0x00000003 -#define SOC_CPU_CLOCK_STANDARD_GET(x) (((x) & SOC_CPU_CLOCK_STANDARD_MASK) >> SOC_CPU_CLOCK_STANDARD_LSB) -#define SOC_CPU_CLOCK_STANDARD_SET(x) (((x) << SOC_CPU_CLOCK_STANDARD_LSB) & SOC_CPU_CLOCK_STANDARD_MASK) - -#define SOC_CLOCK_CONTROL_ADDRESS 0x00000028 -#define SOC_CLOCK_CONTROL_OFFSET 0x00000028 -#define SOC_CLOCK_CONTROL_LF_CLK32_MSB 2 -#define SOC_CLOCK_CONTROL_LF_CLK32_LSB 2 -#define SOC_CLOCK_CONTROL_LF_CLK32_MASK 0x00000004 -#define SOC_CLOCK_CONTROL_LF_CLK32_GET(x) (((x) & SOC_CLOCK_CONTROL_LF_CLK32_MASK) >> SOC_CLOCK_CONTROL_LF_CLK32_LSB) -#define SOC_CLOCK_CONTROL_LF_CLK32_SET(x) (((x) << SOC_CLOCK_CONTROL_LF_CLK32_LSB) & SOC_CLOCK_CONTROL_LF_CLK32_MASK) -#define SOC_CLOCK_CONTROL_SI0_CLK_MSB 0 -#define SOC_CLOCK_CONTROL_SI0_CLK_LSB 0 -#define SOC_CLOCK_CONTROL_SI0_CLK_MASK 0x00000001 -#define SOC_CLOCK_CONTROL_SI0_CLK_GET(x) (((x) & SOC_CLOCK_CONTROL_SI0_CLK_MASK) >> SOC_CLOCK_CONTROL_SI0_CLK_LSB) -#define SOC_CLOCK_CONTROL_SI0_CLK_SET(x) (((x) << SOC_CLOCK_CONTROL_SI0_CLK_LSB) & SOC_CLOCK_CONTROL_SI0_CLK_MASK) - -#define SOC_WDT_CONTROL_ADDRESS 0x00000030 -#define SOC_WDT_CONTROL_OFFSET 0x00000030 -#define SOC_WDT_CONTROL_ACTION_MSB 2 -#define SOC_WDT_CONTROL_ACTION_LSB 0 -#define SOC_WDT_CONTROL_ACTION_MASK 0x00000007 -#define SOC_WDT_CONTROL_ACTION_GET(x) (((x) & SOC_WDT_CONTROL_ACTION_MASK) >> SOC_WDT_CONTROL_ACTION_LSB) -#define SOC_WDT_CONTROL_ACTION_SET(x) (((x) << SOC_WDT_CONTROL_ACTION_LSB) & SOC_WDT_CONTROL_ACTION_MASK) - -#define SOC_WDT_STATUS_ADDRESS 0x00000034 -#define SOC_WDT_STATUS_OFFSET 0x00000034 -#define SOC_WDT_STATUS_INTERRUPT_MSB 0 -#define SOC_WDT_STATUS_INTERRUPT_LSB 0 -#define SOC_WDT_STATUS_INTERRUPT_MASK 0x00000001 -#define SOC_WDT_STATUS_INTERRUPT_GET(x) (((x) & SOC_WDT_STATUS_INTERRUPT_MASK) >> SOC_WDT_STATUS_INTERRUPT_LSB) -#define SOC_WDT_STATUS_INTERRUPT_SET(x) (((x) << SOC_WDT_STATUS_INTERRUPT_LSB) & SOC_WDT_STATUS_INTERRUPT_MASK) - -#define SOC_WDT_ADDRESS 0x00000038 -#define SOC_WDT_OFFSET 0x00000038 -#define SOC_WDT_TARGET_MSB 21 -#define SOC_WDT_TARGET_LSB 0 -#define SOC_WDT_TARGET_MASK 0x003fffff -#define SOC_WDT_TARGET_GET(x) (((x) & SOC_WDT_TARGET_MASK) >> SOC_WDT_TARGET_LSB) -#define SOC_WDT_TARGET_SET(x) (((x) << SOC_WDT_TARGET_LSB) & SOC_WDT_TARGET_MASK) - -#define SOC_WDT_COUNT_ADDRESS 0x0000003c -#define SOC_WDT_COUNT_OFFSET 0x0000003c -#define SOC_WDT_COUNT_VALUE_MSB 21 -#define SOC_WDT_COUNT_VALUE_LSB 0 -#define SOC_WDT_COUNT_VALUE_MASK 0x003fffff -#define SOC_WDT_COUNT_VALUE_GET(x) (((x) & SOC_WDT_COUNT_VALUE_MASK) >> SOC_WDT_COUNT_VALUE_LSB) -#define SOC_WDT_COUNT_VALUE_SET(x) (((x) << SOC_WDT_COUNT_VALUE_LSB) & SOC_WDT_COUNT_VALUE_MASK) - -#define SOC_WDT_RESET_ADDRESS 0x00000040 -#define SOC_WDT_RESET_OFFSET 0x00000040 -#define SOC_WDT_RESET_VALUE_MSB 0 -#define SOC_WDT_RESET_VALUE_LSB 0 -#define SOC_WDT_RESET_VALUE_MASK 0x00000001 -#define SOC_WDT_RESET_VALUE_GET(x) (((x) & SOC_WDT_RESET_VALUE_MASK) >> SOC_WDT_RESET_VALUE_LSB) -#define SOC_WDT_RESET_VALUE_SET(x) (((x) << SOC_WDT_RESET_VALUE_LSB) & SOC_WDT_RESET_VALUE_MASK) - -#define SOC_INT_STATUS_ADDRESS 0x00000044 -#define SOC_INT_STATUS_OFFSET 0x00000044 -#define SOC_INT_STATUS_STE_MBOX_MSB 31 -#define SOC_INT_STATUS_STE_MBOX_LSB 31 -#define SOC_INT_STATUS_STE_MBOX_MASK 0x80000000 -#define SOC_INT_STATUS_STE_MBOX_GET(x) (((x) & SOC_INT_STATUS_STE_MBOX_MASK) >> SOC_INT_STATUS_STE_MBOX_LSB) -#define SOC_INT_STATUS_STE_MBOX_SET(x) (((x) << SOC_INT_STATUS_STE_MBOX_LSB) & SOC_INT_STATUS_STE_MBOX_MASK) -#define SOC_INT_STATUS_SDIO2_MBOX_MSB 30 -#define SOC_INT_STATUS_SDIO2_MBOX_LSB 30 -#define SOC_INT_STATUS_SDIO2_MBOX_MASK 0x40000000 -#define SOC_INT_STATUS_SDIO2_MBOX_GET(x) (((x) & SOC_INT_STATUS_SDIO2_MBOX_MASK) >> SOC_INT_STATUS_SDIO2_MBOX_LSB) -#define SOC_INT_STATUS_SDIO2_MBOX_SET(x) (((x) << SOC_INT_STATUS_SDIO2_MBOX_LSB) & SOC_INT_STATUS_SDIO2_MBOX_MASK) -#define SOC_INT_STATUS_USBDMA_MSB 29 -#define SOC_INT_STATUS_USBDMA_LSB 29 -#define SOC_INT_STATUS_USBDMA_MASK 0x20000000 -#define SOC_INT_STATUS_USBDMA_GET(x) (((x) & SOC_INT_STATUS_USBDMA_MASK) >> SOC_INT_STATUS_USBDMA_LSB) -#define SOC_INT_STATUS_USBDMA_SET(x) (((x) << SOC_INT_STATUS_USBDMA_LSB) & SOC_INT_STATUS_USBDMA_MASK) -#define SOC_INT_STATUS_USBIP_MSB 28 -#define SOC_INT_STATUS_USBIP_LSB 28 -#define SOC_INT_STATUS_USBIP_MASK 0x10000000 -#define SOC_INT_STATUS_USBIP_GET(x) (((x) & SOC_INT_STATUS_USBIP_MASK) >> SOC_INT_STATUS_USBIP_LSB) -#define SOC_INT_STATUS_USBIP_SET(x) (((x) << SOC_INT_STATUS_USBIP_LSB) & SOC_INT_STATUS_USBIP_MASK) -#define SOC_INT_STATUS_MMAC_MSB 27 -#define SOC_INT_STATUS_MMAC_LSB 27 -#define SOC_INT_STATUS_MMAC_MASK 0x08000000 -#define SOC_INT_STATUS_MMAC_GET(x) (((x) & SOC_INT_STATUS_MMAC_MASK) >> SOC_INT_STATUS_MMAC_LSB) -#define SOC_INT_STATUS_MMAC_SET(x) (((x) << SOC_INT_STATUS_MMAC_LSB) & SOC_INT_STATUS_MMAC_MASK) -#define SOC_INT_STATUS_MIT_REG_ACCESS_MSB 26 -#define SOC_INT_STATUS_MIT_REG_ACCESS_LSB 26 -#define SOC_INT_STATUS_MIT_REG_ACCESS_MASK 0x04000000 -#define SOC_INT_STATUS_MIT_REG_ACCESS_GET(x) (((x) & SOC_INT_STATUS_MIT_REG_ACCESS_MASK) >> SOC_INT_STATUS_MIT_REG_ACCESS_LSB) -#define SOC_INT_STATUS_MIT_REG_ACCESS_SET(x) (((x) << SOC_INT_STATUS_MIT_REG_ACCESS_LSB) & SOC_INT_STATUS_MIT_REG_ACCESS_MASK) -#define SOC_INT_STATUS_FLIGHT_MODE_MSB 25 -#define SOC_INT_STATUS_FLIGHT_MODE_LSB 25 -#define SOC_INT_STATUS_FLIGHT_MODE_MASK 0x02000000 -#define SOC_INT_STATUS_FLIGHT_MODE_GET(x) (((x) & SOC_INT_STATUS_FLIGHT_MODE_MASK) >> SOC_INT_STATUS_FLIGHT_MODE_LSB) -#define SOC_INT_STATUS_FLIGHT_MODE_SET(x) (((x) << SOC_INT_STATUS_FLIGHT_MODE_LSB) & SOC_INT_STATUS_FLIGHT_MODE_MASK) -#define SOC_INT_STATUS_BBP_SLEEP_RISING_MSB 24 -#define SOC_INT_STATUS_BBP_SLEEP_RISING_LSB 24 -#define SOC_INT_STATUS_BBP_SLEEP_RISING_MASK 0x01000000 -#define SOC_INT_STATUS_BBP_SLEEP_RISING_GET(x) (((x) & SOC_INT_STATUS_BBP_SLEEP_RISING_MASK) >> SOC_INT_STATUS_BBP_SLEEP_RISING_LSB) -#define SOC_INT_STATUS_BBP_SLEEP_RISING_SET(x) (((x) << SOC_INT_STATUS_BBP_SLEEP_RISING_LSB) & SOC_INT_STATUS_BBP_SLEEP_RISING_MASK) -#define SOC_INT_STATUS_RF_SLEEP_RISING_MSB 23 -#define SOC_INT_STATUS_RF_SLEEP_RISING_LSB 23 -#define SOC_INT_STATUS_RF_SLEEP_RISING_MASK 0x00800000 -#define SOC_INT_STATUS_RF_SLEEP_RISING_GET(x) (((x) & SOC_INT_STATUS_RF_SLEEP_RISING_MASK) >> SOC_INT_STATUS_RF_SLEEP_RISING_LSB) -#define SOC_INT_STATUS_RF_SLEEP_RISING_SET(x) (((x) << SOC_INT_STATUS_RF_SLEEP_RISING_LSB) & SOC_INT_STATUS_RF_SLEEP_RISING_MASK) -#define SOC_INT_STATUS_MODE_SWITCH_MSB 22 -#define SOC_INT_STATUS_MODE_SWITCH_LSB 22 -#define SOC_INT_STATUS_MODE_SWITCH_MASK 0x00400000 -#define SOC_INT_STATUS_MODE_SWITCH_GET(x) (((x) & SOC_INT_STATUS_MODE_SWITCH_MASK) >> SOC_INT_STATUS_MODE_SWITCH_LSB) -#define SOC_INT_STATUS_MODE_SWITCH_SET(x) (((x) << SOC_INT_STATUS_MODE_SWITCH_LSB) & SOC_INT_STATUS_MODE_SWITCH_MASK) -#define SOC_INT_STATUS_HCI_UART_MSB 21 -#define SOC_INT_STATUS_HCI_UART_LSB 21 -#define SOC_INT_STATUS_HCI_UART_MASK 0x00200000 -#define SOC_INT_STATUS_HCI_UART_GET(x) (((x) & SOC_INT_STATUS_HCI_UART_MASK) >> SOC_INT_STATUS_HCI_UART_LSB) -#define SOC_INT_STATUS_HCI_UART_SET(x) (((x) << SOC_INT_STATUS_HCI_UART_LSB) & SOC_INT_STATUS_HCI_UART_MASK) -#define SOC_INT_STATUS_THERM_MSB 20 -#define SOC_INT_STATUS_THERM_LSB 20 -#define SOC_INT_STATUS_THERM_MASK 0x00100000 -#define SOC_INT_STATUS_THERM_GET(x) (((x) & SOC_INT_STATUS_THERM_MASK) >> SOC_INT_STATUS_THERM_LSB) -#define SOC_INT_STATUS_THERM_SET(x) (((x) << SOC_INT_STATUS_THERM_LSB) & SOC_INT_STATUS_THERM_MASK) -#define SOC_INT_STATUS_EFUSE_OVERWRITE_MSB 19 -#define SOC_INT_STATUS_EFUSE_OVERWRITE_LSB 19 -#define SOC_INT_STATUS_EFUSE_OVERWRITE_MASK 0x00080000 -#define SOC_INT_STATUS_EFUSE_OVERWRITE_GET(x) (((x) & SOC_INT_STATUS_EFUSE_OVERWRITE_MASK) >> SOC_INT_STATUS_EFUSE_OVERWRITE_LSB) -#define SOC_INT_STATUS_EFUSE_OVERWRITE_SET(x) (((x) << SOC_INT_STATUS_EFUSE_OVERWRITE_LSB) & SOC_INT_STATUS_EFUSE_OVERWRITE_MASK) -#define SOC_INT_STATUS_UART_MBOX_MSB 18 -#define SOC_INT_STATUS_UART_MBOX_LSB 18 -#define SOC_INT_STATUS_UART_MBOX_MASK 0x00040000 -#define SOC_INT_STATUS_UART_MBOX_GET(x) (((x) & SOC_INT_STATUS_UART_MBOX_MASK) >> SOC_INT_STATUS_UART_MBOX_LSB) -#define SOC_INT_STATUS_UART_MBOX_SET(x) (((x) << SOC_INT_STATUS_UART_MBOX_LSB) & SOC_INT_STATUS_UART_MBOX_MASK) -#define SOC_INT_STATUS_GENERIC_MBOX_MSB 17 -#define SOC_INT_STATUS_GENERIC_MBOX_LSB 17 -#define SOC_INT_STATUS_GENERIC_MBOX_MASK 0x00020000 -#define SOC_INT_STATUS_GENERIC_MBOX_GET(x) (((x) & SOC_INT_STATUS_GENERIC_MBOX_MASK) >> SOC_INT_STATUS_GENERIC_MBOX_LSB) -#define SOC_INT_STATUS_GENERIC_MBOX_SET(x) (((x) << SOC_INT_STATUS_GENERIC_MBOX_LSB) & SOC_INT_STATUS_GENERIC_MBOX_MASK) -#define SOC_INT_STATUS_RDMA_MSB 16 -#define SOC_INT_STATUS_RDMA_LSB 16 -#define SOC_INT_STATUS_RDMA_MASK 0x00010000 -#define SOC_INT_STATUS_RDMA_GET(x) (((x) & SOC_INT_STATUS_RDMA_MASK) >> SOC_INT_STATUS_RDMA_LSB) -#define SOC_INT_STATUS_RDMA_SET(x) (((x) << SOC_INT_STATUS_RDMA_LSB) & SOC_INT_STATUS_RDMA_MASK) -#define SOC_INT_STATUS_BTCOEX_MSB 15 -#define SOC_INT_STATUS_BTCOEX_LSB 15 -#define SOC_INT_STATUS_BTCOEX_MASK 0x00008000 -#define SOC_INT_STATUS_BTCOEX_GET(x) (((x) & SOC_INT_STATUS_BTCOEX_MASK) >> SOC_INT_STATUS_BTCOEX_LSB) -#define SOC_INT_STATUS_BTCOEX_SET(x) (((x) << SOC_INT_STATUS_BTCOEX_LSB) & SOC_INT_STATUS_BTCOEX_MASK) -#define SOC_INT_STATUS_RTC_POWER_MSB 14 -#define SOC_INT_STATUS_RTC_POWER_LSB 14 -#define SOC_INT_STATUS_RTC_POWER_MASK 0x00004000 -#define SOC_INT_STATUS_RTC_POWER_GET(x) (((x) & SOC_INT_STATUS_RTC_POWER_MASK) >> SOC_INT_STATUS_RTC_POWER_LSB) -#define SOC_INT_STATUS_RTC_POWER_SET(x) (((x) << SOC_INT_STATUS_RTC_POWER_LSB) & SOC_INT_STATUS_RTC_POWER_MASK) -#define SOC_INT_STATUS_MAC_MSB 13 -#define SOC_INT_STATUS_MAC_LSB 13 -#define SOC_INT_STATUS_MAC_MASK 0x00002000 -#define SOC_INT_STATUS_MAC_GET(x) (((x) & SOC_INT_STATUS_MAC_MASK) >> SOC_INT_STATUS_MAC_LSB) -#define SOC_INT_STATUS_MAC_SET(x) (((x) << SOC_INT_STATUS_MAC_LSB) & SOC_INT_STATUS_MAC_MASK) -#define SOC_INT_STATUS_MAILBOX_MSB 12 -#define SOC_INT_STATUS_MAILBOX_LSB 12 -#define SOC_INT_STATUS_MAILBOX_MASK 0x00001000 -#define SOC_INT_STATUS_MAILBOX_GET(x) (((x) & SOC_INT_STATUS_MAILBOX_MASK) >> SOC_INT_STATUS_MAILBOX_LSB) -#define SOC_INT_STATUS_MAILBOX_SET(x) (((x) << SOC_INT_STATUS_MAILBOX_LSB) & SOC_INT_STATUS_MAILBOX_MASK) -#define SOC_INT_STATUS_RTC_ALARM_MSB 11 -#define SOC_INT_STATUS_RTC_ALARM_LSB 11 -#define SOC_INT_STATUS_RTC_ALARM_MASK 0x00000800 -#define SOC_INT_STATUS_RTC_ALARM_GET(x) (((x) & SOC_INT_STATUS_RTC_ALARM_MASK) >> SOC_INT_STATUS_RTC_ALARM_LSB) -#define SOC_INT_STATUS_RTC_ALARM_SET(x) (((x) << SOC_INT_STATUS_RTC_ALARM_LSB) & SOC_INT_STATUS_RTC_ALARM_MASK) -#define SOC_INT_STATUS_HF_TIMER_MSB 10 -#define SOC_INT_STATUS_HF_TIMER_LSB 10 -#define SOC_INT_STATUS_HF_TIMER_MASK 0x00000400 -#define SOC_INT_STATUS_HF_TIMER_GET(x) (((x) & SOC_INT_STATUS_HF_TIMER_MASK) >> SOC_INT_STATUS_HF_TIMER_LSB) -#define SOC_INT_STATUS_HF_TIMER_SET(x) (((x) << SOC_INT_STATUS_HF_TIMER_LSB) & SOC_INT_STATUS_HF_TIMER_MASK) -#define SOC_INT_STATUS_LF_TIMER3_MSB 9 -#define SOC_INT_STATUS_LF_TIMER3_LSB 9 -#define SOC_INT_STATUS_LF_TIMER3_MASK 0x00000200 -#define SOC_INT_STATUS_LF_TIMER3_GET(x) (((x) & SOC_INT_STATUS_LF_TIMER3_MASK) >> SOC_INT_STATUS_LF_TIMER3_LSB) -#define SOC_INT_STATUS_LF_TIMER3_SET(x) (((x) << SOC_INT_STATUS_LF_TIMER3_LSB) & SOC_INT_STATUS_LF_TIMER3_MASK) -#define SOC_INT_STATUS_LF_TIMER2_MSB 8 -#define SOC_INT_STATUS_LF_TIMER2_LSB 8 -#define SOC_INT_STATUS_LF_TIMER2_MASK 0x00000100 -#define SOC_INT_STATUS_LF_TIMER2_GET(x) (((x) & SOC_INT_STATUS_LF_TIMER2_MASK) >> SOC_INT_STATUS_LF_TIMER2_LSB) -#define SOC_INT_STATUS_LF_TIMER2_SET(x) (((x) << SOC_INT_STATUS_LF_TIMER2_LSB) & SOC_INT_STATUS_LF_TIMER2_MASK) -#define SOC_INT_STATUS_LF_TIMER1_MSB 7 -#define SOC_INT_STATUS_LF_TIMER1_LSB 7 -#define SOC_INT_STATUS_LF_TIMER1_MASK 0x00000080 -#define SOC_INT_STATUS_LF_TIMER1_GET(x) (((x) & SOC_INT_STATUS_LF_TIMER1_MASK) >> SOC_INT_STATUS_LF_TIMER1_LSB) -#define SOC_INT_STATUS_LF_TIMER1_SET(x) (((x) << SOC_INT_STATUS_LF_TIMER1_LSB) & SOC_INT_STATUS_LF_TIMER1_MASK) -#define SOC_INT_STATUS_LF_TIMER0_MSB 6 -#define SOC_INT_STATUS_LF_TIMER0_LSB 6 -#define SOC_INT_STATUS_LF_TIMER0_MASK 0x00000040 -#define SOC_INT_STATUS_LF_TIMER0_GET(x) (((x) & SOC_INT_STATUS_LF_TIMER0_MASK) >> SOC_INT_STATUS_LF_TIMER0_LSB) -#define SOC_INT_STATUS_LF_TIMER0_SET(x) (((x) << SOC_INT_STATUS_LF_TIMER0_LSB) & SOC_INT_STATUS_LF_TIMER0_MASK) -#define SOC_INT_STATUS_KEYPAD_MSB 5 -#define SOC_INT_STATUS_KEYPAD_LSB 5 -#define SOC_INT_STATUS_KEYPAD_MASK 0x00000020 -#define SOC_INT_STATUS_KEYPAD_GET(x) (((x) & SOC_INT_STATUS_KEYPAD_MASK) >> SOC_INT_STATUS_KEYPAD_LSB) -#define SOC_INT_STATUS_KEYPAD_SET(x) (((x) << SOC_INT_STATUS_KEYPAD_LSB) & SOC_INT_STATUS_KEYPAD_MASK) -#define SOC_INT_STATUS_SI_MSB 4 -#define SOC_INT_STATUS_SI_LSB 4 -#define SOC_INT_STATUS_SI_MASK 0x00000010 -#define SOC_INT_STATUS_SI_GET(x) (((x) & SOC_INT_STATUS_SI_MASK) >> SOC_INT_STATUS_SI_LSB) -#define SOC_INT_STATUS_SI_SET(x) (((x) << SOC_INT_STATUS_SI_LSB) & SOC_INT_STATUS_SI_MASK) -#define SOC_INT_STATUS_GPIO_MSB 3 -#define SOC_INT_STATUS_GPIO_LSB 3 -#define SOC_INT_STATUS_GPIO_MASK 0x00000008 -#define SOC_INT_STATUS_GPIO_GET(x) (((x) & SOC_INT_STATUS_GPIO_MASK) >> SOC_INT_STATUS_GPIO_LSB) -#define SOC_INT_STATUS_GPIO_SET(x) (((x) << SOC_INT_STATUS_GPIO_LSB) & SOC_INT_STATUS_GPIO_MASK) -#define SOC_INT_STATUS_UART_MSB 2 -#define SOC_INT_STATUS_UART_LSB 2 -#define SOC_INT_STATUS_UART_MASK 0x00000004 -#define SOC_INT_STATUS_UART_GET(x) (((x) & SOC_INT_STATUS_UART_MASK) >> SOC_INT_STATUS_UART_LSB) -#define SOC_INT_STATUS_UART_SET(x) (((x) << SOC_INT_STATUS_UART_LSB) & SOC_INT_STATUS_UART_MASK) -#define SOC_INT_STATUS_ERROR_MSB 1 -#define SOC_INT_STATUS_ERROR_LSB 1 -#define SOC_INT_STATUS_ERROR_MASK 0x00000002 -#define SOC_INT_STATUS_ERROR_GET(x) (((x) & SOC_INT_STATUS_ERROR_MASK) >> SOC_INT_STATUS_ERROR_LSB) -#define SOC_INT_STATUS_ERROR_SET(x) (((x) << SOC_INT_STATUS_ERROR_LSB) & SOC_INT_STATUS_ERROR_MASK) -#define SOC_INT_STATUS_WDT_INT_MSB 0 -#define SOC_INT_STATUS_WDT_INT_LSB 0 -#define SOC_INT_STATUS_WDT_INT_MASK 0x00000001 -#define SOC_INT_STATUS_WDT_INT_GET(x) (((x) & SOC_INT_STATUS_WDT_INT_MASK) >> SOC_INT_STATUS_WDT_INT_LSB) -#define SOC_INT_STATUS_WDT_INT_SET(x) (((x) << SOC_INT_STATUS_WDT_INT_LSB) & SOC_INT_STATUS_WDT_INT_MASK) - -#define SOC_LF_TIMER0_ADDRESS 0x00000048 -#define SOC_LF_TIMER0_OFFSET 0x00000048 -#define SOC_LF_TIMER0_TARGET_MSB 31 -#define SOC_LF_TIMER0_TARGET_LSB 0 -#define SOC_LF_TIMER0_TARGET_MASK 0xffffffff -#define SOC_LF_TIMER0_TARGET_GET(x) (((x) & SOC_LF_TIMER0_TARGET_MASK) >> SOC_LF_TIMER0_TARGET_LSB) -#define SOC_LF_TIMER0_TARGET_SET(x) (((x) << SOC_LF_TIMER0_TARGET_LSB) & SOC_LF_TIMER0_TARGET_MASK) - -#define SOC_LF_TIMER_COUNT0_ADDRESS 0x0000004c -#define SOC_LF_TIMER_COUNT0_OFFSET 0x0000004c -#define SOC_LF_TIMER_COUNT0_VALUE_MSB 31 -#define SOC_LF_TIMER_COUNT0_VALUE_LSB 0 -#define SOC_LF_TIMER_COUNT0_VALUE_MASK 0xffffffff -#define SOC_LF_TIMER_COUNT0_VALUE_GET(x) (((x) & SOC_LF_TIMER_COUNT0_VALUE_MASK) >> SOC_LF_TIMER_COUNT0_VALUE_LSB) -#define SOC_LF_TIMER_COUNT0_VALUE_SET(x) (((x) << SOC_LF_TIMER_COUNT0_VALUE_LSB) & SOC_LF_TIMER_COUNT0_VALUE_MASK) - -#define SOC_LF_TIMER_CONTROL0_ADDRESS 0x00000050 -#define SOC_LF_TIMER_CONTROL0_OFFSET 0x00000050 -#define SOC_LF_TIMER_CONTROL0_ENABLE_MSB 2 -#define SOC_LF_TIMER_CONTROL0_ENABLE_LSB 2 -#define SOC_LF_TIMER_CONTROL0_ENABLE_MASK 0x00000004 -#define SOC_LF_TIMER_CONTROL0_ENABLE_GET(x) (((x) & SOC_LF_TIMER_CONTROL0_ENABLE_MASK) >> SOC_LF_TIMER_CONTROL0_ENABLE_LSB) -#define SOC_LF_TIMER_CONTROL0_ENABLE_SET(x) (((x) << SOC_LF_TIMER_CONTROL0_ENABLE_LSB) & SOC_LF_TIMER_CONTROL0_ENABLE_MASK) -#define SOC_LF_TIMER_CONTROL0_AUTO_RESTART_MSB 1 -#define SOC_LF_TIMER_CONTROL0_AUTO_RESTART_LSB 1 -#define SOC_LF_TIMER_CONTROL0_AUTO_RESTART_MASK 0x00000002 -#define SOC_LF_TIMER_CONTROL0_AUTO_RESTART_GET(x) (((x) & SOC_LF_TIMER_CONTROL0_AUTO_RESTART_MASK) >> SOC_LF_TIMER_CONTROL0_AUTO_RESTART_LSB) -#define SOC_LF_TIMER_CONTROL0_AUTO_RESTART_SET(x) (((x) << SOC_LF_TIMER_CONTROL0_AUTO_RESTART_LSB) & SOC_LF_TIMER_CONTROL0_AUTO_RESTART_MASK) -#define SOC_LF_TIMER_CONTROL0_RESET_MSB 0 -#define SOC_LF_TIMER_CONTROL0_RESET_LSB 0 -#define SOC_LF_TIMER_CONTROL0_RESET_MASK 0x00000001 -#define SOC_LF_TIMER_CONTROL0_RESET_GET(x) (((x) & SOC_LF_TIMER_CONTROL0_RESET_MASK) >> SOC_LF_TIMER_CONTROL0_RESET_LSB) -#define SOC_LF_TIMER_CONTROL0_RESET_SET(x) (((x) << SOC_LF_TIMER_CONTROL0_RESET_LSB) & SOC_LF_TIMER_CONTROL0_RESET_MASK) - -#define SOC_LF_TIMER_STATUS0_ADDRESS 0x00000054 -#define SOC_LF_TIMER_STATUS0_OFFSET 0x00000054 -#define SOC_LF_TIMER_STATUS0_INTERRUPT_MSB 0 -#define SOC_LF_TIMER_STATUS0_INTERRUPT_LSB 0 -#define SOC_LF_TIMER_STATUS0_INTERRUPT_MASK 0x00000001 -#define SOC_LF_TIMER_STATUS0_INTERRUPT_GET(x) (((x) & SOC_LF_TIMER_STATUS0_INTERRUPT_MASK) >> SOC_LF_TIMER_STATUS0_INTERRUPT_LSB) -#define SOC_LF_TIMER_STATUS0_INTERRUPT_SET(x) (((x) << SOC_LF_TIMER_STATUS0_INTERRUPT_LSB) & SOC_LF_TIMER_STATUS0_INTERRUPT_MASK) - -#define SOC_LF_TIMER1_ADDRESS 0x00000058 -#define SOC_LF_TIMER1_OFFSET 0x00000058 -#define SOC_LF_TIMER1_TARGET_MSB 31 -#define SOC_LF_TIMER1_TARGET_LSB 0 -#define SOC_LF_TIMER1_TARGET_MASK 0xffffffff -#define SOC_LF_TIMER1_TARGET_GET(x) (((x) & SOC_LF_TIMER1_TARGET_MASK) >> SOC_LF_TIMER1_TARGET_LSB) -#define SOC_LF_TIMER1_TARGET_SET(x) (((x) << SOC_LF_TIMER1_TARGET_LSB) & SOC_LF_TIMER1_TARGET_MASK) - -#define SOC_LF_TIMER_COUNT1_ADDRESS 0x0000005c -#define SOC_LF_TIMER_COUNT1_OFFSET 0x0000005c -#define SOC_LF_TIMER_COUNT1_VALUE_MSB 31 -#define SOC_LF_TIMER_COUNT1_VALUE_LSB 0 -#define SOC_LF_TIMER_COUNT1_VALUE_MASK 0xffffffff -#define SOC_LF_TIMER_COUNT1_VALUE_GET(x) (((x) & SOC_LF_TIMER_COUNT1_VALUE_MASK) >> SOC_LF_TIMER_COUNT1_VALUE_LSB) -#define SOC_LF_TIMER_COUNT1_VALUE_SET(x) (((x) << SOC_LF_TIMER_COUNT1_VALUE_LSB) & SOC_LF_TIMER_COUNT1_VALUE_MASK) - -#define SOC_LF_TIMER_CONTROL1_ADDRESS 0x00000060 -#define SOC_LF_TIMER_CONTROL1_OFFSET 0x00000060 -#define SOC_LF_TIMER_CONTROL1_ENABLE_MSB 2 -#define SOC_LF_TIMER_CONTROL1_ENABLE_LSB 2 -#define SOC_LF_TIMER_CONTROL1_ENABLE_MASK 0x00000004 -#define SOC_LF_TIMER_CONTROL1_ENABLE_GET(x) (((x) & SOC_LF_TIMER_CONTROL1_ENABLE_MASK) >> SOC_LF_TIMER_CONTROL1_ENABLE_LSB) -#define SOC_LF_TIMER_CONTROL1_ENABLE_SET(x) (((x) << SOC_LF_TIMER_CONTROL1_ENABLE_LSB) & SOC_LF_TIMER_CONTROL1_ENABLE_MASK) -#define SOC_LF_TIMER_CONTROL1_AUTO_RESTART_MSB 1 -#define SOC_LF_TIMER_CONTROL1_AUTO_RESTART_LSB 1 -#define SOC_LF_TIMER_CONTROL1_AUTO_RESTART_MASK 0x00000002 -#define SOC_LF_TIMER_CONTROL1_AUTO_RESTART_GET(x) (((x) & SOC_LF_TIMER_CONTROL1_AUTO_RESTART_MASK) >> SOC_LF_TIMER_CONTROL1_AUTO_RESTART_LSB) -#define SOC_LF_TIMER_CONTROL1_AUTO_RESTART_SET(x) (((x) << SOC_LF_TIMER_CONTROL1_AUTO_RESTART_LSB) & SOC_LF_TIMER_CONTROL1_AUTO_RESTART_MASK) -#define SOC_LF_TIMER_CONTROL1_RESET_MSB 0 -#define SOC_LF_TIMER_CONTROL1_RESET_LSB 0 -#define SOC_LF_TIMER_CONTROL1_RESET_MASK 0x00000001 -#define SOC_LF_TIMER_CONTROL1_RESET_GET(x) (((x) & SOC_LF_TIMER_CONTROL1_RESET_MASK) >> SOC_LF_TIMER_CONTROL1_RESET_LSB) -#define SOC_LF_TIMER_CONTROL1_RESET_SET(x) (((x) << SOC_LF_TIMER_CONTROL1_RESET_LSB) & SOC_LF_TIMER_CONTROL1_RESET_MASK) - -#define SOC_LF_TIMER_STATUS1_ADDRESS 0x00000064 -#define SOC_LF_TIMER_STATUS1_OFFSET 0x00000064 -#define SOC_LF_TIMER_STATUS1_INTERRUPT_MSB 0 -#define SOC_LF_TIMER_STATUS1_INTERRUPT_LSB 0 -#define SOC_LF_TIMER_STATUS1_INTERRUPT_MASK 0x00000001 -#define SOC_LF_TIMER_STATUS1_INTERRUPT_GET(x) (((x) & SOC_LF_TIMER_STATUS1_INTERRUPT_MASK) >> SOC_LF_TIMER_STATUS1_INTERRUPT_LSB) -#define SOC_LF_TIMER_STATUS1_INTERRUPT_SET(x) (((x) << SOC_LF_TIMER_STATUS1_INTERRUPT_LSB) & SOC_LF_TIMER_STATUS1_INTERRUPT_MASK) - -#define SOC_LF_TIMER2_ADDRESS 0x00000068 -#define SOC_LF_TIMER2_OFFSET 0x00000068 -#define SOC_LF_TIMER2_TARGET_MSB 31 -#define SOC_LF_TIMER2_TARGET_LSB 0 -#define SOC_LF_TIMER2_TARGET_MASK 0xffffffff -#define SOC_LF_TIMER2_TARGET_GET(x) (((x) & SOC_LF_TIMER2_TARGET_MASK) >> SOC_LF_TIMER2_TARGET_LSB) -#define SOC_LF_TIMER2_TARGET_SET(x) (((x) << SOC_LF_TIMER2_TARGET_LSB) & SOC_LF_TIMER2_TARGET_MASK) - -#define SOC_LF_TIMER_COUNT2_ADDRESS 0x0000006c -#define SOC_LF_TIMER_COUNT2_OFFSET 0x0000006c -#define SOC_LF_TIMER_COUNT2_VALUE_MSB 31 -#define SOC_LF_TIMER_COUNT2_VALUE_LSB 0 -#define SOC_LF_TIMER_COUNT2_VALUE_MASK 0xffffffff -#define SOC_LF_TIMER_COUNT2_VALUE_GET(x) (((x) & SOC_LF_TIMER_COUNT2_VALUE_MASK) >> SOC_LF_TIMER_COUNT2_VALUE_LSB) -#define SOC_LF_TIMER_COUNT2_VALUE_SET(x) (((x) << SOC_LF_TIMER_COUNT2_VALUE_LSB) & SOC_LF_TIMER_COUNT2_VALUE_MASK) - -#define SOC_LF_TIMER_CONTROL2_ADDRESS 0x00000070 -#define SOC_LF_TIMER_CONTROL2_OFFSET 0x00000070 -#define SOC_LF_TIMER_CONTROL2_ENABLE_MSB 2 -#define SOC_LF_TIMER_CONTROL2_ENABLE_LSB 2 -#define SOC_LF_TIMER_CONTROL2_ENABLE_MASK 0x00000004 -#define SOC_LF_TIMER_CONTROL2_ENABLE_GET(x) (((x) & SOC_LF_TIMER_CONTROL2_ENABLE_MASK) >> SOC_LF_TIMER_CONTROL2_ENABLE_LSB) -#define SOC_LF_TIMER_CONTROL2_ENABLE_SET(x) (((x) << SOC_LF_TIMER_CONTROL2_ENABLE_LSB) & SOC_LF_TIMER_CONTROL2_ENABLE_MASK) -#define SOC_LF_TIMER_CONTROL2_AUTO_RESTART_MSB 1 -#define SOC_LF_TIMER_CONTROL2_AUTO_RESTART_LSB 1 -#define SOC_LF_TIMER_CONTROL2_AUTO_RESTART_MASK 0x00000002 -#define SOC_LF_TIMER_CONTROL2_AUTO_RESTART_GET(x) (((x) & SOC_LF_TIMER_CONTROL2_AUTO_RESTART_MASK) >> SOC_LF_TIMER_CONTROL2_AUTO_RESTART_LSB) -#define SOC_LF_TIMER_CONTROL2_AUTO_RESTART_SET(x) (((x) << SOC_LF_TIMER_CONTROL2_AUTO_RESTART_LSB) & SOC_LF_TIMER_CONTROL2_AUTO_RESTART_MASK) -#define SOC_LF_TIMER_CONTROL2_RESET_MSB 0 -#define SOC_LF_TIMER_CONTROL2_RESET_LSB 0 -#define SOC_LF_TIMER_CONTROL2_RESET_MASK 0x00000001 -#define SOC_LF_TIMER_CONTROL2_RESET_GET(x) (((x) & SOC_LF_TIMER_CONTROL2_RESET_MASK) >> SOC_LF_TIMER_CONTROL2_RESET_LSB) -#define SOC_LF_TIMER_CONTROL2_RESET_SET(x) (((x) << SOC_LF_TIMER_CONTROL2_RESET_LSB) & SOC_LF_TIMER_CONTROL2_RESET_MASK) - -#define SOC_LF_TIMER_STATUS2_ADDRESS 0x00000074 -#define SOC_LF_TIMER_STATUS2_OFFSET 0x00000074 -#define SOC_LF_TIMER_STATUS2_INTERRUPT_MSB 0 -#define SOC_LF_TIMER_STATUS2_INTERRUPT_LSB 0 -#define SOC_LF_TIMER_STATUS2_INTERRUPT_MASK 0x00000001 -#define SOC_LF_TIMER_STATUS2_INTERRUPT_GET(x) (((x) & SOC_LF_TIMER_STATUS2_INTERRUPT_MASK) >> SOC_LF_TIMER_STATUS2_INTERRUPT_LSB) -#define SOC_LF_TIMER_STATUS2_INTERRUPT_SET(x) (((x) << SOC_LF_TIMER_STATUS2_INTERRUPT_LSB) & SOC_LF_TIMER_STATUS2_INTERRUPT_MASK) - -#define SOC_LF_TIMER3_ADDRESS 0x00000078 -#define SOC_LF_TIMER3_OFFSET 0x00000078 -#define SOC_LF_TIMER3_TARGET_MSB 31 -#define SOC_LF_TIMER3_TARGET_LSB 0 -#define SOC_LF_TIMER3_TARGET_MASK 0xffffffff -#define SOC_LF_TIMER3_TARGET_GET(x) (((x) & SOC_LF_TIMER3_TARGET_MASK) >> SOC_LF_TIMER3_TARGET_LSB) -#define SOC_LF_TIMER3_TARGET_SET(x) (((x) << SOC_LF_TIMER3_TARGET_LSB) & SOC_LF_TIMER3_TARGET_MASK) - -#define SOC_LF_TIMER_COUNT3_ADDRESS 0x0000007c -#define SOC_LF_TIMER_COUNT3_OFFSET 0x0000007c -#define SOC_LF_TIMER_COUNT3_VALUE_MSB 31 -#define SOC_LF_TIMER_COUNT3_VALUE_LSB 0 -#define SOC_LF_TIMER_COUNT3_VALUE_MASK 0xffffffff -#define SOC_LF_TIMER_COUNT3_VALUE_GET(x) (((x) & SOC_LF_TIMER_COUNT3_VALUE_MASK) >> SOC_LF_TIMER_COUNT3_VALUE_LSB) -#define SOC_LF_TIMER_COUNT3_VALUE_SET(x) (((x) << SOC_LF_TIMER_COUNT3_VALUE_LSB) & SOC_LF_TIMER_COUNT3_VALUE_MASK) - -#define SOC_LF_TIMER_CONTROL3_ADDRESS 0x00000080 -#define SOC_LF_TIMER_CONTROL3_OFFSET 0x00000080 -#define SOC_LF_TIMER_CONTROL3_ENABLE_MSB 2 -#define SOC_LF_TIMER_CONTROL3_ENABLE_LSB 2 -#define SOC_LF_TIMER_CONTROL3_ENABLE_MASK 0x00000004 -#define SOC_LF_TIMER_CONTROL3_ENABLE_GET(x) (((x) & SOC_LF_TIMER_CONTROL3_ENABLE_MASK) >> SOC_LF_TIMER_CONTROL3_ENABLE_LSB) -#define SOC_LF_TIMER_CONTROL3_ENABLE_SET(x) (((x) << SOC_LF_TIMER_CONTROL3_ENABLE_LSB) & SOC_LF_TIMER_CONTROL3_ENABLE_MASK) -#define SOC_LF_TIMER_CONTROL3_AUTO_RESTART_MSB 1 -#define SOC_LF_TIMER_CONTROL3_AUTO_RESTART_LSB 1 -#define SOC_LF_TIMER_CONTROL3_AUTO_RESTART_MASK 0x00000002 -#define SOC_LF_TIMER_CONTROL3_AUTO_RESTART_GET(x) (((x) & SOC_LF_TIMER_CONTROL3_AUTO_RESTART_MASK) >> SOC_LF_TIMER_CONTROL3_AUTO_RESTART_LSB) -#define SOC_LF_TIMER_CONTROL3_AUTO_RESTART_SET(x) (((x) << SOC_LF_TIMER_CONTROL3_AUTO_RESTART_LSB) & SOC_LF_TIMER_CONTROL3_AUTO_RESTART_MASK) -#define SOC_LF_TIMER_CONTROL3_RESET_MSB 0 -#define SOC_LF_TIMER_CONTROL3_RESET_LSB 0 -#define SOC_LF_TIMER_CONTROL3_RESET_MASK 0x00000001 -#define SOC_LF_TIMER_CONTROL3_RESET_GET(x) (((x) & SOC_LF_TIMER_CONTROL3_RESET_MASK) >> SOC_LF_TIMER_CONTROL3_RESET_LSB) -#define SOC_LF_TIMER_CONTROL3_RESET_SET(x) (((x) << SOC_LF_TIMER_CONTROL3_RESET_LSB) & SOC_LF_TIMER_CONTROL3_RESET_MASK) - -#define SOC_LF_TIMER_STATUS3_ADDRESS 0x00000084 -#define SOC_LF_TIMER_STATUS3_OFFSET 0x00000084 -#define SOC_LF_TIMER_STATUS3_INTERRUPT_MSB 0 -#define SOC_LF_TIMER_STATUS3_INTERRUPT_LSB 0 -#define SOC_LF_TIMER_STATUS3_INTERRUPT_MASK 0x00000001 -#define SOC_LF_TIMER_STATUS3_INTERRUPT_GET(x) (((x) & SOC_LF_TIMER_STATUS3_INTERRUPT_MASK) >> SOC_LF_TIMER_STATUS3_INTERRUPT_LSB) -#define SOC_LF_TIMER_STATUS3_INTERRUPT_SET(x) (((x) << SOC_LF_TIMER_STATUS3_INTERRUPT_LSB) & SOC_LF_TIMER_STATUS3_INTERRUPT_MASK) - -#define SOC_HF_TIMER_ADDRESS 0x00000088 -#define SOC_HF_TIMER_OFFSET 0x00000088 -#define SOC_HF_TIMER_TARGET_MSB 31 -#define SOC_HF_TIMER_TARGET_LSB 12 -#define SOC_HF_TIMER_TARGET_MASK 0xfffff000 -#define SOC_HF_TIMER_TARGET_GET(x) (((x) & SOC_HF_TIMER_TARGET_MASK) >> SOC_HF_TIMER_TARGET_LSB) -#define SOC_HF_TIMER_TARGET_SET(x) (((x) << SOC_HF_TIMER_TARGET_LSB) & SOC_HF_TIMER_TARGET_MASK) - -#define SOC_HF_TIMER_COUNT_ADDRESS 0x0000008c -#define SOC_HF_TIMER_COUNT_OFFSET 0x0000008c -#define SOC_HF_TIMER_COUNT_VALUE_MSB 31 -#define SOC_HF_TIMER_COUNT_VALUE_LSB 12 -#define SOC_HF_TIMER_COUNT_VALUE_MASK 0xfffff000 -#define SOC_HF_TIMER_COUNT_VALUE_GET(x) (((x) & SOC_HF_TIMER_COUNT_VALUE_MASK) >> SOC_HF_TIMER_COUNT_VALUE_LSB) -#define SOC_HF_TIMER_COUNT_VALUE_SET(x) (((x) << SOC_HF_TIMER_COUNT_VALUE_LSB) & SOC_HF_TIMER_COUNT_VALUE_MASK) - -#define SOC_HF_LF_COUNT_ADDRESS 0x00000090 -#define SOC_HF_LF_COUNT_OFFSET 0x00000090 -#define SOC_HF_LF_COUNT_VALUE_MSB 31 -#define SOC_HF_LF_COUNT_VALUE_LSB 0 -#define SOC_HF_LF_COUNT_VALUE_MASK 0xffffffff -#define SOC_HF_LF_COUNT_VALUE_GET(x) (((x) & SOC_HF_LF_COUNT_VALUE_MASK) >> SOC_HF_LF_COUNT_VALUE_LSB) -#define SOC_HF_LF_COUNT_VALUE_SET(x) (((x) << SOC_HF_LF_COUNT_VALUE_LSB) & SOC_HF_LF_COUNT_VALUE_MASK) - -#define SOC_HF_TIMER_CONTROL_ADDRESS 0x00000094 -#define SOC_HF_TIMER_CONTROL_OFFSET 0x00000094 -#define SOC_HF_TIMER_CONTROL_ENABLE_MSB 3 -#define SOC_HF_TIMER_CONTROL_ENABLE_LSB 3 -#define SOC_HF_TIMER_CONTROL_ENABLE_MASK 0x00000008 -#define SOC_HF_TIMER_CONTROL_ENABLE_GET(x) (((x) & SOC_HF_TIMER_CONTROL_ENABLE_MASK) >> SOC_HF_TIMER_CONTROL_ENABLE_LSB) -#define SOC_HF_TIMER_CONTROL_ENABLE_SET(x) (((x) << SOC_HF_TIMER_CONTROL_ENABLE_LSB) & SOC_HF_TIMER_CONTROL_ENABLE_MASK) -#define SOC_HF_TIMER_CONTROL_ON_MSB 2 -#define SOC_HF_TIMER_CONTROL_ON_LSB 2 -#define SOC_HF_TIMER_CONTROL_ON_MASK 0x00000004 -#define SOC_HF_TIMER_CONTROL_ON_GET(x) (((x) & SOC_HF_TIMER_CONTROL_ON_MASK) >> SOC_HF_TIMER_CONTROL_ON_LSB) -#define SOC_HF_TIMER_CONTROL_ON_SET(x) (((x) << SOC_HF_TIMER_CONTROL_ON_LSB) & SOC_HF_TIMER_CONTROL_ON_MASK) -#define SOC_HF_TIMER_CONTROL_AUTO_RESTART_MSB 1 -#define SOC_HF_TIMER_CONTROL_AUTO_RESTART_LSB 1 -#define SOC_HF_TIMER_CONTROL_AUTO_RESTART_MASK 0x00000002 -#define SOC_HF_TIMER_CONTROL_AUTO_RESTART_GET(x) (((x) & SOC_HF_TIMER_CONTROL_AUTO_RESTART_MASK) >> SOC_HF_TIMER_CONTROL_AUTO_RESTART_LSB) -#define SOC_HF_TIMER_CONTROL_AUTO_RESTART_SET(x) (((x) << SOC_HF_TIMER_CONTROL_AUTO_RESTART_LSB) & SOC_HF_TIMER_CONTROL_AUTO_RESTART_MASK) -#define SOC_HF_TIMER_CONTROL_RESET_MSB 0 -#define SOC_HF_TIMER_CONTROL_RESET_LSB 0 -#define SOC_HF_TIMER_CONTROL_RESET_MASK 0x00000001 -#define SOC_HF_TIMER_CONTROL_RESET_GET(x) (((x) & SOC_HF_TIMER_CONTROL_RESET_MASK) >> SOC_HF_TIMER_CONTROL_RESET_LSB) -#define SOC_HF_TIMER_CONTROL_RESET_SET(x) (((x) << SOC_HF_TIMER_CONTROL_RESET_LSB) & SOC_HF_TIMER_CONTROL_RESET_MASK) - -#define SOC_HF_TIMER_STATUS_ADDRESS 0x00000098 -#define SOC_HF_TIMER_STATUS_OFFSET 0x00000098 -#define SOC_HF_TIMER_STATUS_INTERRUPT_MSB 0 -#define SOC_HF_TIMER_STATUS_INTERRUPT_LSB 0 -#define SOC_HF_TIMER_STATUS_INTERRUPT_MASK 0x00000001 -#define SOC_HF_TIMER_STATUS_INTERRUPT_GET(x) (((x) & SOC_HF_TIMER_STATUS_INTERRUPT_MASK) >> SOC_HF_TIMER_STATUS_INTERRUPT_LSB) -#define SOC_HF_TIMER_STATUS_INTERRUPT_SET(x) (((x) << SOC_HF_TIMER_STATUS_INTERRUPT_LSB) & SOC_HF_TIMER_STATUS_INTERRUPT_MASK) - -#define SOC_RTC_CONTROL_ADDRESS 0x0000009c -#define SOC_RTC_CONTROL_OFFSET 0x0000009c -#define SOC_RTC_CONTROL_ENABLE_MSB 2 -#define SOC_RTC_CONTROL_ENABLE_LSB 2 -#define SOC_RTC_CONTROL_ENABLE_MASK 0x00000004 -#define SOC_RTC_CONTROL_ENABLE_GET(x) (((x) & SOC_RTC_CONTROL_ENABLE_MASK) >> SOC_RTC_CONTROL_ENABLE_LSB) -#define SOC_RTC_CONTROL_ENABLE_SET(x) (((x) << SOC_RTC_CONTROL_ENABLE_LSB) & SOC_RTC_CONTROL_ENABLE_MASK) -#define SOC_RTC_CONTROL_LOAD_RTC_MSB 1 -#define SOC_RTC_CONTROL_LOAD_RTC_LSB 1 -#define SOC_RTC_CONTROL_LOAD_RTC_MASK 0x00000002 -#define SOC_RTC_CONTROL_LOAD_RTC_GET(x) (((x) & SOC_RTC_CONTROL_LOAD_RTC_MASK) >> SOC_RTC_CONTROL_LOAD_RTC_LSB) -#define SOC_RTC_CONTROL_LOAD_RTC_SET(x) (((x) << SOC_RTC_CONTROL_LOAD_RTC_LSB) & SOC_RTC_CONTROL_LOAD_RTC_MASK) -#define SOC_RTC_CONTROL_LOAD_ALARM_MSB 0 -#define SOC_RTC_CONTROL_LOAD_ALARM_LSB 0 -#define SOC_RTC_CONTROL_LOAD_ALARM_MASK 0x00000001 -#define SOC_RTC_CONTROL_LOAD_ALARM_GET(x) (((x) & SOC_RTC_CONTROL_LOAD_ALARM_MASK) >> SOC_RTC_CONTROL_LOAD_ALARM_LSB) -#define SOC_RTC_CONTROL_LOAD_ALARM_SET(x) (((x) << SOC_RTC_CONTROL_LOAD_ALARM_LSB) & SOC_RTC_CONTROL_LOAD_ALARM_MASK) - -#define SOC_RTC_TIME_ADDRESS 0x000000a0 -#define SOC_RTC_TIME_OFFSET 0x000000a0 -#define SOC_RTC_TIME_WEEK_DAY_MSB 26 -#define SOC_RTC_TIME_WEEK_DAY_LSB 24 -#define SOC_RTC_TIME_WEEK_DAY_MASK 0x07000000 -#define SOC_RTC_TIME_WEEK_DAY_GET(x) (((x) & SOC_RTC_TIME_WEEK_DAY_MASK) >> SOC_RTC_TIME_WEEK_DAY_LSB) -#define SOC_RTC_TIME_WEEK_DAY_SET(x) (((x) << SOC_RTC_TIME_WEEK_DAY_LSB) & SOC_RTC_TIME_WEEK_DAY_MASK) -#define SOC_RTC_TIME_HOUR_MSB 21 -#define SOC_RTC_TIME_HOUR_LSB 16 -#define SOC_RTC_TIME_HOUR_MASK 0x003f0000 -#define SOC_RTC_TIME_HOUR_GET(x) (((x) & SOC_RTC_TIME_HOUR_MASK) >> SOC_RTC_TIME_HOUR_LSB) -#define SOC_RTC_TIME_HOUR_SET(x) (((x) << SOC_RTC_TIME_HOUR_LSB) & SOC_RTC_TIME_HOUR_MASK) -#define SOC_RTC_TIME_MINUTE_MSB 14 -#define SOC_RTC_TIME_MINUTE_LSB 8 -#define SOC_RTC_TIME_MINUTE_MASK 0x00007f00 -#define SOC_RTC_TIME_MINUTE_GET(x) (((x) & SOC_RTC_TIME_MINUTE_MASK) >> SOC_RTC_TIME_MINUTE_LSB) -#define SOC_RTC_TIME_MINUTE_SET(x) (((x) << SOC_RTC_TIME_MINUTE_LSB) & SOC_RTC_TIME_MINUTE_MASK) -#define SOC_RTC_TIME_SECOND_MSB 6 -#define SOC_RTC_TIME_SECOND_LSB 0 -#define SOC_RTC_TIME_SECOND_MASK 0x0000007f -#define SOC_RTC_TIME_SECOND_GET(x) (((x) & SOC_RTC_TIME_SECOND_MASK) >> SOC_RTC_TIME_SECOND_LSB) -#define SOC_RTC_TIME_SECOND_SET(x) (((x) << SOC_RTC_TIME_SECOND_LSB) & SOC_RTC_TIME_SECOND_MASK) - -#define SOC_RTC_DATE_ADDRESS 0x000000a4 -#define SOC_RTC_DATE_OFFSET 0x000000a4 -#define SOC_RTC_DATE_YEAR_MSB 23 -#define SOC_RTC_DATE_YEAR_LSB 16 -#define SOC_RTC_DATE_YEAR_MASK 0x00ff0000 -#define SOC_RTC_DATE_YEAR_GET(x) (((x) & SOC_RTC_DATE_YEAR_MASK) >> SOC_RTC_DATE_YEAR_LSB) -#define SOC_RTC_DATE_YEAR_SET(x) (((x) << SOC_RTC_DATE_YEAR_LSB) & SOC_RTC_DATE_YEAR_MASK) -#define SOC_RTC_DATE_MONTH_MSB 12 -#define SOC_RTC_DATE_MONTH_LSB 8 -#define SOC_RTC_DATE_MONTH_MASK 0x00001f00 -#define SOC_RTC_DATE_MONTH_GET(x) (((x) & SOC_RTC_DATE_MONTH_MASK) >> SOC_RTC_DATE_MONTH_LSB) -#define SOC_RTC_DATE_MONTH_SET(x) (((x) << SOC_RTC_DATE_MONTH_LSB) & SOC_RTC_DATE_MONTH_MASK) -#define SOC_RTC_DATE_MONTH_DAY_MSB 5 -#define SOC_RTC_DATE_MONTH_DAY_LSB 0 -#define SOC_RTC_DATE_MONTH_DAY_MASK 0x0000003f -#define SOC_RTC_DATE_MONTH_DAY_GET(x) (((x) & SOC_RTC_DATE_MONTH_DAY_MASK) >> SOC_RTC_DATE_MONTH_DAY_LSB) -#define SOC_RTC_DATE_MONTH_DAY_SET(x) (((x) << SOC_RTC_DATE_MONTH_DAY_LSB) & SOC_RTC_DATE_MONTH_DAY_MASK) - -#define SOC_RTC_SET_TIME_ADDRESS 0x000000a8 -#define SOC_RTC_SET_TIME_OFFSET 0x000000a8 -#define SOC_RTC_SET_TIME_WEEK_DAY_MSB 26 -#define SOC_RTC_SET_TIME_WEEK_DAY_LSB 24 -#define SOC_RTC_SET_TIME_WEEK_DAY_MASK 0x07000000 -#define SOC_RTC_SET_TIME_WEEK_DAY_GET(x) (((x) & SOC_RTC_SET_TIME_WEEK_DAY_MASK) >> SOC_RTC_SET_TIME_WEEK_DAY_LSB) -#define SOC_RTC_SET_TIME_WEEK_DAY_SET(x) (((x) << SOC_RTC_SET_TIME_WEEK_DAY_LSB) & SOC_RTC_SET_TIME_WEEK_DAY_MASK) -#define SOC_RTC_SET_TIME_HOUR_MSB 21 -#define SOC_RTC_SET_TIME_HOUR_LSB 16 -#define SOC_RTC_SET_TIME_HOUR_MASK 0x003f0000 -#define SOC_RTC_SET_TIME_HOUR_GET(x) (((x) & SOC_RTC_SET_TIME_HOUR_MASK) >> SOC_RTC_SET_TIME_HOUR_LSB) -#define SOC_RTC_SET_TIME_HOUR_SET(x) (((x) << SOC_RTC_SET_TIME_HOUR_LSB) & SOC_RTC_SET_TIME_HOUR_MASK) -#define SOC_RTC_SET_TIME_MINUTE_MSB 14 -#define SOC_RTC_SET_TIME_MINUTE_LSB 8 -#define SOC_RTC_SET_TIME_MINUTE_MASK 0x00007f00 -#define SOC_RTC_SET_TIME_MINUTE_GET(x) (((x) & SOC_RTC_SET_TIME_MINUTE_MASK) >> SOC_RTC_SET_TIME_MINUTE_LSB) -#define SOC_RTC_SET_TIME_MINUTE_SET(x) (((x) << SOC_RTC_SET_TIME_MINUTE_LSB) & SOC_RTC_SET_TIME_MINUTE_MASK) -#define SOC_RTC_SET_TIME_SECOND_MSB 6 -#define SOC_RTC_SET_TIME_SECOND_LSB 0 -#define SOC_RTC_SET_TIME_SECOND_MASK 0x0000007f -#define SOC_RTC_SET_TIME_SECOND_GET(x) (((x) & SOC_RTC_SET_TIME_SECOND_MASK) >> SOC_RTC_SET_TIME_SECOND_LSB) -#define SOC_RTC_SET_TIME_SECOND_SET(x) (((x) << SOC_RTC_SET_TIME_SECOND_LSB) & SOC_RTC_SET_TIME_SECOND_MASK) - -#define SOC_RTC_SET_DATE_ADDRESS 0x000000ac -#define SOC_RTC_SET_DATE_OFFSET 0x000000ac -#define SOC_RTC_SET_DATE_YEAR_MSB 23 -#define SOC_RTC_SET_DATE_YEAR_LSB 16 -#define SOC_RTC_SET_DATE_YEAR_MASK 0x00ff0000 -#define SOC_RTC_SET_DATE_YEAR_GET(x) (((x) & SOC_RTC_SET_DATE_YEAR_MASK) >> SOC_RTC_SET_DATE_YEAR_LSB) -#define SOC_RTC_SET_DATE_YEAR_SET(x) (((x) << SOC_RTC_SET_DATE_YEAR_LSB) & SOC_RTC_SET_DATE_YEAR_MASK) -#define SOC_RTC_SET_DATE_MONTH_MSB 12 -#define SOC_RTC_SET_DATE_MONTH_LSB 8 -#define SOC_RTC_SET_DATE_MONTH_MASK 0x00001f00 -#define SOC_RTC_SET_DATE_MONTH_GET(x) (((x) & SOC_RTC_SET_DATE_MONTH_MASK) >> SOC_RTC_SET_DATE_MONTH_LSB) -#define SOC_RTC_SET_DATE_MONTH_SET(x) (((x) << SOC_RTC_SET_DATE_MONTH_LSB) & SOC_RTC_SET_DATE_MONTH_MASK) -#define SOC_RTC_SET_DATE_MONTH_DAY_MSB 5 -#define SOC_RTC_SET_DATE_MONTH_DAY_LSB 0 -#define SOC_RTC_SET_DATE_MONTH_DAY_MASK 0x0000003f -#define SOC_RTC_SET_DATE_MONTH_DAY_GET(x) (((x) & SOC_RTC_SET_DATE_MONTH_DAY_MASK) >> SOC_RTC_SET_DATE_MONTH_DAY_LSB) -#define SOC_RTC_SET_DATE_MONTH_DAY_SET(x) (((x) << SOC_RTC_SET_DATE_MONTH_DAY_LSB) & SOC_RTC_SET_DATE_MONTH_DAY_MASK) - -#define SOC_RTC_SET_ALARM_ADDRESS 0x000000b0 -#define SOC_RTC_SET_ALARM_OFFSET 0x000000b0 -#define SOC_RTC_SET_ALARM_HOUR_MSB 21 -#define SOC_RTC_SET_ALARM_HOUR_LSB 16 -#define SOC_RTC_SET_ALARM_HOUR_MASK 0x003f0000 -#define SOC_RTC_SET_ALARM_HOUR_GET(x) (((x) & SOC_RTC_SET_ALARM_HOUR_MASK) >> SOC_RTC_SET_ALARM_HOUR_LSB) -#define SOC_RTC_SET_ALARM_HOUR_SET(x) (((x) << SOC_RTC_SET_ALARM_HOUR_LSB) & SOC_RTC_SET_ALARM_HOUR_MASK) -#define SOC_RTC_SET_ALARM_MINUTE_MSB 14 -#define SOC_RTC_SET_ALARM_MINUTE_LSB 8 -#define SOC_RTC_SET_ALARM_MINUTE_MASK 0x00007f00 -#define SOC_RTC_SET_ALARM_MINUTE_GET(x) (((x) & SOC_RTC_SET_ALARM_MINUTE_MASK) >> SOC_RTC_SET_ALARM_MINUTE_LSB) -#define SOC_RTC_SET_ALARM_MINUTE_SET(x) (((x) << SOC_RTC_SET_ALARM_MINUTE_LSB) & SOC_RTC_SET_ALARM_MINUTE_MASK) -#define SOC_RTC_SET_ALARM_SECOND_MSB 6 -#define SOC_RTC_SET_ALARM_SECOND_LSB 0 -#define SOC_RTC_SET_ALARM_SECOND_MASK 0x0000007f -#define SOC_RTC_SET_ALARM_SECOND_GET(x) (((x) & SOC_RTC_SET_ALARM_SECOND_MASK) >> SOC_RTC_SET_ALARM_SECOND_LSB) -#define SOC_RTC_SET_ALARM_SECOND_SET(x) (((x) << SOC_RTC_SET_ALARM_SECOND_LSB) & SOC_RTC_SET_ALARM_SECOND_MASK) - -#define SOC_RTC_CONFIG_ADDRESS 0x000000b4 -#define SOC_RTC_CONFIG_OFFSET 0x000000b4 -#define SOC_RTC_CONFIG_BCD_MSB 2 -#define SOC_RTC_CONFIG_BCD_LSB 2 -#define SOC_RTC_CONFIG_BCD_MASK 0x00000004 -#define SOC_RTC_CONFIG_BCD_GET(x) (((x) & SOC_RTC_CONFIG_BCD_MASK) >> SOC_RTC_CONFIG_BCD_LSB) -#define SOC_RTC_CONFIG_BCD_SET(x) (((x) << SOC_RTC_CONFIG_BCD_LSB) & SOC_RTC_CONFIG_BCD_MASK) -#define SOC_RTC_CONFIG_TWELVE_HOUR_MSB 1 -#define SOC_RTC_CONFIG_TWELVE_HOUR_LSB 1 -#define SOC_RTC_CONFIG_TWELVE_HOUR_MASK 0x00000002 -#define SOC_RTC_CONFIG_TWELVE_HOUR_GET(x) (((x) & SOC_RTC_CONFIG_TWELVE_HOUR_MASK) >> SOC_RTC_CONFIG_TWELVE_HOUR_LSB) -#define SOC_RTC_CONFIG_TWELVE_HOUR_SET(x) (((x) << SOC_RTC_CONFIG_TWELVE_HOUR_LSB) & SOC_RTC_CONFIG_TWELVE_HOUR_MASK) -#define SOC_RTC_CONFIG_DSE_MSB 0 -#define SOC_RTC_CONFIG_DSE_LSB 0 -#define SOC_RTC_CONFIG_DSE_MASK 0x00000001 -#define SOC_RTC_CONFIG_DSE_GET(x) (((x) & SOC_RTC_CONFIG_DSE_MASK) >> SOC_RTC_CONFIG_DSE_LSB) -#define SOC_RTC_CONFIG_DSE_SET(x) (((x) << SOC_RTC_CONFIG_DSE_LSB) & SOC_RTC_CONFIG_DSE_MASK) - -#define SOC_RTC_ALARM_STATUS_ADDRESS 0x000000b8 -#define SOC_RTC_ALARM_STATUS_OFFSET 0x000000b8 -#define SOC_RTC_ALARM_STATUS_ENABLE_MSB 1 -#define SOC_RTC_ALARM_STATUS_ENABLE_LSB 1 -#define SOC_RTC_ALARM_STATUS_ENABLE_MASK 0x00000002 -#define SOC_RTC_ALARM_STATUS_ENABLE_GET(x) (((x) & SOC_RTC_ALARM_STATUS_ENABLE_MASK) >> SOC_RTC_ALARM_STATUS_ENABLE_LSB) -#define SOC_RTC_ALARM_STATUS_ENABLE_SET(x) (((x) << SOC_RTC_ALARM_STATUS_ENABLE_LSB) & SOC_RTC_ALARM_STATUS_ENABLE_MASK) -#define SOC_RTC_ALARM_STATUS_INTERRUPT_MSB 0 -#define SOC_RTC_ALARM_STATUS_INTERRUPT_LSB 0 -#define SOC_RTC_ALARM_STATUS_INTERRUPT_MASK 0x00000001 -#define SOC_RTC_ALARM_STATUS_INTERRUPT_GET(x) (((x) & SOC_RTC_ALARM_STATUS_INTERRUPT_MASK) >> SOC_RTC_ALARM_STATUS_INTERRUPT_LSB) -#define SOC_RTC_ALARM_STATUS_INTERRUPT_SET(x) (((x) << SOC_RTC_ALARM_STATUS_INTERRUPT_LSB) & SOC_RTC_ALARM_STATUS_INTERRUPT_MASK) - -#define SOC_UART_WAKEUP_ADDRESS 0x000000bc -#define SOC_UART_WAKEUP_OFFSET 0x000000bc -#define SOC_UART_WAKEUP_ENABLE_MSB 0 -#define SOC_UART_WAKEUP_ENABLE_LSB 0 -#define SOC_UART_WAKEUP_ENABLE_MASK 0x00000001 -#define SOC_UART_WAKEUP_ENABLE_GET(x) (((x) & SOC_UART_WAKEUP_ENABLE_MASK) >> SOC_UART_WAKEUP_ENABLE_LSB) -#define SOC_UART_WAKEUP_ENABLE_SET(x) (((x) << SOC_UART_WAKEUP_ENABLE_LSB) & SOC_UART_WAKEUP_ENABLE_MASK) - -#define SOC_RESET_CAUSE_ADDRESS 0x000000c0 -#define SOC_RESET_CAUSE_OFFSET 0x000000c0 -#define SOC_RESET_CAUSE_LAST_MSB 2 -#define SOC_RESET_CAUSE_LAST_LSB 0 -#define SOC_RESET_CAUSE_LAST_MASK 0x00000007 -#define SOC_RESET_CAUSE_LAST_GET(x) (((x) & SOC_RESET_CAUSE_LAST_MASK) >> SOC_RESET_CAUSE_LAST_LSB) -#define SOC_RESET_CAUSE_LAST_SET(x) (((x) << SOC_RESET_CAUSE_LAST_LSB) & SOC_RESET_CAUSE_LAST_MASK) - -#define SOC_SYSTEM_SLEEP_ADDRESS 0x000000c4 -#define SOC_SYSTEM_SLEEP_OFFSET 0x000000c4 -#define SOC_SYSTEM_SLEEP_MCI_MSB 5 -#define SOC_SYSTEM_SLEEP_MCI_LSB 5 -#define SOC_SYSTEM_SLEEP_MCI_MASK 0x00000020 -#define SOC_SYSTEM_SLEEP_MCI_GET(x) (((x) & SOC_SYSTEM_SLEEP_MCI_MASK) >> SOC_SYSTEM_SLEEP_MCI_LSB) -#define SOC_SYSTEM_SLEEP_MCI_SET(x) (((x) << SOC_SYSTEM_SLEEP_MCI_LSB) & SOC_SYSTEM_SLEEP_MCI_MASK) -#define SOC_SYSTEM_SLEEP_HOST_IF_MSB 4 -#define SOC_SYSTEM_SLEEP_HOST_IF_LSB 4 -#define SOC_SYSTEM_SLEEP_HOST_IF_MASK 0x00000010 -#define SOC_SYSTEM_SLEEP_HOST_IF_GET(x) (((x) & SOC_SYSTEM_SLEEP_HOST_IF_MASK) >> SOC_SYSTEM_SLEEP_HOST_IF_LSB) -#define SOC_SYSTEM_SLEEP_HOST_IF_SET(x) (((x) << SOC_SYSTEM_SLEEP_HOST_IF_LSB) & SOC_SYSTEM_SLEEP_HOST_IF_MASK) -#define SOC_SYSTEM_SLEEP_MBOX_MSB 3 -#define SOC_SYSTEM_SLEEP_MBOX_LSB 3 -#define SOC_SYSTEM_SLEEP_MBOX_MASK 0x00000008 -#define SOC_SYSTEM_SLEEP_MBOX_GET(x) (((x) & SOC_SYSTEM_SLEEP_MBOX_MASK) >> SOC_SYSTEM_SLEEP_MBOX_LSB) -#define SOC_SYSTEM_SLEEP_MBOX_SET(x) (((x) << SOC_SYSTEM_SLEEP_MBOX_LSB) & SOC_SYSTEM_SLEEP_MBOX_MASK) -#define SOC_SYSTEM_SLEEP_MAC_IF_MSB 2 -#define SOC_SYSTEM_SLEEP_MAC_IF_LSB 2 -#define SOC_SYSTEM_SLEEP_MAC_IF_MASK 0x00000004 -#define SOC_SYSTEM_SLEEP_MAC_IF_GET(x) (((x) & SOC_SYSTEM_SLEEP_MAC_IF_MASK) >> SOC_SYSTEM_SLEEP_MAC_IF_LSB) -#define SOC_SYSTEM_SLEEP_MAC_IF_SET(x) (((x) << SOC_SYSTEM_SLEEP_MAC_IF_LSB) & SOC_SYSTEM_SLEEP_MAC_IF_MASK) -#define SOC_SYSTEM_SLEEP_LIGHT_MSB 1 -#define SOC_SYSTEM_SLEEP_LIGHT_LSB 1 -#define SOC_SYSTEM_SLEEP_LIGHT_MASK 0x00000002 -#define SOC_SYSTEM_SLEEP_LIGHT_GET(x) (((x) & SOC_SYSTEM_SLEEP_LIGHT_MASK) >> SOC_SYSTEM_SLEEP_LIGHT_LSB) -#define SOC_SYSTEM_SLEEP_LIGHT_SET(x) (((x) << SOC_SYSTEM_SLEEP_LIGHT_LSB) & SOC_SYSTEM_SLEEP_LIGHT_MASK) -#define SOC_SYSTEM_SLEEP_DISABLE_MSB 0 -#define SOC_SYSTEM_SLEEP_DISABLE_LSB 0 -#define SOC_SYSTEM_SLEEP_DISABLE_MASK 0x00000001 -#define SOC_SYSTEM_SLEEP_DISABLE_GET(x) (((x) & SOC_SYSTEM_SLEEP_DISABLE_MASK) >> SOC_SYSTEM_SLEEP_DISABLE_LSB) -#define SOC_SYSTEM_SLEEP_DISABLE_SET(x) (((x) << SOC_SYSTEM_SLEEP_DISABLE_LSB) & SOC_SYSTEM_SLEEP_DISABLE_MASK) - -#define SOC_SDIO_WRAPPER_ADDRESS 0x000000c8 -#define SOC_SDIO_WRAPPER_OFFSET 0x000000c8 -#define SOC_SDIO_WRAPPER_SLEEP_MSB 3 -#define SOC_SDIO_WRAPPER_SLEEP_LSB 3 -#define SOC_SDIO_WRAPPER_SLEEP_MASK 0x00000008 -#define SOC_SDIO_WRAPPER_SLEEP_GET(x) (((x) & SOC_SDIO_WRAPPER_SLEEP_MASK) >> SOC_SDIO_WRAPPER_SLEEP_LSB) -#define SOC_SDIO_WRAPPER_SLEEP_SET(x) (((x) << SOC_SDIO_WRAPPER_SLEEP_LSB) & SOC_SDIO_WRAPPER_SLEEP_MASK) -#define SOC_SDIO_WRAPPER_WAKEUP_MSB 2 -#define SOC_SDIO_WRAPPER_WAKEUP_LSB 2 -#define SOC_SDIO_WRAPPER_WAKEUP_MASK 0x00000004 -#define SOC_SDIO_WRAPPER_WAKEUP_GET(x) (((x) & SOC_SDIO_WRAPPER_WAKEUP_MASK) >> SOC_SDIO_WRAPPER_WAKEUP_LSB) -#define SOC_SDIO_WRAPPER_WAKEUP_SET(x) (((x) << SOC_SDIO_WRAPPER_WAKEUP_LSB) & SOC_SDIO_WRAPPER_WAKEUP_MASK) -#define SOC_SDIO_WRAPPER_SOC_ON_MSB 1 -#define SOC_SDIO_WRAPPER_SOC_ON_LSB 1 -#define SOC_SDIO_WRAPPER_SOC_ON_MASK 0x00000002 -#define SOC_SDIO_WRAPPER_SOC_ON_GET(x) (((x) & SOC_SDIO_WRAPPER_SOC_ON_MASK) >> SOC_SDIO_WRAPPER_SOC_ON_LSB) -#define SOC_SDIO_WRAPPER_SOC_ON_SET(x) (((x) << SOC_SDIO_WRAPPER_SOC_ON_LSB) & SOC_SDIO_WRAPPER_SOC_ON_MASK) -#define SOC_SDIO_WRAPPER_ON_MSB 0 -#define SOC_SDIO_WRAPPER_ON_LSB 0 -#define SOC_SDIO_WRAPPER_ON_MASK 0x00000001 -#define SOC_SDIO_WRAPPER_ON_GET(x) (((x) & SOC_SDIO_WRAPPER_ON_MASK) >> SOC_SDIO_WRAPPER_ON_LSB) -#define SOC_SDIO_WRAPPER_ON_SET(x) (((x) << SOC_SDIO_WRAPPER_ON_LSB) & SOC_SDIO_WRAPPER_ON_MASK) - -#define SOC_INT_STATUS1_ADDRESS 0x000000cc -#define SOC_INT_STATUS1_OFFSET 0x000000cc -#define SOC_INT_STATUS1_I2S_1_MSB 9 -#define SOC_INT_STATUS1_I2S_1_LSB 9 -#define SOC_INT_STATUS1_I2S_1_MASK 0x00000200 -#define SOC_INT_STATUS1_I2S_1_GET(x) (((x) & SOC_INT_STATUS1_I2S_1_MASK) >> SOC_INT_STATUS1_I2S_1_LSB) -#define SOC_INT_STATUS1_I2S_1_SET(x) (((x) << SOC_INT_STATUS1_I2S_1_LSB) & SOC_INT_STATUS1_I2S_1_MASK) -#define SOC_INT_STATUS1_I2S_MSB 8 -#define SOC_INT_STATUS1_I2S_LSB 8 -#define SOC_INT_STATUS1_I2S_MASK 0x00000100 -#define SOC_INT_STATUS1_I2S_GET(x) (((x) & SOC_INT_STATUS1_I2S_MASK) >> SOC_INT_STATUS1_I2S_LSB) -#define SOC_INT_STATUS1_I2S_SET(x) (((x) << SOC_INT_STATUS1_I2S_LSB) & SOC_INT_STATUS1_I2S_MASK) -#define SOC_INT_STATUS1_MDIO_MSB 7 -#define SOC_INT_STATUS1_MDIO_LSB 7 -#define SOC_INT_STATUS1_MDIO_MASK 0x00000080 -#define SOC_INT_STATUS1_MDIO_GET(x) (((x) & SOC_INT_STATUS1_MDIO_MASK) >> SOC_INT_STATUS1_MDIO_LSB) -#define SOC_INT_STATUS1_MDIO_SET(x) (((x) << SOC_INT_STATUS1_MDIO_LSB) & SOC_INT_STATUS1_MDIO_MASK) -#define SOC_INT_STATUS1_GMAC_MSB 6 -#define SOC_INT_STATUS1_GMAC_LSB 6 -#define SOC_INT_STATUS1_GMAC_MASK 0x00000040 -#define SOC_INT_STATUS1_GMAC_GET(x) (((x) & SOC_INT_STATUS1_GMAC_MASK) >> SOC_INT_STATUS1_GMAC_LSB) -#define SOC_INT_STATUS1_GMAC_SET(x) (((x) << SOC_INT_STATUS1_GMAC_LSB) & SOC_INT_STATUS1_GMAC_MASK) -#define SOC_INT_STATUS1_I2C_S_MSB 5 -#define SOC_INT_STATUS1_I2C_S_LSB 5 -#define SOC_INT_STATUS1_I2C_S_MASK 0x00000020 -#define SOC_INT_STATUS1_I2C_S_GET(x) (((x) & SOC_INT_STATUS1_I2C_S_MASK) >> SOC_INT_STATUS1_I2C_S_LSB) -#define SOC_INT_STATUS1_I2C_S_SET(x) (((x) << SOC_INT_STATUS1_I2C_S_LSB) & SOC_INT_STATUS1_I2C_S_MASK) -#define SOC_INT_STATUS1_CKSUM_MSB 4 -#define SOC_INT_STATUS1_CKSUM_LSB 4 -#define SOC_INT_STATUS1_CKSUM_MASK 0x00000010 -#define SOC_INT_STATUS1_CKSUM_GET(x) (((x) & SOC_INT_STATUS1_CKSUM_MASK) >> SOC_INT_STATUS1_CKSUM_LSB) -#define SOC_INT_STATUS1_CKSUM_SET(x) (((x) << SOC_INT_STATUS1_CKSUM_LSB) & SOC_INT_STATUS1_CKSUM_MASK) -#define SOC_INT_STATUS1_MAC_4_MSB 3 -#define SOC_INT_STATUS1_MAC_4_LSB 3 -#define SOC_INT_STATUS1_MAC_4_MASK 0x00000008 -#define SOC_INT_STATUS1_MAC_4_GET(x) (((x) & SOC_INT_STATUS1_MAC_4_MASK) >> SOC_INT_STATUS1_MAC_4_LSB) -#define SOC_INT_STATUS1_MAC_4_SET(x) (((x) << SOC_INT_STATUS1_MAC_4_LSB) & SOC_INT_STATUS1_MAC_4_MASK) -#define SOC_INT_STATUS1_MAC_3_MSB 2 -#define SOC_INT_STATUS1_MAC_3_LSB 2 -#define SOC_INT_STATUS1_MAC_3_MASK 0x00000004 -#define SOC_INT_STATUS1_MAC_3_GET(x) (((x) & SOC_INT_STATUS1_MAC_3_MASK) >> SOC_INT_STATUS1_MAC_3_LSB) -#define SOC_INT_STATUS1_MAC_3_SET(x) (((x) << SOC_INT_STATUS1_MAC_3_LSB) & SOC_INT_STATUS1_MAC_3_MASK) -#define SOC_INT_STATUS1_MAC_2_MSB 1 -#define SOC_INT_STATUS1_MAC_2_LSB 1 -#define SOC_INT_STATUS1_MAC_2_MASK 0x00000002 -#define SOC_INT_STATUS1_MAC_2_GET(x) (((x) & SOC_INT_STATUS1_MAC_2_MASK) >> SOC_INT_STATUS1_MAC_2_LSB) -#define SOC_INT_STATUS1_MAC_2_SET(x) (((x) << SOC_INT_STATUS1_MAC_2_LSB) & SOC_INT_STATUS1_MAC_2_MASK) -#define SOC_INT_STATUS1_MAC_1_MSB 0 -#define SOC_INT_STATUS1_MAC_1_LSB 0 -#define SOC_INT_STATUS1_MAC_1_MASK 0x00000001 -#define SOC_INT_STATUS1_MAC_1_GET(x) (((x) & SOC_INT_STATUS1_MAC_1_MASK) >> SOC_INT_STATUS1_MAC_1_LSB) -#define SOC_INT_STATUS1_MAC_1_SET(x) (((x) << SOC_INT_STATUS1_MAC_1_LSB) & SOC_INT_STATUS1_MAC_1_MASK) - -#define SOC_LPO_CAL_TIME_ADDRESS 0x000000d4 -#define SOC_LPO_CAL_TIME_OFFSET 0x000000d4 -#define SOC_LPO_CAL_TIME_LENGTH_MSB 13 -#define SOC_LPO_CAL_TIME_LENGTH_LSB 0 -#define SOC_LPO_CAL_TIME_LENGTH_MASK 0x00003fff -#define SOC_LPO_CAL_TIME_LENGTH_GET(x) (((x) & SOC_LPO_CAL_TIME_LENGTH_MASK) >> SOC_LPO_CAL_TIME_LENGTH_LSB) -#define SOC_LPO_CAL_TIME_LENGTH_SET(x) (((x) << SOC_LPO_CAL_TIME_LENGTH_LSB) & SOC_LPO_CAL_TIME_LENGTH_MASK) - -#define SOC_LPO_INIT_DIVIDEND_INT_ADDRESS 0x000000d8 -#define SOC_LPO_INIT_DIVIDEND_INT_OFFSET 0x000000d8 -#define SOC_LPO_INIT_DIVIDEND_INT_VALUE_MSB 23 -#define SOC_LPO_INIT_DIVIDEND_INT_VALUE_LSB 0 -#define SOC_LPO_INIT_DIVIDEND_INT_VALUE_MASK 0x00ffffff -#define SOC_LPO_INIT_DIVIDEND_INT_VALUE_GET(x) (((x) & SOC_LPO_INIT_DIVIDEND_INT_VALUE_MASK) >> SOC_LPO_INIT_DIVIDEND_INT_VALUE_LSB) -#define SOC_LPO_INIT_DIVIDEND_INT_VALUE_SET(x) (((x) << SOC_LPO_INIT_DIVIDEND_INT_VALUE_LSB) & SOC_LPO_INIT_DIVIDEND_INT_VALUE_MASK) - -#define SOC_LPO_INIT_DIVIDEND_FRACTION_ADDRESS 0x000000dc -#define SOC_LPO_INIT_DIVIDEND_FRACTION_OFFSET 0x000000dc -#define SOC_LPO_INIT_DIVIDEND_FRACTION_VALUE_MSB 10 -#define SOC_LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB 0 -#define SOC_LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK 0x000007ff -#define SOC_LPO_INIT_DIVIDEND_FRACTION_VALUE_GET(x) (((x) & SOC_LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK) >> SOC_LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB) -#define SOC_LPO_INIT_DIVIDEND_FRACTION_VALUE_SET(x) (((x) << SOC_LPO_INIT_DIVIDEND_FRACTION_VALUE_LSB) & SOC_LPO_INIT_DIVIDEND_FRACTION_VALUE_MASK) - -#define SOC_LPO_CAL_ADDRESS 0x000000e0 -#define SOC_LPO_CAL_OFFSET 0x000000e0 -#define SOC_LPO_CAL_ENABLE_MSB 20 -#define SOC_LPO_CAL_ENABLE_LSB 20 -#define SOC_LPO_CAL_ENABLE_MASK 0x00100000 -#define SOC_LPO_CAL_ENABLE_GET(x) (((x) & SOC_LPO_CAL_ENABLE_MASK) >> SOC_LPO_CAL_ENABLE_LSB) -#define SOC_LPO_CAL_ENABLE_SET(x) (((x) << SOC_LPO_CAL_ENABLE_LSB) & SOC_LPO_CAL_ENABLE_MASK) -#define SOC_LPO_CAL_COUNT_MSB 19 -#define SOC_LPO_CAL_COUNT_LSB 0 -#define SOC_LPO_CAL_COUNT_MASK 0x000fffff -#define SOC_LPO_CAL_COUNT_GET(x) (((x) & SOC_LPO_CAL_COUNT_MASK) >> SOC_LPO_CAL_COUNT_LSB) -#define SOC_LPO_CAL_COUNT_SET(x) (((x) << SOC_LPO_CAL_COUNT_LSB) & SOC_LPO_CAL_COUNT_MASK) - -#define SOC_LPO_CAL_TEST_CONTROL_ADDRESS 0x000000e4 -#define SOC_LPO_CAL_TEST_CONTROL_OFFSET 0x000000e4 -#define SOC_LPO_CAL_TEST_CONTROL_ENABLE_MSB 16 -#define SOC_LPO_CAL_TEST_CONTROL_ENABLE_LSB 16 -#define SOC_LPO_CAL_TEST_CONTROL_ENABLE_MASK 0x00010000 -#define SOC_LPO_CAL_TEST_CONTROL_ENABLE_GET(x) (((x) & SOC_LPO_CAL_TEST_CONTROL_ENABLE_MASK) >> SOC_LPO_CAL_TEST_CONTROL_ENABLE_LSB) -#define SOC_LPO_CAL_TEST_CONTROL_ENABLE_SET(x) (((x) << SOC_LPO_CAL_TEST_CONTROL_ENABLE_LSB) & SOC_LPO_CAL_TEST_CONTROL_ENABLE_MASK) -#define SOC_LPO_CAL_TEST_CONTROL_RTC_CYCLES_MSB 15 -#define SOC_LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB 0 -#define SOC_LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK 0x0000ffff -#define SOC_LPO_CAL_TEST_CONTROL_RTC_CYCLES_GET(x) (((x) & SOC_LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK) >> SOC_LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB) -#define SOC_LPO_CAL_TEST_CONTROL_RTC_CYCLES_SET(x) (((x) << SOC_LPO_CAL_TEST_CONTROL_RTC_CYCLES_LSB) & SOC_LPO_CAL_TEST_CONTROL_RTC_CYCLES_MASK) - -#define SOC_LPO_CAL_TEST_STATUS_ADDRESS 0x000000e8 -#define SOC_LPO_CAL_TEST_STATUS_OFFSET 0x000000e8 -#define SOC_LPO_CAL_TEST_STATUS_READY_MSB 16 -#define SOC_LPO_CAL_TEST_STATUS_READY_LSB 16 -#define SOC_LPO_CAL_TEST_STATUS_READY_MASK 0x00010000 -#define SOC_LPO_CAL_TEST_STATUS_READY_GET(x) (((x) & SOC_LPO_CAL_TEST_STATUS_READY_MASK) >> SOC_LPO_CAL_TEST_STATUS_READY_LSB) -#define SOC_LPO_CAL_TEST_STATUS_READY_SET(x) (((x) << SOC_LPO_CAL_TEST_STATUS_READY_LSB) & SOC_LPO_CAL_TEST_STATUS_READY_MASK) -#define SOC_LPO_CAL_TEST_STATUS_COUNT_MSB 15 -#define SOC_LPO_CAL_TEST_STATUS_COUNT_LSB 0 -#define SOC_LPO_CAL_TEST_STATUS_COUNT_MASK 0x0000ffff -#define SOC_LPO_CAL_TEST_STATUS_COUNT_GET(x) (((x) & SOC_LPO_CAL_TEST_STATUS_COUNT_MASK) >> SOC_LPO_CAL_TEST_STATUS_COUNT_LSB) -#define SOC_LPO_CAL_TEST_STATUS_COUNT_SET(x) (((x) << SOC_LPO_CAL_TEST_STATUS_COUNT_LSB) & SOC_LPO_CAL_TEST_STATUS_COUNT_MASK) - -#define LEGACY_SOC_CHIP_ID_ADDRESS 0x000000ec -#define LEGACY_SOC_CHIP_ID_OFFSET 0x000000ec -#define LEGACY_SOC_CHIP_ID_DEVICE_ID_MSB 31 -#define LEGACY_SOC_CHIP_ID_DEVICE_ID_LSB 16 -#define LEGACY_SOC_CHIP_ID_DEVICE_ID_MASK 0xffff0000 -#define LEGACY_SOC_CHIP_ID_DEVICE_ID_GET(x) (((x) & LEGACY_SOC_CHIP_ID_DEVICE_ID_MASK) >> LEGACY_SOC_CHIP_ID_DEVICE_ID_LSB) -#define LEGACY_SOC_CHIP_ID_DEVICE_ID_SET(x) (((x) << LEGACY_SOC_CHIP_ID_DEVICE_ID_LSB) & LEGACY_SOC_CHIP_ID_DEVICE_ID_MASK) -#define LEGACY_SOC_CHIP_ID_CONFIG_ID_MSB 15 -#define LEGACY_SOC_CHIP_ID_CONFIG_ID_LSB 4 -#define LEGACY_SOC_CHIP_ID_CONFIG_ID_MASK 0x0000fff0 -#define LEGACY_SOC_CHIP_ID_CONFIG_ID_GET(x) (((x) & LEGACY_SOC_CHIP_ID_CONFIG_ID_MASK) >> LEGACY_SOC_CHIP_ID_CONFIG_ID_LSB) -#define LEGACY_SOC_CHIP_ID_CONFIG_ID_SET(x) (((x) << LEGACY_SOC_CHIP_ID_CONFIG_ID_LSB) & LEGACY_SOC_CHIP_ID_CONFIG_ID_MASK) -#define LEGACY_SOC_CHIP_ID_VERSION_ID_MSB 3 -#define LEGACY_SOC_CHIP_ID_VERSION_ID_LSB 0 -#define LEGACY_SOC_CHIP_ID_VERSION_ID_MASK 0x0000000f -#define LEGACY_SOC_CHIP_ID_VERSION_ID_GET(x) (((x) & LEGACY_SOC_CHIP_ID_VERSION_ID_MASK) >> LEGACY_SOC_CHIP_ID_VERSION_ID_LSB) -#define LEGACY_SOC_CHIP_ID_VERSION_ID_SET(x) (((x) << LEGACY_SOC_CHIP_ID_VERSION_ID_LSB) & LEGACY_SOC_CHIP_ID_VERSION_ID_MASK) - -#define SOC_CHIP_ID_ADDRESS 0x000000f0 -#define SOC_CHIP_ID_OFFSET 0x000000f0 -#define SOC_CHIP_ID_DEVICE_ID_MSB 31 -#define SOC_CHIP_ID_DEVICE_ID_LSB 16 -#define SOC_CHIP_ID_DEVICE_ID_MASK 0xffff0000 -#define SOC_CHIP_ID_DEVICE_ID_GET(x) (((x) & SOC_CHIP_ID_DEVICE_ID_MASK) >> SOC_CHIP_ID_DEVICE_ID_LSB) -#define SOC_CHIP_ID_DEVICE_ID_SET(x) (((x) << SOC_CHIP_ID_DEVICE_ID_LSB) & SOC_CHIP_ID_DEVICE_ID_MASK) -#define SOC_CHIP_ID_CONFIG_ID_MSB 15 -#define SOC_CHIP_ID_CONFIG_ID_LSB 4 -#define SOC_CHIP_ID_CONFIG_ID_MASK 0x0000fff0 -#define SOC_CHIP_ID_CONFIG_ID_GET(x) (((x) & SOC_CHIP_ID_CONFIG_ID_MASK) >> SOC_CHIP_ID_CONFIG_ID_LSB) -#define SOC_CHIP_ID_CONFIG_ID_SET(x) (((x) << SOC_CHIP_ID_CONFIG_ID_LSB) & SOC_CHIP_ID_CONFIG_ID_MASK) -#define SOC_CHIP_ID_VERSION_ID_MSB 3 -#define SOC_CHIP_ID_VERSION_ID_LSB 0 -#define SOC_CHIP_ID_VERSION_ID_MASK 0x0000000f -#define SOC_CHIP_ID_VERSION_ID_GET(x) (((x) & SOC_CHIP_ID_VERSION_ID_MASK) >> SOC_CHIP_ID_VERSION_ID_LSB) -#define SOC_CHIP_ID_VERSION_ID_SET(x) (((x) << SOC_CHIP_ID_VERSION_ID_LSB) & SOC_CHIP_ID_VERSION_ID_MASK) - -#define SOC_POWER_REG_ADDRESS 0x0000010c -#define SOC_POWER_REG_OFFSET 0x0000010c -#define SOC_POWER_REG_SWREG_VS_EN_MSB 17 -#define SOC_POWER_REG_SWREG_VS_EN_LSB 17 -#define SOC_POWER_REG_SWREG_VS_EN_MASK 0x00020000 -#define SOC_POWER_REG_SWREG_VS_EN_GET(x) (((x) & SOC_POWER_REG_SWREG_VS_EN_MASK) >> SOC_POWER_REG_SWREG_VS_EN_LSB) -#define SOC_POWER_REG_SWREG_VS_EN_SET(x) (((x) << SOC_POWER_REG_SWREG_VS_EN_LSB) & SOC_POWER_REG_SWREG_VS_EN_MASK) -#define SOC_POWER_REG_DISCON_MODE_EN_MSB 16 -#define SOC_POWER_REG_DISCON_MODE_EN_LSB 16 -#define SOC_POWER_REG_DISCON_MODE_EN_MASK 0x00010000 -#define SOC_POWER_REG_DISCON_MODE_EN_GET(x) (((x) & SOC_POWER_REG_DISCON_MODE_EN_MASK) >> SOC_POWER_REG_DISCON_MODE_EN_LSB) -#define SOC_POWER_REG_DISCON_MODE_EN_SET(x) (((x) << SOC_POWER_REG_DISCON_MODE_EN_LSB) & SOC_POWER_REG_DISCON_MODE_EN_MASK) -#define SOC_POWER_REG_DEEP_SLEEP_EN_MSB 15 -#define SOC_POWER_REG_DEEP_SLEEP_EN_LSB 15 -#define SOC_POWER_REG_DEEP_SLEEP_EN_MASK 0x00008000 -#define SOC_POWER_REG_DEEP_SLEEP_EN_GET(x) (((x) & SOC_POWER_REG_DEEP_SLEEP_EN_MASK) >> SOC_POWER_REG_DEEP_SLEEP_EN_LSB) -#define SOC_POWER_REG_DEEP_SLEEP_EN_SET(x) (((x) << SOC_POWER_REG_DEEP_SLEEP_EN_LSB) & SOC_POWER_REG_DEEP_SLEEP_EN_MASK) -#define SOC_POWER_REG_DEBUG_EN_MSB 14 -#define SOC_POWER_REG_DEBUG_EN_LSB 14 -#define SOC_POWER_REG_DEBUG_EN_MASK 0x00004000 -#define SOC_POWER_REG_DEBUG_EN_GET(x) (((x) & SOC_POWER_REG_DEBUG_EN_MASK) >> SOC_POWER_REG_DEBUG_EN_LSB) -#define SOC_POWER_REG_DEBUG_EN_SET(x) (((x) << SOC_POWER_REG_DEBUG_EN_LSB) & SOC_POWER_REG_DEBUG_EN_MASK) -#define SOC_POWER_REG_WLAN_BB_PWD_EN_MSB 13 -#define SOC_POWER_REG_WLAN_BB_PWD_EN_LSB 13 -#define SOC_POWER_REG_WLAN_BB_PWD_EN_MASK 0x00002000 -#define SOC_POWER_REG_WLAN_BB_PWD_EN_GET(x) (((x) & SOC_POWER_REG_WLAN_BB_PWD_EN_MASK) >> SOC_POWER_REG_WLAN_BB_PWD_EN_LSB) -#define SOC_POWER_REG_WLAN_BB_PWD_EN_SET(x) (((x) << SOC_POWER_REG_WLAN_BB_PWD_EN_LSB) & SOC_POWER_REG_WLAN_BB_PWD_EN_MASK) -#define SOC_POWER_REG_WLAN_MAC_PWD_EN_MSB 12 -#define SOC_POWER_REG_WLAN_MAC_PWD_EN_LSB 12 -#define SOC_POWER_REG_WLAN_MAC_PWD_EN_MASK 0x00001000 -#define SOC_POWER_REG_WLAN_MAC_PWD_EN_GET(x) (((x) & SOC_POWER_REG_WLAN_MAC_PWD_EN_MASK) >> SOC_POWER_REG_WLAN_MAC_PWD_EN_LSB) -#define SOC_POWER_REG_WLAN_MAC_PWD_EN_SET(x) (((x) << SOC_POWER_REG_WLAN_MAC_PWD_EN_LSB) & SOC_POWER_REG_WLAN_MAC_PWD_EN_MASK) -#define SOC_POWER_REG_CPU_INT_ENABLE_MSB 7 -#define SOC_POWER_REG_CPU_INT_ENABLE_LSB 7 -#define SOC_POWER_REG_CPU_INT_ENABLE_MASK 0x00000080 -#define SOC_POWER_REG_CPU_INT_ENABLE_GET(x) (((x) & SOC_POWER_REG_CPU_INT_ENABLE_MASK) >> SOC_POWER_REG_CPU_INT_ENABLE_LSB) -#define SOC_POWER_REG_CPU_INT_ENABLE_SET(x) (((x) << SOC_POWER_REG_CPU_INT_ENABLE_LSB) & SOC_POWER_REG_CPU_INT_ENABLE_MASK) -#define SOC_POWER_REG_RADIO_PWD_EN_MSB 4 -#define SOC_POWER_REG_RADIO_PWD_EN_LSB 4 -#define SOC_POWER_REG_RADIO_PWD_EN_MASK 0x00000010 -#define SOC_POWER_REG_RADIO_PWD_EN_GET(x) (((x) & SOC_POWER_REG_RADIO_PWD_EN_MASK) >> SOC_POWER_REG_RADIO_PWD_EN_LSB) -#define SOC_POWER_REG_RADIO_PWD_EN_SET(x) (((x) << SOC_POWER_REG_RADIO_PWD_EN_LSB) & SOC_POWER_REG_RADIO_PWD_EN_MASK) -#define SOC_POWER_REG_WLAN_PWD_EN_MSB 1 -#define SOC_POWER_REG_WLAN_PWD_EN_LSB 1 -#define SOC_POWER_REG_WLAN_PWD_EN_MASK 0x00000002 -#define SOC_POWER_REG_WLAN_PWD_EN_GET(x) (((x) & SOC_POWER_REG_WLAN_PWD_EN_MASK) >> SOC_POWER_REG_WLAN_PWD_EN_LSB) -#define SOC_POWER_REG_WLAN_PWD_EN_SET(x) (((x) << SOC_POWER_REG_WLAN_PWD_EN_LSB) & SOC_POWER_REG_WLAN_PWD_EN_MASK) -#define SOC_POWER_REG_POWER_EN_MSB 0 -#define SOC_POWER_REG_POWER_EN_LSB 0 -#define SOC_POWER_REG_POWER_EN_MASK 0x00000001 -#define SOC_POWER_REG_POWER_EN_GET(x) (((x) & SOC_POWER_REG_POWER_EN_MASK) >> SOC_POWER_REG_POWER_EN_LSB) -#define SOC_POWER_REG_POWER_EN_SET(x) (((x) << SOC_POWER_REG_POWER_EN_LSB) & SOC_POWER_REG_POWER_EN_MASK) - -#define SOC_CORE_CLK_CTRL_ADDRESS 0x00000110 -#define SOC_CORE_CLK_CTRL_OFFSET 0x00000110 -#define SOC_CORE_CLK_CTRL_DIV_MSB 2 -#define SOC_CORE_CLK_CTRL_DIV_LSB 0 -#define SOC_CORE_CLK_CTRL_DIV_MASK 0x00000007 -#define SOC_CORE_CLK_CTRL_DIV_GET(x) (((x) & SOC_CORE_CLK_CTRL_DIV_MASK) >> SOC_CORE_CLK_CTRL_DIV_LSB) -#define SOC_CORE_CLK_CTRL_DIV_SET(x) (((x) << SOC_CORE_CLK_CTRL_DIV_LSB) & SOC_CORE_CLK_CTRL_DIV_MASK) - -#define SOC_GPIO_WAKEUP_CONTROL_ADDRESS 0x00000114 -#define SOC_GPIO_WAKEUP_CONTROL_OFFSET 0x00000114 -#define SOC_GPIO_WAKEUP_CONTROL_ENABLE_MSB 0 -#define SOC_GPIO_WAKEUP_CONTROL_ENABLE_LSB 0 -#define SOC_GPIO_WAKEUP_CONTROL_ENABLE_MASK 0x00000001 -#define SOC_GPIO_WAKEUP_CONTROL_ENABLE_GET(x) (((x) & SOC_GPIO_WAKEUP_CONTROL_ENABLE_MASK) >> SOC_GPIO_WAKEUP_CONTROL_ENABLE_LSB) -#define SOC_GPIO_WAKEUP_CONTROL_ENABLE_SET(x) (((x) << SOC_GPIO_WAKEUP_CONTROL_ENABLE_LSB) & SOC_GPIO_WAKEUP_CONTROL_ENABLE_MASK) - -#define SLEEP_RETENTION_ADDRESS 0x00000214 -#define SLEEP_RETENTION_OFFSET 0x00000214 -#define SLEEP_RETENTION_GREEN_SAVE_MSB 10 -#define SLEEP_RETENTION_GREEN_SAVE_LSB 10 -#define SLEEP_RETENTION_GREEN_SAVE_MASK 0x00000400 -#define SLEEP_RETENTION_GREEN_SAVE_GET(x) (((x) & SLEEP_RETENTION_GREEN_SAVE_MASK) >> SLEEP_RETENTION_GREEN_SAVE_LSB) -#define SLEEP_RETENTION_GREEN_SAVE_SET(x) (((x) << SLEEP_RETENTION_GREEN_SAVE_LSB) & SLEEP_RETENTION_GREEN_SAVE_MASK) -#define SLEEP_RETENTION_TIME_MSB 9 -#define SLEEP_RETENTION_TIME_LSB 2 -#define SLEEP_RETENTION_TIME_MASK 0x000003fc -#define SLEEP_RETENTION_TIME_GET(x) (((x) & SLEEP_RETENTION_TIME_MASK) >> SLEEP_RETENTION_TIME_LSB) -#define SLEEP_RETENTION_TIME_SET(x) (((x) << SLEEP_RETENTION_TIME_LSB) & SLEEP_RETENTION_TIME_MASK) -#define SLEEP_RETENTION_MODE_MSB 1 -#define SLEEP_RETENTION_MODE_LSB 1 -#define SLEEP_RETENTION_MODE_MASK 0x00000002 -#define SLEEP_RETENTION_MODE_GET(x) (((x) & SLEEP_RETENTION_MODE_MASK) >> SLEEP_RETENTION_MODE_LSB) -#define SLEEP_RETENTION_MODE_SET(x) (((x) << SLEEP_RETENTION_MODE_LSB) & SLEEP_RETENTION_MODE_MASK) -#define SLEEP_RETENTION_ENABLE_MSB 0 -#define SLEEP_RETENTION_ENABLE_LSB 0 -#define SLEEP_RETENTION_ENABLE_MASK 0x00000001 -#define SLEEP_RETENTION_ENABLE_GET(x) (((x) & SLEEP_RETENTION_ENABLE_MASK) >> SLEEP_RETENTION_ENABLE_LSB) -#define SLEEP_RETENTION_ENABLE_SET(x) (((x) << SLEEP_RETENTION_ENABLE_LSB) & SLEEP_RETENTION_ENABLE_MASK) - -#define LP_PERF_COUNTER_ADDRESS 0x00000284 -#define LP_PERF_COUNTER_OFFSET 0x00000284 -#define LP_PERF_COUNTER_EN_MSB 0 -#define LP_PERF_COUNTER_EN_LSB 0 -#define LP_PERF_COUNTER_EN_MASK 0x00000001 -#define LP_PERF_COUNTER_EN_GET(x) (((x) & LP_PERF_COUNTER_EN_MASK) >> LP_PERF_COUNTER_EN_LSB) -#define LP_PERF_COUNTER_EN_SET(x) (((x) << LP_PERF_COUNTER_EN_LSB) & LP_PERF_COUNTER_EN_MASK) - -#define LP_PERF_LIGHT_SLEEP_ADDRESS 0x00000288 -#define LP_PERF_LIGHT_SLEEP_OFFSET 0x00000288 -#define LP_PERF_LIGHT_SLEEP_CNT_MSB 31 -#define LP_PERF_LIGHT_SLEEP_CNT_LSB 0 -#define LP_PERF_LIGHT_SLEEP_CNT_MASK 0xffffffff -#define LP_PERF_LIGHT_SLEEP_CNT_GET(x) (((x) & LP_PERF_LIGHT_SLEEP_CNT_MASK) >> LP_PERF_LIGHT_SLEEP_CNT_LSB) -#define LP_PERF_LIGHT_SLEEP_CNT_SET(x) (((x) << LP_PERF_LIGHT_SLEEP_CNT_LSB) & LP_PERF_LIGHT_SLEEP_CNT_MASK) - -#define LP_PERF_DEEP_SLEEP_ADDRESS 0x0000028c -#define LP_PERF_DEEP_SLEEP_OFFSET 0x0000028c -#define LP_PERF_DEEP_SLEEP_CNT_MSB 31 -#define LP_PERF_DEEP_SLEEP_CNT_LSB 0 -#define LP_PERF_DEEP_SLEEP_CNT_MASK 0xffffffff -#define LP_PERF_DEEP_SLEEP_CNT_GET(x) (((x) & LP_PERF_DEEP_SLEEP_CNT_MASK) >> LP_PERF_DEEP_SLEEP_CNT_LSB) -#define LP_PERF_DEEP_SLEEP_CNT_SET(x) (((x) << LP_PERF_DEEP_SLEEP_CNT_LSB) & LP_PERF_DEEP_SLEEP_CNT_MASK) - -#define LP_PERF_ON_ADDRESS 0x00000290 -#define LP_PERF_ON_OFFSET 0x00000290 -#define LP_PERF_ON_CNT_MSB 31 -#define LP_PERF_ON_CNT_LSB 0 -#define LP_PERF_ON_CNT_MASK 0xffffffff -#define LP_PERF_ON_CNT_GET(x) (((x) & LP_PERF_ON_CNT_MASK) >> LP_PERF_ON_CNT_LSB) -#define LP_PERF_ON_CNT_SET(x) (((x) << LP_PERF_ON_CNT_LSB) & LP_PERF_ON_CNT_MASK) - -#define CHIP_MODE_ADDRESS 0x000002a8 -#define CHIP_MODE_OFFSET 0x000002a8 -#define CHIP_MODE_BIT_MSB 1 -#define CHIP_MODE_BIT_LSB 0 -#define CHIP_MODE_BIT_MASK 0x00000003 -#define CHIP_MODE_BIT_GET(x) (((x) & CHIP_MODE_BIT_MASK) >> CHIP_MODE_BIT_LSB) -#define CHIP_MODE_BIT_SET(x) (((x) << CHIP_MODE_BIT_LSB) & CHIP_MODE_BIT_MASK) - -#define CLK_REQ_FALL_EDGE_ADDRESS 0x000002ac -#define CLK_REQ_FALL_EDGE_OFFSET 0x000002ac -#define CLK_REQ_FALL_EDGE_EN_MSB 31 -#define CLK_REQ_FALL_EDGE_EN_LSB 31 -#define CLK_REQ_FALL_EDGE_EN_MASK 0x80000000 -#define CLK_REQ_FALL_EDGE_EN_GET(x) (((x) & CLK_REQ_FALL_EDGE_EN_MASK) >> CLK_REQ_FALL_EDGE_EN_LSB) -#define CLK_REQ_FALL_EDGE_EN_SET(x) (((x) << CLK_REQ_FALL_EDGE_EN_LSB) & CLK_REQ_FALL_EDGE_EN_MASK) -#define CLK_REQ_FALL_EDGE_DELAY_MSB 7 -#define CLK_REQ_FALL_EDGE_DELAY_LSB 0 -#define CLK_REQ_FALL_EDGE_DELAY_MASK 0x000000ff -#define CLK_REQ_FALL_EDGE_DELAY_GET(x) (((x) & CLK_REQ_FALL_EDGE_DELAY_MASK) >> CLK_REQ_FALL_EDGE_DELAY_LSB) -#define CLK_REQ_FALL_EDGE_DELAY_SET(x) (((x) << CLK_REQ_FALL_EDGE_DELAY_LSB) & CLK_REQ_FALL_EDGE_DELAY_MASK) - -#define OTP_ADDRESS 0x000002b0 -#define OTP_OFFSET 0x000002b0 -#define OTP_LDO25_EN_MSB 1 -#define OTP_LDO25_EN_LSB 1 -#define OTP_LDO25_EN_MASK 0x00000002 -#define OTP_LDO25_EN_GET(x) (((x) & OTP_LDO25_EN_MASK) >> OTP_LDO25_EN_LSB) -#define OTP_LDO25_EN_SET(x) (((x) << OTP_LDO25_EN_LSB) & OTP_LDO25_EN_MASK) -#define OTP_VDD12_EN_MSB 0 -#define OTP_VDD12_EN_LSB 0 -#define OTP_VDD12_EN_MASK 0x00000001 -#define OTP_VDD12_EN_GET(x) (((x) & OTP_VDD12_EN_MASK) >> OTP_VDD12_EN_LSB) -#define OTP_VDD12_EN_SET(x) (((x) << OTP_VDD12_EN_LSB) & OTP_VDD12_EN_MASK) - -#define OTP_STATUS_ADDRESS 0x000002b4 -#define OTP_STATUS_OFFSET 0x000002b4 -#define OTP_STATUS_LDO25_EN_READY_MSB 1 -#define OTP_STATUS_LDO25_EN_READY_LSB 1 -#define OTP_STATUS_LDO25_EN_READY_MASK 0x00000002 -#define OTP_STATUS_LDO25_EN_READY_GET(x) (((x) & OTP_STATUS_LDO25_EN_READY_MASK) >> OTP_STATUS_LDO25_EN_READY_LSB) -#define OTP_STATUS_LDO25_EN_READY_SET(x) (((x) << OTP_STATUS_LDO25_EN_READY_LSB) & OTP_STATUS_LDO25_EN_READY_MASK) -#define OTP_STATUS_VDD12_EN_READY_MSB 0 -#define OTP_STATUS_VDD12_EN_READY_LSB 0 -#define OTP_STATUS_VDD12_EN_READY_MASK 0x00000001 -#define OTP_STATUS_VDD12_EN_READY_GET(x) (((x) & OTP_STATUS_VDD12_EN_READY_MASK) >> OTP_STATUS_VDD12_EN_READY_LSB) -#define OTP_STATUS_VDD12_EN_READY_SET(x) (((x) << OTP_STATUS_VDD12_EN_READY_LSB) & OTP_STATUS_VDD12_EN_READY_MASK) - -#define PMU_ADDRESS 0x000002b8 -#define PMU_OFFSET 0x000002b8 -#define PMU_REG_WAKEUP_TIME_SEL_MSB 1 -#define PMU_REG_WAKEUP_TIME_SEL_LSB 0 -#define PMU_REG_WAKEUP_TIME_SEL_MASK 0x00000003 -#define PMU_REG_WAKEUP_TIME_SEL_GET(x) (((x) & PMU_REG_WAKEUP_TIME_SEL_MASK) >> PMU_REG_WAKEUP_TIME_SEL_LSB) -#define PMU_REG_WAKEUP_TIME_SEL_SET(x) (((x) << PMU_REG_WAKEUP_TIME_SEL_LSB) & PMU_REG_WAKEUP_TIME_SEL_MASK) - -#define PMU_CONFIG_ADDRESS 0x000002bc -#define PMU_CONFIG_OFFSET 0x000002bc -#define PMU_CONFIG_VALUE_MSB 4 -#define PMU_CONFIG_VALUE_LSB 0 -#define PMU_CONFIG_VALUE_MASK 0x0000001f -#define PMU_CONFIG_VALUE_GET(x) (((x) & PMU_CONFIG_VALUE_MASK) >> PMU_CONFIG_VALUE_LSB) -#define PMU_CONFIG_VALUE_SET(x) (((x) << PMU_CONFIG_VALUE_LSB) & PMU_CONFIG_VALUE_MASK) - -#define PMU_PAREG_ADDRESS 0x000002c0 -#define PMU_PAREG_OFFSET 0x000002c0 -#define PMU_PAREG_LVL_CTR_MSB 2 -#define PMU_PAREG_LVL_CTR_LSB 0 -#define PMU_PAREG_LVL_CTR_MASK 0x00000007 -#define PMU_PAREG_LVL_CTR_GET(x) (((x) & PMU_PAREG_LVL_CTR_MASK) >> PMU_PAREG_LVL_CTR_LSB) -#define PMU_PAREG_LVL_CTR_SET(x) (((x) << PMU_PAREG_LVL_CTR_LSB) & PMU_PAREG_LVL_CTR_MASK) - -#define PMU_BYPASS_ADDRESS 0x000002c4 -#define PMU_BYPASS_OFFSET 0x000002c4 -#define PMU_BYPASS_SWREG_MSB 1 -#define PMU_BYPASS_SWREG_LSB 1 -#define PMU_BYPASS_SWREG_MASK 0x00000002 -#define PMU_BYPASS_SWREG_GET(x) (((x) & PMU_BYPASS_SWREG_MASK) >> PMU_BYPASS_SWREG_LSB) -#define PMU_BYPASS_SWREG_SET(x) (((x) << PMU_BYPASS_SWREG_LSB) & PMU_BYPASS_SWREG_MASK) -#define PMU_BYPASS_PAREG_MSB 0 -#define PMU_BYPASS_PAREG_LSB 0 -#define PMU_BYPASS_PAREG_MASK 0x00000001 -#define PMU_BYPASS_PAREG_GET(x) (((x) & PMU_BYPASS_PAREG_MASK) >> PMU_BYPASS_PAREG_LSB) -#define PMU_BYPASS_PAREG_SET(x) (((x) << PMU_BYPASS_PAREG_LSB) & PMU_BYPASS_PAREG_MASK) - -#define THERM_CTRL1_ADDRESS 0x000002dc -#define THERM_CTRL1_OFFSET 0x000002dc -#define THERM_CTRL1_BYPASS_MSB 16 -#define THERM_CTRL1_BYPASS_LSB 16 -#define THERM_CTRL1_BYPASS_MASK 0x00010000 -#define THERM_CTRL1_BYPASS_GET(x) (((x) & THERM_CTRL1_BYPASS_MASK) >> THERM_CTRL1_BYPASS_LSB) -#define THERM_CTRL1_BYPASS_SET(x) (((x) << THERM_CTRL1_BYPASS_LSB) & THERM_CTRL1_BYPASS_MASK) -#define THERM_CTRL1_WIDTH_ARBITOR_MSB 15 -#define THERM_CTRL1_WIDTH_ARBITOR_LSB 12 -#define THERM_CTRL1_WIDTH_ARBITOR_MASK 0x0000f000 -#define THERM_CTRL1_WIDTH_ARBITOR_GET(x) (((x) & THERM_CTRL1_WIDTH_ARBITOR_MASK) >> THERM_CTRL1_WIDTH_ARBITOR_LSB) -#define THERM_CTRL1_WIDTH_ARBITOR_SET(x) (((x) << THERM_CTRL1_WIDTH_ARBITOR_LSB) & THERM_CTRL1_WIDTH_ARBITOR_MASK) -#define THERM_CTRL1_WIDTH_MSB 11 -#define THERM_CTRL1_WIDTH_LSB 5 -#define THERM_CTRL1_WIDTH_MASK 0x00000fe0 -#define THERM_CTRL1_WIDTH_GET(x) (((x) & THERM_CTRL1_WIDTH_MASK) >> THERM_CTRL1_WIDTH_LSB) -#define THERM_CTRL1_WIDTH_SET(x) (((x) << THERM_CTRL1_WIDTH_LSB) & THERM_CTRL1_WIDTH_MASK) -#define THERM_CTRL1_TYPE_MSB 4 -#define THERM_CTRL1_TYPE_LSB 3 -#define THERM_CTRL1_TYPE_MASK 0x00000018 -#define THERM_CTRL1_TYPE_GET(x) (((x) & THERM_CTRL1_TYPE_MASK) >> THERM_CTRL1_TYPE_LSB) -#define THERM_CTRL1_TYPE_SET(x) (((x) << THERM_CTRL1_TYPE_LSB) & THERM_CTRL1_TYPE_MASK) -#define THERM_CTRL1_MEASURE_MSB 2 -#define THERM_CTRL1_MEASURE_LSB 2 -#define THERM_CTRL1_MEASURE_MASK 0x00000004 -#define THERM_CTRL1_MEASURE_GET(x) (((x) & THERM_CTRL1_MEASURE_MASK) >> THERM_CTRL1_MEASURE_LSB) -#define THERM_CTRL1_MEASURE_SET(x) (((x) << THERM_CTRL1_MEASURE_LSB) & THERM_CTRL1_MEASURE_MASK) -#define THERM_CTRL1_INT_EN_MSB 1 -#define THERM_CTRL1_INT_EN_LSB 1 -#define THERM_CTRL1_INT_EN_MASK 0x00000002 -#define THERM_CTRL1_INT_EN_GET(x) (((x) & THERM_CTRL1_INT_EN_MASK) >> THERM_CTRL1_INT_EN_LSB) -#define THERM_CTRL1_INT_EN_SET(x) (((x) << THERM_CTRL1_INT_EN_LSB) & THERM_CTRL1_INT_EN_MASK) -#define THERM_CTRL1_INT_STATUS_MSB 0 -#define THERM_CTRL1_INT_STATUS_LSB 0 -#define THERM_CTRL1_INT_STATUS_MASK 0x00000001 -#define THERM_CTRL1_INT_STATUS_GET(x) (((x) & THERM_CTRL1_INT_STATUS_MASK) >> THERM_CTRL1_INT_STATUS_LSB) -#define THERM_CTRL1_INT_STATUS_SET(x) (((x) << THERM_CTRL1_INT_STATUS_LSB) & THERM_CTRL1_INT_STATUS_MASK) - -#define THERM_CTRL2_ADDRESS 0x000002e0 -#define THERM_CTRL2_OFFSET 0x000002e0 -#define THERM_CTRL2_ADC_OFF_MSB 25 -#define THERM_CTRL2_ADC_OFF_LSB 25 -#define THERM_CTRL2_ADC_OFF_MASK 0x02000000 -#define THERM_CTRL2_ADC_OFF_GET(x) (((x) & THERM_CTRL2_ADC_OFF_MASK) >> THERM_CTRL2_ADC_OFF_LSB) -#define THERM_CTRL2_ADC_OFF_SET(x) (((x) << THERM_CTRL2_ADC_OFF_LSB) & THERM_CTRL2_ADC_OFF_MASK) -#define THERM_CTRL2_ADC_ON_MSB 24 -#define THERM_CTRL2_ADC_ON_LSB 24 -#define THERM_CTRL2_ADC_ON_MASK 0x01000000 -#define THERM_CTRL2_ADC_ON_GET(x) (((x) & THERM_CTRL2_ADC_ON_MASK) >> THERM_CTRL2_ADC_ON_LSB) -#define THERM_CTRL2_ADC_ON_SET(x) (((x) << THERM_CTRL2_ADC_ON_LSB) & THERM_CTRL2_ADC_ON_MASK) -#define THERM_CTRL2_SAMPLE_MSB 23 -#define THERM_CTRL2_SAMPLE_LSB 16 -#define THERM_CTRL2_SAMPLE_MASK 0x00ff0000 -#define THERM_CTRL2_SAMPLE_GET(x) (((x) & THERM_CTRL2_SAMPLE_MASK) >> THERM_CTRL2_SAMPLE_LSB) -#define THERM_CTRL2_SAMPLE_SET(x) (((x) << THERM_CTRL2_SAMPLE_LSB) & THERM_CTRL2_SAMPLE_MASK) -#define THERM_CTRL2_HIGH_MSB 15 -#define THERM_CTRL2_HIGH_LSB 8 -#define THERM_CTRL2_HIGH_MASK 0x0000ff00 -#define THERM_CTRL2_HIGH_GET(x) (((x) & THERM_CTRL2_HIGH_MASK) >> THERM_CTRL2_HIGH_LSB) -#define THERM_CTRL2_HIGH_SET(x) (((x) << THERM_CTRL2_HIGH_LSB) & THERM_CTRL2_HIGH_MASK) -#define THERM_CTRL2_LOW_MSB 7 -#define THERM_CTRL2_LOW_LSB 0 -#define THERM_CTRL2_LOW_MASK 0x000000ff -#define THERM_CTRL2_LOW_GET(x) (((x) & THERM_CTRL2_LOW_MASK) >> THERM_CTRL2_LOW_LSB) -#define THERM_CTRL2_LOW_SET(x) (((x) << THERM_CTRL2_LOW_LSB) & THERM_CTRL2_LOW_MASK) - -#define THERM_CTRL3_ADDRESS 0x000002e4 -#define THERM_CTRL3_OFFSET 0x000002e4 -#define THERM_CTRL3_ADC_GAIN_MSB 16 -#define THERM_CTRL3_ADC_GAIN_LSB 8 -#define THERM_CTRL3_ADC_GAIN_MASK 0x0001ff00 -#define THERM_CTRL3_ADC_GAIN_GET(x) (((x) & THERM_CTRL3_ADC_GAIN_MASK) >> THERM_CTRL3_ADC_GAIN_LSB) -#define THERM_CTRL3_ADC_GAIN_SET(x) (((x) << THERM_CTRL3_ADC_GAIN_LSB) & THERM_CTRL3_ADC_GAIN_MASK) -#define THERM_CTRL3_ADC_OFFSET_MSB 7 -#define THERM_CTRL3_ADC_OFFSET_LSB 0 -#define THERM_CTRL3_ADC_OFFSET_MASK 0x000000ff -#define THERM_CTRL3_ADC_OFFSET_GET(x) (((x) & THERM_CTRL3_ADC_OFFSET_MASK) >> THERM_CTRL3_ADC_OFFSET_LSB) -#define THERM_CTRL3_ADC_OFFSET_SET(x) (((x) << THERM_CTRL3_ADC_OFFSET_LSB) & THERM_CTRL3_ADC_OFFSET_MASK) - -#define LISTEN_MODE1_ADDRESS 0x000002e8 -#define LISTEN_MODE1_OFFSET 0x000002e8 -#define LISTEN_MODE1_TIMER_CLEAR_MSB 19 -#define LISTEN_MODE1_TIMER_CLEAR_LSB 19 -#define LISTEN_MODE1_TIMER_CLEAR_MASK 0x00080000 -#define LISTEN_MODE1_TIMER_CLEAR_GET(x) (((x) & LISTEN_MODE1_TIMER_CLEAR_MASK) >> LISTEN_MODE1_TIMER_CLEAR_LSB) -#define LISTEN_MODE1_TIMER_CLEAR_SET(x) (((x) << LISTEN_MODE1_TIMER_CLEAR_LSB) & LISTEN_MODE1_TIMER_CLEAR_MASK) -#define LISTEN_MODE1_TIMER_THRESH_WAKE_MSB 18 -#define LISTEN_MODE1_TIMER_THRESH_WAKE_LSB 3 -#define LISTEN_MODE1_TIMER_THRESH_WAKE_MASK 0x0007fff8 -#define LISTEN_MODE1_TIMER_THRESH_WAKE_GET(x) (((x) & LISTEN_MODE1_TIMER_THRESH_WAKE_MASK) >> LISTEN_MODE1_TIMER_THRESH_WAKE_LSB) -#define LISTEN_MODE1_TIMER_THRESH_WAKE_SET(x) (((x) << LISTEN_MODE1_TIMER_THRESH_WAKE_LSB) & LISTEN_MODE1_TIMER_THRESH_WAKE_MASK) -#define LISTEN_MODE1_TIMER_OVERFLOW_WAKE_MSB 2 -#define LISTEN_MODE1_TIMER_OVERFLOW_WAKE_LSB 2 -#define LISTEN_MODE1_TIMER_OVERFLOW_WAKE_MASK 0x00000004 -#define LISTEN_MODE1_TIMER_OVERFLOW_WAKE_GET(x) (((x) & LISTEN_MODE1_TIMER_OVERFLOW_WAKE_MASK) >> LISTEN_MODE1_TIMER_OVERFLOW_WAKE_LSB) -#define LISTEN_MODE1_TIMER_OVERFLOW_WAKE_SET(x) (((x) << LISTEN_MODE1_TIMER_OVERFLOW_WAKE_LSB) & LISTEN_MODE1_TIMER_OVERFLOW_WAKE_MASK) -#define LISTEN_MODE1_CLOCK_GATE_MSB 1 -#define LISTEN_MODE1_CLOCK_GATE_LSB 1 -#define LISTEN_MODE1_CLOCK_GATE_MASK 0x00000002 -#define LISTEN_MODE1_CLOCK_GATE_GET(x) (((x) & LISTEN_MODE1_CLOCK_GATE_MASK) >> LISTEN_MODE1_CLOCK_GATE_LSB) -#define LISTEN_MODE1_CLOCK_GATE_SET(x) (((x) << LISTEN_MODE1_CLOCK_GATE_LSB) & LISTEN_MODE1_CLOCK_GATE_MASK) -#define LISTEN_MODE1_ENABLE_MSB 0 -#define LISTEN_MODE1_ENABLE_LSB 0 -#define LISTEN_MODE1_ENABLE_MASK 0x00000001 -#define LISTEN_MODE1_ENABLE_GET(x) (((x) & LISTEN_MODE1_ENABLE_MASK) >> LISTEN_MODE1_ENABLE_LSB) -#define LISTEN_MODE1_ENABLE_SET(x) (((x) << LISTEN_MODE1_ENABLE_LSB) & LISTEN_MODE1_ENABLE_MASK) - -#define LISTEN_MODE2_ADDRESS 0x000002ec -#define LISTEN_MODE2_OFFSET 0x000002ec -#define LISTEN_MODE2_TIMER_TRIGGER_WAKE_MSB 15 -#define LISTEN_MODE2_TIMER_TRIGGER_WAKE_LSB 0 -#define LISTEN_MODE2_TIMER_TRIGGER_WAKE_MASK 0x0000ffff -#define LISTEN_MODE2_TIMER_TRIGGER_WAKE_GET(x) (((x) & LISTEN_MODE2_TIMER_TRIGGER_WAKE_MASK) >> LISTEN_MODE2_TIMER_TRIGGER_WAKE_LSB) -#define LISTEN_MODE2_TIMER_TRIGGER_WAKE_SET(x) (((x) << LISTEN_MODE2_TIMER_TRIGGER_WAKE_LSB) & LISTEN_MODE2_TIMER_TRIGGER_WAKE_MASK) - -#define AUDIO_PLL_CONFIG_ADDRESS 0x000002f0 -#define AUDIO_PLL_CONFIG_OFFSET 0x000002f0 -#define AUDIO_PLL_CONFIG_UPDATING_MSB 31 -#define AUDIO_PLL_CONFIG_UPDATING_LSB 31 -#define AUDIO_PLL_CONFIG_UPDATING_MASK 0x80000000 -#define AUDIO_PLL_CONFIG_UPDATING_GET(x) (((x) & AUDIO_PLL_CONFIG_UPDATING_MASK) >> AUDIO_PLL_CONFIG_UPDATING_LSB) -#define AUDIO_PLL_CONFIG_UPDATING_SET(x) (((x) << AUDIO_PLL_CONFIG_UPDATING_LSB) & AUDIO_PLL_CONFIG_UPDATING_MASK) -#define AUDIO_PLL_CONFIG_EXT_DIV_MSB 14 -#define AUDIO_PLL_CONFIG_EXT_DIV_LSB 12 -#define AUDIO_PLL_CONFIG_EXT_DIV_MASK 0x00007000 -#define AUDIO_PLL_CONFIG_EXT_DIV_GET(x) (((x) & AUDIO_PLL_CONFIG_EXT_DIV_MASK) >> AUDIO_PLL_CONFIG_EXT_DIV_LSB) -#define AUDIO_PLL_CONFIG_EXT_DIV_SET(x) (((x) << AUDIO_PLL_CONFIG_EXT_DIV_LSB) & AUDIO_PLL_CONFIG_EXT_DIV_MASK) -#define AUDIO_PLL_CONFIG_POSTPLLDIV_MSB 9 -#define AUDIO_PLL_CONFIG_POSTPLLDIV_LSB 7 -#define AUDIO_PLL_CONFIG_POSTPLLDIV_MASK 0x00000380 -#define AUDIO_PLL_CONFIG_POSTPLLDIV_GET(x) (((x) & AUDIO_PLL_CONFIG_POSTPLLDIV_MASK) >> AUDIO_PLL_CONFIG_POSTPLLDIV_LSB) -#define AUDIO_PLL_CONFIG_POSTPLLDIV_SET(x) (((x) << AUDIO_PLL_CONFIG_POSTPLLDIV_LSB) & AUDIO_PLL_CONFIG_POSTPLLDIV_MASK) -#define AUDIO_PLL_CONFIG_PLLPWD_MSB 5 -#define AUDIO_PLL_CONFIG_PLLPWD_LSB 5 -#define AUDIO_PLL_CONFIG_PLLPWD_MASK 0x00000020 -#define AUDIO_PLL_CONFIG_PLLPWD_GET(x) (((x) & AUDIO_PLL_CONFIG_PLLPWD_MASK) >> AUDIO_PLL_CONFIG_PLLPWD_LSB) -#define AUDIO_PLL_CONFIG_PLLPWD_SET(x) (((x) << AUDIO_PLL_CONFIG_PLLPWD_LSB) & AUDIO_PLL_CONFIG_PLLPWD_MASK) -#define AUDIO_PLL_CONFIG_BYPASS_MSB 4 -#define AUDIO_PLL_CONFIG_BYPASS_LSB 4 -#define AUDIO_PLL_CONFIG_BYPASS_MASK 0x00000010 -#define AUDIO_PLL_CONFIG_BYPASS_GET(x) (((x) & AUDIO_PLL_CONFIG_BYPASS_MASK) >> AUDIO_PLL_CONFIG_BYPASS_LSB) -#define AUDIO_PLL_CONFIG_BYPASS_SET(x) (((x) << AUDIO_PLL_CONFIG_BYPASS_LSB) & AUDIO_PLL_CONFIG_BYPASS_MASK) -#define AUDIO_PLL_CONFIG_REFDIV_MSB 3 -#define AUDIO_PLL_CONFIG_REFDIV_LSB 0 -#define AUDIO_PLL_CONFIG_REFDIV_MASK 0x0000000f -#define AUDIO_PLL_CONFIG_REFDIV_GET(x) (((x) & AUDIO_PLL_CONFIG_REFDIV_MASK) >> AUDIO_PLL_CONFIG_REFDIV_LSB) -#define AUDIO_PLL_CONFIG_REFDIV_SET(x) (((x) << AUDIO_PLL_CONFIG_REFDIV_LSB) & AUDIO_PLL_CONFIG_REFDIV_MASK) - -#define AUDIO_PLL_MODULATION_ADDRESS 0x000002f4 -#define AUDIO_PLL_MODULATION_OFFSET 0x000002f4 -#define AUDIO_PLL_MODULATION_TGT_DIV_FRAC_MSB 28 -#define AUDIO_PLL_MODULATION_TGT_DIV_FRAC_LSB 11 -#define AUDIO_PLL_MODULATION_TGT_DIV_FRAC_MASK 0x1ffff800 -#define AUDIO_PLL_MODULATION_TGT_DIV_FRAC_GET(x) (((x) & AUDIO_PLL_MODULATION_TGT_DIV_FRAC_MASK) >> AUDIO_PLL_MODULATION_TGT_DIV_FRAC_LSB) -#define AUDIO_PLL_MODULATION_TGT_DIV_FRAC_SET(x) (((x) << AUDIO_PLL_MODULATION_TGT_DIV_FRAC_LSB) & AUDIO_PLL_MODULATION_TGT_DIV_FRAC_MASK) -#define AUDIO_PLL_MODULATION_TGT_DIV_INT_MSB 6 -#define AUDIO_PLL_MODULATION_TGT_DIV_INT_LSB 1 -#define AUDIO_PLL_MODULATION_TGT_DIV_INT_MASK 0x0000007e -#define AUDIO_PLL_MODULATION_TGT_DIV_INT_GET(x) (((x) & AUDIO_PLL_MODULATION_TGT_DIV_INT_MASK) >> AUDIO_PLL_MODULATION_TGT_DIV_INT_LSB) -#define AUDIO_PLL_MODULATION_TGT_DIV_INT_SET(x) (((x) << AUDIO_PLL_MODULATION_TGT_DIV_INT_LSB) & AUDIO_PLL_MODULATION_TGT_DIV_INT_MASK) -#define AUDIO_PLL_MODULATION_START_MSB 0 -#define AUDIO_PLL_MODULATION_START_LSB 0 -#define AUDIO_PLL_MODULATION_START_MASK 0x00000001 -#define AUDIO_PLL_MODULATION_START_GET(x) (((x) & AUDIO_PLL_MODULATION_START_MASK) >> AUDIO_PLL_MODULATION_START_LSB) -#define AUDIO_PLL_MODULATION_START_SET(x) (((x) << AUDIO_PLL_MODULATION_START_LSB) & AUDIO_PLL_MODULATION_START_MASK) - -#define AUDIO_PLL_MOD_STEP_ADDRESS 0x000002f8 -#define AUDIO_PLL_MOD_STEP_OFFSET 0x000002f8 -#define AUDIO_PLL_MOD_STEP_FRAC_MSB 31 -#define AUDIO_PLL_MOD_STEP_FRAC_LSB 14 -#define AUDIO_PLL_MOD_STEP_FRAC_MASK 0xffffc000 -#define AUDIO_PLL_MOD_STEP_FRAC_GET(x) (((x) & AUDIO_PLL_MOD_STEP_FRAC_MASK) >> AUDIO_PLL_MOD_STEP_FRAC_LSB) -#define AUDIO_PLL_MOD_STEP_FRAC_SET(x) (((x) << AUDIO_PLL_MOD_STEP_FRAC_LSB) & AUDIO_PLL_MOD_STEP_FRAC_MASK) -#define AUDIO_PLL_MOD_STEP_INT_MSB 13 -#define AUDIO_PLL_MOD_STEP_INT_LSB 4 -#define AUDIO_PLL_MOD_STEP_INT_MASK 0x00003ff0 -#define AUDIO_PLL_MOD_STEP_INT_GET(x) (((x) & AUDIO_PLL_MOD_STEP_INT_MASK) >> AUDIO_PLL_MOD_STEP_INT_LSB) -#define AUDIO_PLL_MOD_STEP_INT_SET(x) (((x) << AUDIO_PLL_MOD_STEP_INT_LSB) & AUDIO_PLL_MOD_STEP_INT_MASK) -#define AUDIO_PLL_MOD_STEP_UPDATE_CNT_MSB 3 -#define AUDIO_PLL_MOD_STEP_UPDATE_CNT_LSB 0 -#define AUDIO_PLL_MOD_STEP_UPDATE_CNT_MASK 0x0000000f -#define AUDIO_PLL_MOD_STEP_UPDATE_CNT_GET(x) (((x) & AUDIO_PLL_MOD_STEP_UPDATE_CNT_MASK) >> AUDIO_PLL_MOD_STEP_UPDATE_CNT_LSB) -#define AUDIO_PLL_MOD_STEP_UPDATE_CNT_SET(x) (((x) << AUDIO_PLL_MOD_STEP_UPDATE_CNT_LSB) & AUDIO_PLL_MOD_STEP_UPDATE_CNT_MASK) - -#define CURRENT_AUDIO_PLL_MODULATION_ADDRESS 0x000002fc -#define CURRENT_AUDIO_PLL_MODULATION_OFFSET 0x000002fc -#define CURRENT_AUDIO_PLL_MODULATION_FRAC_MSB 27 -#define CURRENT_AUDIO_PLL_MODULATION_FRAC_LSB 10 -#define CURRENT_AUDIO_PLL_MODULATION_FRAC_MASK 0x0ffffc00 -#define CURRENT_AUDIO_PLL_MODULATION_FRAC_GET(x) (((x) & CURRENT_AUDIO_PLL_MODULATION_FRAC_MASK) >> CURRENT_AUDIO_PLL_MODULATION_FRAC_LSB) -#define CURRENT_AUDIO_PLL_MODULATION_FRAC_SET(x) (((x) << CURRENT_AUDIO_PLL_MODULATION_FRAC_LSB) & CURRENT_AUDIO_PLL_MODULATION_FRAC_MASK) -#define CURRENT_AUDIO_PLL_MODULATION_INT_MSB 6 -#define CURRENT_AUDIO_PLL_MODULATION_INT_LSB 1 -#define CURRENT_AUDIO_PLL_MODULATION_INT_MASK 0x0000007e -#define CURRENT_AUDIO_PLL_MODULATION_INT_GET(x) (((x) & CURRENT_AUDIO_PLL_MODULATION_INT_MASK) >> CURRENT_AUDIO_PLL_MODULATION_INT_LSB) -#define CURRENT_AUDIO_PLL_MODULATION_INT_SET(x) (((x) << CURRENT_AUDIO_PLL_MODULATION_INT_LSB) & CURRENT_AUDIO_PLL_MODULATION_INT_MASK) - -#define ETH_PLL_CONFIG_ADDRESS 0x00000300 -#define ETH_PLL_CONFIG_OFFSET 0x00000300 -#define ETH_PLL_CONFIG_GE0_MASTER_MSB 30 -#define ETH_PLL_CONFIG_GE0_MASTER_LSB 30 -#define ETH_PLL_CONFIG_GE0_MASTER_MASK 0x40000000 -#define ETH_PLL_CONFIG_GE0_MASTER_GET(x) (((x) & ETH_PLL_CONFIG_GE0_MASTER_MASK) >> ETH_PLL_CONFIG_GE0_MASTER_LSB) -#define ETH_PLL_CONFIG_GE0_MASTER_SET(x) (((x) << ETH_PLL_CONFIG_GE0_MASTER_LSB) & ETH_PLL_CONFIG_GE0_MASTER_MASK) -#define ETH_PLL_CONFIG_GE0_MSB 29 -#define ETH_PLL_CONFIG_GE0_LSB 29 -#define ETH_PLL_CONFIG_GE0_MASK 0x20000000 -#define ETH_PLL_CONFIG_GE0_GET(x) (((x) & ETH_PLL_CONFIG_GE0_MASK) >> ETH_PLL_CONFIG_GE0_LSB) -#define ETH_PLL_CONFIG_GE0_SET(x) (((x) << ETH_PLL_CONFIG_GE0_LSB) & ETH_PLL_CONFIG_GE0_MASK) -#define ETH_PLL_CONFIG_RANGE_MSB 28 -#define ETH_PLL_CONFIG_RANGE_LSB 28 -#define ETH_PLL_CONFIG_RANGE_MASK 0x10000000 -#define ETH_PLL_CONFIG_RANGE_GET(x) (((x) & ETH_PLL_CONFIG_RANGE_MASK) >> ETH_PLL_CONFIG_RANGE_LSB) -#define ETH_PLL_CONFIG_RANGE_SET(x) (((x) << ETH_PLL_CONFIG_RANGE_LSB) & ETH_PLL_CONFIG_RANGE_MASK) -#define ETH_PLL_CONFIG_FRAC_MSB 27 -#define ETH_PLL_CONFIG_FRAC_LSB 18 -#define ETH_PLL_CONFIG_FRAC_MASK 0x0ffc0000 -#define ETH_PLL_CONFIG_FRAC_GET(x) (((x) & ETH_PLL_CONFIG_FRAC_MASK) >> ETH_PLL_CONFIG_FRAC_LSB) -#define ETH_PLL_CONFIG_FRAC_SET(x) (((x) << ETH_PLL_CONFIG_FRAC_LSB) & ETH_PLL_CONFIG_FRAC_MASK) -#define ETH_PLL_CONFIG_INT_MSB 17 -#define ETH_PLL_CONFIG_INT_LSB 12 -#define ETH_PLL_CONFIG_INT_MASK 0x0003f000 -#define ETH_PLL_CONFIG_INT_GET(x) (((x) & ETH_PLL_CONFIG_INT_MASK) >> ETH_PLL_CONFIG_INT_LSB) -#define ETH_PLL_CONFIG_INT_SET(x) (((x) << ETH_PLL_CONFIG_INT_LSB) & ETH_PLL_CONFIG_INT_MASK) -#define ETH_PLL_CONFIG_OUTDIV_MSB 9 -#define ETH_PLL_CONFIG_OUTDIV_LSB 7 -#define ETH_PLL_CONFIG_OUTDIV_MASK 0x00000380 -#define ETH_PLL_CONFIG_OUTDIV_GET(x) (((x) & ETH_PLL_CONFIG_OUTDIV_MASK) >> ETH_PLL_CONFIG_OUTDIV_LSB) -#define ETH_PLL_CONFIG_OUTDIV_SET(x) (((x) << ETH_PLL_CONFIG_OUTDIV_LSB) & ETH_PLL_CONFIG_OUTDIV_MASK) -#define ETH_PLL_CONFIG_PLLPWD_MSB 6 -#define ETH_PLL_CONFIG_PLLPWD_LSB 6 -#define ETH_PLL_CONFIG_PLLPWD_MASK 0x00000040 -#define ETH_PLL_CONFIG_PLLPWD_GET(x) (((x) & ETH_PLL_CONFIG_PLLPWD_MASK) >> ETH_PLL_CONFIG_PLLPWD_LSB) -#define ETH_PLL_CONFIG_PLLPWD_SET(x) (((x) << ETH_PLL_CONFIG_PLLPWD_LSB) & ETH_PLL_CONFIG_PLLPWD_MASK) -#define ETH_PLL_CONFIG_BYPASS_MSB 5 -#define ETH_PLL_CONFIG_BYPASS_LSB 5 -#define ETH_PLL_CONFIG_BYPASS_MASK 0x00000020 -#define ETH_PLL_CONFIG_BYPASS_GET(x) (((x) & ETH_PLL_CONFIG_BYPASS_MASK) >> ETH_PLL_CONFIG_BYPASS_LSB) -#define ETH_PLL_CONFIG_BYPASS_SET(x) (((x) << ETH_PLL_CONFIG_BYPASS_LSB) & ETH_PLL_CONFIG_BYPASS_MASK) -#define ETH_PLL_CONFIG_REFDIV_MSB 4 -#define ETH_PLL_CONFIG_REFDIV_LSB 0 -#define ETH_PLL_CONFIG_REFDIV_MASK 0x0000001f -#define ETH_PLL_CONFIG_REFDIV_GET(x) (((x) & ETH_PLL_CONFIG_REFDIV_MASK) >> ETH_PLL_CONFIG_REFDIV_LSB) -#define ETH_PLL_CONFIG_REFDIV_SET(x) (((x) << ETH_PLL_CONFIG_REFDIV_LSB) & ETH_PLL_CONFIG_REFDIV_MASK) - -#define CPU_PLL_CONFIG_ADDRESS 0x00000304 -#define CPU_PLL_CONFIG_OFFSET 0x00000304 -#define CPU_PLL_CONFIG_RANGE_MSB 28 -#define CPU_PLL_CONFIG_RANGE_LSB 28 -#define CPU_PLL_CONFIG_RANGE_MASK 0x10000000 -#define CPU_PLL_CONFIG_RANGE_GET(x) (((x) & CPU_PLL_CONFIG_RANGE_MASK) >> CPU_PLL_CONFIG_RANGE_LSB) -#define CPU_PLL_CONFIG_RANGE_SET(x) (((x) << CPU_PLL_CONFIG_RANGE_LSB) & CPU_PLL_CONFIG_RANGE_MASK) -#define CPU_PLL_CONFIG_FRAC_MSB 25 -#define CPU_PLL_CONFIG_FRAC_LSB 20 -#define CPU_PLL_CONFIG_FRAC_MASK 0x03f00000 -#define CPU_PLL_CONFIG_FRAC_GET(x) (((x) & CPU_PLL_CONFIG_FRAC_MASK) >> CPU_PLL_CONFIG_FRAC_LSB) -#define CPU_PLL_CONFIG_FRAC_SET(x) (((x) << CPU_PLL_CONFIG_FRAC_LSB) & CPU_PLL_CONFIG_FRAC_MASK) -#define CPU_PLL_CONFIG_INT_MSB 17 -#define CPU_PLL_CONFIG_INT_LSB 12 -#define CPU_PLL_CONFIG_INT_MASK 0x0003f000 -#define CPU_PLL_CONFIG_INT_GET(x) (((x) & CPU_PLL_CONFIG_INT_MASK) >> CPU_PLL_CONFIG_INT_LSB) -#define CPU_PLL_CONFIG_INT_SET(x) (((x) << CPU_PLL_CONFIG_INT_LSB) & CPU_PLL_CONFIG_INT_MASK) -#define CPU_PLL_CONFIG_OUTDIV_MSB 9 -#define CPU_PLL_CONFIG_OUTDIV_LSB 7 -#define CPU_PLL_CONFIG_OUTDIV_MASK 0x00000380 -#define CPU_PLL_CONFIG_OUTDIV_GET(x) (((x) & CPU_PLL_CONFIG_OUTDIV_MASK) >> CPU_PLL_CONFIG_OUTDIV_LSB) -#define CPU_PLL_CONFIG_OUTDIV_SET(x) (((x) << CPU_PLL_CONFIG_OUTDIV_LSB) & CPU_PLL_CONFIG_OUTDIV_MASK) -#define CPU_PLL_CONFIG_PLLPWD_MSB 6 -#define CPU_PLL_CONFIG_PLLPWD_LSB 6 -#define CPU_PLL_CONFIG_PLLPWD_MASK 0x00000040 -#define CPU_PLL_CONFIG_PLLPWD_GET(x) (((x) & CPU_PLL_CONFIG_PLLPWD_MASK) >> CPU_PLL_CONFIG_PLLPWD_LSB) -#define CPU_PLL_CONFIG_PLLPWD_SET(x) (((x) << CPU_PLL_CONFIG_PLLPWD_LSB) & CPU_PLL_CONFIG_PLLPWD_MASK) -#define CPU_PLL_CONFIG_REFDIV_MSB 4 -#define CPU_PLL_CONFIG_REFDIV_LSB 0 -#define CPU_PLL_CONFIG_REFDIV_MASK 0x0000001f -#define CPU_PLL_CONFIG_REFDIV_GET(x) (((x) & CPU_PLL_CONFIG_REFDIV_MASK) >> CPU_PLL_CONFIG_REFDIV_LSB) -#define CPU_PLL_CONFIG_REFDIV_SET(x) (((x) << CPU_PLL_CONFIG_REFDIV_LSB) & CPU_PLL_CONFIG_REFDIV_MASK) - -#define BB_PLL_CONFIG_ADDRESS 0x00000308 -#define BB_PLL_CONFIG_OFFSET 0x00000308 -#define BB_PLL_CONFIG_FRAC_MSB 17 -#define BB_PLL_CONFIG_FRAC_LSB 0 -#define BB_PLL_CONFIG_FRAC_MASK 0x0003ffff -#define BB_PLL_CONFIG_FRAC_GET(x) (((x) & BB_PLL_CONFIG_FRAC_MASK) >> BB_PLL_CONFIG_FRAC_LSB) -#define BB_PLL_CONFIG_FRAC_SET(x) (((x) << BB_PLL_CONFIG_FRAC_LSB) & BB_PLL_CONFIG_FRAC_MASK) - -#define ETH_XMII_ADDRESS 0x0000030c -#define ETH_XMII_OFFSET 0x0000030c -#define ETH_XMII_TX_INVERT_MSB 31 -#define ETH_XMII_TX_INVERT_LSB 31 -#define ETH_XMII_TX_INVERT_MASK 0x80000000 -#define ETH_XMII_TX_INVERT_GET(x) (((x) & ETH_XMII_TX_INVERT_MASK) >> ETH_XMII_TX_INVERT_LSB) -#define ETH_XMII_TX_INVERT_SET(x) (((x) << ETH_XMII_TX_INVERT_LSB) & ETH_XMII_TX_INVERT_MASK) -#define ETH_XMII_GIGE_QUAD_MSB 30 -#define ETH_XMII_GIGE_QUAD_LSB 30 -#define ETH_XMII_GIGE_QUAD_MASK 0x40000000 -#define ETH_XMII_GIGE_QUAD_GET(x) (((x) & ETH_XMII_GIGE_QUAD_MASK) >> ETH_XMII_GIGE_QUAD_LSB) -#define ETH_XMII_GIGE_QUAD_SET(x) (((x) << ETH_XMII_GIGE_QUAD_LSB) & ETH_XMII_GIGE_QUAD_MASK) -#define ETH_XMII_RX_DELAY_MSB 29 -#define ETH_XMII_RX_DELAY_LSB 28 -#define ETH_XMII_RX_DELAY_MASK 0x30000000 -#define ETH_XMII_RX_DELAY_GET(x) (((x) & ETH_XMII_RX_DELAY_MASK) >> ETH_XMII_RX_DELAY_LSB) -#define ETH_XMII_RX_DELAY_SET(x) (((x) << ETH_XMII_RX_DELAY_LSB) & ETH_XMII_RX_DELAY_MASK) -#define ETH_XMII_TX_DELAY_MSB 27 -#define ETH_XMII_TX_DELAY_LSB 26 -#define ETH_XMII_TX_DELAY_MASK 0x0c000000 -#define ETH_XMII_TX_DELAY_GET(x) (((x) & ETH_XMII_TX_DELAY_MASK) >> ETH_XMII_TX_DELAY_LSB) -#define ETH_XMII_TX_DELAY_SET(x) (((x) << ETH_XMII_TX_DELAY_LSB) & ETH_XMII_TX_DELAY_MASK) -#define ETH_XMII_GIGE_MSB 25 -#define ETH_XMII_GIGE_LSB 25 -#define ETH_XMII_GIGE_MASK 0x02000000 -#define ETH_XMII_GIGE_GET(x) (((x) & ETH_XMII_GIGE_MASK) >> ETH_XMII_GIGE_LSB) -#define ETH_XMII_GIGE_SET(x) (((x) << ETH_XMII_GIGE_LSB) & ETH_XMII_GIGE_MASK) -#define ETH_XMII_OFFSET_PHASE_MSB 24 -#define ETH_XMII_OFFSET_PHASE_LSB 24 -#define ETH_XMII_OFFSET_PHASE_MASK 0x01000000 -#define ETH_XMII_OFFSET_PHASE_GET(x) (((x) & ETH_XMII_OFFSET_PHASE_MASK) >> ETH_XMII_OFFSET_PHASE_LSB) -#define ETH_XMII_OFFSET_PHASE_SET(x) (((x) << ETH_XMII_OFFSET_PHASE_LSB) & ETH_XMII_OFFSET_PHASE_MASK) -#define ETH_XMII_OFFSET_COUNT_MSB 23 -#define ETH_XMII_OFFSET_COUNT_LSB 16 -#define ETH_XMII_OFFSET_COUNT_MASK 0x00ff0000 -#define ETH_XMII_OFFSET_COUNT_GET(x) (((x) & ETH_XMII_OFFSET_COUNT_MASK) >> ETH_XMII_OFFSET_COUNT_LSB) -#define ETH_XMII_OFFSET_COUNT_SET(x) (((x) << ETH_XMII_OFFSET_COUNT_LSB) & ETH_XMII_OFFSET_COUNT_MASK) -#define ETH_XMII_PHASE1_COUNT_MSB 15 -#define ETH_XMII_PHASE1_COUNT_LSB 8 -#define ETH_XMII_PHASE1_COUNT_MASK 0x0000ff00 -#define ETH_XMII_PHASE1_COUNT_GET(x) (((x) & ETH_XMII_PHASE1_COUNT_MASK) >> ETH_XMII_PHASE1_COUNT_LSB) -#define ETH_XMII_PHASE1_COUNT_SET(x) (((x) << ETH_XMII_PHASE1_COUNT_LSB) & ETH_XMII_PHASE1_COUNT_MASK) -#define ETH_XMII_PHASE0_COUNT_MSB 7 -#define ETH_XMII_PHASE0_COUNT_LSB 0 -#define ETH_XMII_PHASE0_COUNT_MASK 0x000000ff -#define ETH_XMII_PHASE0_COUNT_GET(x) (((x) & ETH_XMII_PHASE0_COUNT_MASK) >> ETH_XMII_PHASE0_COUNT_LSB) -#define ETH_XMII_PHASE0_COUNT_SET(x) (((x) << ETH_XMII_PHASE0_COUNT_LSB) & ETH_XMII_PHASE0_COUNT_MASK) - -#define USB_PHY_CONFIG_ADDRESS 0x00000310 -#define USB_PHY_CONFIG_OFFSET 0x00000310 -#define USB_PHY_CONFIG_REFCLK_SEL_MSB 7 -#define USB_PHY_CONFIG_REFCLK_SEL_LSB 4 -#define USB_PHY_CONFIG_REFCLK_SEL_MASK 0x000000f0 -#define USB_PHY_CONFIG_REFCLK_SEL_GET(x) (((x) & USB_PHY_CONFIG_REFCLK_SEL_MASK) >> USB_PHY_CONFIG_REFCLK_SEL_LSB) -#define USB_PHY_CONFIG_REFCLK_SEL_SET(x) (((x) << USB_PHY_CONFIG_REFCLK_SEL_LSB) & USB_PHY_CONFIG_REFCLK_SEL_MASK) -#define USB_PHY_CONFIG_REFDIV_MSB 3 -#define USB_PHY_CONFIG_REFDIV_LSB 3 -#define USB_PHY_CONFIG_REFDIV_MASK 0x00000008 -#define USB_PHY_CONFIG_REFDIV_GET(x) (((x) & USB_PHY_CONFIG_REFDIV_MASK) >> USB_PHY_CONFIG_REFDIV_LSB) -#define USB_PHY_CONFIG_REFDIV_SET(x) (((x) << USB_PHY_CONFIG_REFDIV_LSB) & USB_PHY_CONFIG_REFDIV_MASK) -#define USB_PHY_CONFIG_TESTMODE_MSB 2 -#define USB_PHY_CONFIG_TESTMODE_LSB 2 -#define USB_PHY_CONFIG_TESTMODE_MASK 0x00000004 -#define USB_PHY_CONFIG_TESTMODE_GET(x) (((x) & USB_PHY_CONFIG_TESTMODE_MASK) >> USB_PHY_CONFIG_TESTMODE_LSB) -#define USB_PHY_CONFIG_TESTMODE_SET(x) (((x) << USB_PHY_CONFIG_TESTMODE_LSB) & USB_PHY_CONFIG_TESTMODE_MASK) -#define USB_PHY_CONFIG_PLL_PWD_MSB 1 -#define USB_PHY_CONFIG_PLL_PWD_LSB 1 -#define USB_PHY_CONFIG_PLL_PWD_MASK 0x00000002 -#define USB_PHY_CONFIG_PLL_PWD_GET(x) (((x) & USB_PHY_CONFIG_PLL_PWD_MASK) >> USB_PHY_CONFIG_PLL_PWD_LSB) -#define USB_PHY_CONFIG_PLL_PWD_SET(x) (((x) << USB_PHY_CONFIG_PLL_PWD_LSB) & USB_PHY_CONFIG_PLL_PWD_MASK) -#define USB_PHY_CONFIG_HOSTMODE_MSB 0 -#define USB_PHY_CONFIG_HOSTMODE_LSB 0 -#define USB_PHY_CONFIG_HOSTMODE_MASK 0x00000001 -#define USB_PHY_CONFIG_HOSTMODE_GET(x) (((x) & USB_PHY_CONFIG_HOSTMODE_MASK) >> USB_PHY_CONFIG_HOSTMODE_LSB) -#define USB_PHY_CONFIG_HOSTMODE_SET(x) (((x) << USB_PHY_CONFIG_HOSTMODE_LSB) & USB_PHY_CONFIG_HOSTMODE_MASK) - -#define MITSUMI_INT_CONTROL_REG_ADDRESS 0x00000314 -#define MITSUMI_INT_CONTROL_REG_OFFSET 0x00000314 -#define MITSUMI_INT_CONTROL_REG_FLIGHT_MODE_EN_MSB 3 -#define MITSUMI_INT_CONTROL_REG_FLIGHT_MODE_EN_LSB 3 -#define MITSUMI_INT_CONTROL_REG_FLIGHT_MODE_EN_MASK 0x00000008 -#define MITSUMI_INT_CONTROL_REG_FLIGHT_MODE_EN_GET(x) (((x) & MITSUMI_INT_CONTROL_REG_FLIGHT_MODE_EN_MASK) >> MITSUMI_INT_CONTROL_REG_FLIGHT_MODE_EN_LSB) -#define MITSUMI_INT_CONTROL_REG_FLIGHT_MODE_EN_SET(x) (((x) << MITSUMI_INT_CONTROL_REG_FLIGHT_MODE_EN_LSB) & MITSUMI_INT_CONTROL_REG_FLIGHT_MODE_EN_MASK) -#define MITSUMI_INT_CONTROL_REG_BBP_SLEEP_EN_MSB 2 -#define MITSUMI_INT_CONTROL_REG_BBP_SLEEP_EN_LSB 2 -#define MITSUMI_INT_CONTROL_REG_BBP_SLEEP_EN_MASK 0x00000004 -#define MITSUMI_INT_CONTROL_REG_BBP_SLEEP_EN_GET(x) (((x) & MITSUMI_INT_CONTROL_REG_BBP_SLEEP_EN_MASK) >> MITSUMI_INT_CONTROL_REG_BBP_SLEEP_EN_LSB) -#define MITSUMI_INT_CONTROL_REG_BBP_SLEEP_EN_SET(x) (((x) << MITSUMI_INT_CONTROL_REG_BBP_SLEEP_EN_LSB) & MITSUMI_INT_CONTROL_REG_BBP_SLEEP_EN_MASK) -#define MITSUMI_INT_CONTROL_REG_RF_SLEEP_EN_MSB 1 -#define MITSUMI_INT_CONTROL_REG_RF_SLEEP_EN_LSB 1 -#define MITSUMI_INT_CONTROL_REG_RF_SLEEP_EN_MASK 0x00000002 -#define MITSUMI_INT_CONTROL_REG_RF_SLEEP_EN_GET(x) (((x) & MITSUMI_INT_CONTROL_REG_RF_SLEEP_EN_MASK) >> MITSUMI_INT_CONTROL_REG_RF_SLEEP_EN_LSB) -#define MITSUMI_INT_CONTROL_REG_RF_SLEEP_EN_SET(x) (((x) << MITSUMI_INT_CONTROL_REG_RF_SLEEP_EN_LSB) & MITSUMI_INT_CONTROL_REG_RF_SLEEP_EN_MASK) -#define MITSUMI_INT_CONTROL_REG_MODE_SWITCH_EN_MSB 0 -#define MITSUMI_INT_CONTROL_REG_MODE_SWITCH_EN_LSB 0 -#define MITSUMI_INT_CONTROL_REG_MODE_SWITCH_EN_MASK 0x00000001 -#define MITSUMI_INT_CONTROL_REG_MODE_SWITCH_EN_GET(x) (((x) & MITSUMI_INT_CONTROL_REG_MODE_SWITCH_EN_MASK) >> MITSUMI_INT_CONTROL_REG_MODE_SWITCH_EN_LSB) -#define MITSUMI_INT_CONTROL_REG_MODE_SWITCH_EN_SET(x) (((x) << MITSUMI_INT_CONTROL_REG_MODE_SWITCH_EN_LSB) & MITSUMI_INT_CONTROL_REG_MODE_SWITCH_EN_MASK) - -#define MITSUMI_INT_STATUS_REG_ADDRESS 0x00000318 -#define MITSUMI_INT_STATUS_REG_OFFSET 0x00000318 -#define MITSUMI_INT_STATUS_REG_FLIGHT_MODE_INT_MSB 3 -#define MITSUMI_INT_STATUS_REG_FLIGHT_MODE_INT_LSB 3 -#define MITSUMI_INT_STATUS_REG_FLIGHT_MODE_INT_MASK 0x00000008 -#define MITSUMI_INT_STATUS_REG_FLIGHT_MODE_INT_GET(x) (((x) & MITSUMI_INT_STATUS_REG_FLIGHT_MODE_INT_MASK) >> MITSUMI_INT_STATUS_REG_FLIGHT_MODE_INT_LSB) -#define MITSUMI_INT_STATUS_REG_FLIGHT_MODE_INT_SET(x) (((x) << MITSUMI_INT_STATUS_REG_FLIGHT_MODE_INT_LSB) & MITSUMI_INT_STATUS_REG_FLIGHT_MODE_INT_MASK) -#define MITSUMI_INT_STATUS_REG_BBP_SLEEP_INT_MSB 2 -#define MITSUMI_INT_STATUS_REG_BBP_SLEEP_INT_LSB 2 -#define MITSUMI_INT_STATUS_REG_BBP_SLEEP_INT_MASK 0x00000004 -#define MITSUMI_INT_STATUS_REG_BBP_SLEEP_INT_GET(x) (((x) & MITSUMI_INT_STATUS_REG_BBP_SLEEP_INT_MASK) >> MITSUMI_INT_STATUS_REG_BBP_SLEEP_INT_LSB) -#define MITSUMI_INT_STATUS_REG_BBP_SLEEP_INT_SET(x) (((x) << MITSUMI_INT_STATUS_REG_BBP_SLEEP_INT_LSB) & MITSUMI_INT_STATUS_REG_BBP_SLEEP_INT_MASK) -#define MITSUMI_INT_STATUS_REG_RF_SLEEP_INT_MSB 1 -#define MITSUMI_INT_STATUS_REG_RF_SLEEP_INT_LSB 1 -#define MITSUMI_INT_STATUS_REG_RF_SLEEP_INT_MASK 0x00000002 -#define MITSUMI_INT_STATUS_REG_RF_SLEEP_INT_GET(x) (((x) & MITSUMI_INT_STATUS_REG_RF_SLEEP_INT_MASK) >> MITSUMI_INT_STATUS_REG_RF_SLEEP_INT_LSB) -#define MITSUMI_INT_STATUS_REG_RF_SLEEP_INT_SET(x) (((x) << MITSUMI_INT_STATUS_REG_RF_SLEEP_INT_LSB) & MITSUMI_INT_STATUS_REG_RF_SLEEP_INT_MASK) -#define MITSUMI_INT_STATUS_REG_MODE_SWITCH_INT_MSB 0 -#define MITSUMI_INT_STATUS_REG_MODE_SWITCH_INT_LSB 0 -#define MITSUMI_INT_STATUS_REG_MODE_SWITCH_INT_MASK 0x00000001 -#define MITSUMI_INT_STATUS_REG_MODE_SWITCH_INT_GET(x) (((x) & MITSUMI_INT_STATUS_REG_MODE_SWITCH_INT_MASK) >> MITSUMI_INT_STATUS_REG_MODE_SWITCH_INT_LSB) -#define MITSUMI_INT_STATUS_REG_MODE_SWITCH_INT_SET(x) (((x) << MITSUMI_INT_STATUS_REG_MODE_SWITCH_INT_LSB) & MITSUMI_INT_STATUS_REG_MODE_SWITCH_INT_MASK) - -#define CURRENT_WORKING_MODE_ADDRESS 0x0000031c -#define CURRENT_WORKING_MODE_OFFSET 0x0000031c -#define CURRENT_WORKING_MODE_MIT_FORCE_ACTIVE_ON_MSB 5 -#define CURRENT_WORKING_MODE_MIT_FORCE_ACTIVE_ON_LSB 5 -#define CURRENT_WORKING_MODE_MIT_FORCE_ACTIVE_ON_MASK 0x00000020 -#define CURRENT_WORKING_MODE_MIT_FORCE_ACTIVE_ON_GET(x) (((x) & CURRENT_WORKING_MODE_MIT_FORCE_ACTIVE_ON_MASK) >> CURRENT_WORKING_MODE_MIT_FORCE_ACTIVE_ON_LSB) -#define CURRENT_WORKING_MODE_MIT_FORCE_ACTIVE_ON_SET(x) (((x) << CURRENT_WORKING_MODE_MIT_FORCE_ACTIVE_ON_LSB) & CURRENT_WORKING_MODE_MIT_FORCE_ACTIVE_ON_MASK) -#define CURRENT_WORKING_MODE_MIT_REG_WR_TRIGGER_EN_MSB 2 -#define CURRENT_WORKING_MODE_MIT_REG_WR_TRIGGER_EN_LSB 2 -#define CURRENT_WORKING_MODE_MIT_REG_WR_TRIGGER_EN_MASK 0x00000004 -#define CURRENT_WORKING_MODE_MIT_REG_WR_TRIGGER_EN_GET(x) (((x) & CURRENT_WORKING_MODE_MIT_REG_WR_TRIGGER_EN_MASK) >> CURRENT_WORKING_MODE_MIT_REG_WR_TRIGGER_EN_LSB) -#define CURRENT_WORKING_MODE_MIT_REG_WR_TRIGGER_EN_SET(x) (((x) << CURRENT_WORKING_MODE_MIT_REG_WR_TRIGGER_EN_LSB) & CURRENT_WORKING_MODE_MIT_REG_WR_TRIGGER_EN_MASK) -#define CURRENT_WORKING_MODE_NOT_FIRST_MIT_MODE_MSB 1 -#define CURRENT_WORKING_MODE_NOT_FIRST_MIT_MODE_LSB 1 -#define CURRENT_WORKING_MODE_NOT_FIRST_MIT_MODE_MASK 0x00000002 -#define CURRENT_WORKING_MODE_NOT_FIRST_MIT_MODE_GET(x) (((x) & CURRENT_WORKING_MODE_NOT_FIRST_MIT_MODE_MASK) >> CURRENT_WORKING_MODE_NOT_FIRST_MIT_MODE_LSB) -#define CURRENT_WORKING_MODE_NOT_FIRST_MIT_MODE_SET(x) (((x) << CURRENT_WORKING_MODE_NOT_FIRST_MIT_MODE_LSB) & CURRENT_WORKING_MODE_NOT_FIRST_MIT_MODE_MASK) -#define CURRENT_WORKING_MODE_VALUE_MSB 0 -#define CURRENT_WORKING_MODE_VALUE_LSB 0 -#define CURRENT_WORKING_MODE_VALUE_MASK 0x00000001 -#define CURRENT_WORKING_MODE_VALUE_GET(x) (((x) & CURRENT_WORKING_MODE_VALUE_MASK) >> CURRENT_WORKING_MODE_VALUE_LSB) -#define CURRENT_WORKING_MODE_VALUE_SET(x) (((x) << CURRENT_WORKING_MODE_VALUE_LSB) & CURRENT_WORKING_MODE_VALUE_MASK) - -#define RTC_SLEEP_COUNT_ADDRESS 0x00000320 -#define RTC_SLEEP_COUNT_OFFSET 0x00000320 -#define RTC_SLEEP_COUNT_THRESHOLD_MSB 5 -#define RTC_SLEEP_COUNT_THRESHOLD_LSB 0 -#define RTC_SLEEP_COUNT_THRESHOLD_MASK 0x0000003f -#define RTC_SLEEP_COUNT_THRESHOLD_GET(x) (((x) & RTC_SLEEP_COUNT_THRESHOLD_MASK) >> RTC_SLEEP_COUNT_THRESHOLD_LSB) -#define RTC_SLEEP_COUNT_THRESHOLD_SET(x) (((x) << RTC_SLEEP_COUNT_THRESHOLD_LSB) & RTC_SLEEP_COUNT_THRESHOLD_MASK) - -#define MIT2_VAP_ADDRESS 0x00000324 -#define MIT2_VAP_OFFSET 0x00000324 -#define MIT2_VAP_MODE_MSB 0 -#define MIT2_VAP_MODE_LSB 0 -#define MIT2_VAP_MODE_MASK 0x00000001 -#define MIT2_VAP_MODE_GET(x) (((x) & MIT2_VAP_MODE_MASK) >> MIT2_VAP_MODE_LSB) -#define MIT2_VAP_MODE_SET(x) (((x) << MIT2_VAP_MODE_LSB) & MIT2_VAP_MODE_MASK) - -#define SECOND_HOST_INFT_ADDRESS 0x00000328 -#define SECOND_HOST_INFT_OFFSET 0x00000328 -#define SECOND_HOST_INFT_SDIO_MODE_MSB 0 -#define SECOND_HOST_INFT_SDIO_MODE_LSB 0 -#define SECOND_HOST_INFT_SDIO_MODE_MASK 0x00000001 -#define SECOND_HOST_INFT_SDIO_MODE_GET(x) (((x) & SECOND_HOST_INFT_SDIO_MODE_MASK) >> SECOND_HOST_INFT_SDIO_MODE_LSB) -#define SECOND_HOST_INFT_SDIO_MODE_SET(x) (((x) << SECOND_HOST_INFT_SDIO_MODE_LSB) & SECOND_HOST_INFT_SDIO_MODE_MASK) - -#define SDIO_HOST_ADDRESS 0x0000032c -#define SDIO_HOST_OFFSET 0x0000032c -#define SDIO_HOST_RESET_MSB 0 -#define SDIO_HOST_RESET_LSB 0 -#define SDIO_HOST_RESET_MASK 0x00000001 -#define SDIO_HOST_RESET_GET(x) (((x) & SDIO_HOST_RESET_MASK) >> SDIO_HOST_RESET_LSB) -#define SDIO_HOST_RESET_SET(x) (((x) << SDIO_HOST_RESET_LSB) & SDIO_HOST_RESET_MASK) - -#define ENTERPRISE_CONFIG_ADDRESS 0x00000330 -#define ENTERPRISE_CONFIG_OFFSET 0x00000330 -#define ENTERPRISE_CONFIG_TPC_LOWER_PERFORMANCE_MSB 12 -#define ENTERPRISE_CONFIG_TPC_LOWER_PERFORMANCE_LSB 12 -#define ENTERPRISE_CONFIG_TPC_LOWER_PERFORMANCE_MASK 0x00001000 -#define ENTERPRISE_CONFIG_TPC_LOWER_PERFORMANCE_GET(x) (((x) & ENTERPRISE_CONFIG_TPC_LOWER_PERFORMANCE_MASK) >> ENTERPRISE_CONFIG_TPC_LOWER_PERFORMANCE_LSB) -#define ENTERPRISE_CONFIG_TPC_LOWER_PERFORMANCE_SET(x) (((x) << ENTERPRISE_CONFIG_TPC_LOWER_PERFORMANCE_LSB) & ENTERPRISE_CONFIG_TPC_LOWER_PERFORMANCE_MASK) -#define ENTERPRISE_CONFIG_SWCOM_IDLE_MODE_MSB 11 -#define ENTERPRISE_CONFIG_SWCOM_IDLE_MODE_LSB 11 -#define ENTERPRISE_CONFIG_SWCOM_IDLE_MODE_MASK 0x00000800 -#define ENTERPRISE_CONFIG_SWCOM_IDLE_MODE_GET(x) (((x) & ENTERPRISE_CONFIG_SWCOM_IDLE_MODE_MASK) >> ENTERPRISE_CONFIG_SWCOM_IDLE_MODE_LSB) -#define ENTERPRISE_CONFIG_SWCOM_IDLE_MODE_SET(x) (((x) << ENTERPRISE_CONFIG_SWCOM_IDLE_MODE_LSB) & ENTERPRISE_CONFIG_SWCOM_IDLE_MODE_MASK) -#define ENTERPRISE_CONFIG_STBC_DISABLE_MSB 10 -#define ENTERPRISE_CONFIG_STBC_DISABLE_LSB 10 -#define ENTERPRISE_CONFIG_STBC_DISABLE_MASK 0x00000400 -#define ENTERPRISE_CONFIG_STBC_DISABLE_GET(x) (((x) & ENTERPRISE_CONFIG_STBC_DISABLE_MASK) >> ENTERPRISE_CONFIG_STBC_DISABLE_LSB) -#define ENTERPRISE_CONFIG_STBC_DISABLE_SET(x) (((x) << ENTERPRISE_CONFIG_STBC_DISABLE_LSB) & ENTERPRISE_CONFIG_STBC_DISABLE_MASK) -#define ENTERPRISE_CONFIG_LDPC_DISABLE_MSB 9 -#define ENTERPRISE_CONFIG_LDPC_DISABLE_LSB 9 -#define ENTERPRISE_CONFIG_LDPC_DISABLE_MASK 0x00000200 -#define ENTERPRISE_CONFIG_LDPC_DISABLE_GET(x) (((x) & ENTERPRISE_CONFIG_LDPC_DISABLE_MASK) >> ENTERPRISE_CONFIG_LDPC_DISABLE_LSB) -#define ENTERPRISE_CONFIG_LDPC_DISABLE_SET(x) (((x) << ENTERPRISE_CONFIG_LDPC_DISABLE_LSB) & ENTERPRISE_CONFIG_LDPC_DISABLE_MASK) -#define ENTERPRISE_CONFIG_GREEN_TX_DISABLE_MSB 8 -#define ENTERPRISE_CONFIG_GREEN_TX_DISABLE_LSB 8 -#define ENTERPRISE_CONFIG_GREEN_TX_DISABLE_MASK 0x00000100 -#define ENTERPRISE_CONFIG_GREEN_TX_DISABLE_GET(x) (((x) & ENTERPRISE_CONFIG_GREEN_TX_DISABLE_MASK) >> ENTERPRISE_CONFIG_GREEN_TX_DISABLE_LSB) -#define ENTERPRISE_CONFIG_GREEN_TX_DISABLE_SET(x) (((x) << ENTERPRISE_CONFIG_GREEN_TX_DISABLE_LSB) & ENTERPRISE_CONFIG_GREEN_TX_DISABLE_MASK) -#define ENTERPRISE_CONFIG_DUAL_BAND_DISABLE_MSB 7 -#define ENTERPRISE_CONFIG_DUAL_BAND_DISABLE_LSB 7 -#define ENTERPRISE_CONFIG_DUAL_BAND_DISABLE_MASK 0x00000080 -#define ENTERPRISE_CONFIG_DUAL_BAND_DISABLE_GET(x) (((x) & ENTERPRISE_CONFIG_DUAL_BAND_DISABLE_MASK) >> ENTERPRISE_CONFIG_DUAL_BAND_DISABLE_LSB) -#define ENTERPRISE_CONFIG_DUAL_BAND_DISABLE_SET(x) (((x) << ENTERPRISE_CONFIG_DUAL_BAND_DISABLE_LSB) & ENTERPRISE_CONFIG_DUAL_BAND_DISABLE_MASK) -#define ENTERPRISE_CONFIG_CHAIN1_DISABLE_MSB 6 -#define ENTERPRISE_CONFIG_CHAIN1_DISABLE_LSB 6 -#define ENTERPRISE_CONFIG_CHAIN1_DISABLE_MASK 0x00000040 -#define ENTERPRISE_CONFIG_CHAIN1_DISABLE_GET(x) (((x) & ENTERPRISE_CONFIG_CHAIN1_DISABLE_MASK) >> ENTERPRISE_CONFIG_CHAIN1_DISABLE_LSB) -#define ENTERPRISE_CONFIG_CHAIN1_DISABLE_SET(x) (((x) << ENTERPRISE_CONFIG_CHAIN1_DISABLE_LSB) & ENTERPRISE_CONFIG_CHAIN1_DISABLE_MASK) -#define ENTERPRISE_CONFIG_CH_5MHZ_DISABLE_MSB 5 -#define ENTERPRISE_CONFIG_CH_5MHZ_DISABLE_LSB 5 -#define ENTERPRISE_CONFIG_CH_5MHZ_DISABLE_MASK 0x00000020 -#define ENTERPRISE_CONFIG_CH_5MHZ_DISABLE_GET(x) (((x) & ENTERPRISE_CONFIG_CH_5MHZ_DISABLE_MASK) >> ENTERPRISE_CONFIG_CH_5MHZ_DISABLE_LSB) -#define ENTERPRISE_CONFIG_CH_5MHZ_DISABLE_SET(x) (((x) << ENTERPRISE_CONFIG_CH_5MHZ_DISABLE_LSB) & ENTERPRISE_CONFIG_CH_5MHZ_DISABLE_MASK) -#define ENTERPRISE_CONFIG_CH_10MHZ_DISABLE_MSB 4 -#define ENTERPRISE_CONFIG_CH_10MHZ_DISABLE_LSB 4 -#define ENTERPRISE_CONFIG_CH_10MHZ_DISABLE_MASK 0x00000010 -#define ENTERPRISE_CONFIG_CH_10MHZ_DISABLE_GET(x) (((x) & ENTERPRISE_CONFIG_CH_10MHZ_DISABLE_MASK) >> ENTERPRISE_CONFIG_CH_10MHZ_DISABLE_LSB) -#define ENTERPRISE_CONFIG_CH_10MHZ_DISABLE_SET(x) (((x) << ENTERPRISE_CONFIG_CH_10MHZ_DISABLE_LSB) & ENTERPRISE_CONFIG_CH_10MHZ_DISABLE_MASK) -#define ENTERPRISE_CONFIG_TXBF_DISABLE_MSB 3 -#define ENTERPRISE_CONFIG_TXBF_DISABLE_LSB 3 -#define ENTERPRISE_CONFIG_TXBF_DISABLE_MASK 0x00000008 -#define ENTERPRISE_CONFIG_TXBF_DISABLE_GET(x) (((x) & ENTERPRISE_CONFIG_TXBF_DISABLE_MASK) >> ENTERPRISE_CONFIG_TXBF_DISABLE_LSB) -#define ENTERPRISE_CONFIG_TXBF_DISABLE_SET(x) (((x) << ENTERPRISE_CONFIG_TXBF_DISABLE_LSB) & ENTERPRISE_CONFIG_TXBF_DISABLE_MASK) -#define ENTERPRISE_CONFIG_MIN_PKT_SIZE_DISABLE_MSB 2 -#define ENTERPRISE_CONFIG_MIN_PKT_SIZE_DISABLE_LSB 2 -#define ENTERPRISE_CONFIG_MIN_PKT_SIZE_DISABLE_MASK 0x00000004 -#define ENTERPRISE_CONFIG_MIN_PKT_SIZE_DISABLE_GET(x) (((x) & ENTERPRISE_CONFIG_MIN_PKT_SIZE_DISABLE_MASK) >> ENTERPRISE_CONFIG_MIN_PKT_SIZE_DISABLE_LSB) -#define ENTERPRISE_CONFIG_MIN_PKT_SIZE_DISABLE_SET(x) (((x) << ENTERPRISE_CONFIG_MIN_PKT_SIZE_DISABLE_LSB) & ENTERPRISE_CONFIG_MIN_PKT_SIZE_DISABLE_MASK) -#define ENTERPRISE_CONFIG_LOOPBACK_DISABLE_MSB 1 -#define ENTERPRISE_CONFIG_LOOPBACK_DISABLE_LSB 1 -#define ENTERPRISE_CONFIG_LOOPBACK_DISABLE_MASK 0x00000002 -#define ENTERPRISE_CONFIG_LOOPBACK_DISABLE_GET(x) (((x) & ENTERPRISE_CONFIG_LOOPBACK_DISABLE_MASK) >> ENTERPRISE_CONFIG_LOOPBACK_DISABLE_LSB) -#define ENTERPRISE_CONFIG_LOOPBACK_DISABLE_SET(x) (((x) << ENTERPRISE_CONFIG_LOOPBACK_DISABLE_LSB) & ENTERPRISE_CONFIG_LOOPBACK_DISABLE_MASK) -#define ENTERPRISE_CONFIG_LOCATION_DISABLE_MSB 0 -#define ENTERPRISE_CONFIG_LOCATION_DISABLE_LSB 0 -#define ENTERPRISE_CONFIG_LOCATION_DISABLE_MASK 0x00000001 -#define ENTERPRISE_CONFIG_LOCATION_DISABLE_GET(x) (((x) & ENTERPRISE_CONFIG_LOCATION_DISABLE_MASK) >> ENTERPRISE_CONFIG_LOCATION_DISABLE_LSB) -#define ENTERPRISE_CONFIG_LOCATION_DISABLE_SET(x) (((x) << ENTERPRISE_CONFIG_LOCATION_DISABLE_LSB) & ENTERPRISE_CONFIG_LOCATION_DISABLE_MASK) - -#define RTC_DEBUG_BUS_ADDRESS 0x00000334 -#define RTC_DEBUG_BUS_OFFSET 0x00000334 -#define RTC_DEBUG_BUS_SEL_MSB 0 -#define RTC_DEBUG_BUS_SEL_LSB 0 -#define RTC_DEBUG_BUS_SEL_MASK 0x00000001 -#define RTC_DEBUG_BUS_SEL_GET(x) (((x) & RTC_DEBUG_BUS_SEL_MASK) >> RTC_DEBUG_BUS_SEL_LSB) -#define RTC_DEBUG_BUS_SEL_SET(x) (((x) << RTC_DEBUG_BUS_SEL_LSB) & RTC_DEBUG_BUS_SEL_MASK) - -#define RTC_EXT_CLK_BUF_ADDRESS 0x00000338 -#define RTC_EXT_CLK_BUF_OFFSET 0x00000338 -#define RTC_EXT_CLK_BUF_EN_MSB 0 -#define RTC_EXT_CLK_BUF_EN_LSB 0 -#define RTC_EXT_CLK_BUF_EN_MASK 0x00000001 -#define RTC_EXT_CLK_BUF_EN_GET(x) (((x) & RTC_EXT_CLK_BUF_EN_MASK) >> RTC_EXT_CLK_BUF_EN_LSB) -#define RTC_EXT_CLK_BUF_EN_SET(x) (((x) << RTC_EXT_CLK_BUF_EN_LSB) & RTC_EXT_CLK_BUF_EN_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct rtc_soc_reg_reg_s { - volatile unsigned int soc_reset_control; - volatile unsigned int soc_tcxo_detect; - volatile unsigned int soc_xtal_test; - unsigned char pad0[20]; /* pad to 0x20 */ - volatile unsigned int soc_cpu_clock; - unsigned char pad1[4]; /* pad to 0x28 */ - volatile unsigned int soc_clock_control; - unsigned char pad2[4]; /* pad to 0x30 */ - volatile unsigned int soc_wdt_control; - volatile unsigned int soc_wdt_status; - volatile unsigned int soc_wdt; - volatile unsigned int soc_wdt_count; - volatile unsigned int soc_wdt_reset; - volatile unsigned int soc_int_status; - volatile unsigned int soc_lf_timer0; - volatile unsigned int soc_lf_timer_count0; - volatile unsigned int soc_lf_timer_control0; - volatile unsigned int soc_lf_timer_status0; - volatile unsigned int soc_lf_timer1; - volatile unsigned int soc_lf_timer_count1; - volatile unsigned int soc_lf_timer_control1; - volatile unsigned int soc_lf_timer_status1; - volatile unsigned int soc_lf_timer2; - volatile unsigned int soc_lf_timer_count2; - volatile unsigned int soc_lf_timer_control2; - volatile unsigned int soc_lf_timer_status2; - volatile unsigned int soc_lf_timer3; - volatile unsigned int soc_lf_timer_count3; - volatile unsigned int soc_lf_timer_control3; - volatile unsigned int soc_lf_timer_status3; - volatile unsigned int soc_hf_timer; - volatile unsigned int soc_hf_timer_count; - volatile unsigned int soc_hf_lf_count; - volatile unsigned int soc_hf_timer_control; - volatile unsigned int soc_hf_timer_status; - volatile unsigned int soc_rtc_control; - volatile unsigned int soc_rtc_time; - volatile unsigned int soc_rtc_date; - volatile unsigned int soc_rtc_set_time; - volatile unsigned int soc_rtc_set_date; - volatile unsigned int soc_rtc_set_alarm; - volatile unsigned int soc_rtc_config; - volatile unsigned int soc_rtc_alarm_status; - volatile unsigned int soc_uart_wakeup; - volatile unsigned int soc_reset_cause; - volatile unsigned int soc_system_sleep; - volatile unsigned int soc_sdio_wrapper; - volatile unsigned int soc_int_status1; - unsigned char pad3[4]; /* pad to 0xd4 */ - volatile unsigned int soc_lpo_cal_time; - volatile unsigned int soc_lpo_init_dividend_int; - volatile unsigned int soc_lpo_init_dividend_fraction; - volatile unsigned int soc_lpo_cal; - volatile unsigned int soc_lpo_cal_test_control; - volatile unsigned int soc_lpo_cal_test_status; - volatile unsigned int legacy_soc_chip_id; - volatile unsigned int soc_chip_id; - unsigned char pad4[24]; /* pad to 0x10c */ - volatile unsigned int soc_power_reg; - volatile unsigned int soc_core_clk_ctrl; - volatile unsigned int soc_gpio_wakeup_control; - unsigned char pad5[252]; /* pad to 0x214 */ - volatile unsigned int sleep_retention; - unsigned char pad6[108]; /* pad to 0x284 */ - volatile unsigned int lp_perf_counter; - volatile unsigned int lp_perf_light_sleep; - volatile unsigned int lp_perf_deep_sleep; - volatile unsigned int lp_perf_on; - unsigned char pad7[20]; /* pad to 0x2a8 */ - volatile unsigned int chip_mode; - volatile unsigned int clk_req_fall_edge; - volatile unsigned int otp; - volatile unsigned int otp_status; - volatile unsigned int pmu; - volatile unsigned int pmu_config; - volatile unsigned int pmu_pareg; - volatile unsigned int pmu_bypass; - unsigned char pad8[20]; /* pad to 0x2dc */ - volatile unsigned int therm_ctrl1; - volatile unsigned int therm_ctrl2; - volatile unsigned int therm_ctrl3; - volatile unsigned int listen_mode1; - volatile unsigned int listen_mode2; - volatile unsigned int audio_pll_config; - volatile unsigned int audio_pll_modulation; - volatile unsigned int audio_pll_mod_step; - volatile unsigned int current_audio_pll_modulation; - volatile unsigned int eth_pll_config; - volatile unsigned int cpu_pll_config; - volatile unsigned int bb_pll_config; - volatile unsigned int eth_xmii; - volatile unsigned int usb_phy_config; - volatile unsigned int mitsumi_int_control_reg; - volatile unsigned int mitsumi_int_status_reg; - volatile unsigned int current_working_mode; - volatile unsigned int rtc_sleep_count; - volatile unsigned int mit2_vap; - volatile unsigned int second_host_inft; - volatile unsigned int sdio_host; - volatile unsigned int enterprise_config; - volatile unsigned int rtc_debug_bus; - volatile unsigned int rtc_ext_clk_buf; -} rtc_soc_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _RTC_SOC_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_sync_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_sync_reg.h deleted file mode 100644 index 0ab3ea33d327..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_sync_reg.h +++ /dev/null @@ -1,221 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _RTC_SYNC_REG_REG_H_ -#define _RTC_SYNC_REG_REG_H_ - - -/* macros for RTC_SYNC_RESET */ -#define RTC_SYNC_RESET_ADDRESS 0x00000240 -#define RTC_SYNC_RESET_OFFSET 0x00000240 -#define RTC_SYNC_RESET_RESET_L_MSB 0 -#define RTC_SYNC_RESET_RESET_L_LSB 0 -#define RTC_SYNC_RESET_RESET_L_MASK 0x00000001 -#define RTC_SYNC_RESET_RESET_L_GET(x) (((x) & 0x00000001) >> 0) -#define RTC_SYNC_RESET_RESET_L_SET(x) (((x) << 0) & 0x00000001) - -/* macros for RTC_SYNC_STATUS */ -#define RTC_SYNC_STATUS_ADDRESS 0x00000244 -#define RTC_SYNC_STATUS_OFFSET 0x00000244 -#define RTC_SYNC_STATUS_SHUTDOWN_STATE_MSB 0 -#define RTC_SYNC_STATUS_SHUTDOWN_STATE_LSB 0 -#define RTC_SYNC_STATUS_SHUTDOWN_STATE_MASK 0x00000001 -#define RTC_SYNC_STATUS_SHUTDOWN_STATE_GET(x) (((x) & 0x00000001) >> 0) -#define RTC_SYNC_STATUS_ON_STATE_MSB 1 -#define RTC_SYNC_STATUS_ON_STATE_LSB 1 -#define RTC_SYNC_STATUS_ON_STATE_MASK 0x00000002 -#define RTC_SYNC_STATUS_ON_STATE_GET(x) (((x) & 0x00000002) >> 1) -#define RTC_SYNC_STATUS_SLEEP_STATE_MSB 2 -#define RTC_SYNC_STATUS_SLEEP_STATE_LSB 2 -#define RTC_SYNC_STATUS_SLEEP_STATE_MASK 0x00000004 -#define RTC_SYNC_STATUS_SLEEP_STATE_GET(x) (((x) & 0x00000004) >> 2) -#define RTC_SYNC_STATUS_WAKEUP_STATE_MSB 3 -#define RTC_SYNC_STATUS_WAKEUP_STATE_LSB 3 -#define RTC_SYNC_STATUS_WAKEUP_STATE_MASK 0x00000008 -#define RTC_SYNC_STATUS_WAKEUP_STATE_GET(x) (((x) & 0x00000008) >> 3) -#define RTC_SYNC_STATUS_WRESET_MSB 4 -#define RTC_SYNC_STATUS_WRESET_LSB 4 -#define RTC_SYNC_STATUS_WRESET_MASK 0x00000010 -#define RTC_SYNC_STATUS_WRESET_GET(x) (((x) & 0x00000010) >> 4) -#define RTC_SYNC_STATUS_PLL_CHANGING_MSB 5 -#define RTC_SYNC_STATUS_PLL_CHANGING_LSB 5 -#define RTC_SYNC_STATUS_PLL_CHANGING_MASK 0x00000020 -#define RTC_SYNC_STATUS_PLL_CHANGING_GET(x) (((x) & 0x00000020) >> 5) - -/* macros for RTC_SYNC_DERIVED */ -#define RTC_SYNC_DERIVED_ADDRESS 0x00000248 -#define RTC_SYNC_DERIVED_OFFSET 0x00000248 -#define RTC_SYNC_DERIVED_BYPASS_MSB 0 -#define RTC_SYNC_DERIVED_BYPASS_LSB 0 -#define RTC_SYNC_DERIVED_BYPASS_MASK 0x00000001 -#define RTC_SYNC_DERIVED_BYPASS_GET(x) (((x) & 0x00000001) >> 0) -#define RTC_SYNC_DERIVED_BYPASS_SET(x) (((x) << 0) & 0x00000001) -#define RTC_SYNC_DERIVED_FORCE_MSB 1 -#define RTC_SYNC_DERIVED_FORCE_LSB 1 -#define RTC_SYNC_DERIVED_FORCE_MASK 0x00000002 -#define RTC_SYNC_DERIVED_FORCE_GET(x) (((x) & 0x00000002) >> 1) -#define RTC_SYNC_DERIVED_FORCE_SET(x) (((x) << 1) & 0x00000002) -#define RTC_SYNC_DERIVED_FORCE_SWREG_PWD_MSB 2 -#define RTC_SYNC_DERIVED_FORCE_SWREG_PWD_LSB 2 -#define RTC_SYNC_DERIVED_FORCE_SWREG_PWD_MASK 0x00000004 -#define RTC_SYNC_DERIVED_FORCE_SWREG_PWD_SET(x) (((x) << 2) & 0x00000004) -#define RTC_SYNC_DERIVED_FORCE_LPO_PWD_MSB 3 -#define RTC_SYNC_DERIVED_FORCE_LPO_PWD_LSB 3 -#define RTC_SYNC_DERIVED_FORCE_LPO_PWD_MASK 0x00000008 -#define RTC_SYNC_DERIVED_FORCE_LPO_PWD_SET(x) (((x) << 3) & 0x00000008) - -/* macros for RTC_SYNC_FORCE_WAKE */ -#define RTC_SYNC_FORCE_WAKE_ADDRESS 0x0000024c -#define RTC_SYNC_FORCE_WAKE_OFFSET 0x0000024c -#define RTC_SYNC_FORCE_WAKE_ENABLE_MSB 0 -#define RTC_SYNC_FORCE_WAKE_ENABLE_LSB 0 -#define RTC_SYNC_FORCE_WAKE_ENABLE_MASK 0x00000001 -#define RTC_SYNC_FORCE_WAKE_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define RTC_SYNC_FORCE_WAKE_INTR_MSB 1 -#define RTC_SYNC_FORCE_WAKE_INTR_LSB 1 -#define RTC_SYNC_FORCE_WAKE_INTR_MASK 0x00000002 -#define RTC_SYNC_FORCE_WAKE_INTR_GET(x) (((x) & 0x00000002) >> 1) -#define RTC_SYNC_FORCE_WAKE_INTR_SET(x) (((x) << 1) & 0x00000002) - -/* macros for RTC_SYNC_INTR_CAUSE */ -#define RTC_SYNC_INTR_CAUSE_ADDRESS 0x00000250 -#define RTC_SYNC_INTR_CAUSE_OFFSET 0x00000250 -#define RTC_SYNC_INTR_CAUSE_SHUTDOWN_STATE_MSB 0 -#define RTC_SYNC_INTR_CAUSE_SHUTDOWN_STATE_LSB 0 -#define RTC_SYNC_INTR_CAUSE_SHUTDOWN_STATE_MASK 0x00000001 -#define RTC_SYNC_INTR_CAUSE_SHUTDOWN_STATE_GET(x) (((x) & 0x00000001) >> 0) -#define RTC_SYNC_INTR_CAUSE_SHUTDOWN_STATE_SET(x) (((x) << 0) & 0x00000001) -#define RTC_SYNC_INTR_CAUSE_ON_STATE_MSB 1 -#define RTC_SYNC_INTR_CAUSE_ON_STATE_LSB 1 -#define RTC_SYNC_INTR_CAUSE_ON_STATE_MASK 0x00000002 -#define RTC_SYNC_INTR_CAUSE_ON_STATE_GET(x) (((x) & 0x00000002) >> 1) -#define RTC_SYNC_INTR_CAUSE_ON_STATE_SET(x) (((x) << 1) & 0x00000002) -#define RTC_SYNC_INTR_CAUSE_SLEEP_STATE_MSB 2 -#define RTC_SYNC_INTR_CAUSE_SLEEP_STATE_LSB 2 -#define RTC_SYNC_INTR_CAUSE_SLEEP_STATE_MASK 0x00000004 -#define RTC_SYNC_INTR_CAUSE_SLEEP_STATE_GET(x) (((x) & 0x00000004) >> 2) -#define RTC_SYNC_INTR_CAUSE_SLEEP_STATE_SET(x) (((x) << 2) & 0x00000004) -#define RTC_SYNC_INTR_CAUSE_WAKEUP_STATE_MSB 3 -#define RTC_SYNC_INTR_CAUSE_WAKEUP_STATE_LSB 3 -#define RTC_SYNC_INTR_CAUSE_WAKEUP_STATE_MASK 0x00000008 -#define RTC_SYNC_INTR_CAUSE_WAKEUP_STATE_GET(x) (((x) & 0x00000008) >> 3) -#define RTC_SYNC_INTR_CAUSE_WAKEUP_STATE_SET(x) (((x) << 3) & 0x00000008) -#define RTC_SYNC_INTR_CAUSE_SLEEP_ACCESS_MSB 4 -#define RTC_SYNC_INTR_CAUSE_SLEEP_ACCESS_LSB 4 -#define RTC_SYNC_INTR_CAUSE_SLEEP_ACCESS_MASK 0x00000010 -#define RTC_SYNC_INTR_CAUSE_SLEEP_ACCESS_GET(x) (((x) & 0x00000010) >> 4) -#define RTC_SYNC_INTR_CAUSE_SLEEP_ACCESS_SET(x) (((x) << 4) & 0x00000010) -#define RTC_SYNC_INTR_CAUSE_PLL_CHANGING_MSB 5 -#define RTC_SYNC_INTR_CAUSE_PLL_CHANGING_LSB 5 -#define RTC_SYNC_INTR_CAUSE_PLL_CHANGING_MASK 0x00000020 -#define RTC_SYNC_INTR_CAUSE_PLL_CHANGING_GET(x) (((x) & 0x00000020) >> 5) -#define RTC_SYNC_INTR_CAUSE_PLL_CHANGING_SET(x) (((x) << 5) & 0x00000020) - -/* macros for RTC_SYNC_INTR_ENABLE */ -#define RTC_SYNC_INTR_ENABLE_ADDRESS 0x00000254 -#define RTC_SYNC_INTR_ENABLE_OFFSET 0x00000254 -#define RTC_SYNC_INTR_ENABLE_SHUTDOWN_STATE_MSB 0 -#define RTC_SYNC_INTR_ENABLE_SHUTDOWN_STATE_LSB 0 -#define RTC_SYNC_INTR_ENABLE_SHUTDOWN_STATE_MASK 0x00000001 -#define RTC_SYNC_INTR_ENABLE_SHUTDOWN_STATE_GET(x) (((x) & 0x00000001) >> 0) -#define RTC_SYNC_INTR_ENABLE_SHUTDOWN_STATE_SET(x) (((x) << 0) & 0x00000001) -#define RTC_SYNC_INTR_ENABLE_ON_STATE_MSB 1 -#define RTC_SYNC_INTR_ENABLE_ON_STATE_LSB 1 -#define RTC_SYNC_INTR_ENABLE_ON_STATE_MASK 0x00000002 -#define RTC_SYNC_INTR_ENABLE_ON_STATE_GET(x) (((x) & 0x00000002) >> 1) -#define RTC_SYNC_INTR_ENABLE_ON_STATE_SET(x) (((x) << 1) & 0x00000002) -#define RTC_SYNC_INTR_ENABLE_SLEEP_STATE_MSB 2 -#define RTC_SYNC_INTR_ENABLE_SLEEP_STATE_LSB 2 -#define RTC_SYNC_INTR_ENABLE_SLEEP_STATE_MASK 0x00000004 -#define RTC_SYNC_INTR_ENABLE_SLEEP_STATE_GET(x) (((x) & 0x00000004) >> 2) -#define RTC_SYNC_INTR_ENABLE_SLEEP_STATE_SET(x) (((x) << 2) & 0x00000004) -#define RTC_SYNC_INTR_ENABLE_WAKEUP_STATE_MSB 3 -#define RTC_SYNC_INTR_ENABLE_WAKEUP_STATE_LSB 3 -#define RTC_SYNC_INTR_ENABLE_WAKEUP_STATE_MASK 0x00000008 -#define RTC_SYNC_INTR_ENABLE_WAKEUP_STATE_GET(x) (((x) & 0x00000008) >> 3) -#define RTC_SYNC_INTR_ENABLE_WAKEUP_STATE_SET(x) (((x) << 3) & 0x00000008) -#define RTC_SYNC_INTR_ENABLE_SLEEP_ACCESS_MSB 4 -#define RTC_SYNC_INTR_ENABLE_SLEEP_ACCESS_LSB 4 -#define RTC_SYNC_INTR_ENABLE_SLEEP_ACCESS_MASK 0x00000010 -#define RTC_SYNC_INTR_ENABLE_SLEEP_ACCESS_GET(x) (((x) & 0x00000010) >> 4) -#define RTC_SYNC_INTR_ENABLE_SLEEP_ACCESS_SET(x) (((x) << 4) & 0x00000010) -#define RTC_SYNC_INTR_ENABLE_PLL_CHANGING_MSB 5 -#define RTC_SYNC_INTR_ENABLE_PLL_CHANGING_LSB 5 -#define RTC_SYNC_INTR_ENABLE_PLL_CHANGING_MASK 0x00000020 -#define RTC_SYNC_INTR_ENABLE_PLL_CHANGING_GET(x) (((x) & 0x00000020) >> 5) -#define RTC_SYNC_INTR_ENABLE_PLL_CHANGING_SET(x) (((x) << 5) & 0x00000020) - -/* macros for RTC_SYNC_INTR_MASK */ -#define RTC_SYNC_INTR_MASK_ADDRESS 0x00000258 -#define RTC_SYNC_INTR_MASK_OFFSET 0x00000258 -#define RTC_SYNC_INTR_MASK_SHUTDOWN_STATE_MSB 0 -#define RTC_SYNC_INTR_MASK_SHUTDOWN_STATE_LSB 0 -#define RTC_SYNC_INTR_MASK_SHUTDOWN_STATE_MASK 0x00000001 -#define RTC_SYNC_INTR_MASK_SHUTDOWN_STATE_GET(x) (((x) & 0x00000001) >> 0) -#define RTC_SYNC_INTR_MASK_SHUTDOWN_STATE_SET(x) (((x) << 0) & 0x00000001) -#define RTC_SYNC_INTR_MASK_ON_STATE_MSB 1 -#define RTC_SYNC_INTR_MASK_ON_STATE_LSB 1 -#define RTC_SYNC_INTR_MASK_ON_STATE_MASK 0x00000002 -#define RTC_SYNC_INTR_MASK_ON_STATE_GET(x) (((x) & 0x00000002) >> 1) -#define RTC_SYNC_INTR_MASK_ON_STATE_SET(x) (((x) << 1) & 0x00000002) -#define RTC_SYNC_INTR_MASK_SLEEP_STATE_MSB 2 -#define RTC_SYNC_INTR_MASK_SLEEP_STATE_LSB 2 -#define RTC_SYNC_INTR_MASK_SLEEP_STATE_MASK 0x00000004 -#define RTC_SYNC_INTR_MASK_SLEEP_STATE_GET(x) (((x) & 0x00000004) >> 2) -#define RTC_SYNC_INTR_MASK_SLEEP_STATE_SET(x) (((x) << 2) & 0x00000004) -#define RTC_SYNC_INTR_MASK_WAKEUP_STATE_MSB 3 -#define RTC_SYNC_INTR_MASK_WAKEUP_STATE_LSB 3 -#define RTC_SYNC_INTR_MASK_WAKEUP_STATE_MASK 0x00000008 -#define RTC_SYNC_INTR_MASK_WAKEUP_STATE_GET(x) (((x) & 0x00000008) >> 3) -#define RTC_SYNC_INTR_MASK_WAKEUP_STATE_SET(x) (((x) << 3) & 0x00000008) -#define RTC_SYNC_INTR_MASK_SLEEP_ACCESS_MSB 4 -#define RTC_SYNC_INTR_MASK_SLEEP_ACCESS_LSB 4 -#define RTC_SYNC_INTR_MASK_SLEEP_ACCESS_MASK 0x00000010 -#define RTC_SYNC_INTR_MASK_SLEEP_ACCESS_GET(x) (((x) & 0x00000010) >> 4) -#define RTC_SYNC_INTR_MASK_SLEEP_ACCESS_SET(x) (((x) << 4) & 0x00000010) -#define RTC_SYNC_INTR_MASK_PLL_CHANGING_MSB 5 -#define RTC_SYNC_INTR_MASK_PLL_CHANGING_LSB 5 -#define RTC_SYNC_INTR_MASK_PLL_CHANGING_MASK 0x00000020 -#define RTC_SYNC_INTR_MASK_PLL_CHANGING_GET(x) (((x) & 0x00000020) >> 5) -#define RTC_SYNC_INTR_MASK_PLL_CHANGING_SET(x) (((x) << 5) & 0x00000020) - - -#ifndef __ASSEMBLER__ - -typedef struct rtc_sync_reg_reg_s { - volatile char pad__0[0x240]; /* 0x0 - 0x240 */ - volatile unsigned int RTC_SYNC_RESET; /* 0x240 - 0x244 */ - volatile unsigned int RTC_SYNC_STATUS; /* 0x244 - 0x248 */ - volatile unsigned int RTC_SYNC_DERIVED; /* 0x248 - 0x24c */ - volatile unsigned int RTC_SYNC_FORCE_WAKE; /* 0x24c - 0x250 */ - volatile unsigned int RTC_SYNC_INTR_CAUSE; /* 0x250 - 0x254 */ - volatile unsigned int RTC_SYNC_INTR_ENABLE; /* 0x254 - 0x258 */ - volatile unsigned int RTC_SYNC_INTR_MASK; /* 0x258 - 0x25c */ -} rtc_sync_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _RTC_SYNC_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_wlan_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_wlan_reg.h deleted file mode 100644 index d4a7d4d71a1d..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/rtc_wlan_reg.h +++ /dev/null @@ -1,677 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _RTC_WLAN_REG_REG_H_ -#define _RTC_WLAN_REG_REG_H_ - - -/* macros for WLAN_RESET_CONTROL */ -#define WLAN_RESET_CONTROL_ADDRESS 0x00000000 -#define WLAN_RESET_CONTROL_OFFSET 0x00000000 -#define WLAN_RESET_CONTROL_MAC_WARM_RST_MSB 0 -#define WLAN_RESET_CONTROL_MAC_WARM_RST_LSB 0 -#define WLAN_RESET_CONTROL_MAC_WARM_RST_MASK 0x00000001 -#define WLAN_RESET_CONTROL_MAC_WARM_RST_GET(x) (((x) & 0x00000001) >> 0) -#define WLAN_RESET_CONTROL_MAC_WARM_RST_SET(x) (((x) << 0) & 0x00000001) -#define WLAN_RESET_CONTROL_MAC_COLD_RST_MSB 1 -#define WLAN_RESET_CONTROL_MAC_COLD_RST_LSB 1 -#define WLAN_RESET_CONTROL_MAC_COLD_RST_MASK 0x00000002 -#define WLAN_RESET_CONTROL_MAC_COLD_RST_GET(x) (((x) & 0x00000002) >> 1) -#define WLAN_RESET_CONTROL_MAC_COLD_RST_SET(x) (((x) << 1) & 0x00000002) -#define WLAN_RESET_CONTROL_WARM_RST_MSB 2 -#define WLAN_RESET_CONTROL_WARM_RST_LSB 2 -#define WLAN_RESET_CONTROL_WARM_RST_MASK 0x00000004 -#define WLAN_RESET_CONTROL_WARM_RST_GET(x) (((x) & 0x00000004) >> 2) -#define WLAN_RESET_CONTROL_WARM_RST_SET(x) (((x) << 2) & 0x00000004) -#define WLAN_RESET_CONTROL_COLD_RST_MSB 3 -#define WLAN_RESET_CONTROL_COLD_RST_LSB 3 -#define WLAN_RESET_CONTROL_COLD_RST_MASK 0x00000008 -#define WLAN_RESET_CONTROL_COLD_RST_GET(x) (((x) & 0x00000008) >> 3) -#define WLAN_RESET_CONTROL_COLD_RST_SET(x) (((x) << 3) & 0x00000008) -#define WLAN_RESET_CONTROL_BB_WARM_RST_MSB 4 -#define WLAN_RESET_CONTROL_BB_WARM_RST_LSB 4 -#define WLAN_RESET_CONTROL_BB_WARM_RST_MASK 0x00000010 -#define WLAN_RESET_CONTROL_BB_WARM_RST_GET(x) (((x) & 0x00000010) >> 4) -#define WLAN_RESET_CONTROL_BB_WARM_RST_SET(x) (((x) << 4) & 0x00000010) -#define WLAN_RESET_CONTROL_BB_COLD_RST_MSB 5 -#define WLAN_RESET_CONTROL_BB_COLD_RST_LSB 5 -#define WLAN_RESET_CONTROL_BB_COLD_RST_MASK 0x00000020 -#define WLAN_RESET_CONTROL_BB_COLD_RST_GET(x) (((x) & 0x00000020) >> 5) -#define WLAN_RESET_CONTROL_BB_COLD_RST_SET(x) (((x) << 5) & 0x00000020) -#define WLAN_RESET_CONTROL_RADIO_SRESET_MSB 6 -#define WLAN_RESET_CONTROL_RADIO_SRESET_LSB 6 -#define WLAN_RESET_CONTROL_RADIO_SRESET_MASK 0x00000040 -#define WLAN_RESET_CONTROL_RADIO_SRESET_GET(x) (((x) & 0x00000040) >> 6) -#define WLAN_RESET_CONTROL_RADIO_SRESET_SET(x) (((x) << 6) & 0x00000040) -#define WLAN_RESET_CONTROL_MCI_RESET_MSB 7 -#define WLAN_RESET_CONTROL_MCI_RESET_LSB 7 -#define WLAN_RESET_CONTROL_MCI_RESET_MASK 0x00000080 -#define WLAN_RESET_CONTROL_MCI_RESET_GET(x) (((x) & 0x00000080) >> 7) -#define WLAN_RESET_CONTROL_MCI_RESET_SET(x) (((x) << 7) & 0x00000080) - -/* macros for WLAN_XTAL_CONTROL */ -#define WLAN_XTAL_CONTROL_ADDRESS 0x00000004 -#define WLAN_XTAL_CONTROL_OFFSET 0x00000004 -#define WLAN_XTAL_CONTROL_TCXO_MSB 0 -#define WLAN_XTAL_CONTROL_TCXO_LSB 0 -#define WLAN_XTAL_CONTROL_TCXO_MASK 0x00000001 -#define WLAN_XTAL_CONTROL_TCXO_GET(x) (((x) & 0x00000001) >> 0) -#define WLAN_XTAL_CONTROL_TCXO_SET(x) (((x) << 0) & 0x00000001) - -/* macros for WLAN_REG_CONTROL0 */ -#define WLAN_REG_CONTROL0_ADDRESS 0x00000008 -#define WLAN_REG_CONTROL0_OFFSET 0x00000008 -#define WLAN_REG_CONTROL0_SWREG_BITS_MSB 31 -#define WLAN_REG_CONTROL0_SWREG_BITS_LSB 0 -#define WLAN_REG_CONTROL0_SWREG_BITS_MASK 0xffffffff -#define WLAN_REG_CONTROL0_SWREG_BITS_GET(x) (((x) & 0xffffffff) >> 0) -#define WLAN_REG_CONTROL0_SWREG_BITS_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for WLAN_REG_CONTROL1 */ -#define WLAN_REG_CONTROL1_ADDRESS 0x0000000c -#define WLAN_REG_CONTROL1_OFFSET 0x0000000c -#define WLAN_REG_CONTROL1_SWREG_PROGRAM_MSB 0 -#define WLAN_REG_CONTROL1_SWREG_PROGRAM_LSB 0 -#define WLAN_REG_CONTROL1_SWREG_PROGRAM_MASK 0x00000001 -#define WLAN_REG_CONTROL1_SWREG_PROGRAM_GET(x) (((x) & 0x00000001) >> 0) -#define WLAN_REG_CONTROL1_SWREG_PROGRAM_SET(x) (((x) << 0) & 0x00000001) -#define WLAN_REG_CONTROL1_OTPREG_LVL_MSB 2 -#define WLAN_REG_CONTROL1_OTPREG_LVL_LSB 1 -#define WLAN_REG_CONTROL1_OTPREG_LVL_MASK 0x00000006 -#define WLAN_REG_CONTROL1_OTPREG_LVL_GET(x) (((x) & 0x00000006) >> 1) -#define WLAN_REG_CONTROL1_OTPREG_LVL_SET(x) (((x) << 1) & 0x00000006) - -/* macros for WLAN_QUADRATURE */ -#define WLAN_QUADRATURE_ADDRESS 0x00000010 -#define WLAN_QUADRATURE_OFFSET 0x00000010 -#define WLAN_QUADRATURE_DAC_MSB 2 -#define WLAN_QUADRATURE_DAC_LSB 0 -#define WLAN_QUADRATURE_DAC_MASK 0x00000007 -#define WLAN_QUADRATURE_DAC_GET(x) (((x) & 0x00000007) >> 0) -#define WLAN_QUADRATURE_DAC_SET(x) (((x) << 0) & 0x00000007) -#define WLAN_QUADRATURE_ADC_MSB 7 -#define WLAN_QUADRATURE_ADC_LSB 4 -#define WLAN_QUADRATURE_ADC_MASK 0x000000f0 -#define WLAN_QUADRATURE_ADC_GET(x) (((x) & 0x000000f0) >> 4) -#define WLAN_QUADRATURE_ADC_SET(x) (((x) << 4) & 0x000000f0) - -/* macros for WLAN_PLL_CONTROL */ -#define WLAN_PLL_CONTROL_ADDRESS 0x00000014 -#define WLAN_PLL_CONTROL_OFFSET 0x00000014 -#define WLAN_PLL_CONTROL_DIV_MSB 9 -#define WLAN_PLL_CONTROL_DIV_LSB 0 -#define WLAN_PLL_CONTROL_DIV_MASK 0x000003ff -#define WLAN_PLL_CONTROL_DIV_GET(x) (((x) & 0x000003ff) >> 0) -#define WLAN_PLL_CONTROL_DIV_SET(x) (((x) << 0) & 0x000003ff) -#define WLAN_PLL_CONTROL_REFDIV_MSB 13 -#define WLAN_PLL_CONTROL_REFDIV_LSB 10 -#define WLAN_PLL_CONTROL_REFDIV_MASK 0x00003c00 -#define WLAN_PLL_CONTROL_REFDIV_GET(x) (((x) & 0x00003c00) >> 10) -#define WLAN_PLL_CONTROL_REFDIV_SET(x) (((x) << 10) & 0x00003c00) -#define WLAN_PLL_CONTROL_CLK_SEL_MSB 15 -#define WLAN_PLL_CONTROL_CLK_SEL_LSB 14 -#define WLAN_PLL_CONTROL_CLK_SEL_MASK 0x0000c000 -#define WLAN_PLL_CONTROL_CLK_SEL_GET(x) (((x) & 0x0000c000) >> 14) -#define WLAN_PLL_CONTROL_CLK_SEL_SET(x) (((x) << 14) & 0x0000c000) -#define WLAN_PLL_CONTROL_BYPASS_MSB 16 -#define WLAN_PLL_CONTROL_BYPASS_LSB 16 -#define WLAN_PLL_CONTROL_BYPASS_MASK 0x00010000 -#define WLAN_PLL_CONTROL_BYPASS_GET(x) (((x) & 0x00010000) >> 16) -#define WLAN_PLL_CONTROL_BYPASS_SET(x) (((x) << 16) & 0x00010000) -#define WLAN_PLL_CONTROL_UPDATING_MSB 17 -#define WLAN_PLL_CONTROL_UPDATING_LSB 17 -#define WLAN_PLL_CONTROL_UPDATING_MASK 0x00020000 -#define WLAN_PLL_CONTROL_UPDATING_GET(x) (((x) & 0x00020000) >> 17) -#define WLAN_PLL_CONTROL_NOPWD_MSB 18 -#define WLAN_PLL_CONTROL_NOPWD_LSB 18 -#define WLAN_PLL_CONTROL_NOPWD_MASK 0x00040000 -#define WLAN_PLL_CONTROL_NOPWD_GET(x) (((x) & 0x00040000) >> 18) -#define WLAN_PLL_CONTROL_NOPWD_SET(x) (((x) << 18) & 0x00040000) -#define WLAN_PLL_CONTROL_MAC_OVERRIDE_MSB 19 -#define WLAN_PLL_CONTROL_MAC_OVERRIDE_LSB 19 -#define WLAN_PLL_CONTROL_MAC_OVERRIDE_MASK 0x00080000 -#define WLAN_PLL_CONTROL_MAC_OVERRIDE_GET(x) (((x) & 0x00080000) >> 19) -#define WLAN_PLL_CONTROL_MAC_OVERRIDE_SET(x) (((x) << 19) & 0x00080000) -#define WLAN_PLL_CONTROL_DIG_TEST_CLK_MSB 20 -#define WLAN_PLL_CONTROL_DIG_TEST_CLK_LSB 20 -#define WLAN_PLL_CONTROL_DIG_TEST_CLK_MASK 0x00100000 -#define WLAN_PLL_CONTROL_DIG_TEST_CLK_GET(x) (((x) & 0x00100000) >> 20) -#define WLAN_PLL_CONTROL_DIG_TEST_CLK_SET(x) (((x) << 20) & 0x00100000) - -/* macros for WLAN_PLL_SETTLE */ -#define WLAN_PLL_SETTLE_ADDRESS 0x00000018 -#define WLAN_PLL_SETTLE_OFFSET 0x00000018 -#define WLAN_PLL_SETTLE_TIME_MSB 10 -#define WLAN_PLL_SETTLE_TIME_LSB 0 -#define WLAN_PLL_SETTLE_TIME_MASK 0x000007ff -#define WLAN_PLL_SETTLE_TIME_GET(x) (((x) & 0x000007ff) >> 0) -#define WLAN_PLL_SETTLE_TIME_SET(x) (((x) << 0) & 0x000007ff) - -/* macros for WLAN_XTAL_SETTLE */ -#define WLAN_XTAL_SETTLE_ADDRESS 0x0000001c -#define WLAN_XTAL_SETTLE_OFFSET 0x0000001c -#define WLAN_XTAL_SETTLE_TIME_MSB 6 -#define WLAN_XTAL_SETTLE_TIME_LSB 0 -#define WLAN_XTAL_SETTLE_TIME_MASK 0x0000007f -#define WLAN_XTAL_SETTLE_TIME_GET(x) (((x) & 0x0000007f) >> 0) -#define WLAN_XTAL_SETTLE_TIME_SET(x) (((x) << 0) & 0x0000007f) - -/* macros for WLAN_CLOCK_OUT */ -#define WLAN_CLOCK_OUT_ADDRESS 0x00000020 -#define WLAN_CLOCK_OUT_OFFSET 0x00000020 -#define WLAN_CLOCK_OUT_SELECT_MSB 4 -#define WLAN_CLOCK_OUT_SELECT_LSB 0 -#define WLAN_CLOCK_OUT_SELECT_MASK 0x0000001f -#define WLAN_CLOCK_OUT_SELECT_GET(x) (((x) & 0x0000001f) >> 0) -#define WLAN_CLOCK_OUT_SELECT_SET(x) (((x) << 0) & 0x0000001f) -#define WLAN_CLOCK_OUT_DELAY_MSB 7 -#define WLAN_CLOCK_OUT_DELAY_LSB 5 -#define WLAN_CLOCK_OUT_DELAY_MASK 0x000000e0 -#define WLAN_CLOCK_OUT_DELAY_GET(x) (((x) & 0x000000e0) >> 5) -#define WLAN_CLOCK_OUT_DELAY_SET(x) (((x) << 5) & 0x000000e0) - -/* macros for WLAN_BIAS_OVERRIDE */ -#define WLAN_BIAS_OVERRIDE_ADDRESS 0x00000024 -#define WLAN_BIAS_OVERRIDE_OFFSET 0x00000024 -#define WLAN_BIAS_OVERRIDE_ON_MSB 0 -#define WLAN_BIAS_OVERRIDE_ON_LSB 0 -#define WLAN_BIAS_OVERRIDE_ON_MASK 0x00000001 -#define WLAN_BIAS_OVERRIDE_ON_GET(x) (((x) & 0x00000001) >> 0) -#define WLAN_BIAS_OVERRIDE_ON_SET(x) (((x) << 0) & 0x00000001) - -/* macros for WLAN_RESET_CAUSE */ -#define WLAN_RESET_CAUSE_ADDRESS 0x00000028 -#define WLAN_RESET_CAUSE_OFFSET 0x00000028 -#define WLAN_RESET_CAUSE_LAST_MSB 2 -#define WLAN_RESET_CAUSE_LAST_LSB 0 -#define WLAN_RESET_CAUSE_LAST_MASK 0x00000007 -#define WLAN_RESET_CAUSE_LAST_GET(x) (((x) & 0x00000007) >> 0) - -/* macros for WLAN_SYSTEM_SLEEP */ -#define WLAN_SYSTEM_SLEEP_ADDRESS 0x0000002c -#define WLAN_SYSTEM_SLEEP_OFFSET 0x0000002c -#define WLAN_SYSTEM_SLEEP_DISABLE_MSB 0 -#define WLAN_SYSTEM_SLEEP_DISABLE_LSB 0 -#define WLAN_SYSTEM_SLEEP_DISABLE_MASK 0x00000001 -#define WLAN_SYSTEM_SLEEP_DISABLE_GET(x) (((x) & 0x00000001) >> 0) -#define WLAN_SYSTEM_SLEEP_DISABLE_SET(x) (((x) << 0) & 0x00000001) -#define WLAN_SYSTEM_SLEEP_LIGHT_MSB 1 -#define WLAN_SYSTEM_SLEEP_LIGHT_LSB 1 -#define WLAN_SYSTEM_SLEEP_LIGHT_MASK 0x00000002 -#define WLAN_SYSTEM_SLEEP_LIGHT_GET(x) (((x) & 0x00000002) >> 1) -#define WLAN_SYSTEM_SLEEP_LIGHT_SET(x) (((x) << 1) & 0x00000002) -#define WLAN_SYSTEM_SLEEP_MAC_IF_MSB 2 -#define WLAN_SYSTEM_SLEEP_MAC_IF_LSB 2 -#define WLAN_SYSTEM_SLEEP_MAC_IF_MASK 0x00000004 -#define WLAN_SYSTEM_SLEEP_MAC_IF_GET(x) (((x) & 0x00000004) >> 2) - -/* macros for WLAN_MAC_SLEEP_CONTROL */ -#define WLAN_MAC_SLEEP_CONTROL_ADDRESS 0x00000030 -#define WLAN_MAC_SLEEP_CONTROL_OFFSET 0x00000030 -#define WLAN_MAC_SLEEP_CONTROL_ENABLE_MSB 0 -#define WLAN_MAC_SLEEP_CONTROL_ENABLE_LSB 0 -#define WLAN_MAC_SLEEP_CONTROL_ENABLE_MASK 0x00000001 -#define WLAN_MAC_SLEEP_CONTROL_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define WLAN_MAC_SLEEP_CONTROL_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define WLAN_MAC_SLEEP_CONTROL_RESERVED_MSB 1 -#define WLAN_MAC_SLEEP_CONTROL_RESERVED_LSB 1 -#define WLAN_MAC_SLEEP_CONTROL_RESERVED_MASK 0x00000002 -#define WLAN_MAC_SLEEP_CONTROL_RESERVED_GET(x) (((x) & 0x00000002) >> 1) -#define WLAN_MAC_SLEEP_CONTROL_RESERVED_SET(x) (((x) << 1) & 0x00000002) -#define WLAN_MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_MSB 2 -#define WLAN_MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_LSB 2 -#define WLAN_MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_MASK 0x00000004 -#define WLAN_MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_GET(x) (((x) & 0x00000004) >> 2) -#define WLAN_MAC_SLEEP_CONTROL_HSEL_WMAC_ENABLE_SET(x) (((x) << 2) & 0x00000004) - -/* macros for WLAN_KEEP_AWAKE */ -#define WLAN_KEEP_AWAKE_ADDRESS 0x00000034 -#define WLAN_KEEP_AWAKE_OFFSET 0x00000034 -#define WLAN_KEEP_AWAKE_COUNT_MSB 7 -#define WLAN_KEEP_AWAKE_COUNT_LSB 0 -#define WLAN_KEEP_AWAKE_COUNT_MASK 0x000000ff -#define WLAN_KEEP_AWAKE_COUNT_GET(x) (((x) & 0x000000ff) >> 0) -#define WLAN_KEEP_AWAKE_COUNT_SET(x) (((x) << 0) & 0x000000ff) - -/* macros for WLAN_DERIVED_RTC_CLK */ -#define WLAN_DERIVED_RTC_CLK_ADDRESS 0x00000038 -#define WLAN_DERIVED_RTC_CLK_OFFSET 0x00000038 -#define WLAN_DERIVED_RTC_CLK_PERIOD_MSB 15 -#define WLAN_DERIVED_RTC_CLK_PERIOD_LSB 1 -#define WLAN_DERIVED_RTC_CLK_PERIOD_MASK 0x0000fffe -#define WLAN_DERIVED_RTC_CLK_PERIOD_GET(x) (((x) & 0x0000fffe) >> 1) -#define WLAN_DERIVED_RTC_CLK_PERIOD_SET(x) (((x) << 1) & 0x0000fffe) -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_MSB 18 -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_LSB 18 -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_MASK 0x00040000 -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_GET(x) (((x) & 0x00040000) >> 18) -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MSB 20 -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_LSB 20 -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_MASK 0x00100000 -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_GET(x) (((x) & 0x00100000) >> 20) -#define WLAN_DERIVED_RTC_CLK_EXTERNAL_DETECT_EN_SET(x) (((x) << 20) & 0x00100000) - -/* macros for MAC_PCU_SLP32_MODE */ -#define MAC_PCU_SLP32_MODE_ADDRESS 0x0000003c -#define MAC_PCU_SLP32_MODE_OFFSET 0x0000003c -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MSB 19 -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_LSB 0 -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_MASK 0x000fffff -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_GET(x) (((x) & 0x000fffff) >> 0) -#define MAC_PCU_SLP32_MODE_HALF_CLK_LATENCY_SET(x) (((x) << 0) & 0x000fffff) -#define MAC_PCU_SLP32_MODE_ENABLE_MSB 20 -#define MAC_PCU_SLP32_MODE_ENABLE_LSB 20 -#define MAC_PCU_SLP32_MODE_ENABLE_MASK 0x00100000 -#define MAC_PCU_SLP32_MODE_ENABLE_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_PCU_SLP32_MODE_ENABLE_SET(x) (((x) << 20) & 0x00100000) -#define MAC_PCU_SLP32_MODE_TSF_WRITE_STATUS_MSB 21 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_STATUS_LSB 21 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_STATUS_MASK 0x00200000 -#define MAC_PCU_SLP32_MODE_TSF_WRITE_STATUS_GET(x) (((x) & 0x00200000) >> 21) -#define MAC_PCU_SLP32_MODE_DISABLE_32KHZ_MSB 22 -#define MAC_PCU_SLP32_MODE_DISABLE_32KHZ_LSB 22 -#define MAC_PCU_SLP32_MODE_DISABLE_32KHZ_MASK 0x00400000 -#define MAC_PCU_SLP32_MODE_DISABLE_32KHZ_GET(x) (((x) & 0x00400000) >> 22) -#define MAC_PCU_SLP32_MODE_DISABLE_32KHZ_SET(x) (((x) << 22) & 0x00400000) -#define MAC_PCU_SLP32_MODE_FORCE_BIAS_BLOCK_ON_MSB 23 -#define MAC_PCU_SLP32_MODE_FORCE_BIAS_BLOCK_ON_LSB 23 -#define MAC_PCU_SLP32_MODE_FORCE_BIAS_BLOCK_ON_MASK 0x00800000 -#define MAC_PCU_SLP32_MODE_FORCE_BIAS_BLOCK_ON_GET(x) (((x) & 0x00800000) >> 23) -#define MAC_PCU_SLP32_MODE_FORCE_BIAS_BLOCK_ON_SET(x) (((x) << 23) & 0x00800000) -#define MAC_PCU_SLP32_MODE_TSF2_WRITE_STATUS_MSB 24 -#define MAC_PCU_SLP32_MODE_TSF2_WRITE_STATUS_LSB 24 -#define MAC_PCU_SLP32_MODE_TSF2_WRITE_STATUS_MASK 0x01000000 -#define MAC_PCU_SLP32_MODE_TSF2_WRITE_STATUS_GET(x) (((x) & 0x01000000) >> 24) - -/* macros for MAC_PCU_SLP32_WAKE */ -#define MAC_PCU_SLP32_WAKE_ADDRESS 0x00000040 -#define MAC_PCU_SLP32_WAKE_OFFSET 0x00000040 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_MSB 15 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_LSB 0 -#define MAC_PCU_SLP32_WAKE_XTL_TIME_MASK 0x0000ffff -#define MAC_PCU_SLP32_WAKE_XTL_TIME_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_SLP32_WAKE_XTL_TIME_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_PCU_SLP32_INC */ -#define MAC_PCU_SLP32_INC_ADDRESS 0x00000044 -#define MAC_PCU_SLP32_INC_OFFSET 0x00000044 -#define MAC_PCU_SLP32_INC_TSF_INC_MSB 19 -#define MAC_PCU_SLP32_INC_TSF_INC_LSB 0 -#define MAC_PCU_SLP32_INC_TSF_INC_MASK 0x000fffff -#define MAC_PCU_SLP32_INC_TSF_INC_GET(x) (((x) & 0x000fffff) >> 0) -#define MAC_PCU_SLP32_INC_TSF_INC_SET(x) (((x) << 0) & 0x000fffff) - -/* macros for MAC_PCU_SLP_MIB1 */ -#define MAC_PCU_SLP_MIB1_ADDRESS 0x00000048 -#define MAC_PCU_SLP_MIB1_OFFSET 0x00000048 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_MSB 31 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_LSB 0 -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_MASK 0xffffffff -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_SLP_MIB1_SLEEP_CNT_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_SLP_MIB2 */ -#define MAC_PCU_SLP_MIB2_ADDRESS 0x0000004c -#define MAC_PCU_SLP_MIB2_OFFSET 0x0000004c -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_MSB 31 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_LSB 0 -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_MASK 0xffffffff -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_SLP_MIB2_CYCLE_CNT_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_SLP_MIB3 */ -#define MAC_PCU_SLP_MIB3_ADDRESS 0x00000050 -#define MAC_PCU_SLP_MIB3_OFFSET 0x00000050 -#define MAC_PCU_SLP_MIB3_CLR_CNT_MSB 0 -#define MAC_PCU_SLP_MIB3_CLR_CNT_LSB 0 -#define MAC_PCU_SLP_MIB3_CLR_CNT_MASK 0x00000001 -#define MAC_PCU_SLP_MIB3_CLR_CNT_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_SLP_MIB3_CLR_CNT_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_SLP_MIB3_PENDING_MSB 1 -#define MAC_PCU_SLP_MIB3_PENDING_LSB 1 -#define MAC_PCU_SLP_MIB3_PENDING_MASK 0x00000002 -#define MAC_PCU_SLP_MIB3_PENDING_GET(x) (((x) & 0x00000002) >> 1) - -/* macros for MAC_PCU_TSF_L32 */ -#define MAC_PCU_TSF_L32_ADDRESS 0x00000054 -#define MAC_PCU_TSF_L32_OFFSET 0x00000054 -#define MAC_PCU_TSF_L32_VALUE_MSB 31 -#define MAC_PCU_TSF_L32_VALUE_LSB 0 -#define MAC_PCU_TSF_L32_VALUE_MASK 0xffffffff -#define MAC_PCU_TSF_L32_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_TSF_L32_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_TSF_U32 */ -#define MAC_PCU_TSF_U32_ADDRESS 0x00000058 -#define MAC_PCU_TSF_U32_OFFSET 0x00000058 -#define MAC_PCU_TSF_U32_VALUE_MSB 31 -#define MAC_PCU_TSF_U32_VALUE_LSB 0 -#define MAC_PCU_TSF_U32_VALUE_MASK 0xffffffff -#define MAC_PCU_TSF_U32_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_TSF_U32_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_WBTIMER_0 */ -#define MAC_PCU_WBTIMER_0_ADDRESS 0x0000005c -#define MAC_PCU_WBTIMER_0_OFFSET 0x0000005c -#define MAC_PCU_WBTIMER_0_ENABLE_MSB 0 -#define MAC_PCU_WBTIMER_0_ENABLE_LSB 0 -#define MAC_PCU_WBTIMER_0_ENABLE_MASK 0x00000001 -#define MAC_PCU_WBTIMER_0_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_WBTIMER_0_ENABLE_SET(x) (((x) << 0) & 0x00000001) - -/* macros for MAC_PCU_WBTIMER_1 */ -#define MAC_PCU_WBTIMER_1_ADDRESS 0x00000060 -#define MAC_PCU_WBTIMER_1_OFFSET 0x00000060 -#define MAC_PCU_WBTIMER_1_VALUE_MSB 31 -#define MAC_PCU_WBTIMER_1_VALUE_LSB 0 -#define MAC_PCU_WBTIMER_1_VALUE_MASK 0xffffffff -#define MAC_PCU_WBTIMER_1_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_WBTIMER_1_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_GENERIC_TIMERS */ -#define MAC_PCU_GENERIC_TIMERS_ADDRESS 0x00000064 -#define MAC_PCU_GENERIC_TIMERS_OFFSET 0x00000064 -#define MAC_PCU_GENERIC_TIMERS_DATA_MSB 31 -#define MAC_PCU_GENERIC_TIMERS_DATA_LSB 0 -#define MAC_PCU_GENERIC_TIMERS_DATA_MASK 0xffffffff -#define MAC_PCU_GENERIC_TIMERS_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_GENERIC_TIMERS_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_GENERIC_TIMERS_MODE */ -#define MAC_PCU_GENERIC_TIMERS_MODE_ADDRESS 0x000000bc -#define MAC_PCU_GENERIC_TIMERS_MODE_OFFSET 0x000000bc -#define MAC_PCU_GENERIC_TIMERS_MODE_ENABLE_MSB 7 -#define MAC_PCU_GENERIC_TIMERS_MODE_ENABLE_LSB 0 -#define MAC_PCU_GENERIC_TIMERS_MODE_ENABLE_MASK 0x000000ff -#define MAC_PCU_GENERIC_TIMERS_MODE_ENABLE_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_GENERIC_TIMERS_MODE_ENABLE_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_GENERIC_TIMERS_MODE_OVERFLOW_INDEX_MSB 10 -#define MAC_PCU_GENERIC_TIMERS_MODE_OVERFLOW_INDEX_LSB 8 -#define MAC_PCU_GENERIC_TIMERS_MODE_OVERFLOW_INDEX_MASK 0x00000700 -#define MAC_PCU_GENERIC_TIMERS_MODE_OVERFLOW_INDEX_GET(x) (((x) & 0x00000700) >> 8) -#define MAC_PCU_GENERIC_TIMERS_MODE_THRESH_MSB 31 -#define MAC_PCU_GENERIC_TIMERS_MODE_THRESH_LSB 12 -#define MAC_PCU_GENERIC_TIMERS_MODE_THRESH_MASK 0xfffff000 -#define MAC_PCU_GENERIC_TIMERS_MODE_THRESH_GET(x) (((x) & 0xfffff000) >> 12) -#define MAC_PCU_GENERIC_TIMERS_MODE_THRESH_SET(x) (((x) << 12) & 0xfffff000) - -/* macros for MAC_PCU_SLP1 */ -#define MAC_PCU_SLP1_ADDRESS 0x000000c0 -#define MAC_PCU_SLP1_OFFSET 0x000000c0 -#define MAC_PCU_SLP1_CAB_TIMEOUT_EXT_MSB 4 -#define MAC_PCU_SLP1_CAB_TIMEOUT_EXT_LSB 0 -#define MAC_PCU_SLP1_CAB_TIMEOUT_EXT_MASK 0x0000001f -#define MAC_PCU_SLP1_CAB_TIMEOUT_EXT_GET(x) (((x) & 0x0000001f) >> 0) -#define MAC_PCU_SLP1_CAB_TIMEOUT_EXT_SET(x) (((x) << 0) & 0x0000001f) -#define MAC_PCU_SLP1_ASSUME_DTIM_MSB 19 -#define MAC_PCU_SLP1_ASSUME_DTIM_LSB 19 -#define MAC_PCU_SLP1_ASSUME_DTIM_MASK 0x00080000 -#define MAC_PCU_SLP1_ASSUME_DTIM_GET(x) (((x) & 0x00080000) >> 19) -#define MAC_PCU_SLP1_ASSUME_DTIM_SET(x) (((x) << 19) & 0x00080000) -#define MAC_PCU_SLP1_BUG_59985_FIX_ENABLE_MSB 20 -#define MAC_PCU_SLP1_BUG_59985_FIX_ENABLE_LSB 20 -#define MAC_PCU_SLP1_BUG_59985_FIX_ENABLE_MASK 0x00100000 -#define MAC_PCU_SLP1_BUG_59985_FIX_ENABLE_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_PCU_SLP1_BUG_59985_FIX_ENABLE_SET(x) (((x) << 20) & 0x00100000) -#define MAC_PCU_SLP1_CAB_TIMEOUT_MSB 31 -#define MAC_PCU_SLP1_CAB_TIMEOUT_LSB 21 -#define MAC_PCU_SLP1_CAB_TIMEOUT_MASK 0xffe00000 -#define MAC_PCU_SLP1_CAB_TIMEOUT_GET(x) (((x) & 0xffe00000) >> 21) -#define MAC_PCU_SLP1_CAB_TIMEOUT_SET(x) (((x) << 21) & 0xffe00000) - -/* macros for MAC_PCU_SLP2 */ -#define MAC_PCU_SLP2_ADDRESS 0x000000c4 -#define MAC_PCU_SLP2_OFFSET 0x000000c4 -#define MAC_PCU_SLP2_BEACON_TIMEOUT_EXT_MSB 4 -#define MAC_PCU_SLP2_BEACON_TIMEOUT_EXT_LSB 0 -#define MAC_PCU_SLP2_BEACON_TIMEOUT_EXT_MASK 0x0000001f -#define MAC_PCU_SLP2_BEACON_TIMEOUT_EXT_GET(x) (((x) & 0x0000001f) >> 0) -#define MAC_PCU_SLP2_BEACON_TIMEOUT_EXT_SET(x) (((x) << 0) & 0x0000001f) -#define MAC_PCU_SLP2_BEACON_TIMEOUT_MSB 31 -#define MAC_PCU_SLP2_BEACON_TIMEOUT_LSB 21 -#define MAC_PCU_SLP2_BEACON_TIMEOUT_MASK 0xffe00000 -#define MAC_PCU_SLP2_BEACON_TIMEOUT_GET(x) (((x) & 0xffe00000) >> 21) -#define MAC_PCU_SLP2_BEACON_TIMEOUT_SET(x) (((x) << 21) & 0xffe00000) - -/* macros for MAC_PCU_SLP3 */ -#define MAC_PCU_SLP3_ADDRESS 0x000000c8 -#define MAC_PCU_SLP3_OFFSET 0x000000c8 -#define MAC_PCU_SLP3_CAB_AWAKE_DUR_MSB 15 -#define MAC_PCU_SLP3_CAB_AWAKE_DUR_LSB 0 -#define MAC_PCU_SLP3_CAB_AWAKE_DUR_MASK 0x0000ffff -#define MAC_PCU_SLP3_CAB_AWAKE_DUR_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_SLP3_CAB_AWAKE_DUR_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_PCU_SLP3_CAB_AWAKE_ENABLE_MSB 16 -#define MAC_PCU_SLP3_CAB_AWAKE_ENABLE_LSB 16 -#define MAC_PCU_SLP3_CAB_AWAKE_ENABLE_MASK 0x00010000 -#define MAC_PCU_SLP3_CAB_AWAKE_ENABLE_GET(x) (((x) & 0x00010000) >> 16) -#define MAC_PCU_SLP3_CAB_AWAKE_ENABLE_SET(x) (((x) << 16) & 0x00010000) - -/* macros for MAC_PCU_SLP4 */ -#define MAC_PCU_SLP4_ADDRESS 0x000000cc -#define MAC_PCU_SLP4_OFFSET 0x000000cc -#define MAC_PCU_SLP4_BEACON2_TIMEOUT_MSB 15 -#define MAC_PCU_SLP4_BEACON2_TIMEOUT_LSB 0 -#define MAC_PCU_SLP4_BEACON2_TIMEOUT_MASK 0x0000ffff -#define MAC_PCU_SLP4_BEACON2_TIMEOUT_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_SLP4_BEACON2_TIMEOUT_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_PCU_SLP4_CAB2_TIMEOUT_MSB 30 -#define MAC_PCU_SLP4_CAB2_TIMEOUT_LSB 16 -#define MAC_PCU_SLP4_CAB2_TIMEOUT_MASK 0x7fff0000 -#define MAC_PCU_SLP4_CAB2_TIMEOUT_GET(x) (((x) & 0x7fff0000) >> 16) -#define MAC_PCU_SLP4_CAB2_TIMEOUT_SET(x) (((x) << 16) & 0x7fff0000) -#define MAC_PCU_SLP4_ASSUME_DTIM2_MSB 31 -#define MAC_PCU_SLP4_ASSUME_DTIM2_LSB 31 -#define MAC_PCU_SLP4_ASSUME_DTIM2_MASK 0x80000000 -#define MAC_PCU_SLP4_ASSUME_DTIM2_GET(x) (((x) & 0x80000000) >> 31) -#define MAC_PCU_SLP4_ASSUME_DTIM2_SET(x) (((x) << 31) & 0x80000000) - -/* macros for MAC_PCU_RESET_TSF */ -#define MAC_PCU_RESET_TSF_ADDRESS 0x000000d0 -#define MAC_PCU_RESET_TSF_OFFSET 0x000000d0 -#define MAC_PCU_RESET_TSF_ONE_SHOT_MSB 24 -#define MAC_PCU_RESET_TSF_ONE_SHOT_LSB 24 -#define MAC_PCU_RESET_TSF_ONE_SHOT_MASK 0x01000000 -#define MAC_PCU_RESET_TSF_ONE_SHOT_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_PCU_RESET_TSF_ONE_SHOT_SET(x) (((x) << 24) & 0x01000000) -#define MAC_PCU_RESET_TSF_ONE_SHOT2_MSB 25 -#define MAC_PCU_RESET_TSF_ONE_SHOT2_LSB 25 -#define MAC_PCU_RESET_TSF_ONE_SHOT2_MASK 0x02000000 -#define MAC_PCU_RESET_TSF_ONE_SHOT2_GET(x) (((x) & 0x02000000) >> 25) -#define MAC_PCU_RESET_TSF_ONE_SHOT2_SET(x) (((x) << 25) & 0x02000000) - -/* macros for MAC_PCU_TSF2_L32 */ -#define MAC_PCU_TSF2_L32_ADDRESS 0x000000d4 -#define MAC_PCU_TSF2_L32_OFFSET 0x000000d4 -#define MAC_PCU_TSF2_L32_VALUE_MSB 31 -#define MAC_PCU_TSF2_L32_VALUE_LSB 0 -#define MAC_PCU_TSF2_L32_VALUE_MASK 0xffffffff -#define MAC_PCU_TSF2_L32_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_TSF2_L32_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_TSF2_U32 */ -#define MAC_PCU_TSF2_U32_ADDRESS 0x000000d8 -#define MAC_PCU_TSF2_U32_OFFSET 0x000000d8 -#define MAC_PCU_TSF2_U32_VALUE_MSB 31 -#define MAC_PCU_TSF2_U32_VALUE_LSB 0 -#define MAC_PCU_TSF2_U32_VALUE_MASK 0xffffffff -#define MAC_PCU_TSF2_U32_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_TSF2_U32_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_GENERIC_TIMERS2 */ -#define MAC_PCU_GENERIC_TIMERS2_ADDRESS 0x000000dc -#define MAC_PCU_GENERIC_TIMERS2_OFFSET 0x000000dc -#define MAC_PCU_GENERIC_TIMERS2_DATA_MSB 31 -#define MAC_PCU_GENERIC_TIMERS2_DATA_LSB 0 -#define MAC_PCU_GENERIC_TIMERS2_DATA_MASK 0xffffffff -#define MAC_PCU_GENERIC_TIMERS2_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_GENERIC_TIMERS2_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_GENERIC_TIMERS_MODE2 */ -#define MAC_PCU_GENERIC_TIMERS_MODE2_ADDRESS 0x00000134 -#define MAC_PCU_GENERIC_TIMERS_MODE2_OFFSET 0x00000134 -#define MAC_PCU_GENERIC_TIMERS_MODE2_ENABLE_MSB 7 -#define MAC_PCU_GENERIC_TIMERS_MODE2_ENABLE_LSB 0 -#define MAC_PCU_GENERIC_TIMERS_MODE2_ENABLE_MASK 0x000000ff -#define MAC_PCU_GENERIC_TIMERS_MODE2_ENABLE_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_GENERIC_TIMERS_MODE2_ENABLE_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_GENERIC_TIMERS_MODE2_OVERFLOW_INDEX_MSB 11 -#define MAC_PCU_GENERIC_TIMERS_MODE2_OVERFLOW_INDEX_LSB 8 -#define MAC_PCU_GENERIC_TIMERS_MODE2_OVERFLOW_INDEX_MASK 0x00000f00 -#define MAC_PCU_GENERIC_TIMERS_MODE2_OVERFLOW_INDEX_GET(x) (((x) & 0x00000f00) >> 8) -#define MAC_PCU_GENERIC_TIMERS_MODE2_OVERFLOW_INDEX2_MSB 15 -#define MAC_PCU_GENERIC_TIMERS_MODE2_OVERFLOW_INDEX2_LSB 12 -#define MAC_PCU_GENERIC_TIMERS_MODE2_OVERFLOW_INDEX2_MASK 0x0000f000 -#define MAC_PCU_GENERIC_TIMERS_MODE2_OVERFLOW_INDEX2_GET(x) (((x) & 0x0000f000) >> 12) - -/* macros for MAC_PCU_TSF_THRESHOLD */ -#define MAC_PCU_TSF_THRESHOLD_ADDRESS 0x00000144 -#define MAC_PCU_TSF_THRESHOLD_OFFSET 0x00000144 -#define MAC_PCU_TSF_THRESHOLD_VALUE_MSB 15 -#define MAC_PCU_TSF_THRESHOLD_VALUE_LSB 0 -#define MAC_PCU_TSF_THRESHOLD_VALUE_MASK 0x0000ffff -#define MAC_PCU_TSF_THRESHOLD_VALUE_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_TSF_THRESHOLD_VALUE_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for WLAN_HT */ -#define WLAN_HT_ADDRESS 0x00000148 -#define WLAN_HT_OFFSET 0x00000148 -#define WLAN_HT_MODE_MSB 0 -#define WLAN_HT_MODE_LSB 0 -#define WLAN_HT_MODE_MASK 0x00000001 -#define WLAN_HT_MODE_GET(x) (((x) & 0x00000001) >> 0) -#define WLAN_HT_MODE_SET(x) (((x) << 0) & 0x00000001) - -/* macros for MAC_PCU_GENERIC_TIMERS_TSF_SEL */ -#define MAC_PCU_GENERIC_TIMERS_TSF_SEL_ADDRESS 0x00000150 -#define MAC_PCU_GENERIC_TIMERS_TSF_SEL_OFFSET 0x00000150 -#define MAC_PCU_GENERIC_TIMERS_TSF_SEL_VALUE_MSB 15 -#define MAC_PCU_GENERIC_TIMERS_TSF_SEL_VALUE_LSB 0 -#define MAC_PCU_GENERIC_TIMERS_TSF_SEL_VALUE_MASK 0x0000ffff -#define MAC_PCU_GENERIC_TIMERS_TSF_SEL_VALUE_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_GENERIC_TIMERS_TSF_SEL_VALUE_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_PCU_BMISS_TIMEOUT */ -#define MAC_PCU_BMISS_TIMEOUT_ADDRESS 0x00000154 -#define MAC_PCU_BMISS_TIMEOUT_OFFSET 0x00000154 -#define MAC_PCU_BMISS_TIMEOUT_VALUE_MSB 23 -#define MAC_PCU_BMISS_TIMEOUT_VALUE_LSB 0 -#define MAC_PCU_BMISS_TIMEOUT_VALUE_MASK 0x00ffffff -#define MAC_PCU_BMISS_TIMEOUT_VALUE_GET(x) (((x) & 0x00ffffff) >> 0) -#define MAC_PCU_BMISS_TIMEOUT_VALUE_SET(x) (((x) << 0) & 0x00ffffff) -#define MAC_PCU_BMISS_TIMEOUT_ENABLE_MSB 24 -#define MAC_PCU_BMISS_TIMEOUT_ENABLE_LSB 24 -#define MAC_PCU_BMISS_TIMEOUT_ENABLE_MASK 0x01000000 -#define MAC_PCU_BMISS_TIMEOUT_ENABLE_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_PCU_BMISS_TIMEOUT_ENABLE_SET(x) (((x) << 24) & 0x01000000) - -/* macros for MAC_PCU_BMISS2_TIMEOUT */ -#define MAC_PCU_BMISS2_TIMEOUT_ADDRESS 0x00000158 -#define MAC_PCU_BMISS2_TIMEOUT_OFFSET 0x00000158 -#define MAC_PCU_BMISS2_TIMEOUT_VALUE_MSB 23 -#define MAC_PCU_BMISS2_TIMEOUT_VALUE_LSB 0 -#define MAC_PCU_BMISS2_TIMEOUT_VALUE_MASK 0x00ffffff -#define MAC_PCU_BMISS2_TIMEOUT_VALUE_GET(x) (((x) & 0x00ffffff) >> 0) -#define MAC_PCU_BMISS2_TIMEOUT_VALUE_SET(x) (((x) << 0) & 0x00ffffff) -#define MAC_PCU_BMISS2_TIMEOUT_ENABLE_MSB 24 -#define MAC_PCU_BMISS2_TIMEOUT_ENABLE_LSB 24 -#define MAC_PCU_BMISS2_TIMEOUT_ENABLE_MASK 0x01000000 -#define MAC_PCU_BMISS2_TIMEOUT_ENABLE_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_PCU_BMISS2_TIMEOUT_ENABLE_SET(x) (((x) << 24) & 0x01000000) - -/* macros for RTC_AXI_AHB_BRIDGE */ -#define RTC_AXI_AHB_BRIDGE_ADDRESS 0x0000015c -#define RTC_AXI_AHB_BRIDGE_OFFSET 0x0000015c -#define RTC_AXI_AHB_BRIDGE_MAX_BEATS_MSB 1 -#define RTC_AXI_AHB_BRIDGE_MAX_BEATS_LSB 0 -#define RTC_AXI_AHB_BRIDGE_MAX_BEATS_MASK 0x00000003 -#define RTC_AXI_AHB_BRIDGE_MAX_BEATS_GET(x) (((x) & 0x00000003) >> 0) -#define RTC_AXI_AHB_BRIDGE_MAX_BEATS_SET(x) (((x) << 0) & 0x00000003) - -/* macros for UNIFIED_MAC_REVID */ -#define UNIFIED_MAC_REVID_ADDRESS 0x00000160 -#define UNIFIED_MAC_REVID_OFFSET 0x00000160 -#define UNIFIED_MAC_REVID_VALUE_MSB 31 -#define UNIFIED_MAC_REVID_VALUE_LSB 0 -#define UNIFIED_MAC_REVID_VALUE_MASK 0xffffffff -#define UNIFIED_MAC_REVID_VALUE_GET(x) (((x) & 0xffffffff) >> 0) - - -#ifndef __ASSEMBLER__ - -typedef struct rtc_wlan_reg_reg_s { - volatile unsigned int WLAN_RESET_CONTROL; /* 0x0 - 0x4 */ - volatile unsigned int WLAN_XTAL_CONTROL; /* 0x4 - 0x8 */ - volatile unsigned int WLAN_REG_CONTROL0; /* 0x8 - 0xc */ - volatile unsigned int WLAN_REG_CONTROL1; /* 0xc - 0x10 */ - volatile unsigned int WLAN_QUADRATURE; /* 0x10 - 0x14 */ - volatile unsigned int WLAN_PLL_CONTROL; /* 0x14 - 0x18 */ - volatile unsigned int WLAN_PLL_SETTLE; /* 0x18 - 0x1c */ - volatile unsigned int WLAN_XTAL_SETTLE; /* 0x1c - 0x20 */ - volatile unsigned int WLAN_CLOCK_OUT; /* 0x20 - 0x24 */ - volatile unsigned int WLAN_BIAS_OVERRIDE; /* 0x24 - 0x28 */ - volatile unsigned int WLAN_RESET_CAUSE; /* 0x28 - 0x2c */ - volatile unsigned int WLAN_SYSTEM_SLEEP; /* 0x2c - 0x30 */ - volatile unsigned int WLAN_MAC_SLEEP_CONTROL; /* 0x30 - 0x34 */ - volatile unsigned int WLAN_KEEP_AWAKE; /* 0x34 - 0x38 */ - volatile unsigned int WLAN_DERIVED_RTC_CLK; /* 0x38 - 0x3c */ - volatile unsigned int MAC_PCU_SLP32_MODE; /* 0x3c - 0x40 */ - volatile unsigned int MAC_PCU_SLP32_WAKE; /* 0x40 - 0x44 */ - volatile unsigned int MAC_PCU_SLP32_INC; /* 0x44 - 0x48 */ - volatile unsigned int MAC_PCU_SLP_MIB1; /* 0x48 - 0x4c */ - volatile unsigned int MAC_PCU_SLP_MIB2; /* 0x4c - 0x50 */ - volatile unsigned int MAC_PCU_SLP_MIB3; /* 0x50 - 0x54 */ - volatile unsigned int MAC_PCU_TSF_L32; /* 0x54 - 0x58 */ - volatile unsigned int MAC_PCU_TSF_U32; /* 0x58 - 0x5c */ - volatile unsigned int MAC_PCU_WBTIMER_0; /* 0x5c - 0x60 */ - volatile unsigned int MAC_PCU_WBTIMER_1; /* 0x60 - 0x64 */ - volatile unsigned int MAC_PCU_GENERIC_TIMERS[16]; /* 0x64 - 0xa4 */ - volatile char pad__0[0x18]; /* 0xa4 - 0xbc */ - volatile unsigned int MAC_PCU_GENERIC_TIMERS_MODE; /* 0xbc - 0xc0 */ - volatile unsigned int MAC_PCU_SLP1; /* 0xc0 - 0xc4 */ - volatile unsigned int MAC_PCU_SLP2; /* 0xc4 - 0xc8 */ - volatile unsigned int MAC_PCU_SLP3; /* 0xc8 - 0xcc */ - volatile unsigned int MAC_PCU_SLP4; /* 0xcc - 0xd0 */ - volatile unsigned int MAC_PCU_RESET_TSF; /* 0xd0 - 0xd4 */ - volatile unsigned int MAC_PCU_TSF2_L32; /* 0xd4 - 0xd8 */ - volatile unsigned int MAC_PCU_TSF2_U32; /* 0xd8 - 0xdc */ - volatile unsigned int MAC_PCU_GENERIC_TIMERS2[16]; /* 0xdc - 0x11c */ - volatile char pad__1[0x18]; /* 0x11c - 0x134 */ - volatile unsigned int MAC_PCU_GENERIC_TIMERS_MODE2; /* 0x134 - 0x138 */ - volatile char pad__2[0xc]; /* 0x138 - 0x144 */ - volatile unsigned int MAC_PCU_TSF_THRESHOLD; /* 0x144 - 0x148 */ - volatile unsigned int WLAN_HT; /* 0x148 - 0x14c */ - volatile char pad__3[0x4]; /* 0x14c - 0x150 */ - volatile unsigned int MAC_PCU_GENERIC_TIMERS_TSF_SEL; /* 0x150 - 0x154 */ - volatile unsigned int MAC_PCU_BMISS_TIMEOUT; /* 0x154 - 0x158 */ - volatile unsigned int MAC_PCU_BMISS2_TIMEOUT; /* 0x158 - 0x15c */ - volatile unsigned int RTC_AXI_AHB_BRIDGE; /* 0x15c - 0x160 */ - volatile unsigned int UNIFIED_MAC_REVID; /* 0x160 - 0x164 */ -} rtc_wlan_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _RTC_WLAN_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/si_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/si_reg.h deleted file mode 100644 index b1d07a9062ab..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/si_reg.h +++ /dev/null @@ -1,308 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _SI_REG_REG_H_ -#define _SI_REG_REG_H_ - -#define SI_CONFIG_ADDRESS 0x00000000 -#define SI_CONFIG_OFFSET 0x00000000 -#define SI_CONFIG_ERR_INT_MSB 19 -#define SI_CONFIG_ERR_INT_LSB 19 -#define SI_CONFIG_ERR_INT_MASK 0x00080000 -#define SI_CONFIG_ERR_INT_GET(x) (((x) & SI_CONFIG_ERR_INT_MASK) >> SI_CONFIG_ERR_INT_LSB) -#define SI_CONFIG_ERR_INT_SET(x) (((x) << SI_CONFIG_ERR_INT_LSB) & SI_CONFIG_ERR_INT_MASK) -#define SI_CONFIG_BIDIR_OD_DATA_MSB 18 -#define SI_CONFIG_BIDIR_OD_DATA_LSB 18 -#define SI_CONFIG_BIDIR_OD_DATA_MASK 0x00040000 -#define SI_CONFIG_BIDIR_OD_DATA_GET(x) (((x) & SI_CONFIG_BIDIR_OD_DATA_MASK) >> SI_CONFIG_BIDIR_OD_DATA_LSB) -#define SI_CONFIG_BIDIR_OD_DATA_SET(x) (((x) << SI_CONFIG_BIDIR_OD_DATA_LSB) & SI_CONFIG_BIDIR_OD_DATA_MASK) -#define SI_CONFIG_I2C_MSB 16 -#define SI_CONFIG_I2C_LSB 16 -#define SI_CONFIG_I2C_MASK 0x00010000 -#define SI_CONFIG_I2C_GET(x) (((x) & SI_CONFIG_I2C_MASK) >> SI_CONFIG_I2C_LSB) -#define SI_CONFIG_I2C_SET(x) (((x) << SI_CONFIG_I2C_LSB) & SI_CONFIG_I2C_MASK) -#define SI_CONFIG_POS_SAMPLE_MSB 7 -#define SI_CONFIG_POS_SAMPLE_LSB 7 -#define SI_CONFIG_POS_SAMPLE_MASK 0x00000080 -#define SI_CONFIG_POS_SAMPLE_GET(x) (((x) & SI_CONFIG_POS_SAMPLE_MASK) >> SI_CONFIG_POS_SAMPLE_LSB) -#define SI_CONFIG_POS_SAMPLE_SET(x) (((x) << SI_CONFIG_POS_SAMPLE_LSB) & SI_CONFIG_POS_SAMPLE_MASK) -#define SI_CONFIG_POS_DRIVE_MSB 6 -#define SI_CONFIG_POS_DRIVE_LSB 6 -#define SI_CONFIG_POS_DRIVE_MASK 0x00000040 -#define SI_CONFIG_POS_DRIVE_GET(x) (((x) & SI_CONFIG_POS_DRIVE_MASK) >> SI_CONFIG_POS_DRIVE_LSB) -#define SI_CONFIG_POS_DRIVE_SET(x) (((x) << SI_CONFIG_POS_DRIVE_LSB) & SI_CONFIG_POS_DRIVE_MASK) -#define SI_CONFIG_INACTIVE_DATA_MSB 5 -#define SI_CONFIG_INACTIVE_DATA_LSB 5 -#define SI_CONFIG_INACTIVE_DATA_MASK 0x00000020 -#define SI_CONFIG_INACTIVE_DATA_GET(x) (((x) & SI_CONFIG_INACTIVE_DATA_MASK) >> SI_CONFIG_INACTIVE_DATA_LSB) -#define SI_CONFIG_INACTIVE_DATA_SET(x) (((x) << SI_CONFIG_INACTIVE_DATA_LSB) & SI_CONFIG_INACTIVE_DATA_MASK) -#define SI_CONFIG_INACTIVE_CLK_MSB 4 -#define SI_CONFIG_INACTIVE_CLK_LSB 4 -#define SI_CONFIG_INACTIVE_CLK_MASK 0x00000010 -#define SI_CONFIG_INACTIVE_CLK_GET(x) (((x) & SI_CONFIG_INACTIVE_CLK_MASK) >> SI_CONFIG_INACTIVE_CLK_LSB) -#define SI_CONFIG_INACTIVE_CLK_SET(x) (((x) << SI_CONFIG_INACTIVE_CLK_LSB) & SI_CONFIG_INACTIVE_CLK_MASK) -#define SI_CONFIG_DIVIDER_MSB 3 -#define SI_CONFIG_DIVIDER_LSB 0 -#define SI_CONFIG_DIVIDER_MASK 0x0000000f -#define SI_CONFIG_DIVIDER_GET(x) (((x) & SI_CONFIG_DIVIDER_MASK) >> SI_CONFIG_DIVIDER_LSB) -#define SI_CONFIG_DIVIDER_SET(x) (((x) << SI_CONFIG_DIVIDER_LSB) & SI_CONFIG_DIVIDER_MASK) - -#define SI_CS_ADDRESS 0x00000004 -#define SI_CS_OFFSET 0x00000004 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_MSB 13 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_LSB 11 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_MASK 0x00003800 -#define SI_CS_BIT_CNT_IN_LAST_BYTE_GET(x) (((x) & SI_CS_BIT_CNT_IN_LAST_BYTE_MASK) >> SI_CS_BIT_CNT_IN_LAST_BYTE_LSB) -#define SI_CS_BIT_CNT_IN_LAST_BYTE_SET(x) (((x) << SI_CS_BIT_CNT_IN_LAST_BYTE_LSB) & SI_CS_BIT_CNT_IN_LAST_BYTE_MASK) -#define SI_CS_DONE_ERR_MSB 10 -#define SI_CS_DONE_ERR_LSB 10 -#define SI_CS_DONE_ERR_MASK 0x00000400 -#define SI_CS_DONE_ERR_GET(x) (((x) & SI_CS_DONE_ERR_MASK) >> SI_CS_DONE_ERR_LSB) -#define SI_CS_DONE_ERR_SET(x) (((x) << SI_CS_DONE_ERR_LSB) & SI_CS_DONE_ERR_MASK) -#define SI_CS_DONE_INT_MSB 9 -#define SI_CS_DONE_INT_LSB 9 -#define SI_CS_DONE_INT_MASK 0x00000200 -#define SI_CS_DONE_INT_GET(x) (((x) & SI_CS_DONE_INT_MASK) >> SI_CS_DONE_INT_LSB) -#define SI_CS_DONE_INT_SET(x) (((x) << SI_CS_DONE_INT_LSB) & SI_CS_DONE_INT_MASK) -#define SI_CS_START_MSB 8 -#define SI_CS_START_LSB 8 -#define SI_CS_START_MASK 0x00000100 -#define SI_CS_START_GET(x) (((x) & SI_CS_START_MASK) >> SI_CS_START_LSB) -#define SI_CS_START_SET(x) (((x) << SI_CS_START_LSB) & SI_CS_START_MASK) -#define SI_CS_RX_CNT_MSB 7 -#define SI_CS_RX_CNT_LSB 4 -#define SI_CS_RX_CNT_MASK 0x000000f0 -#define SI_CS_RX_CNT_GET(x) (((x) & SI_CS_RX_CNT_MASK) >> SI_CS_RX_CNT_LSB) -#define SI_CS_RX_CNT_SET(x) (((x) << SI_CS_RX_CNT_LSB) & SI_CS_RX_CNT_MASK) -#define SI_CS_TX_CNT_MSB 3 -#define SI_CS_TX_CNT_LSB 0 -#define SI_CS_TX_CNT_MASK 0x0000000f -#define SI_CS_TX_CNT_GET(x) (((x) & SI_CS_TX_CNT_MASK) >> SI_CS_TX_CNT_LSB) -#define SI_CS_TX_CNT_SET(x) (((x) << SI_CS_TX_CNT_LSB) & SI_CS_TX_CNT_MASK) - -#define SI_TX_DATA0_ADDRESS 0x00000008 -#define SI_TX_DATA0_OFFSET 0x00000008 -#define SI_TX_DATA0_DATA3_MSB 31 -#define SI_TX_DATA0_DATA3_LSB 24 -#define SI_TX_DATA0_DATA3_MASK 0xff000000 -#define SI_TX_DATA0_DATA3_GET(x) (((x) & SI_TX_DATA0_DATA3_MASK) >> SI_TX_DATA0_DATA3_LSB) -#define SI_TX_DATA0_DATA3_SET(x) (((x) << SI_TX_DATA0_DATA3_LSB) & SI_TX_DATA0_DATA3_MASK) -#define SI_TX_DATA0_DATA2_MSB 23 -#define SI_TX_DATA0_DATA2_LSB 16 -#define SI_TX_DATA0_DATA2_MASK 0x00ff0000 -#define SI_TX_DATA0_DATA2_GET(x) (((x) & SI_TX_DATA0_DATA2_MASK) >> SI_TX_DATA0_DATA2_LSB) -#define SI_TX_DATA0_DATA2_SET(x) (((x) << SI_TX_DATA0_DATA2_LSB) & SI_TX_DATA0_DATA2_MASK) -#define SI_TX_DATA0_DATA1_MSB 15 -#define SI_TX_DATA0_DATA1_LSB 8 -#define SI_TX_DATA0_DATA1_MASK 0x0000ff00 -#define SI_TX_DATA0_DATA1_GET(x) (((x) & SI_TX_DATA0_DATA1_MASK) >> SI_TX_DATA0_DATA1_LSB) -#define SI_TX_DATA0_DATA1_SET(x) (((x) << SI_TX_DATA0_DATA1_LSB) & SI_TX_DATA0_DATA1_MASK) -#define SI_TX_DATA0_DATA0_MSB 7 -#define SI_TX_DATA0_DATA0_LSB 0 -#define SI_TX_DATA0_DATA0_MASK 0x000000ff -#define SI_TX_DATA0_DATA0_GET(x) (((x) & SI_TX_DATA0_DATA0_MASK) >> SI_TX_DATA0_DATA0_LSB) -#define SI_TX_DATA0_DATA0_SET(x) (((x) << SI_TX_DATA0_DATA0_LSB) & SI_TX_DATA0_DATA0_MASK) - -#define SI_TX_DATA1_ADDRESS 0x0000000c -#define SI_TX_DATA1_OFFSET 0x0000000c -#define SI_TX_DATA1_DATA7_MSB 31 -#define SI_TX_DATA1_DATA7_LSB 24 -#define SI_TX_DATA1_DATA7_MASK 0xff000000 -#define SI_TX_DATA1_DATA7_GET(x) (((x) & SI_TX_DATA1_DATA7_MASK) >> SI_TX_DATA1_DATA7_LSB) -#define SI_TX_DATA1_DATA7_SET(x) (((x) << SI_TX_DATA1_DATA7_LSB) & SI_TX_DATA1_DATA7_MASK) -#define SI_TX_DATA1_DATA6_MSB 23 -#define SI_TX_DATA1_DATA6_LSB 16 -#define SI_TX_DATA1_DATA6_MASK 0x00ff0000 -#define SI_TX_DATA1_DATA6_GET(x) (((x) & SI_TX_DATA1_DATA6_MASK) >> SI_TX_DATA1_DATA6_LSB) -#define SI_TX_DATA1_DATA6_SET(x) (((x) << SI_TX_DATA1_DATA6_LSB) & SI_TX_DATA1_DATA6_MASK) -#define SI_TX_DATA1_DATA5_MSB 15 -#define SI_TX_DATA1_DATA5_LSB 8 -#define SI_TX_DATA1_DATA5_MASK 0x0000ff00 -#define SI_TX_DATA1_DATA5_GET(x) (((x) & SI_TX_DATA1_DATA5_MASK) >> SI_TX_DATA1_DATA5_LSB) -#define SI_TX_DATA1_DATA5_SET(x) (((x) << SI_TX_DATA1_DATA5_LSB) & SI_TX_DATA1_DATA5_MASK) -#define SI_TX_DATA1_DATA4_MSB 7 -#define SI_TX_DATA1_DATA4_LSB 0 -#define SI_TX_DATA1_DATA4_MASK 0x000000ff -#define SI_TX_DATA1_DATA4_GET(x) (((x) & SI_TX_DATA1_DATA4_MASK) >> SI_TX_DATA1_DATA4_LSB) -#define SI_TX_DATA1_DATA4_SET(x) (((x) << SI_TX_DATA1_DATA4_LSB) & SI_TX_DATA1_DATA4_MASK) - -#define SI_RX_DATA0_ADDRESS 0x00000010 -#define SI_RX_DATA0_OFFSET 0x00000010 -#define SI_RX_DATA0_DATA3_MSB 31 -#define SI_RX_DATA0_DATA3_LSB 24 -#define SI_RX_DATA0_DATA3_MASK 0xff000000 -#define SI_RX_DATA0_DATA3_GET(x) (((x) & SI_RX_DATA0_DATA3_MASK) >> SI_RX_DATA0_DATA3_LSB) -#define SI_RX_DATA0_DATA3_SET(x) (((x) << SI_RX_DATA0_DATA3_LSB) & SI_RX_DATA0_DATA3_MASK) -#define SI_RX_DATA0_DATA2_MSB 23 -#define SI_RX_DATA0_DATA2_LSB 16 -#define SI_RX_DATA0_DATA2_MASK 0x00ff0000 -#define SI_RX_DATA0_DATA2_GET(x) (((x) & SI_RX_DATA0_DATA2_MASK) >> SI_RX_DATA0_DATA2_LSB) -#define SI_RX_DATA0_DATA2_SET(x) (((x) << SI_RX_DATA0_DATA2_LSB) & SI_RX_DATA0_DATA2_MASK) -#define SI_RX_DATA0_DATA1_MSB 15 -#define SI_RX_DATA0_DATA1_LSB 8 -#define SI_RX_DATA0_DATA1_MASK 0x0000ff00 -#define SI_RX_DATA0_DATA1_GET(x) (((x) & SI_RX_DATA0_DATA1_MASK) >> SI_RX_DATA0_DATA1_LSB) -#define SI_RX_DATA0_DATA1_SET(x) (((x) << SI_RX_DATA0_DATA1_LSB) & SI_RX_DATA0_DATA1_MASK) -#define SI_RX_DATA0_DATA0_MSB 7 -#define SI_RX_DATA0_DATA0_LSB 0 -#define SI_RX_DATA0_DATA0_MASK 0x000000ff -#define SI_RX_DATA0_DATA0_GET(x) (((x) & SI_RX_DATA0_DATA0_MASK) >> SI_RX_DATA0_DATA0_LSB) -#define SI_RX_DATA0_DATA0_SET(x) (((x) << SI_RX_DATA0_DATA0_LSB) & SI_RX_DATA0_DATA0_MASK) - -#define SI_RX_DATA1_ADDRESS 0x00000014 -#define SI_RX_DATA1_OFFSET 0x00000014 -#define SI_RX_DATA1_DATA7_MSB 31 -#define SI_RX_DATA1_DATA7_LSB 24 -#define SI_RX_DATA1_DATA7_MASK 0xff000000 -#define SI_RX_DATA1_DATA7_GET(x) (((x) & SI_RX_DATA1_DATA7_MASK) >> SI_RX_DATA1_DATA7_LSB) -#define SI_RX_DATA1_DATA7_SET(x) (((x) << SI_RX_DATA1_DATA7_LSB) & SI_RX_DATA1_DATA7_MASK) -#define SI_RX_DATA1_DATA6_MSB 23 -#define SI_RX_DATA1_DATA6_LSB 16 -#define SI_RX_DATA1_DATA6_MASK 0x00ff0000 -#define SI_RX_DATA1_DATA6_GET(x) (((x) & SI_RX_DATA1_DATA6_MASK) >> SI_RX_DATA1_DATA6_LSB) -#define SI_RX_DATA1_DATA6_SET(x) (((x) << SI_RX_DATA1_DATA6_LSB) & SI_RX_DATA1_DATA6_MASK) -#define SI_RX_DATA1_DATA5_MSB 15 -#define SI_RX_DATA1_DATA5_LSB 8 -#define SI_RX_DATA1_DATA5_MASK 0x0000ff00 -#define SI_RX_DATA1_DATA5_GET(x) (((x) & SI_RX_DATA1_DATA5_MASK) >> SI_RX_DATA1_DATA5_LSB) -#define SI_RX_DATA1_DATA5_SET(x) (((x) << SI_RX_DATA1_DATA5_LSB) & SI_RX_DATA1_DATA5_MASK) -#define SI_RX_DATA1_DATA4_MSB 7 -#define SI_RX_DATA1_DATA4_LSB 0 -#define SI_RX_DATA1_DATA4_MASK 0x000000ff -#define SI_RX_DATA1_DATA4_GET(x) (((x) & SI_RX_DATA1_DATA4_MASK) >> SI_RX_DATA1_DATA4_LSB) -#define SI_RX_DATA1_DATA4_SET(x) (((x) << SI_RX_DATA1_DATA4_LSB) & SI_RX_DATA1_DATA4_MASK) - -#define WLAN_APB_ADDR_ERROR_CONTROL_ADDRESS 0x00000018 -#define WLAN_APB_ADDR_ERROR_CONTROL_OFFSET 0x00000018 -#define WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_MSB 1 -#define WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB 1 -#define WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK 0x00000002 -#define WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_GET(x) (((x) & WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK) >> WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB) -#define WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_SET(x) (((x) << WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_LSB) & WLAN_APB_ADDR_ERROR_CONTROL_QUAL_ENABLE_MASK) -#define WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_MSB 0 -#define WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_LSB 0 -#define WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_MASK 0x00000001 -#define WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_GET(x) (((x) & WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_MASK) >> WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_LSB) -#define WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_SET(x) (((x) << WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_LSB) & WLAN_APB_ADDR_ERROR_CONTROL_ENABLE_MASK) - -#define WLAN_APB_ADDR_ERROR_STATUS_ADDRESS 0x0000001c -#define WLAN_APB_ADDR_ERROR_STATUS_OFFSET 0x0000001c -#define WLAN_APB_ADDR_ERROR_STATUS_WRITE_MSB 25 -#define WLAN_APB_ADDR_ERROR_STATUS_WRITE_LSB 25 -#define WLAN_APB_ADDR_ERROR_STATUS_WRITE_MASK 0x02000000 -#define WLAN_APB_ADDR_ERROR_STATUS_WRITE_GET(x) (((x) & WLAN_APB_ADDR_ERROR_STATUS_WRITE_MASK) >> WLAN_APB_ADDR_ERROR_STATUS_WRITE_LSB) -#define WLAN_APB_ADDR_ERROR_STATUS_WRITE_SET(x) (((x) << WLAN_APB_ADDR_ERROR_STATUS_WRITE_LSB) & WLAN_APB_ADDR_ERROR_STATUS_WRITE_MASK) -#define WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_MSB 24 -#define WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_LSB 0 -#define WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_MASK 0x01ffffff -#define WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_GET(x) (((x) & WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_MASK) >> WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_LSB) -#define WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_SET(x) (((x) << WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_LSB) & WLAN_APB_ADDR_ERROR_STATUS_ADDRESS_MASK) - -#define WLAN_AHB_ADDR_ERROR_CONTROL_ADDRESS 0x00000020 -#define WLAN_AHB_ADDR_ERROR_CONTROL_OFFSET 0x00000020 -#define WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_MSB 0 -#define WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_LSB 0 -#define WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_MASK 0x00000001 -#define WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_GET(x) (((x) & WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_MASK) >> WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_LSB) -#define WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_SET(x) (((x) << WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_LSB) & WLAN_AHB_ADDR_ERROR_CONTROL_ENABLE_MASK) - -#define WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS 0x00000024 -#define WLAN_AHB_ADDR_ERROR_STATUS_OFFSET 0x00000024 -#define WLAN_AHB_ADDR_ERROR_STATUS_MAC_MSB 31 -#define WLAN_AHB_ADDR_ERROR_STATUS_MAC_LSB 31 -#define WLAN_AHB_ADDR_ERROR_STATUS_MAC_MASK 0x80000000 -#define WLAN_AHB_ADDR_ERROR_STATUS_MAC_GET(x) (((x) & WLAN_AHB_ADDR_ERROR_STATUS_MAC_MASK) >> WLAN_AHB_ADDR_ERROR_STATUS_MAC_LSB) -#define WLAN_AHB_ADDR_ERROR_STATUS_MAC_SET(x) (((x) << WLAN_AHB_ADDR_ERROR_STATUS_MAC_LSB) & WLAN_AHB_ADDR_ERROR_STATUS_MAC_MASK) -#define WLAN_AHB_ADDR_ERROR_STATUS_MBOX_MSB 30 -#define WLAN_AHB_ADDR_ERROR_STATUS_MBOX_LSB 30 -#define WLAN_AHB_ADDR_ERROR_STATUS_MBOX_MASK 0x40000000 -#define WLAN_AHB_ADDR_ERROR_STATUS_MBOX_GET(x) (((x) & WLAN_AHB_ADDR_ERROR_STATUS_MBOX_MASK) >> WLAN_AHB_ADDR_ERROR_STATUS_MBOX_LSB) -#define WLAN_AHB_ADDR_ERROR_STATUS_MBOX_SET(x) (((x) << WLAN_AHB_ADDR_ERROR_STATUS_MBOX_LSB) & WLAN_AHB_ADDR_ERROR_STATUS_MBOX_MASK) -#define WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_MSB 23 -#define WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_LSB 0 -#define WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_MASK 0x00ffffff -#define WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_GET(x) (((x) & WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_MASK) >> WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_LSB) -#define WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_SET(x) (((x) << WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_LSB) & WLAN_AHB_ADDR_ERROR_STATUS_ADDRESS_MASK) - -#define WLAN_AHB_CONFIG_ADDRESS 0x00000028 -#define WLAN_AHB_CONFIG_OFFSET 0x00000028 -#define WLAN_AHB_CONFIG_MAX_BURST_16_MSB 2 -#define WLAN_AHB_CONFIG_MAX_BURST_16_LSB 2 -#define WLAN_AHB_CONFIG_MAX_BURST_16_MASK 0x00000004 -#define WLAN_AHB_CONFIG_MAX_BURST_16_GET(x) (((x) & WLAN_AHB_CONFIG_MAX_BURST_16_MASK) >> WLAN_AHB_CONFIG_MAX_BURST_16_LSB) -#define WLAN_AHB_CONFIG_MAX_BURST_16_SET(x) (((x) << WLAN_AHB_CONFIG_MAX_BURST_16_LSB) & WLAN_AHB_CONFIG_MAX_BURST_16_MASK) -#define WLAN_AHB_CONFIG_MAX_BURST_8_MSB 1 -#define WLAN_AHB_CONFIG_MAX_BURST_8_LSB 1 -#define WLAN_AHB_CONFIG_MAX_BURST_8_MASK 0x00000002 -#define WLAN_AHB_CONFIG_MAX_BURST_8_GET(x) (((x) & WLAN_AHB_CONFIG_MAX_BURST_8_MASK) >> WLAN_AHB_CONFIG_MAX_BURST_8_LSB) -#define WLAN_AHB_CONFIG_MAX_BURST_8_SET(x) (((x) << WLAN_AHB_CONFIG_MAX_BURST_8_LSB) & WLAN_AHB_CONFIG_MAX_BURST_8_MASK) -#define WLAN_AHB_CONFIG_MAX_BURST_4_MSB 0 -#define WLAN_AHB_CONFIG_MAX_BURST_4_LSB 0 -#define WLAN_AHB_CONFIG_MAX_BURST_4_MASK 0x00000001 -#define WLAN_AHB_CONFIG_MAX_BURST_4_GET(x) (((x) & WLAN_AHB_CONFIG_MAX_BURST_4_MASK) >> WLAN_AHB_CONFIG_MAX_BURST_4_LSB) -#define WLAN_AHB_CONFIG_MAX_BURST_4_SET(x) (((x) << WLAN_AHB_CONFIG_MAX_BURST_4_LSB) & WLAN_AHB_CONFIG_MAX_BURST_4_MASK) - -#define WLAN_MEMORY_MAP_ADDRESS 0x0000002c -#define WLAN_MEMORY_MAP_OFFSET 0x0000002c -#define WLAN_MEMORY_MAP_FOUR_IRAM_BANKS_MSB 3 -#define WLAN_MEMORY_MAP_FOUR_IRAM_BANKS_LSB 3 -#define WLAN_MEMORY_MAP_FOUR_IRAM_BANKS_MASK 0x00000008 -#define WLAN_MEMORY_MAP_FOUR_IRAM_BANKS_GET(x) (((x) & WLAN_MEMORY_MAP_FOUR_IRAM_BANKS_MASK) >> WLAN_MEMORY_MAP_FOUR_IRAM_BANKS_LSB) -#define WLAN_MEMORY_MAP_FOUR_IRAM_BANKS_SET(x) (((x) << WLAN_MEMORY_MAP_FOUR_IRAM_BANKS_LSB) & WLAN_MEMORY_MAP_FOUR_IRAM_BANKS_MASK) -#define WLAN_MEMORY_MAP_THREE_IRAM_BANKS_MSB 2 -#define WLAN_MEMORY_MAP_THREE_IRAM_BANKS_LSB 2 -#define WLAN_MEMORY_MAP_THREE_IRAM_BANKS_MASK 0x00000004 -#define WLAN_MEMORY_MAP_THREE_IRAM_BANKS_GET(x) (((x) & WLAN_MEMORY_MAP_THREE_IRAM_BANKS_MASK) >> WLAN_MEMORY_MAP_THREE_IRAM_BANKS_LSB) -#define WLAN_MEMORY_MAP_THREE_IRAM_BANKS_SET(x) (((x) << WLAN_MEMORY_MAP_THREE_IRAM_BANKS_LSB) & WLAN_MEMORY_MAP_THREE_IRAM_BANKS_MASK) -#define WLAN_MEMORY_MAP_TWO_IRAM_BANKS_MSB 1 -#define WLAN_MEMORY_MAP_TWO_IRAM_BANKS_LSB 1 -#define WLAN_MEMORY_MAP_TWO_IRAM_BANKS_MASK 0x00000002 -#define WLAN_MEMORY_MAP_TWO_IRAM_BANKS_GET(x) (((x) & WLAN_MEMORY_MAP_TWO_IRAM_BANKS_MASK) >> WLAN_MEMORY_MAP_TWO_IRAM_BANKS_LSB) -#define WLAN_MEMORY_MAP_TWO_IRAM_BANKS_SET(x) (((x) << WLAN_MEMORY_MAP_TWO_IRAM_BANKS_LSB) & WLAN_MEMORY_MAP_TWO_IRAM_BANKS_MASK) -#define WLAN_MEMORY_MAP_ONE_IRAM_BANK_MSB 0 -#define WLAN_MEMORY_MAP_ONE_IRAM_BANK_LSB 0 -#define WLAN_MEMORY_MAP_ONE_IRAM_BANK_MASK 0x00000001 -#define WLAN_MEMORY_MAP_ONE_IRAM_BANK_GET(x) (((x) & WLAN_MEMORY_MAP_ONE_IRAM_BANK_MASK) >> WLAN_MEMORY_MAP_ONE_IRAM_BANK_LSB) -#define WLAN_MEMORY_MAP_ONE_IRAM_BANK_SET(x) (((x) << WLAN_MEMORY_MAP_ONE_IRAM_BANK_LSB) & WLAN_MEMORY_MAP_ONE_IRAM_BANK_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct si_reg_reg_s { - volatile unsigned int si_config; - volatile unsigned int si_cs; - volatile unsigned int si_tx_data0; - volatile unsigned int si_tx_data1; - volatile unsigned int si_rx_data0; - volatile unsigned int si_rx_data1; - volatile unsigned int wlan_apb_addr_error_control; - volatile unsigned int wlan_apb_addr_error_status; - volatile unsigned int wlan_ahb_addr_error_control; - volatile unsigned int wlan_ahb_addr_error_status; - volatile unsigned int wlan_ahb_config; - volatile unsigned int wlan_memory_map; -} si_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _SI_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/stereo_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/stereo_reg.h deleted file mode 100644 index 5277db5a24c8..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/stereo_reg.h +++ /dev/null @@ -1,204 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _STEREO_REG_REG_H_ -#define _STEREO_REG_REG_H_ - - -/* macros for STEREO0_CONFIG */ -#define STEREO0_CONFIG_ADDRESS 0x00000000 -#define STEREO0_CONFIG_OFFSET 0x00000000 -#define STEREO0_CONFIG_POSEDGE_MSB 7 -#define STEREO0_CONFIG_POSEDGE_LSB 0 -#define STEREO0_CONFIG_POSEDGE_MASK 0x000000ff -#define STEREO0_CONFIG_POSEDGE_GET(x) (((x) & 0x000000ff) >> 0) -#define STEREO0_CONFIG_POSEDGE_SET(x) (((x) << 0) & 0x000000ff) -#define STEREO0_CONFIG_MASTER_MSB 8 -#define STEREO0_CONFIG_MASTER_LSB 8 -#define STEREO0_CONFIG_MASTER_MASK 0x00000100 -#define STEREO0_CONFIG_MASTER_GET(x) (((x) & 0x00000100) >> 8) -#define STEREO0_CONFIG_MASTER_SET(x) (((x) << 8) & 0x00000100) -#define STEREO0_CONFIG_SAMPLE_CNT_CLEAR_TYPE_MSB 9 -#define STEREO0_CONFIG_SAMPLE_CNT_CLEAR_TYPE_LSB 9 -#define STEREO0_CONFIG_SAMPLE_CNT_CLEAR_TYPE_MASK 0x00000200 -#define STEREO0_CONFIG_SAMPLE_CNT_CLEAR_TYPE_GET(x) (((x) & 0x00000200) >> 9) -#define STEREO0_CONFIG_SAMPLE_CNT_CLEAR_TYPE_SET(x) (((x) << 9) & 0x00000200) -#define STEREO0_CONFIG_MCK_SEL_MSB 10 -#define STEREO0_CONFIG_MCK_SEL_LSB 10 -#define STEREO0_CONFIG_MCK_SEL_MASK 0x00000400 -#define STEREO0_CONFIG_MCK_SEL_GET(x) (((x) & 0x00000400) >> 10) -#define STEREO0_CONFIG_MCK_SEL_SET(x) (((x) << 10) & 0x00000400) -#define STEREO0_CONFIG_I2S_WORD_SIZE_MSB 11 -#define STEREO0_CONFIG_I2S_WORD_SIZE_LSB 11 -#define STEREO0_CONFIG_I2S_WORD_SIZE_MASK 0x00000800 -#define STEREO0_CONFIG_I2S_WORD_SIZE_GET(x) (((x) & 0x00000800) >> 11) -#define STEREO0_CONFIG_I2S_WORD_SIZE_SET(x) (((x) << 11) & 0x00000800) -#define STEREO0_CONFIG_DATA_WORD_SIZE_MSB 13 -#define STEREO0_CONFIG_DATA_WORD_SIZE_LSB 12 -#define STEREO0_CONFIG_DATA_WORD_SIZE_MASK 0x00003000 -#define STEREO0_CONFIG_DATA_WORD_SIZE_GET(x) (((x) & 0x00003000) >> 12) -#define STEREO0_CONFIG_DATA_WORD_SIZE_SET(x) (((x) << 12) & 0x00003000) -#define STEREO0_CONFIG_STEREO_MONO_MSB 15 -#define STEREO0_CONFIG_STEREO_MONO_LSB 14 -#define STEREO0_CONFIG_STEREO_MONO_MASK 0x0000c000 -#define STEREO0_CONFIG_STEREO_MONO_GET(x) (((x) & 0x0000c000) >> 14) -#define STEREO0_CONFIG_STEREO_MONO_SET(x) (((x) << 14) & 0x0000c000) -#define STEREO0_CONFIG_MIC_WORD_SIZE_MSB 16 -#define STEREO0_CONFIG_MIC_WORD_SIZE_LSB 16 -#define STEREO0_CONFIG_MIC_WORD_SIZE_MASK 0x00010000 -#define STEREO0_CONFIG_MIC_WORD_SIZE_GET(x) (((x) & 0x00010000) >> 16) -#define STEREO0_CONFIG_MIC_WORD_SIZE_SET(x) (((x) << 16) & 0x00010000) -#define STEREO0_CONFIG_PCM_SWAP_MSB 17 -#define STEREO0_CONFIG_PCM_SWAP_LSB 17 -#define STEREO0_CONFIG_PCM_SWAP_MASK 0x00020000 -#define STEREO0_CONFIG_PCM_SWAP_GET(x) (((x) & 0x00020000) >> 17) -#define STEREO0_CONFIG_PCM_SWAP_SET(x) (((x) << 17) & 0x00020000) -#define STEREO0_CONFIG_I2S_DELAY_MSB 18 -#define STEREO0_CONFIG_I2S_DELAY_LSB 18 -#define STEREO0_CONFIG_I2S_DELAY_MASK 0x00040000 -#define STEREO0_CONFIG_I2S_DELAY_GET(x) (((x) & 0x00040000) >> 18) -#define STEREO0_CONFIG_I2S_DELAY_SET(x) (((x) << 18) & 0x00040000) -#define STEREO0_CONFIG_RESET_MSB 19 -#define STEREO0_CONFIG_RESET_LSB 19 -#define STEREO0_CONFIG_RESET_MASK 0x00080000 -#define STEREO0_CONFIG_RESET_GET(x) (((x) & 0x00080000) >> 19) -#define STEREO0_CONFIG_RESET_SET(x) (((x) << 19) & 0x00080000) -#define STEREO0_CONFIG_MIC_RESET_MSB 20 -#define STEREO0_CONFIG_MIC_RESET_LSB 20 -#define STEREO0_CONFIG_MIC_RESET_MASK 0x00100000 -#define STEREO0_CONFIG_MIC_RESET_GET(x) (((x) & 0x00100000) >> 20) -#define STEREO0_CONFIG_MIC_RESET_SET(x) (((x) << 20) & 0x00100000) -#define STEREO0_CONFIG_ENABLE_MSB 21 -#define STEREO0_CONFIG_ENABLE_LSB 21 -#define STEREO0_CONFIG_ENABLE_MASK 0x00200000 -#define STEREO0_CONFIG_ENABLE_GET(x) (((x) & 0x00200000) >> 21) -#define STEREO0_CONFIG_ENABLE_SET(x) (((x) << 21) & 0x00200000) -#define STEREO0_CONFIG_REFCLK_SEL_MSB 22 -#define STEREO0_CONFIG_REFCLK_SEL_LSB 22 -#define STEREO0_CONFIG_REFCLK_SEL_MASK 0x00400000 -#define STEREO0_CONFIG_REFCLK_SEL_GET(x) (((x) & 0x00400000) >> 22) -#define STEREO0_CONFIG_REFCLK_SEL_SET(x) (((x) << 22) & 0x00400000) -#define STEREO0_CONFIG_SPDIF_ENABLE_MSB 23 -#define STEREO0_CONFIG_SPDIF_ENABLE_LSB 23 -#define STEREO0_CONFIG_SPDIF_ENABLE_MASK 0x00800000 -#define STEREO0_CONFIG_SPDIF_ENABLE_GET(x) (((x) & 0x00800000) >> 23) -#define STEREO0_CONFIG_SPDIF_ENABLE_SET(x) (((x) << 23) & 0x00800000) - -/* macros for STEREO0_VOLUME */ -#define STEREO0_VOLUME_ADDRESS 0x00000004 -#define STEREO0_VOLUME_OFFSET 0x00000004 -#define STEREO0_VOLUME_CHANNEL0_MSB 4 -#define STEREO0_VOLUME_CHANNEL0_LSB 0 -#define STEREO0_VOLUME_CHANNEL0_MASK 0x0000001f -#define STEREO0_VOLUME_CHANNEL0_GET(x) (((x) & 0x0000001f) >> 0) -#define STEREO0_VOLUME_CHANNEL0_SET(x) (((x) << 0) & 0x0000001f) -#define STEREO0_VOLUME_CHANNEL1_MSB 12 -#define STEREO0_VOLUME_CHANNEL1_LSB 8 -#define STEREO0_VOLUME_CHANNEL1_MASK 0x00001f00 -#define STEREO0_VOLUME_CHANNEL1_GET(x) (((x) & 0x00001f00) >> 8) -#define STEREO0_VOLUME_CHANNEL1_SET(x) (((x) << 8) & 0x00001f00) - -/* macros for STEREO_MASTER_CLOCK */ -#define STEREO_MASTER_CLOCK_ADDRESS 0x00000008 -#define STEREO_MASTER_CLOCK_OFFSET 0x00000008 -#define STEREO_MASTER_CLOCK_MCK_SEL_MSB 0 -#define STEREO_MASTER_CLOCK_MCK_SEL_LSB 0 -#define STEREO_MASTER_CLOCK_MCK_SEL_MASK 0x00000001 -#define STEREO_MASTER_CLOCK_MCK_SEL_GET(x) (((x) & 0x00000001) >> 0) -#define STEREO_MASTER_CLOCK_MCK_SEL_SET(x) (((x) << 0) & 0x00000001) - -/* macros for STEREO0_TX_SAMPLE_CNT_LSB */ -#define STEREO0_TX_SAMPLE_CNT_LSB_ADDRESS 0x0000000c -#define STEREO0_TX_SAMPLE_CNT_LSB_OFFSET 0x0000000c -#define STEREO0_TX_SAMPLE_CNT_LSB_CH0_MSB 15 -#define STEREO0_TX_SAMPLE_CNT_LSB_CH0_LSB 0 -#define STEREO0_TX_SAMPLE_CNT_LSB_CH0_MASK 0x0000ffff -#define STEREO0_TX_SAMPLE_CNT_LSB_CH0_GET(x) (((x) & 0x0000ffff) >> 0) -#define STEREO0_TX_SAMPLE_CNT_LSB_CH0_SET(x) (((x) << 0) & 0x0000ffff) -#define STEREO0_TX_SAMPLE_CNT_LSB_CH1_MSB 31 -#define STEREO0_TX_SAMPLE_CNT_LSB_CH1_LSB 16 -#define STEREO0_TX_SAMPLE_CNT_LSB_CH1_MASK 0xffff0000 -#define STEREO0_TX_SAMPLE_CNT_LSB_CH1_GET(x) (((x) & 0xffff0000) >> 16) -#define STEREO0_TX_SAMPLE_CNT_LSB_CH1_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for STEREO0_TX_SAMPLE_CNT_MSB */ -#define STEREO0_TX_SAMPLE_CNT_MSB_ADDRESS 0x00000010 -#define STEREO0_TX_SAMPLE_CNT_MSB_OFFSET 0x00000010 -#define STEREO0_TX_SAMPLE_CNT_MSB_CH0_MSB 15 -#define STEREO0_TX_SAMPLE_CNT_MSB_CH0_LSB 0 -#define STEREO0_TX_SAMPLE_CNT_MSB_CH0_MASK 0x0000ffff -#define STEREO0_TX_SAMPLE_CNT_MSB_CH0_GET(x) (((x) & 0x0000ffff) >> 0) -#define STEREO0_TX_SAMPLE_CNT_MSB_CH0_SET(x) (((x) << 0) & 0x0000ffff) -#define STEREO0_TX_SAMPLE_CNT_MSB_CH1_MSB 31 -#define STEREO0_TX_SAMPLE_CNT_MSB_CH1_LSB 16 -#define STEREO0_TX_SAMPLE_CNT_MSB_CH1_MASK 0xffff0000 -#define STEREO0_TX_SAMPLE_CNT_MSB_CH1_GET(x) (((x) & 0xffff0000) >> 16) -#define STEREO0_TX_SAMPLE_CNT_MSB_CH1_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for STEREO0_RX_SAMPLE_CNT_LSB */ -#define STEREO0_RX_SAMPLE_CNT_LSB_ADDRESS 0x00000014 -#define STEREO0_RX_SAMPLE_CNT_LSB_OFFSET 0x00000014 -#define STEREO0_RX_SAMPLE_CNT_LSB_CH0_MSB 15 -#define STEREO0_RX_SAMPLE_CNT_LSB_CH0_LSB 0 -#define STEREO0_RX_SAMPLE_CNT_LSB_CH0_MASK 0x0000ffff -#define STEREO0_RX_SAMPLE_CNT_LSB_CH0_GET(x) (((x) & 0x0000ffff) >> 0) -#define STEREO0_RX_SAMPLE_CNT_LSB_CH0_SET(x) (((x) << 0) & 0x0000ffff) -#define STEREO0_RX_SAMPLE_CNT_LSB_CH1_MSB 31 -#define STEREO0_RX_SAMPLE_CNT_LSB_CH1_LSB 16 -#define STEREO0_RX_SAMPLE_CNT_LSB_CH1_MASK 0xffff0000 -#define STEREO0_RX_SAMPLE_CNT_LSB_CH1_GET(x) (((x) & 0xffff0000) >> 16) -#define STEREO0_RX_SAMPLE_CNT_LSB_CH1_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for STEREO0_RX_SAMPLE_CNT_MSB */ -#define STEREO0_RX_SAMPLE_CNT_MSB_ADDRESS 0x00000018 -#define STEREO0_RX_SAMPLE_CNT_MSB_OFFSET 0x00000018 -#define STEREO0_RX_SAMPLE_CNT_MSB_CH0_MSB 15 -#define STEREO0_RX_SAMPLE_CNT_MSB_CH0_LSB 0 -#define STEREO0_RX_SAMPLE_CNT_MSB_CH0_MASK 0x0000ffff -#define STEREO0_RX_SAMPLE_CNT_MSB_CH0_GET(x) (((x) & 0x0000ffff) >> 0) -#define STEREO0_RX_SAMPLE_CNT_MSB_CH0_SET(x) (((x) << 0) & 0x0000ffff) -#define STEREO0_RX_SAMPLE_CNT_MSB_CH1_MSB 31 -#define STEREO0_RX_SAMPLE_CNT_MSB_CH1_LSB 16 -#define STEREO0_RX_SAMPLE_CNT_MSB_CH1_MASK 0xffff0000 -#define STEREO0_RX_SAMPLE_CNT_MSB_CH1_GET(x) (((x) & 0xffff0000) >> 16) -#define STEREO0_RX_SAMPLE_CNT_MSB_CH1_SET(x) (((x) << 16) & 0xffff0000) - - -#ifndef __ASSEMBLER__ - -typedef struct stereo_reg_reg_s { - volatile unsigned int STEREO0_CONFIG; /* 0x0 - 0x4 */ - volatile unsigned int STEREO0_VOLUME; /* 0x4 - 0x8 */ - volatile unsigned int STEREO_MASTER_CLOCK; /* 0x8 - 0xc */ - volatile unsigned int STEREO0_TX_SAMPLE_CNT_LSB; /* 0xc - 0x10 */ - volatile unsigned int STEREO0_TX_SAMPLE_CNT_MSB; /* 0x10 - 0x14 */ - volatile unsigned int STEREO0_RX_SAMPLE_CNT_LSB; /* 0x14 - 0x18 */ - volatile unsigned int STEREO0_RX_SAMPLE_CNT_MSB; /* 0x18 - 0x1c */ -} stereo_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _STEREO_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/uart_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/uart_reg.h deleted file mode 100644 index 5aef4bad347b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/uart_reg.h +++ /dev/null @@ -1,260 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _UART_REG_REG_H_ -#define _UART_REG_REG_H_ - -#define UART_DATA_ADDRESS 0x00000000 -#define UART_DATA_OFFSET 0x00000000 -#define UART_DATA_TX_CSR_MSB 9 -#define UART_DATA_TX_CSR_LSB 9 -#define UART_DATA_TX_CSR_MASK 0x00000200 -#define UART_DATA_TX_CSR_GET(x) (((x) & UART_DATA_TX_CSR_MASK) >> UART_DATA_TX_CSR_LSB) -#define UART_DATA_TX_CSR_SET(x) (((x) << UART_DATA_TX_CSR_LSB) & UART_DATA_TX_CSR_MASK) -#define UART_DATA_RX_CSR_MSB 8 -#define UART_DATA_RX_CSR_LSB 8 -#define UART_DATA_RX_CSR_MASK 0x00000100 -#define UART_DATA_RX_CSR_GET(x) (((x) & UART_DATA_RX_CSR_MASK) >> UART_DATA_RX_CSR_LSB) -#define UART_DATA_RX_CSR_SET(x) (((x) << UART_DATA_RX_CSR_LSB) & UART_DATA_RX_CSR_MASK) -#define UART_DATA_TXRX_DATA_MSB 7 -#define UART_DATA_TXRX_DATA_LSB 0 -#define UART_DATA_TXRX_DATA_MASK 0x000000ff -#define UART_DATA_TXRX_DATA_GET(x) (((x) & UART_DATA_TXRX_DATA_MASK) >> UART_DATA_TXRX_DATA_LSB) -#define UART_DATA_TXRX_DATA_SET(x) (((x) << UART_DATA_TXRX_DATA_LSB) & UART_DATA_TXRX_DATA_MASK) - -#define UART_CONTROL_ADDRESS 0x00000004 -#define UART_CONTROL_OFFSET 0x00000004 -#define UART_CONTROL_RX_BUSY_MSB 15 -#define UART_CONTROL_RX_BUSY_LSB 15 -#define UART_CONTROL_RX_BUSY_MASK 0x00008000 -#define UART_CONTROL_RX_BUSY_GET(x) (((x) & UART_CONTROL_RX_BUSY_MASK) >> UART_CONTROL_RX_BUSY_LSB) -#define UART_CONTROL_RX_BUSY_SET(x) (((x) << UART_CONTROL_RX_BUSY_LSB) & UART_CONTROL_RX_BUSY_MASK) -#define UART_CONTROL_TX_BUSY_MSB 14 -#define UART_CONTROL_TX_BUSY_LSB 14 -#define UART_CONTROL_TX_BUSY_MASK 0x00004000 -#define UART_CONTROL_TX_BUSY_GET(x) (((x) & UART_CONTROL_TX_BUSY_MASK) >> UART_CONTROL_TX_BUSY_LSB) -#define UART_CONTROL_TX_BUSY_SET(x) (((x) << UART_CONTROL_TX_BUSY_LSB) & UART_CONTROL_TX_BUSY_MASK) -#define UART_CONTROL_HOST_INT_ENABLE_MSB 13 -#define UART_CONTROL_HOST_INT_ENABLE_LSB 13 -#define UART_CONTROL_HOST_INT_ENABLE_MASK 0x00002000 -#define UART_CONTROL_HOST_INT_ENABLE_GET(x) (((x) & UART_CONTROL_HOST_INT_ENABLE_MASK) >> UART_CONTROL_HOST_INT_ENABLE_LSB) -#define UART_CONTROL_HOST_INT_ENABLE_SET(x) (((x) << UART_CONTROL_HOST_INT_ENABLE_LSB) & UART_CONTROL_HOST_INT_ENABLE_MASK) -#define UART_CONTROL_HOST_INT_MSB 12 -#define UART_CONTROL_HOST_INT_LSB 12 -#define UART_CONTROL_HOST_INT_MASK 0x00001000 -#define UART_CONTROL_HOST_INT_GET(x) (((x) & UART_CONTROL_HOST_INT_MASK) >> UART_CONTROL_HOST_INT_LSB) -#define UART_CONTROL_HOST_INT_SET(x) (((x) << UART_CONTROL_HOST_INT_LSB) & UART_CONTROL_HOST_INT_MASK) -#define UART_CONTROL_TX_BREAK_MSB 11 -#define UART_CONTROL_TX_BREAK_LSB 11 -#define UART_CONTROL_TX_BREAK_MASK 0x00000800 -#define UART_CONTROL_TX_BREAK_GET(x) (((x) & UART_CONTROL_TX_BREAK_MASK) >> UART_CONTROL_TX_BREAK_LSB) -#define UART_CONTROL_TX_BREAK_SET(x) (((x) << UART_CONTROL_TX_BREAK_LSB) & UART_CONTROL_TX_BREAK_MASK) -#define UART_CONTROL_RX_BREAK_MSB 10 -#define UART_CONTROL_RX_BREAK_LSB 10 -#define UART_CONTROL_RX_BREAK_MASK 0x00000400 -#define UART_CONTROL_RX_BREAK_GET(x) (((x) & UART_CONTROL_RX_BREAK_MASK) >> UART_CONTROL_RX_BREAK_LSB) -#define UART_CONTROL_RX_BREAK_SET(x) (((x) << UART_CONTROL_RX_BREAK_LSB) & UART_CONTROL_RX_BREAK_MASK) -#define UART_CONTROL_SERIAL_TX_READY_MSB 9 -#define UART_CONTROL_SERIAL_TX_READY_LSB 9 -#define UART_CONTROL_SERIAL_TX_READY_MASK 0x00000200 -#define UART_CONTROL_SERIAL_TX_READY_GET(x) (((x) & UART_CONTROL_SERIAL_TX_READY_MASK) >> UART_CONTROL_SERIAL_TX_READY_LSB) -#define UART_CONTROL_SERIAL_TX_READY_SET(x) (((x) << UART_CONTROL_SERIAL_TX_READY_LSB) & UART_CONTROL_SERIAL_TX_READY_MASK) -#define UART_CONTROL_TX_READY_ORIDE_MSB 8 -#define UART_CONTROL_TX_READY_ORIDE_LSB 8 -#define UART_CONTROL_TX_READY_ORIDE_MASK 0x00000100 -#define UART_CONTROL_TX_READY_ORIDE_GET(x) (((x) & UART_CONTROL_TX_READY_ORIDE_MASK) >> UART_CONTROL_TX_READY_ORIDE_LSB) -#define UART_CONTROL_TX_READY_ORIDE_SET(x) (((x) << UART_CONTROL_TX_READY_ORIDE_LSB) & UART_CONTROL_TX_READY_ORIDE_MASK) -#define UART_CONTROL_RX_READY_ORIDE_MSB 7 -#define UART_CONTROL_RX_READY_ORIDE_LSB 7 -#define UART_CONTROL_RX_READY_ORIDE_MASK 0x00000080 -#define UART_CONTROL_RX_READY_ORIDE_GET(x) (((x) & UART_CONTROL_RX_READY_ORIDE_MASK) >> UART_CONTROL_RX_READY_ORIDE_LSB) -#define UART_CONTROL_RX_READY_ORIDE_SET(x) (((x) << UART_CONTROL_RX_READY_ORIDE_LSB) & UART_CONTROL_RX_READY_ORIDE_MASK) -#define UART_CONTROL_DMA_ENABLE_MSB 6 -#define UART_CONTROL_DMA_ENABLE_LSB 6 -#define UART_CONTROL_DMA_ENABLE_MASK 0x00000040 -#define UART_CONTROL_DMA_ENABLE_GET(x) (((x) & UART_CONTROL_DMA_ENABLE_MASK) >> UART_CONTROL_DMA_ENABLE_LSB) -#define UART_CONTROL_DMA_ENABLE_SET(x) (((x) << UART_CONTROL_DMA_ENABLE_LSB) & UART_CONTROL_DMA_ENABLE_MASK) -#define UART_CONTROL_FLOW_ENABLE_MSB 5 -#define UART_CONTROL_FLOW_ENABLE_LSB 5 -#define UART_CONTROL_FLOW_ENABLE_MASK 0x00000020 -#define UART_CONTROL_FLOW_ENABLE_GET(x) (((x) & UART_CONTROL_FLOW_ENABLE_MASK) >> UART_CONTROL_FLOW_ENABLE_LSB) -#define UART_CONTROL_FLOW_ENABLE_SET(x) (((x) << UART_CONTROL_FLOW_ENABLE_LSB) & UART_CONTROL_FLOW_ENABLE_MASK) -#define UART_CONTROL_FLOW_INVERT_MSB 4 -#define UART_CONTROL_FLOW_INVERT_LSB 4 -#define UART_CONTROL_FLOW_INVERT_MASK 0x00000010 -#define UART_CONTROL_FLOW_INVERT_GET(x) (((x) & UART_CONTROL_FLOW_INVERT_MASK) >> UART_CONTROL_FLOW_INVERT_LSB) -#define UART_CONTROL_FLOW_INVERT_SET(x) (((x) << UART_CONTROL_FLOW_INVERT_LSB) & UART_CONTROL_FLOW_INVERT_MASK) -#define UART_CONTROL_IFC_ENABLE_MSB 3 -#define UART_CONTROL_IFC_ENABLE_LSB 3 -#define UART_CONTROL_IFC_ENABLE_MASK 0x00000008 -#define UART_CONTROL_IFC_ENABLE_GET(x) (((x) & UART_CONTROL_IFC_ENABLE_MASK) >> UART_CONTROL_IFC_ENABLE_LSB) -#define UART_CONTROL_IFC_ENABLE_SET(x) (((x) << UART_CONTROL_IFC_ENABLE_LSB) & UART_CONTROL_IFC_ENABLE_MASK) -#define UART_CONTROL_IFC_DCE_MSB 2 -#define UART_CONTROL_IFC_DCE_LSB 2 -#define UART_CONTROL_IFC_DCE_MASK 0x00000004 -#define UART_CONTROL_IFC_DCE_GET(x) (((x) & UART_CONTROL_IFC_DCE_MASK) >> UART_CONTROL_IFC_DCE_LSB) -#define UART_CONTROL_IFC_DCE_SET(x) (((x) << UART_CONTROL_IFC_DCE_LSB) & UART_CONTROL_IFC_DCE_MASK) -#define UART_CONTROL_PARITY_ENABLE_MSB 1 -#define UART_CONTROL_PARITY_ENABLE_LSB 1 -#define UART_CONTROL_PARITY_ENABLE_MASK 0x00000002 -#define UART_CONTROL_PARITY_ENABLE_GET(x) (((x) & UART_CONTROL_PARITY_ENABLE_MASK) >> UART_CONTROL_PARITY_ENABLE_LSB) -#define UART_CONTROL_PARITY_ENABLE_SET(x) (((x) << UART_CONTROL_PARITY_ENABLE_LSB) & UART_CONTROL_PARITY_ENABLE_MASK) -#define UART_CONTROL_PARITY_EVEN_MSB 0 -#define UART_CONTROL_PARITY_EVEN_LSB 0 -#define UART_CONTROL_PARITY_EVEN_MASK 0x00000001 -#define UART_CONTROL_PARITY_EVEN_GET(x) (((x) & UART_CONTROL_PARITY_EVEN_MASK) >> UART_CONTROL_PARITY_EVEN_LSB) -#define UART_CONTROL_PARITY_EVEN_SET(x) (((x) << UART_CONTROL_PARITY_EVEN_LSB) & UART_CONTROL_PARITY_EVEN_MASK) - -#define UART_CLKDIV_ADDRESS 0x00000008 -#define UART_CLKDIV_OFFSET 0x00000008 -#define UART_CLKDIV_CLK_SCALE_MSB 23 -#define UART_CLKDIV_CLK_SCALE_LSB 16 -#define UART_CLKDIV_CLK_SCALE_MASK 0x00ff0000 -#define UART_CLKDIV_CLK_SCALE_GET(x) (((x) & UART_CLKDIV_CLK_SCALE_MASK) >> UART_CLKDIV_CLK_SCALE_LSB) -#define UART_CLKDIV_CLK_SCALE_SET(x) (((x) << UART_CLKDIV_CLK_SCALE_LSB) & UART_CLKDIV_CLK_SCALE_MASK) -#define UART_CLKDIV_CLK_STEP_MSB 15 -#define UART_CLKDIV_CLK_STEP_LSB 0 -#define UART_CLKDIV_CLK_STEP_MASK 0x0000ffff -#define UART_CLKDIV_CLK_STEP_GET(x) (((x) & UART_CLKDIV_CLK_STEP_MASK) >> UART_CLKDIV_CLK_STEP_LSB) -#define UART_CLKDIV_CLK_STEP_SET(x) (((x) << UART_CLKDIV_CLK_STEP_LSB) & UART_CLKDIV_CLK_STEP_MASK) - -#define UART_INT_ADDRESS 0x0000000c -#define UART_INT_OFFSET 0x0000000c -#define UART_INT_TX_EMPTY_INT_MSB 9 -#define UART_INT_TX_EMPTY_INT_LSB 9 -#define UART_INT_TX_EMPTY_INT_MASK 0x00000200 -#define UART_INT_TX_EMPTY_INT_GET(x) (((x) & UART_INT_TX_EMPTY_INT_MASK) >> UART_INT_TX_EMPTY_INT_LSB) -#define UART_INT_TX_EMPTY_INT_SET(x) (((x) << UART_INT_TX_EMPTY_INT_LSB) & UART_INT_TX_EMPTY_INT_MASK) -#define UART_INT_RX_FULL_INT_MSB 8 -#define UART_INT_RX_FULL_INT_LSB 8 -#define UART_INT_RX_FULL_INT_MASK 0x00000100 -#define UART_INT_RX_FULL_INT_GET(x) (((x) & UART_INT_RX_FULL_INT_MASK) >> UART_INT_RX_FULL_INT_LSB) -#define UART_INT_RX_FULL_INT_SET(x) (((x) << UART_INT_RX_FULL_INT_LSB) & UART_INT_RX_FULL_INT_MASK) -#define UART_INT_RX_BREAK_OFF_INT_MSB 7 -#define UART_INT_RX_BREAK_OFF_INT_LSB 7 -#define UART_INT_RX_BREAK_OFF_INT_MASK 0x00000080 -#define UART_INT_RX_BREAK_OFF_INT_GET(x) (((x) & UART_INT_RX_BREAK_OFF_INT_MASK) >> UART_INT_RX_BREAK_OFF_INT_LSB) -#define UART_INT_RX_BREAK_OFF_INT_SET(x) (((x) << UART_INT_RX_BREAK_OFF_INT_LSB) & UART_INT_RX_BREAK_OFF_INT_MASK) -#define UART_INT_RX_BREAK_ON_INT_MSB 6 -#define UART_INT_RX_BREAK_ON_INT_LSB 6 -#define UART_INT_RX_BREAK_ON_INT_MASK 0x00000040 -#define UART_INT_RX_BREAK_ON_INT_GET(x) (((x) & UART_INT_RX_BREAK_ON_INT_MASK) >> UART_INT_RX_BREAK_ON_INT_LSB) -#define UART_INT_RX_BREAK_ON_INT_SET(x) (((x) << UART_INT_RX_BREAK_ON_INT_LSB) & UART_INT_RX_BREAK_ON_INT_MASK) -#define UART_INT_RX_PARITY_ERR_INT_MSB 5 -#define UART_INT_RX_PARITY_ERR_INT_LSB 5 -#define UART_INT_RX_PARITY_ERR_INT_MASK 0x00000020 -#define UART_INT_RX_PARITY_ERR_INT_GET(x) (((x) & UART_INT_RX_PARITY_ERR_INT_MASK) >> UART_INT_RX_PARITY_ERR_INT_LSB) -#define UART_INT_RX_PARITY_ERR_INT_SET(x) (((x) << UART_INT_RX_PARITY_ERR_INT_LSB) & UART_INT_RX_PARITY_ERR_INT_MASK) -#define UART_INT_TX_OFLOW_ERR_INT_MSB 4 -#define UART_INT_TX_OFLOW_ERR_INT_LSB 4 -#define UART_INT_TX_OFLOW_ERR_INT_MASK 0x00000010 -#define UART_INT_TX_OFLOW_ERR_INT_GET(x) (((x) & UART_INT_TX_OFLOW_ERR_INT_MASK) >> UART_INT_TX_OFLOW_ERR_INT_LSB) -#define UART_INT_TX_OFLOW_ERR_INT_SET(x) (((x) << UART_INT_TX_OFLOW_ERR_INT_LSB) & UART_INT_TX_OFLOW_ERR_INT_MASK) -#define UART_INT_RX_OFLOW_ERR_INT_MSB 3 -#define UART_INT_RX_OFLOW_ERR_INT_LSB 3 -#define UART_INT_RX_OFLOW_ERR_INT_MASK 0x00000008 -#define UART_INT_RX_OFLOW_ERR_INT_GET(x) (((x) & UART_INT_RX_OFLOW_ERR_INT_MASK) >> UART_INT_RX_OFLOW_ERR_INT_LSB) -#define UART_INT_RX_OFLOW_ERR_INT_SET(x) (((x) << UART_INT_RX_OFLOW_ERR_INT_LSB) & UART_INT_RX_OFLOW_ERR_INT_MASK) -#define UART_INT_RX_FRAMING_ERR_INT_MSB 2 -#define UART_INT_RX_FRAMING_ERR_INT_LSB 2 -#define UART_INT_RX_FRAMING_ERR_INT_MASK 0x00000004 -#define UART_INT_RX_FRAMING_ERR_INT_GET(x) (((x) & UART_INT_RX_FRAMING_ERR_INT_MASK) >> UART_INT_RX_FRAMING_ERR_INT_LSB) -#define UART_INT_RX_FRAMING_ERR_INT_SET(x) (((x) << UART_INT_RX_FRAMING_ERR_INT_LSB) & UART_INT_RX_FRAMING_ERR_INT_MASK) -#define UART_INT_TX_READY_INT_MSB 1 -#define UART_INT_TX_READY_INT_LSB 1 -#define UART_INT_TX_READY_INT_MASK 0x00000002 -#define UART_INT_TX_READY_INT_GET(x) (((x) & UART_INT_TX_READY_INT_MASK) >> UART_INT_TX_READY_INT_LSB) -#define UART_INT_TX_READY_INT_SET(x) (((x) << UART_INT_TX_READY_INT_LSB) & UART_INT_TX_READY_INT_MASK) -#define UART_INT_RX_VALID_INT_MSB 0 -#define UART_INT_RX_VALID_INT_LSB 0 -#define UART_INT_RX_VALID_INT_MASK 0x00000001 -#define UART_INT_RX_VALID_INT_GET(x) (((x) & UART_INT_RX_VALID_INT_MASK) >> UART_INT_RX_VALID_INT_LSB) -#define UART_INT_RX_VALID_INT_SET(x) (((x) << UART_INT_RX_VALID_INT_LSB) & UART_INT_RX_VALID_INT_MASK) - -#define UART_INT_EN_ADDRESS 0x00000010 -#define UART_INT_EN_OFFSET 0x00000010 -#define UART_INT_EN_TX_EMPTY_INT_EN_MSB 9 -#define UART_INT_EN_TX_EMPTY_INT_EN_LSB 9 -#define UART_INT_EN_TX_EMPTY_INT_EN_MASK 0x00000200 -#define UART_INT_EN_TX_EMPTY_INT_EN_GET(x) (((x) & UART_INT_EN_TX_EMPTY_INT_EN_MASK) >> UART_INT_EN_TX_EMPTY_INT_EN_LSB) -#define UART_INT_EN_TX_EMPTY_INT_EN_SET(x) (((x) << UART_INT_EN_TX_EMPTY_INT_EN_LSB) & UART_INT_EN_TX_EMPTY_INT_EN_MASK) -#define UART_INT_EN_RX_FULL_INT_EN_MSB 8 -#define UART_INT_EN_RX_FULL_INT_EN_LSB 8 -#define UART_INT_EN_RX_FULL_INT_EN_MASK 0x00000100 -#define UART_INT_EN_RX_FULL_INT_EN_GET(x) (((x) & UART_INT_EN_RX_FULL_INT_EN_MASK) >> UART_INT_EN_RX_FULL_INT_EN_LSB) -#define UART_INT_EN_RX_FULL_INT_EN_SET(x) (((x) << UART_INT_EN_RX_FULL_INT_EN_LSB) & UART_INT_EN_RX_FULL_INT_EN_MASK) -#define UART_INT_EN_RX_BREAK_OFF_INT_EN_MSB 7 -#define UART_INT_EN_RX_BREAK_OFF_INT_EN_LSB 7 -#define UART_INT_EN_RX_BREAK_OFF_INT_EN_MASK 0x00000080 -#define UART_INT_EN_RX_BREAK_OFF_INT_EN_GET(x) (((x) & UART_INT_EN_RX_BREAK_OFF_INT_EN_MASK) >> UART_INT_EN_RX_BREAK_OFF_INT_EN_LSB) -#define UART_INT_EN_RX_BREAK_OFF_INT_EN_SET(x) (((x) << UART_INT_EN_RX_BREAK_OFF_INT_EN_LSB) & UART_INT_EN_RX_BREAK_OFF_INT_EN_MASK) -#define UART_INT_EN_RX_BREAK_ON_INT_EN_MSB 6 -#define UART_INT_EN_RX_BREAK_ON_INT_EN_LSB 6 -#define UART_INT_EN_RX_BREAK_ON_INT_EN_MASK 0x00000040 -#define UART_INT_EN_RX_BREAK_ON_INT_EN_GET(x) (((x) & UART_INT_EN_RX_BREAK_ON_INT_EN_MASK) >> UART_INT_EN_RX_BREAK_ON_INT_EN_LSB) -#define UART_INT_EN_RX_BREAK_ON_INT_EN_SET(x) (((x) << UART_INT_EN_RX_BREAK_ON_INT_EN_LSB) & UART_INT_EN_RX_BREAK_ON_INT_EN_MASK) -#define UART_INT_EN_RX_PARITY_ERR_INT_EN_MSB 5 -#define UART_INT_EN_RX_PARITY_ERR_INT_EN_LSB 5 -#define UART_INT_EN_RX_PARITY_ERR_INT_EN_MASK 0x00000020 -#define UART_INT_EN_RX_PARITY_ERR_INT_EN_GET(x) (((x) & UART_INT_EN_RX_PARITY_ERR_INT_EN_MASK) >> UART_INT_EN_RX_PARITY_ERR_INT_EN_LSB) -#define UART_INT_EN_RX_PARITY_ERR_INT_EN_SET(x) (((x) << UART_INT_EN_RX_PARITY_ERR_INT_EN_LSB) & UART_INT_EN_RX_PARITY_ERR_INT_EN_MASK) -#define UART_INT_EN_TX_OFLOW_ERR_INT_EN_MSB 4 -#define UART_INT_EN_TX_OFLOW_ERR_INT_EN_LSB 4 -#define UART_INT_EN_TX_OFLOW_ERR_INT_EN_MASK 0x00000010 -#define UART_INT_EN_TX_OFLOW_ERR_INT_EN_GET(x) (((x) & UART_INT_EN_TX_OFLOW_ERR_INT_EN_MASK) >> UART_INT_EN_TX_OFLOW_ERR_INT_EN_LSB) -#define UART_INT_EN_TX_OFLOW_ERR_INT_EN_SET(x) (((x) << UART_INT_EN_TX_OFLOW_ERR_INT_EN_LSB) & UART_INT_EN_TX_OFLOW_ERR_INT_EN_MASK) -#define UART_INT_EN_RX_OFLOW_ERR_INT_EN_MSB 3 -#define UART_INT_EN_RX_OFLOW_ERR_INT_EN_LSB 3 -#define UART_INT_EN_RX_OFLOW_ERR_INT_EN_MASK 0x00000008 -#define UART_INT_EN_RX_OFLOW_ERR_INT_EN_GET(x) (((x) & UART_INT_EN_RX_OFLOW_ERR_INT_EN_MASK) >> UART_INT_EN_RX_OFLOW_ERR_INT_EN_LSB) -#define UART_INT_EN_RX_OFLOW_ERR_INT_EN_SET(x) (((x) << UART_INT_EN_RX_OFLOW_ERR_INT_EN_LSB) & UART_INT_EN_RX_OFLOW_ERR_INT_EN_MASK) -#define UART_INT_EN_RX_FRAMING_ERR_INT_EN_MSB 2 -#define UART_INT_EN_RX_FRAMING_ERR_INT_EN_LSB 2 -#define UART_INT_EN_RX_FRAMING_ERR_INT_EN_MASK 0x00000004 -#define UART_INT_EN_RX_FRAMING_ERR_INT_EN_GET(x) (((x) & UART_INT_EN_RX_FRAMING_ERR_INT_EN_MASK) >> UART_INT_EN_RX_FRAMING_ERR_INT_EN_LSB) -#define UART_INT_EN_RX_FRAMING_ERR_INT_EN_SET(x) (((x) << UART_INT_EN_RX_FRAMING_ERR_INT_EN_LSB) & UART_INT_EN_RX_FRAMING_ERR_INT_EN_MASK) -#define UART_INT_EN_TX_READY_INT_EN_MSB 1 -#define UART_INT_EN_TX_READY_INT_EN_LSB 1 -#define UART_INT_EN_TX_READY_INT_EN_MASK 0x00000002 -#define UART_INT_EN_TX_READY_INT_EN_GET(x) (((x) & UART_INT_EN_TX_READY_INT_EN_MASK) >> UART_INT_EN_TX_READY_INT_EN_LSB) -#define UART_INT_EN_TX_READY_INT_EN_SET(x) (((x) << UART_INT_EN_TX_READY_INT_EN_LSB) & UART_INT_EN_TX_READY_INT_EN_MASK) -#define UART_INT_EN_RX_VALID_INT_EN_MSB 0 -#define UART_INT_EN_RX_VALID_INT_EN_LSB 0 -#define UART_INT_EN_RX_VALID_INT_EN_MASK 0x00000001 -#define UART_INT_EN_RX_VALID_INT_EN_GET(x) (((x) & UART_INT_EN_RX_VALID_INT_EN_MASK) >> UART_INT_EN_RX_VALID_INT_EN_LSB) -#define UART_INT_EN_RX_VALID_INT_EN_SET(x) (((x) << UART_INT_EN_RX_VALID_INT_EN_LSB) & UART_INT_EN_RX_VALID_INT_EN_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct uart_reg_reg_s { - volatile unsigned int uart_data; - volatile unsigned int uart_control; - volatile unsigned int uart_clkdiv; - volatile unsigned int uart_int; - volatile unsigned int uart_int_en; -} uart_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _UART_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/umbox_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/umbox_reg.h deleted file mode 100644 index 66ed47f44d9b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/umbox_reg.h +++ /dev/null @@ -1,37 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifdef WLAN_HEADERS - -#include "umbox_wlan_reg.h" - - -#ifndef BT_HEADERS - - - -#endif -#endif - - - diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/umbox_wlan_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/umbox_wlan_reg.h deleted file mode 100644 index 5c392f894126..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/umbox_wlan_reg.h +++ /dev/null @@ -1,322 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _UMBOX_WLAN_REG_REG_H_ -#define _UMBOX_WLAN_REG_REG_H_ - -#define UMBOX_FIFO_ADDRESS 0x00000000 -#define UMBOX_FIFO_OFFSET 0x00000000 -#define UMBOX_FIFO_DATA_MSB 8 -#define UMBOX_FIFO_DATA_LSB 0 -#define UMBOX_FIFO_DATA_MASK 0x000001ff -#define UMBOX_FIFO_DATA_GET(x) (((x) & UMBOX_FIFO_DATA_MASK) >> UMBOX_FIFO_DATA_LSB) -#define UMBOX_FIFO_DATA_SET(x) (((x) << UMBOX_FIFO_DATA_LSB) & UMBOX_FIFO_DATA_MASK) - -#define UMBOX_FIFO_STATUS_ADDRESS 0x00000008 -#define UMBOX_FIFO_STATUS_OFFSET 0x00000008 -#define UMBOX_FIFO_STATUS_TX_EMPTY_MSB 3 -#define UMBOX_FIFO_STATUS_TX_EMPTY_LSB 3 -#define UMBOX_FIFO_STATUS_TX_EMPTY_MASK 0x00000008 -#define UMBOX_FIFO_STATUS_TX_EMPTY_GET(x) (((x) & UMBOX_FIFO_STATUS_TX_EMPTY_MASK) >> UMBOX_FIFO_STATUS_TX_EMPTY_LSB) -#define UMBOX_FIFO_STATUS_TX_EMPTY_SET(x) (((x) << UMBOX_FIFO_STATUS_TX_EMPTY_LSB) & UMBOX_FIFO_STATUS_TX_EMPTY_MASK) -#define UMBOX_FIFO_STATUS_TX_FULL_MSB 2 -#define UMBOX_FIFO_STATUS_TX_FULL_LSB 2 -#define UMBOX_FIFO_STATUS_TX_FULL_MASK 0x00000004 -#define UMBOX_FIFO_STATUS_TX_FULL_GET(x) (((x) & UMBOX_FIFO_STATUS_TX_FULL_MASK) >> UMBOX_FIFO_STATUS_TX_FULL_LSB) -#define UMBOX_FIFO_STATUS_TX_FULL_SET(x) (((x) << UMBOX_FIFO_STATUS_TX_FULL_LSB) & UMBOX_FIFO_STATUS_TX_FULL_MASK) -#define UMBOX_FIFO_STATUS_RX_EMPTY_MSB 1 -#define UMBOX_FIFO_STATUS_RX_EMPTY_LSB 1 -#define UMBOX_FIFO_STATUS_RX_EMPTY_MASK 0x00000002 -#define UMBOX_FIFO_STATUS_RX_EMPTY_GET(x) (((x) & UMBOX_FIFO_STATUS_RX_EMPTY_MASK) >> UMBOX_FIFO_STATUS_RX_EMPTY_LSB) -#define UMBOX_FIFO_STATUS_RX_EMPTY_SET(x) (((x) << UMBOX_FIFO_STATUS_RX_EMPTY_LSB) & UMBOX_FIFO_STATUS_RX_EMPTY_MASK) -#define UMBOX_FIFO_STATUS_RX_FULL_MSB 0 -#define UMBOX_FIFO_STATUS_RX_FULL_LSB 0 -#define UMBOX_FIFO_STATUS_RX_FULL_MASK 0x00000001 -#define UMBOX_FIFO_STATUS_RX_FULL_GET(x) (((x) & UMBOX_FIFO_STATUS_RX_FULL_MASK) >> UMBOX_FIFO_STATUS_RX_FULL_LSB) -#define UMBOX_FIFO_STATUS_RX_FULL_SET(x) (((x) << UMBOX_FIFO_STATUS_RX_FULL_LSB) & UMBOX_FIFO_STATUS_RX_FULL_MASK) - -#define UMBOX_DMA_POLICY_ADDRESS 0x0000000c -#define UMBOX_DMA_POLICY_OFFSET 0x0000000c -#define UMBOX_DMA_POLICY_TX_QUANTUM_MSB 3 -#define UMBOX_DMA_POLICY_TX_QUANTUM_LSB 3 -#define UMBOX_DMA_POLICY_TX_QUANTUM_MASK 0x00000008 -#define UMBOX_DMA_POLICY_TX_QUANTUM_GET(x) (((x) & UMBOX_DMA_POLICY_TX_QUANTUM_MASK) >> UMBOX_DMA_POLICY_TX_QUANTUM_LSB) -#define UMBOX_DMA_POLICY_TX_QUANTUM_SET(x) (((x) << UMBOX_DMA_POLICY_TX_QUANTUM_LSB) & UMBOX_DMA_POLICY_TX_QUANTUM_MASK) -#define UMBOX_DMA_POLICY_TX_ORDER_MSB 2 -#define UMBOX_DMA_POLICY_TX_ORDER_LSB 2 -#define UMBOX_DMA_POLICY_TX_ORDER_MASK 0x00000004 -#define UMBOX_DMA_POLICY_TX_ORDER_GET(x) (((x) & UMBOX_DMA_POLICY_TX_ORDER_MASK) >> UMBOX_DMA_POLICY_TX_ORDER_LSB) -#define UMBOX_DMA_POLICY_TX_ORDER_SET(x) (((x) << UMBOX_DMA_POLICY_TX_ORDER_LSB) & UMBOX_DMA_POLICY_TX_ORDER_MASK) -#define UMBOX_DMA_POLICY_RX_QUANTUM_MSB 1 -#define UMBOX_DMA_POLICY_RX_QUANTUM_LSB 1 -#define UMBOX_DMA_POLICY_RX_QUANTUM_MASK 0x00000002 -#define UMBOX_DMA_POLICY_RX_QUANTUM_GET(x) (((x) & UMBOX_DMA_POLICY_RX_QUANTUM_MASK) >> UMBOX_DMA_POLICY_RX_QUANTUM_LSB) -#define UMBOX_DMA_POLICY_RX_QUANTUM_SET(x) (((x) << UMBOX_DMA_POLICY_RX_QUANTUM_LSB) & UMBOX_DMA_POLICY_RX_QUANTUM_MASK) -#define UMBOX_DMA_POLICY_RX_ORDER_MSB 0 -#define UMBOX_DMA_POLICY_RX_ORDER_LSB 0 -#define UMBOX_DMA_POLICY_RX_ORDER_MASK 0x00000001 -#define UMBOX_DMA_POLICY_RX_ORDER_GET(x) (((x) & UMBOX_DMA_POLICY_RX_ORDER_MASK) >> UMBOX_DMA_POLICY_RX_ORDER_LSB) -#define UMBOX_DMA_POLICY_RX_ORDER_SET(x) (((x) << UMBOX_DMA_POLICY_RX_ORDER_LSB) & UMBOX_DMA_POLICY_RX_ORDER_MASK) - -#define UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS 0x00000010 -#define UMBOX0_DMA_RX_DESCRIPTOR_BASE_OFFSET 0x00000010 -#define UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) >> UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_LSB) & UMBOX0_DMA_RX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define UMBOX0_DMA_RX_CONTROL_ADDRESS 0x00000014 -#define UMBOX0_DMA_RX_CONTROL_OFFSET 0x00000014 -#define UMBOX0_DMA_RX_CONTROL_RESUME_MSB 2 -#define UMBOX0_DMA_RX_CONTROL_RESUME_LSB 2 -#define UMBOX0_DMA_RX_CONTROL_RESUME_MASK 0x00000004 -#define UMBOX0_DMA_RX_CONTROL_RESUME_GET(x) (((x) & UMBOX0_DMA_RX_CONTROL_RESUME_MASK) >> UMBOX0_DMA_RX_CONTROL_RESUME_LSB) -#define UMBOX0_DMA_RX_CONTROL_RESUME_SET(x) (((x) << UMBOX0_DMA_RX_CONTROL_RESUME_LSB) & UMBOX0_DMA_RX_CONTROL_RESUME_MASK) -#define UMBOX0_DMA_RX_CONTROL_START_MSB 1 -#define UMBOX0_DMA_RX_CONTROL_START_LSB 1 -#define UMBOX0_DMA_RX_CONTROL_START_MASK 0x00000002 -#define UMBOX0_DMA_RX_CONTROL_START_GET(x) (((x) & UMBOX0_DMA_RX_CONTROL_START_MASK) >> UMBOX0_DMA_RX_CONTROL_START_LSB) -#define UMBOX0_DMA_RX_CONTROL_START_SET(x) (((x) << UMBOX0_DMA_RX_CONTROL_START_LSB) & UMBOX0_DMA_RX_CONTROL_START_MASK) -#define UMBOX0_DMA_RX_CONTROL_STOP_MSB 0 -#define UMBOX0_DMA_RX_CONTROL_STOP_LSB 0 -#define UMBOX0_DMA_RX_CONTROL_STOP_MASK 0x00000001 -#define UMBOX0_DMA_RX_CONTROL_STOP_GET(x) (((x) & UMBOX0_DMA_RX_CONTROL_STOP_MASK) >> UMBOX0_DMA_RX_CONTROL_STOP_LSB) -#define UMBOX0_DMA_RX_CONTROL_STOP_SET(x) (((x) << UMBOX0_DMA_RX_CONTROL_STOP_LSB) & UMBOX0_DMA_RX_CONTROL_STOP_MASK) - -#define UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS 0x00000018 -#define UMBOX0_DMA_TX_DESCRIPTOR_BASE_OFFSET 0x00000018 -#define UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MSB 27 -#define UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB 2 -#define UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK 0x0ffffffc -#define UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_GET(x) (((x) & UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) >> UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) -#define UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_SET(x) (((x) << UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_LSB) & UMBOX0_DMA_TX_DESCRIPTOR_BASE_ADDRESS_MASK) - -#define UMBOX0_DMA_TX_CONTROL_ADDRESS 0x0000001c -#define UMBOX0_DMA_TX_CONTROL_OFFSET 0x0000001c -#define UMBOX0_DMA_TX_CONTROL_RESUME_MSB 2 -#define UMBOX0_DMA_TX_CONTROL_RESUME_LSB 2 -#define UMBOX0_DMA_TX_CONTROL_RESUME_MASK 0x00000004 -#define UMBOX0_DMA_TX_CONTROL_RESUME_GET(x) (((x) & UMBOX0_DMA_TX_CONTROL_RESUME_MASK) >> UMBOX0_DMA_TX_CONTROL_RESUME_LSB) -#define UMBOX0_DMA_TX_CONTROL_RESUME_SET(x) (((x) << UMBOX0_DMA_TX_CONTROL_RESUME_LSB) & UMBOX0_DMA_TX_CONTROL_RESUME_MASK) -#define UMBOX0_DMA_TX_CONTROL_START_MSB 1 -#define UMBOX0_DMA_TX_CONTROL_START_LSB 1 -#define UMBOX0_DMA_TX_CONTROL_START_MASK 0x00000002 -#define UMBOX0_DMA_TX_CONTROL_START_GET(x) (((x) & UMBOX0_DMA_TX_CONTROL_START_MASK) >> UMBOX0_DMA_TX_CONTROL_START_LSB) -#define UMBOX0_DMA_TX_CONTROL_START_SET(x) (((x) << UMBOX0_DMA_TX_CONTROL_START_LSB) & UMBOX0_DMA_TX_CONTROL_START_MASK) -#define UMBOX0_DMA_TX_CONTROL_STOP_MSB 0 -#define UMBOX0_DMA_TX_CONTROL_STOP_LSB 0 -#define UMBOX0_DMA_TX_CONTROL_STOP_MASK 0x00000001 -#define UMBOX0_DMA_TX_CONTROL_STOP_GET(x) (((x) & UMBOX0_DMA_TX_CONTROL_STOP_MASK) >> UMBOX0_DMA_TX_CONTROL_STOP_LSB) -#define UMBOX0_DMA_TX_CONTROL_STOP_SET(x) (((x) << UMBOX0_DMA_TX_CONTROL_STOP_LSB) & UMBOX0_DMA_TX_CONTROL_STOP_MASK) - -#define UMBOX_FIFO_TIMEOUT_ADDRESS 0x00000020 -#define UMBOX_FIFO_TIMEOUT_OFFSET 0x00000020 -#define UMBOX_FIFO_TIMEOUT_ENABLE_SET_MSB 8 -#define UMBOX_FIFO_TIMEOUT_ENABLE_SET_LSB 8 -#define UMBOX_FIFO_TIMEOUT_ENABLE_SET_MASK 0x00000100 -#define UMBOX_FIFO_TIMEOUT_ENABLE_SET_GET(x) (((x) & UMBOX_FIFO_TIMEOUT_ENABLE_SET_MASK) >> UMBOX_FIFO_TIMEOUT_ENABLE_SET_LSB) -#define UMBOX_FIFO_TIMEOUT_ENABLE_SET_SET(x) (((x) << UMBOX_FIFO_TIMEOUT_ENABLE_SET_LSB) & UMBOX_FIFO_TIMEOUT_ENABLE_SET_MASK) -#define UMBOX_FIFO_TIMEOUT_VALUE_MSB 7 -#define UMBOX_FIFO_TIMEOUT_VALUE_LSB 0 -#define UMBOX_FIFO_TIMEOUT_VALUE_MASK 0x000000ff -#define UMBOX_FIFO_TIMEOUT_VALUE_GET(x) (((x) & UMBOX_FIFO_TIMEOUT_VALUE_MASK) >> UMBOX_FIFO_TIMEOUT_VALUE_LSB) -#define UMBOX_FIFO_TIMEOUT_VALUE_SET(x) (((x) << UMBOX_FIFO_TIMEOUT_VALUE_LSB) & UMBOX_FIFO_TIMEOUT_VALUE_MASK) - -#define UMBOX_INT_STATUS_ADDRESS 0x00000024 -#define UMBOX_INT_STATUS_OFFSET 0x00000024 -#define UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_MSB 9 -#define UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_LSB 9 -#define UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_MASK 0x00000200 -#define UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_GET(x) (((x) & UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_MASK) >> UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_LSB) -#define UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_SET(x) (((x) << UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_LSB) & UMBOX_INT_STATUS_HCI_FRAMER_UNDERFLOW_MASK) -#define UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_MSB 8 -#define UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_LSB 8 -#define UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_MASK 0x00000100 -#define UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_GET(x) (((x) & UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_MASK) >> UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_LSB) -#define UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_SET(x) (((x) << UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_LSB) & UMBOX_INT_STATUS_HCI_FRAMER_OVERFLOW_MASK) -#define UMBOX_INT_STATUS_RX_DMA_COMPLETE_MSB 7 -#define UMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB 7 -#define UMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK 0x00000080 -#define UMBOX_INT_STATUS_RX_DMA_COMPLETE_GET(x) (((x) & UMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) >> UMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) -#define UMBOX_INT_STATUS_RX_DMA_COMPLETE_SET(x) (((x) << UMBOX_INT_STATUS_RX_DMA_COMPLETE_LSB) & UMBOX_INT_STATUS_RX_DMA_COMPLETE_MASK) -#define UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MSB 6 -#define UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB 6 -#define UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK 0x00000040 -#define UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_GET(x) (((x) & UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) >> UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) -#define UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_SET(x) (((x) << UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_LSB) & UMBOX_INT_STATUS_TX_DMA_EOM_COMPLETE_MASK) -#define UMBOX_INT_STATUS_TX_DMA_COMPLETE_MSB 5 -#define UMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB 5 -#define UMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK 0x00000020 -#define UMBOX_INT_STATUS_TX_DMA_COMPLETE_GET(x) (((x) & UMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) >> UMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) -#define UMBOX_INT_STATUS_TX_DMA_COMPLETE_SET(x) (((x) << UMBOX_INT_STATUS_TX_DMA_COMPLETE_LSB) & UMBOX_INT_STATUS_TX_DMA_COMPLETE_MASK) -#define UMBOX_INT_STATUS_HCI_SYNC_ERROR_MSB 4 -#define UMBOX_INT_STATUS_HCI_SYNC_ERROR_LSB 4 -#define UMBOX_INT_STATUS_HCI_SYNC_ERROR_MASK 0x00000010 -#define UMBOX_INT_STATUS_HCI_SYNC_ERROR_GET(x) (((x) & UMBOX_INT_STATUS_HCI_SYNC_ERROR_MASK) >> UMBOX_INT_STATUS_HCI_SYNC_ERROR_LSB) -#define UMBOX_INT_STATUS_HCI_SYNC_ERROR_SET(x) (((x) << UMBOX_INT_STATUS_HCI_SYNC_ERROR_LSB) & UMBOX_INT_STATUS_HCI_SYNC_ERROR_MASK) -#define UMBOX_INT_STATUS_TX_OVERFLOW_MSB 3 -#define UMBOX_INT_STATUS_TX_OVERFLOW_LSB 3 -#define UMBOX_INT_STATUS_TX_OVERFLOW_MASK 0x00000008 -#define UMBOX_INT_STATUS_TX_OVERFLOW_GET(x) (((x) & UMBOX_INT_STATUS_TX_OVERFLOW_MASK) >> UMBOX_INT_STATUS_TX_OVERFLOW_LSB) -#define UMBOX_INT_STATUS_TX_OVERFLOW_SET(x) (((x) << UMBOX_INT_STATUS_TX_OVERFLOW_LSB) & UMBOX_INT_STATUS_TX_OVERFLOW_MASK) -#define UMBOX_INT_STATUS_RX_UNDERFLOW_MSB 2 -#define UMBOX_INT_STATUS_RX_UNDERFLOW_LSB 2 -#define UMBOX_INT_STATUS_RX_UNDERFLOW_MASK 0x00000004 -#define UMBOX_INT_STATUS_RX_UNDERFLOW_GET(x) (((x) & UMBOX_INT_STATUS_RX_UNDERFLOW_MASK) >> UMBOX_INT_STATUS_RX_UNDERFLOW_LSB) -#define UMBOX_INT_STATUS_RX_UNDERFLOW_SET(x) (((x) << UMBOX_INT_STATUS_RX_UNDERFLOW_LSB) & UMBOX_INT_STATUS_RX_UNDERFLOW_MASK) -#define UMBOX_INT_STATUS_TX_NOT_EMPTY_MSB 1 -#define UMBOX_INT_STATUS_TX_NOT_EMPTY_LSB 1 -#define UMBOX_INT_STATUS_TX_NOT_EMPTY_MASK 0x00000002 -#define UMBOX_INT_STATUS_TX_NOT_EMPTY_GET(x) (((x) & UMBOX_INT_STATUS_TX_NOT_EMPTY_MASK) >> UMBOX_INT_STATUS_TX_NOT_EMPTY_LSB) -#define UMBOX_INT_STATUS_TX_NOT_EMPTY_SET(x) (((x) << UMBOX_INT_STATUS_TX_NOT_EMPTY_LSB) & UMBOX_INT_STATUS_TX_NOT_EMPTY_MASK) -#define UMBOX_INT_STATUS_RX_NOT_FULL_MSB 0 -#define UMBOX_INT_STATUS_RX_NOT_FULL_LSB 0 -#define UMBOX_INT_STATUS_RX_NOT_FULL_MASK 0x00000001 -#define UMBOX_INT_STATUS_RX_NOT_FULL_GET(x) (((x) & UMBOX_INT_STATUS_RX_NOT_FULL_MASK) >> UMBOX_INT_STATUS_RX_NOT_FULL_LSB) -#define UMBOX_INT_STATUS_RX_NOT_FULL_SET(x) (((x) << UMBOX_INT_STATUS_RX_NOT_FULL_LSB) & UMBOX_INT_STATUS_RX_NOT_FULL_MASK) - -#define UMBOX_INT_ENABLE_ADDRESS 0x00000028 -#define UMBOX_INT_ENABLE_OFFSET 0x00000028 -#define UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_MSB 9 -#define UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_LSB 9 -#define UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_MASK 0x00000200 -#define UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_GET(x) (((x) & UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_MASK) >> UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_LSB) -#define UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_SET(x) (((x) << UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_LSB) & UMBOX_INT_ENABLE_HCI_FRAMER_UNDERFLOW_MASK) -#define UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_MSB 8 -#define UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_LSB 8 -#define UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_MASK 0x00000100 -#define UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_GET(x) (((x) & UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_MASK) >> UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_LSB) -#define UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_SET(x) (((x) << UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_LSB) & UMBOX_INT_ENABLE_HCI_FRAMER_OVERFLOW_MASK) -#define UMBOX_INT_ENABLE_RX_DMA_COMPLETE_MSB 7 -#define UMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB 7 -#define UMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK 0x00000080 -#define UMBOX_INT_ENABLE_RX_DMA_COMPLETE_GET(x) (((x) & UMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) >> UMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) -#define UMBOX_INT_ENABLE_RX_DMA_COMPLETE_SET(x) (((x) << UMBOX_INT_ENABLE_RX_DMA_COMPLETE_LSB) & UMBOX_INT_ENABLE_RX_DMA_COMPLETE_MASK) -#define UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MSB 6 -#define UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB 6 -#define UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK 0x00000040 -#define UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_GET(x) (((x) & UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) >> UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) -#define UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_SET(x) (((x) << UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_LSB) & UMBOX_INT_ENABLE_TX_DMA_EOM_COMPLETE_MASK) -#define UMBOX_INT_ENABLE_TX_DMA_COMPLETE_MSB 5 -#define UMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB 5 -#define UMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK 0x00000020 -#define UMBOX_INT_ENABLE_TX_DMA_COMPLETE_GET(x) (((x) & UMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) >> UMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) -#define UMBOX_INT_ENABLE_TX_DMA_COMPLETE_SET(x) (((x) << UMBOX_INT_ENABLE_TX_DMA_COMPLETE_LSB) & UMBOX_INT_ENABLE_TX_DMA_COMPLETE_MASK) -#define UMBOX_INT_ENABLE_HCI_SYNC_ERROR_MSB 4 -#define UMBOX_INT_ENABLE_HCI_SYNC_ERROR_LSB 4 -#define UMBOX_INT_ENABLE_HCI_SYNC_ERROR_MASK 0x00000010 -#define UMBOX_INT_ENABLE_HCI_SYNC_ERROR_GET(x) (((x) & UMBOX_INT_ENABLE_HCI_SYNC_ERROR_MASK) >> UMBOX_INT_ENABLE_HCI_SYNC_ERROR_LSB) -#define UMBOX_INT_ENABLE_HCI_SYNC_ERROR_SET(x) (((x) << UMBOX_INT_ENABLE_HCI_SYNC_ERROR_LSB) & UMBOX_INT_ENABLE_HCI_SYNC_ERROR_MASK) -#define UMBOX_INT_ENABLE_TX_OVERFLOW_MSB 3 -#define UMBOX_INT_ENABLE_TX_OVERFLOW_LSB 3 -#define UMBOX_INT_ENABLE_TX_OVERFLOW_MASK 0x00000008 -#define UMBOX_INT_ENABLE_TX_OVERFLOW_GET(x) (((x) & UMBOX_INT_ENABLE_TX_OVERFLOW_MASK) >> UMBOX_INT_ENABLE_TX_OVERFLOW_LSB) -#define UMBOX_INT_ENABLE_TX_OVERFLOW_SET(x) (((x) << UMBOX_INT_ENABLE_TX_OVERFLOW_LSB) & UMBOX_INT_ENABLE_TX_OVERFLOW_MASK) -#define UMBOX_INT_ENABLE_RX_UNDERFLOW_MSB 2 -#define UMBOX_INT_ENABLE_RX_UNDERFLOW_LSB 2 -#define UMBOX_INT_ENABLE_RX_UNDERFLOW_MASK 0x00000004 -#define UMBOX_INT_ENABLE_RX_UNDERFLOW_GET(x) (((x) & UMBOX_INT_ENABLE_RX_UNDERFLOW_MASK) >> UMBOX_INT_ENABLE_RX_UNDERFLOW_LSB) -#define UMBOX_INT_ENABLE_RX_UNDERFLOW_SET(x) (((x) << UMBOX_INT_ENABLE_RX_UNDERFLOW_LSB) & UMBOX_INT_ENABLE_RX_UNDERFLOW_MASK) -#define UMBOX_INT_ENABLE_TX_NOT_EMPTY_MSB 1 -#define UMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB 1 -#define UMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK 0x00000002 -#define UMBOX_INT_ENABLE_TX_NOT_EMPTY_GET(x) (((x) & UMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) >> UMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) -#define UMBOX_INT_ENABLE_TX_NOT_EMPTY_SET(x) (((x) << UMBOX_INT_ENABLE_TX_NOT_EMPTY_LSB) & UMBOX_INT_ENABLE_TX_NOT_EMPTY_MASK) -#define UMBOX_INT_ENABLE_RX_NOT_FULL_MSB 0 -#define UMBOX_INT_ENABLE_RX_NOT_FULL_LSB 0 -#define UMBOX_INT_ENABLE_RX_NOT_FULL_MASK 0x00000001 -#define UMBOX_INT_ENABLE_RX_NOT_FULL_GET(x) (((x) & UMBOX_INT_ENABLE_RX_NOT_FULL_MASK) >> UMBOX_INT_ENABLE_RX_NOT_FULL_LSB) -#define UMBOX_INT_ENABLE_RX_NOT_FULL_SET(x) (((x) << UMBOX_INT_ENABLE_RX_NOT_FULL_LSB) & UMBOX_INT_ENABLE_RX_NOT_FULL_MASK) - -#define UMBOX_DEBUG_ADDRESS 0x0000002c -#define UMBOX_DEBUG_OFFSET 0x0000002c -#define UMBOX_DEBUG_SEL_MSB 2 -#define UMBOX_DEBUG_SEL_LSB 0 -#define UMBOX_DEBUG_SEL_MASK 0x00000007 -#define UMBOX_DEBUG_SEL_GET(x) (((x) & UMBOX_DEBUG_SEL_MASK) >> UMBOX_DEBUG_SEL_LSB) -#define UMBOX_DEBUG_SEL_SET(x) (((x) << UMBOX_DEBUG_SEL_LSB) & UMBOX_DEBUG_SEL_MASK) - -#define UMBOX_FIFO_RESET_ADDRESS 0x00000030 -#define UMBOX_FIFO_RESET_OFFSET 0x00000030 -#define UMBOX_FIFO_RESET_INIT_MSB 0 -#define UMBOX_FIFO_RESET_INIT_LSB 0 -#define UMBOX_FIFO_RESET_INIT_MASK 0x00000001 -#define UMBOX_FIFO_RESET_INIT_GET(x) (((x) & UMBOX_FIFO_RESET_INIT_MASK) >> UMBOX_FIFO_RESET_INIT_LSB) -#define UMBOX_FIFO_RESET_INIT_SET(x) (((x) << UMBOX_FIFO_RESET_INIT_LSB) & UMBOX_FIFO_RESET_INIT_MASK) - -#define UMBOX_HCI_FRAMER_ADDRESS 0x00000034 -#define UMBOX_HCI_FRAMER_OFFSET 0x00000034 -#define UMBOX_HCI_FRAMER_CRC_OVERRIDE_MSB 6 -#define UMBOX_HCI_FRAMER_CRC_OVERRIDE_LSB 6 -#define UMBOX_HCI_FRAMER_CRC_OVERRIDE_MASK 0x00000040 -#define UMBOX_HCI_FRAMER_CRC_OVERRIDE_GET(x) (((x) & UMBOX_HCI_FRAMER_CRC_OVERRIDE_MASK) >> UMBOX_HCI_FRAMER_CRC_OVERRIDE_LSB) -#define UMBOX_HCI_FRAMER_CRC_OVERRIDE_SET(x) (((x) << UMBOX_HCI_FRAMER_CRC_OVERRIDE_LSB) & UMBOX_HCI_FRAMER_CRC_OVERRIDE_MASK) -#define UMBOX_HCI_FRAMER_ENABLE_MSB 5 -#define UMBOX_HCI_FRAMER_ENABLE_LSB 5 -#define UMBOX_HCI_FRAMER_ENABLE_MASK 0x00000020 -#define UMBOX_HCI_FRAMER_ENABLE_GET(x) (((x) & UMBOX_HCI_FRAMER_ENABLE_MASK) >> UMBOX_HCI_FRAMER_ENABLE_LSB) -#define UMBOX_HCI_FRAMER_ENABLE_SET(x) (((x) << UMBOX_HCI_FRAMER_ENABLE_LSB) & UMBOX_HCI_FRAMER_ENABLE_MASK) -#define UMBOX_HCI_FRAMER_SYNC_ERROR_MSB 4 -#define UMBOX_HCI_FRAMER_SYNC_ERROR_LSB 4 -#define UMBOX_HCI_FRAMER_SYNC_ERROR_MASK 0x00000010 -#define UMBOX_HCI_FRAMER_SYNC_ERROR_GET(x) (((x) & UMBOX_HCI_FRAMER_SYNC_ERROR_MASK) >> UMBOX_HCI_FRAMER_SYNC_ERROR_LSB) -#define UMBOX_HCI_FRAMER_SYNC_ERROR_SET(x) (((x) << UMBOX_HCI_FRAMER_SYNC_ERROR_LSB) & UMBOX_HCI_FRAMER_SYNC_ERROR_MASK) -#define UMBOX_HCI_FRAMER_UNDERFLOW_MSB 3 -#define UMBOX_HCI_FRAMER_UNDERFLOW_LSB 3 -#define UMBOX_HCI_FRAMER_UNDERFLOW_MASK 0x00000008 -#define UMBOX_HCI_FRAMER_UNDERFLOW_GET(x) (((x) & UMBOX_HCI_FRAMER_UNDERFLOW_MASK) >> UMBOX_HCI_FRAMER_UNDERFLOW_LSB) -#define UMBOX_HCI_FRAMER_UNDERFLOW_SET(x) (((x) << UMBOX_HCI_FRAMER_UNDERFLOW_LSB) & UMBOX_HCI_FRAMER_UNDERFLOW_MASK) -#define UMBOX_HCI_FRAMER_OVERFLOW_MSB 2 -#define UMBOX_HCI_FRAMER_OVERFLOW_LSB 2 -#define UMBOX_HCI_FRAMER_OVERFLOW_MASK 0x00000004 -#define UMBOX_HCI_FRAMER_OVERFLOW_GET(x) (((x) & UMBOX_HCI_FRAMER_OVERFLOW_MASK) >> UMBOX_HCI_FRAMER_OVERFLOW_LSB) -#define UMBOX_HCI_FRAMER_OVERFLOW_SET(x) (((x) << UMBOX_HCI_FRAMER_OVERFLOW_LSB) & UMBOX_HCI_FRAMER_OVERFLOW_MASK) -#define UMBOX_HCI_FRAMER_CONFIG_MODE_MSB 1 -#define UMBOX_HCI_FRAMER_CONFIG_MODE_LSB 0 -#define UMBOX_HCI_FRAMER_CONFIG_MODE_MASK 0x00000003 -#define UMBOX_HCI_FRAMER_CONFIG_MODE_GET(x) (((x) & UMBOX_HCI_FRAMER_CONFIG_MODE_MASK) >> UMBOX_HCI_FRAMER_CONFIG_MODE_LSB) -#define UMBOX_HCI_FRAMER_CONFIG_MODE_SET(x) (((x) << UMBOX_HCI_FRAMER_CONFIG_MODE_LSB) & UMBOX_HCI_FRAMER_CONFIG_MODE_MASK) - - -#ifndef __ASSEMBLER__ - -typedef struct umbox_wlan_reg_reg_s { - volatile unsigned int umbox_fifo[2]; - volatile unsigned int umbox_fifo_status; - volatile unsigned int umbox_dma_policy; - volatile unsigned int umbox0_dma_rx_descriptor_base; - volatile unsigned int umbox0_dma_rx_control; - volatile unsigned int umbox0_dma_tx_descriptor_base; - volatile unsigned int umbox0_dma_tx_control; - volatile unsigned int umbox_fifo_timeout; - volatile unsigned int umbox_int_status; - volatile unsigned int umbox_int_enable; - volatile unsigned int umbox_debug; - volatile unsigned int umbox_fifo_reset; - volatile unsigned int umbox_hci_framer; -} umbox_wlan_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _UMBOX_WLAN_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/usb_cast_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/usb_cast_reg.h deleted file mode 100644 index 91af22da0080..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/usb_cast_reg.h +++ /dev/null @@ -1,1387 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - - -#ifndef _USB_CAST_REG_REG_H_ -#define _USB_CAST_REG_REG_H_ - -#define ENDP0_ADDRESS 0x00000000 -#define ENDP0_OFFSET 0x00000000 -#define ENDP0_CHGSETUP_MSB 23 -#define ENDP0_CHGSETUP_LSB 23 -#define ENDP0_CHGSETUP_MASK 0x00800000 -#define ENDP0_CHGSETUP_GET(x) (((x) & ENDP0_CHGSETUP_MASK) >> ENDP0_CHGSETUP_LSB) -#define ENDP0_CHGSETUP_SET(x) (((x) << ENDP0_CHGSETUP_LSB) & ENDP0_CHGSETUP_MASK) -#define ENDP0_DSTALL_MSB 20 -#define ENDP0_DSTALL_LSB 20 -#define ENDP0_DSTALL_MASK 0x00100000 -#define ENDP0_DSTALL_GET(x) (((x) & ENDP0_DSTALL_MASK) >> ENDP0_DSTALL_LSB) -#define ENDP0_DSTALL_SET(x) (((x) << ENDP0_DSTALL_LSB) & ENDP0_DSTALL_MASK) -#define ENDP0_HSNAK_MSB 17 -#define ENDP0_HSNAK_LSB 17 -#define ENDP0_HSNAK_MASK 0x00020000 -#define ENDP0_HSNAK_GET(x) (((x) & ENDP0_HSNAK_MASK) >> ENDP0_HSNAK_LSB) -#define ENDP0_HSNAK_SET(x) (((x) << ENDP0_HSNAK_LSB) & ENDP0_HSNAK_MASK) -#define ENDP0_STALL_MSB 16 -#define ENDP0_STALL_LSB 16 -#define ENDP0_STALL_MASK 0x00010000 -#define ENDP0_STALL_GET(x) (((x) & ENDP0_STALL_MASK) >> ENDP0_STALL_LSB) -#define ENDP0_STALL_SET(x) (((x) << ENDP0_STALL_LSB) & ENDP0_STALL_MASK) -#define ENDP0_MAXP_MSB 7 -#define ENDP0_MAXP_LSB 0 -#define ENDP0_MAXP_MASK 0x000000ff -#define ENDP0_MAXP_GET(x) (((x) & ENDP0_MAXP_MASK) >> ENDP0_MAXP_LSB) -#define ENDP0_MAXP_SET(x) (((x) << ENDP0_MAXP_LSB) & ENDP0_MAXP_MASK) - -#define OUT1ENDP_ADDRESS 0x00000008 -#define OUT1ENDP_OFFSET 0x00000008 -#define OUT1ENDP_ISOERR_MSB 24 -#define OUT1ENDP_ISOERR_LSB 24 -#define OUT1ENDP_ISOERR_MASK 0x01000000 -#define OUT1ENDP_ISOERR_GET(x) (((x) & OUT1ENDP_ISOERR_MASK) >> OUT1ENDP_ISOERR_LSB) -#define OUT1ENDP_ISOERR_SET(x) (((x) << OUT1ENDP_ISOERR_LSB) & OUT1ENDP_ISOERR_MASK) -#define OUT1ENDP_VAL_MSB 23 -#define OUT1ENDP_VAL_LSB 23 -#define OUT1ENDP_VAL_MASK 0x00800000 -#define OUT1ENDP_VAL_GET(x) (((x) & OUT1ENDP_VAL_MASK) >> OUT1ENDP_VAL_LSB) -#define OUT1ENDP_VAL_SET(x) (((x) << OUT1ENDP_VAL_LSB) & OUT1ENDP_VAL_MASK) -#define OUT1ENDP_STALL_MSB 22 -#define OUT1ENDP_STALL_LSB 22 -#define OUT1ENDP_STALL_MASK 0x00400000 -#define OUT1ENDP_STALL_GET(x) (((x) & OUT1ENDP_STALL_MASK) >> OUT1ENDP_STALL_LSB) -#define OUT1ENDP_STALL_SET(x) (((x) << OUT1ENDP_STALL_LSB) & OUT1ENDP_STALL_MASK) -#define OUT1ENDP_ISOD_MSB 21 -#define OUT1ENDP_ISOD_LSB 20 -#define OUT1ENDP_ISOD_MASK 0x00300000 -#define OUT1ENDP_ISOD_GET(x) (((x) & OUT1ENDP_ISOD_MASK) >> OUT1ENDP_ISOD_LSB) -#define OUT1ENDP_ISOD_SET(x) (((x) << OUT1ENDP_ISOD_LSB) & OUT1ENDP_ISOD_MASK) -#define OUT1ENDP_TYPE_MSB 19 -#define OUT1ENDP_TYPE_LSB 18 -#define OUT1ENDP_TYPE_MASK 0x000c0000 -#define OUT1ENDP_TYPE_GET(x) (((x) & OUT1ENDP_TYPE_MASK) >> OUT1ENDP_TYPE_LSB) -#define OUT1ENDP_TYPE_SET(x) (((x) << OUT1ENDP_TYPE_LSB) & OUT1ENDP_TYPE_MASK) -#define OUT1ENDP_MAXP_MSB 10 -#define OUT1ENDP_MAXP_LSB 0 -#define OUT1ENDP_MAXP_MASK 0x000007ff -#define OUT1ENDP_MAXP_GET(x) (((x) & OUT1ENDP_MAXP_MASK) >> OUT1ENDP_MAXP_LSB) -#define OUT1ENDP_MAXP_SET(x) (((x) << OUT1ENDP_MAXP_LSB) & OUT1ENDP_MAXP_MASK) - -#define IN1ENDP_ADDRESS 0x0000000c -#define IN1ENDP_OFFSET 0x0000000c -#define IN1ENDP_HCSET_MSB 28 -#define IN1ENDP_HCSET_LSB 28 -#define IN1ENDP_HCSET_MASK 0x10000000 -#define IN1ENDP_HCSET_GET(x) (((x) & IN1ENDP_HCSET_MASK) >> IN1ENDP_HCSET_LSB) -#define IN1ENDP_HCSET_SET(x) (((x) << IN1ENDP_HCSET_LSB) & IN1ENDP_HCSET_MASK) -#define IN1ENDP_ISOERR_MSB 24 -#define IN1ENDP_ISOERR_LSB 24 -#define IN1ENDP_ISOERR_MASK 0x01000000 -#define IN1ENDP_ISOERR_GET(x) (((x) & IN1ENDP_ISOERR_MASK) >> IN1ENDP_ISOERR_LSB) -#define IN1ENDP_ISOERR_SET(x) (((x) << IN1ENDP_ISOERR_LSB) & IN1ENDP_ISOERR_MASK) -#define IN1ENDP_VAL_MSB 23 -#define IN1ENDP_VAL_LSB 23 -#define IN1ENDP_VAL_MASK 0x00800000 -#define IN1ENDP_VAL_GET(x) (((x) & IN1ENDP_VAL_MASK) >> IN1ENDP_VAL_LSB) -#define IN1ENDP_VAL_SET(x) (((x) << IN1ENDP_VAL_LSB) & IN1ENDP_VAL_MASK) -#define IN1ENDP_STALL_MSB 22 -#define IN1ENDP_STALL_LSB 22 -#define IN1ENDP_STALL_MASK 0x00400000 -#define IN1ENDP_STALL_GET(x) (((x) & IN1ENDP_STALL_MASK) >> IN1ENDP_STALL_LSB) -#define IN1ENDP_STALL_SET(x) (((x) << IN1ENDP_STALL_LSB) & IN1ENDP_STALL_MASK) -#define IN1ENDP_ISOD_MSB 21 -#define IN1ENDP_ISOD_LSB 20 -#define IN1ENDP_ISOD_MASK 0x00300000 -#define IN1ENDP_ISOD_GET(x) (((x) & IN1ENDP_ISOD_MASK) >> IN1ENDP_ISOD_LSB) -#define IN1ENDP_ISOD_SET(x) (((x) << IN1ENDP_ISOD_LSB) & IN1ENDP_ISOD_MASK) -#define IN1ENDP_TYPE_MSB 19 -#define IN1ENDP_TYPE_LSB 18 -#define IN1ENDP_TYPE_MASK 0x000c0000 -#define IN1ENDP_TYPE_GET(x) (((x) & IN1ENDP_TYPE_MASK) >> IN1ENDP_TYPE_LSB) -#define IN1ENDP_TYPE_SET(x) (((x) << IN1ENDP_TYPE_LSB) & IN1ENDP_TYPE_MASK) -#define IN1ENDP_MAXP_MSB 10 -#define IN1ENDP_MAXP_LSB 0 -#define IN1ENDP_MAXP_MASK 0x000007ff -#define IN1ENDP_MAXP_GET(x) (((x) & IN1ENDP_MAXP_MASK) >> IN1ENDP_MAXP_LSB) -#define IN1ENDP_MAXP_SET(x) (((x) << IN1ENDP_MAXP_LSB) & IN1ENDP_MAXP_MASK) - -#define OUT2ENDP_ADDRESS 0x00000010 -#define OUT2ENDP_OFFSET 0x00000010 -#define OUT2ENDP_ISOERR_MSB 24 -#define OUT2ENDP_ISOERR_LSB 24 -#define OUT2ENDP_ISOERR_MASK 0x01000000 -#define OUT2ENDP_ISOERR_GET(x) (((x) & OUT2ENDP_ISOERR_MASK) >> OUT2ENDP_ISOERR_LSB) -#define OUT2ENDP_ISOERR_SET(x) (((x) << OUT2ENDP_ISOERR_LSB) & OUT2ENDP_ISOERR_MASK) -#define OUT2ENDP_VAL_MSB 23 -#define OUT2ENDP_VAL_LSB 23 -#define OUT2ENDP_VAL_MASK 0x00800000 -#define OUT2ENDP_VAL_GET(x) (((x) & OUT2ENDP_VAL_MASK) >> OUT2ENDP_VAL_LSB) -#define OUT2ENDP_VAL_SET(x) (((x) << OUT2ENDP_VAL_LSB) & OUT2ENDP_VAL_MASK) -#define OUT2ENDP_STALL_MSB 22 -#define OUT2ENDP_STALL_LSB 22 -#define OUT2ENDP_STALL_MASK 0x00400000 -#define OUT2ENDP_STALL_GET(x) (((x) & OUT2ENDP_STALL_MASK) >> OUT2ENDP_STALL_LSB) -#define OUT2ENDP_STALL_SET(x) (((x) << OUT2ENDP_STALL_LSB) & OUT2ENDP_STALL_MASK) -#define OUT2ENDP_ISOD_MSB 21 -#define OUT2ENDP_ISOD_LSB 20 -#define OUT2ENDP_ISOD_MASK 0x00300000 -#define OUT2ENDP_ISOD_GET(x) (((x) & OUT2ENDP_ISOD_MASK) >> OUT2ENDP_ISOD_LSB) -#define OUT2ENDP_ISOD_SET(x) (((x) << OUT2ENDP_ISOD_LSB) & OUT2ENDP_ISOD_MASK) -#define OUT2ENDP_TYPE_MSB 19 -#define OUT2ENDP_TYPE_LSB 18 -#define OUT2ENDP_TYPE_MASK 0x000c0000 -#define OUT2ENDP_TYPE_GET(x) (((x) & OUT2ENDP_TYPE_MASK) >> OUT2ENDP_TYPE_LSB) -#define OUT2ENDP_TYPE_SET(x) (((x) << OUT2ENDP_TYPE_LSB) & OUT2ENDP_TYPE_MASK) -#define OUT2ENDP_MAXP_MSB 10 -#define OUT2ENDP_MAXP_LSB 0 -#define OUT2ENDP_MAXP_MASK 0x000007ff -#define OUT2ENDP_MAXP_GET(x) (((x) & OUT2ENDP_MAXP_MASK) >> OUT2ENDP_MAXP_LSB) -#define OUT2ENDP_MAXP_SET(x) (((x) << OUT2ENDP_MAXP_LSB) & OUT2ENDP_MAXP_MASK) - -#define IN2ENDP_ADDRESS 0x00000014 -#define IN2ENDP_OFFSET 0x00000014 -#define IN2ENDP_HCSET_MSB 28 -#define IN2ENDP_HCSET_LSB 28 -#define IN2ENDP_HCSET_MASK 0x10000000 -#define IN2ENDP_HCSET_GET(x) (((x) & IN2ENDP_HCSET_MASK) >> IN2ENDP_HCSET_LSB) -#define IN2ENDP_HCSET_SET(x) (((x) << IN2ENDP_HCSET_LSB) & IN2ENDP_HCSET_MASK) -#define IN2ENDP_ISOERR_MSB 24 -#define IN2ENDP_ISOERR_LSB 24 -#define IN2ENDP_ISOERR_MASK 0x01000000 -#define IN2ENDP_ISOERR_GET(x) (((x) & IN2ENDP_ISOERR_MASK) >> IN2ENDP_ISOERR_LSB) -#define IN2ENDP_ISOERR_SET(x) (((x) << IN2ENDP_ISOERR_LSB) & IN2ENDP_ISOERR_MASK) -#define IN2ENDP_VAL_MSB 23 -#define IN2ENDP_VAL_LSB 23 -#define IN2ENDP_VAL_MASK 0x00800000 -#define IN2ENDP_VAL_GET(x) (((x) & IN2ENDP_VAL_MASK) >> IN2ENDP_VAL_LSB) -#define IN2ENDP_VAL_SET(x) (((x) << IN2ENDP_VAL_LSB) & IN2ENDP_VAL_MASK) -#define IN2ENDP_STALL_MSB 22 -#define IN2ENDP_STALL_LSB 22 -#define IN2ENDP_STALL_MASK 0x00400000 -#define IN2ENDP_STALL_GET(x) (((x) & IN2ENDP_STALL_MASK) >> IN2ENDP_STALL_LSB) -#define IN2ENDP_STALL_SET(x) (((x) << IN2ENDP_STALL_LSB) & IN2ENDP_STALL_MASK) -#define IN2ENDP_ISOD_MSB 21 -#define IN2ENDP_ISOD_LSB 20 -#define IN2ENDP_ISOD_MASK 0x00300000 -#define IN2ENDP_ISOD_GET(x) (((x) & IN2ENDP_ISOD_MASK) >> IN2ENDP_ISOD_LSB) -#define IN2ENDP_ISOD_SET(x) (((x) << IN2ENDP_ISOD_LSB) & IN2ENDP_ISOD_MASK) -#define IN2ENDP_TYPE_MSB 19 -#define IN2ENDP_TYPE_LSB 18 -#define IN2ENDP_TYPE_MASK 0x000c0000 -#define IN2ENDP_TYPE_GET(x) (((x) & IN2ENDP_TYPE_MASK) >> IN2ENDP_TYPE_LSB) -#define IN2ENDP_TYPE_SET(x) (((x) << IN2ENDP_TYPE_LSB) & IN2ENDP_TYPE_MASK) -#define IN2ENDP_MAXP_MSB 10 -#define IN2ENDP_MAXP_LSB 0 -#define IN2ENDP_MAXP_MASK 0x000007ff -#define IN2ENDP_MAXP_GET(x) (((x) & IN2ENDP_MAXP_MASK) >> IN2ENDP_MAXP_LSB) -#define IN2ENDP_MAXP_SET(x) (((x) << IN2ENDP_MAXP_LSB) & IN2ENDP_MAXP_MASK) - -#define OUT3ENDP_ADDRESS 0x00000018 -#define OUT3ENDP_OFFSET 0x00000018 -#define OUT3ENDP_ISOERR_MSB 24 -#define OUT3ENDP_ISOERR_LSB 24 -#define OUT3ENDP_ISOERR_MASK 0x01000000 -#define OUT3ENDP_ISOERR_GET(x) (((x) & OUT3ENDP_ISOERR_MASK) >> OUT3ENDP_ISOERR_LSB) -#define OUT3ENDP_ISOERR_SET(x) (((x) << OUT3ENDP_ISOERR_LSB) & OUT3ENDP_ISOERR_MASK) -#define OUT3ENDP_VAL_MSB 23 -#define OUT3ENDP_VAL_LSB 23 -#define OUT3ENDP_VAL_MASK 0x00800000 -#define OUT3ENDP_VAL_GET(x) (((x) & OUT3ENDP_VAL_MASK) >> OUT3ENDP_VAL_LSB) -#define OUT3ENDP_VAL_SET(x) (((x) << OUT3ENDP_VAL_LSB) & OUT3ENDP_VAL_MASK) -#define OUT3ENDP_STALL_MSB 22 -#define OUT3ENDP_STALL_LSB 22 -#define OUT3ENDP_STALL_MASK 0x00400000 -#define OUT3ENDP_STALL_GET(x) (((x) & OUT3ENDP_STALL_MASK) >> OUT3ENDP_STALL_LSB) -#define OUT3ENDP_STALL_SET(x) (((x) << OUT3ENDP_STALL_LSB) & OUT3ENDP_STALL_MASK) -#define OUT3ENDP_ISOD_MSB 21 -#define OUT3ENDP_ISOD_LSB 20 -#define OUT3ENDP_ISOD_MASK 0x00300000 -#define OUT3ENDP_ISOD_GET(x) (((x) & OUT3ENDP_ISOD_MASK) >> OUT3ENDP_ISOD_LSB) -#define OUT3ENDP_ISOD_SET(x) (((x) << OUT3ENDP_ISOD_LSB) & OUT3ENDP_ISOD_MASK) -#define OUT3ENDP_TYPE_MSB 19 -#define OUT3ENDP_TYPE_LSB 18 -#define OUT3ENDP_TYPE_MASK 0x000c0000 -#define OUT3ENDP_TYPE_GET(x) (((x) & OUT3ENDP_TYPE_MASK) >> OUT3ENDP_TYPE_LSB) -#define OUT3ENDP_TYPE_SET(x) (((x) << OUT3ENDP_TYPE_LSB) & OUT3ENDP_TYPE_MASK) -#define OUT3ENDP_MAXP_MSB 10 -#define OUT3ENDP_MAXP_LSB 0 -#define OUT3ENDP_MAXP_MASK 0x000007ff -#define OUT3ENDP_MAXP_GET(x) (((x) & OUT3ENDP_MAXP_MASK) >> OUT3ENDP_MAXP_LSB) -#define OUT3ENDP_MAXP_SET(x) (((x) << OUT3ENDP_MAXP_LSB) & OUT3ENDP_MAXP_MASK) - -#define IN3ENDP_ADDRESS 0x0000001c -#define IN3ENDP_OFFSET 0x0000001c -#define IN3ENDP_HCSET_MSB 28 -#define IN3ENDP_HCSET_LSB 28 -#define IN3ENDP_HCSET_MASK 0x10000000 -#define IN3ENDP_HCSET_GET(x) (((x) & IN3ENDP_HCSET_MASK) >> IN3ENDP_HCSET_LSB) -#define IN3ENDP_HCSET_SET(x) (((x) << IN3ENDP_HCSET_LSB) & IN3ENDP_HCSET_MASK) -#define IN3ENDP_ISOERR_MSB 24 -#define IN3ENDP_ISOERR_LSB 24 -#define IN3ENDP_ISOERR_MASK 0x01000000 -#define IN3ENDP_ISOERR_GET(x) (((x) & IN3ENDP_ISOERR_MASK) >> IN3ENDP_ISOERR_LSB) -#define IN3ENDP_ISOERR_SET(x) (((x) << IN3ENDP_ISOERR_LSB) & IN3ENDP_ISOERR_MASK) -#define IN3ENDP_VAL_MSB 23 -#define IN3ENDP_VAL_LSB 23 -#define IN3ENDP_VAL_MASK 0x00800000 -#define IN3ENDP_VAL_GET(x) (((x) & IN3ENDP_VAL_MASK) >> IN3ENDP_VAL_LSB) -#define IN3ENDP_VAL_SET(x) (((x) << IN3ENDP_VAL_LSB) & IN3ENDP_VAL_MASK) -#define IN3ENDP_STALL_MSB 22 -#define IN3ENDP_STALL_LSB 22 -#define IN3ENDP_STALL_MASK 0x00400000 -#define IN3ENDP_STALL_GET(x) (((x) & IN3ENDP_STALL_MASK) >> IN3ENDP_STALL_LSB) -#define IN3ENDP_STALL_SET(x) (((x) << IN3ENDP_STALL_LSB) & IN3ENDP_STALL_MASK) -#define IN3ENDP_ISOD_MSB 21 -#define IN3ENDP_ISOD_LSB 20 -#define IN3ENDP_ISOD_MASK 0x00300000 -#define IN3ENDP_ISOD_GET(x) (((x) & IN3ENDP_ISOD_MASK) >> IN3ENDP_ISOD_LSB) -#define IN3ENDP_ISOD_SET(x) (((x) << IN3ENDP_ISOD_LSB) & IN3ENDP_ISOD_MASK) -#define IN3ENDP_TYPE_MSB 19 -#define IN3ENDP_TYPE_LSB 18 -#define IN3ENDP_TYPE_MASK 0x000c0000 -#define IN3ENDP_TYPE_GET(x) (((x) & IN3ENDP_TYPE_MASK) >> IN3ENDP_TYPE_LSB) -#define IN3ENDP_TYPE_SET(x) (((x) << IN3ENDP_TYPE_LSB) & IN3ENDP_TYPE_MASK) -#define IN3ENDP_MAXP_MSB 10 -#define IN3ENDP_MAXP_LSB 0 -#define IN3ENDP_MAXP_MASK 0x000007ff -#define IN3ENDP_MAXP_GET(x) (((x) & IN3ENDP_MAXP_MASK) >> IN3ENDP_MAXP_LSB) -#define IN3ENDP_MAXP_SET(x) (((x) << IN3ENDP_MAXP_LSB) & IN3ENDP_MAXP_MASK) - -#define OUT4ENDP_ADDRESS 0x00000020 -#define OUT4ENDP_OFFSET 0x00000020 -#define OUT4ENDP_ISOERR_MSB 24 -#define OUT4ENDP_ISOERR_LSB 24 -#define OUT4ENDP_ISOERR_MASK 0x01000000 -#define OUT4ENDP_ISOERR_GET(x) (((x) & OUT4ENDP_ISOERR_MASK) >> OUT4ENDP_ISOERR_LSB) -#define OUT4ENDP_ISOERR_SET(x) (((x) << OUT4ENDP_ISOERR_LSB) & OUT4ENDP_ISOERR_MASK) -#define OUT4ENDP_VAL_MSB 23 -#define OUT4ENDP_VAL_LSB 23 -#define OUT4ENDP_VAL_MASK 0x00800000 -#define OUT4ENDP_VAL_GET(x) (((x) & OUT4ENDP_VAL_MASK) >> OUT4ENDP_VAL_LSB) -#define OUT4ENDP_VAL_SET(x) (((x) << OUT4ENDP_VAL_LSB) & OUT4ENDP_VAL_MASK) -#define OUT4ENDP_STALL_MSB 22 -#define OUT4ENDP_STALL_LSB 22 -#define OUT4ENDP_STALL_MASK 0x00400000 -#define OUT4ENDP_STALL_GET(x) (((x) & OUT4ENDP_STALL_MASK) >> OUT4ENDP_STALL_LSB) -#define OUT4ENDP_STALL_SET(x) (((x) << OUT4ENDP_STALL_LSB) & OUT4ENDP_STALL_MASK) -#define OUT4ENDP_ISOD_MSB 21 -#define OUT4ENDP_ISOD_LSB 20 -#define OUT4ENDP_ISOD_MASK 0x00300000 -#define OUT4ENDP_ISOD_GET(x) (((x) & OUT4ENDP_ISOD_MASK) >> OUT4ENDP_ISOD_LSB) -#define OUT4ENDP_ISOD_SET(x) (((x) << OUT4ENDP_ISOD_LSB) & OUT4ENDP_ISOD_MASK) -#define OUT4ENDP_TYPE_MSB 19 -#define OUT4ENDP_TYPE_LSB 18 -#define OUT4ENDP_TYPE_MASK 0x000c0000 -#define OUT4ENDP_TYPE_GET(x) (((x) & OUT4ENDP_TYPE_MASK) >> OUT4ENDP_TYPE_LSB) -#define OUT4ENDP_TYPE_SET(x) (((x) << OUT4ENDP_TYPE_LSB) & OUT4ENDP_TYPE_MASK) -#define OUT4ENDP_MAXP_MSB 10 -#define OUT4ENDP_MAXP_LSB 0 -#define OUT4ENDP_MAXP_MASK 0x000007ff -#define OUT4ENDP_MAXP_GET(x) (((x) & OUT4ENDP_MAXP_MASK) >> OUT4ENDP_MAXP_LSB) -#define OUT4ENDP_MAXP_SET(x) (((x) << OUT4ENDP_MAXP_LSB) & OUT4ENDP_MAXP_MASK) - -#define IN4ENDP_ADDRESS 0x00000024 -#define IN4ENDP_OFFSET 0x00000024 -#define IN4ENDP_HCSET_MSB 28 -#define IN4ENDP_HCSET_LSB 28 -#define IN4ENDP_HCSET_MASK 0x10000000 -#define IN4ENDP_HCSET_GET(x) (((x) & IN4ENDP_HCSET_MASK) >> IN4ENDP_HCSET_LSB) -#define IN4ENDP_HCSET_SET(x) (((x) << IN4ENDP_HCSET_LSB) & IN4ENDP_HCSET_MASK) -#define IN4ENDP_ISOERR_MSB 24 -#define IN4ENDP_ISOERR_LSB 24 -#define IN4ENDP_ISOERR_MASK 0x01000000 -#define IN4ENDP_ISOERR_GET(x) (((x) & IN4ENDP_ISOERR_MASK) >> IN4ENDP_ISOERR_LSB) -#define IN4ENDP_ISOERR_SET(x) (((x) << IN4ENDP_ISOERR_LSB) & IN4ENDP_ISOERR_MASK) -#define IN4ENDP_VAL_MSB 23 -#define IN4ENDP_VAL_LSB 23 -#define IN4ENDP_VAL_MASK 0x00800000 -#define IN4ENDP_VAL_GET(x) (((x) & IN4ENDP_VAL_MASK) >> IN4ENDP_VAL_LSB) -#define IN4ENDP_VAL_SET(x) (((x) << IN4ENDP_VAL_LSB) & IN4ENDP_VAL_MASK) -#define IN4ENDP_STALL_MSB 22 -#define IN4ENDP_STALL_LSB 22 -#define IN4ENDP_STALL_MASK 0x00400000 -#define IN4ENDP_STALL_GET(x) (((x) & IN4ENDP_STALL_MASK) >> IN4ENDP_STALL_LSB) -#define IN4ENDP_STALL_SET(x) (((x) << IN4ENDP_STALL_LSB) & IN4ENDP_STALL_MASK) -#define IN4ENDP_ISOD_MSB 21 -#define IN4ENDP_ISOD_LSB 20 -#define IN4ENDP_ISOD_MASK 0x00300000 -#define IN4ENDP_ISOD_GET(x) (((x) & IN4ENDP_ISOD_MASK) >> IN4ENDP_ISOD_LSB) -#define IN4ENDP_ISOD_SET(x) (((x) << IN4ENDP_ISOD_LSB) & IN4ENDP_ISOD_MASK) -#define IN4ENDP_TYPE_MSB 19 -#define IN4ENDP_TYPE_LSB 18 -#define IN4ENDP_TYPE_MASK 0x000c0000 -#define IN4ENDP_TYPE_GET(x) (((x) & IN4ENDP_TYPE_MASK) >> IN4ENDP_TYPE_LSB) -#define IN4ENDP_TYPE_SET(x) (((x) << IN4ENDP_TYPE_LSB) & IN4ENDP_TYPE_MASK) -#define IN4ENDP_MAXP_MSB 10 -#define IN4ENDP_MAXP_LSB 0 -#define IN4ENDP_MAXP_MASK 0x000007ff -#define IN4ENDP_MAXP_GET(x) (((x) & IN4ENDP_MAXP_MASK) >> IN4ENDP_MAXP_LSB) -#define IN4ENDP_MAXP_SET(x) (((x) << IN4ENDP_MAXP_LSB) & IN4ENDP_MAXP_MASK) - -#define OUT5ENDP_ADDRESS 0x00000028 -#define OUT5ENDP_OFFSET 0x00000028 -#define OUT5ENDP_ISOERR_MSB 24 -#define OUT5ENDP_ISOERR_LSB 24 -#define OUT5ENDP_ISOERR_MASK 0x01000000 -#define OUT5ENDP_ISOERR_GET(x) (((x) & OUT5ENDP_ISOERR_MASK) >> OUT5ENDP_ISOERR_LSB) -#define OUT5ENDP_ISOERR_SET(x) (((x) << OUT5ENDP_ISOERR_LSB) & OUT5ENDP_ISOERR_MASK) -#define OUT5ENDP_VAL_MSB 23 -#define OUT5ENDP_VAL_LSB 23 -#define OUT5ENDP_VAL_MASK 0x00800000 -#define OUT5ENDP_VAL_GET(x) (((x) & OUT5ENDP_VAL_MASK) >> OUT5ENDP_VAL_LSB) -#define OUT5ENDP_VAL_SET(x) (((x) << OUT5ENDP_VAL_LSB) & OUT5ENDP_VAL_MASK) -#define OUT5ENDP_STALL_MSB 22 -#define OUT5ENDP_STALL_LSB 22 -#define OUT5ENDP_STALL_MASK 0x00400000 -#define OUT5ENDP_STALL_GET(x) (((x) & OUT5ENDP_STALL_MASK) >> OUT5ENDP_STALL_LSB) -#define OUT5ENDP_STALL_SET(x) (((x) << OUT5ENDP_STALL_LSB) & OUT5ENDP_STALL_MASK) -#define OUT5ENDP_ISOD_MSB 21 -#define OUT5ENDP_ISOD_LSB 20 -#define OUT5ENDP_ISOD_MASK 0x00300000 -#define OUT5ENDP_ISOD_GET(x) (((x) & OUT5ENDP_ISOD_MASK) >> OUT5ENDP_ISOD_LSB) -#define OUT5ENDP_ISOD_SET(x) (((x) << OUT5ENDP_ISOD_LSB) & OUT5ENDP_ISOD_MASK) -#define OUT5ENDP_TYPE_MSB 19 -#define OUT5ENDP_TYPE_LSB 18 -#define OUT5ENDP_TYPE_MASK 0x000c0000 -#define OUT5ENDP_TYPE_GET(x) (((x) & OUT5ENDP_TYPE_MASK) >> OUT5ENDP_TYPE_LSB) -#define OUT5ENDP_TYPE_SET(x) (((x) << OUT5ENDP_TYPE_LSB) & OUT5ENDP_TYPE_MASK) -#define OUT5ENDP_MAXP_MSB 10 -#define OUT5ENDP_MAXP_LSB 0 -#define OUT5ENDP_MAXP_MASK 0x000007ff -#define OUT5ENDP_MAXP_GET(x) (((x) & OUT5ENDP_MAXP_MASK) >> OUT5ENDP_MAXP_LSB) -#define OUT5ENDP_MAXP_SET(x) (((x) << OUT5ENDP_MAXP_LSB) & OUT5ENDP_MAXP_MASK) - -#define IN5ENDP_ADDRESS 0x0000002c -#define IN5ENDP_OFFSET 0x0000002c -#define IN5ENDP_HCSET_MSB 28 -#define IN5ENDP_HCSET_LSB 28 -#define IN5ENDP_HCSET_MASK 0x10000000 -#define IN5ENDP_HCSET_GET(x) (((x) & IN5ENDP_HCSET_MASK) >> IN5ENDP_HCSET_LSB) -#define IN5ENDP_HCSET_SET(x) (((x) << IN5ENDP_HCSET_LSB) & IN5ENDP_HCSET_MASK) -#define IN5ENDP_ISOERR_MSB 24 -#define IN5ENDP_ISOERR_LSB 24 -#define IN5ENDP_ISOERR_MASK 0x01000000 -#define IN5ENDP_ISOERR_GET(x) (((x) & IN5ENDP_ISOERR_MASK) >> IN5ENDP_ISOERR_LSB) -#define IN5ENDP_ISOERR_SET(x) (((x) << IN5ENDP_ISOERR_LSB) & IN5ENDP_ISOERR_MASK) -#define IN5ENDP_VAL_MSB 23 -#define IN5ENDP_VAL_LSB 23 -#define IN5ENDP_VAL_MASK 0x00800000 -#define IN5ENDP_VAL_GET(x) (((x) & IN5ENDP_VAL_MASK) >> IN5ENDP_VAL_LSB) -#define IN5ENDP_VAL_SET(x) (((x) << IN5ENDP_VAL_LSB) & IN5ENDP_VAL_MASK) -#define IN5ENDP_STALL_MSB 22 -#define IN5ENDP_STALL_LSB 22 -#define IN5ENDP_STALL_MASK 0x00400000 -#define IN5ENDP_STALL_GET(x) (((x) & IN5ENDP_STALL_MASK) >> IN5ENDP_STALL_LSB) -#define IN5ENDP_STALL_SET(x) (((x) << IN5ENDP_STALL_LSB) & IN5ENDP_STALL_MASK) -#define IN5ENDP_ISOD_MSB 21 -#define IN5ENDP_ISOD_LSB 20 -#define IN5ENDP_ISOD_MASK 0x00300000 -#define IN5ENDP_ISOD_GET(x) (((x) & IN5ENDP_ISOD_MASK) >> IN5ENDP_ISOD_LSB) -#define IN5ENDP_ISOD_SET(x) (((x) << IN5ENDP_ISOD_LSB) & IN5ENDP_ISOD_MASK) -#define IN5ENDP_TYPE_MSB 19 -#define IN5ENDP_TYPE_LSB 18 -#define IN5ENDP_TYPE_MASK 0x000c0000 -#define IN5ENDP_TYPE_GET(x) (((x) & IN5ENDP_TYPE_MASK) >> IN5ENDP_TYPE_LSB) -#define IN5ENDP_TYPE_SET(x) (((x) << IN5ENDP_TYPE_LSB) & IN5ENDP_TYPE_MASK) -#define IN5ENDP_MAXP_MSB 10 -#define IN5ENDP_MAXP_LSB 0 -#define IN5ENDP_MAXP_MASK 0x000007ff -#define IN5ENDP_MAXP_GET(x) (((x) & IN5ENDP_MAXP_MASK) >> IN5ENDP_MAXP_LSB) -#define IN5ENDP_MAXP_SET(x) (((x) << IN5ENDP_MAXP_LSB) & IN5ENDP_MAXP_MASK) - -#define USBMODESTATUS_ADDRESS 0x0000008c -#define USBMODESTATUS_OFFSET 0x0000008c -#define USBMODESTATUS_DEVICE_MSB 5 -#define USBMODESTATUS_DEVICE_LSB 5 -#define USBMODESTATUS_DEVICE_MASK 0x00000020 -#define USBMODESTATUS_DEVICE_GET(x) (((x) & USBMODESTATUS_DEVICE_MASK) >> USBMODESTATUS_DEVICE_LSB) -#define USBMODESTATUS_DEVICE_SET(x) (((x) << USBMODESTATUS_DEVICE_LSB) & USBMODESTATUS_DEVICE_MASK) -#define USBMODESTATUS_HOST_MSB 4 -#define USBMODESTATUS_HOST_LSB 4 -#define USBMODESTATUS_HOST_MASK 0x00000010 -#define USBMODESTATUS_HOST_GET(x) (((x) & USBMODESTATUS_HOST_MASK) >> USBMODESTATUS_HOST_LSB) -#define USBMODESTATUS_HOST_SET(x) (((x) << USBMODESTATUS_HOST_LSB) & USBMODESTATUS_HOST_MASK) -#define USBMODESTATUS_HS_MSB 2 -#define USBMODESTATUS_HS_LSB 2 -#define USBMODESTATUS_HS_MASK 0x00000004 -#define USBMODESTATUS_HS_GET(x) (((x) & USBMODESTATUS_HS_MASK) >> USBMODESTATUS_HS_LSB) -#define USBMODESTATUS_HS_SET(x) (((x) << USBMODESTATUS_HS_LSB) & USBMODESTATUS_HS_MASK) -#define USBMODESTATUS_FS_MSB 1 -#define USBMODESTATUS_FS_LSB 1 -#define USBMODESTATUS_FS_MASK 0x00000002 -#define USBMODESTATUS_FS_GET(x) (((x) & USBMODESTATUS_FS_MASK) >> USBMODESTATUS_FS_LSB) -#define USBMODESTATUS_FS_SET(x) (((x) << USBMODESTATUS_FS_LSB) & USBMODESTATUS_FS_MASK) -#define USBMODESTATUS_LS_MSB 0 -#define USBMODESTATUS_LS_LSB 0 -#define USBMODESTATUS_LS_MASK 0x00000001 -#define USBMODESTATUS_LS_GET(x) (((x) & USBMODESTATUS_LS_MASK) >> USBMODESTATUS_LS_LSB) -#define USBMODESTATUS_LS_SET(x) (((x) << USBMODESTATUS_LS_LSB) & USBMODESTATUS_LS_MASK) - -#define EPIRQ_ADDRESS 0x00000188 -#define EPIRQ_OFFSET 0x00000188 -#define EPIRQ_OUTIRQ_MSB 31 -#define EPIRQ_OUTIRQ_LSB 16 -#define EPIRQ_OUTIRQ_MASK 0xffff0000 -#define EPIRQ_OUTIRQ_GET(x) (((x) & EPIRQ_OUTIRQ_MASK) >> EPIRQ_OUTIRQ_LSB) -#define EPIRQ_OUTIRQ_SET(x) (((x) << EPIRQ_OUTIRQ_LSB) & EPIRQ_OUTIRQ_MASK) -#define EPIRQ_INIRQ_MSB 15 -#define EPIRQ_INIRQ_LSB 0 -#define EPIRQ_INIRQ_MASK 0x0000ffff -#define EPIRQ_INIRQ_GET(x) (((x) & EPIRQ_INIRQ_MASK) >> EPIRQ_INIRQ_LSB) -#define EPIRQ_INIRQ_SET(x) (((x) << EPIRQ_INIRQ_LSB) & EPIRQ_INIRQ_MASK) - -#define USBIRQ_ADDRESS 0x0000018c -#define USBIRQ_OFFSET 0x0000018c -#define USBIRQ_OUTPNGIRQ_MSB 31 -#define USBIRQ_OUTPNGIRQ_LSB 16 -#define USBIRQ_OUTPNGIRQ_MASK 0xffff0000 -#define USBIRQ_OUTPNGIRQ_GET(x) (((x) & USBIRQ_OUTPNGIRQ_MASK) >> USBIRQ_OUTPNGIRQ_LSB) -#define USBIRQ_OUTPNGIRQ_SET(x) (((x) << USBIRQ_OUTPNGIRQ_LSB) & USBIRQ_OUTPNGIRQ_MASK) -#define USBIRQ_LPMIR_MSB 7 -#define USBIRQ_LPMIR_LSB 7 -#define USBIRQ_LPMIR_MASK 0x00000080 -#define USBIRQ_LPMIR_GET(x) (((x) & USBIRQ_LPMIR_MASK) >> USBIRQ_LPMIR_LSB) -#define USBIRQ_LPMIR_SET(x) (((x) << USBIRQ_LPMIR_LSB) & USBIRQ_LPMIR_MASK) -#define USBIRQ_OVERFLOWIR_MSB 6 -#define USBIRQ_OVERFLOWIR_LSB 6 -#define USBIRQ_OVERFLOWIR_MASK 0x00000040 -#define USBIRQ_OVERFLOWIR_GET(x) (((x) & USBIRQ_OVERFLOWIR_MASK) >> USBIRQ_OVERFLOWIR_LSB) -#define USBIRQ_OVERFLOWIR_SET(x) (((x) << USBIRQ_OVERFLOWIR_LSB) & USBIRQ_OVERFLOWIR_MASK) -#define USBIRQ_HSPEEDIR_MSB 5 -#define USBIRQ_HSPEEDIR_LSB 5 -#define USBIRQ_HSPEEDIR_MASK 0x00000020 -#define USBIRQ_HSPEEDIR_GET(x) (((x) & USBIRQ_HSPEEDIR_MASK) >> USBIRQ_HSPEEDIR_LSB) -#define USBIRQ_HSPEEDIR_SET(x) (((x) << USBIRQ_HSPEEDIR_LSB) & USBIRQ_HSPEEDIR_MASK) -#define USBIRQ_URESIR_MSB 4 -#define USBIRQ_URESIR_LSB 4 -#define USBIRQ_URESIR_MASK 0x00000010 -#define USBIRQ_URESIR_GET(x) (((x) & USBIRQ_URESIR_MASK) >> USBIRQ_URESIR_LSB) -#define USBIRQ_URESIR_SET(x) (((x) << USBIRQ_URESIR_LSB) & USBIRQ_URESIR_MASK) -#define USBIRQ_SUSPIR_MSB 3 -#define USBIRQ_SUSPIR_LSB 3 -#define USBIRQ_SUSPIR_MASK 0x00000008 -#define USBIRQ_SUSPIR_GET(x) (((x) & USBIRQ_SUSPIR_MASK) >> USBIRQ_SUSPIR_LSB) -#define USBIRQ_SUSPIR_SET(x) (((x) << USBIRQ_SUSPIR_LSB) & USBIRQ_SUSPIR_MASK) -#define USBIRQ_SUTOKIR_MSB 2 -#define USBIRQ_SUTOKIR_LSB 2 -#define USBIRQ_SUTOKIR_MASK 0x00000004 -#define USBIRQ_SUTOKIR_GET(x) (((x) & USBIRQ_SUTOKIR_MASK) >> USBIRQ_SUTOKIR_LSB) -#define USBIRQ_SUTOKIR_SET(x) (((x) << USBIRQ_SUTOKIR_LSB) & USBIRQ_SUTOKIR_MASK) -#define USBIRQ_SOFIR_MSB 1 -#define USBIRQ_SOFIR_LSB 1 -#define USBIRQ_SOFIR_MASK 0x00000002 -#define USBIRQ_SOFIR_GET(x) (((x) & USBIRQ_SOFIR_MASK) >> USBIRQ_SOFIR_LSB) -#define USBIRQ_SOFIR_SET(x) (((x) << USBIRQ_SOFIR_LSB) & USBIRQ_SOFIR_MASK) -#define USBIRQ_SUDAVIR_MSB 0 -#define USBIRQ_SUDAVIR_LSB 0 -#define USBIRQ_SUDAVIR_MASK 0x00000001 -#define USBIRQ_SUDAVIR_GET(x) (((x) & USBIRQ_SUDAVIR_MASK) >> USBIRQ_SUDAVIR_LSB) -#define USBIRQ_SUDAVIR_SET(x) (((x) << USBIRQ_SUDAVIR_LSB) & USBIRQ_SUDAVIR_MASK) - -#define EPIEN_ADDRESS 0x00000194 -#define EPIEN_OFFSET 0x00000194 -#define EPIEN_OUTIEN_MSB 31 -#define EPIEN_OUTIEN_LSB 16 -#define EPIEN_OUTIEN_MASK 0xffff0000 -#define EPIEN_OUTIEN_GET(x) (((x) & EPIEN_OUTIEN_MASK) >> EPIEN_OUTIEN_LSB) -#define EPIEN_OUTIEN_SET(x) (((x) << EPIEN_OUTIEN_LSB) & EPIEN_OUTIEN_MASK) -#define EPIEN_INIEN_MSB 15 -#define EPIEN_INIEN_LSB 0 -#define EPIEN_INIEN_MASK 0x0000ffff -#define EPIEN_INIEN_GET(x) (((x) & EPIEN_INIEN_MASK) >> EPIEN_INIEN_LSB) -#define EPIEN_INIEN_SET(x) (((x) << EPIEN_INIEN_LSB) & EPIEN_INIEN_MASK) - -#define PIEN_ADDRESS 0x00000198 -#define PIEN_OFFSET 0x00000198 -#define PIEN_OUTPIE_MSB 31 -#define PIEN_OUTPIE_LSB 16 -#define PIEN_OUTPIE_MASK 0xffff0000 -#define PIEN_OUTPIE_GET(x) (((x) & PIEN_OUTPIE_MASK) >> PIEN_OUTPIE_LSB) -#define PIEN_OUTPIE_SET(x) (((x) << PIEN_OUTPIE_LSB) & PIEN_OUTPIE_MASK) -#define PIEN_LPMIE_MSB 7 -#define PIEN_LPMIE_LSB 7 -#define PIEN_LPMIE_MASK 0x00000080 -#define PIEN_LPMIE_GET(x) (((x) & PIEN_LPMIE_MASK) >> PIEN_LPMIE_LSB) -#define PIEN_LPMIE_SET(x) (((x) << PIEN_LPMIE_LSB) & PIEN_LPMIE_MASK) -#define PIEN_OVERFLOIE_MSB 6 -#define PIEN_OVERFLOIE_LSB 6 -#define PIEN_OVERFLOIE_MASK 0x00000040 -#define PIEN_OVERFLOIE_GET(x) (((x) & PIEN_OVERFLOIE_MASK) >> PIEN_OVERFLOIE_LSB) -#define PIEN_OVERFLOIE_SET(x) (((x) << PIEN_OVERFLOIE_LSB) & PIEN_OVERFLOIE_MASK) -#define PIEN_HSPEEDIE_MSB 5 -#define PIEN_HSPEEDIE_LSB 5 -#define PIEN_HSPEEDIE_MASK 0x00000020 -#define PIEN_HSPEEDIE_GET(x) (((x) & PIEN_HSPEEDIE_MASK) >> PIEN_HSPEEDIE_LSB) -#define PIEN_HSPEEDIE_SET(x) (((x) << PIEN_HSPEEDIE_LSB) & PIEN_HSPEEDIE_MASK) -#define PIEN_URESIE_MSB 4 -#define PIEN_URESIE_LSB 4 -#define PIEN_URESIE_MASK 0x00000010 -#define PIEN_URESIE_GET(x) (((x) & PIEN_URESIE_MASK) >> PIEN_URESIE_LSB) -#define PIEN_URESIE_SET(x) (((x) << PIEN_URESIE_LSB) & PIEN_URESIE_MASK) -#define PIEN_SUSPIE_MSB 3 -#define PIEN_SUSPIE_LSB 3 -#define PIEN_SUSPIE_MASK 0x00000008 -#define PIEN_SUSPIE_GET(x) (((x) & PIEN_SUSPIE_MASK) >> PIEN_SUSPIE_LSB) -#define PIEN_SUSPIE_SET(x) (((x) << PIEN_SUSPIE_LSB) & PIEN_SUSPIE_MASK) -#define PIEN_SUTOKIE_MSB 2 -#define PIEN_SUTOKIE_LSB 2 -#define PIEN_SUTOKIE_MASK 0x00000004 -#define PIEN_SUTOKIE_GET(x) (((x) & PIEN_SUTOKIE_MASK) >> PIEN_SUTOKIE_LSB) -#define PIEN_SUTOKIE_SET(x) (((x) << PIEN_SUTOKIE_LSB) & PIEN_SUTOKIE_MASK) -#define PIEN_SOFIE_MSB 1 -#define PIEN_SOFIE_LSB 1 -#define PIEN_SOFIE_MASK 0x00000002 -#define PIEN_SOFIE_GET(x) (((x) & PIEN_SOFIE_MASK) >> PIEN_SOFIE_LSB) -#define PIEN_SOFIE_SET(x) (((x) << PIEN_SOFIE_LSB) & PIEN_SOFIE_MASK) -#define PIEN_SUDAVIE_MSB 0 -#define PIEN_SUDAVIE_LSB 0 -#define PIEN_SUDAVIE_MASK 0x00000001 -#define PIEN_SUDAVIE_GET(x) (((x) & PIEN_SUDAVIE_MASK) >> PIEN_SUDAVIE_LSB) -#define PIEN_SUDAVIE_SET(x) (((x) << PIEN_SUDAVIE_LSB) & PIEN_SUDAVIE_MASK) - -#define FNCTRL_ADDRESS 0x000001a4 -#define FNCTRL_OFFSET 0x000001a4 -#define FNCTRL_CLKGATE_MSB 31 -#define FNCTRL_CLKGATE_LSB 24 -#define FNCTRL_CLKGATE_MASK 0xff000000 -#define FNCTRL_CLKGATE_GET(x) (((x) & FNCTRL_CLKGATE_MASK) >> FNCTRL_CLKGATE_LSB) -#define FNCTRL_CLKGATE_SET(x) (((x) << FNCTRL_CLKGATE_LSB) & FNCTRL_CLKGATE_MASK) -#define FNCTRL_FNADDR_MSB 22 -#define FNCTRL_FNADDR_LSB 16 -#define FNCTRL_FNADDR_MASK 0x007f0000 -#define FNCTRL_FNADDR_GET(x) (((x) & FNCTRL_FNADDR_MASK) >> FNCTRL_FNADDR_LSB) -#define FNCTRL_FNADDR_SET(x) (((x) << FNCTRL_FNADDR_LSB) & FNCTRL_FNADDR_MASK) -#define FNCTRL_FRMNR1_MSB 13 -#define FNCTRL_FRMNR1_LSB 8 -#define FNCTRL_FRMNR1_MASK 0x00003f00 -#define FNCTRL_FRMNR1_GET(x) (((x) & FNCTRL_FRMNR1_MASK) >> FNCTRL_FRMNR1_LSB) -#define FNCTRL_FRMNR1_SET(x) (((x) << FNCTRL_FRMNR1_LSB) & FNCTRL_FRMNR1_MASK) -#define FNCTRL_FRMNR0_MSB 7 -#define FNCTRL_FRMNR0_LSB 3 -#define FNCTRL_FRMNR0_MASK 0x000000f8 -#define FNCTRL_FRMNR0_GET(x) (((x) & FNCTRL_FRMNR0_MASK) >> FNCTRL_FRMNR0_LSB) -#define FNCTRL_FRMNR0_SET(x) (((x) << FNCTRL_FRMNR0_LSB) & FNCTRL_FRMNR0_MASK) -#define FNCTRL_MFR_MSB 2 -#define FNCTRL_MFR_LSB 0 -#define FNCTRL_MFR_MASK 0x00000007 -#define FNCTRL_MFR_GET(x) (((x) & FNCTRL_MFR_MASK) >> FNCTRL_MFR_LSB) -#define FNCTRL_MFR_SET(x) (((x) << FNCTRL_MFR_LSB) & FNCTRL_MFR_MASK) - -#define OTGREG_ADDRESS 0x000001bc -#define OTGREG_OFFSET 0x000001bc -#define OTGREG_OTGSTATUS_ID_MSB 30 -#define OTGREG_OTGSTATUS_ID_LSB 30 -#define OTGREG_OTGSTATUS_ID_MASK 0x40000000 -#define OTGREG_OTGSTATUS_ID_GET(x) (((x) & OTGREG_OTGSTATUS_ID_MASK) >> OTGREG_OTGSTATUS_ID_LSB) -#define OTGREG_OTGSTATUS_ID_SET(x) (((x) << OTGREG_OTGSTATUS_ID_LSB) & OTGREG_OTGSTATUS_ID_MASK) -#define OTGREG_OTGSTATUS_AVBUSVAL_MSB 29 -#define OTGREG_OTGSTATUS_AVBUSVAL_LSB 29 -#define OTGREG_OTGSTATUS_AVBUSVAL_MASK 0x20000000 -#define OTGREG_OTGSTATUS_AVBUSVAL_GET(x) (((x) & OTGREG_OTGSTATUS_AVBUSVAL_MASK) >> OTGREG_OTGSTATUS_AVBUSVAL_LSB) -#define OTGREG_OTGSTATUS_AVBUSVAL_SET(x) (((x) << OTGREG_OTGSTATUS_AVBUSVAL_LSB) & OTGREG_OTGSTATUS_AVBUSVAL_MASK) -#define OTGREG_OTGSTATUS_BSESSEND_MSB 28 -#define OTGREG_OTGSTATUS_BSESSEND_LSB 28 -#define OTGREG_OTGSTATUS_BSESSEND_MASK 0x10000000 -#define OTGREG_OTGSTATUS_BSESSEND_GET(x) (((x) & OTGREG_OTGSTATUS_BSESSEND_MASK) >> OTGREG_OTGSTATUS_BSESSEND_LSB) -#define OTGREG_OTGSTATUS_BSESSEND_SET(x) (((x) << OTGREG_OTGSTATUS_BSESSEND_LSB) & OTGREG_OTGSTATUS_BSESSEND_MASK) -#define OTGREG_OTGSTATUS_ASESSVAL_MSB 27 -#define OTGREG_OTGSTATUS_ASESSVAL_LSB 27 -#define OTGREG_OTGSTATUS_ASESSVAL_MASK 0x08000000 -#define OTGREG_OTGSTATUS_ASESSVAL_GET(x) (((x) & OTGREG_OTGSTATUS_ASESSVAL_MASK) >> OTGREG_OTGSTATUS_ASESSVAL_LSB) -#define OTGREG_OTGSTATUS_ASESSVAL_SET(x) (((x) << OTGREG_OTGSTATUS_ASESSVAL_LSB) & OTGREG_OTGSTATUS_ASESSVAL_MASK) -#define OTGREG_OTGSTATUS_CONN_MSB 25 -#define OTGREG_OTGSTATUS_CONN_LSB 25 -#define OTGREG_OTGSTATUS_CONN_MASK 0x02000000 -#define OTGREG_OTGSTATUS_CONN_GET(x) (((x) & OTGREG_OTGSTATUS_CONN_MASK) >> OTGREG_OTGSTATUS_CONN_LSB) -#define OTGREG_OTGSTATUS_CONN_SET(x) (((x) << OTGREG_OTGSTATUS_CONN_LSB) & OTGREG_OTGSTATUS_CONN_MASK) -#define OTGREG_OTGSTATUS_BSE0SRP_MSB 24 -#define OTGREG_OTGSTATUS_BSE0SRP_LSB 24 -#define OTGREG_OTGSTATUS_BSE0SRP_MASK 0x01000000 -#define OTGREG_OTGSTATUS_BSE0SRP_GET(x) (((x) & OTGREG_OTGSTATUS_BSE0SRP_MASK) >> OTGREG_OTGSTATUS_BSE0SRP_LSB) -#define OTGREG_OTGSTATUS_BSE0SRP_SET(x) (((x) << OTGREG_OTGSTATUS_BSE0SRP_LSB) & OTGREG_OTGSTATUS_BSE0SRP_MASK) -#define OTGREG_OTGCTRL_FORCEBCONN_MSB 23 -#define OTGREG_OTGCTRL_FORCEBCONN_LSB 23 -#define OTGREG_OTGCTRL_FORCEBCONN_MASK 0x00800000 -#define OTGREG_OTGCTRL_FORCEBCONN_GET(x) (((x) & OTGREG_OTGCTRL_FORCEBCONN_MASK) >> OTGREG_OTGCTRL_FORCEBCONN_LSB) -#define OTGREG_OTGCTRL_FORCEBCONN_SET(x) (((x) << OTGREG_OTGCTRL_FORCEBCONN_LSB) & OTGREG_OTGCTRL_FORCEBCONN_MASK) -#define OTGREG_OTGCTRL_SRPDATDETEN_MSB 21 -#define OTGREG_OTGCTRL_SRPDATDETEN_LSB 21 -#define OTGREG_OTGCTRL_SRPDATDETEN_MASK 0x00200000 -#define OTGREG_OTGCTRL_SRPDATDETEN_GET(x) (((x) & OTGREG_OTGCTRL_SRPDATDETEN_MASK) >> OTGREG_OTGCTRL_SRPDATDETEN_LSB) -#define OTGREG_OTGCTRL_SRPDATDETEN_SET(x) (((x) << OTGREG_OTGCTRL_SRPDATDETEN_LSB) & OTGREG_OTGCTRL_SRPDATDETEN_MASK) -#define OTGREG_OTGCTRL_SRPVBUSDETEN_MSB 20 -#define OTGREG_OTGCTRL_SRPVBUSDETEN_LSB 20 -#define OTGREG_OTGCTRL_SRPVBUSDETEN_MASK 0x00100000 -#define OTGREG_OTGCTRL_SRPVBUSDETEN_GET(x) (((x) & OTGREG_OTGCTRL_SRPVBUSDETEN_MASK) >> OTGREG_OTGCTRL_SRPVBUSDETEN_LSB) -#define OTGREG_OTGCTRL_SRPVBUSDETEN_SET(x) (((x) << OTGREG_OTGCTRL_SRPVBUSDETEN_LSB) & OTGREG_OTGCTRL_SRPVBUSDETEN_MASK) -#define OTGREG_OTGCTRL_BHNPEN_MSB 19 -#define OTGREG_OTGCTRL_BHNPEN_LSB 19 -#define OTGREG_OTGCTRL_BHNPEN_MASK 0x00080000 -#define OTGREG_OTGCTRL_BHNPEN_GET(x) (((x) & OTGREG_OTGCTRL_BHNPEN_MASK) >> OTGREG_OTGCTRL_BHNPEN_LSB) -#define OTGREG_OTGCTRL_BHNPEN_SET(x) (((x) << OTGREG_OTGCTRL_BHNPEN_LSB) & OTGREG_OTGCTRL_BHNPEN_MASK) -#define OTGREG_OTGCTRL_ASETBHNPEN_MSB 18 -#define OTGREG_OTGCTRL_ASETBHNPEN_LSB 18 -#define OTGREG_OTGCTRL_ASETBHNPEN_MASK 0x00040000 -#define OTGREG_OTGCTRL_ASETBHNPEN_GET(x) (((x) & OTGREG_OTGCTRL_ASETBHNPEN_MASK) >> OTGREG_OTGCTRL_ASETBHNPEN_LSB) -#define OTGREG_OTGCTRL_ASETBHNPEN_SET(x) (((x) << OTGREG_OTGCTRL_ASETBHNPEN_LSB) & OTGREG_OTGCTRL_ASETBHNPEN_MASK) -#define OTGREG_OTGCTRL_ABUSDROP_MSB 17 -#define OTGREG_OTGCTRL_ABUSDROP_LSB 17 -#define OTGREG_OTGCTRL_ABUSDROP_MASK 0x00020000 -#define OTGREG_OTGCTRL_ABUSDROP_GET(x) (((x) & OTGREG_OTGCTRL_ABUSDROP_MASK) >> OTGREG_OTGCTRL_ABUSDROP_LSB) -#define OTGREG_OTGCTRL_ABUSDROP_SET(x) (((x) << OTGREG_OTGCTRL_ABUSDROP_LSB) & OTGREG_OTGCTRL_ABUSDROP_MASK) -#define OTGREG_OTGCTRL_BUSREQ_MSB 16 -#define OTGREG_OTGCTRL_BUSREQ_LSB 16 -#define OTGREG_OTGCTRL_BUSREQ_MASK 0x00010000 -#define OTGREG_OTGCTRL_BUSREQ_GET(x) (((x) & OTGREG_OTGCTRL_BUSREQ_MASK) >> OTGREG_OTGCTRL_BUSREQ_LSB) -#define OTGREG_OTGCTRL_BUSREQ_SET(x) (((x) << OTGREG_OTGCTRL_BUSREQ_LSB) & OTGREG_OTGCTRL_BUSREQ_MASK) -#define OTGREG_OTGSTATE_MSB 11 -#define OTGREG_OTGSTATE_LSB 8 -#define OTGREG_OTGSTATE_MASK 0x00000f00 -#define OTGREG_OTGSTATE_GET(x) (((x) & OTGREG_OTGSTATE_MASK) >> OTGREG_OTGSTATE_LSB) -#define OTGREG_OTGSTATE_SET(x) (((x) << OTGREG_OTGSTATE_LSB) & OTGREG_OTGSTATE_MASK) -#define OTGREG_OTGIRQ_PERIPHIRQ_MSB 4 -#define OTGREG_OTGIRQ_PERIPHIRQ_LSB 4 -#define OTGREG_OTGIRQ_PERIPHIRQ_MASK 0x00000010 -#define OTGREG_OTGIRQ_PERIPHIRQ_GET(x) (((x) & OTGREG_OTGIRQ_PERIPHIRQ_MASK) >> OTGREG_OTGIRQ_PERIPHIRQ_LSB) -#define OTGREG_OTGIRQ_PERIPHIRQ_SET(x) (((x) << OTGREG_OTGIRQ_PERIPHIRQ_LSB) & OTGREG_OTGIRQ_PERIPHIRQ_MASK) -#define OTGREG_OTGIRQ_VBUSERRIRQ_MSB 3 -#define OTGREG_OTGIRQ_VBUSERRIRQ_LSB 3 -#define OTGREG_OTGIRQ_VBUSERRIRQ_MASK 0x00000008 -#define OTGREG_OTGIRQ_VBUSERRIRQ_GET(x) (((x) & OTGREG_OTGIRQ_VBUSERRIRQ_MASK) >> OTGREG_OTGIRQ_VBUSERRIRQ_LSB) -#define OTGREG_OTGIRQ_VBUSERRIRQ_SET(x) (((x) << OTGREG_OTGIRQ_VBUSERRIRQ_LSB) & OTGREG_OTGIRQ_VBUSERRIRQ_MASK) -#define OTGREG_OTGIRQ_LOCSOFIRQ_MSB 2 -#define OTGREG_OTGIRQ_LOCSOFIRQ_LSB 2 -#define OTGREG_OTGIRQ_LOCSOFIRQ_MASK 0x00000004 -#define OTGREG_OTGIRQ_LOCSOFIRQ_GET(x) (((x) & OTGREG_OTGIRQ_LOCSOFIRQ_MASK) >> OTGREG_OTGIRQ_LOCSOFIRQ_LSB) -#define OTGREG_OTGIRQ_LOCSOFIRQ_SET(x) (((x) << OTGREG_OTGIRQ_LOCSOFIRQ_LSB) & OTGREG_OTGIRQ_LOCSOFIRQ_MASK) -#define OTGREG_OTGIRQ_SRPDETIRQ_MSB 1 -#define OTGREG_OTGIRQ_SRPDETIRQ_LSB 1 -#define OTGREG_OTGIRQ_SRPDETIRQ_MASK 0x00000002 -#define OTGREG_OTGIRQ_SRPDETIRQ_GET(x) (((x) & OTGREG_OTGIRQ_SRPDETIRQ_MASK) >> OTGREG_OTGIRQ_SRPDETIRQ_LSB) -#define OTGREG_OTGIRQ_SRPDETIRQ_SET(x) (((x) << OTGREG_OTGIRQ_SRPDETIRQ_LSB) & OTGREG_OTGIRQ_SRPDETIRQ_MASK) -#define OTGREG_OTGIRQ_IDLEIRQ_MSB 0 -#define OTGREG_OTGIRQ_IDLEIRQ_LSB 0 -#define OTGREG_OTGIRQ_IDLEIRQ_MASK 0x00000001 -#define OTGREG_OTGIRQ_IDLEIRQ_GET(x) (((x) & OTGREG_OTGIRQ_IDLEIRQ_MASK) >> OTGREG_OTGIRQ_IDLEIRQ_LSB) -#define OTGREG_OTGIRQ_IDLEIRQ_SET(x) (((x) << OTGREG_OTGIRQ_IDLEIRQ_LSB) & OTGREG_OTGIRQ_IDLEIRQ_MASK) - -#define DMASTART_ADDRESS 0x000001cc -#define DMASTART_OFFSET 0x000001cc -#define DMASTART_OUT15_MSB 31 -#define DMASTART_OUT15_LSB 31 -#define DMASTART_OUT15_MASK 0x80000000 -#define DMASTART_OUT15_GET(x) (((x) & DMASTART_OUT15_MASK) >> DMASTART_OUT15_LSB) -#define DMASTART_OUT15_SET(x) (((x) << DMASTART_OUT15_LSB) & DMASTART_OUT15_MASK) -#define DMASTART_OUT14_MSB 30 -#define DMASTART_OUT14_LSB 30 -#define DMASTART_OUT14_MASK 0x40000000 -#define DMASTART_OUT14_GET(x) (((x) & DMASTART_OUT14_MASK) >> DMASTART_OUT14_LSB) -#define DMASTART_OUT14_SET(x) (((x) << DMASTART_OUT14_LSB) & DMASTART_OUT14_MASK) -#define DMASTART_OUT13_MSB 29 -#define DMASTART_OUT13_LSB 29 -#define DMASTART_OUT13_MASK 0x20000000 -#define DMASTART_OUT13_GET(x) (((x) & DMASTART_OUT13_MASK) >> DMASTART_OUT13_LSB) -#define DMASTART_OUT13_SET(x) (((x) << DMASTART_OUT13_LSB) & DMASTART_OUT13_MASK) -#define DMASTART_OUT12_MSB 28 -#define DMASTART_OUT12_LSB 28 -#define DMASTART_OUT12_MASK 0x10000000 -#define DMASTART_OUT12_GET(x) (((x) & DMASTART_OUT12_MASK) >> DMASTART_OUT12_LSB) -#define DMASTART_OUT12_SET(x) (((x) << DMASTART_OUT12_LSB) & DMASTART_OUT12_MASK) -#define DMASTART_OUT11_MSB 27 -#define DMASTART_OUT11_LSB 27 -#define DMASTART_OUT11_MASK 0x08000000 -#define DMASTART_OUT11_GET(x) (((x) & DMASTART_OUT11_MASK) >> DMASTART_OUT11_LSB) -#define DMASTART_OUT11_SET(x) (((x) << DMASTART_OUT11_LSB) & DMASTART_OUT11_MASK) -#define DMASTART_OUT10_MSB 26 -#define DMASTART_OUT10_LSB 26 -#define DMASTART_OUT10_MASK 0x04000000 -#define DMASTART_OUT10_GET(x) (((x) & DMASTART_OUT10_MASK) >> DMASTART_OUT10_LSB) -#define DMASTART_OUT10_SET(x) (((x) << DMASTART_OUT10_LSB) & DMASTART_OUT10_MASK) -#define DMASTART_OUT9_MSB 25 -#define DMASTART_OUT9_LSB 25 -#define DMASTART_OUT9_MASK 0x02000000 -#define DMASTART_OUT9_GET(x) (((x) & DMASTART_OUT9_MASK) >> DMASTART_OUT9_LSB) -#define DMASTART_OUT9_SET(x) (((x) << DMASTART_OUT9_LSB) & DMASTART_OUT9_MASK) -#define DMASTART_OUT8_MSB 24 -#define DMASTART_OUT8_LSB 24 -#define DMASTART_OUT8_MASK 0x01000000 -#define DMASTART_OUT8_GET(x) (((x) & DMASTART_OUT8_MASK) >> DMASTART_OUT8_LSB) -#define DMASTART_OUT8_SET(x) (((x) << DMASTART_OUT8_LSB) & DMASTART_OUT8_MASK) -#define DMASTART_OUT7_MSB 23 -#define DMASTART_OUT7_LSB 23 -#define DMASTART_OUT7_MASK 0x00800000 -#define DMASTART_OUT7_GET(x) (((x) & DMASTART_OUT7_MASK) >> DMASTART_OUT7_LSB) -#define DMASTART_OUT7_SET(x) (((x) << DMASTART_OUT7_LSB) & DMASTART_OUT7_MASK) -#define DMASTART_OUT6_MSB 22 -#define DMASTART_OUT6_LSB 22 -#define DMASTART_OUT6_MASK 0x00400000 -#define DMASTART_OUT6_GET(x) (((x) & DMASTART_OUT6_MASK) >> DMASTART_OUT6_LSB) -#define DMASTART_OUT6_SET(x) (((x) << DMASTART_OUT6_LSB) & DMASTART_OUT6_MASK) -#define DMASTART_OUT5_MSB 21 -#define DMASTART_OUT5_LSB 21 -#define DMASTART_OUT5_MASK 0x00200000 -#define DMASTART_OUT5_GET(x) (((x) & DMASTART_OUT5_MASK) >> DMASTART_OUT5_LSB) -#define DMASTART_OUT5_SET(x) (((x) << DMASTART_OUT5_LSB) & DMASTART_OUT5_MASK) -#define DMASTART_OUT4_MSB 20 -#define DMASTART_OUT4_LSB 20 -#define DMASTART_OUT4_MASK 0x00100000 -#define DMASTART_OUT4_GET(x) (((x) & DMASTART_OUT4_MASK) >> DMASTART_OUT4_LSB) -#define DMASTART_OUT4_SET(x) (((x) << DMASTART_OUT4_LSB) & DMASTART_OUT4_MASK) -#define DMASTART_OUT3_MSB 19 -#define DMASTART_OUT3_LSB 19 -#define DMASTART_OUT3_MASK 0x00080000 -#define DMASTART_OUT3_GET(x) (((x) & DMASTART_OUT3_MASK) >> DMASTART_OUT3_LSB) -#define DMASTART_OUT3_SET(x) (((x) << DMASTART_OUT3_LSB) & DMASTART_OUT3_MASK) -#define DMASTART_OUT2_MSB 18 -#define DMASTART_OUT2_LSB 18 -#define DMASTART_OUT2_MASK 0x00040000 -#define DMASTART_OUT2_GET(x) (((x) & DMASTART_OUT2_MASK) >> DMASTART_OUT2_LSB) -#define DMASTART_OUT2_SET(x) (((x) << DMASTART_OUT2_LSB) & DMASTART_OUT2_MASK) -#define DMASTART_OUT1_MSB 17 -#define DMASTART_OUT1_LSB 17 -#define DMASTART_OUT1_MASK 0x00020000 -#define DMASTART_OUT1_GET(x) (((x) & DMASTART_OUT1_MASK) >> DMASTART_OUT1_LSB) -#define DMASTART_OUT1_SET(x) (((x) << DMASTART_OUT1_LSB) & DMASTART_OUT1_MASK) -#define DMASTART_OUT0_MSB 16 -#define DMASTART_OUT0_LSB 16 -#define DMASTART_OUT0_MASK 0x00010000 -#define DMASTART_OUT0_GET(x) (((x) & DMASTART_OUT0_MASK) >> DMASTART_OUT0_LSB) -#define DMASTART_OUT0_SET(x) (((x) << DMASTART_OUT0_LSB) & DMASTART_OUT0_MASK) -#define DMASTART_IN15_MSB 15 -#define DMASTART_IN15_LSB 15 -#define DMASTART_IN15_MASK 0x00008000 -#define DMASTART_IN15_GET(x) (((x) & DMASTART_IN15_MASK) >> DMASTART_IN15_LSB) -#define DMASTART_IN15_SET(x) (((x) << DMASTART_IN15_LSB) & DMASTART_IN15_MASK) -#define DMASTART_IN14_MSB 14 -#define DMASTART_IN14_LSB 14 -#define DMASTART_IN14_MASK 0x00004000 -#define DMASTART_IN14_GET(x) (((x) & DMASTART_IN14_MASK) >> DMASTART_IN14_LSB) -#define DMASTART_IN14_SET(x) (((x) << DMASTART_IN14_LSB) & DMASTART_IN14_MASK) -#define DMASTART_IN13_MSB 13 -#define DMASTART_IN13_LSB 13 -#define DMASTART_IN13_MASK 0x00002000 -#define DMASTART_IN13_GET(x) (((x) & DMASTART_IN13_MASK) >> DMASTART_IN13_LSB) -#define DMASTART_IN13_SET(x) (((x) << DMASTART_IN13_LSB) & DMASTART_IN13_MASK) -#define DMASTART_IN12_MSB 12 -#define DMASTART_IN12_LSB 12 -#define DMASTART_IN12_MASK 0x00001000 -#define DMASTART_IN12_GET(x) (((x) & DMASTART_IN12_MASK) >> DMASTART_IN12_LSB) -#define DMASTART_IN12_SET(x) (((x) << DMASTART_IN12_LSB) & DMASTART_IN12_MASK) -#define DMASTART_IN11_MSB 11 -#define DMASTART_IN11_LSB 11 -#define DMASTART_IN11_MASK 0x00000800 -#define DMASTART_IN11_GET(x) (((x) & DMASTART_IN11_MASK) >> DMASTART_IN11_LSB) -#define DMASTART_IN11_SET(x) (((x) << DMASTART_IN11_LSB) & DMASTART_IN11_MASK) -#define DMASTART_IN10_MSB 10 -#define DMASTART_IN10_LSB 10 -#define DMASTART_IN10_MASK 0x00000400 -#define DMASTART_IN10_GET(x) (((x) & DMASTART_IN10_MASK) >> DMASTART_IN10_LSB) -#define DMASTART_IN10_SET(x) (((x) << DMASTART_IN10_LSB) & DMASTART_IN10_MASK) -#define DMASTART_IN9_MSB 9 -#define DMASTART_IN9_LSB 9 -#define DMASTART_IN9_MASK 0x00000200 -#define DMASTART_IN9_GET(x) (((x) & DMASTART_IN9_MASK) >> DMASTART_IN9_LSB) -#define DMASTART_IN9_SET(x) (((x) << DMASTART_IN9_LSB) & DMASTART_IN9_MASK) -#define DMASTART_IN8_MSB 8 -#define DMASTART_IN8_LSB 8 -#define DMASTART_IN8_MASK 0x00000100 -#define DMASTART_IN8_GET(x) (((x) & DMASTART_IN8_MASK) >> DMASTART_IN8_LSB) -#define DMASTART_IN8_SET(x) (((x) << DMASTART_IN8_LSB) & DMASTART_IN8_MASK) -#define DMASTART_IN7_MSB 7 -#define DMASTART_IN7_LSB 7 -#define DMASTART_IN7_MASK 0x00000080 -#define DMASTART_IN7_GET(x) (((x) & DMASTART_IN7_MASK) >> DMASTART_IN7_LSB) -#define DMASTART_IN7_SET(x) (((x) << DMASTART_IN7_LSB) & DMASTART_IN7_MASK) -#define DMASTART_IN6_MSB 6 -#define DMASTART_IN6_LSB 6 -#define DMASTART_IN6_MASK 0x00000040 -#define DMASTART_IN6_GET(x) (((x) & DMASTART_IN6_MASK) >> DMASTART_IN6_LSB) -#define DMASTART_IN6_SET(x) (((x) << DMASTART_IN6_LSB) & DMASTART_IN6_MASK) -#define DMASTART_IN5_MSB 5 -#define DMASTART_IN5_LSB 5 -#define DMASTART_IN5_MASK 0x00000020 -#define DMASTART_IN5_GET(x) (((x) & DMASTART_IN5_MASK) >> DMASTART_IN5_LSB) -#define DMASTART_IN5_SET(x) (((x) << DMASTART_IN5_LSB) & DMASTART_IN5_MASK) -#define DMASTART_IN4_MSB 4 -#define DMASTART_IN4_LSB 4 -#define DMASTART_IN4_MASK 0x00000010 -#define DMASTART_IN4_GET(x) (((x) & DMASTART_IN4_MASK) >> DMASTART_IN4_LSB) -#define DMASTART_IN4_SET(x) (((x) << DMASTART_IN4_LSB) & DMASTART_IN4_MASK) -#define DMASTART_IN3_MSB 3 -#define DMASTART_IN3_LSB 3 -#define DMASTART_IN3_MASK 0x00000008 -#define DMASTART_IN3_GET(x) (((x) & DMASTART_IN3_MASK) >> DMASTART_IN3_LSB) -#define DMASTART_IN3_SET(x) (((x) << DMASTART_IN3_LSB) & DMASTART_IN3_MASK) -#define DMASTART_IN2_MSB 2 -#define DMASTART_IN2_LSB 2 -#define DMASTART_IN2_MASK 0x00000004 -#define DMASTART_IN2_GET(x) (((x) & DMASTART_IN2_MASK) >> DMASTART_IN2_LSB) -#define DMASTART_IN2_SET(x) (((x) << DMASTART_IN2_LSB) & DMASTART_IN2_MASK) -#define DMASTART_IN1_MSB 1 -#define DMASTART_IN1_LSB 1 -#define DMASTART_IN1_MASK 0x00000002 -#define DMASTART_IN1_GET(x) (((x) & DMASTART_IN1_MASK) >> DMASTART_IN1_LSB) -#define DMASTART_IN1_SET(x) (((x) << DMASTART_IN1_LSB) & DMASTART_IN1_MASK) -#define DMASTART_IN0_MSB 0 -#define DMASTART_IN0_LSB 0 -#define DMASTART_IN0_MASK 0x00000001 -#define DMASTART_IN0_GET(x) (((x) & DMASTART_IN0_MASK) >> DMASTART_IN0_LSB) -#define DMASTART_IN0_SET(x) (((x) << DMASTART_IN0_LSB) & DMASTART_IN0_MASK) - -#define DMASTOP_ADDRESS 0x000001d0 -#define DMASTOP_OFFSET 0x000001d0 -#define DMASTOP_OUT15_MSB 31 -#define DMASTOP_OUT15_LSB 31 -#define DMASTOP_OUT15_MASK 0x80000000 -#define DMASTOP_OUT15_GET(x) (((x) & DMASTOP_OUT15_MASK) >> DMASTOP_OUT15_LSB) -#define DMASTOP_OUT15_SET(x) (((x) << DMASTOP_OUT15_LSB) & DMASTOP_OUT15_MASK) -#define DMASTOP_OUT14_MSB 30 -#define DMASTOP_OUT14_LSB 30 -#define DMASTOP_OUT14_MASK 0x40000000 -#define DMASTOP_OUT14_GET(x) (((x) & DMASTOP_OUT14_MASK) >> DMASTOP_OUT14_LSB) -#define DMASTOP_OUT14_SET(x) (((x) << DMASTOP_OUT14_LSB) & DMASTOP_OUT14_MASK) -#define DMASTOP_OUT13_MSB 29 -#define DMASTOP_OUT13_LSB 29 -#define DMASTOP_OUT13_MASK 0x20000000 -#define DMASTOP_OUT13_GET(x) (((x) & DMASTOP_OUT13_MASK) >> DMASTOP_OUT13_LSB) -#define DMASTOP_OUT13_SET(x) (((x) << DMASTOP_OUT13_LSB) & DMASTOP_OUT13_MASK) -#define DMASTOP_OUT12_MSB 28 -#define DMASTOP_OUT12_LSB 28 -#define DMASTOP_OUT12_MASK 0x10000000 -#define DMASTOP_OUT12_GET(x) (((x) & DMASTOP_OUT12_MASK) >> DMASTOP_OUT12_LSB) -#define DMASTOP_OUT12_SET(x) (((x) << DMASTOP_OUT12_LSB) & DMASTOP_OUT12_MASK) -#define DMASTOP_OUT11_MSB 27 -#define DMASTOP_OUT11_LSB 27 -#define DMASTOP_OUT11_MASK 0x08000000 -#define DMASTOP_OUT11_GET(x) (((x) & DMASTOP_OUT11_MASK) >> DMASTOP_OUT11_LSB) -#define DMASTOP_OUT11_SET(x) (((x) << DMASTOP_OUT11_LSB) & DMASTOP_OUT11_MASK) -#define DMASTOP_OUT10_MSB 26 -#define DMASTOP_OUT10_LSB 26 -#define DMASTOP_OUT10_MASK 0x04000000 -#define DMASTOP_OUT10_GET(x) (((x) & DMASTOP_OUT10_MASK) >> DMASTOP_OUT10_LSB) -#define DMASTOP_OUT10_SET(x) (((x) << DMASTOP_OUT10_LSB) & DMASTOP_OUT10_MASK) -#define DMASTOP_OUT9_MSB 25 -#define DMASTOP_OUT9_LSB 25 -#define DMASTOP_OUT9_MASK 0x02000000 -#define DMASTOP_OUT9_GET(x) (((x) & DMASTOP_OUT9_MASK) >> DMASTOP_OUT9_LSB) -#define DMASTOP_OUT9_SET(x) (((x) << DMASTOP_OUT9_LSB) & DMASTOP_OUT9_MASK) -#define DMASTOP_OUT8_MSB 24 -#define DMASTOP_OUT8_LSB 24 -#define DMASTOP_OUT8_MASK 0x01000000 -#define DMASTOP_OUT8_GET(x) (((x) & DMASTOP_OUT8_MASK) >> DMASTOP_OUT8_LSB) -#define DMASTOP_OUT8_SET(x) (((x) << DMASTOP_OUT8_LSB) & DMASTOP_OUT8_MASK) -#define DMASTOP_OUT7_MSB 23 -#define DMASTOP_OUT7_LSB 23 -#define DMASTOP_OUT7_MASK 0x00800000 -#define DMASTOP_OUT7_GET(x) (((x) & DMASTOP_OUT7_MASK) >> DMASTOP_OUT7_LSB) -#define DMASTOP_OUT7_SET(x) (((x) << DMASTOP_OUT7_LSB) & DMASTOP_OUT7_MASK) -#define DMASTOP_OUT6_MSB 22 -#define DMASTOP_OUT6_LSB 22 -#define DMASTOP_OUT6_MASK 0x00400000 -#define DMASTOP_OUT6_GET(x) (((x) & DMASTOP_OUT6_MASK) >> DMASTOP_OUT6_LSB) -#define DMASTOP_OUT6_SET(x) (((x) << DMASTOP_OUT6_LSB) & DMASTOP_OUT6_MASK) -#define DMASTOP_OUT5_MSB 21 -#define DMASTOP_OUT5_LSB 21 -#define DMASTOP_OUT5_MASK 0x00200000 -#define DMASTOP_OUT5_GET(x) (((x) & DMASTOP_OUT5_MASK) >> DMASTOP_OUT5_LSB) -#define DMASTOP_OUT5_SET(x) (((x) << DMASTOP_OUT5_LSB) & DMASTOP_OUT5_MASK) -#define DMASTOP_OUT4_MSB 20 -#define DMASTOP_OUT4_LSB 20 -#define DMASTOP_OUT4_MASK 0x00100000 -#define DMASTOP_OUT4_GET(x) (((x) & DMASTOP_OUT4_MASK) >> DMASTOP_OUT4_LSB) -#define DMASTOP_OUT4_SET(x) (((x) << DMASTOP_OUT4_LSB) & DMASTOP_OUT4_MASK) -#define DMASTOP_OUT3_MSB 19 -#define DMASTOP_OUT3_LSB 19 -#define DMASTOP_OUT3_MASK 0x00080000 -#define DMASTOP_OUT3_GET(x) (((x) & DMASTOP_OUT3_MASK) >> DMASTOP_OUT3_LSB) -#define DMASTOP_OUT3_SET(x) (((x) << DMASTOP_OUT3_LSB) & DMASTOP_OUT3_MASK) -#define DMASTOP_OUT2_MSB 18 -#define DMASTOP_OUT2_LSB 18 -#define DMASTOP_OUT2_MASK 0x00040000 -#define DMASTOP_OUT2_GET(x) (((x) & DMASTOP_OUT2_MASK) >> DMASTOP_OUT2_LSB) -#define DMASTOP_OUT2_SET(x) (((x) << DMASTOP_OUT2_LSB) & DMASTOP_OUT2_MASK) -#define DMASTOP_OUT1_MSB 17 -#define DMASTOP_OUT1_LSB 17 -#define DMASTOP_OUT1_MASK 0x00020000 -#define DMASTOP_OUT1_GET(x) (((x) & DMASTOP_OUT1_MASK) >> DMASTOP_OUT1_LSB) -#define DMASTOP_OUT1_SET(x) (((x) << DMASTOP_OUT1_LSB) & DMASTOP_OUT1_MASK) -#define DMASTOP_OUT0_MSB 16 -#define DMASTOP_OUT0_LSB 16 -#define DMASTOP_OUT0_MASK 0x00010000 -#define DMASTOP_OUT0_GET(x) (((x) & DMASTOP_OUT0_MASK) >> DMASTOP_OUT0_LSB) -#define DMASTOP_OUT0_SET(x) (((x) << DMASTOP_OUT0_LSB) & DMASTOP_OUT0_MASK) -#define DMASTOP_IN15_MSB 15 -#define DMASTOP_IN15_LSB 15 -#define DMASTOP_IN15_MASK 0x00008000 -#define DMASTOP_IN15_GET(x) (((x) & DMASTOP_IN15_MASK) >> DMASTOP_IN15_LSB) -#define DMASTOP_IN15_SET(x) (((x) << DMASTOP_IN15_LSB) & DMASTOP_IN15_MASK) -#define DMASTOP_IN14_MSB 14 -#define DMASTOP_IN14_LSB 14 -#define DMASTOP_IN14_MASK 0x00004000 -#define DMASTOP_IN14_GET(x) (((x) & DMASTOP_IN14_MASK) >> DMASTOP_IN14_LSB) -#define DMASTOP_IN14_SET(x) (((x) << DMASTOP_IN14_LSB) & DMASTOP_IN14_MASK) -#define DMASTOP_IN13_MSB 13 -#define DMASTOP_IN13_LSB 13 -#define DMASTOP_IN13_MASK 0x00002000 -#define DMASTOP_IN13_GET(x) (((x) & DMASTOP_IN13_MASK) >> DMASTOP_IN13_LSB) -#define DMASTOP_IN13_SET(x) (((x) << DMASTOP_IN13_LSB) & DMASTOP_IN13_MASK) -#define DMASTOP_IN12_MSB 12 -#define DMASTOP_IN12_LSB 12 -#define DMASTOP_IN12_MASK 0x00001000 -#define DMASTOP_IN12_GET(x) (((x) & DMASTOP_IN12_MASK) >> DMASTOP_IN12_LSB) -#define DMASTOP_IN12_SET(x) (((x) << DMASTOP_IN12_LSB) & DMASTOP_IN12_MASK) -#define DMASTOP_IN11_MSB 11 -#define DMASTOP_IN11_LSB 11 -#define DMASTOP_IN11_MASK 0x00000800 -#define DMASTOP_IN11_GET(x) (((x) & DMASTOP_IN11_MASK) >> DMASTOP_IN11_LSB) -#define DMASTOP_IN11_SET(x) (((x) << DMASTOP_IN11_LSB) & DMASTOP_IN11_MASK) -#define DMASTOP_IN10_MSB 10 -#define DMASTOP_IN10_LSB 10 -#define DMASTOP_IN10_MASK 0x00000400 -#define DMASTOP_IN10_GET(x) (((x) & DMASTOP_IN10_MASK) >> DMASTOP_IN10_LSB) -#define DMASTOP_IN10_SET(x) (((x) << DMASTOP_IN10_LSB) & DMASTOP_IN10_MASK) -#define DMASTOP_IN9_MSB 9 -#define DMASTOP_IN9_LSB 9 -#define DMASTOP_IN9_MASK 0x00000200 -#define DMASTOP_IN9_GET(x) (((x) & DMASTOP_IN9_MASK) >> DMASTOP_IN9_LSB) -#define DMASTOP_IN9_SET(x) (((x) << DMASTOP_IN9_LSB) & DMASTOP_IN9_MASK) -#define DMASTOP_IN8_MSB 8 -#define DMASTOP_IN8_LSB 8 -#define DMASTOP_IN8_MASK 0x00000100 -#define DMASTOP_IN8_GET(x) (((x) & DMASTOP_IN8_MASK) >> DMASTOP_IN8_LSB) -#define DMASTOP_IN8_SET(x) (((x) << DMASTOP_IN8_LSB) & DMASTOP_IN8_MASK) -#define DMASTOP_IN7_MSB 7 -#define DMASTOP_IN7_LSB 7 -#define DMASTOP_IN7_MASK 0x00000080 -#define DMASTOP_IN7_GET(x) (((x) & DMASTOP_IN7_MASK) >> DMASTOP_IN7_LSB) -#define DMASTOP_IN7_SET(x) (((x) << DMASTOP_IN7_LSB) & DMASTOP_IN7_MASK) -#define DMASTOP_IN6_MSB 6 -#define DMASTOP_IN6_LSB 6 -#define DMASTOP_IN6_MASK 0x00000040 -#define DMASTOP_IN6_GET(x) (((x) & DMASTOP_IN6_MASK) >> DMASTOP_IN6_LSB) -#define DMASTOP_IN6_SET(x) (((x) << DMASTOP_IN6_LSB) & DMASTOP_IN6_MASK) -#define DMASTOP_IN5_MSB 5 -#define DMASTOP_IN5_LSB 5 -#define DMASTOP_IN5_MASK 0x00000020 -#define DMASTOP_IN5_GET(x) (((x) & DMASTOP_IN5_MASK) >> DMASTOP_IN5_LSB) -#define DMASTOP_IN5_SET(x) (((x) << DMASTOP_IN5_LSB) & DMASTOP_IN5_MASK) -#define DMASTOP_IN4_MSB 4 -#define DMASTOP_IN4_LSB 4 -#define DMASTOP_IN4_MASK 0x00000010 -#define DMASTOP_IN4_GET(x) (((x) & DMASTOP_IN4_MASK) >> DMASTOP_IN4_LSB) -#define DMASTOP_IN4_SET(x) (((x) << DMASTOP_IN4_LSB) & DMASTOP_IN4_MASK) -#define DMASTOP_IN3_MSB 3 -#define DMASTOP_IN3_LSB 3 -#define DMASTOP_IN3_MASK 0x00000008 -#define DMASTOP_IN3_GET(x) (((x) & DMASTOP_IN3_MASK) >> DMASTOP_IN3_LSB) -#define DMASTOP_IN3_SET(x) (((x) << DMASTOP_IN3_LSB) & DMASTOP_IN3_MASK) -#define DMASTOP_IN2_MSB 2 -#define DMASTOP_IN2_LSB 2 -#define DMASTOP_IN2_MASK 0x00000004 -#define DMASTOP_IN2_GET(x) (((x) & DMASTOP_IN2_MASK) >> DMASTOP_IN2_LSB) -#define DMASTOP_IN2_SET(x) (((x) << DMASTOP_IN2_LSB) & DMASTOP_IN2_MASK) -#define DMASTOP_IN1_MSB 1 -#define DMASTOP_IN1_LSB 1 -#define DMASTOP_IN1_MASK 0x00000002 -#define DMASTOP_IN1_GET(x) (((x) & DMASTOP_IN1_MASK) >> DMASTOP_IN1_LSB) -#define DMASTOP_IN1_SET(x) (((x) << DMASTOP_IN1_LSB) & DMASTOP_IN1_MASK) -#define DMASTOP_IN0_MSB 0 -#define DMASTOP_IN0_LSB 0 -#define DMASTOP_IN0_MASK 0x00000001 -#define DMASTOP_IN0_GET(x) (((x) & DMASTOP_IN0_MASK) >> DMASTOP_IN0_LSB) -#define DMASTOP_IN0_SET(x) (((x) << DMASTOP_IN0_LSB) & DMASTOP_IN0_MASK) - -#define EP0DMAADDR_ADDRESS 0x00000400 -#define EP0DMAADDR_OFFSET 0x00000400 -#define EP0DMAADDR_ADDR_MSB 31 -#define EP0DMAADDR_ADDR_LSB 2 -#define EP0DMAADDR_ADDR_MASK 0xfffffffc -#define EP0DMAADDR_ADDR_GET(x) (((x) & EP0DMAADDR_ADDR_MASK) >> EP0DMAADDR_ADDR_LSB) -#define EP0DMAADDR_ADDR_SET(x) (((x) << EP0DMAADDR_ADDR_LSB) & EP0DMAADDR_ADDR_MASK) - -#define EP1DMAADDR_ADDRESS 0x00000420 -#define EP1DMAADDR_OFFSET 0x00000420 -#define EP1DMAADDR_ADDR_MSB 31 -#define EP1DMAADDR_ADDR_LSB 2 -#define EP1DMAADDR_ADDR_MASK 0xfffffffc -#define EP1DMAADDR_ADDR_GET(x) (((x) & EP1DMAADDR_ADDR_MASK) >> EP1DMAADDR_ADDR_LSB) -#define EP1DMAADDR_ADDR_SET(x) (((x) << EP1DMAADDR_ADDR_LSB) & EP1DMAADDR_ADDR_MASK) - -#define OUT1DMACTRL_ADDRESS 0x0000042c -#define OUT1DMACTRL_OFFSET 0x0000042c -#define OUT1DMACTRL_HRPROT_MSB 31 -#define OUT1DMACTRL_HRPROT_LSB 28 -#define OUT1DMACTRL_HRPROT_MASK 0xf0000000 -#define OUT1DMACTRL_HRPROT_GET(x) (((x) & OUT1DMACTRL_HRPROT_MASK) >> OUT1DMACTRL_HRPROT_LSB) -#define OUT1DMACTRL_HRPROT_SET(x) (((x) << OUT1DMACTRL_HRPROT_LSB) & OUT1DMACTRL_HRPROT_MASK) -#define OUT1DMACTRL_HSIZE_MSB 27 -#define OUT1DMACTRL_HSIZE_LSB 26 -#define OUT1DMACTRL_HSIZE_MASK 0x0c000000 -#define OUT1DMACTRL_HSIZE_GET(x) (((x) & OUT1DMACTRL_HSIZE_MASK) >> OUT1DMACTRL_HSIZE_LSB) -#define OUT1DMACTRL_HSIZE_SET(x) (((x) << OUT1DMACTRL_HSIZE_LSB) & OUT1DMACTRL_HSIZE_MASK) -#define OUT1DMACTRL_HLOCK_MSB 25 -#define OUT1DMACTRL_HLOCK_LSB 25 -#define OUT1DMACTRL_HLOCK_MASK 0x02000000 -#define OUT1DMACTRL_HLOCK_GET(x) (((x) & OUT1DMACTRL_HLOCK_MASK) >> OUT1DMACTRL_HLOCK_LSB) -#define OUT1DMACTRL_HLOCK_SET(x) (((x) << OUT1DMACTRL_HLOCK_LSB) & OUT1DMACTRL_HLOCK_MASK) -#define OUT1DMACTRL_DMARING_MSB 22 -#define OUT1DMACTRL_DMARING_LSB 22 -#define OUT1DMACTRL_DMARING_MASK 0x00400000 -#define OUT1DMACTRL_DMARING_GET(x) (((x) & OUT1DMACTRL_DMARING_MASK) >> OUT1DMACTRL_DMARING_LSB) -#define OUT1DMACTRL_DMARING_SET(x) (((x) << OUT1DMACTRL_DMARING_LSB) & OUT1DMACTRL_DMARING_MASK) -#define OUT1DMACTRL_DMANINCR_MSB 21 -#define OUT1DMACTRL_DMANINCR_LSB 21 -#define OUT1DMACTRL_DMANINCR_MASK 0x00200000 -#define OUT1DMACTRL_DMANINCR_GET(x) (((x) & OUT1DMACTRL_DMANINCR_MASK) >> OUT1DMACTRL_DMANINCR_LSB) -#define OUT1DMACTRL_DMANINCR_SET(x) (((x) << OUT1DMACTRL_DMANINCR_LSB) & OUT1DMACTRL_DMANINCR_MASK) -#define OUT1DMACTRL_DMATUNLIM_MSB 20 -#define OUT1DMACTRL_DMATUNLIM_LSB 20 -#define OUT1DMACTRL_DMATUNLIM_MASK 0x00100000 -#define OUT1DMACTRL_DMATUNLIM_GET(x) (((x) & OUT1DMACTRL_DMATUNLIM_MASK) >> OUT1DMACTRL_DMATUNLIM_LSB) -#define OUT1DMACTRL_DMATUNLIM_SET(x) (((x) << OUT1DMACTRL_DMATUNLIM_LSB) & OUT1DMACTRL_DMATUNLIM_MASK) -#define OUT1DMACTRL_DMASTART_MSB 18 -#define OUT1DMACTRL_DMASTART_LSB 18 -#define OUT1DMACTRL_DMASTART_MASK 0x00040000 -#define OUT1DMACTRL_DMASTART_GET(x) (((x) & OUT1DMACTRL_DMASTART_MASK) >> OUT1DMACTRL_DMASTART_LSB) -#define OUT1DMACTRL_DMASTART_SET(x) (((x) << OUT1DMACTRL_DMASTART_LSB) & OUT1DMACTRL_DMASTART_MASK) -#define OUT1DMACTRL_DMASTOP_MSB 17 -#define OUT1DMACTRL_DMASTOP_LSB 17 -#define OUT1DMACTRL_DMASTOP_MASK 0x00020000 -#define OUT1DMACTRL_DMASTOP_GET(x) (((x) & OUT1DMACTRL_DMASTOP_MASK) >> OUT1DMACTRL_DMASTOP_LSB) -#define OUT1DMACTRL_DMASTOP_SET(x) (((x) << OUT1DMACTRL_DMASTOP_LSB) & OUT1DMACTRL_DMASTOP_MASK) -#define OUT1DMACTRL_ENDIAN_MSB 16 -#define OUT1DMACTRL_ENDIAN_LSB 16 -#define OUT1DMACTRL_ENDIAN_MASK 0x00010000 -#define OUT1DMACTRL_ENDIAN_GET(x) (((x) & OUT1DMACTRL_ENDIAN_MASK) >> OUT1DMACTRL_ENDIAN_LSB) -#define OUT1DMACTRL_ENDIAN_SET(x) (((x) << OUT1DMACTRL_ENDIAN_LSB) & OUT1DMACTRL_ENDIAN_MASK) -#define OUT1DMACTRL_RINGSIZ_MSB 15 -#define OUT1DMACTRL_RINGSIZ_LSB 2 -#define OUT1DMACTRL_RINGSIZ_MASK 0x0000fffc -#define OUT1DMACTRL_RINGSIZ_GET(x) (((x) & OUT1DMACTRL_RINGSIZ_MASK) >> OUT1DMACTRL_RINGSIZ_LSB) -#define OUT1DMACTRL_RINGSIZ_SET(x) (((x) << OUT1DMACTRL_RINGSIZ_LSB) & OUT1DMACTRL_RINGSIZ_MASK) - -#define EP2DMAADDR_ADDRESS 0x00000440 -#define EP2DMAADDR_OFFSET 0x00000440 -#define EP2DMAADDR_ADDR_MSB 31 -#define EP2DMAADDR_ADDR_LSB 2 -#define EP2DMAADDR_ADDR_MASK 0xfffffffc -#define EP2DMAADDR_ADDR_GET(x) (((x) & EP2DMAADDR_ADDR_MASK) >> EP2DMAADDR_ADDR_LSB) -#define EP2DMAADDR_ADDR_SET(x) (((x) << EP2DMAADDR_ADDR_LSB) & EP2DMAADDR_ADDR_MASK) - -#define OUT2DMACTRL_ADDRESS 0x0000044c -#define OUT2DMACTRL_OFFSET 0x0000044c -#define OUT2DMACTRL_HRPROT_MSB 31 -#define OUT2DMACTRL_HRPROT_LSB 28 -#define OUT2DMACTRL_HRPROT_MASK 0xf0000000 -#define OUT2DMACTRL_HRPROT_GET(x) (((x) & OUT2DMACTRL_HRPROT_MASK) >> OUT2DMACTRL_HRPROT_LSB) -#define OUT2DMACTRL_HRPROT_SET(x) (((x) << OUT2DMACTRL_HRPROT_LSB) & OUT2DMACTRL_HRPROT_MASK) -#define OUT2DMACTRL_HSIZE_MSB 27 -#define OUT2DMACTRL_HSIZE_LSB 26 -#define OUT2DMACTRL_HSIZE_MASK 0x0c000000 -#define OUT2DMACTRL_HSIZE_GET(x) (((x) & OUT2DMACTRL_HSIZE_MASK) >> OUT2DMACTRL_HSIZE_LSB) -#define OUT2DMACTRL_HSIZE_SET(x) (((x) << OUT2DMACTRL_HSIZE_LSB) & OUT2DMACTRL_HSIZE_MASK) -#define OUT2DMACTRL_HLOCK_MSB 25 -#define OUT2DMACTRL_HLOCK_LSB 25 -#define OUT2DMACTRL_HLOCK_MASK 0x02000000 -#define OUT2DMACTRL_HLOCK_GET(x) (((x) & OUT2DMACTRL_HLOCK_MASK) >> OUT2DMACTRL_HLOCK_LSB) -#define OUT2DMACTRL_HLOCK_SET(x) (((x) << OUT2DMACTRL_HLOCK_LSB) & OUT2DMACTRL_HLOCK_MASK) -#define OUT2DMACTRL_DMARING_MSB 22 -#define OUT2DMACTRL_DMARING_LSB 22 -#define OUT2DMACTRL_DMARING_MASK 0x00400000 -#define OUT2DMACTRL_DMARING_GET(x) (((x) & OUT2DMACTRL_DMARING_MASK) >> OUT2DMACTRL_DMARING_LSB) -#define OUT2DMACTRL_DMARING_SET(x) (((x) << OUT2DMACTRL_DMARING_LSB) & OUT2DMACTRL_DMARING_MASK) -#define OUT2DMACTRL_DMANINCR_MSB 21 -#define OUT2DMACTRL_DMANINCR_LSB 21 -#define OUT2DMACTRL_DMANINCR_MASK 0x00200000 -#define OUT2DMACTRL_DMANINCR_GET(x) (((x) & OUT2DMACTRL_DMANINCR_MASK) >> OUT2DMACTRL_DMANINCR_LSB) -#define OUT2DMACTRL_DMANINCR_SET(x) (((x) << OUT2DMACTRL_DMANINCR_LSB) & OUT2DMACTRL_DMANINCR_MASK) -#define OUT2DMACTRL_DMATUNLIM_MSB 20 -#define OUT2DMACTRL_DMATUNLIM_LSB 20 -#define OUT2DMACTRL_DMATUNLIM_MASK 0x00100000 -#define OUT2DMACTRL_DMATUNLIM_GET(x) (((x) & OUT2DMACTRL_DMATUNLIM_MASK) >> OUT2DMACTRL_DMATUNLIM_LSB) -#define OUT2DMACTRL_DMATUNLIM_SET(x) (((x) << OUT2DMACTRL_DMATUNLIM_LSB) & OUT2DMACTRL_DMATUNLIM_MASK) -#define OUT2DMACTRL_DMASTART_MSB 18 -#define OUT2DMACTRL_DMASTART_LSB 18 -#define OUT2DMACTRL_DMASTART_MASK 0x00040000 -#define OUT2DMACTRL_DMASTART_GET(x) (((x) & OUT2DMACTRL_DMASTART_MASK) >> OUT2DMACTRL_DMASTART_LSB) -#define OUT2DMACTRL_DMASTART_SET(x) (((x) << OUT2DMACTRL_DMASTART_LSB) & OUT2DMACTRL_DMASTART_MASK) -#define OUT2DMACTRL_DMASTOP_MSB 17 -#define OUT2DMACTRL_DMASTOP_LSB 17 -#define OUT2DMACTRL_DMASTOP_MASK 0x00020000 -#define OUT2DMACTRL_DMASTOP_GET(x) (((x) & OUT2DMACTRL_DMASTOP_MASK) >> OUT2DMACTRL_DMASTOP_LSB) -#define OUT2DMACTRL_DMASTOP_SET(x) (((x) << OUT2DMACTRL_DMASTOP_LSB) & OUT2DMACTRL_DMASTOP_MASK) -#define OUT2DMACTRL_ENDIAN_MSB 16 -#define OUT2DMACTRL_ENDIAN_LSB 16 -#define OUT2DMACTRL_ENDIAN_MASK 0x00010000 -#define OUT2DMACTRL_ENDIAN_GET(x) (((x) & OUT2DMACTRL_ENDIAN_MASK) >> OUT2DMACTRL_ENDIAN_LSB) -#define OUT2DMACTRL_ENDIAN_SET(x) (((x) << OUT2DMACTRL_ENDIAN_LSB) & OUT2DMACTRL_ENDIAN_MASK) -#define OUT2DMACTRL_RINGSIZ_MSB 15 -#define OUT2DMACTRL_RINGSIZ_LSB 2 -#define OUT2DMACTRL_RINGSIZ_MASK 0x0000fffc -#define OUT2DMACTRL_RINGSIZ_GET(x) (((x) & OUT2DMACTRL_RINGSIZ_MASK) >> OUT2DMACTRL_RINGSIZ_LSB) -#define OUT2DMACTRL_RINGSIZ_SET(x) (((x) << OUT2DMACTRL_RINGSIZ_LSB) & OUT2DMACTRL_RINGSIZ_MASK) - -#define EP3DMAADDR_ADDRESS 0x00000460 -#define EP3DMAADDR_OFFSET 0x00000460 -#define EP3DMAADDR_ADDR_MSB 31 -#define EP3DMAADDR_ADDR_LSB 2 -#define EP3DMAADDR_ADDR_MASK 0xfffffffc -#define EP3DMAADDR_ADDR_GET(x) (((x) & EP3DMAADDR_ADDR_MASK) >> EP3DMAADDR_ADDR_LSB) -#define EP3DMAADDR_ADDR_SET(x) (((x) << EP3DMAADDR_ADDR_LSB) & EP3DMAADDR_ADDR_MASK) - -#define OUT3DMACTRL_ADDRESS 0x0000046c -#define OUT3DMACTRL_OFFSET 0x0000046c -#define OUT3DMACTRL_HRPROT_MSB 31 -#define OUT3DMACTRL_HRPROT_LSB 28 -#define OUT3DMACTRL_HRPROT_MASK 0xf0000000 -#define OUT3DMACTRL_HRPROT_GET(x) (((x) & OUT3DMACTRL_HRPROT_MASK) >> OUT3DMACTRL_HRPROT_LSB) -#define OUT3DMACTRL_HRPROT_SET(x) (((x) << OUT3DMACTRL_HRPROT_LSB) & OUT3DMACTRL_HRPROT_MASK) -#define OUT3DMACTRL_HSIZE_MSB 27 -#define OUT3DMACTRL_HSIZE_LSB 26 -#define OUT3DMACTRL_HSIZE_MASK 0x0c000000 -#define OUT3DMACTRL_HSIZE_GET(x) (((x) & OUT3DMACTRL_HSIZE_MASK) >> OUT3DMACTRL_HSIZE_LSB) -#define OUT3DMACTRL_HSIZE_SET(x) (((x) << OUT3DMACTRL_HSIZE_LSB) & OUT3DMACTRL_HSIZE_MASK) -#define OUT3DMACTRL_HLOCK_MSB 25 -#define OUT3DMACTRL_HLOCK_LSB 25 -#define OUT3DMACTRL_HLOCK_MASK 0x02000000 -#define OUT3DMACTRL_HLOCK_GET(x) (((x) & OUT3DMACTRL_HLOCK_MASK) >> OUT3DMACTRL_HLOCK_LSB) -#define OUT3DMACTRL_HLOCK_SET(x) (((x) << OUT3DMACTRL_HLOCK_LSB) & OUT3DMACTRL_HLOCK_MASK) -#define OUT3DMACTRL_DMARING_MSB 22 -#define OUT3DMACTRL_DMARING_LSB 22 -#define OUT3DMACTRL_DMARING_MASK 0x00400000 -#define OUT3DMACTRL_DMARING_GET(x) (((x) & OUT3DMACTRL_DMARING_MASK) >> OUT3DMACTRL_DMARING_LSB) -#define OUT3DMACTRL_DMARING_SET(x) (((x) << OUT3DMACTRL_DMARING_LSB) & OUT3DMACTRL_DMARING_MASK) -#define OUT3DMACTRL_DMANINCR_MSB 21 -#define OUT3DMACTRL_DMANINCR_LSB 21 -#define OUT3DMACTRL_DMANINCR_MASK 0x00200000 -#define OUT3DMACTRL_DMANINCR_GET(x) (((x) & OUT3DMACTRL_DMANINCR_MASK) >> OUT3DMACTRL_DMANINCR_LSB) -#define OUT3DMACTRL_DMANINCR_SET(x) (((x) << OUT3DMACTRL_DMANINCR_LSB) & OUT3DMACTRL_DMANINCR_MASK) -#define OUT3DMACTRL_DMATUNLIM_MSB 20 -#define OUT3DMACTRL_DMATUNLIM_LSB 20 -#define OUT3DMACTRL_DMATUNLIM_MASK 0x00100000 -#define OUT3DMACTRL_DMATUNLIM_GET(x) (((x) & OUT3DMACTRL_DMATUNLIM_MASK) >> OUT3DMACTRL_DMATUNLIM_LSB) -#define OUT3DMACTRL_DMATUNLIM_SET(x) (((x) << OUT3DMACTRL_DMATUNLIM_LSB) & OUT3DMACTRL_DMATUNLIM_MASK) -#define OUT3DMACTRL_DMASTART_MSB 18 -#define OUT3DMACTRL_DMASTART_LSB 18 -#define OUT3DMACTRL_DMASTART_MASK 0x00040000 -#define OUT3DMACTRL_DMASTART_GET(x) (((x) & OUT3DMACTRL_DMASTART_MASK) >> OUT3DMACTRL_DMASTART_LSB) -#define OUT3DMACTRL_DMASTART_SET(x) (((x) << OUT3DMACTRL_DMASTART_LSB) & OUT3DMACTRL_DMASTART_MASK) -#define OUT3DMACTRL_DMASTOP_MSB 17 -#define OUT3DMACTRL_DMASTOP_LSB 17 -#define OUT3DMACTRL_DMASTOP_MASK 0x00020000 -#define OUT3DMACTRL_DMASTOP_GET(x) (((x) & OUT3DMACTRL_DMASTOP_MASK) >> OUT3DMACTRL_DMASTOP_LSB) -#define OUT3DMACTRL_DMASTOP_SET(x) (((x) << OUT3DMACTRL_DMASTOP_LSB) & OUT3DMACTRL_DMASTOP_MASK) -#define OUT3DMACTRL_ENDIAN_MSB 16 -#define OUT3DMACTRL_ENDIAN_LSB 16 -#define OUT3DMACTRL_ENDIAN_MASK 0x00010000 -#define OUT3DMACTRL_ENDIAN_GET(x) (((x) & OUT3DMACTRL_ENDIAN_MASK) >> OUT3DMACTRL_ENDIAN_LSB) -#define OUT3DMACTRL_ENDIAN_SET(x) (((x) << OUT3DMACTRL_ENDIAN_LSB) & OUT3DMACTRL_ENDIAN_MASK) -#define OUT3DMACTRL_RINGSIZ_MSB 15 -#define OUT3DMACTRL_RINGSIZ_LSB 2 -#define OUT3DMACTRL_RINGSIZ_MASK 0x0000fffc -#define OUT3DMACTRL_RINGSIZ_GET(x) (((x) & OUT3DMACTRL_RINGSIZ_MASK) >> OUT3DMACTRL_RINGSIZ_LSB) -#define OUT3DMACTRL_RINGSIZ_SET(x) (((x) << OUT3DMACTRL_RINGSIZ_LSB) & OUT3DMACTRL_RINGSIZ_MASK) - -#define EP4DMAADDR_ADDRESS 0x00000480 -#define EP4DMAADDR_OFFSET 0x00000480 -#define EP4DMAADDR_ADDR_MSB 31 -#define EP4DMAADDR_ADDR_LSB 2 -#define EP4DMAADDR_ADDR_MASK 0xfffffffc -#define EP4DMAADDR_ADDR_GET(x) (((x) & EP4DMAADDR_ADDR_MASK) >> EP4DMAADDR_ADDR_LSB) -#define EP4DMAADDR_ADDR_SET(x) (((x) << EP4DMAADDR_ADDR_LSB) & EP4DMAADDR_ADDR_MASK) - -#define OUT4DMACTRL_ADDRESS 0x0000048c -#define OUT4DMACTRL_OFFSET 0x0000048c -#define OUT4DMACTRL_HRPROT_MSB 31 -#define OUT4DMACTRL_HRPROT_LSB 28 -#define OUT4DMACTRL_HRPROT_MASK 0xf0000000 -#define OUT4DMACTRL_HRPROT_GET(x) (((x) & OUT4DMACTRL_HRPROT_MASK) >> OUT4DMACTRL_HRPROT_LSB) -#define OUT4DMACTRL_HRPROT_SET(x) (((x) << OUT4DMACTRL_HRPROT_LSB) & OUT4DMACTRL_HRPROT_MASK) -#define OUT4DMACTRL_HSIZE_MSB 27 -#define OUT4DMACTRL_HSIZE_LSB 26 -#define OUT4DMACTRL_HSIZE_MASK 0x0c000000 -#define OUT4DMACTRL_HSIZE_GET(x) (((x) & OUT4DMACTRL_HSIZE_MASK) >> OUT4DMACTRL_HSIZE_LSB) -#define OUT4DMACTRL_HSIZE_SET(x) (((x) << OUT4DMACTRL_HSIZE_LSB) & OUT4DMACTRL_HSIZE_MASK) -#define OUT4DMACTRL_HLOCK_MSB 25 -#define OUT4DMACTRL_HLOCK_LSB 25 -#define OUT4DMACTRL_HLOCK_MASK 0x02000000 -#define OUT4DMACTRL_HLOCK_GET(x) (((x) & OUT4DMACTRL_HLOCK_MASK) >> OUT4DMACTRL_HLOCK_LSB) -#define OUT4DMACTRL_HLOCK_SET(x) (((x) << OUT4DMACTRL_HLOCK_LSB) & OUT4DMACTRL_HLOCK_MASK) -#define OUT4DMACTRL_DMARING_MSB 22 -#define OUT4DMACTRL_DMARING_LSB 22 -#define OUT4DMACTRL_DMARING_MASK 0x00400000 -#define OUT4DMACTRL_DMARING_GET(x) (((x) & OUT4DMACTRL_DMARING_MASK) >> OUT4DMACTRL_DMARING_LSB) -#define OUT4DMACTRL_DMARING_SET(x) (((x) << OUT4DMACTRL_DMARING_LSB) & OUT4DMACTRL_DMARING_MASK) -#define OUT4DMACTRL_DMANINCR_MSB 21 -#define OUT4DMACTRL_DMANINCR_LSB 21 -#define OUT4DMACTRL_DMANINCR_MASK 0x00200000 -#define OUT4DMACTRL_DMANINCR_GET(x) (((x) & OUT4DMACTRL_DMANINCR_MASK) >> OUT4DMACTRL_DMANINCR_LSB) -#define OUT4DMACTRL_DMANINCR_SET(x) (((x) << OUT4DMACTRL_DMANINCR_LSB) & OUT4DMACTRL_DMANINCR_MASK) -#define OUT4DMACTRL_DMATUNLIM_MSB 20 -#define OUT4DMACTRL_DMATUNLIM_LSB 20 -#define OUT4DMACTRL_DMATUNLIM_MASK 0x00100000 -#define OUT4DMACTRL_DMATUNLIM_GET(x) (((x) & OUT4DMACTRL_DMATUNLIM_MASK) >> OUT4DMACTRL_DMATUNLIM_LSB) -#define OUT4DMACTRL_DMATUNLIM_SET(x) (((x) << OUT4DMACTRL_DMATUNLIM_LSB) & OUT4DMACTRL_DMATUNLIM_MASK) -#define OUT4DMACTRL_DMASTART_MSB 18 -#define OUT4DMACTRL_DMASTART_LSB 18 -#define OUT4DMACTRL_DMASTART_MASK 0x00040000 -#define OUT4DMACTRL_DMASTART_GET(x) (((x) & OUT4DMACTRL_DMASTART_MASK) >> OUT4DMACTRL_DMASTART_LSB) -#define OUT4DMACTRL_DMASTART_SET(x) (((x) << OUT4DMACTRL_DMASTART_LSB) & OUT4DMACTRL_DMASTART_MASK) -#define OUT4DMACTRL_DMASTOP_MSB 17 -#define OUT4DMACTRL_DMASTOP_LSB 17 -#define OUT4DMACTRL_DMASTOP_MASK 0x00020000 -#define OUT4DMACTRL_DMASTOP_GET(x) (((x) & OUT4DMACTRL_DMASTOP_MASK) >> OUT4DMACTRL_DMASTOP_LSB) -#define OUT4DMACTRL_DMASTOP_SET(x) (((x) << OUT4DMACTRL_DMASTOP_LSB) & OUT4DMACTRL_DMASTOP_MASK) -#define OUT4DMACTRL_ENDIAN_MSB 16 -#define OUT4DMACTRL_ENDIAN_LSB 16 -#define OUT4DMACTRL_ENDIAN_MASK 0x00010000 -#define OUT4DMACTRL_ENDIAN_GET(x) (((x) & OUT4DMACTRL_ENDIAN_MASK) >> OUT4DMACTRL_ENDIAN_LSB) -#define OUT4DMACTRL_ENDIAN_SET(x) (((x) << OUT4DMACTRL_ENDIAN_LSB) & OUT4DMACTRL_ENDIAN_MASK) -#define OUT4DMACTRL_RINGSIZ_MSB 15 -#define OUT4DMACTRL_RINGSIZ_LSB 2 -#define OUT4DMACTRL_RINGSIZ_MASK 0x0000fffc -#define OUT4DMACTRL_RINGSIZ_GET(x) (((x) & OUT4DMACTRL_RINGSIZ_MASK) >> OUT4DMACTRL_RINGSIZ_LSB) -#define OUT4DMACTRL_RINGSIZ_SET(x) (((x) << OUT4DMACTRL_RINGSIZ_LSB) & OUT4DMACTRL_RINGSIZ_MASK) - -#define EP5DMAADDR_ADDRESS 0x000004a0 -#define EP5DMAADDR_OFFSET 0x000004a0 -#define EP5DMAADDR_ADDR_MSB 31 -#define EP5DMAADDR_ADDR_LSB 2 -#define EP5DMAADDR_ADDR_MASK 0xfffffffc -#define EP5DMAADDR_ADDR_GET(x) (((x) & EP5DMAADDR_ADDR_MASK) >> EP5DMAADDR_ADDR_LSB) -#define EP5DMAADDR_ADDR_SET(x) (((x) << EP5DMAADDR_ADDR_LSB) & EP5DMAADDR_ADDR_MASK) - -#define OUT5DMACTRL_ADDRESS 0x000004ac -#define OUT5DMACTRL_OFFSET 0x000004ac -#define OUT5DMACTRL_HRPROT_MSB 31 -#define OUT5DMACTRL_HRPROT_LSB 28 -#define OUT5DMACTRL_HRPROT_MASK 0xf0000000 -#define OUT5DMACTRL_HRPROT_GET(x) (((x) & OUT5DMACTRL_HRPROT_MASK) >> OUT5DMACTRL_HRPROT_LSB) -#define OUT5DMACTRL_HRPROT_SET(x) (((x) << OUT5DMACTRL_HRPROT_LSB) & OUT5DMACTRL_HRPROT_MASK) -#define OUT5DMACTRL_HSIZE_MSB 27 -#define OUT5DMACTRL_HSIZE_LSB 26 -#define OUT5DMACTRL_HSIZE_MASK 0x0c000000 -#define OUT5DMACTRL_HSIZE_GET(x) (((x) & OUT5DMACTRL_HSIZE_MASK) >> OUT5DMACTRL_HSIZE_LSB) -#define OUT5DMACTRL_HSIZE_SET(x) (((x) << OUT5DMACTRL_HSIZE_LSB) & OUT5DMACTRL_HSIZE_MASK) -#define OUT5DMACTRL_HLOCK_MSB 25 -#define OUT5DMACTRL_HLOCK_LSB 25 -#define OUT5DMACTRL_HLOCK_MASK 0x02000000 -#define OUT5DMACTRL_HLOCK_GET(x) (((x) & OUT5DMACTRL_HLOCK_MASK) >> OUT5DMACTRL_HLOCK_LSB) -#define OUT5DMACTRL_HLOCK_SET(x) (((x) << OUT5DMACTRL_HLOCK_LSB) & OUT5DMACTRL_HLOCK_MASK) -#define OUT5DMACTRL_DMARING_MSB 22 -#define OUT5DMACTRL_DMARING_LSB 22 -#define OUT5DMACTRL_DMARING_MASK 0x00400000 -#define OUT5DMACTRL_DMARING_GET(x) (((x) & OUT5DMACTRL_DMARING_MASK) >> OUT5DMACTRL_DMARING_LSB) -#define OUT5DMACTRL_DMARING_SET(x) (((x) << OUT5DMACTRL_DMARING_LSB) & OUT5DMACTRL_DMARING_MASK) -#define OUT5DMACTRL_DMANINCR_MSB 21 -#define OUT5DMACTRL_DMANINCR_LSB 21 -#define OUT5DMACTRL_DMANINCR_MASK 0x00200000 -#define OUT5DMACTRL_DMANINCR_GET(x) (((x) & OUT5DMACTRL_DMANINCR_MASK) >> OUT5DMACTRL_DMANINCR_LSB) -#define OUT5DMACTRL_DMANINCR_SET(x) (((x) << OUT5DMACTRL_DMANINCR_LSB) & OUT5DMACTRL_DMANINCR_MASK) -#define OUT5DMACTRL_DMATUNLIM_MSB 20 -#define OUT5DMACTRL_DMATUNLIM_LSB 20 -#define OUT5DMACTRL_DMATUNLIM_MASK 0x00100000 -#define OUT5DMACTRL_DMATUNLIM_GET(x) (((x) & OUT5DMACTRL_DMATUNLIM_MASK) >> OUT5DMACTRL_DMATUNLIM_LSB) -#define OUT5DMACTRL_DMATUNLIM_SET(x) (((x) << OUT5DMACTRL_DMATUNLIM_LSB) & OUT5DMACTRL_DMATUNLIM_MASK) -#define OUT5DMACTRL_DMASTART_MSB 18 -#define OUT5DMACTRL_DMASTART_LSB 18 -#define OUT5DMACTRL_DMASTART_MASK 0x00040000 -#define OUT5DMACTRL_DMASTART_GET(x) (((x) & OUT5DMACTRL_DMASTART_MASK) >> OUT5DMACTRL_DMASTART_LSB) -#define OUT5DMACTRL_DMASTART_SET(x) (((x) << OUT5DMACTRL_DMASTART_LSB) & OUT5DMACTRL_DMASTART_MASK) -#define OUT5DMACTRL_DMASTOP_MSB 17 -#define OUT5DMACTRL_DMASTOP_LSB 17 -#define OUT5DMACTRL_DMASTOP_MASK 0x00020000 -#define OUT5DMACTRL_DMASTOP_GET(x) (((x) & OUT5DMACTRL_DMASTOP_MASK) >> OUT5DMACTRL_DMASTOP_LSB) -#define OUT5DMACTRL_DMASTOP_SET(x) (((x) << OUT5DMACTRL_DMASTOP_LSB) & OUT5DMACTRL_DMASTOP_MASK) -#define OUT5DMACTRL_ENDIAN_MSB 16 -#define OUT5DMACTRL_ENDIAN_LSB 16 -#define OUT5DMACTRL_ENDIAN_MASK 0x00010000 -#define OUT5DMACTRL_ENDIAN_GET(x) (((x) & OUT5DMACTRL_ENDIAN_MASK) >> OUT5DMACTRL_ENDIAN_LSB) -#define OUT5DMACTRL_ENDIAN_SET(x) (((x) << OUT5DMACTRL_ENDIAN_LSB) & OUT5DMACTRL_ENDIAN_MASK) -#define OUT5DMACTRL_RINGSIZ_MSB 15 -#define OUT5DMACTRL_RINGSIZ_LSB 2 -#define OUT5DMACTRL_RINGSIZ_MASK 0x0000fffc -#define OUT5DMACTRL_RINGSIZ_GET(x) (((x) & OUT5DMACTRL_RINGSIZ_MASK) >> OUT5DMACTRL_RINGSIZ_LSB) -#define OUT5DMACTRL_RINGSIZ_SET(x) (((x) << OUT5DMACTRL_RINGSIZ_LSB) & OUT5DMACTRL_RINGSIZ_MASK) - -#define USB_IP_BASE_ADDRESS 0x00084000 -#define USB_IP_BASE_OFFSET 0x00084000 - - -#ifndef __ASSEMBLER__ - -typedef struct usb_cast_reg_reg_s { - volatile unsigned int endp0; - unsigned char pad0[4]; /* pad to 0x8 */ - volatile unsigned int out1endp; - volatile unsigned int in1endp; - volatile unsigned int out2endp; - volatile unsigned int in2endp; - volatile unsigned int out3endp; - volatile unsigned int in3endp; - volatile unsigned int out4endp; - volatile unsigned int in4endp; - volatile unsigned int out5endp; - volatile unsigned int in5endp; - unsigned char pad1[92]; /* pad to 0x8c */ - volatile unsigned int usbmodestatus; - unsigned char pad2[248]; /* pad to 0x188 */ - volatile unsigned int epirq; - volatile unsigned int usbirq; - unsigned char pad3[4]; /* pad to 0x194 */ - volatile unsigned int epien; - volatile unsigned int pien; - unsigned char pad4[8]; /* pad to 0x1a4 */ - volatile unsigned int fnctrl; - unsigned char pad5[20]; /* pad to 0x1bc */ - volatile unsigned int otgreg; - unsigned char pad6[12]; /* pad to 0x1cc */ - volatile unsigned int dmastart; - volatile unsigned int dmastop; - unsigned char pad7[556]; /* pad to 0x400 */ - volatile unsigned int ep0dmaaddr; - unsigned char pad8[28]; /* pad to 0x420 */ - volatile unsigned int ep1dmaaddr; - unsigned char pad9[8]; /* pad to 0x42c */ - volatile unsigned int out1dmactrl; - unsigned char pad10[16]; /* pad to 0x440 */ - volatile unsigned int ep2dmaaddr; - unsigned char pad11[8]; /* pad to 0x44c */ - volatile unsigned int out2dmactrl; - unsigned char pad12[16]; /* pad to 0x460 */ - volatile unsigned int ep3dmaaddr; - unsigned char pad13[8]; /* pad to 0x46c */ - volatile unsigned int out3dmactrl; - unsigned char pad14[16]; /* pad to 0x480 */ - volatile unsigned int ep4dmaaddr; - unsigned char pad15[8]; /* pad to 0x48c */ - volatile unsigned int out4dmactrl; - unsigned char pad16[16]; /* pad to 0x4a0 */ - volatile unsigned int ep5dmaaddr; - unsigned char pad17[8]; /* pad to 0x4ac */ - volatile unsigned int out5dmactrl; - unsigned char pad18[539472]; /* pad to 0x84000 */ - volatile unsigned int usb_ip_base; -} usb_cast_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _USB_CAST_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wlan_coex_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wlan_coex_reg.h deleted file mode 100644 index 17c39a31464c..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wlan_coex_reg.h +++ /dev/null @@ -1,839 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _WLAN_COEX_REG_REG_H_ -#define _WLAN_COEX_REG_REG_H_ - - -/* macros for MCI_COMMAND0 */ -#define MCI_COMMAND0_ADDRESS 0x00000000 -#define MCI_COMMAND0_OFFSET 0x00000000 -#define MCI_COMMAND0_HEADER_MSB 7 -#define MCI_COMMAND0_HEADER_LSB 0 -#define MCI_COMMAND0_HEADER_MASK 0x000000ff -#define MCI_COMMAND0_HEADER_GET(x) (((x) & 0x000000ff) >> 0) -#define MCI_COMMAND0_HEADER_SET(x) (((x) << 0) & 0x000000ff) -#define MCI_COMMAND0_LEN_MSB 12 -#define MCI_COMMAND0_LEN_LSB 8 -#define MCI_COMMAND0_LEN_MASK 0x00001f00 -#define MCI_COMMAND0_LEN_GET(x) (((x) & 0x00001f00) >> 8) -#define MCI_COMMAND0_LEN_SET(x) (((x) << 8) & 0x00001f00) -#define MCI_COMMAND0_DISABLE_TIMESTAMP_MSB 13 -#define MCI_COMMAND0_DISABLE_TIMESTAMP_LSB 13 -#define MCI_COMMAND0_DISABLE_TIMESTAMP_MASK 0x00002000 -#define MCI_COMMAND0_DISABLE_TIMESTAMP_GET(x) (((x) & 0x00002000) >> 13) -#define MCI_COMMAND0_DISABLE_TIMESTAMP_SET(x) (((x) << 13) & 0x00002000) - -/* macros for MCI_COMMAND1 */ -#define MCI_COMMAND1_ADDRESS 0x00000004 -#define MCI_COMMAND1_OFFSET 0x00000004 -#define MCI_COMMAND1_ADDR_MSB 31 -#define MCI_COMMAND1_ADDR_LSB 0 -#define MCI_COMMAND1_ADDR_MASK 0xffffffff -#define MCI_COMMAND1_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define MCI_COMMAND1_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MCI_COMMAND2 */ -#define MCI_COMMAND2_ADDRESS 0x00000008 -#define MCI_COMMAND2_OFFSET 0x00000008 -#define MCI_COMMAND2_RESET_TX_MSB 0 -#define MCI_COMMAND2_RESET_TX_LSB 0 -#define MCI_COMMAND2_RESET_TX_MASK 0x00000001 -#define MCI_COMMAND2_RESET_TX_GET(x) (((x) & 0x00000001) >> 0) -#define MCI_COMMAND2_RESET_TX_SET(x) (((x) << 0) & 0x00000001) -#define MCI_COMMAND2_RESET_RX_MSB 1 -#define MCI_COMMAND2_RESET_RX_LSB 1 -#define MCI_COMMAND2_RESET_RX_MASK 0x00000002 -#define MCI_COMMAND2_RESET_RX_GET(x) (((x) & 0x00000002) >> 1) -#define MCI_COMMAND2_RESET_RX_SET(x) (((x) << 1) & 0x00000002) -#define MCI_COMMAND2_RESET_RX_NUM_CYCLES_MSB 9 -#define MCI_COMMAND2_RESET_RX_NUM_CYCLES_LSB 2 -#define MCI_COMMAND2_RESET_RX_NUM_CYCLES_MASK 0x000003fc -#define MCI_COMMAND2_RESET_RX_NUM_CYCLES_GET(x) (((x) & 0x000003fc) >> 2) -#define MCI_COMMAND2_RESET_RX_NUM_CYCLES_SET(x) (((x) << 2) & 0x000003fc) - -/* macros for MCI_RX_CTRL */ -#define MCI_RX_CTRL_ADDRESS 0x0000000c -#define MCI_RX_CTRL_OFFSET 0x0000000c -#define MCI_RX_CTRL_DISABLE_TIMESTAMP_MSB 0 -#define MCI_RX_CTRL_DISABLE_TIMESTAMP_LSB 0 -#define MCI_RX_CTRL_DISABLE_TIMESTAMP_MASK 0x00000001 -#define MCI_RX_CTRL_DISABLE_TIMESTAMP_GET(x) (((x) & 0x00000001) >> 0) -#define MCI_RX_CTRL_DISABLE_TIMESTAMP_SET(x) (((x) << 0) & 0x00000001) -#define MCI_RX_CTRL_DISABLE_MAXGAIN_RESET_MSB 1 -#define MCI_RX_CTRL_DISABLE_MAXGAIN_RESET_LSB 1 -#define MCI_RX_CTRL_DISABLE_MAXGAIN_RESET_MASK 0x00000002 -#define MCI_RX_CTRL_DISABLE_MAXGAIN_RESET_GET(x) (((x) & 0x00000002) >> 1) -#define MCI_RX_CTRL_DISABLE_MAXGAIN_RESET_SET(x) (((x) << 1) & 0x00000002) -#define MCI_RX_CTRL_DISABLE_MAXGAIN_WBTIMER_RESET_MSB 2 -#define MCI_RX_CTRL_DISABLE_MAXGAIN_WBTIMER_RESET_LSB 2 -#define MCI_RX_CTRL_DISABLE_MAXGAIN_WBTIMER_RESET_MASK 0x00000004 -#define MCI_RX_CTRL_DISABLE_MAXGAIN_WBTIMER_RESET_GET(x) (((x) & 0x00000004) >> 2) -#define MCI_RX_CTRL_DISABLE_MAXGAIN_WBTIMER_RESET_SET(x) (((x) << 2) & 0x00000004) - -/* macros for MCI_TX_CTRL */ -#define MCI_TX_CTRL_ADDRESS 0x00000010 -#define MCI_TX_CTRL_OFFSET 0x00000010 -#define MCI_TX_CTRL_CLK_DIV_MSB 1 -#define MCI_TX_CTRL_CLK_DIV_LSB 0 -#define MCI_TX_CTRL_CLK_DIV_MASK 0x00000003 -#define MCI_TX_CTRL_CLK_DIV_GET(x) (((x) & 0x00000003) >> 0) -#define MCI_TX_CTRL_CLK_DIV_SET(x) (((x) << 0) & 0x00000003) -#define MCI_TX_CTRL_DISABLE_LNA_UPDATES_MSB 2 -#define MCI_TX_CTRL_DISABLE_LNA_UPDATES_LSB 2 -#define MCI_TX_CTRL_DISABLE_LNA_UPDATES_MASK 0x00000004 -#define MCI_TX_CTRL_DISABLE_LNA_UPDATES_GET(x) (((x) & 0x00000004) >> 2) -#define MCI_TX_CTRL_DISABLE_LNA_UPDATES_SET(x) (((x) << 2) & 0x00000004) -#define MCI_TX_CTRL_GAIN_UPDATE_FREQ_MSB 23 -#define MCI_TX_CTRL_GAIN_UPDATE_FREQ_LSB 3 -#define MCI_TX_CTRL_GAIN_UPDATE_FREQ_MASK 0x00fffff8 -#define MCI_TX_CTRL_GAIN_UPDATE_FREQ_GET(x) (((x) & 0x00fffff8) >> 3) -#define MCI_TX_CTRL_GAIN_UPDATE_FREQ_SET(x) (((x) << 3) & 0x00fffff8) -#define MCI_TX_CTRL_GAIN_UPDATE_NUM_MSB 27 -#define MCI_TX_CTRL_GAIN_UPDATE_NUM_LSB 24 -#define MCI_TX_CTRL_GAIN_UPDATE_NUM_MASK 0x0f000000 -#define MCI_TX_CTRL_GAIN_UPDATE_NUM_GET(x) (((x) & 0x0f000000) >> 24) -#define MCI_TX_CTRL_GAIN_UPDATE_NUM_SET(x) (((x) << 24) & 0x0f000000) - -/* macros for MCI_MSG_ATTRIBUTES_TABLE */ -#define MCI_MSG_ATTRIBUTES_TABLE_ADDRESS 0x00000014 -#define MCI_MSG_ATTRIBUTES_TABLE_OFFSET 0x00000014 -#define MCI_MSG_ATTRIBUTES_TABLE_CHECKSUM_EN_MSB 15 -#define MCI_MSG_ATTRIBUTES_TABLE_CHECKSUM_EN_LSB 0 -#define MCI_MSG_ATTRIBUTES_TABLE_CHECKSUM_EN_MASK 0x0000ffff -#define MCI_MSG_ATTRIBUTES_TABLE_CHECKSUM_EN_GET(x) (((x) & 0x0000ffff) >> 0) -#define MCI_MSG_ATTRIBUTES_TABLE_CHECKSUM_EN_SET(x) (((x) << 0) & 0x0000ffff) -#define MCI_MSG_ATTRIBUTES_TABLE_INVALID_HDR_MSB 31 -#define MCI_MSG_ATTRIBUTES_TABLE_INVALID_HDR_LSB 16 -#define MCI_MSG_ATTRIBUTES_TABLE_INVALID_HDR_MASK 0xffff0000 -#define MCI_MSG_ATTRIBUTES_TABLE_INVALID_HDR_GET(x) (((x) & 0xffff0000) >> 16) -#define MCI_MSG_ATTRIBUTES_TABLE_INVALID_HDR_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MCI_SCHD_TABLE_0 */ -#define MCI_SCHD_TABLE_0_ADDRESS 0x00000018 -#define MCI_SCHD_TABLE_0_OFFSET 0x00000018 -#define MCI_SCHD_TABLE_0_BASE_ADDR_MSB 31 -#define MCI_SCHD_TABLE_0_BASE_ADDR_LSB 0 -#define MCI_SCHD_TABLE_0_BASE_ADDR_MASK 0xffffffff -#define MCI_SCHD_TABLE_0_BASE_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define MCI_SCHD_TABLE_0_BASE_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MCI_SCHD_TABLE_1 */ -#define MCI_SCHD_TABLE_1_ADDRESS 0x0000001c -#define MCI_SCHD_TABLE_1_OFFSET 0x0000001c -#define MCI_SCHD_TABLE_1_OWN_MSB 15 -#define MCI_SCHD_TABLE_1_OWN_LSB 0 -#define MCI_SCHD_TABLE_1_OWN_MASK 0x0000ffff -#define MCI_SCHD_TABLE_1_OWN_GET(x) (((x) & 0x0000ffff) >> 0) -#define MCI_SCHD_TABLE_1_OWN_SET(x) (((x) << 0) & 0x0000ffff) -#define MCI_SCHD_TABLE_1_SW_REQ_OWN_MSB 31 -#define MCI_SCHD_TABLE_1_SW_REQ_OWN_LSB 16 -#define MCI_SCHD_TABLE_1_SW_REQ_OWN_MASK 0xffff0000 -#define MCI_SCHD_TABLE_1_SW_REQ_OWN_GET(x) (((x) & 0xffff0000) >> 16) -#define MCI_SCHD_TABLE_1_SW_REQ_OWN_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MCI_GPM_0 */ -#define MCI_GPM_0_ADDRESS 0x00000020 -#define MCI_GPM_0_OFFSET 0x00000020 -#define MCI_GPM_0_START_ADDR_MSB 31 -#define MCI_GPM_0_START_ADDR_LSB 0 -#define MCI_GPM_0_START_ADDR_MASK 0xffffffff -#define MCI_GPM_0_START_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define MCI_GPM_0_START_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MCI_GPM_1 */ -#define MCI_GPM_1_ADDRESS 0x00000024 -#define MCI_GPM_1_OFFSET 0x00000024 -#define MCI_GPM_1_LEN_MSB 15 -#define MCI_GPM_1_LEN_LSB 0 -#define MCI_GPM_1_LEN_MASK 0x0000ffff -#define MCI_GPM_1_LEN_GET(x) (((x) & 0x0000ffff) >> 0) -#define MCI_GPM_1_LEN_SET(x) (((x) << 0) & 0x0000ffff) -#define MCI_GPM_1_WRITE_PTR_MSB 31 -#define MCI_GPM_1_WRITE_PTR_LSB 16 -#define MCI_GPM_1_WRITE_PTR_MASK 0xffff0000 -#define MCI_GPM_1_WRITE_PTR_GET(x) (((x) & 0xffff0000) >> 16) - -/* macros for MCI_INTERRUPT_RAW */ -#define MCI_INTERRUPT_RAW_ADDRESS 0x00000028 -#define MCI_INTERRUPT_RAW_OFFSET 0x00000028 -#define MCI_INTERRUPT_RAW_SW_MSG_DONE_MSB 0 -#define MCI_INTERRUPT_RAW_SW_MSG_DONE_LSB 0 -#define MCI_INTERRUPT_RAW_SW_MSG_DONE_MASK 0x00000001 -#define MCI_INTERRUPT_RAW_SW_MSG_DONE_GET(x) (((x) & 0x00000001) >> 0) -#define MCI_INTERRUPT_RAW_SW_MSG_DONE_SET(x) (((x) << 0) & 0x00000001) -#define MCI_INTERRUPT_RAW_CPU_INT_MSG_MSB 1 -#define MCI_INTERRUPT_RAW_CPU_INT_MSG_LSB 1 -#define MCI_INTERRUPT_RAW_CPU_INT_MSG_MASK 0x00000002 -#define MCI_INTERRUPT_RAW_CPU_INT_MSG_GET(x) (((x) & 0x00000002) >> 1) -#define MCI_INTERRUPT_RAW_CPU_INT_MSG_SET(x) (((x) << 1) & 0x00000002) -#define MCI_INTERRUPT_RAW_RX_CKSUM_FAIL_MSB 2 -#define MCI_INTERRUPT_RAW_RX_CKSUM_FAIL_LSB 2 -#define MCI_INTERRUPT_RAW_RX_CKSUM_FAIL_MASK 0x00000004 -#define MCI_INTERRUPT_RAW_RX_CKSUM_FAIL_GET(x) (((x) & 0x00000004) >> 2) -#define MCI_INTERRUPT_RAW_RX_CKSUM_FAIL_SET(x) (((x) << 2) & 0x00000004) -#define MCI_INTERRUPT_RAW_RX_INVALID_HDR_MSB 3 -#define MCI_INTERRUPT_RAW_RX_INVALID_HDR_LSB 3 -#define MCI_INTERRUPT_RAW_RX_INVALID_HDR_MASK 0x00000008 -#define MCI_INTERRUPT_RAW_RX_INVALID_HDR_GET(x) (((x) & 0x00000008) >> 3) -#define MCI_INTERRUPT_RAW_RX_INVALID_HDR_SET(x) (((x) << 3) & 0x00000008) -#define MCI_INTERRUPT_RAW_RX_HW_MSG_FAIL_MSB 4 -#define MCI_INTERRUPT_RAW_RX_HW_MSG_FAIL_LSB 4 -#define MCI_INTERRUPT_RAW_RX_HW_MSG_FAIL_MASK 0x00000010 -#define MCI_INTERRUPT_RAW_RX_HW_MSG_FAIL_GET(x) (((x) & 0x00000010) >> 4) -#define MCI_INTERRUPT_RAW_RX_HW_MSG_FAIL_SET(x) (((x) << 4) & 0x00000010) -#define MCI_INTERRUPT_RAW_RX_SW_MSG_FAIL_MSB 5 -#define MCI_INTERRUPT_RAW_RX_SW_MSG_FAIL_LSB 5 -#define MCI_INTERRUPT_RAW_RX_SW_MSG_FAIL_MASK 0x00000020 -#define MCI_INTERRUPT_RAW_RX_SW_MSG_FAIL_GET(x) (((x) & 0x00000020) >> 5) -#define MCI_INTERRUPT_RAW_RX_SW_MSG_FAIL_SET(x) (((x) << 5) & 0x00000020) -#define MCI_INTERRUPT_RAW_TX_HW_MSG_FAIL_MSB 7 -#define MCI_INTERRUPT_RAW_TX_HW_MSG_FAIL_LSB 7 -#define MCI_INTERRUPT_RAW_TX_HW_MSG_FAIL_MASK 0x00000080 -#define MCI_INTERRUPT_RAW_TX_HW_MSG_FAIL_GET(x) (((x) & 0x00000080) >> 7) -#define MCI_INTERRUPT_RAW_TX_HW_MSG_FAIL_SET(x) (((x) << 7) & 0x00000080) -#define MCI_INTERRUPT_RAW_TX_SW_MSG_FAIL_MSB 8 -#define MCI_INTERRUPT_RAW_TX_SW_MSG_FAIL_LSB 8 -#define MCI_INTERRUPT_RAW_TX_SW_MSG_FAIL_MASK 0x00000100 -#define MCI_INTERRUPT_RAW_TX_SW_MSG_FAIL_GET(x) (((x) & 0x00000100) >> 8) -#define MCI_INTERRUPT_RAW_TX_SW_MSG_FAIL_SET(x) (((x) << 8) & 0x00000100) -#define MCI_INTERRUPT_RAW_RX_MSG_MSB 9 -#define MCI_INTERRUPT_RAW_RX_MSG_LSB 9 -#define MCI_INTERRUPT_RAW_RX_MSG_MASK 0x00000200 -#define MCI_INTERRUPT_RAW_RX_MSG_GET(x) (((x) & 0x00000200) >> 9) -#define MCI_INTERRUPT_RAW_RX_MSG_SET(x) (((x) << 9) & 0x00000200) -#define MCI_INTERRUPT_RAW_REMOTE_SLEEP_UPDATE_MSB 10 -#define MCI_INTERRUPT_RAW_REMOTE_SLEEP_UPDATE_LSB 10 -#define MCI_INTERRUPT_RAW_REMOTE_SLEEP_UPDATE_MASK 0x00000400 -#define MCI_INTERRUPT_RAW_REMOTE_SLEEP_UPDATE_GET(x) (((x) & 0x00000400) >> 10) -#define MCI_INTERRUPT_RAW_REMOTE_SLEEP_UPDATE_SET(x) (((x) << 10) & 0x00000400) -#define MCI_INTERRUPT_RAW_BT_PRI_MSB 26 -#define MCI_INTERRUPT_RAW_BT_PRI_LSB 11 -#define MCI_INTERRUPT_RAW_BT_PRI_MASK 0x07fff800 -#define MCI_INTERRUPT_RAW_BT_PRI_GET(x) (((x) & 0x07fff800) >> 11) -#define MCI_INTERRUPT_RAW_BT_PRI_SET(x) (((x) << 11) & 0x07fff800) -#define MCI_INTERRUPT_RAW_BT_PRI_THRESH_MSB 27 -#define MCI_INTERRUPT_RAW_BT_PRI_THRESH_LSB 27 -#define MCI_INTERRUPT_RAW_BT_PRI_THRESH_MASK 0x08000000 -#define MCI_INTERRUPT_RAW_BT_PRI_THRESH_GET(x) (((x) & 0x08000000) >> 27) -#define MCI_INTERRUPT_RAW_BT_PRI_THRESH_SET(x) (((x) << 27) & 0x08000000) -#define MCI_INTERRUPT_RAW_BT_FREQ_MSB 28 -#define MCI_INTERRUPT_RAW_BT_FREQ_LSB 28 -#define MCI_INTERRUPT_RAW_BT_FREQ_MASK 0x10000000 -#define MCI_INTERRUPT_RAW_BT_FREQ_GET(x) (((x) & 0x10000000) >> 28) -#define MCI_INTERRUPT_RAW_BT_FREQ_SET(x) (((x) << 28) & 0x10000000) -#define MCI_INTERRUPT_RAW_BT_STOMP_MSB 29 -#define MCI_INTERRUPT_RAW_BT_STOMP_LSB 29 -#define MCI_INTERRUPT_RAW_BT_STOMP_MASK 0x20000000 -#define MCI_INTERRUPT_RAW_BT_STOMP_GET(x) (((x) & 0x20000000) >> 29) -#define MCI_INTERRUPT_RAW_BT_STOMP_SET(x) (((x) << 29) & 0x20000000) - -/* macros for MCI_INTERRUPT_EN */ -#define MCI_INTERRUPT_EN_ADDRESS 0x0000002c -#define MCI_INTERRUPT_EN_OFFSET 0x0000002c -#define MCI_INTERRUPT_EN_SW_MSG_DONE_MSB 0 -#define MCI_INTERRUPT_EN_SW_MSG_DONE_LSB 0 -#define MCI_INTERRUPT_EN_SW_MSG_DONE_MASK 0x00000001 -#define MCI_INTERRUPT_EN_SW_MSG_DONE_GET(x) (((x) & 0x00000001) >> 0) -#define MCI_INTERRUPT_EN_SW_MSG_DONE_SET(x) (((x) << 0) & 0x00000001) -#define MCI_INTERRUPT_EN_CPU_INT_MSG_MSB 1 -#define MCI_INTERRUPT_EN_CPU_INT_MSG_LSB 1 -#define MCI_INTERRUPT_EN_CPU_INT_MSG_MASK 0x00000002 -#define MCI_INTERRUPT_EN_CPU_INT_MSG_GET(x) (((x) & 0x00000002) >> 1) -#define MCI_INTERRUPT_EN_CPU_INT_MSG_SET(x) (((x) << 1) & 0x00000002) -#define MCI_INTERRUPT_EN_RX_CKSUM_FAIL_MSB 2 -#define MCI_INTERRUPT_EN_RX_CKSUM_FAIL_LSB 2 -#define MCI_INTERRUPT_EN_RX_CKSUM_FAIL_MASK 0x00000004 -#define MCI_INTERRUPT_EN_RX_CKSUM_FAIL_GET(x) (((x) & 0x00000004) >> 2) -#define MCI_INTERRUPT_EN_RX_CKSUM_FAIL_SET(x) (((x) << 2) & 0x00000004) -#define MCI_INTERRUPT_EN_RX_INVALID_HDR_MSB 3 -#define MCI_INTERRUPT_EN_RX_INVALID_HDR_LSB 3 -#define MCI_INTERRUPT_EN_RX_INVALID_HDR_MASK 0x00000008 -#define MCI_INTERRUPT_EN_RX_INVALID_HDR_GET(x) (((x) & 0x00000008) >> 3) -#define MCI_INTERRUPT_EN_RX_INVALID_HDR_SET(x) (((x) << 3) & 0x00000008) -#define MCI_INTERRUPT_EN_RX_HW_MSG_FAIL_MSB 4 -#define MCI_INTERRUPT_EN_RX_HW_MSG_FAIL_LSB 4 -#define MCI_INTERRUPT_EN_RX_HW_MSG_FAIL_MASK 0x00000010 -#define MCI_INTERRUPT_EN_RX_HW_MSG_FAIL_GET(x) (((x) & 0x00000010) >> 4) -#define MCI_INTERRUPT_EN_RX_HW_MSG_FAIL_SET(x) (((x) << 4) & 0x00000010) -#define MCI_INTERRUPT_EN_RX_SW_MSG_FAIL_MSB 5 -#define MCI_INTERRUPT_EN_RX_SW_MSG_FAIL_LSB 5 -#define MCI_INTERRUPT_EN_RX_SW_MSG_FAIL_MASK 0x00000020 -#define MCI_INTERRUPT_EN_RX_SW_MSG_FAIL_GET(x) (((x) & 0x00000020) >> 5) -#define MCI_INTERRUPT_EN_RX_SW_MSG_FAIL_SET(x) (((x) << 5) & 0x00000020) -#define MCI_INTERRUPT_EN_TX_HW_MSG_FAIL_MSB 7 -#define MCI_INTERRUPT_EN_TX_HW_MSG_FAIL_LSB 7 -#define MCI_INTERRUPT_EN_TX_HW_MSG_FAIL_MASK 0x00000080 -#define MCI_INTERRUPT_EN_TX_HW_MSG_FAIL_GET(x) (((x) & 0x00000080) >> 7) -#define MCI_INTERRUPT_EN_TX_HW_MSG_FAIL_SET(x) (((x) << 7) & 0x00000080) -#define MCI_INTERRUPT_EN_TX_SW_MSG_FAIL_MSB 8 -#define MCI_INTERRUPT_EN_TX_SW_MSG_FAIL_LSB 8 -#define MCI_INTERRUPT_EN_TX_SW_MSG_FAIL_MASK 0x00000100 -#define MCI_INTERRUPT_EN_TX_SW_MSG_FAIL_GET(x) (((x) & 0x00000100) >> 8) -#define MCI_INTERRUPT_EN_TX_SW_MSG_FAIL_SET(x) (((x) << 8) & 0x00000100) -#define MCI_INTERRUPT_EN_RX_MSG_MSB 9 -#define MCI_INTERRUPT_EN_RX_MSG_LSB 9 -#define MCI_INTERRUPT_EN_RX_MSG_MASK 0x00000200 -#define MCI_INTERRUPT_EN_RX_MSG_GET(x) (((x) & 0x00000200) >> 9) -#define MCI_INTERRUPT_EN_RX_MSG_SET(x) (((x) << 9) & 0x00000200) -#define MCI_INTERRUPT_EN_REMOTE_SLEEP_UPDATE_MSB 10 -#define MCI_INTERRUPT_EN_REMOTE_SLEEP_UPDATE_LSB 10 -#define MCI_INTERRUPT_EN_REMOTE_SLEEP_UPDATE_MASK 0x00000400 -#define MCI_INTERRUPT_EN_REMOTE_SLEEP_UPDATE_GET(x) (((x) & 0x00000400) >> 10) -#define MCI_INTERRUPT_EN_REMOTE_SLEEP_UPDATE_SET(x) (((x) << 10) & 0x00000400) -#define MCI_INTERRUPT_EN_BT_PRI_MSB 26 -#define MCI_INTERRUPT_EN_BT_PRI_LSB 11 -#define MCI_INTERRUPT_EN_BT_PRI_MASK 0x07fff800 -#define MCI_INTERRUPT_EN_BT_PRI_GET(x) (((x) & 0x07fff800) >> 11) -#define MCI_INTERRUPT_EN_BT_PRI_SET(x) (((x) << 11) & 0x07fff800) -#define MCI_INTERRUPT_EN_BT_PRI_THRESH_MSB 27 -#define MCI_INTERRUPT_EN_BT_PRI_THRESH_LSB 27 -#define MCI_INTERRUPT_EN_BT_PRI_THRESH_MASK 0x08000000 -#define MCI_INTERRUPT_EN_BT_PRI_THRESH_GET(x) (((x) & 0x08000000) >> 27) -#define MCI_INTERRUPT_EN_BT_PRI_THRESH_SET(x) (((x) << 27) & 0x08000000) -#define MCI_INTERRUPT_EN_BT_FREQ_MSB 28 -#define MCI_INTERRUPT_EN_BT_FREQ_LSB 28 -#define MCI_INTERRUPT_EN_BT_FREQ_MASK 0x10000000 -#define MCI_INTERRUPT_EN_BT_FREQ_GET(x) (((x) & 0x10000000) >> 28) -#define MCI_INTERRUPT_EN_BT_FREQ_SET(x) (((x) << 28) & 0x10000000) -#define MCI_INTERRUPT_EN_BT_STOMP_MSB 29 -#define MCI_INTERRUPT_EN_BT_STOMP_LSB 29 -#define MCI_INTERRUPT_EN_BT_STOMP_MASK 0x20000000 -#define MCI_INTERRUPT_EN_BT_STOMP_GET(x) (((x) & 0x20000000) >> 29) -#define MCI_INTERRUPT_EN_BT_STOMP_SET(x) (((x) << 29) & 0x20000000) - -/* macros for MCI_REMOTE_CPU_INT */ -#define MCI_REMOTE_CPU_INT_ADDRESS 0x00000030 -#define MCI_REMOTE_CPU_INT_OFFSET 0x00000030 -#define MCI_REMOTE_CPU_INT_BODY_MSB 31 -#define MCI_REMOTE_CPU_INT_BODY_LSB 0 -#define MCI_REMOTE_CPU_INT_BODY_MASK 0xffffffff -#define MCI_REMOTE_CPU_INT_BODY_GET(x) (((x) & 0xffffffff) >> 0) -#define MCI_REMOTE_CPU_INT_BODY_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MCI_REMOTE_CPU_INT_EN */ -#define MCI_REMOTE_CPU_INT_EN_ADDRESS 0x00000034 -#define MCI_REMOTE_CPU_INT_EN_OFFSET 0x00000034 -#define MCI_REMOTE_CPU_INT_EN_BODY_MSB 31 -#define MCI_REMOTE_CPU_INT_EN_BODY_LSB 0 -#define MCI_REMOTE_CPU_INT_EN_BODY_MASK 0xffffffff -#define MCI_REMOTE_CPU_INT_EN_BODY_GET(x) (((x) & 0xffffffff) >> 0) -#define MCI_REMOTE_CPU_INT_EN_BODY_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MCI_INTERRUPT_RX_MSG_RAW */ -#define MCI_INTERRUPT_RX_MSG_RAW_ADDRESS 0x00000038 -#define MCI_INTERRUPT_RX_MSG_RAW_OFFSET 0x00000038 -#define MCI_INTERRUPT_RX_MSG_RAW_REMOTE_RESET_MSB 0 -#define MCI_INTERRUPT_RX_MSG_RAW_REMOTE_RESET_LSB 0 -#define MCI_INTERRUPT_RX_MSG_RAW_REMOTE_RESET_MASK 0x00000001 -#define MCI_INTERRUPT_RX_MSG_RAW_REMOTE_RESET_GET(x) (((x) & 0x00000001) >> 0) -#define MCI_INTERRUPT_RX_MSG_RAW_REMOTE_RESET_SET(x) (((x) << 0) & 0x00000001) -#define MCI_INTERRUPT_RX_MSG_RAW_LNA_CTRL_MSB 1 -#define MCI_INTERRUPT_RX_MSG_RAW_LNA_CTRL_LSB 1 -#define MCI_INTERRUPT_RX_MSG_RAW_LNA_CTRL_MASK 0x00000002 -#define MCI_INTERRUPT_RX_MSG_RAW_LNA_CTRL_GET(x) (((x) & 0x00000002) >> 1) -#define MCI_INTERRUPT_RX_MSG_RAW_LNA_CTRL_SET(x) (((x) << 1) & 0x00000002) -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_NACK_MSB 2 -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_NACK_LSB 2 -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_NACK_MASK 0x00000004 -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_NACK_GET(x) (((x) & 0x00000004) >> 2) -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_NACK_SET(x) (((x) << 2) & 0x00000004) -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_INFO_MSB 3 -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_INFO_LSB 3 -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_INFO_MASK 0x00000008 -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_INFO_GET(x) (((x) & 0x00000008) >> 3) -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_INFO_SET(x) (((x) << 3) & 0x00000008) -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_RST_MSB 4 -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_RST_LSB 4 -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_RST_MASK 0x00000010 -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_RST_GET(x) (((x) & 0x00000010) >> 4) -#define MCI_INTERRUPT_RX_MSG_RAW_CONT_RST_SET(x) (((x) << 4) & 0x00000010) -#define MCI_INTERRUPT_RX_MSG_RAW_SCHD_INFO_MSB 5 -#define MCI_INTERRUPT_RX_MSG_RAW_SCHD_INFO_LSB 5 -#define MCI_INTERRUPT_RX_MSG_RAW_SCHD_INFO_MASK 0x00000020 -#define MCI_INTERRUPT_RX_MSG_RAW_SCHD_INFO_GET(x) (((x) & 0x00000020) >> 5) -#define MCI_INTERRUPT_RX_MSG_RAW_SCHD_INFO_SET(x) (((x) << 5) & 0x00000020) -#define MCI_INTERRUPT_RX_MSG_RAW_CPU_INT_MSB 6 -#define MCI_INTERRUPT_RX_MSG_RAW_CPU_INT_LSB 6 -#define MCI_INTERRUPT_RX_MSG_RAW_CPU_INT_MASK 0x00000040 -#define MCI_INTERRUPT_RX_MSG_RAW_CPU_INT_GET(x) (((x) & 0x00000040) >> 6) -#define MCI_INTERRUPT_RX_MSG_RAW_CPU_INT_SET(x) (((x) << 6) & 0x00000040) -#define MCI_INTERRUPT_RX_MSG_RAW_GPM_MSB 8 -#define MCI_INTERRUPT_RX_MSG_RAW_GPM_LSB 8 -#define MCI_INTERRUPT_RX_MSG_RAW_GPM_MASK 0x00000100 -#define MCI_INTERRUPT_RX_MSG_RAW_GPM_GET(x) (((x) & 0x00000100) >> 8) -#define MCI_INTERRUPT_RX_MSG_RAW_GPM_SET(x) (((x) << 8) & 0x00000100) -#define MCI_INTERRUPT_RX_MSG_RAW_LNA_INFO_MSB 9 -#define MCI_INTERRUPT_RX_MSG_RAW_LNA_INFO_LSB 9 -#define MCI_INTERRUPT_RX_MSG_RAW_LNA_INFO_MASK 0x00000200 -#define MCI_INTERRUPT_RX_MSG_RAW_LNA_INFO_GET(x) (((x) & 0x00000200) >> 9) -#define MCI_INTERRUPT_RX_MSG_RAW_LNA_INFO_SET(x) (((x) << 9) & 0x00000200) -#define MCI_INTERRUPT_RX_MSG_RAW_SYS_SLEEPING_MSB 10 -#define MCI_INTERRUPT_RX_MSG_RAW_SYS_SLEEPING_LSB 10 -#define MCI_INTERRUPT_RX_MSG_RAW_SYS_SLEEPING_MASK 0x00000400 -#define MCI_INTERRUPT_RX_MSG_RAW_SYS_SLEEPING_GET(x) (((x) & 0x00000400) >> 10) -#define MCI_INTERRUPT_RX_MSG_RAW_SYS_SLEEPING_SET(x) (((x) << 10) & 0x00000400) -#define MCI_INTERRUPT_RX_MSG_RAW_SYS_WAKING_MSB 11 -#define MCI_INTERRUPT_RX_MSG_RAW_SYS_WAKING_LSB 11 -#define MCI_INTERRUPT_RX_MSG_RAW_SYS_WAKING_MASK 0x00000800 -#define MCI_INTERRUPT_RX_MSG_RAW_SYS_WAKING_GET(x) (((x) & 0x00000800) >> 11) -#define MCI_INTERRUPT_RX_MSG_RAW_SYS_WAKING_SET(x) (((x) << 11) & 0x00000800) -#define MCI_INTERRUPT_RX_MSG_RAW_REQ_WAKE_MSB 12 -#define MCI_INTERRUPT_RX_MSG_RAW_REQ_WAKE_LSB 12 -#define MCI_INTERRUPT_RX_MSG_RAW_REQ_WAKE_MASK 0x00001000 -#define MCI_INTERRUPT_RX_MSG_RAW_REQ_WAKE_GET(x) (((x) & 0x00001000) >> 12) -#define MCI_INTERRUPT_RX_MSG_RAW_REQ_WAKE_SET(x) (((x) << 12) & 0x00001000) - -/* macros for MCI_INTERRUPT_RX_MSG_EN */ -#define MCI_INTERRUPT_RX_MSG_EN_ADDRESS 0x0000003c -#define MCI_INTERRUPT_RX_MSG_EN_OFFSET 0x0000003c -#define MCI_INTERRUPT_RX_MSG_EN_REMOTE_RESET_MSB 0 -#define MCI_INTERRUPT_RX_MSG_EN_REMOTE_RESET_LSB 0 -#define MCI_INTERRUPT_RX_MSG_EN_REMOTE_RESET_MASK 0x00000001 -#define MCI_INTERRUPT_RX_MSG_EN_REMOTE_RESET_GET(x) (((x) & 0x00000001) >> 0) -#define MCI_INTERRUPT_RX_MSG_EN_REMOTE_RESET_SET(x) (((x) << 0) & 0x00000001) -#define MCI_INTERRUPT_RX_MSG_EN_LNA_CTRL_MSB 1 -#define MCI_INTERRUPT_RX_MSG_EN_LNA_CTRL_LSB 1 -#define MCI_INTERRUPT_RX_MSG_EN_LNA_CTRL_MASK 0x00000002 -#define MCI_INTERRUPT_RX_MSG_EN_LNA_CTRL_GET(x) (((x) & 0x00000002) >> 1) -#define MCI_INTERRUPT_RX_MSG_EN_LNA_CTRL_SET(x) (((x) << 1) & 0x00000002) -#define MCI_INTERRUPT_RX_MSG_EN_CONT_NACK_MSB 2 -#define MCI_INTERRUPT_RX_MSG_EN_CONT_NACK_LSB 2 -#define MCI_INTERRUPT_RX_MSG_EN_CONT_NACK_MASK 0x00000004 -#define MCI_INTERRUPT_RX_MSG_EN_CONT_NACK_GET(x) (((x) & 0x00000004) >> 2) -#define MCI_INTERRUPT_RX_MSG_EN_CONT_NACK_SET(x) (((x) << 2) & 0x00000004) -#define MCI_INTERRUPT_RX_MSG_EN_CONT_INFO_MSB 3 -#define MCI_INTERRUPT_RX_MSG_EN_CONT_INFO_LSB 3 -#define MCI_INTERRUPT_RX_MSG_EN_CONT_INFO_MASK 0x00000008 -#define MCI_INTERRUPT_RX_MSG_EN_CONT_INFO_GET(x) (((x) & 0x00000008) >> 3) -#define MCI_INTERRUPT_RX_MSG_EN_CONT_INFO_SET(x) (((x) << 3) & 0x00000008) -#define MCI_INTERRUPT_RX_MSG_EN_CONT_RST_MSB 4 -#define MCI_INTERRUPT_RX_MSG_EN_CONT_RST_LSB 4 -#define MCI_INTERRUPT_RX_MSG_EN_CONT_RST_MASK 0x00000010 -#define MCI_INTERRUPT_RX_MSG_EN_CONT_RST_GET(x) (((x) & 0x00000010) >> 4) -#define MCI_INTERRUPT_RX_MSG_EN_CONT_RST_SET(x) (((x) << 4) & 0x00000010) -#define MCI_INTERRUPT_RX_MSG_EN_SCHD_INFO_MSB 5 -#define MCI_INTERRUPT_RX_MSG_EN_SCHD_INFO_LSB 5 -#define MCI_INTERRUPT_RX_MSG_EN_SCHD_INFO_MASK 0x00000020 -#define MCI_INTERRUPT_RX_MSG_EN_SCHD_INFO_GET(x) (((x) & 0x00000020) >> 5) -#define MCI_INTERRUPT_RX_MSG_EN_SCHD_INFO_SET(x) (((x) << 5) & 0x00000020) -#define MCI_INTERRUPT_RX_MSG_EN_CPU_INT_MSB 6 -#define MCI_INTERRUPT_RX_MSG_EN_CPU_INT_LSB 6 -#define MCI_INTERRUPT_RX_MSG_EN_CPU_INT_MASK 0x00000040 -#define MCI_INTERRUPT_RX_MSG_EN_CPU_INT_GET(x) (((x) & 0x00000040) >> 6) -#define MCI_INTERRUPT_RX_MSG_EN_CPU_INT_SET(x) (((x) << 6) & 0x00000040) -#define MCI_INTERRUPT_RX_MSG_EN_GPM_MSB 8 -#define MCI_INTERRUPT_RX_MSG_EN_GPM_LSB 8 -#define MCI_INTERRUPT_RX_MSG_EN_GPM_MASK 0x00000100 -#define MCI_INTERRUPT_RX_MSG_EN_GPM_GET(x) (((x) & 0x00000100) >> 8) -#define MCI_INTERRUPT_RX_MSG_EN_GPM_SET(x) (((x) << 8) & 0x00000100) -#define MCI_INTERRUPT_RX_MSG_EN_LNA_INFO_MSB 9 -#define MCI_INTERRUPT_RX_MSG_EN_LNA_INFO_LSB 9 -#define MCI_INTERRUPT_RX_MSG_EN_LNA_INFO_MASK 0x00000200 -#define MCI_INTERRUPT_RX_MSG_EN_LNA_INFO_GET(x) (((x) & 0x00000200) >> 9) -#define MCI_INTERRUPT_RX_MSG_EN_LNA_INFO_SET(x) (((x) << 9) & 0x00000200) -#define MCI_INTERRUPT_RX_MSG_EN_SYS_SLEEPING_MSB 10 -#define MCI_INTERRUPT_RX_MSG_EN_SYS_SLEEPING_LSB 10 -#define MCI_INTERRUPT_RX_MSG_EN_SYS_SLEEPING_MASK 0x00000400 -#define MCI_INTERRUPT_RX_MSG_EN_SYS_SLEEPING_GET(x) (((x) & 0x00000400) >> 10) -#define MCI_INTERRUPT_RX_MSG_EN_SYS_SLEEPING_SET(x) (((x) << 10) & 0x00000400) -#define MCI_INTERRUPT_RX_MSG_EN_SYS_WAKING_MSB 11 -#define MCI_INTERRUPT_RX_MSG_EN_SYS_WAKING_LSB 11 -#define MCI_INTERRUPT_RX_MSG_EN_SYS_WAKING_MASK 0x00000800 -#define MCI_INTERRUPT_RX_MSG_EN_SYS_WAKING_GET(x) (((x) & 0x00000800) >> 11) -#define MCI_INTERRUPT_RX_MSG_EN_SYS_WAKING_SET(x) (((x) << 11) & 0x00000800) -#define MCI_INTERRUPT_RX_MSG_EN_REQ_WAKE_MSB 12 -#define MCI_INTERRUPT_RX_MSG_EN_REQ_WAKE_LSB 12 -#define MCI_INTERRUPT_RX_MSG_EN_REQ_WAKE_MASK 0x00001000 -#define MCI_INTERRUPT_RX_MSG_EN_REQ_WAKE_GET(x) (((x) & 0x00001000) >> 12) -#define MCI_INTERRUPT_RX_MSG_EN_REQ_WAKE_SET(x) (((x) << 12) & 0x00001000) - -/* macros for MCI_CPU_INT */ -#define MCI_CPU_INT_ADDRESS 0x00000040 -#define MCI_CPU_INT_OFFSET 0x00000040 -#define MCI_CPU_INT_MSG_MSB 31 -#define MCI_CPU_INT_MSG_LSB 0 -#define MCI_CPU_INT_MSG_MASK 0xffffffff -#define MCI_CPU_INT_MSG_GET(x) (((x) & 0xffffffff) >> 0) -#define MCI_CPU_INT_MSG_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MCI_RX_STATUS */ -#define MCI_RX_STATUS_ADDRESS 0x00000044 -#define MCI_RX_STATUS_OFFSET 0x00000044 -#define MCI_RX_STATUS_SCHD_MSG_INDEX_MSB 11 -#define MCI_RX_STATUS_SCHD_MSG_INDEX_LSB 8 -#define MCI_RX_STATUS_SCHD_MSG_INDEX_MASK 0x00000f00 -#define MCI_RX_STATUS_SCHD_MSG_INDEX_GET(x) (((x) & 0x00000f00) >> 8) -#define MCI_RX_STATUS_REMOTE_SLEEP_MSB 12 -#define MCI_RX_STATUS_REMOTE_SLEEP_LSB 12 -#define MCI_RX_STATUS_REMOTE_SLEEP_MASK 0x00001000 -#define MCI_RX_STATUS_REMOTE_SLEEP_GET(x) (((x) & 0x00001000) >> 12) - -/* macros for MCI_CONT_STATUS */ -#define MCI_CONT_STATUS_ADDRESS 0x00000048 -#define MCI_CONT_STATUS_OFFSET 0x00000048 -#define MCI_CONT_STATUS_RSSI_POWER_MSB 7 -#define MCI_CONT_STATUS_RSSI_POWER_LSB 0 -#define MCI_CONT_STATUS_RSSI_POWER_MASK 0x000000ff -#define MCI_CONT_STATUS_RSSI_POWER_GET(x) (((x) & 0x000000ff) >> 0) -#define MCI_CONT_STATUS_PRIORITY_MSB 15 -#define MCI_CONT_STATUS_PRIORITY_LSB 8 -#define MCI_CONT_STATUS_PRIORITY_MASK 0x0000ff00 -#define MCI_CONT_STATUS_PRIORITY_GET(x) (((x) & 0x0000ff00) >> 8) -#define MCI_CONT_STATUS_TX_MSB 16 -#define MCI_CONT_STATUS_TX_LSB 16 -#define MCI_CONT_STATUS_TX_MASK 0x00010000 -#define MCI_CONT_STATUS_TX_GET(x) (((x) & 0x00010000) >> 16) -#define MCI_CONT_STATUS_LINKID_MSB 20 -#define MCI_CONT_STATUS_LINKID_LSB 17 -#define MCI_CONT_STATUS_LINKID_MASK 0x001e0000 -#define MCI_CONT_STATUS_LINKID_GET(x) (((x) & 0x001e0000) >> 17) -#define MCI_CONT_STATUS_CHANNEL_MSB 27 -#define MCI_CONT_STATUS_CHANNEL_LSB 21 -#define MCI_CONT_STATUS_CHANNEL_MASK 0x0fe00000 -#define MCI_CONT_STATUS_CHANNEL_GET(x) (((x) & 0x0fe00000) >> 21) -#define MCI_CONT_STATUS_OWNER_MSB 31 -#define MCI_CONT_STATUS_OWNER_LSB 28 -#define MCI_CONT_STATUS_OWNER_MASK 0xf0000000 -#define MCI_CONT_STATUS_OWNER_GET(x) (((x) & 0xf0000000) >> 28) - -/* macros for MCI_BT_PRI0 */ -#define MCI_BT_PRI0_ADDRESS 0x0000004c -#define MCI_BT_PRI0_OFFSET 0x0000004c -#define MCI_BT_PRI0_VAL0_MSB 7 -#define MCI_BT_PRI0_VAL0_LSB 0 -#define MCI_BT_PRI0_VAL0_MASK 0x000000ff -#define MCI_BT_PRI0_VAL0_GET(x) (((x) & 0x000000ff) >> 0) -#define MCI_BT_PRI0_VAL0_SET(x) (((x) << 0) & 0x000000ff) -#define MCI_BT_PRI0_VAL1_MSB 15 -#define MCI_BT_PRI0_VAL1_LSB 8 -#define MCI_BT_PRI0_VAL1_MASK 0x0000ff00 -#define MCI_BT_PRI0_VAL1_GET(x) (((x) & 0x0000ff00) >> 8) -#define MCI_BT_PRI0_VAL1_SET(x) (((x) << 8) & 0x0000ff00) -#define MCI_BT_PRI0_VAL2_MSB 23 -#define MCI_BT_PRI0_VAL2_LSB 16 -#define MCI_BT_PRI0_VAL2_MASK 0x00ff0000 -#define MCI_BT_PRI0_VAL2_GET(x) (((x) & 0x00ff0000) >> 16) -#define MCI_BT_PRI0_VAL2_SET(x) (((x) << 16) & 0x00ff0000) -#define MCI_BT_PRI0_VAL3_MSB 31 -#define MCI_BT_PRI0_VAL3_LSB 24 -#define MCI_BT_PRI0_VAL3_MASK 0xff000000 -#define MCI_BT_PRI0_VAL3_GET(x) (((x) & 0xff000000) >> 24) -#define MCI_BT_PRI0_VAL3_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MCI_BT_PRI1 */ -#define MCI_BT_PRI1_ADDRESS 0x00000050 -#define MCI_BT_PRI1_OFFSET 0x00000050 -#define MCI_BT_PRI1_VAL0_MSB 7 -#define MCI_BT_PRI1_VAL0_LSB 0 -#define MCI_BT_PRI1_VAL0_MASK 0x000000ff -#define MCI_BT_PRI1_VAL0_GET(x) (((x) & 0x000000ff) >> 0) -#define MCI_BT_PRI1_VAL0_SET(x) (((x) << 0) & 0x000000ff) -#define MCI_BT_PRI1_VAL1_MSB 15 -#define MCI_BT_PRI1_VAL1_LSB 8 -#define MCI_BT_PRI1_VAL1_MASK 0x0000ff00 -#define MCI_BT_PRI1_VAL1_GET(x) (((x) & 0x0000ff00) >> 8) -#define MCI_BT_PRI1_VAL1_SET(x) (((x) << 8) & 0x0000ff00) -#define MCI_BT_PRI1_VAL2_MSB 23 -#define MCI_BT_PRI1_VAL2_LSB 16 -#define MCI_BT_PRI1_VAL2_MASK 0x00ff0000 -#define MCI_BT_PRI1_VAL2_GET(x) (((x) & 0x00ff0000) >> 16) -#define MCI_BT_PRI1_VAL2_SET(x) (((x) << 16) & 0x00ff0000) -#define MCI_BT_PRI1_VAL3_MSB 31 -#define MCI_BT_PRI1_VAL3_LSB 24 -#define MCI_BT_PRI1_VAL3_MASK 0xff000000 -#define MCI_BT_PRI1_VAL3_GET(x) (((x) & 0xff000000) >> 24) -#define MCI_BT_PRI1_VAL3_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MCI_BT_PRI2 */ -#define MCI_BT_PRI2_ADDRESS 0x00000054 -#define MCI_BT_PRI2_OFFSET 0x00000054 -#define MCI_BT_PRI2_VAL0_MSB 7 -#define MCI_BT_PRI2_VAL0_LSB 0 -#define MCI_BT_PRI2_VAL0_MASK 0x000000ff -#define MCI_BT_PRI2_VAL0_GET(x) (((x) & 0x000000ff) >> 0) -#define MCI_BT_PRI2_VAL0_SET(x) (((x) << 0) & 0x000000ff) -#define MCI_BT_PRI2_VAL1_MSB 15 -#define MCI_BT_PRI2_VAL1_LSB 8 -#define MCI_BT_PRI2_VAL1_MASK 0x0000ff00 -#define MCI_BT_PRI2_VAL1_GET(x) (((x) & 0x0000ff00) >> 8) -#define MCI_BT_PRI2_VAL1_SET(x) (((x) << 8) & 0x0000ff00) -#define MCI_BT_PRI2_VAL2_MSB 23 -#define MCI_BT_PRI2_VAL2_LSB 16 -#define MCI_BT_PRI2_VAL2_MASK 0x00ff0000 -#define MCI_BT_PRI2_VAL2_GET(x) (((x) & 0x00ff0000) >> 16) -#define MCI_BT_PRI2_VAL2_SET(x) (((x) << 16) & 0x00ff0000) -#define MCI_BT_PRI2_VAL3_MSB 31 -#define MCI_BT_PRI2_VAL3_LSB 24 -#define MCI_BT_PRI2_VAL3_MASK 0xff000000 -#define MCI_BT_PRI2_VAL3_GET(x) (((x) & 0xff000000) >> 24) -#define MCI_BT_PRI2_VAL3_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MCI_BT_PRI3 */ -#define MCI_BT_PRI3_ADDRESS 0x00000058 -#define MCI_BT_PRI3_OFFSET 0x00000058 -#define MCI_BT_PRI3_VAL0_MSB 7 -#define MCI_BT_PRI3_VAL0_LSB 0 -#define MCI_BT_PRI3_VAL0_MASK 0x000000ff -#define MCI_BT_PRI3_VAL0_GET(x) (((x) & 0x000000ff) >> 0) -#define MCI_BT_PRI3_VAL0_SET(x) (((x) << 0) & 0x000000ff) -#define MCI_BT_PRI3_VAL1_MSB 15 -#define MCI_BT_PRI3_VAL1_LSB 8 -#define MCI_BT_PRI3_VAL1_MASK 0x0000ff00 -#define MCI_BT_PRI3_VAL1_GET(x) (((x) & 0x0000ff00) >> 8) -#define MCI_BT_PRI3_VAL1_SET(x) (((x) << 8) & 0x0000ff00) -#define MCI_BT_PRI3_VAL2_MSB 23 -#define MCI_BT_PRI3_VAL2_LSB 16 -#define MCI_BT_PRI3_VAL2_MASK 0x00ff0000 -#define MCI_BT_PRI3_VAL2_GET(x) (((x) & 0x00ff0000) >> 16) -#define MCI_BT_PRI3_VAL2_SET(x) (((x) << 16) & 0x00ff0000) -#define MCI_BT_PRI3_VAL3_MSB 31 -#define MCI_BT_PRI3_VAL3_LSB 24 -#define MCI_BT_PRI3_VAL3_MASK 0xff000000 -#define MCI_BT_PRI3_VAL3_GET(x) (((x) & 0xff000000) >> 24) -#define MCI_BT_PRI3_VAL3_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MCI_BT_PRI */ -#define MCI_BT_PRI_ADDRESS 0x0000005c -#define MCI_BT_PRI_OFFSET 0x0000005c -#define MCI_BT_PRI_THRESH_MSB 7 -#define MCI_BT_PRI_THRESH_LSB 0 -#define MCI_BT_PRI_THRESH_MASK 0x000000ff -#define MCI_BT_PRI_THRESH_GET(x) (((x) & 0x000000ff) >> 0) -#define MCI_BT_PRI_THRESH_SET(x) (((x) << 0) & 0x000000ff) - -/* macros for MCI_WL_FREQ0 */ -#define MCI_WL_FREQ0_ADDRESS 0x00000060 -#define MCI_WL_FREQ0_OFFSET 0x00000060 -#define MCI_WL_FREQ0_MASK_MSB 31 -#define MCI_WL_FREQ0_MASK_LSB 0 -#define MCI_WL_FREQ0_MASK_MASK 0xffffffff -#define MCI_WL_FREQ0_MASK_GET(x) (((x) & 0xffffffff) >> 0) -#define MCI_WL_FREQ0_MASK_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MCI_WL_FREQ1 */ -#define MCI_WL_FREQ1_ADDRESS 0x00000064 -#define MCI_WL_FREQ1_OFFSET 0x00000064 -#define MCI_WL_FREQ1_MASK_MSB 31 -#define MCI_WL_FREQ1_MASK_LSB 0 -#define MCI_WL_FREQ1_MASK_MASK 0xffffffff -#define MCI_WL_FREQ1_MASK_GET(x) (((x) & 0xffffffff) >> 0) -#define MCI_WL_FREQ1_MASK_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MCI_WL_FREQ2 */ -#define MCI_WL_FREQ2_ADDRESS 0x00000068 -#define MCI_WL_FREQ2_OFFSET 0x00000068 -#define MCI_WL_FREQ2_MASK_MSB 15 -#define MCI_WL_FREQ2_MASK_LSB 0 -#define MCI_WL_FREQ2_MASK_MASK 0x0000ffff -#define MCI_WL_FREQ2_MASK_GET(x) (((x) & 0x0000ffff) >> 0) -#define MCI_WL_FREQ2_MASK_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MCI_GAIN */ -#define MCI_GAIN_ADDRESS 0x0000006c -#define MCI_GAIN_OFFSET 0x0000006c -#define MCI_GAIN_OFFSET1_MSB 7 -#define MCI_GAIN_OFFSET1_LSB 0 -#define MCI_GAIN_OFFSET1_MASK 0x000000ff -#define MCI_GAIN_OFFSET1_GET(x) (((x) & 0x000000ff) >> 0) -#define MCI_GAIN_OFFSET1_SET(x) (((x) << 0) & 0x000000ff) -#define MCI_GAIN_OFFSET2_MSB 15 -#define MCI_GAIN_OFFSET2_LSB 8 -#define MCI_GAIN_OFFSET2_MASK 0x0000ff00 -#define MCI_GAIN_OFFSET2_GET(x) (((x) & 0x0000ff00) >> 8) -#define MCI_GAIN_OFFSET2_SET(x) (((x) << 8) & 0x0000ff00) - -/* macros for MCI_WBTIMER1 */ -#define MCI_WBTIMER1_ADDRESS 0x00000070 -#define MCI_WBTIMER1_OFFSET 0x00000070 -#define MCI_WBTIMER1_TARGET_MSB 31 -#define MCI_WBTIMER1_TARGET_LSB 0 -#define MCI_WBTIMER1_TARGET_MASK 0xffffffff -#define MCI_WBTIMER1_TARGET_GET(x) (((x) & 0xffffffff) >> 0) -#define MCI_WBTIMER1_TARGET_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MCI_WBTIMER2 */ -#define MCI_WBTIMER2_ADDRESS 0x00000074 -#define MCI_WBTIMER2_OFFSET 0x00000074 -#define MCI_WBTIMER2_TARGET_MSB 31 -#define MCI_WBTIMER2_TARGET_LSB 0 -#define MCI_WBTIMER2_TARGET_MASK 0xffffffff -#define MCI_WBTIMER2_TARGET_GET(x) (((x) & 0xffffffff) >> 0) -#define MCI_WBTIMER2_TARGET_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MCI_WBTIMER3 */ -#define MCI_WBTIMER3_ADDRESS 0x00000078 -#define MCI_WBTIMER3_OFFSET 0x00000078 -#define MCI_WBTIMER3_TARGET_MSB 31 -#define MCI_WBTIMER3_TARGET_LSB 0 -#define MCI_WBTIMER3_TARGET_MASK 0xffffffff -#define MCI_WBTIMER3_TARGET_GET(x) (((x) & 0xffffffff) >> 0) -#define MCI_WBTIMER3_TARGET_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MCI_WBTIMER4 */ -#define MCI_WBTIMER4_ADDRESS 0x0000007c -#define MCI_WBTIMER4_OFFSET 0x0000007c -#define MCI_WBTIMER4_TARGET_MSB 31 -#define MCI_WBTIMER4_TARGET_LSB 0 -#define MCI_WBTIMER4_TARGET_MASK 0xffffffff -#define MCI_WBTIMER4_TARGET_GET(x) (((x) & 0xffffffff) >> 0) -#define MCI_WBTIMER4_TARGET_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MCI_MAXGAIN */ -#define MCI_MAXGAIN_ADDRESS 0x00000080 -#define MCI_MAXGAIN_OFFSET 0x00000080 -#define MCI_MAXGAIN_GAIN1_MSB 7 -#define MCI_MAXGAIN_GAIN1_LSB 0 -#define MCI_MAXGAIN_GAIN1_MASK 0x000000ff -#define MCI_MAXGAIN_GAIN1_GET(x) (((x) & 0x000000ff) >> 0) -#define MCI_MAXGAIN_GAIN1_SET(x) (((x) << 0) & 0x000000ff) -#define MCI_MAXGAIN_GAIN2_MSB 15 -#define MCI_MAXGAIN_GAIN2_LSB 8 -#define MCI_MAXGAIN_GAIN2_MASK 0x0000ff00 -#define MCI_MAXGAIN_GAIN2_GET(x) (((x) & 0x0000ff00) >> 8) -#define MCI_MAXGAIN_GAIN2_SET(x) (((x) << 8) & 0x0000ff00) -#define MCI_MAXGAIN_GAIN3_MSB 23 -#define MCI_MAXGAIN_GAIN3_LSB 16 -#define MCI_MAXGAIN_GAIN3_MASK 0x00ff0000 -#define MCI_MAXGAIN_GAIN3_GET(x) (((x) & 0x00ff0000) >> 16) -#define MCI_MAXGAIN_GAIN3_SET(x) (((x) << 16) & 0x00ff0000) -#define MCI_MAXGAIN_GAIN4_MSB 31 -#define MCI_MAXGAIN_GAIN4_LSB 24 -#define MCI_MAXGAIN_GAIN4_MASK 0xff000000 -#define MCI_MAXGAIN_GAIN4_GET(x) (((x) & 0xff000000) >> 24) -#define MCI_MAXGAIN_GAIN4_SET(x) (((x) << 24) & 0xff000000) - -/* macros for BTCOEX_CTRL */ -#define BTCOEX_CTRL_ADDRESS 0x000000ac -#define BTCOEX_CTRL_OFFSET 0x000000ac -#define BTCOEX_CTRL_MCI_MODE_ENABLE_MSB 2 -#define BTCOEX_CTRL_MCI_MODE_ENABLE_LSB 2 -#define BTCOEX_CTRL_MCI_MODE_ENABLE_MASK 0x00000004 -#define BTCOEX_CTRL_MCI_MODE_ENABLE_GET(x) (((x) & 0x00000004) >> 2) -#define BTCOEX_CTRL_MCI_MODE_ENABLE_SET(x) (((x) << 2) & 0x00000004) - -/* macros for BTCOEX_CTRL2 */ -#define BTCOEX_CTRL2_ADDRESS 0x0000014c -#define BTCOEX_CTRL2_OFFSET 0x0000014c -#define BTCOEX_CTRL2_RESERVED2_MSB 7 -#define BTCOEX_CTRL2_RESERVED2_LSB 0 -#define BTCOEX_CTRL2_RESERVED2_MASK 0x000000ff -#define BTCOEX_CTRL2_RESERVED2_GET(x) (((x) & 0x000000ff) >> 0) -#define BTCOEX_CTRL2_RESERVED2_SET(x) (((x) << 0) & 0x000000ff) -#define BTCOEX_CTRL2_OBS_SEL_MSB 10 -#define BTCOEX_CTRL2_OBS_SEL_LSB 8 -#define BTCOEX_CTRL2_OBS_SEL_MASK 0x00000700 -#define BTCOEX_CTRL2_OBS_SEL_GET(x) (((x) & 0x00000700) >> 8) -#define BTCOEX_CTRL2_OBS_SEL_SET(x) (((x) << 8) & 0x00000700) - -/* macros for BTCOEX_DBG */ -#define BTCOEX_DBG_ADDRESS 0x00000254 -#define BTCOEX_DBG_OFFSET 0x00000254 -#define BTCOEX_DBG_OBS_MSB 31 -#define BTCOEX_DBG_OBS_LSB 0 -#define BTCOEX_DBG_OBS_MASK 0xffffffff -#define BTCOEX_DBG_OBS_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MCI_LAST_HW_MSG_HDR */ -#define MCI_LAST_HW_MSG_HDR_ADDRESS 0x00000258 -#define MCI_LAST_HW_MSG_HDR_OFFSET 0x00000258 -#define MCI_LAST_HW_MSG_HDR_HDR_MSB 7 -#define MCI_LAST_HW_MSG_HDR_HDR_LSB 0 -#define MCI_LAST_HW_MSG_HDR_HDR_MASK 0x000000ff -#define MCI_LAST_HW_MSG_HDR_HDR_GET(x) (((x) & 0x000000ff) >> 0) -#define MCI_LAST_HW_MSG_HDR_LEN_MSB 10 -#define MCI_LAST_HW_MSG_HDR_LEN_LSB 8 -#define MCI_LAST_HW_MSG_HDR_LEN_MASK 0x00000700 -#define MCI_LAST_HW_MSG_HDR_LEN_GET(x) (((x) & 0x00000700) >> 8) - -/* macros for MCI_LAST_HW_MSG_BDY */ -#define MCI_LAST_HW_MSG_BDY_ADDRESS 0x0000025c -#define MCI_LAST_HW_MSG_BDY_OFFSET 0x0000025c -#define MCI_LAST_HW_MSG_BDY_BDY_MSB 31 -#define MCI_LAST_HW_MSG_BDY_BDY_LSB 0 -#define MCI_LAST_HW_MSG_BDY_BDY_MASK 0xffffffff -#define MCI_LAST_HW_MSG_BDY_BDY_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MCI_MAXGAIN_RST */ -#define MCI_MAXGAIN_RST_ADDRESS 0x00000260 -#define MCI_MAXGAIN_RST_OFFSET 0x00000260 -#define MCI_MAXGAIN_RST_TARGET_MSB 31 -#define MCI_MAXGAIN_RST_TARGET_LSB 0 -#define MCI_MAXGAIN_RST_TARGET_MASK 0xffffffff -#define MCI_MAXGAIN_RST_TARGET_GET(x) (((x) & 0xffffffff) >> 0) -#define MCI_MAXGAIN_RST_TARGET_SET(x) (((x) << 0) & 0xffffffff) - - -#ifndef __ASSEMBLER__ - -typedef struct wlan_coex_reg_reg_s { - volatile unsigned int MCI_COMMAND0; /* 0x0 - 0x4 */ - volatile unsigned int MCI_COMMAND1; /* 0x4 - 0x8 */ - volatile unsigned int MCI_COMMAND2; /* 0x8 - 0xc */ - volatile unsigned int MCI_RX_CTRL; /* 0xc - 0x10 */ - volatile unsigned int MCI_TX_CTRL; /* 0x10 - 0x14 */ - volatile unsigned int MCI_MSG_ATTRIBUTES_TABLE; /* 0x14 - 0x18 */ - volatile unsigned int MCI_SCHD_TABLE_0; /* 0x18 - 0x1c */ - volatile unsigned int MCI_SCHD_TABLE_1; /* 0x1c - 0x20 */ - volatile unsigned int MCI_GPM_0; /* 0x20 - 0x24 */ - volatile unsigned int MCI_GPM_1; /* 0x24 - 0x28 */ - volatile unsigned int MCI_INTERRUPT_RAW; /* 0x28 - 0x2c */ - volatile unsigned int MCI_INTERRUPT_EN; /* 0x2c - 0x30 */ - volatile unsigned int MCI_REMOTE_CPU_INT; /* 0x30 - 0x34 */ - volatile unsigned int MCI_REMOTE_CPU_INT_EN; /* 0x34 - 0x38 */ - volatile unsigned int MCI_INTERRUPT_RX_MSG_RAW; /* 0x38 - 0x3c */ - volatile unsigned int MCI_INTERRUPT_RX_MSG_EN; /* 0x3c - 0x40 */ - volatile unsigned int MCI_CPU_INT; /* 0x40 - 0x44 */ - volatile unsigned int MCI_RX_STATUS; /* 0x44 - 0x48 */ - volatile unsigned int MCI_CONT_STATUS; /* 0x48 - 0x4c */ - volatile unsigned int MCI_BT_PRI0; /* 0x4c - 0x50 */ - volatile unsigned int MCI_BT_PRI1; /* 0x50 - 0x54 */ - volatile unsigned int MCI_BT_PRI2; /* 0x54 - 0x58 */ - volatile unsigned int MCI_BT_PRI3; /* 0x58 - 0x5c */ - volatile unsigned int MCI_BT_PRI; /* 0x5c - 0x60 */ - volatile unsigned int MCI_WL_FREQ0; /* 0x60 - 0x64 */ - volatile unsigned int MCI_WL_FREQ1; /* 0x64 - 0x68 */ - volatile unsigned int MCI_WL_FREQ2; /* 0x68 - 0x6c */ - volatile unsigned int MCI_GAIN; /* 0x6c - 0x70 */ - volatile unsigned int MCI_WBTIMER1; /* 0x70 - 0x74 */ - volatile unsigned int MCI_WBTIMER2; /* 0x74 - 0x78 */ - volatile unsigned int MCI_WBTIMER3; /* 0x78 - 0x7c */ - volatile unsigned int MCI_WBTIMER4; /* 0x7c - 0x80 */ - volatile unsigned int MCI_MAXGAIN; /* 0x80 - 0x84 */ - volatile char pad__0[0x28]; /* 0x84 - 0xac */ - volatile unsigned int BTCOEX_CTRL; /* 0xac - 0xb0 */ - volatile char pad__1[0x9c]; /* 0xb0 - 0x14c */ - volatile unsigned int BTCOEX_CTRL2; /* 0x14c - 0x150 */ - volatile char pad__2[0x104]; /* 0x150 - 0x254 */ - volatile unsigned int BTCOEX_DBG; /* 0x254 - 0x258 */ - volatile unsigned int MCI_LAST_HW_MSG_HDR; /* 0x258 - 0x25c */ - volatile unsigned int MCI_LAST_HW_MSG_BDY; /* 0x25c - 0x260 */ - volatile unsigned int MCI_MAXGAIN_RST; /* 0x260 - 0x264 */ -} wlan_coex_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _WLAN_COEX_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_dcu_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_dcu_reg.h deleted file mode 100644 index 944eb7165413..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_dcu_reg.h +++ /dev/null @@ -1,772 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _WMAC_DCU_REG_REG_H_ -#define _WMAC_DCU_REG_REG_H_ - - -/* macros for MAC_DCU_QCUMASK */ -#define MAC_DCU_QCUMASK_ADDRESS 0x00001000 -#define MAC_DCU_QCUMASK_OFFSET 0x00001000 -#define MAC_DCU_QCUMASK_DATA_MSB 9 -#define MAC_DCU_QCUMASK_DATA_LSB 0 -#define MAC_DCU_QCUMASK_DATA_MASK 0x000003ff -#define MAC_DCU_QCUMASK_DATA_GET(x) (((x) & 0x000003ff) >> 0) -#define MAC_DCU_QCUMASK_DATA_SET(x) (((x) << 0) & 0x000003ff) - -/* macros for MAC_DCU_GBL_IFS_SIFS */ -#define MAC_DCU_GBL_IFS_SIFS_ADDRESS 0x00001030 -#define MAC_DCU_GBL_IFS_SIFS_OFFSET 0x00001030 -#define MAC_DCU_GBL_IFS_SIFS_DURATION_MSB 15 -#define MAC_DCU_GBL_IFS_SIFS_DURATION_LSB 0 -#define MAC_DCU_GBL_IFS_SIFS_DURATION_MASK 0x0000ffff -#define MAC_DCU_GBL_IFS_SIFS_DURATION_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DCU_GBL_IFS_SIFS_DURATION_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_DCU_TXFILTER_DCU0_31_0 */ -#define MAC_DCU_TXFILTER_DCU0_31_0_ADDRESS 0x00001038 -#define MAC_DCU_TXFILTER_DCU0_31_0_OFFSET 0x00001038 -#define MAC_DCU_TXFILTER_DCU0_31_0_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU0_31_0_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU0_31_0_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU0_31_0_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DCU_TXFILTER_DCU0_31_0_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DCU_TXFILTER_DCU8_31_0 */ -#define MAC_DCU_TXFILTER_DCU8_31_0_ADDRESS 0x0000103c -#define MAC_DCU_TXFILTER_DCU8_31_0_OFFSET 0x0000103c -#define MAC_DCU_TXFILTER_DCU8_31_0_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU8_31_0_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU8_31_0_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU8_31_0_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_LCL_IFS */ -#define MAC_DCU_LCL_IFS_ADDRESS 0x00001040 -#define MAC_DCU_LCL_IFS_OFFSET 0x00001040 -#define MAC_DCU_LCL_IFS_CW_MIN_MSB 9 -#define MAC_DCU_LCL_IFS_CW_MIN_LSB 0 -#define MAC_DCU_LCL_IFS_CW_MIN_MASK 0x000003ff -#define MAC_DCU_LCL_IFS_CW_MIN_GET(x) (((x) & 0x000003ff) >> 0) -#define MAC_DCU_LCL_IFS_CW_MIN_SET(x) (((x) << 0) & 0x000003ff) -#define MAC_DCU_LCL_IFS_CW_MAX_MSB 19 -#define MAC_DCU_LCL_IFS_CW_MAX_LSB 10 -#define MAC_DCU_LCL_IFS_CW_MAX_MASK 0x000ffc00 -#define MAC_DCU_LCL_IFS_CW_MAX_GET(x) (((x) & 0x000ffc00) >> 10) -#define MAC_DCU_LCL_IFS_CW_MAX_SET(x) (((x) << 10) & 0x000ffc00) -#define MAC_DCU_LCL_IFS_AIFS_MSB 27 -#define MAC_DCU_LCL_IFS_AIFS_LSB 20 -#define MAC_DCU_LCL_IFS_AIFS_MASK 0x0ff00000 -#define MAC_DCU_LCL_IFS_AIFS_GET(x) (((x) & 0x0ff00000) >> 20) -#define MAC_DCU_LCL_IFS_AIFS_SET(x) (((x) << 20) & 0x0ff00000) -#define MAC_DCU_LCL_IFS_LONG_AIFS_MSB 28 -#define MAC_DCU_LCL_IFS_LONG_AIFS_LSB 28 -#define MAC_DCU_LCL_IFS_LONG_AIFS_MASK 0x10000000 -#define MAC_DCU_LCL_IFS_LONG_AIFS_GET(x) (((x) & 0x10000000) >> 28) -#define MAC_DCU_LCL_IFS_LONG_AIFS_SET(x) (((x) << 28) & 0x10000000) - -/* macros for MAC_DCU_GBL_IFS_SLOT */ -#define MAC_DCU_GBL_IFS_SLOT_ADDRESS 0x00001070 -#define MAC_DCU_GBL_IFS_SLOT_OFFSET 0x00001070 -#define MAC_DCU_GBL_IFS_SLOT_DURATION_MSB 15 -#define MAC_DCU_GBL_IFS_SLOT_DURATION_LSB 0 -#define MAC_DCU_GBL_IFS_SLOT_DURATION_MASK 0x0000ffff -#define MAC_DCU_GBL_IFS_SLOT_DURATION_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DCU_GBL_IFS_SLOT_DURATION_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_DCU_TXFILTER_DCU0_63_32 */ -#define MAC_DCU_TXFILTER_DCU0_63_32_ADDRESS 0x00001078 -#define MAC_DCU_TXFILTER_DCU0_63_32_OFFSET 0x00001078 -#define MAC_DCU_TXFILTER_DCU0_63_32_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU0_63_32_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU0_63_32_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU0_63_32_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DCU_TXFILTER_DCU0_63_32_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DCU_TXFILTER_DCU8_63_32 */ -#define MAC_DCU_TXFILTER_DCU8_63_32_ADDRESS 0x0000107c -#define MAC_DCU_TXFILTER_DCU8_63_32_OFFSET 0x0000107c -#define MAC_DCU_TXFILTER_DCU8_63_32_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU8_63_32_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU8_63_32_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU8_63_32_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_RETRY_LIMIT */ -#define MAC_DCU_RETRY_LIMIT_ADDRESS 0x00001080 -#define MAC_DCU_RETRY_LIMIT_OFFSET 0x00001080 -#define MAC_DCU_RETRY_LIMIT_FRFL_MSB 3 -#define MAC_DCU_RETRY_LIMIT_FRFL_LSB 0 -#define MAC_DCU_RETRY_LIMIT_FRFL_MASK 0x0000000f -#define MAC_DCU_RETRY_LIMIT_FRFL_GET(x) (((x) & 0x0000000f) >> 0) -#define MAC_DCU_RETRY_LIMIT_FRFL_SET(x) (((x) << 0) & 0x0000000f) -#define MAC_DCU_RETRY_LIMIT_SRFL_MSB 13 -#define MAC_DCU_RETRY_LIMIT_SRFL_LSB 8 -#define MAC_DCU_RETRY_LIMIT_SRFL_MASK 0x00003f00 -#define MAC_DCU_RETRY_LIMIT_SRFL_GET(x) (((x) & 0x00003f00) >> 8) -#define MAC_DCU_RETRY_LIMIT_SRFL_SET(x) (((x) << 8) & 0x00003f00) -#define MAC_DCU_RETRY_LIMIT_SDFL_MSB 19 -#define MAC_DCU_RETRY_LIMIT_SDFL_LSB 14 -#define MAC_DCU_RETRY_LIMIT_SDFL_MASK 0x000fc000 -#define MAC_DCU_RETRY_LIMIT_SDFL_GET(x) (((x) & 0x000fc000) >> 14) -#define MAC_DCU_RETRY_LIMIT_SDFL_SET(x) (((x) << 14) & 0x000fc000) - -/* macros for MAC_DCU_GBL_IFS_EIFS */ -#define MAC_DCU_GBL_IFS_EIFS_ADDRESS 0x000010b0 -#define MAC_DCU_GBL_IFS_EIFS_OFFSET 0x000010b0 -#define MAC_DCU_GBL_IFS_EIFS_DURATION_MSB 15 -#define MAC_DCU_GBL_IFS_EIFS_DURATION_LSB 0 -#define MAC_DCU_GBL_IFS_EIFS_DURATION_MASK 0x0000ffff -#define MAC_DCU_GBL_IFS_EIFS_DURATION_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DCU_GBL_IFS_EIFS_DURATION_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_DCU_TXFILTER_DCU0_95_64 */ -#define MAC_DCU_TXFILTER_DCU0_95_64_ADDRESS 0x000010b8 -#define MAC_DCU_TXFILTER_DCU0_95_64_OFFSET 0x000010b8 -#define MAC_DCU_TXFILTER_DCU0_95_64_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU0_95_64_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU0_95_64_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU0_95_64_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DCU_TXFILTER_DCU0_95_64_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DCU_TXFILTER_DCU8_95_64 */ -#define MAC_DCU_TXFILTER_DCU8_95_64_ADDRESS 0x000010bc -#define MAC_DCU_TXFILTER_DCU8_95_64_OFFSET 0x000010bc -#define MAC_DCU_TXFILTER_DCU8_95_64_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU8_95_64_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU8_95_64_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU8_95_64_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_CHANNEL_TIME */ -#define MAC_DCU_CHANNEL_TIME_ADDRESS 0x000010c0 -#define MAC_DCU_CHANNEL_TIME_OFFSET 0x000010c0 -#define MAC_DCU_CHANNEL_TIME_DURATION_MSB 19 -#define MAC_DCU_CHANNEL_TIME_DURATION_LSB 0 -#define MAC_DCU_CHANNEL_TIME_DURATION_MASK 0x000fffff -#define MAC_DCU_CHANNEL_TIME_DURATION_GET(x) (((x) & 0x000fffff) >> 0) -#define MAC_DCU_CHANNEL_TIME_DURATION_SET(x) (((x) << 0) & 0x000fffff) -#define MAC_DCU_CHANNEL_TIME_ENABLE_MSB 20 -#define MAC_DCU_CHANNEL_TIME_ENABLE_LSB 20 -#define MAC_DCU_CHANNEL_TIME_ENABLE_MASK 0x00100000 -#define MAC_DCU_CHANNEL_TIME_ENABLE_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_DCU_CHANNEL_TIME_ENABLE_SET(x) (((x) << 20) & 0x00100000) - -/* macros for MAC_DCU_GBL_IFS_MISC */ -#define MAC_DCU_GBL_IFS_MISC_ADDRESS 0x000010f0 -#define MAC_DCU_GBL_IFS_MISC_OFFSET 0x000010f0 -#define MAC_DCU_GBL_IFS_MISC_LFSR_SLICE_SEL_MSB 2 -#define MAC_DCU_GBL_IFS_MISC_LFSR_SLICE_SEL_LSB 0 -#define MAC_DCU_GBL_IFS_MISC_LFSR_SLICE_SEL_MASK 0x00000007 -#define MAC_DCU_GBL_IFS_MISC_LFSR_SLICE_SEL_GET(x) (((x) & 0x00000007) >> 0) -#define MAC_DCU_GBL_IFS_MISC_LFSR_SLICE_SEL_SET(x) (((x) << 0) & 0x00000007) -#define MAC_DCU_GBL_IFS_MISC_TURBO_MODE_MSB 3 -#define MAC_DCU_GBL_IFS_MISC_TURBO_MODE_LSB 3 -#define MAC_DCU_GBL_IFS_MISC_TURBO_MODE_MASK 0x00000008 -#define MAC_DCU_GBL_IFS_MISC_TURBO_MODE_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_DCU_GBL_IFS_MISC_TURBO_MODE_SET(x) (((x) << 3) & 0x00000008) -#define MAC_DCU_GBL_IFS_MISC_SIFS_DUR_USEC_MSB 9 -#define MAC_DCU_GBL_IFS_MISC_SIFS_DUR_USEC_LSB 4 -#define MAC_DCU_GBL_IFS_MISC_SIFS_DUR_USEC_MASK 0x000003f0 -#define MAC_DCU_GBL_IFS_MISC_SIFS_DUR_USEC_GET(x) (((x) & 0x000003f0) >> 4) -#define MAC_DCU_GBL_IFS_MISC_SIFS_DUR_USEC_SET(x) (((x) << 4) & 0x000003f0) -#define MAC_DCU_GBL_IFS_MISC_ARB_DLY_MSB 21 -#define MAC_DCU_GBL_IFS_MISC_ARB_DLY_LSB 20 -#define MAC_DCU_GBL_IFS_MISC_ARB_DLY_MASK 0x00300000 -#define MAC_DCU_GBL_IFS_MISC_ARB_DLY_GET(x) (((x) & 0x00300000) >> 20) -#define MAC_DCU_GBL_IFS_MISC_ARB_DLY_SET(x) (((x) << 20) & 0x00300000) -#define MAC_DCU_GBL_IFS_MISC_SIFS_RST_UNCOND_MSB 22 -#define MAC_DCU_GBL_IFS_MISC_SIFS_RST_UNCOND_LSB 22 -#define MAC_DCU_GBL_IFS_MISC_SIFS_RST_UNCOND_MASK 0x00400000 -#define MAC_DCU_GBL_IFS_MISC_SIFS_RST_UNCOND_GET(x) (((x) & 0x00400000) >> 22) -#define MAC_DCU_GBL_IFS_MISC_SIFS_RST_UNCOND_SET(x) (((x) << 22) & 0x00400000) -#define MAC_DCU_GBL_IFS_MISC_AIFS_RST_UNCOND_MSB 23 -#define MAC_DCU_GBL_IFS_MISC_AIFS_RST_UNCOND_LSB 23 -#define MAC_DCU_GBL_IFS_MISC_AIFS_RST_UNCOND_MASK 0x00800000 -#define MAC_DCU_GBL_IFS_MISC_AIFS_RST_UNCOND_GET(x) (((x) & 0x00800000) >> 23) -#define MAC_DCU_GBL_IFS_MISC_AIFS_RST_UNCOND_SET(x) (((x) << 23) & 0x00800000) -#define MAC_DCU_GBL_IFS_MISC_LFSR_SLICE_RANDOM_DIS_MSB 24 -#define MAC_DCU_GBL_IFS_MISC_LFSR_SLICE_RANDOM_DIS_LSB 24 -#define MAC_DCU_GBL_IFS_MISC_LFSR_SLICE_RANDOM_DIS_MASK 0x01000000 -#define MAC_DCU_GBL_IFS_MISC_LFSR_SLICE_RANDOM_DIS_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_DCU_GBL_IFS_MISC_LFSR_SLICE_RANDOM_DIS_SET(x) (((x) << 24) & 0x01000000) -#define MAC_DCU_GBL_IFS_MISC_CHAN_SLOT_WIN_DUR_MSB 26 -#define MAC_DCU_GBL_IFS_MISC_CHAN_SLOT_WIN_DUR_LSB 25 -#define MAC_DCU_GBL_IFS_MISC_CHAN_SLOT_WIN_DUR_MASK 0x06000000 -#define MAC_DCU_GBL_IFS_MISC_CHAN_SLOT_WIN_DUR_GET(x) (((x) & 0x06000000) >> 25) -#define MAC_DCU_GBL_IFS_MISC_CHAN_SLOT_WIN_DUR_SET(x) (((x) << 25) & 0x06000000) -#define MAC_DCU_GBL_IFS_MISC_CHAN_SLOT_ALWAYS_MSB 27 -#define MAC_DCU_GBL_IFS_MISC_CHAN_SLOT_ALWAYS_LSB 27 -#define MAC_DCU_GBL_IFS_MISC_CHAN_SLOT_ALWAYS_MASK 0x08000000 -#define MAC_DCU_GBL_IFS_MISC_CHAN_SLOT_ALWAYS_GET(x) (((x) & 0x08000000) >> 27) -#define MAC_DCU_GBL_IFS_MISC_CHAN_SLOT_ALWAYS_SET(x) (((x) << 27) & 0x08000000) -#define MAC_DCU_GBL_IFS_MISC_IGNORE_BACKOFF_MSB 28 -#define MAC_DCU_GBL_IFS_MISC_IGNORE_BACKOFF_LSB 28 -#define MAC_DCU_GBL_IFS_MISC_IGNORE_BACKOFF_MASK 0x10000000 -#define MAC_DCU_GBL_IFS_MISC_IGNORE_BACKOFF_GET(x) (((x) & 0x10000000) >> 28) -#define MAC_DCU_GBL_IFS_MISC_IGNORE_BACKOFF_SET(x) (((x) << 28) & 0x10000000) -#define MAC_DCU_GBL_IFS_MISC_SLOT_COUNT_RST_UNCOND_MSB 29 -#define MAC_DCU_GBL_IFS_MISC_SLOT_COUNT_RST_UNCOND_LSB 29 -#define MAC_DCU_GBL_IFS_MISC_SLOT_COUNT_RST_UNCOND_MASK 0x20000000 -#define MAC_DCU_GBL_IFS_MISC_SLOT_COUNT_RST_UNCOND_GET(x) (((x) & 0x20000000) >> 29) -#define MAC_DCU_GBL_IFS_MISC_SLOT_COUNT_RST_UNCOND_SET(x) (((x) << 29) & 0x20000000) - -/* macros for MAC_DCU_TXFILTER_DCU0_127_96 */ -#define MAC_DCU_TXFILTER_DCU0_127_96_ADDRESS 0x000010f8 -#define MAC_DCU_TXFILTER_DCU0_127_96_OFFSET 0x000010f8 -#define MAC_DCU_TXFILTER_DCU0_127_96_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU0_127_96_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU0_127_96_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU0_127_96_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DCU_TXFILTER_DCU0_127_96_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DCU_TXFILTER_DCU8_127_96 */ -#define MAC_DCU_TXFILTER_DCU8_127_96_ADDRESS 0x000010fc -#define MAC_DCU_TXFILTER_DCU8_127_96_OFFSET 0x000010fc -#define MAC_DCU_TXFILTER_DCU8_127_96_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU8_127_96_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU8_127_96_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU8_127_96_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_MISC */ -#define MAC_DCU_MISC_ADDRESS 0x00001100 -#define MAC_DCU_MISC_OFFSET 0x00001100 -#define MAC_DCU_MISC_BKOFF_THRESH_MSB 5 -#define MAC_DCU_MISC_BKOFF_THRESH_LSB 0 -#define MAC_DCU_MISC_BKOFF_THRESH_MASK 0x0000003f -#define MAC_DCU_MISC_BKOFF_THRESH_GET(x) (((x) & 0x0000003f) >> 0) -#define MAC_DCU_MISC_BKOFF_THRESH_SET(x) (((x) << 0) & 0x0000003f) -#define MAC_DCU_MISC_SFC_RST_AT_TS_END_EN_MSB 6 -#define MAC_DCU_MISC_SFC_RST_AT_TS_END_EN_LSB 6 -#define MAC_DCU_MISC_SFC_RST_AT_TS_END_EN_MASK 0x00000040 -#define MAC_DCU_MISC_SFC_RST_AT_TS_END_EN_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_DCU_MISC_SFC_RST_AT_TS_END_EN_SET(x) (((x) << 6) & 0x00000040) -#define MAC_DCU_MISC_CW_RST_AT_TS_END_DIS_MSB 7 -#define MAC_DCU_MISC_CW_RST_AT_TS_END_DIS_LSB 7 -#define MAC_DCU_MISC_CW_RST_AT_TS_END_DIS_MASK 0x00000080 -#define MAC_DCU_MISC_CW_RST_AT_TS_END_DIS_GET(x) (((x) & 0x00000080) >> 7) -#define MAC_DCU_MISC_CW_RST_AT_TS_END_DIS_SET(x) (((x) << 7) & 0x00000080) -#define MAC_DCU_MISC_FRAG_BURST_WAIT_QCU_EN_MSB 8 -#define MAC_DCU_MISC_FRAG_BURST_WAIT_QCU_EN_LSB 8 -#define MAC_DCU_MISC_FRAG_BURST_WAIT_QCU_EN_MASK 0x00000100 -#define MAC_DCU_MISC_FRAG_BURST_WAIT_QCU_EN_GET(x) (((x) & 0x00000100) >> 8) -#define MAC_DCU_MISC_FRAG_BURST_WAIT_QCU_EN_SET(x) (((x) << 8) & 0x00000100) -#define MAC_DCU_MISC_FRAG_BURST_BKOFF_EN_MSB 9 -#define MAC_DCU_MISC_FRAG_BURST_BKOFF_EN_LSB 9 -#define MAC_DCU_MISC_FRAG_BURST_BKOFF_EN_MASK 0x00000200 -#define MAC_DCU_MISC_FRAG_BURST_BKOFF_EN_GET(x) (((x) & 0x00000200) >> 9) -#define MAC_DCU_MISC_FRAG_BURST_BKOFF_EN_SET(x) (((x) << 9) & 0x00000200) -#define MAC_DCU_MISC_HCF_POLL_EN_MSB 11 -#define MAC_DCU_MISC_HCF_POLL_EN_LSB 11 -#define MAC_DCU_MISC_HCF_POLL_EN_MASK 0x00000800 -#define MAC_DCU_MISC_HCF_POLL_EN_GET(x) (((x) & 0x00000800) >> 11) -#define MAC_DCU_MISC_HCF_POLL_EN_SET(x) (((x) << 11) & 0x00000800) -#define MAC_DCU_MISC_BKOFF_PF_MSB 12 -#define MAC_DCU_MISC_BKOFF_PF_LSB 12 -#define MAC_DCU_MISC_BKOFF_PF_MASK 0x00001000 -#define MAC_DCU_MISC_BKOFF_PF_GET(x) (((x) & 0x00001000) >> 12) -#define MAC_DCU_MISC_BKOFF_PF_SET(x) (((x) << 12) & 0x00001000) -#define MAC_DCU_MISC_VIRT_COLL_POLICY_MSB 15 -#define MAC_DCU_MISC_VIRT_COLL_POLICY_LSB 14 -#define MAC_DCU_MISC_VIRT_COLL_POLICY_MASK 0x0000c000 -#define MAC_DCU_MISC_VIRT_COLL_POLICY_GET(x) (((x) & 0x0000c000) >> 14) -#define MAC_DCU_MISC_VIRT_COLL_POLICY_SET(x) (((x) << 14) & 0x0000c000) -#define MAC_DCU_MISC_IS_BCN_MSB 16 -#define MAC_DCU_MISC_IS_BCN_LSB 16 -#define MAC_DCU_MISC_IS_BCN_MASK 0x00010000 -#define MAC_DCU_MISC_IS_BCN_GET(x) (((x) & 0x00010000) >> 16) -#define MAC_DCU_MISC_IS_BCN_SET(x) (((x) << 16) & 0x00010000) -#define MAC_DCU_MISC_ARB_LOCKOUT_IF_EN_MSB 17 -#define MAC_DCU_MISC_ARB_LOCKOUT_IF_EN_LSB 17 -#define MAC_DCU_MISC_ARB_LOCKOUT_IF_EN_MASK 0x00020000 -#define MAC_DCU_MISC_ARB_LOCKOUT_IF_EN_GET(x) (((x) & 0x00020000) >> 17) -#define MAC_DCU_MISC_ARB_LOCKOUT_IF_EN_SET(x) (((x) << 17) & 0x00020000) -#define MAC_DCU_MISC_LOCKOUT_GBL_EN_MSB 18 -#define MAC_DCU_MISC_LOCKOUT_GBL_EN_LSB 18 -#define MAC_DCU_MISC_LOCKOUT_GBL_EN_MASK 0x00040000 -#define MAC_DCU_MISC_LOCKOUT_GBL_EN_GET(x) (((x) & 0x00040000) >> 18) -#define MAC_DCU_MISC_LOCKOUT_GBL_EN_SET(x) (((x) << 18) & 0x00040000) -#define MAC_DCU_MISC_LOCKOUT_IGNORE_MSB 19 -#define MAC_DCU_MISC_LOCKOUT_IGNORE_LSB 19 -#define MAC_DCU_MISC_LOCKOUT_IGNORE_MASK 0x00080000 -#define MAC_DCU_MISC_LOCKOUT_IGNORE_GET(x) (((x) & 0x00080000) >> 19) -#define MAC_DCU_MISC_LOCKOUT_IGNORE_SET(x) (((x) << 19) & 0x00080000) -#define MAC_DCU_MISC_SEQNUM_FREEZE_MSB 20 -#define MAC_DCU_MISC_SEQNUM_FREEZE_LSB 20 -#define MAC_DCU_MISC_SEQNUM_FREEZE_MASK 0x00100000 -#define MAC_DCU_MISC_SEQNUM_FREEZE_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_DCU_MISC_SEQNUM_FREEZE_SET(x) (((x) << 20) & 0x00100000) -#define MAC_DCU_MISC_POST_BKOFF_SKIP_MSB 21 -#define MAC_DCU_MISC_POST_BKOFF_SKIP_LSB 21 -#define MAC_DCU_MISC_POST_BKOFF_SKIP_MASK 0x00200000 -#define MAC_DCU_MISC_POST_BKOFF_SKIP_GET(x) (((x) & 0x00200000) >> 21) -#define MAC_DCU_MISC_POST_BKOFF_SKIP_SET(x) (((x) << 21) & 0x00200000) -#define MAC_DCU_MISC_VIRT_COLL_CW_INC_EN_MSB 22 -#define MAC_DCU_MISC_VIRT_COLL_CW_INC_EN_LSB 22 -#define MAC_DCU_MISC_VIRT_COLL_CW_INC_EN_MASK 0x00400000 -#define MAC_DCU_MISC_VIRT_COLL_CW_INC_EN_GET(x) (((x) & 0x00400000) >> 22) -#define MAC_DCU_MISC_VIRT_COLL_CW_INC_EN_SET(x) (((x) << 22) & 0x00400000) -#define MAC_DCU_MISC_RETRY_ON_BLOWN_IFS_EN_MSB 23 -#define MAC_DCU_MISC_RETRY_ON_BLOWN_IFS_EN_LSB 23 -#define MAC_DCU_MISC_RETRY_ON_BLOWN_IFS_EN_MASK 0x00800000 -#define MAC_DCU_MISC_RETRY_ON_BLOWN_IFS_EN_GET(x) (((x) & 0x00800000) >> 23) -#define MAC_DCU_MISC_RETRY_ON_BLOWN_IFS_EN_SET(x) (((x) << 23) & 0x00800000) -#define MAC_DCU_MISC_SIFS_BURST_CHAN_BUSY_IGNORE_MSB 24 -#define MAC_DCU_MISC_SIFS_BURST_CHAN_BUSY_IGNORE_LSB 24 -#define MAC_DCU_MISC_SIFS_BURST_CHAN_BUSY_IGNORE_MASK 0x01000000 -#define MAC_DCU_MISC_SIFS_BURST_CHAN_BUSY_IGNORE_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_DCU_MISC_SIFS_BURST_CHAN_BUSY_IGNORE_SET(x) (((x) << 24) & 0x01000000) - -/* macros for MAC_DCU_TXFILTER_DCU1_31_0 */ -#define MAC_DCU_TXFILTER_DCU1_31_0_ADDRESS 0x00001138 -#define MAC_DCU_TXFILTER_DCU1_31_0_OFFSET 0x00001138 -#define MAC_DCU_TXFILTER_DCU1_31_0_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU1_31_0_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU1_31_0_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU1_31_0_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU9_31_0 */ -#define MAC_DCU_TXFILTER_DCU9_31_0_ADDRESS 0x0000113c -#define MAC_DCU_TXFILTER_DCU9_31_0_OFFSET 0x0000113c -#define MAC_DCU_TXFILTER_DCU9_31_0_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU9_31_0_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU9_31_0_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU9_31_0_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_SEQ */ -#define MAC_DCU_SEQ_ADDRESS 0x00001140 -#define MAC_DCU_SEQ_OFFSET 0x00001140 -#define MAC_DCU_SEQ_NUM_MSB 31 -#define MAC_DCU_SEQ_NUM_LSB 0 -#define MAC_DCU_SEQ_NUM_MASK 0xffffffff -#define MAC_DCU_SEQ_NUM_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DCU_SEQ_NUM_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DCU_TXFILTER_DCU1_63_32 */ -#define MAC_DCU_TXFILTER_DCU1_63_32_ADDRESS 0x00001178 -#define MAC_DCU_TXFILTER_DCU1_63_32_OFFSET 0x00001178 -#define MAC_DCU_TXFILTER_DCU1_63_32_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU1_63_32_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU1_63_32_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU1_63_32_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU9_63_32 */ -#define MAC_DCU_TXFILTER_DCU9_63_32_ADDRESS 0x0000117c -#define MAC_DCU_TXFILTER_DCU9_63_32_OFFSET 0x0000117c -#define MAC_DCU_TXFILTER_DCU9_63_32_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU9_63_32_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU9_63_32_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU9_63_32_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU1_95_64 */ -#define MAC_DCU_TXFILTER_DCU1_95_64_ADDRESS 0x000011b8 -#define MAC_DCU_TXFILTER_DCU1_95_64_OFFSET 0x000011b8 -#define MAC_DCU_TXFILTER_DCU1_95_64_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU1_95_64_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU1_95_64_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU1_95_64_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU9_95_64 */ -#define MAC_DCU_TXFILTER_DCU9_95_64_ADDRESS 0x000011bc -#define MAC_DCU_TXFILTER_DCU9_95_64_OFFSET 0x000011bc -#define MAC_DCU_TXFILTER_DCU9_95_64_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU9_95_64_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU9_95_64_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU9_95_64_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU1_127_96 */ -#define MAC_DCU_TXFILTER_DCU1_127_96_ADDRESS 0x000011f8 -#define MAC_DCU_TXFILTER_DCU1_127_96_OFFSET 0x000011f8 -#define MAC_DCU_TXFILTER_DCU1_127_96_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU1_127_96_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU1_127_96_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU1_127_96_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU9_127_96 */ -#define MAC_DCU_TXFILTER_DCU9_127_96_ADDRESS 0x000011fc -#define MAC_DCU_TXFILTER_DCU9_127_96_OFFSET 0x000011fc -#define MAC_DCU_TXFILTER_DCU9_127_96_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU9_127_96_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU9_127_96_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU9_127_96_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU2_31_0 */ -#define MAC_DCU_TXFILTER_DCU2_31_0_ADDRESS 0x00001238 -#define MAC_DCU_TXFILTER_DCU2_31_0_OFFSET 0x00001238 -#define MAC_DCU_TXFILTER_DCU2_31_0_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU2_31_0_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU2_31_0_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU2_31_0_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_PAUSE */ -#define MAC_DCU_PAUSE_ADDRESS 0x00001270 -#define MAC_DCU_PAUSE_OFFSET 0x00001270 -#define MAC_DCU_PAUSE_REQUEST_MSB 9 -#define MAC_DCU_PAUSE_REQUEST_LSB 0 -#define MAC_DCU_PAUSE_REQUEST_MASK 0x000003ff -#define MAC_DCU_PAUSE_REQUEST_GET(x) (((x) & 0x000003ff) >> 0) -#define MAC_DCU_PAUSE_REQUEST_SET(x) (((x) << 0) & 0x000003ff) -#define MAC_DCU_PAUSE_STATUS_MSB 16 -#define MAC_DCU_PAUSE_STATUS_LSB 16 -#define MAC_DCU_PAUSE_STATUS_MASK 0x00010000 -#define MAC_DCU_PAUSE_STATUS_GET(x) (((x) & 0x00010000) >> 16) - -/* macros for MAC_DCU_TXFILTER_DCU2_63_32 */ -#define MAC_DCU_TXFILTER_DCU2_63_32_ADDRESS 0x00001278 -#define MAC_DCU_TXFILTER_DCU2_63_32_OFFSET 0x00001278 -#define MAC_DCU_TXFILTER_DCU2_63_32_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU2_63_32_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU2_63_32_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU2_63_32_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_WOW_KACFG */ -#define MAC_DCU_WOW_KACFG_ADDRESS 0x000012b0 -#define MAC_DCU_WOW_KACFG_OFFSET 0x000012b0 -#define MAC_DCU_WOW_KACFG_TX_EN_MSB 0 -#define MAC_DCU_WOW_KACFG_TX_EN_LSB 0 -#define MAC_DCU_WOW_KACFG_TX_EN_MASK 0x00000001 -#define MAC_DCU_WOW_KACFG_TX_EN_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_DCU_WOW_KACFG_TX_EN_SET(x) (((x) << 0) & 0x00000001) -#define MAC_DCU_WOW_KACFG_TIM_EN_MSB 1 -#define MAC_DCU_WOW_KACFG_TIM_EN_LSB 1 -#define MAC_DCU_WOW_KACFG_TIM_EN_MASK 0x00000002 -#define MAC_DCU_WOW_KACFG_TIM_EN_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_DCU_WOW_KACFG_TIM_EN_SET(x) (((x) << 1) & 0x00000002) -#define MAC_DCU_WOW_KACFG_BCN_CNT_MSB 11 -#define MAC_DCU_WOW_KACFG_BCN_CNT_LSB 4 -#define MAC_DCU_WOW_KACFG_BCN_CNT_MASK 0x00000ff0 -#define MAC_DCU_WOW_KACFG_BCN_CNT_GET(x) (((x) & 0x00000ff0) >> 4) -#define MAC_DCU_WOW_KACFG_BCN_CNT_SET(x) (((x) << 4) & 0x00000ff0) -#define MAC_DCU_WOW_KACFG_RX_TIMEOUT_CNT_MSB 23 -#define MAC_DCU_WOW_KACFG_RX_TIMEOUT_CNT_LSB 12 -#define MAC_DCU_WOW_KACFG_RX_TIMEOUT_CNT_MASK 0x00fff000 -#define MAC_DCU_WOW_KACFG_RX_TIMEOUT_CNT_GET(x) (((x) & 0x00fff000) >> 12) -#define MAC_DCU_WOW_KACFG_RX_TIMEOUT_CNT_SET(x) (((x) << 12) & 0x00fff000) - -/* macros for MAC_DCU_TXFILTER_DCU2_95_64 */ -#define MAC_DCU_TXFILTER_DCU2_95_64_ADDRESS 0x000012b8 -#define MAC_DCU_TXFILTER_DCU2_95_64_OFFSET 0x000012b8 -#define MAC_DCU_TXFILTER_DCU2_95_64_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU2_95_64_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU2_95_64_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU2_95_64_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXSLOT */ -#define MAC_DCU_TXSLOT_ADDRESS 0x000012f0 -#define MAC_DCU_TXSLOT_OFFSET 0x000012f0 -#define MAC_DCU_TXSLOT_MASK_MSB 15 -#define MAC_DCU_TXSLOT_MASK_LSB 0 -#define MAC_DCU_TXSLOT_MASK_MASK 0x0000ffff -#define MAC_DCU_TXSLOT_MASK_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DCU_TXSLOT_MASK_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_DCU_TXFILTER_DCU2_127_96 */ -#define MAC_DCU_TXFILTER_DCU2_127_96_ADDRESS 0x000012f8 -#define MAC_DCU_TXFILTER_DCU2_127_96_OFFSET 0x000012f8 -#define MAC_DCU_TXFILTER_DCU2_127_96_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU2_127_96_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU2_127_96_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU2_127_96_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU3_31_0 */ -#define MAC_DCU_TXFILTER_DCU3_31_0_ADDRESS 0x00001338 -#define MAC_DCU_TXFILTER_DCU3_31_0_OFFSET 0x00001338 -#define MAC_DCU_TXFILTER_DCU3_31_0_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU3_31_0_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU3_31_0_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU3_31_0_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU3_63_32 */ -#define MAC_DCU_TXFILTER_DCU3_63_32_ADDRESS 0x00001378 -#define MAC_DCU_TXFILTER_DCU3_63_32_OFFSET 0x00001378 -#define MAC_DCU_TXFILTER_DCU3_63_32_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU3_63_32_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU3_63_32_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU3_63_32_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU3_95_64 */ -#define MAC_DCU_TXFILTER_DCU3_95_64_ADDRESS 0x000013b8 -#define MAC_DCU_TXFILTER_DCU3_95_64_OFFSET 0x000013b8 -#define MAC_DCU_TXFILTER_DCU3_95_64_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU3_95_64_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU3_95_64_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU3_95_64_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU3_127_96 */ -#define MAC_DCU_TXFILTER_DCU3_127_96_ADDRESS 0x000013f8 -#define MAC_DCU_TXFILTER_DCU3_127_96_OFFSET 0x000013f8 -#define MAC_DCU_TXFILTER_DCU3_127_96_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU3_127_96_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU3_127_96_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU3_127_96_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU4_31_0 */ -#define MAC_DCU_TXFILTER_DCU4_31_0_ADDRESS 0x00001438 -#define MAC_DCU_TXFILTER_DCU4_31_0_OFFSET 0x00001438 -#define MAC_DCU_TXFILTER_DCU4_31_0_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU4_31_0_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU4_31_0_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU4_31_0_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_CLEAR */ -#define MAC_DCU_TXFILTER_CLEAR_ADDRESS 0x0000143c -#define MAC_DCU_TXFILTER_CLEAR_OFFSET 0x0000143c -#define MAC_DCU_TXFILTER_CLEAR_DATA_MSB 31 -#define MAC_DCU_TXFILTER_CLEAR_DATA_LSB 0 -#define MAC_DCU_TXFILTER_CLEAR_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_CLEAR_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DCU_TXFILTER_CLEAR_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DCU_TXFILTER_DCU4_63_32 */ -#define MAC_DCU_TXFILTER_DCU4_63_32_ADDRESS 0x00001478 -#define MAC_DCU_TXFILTER_DCU4_63_32_OFFSET 0x00001478 -#define MAC_DCU_TXFILTER_DCU4_63_32_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU4_63_32_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU4_63_32_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU4_63_32_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_SET */ -#define MAC_DCU_TXFILTER_SET_ADDRESS 0x0000147c -#define MAC_DCU_TXFILTER_SET_OFFSET 0x0000147c -#define MAC_DCU_TXFILTER_SET_DATA_MSB 31 -#define MAC_DCU_TXFILTER_SET_DATA_LSB 0 -#define MAC_DCU_TXFILTER_SET_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_SET_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DCU_TXFILTER_SET_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DCU_TXFILTER_DCU4_95_64 */ -#define MAC_DCU_TXFILTER_DCU4_95_64_ADDRESS 0x000014b8 -#define MAC_DCU_TXFILTER_DCU4_95_64_OFFSET 0x000014b8 -#define MAC_DCU_TXFILTER_DCU4_95_64_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU4_95_64_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU4_95_64_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU4_95_64_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU4_127_96 */ -#define MAC_DCU_TXFILTER_DCU4_127_96_ADDRESS 0x000014f8 -#define MAC_DCU_TXFILTER_DCU4_127_96_OFFSET 0x000014f8 -#define MAC_DCU_TXFILTER_DCU4_127_96_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU4_127_96_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU4_127_96_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU4_127_96_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU5_31_0 */ -#define MAC_DCU_TXFILTER_DCU5_31_0_ADDRESS 0x00001538 -#define MAC_DCU_TXFILTER_DCU5_31_0_OFFSET 0x00001538 -#define MAC_DCU_TXFILTER_DCU5_31_0_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU5_31_0_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU5_31_0_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU5_31_0_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU5_63_32 */ -#define MAC_DCU_TXFILTER_DCU5_63_32_ADDRESS 0x00001578 -#define MAC_DCU_TXFILTER_DCU5_63_32_OFFSET 0x00001578 -#define MAC_DCU_TXFILTER_DCU5_63_32_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU5_63_32_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU5_63_32_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU5_63_32_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU5_95_64 */ -#define MAC_DCU_TXFILTER_DCU5_95_64_ADDRESS 0x000015b8 -#define MAC_DCU_TXFILTER_DCU5_95_64_OFFSET 0x000015b8 -#define MAC_DCU_TXFILTER_DCU5_95_64_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU5_95_64_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU5_95_64_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU5_95_64_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU5_127_96 */ -#define MAC_DCU_TXFILTER_DCU5_127_96_ADDRESS 0x000015f8 -#define MAC_DCU_TXFILTER_DCU5_127_96_OFFSET 0x000015f8 -#define MAC_DCU_TXFILTER_DCU5_127_96_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU5_127_96_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU5_127_96_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU5_127_96_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU6_31_0 */ -#define MAC_DCU_TXFILTER_DCU6_31_0_ADDRESS 0x00001638 -#define MAC_DCU_TXFILTER_DCU6_31_0_OFFSET 0x00001638 -#define MAC_DCU_TXFILTER_DCU6_31_0_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU6_31_0_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU6_31_0_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU6_31_0_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU6_63_32 */ -#define MAC_DCU_TXFILTER_DCU6_63_32_ADDRESS 0x00001678 -#define MAC_DCU_TXFILTER_DCU6_63_32_OFFSET 0x00001678 -#define MAC_DCU_TXFILTER_DCU6_63_32_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU6_63_32_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU6_63_32_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU6_63_32_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU6_95_64 */ -#define MAC_DCU_TXFILTER_DCU6_95_64_ADDRESS 0x000016b8 -#define MAC_DCU_TXFILTER_DCU6_95_64_OFFSET 0x000016b8 -#define MAC_DCU_TXFILTER_DCU6_95_64_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU6_95_64_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU6_95_64_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU6_95_64_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU6_127_96 */ -#define MAC_DCU_TXFILTER_DCU6_127_96_ADDRESS 0x000016f8 -#define MAC_DCU_TXFILTER_DCU6_127_96_OFFSET 0x000016f8 -#define MAC_DCU_TXFILTER_DCU6_127_96_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU6_127_96_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU6_127_96_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU6_127_96_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU7_31_0 */ -#define MAC_DCU_TXFILTER_DCU7_31_0_ADDRESS 0x00001738 -#define MAC_DCU_TXFILTER_DCU7_31_0_OFFSET 0x00001738 -#define MAC_DCU_TXFILTER_DCU7_31_0_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU7_31_0_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU7_31_0_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU7_31_0_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU7_63_32 */ -#define MAC_DCU_TXFILTER_DCU7_63_32_ADDRESS 0x00001778 -#define MAC_DCU_TXFILTER_DCU7_63_32_OFFSET 0x00001778 -#define MAC_DCU_TXFILTER_DCU7_63_32_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU7_63_32_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU7_63_32_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU7_63_32_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU7_95_64 */ -#define MAC_DCU_TXFILTER_DCU7_95_64_ADDRESS 0x000017b8 -#define MAC_DCU_TXFILTER_DCU7_95_64_OFFSET 0x000017b8 -#define MAC_DCU_TXFILTER_DCU7_95_64_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU7_95_64_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU7_95_64_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU7_95_64_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DCU_TXFILTER_DCU7_127_96 */ -#define MAC_DCU_TXFILTER_DCU7_127_96_ADDRESS 0x000017f8 -#define MAC_DCU_TXFILTER_DCU7_127_96_OFFSET 0x000017f8 -#define MAC_DCU_TXFILTER_DCU7_127_96_DATA_MSB 31 -#define MAC_DCU_TXFILTER_DCU7_127_96_DATA_LSB 0 -#define MAC_DCU_TXFILTER_DCU7_127_96_DATA_MASK 0xffffffff -#define MAC_DCU_TXFILTER_DCU7_127_96_DATA_GET(x) (((x) & 0xffffffff) >> 0) - - -#ifndef __ASSEMBLER__ - -typedef struct wmac_dcu_reg_reg_s { - volatile char pad__0[0x1000]; /* 0x0 - 0x1000 */ - volatile unsigned int MAC_DCU_QCUMASK[10]; /* 0x1000 - 0x1028 */ - volatile char pad__1[0x8]; /* 0x1028 - 0x1030 */ - volatile unsigned int MAC_DCU_GBL_IFS_SIFS; /* 0x1030 - 0x1034 */ - volatile char pad__2[0x4]; /* 0x1034 - 0x1038 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU0_31_0; /* 0x1038 - 0x103c */ - volatile unsigned int MAC_DCU_TXFILTER_DCU8_31_0; /* 0x103c - 0x1040 */ - volatile unsigned int MAC_DCU_LCL_IFS[10]; /* 0x1040 - 0x1068 */ - volatile char pad__3[0x8]; /* 0x1068 - 0x1070 */ - volatile unsigned int MAC_DCU_GBL_IFS_SLOT; /* 0x1070 - 0x1074 */ - volatile char pad__4[0x4]; /* 0x1074 - 0x1078 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU0_63_32; /* 0x1078 - 0x107c */ - volatile unsigned int MAC_DCU_TXFILTER_DCU8_63_32; /* 0x107c - 0x1080 */ - volatile unsigned int MAC_DCU_RETRY_LIMIT[10]; /* 0x1080 - 0x10a8 */ - volatile char pad__5[0x8]; /* 0x10a8 - 0x10b0 */ - volatile unsigned int MAC_DCU_GBL_IFS_EIFS; /* 0x10b0 - 0x10b4 */ - volatile char pad__6[0x4]; /* 0x10b4 - 0x10b8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU0_95_64; /* 0x10b8 - 0x10bc */ - volatile unsigned int MAC_DCU_TXFILTER_DCU8_95_64; /* 0x10bc - 0x10c0 */ - volatile unsigned int MAC_DCU_CHANNEL_TIME[10]; /* 0x10c0 - 0x10e8 */ - volatile char pad__7[0x8]; /* 0x10e8 - 0x10f0 */ - volatile unsigned int MAC_DCU_GBL_IFS_MISC; /* 0x10f0 - 0x10f4 */ - volatile char pad__8[0x4]; /* 0x10f4 - 0x10f8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU0_127_96; /* 0x10f8 - 0x10fc */ - volatile unsigned int MAC_DCU_TXFILTER_DCU8_127_96; /* 0x10fc - 0x1100 */ - volatile unsigned int MAC_DCU_MISC[10]; /* 0x1100 - 0x1128 */ - volatile char pad__9[0x10]; /* 0x1128 - 0x1138 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU1_31_0; /* 0x1138 - 0x113c */ - volatile unsigned int MAC_DCU_TXFILTER_DCU9_31_0; /* 0x113c - 0x1140 */ - volatile unsigned int MAC_DCU_SEQ; /* 0x1140 - 0x1144 */ - volatile char pad__10[0x34]; /* 0x1144 - 0x1178 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU1_63_32; /* 0x1178 - 0x117c */ - volatile unsigned int MAC_DCU_TXFILTER_DCU9_63_32; /* 0x117c - 0x1180 */ - volatile char pad__11[0x38]; /* 0x1180 - 0x11b8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU1_95_64; /* 0x11b8 - 0x11bc */ - volatile unsigned int MAC_DCU_TXFILTER_DCU9_95_64; /* 0x11bc - 0x11c0 */ - volatile char pad__12[0x38]; /* 0x11c0 - 0x11f8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU1_127_96; /* 0x11f8 - 0x11fc */ - volatile unsigned int MAC_DCU_TXFILTER_DCU9_127_96; /* 0x11fc - 0x1200 */ - volatile char pad__13[0x38]; /* 0x1200 - 0x1238 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU2_31_0; /* 0x1238 - 0x123c */ - volatile char pad__14[0x34]; /* 0x123c - 0x1270 */ - volatile unsigned int MAC_DCU_PAUSE; /* 0x1270 - 0x1274 */ - volatile char pad__15[0x4]; /* 0x1274 - 0x1278 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU2_63_32; /* 0x1278 - 0x127c */ - volatile char pad__16[0x34]; /* 0x127c - 0x12b0 */ - volatile unsigned int MAC_DCU_WOW_KACFG; /* 0x12b0 - 0x12b4 */ - volatile char pad__17[0x4]; /* 0x12b4 - 0x12b8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU2_95_64; /* 0x12b8 - 0x12bc */ - volatile char pad__18[0x34]; /* 0x12bc - 0x12f0 */ - volatile unsigned int MAC_DCU_TXSLOT; /* 0x12f0 - 0x12f4 */ - volatile char pad__19[0x4]; /* 0x12f4 - 0x12f8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU2_127_96; /* 0x12f8 - 0x12fc */ - volatile char pad__20[0x3c]; /* 0x12fc - 0x1338 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU3_31_0; /* 0x1338 - 0x133c */ - volatile char pad__21[0x3c]; /* 0x133c - 0x1378 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU3_63_32; /* 0x1378 - 0x137c */ - volatile char pad__22[0x3c]; /* 0x137c - 0x13b8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU3_95_64; /* 0x13b8 - 0x13bc */ - volatile char pad__23[0x3c]; /* 0x13bc - 0x13f8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU3_127_96; /* 0x13f8 - 0x13fc */ - volatile char pad__24[0x3c]; /* 0x13fc - 0x1438 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU4_31_0; /* 0x1438 - 0x143c */ - volatile unsigned int MAC_DCU_TXFILTER_CLEAR; /* 0x143c - 0x1440 */ - volatile char pad__25[0x38]; /* 0x1440 - 0x1478 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU4_63_32; /* 0x1478 - 0x147c */ - volatile unsigned int MAC_DCU_TXFILTER_SET; /* 0x147c - 0x1480 */ - volatile char pad__26[0x38]; /* 0x1480 - 0x14b8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU4_95_64; /* 0x14b8 - 0x14bc */ - volatile char pad__27[0x3c]; /* 0x14bc - 0x14f8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU4_127_96; /* 0x14f8 - 0x14fc */ - volatile char pad__28[0x3c]; /* 0x14fc - 0x1538 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU5_31_0; /* 0x1538 - 0x153c */ - volatile char pad__29[0x3c]; /* 0x153c - 0x1578 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU5_63_32; /* 0x1578 - 0x157c */ - volatile char pad__30[0x3c]; /* 0x157c - 0x15b8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU5_95_64; /* 0x15b8 - 0x15bc */ - volatile char pad__31[0x3c]; /* 0x15bc - 0x15f8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU5_127_96; /* 0x15f8 - 0x15fc */ - volatile char pad__32[0x3c]; /* 0x15fc - 0x1638 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU6_31_0; /* 0x1638 - 0x163c */ - volatile char pad__33[0x3c]; /* 0x163c - 0x1678 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU6_63_32; /* 0x1678 - 0x167c */ - volatile char pad__34[0x3c]; /* 0x167c - 0x16b8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU6_95_64; /* 0x16b8 - 0x16bc */ - volatile char pad__35[0x3c]; /* 0x16bc - 0x16f8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU6_127_96; /* 0x16f8 - 0x16fc */ - volatile char pad__36[0x3c]; /* 0x16fc - 0x1738 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU7_31_0; /* 0x1738 - 0x173c */ - volatile char pad__37[0x3c]; /* 0x173c - 0x1778 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU7_63_32; /* 0x1778 - 0x177c */ - volatile char pad__38[0x3c]; /* 0x177c - 0x17b8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU7_95_64; /* 0x17b8 - 0x17bc */ - volatile char pad__39[0x3c]; /* 0x17bc - 0x17f8 */ - volatile unsigned int MAC_DCU_TXFILTER_DCU7_127_96; /* 0x17f8 - 0x17fc */ -} wmac_dcu_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _WMAC_DCU_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_dma_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_dma_reg.h deleted file mode 100644 index 59514f19a55b..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_dma_reg.h +++ /dev/null @@ -1,1000 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _WMAC_DMA_REG_REG_H_ -#define _WMAC_DMA_REG_REG_H_ - - -/* macros for MAC_DMA_CR */ -#define MAC_DMA_CR_ADDRESS 0x00000008 -#define MAC_DMA_CR_OFFSET 0x00000008 -#define MAC_DMA_CR_RXE_LP_MSB 2 -#define MAC_DMA_CR_RXE_LP_LSB 2 -#define MAC_DMA_CR_RXE_LP_MASK 0x00000004 -#define MAC_DMA_CR_RXE_LP_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_DMA_CR_RXE_HP_MSB 3 -#define MAC_DMA_CR_RXE_HP_LSB 3 -#define MAC_DMA_CR_RXE_HP_MASK 0x00000008 -#define MAC_DMA_CR_RXE_HP_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_DMA_CR_RXD_MSB 5 -#define MAC_DMA_CR_RXD_LSB 5 -#define MAC_DMA_CR_RXD_MASK 0x00000020 -#define MAC_DMA_CR_RXD_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_DMA_CR_RXD_SET(x) (((x) << 5) & 0x00000020) -#define MAC_DMA_CR_SWI_MSB 6 -#define MAC_DMA_CR_SWI_LSB 6 -#define MAC_DMA_CR_SWI_MASK 0x00000040 -#define MAC_DMA_CR_SWI_GET(x) (((x) & 0x00000040) >> 6) - -/* macros for MAC_DMA_CFG */ -#define MAC_DMA_CFG_ADDRESS 0x00000014 -#define MAC_DMA_CFG_OFFSET 0x00000014 -#define MAC_DMA_CFG_BE_MODE_XMIT_DESC_MSB 0 -#define MAC_DMA_CFG_BE_MODE_XMIT_DESC_LSB 0 -#define MAC_DMA_CFG_BE_MODE_XMIT_DESC_MASK 0x00000001 -#define MAC_DMA_CFG_BE_MODE_XMIT_DESC_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_DMA_CFG_BE_MODE_XMIT_DESC_SET(x) (((x) << 0) & 0x00000001) -#define MAC_DMA_CFG_BE_MODE_XMIT_DATA_MSB 1 -#define MAC_DMA_CFG_BE_MODE_XMIT_DATA_LSB 1 -#define MAC_DMA_CFG_BE_MODE_XMIT_DATA_MASK 0x00000002 -#define MAC_DMA_CFG_BE_MODE_XMIT_DATA_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_DMA_CFG_BE_MODE_XMIT_DATA_SET(x) (((x) << 1) & 0x00000002) -#define MAC_DMA_CFG_BE_MODE_RCV_DESC_MSB 2 -#define MAC_DMA_CFG_BE_MODE_RCV_DESC_LSB 2 -#define MAC_DMA_CFG_BE_MODE_RCV_DESC_MASK 0x00000004 -#define MAC_DMA_CFG_BE_MODE_RCV_DESC_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_DMA_CFG_BE_MODE_RCV_DESC_SET(x) (((x) << 2) & 0x00000004) -#define MAC_DMA_CFG_BE_MODE_RCV_DATA_MSB 3 -#define MAC_DMA_CFG_BE_MODE_RCV_DATA_LSB 3 -#define MAC_DMA_CFG_BE_MODE_RCV_DATA_MASK 0x00000008 -#define MAC_DMA_CFG_BE_MODE_RCV_DATA_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_DMA_CFG_BE_MODE_RCV_DATA_SET(x) (((x) << 3) & 0x00000008) -#define MAC_DMA_CFG_BE_MODE_MMR_MSB 4 -#define MAC_DMA_CFG_BE_MODE_MMR_LSB 4 -#define MAC_DMA_CFG_BE_MODE_MMR_MASK 0x00000010 -#define MAC_DMA_CFG_BE_MODE_MMR_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_DMA_CFG_BE_MODE_MMR_SET(x) (((x) << 4) & 0x00000010) -#define MAC_DMA_CFG_ADHOC_MSB 5 -#define MAC_DMA_CFG_ADHOC_LSB 5 -#define MAC_DMA_CFG_ADHOC_MASK 0x00000020 -#define MAC_DMA_CFG_ADHOC_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_DMA_CFG_ADHOC_SET(x) (((x) << 5) & 0x00000020) -#define MAC_DMA_CFG_PHY_OK_MSB 8 -#define MAC_DMA_CFG_PHY_OK_LSB 8 -#define MAC_DMA_CFG_PHY_OK_MASK 0x00000100 -#define MAC_DMA_CFG_PHY_OK_GET(x) (((x) & 0x00000100) >> 8) -#define MAC_DMA_CFG_EEPROM_BUSY_MSB 9 -#define MAC_DMA_CFG_EEPROM_BUSY_LSB 9 -#define MAC_DMA_CFG_EEPROM_BUSY_MASK 0x00000200 -#define MAC_DMA_CFG_EEPROM_BUSY_GET(x) (((x) & 0x00000200) >> 9) -#define MAC_DMA_CFG_CLKGATE_DIS_MSB 10 -#define MAC_DMA_CFG_CLKGATE_DIS_LSB 10 -#define MAC_DMA_CFG_CLKGATE_DIS_MASK 0x00000400 -#define MAC_DMA_CFG_CLKGATE_DIS_GET(x) (((x) & 0x00000400) >> 10) -#define MAC_DMA_CFG_CLKGATE_DIS_SET(x) (((x) << 10) & 0x00000400) -#define MAC_DMA_CFG_HALT_REQ_MSB 11 -#define MAC_DMA_CFG_HALT_REQ_LSB 11 -#define MAC_DMA_CFG_HALT_REQ_MASK 0x00000800 -#define MAC_DMA_CFG_HALT_REQ_GET(x) (((x) & 0x00000800) >> 11) -#define MAC_DMA_CFG_HALT_REQ_SET(x) (((x) << 11) & 0x00000800) -#define MAC_DMA_CFG_HALT_ACK_MSB 12 -#define MAC_DMA_CFG_HALT_ACK_LSB 12 -#define MAC_DMA_CFG_HALT_ACK_MASK 0x00001000 -#define MAC_DMA_CFG_HALT_ACK_GET(x) (((x) & 0x00001000) >> 12) -#define MAC_DMA_CFG_REQ_Q_FULL_THRESHOLD_MSB 18 -#define MAC_DMA_CFG_REQ_Q_FULL_THRESHOLD_LSB 17 -#define MAC_DMA_CFG_REQ_Q_FULL_THRESHOLD_MASK 0x00060000 -#define MAC_DMA_CFG_REQ_Q_FULL_THRESHOLD_GET(x) (((x) & 0x00060000) >> 17) -#define MAC_DMA_CFG_REQ_Q_FULL_THRESHOLD_SET(x) (((x) << 17) & 0x00060000) -#define MAC_DMA_CFG_MISSING_TX_INTR_FIX_ENABLE_MSB 19 -#define MAC_DMA_CFG_MISSING_TX_INTR_FIX_ENABLE_LSB 19 -#define MAC_DMA_CFG_MISSING_TX_INTR_FIX_ENABLE_MASK 0x00080000 -#define MAC_DMA_CFG_MISSING_TX_INTR_FIX_ENABLE_GET(x) (((x) & 0x00080000) >> 19) -#define MAC_DMA_CFG_MISSING_TX_INTR_FIX_ENABLE_SET(x) (((x) << 19) & 0x00080000) -#define MAC_DMA_CFG_LEGACY_INT_MIT_MODE_ENABLE_MSB 20 -#define MAC_DMA_CFG_LEGACY_INT_MIT_MODE_ENABLE_LSB 20 -#define MAC_DMA_CFG_LEGACY_INT_MIT_MODE_ENABLE_MASK 0x00100000 -#define MAC_DMA_CFG_LEGACY_INT_MIT_MODE_ENABLE_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_DMA_CFG_LEGACY_INT_MIT_MODE_ENABLE_SET(x) (((x) << 20) & 0x00100000) -#define MAC_DMA_CFG_RESET_INT_MIT_CNTRS_MSB 21 -#define MAC_DMA_CFG_RESET_INT_MIT_CNTRS_LSB 21 -#define MAC_DMA_CFG_RESET_INT_MIT_CNTRS_MASK 0x00200000 -#define MAC_DMA_CFG_RESET_INT_MIT_CNTRS_GET(x) (((x) & 0x00200000) >> 21) -#define MAC_DMA_CFG_RESET_INT_MIT_CNTRS_SET(x) (((x) << 21) & 0x00200000) - -/* macros for MAC_DMA_RXBUFPTR_THRESH */ -#define MAC_DMA_RXBUFPTR_THRESH_ADDRESS 0x00000018 -#define MAC_DMA_RXBUFPTR_THRESH_OFFSET 0x00000018 -#define MAC_DMA_RXBUFPTR_THRESH_HP_DATA_MSB 3 -#define MAC_DMA_RXBUFPTR_THRESH_HP_DATA_LSB 0 -#define MAC_DMA_RXBUFPTR_THRESH_HP_DATA_MASK 0x0000000f -#define MAC_DMA_RXBUFPTR_THRESH_HP_DATA_GET(x) (((x) & 0x0000000f) >> 0) -#define MAC_DMA_RXBUFPTR_THRESH_HP_DATA_SET(x) (((x) << 0) & 0x0000000f) -#define MAC_DMA_RXBUFPTR_THRESH_LP_DATA_MSB 14 -#define MAC_DMA_RXBUFPTR_THRESH_LP_DATA_LSB 8 -#define MAC_DMA_RXBUFPTR_THRESH_LP_DATA_MASK 0x00007f00 -#define MAC_DMA_RXBUFPTR_THRESH_LP_DATA_GET(x) (((x) & 0x00007f00) >> 8) -#define MAC_DMA_RXBUFPTR_THRESH_LP_DATA_SET(x) (((x) << 8) & 0x00007f00) - -/* macros for MAC_DMA_TXDPPTR_THRESH */ -#define MAC_DMA_TXDPPTR_THRESH_ADDRESS 0x0000001c -#define MAC_DMA_TXDPPTR_THRESH_OFFSET 0x0000001c -#define MAC_DMA_TXDPPTR_THRESH_DATA_MSB 3 -#define MAC_DMA_TXDPPTR_THRESH_DATA_LSB 0 -#define MAC_DMA_TXDPPTR_THRESH_DATA_MASK 0x0000000f -#define MAC_DMA_TXDPPTR_THRESH_DATA_GET(x) (((x) & 0x0000000f) >> 0) -#define MAC_DMA_TXDPPTR_THRESH_DATA_SET(x) (((x) << 0) & 0x0000000f) - -/* macros for MAC_DMA_MIRT */ -#define MAC_DMA_MIRT_ADDRESS 0x00000020 -#define MAC_DMA_MIRT_OFFSET 0x00000020 -#define MAC_DMA_MIRT_RATE_THRESH_MSB 15 -#define MAC_DMA_MIRT_RATE_THRESH_LSB 0 -#define MAC_DMA_MIRT_RATE_THRESH_MASK 0x0000ffff -#define MAC_DMA_MIRT_RATE_THRESH_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_MIRT_RATE_THRESH_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_DMA_GLOBAL_IER */ -#define MAC_DMA_GLOBAL_IER_ADDRESS 0x00000024 -#define MAC_DMA_GLOBAL_IER_OFFSET 0x00000024 -#define MAC_DMA_GLOBAL_IER_ENABLE_MSB 0 -#define MAC_DMA_GLOBAL_IER_ENABLE_LSB 0 -#define MAC_DMA_GLOBAL_IER_ENABLE_MASK 0x00000001 -#define MAC_DMA_GLOBAL_IER_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_DMA_GLOBAL_IER_ENABLE_SET(x) (((x) << 0) & 0x00000001) - -/* macros for MAC_DMA_TIMT_0 */ -#define MAC_DMA_TIMT_0_ADDRESS 0x00000028 -#define MAC_DMA_TIMT_0_OFFSET 0x00000028 -#define MAC_DMA_TIMT_0_TX_LAST_PKT_THRESH_MSB 15 -#define MAC_DMA_TIMT_0_TX_LAST_PKT_THRESH_LSB 0 -#define MAC_DMA_TIMT_0_TX_LAST_PKT_THRESH_MASK 0x0000ffff -#define MAC_DMA_TIMT_0_TX_LAST_PKT_THRESH_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_TIMT_0_TX_LAST_PKT_THRESH_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_DMA_TIMT_0_TX_FIRST_PKT_THRESH_MSB 31 -#define MAC_DMA_TIMT_0_TX_FIRST_PKT_THRESH_LSB 16 -#define MAC_DMA_TIMT_0_TX_FIRST_PKT_THRESH_MASK 0xffff0000 -#define MAC_DMA_TIMT_0_TX_FIRST_PKT_THRESH_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_DMA_TIMT_0_TX_FIRST_PKT_THRESH_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_DMA_RIMT */ -#define MAC_DMA_RIMT_ADDRESS 0x0000002c -#define MAC_DMA_RIMT_OFFSET 0x0000002c -#define MAC_DMA_RIMT_RX_LAST_PKT_THRESH_MSB 15 -#define MAC_DMA_RIMT_RX_LAST_PKT_THRESH_LSB 0 -#define MAC_DMA_RIMT_RX_LAST_PKT_THRESH_MASK 0x0000ffff -#define MAC_DMA_RIMT_RX_LAST_PKT_THRESH_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_RIMT_RX_LAST_PKT_THRESH_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_DMA_RIMT_RX_FIRST_PKT_THRESH_MSB 31 -#define MAC_DMA_RIMT_RX_FIRST_PKT_THRESH_LSB 16 -#define MAC_DMA_RIMT_RX_FIRST_PKT_THRESH_MASK 0xffff0000 -#define MAC_DMA_RIMT_RX_FIRST_PKT_THRESH_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_DMA_RIMT_RX_FIRST_PKT_THRESH_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_DMA_TXCFG */ -#define MAC_DMA_TXCFG_ADDRESS 0x00000030 -#define MAC_DMA_TXCFG_OFFSET 0x00000030 -#define MAC_DMA_TXCFG_DMA_SIZE_MSB 2 -#define MAC_DMA_TXCFG_DMA_SIZE_LSB 0 -#define MAC_DMA_TXCFG_DMA_SIZE_MASK 0x00000007 -#define MAC_DMA_TXCFG_DMA_SIZE_GET(x) (((x) & 0x00000007) >> 0) -#define MAC_DMA_TXCFG_DMA_SIZE_SET(x) (((x) << 0) & 0x00000007) -#define MAC_DMA_TXCFG_TRIGLVL_MSB 9 -#define MAC_DMA_TXCFG_TRIGLVL_LSB 4 -#define MAC_DMA_TXCFG_TRIGLVL_MASK 0x000003f0 -#define MAC_DMA_TXCFG_TRIGLVL_GET(x) (((x) & 0x000003f0) >> 4) -#define MAC_DMA_TXCFG_TRIGLVL_SET(x) (((x) << 4) & 0x000003f0) -#define MAC_DMA_TXCFG_JUMBO_EN_MSB 10 -#define MAC_DMA_TXCFG_JUMBO_EN_LSB 10 -#define MAC_DMA_TXCFG_JUMBO_EN_MASK 0x00000400 -#define MAC_DMA_TXCFG_JUMBO_EN_GET(x) (((x) & 0x00000400) >> 10) -#define MAC_DMA_TXCFG_JUMBO_EN_SET(x) (((x) << 10) & 0x00000400) -#define MAC_DMA_TXCFG_BCN_PAST_ATIM_DIS_MSB 11 -#define MAC_DMA_TXCFG_BCN_PAST_ATIM_DIS_LSB 11 -#define MAC_DMA_TXCFG_BCN_PAST_ATIM_DIS_MASK 0x00000800 -#define MAC_DMA_TXCFG_BCN_PAST_ATIM_DIS_GET(x) (((x) & 0x00000800) >> 11) -#define MAC_DMA_TXCFG_BCN_PAST_ATIM_DIS_SET(x) (((x) << 11) & 0x00000800) -#define MAC_DMA_TXCFG_ATIM_DEFER_DIS_MSB 12 -#define MAC_DMA_TXCFG_ATIM_DEFER_DIS_LSB 12 -#define MAC_DMA_TXCFG_ATIM_DEFER_DIS_MASK 0x00001000 -#define MAC_DMA_TXCFG_ATIM_DEFER_DIS_GET(x) (((x) & 0x00001000) >> 12) -#define MAC_DMA_TXCFG_ATIM_DEFER_DIS_SET(x) (((x) << 12) & 0x00001000) -#define MAC_DMA_TXCFG_RTCI_DIS_MSB 14 -#define MAC_DMA_TXCFG_RTCI_DIS_LSB 14 -#define MAC_DMA_TXCFG_RTCI_DIS_MASK 0x00004000 -#define MAC_DMA_TXCFG_RTCI_DIS_GET(x) (((x) & 0x00004000) >> 14) -#define MAC_DMA_TXCFG_RTCI_DIS_SET(x) (((x) << 14) & 0x00004000) -#define MAC_DMA_TXCFG_DIS_RETRY_UNDERRUN_MSB 17 -#define MAC_DMA_TXCFG_DIS_RETRY_UNDERRUN_LSB 17 -#define MAC_DMA_TXCFG_DIS_RETRY_UNDERRUN_MASK 0x00020000 -#define MAC_DMA_TXCFG_DIS_RETRY_UNDERRUN_GET(x) (((x) & 0x00020000) >> 17) -#define MAC_DMA_TXCFG_DIS_RETRY_UNDERRUN_SET(x) (((x) << 17) & 0x00020000) -#define MAC_DMA_TXCFG_DIS_CW_INC_QUIET_COLL_MSB 18 -#define MAC_DMA_TXCFG_DIS_CW_INC_QUIET_COLL_LSB 18 -#define MAC_DMA_TXCFG_DIS_CW_INC_QUIET_COLL_MASK 0x00040000 -#define MAC_DMA_TXCFG_DIS_CW_INC_QUIET_COLL_GET(x) (((x) & 0x00040000) >> 18) -#define MAC_DMA_TXCFG_DIS_CW_INC_QUIET_COLL_SET(x) (((x) << 18) & 0x00040000) -#define MAC_DMA_TXCFG_RTS_FAIL_EXCESSIVE_RETRIES_MSB 19 -#define MAC_DMA_TXCFG_RTS_FAIL_EXCESSIVE_RETRIES_LSB 19 -#define MAC_DMA_TXCFG_RTS_FAIL_EXCESSIVE_RETRIES_MASK 0x00080000 -#define MAC_DMA_TXCFG_RTS_FAIL_EXCESSIVE_RETRIES_GET(x) (((x) & 0x00080000) >> 19) -#define MAC_DMA_TXCFG_RTS_FAIL_EXCESSIVE_RETRIES_SET(x) (((x) << 19) & 0x00080000) - -/* macros for MAC_DMA_RXCFG */ -#define MAC_DMA_RXCFG_ADDRESS 0x00000034 -#define MAC_DMA_RXCFG_OFFSET 0x00000034 -#define MAC_DMA_RXCFG_DMA_SIZE_MSB 2 -#define MAC_DMA_RXCFG_DMA_SIZE_LSB 0 -#define MAC_DMA_RXCFG_DMA_SIZE_MASK 0x00000007 -#define MAC_DMA_RXCFG_DMA_SIZE_GET(x) (((x) & 0x00000007) >> 0) -#define MAC_DMA_RXCFG_DMA_SIZE_SET(x) (((x) << 0) & 0x00000007) -#define MAC_DMA_RXCFG_ZERO_LEN_DMA_EN_MSB 4 -#define MAC_DMA_RXCFG_ZERO_LEN_DMA_EN_LSB 3 -#define MAC_DMA_RXCFG_ZERO_LEN_DMA_EN_MASK 0x00000018 -#define MAC_DMA_RXCFG_ZERO_LEN_DMA_EN_GET(x) (((x) & 0x00000018) >> 3) -#define MAC_DMA_RXCFG_ZERO_LEN_DMA_EN_SET(x) (((x) << 3) & 0x00000018) -#define MAC_DMA_RXCFG_JUMBO_EN_MSB 5 -#define MAC_DMA_RXCFG_JUMBO_EN_LSB 5 -#define MAC_DMA_RXCFG_JUMBO_EN_MASK 0x00000020 -#define MAC_DMA_RXCFG_JUMBO_EN_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_DMA_RXCFG_JUMBO_EN_SET(x) (((x) << 5) & 0x00000020) -#define MAC_DMA_RXCFG_JUMBO_WRAP_EN_MSB 6 -#define MAC_DMA_RXCFG_JUMBO_WRAP_EN_LSB 6 -#define MAC_DMA_RXCFG_JUMBO_WRAP_EN_MASK 0x00000040 -#define MAC_DMA_RXCFG_JUMBO_WRAP_EN_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_DMA_RXCFG_JUMBO_WRAP_EN_SET(x) (((x) << 6) & 0x00000040) -#define MAC_DMA_RXCFG_SLEEP_RX_PEND_EN_MSB 7 -#define MAC_DMA_RXCFG_SLEEP_RX_PEND_EN_LSB 7 -#define MAC_DMA_RXCFG_SLEEP_RX_PEND_EN_MASK 0x00000080 -#define MAC_DMA_RXCFG_SLEEP_RX_PEND_EN_GET(x) (((x) & 0x00000080) >> 7) -#define MAC_DMA_RXCFG_SLEEP_RX_PEND_EN_SET(x) (((x) << 7) & 0x00000080) - -/* macros for MAC_DMA_RXJLA */ -#define MAC_DMA_RXJLA_ADDRESS 0x00000038 -#define MAC_DMA_RXJLA_OFFSET 0x00000038 -#define MAC_DMA_RXJLA_DATA_MSB 31 -#define MAC_DMA_RXJLA_DATA_LSB 2 -#define MAC_DMA_RXJLA_DATA_MASK 0xfffffffc -#define MAC_DMA_RXJLA_DATA_GET(x) (((x) & 0xfffffffc) >> 2) - -/* macros for MAC_DMA_MIBC */ -#define MAC_DMA_MIBC_ADDRESS 0x00000040 -#define MAC_DMA_MIBC_OFFSET 0x00000040 -#define MAC_DMA_MIBC_WARNING_MSB 0 -#define MAC_DMA_MIBC_WARNING_LSB 0 -#define MAC_DMA_MIBC_WARNING_MASK 0x00000001 -#define MAC_DMA_MIBC_WARNING_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_DMA_MIBC_FREEZE_MSB 1 -#define MAC_DMA_MIBC_FREEZE_LSB 1 -#define MAC_DMA_MIBC_FREEZE_MASK 0x00000002 -#define MAC_DMA_MIBC_FREEZE_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_DMA_MIBC_FREEZE_SET(x) (((x) << 1) & 0x00000002) -#define MAC_DMA_MIBC_CLEAR_MSB 2 -#define MAC_DMA_MIBC_CLEAR_LSB 2 -#define MAC_DMA_MIBC_CLEAR_MASK 0x00000004 -#define MAC_DMA_MIBC_CLEAR_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_DMA_MIBC_CLEAR_SET(x) (((x) << 2) & 0x00000004) -#define MAC_DMA_MIBC_STROBE_MSB 3 -#define MAC_DMA_MIBC_STROBE_LSB 3 -#define MAC_DMA_MIBC_STROBE_MASK 0x00000008 -#define MAC_DMA_MIBC_STROBE_GET(x) (((x) & 0x00000008) >> 3) - -/* macros for MAC_DMA_TOPS */ -#define MAC_DMA_TOPS_ADDRESS 0x00000044 -#define MAC_DMA_TOPS_OFFSET 0x00000044 -#define MAC_DMA_TOPS_TIMEOUT_MSB 15 -#define MAC_DMA_TOPS_TIMEOUT_LSB 0 -#define MAC_DMA_TOPS_TIMEOUT_MASK 0x0000ffff -#define MAC_DMA_TOPS_TIMEOUT_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_TOPS_TIMEOUT_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_DMA_RXNPTO */ -#define MAC_DMA_RXNPTO_ADDRESS 0x00000048 -#define MAC_DMA_RXNPTO_OFFSET 0x00000048 -#define MAC_DMA_RXNPTO_TIMEOUT_MSB 9 -#define MAC_DMA_RXNPTO_TIMEOUT_LSB 0 -#define MAC_DMA_RXNPTO_TIMEOUT_MASK 0x000003ff -#define MAC_DMA_RXNPTO_TIMEOUT_GET(x) (((x) & 0x000003ff) >> 0) -#define MAC_DMA_RXNPTO_TIMEOUT_SET(x) (((x) << 0) & 0x000003ff) - -/* macros for MAC_DMA_TXNPTO */ -#define MAC_DMA_TXNPTO_ADDRESS 0x0000004c -#define MAC_DMA_TXNPTO_OFFSET 0x0000004c -#define MAC_DMA_TXNPTO_TIMEOUT_MSB 9 -#define MAC_DMA_TXNPTO_TIMEOUT_LSB 0 -#define MAC_DMA_TXNPTO_TIMEOUT_MASK 0x000003ff -#define MAC_DMA_TXNPTO_TIMEOUT_GET(x) (((x) & 0x000003ff) >> 0) -#define MAC_DMA_TXNPTO_TIMEOUT_SET(x) (((x) << 0) & 0x000003ff) -#define MAC_DMA_TXNPTO_MASK_MSB 19 -#define MAC_DMA_TXNPTO_MASK_LSB 10 -#define MAC_DMA_TXNPTO_MASK_MASK 0x000ffc00 -#define MAC_DMA_TXNPTO_MASK_GET(x) (((x) & 0x000ffc00) >> 10) -#define MAC_DMA_TXNPTO_MASK_SET(x) (((x) << 10) & 0x000ffc00) - -/* macros for MAC_DMA_RPGTO */ -#define MAC_DMA_RPGTO_ADDRESS 0x00000050 -#define MAC_DMA_RPGTO_OFFSET 0x00000050 -#define MAC_DMA_RPGTO_TIMEOUT_MSB 9 -#define MAC_DMA_RPGTO_TIMEOUT_LSB 0 -#define MAC_DMA_RPGTO_TIMEOUT_MASK 0x000003ff -#define MAC_DMA_RPGTO_TIMEOUT_GET(x) (((x) & 0x000003ff) >> 0) -#define MAC_DMA_RPGTO_TIMEOUT_SET(x) (((x) << 0) & 0x000003ff) - -/* macros for MAC_DMA_MACMISC */ -#define MAC_DMA_MACMISC_ADDRESS 0x00000058 -#define MAC_DMA_MACMISC_OFFSET 0x00000058 -#define MAC_DMA_MACMISC_FORCE_PCI_EXT_MSB 4 -#define MAC_DMA_MACMISC_FORCE_PCI_EXT_LSB 4 -#define MAC_DMA_MACMISC_FORCE_PCI_EXT_MASK 0x00000010 -#define MAC_DMA_MACMISC_FORCE_PCI_EXT_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_DMA_MACMISC_FORCE_PCI_EXT_SET(x) (((x) << 4) & 0x00000010) -#define MAC_DMA_MACMISC_DMA_OBS_MUXSEL_MSB 8 -#define MAC_DMA_MACMISC_DMA_OBS_MUXSEL_LSB 5 -#define MAC_DMA_MACMISC_DMA_OBS_MUXSEL_MASK 0x000001e0 -#define MAC_DMA_MACMISC_DMA_OBS_MUXSEL_GET(x) (((x) & 0x000001e0) >> 5) -#define MAC_DMA_MACMISC_DMA_OBS_MUXSEL_SET(x) (((x) << 5) & 0x000001e0) -#define MAC_DMA_MACMISC_MISC_OBS_MUXSEL_MSB 11 -#define MAC_DMA_MACMISC_MISC_OBS_MUXSEL_LSB 9 -#define MAC_DMA_MACMISC_MISC_OBS_MUXSEL_MASK 0x00000e00 -#define MAC_DMA_MACMISC_MISC_OBS_MUXSEL_GET(x) (((x) & 0x00000e00) >> 9) -#define MAC_DMA_MACMISC_MISC_OBS_MUXSEL_SET(x) (((x) << 9) & 0x00000e00) -#define MAC_DMA_MACMISC_MISC_F2_OBS_LOW_MUXSEL_MSB 14 -#define MAC_DMA_MACMISC_MISC_F2_OBS_LOW_MUXSEL_LSB 12 -#define MAC_DMA_MACMISC_MISC_F2_OBS_LOW_MUXSEL_MASK 0x00007000 -#define MAC_DMA_MACMISC_MISC_F2_OBS_LOW_MUXSEL_GET(x) (((x) & 0x00007000) >> 12) -#define MAC_DMA_MACMISC_MISC_F2_OBS_LOW_MUXSEL_SET(x) (((x) << 12) & 0x00007000) -#define MAC_DMA_MACMISC_MISC_F2_OBS_HIGH_MUXSEL_MSB 17 -#define MAC_DMA_MACMISC_MISC_F2_OBS_HIGH_MUXSEL_LSB 15 -#define MAC_DMA_MACMISC_MISC_F2_OBS_HIGH_MUXSEL_MASK 0x00038000 -#define MAC_DMA_MACMISC_MISC_F2_OBS_HIGH_MUXSEL_GET(x) (((x) & 0x00038000) >> 15) -#define MAC_DMA_MACMISC_MISC_F2_OBS_HIGH_MUXSEL_SET(x) (((x) << 15) & 0x00038000) - -/* macros for MAC_DMA_INTER */ -#define MAC_DMA_INTER_ADDRESS 0x0000005c -#define MAC_DMA_INTER_OFFSET 0x0000005c -#define MAC_DMA_INTER_REQ_MSB 0 -#define MAC_DMA_INTER_REQ_LSB 0 -#define MAC_DMA_INTER_REQ_MASK 0x00000001 -#define MAC_DMA_INTER_REQ_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_DMA_INTER_REQ_SET(x) (((x) << 0) & 0x00000001) -#define MAC_DMA_INTER_MSI_RX_SRC_MSB 2 -#define MAC_DMA_INTER_MSI_RX_SRC_LSB 1 -#define MAC_DMA_INTER_MSI_RX_SRC_MASK 0x00000006 -#define MAC_DMA_INTER_MSI_RX_SRC_GET(x) (((x) & 0x00000006) >> 1) -#define MAC_DMA_INTER_MSI_RX_SRC_SET(x) (((x) << 1) & 0x00000006) -#define MAC_DMA_INTER_MSI_TX_SRC_MSB 4 -#define MAC_DMA_INTER_MSI_TX_SRC_LSB 3 -#define MAC_DMA_INTER_MSI_TX_SRC_MASK 0x00000018 -#define MAC_DMA_INTER_MSI_TX_SRC_GET(x) (((x) & 0x00000018) >> 3) -#define MAC_DMA_INTER_MSI_TX_SRC_SET(x) (((x) << 3) & 0x00000018) - -/* macros for MAC_DMA_DATABUF */ -#define MAC_DMA_DATABUF_ADDRESS 0x00000060 -#define MAC_DMA_DATABUF_OFFSET 0x00000060 -#define MAC_DMA_DATABUF_LEN_MSB 11 -#define MAC_DMA_DATABUF_LEN_LSB 0 -#define MAC_DMA_DATABUF_LEN_MASK 0x00000fff -#define MAC_DMA_DATABUF_LEN_GET(x) (((x) & 0x00000fff) >> 0) -#define MAC_DMA_DATABUF_LEN_SET(x) (((x) << 0) & 0x00000fff) - -/* macros for MAC_DMA_GTT */ -#define MAC_DMA_GTT_ADDRESS 0x00000064 -#define MAC_DMA_GTT_OFFSET 0x00000064 -#define MAC_DMA_GTT_COUNT_MSB 15 -#define MAC_DMA_GTT_COUNT_LSB 0 -#define MAC_DMA_GTT_COUNT_MASK 0x0000ffff -#define MAC_DMA_GTT_COUNT_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_GTT_COUNT_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_DMA_GTT_LIMIT_MSB 31 -#define MAC_DMA_GTT_LIMIT_LSB 16 -#define MAC_DMA_GTT_LIMIT_MASK 0xffff0000 -#define MAC_DMA_GTT_LIMIT_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_DMA_GTT_LIMIT_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_DMA_GTTM */ -#define MAC_DMA_GTTM_ADDRESS 0x00000068 -#define MAC_DMA_GTTM_OFFSET 0x00000068 -#define MAC_DMA_GTTM_USEC_STROBE_MSB 0 -#define MAC_DMA_GTTM_USEC_STROBE_LSB 0 -#define MAC_DMA_GTTM_USEC_STROBE_MASK 0x00000001 -#define MAC_DMA_GTTM_USEC_STROBE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_DMA_GTTM_USEC_STROBE_SET(x) (((x) << 0) & 0x00000001) -#define MAC_DMA_GTTM_IGNORE_CHAN_IDLE_MSB 1 -#define MAC_DMA_GTTM_IGNORE_CHAN_IDLE_LSB 1 -#define MAC_DMA_GTTM_IGNORE_CHAN_IDLE_MASK 0x00000002 -#define MAC_DMA_GTTM_IGNORE_CHAN_IDLE_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_DMA_GTTM_IGNORE_CHAN_IDLE_SET(x) (((x) << 1) & 0x00000002) -#define MAC_DMA_GTTM_RESET_ON_CHAN_IDLE_MSB 2 -#define MAC_DMA_GTTM_RESET_ON_CHAN_IDLE_LSB 2 -#define MAC_DMA_GTTM_RESET_ON_CHAN_IDLE_MASK 0x00000004 -#define MAC_DMA_GTTM_RESET_ON_CHAN_IDLE_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_DMA_GTTM_RESET_ON_CHAN_IDLE_SET(x) (((x) << 2) & 0x00000004) -#define MAC_DMA_GTTM_CST_USEC_STROBE_MSB 3 -#define MAC_DMA_GTTM_CST_USEC_STROBE_LSB 3 -#define MAC_DMA_GTTM_CST_USEC_STROBE_MASK 0x00000008 -#define MAC_DMA_GTTM_CST_USEC_STROBE_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_DMA_GTTM_CST_USEC_STROBE_SET(x) (((x) << 3) & 0x00000008) -#define MAC_DMA_GTTM_DISABLE_QCU_FR_ACTIVE_GTT_MSB 4 -#define MAC_DMA_GTTM_DISABLE_QCU_FR_ACTIVE_GTT_LSB 4 -#define MAC_DMA_GTTM_DISABLE_QCU_FR_ACTIVE_GTT_MASK 0x00000010 -#define MAC_DMA_GTTM_DISABLE_QCU_FR_ACTIVE_GTT_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_DMA_GTTM_DISABLE_QCU_FR_ACTIVE_GTT_SET(x) (((x) << 4) & 0x00000010) -#define MAC_DMA_GTTM_DISABLE_QCU_FR_ACTIVE_BT_MSB 5 -#define MAC_DMA_GTTM_DISABLE_QCU_FR_ACTIVE_BT_LSB 5 -#define MAC_DMA_GTTM_DISABLE_QCU_FR_ACTIVE_BT_MASK 0x00000020 -#define MAC_DMA_GTTM_DISABLE_QCU_FR_ACTIVE_BT_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_DMA_GTTM_DISABLE_QCU_FR_ACTIVE_BT_SET(x) (((x) << 5) & 0x00000020) - -/* macros for MAC_DMA_CST */ -#define MAC_DMA_CST_ADDRESS 0x0000006c -#define MAC_DMA_CST_OFFSET 0x0000006c -#define MAC_DMA_CST_COUNT_MSB 15 -#define MAC_DMA_CST_COUNT_LSB 0 -#define MAC_DMA_CST_COUNT_MASK 0x0000ffff -#define MAC_DMA_CST_COUNT_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_CST_COUNT_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_DMA_CST_LIMIT_MSB 31 -#define MAC_DMA_CST_LIMIT_LSB 16 -#define MAC_DMA_CST_LIMIT_MASK 0xffff0000 -#define MAC_DMA_CST_LIMIT_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_DMA_CST_LIMIT_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_DMA_RXDP_SIZE */ -#define MAC_DMA_RXDP_SIZE_ADDRESS 0x00000070 -#define MAC_DMA_RXDP_SIZE_OFFSET 0x00000070 -#define MAC_DMA_RXDP_SIZE_LP_MSB 7 -#define MAC_DMA_RXDP_SIZE_LP_LSB 0 -#define MAC_DMA_RXDP_SIZE_LP_MASK 0x000000ff -#define MAC_DMA_RXDP_SIZE_LP_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_DMA_RXDP_SIZE_HP_MSB 12 -#define MAC_DMA_RXDP_SIZE_HP_LSB 8 -#define MAC_DMA_RXDP_SIZE_HP_MASK 0x00001f00 -#define MAC_DMA_RXDP_SIZE_HP_GET(x) (((x) & 0x00001f00) >> 8) - -/* macros for MAC_DMA_RX_QUEUE_HP_RXDP */ -#define MAC_DMA_RX_QUEUE_HP_RXDP_ADDRESS 0x00000074 -#define MAC_DMA_RX_QUEUE_HP_RXDP_OFFSET 0x00000074 -#define MAC_DMA_RX_QUEUE_HP_RXDP_ADDR_MSB 31 -#define MAC_DMA_RX_QUEUE_HP_RXDP_ADDR_LSB 0 -#define MAC_DMA_RX_QUEUE_HP_RXDP_ADDR_MASK 0xffffffff -#define MAC_DMA_RX_QUEUE_HP_RXDP_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_RX_QUEUE_HP_RXDP_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_RX_QUEUE_LP_RXDP */ -#define MAC_DMA_RX_QUEUE_LP_RXDP_ADDRESS 0x00000078 -#define MAC_DMA_RX_QUEUE_LP_RXDP_OFFSET 0x00000078 -#define MAC_DMA_RX_QUEUE_LP_RXDP_ADDR_MSB 31 -#define MAC_DMA_RX_QUEUE_LP_RXDP_ADDR_LSB 0 -#define MAC_DMA_RX_QUEUE_LP_RXDP_ADDR_MASK 0xffffffff -#define MAC_DMA_RX_QUEUE_LP_RXDP_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_RX_QUEUE_LP_RXDP_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_ISR_P */ -#define MAC_DMA_ISR_P_ADDRESS 0x00000080 -#define MAC_DMA_ISR_P_OFFSET 0x00000080 -#define MAC_DMA_ISR_P_DATA_MSB 31 -#define MAC_DMA_ISR_P_DATA_LSB 0 -#define MAC_DMA_ISR_P_DATA_MASK 0xffffffff -#define MAC_DMA_ISR_P_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_ISR_P_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_ISR_S0 */ -#define MAC_DMA_ISR_S0_ADDRESS 0x00000084 -#define MAC_DMA_ISR_S0_OFFSET 0x00000084 -#define MAC_DMA_ISR_S0_DATA_MSB 31 -#define MAC_DMA_ISR_S0_DATA_LSB 0 -#define MAC_DMA_ISR_S0_DATA_MASK 0xffffffff -#define MAC_DMA_ISR_S0_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_ISR_S0_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_ISR_S1 */ -#define MAC_DMA_ISR_S1_ADDRESS 0x00000088 -#define MAC_DMA_ISR_S1_OFFSET 0x00000088 -#define MAC_DMA_ISR_S1_DATA_MSB 31 -#define MAC_DMA_ISR_S1_DATA_LSB 0 -#define MAC_DMA_ISR_S1_DATA_MASK 0xffffffff -#define MAC_DMA_ISR_S1_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_ISR_S1_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_ISR_S2 */ -#define MAC_DMA_ISR_S2_ADDRESS 0x0000008c -#define MAC_DMA_ISR_S2_OFFSET 0x0000008c -#define MAC_DMA_ISR_S2_DATA_MSB 31 -#define MAC_DMA_ISR_S2_DATA_LSB 0 -#define MAC_DMA_ISR_S2_DATA_MASK 0xffffffff -#define MAC_DMA_ISR_S2_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_ISR_S2_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_ISR_S3 */ -#define MAC_DMA_ISR_S3_ADDRESS 0x00000090 -#define MAC_DMA_ISR_S3_OFFSET 0x00000090 -#define MAC_DMA_ISR_S3_DATA_MSB 31 -#define MAC_DMA_ISR_S3_DATA_LSB 0 -#define MAC_DMA_ISR_S3_DATA_MASK 0xffffffff -#define MAC_DMA_ISR_S3_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_ISR_S3_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_ISR_S4 */ -#define MAC_DMA_ISR_S4_ADDRESS 0x00000094 -#define MAC_DMA_ISR_S4_OFFSET 0x00000094 -#define MAC_DMA_ISR_S4_DATA_MSB 31 -#define MAC_DMA_ISR_S4_DATA_LSB 0 -#define MAC_DMA_ISR_S4_DATA_MASK 0xffffffff -#define MAC_DMA_ISR_S4_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_ISR_S4_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_ISR_S5 */ -#define MAC_DMA_ISR_S5_ADDRESS 0x00000098 -#define MAC_DMA_ISR_S5_OFFSET 0x00000098 -#define MAC_DMA_ISR_S5_DATA_MSB 31 -#define MAC_DMA_ISR_S5_DATA_LSB 0 -#define MAC_DMA_ISR_S5_DATA_MASK 0xffffffff -#define MAC_DMA_ISR_S5_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_ISR_S5_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_ISR_S6 */ -#define MAC_DMA_ISR_S6_ADDRESS 0x0000009c -#define MAC_DMA_ISR_S6_OFFSET 0x0000009c -#define MAC_DMA_ISR_S6_DATA_MSB 31 -#define MAC_DMA_ISR_S6_DATA_LSB 0 -#define MAC_DMA_ISR_S6_DATA_MASK 0xffffffff -#define MAC_DMA_ISR_S6_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_ISR_S6_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_IMR_P */ -#define MAC_DMA_IMR_P_ADDRESS 0x000000a0 -#define MAC_DMA_IMR_P_OFFSET 0x000000a0 -#define MAC_DMA_IMR_P_MASK_MSB 31 -#define MAC_DMA_IMR_P_MASK_LSB 0 -#define MAC_DMA_IMR_P_MASK_MASK 0xffffffff -#define MAC_DMA_IMR_P_MASK_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_IMR_P_MASK_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_IMR_S0 */ -#define MAC_DMA_IMR_S0_ADDRESS 0x000000a4 -#define MAC_DMA_IMR_S0_OFFSET 0x000000a4 -#define MAC_DMA_IMR_S0_MASK_MSB 31 -#define MAC_DMA_IMR_S0_MASK_LSB 0 -#define MAC_DMA_IMR_S0_MASK_MASK 0xffffffff -#define MAC_DMA_IMR_S0_MASK_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_IMR_S0_MASK_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_IMR_S1 */ -#define MAC_DMA_IMR_S1_ADDRESS 0x000000a8 -#define MAC_DMA_IMR_S1_OFFSET 0x000000a8 -#define MAC_DMA_IMR_S1_DATA_MSB 31 -#define MAC_DMA_IMR_S1_DATA_LSB 0 -#define MAC_DMA_IMR_S1_DATA_MASK 0xffffffff -#define MAC_DMA_IMR_S1_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_IMR_S1_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_IMR_S2 */ -#define MAC_DMA_IMR_S2_ADDRESS 0x000000ac -#define MAC_DMA_IMR_S2_OFFSET 0x000000ac -#define MAC_DMA_IMR_S2_MASK_MSB 31 -#define MAC_DMA_IMR_S2_MASK_LSB 0 -#define MAC_DMA_IMR_S2_MASK_MASK 0xffffffff -#define MAC_DMA_IMR_S2_MASK_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_IMR_S2_MASK_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_IMR_S3 */ -#define MAC_DMA_IMR_S3_ADDRESS 0x000000b0 -#define MAC_DMA_IMR_S3_OFFSET 0x000000b0 -#define MAC_DMA_IMR_S3_MASK_MSB 31 -#define MAC_DMA_IMR_S3_MASK_LSB 0 -#define MAC_DMA_IMR_S3_MASK_MASK 0xffffffff -#define MAC_DMA_IMR_S3_MASK_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_IMR_S3_MASK_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_IMR_S4 */ -#define MAC_DMA_IMR_S4_ADDRESS 0x000000b4 -#define MAC_DMA_IMR_S4_OFFSET 0x000000b4 -#define MAC_DMA_IMR_S4_MASK_MSB 31 -#define MAC_DMA_IMR_S4_MASK_LSB 0 -#define MAC_DMA_IMR_S4_MASK_MASK 0xffffffff -#define MAC_DMA_IMR_S4_MASK_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_IMR_S4_MASK_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_IMR_S5 */ -#define MAC_DMA_IMR_S5_ADDRESS 0x000000b8 -#define MAC_DMA_IMR_S5_OFFSET 0x000000b8 -#define MAC_DMA_IMR_S5_MASK_MSB 31 -#define MAC_DMA_IMR_S5_MASK_LSB 0 -#define MAC_DMA_IMR_S5_MASK_MASK 0xffffffff -#define MAC_DMA_IMR_S5_MASK_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_IMR_S5_MASK_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_IMR_S6 */ -#define MAC_DMA_IMR_S6_ADDRESS 0x000000bc -#define MAC_DMA_IMR_S6_OFFSET 0x000000bc -#define MAC_DMA_IMR_S6_MASK_MSB 31 -#define MAC_DMA_IMR_S6_MASK_LSB 0 -#define MAC_DMA_IMR_S6_MASK_MASK 0xffffffff -#define MAC_DMA_IMR_S6_MASK_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_DMA_IMR_S6_MASK_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_DMA_ISR_P_RAC */ -#define MAC_DMA_ISR_P_RAC_ADDRESS 0x000000c0 -#define MAC_DMA_ISR_P_RAC_OFFSET 0x000000c0 -#define MAC_DMA_ISR_P_RAC_DATA_MSB 31 -#define MAC_DMA_ISR_P_RAC_DATA_LSB 0 -#define MAC_DMA_ISR_P_RAC_DATA_MASK 0xffffffff -#define MAC_DMA_ISR_P_RAC_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_ISR_S0_S */ -#define MAC_DMA_ISR_S0_S_ADDRESS 0x000000c4 -#define MAC_DMA_ISR_S0_S_OFFSET 0x000000c4 -#define MAC_DMA_ISR_S0_S_SHADOW_MSB 31 -#define MAC_DMA_ISR_S0_S_SHADOW_LSB 0 -#define MAC_DMA_ISR_S0_S_SHADOW_MASK 0xffffffff -#define MAC_DMA_ISR_S0_S_SHADOW_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_ISR_S1_S */ -#define MAC_DMA_ISR_S1_S_ADDRESS 0x000000c8 -#define MAC_DMA_ISR_S1_S_OFFSET 0x000000c8 -#define MAC_DMA_ISR_S1_S_SHADOW_MSB 31 -#define MAC_DMA_ISR_S1_S_SHADOW_LSB 0 -#define MAC_DMA_ISR_S1_S_SHADOW_MASK 0xffffffff -#define MAC_DMA_ISR_S1_S_SHADOW_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_ISR_S6_S */ -#define MAC_DMA_ISR_S6_S_ADDRESS 0x000000cc -#define MAC_DMA_ISR_S6_S_OFFSET 0x000000cc -#define MAC_DMA_ISR_S6_S_SHADOW_MSB 31 -#define MAC_DMA_ISR_S6_S_SHADOW_LSB 0 -#define MAC_DMA_ISR_S6_S_SHADOW_MASK 0xffffffff -#define MAC_DMA_ISR_S6_S_SHADOW_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_ISR_S2_S */ -#define MAC_DMA_ISR_S2_S_ADDRESS 0x000000d0 -#define MAC_DMA_ISR_S2_S_OFFSET 0x000000d0 -#define MAC_DMA_ISR_S2_S_SHADOW_MSB 31 -#define MAC_DMA_ISR_S2_S_SHADOW_LSB 0 -#define MAC_DMA_ISR_S2_S_SHADOW_MASK 0xffffffff -#define MAC_DMA_ISR_S2_S_SHADOW_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_ISR_S3_S */ -#define MAC_DMA_ISR_S3_S_ADDRESS 0x000000d4 -#define MAC_DMA_ISR_S3_S_OFFSET 0x000000d4 -#define MAC_DMA_ISR_S3_S_SHADOW_MSB 31 -#define MAC_DMA_ISR_S3_S_SHADOW_LSB 0 -#define MAC_DMA_ISR_S3_S_SHADOW_MASK 0xffffffff -#define MAC_DMA_ISR_S3_S_SHADOW_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_ISR_S4_S */ -#define MAC_DMA_ISR_S4_S_ADDRESS 0x000000d8 -#define MAC_DMA_ISR_S4_S_OFFSET 0x000000d8 -#define MAC_DMA_ISR_S4_S_SHADOW_MSB 31 -#define MAC_DMA_ISR_S4_S_SHADOW_LSB 0 -#define MAC_DMA_ISR_S4_S_SHADOW_MASK 0xffffffff -#define MAC_DMA_ISR_S4_S_SHADOW_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_ISR_S5_S */ -#define MAC_DMA_ISR_S5_S_ADDRESS 0x000000dc -#define MAC_DMA_ISR_S5_S_OFFSET 0x000000dc -#define MAC_DMA_ISR_S5_S_SHADOW_MSB 31 -#define MAC_DMA_ISR_S5_S_SHADOW_LSB 0 -#define MAC_DMA_ISR_S5_S_SHADOW_MASK 0xffffffff -#define MAC_DMA_ISR_S5_S_SHADOW_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_DMADBG_0 */ -#define MAC_DMA_DMADBG_0_ADDRESS 0x000000e0 -#define MAC_DMA_DMADBG_0_OFFSET 0x000000e0 -#define MAC_DMA_DMADBG_0_DATA_MSB 31 -#define MAC_DMA_DMADBG_0_DATA_LSB 0 -#define MAC_DMA_DMADBG_0_DATA_MASK 0xffffffff -#define MAC_DMA_DMADBG_0_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_DMADBG_1 */ -#define MAC_DMA_DMADBG_1_ADDRESS 0x000000e4 -#define MAC_DMA_DMADBG_1_OFFSET 0x000000e4 -#define MAC_DMA_DMADBG_1_DATA_MSB 31 -#define MAC_DMA_DMADBG_1_DATA_LSB 0 -#define MAC_DMA_DMADBG_1_DATA_MASK 0xffffffff -#define MAC_DMA_DMADBG_1_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_DMADBG_2 */ -#define MAC_DMA_DMADBG_2_ADDRESS 0x000000e8 -#define MAC_DMA_DMADBG_2_OFFSET 0x000000e8 -#define MAC_DMA_DMADBG_2_DATA_MSB 31 -#define MAC_DMA_DMADBG_2_DATA_LSB 0 -#define MAC_DMA_DMADBG_2_DATA_MASK 0xffffffff -#define MAC_DMA_DMADBG_2_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_DMADBG_3 */ -#define MAC_DMA_DMADBG_3_ADDRESS 0x000000ec -#define MAC_DMA_DMADBG_3_OFFSET 0x000000ec -#define MAC_DMA_DMADBG_3_DATA_MSB 31 -#define MAC_DMA_DMADBG_3_DATA_LSB 0 -#define MAC_DMA_DMADBG_3_DATA_MASK 0xffffffff -#define MAC_DMA_DMADBG_3_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_DMADBG_4 */ -#define MAC_DMA_DMADBG_4_ADDRESS 0x000000f0 -#define MAC_DMA_DMADBG_4_OFFSET 0x000000f0 -#define MAC_DMA_DMADBG_4_DATA_MSB 31 -#define MAC_DMA_DMADBG_4_DATA_LSB 0 -#define MAC_DMA_DMADBG_4_DATA_MASK 0xffffffff -#define MAC_DMA_DMADBG_4_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_DMADBG_5 */ -#define MAC_DMA_DMADBG_5_ADDRESS 0x000000f4 -#define MAC_DMA_DMADBG_5_OFFSET 0x000000f4 -#define MAC_DMA_DMADBG_5_DATA_MSB 31 -#define MAC_DMA_DMADBG_5_DATA_LSB 0 -#define MAC_DMA_DMADBG_5_DATA_MASK 0xffffffff -#define MAC_DMA_DMADBG_5_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_DMADBG_6 */ -#define MAC_DMA_DMADBG_6_ADDRESS 0x000000f8 -#define MAC_DMA_DMADBG_6_OFFSET 0x000000f8 -#define MAC_DMA_DMADBG_6_DATA_MSB 31 -#define MAC_DMA_DMADBG_6_DATA_LSB 0 -#define MAC_DMA_DMADBG_6_DATA_MASK 0xffffffff -#define MAC_DMA_DMADBG_6_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_DMADBG_7 */ -#define MAC_DMA_DMADBG_7_ADDRESS 0x000000fc -#define MAC_DMA_DMADBG_7_OFFSET 0x000000fc -#define MAC_DMA_DMADBG_7_DATA_MSB 31 -#define MAC_DMA_DMADBG_7_DATA_LSB 0 -#define MAC_DMA_DMADBG_7_DATA_MASK 0xffffffff -#define MAC_DMA_DMADBG_7_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_QCU_TXDP_REMAINING_QCU_7_0 */ -#define MAC_DMA_QCU_TXDP_REMAINING_QCU_7_0_ADDRESS 0x00000100 -#define MAC_DMA_QCU_TXDP_REMAINING_QCU_7_0_OFFSET 0x00000100 -#define MAC_DMA_QCU_TXDP_REMAINING_QCU_7_0_DATA_MSB 31 -#define MAC_DMA_QCU_TXDP_REMAINING_QCU_7_0_DATA_LSB 0 -#define MAC_DMA_QCU_TXDP_REMAINING_QCU_7_0_DATA_MASK 0xffffffff -#define MAC_DMA_QCU_TXDP_REMAINING_QCU_7_0_DATA_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_DMA_QCU_TXDP_REMAINING_QCU_9_8 */ -#define MAC_DMA_QCU_TXDP_REMAINING_QCU_9_8_ADDRESS 0x00000104 -#define MAC_DMA_QCU_TXDP_REMAINING_QCU_9_8_OFFSET 0x00000104 -#define MAC_DMA_QCU_TXDP_REMAINING_QCU_9_8_DATA_MSB 7 -#define MAC_DMA_QCU_TXDP_REMAINING_QCU_9_8_DATA_LSB 0 -#define MAC_DMA_QCU_TXDP_REMAINING_QCU_9_8_DATA_MASK 0x000000ff -#define MAC_DMA_QCU_TXDP_REMAINING_QCU_9_8_DATA_GET(x) (((x) & 0x000000ff) >> 0) - -/* macros for MAC_DMA_TIMT_1 */ -#define MAC_DMA_TIMT_1_ADDRESS 0x00000108 -#define MAC_DMA_TIMT_1_OFFSET 0x00000108 -#define MAC_DMA_TIMT_1_TX_LAST_PKT_THRESH_MSB 15 -#define MAC_DMA_TIMT_1_TX_LAST_PKT_THRESH_LSB 0 -#define MAC_DMA_TIMT_1_TX_LAST_PKT_THRESH_MASK 0x0000ffff -#define MAC_DMA_TIMT_1_TX_LAST_PKT_THRESH_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_TIMT_1_TX_LAST_PKT_THRESH_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_DMA_TIMT_1_TX_FIRST_PKT_THRESH_MSB 31 -#define MAC_DMA_TIMT_1_TX_FIRST_PKT_THRESH_LSB 16 -#define MAC_DMA_TIMT_1_TX_FIRST_PKT_THRESH_MASK 0xffff0000 -#define MAC_DMA_TIMT_1_TX_FIRST_PKT_THRESH_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_DMA_TIMT_1_TX_FIRST_PKT_THRESH_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_DMA_TIMT_2 */ -#define MAC_DMA_TIMT_2_ADDRESS 0x0000010c -#define MAC_DMA_TIMT_2_OFFSET 0x0000010c -#define MAC_DMA_TIMT_2_TX_LAST_PKT_THRESH_MSB 15 -#define MAC_DMA_TIMT_2_TX_LAST_PKT_THRESH_LSB 0 -#define MAC_DMA_TIMT_2_TX_LAST_PKT_THRESH_MASK 0x0000ffff -#define MAC_DMA_TIMT_2_TX_LAST_PKT_THRESH_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_TIMT_2_TX_LAST_PKT_THRESH_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_DMA_TIMT_2_TX_FIRST_PKT_THRESH_MSB 31 -#define MAC_DMA_TIMT_2_TX_FIRST_PKT_THRESH_LSB 16 -#define MAC_DMA_TIMT_2_TX_FIRST_PKT_THRESH_MASK 0xffff0000 -#define MAC_DMA_TIMT_2_TX_FIRST_PKT_THRESH_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_DMA_TIMT_2_TX_FIRST_PKT_THRESH_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_DMA_TIMT_3 */ -#define MAC_DMA_TIMT_3_ADDRESS 0x00000110 -#define MAC_DMA_TIMT_3_OFFSET 0x00000110 -#define MAC_DMA_TIMT_3_TX_LAST_PKT_THRESH_MSB 15 -#define MAC_DMA_TIMT_3_TX_LAST_PKT_THRESH_LSB 0 -#define MAC_DMA_TIMT_3_TX_LAST_PKT_THRESH_MASK 0x0000ffff -#define MAC_DMA_TIMT_3_TX_LAST_PKT_THRESH_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_TIMT_3_TX_LAST_PKT_THRESH_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_DMA_TIMT_3_TX_FIRST_PKT_THRESH_MSB 31 -#define MAC_DMA_TIMT_3_TX_FIRST_PKT_THRESH_LSB 16 -#define MAC_DMA_TIMT_3_TX_FIRST_PKT_THRESH_MASK 0xffff0000 -#define MAC_DMA_TIMT_3_TX_FIRST_PKT_THRESH_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_DMA_TIMT_3_TX_FIRST_PKT_THRESH_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_DMA_TIMT_4 */ -#define MAC_DMA_TIMT_4_ADDRESS 0x00000114 -#define MAC_DMA_TIMT_4_OFFSET 0x00000114 -#define MAC_DMA_TIMT_4_TX_LAST_PKT_THRESH_MSB 15 -#define MAC_DMA_TIMT_4_TX_LAST_PKT_THRESH_LSB 0 -#define MAC_DMA_TIMT_4_TX_LAST_PKT_THRESH_MASK 0x0000ffff -#define MAC_DMA_TIMT_4_TX_LAST_PKT_THRESH_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_TIMT_4_TX_LAST_PKT_THRESH_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_DMA_TIMT_4_TX_FIRST_PKT_THRESH_MSB 31 -#define MAC_DMA_TIMT_4_TX_FIRST_PKT_THRESH_LSB 16 -#define MAC_DMA_TIMT_4_TX_FIRST_PKT_THRESH_MASK 0xffff0000 -#define MAC_DMA_TIMT_4_TX_FIRST_PKT_THRESH_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_DMA_TIMT_4_TX_FIRST_PKT_THRESH_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_DMA_TIMT_5 */ -#define MAC_DMA_TIMT_5_ADDRESS 0x00000118 -#define MAC_DMA_TIMT_5_OFFSET 0x00000118 -#define MAC_DMA_TIMT_5_TX_LAST_PKT_THRESH_MSB 15 -#define MAC_DMA_TIMT_5_TX_LAST_PKT_THRESH_LSB 0 -#define MAC_DMA_TIMT_5_TX_LAST_PKT_THRESH_MASK 0x0000ffff -#define MAC_DMA_TIMT_5_TX_LAST_PKT_THRESH_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_TIMT_5_TX_LAST_PKT_THRESH_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_DMA_TIMT_5_TX_FIRST_PKT_THRESH_MSB 31 -#define MAC_DMA_TIMT_5_TX_FIRST_PKT_THRESH_LSB 16 -#define MAC_DMA_TIMT_5_TX_FIRST_PKT_THRESH_MASK 0xffff0000 -#define MAC_DMA_TIMT_5_TX_FIRST_PKT_THRESH_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_DMA_TIMT_5_TX_FIRST_PKT_THRESH_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_DMA_TIMT_6 */ -#define MAC_DMA_TIMT_6_ADDRESS 0x0000011c -#define MAC_DMA_TIMT_6_OFFSET 0x0000011c -#define MAC_DMA_TIMT_6_TX_LAST_PKT_THRESH_MSB 15 -#define MAC_DMA_TIMT_6_TX_LAST_PKT_THRESH_LSB 0 -#define MAC_DMA_TIMT_6_TX_LAST_PKT_THRESH_MASK 0x0000ffff -#define MAC_DMA_TIMT_6_TX_LAST_PKT_THRESH_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_TIMT_6_TX_LAST_PKT_THRESH_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_DMA_TIMT_6_TX_FIRST_PKT_THRESH_MSB 31 -#define MAC_DMA_TIMT_6_TX_FIRST_PKT_THRESH_LSB 16 -#define MAC_DMA_TIMT_6_TX_FIRST_PKT_THRESH_MASK 0xffff0000 -#define MAC_DMA_TIMT_6_TX_FIRST_PKT_THRESH_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_DMA_TIMT_6_TX_FIRST_PKT_THRESH_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_DMA_TIMT_7 */ -#define MAC_DMA_TIMT_7_ADDRESS 0x00000120 -#define MAC_DMA_TIMT_7_OFFSET 0x00000120 -#define MAC_DMA_TIMT_7_TX_LAST_PKT_THRESH_MSB 15 -#define MAC_DMA_TIMT_7_TX_LAST_PKT_THRESH_LSB 0 -#define MAC_DMA_TIMT_7_TX_LAST_PKT_THRESH_MASK 0x0000ffff -#define MAC_DMA_TIMT_7_TX_LAST_PKT_THRESH_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_TIMT_7_TX_LAST_PKT_THRESH_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_DMA_TIMT_7_TX_FIRST_PKT_THRESH_MSB 31 -#define MAC_DMA_TIMT_7_TX_FIRST_PKT_THRESH_LSB 16 -#define MAC_DMA_TIMT_7_TX_FIRST_PKT_THRESH_MASK 0xffff0000 -#define MAC_DMA_TIMT_7_TX_FIRST_PKT_THRESH_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_DMA_TIMT_7_TX_FIRST_PKT_THRESH_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_DMA_TIMT_8 */ -#define MAC_DMA_TIMT_8_ADDRESS 0x00000124 -#define MAC_DMA_TIMT_8_OFFSET 0x00000124 -#define MAC_DMA_TIMT_8_TX_LAST_PKT_THRESH_MSB 15 -#define MAC_DMA_TIMT_8_TX_LAST_PKT_THRESH_LSB 0 -#define MAC_DMA_TIMT_8_TX_LAST_PKT_THRESH_MASK 0x0000ffff -#define MAC_DMA_TIMT_8_TX_LAST_PKT_THRESH_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_TIMT_8_TX_LAST_PKT_THRESH_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_DMA_TIMT_8_TX_FIRST_PKT_THRESH_MSB 31 -#define MAC_DMA_TIMT_8_TX_FIRST_PKT_THRESH_LSB 16 -#define MAC_DMA_TIMT_8_TX_FIRST_PKT_THRESH_MASK 0xffff0000 -#define MAC_DMA_TIMT_8_TX_FIRST_PKT_THRESH_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_DMA_TIMT_8_TX_FIRST_PKT_THRESH_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_DMA_TIMT_9 */ -#define MAC_DMA_TIMT_9_ADDRESS 0x00000128 -#define MAC_DMA_TIMT_9_OFFSET 0x00000128 -#define MAC_DMA_TIMT_9_TX_LAST_PKT_THRESH_MSB 15 -#define MAC_DMA_TIMT_9_TX_LAST_PKT_THRESH_LSB 0 -#define MAC_DMA_TIMT_9_TX_LAST_PKT_THRESH_MASK 0x0000ffff -#define MAC_DMA_TIMT_9_TX_LAST_PKT_THRESH_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_DMA_TIMT_9_TX_LAST_PKT_THRESH_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_DMA_TIMT_9_TX_FIRST_PKT_THRESH_MSB 31 -#define MAC_DMA_TIMT_9_TX_FIRST_PKT_THRESH_LSB 16 -#define MAC_DMA_TIMT_9_TX_FIRST_PKT_THRESH_MASK 0xffff0000 -#define MAC_DMA_TIMT_9_TX_FIRST_PKT_THRESH_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_DMA_TIMT_9_TX_FIRST_PKT_THRESH_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_DMA_CHKACC */ -#define MAC_DMA_CHKACC_ADDRESS 0x0000012c -#define MAC_DMA_CHKACC_OFFSET 0x0000012c -#define MAC_DMA_CHKACC_CHKSUM_SEL_MSB 0 -#define MAC_DMA_CHKACC_CHKSUM_SEL_LSB 0 -#define MAC_DMA_CHKACC_CHKSUM_SEL_MASK 0x00000001 -#define MAC_DMA_CHKACC_CHKSUM_SEL_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_DMA_CHKACC_CHKSUM_SEL_SET(x) (((x) << 0) & 0x00000001) - - -#ifndef __ASSEMBLER__ - -typedef struct wmac_dma_reg_reg_s { - volatile char pad__0[0x8]; /* 0x0 - 0x8 */ - volatile unsigned int MAC_DMA_CR; /* 0x8 - 0xc */ - volatile char pad__1[0x8]; /* 0xc - 0x14 */ - volatile unsigned int MAC_DMA_CFG; /* 0x14 - 0x18 */ - volatile unsigned int MAC_DMA_RXBUFPTR_THRESH; /* 0x18 - 0x1c */ - volatile unsigned int MAC_DMA_TXDPPTR_THRESH; /* 0x1c - 0x20 */ - volatile unsigned int MAC_DMA_MIRT; /* 0x20 - 0x24 */ - volatile unsigned int MAC_DMA_GLOBAL_IER; /* 0x24 - 0x28 */ - volatile unsigned int MAC_DMA_TIMT_0; /* 0x28 - 0x2c */ - volatile unsigned int MAC_DMA_RIMT; /* 0x2c - 0x30 */ - volatile unsigned int MAC_DMA_TXCFG; /* 0x30 - 0x34 */ - volatile unsigned int MAC_DMA_RXCFG; /* 0x34 - 0x38 */ - volatile unsigned int MAC_DMA_RXJLA; /* 0x38 - 0x3c */ - volatile char pad__2[0x4]; /* 0x3c - 0x40 */ - volatile unsigned int MAC_DMA_MIBC; /* 0x40 - 0x44 */ - volatile unsigned int MAC_DMA_TOPS; /* 0x44 - 0x48 */ - volatile unsigned int MAC_DMA_RXNPTO; /* 0x48 - 0x4c */ - volatile unsigned int MAC_DMA_TXNPTO; /* 0x4c - 0x50 */ - volatile unsigned int MAC_DMA_RPGTO; /* 0x50 - 0x54 */ - volatile char pad__3[0x4]; /* 0x54 - 0x58 */ - volatile unsigned int MAC_DMA_MACMISC; /* 0x58 - 0x5c */ - volatile unsigned int MAC_DMA_INTER; /* 0x5c - 0x60 */ - volatile unsigned int MAC_DMA_DATABUF; /* 0x60 - 0x64 */ - volatile unsigned int MAC_DMA_GTT; /* 0x64 - 0x68 */ - volatile unsigned int MAC_DMA_GTTM; /* 0x68 - 0x6c */ - volatile unsigned int MAC_DMA_CST; /* 0x6c - 0x70 */ - volatile unsigned int MAC_DMA_RXDP_SIZE; /* 0x70 - 0x74 */ - volatile unsigned int MAC_DMA_RX_QUEUE_HP_RXDP; /* 0x74 - 0x78 */ - volatile unsigned int MAC_DMA_RX_QUEUE_LP_RXDP; /* 0x78 - 0x7c */ - volatile char pad__4[0x4]; /* 0x7c - 0x80 */ - volatile unsigned int MAC_DMA_ISR_P; /* 0x80 - 0x84 */ - volatile unsigned int MAC_DMA_ISR_S0; /* 0x84 - 0x88 */ - volatile unsigned int MAC_DMA_ISR_S1; /* 0x88 - 0x8c */ - volatile unsigned int MAC_DMA_ISR_S2; /* 0x8c - 0x90 */ - volatile unsigned int MAC_DMA_ISR_S3; /* 0x90 - 0x94 */ - volatile unsigned int MAC_DMA_ISR_S4; /* 0x94 - 0x98 */ - volatile unsigned int MAC_DMA_ISR_S5; /* 0x98 - 0x9c */ - volatile unsigned int MAC_DMA_ISR_S6; /* 0x9c - 0xa0 */ - volatile unsigned int MAC_DMA_IMR_P; /* 0xa0 - 0xa4 */ - volatile unsigned int MAC_DMA_IMR_S0; /* 0xa4 - 0xa8 */ - volatile unsigned int MAC_DMA_IMR_S1; /* 0xa8 - 0xac */ - volatile unsigned int MAC_DMA_IMR_S2; /* 0xac - 0xb0 */ - volatile unsigned int MAC_DMA_IMR_S3; /* 0xb0 - 0xb4 */ - volatile unsigned int MAC_DMA_IMR_S4; /* 0xb4 - 0xb8 */ - volatile unsigned int MAC_DMA_IMR_S5; /* 0xb8 - 0xbc */ - volatile unsigned int MAC_DMA_IMR_S6; /* 0xbc - 0xc0 */ - volatile unsigned int MAC_DMA_ISR_P_RAC; /* 0xc0 - 0xc4 */ - volatile unsigned int MAC_DMA_ISR_S0_S; /* 0xc4 - 0xc8 */ - volatile unsigned int MAC_DMA_ISR_S1_S; /* 0xc8 - 0xcc */ - volatile unsigned int MAC_DMA_ISR_S6_S; /* 0xcc - 0xd0 */ - volatile unsigned int MAC_DMA_ISR_S2_S; /* 0xd0 - 0xd4 */ - volatile unsigned int MAC_DMA_ISR_S3_S; /* 0xd4 - 0xd8 */ - volatile unsigned int MAC_DMA_ISR_S4_S; /* 0xd8 - 0xdc */ - volatile unsigned int MAC_DMA_ISR_S5_S; /* 0xdc - 0xe0 */ - volatile unsigned int MAC_DMA_DMADBG_0; /* 0xe0 - 0xe4 */ - volatile unsigned int MAC_DMA_DMADBG_1; /* 0xe4 - 0xe8 */ - volatile unsigned int MAC_DMA_DMADBG_2; /* 0xe8 - 0xec */ - volatile unsigned int MAC_DMA_DMADBG_3; /* 0xec - 0xf0 */ - volatile unsigned int MAC_DMA_DMADBG_4; /* 0xf0 - 0xf4 */ - volatile unsigned int MAC_DMA_DMADBG_5; /* 0xf4 - 0xf8 */ - volatile unsigned int MAC_DMA_DMADBG_6; /* 0xf8 - 0xfc */ - volatile unsigned int MAC_DMA_DMADBG_7; /* 0xfc - 0x100 */ - volatile unsigned int MAC_DMA_QCU_TXDP_REMAINING_QCU_7_0; /* 0x100 - 0x104 */ - volatile unsigned int MAC_DMA_QCU_TXDP_REMAINING_QCU_9_8; /* 0x104 - 0x108 */ - volatile unsigned int MAC_DMA_TIMT_1; /* 0x108 - 0x10c */ - volatile unsigned int MAC_DMA_TIMT_2; /* 0x10c - 0x110 */ - volatile unsigned int MAC_DMA_TIMT_3; /* 0x110 - 0x114 */ - volatile unsigned int MAC_DMA_TIMT_4; /* 0x114 - 0x118 */ - volatile unsigned int MAC_DMA_TIMT_5; /* 0x118 - 0x11c */ - volatile unsigned int MAC_DMA_TIMT_6; /* 0x11c - 0x120 */ - volatile unsigned int MAC_DMA_TIMT_7; /* 0x120 - 0x124 */ - volatile unsigned int MAC_DMA_TIMT_8; /* 0x124 - 0x128 */ - volatile unsigned int MAC_DMA_TIMT_9; /* 0x128 - 0x12c */ - volatile unsigned int MAC_DMA_CHKACC; /* 0x12c - 0x130 */ -} wmac_dma_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _WMAC_DMA_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_pcu_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_pcu_reg.h deleted file mode 100644 index a83ae2c7d7ee..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_pcu_reg.h +++ /dev/null @@ -1,4492 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _WMAC_PCU_REG_REG_H_ -#define _WMAC_PCU_REG_REG_H_ - - -/* macros for MAC_PCU_STA_ADDR_L32 */ -#define MAC_PCU_STA_ADDR_L32_ADDRESS 0x00008000 -#define MAC_PCU_STA_ADDR_L32_OFFSET 0x00008000 -#define MAC_PCU_STA_ADDR_L32_ADDR_31_0_MSB 31 -#define MAC_PCU_STA_ADDR_L32_ADDR_31_0_LSB 0 -#define MAC_PCU_STA_ADDR_L32_ADDR_31_0_MASK 0xffffffff -#define MAC_PCU_STA_ADDR_L32_ADDR_31_0_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_STA_ADDR_L32_ADDR_31_0_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_STA_ADDR_U16 */ -#define MAC_PCU_STA_ADDR_U16_ADDRESS 0x00008004 -#define MAC_PCU_STA_ADDR_U16_OFFSET 0x00008004 -#define MAC_PCU_STA_ADDR_U16_ADDR_47_32_MSB 15 -#define MAC_PCU_STA_ADDR_U16_ADDR_47_32_LSB 0 -#define MAC_PCU_STA_ADDR_U16_ADDR_47_32_MASK 0x0000ffff -#define MAC_PCU_STA_ADDR_U16_ADDR_47_32_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_STA_ADDR_U16_ADDR_47_32_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_PCU_STA_ADDR_U16_STA_AP_MSB 16 -#define MAC_PCU_STA_ADDR_U16_STA_AP_LSB 16 -#define MAC_PCU_STA_ADDR_U16_STA_AP_MASK 0x00010000 -#define MAC_PCU_STA_ADDR_U16_STA_AP_GET(x) (((x) & 0x00010000) >> 16) -#define MAC_PCU_STA_ADDR_U16_STA_AP_SET(x) (((x) << 16) & 0x00010000) -#define MAC_PCU_STA_ADDR_U16_ADHOC_MSB 17 -#define MAC_PCU_STA_ADDR_U16_ADHOC_LSB 17 -#define MAC_PCU_STA_ADDR_U16_ADHOC_MASK 0x00020000 -#define MAC_PCU_STA_ADDR_U16_ADHOC_GET(x) (((x) & 0x00020000) >> 17) -#define MAC_PCU_STA_ADDR_U16_ADHOC_SET(x) (((x) << 17) & 0x00020000) -#define MAC_PCU_STA_ADDR_U16_PW_SAVE_MSB 18 -#define MAC_PCU_STA_ADDR_U16_PW_SAVE_LSB 18 -#define MAC_PCU_STA_ADDR_U16_PW_SAVE_MASK 0x00040000 -#define MAC_PCU_STA_ADDR_U16_PW_SAVE_GET(x) (((x) & 0x00040000) >> 18) -#define MAC_PCU_STA_ADDR_U16_PW_SAVE_SET(x) (((x) << 18) & 0x00040000) -#define MAC_PCU_STA_ADDR_U16_KEYSRCH_DIS_MSB 19 -#define MAC_PCU_STA_ADDR_U16_KEYSRCH_DIS_LSB 19 -#define MAC_PCU_STA_ADDR_U16_KEYSRCH_DIS_MASK 0x00080000 -#define MAC_PCU_STA_ADDR_U16_KEYSRCH_DIS_GET(x) (((x) & 0x00080000) >> 19) -#define MAC_PCU_STA_ADDR_U16_KEYSRCH_DIS_SET(x) (((x) << 19) & 0x00080000) -#define MAC_PCU_STA_ADDR_U16_PCF_MSB 20 -#define MAC_PCU_STA_ADDR_U16_PCF_LSB 20 -#define MAC_PCU_STA_ADDR_U16_PCF_MASK 0x00100000 -#define MAC_PCU_STA_ADDR_U16_PCF_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_PCU_STA_ADDR_U16_PCF_SET(x) (((x) << 20) & 0x00100000) -#define MAC_PCU_STA_ADDR_U16_USE_DEFANT_MSB 21 -#define MAC_PCU_STA_ADDR_U16_USE_DEFANT_LSB 21 -#define MAC_PCU_STA_ADDR_U16_USE_DEFANT_MASK 0x00200000 -#define MAC_PCU_STA_ADDR_U16_USE_DEFANT_GET(x) (((x) & 0x00200000) >> 21) -#define MAC_PCU_STA_ADDR_U16_USE_DEFANT_SET(x) (((x) << 21) & 0x00200000) -#define MAC_PCU_STA_ADDR_U16_DEFANT_UPDATE_MSB 22 -#define MAC_PCU_STA_ADDR_U16_DEFANT_UPDATE_LSB 22 -#define MAC_PCU_STA_ADDR_U16_DEFANT_UPDATE_MASK 0x00400000 -#define MAC_PCU_STA_ADDR_U16_DEFANT_UPDATE_GET(x) (((x) & 0x00400000) >> 22) -#define MAC_PCU_STA_ADDR_U16_DEFANT_UPDATE_SET(x) (((x) << 22) & 0x00400000) -#define MAC_PCU_STA_ADDR_U16_RTS_USE_DEF_MSB 23 -#define MAC_PCU_STA_ADDR_U16_RTS_USE_DEF_LSB 23 -#define MAC_PCU_STA_ADDR_U16_RTS_USE_DEF_MASK 0x00800000 -#define MAC_PCU_STA_ADDR_U16_RTS_USE_DEF_GET(x) (((x) & 0x00800000) >> 23) -#define MAC_PCU_STA_ADDR_U16_RTS_USE_DEF_SET(x) (((x) << 23) & 0x00800000) -#define MAC_PCU_STA_ADDR_U16_ACKCTS_6MB_MSB 24 -#define MAC_PCU_STA_ADDR_U16_ACKCTS_6MB_LSB 24 -#define MAC_PCU_STA_ADDR_U16_ACKCTS_6MB_MASK 0x01000000 -#define MAC_PCU_STA_ADDR_U16_ACKCTS_6MB_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_PCU_STA_ADDR_U16_ACKCTS_6MB_SET(x) (((x) << 24) & 0x01000000) -#define MAC_PCU_STA_ADDR_U16_BASE_RATE_11B_MSB 25 -#define MAC_PCU_STA_ADDR_U16_BASE_RATE_11B_LSB 25 -#define MAC_PCU_STA_ADDR_U16_BASE_RATE_11B_MASK 0x02000000 -#define MAC_PCU_STA_ADDR_U16_BASE_RATE_11B_GET(x) (((x) & 0x02000000) >> 25) -#define MAC_PCU_STA_ADDR_U16_BASE_RATE_11B_SET(x) (((x) << 25) & 0x02000000) -#define MAC_PCU_STA_ADDR_U16_SECTOR_SELF_GEN_MSB 26 -#define MAC_PCU_STA_ADDR_U16_SECTOR_SELF_GEN_LSB 26 -#define MAC_PCU_STA_ADDR_U16_SECTOR_SELF_GEN_MASK 0x04000000 -#define MAC_PCU_STA_ADDR_U16_SECTOR_SELF_GEN_GET(x) (((x) & 0x04000000) >> 26) -#define MAC_PCU_STA_ADDR_U16_SECTOR_SELF_GEN_SET(x) (((x) << 26) & 0x04000000) -#define MAC_PCU_STA_ADDR_U16_CRPT_MIC_ENABLE_MSB 27 -#define MAC_PCU_STA_ADDR_U16_CRPT_MIC_ENABLE_LSB 27 -#define MAC_PCU_STA_ADDR_U16_CRPT_MIC_ENABLE_MASK 0x08000000 -#define MAC_PCU_STA_ADDR_U16_CRPT_MIC_ENABLE_GET(x) (((x) & 0x08000000) >> 27) -#define MAC_PCU_STA_ADDR_U16_CRPT_MIC_ENABLE_SET(x) (((x) << 27) & 0x08000000) -#define MAC_PCU_STA_ADDR_U16_KSRCH_MODE_MSB 28 -#define MAC_PCU_STA_ADDR_U16_KSRCH_MODE_LSB 28 -#define MAC_PCU_STA_ADDR_U16_KSRCH_MODE_MASK 0x10000000 -#define MAC_PCU_STA_ADDR_U16_KSRCH_MODE_GET(x) (((x) & 0x10000000) >> 28) -#define MAC_PCU_STA_ADDR_U16_KSRCH_MODE_SET(x) (((x) << 28) & 0x10000000) -#define MAC_PCU_STA_ADDR_U16_PRESERVE_SEQNUM_MSB 29 -#define MAC_PCU_STA_ADDR_U16_PRESERVE_SEQNUM_LSB 29 -#define MAC_PCU_STA_ADDR_U16_PRESERVE_SEQNUM_MASK 0x20000000 -#define MAC_PCU_STA_ADDR_U16_PRESERVE_SEQNUM_GET(x) (((x) & 0x20000000) >> 29) -#define MAC_PCU_STA_ADDR_U16_PRESERVE_SEQNUM_SET(x) (((x) << 29) & 0x20000000) -#define MAC_PCU_STA_ADDR_U16_CBCIV_ENDIAN_MSB 30 -#define MAC_PCU_STA_ADDR_U16_CBCIV_ENDIAN_LSB 30 -#define MAC_PCU_STA_ADDR_U16_CBCIV_ENDIAN_MASK 0x40000000 -#define MAC_PCU_STA_ADDR_U16_CBCIV_ENDIAN_GET(x) (((x) & 0x40000000) >> 30) -#define MAC_PCU_STA_ADDR_U16_CBCIV_ENDIAN_SET(x) (((x) << 30) & 0x40000000) -#define MAC_PCU_STA_ADDR_U16_ADHOC_MCAST_SEARCH_MSB 31 -#define MAC_PCU_STA_ADDR_U16_ADHOC_MCAST_SEARCH_LSB 31 -#define MAC_PCU_STA_ADDR_U16_ADHOC_MCAST_SEARCH_MASK 0x80000000 -#define MAC_PCU_STA_ADDR_U16_ADHOC_MCAST_SEARCH_GET(x) (((x) & 0x80000000) >> 31) -#define MAC_PCU_STA_ADDR_U16_ADHOC_MCAST_SEARCH_SET(x) (((x) << 31) & 0x80000000) - -/* macros for MAC_PCU_BSSID_L32 */ -#define MAC_PCU_BSSID_L32_ADDRESS 0x00008008 -#define MAC_PCU_BSSID_L32_OFFSET 0x00008008 -#define MAC_PCU_BSSID_L32_ADDR_MSB 31 -#define MAC_PCU_BSSID_L32_ADDR_LSB 0 -#define MAC_PCU_BSSID_L32_ADDR_MASK 0xffffffff -#define MAC_PCU_BSSID_L32_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_BSSID_L32_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_BSSID_U16 */ -#define MAC_PCU_BSSID_U16_ADDRESS 0x0000800c -#define MAC_PCU_BSSID_U16_OFFSET 0x0000800c -#define MAC_PCU_BSSID_U16_ADDR_MSB 15 -#define MAC_PCU_BSSID_U16_ADDR_LSB 0 -#define MAC_PCU_BSSID_U16_ADDR_MASK 0x0000ffff -#define MAC_PCU_BSSID_U16_ADDR_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_BSSID_U16_ADDR_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_PCU_BSSID_U16_AID_MSB 26 -#define MAC_PCU_BSSID_U16_AID_LSB 16 -#define MAC_PCU_BSSID_U16_AID_MASK 0x07ff0000 -#define MAC_PCU_BSSID_U16_AID_GET(x) (((x) & 0x07ff0000) >> 16) -#define MAC_PCU_BSSID_U16_AID_SET(x) (((x) << 16) & 0x07ff0000) - -/* macros for MAC_PCU_BCN_RSSI_AVE */ -#define MAC_PCU_BCN_RSSI_AVE_ADDRESS 0x00008010 -#define MAC_PCU_BCN_RSSI_AVE_OFFSET 0x00008010 -#define MAC_PCU_BCN_RSSI_AVE_AVE_VALUE_MSB 11 -#define MAC_PCU_BCN_RSSI_AVE_AVE_VALUE_LSB 0 -#define MAC_PCU_BCN_RSSI_AVE_AVE_VALUE_MASK 0x00000fff -#define MAC_PCU_BCN_RSSI_AVE_AVE_VALUE_GET(x) (((x) & 0x00000fff) >> 0) -#define MAC_PCU_BCN_RSSI_AVE_AVE_VALUE2_MSB 27 -#define MAC_PCU_BCN_RSSI_AVE_AVE_VALUE2_LSB 16 -#define MAC_PCU_BCN_RSSI_AVE_AVE_VALUE2_MASK 0x0fff0000 -#define MAC_PCU_BCN_RSSI_AVE_AVE_VALUE2_GET(x) (((x) & 0x0fff0000) >> 16) - -/* macros for MAC_PCU_ACK_CTS_TIMEOUT */ -#define MAC_PCU_ACK_CTS_TIMEOUT_ADDRESS 0x00008014 -#define MAC_PCU_ACK_CTS_TIMEOUT_OFFSET 0x00008014 -#define MAC_PCU_ACK_CTS_TIMEOUT_ACK_TIMEOUT_MSB 13 -#define MAC_PCU_ACK_CTS_TIMEOUT_ACK_TIMEOUT_LSB 0 -#define MAC_PCU_ACK_CTS_TIMEOUT_ACK_TIMEOUT_MASK 0x00003fff -#define MAC_PCU_ACK_CTS_TIMEOUT_ACK_TIMEOUT_GET(x) (((x) & 0x00003fff) >> 0) -#define MAC_PCU_ACK_CTS_TIMEOUT_ACK_TIMEOUT_SET(x) (((x) << 0) & 0x00003fff) -#define MAC_PCU_ACK_CTS_TIMEOUT_CTS_TIMEOUT_MSB 29 -#define MAC_PCU_ACK_CTS_TIMEOUT_CTS_TIMEOUT_LSB 16 -#define MAC_PCU_ACK_CTS_TIMEOUT_CTS_TIMEOUT_MASK 0x3fff0000 -#define MAC_PCU_ACK_CTS_TIMEOUT_CTS_TIMEOUT_GET(x) (((x) & 0x3fff0000) >> 16) -#define MAC_PCU_ACK_CTS_TIMEOUT_CTS_TIMEOUT_SET(x) (((x) << 16) & 0x3fff0000) - -/* macros for MAC_PCU_BCN_RSSI_CTL */ -#define MAC_PCU_BCN_RSSI_CTL_ADDRESS 0x00008018 -#define MAC_PCU_BCN_RSSI_CTL_OFFSET 0x00008018 -#define MAC_PCU_BCN_RSSI_CTL_RSSI_LOW_THRESH_MSB 7 -#define MAC_PCU_BCN_RSSI_CTL_RSSI_LOW_THRESH_LSB 0 -#define MAC_PCU_BCN_RSSI_CTL_RSSI_LOW_THRESH_MASK 0x000000ff -#define MAC_PCU_BCN_RSSI_CTL_RSSI_LOW_THRESH_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_BCN_RSSI_CTL_RSSI_LOW_THRESH_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_BCN_RSSI_CTL_MISS_THRESH_MSB 15 -#define MAC_PCU_BCN_RSSI_CTL_MISS_THRESH_LSB 8 -#define MAC_PCU_BCN_RSSI_CTL_MISS_THRESH_MASK 0x0000ff00 -#define MAC_PCU_BCN_RSSI_CTL_MISS_THRESH_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_BCN_RSSI_CTL_MISS_THRESH_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_BCN_RSSI_CTL_RSSI_HIGH_THRESH_MSB 23 -#define MAC_PCU_BCN_RSSI_CTL_RSSI_HIGH_THRESH_LSB 16 -#define MAC_PCU_BCN_RSSI_CTL_RSSI_HIGH_THRESH_MASK 0x00ff0000 -#define MAC_PCU_BCN_RSSI_CTL_RSSI_HIGH_THRESH_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_BCN_RSSI_CTL_RSSI_HIGH_THRESH_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_BCN_RSSI_CTL_WEIGHT_MSB 28 -#define MAC_PCU_BCN_RSSI_CTL_WEIGHT_LSB 24 -#define MAC_PCU_BCN_RSSI_CTL_WEIGHT_MASK 0x1f000000 -#define MAC_PCU_BCN_RSSI_CTL_WEIGHT_GET(x) (((x) & 0x1f000000) >> 24) -#define MAC_PCU_BCN_RSSI_CTL_WEIGHT_SET(x) (((x) << 24) & 0x1f000000) -#define MAC_PCU_BCN_RSSI_CTL_RESET_MSB 29 -#define MAC_PCU_BCN_RSSI_CTL_RESET_LSB 29 -#define MAC_PCU_BCN_RSSI_CTL_RESET_MASK 0x20000000 -#define MAC_PCU_BCN_RSSI_CTL_RESET_GET(x) (((x) & 0x20000000) >> 29) -#define MAC_PCU_BCN_RSSI_CTL_RESET_SET(x) (((x) << 29) & 0x20000000) - -/* macros for MAC_PCU_USEC_LATENCY */ -#define MAC_PCU_USEC_LATENCY_ADDRESS 0x0000801c -#define MAC_PCU_USEC_LATENCY_OFFSET 0x0000801c -#define MAC_PCU_USEC_LATENCY_USEC_MSB 7 -#define MAC_PCU_USEC_LATENCY_USEC_LSB 0 -#define MAC_PCU_USEC_LATENCY_USEC_MASK 0x000000ff -#define MAC_PCU_USEC_LATENCY_USEC_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_USEC_LATENCY_USEC_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_USEC_LATENCY_TX_LATENCY_MSB 22 -#define MAC_PCU_USEC_LATENCY_TX_LATENCY_LSB 14 -#define MAC_PCU_USEC_LATENCY_TX_LATENCY_MASK 0x007fc000 -#define MAC_PCU_USEC_LATENCY_TX_LATENCY_GET(x) (((x) & 0x007fc000) >> 14) -#define MAC_PCU_USEC_LATENCY_TX_LATENCY_SET(x) (((x) << 14) & 0x007fc000) -#define MAC_PCU_USEC_LATENCY_RX_LATENCY_MSB 28 -#define MAC_PCU_USEC_LATENCY_RX_LATENCY_LSB 23 -#define MAC_PCU_USEC_LATENCY_RX_LATENCY_MASK 0x1f800000 -#define MAC_PCU_USEC_LATENCY_RX_LATENCY_GET(x) (((x) & 0x1f800000) >> 23) -#define MAC_PCU_USEC_LATENCY_RX_LATENCY_SET(x) (((x) << 23) & 0x1f800000) - -/* macros for MAC_PCU_BCN_RSSI_CTL2 */ -#define MAC_PCU_BCN_RSSI_CTL2_ADDRESS 0x00008020 -#define MAC_PCU_BCN_RSSI_CTL2_OFFSET 0x00008020 -#define MAC_PCU_BCN_RSSI_CTL2_RSSI2_LOW_THRESH_MSB 7 -#define MAC_PCU_BCN_RSSI_CTL2_RSSI2_LOW_THRESH_LSB 0 -#define MAC_PCU_BCN_RSSI_CTL2_RSSI2_LOW_THRESH_MASK 0x000000ff -#define MAC_PCU_BCN_RSSI_CTL2_RSSI2_LOW_THRESH_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_BCN_RSSI_CTL2_RSSI2_LOW_THRESH_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_BCN_RSSI_CTL2_RSSI2_HIGH_THRESH_MSB 23 -#define MAC_PCU_BCN_RSSI_CTL2_RSSI2_HIGH_THRESH_LSB 16 -#define MAC_PCU_BCN_RSSI_CTL2_RSSI2_HIGH_THRESH_MASK 0x00ff0000 -#define MAC_PCU_BCN_RSSI_CTL2_RSSI2_HIGH_THRESH_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_BCN_RSSI_CTL2_RSSI2_HIGH_THRESH_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_BCN_RSSI_CTL2_RESET2_MSB 29 -#define MAC_PCU_BCN_RSSI_CTL2_RESET2_LSB 29 -#define MAC_PCU_BCN_RSSI_CTL2_RESET2_MASK 0x20000000 -#define MAC_PCU_BCN_RSSI_CTL2_RESET2_GET(x) (((x) & 0x20000000) >> 29) -#define MAC_PCU_BCN_RSSI_CTL2_RESET2_SET(x) (((x) << 29) & 0x20000000) - -/* macros for MAC_PCU_BT_WL_1 */ -#define MAC_PCU_BT_WL_1_ADDRESS 0x00008024 -#define MAC_PCU_BT_WL_1_OFFSET 0x00008024 -#define MAC_PCU_BT_WL_1_WEIGHT_MSB 31 -#define MAC_PCU_BT_WL_1_WEIGHT_LSB 0 -#define MAC_PCU_BT_WL_1_WEIGHT_MASK 0xffffffff -#define MAC_PCU_BT_WL_1_WEIGHT_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_BT_WL_1_WEIGHT_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_BT_WL_2 */ -#define MAC_PCU_BT_WL_2_ADDRESS 0x00008028 -#define MAC_PCU_BT_WL_2_OFFSET 0x00008028 -#define MAC_PCU_BT_WL_2_WEIGHT_MSB 31 -#define MAC_PCU_BT_WL_2_WEIGHT_LSB 0 -#define MAC_PCU_BT_WL_2_WEIGHT_MASK 0xffffffff -#define MAC_PCU_BT_WL_2_WEIGHT_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_BT_WL_2_WEIGHT_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_BT_WL_3 */ -#define MAC_PCU_BT_WL_3_ADDRESS 0x0000802c -#define MAC_PCU_BT_WL_3_OFFSET 0x0000802c -#define MAC_PCU_BT_WL_3_WEIGHT_MSB 31 -#define MAC_PCU_BT_WL_3_WEIGHT_LSB 0 -#define MAC_PCU_BT_WL_3_WEIGHT_MASK 0xffffffff -#define MAC_PCU_BT_WL_3_WEIGHT_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_BT_WL_3_WEIGHT_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_BT_WL_4 */ -#define MAC_PCU_BT_WL_4_ADDRESS 0x00008030 -#define MAC_PCU_BT_WL_4_OFFSET 0x00008030 -#define MAC_PCU_BT_WL_4_WEIGHT_MSB 31 -#define MAC_PCU_BT_WL_4_WEIGHT_LSB 0 -#define MAC_PCU_BT_WL_4_WEIGHT_MASK 0xffffffff -#define MAC_PCU_BT_WL_4_WEIGHT_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_BT_WL_4_WEIGHT_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_COEX_EPTA */ -#define MAC_PCU_COEX_EPTA_ADDRESS 0x00008034 -#define MAC_PCU_COEX_EPTA_OFFSET 0x00008034 -#define MAC_PCU_COEX_EPTA_LINKID_MSB 5 -#define MAC_PCU_COEX_EPTA_LINKID_LSB 0 -#define MAC_PCU_COEX_EPTA_LINKID_MASK 0x0000003f -#define MAC_PCU_COEX_EPTA_LINKID_GET(x) (((x) & 0x0000003f) >> 0) -#define MAC_PCU_COEX_EPTA_LINKID_SET(x) (((x) << 0) & 0x0000003f) -#define MAC_PCU_COEX_EPTA_WT_IDX_MSB 12 -#define MAC_PCU_COEX_EPTA_WT_IDX_LSB 6 -#define MAC_PCU_COEX_EPTA_WT_IDX_MASK 0x00001fc0 -#define MAC_PCU_COEX_EPTA_WT_IDX_GET(x) (((x) & 0x00001fc0) >> 6) -#define MAC_PCU_COEX_EPTA_WT_IDX_SET(x) (((x) << 6) & 0x00001fc0) - -/* macros for MAC_PCU_MAX_CFP_DUR */ -#define MAC_PCU_MAX_CFP_DUR_ADDRESS 0x00008038 -#define MAC_PCU_MAX_CFP_DUR_OFFSET 0x00008038 -#define MAC_PCU_MAX_CFP_DUR_VALUE_MSB 15 -#define MAC_PCU_MAX_CFP_DUR_VALUE_LSB 0 -#define MAC_PCU_MAX_CFP_DUR_VALUE_MASK 0x0000ffff -#define MAC_PCU_MAX_CFP_DUR_VALUE_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_MAX_CFP_DUR_VALUE_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_NUMERATOR_MSB 19 -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_NUMERATOR_LSB 16 -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_NUMERATOR_MASK 0x000f0000 -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_NUMERATOR_GET(x) (((x) & 0x000f0000) >> 16) -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_NUMERATOR_SET(x) (((x) << 16) & 0x000f0000) -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_DENOMINATOR_MSB 27 -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_DENOMINATOR_LSB 24 -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_DENOMINATOR_MASK 0x0f000000 -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_DENOMINATOR_GET(x) (((x) & 0x0f000000) >> 24) -#define MAC_PCU_MAX_CFP_DUR_USEC_FRAC_DENOMINATOR_SET(x) (((x) << 24) & 0x0f000000) - -/* macros for MAC_PCU_RX_FILTER */ -#define MAC_PCU_RX_FILTER_ADDRESS 0x0000803c -#define MAC_PCU_RX_FILTER_OFFSET 0x0000803c -#define MAC_PCU_RX_FILTER_UNICAST_MSB 0 -#define MAC_PCU_RX_FILTER_UNICAST_LSB 0 -#define MAC_PCU_RX_FILTER_UNICAST_MASK 0x00000001 -#define MAC_PCU_RX_FILTER_UNICAST_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_RX_FILTER_UNICAST_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_RX_FILTER_MULTICAST_MSB 1 -#define MAC_PCU_RX_FILTER_MULTICAST_LSB 1 -#define MAC_PCU_RX_FILTER_MULTICAST_MASK 0x00000002 -#define MAC_PCU_RX_FILTER_MULTICAST_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_RX_FILTER_MULTICAST_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_RX_FILTER_BROADCAST_MSB 2 -#define MAC_PCU_RX_FILTER_BROADCAST_LSB 2 -#define MAC_PCU_RX_FILTER_BROADCAST_MASK 0x00000004 -#define MAC_PCU_RX_FILTER_BROADCAST_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_RX_FILTER_BROADCAST_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_RX_FILTER_CONTROL_MSB 3 -#define MAC_PCU_RX_FILTER_CONTROL_LSB 3 -#define MAC_PCU_RX_FILTER_CONTROL_MASK 0x00000008 -#define MAC_PCU_RX_FILTER_CONTROL_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_RX_FILTER_CONTROL_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_RX_FILTER_BEACON_MSB 4 -#define MAC_PCU_RX_FILTER_BEACON_LSB 4 -#define MAC_PCU_RX_FILTER_BEACON_MASK 0x00000010 -#define MAC_PCU_RX_FILTER_BEACON_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_PCU_RX_FILTER_BEACON_SET(x) (((x) << 4) & 0x00000010) -#define MAC_PCU_RX_FILTER_PROMISCUOUS_MSB 5 -#define MAC_PCU_RX_FILTER_PROMISCUOUS_LSB 5 -#define MAC_PCU_RX_FILTER_PROMISCUOUS_MASK 0x00000020 -#define MAC_PCU_RX_FILTER_PROMISCUOUS_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_PCU_RX_FILTER_PROMISCUOUS_SET(x) (((x) << 5) & 0x00000020) -#define MAC_PCU_RX_FILTER_XR_POLL_MSB 6 -#define MAC_PCU_RX_FILTER_XR_POLL_LSB 6 -#define MAC_PCU_RX_FILTER_XR_POLL_MASK 0x00000040 -#define MAC_PCU_RX_FILTER_XR_POLL_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_PCU_RX_FILTER_XR_POLL_SET(x) (((x) << 6) & 0x00000040) -#define MAC_PCU_RX_FILTER_PROBE_REQ_MSB 7 -#define MAC_PCU_RX_FILTER_PROBE_REQ_LSB 7 -#define MAC_PCU_RX_FILTER_PROBE_REQ_MASK 0x00000080 -#define MAC_PCU_RX_FILTER_PROBE_REQ_GET(x) (((x) & 0x00000080) >> 7) -#define MAC_PCU_RX_FILTER_PROBE_REQ_SET(x) (((x) << 7) & 0x00000080) -#define MAC_PCU_RX_FILTER_SYNC_FRAME_MSB 8 -#define MAC_PCU_RX_FILTER_SYNC_FRAME_LSB 8 -#define MAC_PCU_RX_FILTER_SYNC_FRAME_MASK 0x00000100 -#define MAC_PCU_RX_FILTER_SYNC_FRAME_GET(x) (((x) & 0x00000100) >> 8) -#define MAC_PCU_RX_FILTER_SYNC_FRAME_SET(x) (((x) << 8) & 0x00000100) -#define MAC_PCU_RX_FILTER_MY_BEACON_MSB 9 -#define MAC_PCU_RX_FILTER_MY_BEACON_LSB 9 -#define MAC_PCU_RX_FILTER_MY_BEACON_MASK 0x00000200 -#define MAC_PCU_RX_FILTER_MY_BEACON_GET(x) (((x) & 0x00000200) >> 9) -#define MAC_PCU_RX_FILTER_MY_BEACON_SET(x) (((x) << 9) & 0x00000200) -#define MAC_PCU_RX_FILTER_COMPRESSED_BAR_MSB 10 -#define MAC_PCU_RX_FILTER_COMPRESSED_BAR_LSB 10 -#define MAC_PCU_RX_FILTER_COMPRESSED_BAR_MASK 0x00000400 -#define MAC_PCU_RX_FILTER_COMPRESSED_BAR_GET(x) (((x) & 0x00000400) >> 10) -#define MAC_PCU_RX_FILTER_COMPRESSED_BAR_SET(x) (((x) << 10) & 0x00000400) -#define MAC_PCU_RX_FILTER_COMPRESSED_BA_MSB 11 -#define MAC_PCU_RX_FILTER_COMPRESSED_BA_LSB 11 -#define MAC_PCU_RX_FILTER_COMPRESSED_BA_MASK 0x00000800 -#define MAC_PCU_RX_FILTER_COMPRESSED_BA_GET(x) (((x) & 0x00000800) >> 11) -#define MAC_PCU_RX_FILTER_COMPRESSED_BA_SET(x) (((x) << 11) & 0x00000800) -#define MAC_PCU_RX_FILTER_UNCOMPRESSED_BA_BAR_MSB 12 -#define MAC_PCU_RX_FILTER_UNCOMPRESSED_BA_BAR_LSB 12 -#define MAC_PCU_RX_FILTER_UNCOMPRESSED_BA_BAR_MASK 0x00001000 -#define MAC_PCU_RX_FILTER_UNCOMPRESSED_BA_BAR_GET(x) (((x) & 0x00001000) >> 12) -#define MAC_PCU_RX_FILTER_UNCOMPRESSED_BA_BAR_SET(x) (((x) << 12) & 0x00001000) -#define MAC_PCU_RX_FILTER_ASSUME_RADAR_MSB 13 -#define MAC_PCU_RX_FILTER_ASSUME_RADAR_LSB 13 -#define MAC_PCU_RX_FILTER_ASSUME_RADAR_MASK 0x00002000 -#define MAC_PCU_RX_FILTER_ASSUME_RADAR_GET(x) (((x) & 0x00002000) >> 13) -#define MAC_PCU_RX_FILTER_ASSUME_RADAR_SET(x) (((x) << 13) & 0x00002000) -#define MAC_PCU_RX_FILTER_PS_POLL_MSB 14 -#define MAC_PCU_RX_FILTER_PS_POLL_LSB 14 -#define MAC_PCU_RX_FILTER_PS_POLL_MASK 0x00004000 -#define MAC_PCU_RX_FILTER_PS_POLL_GET(x) (((x) & 0x00004000) >> 14) -#define MAC_PCU_RX_FILTER_PS_POLL_SET(x) (((x) << 14) & 0x00004000) -#define MAC_PCU_RX_FILTER_MCAST_BCAST_ALL_MSB 15 -#define MAC_PCU_RX_FILTER_MCAST_BCAST_ALL_LSB 15 -#define MAC_PCU_RX_FILTER_MCAST_BCAST_ALL_MASK 0x00008000 -#define MAC_PCU_RX_FILTER_MCAST_BCAST_ALL_GET(x) (((x) & 0x00008000) >> 15) -#define MAC_PCU_RX_FILTER_MCAST_BCAST_ALL_SET(x) (((x) << 15) & 0x00008000) -#define MAC_PCU_RX_FILTER_RST_DLMTR_CNT_DISABLE_MSB 16 -#define MAC_PCU_RX_FILTER_RST_DLMTR_CNT_DISABLE_LSB 16 -#define MAC_PCU_RX_FILTER_RST_DLMTR_CNT_DISABLE_MASK 0x00010000 -#define MAC_PCU_RX_FILTER_RST_DLMTR_CNT_DISABLE_GET(x) (((x) & 0x00010000) >> 16) -#define MAC_PCU_RX_FILTER_RST_DLMTR_CNT_DISABLE_SET(x) (((x) << 16) & 0x00010000) -#define MAC_PCU_RX_FILTER_HW_BCN_PROC_ENABLE_MSB 17 -#define MAC_PCU_RX_FILTER_HW_BCN_PROC_ENABLE_LSB 17 -#define MAC_PCU_RX_FILTER_HW_BCN_PROC_ENABLE_MASK 0x00020000 -#define MAC_PCU_RX_FILTER_HW_BCN_PROC_ENABLE_GET(x) (((x) & 0x00020000) >> 17) -#define MAC_PCU_RX_FILTER_HW_BCN_PROC_ENABLE_SET(x) (((x) << 17) & 0x00020000) -#define MAC_PCU_RX_FILTER_MGMT_ACTION_MCAST_MSB 18 -#define MAC_PCU_RX_FILTER_MGMT_ACTION_MCAST_LSB 18 -#define MAC_PCU_RX_FILTER_MGMT_ACTION_MCAST_MASK 0x00040000 -#define MAC_PCU_RX_FILTER_MGMT_ACTION_MCAST_GET(x) (((x) & 0x00040000) >> 18) -#define MAC_PCU_RX_FILTER_MGMT_ACTION_MCAST_SET(x) (((x) << 18) & 0x00040000) -#define MAC_PCU_RX_FILTER_CONTROL_WRAPPER_MSB 19 -#define MAC_PCU_RX_FILTER_CONTROL_WRAPPER_LSB 19 -#define MAC_PCU_RX_FILTER_CONTROL_WRAPPER_MASK 0x00080000 -#define MAC_PCU_RX_FILTER_CONTROL_WRAPPER_GET(x) (((x) & 0x00080000) >> 19) -#define MAC_PCU_RX_FILTER_CONTROL_WRAPPER_SET(x) (((x) << 19) & 0x00080000) -#define MAC_PCU_RX_FILTER_FROM_TO_DS_MSB 20 -#define MAC_PCU_RX_FILTER_FROM_TO_DS_LSB 20 -#define MAC_PCU_RX_FILTER_FROM_TO_DS_MASK 0x00100000 -#define MAC_PCU_RX_FILTER_FROM_TO_DS_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_PCU_RX_FILTER_FROM_TO_DS_SET(x) (((x) << 20) & 0x00100000) -#define MAC_PCU_RX_FILTER_GENERIC_FTYPE_MSB 26 -#define MAC_PCU_RX_FILTER_GENERIC_FTYPE_LSB 21 -#define MAC_PCU_RX_FILTER_GENERIC_FTYPE_MASK 0x07e00000 -#define MAC_PCU_RX_FILTER_GENERIC_FTYPE_GET(x) (((x) & 0x07e00000) >> 21) -#define MAC_PCU_RX_FILTER_GENERIC_FTYPE_SET(x) (((x) << 21) & 0x07e00000) -#define MAC_PCU_RX_FILTER_GENERIC_FILTER_MSB 28 -#define MAC_PCU_RX_FILTER_GENERIC_FILTER_LSB 27 -#define MAC_PCU_RX_FILTER_GENERIC_FILTER_MASK 0x18000000 -#define MAC_PCU_RX_FILTER_GENERIC_FILTER_GET(x) (((x) & 0x18000000) >> 27) -#define MAC_PCU_RX_FILTER_GENERIC_FILTER_SET(x) (((x) << 27) & 0x18000000) -#define MAC_PCU_RX_FILTER_MY_BEACON2_MSB 29 -#define MAC_PCU_RX_FILTER_MY_BEACON2_LSB 29 -#define MAC_PCU_RX_FILTER_MY_BEACON2_MASK 0x20000000 -#define MAC_PCU_RX_FILTER_MY_BEACON2_GET(x) (((x) & 0x20000000) >> 29) -#define MAC_PCU_RX_FILTER_MY_BEACON2_SET(x) (((x) << 29) & 0x20000000) - -/* macros for MAC_PCU_MCAST_FILTER_L32 */ -#define MAC_PCU_MCAST_FILTER_L32_ADDRESS 0x00008040 -#define MAC_PCU_MCAST_FILTER_L32_OFFSET 0x00008040 -#define MAC_PCU_MCAST_FILTER_L32_VALUE_MSB 31 -#define MAC_PCU_MCAST_FILTER_L32_VALUE_LSB 0 -#define MAC_PCU_MCAST_FILTER_L32_VALUE_MASK 0xffffffff -#define MAC_PCU_MCAST_FILTER_L32_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_MCAST_FILTER_L32_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_MCAST_FILTER_U32 */ -#define MAC_PCU_MCAST_FILTER_U32_ADDRESS 0x00008044 -#define MAC_PCU_MCAST_FILTER_U32_OFFSET 0x00008044 -#define MAC_PCU_MCAST_FILTER_U32_VALUE_MSB 31 -#define MAC_PCU_MCAST_FILTER_U32_VALUE_LSB 0 -#define MAC_PCU_MCAST_FILTER_U32_VALUE_MASK 0xffffffff -#define MAC_PCU_MCAST_FILTER_U32_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_MCAST_FILTER_U32_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_DIAG_SW */ -#define MAC_PCU_DIAG_SW_ADDRESS 0x00008048 -#define MAC_PCU_DIAG_SW_OFFSET 0x00008048 -#define MAC_PCU_DIAG_SW_INVALID_KEY_NO_ACK_MSB 0 -#define MAC_PCU_DIAG_SW_INVALID_KEY_NO_ACK_LSB 0 -#define MAC_PCU_DIAG_SW_INVALID_KEY_NO_ACK_MASK 0x00000001 -#define MAC_PCU_DIAG_SW_INVALID_KEY_NO_ACK_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_DIAG_SW_INVALID_KEY_NO_ACK_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_DIAG_SW_NO_ACK_MSB 1 -#define MAC_PCU_DIAG_SW_NO_ACK_LSB 1 -#define MAC_PCU_DIAG_SW_NO_ACK_MASK 0x00000002 -#define MAC_PCU_DIAG_SW_NO_ACK_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_DIAG_SW_NO_ACK_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_DIAG_SW_NO_CTS_MSB 2 -#define MAC_PCU_DIAG_SW_NO_CTS_LSB 2 -#define MAC_PCU_DIAG_SW_NO_CTS_MASK 0x00000004 -#define MAC_PCU_DIAG_SW_NO_CTS_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_DIAG_SW_NO_CTS_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_DIAG_SW_NO_ENCRYPT_MSB 3 -#define MAC_PCU_DIAG_SW_NO_ENCRYPT_LSB 3 -#define MAC_PCU_DIAG_SW_NO_ENCRYPT_MASK 0x00000008 -#define MAC_PCU_DIAG_SW_NO_ENCRYPT_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_DIAG_SW_NO_ENCRYPT_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_DIAG_SW_NO_DECRYPT_MSB 4 -#define MAC_PCU_DIAG_SW_NO_DECRYPT_LSB 4 -#define MAC_PCU_DIAG_SW_NO_DECRYPT_MASK 0x00000010 -#define MAC_PCU_DIAG_SW_NO_DECRYPT_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_PCU_DIAG_SW_NO_DECRYPT_SET(x) (((x) << 4) & 0x00000010) -#define MAC_PCU_DIAG_SW_HALT_RX_MSB 5 -#define MAC_PCU_DIAG_SW_HALT_RX_LSB 5 -#define MAC_PCU_DIAG_SW_HALT_RX_MASK 0x00000020 -#define MAC_PCU_DIAG_SW_HALT_RX_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_PCU_DIAG_SW_HALT_RX_SET(x) (((x) << 5) & 0x00000020) -#define MAC_PCU_DIAG_SW_LOOP_BACK_MSB 6 -#define MAC_PCU_DIAG_SW_LOOP_BACK_LSB 6 -#define MAC_PCU_DIAG_SW_LOOP_BACK_MASK 0x00000040 -#define MAC_PCU_DIAG_SW_LOOP_BACK_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_PCU_DIAG_SW_LOOP_BACK_SET(x) (((x) << 6) & 0x00000040) -#define MAC_PCU_DIAG_SW_CORRUPT_FCS_MSB 7 -#define MAC_PCU_DIAG_SW_CORRUPT_FCS_LSB 7 -#define MAC_PCU_DIAG_SW_CORRUPT_FCS_MASK 0x00000080 -#define MAC_PCU_DIAG_SW_CORRUPT_FCS_GET(x) (((x) & 0x00000080) >> 7) -#define MAC_PCU_DIAG_SW_CORRUPT_FCS_SET(x) (((x) << 7) & 0x00000080) -#define MAC_PCU_DIAG_SW_DUMP_CHAN_INFO_MSB 8 -#define MAC_PCU_DIAG_SW_DUMP_CHAN_INFO_LSB 8 -#define MAC_PCU_DIAG_SW_DUMP_CHAN_INFO_MASK 0x00000100 -#define MAC_PCU_DIAG_SW_DUMP_CHAN_INFO_GET(x) (((x) & 0x00000100) >> 8) -#define MAC_PCU_DIAG_SW_DUMP_CHAN_INFO_SET(x) (((x) << 8) & 0x00000100) -#define MAC_PCU_DIAG_SW_ACCEPT_NON_V0_MSB 17 -#define MAC_PCU_DIAG_SW_ACCEPT_NON_V0_LSB 17 -#define MAC_PCU_DIAG_SW_ACCEPT_NON_V0_MASK 0x00020000 -#define MAC_PCU_DIAG_SW_ACCEPT_NON_V0_GET(x) (((x) & 0x00020000) >> 17) -#define MAC_PCU_DIAG_SW_ACCEPT_NON_V0_SET(x) (((x) << 17) & 0x00020000) -#define MAC_PCU_DIAG_SW_OBS_SEL_1_0_MSB 19 -#define MAC_PCU_DIAG_SW_OBS_SEL_1_0_LSB 18 -#define MAC_PCU_DIAG_SW_OBS_SEL_1_0_MASK 0x000c0000 -#define MAC_PCU_DIAG_SW_OBS_SEL_1_0_GET(x) (((x) & 0x000c0000) >> 18) -#define MAC_PCU_DIAG_SW_OBS_SEL_1_0_SET(x) (((x) << 18) & 0x000c0000) -#define MAC_PCU_DIAG_SW_RX_CLEAR_HIGH_MSB 20 -#define MAC_PCU_DIAG_SW_RX_CLEAR_HIGH_LSB 20 -#define MAC_PCU_DIAG_SW_RX_CLEAR_HIGH_MASK 0x00100000 -#define MAC_PCU_DIAG_SW_RX_CLEAR_HIGH_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_PCU_DIAG_SW_RX_CLEAR_HIGH_SET(x) (((x) << 20) & 0x00100000) -#define MAC_PCU_DIAG_SW_IGNORE_NAV_MSB 21 -#define MAC_PCU_DIAG_SW_IGNORE_NAV_LSB 21 -#define MAC_PCU_DIAG_SW_IGNORE_NAV_MASK 0x00200000 -#define MAC_PCU_DIAG_SW_IGNORE_NAV_GET(x) (((x) & 0x00200000) >> 21) -#define MAC_PCU_DIAG_SW_IGNORE_NAV_SET(x) (((x) << 21) & 0x00200000) -#define MAC_PCU_DIAG_SW_CHAN_IDLE_HIGH_MSB 22 -#define MAC_PCU_DIAG_SW_CHAN_IDLE_HIGH_LSB 22 -#define MAC_PCU_DIAG_SW_CHAN_IDLE_HIGH_MASK 0x00400000 -#define MAC_PCU_DIAG_SW_CHAN_IDLE_HIGH_GET(x) (((x) & 0x00400000) >> 22) -#define MAC_PCU_DIAG_SW_CHAN_IDLE_HIGH_SET(x) (((x) << 22) & 0x00400000) -#define MAC_PCU_DIAG_SW_PHYERR_ENABLE_EIFS_CTL_MSB 23 -#define MAC_PCU_DIAG_SW_PHYERR_ENABLE_EIFS_CTL_LSB 23 -#define MAC_PCU_DIAG_SW_PHYERR_ENABLE_EIFS_CTL_MASK 0x00800000 -#define MAC_PCU_DIAG_SW_PHYERR_ENABLE_EIFS_CTL_GET(x) (((x) & 0x00800000) >> 23) -#define MAC_PCU_DIAG_SW_PHYERR_ENABLE_EIFS_CTL_SET(x) (((x) << 23) & 0x00800000) -#define MAC_PCU_DIAG_SW_DUAL_CHAIN_CHAN_INFO_MSB 24 -#define MAC_PCU_DIAG_SW_DUAL_CHAIN_CHAN_INFO_LSB 24 -#define MAC_PCU_DIAG_SW_DUAL_CHAIN_CHAN_INFO_MASK 0x01000000 -#define MAC_PCU_DIAG_SW_DUAL_CHAIN_CHAN_INFO_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_PCU_DIAG_SW_DUAL_CHAIN_CHAN_INFO_SET(x) (((x) << 24) & 0x01000000) -#define MAC_PCU_DIAG_SW_FORCE_RX_ABORT_MSB 25 -#define MAC_PCU_DIAG_SW_FORCE_RX_ABORT_LSB 25 -#define MAC_PCU_DIAG_SW_FORCE_RX_ABORT_MASK 0x02000000 -#define MAC_PCU_DIAG_SW_FORCE_RX_ABORT_GET(x) (((x) & 0x02000000) >> 25) -#define MAC_PCU_DIAG_SW_FORCE_RX_ABORT_SET(x) (((x) << 25) & 0x02000000) -#define MAC_PCU_DIAG_SW_SATURATE_CYCLE_CNT_MSB 26 -#define MAC_PCU_DIAG_SW_SATURATE_CYCLE_CNT_LSB 26 -#define MAC_PCU_DIAG_SW_SATURATE_CYCLE_CNT_MASK 0x04000000 -#define MAC_PCU_DIAG_SW_SATURATE_CYCLE_CNT_GET(x) (((x) & 0x04000000) >> 26) -#define MAC_PCU_DIAG_SW_SATURATE_CYCLE_CNT_SET(x) (((x) << 26) & 0x04000000) -#define MAC_PCU_DIAG_SW_OBS_SEL_2_MSB 27 -#define MAC_PCU_DIAG_SW_OBS_SEL_2_LSB 27 -#define MAC_PCU_DIAG_SW_OBS_SEL_2_MASK 0x08000000 -#define MAC_PCU_DIAG_SW_OBS_SEL_2_GET(x) (((x) & 0x08000000) >> 27) -#define MAC_PCU_DIAG_SW_OBS_SEL_2_SET(x) (((x) << 27) & 0x08000000) -#define MAC_PCU_DIAG_SW_RX_CLEAR_CTL_LOW_MSB 28 -#define MAC_PCU_DIAG_SW_RX_CLEAR_CTL_LOW_LSB 28 -#define MAC_PCU_DIAG_SW_RX_CLEAR_CTL_LOW_MASK 0x10000000 -#define MAC_PCU_DIAG_SW_RX_CLEAR_CTL_LOW_GET(x) (((x) & 0x10000000) >> 28) -#define MAC_PCU_DIAG_SW_RX_CLEAR_CTL_LOW_SET(x) (((x) << 28) & 0x10000000) -#define MAC_PCU_DIAG_SW_RX_CLEAR_EXT_LOW_MSB 29 -#define MAC_PCU_DIAG_SW_RX_CLEAR_EXT_LOW_LSB 29 -#define MAC_PCU_DIAG_SW_RX_CLEAR_EXT_LOW_MASK 0x20000000 -#define MAC_PCU_DIAG_SW_RX_CLEAR_EXT_LOW_GET(x) (((x) & 0x20000000) >> 29) -#define MAC_PCU_DIAG_SW_RX_CLEAR_EXT_LOW_SET(x) (((x) << 29) & 0x20000000) -#define MAC_PCU_DIAG_SW_DEBUG_MODE_MSB 31 -#define MAC_PCU_DIAG_SW_DEBUG_MODE_LSB 30 -#define MAC_PCU_DIAG_SW_DEBUG_MODE_MASK 0xc0000000 -#define MAC_PCU_DIAG_SW_DEBUG_MODE_GET(x) (((x) & 0xc0000000) >> 30) -#define MAC_PCU_DIAG_SW_DEBUG_MODE_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for MAC_PCU_TST_ADDAC */ -#define MAC_PCU_TST_ADDAC_ADDRESS 0x00008054 -#define MAC_PCU_TST_ADDAC_OFFSET 0x00008054 -#define MAC_PCU_TST_ADDAC_CONT_TX_MSB 0 -#define MAC_PCU_TST_ADDAC_CONT_TX_LSB 0 -#define MAC_PCU_TST_ADDAC_CONT_TX_MASK 0x00000001 -#define MAC_PCU_TST_ADDAC_CONT_TX_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_TST_ADDAC_CONT_TX_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_TST_ADDAC_TESTMODE_MSB 1 -#define MAC_PCU_TST_ADDAC_TESTMODE_LSB 1 -#define MAC_PCU_TST_ADDAC_TESTMODE_MASK 0x00000002 -#define MAC_PCU_TST_ADDAC_TESTMODE_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_TST_ADDAC_TESTMODE_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_TST_ADDAC_LOOP_MSB 2 -#define MAC_PCU_TST_ADDAC_LOOP_LSB 2 -#define MAC_PCU_TST_ADDAC_LOOP_MASK 0x00000004 -#define MAC_PCU_TST_ADDAC_LOOP_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_TST_ADDAC_LOOP_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_TST_ADDAC_LOOP_LEN_MSB 13 -#define MAC_PCU_TST_ADDAC_LOOP_LEN_LSB 3 -#define MAC_PCU_TST_ADDAC_LOOP_LEN_MASK 0x00003ff8 -#define MAC_PCU_TST_ADDAC_LOOP_LEN_GET(x) (((x) & 0x00003ff8) >> 3) -#define MAC_PCU_TST_ADDAC_LOOP_LEN_SET(x) (((x) << 3) & 0x00003ff8) -#define MAC_PCU_TST_ADDAC_UPPER_8B_MSB 14 -#define MAC_PCU_TST_ADDAC_UPPER_8B_LSB 14 -#define MAC_PCU_TST_ADDAC_UPPER_8B_MASK 0x00004000 -#define MAC_PCU_TST_ADDAC_UPPER_8B_GET(x) (((x) & 0x00004000) >> 14) -#define MAC_PCU_TST_ADDAC_UPPER_8B_SET(x) (((x) << 14) & 0x00004000) -#define MAC_PCU_TST_ADDAC_SAMPLE_SIZE_2K_MSB 15 -#define MAC_PCU_TST_ADDAC_SAMPLE_SIZE_2K_LSB 15 -#define MAC_PCU_TST_ADDAC_SAMPLE_SIZE_2K_MASK 0x00008000 -#define MAC_PCU_TST_ADDAC_SAMPLE_SIZE_2K_GET(x) (((x) & 0x00008000) >> 15) -#define MAC_PCU_TST_ADDAC_SAMPLE_SIZE_2K_SET(x) (((x) << 15) & 0x00008000) -#define MAC_PCU_TST_ADDAC_TRIG_SEL_MSB 16 -#define MAC_PCU_TST_ADDAC_TRIG_SEL_LSB 16 -#define MAC_PCU_TST_ADDAC_TRIG_SEL_MASK 0x00010000 -#define MAC_PCU_TST_ADDAC_TRIG_SEL_GET(x) (((x) & 0x00010000) >> 16) -#define MAC_PCU_TST_ADDAC_TRIG_SEL_SET(x) (((x) << 16) & 0x00010000) -#define MAC_PCU_TST_ADDAC_TRIG_POLARITY_MSB 17 -#define MAC_PCU_TST_ADDAC_TRIG_POLARITY_LSB 17 -#define MAC_PCU_TST_ADDAC_TRIG_POLARITY_MASK 0x00020000 -#define MAC_PCU_TST_ADDAC_TRIG_POLARITY_GET(x) (((x) & 0x00020000) >> 17) -#define MAC_PCU_TST_ADDAC_TRIG_POLARITY_SET(x) (((x) << 17) & 0x00020000) -#define MAC_PCU_TST_ADDAC_CONT_TEST_MSB 18 -#define MAC_PCU_TST_ADDAC_CONT_TEST_LSB 18 -#define MAC_PCU_TST_ADDAC_CONT_TEST_MASK 0x00040000 -#define MAC_PCU_TST_ADDAC_CONT_TEST_GET(x) (((x) & 0x00040000) >> 18) -#define MAC_PCU_TST_ADDAC_TEST_CAPTURE_MSB 19 -#define MAC_PCU_TST_ADDAC_TEST_CAPTURE_LSB 19 -#define MAC_PCU_TST_ADDAC_TEST_CAPTURE_MASK 0x00080000 -#define MAC_PCU_TST_ADDAC_TEST_CAPTURE_GET(x) (((x) & 0x00080000) >> 19) -#define MAC_PCU_TST_ADDAC_TEST_CAPTURE_SET(x) (((x) << 19) & 0x00080000) -#define MAC_PCU_TST_ADDAC_TEST_ARM_MSB 20 -#define MAC_PCU_TST_ADDAC_TEST_ARM_LSB 20 -#define MAC_PCU_TST_ADDAC_TEST_ARM_MASK 0x00100000 -#define MAC_PCU_TST_ADDAC_TEST_ARM_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_PCU_TST_ADDAC_TEST_ARM_SET(x) (((x) << 20) & 0x00100000) - -/* macros for MAC_PCU_DEF_ANTENNA */ -#define MAC_PCU_DEF_ANTENNA_ADDRESS 0x00008058 -#define MAC_PCU_DEF_ANTENNA_OFFSET 0x00008058 -#define MAC_PCU_DEF_ANTENNA_VALUE_MSB 23 -#define MAC_PCU_DEF_ANTENNA_VALUE_LSB 0 -#define MAC_PCU_DEF_ANTENNA_VALUE_MASK 0x00ffffff -#define MAC_PCU_DEF_ANTENNA_VALUE_GET(x) (((x) & 0x00ffffff) >> 0) -#define MAC_PCU_DEF_ANTENNA_VALUE_SET(x) (((x) << 0) & 0x00ffffff) -#define MAC_PCU_DEF_ANTENNA_TX_DEF_ANT_SEL_MSB 24 -#define MAC_PCU_DEF_ANTENNA_TX_DEF_ANT_SEL_LSB 24 -#define MAC_PCU_DEF_ANTENNA_TX_DEF_ANT_SEL_MASK 0x01000000 -#define MAC_PCU_DEF_ANTENNA_TX_DEF_ANT_SEL_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_PCU_DEF_ANTENNA_TX_DEF_ANT_SEL_SET(x) (((x) << 24) & 0x01000000) -#define MAC_PCU_DEF_ANTENNA_SLOW_TX_ANT_EN_MSB 25 -#define MAC_PCU_DEF_ANTENNA_SLOW_TX_ANT_EN_LSB 25 -#define MAC_PCU_DEF_ANTENNA_SLOW_TX_ANT_EN_MASK 0x02000000 -#define MAC_PCU_DEF_ANTENNA_SLOW_TX_ANT_EN_GET(x) (((x) & 0x02000000) >> 25) -#define MAC_PCU_DEF_ANTENNA_SLOW_TX_ANT_EN_SET(x) (((x) << 25) & 0x02000000) -#define MAC_PCU_DEF_ANTENNA_TX_CUR_ANT_MSB 26 -#define MAC_PCU_DEF_ANTENNA_TX_CUR_ANT_LSB 26 -#define MAC_PCU_DEF_ANTENNA_TX_CUR_ANT_MASK 0x04000000 -#define MAC_PCU_DEF_ANTENNA_TX_CUR_ANT_GET(x) (((x) & 0x04000000) >> 26) -#define MAC_PCU_DEF_ANTENNA_TX_CUR_ANT_SET(x) (((x) << 26) & 0x04000000) -#define MAC_PCU_DEF_ANTENNA_FAST_DEF_ANT_MSB 27 -#define MAC_PCU_DEF_ANTENNA_FAST_DEF_ANT_LSB 27 -#define MAC_PCU_DEF_ANTENNA_FAST_DEF_ANT_MASK 0x08000000 -#define MAC_PCU_DEF_ANTENNA_FAST_DEF_ANT_GET(x) (((x) & 0x08000000) >> 27) -#define MAC_PCU_DEF_ANTENNA_FAST_DEF_ANT_SET(x) (((x) << 27) & 0x08000000) -#define MAC_PCU_DEF_ANTENNA_RX_LNA_CONFIG_SEL_MSB 28 -#define MAC_PCU_DEF_ANTENNA_RX_LNA_CONFIG_SEL_LSB 28 -#define MAC_PCU_DEF_ANTENNA_RX_LNA_CONFIG_SEL_MASK 0x10000000 -#define MAC_PCU_DEF_ANTENNA_RX_LNA_CONFIG_SEL_GET(x) (((x) & 0x10000000) >> 28) -#define MAC_PCU_DEF_ANTENNA_RX_LNA_CONFIG_SEL_SET(x) (((x) << 28) & 0x10000000) -#define MAC_PCU_DEF_ANTENNA_FAST_TX_ANT_EN_MSB 29 -#define MAC_PCU_DEF_ANTENNA_FAST_TX_ANT_EN_LSB 29 -#define MAC_PCU_DEF_ANTENNA_FAST_TX_ANT_EN_MASK 0x20000000 -#define MAC_PCU_DEF_ANTENNA_FAST_TX_ANT_EN_GET(x) (((x) & 0x20000000) >> 29) -#define MAC_PCU_DEF_ANTENNA_FAST_TX_ANT_EN_SET(x) (((x) << 29) & 0x20000000) -#define MAC_PCU_DEF_ANTENNA_RX_ANT_EN_MSB 30 -#define MAC_PCU_DEF_ANTENNA_RX_ANT_EN_LSB 30 -#define MAC_PCU_DEF_ANTENNA_RX_ANT_EN_MASK 0x40000000 -#define MAC_PCU_DEF_ANTENNA_RX_ANT_EN_GET(x) (((x) & 0x40000000) >> 30) -#define MAC_PCU_DEF_ANTENNA_RX_ANT_EN_SET(x) (((x) << 30) & 0x40000000) -#define MAC_PCU_DEF_ANTENNA_RX_ANT_DIV_ON_MSB 31 -#define MAC_PCU_DEF_ANTENNA_RX_ANT_DIV_ON_LSB 31 -#define MAC_PCU_DEF_ANTENNA_RX_ANT_DIV_ON_MASK 0x80000000 -#define MAC_PCU_DEF_ANTENNA_RX_ANT_DIV_ON_GET(x) (((x) & 0x80000000) >> 31) -#define MAC_PCU_DEF_ANTENNA_RX_ANT_DIV_ON_SET(x) (((x) << 31) & 0x80000000) - -/* macros for MAC_PCU_AES_MUTE_MASK_0 */ -#define MAC_PCU_AES_MUTE_MASK_0_ADDRESS 0x0000805c -#define MAC_PCU_AES_MUTE_MASK_0_OFFSET 0x0000805c -#define MAC_PCU_AES_MUTE_MASK_0_FC_MSB 15 -#define MAC_PCU_AES_MUTE_MASK_0_FC_LSB 0 -#define MAC_PCU_AES_MUTE_MASK_0_FC_MASK 0x0000ffff -#define MAC_PCU_AES_MUTE_MASK_0_FC_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_AES_MUTE_MASK_0_FC_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_PCU_AES_MUTE_MASK_0_QOS_MSB 31 -#define MAC_PCU_AES_MUTE_MASK_0_QOS_LSB 16 -#define MAC_PCU_AES_MUTE_MASK_0_QOS_MASK 0xffff0000 -#define MAC_PCU_AES_MUTE_MASK_0_QOS_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_PCU_AES_MUTE_MASK_0_QOS_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_PCU_AES_MUTE_MASK_1 */ -#define MAC_PCU_AES_MUTE_MASK_1_ADDRESS 0x00008060 -#define MAC_PCU_AES_MUTE_MASK_1_OFFSET 0x00008060 -#define MAC_PCU_AES_MUTE_MASK_1_SEQ_MSB 15 -#define MAC_PCU_AES_MUTE_MASK_1_SEQ_LSB 0 -#define MAC_PCU_AES_MUTE_MASK_1_SEQ_MASK 0x0000ffff -#define MAC_PCU_AES_MUTE_MASK_1_SEQ_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_AES_MUTE_MASK_1_SEQ_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_PCU_AES_MUTE_MASK_1_FC_MGMT_MSB 31 -#define MAC_PCU_AES_MUTE_MASK_1_FC_MGMT_LSB 16 -#define MAC_PCU_AES_MUTE_MASK_1_FC_MGMT_MASK 0xffff0000 -#define MAC_PCU_AES_MUTE_MASK_1_FC_MGMT_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_PCU_AES_MUTE_MASK_1_FC_MGMT_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_PCU_GATED_CLKS */ -#define MAC_PCU_GATED_CLKS_ADDRESS 0x00008064 -#define MAC_PCU_GATED_CLKS_OFFSET 0x00008064 -#define MAC_PCU_GATED_CLKS_GATED_TX_MSB 1 -#define MAC_PCU_GATED_CLKS_GATED_TX_LSB 1 -#define MAC_PCU_GATED_CLKS_GATED_TX_MASK 0x00000002 -#define MAC_PCU_GATED_CLKS_GATED_TX_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_GATED_CLKS_GATED_TX_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_GATED_CLKS_GATED_RX_MSB 2 -#define MAC_PCU_GATED_CLKS_GATED_RX_LSB 2 -#define MAC_PCU_GATED_CLKS_GATED_RX_MASK 0x00000004 -#define MAC_PCU_GATED_CLKS_GATED_RX_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_GATED_CLKS_GATED_RX_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_GATED_CLKS_GATED_REG_MSB 3 -#define MAC_PCU_GATED_CLKS_GATED_REG_LSB 3 -#define MAC_PCU_GATED_CLKS_GATED_REG_MASK 0x00000008 -#define MAC_PCU_GATED_CLKS_GATED_REG_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_GATED_CLKS_GATED_REG_SET(x) (((x) << 3) & 0x00000008) - -/* macros for MAC_PCU_OBS_BUS_2 */ -#define MAC_PCU_OBS_BUS_2_ADDRESS 0x00008068 -#define MAC_PCU_OBS_BUS_2_OFFSET 0x00008068 -#define MAC_PCU_OBS_BUS_2_VALUE_MSB 17 -#define MAC_PCU_OBS_BUS_2_VALUE_LSB 0 -#define MAC_PCU_OBS_BUS_2_VALUE_MASK 0x0003ffff -#define MAC_PCU_OBS_BUS_2_VALUE_GET(x) (((x) & 0x0003ffff) >> 0) -#define MAC_PCU_OBS_BUS_2_WCF_STATE_MSB 21 -#define MAC_PCU_OBS_BUS_2_WCF_STATE_LSB 18 -#define MAC_PCU_OBS_BUS_2_WCF_STATE_MASK 0x003c0000 -#define MAC_PCU_OBS_BUS_2_WCF_STATE_GET(x) (((x) & 0x003c0000) >> 18) -#define MAC_PCU_OBS_BUS_2_WCF0_FULL_MSB 22 -#define MAC_PCU_OBS_BUS_2_WCF0_FULL_LSB 22 -#define MAC_PCU_OBS_BUS_2_WCF0_FULL_MASK 0x00400000 -#define MAC_PCU_OBS_BUS_2_WCF0_FULL_GET(x) (((x) & 0x00400000) >> 22) -#define MAC_PCU_OBS_BUS_2_WCF1_FULL_MSB 23 -#define MAC_PCU_OBS_BUS_2_WCF1_FULL_LSB 23 -#define MAC_PCU_OBS_BUS_2_WCF1_FULL_MASK 0x00800000 -#define MAC_PCU_OBS_BUS_2_WCF1_FULL_GET(x) (((x) & 0x00800000) >> 23) -#define MAC_PCU_OBS_BUS_2_WCF_COUNT_MSB 28 -#define MAC_PCU_OBS_BUS_2_WCF_COUNT_LSB 24 -#define MAC_PCU_OBS_BUS_2_WCF_COUNT_MASK 0x1f000000 -#define MAC_PCU_OBS_BUS_2_WCF_COUNT_GET(x) (((x) & 0x1f000000) >> 24) -#define MAC_PCU_OBS_BUS_2_MACBB_ALL_AWAKE_MSB 29 -#define MAC_PCU_OBS_BUS_2_MACBB_ALL_AWAKE_LSB 29 -#define MAC_PCU_OBS_BUS_2_MACBB_ALL_AWAKE_MASK 0x20000000 -#define MAC_PCU_OBS_BUS_2_MACBB_ALL_AWAKE_GET(x) (((x) & 0x20000000) >> 29) - -/* macros for MAC_PCU_OBS_BUS_1 */ -#define MAC_PCU_OBS_BUS_1_ADDRESS 0x0000806c -#define MAC_PCU_OBS_BUS_1_OFFSET 0x0000806c -#define MAC_PCU_OBS_BUS_1_PCU_DIRECTED_MSB 0 -#define MAC_PCU_OBS_BUS_1_PCU_DIRECTED_LSB 0 -#define MAC_PCU_OBS_BUS_1_PCU_DIRECTED_MASK 0x00000001 -#define MAC_PCU_OBS_BUS_1_PCU_DIRECTED_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_OBS_BUS_1_PCU_RX_END_MSB 1 -#define MAC_PCU_OBS_BUS_1_PCU_RX_END_LSB 1 -#define MAC_PCU_OBS_BUS_1_PCU_RX_END_MASK 0x00000002 -#define MAC_PCU_OBS_BUS_1_PCU_RX_END_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_OBS_BUS_1_RX_WEP_MSB 2 -#define MAC_PCU_OBS_BUS_1_RX_WEP_LSB 2 -#define MAC_PCU_OBS_BUS_1_RX_WEP_MASK 0x00000004 -#define MAC_PCU_OBS_BUS_1_RX_WEP_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_OBS_BUS_1_RX_MY_BEACON_MSB 3 -#define MAC_PCU_OBS_BUS_1_RX_MY_BEACON_LSB 3 -#define MAC_PCU_OBS_BUS_1_RX_MY_BEACON_MASK 0x00000008 -#define MAC_PCU_OBS_BUS_1_RX_MY_BEACON_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_OBS_BUS_1_FILTER_PASS_MSB 4 -#define MAC_PCU_OBS_BUS_1_FILTER_PASS_LSB 4 -#define MAC_PCU_OBS_BUS_1_FILTER_PASS_MASK 0x00000010 -#define MAC_PCU_OBS_BUS_1_FILTER_PASS_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_PCU_OBS_BUS_1_TX_HCF_MSB 5 -#define MAC_PCU_OBS_BUS_1_TX_HCF_LSB 5 -#define MAC_PCU_OBS_BUS_1_TX_HCF_MASK 0x00000020 -#define MAC_PCU_OBS_BUS_1_TX_HCF_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_PCU_OBS_BUS_1_TM_QUIET_TIME_MSB 6 -#define MAC_PCU_OBS_BUS_1_TM_QUIET_TIME_LSB 6 -#define MAC_PCU_OBS_BUS_1_TM_QUIET_TIME_MASK 0x00000040 -#define MAC_PCU_OBS_BUS_1_TM_QUIET_TIME_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_PCU_OBS_BUS_1_PCU_CHANNEL_IDLE_MSB 7 -#define MAC_PCU_OBS_BUS_1_PCU_CHANNEL_IDLE_LSB 7 -#define MAC_PCU_OBS_BUS_1_PCU_CHANNEL_IDLE_MASK 0x00000080 -#define MAC_PCU_OBS_BUS_1_PCU_CHANNEL_IDLE_GET(x) (((x) & 0x00000080) >> 7) -#define MAC_PCU_OBS_BUS_1_TX_HOLD_MSB 8 -#define MAC_PCU_OBS_BUS_1_TX_HOLD_LSB 8 -#define MAC_PCU_OBS_BUS_1_TX_HOLD_MASK 0x00000100 -#define MAC_PCU_OBS_BUS_1_TX_HOLD_GET(x) (((x) & 0x00000100) >> 8) -#define MAC_PCU_OBS_BUS_1_TX_FRAME_MSB 9 -#define MAC_PCU_OBS_BUS_1_TX_FRAME_LSB 9 -#define MAC_PCU_OBS_BUS_1_TX_FRAME_MASK 0x00000200 -#define MAC_PCU_OBS_BUS_1_TX_FRAME_GET(x) (((x) & 0x00000200) >> 9) -#define MAC_PCU_OBS_BUS_1_RX_FRAME_MSB 10 -#define MAC_PCU_OBS_BUS_1_RX_FRAME_LSB 10 -#define MAC_PCU_OBS_BUS_1_RX_FRAME_MASK 0x00000400 -#define MAC_PCU_OBS_BUS_1_RX_FRAME_GET(x) (((x) & 0x00000400) >> 10) -#define MAC_PCU_OBS_BUS_1_RX_CLEAR_MSB 11 -#define MAC_PCU_OBS_BUS_1_RX_CLEAR_LSB 11 -#define MAC_PCU_OBS_BUS_1_RX_CLEAR_MASK 0x00000800 -#define MAC_PCU_OBS_BUS_1_RX_CLEAR_GET(x) (((x) & 0x00000800) >> 11) -#define MAC_PCU_OBS_BUS_1_WEP_STATE_MSB 17 -#define MAC_PCU_OBS_BUS_1_WEP_STATE_LSB 12 -#define MAC_PCU_OBS_BUS_1_WEP_STATE_MASK 0x0003f000 -#define MAC_PCU_OBS_BUS_1_WEP_STATE_GET(x) (((x) & 0x0003f000) >> 12) -#define MAC_PCU_OBS_BUS_1_RX_STATE_MSB 24 -#define MAC_PCU_OBS_BUS_1_RX_STATE_LSB 20 -#define MAC_PCU_OBS_BUS_1_RX_STATE_MASK 0x01f00000 -#define MAC_PCU_OBS_BUS_1_RX_STATE_GET(x) (((x) & 0x01f00000) >> 20) -#define MAC_PCU_OBS_BUS_1_TX_STATE_MSB 30 -#define MAC_PCU_OBS_BUS_1_TX_STATE_LSB 25 -#define MAC_PCU_OBS_BUS_1_TX_STATE_MASK 0x7e000000 -#define MAC_PCU_OBS_BUS_1_TX_STATE_GET(x) (((x) & 0x7e000000) >> 25) - -/* macros for MAC_PCU_DYM_MIMO_PWR_SAVE */ -#define MAC_PCU_DYM_MIMO_PWR_SAVE_ADDRESS 0x00008070 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_OFFSET 0x00008070 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_USE_MAC_CTRL_MSB 0 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_USE_MAC_CTRL_LSB 0 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_USE_MAC_CTRL_MASK 0x00000001 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_USE_MAC_CTRL_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_USE_MAC_CTRL_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HW_CTRL_EN_MSB 1 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HW_CTRL_EN_LSB 1 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HW_CTRL_EN_MASK 0x00000002 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HW_CTRL_EN_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HW_CTRL_EN_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_SW_CHAIN_MASK_SEL_MSB 2 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_SW_CHAIN_MASK_SEL_LSB 2 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_SW_CHAIN_MASK_SEL_MASK 0x00000004 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_SW_CHAIN_MASK_SEL_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_SW_CHAIN_MASK_SEL_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_LOW_PWR_CHAIN_MASK_MSB 6 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_LOW_PWR_CHAIN_MASK_LSB 4 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_LOW_PWR_CHAIN_MASK_MASK 0x00000070 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_LOW_PWR_CHAIN_MASK_GET(x) (((x) & 0x00000070) >> 4) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_LOW_PWR_CHAIN_MASK_SET(x) (((x) << 4) & 0x00000070) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HI_PWR_CHAIN_MASK_MSB 10 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HI_PWR_CHAIN_MASK_LSB 8 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HI_PWR_CHAIN_MASK_MASK 0x00000700 -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HI_PWR_CHAIN_MASK_GET(x) (((x) & 0x00000700) >> 8) -#define MAC_PCU_DYM_MIMO_PWR_SAVE_HI_PWR_CHAIN_MASK_SET(x) (((x) << 8) & 0x00000700) - -/* macros for MAC_PCU_LAST_BEACON_TSF */ -#define MAC_PCU_LAST_BEACON_TSF_ADDRESS 0x00008080 -#define MAC_PCU_LAST_BEACON_TSF_OFFSET 0x00008080 -#define MAC_PCU_LAST_BEACON_TSF_VALUE_MSB 31 -#define MAC_PCU_LAST_BEACON_TSF_VALUE_LSB 0 -#define MAC_PCU_LAST_BEACON_TSF_VALUE_MASK 0xffffffff -#define MAC_PCU_LAST_BEACON_TSF_VALUE_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_PCU_NAV */ -#define MAC_PCU_NAV_ADDRESS 0x00008084 -#define MAC_PCU_NAV_OFFSET 0x00008084 -#define MAC_PCU_NAV_VALUE_MSB 25 -#define MAC_PCU_NAV_VALUE_LSB 0 -#define MAC_PCU_NAV_VALUE_MASK 0x03ffffff -#define MAC_PCU_NAV_VALUE_GET(x) (((x) & 0x03ffffff) >> 0) -#define MAC_PCU_NAV_VALUE_SET(x) (((x) << 0) & 0x03ffffff) - -/* macros for MAC_PCU_RTS_SUCCESS_CNT */ -#define MAC_PCU_RTS_SUCCESS_CNT_ADDRESS 0x00008088 -#define MAC_PCU_RTS_SUCCESS_CNT_OFFSET 0x00008088 -#define MAC_PCU_RTS_SUCCESS_CNT_VALUE_MSB 15 -#define MAC_PCU_RTS_SUCCESS_CNT_VALUE_LSB 0 -#define MAC_PCU_RTS_SUCCESS_CNT_VALUE_MASK 0x0000ffff -#define MAC_PCU_RTS_SUCCESS_CNT_VALUE_GET(x) (((x) & 0x0000ffff) >> 0) - -/* macros for MAC_PCU_RTS_FAIL_CNT */ -#define MAC_PCU_RTS_FAIL_CNT_ADDRESS 0x0000808c -#define MAC_PCU_RTS_FAIL_CNT_OFFSET 0x0000808c -#define MAC_PCU_RTS_FAIL_CNT_VALUE_MSB 15 -#define MAC_PCU_RTS_FAIL_CNT_VALUE_LSB 0 -#define MAC_PCU_RTS_FAIL_CNT_VALUE_MASK 0x0000ffff -#define MAC_PCU_RTS_FAIL_CNT_VALUE_GET(x) (((x) & 0x0000ffff) >> 0) - -/* macros for MAC_PCU_ACK_FAIL_CNT */ -#define MAC_PCU_ACK_FAIL_CNT_ADDRESS 0x00008090 -#define MAC_PCU_ACK_FAIL_CNT_OFFSET 0x00008090 -#define MAC_PCU_ACK_FAIL_CNT_VALUE_MSB 15 -#define MAC_PCU_ACK_FAIL_CNT_VALUE_LSB 0 -#define MAC_PCU_ACK_FAIL_CNT_VALUE_MASK 0x0000ffff -#define MAC_PCU_ACK_FAIL_CNT_VALUE_GET(x) (((x) & 0x0000ffff) >> 0) - -/* macros for MAC_PCU_FCS_FAIL_CNT */ -#define MAC_PCU_FCS_FAIL_CNT_ADDRESS 0x00008094 -#define MAC_PCU_FCS_FAIL_CNT_OFFSET 0x00008094 -#define MAC_PCU_FCS_FAIL_CNT_VALUE_MSB 15 -#define MAC_PCU_FCS_FAIL_CNT_VALUE_LSB 0 -#define MAC_PCU_FCS_FAIL_CNT_VALUE_MASK 0x0000ffff -#define MAC_PCU_FCS_FAIL_CNT_VALUE_GET(x) (((x) & 0x0000ffff) >> 0) - -/* macros for MAC_PCU_BEACON_CNT */ -#define MAC_PCU_BEACON_CNT_ADDRESS 0x00008098 -#define MAC_PCU_BEACON_CNT_OFFSET 0x00008098 -#define MAC_PCU_BEACON_CNT_VALUE_MSB 15 -#define MAC_PCU_BEACON_CNT_VALUE_LSB 0 -#define MAC_PCU_BEACON_CNT_VALUE_MASK 0x0000ffff -#define MAC_PCU_BEACON_CNT_VALUE_GET(x) (((x) & 0x0000ffff) >> 0) - -/* macros for MAC_PCU_BEACON2_CNT */ -#define MAC_PCU_BEACON2_CNT_ADDRESS 0x0000809c -#define MAC_PCU_BEACON2_CNT_OFFSET 0x0000809c -#define MAC_PCU_BEACON2_CNT_VALUE_MSB 15 -#define MAC_PCU_BEACON2_CNT_VALUE_LSB 0 -#define MAC_PCU_BEACON2_CNT_VALUE_MASK 0x0000ffff -#define MAC_PCU_BEACON2_CNT_VALUE_GET(x) (((x) & 0x0000ffff) >> 0) - -/* macros for MAC_PCU_BASIC_SET */ -#define MAC_PCU_BASIC_SET_ADDRESS 0x000080a0 -#define MAC_PCU_BASIC_SET_OFFSET 0x000080a0 -#define MAC_PCU_BASIC_SET_MCS_MSB 31 -#define MAC_PCU_BASIC_SET_MCS_LSB 0 -#define MAC_PCU_BASIC_SET_MCS_MASK 0xffffffff -#define MAC_PCU_BASIC_SET_MCS_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_BASIC_SET_MCS_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_MGMT_SEQ */ -#define MAC_PCU_MGMT_SEQ_ADDRESS 0x000080a4 -#define MAC_PCU_MGMT_SEQ_OFFSET 0x000080a4 -#define MAC_PCU_MGMT_SEQ_MIN_MSB 11 -#define MAC_PCU_MGMT_SEQ_MIN_LSB 0 -#define MAC_PCU_MGMT_SEQ_MIN_MASK 0x00000fff -#define MAC_PCU_MGMT_SEQ_MIN_GET(x) (((x) & 0x00000fff) >> 0) -#define MAC_PCU_MGMT_SEQ_MIN_SET(x) (((x) << 0) & 0x00000fff) -#define MAC_PCU_MGMT_SEQ_MAX_MSB 27 -#define MAC_PCU_MGMT_SEQ_MAX_LSB 16 -#define MAC_PCU_MGMT_SEQ_MAX_MASK 0x0fff0000 -#define MAC_PCU_MGMT_SEQ_MAX_GET(x) (((x) & 0x0fff0000) >> 16) -#define MAC_PCU_MGMT_SEQ_MAX_SET(x) (((x) << 16) & 0x0fff0000) - -/* macros for MAC_PCU_BF_RPT1 */ -#define MAC_PCU_BF_RPT1_ADDRESS 0x000080a8 -#define MAC_PCU_BF_RPT1_OFFSET 0x000080a8 -#define MAC_PCU_BF_RPT1_V_ACTION_VALUE_MSB 7 -#define MAC_PCU_BF_RPT1_V_ACTION_VALUE_LSB 0 -#define MAC_PCU_BF_RPT1_V_ACTION_VALUE_MASK 0x000000ff -#define MAC_PCU_BF_RPT1_V_ACTION_VALUE_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_BF_RPT1_V_ACTION_VALUE_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_BF_RPT1_CV_ACTION_VALUE_MSB 15 -#define MAC_PCU_BF_RPT1_CV_ACTION_VALUE_LSB 8 -#define MAC_PCU_BF_RPT1_CV_ACTION_VALUE_MASK 0x0000ff00 -#define MAC_PCU_BF_RPT1_CV_ACTION_VALUE_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_BF_RPT1_CV_ACTION_VALUE_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_BF_RPT1_CATEGORY_VALUE_MSB 23 -#define MAC_PCU_BF_RPT1_CATEGORY_VALUE_LSB 16 -#define MAC_PCU_BF_RPT1_CATEGORY_VALUE_MASK 0x00ff0000 -#define MAC_PCU_BF_RPT1_CATEGORY_VALUE_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_BF_RPT1_CATEGORY_VALUE_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_BF_RPT1_FRAME_SUBTYPE_VALUE_MSB 27 -#define MAC_PCU_BF_RPT1_FRAME_SUBTYPE_VALUE_LSB 24 -#define MAC_PCU_BF_RPT1_FRAME_SUBTYPE_VALUE_MASK 0x0f000000 -#define MAC_PCU_BF_RPT1_FRAME_SUBTYPE_VALUE_GET(x) (((x) & 0x0f000000) >> 24) -#define MAC_PCU_BF_RPT1_FRAME_SUBTYPE_VALUE_SET(x) (((x) << 24) & 0x0f000000) -#define MAC_PCU_BF_RPT1_FRAME_TYPE_VALUE_MSB 29 -#define MAC_PCU_BF_RPT1_FRAME_TYPE_VALUE_LSB 28 -#define MAC_PCU_BF_RPT1_FRAME_TYPE_VALUE_MASK 0x30000000 -#define MAC_PCU_BF_RPT1_FRAME_TYPE_VALUE_GET(x) (((x) & 0x30000000) >> 28) -#define MAC_PCU_BF_RPT1_FRAME_TYPE_VALUE_SET(x) (((x) << 28) & 0x30000000) - -/* macros for MAC_PCU_BF_RPT2 */ -#define MAC_PCU_BF_RPT2_ADDRESS 0x000080ac -#define MAC_PCU_BF_RPT2_OFFSET 0x000080ac -#define MAC_PCU_BF_RPT2_FRAME_SUBTYPE_VALUE_MSB 3 -#define MAC_PCU_BF_RPT2_FRAME_SUBTYPE_VALUE_LSB 0 -#define MAC_PCU_BF_RPT2_FRAME_SUBTYPE_VALUE_MASK 0x0000000f -#define MAC_PCU_BF_RPT2_FRAME_SUBTYPE_VALUE_GET(x) (((x) & 0x0000000f) >> 0) -#define MAC_PCU_BF_RPT2_FRAME_SUBTYPE_VALUE_SET(x) (((x) << 0) & 0x0000000f) - -/* macros for MAC_PCU_TX_ANT_1 */ -#define MAC_PCU_TX_ANT_1_ADDRESS 0x000080b0 -#define MAC_PCU_TX_ANT_1_OFFSET 0x000080b0 -#define MAC_PCU_TX_ANT_1_VALUE_MSB 31 -#define MAC_PCU_TX_ANT_1_VALUE_LSB 0 -#define MAC_PCU_TX_ANT_1_VALUE_MASK 0xffffffff -#define MAC_PCU_TX_ANT_1_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_TX_ANT_1_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_TX_ANT_2 */ -#define MAC_PCU_TX_ANT_2_ADDRESS 0x000080b4 -#define MAC_PCU_TX_ANT_2_OFFSET 0x000080b4 -#define MAC_PCU_TX_ANT_2_VALUE_MSB 31 -#define MAC_PCU_TX_ANT_2_VALUE_LSB 0 -#define MAC_PCU_TX_ANT_2_VALUE_MASK 0xffffffff -#define MAC_PCU_TX_ANT_2_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_TX_ANT_2_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_TX_ANT_3 */ -#define MAC_PCU_TX_ANT_3_ADDRESS 0x000080b8 -#define MAC_PCU_TX_ANT_3_OFFSET 0x000080b8 -#define MAC_PCU_TX_ANT_3_VALUE_MSB 31 -#define MAC_PCU_TX_ANT_3_VALUE_LSB 0 -#define MAC_PCU_TX_ANT_3_VALUE_MASK 0xffffffff -#define MAC_PCU_TX_ANT_3_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_TX_ANT_3_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_TX_ANT_4 */ -#define MAC_PCU_TX_ANT_4_ADDRESS 0x000080bc -#define MAC_PCU_TX_ANT_4_OFFSET 0x000080bc -#define MAC_PCU_TX_ANT_4_VALUE_MSB 31 -#define MAC_PCU_TX_ANT_4_VALUE_LSB 0 -#define MAC_PCU_TX_ANT_4_VALUE_MASK 0xffffffff -#define MAC_PCU_TX_ANT_4_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_TX_ANT_4_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_XRMODE */ -#define MAC_PCU_XRMODE_ADDRESS 0x000080c0 -#define MAC_PCU_XRMODE_OFFSET 0x000080c0 -#define MAC_PCU_XRMODE_POLL_TYPE_MSB 5 -#define MAC_PCU_XRMODE_POLL_TYPE_LSB 0 -#define MAC_PCU_XRMODE_POLL_TYPE_MASK 0x0000003f -#define MAC_PCU_XRMODE_POLL_TYPE_GET(x) (((x) & 0x0000003f) >> 0) -#define MAC_PCU_XRMODE_POLL_TYPE_SET(x) (((x) << 0) & 0x0000003f) -#define MAC_PCU_XRMODE_WAIT_FOR_POLL_MSB 7 -#define MAC_PCU_XRMODE_WAIT_FOR_POLL_LSB 7 -#define MAC_PCU_XRMODE_WAIT_FOR_POLL_MASK 0x00000080 -#define MAC_PCU_XRMODE_WAIT_FOR_POLL_GET(x) (((x) & 0x00000080) >> 7) -#define MAC_PCU_XRMODE_WAIT_FOR_POLL_SET(x) (((x) << 7) & 0x00000080) -#define MAC_PCU_XRMODE_FRAME_HOLD_MSB 31 -#define MAC_PCU_XRMODE_FRAME_HOLD_LSB 20 -#define MAC_PCU_XRMODE_FRAME_HOLD_MASK 0xfff00000 -#define MAC_PCU_XRMODE_FRAME_HOLD_GET(x) (((x) & 0xfff00000) >> 20) -#define MAC_PCU_XRMODE_FRAME_HOLD_SET(x) (((x) << 20) & 0xfff00000) - -/* macros for MAC_PCU_XRDEL */ -#define MAC_PCU_XRDEL_ADDRESS 0x000080c4 -#define MAC_PCU_XRDEL_OFFSET 0x000080c4 -#define MAC_PCU_XRDEL_SLOT_DELAY_MSB 15 -#define MAC_PCU_XRDEL_SLOT_DELAY_LSB 0 -#define MAC_PCU_XRDEL_SLOT_DELAY_MASK 0x0000ffff -#define MAC_PCU_XRDEL_SLOT_DELAY_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_XRDEL_SLOT_DELAY_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_PCU_XRDEL_CHIRP_DATA_DELAY_MSB 31 -#define MAC_PCU_XRDEL_CHIRP_DATA_DELAY_LSB 16 -#define MAC_PCU_XRDEL_CHIRP_DATA_DELAY_MASK 0xffff0000 -#define MAC_PCU_XRDEL_CHIRP_DATA_DELAY_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_PCU_XRDEL_CHIRP_DATA_DELAY_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_PCU_XRTO */ -#define MAC_PCU_XRTO_ADDRESS 0x000080c8 -#define MAC_PCU_XRTO_OFFSET 0x000080c8 -#define MAC_PCU_XRTO_CHIRP_TIMEOUT_MSB 15 -#define MAC_PCU_XRTO_CHIRP_TIMEOUT_LSB 0 -#define MAC_PCU_XRTO_CHIRP_TIMEOUT_MASK 0x0000ffff -#define MAC_PCU_XRTO_CHIRP_TIMEOUT_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_XRTO_CHIRP_TIMEOUT_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_PCU_XRTO_POLL_TIMEOUT_MSB 31 -#define MAC_PCU_XRTO_POLL_TIMEOUT_LSB 16 -#define MAC_PCU_XRTO_POLL_TIMEOUT_MASK 0xffff0000 -#define MAC_PCU_XRTO_POLL_TIMEOUT_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_PCU_XRTO_POLL_TIMEOUT_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_PCU_XRCRP */ -#define MAC_PCU_XRCRP_ADDRESS 0x000080cc -#define MAC_PCU_XRCRP_OFFSET 0x000080cc -#define MAC_PCU_XRCRP_SEND_CHIRP_MSB 0 -#define MAC_PCU_XRCRP_SEND_CHIRP_LSB 0 -#define MAC_PCU_XRCRP_SEND_CHIRP_MASK 0x00000001 -#define MAC_PCU_XRCRP_SEND_CHIRP_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_XRCRP_SEND_CHIRP_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_XRCRP_CHIRP_GAP_MSB 31 -#define MAC_PCU_XRCRP_CHIRP_GAP_LSB 16 -#define MAC_PCU_XRCRP_CHIRP_GAP_MASK 0xffff0000 -#define MAC_PCU_XRCRP_CHIRP_GAP_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_PCU_XRCRP_CHIRP_GAP_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_PCU_XRSTMP */ -#define MAC_PCU_XRSTMP_ADDRESS 0x000080d0 -#define MAC_PCU_XRSTMP_OFFSET 0x000080d0 -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_MSB 0 -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_LSB 0 -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_MASK 0x00000001 -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_XRSTMP_RX_ABORT_BSSID_MSB 1 -#define MAC_PCU_XRSTMP_RX_ABORT_BSSID_LSB 1 -#define MAC_PCU_XRSTMP_RX_ABORT_BSSID_MASK 0x00000002 -#define MAC_PCU_XRSTMP_RX_ABORT_BSSID_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_XRSTMP_RX_ABORT_BSSID_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_MSB 2 -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_LSB 2 -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_MASK 0x00000004 -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_XRSTMP_TX_STOMP_BSSID_MSB 3 -#define MAC_PCU_XRSTMP_TX_STOMP_BSSID_LSB 3 -#define MAC_PCU_XRSTMP_TX_STOMP_BSSID_MASK 0x00000008 -#define MAC_PCU_XRSTMP_TX_STOMP_BSSID_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_XRSTMP_TX_STOMP_BSSID_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_XRSTMP_TX_STOMP_DATA_MSB 4 -#define MAC_PCU_XRSTMP_TX_STOMP_DATA_LSB 4 -#define MAC_PCU_XRSTMP_TX_STOMP_DATA_MASK 0x00000010 -#define MAC_PCU_XRSTMP_TX_STOMP_DATA_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_PCU_XRSTMP_TX_STOMP_DATA_SET(x) (((x) << 4) & 0x00000010) -#define MAC_PCU_XRSTMP_RX_ABORT_DATA_MSB 5 -#define MAC_PCU_XRSTMP_RX_ABORT_DATA_LSB 5 -#define MAC_PCU_XRSTMP_RX_ABORT_DATA_MASK 0x00000020 -#define MAC_PCU_XRSTMP_RX_ABORT_DATA_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_PCU_XRSTMP_RX_ABORT_DATA_SET(x) (((x) << 5) & 0x00000020) -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_THRESH_MSB 15 -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_THRESH_LSB 8 -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_THRESH_MASK 0x0000ff00 -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_THRESH_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_XRSTMP_TX_STOMP_RSSI_THRESH_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_THRESH_MSB 23 -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_THRESH_LSB 16 -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_THRESH_MASK 0x00ff0000 -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_THRESH_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_XRSTMP_RX_ABORT_RSSI_THRESH_SET(x) (((x) << 16) & 0x00ff0000) - -/* macros for MAC_PCU_SELF_GEN_DEFAULT */ -#define MAC_PCU_SELF_GEN_DEFAULT_ADDRESS 0x000080dc -#define MAC_PCU_SELF_GEN_DEFAULT_OFFSET 0x000080dc -#define MAC_PCU_SELF_GEN_DEFAULT_MMSS_MSB 2 -#define MAC_PCU_SELF_GEN_DEFAULT_MMSS_LSB 0 -#define MAC_PCU_SELF_GEN_DEFAULT_MMSS_MASK 0x00000007 -#define MAC_PCU_SELF_GEN_DEFAULT_MMSS_GET(x) (((x) & 0x00000007) >> 0) -#define MAC_PCU_SELF_GEN_DEFAULT_MMSS_SET(x) (((x) << 0) & 0x00000007) -#define MAC_PCU_SELF_GEN_DEFAULT_CEC_MSB 4 -#define MAC_PCU_SELF_GEN_DEFAULT_CEC_LSB 3 -#define MAC_PCU_SELF_GEN_DEFAULT_CEC_MASK 0x00000018 -#define MAC_PCU_SELF_GEN_DEFAULT_CEC_GET(x) (((x) & 0x00000018) >> 3) -#define MAC_PCU_SELF_GEN_DEFAULT_CEC_SET(x) (((x) << 3) & 0x00000018) -#define MAC_PCU_SELF_GEN_DEFAULT_STAGGER_SOUNDING_MSB 5 -#define MAC_PCU_SELF_GEN_DEFAULT_STAGGER_SOUNDING_LSB 5 -#define MAC_PCU_SELF_GEN_DEFAULT_STAGGER_SOUNDING_MASK 0x00000020 -#define MAC_PCU_SELF_GEN_DEFAULT_STAGGER_SOUNDING_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_PCU_SELF_GEN_DEFAULT_STAGGER_SOUNDING_SET(x) (((x) << 5) & 0x00000020) - -/* macros for MAC_PCU_ADDR1_MASK_L32 */ -#define MAC_PCU_ADDR1_MASK_L32_ADDRESS 0x000080e0 -#define MAC_PCU_ADDR1_MASK_L32_OFFSET 0x000080e0 -#define MAC_PCU_ADDR1_MASK_L32_VALUE_MSB 31 -#define MAC_PCU_ADDR1_MASK_L32_VALUE_LSB 0 -#define MAC_PCU_ADDR1_MASK_L32_VALUE_MASK 0xffffffff -#define MAC_PCU_ADDR1_MASK_L32_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_ADDR1_MASK_L32_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_ADDR1_MASK_U16 */ -#define MAC_PCU_ADDR1_MASK_U16_ADDRESS 0x000080e4 -#define MAC_PCU_ADDR1_MASK_U16_OFFSET 0x000080e4 -#define MAC_PCU_ADDR1_MASK_U16_VALUE_MSB 15 -#define MAC_PCU_ADDR1_MASK_U16_VALUE_LSB 0 -#define MAC_PCU_ADDR1_MASK_U16_VALUE_MASK 0x0000ffff -#define MAC_PCU_ADDR1_MASK_U16_VALUE_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_ADDR1_MASK_U16_VALUE_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_PCU_TPC */ -#define MAC_PCU_TPC_ADDRESS 0x000080e8 -#define MAC_PCU_TPC_OFFSET 0x000080e8 -#define MAC_PCU_TPC_ACK_PWR_MSB 5 -#define MAC_PCU_TPC_ACK_PWR_LSB 0 -#define MAC_PCU_TPC_ACK_PWR_MASK 0x0000003f -#define MAC_PCU_TPC_ACK_PWR_GET(x) (((x) & 0x0000003f) >> 0) -#define MAC_PCU_TPC_ACK_PWR_SET(x) (((x) << 0) & 0x0000003f) -#define MAC_PCU_TPC_CTS_PWR_MSB 13 -#define MAC_PCU_TPC_CTS_PWR_LSB 8 -#define MAC_PCU_TPC_CTS_PWR_MASK 0x00003f00 -#define MAC_PCU_TPC_CTS_PWR_GET(x) (((x) & 0x00003f00) >> 8) -#define MAC_PCU_TPC_CTS_PWR_SET(x) (((x) << 8) & 0x00003f00) -#define MAC_PCU_TPC_CHIRP_PWR_MSB 21 -#define MAC_PCU_TPC_CHIRP_PWR_LSB 16 -#define MAC_PCU_TPC_CHIRP_PWR_MASK 0x003f0000 -#define MAC_PCU_TPC_CHIRP_PWR_GET(x) (((x) & 0x003f0000) >> 16) -#define MAC_PCU_TPC_CHIRP_PWR_SET(x) (((x) << 16) & 0x003f0000) -#define MAC_PCU_TPC_RPT_PWR_MSB 29 -#define MAC_PCU_TPC_RPT_PWR_LSB 24 -#define MAC_PCU_TPC_RPT_PWR_MASK 0x3f000000 -#define MAC_PCU_TPC_RPT_PWR_GET(x) (((x) & 0x3f000000) >> 24) -#define MAC_PCU_TPC_RPT_PWR_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for MAC_PCU_TX_FRAME_CNT */ -#define MAC_PCU_TX_FRAME_CNT_ADDRESS 0x000080ec -#define MAC_PCU_TX_FRAME_CNT_OFFSET 0x000080ec -#define MAC_PCU_TX_FRAME_CNT_VALUE_MSB 31 -#define MAC_PCU_TX_FRAME_CNT_VALUE_LSB 0 -#define MAC_PCU_TX_FRAME_CNT_VALUE_MASK 0xffffffff -#define MAC_PCU_TX_FRAME_CNT_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_TX_FRAME_CNT_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_RX_FRAME_CNT */ -#define MAC_PCU_RX_FRAME_CNT_ADDRESS 0x000080f0 -#define MAC_PCU_RX_FRAME_CNT_OFFSET 0x000080f0 -#define MAC_PCU_RX_FRAME_CNT_VALUE_MSB 31 -#define MAC_PCU_RX_FRAME_CNT_VALUE_LSB 0 -#define MAC_PCU_RX_FRAME_CNT_VALUE_MASK 0xffffffff -#define MAC_PCU_RX_FRAME_CNT_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_RX_FRAME_CNT_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_RX_CLEAR_CNT */ -#define MAC_PCU_RX_CLEAR_CNT_ADDRESS 0x000080f4 -#define MAC_PCU_RX_CLEAR_CNT_OFFSET 0x000080f4 -#define MAC_PCU_RX_CLEAR_CNT_VALUE_MSB 31 -#define MAC_PCU_RX_CLEAR_CNT_VALUE_LSB 0 -#define MAC_PCU_RX_CLEAR_CNT_VALUE_MASK 0xffffffff -#define MAC_PCU_RX_CLEAR_CNT_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_RX_CLEAR_CNT_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_CYCLE_CNT */ -#define MAC_PCU_CYCLE_CNT_ADDRESS 0x000080f8 -#define MAC_PCU_CYCLE_CNT_OFFSET 0x000080f8 -#define MAC_PCU_CYCLE_CNT_VALUE_MSB 31 -#define MAC_PCU_CYCLE_CNT_VALUE_LSB 0 -#define MAC_PCU_CYCLE_CNT_VALUE_MASK 0xffffffff -#define MAC_PCU_CYCLE_CNT_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_CYCLE_CNT_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_QUIET_TIME_1 */ -#define MAC_PCU_QUIET_TIME_1_ADDRESS 0x000080fc -#define MAC_PCU_QUIET_TIME_1_OFFSET 0x000080fc -#define MAC_PCU_QUIET_TIME_1_ACK_CTS_ENABLE_MSB 17 -#define MAC_PCU_QUIET_TIME_1_ACK_CTS_ENABLE_LSB 17 -#define MAC_PCU_QUIET_TIME_1_ACK_CTS_ENABLE_MASK 0x00020000 -#define MAC_PCU_QUIET_TIME_1_ACK_CTS_ENABLE_GET(x) (((x) & 0x00020000) >> 17) -#define MAC_PCU_QUIET_TIME_1_ACK_CTS_ENABLE_SET(x) (((x) << 17) & 0x00020000) - -/* macros for MAC_PCU_QUIET_TIME_2 */ -#define MAC_PCU_QUIET_TIME_2_ADDRESS 0x00008100 -#define MAC_PCU_QUIET_TIME_2_OFFSET 0x00008100 -#define MAC_PCU_QUIET_TIME_2_DURATION2_MSB 15 -#define MAC_PCU_QUIET_TIME_2_DURATION2_LSB 0 -#define MAC_PCU_QUIET_TIME_2_DURATION2_MASK 0x0000ffff -#define MAC_PCU_QUIET_TIME_2_DURATION2_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_QUIET_TIME_2_DURATION2_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_PCU_QUIET_TIME_2_DURATION_MSB 31 -#define MAC_PCU_QUIET_TIME_2_DURATION_LSB 16 -#define MAC_PCU_QUIET_TIME_2_DURATION_MASK 0xffff0000 -#define MAC_PCU_QUIET_TIME_2_DURATION_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_PCU_QUIET_TIME_2_DURATION_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_PCU_QOS_NO_ACK */ -#define MAC_PCU_QOS_NO_ACK_ADDRESS 0x00008108 -#define MAC_PCU_QOS_NO_ACK_OFFSET 0x00008108 -#define MAC_PCU_QOS_NO_ACK_TWO_BIT_VALUES_MSB 3 -#define MAC_PCU_QOS_NO_ACK_TWO_BIT_VALUES_LSB 0 -#define MAC_PCU_QOS_NO_ACK_TWO_BIT_VALUES_MASK 0x0000000f -#define MAC_PCU_QOS_NO_ACK_TWO_BIT_VALUES_GET(x) (((x) & 0x0000000f) >> 0) -#define MAC_PCU_QOS_NO_ACK_TWO_BIT_VALUES_SET(x) (((x) << 0) & 0x0000000f) -#define MAC_PCU_QOS_NO_ACK_BIT_OFFSET_MSB 6 -#define MAC_PCU_QOS_NO_ACK_BIT_OFFSET_LSB 4 -#define MAC_PCU_QOS_NO_ACK_BIT_OFFSET_MASK 0x00000070 -#define MAC_PCU_QOS_NO_ACK_BIT_OFFSET_GET(x) (((x) & 0x00000070) >> 4) -#define MAC_PCU_QOS_NO_ACK_BIT_OFFSET_SET(x) (((x) << 4) & 0x00000070) -#define MAC_PCU_QOS_NO_ACK_BYTE_OFFSET_MSB 8 -#define MAC_PCU_QOS_NO_ACK_BYTE_OFFSET_LSB 7 -#define MAC_PCU_QOS_NO_ACK_BYTE_OFFSET_MASK 0x00000180 -#define MAC_PCU_QOS_NO_ACK_BYTE_OFFSET_GET(x) (((x) & 0x00000180) >> 7) -#define MAC_PCU_QOS_NO_ACK_BYTE_OFFSET_SET(x) (((x) << 7) & 0x00000180) - -/* macros for MAC_PCU_PHY_ERROR_MASK */ -#define MAC_PCU_PHY_ERROR_MASK_ADDRESS 0x0000810c -#define MAC_PCU_PHY_ERROR_MASK_OFFSET 0x0000810c -#define MAC_PCU_PHY_ERROR_MASK_VALUE_MSB 31 -#define MAC_PCU_PHY_ERROR_MASK_VALUE_LSB 0 -#define MAC_PCU_PHY_ERROR_MASK_VALUE_MASK 0xffffffff -#define MAC_PCU_PHY_ERROR_MASK_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_PHY_ERROR_MASK_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_XRLAT */ -#define MAC_PCU_XRLAT_ADDRESS 0x00008110 -#define MAC_PCU_XRLAT_OFFSET 0x00008110 -#define MAC_PCU_XRLAT_VALUE_MSB 11 -#define MAC_PCU_XRLAT_VALUE_LSB 0 -#define MAC_PCU_XRLAT_VALUE_MASK 0x00000fff -#define MAC_PCU_XRLAT_VALUE_GET(x) (((x) & 0x00000fff) >> 0) -#define MAC_PCU_XRLAT_VALUE_SET(x) (((x) << 0) & 0x00000fff) - -/* macros for MAC_PCU_RXBUF */ -#define MAC_PCU_RXBUF_ADDRESS 0x00008114 -#define MAC_PCU_RXBUF_OFFSET 0x00008114 -#define MAC_PCU_RXBUF_HIGH_PRIORITY_THRSHD_MSB 10 -#define MAC_PCU_RXBUF_HIGH_PRIORITY_THRSHD_LSB 0 -#define MAC_PCU_RXBUF_HIGH_PRIORITY_THRSHD_MASK 0x000007ff -#define MAC_PCU_RXBUF_HIGH_PRIORITY_THRSHD_GET(x) (((x) & 0x000007ff) >> 0) -#define MAC_PCU_RXBUF_HIGH_PRIORITY_THRSHD_SET(x) (((x) << 0) & 0x000007ff) -#define MAC_PCU_RXBUF_REG_RD_ENABLE_MSB 11 -#define MAC_PCU_RXBUF_REG_RD_ENABLE_LSB 11 -#define MAC_PCU_RXBUF_REG_RD_ENABLE_MASK 0x00000800 -#define MAC_PCU_RXBUF_REG_RD_ENABLE_GET(x) (((x) & 0x00000800) >> 11) -#define MAC_PCU_RXBUF_REG_RD_ENABLE_SET(x) (((x) << 11) & 0x00000800) - -/* macros for MAC_PCU_MIC_QOS_CONTROL */ -#define MAC_PCU_MIC_QOS_CONTROL_ADDRESS 0x00008118 -#define MAC_PCU_MIC_QOS_CONTROL_OFFSET 0x00008118 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_0_MSB 1 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_0_LSB 0 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_0_MASK 0x00000003 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_0_GET(x) (((x) & 0x00000003) >> 0) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_0_SET(x) (((x) << 0) & 0x00000003) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_1_MSB 3 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_1_LSB 2 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_1_MASK 0x0000000c -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_1_GET(x) (((x) & 0x0000000c) >> 2) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_1_SET(x) (((x) << 2) & 0x0000000c) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_2_MSB 5 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_2_LSB 4 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_2_MASK 0x00000030 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_2_GET(x) (((x) & 0x00000030) >> 4) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_2_SET(x) (((x) << 4) & 0x00000030) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_3_MSB 7 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_3_LSB 6 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_3_MASK 0x000000c0 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_3_GET(x) (((x) & 0x000000c0) >> 6) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_3_SET(x) (((x) << 6) & 0x000000c0) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_4_MSB 9 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_4_LSB 8 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_4_MASK 0x00000300 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_4_GET(x) (((x) & 0x00000300) >> 8) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_4_SET(x) (((x) << 8) & 0x00000300) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_5_MSB 11 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_5_LSB 10 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_5_MASK 0x00000c00 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_5_GET(x) (((x) & 0x00000c00) >> 10) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_5_SET(x) (((x) << 10) & 0x00000c00) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_6_MSB 13 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_6_LSB 12 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_6_MASK 0x00003000 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_6_GET(x) (((x) & 0x00003000) >> 12) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_6_SET(x) (((x) << 12) & 0x00003000) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_7_MSB 15 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_7_LSB 14 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_7_MASK 0x0000c000 -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_7_GET(x) (((x) & 0x0000c000) >> 14) -#define MAC_PCU_MIC_QOS_CONTROL_VALUE_7_SET(x) (((x) << 14) & 0x0000c000) -#define MAC_PCU_MIC_QOS_CONTROL_ENABLE_MSB 16 -#define MAC_PCU_MIC_QOS_CONTROL_ENABLE_LSB 16 -#define MAC_PCU_MIC_QOS_CONTROL_ENABLE_MASK 0x00010000 -#define MAC_PCU_MIC_QOS_CONTROL_ENABLE_GET(x) (((x) & 0x00010000) >> 16) -#define MAC_PCU_MIC_QOS_CONTROL_ENABLE_SET(x) (((x) << 16) & 0x00010000) - -/* macros for MAC_PCU_MIC_QOS_SELECT */ -#define MAC_PCU_MIC_QOS_SELECT_ADDRESS 0x0000811c -#define MAC_PCU_MIC_QOS_SELECT_OFFSET 0x0000811c -#define MAC_PCU_MIC_QOS_SELECT_VALUE_0_MSB 3 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_0_LSB 0 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_0_MASK 0x0000000f -#define MAC_PCU_MIC_QOS_SELECT_VALUE_0_GET(x) (((x) & 0x0000000f) >> 0) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_0_SET(x) (((x) << 0) & 0x0000000f) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_1_MSB 7 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_1_LSB 4 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_1_MASK 0x000000f0 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_1_GET(x) (((x) & 0x000000f0) >> 4) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_1_SET(x) (((x) << 4) & 0x000000f0) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_2_MSB 11 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_2_LSB 8 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_2_MASK 0x00000f00 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_2_GET(x) (((x) & 0x00000f00) >> 8) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_2_SET(x) (((x) << 8) & 0x00000f00) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_3_MSB 15 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_3_LSB 12 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_3_MASK 0x0000f000 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_3_GET(x) (((x) & 0x0000f000) >> 12) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_3_SET(x) (((x) << 12) & 0x0000f000) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_4_MSB 19 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_4_LSB 16 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_4_MASK 0x000f0000 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_4_GET(x) (((x) & 0x000f0000) >> 16) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_4_SET(x) (((x) << 16) & 0x000f0000) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_5_MSB 23 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_5_LSB 20 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_5_MASK 0x00f00000 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_5_GET(x) (((x) & 0x00f00000) >> 20) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_5_SET(x) (((x) << 20) & 0x00f00000) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_6_MSB 27 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_6_LSB 24 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_6_MASK 0x0f000000 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_6_GET(x) (((x) & 0x0f000000) >> 24) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_6_SET(x) (((x) << 24) & 0x0f000000) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_7_MSB 31 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_7_LSB 28 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_7_MASK 0xf0000000 -#define MAC_PCU_MIC_QOS_SELECT_VALUE_7_GET(x) (((x) & 0xf0000000) >> 28) -#define MAC_PCU_MIC_QOS_SELECT_VALUE_7_SET(x) (((x) << 28) & 0xf0000000) - -/* macros for MAC_PCU_MISC_MODE */ -#define MAC_PCU_MISC_MODE_ADDRESS 0x00008120 -#define MAC_PCU_MISC_MODE_OFFSET 0x00008120 -#define MAC_PCU_MISC_MODE_BSSID_MATCH_FORCE_MSB 0 -#define MAC_PCU_MISC_MODE_BSSID_MATCH_FORCE_LSB 0 -#define MAC_PCU_MISC_MODE_BSSID_MATCH_FORCE_MASK 0x00000001 -#define MAC_PCU_MISC_MODE_BSSID_MATCH_FORCE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_MISC_MODE_BSSID_MATCH_FORCE_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_AD_MSB 1 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_AD_LSB 1 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_AD_MASK 0x00000002 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_AD_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_AD_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_MISC_MODE_MIC_NEW_LOCATION_ENABLE_MSB 2 -#define MAC_PCU_MISC_MODE_MIC_NEW_LOCATION_ENABLE_LSB 2 -#define MAC_PCU_MISC_MODE_MIC_NEW_LOCATION_ENABLE_MASK 0x00000004 -#define MAC_PCU_MISC_MODE_MIC_NEW_LOCATION_ENABLE_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_MISC_MODE_MIC_NEW_LOCATION_ENABLE_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_MISC_MODE_TX_ADD_TSF_MSB 3 -#define MAC_PCU_MISC_MODE_TX_ADD_TSF_LSB 3 -#define MAC_PCU_MISC_MODE_TX_ADD_TSF_MASK 0x00000008 -#define MAC_PCU_MISC_MODE_TX_ADD_TSF_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_MISC_MODE_TX_ADD_TSF_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_MISC_MODE_CCK_SIFS_MODE_MSB 4 -#define MAC_PCU_MISC_MODE_CCK_SIFS_MODE_LSB 4 -#define MAC_PCU_MISC_MODE_CCK_SIFS_MODE_MASK 0x00000010 -#define MAC_PCU_MISC_MODE_CCK_SIFS_MODE_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_PCU_MISC_MODE_CCK_SIFS_MODE_SET(x) (((x) << 4) & 0x00000010) -#define MAC_PCU_MISC_MODE_RXSM2SVD_PRE_RST_MSB 5 -#define MAC_PCU_MISC_MODE_RXSM2SVD_PRE_RST_LSB 5 -#define MAC_PCU_MISC_MODE_RXSM2SVD_PRE_RST_MASK 0x00000020 -#define MAC_PCU_MISC_MODE_RXSM2SVD_PRE_RST_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_PCU_MISC_MODE_RXSM2SVD_PRE_RST_SET(x) (((x) << 5) & 0x00000020) -#define MAC_PCU_MISC_MODE_RCV_DELAY_SOUNDING_IM_TXBF_MSB 6 -#define MAC_PCU_MISC_MODE_RCV_DELAY_SOUNDING_IM_TXBF_LSB 6 -#define MAC_PCU_MISC_MODE_RCV_DELAY_SOUNDING_IM_TXBF_MASK 0x00000040 -#define MAC_PCU_MISC_MODE_RCV_DELAY_SOUNDING_IM_TXBF_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_PCU_MISC_MODE_RCV_DELAY_SOUNDING_IM_TXBF_SET(x) (((x) << 6) & 0x00000040) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_BA_BITMAP_MSB 9 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_BA_BITMAP_LSB 9 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_BA_BITMAP_MASK 0x00000200 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_BA_BITMAP_GET(x) (((x) & 0x00000200) >> 9) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_BA_BITMAP_SET(x) (((x) << 9) & 0x00000200) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_SIFS_MSB 10 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_SIFS_LSB 10 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_SIFS_MASK 0x00000400 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_SIFS_GET(x) (((x) & 0x00000400) >> 10) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_SIFS_SET(x) (((x) << 10) & 0x00000400) -#define MAC_PCU_MISC_MODE_KC_RX_ANT_UPDATE_MSB 11 -#define MAC_PCU_MISC_MODE_KC_RX_ANT_UPDATE_LSB 11 -#define MAC_PCU_MISC_MODE_KC_RX_ANT_UPDATE_MASK 0x00000800 -#define MAC_PCU_MISC_MODE_KC_RX_ANT_UPDATE_GET(x) (((x) & 0x00000800) >> 11) -#define MAC_PCU_MISC_MODE_KC_RX_ANT_UPDATE_SET(x) (((x) << 11) & 0x00000800) -#define MAC_PCU_MISC_MODE_TXOP_TBTT_LIMIT_ENABLE_MSB 12 -#define MAC_PCU_MISC_MODE_TXOP_TBTT_LIMIT_ENABLE_LSB 12 -#define MAC_PCU_MISC_MODE_TXOP_TBTT_LIMIT_ENABLE_MASK 0x00001000 -#define MAC_PCU_MISC_MODE_TXOP_TBTT_LIMIT_ENABLE_GET(x) (((x) & 0x00001000) >> 12) -#define MAC_PCU_MISC_MODE_TXOP_TBTT_LIMIT_ENABLE_SET(x) (((x) << 12) & 0x00001000) -#define MAC_PCU_MISC_MODE_MISS_BEACON_IN_SLEEP_MSB 14 -#define MAC_PCU_MISC_MODE_MISS_BEACON_IN_SLEEP_LSB 14 -#define MAC_PCU_MISC_MODE_MISS_BEACON_IN_SLEEP_MASK 0x00004000 -#define MAC_PCU_MISC_MODE_MISS_BEACON_IN_SLEEP_GET(x) (((x) & 0x00004000) >> 14) -#define MAC_PCU_MISC_MODE_MISS_BEACON_IN_SLEEP_SET(x) (((x) << 14) & 0x00004000) -#define MAC_PCU_MISC_MODE_FORCE_QUIET_COLLISION_MSB 18 -#define MAC_PCU_MISC_MODE_FORCE_QUIET_COLLISION_LSB 18 -#define MAC_PCU_MISC_MODE_FORCE_QUIET_COLLISION_MASK 0x00040000 -#define MAC_PCU_MISC_MODE_FORCE_QUIET_COLLISION_GET(x) (((x) & 0x00040000) >> 18) -#define MAC_PCU_MISC_MODE_FORCE_QUIET_COLLISION_SET(x) (((x) << 18) & 0x00040000) -#define MAC_PCU_MISC_MODE_BT_ANT_PREVENTS_RX_MSB 20 -#define MAC_PCU_MISC_MODE_BT_ANT_PREVENTS_RX_LSB 20 -#define MAC_PCU_MISC_MODE_BT_ANT_PREVENTS_RX_MASK 0x00100000 -#define MAC_PCU_MISC_MODE_BT_ANT_PREVENTS_RX_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_PCU_MISC_MODE_BT_ANT_PREVENTS_RX_SET(x) (((x) << 20) & 0x00100000) -#define MAC_PCU_MISC_MODE_TBTT_PROTECT_MSB 21 -#define MAC_PCU_MISC_MODE_TBTT_PROTECT_LSB 21 -#define MAC_PCU_MISC_MODE_TBTT_PROTECT_MASK 0x00200000 -#define MAC_PCU_MISC_MODE_TBTT_PROTECT_GET(x) (((x) & 0x00200000) >> 21) -#define MAC_PCU_MISC_MODE_TBTT_PROTECT_SET(x) (((x) << 21) & 0x00200000) -#define MAC_PCU_MISC_MODE_HCF_POLL_CANCELS_NAV_MSB 22 -#define MAC_PCU_MISC_MODE_HCF_POLL_CANCELS_NAV_LSB 22 -#define MAC_PCU_MISC_MODE_HCF_POLL_CANCELS_NAV_MASK 0x00400000 -#define MAC_PCU_MISC_MODE_HCF_POLL_CANCELS_NAV_GET(x) (((x) & 0x00400000) >> 22) -#define MAC_PCU_MISC_MODE_HCF_POLL_CANCELS_NAV_SET(x) (((x) << 22) & 0x00400000) -#define MAC_PCU_MISC_MODE_RX_HCF_POLL_ENABLE_MSB 23 -#define MAC_PCU_MISC_MODE_RX_HCF_POLL_ENABLE_LSB 23 -#define MAC_PCU_MISC_MODE_RX_HCF_POLL_ENABLE_MASK 0x00800000 -#define MAC_PCU_MISC_MODE_RX_HCF_POLL_ENABLE_GET(x) (((x) & 0x00800000) >> 23) -#define MAC_PCU_MISC_MODE_RX_HCF_POLL_ENABLE_SET(x) (((x) << 23) & 0x00800000) -#define MAC_PCU_MISC_MODE_CLEAR_VMF_MSB 24 -#define MAC_PCU_MISC_MODE_CLEAR_VMF_LSB 24 -#define MAC_PCU_MISC_MODE_CLEAR_VMF_MASK 0x01000000 -#define MAC_PCU_MISC_MODE_CLEAR_VMF_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_PCU_MISC_MODE_CLEAR_VMF_SET(x) (((x) << 24) & 0x01000000) -#define MAC_PCU_MISC_MODE_CLEAR_FIRST_HCF_MSB 25 -#define MAC_PCU_MISC_MODE_CLEAR_FIRST_HCF_LSB 25 -#define MAC_PCU_MISC_MODE_CLEAR_FIRST_HCF_MASK 0x02000000 -#define MAC_PCU_MISC_MODE_CLEAR_FIRST_HCF_GET(x) (((x) & 0x02000000) >> 25) -#define MAC_PCU_MISC_MODE_CLEAR_FIRST_HCF_SET(x) (((x) << 25) & 0x02000000) -#define MAC_PCU_MISC_MODE_CLEAR_BA_VALID_MSB 26 -#define MAC_PCU_MISC_MODE_CLEAR_BA_VALID_LSB 26 -#define MAC_PCU_MISC_MODE_CLEAR_BA_VALID_MASK 0x04000000 -#define MAC_PCU_MISC_MODE_CLEAR_BA_VALID_GET(x) (((x) & 0x04000000) >> 26) -#define MAC_PCU_MISC_MODE_CLEAR_BA_VALID_SET(x) (((x) << 26) & 0x04000000) -#define MAC_PCU_MISC_MODE_SEL_EVM_MSB 27 -#define MAC_PCU_MISC_MODE_SEL_EVM_LSB 27 -#define MAC_PCU_MISC_MODE_SEL_EVM_MASK 0x08000000 -#define MAC_PCU_MISC_MODE_SEL_EVM_GET(x) (((x) & 0x08000000) >> 27) -#define MAC_PCU_MISC_MODE_SEL_EVM_SET(x) (((x) << 27) & 0x08000000) -#define MAC_PCU_MISC_MODE_ALWAYS_PERFORM_KEY_SEARCH_MSB 28 -#define MAC_PCU_MISC_MODE_ALWAYS_PERFORM_KEY_SEARCH_LSB 28 -#define MAC_PCU_MISC_MODE_ALWAYS_PERFORM_KEY_SEARCH_MASK 0x10000000 -#define MAC_PCU_MISC_MODE_ALWAYS_PERFORM_KEY_SEARCH_GET(x) (((x) & 0x10000000) >> 28) -#define MAC_PCU_MISC_MODE_ALWAYS_PERFORM_KEY_SEARCH_SET(x) (((x) << 28) & 0x10000000) -#define MAC_PCU_MISC_MODE_USE_EOP_PTR_FOR_DMA_WR_MSB 29 -#define MAC_PCU_MISC_MODE_USE_EOP_PTR_FOR_DMA_WR_LSB 29 -#define MAC_PCU_MISC_MODE_USE_EOP_PTR_FOR_DMA_WR_MASK 0x20000000 -#define MAC_PCU_MISC_MODE_USE_EOP_PTR_FOR_DMA_WR_GET(x) (((x) & 0x20000000) >> 29) -#define MAC_PCU_MISC_MODE_USE_EOP_PTR_FOR_DMA_WR_SET(x) (((x) << 29) & 0x20000000) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_MSB 31 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_LSB 30 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_MASK 0xc0000000 -#define MAC_PCU_MISC_MODE_DEBUG_MODE_GET(x) (((x) & 0xc0000000) >> 30) -#define MAC_PCU_MISC_MODE_DEBUG_MODE_SET(x) (((x) << 30) & 0xc0000000) - -/* macros for MAC_PCU_FILTER_OFDM_CNT */ -#define MAC_PCU_FILTER_OFDM_CNT_ADDRESS 0x00008124 -#define MAC_PCU_FILTER_OFDM_CNT_OFFSET 0x00008124 -#define MAC_PCU_FILTER_OFDM_CNT_VALUE_MSB 23 -#define MAC_PCU_FILTER_OFDM_CNT_VALUE_LSB 0 -#define MAC_PCU_FILTER_OFDM_CNT_VALUE_MASK 0x00ffffff -#define MAC_PCU_FILTER_OFDM_CNT_VALUE_GET(x) (((x) & 0x00ffffff) >> 0) -#define MAC_PCU_FILTER_OFDM_CNT_VALUE_SET(x) (((x) << 0) & 0x00ffffff) - -/* macros for MAC_PCU_FILTER_CCK_CNT */ -#define MAC_PCU_FILTER_CCK_CNT_ADDRESS 0x00008128 -#define MAC_PCU_FILTER_CCK_CNT_OFFSET 0x00008128 -#define MAC_PCU_FILTER_CCK_CNT_VALUE_MSB 23 -#define MAC_PCU_FILTER_CCK_CNT_VALUE_LSB 0 -#define MAC_PCU_FILTER_CCK_CNT_VALUE_MASK 0x00ffffff -#define MAC_PCU_FILTER_CCK_CNT_VALUE_GET(x) (((x) & 0x00ffffff) >> 0) -#define MAC_PCU_FILTER_CCK_CNT_VALUE_SET(x) (((x) << 0) & 0x00ffffff) - -/* macros for MAC_PCU_PHY_ERR_CNT_1 */ -#define MAC_PCU_PHY_ERR_CNT_1_ADDRESS 0x0000812c -#define MAC_PCU_PHY_ERR_CNT_1_OFFSET 0x0000812c -#define MAC_PCU_PHY_ERR_CNT_1_VALUE_MSB 23 -#define MAC_PCU_PHY_ERR_CNT_1_VALUE_LSB 0 -#define MAC_PCU_PHY_ERR_CNT_1_VALUE_MASK 0x00ffffff -#define MAC_PCU_PHY_ERR_CNT_1_VALUE_GET(x) (((x) & 0x00ffffff) >> 0) -#define MAC_PCU_PHY_ERR_CNT_1_VALUE_SET(x) (((x) << 0) & 0x00ffffff) - -/* macros for MAC_PCU_PHY_ERR_CNT_1_MASK */ -#define MAC_PCU_PHY_ERR_CNT_1_MASK_ADDRESS 0x00008130 -#define MAC_PCU_PHY_ERR_CNT_1_MASK_OFFSET 0x00008130 -#define MAC_PCU_PHY_ERR_CNT_1_MASK_VALUE_MSB 31 -#define MAC_PCU_PHY_ERR_CNT_1_MASK_VALUE_LSB 0 -#define MAC_PCU_PHY_ERR_CNT_1_MASK_VALUE_MASK 0xffffffff -#define MAC_PCU_PHY_ERR_CNT_1_MASK_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_PHY_ERR_CNT_1_MASK_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_PHY_ERR_CNT_2 */ -#define MAC_PCU_PHY_ERR_CNT_2_ADDRESS 0x00008134 -#define MAC_PCU_PHY_ERR_CNT_2_OFFSET 0x00008134 -#define MAC_PCU_PHY_ERR_CNT_2_VALUE_MSB 23 -#define MAC_PCU_PHY_ERR_CNT_2_VALUE_LSB 0 -#define MAC_PCU_PHY_ERR_CNT_2_VALUE_MASK 0x00ffffff -#define MAC_PCU_PHY_ERR_CNT_2_VALUE_GET(x) (((x) & 0x00ffffff) >> 0) -#define MAC_PCU_PHY_ERR_CNT_2_VALUE_SET(x) (((x) << 0) & 0x00ffffff) - -/* macros for MAC_PCU_PHY_ERR_CNT_2_MASK */ -#define MAC_PCU_PHY_ERR_CNT_2_MASK_ADDRESS 0x00008138 -#define MAC_PCU_PHY_ERR_CNT_2_MASK_OFFSET 0x00008138 -#define MAC_PCU_PHY_ERR_CNT_2_MASK_VALUE_MSB 31 -#define MAC_PCU_PHY_ERR_CNT_2_MASK_VALUE_LSB 0 -#define MAC_PCU_PHY_ERR_CNT_2_MASK_VALUE_MASK 0xffffffff -#define MAC_PCU_PHY_ERR_CNT_2_MASK_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_PHY_ERR_CNT_2_MASK_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_PHY_ERROR_EIFS_MASK */ -#define MAC_PCU_PHY_ERROR_EIFS_MASK_ADDRESS 0x00008144 -#define MAC_PCU_PHY_ERROR_EIFS_MASK_OFFSET 0x00008144 -#define MAC_PCU_PHY_ERROR_EIFS_MASK_VALUE_MSB 31 -#define MAC_PCU_PHY_ERROR_EIFS_MASK_VALUE_LSB 0 -#define MAC_PCU_PHY_ERROR_EIFS_MASK_VALUE_MASK 0xffffffff -#define MAC_PCU_PHY_ERROR_EIFS_MASK_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_PHY_ERROR_EIFS_MASK_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_COEX_LNAMAXGAIN1 */ -#define MAC_PCU_COEX_LNAMAXGAIN1_ADDRESS 0x00008150 -#define MAC_PCU_COEX_LNAMAXGAIN1_OFFSET 0x00008150 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN1_MSB 7 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN1_LSB 0 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN1_MASK 0x000000ff -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN1_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN1_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN2_MSB 15 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN2_LSB 8 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN2_MASK 0x0000ff00 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN2_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN2_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN3_MSB 23 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN3_LSB 16 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN3_MASK 0x00ff0000 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN3_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN3_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN4_MSB 31 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN4_LSB 24 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN4_MASK 0xff000000 -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN4_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_COEX_LNAMAXGAIN1_MAXGAIN4_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_COEX_LNAMAXGAIN2 */ -#define MAC_PCU_COEX_LNAMAXGAIN2_ADDRESS 0x00008154 -#define MAC_PCU_COEX_LNAMAXGAIN2_OFFSET 0x00008154 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN1_MSB 7 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN1_LSB 0 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN1_MASK 0x000000ff -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN1_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN1_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN2_MSB 15 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN2_LSB 8 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN2_MASK 0x0000ff00 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN2_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN2_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN3_MSB 23 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN3_LSB 16 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN3_MASK 0x00ff0000 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN3_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN3_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN4_MSB 31 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN4_LSB 24 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN4_MASK 0xff000000 -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN4_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_COEX_LNAMAXGAIN2_MAXGAIN4_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_COEX_LNAMAXGAIN3 */ -#define MAC_PCU_COEX_LNAMAXGAIN3_ADDRESS 0x00008158 -#define MAC_PCU_COEX_LNAMAXGAIN3_OFFSET 0x00008158 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN1_MSB 7 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN1_LSB 0 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN1_MASK 0x000000ff -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN1_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN1_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN2_MSB 15 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN2_LSB 8 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN2_MASK 0x0000ff00 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN2_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN2_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN3_MSB 23 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN3_LSB 16 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN3_MASK 0x00ff0000 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN3_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN3_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN4_MSB 31 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN4_LSB 24 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN4_MASK 0xff000000 -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN4_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_COEX_LNAMAXGAIN3_MAXGAIN4_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_COEX_LNAMAXGAIN4 */ -#define MAC_PCU_COEX_LNAMAXGAIN4_ADDRESS 0x0000815c -#define MAC_PCU_COEX_LNAMAXGAIN4_OFFSET 0x0000815c -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN1_MSB 7 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN1_LSB 0 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN1_MASK 0x000000ff -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN1_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN1_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN2_MSB 15 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN2_LSB 8 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN2_MASK 0x0000ff00 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN2_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN2_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN3_MSB 23 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN3_LSB 16 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN3_MASK 0x00ff0000 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN3_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN3_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN4_MSB 31 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN4_LSB 24 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN4_MASK 0xff000000 -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN4_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_COEX_LNAMAXGAIN4_MAXGAIN4_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_PHY_ERR_CNT_3 */ -#define MAC_PCU_PHY_ERR_CNT_3_ADDRESS 0x00008168 -#define MAC_PCU_PHY_ERR_CNT_3_OFFSET 0x00008168 -#define MAC_PCU_PHY_ERR_CNT_3_VALUE_MSB 23 -#define MAC_PCU_PHY_ERR_CNT_3_VALUE_LSB 0 -#define MAC_PCU_PHY_ERR_CNT_3_VALUE_MASK 0x00ffffff -#define MAC_PCU_PHY_ERR_CNT_3_VALUE_GET(x) (((x) & 0x00ffffff) >> 0) -#define MAC_PCU_PHY_ERR_CNT_3_VALUE_SET(x) (((x) << 0) & 0x00ffffff) - -/* macros for MAC_PCU_PHY_ERR_CNT_3_MASK */ -#define MAC_PCU_PHY_ERR_CNT_3_MASK_ADDRESS 0x0000816c -#define MAC_PCU_PHY_ERR_CNT_3_MASK_OFFSET 0x0000816c -#define MAC_PCU_PHY_ERR_CNT_3_MASK_VALUE_MSB 31 -#define MAC_PCU_PHY_ERR_CNT_3_MASK_VALUE_LSB 0 -#define MAC_PCU_PHY_ERR_CNT_3_MASK_VALUE_MASK 0xffffffff -#define MAC_PCU_PHY_ERR_CNT_3_MASK_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_PHY_ERR_CNT_3_MASK_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_BLUETOOTH_MODE */ -#define MAC_PCU_BLUETOOTH_MODE_ADDRESS 0x00008170 -#define MAC_PCU_BLUETOOTH_MODE_OFFSET 0x00008170 -#define MAC_PCU_BLUETOOTH_MODE_TIME_EXTEND_MSB 7 -#define MAC_PCU_BLUETOOTH_MODE_TIME_EXTEND_LSB 0 -#define MAC_PCU_BLUETOOTH_MODE_TIME_EXTEND_MASK 0x000000ff -#define MAC_PCU_BLUETOOTH_MODE_TIME_EXTEND_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_BLUETOOTH_MODE_TIME_EXTEND_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_BLUETOOTH_MODE_TX_STATE_EXTEND_MSB 8 -#define MAC_PCU_BLUETOOTH_MODE_TX_STATE_EXTEND_LSB 8 -#define MAC_PCU_BLUETOOTH_MODE_TX_STATE_EXTEND_MASK 0x00000100 -#define MAC_PCU_BLUETOOTH_MODE_TX_STATE_EXTEND_GET(x) (((x) & 0x00000100) >> 8) -#define MAC_PCU_BLUETOOTH_MODE_TX_STATE_EXTEND_SET(x) (((x) << 8) & 0x00000100) -#define MAC_PCU_BLUETOOTH_MODE_TX_FRAME_EXTEND_MSB 9 -#define MAC_PCU_BLUETOOTH_MODE_TX_FRAME_EXTEND_LSB 9 -#define MAC_PCU_BLUETOOTH_MODE_TX_FRAME_EXTEND_MASK 0x00000200 -#define MAC_PCU_BLUETOOTH_MODE_TX_FRAME_EXTEND_GET(x) (((x) & 0x00000200) >> 9) -#define MAC_PCU_BLUETOOTH_MODE_TX_FRAME_EXTEND_SET(x) (((x) << 9) & 0x00000200) -#define MAC_PCU_BLUETOOTH_MODE_MODE_MSB 11 -#define MAC_PCU_BLUETOOTH_MODE_MODE_LSB 10 -#define MAC_PCU_BLUETOOTH_MODE_MODE_MASK 0x00000c00 -#define MAC_PCU_BLUETOOTH_MODE_MODE_GET(x) (((x) & 0x00000c00) >> 10) -#define MAC_PCU_BLUETOOTH_MODE_MODE_SET(x) (((x) << 10) & 0x00000c00) -#define MAC_PCU_BLUETOOTH_MODE_QUIET_MSB 12 -#define MAC_PCU_BLUETOOTH_MODE_QUIET_LSB 12 -#define MAC_PCU_BLUETOOTH_MODE_QUIET_MASK 0x00001000 -#define MAC_PCU_BLUETOOTH_MODE_QUIET_GET(x) (((x) & 0x00001000) >> 12) -#define MAC_PCU_BLUETOOTH_MODE_QUIET_SET(x) (((x) << 12) & 0x00001000) -#define MAC_PCU_BLUETOOTH_MODE_QCU_THRESH_MSB 16 -#define MAC_PCU_BLUETOOTH_MODE_QCU_THRESH_LSB 13 -#define MAC_PCU_BLUETOOTH_MODE_QCU_THRESH_MASK 0x0001e000 -#define MAC_PCU_BLUETOOTH_MODE_QCU_THRESH_GET(x) (((x) & 0x0001e000) >> 13) -#define MAC_PCU_BLUETOOTH_MODE_QCU_THRESH_SET(x) (((x) << 13) & 0x0001e000) -#define MAC_PCU_BLUETOOTH_MODE_RX_CLEAR_POLARITY_MSB 17 -#define MAC_PCU_BLUETOOTH_MODE_RX_CLEAR_POLARITY_LSB 17 -#define MAC_PCU_BLUETOOTH_MODE_RX_CLEAR_POLARITY_MASK 0x00020000 -#define MAC_PCU_BLUETOOTH_MODE_RX_CLEAR_POLARITY_GET(x) (((x) & 0x00020000) >> 17) -#define MAC_PCU_BLUETOOTH_MODE_RX_CLEAR_POLARITY_SET(x) (((x) << 17) & 0x00020000) -#define MAC_PCU_BLUETOOTH_MODE_PRIORITY_TIME_MSB 23 -#define MAC_PCU_BLUETOOTH_MODE_PRIORITY_TIME_LSB 18 -#define MAC_PCU_BLUETOOTH_MODE_PRIORITY_TIME_MASK 0x00fc0000 -#define MAC_PCU_BLUETOOTH_MODE_PRIORITY_TIME_GET(x) (((x) & 0x00fc0000) >> 18) -#define MAC_PCU_BLUETOOTH_MODE_PRIORITY_TIME_SET(x) (((x) << 18) & 0x00fc0000) -#define MAC_PCU_BLUETOOTH_MODE_FIRST_SLOT_TIME_MSB 31 -#define MAC_PCU_BLUETOOTH_MODE_FIRST_SLOT_TIME_LSB 24 -#define MAC_PCU_BLUETOOTH_MODE_FIRST_SLOT_TIME_MASK 0xff000000 -#define MAC_PCU_BLUETOOTH_MODE_FIRST_SLOT_TIME_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_BLUETOOTH_MODE_FIRST_SLOT_TIME_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_HCF_TIMEOUT */ -#define MAC_PCU_HCF_TIMEOUT_ADDRESS 0x00008178 -#define MAC_PCU_HCF_TIMEOUT_OFFSET 0x00008178 -#define MAC_PCU_HCF_TIMEOUT_VALUE_MSB 15 -#define MAC_PCU_HCF_TIMEOUT_VALUE_LSB 0 -#define MAC_PCU_HCF_TIMEOUT_VALUE_MASK 0x0000ffff -#define MAC_PCU_HCF_TIMEOUT_VALUE_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_HCF_TIMEOUT_VALUE_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_PCU_BLUETOOTH_MODE2 */ -#define MAC_PCU_BLUETOOTH_MODE2_ADDRESS 0x0000817c -#define MAC_PCU_BLUETOOTH_MODE2_OFFSET 0x0000817c -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_THRESH_MSB 7 -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_THRESH_LSB 0 -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_THRESH_MASK 0x000000ff -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_THRESH_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_THRESH_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_CNT_MSB 15 -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_CNT_LSB 8 -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_CNT_MASK 0x0000ff00 -#define MAC_PCU_BLUETOOTH_MODE2_BCN_MISS_CNT_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_BLUETOOTH_MODE2_HOLD_RX_CLEAR_MSB 16 -#define MAC_PCU_BLUETOOTH_MODE2_HOLD_RX_CLEAR_LSB 16 -#define MAC_PCU_BLUETOOTH_MODE2_HOLD_RX_CLEAR_MASK 0x00010000 -#define MAC_PCU_BLUETOOTH_MODE2_HOLD_RX_CLEAR_GET(x) (((x) & 0x00010000) >> 16) -#define MAC_PCU_BLUETOOTH_MODE2_HOLD_RX_CLEAR_SET(x) (((x) << 16) & 0x00010000) -#define MAC_PCU_BLUETOOTH_MODE2_SLEEP_ALLOW_BT_ACCESS_MSB 17 -#define MAC_PCU_BLUETOOTH_MODE2_SLEEP_ALLOW_BT_ACCESS_LSB 17 -#define MAC_PCU_BLUETOOTH_MODE2_SLEEP_ALLOW_BT_ACCESS_MASK 0x00020000 -#define MAC_PCU_BLUETOOTH_MODE2_SLEEP_ALLOW_BT_ACCESS_GET(x) (((x) & 0x00020000) >> 17) -#define MAC_PCU_BLUETOOTH_MODE2_SLEEP_ALLOW_BT_ACCESS_SET(x) (((x) << 17) & 0x00020000) -#define MAC_PCU_BLUETOOTH_MODE2_PROTECT_BT_AFTER_WAKEUP_MSB 19 -#define MAC_PCU_BLUETOOTH_MODE2_PROTECT_BT_AFTER_WAKEUP_LSB 19 -#define MAC_PCU_BLUETOOTH_MODE2_PROTECT_BT_AFTER_WAKEUP_MASK 0x00080000 -#define MAC_PCU_BLUETOOTH_MODE2_PROTECT_BT_AFTER_WAKEUP_GET(x) (((x) & 0x00080000) >> 19) -#define MAC_PCU_BLUETOOTH_MODE2_PROTECT_BT_AFTER_WAKEUP_SET(x) (((x) << 19) & 0x00080000) -#define MAC_PCU_BLUETOOTH_MODE2_DISABLE_BT_ANT_MSB 20 -#define MAC_PCU_BLUETOOTH_MODE2_DISABLE_BT_ANT_LSB 20 -#define MAC_PCU_BLUETOOTH_MODE2_DISABLE_BT_ANT_MASK 0x00100000 -#define MAC_PCU_BLUETOOTH_MODE2_DISABLE_BT_ANT_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_PCU_BLUETOOTH_MODE2_DISABLE_BT_ANT_SET(x) (((x) << 20) & 0x00100000) -#define MAC_PCU_BLUETOOTH_MODE2_QUIET_2_WIRE_MSB 21 -#define MAC_PCU_BLUETOOTH_MODE2_QUIET_2_WIRE_LSB 21 -#define MAC_PCU_BLUETOOTH_MODE2_QUIET_2_WIRE_MASK 0x00200000 -#define MAC_PCU_BLUETOOTH_MODE2_QUIET_2_WIRE_GET(x) (((x) & 0x00200000) >> 21) -#define MAC_PCU_BLUETOOTH_MODE2_QUIET_2_WIRE_SET(x) (((x) << 21) & 0x00200000) -#define MAC_PCU_BLUETOOTH_MODE2_WL_ACTIVE_MODE_MSB 23 -#define MAC_PCU_BLUETOOTH_MODE2_WL_ACTIVE_MODE_LSB 22 -#define MAC_PCU_BLUETOOTH_MODE2_WL_ACTIVE_MODE_MASK 0x00c00000 -#define MAC_PCU_BLUETOOTH_MODE2_WL_ACTIVE_MODE_GET(x) (((x) & 0x00c00000) >> 22) -#define MAC_PCU_BLUETOOTH_MODE2_WL_ACTIVE_MODE_SET(x) (((x) << 22) & 0x00c00000) -#define MAC_PCU_BLUETOOTH_MODE2_WL_TXRX_SEPARATE_MSB 24 -#define MAC_PCU_BLUETOOTH_MODE2_WL_TXRX_SEPARATE_LSB 24 -#define MAC_PCU_BLUETOOTH_MODE2_WL_TXRX_SEPARATE_MASK 0x01000000 -#define MAC_PCU_BLUETOOTH_MODE2_WL_TXRX_SEPARATE_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_PCU_BLUETOOTH_MODE2_WL_TXRX_SEPARATE_SET(x) (((x) << 24) & 0x01000000) -#define MAC_PCU_BLUETOOTH_MODE2_RS_DISCARD_EXTEND_MSB 25 -#define MAC_PCU_BLUETOOTH_MODE2_RS_DISCARD_EXTEND_LSB 25 -#define MAC_PCU_BLUETOOTH_MODE2_RS_DISCARD_EXTEND_MASK 0x02000000 -#define MAC_PCU_BLUETOOTH_MODE2_RS_DISCARD_EXTEND_GET(x) (((x) & 0x02000000) >> 25) -#define MAC_PCU_BLUETOOTH_MODE2_RS_DISCARD_EXTEND_SET(x) (((x) << 25) & 0x02000000) -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_ACTIVE_CTRL_MSB 27 -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_ACTIVE_CTRL_LSB 26 -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_ACTIVE_CTRL_MASK 0x0c000000 -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_ACTIVE_CTRL_GET(x) (((x) & 0x0c000000) >> 26) -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_ACTIVE_CTRL_SET(x) (((x) << 26) & 0x0c000000) -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_PRIORITY_CTRL_MSB 29 -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_PRIORITY_CTRL_LSB 28 -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_PRIORITY_CTRL_MASK 0x30000000 -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_PRIORITY_CTRL_GET(x) (((x) & 0x30000000) >> 28) -#define MAC_PCU_BLUETOOTH_MODE2_TSF_BT_PRIORITY_CTRL_SET(x) (((x) << 28) & 0x30000000) -#define MAC_PCU_BLUETOOTH_MODE2_INTERRUPT_ENABLE_MSB 30 -#define MAC_PCU_BLUETOOTH_MODE2_INTERRUPT_ENABLE_LSB 30 -#define MAC_PCU_BLUETOOTH_MODE2_INTERRUPT_ENABLE_MASK 0x40000000 -#define MAC_PCU_BLUETOOTH_MODE2_INTERRUPT_ENABLE_GET(x) (((x) & 0x40000000) >> 30) -#define MAC_PCU_BLUETOOTH_MODE2_INTERRUPT_ENABLE_SET(x) (((x) << 30) & 0x40000000) -#define MAC_PCU_BLUETOOTH_MODE2_PHY_ERR_BT_COLL_ENABLE_MSB 31 -#define MAC_PCU_BLUETOOTH_MODE2_PHY_ERR_BT_COLL_ENABLE_LSB 31 -#define MAC_PCU_BLUETOOTH_MODE2_PHY_ERR_BT_COLL_ENABLE_MASK 0x80000000 -#define MAC_PCU_BLUETOOTH_MODE2_PHY_ERR_BT_COLL_ENABLE_GET(x) (((x) & 0x80000000) >> 31) -#define MAC_PCU_BLUETOOTH_MODE2_PHY_ERR_BT_COLL_ENABLE_SET(x) (((x) << 31) & 0x80000000) - -/* macros for MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE */ -#define MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_ADDRESS 0x000081c8 -#define MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_OFFSET 0x000081c8 -#define MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_VALUE_MSB 31 -#define MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_VALUE_LSB 0 -#define MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_VALUE_MASK 0xffffffff -#define MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE_VALUE_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY */ -#define MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_ADDRESS 0x000081cc -#define MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_OFFSET 0x000081cc -#define MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_VALUE_MSB 31 -#define MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_VALUE_LSB 0 -#define MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_VALUE_MASK 0xffffffff -#define MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY_VALUE_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_PCU_TXSIFS */ -#define MAC_PCU_TXSIFS_ADDRESS 0x000081d0 -#define MAC_PCU_TXSIFS_OFFSET 0x000081d0 -#define MAC_PCU_TXSIFS_SIFS_TIME_MSB 7 -#define MAC_PCU_TXSIFS_SIFS_TIME_LSB 0 -#define MAC_PCU_TXSIFS_SIFS_TIME_MASK 0x000000ff -#define MAC_PCU_TXSIFS_SIFS_TIME_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_TXSIFS_SIFS_TIME_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_TXSIFS_TX_LATENCY_MSB 11 -#define MAC_PCU_TXSIFS_TX_LATENCY_LSB 8 -#define MAC_PCU_TXSIFS_TX_LATENCY_MASK 0x00000f00 -#define MAC_PCU_TXSIFS_TX_LATENCY_GET(x) (((x) & 0x00000f00) >> 8) -#define MAC_PCU_TXSIFS_TX_LATENCY_SET(x) (((x) << 8) & 0x00000f00) -#define MAC_PCU_TXSIFS_ACK_SHIFT_MSB 14 -#define MAC_PCU_TXSIFS_ACK_SHIFT_LSB 12 -#define MAC_PCU_TXSIFS_ACK_SHIFT_MASK 0x00007000 -#define MAC_PCU_TXSIFS_ACK_SHIFT_GET(x) (((x) & 0x00007000) >> 12) -#define MAC_PCU_TXSIFS_ACK_SHIFT_SET(x) (((x) << 12) & 0x00007000) - -/* macros for MAC_PCU_BLUETOOTH_MODE3 */ -#define MAC_PCU_BLUETOOTH_MODE3_ADDRESS 0x000081d4 -#define MAC_PCU_BLUETOOTH_MODE3_OFFSET 0x000081d4 -#define MAC_PCU_BLUETOOTH_MODE3_WL_ACTIVE_TIME_MSB 7 -#define MAC_PCU_BLUETOOTH_MODE3_WL_ACTIVE_TIME_LSB 0 -#define MAC_PCU_BLUETOOTH_MODE3_WL_ACTIVE_TIME_MASK 0x000000ff -#define MAC_PCU_BLUETOOTH_MODE3_WL_ACTIVE_TIME_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_BLUETOOTH_MODE3_WL_ACTIVE_TIME_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_BLUETOOTH_MODE3_WL_QC_TIME_MSB 15 -#define MAC_PCU_BLUETOOTH_MODE3_WL_QC_TIME_LSB 8 -#define MAC_PCU_BLUETOOTH_MODE3_WL_QC_TIME_MASK 0x0000ff00 -#define MAC_PCU_BLUETOOTH_MODE3_WL_QC_TIME_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_BLUETOOTH_MODE3_WL_QC_TIME_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_BLUETOOTH_MODE3_ALLOW_CONCURRENT_ACCESS_MSB 19 -#define MAC_PCU_BLUETOOTH_MODE3_ALLOW_CONCURRENT_ACCESS_LSB 16 -#define MAC_PCU_BLUETOOTH_MODE3_ALLOW_CONCURRENT_ACCESS_MASK 0x000f0000 -#define MAC_PCU_BLUETOOTH_MODE3_ALLOW_CONCURRENT_ACCESS_GET(x) (((x) & 0x000f0000) >> 16) -#define MAC_PCU_BLUETOOTH_MODE3_ALLOW_CONCURRENT_ACCESS_SET(x) (((x) << 16) & 0x000f0000) -#define MAC_PCU_BLUETOOTH_MODE3_AGC_SATURATION_CNT_ENABLE_MSB 20 -#define MAC_PCU_BLUETOOTH_MODE3_AGC_SATURATION_CNT_ENABLE_LSB 20 -#define MAC_PCU_BLUETOOTH_MODE3_AGC_SATURATION_CNT_ENABLE_MASK 0x00100000 -#define MAC_PCU_BLUETOOTH_MODE3_AGC_SATURATION_CNT_ENABLE_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_PCU_BLUETOOTH_MODE3_AGC_SATURATION_CNT_ENABLE_SET(x) (((x) << 20) & 0x00100000) -#define MAC_PCU_BLUETOOTH_MODE3_WL_PRIORITY_OFFSET_EN_MSB 21 -#define MAC_PCU_BLUETOOTH_MODE3_WL_PRIORITY_OFFSET_EN_LSB 21 -#define MAC_PCU_BLUETOOTH_MODE3_WL_PRIORITY_OFFSET_EN_MASK 0x00200000 -#define MAC_PCU_BLUETOOTH_MODE3_WL_PRIORITY_OFFSET_EN_GET(x) (((x) & 0x00200000) >> 21) -#define MAC_PCU_BLUETOOTH_MODE3_WL_PRIORITY_OFFSET_EN_SET(x) (((x) << 21) & 0x00200000) -#define MAC_PCU_BLUETOOTH_MODE3_RFGAIN_LOCK_SRC_MSB 22 -#define MAC_PCU_BLUETOOTH_MODE3_RFGAIN_LOCK_SRC_LSB 22 -#define MAC_PCU_BLUETOOTH_MODE3_RFGAIN_LOCK_SRC_MASK 0x00400000 -#define MAC_PCU_BLUETOOTH_MODE3_RFGAIN_LOCK_SRC_GET(x) (((x) & 0x00400000) >> 22) -#define MAC_PCU_BLUETOOTH_MODE3_RFGAIN_LOCK_SRC_SET(x) (((x) << 22) & 0x00400000) -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_PRI_EN_MSB 23 -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_PRI_EN_LSB 23 -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_PRI_EN_MASK 0x00800000 -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_PRI_EN_GET(x) (((x) & 0x00800000) >> 23) -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_PRI_EN_SET(x) (((x) << 23) & 0x00800000) -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_TOGGLE_WLA_EN_MSB 24 -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_TOGGLE_WLA_EN_LSB 24 -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_TOGGLE_WLA_EN_MASK 0x01000000 -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_TOGGLE_WLA_EN_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_PCU_BLUETOOTH_MODE3_DYNAMIC_TOGGLE_WLA_EN_SET(x) (((x) << 24) & 0x01000000) -#define MAC_PCU_BLUETOOTH_MODE3_SLOT_SLOP_MSB 26 -#define MAC_PCU_BLUETOOTH_MODE3_SLOT_SLOP_LSB 25 -#define MAC_PCU_BLUETOOTH_MODE3_SLOT_SLOP_MASK 0x06000000 -#define MAC_PCU_BLUETOOTH_MODE3_SLOT_SLOP_GET(x) (((x) & 0x06000000) >> 25) -#define MAC_PCU_BLUETOOTH_MODE3_SLOT_SLOP_SET(x) (((x) << 25) & 0x06000000) -#define MAC_PCU_BLUETOOTH_MODE3_BT_TX_ON_EN_MSB 27 -#define MAC_PCU_BLUETOOTH_MODE3_BT_TX_ON_EN_LSB 27 -#define MAC_PCU_BLUETOOTH_MODE3_BT_TX_ON_EN_MASK 0x08000000 -#define MAC_PCU_BLUETOOTH_MODE3_BT_TX_ON_EN_GET(x) (((x) & 0x08000000) >> 27) -#define MAC_PCU_BLUETOOTH_MODE3_BT_TX_ON_EN_SET(x) (((x) << 27) & 0x08000000) -#define MAC_PCU_BLUETOOTH_MODE3_BT_PRIORITY_EXTEND_THRES_MSB 31 -#define MAC_PCU_BLUETOOTH_MODE3_BT_PRIORITY_EXTEND_THRES_LSB 28 -#define MAC_PCU_BLUETOOTH_MODE3_BT_PRIORITY_EXTEND_THRES_MASK 0xf0000000 -#define MAC_PCU_BLUETOOTH_MODE3_BT_PRIORITY_EXTEND_THRES_GET(x) (((x) & 0xf0000000) >> 28) -#define MAC_PCU_BLUETOOTH_MODE3_BT_PRIORITY_EXTEND_THRES_SET(x) (((x) << 28) & 0xf0000000) - -/* macros for MAC_PCU_BLUETOOTH_MODE4 */ -#define MAC_PCU_BLUETOOTH_MODE4_ADDRESS 0x000081d8 -#define MAC_PCU_BLUETOOTH_MODE4_OFFSET 0x000081d8 -#define MAC_PCU_BLUETOOTH_MODE4_BT_ACTIVE_EXTEND_MSB 15 -#define MAC_PCU_BLUETOOTH_MODE4_BT_ACTIVE_EXTEND_LSB 0 -#define MAC_PCU_BLUETOOTH_MODE4_BT_ACTIVE_EXTEND_MASK 0x0000ffff -#define MAC_PCU_BLUETOOTH_MODE4_BT_ACTIVE_EXTEND_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_BLUETOOTH_MODE4_BT_ACTIVE_EXTEND_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_PCU_BLUETOOTH_MODE4_BT_PRIORITY_EXTEND_MSB 31 -#define MAC_PCU_BLUETOOTH_MODE4_BT_PRIORITY_EXTEND_LSB 16 -#define MAC_PCU_BLUETOOTH_MODE4_BT_PRIORITY_EXTEND_MASK 0xffff0000 -#define MAC_PCU_BLUETOOTH_MODE4_BT_PRIORITY_EXTEND_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_PCU_BLUETOOTH_MODE4_BT_PRIORITY_EXTEND_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_PCU_BLUETOOTH_MODE5 */ -#define MAC_PCU_BLUETOOTH_MODE5_ADDRESS 0x000081dc -#define MAC_PCU_BLUETOOTH_MODE5_OFFSET 0x000081dc -#define MAC_PCU_BLUETOOTH_MODE5_MCI_WL_LEVEL_MULT_MSB 2 -#define MAC_PCU_BLUETOOTH_MODE5_MCI_WL_LEVEL_MULT_LSB 0 -#define MAC_PCU_BLUETOOTH_MODE5_MCI_WL_LEVEL_MULT_MASK 0x00000007 -#define MAC_PCU_BLUETOOTH_MODE5_MCI_WL_LEVEL_MULT_GET(x) (((x) & 0x00000007) >> 0) -#define MAC_PCU_BLUETOOTH_MODE5_MCI_WL_LEVEL_MULT_SET(x) (((x) << 0) & 0x00000007) -#define MAC_PCU_BLUETOOTH_MODE5_TX_ON_SRC_MSB 3 -#define MAC_PCU_BLUETOOTH_MODE5_TX_ON_SRC_LSB 3 -#define MAC_PCU_BLUETOOTH_MODE5_TX_ON_SRC_MASK 0x00000008 -#define MAC_PCU_BLUETOOTH_MODE5_TX_ON_SRC_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_BLUETOOTH_MODE5_TX_ON_SRC_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_BLUETOOTH_MODE5_TIMER_TARGET_MSB 19 -#define MAC_PCU_BLUETOOTH_MODE5_TIMER_TARGET_LSB 4 -#define MAC_PCU_BLUETOOTH_MODE5_TIMER_TARGET_MASK 0x000ffff0 -#define MAC_PCU_BLUETOOTH_MODE5_TIMER_TARGET_GET(x) (((x) & 0x000ffff0) >> 4) -#define MAC_PCU_BLUETOOTH_MODE5_TIMER_TARGET_SET(x) (((x) << 4) & 0x000ffff0) -#define MAC_PCU_BLUETOOTH_MODE5_SHARED_RX_MSB 20 -#define MAC_PCU_BLUETOOTH_MODE5_SHARED_RX_LSB 20 -#define MAC_PCU_BLUETOOTH_MODE5_SHARED_RX_MASK 0x00100000 -#define MAC_PCU_BLUETOOTH_MODE5_SHARED_RX_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_PCU_BLUETOOTH_MODE5_SHARED_RX_SET(x) (((x) << 20) & 0x00100000) -#define MAC_PCU_BLUETOOTH_MODE5_USE_BTP_EXT_MSB 21 -#define MAC_PCU_BLUETOOTH_MODE5_USE_BTP_EXT_LSB 21 -#define MAC_PCU_BLUETOOTH_MODE5_USE_BTP_EXT_MASK 0x00200000 -#define MAC_PCU_BLUETOOTH_MODE5_USE_BTP_EXT_GET(x) (((x) & 0x00200000) >> 21) -#define MAC_PCU_BLUETOOTH_MODE5_USE_BTP_EXT_SET(x) (((x) << 21) & 0x00200000) - -/* macros for MAC_PCU_BLUETOOTH_WEIGHTS */ -#define MAC_PCU_BLUETOOTH_WEIGHTS_ADDRESS 0x000081e0 -#define MAC_PCU_BLUETOOTH_WEIGHTS_OFFSET 0x000081e0 -#define MAC_PCU_BLUETOOTH_WEIGHTS_BT_WEIGHT_MSB 15 -#define MAC_PCU_BLUETOOTH_WEIGHTS_BT_WEIGHT_LSB 0 -#define MAC_PCU_BLUETOOTH_WEIGHTS_BT_WEIGHT_MASK 0x0000ffff -#define MAC_PCU_BLUETOOTH_WEIGHTS_BT_WEIGHT_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_BLUETOOTH_WEIGHTS_BT_WEIGHT_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_PCU_BLUETOOTH_WEIGHTS_WL_WEIGHT_MSB 31 -#define MAC_PCU_BLUETOOTH_WEIGHTS_WL_WEIGHT_LSB 16 -#define MAC_PCU_BLUETOOTH_WEIGHTS_WL_WEIGHT_MASK 0xffff0000 -#define MAC_PCU_BLUETOOTH_WEIGHTS_WL_WEIGHT_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_PCU_BLUETOOTH_WEIGHTS_WL_WEIGHT_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_PCU_BT_BT_ASYNC */ -#define MAC_PCU_BT_BT_ASYNC_ADDRESS 0x000081e4 -#define MAC_PCU_BT_BT_ASYNC_OFFSET 0x000081e4 -#define MAC_PCU_BT_BT_ASYNC_TXHP_WEIGHT_MSB 3 -#define MAC_PCU_BT_BT_ASYNC_TXHP_WEIGHT_LSB 0 -#define MAC_PCU_BT_BT_ASYNC_TXHP_WEIGHT_MASK 0x0000000f -#define MAC_PCU_BT_BT_ASYNC_TXHP_WEIGHT_GET(x) (((x) & 0x0000000f) >> 0) -#define MAC_PCU_BT_BT_ASYNC_TXHP_WEIGHT_SET(x) (((x) << 0) & 0x0000000f) -#define MAC_PCU_BT_BT_ASYNC_TXLP_WEIGHT_MSB 7 -#define MAC_PCU_BT_BT_ASYNC_TXLP_WEIGHT_LSB 4 -#define MAC_PCU_BT_BT_ASYNC_TXLP_WEIGHT_MASK 0x000000f0 -#define MAC_PCU_BT_BT_ASYNC_TXLP_WEIGHT_GET(x) (((x) & 0x000000f0) >> 4) -#define MAC_PCU_BT_BT_ASYNC_TXLP_WEIGHT_SET(x) (((x) << 4) & 0x000000f0) -#define MAC_PCU_BT_BT_ASYNC_RXHP_WEIGHT_MSB 11 -#define MAC_PCU_BT_BT_ASYNC_RXHP_WEIGHT_LSB 8 -#define MAC_PCU_BT_BT_ASYNC_RXHP_WEIGHT_MASK 0x00000f00 -#define MAC_PCU_BT_BT_ASYNC_RXHP_WEIGHT_GET(x) (((x) & 0x00000f00) >> 8) -#define MAC_PCU_BT_BT_ASYNC_RXHP_WEIGHT_SET(x) (((x) << 8) & 0x00000f00) -#define MAC_PCU_BT_BT_ASYNC_RXLP_WEIGHT_MSB 15 -#define MAC_PCU_BT_BT_ASYNC_RXLP_WEIGHT_LSB 12 -#define MAC_PCU_BT_BT_ASYNC_RXLP_WEIGHT_MASK 0x0000f000 -#define MAC_PCU_BT_BT_ASYNC_RXLP_WEIGHT_GET(x) (((x) & 0x0000f000) >> 12) -#define MAC_PCU_BT_BT_ASYNC_RXLP_WEIGHT_SET(x) (((x) << 12) & 0x0000f000) - -/* macros for MAC_PCU_TXOP_X */ -#define MAC_PCU_TXOP_X_ADDRESS 0x000081ec -#define MAC_PCU_TXOP_X_OFFSET 0x000081ec -#define MAC_PCU_TXOP_X_VALUE_MSB 7 -#define MAC_PCU_TXOP_X_VALUE_LSB 0 -#define MAC_PCU_TXOP_X_VALUE_MASK 0x000000ff -#define MAC_PCU_TXOP_X_VALUE_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_TXOP_X_VALUE_SET(x) (((x) << 0) & 0x000000ff) - -/* macros for MAC_PCU_TXOP_0_3 */ -#define MAC_PCU_TXOP_0_3_ADDRESS 0x000081f0 -#define MAC_PCU_TXOP_0_3_OFFSET 0x000081f0 -#define MAC_PCU_TXOP_0_3_VALUE_0_MSB 7 -#define MAC_PCU_TXOP_0_3_VALUE_0_LSB 0 -#define MAC_PCU_TXOP_0_3_VALUE_0_MASK 0x000000ff -#define MAC_PCU_TXOP_0_3_VALUE_0_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_TXOP_0_3_VALUE_0_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_TXOP_0_3_VALUE_1_MSB 15 -#define MAC_PCU_TXOP_0_3_VALUE_1_LSB 8 -#define MAC_PCU_TXOP_0_3_VALUE_1_MASK 0x0000ff00 -#define MAC_PCU_TXOP_0_3_VALUE_1_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_TXOP_0_3_VALUE_1_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_TXOP_0_3_VALUE_2_MSB 23 -#define MAC_PCU_TXOP_0_3_VALUE_2_LSB 16 -#define MAC_PCU_TXOP_0_3_VALUE_2_MASK 0x00ff0000 -#define MAC_PCU_TXOP_0_3_VALUE_2_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_TXOP_0_3_VALUE_2_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_TXOP_0_3_VALUE_3_MSB 31 -#define MAC_PCU_TXOP_0_3_VALUE_3_LSB 24 -#define MAC_PCU_TXOP_0_3_VALUE_3_MASK 0xff000000 -#define MAC_PCU_TXOP_0_3_VALUE_3_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_TXOP_0_3_VALUE_3_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_TXOP_4_7 */ -#define MAC_PCU_TXOP_4_7_ADDRESS 0x000081f4 -#define MAC_PCU_TXOP_4_7_OFFSET 0x000081f4 -#define MAC_PCU_TXOP_4_7_VALUE_4_MSB 7 -#define MAC_PCU_TXOP_4_7_VALUE_4_LSB 0 -#define MAC_PCU_TXOP_4_7_VALUE_4_MASK 0x000000ff -#define MAC_PCU_TXOP_4_7_VALUE_4_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_TXOP_4_7_VALUE_4_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_TXOP_4_7_VALUE_5_MSB 15 -#define MAC_PCU_TXOP_4_7_VALUE_5_LSB 8 -#define MAC_PCU_TXOP_4_7_VALUE_5_MASK 0x0000ff00 -#define MAC_PCU_TXOP_4_7_VALUE_5_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_TXOP_4_7_VALUE_5_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_TXOP_4_7_VALUE_6_MSB 23 -#define MAC_PCU_TXOP_4_7_VALUE_6_LSB 16 -#define MAC_PCU_TXOP_4_7_VALUE_6_MASK 0x00ff0000 -#define MAC_PCU_TXOP_4_7_VALUE_6_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_TXOP_4_7_VALUE_6_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_TXOP_4_7_VALUE_7_MSB 31 -#define MAC_PCU_TXOP_4_7_VALUE_7_LSB 24 -#define MAC_PCU_TXOP_4_7_VALUE_7_MASK 0xff000000 -#define MAC_PCU_TXOP_4_7_VALUE_7_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_TXOP_4_7_VALUE_7_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_TXOP_8_11 */ -#define MAC_PCU_TXOP_8_11_ADDRESS 0x000081f8 -#define MAC_PCU_TXOP_8_11_OFFSET 0x000081f8 -#define MAC_PCU_TXOP_8_11_VALUE_8_MSB 7 -#define MAC_PCU_TXOP_8_11_VALUE_8_LSB 0 -#define MAC_PCU_TXOP_8_11_VALUE_8_MASK 0x000000ff -#define MAC_PCU_TXOP_8_11_VALUE_8_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_TXOP_8_11_VALUE_8_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_TXOP_8_11_VALUE_9_MSB 15 -#define MAC_PCU_TXOP_8_11_VALUE_9_LSB 8 -#define MAC_PCU_TXOP_8_11_VALUE_9_MASK 0x0000ff00 -#define MAC_PCU_TXOP_8_11_VALUE_9_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_TXOP_8_11_VALUE_9_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_TXOP_8_11_VALUE_10_MSB 23 -#define MAC_PCU_TXOP_8_11_VALUE_10_LSB 16 -#define MAC_PCU_TXOP_8_11_VALUE_10_MASK 0x00ff0000 -#define MAC_PCU_TXOP_8_11_VALUE_10_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_TXOP_8_11_VALUE_10_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_TXOP_8_11_VALUE_11_MSB 31 -#define MAC_PCU_TXOP_8_11_VALUE_11_LSB 24 -#define MAC_PCU_TXOP_8_11_VALUE_11_MASK 0xff000000 -#define MAC_PCU_TXOP_8_11_VALUE_11_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_TXOP_8_11_VALUE_11_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_TXOP_12_15 */ -#define MAC_PCU_TXOP_12_15_ADDRESS 0x000081fc -#define MAC_PCU_TXOP_12_15_OFFSET 0x000081fc -#define MAC_PCU_TXOP_12_15_VALUE_12_MSB 7 -#define MAC_PCU_TXOP_12_15_VALUE_12_LSB 0 -#define MAC_PCU_TXOP_12_15_VALUE_12_MASK 0x000000ff -#define MAC_PCU_TXOP_12_15_VALUE_12_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_TXOP_12_15_VALUE_12_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_TXOP_12_15_VALUE_13_MSB 15 -#define MAC_PCU_TXOP_12_15_VALUE_13_LSB 8 -#define MAC_PCU_TXOP_12_15_VALUE_13_MASK 0x0000ff00 -#define MAC_PCU_TXOP_12_15_VALUE_13_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_TXOP_12_15_VALUE_13_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_TXOP_12_15_VALUE_14_MSB 23 -#define MAC_PCU_TXOP_12_15_VALUE_14_LSB 16 -#define MAC_PCU_TXOP_12_15_VALUE_14_MASK 0x00ff0000 -#define MAC_PCU_TXOP_12_15_VALUE_14_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_TXOP_12_15_VALUE_14_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_TXOP_12_15_VALUE_15_MSB 31 -#define MAC_PCU_TXOP_12_15_VALUE_15_LSB 24 -#define MAC_PCU_TXOP_12_15_VALUE_15_MASK 0xff000000 -#define MAC_PCU_TXOP_12_15_VALUE_15_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_TXOP_12_15_VALUE_15_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_LSB */ -#define MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_LSB_ADDRESS 0x00008200 -#define MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_LSB_OFFSET 0x00008200 -#define MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_LSB_VALUE_MSB 31 -#define MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_LSB_VALUE_LSB 0 -#define MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_LSB_VALUE_MASK 0xffffffff -#define MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_LSB_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_LSB_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_MSB */ -#define MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_MSB_ADDRESS 0x00008204 -#define MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_MSB_OFFSET 0x00008204 -#define MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_MSB_VALUE_MSB 31 -#define MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_MSB_VALUE_LSB 0 -#define MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_MSB_VALUE_MASK 0xffffffff -#define MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_MSB_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_MSB_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_TDMA_SLOT_ALERT_CNTL */ -#define MAC_PCU_TDMA_SLOT_ALERT_CNTL_ADDRESS 0x00008208 -#define MAC_PCU_TDMA_SLOT_ALERT_CNTL_OFFSET 0x00008208 -#define MAC_PCU_TDMA_SLOT_ALERT_CNTL_VALUE_MSB 15 -#define MAC_PCU_TDMA_SLOT_ALERT_CNTL_VALUE_LSB 0 -#define MAC_PCU_TDMA_SLOT_ALERT_CNTL_VALUE_MASK 0x0000ffff -#define MAC_PCU_TDMA_SLOT_ALERT_CNTL_VALUE_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_TDMA_SLOT_ALERT_CNTL_VALUE_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_PCU_WOW1 */ -#define MAC_PCU_WOW1_ADDRESS 0x0000825c -#define MAC_PCU_WOW1_OFFSET 0x0000825c -#define MAC_PCU_WOW1_PATTERN_ENABLE_MSB 7 -#define MAC_PCU_WOW1_PATTERN_ENABLE_LSB 0 -#define MAC_PCU_WOW1_PATTERN_ENABLE_MASK 0x000000ff -#define MAC_PCU_WOW1_PATTERN_ENABLE_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_WOW1_PATTERN_ENABLE_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_WOW1_PATTERN_DETECT_MSB 15 -#define MAC_PCU_WOW1_PATTERN_DETECT_LSB 8 -#define MAC_PCU_WOW1_PATTERN_DETECT_MASK 0x0000ff00 -#define MAC_PCU_WOW1_PATTERN_DETECT_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_WOW1_MAGIC_ENABLE_MSB 16 -#define MAC_PCU_WOW1_MAGIC_ENABLE_LSB 16 -#define MAC_PCU_WOW1_MAGIC_ENABLE_MASK 0x00010000 -#define MAC_PCU_WOW1_MAGIC_ENABLE_GET(x) (((x) & 0x00010000) >> 16) -#define MAC_PCU_WOW1_MAGIC_ENABLE_SET(x) (((x) << 16) & 0x00010000) -#define MAC_PCU_WOW1_MAGIC_DETECT_MSB 17 -#define MAC_PCU_WOW1_MAGIC_DETECT_LSB 17 -#define MAC_PCU_WOW1_MAGIC_DETECT_MASK 0x00020000 -#define MAC_PCU_WOW1_MAGIC_DETECT_GET(x) (((x) & 0x00020000) >> 17) -#define MAC_PCU_WOW1_INTR_ENABLE_MSB 18 -#define MAC_PCU_WOW1_INTR_ENABLE_LSB 18 -#define MAC_PCU_WOW1_INTR_ENABLE_MASK 0x00040000 -#define MAC_PCU_WOW1_INTR_ENABLE_GET(x) (((x) & 0x00040000) >> 18) -#define MAC_PCU_WOW1_INTR_ENABLE_SET(x) (((x) << 18) & 0x00040000) -#define MAC_PCU_WOW1_INTR_DETECT_MSB 19 -#define MAC_PCU_WOW1_INTR_DETECT_LSB 19 -#define MAC_PCU_WOW1_INTR_DETECT_MASK 0x00080000 -#define MAC_PCU_WOW1_INTR_DETECT_GET(x) (((x) & 0x00080000) >> 19) -#define MAC_PCU_WOW1_KEEP_ALIVE_FAIL_MSB 20 -#define MAC_PCU_WOW1_KEEP_ALIVE_FAIL_LSB 20 -#define MAC_PCU_WOW1_KEEP_ALIVE_FAIL_MASK 0x00100000 -#define MAC_PCU_WOW1_KEEP_ALIVE_FAIL_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_PCU_WOW1_BEACON_FAIL_MSB 21 -#define MAC_PCU_WOW1_BEACON_FAIL_LSB 21 -#define MAC_PCU_WOW1_BEACON_FAIL_MASK 0x00200000 -#define MAC_PCU_WOW1_BEACON_FAIL_GET(x) (((x) & 0x00200000) >> 21) -#define MAC_PCU_WOW1_CW_BITS_MSB 31 -#define MAC_PCU_WOW1_CW_BITS_LSB 28 -#define MAC_PCU_WOW1_CW_BITS_MASK 0xf0000000 -#define MAC_PCU_WOW1_CW_BITS_GET(x) (((x) & 0xf0000000) >> 28) -#define MAC_PCU_WOW1_CW_BITS_SET(x) (((x) << 28) & 0xf0000000) - -/* macros for MAC_PCU_WOW2 */ -#define MAC_PCU_WOW2_ADDRESS 0x00008260 -#define MAC_PCU_WOW2_OFFSET 0x00008260 -#define MAC_PCU_WOW2_AIFS_MSB 7 -#define MAC_PCU_WOW2_AIFS_LSB 0 -#define MAC_PCU_WOW2_AIFS_MASK 0x000000ff -#define MAC_PCU_WOW2_AIFS_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_WOW2_AIFS_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_WOW2_SLOT_MSB 15 -#define MAC_PCU_WOW2_SLOT_LSB 8 -#define MAC_PCU_WOW2_SLOT_MASK 0x0000ff00 -#define MAC_PCU_WOW2_SLOT_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_WOW2_SLOT_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_WOW2_TRY_CNT_MSB 23 -#define MAC_PCU_WOW2_TRY_CNT_LSB 16 -#define MAC_PCU_WOW2_TRY_CNT_MASK 0x00ff0000 -#define MAC_PCU_WOW2_TRY_CNT_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_WOW2_TRY_CNT_SET(x) (((x) << 16) & 0x00ff0000) - -/* macros for MAC_PCU_LOGIC_ANALYZER */ -#define MAC_PCU_LOGIC_ANALYZER_ADDRESS 0x00008264 -#define MAC_PCU_LOGIC_ANALYZER_OFFSET 0x00008264 -#define MAC_PCU_LOGIC_ANALYZER_HOLD_MSB 0 -#define MAC_PCU_LOGIC_ANALYZER_HOLD_LSB 0 -#define MAC_PCU_LOGIC_ANALYZER_HOLD_MASK 0x00000001 -#define MAC_PCU_LOGIC_ANALYZER_HOLD_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_LOGIC_ANALYZER_HOLD_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_LOGIC_ANALYZER_CLEAR_MSB 1 -#define MAC_PCU_LOGIC_ANALYZER_CLEAR_LSB 1 -#define MAC_PCU_LOGIC_ANALYZER_CLEAR_MASK 0x00000002 -#define MAC_PCU_LOGIC_ANALYZER_CLEAR_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_LOGIC_ANALYZER_CLEAR_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_LOGIC_ANALYZER_STATE_MSB 2 -#define MAC_PCU_LOGIC_ANALYZER_STATE_LSB 2 -#define MAC_PCU_LOGIC_ANALYZER_STATE_MASK 0x00000004 -#define MAC_PCU_LOGIC_ANALYZER_STATE_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_LOGIC_ANALYZER_ENABLE_MSB 3 -#define MAC_PCU_LOGIC_ANALYZER_ENABLE_LSB 3 -#define MAC_PCU_LOGIC_ANALYZER_ENABLE_MASK 0x00000008 -#define MAC_PCU_LOGIC_ANALYZER_ENABLE_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_LOGIC_ANALYZER_ENABLE_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_LOGIC_ANALYZER_QCU_SEL_MSB 7 -#define MAC_PCU_LOGIC_ANALYZER_QCU_SEL_LSB 4 -#define MAC_PCU_LOGIC_ANALYZER_QCU_SEL_MASK 0x000000f0 -#define MAC_PCU_LOGIC_ANALYZER_QCU_SEL_GET(x) (((x) & 0x000000f0) >> 4) -#define MAC_PCU_LOGIC_ANALYZER_QCU_SEL_SET(x) (((x) << 4) & 0x000000f0) -#define MAC_PCU_LOGIC_ANALYZER_INT_ADDR_MSB 17 -#define MAC_PCU_LOGIC_ANALYZER_INT_ADDR_LSB 8 -#define MAC_PCU_LOGIC_ANALYZER_INT_ADDR_MASK 0x0003ff00 -#define MAC_PCU_LOGIC_ANALYZER_INT_ADDR_GET(x) (((x) & 0x0003ff00) >> 8) -#define MAC_PCU_LOGIC_ANALYZER_DIAG_MODE_MSB 31 -#define MAC_PCU_LOGIC_ANALYZER_DIAG_MODE_LSB 18 -#define MAC_PCU_LOGIC_ANALYZER_DIAG_MODE_MASK 0xfffc0000 -#define MAC_PCU_LOGIC_ANALYZER_DIAG_MODE_GET(x) (((x) & 0xfffc0000) >> 18) -#define MAC_PCU_LOGIC_ANALYZER_DIAG_MODE_SET(x) (((x) << 18) & 0xfffc0000) - -/* macros for MAC_PCU_LOGIC_ANALYZER_32L */ -#define MAC_PCU_LOGIC_ANALYZER_32L_ADDRESS 0x00008268 -#define MAC_PCU_LOGIC_ANALYZER_32L_OFFSET 0x00008268 -#define MAC_PCU_LOGIC_ANALYZER_32L_MASK_MSB 31 -#define MAC_PCU_LOGIC_ANALYZER_32L_MASK_LSB 0 -#define MAC_PCU_LOGIC_ANALYZER_32L_MASK_MASK 0xffffffff -#define MAC_PCU_LOGIC_ANALYZER_32L_MASK_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_LOGIC_ANALYZER_32L_MASK_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_LOGIC_ANALYZER_16U */ -#define MAC_PCU_LOGIC_ANALYZER_16U_ADDRESS 0x0000826c -#define MAC_PCU_LOGIC_ANALYZER_16U_OFFSET 0x0000826c -#define MAC_PCU_LOGIC_ANALYZER_16U_MASK_MSB 15 -#define MAC_PCU_LOGIC_ANALYZER_16U_MASK_LSB 0 -#define MAC_PCU_LOGIC_ANALYZER_16U_MASK_MASK 0x0000ffff -#define MAC_PCU_LOGIC_ANALYZER_16U_MASK_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_LOGIC_ANALYZER_16U_MASK_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_PCU_WOW3_BEACON_FAIL */ -#define MAC_PCU_WOW3_BEACON_FAIL_ADDRESS 0x00008270 -#define MAC_PCU_WOW3_BEACON_FAIL_OFFSET 0x00008270 -#define MAC_PCU_WOW3_BEACON_FAIL_ENABLE_MSB 0 -#define MAC_PCU_WOW3_BEACON_FAIL_ENABLE_LSB 0 -#define MAC_PCU_WOW3_BEACON_FAIL_ENABLE_MASK 0x00000001 -#define MAC_PCU_WOW3_BEACON_FAIL_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_WOW3_BEACON_FAIL_ENABLE_SET(x) (((x) << 0) & 0x00000001) - -/* macros for MAC_PCU_WOW3_BEACON */ -#define MAC_PCU_WOW3_BEACON_ADDRESS 0x00008274 -#define MAC_PCU_WOW3_BEACON_OFFSET 0x00008274 -#define MAC_PCU_WOW3_BEACON_TIMEOUT_MSB 31 -#define MAC_PCU_WOW3_BEACON_TIMEOUT_LSB 0 -#define MAC_PCU_WOW3_BEACON_TIMEOUT_MASK 0xffffffff -#define MAC_PCU_WOW3_BEACON_TIMEOUT_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_WOW3_BEACON_TIMEOUT_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_WOW3_KEEP_ALIVE */ -#define MAC_PCU_WOW3_KEEP_ALIVE_ADDRESS 0x00008278 -#define MAC_PCU_WOW3_KEEP_ALIVE_OFFSET 0x00008278 -#define MAC_PCU_WOW3_KEEP_ALIVE_TIMEOUT_MSB 31 -#define MAC_PCU_WOW3_KEEP_ALIVE_TIMEOUT_LSB 0 -#define MAC_PCU_WOW3_KEEP_ALIVE_TIMEOUT_MASK 0xffffffff -#define MAC_PCU_WOW3_KEEP_ALIVE_TIMEOUT_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_WOW3_KEEP_ALIVE_TIMEOUT_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_WOW_KA */ -#define MAC_PCU_WOW_KA_ADDRESS 0x0000827c -#define MAC_PCU_WOW_KA_OFFSET 0x0000827c -#define MAC_PCU_WOW_KA_AUTO_DISABLE_MSB 0 -#define MAC_PCU_WOW_KA_AUTO_DISABLE_LSB 0 -#define MAC_PCU_WOW_KA_AUTO_DISABLE_MASK 0x00000001 -#define MAC_PCU_WOW_KA_AUTO_DISABLE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_WOW_KA_AUTO_DISABLE_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_WOW_KA_FAIL_DISABLE_MSB 1 -#define MAC_PCU_WOW_KA_FAIL_DISABLE_LSB 1 -#define MAC_PCU_WOW_KA_FAIL_DISABLE_MASK 0x00000002 -#define MAC_PCU_WOW_KA_FAIL_DISABLE_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_WOW_KA_FAIL_DISABLE_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_WOW_KA_BKOFF_CS_ENABLE_MSB 2 -#define MAC_PCU_WOW_KA_BKOFF_CS_ENABLE_LSB 2 -#define MAC_PCU_WOW_KA_BKOFF_CS_ENABLE_MASK 0x00000004 -#define MAC_PCU_WOW_KA_BKOFF_CS_ENABLE_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_WOW_KA_BKOFF_CS_ENABLE_SET(x) (((x) << 2) & 0x00000004) - -/* macros for PCU_1US */ -#define PCU_1US_ADDRESS 0x00008284 -#define PCU_1US_OFFSET 0x00008284 -#define PCU_1US_SCALER_MSB 6 -#define PCU_1US_SCALER_LSB 0 -#define PCU_1US_SCALER_MASK 0x0000007f -#define PCU_1US_SCALER_GET(x) (((x) & 0x0000007f) >> 0) -#define PCU_1US_SCALER_SET(x) (((x) << 0) & 0x0000007f) - -/* macros for PCU_KA */ -#define PCU_KA_ADDRESS 0x00008288 -#define PCU_KA_OFFSET 0x00008288 -#define PCU_KA_DEL_MSB 11 -#define PCU_KA_DEL_LSB 0 -#define PCU_KA_DEL_MASK 0x00000fff -#define PCU_KA_DEL_GET(x) (((x) & 0x00000fff) >> 0) -#define PCU_KA_DEL_SET(x) (((x) << 0) & 0x00000fff) - -/* macros for WOW_EXACT */ -#define WOW_EXACT_ADDRESS 0x0000828c -#define WOW_EXACT_OFFSET 0x0000828c -#define WOW_EXACT_LENGTH_MSB 7 -#define WOW_EXACT_LENGTH_LSB 0 -#define WOW_EXACT_LENGTH_MASK 0x000000ff -#define WOW_EXACT_LENGTH_GET(x) (((x) & 0x000000ff) >> 0) -#define WOW_EXACT_LENGTH_SET(x) (((x) << 0) & 0x000000ff) -#define WOW_EXACT_OFFSET_MSB 15 -#define WOW_EXACT_OFFSET_LSB 8 -#define WOW_EXACT_OFFSET_MASK 0x0000ff00 -#define WOW_EXACT_OFFSET_GET(x) (((x) & 0x0000ff00) >> 8) -#define WOW_EXACT_OFFSET_SET(x) (((x) << 8) & 0x0000ff00) - -/* macros for PCU_WOW4 */ -#define PCU_WOW4_ADDRESS 0x00008294 -#define PCU_WOW4_OFFSET 0x00008294 -#define PCU_WOW4_OFFSET0_MSB 7 -#define PCU_WOW4_OFFSET0_LSB 0 -#define PCU_WOW4_OFFSET0_MASK 0x000000ff -#define PCU_WOW4_OFFSET0_GET(x) (((x) & 0x000000ff) >> 0) -#define PCU_WOW4_OFFSET0_SET(x) (((x) << 0) & 0x000000ff) -#define PCU_WOW4_OFFSET1_MSB 15 -#define PCU_WOW4_OFFSET1_LSB 8 -#define PCU_WOW4_OFFSET1_MASK 0x0000ff00 -#define PCU_WOW4_OFFSET1_GET(x) (((x) & 0x0000ff00) >> 8) -#define PCU_WOW4_OFFSET1_SET(x) (((x) << 8) & 0x0000ff00) -#define PCU_WOW4_OFFSET2_MSB 23 -#define PCU_WOW4_OFFSET2_LSB 16 -#define PCU_WOW4_OFFSET2_MASK 0x00ff0000 -#define PCU_WOW4_OFFSET2_GET(x) (((x) & 0x00ff0000) >> 16) -#define PCU_WOW4_OFFSET2_SET(x) (((x) << 16) & 0x00ff0000) -#define PCU_WOW4_OFFSET3_MSB 31 -#define PCU_WOW4_OFFSET3_LSB 24 -#define PCU_WOW4_OFFSET3_MASK 0xff000000 -#define PCU_WOW4_OFFSET3_GET(x) (((x) & 0xff000000) >> 24) -#define PCU_WOW4_OFFSET3_SET(x) (((x) << 24) & 0xff000000) - -/* macros for PCU_WOW5 */ -#define PCU_WOW5_ADDRESS 0x00008298 -#define PCU_WOW5_OFFSET 0x00008298 -#define PCU_WOW5_OFFSET4_MSB 7 -#define PCU_WOW5_OFFSET4_LSB 0 -#define PCU_WOW5_OFFSET4_MASK 0x000000ff -#define PCU_WOW5_OFFSET4_GET(x) (((x) & 0x000000ff) >> 0) -#define PCU_WOW5_OFFSET4_SET(x) (((x) << 0) & 0x000000ff) -#define PCU_WOW5_OFFSET5_MSB 15 -#define PCU_WOW5_OFFSET5_LSB 8 -#define PCU_WOW5_OFFSET5_MASK 0x0000ff00 -#define PCU_WOW5_OFFSET5_GET(x) (((x) & 0x0000ff00) >> 8) -#define PCU_WOW5_OFFSET5_SET(x) (((x) << 8) & 0x0000ff00) -#define PCU_WOW5_OFFSET6_MSB 23 -#define PCU_WOW5_OFFSET6_LSB 16 -#define PCU_WOW5_OFFSET6_MASK 0x00ff0000 -#define PCU_WOW5_OFFSET6_GET(x) (((x) & 0x00ff0000) >> 16) -#define PCU_WOW5_OFFSET6_SET(x) (((x) << 16) & 0x00ff0000) -#define PCU_WOW5_OFFSET7_MSB 31 -#define PCU_WOW5_OFFSET7_LSB 24 -#define PCU_WOW5_OFFSET7_MASK 0xff000000 -#define PCU_WOW5_OFFSET7_GET(x) (((x) & 0xff000000) >> 24) -#define PCU_WOW5_OFFSET7_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_PHY_ERR_CNT_MASK_CONT */ -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_ADDRESS 0x0000829c -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_OFFSET 0x0000829c -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK1_MSB 7 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK1_LSB 0 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK1_MASK 0x000000ff -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK1_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK1_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK2_MSB 15 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK2_LSB 8 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK2_MASK 0x0000ff00 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK2_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK2_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK3_MSB 23 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK3_LSB 16 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK3_MASK 0x00ff0000 -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK3_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_PHY_ERR_CNT_MASK_CONT_MASK3_SET(x) (((x) << 16) & 0x00ff0000) - -/* macros for MAC_PCU_AZIMUTH_MODE */ -#define MAC_PCU_AZIMUTH_MODE_ADDRESS 0x00008300 -#define MAC_PCU_AZIMUTH_MODE_OFFSET 0x00008300 -#define MAC_PCU_AZIMUTH_MODE_DISABLE_TSF_UPDATE_MSB 0 -#define MAC_PCU_AZIMUTH_MODE_DISABLE_TSF_UPDATE_LSB 0 -#define MAC_PCU_AZIMUTH_MODE_DISABLE_TSF_UPDATE_MASK 0x00000001 -#define MAC_PCU_AZIMUTH_MODE_DISABLE_TSF_UPDATE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_AZIMUTH_MODE_DISABLE_TSF_UPDATE_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_AZIMUTH_MODE_KEY_SEARCH_AD1_MSB 1 -#define MAC_PCU_AZIMUTH_MODE_KEY_SEARCH_AD1_LSB 1 -#define MAC_PCU_AZIMUTH_MODE_KEY_SEARCH_AD1_MASK 0x00000002 -#define MAC_PCU_AZIMUTH_MODE_KEY_SEARCH_AD1_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_AZIMUTH_MODE_KEY_SEARCH_AD1_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_AZIMUTH_MODE_TX_TSF_STATUS_SEL_MSB 2 -#define MAC_PCU_AZIMUTH_MODE_TX_TSF_STATUS_SEL_LSB 2 -#define MAC_PCU_AZIMUTH_MODE_TX_TSF_STATUS_SEL_MASK 0x00000004 -#define MAC_PCU_AZIMUTH_MODE_TX_TSF_STATUS_SEL_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_AZIMUTH_MODE_TX_TSF_STATUS_SEL_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_AZIMUTH_MODE_RX_TSF_STATUS_SEL_MSB 3 -#define MAC_PCU_AZIMUTH_MODE_RX_TSF_STATUS_SEL_LSB 3 -#define MAC_PCU_AZIMUTH_MODE_RX_TSF_STATUS_SEL_MASK 0x00000008 -#define MAC_PCU_AZIMUTH_MODE_RX_TSF_STATUS_SEL_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_AZIMUTH_MODE_RX_TSF_STATUS_SEL_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_AZIMUTH_MODE_CLK_EN_MSB 4 -#define MAC_PCU_AZIMUTH_MODE_CLK_EN_LSB 4 -#define MAC_PCU_AZIMUTH_MODE_CLK_EN_MASK 0x00000010 -#define MAC_PCU_AZIMUTH_MODE_CLK_EN_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_PCU_AZIMUTH_MODE_CLK_EN_SET(x) (((x) << 4) & 0x00000010) -#define MAC_PCU_AZIMUTH_MODE_TX_DESC_EN_MSB 5 -#define MAC_PCU_AZIMUTH_MODE_TX_DESC_EN_LSB 5 -#define MAC_PCU_AZIMUTH_MODE_TX_DESC_EN_MASK 0x00000020 -#define MAC_PCU_AZIMUTH_MODE_TX_DESC_EN_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_PCU_AZIMUTH_MODE_TX_DESC_EN_SET(x) (((x) << 5) & 0x00000020) -#define MAC_PCU_AZIMUTH_MODE_ACK_CTS_MATCH_TX_AD2_MSB 6 -#define MAC_PCU_AZIMUTH_MODE_ACK_CTS_MATCH_TX_AD2_LSB 6 -#define MAC_PCU_AZIMUTH_MODE_ACK_CTS_MATCH_TX_AD2_MASK 0x00000040 -#define MAC_PCU_AZIMUTH_MODE_ACK_CTS_MATCH_TX_AD2_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_PCU_AZIMUTH_MODE_ACK_CTS_MATCH_TX_AD2_SET(x) (((x) << 6) & 0x00000040) -#define MAC_PCU_AZIMUTH_MODE_BA_USES_AD1_MSB 7 -#define MAC_PCU_AZIMUTH_MODE_BA_USES_AD1_LSB 7 -#define MAC_PCU_AZIMUTH_MODE_BA_USES_AD1_MASK 0x00000080 -#define MAC_PCU_AZIMUTH_MODE_BA_USES_AD1_GET(x) (((x) & 0x00000080) >> 7) -#define MAC_PCU_AZIMUTH_MODE_BA_USES_AD1_SET(x) (((x) << 7) & 0x00000080) -#define MAC_PCU_AZIMUTH_MODE_WMAC_CLK_SEL_MSB 8 -#define MAC_PCU_AZIMUTH_MODE_WMAC_CLK_SEL_LSB 8 -#define MAC_PCU_AZIMUTH_MODE_WMAC_CLK_SEL_MASK 0x00000100 -#define MAC_PCU_AZIMUTH_MODE_WMAC_CLK_SEL_GET(x) (((x) & 0x00000100) >> 8) -#define MAC_PCU_AZIMUTH_MODE_WMAC_CLK_SEL_SET(x) (((x) << 8) & 0x00000100) -#define MAC_PCU_AZIMUTH_MODE_FILTER_PASS_HOLD_MSB 9 -#define MAC_PCU_AZIMUTH_MODE_FILTER_PASS_HOLD_LSB 9 -#define MAC_PCU_AZIMUTH_MODE_FILTER_PASS_HOLD_MASK 0x00000200 -#define MAC_PCU_AZIMUTH_MODE_FILTER_PASS_HOLD_GET(x) (((x) & 0x00000200) >> 9) -#define MAC_PCU_AZIMUTH_MODE_FILTER_PASS_HOLD_SET(x) (((x) << 9) & 0x00000200) - -/* macros for MAC_PCU_AZIMUTH_TIME_STAMP */ -#define MAC_PCU_AZIMUTH_TIME_STAMP_ADDRESS 0x00008314 -#define MAC_PCU_AZIMUTH_TIME_STAMP_OFFSET 0x00008314 -#define MAC_PCU_AZIMUTH_TIME_STAMP_VALUE_MSB 31 -#define MAC_PCU_AZIMUTH_TIME_STAMP_VALUE_LSB 0 -#define MAC_PCU_AZIMUTH_TIME_STAMP_VALUE_MASK 0xffffffff -#define MAC_PCU_AZIMUTH_TIME_STAMP_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_AZIMUTH_TIME_STAMP_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_20_40_MODE */ -#define MAC_PCU_20_40_MODE_ADDRESS 0x00008318 -#define MAC_PCU_20_40_MODE_OFFSET 0x00008318 -#define MAC_PCU_20_40_MODE_JOINED_RX_CLEAR_MSB 0 -#define MAC_PCU_20_40_MODE_JOINED_RX_CLEAR_LSB 0 -#define MAC_PCU_20_40_MODE_JOINED_RX_CLEAR_MASK 0x00000001 -#define MAC_PCU_20_40_MODE_JOINED_RX_CLEAR_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_20_40_MODE_JOINED_RX_CLEAR_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_20_40_MODE_EXT_PIFS_ENABLE_MSB 1 -#define MAC_PCU_20_40_MODE_EXT_PIFS_ENABLE_LSB 1 -#define MAC_PCU_20_40_MODE_EXT_PIFS_ENABLE_MASK 0x00000002 -#define MAC_PCU_20_40_MODE_EXT_PIFS_ENABLE_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_20_40_MODE_EXT_PIFS_ENABLE_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_20_40_MODE_TX_HT20_ON_EXT_BUSY_MSB 2 -#define MAC_PCU_20_40_MODE_TX_HT20_ON_EXT_BUSY_LSB 2 -#define MAC_PCU_20_40_MODE_TX_HT20_ON_EXT_BUSY_MASK 0x00000004 -#define MAC_PCU_20_40_MODE_TX_HT20_ON_EXT_BUSY_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_20_40_MODE_TX_HT20_ON_EXT_BUSY_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_20_40_MODE_SWAMPED_FORCES_RX_CLEAR_CTL_IDLE_MSB 3 -#define MAC_PCU_20_40_MODE_SWAMPED_FORCES_RX_CLEAR_CTL_IDLE_LSB 3 -#define MAC_PCU_20_40_MODE_SWAMPED_FORCES_RX_CLEAR_CTL_IDLE_MASK 0x00000008 -#define MAC_PCU_20_40_MODE_SWAMPED_FORCES_RX_CLEAR_CTL_IDLE_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_20_40_MODE_SWAMPED_FORCES_RX_CLEAR_CTL_IDLE_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_20_40_MODE_PIFS_CYCLES_MSB 15 -#define MAC_PCU_20_40_MODE_PIFS_CYCLES_LSB 4 -#define MAC_PCU_20_40_MODE_PIFS_CYCLES_MASK 0x0000fff0 -#define MAC_PCU_20_40_MODE_PIFS_CYCLES_GET(x) (((x) & 0x0000fff0) >> 4) -#define MAC_PCU_20_40_MODE_PIFS_CYCLES_SET(x) (((x) << 4) & 0x0000fff0) - -/* macros for MAC_PCU_H_XFER_TIMEOUT */ -#define MAC_PCU_H_XFER_TIMEOUT_ADDRESS 0x0000831c -#define MAC_PCU_H_XFER_TIMEOUT_OFFSET 0x0000831c -#define MAC_PCU_H_XFER_TIMEOUT_VALUE_MSB 4 -#define MAC_PCU_H_XFER_TIMEOUT_VALUE_LSB 0 -#define MAC_PCU_H_XFER_TIMEOUT_VALUE_MASK 0x0000001f -#define MAC_PCU_H_XFER_TIMEOUT_VALUE_GET(x) (((x) & 0x0000001f) >> 0) -#define MAC_PCU_H_XFER_TIMEOUT_VALUE_SET(x) (((x) << 0) & 0x0000001f) -#define MAC_PCU_H_XFER_TIMEOUT_DISABLE_MSB 5 -#define MAC_PCU_H_XFER_TIMEOUT_DISABLE_LSB 5 -#define MAC_PCU_H_XFER_TIMEOUT_DISABLE_MASK 0x00000020 -#define MAC_PCU_H_XFER_TIMEOUT_DISABLE_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_PCU_H_XFER_TIMEOUT_DISABLE_SET(x) (((x) << 5) & 0x00000020) -#define MAC_PCU_H_XFER_TIMEOUT_EXTXBF_IMMEDIATE_RESP_MSB 6 -#define MAC_PCU_H_XFER_TIMEOUT_EXTXBF_IMMEDIATE_RESP_LSB 6 -#define MAC_PCU_H_XFER_TIMEOUT_EXTXBF_IMMEDIATE_RESP_MASK 0x00000040 -#define MAC_PCU_H_XFER_TIMEOUT_EXTXBF_IMMEDIATE_RESP_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_PCU_H_XFER_TIMEOUT_EXTXBF_IMMEDIATE_RESP_SET(x) (((x) << 6) & 0x00000040) -#define MAC_PCU_H_XFER_TIMEOUT_DELAY_EXTXBF_ONLY_UPLOAD_H_MSB 7 -#define MAC_PCU_H_XFER_TIMEOUT_DELAY_EXTXBF_ONLY_UPLOAD_H_LSB 7 -#define MAC_PCU_H_XFER_TIMEOUT_DELAY_EXTXBF_ONLY_UPLOAD_H_MASK 0x00000080 -#define MAC_PCU_H_XFER_TIMEOUT_DELAY_EXTXBF_ONLY_UPLOAD_H_GET(x) (((x) & 0x00000080) >> 7) -#define MAC_PCU_H_XFER_TIMEOUT_DELAY_EXTXBF_ONLY_UPLOAD_H_SET(x) (((x) << 7) & 0x00000080) -#define MAC_PCU_H_XFER_TIMEOUT_EXTXBF_NOACK_NORPT_MSB 8 -#define MAC_PCU_H_XFER_TIMEOUT_EXTXBF_NOACK_NORPT_LSB 8 -#define MAC_PCU_H_XFER_TIMEOUT_EXTXBF_NOACK_NORPT_MASK 0x00000100 -#define MAC_PCU_H_XFER_TIMEOUT_EXTXBF_NOACK_NORPT_GET(x) (((x) & 0x00000100) >> 8) -#define MAC_PCU_H_XFER_TIMEOUT_EXTXBF_NOACK_NORPT_SET(x) (((x) << 8) & 0x00000100) - -/* macros for MAC_PCU_RX_CLEAR_DIFF_CNT */ -#define MAC_PCU_RX_CLEAR_DIFF_CNT_ADDRESS 0x00008328 -#define MAC_PCU_RX_CLEAR_DIFF_CNT_OFFSET 0x00008328 -#define MAC_PCU_RX_CLEAR_DIFF_CNT_VALUE_MSB 31 -#define MAC_PCU_RX_CLEAR_DIFF_CNT_VALUE_LSB 0 -#define MAC_PCU_RX_CLEAR_DIFF_CNT_VALUE_MASK 0xffffffff -#define MAC_PCU_RX_CLEAR_DIFF_CNT_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_RX_CLEAR_DIFF_CNT_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_SELF_GEN_ANTENNA_MASK */ -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_ADDRESS 0x0000832c -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_OFFSET 0x0000832c -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_VALUE_MSB 2 -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_VALUE_LSB 0 -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_VALUE_MASK 0x00000007 -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_VALUE_GET(x) (((x) & 0x00000007) >> 0) -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_VALUE_SET(x) (((x) << 0) & 0x00000007) -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_ONE_RESP_EN_MSB 3 -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_ONE_RESP_EN_LSB 3 -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_ONE_RESP_EN_MASK 0x00000008 -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_ONE_RESP_EN_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_ONE_RESP_EN_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_FORCE_CHAIN_0_MSB 4 -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_FORCE_CHAIN_0_LSB 4 -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_FORCE_CHAIN_0_MASK 0x00000010 -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_FORCE_CHAIN_0_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_PCU_SELF_GEN_ANTENNA_MASK_FORCE_CHAIN_0_SET(x) (((x) << 4) & 0x00000010) - -/* macros for MAC_PCU_BA_BAR_CONTROL */ -#define MAC_PCU_BA_BAR_CONTROL_ADDRESS 0x00008330 -#define MAC_PCU_BA_BAR_CONTROL_OFFSET 0x00008330 -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_OFFSET_MSB 3 -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_OFFSET_LSB 0 -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_OFFSET_MASK 0x0000000f -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_OFFSET_GET(x) (((x) & 0x0000000f) >> 0) -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_OFFSET_SET(x) (((x) << 0) & 0x0000000f) -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_OFFSET_MSB 7 -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_OFFSET_LSB 4 -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_OFFSET_MASK 0x000000f0 -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_OFFSET_GET(x) (((x) & 0x000000f0) >> 4) -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_OFFSET_SET(x) (((x) << 4) & 0x000000f0) -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_VALUE_MSB 8 -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_VALUE_LSB 8 -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_VALUE_MASK 0x00000100 -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_VALUE_GET(x) (((x) & 0x00000100) >> 8) -#define MAC_PCU_BA_BAR_CONTROL_COMPRESSED_VALUE_SET(x) (((x) << 8) & 0x00000100) -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_VALUE_MSB 9 -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_VALUE_LSB 9 -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_VALUE_MASK 0x00000200 -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_VALUE_GET(x) (((x) & 0x00000200) >> 9) -#define MAC_PCU_BA_BAR_CONTROL_ACK_POLICY_VALUE_SET(x) (((x) << 9) & 0x00000200) -#define MAC_PCU_BA_BAR_CONTROL_FORCE_NO_MATCH_MSB 10 -#define MAC_PCU_BA_BAR_CONTROL_FORCE_NO_MATCH_LSB 10 -#define MAC_PCU_BA_BAR_CONTROL_FORCE_NO_MATCH_MASK 0x00000400 -#define MAC_PCU_BA_BAR_CONTROL_FORCE_NO_MATCH_GET(x) (((x) & 0x00000400) >> 10) -#define MAC_PCU_BA_BAR_CONTROL_FORCE_NO_MATCH_SET(x) (((x) << 10) & 0x00000400) -#define MAC_PCU_BA_BAR_CONTROL_TX_BA_CLEAR_BA_VALID_MSB 11 -#define MAC_PCU_BA_BAR_CONTROL_TX_BA_CLEAR_BA_VALID_LSB 11 -#define MAC_PCU_BA_BAR_CONTROL_TX_BA_CLEAR_BA_VALID_MASK 0x00000800 -#define MAC_PCU_BA_BAR_CONTROL_TX_BA_CLEAR_BA_VALID_GET(x) (((x) & 0x00000800) >> 11) -#define MAC_PCU_BA_BAR_CONTROL_TX_BA_CLEAR_BA_VALID_SET(x) (((x) << 11) & 0x00000800) -#define MAC_PCU_BA_BAR_CONTROL_UPDATE_BA_BITMAP_QOS_NULL_MSB 12 -#define MAC_PCU_BA_BAR_CONTROL_UPDATE_BA_BITMAP_QOS_NULL_LSB 12 -#define MAC_PCU_BA_BAR_CONTROL_UPDATE_BA_BITMAP_QOS_NULL_MASK 0x00001000 -#define MAC_PCU_BA_BAR_CONTROL_UPDATE_BA_BITMAP_QOS_NULL_GET(x) (((x) & 0x00001000) >> 12) -#define MAC_PCU_BA_BAR_CONTROL_UPDATE_BA_BITMAP_QOS_NULL_SET(x) (((x) << 12) & 0x00001000) - -/* macros for MAC_PCU_LEGACY_PLCP_SPOOF */ -#define MAC_PCU_LEGACY_PLCP_SPOOF_ADDRESS 0x00008334 -#define MAC_PCU_LEGACY_PLCP_SPOOF_OFFSET 0x00008334 -#define MAC_PCU_LEGACY_PLCP_SPOOF_EIFS_MINUS_DIFS_MSB 7 -#define MAC_PCU_LEGACY_PLCP_SPOOF_EIFS_MINUS_DIFS_LSB 0 -#define MAC_PCU_LEGACY_PLCP_SPOOF_EIFS_MINUS_DIFS_MASK 0x000000ff -#define MAC_PCU_LEGACY_PLCP_SPOOF_EIFS_MINUS_DIFS_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_LEGACY_PLCP_SPOOF_EIFS_MINUS_DIFS_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_LEGACY_PLCP_SPOOF_MIN_LENGTH_MSB 12 -#define MAC_PCU_LEGACY_PLCP_SPOOF_MIN_LENGTH_LSB 8 -#define MAC_PCU_LEGACY_PLCP_SPOOF_MIN_LENGTH_MASK 0x00001f00 -#define MAC_PCU_LEGACY_PLCP_SPOOF_MIN_LENGTH_GET(x) (((x) & 0x00001f00) >> 8) -#define MAC_PCU_LEGACY_PLCP_SPOOF_MIN_LENGTH_SET(x) (((x) << 8) & 0x00001f00) - -/* macros for MAC_PCU_PHY_ERROR_MASK_CONT */ -#define MAC_PCU_PHY_ERROR_MASK_CONT_ADDRESS 0x00008338 -#define MAC_PCU_PHY_ERROR_MASK_CONT_OFFSET 0x00008338 -#define MAC_PCU_PHY_ERROR_MASK_CONT_MASK_VALUE_MSB 7 -#define MAC_PCU_PHY_ERROR_MASK_CONT_MASK_VALUE_LSB 0 -#define MAC_PCU_PHY_ERROR_MASK_CONT_MASK_VALUE_MASK 0x000000ff -#define MAC_PCU_PHY_ERROR_MASK_CONT_MASK_VALUE_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_PHY_ERROR_MASK_CONT_MASK_VALUE_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_PHY_ERROR_MASK_CONT_EIFS_VALUE_MSB 23 -#define MAC_PCU_PHY_ERROR_MASK_CONT_EIFS_VALUE_LSB 16 -#define MAC_PCU_PHY_ERROR_MASK_CONT_EIFS_VALUE_MASK 0x00ff0000 -#define MAC_PCU_PHY_ERROR_MASK_CONT_EIFS_VALUE_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_PHY_ERROR_MASK_CONT_EIFS_VALUE_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_PHY_ERROR_MASK_CONT_AIFS_VALUE_MSB 31 -#define MAC_PCU_PHY_ERROR_MASK_CONT_AIFS_VALUE_LSB 24 -#define MAC_PCU_PHY_ERROR_MASK_CONT_AIFS_VALUE_MASK 0xff000000 -#define MAC_PCU_PHY_ERROR_MASK_CONT_AIFS_VALUE_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_PHY_ERROR_MASK_CONT_AIFS_VALUE_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_TX_TIMER */ -#define MAC_PCU_TX_TIMER_ADDRESS 0x0000833c -#define MAC_PCU_TX_TIMER_OFFSET 0x0000833c -#define MAC_PCU_TX_TIMER_TX_TIMER_MSB 14 -#define MAC_PCU_TX_TIMER_TX_TIMER_LSB 0 -#define MAC_PCU_TX_TIMER_TX_TIMER_MASK 0x00007fff -#define MAC_PCU_TX_TIMER_TX_TIMER_GET(x) (((x) & 0x00007fff) >> 0) -#define MAC_PCU_TX_TIMER_TX_TIMER_SET(x) (((x) << 0) & 0x00007fff) -#define MAC_PCU_TX_TIMER_TX_TIMER_ENABLE_MSB 15 -#define MAC_PCU_TX_TIMER_TX_TIMER_ENABLE_LSB 15 -#define MAC_PCU_TX_TIMER_TX_TIMER_ENABLE_MASK 0x00008000 -#define MAC_PCU_TX_TIMER_TX_TIMER_ENABLE_GET(x) (((x) & 0x00008000) >> 15) -#define MAC_PCU_TX_TIMER_TX_TIMER_ENABLE_SET(x) (((x) << 15) & 0x00008000) -#define MAC_PCU_TX_TIMER_RIFS_TIMER_MSB 19 -#define MAC_PCU_TX_TIMER_RIFS_TIMER_LSB 16 -#define MAC_PCU_TX_TIMER_RIFS_TIMER_MASK 0x000f0000 -#define MAC_PCU_TX_TIMER_RIFS_TIMER_GET(x) (((x) & 0x000f0000) >> 16) -#define MAC_PCU_TX_TIMER_RIFS_TIMER_SET(x) (((x) << 16) & 0x000f0000) -#define MAC_PCU_TX_TIMER_QUIET_TIMER_MSB 24 -#define MAC_PCU_TX_TIMER_QUIET_TIMER_LSB 20 -#define MAC_PCU_TX_TIMER_QUIET_TIMER_MASK 0x01f00000 -#define MAC_PCU_TX_TIMER_QUIET_TIMER_GET(x) (((x) & 0x01f00000) >> 20) -#define MAC_PCU_TX_TIMER_QUIET_TIMER_SET(x) (((x) << 20) & 0x01f00000) -#define MAC_PCU_TX_TIMER_QUIET_TIMER_ENABLE_MSB 25 -#define MAC_PCU_TX_TIMER_QUIET_TIMER_ENABLE_LSB 25 -#define MAC_PCU_TX_TIMER_QUIET_TIMER_ENABLE_MASK 0x02000000 -#define MAC_PCU_TX_TIMER_QUIET_TIMER_ENABLE_GET(x) (((x) & 0x02000000) >> 25) -#define MAC_PCU_TX_TIMER_QUIET_TIMER_ENABLE_SET(x) (((x) << 25) & 0x02000000) - -/* macros for MAC_PCU_TXBUF_CTRL */ -#define MAC_PCU_TXBUF_CTRL_ADDRESS 0x00008340 -#define MAC_PCU_TXBUF_CTRL_OFFSET 0x00008340 -#define MAC_PCU_TXBUF_CTRL_USABLE_ENTRIES_MSB 11 -#define MAC_PCU_TXBUF_CTRL_USABLE_ENTRIES_LSB 0 -#define MAC_PCU_TXBUF_CTRL_USABLE_ENTRIES_MASK 0x00000fff -#define MAC_PCU_TXBUF_CTRL_USABLE_ENTRIES_GET(x) (((x) & 0x00000fff) >> 0) -#define MAC_PCU_TXBUF_CTRL_USABLE_ENTRIES_SET(x) (((x) << 0) & 0x00000fff) -#define MAC_PCU_TXBUF_CTRL_TX_FIFO_WRAP_ENABLE_MSB 16 -#define MAC_PCU_TXBUF_CTRL_TX_FIFO_WRAP_ENABLE_LSB 16 -#define MAC_PCU_TXBUF_CTRL_TX_FIFO_WRAP_ENABLE_MASK 0x00010000 -#define MAC_PCU_TXBUF_CTRL_TX_FIFO_WRAP_ENABLE_GET(x) (((x) & 0x00010000) >> 16) -#define MAC_PCU_TXBUF_CTRL_TX_FIFO_WRAP_ENABLE_SET(x) (((x) << 16) & 0x00010000) - -/* macros for MAC_PCU_MISC_MODE2 */ -#define MAC_PCU_MISC_MODE2_ADDRESS 0x00008344 -#define MAC_PCU_MISC_MODE2_OFFSET 0x00008344 -#define MAC_PCU_MISC_MODE2_BUG_21532_FIX_ENABLE_MSB 0 -#define MAC_PCU_MISC_MODE2_BUG_21532_FIX_ENABLE_LSB 0 -#define MAC_PCU_MISC_MODE2_BUG_21532_FIX_ENABLE_MASK 0x00000001 -#define MAC_PCU_MISC_MODE2_BUG_21532_FIX_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_MISC_MODE2_BUG_21532_FIX_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE_MSB 1 -#define MAC_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE_LSB 1 -#define MAC_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE_MASK 0x00000002 -#define MAC_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT_MSB 2 -#define MAC_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT_LSB 2 -#define MAC_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT_MASK 0x00000004 -#define MAC_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_MISC_MODE2_BUG_58603_FIX_ENABLE_MSB 3 -#define MAC_PCU_MISC_MODE2_BUG_58603_FIX_ENABLE_LSB 3 -#define MAC_PCU_MISC_MODE2_BUG_58603_FIX_ENABLE_MASK 0x00000008 -#define MAC_PCU_MISC_MODE2_BUG_58603_FIX_ENABLE_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_MISC_MODE2_BUG_58603_FIX_ENABLE_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_MISC_MODE2_BUG_58057_FIX_ENABLE_MSB 4 -#define MAC_PCU_MISC_MODE2_BUG_58057_FIX_ENABLE_LSB 4 -#define MAC_PCU_MISC_MODE2_BUG_58057_FIX_ENABLE_MASK 0x00000010 -#define MAC_PCU_MISC_MODE2_BUG_58057_FIX_ENABLE_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_PCU_MISC_MODE2_BUG_58057_FIX_ENABLE_SET(x) (((x) << 4) & 0x00000010) -#define MAC_PCU_MISC_MODE2_RESERVED_0_MSB 5 -#define MAC_PCU_MISC_MODE2_RESERVED_0_LSB 5 -#define MAC_PCU_MISC_MODE2_RESERVED_0_MASK 0x00000020 -#define MAC_PCU_MISC_MODE2_RESERVED_0_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_PCU_MISC_MODE2_RESERVED_0_SET(x) (((x) << 5) & 0x00000020) -#define MAC_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE_MSB 6 -#define MAC_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE_LSB 6 -#define MAC_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE_MASK 0x00000040 -#define MAC_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE_SET(x) (((x) << 6) & 0x00000040) -#define MAC_PCU_MISC_MODE2_CFP_IGNORE_MSB 7 -#define MAC_PCU_MISC_MODE2_CFP_IGNORE_LSB 7 -#define MAC_PCU_MISC_MODE2_CFP_IGNORE_MASK 0x00000080 -#define MAC_PCU_MISC_MODE2_CFP_IGNORE_GET(x) (((x) & 0x00000080) >> 7) -#define MAC_PCU_MISC_MODE2_CFP_IGNORE_SET(x) (((x) << 7) & 0x00000080) -#define MAC_PCU_MISC_MODE2_MGMT_QOS_MSB 15 -#define MAC_PCU_MISC_MODE2_MGMT_QOS_LSB 8 -#define MAC_PCU_MISC_MODE2_MGMT_QOS_MASK 0x0000ff00 -#define MAC_PCU_MISC_MODE2_MGMT_QOS_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_MISC_MODE2_MGMT_QOS_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION_MSB 16 -#define MAC_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION_LSB 16 -#define MAC_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION_MASK 0x00010000 -#define MAC_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION_GET(x) (((x) & 0x00010000) >> 16) -#define MAC_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION_SET(x) (((x) << 16) & 0x00010000) -#define MAC_PCU_MISC_MODE2_AGG_WEP_MSB 17 -#define MAC_PCU_MISC_MODE2_AGG_WEP_LSB 17 -#define MAC_PCU_MISC_MODE2_AGG_WEP_MASK 0x00020000 -#define MAC_PCU_MISC_MODE2_AGG_WEP_GET(x) (((x) & 0x00020000) >> 17) -#define MAC_PCU_MISC_MODE2_AGG_WEP_SET(x) (((x) << 17) & 0x00020000) -#define MAC_PCU_MISC_MODE2_BC_MC_WAPI_MODE_MSB 18 -#define MAC_PCU_MISC_MODE2_BC_MC_WAPI_MODE_LSB 18 -#define MAC_PCU_MISC_MODE2_BC_MC_WAPI_MODE_MASK 0x00040000 -#define MAC_PCU_MISC_MODE2_BC_MC_WAPI_MODE_GET(x) (((x) & 0x00040000) >> 18) -#define MAC_PCU_MISC_MODE2_BC_MC_WAPI_MODE_SET(x) (((x) << 18) & 0x00040000) -#define MAC_PCU_MISC_MODE2_DUR_ACCOUNT_BY_BA_MSB 19 -#define MAC_PCU_MISC_MODE2_DUR_ACCOUNT_BY_BA_LSB 19 -#define MAC_PCU_MISC_MODE2_DUR_ACCOUNT_BY_BA_MASK 0x00080000 -#define MAC_PCU_MISC_MODE2_DUR_ACCOUNT_BY_BA_GET(x) (((x) & 0x00080000) >> 19) -#define MAC_PCU_MISC_MODE2_DUR_ACCOUNT_BY_BA_SET(x) (((x) << 19) & 0x00080000) -#define MAC_PCU_MISC_MODE2_BUG_28676_MSB 20 -#define MAC_PCU_MISC_MODE2_BUG_28676_LSB 20 -#define MAC_PCU_MISC_MODE2_BUG_28676_MASK 0x00100000 -#define MAC_PCU_MISC_MODE2_BUG_28676_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_PCU_MISC_MODE2_BUG_28676_SET(x) (((x) << 20) & 0x00100000) -#define MAC_PCU_MISC_MODE2_CLEAR_MORE_FRAG_MSB 21 -#define MAC_PCU_MISC_MODE2_CLEAR_MORE_FRAG_LSB 21 -#define MAC_PCU_MISC_MODE2_CLEAR_MORE_FRAG_MASK 0x00200000 -#define MAC_PCU_MISC_MODE2_CLEAR_MORE_FRAG_GET(x) (((x) & 0x00200000) >> 21) -#define MAC_PCU_MISC_MODE2_CLEAR_MORE_FRAG_SET(x) (((x) << 21) & 0x00200000) -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_1ST_PKT_MSB 22 -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_1ST_PKT_LSB 22 -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_1ST_PKT_MASK 0x00400000 -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_1ST_PKT_GET(x) (((x) & 0x00400000) >> 22) -#define MAC_PCU_MISC_MODE2_IGNORE_TXOP_1ST_PKT_SET(x) (((x) << 22) & 0x00400000) -#define MAC_PCU_MISC_MODE2_MPDU_DENSITY_STS_FIX_MSB 23 -#define MAC_PCU_MISC_MODE2_MPDU_DENSITY_STS_FIX_LSB 23 -#define MAC_PCU_MISC_MODE2_MPDU_DENSITY_STS_FIX_MASK 0x00800000 -#define MAC_PCU_MISC_MODE2_MPDU_DENSITY_STS_FIX_GET(x) (((x) & 0x00800000) >> 23) -#define MAC_PCU_MISC_MODE2_MPDU_DENSITY_STS_FIX_SET(x) (((x) << 23) & 0x00800000) -#define MAC_PCU_MISC_MODE2_MPDU_DENSITY_WAIT_WEP_MSB 24 -#define MAC_PCU_MISC_MODE2_MPDU_DENSITY_WAIT_WEP_LSB 24 -#define MAC_PCU_MISC_MODE2_MPDU_DENSITY_WAIT_WEP_MASK 0x01000000 -#define MAC_PCU_MISC_MODE2_MPDU_DENSITY_WAIT_WEP_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_PCU_MISC_MODE2_MPDU_DENSITY_WAIT_WEP_SET(x) (((x) << 24) & 0x01000000) -#define MAC_PCU_MISC_MODE2_RCV_TIMESTAMP_FIX_MSB 25 -#define MAC_PCU_MISC_MODE2_RCV_TIMESTAMP_FIX_LSB 25 -#define MAC_PCU_MISC_MODE2_RCV_TIMESTAMP_FIX_MASK 0x02000000 -#define MAC_PCU_MISC_MODE2_RCV_TIMESTAMP_FIX_GET(x) (((x) & 0x02000000) >> 25) -#define MAC_PCU_MISC_MODE2_RCV_TIMESTAMP_FIX_SET(x) (((x) << 25) & 0x02000000) -#define MAC_PCU_MISC_MODE2_DECOUPLE_DECRYPTION_MSB 27 -#define MAC_PCU_MISC_MODE2_DECOUPLE_DECRYPTION_LSB 27 -#define MAC_PCU_MISC_MODE2_DECOUPLE_DECRYPTION_MASK 0x08000000 -#define MAC_PCU_MISC_MODE2_DECOUPLE_DECRYPTION_GET(x) (((x) & 0x08000000) >> 27) -#define MAC_PCU_MISC_MODE2_DECOUPLE_DECRYPTION_SET(x) (((x) << 27) & 0x08000000) -#define MAC_PCU_MISC_MODE2_H_TO_SW_DEBUG_MODE_MSB 28 -#define MAC_PCU_MISC_MODE2_H_TO_SW_DEBUG_MODE_LSB 28 -#define MAC_PCU_MISC_MODE2_H_TO_SW_DEBUG_MODE_MASK 0x10000000 -#define MAC_PCU_MISC_MODE2_H_TO_SW_DEBUG_MODE_GET(x) (((x) & 0x10000000) >> 28) -#define MAC_PCU_MISC_MODE2_H_TO_SW_DEBUG_MODE_SET(x) (((x) << 28) & 0x10000000) -#define MAC_PCU_MISC_MODE2_TXBF_ACT_RPT_DONE_PASS_MSB 29 -#define MAC_PCU_MISC_MODE2_TXBF_ACT_RPT_DONE_PASS_LSB 29 -#define MAC_PCU_MISC_MODE2_TXBF_ACT_RPT_DONE_PASS_MASK 0x20000000 -#define MAC_PCU_MISC_MODE2_TXBF_ACT_RPT_DONE_PASS_GET(x) (((x) & 0x20000000) >> 29) -#define MAC_PCU_MISC_MODE2_TXBF_ACT_RPT_DONE_PASS_SET(x) (((x) << 29) & 0x20000000) -#define MAC_PCU_MISC_MODE2_PCU_LOOP_TXBF_MSB 30 -#define MAC_PCU_MISC_MODE2_PCU_LOOP_TXBF_LSB 30 -#define MAC_PCU_MISC_MODE2_PCU_LOOP_TXBF_MASK 0x40000000 -#define MAC_PCU_MISC_MODE2_PCU_LOOP_TXBF_GET(x) (((x) & 0x40000000) >> 30) -#define MAC_PCU_MISC_MODE2_PCU_LOOP_TXBF_SET(x) (((x) << 30) & 0x40000000) -#define MAC_PCU_MISC_MODE2_CLEAR_WEP_TXBUSY_ON_TXURN_MSB 31 -#define MAC_PCU_MISC_MODE2_CLEAR_WEP_TXBUSY_ON_TXURN_LSB 31 -#define MAC_PCU_MISC_MODE2_CLEAR_WEP_TXBUSY_ON_TXURN_MASK 0x80000000 -#define MAC_PCU_MISC_MODE2_CLEAR_WEP_TXBUSY_ON_TXURN_GET(x) (((x) & 0x80000000) >> 31) -#define MAC_PCU_MISC_MODE2_CLEAR_WEP_TXBUSY_ON_TXURN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for MAC_PCU_ALT_AES_MUTE_MASK */ -#define MAC_PCU_ALT_AES_MUTE_MASK_ADDRESS 0x00008348 -#define MAC_PCU_ALT_AES_MUTE_MASK_OFFSET 0x00008348 -#define MAC_PCU_ALT_AES_MUTE_MASK_QOS_MSB 31 -#define MAC_PCU_ALT_AES_MUTE_MASK_QOS_LSB 16 -#define MAC_PCU_ALT_AES_MUTE_MASK_QOS_MASK 0xffff0000 -#define MAC_PCU_ALT_AES_MUTE_MASK_QOS_GET(x) (((x) & 0xffff0000) >> 16) -#define MAC_PCU_ALT_AES_MUTE_MASK_QOS_SET(x) (((x) << 16) & 0xffff0000) - -/* macros for MAC_PCU_WOW6 */ -#define MAC_PCU_WOW6_ADDRESS 0x0000834c -#define MAC_PCU_WOW6_OFFSET 0x0000834c -#define MAC_PCU_WOW6_RXBUF_START_ADDR_MSB 15 -#define MAC_PCU_WOW6_RXBUF_START_ADDR_LSB 0 -#define MAC_PCU_WOW6_RXBUF_START_ADDR_MASK 0x0000ffff -#define MAC_PCU_WOW6_RXBUF_START_ADDR_GET(x) (((x) & 0x0000ffff) >> 0) - -/* macros for ASYNC_FIFO_REG1 */ -#define ASYNC_FIFO_REG1_ADDRESS 0x00008350 -#define ASYNC_FIFO_REG1_OFFSET 0x00008350 -#define ASYNC_FIFO_REG1_DBG_MSB 29 -#define ASYNC_FIFO_REG1_DBG_LSB 0 -#define ASYNC_FIFO_REG1_DBG_MASK 0x3fffffff -#define ASYNC_FIFO_REG1_DBG_GET(x) (((x) & 0x3fffffff) >> 0) -#define ASYNC_FIFO_REG1_DBG_SET(x) (((x) << 0) & 0x3fffffff) - -/* macros for ASYNC_FIFO_REG2 */ -#define ASYNC_FIFO_REG2_ADDRESS 0x00008354 -#define ASYNC_FIFO_REG2_OFFSET 0x00008354 -#define ASYNC_FIFO_REG2_DBG_MSB 27 -#define ASYNC_FIFO_REG2_DBG_LSB 0 -#define ASYNC_FIFO_REG2_DBG_MASK 0x0fffffff -#define ASYNC_FIFO_REG2_DBG_GET(x) (((x) & 0x0fffffff) >> 0) -#define ASYNC_FIFO_REG2_DBG_SET(x) (((x) << 0) & 0x0fffffff) - -/* macros for ASYNC_FIFO_REG3 */ -#define ASYNC_FIFO_REG3_ADDRESS 0x00008358 -#define ASYNC_FIFO_REG3_OFFSET 0x00008358 -#define ASYNC_FIFO_REG3_DBG_MSB 9 -#define ASYNC_FIFO_REG3_DBG_LSB 0 -#define ASYNC_FIFO_REG3_DBG_MASK 0x000003ff -#define ASYNC_FIFO_REG3_DBG_GET(x) (((x) & 0x000003ff) >> 0) -#define ASYNC_FIFO_REG3_DBG_SET(x) (((x) << 0) & 0x000003ff) -#define ASYNC_FIFO_REG3_DATAPATH_SEL_MSB 10 -#define ASYNC_FIFO_REG3_DATAPATH_SEL_LSB 10 -#define ASYNC_FIFO_REG3_DATAPATH_SEL_MASK 0x00000400 -#define ASYNC_FIFO_REG3_DATAPATH_SEL_GET(x) (((x) & 0x00000400) >> 10) -#define ASYNC_FIFO_REG3_DATAPATH_SEL_SET(x) (((x) << 10) & 0x00000400) -#define ASYNC_FIFO_REG3_SFT_RST_N_MSB 31 -#define ASYNC_FIFO_REG3_SFT_RST_N_LSB 31 -#define ASYNC_FIFO_REG3_SFT_RST_N_MASK 0x80000000 -#define ASYNC_FIFO_REG3_SFT_RST_N_GET(x) (((x) & 0x80000000) >> 31) -#define ASYNC_FIFO_REG3_SFT_RST_N_SET(x) (((x) << 31) & 0x80000000) - -/* macros for MAC_PCU_WOW5 */ -#define MAC_PCU_WOW5_ADDRESS 0x0000835c -#define MAC_PCU_WOW5_OFFSET 0x0000835c -#define MAC_PCU_WOW5_RX_ABORT_ENABLE_MSB 15 -#define MAC_PCU_WOW5_RX_ABORT_ENABLE_LSB 0 -#define MAC_PCU_WOW5_RX_ABORT_ENABLE_MASK 0x0000ffff -#define MAC_PCU_WOW5_RX_ABORT_ENABLE_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_WOW5_RX_ABORT_ENABLE_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_PCU_WOW_LENGTH1 */ -#define MAC_PCU_WOW_LENGTH1_ADDRESS 0x00008360 -#define MAC_PCU_WOW_LENGTH1_OFFSET 0x00008360 -#define MAC_PCU_WOW_LENGTH1_PATTERN_3_MSB 7 -#define MAC_PCU_WOW_LENGTH1_PATTERN_3_LSB 0 -#define MAC_PCU_WOW_LENGTH1_PATTERN_3_MASK 0x000000ff -#define MAC_PCU_WOW_LENGTH1_PATTERN_3_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_WOW_LENGTH1_PATTERN_3_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_WOW_LENGTH1_PATTERN_2_MSB 15 -#define MAC_PCU_WOW_LENGTH1_PATTERN_2_LSB 8 -#define MAC_PCU_WOW_LENGTH1_PATTERN_2_MASK 0x0000ff00 -#define MAC_PCU_WOW_LENGTH1_PATTERN_2_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_WOW_LENGTH1_PATTERN_2_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_WOW_LENGTH1_PATTERN_1_MSB 23 -#define MAC_PCU_WOW_LENGTH1_PATTERN_1_LSB 16 -#define MAC_PCU_WOW_LENGTH1_PATTERN_1_MASK 0x00ff0000 -#define MAC_PCU_WOW_LENGTH1_PATTERN_1_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_WOW_LENGTH1_PATTERN_1_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_WOW_LENGTH1_PATTERN_0_MSB 31 -#define MAC_PCU_WOW_LENGTH1_PATTERN_0_LSB 24 -#define MAC_PCU_WOW_LENGTH1_PATTERN_0_MASK 0xff000000 -#define MAC_PCU_WOW_LENGTH1_PATTERN_0_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_WOW_LENGTH1_PATTERN_0_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_WOW_LENGTH2 */ -#define MAC_PCU_WOW_LENGTH2_ADDRESS 0x00008364 -#define MAC_PCU_WOW_LENGTH2_OFFSET 0x00008364 -#define MAC_PCU_WOW_LENGTH2_PATTERN_7_MSB 7 -#define MAC_PCU_WOW_LENGTH2_PATTERN_7_LSB 0 -#define MAC_PCU_WOW_LENGTH2_PATTERN_7_MASK 0x000000ff -#define MAC_PCU_WOW_LENGTH2_PATTERN_7_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_WOW_LENGTH2_PATTERN_7_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_WOW_LENGTH2_PATTERN_6_MSB 15 -#define MAC_PCU_WOW_LENGTH2_PATTERN_6_LSB 8 -#define MAC_PCU_WOW_LENGTH2_PATTERN_6_MASK 0x0000ff00 -#define MAC_PCU_WOW_LENGTH2_PATTERN_6_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_WOW_LENGTH2_PATTERN_6_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_WOW_LENGTH2_PATTERN_5_MSB 23 -#define MAC_PCU_WOW_LENGTH2_PATTERN_5_LSB 16 -#define MAC_PCU_WOW_LENGTH2_PATTERN_5_MASK 0x00ff0000 -#define MAC_PCU_WOW_LENGTH2_PATTERN_5_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_WOW_LENGTH2_PATTERN_5_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_WOW_LENGTH2_PATTERN_4_MSB 31 -#define MAC_PCU_WOW_LENGTH2_PATTERN_4_LSB 24 -#define MAC_PCU_WOW_LENGTH2_PATTERN_4_MASK 0xff000000 -#define MAC_PCU_WOW_LENGTH2_PATTERN_4_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_WOW_LENGTH2_PATTERN_4_SET(x) (((x) << 24) & 0xff000000) - -/* macros for WOW_PATTERN_MATCH_LESS_THAN_256_BYTES */ -#define WOW_PATTERN_MATCH_LESS_THAN_256_BYTES_ADDRESS 0x00008368 -#define WOW_PATTERN_MATCH_LESS_THAN_256_BYTES_OFFSET 0x00008368 -#define WOW_PATTERN_MATCH_LESS_THAN_256_BYTES_EN_MSB 15 -#define WOW_PATTERN_MATCH_LESS_THAN_256_BYTES_EN_LSB 0 -#define WOW_PATTERN_MATCH_LESS_THAN_256_BYTES_EN_MASK 0x0000ffff -#define WOW_PATTERN_MATCH_LESS_THAN_256_BYTES_EN_GET(x) (((x) & 0x0000ffff) >> 0) -#define WOW_PATTERN_MATCH_LESS_THAN_256_BYTES_EN_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_PCU_WOW4 */ -#define MAC_PCU_WOW4_ADDRESS 0x00008370 -#define MAC_PCU_WOW4_OFFSET 0x00008370 -#define MAC_PCU_WOW4_PATTERN_ENABLE_MSB 7 -#define MAC_PCU_WOW4_PATTERN_ENABLE_LSB 0 -#define MAC_PCU_WOW4_PATTERN_ENABLE_MASK 0x000000ff -#define MAC_PCU_WOW4_PATTERN_ENABLE_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_WOW4_PATTERN_ENABLE_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_WOW4_PATTERN_DETECT_MSB 15 -#define MAC_PCU_WOW4_PATTERN_DETECT_LSB 8 -#define MAC_PCU_WOW4_PATTERN_DETECT_MASK 0x0000ff00 -#define MAC_PCU_WOW4_PATTERN_DETECT_GET(x) (((x) & 0x0000ff00) >> 8) - -/* macros for WOW2_EXACT */ -#define WOW2_EXACT_ADDRESS 0x00008374 -#define WOW2_EXACT_OFFSET 0x00008374 -#define WOW2_EXACT_LENGTH_MSB 7 -#define WOW2_EXACT_LENGTH_LSB 0 -#define WOW2_EXACT_LENGTH_MASK 0x000000ff -#define WOW2_EXACT_LENGTH_GET(x) (((x) & 0x000000ff) >> 0) -#define WOW2_EXACT_LENGTH_SET(x) (((x) << 0) & 0x000000ff) -#define WOW2_EXACT_OFFSET_MSB 15 -#define WOW2_EXACT_OFFSET_LSB 8 -#define WOW2_EXACT_OFFSET_MASK 0x0000ff00 -#define WOW2_EXACT_OFFSET_GET(x) (((x) & 0x0000ff00) >> 8) -#define WOW2_EXACT_OFFSET_SET(x) (((x) << 8) & 0x0000ff00) - -/* macros for PCU_WOW6 */ -#define PCU_WOW6_ADDRESS 0x00008378 -#define PCU_WOW6_OFFSET 0x00008378 -#define PCU_WOW6_OFFSET8_MSB 7 -#define PCU_WOW6_OFFSET8_LSB 0 -#define PCU_WOW6_OFFSET8_MASK 0x000000ff -#define PCU_WOW6_OFFSET8_GET(x) (((x) & 0x000000ff) >> 0) -#define PCU_WOW6_OFFSET8_SET(x) (((x) << 0) & 0x000000ff) -#define PCU_WOW6_OFFSET9_MSB 15 -#define PCU_WOW6_OFFSET9_LSB 8 -#define PCU_WOW6_OFFSET9_MASK 0x0000ff00 -#define PCU_WOW6_OFFSET9_GET(x) (((x) & 0x0000ff00) >> 8) -#define PCU_WOW6_OFFSET9_SET(x) (((x) << 8) & 0x0000ff00) -#define PCU_WOW6_OFFSET10_MSB 23 -#define PCU_WOW6_OFFSET10_LSB 16 -#define PCU_WOW6_OFFSET10_MASK 0x00ff0000 -#define PCU_WOW6_OFFSET10_GET(x) (((x) & 0x00ff0000) >> 16) -#define PCU_WOW6_OFFSET10_SET(x) (((x) << 16) & 0x00ff0000) -#define PCU_WOW6_OFFSET11_MSB 31 -#define PCU_WOW6_OFFSET11_LSB 24 -#define PCU_WOW6_OFFSET11_MASK 0xff000000 -#define PCU_WOW6_OFFSET11_GET(x) (((x) & 0xff000000) >> 24) -#define PCU_WOW6_OFFSET11_SET(x) (((x) << 24) & 0xff000000) - -/* macros for PCU_WOW7 */ -#define PCU_WOW7_ADDRESS 0x0000837c -#define PCU_WOW7_OFFSET 0x0000837c -#define PCU_WOW7_OFFSET12_MSB 7 -#define PCU_WOW7_OFFSET12_LSB 0 -#define PCU_WOW7_OFFSET12_MASK 0x000000ff -#define PCU_WOW7_OFFSET12_GET(x) (((x) & 0x000000ff) >> 0) -#define PCU_WOW7_OFFSET12_SET(x) (((x) << 0) & 0x000000ff) -#define PCU_WOW7_OFFSET13_MSB 15 -#define PCU_WOW7_OFFSET13_LSB 8 -#define PCU_WOW7_OFFSET13_MASK 0x0000ff00 -#define PCU_WOW7_OFFSET13_GET(x) (((x) & 0x0000ff00) >> 8) -#define PCU_WOW7_OFFSET13_SET(x) (((x) << 8) & 0x0000ff00) -#define PCU_WOW7_OFFSET14_MSB 23 -#define PCU_WOW7_OFFSET14_LSB 16 -#define PCU_WOW7_OFFSET14_MASK 0x00ff0000 -#define PCU_WOW7_OFFSET14_GET(x) (((x) & 0x00ff0000) >> 16) -#define PCU_WOW7_OFFSET14_SET(x) (((x) << 16) & 0x00ff0000) -#define PCU_WOW7_OFFSET15_MSB 31 -#define PCU_WOW7_OFFSET15_LSB 24 -#define PCU_WOW7_OFFSET15_MASK 0xff000000 -#define PCU_WOW7_OFFSET15_GET(x) (((x) & 0xff000000) >> 24) -#define PCU_WOW7_OFFSET15_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_WOW_LENGTH3 */ -#define MAC_PCU_WOW_LENGTH3_ADDRESS 0x00008380 -#define MAC_PCU_WOW_LENGTH3_OFFSET 0x00008380 -#define MAC_PCU_WOW_LENGTH3_PATTERN_11_MSB 7 -#define MAC_PCU_WOW_LENGTH3_PATTERN_11_LSB 0 -#define MAC_PCU_WOW_LENGTH3_PATTERN_11_MASK 0x000000ff -#define MAC_PCU_WOW_LENGTH3_PATTERN_11_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_WOW_LENGTH3_PATTERN_11_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_WOW_LENGTH3_PATTERN_10_MSB 15 -#define MAC_PCU_WOW_LENGTH3_PATTERN_10_LSB 8 -#define MAC_PCU_WOW_LENGTH3_PATTERN_10_MASK 0x0000ff00 -#define MAC_PCU_WOW_LENGTH3_PATTERN_10_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_WOW_LENGTH3_PATTERN_10_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_WOW_LENGTH3_PATTERN_9_MSB 23 -#define MAC_PCU_WOW_LENGTH3_PATTERN_9_LSB 16 -#define MAC_PCU_WOW_LENGTH3_PATTERN_9_MASK 0x00ff0000 -#define MAC_PCU_WOW_LENGTH3_PATTERN_9_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_WOW_LENGTH3_PATTERN_9_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_WOW_LENGTH3_PATTERN_8_MSB 31 -#define MAC_PCU_WOW_LENGTH3_PATTERN_8_LSB 24 -#define MAC_PCU_WOW_LENGTH3_PATTERN_8_MASK 0xff000000 -#define MAC_PCU_WOW_LENGTH3_PATTERN_8_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_WOW_LENGTH3_PATTERN_8_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_WOW_LENGTH4 */ -#define MAC_PCU_WOW_LENGTH4_ADDRESS 0x00008384 -#define MAC_PCU_WOW_LENGTH4_OFFSET 0x00008384 -#define MAC_PCU_WOW_LENGTH4_PATTERN_15_MSB 7 -#define MAC_PCU_WOW_LENGTH4_PATTERN_15_LSB 0 -#define MAC_PCU_WOW_LENGTH4_PATTERN_15_MASK 0x000000ff -#define MAC_PCU_WOW_LENGTH4_PATTERN_15_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_WOW_LENGTH4_PATTERN_15_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_WOW_LENGTH4_PATTERN_14_MSB 15 -#define MAC_PCU_WOW_LENGTH4_PATTERN_14_LSB 8 -#define MAC_PCU_WOW_LENGTH4_PATTERN_14_MASK 0x0000ff00 -#define MAC_PCU_WOW_LENGTH4_PATTERN_14_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_WOW_LENGTH4_PATTERN_14_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_WOW_LENGTH4_PATTERN_13_MSB 23 -#define MAC_PCU_WOW_LENGTH4_PATTERN_13_LSB 16 -#define MAC_PCU_WOW_LENGTH4_PATTERN_13_MASK 0x00ff0000 -#define MAC_PCU_WOW_LENGTH4_PATTERN_13_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_WOW_LENGTH4_PATTERN_13_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_WOW_LENGTH4_PATTERN_12_MSB 31 -#define MAC_PCU_WOW_LENGTH4_PATTERN_12_LSB 24 -#define MAC_PCU_WOW_LENGTH4_PATTERN_12_MASK 0xff000000 -#define MAC_PCU_WOW_LENGTH4_PATTERN_12_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_WOW_LENGTH4_PATTERN_12_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_LOCATION_MODE_CONTROL */ -#define MAC_PCU_LOCATION_MODE_CONTROL_ADDRESS 0x00008388 -#define MAC_PCU_LOCATION_MODE_CONTROL_OFFSET 0x00008388 -#define MAC_PCU_LOCATION_MODE_CONTROL_ENABLE_MSB 0 -#define MAC_PCU_LOCATION_MODE_CONTROL_ENABLE_LSB 0 -#define MAC_PCU_LOCATION_MODE_CONTROL_ENABLE_MASK 0x00000001 -#define MAC_PCU_LOCATION_MODE_CONTROL_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_LOCATION_MODE_CONTROL_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_LOCATION_MODE_CONTROL_UPLOAD_H_DISABLE_MSB 1 -#define MAC_PCU_LOCATION_MODE_CONTROL_UPLOAD_H_DISABLE_LSB 1 -#define MAC_PCU_LOCATION_MODE_CONTROL_UPLOAD_H_DISABLE_MASK 0x00000002 -#define MAC_PCU_LOCATION_MODE_CONTROL_UPLOAD_H_DISABLE_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_LOCATION_MODE_CONTROL_UPLOAD_H_DISABLE_SET(x) (((x) << 1) & 0x00000002) - -/* macros for MAC_PCU_LOCATION_MODE_TIMER */ -#define MAC_PCU_LOCATION_MODE_TIMER_ADDRESS 0x0000838c -#define MAC_PCU_LOCATION_MODE_TIMER_OFFSET 0x0000838c -#define MAC_PCU_LOCATION_MODE_TIMER_VALUE_MSB 31 -#define MAC_PCU_LOCATION_MODE_TIMER_VALUE_LSB 0 -#define MAC_PCU_LOCATION_MODE_TIMER_VALUE_MASK 0xffffffff -#define MAC_PCU_LOCATION_MODE_TIMER_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_LOCATION_MODE_TIMER_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_BSSID2_L32 */ -#define MAC_PCU_BSSID2_L32_ADDRESS 0x00008398 -#define MAC_PCU_BSSID2_L32_OFFSET 0x00008398 -#define MAC_PCU_BSSID2_L32_ADDR_MSB 31 -#define MAC_PCU_BSSID2_L32_ADDR_LSB 0 -#define MAC_PCU_BSSID2_L32_ADDR_MASK 0xffffffff -#define MAC_PCU_BSSID2_L32_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_BSSID2_L32_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_BSSID2_U16 */ -#define MAC_PCU_BSSID2_U16_ADDRESS 0x0000839c -#define MAC_PCU_BSSID2_U16_OFFSET 0x0000839c -#define MAC_PCU_BSSID2_U16_ADDR_MSB 15 -#define MAC_PCU_BSSID2_U16_ADDR_LSB 0 -#define MAC_PCU_BSSID2_U16_ADDR_MASK 0x0000ffff -#define MAC_PCU_BSSID2_U16_ADDR_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_BSSID2_U16_ADDR_SET(x) (((x) << 0) & 0x0000ffff) -#define MAC_PCU_BSSID2_U16_ENABLE_MSB 16 -#define MAC_PCU_BSSID2_U16_ENABLE_LSB 16 -#define MAC_PCU_BSSID2_U16_ENABLE_MASK 0x00010000 -#define MAC_PCU_BSSID2_U16_ENABLE_GET(x) (((x) & 0x00010000) >> 16) -#define MAC_PCU_BSSID2_U16_ENABLE_SET(x) (((x) << 16) & 0x00010000) -#define MAC_PCU_BSSID2_U16_AID_MSB 30 -#define MAC_PCU_BSSID2_U16_AID_LSB 20 -#define MAC_PCU_BSSID2_U16_AID_MASK 0x7ff00000 -#define MAC_PCU_BSSID2_U16_AID_GET(x) (((x) & 0x7ff00000) >> 20) -#define MAC_PCU_BSSID2_U16_AID_SET(x) (((x) << 20) & 0x7ff00000) - -/* macros for MAC_PCU_DIRECT_CONNECT */ -#define MAC_PCU_DIRECT_CONNECT_ADDRESS 0x000083a0 -#define MAC_PCU_DIRECT_CONNECT_OFFSET 0x000083a0 -#define MAC_PCU_DIRECT_CONNECT_TSF2_ENABLE_MSB 0 -#define MAC_PCU_DIRECT_CONNECT_TSF2_ENABLE_LSB 0 -#define MAC_PCU_DIRECT_CONNECT_TSF2_ENABLE_MASK 0x00000001 -#define MAC_PCU_DIRECT_CONNECT_TSF2_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_DIRECT_CONNECT_TSF2_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_DIRECT_CONNECT_TS_TSF_SEL_MSB 1 -#define MAC_PCU_DIRECT_CONNECT_TS_TSF_SEL_LSB 1 -#define MAC_PCU_DIRECT_CONNECT_TS_TSF_SEL_MASK 0x00000002 -#define MAC_PCU_DIRECT_CONNECT_TS_TSF_SEL_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_DIRECT_CONNECT_TS_TSF_SEL_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_DIRECT_CONNECT_TSF1_UPDATE_MSB 2 -#define MAC_PCU_DIRECT_CONNECT_TSF1_UPDATE_LSB 2 -#define MAC_PCU_DIRECT_CONNECT_TSF1_UPDATE_MASK 0x00000004 -#define MAC_PCU_DIRECT_CONNECT_TSF1_UPDATE_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_DIRECT_CONNECT_TSF1_UPDATE_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_DIRECT_CONNECT_TSF2_UPDATE_MSB 3 -#define MAC_PCU_DIRECT_CONNECT_TSF2_UPDATE_LSB 3 -#define MAC_PCU_DIRECT_CONNECT_TSF2_UPDATE_MASK 0x00000008 -#define MAC_PCU_DIRECT_CONNECT_TSF2_UPDATE_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_DIRECT_CONNECT_TSF2_UPDATE_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_DIRECT_CONNECT_MY_BEACON_OVERRIDE_MSB 4 -#define MAC_PCU_DIRECT_CONNECT_MY_BEACON_OVERRIDE_LSB 4 -#define MAC_PCU_DIRECT_CONNECT_MY_BEACON_OVERRIDE_MASK 0x00000010 -#define MAC_PCU_DIRECT_CONNECT_MY_BEACON_OVERRIDE_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_PCU_DIRECT_CONNECT_MY_BEACON_OVERRIDE_SET(x) (((x) << 4) & 0x00000010) -#define MAC_PCU_DIRECT_CONNECT_MY_BEACON2_OVERRIDE_MSB 5 -#define MAC_PCU_DIRECT_CONNECT_MY_BEACON2_OVERRIDE_LSB 5 -#define MAC_PCU_DIRECT_CONNECT_MY_BEACON2_OVERRIDE_MASK 0x00000020 -#define MAC_PCU_DIRECT_CONNECT_MY_BEACON2_OVERRIDE_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_PCU_DIRECT_CONNECT_MY_BEACON2_OVERRIDE_SET(x) (((x) << 5) & 0x00000020) -#define MAC_PCU_DIRECT_CONNECT_BMISS_CNT_TSF_SEL_MSB 6 -#define MAC_PCU_DIRECT_CONNECT_BMISS_CNT_TSF_SEL_LSB 6 -#define MAC_PCU_DIRECT_CONNECT_BMISS_CNT_TSF_SEL_MASK 0x00000040 -#define MAC_PCU_DIRECT_CONNECT_BMISS_CNT_TSF_SEL_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_PCU_DIRECT_CONNECT_BMISS_CNT_TSF_SEL_SET(x) (((x) << 6) & 0x00000040) -#define MAC_PCU_DIRECT_CONNECT_BMISS_CNT_OVERRIDE_MSB 7 -#define MAC_PCU_DIRECT_CONNECT_BMISS_CNT_OVERRIDE_LSB 7 -#define MAC_PCU_DIRECT_CONNECT_BMISS_CNT_OVERRIDE_MASK 0x00000080 -#define MAC_PCU_DIRECT_CONNECT_BMISS_CNT_OVERRIDE_GET(x) (((x) & 0x00000080) >> 7) -#define MAC_PCU_DIRECT_CONNECT_BMISS_CNT_OVERRIDE_SET(x) (((x) << 7) & 0x00000080) -#define MAC_PCU_DIRECT_CONNECT_RESERVED_MSB 31 -#define MAC_PCU_DIRECT_CONNECT_RESERVED_LSB 8 -#define MAC_PCU_DIRECT_CONNECT_RESERVED_MASK 0xffffff00 -#define MAC_PCU_DIRECT_CONNECT_RESERVED_GET(x) (((x) & 0xffffff00) >> 8) -#define MAC_PCU_DIRECT_CONNECT_RESERVED_SET(x) (((x) << 8) & 0xffffff00) - -/* macros for MAC_PCU_TID_TO_AC */ -#define MAC_PCU_TID_TO_AC_ADDRESS 0x000083a4 -#define MAC_PCU_TID_TO_AC_OFFSET 0x000083a4 -#define MAC_PCU_TID_TO_AC_DATA_MSB 31 -#define MAC_PCU_TID_TO_AC_DATA_LSB 0 -#define MAC_PCU_TID_TO_AC_DATA_MASK 0xffffffff -#define MAC_PCU_TID_TO_AC_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_TID_TO_AC_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_HP_QUEUE */ -#define MAC_PCU_HP_QUEUE_ADDRESS 0x000083a8 -#define MAC_PCU_HP_QUEUE_OFFSET 0x000083a8 -#define MAC_PCU_HP_QUEUE_ENABLE_MSB 0 -#define MAC_PCU_HP_QUEUE_ENABLE_LSB 0 -#define MAC_PCU_HP_QUEUE_ENABLE_MASK 0x00000001 -#define MAC_PCU_HP_QUEUE_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_HP_QUEUE_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_HP_QUEUE_AC_MASK_BE_MSB 1 -#define MAC_PCU_HP_QUEUE_AC_MASK_BE_LSB 1 -#define MAC_PCU_HP_QUEUE_AC_MASK_BE_MASK 0x00000002 -#define MAC_PCU_HP_QUEUE_AC_MASK_BE_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_HP_QUEUE_AC_MASK_BE_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_HP_QUEUE_AC_MASK_BK_MSB 2 -#define MAC_PCU_HP_QUEUE_AC_MASK_BK_LSB 2 -#define MAC_PCU_HP_QUEUE_AC_MASK_BK_MASK 0x00000004 -#define MAC_PCU_HP_QUEUE_AC_MASK_BK_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_HP_QUEUE_AC_MASK_BK_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_HP_QUEUE_AC_MASK_VI_MSB 3 -#define MAC_PCU_HP_QUEUE_AC_MASK_VI_LSB 3 -#define MAC_PCU_HP_QUEUE_AC_MASK_VI_MASK 0x00000008 -#define MAC_PCU_HP_QUEUE_AC_MASK_VI_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_HP_QUEUE_AC_MASK_VI_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_HP_QUEUE_AC_MASK_VO_MSB 4 -#define MAC_PCU_HP_QUEUE_AC_MASK_VO_LSB 4 -#define MAC_PCU_HP_QUEUE_AC_MASK_VO_MASK 0x00000010 -#define MAC_PCU_HP_QUEUE_AC_MASK_VO_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_PCU_HP_QUEUE_AC_MASK_VO_SET(x) (((x) << 4) & 0x00000010) -#define MAC_PCU_HP_QUEUE_HPQON_UAPSD_MSB 5 -#define MAC_PCU_HP_QUEUE_HPQON_UAPSD_LSB 5 -#define MAC_PCU_HP_QUEUE_HPQON_UAPSD_MASK 0x00000020 -#define MAC_PCU_HP_QUEUE_HPQON_UAPSD_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_PCU_HP_QUEUE_HPQON_UAPSD_SET(x) (((x) << 5) & 0x00000020) -#define MAC_PCU_HP_QUEUE_FRAME_FILTER_ENABLE0_MSB 6 -#define MAC_PCU_HP_QUEUE_FRAME_FILTER_ENABLE0_LSB 6 -#define MAC_PCU_HP_QUEUE_FRAME_FILTER_ENABLE0_MASK 0x00000040 -#define MAC_PCU_HP_QUEUE_FRAME_FILTER_ENABLE0_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_PCU_HP_QUEUE_FRAME_FILTER_ENABLE0_SET(x) (((x) << 6) & 0x00000040) -#define MAC_PCU_HP_QUEUE_FRAME_BSSID_MATCH0_MSB 7 -#define MAC_PCU_HP_QUEUE_FRAME_BSSID_MATCH0_LSB 7 -#define MAC_PCU_HP_QUEUE_FRAME_BSSID_MATCH0_MASK 0x00000080 -#define MAC_PCU_HP_QUEUE_FRAME_BSSID_MATCH0_GET(x) (((x) & 0x00000080) >> 7) -#define MAC_PCU_HP_QUEUE_FRAME_BSSID_MATCH0_SET(x) (((x) << 7) & 0x00000080) -#define MAC_PCU_HP_QUEUE_FRAME_TYPE0_MSB 9 -#define MAC_PCU_HP_QUEUE_FRAME_TYPE0_LSB 8 -#define MAC_PCU_HP_QUEUE_FRAME_TYPE0_MASK 0x00000300 -#define MAC_PCU_HP_QUEUE_FRAME_TYPE0_GET(x) (((x) & 0x00000300) >> 8) -#define MAC_PCU_HP_QUEUE_FRAME_TYPE0_SET(x) (((x) << 8) & 0x00000300) -#define MAC_PCU_HP_QUEUE_FRAME_TYPE_MASK0_MSB 11 -#define MAC_PCU_HP_QUEUE_FRAME_TYPE_MASK0_LSB 10 -#define MAC_PCU_HP_QUEUE_FRAME_TYPE_MASK0_MASK 0x00000c00 -#define MAC_PCU_HP_QUEUE_FRAME_TYPE_MASK0_GET(x) (((x) & 0x00000c00) >> 10) -#define MAC_PCU_HP_QUEUE_FRAME_TYPE_MASK0_SET(x) (((x) << 10) & 0x00000c00) -#define MAC_PCU_HP_QUEUE_FRAME_SUBTYPE0_MSB 15 -#define MAC_PCU_HP_QUEUE_FRAME_SUBTYPE0_LSB 12 -#define MAC_PCU_HP_QUEUE_FRAME_SUBTYPE0_MASK 0x0000f000 -#define MAC_PCU_HP_QUEUE_FRAME_SUBTYPE0_GET(x) (((x) & 0x0000f000) >> 12) -#define MAC_PCU_HP_QUEUE_FRAME_SUBTYPE0_SET(x) (((x) << 12) & 0x0000f000) -#define MAC_PCU_HP_QUEUE_FRAME_SUBTYPE_MASK0_MSB 19 -#define MAC_PCU_HP_QUEUE_FRAME_SUBTYPE_MASK0_LSB 16 -#define MAC_PCU_HP_QUEUE_FRAME_SUBTYPE_MASK0_MASK 0x000f0000 -#define MAC_PCU_HP_QUEUE_FRAME_SUBTYPE_MASK0_GET(x) (((x) & 0x000f0000) >> 16) -#define MAC_PCU_HP_QUEUE_FRAME_SUBTYPE_MASK0_SET(x) (((x) << 16) & 0x000f0000) -#define MAC_PCU_HP_QUEUE_UAPSD_EN_MSB 20 -#define MAC_PCU_HP_QUEUE_UAPSD_EN_LSB 20 -#define MAC_PCU_HP_QUEUE_UAPSD_EN_MASK 0x00100000 -#define MAC_PCU_HP_QUEUE_UAPSD_EN_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_PCU_HP_QUEUE_UAPSD_EN_SET(x) (((x) << 20) & 0x00100000) -#define MAC_PCU_HP_QUEUE_PM_CHANGE_MSB 21 -#define MAC_PCU_HP_QUEUE_PM_CHANGE_LSB 21 -#define MAC_PCU_HP_QUEUE_PM_CHANGE_MASK 0x00200000 -#define MAC_PCU_HP_QUEUE_PM_CHANGE_GET(x) (((x) & 0x00200000) >> 21) -#define MAC_PCU_HP_QUEUE_PM_CHANGE_SET(x) (((x) << 21) & 0x00200000) -#define MAC_PCU_HP_QUEUE_NON_UAPSD_EN_MSB 22 -#define MAC_PCU_HP_QUEUE_NON_UAPSD_EN_LSB 22 -#define MAC_PCU_HP_QUEUE_NON_UAPSD_EN_MASK 0x00400000 -#define MAC_PCU_HP_QUEUE_NON_UAPSD_EN_GET(x) (((x) & 0x00400000) >> 22) -#define MAC_PCU_HP_QUEUE_NON_UAPSD_EN_SET(x) (((x) << 22) & 0x00400000) -#define MAC_PCU_HP_QUEUE_UAPSD_AC_MUST_MATCH_MSB 23 -#define MAC_PCU_HP_QUEUE_UAPSD_AC_MUST_MATCH_LSB 23 -#define MAC_PCU_HP_QUEUE_UAPSD_AC_MUST_MATCH_MASK 0x00800000 -#define MAC_PCU_HP_QUEUE_UAPSD_AC_MUST_MATCH_GET(x) (((x) & 0x00800000) >> 23) -#define MAC_PCU_HP_QUEUE_UAPSD_AC_MUST_MATCH_SET(x) (((x) << 23) & 0x00800000) -#define MAC_PCU_HP_QUEUE_UAPSD_ONLY_QOS_MSB 24 -#define MAC_PCU_HP_QUEUE_UAPSD_ONLY_QOS_LSB 24 -#define MAC_PCU_HP_QUEUE_UAPSD_ONLY_QOS_MASK 0x01000000 -#define MAC_PCU_HP_QUEUE_UAPSD_ONLY_QOS_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_PCU_HP_QUEUE_UAPSD_ONLY_QOS_SET(x) (((x) << 24) & 0x01000000) - -/* macros for MAC_PCU_AGC_SATURATION_CNT0 */ -#define MAC_PCU_AGC_SATURATION_CNT0_ADDRESS 0x000083bc -#define MAC_PCU_AGC_SATURATION_CNT0_OFFSET 0x000083bc -#define MAC_PCU_AGC_SATURATION_CNT0_VALUE_MSB 31 -#define MAC_PCU_AGC_SATURATION_CNT0_VALUE_LSB 0 -#define MAC_PCU_AGC_SATURATION_CNT0_VALUE_MASK 0xffffffff -#define MAC_PCU_AGC_SATURATION_CNT0_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_AGC_SATURATION_CNT0_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_AGC_SATURATION_CNT1 */ -#define MAC_PCU_AGC_SATURATION_CNT1_ADDRESS 0x000083c0 -#define MAC_PCU_AGC_SATURATION_CNT1_OFFSET 0x000083c0 -#define MAC_PCU_AGC_SATURATION_CNT1_VALUE_MSB 31 -#define MAC_PCU_AGC_SATURATION_CNT1_VALUE_LSB 0 -#define MAC_PCU_AGC_SATURATION_CNT1_VALUE_MASK 0xffffffff -#define MAC_PCU_AGC_SATURATION_CNT1_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_AGC_SATURATION_CNT1_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_AGC_SATURATION_CNT2 */ -#define MAC_PCU_AGC_SATURATION_CNT2_ADDRESS 0x000083c4 -#define MAC_PCU_AGC_SATURATION_CNT2_OFFSET 0x000083c4 -#define MAC_PCU_AGC_SATURATION_CNT2_VALUE_MSB 31 -#define MAC_PCU_AGC_SATURATION_CNT2_VALUE_LSB 0 -#define MAC_PCU_AGC_SATURATION_CNT2_VALUE_MASK 0xffffffff -#define MAC_PCU_AGC_SATURATION_CNT2_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_AGC_SATURATION_CNT2_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_HW_BCN_PROC1 */ -#define MAC_PCU_HW_BCN_PROC1_ADDRESS 0x000083c8 -#define MAC_PCU_HW_BCN_PROC1_OFFSET 0x000083c8 -#define MAC_PCU_HW_BCN_PROC1_CRC_ENABLE_MSB 0 -#define MAC_PCU_HW_BCN_PROC1_CRC_ENABLE_LSB 0 -#define MAC_PCU_HW_BCN_PROC1_CRC_ENABLE_MASK 0x00000001 -#define MAC_PCU_HW_BCN_PROC1_CRC_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_HW_BCN_PROC1_CRC_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_HW_BCN_PROC1_RESET_CRC_MSB 1 -#define MAC_PCU_HW_BCN_PROC1_RESET_CRC_LSB 1 -#define MAC_PCU_HW_BCN_PROC1_RESET_CRC_MASK 0x00000002 -#define MAC_PCU_HW_BCN_PROC1_RESET_CRC_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_HW_BCN_PROC1_RESET_CRC_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_BCN_INTVL_MSB 2 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_BCN_INTVL_LSB 2 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_BCN_INTVL_MASK 0x00000004 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_BCN_INTVL_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_BCN_INTVL_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_CAP_INFO_MSB 3 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_CAP_INFO_LSB 3 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_CAP_INFO_MASK 0x00000008 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_CAP_INFO_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_CAP_INFO_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_TIM_ELM_MSB 4 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_TIM_ELM_LSB 4 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_TIM_ELM_MASK 0x00000010 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_TIM_ELM_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_TIM_ELM_SET(x) (((x) << 4) & 0x00000010) -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM0_MSB 5 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM0_LSB 5 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM0_MASK 0x00000020 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM0_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM0_SET(x) (((x) << 5) & 0x00000020) -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM1_MSB 6 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM1_LSB 6 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM1_MASK 0x00000040 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM1_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM1_SET(x) (((x) << 6) & 0x00000040) -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM2_MSB 7 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM2_LSB 7 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM2_MASK 0x00000080 -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM2_GET(x) (((x) & 0x00000080) >> 7) -#define MAC_PCU_HW_BCN_PROC1_EXCLUDE_ELM2_SET(x) (((x) << 7) & 0x00000080) -#define MAC_PCU_HW_BCN_PROC1_ELM0_ID_MSB 15 -#define MAC_PCU_HW_BCN_PROC1_ELM0_ID_LSB 8 -#define MAC_PCU_HW_BCN_PROC1_ELM0_ID_MASK 0x0000ff00 -#define MAC_PCU_HW_BCN_PROC1_ELM0_ID_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_HW_BCN_PROC1_ELM0_ID_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_HW_BCN_PROC1_ELM1_ID_MSB 23 -#define MAC_PCU_HW_BCN_PROC1_ELM1_ID_LSB 16 -#define MAC_PCU_HW_BCN_PROC1_ELM1_ID_MASK 0x00ff0000 -#define MAC_PCU_HW_BCN_PROC1_ELM1_ID_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_HW_BCN_PROC1_ELM1_ID_SET(x) (((x) << 16) & 0x00ff0000) -#define MAC_PCU_HW_BCN_PROC1_ELM2_ID_MSB 31 -#define MAC_PCU_HW_BCN_PROC1_ELM2_ID_LSB 24 -#define MAC_PCU_HW_BCN_PROC1_ELM2_ID_MASK 0xff000000 -#define MAC_PCU_HW_BCN_PROC1_ELM2_ID_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_PCU_HW_BCN_PROC1_ELM2_ID_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_PCU_HW_BCN_PROC2 */ -#define MAC_PCU_HW_BCN_PROC2_ADDRESS 0x000083cc -#define MAC_PCU_HW_BCN_PROC2_OFFSET 0x000083cc -#define MAC_PCU_HW_BCN_PROC2_FILTER_INTERVAL_ENABLE_MSB 0 -#define MAC_PCU_HW_BCN_PROC2_FILTER_INTERVAL_ENABLE_LSB 0 -#define MAC_PCU_HW_BCN_PROC2_FILTER_INTERVAL_ENABLE_MASK 0x00000001 -#define MAC_PCU_HW_BCN_PROC2_FILTER_INTERVAL_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_HW_BCN_PROC2_FILTER_INTERVAL_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_HW_BCN_PROC2_RESET_INTERVAL_MSB 1 -#define MAC_PCU_HW_BCN_PROC2_RESET_INTERVAL_LSB 1 -#define MAC_PCU_HW_BCN_PROC2_RESET_INTERVAL_MASK 0x00000002 -#define MAC_PCU_HW_BCN_PROC2_RESET_INTERVAL_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_HW_BCN_PROC2_RESET_INTERVAL_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_HW_BCN_PROC2_EXCLUDE_ELM3_MSB 2 -#define MAC_PCU_HW_BCN_PROC2_EXCLUDE_ELM3_LSB 2 -#define MAC_PCU_HW_BCN_PROC2_EXCLUDE_ELM3_MASK 0x00000004 -#define MAC_PCU_HW_BCN_PROC2_EXCLUDE_ELM3_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_HW_BCN_PROC2_EXCLUDE_ELM3_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_HW_BCN_PROC2_FILTER_INTERVAL_MSB 15 -#define MAC_PCU_HW_BCN_PROC2_FILTER_INTERVAL_LSB 8 -#define MAC_PCU_HW_BCN_PROC2_FILTER_INTERVAL_MASK 0x0000ff00 -#define MAC_PCU_HW_BCN_PROC2_FILTER_INTERVAL_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_HW_BCN_PROC2_FILTER_INTERVAL_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_HW_BCN_PROC2_ELM3_ID_MSB 23 -#define MAC_PCU_HW_BCN_PROC2_ELM3_ID_LSB 16 -#define MAC_PCU_HW_BCN_PROC2_ELM3_ID_MASK 0x00ff0000 -#define MAC_PCU_HW_BCN_PROC2_ELM3_ID_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_HW_BCN_PROC2_ELM3_ID_SET(x) (((x) << 16) & 0x00ff0000) - -/* macros for MAC_PCU_MISC_MODE3 */ -#define MAC_PCU_MISC_MODE3_ADDRESS 0x000083d0 -#define MAC_PCU_MISC_MODE3_OFFSET 0x000083d0 -#define MAC_PCU_MISC_MODE3_BUG_55702_FIX_ENABLE_MSB 0 -#define MAC_PCU_MISC_MODE3_BUG_55702_FIX_ENABLE_LSB 0 -#define MAC_PCU_MISC_MODE3_BUG_55702_FIX_ENABLE_MASK 0x00000001 -#define MAC_PCU_MISC_MODE3_BUG_55702_FIX_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_MISC_MODE3_BUG_55702_FIX_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_MISC_MODE3_AES_3STREAM_MSB 1 -#define MAC_PCU_MISC_MODE3_AES_3STREAM_LSB 1 -#define MAC_PCU_MISC_MODE3_AES_3STREAM_MASK 0x00000002 -#define MAC_PCU_MISC_MODE3_AES_3STREAM_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_MISC_MODE3_AES_3STREAM_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_MISC_MODE3_REGULAR_SOUNDING_MSB 2 -#define MAC_PCU_MISC_MODE3_REGULAR_SOUNDING_LSB 2 -#define MAC_PCU_MISC_MODE3_REGULAR_SOUNDING_MASK 0x00000004 -#define MAC_PCU_MISC_MODE3_REGULAR_SOUNDING_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_MISC_MODE3_REGULAR_SOUNDING_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_MISC_MODE3_BUG_58011_FIX_ENABLE_MSB 3 -#define MAC_PCU_MISC_MODE3_BUG_58011_FIX_ENABLE_LSB 3 -#define MAC_PCU_MISC_MODE3_BUG_58011_FIX_ENABLE_MASK 0x00000008 -#define MAC_PCU_MISC_MODE3_BUG_58011_FIX_ENABLE_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_MISC_MODE3_BUG_58011_FIX_ENABLE_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_MISC_MODE3_BUG_56991_FIX_ENABLE_MSB 4 -#define MAC_PCU_MISC_MODE3_BUG_56991_FIX_ENABLE_LSB 4 -#define MAC_PCU_MISC_MODE3_BUG_56991_FIX_ENABLE_MASK 0x00000010 -#define MAC_PCU_MISC_MODE3_BUG_56991_FIX_ENABLE_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_PCU_MISC_MODE3_BUG_56991_FIX_ENABLE_SET(x) (((x) << 4) & 0x00000010) -#define MAC_PCU_MISC_MODE3_WOW_ADDR1_MASK_ENABLE_MSB 5 -#define MAC_PCU_MISC_MODE3_WOW_ADDR1_MASK_ENABLE_LSB 5 -#define MAC_PCU_MISC_MODE3_WOW_ADDR1_MASK_ENABLE_MASK 0x00000020 -#define MAC_PCU_MISC_MODE3_WOW_ADDR1_MASK_ENABLE_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_PCU_MISC_MODE3_WOW_ADDR1_MASK_ENABLE_SET(x) (((x) << 5) & 0x00000020) -#define MAC_PCU_MISC_MODE3_BUG_61936_FIX_ENABLE_MSB 6 -#define MAC_PCU_MISC_MODE3_BUG_61936_FIX_ENABLE_LSB 6 -#define MAC_PCU_MISC_MODE3_BUG_61936_FIX_ENABLE_MASK 0x00000040 -#define MAC_PCU_MISC_MODE3_BUG_61936_FIX_ENABLE_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_PCU_MISC_MODE3_BUG_61936_FIX_ENABLE_SET(x) (((x) << 6) & 0x00000040) -#define MAC_PCU_MISC_MODE3_CHECK_LENGTH_FOR_BA_MSB 7 -#define MAC_PCU_MISC_MODE3_CHECK_LENGTH_FOR_BA_LSB 7 -#define MAC_PCU_MISC_MODE3_CHECK_LENGTH_FOR_BA_MASK 0x00000080 -#define MAC_PCU_MISC_MODE3_CHECK_LENGTH_FOR_BA_GET(x) (((x) & 0x00000080) >> 7) -#define MAC_PCU_MISC_MODE3_CHECK_LENGTH_FOR_BA_SET(x) (((x) << 7) & 0x00000080) -#define MAC_PCU_MISC_MODE3_BA_FRAME_LENGTH_MSB 15 -#define MAC_PCU_MISC_MODE3_BA_FRAME_LENGTH_LSB 8 -#define MAC_PCU_MISC_MODE3_BA_FRAME_LENGTH_MASK 0x0000ff00 -#define MAC_PCU_MISC_MODE3_BA_FRAME_LENGTH_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_MISC_MODE3_BA_FRAME_LENGTH_SET(x) (((x) << 8) & 0x0000ff00) -#define MAC_PCU_MISC_MODE3_MATCH_TID_FOR_BA_MSB 16 -#define MAC_PCU_MISC_MODE3_MATCH_TID_FOR_BA_LSB 16 -#define MAC_PCU_MISC_MODE3_MATCH_TID_FOR_BA_MASK 0x00010000 -#define MAC_PCU_MISC_MODE3_MATCH_TID_FOR_BA_GET(x) (((x) & 0x00010000) >> 16) -#define MAC_PCU_MISC_MODE3_MATCH_TID_FOR_BA_SET(x) (((x) << 16) & 0x00010000) -#define MAC_PCU_MISC_MODE3_WAPI_ORDER_MASK_MSB 17 -#define MAC_PCU_MISC_MODE3_WAPI_ORDER_MASK_LSB 17 -#define MAC_PCU_MISC_MODE3_WAPI_ORDER_MASK_MASK 0x00020000 -#define MAC_PCU_MISC_MODE3_WAPI_ORDER_MASK_GET(x) (((x) & 0x00020000) >> 17) -#define MAC_PCU_MISC_MODE3_WAPI_ORDER_MASK_SET(x) (((x) << 17) & 0x00020000) -#define MAC_PCU_MISC_MODE3_BB_LDPC_EN_MSB 18 -#define MAC_PCU_MISC_MODE3_BB_LDPC_EN_LSB 18 -#define MAC_PCU_MISC_MODE3_BB_LDPC_EN_MASK 0x00040000 -#define MAC_PCU_MISC_MODE3_BB_LDPC_EN_GET(x) (((x) & 0x00040000) >> 18) -#define MAC_PCU_MISC_MODE3_BB_LDPC_EN_SET(x) (((x) << 18) & 0x00040000) -#define MAC_PCU_MISC_MODE3_SELF_GEN_SMOOTHING_MSB 19 -#define MAC_PCU_MISC_MODE3_SELF_GEN_SMOOTHING_LSB 19 -#define MAC_PCU_MISC_MODE3_SELF_GEN_SMOOTHING_MASK 0x00080000 -#define MAC_PCU_MISC_MODE3_SELF_GEN_SMOOTHING_GET(x) (((x) & 0x00080000) >> 19) -#define MAC_PCU_MISC_MODE3_SELF_GEN_SMOOTHING_SET(x) (((x) << 19) & 0x00080000) -#define MAC_PCU_MISC_MODE3_SMOOTHING_FORCE_MSB 20 -#define MAC_PCU_MISC_MODE3_SMOOTHING_FORCE_LSB 20 -#define MAC_PCU_MISC_MODE3_SMOOTHING_FORCE_MASK 0x00100000 -#define MAC_PCU_MISC_MODE3_SMOOTHING_FORCE_GET(x) (((x) & 0x00100000) >> 20) -#define MAC_PCU_MISC_MODE3_SMOOTHING_FORCE_SET(x) (((x) << 20) & 0x00100000) -#define MAC_PCU_MISC_MODE3_ALLOW_RAC_MSB 21 -#define MAC_PCU_MISC_MODE3_ALLOW_RAC_LSB 21 -#define MAC_PCU_MISC_MODE3_ALLOW_RAC_MASK 0x00200000 -#define MAC_PCU_MISC_MODE3_ALLOW_RAC_GET(x) (((x) & 0x00200000) >> 21) -#define MAC_PCU_MISC_MODE3_ALLOW_RAC_SET(x) (((x) << 21) & 0x00200000) -#define MAC_PCU_MISC_MODE3_IGNORE_TXOP_IF_ZER0_MSB 22 -#define MAC_PCU_MISC_MODE3_IGNORE_TXOP_IF_ZER0_LSB 22 -#define MAC_PCU_MISC_MODE3_IGNORE_TXOP_IF_ZER0_MASK 0x00400000 -#define MAC_PCU_MISC_MODE3_IGNORE_TXOP_IF_ZER0_GET(x) (((x) & 0x00400000) >> 22) -#define MAC_PCU_MISC_MODE3_IGNORE_TXOP_IF_ZER0_SET(x) (((x) << 22) & 0x00400000) -#define MAC_PCU_MISC_MODE3_BEACON_FROM_TO_DS_CHECK_MSB 23 -#define MAC_PCU_MISC_MODE3_BEACON_FROM_TO_DS_CHECK_LSB 23 -#define MAC_PCU_MISC_MODE3_BEACON_FROM_TO_DS_CHECK_MASK 0x00800000 -#define MAC_PCU_MISC_MODE3_BEACON_FROM_TO_DS_CHECK_GET(x) (((x) & 0x00800000) >> 23) -#define MAC_PCU_MISC_MODE3_BEACON_FROM_TO_DS_CHECK_SET(x) (((x) << 23) & 0x00800000) -#define MAC_PCU_MISC_MODE3_PM_FIELD_FOR_DAT_MSB 24 -#define MAC_PCU_MISC_MODE3_PM_FIELD_FOR_DAT_LSB 24 -#define MAC_PCU_MISC_MODE3_PM_FIELD_FOR_DAT_MASK 0x01000000 -#define MAC_PCU_MISC_MODE3_PM_FIELD_FOR_DAT_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_PCU_MISC_MODE3_PM_FIELD_FOR_DAT_SET(x) (((x) << 24) & 0x01000000) -#define MAC_PCU_MISC_MODE3_PM_FIELD_FOR_MGMT_MSB 25 -#define MAC_PCU_MISC_MODE3_PM_FIELD_FOR_MGMT_LSB 25 -#define MAC_PCU_MISC_MODE3_PM_FIELD_FOR_MGMT_MASK 0x02000000 -#define MAC_PCU_MISC_MODE3_PM_FIELD_FOR_MGMT_GET(x) (((x) & 0x02000000) >> 25) -#define MAC_PCU_MISC_MODE3_PM_FIELD_FOR_MGMT_SET(x) (((x) << 25) & 0x02000000) -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_CTL_MSB 26 -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_CTL_LSB 26 -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_CTL_MASK 0x04000000 -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_CTL_GET(x) (((x) & 0x04000000) >> 26) -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_CTL_SET(x) (((x) << 26) & 0x04000000) -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_DAT_MSB 27 -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_DAT_LSB 27 -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_DAT_MASK 0x08000000 -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_DAT_GET(x) (((x) & 0x08000000) >> 27) -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_DAT_SET(x) (((x) << 27) & 0x08000000) -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_MGT_MSB 28 -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_MGT_LSB 28 -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_MGT_MASK 0x10000000 -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_MGT_GET(x) (((x) & 0x10000000) >> 28) -#define MAC_PCU_MISC_MODE3_PM_FIELD2_FOR_MGT_SET(x) (((x) << 28) & 0x10000000) -#define MAC_PCU_MISC_MODE3_KEY_MISS_FIX_MSB 29 -#define MAC_PCU_MISC_MODE3_KEY_MISS_FIX_LSB 29 -#define MAC_PCU_MISC_MODE3_KEY_MISS_FIX_MASK 0x20000000 -#define MAC_PCU_MISC_MODE3_KEY_MISS_FIX_GET(x) (((x) & 0x20000000) >> 29) -#define MAC_PCU_MISC_MODE3_KEY_MISS_FIX_SET(x) (((x) << 29) & 0x20000000) -#define MAC_PCU_MISC_MODE3_PER_STA_WEP_ENTRY_ENABLE_MSB 30 -#define MAC_PCU_MISC_MODE3_PER_STA_WEP_ENTRY_ENABLE_LSB 30 -#define MAC_PCU_MISC_MODE3_PER_STA_WEP_ENTRY_ENABLE_MASK 0x40000000 -#define MAC_PCU_MISC_MODE3_PER_STA_WEP_ENTRY_ENABLE_GET(x) (((x) & 0x40000000) >> 30) -#define MAC_PCU_MISC_MODE3_PER_STA_WEP_ENTRY_ENABLE_SET(x) (((x) << 30) & 0x40000000) -#define MAC_PCU_MISC_MODE3_TIME_BASED_DISCARD_EN_MSB 31 -#define MAC_PCU_MISC_MODE3_TIME_BASED_DISCARD_EN_LSB 31 -#define MAC_PCU_MISC_MODE3_TIME_BASED_DISCARD_EN_MASK 0x80000000 -#define MAC_PCU_MISC_MODE3_TIME_BASED_DISCARD_EN_GET(x) (((x) & 0x80000000) >> 31) -#define MAC_PCU_MISC_MODE3_TIME_BASED_DISCARD_EN_SET(x) (((x) << 31) & 0x80000000) - -/* macros for MAC_PCU_MISC_MODE4 */ -#define MAC_PCU_MISC_MODE4_ADDRESS 0x000083d4 -#define MAC_PCU_MISC_MODE4_OFFSET 0x000083d4 -#define MAC_PCU_MISC_MODE4_BC_MC_WAPI_MODE2_EN_MSB 0 -#define MAC_PCU_MISC_MODE4_BC_MC_WAPI_MODE2_EN_LSB 0 -#define MAC_PCU_MISC_MODE4_BC_MC_WAPI_MODE2_EN_MASK 0x00000001 -#define MAC_PCU_MISC_MODE4_BC_MC_WAPI_MODE2_EN_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_MISC_MODE4_BC_MC_WAPI_MODE2_EN_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_MISC_MODE4_BC_MC_WAPI_MODE2_MSB 1 -#define MAC_PCU_MISC_MODE4_BC_MC_WAPI_MODE2_LSB 1 -#define MAC_PCU_MISC_MODE4_BC_MC_WAPI_MODE2_MASK 0x00000002 -#define MAC_PCU_MISC_MODE4_BC_MC_WAPI_MODE2_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_MISC_MODE4_BC_MC_WAPI_MODE2_SET(x) (((x) << 1) & 0x00000002) -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_BEACON_MSB 2 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_BEACON_LSB 2 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_BEACON_MASK 0x00000004 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_BEACON_GET(x) (((x) & 0x00000004) >> 2) -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_BEACON_SET(x) (((x) << 2) & 0x00000004) -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_BCAST_PROBE_RESP_MSB 3 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_BCAST_PROBE_RESP_LSB 3 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_BCAST_PROBE_RESP_MASK 0x00000008 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_BCAST_PROBE_RESP_GET(x) (((x) & 0x00000008) >> 3) -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_BCAST_PROBE_RESP_SET(x) (((x) << 3) & 0x00000008) -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_MCAST_PROBE_RESP_MSB 4 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_MCAST_PROBE_RESP_LSB 4 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_MCAST_PROBE_RESP_MASK 0x00000010 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_MCAST_PROBE_RESP_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_MCAST_PROBE_RESP_SET(x) (((x) << 4) & 0x00000010) -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_UCAST_MOON_PROBE_RESP_MSB 5 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_UCAST_MOON_PROBE_RESP_LSB 5 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_UCAST_MOON_PROBE_RESP_MASK 0x00000020 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_UCAST_MOON_PROBE_RESP_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_UCAST_MOON_PROBE_RESP_SET(x) (((x) << 5) & 0x00000020) -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_UCAST_PROBE_RESP_MSB 6 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_UCAST_PROBE_RESP_LSB 6 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_UCAST_PROBE_RESP_MASK 0x00000040 -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_UCAST_PROBE_RESP_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_PCU_MISC_MODE4_SYNC_TSF_ON_UCAST_PROBE_RESP_SET(x) (((x) << 6) & 0x00000040) - -/* macros for MAC_PCU_PS_FILTER */ -#define MAC_PCU_PS_FILTER_ADDRESS 0x000083dc -#define MAC_PCU_PS_FILTER_OFFSET 0x000083dc -#define MAC_PCU_PS_FILTER_ENABLE_MSB 0 -#define MAC_PCU_PS_FILTER_ENABLE_LSB 0 -#define MAC_PCU_PS_FILTER_ENABLE_MASK 0x00000001 -#define MAC_PCU_PS_FILTER_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_PS_FILTER_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_PS_FILTER_PS_SAVE_ENABLE_MSB 1 -#define MAC_PCU_PS_FILTER_PS_SAVE_ENABLE_LSB 1 -#define MAC_PCU_PS_FILTER_PS_SAVE_ENABLE_MASK 0x00000002 -#define MAC_PCU_PS_FILTER_PS_SAVE_ENABLE_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_PS_FILTER_PS_SAVE_ENABLE_SET(x) (((x) << 1) & 0x00000002) - -/* macros for MAC_PCU_BASIC_RATE_SET0 */ -#define MAC_PCU_BASIC_RATE_SET0_ADDRESS 0x000083e0 -#define MAC_PCU_BASIC_RATE_SET0_OFFSET 0x000083e0 -#define MAC_PCU_BASIC_RATE_SET0_VALUE_MSB 29 -#define MAC_PCU_BASIC_RATE_SET0_VALUE_LSB 0 -#define MAC_PCU_BASIC_RATE_SET0_VALUE_MASK 0x3fffffff -#define MAC_PCU_BASIC_RATE_SET0_VALUE_GET(x) (((x) & 0x3fffffff) >> 0) -#define MAC_PCU_BASIC_RATE_SET0_VALUE_SET(x) (((x) << 0) & 0x3fffffff) - -/* macros for MAC_PCU_BASIC_RATE_SET1 */ -#define MAC_PCU_BASIC_RATE_SET1_ADDRESS 0x000083e4 -#define MAC_PCU_BASIC_RATE_SET1_OFFSET 0x000083e4 -#define MAC_PCU_BASIC_RATE_SET1_VALUE_MSB 29 -#define MAC_PCU_BASIC_RATE_SET1_VALUE_LSB 0 -#define MAC_PCU_BASIC_RATE_SET1_VALUE_MASK 0x3fffffff -#define MAC_PCU_BASIC_RATE_SET1_VALUE_GET(x) (((x) & 0x3fffffff) >> 0) -#define MAC_PCU_BASIC_RATE_SET1_VALUE_SET(x) (((x) << 0) & 0x3fffffff) - -/* macros for MAC_PCU_BASIC_RATE_SET2 */ -#define MAC_PCU_BASIC_RATE_SET2_ADDRESS 0x000083e8 -#define MAC_PCU_BASIC_RATE_SET2_OFFSET 0x000083e8 -#define MAC_PCU_BASIC_RATE_SET2_VALUE_MSB 29 -#define MAC_PCU_BASIC_RATE_SET2_VALUE_LSB 0 -#define MAC_PCU_BASIC_RATE_SET2_VALUE_MASK 0x3fffffff -#define MAC_PCU_BASIC_RATE_SET2_VALUE_GET(x) (((x) & 0x3fffffff) >> 0) -#define MAC_PCU_BASIC_RATE_SET2_VALUE_SET(x) (((x) << 0) & 0x3fffffff) - -/* macros for MAC_PCU_BASIC_RATE_SET3 */ -#define MAC_PCU_BASIC_RATE_SET3_ADDRESS 0x000083ec -#define MAC_PCU_BASIC_RATE_SET3_OFFSET 0x000083ec -#define MAC_PCU_BASIC_RATE_SET3_VALUE_MSB 24 -#define MAC_PCU_BASIC_RATE_SET3_VALUE_LSB 0 -#define MAC_PCU_BASIC_RATE_SET3_VALUE_MASK 0x01ffffff -#define MAC_PCU_BASIC_RATE_SET3_VALUE_GET(x) (((x) & 0x01ffffff) >> 0) -#define MAC_PCU_BASIC_RATE_SET3_VALUE_SET(x) (((x) << 0) & 0x01ffffff) - -/* macros for MAC_PCU_TXBUF_BA */ -#define MAC_PCU_TXBUF_BA_ADDRESS 0x00008400 -#define MAC_PCU_TXBUF_BA_OFFSET 0x00008400 -#define MAC_PCU_TXBUF_BA_DATA_MSB 31 -#define MAC_PCU_TXBUF_BA_DATA_LSB 0 -#define MAC_PCU_TXBUF_BA_DATA_MASK 0xffffffff -#define MAC_PCU_TXBUF_BA_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_TXBUF_BA_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_BT_BT */ -#define MAC_PCU_BT_BT_ADDRESS 0x00008500 -#define MAC_PCU_BT_BT_OFFSET 0x00008500 -#define MAC_PCU_BT_BT_WEIGHT_MSB 31 -#define MAC_PCU_BT_BT_WEIGHT_LSB 0 -#define MAC_PCU_BT_BT_WEIGHT_MASK 0xffffffff -#define MAC_PCU_BT_BT_WEIGHT_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_BT_BT_WEIGHT_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_RX_INT_STATUS0 */ -#define MAC_PCU_RX_INT_STATUS0_ADDRESS 0x00008600 -#define MAC_PCU_RX_INT_STATUS0_OFFSET 0x00008600 -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_L_MSB 7 -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_L_LSB 0 -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_L_MASK 0x000000ff -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_L_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_H_MSB 15 -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_H_LSB 8 -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_H_MASK 0x0000ff00 -#define MAC_PCU_RX_INT_STATUS0_FRAME_CONTROL_H_GET(x) (((x) & 0x0000ff00) >> 8) -#define MAC_PCU_RX_INT_STATUS0_DURATION_L_MSB 23 -#define MAC_PCU_RX_INT_STATUS0_DURATION_L_LSB 16 -#define MAC_PCU_RX_INT_STATUS0_DURATION_L_MASK 0x00ff0000 -#define MAC_PCU_RX_INT_STATUS0_DURATION_L_GET(x) (((x) & 0x00ff0000) >> 16) -#define MAC_PCU_RX_INT_STATUS0_DURATION_H_MSB 31 -#define MAC_PCU_RX_INT_STATUS0_DURATION_H_LSB 24 -#define MAC_PCU_RX_INT_STATUS0_DURATION_H_MASK 0xff000000 -#define MAC_PCU_RX_INT_STATUS0_DURATION_H_GET(x) (((x) & 0xff000000) >> 24) - -/* macros for MAC_PCU_RX_INT_STATUS1 */ -#define MAC_PCU_RX_INT_STATUS1_ADDRESS 0x00008604 -#define MAC_PCU_RX_INT_STATUS1_OFFSET 0x00008604 -#define MAC_PCU_RX_INT_STATUS1_VALUE_MSB 17 -#define MAC_PCU_RX_INT_STATUS1_VALUE_LSB 0 -#define MAC_PCU_RX_INT_STATUS1_VALUE_MASK 0x0003ffff -#define MAC_PCU_RX_INT_STATUS1_VALUE_GET(x) (((x) & 0x0003ffff) >> 0) - -/* macros for MAC_PCU_RX_INT_STATUS2 */ -#define MAC_PCU_RX_INT_STATUS2_ADDRESS 0x00008608 -#define MAC_PCU_RX_INT_STATUS2_OFFSET 0x00008608 -#define MAC_PCU_RX_INT_STATUS2_VALUE_MSB 26 -#define MAC_PCU_RX_INT_STATUS2_VALUE_LSB 0 -#define MAC_PCU_RX_INT_STATUS2_VALUE_MASK 0x07ffffff -#define MAC_PCU_RX_INT_STATUS2_VALUE_GET(x) (((x) & 0x07ffffff) >> 0) - -/* macros for MAC_PCU_RX_INT_STATUS3 */ -#define MAC_PCU_RX_INT_STATUS3_ADDRESS 0x0000860c -#define MAC_PCU_RX_INT_STATUS3_OFFSET 0x0000860c -#define MAC_PCU_RX_INT_STATUS3_VALUE_MSB 23 -#define MAC_PCU_RX_INT_STATUS3_VALUE_LSB 0 -#define MAC_PCU_RX_INT_STATUS3_VALUE_MASK 0x00ffffff -#define MAC_PCU_RX_INT_STATUS3_VALUE_GET(x) (((x) & 0x00ffffff) >> 0) - -/* macros for HT_HALF_GI_RATE1 */ -#define HT_HALF_GI_RATE1_ADDRESS 0x00008610 -#define HT_HALF_GI_RATE1_OFFSET 0x00008610 -#define HT_HALF_GI_RATE1_MCS0_MSB 7 -#define HT_HALF_GI_RATE1_MCS0_LSB 0 -#define HT_HALF_GI_RATE1_MCS0_MASK 0x000000ff -#define HT_HALF_GI_RATE1_MCS0_GET(x) (((x) & 0x000000ff) >> 0) -#define HT_HALF_GI_RATE1_MCS0_SET(x) (((x) << 0) & 0x000000ff) -#define HT_HALF_GI_RATE1_MCS1_MSB 15 -#define HT_HALF_GI_RATE1_MCS1_LSB 8 -#define HT_HALF_GI_RATE1_MCS1_MASK 0x0000ff00 -#define HT_HALF_GI_RATE1_MCS1_GET(x) (((x) & 0x0000ff00) >> 8) -#define HT_HALF_GI_RATE1_MCS1_SET(x) (((x) << 8) & 0x0000ff00) -#define HT_HALF_GI_RATE1_MCS2_MSB 23 -#define HT_HALF_GI_RATE1_MCS2_LSB 16 -#define HT_HALF_GI_RATE1_MCS2_MASK 0x00ff0000 -#define HT_HALF_GI_RATE1_MCS2_GET(x) (((x) & 0x00ff0000) >> 16) -#define HT_HALF_GI_RATE1_MCS2_SET(x) (((x) << 16) & 0x00ff0000) -#define HT_HALF_GI_RATE1_MCS3_MSB 31 -#define HT_HALF_GI_RATE1_MCS3_LSB 24 -#define HT_HALF_GI_RATE1_MCS3_MASK 0xff000000 -#define HT_HALF_GI_RATE1_MCS3_GET(x) (((x) & 0xff000000) >> 24) -#define HT_HALF_GI_RATE1_MCS3_SET(x) (((x) << 24) & 0xff000000) - -/* macros for HT_HALF_GI_RATE2 */ -#define HT_HALF_GI_RATE2_ADDRESS 0x00008614 -#define HT_HALF_GI_RATE2_OFFSET 0x00008614 -#define HT_HALF_GI_RATE2_MCS4_MSB 7 -#define HT_HALF_GI_RATE2_MCS4_LSB 0 -#define HT_HALF_GI_RATE2_MCS4_MASK 0x000000ff -#define HT_HALF_GI_RATE2_MCS4_GET(x) (((x) & 0x000000ff) >> 0) -#define HT_HALF_GI_RATE2_MCS4_SET(x) (((x) << 0) & 0x000000ff) -#define HT_HALF_GI_RATE2_MCS5_MSB 15 -#define HT_HALF_GI_RATE2_MCS5_LSB 8 -#define HT_HALF_GI_RATE2_MCS5_MASK 0x0000ff00 -#define HT_HALF_GI_RATE2_MCS5_GET(x) (((x) & 0x0000ff00) >> 8) -#define HT_HALF_GI_RATE2_MCS5_SET(x) (((x) << 8) & 0x0000ff00) -#define HT_HALF_GI_RATE2_MCS6_MSB 23 -#define HT_HALF_GI_RATE2_MCS6_LSB 16 -#define HT_HALF_GI_RATE2_MCS6_MASK 0x00ff0000 -#define HT_HALF_GI_RATE2_MCS6_GET(x) (((x) & 0x00ff0000) >> 16) -#define HT_HALF_GI_RATE2_MCS6_SET(x) (((x) << 16) & 0x00ff0000) -#define HT_HALF_GI_RATE2_MCS7_MSB 31 -#define HT_HALF_GI_RATE2_MCS7_LSB 24 -#define HT_HALF_GI_RATE2_MCS7_MASK 0xff000000 -#define HT_HALF_GI_RATE2_MCS7_GET(x) (((x) & 0xff000000) >> 24) -#define HT_HALF_GI_RATE2_MCS7_SET(x) (((x) << 24) & 0xff000000) - -/* macros for HT_FULL_GI_RATE1 */ -#define HT_FULL_GI_RATE1_ADDRESS 0x00008618 -#define HT_FULL_GI_RATE1_OFFSET 0x00008618 -#define HT_FULL_GI_RATE1_MCS0_MSB 7 -#define HT_FULL_GI_RATE1_MCS0_LSB 0 -#define HT_FULL_GI_RATE1_MCS0_MASK 0x000000ff -#define HT_FULL_GI_RATE1_MCS0_GET(x) (((x) & 0x000000ff) >> 0) -#define HT_FULL_GI_RATE1_MCS0_SET(x) (((x) << 0) & 0x000000ff) -#define HT_FULL_GI_RATE1_MCS1_MSB 15 -#define HT_FULL_GI_RATE1_MCS1_LSB 8 -#define HT_FULL_GI_RATE1_MCS1_MASK 0x0000ff00 -#define HT_FULL_GI_RATE1_MCS1_GET(x) (((x) & 0x0000ff00) >> 8) -#define HT_FULL_GI_RATE1_MCS1_SET(x) (((x) << 8) & 0x0000ff00) -#define HT_FULL_GI_RATE1_MCS2_MSB 23 -#define HT_FULL_GI_RATE1_MCS2_LSB 16 -#define HT_FULL_GI_RATE1_MCS2_MASK 0x00ff0000 -#define HT_FULL_GI_RATE1_MCS2_GET(x) (((x) & 0x00ff0000) >> 16) -#define HT_FULL_GI_RATE1_MCS2_SET(x) (((x) << 16) & 0x00ff0000) -#define HT_FULL_GI_RATE1_MCS3_MSB 31 -#define HT_FULL_GI_RATE1_MCS3_LSB 24 -#define HT_FULL_GI_RATE1_MCS3_MASK 0xff000000 -#define HT_FULL_GI_RATE1_MCS3_GET(x) (((x) & 0xff000000) >> 24) -#define HT_FULL_GI_RATE1_MCS3_SET(x) (((x) << 24) & 0xff000000) - -/* macros for HT_FULL_GI_RATE2 */ -#define HT_FULL_GI_RATE2_ADDRESS 0x0000861c -#define HT_FULL_GI_RATE2_OFFSET 0x0000861c -#define HT_FULL_GI_RATE2_MCS4_MSB 7 -#define HT_FULL_GI_RATE2_MCS4_LSB 0 -#define HT_FULL_GI_RATE2_MCS4_MASK 0x000000ff -#define HT_FULL_GI_RATE2_MCS4_GET(x) (((x) & 0x000000ff) >> 0) -#define HT_FULL_GI_RATE2_MCS4_SET(x) (((x) << 0) & 0x000000ff) -#define HT_FULL_GI_RATE2_MCS5_MSB 15 -#define HT_FULL_GI_RATE2_MCS5_LSB 8 -#define HT_FULL_GI_RATE2_MCS5_MASK 0x0000ff00 -#define HT_FULL_GI_RATE2_MCS5_GET(x) (((x) & 0x0000ff00) >> 8) -#define HT_FULL_GI_RATE2_MCS5_SET(x) (((x) << 8) & 0x0000ff00) -#define HT_FULL_GI_RATE2_MCS6_MSB 23 -#define HT_FULL_GI_RATE2_MCS6_LSB 16 -#define HT_FULL_GI_RATE2_MCS6_MASK 0x00ff0000 -#define HT_FULL_GI_RATE2_MCS6_GET(x) (((x) & 0x00ff0000) >> 16) -#define HT_FULL_GI_RATE2_MCS6_SET(x) (((x) << 16) & 0x00ff0000) -#define HT_FULL_GI_RATE2_MCS7_MSB 31 -#define HT_FULL_GI_RATE2_MCS7_LSB 24 -#define HT_FULL_GI_RATE2_MCS7_MASK 0xff000000 -#define HT_FULL_GI_RATE2_MCS7_GET(x) (((x) & 0xff000000) >> 24) -#define HT_FULL_GI_RATE2_MCS7_SET(x) (((x) << 24) & 0xff000000) - -/* macros for LEGACY_RATE1 */ -#define LEGACY_RATE1_ADDRESS 0x00008620 -#define LEGACY_RATE1_OFFSET 0x00008620 -#define LEGACY_RATE1_RATE8_MSB 5 -#define LEGACY_RATE1_RATE8_LSB 0 -#define LEGACY_RATE1_RATE8_MASK 0x0000003f -#define LEGACY_RATE1_RATE8_GET(x) (((x) & 0x0000003f) >> 0) -#define LEGACY_RATE1_RATE8_SET(x) (((x) << 0) & 0x0000003f) -#define LEGACY_RATE1_RATE9_MSB 11 -#define LEGACY_RATE1_RATE9_LSB 6 -#define LEGACY_RATE1_RATE9_MASK 0x00000fc0 -#define LEGACY_RATE1_RATE9_GET(x) (((x) & 0x00000fc0) >> 6) -#define LEGACY_RATE1_RATE9_SET(x) (((x) << 6) & 0x00000fc0) -#define LEGACY_RATE1_RATE10_MSB 17 -#define LEGACY_RATE1_RATE10_LSB 12 -#define LEGACY_RATE1_RATE10_MASK 0x0003f000 -#define LEGACY_RATE1_RATE10_GET(x) (((x) & 0x0003f000) >> 12) -#define LEGACY_RATE1_RATE10_SET(x) (((x) << 12) & 0x0003f000) -#define LEGACY_RATE1_RATE11_MSB 23 -#define LEGACY_RATE1_RATE11_LSB 18 -#define LEGACY_RATE1_RATE11_MASK 0x00fc0000 -#define LEGACY_RATE1_RATE11_GET(x) (((x) & 0x00fc0000) >> 18) -#define LEGACY_RATE1_RATE11_SET(x) (((x) << 18) & 0x00fc0000) -#define LEGACY_RATE1_RATE12_MSB 29 -#define LEGACY_RATE1_RATE12_LSB 24 -#define LEGACY_RATE1_RATE12_MASK 0x3f000000 -#define LEGACY_RATE1_RATE12_GET(x) (((x) & 0x3f000000) >> 24) -#define LEGACY_RATE1_RATE12_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for LEGACY_RATE2 */ -#define LEGACY_RATE2_ADDRESS 0x00008624 -#define LEGACY_RATE2_OFFSET 0x00008624 -#define LEGACY_RATE2_RATE13_MSB 5 -#define LEGACY_RATE2_RATE13_LSB 0 -#define LEGACY_RATE2_RATE13_MASK 0x0000003f -#define LEGACY_RATE2_RATE13_GET(x) (((x) & 0x0000003f) >> 0) -#define LEGACY_RATE2_RATE13_SET(x) (((x) << 0) & 0x0000003f) -#define LEGACY_RATE2_RATE14_MSB 11 -#define LEGACY_RATE2_RATE14_LSB 6 -#define LEGACY_RATE2_RATE14_MASK 0x00000fc0 -#define LEGACY_RATE2_RATE14_GET(x) (((x) & 0x00000fc0) >> 6) -#define LEGACY_RATE2_RATE14_SET(x) (((x) << 6) & 0x00000fc0) -#define LEGACY_RATE2_RATE15_MSB 17 -#define LEGACY_RATE2_RATE15_LSB 12 -#define LEGACY_RATE2_RATE15_MASK 0x0003f000 -#define LEGACY_RATE2_RATE15_GET(x) (((x) & 0x0003f000) >> 12) -#define LEGACY_RATE2_RATE15_SET(x) (((x) << 12) & 0x0003f000) -#define LEGACY_RATE2_RATE24_MSB 23 -#define LEGACY_RATE2_RATE24_LSB 18 -#define LEGACY_RATE2_RATE24_MASK 0x00fc0000 -#define LEGACY_RATE2_RATE24_GET(x) (((x) & 0x00fc0000) >> 18) -#define LEGACY_RATE2_RATE24_SET(x) (((x) << 18) & 0x00fc0000) -#define LEGACY_RATE2_RATE25_MSB 29 -#define LEGACY_RATE2_RATE25_LSB 24 -#define LEGACY_RATE2_RATE25_MASK 0x3f000000 -#define LEGACY_RATE2_RATE25_GET(x) (((x) & 0x3f000000) >> 24) -#define LEGACY_RATE2_RATE25_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for LEGACY_RATE3 */ -#define LEGACY_RATE3_ADDRESS 0x00008628 -#define LEGACY_RATE3_OFFSET 0x00008628 -#define LEGACY_RATE3_RATE26_MSB 5 -#define LEGACY_RATE3_RATE26_LSB 0 -#define LEGACY_RATE3_RATE26_MASK 0x0000003f -#define LEGACY_RATE3_RATE26_GET(x) (((x) & 0x0000003f) >> 0) -#define LEGACY_RATE3_RATE26_SET(x) (((x) << 0) & 0x0000003f) -#define LEGACY_RATE3_RATE27_MSB 11 -#define LEGACY_RATE3_RATE27_LSB 6 -#define LEGACY_RATE3_RATE27_MASK 0x00000fc0 -#define LEGACY_RATE3_RATE27_GET(x) (((x) & 0x00000fc0) >> 6) -#define LEGACY_RATE3_RATE27_SET(x) (((x) << 6) & 0x00000fc0) -#define LEGACY_RATE3_RATE28_MSB 17 -#define LEGACY_RATE3_RATE28_LSB 12 -#define LEGACY_RATE3_RATE28_MASK 0x0003f000 -#define LEGACY_RATE3_RATE28_GET(x) (((x) & 0x0003f000) >> 12) -#define LEGACY_RATE3_RATE28_SET(x) (((x) << 12) & 0x0003f000) -#define LEGACY_RATE3_RATE29_MSB 23 -#define LEGACY_RATE3_RATE29_LSB 18 -#define LEGACY_RATE3_RATE29_MASK 0x00fc0000 -#define LEGACY_RATE3_RATE29_GET(x) (((x) & 0x00fc0000) >> 18) -#define LEGACY_RATE3_RATE29_SET(x) (((x) << 18) & 0x00fc0000) -#define LEGACY_RATE3_RATE30_MSB 29 -#define LEGACY_RATE3_RATE30_LSB 24 -#define LEGACY_RATE3_RATE30_MASK 0x3f000000 -#define LEGACY_RATE3_RATE30_GET(x) (((x) & 0x3f000000) >> 24) -#define LEGACY_RATE3_RATE30_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for RX_INT_FILTER */ -#define RX_INT_FILTER_ADDRESS 0x0000862c -#define RX_INT_FILTER_OFFSET 0x0000862c -#define RX_INT_FILTER_ENABLE_MSB 0 -#define RX_INT_FILTER_ENABLE_LSB 0 -#define RX_INT_FILTER_ENABLE_MASK 0x00000001 -#define RX_INT_FILTER_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define RX_INT_FILTER_ENABLE_SET(x) (((x) << 0) & 0x00000001) -#define RX_INT_FILTER_DIRECTED_MSB 1 -#define RX_INT_FILTER_DIRECTED_LSB 1 -#define RX_INT_FILTER_DIRECTED_MASK 0x00000002 -#define RX_INT_FILTER_DIRECTED_GET(x) (((x) & 0x00000002) >> 1) -#define RX_INT_FILTER_DIRECTED_SET(x) (((x) << 1) & 0x00000002) -#define RX_INT_FILTER_BCAST_MSB 2 -#define RX_INT_FILTER_BCAST_LSB 2 -#define RX_INT_FILTER_BCAST_MASK 0x00000004 -#define RX_INT_FILTER_BCAST_GET(x) (((x) & 0x00000004) >> 2) -#define RX_INT_FILTER_BCAST_SET(x) (((x) << 2) & 0x00000004) -#define RX_INT_FILTER_MCAST_MSB 3 -#define RX_INT_FILTER_MCAST_LSB 3 -#define RX_INT_FILTER_MCAST_MASK 0x00000008 -#define RX_INT_FILTER_MCAST_GET(x) (((x) & 0x00000008) >> 3) -#define RX_INT_FILTER_MCAST_SET(x) (((x) << 3) & 0x00000008) -#define RX_INT_FILTER_RTS_MSB 4 -#define RX_INT_FILTER_RTS_LSB 4 -#define RX_INT_FILTER_RTS_MASK 0x00000010 -#define RX_INT_FILTER_RTS_GET(x) (((x) & 0x00000010) >> 4) -#define RX_INT_FILTER_RTS_SET(x) (((x) << 4) & 0x00000010) -#define RX_INT_FILTER_ACK_MSB 5 -#define RX_INT_FILTER_ACK_LSB 5 -#define RX_INT_FILTER_ACK_MASK 0x00000020 -#define RX_INT_FILTER_ACK_GET(x) (((x) & 0x00000020) >> 5) -#define RX_INT_FILTER_ACK_SET(x) (((x) << 5) & 0x00000020) -#define RX_INT_FILTER_CTS_MSB 6 -#define RX_INT_FILTER_CTS_LSB 6 -#define RX_INT_FILTER_CTS_MASK 0x00000040 -#define RX_INT_FILTER_CTS_GET(x) (((x) & 0x00000040) >> 6) -#define RX_INT_FILTER_CTS_SET(x) (((x) << 6) & 0x00000040) -#define RX_INT_FILTER_RETRY_MSB 7 -#define RX_INT_FILTER_RETRY_LSB 7 -#define RX_INT_FILTER_RETRY_MASK 0x00000080 -#define RX_INT_FILTER_RETRY_GET(x) (((x) & 0x00000080) >> 7) -#define RX_INT_FILTER_RETRY_SET(x) (((x) << 7) & 0x00000080) -#define RX_INT_FILTER_MORE_DATA_MSB 8 -#define RX_INT_FILTER_MORE_DATA_LSB 8 -#define RX_INT_FILTER_MORE_DATA_MASK 0x00000100 -#define RX_INT_FILTER_MORE_DATA_GET(x) (((x) & 0x00000100) >> 8) -#define RX_INT_FILTER_MORE_DATA_SET(x) (((x) << 8) & 0x00000100) -#define RX_INT_FILTER_MORE_FRAG_MSB 9 -#define RX_INT_FILTER_MORE_FRAG_LSB 9 -#define RX_INT_FILTER_MORE_FRAG_MASK 0x00000200 -#define RX_INT_FILTER_MORE_FRAG_GET(x) (((x) & 0x00000200) >> 9) -#define RX_INT_FILTER_MORE_FRAG_SET(x) (((x) << 9) & 0x00000200) -#define RX_INT_FILTER_RATE_HIGH_MSB 10 -#define RX_INT_FILTER_RATE_HIGH_LSB 10 -#define RX_INT_FILTER_RATE_HIGH_MASK 0x00000400 -#define RX_INT_FILTER_RATE_HIGH_GET(x) (((x) & 0x00000400) >> 10) -#define RX_INT_FILTER_RATE_HIGH_SET(x) (((x) << 10) & 0x00000400) -#define RX_INT_FILTER_RATE_LOW_MSB 11 -#define RX_INT_FILTER_RATE_LOW_LSB 11 -#define RX_INT_FILTER_RATE_LOW_MASK 0x00000800 -#define RX_INT_FILTER_RATE_LOW_GET(x) (((x) & 0x00000800) >> 11) -#define RX_INT_FILTER_RATE_LOW_SET(x) (((x) << 11) & 0x00000800) -#define RX_INT_FILTER_RSSI_MSB 12 -#define RX_INT_FILTER_RSSI_LSB 12 -#define RX_INT_FILTER_RSSI_MASK 0x00001000 -#define RX_INT_FILTER_RSSI_GET(x) (((x) & 0x00001000) >> 12) -#define RX_INT_FILTER_RSSI_SET(x) (((x) << 12) & 0x00001000) -#define RX_INT_FILTER_LENGTH_HIGH_MSB 13 -#define RX_INT_FILTER_LENGTH_HIGH_LSB 13 -#define RX_INT_FILTER_LENGTH_HIGH_MASK 0x00002000 -#define RX_INT_FILTER_LENGTH_HIGH_GET(x) (((x) & 0x00002000) >> 13) -#define RX_INT_FILTER_LENGTH_HIGH_SET(x) (((x) << 13) & 0x00002000) -#define RX_INT_FILTER_LENGTH_LOW_MSB 14 -#define RX_INT_FILTER_LENGTH_LOW_LSB 14 -#define RX_INT_FILTER_LENGTH_LOW_MASK 0x00004000 -#define RX_INT_FILTER_LENGTH_LOW_GET(x) (((x) & 0x00004000) >> 14) -#define RX_INT_FILTER_LENGTH_LOW_SET(x) (((x) << 14) & 0x00004000) -#define RX_INT_FILTER_EOSP_MSB 15 -#define RX_INT_FILTER_EOSP_LSB 15 -#define RX_INT_FILTER_EOSP_MASK 0x00008000 -#define RX_INT_FILTER_EOSP_GET(x) (((x) & 0x00008000) >> 15) -#define RX_INT_FILTER_EOSP_SET(x) (((x) << 15) & 0x00008000) -#define RX_INT_FILTER_AMPDU_MSB 16 -#define RX_INT_FILTER_AMPDU_LSB 16 -#define RX_INT_FILTER_AMPDU_MASK 0x00010000 -#define RX_INT_FILTER_AMPDU_GET(x) (((x) & 0x00010000) >> 16) -#define RX_INT_FILTER_AMPDU_SET(x) (((x) << 16) & 0x00010000) -#define RX_INT_FILTER_BEACON_MSB 17 -#define RX_INT_FILTER_BEACON_LSB 17 -#define RX_INT_FILTER_BEACON_MASK 0x00020000 -#define RX_INT_FILTER_BEACON_GET(x) (((x) & 0x00020000) >> 17) -#define RX_INT_FILTER_BEACON_SET(x) (((x) << 17) & 0x00020000) -#define RX_INT_FILTER_RSSI_HIGH_MSB 18 -#define RX_INT_FILTER_RSSI_HIGH_LSB 18 -#define RX_INT_FILTER_RSSI_HIGH_MASK 0x00040000 -#define RX_INT_FILTER_RSSI_HIGH_GET(x) (((x) & 0x00040000) >> 18) -#define RX_INT_FILTER_RSSI_HIGH_SET(x) (((x) << 18) & 0x00040000) - -/* macros for RX_INT_OVERFLOW */ -#define RX_INT_OVERFLOW_ADDRESS 0x00008630 -#define RX_INT_OVERFLOW_OFFSET 0x00008630 -#define RX_INT_OVERFLOW_STATUS_MSB 0 -#define RX_INT_OVERFLOW_STATUS_LSB 0 -#define RX_INT_OVERFLOW_STATUS_MASK 0x00000001 -#define RX_INT_OVERFLOW_STATUS_GET(x) (((x) & 0x00000001) >> 0) -#define RX_INT_OVERFLOW_STATUS_SET(x) (((x) << 0) & 0x00000001) - -/* macros for RX_FILTER_THRESH0 */ -#define RX_FILTER_THRESH0_ADDRESS 0x00008634 -#define RX_FILTER_THRESH0_OFFSET 0x00008634 -#define RX_FILTER_THRESH0_RATE_HIGH_MSB 7 -#define RX_FILTER_THRESH0_RATE_HIGH_LSB 0 -#define RX_FILTER_THRESH0_RATE_HIGH_MASK 0x000000ff -#define RX_FILTER_THRESH0_RATE_HIGH_GET(x) (((x) & 0x000000ff) >> 0) -#define RX_FILTER_THRESH0_RATE_HIGH_SET(x) (((x) << 0) & 0x000000ff) -#define RX_FILTER_THRESH0_RATE_LOW_MSB 15 -#define RX_FILTER_THRESH0_RATE_LOW_LSB 8 -#define RX_FILTER_THRESH0_RATE_LOW_MASK 0x0000ff00 -#define RX_FILTER_THRESH0_RATE_LOW_GET(x) (((x) & 0x0000ff00) >> 8) -#define RX_FILTER_THRESH0_RATE_LOW_SET(x) (((x) << 8) & 0x0000ff00) -#define RX_FILTER_THRESH0_RSSI_LOW_MSB 23 -#define RX_FILTER_THRESH0_RSSI_LOW_LSB 16 -#define RX_FILTER_THRESH0_RSSI_LOW_MASK 0x00ff0000 -#define RX_FILTER_THRESH0_RSSI_LOW_GET(x) (((x) & 0x00ff0000) >> 16) -#define RX_FILTER_THRESH0_RSSI_LOW_SET(x) (((x) << 16) & 0x00ff0000) -#define RX_FILTER_THRESH0_RSSI_HIGH_MSB 31 -#define RX_FILTER_THRESH0_RSSI_HIGH_LSB 24 -#define RX_FILTER_THRESH0_RSSI_HIGH_MASK 0xff000000 -#define RX_FILTER_THRESH0_RSSI_HIGH_GET(x) (((x) & 0xff000000) >> 24) -#define RX_FILTER_THRESH0_RSSI_HIGH_SET(x) (((x) << 24) & 0xff000000) - -/* macros for RX_FILTER_THRESH1 */ -#define RX_FILTER_THRESH1_ADDRESS 0x00008638 -#define RX_FILTER_THRESH1_OFFSET 0x00008638 -#define RX_FILTER_THRESH1_LENGTH_HIGH_MSB 11 -#define RX_FILTER_THRESH1_LENGTH_HIGH_LSB 0 -#define RX_FILTER_THRESH1_LENGTH_HIGH_MASK 0x00000fff -#define RX_FILTER_THRESH1_LENGTH_HIGH_GET(x) (((x) & 0x00000fff) >> 0) -#define RX_FILTER_THRESH1_LENGTH_HIGH_SET(x) (((x) << 0) & 0x00000fff) -#define RX_FILTER_THRESH1_LENGTH_LOW_MSB 23 -#define RX_FILTER_THRESH1_LENGTH_LOW_LSB 12 -#define RX_FILTER_THRESH1_LENGTH_LOW_MASK 0x00fff000 -#define RX_FILTER_THRESH1_LENGTH_LOW_GET(x) (((x) & 0x00fff000) >> 12) -#define RX_FILTER_THRESH1_LENGTH_LOW_SET(x) (((x) << 12) & 0x00fff000) - -/* macros for RX_PRIORITY_THRESH0 */ -#define RX_PRIORITY_THRESH0_ADDRESS 0x0000863c -#define RX_PRIORITY_THRESH0_OFFSET 0x0000863c -#define RX_PRIORITY_THRESH0_RATE_HIGH_MSB 7 -#define RX_PRIORITY_THRESH0_RATE_HIGH_LSB 0 -#define RX_PRIORITY_THRESH0_RATE_HIGH_MASK 0x000000ff -#define RX_PRIORITY_THRESH0_RATE_HIGH_GET(x) (((x) & 0x000000ff) >> 0) -#define RX_PRIORITY_THRESH0_RATE_HIGH_SET(x) (((x) << 0) & 0x000000ff) -#define RX_PRIORITY_THRESH0_RATE_LOW_MSB 15 -#define RX_PRIORITY_THRESH0_RATE_LOW_LSB 8 -#define RX_PRIORITY_THRESH0_RATE_LOW_MASK 0x0000ff00 -#define RX_PRIORITY_THRESH0_RATE_LOW_GET(x) (((x) & 0x0000ff00) >> 8) -#define RX_PRIORITY_THRESH0_RATE_LOW_SET(x) (((x) << 8) & 0x0000ff00) -#define RX_PRIORITY_THRESH0_RSSI_HIGH_MSB 23 -#define RX_PRIORITY_THRESH0_RSSI_HIGH_LSB 16 -#define RX_PRIORITY_THRESH0_RSSI_HIGH_MASK 0x00ff0000 -#define RX_PRIORITY_THRESH0_RSSI_HIGH_GET(x) (((x) & 0x00ff0000) >> 16) -#define RX_PRIORITY_THRESH0_RSSI_HIGH_SET(x) (((x) << 16) & 0x00ff0000) -#define RX_PRIORITY_THRESH0_RSSI_LOW_MSB 31 -#define RX_PRIORITY_THRESH0_RSSI_LOW_LSB 24 -#define RX_PRIORITY_THRESH0_RSSI_LOW_MASK 0xff000000 -#define RX_PRIORITY_THRESH0_RSSI_LOW_GET(x) (((x) & 0xff000000) >> 24) -#define RX_PRIORITY_THRESH0_RSSI_LOW_SET(x) (((x) << 24) & 0xff000000) - -/* macros for RX_PRIORITY_THRESH1 */ -#define RX_PRIORITY_THRESH1_ADDRESS 0x00008640 -#define RX_PRIORITY_THRESH1_OFFSET 0x00008640 -#define RX_PRIORITY_THRESH1_LENGTH_HIGH_MSB 11 -#define RX_PRIORITY_THRESH1_LENGTH_HIGH_LSB 0 -#define RX_PRIORITY_THRESH1_LENGTH_HIGH_MASK 0x00000fff -#define RX_PRIORITY_THRESH1_LENGTH_HIGH_GET(x) (((x) & 0x00000fff) >> 0) -#define RX_PRIORITY_THRESH1_LENGTH_HIGH_SET(x) (((x) << 0) & 0x00000fff) -#define RX_PRIORITY_THRESH1_LENGTH_LOW_MSB 23 -#define RX_PRIORITY_THRESH1_LENGTH_LOW_LSB 12 -#define RX_PRIORITY_THRESH1_LENGTH_LOW_MASK 0x00fff000 -#define RX_PRIORITY_THRESH1_LENGTH_LOW_GET(x) (((x) & 0x00fff000) >> 12) -#define RX_PRIORITY_THRESH1_LENGTH_LOW_SET(x) (((x) << 12) & 0x00fff000) -#define RX_PRIORITY_THRESH1_XCAST_RSSI_HIGH_MSB 31 -#define RX_PRIORITY_THRESH1_XCAST_RSSI_HIGH_LSB 24 -#define RX_PRIORITY_THRESH1_XCAST_RSSI_HIGH_MASK 0xff000000 -#define RX_PRIORITY_THRESH1_XCAST_RSSI_HIGH_GET(x) (((x) & 0xff000000) >> 24) -#define RX_PRIORITY_THRESH1_XCAST_RSSI_HIGH_SET(x) (((x) << 24) & 0xff000000) - -/* macros for RX_PRIORITY_THRESH2 */ -#define RX_PRIORITY_THRESH2_ADDRESS 0x00008644 -#define RX_PRIORITY_THRESH2_OFFSET 0x00008644 -#define RX_PRIORITY_THRESH2_PRESP_RSSI_HIGH_MSB 7 -#define RX_PRIORITY_THRESH2_PRESP_RSSI_HIGH_LSB 0 -#define RX_PRIORITY_THRESH2_PRESP_RSSI_HIGH_MASK 0x000000ff -#define RX_PRIORITY_THRESH2_PRESP_RSSI_HIGH_GET(x) (((x) & 0x000000ff) >> 0) -#define RX_PRIORITY_THRESH2_PRESP_RSSI_HIGH_SET(x) (((x) << 0) & 0x000000ff) -#define RX_PRIORITY_THRESH2_MGMT_RSSI_HIGH_MSB 15 -#define RX_PRIORITY_THRESH2_MGMT_RSSI_HIGH_LSB 8 -#define RX_PRIORITY_THRESH2_MGMT_RSSI_HIGH_MASK 0x0000ff00 -#define RX_PRIORITY_THRESH2_MGMT_RSSI_HIGH_GET(x) (((x) & 0x0000ff00) >> 8) -#define RX_PRIORITY_THRESH2_MGMT_RSSI_HIGH_SET(x) (((x) << 8) & 0x0000ff00) -#define RX_PRIORITY_THRESH2_BEACON_RSSI_HIGH_MSB 23 -#define RX_PRIORITY_THRESH2_BEACON_RSSI_HIGH_LSB 16 -#define RX_PRIORITY_THRESH2_BEACON_RSSI_HIGH_MASK 0x00ff0000 -#define RX_PRIORITY_THRESH2_BEACON_RSSI_HIGH_GET(x) (((x) & 0x00ff0000) >> 16) -#define RX_PRIORITY_THRESH2_BEACON_RSSI_HIGH_SET(x) (((x) << 16) & 0x00ff0000) -#define RX_PRIORITY_THRESH2_NULL_RSSI_HIGH_MSB 31 -#define RX_PRIORITY_THRESH2_NULL_RSSI_HIGH_LSB 24 -#define RX_PRIORITY_THRESH2_NULL_RSSI_HIGH_MASK 0xff000000 -#define RX_PRIORITY_THRESH2_NULL_RSSI_HIGH_GET(x) (((x) & 0xff000000) >> 24) -#define RX_PRIORITY_THRESH2_NULL_RSSI_HIGH_SET(x) (((x) << 24) & 0xff000000) - -/* macros for RX_PRIORITY_THRESH3 */ -#define RX_PRIORITY_THRESH3_ADDRESS 0x00008648 -#define RX_PRIORITY_THRESH3_OFFSET 0x00008648 -#define RX_PRIORITY_THRESH3_PREQ_RSSI_HIGH_MSB 7 -#define RX_PRIORITY_THRESH3_PREQ_RSSI_HIGH_LSB 0 -#define RX_PRIORITY_THRESH3_PREQ_RSSI_HIGH_MASK 0x000000ff -#define RX_PRIORITY_THRESH3_PREQ_RSSI_HIGH_GET(x) (((x) & 0x000000ff) >> 0) -#define RX_PRIORITY_THRESH3_PREQ_RSSI_HIGH_SET(x) (((x) << 0) & 0x000000ff) -#define RX_PRIORITY_THRESH3_PS_POLL_RSSI_HIGH_MSB 15 -#define RX_PRIORITY_THRESH3_PS_POLL_RSSI_HIGH_LSB 8 -#define RX_PRIORITY_THRESH3_PS_POLL_RSSI_HIGH_MASK 0x0000ff00 -#define RX_PRIORITY_THRESH3_PS_POLL_RSSI_HIGH_GET(x) (((x) & 0x0000ff00) >> 8) -#define RX_PRIORITY_THRESH3_PS_POLL_RSSI_HIGH_SET(x) (((x) << 8) & 0x0000ff00) - -/* macros for RX_PRIORITY_OFFSET0 */ -#define RX_PRIORITY_OFFSET0_ADDRESS 0x0000864c -#define RX_PRIORITY_OFFSET0_OFFSET 0x0000864c -#define RX_PRIORITY_OFFSET0_PHY_RATE_HIGH_MSB 5 -#define RX_PRIORITY_OFFSET0_PHY_RATE_HIGH_LSB 0 -#define RX_PRIORITY_OFFSET0_PHY_RATE_HIGH_MASK 0x0000003f -#define RX_PRIORITY_OFFSET0_PHY_RATE_HIGH_GET(x) (((x) & 0x0000003f) >> 0) -#define RX_PRIORITY_OFFSET0_PHY_RATE_HIGH_SET(x) (((x) << 0) & 0x0000003f) -#define RX_PRIORITY_OFFSET0_PHY_RATE_LOW_MSB 11 -#define RX_PRIORITY_OFFSET0_PHY_RATE_LOW_LSB 6 -#define RX_PRIORITY_OFFSET0_PHY_RATE_LOW_MASK 0x00000fc0 -#define RX_PRIORITY_OFFSET0_PHY_RATE_LOW_GET(x) (((x) & 0x00000fc0) >> 6) -#define RX_PRIORITY_OFFSET0_PHY_RATE_LOW_SET(x) (((x) << 6) & 0x00000fc0) -#define RX_PRIORITY_OFFSET0_RSSI_HIGH_MSB 17 -#define RX_PRIORITY_OFFSET0_RSSI_HIGH_LSB 12 -#define RX_PRIORITY_OFFSET0_RSSI_HIGH_MASK 0x0003f000 -#define RX_PRIORITY_OFFSET0_RSSI_HIGH_GET(x) (((x) & 0x0003f000) >> 12) -#define RX_PRIORITY_OFFSET0_RSSI_HIGH_SET(x) (((x) << 12) & 0x0003f000) -#define RX_PRIORITY_OFFSET0_RSSI_LOW_MSB 23 -#define RX_PRIORITY_OFFSET0_RSSI_LOW_LSB 18 -#define RX_PRIORITY_OFFSET0_RSSI_LOW_MASK 0x00fc0000 -#define RX_PRIORITY_OFFSET0_RSSI_LOW_GET(x) (((x) & 0x00fc0000) >> 18) -#define RX_PRIORITY_OFFSET0_RSSI_LOW_SET(x) (((x) << 18) & 0x00fc0000) -#define RX_PRIORITY_OFFSET0_XCAST_RSSI_HIGH_MSB 29 -#define RX_PRIORITY_OFFSET0_XCAST_RSSI_HIGH_LSB 24 -#define RX_PRIORITY_OFFSET0_XCAST_RSSI_HIGH_MASK 0x3f000000 -#define RX_PRIORITY_OFFSET0_XCAST_RSSI_HIGH_GET(x) (((x) & 0x3f000000) >> 24) -#define RX_PRIORITY_OFFSET0_XCAST_RSSI_HIGH_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for RX_PRIORITY_OFFSET1 */ -#define RX_PRIORITY_OFFSET1_ADDRESS 0x00008650 -#define RX_PRIORITY_OFFSET1_OFFSET 0x00008650 -#define RX_PRIORITY_OFFSET1_LENGTH_HIGH_MSB 5 -#define RX_PRIORITY_OFFSET1_LENGTH_HIGH_LSB 0 -#define RX_PRIORITY_OFFSET1_LENGTH_HIGH_MASK 0x0000003f -#define RX_PRIORITY_OFFSET1_LENGTH_HIGH_GET(x) (((x) & 0x0000003f) >> 0) -#define RX_PRIORITY_OFFSET1_LENGTH_HIGH_SET(x) (((x) << 0) & 0x0000003f) -#define RX_PRIORITY_OFFSET1_LENGTH_LOW_MSB 11 -#define RX_PRIORITY_OFFSET1_LENGTH_LOW_LSB 6 -#define RX_PRIORITY_OFFSET1_LENGTH_LOW_MASK 0x00000fc0 -#define RX_PRIORITY_OFFSET1_LENGTH_LOW_GET(x) (((x) & 0x00000fc0) >> 6) -#define RX_PRIORITY_OFFSET1_LENGTH_LOW_SET(x) (((x) << 6) & 0x00000fc0) -#define RX_PRIORITY_OFFSET1_PRESP_RSSI_HIGH_MSB 17 -#define RX_PRIORITY_OFFSET1_PRESP_RSSI_HIGH_LSB 12 -#define RX_PRIORITY_OFFSET1_PRESP_RSSI_HIGH_MASK 0x0003f000 -#define RX_PRIORITY_OFFSET1_PRESP_RSSI_HIGH_GET(x) (((x) & 0x0003f000) >> 12) -#define RX_PRIORITY_OFFSET1_PRESP_RSSI_HIGH_SET(x) (((x) << 12) & 0x0003f000) -#define RX_PRIORITY_OFFSET1_RETX_MSB 23 -#define RX_PRIORITY_OFFSET1_RETX_LSB 18 -#define RX_PRIORITY_OFFSET1_RETX_MASK 0x00fc0000 -#define RX_PRIORITY_OFFSET1_RETX_GET(x) (((x) & 0x00fc0000) >> 18) -#define RX_PRIORITY_OFFSET1_RETX_SET(x) (((x) << 18) & 0x00fc0000) -#define RX_PRIORITY_OFFSET1_RTS_MSB 29 -#define RX_PRIORITY_OFFSET1_RTS_LSB 24 -#define RX_PRIORITY_OFFSET1_RTS_MASK 0x3f000000 -#define RX_PRIORITY_OFFSET1_RTS_GET(x) (((x) & 0x3f000000) >> 24) -#define RX_PRIORITY_OFFSET1_RTS_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for RX_PRIORITY_OFFSET2 */ -#define RX_PRIORITY_OFFSET2_ADDRESS 0x00008654 -#define RX_PRIORITY_OFFSET2_OFFSET 0x00008654 -#define RX_PRIORITY_OFFSET2_XCAST_MSB 5 -#define RX_PRIORITY_OFFSET2_XCAST_LSB 0 -#define RX_PRIORITY_OFFSET2_XCAST_MASK 0x0000003f -#define RX_PRIORITY_OFFSET2_XCAST_GET(x) (((x) & 0x0000003f) >> 0) -#define RX_PRIORITY_OFFSET2_XCAST_SET(x) (((x) << 0) & 0x0000003f) -#define RX_PRIORITY_OFFSET2_PRESP_MSB 11 -#define RX_PRIORITY_OFFSET2_PRESP_LSB 6 -#define RX_PRIORITY_OFFSET2_PRESP_MASK 0x00000fc0 -#define RX_PRIORITY_OFFSET2_PRESP_GET(x) (((x) & 0x00000fc0) >> 6) -#define RX_PRIORITY_OFFSET2_PRESP_SET(x) (((x) << 6) & 0x00000fc0) -#define RX_PRIORITY_OFFSET2_ATIM_MSB 17 -#define RX_PRIORITY_OFFSET2_ATIM_LSB 12 -#define RX_PRIORITY_OFFSET2_ATIM_MASK 0x0003f000 -#define RX_PRIORITY_OFFSET2_ATIM_GET(x) (((x) & 0x0003f000) >> 12) -#define RX_PRIORITY_OFFSET2_ATIM_SET(x) (((x) << 12) & 0x0003f000) -#define RX_PRIORITY_OFFSET2_MGMT_MSB 23 -#define RX_PRIORITY_OFFSET2_MGMT_LSB 18 -#define RX_PRIORITY_OFFSET2_MGMT_MASK 0x00fc0000 -#define RX_PRIORITY_OFFSET2_MGMT_GET(x) (((x) & 0x00fc0000) >> 18) -#define RX_PRIORITY_OFFSET2_MGMT_SET(x) (((x) << 18) & 0x00fc0000) -#define RX_PRIORITY_OFFSET2_BEACON_MSB 29 -#define RX_PRIORITY_OFFSET2_BEACON_LSB 24 -#define RX_PRIORITY_OFFSET2_BEACON_MASK 0x3f000000 -#define RX_PRIORITY_OFFSET2_BEACON_GET(x) (((x) & 0x3f000000) >> 24) -#define RX_PRIORITY_OFFSET2_BEACON_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for RX_PRIORITY_OFFSET3 */ -#define RX_PRIORITY_OFFSET3_ADDRESS 0x00008658 -#define RX_PRIORITY_OFFSET3_OFFSET 0x00008658 -#define RX_PRIORITY_OFFSET3_MORE_MSB 5 -#define RX_PRIORITY_OFFSET3_MORE_LSB 0 -#define RX_PRIORITY_OFFSET3_MORE_MASK 0x0000003f -#define RX_PRIORITY_OFFSET3_MORE_GET(x) (((x) & 0x0000003f) >> 0) -#define RX_PRIORITY_OFFSET3_MORE_SET(x) (((x) << 0) & 0x0000003f) -#define RX_PRIORITY_OFFSET3_EOSP_MSB 11 -#define RX_PRIORITY_OFFSET3_EOSP_LSB 6 -#define RX_PRIORITY_OFFSET3_EOSP_MASK 0x00000fc0 -#define RX_PRIORITY_OFFSET3_EOSP_GET(x) (((x) & 0x00000fc0) >> 6) -#define RX_PRIORITY_OFFSET3_EOSP_SET(x) (((x) << 6) & 0x00000fc0) -#define RX_PRIORITY_OFFSET3_AMPDU_MSB 17 -#define RX_PRIORITY_OFFSET3_AMPDU_LSB 12 -#define RX_PRIORITY_OFFSET3_AMPDU_MASK 0x0003f000 -#define RX_PRIORITY_OFFSET3_AMPDU_GET(x) (((x) & 0x0003f000) >> 12) -#define RX_PRIORITY_OFFSET3_AMPDU_SET(x) (((x) << 12) & 0x0003f000) -#define RX_PRIORITY_OFFSET3_AMSDU_MSB 23 -#define RX_PRIORITY_OFFSET3_AMSDU_LSB 18 -#define RX_PRIORITY_OFFSET3_AMSDU_MASK 0x00fc0000 -#define RX_PRIORITY_OFFSET3_AMSDU_GET(x) (((x) & 0x00fc0000) >> 18) -#define RX_PRIORITY_OFFSET3_AMSDU_SET(x) (((x) << 18) & 0x00fc0000) -#define RX_PRIORITY_OFFSET3_PS_POLL_MSB 29 -#define RX_PRIORITY_OFFSET3_PS_POLL_LSB 24 -#define RX_PRIORITY_OFFSET3_PS_POLL_MASK 0x3f000000 -#define RX_PRIORITY_OFFSET3_PS_POLL_GET(x) (((x) & 0x3f000000) >> 24) -#define RX_PRIORITY_OFFSET3_PS_POLL_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for RX_PRIORITY_OFFSET4 */ -#define RX_PRIORITY_OFFSET4_ADDRESS 0x0000865c -#define RX_PRIORITY_OFFSET4_OFFSET 0x0000865c -#define RX_PRIORITY_OFFSET4_PREQ_MSB 5 -#define RX_PRIORITY_OFFSET4_PREQ_LSB 0 -#define RX_PRIORITY_OFFSET4_PREQ_MASK 0x0000003f -#define RX_PRIORITY_OFFSET4_PREQ_GET(x) (((x) & 0x0000003f) >> 0) -#define RX_PRIORITY_OFFSET4_PREQ_SET(x) (((x) << 0) & 0x0000003f) -#define RX_PRIORITY_OFFSET4_NULL_MSB 11 -#define RX_PRIORITY_OFFSET4_NULL_LSB 6 -#define RX_PRIORITY_OFFSET4_NULL_MASK 0x00000fc0 -#define RX_PRIORITY_OFFSET4_NULL_GET(x) (((x) & 0x00000fc0) >> 6) -#define RX_PRIORITY_OFFSET4_NULL_SET(x) (((x) << 6) & 0x00000fc0) -#define RX_PRIORITY_OFFSET4_BEACON_SSID_MSB 17 -#define RX_PRIORITY_OFFSET4_BEACON_SSID_LSB 12 -#define RX_PRIORITY_OFFSET4_BEACON_SSID_MASK 0x0003f000 -#define RX_PRIORITY_OFFSET4_BEACON_SSID_GET(x) (((x) & 0x0003f000) >> 12) -#define RX_PRIORITY_OFFSET4_BEACON_SSID_SET(x) (((x) << 12) & 0x0003f000) -#define RX_PRIORITY_OFFSET4_MGMT_RSSI_HIGH_MSB 23 -#define RX_PRIORITY_OFFSET4_MGMT_RSSI_HIGH_LSB 18 -#define RX_PRIORITY_OFFSET4_MGMT_RSSI_HIGH_MASK 0x00fc0000 -#define RX_PRIORITY_OFFSET4_MGMT_RSSI_HIGH_GET(x) (((x) & 0x00fc0000) >> 18) -#define RX_PRIORITY_OFFSET4_MGMT_RSSI_HIGH_SET(x) (((x) << 18) & 0x00fc0000) -#define RX_PRIORITY_OFFSET4_BEACON_RSSI_HIGH_MSB 29 -#define RX_PRIORITY_OFFSET4_BEACON_RSSI_HIGH_LSB 24 -#define RX_PRIORITY_OFFSET4_BEACON_RSSI_HIGH_MASK 0x3f000000 -#define RX_PRIORITY_OFFSET4_BEACON_RSSI_HIGH_GET(x) (((x) & 0x3f000000) >> 24) -#define RX_PRIORITY_OFFSET4_BEACON_RSSI_HIGH_SET(x) (((x) << 24) & 0x3f000000) - -/* macros for RX_PRIORITY_OFFSET5 */ -#define RX_PRIORITY_OFFSET5_ADDRESS 0x00008660 -#define RX_PRIORITY_OFFSET5_OFFSET 0x00008660 -#define RX_PRIORITY_OFFSET5_NULL_RSSI_HIGH_MSB 5 -#define RX_PRIORITY_OFFSET5_NULL_RSSI_HIGH_LSB 0 -#define RX_PRIORITY_OFFSET5_NULL_RSSI_HIGH_MASK 0x0000003f -#define RX_PRIORITY_OFFSET5_NULL_RSSI_HIGH_GET(x) (((x) & 0x0000003f) >> 0) -#define RX_PRIORITY_OFFSET5_NULL_RSSI_HIGH_SET(x) (((x) << 0) & 0x0000003f) -#define RX_PRIORITY_OFFSET5_PREQ_RSSI_HIGH_MSB 11 -#define RX_PRIORITY_OFFSET5_PREQ_RSSI_HIGH_LSB 6 -#define RX_PRIORITY_OFFSET5_PREQ_RSSI_HIGH_MASK 0x00000fc0 -#define RX_PRIORITY_OFFSET5_PREQ_RSSI_HIGH_GET(x) (((x) & 0x00000fc0) >> 6) -#define RX_PRIORITY_OFFSET5_PREQ_RSSI_HIGH_SET(x) (((x) << 6) & 0x00000fc0) -#define RX_PRIORITY_OFFSET5_PS_POLL_RSSI_HIGH_MSB 17 -#define RX_PRIORITY_OFFSET5_PS_POLL_RSSI_HIGH_LSB 12 -#define RX_PRIORITY_OFFSET5_PS_POLL_RSSI_HIGH_MASK 0x0003f000 -#define RX_PRIORITY_OFFSET5_PS_POLL_RSSI_HIGH_GET(x) (((x) & 0x0003f000) >> 12) -#define RX_PRIORITY_OFFSET5_PS_POLL_RSSI_HIGH_SET(x) (((x) << 12) & 0x0003f000) - -/* macros for MAC_PCU_LAST_BEACON2_TSF */ -#define MAC_PCU_LAST_BEACON2_TSF_ADDRESS 0x00008664 -#define MAC_PCU_LAST_BEACON2_TSF_OFFSET 0x00008664 -#define MAC_PCU_LAST_BEACON2_TSF_VALUE_MSB 31 -#define MAC_PCU_LAST_BEACON2_TSF_VALUE_LSB 0 -#define MAC_PCU_LAST_BEACON2_TSF_VALUE_MASK 0xffffffff -#define MAC_PCU_LAST_BEACON2_TSF_VALUE_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_PCU_PHY_ERROR_AIFS */ -#define MAC_PCU_PHY_ERROR_AIFS_ADDRESS 0x00008668 -#define MAC_PCU_PHY_ERROR_AIFS_OFFSET 0x00008668 -#define MAC_PCU_PHY_ERROR_AIFS_MASK_ENABLE_MSB 0 -#define MAC_PCU_PHY_ERROR_AIFS_MASK_ENABLE_LSB 0 -#define MAC_PCU_PHY_ERROR_AIFS_MASK_ENABLE_MASK 0x00000001 -#define MAC_PCU_PHY_ERROR_AIFS_MASK_ENABLE_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_PHY_ERROR_AIFS_MASK_ENABLE_SET(x) (((x) << 0) & 0x00000001) - -/* macros for MAC_PCU_PHY_ERROR_AIFS_MASK */ -#define MAC_PCU_PHY_ERROR_AIFS_MASK_ADDRESS 0x0000866c -#define MAC_PCU_PHY_ERROR_AIFS_MASK_OFFSET 0x0000866c -#define MAC_PCU_PHY_ERROR_AIFS_MASK_VALUE_MSB 31 -#define MAC_PCU_PHY_ERROR_AIFS_MASK_VALUE_LSB 0 -#define MAC_PCU_PHY_ERROR_AIFS_MASK_VALUE_MASK 0xffffffff -#define MAC_PCU_PHY_ERROR_AIFS_MASK_VALUE_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_PHY_ERROR_AIFS_MASK_VALUE_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_FILTER_RSSI_AVE */ -#define MAC_PCU_FILTER_RSSI_AVE_ADDRESS 0x00008670 -#define MAC_PCU_FILTER_RSSI_AVE_OFFSET 0x00008670 -#define MAC_PCU_FILTER_RSSI_AVE_AVE_VALUE_MSB 7 -#define MAC_PCU_FILTER_RSSI_AVE_AVE_VALUE_LSB 0 -#define MAC_PCU_FILTER_RSSI_AVE_AVE_VALUE_MASK 0x000000ff -#define MAC_PCU_FILTER_RSSI_AVE_AVE_VALUE_GET(x) (((x) & 0x000000ff) >> 0) -#define MAC_PCU_FILTER_RSSI_AVE_AVE_VALUE_SET(x) (((x) << 0) & 0x000000ff) -#define MAC_PCU_FILTER_RSSI_AVE_NUM_FRAMES_EXPONENT_MSB 10 -#define MAC_PCU_FILTER_RSSI_AVE_NUM_FRAMES_EXPONENT_LSB 8 -#define MAC_PCU_FILTER_RSSI_AVE_NUM_FRAMES_EXPONENT_MASK 0x00000700 -#define MAC_PCU_FILTER_RSSI_AVE_NUM_FRAMES_EXPONENT_GET(x) (((x) & 0x00000700) >> 8) -#define MAC_PCU_FILTER_RSSI_AVE_NUM_FRAMES_EXPONENT_SET(x) (((x) << 8) & 0x00000700) -#define MAC_PCU_FILTER_RSSI_AVE_ENABLE_MSB 11 -#define MAC_PCU_FILTER_RSSI_AVE_ENABLE_LSB 11 -#define MAC_PCU_FILTER_RSSI_AVE_ENABLE_MASK 0x00000800 -#define MAC_PCU_FILTER_RSSI_AVE_ENABLE_GET(x) (((x) & 0x00000800) >> 11) -#define MAC_PCU_FILTER_RSSI_AVE_ENABLE_SET(x) (((x) << 11) & 0x00000800) -#define MAC_PCU_FILTER_RSSI_AVE_RESET_MSB 12 -#define MAC_PCU_FILTER_RSSI_AVE_RESET_LSB 12 -#define MAC_PCU_FILTER_RSSI_AVE_RESET_MASK 0x00001000 -#define MAC_PCU_FILTER_RSSI_AVE_RESET_GET(x) (((x) & 0x00001000) >> 12) -#define MAC_PCU_FILTER_RSSI_AVE_RESET_SET(x) (((x) << 12) & 0x00001000) - -/* macros for MAC_PCU_TBD_FILTER */ -#define MAC_PCU_TBD_FILTER_ADDRESS 0x00008674 -#define MAC_PCU_TBD_FILTER_OFFSET 0x00008674 -#define MAC_PCU_TBD_FILTER_USE_WBTIMER_TX_TS_MSB 0 -#define MAC_PCU_TBD_FILTER_USE_WBTIMER_TX_TS_LSB 0 -#define MAC_PCU_TBD_FILTER_USE_WBTIMER_TX_TS_MASK 0x00000001 -#define MAC_PCU_TBD_FILTER_USE_WBTIMER_TX_TS_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_PCU_TBD_FILTER_USE_WBTIMER_TX_TS_SET(x) (((x) << 0) & 0x00000001) -#define MAC_PCU_TBD_FILTER_USE_WBTIMER_RX_TS_MSB 1 -#define MAC_PCU_TBD_FILTER_USE_WBTIMER_RX_TS_LSB 1 -#define MAC_PCU_TBD_FILTER_USE_WBTIMER_RX_TS_MASK 0x00000002 -#define MAC_PCU_TBD_FILTER_USE_WBTIMER_RX_TS_GET(x) (((x) & 0x00000002) >> 1) -#define MAC_PCU_TBD_FILTER_USE_WBTIMER_RX_TS_SET(x) (((x) << 1) & 0x00000002) - -/* macros for MAC_PCU_BT_ANT_SLEEP_EXTEND */ -#define MAC_PCU_BT_ANT_SLEEP_EXTEND_ADDRESS 0x00008678 -#define MAC_PCU_BT_ANT_SLEEP_EXTEND_OFFSET 0x00008678 -#define MAC_PCU_BT_ANT_SLEEP_EXTEND_CNT_MSB 15 -#define MAC_PCU_BT_ANT_SLEEP_EXTEND_CNT_LSB 0 -#define MAC_PCU_BT_ANT_SLEEP_EXTEND_CNT_MASK 0x0000ffff -#define MAC_PCU_BT_ANT_SLEEP_EXTEND_CNT_GET(x) (((x) & 0x0000ffff) >> 0) -#define MAC_PCU_BT_ANT_SLEEP_EXTEND_CNT_SET(x) (((x) << 0) & 0x0000ffff) - -/* macros for MAC_PCU_KEY_CACHE */ -#define MAC_PCU_KEY_CACHE_ADDRESS 0x00008800 -#define MAC_PCU_KEY_CACHE_OFFSET 0x00008800 -#define MAC_PCU_KEY_CACHE_DATA_MSB 31 -#define MAC_PCU_KEY_CACHE_DATA_LSB 0 -#define MAC_PCU_KEY_CACHE_DATA_MASK 0xffffffff -#define MAC_PCU_KEY_CACHE_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_KEY_CACHE_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_PCU_BUF */ -#define MAC_PCU_BUF_ADDRESS 0x0000e000 -#define MAC_PCU_BUF_OFFSET 0x0000e000 -#define MAC_PCU_BUF_DATA_MSB 31 -#define MAC_PCU_BUF_DATA_LSB 0 -#define MAC_PCU_BUF_DATA_MASK 0xffffffff -#define MAC_PCU_BUF_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_PCU_BUF_DATA_SET(x) (((x) << 0) & 0xffffffff) - - -#ifndef __ASSEMBLER__ - -typedef struct wmac_pcu_reg_reg_s { - volatile char pad__0[0x8000]; /* 0x0 - 0x8000 */ - volatile unsigned int MAC_PCU_STA_ADDR_L32; /* 0x8000 - 0x8004 */ - volatile unsigned int MAC_PCU_STA_ADDR_U16; /* 0x8004 - 0x8008 */ - volatile unsigned int MAC_PCU_BSSID_L32; /* 0x8008 - 0x800c */ - volatile unsigned int MAC_PCU_BSSID_U16; /* 0x800c - 0x8010 */ - volatile unsigned int MAC_PCU_BCN_RSSI_AVE; /* 0x8010 - 0x8014 */ - volatile unsigned int MAC_PCU_ACK_CTS_TIMEOUT; /* 0x8014 - 0x8018 */ - volatile unsigned int MAC_PCU_BCN_RSSI_CTL; /* 0x8018 - 0x801c */ - volatile unsigned int MAC_PCU_USEC_LATENCY; /* 0x801c - 0x8020 */ - volatile unsigned int MAC_PCU_BCN_RSSI_CTL2; /* 0x8020 - 0x8024 */ - volatile unsigned int MAC_PCU_BT_WL_1; /* 0x8024 - 0x8028 */ - volatile unsigned int MAC_PCU_BT_WL_2; /* 0x8028 - 0x802c */ - volatile unsigned int MAC_PCU_BT_WL_3; /* 0x802c - 0x8030 */ - volatile unsigned int MAC_PCU_BT_WL_4; /* 0x8030 - 0x8034 */ - volatile unsigned int MAC_PCU_COEX_EPTA; /* 0x8034 - 0x8038 */ - volatile unsigned int MAC_PCU_MAX_CFP_DUR; /* 0x8038 - 0x803c */ - volatile unsigned int MAC_PCU_RX_FILTER; /* 0x803c - 0x8040 */ - volatile unsigned int MAC_PCU_MCAST_FILTER_L32; /* 0x8040 - 0x8044 */ - volatile unsigned int MAC_PCU_MCAST_FILTER_U32; /* 0x8044 - 0x8048 */ - volatile unsigned int MAC_PCU_DIAG_SW; /* 0x8048 - 0x804c */ - volatile char pad__1[0x8]; /* 0x804c - 0x8054 */ - volatile unsigned int MAC_PCU_TST_ADDAC; /* 0x8054 - 0x8058 */ - volatile unsigned int MAC_PCU_DEF_ANTENNA; /* 0x8058 - 0x805c */ - volatile unsigned int MAC_PCU_AES_MUTE_MASK_0; /* 0x805c - 0x8060 */ - volatile unsigned int MAC_PCU_AES_MUTE_MASK_1; /* 0x8060 - 0x8064 */ - volatile unsigned int MAC_PCU_GATED_CLKS; /* 0x8064 - 0x8068 */ - volatile unsigned int MAC_PCU_OBS_BUS_2; /* 0x8068 - 0x806c */ - volatile unsigned int MAC_PCU_OBS_BUS_1; /* 0x806c - 0x8070 */ - volatile unsigned int MAC_PCU_DYM_MIMO_PWR_SAVE; /* 0x8070 - 0x8074 */ - volatile char pad__2[0xc]; /* 0x8074 - 0x8080 */ - volatile unsigned int MAC_PCU_LAST_BEACON_TSF; /* 0x8080 - 0x8084 */ - volatile unsigned int MAC_PCU_NAV; /* 0x8084 - 0x8088 */ - volatile unsigned int MAC_PCU_RTS_SUCCESS_CNT; /* 0x8088 - 0x808c */ - volatile unsigned int MAC_PCU_RTS_FAIL_CNT; /* 0x808c - 0x8090 */ - volatile unsigned int MAC_PCU_ACK_FAIL_CNT; /* 0x8090 - 0x8094 */ - volatile unsigned int MAC_PCU_FCS_FAIL_CNT; /* 0x8094 - 0x8098 */ - volatile unsigned int MAC_PCU_BEACON_CNT; /* 0x8098 - 0x809c */ - volatile unsigned int MAC_PCU_BEACON2_CNT; /* 0x809c - 0x80a0 */ - volatile unsigned int MAC_PCU_BASIC_SET; /* 0x80a0 - 0x80a4 */ - volatile unsigned int MAC_PCU_MGMT_SEQ; /* 0x80a4 - 0x80a8 */ - volatile unsigned int MAC_PCU_BF_RPT1; /* 0x80a8 - 0x80ac */ - volatile unsigned int MAC_PCU_BF_RPT2; /* 0x80ac - 0x80b0 */ - volatile unsigned int MAC_PCU_TX_ANT_1; /* 0x80b0 - 0x80b4 */ - volatile unsigned int MAC_PCU_TX_ANT_2; /* 0x80b4 - 0x80b8 */ - volatile unsigned int MAC_PCU_TX_ANT_3; /* 0x80b8 - 0x80bc */ - volatile unsigned int MAC_PCU_TX_ANT_4; /* 0x80bc - 0x80c0 */ - volatile unsigned int MAC_PCU_XRMODE; /* 0x80c0 - 0x80c4 */ - volatile unsigned int MAC_PCU_XRDEL; /* 0x80c4 - 0x80c8 */ - volatile unsigned int MAC_PCU_XRTO; /* 0x80c8 - 0x80cc */ - volatile unsigned int MAC_PCU_XRCRP; /* 0x80cc - 0x80d0 */ - volatile unsigned int MAC_PCU_XRSTMP; /* 0x80d0 - 0x80d4 */ - volatile char pad__3[0x8]; /* 0x80d4 - 0x80dc */ - volatile unsigned int MAC_PCU_SELF_GEN_DEFAULT; /* 0x80dc - 0x80e0 */ - volatile unsigned int MAC_PCU_ADDR1_MASK_L32; /* 0x80e0 - 0x80e4 */ - volatile unsigned int MAC_PCU_ADDR1_MASK_U16; /* 0x80e4 - 0x80e8 */ - volatile unsigned int MAC_PCU_TPC; /* 0x80e8 - 0x80ec */ - volatile unsigned int MAC_PCU_TX_FRAME_CNT; /* 0x80ec - 0x80f0 */ - volatile unsigned int MAC_PCU_RX_FRAME_CNT; /* 0x80f0 - 0x80f4 */ - volatile unsigned int MAC_PCU_RX_CLEAR_CNT; /* 0x80f4 - 0x80f8 */ - volatile unsigned int MAC_PCU_CYCLE_CNT; /* 0x80f8 - 0x80fc */ - volatile unsigned int MAC_PCU_QUIET_TIME_1; /* 0x80fc - 0x8100 */ - volatile unsigned int MAC_PCU_QUIET_TIME_2; /* 0x8100 - 0x8104 */ - volatile char pad__4[0x4]; /* 0x8104 - 0x8108 */ - volatile unsigned int MAC_PCU_QOS_NO_ACK; /* 0x8108 - 0x810c */ - volatile unsigned int MAC_PCU_PHY_ERROR_MASK; /* 0x810c - 0x8110 */ - volatile unsigned int MAC_PCU_XRLAT; /* 0x8110 - 0x8114 */ - volatile unsigned int MAC_PCU_RXBUF; /* 0x8114 - 0x8118 */ - volatile unsigned int MAC_PCU_MIC_QOS_CONTROL; /* 0x8118 - 0x811c */ - volatile unsigned int MAC_PCU_MIC_QOS_SELECT; /* 0x811c - 0x8120 */ - volatile unsigned int MAC_PCU_MISC_MODE; /* 0x8120 - 0x8124 */ - volatile unsigned int MAC_PCU_FILTER_OFDM_CNT; /* 0x8124 - 0x8128 */ - volatile unsigned int MAC_PCU_FILTER_CCK_CNT; /* 0x8128 - 0x812c */ - volatile unsigned int MAC_PCU_PHY_ERR_CNT_1; /* 0x812c - 0x8130 */ - volatile unsigned int MAC_PCU_PHY_ERR_CNT_1_MASK; /* 0x8130 - 0x8134 */ - volatile unsigned int MAC_PCU_PHY_ERR_CNT_2; /* 0x8134 - 0x8138 */ - volatile unsigned int MAC_PCU_PHY_ERR_CNT_2_MASK; /* 0x8138 - 0x813c */ - volatile char pad__5[0x8]; /* 0x813c - 0x8144 */ - volatile unsigned int MAC_PCU_PHY_ERROR_EIFS_MASK; /* 0x8144 - 0x8148 */ - volatile char pad__6[0x8]; /* 0x8148 - 0x8150 */ - volatile unsigned int MAC_PCU_COEX_LNAMAXGAIN1; /* 0x8150 - 0x8154 */ - volatile unsigned int MAC_PCU_COEX_LNAMAXGAIN2; /* 0x8154 - 0x8158 */ - volatile unsigned int MAC_PCU_COEX_LNAMAXGAIN3; /* 0x8158 - 0x815c */ - volatile unsigned int MAC_PCU_COEX_LNAMAXGAIN4; /* 0x815c - 0x8160 */ - volatile char pad__7[0x8]; /* 0x8160 - 0x8168 */ - volatile unsigned int MAC_PCU_PHY_ERR_CNT_3; /* 0x8168 - 0x816c */ - volatile unsigned int MAC_PCU_PHY_ERR_CNT_3_MASK; /* 0x816c - 0x8170 */ - volatile unsigned int MAC_PCU_BLUETOOTH_MODE; /* 0x8170 - 0x8174 */ - volatile char pad__8[0x4]; /* 0x8174 - 0x8178 */ - volatile unsigned int MAC_PCU_HCF_TIMEOUT; /* 0x8178 - 0x817c */ - volatile unsigned int MAC_PCU_BLUETOOTH_MODE2; /* 0x817c - 0x8180 */ - volatile char pad__9[0x48]; /* 0x8180 - 0x81c8 */ - volatile unsigned int MAC_PCU_BLUETOOTH_TSF_BT_ACTIVE; /* 0x81c8 - 0x81cc */ - volatile unsigned int MAC_PCU_BLUETOOTH_TSF_BT_PRIORITY; /* 0x81cc - 0x81d0 */ - volatile unsigned int MAC_PCU_TXSIFS; /* 0x81d0 - 0x81d4 */ - volatile unsigned int MAC_PCU_BLUETOOTH_MODE3; /* 0x81d4 - 0x81d8 */ - volatile unsigned int MAC_PCU_BLUETOOTH_MODE4; /* 0x81d8 - 0x81dc */ - volatile unsigned int MAC_PCU_BLUETOOTH_MODE5; /* 0x81dc - 0x81e0 */ - volatile unsigned int MAC_PCU_BLUETOOTH_WEIGHTS; /* 0x81e0 - 0x81e4 */ - volatile unsigned int MAC_PCU_BT_BT_ASYNC; /* 0x81e4 - 0x81e8 */ - volatile char pad__10[0x4]; /* 0x81e8 - 0x81ec */ - volatile unsigned int MAC_PCU_TXOP_X; /* 0x81ec - 0x81f0 */ - volatile unsigned int MAC_PCU_TXOP_0_3; /* 0x81f0 - 0x81f4 */ - volatile unsigned int MAC_PCU_TXOP_4_7; /* 0x81f4 - 0x81f8 */ - volatile unsigned int MAC_PCU_TXOP_8_11; /* 0x81f8 - 0x81fc */ - volatile unsigned int MAC_PCU_TXOP_12_15; /* 0x81fc - 0x8200 */ - volatile unsigned int MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_LSB; /* 0x8200 - 0x8204 */ - volatile unsigned int MAC_PCU_TDMA_TXFRAME_START_TIME_TRIGGER_MSB; /* 0x8204 - 0x8208 */ - volatile unsigned int MAC_PCU_TDMA_SLOT_ALERT_CNTL; /* 0x8208 - 0x820c */ - volatile char pad__11[0x50]; /* 0x820c - 0x825c */ - volatile unsigned int MAC_PCU_WOW1; /* 0x825c - 0x8260 */ - volatile unsigned int MAC_PCU_WOW2; /* 0x8260 - 0x8264 */ - volatile unsigned int MAC_PCU_LOGIC_ANALYZER; /* 0x8264 - 0x8268 */ - volatile unsigned int MAC_PCU_LOGIC_ANALYZER_32L; /* 0x8268 - 0x826c */ - volatile unsigned int MAC_PCU_LOGIC_ANALYZER_16U; /* 0x826c - 0x8270 */ - volatile unsigned int MAC_PCU_WOW3_BEACON_FAIL; /* 0x8270 - 0x8274 */ - volatile unsigned int MAC_PCU_WOW3_BEACON; /* 0x8274 - 0x8278 */ - volatile unsigned int MAC_PCU_WOW3_KEEP_ALIVE; /* 0x8278 - 0x827c */ - volatile unsigned int MAC_PCU_WOW_KA; /* 0x827c - 0x8280 */ - volatile char pad__12[0x4]; /* 0x8280 - 0x8284 */ - volatile unsigned int PCU_1US; /* 0x8284 - 0x8288 */ - volatile unsigned int PCU_KA; /* 0x8288 - 0x828c */ - volatile unsigned int WOW_EXACT; /* 0x828c - 0x8290 */ - volatile char pad__13[0x4]; /* 0x8290 - 0x8294 */ - volatile unsigned int PCU_WOW4; /* 0x8294 - 0x8298 */ - volatile unsigned int PCU_WOW5; /* 0x8298 - 0x829c */ - volatile unsigned int MAC_PCU_PHY_ERR_CNT_MASK_CONT; /* 0x829c - 0x82a0 */ - volatile char pad__14[0x60]; /* 0x82a0 - 0x8300 */ - volatile unsigned int MAC_PCU_AZIMUTH_MODE; /* 0x8300 - 0x8304 */ - volatile char pad__15[0x10]; /* 0x8304 - 0x8314 */ - volatile unsigned int MAC_PCU_AZIMUTH_TIME_STAMP; /* 0x8314 - 0x8318 */ - volatile unsigned int MAC_PCU_20_40_MODE; /* 0x8318 - 0x831c */ - volatile unsigned int MAC_PCU_H_XFER_TIMEOUT; /* 0x831c - 0x8320 */ - volatile char pad__16[0x8]; /* 0x8320 - 0x8328 */ - volatile unsigned int MAC_PCU_RX_CLEAR_DIFF_CNT; /* 0x8328 - 0x832c */ - volatile unsigned int MAC_PCU_SELF_GEN_ANTENNA_MASK; /* 0x832c - 0x8330 */ - volatile unsigned int MAC_PCU_BA_BAR_CONTROL; /* 0x8330 - 0x8334 */ - volatile unsigned int MAC_PCU_LEGACY_PLCP_SPOOF; /* 0x8334 - 0x8338 */ - volatile unsigned int MAC_PCU_PHY_ERROR_MASK_CONT; /* 0x8338 - 0x833c */ - volatile unsigned int MAC_PCU_TX_TIMER; /* 0x833c - 0x8340 */ - volatile unsigned int MAC_PCU_TXBUF_CTRL; /* 0x8340 - 0x8344 */ - volatile unsigned int MAC_PCU_MISC_MODE2; /* 0x8344 - 0x8348 */ - volatile unsigned int MAC_PCU_ALT_AES_MUTE_MASK; /* 0x8348 - 0x834c */ - volatile unsigned int MAC_PCU_WOW6; /* 0x834c - 0x8350 */ - volatile unsigned int ASYNC_FIFO_REG1; /* 0x8350 - 0x8354 */ - volatile unsigned int ASYNC_FIFO_REG2; /* 0x8354 - 0x8358 */ - volatile unsigned int ASYNC_FIFO_REG3; /* 0x8358 - 0x835c */ - volatile unsigned int MAC_PCU_WOW5; /* 0x835c - 0x8360 */ - volatile unsigned int MAC_PCU_WOW_LENGTH1; /* 0x8360 - 0x8364 */ - volatile unsigned int MAC_PCU_WOW_LENGTH2; /* 0x8364 - 0x8368 */ - volatile unsigned int WOW_PATTERN_MATCH_LESS_THAN_256_BYTES; /* 0x8368 - 0x836c */ - volatile char pad__17[0x4]; /* 0x836c - 0x8370 */ - volatile unsigned int MAC_PCU_WOW4; /* 0x8370 - 0x8374 */ - volatile unsigned int WOW2_EXACT; /* 0x8374 - 0x8378 */ - volatile unsigned int PCU_WOW6; /* 0x8378 - 0x837c */ - volatile unsigned int PCU_WOW7; /* 0x837c - 0x8380 */ - volatile unsigned int MAC_PCU_WOW_LENGTH3; /* 0x8380 - 0x8384 */ - volatile unsigned int MAC_PCU_WOW_LENGTH4; /* 0x8384 - 0x8388 */ - volatile unsigned int MAC_PCU_LOCATION_MODE_CONTROL; /* 0x8388 - 0x838c */ - volatile unsigned int MAC_PCU_LOCATION_MODE_TIMER; /* 0x838c - 0x8390 */ - volatile char pad__18[0x8]; /* 0x8390 - 0x8398 */ - volatile unsigned int MAC_PCU_BSSID2_L32; /* 0x8398 - 0x839c */ - volatile unsigned int MAC_PCU_BSSID2_U16; /* 0x839c - 0x83a0 */ - volatile unsigned int MAC_PCU_DIRECT_CONNECT; /* 0x83a0 - 0x83a4 */ - volatile unsigned int MAC_PCU_TID_TO_AC; /* 0x83a4 - 0x83a8 */ - volatile unsigned int MAC_PCU_HP_QUEUE; /* 0x83a8 - 0x83ac */ - volatile char pad__19[0x10]; /* 0x83ac - 0x83bc */ - volatile unsigned int MAC_PCU_AGC_SATURATION_CNT0; /* 0x83bc - 0x83c0 */ - volatile unsigned int MAC_PCU_AGC_SATURATION_CNT1; /* 0x83c0 - 0x83c4 */ - volatile unsigned int MAC_PCU_AGC_SATURATION_CNT2; /* 0x83c4 - 0x83c8 */ - volatile unsigned int MAC_PCU_HW_BCN_PROC1; /* 0x83c8 - 0x83cc */ - volatile unsigned int MAC_PCU_HW_BCN_PROC2; /* 0x83cc - 0x83d0 */ - volatile unsigned int MAC_PCU_MISC_MODE3; /* 0x83d0 - 0x83d4 */ - volatile unsigned int MAC_PCU_MISC_MODE4; /* 0x83d4 - 0x83d8 */ - volatile char pad__20[0x4]; /* 0x83d8 - 0x83dc */ - volatile unsigned int MAC_PCU_PS_FILTER; /* 0x83dc - 0x83e0 */ - volatile unsigned int MAC_PCU_BASIC_RATE_SET0; /* 0x83e0 - 0x83e4 */ - volatile unsigned int MAC_PCU_BASIC_RATE_SET1; /* 0x83e4 - 0x83e8 */ - volatile unsigned int MAC_PCU_BASIC_RATE_SET2; /* 0x83e8 - 0x83ec */ - volatile unsigned int MAC_PCU_BASIC_RATE_SET3; /* 0x83ec - 0x83f0 */ - volatile char pad__21[0x10]; /* 0x83f0 - 0x8400 */ - volatile unsigned int MAC_PCU_TXBUF_BA[64]; /* 0x8400 - 0x8500 */ - volatile unsigned int MAC_PCU_BT_BT[64]; /* 0x8500 - 0x8600 */ - volatile unsigned int MAC_PCU_RX_INT_STATUS0; /* 0x8600 - 0x8604 */ - volatile unsigned int MAC_PCU_RX_INT_STATUS1; /* 0x8604 - 0x8608 */ - volatile unsigned int MAC_PCU_RX_INT_STATUS2; /* 0x8608 - 0x860c */ - volatile unsigned int MAC_PCU_RX_INT_STATUS3; /* 0x860c - 0x8610 */ - volatile unsigned int HT_HALF_GI_RATE1; /* 0x8610 - 0x8614 */ - volatile unsigned int HT_HALF_GI_RATE2; /* 0x8614 - 0x8618 */ - volatile unsigned int HT_FULL_GI_RATE1; /* 0x8618 - 0x861c */ - volatile unsigned int HT_FULL_GI_RATE2; /* 0x861c - 0x8620 */ - volatile unsigned int LEGACY_RATE1; /* 0x8620 - 0x8624 */ - volatile unsigned int LEGACY_RATE2; /* 0x8624 - 0x8628 */ - volatile unsigned int LEGACY_RATE3; /* 0x8628 - 0x862c */ - volatile unsigned int RX_INT_FILTER; /* 0x862c - 0x8630 */ - volatile unsigned int RX_INT_OVERFLOW; /* 0x8630 - 0x8634 */ - volatile unsigned int RX_FILTER_THRESH0; /* 0x8634 - 0x8638 */ - volatile unsigned int RX_FILTER_THRESH1; /* 0x8638 - 0x863c */ - volatile unsigned int RX_PRIORITY_THRESH0; /* 0x863c - 0x8640 */ - volatile unsigned int RX_PRIORITY_THRESH1; /* 0x8640 - 0x8644 */ - volatile unsigned int RX_PRIORITY_THRESH2; /* 0x8644 - 0x8648 */ - volatile unsigned int RX_PRIORITY_THRESH3; /* 0x8648 - 0x864c */ - volatile unsigned int RX_PRIORITY_OFFSET0; /* 0x864c - 0x8650 */ - volatile unsigned int RX_PRIORITY_OFFSET1; /* 0x8650 - 0x8654 */ - volatile unsigned int RX_PRIORITY_OFFSET2; /* 0x8654 - 0x8658 */ - volatile unsigned int RX_PRIORITY_OFFSET3; /* 0x8658 - 0x865c */ - volatile unsigned int RX_PRIORITY_OFFSET4; /* 0x865c - 0x8660 */ - volatile unsigned int RX_PRIORITY_OFFSET5; /* 0x8660 - 0x8664 */ - volatile unsigned int MAC_PCU_LAST_BEACON2_TSF; /* 0x8664 - 0x8668 */ - volatile unsigned int MAC_PCU_PHY_ERROR_AIFS; /* 0x8668 - 0x866c */ - volatile unsigned int MAC_PCU_PHY_ERROR_AIFS_MASK; /* 0x866c - 0x8670 */ - volatile unsigned int MAC_PCU_FILTER_RSSI_AVE; /* 0x8670 - 0x8674 */ - volatile unsigned int MAC_PCU_TBD_FILTER; /* 0x8674 - 0x8678 */ - volatile unsigned int MAC_PCU_BT_ANT_SLEEP_EXTEND; /* 0x8678 - 0x867c */ - volatile char pad__22[0x184]; /* 0x867c - 0x8800 */ - volatile unsigned int MAC_PCU_KEY_CACHE[512]; /* 0x8800 - 0x9000 */ - volatile char pad__23[0x5000]; /* 0x9000 - 0xe000 */ - volatile unsigned int MAC_PCU_BUF[2048]; /* 0xe000 - 0x10000 */ -} wmac_pcu_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _WMAC_PCU_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_qcu_reg.h b/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_qcu_reg.h deleted file mode 100644 index c722dcdfaf3a..000000000000 --- a/drivers/net/wireless/ar6003/include/AR6002/hw6.0/hw/wmac_qcu_reg.h +++ /dev/null @@ -1,251 +0,0 @@ -// ------------------------------------------------------------------ -// Copyright (c) 2004-2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -// ------------------------------------------------------------------ -//=================================================================== -// Author(s): ="Atheros" -//=================================================================== - -/* Copyright (C) 2010 Denali Software Inc. All rights reserved */ -/* THIS FILE IS AUTOMATICALLY GENERATED BY DENALI BLUEPRINT, DO NOT EDIT */ - - -#ifndef _WMAC_QCU_REG_REG_H_ -#define _WMAC_QCU_REG_REG_H_ - - -/* macros for MAC_QCU_TXDP */ -#define MAC_QCU_TXDP_ADDRESS 0x00000800 -#define MAC_QCU_TXDP_OFFSET 0x00000800 -#define MAC_QCU_TXDP_DATA_MSB 31 -#define MAC_QCU_TXDP_DATA_LSB 0 -#define MAC_QCU_TXDP_DATA_MASK 0xffffffff -#define MAC_QCU_TXDP_DATA_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_QCU_TXDP_DATA_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_QCU_STATUS_RING_START */ -#define MAC_QCU_STATUS_RING_START_ADDRESS 0x00000830 -#define MAC_QCU_STATUS_RING_START_OFFSET 0x00000830 -#define MAC_QCU_STATUS_RING_START_ADDR_MSB 31 -#define MAC_QCU_STATUS_RING_START_ADDR_LSB 0 -#define MAC_QCU_STATUS_RING_START_ADDR_MASK 0xffffffff -#define MAC_QCU_STATUS_RING_START_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_QCU_STATUS_RING_START_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_QCU_STATUS_RING_END */ -#define MAC_QCU_STATUS_RING_END_ADDRESS 0x00000834 -#define MAC_QCU_STATUS_RING_END_OFFSET 0x00000834 -#define MAC_QCU_STATUS_RING_END_ADDR_MSB 31 -#define MAC_QCU_STATUS_RING_END_ADDR_LSB 0 -#define MAC_QCU_STATUS_RING_END_ADDR_MASK 0xffffffff -#define MAC_QCU_STATUS_RING_END_ADDR_GET(x) (((x) & 0xffffffff) >> 0) -#define MAC_QCU_STATUS_RING_END_ADDR_SET(x) (((x) << 0) & 0xffffffff) - -/* macros for MAC_QCU_STATUS_RING_CURRENT */ -#define MAC_QCU_STATUS_RING_CURRENT_ADDRESS 0x00000838 -#define MAC_QCU_STATUS_RING_CURRENT_OFFSET 0x00000838 -#define MAC_QCU_STATUS_RING_CURRENT_ADDRESS_MSB 31 -#define MAC_QCU_STATUS_RING_CURRENT_ADDRESS_LSB 0 -#define MAC_QCU_STATUS_RING_CURRENT_ADDRESS_MASK 0xffffffff -#define MAC_QCU_STATUS_RING_CURRENT_ADDRESS_GET(x) (((x) & 0xffffffff) >> 0) - -/* macros for MAC_QCU_TXE */ -#define MAC_QCU_TXE_ADDRESS 0x00000840 -#define MAC_QCU_TXE_OFFSET 0x00000840 -#define MAC_QCU_TXE_DATA_MSB 9 -#define MAC_QCU_TXE_DATA_LSB 0 -#define MAC_QCU_TXE_DATA_MASK 0x000003ff -#define MAC_QCU_TXE_DATA_GET(x) (((x) & 0x000003ff) >> 0) - -/* macros for MAC_QCU_TXD */ -#define MAC_QCU_TXD_ADDRESS 0x00000880 -#define MAC_QCU_TXD_OFFSET 0x00000880 -#define MAC_QCU_TXD_DATA_MSB 9 -#define MAC_QCU_TXD_DATA_LSB 0 -#define MAC_QCU_TXD_DATA_MASK 0x000003ff -#define MAC_QCU_TXD_DATA_GET(x) (((x) & 0x000003ff) >> 0) -#define MAC_QCU_TXD_DATA_SET(x) (((x) << 0) & 0x000003ff) - -/* macros for MAC_QCU_CBR */ -#define MAC_QCU_CBR_ADDRESS 0x000008c0 -#define MAC_QCU_CBR_OFFSET 0x000008c0 -#define MAC_QCU_CBR_INTERVAL_MSB 23 -#define MAC_QCU_CBR_INTERVAL_LSB 0 -#define MAC_QCU_CBR_INTERVAL_MASK 0x00ffffff -#define MAC_QCU_CBR_INTERVAL_GET(x) (((x) & 0x00ffffff) >> 0) -#define MAC_QCU_CBR_INTERVAL_SET(x) (((x) << 0) & 0x00ffffff) -#define MAC_QCU_CBR_OVF_THRESH_MSB 31 -#define MAC_QCU_CBR_OVF_THRESH_LSB 24 -#define MAC_QCU_CBR_OVF_THRESH_MASK 0xff000000 -#define MAC_QCU_CBR_OVF_THRESH_GET(x) (((x) & 0xff000000) >> 24) -#define MAC_QCU_CBR_OVF_THRESH_SET(x) (((x) << 24) & 0xff000000) - -/* macros for MAC_QCU_RDYTIME */ -#define MAC_QCU_RDYTIME_ADDRESS 0x00000900 -#define MAC_QCU_RDYTIME_OFFSET 0x00000900 -#define MAC_QCU_RDYTIME_DURATION_MSB 23 -#define MAC_QCU_RDYTIME_DURATION_LSB 0 -#define MAC_QCU_RDYTIME_DURATION_MASK 0x00ffffff -#define MAC_QCU_RDYTIME_DURATION_GET(x) (((x) & 0x00ffffff) >> 0) -#define MAC_QCU_RDYTIME_DURATION_SET(x) (((x) << 0) & 0x00ffffff) -#define MAC_QCU_RDYTIME_EN_MSB 24 -#define MAC_QCU_RDYTIME_EN_LSB 24 -#define MAC_QCU_RDYTIME_EN_MASK 0x01000000 -#define MAC_QCU_RDYTIME_EN_GET(x) (((x) & 0x01000000) >> 24) -#define MAC_QCU_RDYTIME_EN_SET(x) (((x) << 24) & 0x01000000) - -/* macros for MAC_QCU_ONESHOT_ARM_SC */ -#define MAC_QCU_ONESHOT_ARM_SC_ADDRESS 0x00000940 -#define MAC_QCU_ONESHOT_ARM_SC_OFFSET 0x00000940 -#define MAC_QCU_ONESHOT_ARM_SC_SET_MSB 9 -#define MAC_QCU_ONESHOT_ARM_SC_SET_LSB 0 -#define MAC_QCU_ONESHOT_ARM_SC_SET_MASK 0x000003ff -#define MAC_QCU_ONESHOT_ARM_SC_SET_GET(x) (((x) & 0x000003ff) >> 0) -#define MAC_QCU_ONESHOT_ARM_SC_SET_SET(x) (((x) << 0) & 0x000003ff) - -/* macros for MAC_QCU_ONESHOT_ARM_CC */ -#define MAC_QCU_ONESHOT_ARM_CC_ADDRESS 0x00000980 -#define MAC_QCU_ONESHOT_ARM_CC_OFFSET 0x00000980 -#define MAC_QCU_ONESHOT_ARM_CC_CLEAR_MSB 9 -#define MAC_QCU_ONESHOT_ARM_CC_CLEAR_LSB 0 -#define MAC_QCU_ONESHOT_ARM_CC_CLEAR_MASK 0x000003ff -#define MAC_QCU_ONESHOT_ARM_CC_CLEAR_GET(x) (((x) & 0x000003ff) >> 0) -#define MAC_QCU_ONESHOT_ARM_CC_CLEAR_SET(x) (((x) << 0) & 0x000003ff) - -/* macros for MAC_QCU_MISC */ -#define MAC_QCU_MISC_ADDRESS 0x000009c0 -#define MAC_QCU_MISC_OFFSET 0x000009c0 -#define MAC_QCU_MISC_FSP_MSB 3 -#define MAC_QCU_MISC_FSP_LSB 0 -#define MAC_QCU_MISC_FSP_MASK 0x0000000f -#define MAC_QCU_MISC_FSP_GET(x) (((x) & 0x0000000f) >> 0) -#define MAC_QCU_MISC_FSP_SET(x) (((x) << 0) & 0x0000000f) -#define MAC_QCU_MISC_ONESHOT_EN_MSB 4 -#define MAC_QCU_MISC_ONESHOT_EN_LSB 4 -#define MAC_QCU_MISC_ONESHOT_EN_MASK 0x00000010 -#define MAC_QCU_MISC_ONESHOT_EN_GET(x) (((x) & 0x00000010) >> 4) -#define MAC_QCU_MISC_ONESHOT_EN_SET(x) (((x) << 4) & 0x00000010) -#define MAC_QCU_MISC_CBR_EXP_INC_DIS_NOFR_MSB 5 -#define MAC_QCU_MISC_CBR_EXP_INC_DIS_NOFR_LSB 5 -#define MAC_QCU_MISC_CBR_EXP_INC_DIS_NOFR_MASK 0x00000020 -#define MAC_QCU_MISC_CBR_EXP_INC_DIS_NOFR_GET(x) (((x) & 0x00000020) >> 5) -#define MAC_QCU_MISC_CBR_EXP_INC_DIS_NOFR_SET(x) (((x) << 5) & 0x00000020) -#define MAC_QCU_MISC_CBR_EXP_INC_DIS_NOBCNFR_MSB 6 -#define MAC_QCU_MISC_CBR_EXP_INC_DIS_NOBCNFR_LSB 6 -#define MAC_QCU_MISC_CBR_EXP_INC_DIS_NOBCNFR_MASK 0x00000040 -#define MAC_QCU_MISC_CBR_EXP_INC_DIS_NOBCNFR_GET(x) (((x) & 0x00000040) >> 6) -#define MAC_QCU_MISC_CBR_EXP_INC_DIS_NOBCNFR_SET(x) (((x) << 6) & 0x00000040) -#define MAC_QCU_MISC_IS_BCN_MSB 7 -#define MAC_QCU_MISC_IS_BCN_LSB 7 -#define MAC_QCU_MISC_IS_BCN_MASK 0x00000080 -#define MAC_QCU_MISC_IS_BCN_GET(x) (((x) & 0x00000080) >> 7) -#define MAC_QCU_MISC_IS_BCN_SET(x) (((x) << 7) & 0x00000080) -#define MAC_QCU_MISC_CBR_EXP_INC_LIMIT_MSB 8 -#define MAC_QCU_MISC_CBR_EXP_INC_LIMIT_LSB 8 -#define MAC_QCU_MISC_CBR_EXP_INC_LIMIT_MASK 0x00000100 -#define MAC_QCU_MISC_CBR_EXP_INC_LIMIT_GET(x) (((x) & 0x00000100) >> 8) -#define MAC_QCU_MISC_CBR_EXP_INC_LIMIT_SET(x) (((x) << 8) & 0x00000100) -#define MAC_QCU_MISC_TXE_CLR_ON_CBR_END_MSB 9 -#define MAC_QCU_MISC_TXE_CLR_ON_CBR_END_LSB 9 -#define MAC_QCU_MISC_TXE_CLR_ON_CBR_END_MASK 0x00000200 -#define MAC_QCU_MISC_TXE_CLR_ON_CBR_END_GET(x) (((x) & 0x00000200) >> 9) -#define MAC_QCU_MISC_TXE_CLR_ON_CBR_END_SET(x) (((x) << 9) & 0x00000200) -#define MAC_QCU_MISC_MMR_CBR_EXP_CNT_CLR_EN_MSB 10 -#define MAC_QCU_MISC_MMR_CBR_EXP_CNT_CLR_EN_LSB 10 -#define MAC_QCU_MISC_MMR_CBR_EXP_CNT_CLR_EN_MASK 0x00000400 -#define MAC_QCU_MISC_MMR_CBR_EXP_CNT_CLR_EN_GET(x) (((x) & 0x00000400) >> 10) -#define MAC_QCU_MISC_MMR_CBR_EXP_CNT_CLR_EN_SET(x) (((x) << 10) & 0x00000400) -#define MAC_QCU_MISC_FR_ABORT_REQ_EN_MSB 11 -#define MAC_QCU_MISC_FR_ABORT_REQ_EN_LSB 11 -#define MAC_QCU_MISC_FR_ABORT_REQ_EN_MASK 0x00000800 -#define MAC_QCU_MISC_FR_ABORT_REQ_EN_GET(x) (((x) & 0x00000800) >> 11) -#define MAC_QCU_MISC_FR_ABORT_REQ_EN_SET(x) (((x) << 11) & 0x00000800) - -/* macros for MAC_QCU_CNT */ -#define MAC_QCU_CNT_ADDRESS 0x00000a00 -#define MAC_QCU_CNT_OFFSET 0x00000a00 -#define MAC_QCU_CNT_FR_PEND_MSB 1 -#define MAC_QCU_CNT_FR_PEND_LSB 0 -#define MAC_QCU_CNT_FR_PEND_MASK 0x00000003 -#define MAC_QCU_CNT_FR_PEND_GET(x) (((x) & 0x00000003) >> 0) -#define MAC_QCU_CNT_CBR_EXP_MSB 15 -#define MAC_QCU_CNT_CBR_EXP_LSB 8 -#define MAC_QCU_CNT_CBR_EXP_MASK 0x0000ff00 -#define MAC_QCU_CNT_CBR_EXP_GET(x) (((x) & 0x0000ff00) >> 8) - -/* macros for MAC_QCU_RDYTIME_SHDN */ -#define MAC_QCU_RDYTIME_SHDN_ADDRESS 0x00000a40 -#define MAC_QCU_RDYTIME_SHDN_OFFSET 0x00000a40 -#define MAC_QCU_RDYTIME_SHDN_SHUTDOWN_MSB 9 -#define MAC_QCU_RDYTIME_SHDN_SHUTDOWN_LSB 0 -#define MAC_QCU_RDYTIME_SHDN_SHUTDOWN_MASK 0x000003ff -#define MAC_QCU_RDYTIME_SHDN_SHUTDOWN_GET(x) (((x) & 0x000003ff) >> 0) -#define MAC_QCU_RDYTIME_SHDN_SHUTDOWN_SET(x) (((x) << 0) & 0x000003ff) - -/* macros for MAC_QCU_DESC_CRC_CHK */ -#define MAC_QCU_DESC_CRC_CHK_ADDRESS 0x00000a44 -#define MAC_QCU_DESC_CRC_CHK_OFFSET 0x00000a44 -#define MAC_QCU_DESC_CRC_CHK_EN_MSB 0 -#define MAC_QCU_DESC_CRC_CHK_EN_LSB 0 -#define MAC_QCU_DESC_CRC_CHK_EN_MASK 0x00000001 -#define MAC_QCU_DESC_CRC_CHK_EN_GET(x) (((x) & 0x00000001) >> 0) -#define MAC_QCU_DESC_CRC_CHK_EN_SET(x) (((x) << 0) & 0x00000001) - -/* macros for MAC_QCU_EOL */ -#define MAC_QCU_EOL_ADDRESS 0x00000a48 -#define MAC_QCU_EOL_OFFSET 0x00000a48 -#define MAC_QCU_EOL_DUR_CAL_EN_MSB 9 -#define MAC_QCU_EOL_DUR_CAL_EN_LSB 0 -#define MAC_QCU_EOL_DUR_CAL_EN_MASK 0x000003ff -#define MAC_QCU_EOL_DUR_CAL_EN_GET(x) (((x) & 0x000003ff) >> 0) -#define MAC_QCU_EOL_DUR_CAL_EN_SET(x) (((x) << 0) & 0x000003ff) - - -#ifndef __ASSEMBLER__ - -typedef struct wmac_qcu_reg_reg_s { - volatile char pad__0[0x800]; /* 0x0 - 0x800 */ - volatile unsigned int MAC_QCU_TXDP[10]; /* 0x800 - 0x828 */ - volatile char pad__1[0x8]; /* 0x828 - 0x830 */ - volatile unsigned int MAC_QCU_STATUS_RING_START; /* 0x830 - 0x834 */ - volatile unsigned int MAC_QCU_STATUS_RING_END; /* 0x834 - 0x838 */ - volatile unsigned int MAC_QCU_STATUS_RING_CURRENT; /* 0x838 - 0x83c */ - volatile char pad__2[0x4]; /* 0x83c - 0x840 */ - volatile unsigned int MAC_QCU_TXE; /* 0x840 - 0x844 */ - volatile char pad__3[0x3c]; /* 0x844 - 0x880 */ - volatile unsigned int MAC_QCU_TXD; /* 0x880 - 0x884 */ - volatile char pad__4[0x3c]; /* 0x884 - 0x8c0 */ - volatile unsigned int MAC_QCU_CBR[10]; /* 0x8c0 - 0x8e8 */ - volatile char pad__5[0x18]; /* 0x8e8 - 0x900 */ - volatile unsigned int MAC_QCU_RDYTIME[10]; /* 0x900 - 0x928 */ - volatile char pad__6[0x18]; /* 0x928 - 0x940 */ - volatile unsigned int MAC_QCU_ONESHOT_ARM_SC; /* 0x940 - 0x944 */ - volatile char pad__7[0x3c]; /* 0x944 - 0x980 */ - volatile unsigned int MAC_QCU_ONESHOT_ARM_CC; /* 0x980 - 0x984 */ - volatile char pad__8[0x3c]; /* 0x984 - 0x9c0 */ - volatile unsigned int MAC_QCU_MISC[10]; /* 0x9c0 - 0x9e8 */ - volatile char pad__9[0x18]; /* 0x9e8 - 0xa00 */ - volatile unsigned int MAC_QCU_CNT[10]; /* 0xa00 - 0xa28 */ - volatile char pad__10[0x18]; /* 0xa28 - 0xa40 */ - volatile unsigned int MAC_QCU_RDYTIME_SHDN; /* 0xa40 - 0xa44 */ - volatile unsigned int MAC_QCU_DESC_CRC_CHK; /* 0xa44 - 0xa48 */ - volatile unsigned int MAC_QCU_EOL; /* 0xa48 - 0xa4c */ -} wmac_qcu_reg_reg_t; - -#endif /* __ASSEMBLER__ */ - -#endif /* _WMAC_QCU_REG_REG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/a_hci.h b/drivers/net/wireless/ar6003/include/a_hci.h deleted file mode 100644 index d38c3f917be1..000000000000 --- a/drivers/net/wireless/ar6003/include/a_hci.h +++ /dev/null @@ -1,668 +0,0 @@ -//- -// Copyright (c) 2009-2010 Atheros Communications Inc. -// All rights reserved. -// $ATH_LICENSE_TARGET_C$ -// -// - - -#ifndef __A_HCI_H__ -#define __A_HCI_H__ - -#define HCI_CMD_OGF_MASK 0x3F -#define HCI_CMD_OGF_SHIFT 10 -#define HCI_CMD_GET_OGF(opcode) ((opcode >> HCI_CMD_OGF_SHIFT) & HCI_CMD_OGF_MASK) - -#define HCI_CMD_OCF_MASK 0x3FF -#define HCI_CMD_OCF_SHIFT 0 -#define HCI_CMD_GET_OCF(opcode) (((opcode) >> HCI_CMD_OCF_SHIFT) & HCI_CMD_OCF_MASK) - -#define HCI_FORM_OPCODE(ocf, ogf) ((ocf & HCI_CMD_OCF_MASK) << HCI_CMD_OCF_SHIFT | \ - (ogf & HCI_CMD_OGF_MASK) << HCI_CMD_OGF_SHIFT) - - -/*======== HCI Opcode groups ===============*/ -#define OGF_NOP 0x00 -#define OGF_LINK_CONTROL 0x01 -#define OGF_LINK_POLICY 0x03 -#define OGF_INFO_PARAMS 0x04 -#define OGF_STATUS 0x05 -#define OGF_TESTING 0x06 -#define OGF_BLUETOOTH 0x3E -#define OGF_VENDOR_DEBUG 0x3F - - - -#define OCF_NOP 0x00 - - -/*===== Link Control Commands Opcode===================*/ -#define OCF_HCI_Create_Physical_Link 0x35 -#define OCF_HCI_Accept_Physical_Link_Req 0x36 -#define OCF_HCI_Disconnect_Physical_Link 0x37 -#define OCF_HCI_Create_Logical_Link 0x38 -#define OCF_HCI_Accept_Logical_Link 0x39 -#define OCF_HCI_Disconnect_Logical_Link 0x3A -#define OCF_HCI_Logical_Link_Cancel 0x3B -#define OCF_HCI_Flow_Spec_Modify 0x3C - - - -/*===== Link Policy Commands Opcode====================*/ -#define OCF_HCI_Set_Event_Mask 0x01 -#define OCF_HCI_Reset 0x03 -#define OCF_HCI_Read_Conn_Accept_Timeout 0x15 -#define OCF_HCI_Write_Conn_Accept_Timeout 0x16 -#define OCF_HCI_Read_Link_Supervision_Timeout 0x36 -#define OCF_HCI_Write_Link_Supervision_Timeout 0x37 -#define OCF_HCI_Enhanced_Flush 0x5F -#define OCF_HCI_Read_Logical_Link_Accept_Timeout 0x61 -#define OCF_HCI_Write_Logical_Link_Accept_Timeout 0x62 -#define OCF_HCI_Set_Event_Mask_Page_2 0x63 -#define OCF_HCI_Read_Location_Data 0x64 -#define OCF_HCI_Write_Location_Data 0x65 -#define OCF_HCI_Read_Flow_Control_Mode 0x66 -#define OCF_HCI_Write_Flow_Control_Mode 0x67 -#define OCF_HCI_Read_BE_Flush_Timeout 0x69 -#define OCF_HCI_Write_BE_Flush_Timeout 0x6A -#define OCF_HCI_Short_Range_Mode 0x6B - - -/*======== Info Commands Opcode========================*/ -#define OCF_HCI_Read_Local_Ver_Info 0x01 -#define OCF_HCI_Read_Local_Supported_Cmds 0x02 -#define OCF_HCI_Read_Data_Block_Size 0x0A -/*======== Status Commands Opcode======================*/ -#define OCF_HCI_Read_Failed_Contact_Counter 0x01 -#define OCF_HCI_Reset_Failed_Contact_Counter 0x02 -#define OCF_HCI_Read_Link_Quality 0x03 -#define OCF_HCI_Read_RSSI 0x05 -#define OCF_HCI_Read_Local_AMP_Info 0x09 -#define OCF_HCI_Read_Local_AMP_ASSOC 0x0A -#define OCF_HCI_Write_Remote_AMP_ASSOC 0x0B - - -/*======= AMP_ASSOC Specific TLV tags =================*/ -#define AMP_ASSOC_MAC_ADDRESS_INFO_TYPE 0x1 -#define AMP_ASSOC_PREF_CHAN_LIST 0x2 -#define AMP_ASSOC_CONNECTED_CHAN 0x3 -#define AMP_ASSOC_PAL_CAPABILITIES 0x4 -#define AMP_ASSOC_PAL_VERSION 0x5 - - -/*========= PAL Events =================================*/ -#define PAL_COMMAND_COMPLETE_EVENT 0x0E -#define PAL_COMMAND_STATUS_EVENT 0x0F -#define PAL_HARDWARE_ERROR_EVENT 0x10 -#define PAL_FLUSH_OCCURRED_EVENT 0x11 -#define PAL_LOOPBACK_EVENT 0x19 -#define PAL_BUFFER_OVERFLOW_EVENT 0x1A -#define PAL_QOS_VIOLATION_EVENT 0x1E -#define PAL_ENHANCED_FLUSH_COMPLT_EVENT 0x39 -#define PAL_PHYSICAL_LINK_COMPL_EVENT 0x40 -#define PAL_CHANNEL_SELECT_EVENT 0x41 -#define PAL_DISCONNECT_PHYSICAL_LINK_EVENT 0x42 -#define PAL_PHY_LINK_EARLY_LOSS_WARNING_EVENT 0x43 -#define PAL_PHY_LINK_RECOVERY_EVENT 0x44 -#define PAL_LOGICAL_LINK_COMPL_EVENT 0x45 -#define PAL_DISCONNECT_LOGICAL_LINK_COMPL_EVENT 0x46 -#define PAL_FLOW_SPEC_MODIFY_COMPL_EVENT 0x47 -#define PAL_NUM_COMPL_DATA_BLOCK_EVENT 0x48 -#define PAL_SHORT_RANGE_MODE_CHANGE_COMPL_EVENT 0x4C -#define PAL_AMP_STATUS_CHANGE_EVENT 0x4D -/*======== End of PAL events definiton =================*/ - - -/*======== Timeouts (not part of HCI cmd, but input to PAL engine) =========*/ -#define Timer_Conn_Accept_TO 0x01 -#define Timer_Link_Supervision_TO 0x02 - -#define NUM_HCI_COMMAND_PKTS 0x1 - - -/*====== NOP Cmd ============================*/ -#define HCI_CMD_NOP HCI_FORM_OPCODE(OCF_NOP, OGF_NOP) - - -/*===== Link Control Commands================*/ -#define HCI_Create_Physical_Link HCI_FORM_OPCODE(OCF_HCI_Create_Physical_Link, OGF_LINK_CONTROL) -#define HCI_Accept_Physical_Link_Req HCI_FORM_OPCODE(OCF_HCI_Accept_Physical_Link_Req, OGF_LINK_CONTROL) -#define HCI_Disconnect_Physical_Link HCI_FORM_OPCODE(OCF_HCI_Disconnect_Physical_Link, OGF_LINK_CONTROL) -#define HCI_Create_Logical_Link HCI_FORM_OPCODE(OCF_HCI_Create_Logical_Link, OGF_LINK_CONTROL) -#define HCI_Accept_Logical_Link HCI_FORM_OPCODE(OCF_HCI_Accept_Logical_Link, OGF_LINK_CONTROL) -#define HCI_Disconnect_Logical_Link HCI_FORM_OPCODE(OCF_HCI_Disconnect_Logical_Link, OGF_LINK_CONTROL) -#define HCI_Logical_Link_Cancel HCI_FORM_OPCODE(OCF_HCI_Logical_Link_Cancel, OGF_LINK_CONTROL) -#define HCI_Flow_Spec_Modify HCI_FORM_OPCODE(OCF_HCI_Flow_Spec_Modify, OGF_LINK_CONTROL) - - -/*===== Link Policy Commands ================*/ -#define HCI_Set_Event_Mask HCI_FORM_OPCODE(OCF_HCI_Set_Event_Mask, OGF_LINK_POLICY) -#define HCI_Reset HCI_FORM_OPCODE(OCF_HCI_Reset, OGF_LINK_POLICY) -#define HCI_Enhanced_Flush HCI_FORM_OPCODE(OCF_HCI_Enhanced_Flush, OGF_LINK_POLICY) -#define HCI_Read_Conn_Accept_Timeout HCI_FORM_OPCODE(OCF_HCI_Read_Conn_Accept_Timeout, OGF_LINK_POLICY) -#define HCI_Write_Conn_Accept_Timeout HCI_FORM_OPCODE(OCF_HCI_Write_Conn_Accept_Timeout, OGF_LINK_POLICY) -#define HCI_Read_Logical_Link_Accept_Timeout HCI_FORM_OPCODE(OCF_HCI_Read_Logical_Link_Accept_Timeout, OGF_LINK_POLICY) -#define HCI_Write_Logical_Link_Accept_Timeout HCI_FORM_OPCODE(OCF_HCI_Write_Logical_Link_Accept_Timeout, OGF_LINK_POLICY) -#define HCI_Read_Link_Supervision_Timeout HCI_FORM_OPCODE(OCF_HCI_Read_Link_Supervision_Timeout, OGF_LINK_POLICY) -#define HCI_Write_Link_Supervision_Timeout HCI_FORM_OPCODE(OCF_HCI_Write_Link_Supervision_Timeout, OGF_LINK_POLICY) -#define HCI_Read_Location_Data HCI_FORM_OPCODE(OCF_HCI_Read_Location_Data, OGF_LINK_POLICY) -#define HCI_Write_Location_Data HCI_FORM_OPCODE(OCF_HCI_Write_Location_Data, OGF_LINK_POLICY) -#define HCI_Set_Event_Mask_Page_2 HCI_FORM_OPCODE(OCF_HCI_Set_Event_Mask_Page_2, OGF_LINK_POLICY) -#define HCI_Read_Flow_Control_Mode HCI_FORM_OPCODE(OCF_HCI_Read_Flow_Control_Mode, OGF_LINK_POLICY) -#define HCI_Write_Flow_Control_Mode HCI_FORM_OPCODE(OCF_HCI_Write_Flow_Control_Mode, OGF_LINK_POLICY) -#define HCI_Write_BE_Flush_Timeout HCI_FORM_OPCODE(OCF_HCI_Write_BE_Flush_Timeout, OGF_LINK_POLICY) -#define HCI_Read_BE_Flush_Timeout HCI_FORM_OPCODE(OCF_HCI_Read_BE_Flush_Timeout, OGF_LINK_POLICY) -#define HCI_Short_Range_Mode HCI_FORM_OPCODE(OCF_HCI_Short_Range_Mode, OGF_LINK_POLICY) - - -/*===== Info Commands =====================*/ -#define HCI_Read_Local_Ver_Info HCI_FORM_OPCODE(OCF_HCI_Read_Local_Ver_Info, OGF_INFO_PARAMS) -#define HCI_Read_Local_Supported_Cmds HCI_FORM_OPCODE(OCF_HCI_Read_Local_Supported_Cmds, OGF_INFO_PARAMS) -#define HCI_Read_Data_Block_Size HCI_FORM_OPCODE(OCF_HCI_Read_Data_Block_Size, OGF_INFO_PARAMS) - -/*===== Status Commands =====================*/ -#define HCI_Read_Link_Quality HCI_FORM_OPCODE(OCF_HCI_Read_Link_Quality, OGF_STATUS) -#define HCI_Read_RSSI HCI_FORM_OPCODE(OCF_HCI_Read_RSSI, OGF_STATUS) -#define HCI_Read_Local_AMP_Info HCI_FORM_OPCODE(OCF_HCI_Read_Local_AMP_Info, OGF_STATUS) -#define HCI_Read_Local_AMP_ASSOC HCI_FORM_OPCODE(OCF_HCI_Read_Local_AMP_ASSOC, OGF_STATUS) -#define HCI_Write_Remote_AMP_ASSOC HCI_FORM_OPCODE(OCF_HCI_Write_Remote_AMP_ASSOC, OGF_STATUS) - -/*====== End of cmd definitions =============*/ - - - -/*===== Timeouts(private - can't come from HCI)=================*/ -#define Conn_Accept_TO HCI_FORM_OPCODE(Timer_Conn_Accept_TO, OGF_VENDOR_DEBUG) -#define Link_Supervision_TO HCI_FORM_OPCODE(Timer_Link_Supervision_TO, OGF_VENDOR_DEBUG) - -/*----- PAL Constants (Sec 6 of Doc)------------------------*/ -#define Max80211_PAL_PDU_Size 1492 -#define Max80211_AMP_ASSOC_Len 672 -#define MinGUserPrio 4 -#define MaxGUserPrio 7 -#define BEUserPrio0 0 -#define BEUserPrio1 3 -#define Max80211BeaconPeriod 2000 /* in millisec */ -#define ShortRangeModePowerMax 4 /* dBm */ - -/*------ PAL Protocol Identifiers (Sec5.1) ------------------*/ -typedef enum { - ACL_DATA = 0x01, - ACTIVITY_REPORT, - SECURED_FRAMES, - LINK_SUPERVISION_REQ, - LINK_SUPERVISION_RESP, -}PAL_PROTOCOL_IDENTIFIERS; - -#define HCI_CMD_HDR_SZ 3 -#define HCI_EVENT_HDR_SIZE 2 -#define MAX_EVT_PKT_SZ 255 -#define AMP_ASSOC_MAX_FRAG_SZ 248 -#define AMP_MAX_GUARANTEED_BW 20000 - -#define DEFAULT_CONN_ACCPT_TO 5000 -#define DEFAULT_LL_ACCPT_TO 5000 -#define DEFAULT_LSTO 10000 - -#define PACKET_BASED_FLOW_CONTROL_MODE 0x00 -#define DATA_BLK_BASED_FLOW_CONTROL_MODE 0x01 - -#define SERVICE_TYPE_BEST_EFFORT 0x01 -#define SERVICE_TYPE_GUARANTEED 0x02 - -#define MAC_ADDR_LEN 6 -#define LINK_KEY_LEN 32 - -typedef enum { - ACL_DATA_PB_1ST_NON_AUTOMATICALLY_FLUSHABLE = 0x00, - ACL_DATA_PB_CONTINUING_FRAGMENT = 0x01, - ACL_DATA_PB_1ST_AUTOMATICALLY_FLUSHABLE = 0x02, - ACL_DATA_PB_COMPLETE_PDU = 0x03, -} ACL_DATA_PB_FLAGS; -#define ACL_DATA_PB_FLAGS_SHIFT 12 - -typedef enum { - ACL_DATA_BC_POINT_TO_POINT = 0x00, -} ACL_DATA_BC_FLAGS; -#define ACL_DATA_BC_FLAGS_SHIFT 14 - -/* Command pkt */ -typedef struct hci_cmd_pkt_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT8 params[255]; -} POSTPACK HCI_CMD_PKT; - -#define ACL_DATA_HDR_SIZE 4 /* hdl_and flags + data_len */ -/* Data pkt */ -typedef struct hci_acl_data_pkt_t { - A_UINT16 hdl_and_flags; - A_UINT16 data_len; - A_UINT8 data[Max80211_PAL_PDU_Size]; -} POSTPACK HCI_ACL_DATA_PKT; - -/* Event pkt */ -typedef struct hci_event_pkt_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 params[256]; -} POSTPACK HCI_EVENT_PKT; - - -/*============== HCI Command definitions ======================= */ -typedef struct hci_cmd_phy_link_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT8 phy_link_hdl; - A_UINT8 link_key_len; - A_UINT8 link_key_type; - A_UINT8 link_key[LINK_KEY_LEN]; -} POSTPACK HCI_CMD_PHY_LINK; - -typedef struct hci_cmd_write_rem_amp_assoc_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT8 phy_link_hdl; - A_UINT16 len_so_far; - A_UINT16 amp_assoc_remaining_len; - A_UINT8 amp_assoc_frag[AMP_ASSOC_MAX_FRAG_SZ]; -} POSTPACK HCI_CMD_WRITE_REM_AMP_ASSOC; - - -typedef struct hci_cmd_opcode_hdl_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT16 hdl; -} POSTPACK HCI_CMD_READ_LINK_QUAL, - HCI_CMD_FLUSH, - HCI_CMD_READ_LINK_SUPERVISION_TIMEOUT; - -typedef struct hci_cmd_read_local_amp_assoc_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT8 phy_link_hdl; - A_UINT16 len_so_far; - A_UINT16 max_rem_amp_assoc_len; -} POSTPACK HCI_CMD_READ_LOCAL_AMP_ASSOC; - - -typedef struct hci_cmd_set_event_mask_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT64 mask; -}POSTPACK HCI_CMD_SET_EVT_MASK, HCI_CMD_SET_EVT_MASK_PG_2; - - -typedef struct hci_cmd_enhanced_flush_t{ - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT16 hdl; - A_UINT8 type; -} POSTPACK HCI_CMD_ENHANCED_FLUSH; - - -typedef struct hci_cmd_write_timeout_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT16 timeout; -} POSTPACK HCI_CMD_WRITE_TIMEOUT; - -typedef struct hci_cmd_write_link_supervision_timeout_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT16 hdl; - A_UINT16 timeout; -} POSTPACK HCI_CMD_WRITE_LINK_SUPERVISION_TIMEOUT; - -typedef struct hci_cmd_write_flow_control_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT8 mode; -} POSTPACK HCI_CMD_WRITE_FLOW_CONTROL; - -typedef struct location_data_cfg_t { - A_UINT8 reg_domain_aware; - A_UINT8 reg_domain[3]; - A_UINT8 reg_options; -} POSTPACK LOCATION_DATA_CFG; - -typedef struct hci_cmd_write_location_data_t { - A_UINT16 opcode; - A_UINT8 param_length; - LOCATION_DATA_CFG cfg; -} POSTPACK HCI_CMD_WRITE_LOCATION_DATA; - - -typedef struct flow_spec_t { - A_UINT8 id; - A_UINT8 service_type; - A_UINT16 max_sdu; - A_UINT32 sdu_inter_arrival_time; - A_UINT32 access_latency; - A_UINT32 flush_timeout; -} POSTPACK FLOW_SPEC; - - -typedef struct hci_cmd_create_logical_link_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT8 phy_link_hdl; - FLOW_SPEC tx_flow_spec; - FLOW_SPEC rx_flow_spec; -} POSTPACK HCI_CMD_CREATE_LOGICAL_LINK; - -typedef struct hci_cmd_flow_spec_modify_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT16 hdl; - FLOW_SPEC tx_flow_spec; - FLOW_SPEC rx_flow_spec; -} POSTPACK HCI_CMD_FLOW_SPEC_MODIFY; - -typedef struct hci_cmd_logical_link_cancel_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT8 phy_link_hdl; - A_UINT8 tx_flow_spec_id; -} POSTPACK HCI_CMD_LOGICAL_LINK_CANCEL; - -typedef struct hci_cmd_disconnect_logical_link_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT16 logical_link_hdl; -} POSTPACK HCI_CMD_DISCONNECT_LOGICAL_LINK; - -typedef struct hci_cmd_disconnect_phy_link_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT8 phy_link_hdl; -} POSTPACK HCI_CMD_DISCONNECT_PHY_LINK; - -typedef struct hci_cmd_srm_t { - A_UINT16 opcode; - A_UINT8 param_length; - A_UINT8 phy_link_hdl; - A_UINT8 mode; -} POSTPACK HCI_CMD_SHORT_RANGE_MODE; -/*============== HCI Command definitions end ======================= */ - - - -/*============== HCI Event definitions ============================= */ - -/* Command complete event */ -typedef struct hci_event_cmd_complete_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 num_hci_cmd_pkts; - A_UINT16 opcode; - A_UINT8 params[255]; -} POSTPACK HCI_EVENT_CMD_COMPLETE; - - -/* Command status event */ -typedef struct hci_event_cmd_status_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 status; - A_UINT8 num_hci_cmd_pkts; - A_UINT16 opcode; -} POSTPACK HCI_EVENT_CMD_STATUS; - -/* Hardware Error event */ -typedef struct hci_event_hw_err_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 hw_err_code; -} POSTPACK HCI_EVENT_HW_ERR; - -/* Flush occured event */ -/* Qos Violation event */ -typedef struct hci_event_handle_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT16 handle; -} POSTPACK HCI_EVENT_FLUSH_OCCRD, - HCI_EVENT_QOS_VIOLATION; - -/* Loopback command event */ -typedef struct hci_loopback_cmd_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 params[252]; -} POSTPACK HCI_EVENT_LOOPBACK_CMD; - -/* Data buffer overflow event */ -typedef struct hci_data_buf_overflow_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 link_type; -} POSTPACK HCI_EVENT_DATA_BUF_OVERFLOW; - -/* Enhanced Flush complete event */ -typedef struct hci_enhanced_flush_complt_t{ - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT16 hdl; -} POSTPACK HCI_EVENT_ENHANCED_FLUSH_COMPLT; - -/* Channel select event */ -typedef struct hci_event_chan_select_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 phy_link_hdl; -} POSTPACK HCI_EVENT_CHAN_SELECT; - -/* Physical Link Complete event */ -typedef struct hci_event_phy_link_complete_event_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 status; - A_UINT8 phy_link_hdl; -} POSTPACK HCI_EVENT_PHY_LINK_COMPLETE; - -/* Logical Link complete event */ -typedef struct hci_event_logical_link_complete_event_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 status; - A_UINT16 logical_link_hdl; - A_UINT8 phy_hdl; - A_UINT8 tx_flow_id; -} POSTPACK HCI_EVENT_LOGICAL_LINK_COMPLETE_EVENT; - -/* Disconnect Logical Link complete event */ -typedef struct hci_event_disconnect_logical_link_event_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 status; - A_UINT16 logical_link_hdl; - A_UINT8 reason; -} POSTPACK HCI_EVENT_DISCONNECT_LOGICAL_LINK_EVENT; - -/* Disconnect Physical Link complete event */ -typedef struct hci_event_disconnect_phy_link_complete_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 status; - A_UINT8 phy_link_hdl; - A_UINT8 reason; -} POSTPACK HCI_EVENT_DISCONNECT_PHY_LINK_COMPLETE; - -typedef struct hci_event_physical_link_loss_early_warning_t{ - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 phy_hdl; - A_UINT8 reason; -} POSTPACK HCI_EVENT_PHY_LINK_LOSS_EARLY_WARNING; - -typedef struct hci_event_physical_link_recovery_t{ - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 phy_hdl; -} POSTPACK HCI_EVENT_PHY_LINK_RECOVERY; - - -/* Flow spec modify complete event */ -/* Flush event */ -typedef struct hci_event_status_handle_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 status; - A_UINT16 handle; -} POSTPACK HCI_EVENT_FLOW_SPEC_MODIFY, - HCI_EVENT_FLUSH; - - -/* Num of completed data blocks event */ -typedef struct hci_event_num_of_compl_data_blks_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT16 num_data_blks; - A_UINT8 num_handles; - A_UINT8 params[255]; -} POSTPACK HCI_EVENT_NUM_COMPL_DATA_BLKS; - -/* Short range mode change complete event */ -typedef struct hci_srm_cmpl_t { - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 status; - A_UINT8 phy_link; - A_UINT8 state; -} POSTPACK HCI_EVENT_SRM_COMPL; - -typedef struct hci_event_amp_status_change_t{ - A_UINT8 event_code; - A_UINT8 param_len; - A_UINT8 status; - A_UINT8 amp_status; -} POSTPACK HCI_EVENT_AMP_STATUS_CHANGE; - -/*============== Event definitions end =========================== */ - - -typedef struct local_amp_info_resp_t { - A_UINT8 status; - A_UINT8 amp_status; - A_UINT32 total_bw; /* kbps */ - A_UINT32 max_guranteed_bw; /* kbps */ - A_UINT32 min_latency; - A_UINT32 max_pdu_size; - A_UINT8 amp_type; - A_UINT16 pal_capabilities; - A_UINT16 amp_assoc_len; - A_UINT32 max_flush_timeout; /* in ms */ - A_UINT32 be_flush_timeout; /* in ms */ -} POSTPACK LOCAL_AMP_INFO; - -typedef struct amp_assoc_cmd_resp_t{ - A_UINT8 status; - A_UINT8 phy_hdl; - A_UINT16 amp_assoc_len; - A_UINT8 amp_assoc_frag[AMP_ASSOC_MAX_FRAG_SZ]; -}POSTPACK AMP_ASSOC_CMD_RESP; - - -enum PAL_HCI_CMD_STATUS { - PAL_HCI_CMD_PROCESSED, - PAL_HCI_CMD_IGNORED -}; - - -/*============= HCI Error Codes =======================*/ -#define HCI_SUCCESS 0x00 -#define HCI_ERR_UNKNOW_CMD 0x01 -#define HCI_ERR_UNKNOWN_CONN_ID 0x02 -#define HCI_ERR_HW_FAILURE 0x03 -#define HCI_ERR_PAGE_TIMEOUT 0x04 -#define HCI_ERR_AUTH_FAILURE 0x05 -#define HCI_ERR_KEY_MISSING 0x06 -#define HCI_ERR_MEM_CAP_EXECED 0x07 -#define HCI_ERR_CON_TIMEOUT 0x08 -#define HCI_ERR_CON_LIMIT_EXECED 0x09 -#define HCI_ERR_ACL_CONN_ALRDY_EXISTS 0x0B -#define HCI_ERR_COMMAND_DISALLOWED 0x0C -#define HCI_ERR_CONN_REJ_BY_LIMIT_RES 0x0D -#define HCI_ERR_CONN_REJ_BY_SEC 0x0E -#define HCI_ERR_CONN_REJ_BY_BAD_ADDR 0x0F -#define HCI_ERR_CONN_ACCPT_TIMEOUT 0x10 -#define HCI_ERR_UNSUPPORT_FEATURE 0x11 -#define HCI_ERR_INVALID_HCI_CMD_PARAMS 0x12 -#define HCI_ERR_REMOTE_USER_TERMINATE_CONN 0x13 -#define HCI_ERR_CON_TERM_BY_HOST 0x16 -#define HCI_ERR_UNSPECIFIED_ERROR 0x1F -#define HCI_ERR_ENCRYPTION_MODE_NOT_SUPPORT 0x25 -#define HCI_ERR_REQUESTED_QOS_NOT_SUPPORT 0x27 -#define HCI_ERR_QOS_UNACCEPTABLE_PARM 0x2C -#define HCI_ERR_QOS_REJECTED 0x2D -#define HCI_ERR_CONN_REJ_NO_SUITABLE_CHAN 0x39 - -/*============= HCI Error Codes End =======================*/ - - -/* Following are event return parameters.. part of HCI events - */ -typedef struct timeout_read_t { - A_UINT8 status; - A_UINT16 timeout; -}POSTPACK TIMEOUT_INFO; - -typedef struct link_supervision_timeout_read_t { - A_UINT8 status; - A_UINT16 hdl; - A_UINT16 timeout; -}POSTPACK LINK_SUPERVISION_TIMEOUT_INFO; - -typedef struct status_hdl_t { - A_UINT8 status; - A_UINT16 hdl; -}POSTPACK INFO_STATUS_HDL; - -typedef struct write_remote_amp_assoc_t{ - A_UINT8 status; - A_UINT8 hdl; -}POSTPACK WRITE_REMOTE_AMP_ASSOC_INFO; - -typedef struct read_loc_info_t { - A_UINT8 status; - LOCATION_DATA_CFG loc; -}POSTPACK READ_LOC_INFO; - -typedef struct read_flow_ctrl_mode_t { - A_UINT8 status; - A_UINT8 mode; -}POSTPACK READ_FLWCTRL_INFO; - -typedef struct read_data_blk_size_t { - A_UINT8 status; - A_UINT16 max_acl_data_pkt_len; - A_UINT16 data_block_len; - A_UINT16 total_num_data_blks; -}POSTPACK READ_DATA_BLK_SIZE_INFO; - -/* Read Link quality info */ -typedef struct link_qual_t { - A_UINT8 status; - A_UINT16 hdl; - A_UINT8 link_qual; -} POSTPACK READ_LINK_QUAL_INFO, - READ_RSSI_INFO; - -typedef struct ll_cancel_resp_t { - A_UINT8 status; - A_UINT8 phy_link_hdl; - A_UINT8 tx_flow_spec_id; -} POSTPACK LL_CANCEL_RESP; - -typedef struct read_local_ver_info_t { - A_UINT8 status; - A_UINT8 hci_version; - A_UINT16 hci_revision; - A_UINT8 pal_version; - A_UINT16 manf_name; - A_UINT16 pal_sub_ver; -} POSTPACK READ_LOCAL_VER_INFO; - - -#endif /* __A_HCI_H__ */ diff --git a/drivers/net/wireless/ar6003/include/athdefs.h b/drivers/net/wireless/ar6003/include/athdefs.h deleted file mode 100644 index b59bfd3af0a5..000000000000 --- a/drivers/net/wireless/ar6003/include/athdefs.h +++ /dev/null @@ -1,84 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#ifndef __ATHDEFS_H__ -#define __ATHDEFS_H__ - -/* - * This file contains definitions that may be used across both - * Host and Target software. Nothing here is module-dependent - * or platform-dependent. - */ - -/* - * Generic error codes that can be used by hw, sta, ap, sim, dk - * and any other environments. Since these are enums, feel free to - * add any more codes that you need. - */ - -typedef enum { - A_ERROR = -1, /* Generic error return */ - A_OK = 0, /* success */ - /* Following values start at 1 */ - A_DEVICE_NOT_FOUND, /* not able to find PCI device */ - A_NO_MEMORY, /* not able to allocate memory, not available */ - A_MEMORY_NOT_AVAIL, /* memory region is not free for mapping */ - A_NO_FREE_DESC, /* no free descriptors available */ - A_BAD_ADDRESS, /* address does not match descriptor */ - A_WIN_DRIVER_ERROR, /* used in NT_HW version, if problem at init */ - A_REGS_NOT_MAPPED, /* registers not correctly mapped */ - A_EPERM, /* Not superuser */ - A_EACCES, /* Access denied */ - A_ENOENT, /* No such entry, search failed, etc. */ - A_EEXIST, /* The object already exists (can't create) */ - A_EFAULT, /* Bad address fault */ - A_EBUSY, /* Object is busy */ - A_EINVAL, /* Invalid parameter */ - A_EMSGSIZE, /* Inappropriate message buffer length */ - A_ECANCELED, /* Operation canceled */ - A_ENOTSUP, /* Operation not supported */ - A_ECOMM, /* Communication error on send */ - A_EPROTO, /* Protocol error */ - A_ENODEV, /* No such device */ - A_EDEVNOTUP, /* device is not UP */ - A_NO_RESOURCE, /* No resources for requested operation */ - A_HARDWARE, /* Hardware failure */ - A_PENDING, /* Asynchronous routine; will send up results la -ter (typically in callback) */ - A_EBADCHANNEL, /* The channel cannot be used */ - A_DECRYPT_ERROR, /* Decryption error */ - A_PHY_ERROR, /* RX PHY error */ - A_CONSUMED /* Object was consumed */ -} A_STATUS; - -#define A_SUCCESS(x) (x == A_OK) -#define A_FAILED(x) (!A_SUCCESS(x)) - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#endif /* __ATHDEFS_H__ */ diff --git a/drivers/net/wireless/ar6003/include/bmi_msg.h b/drivers/net/wireless/ar6003/include/bmi_msg.h deleted file mode 100644 index 3035827c9abb..000000000000 --- a/drivers/net/wireless/ar6003/include/bmi_msg.h +++ /dev/null @@ -1,334 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef __BMI_MSG_H__ -#define __BMI_MSG_H__ - -#ifndef ATH_TARGET -#include "athstartpack.h" -#endif - -/* - * Bootloader Messaging Interface (BMI) - * - * BMI is a very simple messaging interface used during initialization - * to read memory, write memory, execute code, and to define an - * application entry PC. - * - * It is used to download an application to AR6K, to provide - * patches to code that is already resident on AR6K, and generally - * to examine and modify state. The Host has an opportunity to use - * BMI only once during bootup. Once the Host issues a BMI_DONE - * command, this opportunity ends. - * - * The Host writes BMI requests to mailbox0, and reads BMI responses - * from mailbox0. BMI requests all begin with a command - * (see below for specific commands), and are followed by - * command-specific data. - * - * Flow control: - * The Host can only issue a command once the Target gives it a - * "BMI Command Credit", using AR6K Counter #4. As soon as the - * Target has completed a command, it issues another BMI Command - * Credit (so the Host can issue the next command). - * - * BMI handles all required Target-side cache flushing. - */ - - -/* Maximum data size used for BMI transfers */ -#define BMI_DATASZ_MAX 256 - -/* BMI Commands */ - -#define BMI_NO_COMMAND 0 - -#define BMI_DONE 1 - /* - * Semantics: Host is done using BMI - * Request format: - * A_UINT32 command (BMI_DONE) - * Response format: none - */ - -#define BMI_READ_MEMORY 2 - /* - * Semantics: Host reads AR6K memory - * Request format: - * A_UINT32 command (BMI_READ_MEMORY) - * A_UINT32 address - * A_UINT32 length, at most BMI_DATASZ_MAX - * Response format: - * A_UINT8 data[length] - */ - -#define BMI_WRITE_MEMORY 3 - /* - * Semantics: Host writes AR6K memory - * Request format: - * A_UINT32 command (BMI_WRITE_MEMORY) - * A_UINT32 address - * A_UINT32 length, at most BMI_DATASZ_MAX - * A_UINT8 data[length] - * Response format: none - */ -/* - * Capbility to write "segmented files" is provided for two reasons - * 1) backwards compatibility for certain situations where Hosts - * have limited flexibility - * 2) because it's darn convenient. - * - * A segmented file consists of a file header followed by an arbitrary number - * of segments. Each segment contains segment metadata -- a Target address and - * a length -- followed by "length" bytes of data. A segmented file ends with - * a segment that specifies length=BMI_SGMTFILE_DONE. When a segmented file - * is sent to the Target, firmware writes each segment to the specified address. - * - * Special cases: - * 1) If a segment's metadata indicates length=BMI_SGMTFILE_EXEC, then the - * specified address is used as a function entry point for a brief function - * with prototype "(void *)(void)". That function is called immediately. - * After execution of the function completes, firmware continues with the - * next segment. No data is expected when length=BMI_SGMTFILE_EXEC. - * - * 2) If a segment's metadata indicates length=BMI_SGMTFILE_BEGINADDR, then - * the specified address is established as the application start address - * so that a subsequent BMI_DONE jumps there. - * - * 3) If a segment's metadata indicates length=BMI_SGMTFILE_BDDATA, then - * the specified address is used as the (possibly compressed) length of board - * data, which is loaded into the proper Target address as specified by - * hi_board_data. In addition, the hi_board_data_initialized flag is set. - * - * A segmented file is sent to the Target using a sequence of 1 or more - * BMI_WRITE_MEMORY commands. The first such command must have - * address=BMI_SEGMENTED_WRITE_ADDR. Subsequent BMI_WRITE_MEMORY commands - * can use an arbitrary address. In each BMI_WRITE_MEMORY command, the - * length specifies the number of data bytes transmitted (except for the - * special cases listed above). - * - * Alternatively, a segmented file may be sent to the Target using a - * BMI_LZ_STREAM_START command with address=BMI_SEGMENTED_WRITE_ADDR - * followed by a series of BMI_LZ_DATA commands that each send the next portion - * of the segmented file. - * - * The data segments may be lz77 compressed. In this case, the segmented file - * header flag, BMI_SGMTFILE_FLAG_COMPRESS, must be set. Note that segmented - * file METAdata is never compressed; only the data segments themselves are - * compressed. There is no way to mix compressed and uncompressed data segments - * in a single segmented file. Compressed (or uncompressed) segments are handled - * by both BMI_WRITE_MEMORY and by BMI_LZ_DATA commands. (Compression is an - * attribute of the segmented file rather than of the command used to transmit - * it.) - */ -#define BMI_SEGMENTED_WRITE_ADDR 0x1234 - -/* File header for a segmented file */ -struct bmi_segmented_file_header { - A_UINT32 magic_num; - A_UINT32 file_flags; -}; -#define BMI_SGMTFILE_MAGIC_NUM 0x544d4753 /* "SGMT" */ -#define BMI_SGMTFILE_FLAG_COMPRESS 1 - -/* Metadata for a segmented file segment */ -struct bmi_segmented_metadata { - A_UINT32 addr; - A_UINT32 length; -}; -/* Special values for bmi_segmented_metadata.length (all have high bit set) */ -#define BMI_SGMTFILE_DONE 0xffffffff /* end of segmented data */ -#define BMI_SGMTFILE_BDDATA 0xfffffffe /* Board Data segment */ -#define BMI_SGMTFILE_BEGINADDR 0xfffffffd /* set beginning address */ -#define BMI_SGMTFILE_EXEC 0xfffffffc /* immediate function execution */ - -#define BMI_EXECUTE 4 - /* - * Semantics: Causes AR6K to execute code - * Request format: - * A_UINT32 command (BMI_EXECUTE) - * A_UINT32 address - * A_UINT32 parameter - * Response format: - * A_UINT32 return value - */ -/* - * Note: In order to support the segmented file feature - * (see BMI_WRITE_MEMORY), when the address specified in a - * BMI_EXECUTE command matches (same physical address) - * BMI_SEGMENTED_WRITE_ADDR, it is ignored. Instead, execution - * begins at the address specified by hi_app_start. - */ - -#define BMI_SET_APP_START 5 - /* - * Semantics: Set Target application starting address - * Request format: - * A_UINT32 command (BMI_SET_APP_START) - * A_UINT32 address - * Response format: none - */ - -#define BMI_READ_SOC_REGISTER 6 - /* - * Semantics: Read a 32-bit Target SOC register. - * Request format: - * A_UINT32 command (BMI_READ_REGISTER) - * A_UINT32 address - * Response format: - * A_UINT32 value - */ - -#define BMI_WRITE_SOC_REGISTER 7 - /* - * Semantics: Write a 32-bit Target SOC register. - * Request format: - * A_UINT32 command (BMI_WRITE_REGISTER) - * A_UINT32 address - * A_UINT32 value - * - * Response format: none - */ - -#define BMI_GET_TARGET_ID 8 -#define BMI_GET_TARGET_INFO 8 - /* - * Semantics: Fetch the 4-byte Target information - * Request format: - * A_UINT32 command (BMI_GET_TARGET_ID/INFO) - * Response format1 (old firmware): - * A_UINT32 TargetVersionID - * Response format2 (newer firmware): - * A_UINT32 TARGET_VERSION_SENTINAL - * struct bmi_target_info; - */ - -PREPACK struct bmi_target_info { - A_UINT32 target_info_byte_count; /* size of this structure */ - A_UINT32 target_ver; /* Target Version ID */ - A_UINT32 target_type; /* Target type */ -} POSTPACK; -#define TARGET_VERSION_SENTINAL 0xffffffff -#define TARGET_TYPE_AR6001 1 -#define TARGET_TYPE_AR6002 2 -#define TARGET_TYPE_AR6003 3 -#define TARGET_TYPE_MCKINLEY 5 - - -#define BMI_ROMPATCH_INSTALL 9 - /* - * Semantics: Install a ROM Patch. - * Request format: - * A_UINT32 command (BMI_ROMPATCH_INSTALL) - * A_UINT32 Target ROM Address - * A_UINT32 Target RAM Address or Value (depending on Target Type) - * A_UINT32 Size, in bytes - * A_UINT32 Activate? 1-->activate; - * 0-->install but do not activate - * Response format: - * A_UINT32 PatchID - */ - -#define BMI_ROMPATCH_UNINSTALL 10 - /* - * Semantics: Uninstall a previously-installed ROM Patch, - * automatically deactivating, if necessary. - * Request format: - * A_UINT32 command (BMI_ROMPATCH_UNINSTALL) - * A_UINT32 PatchID - * - * Response format: none - */ - -#define BMI_ROMPATCH_ACTIVATE 11 - /* - * Semantics: Activate a list of previously-installed ROM Patches. - * Request format: - * A_UINT32 command (BMI_ROMPATCH_ACTIVATE) - * A_UINT32 rompatch_count - * A_UINT32 PatchID[rompatch_count] - * - * Response format: none - */ - -#define BMI_ROMPATCH_DEACTIVATE 12 - /* - * Semantics: Deactivate a list of active ROM Patches. - * Request format: - * A_UINT32 command (BMI_ROMPATCH_DEACTIVATE) - * A_UINT32 rompatch_count - * A_UINT32 PatchID[rompatch_count] - * - * Response format: none - */ - - -#define BMI_LZ_STREAM_START 13 - /* - * Semantics: Begin an LZ-compressed stream of input - * which is to be uncompressed by the Target to an - * output buffer at address. The output buffer must - * be sufficiently large to hold the uncompressed - * output from the compressed input stream. This BMI - * command should be followed by a series of 1 or more - * BMI_LZ_DATA commands. - * A_UINT32 command (BMI_LZ_STREAM_START) - * A_UINT32 address - * Note: Not supported on all versions of ROM firmware. - */ - -#define BMI_LZ_DATA 14 - /* - * Semantics: Host writes AR6K memory with LZ-compressed - * data which is uncompressed by the Target. This command - * must be preceded by a BMI_LZ_STREAM_START command. A series - * of BMI_LZ_DATA commands are considered part of a single - * input stream until another BMI_LZ_STREAM_START is issued. - * Request format: - * A_UINT32 command (BMI_LZ_DATA) - * A_UINT32 length (of compressed data), - * at most BMI_DATASZ_MAX - * A_UINT8 CompressedData[length] - * Response format: none - * Note: Not supported on all versions of ROM firmware. - */ - -#define BMI_NVRAM_PROCESS 15 -#define BMI_NVRAM_SEG_NAME_SZ 16 - /* - * Semantics: Cause Target to search NVRAM (if any) for a - * segment with the specified name and process it according - * to NVRAM metadata. - * Request format: - * A_UINT32 command (BMI_NVRAM_PROCESS) - * A_UCHAR name[BMI_NVRAM_SEG_NAME_SZ] name (LE format) - * Response format: - * A_UINT32 0, if nothing was executed; - * otherwise the value returned from the - * last NVRAM segment that was executed - */ - -#ifndef ATH_TARGET -#include "athendpack.h" -#endif - -#endif /* __BMI_MSG_H__ */ diff --git a/drivers/net/wireless/ar6003/include/btcoexGpio.h b/drivers/net/wireless/ar6003/include/btcoexGpio.h deleted file mode 100644 index bc067f557eaa..000000000000 --- a/drivers/net/wireless/ar6003/include/btcoexGpio.h +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2010 Atheros Communications Inc. -// All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// - -#ifndef BTCOEX_GPIO_H_ -#define BTCOEX_GPIO_H_ - - - -#ifdef FPGA -#define GPIO_A (15) -#define GPIO_B (16) -#define GPIO_C (17) -#define GPIO_D (18) -#define GPIO_E (19) -#define GPIO_F (21) -#define GPIO_G (21) -#else -#define GPIO_A (0) -#define GPIO_B (5) -#define GPIO_C (6) -#define GPIO_D (7) -#define GPIO_E (7) -#define GPIO_F (7) -#define GPIO_G (7) -#endif - - - - - -#define GPIO_DEBUG_WORD_1 (1< -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef _CNXMGMT_H_ -#define _CNXMGMT_H_ - -typedef enum { - CM_CONNECT_WITHOUT_SCAN = 0x0001, - CM_CONNECT_ASSOC_POLICY_USER = 0x0002, - CM_CONNECT_SEND_REASSOC = 0x0004, - CM_CONNECT_WITHOUT_ROAMTABLE_UPDATE = 0x0008, - CM_CONNECT_DO_WPA_OFFLOAD = 0x0010, - CM_CONNECT_DO_NOT_DEAUTH = 0x0020, -} CM_CONNECT_TYPE; - -#endif /* _CNXMGMT_H_ */ diff --git a/drivers/net/wireless/ar6003/include/dbglog.h b/drivers/net/wireless/ar6003/include/dbglog.h deleted file mode 100644 index 382d9a2dd4eb..000000000000 --- a/drivers/net/wireless/ar6003/include/dbglog.h +++ /dev/null @@ -1,134 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef _DBGLOG_H_ -#define _DBGLOG_H_ - -#ifndef ATH_TARGET -#include "athstartpack.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define DBGLOG_TIMESTAMP_OFFSET 0 -#define DBGLOG_TIMESTAMP_MASK 0x0000FFFF /* Bit 0-15. Contains bit - 8-23 of the LF0 timer */ -#define DBGLOG_DBGID_OFFSET 16 -#define DBGLOG_DBGID_MASK 0x03FF0000 /* Bit 16-25 */ -#define DBGLOG_DBGID_NUM_MAX 256 /* Upper limit is width of mask */ - -#define DBGLOG_MODULEID_OFFSET 26 -#define DBGLOG_MODULEID_MASK 0x3C000000 /* Bit 26-29 */ -#define DBGLOG_MODULEID_NUM_MAX 16 /* Upper limit is width of mask */ - -/* - * Please ensure that the definition of any new module intrduced is captured - * between the DBGLOG_MODULEID_START and DBGLOG_MODULEID_END defines. The - * structure is required for the parser to correctly pick up the values for - * different modules. - */ -#define DBGLOG_MODULEID_START -#define DBGLOG_MODULEID_INF 0 -#define DBGLOG_MODULEID_WMI 1 -#define DBGLOG_MODULEID_MISC 2 -#define DBGLOG_MODULEID_PM 3 -#define DBGLOG_MODULEID_TXRX_MGMTBUF 4 -#define DBGLOG_MODULEID_TXRX_TXBUF 5 -#define DBGLOG_MODULEID_TXRX_RXBUF 6 -#define DBGLOG_MODULEID_WOW 7 -#define DBGLOG_MODULEID_WHAL 8 -#define DBGLOG_MODULEID_DC 9 -#define DBGLOG_MODULEID_CO 10 -#define DBGLOG_MODULEID_RO 11 -#define DBGLOG_MODULEID_CM 12 -#define DBGLOG_MODULEID_MGMT 13 -#define DBGLOG_MODULEID_TMR 14 -#define DBGLOG_MODULEID_BTCOEX 15 -#define DBGLOG_MODULEID_END - -#define DBGLOG_NUM_ARGS_OFFSET 30 -#define DBGLOG_NUM_ARGS_MASK 0xC0000000 /* Bit 30-31 */ -#define DBGLOG_NUM_ARGS_MAX 2 /* Upper limit is width of mask */ - -#define DBGLOG_MODULE_LOG_ENABLE_OFFSET 0 -#define DBGLOG_MODULE_LOG_ENABLE_MASK 0x0000FFFF - -#define DBGLOG_REPORTING_ENABLED_OFFSET 16 -#define DBGLOG_REPORTING_ENABLED_MASK 0x00010000 - -#define DBGLOG_TIMESTAMP_RESOLUTION_OFFSET 17 -#define DBGLOG_TIMESTAMP_RESOLUTION_MASK 0x000E0000 - -#define DBGLOG_REPORT_SIZE_OFFSET 20 -#define DBGLOG_REPORT_SIZE_MASK 0x3FF00000 - -#define DBGLOG_LOG_BUFFER_SIZE 1500 -#define DBGLOG_DBGID_DEFINITION_LEN_MAX 90 - -PREPACK struct dbglog_buf_s { - struct dbglog_buf_s *next; - A_UINT8 *buffer; - A_UINT32 bufsize; - A_UINT32 length; - A_UINT32 count; - A_UINT32 free; -} POSTPACK; - -PREPACK struct dbglog_hdr_s { - struct dbglog_buf_s *dbuf; - A_UINT32 dropped; -} POSTPACK; - -PREPACK struct dbglog_config_s { - A_UINT32 cfgvalid; /* Mask with valid config bits */ - union { - /* TODO: Take care of endianness */ - struct { - A_UINT32 mmask:16; /* Mask of modules with logging on */ - A_UINT32 rep:1; /* Reporting enabled or not */ - A_UINT32 tsr:3; /* Time stamp resolution. Def: 1 ms */ - A_UINT32 size:10; /* Report size in number of messages */ - A_UINT32 reserved:2; - } dbglog_config; - - A_UINT32 value; - } u; -} POSTPACK; - -#define cfgmmask u.dbglog_config.mmask -#define cfgrep u.dbglog_config.rep -#define cfgtsr u.dbglog_config.tsr -#define cfgsize u.dbglog_config.size -#define cfgvalue u.value - -#ifdef __cplusplus -} -#endif - -#ifndef ATH_TARGET -#include "athendpack.h" -#endif - -#endif /* _DBGLOG_H_ */ diff --git a/drivers/net/wireless/ar6003/include/dbglog_id.h b/drivers/net/wireless/ar6003/include/dbglog_id.h deleted file mode 100644 index 16ab89c9e110..000000000000 --- a/drivers/net/wireless/ar6003/include/dbglog_id.h +++ /dev/null @@ -1,593 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef _DBGLOG_ID_H_ -#define _DBGLOG_ID_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The nomenclature for the debug identifiers is MODULE_DESCRIPTION. - * Please ensure that the definition of any new debugid introduced is captured - * between the _DBGID_DEFINITION_START and - * _DBGID_DEFINITION_END defines. The structure is required for the - * parser to correctly pick up the values for different debug identifiers. - */ - -/* INF debug identifier definitions */ -#define INF_DBGID_DEFINITION_START -#define INF_ASSERTION_FAILED 1 -#define INF_TARGET_ID 2 -#define INF_DBGID_DEFINITION_END - -/* WMI debug identifier definitions */ -#define WMI_DBGID_DEFINITION_START -#define WMI_CMD_RX_XTND_PKT_TOO_SHORT 1 -#define WMI_EXTENDED_CMD_NOT_HANDLED 2 -#define WMI_CMD_RX_PKT_TOO_SHORT 3 -#define WMI_CALLING_WMI_EXTENSION_FN 4 -#define WMI_CMD_NOT_HANDLED 5 -#define WMI_IN_SYNC 6 -#define WMI_TARGET_WMI_SYNC_CMD 7 -#define WMI_SET_SNR_THRESHOLD_PARAMS 8 -#define WMI_SET_RSSI_THRESHOLD_PARAMS 9 -#define WMI_SET_LQ_TRESHOLD_PARAMS 10 -#define WMI_TARGET_CREATE_PSTREAM_CMD 11 -#define WMI_WI_DTM_INUSE 12 -#define WMI_TARGET_DELETE_PSTREAM_CMD 13 -#define WMI_TARGET_IMPLICIT_DELETE_PSTREAM_CMD 14 -#define WMI_TARGET_GET_BIT_RATE_CMD 15 -#define WMI_GET_RATE_MASK_CMD_FIX_RATE_MASK_IS 16 -#define WMI_TARGET_GET_AVAILABLE_CHANNELS_CMD 17 -#define WMI_TARGET_GET_TX_PWR_CMD 18 -#define WMI_FREE_EVBUF_WMIBUF 19 -#define WMI_FREE_EVBUF_DATABUF 20 -#define WMI_FREE_EVBUF_BADFLAG 21 -#define WMI_HTC_RX_ERROR_DATA_PACKET 22 -#define WMI_HTC_RX_SYNC_PAUSING_FOR_MBOX 23 -#define WMI_INCORRECT_WMI_DATA_HDR_DROPPING_PKT 24 -#define WMI_SENDING_READY_EVENT 25 -#define WMI_SETPOWER_MDOE_TO_MAXPERF 26 -#define WMI_SETPOWER_MDOE_TO_REC 27 -#define WMI_BSSINFO_EVENT_FROM 28 -#define WMI_TARGET_GET_STATS_CMD 29 -#define WMI_SENDING_SCAN_COMPLETE_EVENT 30 -#define WMI_SENDING_RSSI_INDB_THRESHOLD_EVENT 31 -#define WMI_SENDING_RSSI_INDBM_THRESHOLD_EVENT 32 -#define WMI_SENDING_LINK_QUALITY_THRESHOLD_EVENT 33 -#define WMI_SENDING_ERROR_REPORT_EVENT 34 -#define WMI_SENDING_CAC_EVENT 35 -#define WMI_TARGET_GET_ROAM_TABLE_CMD 36 -#define WMI_TARGET_GET_ROAM_DATA_CMD 37 -#define WMI_SENDING_GPIO_INTR_EVENT 38 -#define WMI_SENDING_GPIO_ACK_EVENT 39 -#define WMI_SENDING_GPIO_DATA_EVENT 40 -#define WMI_CMD_RX 41 -#define WMI_CMD_RX_XTND 42 -#define WMI_EVENT_SEND 43 -#define WMI_EVENT_SEND_XTND 44 -#define WMI_CMD_PARAMS_DUMP_START 45 -#define WMI_CMD_PARAMS_DUMP_END 46 -#define WMI_CMD_PARAMS 47 -#define WMI_DBGID_DEFINITION_END - -/* MISC debug identifier definitions */ -#define MISC_DBGID_DEFINITION_START -#define MISC_WLAN_SCHEDULER_EVENT_REGISTER_ERROR 1 -#define TLPM_INIT 2 -#define TLPM_FILTER_POWER_STATE 3 -#define TLPM_NOTIFY_NOT_IDLE 4 -#define TLPM_TIMEOUT_IDLE_HANDLER 5 -#define TLPM_TIMEOUT_WAKEUP_HANDLER 6 -#define TLPM_WAKEUP_SIGNAL_HANDLER 7 -#define TLPM_UNEXPECTED_GPIO_INTR_ERROR 8 -#define TLPM_BREAK_ON_NOT_RECEIVED_ERROR 9 -#define TLPM_BREAK_OFF_NOT_RECIVED_ERROR 10 -#define TLPM_ACK_GPIO_INTR 11 -#define TLPM_ON 12 -#define TLPM_OFF 13 -#define TLPM_WAKEUP_FROM_HOST 14 -#define TLPM_WAKEUP_FROM_BT 15 -#define TLPM_TX_BREAK_RECIVED 16 -#define TLPM_IDLE_TIMER_NOT_RUNNING 17 -#define WAC_ENABLE 18 -#define WAC_SCAN_DONE 19 -#define WAC_REPORT_BSS 20 -#define WAC_START_WPS 21 -#define WAC_SCAN_REPLY 22 -#define WAC_UPDATE_BSS 23 -#define WAC_PIN_STATUS 24 -#define WAC_PIN_STATUS_REJECT 25 -#define WAC_RSSI_BELOW_THRESHOLD 26 -#define WAC_CTRL_REQ_CMD 27 -#define WAC_CTRL_REQ_REPLY 28 -#define DV_SET_ANTENNA 29 -#define MISC_DBGID_DEFINITION_END - -/* TXRX debug identifier definitions */ -#define TXRX_TXBUF_DBGID_DEFINITION_START -#define TXRX_TXBUF_ALLOCATE_BUF 1 -#define TXRX_TXBUF_QUEUE_BUF_TO_MBOX 2 -#define TXRX_TXBUF_QUEUE_BUF_TO_TXQ 3 -#define TXRX_TXBUF_TXQ_DEPTH 4 -#define TXRX_TXBUF_IBSS_QUEUE_TO_SFQ 5 -#define TXRX_TXBUF_IBSS_QUEUE_TO_TXQ_FRM_SFQ 6 -#define TXRX_TXBUF_INITIALIZE_TIMER 7 -#define TXRX_TXBUF_ARM_TIMER 8 -#define TXRX_TXBUF_DISARM_TIMER 9 -#define TXRX_TXBUF_UNINITIALIZE_TIMER 10 -#define TXRX_TXBUF_DBGID_DEFINITION_END - -#define TXRX_RXBUF_DBGID_DEFINITION_START -#define TXRX_RXBUF_ALLOCATE_BUF 1 -#define TXRX_RXBUF_QUEUE_TO_HOST 2 -#define TXRX_RXBUF_QUEUE_TO_WLAN 3 -#define TXRX_RXBUF_ZERO_LEN_BUF 4 -#define TXRX_RXBUF_QUEUE_TO_HOST_LASTBUF_IN_RXCHAIN 5 -#define TXRX_RXBUF_LASTBUF_IN_RXCHAIN_ZEROBUF 6 -#define TXRX_RXBUF_QUEUE_EMPTY_QUEUE_TO_WLAN 7 -#define TXRX_RXBUF_SEND_TO_RECV_MGMT 8 -#define TXRX_RXBUF_SEND_TO_IEEE_LAYER 9 -#define TXRX_RXBUF_REQUEUE_ERROR 10 -#define TXRX_RXBUF_DBGID_DEFINITION_END - -#define TXRX_MGMTBUF_DBGID_DEFINITION_START -#define TXRX_MGMTBUF_ALLOCATE_BUF 1 -#define TXRX_MGMTBUF_ALLOCATE_SM_BUF 2 -#define TXRX_MGMTBUF_ALLOCATE_RMBUF 3 -#define TXRX_MGMTBUF_GET_BUF 4 -#define TXRX_MGMTBUF_GET_SM_BUF 5 -#define TXRX_MGMTBUF_QUEUE_BUF_TO_TXQ 6 -#define TXRX_MGMTBUF_REAPED_BUF 7 -#define TXRX_MGMTBUF_REAPED_SM_BUF 8 -#define TXRX_MGMTBUF_WAIT_FOR_TXQ_DRAIN 9 -#define TXRX_MGMTBUF_WAIT_FOR_TXQ_SFQ_DRAIN 10 -#define TXRX_MGMTBUF_ENQUEUE_INTO_DATA_SFQ 11 -#define TXRX_MGMTBUF_DEQUEUE_FROM_DATA_SFQ 12 -#define TXRX_MGMTBUF_PAUSE_DATA_TXQ 13 -#define TXRX_MGMTBUF_RESUME_DATA_TXQ 14 -#define TXRX_MGMTBUF_WAIT_FORTXQ_DRAIN_TIMEOUT 15 -#define TXRX_MGMTBUF_DRAINQ 16 -#define TXRX_MGMTBUF_INDICATE_Q_DRAINED 17 -#define TXRX_MGMTBUF_ENQUEUE_INTO_HW_SFQ 18 -#define TXRX_MGMTBUF_DEQUEUE_FROM_HW_SFQ 19 -#define TXRX_MGMTBUF_PAUSE_HW_TXQ 20 -#define TXRX_MGMTBUF_RESUME_HW_TXQ 21 -#define TXRX_MGMTBUF_TEAR_DOWN_BA 22 -#define TXRX_MGMTBUF_PROCESS_ADDBA_REQ 23 -#define TXRX_MGMTBUF_PROCESS_DELBA 24 -#define TXRX_MGMTBUF_PERFORM_BA 25 -#define TXRX_MGMTBUF_WLAN_RESET_ON_ERROR 26 -#define TXRX_MGMTBUF_DBGID_DEFINITION_END - -/* PM (Power Module) debug identifier definitions */ -#define PM_DBGID_DEFINITION_START -#define PM_INIT 1 -#define PM_ENABLE 2 -#define PM_SET_STATE 3 -#define PM_SET_POWERMODE 4 -#define PM_CONN_NOTIFY 5 -#define PM_REF_COUNT_NEGATIVE 6 -#define PM_INFRA_STA_APSD_ENABLE 7 -#define PM_INFRA_STA_UPDATE_APSD_STATE 8 -#define PM_CHAN_OP_REQ 9 -#define PM_SET_MY_BEACON_POLICY 10 -#define PM_SET_ALL_BEACON_POLICY 11 -#define PM_INFRA_STA_SET_PM_PARAMS1 12 -#define PM_INFRA_STA_SET_PM_PARAMS2 13 -#define PM_ADHOC_SET_PM_CAPS_FAIL 14 -#define PM_ADHOC_UNKNOWN_IBSS_ATTRIB_ID 15 -#define PM_ADHOC_SET_PM_PARAMS 16 -#define PM_ADHOC_STATE1 18 -#define PM_ADHOC_STATE2 19 -#define PM_ADHOC_CONN_MAP 20 -#define PM_FAKE_SLEEP 21 -#define PM_AP_STATE1 22 -#define PM_AP_SET_PM_PARAMS 23 -#define PM_P2P_STATE1 24 -#define PM_DBGID_DEFINITION_END - -/* Wake on Wireless debug identifier definitions */ -#define WOW_DBGID_DEFINITION_START -#define WOW_INIT 1 -#define WOW_GET_CONFIG_DSET 2 -#define WOW_NO_CONFIG_DSET 3 -#define WOW_INVALID_CONFIG_DSET 4 -#define WOW_USE_DEFAULT_CONFIG 5 -#define WOW_SETUP_GPIO 6 -#define WOW_INIT_DONE 7 -#define WOW_SET_GPIO_PIN 8 -#define WOW_CLEAR_GPIO_PIN 9 -#define WOW_SET_WOW_MODE_CMD 10 -#define WOW_SET_HOST_MODE_CMD 11 -#define WOW_ADD_WOW_PATTERN_CMD 12 -#define WOW_NEW_WOW_PATTERN_AT_INDEX 13 -#define WOW_DEL_WOW_PATTERN_CMD 14 -#define WOW_LIST_CONTAINS_PATTERNS 15 -#define WOW_GET_WOW_LIST_CMD 16 -#define WOW_INVALID_FILTER_ID 17 -#define WOW_INVALID_FILTER_LISTID 18 -#define WOW_NO_VALID_FILTER_AT_ID 19 -#define WOW_NO_VALID_LIST_AT_ID 20 -#define WOW_NUM_PATTERNS_EXCEEDED 21 -#define WOW_NUM_LISTS_EXCEEDED 22 -#define WOW_GET_WOW_STATS 23 -#define WOW_CLEAR_WOW_STATS 24 -#define WOW_WAKEUP_HOST 25 -#define WOW_EVENT_WAKEUP_HOST 26 -#define WOW_EVENT_DISCARD 27 -#define WOW_PATTERN_MATCH 28 -#define WOW_PATTERN_NOT_MATCH 29 -#define WOW_PATTERN_NOT_MATCH_OFFSET 30 -#define WOW_DISABLED_HOST_ASLEEP 31 -#define WOW_ENABLED_HOST_ASLEEP_NO_PATTERNS 32 -#define WOW_ENABLED_HOST_ASLEEP_NO_MATCH_FOUND 33 -#define WOW_DBGID_DEFINITION_END - -/* WHAL debug identifier definitions */ -#define WHAL_DBGID_DEFINITION_START -#define WHAL_ERROR_ANI_CONTROL 1 -#define WHAL_ERROR_CHIP_TEST1 2 -#define WHAL_ERROR_CHIP_TEST2 3 -#define WHAL_ERROR_EEPROM_CHECKSUM 4 -#define WHAL_ERROR_EEPROM_MACADDR 5 -#define WHAL_ERROR_INTERRUPT_HIU 6 -#define WHAL_ERROR_KEYCACHE_RESET 7 -#define WHAL_ERROR_KEYCACHE_SET 8 -#define WHAL_ERROR_KEYCACHE_TYPE 9 -#define WHAL_ERROR_KEYCACHE_TKIPENTRY 10 -#define WHAL_ERROR_KEYCACHE_WEPLENGTH 11 -#define WHAL_ERROR_PHY_INVALID_CHANNEL 12 -#define WHAL_ERROR_POWER_AWAKE 13 -#define WHAL_ERROR_POWER_SET 14 -#define WHAL_ERROR_RECV_STOPDMA 15 -#define WHAL_ERROR_RECV_STOPPCU 16 -#define WHAL_ERROR_RESET_CHANNF1 17 -#define WHAL_ERROR_RESET_CHANNF2 18 -#define WHAL_ERROR_RESET_PM 19 -#define WHAL_ERROR_RESET_OFFSETCAL 20 -#define WHAL_ERROR_RESET_RFGRANT 21 -#define WHAL_ERROR_RESET_RXFRAME 22 -#define WHAL_ERROR_RESET_STOPDMA 23 -#define WHAL_ERROR_RESET_RECOVER 24 -#define WHAL_ERROR_XMIT_COMPUTE 25 -#define WHAL_ERROR_XMIT_NOQUEUE 26 -#define WHAL_ERROR_XMIT_ACTIVEQUEUE 27 -#define WHAL_ERROR_XMIT_BADTYPE 28 -#define WHAL_ERROR_XMIT_STOPDMA 29 -#define WHAL_ERROR_INTERRUPT_BB_PANIC 30 -#define WHAL_ERROR_RESET_TXIQCAL 31 -#define WHAL_ERROR_PAPRD_MAXGAIN_ABOVE_WINDOW 32 -#define WHAL_DBGID_DEFINITION_END - -/* DC debug identifier definitions */ -#define DC_DBGID_DEFINITION_START -#define DC_SCAN_CHAN_START 1 -#define DC_SCAN_CHAN_FINISH 2 -#define DC_BEACON_RECEIVE7 3 -#define DC_SSID_PROBE_CB 4 -#define DC_SEND_NEXT_SSID_PROBE 5 -#define DC_START_SEARCH 6 -#define DC_CANCEL_SEARCH_CB 7 -#define DC_STOP_SEARCH 8 -#define DC_END_SEARCH 9 -#define DC_MIN_CHDWELL_TIMEOUT 10 -#define DC_START_SEARCH_CANCELED 11 -#define DC_SET_POWER_MODE 12 -#define DC_INIT 13 -#define DC_SEARCH_OPPORTUNITY 14 -#define DC_RECEIVED_ANY_BEACON 15 -#define DC_RECEIVED_MY_BEACON 16 -#define DC_PROFILE_IS_ADHOC_BUT_BSS_IS_INFRA 17 -#define DC_PS_ENABLED_BUT_ATHEROS_IE_ABSENT 18 -#define DC_BSS_ADHOC_CHANNEL_NOT_ALLOWED 19 -#define DC_SET_BEACON_UPDATE 20 -#define DC_BEACON_UPDATE_COMPLETE 21 -#define DC_END_SEARCH_BEACON_UPDATE_COMP_CB 22 -#define DC_BSSINFO_EVENT_DROPPED 23 -#define DC_IEEEPS_ENABLED_BUT_ATIM_ABSENT 24 -#define DC_DBGID_DEFINITION_END - -/* CO debug identifier definitions */ -#define CO_DBGID_DEFINITION_START -#define CO_INIT 1 -#define CO_ACQUIRE_LOCK 2 -#define CO_START_OP1 3 -#define CO_START_OP2 4 -#define CO_DRAIN_TX_COMPLETE_CB 5 -#define CO_CHANGE_CHANNEL_CB 6 -#define CO_RETURN_TO_HOME_CHANNEL 7 -#define CO_FINISH_OP_TIMEOUT 8 -#define CO_OP_END 9 -#define CO_CANCEL_OP 10 -#define CO_CHANGE_CHANNEL 11 -#define CO_RELEASE_LOCK 12 -#define CO_CHANGE_STATE 13 -#define CO_DBGID_DEFINITION_END - -/* RO debug identifier definitions */ -#define RO_DBGID_DEFINITION_START -#define RO_REFRESH_ROAM_TABLE 1 -#define RO_UPDATE_ROAM_CANDIDATE 2 -#define RO_UPDATE_ROAM_CANDIDATE_CB 3 -#define RO_UPDATE_ROAM_CANDIDATE_FINISH 4 -#define RO_REFRESH_ROAM_TABLE_DONE 5 -#define RO_PERIODIC_SEARCH_CB 6 -#define RO_PERIODIC_SEARCH_TIMEOUT 7 -#define RO_INIT 8 -#define RO_BMISS_STATE1 9 -#define RO_BMISS_STATE2 10 -#define RO_SET_PERIODIC_SEARCH_ENABLE 11 -#define RO_SET_PERIODIC_SEARCH_DISABLE 12 -#define RO_ENABLE_SQ_THRESHOLD 13 -#define RO_DISABLE_SQ_THRESHOLD 14 -#define RO_ADD_BSS_TO_ROAM_TABLE 15 -#define RO_SET_PERIODIC_SEARCH_MODE 16 -#define RO_CONFIGURE_SQ_THRESHOLD1 17 -#define RO_CONFIGURE_SQ_THRESHOLD2 18 -#define RO_CONFIGURE_SQ_PARAMS 19 -#define RO_LOW_SIGNAL_QUALITY_EVENT 20 -#define RO_HIGH_SIGNAL_QUALITY_EVENT 21 -#define RO_REMOVE_BSS_FROM_ROAM_TABLE 22 -#define RO_UPDATE_CONNECTION_STATE_METRIC 23 -#define RO_LOWRSSI_SCAN_PARAMS 24 -#define RO_LOWRSSI_SCAN_START 25 -#define RO_LOWRSSI_SCAN_END 26 -#define RO_LOWRSSI_SCAN_CANCEL 27 -#define RO_LOWRSSI_ROAM_CANCEL 28 -#define RO_REFRESH_ROAM_CANDIDATE 29 -#define RO_DBGID_DEFINITION_END - -/* CM debug identifier definitions */ -#define CM_DBGID_DEFINITION_START -#define CM_INITIATE_HANDOFF 1 -#define CM_INITIATE_HANDOFF_CB 2 -#define CM_CONNECT_EVENT 3 -#define CM_DISCONNECT_EVENT 4 -#define CM_INIT 5 -#define CM_HANDOFF_SOURCE 6 -#define CM_SET_HANDOFF_TRIGGERS 7 -#define CM_CONNECT_REQUEST 8 -#define CM_CONNECT_REQUEST_CB 9 -#define CM_CONTINUE_SCAN_CB 10 -#define CM_DBGID_DEFINITION_END - - -/* mgmt debug identifier definitions */ -#define MGMT_DBGID_DEFINITION_START -#define KEYMGMT_CONNECTION_INIT 1 -#define KEYMGMT_CONNECTION_COMPLETE 2 -#define KEYMGMT_CONNECTION_CLOSE 3 -#define KEYMGMT_ADD_KEY 4 -#define MLME_NEW_STATE 5 -#define MLME_CONN_INIT 6 -#define MLME_CONN_COMPLETE 7 -#define MLME_CONN_CLOSE 8 -#define MLME_WLAN_OPMODE 9 -#define MLME_WLAN_SLOTTIME 10 -#define MGMT_DBGID_DEFINITION_END - -/* TMR debug identifier definitions */ -#define TMR_DBGID_DEFINITION_START -#define TMR_HANG_DETECTED 1 -#define TMR_WDT_TRIGGERED 2 -#define TMR_WDT_RESET 3 -#define TMR_HANDLER_ENTRY 4 -#define TMR_HANDLER_EXIT 5 -#define TMR_SAVED_START 6 -#define TMR_SAVED_END 7 -#define TMR_DBGID_DEFINITION_END - -/* BTCOEX debug identifier definitions */ -#define BTCOEX_DBGID_DEFINITION_START -#define BTCOEX_STATUS_CMD 1 -#define BTCOEX_PARAMS_CMD 2 -#define BTCOEX_ANT_CONFIG 3 -#define BTCOEX_COLOCATED_BT_DEVICE 4 -#define BTCOEX_CLOSE_RANGE_SCO_ON 5 -#define BTCOEX_CLOSE_RANGE_SCO_OFF 6 -#define BTCOEX_CLOSE_RANGE_A2DP_ON 7 -#define BTCOEX_CLOSE_RANGE_A2DP_OFF 8 -#define BTCOEX_A2DP_PROTECT_ON 9 -#define BTCOEX_A2DP_PROTECT_OFF 10 -#define BTCOEX_SCO_PROTECT_ON 11 -#define BTCOEX_SCO_PROTECT_OFF 12 -#define BTCOEX_CLOSE_RANGE_DETECTOR_START 13 -#define BTCOEX_CLOSE_RANGE_DETECTOR_STOP 14 -#define BTCOEX_CLOSE_RANGE_TOGGLE 15 -#define BTCOEX_CLOSE_RANGE_TOGGLE_RSSI_LRCNT 16 -#define BTCOEX_CLOSE_RANGE_RSSI_THRESH 17 -#define BTCOEX_CLOSE_RANGE_LOW_RATE_THRESH 18 -#define BTCOEX_PTA_PRI_INTR_HANDLER 19 -#define BTCOEX_PSPOLL_QUEUED 20 -#define BTCOEX_PSPOLL_COMPLETE 21 -#define BTCOEX_DBG_PM_AWAKE 22 -#define BTCOEX_DBG_PM_SLEEP 23 -#define BTCOEX_DBG_SCO_COEX_ON 24 -#define BTCOEX_SCO_DATARECEIVE 25 -#define BTCOEX_INTR_INIT 26 -#define BTCOEX_PTA_PRI_DIFF 27 -#define BTCOEX_TIM_NOTIFICATION 28 -#define BTCOEX_SCO_WAKEUP_ON_DATA 29 -#define BTCOEX_SCO_SLEEP 30 -#define BTCOEX_SET_WEIGHTS 31 -#define BTCOEX_SCO_DATARECEIVE_LATENCY_VAL 32 -#define BTCOEX_SCO_MEASURE_TIME_DIFF 33 -#define BTCOEX_SET_EOL_VAL 34 -#define BTCOEX_OPT_DETECT_HANDLER 35 -#define BTCOEX_SCO_TOGGLE_STATE 36 -#define BTCOEX_SCO_STOMP 37 -#define BTCOEX_NULL_COMP_CALLBACK 38 -#define BTCOEX_RX_INCOMING 39 -#define BTCOEX_RX_INCOMING_CTL 40 -#define BTCOEX_RX_INCOMING_MGMT 41 -#define BTCOEX_RX_INCOMING_DATA 42 -#define BTCOEX_RTS_RECEPTION 43 -#define BTCOEX_FRAME_PRI_LOW_RATE_THRES 44 -#define BTCOEX_PM_FAKE_SLEEP 45 -#define BTCOEX_ACL_COEX_STATUS 46 -#define BTCOEX_ACL_COEX_DETECTION 47 -#define BTCOEX_A2DP_COEX_STATUS 48 -#define BTCOEX_SCO_STATUS 49 -#define BTCOEX_WAKEUP_ON_DATA 50 -#define BTCOEX_DATARECEIVE 51 -#define BTCOEX_GET_MAX_AGGR_SIZE 53 -#define BTCOEX_MAX_AGGR_AVAIL_TIME 54 -#define BTCOEX_DBG_WBTIMER_INTR 55 -#define BTCOEX_DBG_SCO_SYNC 57 -#define BTCOEX_UPLINK_QUEUED_RATE 59 -#define BTCOEX_DBG_UPLINK_ENABLE_EOL 60 -#define BTCOEX_UPLINK_FRAME_DURATION 61 -#define BTCOEX_UPLINK_SET_EOL 62 -#define BTCOEX_DBG_EOL_EXPIRED 63 -#define BTCOEX_DBG_DATA_COMPLETE 64 -#define BTCOEX_UPLINK_QUEUED_TIMESTAMP 65 -#define BTCOEX_DBG_DATA_COMPLETE_TIME 66 -#define BTCOEX_DBG_A2DP_ROLE_IS_SLAVE 67 -#define BTCOEX_DBG_A2DP_ROLE_IS_MASTER 68 -#define BTCOEX_DBG_UPLINK_SEQ_NUM 69 -#define BTCOEX_UPLINK_AGGR_SEQ 70 -#define BTCOEX_DBG_TX_COMP_SEQ_NO 71 -#define BTCOEX_DBG_MAX_AGGR_PAUSE_STATE 72 -#define BTCOEX_DBG_ACL_TRAFFIC 73 -#define BTCOEX_CURR_AGGR_PROP 74 -#define BTCOEX_DBG_SCO_GET_PER_TIME_DIFF 75 -#define BTCOEX_PSPOLL_PROCESS 76 -#define BTCOEX_RETURN_FROM_MAC 77 -#define BTCOEX_FREED_REQUEUED_CNT 78 -#define BTCOEX_DBG_TOGGLE_LOW_RATES 79 -#define BTCOEX_MAC_GOES_TO_SLEEP 80 -#define BTCOEX_DBG_A2DP_NO_SYNC 81 -#define BTCOEX_RETURN_FROM_MAC_HOLD_Q_INFO 82 -#define BTCOEX_RETURN_FROM_MAC_AC 83 -#define BTCOEX_DBG_DTIM_RECV 84 -#define BTCOEX_IS_PRE_UPDATE 86 -#define BTCOEX_ENQUEUED_BIT_MAP 87 -#define BTCOEX_TX_COMPLETE_FIRST_DESC_STATS 88 -#define BTCOEX_UPLINK_DESC 89 -#define BTCOEX_SCO_GET_PER_FIRST_FRM_TIMESTAMP 90 -#define BTCOEX_DBG_RECV_ACK 94 -#define BTCOEX_DBG_ADDBA_INDICATION 95 -#define BTCOEX_TX_COMPLETE_EOL_FAILED 96 -#define BTCOEX_DBG_A2DP_USAGE_COMPLETE 97 -#define BTCOEX_DBG_A2DP_STOMP_FOR_BCN_HANDLER 98 -#define BTCOEX_DBG_A2DP_SYNC_INTR 99 -#define BTCOEX_DBG_A2DP_STOMP_FOR_BCN_RECEPTION 100 -#define BTCOEX_FORM_AGGR_CURR_AGGR 101 -#define BTCOEX_DBG_TOGGLE_A2DP_BURST_CNT 102 -#define BTCOEX_DBG_BT_TRAFFIC 103 -#define BTCOEX_DBG_STOMP_BT_TRAFFIC 104 -#define BTCOEX_RECV_NULL 105 -#define BTCOEX_DBG_A2DP_MASTER_BT_END 106 -#define BTCOEX_DBG_A2DP_BT_START 107 -#define BTCOEX_DBG_A2DP_SLAVE_BT_END 108 -#define BTCOEX_DBG_A2DP_STOMP_BT 109 -#define BTCOEX_DBG_GO_TO_SLEEP 110 -#define BTCOEX_DBG_A2DP_PKT 111 -#define BTCOEX_DBG_A2DP_PSPOLL_DATA_RECV 112 -#define BTCOEX_DBG_A2DP_NULL 113 -#define BTCOEX_DBG_UPLINK_DATA 114 -#define BTCOEX_DBG_A2DP_STOMP_LOW_PRIO_NULL 115 -#define BTCOEX_DBG_ADD_BA_RESP_TIMEOUT 116 -#define BTCOEX_DBG_TXQ_STATE 117 -#define BTCOEX_DBG_ALLOW_SCAN 118 -#define BTCOEX_DBG_SCAN_REQUEST 119 -#define BTCOEX_A2DP_SLEEP 127 -#define BTCOEX_DBG_DATA_ACTIV_TIMEOUT 128 -#define BTCOEX_DBG_SWITCH_TO_PSPOLL_ON_MODE 129 -#define BTCOEX_DBG_SWITCH_TO_PSPOLL_OFF_MODE 130 -#define BTCOEX_DATARECEIVE_AGGR 131 -#define BTCOEX_DBG_DATA_RECV_SLEEPING_PENDING 132 -#define BTCOEX_DBG_DATARESP_TIMEOUT 133 -#define BTCOEX_BDG_BMISS 134 -#define BTCOEX_DBG_DATA_RECV_WAKEUP_TIM 135 -#define BTCOEX_DBG_SECOND_BMISS 136 -#define BTCOEX_DBG_SET_WLAN_STATE 138 -#define BTCOEX_BDG_FIRST_BMISS 139 -#define BTCOEX_DBG_A2DP_CHAN_OP 140 -#define BTCOEX_DBG_A2DP_INTR 141 -#define BTCOEX_DBG_BT_INQUIRY 142 -#define BTCOEX_DBG_BT_INQUIRY_DATA_FETCH 143 -#define BTCOEX_DBG_POST_INQUIRY_FINISH 144 -#define BTCOEX_DBG_SCO_OPT_MODE_TIMER_HANDLER 145 -#define BTCOEX_DBG_NULL_FRAME_SLEEP 146 -#define BTCOEX_DBG_NULL_FRAME_AWAKE 147 -#define BTCOEX_DBG_SET_AGGR_SIZE 152 -#define BTCOEX_DBG_TEAR_BA_TIMEOUT 153 -#define BTCOEX_DBG_MGMT_FRAME_SEQ_NO 154 -#define BTCOEX_DBG_SCO_STOMP_HIGH_PRI 155 -#define BTCOEX_DBG_COLOCATED_BT_DEV 156 -#define BTCOEX_DBG_FE_ANT_TYPE 157 -#define BTCOEX_DBG_BT_INQUIRY_CMD 158 -#define BTCOEX_DBG_SCO_CONFIG 159 -#define BTCOEX_DBG_SCO_PSPOLL_CONFIG 160 -#define BTCOEX_DBG_SCO_OPTMODE_CONFIG 161 -#define BTCOEX_DBG_A2DP_CONFIG 162 -#define BTCOEX_DBG_A2DP_PSPOLL_CONFIG 163 -#define BTCOEX_DBG_A2DP_OPTMODE_CONFIG 164 -#define BTCOEX_DBG_ACLCOEX_CONFIG 165 -#define BTCOEX_DBG_ACLCOEX_PSPOLL_CONFIG 166 -#define BTCOEX_DBG_ACLCOEX_OPTMODE_CONFIG 167 -#define BTCOEX_DBG_DEBUG_CMD 168 -#define BTCOEX_DBG_SET_BT_OPERATING_STATUS 169 -#define BTCOEX_DBG_GET_CONFIG 170 -#define BTCOEX_DBG_GET_STATS 171 -#define BTCOEX_DBG_BT_OPERATING_STATUS 172 -#define BTCOEX_DBG_PERFORM_RECONNECT 173 -#define BTCOEX_DBG_ACL_WLAN_MED 175 -#define BTCOEX_DBG_ACL_BT_MED 176 -#define BTCOEX_DBG_WLAN_CONNECT 177 -#define BTCOEX_DBG_A2DP_DUAL_START 178 -#define BTCOEX_DBG_PMAWAKE_NOTIFY 179 -#define BTCOEX_DBG_BEACON_SCAN_ENABLE 180 -#define BTCOEX_DBG_BEACON_SCAN_DISABLE 181 -#define BTCOEX_DBG_RX_NOTIFY 182 -#define BTCOEX_SCO_GET_PER_SECOND_FRM_TIMESTAMP 183 -#define BTCOEX_DBG_TXQ_DETAILS 184 -#define BTCOEX_DBG_SCO_STOMP_LOW_PRI 185 -#define BTCOEX_DBG_A2DP_FORCE_SCAN 186 -#define BTCOEX_DBG_DTIM_STOMP_COMP 187 -#define BTCOEX_ACL_PRESENCE_TIMER 188 -#define BTCOEX_DBG_QUEUE_SELF_CTS 189 -#define BTCOEX_DBG_SELF_CTS_COMP 190 -#define BTCOEX_DBG_APMODE_WAIT_FOR_CTS_COMP_FAILED 191 -#define BTCOEX_DBG_APMODE_A2DP_MED_TO_BT 192 -#define BTCOEX_DBG_APMODE_SET_BTSTATE 193 -#define BTCOEX_DBG_APMODE_A2DP_STATUS 194 -#define BTCOEX_DBG_APMODE_SCO_CTS_HANDLER 195 -#define BTCOEX_DBG_APMODE_SCO_STATUS 196 -#define BTCOEX_DBG_APMODE_TXQ_DRAINED 197 -#define BTCOEX_DBG_APMODE_SCO_ARM_TIMER 198 -#define BTCOEX_DBG_APMODE_SWITCH_MED_TO_WLAN 199 -#define BTCOEX_APMODE_BCN_TX_HANDLER 200 -#define BTCOEX_APMODE_BCN_TX 201 -#define BTCOEX_APMODE_SCO_RTS_HANDLER 202 -#define BTCOEX_DBGID_DEFINITION_END - -#ifdef __cplusplus -} -#endif - -#endif /* _DBGLOG_ID_H_ */ diff --git a/drivers/net/wireless/ar6003/include/dfs_common.h b/drivers/net/wireless/ar6003/include/dfs_common.h deleted file mode 100644 index cf1844fbb2c6..000000000000 --- a/drivers/net/wireless/ar6003/include/dfs_common.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2005-2006 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -#ifndef _DFS_COMMON_H_ -#define _DFS_COMMON_H_ - -enum { - DFS_UNINIT_DOMAIN = 0, /* Uninitialized dfs domain */ - DFS_FCC_DOMAIN = 1, /* FCC3 dfs domain */ - DFS_ETSI_DOMAIN = 2, /* ETSI dfs domain */ - DFS_MKK4_DOMAIN = 3 /* Japan dfs domain */ -}; - - - -#define MAX_BIN5_DUR 131 /* 105 * 1.25*/ - -PREPACK struct ath_dfs_capinfo { - A_UINT64 ext_chan_busy_ts; - A_UINT8 enable_ar; - A_UINT8 enable_radar; -} POSTPACK; - -typedef struct ath_dfs_capinfo WMI_DFS_HOST_ATTACH_EVENT; - -PREPACK struct ath_dfs_info { - A_UINT32 dfs_domain; -} POSTPACK; - -typedef struct ath_dfs_info WMI_DFS_HOST_INIT_EVENT; - - -PREPACK struct dfs_event_info { - A_UINT64 full_ts; /* 64-bit full timestamp from interrupt time */ - A_UINT32 ts; /* Original 15 bit recv timestamp */ - A_UINT32 ext_chan_busy; /* Ext chan busy % */ - A_UINT8 rssi; /* rssi of radar event */ - A_UINT8 dur; /* duration of radar pulse */ - A_UINT8 chanindex; /* Channel of event */ - A_UINT8 flags; -#define CH_TYPE_MASK 1 -#define PRIMARY_CH 0 -#define EXT_CH 1 -#define EVENT_TYPE_MASK 2 -#define AR_EVENT 0 -#define DFS_EVENT 2 -} POSTPACK; - -/* XXX: Replace 256 with WMI_SVC_MAX_BUFFERED_EVENT_SIZE */ -#define WMI_DFS_EVENT_MAX_BUFFER_SIZE ((256 - 1)/sizeof(struct dfs_event_info)) -/* Fill in event info */ -PREPACK struct dfs_ev_buffer { - A_UINT8 num_events; - struct dfs_event_info ev_info[WMI_DFS_EVENT_MAX_BUFFER_SIZE]; -} POSTPACK; - -typedef struct dfs_ev_buffer WMI_DFS_PHYERR_EVENT; - - - /* This should match the table from if_ath.c */ -enum { - ATH_DEBUG_DFS = 0x00000100, /* Minimal DFS debug */ - ATH_DEBUG_DFS1 = 0x00000200, /* Normal DFS debug */ - ATH_DEBUG_DFS2 = 0x00000400, /* Maximal DFS debug */ - ATH_DEBUG_DFS3 = 0x00000800, /* matched filterID display */ -}; - -#define TRAFFIC_DETECTED 1 - -#endif /* _DFS_H_ */ diff --git a/drivers/net/wireless/ar6003/include/discovery.h b/drivers/net/wireless/ar6003/include/discovery.h deleted file mode 100644 index e81d707cf830..000000000000 --- a/drivers/net/wireless/ar6003/include/discovery.h +++ /dev/null @@ -1,77 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef _DISCOVERY_H_ -#define _DISCOVERY_H_ - -/* - * DC_SCAN_PRIORITY is an 8-bit bitmap of the scan priority of a channel - */ -typedef enum { - DEFAULT_SCPRI = 0x01, - POPULAR_SCPRI = 0x02, - SSIDS_SCPRI = 0x04, - PROF_SCPRI = 0x08, - DISABLE_SCPRI = 0x10, -} DC_SCAN_PRIORITY; - -/* The following search type construct can be used to manipulate the behavior of the search module based on different bits set */ -typedef enum { - SCAN_RESET = 0, - SCAN_ALL = (DEFAULT_SCPRI | POPULAR_SCPRI | \ - SSIDS_SCPRI | PROF_SCPRI), - - SCAN_POPULAR = (POPULAR_SCPRI | SSIDS_SCPRI | PROF_SCPRI), - SCAN_SSIDS = (SSIDS_SCPRI | PROF_SCPRI), - SCAN_PROF_MASK = (PROF_SCPRI), - SCAN_MULTI_CHANNEL = 0x000100, - SCAN_DETERMINISTIC = 0x000200, - SCAN_PROFILE_MATCH_TERMINATED = 0x000400, - SCAN_HOME_CHANNEL_SKIP = 0x000800, - SCAN_CHANNEL_LIST_CONTINUE = 0x001000, - SCAN_CURRENT_SSID_SKIP = 0x002000, - SCAN_ACTIVE_PROBE_DISABLE = 0x004000, - SCAN_CHANNEL_HINT_ONLY = 0x008000, - SCAN_ACTIVE_CHANNELS_ONLY = 0x010000, - SCAN_UNUSED1 = 0x020000, /* unused */ - SCAN_PERIODIC = 0x040000, - SCAN_FIXED_DURATION = 0x080000, - SCAN_AP_ASSISTED = 0x100000, - SCAN_DONOT_RETURN_TO_HOME_AFTERSCAN = 0x200000, -} DC_SCAN_TYPE; - -typedef enum { - BSS_REPORTING_DEFAULT = 0x0, - EXCLUDE_NON_SCAN_RESULTS = 0x1, /* Exclude results outside of scan */ -} DC_BSS_REPORTING_POLICY; - -typedef enum { - DC_IGNORE_WPAx_GROUP_CIPHER = 0x01, - DC_PROFILE_MATCH_DONE = 0x02, - DC_IGNORE_AAC_BEACON = 0x04, - DC_CSA_FOLLOW_BSS = 0x08, -} DC_PROFILE_FILTER; - -#define DEFAULT_DC_PROFILE_FILTER (DC_CSA_FOLLOW_BSS) - -#endif /* _DISCOVERY_H_ */ diff --git a/drivers/net/wireless/ar6003/include/dset_internal.h b/drivers/net/wireless/ar6003/include/dset_internal.h deleted file mode 100644 index 2460f0ecf12b..000000000000 --- a/drivers/net/wireless/ar6003/include/dset_internal.h +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - - -#ifndef __DSET_INTERNAL_H__ -#define __DSET_INTERNAL_H__ - -#ifndef ATH_TARGET -#include "athstartpack.h" -#endif - -/* - * Internal dset definitions, common for DataSet layer. - */ - -#define DSET_TYPE_STANDARD 0 -#define DSET_TYPE_BPATCHED 1 -#define DSET_TYPE_COMPRESSED 2 - -/* Dataset descriptor */ - -typedef PREPACK struct dset_descriptor_s { - struct dset_descriptor_s *next; /* List link. NULL only at the last - descriptor */ - A_UINT16 id; /* Dset ID */ - A_UINT16 size; /* Dset size. */ - void *DataPtr; /* Pointer to raw data for standard - DataSet or pointer to original - dset_descriptor for patched - DataSet */ - A_UINT32 data_type; /* DSET_TYPE_*, above */ - - void *AuxPtr; /* Additional data that might - needed for data_type. For - example, pointer to patch - Dataset descriptor for BPatch. */ -} POSTPACK dset_descriptor_t; - -#ifndef ATH_TARGET -#include "athendpack.h" -#endif - -#endif /* __DSET_INTERNAL_H__ */ diff --git a/drivers/net/wireless/ar6003/include/dsetid.h b/drivers/net/wireless/ar6003/include/dsetid.h deleted file mode 100644 index d08fdeb39ec3..000000000000 --- a/drivers/net/wireless/ar6003/include/dsetid.h +++ /dev/null @@ -1,134 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - - -#ifndef __DSETID_H__ -#define __DSETID_H__ - -#ifndef ATH_TARGET -#include "athstartpack.h" -#endif - -/* Well-known DataSet IDs */ -#define DSETID_UNUSED 0x00000000 -#define DSETID_BOARD_DATA 0x00000001 /* Cal and board data */ -#define DSETID_REGDB 0x00000002 /* Regulatory Database */ -#define DSETID_POWER_CONTROL 0x00000003 /* TX Pwr Lim & Ant Gain */ -#define DSETID_USER_CONFIG 0x00000004 /* User Configuration */ - -#define DSETID_ANALOG_CONTROL_DATA_START 0x00000005 -#define DSETID_ANALOG_CONTROL_DATA_END 0x00000025 -/* - * Get DSETID for various reference clock speeds. - * For each speed there are three DataSets that correspond - * to the three columns of bank6 data (addr, 11a, 11b/g). - * This macro returns the dsetid of the first of those - * three DataSets. - */ -#define ANALOG_CONTROL_DATA_DSETID(refclk) \ - (DSETID_ANALOG_CONTROL_DATA_START + 3*refclk) - -/* - * There are TWO STARTUP_PATCH DataSets. - * DSETID_STARTUP_PATCH is historical, and was applied before BMI on - * earlier systems. On AR6002, it is applied after BMI, just like - * DSETID_STARTUP_PATCH2. - */ -#define DSETID_STARTUP_PATCH 0x00000026 -#define DSETID_GPIO_CONFIG_PATCH 0x00000027 -#define DSETID_WLANREGS 0x00000028 /* override wlan regs */ -#define DSETID_STARTUP_PATCH2 0x00000029 - -#define DSETID_WOW_CONFIG 0x00000090 /* WoW Configuration */ - -/* Add WHAL_INI_DATA_ID to DSETID_INI_DATA for a specific WHAL INI table. */ -#define DSETID_INI_DATA 0x00000100 -/* Reserved for WHAL INI Tables: 0x100..0x11f */ -#define DSETID_INI_DATA_END 0x0000011f - -#define DSETID_VENDOR_START 0x00010000 /* Vendor-defined DataSets */ - -#define DSETID_INDEX_END 0xfffffffe /* Reserved to indicate the - end of a memory-based - DataSet Index */ -#define DSETID_INDEX_FREE 0xffffffff /* An unused index entry */ - -/* - * PATCH DataSet format: - * A list of patches, terminated by a patch with - * address=PATCH_END. - * - * This allows for patches to be stored in flash. - */ -PREPACK struct patch_s { - A_UINT32 *address; - A_UINT32 data; -} POSTPACK ; - -/* - * Skip some patches. Can be used to erase a single patch in a - * patch DataSet without having to re-write the DataSet. May - * also be used to embed information for use by subsequent - * patch code. The "data" in a PATCH_SKIP tells how many - * bytes of length "patch_s" to skip. - */ -#define PATCH_SKIP ((A_UINT32 *)0x00000000) - -/* - * Execute code at the address specified by "data". - * The address of the patch structure is passed as - * the one parameter. - */ -#define PATCH_CODE_ABS ((A_UINT32 *)0x00000001) - -/* - * Same as PATCH_CODE_ABS, but treat "data" as an - * offset from the start of the patch word. - */ -#define PATCH_CODE_REL ((A_UINT32 *)0x00000002) - -/* Mark the end of this patch DataSet. */ -#define PATCH_END ((A_UINT32 *)0xffffffff) - -/* - * A DataSet which contains a Binary Patch to some other DataSet - * uses the original dsetid with the DSETID_BPATCH_FLAG bit set. - * Such a BPatch DataSet consists of BPatch metadata followed by - * the bdiff bytes. BPatch metadata consists of a single 32-bit - * word that contains the size of the BPatched final image. - * - * To create a suitable bdiff DataSet, use bdiff in host/tools/bdiff - * to create "diffs": - * bdiff -q -O -nooldmd5 -nonewmd5 -d ORIGfile NEWfile diffs - * Then add BPatch metadata to the start of "diffs". - * - * NB: There are some implementation-induced restrictions - * on which DataSets can be BPatched. - */ -#define DSETID_BPATCH_FLAG 0x80000000 - -#ifndef ATH_TARGET -#include "athendpack.h" -#endif - -#endif /* __DSETID_H__ */ diff --git a/drivers/net/wireless/ar6003/include/epping_test.h b/drivers/net/wireless/ar6003/include/epping_test.h deleted file mode 100644 index f8aeb3f657ea..000000000000 --- a/drivers/net/wireless/ar6003/include/epping_test.h +++ /dev/null @@ -1,120 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2009-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -// - -/* This file contains shared definitions for the host/target endpoint ping test */ - -#ifndef EPPING_TEST_H_ -#define EPPING_TEST_H_ - -#ifndef ATH_TARGET -#include "athstartpack.h" -#endif - - /* alignment to 4-bytes */ -#define EPPING_ALIGNMENT_PAD (((sizeof(HTC_FRAME_HDR) + 3) & (~0x3)) - sizeof(HTC_FRAME_HDR)) - -#ifndef A_OFFSETOF -#define A_OFFSETOF(type,field) (int)(&(((type *)NULL)->field)) -#endif - -#define EPPING_RSVD_FILL 0xCC - -#define HCI_RSVD_EXPECTED_PKT_TYPE_RECV_OFFSET 7 - -typedef PREPACK struct { - A_UINT8 _HCIRsvd[8]; /* reserved for HCI packet header (GMBOX) testing */ - A_UINT8 StreamEcho_h; /* stream no. to echo this packet on (filled by host) */ - A_UINT8 StreamEchoSent_t; /* stream no. packet was echoed to (filled by target) - When echoed: StreamEchoSent_t == StreamEcho_h */ - A_UINT8 StreamRecv_t; /* stream no. that target received this packet on (filled by target) */ - A_UINT8 StreamNo_h; /* stream number to send on (filled by host) */ - A_UINT8 Magic_h[4]; /* magic number to filter for this packet on the host*/ - A_UINT8 _rsvd[6]; /* reserved fields that must be set to a "reserved" value - since this packet maps to a 14-byte ethernet frame we want - to make sure ethertype field is set to something unknown */ - - A_UINT8 _pad[2]; /* padding for alignment */ - A_UINT8 TimeStamp[8]; /* timestamp of packet (host or target) */ - A_UINT32 HostContext_h; /* 4 byte host context, target echos this back */ - A_UINT32 SeqNo; /* sequence number (set by host or target) */ - A_UINT16 Cmd_h; /* ping command (filled by host) */ - A_UINT16 CmdFlags_h; /* optional flags */ - A_UINT8 CmdBuffer_h[8]; /* buffer for command (host -> target) */ - A_UINT8 CmdBuffer_t[8]; /* buffer for command (target -> host) */ - A_UINT16 DataLength; /* length of data */ - A_UINT16 DataCRC; /* 16 bit CRC of data */ - A_UINT16 HeaderCRC; /* header CRC (fields : StreamNo_h to end, minus HeaderCRC) */ -} POSTPACK EPPING_HEADER; - -#define EPPING_PING_MAGIC_0 0xAA -#define EPPING_PING_MAGIC_1 0x55 -#define EPPING_PING_MAGIC_2 0xCE -#define EPPING_PING_MAGIC_3 0xEC - - - -#define IS_EPPING_PACKET(pPkt) (((pPkt)->Magic_h[0] == EPPING_PING_MAGIC_0) && \ - ((pPkt)->Magic_h[1] == EPPING_PING_MAGIC_1) && \ - ((pPkt)->Magic_h[2] == EPPING_PING_MAGIC_2) && \ - ((pPkt)->Magic_h[3] == EPPING_PING_MAGIC_3)) - -#define SET_EPPING_PACKET_MAGIC(pPkt) { (pPkt)->Magic_h[0] = EPPING_PING_MAGIC_0; \ - (pPkt)->Magic_h[1] = EPPING_PING_MAGIC_1; \ - (pPkt)->Magic_h[2] = EPPING_PING_MAGIC_2; \ - (pPkt)->Magic_h[3] = EPPING_PING_MAGIC_3;} - -#define CMD_FLAGS_DATA_CRC (1 << 0) /* DataCRC field is valid */ -#define CMD_FLAGS_DELAY_ECHO (1 << 1) /* delay the echo of the packet */ -#define CMD_FLAGS_NO_DROP (1 << 2) /* do not drop at HTC layer no matter what the stream is */ - -#define IS_EPING_PACKET_NO_DROP(pPkt) ((pPkt)->CmdFlags_h & CMD_FLAGS_NO_DROP) - -#define EPPING_CMD_ECHO_PACKET 1 /* echo packet test */ -#define EPPING_CMD_RESET_RECV_CNT 2 /* reset recv count */ -#define EPPING_CMD_CAPTURE_RECV_CNT 3 /* fetch recv count, 4-byte count returned in CmdBuffer_t */ -#define EPPING_CMD_NO_ECHO 4 /* non-echo packet test (tx-only) */ -#define EPPING_CMD_CONT_RX_START 5 /* continous RX packets, parameters are in CmdBuffer_h */ -#define EPPING_CMD_CONT_RX_STOP 6 /* stop continuous RX packet transmission */ - - /* test command parameters may be no more than 8 bytes */ -typedef PREPACK struct { - A_UINT16 BurstCnt; /* number of packets to burst together (for HTC 2.1 testing) */ - A_UINT16 PacketLength; /* length of packet to generate including header */ - A_UINT16 Flags; /* flags */ - -#define EPPING_CONT_RX_DATA_CRC (1 << 0) /* Add CRC to all data */ -#define EPPING_CONT_RX_RANDOM_DATA (1 << 1) /* randomize the data pattern */ -#define EPPING_CONT_RX_RANDOM_LEN (1 << 2) /* randomize the packet lengths */ -} POSTPACK EPPING_CONT_RX_PARAMS; - -#define EPPING_HDR_CRC_OFFSET A_OFFSETOF(EPPING_HEADER,StreamNo_h) -#define EPPING_HDR_BYTES_CRC (sizeof(EPPING_HEADER) - EPPING_HDR_CRC_OFFSET - (sizeof(A_UINT16))) - -#define HCI_TRANSPORT_STREAM_NUM 16 /* this number is higher than the define WMM AC classes so we - can use this to distinguish packets */ - -#ifndef ATH_TARGET -#include "athendpack.h" -#endif - - -#endif /*EPPING_TEST_H_*/ diff --git a/drivers/net/wireless/ar6003/include/gmboxif.h b/drivers/net/wireless/ar6003/include/gmboxif.h deleted file mode 100644 index ac251b6bef7a..000000000000 --- a/drivers/net/wireless/ar6003/include/gmboxif.h +++ /dev/null @@ -1,83 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2009-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef __GMBOXIF_H__ -#define __GMBOXIF_H__ - -#ifndef ATH_TARGET -#include "athstartpack.h" -#endif - -/* GMBOX interface definitions */ - -#define AR6K_GMBOX_CREDIT_COUNTER 1 /* we use credit counter 1 to track credits */ -#define AR6K_GMBOX_CREDIT_SIZE_COUNTER 2 /* credit counter 2 is used to pass the size of each credit */ - - - /* HCI UART transport definitions when used over GMBOX interface */ -#define HCI_UART_COMMAND_PKT 0x01 -#define HCI_UART_ACL_PKT 0x02 -#define HCI_UART_SCO_PKT 0x03 -#define HCI_UART_EVENT_PKT 0x04 - - /* definitions for BT HCI packets */ -typedef PREPACK struct { - A_UINT16 Flags_ConnHandle; - A_UINT16 Length; -} POSTPACK BT_HCI_ACL_HEADER; - -typedef PREPACK struct { - A_UINT16 Flags_ConnHandle; - A_UINT8 Length; -} POSTPACK BT_HCI_SCO_HEADER; - -typedef PREPACK struct { - A_UINT16 OpCode; - A_UINT8 ParamLength; -} POSTPACK BT_HCI_COMMAND_HEADER; - -typedef PREPACK struct { - A_UINT8 EventCode; - A_UINT8 ParamLength; -} POSTPACK BT_HCI_EVENT_HEADER; - -/* MBOX host interrupt signal assignments */ - -#define MBOX_SIG_HCI_BRIDGE_MAX 8 -#define MBOX_SIG_HCI_BRIDGE_BT_ON 0 -#define MBOX_SIG_HCI_BRIDGE_BT_OFF 1 -#define MBOX_SIG_HCI_BRIDGE_BAUD_SET 2 -#define MBOX_SIG_HCI_BRIDGE_PWR_SAV_ON 3 -#define MBOX_SIG_HCI_BRIDGE_PWR_SAV_OFF 4 - -/* Host interrupts target to change baud rate and - * baud rate info is stored in scratch registers 4 and 5 - */ -#define LSB_SCRATCH_IDX 4 -#define MSB_SCRATCH_IDX 5 - -#ifndef ATH_TARGET -#include "athendpack.h" -#endif - -#endif /* __GMBOXIF_H__ */ - diff --git a/drivers/net/wireless/ar6003/include/gpio.h b/drivers/net/wireless/ar6003/include/gpio.h deleted file mode 100644 index 0334f2c3319a..000000000000 --- a/drivers/net/wireless/ar6003/include/gpio.h +++ /dev/null @@ -1,51 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2005-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#define AR6001_GPIO_PIN_COUNT 18 -#define AR6002_GPIO_PIN_COUNT 18 -#define AR6003_GPIO_PIN_COUNT 28 -#define MCKINLEY_GPIO_PIN_COUNT 57 - -/* - * Values of gpioreg_id in the WMIX_GPIO_REGISTER_SET_CMDID and WMIX_GPIO_REGISTER_GET_CMDID - * commands come in two flavors. If the upper bit of gpioreg_id is CLEAR, then the - * remainder is interpreted as one of these values. This provides platform-independent - * access to GPIO registers. If the upper bit (GPIO_ID_OFFSET_FLAG) of gpioreg_id is SET, - * then the remainder is interpreted as a platform-specific GPIO register offset. - */ -#define GPIO_ID_OUT 0x00000000 -#define GPIO_ID_OUT_W1TS 0x00000001 -#define GPIO_ID_OUT_W1TC 0x00000002 -#define GPIO_ID_ENABLE 0x00000003 -#define GPIO_ID_ENABLE_W1TS 0x00000004 -#define GPIO_ID_ENABLE_W1TC 0x00000005 -#define GPIO_ID_IN 0x00000006 -#define GPIO_ID_STATUS 0x00000007 -#define GPIO_ID_STATUS_W1TS 0x00000008 -#define GPIO_ID_STATUS_W1TC 0x00000009 -#define GPIO_ID_PIN0 0x0000000a -#define GPIO_ID_PIN(n) (GPIO_ID_PIN0+(n)) -#define GPIO_ID_NONE 0xffffffff - -#define GPIO_ID_OFFSET_FLAG 0x80000000 -#define GPIO_ID_REG_MASK 0x7fffffff -#define GPIO_ID_IS_OFFSET(reg_id) (((reg_id) & GPIO_ID_OFFSET_FLAG) != 0) diff --git a/drivers/net/wireless/ar6003/include/host_proxy_iface.h b/drivers/net/wireless/ar6003/include/host_proxy_iface.h deleted file mode 100644 index 7f0f3fd92ff1..000000000000 --- a/drivers/net/wireless/ar6003/include/host_proxy_iface.h +++ /dev/null @@ -1,45 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2011 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -/* - * This file contains the definitions of the host_proxy interface. - */ - -#ifndef _HOST_PROXY_IFACE_H_ -#define _HOST_PROXY_IFACE_H_ - -/* Host proxy initializes shared memory with HOST_PROXY_INIT to - * indicate that it is ready to receive instruction */ -#define HOST_PROXY_INIT (1) -/* Host writes HOST_PROXY_NORMAL_BOOT to shared memory to - * indicate to host proxy that it should proceed to boot - * normally (bypassing BMI). - */ -#define HOST_PROXY_NORMAL_BOOT (2) -/* Host writes HOST_PROXY_BMI_BOOT to shared memory to - * indicate to host proxy that is should enable BMI and - * exit. This allows a host to reprogram the on board - * flash. - */ -#define HOST_PROXY_BMI_BOOT (3) - -#endif /* _HOST_PROXY_IFACE_H_ */ diff --git a/drivers/net/wireless/ar6003/include/htc.h b/drivers/net/wireless/ar6003/include/htc.h deleted file mode 100644 index a86cdaeb5fa1..000000000000 --- a/drivers/net/wireless/ar6003/include/htc.h +++ /dev/null @@ -1,238 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef __HTC_H__ -#define __HTC_H__ - -#ifndef ATH_TARGET -#include "athstartpack.h" -#endif - -#ifndef A_OFFSETOF -#define A_OFFSETOF(type,field) (unsigned long)(&(((type *)NULL)->field)) -#endif - -#define ASSEMBLE_UNALIGNED_UINT16(p,highbyte,lowbyte) \ - (((A_UINT16)(((A_UINT8 *)(p))[(highbyte)])) << 8 | (A_UINT16)(((A_UINT8 *)(p))[(lowbyte)])) - -/* alignment independent macros (little-endian) to fetch UINT16s or UINT8s from a - * structure using only the type and field name. - * Use these macros if there is the potential for unaligned buffer accesses. */ -#define A_GET_UINT16_FIELD(p,type,field) \ - ASSEMBLE_UNALIGNED_UINT16(p,\ - A_OFFSETOF(type,field) + 1, \ - A_OFFSETOF(type,field)) - -#define A_SET_UINT16_FIELD(p,type,field,value) \ -{ \ - ((A_UINT8 *)(p))[A_OFFSETOF(type,field)] = (A_UINT8)(value); \ - ((A_UINT8 *)(p))[A_OFFSETOF(type,field) + 1] = (A_UINT8)((value) >> 8); \ -} - -#define A_GET_UINT8_FIELD(p,type,field) \ - ((A_UINT8 *)(p))[A_OFFSETOF(type,field)] - -#define A_SET_UINT8_FIELD(p,type,field,value) \ - ((A_UINT8 *)(p))[A_OFFSETOF(type,field)] = (value) - -/****** DANGER DANGER *************** - * - * The frame header length and message formats defined herein were - * selected to accommodate optimal alignment for target processing. This reduces code - * size and improves performance. - * - * Any changes to the header length may alter the alignment and cause exceptions - * on the target. When adding to the message structures insure that fields are - * properly aligned. - * - */ - -/* HTC frame header */ -typedef PREPACK struct _HTC_FRAME_HDR{ - /* do not remove or re-arrange these fields, these are minimally required - * to take advantage of 4-byte lookaheads in some hardware implementations */ - A_UINT8 EndpointID; - A_UINT8 Flags; - A_UINT16 PayloadLen; /* length of data (including trailer) that follows the header */ - - /***** end of 4-byte lookahead ****/ - - A_UINT8 ControlBytes[2]; - - /* message payload starts after the header */ - -} POSTPACK HTC_FRAME_HDR; - -/* frame header flags */ - - /* send direction */ -#define HTC_FLAGS_NEED_CREDIT_UPDATE (1 << 0) -#define HTC_FLAGS_SEND_BUNDLE (1 << 1) /* start or part of bundle */ - /* receive direction */ -#define HTC_FLAGS_RECV_UNUSED_0 (1 << 0) /* bit 0 unused */ -#define HTC_FLAGS_RECV_TRAILER (1 << 1) /* bit 1 trailer data present */ -#define HTC_FLAGS_RECV_UNUSED_2 (1 << 0) /* bit 2 unused */ -#define HTC_FLAGS_RECV_UNUSED_3 (1 << 0) /* bit 3 unused */ -#define HTC_FLAGS_RECV_BUNDLE_CNT_MASK (0xF0) /* bits 7..4 */ -#define HTC_FLAGS_RECV_BUNDLE_CNT_SHIFT 4 - -#define HTC_HDR_LENGTH (sizeof(HTC_FRAME_HDR)) -#define HTC_MAX_TRAILER_LENGTH 255 -#define HTC_MAX_PAYLOAD_LENGTH (4096 - sizeof(HTC_FRAME_HDR)) - -/* HTC control message IDs */ - -#define HTC_MSG_READY_ID 1 -#define HTC_MSG_CONNECT_SERVICE_ID 2 -#define HTC_MSG_CONNECT_SERVICE_RESPONSE_ID 3 -#define HTC_MSG_SETUP_COMPLETE_ID 4 -#define HTC_MSG_SETUP_COMPLETE_EX_ID 5 - -#define HTC_MAX_CONTROL_MESSAGE_LENGTH 256 - -/* base message ID header */ -typedef PREPACK struct { - A_UINT16 MessageID; -} POSTPACK HTC_UNKNOWN_MSG; - -/* HTC ready message - * direction : target-to-host */ -typedef PREPACK struct { - A_UINT16 MessageID; /* ID */ - A_UINT16 CreditCount; /* number of credits the target can offer */ - A_UINT16 CreditSize; /* size of each credit */ - A_UINT8 MaxEndpoints; /* maximum number of endpoints the target has resources for */ - A_UINT8 _Pad1; -} POSTPACK HTC_READY_MSG; - - /* extended HTC ready message */ -typedef PREPACK struct { - HTC_READY_MSG Version2_0_Info; /* legacy version 2.0 information at the front... */ - /* extended information */ - A_UINT8 HTCVersion; - A_UINT8 MaxMsgsPerHTCBundle; -} POSTPACK HTC_READY_EX_MSG; - -#define HTC_VERSION_2P0 0x00 -#define HTC_VERSION_2P1 0x01 /* HTC 2.1 */ - -#define HTC_SERVICE_META_DATA_MAX_LENGTH 128 - -/* connect service - * direction : host-to-target */ -typedef PREPACK struct { - A_UINT16 MessageID; - A_UINT16 ServiceID; /* service ID of the service to connect to */ - A_UINT16 ConnectionFlags; /* connection flags */ - -#define HTC_CONNECT_FLAGS_REDUCE_CREDIT_DRIBBLE (1 << 2) /* reduce credit dribbling when - the host needs credits */ -#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_MASK (0x3) -#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_FOURTH 0x0 -#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_HALF 0x1 -#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_THREE_FOURTHS 0x2 -#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_UNITY 0x3 - - A_UINT8 ServiceMetaLength; /* length of meta data that follows */ - A_UINT8 _Pad1; - - /* service-specific meta data starts after the header */ - -} POSTPACK HTC_CONNECT_SERVICE_MSG; - -/* connect response - * direction : target-to-host */ -typedef PREPACK struct { - A_UINT16 MessageID; - A_UINT16 ServiceID; /* service ID that the connection request was made */ - A_UINT8 Status; /* service connection status */ - A_UINT8 EndpointID; /* assigned endpoint ID */ - A_UINT16 MaxMsgSize; /* maximum expected message size on this endpoint */ - A_UINT8 ServiceMetaLength; /* length of meta data that follows */ - A_UINT8 _Pad1; - - /* service-specific meta data starts after the header */ - -} POSTPACK HTC_CONNECT_SERVICE_RESPONSE_MSG; - -typedef PREPACK struct { - A_UINT16 MessageID; - /* currently, no other fields */ -} POSTPACK HTC_SETUP_COMPLETE_MSG; - - /* extended setup completion message */ -typedef PREPACK struct { - A_UINT16 MessageID; - A_UINT32 SetupFlags; - A_UINT8 MaxMsgsPerBundledRecv; - A_UINT8 Rsvd[3]; -} POSTPACK HTC_SETUP_COMPLETE_EX_MSG; - -#define HTC_SETUP_COMPLETE_FLAGS_ENABLE_BUNDLE_RECV (1 << 0) - -/* connect response status codes */ -#define HTC_SERVICE_SUCCESS 0 /* success */ -#define HTC_SERVICE_NOT_FOUND 1 /* service could not be found */ -#define HTC_SERVICE_FAILED 2 /* specific service failed the connect */ -#define HTC_SERVICE_NO_RESOURCES 3 /* no resources (i.e. no more endpoints) */ -#define HTC_SERVICE_NO_MORE_EP 4 /* specific service is not allowing any more - endpoints */ - -/* report record IDs */ - -#define HTC_RECORD_NULL 0 -#define HTC_RECORD_CREDITS 1 -#define HTC_RECORD_LOOKAHEAD 2 -#define HTC_RECORD_LOOKAHEAD_BUNDLE 3 - -typedef PREPACK struct { - A_UINT8 RecordID; /* Record ID */ - A_UINT8 Length; /* Length of record */ -} POSTPACK HTC_RECORD_HDR; - -typedef PREPACK struct { - A_UINT8 EndpointID; /* Endpoint that owns these credits */ - A_UINT8 Credits; /* credits to report since last report */ -} POSTPACK HTC_CREDIT_REPORT; - -typedef PREPACK struct { - A_UINT8 PreValid; /* pre valid guard */ - A_UINT8 LookAhead[4]; /* 4 byte lookahead */ - A_UINT8 PostValid; /* post valid guard */ - - /* NOTE: the LookAhead array is guarded by a PreValid and Post Valid guard bytes. - * The PreValid bytes must equal the inverse of the PostValid byte */ - -} POSTPACK HTC_LOOKAHEAD_REPORT; - -typedef PREPACK struct { - A_UINT8 LookAhead[4]; /* 4 byte lookahead */ -} POSTPACK HTC_BUNDLED_LOOKAHEAD_REPORT; - -#ifndef ATH_TARGET -#include "athendpack.h" -#endif - - -#endif /* __HTC_H__ */ - diff --git a/drivers/net/wireless/ar6003/include/htc_services.h b/drivers/net/wireless/ar6003/include/htc_services.h deleted file mode 100644 index fb22268a8d84..000000000000 --- a/drivers/net/wireless/ar6003/include/htc_services.h +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2007 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef __HTC_SERVICES_H__ -#define __HTC_SERVICES_H__ - -/* Current service IDs */ - -typedef enum { - RSVD_SERVICE_GROUP = 0, - WMI_SERVICE_GROUP = 1, - - HTC_TEST_GROUP = 254, - HTC_SERVICE_GROUP_LAST = 255 -}HTC_SERVICE_GROUP_IDS; - -#define MAKE_SERVICE_ID(group,index) \ - (int)(((int)group << 8) | (int)(index)) - -/* NOTE: service ID of 0x0000 is reserved and should never be used */ -#define HTC_CTRL_RSVD_SVC MAKE_SERVICE_ID(RSVD_SERVICE_GROUP,1) -#define WMI_CONTROL_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP,0) -#define WMI_DATA_BE_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP,1) -#define WMI_DATA_BK_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP,2) -#define WMI_DATA_VI_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP,3) -#define WMI_DATA_VO_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP,4) -#define WMI_MAX_SERVICES 5 - -/* raw stream service (i.e. flash, tcmd, calibration apps) */ -#define HTC_RAW_STREAMS_SVC MAKE_SERVICE_ID(HTC_TEST_GROUP,0) - -#endif /*HTC_SERVICES_H_*/ diff --git a/drivers/net/wireless/ar6003/include/ini_dset.h b/drivers/net/wireless/ar6003/include/ini_dset.h deleted file mode 100644 index 6ab422ad44ee..000000000000 --- a/drivers/net/wireless/ar6003/include/ini_dset.h +++ /dev/null @@ -1,83 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef _INI_DSET_H_ -#define _INI_DSET_H_ - -/* - * Each of these represents a WHAL INI table, which consists - * of an "address column" followed by 1 or more "value columns". - * - * Software uses the base WHAL_INI_DATA_ID+column to access a - * DataSet that holds a particular column of data. - */ -typedef enum { -#if defined(AR6002_REV4) || defined(AR6003) || defined(AR6002_REV6) -/* Add these definitions for compatability */ -#define WHAL_INI_DATA_ID_BB_RFGAIN_LNA1 WHAL_INI_DATA_ID_BB_RFGAIN -#define WHAL_INI_DATA_ID_BB_RFGAIN_LNA2 WHAL_INI_DATA_ID_BB_RFGAIN - WHAL_INI_DATA_ID_NULL =0, - WHAL_INI_DATA_ID_MODE_SPECIFIC =1, /* 2,3,4,5 */ - WHAL_INI_DATA_ID_COMMON =6, /* 7 */ - WHAL_INI_DATA_ID_BB_RFGAIN =8, /* 9,10 */ -#ifdef FPGA - WHAL_INI_DATA_ID_ANALOG_BANK0 =11, /* 12 */ - WHAL_INI_DATA_ID_ANALOG_BANK1 =13, /* 14 */ - WHAL_INI_DATA_ID_ANALOG_BANK2 =15, /* 16 */ - WHAL_INI_DATA_ID_ANALOG_BANK3 =17, /* 18, 19 */ - WHAL_INI_DATA_ID_ANALOG_BANK6 =20, /* 21,22 */ - WHAL_INI_DATA_ID_ANALOG_BANK7 =23, /* 24 */ - WHAL_INI_DATA_ID_ADDAC =25, /* 26 */ -#else - WHAL_INI_DATA_ID_ANALOG_COMMON =11, /* 12 */ - WHAL_INI_DATA_ID_ANALOG_MODE_SPECIFIC=13, /* 14,15 */ - WHAL_INI_DATA_ID_ANALOG_BANK6 =16, /* 17,18 */ - WHAL_INI_DATA_ID_MODE_OVERRIDES =19, /* 20,21,22,23 */ - WHAL_INI_DATA_ID_COMMON_OVERRIDES =24, /* 25 */ - WHAL_INI_DATA_ID_ANALOG_OVERRIDES =26, /* 27,28 */ -#endif /* FPGA */ -#else - WHAL_INI_DATA_ID_NULL =0, - WHAL_INI_DATA_ID_MODE_SPECIFIC =1, /* 2,3 */ - WHAL_INI_DATA_ID_COMMON =4, /* 5 */ - WHAL_INI_DATA_ID_BB_RFGAIN =6, /* 7,8 */ -#define WHAL_INI_DATA_ID_BB_RFGAIN_LNA1 WHAL_INI_DATA_ID_BB_RFGAIN - WHAL_INI_DATA_ID_ANALOG_BANK1 =9, /* 10 */ - WHAL_INI_DATA_ID_ANALOG_BANK2 =11, /* 12 */ - WHAL_INI_DATA_ID_ANALOG_BANK3 =13, /* 14, 15 */ - WHAL_INI_DATA_ID_ANALOG_BANK6 =16, /* 17, 18 */ - WHAL_INI_DATA_ID_ANALOG_BANK7 =19, /* 20 */ - WHAL_INI_DATA_ID_MODE_OVERRIDES =21, /* 22,23 */ - WHAL_INI_DATA_ID_COMMON_OVERRIDES =24, /* 25 */ - WHAL_INI_DATA_ID_ANALOG_OVERRIDES =26, /* 27,28 */ - WHAL_INI_DATA_ID_BB_RFGAIN_LNA2 =29, /* 30,31 */ -#endif - WHAL_INI_DATA_ID_MAX =31 -} WHAL_INI_DATA_ID; - -typedef PREPACK struct { - A_UINT16 freqIndex; // 1 - A mode 2 - B or G mode 0 - common - A_UINT16 offset; - A_UINT32 newValue; -} POSTPACK INI_DSET_REG_OVERRIDE; - -#endif diff --git a/drivers/net/wireless/ar6003/include/iot_flashotp.h b/drivers/net/wireless/ar6003/include/iot_flashotp.h deleted file mode 100644 index 67c24fc3f805..000000000000 --- a/drivers/net/wireless/ar6003/include/iot_flashotp.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef _IOT_FLASHOTP_H_ -#define _IOT_FLASHOTP_H_ -/******************************************/ -/* firmware input param value definitions */ -/******************************************/ -/* IOTFLASHOTP_PARAM_SKIP_OTP - instructs firmware to skip OTP operations */ -#define IOTFLASHOTP_PARAM_SKIP_OTP (0x00000001) -/* IOTFLASHOTP_PARAM_SKIP_FLASH - instructs firmware to skip Flash operations */ -#define IOTFLASHOTP_PARAM_SKIP_FLASH (0x00000002) -/* IOTFLASHOTP_PARAM_USE_NVRAM_CONFIG_FROM_OTP - instructs firmware to use NVRAM config found in OTP - * to access flash. */ -#define IOTFLASHOTP_PARAM_USE_NVRAM_CONFIG_FROM_OTP (0x00000004) -/*************************************/ -/* firmware return value definitions */ -/*************************************/ -#define IOTFLASHOTP_RESULT_OTP_SUCCESS (0x00000001) -#define IOTFLASHOTP_RESULT_OTP_FAILED (0x00000002) -#define IOTFLASHOTP_RESULT_OTP_NOT_WRITTEN (0x00000004) -#define IOTFLASHOTP_RESULT_OTP_SKIPPED (0x00000008) -#define IOTFLASHOTP_RESULT_OTP_POS_MASK (0x0000000f) -#define IOTFLASHOTP_RESULT_OTP_POS_SHIFT (8) -#define IOTFLASHOTP_RESULT_OTP_MASK (0x0000ffff) - -#define IOTFLASHOTP_RESULT_FLASH_SUCCESS (0x00010000) -#define IOTFLASHOTP_RESULT_FLASH_FAILED (0x00020000) -#define IOTFLASHOTP_RESULT_FLASH_VALIDATE_FAILED (0x00040000) -#define IOTFLASHOTP_RESULT_FLASH_SKIPPED (0x00080000) -#define IOTFLASHOTP_RESULT_FLASH_MASK (0xffff0000) - - -#if !defined(AR6002_REV4) -typedef unsigned long A_UINT32; -#endif - -typedef struct{ - A_UINT32 length; // length of binary in bytes - A_UINT32 loadAddr; // address to which the image should be loaded - A_UINT32 execAddr; // address from which execution should start - A_UINT32 MACOffset; // offset in image of MAC address location. - A_UINT32 ChksumOffset; // offset of checksum location <0 implies no checksum> - A_UINT32 ChksumStart; // offset in image for start of checksum calculation - A_UINT32 ChksumEnd; // offset in image for end of checksum calculation - A_UINT32 partitionTableOffset; // offset in image for start of 3 word partition table - A_UINT32 flashDescOffset; // offset in image for the start of the flash descriptor file -}CONFIG_HEADER; - -typedef struct{ - A_UINT32 capacity; // size of flash chip in bytes - A_UINT32 blocksize; // size of a block needed for nvram block erase command - A_UINT32 sectorsize; // size of sector needed for nvram sector erase command - A_UINT32 pagesize; // size of page needed for nvram write command -}FLASH_DESCRIPTOR; - - -#endif /* _IOT_FLASHOTP_H_ */ diff --git a/drivers/net/wireless/ar6003/include/p2p.h b/drivers/net/wireless/ar6003/include/p2p.h deleted file mode 100644 index 83115d9081c2..000000000000 --- a/drivers/net/wireless/ar6003/include/p2p.h +++ /dev/null @@ -1,429 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// This file has the shared declarations between the host & target P2P modules. -// Author(s): ="Atheros" -//============================================================================== -#ifndef _P2P_H_ -#define _P2P_H_ - -#define WPS_NONCE_LEN 16 -#define WPS_DEV_TYPE_LEN 8 -#define WPS_AUTHENTICATOR_LEN 8 -#define WPS_HASH_LEN 32 -#define WPS_SECRET_NONCE_LEN 16 -#define WPS_KWA_LEN 8 -#define WPS_MAX_PIN_LEN 8 -#define P2P_MAX_SSID_LEN 32 - -#define WPS_DEV_OUI_WFA 0x0050f204 -#define P2P_IE_VENDOR_TYPE 0x506f9a09 - -#define WLAN_EID_VENDOR_SPECIFIC 221 - -#define P2P_DEV_CAPAB_SERVICE_DISCOVERY BIT(0) - -/* Config Methods */ -#define WPS_CONFIG_USBA 0x0001 -#define WPS_CONFIG_ETHERNET 0x0002 -#define WPS_CONFIG_LABEL 0x0004 -#define WPS_CONFIG_DISPLAY 0x0008 -#define WPS_CONFIG_EXT_NFC_TOKEN 0x0010 -#define WPS_CONFIG_INT_NFC_TOKEN 0x0020 -#define WPS_CONFIG_NFC_INTERFACE 0x0040 -#define WPS_CONFIG_PUSHBUTTON 0x0080 -#define WPS_CONFIG_KEYPAD 0x0100 - -/* Attribute Types */ -enum wps_attribute { - ATTR_AP_CHANNEL = 0x1001, - ATTR_ASSOC_STATE = 0x1002, - ATTR_AUTH_TYPE = 0x1003, - ATTR_AUTH_TYPE_FLAGS = 0x1004, - ATTR_AUTHENTICATOR = 0x1005, - ATTR_CONFIG_METHODS = 0x1008, - ATTR_CONFIG_ERROR = 0x1009, - ATTR_CONFIRM_URL4 = 0x100a, - ATTR_CONFIRM_URL6 = 0x100b, - ATTR_CONN_TYPE = 0x100c, - ATTR_CONN_TYPE_FLAGS = 0x100d, - ATTR_CRED = 0x100e, - ATTR_ENCR_TYPE = 0x100f, - ATTR_ENCR_TYPE_FLAGS = 0x1010, - ATTR_DEV_NAME = 0x1011, - ATTR_DEV_PASSWORD_ID = 0x1012, - ATTR_E_HASH1 = 0x1014, - ATTR_E_HASH2 = 0x1015, - ATTR_E_SNONCE1 = 0x1016, - ATTR_E_SNONCE2 = 0x1017, - ATTR_ENCR_SETTINGS = 0x1018, - ATTR_ENROLLEE_NONCE = 0x101a, - ATTR_FEATURE_ID = 0x101b, - ATTR_IDENTITY = 0x101c, - ATTR_IDENTITY_PROOF = 0x101d, - ATTR_KEY_WRAP_AUTH = 0x101e, - ATTR_KEY_ID = 0x101f, - ATTR_MAC_ADDR = 0x1020, - ATTR_MANUFACTURER = 0x1021, - ATTR_MSG_TYPE = 0x1022, - ATTR_MODEL_NAME = 0x1023, - ATTR_MODEL_NUMBER = 0x1024, - ATTR_NETWORK_INDEX = 0x1026, - ATTR_NETWORK_KEY = 0x1027, - ATTR_NETWORK_KEY_INDEX = 0x1028, - ATTR_NEW_DEVICE_NAME = 0x1029, - ATTR_NEW_PASSWORD = 0x102a, - ATTR_OOB_DEVICE_PASSWORD = 0x102c, - ATTR_OS_VERSION = 0x102d, - ATTR_POWER_LEVEL = 0x102f, - ATTR_PSK_CURRENT = 0x1030, - ATTR_PSK_MAX = 0x1031, - ATTR_PUBLIC_KEY = 0x1032, - ATTR_RADIO_ENABLE = 0x1033, - ATTR_REBOOT = 0x1034, - ATTR_REGISTRAR_CURRENT = 0x1035, - ATTR_REGISTRAR_ESTABLISHED = 0x1036, - ATTR_REGISTRAR_LIST = 0x1037, - ATTR_REGISTRAR_MAX = 0x1038, - ATTR_REGISTRAR_NONCE = 0x1039, - ATTR_REQUEST_TYPE = 0x103a, - ATTR_RESPONSE_TYPE = 0x103b, - ATTR_RF_BANDS = 0x103c, - ATTR_R_HASH1 = 0x103d, - ATTR_R_HASH2 = 0x103e, - ATTR_R_SNONCE1 = 0x103f, - ATTR_R_SNONCE2 = 0x1040, - ATTR_SELECTED_REGISTRAR = 0x1041, - ATTR_SERIAL_NUMBER = 0x1042, - ATTR_WPS_STATE = 0x1044, - ATTR_SSID = 0x1045, - ATTR_TOTAL_NETWORKS = 0x1046, - ATTR_UUID_E = 0x1047, - ATTR_UUID_R = 0x1048, - ATTR_VENDOR_EXT = 0x1049, - ATTR_VERSION = 0x104a, - ATTR_X509_CERT_REQ = 0x104b, - ATTR_X509_CERT = 0x104c, - ATTR_EAP_IDENTITY = 0x104d, - ATTR_MSG_COUNTER = 0x104e, - ATTR_PUBKEY_HASH = 0x104f, - ATTR_REKEY_KEY = 0x1050, - ATTR_KEY_LIFETIME = 0x1051, - ATTR_PERMITTED_CFG_METHODS = 0x1052, - ATTR_SELECTED_REGISTRAR_CONFIG_METHODS = 0x1053, - ATTR_PRIMARY_DEV_TYPE = 0x1054, - ATTR_SECONDARY_DEV_TYP_ELIST = 0x1055, - ATTR_PORTABLE_DEV = 0x1056, - ATTR_AP_SETUP_LOCKED = 0x1057, - ATTR_APPLICATION_EXT = 0x1058, - ATTR_EAP_TYPE = 0x1059, - ATTR_IV = 0x1060, - ATTR_KEY_PROVIDED_AUTO = 0x1061, - ATTR_802_1X_ENABLED = 0x1062, - ATTR_APPSESSIONKEY = 0x1063, - ATTR_WEPTRANSMITKEY = 0x1064, - ATTR_REQUESTED_DEV_TYPE = 0x106a -}; - -enum p2p_wps_method { - WPS_NOT_READY, WPS_PIN_LABEL, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC -}; - -enum p2p_status_code { - P2P_SC_SUCCESS = 0, - P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE = 1, - P2P_SC_FAIL_INCOMPATIBLE_PARAMS = 2, - P2P_SC_FAIL_LIMIT_REACHED = 3, - P2P_SC_FAIL_INVALID_PARAMS = 4, - P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE = 5, - P2P_SC_FAIL_PREV_PROTOCOL_ERROR = 6, - P2P_SC_FAIL_NO_COMMON_CHANNELS = 7, - P2P_SC_FAIL_UNKNOWN_GROUP = 8, - P2P_SC_FAIL_BOTH_GO_INTENT_15 = 9, - P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD = 10, - P2P_SC_FAIL_REJECTED_BY_USER = 11, -}; - -struct wps_parse_attr { - /* fixed length fields */ - const A_UINT8 *version; /* 1 octet */ - const A_UINT8 *msg_type; /* 1 octet */ - const A_UINT8 *enrollee_nonce; /* WPS_NONCE_LEN (16) octets */ - const A_UINT8 *registrar_nonce; /* WPS_NONCE_LEN (16) octets */ - const A_UINT8 *uuid_r; /* WPS_UUID_LEN (16) octets */ - const A_UINT8 *uuid_e; /* WPS_UUID_LEN (16) octets */ - const A_UINT8 *auth_type_flags; /* 2 octets */ - const A_UINT8 *encr_type_flags; /* 2 octets */ - const A_UINT8 *conn_type_flags; /* 1 octet */ - const A_UINT8 *config_methods; /* 2 octets */ - const A_UINT8 *sel_reg_config_methods; /* 2 octets */ - const A_UINT8 *primary_dev_type; /* 8 octets */ - const A_UINT8 *rf_bands; /* 1 octet */ - const A_UINT8 *assoc_state; /* 2 octets */ - const A_UINT8 *config_error; /* 2 octets */ - const A_UINT8 *dev_password_id; /* 2 octets */ - const A_UINT8 *oob_dev_password; /* WPS_OOB_DEVICE_PASSWORD_ATTR_LEN (54) - * octets */ - const A_UINT8 *os_version; /* 4 octets */ - const A_UINT8 *wps_state; /* 1 octet */ - const A_UINT8 *authenticator; /* WPS_AUTHENTICATOR_LEN (8) octets */ - const A_UINT8 *r_hash1; /* WPS_HASH_LEN (32) octets */ - const A_UINT8 *r_hash2; /* WPS_HASH_LEN (32) octets */ - const A_UINT8 *e_hash1; /* WPS_HASH_LEN (32) octets */ - const A_UINT8 *e_hash2; /* WPS_HASH_LEN (32) octets */ - const A_UINT8 *r_snonce1; /* WPS_SECRET_NONCE_LEN (16) octets */ - const A_UINT8 *r_snonce2; /* WPS_SECRET_NONCE_LEN (16) octets */ - const A_UINT8 *e_snonce1; /* WPS_SECRET_NONCE_LEN (16) octets */ - const A_UINT8 *e_snonce2; /* WPS_SECRET_NONCE_LEN (16) octets */ - const A_UINT8 *key_wrap_auth; /* WPS_KWA_LEN (8) octets */ - const A_UINT8 *auth_type; /* 2 octets */ - const A_UINT8 *encr_type; /* 2 octets */ - const A_UINT8 *network_idx; /* 1 octet */ - const A_UINT8 *network_key_idx; /* 1 octet */ - const A_UINT8 *mac_addr; /* ETH_ALEN (6) octets */ - const A_UINT8 *key_prov_auto; /* 1 octet (Bool) */ - const A_UINT8 *dot1x_enabled; /* 1 octet (Bool) */ - const A_UINT8 *selected_registrar; /* 1 octet (Bool) */ - const A_UINT8 *request_type; /* 1 octet */ - const A_UINT8 *response_type; /* 1 octet */ - const A_UINT8 *ap_setup_locked; /* 1 octet */ - - /* variable length fields */ - const A_UINT8 *manufacturer; - A_UINT32 manufacturer_len; - const A_UINT8 *model_name; - A_UINT32 model_name_len; - const A_UINT8 *model_number; - A_UINT32 model_number_len; - const A_UINT8 *serial_number; - A_UINT32 serial_number_len; - const A_UINT8 *dev_name; - A_UINT32 dev_name_len; - const A_UINT8 *public_key; - A_UINT32 public_key_len; - const A_UINT8 *encr_settings; - A_UINT32 encr_settings_len; - const A_UINT8 *ssid; /* <= 32 octets */ - A_UINT32 ssid_len; - const A_UINT8 *network_key; /* <= 64 octets */ - A_UINT32 network_key_len; - const A_UINT8 *eap_type; /* <= 8 octets */ - A_UINT32 eap_type_len; - const A_UINT8 *eap_identity; /* <= 64 octets */ - A_UINT32 eap_identity_len; - - /* attributes that can occur multiple times */ -#define MAX_CRED_COUNT 10 - const A_UINT8 *cred[MAX_CRED_COUNT]; - A_UINT32 cred_len[MAX_CRED_COUNT]; - A_UINT32 num_cred; - -#define MAX_REQ_DEV_TYPE_COUNT 10 - const A_UINT8 *req_dev_type[MAX_REQ_DEV_TYPE_COUNT]; - A_UINT32 num_req_dev_type; -}; - - -enum p2p_sublem_id { - P2P_ATTR_STATUS = 0, - P2P_ATTR_MINOR_REASON_CODE = 1, - P2P_ATTR_CAPABILITY = 2, - P2P_ATTR_DEVICE_ID = 3, - P2P_ATTR_GROUP_OWNER_INTENT = 4, - P2P_ATTR_CONFIGURATION_TIMEOUT = 5, - P2P_ATTR_LISTEN_CHANNEL = 6, - P2P_ATTR_GROUP_BSSID = 7, - P2P_ATTR_EXT_LISTEN_TIMING = 8, - P2P_ATTR_INTENDED_INTERFACE_ADDR = 9, - P2P_ATTR_MANAGEABILITY = 10, - P2P_ATTR_CHANNEL_LIST = 11, - P2P_ATTR_NOTICE_OF_ABSENCE = 12, - P2P_ATTR_DEVICE_INFO = 13, - P2P_ATTR_GROUP_INFO = 14, - P2P_ATTR_GROUP_ID = 15, - P2P_ATTR_INTERFACE = 16, - P2P_ATTR_OPERATING_CHANNEL = 17, - P2P_ATTR_INVITATION_FLAGS = 18, - P2P_ATTR_VENDOR_SPECIFIC = 221 -}; - -#define P2P_MAX_REG_CLASSES 10 -#define P2P_MAX_REG_CLASS_CHANNELS 20 - -#define P2P_WILDCARD_SSID "DIRECT-" -#define P2P_WILDCARD_SSID_LEN 7 - -struct p2p_channels { - struct p2p_reg_class { - A_UINT8 reg_class; - A_UINT8 channel[P2P_MAX_REG_CLASS_CHANNELS]; - A_UINT8 channels; - } reg_class[P2P_MAX_REG_CLASSES]; - A_UINT8 reg_classes; -}; - -#define P2P_NOA_DESCRIPTOR_LEN 13 -struct p2p_noa_descriptor { - A_UINT8 type_count; /* 255: continuous schedule, 0: reserved */ - A_UINT32 duration ; /* Absent period duration in micro seconds */ - A_UINT32 interval; /* Absent period interval in micro seconds */ - A_UINT32 start_time; /* 32 bit tsf time when in starts */ -}; - -#define P2P_MAX_NOA_DESCRIPTORS 4 -/* - * Length = (2 octets for Index and CTWin/Opp PS) and - * (13 octets for each NOA Descriptors) - */ -#define P2P_NOA_IE_SIZE(num_desc) (2 + (13 * (num_desc))) - -#define P2P_NOE_IE_OPP_PS_SET (0x80) -#define P2P_NOE_IE_CTWIN_MASK (0x7F) - -struct p2p_sub_element_noa { - A_UINT8 p2p_sub_id; - A_UINT8 p2p_sub_len; - A_UINT8 index; /* identifies instance of NOA su element */ - A_UINT8 oppPS:1, /* oppPS state of the AP */ - ctwindow:7; /* ctwindow in TUs */ - A_UINT8 num_descriptors; /* number of NOA descriptors */ - struct p2p_noa_descriptor noa_descriptors[P2P_MAX_NOA_DESCRIPTORS]; -}; - -#define ETH_ALEN 6 - -struct p2p_ie { - A_UINT8 dialog_token; - const A_UINT8 *capability; - const A_UINT8 *go_intent; - const A_UINT8 *status; - const A_UINT8 *listen_channel; - const A_UINT8 *operating_channel; - const A_UINT8 *channel_list; - A_UINT8 channel_list_len; - const A_UINT8 *config_timeout; - const A_UINT8 *intended_addr; - const A_UINT8 *group_bssid; - const A_UINT8 *invitation_flags; - - const A_UINT8 *group_info; - A_UINT32 group_info_len; - const A_UINT8 *group_id; - A_UINT32 group_id_len; - - const A_UINT8 *device_id; - const A_UINT8 *manageability; - - const A_UINT8 *noa; - A_UINT32 noa_len; - const A_UINT8 *ext_listen_timing; - - const A_UINT8 *minor_reason_code; - - /* P2P Device Info */ - const A_UINT8 *p2p_device_info; - A_UINT32 p2p_device_info_len; - const A_UINT8 *p2p_device_addr; - const A_UINT8 *pri_dev_type; - A_UINT8 num_sec_dev_types; - A_CHAR device_name[33]; - A_UINT8 dev_name_len; - A_UINT16 config_methods; - - /* WPS IE */ - A_UINT16 dev_password_id; - A_UINT16 wps_config_methods; - const A_UINT8 *wps_pri_dev_type; - A_CHAR wps_device_name[33]; - A_UINT8 wps_dev_name_len; - - - /* SSID IE */ - const A_UINT8 *ssid; -}; - -struct p2p_device { - A_UINT16 listen_freq; - A_UINT32 wps_pbc; - A_CHAR wps_pin[WPS_MAX_PIN_LEN]; - A_UINT8 pin_len; - enum p2p_wps_method wps_method; - - A_UINT8 p2p_device_addr[ETH_ALEN]; - A_UINT8 pri_dev_type[8]; - A_CHAR device_name[33]; - A_UINT16 config_methods; - A_UINT8 dev_capab; - A_UINT8 group_capab; - - A_UINT8 interface_addr[ETH_ALEN]; - - /* Dev. Discoverability data */ - A_UINT8 dev_disc_dialog_token; - A_UINT8 member_in_go_dev[ETH_ALEN]; - A_UINT8 member_in_go_iface[ETH_ALEN]; - A_UINT8 dev_disc_go_oper_ssid[WMI_MAX_SSID_LEN]; - A_UINT8 dev_disc_go_oper_ssid_len; - A_UINT16 dev_disc_go_oper_freq; - - A_UINT32 go_neg_req_sent; - enum p2p_go_state { UNKNOWN_GO, LOCAL_GO, REMOTE_GO } go_state; - A_UINT8 dialog_token; - A_UINT8 intended_addr[ETH_ALEN]; - - A_CHAR country[3]; - struct p2p_channels channels; - A_UINT16 oper_freq; - A_UINT8 oper_ssid[P2P_MAX_SSID_LEN]; - A_UINT8 oper_ssid_len; - - A_UINT16 req_config_methods; - -#define P2P_DEV_PROBE_REQ_ONLY BIT(0) -#define P2P_DEV_REPORTED BIT(1) -#define P2P_DEV_NOT_YET_READY BIT(2) -#define P2P_DEV_SD_INFO BIT(3) -#define P2P_DEV_SD_SCHEDULE BIT(4) -#define P2P_DEV_PD_PEER_DISPLAY BIT(5) -#define P2P_DEV_PD_PEER_KEYPAD BIT(6) -#define P2P_DEV_USER_REJECTED BIT(7) -#define P2P_DEV_PEER_WAITING_RESPONSE BIT(8) -#define P2P_DEV_PREFER_PERSISTENT_GROUP BIT(9) -#define P2P_DEV_WAIT_GO_NEG_RESPONSE BIT(10) -#define P2P_DEV_WAIT_GO_NEG_CONFIRM BIT(11) -#define P2P_DEV_GROUP_CLIENT_ONLY BIT(12) -#define P2P_DEV_FORCE_FREQ BIT(13) -#define P2P_DEV_PD_FOR_JOIN BIT(14) - - A_UINT32 flags; - - A_UINT32 status; - A_UINT8 wait_count; - A_UINT32 invitation_reqs; - - A_UINT16 ext_listen_period; - A_UINT16 ext_listen_interval; - - A_UINT8 go_timeout; - A_UINT8 client_timeout; - A_UINT8 persistent_grp; - -}; -#endif /* _P2P_H_ */ diff --git a/drivers/net/wireless/ar6003/include/pkt_log.h b/drivers/net/wireless/ar6003/include/pkt_log.h deleted file mode 100644 index 331cc04edada..000000000000 --- a/drivers/net/wireless/ar6003/include/pkt_log.h +++ /dev/null @@ -1,45 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2005-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef __PKT_LOG_H__ -#define __PKT_LOG_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Pkt log info */ -typedef PREPACK struct pkt_log_t { - struct info_t { - A_UINT16 st; - A_UINT16 end; - A_UINT16 cur; - }info[4096]; - A_UINT16 last_idx; -}POSTPACK PACKET_LOG; - - -#ifdef __cplusplus -} -#endif -#endif /* __PKT_LOG_H__ */ diff --git a/drivers/net/wireless/ar6003/include/queue.h b/drivers/net/wireless/ar6003/include/queue.h deleted file mode 100644 index 72c10cfa2fa1..000000000000 --- a/drivers/net/wireless/ar6003/include/queue.h +++ /dev/null @@ -1,564 +0,0 @@ -// -// Copyright (c) 1991, 1993 -// The Regents of the University of California. All rights reserved. -// $ATH_LICENSE_NULL$ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// 3. All advertising materials mentioning features or use of this software -// must display the following acknowledgement: -// This product includes software developed by the University of -// California, Berkeley and its contributors. -// 4. Neither the name of the University nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -// SUCH DAMAGE. -// -// @(#)queue.h 8.5 (Berkeley) 8/20/94 -// $FreeBSD: src/sys/sys/queue.h,v 1.58 2004/04/07 04:19:49 imp Exp $ -// $Id: //depot/sw/releases/olca3.1-RC/include/queue.h#1 $ -// - -#ifndef _SYS_QUEUE_H_ -#define _SYS_QUEUE_H_ - -/* - * This file defines four types of data structures: singly-linked lists, - * singly-linked tail queues, lists and tail queues. - * - * A singly-linked list is headed by a single forward pointer. The elements - * are singly linked for minimum space and pointer manipulation overhead at - * the expense of O(n) removal for arbitrary elements. New elements can be - * added to the list after an existing element or at the head of the list. - * Elements being removed from the head of the list should use the explicit - * macro for this purpose for optimum efficiency. A singly-linked list may - * only be traversed in the forward direction. Singly-linked lists are ideal - * for applications with large datasets and few or no removals or for - * implementing a LIFO queue. - * - * A singly-linked tail queue is headed by a pair of pointers, one to the - * head of the list and the other to the tail of the list. The elements are - * singly linked for minimum space and pointer manipulation overhead at the - * expense of O(n) removal for arbitrary elements. New elements can be added - * to the list after an existing element, at the head of the list, or at the - * end of the list. Elements being removed from the head of the tail queue - * should use the explicit macro for this purpose for optimum efficiency. - * A singly-linked tail queue may only be traversed in the forward direction. - * Singly-linked tail queues are ideal for applications with large datasets - * and few or no removals or for implementing a FIFO queue. - * - * A list is headed by a single forward pointer (or an array of forward - * pointers for a hash table header). The elements are doubly linked - * so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before - * or after an existing element or at the head of the list. A list - * may only be traversed in the forward direction. - * - * A tail queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or - * after an existing element, at the head of the list, or at the end of - * the list. A tail queue may be traversed in either direction. - * - * For details on the use of these macros, see the queue(3) manual page. - * - * - * SLIST LIST STAILQ TAILQ - * _HEAD + + + + - * _HEAD_INITIALIZER + + + + - * _ENTRY + + + + - * _INIT + + + + - * _EMPTY + + + + - * _FIRST + + + + - * _NEXT + + + + - * _PREV - - - + - * _LAST - - + + - * _FOREACH + + + + - * _FOREACH_SAFE + + + + - * _FOREACH_REVERSE - - - + - * _FOREACH_REVERSE_SAFE - - - + - * _INSERT_HEAD + + + + - * _INSERT_BEFORE - + - + - * _INSERT_AFTER + + + + - * _INSERT_TAIL - - + + - * _CONCAT - - + + - * _REMOVE_HEAD + - + - - * _REMOVE + + + + - * - */ -#define QUEUE_MACRO_DEBUG 0 -#if QUEUE_MACRO_DEBUG -/* Store the last 2 places the queue element or head was altered */ -struct qm_trace { - char * lastfile; - int lastline; - char * prevfile; - int prevline; -}; - -#define TRACEBUF struct qm_trace trace; -#define TRASHIT(x) do {(x) = (void *)-1;} while (0) - -#define QMD_TRACE_HEAD(head) do { \ - (head)->trace.prevline = (head)->trace.lastline; \ - (head)->trace.prevfile = (head)->trace.lastfile; \ - (head)->trace.lastline = __LINE__; \ - (head)->trace.lastfile = __FILE__; \ -} while (0) - -#define QMD_TRACE_ELEM(elem) do { \ - (elem)->trace.prevline = (elem)->trace.lastline; \ - (elem)->trace.prevfile = (elem)->trace.lastfile; \ - (elem)->trace.lastline = __LINE__; \ - (elem)->trace.lastfile = __FILE__; \ -} while (0) - -#else -#define QMD_TRACE_ELEM(elem) -#define QMD_TRACE_HEAD(head) -#define TRACEBUF -#define TRASHIT(x) -#endif /* QUEUE_MACRO_DEBUG */ - -/* - * Singly-linked List declarations. - */ -#define SLIST_HEAD(name, type) \ -struct name { \ - struct type *slh_first; /* first element */ \ -} - -#define SLIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define SLIST_ENTRY(type) \ -struct { \ - struct type *sle_next; /* next element */ \ -} - -/* - * Singly-linked List functions. - */ -#define SLIST_EMPTY(head) ((head)->slh_first == NULL) - -#define SLIST_FIRST(head) ((head)->slh_first) - -#define SLIST_FOREACH(var, head, field) \ - for ((var) = SLIST_FIRST((head)); \ - (var); \ - (var) = SLIST_NEXT((var), field)) - -#define SLIST_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = SLIST_FIRST((head)); \ - (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ - (var) = (tvar)) - -#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \ - for ((varp) = &SLIST_FIRST((head)); \ - ((var) = *(varp)) != NULL; \ - (varp) = &SLIST_NEXT((var), field)) - -#define SLIST_INIT(head) do { \ - SLIST_FIRST((head)) = NULL; \ -} while (0) - -#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ - SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \ - SLIST_NEXT((slistelm), field) = (elm); \ -} while (0) - -#define SLIST_INSERT_HEAD(head, elm, field) do { \ - SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \ - SLIST_FIRST((head)) = (elm); \ -} while (0) - -#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) - -#define SLIST_REMOVE(head, elm, type, field) do { \ - if (SLIST_FIRST((head)) == (elm)) { \ - SLIST_REMOVE_HEAD((head), field); \ - } \ - else { \ - struct type *curelm = SLIST_FIRST((head)); \ - while (SLIST_NEXT(curelm, field) != (elm)) \ - curelm = SLIST_NEXT(curelm, field); \ - SLIST_NEXT(curelm, field) = \ - SLIST_NEXT(SLIST_NEXT(curelm, field), field); \ - } \ -} while (0) - -#define SLIST_REMOVE_HEAD(head, field) do { \ - SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \ -} while (0) - -/* - * Singly-linked Tail queue declarations. - */ -#define STAILQ_HEAD(name, type) \ -struct name { \ - struct type *stqh_first;/* first element */ \ - struct type **stqh_last;/* addr of last next element */ \ -} - -#define STAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).stqh_first } - -#define STAILQ_ENTRY(type) \ -struct { \ - struct type *stqe_next; /* next element */ \ -} - -/* - * Singly-linked Tail queue functions. - */ -#define STAILQ_CONCAT(head1, head2) do { \ - if (!STAILQ_EMPTY((head2))) { \ - *(head1)->stqh_last = (head2)->stqh_first; \ - (head1)->stqh_last = (head2)->stqh_last; \ - STAILQ_INIT((head2)); \ - } \ -} while (0) - -#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) - -#define STAILQ_FIRST(head) ((head)->stqh_first) - -#define STAILQ_FOREACH(var, head, field) \ - for((var) = STAILQ_FIRST((head)); \ - (var); \ - (var) = STAILQ_NEXT((var), field)) - - -#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = STAILQ_FIRST((head)); \ - (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ - (var) = (tvar)) - -#define STAILQ_INIT(head) do { \ - STAILQ_FIRST((head)) = NULL; \ - (head)->stqh_last = &STAILQ_FIRST((head)); \ -} while (0) - -#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ - if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\ - (head)->stqh_last = &STAILQ_NEXT((elm), field); \ - STAILQ_NEXT((tqelm), field) = (elm); \ -} while (0) - -#define STAILQ_INSERT_HEAD(head, elm, field) do { \ - if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \ - (head)->stqh_last = &STAILQ_NEXT((elm), field); \ - STAILQ_FIRST((head)) = (elm); \ -} while (0) - -#define STAILQ_INSERT_TAIL(head, elm, field) do { \ - STAILQ_NEXT((elm), field) = NULL; \ - *(head)->stqh_last = (elm); \ - (head)->stqh_last = &STAILQ_NEXT((elm), field); \ -} while (0) - -#define FIELD_OFFSET(type, field) ((int)(int *)&(((struct type *)0)->field)) - -#define STAILQ_LAST(head, type, field) \ - (STAILQ_EMPTY((head)) ? \ - NULL : \ - ((struct type *) \ - ((char *)((head)->stqh_last) - FIELD_OFFSET(type, field)))) - -#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) - -#define STAILQ_CONCAT_ELEM(prevelm, elm, field) do { \ - prevelm->field.stqe_next = elm; \ -} while (0) - -#define STAILQ_REMOVE(head, elm, type, field) do { \ - if (STAILQ_FIRST((head)) == (elm)) { \ - STAILQ_REMOVE_HEAD((head), field); \ - } \ - else { \ - struct type *curelm = STAILQ_FIRST((head)); \ - while (STAILQ_NEXT(curelm, field) != (elm)) \ - curelm = STAILQ_NEXT(curelm, field); \ - if ((STAILQ_NEXT(curelm, field) = \ - STAILQ_NEXT(STAILQ_NEXT(curelm, field), field)) == NULL)\ - (head)->stqh_last = &STAILQ_NEXT((curelm), field);\ - } \ -} while (0) - -#define STAILQ_REMOVE_HEAD(head, field) do { \ - if ((STAILQ_FIRST((head)) = \ - STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \ - (head)->stqh_last = &STAILQ_FIRST((head)); \ -} while (0) - -#define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \ - if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL) \ - (head)->stqh_last = &STAILQ_FIRST((head)); \ -} while (0) - -/* - * List declarations. - */ -#define ATH_LIST_HEAD(name, type) \ -struct name { \ - struct type *lh_first; /* first element */ \ -} - -#define LIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define LIST_ENTRY(type) \ -struct { \ - struct type *le_next; /* next element */ \ - struct type **le_prev; /* address of previous next element */ \ -} - -/* - * List functions. - */ - -#define LIST_EMPTY(head) ((head)->lh_first == NULL) - -#define LIST_FIRST(head) ((head)->lh_first) - -#define LIST_FOREACH(var, head, field) \ - for ((var) = LIST_FIRST((head)); \ - (var); \ - (var) = LIST_NEXT((var), field)) - -#define LIST_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = LIST_FIRST((head)); \ - (var) && ((tvar) = LIST_NEXT((var), field), 1); \ - (var) = (tvar)) - -#define LIST_INIT(head) do { \ - LIST_FIRST((head)) = NULL; \ -} while (0) - -#define LIST_INSERT_AFTER(listelm, elm, field) do { \ - if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\ - LIST_NEXT((listelm), field)->field.le_prev = \ - &LIST_NEXT((elm), field); \ - LIST_NEXT((listelm), field) = (elm); \ - (elm)->field.le_prev = &LIST_NEXT((listelm), field); \ -} while (0) - -#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.le_prev = (listelm)->field.le_prev; \ - LIST_NEXT((elm), field) = (listelm); \ - *(listelm)->field.le_prev = (elm); \ - (listelm)->field.le_prev = &LIST_NEXT((elm), field); \ -} while (0) - -#define LIST_INSERT_HEAD(head, elm, field) do { \ - if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \ - LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\ - LIST_FIRST((head)) = (elm); \ - (elm)->field.le_prev = &LIST_FIRST((head)); \ -} while (0) - -#define LIST_NEXT(elm, field) ((elm)->field.le_next) - -#define LIST_REMOVE(elm, field) do { \ - if (LIST_NEXT((elm), field) != NULL) \ - LIST_NEXT((elm), field)->field.le_prev = \ - (elm)->field.le_prev; \ - *(elm)->field.le_prev = LIST_NEXT((elm), field); \ -} while (0) - -/* - * Tail queue declarations. - */ -#define TAILQ_HEAD(name, type) \ -struct name { \ - struct type *tqh_first; /* first element */ \ - struct type **tqh_last; /* addr of last next element */ \ - TRACEBUF \ -} - -#define TAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } - -#define TAILQ_ENTRY(type) \ -struct { \ - struct type *tqe_next; /* next element */ \ - struct type **tqe_prev; /* address of previous next element */ \ - TRACEBUF \ -} - -/* - * Tail queue functions. - */ -#define TAILQ_CONCAT(head1, head2, field) do { \ - if (!TAILQ_EMPTY(head2)) { \ - *(head1)->tqh_last = (head2)->tqh_first; \ - (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ - (head1)->tqh_last = (head2)->tqh_last; \ - TAILQ_INIT((head2)); \ - QMD_TRACE_HEAD(head); \ - QMD_TRACE_HEAD(head2); \ - } \ -} while (0) - -#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) - -#define TAILQ_FIRST(head) ((head)->tqh_first) - -#define TAILQ_FOREACH(var, head, field) \ - for ((var) = TAILQ_FIRST((head)); \ - (var); \ - (var) = TAILQ_NEXT((var), field)) - -#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = TAILQ_FIRST((head)); \ - (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ - (var) = (tvar)) - -#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = TAILQ_LAST((head), headname); \ - (var); \ - (var) = TAILQ_PREV((var), headname, field)) - -#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ - for ((var) = TAILQ_LAST((head), headname); \ - (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ - (var) = (tvar)) - -#define TAILQ_INIT(head) do { \ - TAILQ_FIRST((head)) = NULL; \ - (head)->tqh_last = &TAILQ_FIRST((head)); \ - QMD_TRACE_HEAD(head); \ -} while (0) - -#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\ - TAILQ_NEXT((elm), field)->field.tqe_prev = \ - &TAILQ_NEXT((elm), field); \ - else { \ - (head)->tqh_last = &TAILQ_NEXT((elm), field); \ - QMD_TRACE_HEAD(head); \ - } \ - TAILQ_NEXT((listelm), field) = (elm); \ - (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \ - QMD_TRACE_ELEM(&(elm)->field); \ - QMD_TRACE_ELEM(&listelm->field); \ -} while (0) - -#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - TAILQ_NEXT((elm), field) = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \ - QMD_TRACE_ELEM(&(elm)->field); \ - QMD_TRACE_ELEM(&listelm->field); \ -} while (0) - -#define TAILQ_INSERT_HEAD(head, elm, field) do { \ - if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \ - TAILQ_FIRST((head))->field.tqe_prev = \ - &TAILQ_NEXT((elm), field); \ - else \ - (head)->tqh_last = &TAILQ_NEXT((elm), field); \ - TAILQ_FIRST((head)) = (elm); \ - (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \ - QMD_TRACE_HEAD(head); \ - QMD_TRACE_ELEM(&(elm)->field); \ -} while (0) - -#define TAILQ_INSERT_TAIL(head, elm, field) do { \ - TAILQ_NEXT((elm), field) = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &TAILQ_NEXT((elm), field); \ - QMD_TRACE_HEAD(head); \ - QMD_TRACE_ELEM(&(elm)->field); \ -} while (0) - -#define TAILQ_LAST(head, headname) \ - (*(((struct headname *)((head)->tqh_last))->tqh_last)) - -#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) - -#define TAILQ_PREV(elm, headname, field) \ - (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) - -#define TAILQ_REMOVE(head, elm, field) do { \ - if ((TAILQ_NEXT((elm), field)) != NULL) \ - TAILQ_NEXT((elm), field)->field.tqe_prev = \ - (elm)->field.tqe_prev; \ - else { \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - QMD_TRACE_HEAD(head); \ - } \ - *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \ - TRASHIT((elm)->field.tqe_next); \ - TRASHIT((elm)->field.tqe_prev); \ - QMD_TRACE_ELEM(&(elm)->field); \ -} while (0) - - -#ifdef _KERNEL - -/* - * XXX insque() and remque() are an old way of handling certain queues. - * They bogusly assumes that all queue heads look alike. - */ - -struct quehead { - struct quehead *qh_link; - struct quehead *qh_rlink; -}; - -#if defined(__GNUC__) || defined(__INTEL_COMPILER) - -static __inline void -insque(void *a, void *b) -{ - struct quehead *element = (struct quehead *)a, - *head = (struct quehead *)b; - - element->qh_link = head->qh_link; - element->qh_rlink = head; - head->qh_link = element; - element->qh_link->qh_rlink = element; -} - -static __inline void -remque(void *a) -{ - struct quehead *element = (struct quehead *)a; - - element->qh_link->qh_rlink = element->qh_rlink; - element->qh_rlink->qh_link = element->qh_link; - element->qh_rlink = 0; -} - -#else /* !(__GNUC__ || __INTEL_COMPILER) */ - -void insque(void *a, void *b); -void remque(void *a); - -#endif /* __GNUC__ || __INTEL_COMPILER */ - -#endif /* _KERNEL */ - -#endif /* !_SYS_QUEUE_H_ */ - diff --git a/drivers/net/wireless/ar6003/include/regdump.h b/drivers/net/wireless/ar6003/include/regdump.h deleted file mode 100644 index ff79b4846e69..000000000000 --- a/drivers/net/wireless/ar6003/include/regdump.h +++ /dev/null @@ -1,59 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef __REGDUMP_H__ -#define __REGDUMP_H__ - -#ifndef ATH_TARGET -#include "athstartpack.h" -#endif - -#if defined(AR6001) -#include "AR6001/AR6001_regdump.h" -#endif -#if defined(AR6002) -#include "AR6002/AR6002_regdump.h" -#endif - -#if !defined(__ASSEMBLER__) -/* - * Target CPU state at the time of failure is reflected - * in a register dump, which the Host can fetch through - * the diagnostic window. - */ -PREPACK struct register_dump_s { - A_UINT32 target_id; /* Target ID */ - A_UINT32 assline; /* Line number (if assertion failure) */ - A_UINT32 pc; /* Program Counter at time of exception */ - A_UINT32 badvaddr; /* Virtual address causing exception */ - CPU_exception_frame_t exc_frame; /* CPU-specific exception info */ - - /* Could copy top of stack here, too.... */ -} POSTPACK; -#endif /* __ASSEMBLER__ */ - -#ifndef ATH_TARGET -#include "athendpack.h" -#endif - -#endif /* __REGDUMP_H__ */ diff --git a/drivers/net/wireless/ar6003/include/roaming.h b/drivers/net/wireless/ar6003/include/roaming.h deleted file mode 100644 index 8019850a0571..000000000000 --- a/drivers/net/wireless/ar6003/include/roaming.h +++ /dev/null @@ -1,41 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef _ROAMING_H_ -#define _ROAMING_H_ - -/* - * The signal quality could be in terms of either snr or rssi. We should - * have an enum for both of them. For the time being, we are going to move - * it to wmi.h that is shared by both host and the target, since we are - * repartitioning the code to the host - */ -#define SIGNAL_QUALITY_NOISE_FLOOR -96 -#define SIGNAL_QUALITY_METRICS_NUM_MAX 2 -typedef enum { - SIGNAL_QUALITY_METRICS_SNR = 0, - SIGNAL_QUALITY_METRICS_RSSI, - SIGNAL_QUALITY_METRICS_ALL, -} SIGNAL_QUALITY_METRICS_TYPE; - -#endif /* _ROAMING_H_ */ diff --git a/drivers/net/wireless/ar6003/include/targaddrs.h b/drivers/net/wireless/ar6003/include/targaddrs.h deleted file mode 100644 index ccbfe5892e80..000000000000 --- a/drivers/net/wireless/ar6003/include/targaddrs.h +++ /dev/null @@ -1,398 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef __TARGADDRS_H__ -#define __TARGADDRS_H__ - -#ifndef ATH_TARGET -#include "athstartpack.h" -#endif - -#if defined(AR6002) -#include "AR6002/addrs.h" -#endif - -/* - * AR6K option bits, to enable/disable various features. - * By default, all option bits are 0. - * These bits can be set in LOCAL_SCRATCH register 0. - */ -#define AR6K_OPTION_BMI_DISABLE 0x01 /* Disable BMI comm with Host */ -#define AR6K_OPTION_SERIAL_ENABLE 0x02 /* Enable serial port msgs */ -#define AR6K_OPTION_WDT_DISABLE 0x04 /* WatchDog Timer override */ -#define AR6K_OPTION_SLEEP_DISABLE 0x08 /* Disable system sleep */ -#define AR6K_OPTION_STOP_BOOT 0x10 /* Stop boot processes (for ATE) */ -#define AR6K_OPTION_ENABLE_NOANI 0x20 /* Operate without ANI */ -#define AR6K_OPTION_DSET_DISABLE 0x40 /* Ignore DataSets */ -#define AR6K_OPTION_IGNORE_FLASH 0x80 /* Ignore flash during bootup */ - -/* - * xxx_HOST_INTEREST_ADDRESS is the address in Target RAM of the - * host_interest structure. It must match the address of the _host_interest - * symbol (see linker script). - * - * Host Interest is shared between Host and Target in order to coordinate - * between the two, and is intended to remain constant (with additions only - * at the end) across software releases. - * - * All addresses are available here so that it's possible to - * write a single binary that works with all Target Types. - * May be used in assembler code as well as C. - */ -#define AR6002_HOST_INTEREST_ADDRESS 0x00500400 -#define AR6003_HOST_INTEREST_ADDRESS 0x00540600 -#define MCKINLEY_HOST_INTEREST_ADDRESS 0x00400600 - - -#define HOST_INTEREST_MAX_SIZE 0x100 - -#if !defined(__ASSEMBLER__) -struct register_dump_s; -struct dbglog_hdr_s; - -/* - * These are items that the Host may need to access - * via BMI or via the Diagnostic Window. The position - * of items in this structure must remain constant - * across firmware revisions! - * - * Types for each item must be fixed size across - * target and host platforms. - * - * More items may be added at the end. - */ -PREPACK64 struct host_interest_s { - /* - * Pointer to application-defined area, if any. - * Set by Target application during startup. - */ - A_UINT32 hi_app_host_interest; /* 0x00 */ - - /* Pointer to register dump area, valid after Target crash. */ - A_UINT32 hi_failure_state; /* 0x04 */ - - /* Pointer to debug logging header */ - A_UINT32 hi_dbglog_hdr; /* 0x08 */ - - /* Indicates whether or not flash is present on Target. - * NB: flash_is_present indicator is here not just - * because it might be of interest to the Host; but - * also because it's set early on by Target's startup - * asm code and we need it to have a special RAM address - * so that it doesn't get reinitialized with the rest - * of data. - */ - A_UINT32 hi_flash_is_present; /* 0x0c */ - - /* - * General-purpose flag bits, similar to AR6000_OPTION_* flags. - * Can be used by application rather than by OS. - */ - A_UINT32 hi_option_flag; /* 0x10 */ - - /* - * Boolean that determines whether or not to - * display messages on the serial port. - */ - A_UINT32 hi_serial_enable; /* 0x14 */ - - /* Start address of DataSet index, if any */ - A_UINT32 hi_dset_list_head; /* 0x18 */ - - /* Override Target application start address */ - A_UINT32 hi_app_start; /* 0x1c */ - - /* Clock and voltage tuning */ - A_UINT32 hi_skip_clock_init; /* 0x20 */ - A_UINT32 hi_core_clock_setting; /* 0x24 */ - A_UINT32 hi_cpu_clock_setting; /* 0x28 */ - A_UINT32 hi_system_sleep_setting; /* 0x2c */ - A_UINT32 hi_xtal_control_setting; /* 0x30 */ - A_UINT32 hi_pll_ctrl_setting_24ghz; /* 0x34 */ - A_UINT32 hi_pll_ctrl_setting_5ghz; /* 0x38 */ - A_UINT32 hi_ref_voltage_trim_setting; /* 0x3c */ - A_UINT32 hi_clock_info; /* 0x40 */ - - /* - * Flash configuration overrides, used only - * when firmware is not executing from flash. - * (When using flash, modify the global variables - * with equivalent names.) - */ - A_UINT32 hi_bank0_addr_value; /* 0x44 */ - A_UINT32 hi_bank0_read_value; /* 0x48 */ - A_UINT32 hi_bank0_write_value; /* 0x4c */ - A_UINT32 hi_bank0_config_value; /* 0x50 */ - - /* Pointer to Board Data */ - A_UINT32 hi_board_data; /* 0x54 */ - A_UINT32 hi_board_data_initialized; /* 0x58 */ - - A_UINT32 hi_dset_RAM_index_table; /* 0x5c */ - - A_UINT32 hi_desired_baud_rate; /* 0x60 */ - A_UINT32 hi_dbglog_config; /* 0x64 */ - A_UINT32 hi_end_RAM_reserve_sz; /* 0x68 */ - A_UINT32 hi_mbox_io_block_sz; /* 0x6c */ - - A_UINT32 hi_num_bpatch_streams; /* 0x70 -- unused */ - A_UINT32 hi_mbox_isr_yield_limit; /* 0x74 */ - - A_UINT32 hi_refclk_hz; /* 0x78 */ - A_UINT32 hi_ext_clk_detected; /* 0x7c */ - A_UINT32 hi_dbg_uart_txpin; /* 0x80 */ - A_UINT32 hi_dbg_uart_rxpin; /* 0x84 */ - A_UINT32 hi_hci_uart_baud; /* 0x88 */ - A_UINT32 hi_hci_uart_pin_assignments; /* 0x8C */ - /* NOTE: byte [0] = tx pin, [1] = rx pin, [2] = rts pin, [3] = cts pin */ - A_UINT32 hi_hci_uart_baud_scale_val; /* 0x90 */ - A_UINT32 hi_hci_uart_baud_step_val; /* 0x94 */ - - A_UINT32 hi_allocram_start; /* 0x98 */ - A_UINT32 hi_allocram_sz; /* 0x9c */ - A_UINT32 hi_hci_bridge_flags; /* 0xa0 */ - A_UINT32 hi_hci_uart_support_pins; /* 0xa4 */ - /* NOTE: byte [0] = RESET pin (bit 7 is polarity), bytes[1]..bytes[3] are for future use */ - A_UINT32 hi_hci_uart_pwr_mgmt_params; /* 0xa8 */ - /* 0xa8 - [1]: 0 = UART FC active low, 1 = UART FC active high - * [31:16]: wakeup timeout in ms - */ - /* Pointer to extended board Data */ - A_UINT32 hi_board_ext_data; /* 0xac */ - A_UINT32 hi_board_ext_data_config; /* 0xb0 */ - /* - * Bit [0] : valid - * Bit[31:16: size - */ - /* - * hi_reset_flag is used to do some stuff when target reset. - * such as restore app_start after warm reset or - * preserve host Interest area, or preserve ROM data, literals etc. - */ - A_UINT32 hi_reset_flag; /* 0xb4 */ - /* indicate hi_reset_flag is valid */ - A_UINT32 hi_reset_flag_valid; /* 0xb8 */ - A_UINT32 hi_hci_uart_pwr_mgmt_params_ext; /* 0xbc */ - /* 0xbc - [31:0]: idle timeout in ms - */ - /* ACS flags */ - A_UINT32 hi_acs_flags; /* 0xc0 */ - A_UINT32 hi_console_flags; /* 0xc4 */ - A_UINT32 hi_nvram_state; /* 0xc8 */ - A_UINT32 hi_option_flag2; /* 0xcc */ - - /* If non-zero, override values sent to Host in WMI_READY event. */ - A_UINT32 hi_sw_version_override; /* 0xd0 */ - A_UINT32 hi_abi_version_override; /* 0xd4 */ - - /* test applications flags */ - A_UINT32 hi_test_apps_related ; /* 0xd8 */ - /* location of test script */ - A_UINT32 hi_ota_testscript; /* 0xdc */ - /* location of CAL data */ - A_UINT32 hi_cal_data; /* 0xe0 */ - -} POSTPACK64; -/* bitmap for hi_test_apps_related */ -#define HI_TEST_APPS_TESTSCRIPT_LOADED 0x00000001 -#define HI_TEST_APPS_CAL_DATA_AVAIL 0x00000002 - -/* Bits defined in hi_option_flag */ -#define HI_OPTION_TIMER_WAR 0x01 /* Enable timer workaround */ -#define HI_OPTION_BMI_CRED_LIMIT 0x02 /* Limit BMI command credits */ -#define HI_OPTION_RELAY_DOT11_HDR 0x04 /* Relay Dot11 hdr to/from host */ -#define HI_OPTION_MAC_ADDR_METHOD 0x08 /* MAC addr method 0-locally administred 1-globally unique addrs */ -#define HI_OPTION_ENABLE_RFKILL 0x10 /* RFKill Enable Feature*/ -#define HI_OPTION_ENABLE_PROFILE 0x20 /* Enable CPU profiling */ -#define HI_OPTION_DISABLE_DBGLOG 0x40 /* Disable debug logging */ -#define HI_OPTION_SKIP_ERA_TRACKING 0x80 /* Skip Era Tracking */ -#define HI_OPTION_PAPRD_DISABLE 0x100 /* Disable PAPRD (debug) */ -#define HI_OPTION_NUM_DEV_LSB 0x200 -#define HI_OPTION_NUM_DEV_MSB 0x800 -#define HI_OPTION_DEV_MODE_LSB 0x1000 -#define HI_OPTION_DEV_MODE_MSB 0x8000000 -#define HI_OPTION_NO_LFT_STBL 0x10000000 /* Disable LowFreq Timer Stabilization */ -#define HI_OPTION_SKIP_REG_SCAN 0x20000000 /* Skip regulatory scan */ -#define HI_OPTION_INIT_REG_SCAN 0x40000000 /* Do regulatory scan during init before sending WMI ready event to host */ -#define HI_OPTION_FW_BRIDGE 0x80000000 - -#define HI_OPTION_OFFLOAD_AMSDU 0x01 -#define HI_OPTION_MAC_ADDR_METHOD_SHIFT 3 - -/* 2 bits of hi_option_flag are used to represent 3 modes */ -#define HI_OPTION_FW_MODE_IBSS 0x0 /* IBSS Mode */ -#define HI_OPTION_FW_MODE_BSS_STA 0x1 /* STA Mode */ -#define HI_OPTION_FW_MODE_AP 0x2 /* AP Mode */ -#define HI_OPTION_FW_MODE_BT30AMP 0x3 /* BT30 AMP Mode */ - -/* 2 bits of hi_option flag are usedto represent 4 submodes */ -#define HI_OPTION_FW_SUBMODE_NONE 0x0 /* Normal mode */ -#define HI_OPTION_FW_SUBMODE_P2PDEV 0x1 /* p2p device mode */ -#define HI_OPTION_FW_SUBMODE_P2PCLIENT 0x2 /* p2p client mode */ -#define HI_OPTION_FW_SUBMODE_P2PGO 0x3 /* p2p go mode */ - -/* Num dev Mask */ -#define HI_OPTION_NUM_DEV_MASK 0x7 -#define HI_OPTION_NUM_DEV_SHIFT 0x9 - -#define HI_OPTION_RF_KILL_SHIFT 0x4 -#define HI_OPTION_RF_KILL_MASK 0x1 - -/* firmware bridging */ -#define HI_OPTION_FW_BRIDGE_SHIFT 0x1f - -/* Fw Mode/SubMode Mask -|-------------------------------------------------------------------------------| -| SUB | SUB | SUB | SUB | | | | | -| MODE[3] | MODE[2] | MODE[1] | MODE[0] | MODE[3] | MODE[2] | MODE[1] | MODE[0] | -| (2) | (2) | (2) | (2) | (2) | (2) | (2) | (2) | -|-------------------------------------------------------------------------------| -*/ -#define HI_OPTION_FW_MODE_BITS 0x2 -#define HI_OPTION_FW_MODE_MASK 0x3 -#define HI_OPTION_FW_MODE_SHIFT 0xC -#define HI_OPTION_ALL_FW_MODE_MASK 0xFF - -#define HI_OPTION_FW_SUBMODE_BITS 0x2 -#define HI_OPTION_FW_SUBMODE_MASK 0x3 -#define HI_OPTION_FW_SUBMODE_SHIFT 0x14 -#define HI_OPTION_ALL_FW_SUBMODE_MASK 0xFF00 -#define HI_OPTION_ALL_FW_SUBMODE_SHIFT 0x8 - -/* hi_reset_flag */ -#define HI_RESET_FLAG_PRESERVE_APP_START 0x01 /* preserve App Start address */ -#define HI_RESET_FLAG_PRESERVE_HOST_INTEREST 0x02 /* preserve host interest */ -#define HI_RESET_FLAG_PRESERVE_ROMDATA 0x04 /* preserve ROM data */ -#define HI_RESET_FLAG_PRESERVE_NVRAM_STATE 0x08 - -#define HI_RESET_FLAG_IS_VALID 0x12345678 /* indicate the reset flag is valid */ - -#define ON_RESET_FLAGS_VALID() \ - (HOST_INTEREST->hi_reset_flag_valid == HI_RESET_FLAG_IS_VALID) - -#define RESET_FLAGS_VALIDATE() \ - (HOST_INTEREST->hi_reset_flag_valid = HI_RESET_FLAG_IS_VALID) - -#define RESET_FLAGS_INVALIDATE() \ - (HOST_INTEREST->hi_reset_flag_valid = 0) - -#define ON_RESET_PRESERVE_APP_START() \ - (HOST_INTEREST->hi_reset_flag & HI_RESET_FLAG_PRESERVE_APP_START) - -#define ON_RESET_PRESERVE_NVRAM_STATE() \ - (HOST_INTEREST->hi_reset_flag & HI_RESET_FLAG_PRESERVE_NVRAM_STATE) - -#define ON_RESET_PRESERVE_HOST_INTEREST() \ - (HOST_INTEREST->hi_reset_flag & HI_RESET_FLAG_PRESERVE_HOST_INTEREST) - -#define ON_RESET_PRESERVE_ROMDATA() \ - (HOST_INTEREST->hi_reset_flag & HI_RESET_FLAG_PRESERVE_ROMDATA) - -#define HI_ACS_FLAGS_ENABLED (1 << 0) /* ACS is enabled */ -#define HI_ACS_FLAGS_USE_WWAN (1 << 1) /* Use physical WWAN device */ -#define HI_ACS_FLAGS_TEST_VAP (1 << 2) /* Use test VAP */ - -/* CONSOLE FLAGS - * - * Bit Range Meaning - * --------- -------------------------------- - * 2..0 UART ID (0 = Default) - * 3 Baud Select (0 = 9600, 1 = 115200) - * 30..4 Reserved - * 31 Enable Console - * - * */ - -#define HI_CONSOLE_FLAGS_ENABLE (1 << 31) -#define HI_CONSOLE_FLAGS_UART_MASK (0x7) -#define HI_CONSOLE_FLAGS_UART_SHIFT 0 -#define HI_CONSOLE_FLAGS_BAUD_SELECT (1 << 3) - -/* - * Intended for use by Host software, this macro returns the Target RAM - * address of any item in the host_interest structure. - * Example: target_addr = AR6002_HOST_INTEREST_ITEM_ADDRESS(hi_board_data); - */ -#define AR6002_HOST_INTEREST_ITEM_ADDRESS(item) \ - (A_UINT32)((unsigned long)&((((struct host_interest_s *)(AR6002_HOST_INTEREST_ADDRESS))->item))) - -#define AR6003_HOST_INTEREST_ITEM_ADDRESS(item) \ - (A_UINT32)((unsigned long)&((((struct host_interest_s *)(AR6003_HOST_INTEREST_ADDRESS))->item))) - -#define MCKINLEY_HOST_INTEREST_ITEM_ADDRESS(item) \ - ((A_UINT32)&((((struct host_interest_s *)(MCKINLEY_HOST_INTEREST_ADDRESS))->item))) - -#define HOST_INTEREST_DBGLOG_IS_ENABLED() \ - (!(HOST_INTEREST->hi_option_flag & HI_OPTION_DISABLE_DBGLOG)) - -#define HOST_INTEREST_PROFILE_IS_ENABLED() \ - (HOST_INTEREST->hi_option_flag & HI_OPTION_ENABLE_PROFILE) - -#define LF_TIMER_STABILIZATION_IS_ENABLED() \ - (!(HOST_INTEREST->hi_option_flag & HI_OPTION_NO_LFT_STBL)) - -#define IS_AMSDU_OFFLAOD_ENABLED() \ - ((HOST_INTEREST->hi_option_flag2 & HI_OPTION_OFFLOAD_AMSDU)) - -/* Convert a Target virtual address into a Target physical address */ -#define AR6002_VTOP(vaddr) ((vaddr) & 0x001fffff) -#define AR6003_VTOP(vaddr) ((vaddr) & 0x001fffff) -#define MCKINLEY_VTOP(vaddr) (vaddr) -#define TARG_VTOP(TargetType, vaddr) \ - (((TargetType) == TARGET_TYPE_AR6002) ? AR6002_VTOP(vaddr) : \ - (((TargetType) == TARGET_TYPE_AR6003) ? AR6003_VTOP(vaddr) : \ - (((TargetType) == TARGET_TYPE_MCKINLEY) ? MCKINLEY_VTOP(vaddr) : 0))) - -#define HOST_INTEREST_ITEM_ADDRESS(TargetType, item) \ - (((TargetType) == TARGET_TYPE_AR6002) ? AR6002_HOST_INTEREST_ITEM_ADDRESS(item) : \ - (((TargetType) == TARGET_TYPE_AR6003) ? AR6003_HOST_INTEREST_ITEM_ADDRESS(item) : \ - (((TargetType) == TARGET_TYPE_MCKINLEY) ? MCKINLEY_HOST_INTEREST_ITEM_ADDRESS(item) : 0))) - -/* override REV2 ROM's app start address */ -#define AR6002_REV2_APP_START_OVERRIDE 0x911A00 -#define AR6002_REV2_DATASET_PATCH_ADDRESS 0x52d8b0 -#define AR6002_REV2_APP_LOAD_ADDRESS 0x502070 - -#define AR6003_REV2_APP_START_OVERRIDE 0x944C00 -#define AR6003_REV2_APP_LOAD_ADDRESS 0x543180 -#define AR6003_REV2_BOARD_EXT_DATA_ADDRESS 0x57E500 -#define AR6003_REV2_DATASET_PATCH_ADDRESS 0x57e884 -#define AR6003_REV2_RAM_RESERVE_SIZE 6912 - -#define AR6003_REV3_APP_START_OVERRIDE 0x945d00 -#define AR6003_REV3_APP_LOAD_ADDRESS 0x545000 -#define AR6003_REV3_BOARD_EXT_DATA_ADDRESS 0x542330 -#define AR6003_REV3_DATASET_PATCH_ADDRESS 0x57FF74 -#define AR6003_REV3_RAM_RESERVE_SIZE 4352 - -/* # of A_UINT32 entries in targregs, used by DIAG_FETCH_TARG_REGS */ -#define AR6003_FETCH_TARG_REGS_COUNT 64 -#define MCKINLEY_FETCH_TARG_REGS_COUNT 64 - -#endif /* !__ASSEMBLER__ */ - -#ifndef ATH_TARGET -#include "athendpack.h" -#endif - -#endif /* __TARGADDRS_H__ */ diff --git a/drivers/net/wireless/ar6003/include/testcmd.h b/drivers/net/wireless/ar6003/include/testcmd.h deleted file mode 100644 index 28100a1aa43d..000000000000 --- a/drivers/net/wireless/ar6003/include/testcmd.h +++ /dev/null @@ -1,247 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef TESTCMD_H_ -#define TESTCMD_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef AR6002_REV2 -#define TCMD_MAX_RATES 12 -#else -#define TCMD_MAX_RATES 28 -#endif - -#define WMI_CMD_ID_SIZE 4 -#define WMI_CMDS_SIZE_MAX 2048 -#define TC_CMDS_GAP 16 -// should add up to the same size as buf[WMI_CMDS_SIZE_MAX] -//#define TC_CMDS_SIZE_MAX (WMI_CMDS_SIZE_MAX - sizeof(TC_CMDS_HDR) - WMI_CMD_ID_SIZE - TC_CMDS_GAP) -#define TC_CMDS_SIZE_MAX 256 - -typedef enum { - ZEROES_PATTERN = 0, - ONES_PATTERN, - REPEATING_10, - PN7_PATTERN, - PN9_PATTERN, - PN15_PATTERN -}TX_DATA_PATTERN; - -/* Continous tx - mode : TCMD_CONT_TX_OFF - Disabling continous tx - TCMD_CONT_TX_SINE - Enable continuous unmodulated tx - TCMD_CONT_TX_FRAME- Enable continuous modulated tx - freq : Channel freq in Mhz. (e.g 2412 for channel 1 in 11 g) -dataRate: 0 - 1 Mbps - 1 - 2 Mbps - 2 - 5.5 Mbps - 3 - 11 Mbps - 4 - 6 Mbps - 5 - 9 Mbps - 6 - 12 Mbps - 7 - 18 Mbps - 8 - 24 Mbps - 9 - 36 Mbps - 10 - 28 Mbps - 11 - 54 Mbps - txPwr: twice the Tx power in dBm, actual dBm values of [5 -11] for unmod Tx, - [5-14] for mod Tx -antenna: 1 - one antenna - 2 - two antenna -Note : Enable/disable continuous tx test cmd works only when target is awake. -*/ - -typedef enum { - TCMD_CONT_TX_OFF = 0, - TCMD_CONT_TX_SINE, - TCMD_CONT_TX_FRAME, - TCMD_CONT_TX_TX99, - TCMD_CONT_TX_TX100 -} TCMD_CONT_TX_MODE; - -typedef enum { - TCMD_WLAN_MODE_NOHT = 0, - TCMD_WLAN_MODE_HT20 = 1, - TCMD_WLAN_MODE_HT40PLUS = 2, - TCMD_WLAN_MODE_HT40MINUS = 3, - TCMD_WLAN_MODE_CCK = 4, - - TCMD_WLAN_MODE_MAX, - TCMD_WLAN_MODE_INVALID = TCMD_WLAN_MODE_MAX, - -} TCMD_WLAN_MODE; - -typedef PREPACK struct { - A_UINT32 testCmdId; - A_UINT32 mode; - A_UINT32 freq; - A_UINT32 dataRate; - A_INT32 txPwr; - A_UINT32 antenna; - A_UINT32 enANI; - A_UINT32 scramblerOff; - A_UINT32 aifsn; - A_UINT16 pktSz; - A_UINT16 txPattern; - A_UINT32 shortGuard; - A_UINT32 numPackets; - A_UINT32 wlanMode; -} POSTPACK TCMD_CONT_TX; - -#define TCMD_TXPATTERN_ZERONE 0x1 -#define TCMD_TXPATTERN_ZERONE_DIS_SCRAMBLE 0x2 - -/* Continuous Rx - act: TCMD_CONT_RX_PROMIS - promiscuous mode (accept all incoming frames) - TCMD_CONT_RX_FILTER - filter mode (accept only frames with dest - address equal specified - mac address (set via act =3) - TCMD_CONT_RX_REPORT off mode (disable cont rx mode and get the - report from the last cont - Rx test) - - TCMD_CONT_RX_SETMAC - set MacAddr mode (sets the MAC address for the - target. This Overrides - the default MAC address.) - -*/ -typedef enum { - TCMD_CONT_RX_PROMIS =0, - TCMD_CONT_RX_FILTER, - TCMD_CONT_RX_REPORT, - TCMD_CONT_RX_SETMAC, - TCMD_CONT_RX_SET_ANT_SWITCH_TABLE, - - TC_CMD_RESP, -} TCMD_CONT_RX_ACT; - -typedef PREPACK struct { - A_UINT32 testCmdId; - A_UINT32 act; - A_UINT32 enANI; - PREPACK union { - struct PREPACK TCMD_CONT_RX_PARA { - A_UINT32 freq; - A_UINT32 antenna; - A_UINT32 wlanMode; - } POSTPACK para; - struct PREPACK TCMD_CONT_RX_REPORT { - A_UINT32 totalPkt; - A_INT32 rssiInDBm; - A_UINT32 crcErrPkt; - A_UINT32 secErrPkt; - A_UINT16 rateCnt[TCMD_MAX_RATES]; - A_UINT16 rateCntShortGuard[TCMD_MAX_RATES]; - } POSTPACK report; - struct PREPACK TCMD_CONT_RX_MAC { - A_UCHAR addr[ATH_MAC_LEN]; - A_UCHAR btaddr[ATH_MAC_LEN]; - A_UINT16 regDmn[2]; - A_UINT32 otpWriteFlag; - } POSTPACK mac; - struct PREPACK TCMD_CONT_RX_ANT_SWITCH_TABLE { - A_UINT32 antswitch1; - A_UINT32 antswitch2; - }POSTPACK antswitchtable; - } POSTPACK u; -} POSTPACK TCMD_CONT_RX; - -/* Force sleep/wake test cmd - mode: TCMD_PM_WAKEUP - Wakeup the target - TCMD_PM_SLEEP - Force the target to sleep. - */ -typedef enum { - TCMD_PM_WAKEUP = 1, /* be consistent with target */ - TCMD_PM_SLEEP, - TCMD_PM_DEEPSLEEP -} TCMD_PM_MODE; - -typedef PREPACK struct { - A_UINT32 testCmdId; - A_UINT32 mode; -} POSTPACK TCMD_PM; - -typedef enum { - TC_CMDS_VERSION_RESERVED=0, - TC_CMDS_VERSION_MDK, - TC_CMDS_VERSION_TS, - TC_CMDS_VERSION_LAST, -} TC_CMDS_VERSION; - -typedef enum { - TC_CMDS_TS =0, - TC_CMDS_CAL, -} TC_CMDS_ACT; - -typedef PREPACK struct { - A_UINT32 testCmdId; - A_UINT32 act; - PREPACK union { - A_UINT32 enANI; // to be identical to CONT_RX struct - struct PREPACK { - A_UINT16 length; - A_UINT8 version; - A_UINT8 reserved; - } POSTPACK parm; - } POSTPACK u; -} POSTPACK TC_CMDS_HDR; - -typedef PREPACK struct { - TC_CMDS_HDR hdr; - A_UINT8 buf[TC_CMDS_SIZE_MAX]; -} POSTPACK TC_CMDS; - -typedef PREPACK struct { - A_UINT32 testCmdId; - A_UINT32 regAddr; - A_UINT32 val; - A_UINT16 flag; -} POSTPACK TCMD_SET_REG; - -typedef enum { - TCMD_CONT_TX_ID, - TCMD_CONT_RX_ID, - TCMD_PM_ID, - TC_CMDS_ID, - TCMD_SET_REG_ID, -} TCMD_ID; - -typedef PREPACK union { - TCMD_CONT_TX contTx; - TCMD_CONT_RX contRx; - TCMD_PM pm; - // New test cmds from ART/MDK ... - TC_CMDS tcCmds; - TCMD_SET_REG setReg; -} POSTPACK TEST_CMD; - -#ifdef __cplusplus -} -#endif - -#endif /* TESTCMD_H_ */ - - diff --git a/drivers/net/wireless/ar6003/include/tlpm.h b/drivers/net/wireless/ar6003/include/tlpm.h deleted file mode 100644 index 659b1c07ba90..000000000000 --- a/drivers/net/wireless/ar6003/include/tlpm.h +++ /dev/null @@ -1,38 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef __TLPM_H__ -#define __TLPM_H__ - -/* idle timeout in 16-bit value as in HOST_INTEREST hi_hci_uart_pwr_mgmt_params */ -#define TLPM_DEFAULT_IDLE_TIMEOUT_MS 1000 -/* hex in LSB and MSB for HCI command */ -#define TLPM_DEFAULT_IDLE_TIMEOUT_LSB 0xE8 -#define TLPM_DEFAULT_IDLE_TIMEOUT_MSB 0x3 - -/* wakeup timeout in 8-bit value as in HOST_INTEREST hi_hci_uart_pwr_mgmt_params */ -#define TLPM_DEFAULT_WAKEUP_TIMEOUT_MS 10 - -/* default UART FC polarity is low */ -#define TLPM_DEFAULT_UART_FC_POLARITY 0 - -#endif diff --git a/drivers/net/wireless/ar6003/include/wac_defs.h b/drivers/net/wireless/ar6003/include/wac_defs.h deleted file mode 100644 index b32c6846ef84..000000000000 --- a/drivers/net/wireless/ar6003/include/wac_defs.h +++ /dev/null @@ -1,56 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef __WAC_API_H__ -#define __WAC_API_H__ - -typedef enum { - WAC_SET, - WAC_GET, -} WAC_REQUEST_TYPE; - -typedef enum { - WAC_ADD, - WAC_DEL, - WAC_GET_STATUS, - WAC_GET_IE, -} WAC_COMMAND; - -typedef enum { - PRBREQ, - PRBRSP, - BEACON, -} WAC_FRAME_TYPE; - -typedef enum { - WAC_FAILED_NO_WAC_AP = -4, - WAC_FAILED_LOW_RSSI = -3, - WAC_FAILED_INVALID_PARAM = -2, - WAC_FAILED_REJECTED = -1, - WAC_SUCCESS = 0, - WAC_DISABLED = 1, - WAC_PROCEED_FIRST_PHASE, - WAC_PROCEED_SECOND_PHASE, -} WAC_STATUS; - - -#endif diff --git a/drivers/net/wireless/ar6003/include/wlan_defs.h b/drivers/net/wireless/ar6003/include/wlan_defs.h deleted file mode 100644 index eee7195d09db..000000000000 --- a/drivers/net/wireless/ar6003/include/wlan_defs.h +++ /dev/null @@ -1,85 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== -#ifndef __WLAN_DEFS_H__ -#define __WLAN_DEFS_H__ - -/* - * This file contains WLAN definitions that may be used across both - * Host and Target software. - */ - -typedef enum { - MODE_11A = 0, /* 11a Mode */ - MODE_11G = 1, /* 11b/g Mode */ - MODE_11B = 2, /* 11b Mode */ - MODE_11GONLY = 3, /* 11g only Mode */ -#ifdef SUPPORT_11N - MODE_11NA_HT20 = 4, /* 11a HT20 mode */ - MODE_11NG_HT20 = 5, /* 11g HT20 mode */ - MODE_11NA_HT40 = 6, /* 11a HT40 mode */ - MODE_11NG_HT40 = 7, /* 11g HT40 mode */ - MODE_UNKNOWN = 8, - MODE_MAX = 8 -#else - MODE_UNKNOWN = 4, - MODE_MAX = 4 -#endif -} WLAN_PHY_MODE; - -typedef enum { - WLAN_11A_CAPABILITY = 1, - WLAN_11G_CAPABILITY = 2, - WLAN_11AG_CAPABILITY = 3, -}WLAN_CAPABILITY; - -#ifdef SUPPORT_11N -#ifdef SUPPORT_2SS -typedef A_UINT64 A_RATEMASK; -#else -typedef unsigned long A_RATEMASK; -#endif /* SUPPORT_2SS */ -#else -typedef unsigned short A_RATEMASK; -#endif /* SUPPORT_11N */ - -#ifdef SUPPORT_11N -#define IS_MODE_11A(mode) (((mode) == MODE_11A) || \ - ((mode) == MODE_11NA_HT20) || \ - ((mode) == MODE_11NA_HT40)) -#define IS_MODE_11B(mode) ((mode) == MODE_11B) -#define IS_MODE_11G(mode) (((mode) == MODE_11G) || \ - ((mode) == MODE_11GONLY) || \ - ((mode) == MODE_11NG_HT20) || \ - ((mode) == MODE_11NG_HT40)) -#define IS_MODE_11GN(mode) (((mode) == MODE_11NG_HT20) || \ - ((mode) == MODE_11NG_HT40)) -#define IS_MODE_11GONLY(mode) ((mode) == MODE_11GONLY) -#else -#define IS_MODE_11A(mode) ((mode) == MODE_11A) -#define IS_MODE_11B(mode) ((mode) == MODE_11B) -#define IS_MODE_11G(mode) (((mode) == MODE_11G) || \ - ((mode) == MODE_11GONLY)) -#define IS_MODE_11GONLY(mode) ((mode) == MODE_11GONLY) -#endif /* SUPPORT_11N */ - -#endif /* __WLANDEFS_H__ */ diff --git a/drivers/net/wireless/ar6003/include/wlan_dset.h b/drivers/net/wireless/ar6003/include/wlan_dset.h deleted file mode 100644 index 864a60cedf10..000000000000 --- a/drivers/net/wireless/ar6003/include/wlan_dset.h +++ /dev/null @@ -1,33 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -#ifndef __WLAN_DSET_H__ -#define __WLAN_DSET_H__ - -typedef PREPACK struct wow_config_dset { - - A_UINT8 valid_dset; - A_UINT8 gpio_enable; - A_UINT16 gpio_pin; -} POSTPACK WOW_CONFIG_DSET; - -#endif diff --git a/drivers/net/wireless/ar6003/include/wmi.h b/drivers/net/wireless/ar6003/include/wmi.h deleted file mode 100644 index 0c32588543e8..000000000000 --- a/drivers/net/wireless/ar6003/include/wmi.h +++ /dev/null @@ -1,3834 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -/* - * This file contains the definitions of the WMI protocol specified in the - * Wireless Module Interface (WMI). It includes definitions of all the - * commands and events. Commands are messages from the host to the WM. - * Events and Replies are messages from the WM to the host. - * - * Ownership of correctness in regards to commands - * belongs to the host driver and the WMI is not required to validate - * parameters for value, proper range, or any other checking. - * - */ - -#ifndef _WMI_H_ -#define _WMI_H_ - -#ifndef ATH_TARGET -#include "athstartpack.h" -#endif - -#include "wmix.h" -#include "wlan_defs.h" -#include "dfs_common.h" -#ifdef __cplusplus -extern "C" { -#endif - -#define HTC_PROTOCOL_VERSION 0x0002 -#define HTC_PROTOCOL_REVISION 0x0000 - -#define WMI_PROTOCOL_VERSION 0x0002 -#define WMI_PROTOCOL_REVISION 0x0000 - -#define ATH_MAC_LEN 6 /* length of mac in bytes */ -#define WMI_CMD_MAX_LEN 100 -#define WMI_CONTROL_MSG_MAX_LEN 256 -#define WMI_OPT_CONTROL_MSG_MAX_LEN 1536 -#define IS_ETHERTYPE(_typeOrLen) ((_typeOrLen) >= 0x0600) -#define RFC1042OUI {0x00, 0x00, 0x00} - -#define IP_ETHERTYPE 0x0800 - -#define WMI_IMPLICIT_PSTREAM 0xFF -#define WMI_MAX_THINSTREAM 15 - -#ifdef AR6002_REV2 -#define IBSS_MAX_NUM_STA 4 -#else -#define IBSS_MAX_NUM_STA 8 -#endif - -#define WMI_MODE_MAX 8 -#define WMI_MAX_RATE_MASK 2 - -PREPACK struct host_app_area_s { - A_UINT32 wmi_protocol_ver; -} POSTPACK; - -/* - * Data Path - */ -typedef PREPACK struct { - A_UINT8 dstMac[ATH_MAC_LEN]; - A_UINT8 srcMac[ATH_MAC_LEN]; - A_UINT16 typeOrLen; -} POSTPACK ATH_MAC_HDR; - -typedef PREPACK struct { - A_UINT8 dsap; - A_UINT8 ssap; - A_UINT8 cntl; - A_UINT8 orgCode[3]; - A_UINT16 etherType; -} POSTPACK ATH_LLC_SNAP_HDR; - -typedef enum { - DATA_MSGTYPE = 0x0, - CNTL_MSGTYPE, - SYNC_MSGTYPE, - OPT_MSGTYPE, -} WMI_MSG_TYPE; - - -/* - * Macros for operating on WMI_DATA_HDR (info) field - */ - -#define WMI_DATA_HDR_MSG_TYPE_MASK 0x03 -#define WMI_DATA_HDR_MSG_TYPE_SHIFT 0 -#define WMI_DATA_HDR_UP_MASK 0x07 -#define WMI_DATA_HDR_UP_SHIFT 2 -/* In AP mode, the same bit (b5) is used to indicate Power save state in - * the Rx dir and More data bit state in the tx direction. - */ -#define WMI_DATA_HDR_PS_MASK 0x1 -#define WMI_DATA_HDR_PS_SHIFT 5 - -#define WMI_DATA_HDR_MORE_MASK 0x1 -#define WMI_DATA_HDR_MORE_SHIFT 5 - -typedef enum { - WMI_DATA_HDR_DATA_TYPE_802_3 = 0, - WMI_DATA_HDR_DATA_TYPE_802_11, - WMI_DATA_HDR_DATA_TYPE_ACL, -} WMI_DATA_HDR_DATA_TYPE; - -/* Bitmap of data header flags */ -typedef enum { - WMI_DATA_HDR_FLAGS_MORE = 0x1, - WMI_DATA_HDR_FLAGS_EOSP = 0x2, -} WMI_DATA_HDR_FLAGS; - -#define WMI_DATA_HDR_DATA_TYPE_MASK 0x3 -#define WMI_DATA_HDR_DATA_TYPE_SHIFT 6 - -#define WMI_DATA_HDR_SET_MORE_BIT(h) ((h)->info |= (WMI_DATA_HDR_MORE_MASK << WMI_DATA_HDR_MORE_SHIFT)) -#define WMI_DATA_HDR_HAS_MORE_BIT(h) ((h)->info & (WMI_DATA_HDR_MORE_MASK << WMI_DATA_HDR_MORE_SHIFT)) - -#define WMI_DATA_HDR_IS_MSG_TYPE(h, t) (((h)->info & (WMI_DATA_HDR_MSG_TYPE_MASK)) == (t)) -#define WMI_DATA_HDR_SET_MSG_TYPE(h, t) (h)->info = (((h)->info & ~(WMI_DATA_HDR_MSG_TYPE_MASK << WMI_DATA_HDR_MSG_TYPE_SHIFT)) | (t << WMI_DATA_HDR_MSG_TYPE_SHIFT)) -#define WMI_DATA_HDR_GET_UP(h) (((h)->info >> WMI_DATA_HDR_UP_SHIFT) & WMI_DATA_HDR_UP_MASK) -#define WMI_DATA_HDR_SET_UP(h, p) (h)->info = (((h)->info & ~(WMI_DATA_HDR_UP_MASK << WMI_DATA_HDR_UP_SHIFT)) | (p << WMI_DATA_HDR_UP_SHIFT)) - -#define WMI_DATA_HDR_GET_DATA_TYPE(h) (((h)->info >> WMI_DATA_HDR_DATA_TYPE_SHIFT) & WMI_DATA_HDR_DATA_TYPE_MASK) -#define WMI_DATA_HDR_SET_DATA_TYPE(h, p) (h)->info = (((h)->info & ~(WMI_DATA_HDR_DATA_TYPE_MASK << WMI_DATA_HDR_DATA_TYPE_SHIFT)) | ((p) << WMI_DATA_HDR_DATA_TYPE_SHIFT)) - -#define WMI_DATA_HDR_GET_DOT11(h) (WMI_DATA_HDR_GET_DATA_TYPE((h)) == WMI_DATA_HDR_DATA_TYPE_802_11) -#define WMI_DATA_HDR_SET_DOT11(h, p) WMI_DATA_HDR_SET_DATA_TYPE((h), (p)) - -/* Macros for operating on WMI_DATA_HDR (info2) field */ -#define WMI_DATA_HDR_SEQNO_MASK 0xFFF -#define WMI_DATA_HDR_SEQNO_SHIFT 0 - -#define WMI_DATA_HDR_AMSDU_MASK 0x1 -#define WMI_DATA_HDR_AMSDU_SHIFT 12 - -#define WMI_DATA_HDR_META_MASK 0x7 -#define WMI_DATA_HDR_META_SHIFT 13 - -#define GET_SEQ_NO(_v) ((_v) & WMI_DATA_HDR_SEQNO_MASK) -#define GET_ISMSDU(_v) ((_v) & WMI_DATA_HDR_AMSDU_MASK) - -#define WMI_DATA_HDR_GET_SEQNO(h) GET_SEQ_NO((h)->info2 >> WMI_DATA_HDR_SEQNO_SHIFT) -#define WMI_DATA_HDR_SET_SEQNO(h, _v) ((h)->info2 = ((h)->info2 & ~(WMI_DATA_HDR_SEQNO_MASK << WMI_DATA_HDR_SEQNO_SHIFT)) | (GET_SEQ_NO(_v) << WMI_DATA_HDR_SEQNO_SHIFT)) - -#define WMI_DATA_HDR_IS_AMSDU(h) GET_ISMSDU((h)->info2 >> WMI_DATA_HDR_AMSDU_SHIFT) -#define WMI_DATA_HDR_SET_AMSDU(h, _v) ((h)->info2 = ((h)->info2 & ~(WMI_DATA_HDR_AMSDU_MASK << WMI_DATA_HDR_AMSDU_SHIFT)) | (GET_ISMSDU(_v) << WMI_DATA_HDR_AMSDU_SHIFT)) - -#define WMI_DATA_HDR_GET_META(h) (((h)->info2 >> WMI_DATA_HDR_META_SHIFT) & WMI_DATA_HDR_META_MASK) -#define WMI_DATA_HDR_SET_META(h, _v) ((h)->info2 = ((h)->info2 & ~(WMI_DATA_HDR_META_MASK << WMI_DATA_HDR_META_SHIFT)) | ((_v) << WMI_DATA_HDR_META_SHIFT)) - -/* Macros for operating on WMI_DATA_HDR (info3) field */ -#define WMI_DATA_HDR_DEVID_MASK 0xF -#define WMI_DATA_HDR_DEVID_SHIFT 0 -#define GET_DEVID(_v) ((_v) & WMI_DATA_HDR_DEVID_MASK) - -#define WMI_DATA_HDR_GET_DEVID(h) (((h)->info3 >> WMI_DATA_HDR_DEVID_SHIFT) & WMI_DATA_HDR_DEVID_MASK) -#define WMI_DATA_HDR_SET_DEVID(h, _v) ((h)->info3 = ((h)->info3 & ~(WMI_DATA_HDR_DEVID_MASK << WMI_DATA_HDR_DEVID_SHIFT)) | (GET_DEVID(_v) << WMI_DATA_HDR_DEVID_SHIFT)) - -#define WMI_DATA_HDR_TRIGGER_MASK 0x1 -#define WMI_DATA_HDR_TRIGGER_SHIFT 4 -#define WMI_DATA_HDR_SET_TRIGGER(h, _v) ((h)->info3 = ((h)->info3 & ~(WMI_DATA_HDR_TRIGGER_MASK << WMI_DATA_HDR_TRIGGER_SHIFT)) | ((_v) << WMI_DATA_HDR_TRIGGER_SHIFT)) -#define WMI_DATA_HDR_IS_TRIGGER(h) ((((h)->info3 >> WMI_DATA_HDR_TRIGGER_SHIFT) & WMI_DATA_HDR_TRIGGER_MASK) == WMI_DATA_HDR_TRIGGER_MASK) - -#define WMI_DATA_HDR_EOSP_MASK WMI_DATA_HDR_TRIGGER_MASK -#define WMI_DATA_HDR_EOSP_SHIFT WMI_DATA_HDR_TRIGGER_SHIFT - -#define WMI_DATA_HDR_SET_EOSP_BIT(h) ((h)->info3 |= (WMI_DATA_HDR_EOSP_MASK << WMI_DATA_HDR_EOSP_SHIFT)) -#define WMI_DATA_HDR_HAS_EOSP_BIT(h) ((h)->info3 & (WMI_DATA_HDR_EOSP_MASK << WMI_DATA_HDR_EOSP_SHIFT)) - -typedef PREPACK struct { - A_INT8 rssi; - A_UINT8 info; /* usage of 'info' field(8-bit): - * b1:b0 - WMI_MSG_TYPE - * b4:b3:b2 - UP(tid) - * b5 - Used in AP mode. More-data in tx dir, PS in rx. - * b7:b6 - Dot3 header(0), - * Dot11 Header(1), - * ACL data(2) - */ - - A_UINT16 info2; /* usage of 'info2' field(16-bit): - * b11:b0 - seq_no - * b12 - A-MSDU? - * b15:b13 - META_DATA_VERSION 0 - 7 - */ - A_UINT16 info3; /* b3:b2:b1:b0 - device id - * b4 - Used in AP mode. uAPSD trigger in rx, EOSP in tx - */ -} POSTPACK WMI_DATA_HDR; - -/* - * TX META VERSION DEFINITIONS - */ -#define WMI_MAX_TX_META_SZ (12) -#define WMI_MAX_TX_META_VERSION (7) -#define WMI_META_VERSION_1 (0x01) -#define WMI_META_VERSION_2 (0X02) -#define WMI_META_VERSION_3 (0x03) - -#define WMI_ACL_TO_DOT11_HEADROOM 36 - -#if 0 /* removed to prevent compile errors for WM.. */ -typedef PREPACK struct { -/* intentionally empty. Default version is no meta data. */ -} POSTPACK WMI_TX_META_V0; -#endif - -typedef PREPACK struct { - A_UINT8 pktID; /* The packet ID to identify the tx request */ - A_UINT8 ratePolicyID; /* The rate policy to be used for the tx of this frame */ -} POSTPACK WMI_TX_META_V1; - - -#define WMI_CSUM_DIR_TX (0x1) -#define TX_CSUM_CALC_FILL (0x1) -typedef PREPACK struct { - A_UINT8 csumStart; /*Offset from start of the Payload(SNAP header) for csum calculation to begin */ - A_UINT8 csumDest; /*Offset from start of Payload(SNAP header) where final csum goes*/ - A_UINT8 csumFlags; /*Flag for check sum engine to be offloaded to device*/ -} POSTPACK WMI_TX_META_V2; - -/* WMI_META_TX_FLAG... are used as TX qualifiers for frames containing WMI_TX_RATE_SCHEDULE in the - * meta data. 0 or more of these flags should be assigned to the flags member of the schedule. */ -#define WMI_META_TX_FLAG_ACK 0x01 // frame needs ACK response from receiver -#define WMI_META_TX_FLAG_SET_RETRY_BIT 0x02 // device will set retry bit in MAC header for retried frames. -#define WMI_META_TX_FLAG_SET_DURATION 0x04 // device will fill duration field in MAC header -/* NOTE: If WMI_META_TX_FLAG_USE_PREFIX == 0 device will NOT use prefix frame. - * If WMI_META_TX_FLAG_USE_PREFIX == 1 && WMI_META_TX_FLAG_PREFIX_RTS == 0 device will use CTS prefix. - * If WMI_META_TX_FLAG_USE_PREFIX == 1 && WMI_META_TX_FLAG_PREFIX_RTS == 1 device will use RTS prefix. - */ -#define WMI_META_TX_FLAG_USE_PREFIX 0x08 // device will send either RTS or CTS frame prior to subject frame. -#define WMI_META_TX_FLAG_PREFIX_RTS 0x10 // device will send RTS and wait for CTS prior to sending subject frame. -#define WMI_META_TX_LOAD_TSF 0x20 // device will fill the TSF field during transmit procedure. - -/* WMI_TX_RATE_SCHEDULE - Acts as a host-provided rate schedule to replace what would be normally determined - * by firmware. This allows the host to specify what rates and attempts should be used to transmit the - * frame. */ -typedef PREPACK struct { -#define WMI_TX_MAX_RATE_SERIES (4) - A_UINT8 rateSeries[WMI_TX_MAX_RATE_SERIES]; //rate index for each series. first invalid rate terminates series. - A_UINT8 trySeries[WMI_TX_MAX_RATE_SERIES]; //number of tries for each series. - A_UINT8 flags; // combination of WMI_META_TX_FLAG... - A_UINT8 accessCategory; // should be WMM_AC_BE for managment frames and multicast frames. - //A_UINT8 keyIndex; - // -}POSTPACK WMI_TX_RATE_SCHEDULE; - -typedef PREPACK struct { - WMI_TX_RATE_SCHEDULE rateSched; - A_UINT8 pktID; /* The packet ID to identify the tx request */ -} POSTPACK WMI_TX_META_V3; - -/* - * RX META VERSION DEFINITIONS - */ -/* if RX meta data is present at all then the meta data field - * will consume WMI_MAX_RX_META_SZ bytes of space between the - * WMI_DATA_HDR and the payload. How much of the available - * Meta data is actually used depends on which meta data - * version is active. */ -#define WMI_MAX_RX_META_SZ (12) -#define WMI_MAX_RX_META_VERSION (7) - -#define WMI_RX_STATUS_OK 0 /* success */ -#define WMI_RX_STATUS_DECRYPT_ERR 1 /* decrypt error */ -#define WMI_RX_STATUS_MIC_ERR 2 /* tkip MIC error */ -#define WMI_RX_STATUS_ERR 3 /* undefined error */ - -#define WMI_RX_FLAGS_AGGR 0x0001 /* part of AGGR */ -#define WMI_RX_FlAGS_STBC 0x0002 /* used STBC */ -#define WMI_RX_FLAGS_SGI 0x0004 /* used SGI */ -#define WMI_RX_FLAGS_HT 0x0008 /* is HT packet */ -/* the flags field is also used to store the CRYPTO_TYPE of the frame - * that value is shifted by WMI_RX_FLAGS_CRYPTO_SHIFT */ -#define WMI_RX_FLAGS_CRYPTO_SHIFT 4 -#define WMI_RX_FLAGS_CRYPTO_MASK 0x1f -#define WMI_RX_META_GET_CRYPTO(flags) (((flags) >> WMI_RX_FLAGS_CRYPTO_SHIFT) & WMI_RX_FLAGS_CRYPTO_MASK) - -#if 0 /* removed to prevent compile errors for WM.. */ -typedef PREPACK struct { -/* intentionally empty. Default version is no meta data. */ -} POSTPACK WMI_RX_META_VERSION_0; -#endif - -typedef PREPACK struct { - A_UINT8 status; /* one of WMI_RX_STATUS_... */ - A_UINT8 rix; /* rate index mapped to rate at which this packet was received. */ - A_UINT8 rssi; /* rssi of packet */ - A_UINT8 channel;/* rf channel during packet reception */ - A_UINT16 flags; /* a combination of WMI_RX_FLAGS_... */ -} POSTPACK WMI_RX_META_V1; - -#define RX_CSUM_VALID_FLAG (0x1) -typedef PREPACK struct { - A_UINT16 csum; - A_UINT8 csumFlags;/* bit 0 set -partial csum valid - bit 1 set -test mode */ -} POSTPACK WMI_RX_META_V2; - - - -#define WMI_GET_DEVICE_ID(info1) ((info1) & 0xF) -/* Macros for operating on WMI_CMD_HDR (info1) field */ -#define WMI_CMD_HDR_DEVID_MASK 0xF -#define WMI_CMD_HDR_DEVID_SHIFT 0 -#define GET_CMD_DEVID(_v) ((_v) & WMI_CMD_HDR_DEVID_MASK) - -#define WMI_CMD_HDR_GET_DEVID(h) (((h)->info1 >> WMI_CMD_HDR_DEVID_SHIFT) & WMI_CMD_HDR_DEVID_MASK) -#define WMI_CMD_HDR_SET_DEVID(h, _v) ((h)->info1 = ((h)->info1 & ~(WMI_CMD_HDR_DEVID_MASK << WMI_CMD_HDR_DEVID_SHIFT)) | (GET_CMD_DEVID(_v) << WMI_CMD_HDR_DEVID_SHIFT)) - -/* - * Control Path - */ -typedef PREPACK struct { - A_UINT16 commandId; -/* - * info1 - 16 bits - * b03:b00 - id - * b15:b04 - unused - */ - A_UINT16 info1; - - A_UINT16 reserved; /* For alignment */ -} POSTPACK WMI_CMD_HDR; /* used for commands and events */ - -/* - * List of Commnands - */ -typedef enum { - WMI_CONNECT_CMDID = 0x0001, - WMI_RECONNECT_CMDID, - WMI_DISCONNECT_CMDID, - WMI_SYNCHRONIZE_CMDID, - WMI_CREATE_PSTREAM_CMDID, - WMI_DELETE_PSTREAM_CMDID, - WMI_START_SCAN_CMDID, - WMI_SET_SCAN_PARAMS_CMDID, - WMI_SET_BSS_FILTER_CMDID, - WMI_SET_PROBED_SSID_CMDID, /* 10 */ - WMI_SET_LISTEN_INT_CMDID, - WMI_SET_BMISS_TIME_CMDID, - WMI_SET_DISC_TIMEOUT_CMDID, - WMI_GET_CHANNEL_LIST_CMDID, - WMI_SET_BEACON_INT_CMDID, - WMI_GET_STATISTICS_CMDID, - WMI_SET_CHANNEL_PARAMS_CMDID, - WMI_SET_POWER_MODE_CMDID, - WMI_SET_IBSS_PM_CAPS_CMDID, - WMI_SET_POWER_PARAMS_CMDID, /* 20 */ - WMI_SET_POWERSAVE_TIMERS_POLICY_CMDID, - WMI_ADD_CIPHER_KEY_CMDID, - WMI_DELETE_CIPHER_KEY_CMDID, - WMI_ADD_KRK_CMDID, - WMI_DELETE_KRK_CMDID, - WMI_SET_PMKID_CMDID, - WMI_SET_TX_PWR_CMDID, - WMI_GET_TX_PWR_CMDID, - WMI_SET_ASSOC_INFO_CMDID, - WMI_ADD_BAD_AP_CMDID, /* 30 */ - WMI_DELETE_BAD_AP_CMDID, - WMI_SET_TKIP_COUNTERMEASURES_CMDID, - WMI_RSSI_THRESHOLD_PARAMS_CMDID, - WMI_TARGET_ERROR_REPORT_BITMASK_CMDID, - WMI_SET_ACCESS_PARAMS_CMDID, - WMI_SET_RETRY_LIMITS_CMDID, - WMI_RESERVED1, - WMI_RESERVED2, - WMI_SET_VOICE_PKT_SIZE_CMDID, - WMI_SET_MAX_SP_LEN_CMDID, /* 40 */ - WMI_SET_ROAM_CTRL_CMDID, - WMI_GET_ROAM_TBL_CMDID, - WMI_GET_ROAM_DATA_CMDID, - WMI_ENABLE_RM_CMDID, - WMI_SET_MAX_OFFHOME_DURATION_CMDID, - WMI_EXTENSION_CMDID, /* Non-wireless extensions */ - WMI_SNR_THRESHOLD_PARAMS_CMDID, - WMI_LQ_THRESHOLD_PARAMS_CMDID, - WMI_SET_LPREAMBLE_CMDID, - WMI_SET_RTS_CMDID, /* 50 */ - WMI_CLR_RSSI_SNR_CMDID, - WMI_SET_FIXRATES_CMDID, - WMI_GET_FIXRATES_CMDID, - WMI_SET_AUTH_MODE_CMDID, - WMI_SET_REASSOC_MODE_CMDID, - WMI_SET_WMM_CMDID, - WMI_SET_WMM_TXOP_CMDID, - WMI_TEST_CMDID, - /* COEX AR6002 only*/ - WMI_SET_BT_STATUS_CMDID, - WMI_SET_BT_PARAMS_CMDID, /* 60 */ - - WMI_SET_KEEPALIVE_CMDID, - WMI_GET_KEEPALIVE_CMDID, - WMI_SET_APPIE_CMDID, - WMI_GET_APPIE_CMDID, - WMI_SET_WSC_STATUS_CMDID, - - /* Wake on Wireless */ - WMI_SET_HOST_SLEEP_MODE_CMDID, - WMI_SET_WOW_MODE_CMDID, - WMI_GET_WOW_LIST_CMDID, - WMI_ADD_WOW_PATTERN_CMDID, - WMI_DEL_WOW_PATTERN_CMDID, /* 70 */ - - WMI_SET_FRAMERATES_CMDID, - WMI_SET_AP_PS_CMDID, - WMI_SET_QOS_SUPP_CMDID, - /* WMI_THIN_RESERVED_... mark the start and end - * values for WMI_THIN_RESERVED command IDs. These - * command IDs can be found in wmi_thin.h */ - WMI_THIN_RESERVED_START = 0x8000, - WMI_THIN_RESERVED_END = 0x8fff, - /* - * Developer commands starts at 0xF000 - */ - WMI_SET_BITRATE_CMDID = 0xF000, - WMI_GET_BITRATE_CMDID, - WMI_SET_WHALPARAM_CMDID, - - - /*Should add the new command to the tail for compatible with - * etna. - */ - WMI_SET_MAC_ADDRESS_CMDID, - WMI_SET_AKMP_PARAMS_CMDID, - WMI_SET_PMKID_LIST_CMDID, - WMI_GET_PMKID_LIST_CMDID, - WMI_ABORT_SCAN_CMDID, - WMI_SET_TARGET_EVENT_REPORT_CMDID, - - // Unused - WMI_UNUSED1, - WMI_UNUSED2, - - /* - * AP mode commands - */ - WMI_AP_HIDDEN_SSID_CMDID, /* F00B */ - WMI_AP_SET_NUM_STA_CMDID, - WMI_AP_ACL_POLICY_CMDID, - WMI_AP_ACL_MAC_LIST_CMDID, - WMI_AP_CONFIG_COMMIT_CMDID, - WMI_AP_SET_MLME_CMDID, /* F010 */ - WMI_AP_SET_PVB_CMDID, - WMI_AP_CONN_INACT_CMDID, - WMI_AP_PROT_SCAN_TIME_CMDID, - WMI_AP_SET_COUNTRY_CMDID, - WMI_AP_SET_DTIM_CMDID, - WMI_AP_MODE_STAT_CMDID, - - WMI_SET_IP_CMDID, /* F017 */ - WMI_SET_PARAMS_CMDID, - WMI_SET_MCAST_FILTER_CMDID, - WMI_DEL_MCAST_FILTER_CMDID, - - WMI_ALLOW_AGGR_CMDID, /* F01B */ - WMI_ADDBA_REQ_CMDID, - WMI_DELBA_REQ_CMDID, - WMI_SET_HT_CAP_CMDID, - WMI_SET_HT_OP_CMDID, - WMI_SET_TX_SELECT_RATES_CMDID, - WMI_SET_TX_SGI_PARAM_CMDID, - WMI_SET_RATE_POLICY_CMDID, - - WMI_HCI_CMD_CMDID, /* F023 */ - WMI_RX_FRAME_FORMAT_CMDID, - WMI_SET_THIN_MODE_CMDID, - WMI_SET_BT_WLAN_CONN_PRECEDENCE_CMDID, - - WMI_AP_SET_11BG_RATESET_CMDID, /* F027 */ - WMI_SET_PMK_CMDID, - WMI_MCAST_FILTER_CMDID, - /* COEX CMDID AR6003*/ - WMI_SET_BTCOEX_FE_ANT_CMDID, /* F02A */ - WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMDID, - WMI_SET_BTCOEX_SCO_CONFIG_CMDID, - WMI_SET_BTCOEX_A2DP_CONFIG_CMDID, - WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMDID, - WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMDID, - WMI_SET_BTCOEX_DEBUG_CMDID, - WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID, - WMI_GET_BTCOEX_STATS_CMDID, - WMI_GET_BTCOEX_CONFIG_CMDID, - - WMI_SET_DFS_ENABLE_CMDID, /* F034 */ - WMI_SET_DFS_MINRSSITHRESH_CMDID, - WMI_SET_DFS_MAXPULSEDUR_CMDID, - WMI_DFS_RADAR_DETECTED_CMDID, - - /* P2P CMDS */ - WMI_P2P_SET_CONFIG_CMDID, /* F038 */ - WMI_WPS_SET_CONFIG_CMDID, - WMI_SET_REQ_DEV_ATTR_CMDID, - WMI_P2P_FIND_CMDID, - WMI_P2P_STOP_FIND_CMDID, - WMI_P2P_GO_NEG_START_CMDID, - WMI_P2P_LISTEN_CMDID, - - WMI_CONFIG_TX_MAC_RULES_CMDID, - WMI_SET_PROMISCUOUS_MODE_CMDID,/* F040 */ - WMI_RX_FRAME_FILTER_CMDID, - WMI_SET_CHANNEL_CMDID, - - /* WAC commands */ - WMI_ENABLE_WAC_CMDID, - WMI_WAC_SCAN_REPLY_CMDID, - WMI_WAC_CTRL_REQ_CMDID, - WMI_SET_DIV_PARAMS_CMDID, - - WMI_GET_PMK_CMDID, - WMI_SET_PASSPHRASE_CMDID, - WMI_SEND_ASSOC_RES_CMDID, - WMI_SET_ASSOC_REQ_RELAY_CMDID, - WMI_GET_RFKILL_MODE_CMDID, - WMI_SET_RFKILL_MODE_CMDID, - - /* ACS command, consists of sub-commands */ - WMI_ACS_CTRL_CMDID, - - /* Ultra low power store / recall commands */ - WMI_STORERECALL_CONFIGURE_CMDID, - WMI_STORERECALL_RECALL_CMDID, - WMI_STORERECALL_HOST_READY_CMDID, - WMI_FORCE_TARGET_ASSERT_CMDID, - WMI_SET_EXCESS_TX_RETRY_THRES_CMDID, - - WMI_P2P_GO_NEG_REQ_RSP_CMDID, /* F053 */ - WMI_P2P_GRP_INIT_CMDID, - WMI_P2P_GRP_FORMATION_DONE_CMDID, - WMI_P2P_INVITE_CMDID, - WMI_P2P_INVITE_REQ_RSP_CMDID, - WMI_P2P_PROV_DISC_REQ_CMDID, - WMI_P2P_SET_CMDID, - - WMI_AP_SET_APSD_CMDID, /* F05A */ - WMI_AP_APSD_BUFFERED_TRAFFIC_CMDID, - - WMI_P2P_SDPD_TX_CMDID, /* F05C */ - WMI_P2P_STOP_SDPD_CMDID, - WMI_P2P_CANCEL_CMDID, - -} WMI_COMMAND_ID; - -/* - * Frame Types - */ -typedef enum { - WMI_FRAME_BEACON = 0, - WMI_FRAME_PROBE_REQ, - WMI_FRAME_PROBE_RESP, - WMI_FRAME_ASSOC_REQ, - WMI_FRAME_ASSOC_RESP, - WMI_NUM_MGMT_FRAME -} WMI_MGMT_FRAME_TYPE; - -/* - * Connect Command - */ -typedef enum { - INFRA_NETWORK = 0x01, - ADHOC_NETWORK = 0x02, - ADHOC_CREATOR = 0x04, - AP_NETWORK = 0x10, -} NETWORK_TYPE; - -typedef enum { - SUBTYPE_NONE, - SUBTYPE_BT, - SUBTYPE_P2PDEV, - SUBTYPE_P2PCLIENT, - SUBTYPE_P2PGO, -} NETWORK_SUBTYPE; - -typedef enum { - OPEN_AUTH = 0x01, - SHARED_AUTH = 0x02, - LEAP_AUTH = 0x04, /* different from IEEE_AUTH_MODE definitions */ -} DOT11_AUTH_MODE; - -typedef enum { - WMI_NONE_AUTH = 0x01, - WMI_WPA_AUTH = 0x02, - WMI_WPA2_AUTH = 0x04, - WMI_WPA_PSK_AUTH = 0x08, - WMI_WPA2_PSK_AUTH = 0x10, - WMI_WPA_AUTH_CCKM = 0x20, - WMI_WPA2_AUTH_CCKM = 0x40, -} AUTH_MODE; - -typedef enum { - NONE_CRYPT = 0x01, - WEP_CRYPT = 0x02, - TKIP_CRYPT = 0x04, - AES_CRYPT = 0x08, -#ifdef WAPI_ENABLE - WAPI_CRYPT = 0x10, -#endif /*WAPI_ENABLE*/ -} CRYPTO_TYPE; - -#define WMI_MIN_CRYPTO_TYPE NONE_CRYPT -#define WMI_MAX_CRYPTO_TYPE (AES_CRYPT + 1) - -#ifdef WAPI_ENABLE -#undef WMI_MAX_CRYPTO_TYPE -#define WMI_MAX_CRYPTO_TYPE (WAPI_CRYPT + 1) -#endif /* WAPI_ENABLE */ - -#ifdef WAPI_ENABLE -#define IW_ENCODE_ALG_SM4 0x20 -/* - * Defined this to be some very high bit because it is less likely to be - * clobbered by future changes to the kernel's wireless.h file -*/ -#define IW_AUTH_CIPHER_SMS4 0x40000000 -#endif - -#define WMI_MIN_KEY_INDEX 0 -#define WMI_MAX_KEY_INDEX 3 - -#ifdef WAPI_ENABLE -#undef WMI_MAX_KEY_INDEX -#define WMI_MAX_KEY_INDEX 7 /* wapi grpKey 0-3, prwKey 4-7 */ -#endif /* WAPI_ENABLE */ - -#define WMI_MAX_KEY_LEN 32 - -#define WMI_MAX_SSID_LEN 32 - -typedef enum { - CONNECT_ASSOC_POLICY_USER = 0x0001, - CONNECT_SEND_REASSOC = 0x0002, - CONNECT_IGNORE_WPAx_GROUP_CIPHER = 0x0004, - CONNECT_PROFILE_MATCH_DONE = 0x0008, - CONNECT_IGNORE_AAC_BEACON = 0x0010, - CONNECT_CSA_FOLLOW_BSS = 0x0020, - CONNECT_DO_WPA_OFFLOAD = 0x0040, - CONNECT_DO_NOT_DEAUTH = 0x0080, - CONNECT_WPS_FLAG = 0x0100, - /* AP configuration flags */ - AP_NO_DISASSOC_UPON_DEAUTH = 0x10000 -} WMI_CONNECT_CTRL_FLAGS_BITS; - -#define DEFAULT_CONNECT_CTRL_FLAGS (CONNECT_CSA_FOLLOW_BSS) - -typedef PREPACK struct { - A_UINT8 networkType; - A_UINT8 dot11AuthMode; - A_UINT8 authMode; - A_UINT8 pairwiseCryptoType; - A_UINT8 pairwiseCryptoLen; - A_UINT8 groupCryptoType; - A_UINT8 groupCryptoLen; - A_UINT8 ssidLength; - A_UCHAR ssid[WMI_MAX_SSID_LEN]; - A_UINT16 channel; - A_UINT8 bssid[ATH_MAC_LEN]; - A_UINT32 ctrl_flags; -} POSTPACK WMI_CONNECT_CMD; - - -typedef PREPACK struct { - A_UINT32 divIdleTime; - A_UINT8 antRssiThresh; - A_UINT8 divEnable; - A_UINT16 active_treshold_rate; -} POSTPACK WMI_DIV_PARAMS_CMD; - -/* - * WMI_RECONNECT_CMDID - */ -typedef PREPACK struct { - A_UINT16 channel; /* hint */ - A_UINT8 bssid[ATH_MAC_LEN]; /* mandatory if set */ -} POSTPACK WMI_RECONNECT_CMD; - -/* - * WMI_SET_PMK_CMDID - */ -#define WMI_PMK_LEN 32 -typedef PREPACK struct { - A_UINT8 pmk[WMI_PMK_LEN]; -} POSTPACK WMI_SET_PMK_CMD, WMI_GET_PMK_REPLY; - -/* - * WMI_SET_PASSPHRASE_CMDID - */ -#define WMI_PASSPHRASE_LEN 64 -typedef PREPACK struct { - A_UCHAR ssid[WMI_MAX_SSID_LEN]; - A_UINT8 passphrase[WMI_PASSPHRASE_LEN]; - A_UINT8 ssid_len; - A_UINT8 passphrase_len; -} POSTPACK WMI_SET_PASSPHRASE_CMD; - -/* - * WMI_SET_EXCESS_TX_RETRY_THRES_CMDID - */ -typedef PREPACK struct { - A_UINT32 threshold; -} POSTPACK WMI_SET_EXCESS_TX_RETRY_THRES_CMD; - -/* - * WMI_ADD_CIPHER_KEY_CMDID - */ -typedef enum { - PAIRWISE_USAGE = 0x00, - GROUP_USAGE = 0x01, - TX_USAGE = 0x02, /* default Tx Key - Static WEP only */ -} KEY_USAGE; - -/* - * Bit Flag - * Bit 0 - Initialise TSC - default is Initialize - */ -#define KEY_OP_INIT_TSC 0x01 -#define KEY_OP_INIT_RSC 0x02 -#ifdef WAPI_ENABLE -#define KEY_OP_INIT_WAPIPN 0x10 -#endif /* WAPI_ENABLE */ - -#define KEY_OP_INIT_VAL 0x03 /* Default Initialise the TSC & RSC */ -#define KEY_OP_VALID_MASK 0x03 - -typedef PREPACK struct { - A_UINT8 keyIndex; - A_UINT8 keyType; - A_UINT8 keyUsage; /* KEY_USAGE */ - A_UINT8 keyLength; - A_UINT8 keyRSC[8]; /* key replay sequence counter */ - A_UINT8 key[WMI_MAX_KEY_LEN]; - A_UINT8 key_op_ctrl; /* Additional Key Control information */ - A_UINT8 key_macaddr[ATH_MAC_LEN]; -} POSTPACK WMI_ADD_CIPHER_KEY_CMD; - -/* - * WMI_DELETE_CIPHER_KEY_CMDID - */ -typedef PREPACK struct { - A_UINT8 keyIndex; -} POSTPACK WMI_DELETE_CIPHER_KEY_CMD; - -#define WMI_KRK_LEN 16 -/* - * WMI_ADD_KRK_CMDID - */ -typedef PREPACK struct { - A_UINT8 krk[WMI_KRK_LEN]; -} POSTPACK WMI_ADD_KRK_CMD; - -/* - * WMI_SET_TKIP_COUNTERMEASURES_CMDID - */ -typedef enum { - WMI_TKIP_CM_DISABLE = 0x0, - WMI_TKIP_CM_ENABLE = 0x1, -} WMI_TKIP_CM_CONTROL; - -typedef PREPACK struct { - A_UINT8 cm_en; /* WMI_TKIP_CM_CONTROL */ -} POSTPACK WMI_SET_TKIP_COUNTERMEASURES_CMD; - -/* - * WMI_SET_PMKID_CMDID - */ - -#define WMI_PMKID_LEN 16 - -typedef enum { - PMKID_DISABLE = 0, - PMKID_ENABLE = 1, -} PMKID_ENABLE_FLG; - -typedef PREPACK struct { - A_UINT8 bssid[ATH_MAC_LEN]; - A_UINT8 enable; /* PMKID_ENABLE_FLG */ - A_UINT8 pmkid[WMI_PMKID_LEN]; -} POSTPACK WMI_SET_PMKID_CMD; - -/* - * WMI_START_SCAN_CMD - */ -typedef enum { - WMI_LONG_SCAN = 0, - WMI_SHORT_SCAN = 1, -} WMI_SCAN_TYPE; - -typedef PREPACK struct { - A_BOOL forceFgScan; - A_BOOL isLegacy; /* For Legacy Cisco AP compatibility */ - A_UINT32 homeDwellTime; /* Maximum duration in the home channel(milliseconds) */ - A_UINT32 forceScanInterval; /* Time interval between scans (milliseconds)*/ - A_UINT8 scanType; /* WMI_SCAN_TYPE */ - A_UINT8 numChannels; /* how many channels follow */ - A_UINT16 channelList[1]; /* channels in Mhz */ -} POSTPACK WMI_START_SCAN_CMD; - -/* - * WMI_SET_SCAN_PARAMS_CMDID - */ -#define WMI_SHORTSCANRATIO_DEFAULT 3 -/* - * Warning: ScanCtrlFlag value of 0xFF is used to disable all flags in WMI_SCAN_PARAMS_CMD - * Do not add any more flags to WMI_SCAN_CTRL_FLAG_BITS - */ -typedef enum { - CONNECT_SCAN_CTRL_FLAGS = 0x01, /* set if can scan in the Connect cmd */ - SCAN_CONNECTED_CTRL_FLAGS = 0x02, /* set if scan for the SSID it is */ - /* already connected to */ - ACTIVE_SCAN_CTRL_FLAGS = 0x04, /* set if enable active scan */ - ROAM_SCAN_CTRL_FLAGS = 0x08, /* set if enable roam scan when bmiss and lowrssi */ - REPORT_BSSINFO_CTRL_FLAGS = 0x10, /* set if follows customer BSSINFO reporting rule */ - ENABLE_AUTO_CTRL_FLAGS = 0x20, /* if disabled, target doesn't - scan after a disconnect event */ - ENABLE_SCAN_ABORT_EVENT = 0x40 /* Scan complete event with canceled status will be generated when a scan is prempted before it gets completed */ -} WMI_SCAN_CTRL_FLAGS_BITS; - -#define CAN_SCAN_IN_CONNECT(flags) (flags & CONNECT_SCAN_CTRL_FLAGS) -#define CAN_SCAN_CONNECTED(flags) (flags & SCAN_CONNECTED_CTRL_FLAGS) -#define ENABLE_ACTIVE_SCAN(flags) (flags & ACTIVE_SCAN_CTRL_FLAGS) -#define ENABLE_ROAM_SCAN(flags) (flags & ROAM_SCAN_CTRL_FLAGS) -#define CONFIG_REPORT_BSSINFO(flags) (flags & REPORT_BSSINFO_CTRL_FLAGS) -#define IS_AUTO_SCAN_ENABLED(flags) (flags & ENABLE_AUTO_CTRL_FLAGS) -#define SCAN_ABORT_EVENT_ENABLED(flags) (flags & ENABLE_SCAN_ABORT_EVENT) - -#define DEFAULT_SCAN_CTRL_FLAGS (CONNECT_SCAN_CTRL_FLAGS| SCAN_CONNECTED_CTRL_FLAGS| ACTIVE_SCAN_CTRL_FLAGS| ROAM_SCAN_CTRL_FLAGS | ENABLE_AUTO_CTRL_FLAGS) - - -typedef PREPACK struct { - A_UINT16 fg_start_period; /* seconds */ - A_UINT16 fg_end_period; /* seconds */ - A_UINT16 bg_period; /* seconds */ - A_UINT16 maxact_chdwell_time; /* msec */ - A_UINT16 pas_chdwell_time; /* msec */ - A_UINT8 shortScanRatio; /* how many shorts scan for one long */ - A_UINT8 scanCtrlFlags; - A_UINT16 minact_chdwell_time; /* msec */ - A_UINT16 maxact_scan_per_ssid; /* max active scans per ssid */ - A_UINT32 max_dfsch_act_time; /* msecs */ -} POSTPACK WMI_SCAN_PARAMS_CMD; - -typedef PREPACK struct { - A_UINT16 chan_index; - A_INT8 bang_radar; -} POSTPACK WMI_RADAR_DETECTED_CMD; - -/* - * WMI_SET_BSS_FILTER_CMDID - */ -typedef enum { - NONE_BSS_FILTER = 0x0, /* no beacons forwarded */ - ALL_BSS_FILTER, /* all beacons forwarded */ - PROFILE_FILTER, /* only beacons matching profile */ - ALL_BUT_PROFILE_FILTER, /* all but beacons matching profile */ - CURRENT_BSS_FILTER, /* only beacons matching current BSS */ - ALL_BUT_BSS_FILTER, /* all but beacons matching BSS */ - PROBED_SSID_FILTER, /* beacons matching probed ssid */ - LAST_BSS_FILTER, /* marker only */ -} WMI_BSS_FILTER; - -typedef PREPACK struct { - A_UINT8 bssFilter; /* see WMI_BSS_FILTER */ - A_UINT8 reserved1; /* For alignment */ - A_UINT16 reserved2; /* For alignment */ - A_UINT32 ieMask; -} POSTPACK WMI_BSS_FILTER_CMD; - -/* - * WMI_SET_PROBED_SSID_CMDID - */ -#define MAX_PROBED_SSID_INDEX 15 - -typedef enum { - DISABLE_SSID_FLAG = 0, /* disables entry */ - SPECIFIC_SSID_FLAG = 0x01, /* probes specified ssid */ - ANY_SSID_FLAG = 0x02, /* probes for any ssid */ -} WMI_SSID_FLAG; - -typedef PREPACK struct { - A_UINT8 entryIndex; /* 0 to MAX_PROBED_SSID_INDEX */ - A_UINT8 flag; /* WMI_SSID_FLG */ - A_UINT8 ssidLength; - A_UINT8 ssid[32]; -} POSTPACK WMI_PROBED_SSID_CMD; - -/* - * WMI_SET_LISTEN_INT_CMDID - * The Listen interval is between 15 and 3000 TUs - */ -#define MIN_LISTEN_INTERVAL 15 -#define MAX_LISTEN_INTERVAL 5000 -#define MIN_LISTEN_BEACONS 1 -#define MAX_LISTEN_BEACONS 50 - -typedef PREPACK struct { - A_UINT16 listenInterval; - A_UINT16 numBeacons; -} POSTPACK WMI_LISTEN_INT_CMD; - -/* - * WMI_SET_BEACON_INT_CMDID - */ -typedef PREPACK struct { - A_UINT16 beaconInterval; -} POSTPACK WMI_BEACON_INT_CMD; - -/* - * WMI_SET_BMISS_TIME_CMDID - * valid values are between 1000 and 5000 TUs - */ - -#define MIN_BMISS_TIME 1000 -#define MAX_BMISS_TIME 5000 -#define MIN_BMISS_BEACONS 1 -#define MAX_BMISS_BEACONS 50 - -typedef PREPACK struct { - A_UINT16 bmissTime; - A_UINT16 numBeacons; -} POSTPACK WMI_BMISS_TIME_CMD; - -/* - * WMI_SET_POWER_MODE_CMDID - */ -typedef enum { - REC_POWER = 0x01, - MAX_PERF_POWER, -} WMI_POWER_MODE; - -typedef PREPACK struct { - A_UINT8 powerMode; /* WMI_POWER_MODE */ -} POSTPACK WMI_POWER_MODE_CMD; - -typedef PREPACK struct { - A_INT8 status; /* WMI_SET_PARAMS_REPLY */ -} POSTPACK WMI_SET_PARAMS_REPLY; - -typedef PREPACK struct { - A_UINT32 opcode; - A_UINT32 length; - A_CHAR buffer[1]; /* WMI_SET_PARAMS */ -} POSTPACK WMI_SET_PARAMS_CMD; - -typedef PREPACK struct { - A_UINT8 multicast_mac[ATH_MAC_LEN]; /* WMI_SET_MCAST_FILTER */ -} POSTPACK WMI_SET_MCAST_FILTER_CMD; - -typedef PREPACK struct { - A_UINT8 enable; /* WMI_MCAST_FILTER */ -} POSTPACK WMI_MCAST_FILTER_CMD; - -/* - * WMI_SET_POWER_PARAMS_CMDID - */ -typedef enum { - IGNORE_DTIM = 0x01, - NORMAL_DTIM = 0x02, - STICK_DTIM = 0x03, - AUTO_DTIM = 0x04, -} WMI_DTIM_POLICY; - -/* Policy to determnine whether TX should wakeup WLAN if sleeping */ -typedef enum { - TX_WAKEUP_UPON_SLEEP = 1, - TX_DONT_WAKEUP_UPON_SLEEP = 2 -} WMI_TX_WAKEUP_POLICY_UPON_SLEEP; - -/* - * Policy to determnine whether power save failure event should be sent to - * host during scanning - */ -typedef enum { - SEND_POWER_SAVE_FAIL_EVENT_ALWAYS = 1, - IGNORE_POWER_SAVE_FAIL_EVENT_DURING_SCAN = 2, -} POWER_SAVE_FAIL_EVENT_POLICY; - -typedef PREPACK struct { - A_UINT16 idle_period; /* msec */ - A_UINT16 pspoll_number; - A_UINT16 dtim_policy; - A_UINT16 tx_wakeup_policy; - A_UINT16 num_tx_to_wakeup; - A_UINT16 ps_fail_event_policy; -} POSTPACK WMI_POWER_PARAMS_CMD; - -/* Adhoc power save types */ -typedef enum { - ADHOC_PS_DISABLE=1, - ADHOC_PS_ATH=2, - ADHOC_PS_IEEE=3, - ADHOC_PS_OTHER=4, -} WMI_ADHOC_PS_TYPE; - -typedef PREPACK struct { - A_UINT8 power_saving; - A_UINT8 ttl; /* number of beacon periods */ - A_UINT16 atim_windows; /* msec */ - A_UINT16 timeout_value; /* msec */ -} POSTPACK WMI_IBSS_PM_CAPS_CMD; - -/* AP power save types */ -typedef enum { - AP_PS_DISABLE=1, - AP_PS_ATH=2, -} WMI_AP_PS_TYPE; - -typedef PREPACK struct { - A_UINT32 idle_time; /* in msec */ - A_UINT32 ps_period; /* in usec */ - A_UINT8 sleep_period; /* in ps periods */ - A_UINT8 psType; -} POSTPACK WMI_AP_PS_CMD; - -/* - * WMI_SET_POWERSAVE_TIMERS_POLICY_CMDID - */ -typedef enum { - IGNORE_TIM_ALL_QUEUES_APSD = 0, - PROCESS_TIM_ALL_QUEUES_APSD = 1, - IGNORE_TIM_SIMULATED_APSD = 2, - PROCESS_TIM_SIMULATED_APSD = 3, -} APSD_TIM_POLICY; - -typedef PREPACK struct { - A_UINT16 psPollTimeout; /* msec */ - A_UINT16 triggerTimeout; /* msec */ - A_UINT32 apsdTimPolicy; /* TIM behavior with ques APSD enabled. Default is IGNORE_TIM_ALL_QUEUES_APSD */ - A_UINT32 simulatedAPSDTimPolicy; /* TIM behavior with simulated APSD enabled. Default is PROCESS_TIM_SIMULATED_APSD */ -} POSTPACK WMI_POWERSAVE_TIMERS_POLICY_CMD; - -/* - * WMI_SET_VOICE_PKT_SIZE_CMDID - */ -typedef PREPACK struct { - A_UINT16 voicePktSize; -} POSTPACK WMI_SET_VOICE_PKT_SIZE_CMD; - -/* - * WMI_SET_MAX_SP_LEN_CMDID - */ -typedef enum { - DELIVER_ALL_PKT = 0x0, - DELIVER_2_PKT = 0x1, - DELIVER_4_PKT = 0x2, - DELIVER_6_PKT = 0x3, -} APSD_SP_LEN_TYPE; - -typedef PREPACK struct { - A_UINT8 maxSPLen; -} POSTPACK WMI_SET_MAX_SP_LEN_CMD; - -/* - * WMI_SET_DISC_TIMEOUT_CMDID - */ -typedef PREPACK struct { - A_UINT8 disconnectTimeout; /* seconds */ -} POSTPACK WMI_DISC_TIMEOUT_CMD; - -typedef enum { - UPLINK_TRAFFIC = 0, - DNLINK_TRAFFIC = 1, - BIDIR_TRAFFIC = 2, -} DIR_TYPE; - -typedef enum { - DISABLE_FOR_THIS_AC = 0, - ENABLE_FOR_THIS_AC = 1, - ENABLE_FOR_ALL_AC = 2, -} VOICEPS_CAP_TYPE; - -typedef enum { - TRAFFIC_TYPE_APERIODIC = 0, - TRAFFIC_TYPE_PERIODIC = 1, -}TRAFFIC_TYPE; - -/* - * WMI_SYNCHRONIZE_CMDID - */ -typedef PREPACK struct { - A_UINT8 dataSyncMap; -} POSTPACK WMI_SYNC_CMD; - -/* - * WMI_CREATE_PSTREAM_CMDID - */ -typedef PREPACK struct { - A_UINT32 minServiceInt; /* in milli-sec */ - A_UINT32 maxServiceInt; /* in milli-sec */ - A_UINT32 inactivityInt; /* in milli-sec */ - A_UINT32 suspensionInt; /* in milli-sec */ - A_UINT32 serviceStartTime; - A_UINT32 minDataRate; /* in bps */ - A_UINT32 meanDataRate; /* in bps */ - A_UINT32 peakDataRate; /* in bps */ - A_UINT32 maxBurstSize; - A_UINT32 delayBound; - A_UINT32 minPhyRate; /* in bps */ - A_UINT32 sba; - A_UINT32 mediumTime; - A_UINT16 nominalMSDU; /* in octects */ - A_UINT16 maxMSDU; /* in octects */ - A_UINT8 trafficClass; - A_UINT8 trafficDirection; /* DIR_TYPE */ - A_UINT8 rxQueueNum; - A_UINT8 trafficType; /* TRAFFIC_TYPE */ - A_UINT8 voicePSCapability; /* VOICEPS_CAP_TYPE */ - A_UINT8 tsid; - A_UINT8 userPriority; /* 802.1D user priority */ - A_UINT8 nominalPHY; /* nominal phy rate */ -} POSTPACK WMI_CREATE_PSTREAM_CMD; - -/* - * WMI_DELETE_PSTREAM_CMDID - */ -typedef PREPACK struct { - A_UINT8 txQueueNumber; - A_UINT8 rxQueueNumber; - A_UINT8 trafficDirection; - A_UINT8 trafficClass; - A_UINT8 tsid; -} POSTPACK WMI_DELETE_PSTREAM_CMD; - -/* - * WMI_SET_CHANNEL_PARAMS_CMDID - */ -typedef enum { - WMI_11A_MODE = 0x1, - WMI_11G_MODE = 0x2, - WMI_11AG_MODE = 0x3, - WMI_11B_MODE = 0x4, - WMI_11GONLY_MODE = 0x5, -} WMI_PHY_MODE; - -#define WMI_MAX_CHANNELS 32 - -typedef PREPACK struct { - A_UINT8 reserved1; - A_UINT8 scanParam; /* set if enable scan */ - A_UINT8 phyMode; /* see WMI_PHY_MODE */ - A_UINT8 numChannels; /* how many channels follow */ - A_UINT16 channelList[1]; /* channels in Mhz */ -} POSTPACK WMI_CHANNEL_PARAMS_CMD; - - -/* - * WMI_RSSI_THRESHOLD_PARAMS_CMDID - * Setting the polltime to 0 would disable polling. - * Threshold values are in the ascending order, and should agree to: - * (lowThreshold_lowerVal < lowThreshold_upperVal < highThreshold_lowerVal - * < highThreshold_upperVal) - */ - -typedef PREPACK struct WMI_RSSI_THRESHOLD_PARAMS{ - A_UINT32 pollTime; /* Polling time as a factor of LI */ - A_INT16 thresholdAbove1_Val; /* lowest of upper */ - A_INT16 thresholdAbove2_Val; - A_INT16 thresholdAbove3_Val; - A_INT16 thresholdAbove4_Val; - A_INT16 thresholdAbove5_Val; - A_INT16 thresholdAbove6_Val; /* highest of upper */ - A_INT16 thresholdBelow1_Val; /* lowest of bellow */ - A_INT16 thresholdBelow2_Val; - A_INT16 thresholdBelow3_Val; - A_INT16 thresholdBelow4_Val; - A_INT16 thresholdBelow5_Val; - A_INT16 thresholdBelow6_Val; /* highest of bellow */ - A_UINT8 weight; /* "alpha" */ - A_UINT8 reserved[3]; -} POSTPACK WMI_RSSI_THRESHOLD_PARAMS_CMD; - -/* - * WMI_SNR_THRESHOLD_PARAMS_CMDID - * Setting the polltime to 0 would disable polling. - */ - -typedef PREPACK struct WMI_SNR_THRESHOLD_PARAMS{ - A_UINT32 pollTime; /* Polling time as a factor of LI */ - A_UINT8 weight; /* "alpha" */ - A_UINT8 thresholdAbove1_Val; /* lowest of uppper*/ - A_UINT8 thresholdAbove2_Val; - A_UINT8 thresholdAbove3_Val; - A_UINT8 thresholdAbove4_Val; /* highest of upper */ - A_UINT8 thresholdBelow1_Val; /* lowest of bellow */ - A_UINT8 thresholdBelow2_Val; - A_UINT8 thresholdBelow3_Val; - A_UINT8 thresholdBelow4_Val; /* highest of bellow */ - A_UINT8 reserved[3]; -} POSTPACK WMI_SNR_THRESHOLD_PARAMS_CMD; - -/* - * WMI_LQ_THRESHOLD_PARAMS_CMDID - */ -typedef PREPACK struct WMI_LQ_THRESHOLD_PARAMS { - A_UINT8 enable; - A_UINT8 thresholdAbove1_Val; - A_UINT8 thresholdAbove2_Val; - A_UINT8 thresholdAbove3_Val; - A_UINT8 thresholdAbove4_Val; - A_UINT8 thresholdBelow1_Val; - A_UINT8 thresholdBelow2_Val; - A_UINT8 thresholdBelow3_Val; - A_UINT8 thresholdBelow4_Val; - A_UINT8 reserved[3]; -} POSTPACK WMI_LQ_THRESHOLD_PARAMS_CMD; - -typedef enum { - WMI_LPREAMBLE_DISABLED = 0, - WMI_LPREAMBLE_ENABLED -} WMI_LPREAMBLE_STATUS; - -typedef enum { - WMI_IGNORE_BARKER_IN_ERP = 0, - WMI_DONOT_IGNORE_BARKER_IN_ERP -} WMI_PREAMBLE_POLICY; - -typedef PREPACK struct { - A_UINT8 status; - A_UINT8 preamblePolicy; -}POSTPACK WMI_SET_LPREAMBLE_CMD; - -typedef PREPACK struct { - A_UINT16 threshold; -}POSTPACK WMI_SET_RTS_CMD; - -/* - * WMI_TARGET_ERROR_REPORT_BITMASK_CMDID - * Sets the error reporting event bitmask in target. Target clears it - * upon an error. Subsequent errors are counted, but not reported - * via event, unless the bitmask is set again. - */ -typedef PREPACK struct { - A_UINT32 bitmask; -} POSTPACK WMI_TARGET_ERROR_REPORT_BITMASK; - -/* - * WMI_SET_TX_PWR_CMDID - */ -typedef PREPACK struct { - A_UINT8 dbM; /* in dbM units */ -} POSTPACK WMI_SET_TX_PWR_CMD, WMI_TX_PWR_REPLY; - -/* - * WMI_SET_ASSOC_INFO_CMDID - * - * A maximum of 2 private IEs can be sent in the [Re]Assoc request. - * A 3rd one, the CCX version IE can also be set from the host. - */ -#define WMI_MAX_ASSOC_INFO_TYPE 2 -#define WMI_CCX_VER_IE 2 /* ieType to set CCX Version IE */ - -#define WMI_MAX_ASSOC_INFO_LEN 240 - -typedef PREPACK struct { - A_UINT8 ieType; - A_UINT8 bufferSize; - A_UINT8 assocInfo[1]; /* up to WMI_MAX_ASSOC_INFO_LEN */ -} POSTPACK WMI_SET_ASSOC_INFO_CMD; - - -/* - * WMI_GET_TX_PWR_CMDID does not take any parameters - */ - -/* - * WMI_ADD_BAD_AP_CMDID - */ -#define WMI_MAX_BAD_AP_INDEX 1 - -typedef PREPACK struct { - A_UINT8 badApIndex; /* 0 to WMI_MAX_BAD_AP_INDEX */ - A_UINT8 bssid[ATH_MAC_LEN]; -} POSTPACK WMI_ADD_BAD_AP_CMD; - -/* - * WMI_DELETE_BAD_AP_CMDID - */ -typedef PREPACK struct { - A_UINT8 badApIndex; /* 0 to WMI_MAX_BAD_AP_INDEX */ -} POSTPACK WMI_DELETE_BAD_AP_CMD; - -/* - * WMI_SET_ACCESS_PARAMS_CMDID - */ -#define WMI_DEFAULT_TXOP_ACPARAM 0 /* implies one MSDU */ -#define WMI_DEFAULT_ECWMIN_ACPARAM 4 /* corresponds to CWmin of 15 */ -#define WMI_DEFAULT_ECWMAX_ACPARAM 10 /* corresponds to CWmax of 1023 */ -#define WMI_MAX_CW_ACPARAM 15 /* maximum eCWmin or eCWmax */ -#define WMI_DEFAULT_AIFSN_ACPARAM 2 -#define WMI_MAX_AIFSN_ACPARAM 15 -typedef PREPACK struct { - A_UINT16 txop; /* in units of 32 usec */ - A_UINT8 eCWmin; - A_UINT8 eCWmax; - A_UINT8 aifsn; - A_UINT8 ac; -} POSTPACK WMI_SET_ACCESS_PARAMS_CMD; - - -/* - * WMI_SET_RETRY_LIMITS_CMDID - * - * This command is used to customize the number of retries the - * wlan device will perform on a given frame. - */ -#define WMI_MIN_RETRIES 2 -#define WMI_MAX_RETRIES 13 -typedef enum { - MGMT_FRAMETYPE = 0, - CONTROL_FRAMETYPE = 1, - DATA_FRAMETYPE = 2 -} WMI_FRAMETYPE; - -typedef PREPACK struct { - A_UINT8 frameType; /* WMI_FRAMETYPE */ - A_UINT8 trafficClass; /* applies only to DATA_FRAMETYPE */ - A_UINT8 maxRetries; - A_UINT8 enableNotify; -} POSTPACK WMI_SET_RETRY_LIMITS_CMD; - -/* - * WMI_SET_ROAM_CTRL_CMDID - * - * This command is used to influence the Roaming behaviour - * Set the host biases of the BSSs before setting the roam mode as bias - * based. - */ - -/* - * Different types of Roam Control - */ - -typedef enum { - WMI_FORCE_ROAM = 1, /* Roam to the specified BSSID */ - WMI_SET_ROAM_MODE = 2, /* default ,progd bias, no roam */ - WMI_SET_HOST_BIAS = 3, /* Set the Host Bias */ - WMI_SET_LOWRSSI_SCAN_PARAMS = 4, /* Set lowrssi Scan parameters */ -} WMI_ROAM_CTRL_TYPE; - -#define WMI_MIN_ROAM_CTRL_TYPE WMI_FORCE_ROAM -#define WMI_MAX_ROAM_CTRL_TYPE WMI_SET_LOWRSSI_SCAN_PARAMS - -/* - * ROAM MODES - */ - -typedef enum { - WMI_DEFAULT_ROAM_MODE = 1, /* RSSI based ROAM */ - WMI_HOST_BIAS_ROAM_MODE = 2, /* HOST BIAS based ROAM */ - WMI_LOCK_BSS_MODE = 3 /* Lock to the Current BSS - no Roam */ -} WMI_ROAM_MODE; - -/* - * BSS HOST BIAS INFO - */ - -typedef PREPACK struct { - A_UINT8 bssid[ATH_MAC_LEN]; - A_INT8 bias; -} POSTPACK WMI_BSS_BIAS; - -typedef PREPACK struct { - A_UINT8 numBss; - WMI_BSS_BIAS bssBias[1]; -} POSTPACK WMI_BSS_BIAS_INFO; - -typedef PREPACK struct WMI_LOWRSSI_SCAN_PARAMS { - A_UINT16 lowrssi_scan_period; - A_INT16 lowrssi_scan_threshold; - A_INT16 lowrssi_roam_threshold; - A_UINT8 roam_rssi_floor; - A_UINT8 reserved[1]; /* For alignment */ -} POSTPACK WMI_LOWRSSI_SCAN_PARAMS; - -typedef PREPACK struct { - PREPACK union { - A_UINT8 bssid[ATH_MAC_LEN]; /* WMI_FORCE_ROAM */ - A_UINT8 roamMode; /* WMI_SET_ROAM_MODE */ - WMI_BSS_BIAS_INFO bssBiasInfo; /* WMI_SET_HOST_BIAS */ - WMI_LOWRSSI_SCAN_PARAMS lrScanParams; - } POSTPACK info; - A_UINT8 roamCtrlType ; -} POSTPACK WMI_SET_ROAM_CTRL_CMD; - -/* - * WMI_SET_BT_WLAN_CONN_PRECEDENCE_CMDID - */ -typedef enum { - BT_WLAN_CONN_PRECDENCE_WLAN=0, /* Default */ - BT_WLAN_CONN_PRECDENCE_PAL, -} BT_WLAN_CONN_PRECEDENCE; - -typedef PREPACK struct { - A_UINT8 precedence; -} POSTPACK WMI_SET_BT_WLAN_CONN_PRECEDENCE; - -/* - * WMI_ENABLE_RM_CMDID - */ -typedef PREPACK struct { - A_BOOL enable_radio_measurements; -} POSTPACK WMI_ENABLE_RM_CMD; - -/* - * WMI_SET_MAX_OFFHOME_DURATION_CMDID - */ -typedef PREPACK struct { - A_UINT8 max_offhome_duration; -} POSTPACK WMI_SET_MAX_OFFHOME_DURATION_CMD; - -typedef PREPACK struct { - A_UINT32 frequency; - A_UINT8 threshold; -} POSTPACK WMI_SET_HB_CHALLENGE_RESP_PARAMS_CMD; - -typedef PREPACK struct { - A_UINT8 enable; -} POSTPACK WMI_SET_DFS_CMD; - - -typedef enum { - WMI_CCX_RM_STATUS_UNKNOWN = 0, - WMI_CCX_RM_REPORT_SENT, - WMI_CCX_RM_REFUSE_REPORT_SENT, - WMI_CCX_RM_STATUS_MAX -} WMI_CCX_RM_STATUS_TYPE; - -/*---------------------- BTCOEX RELATED -------------------------------------*/ -/*----------------------COMMON to AR6002 and AR6003 -------------------------*/ -typedef enum { - BT_STREAM_UNDEF = 0, - BT_STREAM_SCO, /* SCO stream */ - BT_STREAM_A2DP, /* A2DP stream */ - BT_STREAM_SCAN, /* BT Discovery or Page */ - BT_STREAM_ESCO, - BT_STREAM_MAX -} BT_STREAM_TYPE; - -typedef enum { - BT_PARAM_SCO_PSPOLL_LATENCY_ONE_FOURTH =1, - BT_PARAM_SCO_PSPOLL_LATENCY_HALF, - BT_PARAM_SCO_PSPOLL_LATENCY_THREE_FOURTH, -} BT_PARAMS_SCO_PSPOLL_LATENCY; - -typedef enum { - BT_PARAMS_SCO_STOMP_SCO_NEVER =1, - BT_PARAMS_SCO_STOMP_SCO_ALWAYS, - BT_PARAMS_SCO_STOMP_SCO_IN_LOWRSSI, -} BT_PARAMS_SCO_STOMP_RULES; - -typedef enum { - BT_STATUS_UNDEF = 0, - BT_STATUS_ON, - BT_STATUS_OFF, - BT_STATUS_MAX -} BT_STREAM_STATUS; - -typedef PREPACK struct { - A_UINT8 streamType; - A_UINT8 status; -} POSTPACK WMI_SET_BT_STATUS_CMD; - -typedef enum { - BT_ANT_TYPE_UNDEF=0, - BT_ANT_TYPE_DUAL, - BT_ANT_TYPE_SPLITTER, - BT_ANT_TYPE_SWITCH, - BT_ANT_TYPE_HIGH_ISO_DUAL -} BT_ANT_FRONTEND_CONFIG; - -typedef enum { - BT_COLOCATED_DEV_BTS4020=0, - BT_COLCATED_DEV_CSR , - BT_COLOCATED_DEV_VALKYRIE -} BT_COLOCATED_DEV_TYPE; - -/*********************** Applicable to AR6002 ONLY ******************************/ - -typedef enum { - BT_PARAM_SCO = 1, /* SCO stream parameters */ - BT_PARAM_A2DP , - BT_PARAM_ANTENNA_CONFIG, - BT_PARAM_COLOCATED_BT_DEVICE, - BT_PARAM_ACLCOEX, - BT_PARAM_11A_SEPARATE_ANT, - BT_PARAM_MAX -} BT_PARAM_TYPE; - - -#define BT_SCO_ALLOW_CLOSE_RANGE_OPT (1 << 0) -#define BT_SCO_FORCE_AWAKE_OPT (1 << 1) -#define BT_SCO_SET_RSSI_OVERRIDE(flags) ((flags) |= (1 << 2)) -#define BT_SCO_GET_RSSI_OVERRIDE(flags) (((flags) >> 2) & 0x1) -#define BT_SCO_SET_RTS_OVERRIDE(flags) ((flags) |= (1 << 3)) -#define BT_SCO_GET_RTS_OVERRIDE(flags) (((flags) >> 3) & 0x1) -#define BT_SCO_GET_MIN_LOW_RATE_CNT(flags) (((flags) >> 8) & 0xFF) -#define BT_SCO_GET_MAX_LOW_RATE_CNT(flags) (((flags) >> 16) & 0xFF) -#define BT_SCO_SET_MIN_LOW_RATE_CNT(flags,val) (flags) |= (((val) & 0xFF) << 8) -#define BT_SCO_SET_MAX_LOW_RATE_CNT(flags,val) (flags) |= (((val) & 0xFF) << 16) - -typedef PREPACK struct { - A_UINT32 numScoCyclesForceTrigger; /* Number SCO cycles after which - force a pspoll. default = 10 */ - A_UINT32 dataResponseTimeout; /* Timeout Waiting for Downlink pkt - in response for ps-poll, - default = 10 msecs */ - A_UINT32 stompScoRules; - A_UINT32 scoOptFlags; /* SCO Options Flags : - bits: meaning: - 0 Allow Close Range Optimization - 1 Force awake during close range - 2 If set use host supplied RSSI for OPT - 3 If set use host supplied RTS COUNT for OPT - 4..7 Unused - 8..15 Low Data Rate Min Cnt - 16..23 Low Data Rate Max Cnt - */ - - A_UINT8 stompDutyCyleVal; /* Sco cycles to limit ps-poll queuing - if stomped */ - A_UINT8 stompDutyCyleMaxVal; /*firm ware increases stomp duty cycle - gradually uptill this value on need basis*/ - A_UINT8 psPollLatencyFraction; /* Fraction of idle - period, within which - additional ps-polls - can be queued */ - A_UINT8 noSCOSlots; /* Number of SCO Tx/Rx slots. - HVx, EV3, 2EV3 = 2 */ - A_UINT8 noIdleSlots; /* Number of Bluetooth idle slots between - consecutive SCO Tx/Rx slots - HVx, EV3 = 4 - 2EV3 = 10 */ - A_UINT8 scoOptOffRssi;/*RSSI value below which we go to ps poll*/ - A_UINT8 scoOptOnRssi; /*RSSI value above which we reenter opt mode*/ - A_UINT8 scoOptRtsCount; -} POSTPACK BT_PARAMS_SCO; - -#define BT_A2DP_ALLOW_CLOSE_RANGE_OPT (1 << 0) -#define BT_A2DP_FORCE_AWAKE_OPT (1 << 1) -#define BT_A2DP_SET_RSSI_OVERRIDE(flags) ((flags) |= (1 << 2)) -#define BT_A2DP_GET_RSSI_OVERRIDE(flags) (((flags) >> 2) & 0x1) -#define BT_A2DP_SET_RTS_OVERRIDE(flags) ((flags) |= (1 << 3)) -#define BT_A2DP_GET_RTS_OVERRIDE(flags) (((flags) >> 3) & 0x1) -#define BT_A2DP_GET_MIN_LOW_RATE_CNT(flags) (((flags) >> 8) & 0xFF) -#define BT_A2DP_GET_MAX_LOW_RATE_CNT(flags) (((flags) >> 16) & 0xFF) -#define BT_A2DP_SET_MIN_LOW_RATE_CNT(flags,val) (flags) |= (((val) & 0xFF) << 8) -#define BT_A2DP_SET_MAX_LOW_RATE_CNT(flags,val) (flags) |= (((val) & 0xFF) << 16) - -typedef PREPACK struct { - A_UINT32 a2dpWlanUsageLimit; /* MAX time firmware uses the medium for - wlan, after it identifies the idle time - default (30 msecs) */ - A_UINT32 a2dpBurstCntMin; /* Minimum number of bluetooth data frames - to replenish Wlan Usage limit (default 3) */ - A_UINT32 a2dpDataRespTimeout; - A_UINT32 a2dpOptFlags; /* A2DP Option flags: - bits: meaning: - 0 Allow Close Range Optimization - 1 Force awake during close range - 2 If set use host supplied RSSI for OPT - 3 If set use host supplied RTS COUNT for OPT - 4..7 Unused - 8..15 Low Data Rate Min Cnt - 16..23 Low Data Rate Max Cnt - */ - A_UINT8 isCoLocatedBtRoleMaster; - A_UINT8 a2dpOptOffRssi;/*RSSI value below which we go to ps poll*/ - A_UINT8 a2dpOptOnRssi; /*RSSI value above which we reenter opt mode*/ - A_UINT8 a2dpOptRtsCount; -}POSTPACK BT_PARAMS_A2DP; - -/* During BT ftp/ BT OPP or any another data based acl profile on bluetooth - (non a2dp).*/ -typedef PREPACK struct { - A_UINT32 aclWlanMediumUsageTime; /* Wlan usage time during Acl (non-a2dp) - coexistence (default 30 msecs) */ - A_UINT32 aclBtMediumUsageTime; /* Bt usage time during acl coexistence - (default 30 msecs)*/ - A_UINT32 aclDataRespTimeout; - A_UINT32 aclDetectTimeout; /* ACL coexistence enabled if we get - 10 Pkts in X msec(default 100 msecs) */ - A_UINT32 aclmaxPktCnt; /* No of ACL pkts to receive before - enabling ACL coex */ - -}POSTPACK BT_PARAMS_ACLCOEX; - -typedef PREPACK struct { - PREPACK union { - BT_PARAMS_SCO scoParams; - BT_PARAMS_A2DP a2dpParams; - BT_PARAMS_ACLCOEX aclCoexParams; - A_UINT8 antType; /* 0 -Disabled (default) - 1 - BT_ANT_TYPE_DUAL - 2 - BT_ANT_TYPE_SPLITTER - 3 - BT_ANT_TYPE_SWITCH */ - A_UINT8 coLocatedBtDev; /* 0 - BT_COLOCATED_DEV_BTS4020 (default) - 1 - BT_COLCATED_DEV_CSR - 2 - BT_COLOCATED_DEV_VALKYRIe - */ - } POSTPACK info; - A_UINT8 paramType ; -} POSTPACK WMI_SET_BT_PARAMS_CMD; - -/************************ END AR6002 BTCOEX *******************************/ -/*-----------------------AR6003 BTCOEX -----------------------------------*/ - -/* ---------------WMI_SET_BTCOEX_FE_ANT_CMDID --------------------------*/ -/* Indicates front end antenna configuration. This command needs to be issued - * right after initialization and after WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMDID. - * AR6003 enables coexistence and antenna switching based on the configuration. - */ -typedef enum { - WMI_BTCOEX_NOT_ENABLED = 0, - WMI_BTCOEX_FE_ANT_SINGLE =1, - WMI_BTCOEX_FE_ANT_DUAL=2, - WMI_BTCOEX_FE_ANT_DUAL_HIGH_ISO=3, - WMI_BTCOEX_FE_ANT_BYPASS_MODE=4, - WMI_BTCOEX_FE_ANT_COMBINE_MODE=5, - WMI_BTCOEX_FE_ANT_TYPE_MAX -}WMI_BTCOEX_FE_ANT_TYPE; - -typedef PREPACK struct { - A_UINT8 btcoexFeAntType; /* 1 - WMI_BTCOEX_FE_ANT_SINGLE for single antenna front end - 2 - WMI_BTCOEX_FE_ANT_DUAL for dual antenna front end - (for isolations less 35dB, for higher isolation there - is not need to pass this command). - (not implemented) - */ -}POSTPACK WMI_SET_BTCOEX_FE_ANT_CMD; - -/* -------------WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMDID ----------------*/ -/* Indicate the bluetooth chip to the firmware. Firmware can have different algorithm based - * bluetooth chip type.Based on bluetooth device, different coexistence protocol would be used. - */ -typedef PREPACK struct { - A_UINT8 btcoexCoLocatedBTdev; /*1 - Qcom BT (3 -wire PTA) - 2 - CSR BT (3 wire PTA) - 3 - Atheros 3001 BT (3 wire PTA) - 4 - STE bluetooth (4-wire ePTA) - 5 - Atheros 3002 BT (4-wire MCI) - defaults= 3 (Atheros 3001 BT ) - */ -}POSTPACK WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD; - -/* -------------WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMDID ------------*/ -/* Configuration parameters during bluetooth inquiry and page. Page configuration - * is applicable only on interfaces which can distinguish page (applicable only for ePTA - - * STE bluetooth). - * Bluetooth inquiry start and end is indicated via WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID. - * During this the station will be power-save mode. - */ -typedef PREPACK struct { - A_UINT32 btInquiryDataFetchFrequency;/* The frequency of querying the AP for data - (via pspoll) is configured by this parameter. - "default = 10 ms" */ - - A_UINT32 protectBmissDurPostBtInquiry;/* The firmware will continue to be in inquiry state - for configured duration, after inquiry completion - . This is to ensure other bluetooth transactions - (RDP, SDP profiles, link key exchange ...etc) - goes through smoothly without wifi stomping. - default = 10 secs*/ - - A_UINT32 maxpageStomp; /*Applicable only for STE-BT interface. Currently not - used */ - A_UINT32 btInquiryPageFlag; /* Not used */ -}POSTPACK WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD; - -/*---------------------WMI_SET_BTCOEX_SCO_CONFIG_CMDID ---------------*/ -/* Configure SCO parameters. These parameters would be used whenever firmware is indicated - * of (e)SCO profile on bluetooth ( via WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID). - * Configration of BTCOEX_SCO_CONFIG data structure are common configuration and applies - * ps-poll mode and opt mode. - * Ps-poll Mode - Station is in power-save and retrieves downlink data between sco gaps. - * Opt Mode - station is in awake state and access point can send data to station any time. - * BTCOEX_PSPOLLMODE_SCO_CONFIG - Configuration applied only during ps-poll mode. - * BTCOEX_OPTMODE_SCO_CONFIG - Configuration applied only during opt mode. - */ -#define WMI_SCO_CONFIG_FLAG_ALLOW_OPTIMIZATION (1 << 0) -#define WMI_SCO_CONFIG_FLAG_IS_EDR_CAPABLE (1 << 1) -#define WMI_SCO_CONFIG_FLAG_IS_BT_MASTER (1 << 2) -#define WMI_SCO_CONFIG_FLAG_FW_DETECT_OF_PER (1 << 3) -typedef PREPACK struct { - A_UINT32 scoSlots; /* Number of SCO Tx/Rx slots. - HVx, EV3, 2EV3 = 2 */ - A_UINT32 scoIdleSlots; /* Number of Bluetooth idle slots between - consecutive SCO Tx/Rx slots - HVx, EV3 = 4 - 2EV3 = 10 - */ - A_UINT32 scoFlags; /* SCO Options Flags : - bits: meaning: - 0 Allow Close Range Optimization - 1 Is EDR capable or Not - 2 IS Co-located Bt role Master - 3 Firmware determines the periodicity of SCO. - */ - - A_UINT32 linkId; /* applicable to STE-BT - not used */ -}POSTPACK BTCOEX_SCO_CONFIG; - -typedef PREPACK struct { - A_UINT32 scoCyclesForceTrigger; /* Number SCO cycles after which - force a pspoll. default = 10 */ - A_UINT32 scoDataResponseTimeout; /* Timeout Waiting for Downlink pkt - in response for ps-poll, - default = 20 msecs */ - - A_UINT32 scoStompDutyCyleVal; /* not implemented */ - - A_UINT32 scoStompDutyCyleMaxVal; /*Not implemented */ - - A_UINT32 scoPsPollLatencyFraction; /* Fraction of idle - period, within which - additional ps-polls can be queued - 1 - 1/4 of idle duration - 2 - 1/2 of idle duration - 3 - 3/4 of idle duration - default =2 (1/2) - */ -}POSTPACK BTCOEX_PSPOLLMODE_SCO_CONFIG; - -typedef PREPACK struct { - A_UINT32 scoStompCntIn100ms;/*max number of SCO stomp in 100ms allowed in - opt mode. If exceeds the configured value, - switch to ps-poll mode - default = 3 */ - - A_UINT32 scoContStompMax; /* max number of continous stomp allowed in opt mode. - if excedded switch to pspoll mode - default = 3 */ - - A_UINT32 scoMinlowRateMbps; /* Low rate threshold */ - - A_UINT32 scoLowRateCnt; /* number of low rate pkts (< scoMinlowRateMbps) allowed in 100 ms. - If exceeded switch/stay to ps-poll mode, lower stay in opt mode. - default = 36 - */ - - A_UINT32 scoHighPktRatio; /*(Total Rx pkts in 100 ms + 1)/ - ((Total tx pkts in 100 ms - No of high rate pkts in 100 ms) + 1) in 100 ms, - if exceeded switch/stay in opt mode and if lower switch/stay in pspoll mode. - default = 5 (80% of high rates) - */ - - A_UINT32 scoMaxAggrSize; /* Max number of Rx subframes allowed in this mode. (Firmware re-negogiates - max number of aggregates if it was negogiated to higher value - default = 1 - Recommended value Basic rate headsets = 1, EDR (2-EV3) =4. - */ -}POSTPACK BTCOEX_OPTMODE_SCO_CONFIG; - -typedef PREPACK struct { - A_UINT32 scanInterval; - A_UINT32 maxScanStompCnt; -}POSTPACK BTCOEX_WLANSCAN_SCO_CONFIG; - -typedef PREPACK struct { - BTCOEX_SCO_CONFIG scoConfig; - BTCOEX_PSPOLLMODE_SCO_CONFIG scoPspollConfig; - BTCOEX_OPTMODE_SCO_CONFIG scoOptModeConfig; - BTCOEX_WLANSCAN_SCO_CONFIG scoWlanScanConfig; -}POSTPACK WMI_SET_BTCOEX_SCO_CONFIG_CMD; - -/* ------------------WMI_SET_BTCOEX_A2DP_CONFIG_CMDID -------------------*/ -/* Configure A2DP profile parameters. These parameters would be used whenver firmware is indicated - * of A2DP profile on bluetooth ( via WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID). - * Configuration of BTCOEX_A2DP_CONFIG data structure are common configuration and applies to - * ps-poll mode and opt mode. - * Ps-poll Mode - Station is in power-save and retrieves downlink data between a2dp data bursts. - * Opt Mode - station is in power save during a2dp bursts and awake in the gaps. - * BTCOEX_PSPOLLMODE_A2DP_CONFIG - Configuration applied only during ps-poll mode. - * BTCOEX_OPTMODE_A2DP_CONFIG - Configuration applied only during opt mode. - */ - -#define WMI_A2DP_CONFIG_FLAG_ALLOW_OPTIMIZATION (1 << 0) -#define WMI_A2DP_CONFIG_FLAG_IS_EDR_CAPABLE (1 << 1) -#define WMI_A2DP_CONFIG_FLAG_IS_BT_ROLE_MASTER (1 << 2) -#define WMI_A2DP_CONFIG_FLAG_IS_A2DP_HIGH_PRI (1 << 3) -#define WMI_A2DP_CONFIG_FLAG_FIND_BT_ROLE (1 << 4) - -typedef PREPACK struct { - A_UINT32 a2dpFlags; /* A2DP Option flags: - bits: meaning: - 0 Allow Close Range Optimization - 1 IS EDR capable - 2 IS Co-located Bt role Master - 3 a2dp traffic is high priority - 4 Fw detect the role of bluetooth. - */ - A_UINT32 linkId; /* Applicable only to STE-BT - not used */ - -}POSTPACK BTCOEX_A2DP_CONFIG; - -typedef PREPACK struct { - A_UINT32 a2dpWlanMaxDur; /* MAX time firmware uses the medium for - wlan, after it identifies the idle time - default (30 msecs) */ - - A_UINT32 a2dpMinBurstCnt; /* Minimum number of bluetooth data frames - to replenish Wlan Usage limit (default 3) */ - - A_UINT32 a2dpDataRespTimeout; /* Max duration firmware waits for downlink - by stomping on bluetooth - after ps-poll is acknowledged. - default = 20 ms - */ -}POSTPACK BTCOEX_PSPOLLMODE_A2DP_CONFIG; - -typedef PREPACK struct { - A_UINT32 a2dpMinlowRateMbps; /* Low rate threshold */ - - A_UINT32 a2dpLowRateCnt; /* number of low rate pkts (< a2dpMinlowRateMbps) allowed in 100 ms. - If exceeded switch/stay to ps-poll mode, lower stay in opt mode. - default = 36 - */ - - A_UINT32 a2dpHighPktRatio; /*(Total Rx pkts in 100 ms + 1)/ - ((Total tx pkts in 100 ms - No of high rate pkts in 100 ms) + 1) in 100 ms, - if exceeded switch/stay in opt mode and if lower switch/stay in pspoll mode. - default = 5 (80% of high rates) - */ - - A_UINT32 a2dpMaxAggrSize; /* Max number of Rx subframes allowed in this mode. (Firmware re-negogiates - max number of aggregates if it was negogiated to higher value - default = 1 - Recommended value Basic rate headsets = 1, EDR (2-EV3) =8. - */ - A_UINT32 a2dpPktStompCnt; /*number of a2dp pkts that can be stomped per burst. - default = 6*/ - -}POSTPACK BTCOEX_OPTMODE_A2DP_CONFIG; - -typedef PREPACK struct { - BTCOEX_A2DP_CONFIG a2dpConfig; - BTCOEX_PSPOLLMODE_A2DP_CONFIG a2dppspollConfig; - BTCOEX_OPTMODE_A2DP_CONFIG a2dpOptConfig; -}POSTPACK WMI_SET_BTCOEX_A2DP_CONFIG_CMD; - -/*------------ WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMDID---------------------*/ -/* Configure non-A2dp ACL profile parameters.The starts of ACL profile can either be - * indicated via WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID orenabled via firmware detection - * which is configured via "aclCoexFlags". - * Configration of BTCOEX_ACLCOEX_CONFIG data structure are common configuration and applies - * ps-poll mode and opt mode. - * Ps-poll Mode - Station is in power-save and retrieves downlink data during wlan medium. - * Opt Mode - station is in power save during bluetooth medium time and awake during wlan duration. - * (Not implemented yet) - * - * BTCOEX_PSPOLLMODE_ACLCOEX_CONFIG - Configuration applied only during ps-poll mode. - * BTCOEX_OPTMODE_ACLCOEX_CONFIG - Configuration applied only during opt mode. - */ - -#define WMI_ACLCOEX_FLAGS_ALLOW_OPTIMIZATION (1 << 0) -#define WMI_ACLCOEX_FLAGS_DISABLE_FW_DETECTION (1 << 1) - -typedef PREPACK struct { - A_UINT32 aclWlanMediumDur; /* Wlan usage time during Acl (non-a2dp) - coexistence (default 30 msecs) - */ - - A_UINT32 aclBtMediumDur; /* Bt usage time during acl coexistence - (default 30 msecs) - */ - - A_UINT32 aclDetectTimeout; /* BT activity observation time limit. - In this time duration, number of bt pkts are counted. - If the Cnt reaches "aclPktCntLowerLimit" value - for "aclIterToEnableCoex" iteration continuously, - firmware gets into ACL coexistence mode. - Similarly, if bt traffic count during ACL coexistence - has not reached "aclPktCntLowerLimit" continuously - for "aclIterToEnableCoex", then ACL coexistence is - disabled. - -default 100 msecs - */ - - A_UINT32 aclPktCntLowerLimit; /* Acl Pkt Cnt to be received in duration of - "aclDetectTimeout" for - "aclIterForEnDis" times to enabling ACL coex. - Similar logic is used to disable acl coexistence. - (If "aclPktCntLowerLimit" cnt of acl pkts - are not seen by the for "aclIterForEnDis" - then acl coexistence is disabled). - default = 10 - */ - - A_UINT32 aclIterForEnDis; /* number of Iteration of "aclPktCntLowerLimit" for Enabling and - Disabling Acl Coexistence. - default = 3 - */ - - A_UINT32 aclPktCntUpperLimit; /* This is upperBound limit, if there is more than - "aclPktCntUpperLimit" seen in "aclDetectTimeout", - ACL coexistence is enabled right away. - - default 15*/ - - A_UINT32 aclCoexFlags; /* A2DP Option flags: - bits: meaning: - 0 Allow Close Range Optimization - 1 disable Firmware detection - (Currently supported configuration is aclCoexFlags =0) - */ - - A_UINT32 linkId; /* Applicable only for STE-BT - not used */ - -}POSTPACK BTCOEX_ACLCOEX_CONFIG; - -typedef PREPACK struct { - A_UINT32 aclDataRespTimeout; /* Max duration firmware waits for downlink - by stomping on bluetooth - after ps-poll is acknowledged. - default = 20 ms */ - -}POSTPACK BTCOEX_PSPOLLMODE_ACLCOEX_CONFIG; - - -/* Not implemented yet*/ -typedef PREPACK struct { - A_UINT32 aclCoexMinlowRateMbps; - A_UINT32 aclCoexLowRateCnt; - A_UINT32 aclCoexHighPktRatio; - A_UINT32 aclCoexMaxAggrSize; - A_UINT32 aclPktStompCnt; -}POSTPACK BTCOEX_OPTMODE_ACLCOEX_CONFIG; - -typedef PREPACK struct { - BTCOEX_ACLCOEX_CONFIG aclCoexConfig; - BTCOEX_PSPOLLMODE_ACLCOEX_CONFIG aclCoexPspollConfig; - BTCOEX_OPTMODE_ACLCOEX_CONFIG aclCoexOptConfig; -}POSTPACK WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD; - -/* -----------WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID ------------------*/ -typedef enum { - WMI_BTCOEX_BT_PROFILE_SCO =1, - WMI_BTCOEX_BT_PROFILE_A2DP, - WMI_BTCOEX_BT_PROFILE_INQUIRY_PAGE, - WMI_BTCOEX_BT_PROFILE_ACLCOEX, -}WMI_BTCOEX_BT_PROFILE; - -typedef PREPACK struct { - A_UINT32 btProfileType; - A_UINT32 btOperatingStatus; - A_UINT32 btLinkId; -}WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD; - -/*--------------------- WMI_SET_BTCOEX_DEBUG_CMDID ---------------------*/ -/* Used for firmware development and debugging */ -typedef PREPACK struct { - A_UINT32 btcoexDbgParam1; - A_UINT32 btcoexDbgParam2; - A_UINT32 btcoexDbgParam3; - A_UINT32 btcoexDbgParam4; - A_UINT32 btcoexDbgParam5; -}WMI_SET_BTCOEX_DEBUG_CMD; - -/*---------------------WMI_GET_BTCOEX_CONFIG_CMDID --------------------- */ -/* Command to firmware to get configuration parameters of the bt profile - * reported via WMI_BTCOEX_CONFIG_EVENTID */ -typedef PREPACK struct { - A_UINT32 btProfileType; /* 1 - SCO - 2 - A2DP - 3 - INQUIRY_PAGE - 4 - ACLCOEX - */ - A_UINT32 linkId; /* not used */ -}WMI_GET_BTCOEX_CONFIG_CMD; - -/*------------------WMI_REPORT_BTCOEX_CONFIG_EVENTID------------------- */ -/* Event from firmware to host, sent in response to WMI_GET_BTCOEX_CONFIG_CMDID - * */ -typedef PREPACK struct { - A_UINT32 btProfileType; - A_UINT32 linkId; /* not used */ - PREPACK union { - WMI_SET_BTCOEX_SCO_CONFIG_CMD scoConfigCmd; - WMI_SET_BTCOEX_A2DP_CONFIG_CMD a2dpConfigCmd; - WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD aclcoexConfig; - WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD btinquiryPageConfigCmd; - } POSTPACK info; -} POSTPACK WMI_BTCOEX_CONFIG_EVENT; - -/*------------- WMI_REPORT_BTCOEX_BTCOEX_STATS_EVENTID--------------------*/ -/* Used for firmware development and debugging*/ -typedef PREPACK struct { - A_UINT32 highRatePktCnt; - A_UINT32 firstBmissCnt; - A_UINT32 psPollFailureCnt; - A_UINT32 nullFrameFailureCnt; - A_UINT32 optModeTransitionCnt; -}BTCOEX_GENERAL_STATS; - -typedef PREPACK struct { - A_UINT32 scoStompCntAvg; - A_UINT32 scoStompIn100ms; - A_UINT32 scoMaxContStomp; - A_UINT32 scoAvgNoRetries; - A_UINT32 scoMaxNoRetriesIn100ms; -}BTCOEX_SCO_STATS; - -typedef PREPACK struct { - A_UINT32 a2dpBurstCnt; - A_UINT32 a2dpMaxBurstCnt; - A_UINT32 a2dpAvgIdletimeIn100ms; - A_UINT32 a2dpAvgStompCnt; -}BTCOEX_A2DP_STATS; - -typedef PREPACK struct { - A_UINT32 aclPktCntInBtTime; - A_UINT32 aclStompCntInWlanTime; - A_UINT32 aclPktCntIn100ms; -}BTCOEX_ACLCOEX_STATS; - -typedef PREPACK struct { - BTCOEX_GENERAL_STATS coexStats; - BTCOEX_SCO_STATS scoStats; - BTCOEX_A2DP_STATS a2dpStats; - BTCOEX_ACLCOEX_STATS aclCoexStats; -}WMI_BTCOEX_STATS_EVENT; - - -/*--------------------------END OF BTCOEX -------------------------------------*/ - -/* WAC commands - */ - - -typedef PREPACK struct { - A_UINT32 period; - A_UINT32 threshold; - A_INT32 rssi; - A_BOOL enable; - A_CHAR wps_pin[8]; -}WMI_WAC_ENABLE_CMD; - -typedef enum { - WAC_MORE_SCAN = -1, - WAC_SEND_PROBE_IDX = 0, -}WAC_SUBCMD; - -typedef PREPACK struct { - WAC_SUBCMD cmdid; -}WMI_WAC_SCAN_REPLY_CMD; - -typedef PREPACK struct { - A_UINT8 req; - A_UINT8 cmd; - A_UINT8 frame; - A_UINT8 ie[17]; - A_INT32 status; -}WMI_WAC_CTRL_REQ_CMD; - -/* END OF WAC */ - -typedef PREPACK struct { - A_UINT32 sleepState; -}WMI_REPORT_SLEEP_STATE_EVENT; - -typedef enum { - WMI_REPORT_SLEEP_STATUS_IS_DEEP_SLEEP =0, - WMI_REPORT_SLEEP_STATUS_IS_AWAKE -} WMI_REPORT_SLEEP_STATUS; -typedef enum { - DISCONN_EVT_IN_RECONN = 0, /* default */ - NO_DISCONN_EVT_IN_RECONN -} TARGET_EVENT_REPORT_CONFIG; - -typedef PREPACK struct { - A_UINT32 evtConfig; -} POSTPACK WMI_SET_TARGET_EVENT_REPORT_CMD; - - -typedef PREPACK struct { - A_UINT16 cmd_buf_sz; /* HCI cmd buffer size */ - A_UINT8 buf[1]; /* Absolute HCI cmd */ -} POSTPACK WMI_HCI_CMD; - -/* - * Command Replies - */ - -/* - * WMI_GET_CHANNEL_LIST_CMDID reply - */ -typedef PREPACK struct { - A_UINT8 reserved1; - A_UINT8 numChannels; /* number of channels in reply */ - A_UINT16 channelList[1]; /* channel in Mhz */ -} POSTPACK WMI_CHANNEL_LIST_REPLY; - -typedef enum { - A_SUCCEEDED = A_OK, - A_FAILED_DELETE_STREAM_DOESNOT_EXIST=250, - A_SUCCEEDED_MODIFY_STREAM=251, - A_FAILED_INVALID_STREAM = 252, - A_FAILED_MAX_THINSTREAMS = 253, - A_FAILED_CREATE_REMOVE_PSTREAM_FIRST = 254, -} PSTREAM_REPLY_STATUS; - -typedef PREPACK struct { - A_UINT8 status; /* PSTREAM_REPLY_STATUS */ - A_UINT8 txQueueNumber; - A_UINT8 rxQueueNumber; - A_UINT8 trafficClass; - A_UINT8 trafficDirection; /* DIR_TYPE */ -} POSTPACK WMI_CRE_PRIORITY_STREAM_REPLY; - -typedef PREPACK struct { - A_UINT8 status; /* PSTREAM_REPLY_STATUS */ - A_UINT8 txQueueNumber; - A_UINT8 rxQueueNumber; - A_UINT8 trafficDirection; /* DIR_TYPE */ - A_UINT8 trafficClass; -} POSTPACK WMI_DEL_PRIORITY_STREAM_REPLY; - -/* - * List of Events (target to host) - */ -typedef enum { - WMI_READY_EVENTID = 0x1001, - WMI_CONNECT_EVENTID, - WMI_DISCONNECT_EVENTID, - WMI_BSSINFO_EVENTID, - WMI_CMDERROR_EVENTID, - WMI_REGDOMAIN_EVENTID, - WMI_PSTREAM_TIMEOUT_EVENTID, - WMI_NEIGHBOR_REPORT_EVENTID, - WMI_TKIP_MICERR_EVENTID, - WMI_SCAN_COMPLETE_EVENTID, /* 0x100a */ - WMI_REPORT_STATISTICS_EVENTID, - WMI_RSSI_THRESHOLD_EVENTID, - WMI_ERROR_REPORT_EVENTID, - WMI_OPT_RX_FRAME_EVENTID, - WMI_REPORT_ROAM_TBL_EVENTID, - WMI_EXTENSION_EVENTID, - WMI_CAC_EVENTID, - WMI_SNR_THRESHOLD_EVENTID, - WMI_LQ_THRESHOLD_EVENTID, - WMI_TX_RETRY_ERR_EVENTID, /* 0x1014 */ - WMI_REPORT_ROAM_DATA_EVENTID, - WMI_TEST_EVENTID, - WMI_APLIST_EVENTID, - WMI_GET_WOW_LIST_EVENTID, - WMI_GET_PMKID_LIST_EVENTID, - WMI_CHANNEL_CHANGE_EVENTID, - WMI_PEER_NODE_EVENTID, - WMI_PSPOLL_EVENTID, - WMI_DTIMEXPIRY_EVENTID, - WMI_WLAN_VERSION_EVENTID, - WMI_SET_PARAMS_REPLY_EVENTID, - WMI_ADDBA_REQ_EVENTID, /*0x1020 */ - WMI_ADDBA_RESP_EVENTID, - WMI_DELBA_REQ_EVENTID, - WMI_TX_COMPLETE_EVENTID, - WMI_HCI_EVENT_EVENTID, - WMI_ACL_DATA_EVENTID, - WMI_REPORT_SLEEP_STATE_EVENTID, - - WMI_WAPI_REKEY_EVENTID, - - WMI_REPORT_BTCOEX_STATS_EVENTID, - WMI_REPORT_BTCOEX_CONFIG_EVENTID, - WMI_GET_PMK_EVENTID, - - /* DFS Events */ - WMI_DFS_HOST_ATTACH_EVENTID, - WMI_DFS_HOST_INIT_EVENTID, - WMI_DFS_RESET_DELAYLINES_EVENTID, - WMI_DFS_RESET_RADARQ_EVENTID, - WMI_DFS_RESET_AR_EVENTID, - WMI_DFS_RESET_ARQ_EVENTID, /*0x1030*/ - WMI_DFS_SET_DUR_MULTIPLIER_EVENTID, - WMI_DFS_SET_BANGRADAR_EVENTID, - WMI_DFS_SET_DEBUGLEVEL_EVENTID, - WMI_DFS_PHYERR_EVENTID, - /* CCX Evants */ - WMI_CCX_RM_STATUS_EVENTID, - - /* P2P Events */ - WMI_P2P_GO_NEG_RESULT_EVENTID, - - WMI_WAC_SCAN_DONE_EVENTID, - WMI_WAC_REPORT_BSS_EVENTID, - WMI_WAC_START_WPS_EVENTID, - WMI_WAC_CTRL_REQ_REPLY_EVENTID, - - /*RFKILL Events*/ - WMI_RFKILL_STATE_CHANGE_EVENTID, - WMI_RFKILL_GET_MODE_CMD_EVENTID, - - /* More P2P Events */ - WMI_P2P_GO_NEG_REQ_EVENTID, - WMI_P2P_INVITE_REQ_EVENTID, - WMI_P2P_INVITE_RCVD_RESULT_EVENTID, - WMI_P2P_INVITE_SENT_RESULT_EVENTID, /*1040*/ - WMI_P2P_PROV_DISC_RESP_EVENTID, - WMI_P2P_PROV_DISC_REQ_EVENTID, - WMI_P2P_START_SDPD_EVENTID, - WMI_P2P_SDPD_RX_EVENTID, - - WMI_THIN_RESERVED_START_EVENTID = 0x8000, - /* Events in this range are reserved for thinmode - * See wmi_thin.h for actual definitions */ - WMI_THIN_RESERVED_END_EVENTID = 0x8fff, - - WMI_SET_CHANNEL_EVENTID, - WMI_ASSOC_REQ_EVENTID, - - - /* generic ACS event */ - WMI_ACS_EVENTID, - WMI_REPORT_WMM_PARAMS_EVENTID, - WMI_STORERECALL_STORE_EVENTID, - -} WMI_EVENT_ID; - -typedef enum { - WMI_11A_CAPABILITY = 1, - WMI_11G_CAPABILITY = 2, - WMI_11AG_CAPABILITY = 3, - WMI_11NA_CAPABILITY = 4, - WMI_11NG_CAPABILITY = 5, - WMI_11NAG_CAPABILITY = 6, - // END CAPABILITY - WMI_11N_CAPABILITY_OFFSET = (WMI_11NA_CAPABILITY - WMI_11A_CAPABILITY), -} WMI_PHY_CAPABILITY; - -typedef PREPACK struct { - A_UINT8 macaddr[ATH_MAC_LEN]; - A_UINT8 phyCapability; /* WMI_PHY_CAPABILITY */ -} POSTPACK WMI_READY_EVENT_1; - -typedef PREPACK struct { - A_UINT32 sw_version; - A_UINT32 abi_version; - A_UINT8 macaddr[ATH_MAC_LEN]; - A_UINT8 phyCapability; /* WMI_PHY_CAPABILITY */ -} POSTPACK WMI_READY_EVENT_2; - -#if defined(ATH_TARGET) -#ifdef AR6002_REV2 -#define WMI_READY_EVENT WMI_READY_EVENT_1 /* AR6002_REV2 target code */ -#else -#define WMI_READY_EVENT WMI_READY_EVENT_2 /* AR6001, AR6002_REV4, AR6002_REV6 */ -#endif -#else -#define WMI_READY_EVENT WMI_READY_EVENT_2 /* host code */ -#endif - - -/* - * Connect Event - */ -typedef PREPACK struct { - PREPACK union { - struct { - A_UINT16 channel; - A_UINT8 bssid[ATH_MAC_LEN]; - A_UINT16 listenInterval; - A_UINT16 beaconInterval; - A_UINT32 networkType; - } infra_ibss_bss; - struct { - A_UINT8 phymode; - A_UINT8 aid; - A_UINT8 mac_addr[ATH_MAC_LEN]; - A_UINT8 auth; - A_UINT8 keymgmt; - A_UINT16 cipher; - A_UINT8 apsd_info; - A_UINT8 unused[3]; - } ap_sta; - struct { - A_UINT16 channel; - A_UINT8 bssid[ATH_MAC_LEN]; - A_UINT8 unused[8]; - } ap_bss; - } POSTPACK u; - A_UINT8 beaconIeLen; - A_UINT8 assocReqLen; - A_UINT8 assocRespLen; - A_UINT8 assocInfo[1]; -} POSTPACK WMI_CONNECT_EVENT; - - -typedef struct { - A_UINT8 status; - A_UINT8 rspType; -} WMI_ASSOCREQ_EVENT; - -typedef PREPACK struct { - A_UINT8 host_accept; - A_UINT8 host_reasonCode; - A_UINT8 target_status; - A_UINT8 sta_mac_addr[ATH_MAC_LEN]; - A_UINT8 rspType; -} POSTPACK WMI_SEND_ASSOCRES_CMD; - -typedef struct { - A_UINT8 enable; -} WMI_SET_ASSOCREQ_RELAY; - -/* - * Disconnect Event - */ -typedef enum { - NO_NETWORK_AVAIL = 0x01, - LOST_LINK = 0x02, /* bmiss */ - DISCONNECT_CMD = 0x03, - BSS_DISCONNECTED = 0x04, - AUTH_FAILED = 0x05, - ASSOC_FAILED = 0x06, - NO_RESOURCES_AVAIL = 0x07, - CSERV_DISCONNECT = 0x08, - INVALID_PROFILE = 0x0a, - DOT11H_CHANNEL_SWITCH = 0x0b, - PROFILE_MISMATCH = 0x0c, - CONNECTION_EVICTED = 0x0d, - IBSS_MERGE = 0x0e, - EXCESS_TX_RETRY = 0x0f, /* TX frames failed after excessive retries */ -} WMI_DISCONNECT_REASON; - -typedef PREPACK struct { - A_UINT16 protocolReasonStatus; /* reason code, see 802.11 spec. */ - A_UINT8 bssid[ATH_MAC_LEN]; /* set if known */ - A_UINT8 disconnectReason ; /* see WMI_DISCONNECT_REASON */ - A_UINT8 assocRespLen; - A_UINT8 assocInfo[1]; -} POSTPACK WMI_DISCONNECT_EVENT; - -/* - * BSS Info Event. - * Mechanism used to inform host of the presence and characteristic of - * wireless networks present. Consists of bss info header followed by - * the beacon or probe-response frame body. The 802.11 header is not included. - */ -typedef enum { - BEACON_FTYPE = 0x1, - PROBERESP_FTYPE, - ACTION_MGMT_FTYPE, - PROBEREQ_FTYPE, -} WMI_BI_FTYPE; - -enum { - BSS_ELEMID_CHANSWITCH = 0x01, - BSS_ELEMID_ATHEROS = 0x02, -}; - -typedef PREPACK struct { - A_UINT16 channel; - A_UINT8 frameType; /* see WMI_BI_FTYPE */ - A_UINT8 snr; - A_INT16 rssi; - A_UINT8 bssid[ATH_MAC_LEN]; - A_UINT32 ieMask; -} POSTPACK WMI_BSS_INFO_HDR; - -/* - * BSS INFO HDR version 2.0 - * With 6 bytes HTC header and 6 bytes of WMI header - * WMI_BSS_INFO_HDR cannot be accomodated in the removed 802.11 management - * header space. - * - Reduce the ieMask to 2 bytes as only two bit flags are used - * - Remove rssi and compute it on the host. rssi = snr - 95 - */ -typedef PREPACK struct { - A_UINT16 channel; - A_UINT8 frameType; /* see WMI_BI_FTYPE */ - A_UINT8 snr; - A_UINT8 bssid[ATH_MAC_LEN]; - A_UINT16 ieMask; -} POSTPACK WMI_BSS_INFO_HDR2; - -typedef PREPACK struct { - A_UINT8 bssid[ATH_MAC_LEN]; - A_UINT8 pin[8]; -} POSTPACK WMI_WPS_PIN_INFO; - -typedef PREPACK struct { - PREPACK union { - A_UINT8 ie[17]; - A_INT32 wac_status; - } POSTPACK info; -} POSTPACK WMI_GET_WAC_INFO; - -/* - * Command Error Event - */ -typedef enum { - INVALID_PARAM = 0x01, - ILLEGAL_STATE = 0x02, - INTERNAL_ERROR = 0x03, -} WMI_ERROR_CODE; - -typedef PREPACK struct { - A_UINT16 commandId; - A_UINT8 errorCode; -} POSTPACK WMI_CMD_ERROR_EVENT; - -/* - * New Regulatory Domain Event - */ -typedef PREPACK struct { - A_UINT32 regDomain; -} POSTPACK WMI_REG_DOMAIN_EVENT; - -typedef PREPACK struct { - A_UINT8 txQueueNumber; - A_UINT8 rxQueueNumber; - A_UINT8 trafficDirection; - A_UINT8 trafficClass; -} POSTPACK WMI_PSTREAM_TIMEOUT_EVENT; - -/* - * The WMI_NEIGHBOR_REPORT Event is generated by the target to inform - * the host of BSS's it has found that matches the current profile. - * It can be used by the host to cache PMKs and/to initiate pre-authentication - * if the BSS supports it. The first bssid is always the current associated - * BSS. - * The bssid and bssFlags information repeats according to the number - * or APs reported. - */ -typedef enum { - WMI_DEFAULT_BSS_FLAGS = 0x00, - WMI_PREAUTH_CAPABLE_BSS = 0x01, - WMI_PMKID_VALID_BSS = 0x02, -} WMI_BSS_FLAGS; - -typedef PREPACK struct { - A_UINT8 bssid[ATH_MAC_LEN]; - A_UINT8 bssFlags; /* see WMI_BSS_FLAGS */ -} POSTPACK WMI_NEIGHBOR_INFO; - -typedef PREPACK struct { - A_INT8 numberOfAps; - WMI_NEIGHBOR_INFO neighbor[1]; -} POSTPACK WMI_NEIGHBOR_REPORT_EVENT; - -/* - * TKIP MIC Error Event - */ -typedef PREPACK struct { - A_UINT8 keyid; - A_UINT8 ismcast; -} POSTPACK WMI_TKIP_MICERR_EVENT; - -/* - * WMI_SCAN_COMPLETE_EVENTID - no parameters (old), staus parameter (new) - */ -typedef PREPACK struct { - A_INT32 status; -} POSTPACK WMI_SCAN_COMPLETE_EVENT; - -typedef PREPACK struct { - A_INT32 rm_type; - A_INT32 status; -} POSTPACK WMI_CCX_RM_STATUS_EVENT; - -#define MAX_OPT_DATA_LEN 1400 - -/* - * WMI_SET_ADHOC_BSSID_CMDID - */ -typedef PREPACK struct { - A_UINT8 bssid[ATH_MAC_LEN]; -} POSTPACK WMI_SET_ADHOC_BSSID_CMD; - -/* - * Special frame receive Event. - * Mechanism used to inform host of the receiption of the special frames. - * Consists of special frame info header followed by special frame body. - * The 802.11 header is not included. - */ -typedef PREPACK struct { - A_UINT16 channel; - A_UINT8 frameType; /* see WMI_OPT_FTYPE */ - A_INT8 snr; - A_UINT8 srcAddr[ATH_MAC_LEN]; - A_UINT8 bssid[ATH_MAC_LEN]; -} POSTPACK WMI_OPT_RX_INFO_HDR; - -/* - * Reporting statistics. - */ -typedef PREPACK struct { - A_UINT32 tx_packets; - A_UINT32 tx_bytes; - A_UINT32 tx_unicast_pkts; - A_UINT32 tx_unicast_bytes; - A_UINT32 tx_multicast_pkts; - A_UINT32 tx_multicast_bytes; - A_UINT32 tx_broadcast_pkts; - A_UINT32 tx_broadcast_bytes; - A_UINT32 tx_rts_success_cnt; - A_UINT32 tx_packet_per_ac[4]; - A_UINT32 tx_errors_per_ac[4]; - - A_UINT32 tx_errors; - A_UINT32 tx_failed_cnt; - A_UINT32 tx_retry_cnt; - A_UINT32 tx_mult_retry_cnt; - A_UINT32 tx_rts_fail_cnt; - A_INT32 tx_unicast_rate; -}POSTPACK tx_stats_t; - -typedef PREPACK struct { - A_UINT32 rx_packets; - A_UINT32 rx_bytes; - A_UINT32 rx_unicast_pkts; - A_UINT32 rx_unicast_bytes; - A_UINT32 rx_multicast_pkts; - A_UINT32 rx_multicast_bytes; - A_UINT32 rx_broadcast_pkts; - A_UINT32 rx_broadcast_bytes; - A_UINT32 rx_fragment_pkt; - - A_UINT32 rx_errors; - A_UINT32 rx_crcerr; - A_UINT32 rx_key_cache_miss; - A_UINT32 rx_decrypt_err; - A_UINT32 rx_duplicate_frames; - A_INT32 rx_unicast_rate; -}POSTPACK rx_stats_t; - -typedef PREPACK struct { - A_UINT32 tkip_local_mic_failure; - A_UINT32 tkip_counter_measures_invoked; - A_UINT32 tkip_replays; - A_UINT32 tkip_format_errors; - A_UINT32 ccmp_format_errors; - A_UINT32 ccmp_replays; -}POSTPACK tkip_ccmp_stats_t; - -typedef PREPACK struct { - A_UINT32 power_save_failure_cnt; - A_UINT16 stop_tx_failure_cnt; - A_UINT16 atim_tx_failure_cnt; - A_UINT16 atim_rx_failure_cnt; - A_UINT16 bcn_rx_failure_cnt; -}POSTPACK pm_stats_t; - -typedef PREPACK struct { - A_UINT32 cs_bmiss_cnt; - A_UINT32 cs_lowRssi_cnt; - A_UINT16 cs_connect_cnt; - A_UINT16 cs_disconnect_cnt; - A_INT16 cs_aveBeacon_rssi; - A_UINT16 cs_roam_count; - A_INT16 cs_rssi; - A_UINT8 cs_snr; - A_UINT8 cs_aveBeacon_snr; - A_UINT8 cs_lastRoam_msec; -} POSTPACK cserv_stats_t; - -typedef PREPACK struct { - tx_stats_t tx_stats; - rx_stats_t rx_stats; - tkip_ccmp_stats_t tkipCcmpStats; -}POSTPACK wlan_net_stats_t; - -typedef PREPACK struct { - A_UINT32 arp_received; - A_UINT32 arp_matched; - A_UINT32 arp_replied; -} POSTPACK arp_stats_t; - -typedef PREPACK struct { - A_UINT32 wow_num_pkts_dropped; - A_UINT16 wow_num_events_discarded; - A_UINT8 wow_num_host_pkt_wakeups; - A_UINT8 wow_num_host_event_wakeups; -} POSTPACK wlan_wow_stats_t; - -typedef PREPACK struct { - A_UINT32 lqVal; - A_INT32 noise_floor_calibation; - pm_stats_t pmStats; - wlan_net_stats_t txrxStats; - wlan_wow_stats_t wowStats; - arp_stats_t arpStats; - cserv_stats_t cservStats; -} POSTPACK WMI_TARGET_STATS; - -/* - * WMI_RSSI_THRESHOLD_EVENTID. - * Indicate the RSSI events to host. Events are indicated when we breach a - * thresold value. - */ -typedef enum{ - WMI_RSSI_THRESHOLD1_ABOVE = 0, - WMI_RSSI_THRESHOLD2_ABOVE, - WMI_RSSI_THRESHOLD3_ABOVE, - WMI_RSSI_THRESHOLD4_ABOVE, - WMI_RSSI_THRESHOLD5_ABOVE, - WMI_RSSI_THRESHOLD6_ABOVE, - WMI_RSSI_THRESHOLD1_BELOW, - WMI_RSSI_THRESHOLD2_BELOW, - WMI_RSSI_THRESHOLD3_BELOW, - WMI_RSSI_THRESHOLD4_BELOW, - WMI_RSSI_THRESHOLD5_BELOW, - WMI_RSSI_THRESHOLD6_BELOW -}WMI_RSSI_THRESHOLD_VAL; - -typedef PREPACK struct { - A_INT16 rssi; - A_UINT8 range; -}POSTPACK WMI_RSSI_THRESHOLD_EVENT; - -/* - * WMI_ERROR_REPORT_EVENTID - */ -typedef enum{ - WMI_TARGET_PM_ERR_FAIL = 0x00000001, - WMI_TARGET_KEY_NOT_FOUND = 0x00000002, - WMI_TARGET_DECRYPTION_ERR = 0x00000004, - WMI_TARGET_BMISS = 0x00000008, - WMI_PSDISABLE_NODE_JOIN = 0x00000010, - WMI_TARGET_COM_ERR = 0x00000020, - WMI_TARGET_FATAL_ERR = 0x00000040, - WMI_TARGET_BCN_FOUND = 0x00000080 -} WMI_TARGET_ERROR_VAL; - -typedef PREPACK struct { - A_UINT32 errorVal; -}POSTPACK WMI_TARGET_ERROR_REPORT_EVENT; - -typedef PREPACK struct { - A_UINT8 retrys; -}POSTPACK WMI_TX_RETRY_ERR_EVENT; - -typedef enum{ - WMI_SNR_THRESHOLD1_ABOVE = 1, - WMI_SNR_THRESHOLD1_BELOW, - WMI_SNR_THRESHOLD2_ABOVE, - WMI_SNR_THRESHOLD2_BELOW, - WMI_SNR_THRESHOLD3_ABOVE, - WMI_SNR_THRESHOLD3_BELOW, - WMI_SNR_THRESHOLD4_ABOVE, - WMI_SNR_THRESHOLD4_BELOW -} WMI_SNR_THRESHOLD_VAL; - -typedef PREPACK struct { - A_UINT8 range; /* WMI_SNR_THRESHOLD_VAL */ - A_UINT8 snr; -}POSTPACK WMI_SNR_THRESHOLD_EVENT; - -typedef enum{ - WMI_LQ_THRESHOLD1_ABOVE = 1, - WMI_LQ_THRESHOLD1_BELOW, - WMI_LQ_THRESHOLD2_ABOVE, - WMI_LQ_THRESHOLD2_BELOW, - WMI_LQ_THRESHOLD3_ABOVE, - WMI_LQ_THRESHOLD3_BELOW, - WMI_LQ_THRESHOLD4_ABOVE, - WMI_LQ_THRESHOLD4_BELOW -} WMI_LQ_THRESHOLD_VAL; - -typedef PREPACK struct { - A_INT32 lq; - A_UINT8 range; /* WMI_LQ_THRESHOLD_VAL */ -}POSTPACK WMI_LQ_THRESHOLD_EVENT; -/* - * WMI_REPORT_ROAM_TBL_EVENTID - */ -#define MAX_ROAM_TBL_CAND 5 - -typedef PREPACK struct { - A_INT32 roam_util; - A_UINT8 bssid[ATH_MAC_LEN]; - A_INT8 rssi; - A_INT8 rssidt; - A_INT8 last_rssi; - A_INT8 util; - A_INT8 bias; - A_UINT8 reserved; /* For alignment */ -} POSTPACK WMI_BSS_ROAM_INFO; - - -typedef PREPACK struct { - A_UINT16 roamMode; - A_UINT16 numEntries; - WMI_BSS_ROAM_INFO bssRoamInfo[1]; -} POSTPACK WMI_TARGET_ROAM_TBL; - -/* - * WMI_HCI_EVENT_EVENTID - */ -typedef PREPACK struct { - A_UINT16 evt_buf_sz; /* HCI event buffer size */ - A_UINT8 buf[1]; /* HCI event */ -} POSTPACK WMI_HCI_EVENT; - -/* - * WMI_CAC_EVENTID - */ -typedef enum { - CAC_INDICATION_ADMISSION = 0x00, - CAC_INDICATION_ADMISSION_RESP = 0x01, - CAC_INDICATION_DELETE = 0x02, - CAC_INDICATION_NO_RESP = 0x03, -}CAC_INDICATION; - -#define WMM_TSPEC_IE_LEN 63 - -typedef PREPACK struct { - A_UINT8 ac; - A_UINT8 cac_indication; - A_UINT8 statusCode; - A_UINT8 tspecSuggestion[WMM_TSPEC_IE_LEN]; -}POSTPACK WMI_CAC_EVENT; - -/* - * WMI_APLIST_EVENTID - */ - -typedef enum { - APLIST_VER1 = 1, -} APLIST_VER; - -typedef PREPACK struct { - A_UINT8 bssid[ATH_MAC_LEN]; - A_UINT16 channel; -} POSTPACK WMI_AP_INFO_V1; - -typedef PREPACK union { - WMI_AP_INFO_V1 apInfoV1; -} POSTPACK WMI_AP_INFO; - -typedef PREPACK struct { - A_UINT8 apListVer; - A_UINT8 numAP; - WMI_AP_INFO apList[1]; -} POSTPACK WMI_APLIST_EVENT; - -/* - * developer commands - */ - -/* - * WMI_SET_BITRATE_CMDID - * - * Get bit rate cmd uses same definition as set bit rate cmd - */ -typedef enum { - RATE_AUTO = -1, - RATE_1Mb = 0, - RATE_2Mb = 1, - RATE_5_5Mb = 2, - RATE_11Mb = 3, - RATE_6Mb = 4, - RATE_9Mb = 5, - RATE_12Mb = 6, - RATE_18Mb = 7, - RATE_24Mb = 8, - RATE_36Mb = 9, - RATE_48Mb = 10, - RATE_54Mb = 11, - RATE_MCS_0_20 = 12, - RATE_MCS_1_20 = 13, - RATE_MCS_2_20 = 14, - RATE_MCS_3_20 = 15, - RATE_MCS_4_20 = 16, - RATE_MCS_5_20 = 17, - RATE_MCS_6_20 = 18, - RATE_MCS_7_20 = 19, - RATE_MCS_0_40 = 20, - RATE_MCS_1_40 = 21, - RATE_MCS_2_40 = 22, - RATE_MCS_3_40 = 23, - RATE_MCS_4_40 = 24, - RATE_MCS_5_40 = 25, - RATE_MCS_6_40 = 26, - RATE_MCS_7_40 = 27, -} WMI_BIT_RATE; - -typedef PREPACK struct { - A_INT8 rateIndex; /* see WMI_BIT_RATE */ - A_INT8 mgmtRateIndex; - A_INT8 ctlRateIndex; -} POSTPACK WMI_BIT_RATE_CMD; - - -typedef PREPACK struct { - A_INT8 rateIndex; /* see WMI_BIT_RATE */ -} POSTPACK WMI_BIT_RATE_REPLY; - - -/* - * WMI_SET_FIXRATES_CMDID - * - * Get fix rates cmd uses same definition as set fix rates cmd - */ -#define FIX_RATE_1Mb ((A_UINT32)0x1) -#define FIX_RATE_2Mb ((A_UINT32)0x2) -#define FIX_RATE_5_5Mb ((A_UINT32)0x4) -#define FIX_RATE_11Mb ((A_UINT32)0x8) -#define FIX_RATE_6Mb ((A_UINT32)0x10) -#define FIX_RATE_9Mb ((A_UINT32)0x20) -#define FIX_RATE_12Mb ((A_UINT32)0x40) -#define FIX_RATE_18Mb ((A_UINT32)0x80) -#define FIX_RATE_24Mb ((A_UINT32)0x100) -#define FIX_RATE_36Mb ((A_UINT32)0x200) -#define FIX_RATE_48Mb ((A_UINT32)0x400) -#define FIX_RATE_54Mb ((A_UINT32)0x800) -#define FIX_RATE_MCS_0_20 ((A_UINT32)0x1000) -#define FIX_RATE_MCS_1_20 ((A_UINT32)0x2000) -#define FIX_RATE_MCS_2_20 ((A_UINT32)0x4000) -#define FIX_RATE_MCS_3_20 ((A_UINT32)0x8000) -#define FIX_RATE_MCS_4_20 ((A_UINT32)0x10000) -#define FIX_RATE_MCS_5_20 ((A_UINT32)0x20000) -#define FIX_RATE_MCS_6_20 ((A_UINT32)0x40000) -#define FIX_RATE_MCS_7_20 ((A_UINT32)0x80000) -#define FIX_RATE_MCS_0_40 ((A_UINT32)0x100000) -#define FIX_RATE_MCS_1_40 ((A_UINT32)0x200000) -#define FIX_RATE_MCS_2_40 ((A_UINT32)0x400000) -#define FIX_RATE_MCS_3_40 ((A_UINT32)0x800000) -#define FIX_RATE_MCS_4_40 ((A_UINT32)0x1000000) -#define FIX_RATE_MCS_5_40 ((A_UINT32)0x2000000) -#define FIX_RATE_MCS_6_40 ((A_UINT32)0x4000000) -#define FIX_RATE_MCS_7_40 ((A_UINT32)0x8000000) - -typedef PREPACK struct { - A_UINT32 fixRateMask[WMI_MAX_RATE_MASK]; /* see WMI_BIT_RATE */ -} POSTPACK WMI_FIX_RATES_CMD, WMI_FIX_RATES_REPLY; - -typedef PREPACK struct { - A_UINT8 bEnableMask; - A_UINT8 frameType; /* type and subtype */ - A_UINT8 reserved[2]; /* for alignment */ - A_UINT32 frameRateMask[WMI_MAX_RATE_MASK]; /* see WMI_BIT_RATE */ -} POSTPACK WMI_FRAME_RATES_CMD, WMI_FRAME_RATES_REPLY; - -/* - * WMI_SET_RECONNECT_AUTH_MODE_CMDID - * - * Set authentication mode - */ -typedef enum { - RECONN_DO_AUTH = 0x00, - RECONN_NOT_AUTH = 0x01 -} WMI_AUTH_MODE; - -typedef PREPACK struct { - A_UINT8 mode; -} POSTPACK WMI_SET_AUTH_MODE_CMD; - -/* - * WMI_SET_REASSOC_MODE_CMDID - * - * Set authentication mode - */ -typedef enum { - REASSOC_DO_DISASSOC = 0x00, - REASSOC_DONOT_DISASSOC = 0x01 -} WMI_REASSOC_MODE; - -typedef PREPACK struct { - A_UINT8 mode; -}POSTPACK WMI_SET_REASSOC_MODE_CMD; - -typedef enum { - ROAM_DATA_TIME = 1, /* Get The Roam Time Data */ -} ROAM_DATA_TYPE; - -typedef PREPACK struct { - A_UINT32 disassoc_time; - A_UINT32 no_txrx_time; - A_UINT32 assoc_time; - A_UINT32 allow_txrx_time; - A_UINT8 disassoc_bssid[ATH_MAC_LEN]; - A_INT8 disassoc_bss_rssi; - A_UINT8 assoc_bssid[ATH_MAC_LEN]; - A_INT8 assoc_bss_rssi; -} POSTPACK WMI_TARGET_ROAM_TIME; - -typedef PREPACK struct { - PREPACK union { - WMI_TARGET_ROAM_TIME roamTime; - } POSTPACK u; - A_UINT8 roamDataType ; -} POSTPACK WMI_TARGET_ROAM_DATA; - -typedef enum { - WMI_WMM_DISABLED = 0, - WMI_WMM_ENABLED -} WMI_WMM_STATUS; - -typedef PREPACK struct { - A_UINT8 status; -}POSTPACK WMI_SET_WMM_CMD; - -typedef PREPACK struct { - A_UINT8 status; -}POSTPACK WMI_SET_QOS_SUPP_CMD; - -typedef enum { - WMI_TXOP_DISABLED = 0, - WMI_TXOP_ENABLED -} WMI_TXOP_CFG; - -typedef PREPACK struct { - A_UINT8 txopEnable; -}POSTPACK WMI_SET_WMM_TXOP_CMD; - -typedef PREPACK struct { - A_UINT8 keepaliveInterval; -} POSTPACK WMI_SET_KEEPALIVE_CMD; - -typedef PREPACK struct { - A_BOOL configured; - A_UINT8 keepaliveInterval; -} POSTPACK WMI_GET_KEEPALIVE_CMD; - -/* - * Add Application specified IE to a management frame - */ -#define WMI_MAX_IE_LEN 255 - -typedef PREPACK struct { - A_UINT8 mgmtFrmType; /* one of WMI_MGMT_FRAME_TYPE */ - A_UINT8 ieLen; /* Length of the IE that should be added to the MGMT frame */ - A_UINT8 ieInfo[1]; -} POSTPACK WMI_SET_APPIE_CMD; - -/* - * Notify the WSC registration status to the target - */ -#define WSC_REG_ACTIVE 1 -#define WSC_REG_INACTIVE 0 -/* Generic Hal Interface for setting hal paramters. */ -/* Add new Set HAL Param cmdIds here for newer params */ -typedef enum { - WHAL_SETCABTO_CMDID = 1, -}WHAL_CMDID; - -typedef PREPACK struct { - A_UINT8 cabTimeOut; -} POSTPACK WHAL_SETCABTO_PARAM; - -typedef PREPACK struct { - A_UINT8 whalCmdId; - A_UINT8 data[1]; -} POSTPACK WHAL_PARAMCMD; - - -#define WOW_MAX_FILTER_LISTS 1 /*4*/ -#define WOW_MAX_FILTERS_PER_LIST 4 -#define WOW_PATTERN_SIZE 64 -#define WOW_MASK_SIZE 64 - -#define MAC_MAX_FILTERS_PER_LIST 7 - -typedef PREPACK struct { - A_UINT8 wow_valid_filter; - A_UINT8 wow_filter_id; - A_UINT8 wow_filter_size; - A_UINT8 wow_filter_offset; - A_UINT8 wow_filter_mask[WOW_MASK_SIZE]; - A_UINT8 wow_filter_pattern[WOW_PATTERN_SIZE]; -} POSTPACK WOW_FILTER; - - -typedef PREPACK struct { - A_UINT8 wow_valid_list; - A_UINT8 wow_list_id; - A_UINT8 wow_num_filters; - A_UINT8 wow_total_list_size; - WOW_FILTER list[WOW_MAX_FILTERS_PER_LIST]; -} POSTPACK WOW_FILTER_LIST; - -typedef PREPACK struct { - A_UINT8 valid_filter; - A_UINT8 mac_addr[ATH_MAC_LEN]; -} POSTPACK MAC_FILTER; - - -typedef PREPACK struct { - A_UINT8 total_list_size; - A_UINT8 enable; - MAC_FILTER list[MAC_MAX_FILTERS_PER_LIST]; -} POSTPACK MAC_FILTER_LIST; - -#define MAX_IP_ADDRS 2 -typedef PREPACK struct { - A_UINT32 ips[MAX_IP_ADDRS]; /* IP in Network Byte Order */ -} POSTPACK WMI_SET_IP_CMD; - -typedef PREPACK struct { - A_BOOL awake; - A_BOOL asleep; -} POSTPACK WMI_SET_HOST_SLEEP_MODE_CMD; - -typedef enum { - WOW_FILTER_SSID = 0x1 -} WMI_WOW_FILTER; - -typedef PREPACK struct { - A_BOOL enable_wow; - WMI_WOW_FILTER filter; - A_UINT16 hostReqDelay; -} POSTPACK WMI_SET_WOW_MODE_CMD; - -typedef PREPACK struct { - A_UINT8 filter_list_id; -} POSTPACK WMI_GET_WOW_LIST_CMD; - -/* - * WMI_GET_WOW_LIST_CMD reply - */ -typedef PREPACK struct { - A_UINT8 num_filters; /* number of patterns in reply */ - A_UINT8 this_filter_num; /* this is filter # x of total num_filters */ - A_UINT8 wow_mode; - A_UINT8 host_mode; - WOW_FILTER wow_filters[1]; -} POSTPACK WMI_GET_WOW_LIST_REPLY; - -typedef PREPACK struct { - A_UINT8 filter_list_id; - A_UINT8 filter_size; - A_UINT8 filter_offset; - A_UINT8 filter[1]; -} POSTPACK WMI_ADD_WOW_PATTERN_CMD; - -typedef PREPACK struct { - A_UINT16 filter_list_id; - A_UINT16 filter_id; -} POSTPACK WMI_DEL_WOW_PATTERN_CMD; - -typedef PREPACK struct { - A_UINT8 macaddr[ATH_MAC_LEN]; -} POSTPACK WMI_SET_MAC_ADDRESS_CMD; - -/* - * WMI_SET_AKMP_PARAMS_CMD - */ - -#define WMI_AKMP_MULTI_PMKID_EN 0x000001 - -typedef PREPACK struct { - A_UINT32 akmpInfo; -} POSTPACK WMI_SET_AKMP_PARAMS_CMD; - -typedef PREPACK struct { - A_UINT8 pmkid[WMI_PMKID_LEN]; -} POSTPACK WMI_PMKID; - -/* - * WMI_SET_PMKID_LIST_CMD - */ -#define WMI_MAX_PMKID_CACHE 8 - -typedef PREPACK struct { - A_UINT32 numPMKID; - WMI_PMKID pmkidList[WMI_MAX_PMKID_CACHE]; -} POSTPACK WMI_SET_PMKID_LIST_CMD; - -/* - * WMI_GET_PMKID_LIST_CMD Reply - * Following the Number of PMKIDs is the list of PMKIDs - */ -typedef PREPACK struct { - A_UINT32 numPMKID; - A_UINT8 bssidList[ATH_MAC_LEN][1]; - WMI_PMKID pmkidList[1]; -} POSTPACK WMI_PMKID_LIST_REPLY; - -typedef PREPACK struct { - A_UINT16 oldChannel; - A_UINT32 newChannel; -} POSTPACK WMI_CHANNEL_CHANGE_EVENT; - -typedef PREPACK struct { - A_UINT32 version; -} POSTPACK WMI_WLAN_VERSION_EVENT; - - -/* WMI_ADDBA_REQ_EVENTID */ -typedef PREPACK struct { - A_UINT8 tid; - A_UINT8 win_sz; - A_UINT16 st_seq_no; - A_UINT8 status; /* f/w response for ADDBA Req; OK(0) or failure(!=0) */ -} POSTPACK WMI_ADDBA_REQ_EVENT; - -/* WMI_ADDBA_RESP_EVENTID */ -typedef PREPACK struct { - A_UINT8 tid; - A_UINT8 status; /* OK(0), failure (!=0) */ - A_UINT16 amsdu_sz; /* Three values: Not supported(0), 3839, 8k */ -} POSTPACK WMI_ADDBA_RESP_EVENT; - -/* WMI_DELBA_EVENTID - * f/w received a DELBA for peer and processed it. - * Host is notified of this - */ -typedef PREPACK struct { - A_UINT8 tid; - A_UINT8 is_peer_initiator; - A_UINT16 reason_code; -} POSTPACK WMI_DELBA_EVENT; - - -#ifdef WAPI_ENABLE -#define WAPI_REKEY_UCAST 1 -#define WAPI_REKEY_MCAST 2 -typedef PREPACK struct { - A_UINT8 type; - A_UINT8 macAddr[ATH_MAC_LEN]; -} POSTPACK WMI_WAPIREKEY_EVENT; -#endif - - -/* WMI_ALLOW_AGGR_CMDID - * Configures tid's to allow ADDBA negotiations - * on each tid, in each direction - */ -typedef PREPACK struct { - A_UINT16 tx_allow_aggr; /* 16-bit mask to allow uplink ADDBA negotiation - bit position indicates tid*/ - A_UINT16 rx_allow_aggr; /* 16-bit mask to allow donwlink ADDBA negotiation - bit position indicates tid*/ -} POSTPACK WMI_ALLOW_AGGR_CMD; - -/* WMI_ADDBA_REQ_CMDID - * f/w starts performing ADDBA negotiations with peer - * on the given tid - */ -typedef PREPACK struct { - A_UINT8 tid; -} POSTPACK WMI_ADDBA_REQ_CMD; - -/* WMI_DELBA_REQ_CMDID - * f/w would teardown BA with peer. - * is_send_initiator indicates if it's or tx or rx side - */ -typedef PREPACK struct { - A_UINT8 tid; - A_UINT8 is_sender_initiator; - -} POSTPACK WMI_DELBA_REQ_CMD; - -#define PEER_NODE_JOIN_EVENT 0x00 -#define PEER_NODE_LEAVE_EVENT 0x01 -#define PEER_FIRST_NODE_JOIN_EVENT 0x10 -#define PEER_LAST_NODE_LEAVE_EVENT 0x11 -typedef PREPACK struct { - A_UINT8 eventCode; - A_UINT8 peerMacAddr[ATH_MAC_LEN]; -} POSTPACK WMI_PEER_NODE_EVENT; - -#define IEEE80211_FRAME_TYPE_MGT 0x00 -#define IEEE80211_FRAME_TYPE_CTL 0x04 - -typedef PREPACK struct { - A_UINT32 rules; /* combination of WMI_WRT_... values */ -} POSTPACK WMI_CONFIG_TX_MAC_RULES_CMD; - -typedef PREPACK struct { - A_UINT8 enable; /* 1 == device operates in promiscuous mode , 0 == normal mode */ -} POSTPACK WMI_SET_PROMISCUOUS_MODE_CMD; - -typedef enum { - RADIO_STATE_OFF = 0x1, - RADIO_STATE_ON = 0x2, - RADIO_STATE_INVALID = 0xFF -}RFKILL_RADIO_STATE; - -typedef PREPACK struct { - A_UINT8 GPIOPinNumber; - A_UINT8 IntrType; - A_UINT8 RadioState; -} POSTPACK WMI_RFKILL_MODE_CMD; - -/* - * Transmit complete event data structure(s) - */ - - -typedef PREPACK struct { -#define TX_COMPLETE_STATUS_SUCCESS 0 -#define TX_COMPLETE_STATUS_RETRIES 1 -#define TX_COMPLETE_STATUS_NOLINK 2 -#define TX_COMPLETE_STATUS_TIMEOUT 3 -#define TX_COMPLETE_STATUS_OTHER 4 - - A_UINT8 status; /* one of TX_COMPLETE_STATUS_... */ - A_UINT8 pktID; /* packet ID to identify parent packet */ - A_UINT8 rateIdx; /* rate index on successful transmission */ - A_UINT8 ackFailures; /* number of ACK failures in tx attempt */ -#if 0 /* optional params currently ommitted. */ - A_UINT32 queueDelay; // usec delay measured Tx Start time - host delivery time - A_UINT32 mediaDelay; // usec delay measured ACK rx time - host delivery time -#endif -} POSTPACK TX_COMPLETE_MSG_V1; /* version 1 of tx complete msg */ - -typedef PREPACK struct { - A_UINT8 numMessages; /* number of tx comp msgs following this struct */ - A_UINT8 msgLen; /* length in bytes for each individual msg following this struct */ - A_UINT8 msgType; /* version of tx complete msg data following this struct */ - A_UINT8 reserved; /* individual messages follow this header */ -} POSTPACK WMI_TX_COMPLETE_EVENT; - -#define WMI_TXCOMPLETE_VERSION_1 (0x01) - - -/* - * ------- AP Mode definitions -------------- - */ - -/* - * !!! Warning !!! - * -Changing the following values needs compilation of both driver and firmware - */ -#ifdef AR6002_REV2 -#define AP_MAX_NUM_STA 4 -#else -#define AP_MAX_NUM_STA 10 -#endif - -/*Maximum no. of virtual interface supported*/ -#define NUM_DEV 3 -#define NUM_CONN (AP_MAX_NUM_STA + NUM_DEV) - -#define AP_ACL_SIZE 10 -#define IEEE80211_MAX_IE 256 -#define MCAST_AID 0xFF /* Spl. AID used to set DTIM flag in the beacons */ -#define DEF_AP_COUNTRY_CODE "US " -#define DEF_AP_WMODE_G WMI_11G_MODE -#define DEF_AP_WMODE_AG WMI_11AG_MODE -#define DEF_AP_DTIM 5 -#define DEF_BEACON_INTERVAL 100 - -/* AP mode disconnect reasons */ -#define AP_DISCONNECT_STA_LEFT 101 -#define AP_DISCONNECT_FROM_HOST 102 -#define AP_DISCONNECT_COMM_TIMEOUT 103 -#define AP_DISCONNECT_MAX_STA 104 -#define AP_DISCONNECT_ACL 105 - -/* - * Used with WMI_AP_HIDDEN_SSID_CMDID - */ -#define HIDDEN_SSID_FALSE 0 -#define HIDDEN_SSID_TRUE 1 -typedef PREPACK struct { - A_UINT8 hidden_ssid; -} POSTPACK WMI_AP_HIDDEN_SSID_CMD; - -/* - * Used with WMI_AP_ACL_POLICY_CMDID - */ -#define AP_ACL_DISABLE 0x00 -#define AP_ACL_ALLOW_MAC 0x01 -#define AP_ACL_DENY_MAC 0x02 -#define AP_ACL_RETAIN_LIST_MASK 0x80 -typedef PREPACK struct { - A_UINT8 policy; -} POSTPACK WMI_AP_ACL_POLICY_CMD; - -/* - * Used with WMI_AP_ACL_MAC_LIST_CMDID - */ -#define ADD_MAC_ADDR 1 -#define DEL_MAC_ADDR 2 -typedef PREPACK struct { - A_UINT8 action; - A_UINT8 index; - A_UINT8 mac[ATH_MAC_LEN]; - A_UINT8 wildcard; -} POSTPACK WMI_AP_ACL_MAC_CMD; - -typedef PREPACK struct { - A_UINT16 index; - A_UINT8 acl_mac[AP_ACL_SIZE][ATH_MAC_LEN]; - A_UINT8 wildcard[AP_ACL_SIZE]; - A_UINT8 policy; -} POSTPACK WMI_AP_ACL; - -/* - * Used with WMI_AP_SET_NUM_STA_CMDID - */ -typedef PREPACK struct { - A_UINT8 num_sta; -} POSTPACK WMI_AP_NUM_STA_CMD; - -/* - * Used with WMI_AP_SET_MLME_CMDID - */ -typedef PREPACK struct { - A_UINT8 mac[ATH_MAC_LEN]; - A_UINT16 reason; /* 802.11 reason code */ - A_UINT8 cmd; /* operation to perform */ -/* MLME Commands */ -#define WMI_AP_MLME_ASSOC 1 /* associate station */ -#define WMI_AP_DISASSOC 2 /* disassociate station */ -#define WMI_AP_DEAUTH 3 /* deauthenticate station */ -#define WMI_AP_MLME_AUTHORIZE 4 /* authorize station */ -#define WMI_AP_MLME_UNAUTHORIZE 5 /* unauthorize station */ -} POSTPACK WMI_AP_SET_MLME_CMD; - -typedef PREPACK struct { - A_UINT32 period; -} POSTPACK WMI_AP_CONN_INACT_CMD; - -typedef PREPACK struct { - A_UINT32 period_min; - A_UINT32 dwell_ms; -} POSTPACK WMI_AP_PROT_SCAN_TIME_CMD; - -typedef PREPACK struct { - A_BOOL flag; - A_UINT16 rsvd; - A_UINT16 aid; -} POSTPACK WMI_AP_SET_PVB_CMD; - -#define WMI_DISABLE_REGULATORY_CODE "FF" - -typedef PREPACK struct { - A_UCHAR countryCode[3]; -} POSTPACK WMI_AP_SET_COUNTRY_CMD; - -typedef PREPACK struct { - A_UINT8 dtim; -} POSTPACK WMI_AP_SET_DTIM_CMD; - -typedef PREPACK struct { - A_UINT8 band; /* specifies which band to apply these values */ - A_UINT8 enable; /* allows 11n to be disabled on a per band basis */ - A_UINT8 chan_width_40M_supported; - A_UINT8 short_GI_20MHz; - A_UINT8 short_GI_40MHz; - A_UINT8 intolerance_40MHz; - A_UINT8 max_ampdu_len_exp; -} POSTPACK WMI_SET_HT_CAP_CMD; - -typedef PREPACK struct { - A_UINT8 sta_chan_width; -} POSTPACK WMI_SET_HT_OP_CMD; - -typedef PREPACK struct { - A_UINT32 rateMasks[WMI_MODE_MAX*WMI_MAX_RATE_MASK]; -} POSTPACK WMI_SET_TX_SELECT_RATES_CMD; - -typedef PREPACK struct { - A_UINT32 sgiMask[WMI_MAX_RATE_MASK]; - A_UINT8 sgiPERThreshold; -} POSTPACK WMI_SET_TX_SGI_PARAM_CMD; - -#define DEFAULT_SGI_MASK_L32 0x08080000 -#define DEFAULT_SGI_MASK_U32 0x00000000 -#define DEFAULT_SGI_PER 10 - -typedef PREPACK struct { - A_UINT32 rateField[WMI_MAX_RATE_MASK]; /* 1 bit per rate corresponding to index */ -#define WMI_RATE_POLICY_ID_MAX 5 - A_UINT8 id; /* valid values == 1->WMI_RATE_POLICY_ID_MAX */ - A_UINT8 shortTrys; - A_UINT8 longTrys; - A_UINT8 reserved; /* padding */ -} POSTPACK WMI_SET_RATE_POLICY_CMD; - -typedef PREPACK struct { - A_UINT8 metaVersion; /* version of meta data for rx packets <0 = default> (0-7 = valid) */ - A_UINT8 dot11Hdr; /* 1 == leave .11 header intact , 0 == replace .11 header with .3 */ - A_UINT8 defragOnHost; /* 1 == defragmentation is performed by host, 0 == performed by target */ - A_UINT8 reserved[1]; /* alignment */ -} POSTPACK WMI_RX_FRAME_FORMAT_CMD; - - -typedef PREPACK struct { - A_UINT8 enable; /* 1 == device operates in thin mode , 0 == normal mode */ - A_UINT8 reserved[3]; -} POSTPACK WMI_SET_THIN_MODE_CMD; - - -typedef PREPACK struct { - A_UINT16 channel; /* frequency in Mhz */ - //A_UINT8 mode; // HT20 or HT40 - //A_UINT8 secondary; // if mode == HT40 secondary channel above | below -} POSTPACK WMI_SET_CHANNEL_CMD; - - -typedef enum { - WMI_SET_CHANNEL_RES_SUCCESS = 0, // device has joined the network - WMI_SET_CHANNEL_RES_FAIL, // device failed for unspecified reason -}WMI_SET_CHANNEL_RESULT; - -typedef PREPACK struct { - A_UINT8 result; /* the result of the join cmd. one of WMI_THIN_JOIN_RESULT */ - A_UINT8 reserved[3]; /* alignment */ -} POSTPACK WMI_SET_CHANNEL_EVENT; - -typedef enum { - WMI_FILTERMASK_MGMT=0, - WMI_FILTERMASK_CTRL, - WMI_FILTERMASK_DATA, - WMI_FILTERMASK_MAX -}WMI_FILTERMASK_INDEX; - -typedef PREPACK struct { - A_UINT16 filtermask[WMI_FILTERMASK_MAX]; - A_UINT16 reserved; /* alignment */ -} POSTPACK WMI_RX_FRAME_FILTER_CMD; - -/* AP mode events */ -/* WMI_PS_POLL_EVENT */ -typedef PREPACK struct { - A_UINT16 aid; -} POSTPACK WMI_PSPOLL_EVENT; - -typedef PREPACK struct { - A_UINT32 tx_bytes; - A_UINT32 tx_pkts; - A_UINT32 tx_error; - A_UINT32 tx_discard; - A_UINT32 rx_bytes; - A_UINT32 rx_pkts; - A_UINT32 rx_error; - A_UINT32 rx_discard; - A_UINT32 aid; -} POSTPACK WMI_PER_STA_STAT; - -#define AP_GET_STATS 0 -#define AP_CLEAR_STATS 1 - -typedef PREPACK struct { - A_UINT32 action; - WMI_PER_STA_STAT sta[AP_MAX_NUM_STA]; -} POSTPACK WMI_AP_MODE_STAT; - -#define AP_11BG_RATESET1 1 -#define AP_11BG_RATESET2 2 -#define DEF_AP_11BG_RATESET AP_11BG_RATESET1 -typedef PREPACK struct { - A_UINT8 rateset; -} POSTPACK WMI_AP_SET_11BG_RATESET_CMD; -/* - * End of AP mode definitions - */ - -struct _wmm_params { - A_UINT8 acm; /* ACM parameter */ - A_UINT8 aifsn; /* AIFSN parameters */ - A_UINT8 logcwmin; /* cwmin in exponential form */ - A_UINT8 logcwmax; /* cwmax in exponential form */ - A_UINT16 txopLimit; /* txopLimit */ -}; - -/* WMI_REPORT_WMM_PARAMS_EVENT */ -typedef PREPACK struct { - struct _wmm_params wmm_params[4]; -} POSTPACK WMI_REPORT_WMM_PARAMS_EVENT; - -/* P2P module definitions */ - -/* P2P module commands */ -typedef PREPACK struct { - A_UINT8 go_intent; - A_UINT8 country[3]; - A_UINT8 reg_class; - A_UINT8 listen_channel; - A_UINT8 op_reg_class; - A_UINT8 op_channel; - A_UINT16 config_methods; -} POSTPACK WMI_P2P_SET_CONFIG_CMD; - -typedef PREPACK struct { - A_UINT16 categ; - A_UINT16 sub_categ; -} POSTPACK device_type_tuple; - -typedef PREPACK struct { - device_type_tuple pri_dev_type; - //A_UINT8 pri_device_type[8]; -#define MAX_P2P_SEC_DEVICE_TYPES 5 - device_type_tuple sec_dev_type[MAX_P2P_SEC_DEVICE_TYPES]; -#define WPS_UUID_LEN 16 - A_UINT8 uuid[WPS_UUID_LEN]; -#define WPS_MAX_DEVNAME_LEN 32 - A_UINT8 device_name[WPS_MAX_DEVNAME_LEN]; - A_UINT8 dev_name_len; -} POSTPACK WMI_WPS_SET_CONFIG_CMD; - -typedef PREPACK struct { - device_type_tuple pri_dev_type; - device_type_tuple sec_dev_type[MAX_P2P_SEC_DEVICE_TYPES]; - A_UINT8 device_addr[ATH_MAC_LEN]; -} POSTPACK WMI_SET_REQ_DEV_ATTR_CMD; - -typedef PREPACK struct { - A_UINT8 ssidLength; - A_UINT8 ssid[WMI_MAX_SSID_LEN]; -} POSTPACK P2P_SSID; - -typedef enum wmi_p2p_discovery_type { - WMI_P2P_FIND_START_WITH_FULL, - WMI_P2P_FIND_ONLY_SOCIAL, - WMI_P2P_FIND_PROGRESSIVE -} WMI_P2P_DISC_TYPE; - -typedef PREPACK struct { - A_UINT32 timeout; - WMI_P2P_DISC_TYPE type; -} POSTPACK WMI_P2P_FIND_CMD; - -typedef PREPACK struct { - A_UINT16 listen_freq; - A_UINT16 force_freq; - A_UINT16 go_oper_freq; - A_UINT8 dialog_token; - A_UINT8 peer_addr[ATH_MAC_LEN]; - A_UINT8 own_interface_addr[ATH_MAC_LEN]; - A_UINT8 member_in_go_dev[ATH_MAC_LEN]; - A_UINT8 go_dev_dialog_token; - P2P_SSID peer_go_ssid; - A_UINT8 wps_method; - A_UINT8 dev_capab; - A_INT8 go_intent; - A_UINT8 persistent_grp; -} POSTPACK WMI_P2P_GO_NEG_START_CMD; - -typedef PREPACK struct { - A_UINT8 persistent_group; - A_UINT8 group_formation; -} POSTPACK WMI_P2P_GRP_INIT_CMD; - -typedef PREPACK struct { - A_UINT8 peer_addr[ATH_MAC_LEN]; - A_UINT8 grp_formation_status; -} POSTPACK WMI_P2P_GRP_FORMATION_DONE_CMD; - -typedef PREPACK struct { - A_UINT32 timeout; -}POSTPACK WMI_P2P_LISTEN_CMD; - -typedef PREPACK struct { - A_UINT16 listen_freq; - A_UINT16 force_freq; - A_UINT8 status; - A_INT8 go_intent; - A_UINT8 wps_buf[512]; - A_UINT16 wps_buflen; - A_UINT8 p2p_buf[512]; - A_UINT16 p2p_buflen; - A_UINT8 dialog_token; - A_UINT8 wps_method; - A_UINT8 persistent_grp; -}POSTPACK WMI_P2P_GO_NEG_REQ_RSP_CMD; - -typedef enum { - WMI_P2P_INVITE_ROLE_GO, - WMI_P2P_INVITE_ROLE_ACTIVE_GO, - WMI_P2P_INVITE_ROLE_CLIENT, -} WMI_P2P_INVITE_ROLE; - -typedef PREPACK struct { - WMI_P2P_INVITE_ROLE role; - A_UINT16 listen_freq; - A_UINT16 force_freq; - A_UINT8 dialog_token; - A_UINT8 peer_addr[ATH_MAC_LEN]; - A_UINT8 bssid[ATH_MAC_LEN]; - A_UINT8 go_dev_addr[ATH_MAC_LEN]; - P2P_SSID ssid; - A_UINT8 is_persistent; - A_UINT8 wps_method; -}POSTPACK WMI_P2P_INVITE_CMD; - -typedef PREPACK struct { - A_UINT16 force_freq; - A_UINT8 status; - A_UINT8 dialog_token; - A_UINT8 p2p_buf[512]; - A_UINT16 p2p_buflen; - A_UINT8 is_go; - A_UINT8 group_bssid[ATH_MAC_LEN]; -}POSTPACK WMI_P2P_INVITE_REQ_RSP_CMD; - -typedef PREPACK struct { - A_UINT16 wps_method; - A_UINT16 listen_freq; - A_UINT8 dialog_token; - A_UINT8 peer[ATH_MAC_LEN]; - A_UINT8 go_dev_addr[ATH_MAC_LEN]; - P2P_SSID go_oper_ssid; -}POSTPACK WMI_P2P_PROV_DISC_REQ_CMD; - -typedef enum { - WMI_P2P_CONFID_LISTEN_CHANNEL=1, - WMI_P2P_CONFID_CROSS_CONNECT=2, - WMI_P2P_CONFID_SSID_POSTFIX=3, - WMI_P2P_CONFID_INTRA_BSS=4, - -} WMI_P2P_CONF_ID; - -typedef PREPACK struct { - A_UINT8 reg_class; - A_UINT8 listen_channel; -}POSTPACK WMI_P2P_LISTEN_CHANNEL; - -typedef PREPACK struct { - A_UINT8 flag; -}POSTPACK WMI_P2P_SET_CROSS_CONNECT; - -typedef PREPACK struct { - A_UINT8 ssid_postfix[WMI_MAX_SSID_LEN-9]; - A_UINT8 ssid_postfix_len; -}POSTPACK WMI_P2P_SET_SSID_POSTFIX; - -typedef PREPACK struct { - A_UINT8 flag; -}POSTPACK WMI_P2P_SET_INTRA_BSS; - -typedef PREPACK struct { - A_UINT8 config_id; /* set to one of WMI_P2P_CONF_ID */ - PREPACK union { - WMI_P2P_LISTEN_CHANNEL listen_ch; - WMI_P2P_SET_CROSS_CONNECT cross_conn; - WMI_P2P_SET_SSID_POSTFIX ssid_postfix; - WMI_P2P_SET_INTRA_BSS intra_bss; - }POSTPACK val; -}POSTPACK WMI_P2P_SET_CMD; - -#define WMI_P2P_MAX_TLV_LEN 1024 -typedef enum { - WMI_P2P_SD_TYPE_GAS_INITIAL_REQ = 0x1, - WMI_P2P_SD_TYPE_GAS_INITIAL_RESP = 0x2, - WMI_P2P_SD_TYPE_GAS_COMEBACK_REQ = 0x3, - WMI_P2P_SD_TYPE_GAS_COMEBACK_RESP = 0x4, - WMI_P2P_PD_TYPE_RESP = 0x5, - WMI_P2P_SD_TYPE_STATUS_IND = 0x6, -} WMI_P2P_SDPD_TYPE; - -typedef enum { - WMI_P2P_SDPD_TRANSACTION_PENDING = 0x1, - WMI_P2P_SDPD_TRANSACTION_COMP = 0x2, -} WMI_P2P_SDPD_TRANSACTION_STATUS; - -typedef PREPACK struct { - A_UINT8 type; - A_UINT8 dialog_token; - A_UINT8 frag_id; - A_UINT8 reserved1; /* alignment */ - A_UINT8 peer_addr[ATH_MAC_LEN]; - A_UINT16 freq; - A_UINT16 status_code; - A_UINT16 comeback_delay; - A_UINT16 tlv_length; - A_UINT16 update_indic; - A_UINT16 total_length; - A_UINT16 reserved2; /* future */ - A_UINT8 tlv[WMI_P2P_MAX_TLV_LEN]; -} POSTPACK WMI_P2P_SDPD_TX_CMD; - -/* P2P module events */ - -typedef PREPACK struct { - A_UINT8 sa[ATH_MAC_LEN]; - A_UINT8 wps_buf[512]; - A_UINT16 wps_buflen; - A_UINT8 p2p_buf[512]; - A_UINT16 p2p_buflen; - A_UINT8 dialog_token; -}POSTPACK WMI_P2P_GO_NEG_REQ_EVENT; - -typedef PREPACK struct { - A_UINT16 freq; - A_INT8 status; - A_UINT8 role_go; - A_UINT8 ssid[WMI_MAX_SSID_LEN]; - A_UINT8 ssid_len; -#define WMI_MAX_PASSPHRASE_LEN 9 - A_CHAR pass_phrase[WMI_MAX_PASSPHRASE_LEN]; - A_UINT8 peer_device_addr[ATH_MAC_LEN]; - A_UINT8 peer_interface_addr[ATH_MAC_LEN]; - A_UINT8 wps_method; - A_UINT8 persistent_grp; -} POSTPACK WMI_P2P_GO_NEG_RESULT_EVENT; - -typedef PREPACK struct { - A_UINT8 p2p_buf[512]; - A_UINT16 p2p_buflen; - A_UINT8 sa[ATH_MAC_LEN]; - A_UINT8 bssid[ATH_MAC_LEN]; - A_UINT8 go_dev_addr[ATH_MAC_LEN]; - P2P_SSID ssid; - A_UINT8 is_persistent; - A_UINT8 dialog_token; -} POSTPACK WMI_P2P_INVITE_REQ_EVENT; - -typedef PREPACK struct { - A_UINT16 oper_freq; - A_UINT8 sa[ATH_MAC_LEN]; - A_UINT8 bssid[ATH_MAC_LEN]; - A_UINT8 is_bssid_valid; - A_UINT8 go_dev_addr[ATH_MAC_LEN]; - P2P_SSID ssid; - A_UINT8 status; -} POSTPACK WMI_P2P_INVITE_RCVD_RESULT_EVENT; - -typedef PREPACK struct { - A_UINT8 status; - A_UINT8 bssid[ATH_MAC_LEN]; - A_UINT8 is_bssid_valid; -} POSTPACK WMI_P2P_INVITE_SENT_RESULT_EVENT; - -typedef PREPACK struct { - A_UINT8 sa[ATH_MAC_LEN]; - A_UINT16 wps_config_method; - A_UINT8 dev_addr[ATH_MAC_LEN]; -#define WPS_DEV_TYPE_LEN 8 - A_UINT8 pri_dev_type[WPS_DEV_TYPE_LEN]; - A_UINT8 device_name[WPS_MAX_DEVNAME_LEN]; - A_UINT8 dev_name_len; - A_UINT16 dev_config_methods; - A_UINT8 device_capab; - A_UINT8 group_capab; -} POSTPACK WMI_P2P_PROV_DISC_REQ_EVENT; - -typedef PREPACK struct { - A_UINT8 peer[ATH_MAC_LEN]; - A_UINT16 config_methods; -} POSTPACK WMI_P2P_PROV_DISC_RESP_EVENT; - -typedef PREPACK struct { - A_UINT8 type; - A_UINT8 transaction_status; - A_UINT8 dialog_token; - A_UINT8 frag_id; - A_UINT8 peer_addr[ATH_MAC_LEN]; - A_UINT16 freq; - A_UINT16 status_code; - A_UINT16 comeback_delay; - A_UINT16 tlv_length; - A_UINT16 update_indic; -// Variable length TLV will be placed after the event -} POSTPACK WMI_P2P_SDPD_RX_EVENT; - -typedef PREPACK struct { - A_UINT8 event_id; /* event identifier */ - A_UINT8 length; /* number of bytes of data that follows */ - A_UINT8 data[1]; /* start of event data */ -} POSTPACK WMI_ACS_EVENT_MSG; - -#define WMI_ACS_EVENT_HDR_LEN (sizeof(WMI_ACS_EVENT_MSG) - sizeof(A_UINT8)) - -typedef PREPACK struct { - A_UINT8 ctrl_id; /* control identifier */ - A_UINT8 length; /* number of bytes of data to follow */ - A_UINT8 data[1]; /* start of control data */ -} POSTPACK WMI_ACS_CTRL_MSG; - -#define WMI_ACS_CTRL_HDR_LEN (sizeof(WMI_ACS_CTRL_MSG) - sizeof(A_UINT8)) - -/* STORE / RECALL Commands AND Events DEFINITION START */ -typedef PREPACK struct { - A_UINT8 enable; -#define STRRCL_RECIPIENT_HOST 1 - A_UINT8 recipient; -} POSTPACK WMI_STORERECALL_CONFIGURE_CMD; - -typedef PREPACK struct { - A_UINT32 length; /* number of bytes of data to follow */ - A_UINT8 data[1]; /* start of data */ -} POSTPACK WMI_STORERECALL_RECALL_CMD; - -typedef PREPACK struct { - A_UINT32 sleep_msec; - A_UINT8 store_after_tx_empty; - A_UINT8 store_after_fresh_beacon_rx; -} POSTPACK WMI_STORERECALL_HOST_READY_CMD; - -typedef PREPACK struct { - A_UINT32 msec_sleep; /* time between power off/on */ - A_UINT32 length; /* length of following data */ - A_UINT8 data[1]; /* start of data */ -} POSTPACK WMI_STORERECALL_STORE_EVENT; - -/* STORE / RECALL Commands AND Events DEFINITION END */ - -typedef enum { - WMI_AP_APSD_DISABLED = 0, - WMI_AP_APSD_ENABLED -} WMI_AP_APSD_STATUS; - -typedef PREPACK struct { - A_UINT8 enable; -} POSTPACK WMI_AP_SET_APSD_CMD; - -typedef enum { - WMI_AP_APSD_NO_DELIVERY_FRAMES_FOR_THIS_TRIGGER = 0x1, -} WMI_AP_APSD_BUFFERED_TRAFFIC_FLAGS; - -typedef PREPACK struct { - A_UINT16 aid; - A_UINT16 bitmap; - A_UINT32 flags; -} POSTPACK WMI_AP_APSD_BUFFERED_TRAFFIC_CMD; - -/* - * These constants are used with A_WLAN_BAND_SET. - */ -#define A_BAND_24GHZ 0 -#define A_BAND_5GHZ 1 -#define A_NUM_BANDS 2 - -#ifndef ATH_TARGET -#include "athendpack.h" -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _WMI_H_ */ diff --git a/drivers/net/wireless/ar6003/include/wmi_thin.h b/drivers/net/wireless/ar6003/include/wmi_thin.h deleted file mode 100644 index 3d48b061a5ab..000000000000 --- a/drivers/net/wireless/ar6003/include/wmi_thin.h +++ /dev/null @@ -1,371 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -/* - * This file contains the definitions of the WMI protocol specified in the - * Wireless Module Interface (WMI). It includes definitions of all the - * commands and events. Commands are messages from the host to the WM. - * Events and Replies are messages from the WM to the host. - * - * Ownership of correctness in regards to WMI commands - * belongs to the host driver and the WM is not required to validate - * parameters for value, proper range, or any other checking. - * - */ - -#ifndef _WMI_THIN_H_ -#define _WMI_THIN_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef enum { - WMI_THIN_CONFIG_CMDID = 0x8000, // WMI_THIN_RESERVED_START - WMI_THIN_SET_MIB_CMDID, - WMI_THIN_GET_MIB_CMDID, - WMI_THIN_JOIN_CMDID, - WMI_THIN_CONNECT_CMDID, - WMI_THIN_RESET_CMDID, - /* add new CMDID's here */ - WMI_THIN_RESERVED_END_CMDID = 0x8fff // WMI_THIN_RESERVED_END -} WMI_THIN_COMMAND_ID; - -typedef enum{ - TEMPLATE_FRM_FIRST = 0, - TEMPLATE_FRM_PROBE_REQ =TEMPLATE_FRM_FIRST, - TEMPLATE_FRM_BEACON, - TEMPLATE_FRM_PROBE_RESP, - TEMPLATE_FRM_NULL, - TEMPLATE_FRM_QOS_NULL, - TEMPLATE_FRM_PSPOLL, - TEMPLATE_FRM_MAX -}WMI_TEMPLATE_FRM_TYPE; - -/* TEMPLATE_FRM_LEN... represent the maximum allowable - * data lengths (bytes) for each frame type */ -#define TEMPLATE_FRM_LEN_PROBE_REQ (256) /* Symbian dictates a minimum of 256 for these 3 frame types */ -#define TEMPLATE_FRM_LEN_BEACON (256) -#define TEMPLATE_FRM_LEN_PROBE_RESP (256) -#define TEMPLATE_FRM_LEN_NULL (32) -#define TEMPLATE_FRM_LEN_QOS_NULL (32) -#define TEMPLATE_FRM_LEN_PSPOLL (32) -#define TEMPLATE_FRM_LEN_SUM (TEMPLATE_FRM_LEN_PROBE_REQ + TEMPLATE_FRM_LEN_BEACON + TEMPLATE_FRM_LEN_PROBE_RESP + \ - TEMPLATE_FRM_LEN_NULL + TEMPLATE_FRM_LEN_QOS_NULL + TEMPLATE_FRM_LEN_PSPOLL) - - -/* MAC Header Build Rules */ -/* These values allow the host to configure the - * target code that is responsible for constructing - * the MAC header. In cases where the MAC header - * is provided by the host framework, the target - * has a diminished responsibility over what fields - * it must write. This will vary from framework to framework. - * Symbian requires different behavior from MAC80211 which - * requires different behavior from MS Native Wifi. */ -#define WMI_WRT_VER_TYPE 0x00000001 -#define WMI_WRT_DURATION 0x00000002 -#define WMI_WRT_DIRECTION 0x00000004 -#define WMI_WRT_POWER 0x00000008 -#define WMI_WRT_WEP 0x00000010 -#define WMI_WRT_MORE 0x00000020 -#define WMI_WRT_BSSID 0x00000040 -#define WMI_WRT_QOS 0x00000080 -#define WMI_WRT_SEQNO 0x00000100 -#define WMI_GUARD_TX 0x00000200 /* prevents TX ops that are not allowed for a current state */ -#define WMI_WRT_DEFAULT_CONFIG (WMI_WRT_VER_TYPE | WMI_WRT_DURATION | WMI_WRT_DIRECTION | \ - WMI_WRT_POWER | WMI_WRT_MORE | WMI_WRT_WEP | WMI_WRT_BSSID | \ - WMI_WRT_QOS | WMI_WRT_SEQNO | WMI_GUARD_TX) - -/* WMI_THIN_CONFIG_TXCOMPLETE -- Used to configure the params and content for - * TX Complete messages the will come from the Target. these messages are - * disabled by default but can be enabled using this structure and the - * WMI_THIN_CONFIG_CMDID. */ -typedef PREPACK struct { - A_UINT8 version; /* the versioned type of messages to use or 0 to disable */ - A_UINT8 countThreshold; /* msg count threshold triggering a tx complete message */ - A_UINT16 timeThreshold; /* timeout interval in MSEC triggering a tx complete message */ -} POSTPACK WMI_THIN_CONFIG_TXCOMPLETE; - -/* WMI_THIN_CONFIG_DECRYPT_ERR -- Used to configure behavior for received frames - * that have decryption errors. The default behavior is to discard the frame - * without notification. Alternately, the MAC Header is forwarded to the host - * with the failed status. */ -typedef PREPACK struct { - A_UINT8 enable; /* 1 == send decrypt errors to the host, 0 == don't */ - A_UINT8 reserved[3]; /* align padding */ -} POSTPACK WMI_THIN_CONFIG_DECRYPT_ERR; - -/* WMI_THIN_CONFIG_TX_MAC_RULES -- Used to configure behavior for transmitted - * frames that require partial MAC header construction. These rules - * are used by the target to indicate which fields need to be written. */ -typedef PREPACK struct { - A_UINT32 rules; /* combination of WMI_WRT_... values */ -} POSTPACK WMI_THIN_CONFIG_TX_MAC_RULES; - -/* WMI_THIN_CONFIG_RX_FILTER_RULES -- Used to configure behavior for received - * frames as to which frames should get forwarded to the host and which - * should get processed internally. */ -typedef PREPACK struct { - A_UINT32 rules; /* combination of WMI_FILT_... values */ -} POSTPACK WMI_THIN_CONFIG_RX_FILTER_RULES; - - -/* WMI_THIN_CONFIG_CIPHER_ENCAP -- Used to configure behavior for both - * TX and RX frames regarding security cipher encapsulation. The host may specify - * whether or not the firmware is responsible for cipher - * encapsulation. If the firmware is responsible it will add the security header - * and trailer for TX frames and remove the header and trailer for Rx frames. Also, - * the firmware will examine the resource counter if any and behave appropriately when - * a bad value is detected. If the host indicates responsibility for encapsulation - * then it is responsible for all aspects of encapsulation, however the device will - * still perform the encryption and decryption of the frame payload if a key has - * been provided. */ -typedef PREPACK struct { - A_UINT8 enable; /* enables/disables firmware cipher encapsulation */ - A_UINT8 reserved[3]; /* align padding */ -} POSTPACK WMI_THIN_CONFIG_CIPHER_ENCAP; - -/* WMI_THIN_CONFIG_CMD -- Used to contain some combination of the above - * WMI_THIN_CONFIG_... structures. The actual combination is indicated - * by the value of cfgField. Each bit in this field corresponds to - * one of the above structures. */ -typedef PREPACK struct { -#define WMI_THIN_CFG_TXCOMP 0x00000001 -#define WMI_THIN_CFG_DECRYPT 0x00000002 -#define WMI_THIN_UNUSED1 0x00000004 /* used to be WMI_THIN_CFG_MAC_RULES */ -#define WMI_THIN_CFG_FILTER_RULES 0x00000008 -#define WMI_THIN_CFG_CIPHER_ENCAP 0x00000010 - A_UINT32 cfgField; /* combination of WMI_THIN_CFG_... describes contents of config command */ - A_UINT16 length; /* length in bytes of appended sub-commands */ - A_UINT8 reserved[2]; /* align padding */ -} POSTPACK WMI_THIN_CONFIG_CMD; - -/* MIB Access Identifiers tailored for Symbian. */ -enum { - MIB_ID_STA_MAC = 1, // [READONLY] - MIB_ID_RX_LIFE_TIME, // [NOT IMPLEMENTED] - MIB_ID_SLOT_TIME, // [READ/WRITE] - MIB_ID_RTS_THRESHOLD, // [READ/WRITE] - MIB_ID_CTS_TO_SELF, // [READ/WRITE] - MIB_ID_TEMPLATE_FRAME, // [WRITE ONLY] - MIB_ID_RXFRAME_FILTER, // [READ/WRITE] - MIB_ID_BEACON_FILTER_TABLE, // [WRITE ONLY] - MIB_ID_BEACON_FILTER, // [READ/WRITE] - MIB_ID_BEACON_LOST_COUNT, // [WRITE ONLY] - MIB_ID_RSSI_THRESHOLD, // [WRITE ONLY] - MIB_ID_HT_CAP, // [NOT IMPLEMENTED] - MIB_ID_HT_OP, // [NOT IMPLEMENTED] - MIB_ID_HT_2ND_BEACON, // [NOT IMPLEMENTED] - MIB_ID_HT_BLOCK_ACK, // [NOT IMPLEMENTED] - MIB_ID_PREAMBLE, // [READ/WRITE] - /*MIB_ID_GROUP_ADDR_TABLE,*/ - /*MIB_ID_WEP_DEFAULT_KEY_ID */ // satisfied by wmi_addKey_cmd() - /*MIB_ID_TX_POWER */ - /*MIB_ID_ARP_IP_TABLE */ - /*MIB_ID_SLEEP_MODE */ - /*MIB_ID_WAKE_INTERVAL*/ - /*MIB_ID_STAT_TABLE*/ - /*MIB_ID_IBSS_PWR_SAVE*/ - /*MIB_ID_COUNTERS_TABLE*/ - /*MIB_ID_ETHERTYPE_FILTER*/ - /*MIB_ID_BC_UDP_FILTER*/ - -}; - -typedef PREPACK struct { - A_UINT8 addr[ATH_MAC_LEN]; -} POSTPACK WMI_THIN_MIB_STA_MAC; - -typedef PREPACK struct { - A_UINT32 time; // units == msec -} POSTPACK WMI_THIN_MIB_RX_LIFE_TIME; - -typedef PREPACK struct { - A_UINT8 enable; //1 = on, 0 = off -} POSTPACK WMI_THIN_MIB_CTS_TO_SELF; - -typedef PREPACK struct { - A_UINT32 time; // units == usec -} POSTPACK WMI_THIN_MIB_SLOT_TIME; - -typedef PREPACK struct { - A_UINT16 length; //units == bytes -} POSTPACK WMI_THIN_MIB_RTS_THRESHOLD; - -typedef PREPACK struct { - A_UINT8 type; // type of frame - A_UINT8 rate; // tx rate to be used (one of WMI_BIT_RATE) - A_UINT16 length; // num bytes following this structure as the template data -} POSTPACK WMI_THIN_MIB_TEMPLATE_FRAME; - -typedef PREPACK struct { -#define FRAME_FILTER_PROMISCUOUS 0x00000001 -#define FRAME_FILTER_BSSID 0x00000002 - A_UINT32 filterMask; -} POSTPACK WMI_THIN_MIB_RXFRAME_FILTER; - - -#define IE_FILTER_TREATMENT_CHANGE 1 -#define IE_FILTER_TREATMENT_APPEAR 2 - -typedef PREPACK struct { - A_UINT8 ie; - A_UINT8 treatment; -} POSTPACK WMI_THIN_MIB_BEACON_FILTER_TABLE; - -typedef PREPACK struct { - A_UINT8 ie; - A_UINT8 treatment; - A_UINT8 oui[3]; - A_UINT8 type; - A_UINT16 version; -} POSTPACK WMI_THIN_MIB_BEACON_FILTER_TABLE_OUI; - -typedef PREPACK struct { - A_UINT16 numElements; - A_UINT8 entrySize; // sizeof(WMI_THIN_MIB_BEACON_FILTER_TABLE) on host cpu may be 2 may be 4 - A_UINT8 reserved; -} POSTPACK WMI_THIN_MIB_BEACON_FILTER_TABLE_HEADER; - -typedef PREPACK struct { - A_UINT32 count; /* num beacons between deliveries */ - A_UINT8 enable; - A_UINT8 reserved[3]; -} POSTPACK WMI_THIN_MIB_BEACON_FILTER; - -typedef PREPACK struct { - A_UINT32 count; /* num consec lost beacons after which send event */ -} POSTPACK WMI_THIN_MIB_BEACON_LOST_COUNT; - -typedef PREPACK struct { - A_UINT8 rssi; /* the low threshold which can trigger an event warning */ - A_UINT8 tolerance; /* the range above and below the threshold to prevent event flooding to the host. */ - A_UINT8 count; /* the sample count of consecutive frames necessary to trigger an event. */ - A_UINT8 reserved[1]; /* padding */ -} POSTPACK WMI_THIN_MIB_RSSI_THRESHOLD; - - -typedef PREPACK struct { - A_UINT32 cap; - A_UINT32 rxRateField; - A_UINT32 beamForming; - A_UINT8 addr[ATH_MAC_LEN]; - A_UINT8 enable; - A_UINT8 stbc; - A_UINT8 maxAMPDU; - A_UINT8 msduSpacing; - A_UINT8 mcsFeedback; - A_UINT8 antennaSelCap; -} POSTPACK WMI_THIN_MIB_HT_CAP; - -typedef PREPACK struct { - A_UINT32 infoField; - A_UINT32 basicRateField; - A_UINT8 protection; - A_UINT8 secondChanneloffset; - A_UINT8 channelWidth; - A_UINT8 reserved; -} POSTPACK WMI_THIN_MIB_HT_OP; - -typedef PREPACK struct { -#define SECOND_BEACON_PRIMARY 1 -#define SECOND_BEACON_EITHER 2 -#define SECOND_BEACON_SECONDARY 3 - A_UINT8 cfg; - A_UINT8 reserved[3]; /* padding */ -} POSTPACK WMI_THIN_MIB_HT_2ND_BEACON; - -typedef PREPACK struct { - A_UINT8 txTIDField; - A_UINT8 rxTIDField; - A_UINT8 reserved[2]; /* padding */ -} POSTPACK WMI_THIN_MIB_HT_BLOCK_ACK; - -typedef PREPACK struct { - A_UINT8 enableLong; // 1 == long preamble, 0 == short preamble - A_UINT8 reserved[3]; -} POSTPACK WMI_THIN_MIB_PREAMBLE; - -typedef PREPACK struct { - A_UINT16 length; /* the length in bytes of the appended MIB data */ - A_UINT8 mibID; /* the ID of the MIB element being set */ - A_UINT8 reserved; /* align padding */ -} POSTPACK WMI_THIN_SET_MIB_CMD; - -typedef PREPACK struct { - A_UINT8 mibID; /* the ID of the MIB element being set */ - A_UINT8 reserved[3]; /* align padding */ -} POSTPACK WMI_THIN_GET_MIB_CMD; - -typedef PREPACK struct { - A_UINT32 basicRateMask; /* bit mask of basic rates */ - A_UINT32 beaconIntval; /* TUs */ - A_UINT16 atimWindow; /* TUs */ - A_UINT16 channel; /* frequency in Mhz */ - A_UINT8 networkType; /* INFRA_NETWORK | ADHOC_NETWORK */ - A_UINT8 ssidLength; /* 0 - 32 */ - A_UINT8 probe; /* != 0 : issue probe req at start */ - A_UINT8 reserved; /* alignment */ - A_UCHAR ssid[WMI_MAX_SSID_LEN]; - A_UINT8 bssid[ATH_MAC_LEN]; -} POSTPACK WMI_THIN_JOIN_CMD; - -typedef PREPACK struct { - A_UINT16 dtim; /* dtim interval in num beacons */ - A_UINT16 aid; /* 80211 association ID from Assoc resp */ -} POSTPACK WMI_THIN_CONNECT_CMD; - -typedef PREPACK struct { - A_UINT8 reserved[4]; -} POSTPACK WMI_THIN_RESET_CMD; - -typedef enum { - WMI_THIN_EVENTID_RESERVED_START = 0x8000, - WMI_THIN_GET_MIB_EVENTID, - WMI_THIN_JOIN_EVENTID, - - /* Add new THIN EVENTID's here */ - WMI_THIN_EVENTID_RESERVED_END = 0x8fff -} WMI_THIN_EVENT_ID; - -/* Possible values for WMI_THIN_JOIN_EVENT.result */ -typedef enum { - WMI_THIN_JOIN_RES_SUCCESS = 0, // device has joined the network - WMI_THIN_JOIN_RES_FAIL, // device failed for unspecified reason - WMI_THIN_JOIN_RES_TIMEOUT, // device failed due to no beacon rx in time limit - WMI_THIN_JOIN_RES_BAD_PARAM, // device failed due to bad cmd param. - WMI_THIN_JOIN_RES_IBSS_START, // device started new IBSS network. -}WMI_THIN_JOIN_RESULT; - -typedef PREPACK struct { - A_UINT8 result; /* the result of the join cmd. one of WMI_THIN_JOIN_RESULT */ - A_UINT8 reserved[3]; /* alignment */ -} POSTPACK WMI_THIN_JOIN_EVENT; - -#ifdef __cplusplus -} -#endif - -#endif /* _WMI_THIN_H_ */ diff --git a/drivers/net/wireless/ar6003/include/wmix.h b/drivers/net/wireless/ar6003/include/wmix.h deleted file mode 100644 index cc58c5b1e861..000000000000 --- a/drivers/net/wireless/ar6003/include/wmix.h +++ /dev/null @@ -1,280 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Copyright (c) 2004-2010 Atheros Corporation. All rights reserved. -// -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// -// -//------------------------------------------------------------------------------ -//============================================================================== -// Author(s): ="Atheros" -//============================================================================== - -/* - * This file contains extensions of the WMI protocol specified in the - * Wireless Module Interface (WMI). It includes definitions of all - * extended commands and events. Extensions include useful commands - * that are not directly related to wireless activities. They may - * be hardware-specific, and they might not be supported on all - * implementations. - * - * Extended WMIX commands are encapsulated in a WMI message with - * cmd=WMI_EXTENSION_CMD. - */ - -#ifndef _WMIX_H_ -#define _WMIX_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef ATH_TARGET -#include "athstartpack.h" -#endif - -#include "dbglog.h" - -/* - * Extended WMI commands are those that are needed during wireless - * operation, but which are not really wireless commands. This allows, - * for instance, platform-specific commands. Extended WMI commands are - * embedded in a WMI command message with WMI_COMMAND_ID=WMI_EXTENSION_CMDID. - * Extended WMI events are similarly embedded in a WMI event message with - * WMI_EVENT_ID=WMI_EXTENSION_EVENTID. - */ -typedef PREPACK struct { - A_UINT32 commandId; -} POSTPACK WMIX_CMD_HDR; - -typedef enum { - WMIX_DSETOPEN_REPLY_CMDID = 0x2001, - WMIX_DSETDATA_REPLY_CMDID, - WMIX_GPIO_OUTPUT_SET_CMDID, - WMIX_GPIO_INPUT_GET_CMDID, - WMIX_GPIO_REGISTER_SET_CMDID, - WMIX_GPIO_REGISTER_GET_CMDID, - WMIX_GPIO_INTR_ACK_CMDID, - WMIX_HB_CHALLENGE_RESP_CMDID, - WMIX_DBGLOG_CFG_MODULE_CMDID, - WMIX_PROF_CFG_CMDID, /* 0x200a */ - WMIX_PROF_ADDR_SET_CMDID, - WMIX_PROF_START_CMDID, - WMIX_PROF_STOP_CMDID, - WMIX_PROF_COUNT_GET_CMDID, -} WMIX_COMMAND_ID; - -typedef enum { - WMIX_DSETOPENREQ_EVENTID = 0x3001, - WMIX_DSETCLOSE_EVENTID, - WMIX_DSETDATAREQ_EVENTID, - WMIX_GPIO_INTR_EVENTID, - WMIX_GPIO_DATA_EVENTID, - WMIX_GPIO_ACK_EVENTID, - WMIX_HB_CHALLENGE_RESP_EVENTID, - WMIX_DBGLOG_EVENTID, - WMIX_PROF_COUNT_EVENTID, -} WMIX_EVENT_ID; - -/* - * =============DataSet support================= - */ - -/* - * WMIX_DSETOPENREQ_EVENTID - * DataSet Open Request Event - */ -typedef PREPACK struct { - A_UINT32 dset_id; - A_UINT32 targ_dset_handle; /* echo'ed, not used by Host, */ - A_UINT32 targ_reply_fn; /* echo'ed, not used by Host, */ - A_UINT32 targ_reply_arg; /* echo'ed, not used by Host, */ -} POSTPACK WMIX_DSETOPENREQ_EVENT; - -/* - * WMIX_DSETCLOSE_EVENTID - * DataSet Close Event - */ -typedef PREPACK struct { - A_UINT32 access_cookie; -} POSTPACK WMIX_DSETCLOSE_EVENT; - -/* - * WMIX_DSETDATAREQ_EVENTID - * DataSet Data Request Event - */ -typedef PREPACK struct { - A_UINT32 access_cookie; - A_UINT32 offset; - A_UINT32 length; - A_UINT32 targ_buf; /* echo'ed, not used by Host, */ - A_UINT32 targ_reply_fn; /* echo'ed, not used by Host, */ - A_UINT32 targ_reply_arg; /* echo'ed, not used by Host, */ -} POSTPACK WMIX_DSETDATAREQ_EVENT; - -typedef PREPACK struct { - A_UINT32 status; - A_UINT32 targ_dset_handle; - A_UINT32 targ_reply_fn; - A_UINT32 targ_reply_arg; - A_UINT32 access_cookie; - A_UINT32 size; - A_UINT32 version; -} POSTPACK WMIX_DSETOPEN_REPLY_CMD; - -typedef PREPACK struct { - A_UINT32 status; - A_UINT32 targ_buf; - A_UINT32 targ_reply_fn; - A_UINT32 targ_reply_arg; - A_UINT32 length; - A_UINT8 buf[1]; -} POSTPACK WMIX_DSETDATA_REPLY_CMD; - - -/* - * =============GPIO support================= - * NB: Some of the WMIX APIs use a 32-bit mask. On Targets that support - * more than 32 GPIO pins, those APIs only support the first 32 GPIO pins. - */ - -#include "gpio.h" - -/* - * Set GPIO pin output state. - * In order for output to be driven, a pin must be enabled for output. - * This can be done during initialization through the GPIO Configuration - * DataSet, or during operation with the enable_mask. - * - * If a request is made to simultaneously set/clear or set/disable or - * clear/disable or disable/enable, results are undefined. - */ -typedef PREPACK struct { - A_UINT32 set_mask; /* pins to set */ - A_UINT32 clear_mask; /* pins to clear */ - A_UINT32 enable_mask; /* pins to enable for output */ - A_UINT32 disable_mask; /* pins to disable/tristate */ -} POSTPACK WMIX_GPIO_OUTPUT_SET_CMD; - -/* - * Set a GPIO register. For debug/exceptional cases. - * Values for gpioreg_id are GPIO_ID_*, defined in a - * platform-dependent header, gpio.h. - */ -typedef PREPACK struct { - A_UINT32 gpioreg_id; /* GPIO register ID */ - A_UINT32 value; /* value to write */ -} POSTPACK WMIX_GPIO_REGISTER_SET_CMD; - -/* Get a GPIO register. For debug/exceptional cases. */ -typedef PREPACK struct { - A_UINT32 gpioreg_id; /* GPIO register to read */ -} POSTPACK WMIX_GPIO_REGISTER_GET_CMD; - -/* - * Host acknowledges and re-arms GPIO interrupts. A single - * message should be used to acknowledge all interrupts that - * were delivered in an earlier WMIX_GPIO_INTR_EVENT message. - */ -typedef PREPACK struct { - A_UINT32 ack_mask; /* interrupts to acknowledge */ -} POSTPACK WMIX_GPIO_INTR_ACK_CMD; - -/* - * Target informs Host of GPIO interrupts that have ocurred since the - * last WMIX_GIPO_INTR_ACK_CMD was received. Additional information -- - * the current GPIO input values is provided -- in order to support - * use of a GPIO interrupt as a Data Valid signal for other GPIO pins. - */ -typedef PREPACK struct { - A_UINT32 intr_mask; /* pending GPIO interrupts */ - A_UINT32 input_values; /* recent GPIO input values */ -} POSTPACK WMIX_GPIO_INTR_EVENT; - -/* - * Target responds to Host's earlier WMIX_GPIO_INPUT_GET_CMDID request - * using a GPIO_DATA_EVENT with - * value set to the mask of GPIO pin inputs and - * reg_id set to GPIO_ID_NONE - * - * - * Target responds to Hosts's earlier WMIX_GPIO_REGISTER_GET_CMDID request - * using a GPIO_DATA_EVENT with - * value set to the value of the requested register and - * reg_id identifying the register (reflects the original request) - * NB: reg_id supports the future possibility of unsolicited - * WMIX_GPIO_DATA_EVENTs (for polling GPIO input), and it may - * simplify Host GPIO support. - */ -typedef PREPACK struct { - A_UINT32 value; - A_UINT32 reg_id; -} POSTPACK WMIX_GPIO_DATA_EVENT; - -/* - * =============Error Detection support================= - */ - -/* - * WMIX_HB_CHALLENGE_RESP_CMDID - * Heartbeat Challenge Response command - */ -typedef PREPACK struct { - A_UINT32 cookie; - A_UINT32 source; -} POSTPACK WMIX_HB_CHALLENGE_RESP_CMD; - -/* - * WMIX_HB_CHALLENGE_RESP_EVENTID - * Heartbeat Challenge Response Event - */ -#define WMIX_HB_CHALLENGE_RESP_EVENT WMIX_HB_CHALLENGE_RESP_CMD - -typedef PREPACK struct { - struct dbglog_config_s config; -} POSTPACK WMIX_DBGLOG_CFG_MODULE_CMD; - -/* - * =============Target Profiling support================= - */ - -typedef PREPACK struct { - A_UINT32 period; /* Time (in 30.5us ticks) between samples */ - A_UINT32 nbins; -} POSTPACK WMIX_PROF_CFG_CMD; - -typedef PREPACK struct { - A_UINT32 addr; -} POSTPACK WMIX_PROF_ADDR_SET_CMD; - -/* - * Target responds to Hosts's earlier WMIX_PROF_COUNT_GET_CMDID request - * using a WMIX_PROF_COUNT_EVENT with - * addr set to the next address - * count set to the corresponding count - */ -typedef PREPACK struct { - A_UINT32 addr; - A_UINT32 count; -} POSTPACK WMIX_PROF_COUNT_EVENT; - -#ifndef ATH_TARGET -#include "athendpack.h" -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _WMIX_H_ */ diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c deleted file mode 100644 index 34c8a33cac06..000000000000 --- a/drivers/net/wireless/at76c50x-usb.c +++ /dev/null @@ -1,2502 +0,0 @@ -/* - * at76c503/at76c505 USB driver - * - * Copyright (c) 2002 - 2003 Oliver Kurth - * Copyright (c) 2004 Joerg Albert - * Copyright (c) 2004 Nick Jones - * Copyright (c) 2004 Balint Seeber - * Copyright (c) 2007 Guido Guenther - * Copyright (c) 2007 Kalle Valo - * Copyright (c) 2010 Sebastian Smolorz - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This file is part of the Berlios driver for WLAN USB devices based on the - * Atmel AT76C503A/505/505A. - * - * Some iw_handler code was taken from airo.c, (C) 1999 Benjamin Reed - * - * TODO list is at the wiki: - * - * http://wireless.kernel.org/en/users/Drivers/at76c50x-usb#TODO - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "at76c50x-usb.h" - -/* Version information */ -#define DRIVER_NAME "at76c50x-usb" -#define DRIVER_VERSION "0.17" -#define DRIVER_DESC "Atmel at76x USB Wireless LAN Driver" - -/* at76_debug bits */ -#define DBG_PROGRESS 0x00000001 /* authentication/accociation */ -#define DBG_BSS_TABLE 0x00000002 /* show BSS table after scans */ -#define DBG_IOCTL 0x00000004 /* ioctl calls / settings */ -#define DBG_MAC_STATE 0x00000008 /* MAC state transitions */ -#define DBG_TX_DATA 0x00000010 /* tx header */ -#define DBG_TX_DATA_CONTENT 0x00000020 /* tx content */ -#define DBG_TX_MGMT 0x00000040 /* tx management */ -#define DBG_RX_DATA 0x00000080 /* rx data header */ -#define DBG_RX_DATA_CONTENT 0x00000100 /* rx data content */ -#define DBG_RX_MGMT 0x00000200 /* rx mgmt frame headers */ -#define DBG_RX_BEACON 0x00000400 /* rx beacon */ -#define DBG_RX_CTRL 0x00000800 /* rx control */ -#define DBG_RX_MGMT_CONTENT 0x00001000 /* rx mgmt content */ -#define DBG_RX_FRAGS 0x00002000 /* rx data fragment handling */ -#define DBG_DEVSTART 0x00004000 /* fw download, device start */ -#define DBG_URB 0x00008000 /* rx urb status, ... */ -#define DBG_RX_ATMEL_HDR 0x00010000 /* Atmel-specific Rx headers */ -#define DBG_PROC_ENTRY 0x00020000 /* procedure entries/exits */ -#define DBG_PM 0x00040000 /* power management settings */ -#define DBG_BSS_MATCH 0x00080000 /* BSS match failures */ -#define DBG_PARAMS 0x00100000 /* show configured parameters */ -#define DBG_WAIT_COMPLETE 0x00200000 /* command completion */ -#define DBG_RX_FRAGS_SKB 0x00400000 /* skb header of Rx fragments */ -#define DBG_BSS_TABLE_RM 0x00800000 /* purging bss table entries */ -#define DBG_MONITOR_MODE 0x01000000 /* monitor mode */ -#define DBG_MIB 0x02000000 /* dump all MIBs on startup */ -#define DBG_MGMT_TIMER 0x04000000 /* dump mgmt_timer ops */ -#define DBG_WE_EVENTS 0x08000000 /* dump wireless events */ -#define DBG_FW 0x10000000 /* firmware download */ -#define DBG_DFU 0x20000000 /* device firmware upgrade */ -#define DBG_CMD 0x40000000 -#define DBG_MAC80211 0x80000000 - -#define DBG_DEFAULTS 0 - -/* Use our own dbg macro */ -#define at76_dbg(bits, format, arg...) \ -do { \ - if (at76_debug & (bits)) \ - printk(KERN_DEBUG DRIVER_NAME ": " format "\n", ##arg); \ -} while (0) - -#define at76_dbg_dump(bits, buf, len, format, arg...) \ -do { \ - if (at76_debug & (bits)) { \ - printk(KERN_DEBUG DRIVER_NAME ": " format "\n", ##arg); \ - print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len); \ - } \ -} while (0) - -static uint at76_debug = DBG_DEFAULTS; - -/* Protect against concurrent firmware loading and parsing */ -static struct mutex fw_mutex; - -static struct fwentry firmwares[] = { - [0] = { "" }, - [BOARD_503_ISL3861] = { "atmel_at76c503-i3861.bin" }, - [BOARD_503_ISL3863] = { "atmel_at76c503-i3863.bin" }, - [BOARD_503] = { "atmel_at76c503-rfmd.bin" }, - [BOARD_503_ACC] = { "atmel_at76c503-rfmd-acc.bin" }, - [BOARD_505] = { "atmel_at76c505-rfmd.bin" }, - [BOARD_505_2958] = { "atmel_at76c505-rfmd2958.bin" }, - [BOARD_505A] = { "atmel_at76c505a-rfmd2958.bin" }, - [BOARD_505AMX] = { "atmel_at76c505amx-rfmd.bin" }, -}; -MODULE_FIRMWARE("atmel_at76c503-i3861.bin"); -MODULE_FIRMWARE("atmel_at76c503-i3863.bin"); -MODULE_FIRMWARE("atmel_at76c503-rfmd.bin"); -MODULE_FIRMWARE("atmel_at76c503-rfmd-acc.bin"); -MODULE_FIRMWARE("atmel_at76c505-rfmd.bin"); -MODULE_FIRMWARE("atmel_at76c505-rfmd2958.bin"); -MODULE_FIRMWARE("atmel_at76c505a-rfmd2958.bin"); -MODULE_FIRMWARE("atmel_at76c505amx-rfmd.bin"); - -#define USB_DEVICE_DATA(__ops) .driver_info = (kernel_ulong_t)(__ops) - -static struct usb_device_id dev_table[] = { - /* - * at76c503-i3861 - */ - /* Generic AT76C503/3861 device */ - { USB_DEVICE(0x03eb, 0x7603), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* Linksys WUSB11 v2.1/v2.6 */ - { USB_DEVICE(0x066b, 0x2211), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* Netgear MA101 rev. A */ - { USB_DEVICE(0x0864, 0x4100), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* Tekram U300C / Allnet ALL0193 */ - { USB_DEVICE(0x0b3b, 0x1612), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* HP HN210W J7801A */ - { USB_DEVICE(0x03f0, 0x011c), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* Sitecom/Z-Com/Zyxel M4Y-750 */ - { USB_DEVICE(0x0cde, 0x0001), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* Dynalink/Askey WLL013 (intersil) */ - { USB_DEVICE(0x069a, 0x0320), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* EZ connect 11Mpbs Wireless USB Adapter SMC2662W v1 */ - { USB_DEVICE(0x0d5c, 0xa001), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* BenQ AWL300 */ - { USB_DEVICE(0x04a5, 0x9000), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* Addtron AWU-120, Compex WLU11 */ - { USB_DEVICE(0x05dd, 0xff31), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* Intel AP310 AnyPoint II USB */ - { USB_DEVICE(0x8086, 0x0200), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* Dynalink L11U */ - { USB_DEVICE(0x0d8e, 0x7100), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* Arescom WL-210, FCC id 07J-GL2411USB */ - { USB_DEVICE(0x0d8e, 0x7110), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* I-O DATA WN-B11/USB */ - { USB_DEVICE(0x04bb, 0x0919), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* BT Voyager 1010 */ - { USB_DEVICE(0x069a, 0x0821), USB_DEVICE_DATA(BOARD_503_ISL3861) }, - /* - * at76c503-i3863 - */ - /* Generic AT76C503/3863 device */ - { USB_DEVICE(0x03eb, 0x7604), USB_DEVICE_DATA(BOARD_503_ISL3863) }, - /* Samsung SWL-2100U */ - { USB_DEVICE(0x055d, 0xa000), USB_DEVICE_DATA(BOARD_503_ISL3863) }, - /* - * at76c503-rfmd - */ - /* Generic AT76C503/RFMD device */ - { USB_DEVICE(0x03eb, 0x7605), USB_DEVICE_DATA(BOARD_503) }, - /* Dynalink/Askey WLL013 (rfmd) */ - { USB_DEVICE(0x069a, 0x0321), USB_DEVICE_DATA(BOARD_503) }, - /* Linksys WUSB11 v2.6 */ - { USB_DEVICE(0x077b, 0x2219), USB_DEVICE_DATA(BOARD_503) }, - /* Network Everywhere NWU11B */ - { USB_DEVICE(0x077b, 0x2227), USB_DEVICE_DATA(BOARD_503) }, - /* Netgear MA101 rev. B */ - { USB_DEVICE(0x0864, 0x4102), USB_DEVICE_DATA(BOARD_503) }, - /* D-Link DWL-120 rev. E */ - { USB_DEVICE(0x2001, 0x3200), USB_DEVICE_DATA(BOARD_503) }, - /* Actiontec 802UAT1, HWU01150-01UK */ - { USB_DEVICE(0x1668, 0x7605), USB_DEVICE_DATA(BOARD_503) }, - /* AirVast W-Buddie WN210 */ - { USB_DEVICE(0x03eb, 0x4102), USB_DEVICE_DATA(BOARD_503) }, - /* Dick Smith Electronics XH1153 802.11b USB adapter */ - { USB_DEVICE(0x1371, 0x5743), USB_DEVICE_DATA(BOARD_503) }, - /* CNet CNUSB611 */ - { USB_DEVICE(0x1371, 0x0001), USB_DEVICE_DATA(BOARD_503) }, - /* FiberLine FL-WL200U */ - { USB_DEVICE(0x1371, 0x0002), USB_DEVICE_DATA(BOARD_503) }, - /* BenQ AWL400 USB stick */ - { USB_DEVICE(0x04a5, 0x9001), USB_DEVICE_DATA(BOARD_503) }, - /* 3Com 3CRSHEW696 */ - { USB_DEVICE(0x0506, 0x0a01), USB_DEVICE_DATA(BOARD_503) }, - /* Siemens Santis ADSL WLAN USB adapter WLL 013 */ - { USB_DEVICE(0x0681, 0x001b), USB_DEVICE_DATA(BOARD_503) }, - /* Belkin F5D6050, version 2 */ - { USB_DEVICE(0x050d, 0x0050), USB_DEVICE_DATA(BOARD_503) }, - /* iBlitzz, BWU613 (not *B or *SB) */ - { USB_DEVICE(0x07b8, 0xb000), USB_DEVICE_DATA(BOARD_503) }, - /* Gigabyte GN-WLBM101 */ - { USB_DEVICE(0x1044, 0x8003), USB_DEVICE_DATA(BOARD_503) }, - /* Planex GW-US11S */ - { USB_DEVICE(0x2019, 0x3220), USB_DEVICE_DATA(BOARD_503) }, - /* Internal WLAN adapter in h5[4,5]xx series iPAQs */ - { USB_DEVICE(0x049f, 0x0032), USB_DEVICE_DATA(BOARD_503) }, - /* Corega Wireless LAN USB-11 mini */ - { USB_DEVICE(0x07aa, 0x0011), USB_DEVICE_DATA(BOARD_503) }, - /* Corega Wireless LAN USB-11 mini2 */ - { USB_DEVICE(0x07aa, 0x0018), USB_DEVICE_DATA(BOARD_503) }, - /* Uniden PCW100 */ - { USB_DEVICE(0x05dd, 0xff35), USB_DEVICE_DATA(BOARD_503) }, - /* - * at76c503-rfmd-acc - */ - /* SMC2664W */ - { USB_DEVICE(0x083a, 0x3501), USB_DEVICE_DATA(BOARD_503_ACC) }, - /* Belkin F5D6050, SMC2662W v2, SMC2662W-AR */ - { USB_DEVICE(0x0d5c, 0xa002), USB_DEVICE_DATA(BOARD_503_ACC) }, - /* - * at76c505-rfmd - */ - /* Generic AT76C505/RFMD */ - { USB_DEVICE(0x03eb, 0x7606), USB_DEVICE_DATA(BOARD_505) }, - /* - * at76c505-rfmd2958 - */ - /* Generic AT76C505/RFMD, OvisLink WL-1130USB */ - { USB_DEVICE(0x03eb, 0x7613), USB_DEVICE_DATA(BOARD_505_2958) }, - /* Fiberline FL-WL240U */ - { USB_DEVICE(0x1371, 0x0014), USB_DEVICE_DATA(BOARD_505_2958) }, - /* CNet CNUSB-611G */ - { USB_DEVICE(0x1371, 0x0013), USB_DEVICE_DATA(BOARD_505_2958) }, - /* Linksys WUSB11 v2.8 */ - { USB_DEVICE(0x1915, 0x2233), USB_DEVICE_DATA(BOARD_505_2958) }, - /* Xterasys XN-2122B, IBlitzz BWU613B/BWU613SB */ - { USB_DEVICE(0x12fd, 0x1001), USB_DEVICE_DATA(BOARD_505_2958) }, - /* Corega WLAN USB Stick 11 */ - { USB_DEVICE(0x07aa, 0x7613), USB_DEVICE_DATA(BOARD_505_2958) }, - /* Microstar MSI Box MS6978 */ - { USB_DEVICE(0x0db0, 0x1020), USB_DEVICE_DATA(BOARD_505_2958) }, - /* - * at76c505a-rfmd2958 - */ - /* Generic AT76C505A device */ - { USB_DEVICE(0x03eb, 0x7614), USB_DEVICE_DATA(BOARD_505A) }, - /* Generic AT76C505AS device */ - { USB_DEVICE(0x03eb, 0x7617), USB_DEVICE_DATA(BOARD_505A) }, - /* Siemens Gigaset USB WLAN Adapter 11 */ - { USB_DEVICE(0x1690, 0x0701), USB_DEVICE_DATA(BOARD_505A) }, - /* OQO Model 01+ Internal Wi-Fi */ - { USB_DEVICE(0x1557, 0x0002), USB_DEVICE_DATA(BOARD_505A) }, - /* - * at76c505amx-rfmd - */ - /* Generic AT76C505AMX device */ - { USB_DEVICE(0x03eb, 0x7615), USB_DEVICE_DATA(BOARD_505AMX) }, - { } -}; - -MODULE_DEVICE_TABLE(usb, dev_table); - -/* Supported rates of this hardware, bit 7 marks basic rates */ -static const u8 hw_rates[] = { 0x82, 0x84, 0x0b, 0x16 }; - -static const char *const preambles[] = { "long", "short", "auto" }; - -/* Firmware download */ -/* DFU states */ -#define STATE_IDLE 0x00 -#define STATE_DETACH 0x01 -#define STATE_DFU_IDLE 0x02 -#define STATE_DFU_DOWNLOAD_SYNC 0x03 -#define STATE_DFU_DOWNLOAD_BUSY 0x04 -#define STATE_DFU_DOWNLOAD_IDLE 0x05 -#define STATE_DFU_MANIFEST_SYNC 0x06 -#define STATE_DFU_MANIFEST 0x07 -#define STATE_DFU_MANIFEST_WAIT_RESET 0x08 -#define STATE_DFU_UPLOAD_IDLE 0x09 -#define STATE_DFU_ERROR 0x0a - -/* DFU commands */ -#define DFU_DETACH 0 -#define DFU_DNLOAD 1 -#define DFU_UPLOAD 2 -#define DFU_GETSTATUS 3 -#define DFU_CLRSTATUS 4 -#define DFU_GETSTATE 5 -#define DFU_ABORT 6 - -#define FW_BLOCK_SIZE 1024 - -struct dfu_status { - unsigned char status; - unsigned char poll_timeout[3]; - unsigned char state; - unsigned char string; -} __packed; - -static inline int at76_is_intersil(enum board_type board) -{ - return (board == BOARD_503_ISL3861 || board == BOARD_503_ISL3863); -} - -static inline int at76_is_503rfmd(enum board_type board) -{ - return (board == BOARD_503 || board == BOARD_503_ACC); -} - -static inline int at76_is_505a(enum board_type board) -{ - return (board == BOARD_505A || board == BOARD_505AMX); -} - -/* Load a block of the first (internal) part of the firmware */ -static int at76_load_int_fw_block(struct usb_device *udev, int blockno, - void *block, int size) -{ - return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), DFU_DNLOAD, - USB_TYPE_CLASS | USB_DIR_OUT | - USB_RECIP_INTERFACE, blockno, 0, block, size, - USB_CTRL_GET_TIMEOUT); -} - -static int at76_dfu_get_status(struct usb_device *udev, - struct dfu_status *status) -{ - int ret; - - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), DFU_GETSTATUS, - USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE, - 0, 0, status, sizeof(struct dfu_status), - USB_CTRL_GET_TIMEOUT); - return ret; -} - -static int at76_dfu_get_state(struct usb_device *udev, u8 *state) -{ - int ret; - - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), DFU_GETSTATE, - USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE, - 0, 0, state, 1, USB_CTRL_GET_TIMEOUT); - return ret; -} - -/* Convert timeout from the DFU status to jiffies */ -static inline unsigned long at76_get_timeout(struct dfu_status *s) -{ - return msecs_to_jiffies((s->poll_timeout[2] << 16) - | (s->poll_timeout[1] << 8) - | (s->poll_timeout[0])); -} - -/* Load internal firmware from the buffer. If manifest_sync_timeout > 0, use - * its value in jiffies in the MANIFEST_SYNC state. */ -static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size, - int manifest_sync_timeout) -{ - u8 *block; - struct dfu_status dfu_stat_buf; - int ret = 0; - int need_dfu_state = 1; - int is_done = 0; - u8 dfu_state = 0; - u32 dfu_timeout = 0; - int bsize = 0; - int blockno = 0; - - at76_dbg(DBG_DFU, "%s( %p, %u, %d)", __func__, buf, size, - manifest_sync_timeout); - - if (!size) { - dev_err(&udev->dev, "FW buffer length invalid!\n"); - return -EINVAL; - } - - block = kmalloc(FW_BLOCK_SIZE, GFP_KERNEL); - if (!block) - return -ENOMEM; - - do { - if (need_dfu_state) { - ret = at76_dfu_get_state(udev, &dfu_state); - if (ret < 0) { - dev_err(&udev->dev, - "cannot get DFU state: %d\n", ret); - goto exit; - } - need_dfu_state = 0; - } - - switch (dfu_state) { - case STATE_DFU_DOWNLOAD_SYNC: - at76_dbg(DBG_DFU, "STATE_DFU_DOWNLOAD_SYNC"); - ret = at76_dfu_get_status(udev, &dfu_stat_buf); - if (ret >= 0) { - dfu_state = dfu_stat_buf.state; - dfu_timeout = at76_get_timeout(&dfu_stat_buf); - need_dfu_state = 0; - } else - dev_err(&udev->dev, - "at76_dfu_get_status returned %d\n", - ret); - break; - - case STATE_DFU_DOWNLOAD_BUSY: - at76_dbg(DBG_DFU, "STATE_DFU_DOWNLOAD_BUSY"); - need_dfu_state = 1; - - at76_dbg(DBG_DFU, "DFU: Resetting device"); - schedule_timeout_interruptible(dfu_timeout); - break; - - case STATE_DFU_DOWNLOAD_IDLE: - at76_dbg(DBG_DFU, "DOWNLOAD..."); - /* fall through */ - case STATE_DFU_IDLE: - at76_dbg(DBG_DFU, "DFU IDLE"); - - bsize = min_t(int, size, FW_BLOCK_SIZE); - memcpy(block, buf, bsize); - at76_dbg(DBG_DFU, "int fw, size left = %5d, " - "bsize = %4d, blockno = %2d", size, bsize, - blockno); - ret = - at76_load_int_fw_block(udev, blockno, block, bsize); - buf += bsize; - size -= bsize; - blockno++; - - if (ret != bsize) - dev_err(&udev->dev, - "at76_load_int_fw_block returned %d\n", - ret); - need_dfu_state = 1; - break; - - case STATE_DFU_MANIFEST_SYNC: - at76_dbg(DBG_DFU, "STATE_DFU_MANIFEST_SYNC"); - - ret = at76_dfu_get_status(udev, &dfu_stat_buf); - if (ret < 0) - break; - - dfu_state = dfu_stat_buf.state; - dfu_timeout = at76_get_timeout(&dfu_stat_buf); - need_dfu_state = 0; - - /* override the timeout from the status response, - needed for AT76C505A */ - if (manifest_sync_timeout > 0) - dfu_timeout = manifest_sync_timeout; - - at76_dbg(DBG_DFU, "DFU: Waiting for manifest phase"); - schedule_timeout_interruptible(dfu_timeout); - break; - - case STATE_DFU_MANIFEST: - at76_dbg(DBG_DFU, "STATE_DFU_MANIFEST"); - is_done = 1; - break; - - case STATE_DFU_MANIFEST_WAIT_RESET: - at76_dbg(DBG_DFU, "STATE_DFU_MANIFEST_WAIT_RESET"); - is_done = 1; - break; - - case STATE_DFU_UPLOAD_IDLE: - at76_dbg(DBG_DFU, "STATE_DFU_UPLOAD_IDLE"); - break; - - case STATE_DFU_ERROR: - at76_dbg(DBG_DFU, "STATE_DFU_ERROR"); - ret = -EPIPE; - break; - - default: - at76_dbg(DBG_DFU, "DFU UNKNOWN STATE (%d)", dfu_state); - ret = -EINVAL; - break; - } - } while (!is_done && (ret >= 0)); - -exit: - kfree(block); - if (ret >= 0) - ret = 0; - - return ret; -} - -/* LED trigger */ -static int tx_activity; -static void at76_ledtrig_tx_timerfunc(unsigned long data); -static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc, 0, 0); -DEFINE_LED_TRIGGER(ledtrig_tx); - -static void at76_ledtrig_tx_timerfunc(unsigned long data) -{ - static int tx_lastactivity; - - if (tx_lastactivity != tx_activity) { - tx_lastactivity = tx_activity; - led_trigger_event(ledtrig_tx, LED_FULL); - mod_timer(&ledtrig_tx_timer, jiffies + HZ / 4); - } else - led_trigger_event(ledtrig_tx, LED_OFF); -} - -static void at76_ledtrig_tx_activity(void) -{ - tx_activity++; - if (!timer_pending(&ledtrig_tx_timer)) - mod_timer(&ledtrig_tx_timer, jiffies + HZ / 4); -} - -static int at76_remap(struct usb_device *udev) -{ - int ret; - ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x0a, - USB_TYPE_VENDOR | USB_DIR_OUT | - USB_RECIP_INTERFACE, 0, 0, NULL, 0, - USB_CTRL_GET_TIMEOUT); - if (ret < 0) - return ret; - return 0; -} - -static int at76_get_op_mode(struct usb_device *udev) -{ - int ret; - u8 saved; - u8 *op_mode; - - op_mode = kmalloc(1, GFP_NOIO); - if (!op_mode) - return -ENOMEM; - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x33, - USB_TYPE_VENDOR | USB_DIR_IN | - USB_RECIP_INTERFACE, 0x01, 0, op_mode, 1, - USB_CTRL_GET_TIMEOUT); - saved = *op_mode; - kfree(op_mode); - - if (ret < 0) - return ret; - else if (ret < 1) - return -EIO; - else - return saved; -} - -/* Load a block of the second ("external") part of the firmware */ -static inline int at76_load_ext_fw_block(struct usb_device *udev, int blockno, - void *block, int size) -{ - return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x0e, - USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, - 0x0802, blockno, block, size, - USB_CTRL_GET_TIMEOUT); -} - -static inline int at76_get_hw_cfg(struct usb_device *udev, - union at76_hwcfg *buf, int buf_size) -{ - return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x33, - USB_TYPE_VENDOR | USB_DIR_IN | - USB_RECIP_INTERFACE, 0x0a02, 0, - buf, buf_size, USB_CTRL_GET_TIMEOUT); -} - -/* Intersil boards use a different "value" for GetHWConfig requests */ -static inline int at76_get_hw_cfg_intersil(struct usb_device *udev, - union at76_hwcfg *buf, int buf_size) -{ - return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x33, - USB_TYPE_VENDOR | USB_DIR_IN | - USB_RECIP_INTERFACE, 0x0902, 0, - buf, buf_size, USB_CTRL_GET_TIMEOUT); -} - -/* Get the hardware configuration for the adapter and put it to the appropriate - * fields of 'priv' (the GetHWConfig request and interpretation of the result - * depends on the board type) */ -static int at76_get_hw_config(struct at76_priv *priv) -{ - int ret; - union at76_hwcfg *hwcfg = kmalloc(sizeof(*hwcfg), GFP_KERNEL); - - if (!hwcfg) - return -ENOMEM; - - if (at76_is_intersil(priv->board_type)) { - ret = at76_get_hw_cfg_intersil(priv->udev, hwcfg, - sizeof(hwcfg->i)); - if (ret < 0) - goto exit; - memcpy(priv->mac_addr, hwcfg->i.mac_addr, ETH_ALEN); - priv->regulatory_domain = hwcfg->i.regulatory_domain; - } else if (at76_is_503rfmd(priv->board_type)) { - ret = at76_get_hw_cfg(priv->udev, hwcfg, sizeof(hwcfg->r3)); - if (ret < 0) - goto exit; - memcpy(priv->mac_addr, hwcfg->r3.mac_addr, ETH_ALEN); - priv->regulatory_domain = hwcfg->r3.regulatory_domain; - } else { - ret = at76_get_hw_cfg(priv->udev, hwcfg, sizeof(hwcfg->r5)); - if (ret < 0) - goto exit; - memcpy(priv->mac_addr, hwcfg->r5.mac_addr, ETH_ALEN); - priv->regulatory_domain = hwcfg->r5.regulatory_domain; - } - -exit: - kfree(hwcfg); - if (ret < 0) - wiphy_err(priv->hw->wiphy, "cannot get HW Config (error %d)\n", - ret); - - return ret; -} - -static struct reg_domain const *at76_get_reg_domain(u16 code) -{ - int i; - static struct reg_domain const fd_tab[] = { - { 0x10, "FCC (USA)", 0x7ff }, /* ch 1-11 */ - { 0x20, "IC (Canada)", 0x7ff }, /* ch 1-11 */ - { 0x30, "ETSI (most of Europe)", 0x1fff }, /* ch 1-13 */ - { 0x31, "Spain", 0x600 }, /* ch 10-11 */ - { 0x32, "France", 0x1e00 }, /* ch 10-13 */ - { 0x40, "MKK (Japan)", 0x2000 }, /* ch 14 */ - { 0x41, "MKK1 (Japan)", 0x3fff }, /* ch 1-14 */ - { 0x50, "Israel", 0x3fc }, /* ch 3-9 */ - { 0x00, "", 0xffffffff } /* ch 1-32 */ - }; - - /* Last entry is fallback for unknown domain code */ - for (i = 0; i < ARRAY_SIZE(fd_tab) - 1; i++) - if (code == fd_tab[i].code) - break; - - return &fd_tab[i]; -} - -static inline int at76_get_mib(struct usb_device *udev, u16 mib, void *buf, - int buf_size) -{ - int ret; - - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x33, - USB_TYPE_VENDOR | USB_DIR_IN | - USB_RECIP_INTERFACE, mib << 8, 0, buf, buf_size, - USB_CTRL_GET_TIMEOUT); - if (ret >= 0 && ret != buf_size) - return -EIO; - return ret; -} - -/* Return positive number for status, negative for an error */ -static inline int at76_get_cmd_status(struct usb_device *udev, u8 cmd) -{ - u8 *stat_buf; - int ret; - - stat_buf = kmalloc(40, GFP_NOIO); - if (!stat_buf) - return -ENOMEM; - - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x22, - USB_TYPE_VENDOR | USB_DIR_IN | - USB_RECIP_INTERFACE, cmd, 0, stat_buf, - 40, USB_CTRL_GET_TIMEOUT); - if (ret >= 0) - ret = stat_buf[5]; - kfree(stat_buf); - - return ret; -} - -#define MAKE_CMD_CASE(c) case (c): return #c -static const char *at76_get_cmd_string(u8 cmd_status) -{ - switch (cmd_status) { - MAKE_CMD_CASE(CMD_SET_MIB); - MAKE_CMD_CASE(CMD_GET_MIB); - MAKE_CMD_CASE(CMD_SCAN); - MAKE_CMD_CASE(CMD_JOIN); - MAKE_CMD_CASE(CMD_START_IBSS); - MAKE_CMD_CASE(CMD_RADIO_ON); - MAKE_CMD_CASE(CMD_RADIO_OFF); - MAKE_CMD_CASE(CMD_STARTUP); - } - - return "UNKNOWN"; -} - -static int at76_set_card_command(struct usb_device *udev, u8 cmd, void *buf, - int buf_size) -{ - int ret; - struct at76_command *cmd_buf = kmalloc(sizeof(struct at76_command) + - buf_size, GFP_KERNEL); - - if (!cmd_buf) - return -ENOMEM; - - cmd_buf->cmd = cmd; - cmd_buf->reserved = 0; - cmd_buf->size = cpu_to_le16(buf_size); - memcpy(cmd_buf->data, buf, buf_size); - - at76_dbg_dump(DBG_CMD, cmd_buf, sizeof(struct at76_command) + buf_size, - "issuing command %s (0x%02x)", - at76_get_cmd_string(cmd), cmd); - - ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x0e, - USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, - 0, 0, cmd_buf, - sizeof(struct at76_command) + buf_size, - USB_CTRL_GET_TIMEOUT); - kfree(cmd_buf); - return ret; -} - -#define MAKE_CMD_STATUS_CASE(c) case (c): return #c -static const char *at76_get_cmd_status_string(u8 cmd_status) -{ - switch (cmd_status) { - MAKE_CMD_STATUS_CASE(CMD_STATUS_IDLE); - MAKE_CMD_STATUS_CASE(CMD_STATUS_COMPLETE); - MAKE_CMD_STATUS_CASE(CMD_STATUS_UNKNOWN); - MAKE_CMD_STATUS_CASE(CMD_STATUS_INVALID_PARAMETER); - MAKE_CMD_STATUS_CASE(CMD_STATUS_FUNCTION_NOT_SUPPORTED); - MAKE_CMD_STATUS_CASE(CMD_STATUS_TIME_OUT); - MAKE_CMD_STATUS_CASE(CMD_STATUS_IN_PROGRESS); - MAKE_CMD_STATUS_CASE(CMD_STATUS_HOST_FAILURE); - MAKE_CMD_STATUS_CASE(CMD_STATUS_SCAN_FAILED); - } - - return "UNKNOWN"; -} - -/* Wait until the command is completed */ -static int at76_wait_completion(struct at76_priv *priv, int cmd) -{ - int status = 0; - unsigned long timeout = jiffies + CMD_COMPLETION_TIMEOUT; - - do { - status = at76_get_cmd_status(priv->udev, cmd); - if (status < 0) { - wiphy_err(priv->hw->wiphy, - "at76_get_cmd_status failed: %d\n", - status); - break; - } - - at76_dbg(DBG_WAIT_COMPLETE, - "%s: Waiting on cmd %d, status = %d (%s)", - wiphy_name(priv->hw->wiphy), cmd, status, - at76_get_cmd_status_string(status)); - - if (status != CMD_STATUS_IN_PROGRESS - && status != CMD_STATUS_IDLE) - break; - - schedule_timeout_interruptible(HZ / 10); /* 100 ms */ - if (time_after(jiffies, timeout)) { - wiphy_err(priv->hw->wiphy, - "completion timeout for command %d\n", cmd); - status = -ETIMEDOUT; - break; - } - } while (1); - - return status; -} - -static int at76_set_mib(struct at76_priv *priv, struct set_mib_buffer *buf) -{ - int ret; - - ret = at76_set_card_command(priv->udev, CMD_SET_MIB, buf, - offsetof(struct set_mib_buffer, - data) + buf->size); - if (ret < 0) - return ret; - - ret = at76_wait_completion(priv, CMD_SET_MIB); - if (ret != CMD_STATUS_COMPLETE) { - wiphy_info(priv->hw->wiphy, - "set_mib: at76_wait_completion failed with %d\n", - ret); - ret = -EIO; - } - - return ret; -} - -/* Return < 0 on error, == 0 if no command sent, == 1 if cmd sent */ -static int at76_set_radio(struct at76_priv *priv, int enable) -{ - int ret; - int cmd; - - if (priv->radio_on == enable) - return 0; - - cmd = enable ? CMD_RADIO_ON : CMD_RADIO_OFF; - - ret = at76_set_card_command(priv->udev, cmd, NULL, 0); - if (ret < 0) - wiphy_err(priv->hw->wiphy, - "at76_set_card_command(%d) failed: %d\n", cmd, ret); - else - ret = 1; - - priv->radio_on = enable; - return ret; -} - -/* Set current power save mode (AT76_PM_OFF/AT76_PM_ON/AT76_PM_SMART) */ -static int at76_set_pm_mode(struct at76_priv *priv) -{ - int ret = 0; - - priv->mib_buf.type = MIB_MAC_MGMT; - priv->mib_buf.size = 1; - priv->mib_buf.index = offsetof(struct mib_mac_mgmt, power_mgmt_mode); - priv->mib_buf.data.byte = priv->pm_mode; - - ret = at76_set_mib(priv, &priv->mib_buf); - if (ret < 0) - wiphy_err(priv->hw->wiphy, "set_mib (pm_mode) failed: %d\n", - ret); - - return ret; -} - -static int at76_set_preamble(struct at76_priv *priv, u8 type) -{ - int ret = 0; - - priv->mib_buf.type = MIB_LOCAL; - priv->mib_buf.size = 1; - priv->mib_buf.index = offsetof(struct mib_local, preamble_type); - priv->mib_buf.data.byte = type; - - ret = at76_set_mib(priv, &priv->mib_buf); - if (ret < 0) - wiphy_err(priv->hw->wiphy, "set_mib (preamble) failed: %d\n", - ret); - - return ret; -} - -static int at76_set_frag(struct at76_priv *priv, u16 size) -{ - int ret = 0; - - priv->mib_buf.type = MIB_MAC; - priv->mib_buf.size = 2; - priv->mib_buf.index = offsetof(struct mib_mac, frag_threshold); - priv->mib_buf.data.word = cpu_to_le16(size); - - ret = at76_set_mib(priv, &priv->mib_buf); - if (ret < 0) - wiphy_err(priv->hw->wiphy, - "set_mib (frag threshold) failed: %d\n", ret); - - return ret; -} - -static int at76_set_rts(struct at76_priv *priv, u16 size) -{ - int ret = 0; - - priv->mib_buf.type = MIB_MAC; - priv->mib_buf.size = 2; - priv->mib_buf.index = offsetof(struct mib_mac, rts_threshold); - priv->mib_buf.data.word = cpu_to_le16(size); - - ret = at76_set_mib(priv, &priv->mib_buf); - if (ret < 0) - wiphy_err(priv->hw->wiphy, "set_mib (rts) failed: %d\n", ret); - - return ret; -} - -static int at76_set_autorate_fallback(struct at76_priv *priv, int onoff) -{ - int ret = 0; - - priv->mib_buf.type = MIB_LOCAL; - priv->mib_buf.size = 1; - priv->mib_buf.index = offsetof(struct mib_local, txautorate_fallback); - priv->mib_buf.data.byte = onoff; - - ret = at76_set_mib(priv, &priv->mib_buf); - if (ret < 0) - wiphy_err(priv->hw->wiphy, - "set_mib (autorate fallback) failed: %d\n", ret); - - return ret; -} - -static void at76_dump_mib_mac_addr(struct at76_priv *priv) -{ - int i; - int ret; - struct mib_mac_addr *m = kmalloc(sizeof(struct mib_mac_addr), - GFP_KERNEL); - - if (!m) - return; - - ret = at76_get_mib(priv->udev, MIB_MAC_ADDR, m, - sizeof(struct mib_mac_addr)); - if (ret < 0) { - wiphy_err(priv->hw->wiphy, - "at76_get_mib (MAC_ADDR) failed: %d\n", ret); - goto exit; - } - - at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: mac_addr %pM res 0x%x 0x%x", - wiphy_name(priv->hw->wiphy), - m->mac_addr, m->res[0], m->res[1]); - for (i = 0; i < ARRAY_SIZE(m->group_addr); i++) - at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: group addr %d: %pM, " - "status %d", wiphy_name(priv->hw->wiphy), i, - m->group_addr[i], m->group_addr_status[i]); -exit: - kfree(m); -} - -static void at76_dump_mib_mac_wep(struct at76_priv *priv) -{ - int i; - int ret; - int key_len; - struct mib_mac_wep *m = kmalloc(sizeof(struct mib_mac_wep), GFP_KERNEL); - - if (!m) - return; - - ret = at76_get_mib(priv->udev, MIB_MAC_WEP, m, - sizeof(struct mib_mac_wep)); - if (ret < 0) { - wiphy_err(priv->hw->wiphy, - "at76_get_mib (MAC_WEP) failed: %d\n", ret); - goto exit; - } - - at76_dbg(DBG_MIB, "%s: MIB MAC_WEP: priv_invoked %u def_key_id %u " - "key_len %u excl_unencr %u wep_icv_err %u wep_excluded %u " - "encr_level %u key %d", wiphy_name(priv->hw->wiphy), - m->privacy_invoked, m->wep_default_key_id, - m->wep_key_mapping_len, m->exclude_unencrypted, - le32_to_cpu(m->wep_icv_error_count), - le32_to_cpu(m->wep_excluded_count), m->encryption_level, - m->wep_default_key_id); - - key_len = (m->encryption_level == 1) ? - WEP_SMALL_KEY_LEN : WEP_LARGE_KEY_LEN; - - for (i = 0; i < WEP_KEYS; i++) - at76_dbg(DBG_MIB, "%s: MIB MAC_WEP: key %d: %*phD", - wiphy_name(priv->hw->wiphy), i, - key_len, m->wep_default_keyvalue[i]); -exit: - kfree(m); -} - -static void at76_dump_mib_mac_mgmt(struct at76_priv *priv) -{ - int ret; - struct mib_mac_mgmt *m = kmalloc(sizeof(struct mib_mac_mgmt), - GFP_KERNEL); - - if (!m) - return; - - ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, m, - sizeof(struct mib_mac_mgmt)); - if (ret < 0) { - wiphy_err(priv->hw->wiphy, - "at76_get_mib (MAC_MGMT) failed: %d\n", ret); - goto exit; - } - - at76_dbg(DBG_MIB, "%s: MIB MAC_MGMT: beacon_period %d CFP_max_duration " - "%d medium_occupancy_limit %d station_id 0x%x ATIM_window %d " - "CFP_mode %d privacy_opt_impl %d DTIM_period %d CFP_period %d " - "current_bssid %pM current_essid %*phD current_bss_type %d " - "pm_mode %d ibss_change %d res %d " - "multi_domain_capability_implemented %d " - "international_roaming %d country_string %.3s", - wiphy_name(priv->hw->wiphy), le16_to_cpu(m->beacon_period), - le16_to_cpu(m->CFP_max_duration), - le16_to_cpu(m->medium_occupancy_limit), - le16_to_cpu(m->station_id), le16_to_cpu(m->ATIM_window), - m->CFP_mode, m->privacy_option_implemented, m->DTIM_period, - m->CFP_period, m->current_bssid, - IW_ESSID_MAX_SIZE, m->current_essid, - m->current_bss_type, m->power_mgmt_mode, m->ibss_change, - m->res, m->multi_domain_capability_implemented, - m->multi_domain_capability_enabled, m->country_string); -exit: - kfree(m); -} - -static void at76_dump_mib_mac(struct at76_priv *priv) -{ - int ret; - struct mib_mac *m = kmalloc(sizeof(struct mib_mac), GFP_KERNEL); - - if (!m) - return; - - ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac)); - if (ret < 0) { - wiphy_err(priv->hw->wiphy, - "at76_get_mib (MAC) failed: %d\n", ret); - goto exit; - } - - at76_dbg(DBG_MIB, "%s: MIB MAC: max_tx_msdu_lifetime %d " - "max_rx_lifetime %d frag_threshold %d rts_threshold %d " - "cwmin %d cwmax %d short_retry_time %d long_retry_time %d " - "scan_type %d scan_channel %d probe_delay %u " - "min_channel_time %d max_channel_time %d listen_int %d " - "desired_ssid %*phD desired_bssid %pM desired_bsstype %d", - wiphy_name(priv->hw->wiphy), - le32_to_cpu(m->max_tx_msdu_lifetime), - le32_to_cpu(m->max_rx_lifetime), - le16_to_cpu(m->frag_threshold), le16_to_cpu(m->rts_threshold), - le16_to_cpu(m->cwmin), le16_to_cpu(m->cwmax), - m->short_retry_time, m->long_retry_time, m->scan_type, - m->scan_channel, le16_to_cpu(m->probe_delay), - le16_to_cpu(m->min_channel_time), - le16_to_cpu(m->max_channel_time), - le16_to_cpu(m->listen_interval), - IW_ESSID_MAX_SIZE, m->desired_ssid, - m->desired_bssid, m->desired_bsstype); -exit: - kfree(m); -} - -static void at76_dump_mib_phy(struct at76_priv *priv) -{ - int ret; - struct mib_phy *m = kmalloc(sizeof(struct mib_phy), GFP_KERNEL); - - if (!m) - return; - - ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy)); - if (ret < 0) { - wiphy_err(priv->hw->wiphy, - "at76_get_mib (PHY) failed: %d\n", ret); - goto exit; - } - - at76_dbg(DBG_MIB, "%s: MIB PHY: ed_threshold %d slot_time %d " - "sifs_time %d preamble_length %d plcp_header_length %d " - "mpdu_max_length %d cca_mode_supported %d operation_rate_set " - "0x%x 0x%x 0x%x 0x%x channel_id %d current_cca_mode %d " - "phy_type %d current_reg_domain %d", - wiphy_name(priv->hw->wiphy), le32_to_cpu(m->ed_threshold), - le16_to_cpu(m->slot_time), le16_to_cpu(m->sifs_time), - le16_to_cpu(m->preamble_length), - le16_to_cpu(m->plcp_header_length), - le16_to_cpu(m->mpdu_max_length), - le16_to_cpu(m->cca_mode_supported), m->operation_rate_set[0], - m->operation_rate_set[1], m->operation_rate_set[2], - m->operation_rate_set[3], m->channel_id, m->current_cca_mode, - m->phy_type, m->current_reg_domain); -exit: - kfree(m); -} - -static void at76_dump_mib_local(struct at76_priv *priv) -{ - int ret; - struct mib_local *m = kmalloc(sizeof(*m), GFP_KERNEL); - - if (!m) - return; - - ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(*m)); - if (ret < 0) { - wiphy_err(priv->hw->wiphy, - "at76_get_mib (LOCAL) failed: %d\n", ret); - goto exit; - } - - at76_dbg(DBG_MIB, "%s: MIB LOCAL: beacon_enable %d " - "txautorate_fallback %d ssid_size %d promiscuous_mode %d " - "preamble_type %d", wiphy_name(priv->hw->wiphy), - m->beacon_enable, - m->txautorate_fallback, m->ssid_size, m->promiscuous_mode, - m->preamble_type); -exit: - kfree(m); -} - -static void at76_dump_mib_mdomain(struct at76_priv *priv) -{ - int ret; - struct mib_mdomain *m = kmalloc(sizeof(struct mib_mdomain), GFP_KERNEL); - - if (!m) - return; - - ret = at76_get_mib(priv->udev, MIB_MDOMAIN, m, - sizeof(struct mib_mdomain)); - if (ret < 0) { - wiphy_err(priv->hw->wiphy, - "at76_get_mib (MDOMAIN) failed: %d\n", ret); - goto exit; - } - - at76_dbg(DBG_MIB, "%s: MIB MDOMAIN: channel_list %*phD", - wiphy_name(priv->hw->wiphy), - (int)sizeof(m->channel_list), m->channel_list); - - at76_dbg(DBG_MIB, "%s: MIB MDOMAIN: tx_powerlevel %*phD", - wiphy_name(priv->hw->wiphy), - (int)sizeof(m->tx_powerlevel), m->tx_powerlevel); -exit: - kfree(m); -} - -/* Enable monitor mode */ -static int at76_start_monitor(struct at76_priv *priv) -{ - struct at76_req_scan scan; - int ret; - - memset(&scan, 0, sizeof(struct at76_req_scan)); - memset(scan.bssid, 0xff, ETH_ALEN); - - scan.channel = priv->channel; - scan.scan_type = SCAN_TYPE_PASSIVE; - scan.international_scan = 0; - scan.min_channel_time = cpu_to_le16(priv->scan_min_time); - scan.max_channel_time = cpu_to_le16(priv->scan_max_time); - scan.probe_delay = cpu_to_le16(0); - - ret = at76_set_card_command(priv->udev, CMD_SCAN, &scan, sizeof(scan)); - if (ret >= 0) - ret = at76_get_cmd_status(priv->udev, CMD_SCAN); - - return ret; -} - -/* Calculate padding from txbuf->wlength (which excludes the USB TX header), - likely to compensate a flaw in the AT76C503A USB part ... */ -static inline int at76_calc_padding(int wlen) -{ - /* add the USB TX header */ - wlen += AT76_TX_HDRLEN; - - wlen = wlen % 64; - - if (wlen < 50) - return 50 - wlen; - - if (wlen >= 61) - return 64 + 50 - wlen; - - return 0; -} - -static void at76_rx_callback(struct urb *urb) -{ - struct at76_priv *priv = urb->context; - - priv->rx_tasklet.data = (unsigned long)urb; - tasklet_schedule(&priv->rx_tasklet); -} - -static int at76_submit_rx_urb(struct at76_priv *priv) -{ - int ret; - int size; - struct sk_buff *skb = priv->rx_skb; - - if (!priv->rx_urb) { - wiphy_err(priv->hw->wiphy, "%s: priv->rx_urb is NULL\n", - __func__); - return -EFAULT; - } - - if (!skb) { - skb = dev_alloc_skb(sizeof(struct at76_rx_buffer)); - if (!skb) { - wiphy_err(priv->hw->wiphy, - "cannot allocate rx skbuff\n"); - ret = -ENOMEM; - goto exit; - } - priv->rx_skb = skb; - } else { - skb_push(skb, skb_headroom(skb)); - skb_trim(skb, 0); - } - - size = skb_tailroom(skb); - usb_fill_bulk_urb(priv->rx_urb, priv->udev, priv->rx_pipe, - skb_put(skb, size), size, at76_rx_callback, priv); - ret = usb_submit_urb(priv->rx_urb, GFP_ATOMIC); - if (ret < 0) { - if (ret == -ENODEV) - at76_dbg(DBG_DEVSTART, - "usb_submit_urb returned -ENODEV"); - else - wiphy_err(priv->hw->wiphy, - "rx, usb_submit_urb failed: %d\n", ret); - } - -exit: - if (ret < 0 && ret != -ENODEV) - wiphy_err(priv->hw->wiphy, - "cannot submit rx urb - please unload the driver and/or power cycle the device\n"); - - return ret; -} - -/* Download external firmware */ -static int at76_load_external_fw(struct usb_device *udev, struct fwentry *fwe) -{ - int ret; - int op_mode; - int blockno = 0; - int bsize; - u8 *block; - u8 *buf = fwe->extfw; - int size = fwe->extfw_size; - - if (!buf || !size) - return -ENOENT; - - op_mode = at76_get_op_mode(udev); - at76_dbg(DBG_DEVSTART, "opmode %d", op_mode); - - if (op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) { - dev_err(&udev->dev, "unexpected opmode %d\n", op_mode); - return -EINVAL; - } - - block = kmalloc(FW_BLOCK_SIZE, GFP_KERNEL); - if (!block) - return -ENOMEM; - - at76_dbg(DBG_DEVSTART, "downloading external firmware"); - - /* for fw >= 0.100, the device needs an extra empty block */ - do { - bsize = min_t(int, size, FW_BLOCK_SIZE); - memcpy(block, buf, bsize); - at76_dbg(DBG_DEVSTART, - "ext fw, size left = %5d, bsize = %4d, blockno = %2d", - size, bsize, blockno); - ret = at76_load_ext_fw_block(udev, blockno, block, bsize); - if (ret != bsize) { - dev_err(&udev->dev, - "loading %dth firmware block failed: %d\n", - blockno, ret); - goto exit; - } - buf += bsize; - size -= bsize; - blockno++; - } while (bsize > 0); - - if (at76_is_505a(fwe->board_type)) { - at76_dbg(DBG_DEVSTART, "200 ms delay for 505a"); - schedule_timeout_interruptible(HZ / 5 + 1); - } - -exit: - kfree(block); - if (ret < 0) - dev_err(&udev->dev, - "downloading external firmware failed: %d\n", ret); - return ret; -} - -/* Download internal firmware */ -static int at76_load_internal_fw(struct usb_device *udev, struct fwentry *fwe) -{ - int ret; - int need_remap = !at76_is_505a(fwe->board_type); - - ret = at76_usbdfu_download(udev, fwe->intfw, fwe->intfw_size, - need_remap ? 0 : 2 * HZ); - - if (ret < 0) { - dev_err(&udev->dev, - "downloading internal fw failed with %d\n", ret); - goto exit; - } - - at76_dbg(DBG_DEVSTART, "sending REMAP"); - - /* no REMAP for 505A (see SF driver) */ - if (need_remap) { - ret = at76_remap(udev); - if (ret < 0) { - dev_err(&udev->dev, - "sending REMAP failed with %d\n", ret); - goto exit; - } - } - - at76_dbg(DBG_DEVSTART, "sleeping for 2 seconds"); - schedule_timeout_interruptible(2 * HZ + 1); - usb_reset_device(udev); - -exit: - return ret; -} - -static int at76_startup_device(struct at76_priv *priv) -{ - struct at76_card_config *ccfg = &priv->card_config; - int ret; - - at76_dbg(DBG_PARAMS, - "%s param: ssid %.*s (%*phD) mode %s ch %d wep %s key %d " - "keylen %d", wiphy_name(priv->hw->wiphy), priv->essid_size, - priv->essid, IW_ESSID_MAX_SIZE, priv->essid, - priv->iw_mode == IW_MODE_ADHOC ? "adhoc" : "infra", - priv->channel, priv->wep_enabled ? "enabled" : "disabled", - priv->wep_key_id, priv->wep_keys_len[priv->wep_key_id]); - at76_dbg(DBG_PARAMS, - "%s param: preamble %s rts %d retry %d frag %d " - "txrate %s auth_mode %d", wiphy_name(priv->hw->wiphy), - preambles[priv->preamble_type], priv->rts_threshold, - priv->short_retry_limit, priv->frag_threshold, - priv->txrate == TX_RATE_1MBIT ? "1MBit" : priv->txrate == - TX_RATE_2MBIT ? "2MBit" : priv->txrate == - TX_RATE_5_5MBIT ? "5.5MBit" : priv->txrate == - TX_RATE_11MBIT ? "11MBit" : priv->txrate == - TX_RATE_AUTO ? "auto" : "", priv->auth_mode); - at76_dbg(DBG_PARAMS, - "%s param: pm_mode %d pm_period %d auth_mode %s " - "scan_times %d %d scan_mode %s", - wiphy_name(priv->hw->wiphy), priv->pm_mode, priv->pm_period, - priv->auth_mode == WLAN_AUTH_OPEN ? "open" : "shared_secret", - priv->scan_min_time, priv->scan_max_time, - priv->scan_mode == SCAN_TYPE_ACTIVE ? "active" : "passive"); - - memset(ccfg, 0, sizeof(struct at76_card_config)); - ccfg->promiscuous_mode = 0; - ccfg->short_retry_limit = priv->short_retry_limit; - - if (priv->wep_enabled) { - if (priv->wep_keys_len[priv->wep_key_id] > WEP_SMALL_KEY_LEN) - ccfg->encryption_type = 2; - else - ccfg->encryption_type = 1; - - /* jal: always exclude unencrypted if WEP is active */ - ccfg->exclude_unencrypted = 1; - } else { - ccfg->exclude_unencrypted = 0; - ccfg->encryption_type = 0; - } - - ccfg->rts_threshold = cpu_to_le16(priv->rts_threshold); - ccfg->fragmentation_threshold = cpu_to_le16(priv->frag_threshold); - - memcpy(ccfg->basic_rate_set, hw_rates, 4); - /* jal: really needed, we do a set_mib for autorate later ??? */ - ccfg->auto_rate_fallback = (priv->txrate == TX_RATE_AUTO ? 1 : 0); - ccfg->channel = priv->channel; - ccfg->privacy_invoked = priv->wep_enabled; - memcpy(ccfg->current_ssid, priv->essid, IW_ESSID_MAX_SIZE); - ccfg->ssid_len = priv->essid_size; - - ccfg->wep_default_key_id = priv->wep_key_id; - memcpy(ccfg->wep_default_key_value, priv->wep_keys, - sizeof(priv->wep_keys)); - - ccfg->short_preamble = priv->preamble_type; - ccfg->beacon_period = cpu_to_le16(priv->beacon_period); - - ret = at76_set_card_command(priv->udev, CMD_STARTUP, &priv->card_config, - sizeof(struct at76_card_config)); - if (ret < 0) { - wiphy_err(priv->hw->wiphy, "at76_set_card_command failed: %d\n", - ret); - return ret; - } - - at76_wait_completion(priv, CMD_STARTUP); - - /* remove BSSID from previous run */ - memset(priv->bssid, 0, ETH_ALEN); - - if (at76_set_radio(priv, 1) == 1) - at76_wait_completion(priv, CMD_RADIO_ON); - - ret = at76_set_preamble(priv, priv->preamble_type); - if (ret < 0) - return ret; - - ret = at76_set_frag(priv, priv->frag_threshold); - if (ret < 0) - return ret; - - ret = at76_set_rts(priv, priv->rts_threshold); - if (ret < 0) - return ret; - - ret = at76_set_autorate_fallback(priv, - priv->txrate == TX_RATE_AUTO ? 1 : 0); - if (ret < 0) - return ret; - - ret = at76_set_pm_mode(priv); - if (ret < 0) - return ret; - - if (at76_debug & DBG_MIB) { - at76_dump_mib_mac(priv); - at76_dump_mib_mac_addr(priv); - at76_dump_mib_mac_mgmt(priv); - at76_dump_mib_mac_wep(priv); - at76_dump_mib_mdomain(priv); - at76_dump_mib_phy(priv); - at76_dump_mib_local(priv); - } - - return 0; -} - -/* Enable or disable promiscuous mode */ -static void at76_work_set_promisc(struct work_struct *work) -{ - struct at76_priv *priv = container_of(work, struct at76_priv, - work_set_promisc); - int ret = 0; - - if (priv->device_unplugged) - return; - - mutex_lock(&priv->mtx); - - priv->mib_buf.type = MIB_LOCAL; - priv->mib_buf.size = 1; - priv->mib_buf.index = offsetof(struct mib_local, promiscuous_mode); - priv->mib_buf.data.byte = priv->promisc ? 1 : 0; - - ret = at76_set_mib(priv, &priv->mib_buf); - if (ret < 0) - wiphy_err(priv->hw->wiphy, - "set_mib (promiscuous_mode) failed: %d\n", ret); - - mutex_unlock(&priv->mtx); -} - -/* Submit Rx urb back to the device */ -static void at76_work_submit_rx(struct work_struct *work) -{ - struct at76_priv *priv = container_of(work, struct at76_priv, - work_submit_rx); - - mutex_lock(&priv->mtx); - at76_submit_rx_urb(priv); - mutex_unlock(&priv->mtx); -} - -static void at76_rx_tasklet(unsigned long param) -{ - struct urb *urb = (struct urb *)param; - struct at76_priv *priv = urb->context; - struct at76_rx_buffer *buf; - struct ieee80211_rx_status rx_status = { 0 }; - - if (priv->device_unplugged) { - at76_dbg(DBG_DEVSTART, "device unplugged"); - at76_dbg(DBG_DEVSTART, "urb status %d", urb->status); - return; - } - - if (!priv->rx_skb || !priv->rx_skb->data) - return; - - buf = (struct at76_rx_buffer *)priv->rx_skb->data; - - if (urb->status != 0) { - if (urb->status != -ENOENT && urb->status != -ECONNRESET) - at76_dbg(DBG_URB, - "%s %s: - nonzero Rx bulk status received: %d", - __func__, wiphy_name(priv->hw->wiphy), - urb->status); - return; - } - - at76_dbg(DBG_RX_ATMEL_HDR, - "%s: rx frame: rate %d rssi %d noise %d link %d", - wiphy_name(priv->hw->wiphy), buf->rx_rate, buf->rssi, - buf->noise_level, buf->link_quality); - - skb_pull(priv->rx_skb, AT76_RX_HDRLEN); - skb_trim(priv->rx_skb, le16_to_cpu(buf->wlength)); - at76_dbg_dump(DBG_RX_DATA, priv->rx_skb->data, - priv->rx_skb->len, "RX: len=%d", priv->rx_skb->len); - - rx_status.signal = buf->rssi; - rx_status.flag |= RX_FLAG_DECRYPTED; - rx_status.flag |= RX_FLAG_IV_STRIPPED; - - at76_dbg(DBG_MAC80211, "calling ieee80211_rx_irqsafe(): %d/%d", - priv->rx_skb->len, priv->rx_skb->data_len); - memcpy(IEEE80211_SKB_RXCB(priv->rx_skb), &rx_status, sizeof(rx_status)); - ieee80211_rx_irqsafe(priv->hw, priv->rx_skb); - - /* Use a new skb for the next receive */ - priv->rx_skb = NULL; - - at76_submit_rx_urb(priv); -} - -/* Load firmware into kernel memory and parse it */ -static struct fwentry *at76_load_firmware(struct usb_device *udev, - enum board_type board_type) -{ - int ret; - char *str; - struct at76_fw_header *fwh; - struct fwentry *fwe = &firmwares[board_type]; - - mutex_lock(&fw_mutex); - - if (fwe->loaded) { - at76_dbg(DBG_FW, "re-using previously loaded fw"); - goto exit; - } - - at76_dbg(DBG_FW, "downloading firmware %s", fwe->fwname); - ret = request_firmware(&fwe->fw, fwe->fwname, &udev->dev); - if (ret < 0) { - dev_err(&udev->dev, "firmware %s not found!\n", - fwe->fwname); - dev_err(&udev->dev, - "you may need to download the firmware from http://developer.berlios.de/projects/at76c503a/\n"); - goto exit; - } - - at76_dbg(DBG_FW, "got it."); - fwh = (struct at76_fw_header *)(fwe->fw->data); - - if (fwe->fw->size <= sizeof(*fwh)) { - dev_err(&udev->dev, - "firmware is too short (0x%zx)\n", fwe->fw->size); - goto exit; - } - - /* CRC currently not checked */ - fwe->board_type = le32_to_cpu(fwh->board_type); - if (fwe->board_type != board_type) { - dev_err(&udev->dev, - "board type mismatch, requested %u, got %u\n", - board_type, fwe->board_type); - goto exit; - } - - fwe->fw_version.major = fwh->major; - fwe->fw_version.minor = fwh->minor; - fwe->fw_version.patch = fwh->patch; - fwe->fw_version.build = fwh->build; - - str = (char *)fwh + le32_to_cpu(fwh->str_offset); - fwe->intfw = (u8 *)fwh + le32_to_cpu(fwh->int_fw_offset); - fwe->intfw_size = le32_to_cpu(fwh->int_fw_len); - fwe->extfw = (u8 *)fwh + le32_to_cpu(fwh->ext_fw_offset); - fwe->extfw_size = le32_to_cpu(fwh->ext_fw_len); - - fwe->loaded = 1; - - dev_printk(KERN_DEBUG, &udev->dev, - "using firmware %s (version %d.%d.%d-%d)\n", - fwe->fwname, fwh->major, fwh->minor, fwh->patch, fwh->build); - - at76_dbg(DBG_DEVSTART, "board %u, int %d:%d, ext %d:%d", board_type, - le32_to_cpu(fwh->int_fw_offset), le32_to_cpu(fwh->int_fw_len), - le32_to_cpu(fwh->ext_fw_offset), le32_to_cpu(fwh->ext_fw_len)); - at76_dbg(DBG_DEVSTART, "firmware id %s", str); - -exit: - mutex_unlock(&fw_mutex); - - if (fwe->loaded) - return fwe; - else - return NULL; -} - -static int at76_join(struct at76_priv *priv) -{ - struct at76_req_join join; - int ret; - - memset(&join, 0, sizeof(struct at76_req_join)); - memcpy(join.essid, priv->essid, priv->essid_size); - join.essid_size = priv->essid_size; - memcpy(join.bssid, priv->bssid, ETH_ALEN); - join.bss_type = INFRASTRUCTURE_MODE; - join.channel = priv->channel; - join.timeout = cpu_to_le16(2000); - - at76_dbg(DBG_MAC80211, "%s: sending CMD_JOIN", __func__); - ret = at76_set_card_command(priv->udev, CMD_JOIN, &join, - sizeof(struct at76_req_join)); - - if (ret < 0) { - wiphy_err(priv->hw->wiphy, "at76_set_card_command failed: %d\n", - ret); - return 0; - } - - ret = at76_wait_completion(priv, CMD_JOIN); - at76_dbg(DBG_MAC80211, "%s: CMD_JOIN returned: 0x%02x", __func__, ret); - if (ret != CMD_STATUS_COMPLETE) { - wiphy_err(priv->hw->wiphy, "at76_wait_completion failed: %d\n", - ret); - return 0; - } - - at76_set_pm_mode(priv); - - return 0; -} - -static void at76_work_join_bssid(struct work_struct *work) -{ - struct at76_priv *priv = container_of(work, struct at76_priv, - work_join_bssid); - - if (priv->device_unplugged) - return; - - mutex_lock(&priv->mtx); - - if (is_valid_ether_addr(priv->bssid)) - at76_join(priv); - - mutex_unlock(&priv->mtx); -} - -static void at76_mac80211_tx_callback(struct urb *urb) -{ - struct at76_priv *priv = urb->context; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(priv->tx_skb); - - at76_dbg(DBG_MAC80211, "%s()", __func__); - - switch (urb->status) { - case 0: - /* success */ - info->flags |= IEEE80211_TX_STAT_ACK; - break; - case -ENOENT: - case -ECONNRESET: - /* fail, urb has been unlinked */ - /* FIXME: add error message */ - break; - default: - at76_dbg(DBG_URB, "%s - nonzero tx status received: %d", - __func__, urb->status); - break; - } - - memset(&info->status, 0, sizeof(info->status)); - - ieee80211_tx_status_irqsafe(priv->hw, priv->tx_skb); - - priv->tx_skb = NULL; - - ieee80211_wake_queues(priv->hw); -} - -static void at76_mac80211_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct at76_priv *priv = hw->priv; - struct at76_tx_buffer *tx_buffer = priv->bulk_out_buffer; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; - int padding, submit_len, ret; - - at76_dbg(DBG_MAC80211, "%s()", __func__); - - if (priv->tx_urb->status == -EINPROGRESS) { - wiphy_err(priv->hw->wiphy, - "%s called while tx urb is pending\n", __func__); - dev_kfree_skb_any(skb); - return; - } - - /* The following code lines are important when the device is going to - * authenticate with a new bssid. The driver must send CMD_JOIN before - * an authentication frame is transmitted. For this to succeed, the - * correct bssid of the AP must be known. As mac80211 does not inform - * drivers about the bssid prior to the authentication process the - * following workaround is necessary. If the TX frame is an - * authentication frame extract the bssid and send the CMD_JOIN. */ - if (mgmt->frame_control & cpu_to_le16(IEEE80211_STYPE_AUTH)) { - if (!ether_addr_equal(priv->bssid, mgmt->bssid)) { - memcpy(priv->bssid, mgmt->bssid, ETH_ALEN); - ieee80211_queue_work(hw, &priv->work_join_bssid); - dev_kfree_skb_any(skb); - return; - } - } - - ieee80211_stop_queues(hw); - - at76_ledtrig_tx_activity(); /* tell ledtrigger we send a packet */ - - WARN_ON(priv->tx_skb != NULL); - - priv->tx_skb = skb; - padding = at76_calc_padding(skb->len); - submit_len = AT76_TX_HDRLEN + skb->len + padding; - - /* setup 'Atmel' header */ - memset(tx_buffer, 0, sizeof(*tx_buffer)); - tx_buffer->padding = padding; - tx_buffer->wlength = cpu_to_le16(skb->len); - tx_buffer->tx_rate = ieee80211_get_tx_rate(hw, info)->hw_value; - memset(tx_buffer->reserved, 0, sizeof(tx_buffer->reserved)); - memcpy(tx_buffer->packet, skb->data, skb->len); - - at76_dbg(DBG_TX_DATA, "%s tx: wlen 0x%x pad 0x%x rate %d hdr", - wiphy_name(priv->hw->wiphy), le16_to_cpu(tx_buffer->wlength), - tx_buffer->padding, tx_buffer->tx_rate); - - /* send stuff */ - at76_dbg_dump(DBG_TX_DATA_CONTENT, tx_buffer, submit_len, - "%s(): tx_buffer %d bytes:", __func__, submit_len); - usb_fill_bulk_urb(priv->tx_urb, priv->udev, priv->tx_pipe, tx_buffer, - submit_len, at76_mac80211_tx_callback, priv); - ret = usb_submit_urb(priv->tx_urb, GFP_ATOMIC); - if (ret) { - wiphy_err(priv->hw->wiphy, "error in tx submit urb: %d\n", ret); - if (ret == -EINVAL) - wiphy_err(priv->hw->wiphy, - "-EINVAL: tx urb %p hcpriv %p complete %p\n", - priv->tx_urb, - priv->tx_urb->hcpriv, priv->tx_urb->complete); - } -} - -static int at76_mac80211_start(struct ieee80211_hw *hw) -{ - struct at76_priv *priv = hw->priv; - int ret; - - at76_dbg(DBG_MAC80211, "%s()", __func__); - - mutex_lock(&priv->mtx); - - ret = at76_submit_rx_urb(priv); - if (ret < 0) { - wiphy_err(priv->hw->wiphy, "open: submit_rx_urb failed: %d\n", - ret); - goto error; - } - - at76_startup_device(priv); - - at76_start_monitor(priv); - -error: - mutex_unlock(&priv->mtx); - - return 0; -} - -static void at76_mac80211_stop(struct ieee80211_hw *hw) -{ - struct at76_priv *priv = hw->priv; - - at76_dbg(DBG_MAC80211, "%s()", __func__); - - cancel_delayed_work(&priv->dwork_hw_scan); - cancel_work_sync(&priv->work_join_bssid); - cancel_work_sync(&priv->work_set_promisc); - - mutex_lock(&priv->mtx); - - if (!priv->device_unplugged) { - /* We are called by "ifconfig ethX down", not because the - * device is not available anymore. */ - at76_set_radio(priv, 0); - - /* We unlink rx_urb because at76_open() re-submits it. - * If unplugged, at76_delete_device() takes care of it. */ - usb_kill_urb(priv->rx_urb); - } - - mutex_unlock(&priv->mtx); -} - -static int at76_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct at76_priv *priv = hw->priv; - int ret = 0; - - at76_dbg(DBG_MAC80211, "%s()", __func__); - - mutex_lock(&priv->mtx); - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - priv->iw_mode = IW_MODE_INFRA; - break; - default: - ret = -EOPNOTSUPP; - goto exit; - } - -exit: - mutex_unlock(&priv->mtx); - - return ret; -} - -static void at76_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - at76_dbg(DBG_MAC80211, "%s()", __func__); -} - -static void at76_dwork_hw_scan(struct work_struct *work) -{ - struct at76_priv *priv = container_of(work, struct at76_priv, - dwork_hw_scan.work); - int ret; - - if (priv->device_unplugged) - return; - - mutex_lock(&priv->mtx); - - ret = at76_get_cmd_status(priv->udev, CMD_SCAN); - at76_dbg(DBG_MAC80211, "%s: CMD_SCAN status 0x%02x", __func__, ret); - - /* FIXME: add maximum time for scan to complete */ - - if (ret != CMD_STATUS_COMPLETE) { - ieee80211_queue_delayed_work(priv->hw, &priv->dwork_hw_scan, - SCAN_POLL_INTERVAL); - mutex_unlock(&priv->mtx); - return; - } - - if (is_valid_ether_addr(priv->bssid)) - at76_join(priv); - - mutex_unlock(&priv->mtx); - - ieee80211_scan_completed(priv->hw, false); - - ieee80211_wake_queues(priv->hw); -} - -static int at76_hw_scan(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct cfg80211_scan_request *req) -{ - struct at76_priv *priv = hw->priv; - struct at76_req_scan scan; - u8 *ssid = NULL; - int ret, len = 0; - - at76_dbg(DBG_MAC80211, "%s():", __func__); - - if (priv->device_unplugged) - return 0; - - mutex_lock(&priv->mtx); - - ieee80211_stop_queues(hw); - - memset(&scan, 0, sizeof(struct at76_req_scan)); - memset(scan.bssid, 0xFF, ETH_ALEN); - - if (req->n_ssids) { - scan.scan_type = SCAN_TYPE_ACTIVE; - ssid = req->ssids[0].ssid; - len = req->ssids[0].ssid_len; - } else { - scan.scan_type = SCAN_TYPE_PASSIVE; - } - - if (len) { - memcpy(scan.essid, ssid, len); - scan.essid_size = len; - } - - scan.min_channel_time = cpu_to_le16(priv->scan_min_time); - scan.max_channel_time = cpu_to_le16(priv->scan_max_time); - scan.probe_delay = cpu_to_le16(priv->scan_min_time * 1000); - scan.international_scan = 0; - - at76_dbg(DBG_MAC80211, "%s: sending CMD_SCAN", __func__); - ret = at76_set_card_command(priv->udev, CMD_SCAN, &scan, sizeof(scan)); - - if (ret < 0) { - wiphy_err(priv->hw->wiphy, "CMD_SCAN failed: %d\n", ret); - goto exit; - } - - ieee80211_queue_delayed_work(priv->hw, &priv->dwork_hw_scan, - SCAN_POLL_INTERVAL); - -exit: - mutex_unlock(&priv->mtx); - - return 0; -} - -static int at76_config(struct ieee80211_hw *hw, u32 changed) -{ - struct at76_priv *priv = hw->priv; - - at76_dbg(DBG_MAC80211, "%s(): channel %d", - __func__, hw->conf.chandef.chan->hw_value); - at76_dbg_dump(DBG_MAC80211, priv->bssid, ETH_ALEN, "bssid:"); - - mutex_lock(&priv->mtx); - - priv->channel = hw->conf.chandef.chan->hw_value; - - if (is_valid_ether_addr(priv->bssid)) - at76_join(priv); - else - at76_start_monitor(priv); - - mutex_unlock(&priv->mtx); - - return 0; -} - -static void at76_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *conf, - u32 changed) -{ - struct at76_priv *priv = hw->priv; - - at76_dbg(DBG_MAC80211, "%s():", __func__); - - if (!(changed & BSS_CHANGED_BSSID)) - return; - - at76_dbg_dump(DBG_MAC80211, conf->bssid, ETH_ALEN, "bssid:"); - - mutex_lock(&priv->mtx); - - memcpy(priv->bssid, conf->bssid, ETH_ALEN); - - if (is_valid_ether_addr(priv->bssid)) - /* mac80211 is joining a bss */ - at76_join(priv); - - mutex_unlock(&priv->mtx); -} - -/* must be atomic */ -static void at76_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *total_flags, u64 multicast) -{ - struct at76_priv *priv = hw->priv; - int flags; - - at76_dbg(DBG_MAC80211, "%s(): changed_flags=0x%08x " - "total_flags=0x%08x", - __func__, changed_flags, *total_flags); - - flags = changed_flags & AT76_SUPPORTED_FILTERS; - *total_flags = AT76_SUPPORTED_FILTERS; - - /* Bail out after updating flags to prevent a WARN_ON in mac80211. */ - if (priv->device_unplugged) - return; - - /* FIXME: access to priv->promisc should be protected with - * priv->mtx, but it's impossible because this function needs to be - * atomic */ - - if (flags && !priv->promisc) { - /* mac80211 wants us to enable promiscuous mode */ - priv->promisc = 1; - } else if (!flags && priv->promisc) { - /* we need to disable promiscuous mode */ - priv->promisc = 0; - } else - return; - - ieee80211_queue_work(hw, &priv->work_set_promisc); -} - -static int at76_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct at76_priv *priv = hw->priv; - - int i; - - at76_dbg(DBG_MAC80211, "%s(): cmd %d key->cipher %d key->keyidx %d " - "key->keylen %d", - __func__, cmd, key->cipher, key->keyidx, key->keylen); - - if ((key->cipher != WLAN_CIPHER_SUITE_WEP40) && - (key->cipher != WLAN_CIPHER_SUITE_WEP104)) - return -EOPNOTSUPP; - - key->hw_key_idx = key->keyidx; - - mutex_lock(&priv->mtx); - - switch (cmd) { - case SET_KEY: - memcpy(priv->wep_keys[key->keyidx], key->key, key->keylen); - priv->wep_keys_len[key->keyidx] = key->keylen; - - /* FIXME: find out how to do this properly */ - priv->wep_key_id = key->keyidx; - - break; - case DISABLE_KEY: - default: - priv->wep_keys_len[key->keyidx] = 0; - break; - } - - priv->wep_enabled = 0; - - for (i = 0; i < WEP_KEYS; i++) { - if (priv->wep_keys_len[i] != 0) - priv->wep_enabled = 1; - } - - at76_startup_device(priv); - - mutex_unlock(&priv->mtx); - - return 0; -} - -static const struct ieee80211_ops at76_ops = { - .tx = at76_mac80211_tx, - .add_interface = at76_add_interface, - .remove_interface = at76_remove_interface, - .config = at76_config, - .bss_info_changed = at76_bss_info_changed, - .configure_filter = at76_configure_filter, - .start = at76_mac80211_start, - .stop = at76_mac80211_stop, - .hw_scan = at76_hw_scan, - .set_key = at76_set_key, -}; - -/* Allocate network device and initialize private data */ -static struct at76_priv *at76_alloc_new_device(struct usb_device *udev) -{ - struct ieee80211_hw *hw; - struct at76_priv *priv; - - hw = ieee80211_alloc_hw(sizeof(struct at76_priv), &at76_ops); - if (!hw) { - printk(KERN_ERR DRIVER_NAME ": could not register" - " ieee80211_hw\n"); - return NULL; - } - - priv = hw->priv; - priv->hw = hw; - - priv->udev = udev; - - mutex_init(&priv->mtx); - INIT_WORK(&priv->work_set_promisc, at76_work_set_promisc); - INIT_WORK(&priv->work_submit_rx, at76_work_submit_rx); - INIT_WORK(&priv->work_join_bssid, at76_work_join_bssid); - INIT_DELAYED_WORK(&priv->dwork_hw_scan, at76_dwork_hw_scan); - - tasklet_init(&priv->rx_tasklet, at76_rx_tasklet, 0); - - priv->pm_mode = AT76_PM_OFF; - priv->pm_period = 0; - - /* unit us */ - priv->hw->channel_change_time = 100000; - - return priv; -} - -static int at76_alloc_urbs(struct at76_priv *priv, - struct usb_interface *interface) -{ - struct usb_endpoint_descriptor *endpoint, *ep_in, *ep_out; - int i; - int buffer_size; - struct usb_host_interface *iface_desc; - - at76_dbg(DBG_PROC_ENTRY, "%s: ENTER", __func__); - - at76_dbg(DBG_URB, "%s: NumEndpoints %d ", __func__, - interface->altsetting[0].desc.bNumEndpoints); - - ep_in = NULL; - ep_out = NULL; - iface_desc = interface->cur_altsetting; - for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) { - endpoint = &iface_desc->endpoint[i].desc; - - at76_dbg(DBG_URB, "%s: %d. endpoint: addr 0x%x attr 0x%x", - __func__, i, endpoint->bEndpointAddress, - endpoint->bmAttributes); - - if (!ep_in && usb_endpoint_is_bulk_in(endpoint)) - ep_in = endpoint; - - if (!ep_out && usb_endpoint_is_bulk_out(endpoint)) - ep_out = endpoint; - } - - if (!ep_in || !ep_out) { - dev_err(&interface->dev, "bulk endpoints missing\n"); - return -ENXIO; - } - - priv->rx_pipe = usb_rcvbulkpipe(priv->udev, ep_in->bEndpointAddress); - priv->tx_pipe = usb_sndbulkpipe(priv->udev, ep_out->bEndpointAddress); - - priv->rx_urb = usb_alloc_urb(0, GFP_KERNEL); - priv->tx_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!priv->rx_urb || !priv->tx_urb) { - dev_err(&interface->dev, "cannot allocate URB\n"); - return -ENOMEM; - } - - buffer_size = sizeof(struct at76_tx_buffer) + MAX_PADDING_SIZE; - priv->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL); - if (!priv->bulk_out_buffer) - return -ENOMEM; - - at76_dbg(DBG_PROC_ENTRY, "%s: EXIT", __func__); - - return 0; -} - -static struct ieee80211_rate at76_rates[] = { - { .bitrate = 10, .hw_value = TX_RATE_1MBIT, }, - { .bitrate = 20, .hw_value = TX_RATE_2MBIT, }, - { .bitrate = 55, .hw_value = TX_RATE_5_5MBIT, }, - { .bitrate = 110, .hw_value = TX_RATE_11MBIT, }, -}; - -static struct ieee80211_channel at76_channels[] = { - { .center_freq = 2412, .hw_value = 1 }, - { .center_freq = 2417, .hw_value = 2 }, - { .center_freq = 2422, .hw_value = 3 }, - { .center_freq = 2427, .hw_value = 4 }, - { .center_freq = 2432, .hw_value = 5 }, - { .center_freq = 2437, .hw_value = 6 }, - { .center_freq = 2442, .hw_value = 7 }, - { .center_freq = 2447, .hw_value = 8 }, - { .center_freq = 2452, .hw_value = 9 }, - { .center_freq = 2457, .hw_value = 10 }, - { .center_freq = 2462, .hw_value = 11 }, - { .center_freq = 2467, .hw_value = 12 }, - { .center_freq = 2472, .hw_value = 13 }, - { .center_freq = 2484, .hw_value = 14 } -}; - -static struct ieee80211_supported_band at76_supported_band = { - .channels = at76_channels, - .n_channels = ARRAY_SIZE(at76_channels), - .bitrates = at76_rates, - .n_bitrates = ARRAY_SIZE(at76_rates), -}; - -/* Register network device and initialize the hardware */ -static int at76_init_new_device(struct at76_priv *priv, - struct usb_interface *interface) -{ - struct wiphy *wiphy; - size_t len; - int ret; - - /* set up the endpoint information */ - /* check out the endpoints */ - - at76_dbg(DBG_DEVSTART, "USB interface: %d endpoints", - interface->cur_altsetting->desc.bNumEndpoints); - - ret = at76_alloc_urbs(priv, interface); - if (ret < 0) - goto exit; - - /* MAC address */ - ret = at76_get_hw_config(priv); - if (ret < 0) { - dev_err(&interface->dev, "cannot get MAC address\n"); - goto exit; - } - - priv->domain = at76_get_reg_domain(priv->regulatory_domain); - - priv->channel = DEF_CHANNEL; - priv->iw_mode = IW_MODE_INFRA; - priv->rts_threshold = DEF_RTS_THRESHOLD; - priv->frag_threshold = DEF_FRAG_THRESHOLD; - priv->short_retry_limit = DEF_SHORT_RETRY_LIMIT; - priv->txrate = TX_RATE_AUTO; - priv->preamble_type = PREAMBLE_TYPE_LONG; - priv->beacon_period = 100; - priv->auth_mode = WLAN_AUTH_OPEN; - priv->scan_min_time = DEF_SCAN_MIN_TIME; - priv->scan_max_time = DEF_SCAN_MAX_TIME; - priv->scan_mode = SCAN_TYPE_ACTIVE; - priv->device_unplugged = 0; - - /* mac80211 initialisation */ - wiphy = priv->hw->wiphy; - priv->hw->wiphy->max_scan_ssids = 1; - priv->hw->wiphy->max_scan_ie_len = 0; - priv->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); - priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &at76_supported_band; - priv->hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_SIGNAL_UNSPEC; - priv->hw->max_signal = 100; - - SET_IEEE80211_DEV(priv->hw, &interface->dev); - SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); - - len = sizeof(wiphy->fw_version); - snprintf(wiphy->fw_version, len, "%d.%d.%d-%d", - priv->fw_version.major, priv->fw_version.minor, - priv->fw_version.patch, priv->fw_version.build); - - wiphy->hw_version = priv->board_type; - - ret = ieee80211_register_hw(priv->hw); - if (ret) { - printk(KERN_ERR "cannot register mac80211 hw (status %d)!\n", - ret); - goto exit; - } - - priv->mac80211_registered = 1; - - wiphy_info(priv->hw->wiphy, "USB %s, MAC %pM, firmware %d.%d.%d-%d\n", - dev_name(&interface->dev), priv->mac_addr, - priv->fw_version.major, priv->fw_version.minor, - priv->fw_version.patch, priv->fw_version.build); - wiphy_info(priv->hw->wiphy, "regulatory domain 0x%02x: %s\n", - priv->regulatory_domain, priv->domain->name); - -exit: - return ret; -} - -static void at76_delete_device(struct at76_priv *priv) -{ - at76_dbg(DBG_PROC_ENTRY, "%s: ENTER", __func__); - - /* The device is gone, don't bother turning it off */ - priv->device_unplugged = 1; - - tasklet_kill(&priv->rx_tasklet); - - if (priv->mac80211_registered) - ieee80211_unregister_hw(priv->hw); - - if (priv->tx_urb) { - usb_kill_urb(priv->tx_urb); - usb_free_urb(priv->tx_urb); - } - if (priv->rx_urb) { - usb_kill_urb(priv->rx_urb); - usb_free_urb(priv->rx_urb); - } - - at76_dbg(DBG_PROC_ENTRY, "%s: unlinked urbs", __func__); - - kfree(priv->bulk_out_buffer); - - del_timer_sync(&ledtrig_tx_timer); - - kfree_skb(priv->rx_skb); - - usb_put_dev(priv->udev); - - at76_dbg(DBG_PROC_ENTRY, "%s: before freeing priv/ieee80211_hw", - __func__); - ieee80211_free_hw(priv->hw); - - at76_dbg(DBG_PROC_ENTRY, "%s: EXIT", __func__); -} - -static int at76_probe(struct usb_interface *interface, - const struct usb_device_id *id) -{ - int ret; - struct at76_priv *priv; - struct fwentry *fwe; - struct usb_device *udev; - int op_mode; - int need_ext_fw = 0; - struct mib_fw_version fwv; - int board_type = (int)id->driver_info; - - udev = usb_get_dev(interface_to_usbdev(interface)); - - /* Load firmware into kernel memory */ - fwe = at76_load_firmware(udev, board_type); - if (!fwe) { - ret = -ENOENT; - goto error; - } - - op_mode = at76_get_op_mode(udev); - - at76_dbg(DBG_DEVSTART, "opmode %d", op_mode); - - /* we get OPMODE_NONE with 2.4.23, SMC2662W-AR ??? - we get 204 with 2.4.23, Fiberline FL-WL240u (505A+RFMD2958) ??? */ - - if (op_mode == OPMODE_HW_CONFIG_MODE) { - dev_err(&interface->dev, - "cannot handle a device in HW_CONFIG_MODE\n"); - ret = -EBUSY; - goto error; - } - - if (op_mode != OPMODE_NORMAL_NIC_WITH_FLASH - && op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) { - /* download internal firmware part */ - dev_printk(KERN_DEBUG, &interface->dev, - "downloading internal firmware\n"); - ret = at76_load_internal_fw(udev, fwe); - if (ret < 0) { - dev_err(&interface->dev, - "error %d downloading internal firmware\n", - ret); - goto error; - } - usb_put_dev(udev); - return ret; - } - - /* Internal firmware already inside the device. Get firmware - * version to test if external firmware is loaded. - * This works only for newer firmware, e.g. the Intersil 0.90.x - * says "control timeout on ep0in" and subsequent - * at76_get_op_mode() fail too :-( */ - - /* if version >= 0.100.x.y or device with built-in flash we can - * query the device for the fw version */ - if ((fwe->fw_version.major > 0 || fwe->fw_version.minor >= 100) - || (op_mode == OPMODE_NORMAL_NIC_WITH_FLASH)) { - ret = at76_get_mib(udev, MIB_FW_VERSION, &fwv, sizeof(fwv)); - if (ret < 0 || (fwv.major | fwv.minor) == 0) - need_ext_fw = 1; - } else - /* No way to check firmware version, reload to be sure */ - need_ext_fw = 1; - - if (need_ext_fw) { - dev_printk(KERN_DEBUG, &interface->dev, - "downloading external firmware\n"); - - ret = at76_load_external_fw(udev, fwe); - if (ret) - goto error; - - /* Re-check firmware version */ - ret = at76_get_mib(udev, MIB_FW_VERSION, &fwv, sizeof(fwv)); - if (ret < 0) { - dev_err(&interface->dev, - "error %d getting firmware version\n", ret); - goto error; - } - } - - priv = at76_alloc_new_device(udev); - if (!priv) { - ret = -ENOMEM; - goto error; - } - - usb_set_intfdata(interface, priv); - - memcpy(&priv->fw_version, &fwv, sizeof(struct mib_fw_version)); - priv->board_type = board_type; - - ret = at76_init_new_device(priv, interface); - if (ret < 0) - at76_delete_device(priv); - - return ret; - -error: - usb_put_dev(udev); - return ret; -} - -static void at76_disconnect(struct usb_interface *interface) -{ - struct at76_priv *priv; - - priv = usb_get_intfdata(interface); - usb_set_intfdata(interface, NULL); - - /* Disconnect after loading internal firmware */ - if (!priv) - return; - - wiphy_info(priv->hw->wiphy, "disconnecting\n"); - at76_delete_device(priv); - dev_info(&interface->dev, "disconnected\n"); -} - -/* Structure for registering this driver with the USB subsystem */ -static struct usb_driver at76_driver = { - .name = DRIVER_NAME, - .probe = at76_probe, - .disconnect = at76_disconnect, - .id_table = dev_table, - .disable_hub_initiated_lpm = 1, -}; - -static int __init at76_mod_init(void) -{ - int result; - - printk(KERN_INFO DRIVER_DESC " " DRIVER_VERSION " loading\n"); - - mutex_init(&fw_mutex); - - /* register this driver with the USB subsystem */ - result = usb_register(&at76_driver); - if (result < 0) - printk(KERN_ERR DRIVER_NAME - ": usb_register failed (status %d)\n", result); - - led_trigger_register_simple("at76_usb-tx", &ledtrig_tx); - return result; -} - -static void __exit at76_mod_exit(void) -{ - int i; - - printk(KERN_INFO DRIVER_DESC " " DRIVER_VERSION " unloading\n"); - usb_deregister(&at76_driver); - for (i = 0; i < ARRAY_SIZE(firmwares); i++) - release_firmware(firmwares[i].fw); - led_trigger_unregister_simple(ledtrig_tx); -} - -module_param_named(debug, at76_debug, uint, 0600); -MODULE_PARM_DESC(debug, "Debugging level"); - -module_init(at76_mod_init); -module_exit(at76_mod_exit); - -MODULE_AUTHOR("Oliver Kurth "); -MODULE_AUTHOR("Joerg Albert "); -MODULE_AUTHOR("Alex "); -MODULE_AUTHOR("Nick Jones"); -MODULE_AUTHOR("Balint Seeber "); -MODULE_AUTHOR("Pavel Roskin "); -MODULE_AUTHOR("Guido Guenther "); -MODULE_AUTHOR("Kalle Valo "); -MODULE_AUTHOR("Sebastian Smolorz "); -MODULE_DESCRIPTION(DRIVER_DESC); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/at76c50x-usb.h b/drivers/net/wireless/at76c50x-usb.h deleted file mode 100644 index f14a65473fe8..000000000000 --- a/drivers/net/wireless/at76c50x-usb.h +++ /dev/null @@ -1,464 +0,0 @@ -/* - * Copyright (c) 2002,2003 Oliver Kurth - * (c) 2003,2004 Joerg Albert - * (c) 2007 Guido Guenther - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This driver was based on information from the Sourceforge driver - * released and maintained by Atmel: - * - * http://sourceforge.net/projects/atmelwlandriver/ - * - * Although the code was completely re-written, - * it would have been impossible without Atmel's decision to - * release an Open Source driver (unfortunately the firmware was - * kept binary only). Thanks for that decision to Atmel! - */ - -#ifndef _AT76_USB_H -#define _AT76_USB_H - -/* Board types */ -enum board_type { - BOARD_503_ISL3861 = 1, - BOARD_503_ISL3863 = 2, - BOARD_503 = 3, - BOARD_503_ACC = 4, - BOARD_505 = 5, - BOARD_505_2958 = 6, - BOARD_505A = 7, - BOARD_505AMX = 8 -}; - -#define CMD_STATUS_IDLE 0x00 -#define CMD_STATUS_COMPLETE 0x01 -#define CMD_STATUS_UNKNOWN 0x02 -#define CMD_STATUS_INVALID_PARAMETER 0x03 -#define CMD_STATUS_FUNCTION_NOT_SUPPORTED 0x04 -#define CMD_STATUS_TIME_OUT 0x07 -#define CMD_STATUS_IN_PROGRESS 0x08 -#define CMD_STATUS_HOST_FAILURE 0xff -#define CMD_STATUS_SCAN_FAILED 0xf0 - -/* answers to get op mode */ -#define OPMODE_NONE 0x00 -#define OPMODE_NORMAL_NIC_WITH_FLASH 0x01 -#define OPMODE_HW_CONFIG_MODE 0x02 -#define OPMODE_DFU_MODE_WITH_FLASH 0x03 -#define OPMODE_NORMAL_NIC_WITHOUT_FLASH 0x04 - -#define CMD_SET_MIB 0x01 -#define CMD_GET_MIB 0x02 -#define CMD_SCAN 0x03 -#define CMD_JOIN 0x04 -#define CMD_START_IBSS 0x05 -#define CMD_RADIO_ON 0x06 -#define CMD_RADIO_OFF 0x07 -#define CMD_STARTUP 0x0B - -#define MIB_LOCAL 0x01 -#define MIB_MAC_ADDR 0x02 -#define MIB_MAC 0x03 -#define MIB_MAC_MGMT 0x05 -#define MIB_MAC_WEP 0x06 -#define MIB_PHY 0x07 -#define MIB_FW_VERSION 0x08 -#define MIB_MDOMAIN 0x09 - -#define ADHOC_MODE 1 -#define INFRASTRUCTURE_MODE 2 - -/* values for struct mib_local, field preamble_type */ -#define PREAMBLE_TYPE_LONG 0 -#define PREAMBLE_TYPE_SHORT 1 -#define PREAMBLE_TYPE_AUTO 2 - -/* values for tx_rate */ -#define TX_RATE_1MBIT 0 -#define TX_RATE_2MBIT 1 -#define TX_RATE_5_5MBIT 2 -#define TX_RATE_11MBIT 3 -#define TX_RATE_AUTO 4 - -/* power management modes */ -#define AT76_PM_OFF 1 -#define AT76_PM_ON 2 -#define AT76_PM_SMART 3 - -struct hwcfg_r505 { - u8 cr39_values[14]; - u8 reserved1[14]; - u8 bb_cr[14]; - u8 pidvid[4]; - u8 mac_addr[ETH_ALEN]; - u8 regulatory_domain; - u8 reserved2[14]; - u8 cr15_values[14]; - u8 reserved3[3]; -} __packed; - -struct hwcfg_rfmd { - u8 cr20_values[14]; - u8 cr21_values[14]; - u8 bb_cr[14]; - u8 pidvid[4]; - u8 mac_addr[ETH_ALEN]; - u8 regulatory_domain; - u8 low_power_values[14]; - u8 normal_power_values[14]; - u8 reserved1[3]; -} __packed; - -struct hwcfg_intersil { - u8 mac_addr[ETH_ALEN]; - u8 cr31_values[14]; - u8 cr58_values[14]; - u8 pidvid[4]; - u8 regulatory_domain; - u8 reserved[1]; -} __packed; - -union at76_hwcfg { - struct hwcfg_intersil i; - struct hwcfg_rfmd r3; - struct hwcfg_r505 r5; -}; - -#define WEP_SMALL_KEY_LEN (40 / 8) -#define WEP_LARGE_KEY_LEN (104 / 8) -#define WEP_KEYS (4) - -struct at76_card_config { - u8 exclude_unencrypted; - u8 promiscuous_mode; - u8 short_retry_limit; - u8 encryption_type; - __le16 rts_threshold; - __le16 fragmentation_threshold; /* 256..2346 */ - u8 basic_rate_set[4]; - u8 auto_rate_fallback; /* 0,1 */ - u8 channel; - u8 privacy_invoked; - u8 wep_default_key_id; /* 0..3 */ - u8 current_ssid[32]; - u8 wep_default_key_value[4][WEP_LARGE_KEY_LEN]; - u8 ssid_len; - u8 short_preamble; - __le16 beacon_period; -} __packed; - -struct at76_command { - u8 cmd; - u8 reserved; - __le16 size; - u8 data[0]; -} __packed; - -/* Length of Atmel-specific Rx header before 802.11 frame */ -#define AT76_RX_HDRLEN offsetof(struct at76_rx_buffer, packet) - -struct at76_rx_buffer { - __le16 wlength; - u8 rx_rate; - u8 newbss; - u8 fragmentation; - u8 rssi; - u8 link_quality; - u8 noise_level; - __le32 rx_time; - u8 packet[IEEE80211_MAX_FRAG_THRESHOLD]; -} __packed; - -/* Length of Atmel-specific Tx header before 802.11 frame */ -#define AT76_TX_HDRLEN offsetof(struct at76_tx_buffer, packet) - -struct at76_tx_buffer { - __le16 wlength; - u8 tx_rate; - u8 padding; - u8 reserved[4]; - u8 packet[IEEE80211_MAX_FRAG_THRESHOLD]; -} __packed; - -/* defines for scan_type below */ -#define SCAN_TYPE_ACTIVE 0 -#define SCAN_TYPE_PASSIVE 1 - -struct at76_req_scan { - u8 bssid[ETH_ALEN]; - u8 essid[32]; - u8 scan_type; - u8 channel; - __le16 probe_delay; - __le16 min_channel_time; - __le16 max_channel_time; - u8 essid_size; - u8 international_scan; -} __packed; - -struct at76_req_ibss { - u8 bssid[ETH_ALEN]; - u8 essid[32]; - u8 bss_type; - u8 channel; - u8 essid_size; - u8 reserved[3]; -} __packed; - -struct at76_req_join { - u8 bssid[ETH_ALEN]; - u8 essid[32]; - u8 bss_type; - u8 channel; - __le16 timeout; - u8 essid_size; - u8 reserved; -} __packed; - -struct set_mib_buffer { - u8 type; - u8 size; - u8 index; - u8 reserved; - union { - u8 byte; - __le16 word; - u8 addr[ETH_ALEN]; - } data; -} __packed; - -struct mib_local { - u16 reserved0; - u8 beacon_enable; - u8 txautorate_fallback; - u8 reserved1; - u8 ssid_size; - u8 promiscuous_mode; - u16 reserved2; - u8 preamble_type; - u16 reserved3; -} __packed; - -struct mib_mac_addr { - u8 mac_addr[ETH_ALEN]; - u8 res[2]; /* ??? */ - u8 group_addr[4][ETH_ALEN]; - u8 group_addr_status[4]; -} __packed; - -struct mib_mac { - __le32 max_tx_msdu_lifetime; - __le32 max_rx_lifetime; - __le16 frag_threshold; - __le16 rts_threshold; - __le16 cwmin; - __le16 cwmax; - u8 short_retry_time; - u8 long_retry_time; - u8 scan_type; /* active or passive */ - u8 scan_channel; - __le16 probe_delay; /* delay before ProbeReq in active scan, RO */ - __le16 min_channel_time; - __le16 max_channel_time; - __le16 listen_interval; - u8 desired_ssid[32]; - u8 desired_bssid[ETH_ALEN]; - u8 desired_bsstype; /* ad-hoc or infrastructure */ - u8 reserved2; -} __packed; - -struct mib_mac_mgmt { - __le16 beacon_period; - __le16 CFP_max_duration; - __le16 medium_occupancy_limit; - __le16 station_id; /* assoc id */ - __le16 ATIM_window; - u8 CFP_mode; - u8 privacy_option_implemented; - u8 DTIM_period; - u8 CFP_period; - u8 current_bssid[ETH_ALEN]; - u8 current_essid[32]; - u8 current_bss_type; - u8 power_mgmt_mode; - /* rfmd and 505 */ - u8 ibss_change; - u8 res; - u8 multi_domain_capability_implemented; - u8 multi_domain_capability_enabled; - u8 country_string[IEEE80211_COUNTRY_STRING_LEN]; - u8 reserved[3]; -} __packed; - -struct mib_mac_wep { - u8 privacy_invoked; /* 0 disable encr., 1 enable encr */ - u8 wep_default_key_id; - u8 wep_key_mapping_len; - u8 exclude_unencrypted; - __le32 wep_icv_error_count; - __le32 wep_excluded_count; - u8 wep_default_keyvalue[WEP_KEYS][WEP_LARGE_KEY_LEN]; - u8 encryption_level; /* 1 for 40bit, 2 for 104bit encryption */ -} __packed; - -struct mib_phy { - __le32 ed_threshold; - - __le16 slot_time; - __le16 sifs_time; - __le16 preamble_length; - __le16 plcp_header_length; - __le16 mpdu_max_length; - __le16 cca_mode_supported; - - u8 operation_rate_set[4]; - u8 channel_id; - u8 current_cca_mode; - u8 phy_type; - u8 current_reg_domain; -} __packed; - -struct mib_fw_version { - u8 major; - u8 minor; - u8 patch; - u8 build; -} __packed; - -struct mib_mdomain { - u8 tx_powerlevel[14]; - u8 channel_list[14]; /* 0 for invalid channels */ -} __packed; - -struct at76_fw_header { - __le32 crc; /* CRC32 of the whole image */ - __le32 board_type; /* firmware compatibility code */ - u8 build; /* firmware build number */ - u8 patch; /* firmware patch level */ - u8 minor; /* firmware minor version */ - u8 major; /* firmware major version */ - __le32 str_offset; /* offset of the copyright string */ - __le32 int_fw_offset; /* internal firmware image offset */ - __le32 int_fw_len; /* internal firmware image length */ - __le32 ext_fw_offset; /* external firmware image offset */ - __le32 ext_fw_len; /* external firmware image length */ -} __packed; - -/* a description of a regulatory domain and the allowed channels */ -struct reg_domain { - u16 code; - char const *name; - u32 channel_map; /* if bit N is set, channel (N+1) is allowed */ -}; - -/* Data for one loaded firmware file */ -struct fwentry { - const char *const fwname; - const struct firmware *fw; - int extfw_size; - int intfw_size; - /* pointer to loaded firmware, no need to free */ - u8 *extfw; /* external firmware, extfw_size bytes long */ - u8 *intfw; /* internal firmware, intfw_size bytes long */ - enum board_type board_type; /* board type */ - struct mib_fw_version fw_version; - int loaded; /* Loaded and parsed successfully */ -}; - -struct at76_priv { - struct usb_device *udev; /* USB device pointer */ - - struct sk_buff *rx_skb; /* skbuff for receiving data */ - struct sk_buff *tx_skb; /* skbuff for transmitting data */ - void *bulk_out_buffer; /* buffer for sending data */ - - struct urb *tx_urb; /* URB for sending data */ - struct urb *rx_urb; /* URB for receiving data */ - - unsigned int tx_pipe; /* bulk out pipe */ - unsigned int rx_pipe; /* bulk in pipe */ - - struct mutex mtx; /* locks this structure */ - - /* work queues */ - struct work_struct work_set_promisc; - struct work_struct work_submit_rx; - struct work_struct work_join_bssid; - struct delayed_work dwork_hw_scan; - - struct tasklet_struct rx_tasklet; - - /* the WEP stuff */ - int wep_enabled; /* 1 if WEP is enabled */ - int wep_key_id; /* key id to be used */ - u8 wep_keys[WEP_KEYS][WEP_LARGE_KEY_LEN]; /* WEP keys */ - u8 wep_keys_len[WEP_KEYS]; /* length of WEP keys */ - - int channel; - int iw_mode; - u8 bssid[ETH_ALEN]; - u8 essid[IW_ESSID_MAX_SIZE]; - int essid_size; - int radio_on; - int promisc; - - int preamble_type; /* 0 - long, 1 - short, 2 - auto */ - int auth_mode; /* authentication type: 0 open, 1 shared key */ - int txrate; /* 0,1,2,3 = 1,2,5.5,11 Mbps, 4 is auto */ - int frag_threshold; /* threshold for fragmentation of tx packets */ - int rts_threshold; /* threshold for RTS mechanism */ - int short_retry_limit; - - int scan_min_time; /* scan min channel time */ - int scan_max_time; /* scan max channel time */ - int scan_mode; /* SCAN_TYPE_ACTIVE, SCAN_TYPE_PASSIVE */ - int scan_need_any; /* if set, need to scan for any ESSID */ - - u16 assoc_id; /* current association ID, if associated */ - - u8 pm_mode; /* power management mode */ - u32 pm_period; /* power management period in microseconds */ - - struct reg_domain const *domain; /* reg domain description */ - - /* These fields contain HW config provided by the device (not all of - * these fields are used by all board types) */ - u8 mac_addr[ETH_ALEN]; - u8 regulatory_domain; - - struct at76_card_config card_config; - - enum board_type board_type; - struct mib_fw_version fw_version; - - unsigned int device_unplugged:1; - unsigned int netdev_registered:1; - struct set_mib_buffer mib_buf; /* global buffer for set_mib calls */ - - int beacon_period; /* period of mgmt beacons, Kus */ - - struct ieee80211_hw *hw; - int mac80211_registered; -}; - -#define AT76_SUPPORTED_FILTERS FIF_PROMISC_IN_BSS - -#define SCAN_POLL_INTERVAL (HZ / 4) - -#define CMD_COMPLETION_TIMEOUT (5 * HZ) - -#define DEF_RTS_THRESHOLD 1536 -#define DEF_FRAG_THRESHOLD 1536 -#define DEF_SHORT_RETRY_LIMIT 8 -#define DEF_CHANNEL 10 -#define DEF_SCAN_MIN_TIME 10 -#define DEF_SCAN_MAX_TIME 120 - -/* the max padding size for tx in bytes (see calc_padding) */ -#define MAX_PADDING_SIZE 53 - -#endif /* _AT76_USB_H */ diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig deleted file mode 100644 index 2c02b4e84094..000000000000 --- a/drivers/net/wireless/ath/Kconfig +++ /dev/null @@ -1,35 +0,0 @@ -config ATH_COMMON - tristate - -menuconfig ATH_CARDS - tristate "Atheros Wireless Cards" - depends on CFG80211 && (!UML || BROKEN) - ---help--- - This will enable the support for the Atheros wireless drivers. - ath5k, ath9k, ath9k_htc and ar9170 drivers share some common code, this option - enables the common ath.ko module which shares common helpers. - - For more information and documentation on this module you can visit: - - http://wireless.kernel.org/en/users/Drivers/ath - - For information on all Atheros wireless drivers visit: - - http://wireless.kernel.org/en/users/Drivers/Atheros - -if ATH_CARDS - -config ATH_DEBUG - bool "Atheros wireless debugging" - ---help--- - Say Y, if you want to debug atheros wireless drivers. - Right now only ath9k makes use of this. - -source "drivers/net/wireless/ath/ath5k/Kconfig" -source "drivers/net/wireless/ath/ath9k/Kconfig" -source "drivers/net/wireless/ath/carl9170/Kconfig" -source "drivers/net/wireless/ath/ath6kl/Kconfig" -source "drivers/net/wireless/ath/ar5523/Kconfig" -source "drivers/net/wireless/ath/wil6210/Kconfig" - -endif diff --git a/drivers/net/wireless/ath/Makefile b/drivers/net/wireless/ath/Makefile deleted file mode 100644 index 97b964ded2be..000000000000 --- a/drivers/net/wireless/ath/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -obj-$(CONFIG_ATH5K) += ath5k/ -obj-$(CONFIG_ATH9K_HW) += ath9k/ -obj-$(CONFIG_CARL9170) += carl9170/ -obj-$(CONFIG_ATH6KL) += ath6kl/ -obj-$(CONFIG_AR5523) += ar5523/ -obj-$(CONFIG_WIL6210) += wil6210/ - -obj-$(CONFIG_ATH_COMMON) += ath.o - -ath-objs := main.o \ - regd.o \ - hw.o \ - key.o - -ath-$(CONFIG_ATH_DEBUG) += debug.o -ccflags-y += -D__CHECK_ENDIAN__ diff --git a/drivers/net/wireless/ath/ar5523/Kconfig b/drivers/net/wireless/ath/ar5523/Kconfig deleted file mode 100644 index 0d320cc7769b..000000000000 --- a/drivers/net/wireless/ath/ar5523/Kconfig +++ /dev/null @@ -1,8 +0,0 @@ -config AR5523 - tristate "Atheros AR5523 wireless driver support" - depends on MAC80211 && USB - select ATH_COMMON - select FW_LOADER - ---help--- - This module add support for AR5523 based USB dongles such as D-Link - DWL-G132, Netgear WPN111 and many more. diff --git a/drivers/net/wireless/ath/ar5523/Makefile b/drivers/net/wireless/ath/ar5523/Makefile deleted file mode 100644 index ebf7f3bf0a33..000000000000 --- a/drivers/net/wireless/ath/ar5523/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-$(CONFIG_AR5523) := ar5523.o diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c deleted file mode 100644 index 17d7fece35d2..000000000000 --- a/drivers/net/wireless/ath/ar5523/ar5523.c +++ /dev/null @@ -1,1798 +0,0 @@ -/* - * Copyright (c) 2006 Damien Bergamini - * Copyright (c) 2006 Sam Leffler, Errno Consulting - * Copyright (c) 2007 Christoph Hellwig - * Copyright (c) 2008-2009 Weongyo Jeong - * Copyright (c) 2012 Pontus Fuchs - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * This driver is based on the uath driver written by Damien Bergamini for - * OpenBSD, who did black-box analysis of the Windows binary driver to find - * out how the hardware works. It contains a lot magic numbers because of - * that and only has minimal functionality. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ar5523.h" -#include "ar5523_hw.h" - -/* - * Various supported device vendors/products. - * UB51: AR5005UG 802.11b/g, UB52: AR5005UX 802.11a/b/g - */ - -static int ar5523_submit_rx_cmd(struct ar5523 *ar); -static void ar5523_data_tx_pkt_put(struct ar5523 *ar); - -static void ar5523_read_reply(struct ar5523 *ar, struct ar5523_cmd_hdr *hdr, - struct ar5523_tx_cmd *cmd) -{ - int dlen, olen; - __be32 *rp; - - dlen = be32_to_cpu(hdr->len) - sizeof(*hdr); - - if (dlen < 0) { - WARN_ON(1); - goto out; - } - - ar5523_dbg(ar, "Code = %d len = %d\n", be32_to_cpu(hdr->code) & 0xff, - dlen); - - rp = (__be32 *)(hdr + 1); - if (dlen >= sizeof(u32)) { - olen = be32_to_cpu(rp[0]); - dlen -= sizeof(u32); - if (olen == 0) { - /* convention is 0 =>'s one word */ - olen = sizeof(u32); - } - } else - olen = 0; - - if (cmd->odata) { - if (cmd->olen < olen) { - ar5523_err(ar, "olen to small %d < %d\n", - cmd->olen, olen); - cmd->olen = 0; - cmd->res = -EOVERFLOW; - } else { - cmd->olen = olen; - memcpy(cmd->odata, &rp[1], olen); - cmd->res = 0; - } - } - -out: - complete(&cmd->done); -} - -static void ar5523_cmd_rx_cb(struct urb *urb) -{ - struct ar5523 *ar = urb->context; - struct ar5523_tx_cmd *cmd = &ar->tx_cmd; - struct ar5523_cmd_hdr *hdr = ar->rx_cmd_buf; - int dlen; - u32 code, hdrlen; - - if (urb->status) { - if (urb->status != -ESHUTDOWN) - ar5523_err(ar, "RX USB error %d.\n", urb->status); - goto skip; - } - - if (urb->actual_length < sizeof(struct ar5523_cmd_hdr)) { - ar5523_err(ar, "RX USB to short.\n"); - goto skip; - } - - ar5523_dbg(ar, "%s code %02x priv %d\n", __func__, - be32_to_cpu(hdr->code) & 0xff, hdr->priv); - - code = be32_to_cpu(hdr->code); - hdrlen = be32_to_cpu(hdr->len); - - switch (code & 0xff) { - default: - /* reply to a read command */ - if (hdr->priv != AR5523_CMD_ID) { - ar5523_err(ar, "Unexpected command id: %02x\n", - code & 0xff); - goto skip; - } - ar5523_read_reply(ar, hdr, cmd); - break; - - case WDCMSG_DEVICE_AVAIL: - ar5523_dbg(ar, "WDCMSG_DEVICE_AVAIL\n"); - cmd->res = 0; - cmd->olen = 0; - complete(&cmd->done); - break; - - case WDCMSG_SEND_COMPLETE: - ar5523_dbg(ar, "WDCMSG_SEND_COMPLETE: %d pending\n", - atomic_read(&ar->tx_nr_pending)); - if (!test_bit(AR5523_HW_UP, &ar->flags)) - ar5523_dbg(ar, "Unexpected WDCMSG_SEND_COMPLETE\n"); - else { - mod_timer(&ar->tx_wd_timer, - jiffies + AR5523_TX_WD_TIMEOUT); - ar5523_data_tx_pkt_put(ar); - - } - break; - - case WDCMSG_TARGET_START: - /* This command returns a bogus id so it needs special - handling */ - dlen = hdrlen - sizeof(*hdr); - if (dlen != (int)sizeof(u32)) { - ar5523_err(ar, "Invalid reply to WDCMSG_TARGET_START"); - return; - } - memcpy(cmd->odata, hdr + 1, sizeof(u32)); - cmd->olen = sizeof(u32); - cmd->res = 0; - complete(&cmd->done); - break; - - case WDCMSG_STATS_UPDATE: - ar5523_dbg(ar, "WDCMSG_STATS_UPDATE\n"); - break; - } - -skip: - ar5523_submit_rx_cmd(ar); -} - -static int ar5523_alloc_rx_cmd(struct ar5523 *ar) -{ - ar->rx_cmd_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!ar->rx_cmd_urb) - return -ENOMEM; - - ar->rx_cmd_buf = usb_alloc_coherent(ar->dev, AR5523_MAX_RXCMDSZ, - GFP_KERNEL, - &ar->rx_cmd_urb->transfer_dma); - if (!ar->rx_cmd_buf) { - usb_free_urb(ar->rx_cmd_urb); - return -ENOMEM; - } - return 0; -} - -static void ar5523_cancel_rx_cmd(struct ar5523 *ar) -{ - usb_kill_urb(ar->rx_cmd_urb); -} - -static void ar5523_free_rx_cmd(struct ar5523 *ar) -{ - usb_free_coherent(ar->dev, AR5523_MAX_RXCMDSZ, - ar->rx_cmd_buf, ar->rx_cmd_urb->transfer_dma); - usb_free_urb(ar->rx_cmd_urb); -} - -static int ar5523_submit_rx_cmd(struct ar5523 *ar) -{ - int error; - - usb_fill_bulk_urb(ar->rx_cmd_urb, ar->dev, - ar5523_cmd_rx_pipe(ar->dev), ar->rx_cmd_buf, - AR5523_MAX_RXCMDSZ, ar5523_cmd_rx_cb, ar); - ar->rx_cmd_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - - error = usb_submit_urb(ar->rx_cmd_urb, GFP_ATOMIC); - if (error) { - if (error != -ENODEV) - ar5523_err(ar, "error %d when submitting rx urb\n", - error); - return error; - } - return 0; -} - -/* - * Command submitted cb - */ -static void ar5523_cmd_tx_cb(struct urb *urb) -{ - struct ar5523_tx_cmd *cmd = urb->context; - struct ar5523 *ar = cmd->ar; - - if (urb->status) { - ar5523_err(ar, "Failed to TX command. Status = %d\n", - urb->status); - cmd->res = urb->status; - complete(&cmd->done); - return; - } - - if (!(cmd->flags & AR5523_CMD_FLAG_READ)) { - cmd->res = 0; - complete(&cmd->done); - } -} - -static int ar5523_cmd(struct ar5523 *ar, u32 code, const void *idata, - int ilen, void *odata, int olen, int flags) -{ - struct ar5523_cmd_hdr *hdr; - struct ar5523_tx_cmd *cmd = &ar->tx_cmd; - int xferlen, error; - - /* always bulk-out a multiple of 4 bytes */ - xferlen = (sizeof(struct ar5523_cmd_hdr) + ilen + 3) & ~3; - - hdr = (struct ar5523_cmd_hdr *)cmd->buf_tx; - memset(hdr, 0, sizeof(struct ar5523_cmd_hdr)); - hdr->len = cpu_to_be32(xferlen); - hdr->code = cpu_to_be32(code); - hdr->priv = AR5523_CMD_ID; - - if (flags & AR5523_CMD_FLAG_MAGIC) - hdr->magic = cpu_to_be32(1 << 24); - memcpy(hdr + 1, idata, ilen); - - cmd->odata = odata; - cmd->olen = olen; - cmd->flags = flags; - - ar5523_dbg(ar, "do cmd %02x\n", code); - - usb_fill_bulk_urb(cmd->urb_tx, ar->dev, ar5523_cmd_tx_pipe(ar->dev), - cmd->buf_tx, xferlen, ar5523_cmd_tx_cb, cmd); - cmd->urb_tx->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - - error = usb_submit_urb(cmd->urb_tx, GFP_KERNEL); - if (error) { - ar5523_err(ar, "could not send command 0x%x, error=%d\n", - code, error); - return error; - } - - if (!wait_for_completion_timeout(&cmd->done, 2 * HZ)) { - cmd->odata = NULL; - ar5523_err(ar, "timeout waiting for command %02x reply\n", - code); - cmd->res = -ETIMEDOUT; - } - return cmd->res; -} - -static int ar5523_cmd_write(struct ar5523 *ar, u32 code, const void *data, - int len, int flags) -{ - flags &= ~AR5523_CMD_FLAG_READ; - return ar5523_cmd(ar, code, data, len, NULL, 0, flags); -} - -static int ar5523_cmd_read(struct ar5523 *ar, u32 code, const void *idata, - int ilen, void *odata, int olen, int flags) -{ - flags |= AR5523_CMD_FLAG_READ; - return ar5523_cmd(ar, code, idata, ilen, odata, olen, flags); -} - -static int ar5523_config(struct ar5523 *ar, u32 reg, u32 val) -{ - struct ar5523_write_mac write; - int error; - - write.reg = cpu_to_be32(reg); - write.len = cpu_to_be32(0); /* 0 = single write */ - *(__be32 *)write.data = cpu_to_be32(val); - - error = ar5523_cmd_write(ar, WDCMSG_TARGET_SET_CONFIG, &write, - 3 * sizeof(u32), 0); - if (error != 0) - ar5523_err(ar, "could not write register 0x%02x\n", reg); - return error; -} - -static int ar5523_config_multi(struct ar5523 *ar, u32 reg, const void *data, - int len) -{ - struct ar5523_write_mac write; - int error; - - write.reg = cpu_to_be32(reg); - write.len = cpu_to_be32(len); - memcpy(write.data, data, len); - - /* properly handle the case where len is zero (reset) */ - error = ar5523_cmd_write(ar, WDCMSG_TARGET_SET_CONFIG, &write, - (len == 0) ? sizeof(u32) : 2 * sizeof(u32) + len, 0); - if (error != 0) - ar5523_err(ar, "could not write %d bytes to register 0x%02x\n", - len, reg); - return error; -} - -static int ar5523_get_status(struct ar5523 *ar, u32 which, void *odata, - int olen) -{ - int error; - __be32 which_be; - - which_be = cpu_to_be32(which); - error = ar5523_cmd_read(ar, WDCMSG_TARGET_GET_STATUS, - &which_be, sizeof(which_be), odata, olen, AR5523_CMD_FLAG_MAGIC); - if (error != 0) - ar5523_err(ar, "could not read EEPROM offset 0x%02x\n", which); - return error; -} - -static int ar5523_get_capability(struct ar5523 *ar, u32 cap, u32 *val) -{ - int error; - __be32 cap_be, val_be; - - cap_be = cpu_to_be32(cap); - error = ar5523_cmd_read(ar, WDCMSG_TARGET_GET_CAPABILITY, &cap_be, - sizeof(cap_be), &val_be, sizeof(__be32), - AR5523_CMD_FLAG_MAGIC); - if (error != 0) { - ar5523_err(ar, "could not read capability %u\n", cap); - return error; - } - *val = be32_to_cpu(val_be); - return error; -} - -static int ar5523_get_devcap(struct ar5523 *ar) -{ -#define GETCAP(x) do { \ - error = ar5523_get_capability(ar, x, &cap); \ - if (error != 0) \ - return error; \ - ar5523_info(ar, "Cap: " \ - "%s=0x%08x\n", #x, cap); \ -} while (0) - int error; - u32 cap; - - /* collect device capabilities */ - GETCAP(CAP_TARGET_VERSION); - GETCAP(CAP_TARGET_REVISION); - GETCAP(CAP_MAC_VERSION); - GETCAP(CAP_MAC_REVISION); - GETCAP(CAP_PHY_REVISION); - GETCAP(CAP_ANALOG_5GHz_REVISION); - GETCAP(CAP_ANALOG_2GHz_REVISION); - - GETCAP(CAP_REG_DOMAIN); - GETCAP(CAP_REG_CAP_BITS); - GETCAP(CAP_WIRELESS_MODES); - GETCAP(CAP_CHAN_SPREAD_SUPPORT); - GETCAP(CAP_COMPRESS_SUPPORT); - GETCAP(CAP_BURST_SUPPORT); - GETCAP(CAP_FAST_FRAMES_SUPPORT); - GETCAP(CAP_CHAP_TUNING_SUPPORT); - GETCAP(CAP_TURBOG_SUPPORT); - GETCAP(CAP_TURBO_PRIME_SUPPORT); - GETCAP(CAP_DEVICE_TYPE); - GETCAP(CAP_WME_SUPPORT); - GETCAP(CAP_TOTAL_QUEUES); - GETCAP(CAP_CONNECTION_ID_MAX); - - GETCAP(CAP_LOW_5GHZ_CHAN); - GETCAP(CAP_HIGH_5GHZ_CHAN); - GETCAP(CAP_LOW_2GHZ_CHAN); - GETCAP(CAP_HIGH_2GHZ_CHAN); - GETCAP(CAP_TWICE_ANTENNAGAIN_5G); - GETCAP(CAP_TWICE_ANTENNAGAIN_2G); - - GETCAP(CAP_CIPHER_AES_CCM); - GETCAP(CAP_CIPHER_TKIP); - GETCAP(CAP_MIC_TKIP); - return 0; -} - -static int ar5523_set_ledsteady(struct ar5523 *ar, int lednum, int ledmode) -{ - struct ar5523_cmd_ledsteady led; - - led.lednum = cpu_to_be32(lednum); - led.ledmode = cpu_to_be32(ledmode); - - ar5523_dbg(ar, "set %s led %s (steady)\n", - (lednum == UATH_LED_LINK) ? "link" : "activity", - ledmode ? "on" : "off"); - return ar5523_cmd_write(ar, WDCMSG_SET_LED_STEADY, &led, sizeof(led), - 0); -} - -static int ar5523_set_rxfilter(struct ar5523 *ar, u32 bits, u32 op) -{ - struct ar5523_cmd_rx_filter rxfilter; - - rxfilter.bits = cpu_to_be32(bits); - rxfilter.op = cpu_to_be32(op); - - ar5523_dbg(ar, "setting Rx filter=0x%x flags=0x%x\n", bits, op); - return ar5523_cmd_write(ar, WDCMSG_RX_FILTER, &rxfilter, - sizeof(rxfilter), 0); -} - -static int ar5523_reset_tx_queues(struct ar5523 *ar) -{ - __be32 qid = cpu_to_be32(0); - - ar5523_dbg(ar, "resetting Tx queue\n"); - return ar5523_cmd_write(ar, WDCMSG_RELEASE_TX_QUEUE, - &qid, sizeof(qid), 0); -} - -static int ar5523_set_chan(struct ar5523 *ar) -{ - struct ieee80211_conf *conf = &ar->hw->conf; - - struct ar5523_cmd_reset reset; - - memset(&reset, 0, sizeof(reset)); - reset.flags |= cpu_to_be32(UATH_CHAN_2GHZ); - reset.flags |= cpu_to_be32(UATH_CHAN_OFDM); - reset.freq = cpu_to_be32(conf->chandef.chan->center_freq); - reset.maxrdpower = cpu_to_be32(50); /* XXX */ - reset.channelchange = cpu_to_be32(1); - reset.keeprccontent = cpu_to_be32(0); - - ar5523_dbg(ar, "set chan flags 0x%x freq %d\n", - be32_to_cpu(reset.flags), - conf->chandef.chan->center_freq); - return ar5523_cmd_write(ar, WDCMSG_RESET, &reset, sizeof(reset), 0); -} - -static int ar5523_queue_init(struct ar5523 *ar) -{ - struct ar5523_cmd_txq_setup qinfo; - - ar5523_dbg(ar, "setting up Tx queue\n"); - qinfo.qid = cpu_to_be32(0); - qinfo.len = cpu_to_be32(sizeof(qinfo.attr)); - qinfo.attr.priority = cpu_to_be32(0); /* XXX */ - qinfo.attr.aifs = cpu_to_be32(3); - qinfo.attr.logcwmin = cpu_to_be32(4); - qinfo.attr.logcwmax = cpu_to_be32(10); - qinfo.attr.bursttime = cpu_to_be32(0); - qinfo.attr.mode = cpu_to_be32(0); - qinfo.attr.qflags = cpu_to_be32(1); /* XXX? */ - return ar5523_cmd_write(ar, WDCMSG_SETUP_TX_QUEUE, &qinfo, - sizeof(qinfo), 0); -} - -static int ar5523_switch_chan(struct ar5523 *ar) -{ - int error; - - error = ar5523_set_chan(ar); - if (error) { - ar5523_err(ar, "could not set chan, error %d\n", error); - goto out_err; - } - - /* reset Tx rings */ - error = ar5523_reset_tx_queues(ar); - if (error) { - ar5523_err(ar, "could not reset Tx queues, error %d\n", - error); - goto out_err; - } - /* set Tx rings WME properties */ - error = ar5523_queue_init(ar); - if (error) - ar5523_err(ar, "could not init wme, error %d\n", error); - -out_err: - return error; -} - -static void ar5523_rx_data_put(struct ar5523 *ar, - struct ar5523_rx_data *data) -{ - unsigned long flags; - spin_lock_irqsave(&ar->rx_data_list_lock, flags); - list_move(&data->list, &ar->rx_data_free); - spin_unlock_irqrestore(&ar->rx_data_list_lock, flags); -} - -static void ar5523_data_rx_cb(struct urb *urb) -{ - struct ar5523_rx_data *data = urb->context; - struct ar5523 *ar = data->ar; - struct ar5523_rx_desc *desc; - struct ar5523_chunk *chunk; - struct ieee80211_hw *hw = ar->hw; - struct ieee80211_rx_status *rx_status; - u32 rxlen; - int usblen = urb->actual_length; - int hdrlen, pad; - - ar5523_dbg(ar, "%s\n", __func__); - /* sync/async unlink faults aren't errors */ - if (urb->status) { - if (urb->status != -ESHUTDOWN) - ar5523_err(ar, "%s: USB err: %d\n", __func__, - urb->status); - goto skip; - } - - if (usblen < AR5523_MIN_RXBUFSZ) { - ar5523_err(ar, "RX: wrong xfer size (usblen=%d)\n", usblen); - goto skip; - } - - chunk = (struct ar5523_chunk *) data->skb->data; - - if (((chunk->flags & UATH_CFLAGS_FINAL) == 0) || - chunk->seqnum != 0) { - ar5523_dbg(ar, "RX: No final flag. s: %d f: %02x l: %d\n", - chunk->seqnum, chunk->flags, - be16_to_cpu(chunk->length)); - goto skip; - } - - /* Rx descriptor is located at the end, 32-bit aligned */ - desc = (struct ar5523_rx_desc *) - (data->skb->data + usblen - sizeof(struct ar5523_rx_desc)); - - rxlen = be32_to_cpu(desc->len); - if (rxlen > ar->rxbufsz) { - ar5523_dbg(ar, "RX: Bad descriptor (len=%d)\n", - be32_to_cpu(desc->len)); - goto skip; - } - - if (!rxlen) { - ar5523_dbg(ar, "RX: rxlen is 0\n"); - goto skip; - } - - if (be32_to_cpu(desc->status) != 0) { - ar5523_dbg(ar, "Bad RX status (0x%x len = %d). Skip\n", - be32_to_cpu(desc->status), be32_to_cpu(desc->len)); - goto skip; - } - - skb_reserve(data->skb, sizeof(*chunk)); - skb_put(data->skb, rxlen - sizeof(struct ar5523_rx_desc)); - - hdrlen = ieee80211_get_hdrlen_from_skb(data->skb); - if (!IS_ALIGNED(hdrlen, 4)) { - ar5523_dbg(ar, "eek, alignment workaround activated\n"); - pad = ALIGN(hdrlen, 4) - hdrlen; - memmove(data->skb->data + pad, data->skb->data, hdrlen); - skb_pull(data->skb, pad); - skb_put(data->skb, pad); - } - - rx_status = IEEE80211_SKB_RXCB(data->skb); - memset(rx_status, 0, sizeof(*rx_status)); - rx_status->freq = be32_to_cpu(desc->channel); - rx_status->band = hw->conf.chandef.chan->band; - rx_status->signal = -95 + be32_to_cpu(desc->rssi); - - ieee80211_rx_irqsafe(hw, data->skb); - data->skb = NULL; - -skip: - if (data->skb) { - dev_kfree_skb_irq(data->skb); - data->skb = NULL; - } - - ar5523_rx_data_put(ar, data); - if (atomic_inc_return(&ar->rx_data_free_cnt) >= - AR5523_RX_DATA_REFILL_COUNT && - test_bit(AR5523_HW_UP, &ar->flags)) - queue_work(ar->wq, &ar->rx_refill_work); -} - -static void ar5523_rx_refill_work(struct work_struct *work) -{ - struct ar5523 *ar = container_of(work, struct ar5523, rx_refill_work); - struct ar5523_rx_data *data; - unsigned long flags; - int error; - - ar5523_dbg(ar, "%s\n", __func__); - do { - spin_lock_irqsave(&ar->rx_data_list_lock, flags); - - if (!list_empty(&ar->rx_data_free)) - data = (struct ar5523_rx_data *) ar->rx_data_free.next; - else - data = NULL; - spin_unlock_irqrestore(&ar->rx_data_list_lock, flags); - - if (!data) - goto done; - - data->skb = alloc_skb(ar->rxbufsz, GFP_KERNEL); - if (!data->skb) { - ar5523_err(ar, "could not allocate rx skbuff\n"); - return; - } - - usb_fill_bulk_urb(data->urb, ar->dev, - ar5523_data_rx_pipe(ar->dev), data->skb->data, - ar->rxbufsz, ar5523_data_rx_cb, data); - - spin_lock_irqsave(&ar->rx_data_list_lock, flags); - list_move(&data->list, &ar->rx_data_used); - spin_unlock_irqrestore(&ar->rx_data_list_lock, flags); - atomic_dec(&ar->rx_data_free_cnt); - - error = usb_submit_urb(data->urb, GFP_KERNEL); - if (error) { - kfree_skb(data->skb); - if (error != -ENODEV) - ar5523_err(ar, "Err sending rx data urb %d\n", - error); - ar5523_rx_data_put(ar, data); - atomic_inc(&ar->rx_data_free_cnt); - return; - } - - } while (true); -done: - return; -} - -static void ar5523_cancel_rx_bufs(struct ar5523 *ar) -{ - struct ar5523_rx_data *data; - unsigned long flags; - - do { - spin_lock_irqsave(&ar->rx_data_list_lock, flags); - if (!list_empty(&ar->rx_data_used)) - data = (struct ar5523_rx_data *) ar->rx_data_used.next; - else - data = NULL; - spin_unlock_irqrestore(&ar->rx_data_list_lock, flags); - - if (!data) - break; - - usb_kill_urb(data->urb); - list_move(&data->list, &ar->rx_data_free); - atomic_inc(&ar->rx_data_free_cnt); - } while (data); -} - -static void ar5523_free_rx_bufs(struct ar5523 *ar) -{ - struct ar5523_rx_data *data; - - ar5523_cancel_rx_bufs(ar); - while (!list_empty(&ar->rx_data_free)) { - data = (struct ar5523_rx_data *) ar->rx_data_free.next; - list_del(&data->list); - usb_free_urb(data->urb); - } -} - -static int ar5523_alloc_rx_bufs(struct ar5523 *ar) -{ - int i; - - for (i = 0; i < AR5523_RX_DATA_COUNT; i++) { - struct ar5523_rx_data *data = &ar->rx_data[i]; - - data->ar = ar; - data->urb = usb_alloc_urb(0, GFP_KERNEL); - if (!data->urb) { - ar5523_err(ar, "could not allocate rx data urb\n"); - goto err; - } - list_add_tail(&data->list, &ar->rx_data_free); - atomic_inc(&ar->rx_data_free_cnt); - } - return 0; - -err: - ar5523_free_rx_bufs(ar); - return -ENOMEM; -} - -static void ar5523_data_tx_pkt_put(struct ar5523 *ar) -{ - atomic_dec(&ar->tx_nr_total); - if (!atomic_dec_return(&ar->tx_nr_pending)) { - del_timer(&ar->tx_wd_timer); - wake_up(&ar->tx_flush_waitq); - } - - if (atomic_read(&ar->tx_nr_total) < AR5523_TX_DATA_RESTART_COUNT) { - ar5523_dbg(ar, "restart tx queue\n"); - ieee80211_wake_queues(ar->hw); - } -} - -static void ar5523_data_tx_cb(struct urb *urb) -{ - struct sk_buff *skb = urb->context; - struct ieee80211_tx_info *txi = IEEE80211_SKB_CB(skb); - struct ar5523_tx_data *data = (struct ar5523_tx_data *) - txi->driver_data; - struct ar5523 *ar = data->ar; - unsigned long flags; - - ar5523_dbg(ar, "data tx urb completed: %d\n", urb->status); - - spin_lock_irqsave(&ar->tx_data_list_lock, flags); - list_del(&data->list); - spin_unlock_irqrestore(&ar->tx_data_list_lock, flags); - - if (urb->status) { - ar5523_dbg(ar, "%s: urb status: %d\n", __func__, urb->status); - ar5523_data_tx_pkt_put(ar); - ieee80211_free_txskb(ar->hw, skb); - } else { - skb_pull(skb, sizeof(struct ar5523_tx_desc) + sizeof(__be32)); - ieee80211_tx_status_irqsafe(ar->hw, skb); - } - usb_free_urb(urb); -} - -static void ar5523_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct ieee80211_tx_info *txi = IEEE80211_SKB_CB(skb); - struct ar5523_tx_data *data = (struct ar5523_tx_data *) - txi->driver_data; - struct ar5523 *ar = hw->priv; - unsigned long flags; - - ar5523_dbg(ar, "tx called\n"); - if (atomic_inc_return(&ar->tx_nr_total) >= AR5523_TX_DATA_COUNT) { - ar5523_dbg(ar, "tx queue full\n"); - ar5523_dbg(ar, "stop queues (tot %d pend %d)\n", - atomic_read(&ar->tx_nr_total), - atomic_read(&ar->tx_nr_pending)); - ieee80211_stop_queues(hw); - } - - data->skb = skb; - - spin_lock_irqsave(&ar->tx_data_list_lock, flags); - list_add_tail(&data->list, &ar->tx_queue_pending); - spin_unlock_irqrestore(&ar->tx_data_list_lock, flags); - - ieee80211_queue_work(ar->hw, &ar->tx_work); -} - -static void ar5523_tx_work_locked(struct ar5523 *ar) -{ - struct ar5523_tx_data *data; - struct ar5523_tx_desc *desc; - struct ar5523_chunk *chunk; - struct ieee80211_tx_info *txi; - struct urb *urb; - struct sk_buff *skb; - int error = 0, paylen; - u32 txqid; - unsigned long flags; - - BUILD_BUG_ON(sizeof(struct ar5523_tx_data) > - IEEE80211_TX_INFO_DRIVER_DATA_SIZE); - - ar5523_dbg(ar, "%s\n", __func__); - do { - spin_lock_irqsave(&ar->tx_data_list_lock, flags); - if (!list_empty(&ar->tx_queue_pending)) { - data = (struct ar5523_tx_data *) - ar->tx_queue_pending.next; - list_del(&data->list); - } else - data = NULL; - spin_unlock_irqrestore(&ar->tx_data_list_lock, flags); - - if (!data) - break; - - skb = data->skb; - txqid = 0; - txi = IEEE80211_SKB_CB(skb); - paylen = skb->len; - urb = usb_alloc_urb(0, GFP_KERNEL); - if (!urb) { - ar5523_err(ar, "Failed to allocate TX urb\n"); - ieee80211_free_txskb(ar->hw, skb); - continue; - } - - data->ar = ar; - data->urb = urb; - - desc = (struct ar5523_tx_desc *)skb_push(skb, sizeof(*desc)); - chunk = (struct ar5523_chunk *)skb_push(skb, sizeof(*chunk)); - - chunk->seqnum = 0; - chunk->flags = UATH_CFLAGS_FINAL; - chunk->length = cpu_to_be16(skb->len); - - desc->msglen = cpu_to_be32(skb->len); - desc->msgid = AR5523_DATA_ID; - desc->buflen = cpu_to_be32(paylen); - desc->type = cpu_to_be32(WDCMSG_SEND); - desc->flags = cpu_to_be32(UATH_TX_NOTIFY); - - if (test_bit(AR5523_CONNECTED, &ar->flags)) - desc->connid = cpu_to_be32(AR5523_ID_BSS); - else - desc->connid = cpu_to_be32(AR5523_ID_BROADCAST); - - if (txi->flags & IEEE80211_TX_CTL_USE_MINRATE) - txqid |= UATH_TXQID_MINRATE; - - desc->txqid = cpu_to_be32(txqid); - - urb->transfer_flags = URB_ZERO_PACKET; - usb_fill_bulk_urb(urb, ar->dev, ar5523_data_tx_pipe(ar->dev), - skb->data, skb->len, ar5523_data_tx_cb, skb); - - spin_lock_irqsave(&ar->tx_data_list_lock, flags); - list_add_tail(&data->list, &ar->tx_queue_submitted); - spin_unlock_irqrestore(&ar->tx_data_list_lock, flags); - mod_timer(&ar->tx_wd_timer, jiffies + AR5523_TX_WD_TIMEOUT); - atomic_inc(&ar->tx_nr_pending); - - ar5523_dbg(ar, "TX Frame (%d pending)\n", - atomic_read(&ar->tx_nr_pending)); - error = usb_submit_urb(urb, GFP_KERNEL); - if (error) { - ar5523_err(ar, "error %d when submitting tx urb\n", - error); - spin_lock_irqsave(&ar->tx_data_list_lock, flags); - list_del(&data->list); - spin_unlock_irqrestore(&ar->tx_data_list_lock, flags); - atomic_dec(&ar->tx_nr_pending); - ar5523_data_tx_pkt_put(ar); - usb_free_urb(urb); - ieee80211_free_txskb(ar->hw, skb); - } - } while (true); -} - -static void ar5523_tx_work(struct work_struct *work) -{ - struct ar5523 *ar = container_of(work, struct ar5523, tx_work); - - ar5523_dbg(ar, "%s\n", __func__); - mutex_lock(&ar->mutex); - ar5523_tx_work_locked(ar); - mutex_unlock(&ar->mutex); -} - -static void ar5523_tx_wd_timer(unsigned long arg) -{ - struct ar5523 *ar = (struct ar5523 *) arg; - - ar5523_dbg(ar, "TX watchdog timer triggered\n"); - ieee80211_queue_work(ar->hw, &ar->tx_wd_work); -} - -static void ar5523_tx_wd_work(struct work_struct *work) -{ - struct ar5523 *ar = container_of(work, struct ar5523, tx_wd_work); - - /* Occasionally the TX queues stop responding. The only way to - * recover seems to be to reset the dongle. - */ - - mutex_lock(&ar->mutex); - ar5523_err(ar, "TX queue stuck (tot %d pend %d)\n", - atomic_read(&ar->tx_nr_total), - atomic_read(&ar->tx_nr_pending)); - - ar5523_err(ar, "Will restart dongle.\n"); - ar5523_cmd_write(ar, WDCMSG_TARGET_RESET, NULL, 0, 0); - mutex_unlock(&ar->mutex); -} - -static void ar5523_flush_tx(struct ar5523 *ar) -{ - ar5523_tx_work_locked(ar); - - /* Don't waste time trying to flush if USB is disconnected */ - if (test_bit(AR5523_USB_DISCONNECTED, &ar->flags)) - return; - if (!wait_event_timeout(ar->tx_flush_waitq, - !atomic_read(&ar->tx_nr_pending), AR5523_FLUSH_TIMEOUT)) - ar5523_err(ar, "flush timeout (tot %d pend %d)\n", - atomic_read(&ar->tx_nr_total), - atomic_read(&ar->tx_nr_pending)); -} - -static void ar5523_free_tx_cmd(struct ar5523 *ar) -{ - struct ar5523_tx_cmd *cmd = &ar->tx_cmd; - - usb_free_coherent(ar->dev, AR5523_MAX_RXCMDSZ, cmd->buf_tx, - cmd->urb_tx->transfer_dma); - usb_free_urb(cmd->urb_tx); -} - -static int ar5523_alloc_tx_cmd(struct ar5523 *ar) -{ - struct ar5523_tx_cmd *cmd = &ar->tx_cmd; - - cmd->ar = ar; - init_completion(&cmd->done); - - cmd->urb_tx = usb_alloc_urb(0, GFP_KERNEL); - if (!cmd->urb_tx) { - ar5523_err(ar, "could not allocate urb\n"); - return -ENOMEM; - } - cmd->buf_tx = usb_alloc_coherent(ar->dev, AR5523_MAX_TXCMDSZ, - GFP_KERNEL, - &cmd->urb_tx->transfer_dma); - if (!cmd->buf_tx) { - usb_free_urb(cmd->urb_tx); - return -ENOMEM; - } - return 0; -} - -/* - * This function is called periodically (every second) when associated to - * query device statistics. - */ -static void ar5523_stat_work(struct work_struct *work) -{ - struct ar5523 *ar = container_of(work, struct ar5523, stat_work.work); - int error; - - ar5523_dbg(ar, "%s\n", __func__); - mutex_lock(&ar->mutex); - - /* - * Send request for statistics asynchronously once a second. This - * seems to be important. Throughput is a lot better if this is done. - */ - error = ar5523_cmd_write(ar, WDCMSG_TARGET_GET_STATS, NULL, 0, 0); - if (error) - ar5523_err(ar, "could not query stats, error %d\n", error); - mutex_unlock(&ar->mutex); - ieee80211_queue_delayed_work(ar->hw, &ar->stat_work, HZ); -} - -/* - * Interface routines to the mac80211 stack. - */ -static int ar5523_start(struct ieee80211_hw *hw) -{ - struct ar5523 *ar = hw->priv; - int error; - __be32 val; - - ar5523_dbg(ar, "start called\n"); - - mutex_lock(&ar->mutex); - val = cpu_to_be32(0); - ar5523_cmd_write(ar, WDCMSG_BIND, &val, sizeof(val), 0); - - /* set MAC address */ - ar5523_config_multi(ar, CFG_MAC_ADDR, &ar->hw->wiphy->perm_addr, - ETH_ALEN); - - /* XXX honor net80211 state */ - ar5523_config(ar, CFG_RATE_CONTROL_ENABLE, 0x00000001); - ar5523_config(ar, CFG_DIVERSITY_CTL, 0x00000001); - ar5523_config(ar, CFG_ABOLT, 0x0000003f); - ar5523_config(ar, CFG_WME_ENABLED, 0x00000000); - - ar5523_config(ar, CFG_SERVICE_TYPE, 1); - ar5523_config(ar, CFG_TP_SCALE, 0x00000000); - ar5523_config(ar, CFG_TPC_HALF_DBM5, 0x0000003c); - ar5523_config(ar, CFG_TPC_HALF_DBM2, 0x0000003c); - ar5523_config(ar, CFG_OVERRD_TX_POWER, 0x00000000); - ar5523_config(ar, CFG_GMODE_PROTECTION, 0x00000000); - ar5523_config(ar, CFG_GMODE_PROTECT_RATE_INDEX, 0x00000003); - ar5523_config(ar, CFG_PROTECTION_TYPE, 0x00000000); - ar5523_config(ar, CFG_MODE_CTS, 0x00000002); - - error = ar5523_cmd_read(ar, WDCMSG_TARGET_START, NULL, 0, - &val, sizeof(val), AR5523_CMD_FLAG_MAGIC); - if (error) { - ar5523_dbg(ar, "could not start target, error %d\n", error); - goto err; - } - ar5523_dbg(ar, "WDCMSG_TARGET_START returns handle: 0x%x\n", - be32_to_cpu(val)); - - ar5523_switch_chan(ar); - - val = cpu_to_be32(TARGET_DEVICE_AWAKE); - ar5523_cmd_write(ar, WDCMSG_SET_PWR_MODE, &val, sizeof(val), 0); - /* XXX? check */ - ar5523_cmd_write(ar, WDCMSG_RESET_KEY_CACHE, NULL, 0, 0); - - set_bit(AR5523_HW_UP, &ar->flags); - queue_work(ar->wq, &ar->rx_refill_work); - - /* enable Rx */ - ar5523_set_rxfilter(ar, 0, UATH_FILTER_OP_INIT); - ar5523_set_rxfilter(ar, - UATH_FILTER_RX_UCAST | UATH_FILTER_RX_MCAST | - UATH_FILTER_RX_BCAST | UATH_FILTER_RX_BEACON, - UATH_FILTER_OP_SET); - - ar5523_set_ledsteady(ar, UATH_LED_ACTIVITY, UATH_LED_ON); - ar5523_dbg(ar, "start OK\n"); - -err: - mutex_unlock(&ar->mutex); - return error; -} - -static void ar5523_stop(struct ieee80211_hw *hw) -{ - struct ar5523 *ar = hw->priv; - - ar5523_dbg(ar, "stop called\n"); - - cancel_delayed_work_sync(&ar->stat_work); - mutex_lock(&ar->mutex); - clear_bit(AR5523_HW_UP, &ar->flags); - - ar5523_set_ledsteady(ar, UATH_LED_LINK, UATH_LED_OFF); - ar5523_set_ledsteady(ar, UATH_LED_ACTIVITY, UATH_LED_OFF); - - ar5523_cmd_write(ar, WDCMSG_TARGET_STOP, NULL, 0, 0); - - del_timer_sync(&ar->tx_wd_timer); - cancel_work_sync(&ar->tx_wd_work); - cancel_work_sync(&ar->rx_refill_work); - ar5523_cancel_rx_bufs(ar); - mutex_unlock(&ar->mutex); -} - -static int ar5523_set_rts_threshold(struct ieee80211_hw *hw, u32 value) -{ - struct ar5523 *ar = hw->priv; - int ret; - - ar5523_dbg(ar, "set_rts_threshold called\n"); - mutex_lock(&ar->mutex); - - ret = ar5523_config(ar, CFG_USER_RTS_THRESHOLD, value); - - mutex_unlock(&ar->mutex); - return ret; -} - -static void ar5523_flush(struct ieee80211_hw *hw, u32 queues, bool drop) -{ - struct ar5523 *ar = hw->priv; - - ar5523_dbg(ar, "flush called\n"); - ar5523_flush_tx(ar); -} - -static int ar5523_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ar5523 *ar = hw->priv; - - ar5523_dbg(ar, "add interface called\n"); - - if (ar->vif) { - ar5523_dbg(ar, "invalid add_interface\n"); - return -EOPNOTSUPP; - } - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - ar->vif = vif; - break; - default: - return -EOPNOTSUPP; - } - return 0; -} - -static void ar5523_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ar5523 *ar = hw->priv; - - ar5523_dbg(ar, "remove interface called\n"); - ar->vif = NULL; -} - -static int ar5523_hwconfig(struct ieee80211_hw *hw, u32 changed) -{ - struct ar5523 *ar = hw->priv; - - ar5523_dbg(ar, "config called\n"); - mutex_lock(&ar->mutex); - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { - ar5523_dbg(ar, "Do channel switch\n"); - ar5523_flush_tx(ar); - ar5523_switch_chan(ar); - } - mutex_unlock(&ar->mutex); - return 0; -} - -static int ar5523_get_wlan_mode(struct ar5523 *ar, - struct ieee80211_bss_conf *bss_conf) -{ - struct ieee80211_supported_band *band; - int bit; - struct ieee80211_sta *sta; - u32 sta_rate_set; - - band = ar->hw->wiphy->bands[ar->hw->conf.chandef.chan->band]; - sta = ieee80211_find_sta(ar->vif, bss_conf->bssid); - if (!sta) { - ar5523_info(ar, "STA not found!\n"); - return WLAN_MODE_11b; - } - sta_rate_set = sta->supp_rates[ar->hw->conf.chandef.chan->band]; - - for (bit = 0; bit < band->n_bitrates; bit++) { - if (sta_rate_set & 1) { - int rate = band->bitrates[bit].bitrate; - switch (rate) { - case 60: - case 90: - case 120: - case 180: - case 240: - case 360: - case 480: - case 540: - return WLAN_MODE_11g; - } - } - sta_rate_set >>= 1; - } - return WLAN_MODE_11b; -} - -static void ar5523_create_rateset(struct ar5523 *ar, - struct ieee80211_bss_conf *bss_conf, - struct ar5523_cmd_rateset *rs, - bool basic) -{ - struct ieee80211_supported_band *band; - struct ieee80211_sta *sta; - int bit, i = 0; - u32 sta_rate_set, basic_rate_set; - - sta = ieee80211_find_sta(ar->vif, bss_conf->bssid); - basic_rate_set = bss_conf->basic_rates; - if (!sta) { - ar5523_info(ar, "STA not found. Cannot set rates\n"); - sta_rate_set = bss_conf->basic_rates; - } else - sta_rate_set = sta->supp_rates[ar->hw->conf.chandef.chan->band]; - - ar5523_dbg(ar, "sta rate_set = %08x\n", sta_rate_set); - - band = ar->hw->wiphy->bands[ar->hw->conf.chandef.chan->band]; - for (bit = 0; bit < band->n_bitrates; bit++) { - BUG_ON(i >= AR5523_MAX_NRATES); - ar5523_dbg(ar, "Considering rate %d : %d\n", - band->bitrates[bit].hw_value, sta_rate_set & 1); - if (sta_rate_set & 1) { - rs->set[i] = band->bitrates[bit].hw_value; - if (basic_rate_set & 1 && basic) - rs->set[i] |= 0x80; - i++; - } - sta_rate_set >>= 1; - basic_rate_set >>= 1; - } - - rs->length = i; -} - -static int ar5523_set_basic_rates(struct ar5523 *ar, - struct ieee80211_bss_conf *bss) -{ - struct ar5523_cmd_rates rates; - - memset(&rates, 0, sizeof(rates)); - rates.connid = cpu_to_be32(2); /* XXX */ - rates.size = cpu_to_be32(sizeof(struct ar5523_cmd_rateset)); - ar5523_create_rateset(ar, bss, &rates.rateset, true); - - return ar5523_cmd_write(ar, WDCMSG_SET_BASIC_RATE, &rates, - sizeof(rates), 0); -} - -static int ar5523_create_connection(struct ar5523 *ar, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss) -{ - struct ar5523_cmd_create_connection create; - int wlan_mode; - - memset(&create, 0, sizeof(create)); - create.connid = cpu_to_be32(2); - create.bssid = cpu_to_be32(0); - /* XXX packed or not? */ - create.size = cpu_to_be32(sizeof(struct ar5523_cmd_rateset)); - - ar5523_create_rateset(ar, bss, &create.connattr.rateset, false); - - wlan_mode = ar5523_get_wlan_mode(ar, bss); - create.connattr.wlanmode = cpu_to_be32(wlan_mode); - - return ar5523_cmd_write(ar, WDCMSG_CREATE_CONNECTION, &create, - sizeof(create), 0); -} - -static int ar5523_write_associd(struct ar5523 *ar, - struct ieee80211_bss_conf *bss) -{ - struct ar5523_cmd_set_associd associd; - - memset(&associd, 0, sizeof(associd)); - associd.defaultrateix = cpu_to_be32(0); /* XXX */ - associd.associd = cpu_to_be32(bss->aid); - associd.timoffset = cpu_to_be32(0x3b); /* XXX */ - memcpy(associd.bssid, bss->bssid, ETH_ALEN); - return ar5523_cmd_write(ar, WDCMSG_WRITE_ASSOCID, &associd, - sizeof(associd), 0); -} - -static void ar5523_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss, - u32 changed) -{ - struct ar5523 *ar = hw->priv; - int error; - - ar5523_dbg(ar, "bss_info_changed called\n"); - mutex_lock(&ar->mutex); - - if (!(changed & BSS_CHANGED_ASSOC)) - goto out_unlock; - - if (bss->assoc) { - error = ar5523_create_connection(ar, vif, bss); - if (error) { - ar5523_err(ar, "could not create connection\n"); - goto out_unlock; - } - - error = ar5523_set_basic_rates(ar, bss); - if (error) { - ar5523_err(ar, "could not set negotiated rate set\n"); - goto out_unlock; - } - - error = ar5523_write_associd(ar, bss); - if (error) { - ar5523_err(ar, "could not set association\n"); - goto out_unlock; - } - - /* turn link LED on */ - ar5523_set_ledsteady(ar, UATH_LED_LINK, UATH_LED_ON); - set_bit(AR5523_CONNECTED, &ar->flags); - ieee80211_queue_delayed_work(hw, &ar->stat_work, HZ); - - } else { - cancel_delayed_work(&ar->stat_work); - clear_bit(AR5523_CONNECTED, &ar->flags); - ar5523_set_ledsteady(ar, UATH_LED_LINK, UATH_LED_OFF); - } - -out_unlock: - mutex_unlock(&ar->mutex); - -} - -#define AR5523_SUPPORTED_FILTERS (FIF_PROMISC_IN_BSS | \ - FIF_ALLMULTI | \ - FIF_FCSFAIL | \ - FIF_OTHER_BSS) - -static void ar5523_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast) -{ - struct ar5523 *ar = hw->priv; - u32 filter = 0; - - ar5523_dbg(ar, "configure_filter called\n"); - mutex_lock(&ar->mutex); - ar5523_flush_tx(ar); - - *total_flags &= AR5523_SUPPORTED_FILTERS; - - /* The filters seems strange. UATH_FILTER_RX_BCAST and - * UATH_FILTER_RX_MCAST does not result in those frames being RXed. - * The only way I have found to get [mb]cast frames seems to be - * to set UATH_FILTER_RX_PROM. */ - filter |= UATH_FILTER_RX_UCAST | UATH_FILTER_RX_MCAST | - UATH_FILTER_RX_BCAST | UATH_FILTER_RX_BEACON | - UATH_FILTER_RX_PROM; - - ar5523_set_rxfilter(ar, 0, UATH_FILTER_OP_INIT); - ar5523_set_rxfilter(ar, filter, UATH_FILTER_OP_SET); - - mutex_unlock(&ar->mutex); -} - -static const struct ieee80211_ops ar5523_ops = { - .start = ar5523_start, - .stop = ar5523_stop, - .tx = ar5523_tx, - .set_rts_threshold = ar5523_set_rts_threshold, - .add_interface = ar5523_add_interface, - .remove_interface = ar5523_remove_interface, - .config = ar5523_hwconfig, - .bss_info_changed = ar5523_bss_info_changed, - .configure_filter = ar5523_configure_filter, - .flush = ar5523_flush, -}; - -static int ar5523_host_available(struct ar5523 *ar) -{ - struct ar5523_cmd_host_available setup; - - /* inform target the host is available */ - setup.sw_ver_major = cpu_to_be32(ATH_SW_VER_MAJOR); - setup.sw_ver_minor = cpu_to_be32(ATH_SW_VER_MINOR); - setup.sw_ver_patch = cpu_to_be32(ATH_SW_VER_PATCH); - setup.sw_ver_build = cpu_to_be32(ATH_SW_VER_BUILD); - return ar5523_cmd_read(ar, WDCMSG_HOST_AVAILABLE, - &setup, sizeof(setup), NULL, 0, 0); -} - -static int ar5523_get_devstatus(struct ar5523 *ar) -{ - u8 macaddr[ETH_ALEN]; - int error; - - /* retrieve MAC address */ - error = ar5523_get_status(ar, ST_MAC_ADDR, macaddr, ETH_ALEN); - if (error) { - ar5523_err(ar, "could not read MAC address\n"); - return error; - } - - SET_IEEE80211_PERM_ADDR(ar->hw, macaddr); - - error = ar5523_get_status(ar, ST_SERIAL_NUMBER, - &ar->serial[0], sizeof(ar->serial)); - if (error) { - ar5523_err(ar, "could not read device serial number\n"); - return error; - } - return 0; -} - -#define AR5523_SANE_RXBUFSZ 2000 - -static int ar5523_get_max_rxsz(struct ar5523 *ar) -{ - int error; - __be32 rxsize; - - /* Get max rx size */ - error = ar5523_get_status(ar, ST_WDC_TRANSPORT_CHUNK_SIZE, &rxsize, - sizeof(rxsize)); - if (error != 0) { - ar5523_err(ar, "could not read max RX size\n"); - return error; - } - - ar->rxbufsz = be32_to_cpu(rxsize); - - if (!ar->rxbufsz || ar->rxbufsz > AR5523_SANE_RXBUFSZ) { - ar5523_err(ar, "Bad rxbufsz from device. Using %d instead\n", - AR5523_SANE_RXBUFSZ); - ar->rxbufsz = AR5523_SANE_RXBUFSZ; - } - - ar5523_dbg(ar, "Max RX buf size: %d\n", ar->rxbufsz); - return 0; -} - -/* - * This is copied from rtl818x, but we should probably move this - * to common code as in OpenBSD. - */ -static const struct ieee80211_rate ar5523_rates[] = { - { .bitrate = 10, .hw_value = 2, }, - { .bitrate = 20, .hw_value = 4 }, - { .bitrate = 55, .hw_value = 11, }, - { .bitrate = 110, .hw_value = 22, }, - { .bitrate = 60, .hw_value = 12, }, - { .bitrate = 90, .hw_value = 18, }, - { .bitrate = 120, .hw_value = 24, }, - { .bitrate = 180, .hw_value = 36, }, - { .bitrate = 240, .hw_value = 48, }, - { .bitrate = 360, .hw_value = 72, }, - { .bitrate = 480, .hw_value = 96, }, - { .bitrate = 540, .hw_value = 108, }, -}; - -static const struct ieee80211_channel ar5523_channels[] = { - { .center_freq = 2412 }, - { .center_freq = 2417 }, - { .center_freq = 2422 }, - { .center_freq = 2427 }, - { .center_freq = 2432 }, - { .center_freq = 2437 }, - { .center_freq = 2442 }, - { .center_freq = 2447 }, - { .center_freq = 2452 }, - { .center_freq = 2457 }, - { .center_freq = 2462 }, - { .center_freq = 2467 }, - { .center_freq = 2472 }, - { .center_freq = 2484 }, -}; - -static int ar5523_init_modes(struct ar5523 *ar) -{ - BUILD_BUG_ON(sizeof(ar->channels) != sizeof(ar5523_channels)); - BUILD_BUG_ON(sizeof(ar->rates) != sizeof(ar5523_rates)); - - memcpy(ar->channels, ar5523_channels, sizeof(ar5523_channels)); - memcpy(ar->rates, ar5523_rates, sizeof(ar5523_rates)); - - ar->band.band = IEEE80211_BAND_2GHZ; - ar->band.channels = ar->channels; - ar->band.n_channels = ARRAY_SIZE(ar5523_channels); - ar->band.bitrates = ar->rates; - ar->band.n_bitrates = ARRAY_SIZE(ar5523_rates); - ar->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &ar->band; - return 0; -} - -/* - * Load the MIPS R4000 microcode into the device. Once the image is loaded, - * the device will detach itself from the bus and reattach later with a new - * product Id (a la ezusb). - */ -static int ar5523_load_firmware(struct usb_device *dev) -{ - struct ar5523_fwblock *txblock, *rxblock; - const struct firmware *fw; - void *fwbuf; - int len, offset; - int foolen; /* XXX(hch): handle short transfers */ - int error = -ENXIO; - - if (request_firmware(&fw, AR5523_FIRMWARE_FILE, &dev->dev)) { - dev_err(&dev->dev, "no firmware found: %s\n", - AR5523_FIRMWARE_FILE); - return -ENOENT; - } - - txblock = kmalloc(sizeof(*txblock), GFP_KERNEL); - if (!txblock) - goto out; - - rxblock = kmalloc(sizeof(*rxblock), GFP_KERNEL); - if (!rxblock) - goto out_free_txblock; - - fwbuf = kmalloc(AR5523_MAX_FWBLOCK_SIZE, GFP_KERNEL); - if (!fwbuf) - goto out_free_rxblock; - - memset(txblock, 0, sizeof(struct ar5523_fwblock)); - txblock->flags = cpu_to_be32(AR5523_WRITE_BLOCK); - txblock->total = cpu_to_be32(fw->size); - - offset = 0; - len = fw->size; - while (len > 0) { - int mlen = min(len, AR5523_MAX_FWBLOCK_SIZE); - - txblock->remain = cpu_to_be32(len - mlen); - txblock->len = cpu_to_be32(mlen); - - /* send firmware block meta-data */ - error = usb_bulk_msg(dev, ar5523_cmd_tx_pipe(dev), - txblock, sizeof(*txblock), &foolen, - AR5523_CMD_TIMEOUT); - if (error) { - dev_err(&dev->dev, - "could not send firmware block info\n"); - goto out_free_fwbuf; - } - - /* send firmware block data */ - memcpy(fwbuf, fw->data + offset, mlen); - error = usb_bulk_msg(dev, ar5523_data_tx_pipe(dev), - fwbuf, mlen, &foolen, - AR5523_DATA_TIMEOUT); - if (error) { - dev_err(&dev->dev, - "could not send firmware block data\n"); - goto out_free_fwbuf; - } - - /* wait for ack from firmware */ - error = usb_bulk_msg(dev, ar5523_cmd_rx_pipe(dev), - rxblock, sizeof(*rxblock), &foolen, - AR5523_CMD_TIMEOUT); - if (error) { - dev_err(&dev->dev, - "could not read firmware answer\n"); - goto out_free_fwbuf; - } - - len -= mlen; - offset += mlen; - } - - /* - * Set the error to -ENXIO to make sure we continue probing for - * a driver. - */ - error = -ENXIO; - - out_free_fwbuf: - kfree(fwbuf); - out_free_rxblock: - kfree(rxblock); - out_free_txblock: - kfree(txblock); - out: - release_firmware(fw); - return error; -} - -static int ar5523_probe(struct usb_interface *intf, - const struct usb_device_id *id) -{ - struct usb_device *dev = interface_to_usbdev(intf); - struct ieee80211_hw *hw; - struct ar5523 *ar; - int error = -ENOMEM; - - /* - * Load firmware if the device requires it. This will return - * -ENXIO on success and we'll get called back afer the usb - * id changes to indicate that the firmware is present. - */ - if (id->driver_info & AR5523_FLAG_PRE_FIRMWARE) - return ar5523_load_firmware(dev); - - - hw = ieee80211_alloc_hw(sizeof(*ar), &ar5523_ops); - if (!hw) - goto out; - SET_IEEE80211_DEV(hw, &intf->dev); - - ar = hw->priv; - ar->hw = hw; - ar->dev = dev; - mutex_init(&ar->mutex); - - INIT_DELAYED_WORK(&ar->stat_work, ar5523_stat_work); - init_timer(&ar->tx_wd_timer); - setup_timer(&ar->tx_wd_timer, ar5523_tx_wd_timer, (unsigned long) ar); - INIT_WORK(&ar->tx_wd_work, ar5523_tx_wd_work); - INIT_WORK(&ar->tx_work, ar5523_tx_work); - INIT_LIST_HEAD(&ar->tx_queue_pending); - INIT_LIST_HEAD(&ar->tx_queue_submitted); - spin_lock_init(&ar->tx_data_list_lock); - atomic_set(&ar->tx_nr_total, 0); - atomic_set(&ar->tx_nr_pending, 0); - init_waitqueue_head(&ar->tx_flush_waitq); - - atomic_set(&ar->rx_data_free_cnt, 0); - INIT_WORK(&ar->rx_refill_work, ar5523_rx_refill_work); - INIT_LIST_HEAD(&ar->rx_data_free); - INIT_LIST_HEAD(&ar->rx_data_used); - spin_lock_init(&ar->rx_data_list_lock); - - ar->wq = create_singlethread_workqueue("ar5523"); - if (!ar->wq) { - ar5523_err(ar, "Could not create wq\n"); - goto out_free_ar; - } - - error = ar5523_alloc_rx_bufs(ar); - if (error) { - ar5523_err(ar, "Could not allocate rx buffers\n"); - goto out_free_wq; - } - - error = ar5523_alloc_rx_cmd(ar); - if (error) { - ar5523_err(ar, "Could not allocate rx command buffers\n"); - goto out_free_rx_bufs; - } - - error = ar5523_alloc_tx_cmd(ar); - if (error) { - ar5523_err(ar, "Could not allocate tx command buffers\n"); - goto out_free_rx_cmd; - } - - error = ar5523_submit_rx_cmd(ar); - if (error) { - ar5523_err(ar, "Failed to submit rx cmd\n"); - goto out_free_tx_cmd; - } - - /* - * We're now ready to send/receive firmware commands. - */ - error = ar5523_host_available(ar); - if (error) { - ar5523_err(ar, "could not initialize adapter\n"); - goto out_cancel_rx_cmd; - } - - error = ar5523_get_max_rxsz(ar); - if (error) { - ar5523_err(ar, "could not get caps from adapter\n"); - goto out_cancel_rx_cmd; - } - - error = ar5523_get_devcap(ar); - if (error) { - ar5523_err(ar, "could not get caps from adapter\n"); - goto out_cancel_rx_cmd; - } - - error = ar5523_get_devstatus(ar); - if (error != 0) { - ar5523_err(ar, "could not get device status\n"); - goto out_cancel_rx_cmd; - } - - ar5523_info(ar, "MAC/BBP AR5523, RF AR%c112\n", - (id->driver_info & AR5523_FLAG_ABG) ? '5' : '2'); - - ar->vif = NULL; - hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_HAS_RATE_CONTROL; - hw->extra_tx_headroom = sizeof(struct ar5523_tx_desc) + - sizeof(struct ar5523_chunk); - hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); - hw->queues = 1; - - error = ar5523_init_modes(ar); - if (error) - goto out_cancel_rx_cmd; - - usb_set_intfdata(intf, hw); - - error = ieee80211_register_hw(hw); - if (error) { - ar5523_err(ar, "could not register device\n"); - goto out_cancel_rx_cmd; - } - - ar5523_info(ar, "Found and initialized AR5523 device\n"); - return 0; - -out_cancel_rx_cmd: - ar5523_cancel_rx_cmd(ar); -out_free_tx_cmd: - ar5523_free_tx_cmd(ar); -out_free_rx_cmd: - ar5523_free_rx_cmd(ar); -out_free_rx_bufs: - ar5523_free_rx_bufs(ar); -out_free_wq: - destroy_workqueue(ar->wq); -out_free_ar: - ieee80211_free_hw(hw); -out: - return error; -} - -static void ar5523_disconnect(struct usb_interface *intf) -{ - struct ieee80211_hw *hw = usb_get_intfdata(intf); - struct ar5523 *ar = hw->priv; - - ar5523_dbg(ar, "detaching\n"); - set_bit(AR5523_USB_DISCONNECTED, &ar->flags); - - ieee80211_unregister_hw(hw); - - ar5523_cancel_rx_cmd(ar); - ar5523_free_tx_cmd(ar); - ar5523_free_rx_cmd(ar); - ar5523_free_rx_bufs(ar); - - destroy_workqueue(ar->wq); - - ieee80211_free_hw(hw); - usb_set_intfdata(intf, NULL); -} - -#define AR5523_DEVICE_UG(vendor, device) \ - { USB_DEVICE((vendor), (device)) }, \ - { USB_DEVICE((vendor), (device) + 1), \ - .driver_info = AR5523_FLAG_PRE_FIRMWARE } -#define AR5523_DEVICE_UX(vendor, device) \ - { USB_DEVICE((vendor), (device)), \ - .driver_info = AR5523_FLAG_ABG }, \ - { USB_DEVICE((vendor), (device) + 1), \ - .driver_info = AR5523_FLAG_ABG|AR5523_FLAG_PRE_FIRMWARE } - -static struct usb_device_id ar5523_id_table[] = { - AR5523_DEVICE_UG(0x168c, 0x0001), /* Atheros / AR5523 */ - AR5523_DEVICE_UG(0x0cf3, 0x0001), /* Atheros2 / AR5523_1 */ - AR5523_DEVICE_UG(0x0cf3, 0x0003), /* Atheros2 / AR5523_2 */ - AR5523_DEVICE_UX(0x0cf3, 0x0005), /* Atheros2 / AR5523_3 */ - AR5523_DEVICE_UG(0x0d8e, 0x7801), /* Conceptronic / AR5523_1 */ - AR5523_DEVICE_UX(0x0d8e, 0x7811), /* Conceptronic / AR5523_2 */ - AR5523_DEVICE_UX(0x2001, 0x3a00), /* Dlink / DWLAG132 */ - AR5523_DEVICE_UG(0x2001, 0x3a02), /* Dlink / DWLG132 */ - AR5523_DEVICE_UX(0x2001, 0x3a04), /* Dlink / DWLAG122 */ - AR5523_DEVICE_UG(0x1690, 0x0712), /* Gigaset / AR5523 */ - AR5523_DEVICE_UG(0x1690, 0x0710), /* Gigaset / SMCWUSBTG */ - AR5523_DEVICE_UG(0x129b, 0x160c), /* Gigaset / USB stick 108 - (CyberTAN Technology) */ - AR5523_DEVICE_UG(0x16ab, 0x7801), /* Globalsun / AR5523_1 */ - AR5523_DEVICE_UX(0x16ab, 0x7811), /* Globalsun / AR5523_2 */ - AR5523_DEVICE_UG(0x0d8e, 0x7802), /* Globalsun / AR5523_3 */ - AR5523_DEVICE_UX(0x0846, 0x4300), /* Netgear / WG111U */ - AR5523_DEVICE_UG(0x0846, 0x4250), /* Netgear / WG111T */ - AR5523_DEVICE_UG(0x0846, 0x5f00), /* Netgear / WPN111 */ - AR5523_DEVICE_UG(0x157e, 0x3006), /* Umedia / AR5523_1 */ - AR5523_DEVICE_UX(0x157e, 0x3205), /* Umedia / AR5523_2 */ - AR5523_DEVICE_UG(0x157e, 0x3006), /* Umedia / TEW444UBEU */ - AR5523_DEVICE_UG(0x1435, 0x0826), /* Wistronneweb / AR5523_1 */ - AR5523_DEVICE_UX(0x1435, 0x0828), /* Wistronneweb / AR5523_2 */ - AR5523_DEVICE_UG(0x0cde, 0x0012), /* Zcom / AR5523 */ - AR5523_DEVICE_UG(0x1385, 0x4250), /* Netgear3 / WG111T (2) */ - AR5523_DEVICE_UG(0x1385, 0x5f00), /* Netgear / WPN111 */ - AR5523_DEVICE_UG(0x1385, 0x5f02), /* Netgear / WPN111 */ - { } -}; -MODULE_DEVICE_TABLE(usb, ar5523_id_table); - -static struct usb_driver ar5523_driver = { - .name = "ar5523", - .id_table = ar5523_id_table, - .probe = ar5523_probe, - .disconnect = ar5523_disconnect, -}; - -module_usb_driver(ar5523_driver); - -MODULE_LICENSE("Dual BSD/GPL"); -MODULE_FIRMWARE(AR5523_FIRMWARE_FILE); diff --git a/drivers/net/wireless/ath/ar5523/ar5523.h b/drivers/net/wireless/ath/ar5523/ar5523.h deleted file mode 100644 index 00c6fd346d48..000000000000 --- a/drivers/net/wireless/ath/ar5523/ar5523.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2006 Damien Bergamini - * Copyright (c) 2006 Sam Leffler, Errno Consulting - * Copyright (c) 2007 Christoph Hellwig - * Copyright (c) 2008-2009 Weongyo Jeong - * Copyright (c) 2012 Pontus Fuchs - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define AR5523_FLAG_PRE_FIRMWARE (1 << 0) -#define AR5523_FLAG_ABG (1 << 1) - -#define AR5523_FIRMWARE_FILE "ar5523.bin" - -#define AR5523_CMD_TX_PIPE 0x01 -#define AR5523_DATA_TX_PIPE 0x02 -#define AR5523_CMD_RX_PIPE 0x81 -#define AR5523_DATA_RX_PIPE 0x82 - -#define ar5523_cmd_tx_pipe(dev) \ - usb_sndbulkpipe((dev), AR5523_CMD_TX_PIPE) -#define ar5523_data_tx_pipe(dev) \ - usb_sndbulkpipe((dev), AR5523_DATA_TX_PIPE) -#define ar5523_cmd_rx_pipe(dev) \ - usb_rcvbulkpipe((dev), AR5523_CMD_RX_PIPE) -#define ar5523_data_rx_pipe(dev) \ - usb_rcvbulkpipe((dev), AR5523_DATA_RX_PIPE) - -#define AR5523_DATA_TIMEOUT 10000 -#define AR5523_CMD_TIMEOUT 1000 - -#define AR5523_TX_DATA_COUNT 8 -#define AR5523_TX_DATA_RESTART_COUNT 2 -#define AR5523_RX_DATA_COUNT 16 -#define AR5523_RX_DATA_REFILL_COUNT 8 - -#define AR5523_CMD_ID 1 -#define AR5523_DATA_ID 2 - -#define AR5523_TX_WD_TIMEOUT (HZ * 2) -#define AR5523_FLUSH_TIMEOUT (HZ * 3) - -enum AR5523_flags { - AR5523_HW_UP, - AR5523_USB_DISCONNECTED, - AR5523_CONNECTED -}; - -struct ar5523_tx_cmd { - struct ar5523 *ar; - struct urb *urb_tx; - void *buf_tx; - void *odata; - int olen; - int flags; - int res; - struct completion done; -}; - -/* This struct is placed in tx_info->driver_data. It must not be larger - * than IEEE80211_TX_INFO_DRIVER_DATA_SIZE. - */ -struct ar5523_tx_data { - struct list_head list; - struct ar5523 *ar; - struct sk_buff *skb; - struct urb *urb; -}; - -struct ar5523_rx_data { - struct list_head list; - struct ar5523 *ar; - struct urb *urb; - struct sk_buff *skb; -}; - -struct ar5523 { - struct usb_device *dev; - struct ieee80211_hw *hw; - - unsigned long flags; - struct mutex mutex; - struct workqueue_struct *wq; - - struct ar5523_tx_cmd tx_cmd; - - struct delayed_work stat_work; - - struct timer_list tx_wd_timer; - struct work_struct tx_wd_work; - struct work_struct tx_work; - struct list_head tx_queue_pending; - struct list_head tx_queue_submitted; - spinlock_t tx_data_list_lock; - wait_queue_head_t tx_flush_waitq; - - /* Queued + Submitted TX frames */ - atomic_t tx_nr_total; - - /* Submitted TX frames */ - atomic_t tx_nr_pending; - - void *rx_cmd_buf; - struct urb *rx_cmd_urb; - - struct ar5523_rx_data rx_data[AR5523_RX_DATA_COUNT]; - spinlock_t rx_data_list_lock; - struct list_head rx_data_free; - struct list_head rx_data_used; - atomic_t rx_data_free_cnt; - - struct work_struct rx_refill_work; - - unsigned int rxbufsz; - u8 serial[16]; - - struct ieee80211_channel channels[14]; - struct ieee80211_rate rates[12]; - struct ieee80211_supported_band band; - struct ieee80211_vif *vif; -}; - -/* flags for sending firmware commands */ -#define AR5523_CMD_FLAG_READ (1 << 1) -#define AR5523_CMD_FLAG_MAGIC (1 << 2) - -#define ar5523_dbg(ar, format, arg...) \ - dev_dbg(&(ar)->dev->dev, format, ## arg) - -/* On USB hot-unplug there can be a lot of URBs in flight and they'll all - * fail. Instead of dealing with them in every possible place just surpress - * any messages on USB disconnect. - */ -#define ar5523_err(ar, format, arg...) \ -do { \ - if (!test_bit(AR5523_USB_DISCONNECTED, &ar->flags)) { \ - dev_err(&(ar)->dev->dev, format, ## arg); \ - } \ -} while (0) -#define ar5523_info(ar, format, arg...) \ - dev_info(&(ar)->dev->dev, format, ## arg) diff --git a/drivers/net/wireless/ath/ar5523/ar5523_hw.h b/drivers/net/wireless/ath/ar5523/ar5523_hw.h deleted file mode 100644 index 0fe2c803f48f..000000000000 --- a/drivers/net/wireless/ath/ar5523/ar5523_hw.h +++ /dev/null @@ -1,431 +0,0 @@ -/* - * Copyright (c) 2006 Damien Bergamini - * Copyright (c) 2006 Sam Leffler, Errno Consulting - * Copyright (c) 2007 Christoph Hellwig - * Copyright (c) 2008-2009 Weongyo Jeong - * Copyright (c) 2012 Pontus Fuchs - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* all fields are big endian */ -struct ar5523_fwblock { - __be32 flags; -#define AR5523_WRITE_BLOCK (1 << 4) - - __be32 len; -#define AR5523_MAX_FWBLOCK_SIZE 2048 - - __be32 total; - __be32 remain; - __be32 rxtotal; - __be32 pad[123]; -} __packed; - -#define AR5523_MAX_RXCMDSZ 1024 -#define AR5523_MAX_TXCMDSZ 1024 - -struct ar5523_cmd_hdr { - __be32 len; - __be32 code; -/* NB: these are defined for rev 1.5 firmware; rev 1.6 is different */ -/* messages from Host -> Target */ -#define WDCMSG_HOST_AVAILABLE 0x01 -#define WDCMSG_BIND 0x02 -#define WDCMSG_TARGET_RESET 0x03 -#define WDCMSG_TARGET_GET_CAPABILITY 0x04 -#define WDCMSG_TARGET_SET_CONFIG 0x05 -#define WDCMSG_TARGET_GET_STATUS 0x06 -#define WDCMSG_TARGET_GET_STATS 0x07 -#define WDCMSG_TARGET_START 0x08 -#define WDCMSG_TARGET_STOP 0x09 -#define WDCMSG_TARGET_ENABLE 0x0a -#define WDCMSG_TARGET_DISABLE 0x0b -#define WDCMSG_CREATE_CONNECTION 0x0c -#define WDCMSG_UPDATE_CONNECT_ATTR 0x0d -#define WDCMSG_DELETE_CONNECT 0x0e -#define WDCMSG_SEND 0x0f -#define WDCMSG_FLUSH 0x10 -/* messages from Target -> Host */ -#define WDCMSG_STATS_UPDATE 0x11 -#define WDCMSG_BMISS 0x12 -#define WDCMSG_DEVICE_AVAIL 0x13 -#define WDCMSG_SEND_COMPLETE 0x14 -#define WDCMSG_DATA_AVAIL 0x15 -#define WDCMSG_SET_PWR_MODE 0x16 -#define WDCMSG_BMISS_ACK 0x17 -#define WDCMSG_SET_LED_STEADY 0x18 -#define WDCMSG_SET_LED_BLINK 0x19 -/* more messages */ -#define WDCMSG_SETUP_BEACON_DESC 0x1a -#define WDCMSG_BEACON_INIT 0x1b -#define WDCMSG_RESET_KEY_CACHE 0x1c -#define WDCMSG_RESET_KEY_CACHE_ENTRY 0x1d -#define WDCMSG_SET_KEY_CACHE_ENTRY 0x1e -#define WDCMSG_SET_DECOMP_MASK 0x1f -#define WDCMSG_SET_REGULATORY_DOMAIN 0x20 -#define WDCMSG_SET_LED_STATE 0x21 -#define WDCMSG_WRITE_ASSOCID 0x22 -#define WDCMSG_SET_STA_BEACON_TIMERS 0x23 -#define WDCMSG_GET_TSF 0x24 -#define WDCMSG_RESET_TSF 0x25 -#define WDCMSG_SET_ADHOC_MODE 0x26 -#define WDCMSG_SET_BASIC_RATE 0x27 -#define WDCMSG_MIB_CONTROL 0x28 -#define WDCMSG_GET_CHANNEL_DATA 0x29 -#define WDCMSG_GET_CUR_RSSI 0x2a -#define WDCMSG_SET_ANTENNA_SWITCH 0x2b -#define WDCMSG_USE_SHORT_SLOT_TIME 0x2f -#define WDCMSG_SET_POWER_MODE 0x30 -#define WDCMSG_SETUP_PSPOLL_DESC 0x31 -#define WDCMSG_SET_RX_MULTICAST_FILTER 0x32 -#define WDCMSG_RX_FILTER 0x33 -#define WDCMSG_PER_CALIBRATION 0x34 -#define WDCMSG_RESET 0x35 -#define WDCMSG_DISABLE 0x36 -#define WDCMSG_PHY_DISABLE 0x37 -#define WDCMSG_SET_TX_POWER_LIMIT 0x38 -#define WDCMSG_SET_TX_QUEUE_PARAMS 0x39 -#define WDCMSG_SETUP_TX_QUEUE 0x3a -#define WDCMSG_RELEASE_TX_QUEUE 0x3b -#define WDCMSG_SET_DEFAULT_KEY 0x43 - - __u32 priv; /* driver private data, - don't care about endianess */ - __be32 magic; - __be32 reserved2[4]; -}; - -struct ar5523_cmd_host_available { - __be32 sw_ver_major; - __be32 sw_ver_minor; - __be32 sw_ver_patch; - __be32 sw_ver_build; -} __packed; - -#define ATH_SW_VER_MAJOR 1 -#define ATH_SW_VER_MINOR 5 -#define ATH_SW_VER_PATCH 0 -#define ATH_SW_VER_BUILD 9999 - -struct ar5523_chunk { - u8 seqnum; /* sequence number for ordering */ - u8 flags; -#define UATH_CFLAGS_FINAL 0x01 /* final chunk of a msg */ -#define UATH_CFLAGS_RXMSG 0x02 /* chunk contains rx completion */ -#define UATH_CFLAGS_DEBUG 0x04 /* for debugging */ - __be16 length; /* chunk size in bytes */ - /* chunk data follows */ -} __packed; - -/* - * Message format for a WDCMSG_DATA_AVAIL message from Target to Host. - */ -struct ar5523_rx_desc { - __be32 len; /* msg length including header */ - __be32 code; /* WDCMSG_DATA_AVAIL */ - __be32 gennum; /* generation number */ - __be32 status; /* start of RECEIVE_INFO */ -#define UATH_STATUS_OK 0 -#define UATH_STATUS_STOP_IN_PROGRESS 1 -#define UATH_STATUS_CRC_ERR 2 -#define UATH_STATUS_PHY_ERR 3 -#define UATH_STATUS_DECRYPT_CRC_ERR 4 -#define UATH_STATUS_DECRYPT_MIC_ERR 5 -#define UATH_STATUS_DECOMP_ERR 6 -#define UATH_STATUS_KEY_ERR 7 -#define UATH_STATUS_ERR 8 - __be32 tstamp_low; /* low-order 32-bits of rx timestamp */ - __be32 tstamp_high; /* high-order 32-bits of rx timestamp */ - __be32 framelen; /* frame length */ - __be32 rate; /* rx rate code */ - __be32 antenna; - __be32 rssi; - __be32 channel; - __be32 phyerror; - __be32 connix; /* key table ix for bss traffic */ - __be32 decrypterror; - __be32 keycachemiss; - __be32 pad; /* XXX? */ -} __packed; - -struct ar5523_tx_desc { - __be32 msglen; - u32 msgid; /* msg id (supplied by host) */ - __be32 type; /* opcode: WDMSG_SEND or WDCMSG_FLUSH */ - __be32 txqid; /* tx queue id and flags */ -#define UATH_TXQID_MASK 0x0f -#define UATH_TXQID_MINRATE 0x10 /* use min tx rate */ -#define UATH_TXQID_FF 0x20 /* content is fast frame */ - __be32 connid; /* tx connection id */ -#define UATH_ID_INVALID 0xffffffff /* for sending prior to connection */ - __be32 flags; /* non-zero if response desired */ -#define UATH_TX_NOTIFY (1 << 24) /* f/w will send a UATH_NOTIF_TX */ - __be32 buflen; /* payload length */ -} __packed; - - -#define AR5523_ID_BSS 2 -#define AR5523_ID_BROADCAST 0xffffffff - -/* structure for command UATH_CMD_WRITE_MAC */ -struct ar5523_write_mac { - __be32 reg; - __be32 len; - u8 data[32]; -} __packed; - -struct ar5523_cmd_rateset { - __u8 length; -#define AR5523_MAX_NRATES 32 - __u8 set[AR5523_MAX_NRATES]; -}; - -struct ar5523_cmd_set_associd { /* AR5523_WRITE_ASSOCID */ - __be32 defaultrateix; - __be32 associd; - __be32 timoffset; - __be32 turboprime; - __u8 bssid[6]; -} __packed; - -/* structure for command WDCMSG_RESET */ -struct ar5523_cmd_reset { - __be32 flags; /* channel flags */ -#define UATH_CHAN_TURBO 0x0100 -#define UATH_CHAN_CCK 0x0200 -#define UATH_CHAN_OFDM 0x0400 -#define UATH_CHAN_2GHZ 0x1000 -#define UATH_CHAN_5GHZ 0x2000 - __be32 freq; /* channel frequency */ - __be32 maxrdpower; - __be32 cfgctl; - __be32 twiceantennareduction; - __be32 channelchange; - __be32 keeprccontent; -} __packed; - -/* structure for command WDCMSG_SET_BASIC_RATE */ -struct ar5523_cmd_rates { - __be32 connid; - __be32 keeprccontent; - __be32 size; - struct ar5523_cmd_rateset rateset; -} __packed; - -enum { - WLAN_MODE_NONE = 0, - WLAN_MODE_11b, - WLAN_MODE_11a, - WLAN_MODE_11g, - WLAN_MODE_11a_TURBO, - WLAN_MODE_11g_TURBO, - WLAN_MODE_11a_TURBO_PRIME, - WLAN_MODE_11g_TURBO_PRIME, - WLAN_MODE_11a_XR, - WLAN_MODE_11g_XR, -}; - -struct ar5523_cmd_connection_attr { - __be32 longpreambleonly; - struct ar5523_cmd_rateset rateset; - __be32 wlanmode; -} __packed; - -/* structure for command AR5523_CREATE_CONNECTION */ -struct ar5523_cmd_create_connection { - __be32 connid; - __be32 bssid; - __be32 size; - struct ar5523_cmd_connection_attr connattr; -} __packed; - -struct ar5523_cmd_ledsteady { /* WDCMSG_SET_LED_STEADY */ - __be32 lednum; -#define UATH_LED_LINK 0 -#define UATH_LED_ACTIVITY 1 - __be32 ledmode; -#define UATH_LED_OFF 0 -#define UATH_LED_ON 1 -} __packed; - -struct ar5523_cmd_ledblink { /* WDCMSG_SET_LED_BLINK */ - __be32 lednum; - __be32 ledmode; - __be32 blinkrate; - __be32 slowmode; -} __packed; - -struct ar5523_cmd_ledstate { /* WDCMSG_SET_LED_STATE */ - __be32 connected; -} __packed; - -struct ar5523_cmd_txq_attr { - __be32 priority; - __be32 aifs; - __be32 logcwmin; - __be32 logcwmax; - __be32 bursttime; - __be32 mode; - __be32 qflags; -} __packed; - -struct ar5523_cmd_txq_setup { /* WDCMSG_SETUP_TX_QUEUE */ - __be32 qid; - __be32 len; - struct ar5523_cmd_txq_attr attr; -} __packed; - -struct ar5523_cmd_rx_filter { /* WDCMSG_RX_FILTER */ - __be32 bits; -#define UATH_FILTER_RX_UCAST 0x00000001 -#define UATH_FILTER_RX_MCAST 0x00000002 -#define UATH_FILTER_RX_BCAST 0x00000004 -#define UATH_FILTER_RX_CONTROL 0x00000008 -#define UATH_FILTER_RX_BEACON 0x00000010 /* beacon frames */ -#define UATH_FILTER_RX_PROM 0x00000020 /* promiscuous mode */ -#define UATH_FILTER_RX_PHY_ERR 0x00000040 /* phy errors */ -#define UATH_FILTER_RX_PHY_RADAR 0x00000080 /* radar phy errors */ -#define UATH_FILTER_RX_XR_POOL 0x00000400 /* XR group polls */ -#define UATH_FILTER_RX_PROBE_REQ 0x00000800 - __be32 op; -#define UATH_FILTER_OP_INIT 0x0 -#define UATH_FILTER_OP_SET 0x1 -#define UATH_FILTER_OP_CLEAR 0x2 -#define UATH_FILTER_OP_TEMP 0x3 -#define UATH_FILTER_OP_RESTORE 0x4 -} __packed; - -enum { - CFG_NONE, /* Sentinal to indicate "no config" */ - CFG_REG_DOMAIN, /* Regulatory Domain */ - CFG_RATE_CONTROL_ENABLE, - CFG_DEF_XMIT_DATA_RATE, /* NB: if rate control is not enabled */ - CFG_HW_TX_RETRIES, - CFG_SW_TX_RETRIES, - CFG_SLOW_CLOCK_ENABLE, - CFG_COMP_PROC, - CFG_USER_RTS_THRESHOLD, - CFG_XR2NORM_RATE_THRESHOLD, - CFG_XRMODE_SWITCH_COUNT, - CFG_PROTECTION_TYPE, - CFG_BURST_SEQ_THRESHOLD, - CFG_ABOLT, - CFG_IQ_LOG_COUNT_MAX, - CFG_MODE_CTS, - CFG_WME_ENABLED, - CFG_GPRS_CBR_PERIOD, - CFG_SERVICE_TYPE, - /* MAC Address to use. Overrides EEPROM */ - CFG_MAC_ADDR, - CFG_DEBUG_EAR, - CFG_INIT_REGS, - /* An ID for use in error & debug messages */ - CFG_DEBUG_ID, - CFG_COMP_WIN_SZ, - CFG_DIVERSITY_CTL, - CFG_TP_SCALE, - CFG_TPC_HALF_DBM5, - CFG_TPC_HALF_DBM2, - CFG_OVERRD_TX_POWER, - CFG_USE_32KHZ_CLOCK, - CFG_GMODE_PROTECTION, - CFG_GMODE_PROTECT_RATE_INDEX, - CFG_GMODE_NON_ERP_PREAMBLE, - CFG_WDC_TRANSPORT_CHUNK_SIZE, -}; - -enum { - /* Sentinal to indicate "no capability" */ - CAP_NONE, - CAP_ALL, /* ALL capabilities */ - CAP_TARGET_VERSION, - CAP_TARGET_REVISION, - CAP_MAC_VERSION, - CAP_MAC_REVISION, - CAP_PHY_REVISION, - CAP_ANALOG_5GHz_REVISION, - CAP_ANALOG_2GHz_REVISION, - /* Target supports WDC message debug features */ - CAP_DEBUG_WDCMSG_SUPPORT, - - CAP_REG_DOMAIN, - CAP_COUNTRY_CODE, - CAP_REG_CAP_BITS, - - CAP_WIRELESS_MODES, - CAP_CHAN_SPREAD_SUPPORT, - CAP_SLEEP_AFTER_BEACON_BROKEN, - CAP_COMPRESS_SUPPORT, - CAP_BURST_SUPPORT, - CAP_FAST_FRAMES_SUPPORT, - CAP_CHAP_TUNING_SUPPORT, - CAP_TURBOG_SUPPORT, - CAP_TURBO_PRIME_SUPPORT, - CAP_DEVICE_TYPE, - CAP_XR_SUPPORT, - CAP_WME_SUPPORT, - CAP_TOTAL_QUEUES, - CAP_CONNECTION_ID_MAX, /* Should absorb CAP_KEY_CACHE_SIZE */ - - CAP_LOW_5GHZ_CHAN, - CAP_HIGH_5GHZ_CHAN, - CAP_LOW_2GHZ_CHAN, - CAP_HIGH_2GHZ_CHAN, - - CAP_MIC_AES_CCM, - CAP_MIC_CKIP, - CAP_MIC_TKIP, - CAP_MIC_TKIP_WME, - CAP_CIPHER_AES_CCM, - CAP_CIPHER_CKIP, - CAP_CIPHER_TKIP, - - CAP_TWICE_ANTENNAGAIN_5G, - CAP_TWICE_ANTENNAGAIN_2G, -}; - -enum { - ST_NONE, /* Sentinal to indicate "no status" */ - ST_ALL, - ST_SERVICE_TYPE, - ST_WLAN_MODE, - ST_FREQ, - ST_BAND, - ST_LAST_RSSI, - ST_PS_FRAMES_DROPPED, - ST_CACHED_DEF_ANT, - ST_COUNT_OTHER_RX_ANT, - ST_USE_FAST_DIVERSITY, - ST_MAC_ADDR, - ST_RX_GENERATION_NUM, - ST_TX_QUEUE_DEPTH, - ST_SERIAL_NUMBER, - ST_WDC_TRANSPORT_CHUNK_SIZE, -}; - -enum { - TARGET_DEVICE_AWAKE, - TARGET_DEVICE_SLEEP, - TARGET_DEVICE_PWRDN, - TARGET_DEVICE_PWRSAVE, - TARGET_DEVICE_SUSPEND, - TARGET_DEVICE_RESUME, -}; - -/* this is in net/ieee80211.h, but that conflicts with the mac80211 headers */ -#define IEEE80211_2ADDR_LEN 16 - -#define AR5523_MIN_RXBUFSZ \ - (((sizeof(__be32) + IEEE80211_2ADDR_LEN + \ - sizeof(struct ar5523_rx_desc)) + 3) & ~3) diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h deleted file mode 100644 index 4521342c62cc..000000000000 --- a/drivers/net/wireless/ath/ath.h +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright (c) 2008-2009 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef ATH_H -#define ATH_H - -#include -#include -#include -#include - -/* - * The key cache is used for h/w cipher state and also for - * tracking station state such as the current tx antenna. - * We also setup a mapping table between key cache slot indices - * and station state to short-circuit node lookups on rx. - * Different parts have different size key caches. We handle - * up to ATH_KEYMAX entries (could dynamically allocate state). - */ -#define ATH_KEYMAX 128 /* max key cache size we handle */ - -static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - -struct ath_ani { - bool caldone; - unsigned int longcal_timer; - unsigned int shortcal_timer; - unsigned int resetcal_timer; - unsigned int checkani_timer; - struct timer_list timer; -}; - -struct ath_cycle_counters { - u32 cycles; - u32 rx_busy; - u32 rx_frame; - u32 tx_frame; -}; - -enum ath_device_state { - ATH_HW_UNAVAILABLE, - ATH_HW_INITIALIZED, -}; - -enum ath_bus_type { - ATH_PCI, - ATH_AHB, - ATH_USB, -}; - -struct reg_dmn_pair_mapping { - u16 regDmnEnum; - u16 reg_5ghz_ctl; - u16 reg_2ghz_ctl; -}; - -struct ath_regulatory { - char alpha2[2]; - u16 country_code; - u16 max_power_level; - u16 current_rd; - int16_t power_limit; - struct reg_dmn_pair_mapping *regpair; -}; - -enum ath_crypt_caps { - ATH_CRYPT_CAP_CIPHER_AESCCM = BIT(0), - ATH_CRYPT_CAP_MIC_COMBINED = BIT(1), -}; - -struct ath_keyval { - u8 kv_type; - u8 kv_pad; - u16 kv_len; - u8 kv_val[16]; /* TK */ - u8 kv_mic[8]; /* Michael MIC key */ - u8 kv_txmic[8]; /* Michael MIC TX key (used only if the hardware - * supports both MIC keys in the same key cache entry; - * in that case, kv_mic is the RX key) */ -}; - -enum ath_cipher { - ATH_CIPHER_WEP = 0, - ATH_CIPHER_AES_OCB = 1, - ATH_CIPHER_AES_CCM = 2, - ATH_CIPHER_CKIP = 3, - ATH_CIPHER_TKIP = 4, - ATH_CIPHER_CLR = 5, - ATH_CIPHER_MIC = 127 -}; - -/** - * struct ath_ops - Register read/write operations - * - * @read: Register read - * @multi_read: Multiple register read - * @write: Register write - * @enable_write_buffer: Enable multiple register writes - * @write_flush: flush buffered register writes and disable buffering - */ -struct ath_ops { - unsigned int (*read)(void *, u32 reg_offset); - void (*multi_read)(void *, u32 *addr, u32 *val, u16 count); - void (*write)(void *, u32 val, u32 reg_offset); - void (*enable_write_buffer)(void *); - void (*write_flush) (void *); - u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr); -}; - -struct ath_common; -struct ath_bus_ops; - -struct ath_common { - void *ah; - void *priv; - struct ieee80211_hw *hw; - int debug_mask; - enum ath_device_state state; - - struct ath_ani ani; - - u16 cachelsz; - u16 curaid; - u8 macaddr[ETH_ALEN]; - u8 curbssid[ETH_ALEN]; - u8 bssidmask[ETH_ALEN]; - - u32 rx_bufsize; - - u32 keymax; - DECLARE_BITMAP(keymap, ATH_KEYMAX); - DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX); - DECLARE_BITMAP(ccmp_keymap, ATH_KEYMAX); - enum ath_crypt_caps crypt_caps; - - unsigned int clockrate; - - spinlock_t cc_lock; - struct ath_cycle_counters cc_ani; - struct ath_cycle_counters cc_survey; - - struct ath_regulatory regulatory; - struct ath_regulatory reg_world_copy; - const struct ath_ops *ops; - const struct ath_bus_ops *bus_ops; - - bool btcoex_enabled; - bool disable_ani; - bool antenna_diversity; -}; - -struct sk_buff *ath_rxbuf_alloc(struct ath_common *common, - u32 len, - gfp_t gfp_mask); - -void ath_hw_setbssidmask(struct ath_common *common); -void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf *key); -int ath_key_config(struct ath_common *common, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key); -bool ath_hw_keyreset(struct ath_common *common, u16 entry); -void ath_hw_cycle_counters_update(struct ath_common *common); -int32_t ath_hw_get_listen_time(struct ath_common *common); - -__printf(3, 4) -void ath_printk(const char *level, const struct ath_common *common, - const char *fmt, ...); - -#define ath_emerg(common, fmt, ...) \ - ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__) -#define ath_alert(common, fmt, ...) \ - ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__) -#define ath_crit(common, fmt, ...) \ - ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__) -#define ath_err(common, fmt, ...) \ - ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__) -#define ath_warn(common, fmt, ...) \ - ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__) -#define ath_notice(common, fmt, ...) \ - ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__) -#define ath_info(common, fmt, ...) \ - ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__) - -/** - * enum ath_debug_level - atheros wireless debug level - * - * @ATH_DBG_RESET: reset processing - * @ATH_DBG_QUEUE: hardware queue management - * @ATH_DBG_EEPROM: eeprom processing - * @ATH_DBG_CALIBRATE: periodic calibration - * @ATH_DBG_INTERRUPT: interrupt processing - * @ATH_DBG_REGULATORY: regulatory processing - * @ATH_DBG_ANI: adaptive noise immunitive processing - * @ATH_DBG_XMIT: basic xmit operation - * @ATH_DBG_BEACON: beacon handling - * @ATH_DBG_CONFIG: configuration of the hardware - * @ATH_DBG_FATAL: fatal errors, this is the default, DBG_DEFAULT - * @ATH_DBG_PS: power save processing - * @ATH_DBG_HWTIMER: hardware timer handling - * @ATH_DBG_BTCOEX: bluetooth coexistance - * @ATH_DBG_BSTUCK: stuck beacons - * @ATH_DBG_MCI: Message Coexistence Interface, a private protocol - * used exclusively for WLAN-BT coexistence starting from - * AR9462. - * @ATH_DBG_DFS: radar datection - * @ATH_DBG_WOW: Wake on Wireless - * @ATH_DBG_ANY: enable all debugging - * - * The debug level is used to control the amount and type of debugging output - * we want to see. Each driver has its own method for enabling debugging and - * modifying debug level states -- but this is typically done through a - * module parameter 'debug' along with a respective 'debug' debugfs file - * entry. - */ -enum ATH_DEBUG { - ATH_DBG_RESET = 0x00000001, - ATH_DBG_QUEUE = 0x00000002, - ATH_DBG_EEPROM = 0x00000004, - ATH_DBG_CALIBRATE = 0x00000008, - ATH_DBG_INTERRUPT = 0x00000010, - ATH_DBG_REGULATORY = 0x00000020, - ATH_DBG_ANI = 0x00000040, - ATH_DBG_XMIT = 0x00000080, - ATH_DBG_BEACON = 0x00000100, - ATH_DBG_CONFIG = 0x00000200, - ATH_DBG_FATAL = 0x00000400, - ATH_DBG_PS = 0x00000800, - ATH_DBG_HWTIMER = 0x00001000, - ATH_DBG_BTCOEX = 0x00002000, - ATH_DBG_WMI = 0x00004000, - ATH_DBG_BSTUCK = 0x00008000, - ATH_DBG_MCI = 0x00010000, - ATH_DBG_DFS = 0x00020000, - ATH_DBG_WOW = 0x00040000, - ATH_DBG_ANY = 0xffffffff -}; - -#define ATH_DBG_DEFAULT (ATH_DBG_FATAL) - -#ifdef CONFIG_ATH_DEBUG - -#define ath_dbg(common, dbg_mask, fmt, ...) \ -do { \ - if ((common)->debug_mask & ATH_DBG_##dbg_mask) \ - ath_printk(KERN_DEBUG, common, fmt, ##__VA_ARGS__); \ -} while (0) - -#define ATH_DBG_WARN(foo, arg...) WARN(foo, arg) -#define ATH_DBG_WARN_ON_ONCE(foo) WARN_ON_ONCE(foo) - -#else - -static inline __attribute__ ((format (printf, 3, 4))) -void _ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask, - const char *fmt, ...) -{ -} -#define ath_dbg(common, dbg_mask, fmt, ...) \ - _ath_dbg(common, ATH_DBG_##dbg_mask, fmt, ##__VA_ARGS__) - -#define ATH_DBG_WARN(foo, arg...) do {} while (0) -#define ATH_DBG_WARN_ON_ONCE(foo) ({ \ - int __ret_warn_once = !!(foo); \ - unlikely(__ret_warn_once); \ -}) - -#endif /* CONFIG_ATH_DEBUG */ - -/** Returns string describing opmode, or NULL if unknown mode. */ -#ifdef CONFIG_ATH_DEBUG -const char *ath_opmode_to_string(enum nl80211_iftype opmode); -#else -static inline const char *ath_opmode_to_string(enum nl80211_iftype opmode) -{ - return "UNKNOWN"; -} -#endif - -#endif /* ATH_H */ diff --git a/drivers/net/wireless/ath/ath5k/Kconfig b/drivers/net/wireless/ath/ath5k/Kconfig deleted file mode 100644 index c9f81a388f15..000000000000 --- a/drivers/net/wireless/ath/ath5k/Kconfig +++ /dev/null @@ -1,75 +0,0 @@ -config ATH5K - tristate "Atheros 5xxx wireless cards support" - depends on (PCI || ATHEROS_AR231X) && MAC80211 - select ATH_COMMON - select MAC80211_LEDS - select LEDS_CLASS - select NEW_LEDS - select AVERAGE - select ATH5K_AHB if (ATHEROS_AR231X && !PCI) - select ATH5K_PCI if (!ATHEROS_AR231X && PCI) - ---help--- - This module adds support for wireless adapters based on - Atheros 5xxx chipset. - - Currently the following chip versions are supported: - - MAC: AR5211 AR5212 - PHY: RF5111/2111 RF5112/2112 RF5413/2413 - - This driver uses the kernel's mac80211 subsystem. - - If you choose to build a module, it'll be called ath5k. Say M if - unsure. - -config ATH5K_DEBUG - bool "Atheros 5xxx debugging" - depends on ATH5K - ---help--- - Atheros 5xxx debugging messages. - - Say Y, if and you will get debug options for ath5k. - To use this, you need to mount debugfs: - - mount -t debugfs debug /sys/kernel/debug - - You will get access to files under: - /sys/kernel/debug/ath5k/phy0/ - - To enable debug, pass the debug level to the debug module - parameter. For example: - - modprobe ath5k debug=0x00000400 - -config ATH5K_TRACER - bool "Atheros 5xxx tracer" - depends on ATH5K - depends on EVENT_TRACING - ---help--- - Say Y here to enable tracepoints for the ath5k driver - using the kernel tracing infrastructure. Select this - option if you are interested in debugging the driver. - - If unsure, say N. - -config ATH5K_AHB - bool "Atheros 5xxx AHB bus support" - depends on (ATHEROS_AR231X && !PCI) - ---help--- - This adds support for WiSoC type chipsets of the 5xxx Atheros - family. - -config ATH5K_PCI - bool "Atheros 5xxx PCI bus support" - depends on (!ATHEROS_AR231X && PCI) - ---help--- - This adds support for PCI type chipsets of the 5xxx Atheros - family. - -config ATH5K_TEST_CHANNELS - bool "Enables testing channels on ath5k" - depends on ATH5K && CFG80211_CERTIFICATION_ONUS - ---help--- - This enables non-standard IEEE 802.11 channels on ath5k, which - can be used for research purposes. This option should be disabled - unless doing research. diff --git a/drivers/net/wireless/ath/ath5k/Makefile b/drivers/net/wireless/ath/ath5k/Makefile deleted file mode 100644 index 1b3a34f7f224..000000000000 --- a/drivers/net/wireless/ath/ath5k/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -ath5k-y += caps.o -ath5k-y += initvals.o -ath5k-y += eeprom.o -ath5k-y += gpio.o -ath5k-y += desc.o -ath5k-y += dma.o -ath5k-y += qcu.o -ath5k-y += pcu.o -ath5k-y += phy.o -ath5k-y += reset.o -ath5k-y += attach.o -ath5k-y += base.o -CFLAGS_base.o += -I$(src) -ath5k-y += led.o -ath5k-y += rfkill.o -ath5k-y += ani.o -ath5k-y += sysfs.o -ath5k-y += mac80211-ops.o -ath5k-$(CONFIG_ATH5K_DEBUG) += debug.o -ath5k-$(CONFIG_ATH5K_AHB) += ahb.o -ath5k-$(CONFIG_ATH5K_PCI) += pci.o -obj-$(CONFIG_ATH5K) += ath5k.o diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c deleted file mode 100644 index 8e8bcc7a4805..000000000000 --- a/drivers/net/wireless/ath/ath5k/ahb.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (c) 2008-2009 Atheros Communications Inc. - * Copyright (c) 2009 Gabor Juhos - * Copyright (c) 2009 Imre Kaloz - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include "ath5k.h" -#include "debug.h" -#include "base.h" -#include "reg.h" - -/* return bus cachesize in 4B word units */ -static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz) -{ - *csz = L1_CACHE_BYTES >> 2; -} - -static bool -ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data) -{ - struct ath5k_hw *ah = common->priv; - struct platform_device *pdev = to_platform_device(ah->dev); - struct ar231x_board_config *bcfg = pdev->dev.platform_data; - u16 *eeprom, *eeprom_end; - - - - bcfg = pdev->dev.platform_data; - eeprom = (u16 *) bcfg->radio; - eeprom_end = ((void *) bcfg->config) + BOARD_CONFIG_BUFSZ; - - eeprom += off; - if (eeprom > eeprom_end) - return false; - - *data = *eeprom; - return true; -} - -int ath5k_hw_read_srev(struct ath5k_hw *ah) -{ - struct platform_device *pdev = to_platform_device(ah->dev); - struct ar231x_board_config *bcfg = pdev->dev.platform_data; - ah->ah_mac_srev = bcfg->devid; - return 0; -} - -static int ath5k_ahb_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac) -{ - struct platform_device *pdev = to_platform_device(ah->dev); - struct ar231x_board_config *bcfg = pdev->dev.platform_data; - u8 *cfg_mac; - - if (to_platform_device(ah->dev)->id == 0) - cfg_mac = bcfg->config->wlan0_mac; - else - cfg_mac = bcfg->config->wlan1_mac; - - memcpy(mac, cfg_mac, ETH_ALEN); - return 0; -} - -static const struct ath_bus_ops ath_ahb_bus_ops = { - .ath_bus_type = ATH_AHB, - .read_cachesize = ath5k_ahb_read_cachesize, - .eeprom_read = ath5k_ahb_eeprom_read, - .eeprom_read_mac = ath5k_ahb_eeprom_read_mac, -}; - -/*Initialization*/ -static int ath_ahb_probe(struct platform_device *pdev) -{ - struct ar231x_board_config *bcfg = pdev->dev.platform_data; - struct ath5k_hw *ah; - struct ieee80211_hw *hw; - struct resource *res; - void __iomem *mem; - int irq; - int ret = 0; - u32 reg; - - if (!pdev->dev.platform_data) { - dev_err(&pdev->dev, "no platform data specified\n"); - ret = -EINVAL; - goto err_out; - } - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res == NULL) { - dev_err(&pdev->dev, "no memory resource found\n"); - ret = -ENXIO; - goto err_out; - } - - mem = ioremap_nocache(res->start, resource_size(res)); - if (mem == NULL) { - dev_err(&pdev->dev, "ioremap failed\n"); - ret = -ENOMEM; - goto err_out; - } - - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (res == NULL) { - dev_err(&pdev->dev, "no IRQ resource found\n"); - ret = -ENXIO; - goto err_iounmap; - } - - irq = res->start; - - hw = ieee80211_alloc_hw(sizeof(struct ath5k_hw), &ath5k_hw_ops); - if (hw == NULL) { - dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); - ret = -ENOMEM; - goto err_iounmap; - } - - ah = hw->priv; - ah->hw = hw; - ah->dev = &pdev->dev; - ah->iobase = mem; - ah->irq = irq; - ah->devid = bcfg->devid; - - if (bcfg->devid >= AR5K_SREV_AR2315_R6) { - /* Enable WMAC AHB arbitration */ - reg = ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_CTL); - reg |= AR5K_AR2315_AHB_ARB_CTL_WLAN; - iowrite32(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL); - - /* Enable global WMAC swapping */ - reg = ioread32((void __iomem *) AR5K_AR2315_BYTESWAP); - reg |= AR5K_AR2315_BYTESWAP_WMAC; - iowrite32(reg, (void __iomem *) AR5K_AR2315_BYTESWAP); - } else { - /* Enable WMAC DMA access (assuming 5312 or 231x*/ - /* TODO: check other platforms */ - reg = ioread32((void __iomem *) AR5K_AR5312_ENABLE); - if (to_platform_device(ah->dev)->id == 0) - reg |= AR5K_AR5312_ENABLE_WLAN0; - else - reg |= AR5K_AR5312_ENABLE_WLAN1; - iowrite32(reg, (void __iomem *) AR5K_AR5312_ENABLE); - - /* - * On a dual-band AR5312, the multiband radio is only - * used as pass-through. Disable 2 GHz support in the - * driver for it - */ - if (to_platform_device(ah->dev)->id == 0 && - (bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) == - (BD_WLAN1 | BD_WLAN0)) - ah->ah_capabilities.cap_needs_2GHz_ovr = true; - else - ah->ah_capabilities.cap_needs_2GHz_ovr = false; - } - - ret = ath5k_init_ah(ah, &ath_ahb_bus_ops); - if (ret != 0) { - dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret); - ret = -ENODEV; - goto err_free_hw; - } - - platform_set_drvdata(pdev, hw); - - return 0; - - err_free_hw: - ieee80211_free_hw(hw); - platform_set_drvdata(pdev, NULL); - err_iounmap: - iounmap(mem); - err_out: - return ret; -} - -static int ath_ahb_remove(struct platform_device *pdev) -{ - struct ar231x_board_config *bcfg = pdev->dev.platform_data; - struct ieee80211_hw *hw = platform_get_drvdata(pdev); - struct ath5k_hw *ah; - u32 reg; - - if (!hw) - return 0; - - ah = hw->priv; - - if (bcfg->devid >= AR5K_SREV_AR2315_R6) { - /* Disable WMAC AHB arbitration */ - reg = ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_CTL); - reg &= ~AR5K_AR2315_AHB_ARB_CTL_WLAN; - iowrite32(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL); - } else { - /*Stop DMA access */ - reg = ioread32((void __iomem *) AR5K_AR5312_ENABLE); - if (to_platform_device(ah->dev)->id == 0) - reg &= ~AR5K_AR5312_ENABLE_WLAN0; - else - reg &= ~AR5K_AR5312_ENABLE_WLAN1; - iowrite32(reg, (void __iomem *) AR5K_AR5312_ENABLE); - } - - ath5k_deinit_ah(ah); - iounmap(ah->iobase); - platform_set_drvdata(pdev, NULL); - ieee80211_free_hw(hw); - - return 0; -} - -static struct platform_driver ath_ahb_driver = { - .probe = ath_ahb_probe, - .remove = ath_ahb_remove, - .driver = { - .name = "ar231x-wmac", - .owner = THIS_MODULE, - }, -}; - -module_platform_driver(ath_ahb_driver); diff --git a/drivers/net/wireless/ath/ath5k/ani.c b/drivers/net/wireless/ath/ath5k/ani.c deleted file mode 100644 index 5c008757662b..000000000000 --- a/drivers/net/wireless/ath/ath5k/ani.c +++ /dev/null @@ -1,754 +0,0 @@ -/* - * Copyright (C) 2010 Bruno Randolf - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include "ath5k.h" -#include "reg.h" -#include "debug.h" -#include "ani.h" - -/** - * DOC: Basic ANI Operation - * - * Adaptive Noise Immunity (ANI) controls five noise immunity parameters - * depending on the amount of interference in the environment, increasing - * or reducing sensitivity as necessary. - * - * The parameters are: - * - * - "noise immunity" - * - * - "spur immunity" - * - * - "firstep level" - * - * - "OFDM weak signal detection" - * - * - "CCK weak signal detection" - * - * Basically we look at the amount of ODFM and CCK timing errors we get and then - * raise or lower immunity accordingly by setting one or more of these - * parameters. - * - * Newer chipsets have PHY error counters in hardware which will generate a MIB - * interrupt when they overflow. Older hardware has too enable PHY error frames - * by setting a RX flag and then count every single PHY error. When a specified - * threshold of errors has been reached we will raise immunity. - * Also we regularly check the amount of errors and lower or raise immunity as - * necessary. - */ - - -/***********************\ -* ANI parameter control * -\***********************/ - -/** - * ath5k_ani_set_noise_immunity_level() - Set noise immunity level - * @ah: The &struct ath5k_hw - * @level: level between 0 and @ATH5K_ANI_MAX_NOISE_IMM_LVL - */ -void -ath5k_ani_set_noise_immunity_level(struct ath5k_hw *ah, int level) -{ - /* TODO: - * ANI documents suggest the following five levels to use, but the HAL - * and ath9k use only the last two levels, making this - * essentially an on/off option. There *may* be a reason for this (???), - * so i stick with the HAL version for now... - */ -#if 0 - static const s8 lo[] = { -52, -56, -60, -64, -70 }; - static const s8 hi[] = { -18, -18, -16, -14, -12 }; - static const s8 sz[] = { -34, -41, -48, -55, -62 }; - static const s8 fr[] = { -70, -72, -75, -78, -80 }; -#else - static const s8 lo[] = { -64, -70 }; - static const s8 hi[] = { -14, -12 }; - static const s8 sz[] = { -55, -62 }; - static const s8 fr[] = { -78, -80 }; -#endif - if (level < 0 || level >= ARRAY_SIZE(sz)) { - ATH5K_ERR(ah, "noise immunity level %d out of range", - level); - return; - } - - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_DESIRED_SIZE, - AR5K_PHY_DESIRED_SIZE_TOT, sz[level]); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_AGCCOARSE, - AR5K_PHY_AGCCOARSE_LO, lo[level]); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_AGCCOARSE, - AR5K_PHY_AGCCOARSE_HI, hi[level]); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SIG, - AR5K_PHY_SIG_FIRPWR, fr[level]); - - ah->ani_state.noise_imm_level = level; - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "new level %d", level); -} - -/** - * ath5k_ani_set_spur_immunity_level() - Set spur immunity level - * @ah: The &struct ath5k_hw - * @level: level between 0 and @max_spur_level (the maximum level is dependent - * on the chip revision). - */ -void -ath5k_ani_set_spur_immunity_level(struct ath5k_hw *ah, int level) -{ - static const int val[] = { 2, 4, 6, 8, 10, 12, 14, 16 }; - - if (level < 0 || level >= ARRAY_SIZE(val) || - level > ah->ani_state.max_spur_level) { - ATH5K_ERR(ah, "spur immunity level %d out of range", - level); - return; - } - - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_OFDM_SELFCORR, - AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1, val[level]); - - ah->ani_state.spur_level = level; - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "new level %d", level); -} - -/** - * ath5k_ani_set_firstep_level() - Set "firstep" level - * @ah: The &struct ath5k_hw - * @level: level between 0 and @ATH5K_ANI_MAX_FIRSTEP_LVL - */ -void -ath5k_ani_set_firstep_level(struct ath5k_hw *ah, int level) -{ - static const int val[] = { 0, 4, 8 }; - - if (level < 0 || level >= ARRAY_SIZE(val)) { - ATH5K_ERR(ah, "firstep level %d out of range", level); - return; - } - - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SIG, - AR5K_PHY_SIG_FIRSTEP, val[level]); - - ah->ani_state.firstep_level = level; - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "new level %d", level); -} - -/** - * ath5k_ani_set_ofdm_weak_signal_detection() - Set OFDM weak signal detection - * @ah: The &struct ath5k_hw - * @on: turn on or off - */ -void -ath5k_ani_set_ofdm_weak_signal_detection(struct ath5k_hw *ah, bool on) -{ - static const int m1l[] = { 127, 50 }; - static const int m2l[] = { 127, 40 }; - static const int m1[] = { 127, 0x4d }; - static const int m2[] = { 127, 0x40 }; - static const int m2cnt[] = { 31, 16 }; - static const int m2lcnt[] = { 63, 48 }; - - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR, - AR5K_PHY_WEAK_OFDM_LOW_THR_M1, m1l[on]); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR, - AR5K_PHY_WEAK_OFDM_LOW_THR_M2, m2l[on]); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_HIGH_THR, - AR5K_PHY_WEAK_OFDM_HIGH_THR_M1, m1[on]); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_HIGH_THR, - AR5K_PHY_WEAK_OFDM_HIGH_THR_M2, m2[on]); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_HIGH_THR, - AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_COUNT, m2cnt[on]); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR, - AR5K_PHY_WEAK_OFDM_LOW_THR_M2_COUNT, m2lcnt[on]); - - if (on) - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR, - AR5K_PHY_WEAK_OFDM_LOW_THR_SELFCOR_EN); - else - AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR, - AR5K_PHY_WEAK_OFDM_LOW_THR_SELFCOR_EN); - - ah->ani_state.ofdm_weak_sig = on; - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "turned %s", - on ? "on" : "off"); -} - -/** - * ath5k_ani_set_cck_weak_signal_detection() - Set CCK weak signal detection - * @ah: The &struct ath5k_hw - * @on: turn on or off - */ -void -ath5k_ani_set_cck_weak_signal_detection(struct ath5k_hw *ah, bool on) -{ - static const int val[] = { 8, 6 }; - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_CCK_CROSSCORR, - AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR, val[on]); - ah->ani_state.cck_weak_sig = on; - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "turned %s", - on ? "on" : "off"); -} - - -/***************\ -* ANI algorithm * -\***************/ - -/** - * ath5k_ani_raise_immunity() - Increase noise immunity - * @ah: The &struct ath5k_hw - * @as: The &struct ath5k_ani_state - * @ofdm_trigger: If this is true we are called because of too many OFDM errors, - * the algorithm will tune more parameters then. - * - * Try to raise noise immunity (=decrease sensitivity) in several steps - * depending on the average RSSI of the beacons we received. - */ -static void -ath5k_ani_raise_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as, - bool ofdm_trigger) -{ - int rssi = ewma_read(&ah->ah_beacon_rssi_avg); - - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "raise immunity (%s)", - ofdm_trigger ? "ODFM" : "CCK"); - - /* first: raise noise immunity */ - if (as->noise_imm_level < ATH5K_ANI_MAX_NOISE_IMM_LVL) { - ath5k_ani_set_noise_immunity_level(ah, as->noise_imm_level + 1); - return; - } - - /* only OFDM: raise spur immunity level */ - if (ofdm_trigger && - as->spur_level < ah->ani_state.max_spur_level) { - ath5k_ani_set_spur_immunity_level(ah, as->spur_level + 1); - return; - } - - /* AP mode */ - if (ah->opmode == NL80211_IFTYPE_AP) { - if (as->firstep_level < ATH5K_ANI_MAX_FIRSTEP_LVL) - ath5k_ani_set_firstep_level(ah, as->firstep_level + 1); - return; - } - - /* STA and IBSS mode */ - - /* TODO: for IBSS mode it would be better to keep a beacon RSSI average - * per each neighbour node and use the minimum of these, to make sure we - * don't shut out a remote node by raising immunity too high. */ - - if (rssi > ATH5K_ANI_RSSI_THR_HIGH) { - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, - "beacon RSSI high"); - /* only OFDM: beacon RSSI is high, we can disable ODFM weak - * signal detection */ - if (ofdm_trigger && as->ofdm_weak_sig) { - ath5k_ani_set_ofdm_weak_signal_detection(ah, false); - ath5k_ani_set_spur_immunity_level(ah, 0); - return; - } - /* as a last resort or CCK: raise firstep level */ - if (as->firstep_level < ATH5K_ANI_MAX_FIRSTEP_LVL) { - ath5k_ani_set_firstep_level(ah, as->firstep_level + 1); - return; - } - } else if (rssi > ATH5K_ANI_RSSI_THR_LOW) { - /* beacon RSSI in mid range, we need OFDM weak signal detect, - * but can raise firstep level */ - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, - "beacon RSSI mid"); - if (ofdm_trigger && !as->ofdm_weak_sig) - ath5k_ani_set_ofdm_weak_signal_detection(ah, true); - if (as->firstep_level < ATH5K_ANI_MAX_FIRSTEP_LVL) - ath5k_ani_set_firstep_level(ah, as->firstep_level + 1); - return; - } else if (ah->ah_current_channel->band == IEEE80211_BAND_2GHZ) { - /* beacon RSSI is low. in B/G mode turn of OFDM weak signal - * detect and zero firstep level to maximize CCK sensitivity */ - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, - "beacon RSSI low, 2GHz"); - if (ofdm_trigger && as->ofdm_weak_sig) - ath5k_ani_set_ofdm_weak_signal_detection(ah, false); - if (as->firstep_level > 0) - ath5k_ani_set_firstep_level(ah, 0); - return; - } - - /* TODO: why not?: - if (as->cck_weak_sig == true) { - ath5k_ani_set_cck_weak_signal_detection(ah, false); - } - */ -} - -/** - * ath5k_ani_lower_immunity() - Decrease noise immunity - * @ah: The &struct ath5k_hw - * @as: The &struct ath5k_ani_state - * - * Try to lower noise immunity (=increase sensitivity) in several steps - * depending on the average RSSI of the beacons we received. - */ -static void -ath5k_ani_lower_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as) -{ - int rssi = ewma_read(&ah->ah_beacon_rssi_avg); - - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "lower immunity"); - - if (ah->opmode == NL80211_IFTYPE_AP) { - /* AP mode */ - if (as->firstep_level > 0) { - ath5k_ani_set_firstep_level(ah, as->firstep_level - 1); - return; - } - } else { - /* STA and IBSS mode (see TODO above) */ - if (rssi > ATH5K_ANI_RSSI_THR_HIGH) { - /* beacon signal is high, leave OFDM weak signal - * detection off or it may oscillate - * TODO: who said it's off??? */ - } else if (rssi > ATH5K_ANI_RSSI_THR_LOW) { - /* beacon RSSI is mid-range: turn on ODFM weak signal - * detection and next, lower firstep level */ - if (!as->ofdm_weak_sig) { - ath5k_ani_set_ofdm_weak_signal_detection(ah, - true); - return; - } - if (as->firstep_level > 0) { - ath5k_ani_set_firstep_level(ah, - as->firstep_level - 1); - return; - } - } else { - /* beacon signal is low: only reduce firstep level */ - if (as->firstep_level > 0) { - ath5k_ani_set_firstep_level(ah, - as->firstep_level - 1); - return; - } - } - } - - /* all modes */ - if (as->spur_level > 0) { - ath5k_ani_set_spur_immunity_level(ah, as->spur_level - 1); - return; - } - - /* finally, reduce noise immunity */ - if (as->noise_imm_level > 0) { - ath5k_ani_set_noise_immunity_level(ah, as->noise_imm_level - 1); - return; - } -} - -/** - * ath5k_hw_ani_get_listen_time() - Update counters and return listening time - * @ah: The &struct ath5k_hw - * @as: The &struct ath5k_ani_state - * - * Return an approximation of the time spent "listening" in milliseconds (ms) - * since the last call of this function. - * Save a snapshot of the counter values for debugging/statistics. - */ -static int -ath5k_hw_ani_get_listen_time(struct ath5k_hw *ah, struct ath5k_ani_state *as) -{ - struct ath_common *common = ath5k_hw_common(ah); - int listen; - - spin_lock_bh(&common->cc_lock); - - ath_hw_cycle_counters_update(common); - memcpy(&as->last_cc, &common->cc_ani, sizeof(as->last_cc)); - - /* clears common->cc_ani */ - listen = ath_hw_get_listen_time(common); - - spin_unlock_bh(&common->cc_lock); - - return listen; -} - -/** - * ath5k_ani_save_and_clear_phy_errors() - Clear and save PHY error counters - * @ah: The &struct ath5k_hw - * @as: The &struct ath5k_ani_state - * - * Clear the PHY error counters as soon as possible, since this might be called - * from a MIB interrupt and we want to make sure we don't get interrupted again. - * Add the count of CCK and OFDM errors to our internal state, so it can be used - * by the algorithm later. - * - * Will be called from interrupt and tasklet context. - * Returns 0 if both counters are zero. - */ -static int -ath5k_ani_save_and_clear_phy_errors(struct ath5k_hw *ah, - struct ath5k_ani_state *as) -{ - unsigned int ofdm_err, cck_err; - - if (!ah->ah_capabilities.cap_has_phyerr_counters) - return 0; - - ofdm_err = ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT1); - cck_err = ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT2); - - /* reset counters first, we might be in a hurry (interrupt) */ - ath5k_hw_reg_write(ah, ATH5K_PHYERR_CNT_MAX - ATH5K_ANI_OFDM_TRIG_HIGH, - AR5K_PHYERR_CNT1); - ath5k_hw_reg_write(ah, ATH5K_PHYERR_CNT_MAX - ATH5K_ANI_CCK_TRIG_HIGH, - AR5K_PHYERR_CNT2); - - ofdm_err = ATH5K_ANI_OFDM_TRIG_HIGH - (ATH5K_PHYERR_CNT_MAX - ofdm_err); - cck_err = ATH5K_ANI_CCK_TRIG_HIGH - (ATH5K_PHYERR_CNT_MAX - cck_err); - - /* sometimes both can be zero, especially when there is a superfluous - * second interrupt. detect that here and return an error. */ - if (ofdm_err <= 0 && cck_err <= 0) - return 0; - - /* avoid negative values should one of the registers overflow */ - if (ofdm_err > 0) { - as->ofdm_errors += ofdm_err; - as->sum_ofdm_errors += ofdm_err; - } - if (cck_err > 0) { - as->cck_errors += cck_err; - as->sum_cck_errors += cck_err; - } - return 1; -} - -/** - * ath5k_ani_period_restart() - Restart ANI period - * @as: The &struct ath5k_ani_state - * - * Just reset counters, so they are clear for the next "ani period". - */ -static void -ath5k_ani_period_restart(struct ath5k_ani_state *as) -{ - /* keep last values for debugging */ - as->last_ofdm_errors = as->ofdm_errors; - as->last_cck_errors = as->cck_errors; - as->last_listen = as->listen_time; - - as->ofdm_errors = 0; - as->cck_errors = 0; - as->listen_time = 0; -} - -/** - * ath5k_ani_calibration() - The main ANI calibration function - * @ah: The &struct ath5k_hw - * - * We count OFDM and CCK errors relative to the time where we did not send or - * receive ("listen" time) and raise or lower immunity accordingly. - * This is called regularly (every second) from the calibration timer, but also - * when an error threshold has been reached. - * - * In order to synchronize access from different contexts, this should be - * called only indirectly by scheduling the ANI tasklet! - */ -void -ath5k_ani_calibration(struct ath5k_hw *ah) -{ - struct ath5k_ani_state *as = &ah->ani_state; - int listen, ofdm_high, ofdm_low, cck_high, cck_low; - - /* get listen time since last call and add it to the counter because we - * might not have restarted the "ani period" last time. - * always do this to calculate the busy time also in manual mode */ - listen = ath5k_hw_ani_get_listen_time(ah, as); - as->listen_time += listen; - - if (as->ani_mode != ATH5K_ANI_MODE_AUTO) - return; - - ath5k_ani_save_and_clear_phy_errors(ah, as); - - ofdm_high = as->listen_time * ATH5K_ANI_OFDM_TRIG_HIGH / 1000; - cck_high = as->listen_time * ATH5K_ANI_CCK_TRIG_HIGH / 1000; - ofdm_low = as->listen_time * ATH5K_ANI_OFDM_TRIG_LOW / 1000; - cck_low = as->listen_time * ATH5K_ANI_CCK_TRIG_LOW / 1000; - - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, - "listen %d (now %d)", as->listen_time, listen); - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, - "check high ofdm %d/%d cck %d/%d", - as->ofdm_errors, ofdm_high, as->cck_errors, cck_high); - - if (as->ofdm_errors > ofdm_high || as->cck_errors > cck_high) { - /* too many PHY errors - we have to raise immunity */ - bool ofdm_flag = as->ofdm_errors > ofdm_high ? true : false; - ath5k_ani_raise_immunity(ah, as, ofdm_flag); - ath5k_ani_period_restart(as); - - } else if (as->listen_time > 5 * ATH5K_ANI_LISTEN_PERIOD) { - /* If more than 5 (TODO: why 5?) periods have passed and we got - * relatively little errors we can try to lower immunity */ - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, - "check low ofdm %d/%d cck %d/%d", - as->ofdm_errors, ofdm_low, as->cck_errors, cck_low); - - if (as->ofdm_errors <= ofdm_low && as->cck_errors <= cck_low) - ath5k_ani_lower_immunity(ah, as); - - ath5k_ani_period_restart(as); - } -} - - -/*******************\ -* Interrupt handler * -\*******************/ - -/** - * ath5k_ani_mib_intr() - Interrupt handler for ANI MIB counters - * @ah: The &struct ath5k_hw - * - * Just read & reset the registers quickly, so they don't generate more - * interrupts, save the counters and schedule the tasklet to decide whether - * to raise immunity or not. - * - * We just need to handle PHY error counters, ath5k_hw_update_mib_counters() - * should take care of all "normal" MIB interrupts. - */ -void -ath5k_ani_mib_intr(struct ath5k_hw *ah) -{ - struct ath5k_ani_state *as = &ah->ani_state; - - /* nothing to do here if HW does not have PHY error counters - they - * can't be the reason for the MIB interrupt then */ - if (!ah->ah_capabilities.cap_has_phyerr_counters) - return; - - /* not in use but clear anyways */ - ath5k_hw_reg_write(ah, 0, AR5K_OFDM_FIL_CNT); - ath5k_hw_reg_write(ah, 0, AR5K_CCK_FIL_CNT); - - if (ah->ani_state.ani_mode != ATH5K_ANI_MODE_AUTO) - return; - - /* If one of the errors triggered, we can get a superfluous second - * interrupt, even though we have already reset the register. The - * function detects that so we can return early. */ - if (ath5k_ani_save_and_clear_phy_errors(ah, as) == 0) - return; - - if (as->ofdm_errors > ATH5K_ANI_OFDM_TRIG_HIGH || - as->cck_errors > ATH5K_ANI_CCK_TRIG_HIGH) - tasklet_schedule(&ah->ani_tasklet); -} - -/** - * ath5k_ani_phy_error_report - Used by older HW to report PHY errors - * - * @ah: The &struct ath5k_hw - * @phyerr: One of enum ath5k_phy_error_code - * - * This is used by hardware without PHY error counters to report PHY errors - * on a frame-by-frame basis, instead of the interrupt. - */ -void -ath5k_ani_phy_error_report(struct ath5k_hw *ah, - enum ath5k_phy_error_code phyerr) -{ - struct ath5k_ani_state *as = &ah->ani_state; - - if (phyerr == AR5K_RX_PHY_ERROR_OFDM_TIMING) { - as->ofdm_errors++; - if (as->ofdm_errors > ATH5K_ANI_OFDM_TRIG_HIGH) - tasklet_schedule(&ah->ani_tasklet); - } else if (phyerr == AR5K_RX_PHY_ERROR_CCK_TIMING) { - as->cck_errors++; - if (as->cck_errors > ATH5K_ANI_CCK_TRIG_HIGH) - tasklet_schedule(&ah->ani_tasklet); - } -} - - -/****************\ -* Initialization * -\****************/ - -/** - * ath5k_enable_phy_err_counters() - Enable PHY error counters - * @ah: The &struct ath5k_hw - * - * Enable PHY error counters for OFDM and CCK timing errors. - */ -static void -ath5k_enable_phy_err_counters(struct ath5k_hw *ah) -{ - ath5k_hw_reg_write(ah, ATH5K_PHYERR_CNT_MAX - ATH5K_ANI_OFDM_TRIG_HIGH, - AR5K_PHYERR_CNT1); - ath5k_hw_reg_write(ah, ATH5K_PHYERR_CNT_MAX - ATH5K_ANI_CCK_TRIG_HIGH, - AR5K_PHYERR_CNT2); - ath5k_hw_reg_write(ah, AR5K_PHY_ERR_FIL_OFDM, AR5K_PHYERR_CNT1_MASK); - ath5k_hw_reg_write(ah, AR5K_PHY_ERR_FIL_CCK, AR5K_PHYERR_CNT2_MASK); - - /* not in use */ - ath5k_hw_reg_write(ah, 0, AR5K_OFDM_FIL_CNT); - ath5k_hw_reg_write(ah, 0, AR5K_CCK_FIL_CNT); -} - -/** - * ath5k_disable_phy_err_counters() - Disable PHY error counters - * @ah: The &struct ath5k_hw - * - * Disable PHY error counters for OFDM and CCK timing errors. - */ -static void -ath5k_disable_phy_err_counters(struct ath5k_hw *ah) -{ - ath5k_hw_reg_write(ah, 0, AR5K_PHYERR_CNT1); - ath5k_hw_reg_write(ah, 0, AR5K_PHYERR_CNT2); - ath5k_hw_reg_write(ah, 0, AR5K_PHYERR_CNT1_MASK); - ath5k_hw_reg_write(ah, 0, AR5K_PHYERR_CNT2_MASK); - - /* not in use */ - ath5k_hw_reg_write(ah, 0, AR5K_OFDM_FIL_CNT); - ath5k_hw_reg_write(ah, 0, AR5K_CCK_FIL_CNT); -} - -/** - * ath5k_ani_init() - Initialize ANI - * @ah: The &struct ath5k_hw - * @mode: One of enum ath5k_ani_mode - * - * Initialize ANI according to mode. - */ -void -ath5k_ani_init(struct ath5k_hw *ah, enum ath5k_ani_mode mode) -{ - /* ANI is only possible on 5212 and newer */ - if (ah->ah_version < AR5K_AR5212) - return; - - if (mode < ATH5K_ANI_MODE_OFF || mode > ATH5K_ANI_MODE_AUTO) { - ATH5K_ERR(ah, "ANI mode %d out of range", mode); - return; - } - - /* clear old state information */ - memset(&ah->ani_state, 0, sizeof(ah->ani_state)); - - /* older hardware has more spur levels than newer */ - if (ah->ah_mac_srev < AR5K_SREV_AR2414) - ah->ani_state.max_spur_level = 7; - else - ah->ani_state.max_spur_level = 2; - - /* initial values for our ani parameters */ - if (mode == ATH5K_ANI_MODE_OFF) { - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "ANI off\n"); - } else if (mode == ATH5K_ANI_MODE_MANUAL_LOW) { - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, - "ANI manual low -> high sensitivity\n"); - ath5k_ani_set_noise_immunity_level(ah, 0); - ath5k_ani_set_spur_immunity_level(ah, 0); - ath5k_ani_set_firstep_level(ah, 0); - ath5k_ani_set_ofdm_weak_signal_detection(ah, true); - ath5k_ani_set_cck_weak_signal_detection(ah, true); - } else if (mode == ATH5K_ANI_MODE_MANUAL_HIGH) { - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, - "ANI manual high -> low sensitivity\n"); - ath5k_ani_set_noise_immunity_level(ah, - ATH5K_ANI_MAX_NOISE_IMM_LVL); - ath5k_ani_set_spur_immunity_level(ah, - ah->ani_state.max_spur_level); - ath5k_ani_set_firstep_level(ah, ATH5K_ANI_MAX_FIRSTEP_LVL); - ath5k_ani_set_ofdm_weak_signal_detection(ah, false); - ath5k_ani_set_cck_weak_signal_detection(ah, false); - } else if (mode == ATH5K_ANI_MODE_AUTO) { - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "ANI auto\n"); - ath5k_ani_set_noise_immunity_level(ah, 0); - ath5k_ani_set_spur_immunity_level(ah, 0); - ath5k_ani_set_firstep_level(ah, 0); - ath5k_ani_set_ofdm_weak_signal_detection(ah, true); - ath5k_ani_set_cck_weak_signal_detection(ah, false); - } - - /* newer hardware has PHY error counter registers which we can use to - * get OFDM and CCK error counts. older hardware has to set rxfilter and - * report every single PHY error by calling ath5k_ani_phy_error_report() - */ - if (mode == ATH5K_ANI_MODE_AUTO) { - if (ah->ah_capabilities.cap_has_phyerr_counters) - ath5k_enable_phy_err_counters(ah); - else - ath5k_hw_set_rx_filter(ah, ath5k_hw_get_rx_filter(ah) | - AR5K_RX_FILTER_PHYERR); - } else { - if (ah->ah_capabilities.cap_has_phyerr_counters) - ath5k_disable_phy_err_counters(ah); - else - ath5k_hw_set_rx_filter(ah, ath5k_hw_get_rx_filter(ah) & - ~AR5K_RX_FILTER_PHYERR); - } - - ah->ani_state.ani_mode = mode; -} - - -/**************\ -* Debug output * -\**************/ - -#ifdef CONFIG_ATH5K_DEBUG - -/** - * ath5k_ani_print_counters() - Print ANI counters - * @ah: The &struct ath5k_hw - * - * Used for debugging ANI - */ -void -ath5k_ani_print_counters(struct ath5k_hw *ah) -{ - /* clears too */ - pr_notice("ACK fail\t%d\n", ath5k_hw_reg_read(ah, AR5K_ACK_FAIL)); - pr_notice("RTS fail\t%d\n", ath5k_hw_reg_read(ah, AR5K_RTS_FAIL)); - pr_notice("RTS success\t%d\n", ath5k_hw_reg_read(ah, AR5K_RTS_OK)); - pr_notice("FCS error\t%d\n", ath5k_hw_reg_read(ah, AR5K_FCS_FAIL)); - - /* no clear */ - pr_notice("tx\t%d\n", ath5k_hw_reg_read(ah, AR5K_PROFCNT_TX)); - pr_notice("rx\t%d\n", ath5k_hw_reg_read(ah, AR5K_PROFCNT_RX)); - pr_notice("busy\t%d\n", ath5k_hw_reg_read(ah, AR5K_PROFCNT_RXCLR)); - pr_notice("cycles\t%d\n", ath5k_hw_reg_read(ah, AR5K_PROFCNT_CYCLE)); - - pr_notice("AR5K_PHYERR_CNT1\t%d\n", - ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT1)); - pr_notice("AR5K_PHYERR_CNT2\t%d\n", - ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT2)); - pr_notice("AR5K_OFDM_FIL_CNT\t%d\n", - ath5k_hw_reg_read(ah, AR5K_OFDM_FIL_CNT)); - pr_notice("AR5K_CCK_FIL_CNT\t%d\n", - ath5k_hw_reg_read(ah, AR5K_CCK_FIL_CNT)); -} - -#endif diff --git a/drivers/net/wireless/ath/ath5k/ani.h b/drivers/net/wireless/ath/ath5k/ani.h deleted file mode 100644 index 21aa355460bb..000000000000 --- a/drivers/net/wireless/ath/ath5k/ani.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (C) 2010 Bruno Randolf - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef ANI_H -#define ANI_H - -#include "../ath.h" - -enum ath5k_phy_error_code; - -/* these thresholds are relative to the ATH5K_ANI_LISTEN_PERIOD */ -#define ATH5K_ANI_LISTEN_PERIOD 100 -#define ATH5K_ANI_OFDM_TRIG_HIGH 500 -#define ATH5K_ANI_OFDM_TRIG_LOW 200 -#define ATH5K_ANI_CCK_TRIG_HIGH 200 -#define ATH5K_ANI_CCK_TRIG_LOW 100 - -/* average beacon RSSI thresholds */ -#define ATH5K_ANI_RSSI_THR_HIGH 40 -#define ATH5K_ANI_RSSI_THR_LOW 7 - -/* maximum available levels */ -#define ATH5K_ANI_MAX_FIRSTEP_LVL 2 -#define ATH5K_ANI_MAX_NOISE_IMM_LVL 1 - - -/** - * enum ath5k_ani_mode - mode for ANI / noise sensitivity - * - * @ATH5K_ANI_MODE_OFF: Turn ANI off. This can be useful to just stop the ANI - * algorithm after it has been on auto mode. - * @ATH5K_ANI_MODE_MANUAL_LOW: Manually set all immunity parameters to low, - * maximizing sensitivity. ANI will not run. - * @ATH5K_ANI_MODE_MANUAL_HIGH: Manually set all immunity parameters to high, - * minimizing sensitivity. ANI will not run. - * @ATH5K_ANI_MODE_AUTO: Automatically control immunity parameters based on the - * amount of OFDM and CCK frame errors (default). - */ -enum ath5k_ani_mode { - ATH5K_ANI_MODE_OFF = 0, - ATH5K_ANI_MODE_MANUAL_LOW = 1, - ATH5K_ANI_MODE_MANUAL_HIGH = 2, - ATH5K_ANI_MODE_AUTO = 3 -}; - - -/** - * struct ath5k_ani_state - ANI state and associated counters - * @ani_mode: One of enum ath5k_ani_mode - * @noise_imm_level: Noise immunity level - * @spur_level: Spur immunity level - * @firstep_level: FIRstep level - * @ofdm_weak_sig: OFDM weak signal detection state (on/off) - * @cck_weak_sig: CCK weak signal detection state (on/off) - * @max_spur_level: Max spur immunity level (chip specific) - * @listen_time: Listen time - * @ofdm_errors: OFDM timing error count - * @cck_errors: CCK timing error count - * @last_cc: The &struct ath_cycle_counters (for stats) - * @last_listen: Listen time from previous run (for stats) - * @last_ofdm_errors: OFDM timing error count from previous run (for tats) - * @last_cck_errors: CCK timing error count from previous run (for stats) - * @sum_ofdm_errors: Sum of OFDM timing errors (for stats) - * @sum_cck_errors: Sum of all CCK timing errors (for stats) - */ -struct ath5k_ani_state { - enum ath5k_ani_mode ani_mode; - - /* state */ - int noise_imm_level; - int spur_level; - int firstep_level; - bool ofdm_weak_sig; - bool cck_weak_sig; - - int max_spur_level; - - /* used by the algorithm */ - unsigned int listen_time; - unsigned int ofdm_errors; - unsigned int cck_errors; - - /* debug/statistics only: numbers from last ANI calibration */ - struct ath_cycle_counters last_cc; - unsigned int last_listen; - unsigned int last_ofdm_errors; - unsigned int last_cck_errors; - unsigned int sum_ofdm_errors; - unsigned int sum_cck_errors; -}; - -void ath5k_ani_init(struct ath5k_hw *ah, enum ath5k_ani_mode mode); -void ath5k_ani_mib_intr(struct ath5k_hw *ah); -void ath5k_ani_calibration(struct ath5k_hw *ah); -void ath5k_ani_phy_error_report(struct ath5k_hw *ah, - enum ath5k_phy_error_code phyerr); - -/* for manual control */ -void ath5k_ani_set_noise_immunity_level(struct ath5k_hw *ah, int level); -void ath5k_ani_set_spur_immunity_level(struct ath5k_hw *ah, int level); -void ath5k_ani_set_firstep_level(struct ath5k_hw *ah, int level); -void ath5k_ani_set_ofdm_weak_signal_detection(struct ath5k_hw *ah, bool on); -void ath5k_ani_set_cck_weak_signal_detection(struct ath5k_hw *ah, bool on); - -void ath5k_ani_print_counters(struct ath5k_hw *ah); - -#endif /* ANI_H */ diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h deleted file mode 100644 index 2d691b8b95b9..000000000000 --- a/drivers/net/wireless/ath/ath5k/ath5k.h +++ /dev/null @@ -1,1714 +0,0 @@ -/* - * Copyright (c) 2004-2007 Reyk Floeter - * Copyright (c) 2006-2007 Nick Kossifidis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _ATH5K_H -#define _ATH5K_H - -/* TODO: Clean up channel debugging (doesn't work anyway) and start - * working on reg. control code using all available eeprom information - * (rev. engineering needed) */ -#define CHAN_DEBUG 0 - -#include -#include -#include -#include -#include -#include - -/* RX/TX descriptor hw structs - * TODO: Driver part should only see sw structs */ -#include "desc.h" - -/* EEPROM structs/offsets - * TODO: Make a more generic struct (eg. add more stuff to ath5k_capabilities) - * and clean up common bits, then introduce set/get functions in eeprom.c */ -#include "eeprom.h" -#include "debug.h" -#include "../ath.h" -#include "ani.h" - -/* PCI IDs */ -#define PCI_DEVICE_ID_ATHEROS_AR5210 0x0007 /* AR5210 */ -#define PCI_DEVICE_ID_ATHEROS_AR5311 0x0011 /* AR5311 */ -#define PCI_DEVICE_ID_ATHEROS_AR5211 0x0012 /* AR5211 */ -#define PCI_DEVICE_ID_ATHEROS_AR5212 0x0013 /* AR5212 */ -#define PCI_DEVICE_ID_3COM_3CRDAG675 0x0013 /* 3CRDAG675 (Atheros AR5212) */ -#define PCI_DEVICE_ID_3COM_2_3CRPAG175 0x0013 /* 3CRPAG175 (Atheros AR5212) */ -#define PCI_DEVICE_ID_ATHEROS_AR5210_AP 0x0207 /* AR5210 (Early) */ -#define PCI_DEVICE_ID_ATHEROS_AR5212_IBM 0x1014 /* AR5212 (IBM MiniPCI) */ -#define PCI_DEVICE_ID_ATHEROS_AR5210_DEFAULT 0x1107 /* AR5210 (no eeprom) */ -#define PCI_DEVICE_ID_ATHEROS_AR5212_DEFAULT 0x1113 /* AR5212 (no eeprom) */ -#define PCI_DEVICE_ID_ATHEROS_AR5211_DEFAULT 0x1112 /* AR5211 (no eeprom) */ -#define PCI_DEVICE_ID_ATHEROS_AR5212_FPGA 0xf013 /* AR5212 (emulation board) */ -#define PCI_DEVICE_ID_ATHEROS_AR5211_LEGACY 0xff12 /* AR5211 (emulation board) */ -#define PCI_DEVICE_ID_ATHEROS_AR5211_FPGA11B 0xf11b /* AR5211 (emulation board) */ -#define PCI_DEVICE_ID_ATHEROS_AR5312_REV2 0x0052 /* AR5312 WMAC (AP31) */ -#define PCI_DEVICE_ID_ATHEROS_AR5312_REV7 0x0057 /* AR5312 WMAC (AP30-040) */ -#define PCI_DEVICE_ID_ATHEROS_AR5312_REV8 0x0058 /* AR5312 WMAC (AP43-030) */ -#define PCI_DEVICE_ID_ATHEROS_AR5212_0014 0x0014 /* AR5212 compatible */ -#define PCI_DEVICE_ID_ATHEROS_AR5212_0015 0x0015 /* AR5212 compatible */ -#define PCI_DEVICE_ID_ATHEROS_AR5212_0016 0x0016 /* AR5212 compatible */ -#define PCI_DEVICE_ID_ATHEROS_AR5212_0017 0x0017 /* AR5212 compatible */ -#define PCI_DEVICE_ID_ATHEROS_AR5212_0018 0x0018 /* AR5212 compatible */ -#define PCI_DEVICE_ID_ATHEROS_AR5212_0019 0x0019 /* AR5212 compatible */ -#define PCI_DEVICE_ID_ATHEROS_AR2413 0x001a /* AR2413 (Griffin-lite) */ -#define PCI_DEVICE_ID_ATHEROS_AR5413 0x001b /* AR5413 (Eagle) */ -#define PCI_DEVICE_ID_ATHEROS_AR5424 0x001c /* AR5424 (Condor PCI-E) */ -#define PCI_DEVICE_ID_ATHEROS_AR5416 0x0023 /* AR5416 */ -#define PCI_DEVICE_ID_ATHEROS_AR5418 0x0024 /* AR5418 */ - -/****************************\ - GENERIC DRIVER DEFINITIONS -\****************************/ - -#define ATH5K_PRINTF(fmt, ...) \ - pr_warn("%s: " fmt, __func__, ##__VA_ARGS__) - -void __printf(3, 4) -_ath5k_printk(const struct ath5k_hw *ah, const char *level, - const char *fmt, ...); - -#define ATH5K_PRINTK(_sc, _level, _fmt, ...) \ - _ath5k_printk(_sc, _level, _fmt, ##__VA_ARGS__) - -#define ATH5K_PRINTK_LIMIT(_sc, _level, _fmt, ...) \ -do { \ - if (net_ratelimit()) \ - ATH5K_PRINTK(_sc, _level, _fmt, ##__VA_ARGS__); \ -} while (0) - -#define ATH5K_INFO(_sc, _fmt, ...) \ - ATH5K_PRINTK(_sc, KERN_INFO, _fmt, ##__VA_ARGS__) - -#define ATH5K_WARN(_sc, _fmt, ...) \ - ATH5K_PRINTK_LIMIT(_sc, KERN_WARNING, _fmt, ##__VA_ARGS__) - -#define ATH5K_ERR(_sc, _fmt, ...) \ - ATH5K_PRINTK_LIMIT(_sc, KERN_ERR, _fmt, ##__VA_ARGS__) - -/* - * AR5K REGISTER ACCESS - */ - -/* Some macros to read/write fields */ - -/* First shift, then mask */ -#define AR5K_REG_SM(_val, _flags) \ - (((_val) << _flags##_S) & (_flags)) - -/* First mask, then shift */ -#define AR5K_REG_MS(_val, _flags) \ - (((_val) & (_flags)) >> _flags##_S) - -/* Some registers can hold multiple values of interest. For this - * reason when we want to write to these registers we must first - * retrieve the values which we do not want to clear (lets call this - * old_data) and then set the register with this and our new_value: - * ( old_data | new_value) */ -#define AR5K_REG_WRITE_BITS(ah, _reg, _flags, _val) \ - ath5k_hw_reg_write(ah, (ath5k_hw_reg_read(ah, _reg) & ~(_flags)) | \ - (((_val) << _flags##_S) & (_flags)), _reg) - -#define AR5K_REG_MASKED_BITS(ah, _reg, _flags, _mask) \ - ath5k_hw_reg_write(ah, (ath5k_hw_reg_read(ah, _reg) & \ - (_mask)) | (_flags), _reg) - -#define AR5K_REG_ENABLE_BITS(ah, _reg, _flags) \ - ath5k_hw_reg_write(ah, ath5k_hw_reg_read(ah, _reg) | (_flags), _reg) - -#define AR5K_REG_DISABLE_BITS(ah, _reg, _flags) \ - ath5k_hw_reg_write(ah, ath5k_hw_reg_read(ah, _reg) & ~(_flags), _reg) - -/* Access QCU registers per queue */ -#define AR5K_REG_READ_Q(ah, _reg, _queue) \ - (ath5k_hw_reg_read(ah, _reg) & (1 << _queue)) \ - -#define AR5K_REG_WRITE_Q(ah, _reg, _queue) \ - ath5k_hw_reg_write(ah, (1 << _queue), _reg) - -#define AR5K_Q_ENABLE_BITS(_reg, _queue) do { \ - _reg |= 1 << _queue; \ -} while (0) - -#define AR5K_Q_DISABLE_BITS(_reg, _queue) do { \ - _reg &= ~(1 << _queue); \ -} while (0) - -/* Used while writing initvals */ -#define AR5K_REG_WAIT(_i) do { \ - if (_i % 64) \ - udelay(1); \ -} while (0) - -/* - * Some tunable values (these should be changeable by the user) - * TODO: Make use of them and add more options OR use debug/configfs - */ -#define AR5K_TUNE_DMA_BEACON_RESP 2 -#define AR5K_TUNE_SW_BEACON_RESP 10 -#define AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF 0 -#define AR5K_TUNE_MIN_TX_FIFO_THRES 1 -#define AR5K_TUNE_MAX_TX_FIFO_THRES ((IEEE80211_MAX_FRAME_LEN / 64) + 1) -#define AR5K_TUNE_REGISTER_TIMEOUT 20000 -/* Register for RSSI threshold has a mask of 0xff, so 255 seems to - * be the max value. */ -#define AR5K_TUNE_RSSI_THRES 129 -/* This must be set when setting the RSSI threshold otherwise it can - * prevent a reset. If AR5K_RSSI_THR is read after writing to it - * the BMISS_THRES will be seen as 0, seems hardware doesn't keep - * track of it. Max value depends on hardware. For AR5210 this is just 7. - * For AR5211+ this seems to be up to 255. */ -#define AR5K_TUNE_BMISS_THRES 7 -#define AR5K_TUNE_REGISTER_DWELL_TIME 20000 -#define AR5K_TUNE_BEACON_INTERVAL 100 -#define AR5K_TUNE_AIFS 2 -#define AR5K_TUNE_AIFS_11B 2 -#define AR5K_TUNE_AIFS_XR 0 -#define AR5K_TUNE_CWMIN 15 -#define AR5K_TUNE_CWMIN_11B 31 -#define AR5K_TUNE_CWMIN_XR 3 -#define AR5K_TUNE_CWMAX 1023 -#define AR5K_TUNE_CWMAX_11B 1023 -#define AR5K_TUNE_CWMAX_XR 7 -#define AR5K_TUNE_NOISE_FLOOR -72 -#define AR5K_TUNE_CCA_MAX_GOOD_VALUE -95 -#define AR5K_TUNE_MAX_TXPOWER 63 -#define AR5K_TUNE_DEFAULT_TXPOWER 25 -#define AR5K_TUNE_TPC_TXPOWER false -#define ATH5K_TUNE_CALIBRATION_INTERVAL_FULL 60000 /* 60 sec */ -#define ATH5K_TUNE_CALIBRATION_INTERVAL_SHORT 10000 /* 10 sec */ -#define ATH5K_TUNE_CALIBRATION_INTERVAL_ANI 1000 /* 1 sec */ -#define ATH5K_TX_COMPLETE_POLL_INT 3000 /* 3 sec */ - -#define AR5K_INIT_CARR_SENSE_EN 1 - -/*Swap RX/TX Descriptor for big endian archs*/ -#if defined(__BIG_ENDIAN) -#define AR5K_INIT_CFG ( \ - AR5K_CFG_SWTD | AR5K_CFG_SWRD \ -) -#else -#define AR5K_INIT_CFG 0x00000000 -#endif - -/* Initial values */ -#define AR5K_INIT_CYCRSSI_THR1 2 - -/* Tx retry limit defaults from standard */ -#define AR5K_INIT_RETRY_SHORT 7 -#define AR5K_INIT_RETRY_LONG 4 - -/* Slot time */ -#define AR5K_INIT_SLOT_TIME_TURBO 6 -#define AR5K_INIT_SLOT_TIME_DEFAULT 9 -#define AR5K_INIT_SLOT_TIME_HALF_RATE 13 -#define AR5K_INIT_SLOT_TIME_QUARTER_RATE 21 -#define AR5K_INIT_SLOT_TIME_B 20 -#define AR5K_SLOT_TIME_MAX 0xffff - -/* SIFS */ -#define AR5K_INIT_SIFS_TURBO 6 -#define AR5K_INIT_SIFS_DEFAULT_BG 10 -#define AR5K_INIT_SIFS_DEFAULT_A 16 -#define AR5K_INIT_SIFS_HALF_RATE 32 -#define AR5K_INIT_SIFS_QUARTER_RATE 64 - -/* Used to calculate tx time for non 5/10/40MHz - * operation */ -/* It's preamble time + signal time (16 + 4) */ -#define AR5K_INIT_OFDM_PREAMPLE_TIME 20 -/* Preamble time for 40MHz (turbo) operation (min ?) */ -#define AR5K_INIT_OFDM_PREAMBLE_TIME_MIN 14 -#define AR5K_INIT_OFDM_SYMBOL_TIME 4 -#define AR5K_INIT_OFDM_PLCP_BITS 22 - -/* Rx latency for 5 and 10MHz operation (max ?) */ -#define AR5K_INIT_RX_LAT_MAX 63 -/* Tx latencies from initvals (5212 only but no problem - * because we only tweak them on 5212) */ -#define AR5K_INIT_TX_LAT_A 54 -#define AR5K_INIT_TX_LAT_BG 384 -/* Tx latency for 40MHz (turbo) operation (min ?) */ -#define AR5K_INIT_TX_LAT_MIN 32 -/* Default Tx/Rx latencies (same for 5211)*/ -#define AR5K_INIT_TX_LATENCY_5210 54 -#define AR5K_INIT_RX_LATENCY_5210 29 - -/* Tx frame to Tx data start delay */ -#define AR5K_INIT_TXF2TXD_START_DEFAULT 14 -#define AR5K_INIT_TXF2TXD_START_DELAY_10MHZ 12 -#define AR5K_INIT_TXF2TXD_START_DELAY_5MHZ 13 - -/* We need to increase PHY switch and agc settling time - * on turbo mode */ -#define AR5K_SWITCH_SETTLING 5760 -#define AR5K_SWITCH_SETTLING_TURBO 7168 - -#define AR5K_AGC_SETTLING 28 -/* 38 on 5210 but shouldn't matter */ -#define AR5K_AGC_SETTLING_TURBO 37 - - - -/*****************************\ -* GENERIC CHIPSET DEFINITIONS * -\*****************************/ - -/** - * enum ath5k_version - MAC Chips - * @AR5K_AR5210: AR5210 (Crete) - * @AR5K_AR5211: AR5211 (Oahu/Maui) - * @AR5K_AR5212: AR5212 (Venice) and newer - */ -enum ath5k_version { - AR5K_AR5210 = 0, - AR5K_AR5211 = 1, - AR5K_AR5212 = 2, -}; - -/** - * enum ath5k_radio - PHY Chips - * @AR5K_RF5110: RF5110 (Fez) - * @AR5K_RF5111: RF5111 (Sombrero) - * @AR5K_RF5112: RF2112/5112(A) (Derby/Derby2) - * @AR5K_RF2413: RF2413/2414 (Griffin/Griffin-Lite) - * @AR5K_RF5413: RF5413/5414/5424 (Eagle/Condor) - * @AR5K_RF2316: RF2315/2316 (Cobra SoC) - * @AR5K_RF2317: RF2317 (Spider SoC) - * @AR5K_RF2425: RF2425/2417 (Swan/Nalla) - */ -enum ath5k_radio { - AR5K_RF5110 = 0, - AR5K_RF5111 = 1, - AR5K_RF5112 = 2, - AR5K_RF2413 = 3, - AR5K_RF5413 = 4, - AR5K_RF2316 = 5, - AR5K_RF2317 = 6, - AR5K_RF2425 = 7, -}; - -/* - * Common silicon revision/version values - */ - -#define AR5K_SREV_UNKNOWN 0xffff - -#define AR5K_SREV_AR5210 0x00 /* Crete */ -#define AR5K_SREV_AR5311 0x10 /* Maui 1 */ -#define AR5K_SREV_AR5311A 0x20 /* Maui 2 */ -#define AR5K_SREV_AR5311B 0x30 /* Spirit */ -#define AR5K_SREV_AR5211 0x40 /* Oahu */ -#define AR5K_SREV_AR5212 0x50 /* Venice */ -#define AR5K_SREV_AR5312_R2 0x52 /* AP31 */ -#define AR5K_SREV_AR5212_V4 0x54 /* ??? */ -#define AR5K_SREV_AR5213 0x55 /* ??? */ -#define AR5K_SREV_AR5312_R7 0x57 /* AP30 */ -#define AR5K_SREV_AR2313_R8 0x58 /* AP43 */ -#define AR5K_SREV_AR5213A 0x59 /* Hainan */ -#define AR5K_SREV_AR2413 0x78 /* Griffin lite */ -#define AR5K_SREV_AR2414 0x70 /* Griffin */ -#define AR5K_SREV_AR2315_R6 0x86 /* AP51-Light */ -#define AR5K_SREV_AR2315_R7 0x87 /* AP51-Full */ -#define AR5K_SREV_AR5424 0x90 /* Condor */ -#define AR5K_SREV_AR2317_R1 0x90 /* AP61-Light */ -#define AR5K_SREV_AR2317_R2 0x91 /* AP61-Full */ -#define AR5K_SREV_AR5413 0xa4 /* Eagle lite */ -#define AR5K_SREV_AR5414 0xa0 /* Eagle */ -#define AR5K_SREV_AR2415 0xb0 /* Talon */ -#define AR5K_SREV_AR5416 0xc0 /* PCI-E */ -#define AR5K_SREV_AR5418 0xca /* PCI-E */ -#define AR5K_SREV_AR2425 0xe0 /* Swan */ -#define AR5K_SREV_AR2417 0xf0 /* Nala */ - -#define AR5K_SREV_RAD_5110 0x00 -#define AR5K_SREV_RAD_5111 0x10 -#define AR5K_SREV_RAD_5111A 0x15 -#define AR5K_SREV_RAD_2111 0x20 -#define AR5K_SREV_RAD_5112 0x30 -#define AR5K_SREV_RAD_5112A 0x35 -#define AR5K_SREV_RAD_5112B 0x36 -#define AR5K_SREV_RAD_2112 0x40 -#define AR5K_SREV_RAD_2112A 0x45 -#define AR5K_SREV_RAD_2112B 0x46 -#define AR5K_SREV_RAD_2413 0x50 -#define AR5K_SREV_RAD_5413 0x60 -#define AR5K_SREV_RAD_2316 0x70 /* Cobra SoC */ -#define AR5K_SREV_RAD_2317 0x80 -#define AR5K_SREV_RAD_5424 0xa0 /* Mostly same as 5413 */ -#define AR5K_SREV_RAD_2425 0xa2 -#define AR5K_SREV_RAD_5133 0xc0 - -#define AR5K_SREV_PHY_5211 0x30 -#define AR5K_SREV_PHY_5212 0x41 -#define AR5K_SREV_PHY_5212A 0x42 -#define AR5K_SREV_PHY_5212B 0x43 -#define AR5K_SREV_PHY_2413 0x45 -#define AR5K_SREV_PHY_5413 0x61 -#define AR5K_SREV_PHY_2425 0x70 - -/* TODO add support to mac80211 for vendor-specific rates and modes */ - -/** - * DOC: Atheros XR - * - * Some of this information is based on Documentation from: - * - * http://madwifi-project.org/wiki/ChipsetFeatures/SuperAG - * - * Atheros' eXtended Range - range enhancing extension is a modulation scheme - * that is supposed to double the link distance between an Atheros XR-enabled - * client device with an Atheros XR-enabled access point. This is achieved - * by increasing the receiver sensitivity up to, -105dBm, which is about 20dB - * above what the 802.11 specifications demand. In addition, new (proprietary) - * data rates are introduced: 3, 2, 1, 0.5 and 0.25 MBit/s. - * - * Please note that can you either use XR or TURBO but you cannot use both, - * they are exclusive. - * - * Also note that we do not plan to support XR mode at least for now. You can - * get a mode similar to XR by using 5MHz bwmode. - */ - - -/** - * DOC: Atheros SuperAG - * - * In addition to XR we have another modulation scheme called TURBO mode - * that is supposed to provide a throughput transmission speed up to 40Mbit/s - * -60Mbit/s at a 108Mbit/s signaling rate achieved through the bonding of two - * 54Mbit/s 802.11g channels. To use this feature both ends must support it. - * There is also a distinction between "static" and "dynamic" turbo modes: - * - * - Static: is the dumb version: devices set to this mode stick to it until - * the mode is turned off. - * - * - Dynamic: is the intelligent version, the network decides itself if it - * is ok to use turbo. As soon as traffic is detected on adjacent channels - * (which would get used in turbo mode), or when a non-turbo station joins - * the network, turbo mode won't be used until the situation changes again. - * Dynamic mode is achieved by Atheros' Adaptive Radio (AR) feature which - * monitors the used radio band in order to decide whether turbo mode may - * be used or not. - * - * This article claims Super G sticks to bonding of channels 5 and 6 for - * USA: - * - * http://www.pcworld.com/article/id,113428-page,1/article.html - * - * The channel bonding seems to be driver specific though. - * - * In addition to TURBO modes we also have the following features for even - * greater speed-up: - * - * - Bursting: allows multiple frames to be sent at once, rather than pausing - * after each frame. Bursting is a standards-compliant feature that can be - * used with any Access Point. - * - * - Fast frames: increases the amount of information that can be sent per - * frame, also resulting in a reduction of transmission overhead. It is a - * proprietary feature that needs to be supported by the Access Point. - * - * - Compression: data frames are compressed in real time using a Lempel Ziv - * algorithm. This is done transparently. Once this feature is enabled, - * compression and decompression takes place inside the chipset, without - * putting additional load on the host CPU. - * - * As with XR we also don't plan to support SuperAG features for now. You can - * get a mode similar to TURBO by using 40MHz bwmode. - */ - - -/** - * enum ath5k_driver_mode - PHY operation mode - * @AR5K_MODE_11A: 802.11a - * @AR5K_MODE_11B: 802.11b - * @AR5K_MODE_11G: 801.11g - * @AR5K_MODE_MAX: Used for boundary checks - * - * Do not change the order here, we use these as - * array indices and it also maps EEPROM structures. - */ -enum ath5k_driver_mode { - AR5K_MODE_11A = 0, - AR5K_MODE_11B = 1, - AR5K_MODE_11G = 2, - AR5K_MODE_MAX = 3 -}; - -/** - * enum ath5k_ant_mode - Antenna operation mode - * @AR5K_ANTMODE_DEFAULT: Default antenna setup - * @AR5K_ANTMODE_FIXED_A: Only antenna A is present - * @AR5K_ANTMODE_FIXED_B: Only antenna B is present - * @AR5K_ANTMODE_SINGLE_AP: STA locked on a single ap - * @AR5K_ANTMODE_SECTOR_AP: AP with tx antenna set on tx desc - * @AR5K_ANTMODE_SECTOR_STA: STA with tx antenna set on tx desc - * @AR5K_ANTMODE_DEBUG: Debug mode -A -> Rx, B-> Tx- - * @AR5K_ANTMODE_MAX: Used for boundary checks - * - * For more infos on antenna control check out phy.c - */ -enum ath5k_ant_mode { - AR5K_ANTMODE_DEFAULT = 0, - AR5K_ANTMODE_FIXED_A = 1, - AR5K_ANTMODE_FIXED_B = 2, - AR5K_ANTMODE_SINGLE_AP = 3, - AR5K_ANTMODE_SECTOR_AP = 4, - AR5K_ANTMODE_SECTOR_STA = 5, - AR5K_ANTMODE_DEBUG = 6, - AR5K_ANTMODE_MAX, -}; - -/** - * enum ath5k_bw_mode - Bandwidth operation mode - * @AR5K_BWMODE_DEFAULT: 20MHz, default operation - * @AR5K_BWMODE_5MHZ: Quarter rate - * @AR5K_BWMODE_10MHZ: Half rate - * @AR5K_BWMODE_40MHZ: Turbo - */ -enum ath5k_bw_mode { - AR5K_BWMODE_DEFAULT = 0, - AR5K_BWMODE_5MHZ = 1, - AR5K_BWMODE_10MHZ = 2, - AR5K_BWMODE_40MHZ = 3 -}; - - - -/****************\ - TX DEFINITIONS -\****************/ - -/** - * struct ath5k_tx_status - TX Status descriptor - * @ts_seqnum: Sequence number - * @ts_tstamp: Timestamp - * @ts_status: Status code - * @ts_final_idx: Final transmission series index - * @ts_final_retry: Final retry count - * @ts_rssi: RSSI for received ACK - * @ts_shortretry: Short retry count - * @ts_virtcol: Virtual collision count - * @ts_antenna: Antenna used - * - * TX status descriptor gets filled by the hw - * on each transmission attempt. - */ -struct ath5k_tx_status { - u16 ts_seqnum; - u16 ts_tstamp; - u8 ts_status; - u8 ts_final_idx; - u8 ts_final_retry; - s8 ts_rssi; - u8 ts_shortretry; - u8 ts_virtcol; - u8 ts_antenna; -}; - -#define AR5K_TXSTAT_ALTRATE 0x80 -#define AR5K_TXERR_XRETRY 0x01 -#define AR5K_TXERR_FILT 0x02 -#define AR5K_TXERR_FIFO 0x04 - -/** - * enum ath5k_tx_queue - Queue types used to classify tx queues. - * @AR5K_TX_QUEUE_INACTIVE: q is unused -- see ath5k_hw_release_tx_queue - * @AR5K_TX_QUEUE_DATA: A normal data queue - * @AR5K_TX_QUEUE_BEACON: The beacon queue - * @AR5K_TX_QUEUE_CAB: The after-beacon queue - * @AR5K_TX_QUEUE_UAPSD: Unscheduled Automatic Power Save Delivery queue - */ -enum ath5k_tx_queue { - AR5K_TX_QUEUE_INACTIVE = 0, - AR5K_TX_QUEUE_DATA, - AR5K_TX_QUEUE_BEACON, - AR5K_TX_QUEUE_CAB, - AR5K_TX_QUEUE_UAPSD, -}; - -#define AR5K_NUM_TX_QUEUES 10 -#define AR5K_NUM_TX_QUEUES_NOQCU 2 - -/** - * enum ath5k_tx_queue_subtype - Queue sub-types to classify normal data queues - * @AR5K_WME_AC_BK: Background traffic - * @AR5K_WME_AC_BE: Best-effort (normal) traffic - * @AR5K_WME_AC_VI: Video traffic - * @AR5K_WME_AC_VO: Voice traffic - * - * These are the 4 Access Categories as defined in - * WME spec. 0 is the lowest priority and 4 is the - * highest. Normal data that hasn't been classified - * goes to the Best Effort AC. - */ -enum ath5k_tx_queue_subtype { - AR5K_WME_AC_BK = 0, - AR5K_WME_AC_BE, - AR5K_WME_AC_VI, - AR5K_WME_AC_VO, -}; - -/** - * enum ath5k_tx_queue_id - Queue ID numbers as returned by the hw functions - * @AR5K_TX_QUEUE_ID_NOQCU_DATA: Data queue on AR5210 (no QCU available) - * @AR5K_TX_QUEUE_ID_NOQCU_BEACON: Beacon queue on AR5210 (no QCU available) - * @AR5K_TX_QUEUE_ID_DATA_MIN: Data queue min index - * @AR5K_TX_QUEUE_ID_DATA_MAX: Data queue max index - * @AR5K_TX_QUEUE_ID_CAB: Content after beacon queue - * @AR5K_TX_QUEUE_ID_BEACON: Beacon queue - * @AR5K_TX_QUEUE_ID_UAPSD: Urgent Automatic Power Save Delivery, - * - * Each number represents a hw queue. If hw does not support hw queues - * (eg 5210) all data goes in one queue. - */ -enum ath5k_tx_queue_id { - AR5K_TX_QUEUE_ID_NOQCU_DATA = 0, - AR5K_TX_QUEUE_ID_NOQCU_BEACON = 1, - AR5K_TX_QUEUE_ID_DATA_MIN = 0, - AR5K_TX_QUEUE_ID_DATA_MAX = 3, - AR5K_TX_QUEUE_ID_UAPSD = 7, - AR5K_TX_QUEUE_ID_CAB = 8, - AR5K_TX_QUEUE_ID_BEACON = 9, -}; - -/* - * Flags to set hw queue's parameters... - */ -#define AR5K_TXQ_FLAG_TXOKINT_ENABLE 0x0001 /* Enable TXOK interrupt */ -#define AR5K_TXQ_FLAG_TXERRINT_ENABLE 0x0002 /* Enable TXERR interrupt */ -#define AR5K_TXQ_FLAG_TXEOLINT_ENABLE 0x0004 /* Enable TXEOL interrupt -not used- */ -#define AR5K_TXQ_FLAG_TXDESCINT_ENABLE 0x0008 /* Enable TXDESC interrupt -not used- */ -#define AR5K_TXQ_FLAG_TXURNINT_ENABLE 0x0010 /* Enable TXURN interrupt */ -#define AR5K_TXQ_FLAG_CBRORNINT_ENABLE 0x0020 /* Enable CBRORN interrupt */ -#define AR5K_TXQ_FLAG_CBRURNINT_ENABLE 0x0040 /* Enable CBRURN interrupt */ -#define AR5K_TXQ_FLAG_QTRIGINT_ENABLE 0x0080 /* Enable QTRIG interrupt */ -#define AR5K_TXQ_FLAG_TXNOFRMINT_ENABLE 0x0100 /* Enable TXNOFRM interrupt */ -#define AR5K_TXQ_FLAG_BACKOFF_DISABLE 0x0200 /* Disable random post-backoff */ -#define AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE 0x0300 /* Enable ready time expiry policy (?)*/ -#define AR5K_TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE 0x0800 /* Enable backoff while bursting */ -#define AR5K_TXQ_FLAG_POST_FR_BKOFF_DIS 0x1000 /* Disable backoff while bursting */ -#define AR5K_TXQ_FLAG_COMPRESSION_ENABLE 0x2000 /* Enable hw compression -not implemented-*/ - -/** - * struct ath5k_txq - Transmit queue state - * @qnum: Hardware q number - * @link: Link ptr in last TX desc - * @q: Transmit queue (&struct list_head) - * @lock: Lock on q and link - * @setup: Is the queue configured - * @txq_len:Number of queued buffers - * @txq_max: Max allowed num of queued buffers - * @txq_poll_mark: Used to check if queue got stuck - * @txq_stuck: Queue stuck counter - * - * One of these exists for each hardware transmit queue. - * Packets sent to us from above are assigned to queues based - * on their priority. Not all devices support a complete set - * of hardware transmit queues. For those devices the array - * sc_ac2q will map multiple priorities to fewer hardware queues - * (typically all to one hardware queue). - */ -struct ath5k_txq { - unsigned int qnum; - u32 *link; - struct list_head q; - spinlock_t lock; - bool setup; - int txq_len; - int txq_max; - bool txq_poll_mark; - unsigned int txq_stuck; -}; - -/** - * struct ath5k_txq_info - A struct to hold TX queue's parameters - * @tqi_type: One of enum ath5k_tx_queue - * @tqi_subtype: One of enum ath5k_tx_queue_subtype - * @tqi_flags: TX queue flags (see above) - * @tqi_aifs: Arbitrated Inter-frame Space - * @tqi_cw_min: Minimum Contention Window - * @tqi_cw_max: Maximum Contention Window - * @tqi_cbr_period: Constant bit rate period - * @tqi_ready_time: Time queue waits after an event when RDYTIME is enabled - */ -struct ath5k_txq_info { - enum ath5k_tx_queue tqi_type; - enum ath5k_tx_queue_subtype tqi_subtype; - u16 tqi_flags; - u8 tqi_aifs; - u16 tqi_cw_min; - u16 tqi_cw_max; - u32 tqi_cbr_period; - u32 tqi_cbr_overflow_limit; - u32 tqi_burst_time; - u32 tqi_ready_time; -}; - -/** - * enum ath5k_pkt_type - Transmit packet types - * @AR5K_PKT_TYPE_NORMAL: Normal data - * @AR5K_PKT_TYPE_ATIM: ATIM - * @AR5K_PKT_TYPE_PSPOLL: PS-Poll - * @AR5K_PKT_TYPE_BEACON: Beacon - * @AR5K_PKT_TYPE_PROBE_RESP: Probe response - * @AR5K_PKT_TYPE_PIFS: PIFS - * Used on tx control descriptor - */ -enum ath5k_pkt_type { - AR5K_PKT_TYPE_NORMAL = 0, - AR5K_PKT_TYPE_ATIM = 1, - AR5K_PKT_TYPE_PSPOLL = 2, - AR5K_PKT_TYPE_BEACON = 3, - AR5K_PKT_TYPE_PROBE_RESP = 4, - AR5K_PKT_TYPE_PIFS = 5, -}; - -/* - * TX power and TPC settings - */ -#define AR5K_TXPOWER_OFDM(_r, _v) ( \ - ((0 & 1) << ((_v) + 6)) | \ - (((ah->ah_txpower.txp_rates_power_table[(_r)]) & 0x3f) << (_v)) \ -) - -#define AR5K_TXPOWER_CCK(_r, _v) ( \ - (ah->ah_txpower.txp_rates_power_table[(_r)] & 0x3f) << (_v) \ -) - - - -/****************\ - RX DEFINITIONS -\****************/ - -/** - * struct ath5k_rx_status - RX Status descriptor - * @rs_datalen: Data length - * @rs_tstamp: Timestamp - * @rs_status: Status code - * @rs_phyerr: PHY error mask - * @rs_rssi: RSSI in 0.5dbm units - * @rs_keyix: Index to the key used for decrypting - * @rs_rate: Rate used to decode the frame - * @rs_antenna: Antenna used to receive the frame - * @rs_more: Indicates this is a frame fragment (Fast frames) - */ -struct ath5k_rx_status { - u16 rs_datalen; - u16 rs_tstamp; - u8 rs_status; - u8 rs_phyerr; - s8 rs_rssi; - u8 rs_keyix; - u8 rs_rate; - u8 rs_antenna; - u8 rs_more; -}; - -#define AR5K_RXERR_CRC 0x01 -#define AR5K_RXERR_PHY 0x02 -#define AR5K_RXERR_FIFO 0x04 -#define AR5K_RXERR_DECRYPT 0x08 -#define AR5K_RXERR_MIC 0x10 -#define AR5K_RXKEYIX_INVALID ((u8) -1) -#define AR5K_TXKEYIX_INVALID ((u32) -1) - - -/**************************\ - BEACON TIMERS DEFINITIONS -\**************************/ - -#define AR5K_BEACON_PERIOD 0x0000ffff -#define AR5K_BEACON_ENA 0x00800000 /*enable beacon xmit*/ -#define AR5K_BEACON_RESET_TSF 0x01000000 /*force a TSF reset*/ - - -/* - * TSF to TU conversion: - * - * TSF is a 64bit value in usec (microseconds). - * TU is a 32bit value and defined by IEEE802.11 (page 6) as "A measurement of - * time equal to 1024 usec", so it's roughly milliseconds (usec / 1024). - */ -#define TSF_TO_TU(_tsf) (u32)((_tsf) >> 10) - - - -/*******************************\ - GAIN OPTIMIZATION DEFINITIONS -\*******************************/ - -/** - * enum ath5k_rfgain - RF Gain optimization engine state - * @AR5K_RFGAIN_INACTIVE: Engine disabled - * @AR5K_RFGAIN_ACTIVE: Probe active - * @AR5K_RFGAIN_READ_REQUESTED: Probe requested - * @AR5K_RFGAIN_NEED_CHANGE: Gain_F needs change - */ -enum ath5k_rfgain { - AR5K_RFGAIN_INACTIVE = 0, - AR5K_RFGAIN_ACTIVE, - AR5K_RFGAIN_READ_REQUESTED, - AR5K_RFGAIN_NEED_CHANGE, -}; - -/** - * struct ath5k_gain - RF Gain optimization engine state data - * @g_step_idx: Current step index - * @g_current: Current gain - * @g_target: Target gain - * @g_low: Low gain boundary - * @g_high: High gain boundary - * @g_f_corr: Gain_F correction - * @g_state: One of enum ath5k_rfgain - */ -struct ath5k_gain { - u8 g_step_idx; - u8 g_current; - u8 g_target; - u8 g_low; - u8 g_high; - u8 g_f_corr; - u8 g_state; -}; - - - -/********************\ - COMMON DEFINITIONS -\********************/ - -#define AR5K_SLOT_TIME_9 396 -#define AR5K_SLOT_TIME_20 880 -#define AR5K_SLOT_TIME_MAX 0xffff - -/** - * struct ath5k_athchan_2ghz - 2GHz to 5GHZ map for RF5111 - * @a2_flags: Channel flags (internal) - * @a2_athchan: HW channel number (internal) - * - * This structure is used to map 2GHz channels to - * 5GHz Atheros channels on 2111 frequency converter - * that comes together with RF5111 - * TODO: Clean up - */ -struct ath5k_athchan_2ghz { - u32 a2_flags; - u16 a2_athchan; -}; - -/** - * enum ath5k_dmasize - DMA size definitions (2^(n+2)) - * @AR5K_DMASIZE_4B: 4Bytes - * @AR5K_DMASIZE_8B: 8Bytes - * @AR5K_DMASIZE_16B: 16Bytes - * @AR5K_DMASIZE_32B: 32Bytes - * @AR5K_DMASIZE_64B: 64Bytes (Default) - * @AR5K_DMASIZE_128B: 128Bytes - * @AR5K_DMASIZE_256B: 256Bytes - * @AR5K_DMASIZE_512B: 512Bytes - * - * These are used to set DMA burst size on hw - * - * Note: Some platforms can't handle more than 4Bytes - * be careful on embedded boards. - */ -enum ath5k_dmasize { - AR5K_DMASIZE_4B = 0, - AR5K_DMASIZE_8B, - AR5K_DMASIZE_16B, - AR5K_DMASIZE_32B, - AR5K_DMASIZE_64B, - AR5K_DMASIZE_128B, - AR5K_DMASIZE_256B, - AR5K_DMASIZE_512B -}; - - - -/******************\ - RATE DEFINITIONS -\******************/ - -/** - * DOC: Rate codes - * - * Seems the ar5xxx hardware supports up to 32 rates, indexed by 1-32. - * - * The rate code is used to get the RX rate or set the TX rate on the - * hardware descriptors. It is also used for internal modulation control - * and settings. - * - * This is the hardware rate map we are aware of (html unfriendly): - * - * Rate code Rate (Kbps) - * --------- ----------- - * 0x01 3000 (XR) - * 0x02 1000 (XR) - * 0x03 250 (XR) - * 0x04 - 05 -Reserved- - * 0x06 2000 (XR) - * 0x07 500 (XR) - * 0x08 48000 (OFDM) - * 0x09 24000 (OFDM) - * 0x0A 12000 (OFDM) - * 0x0B 6000 (OFDM) - * 0x0C 54000 (OFDM) - * 0x0D 36000 (OFDM) - * 0x0E 18000 (OFDM) - * 0x0F 9000 (OFDM) - * 0x10 - 17 -Reserved- - * 0x18 11000L (CCK) - * 0x19 5500L (CCK) - * 0x1A 2000L (CCK) - * 0x1B 1000L (CCK) - * 0x1C 11000S (CCK) - * 0x1D 5500S (CCK) - * 0x1E 2000S (CCK) - * 0x1F -Reserved- - * - * "S" indicates CCK rates with short preamble and "L" with long preamble. - * - * AR5211 has different rate codes for CCK (802.11B) rates. It only uses the - * lowest 4 bits, so they are the same as above with a 0xF mask. - * (0xB, 0xA, 0x9 and 0x8 for 1M, 2M, 5.5M and 11M). - * We handle this in ath5k_setup_bands(). - */ -#define AR5K_MAX_RATES 32 - -/* B */ -#define ATH5K_RATE_CODE_1M 0x1B -#define ATH5K_RATE_CODE_2M 0x1A -#define ATH5K_RATE_CODE_5_5M 0x19 -#define ATH5K_RATE_CODE_11M 0x18 -/* A and G */ -#define ATH5K_RATE_CODE_6M 0x0B -#define ATH5K_RATE_CODE_9M 0x0F -#define ATH5K_RATE_CODE_12M 0x0A -#define ATH5K_RATE_CODE_18M 0x0E -#define ATH5K_RATE_CODE_24M 0x09 -#define ATH5K_RATE_CODE_36M 0x0D -#define ATH5K_RATE_CODE_48M 0x08 -#define ATH5K_RATE_CODE_54M 0x0C - -/* Adding this flag to rate_code on B rates - * enables short preamble */ -#define AR5K_SET_SHORT_PREAMBLE 0x04 - -/* - * Crypto definitions - */ - -#define AR5K_KEYCACHE_SIZE 8 -extern bool ath5k_modparam_nohwcrypt; - -/***********************\ - HW RELATED DEFINITIONS -\***********************/ - -/* - * Misc definitions - */ -#define AR5K_RSSI_EP_MULTIPLIER (1 << 7) - -#define AR5K_ASSERT_ENTRY(_e, _s) do { \ - if (_e >= _s) \ - return false; \ -} while (0) - -/* - * Hardware interrupt abstraction - */ - -/** - * enum ath5k_int - Hardware interrupt masks helpers - * @AR5K_INT_RXOK: Frame successfully received - * @AR5K_INT_RXDESC: Request RX descriptor/Read RX descriptor - * @AR5K_INT_RXERR: Frame reception failed - * @AR5K_INT_RXNOFRM: No frame received within a specified time period - * @AR5K_INT_RXEOL: Reached "End Of List", means we need more RX descriptors - * @AR5K_INT_RXORN: Indicates we got RX FIFO overrun. Note that Rx overrun is - * not always fatal, on some chips we can continue operation - * without resetting the card, that's why %AR5K_INT_FATAL is not - * common for all chips. - * @AR5K_INT_RX_ALL: Mask to identify all RX related interrupts - * - * @AR5K_INT_TXOK: Frame transmission success - * @AR5K_INT_TXDESC: Request TX descriptor/Read TX status descriptor - * @AR5K_INT_TXERR: Frame transmission failure - * @AR5K_INT_TXEOL: Received End Of List for VEOL (Virtual End Of List). The - * Queue Control Unit (QCU) signals an EOL interrupt only if a - * descriptor's LinkPtr is NULL. For more details, refer to: - * "http://www.freepatentsonline.com/20030225739.html" - * @AR5K_INT_TXNOFRM: No frame was transmitted within a specified time period - * @AR5K_INT_TXURN: Indicates we got TX FIFO underrun. In such case we should - * increase the TX trigger threshold. - * @AR5K_INT_TX_ALL: Mask to identify all TX related interrupts - * - * @AR5K_INT_MIB: Indicates the either Management Information Base counters or - * one of the PHY error counters reached the maximum value and - * should be read and cleared. - * @AR5K_INT_SWI: Software triggered interrupt. - * @AR5K_INT_RXPHY: RX PHY Error - * @AR5K_INT_RXKCM: RX Key cache miss - * @AR5K_INT_SWBA: SoftWare Beacon Alert - indicates its time to send a - * beacon that must be handled in software. The alternative is if - * you have VEOL support, in that case you let the hardware deal - * with things. - * @AR5K_INT_BRSSI: Beacon received with an RSSI value below our threshold - * @AR5K_INT_BMISS: If in STA mode this indicates we have stopped seeing - * beacons from the AP have associated with, we should probably - * try to reassociate. When in IBSS mode this might mean we have - * not received any beacons from any local stations. Note that - * every station in an IBSS schedules to send beacons at the - * Target Beacon Transmission Time (TBTT) with a random backoff. - * @AR5K_INT_BNR: Beacon queue got triggered (DMA beacon alert) while empty. - * @AR5K_INT_TIM: Beacon with local station's TIM bit set - * @AR5K_INT_DTIM: Beacon with DTIM bit and zero DTIM count received - * @AR5K_INT_DTIM_SYNC: DTIM sync lost - * @AR5K_INT_GPIO: GPIO interrupt is used for RF Kill switches connected to - * our GPIO pins. - * @AR5K_INT_BCN_TIMEOUT: Beacon timeout, we waited after TBTT but got noting - * @AR5K_INT_CAB_TIMEOUT: We waited for CAB traffic after the beacon but got - * nothing or an incomplete CAB frame sequence. - * @AR5K_INT_QCBRORN: A queue got it's CBR counter expired - * @AR5K_INT_QCBRURN: A queue got triggered wile empty - * @AR5K_INT_QTRIG: A queue got triggered - * - * @AR5K_INT_FATAL: Fatal errors were encountered, typically caused by bus/DMA - * errors. Indicates we need to reset the card. - * @AR5K_INT_GLOBAL: Used to clear and set the IER - * @AR5K_INT_NOCARD: Signals the card has been removed - * @AR5K_INT_COMMON: Common interrupts shared among MACs with the same - * bit value - * - * These are mapped to take advantage of some common bits - * between the MACs, to be able to set intr properties - * easier. Some of them are not used yet inside hw.c. Most map - * to the respective hw interrupt value as they are common among different - * MACs. - */ -enum ath5k_int { - AR5K_INT_RXOK = 0x00000001, - AR5K_INT_RXDESC = 0x00000002, - AR5K_INT_RXERR = 0x00000004, - AR5K_INT_RXNOFRM = 0x00000008, - AR5K_INT_RXEOL = 0x00000010, - AR5K_INT_RXORN = 0x00000020, - AR5K_INT_TXOK = 0x00000040, - AR5K_INT_TXDESC = 0x00000080, - AR5K_INT_TXERR = 0x00000100, - AR5K_INT_TXNOFRM = 0x00000200, - AR5K_INT_TXEOL = 0x00000400, - AR5K_INT_TXURN = 0x00000800, - AR5K_INT_MIB = 0x00001000, - AR5K_INT_SWI = 0x00002000, - AR5K_INT_RXPHY = 0x00004000, - AR5K_INT_RXKCM = 0x00008000, - AR5K_INT_SWBA = 0x00010000, - AR5K_INT_BRSSI = 0x00020000, - AR5K_INT_BMISS = 0x00040000, - AR5K_INT_FATAL = 0x00080000, /* Non common */ - AR5K_INT_BNR = 0x00100000, /* Non common */ - AR5K_INT_TIM = 0x00200000, /* Non common */ - AR5K_INT_DTIM = 0x00400000, /* Non common */ - AR5K_INT_DTIM_SYNC = 0x00800000, /* Non common */ - AR5K_INT_GPIO = 0x01000000, - AR5K_INT_BCN_TIMEOUT = 0x02000000, /* Non common */ - AR5K_INT_CAB_TIMEOUT = 0x04000000, /* Non common */ - AR5K_INT_QCBRORN = 0x08000000, /* Non common */ - AR5K_INT_QCBRURN = 0x10000000, /* Non common */ - AR5K_INT_QTRIG = 0x20000000, /* Non common */ - AR5K_INT_GLOBAL = 0x80000000, - - AR5K_INT_TX_ALL = AR5K_INT_TXOK - | AR5K_INT_TXDESC - | AR5K_INT_TXERR - | AR5K_INT_TXNOFRM - | AR5K_INT_TXEOL - | AR5K_INT_TXURN, - - AR5K_INT_RX_ALL = AR5K_INT_RXOK - | AR5K_INT_RXDESC - | AR5K_INT_RXERR - | AR5K_INT_RXNOFRM - | AR5K_INT_RXEOL - | AR5K_INT_RXORN, - - AR5K_INT_COMMON = AR5K_INT_RXOK - | AR5K_INT_RXDESC - | AR5K_INT_RXERR - | AR5K_INT_RXNOFRM - | AR5K_INT_RXEOL - | AR5K_INT_RXORN - | AR5K_INT_TXOK - | AR5K_INT_TXDESC - | AR5K_INT_TXERR - | AR5K_INT_TXNOFRM - | AR5K_INT_TXEOL - | AR5K_INT_TXURN - | AR5K_INT_MIB - | AR5K_INT_SWI - | AR5K_INT_RXPHY - | AR5K_INT_RXKCM - | AR5K_INT_SWBA - | AR5K_INT_BRSSI - | AR5K_INT_BMISS - | AR5K_INT_GPIO - | AR5K_INT_GLOBAL, - - AR5K_INT_NOCARD = 0xffffffff -}; - -/** - * enum ath5k_calibration_mask - Mask which calibration is active at the moment - * @AR5K_CALIBRATION_FULL: Full calibration (AGC + SHORT) - * @AR5K_CALIBRATION_SHORT: Short calibration (NF + I/Q) - * @AR5K_CALIBRATION_NF: Noise Floor calibration - * @AR5K_CALIBRATION_ANI: Adaptive Noise Immunity - */ -enum ath5k_calibration_mask { - AR5K_CALIBRATION_FULL = 0x01, - AR5K_CALIBRATION_SHORT = 0x02, - AR5K_CALIBRATION_NF = 0x04, - AR5K_CALIBRATION_ANI = 0x08, -}; - -/** - * enum ath5k_power_mode - Power management modes - * @AR5K_PM_UNDEFINED: Undefined - * @AR5K_PM_AUTO: Allow card to sleep if possible - * @AR5K_PM_AWAKE: Force card to wake up - * @AR5K_PM_FULL_SLEEP: Force card to full sleep (DANGEROUS) - * @AR5K_PM_NETWORK_SLEEP: Allow to sleep for a specified duration - * - * Currently only PM_AWAKE is used, FULL_SLEEP and NETWORK_SLEEP/AUTO - * are also known to have problems on some cards. This is not a big - * problem though because we can have almost the same effect as - * FULL_SLEEP by putting card on warm reset (it's almost powered down). - */ -enum ath5k_power_mode { - AR5K_PM_UNDEFINED = 0, - AR5K_PM_AUTO, - AR5K_PM_AWAKE, - AR5K_PM_FULL_SLEEP, - AR5K_PM_NETWORK_SLEEP, -}; - -/* - * These match net80211 definitions (not used in - * mac80211). - * TODO: Clean this up - */ -#define AR5K_LED_INIT 0 /*IEEE80211_S_INIT*/ -#define AR5K_LED_SCAN 1 /*IEEE80211_S_SCAN*/ -#define AR5K_LED_AUTH 2 /*IEEE80211_S_AUTH*/ -#define AR5K_LED_ASSOC 3 /*IEEE80211_S_ASSOC*/ -#define AR5K_LED_RUN 4 /*IEEE80211_S_RUN*/ - -/* GPIO-controlled software LED */ -#define AR5K_SOFTLED_PIN 0 -#define AR5K_SOFTLED_ON 0 -#define AR5K_SOFTLED_OFF 1 - - -/* XXX: we *may* move cap_range stuff to struct wiphy */ -struct ath5k_capabilities { - /* - * Supported PHY modes - * (ie. AR5K_MODE_11A, AR5K_MODE_11B, ...) - */ - DECLARE_BITMAP(cap_mode, AR5K_MODE_MAX); - - /* - * Frequency range (without regulation restrictions) - */ - struct { - u16 range_2ghz_min; - u16 range_2ghz_max; - u16 range_5ghz_min; - u16 range_5ghz_max; - } cap_range; - - /* - * Values stored in the EEPROM (some of them...) - */ - struct ath5k_eeprom_info cap_eeprom; - - /* - * Queue information - */ - struct { - u8 q_tx_num; - } cap_queues; - - bool cap_has_phyerr_counters; - bool cap_has_mrr_support; - bool cap_needs_2GHz_ovr; -}; - -/* size of noise floor history (keep it a power of two) */ -#define ATH5K_NF_CAL_HIST_MAX 8 -struct ath5k_nfcal_hist { - s16 index; /* current index into nfval */ - s16 nfval[ATH5K_NF_CAL_HIST_MAX]; /* last few noise floors */ -}; - -#define ATH5K_LED_MAX_NAME_LEN 31 - -/* - * State for LED triggers - */ -struct ath5k_led { - char name[ATH5K_LED_MAX_NAME_LEN + 1]; /* name of the LED in sysfs */ - struct ath5k_hw *ah; /* driver state */ - struct led_classdev led_dev; /* led classdev */ -}; - -/* Rfkill */ -struct ath5k_rfkill { - /* GPIO PIN for rfkill */ - u16 gpio; - /* polarity of rfkill GPIO PIN */ - bool polarity; - /* RFKILL toggle tasklet */ - struct tasklet_struct toggleq; -}; - -/* statistics */ -struct ath5k_statistics { - /* antenna use */ - unsigned int antenna_rx[5]; /* frames count per antenna RX */ - unsigned int antenna_tx[5]; /* frames count per antenna TX */ - - /* frame errors */ - unsigned int rx_all_count; /* all RX frames, including errors */ - unsigned int tx_all_count; /* all TX frames, including errors */ - unsigned int rx_bytes_count; /* all RX bytes, including errored pkts - * and the MAC headers for each packet - */ - unsigned int tx_bytes_count; /* all TX bytes, including errored pkts - * and the MAC headers and padding for - * each packet. - */ - unsigned int rxerr_crc; - unsigned int rxerr_phy; - unsigned int rxerr_phy_code[32]; - unsigned int rxerr_fifo; - unsigned int rxerr_decrypt; - unsigned int rxerr_mic; - unsigned int rxerr_proc; - unsigned int rxerr_jumbo; - unsigned int txerr_retry; - unsigned int txerr_fifo; - unsigned int txerr_filt; - - /* MIB counters */ - unsigned int ack_fail; - unsigned int rts_fail; - unsigned int rts_ok; - unsigned int fcs_error; - unsigned int beacons; - - unsigned int mib_intr; - unsigned int rxorn_intr; - unsigned int rxeol_intr; -}; - -/* - * Misc defines - */ - -#define AR5K_MAX_GPIO 10 -#define AR5K_MAX_RF_BANKS 8 - -#if CHAN_DEBUG -#define ATH_CHAN_MAX (26 + 26 + 26 + 200 + 200) -#else -#define ATH_CHAN_MAX (14 + 14 + 14 + 252 + 20) -#endif - -#define ATH_RXBUF 40 /* number of RX buffers */ -#define ATH_TXBUF 200 /* number of TX buffers */ -#define ATH_BCBUF 4 /* number of beacon buffers */ -#define ATH5K_TXQ_LEN_MAX (ATH_TXBUF / 4) /* bufs per queue */ -#define ATH5K_TXQ_LEN_LOW (ATH5K_TXQ_LEN_MAX / 2) /* low mark */ - -/* Driver state associated with an instance of a device */ -struct ath5k_hw { - struct ath_common common; - - struct pci_dev *pdev; - struct device *dev; /* for dma mapping */ - int irq; - u16 devid; - void __iomem *iobase; /* address of the device */ - struct mutex lock; /* dev-level lock */ - struct ieee80211_hw *hw; /* IEEE 802.11 common */ - struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; - struct ieee80211_channel channels[ATH_CHAN_MAX]; - struct ieee80211_rate rates[IEEE80211_NUM_BANDS][AR5K_MAX_RATES]; - s8 rate_idx[IEEE80211_NUM_BANDS][AR5K_MAX_RATES]; - enum nl80211_iftype opmode; - -#ifdef CONFIG_ATH5K_DEBUG - struct ath5k_dbg_info debug; /* debug info */ -#endif /* CONFIG_ATH5K_DEBUG */ - - struct ath5k_buf *bufptr; /* allocated buffer ptr */ - struct ath5k_desc *desc; /* TX/RX descriptors */ - dma_addr_t desc_daddr; /* DMA (physical) address */ - size_t desc_len; /* size of TX/RX descriptors */ - - DECLARE_BITMAP(status, 4); -#define ATH_STAT_INVALID 0 /* disable hardware accesses */ -#define ATH_STAT_PROMISC 1 -#define ATH_STAT_LEDSOFT 2 /* enable LED gpio status */ -#define ATH_STAT_STARTED 3 /* opened & irqs enabled */ - - unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */ - struct ieee80211_channel *curchan; /* current h/w channel */ - - u16 nvifs; - - enum ath5k_int imask; /* interrupt mask copy */ - - spinlock_t irqlock; - bool rx_pending; /* rx tasklet pending */ - bool tx_pending; /* tx tasklet pending */ - - u8 bssidmask[ETH_ALEN]; - - unsigned int led_pin, /* GPIO pin for driving LED */ - led_on; /* pin setting for LED on */ - - struct work_struct reset_work; /* deferred chip reset */ - struct work_struct calib_work; /* deferred phy calibration */ - - struct list_head rxbuf; /* receive buffer */ - spinlock_t rxbuflock; - u32 *rxlink; /* link ptr in last RX desc */ - struct tasklet_struct rxtq; /* rx intr tasklet */ - struct ath5k_led rx_led; /* rx led */ - - struct list_head txbuf; /* transmit buffer */ - spinlock_t txbuflock; - unsigned int txbuf_len; /* buf count in txbuf list */ - struct ath5k_txq txqs[AR5K_NUM_TX_QUEUES]; /* tx queues */ - struct tasklet_struct txtq; /* tx intr tasklet */ - struct ath5k_led tx_led; /* tx led */ - - struct ath5k_rfkill rf_kill; - - spinlock_t block; /* protects beacon */ - struct tasklet_struct beacontq; /* beacon intr tasklet */ - struct list_head bcbuf; /* beacon buffer */ - struct ieee80211_vif *bslot[ATH_BCBUF]; - u16 num_ap_vifs; - u16 num_adhoc_vifs; - u16 num_mesh_vifs; - unsigned int bhalq, /* SW q for outgoing beacons */ - bmisscount, /* missed beacon transmits */ - bintval, /* beacon interval in TU */ - bsent; - unsigned int nexttbtt; /* next beacon time in TU */ - struct ath5k_txq *cabq; /* content after beacon */ - - bool assoc; /* associate state */ - bool enable_beacon; /* true if beacons are on */ - - struct ath5k_statistics stats; - - struct ath5k_ani_state ani_state; - struct tasklet_struct ani_tasklet; /* ANI calibration */ - - struct delayed_work tx_complete_work; - - struct survey_info survey; /* collected survey info */ - - enum ath5k_int ah_imr; - - struct ieee80211_channel *ah_current_channel; - bool ah_iq_cal_needed; - bool ah_single_chip; - - enum ath5k_version ah_version; - enum ath5k_radio ah_radio; - u32 ah_mac_srev; - u16 ah_mac_version; - u16 ah_phy_revision; - u16 ah_radio_5ghz_revision; - u16 ah_radio_2ghz_revision; - -#define ah_modes ah_capabilities.cap_mode -#define ah_ee_version ah_capabilities.cap_eeprom.ee_version - - u8 ah_retry_long; - u8 ah_retry_short; - - u32 ah_use_32khz_clock; - - u8 ah_coverage_class; - bool ah_ack_bitrate_high; - u8 ah_bwmode; - bool ah_short_slot; - - /* Antenna Control */ - u32 ah_ant_ctl[AR5K_EEPROM_N_MODES][AR5K_ANT_MAX]; - u8 ah_ant_mode; - u8 ah_tx_ant; - u8 ah_def_ant; - - struct ath5k_capabilities ah_capabilities; - - struct ath5k_txq_info ah_txq[AR5K_NUM_TX_QUEUES]; - u32 ah_txq_status; - u32 ah_txq_imr_txok; - u32 ah_txq_imr_txerr; - u32 ah_txq_imr_txurn; - u32 ah_txq_imr_txdesc; - u32 ah_txq_imr_txeol; - u32 ah_txq_imr_cbrorn; - u32 ah_txq_imr_cbrurn; - u32 ah_txq_imr_qtrig; - u32 ah_txq_imr_nofrm; - - u32 ah_txq_isr_txok_all; - u32 ah_txq_isr_txurn; - u32 ah_txq_isr_qcborn; - u32 ah_txq_isr_qcburn; - u32 ah_txq_isr_qtrig; - - u32 *ah_rf_banks; - size_t ah_rf_banks_size; - size_t ah_rf_regs_count; - struct ath5k_gain ah_gain; - u8 ah_offset[AR5K_MAX_RF_BANKS]; - - - struct { - /* Temporary tables used for interpolation */ - u8 tmpL[AR5K_EEPROM_N_PD_GAINS] - [AR5K_EEPROM_POWER_TABLE_SIZE]; - u8 tmpR[AR5K_EEPROM_N_PD_GAINS] - [AR5K_EEPROM_POWER_TABLE_SIZE]; - u8 txp_pd_table[AR5K_EEPROM_POWER_TABLE_SIZE * 2]; - u16 txp_rates_power_table[AR5K_MAX_RATES]; - u8 txp_min_idx; - bool txp_tpc; - /* Values in 0.25dB units */ - s16 txp_min_pwr; - s16 txp_max_pwr; - s16 txp_cur_pwr; - /* Values in 0.5dB units */ - s16 txp_offset; - s16 txp_ofdm; - s16 txp_cck_ofdm_gainf_delta; - /* Value in dB units */ - s16 txp_cck_ofdm_pwr_delta; - bool txp_setup; - int txp_requested; /* Requested tx power in dBm */ - } ah_txpower; - - struct ath5k_nfcal_hist ah_nfcal_hist; - - /* average beacon RSSI in our BSS (used by ANI) */ - struct ewma ah_beacon_rssi_avg; - - /* noise floor from last periodic calibration */ - s32 ah_noise_floor; - - /* Calibration timestamp */ - unsigned long ah_cal_next_full; - unsigned long ah_cal_next_short; - unsigned long ah_cal_next_ani; - - /* Calibration mask */ - u8 ah_cal_mask; - - /* - * Function pointers - */ - int (*ah_setup_tx_desc)(struct ath5k_hw *, struct ath5k_desc *, - unsigned int, unsigned int, int, enum ath5k_pkt_type, - unsigned int, unsigned int, unsigned int, unsigned int, - unsigned int, unsigned int, unsigned int, unsigned int); - int (*ah_proc_tx_desc)(struct ath5k_hw *, struct ath5k_desc *, - struct ath5k_tx_status *); - int (*ah_proc_rx_desc)(struct ath5k_hw *, struct ath5k_desc *, - struct ath5k_rx_status *); -}; - -struct ath_bus_ops { - enum ath_bus_type ath_bus_type; - void (*read_cachesize)(struct ath_common *common, int *csz); - bool (*eeprom_read)(struct ath_common *common, u32 off, u16 *data); - int (*eeprom_read_mac)(struct ath5k_hw *ah, u8 *mac); -}; - -/* - * Prototypes - */ -extern const struct ieee80211_ops ath5k_hw_ops; - -/* Initialization and detach functions */ -int ath5k_hw_init(struct ath5k_hw *ah); -void ath5k_hw_deinit(struct ath5k_hw *ah); - -int ath5k_sysfs_register(struct ath5k_hw *ah); -void ath5k_sysfs_unregister(struct ath5k_hw *ah); - -/*Chip id helper functions */ -int ath5k_hw_read_srev(struct ath5k_hw *ah); - -/* LED functions */ -int ath5k_init_leds(struct ath5k_hw *ah); -void ath5k_led_enable(struct ath5k_hw *ah); -void ath5k_led_off(struct ath5k_hw *ah); -void ath5k_unregister_leds(struct ath5k_hw *ah); - - -/* Reset Functions */ -int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, struct ieee80211_channel *channel); -int ath5k_hw_on_hold(struct ath5k_hw *ah); -int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, - struct ieee80211_channel *channel, bool fast, bool skip_pcu); -int ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag, u32 val, - bool is_set); -/* Power management functions */ - - -/* Clock rate related functions */ -unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec); -unsigned int ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock); -void ath5k_hw_set_clockrate(struct ath5k_hw *ah); - - -/* DMA Related Functions */ -void ath5k_hw_start_rx_dma(struct ath5k_hw *ah); -u32 ath5k_hw_get_rxdp(struct ath5k_hw *ah); -int ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr); -int ath5k_hw_start_tx_dma(struct ath5k_hw *ah, unsigned int queue); -int ath5k_hw_stop_beacon_queue(struct ath5k_hw *ah, unsigned int queue); -u32 ath5k_hw_get_txdp(struct ath5k_hw *ah, unsigned int queue); -int ath5k_hw_set_txdp(struct ath5k_hw *ah, unsigned int queue, - u32 phys_addr); -int ath5k_hw_update_tx_triglevel(struct ath5k_hw *ah, bool increase); -/* Interrupt handling */ -bool ath5k_hw_is_intr_pending(struct ath5k_hw *ah); -int ath5k_hw_get_isr(struct ath5k_hw *ah, enum ath5k_int *interrupt_mask); -enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask); -void ath5k_hw_update_mib_counters(struct ath5k_hw *ah); -/* Init/Stop functions */ -void ath5k_hw_dma_init(struct ath5k_hw *ah); -int ath5k_hw_dma_stop(struct ath5k_hw *ah); - -/* EEPROM access functions */ -int ath5k_eeprom_init(struct ath5k_hw *ah); -void ath5k_eeprom_detach(struct ath5k_hw *ah); -int ath5k_eeprom_mode_from_channel(struct ath5k_hw *ah, - struct ieee80211_channel *channel); - -/* Protocol Control Unit Functions */ -/* Helpers */ -int ath5k_hw_get_frame_duration(struct ath5k_hw *ah, enum ieee80211_band band, - int len, struct ieee80211_rate *rate, bool shortpre); -unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah); -unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah); -int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype opmode); -void ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class); -/* RX filter control*/ -int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac); -void ath5k_hw_set_bssid(struct ath5k_hw *ah); -void ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask); -void ath5k_hw_set_mcast_filter(struct ath5k_hw *ah, u32 filter0, u32 filter1); -u32 ath5k_hw_get_rx_filter(struct ath5k_hw *ah); -void ath5k_hw_set_rx_filter(struct ath5k_hw *ah, u32 filter); -/* Receive (DRU) start/stop functions */ -void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah); -void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah); -/* Beacon control functions */ -u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah); -void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64); -void ath5k_hw_reset_tsf(struct ath5k_hw *ah); -void ath5k_hw_init_beacon_timers(struct ath5k_hw *ah, u32 next_beacon, - u32 interval); -bool ath5k_hw_check_beacon_timers(struct ath5k_hw *ah, int intval); -/* Init function */ -void ath5k_hw_pcu_init(struct ath5k_hw *ah, enum nl80211_iftype op_mode); - -/* Queue Control Unit, DFS Control Unit Functions */ -int ath5k_hw_get_tx_queueprops(struct ath5k_hw *ah, int queue, - struct ath5k_txq_info *queue_info); -int ath5k_hw_set_tx_queueprops(struct ath5k_hw *ah, int queue, - const struct ath5k_txq_info *queue_info); -int ath5k_hw_setup_tx_queue(struct ath5k_hw *ah, - enum ath5k_tx_queue queue_type, - struct ath5k_txq_info *queue_info); -void ath5k_hw_set_tx_retry_limits(struct ath5k_hw *ah, - unsigned int queue); -u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue); -void ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue); -int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue); -int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time); -/* Init function */ -int ath5k_hw_init_queues(struct ath5k_hw *ah); - -/* Hardware Descriptor Functions */ -int ath5k_hw_init_desc_functions(struct ath5k_hw *ah); -int ath5k_hw_setup_rx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc, - u32 size, unsigned int flags); -int ath5k_hw_setup_mrr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc, - unsigned int tx_rate1, u_int tx_tries1, u_int tx_rate2, - u_int tx_tries2, unsigned int tx_rate3, u_int tx_tries3); - - -/* GPIO Functions */ -void ath5k_hw_set_ledstate(struct ath5k_hw *ah, unsigned int state); -int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio); -int ath5k_hw_set_gpio_output(struct ath5k_hw *ah, u32 gpio); -u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio); -int ath5k_hw_set_gpio(struct ath5k_hw *ah, u32 gpio, u32 val); -void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio, - u32 interrupt_level); - - -/* RFkill Functions */ -void ath5k_rfkill_hw_start(struct ath5k_hw *ah); -void ath5k_rfkill_hw_stop(struct ath5k_hw *ah); - - -/* Misc functions TODO: Cleanup */ -int ath5k_hw_set_capabilities(struct ath5k_hw *ah); -int ath5k_hw_enable_pspoll(struct ath5k_hw *ah, u8 *bssid, u16 assoc_id); -int ath5k_hw_disable_pspoll(struct ath5k_hw *ah); - - -/* Initial register settings functions */ -int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel); - - -/* PHY functions */ -/* Misc PHY functions */ -u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, enum ieee80211_band band); -int ath5k_hw_phy_disable(struct ath5k_hw *ah); -/* Gain_F optimization */ -enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah); -int ath5k_hw_rfgain_opt_init(struct ath5k_hw *ah); -/* PHY/RF channel functions */ -bool ath5k_channel_ok(struct ath5k_hw *ah, struct ieee80211_channel *channel); -/* PHY calibration */ -void ath5k_hw_init_nfcal_hist(struct ath5k_hw *ah); -int ath5k_hw_phy_calibrate(struct ath5k_hw *ah, - struct ieee80211_channel *channel); -void ath5k_hw_update_noise_floor(struct ath5k_hw *ah); -/* Spur mitigation */ -bool ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah, - struct ieee80211_channel *channel); -/* Antenna control */ -void ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode); -void ath5k_hw_set_antenna_switch(struct ath5k_hw *ah, u8 ee_mode); -/* TX power setup */ -int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower); -/* Init function */ -int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, - u8 mode, bool fast); - -/* - * Functions used internally - */ - -static inline struct ath_common *ath5k_hw_common(struct ath5k_hw *ah) -{ - return &ah->common; -} - -static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah) -{ - return &(ath5k_hw_common(ah)->regulatory); -} - -#ifdef CONFIG_ATHEROS_AR231X -#define AR5K_AR2315_PCI_BASE ((void __iomem *)0xb0100000) - -static inline void __iomem *ath5k_ahb_reg(struct ath5k_hw *ah, u16 reg) -{ - /* On AR2315 and AR2317 the PCI clock domain registers - * are outside of the WMAC register space */ - if (unlikely((reg >= 0x4000) && (reg < 0x5000) && - (ah->ah_mac_srev >= AR5K_SREV_AR2315_R6))) - return AR5K_AR2315_PCI_BASE + reg; - - return ah->iobase + reg; -} - -static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg) -{ - return ioread32(ath5k_ahb_reg(ah, reg)); -} - -static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg) -{ - iowrite32(val, ath5k_ahb_reg(ah, reg)); -} - -#else - -static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg) -{ - return ioread32(ah->iobase + reg); -} - -static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg) -{ - iowrite32(val, ah->iobase + reg); -} - -#endif - -static inline enum ath_bus_type ath5k_get_bus_type(struct ath5k_hw *ah) -{ - return ath5k_hw_common(ah)->bus_ops->ath_bus_type; -} - -static inline void ath5k_read_cachesize(struct ath_common *common, int *csz) -{ - common->bus_ops->read_cachesize(common, csz); -} - -static inline bool ath5k_hw_nvram_read(struct ath5k_hw *ah, u32 off, u16 *data) -{ - struct ath_common *common = ath5k_hw_common(ah); - return common->bus_ops->eeprom_read(common, off, data); -} - -static inline u32 ath5k_hw_bitswap(u32 val, unsigned int bits) -{ - u32 retval = 0, bit, i; - - for (i = 0; i < bits; i++) { - bit = (val >> i) & 1; - retval = (retval << 1) | bit; - } - - return retval; -} - -#endif diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c deleted file mode 100644 index 7106547a14dd..000000000000 --- a/drivers/net/wireless/ath/ath5k/attach.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright (c) 2004-2008 Reyk Floeter - * Copyright (c) 2006-2008 Nick Kossifidis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/*************************************\ -* Attach/Detach Functions and helpers * -\*************************************/ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include "ath5k.h" -#include "reg.h" -#include "debug.h" - -/** - * ath5k_hw_post() - Power On Self Test helper function - * @ah: The &struct ath5k_hw - */ -static int ath5k_hw_post(struct ath5k_hw *ah) -{ - - static const u32 static_pattern[4] = { - 0x55555555, 0xaaaaaaaa, - 0x66666666, 0x99999999 - }; - static const u16 regs[2] = { AR5K_STA_ID0, AR5K_PHY(8) }; - int i, c; - u16 cur_reg; - u32 var_pattern; - u32 init_val; - u32 cur_val; - - for (c = 0; c < 2; c++) { - - cur_reg = regs[c]; - - /* Save previous value */ - init_val = ath5k_hw_reg_read(ah, cur_reg); - - for (i = 0; i < 256; i++) { - var_pattern = i << 16 | i; - ath5k_hw_reg_write(ah, var_pattern, cur_reg); - cur_val = ath5k_hw_reg_read(ah, cur_reg); - - if (cur_val != var_pattern) { - ATH5K_ERR(ah, "POST Failed !!!\n"); - return -EAGAIN; - } - - /* Found on ndiswrapper dumps */ - var_pattern = 0x0039080f; - ath5k_hw_reg_write(ah, var_pattern, cur_reg); - } - - for (i = 0; i < 4; i++) { - var_pattern = static_pattern[i]; - ath5k_hw_reg_write(ah, var_pattern, cur_reg); - cur_val = ath5k_hw_reg_read(ah, cur_reg); - - if (cur_val != var_pattern) { - ATH5K_ERR(ah, "POST Failed !!!\n"); - return -EAGAIN; - } - - /* Found on ndiswrapper dumps */ - var_pattern = 0x003b080f; - ath5k_hw_reg_write(ah, var_pattern, cur_reg); - } - - /* Restore previous value */ - ath5k_hw_reg_write(ah, init_val, cur_reg); - - } - - return 0; - -} - -/** - * ath5k_hw_init() - Check if hw is supported and init the needed structs - * @ah: The &struct ath5k_hw associated with the device - * - * Check if the device is supported, perform a POST and initialize the needed - * structs. Returns -ENOMEM if we don't have memory for the needed structs, - * -ENODEV if the device is not supported or prints an error msg if something - * else went wrong. - */ -int ath5k_hw_init(struct ath5k_hw *ah) -{ - static const u8 zero_mac[ETH_ALEN] = { }; - struct ath_common *common = ath5k_hw_common(ah); - struct pci_dev *pdev = ah->pdev; - struct ath5k_eeprom_info *ee; - int ret; - u32 srev; - - /* - * HW information - */ - ah->ah_bwmode = AR5K_BWMODE_DEFAULT; - ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER; - ah->ah_imr = 0; - ah->ah_retry_short = AR5K_INIT_RETRY_SHORT; - ah->ah_retry_long = AR5K_INIT_RETRY_LONG; - ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT; - ah->ah_noise_floor = -95; /* until first NF calibration is run */ - ah->ani_state.ani_mode = ATH5K_ANI_MODE_AUTO; - ah->ah_current_channel = &ah->channels[0]; - - /* - * Find the mac version - */ - ath5k_hw_read_srev(ah); - srev = ah->ah_mac_srev; - if (srev < AR5K_SREV_AR5311) - ah->ah_version = AR5K_AR5210; - else if (srev < AR5K_SREV_AR5212) - ah->ah_version = AR5K_AR5211; - else - ah->ah_version = AR5K_AR5212; - - /* Get the MAC version */ - ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER); - - /* Fill the ath5k_hw struct with the needed functions */ - ret = ath5k_hw_init_desc_functions(ah); - if (ret) - goto err; - - /* Bring device out of sleep and reset its units */ - ret = ath5k_hw_nic_wakeup(ah, NULL); - if (ret) - goto err; - - /* Get PHY and RADIO revisions */ - ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) & - 0xffffffff; - ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah, - IEEE80211_BAND_5GHZ); - - /* Try to identify radio chip based on its srev */ - switch (ah->ah_radio_5ghz_revision & 0xf0) { - case AR5K_SREV_RAD_5111: - ah->ah_radio = AR5K_RF5111; - ah->ah_single_chip = false; - ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah, - IEEE80211_BAND_2GHZ); - break; - case AR5K_SREV_RAD_5112: - case AR5K_SREV_RAD_2112: - ah->ah_radio = AR5K_RF5112; - ah->ah_single_chip = false; - ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah, - IEEE80211_BAND_2GHZ); - break; - case AR5K_SREV_RAD_2413: - ah->ah_radio = AR5K_RF2413; - ah->ah_single_chip = true; - break; - case AR5K_SREV_RAD_5413: - ah->ah_radio = AR5K_RF5413; - ah->ah_single_chip = true; - break; - case AR5K_SREV_RAD_2316: - ah->ah_radio = AR5K_RF2316; - ah->ah_single_chip = true; - break; - case AR5K_SREV_RAD_2317: - ah->ah_radio = AR5K_RF2317; - ah->ah_single_chip = true; - break; - case AR5K_SREV_RAD_5424: - if (ah->ah_mac_version == AR5K_SREV_AR2425 || - ah->ah_mac_version == AR5K_SREV_AR2417) { - ah->ah_radio = AR5K_RF2425; - ah->ah_single_chip = true; - } else { - ah->ah_radio = AR5K_RF5413; - ah->ah_single_chip = true; - } - break; - default: - /* Identify radio based on mac/phy srev */ - if (ah->ah_version == AR5K_AR5210) { - ah->ah_radio = AR5K_RF5110; - ah->ah_single_chip = false; - } else if (ah->ah_version == AR5K_AR5211) { - ah->ah_radio = AR5K_RF5111; - ah->ah_single_chip = false; - ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah, - IEEE80211_BAND_2GHZ); - } else if (ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4) || - ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4) || - ah->ah_phy_revision == AR5K_SREV_PHY_2425) { - ah->ah_radio = AR5K_RF2425; - ah->ah_single_chip = true; - ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2425; - } else if (srev == AR5K_SREV_AR5213A && - ah->ah_phy_revision == AR5K_SREV_PHY_5212B) { - ah->ah_radio = AR5K_RF5112; - ah->ah_single_chip = false; - ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_5112B; - } else if (ah->ah_mac_version == (AR5K_SREV_AR2415 >> 4) || - ah->ah_mac_version == (AR5K_SREV_AR2315_R6 >> 4)) { - ah->ah_radio = AR5K_RF2316; - ah->ah_single_chip = true; - ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2316; - } else if (ah->ah_mac_version == (AR5K_SREV_AR5414 >> 4) || - ah->ah_phy_revision == AR5K_SREV_PHY_5413) { - ah->ah_radio = AR5K_RF5413; - ah->ah_single_chip = true; - ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_5413; - } else if (ah->ah_mac_version == (AR5K_SREV_AR2414 >> 4) || - ah->ah_phy_revision == AR5K_SREV_PHY_2413) { - ah->ah_radio = AR5K_RF2413; - ah->ah_single_chip = true; - ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2413; - } else { - ATH5K_ERR(ah, "Couldn't identify radio revision.\n"); - ret = -ENODEV; - goto err; - } - } - - - /* Return on unsupported chips (unsupported eeprom etc) */ - if ((srev >= AR5K_SREV_AR5416) && (srev < AR5K_SREV_AR2425)) { - ATH5K_ERR(ah, "Device not yet supported.\n"); - ret = -ENODEV; - goto err; - } - - /* - * POST - */ - ret = ath5k_hw_post(ah); - if (ret) - goto err; - - /* Enable pci core retry fix on Hainan (5213A) and later chips */ - if (srev >= AR5K_SREV_AR5213A) - AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, AR5K_PCICFG_RETRY_FIX); - - /* - * Get card capabilities, calibration values etc - * TODO: EEPROM work - */ - ret = ath5k_eeprom_init(ah); - if (ret) { - ATH5K_ERR(ah, "unable to init EEPROM\n"); - goto err; - } - - ee = &ah->ah_capabilities.cap_eeprom; - - /* - * Write PCI-E power save settings - */ - if ((ah->ah_version == AR5K_AR5212) && pdev && (pci_is_pcie(pdev))) { - ath5k_hw_reg_write(ah, 0x9248fc00, AR5K_PCIE_SERDES); - ath5k_hw_reg_write(ah, 0x24924924, AR5K_PCIE_SERDES); - - /* Shut off RX when elecidle is asserted */ - ath5k_hw_reg_write(ah, 0x28000039, AR5K_PCIE_SERDES); - ath5k_hw_reg_write(ah, 0x53160824, AR5K_PCIE_SERDES); - - /* If serdes programming is enabled, increase PCI-E - * tx power for systems with long trace from host - * to minicard connector. */ - if (ee->ee_serdes) - ath5k_hw_reg_write(ah, 0xe5980579, AR5K_PCIE_SERDES); - else - ath5k_hw_reg_write(ah, 0xf6800579, AR5K_PCIE_SERDES); - - /* Shut off PLL and CLKREQ active in L1 */ - ath5k_hw_reg_write(ah, 0x001defff, AR5K_PCIE_SERDES); - - /* Preserve other settings */ - ath5k_hw_reg_write(ah, 0x1aaabe40, AR5K_PCIE_SERDES); - ath5k_hw_reg_write(ah, 0xbe105554, AR5K_PCIE_SERDES); - ath5k_hw_reg_write(ah, 0x000e3007, AR5K_PCIE_SERDES); - - /* Reset SERDES to load new settings */ - ath5k_hw_reg_write(ah, 0x00000000, AR5K_PCIE_SERDES_RESET); - usleep_range(1000, 1500); - } - - /* Get misc capabilities */ - ret = ath5k_hw_set_capabilities(ah); - if (ret) { - ATH5K_ERR(ah, "unable to get device capabilities\n"); - goto err; - } - - /* Crypto settings */ - common->keymax = (ah->ah_version == AR5K_AR5210 ? - AR5K_KEYTABLE_SIZE_5210 : AR5K_KEYTABLE_SIZE_5211); - - if (srev >= AR5K_SREV_AR5212_V4 && - (ee->ee_version < AR5K_EEPROM_VERSION_5_0 || - !AR5K_EEPROM_AES_DIS(ee->ee_misc5))) - common->crypt_caps |= ATH_CRYPT_CAP_CIPHER_AESCCM; - - if (srev >= AR5K_SREV_AR2414) { - common->crypt_caps |= ATH_CRYPT_CAP_MIC_COMBINED; - AR5K_REG_ENABLE_BITS(ah, AR5K_MISC_MODE, - AR5K_MISC_MODE_COMBINED_MIC); - } - - /* MAC address is cleared until add_interface */ - ath5k_hw_set_lladdr(ah, zero_mac); - - /* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */ - memcpy(common->curbssid, ath_bcast_mac, ETH_ALEN); - ath5k_hw_set_bssid(ah); - ath5k_hw_set_opmode(ah, ah->opmode); - - ath5k_hw_rfgain_opt_init(ah); - - ath5k_hw_init_nfcal_hist(ah); - - /* turn on HW LEDs */ - ath5k_hw_set_ledstate(ah, AR5K_LED_INIT); - - return 0; -err: - return ret; -} - -/** - * ath5k_hw_deinit() - Free the &struct ath5k_hw - * @ah: The &struct ath5k_hw - */ -void ath5k_hw_deinit(struct ath5k_hw *ah) -{ - __set_bit(ATH_STAT_INVALID, ah->status); - - if (ah->ah_rf_banks != NULL) - kfree(ah->ah_rf_banks); - - ath5k_eeprom_detach(ah); - - /* assume interrupts are down */ -} diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c deleted file mode 100644 index 7f702fe3ecc2..000000000000 --- a/drivers/net/wireless/ath/ath5k/base.c +++ /dev/null @@ -1,3082 +0,0 @@ -/*- - * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting - * Copyright (c) 2004-2005 Atheros Communications, Inc. - * Copyright (c) 2006 Devicescape Software, Inc. - * Copyright (c) 2007 Jiri Slaby - * Copyright (c) 2007 Luis R. Rodriguez - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any - * redistribution must be conditioned upon including a substantially - * similar Disclaimer requirement for further binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGES. - * - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "base.h" -#include "reg.h" -#include "debug.h" -#include "ani.h" -#include "ath5k.h" -#include "../regd.h" - -#define CREATE_TRACE_POINTS -#include "trace.h" - -bool ath5k_modparam_nohwcrypt; -module_param_named(nohwcrypt, ath5k_modparam_nohwcrypt, bool, S_IRUGO); -MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); - -static bool modparam_fastchanswitch; -module_param_named(fastchanswitch, modparam_fastchanswitch, bool, S_IRUGO); -MODULE_PARM_DESC(fastchanswitch, "Enable fast channel switching for AR2413/AR5413 radios."); - -static bool ath5k_modparam_no_hw_rfkill_switch; -module_param_named(no_hw_rfkill_switch, ath5k_modparam_no_hw_rfkill_switch, - bool, S_IRUGO); -MODULE_PARM_DESC(no_hw_rfkill_switch, "Ignore the GPIO RFKill switch state"); - - -/* Module info */ -MODULE_AUTHOR("Jiri Slaby"); -MODULE_AUTHOR("Nick Kossifidis"); -MODULE_DESCRIPTION("Support for 5xxx series of Atheros 802.11 wireless LAN cards."); -MODULE_SUPPORTED_DEVICE("Atheros 5xxx WLAN cards"); -MODULE_LICENSE("Dual BSD/GPL"); - -static int ath5k_init(struct ieee80211_hw *hw); -static int ath5k_reset(struct ath5k_hw *ah, struct ieee80211_channel *chan, - bool skip_pcu); - -/* Known SREVs */ -static const struct ath5k_srev_name srev_names[] = { -#ifdef CONFIG_ATHEROS_AR231X - { "5312", AR5K_VERSION_MAC, AR5K_SREV_AR5312_R2 }, - { "5312", AR5K_VERSION_MAC, AR5K_SREV_AR5312_R7 }, - { "2313", AR5K_VERSION_MAC, AR5K_SREV_AR2313_R8 }, - { "2315", AR5K_VERSION_MAC, AR5K_SREV_AR2315_R6 }, - { "2315", AR5K_VERSION_MAC, AR5K_SREV_AR2315_R7 }, - { "2317", AR5K_VERSION_MAC, AR5K_SREV_AR2317_R1 }, - { "2317", AR5K_VERSION_MAC, AR5K_SREV_AR2317_R2 }, -#else - { "5210", AR5K_VERSION_MAC, AR5K_SREV_AR5210 }, - { "5311", AR5K_VERSION_MAC, AR5K_SREV_AR5311 }, - { "5311A", AR5K_VERSION_MAC, AR5K_SREV_AR5311A }, - { "5311B", AR5K_VERSION_MAC, AR5K_SREV_AR5311B }, - { "5211", AR5K_VERSION_MAC, AR5K_SREV_AR5211 }, - { "5212", AR5K_VERSION_MAC, AR5K_SREV_AR5212 }, - { "5213", AR5K_VERSION_MAC, AR5K_SREV_AR5213 }, - { "5213A", AR5K_VERSION_MAC, AR5K_SREV_AR5213A }, - { "2413", AR5K_VERSION_MAC, AR5K_SREV_AR2413 }, - { "2414", AR5K_VERSION_MAC, AR5K_SREV_AR2414 }, - { "5424", AR5K_VERSION_MAC, AR5K_SREV_AR5424 }, - { "5413", AR5K_VERSION_MAC, AR5K_SREV_AR5413 }, - { "5414", AR5K_VERSION_MAC, AR5K_SREV_AR5414 }, - { "2415", AR5K_VERSION_MAC, AR5K_SREV_AR2415 }, - { "5416", AR5K_VERSION_MAC, AR5K_SREV_AR5416 }, - { "5418", AR5K_VERSION_MAC, AR5K_SREV_AR5418 }, - { "2425", AR5K_VERSION_MAC, AR5K_SREV_AR2425 }, - { "2417", AR5K_VERSION_MAC, AR5K_SREV_AR2417 }, -#endif - { "xxxxx", AR5K_VERSION_MAC, AR5K_SREV_UNKNOWN }, - { "5110", AR5K_VERSION_RAD, AR5K_SREV_RAD_5110 }, - { "5111", AR5K_VERSION_RAD, AR5K_SREV_RAD_5111 }, - { "5111A", AR5K_VERSION_RAD, AR5K_SREV_RAD_5111A }, - { "2111", AR5K_VERSION_RAD, AR5K_SREV_RAD_2111 }, - { "5112", AR5K_VERSION_RAD, AR5K_SREV_RAD_5112 }, - { "5112A", AR5K_VERSION_RAD, AR5K_SREV_RAD_5112A }, - { "5112B", AR5K_VERSION_RAD, AR5K_SREV_RAD_5112B }, - { "2112", AR5K_VERSION_RAD, AR5K_SREV_RAD_2112 }, - { "2112A", AR5K_VERSION_RAD, AR5K_SREV_RAD_2112A }, - { "2112B", AR5K_VERSION_RAD, AR5K_SREV_RAD_2112B }, - { "2413", AR5K_VERSION_RAD, AR5K_SREV_RAD_2413 }, - { "5413", AR5K_VERSION_RAD, AR5K_SREV_RAD_5413 }, - { "5424", AR5K_VERSION_RAD, AR5K_SREV_RAD_5424 }, - { "5133", AR5K_VERSION_RAD, AR5K_SREV_RAD_5133 }, -#ifdef CONFIG_ATHEROS_AR231X - { "2316", AR5K_VERSION_RAD, AR5K_SREV_RAD_2316 }, - { "2317", AR5K_VERSION_RAD, AR5K_SREV_RAD_2317 }, -#endif - { "xxxxx", AR5K_VERSION_RAD, AR5K_SREV_UNKNOWN }, -}; - -static const struct ieee80211_rate ath5k_rates[] = { - { .bitrate = 10, - .hw_value = ATH5K_RATE_CODE_1M, }, - { .bitrate = 20, - .hw_value = ATH5K_RATE_CODE_2M, - .hw_value_short = ATH5K_RATE_CODE_2M | AR5K_SET_SHORT_PREAMBLE, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 55, - .hw_value = ATH5K_RATE_CODE_5_5M, - .hw_value_short = ATH5K_RATE_CODE_5_5M | AR5K_SET_SHORT_PREAMBLE, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 110, - .hw_value = ATH5K_RATE_CODE_11M, - .hw_value_short = ATH5K_RATE_CODE_11M | AR5K_SET_SHORT_PREAMBLE, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 60, - .hw_value = ATH5K_RATE_CODE_6M, - .flags = 0 }, - { .bitrate = 90, - .hw_value = ATH5K_RATE_CODE_9M, - .flags = 0 }, - { .bitrate = 120, - .hw_value = ATH5K_RATE_CODE_12M, - .flags = 0 }, - { .bitrate = 180, - .hw_value = ATH5K_RATE_CODE_18M, - .flags = 0 }, - { .bitrate = 240, - .hw_value = ATH5K_RATE_CODE_24M, - .flags = 0 }, - { .bitrate = 360, - .hw_value = ATH5K_RATE_CODE_36M, - .flags = 0 }, - { .bitrate = 480, - .hw_value = ATH5K_RATE_CODE_48M, - .flags = 0 }, - { .bitrate = 540, - .hw_value = ATH5K_RATE_CODE_54M, - .flags = 0 }, -}; - -static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp) -{ - u64 tsf = ath5k_hw_get_tsf64(ah); - - if ((tsf & 0x7fff) < rstamp) - tsf -= 0x8000; - - return (tsf & ~0x7fff) | rstamp; -} - -const char * -ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val) -{ - const char *name = "xxxxx"; - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(srev_names); i++) { - if (srev_names[i].sr_type != type) - continue; - - if ((val & 0xf0) == srev_names[i].sr_val) - name = srev_names[i].sr_name; - - if ((val & 0xff) == srev_names[i].sr_val) { - name = srev_names[i].sr_name; - break; - } - } - - return name; -} -static unsigned int ath5k_ioread32(void *hw_priv, u32 reg_offset) -{ - struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv; - return ath5k_hw_reg_read(ah, reg_offset); -} - -static void ath5k_iowrite32(void *hw_priv, u32 val, u32 reg_offset) -{ - struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv; - ath5k_hw_reg_write(ah, val, reg_offset); -} - -static const struct ath_ops ath5k_common_ops = { - .read = ath5k_ioread32, - .write = ath5k_iowrite32, -}; - -/***********************\ -* Driver Initialization * -\***********************/ - -static void ath5k_reg_notifier(struct wiphy *wiphy, - struct regulatory_request *request) -{ - struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); - struct ath5k_hw *ah = hw->priv; - struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah); - - ath_reg_notifier_apply(wiphy, request, regulatory); -} - -/********************\ -* Channel/mode setup * -\********************/ - -/* - * Returns true for the channel numbers used. - */ -#ifdef CONFIG_ATH5K_TEST_CHANNELS -static bool ath5k_is_standard_channel(short chan, enum ieee80211_band band) -{ - return true; -} - -#else -static bool ath5k_is_standard_channel(short chan, enum ieee80211_band band) -{ - if (band == IEEE80211_BAND_2GHZ && chan <= 14) - return true; - - return /* UNII 1,2 */ - (((chan & 3) == 0 && chan >= 36 && chan <= 64) || - /* midband */ - ((chan & 3) == 0 && chan >= 100 && chan <= 140) || - /* UNII-3 */ - ((chan & 3) == 1 && chan >= 149 && chan <= 165) || - /* 802.11j 5.030-5.080 GHz (20MHz) */ - (chan == 8 || chan == 12 || chan == 16) || - /* 802.11j 4.9GHz (20MHz) */ - (chan == 184 || chan == 188 || chan == 192 || chan == 196)); -} -#endif - -static unsigned int -ath5k_setup_channels(struct ath5k_hw *ah, struct ieee80211_channel *channels, - unsigned int mode, unsigned int max) -{ - unsigned int count, size, freq, ch; - enum ieee80211_band band; - - switch (mode) { - case AR5K_MODE_11A: - /* 1..220, but 2GHz frequencies are filtered by check_channel */ - size = 220; - band = IEEE80211_BAND_5GHZ; - break; - case AR5K_MODE_11B: - case AR5K_MODE_11G: - size = 26; - band = IEEE80211_BAND_2GHZ; - break; - default: - ATH5K_WARN(ah, "bad mode, not copying channels\n"); - return 0; - } - - count = 0; - for (ch = 1; ch <= size && count < max; ch++) { - freq = ieee80211_channel_to_frequency(ch, band); - - if (freq == 0) /* mapping failed - not a standard channel */ - continue; - - /* Write channel info, needed for ath5k_channel_ok() */ - channels[count].center_freq = freq; - channels[count].band = band; - channels[count].hw_value = mode; - - /* Check if channel is supported by the chipset */ - if (!ath5k_channel_ok(ah, &channels[count])) - continue; - - if (!ath5k_is_standard_channel(ch, band)) - continue; - - count++; - } - - return count; -} - -static void -ath5k_setup_rate_idx(struct ath5k_hw *ah, struct ieee80211_supported_band *b) -{ - u8 i; - - for (i = 0; i < AR5K_MAX_RATES; i++) - ah->rate_idx[b->band][i] = -1; - - for (i = 0; i < b->n_bitrates; i++) { - ah->rate_idx[b->band][b->bitrates[i].hw_value] = i; - if (b->bitrates[i].hw_value_short) - ah->rate_idx[b->band][b->bitrates[i].hw_value_short] = i; - } -} - -static int -ath5k_setup_bands(struct ieee80211_hw *hw) -{ - struct ath5k_hw *ah = hw->priv; - struct ieee80211_supported_band *sband; - int max_c, count_c = 0; - int i; - - BUILD_BUG_ON(ARRAY_SIZE(ah->sbands) < IEEE80211_NUM_BANDS); - max_c = ARRAY_SIZE(ah->channels); - - /* 2GHz band */ - sband = &ah->sbands[IEEE80211_BAND_2GHZ]; - sband->band = IEEE80211_BAND_2GHZ; - sband->bitrates = &ah->rates[IEEE80211_BAND_2GHZ][0]; - - if (test_bit(AR5K_MODE_11G, ah->ah_capabilities.cap_mode)) { - /* G mode */ - memcpy(sband->bitrates, &ath5k_rates[0], - sizeof(struct ieee80211_rate) * 12); - sband->n_bitrates = 12; - - sband->channels = ah->channels; - sband->n_channels = ath5k_setup_channels(ah, sband->channels, - AR5K_MODE_11G, max_c); - - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband; - count_c = sband->n_channels; - max_c -= count_c; - } else if (test_bit(AR5K_MODE_11B, ah->ah_capabilities.cap_mode)) { - /* B mode */ - memcpy(sband->bitrates, &ath5k_rates[0], - sizeof(struct ieee80211_rate) * 4); - sband->n_bitrates = 4; - - /* 5211 only supports B rates and uses 4bit rate codes - * (e.g normally we have 0x1B for 1M, but on 5211 we have 0x0B) - * fix them up here: - */ - if (ah->ah_version == AR5K_AR5211) { - for (i = 0; i < 4; i++) { - sband->bitrates[i].hw_value = - sband->bitrates[i].hw_value & 0xF; - sband->bitrates[i].hw_value_short = - sband->bitrates[i].hw_value_short & 0xF; - } - } - - sband->channels = ah->channels; - sband->n_channels = ath5k_setup_channels(ah, sband->channels, - AR5K_MODE_11B, max_c); - - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband; - count_c = sband->n_channels; - max_c -= count_c; - } - ath5k_setup_rate_idx(ah, sband); - - /* 5GHz band, A mode */ - if (test_bit(AR5K_MODE_11A, ah->ah_capabilities.cap_mode)) { - sband = &ah->sbands[IEEE80211_BAND_5GHZ]; - sband->band = IEEE80211_BAND_5GHZ; - sband->bitrates = &ah->rates[IEEE80211_BAND_5GHZ][0]; - - memcpy(sband->bitrates, &ath5k_rates[4], - sizeof(struct ieee80211_rate) * 8); - sband->n_bitrates = 8; - - sband->channels = &ah->channels[count_c]; - sband->n_channels = ath5k_setup_channels(ah, sband->channels, - AR5K_MODE_11A, max_c); - - hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband; - } - ath5k_setup_rate_idx(ah, sband); - - ath5k_debug_dump_bands(ah); - - return 0; -} - -/* - * Set/change channels. We always reset the chip. - * To accomplish this we must first cleanup any pending DMA, - * then restart stuff after a la ath5k_init. - * - * Called with ah->lock. - */ -int -ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan) -{ - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, - "channel set, resetting (%u -> %u MHz)\n", - ah->curchan->center_freq, chan->center_freq); - - /* - * To switch channels clear any pending DMA operations; - * wait long enough for the RX fifo to drain, reset the - * hardware at the new frequency, and then re-enable - * the relevant bits of the h/w. - */ - return ath5k_reset(ah, chan, true); -} - -void ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) -{ - struct ath5k_vif_iter_data *iter_data = data; - int i; - struct ath5k_vif *avf = (void *)vif->drv_priv; - - if (iter_data->hw_macaddr) - for (i = 0; i < ETH_ALEN; i++) - iter_data->mask[i] &= - ~(iter_data->hw_macaddr[i] ^ mac[i]); - - if (!iter_data->found_active) { - iter_data->found_active = true; - memcpy(iter_data->active_mac, mac, ETH_ALEN); - } - - if (iter_data->need_set_hw_addr && iter_data->hw_macaddr) - if (ether_addr_equal(iter_data->hw_macaddr, mac)) - iter_data->need_set_hw_addr = false; - - if (!iter_data->any_assoc) { - if (avf->assoc) - iter_data->any_assoc = true; - } - - /* Calculate combined mode - when APs are active, operate in AP mode. - * Otherwise use the mode of the new interface. This can currently - * only deal with combinations of APs and STAs. Only one ad-hoc - * interfaces is allowed. - */ - if (avf->opmode == NL80211_IFTYPE_AP) - iter_data->opmode = NL80211_IFTYPE_AP; - else { - if (avf->opmode == NL80211_IFTYPE_STATION) - iter_data->n_stas++; - if (iter_data->opmode == NL80211_IFTYPE_UNSPECIFIED) - iter_data->opmode = avf->opmode; - } -} - -void -ath5k_update_bssid_mask_and_opmode(struct ath5k_hw *ah, - struct ieee80211_vif *vif) -{ - struct ath_common *common = ath5k_hw_common(ah); - struct ath5k_vif_iter_data iter_data; - u32 rfilt; - - /* - * Use the hardware MAC address as reference, the hardware uses it - * together with the BSSID mask when matching addresses. - */ - iter_data.hw_macaddr = common->macaddr; - memset(&iter_data.mask, 0xff, ETH_ALEN); - iter_data.found_active = false; - iter_data.need_set_hw_addr = true; - iter_data.opmode = NL80211_IFTYPE_UNSPECIFIED; - iter_data.n_stas = 0; - - if (vif) - ath5k_vif_iter(&iter_data, vif->addr, vif); - - /* Get list of all active MAC addresses */ - ieee80211_iterate_active_interfaces_atomic( - ah->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - ath5k_vif_iter, &iter_data); - memcpy(ah->bssidmask, iter_data.mask, ETH_ALEN); - - ah->opmode = iter_data.opmode; - if (ah->opmode == NL80211_IFTYPE_UNSPECIFIED) - /* Nothing active, default to station mode */ - ah->opmode = NL80211_IFTYPE_STATION; - - ath5k_hw_set_opmode(ah, ah->opmode); - ATH5K_DBG(ah, ATH5K_DEBUG_MODE, "mode setup opmode %d (%s)\n", - ah->opmode, ath_opmode_to_string(ah->opmode)); - - if (iter_data.need_set_hw_addr && iter_data.found_active) - ath5k_hw_set_lladdr(ah, iter_data.active_mac); - - if (ath5k_hw_hasbssidmask(ah)) - ath5k_hw_set_bssid_mask(ah, ah->bssidmask); - - /* Set up RX Filter */ - if (iter_data.n_stas > 1) { - /* If you have multiple STA interfaces connected to - * different APs, ARPs are not received (most of the time?) - * Enabling PROMISC appears to fix that problem. - */ - ah->filter_flags |= AR5K_RX_FILTER_PROM; - } - - rfilt = ah->filter_flags; - ath5k_hw_set_rx_filter(ah, rfilt); - ATH5K_DBG(ah, ATH5K_DEBUG_MODE, "RX filter 0x%x\n", rfilt); -} - -static inline int -ath5k_hw_to_driver_rix(struct ath5k_hw *ah, int hw_rix) -{ - int rix; - - /* return base rate on errors */ - if (WARN(hw_rix < 0 || hw_rix >= AR5K_MAX_RATES, - "hw_rix out of bounds: %x\n", hw_rix)) - return 0; - - rix = ah->rate_idx[ah->curchan->band][hw_rix]; - if (WARN(rix < 0, "invalid hw_rix: %x\n", hw_rix)) - rix = 0; - - return rix; -} - -/***************\ -* Buffers setup * -\***************/ - -static -struct sk_buff *ath5k_rx_skb_alloc(struct ath5k_hw *ah, dma_addr_t *skb_addr) -{ - struct ath_common *common = ath5k_hw_common(ah); - struct sk_buff *skb; - - /* - * Allocate buffer with headroom_needed space for the - * fake physical layer header at the start. - */ - skb = ath_rxbuf_alloc(common, - common->rx_bufsize, - GFP_ATOMIC); - - if (!skb) { - ATH5K_ERR(ah, "can't alloc skbuff of size %u\n", - common->rx_bufsize); - return NULL; - } - - *skb_addr = dma_map_single(ah->dev, - skb->data, common->rx_bufsize, - DMA_FROM_DEVICE); - - if (unlikely(dma_mapping_error(ah->dev, *skb_addr))) { - ATH5K_ERR(ah, "%s: DMA mapping failed\n", __func__); - dev_kfree_skb(skb); - return NULL; - } - return skb; -} - -static int -ath5k_rxbuf_setup(struct ath5k_hw *ah, struct ath5k_buf *bf) -{ - struct sk_buff *skb = bf->skb; - struct ath5k_desc *ds; - int ret; - - if (!skb) { - skb = ath5k_rx_skb_alloc(ah, &bf->skbaddr); - if (!skb) - return -ENOMEM; - bf->skb = skb; - } - - /* - * Setup descriptors. For receive we always terminate - * the descriptor list with a self-linked entry so we'll - * not get overrun under high load (as can happen with a - * 5212 when ANI processing enables PHY error frames). - * - * To ensure the last descriptor is self-linked we create - * each descriptor as self-linked and add it to the end. As - * each additional descriptor is added the previous self-linked - * entry is "fixed" naturally. This should be safe even - * if DMA is happening. When processing RX interrupts we - * never remove/process the last, self-linked, entry on the - * descriptor list. This ensures the hardware always has - * someplace to write a new frame. - */ - ds = bf->desc; - ds->ds_link = bf->daddr; /* link to self */ - ds->ds_data = bf->skbaddr; - ret = ath5k_hw_setup_rx_desc(ah, ds, ah->common.rx_bufsize, 0); - if (ret) { - ATH5K_ERR(ah, "%s: could not setup RX desc\n", __func__); - return ret; - } - - if (ah->rxlink != NULL) - *ah->rxlink = bf->daddr; - ah->rxlink = &ds->ds_link; - return 0; -} - -static enum ath5k_pkt_type get_hw_packet_type(struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr; - enum ath5k_pkt_type htype; - __le16 fc; - - hdr = (struct ieee80211_hdr *)skb->data; - fc = hdr->frame_control; - - if (ieee80211_is_beacon(fc)) - htype = AR5K_PKT_TYPE_BEACON; - else if (ieee80211_is_probe_resp(fc)) - htype = AR5K_PKT_TYPE_PROBE_RESP; - else if (ieee80211_is_atim(fc)) - htype = AR5K_PKT_TYPE_ATIM; - else if (ieee80211_is_pspoll(fc)) - htype = AR5K_PKT_TYPE_PSPOLL; - else - htype = AR5K_PKT_TYPE_NORMAL; - - return htype; -} - -static int -ath5k_txbuf_setup(struct ath5k_hw *ah, struct ath5k_buf *bf, - struct ath5k_txq *txq, int padsize) -{ - struct ath5k_desc *ds = bf->desc; - struct sk_buff *skb = bf->skb; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - unsigned int pktlen, flags, keyidx = AR5K_TXKEYIX_INVALID; - struct ieee80211_rate *rate; - unsigned int mrr_rate[3], mrr_tries[3]; - int i, ret; - u16 hw_rate; - u16 cts_rate = 0; - u16 duration = 0; - u8 rc_flags; - - flags = AR5K_TXDESC_INTREQ | AR5K_TXDESC_CLRDMASK; - - /* XXX endianness */ - bf->skbaddr = dma_map_single(ah->dev, skb->data, skb->len, - DMA_TO_DEVICE); - - rate = ieee80211_get_tx_rate(ah->hw, info); - if (!rate) { - ret = -EINVAL; - goto err_unmap; - } - - if (info->flags & IEEE80211_TX_CTL_NO_ACK) - flags |= AR5K_TXDESC_NOACK; - - rc_flags = info->control.rates[0].flags; - hw_rate = (rc_flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) ? - rate->hw_value_short : rate->hw_value; - - pktlen = skb->len; - - /* FIXME: If we are in g mode and rate is a CCK rate - * subtract ah->ah_txpower.txp_cck_ofdm_pwr_delta - * from tx power (value is in dB units already) */ - if (info->control.hw_key) { - keyidx = info->control.hw_key->hw_key_idx; - pktlen += info->control.hw_key->icv_len; - } - if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) { - flags |= AR5K_TXDESC_RTSENA; - cts_rate = ieee80211_get_rts_cts_rate(ah->hw, info)->hw_value; - duration = le16_to_cpu(ieee80211_rts_duration(ah->hw, - info->control.vif, pktlen, info)); - } - if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { - flags |= AR5K_TXDESC_CTSENA; - cts_rate = ieee80211_get_rts_cts_rate(ah->hw, info)->hw_value; - duration = le16_to_cpu(ieee80211_ctstoself_duration(ah->hw, - info->control.vif, pktlen, info)); - } - ret = ah->ah_setup_tx_desc(ah, ds, pktlen, - ieee80211_get_hdrlen_from_skb(skb), padsize, - get_hw_packet_type(skb), - (ah->ah_txpower.txp_requested * 2), - hw_rate, - info->control.rates[0].count, keyidx, ah->ah_tx_ant, flags, - cts_rate, duration); - if (ret) - goto err_unmap; - - /* Set up MRR descriptor */ - if (ah->ah_capabilities.cap_has_mrr_support) { - memset(mrr_rate, 0, sizeof(mrr_rate)); - memset(mrr_tries, 0, sizeof(mrr_tries)); - for (i = 0; i < 3; i++) { - rate = ieee80211_get_alt_retry_rate(ah->hw, info, i); - if (!rate) - break; - - mrr_rate[i] = rate->hw_value; - mrr_tries[i] = info->control.rates[i + 1].count; - } - - ath5k_hw_setup_mrr_tx_desc(ah, ds, - mrr_rate[0], mrr_tries[0], - mrr_rate[1], mrr_tries[1], - mrr_rate[2], mrr_tries[2]); - } - - ds->ds_link = 0; - ds->ds_data = bf->skbaddr; - - spin_lock_bh(&txq->lock); - list_add_tail(&bf->list, &txq->q); - txq->txq_len++; - if (txq->link == NULL) /* is this first packet? */ - ath5k_hw_set_txdp(ah, txq->qnum, bf->daddr); - else /* no, so only link it */ - *txq->link = bf->daddr; - - txq->link = &ds->ds_link; - ath5k_hw_start_tx_dma(ah, txq->qnum); - mmiowb(); - spin_unlock_bh(&txq->lock); - - return 0; -err_unmap: - dma_unmap_single(ah->dev, bf->skbaddr, skb->len, DMA_TO_DEVICE); - return ret; -} - -/*******************\ -* Descriptors setup * -\*******************/ - -static int -ath5k_desc_alloc(struct ath5k_hw *ah) -{ - struct ath5k_desc *ds; - struct ath5k_buf *bf; - dma_addr_t da; - unsigned int i; - int ret; - - /* allocate descriptors */ - ah->desc_len = sizeof(struct ath5k_desc) * - (ATH_TXBUF + ATH_RXBUF + ATH_BCBUF + 1); - - ah->desc = dma_alloc_coherent(ah->dev, ah->desc_len, - &ah->desc_daddr, GFP_KERNEL); - if (ah->desc == NULL) { - ATH5K_ERR(ah, "can't allocate descriptors\n"); - ret = -ENOMEM; - goto err; - } - ds = ah->desc; - da = ah->desc_daddr; - ATH5K_DBG(ah, ATH5K_DEBUG_ANY, "DMA map: %p (%zu) -> %llx\n", - ds, ah->desc_len, (unsigned long long)ah->desc_daddr); - - bf = kcalloc(1 + ATH_TXBUF + ATH_RXBUF + ATH_BCBUF, - sizeof(struct ath5k_buf), GFP_KERNEL); - if (bf == NULL) { - ATH5K_ERR(ah, "can't allocate bufptr\n"); - ret = -ENOMEM; - goto err_free; - } - ah->bufptr = bf; - - INIT_LIST_HEAD(&ah->rxbuf); - for (i = 0; i < ATH_RXBUF; i++, bf++, ds++, da += sizeof(*ds)) { - bf->desc = ds; - bf->daddr = da; - list_add_tail(&bf->list, &ah->rxbuf); - } - - INIT_LIST_HEAD(&ah->txbuf); - ah->txbuf_len = ATH_TXBUF; - for (i = 0; i < ATH_TXBUF; i++, bf++, ds++, da += sizeof(*ds)) { - bf->desc = ds; - bf->daddr = da; - list_add_tail(&bf->list, &ah->txbuf); - } - - /* beacon buffers */ - INIT_LIST_HEAD(&ah->bcbuf); - for (i = 0; i < ATH_BCBUF; i++, bf++, ds++, da += sizeof(*ds)) { - bf->desc = ds; - bf->daddr = da; - list_add_tail(&bf->list, &ah->bcbuf); - } - - return 0; -err_free: - dma_free_coherent(ah->dev, ah->desc_len, ah->desc, ah->desc_daddr); -err: - ah->desc = NULL; - return ret; -} - -void -ath5k_txbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf) -{ - BUG_ON(!bf); - if (!bf->skb) - return; - dma_unmap_single(ah->dev, bf->skbaddr, bf->skb->len, - DMA_TO_DEVICE); - ieee80211_free_txskb(ah->hw, bf->skb); - bf->skb = NULL; - bf->skbaddr = 0; - bf->desc->ds_data = 0; -} - -void -ath5k_rxbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf) -{ - struct ath_common *common = ath5k_hw_common(ah); - - BUG_ON(!bf); - if (!bf->skb) - return; - dma_unmap_single(ah->dev, bf->skbaddr, common->rx_bufsize, - DMA_FROM_DEVICE); - dev_kfree_skb_any(bf->skb); - bf->skb = NULL; - bf->skbaddr = 0; - bf->desc->ds_data = 0; -} - -static void -ath5k_desc_free(struct ath5k_hw *ah) -{ - struct ath5k_buf *bf; - - list_for_each_entry(bf, &ah->txbuf, list) - ath5k_txbuf_free_skb(ah, bf); - list_for_each_entry(bf, &ah->rxbuf, list) - ath5k_rxbuf_free_skb(ah, bf); - list_for_each_entry(bf, &ah->bcbuf, list) - ath5k_txbuf_free_skb(ah, bf); - - /* Free memory associated with all descriptors */ - dma_free_coherent(ah->dev, ah->desc_len, ah->desc, ah->desc_daddr); - ah->desc = NULL; - ah->desc_daddr = 0; - - kfree(ah->bufptr); - ah->bufptr = NULL; -} - - -/**************\ -* Queues setup * -\**************/ - -static struct ath5k_txq * -ath5k_txq_setup(struct ath5k_hw *ah, - int qtype, int subtype) -{ - struct ath5k_txq *txq; - struct ath5k_txq_info qi = { - .tqi_subtype = subtype, - /* XXX: default values not correct for B and XR channels, - * but who cares? */ - .tqi_aifs = AR5K_TUNE_AIFS, - .tqi_cw_min = AR5K_TUNE_CWMIN, - .tqi_cw_max = AR5K_TUNE_CWMAX - }; - int qnum; - - /* - * Enable interrupts only for EOL and DESC conditions. - * We mark tx descriptors to receive a DESC interrupt - * when a tx queue gets deep; otherwise we wait for the - * EOL to reap descriptors. Note that this is done to - * reduce interrupt load and this only defers reaping - * descriptors, never transmitting frames. Aside from - * reducing interrupts this also permits more concurrency. - * The only potential downside is if the tx queue backs - * up in which case the top half of the kernel may backup - * due to a lack of tx descriptors. - */ - qi.tqi_flags = AR5K_TXQ_FLAG_TXEOLINT_ENABLE | - AR5K_TXQ_FLAG_TXDESCINT_ENABLE; - qnum = ath5k_hw_setup_tx_queue(ah, qtype, &qi); - if (qnum < 0) { - /* - * NB: don't print a message, this happens - * normally on parts with too few tx queues - */ - return ERR_PTR(qnum); - } - txq = &ah->txqs[qnum]; - if (!txq->setup) { - txq->qnum = qnum; - txq->link = NULL; - INIT_LIST_HEAD(&txq->q); - spin_lock_init(&txq->lock); - txq->setup = true; - txq->txq_len = 0; - txq->txq_max = ATH5K_TXQ_LEN_MAX; - txq->txq_poll_mark = false; - txq->txq_stuck = 0; - } - return &ah->txqs[qnum]; -} - -static int -ath5k_beaconq_setup(struct ath5k_hw *ah) -{ - struct ath5k_txq_info qi = { - /* XXX: default values not correct for B and XR channels, - * but who cares? */ - .tqi_aifs = AR5K_TUNE_AIFS, - .tqi_cw_min = AR5K_TUNE_CWMIN, - .tqi_cw_max = AR5K_TUNE_CWMAX, - /* NB: for dynamic turbo, don't enable any other interrupts */ - .tqi_flags = AR5K_TXQ_FLAG_TXDESCINT_ENABLE - }; - - return ath5k_hw_setup_tx_queue(ah, AR5K_TX_QUEUE_BEACON, &qi); -} - -static int -ath5k_beaconq_config(struct ath5k_hw *ah) -{ - struct ath5k_txq_info qi; - int ret; - - ret = ath5k_hw_get_tx_queueprops(ah, ah->bhalq, &qi); - if (ret) - goto err; - - if (ah->opmode == NL80211_IFTYPE_AP || - ah->opmode == NL80211_IFTYPE_MESH_POINT) { - /* - * Always burst out beacon and CAB traffic - * (aifs = cwmin = cwmax = 0) - */ - qi.tqi_aifs = 0; - qi.tqi_cw_min = 0; - qi.tqi_cw_max = 0; - } else if (ah->opmode == NL80211_IFTYPE_ADHOC) { - /* - * Adhoc mode; backoff between 0 and (2 * cw_min). - */ - qi.tqi_aifs = 0; - qi.tqi_cw_min = 0; - qi.tqi_cw_max = 2 * AR5K_TUNE_CWMIN; - } - - ATH5K_DBG(ah, ATH5K_DEBUG_BEACON, - "beacon queueprops tqi_aifs:%d tqi_cw_min:%d tqi_cw_max:%d\n", - qi.tqi_aifs, qi.tqi_cw_min, qi.tqi_cw_max); - - ret = ath5k_hw_set_tx_queueprops(ah, ah->bhalq, &qi); - if (ret) { - ATH5K_ERR(ah, "%s: unable to update parameters for beacon " - "hardware queue!\n", __func__); - goto err; - } - ret = ath5k_hw_reset_tx_queue(ah, ah->bhalq); /* push to h/w */ - if (ret) - goto err; - - /* reconfigure cabq with ready time to 80% of beacon_interval */ - ret = ath5k_hw_get_tx_queueprops(ah, AR5K_TX_QUEUE_ID_CAB, &qi); - if (ret) - goto err; - - qi.tqi_ready_time = (ah->bintval * 80) / 100; - ret = ath5k_hw_set_tx_queueprops(ah, AR5K_TX_QUEUE_ID_CAB, &qi); - if (ret) - goto err; - - ret = ath5k_hw_reset_tx_queue(ah, AR5K_TX_QUEUE_ID_CAB); -err: - return ret; -} - -/** - * ath5k_drain_tx_buffs - Empty tx buffers - * - * @ah The &struct ath5k_hw - * - * Empty tx buffers from all queues in preparation - * of a reset or during shutdown. - * - * NB: this assumes output has been stopped and - * we do not need to block ath5k_tx_tasklet - */ -static void -ath5k_drain_tx_buffs(struct ath5k_hw *ah) -{ - struct ath5k_txq *txq; - struct ath5k_buf *bf, *bf0; - int i; - - for (i = 0; i < ARRAY_SIZE(ah->txqs); i++) { - if (ah->txqs[i].setup) { - txq = &ah->txqs[i]; - spin_lock_bh(&txq->lock); - list_for_each_entry_safe(bf, bf0, &txq->q, list) { - ath5k_debug_printtxbuf(ah, bf); - - ath5k_txbuf_free_skb(ah, bf); - - spin_lock(&ah->txbuflock); - list_move_tail(&bf->list, &ah->txbuf); - ah->txbuf_len++; - txq->txq_len--; - spin_unlock(&ah->txbuflock); - } - txq->link = NULL; - txq->txq_poll_mark = false; - spin_unlock_bh(&txq->lock); - } - } -} - -static void -ath5k_txq_release(struct ath5k_hw *ah) -{ - struct ath5k_txq *txq = ah->txqs; - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(ah->txqs); i++, txq++) - if (txq->setup) { - ath5k_hw_release_tx_queue(ah, txq->qnum); - txq->setup = false; - } -} - - -/*************\ -* RX Handling * -\*************/ - -/* - * Enable the receive h/w following a reset. - */ -static int -ath5k_rx_start(struct ath5k_hw *ah) -{ - struct ath_common *common = ath5k_hw_common(ah); - struct ath5k_buf *bf; - int ret; - - common->rx_bufsize = roundup(IEEE80211_MAX_FRAME_LEN, common->cachelsz); - - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "cachelsz %u rx_bufsize %u\n", - common->cachelsz, common->rx_bufsize); - - spin_lock_bh(&ah->rxbuflock); - ah->rxlink = NULL; - list_for_each_entry(bf, &ah->rxbuf, list) { - ret = ath5k_rxbuf_setup(ah, bf); - if (ret != 0) { - spin_unlock_bh(&ah->rxbuflock); - goto err; - } - } - bf = list_first_entry(&ah->rxbuf, struct ath5k_buf, list); - ath5k_hw_set_rxdp(ah, bf->daddr); - spin_unlock_bh(&ah->rxbuflock); - - ath5k_hw_start_rx_dma(ah); /* enable recv descriptors */ - ath5k_update_bssid_mask_and_opmode(ah, NULL); /* set filters, etc. */ - ath5k_hw_start_rx_pcu(ah); /* re-enable PCU/DMA engine */ - - return 0; -err: - return ret; -} - -/* - * Disable the receive logic on PCU (DRU) - * In preparation for a shutdown. - * - * Note: Doesn't stop rx DMA, ath5k_hw_dma_stop - * does. - */ -static void -ath5k_rx_stop(struct ath5k_hw *ah) -{ - - ath5k_hw_set_rx_filter(ah, 0); /* clear recv filter */ - ath5k_hw_stop_rx_pcu(ah); /* disable PCU */ - - ath5k_debug_printrxbuffs(ah); -} - -static unsigned int -ath5k_rx_decrypted(struct ath5k_hw *ah, struct sk_buff *skb, - struct ath5k_rx_status *rs) -{ - struct ath_common *common = ath5k_hw_common(ah); - struct ieee80211_hdr *hdr = (void *)skb->data; - unsigned int keyix, hlen; - - if (!(rs->rs_status & AR5K_RXERR_DECRYPT) && - rs->rs_keyix != AR5K_RXKEYIX_INVALID) - return RX_FLAG_DECRYPTED; - - /* Apparently when a default key is used to decrypt the packet - the hw does not set the index used to decrypt. In such cases - get the index from the packet. */ - hlen = ieee80211_hdrlen(hdr->frame_control); - if (ieee80211_has_protected(hdr->frame_control) && - !(rs->rs_status & AR5K_RXERR_DECRYPT) && - skb->len >= hlen + 4) { - keyix = skb->data[hlen + 3] >> 6; - - if (test_bit(keyix, common->keymap)) - return RX_FLAG_DECRYPTED; - } - - return 0; -} - - -static void -ath5k_check_ibss_tsf(struct ath5k_hw *ah, struct sk_buff *skb, - struct ieee80211_rx_status *rxs) -{ - struct ath_common *common = ath5k_hw_common(ah); - u64 tsf, bc_tstamp; - u32 hw_tu; - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; - - if (ieee80211_is_beacon(mgmt->frame_control) && - le16_to_cpu(mgmt->u.beacon.capab_info) & WLAN_CAPABILITY_IBSS && - ether_addr_equal(mgmt->bssid, common->curbssid)) { - /* - * Received an IBSS beacon with the same BSSID. Hardware *must* - * have updated the local TSF. We have to work around various - * hardware bugs, though... - */ - tsf = ath5k_hw_get_tsf64(ah); - bc_tstamp = le64_to_cpu(mgmt->u.beacon.timestamp); - hw_tu = TSF_TO_TU(tsf); - - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_BEACON, - "beacon %llx mactime %llx (diff %lld) tsf now %llx\n", - (unsigned long long)bc_tstamp, - (unsigned long long)rxs->mactime, - (unsigned long long)(rxs->mactime - bc_tstamp), - (unsigned long long)tsf); - - /* - * Sometimes the HW will give us a wrong tstamp in the rx - * status, causing the timestamp extension to go wrong. - * (This seems to happen especially with beacon frames bigger - * than 78 byte (incl. FCS)) - * But we know that the receive timestamp must be later than the - * timestamp of the beacon since HW must have synced to that. - * - * NOTE: here we assume mactime to be after the frame was - * received, not like mac80211 which defines it at the start. - */ - if (bc_tstamp > rxs->mactime) { - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_BEACON, - "fixing mactime from %llx to %llx\n", - (unsigned long long)rxs->mactime, - (unsigned long long)tsf); - rxs->mactime = tsf; - } - - /* - * Local TSF might have moved higher than our beacon timers, - * in that case we have to update them to continue sending - * beacons. This also takes care of synchronizing beacon sending - * times with other stations. - */ - if (hw_tu >= ah->nexttbtt) - ath5k_beacon_update_timers(ah, bc_tstamp); - - /* Check if the beacon timers are still correct, because a TSF - * update might have created a window between them - for a - * longer description see the comment of this function: */ - if (!ath5k_hw_check_beacon_timers(ah, ah->bintval)) { - ath5k_beacon_update_timers(ah, bc_tstamp); - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_BEACON, - "fixed beacon timers after beacon receive\n"); - } - } -} - -static void -ath5k_update_beacon_rssi(struct ath5k_hw *ah, struct sk_buff *skb, int rssi) -{ - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; - struct ath_common *common = ath5k_hw_common(ah); - - /* only beacons from our BSSID */ - if (!ieee80211_is_beacon(mgmt->frame_control) || - !ether_addr_equal(mgmt->bssid, common->curbssid)) - return; - - ewma_add(&ah->ah_beacon_rssi_avg, rssi); - - /* in IBSS mode we should keep RSSI statistics per neighbour */ - /* le16_to_cpu(mgmt->u.beacon.capab_info) & WLAN_CAPABILITY_IBSS */ -} - -/* - * Compute padding position. skb must contain an IEEE 802.11 frame - */ -static int ath5k_common_padpos(struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - __le16 frame_control = hdr->frame_control; - int padpos = 24; - - if (ieee80211_has_a4(frame_control)) - padpos += ETH_ALEN; - - if (ieee80211_is_data_qos(frame_control)) - padpos += IEEE80211_QOS_CTL_LEN; - - return padpos; -} - -/* - * This function expects an 802.11 frame and returns the number of - * bytes added, or -1 if we don't have enough header room. - */ -static int ath5k_add_padding(struct sk_buff *skb) -{ - int padpos = ath5k_common_padpos(skb); - int padsize = padpos & 3; - - if (padsize && skb->len > padpos) { - - if (skb_headroom(skb) < padsize) - return -1; - - skb_push(skb, padsize); - memmove(skb->data, skb->data + padsize, padpos); - return padsize; - } - - return 0; -} - -/* - * The MAC header is padded to have 32-bit boundary if the - * packet payload is non-zero. The general calculation for - * padsize would take into account odd header lengths: - * padsize = 4 - (hdrlen & 3); however, since only - * even-length headers are used, padding can only be 0 or 2 - * bytes and we can optimize this a bit. We must not try to - * remove padding from short control frames that do not have a - * payload. - * - * This function expects an 802.11 frame and returns the number of - * bytes removed. - */ -static int ath5k_remove_padding(struct sk_buff *skb) -{ - int padpos = ath5k_common_padpos(skb); - int padsize = padpos & 3; - - if (padsize && skb->len >= padpos + padsize) { - memmove(skb->data + padsize, skb->data, padpos); - skb_pull(skb, padsize); - return padsize; - } - - return 0; -} - -static void -ath5k_receive_frame(struct ath5k_hw *ah, struct sk_buff *skb, - struct ath5k_rx_status *rs) -{ - struct ieee80211_rx_status *rxs; - - ath5k_remove_padding(skb); - - rxs = IEEE80211_SKB_RXCB(skb); - - rxs->flag = 0; - if (unlikely(rs->rs_status & AR5K_RXERR_MIC)) - rxs->flag |= RX_FLAG_MMIC_ERROR; - - /* - * always extend the mac timestamp, since this information is - * also needed for proper IBSS merging. - * - * XXX: it might be too late to do it here, since rs_tstamp is - * 15bit only. that means TSF extension has to be done within - * 32768usec (about 32ms). it might be necessary to move this to - * the interrupt handler, like it is done in madwifi. - */ - rxs->mactime = ath5k_extend_tsf(ah, rs->rs_tstamp); - rxs->flag |= RX_FLAG_MACTIME_END; - - rxs->freq = ah->curchan->center_freq; - rxs->band = ah->curchan->band; - - rxs->signal = ah->ah_noise_floor + rs->rs_rssi; - - rxs->antenna = rs->rs_antenna; - - if (rs->rs_antenna > 0 && rs->rs_antenna < 5) - ah->stats.antenna_rx[rs->rs_antenna]++; - else - ah->stats.antenna_rx[0]++; /* invalid */ - - rxs->rate_idx = ath5k_hw_to_driver_rix(ah, rs->rs_rate); - rxs->flag |= ath5k_rx_decrypted(ah, skb, rs); - - if (rxs->rate_idx >= 0 && rs->rs_rate == - ah->sbands[ah->curchan->band].bitrates[rxs->rate_idx].hw_value_short) - rxs->flag |= RX_FLAG_SHORTPRE; - - trace_ath5k_rx(ah, skb); - - ath5k_update_beacon_rssi(ah, skb, rs->rs_rssi); - - /* check beacons in IBSS mode */ - if (ah->opmode == NL80211_IFTYPE_ADHOC) - ath5k_check_ibss_tsf(ah, skb, rxs); - - ieee80211_rx(ah->hw, skb); -} - -/** ath5k_frame_receive_ok() - Do we want to receive this frame or not? - * - * Check if we want to further process this frame or not. Also update - * statistics. Return true if we want this frame, false if not. - */ -static bool -ath5k_receive_frame_ok(struct ath5k_hw *ah, struct ath5k_rx_status *rs) -{ - ah->stats.rx_all_count++; - ah->stats.rx_bytes_count += rs->rs_datalen; - - if (unlikely(rs->rs_status)) { - if (rs->rs_status & AR5K_RXERR_CRC) - ah->stats.rxerr_crc++; - if (rs->rs_status & AR5K_RXERR_FIFO) - ah->stats.rxerr_fifo++; - if (rs->rs_status & AR5K_RXERR_PHY) { - ah->stats.rxerr_phy++; - if (rs->rs_phyerr > 0 && rs->rs_phyerr < 32) - ah->stats.rxerr_phy_code[rs->rs_phyerr]++; - return false; - } - if (rs->rs_status & AR5K_RXERR_DECRYPT) { - /* - * Decrypt error. If the error occurred - * because there was no hardware key, then - * let the frame through so the upper layers - * can process it. This is necessary for 5210 - * parts which have no way to setup a ``clear'' - * key cache entry. - * - * XXX do key cache faulting - */ - ah->stats.rxerr_decrypt++; - if (rs->rs_keyix == AR5K_RXKEYIX_INVALID && - !(rs->rs_status & AR5K_RXERR_CRC)) - return true; - } - if (rs->rs_status & AR5K_RXERR_MIC) { - ah->stats.rxerr_mic++; - return true; - } - - /* reject any frames with non-crypto errors */ - if (rs->rs_status & ~(AR5K_RXERR_DECRYPT)) - return false; - } - - if (unlikely(rs->rs_more)) { - ah->stats.rxerr_jumbo++; - return false; - } - return true; -} - -static void -ath5k_set_current_imask(struct ath5k_hw *ah) -{ - enum ath5k_int imask; - unsigned long flags; - - spin_lock_irqsave(&ah->irqlock, flags); - imask = ah->imask; - if (ah->rx_pending) - imask &= ~AR5K_INT_RX_ALL; - if (ah->tx_pending) - imask &= ~AR5K_INT_TX_ALL; - ath5k_hw_set_imr(ah, imask); - spin_unlock_irqrestore(&ah->irqlock, flags); -} - -static void -ath5k_tasklet_rx(unsigned long data) -{ - struct ath5k_rx_status rs = {}; - struct sk_buff *skb, *next_skb; - dma_addr_t next_skb_addr; - struct ath5k_hw *ah = (void *)data; - struct ath_common *common = ath5k_hw_common(ah); - struct ath5k_buf *bf; - struct ath5k_desc *ds; - int ret; - - spin_lock(&ah->rxbuflock); - if (list_empty(&ah->rxbuf)) { - ATH5K_WARN(ah, "empty rx buf pool\n"); - goto unlock; - } - do { - bf = list_first_entry(&ah->rxbuf, struct ath5k_buf, list); - BUG_ON(bf->skb == NULL); - skb = bf->skb; - ds = bf->desc; - - /* bail if HW is still using self-linked descriptor */ - if (ath5k_hw_get_rxdp(ah) == bf->daddr) - break; - - ret = ah->ah_proc_rx_desc(ah, ds, &rs); - if (unlikely(ret == -EINPROGRESS)) - break; - else if (unlikely(ret)) { - ATH5K_ERR(ah, "error in processing rx descriptor\n"); - ah->stats.rxerr_proc++; - break; - } - - if (ath5k_receive_frame_ok(ah, &rs)) { - next_skb = ath5k_rx_skb_alloc(ah, &next_skb_addr); - - /* - * If we can't replace bf->skb with a new skb under - * memory pressure, just skip this packet - */ - if (!next_skb) - goto next; - - dma_unmap_single(ah->dev, bf->skbaddr, - common->rx_bufsize, - DMA_FROM_DEVICE); - - skb_put(skb, rs.rs_datalen); - - ath5k_receive_frame(ah, skb, &rs); - - bf->skb = next_skb; - bf->skbaddr = next_skb_addr; - } -next: - list_move_tail(&bf->list, &ah->rxbuf); - } while (ath5k_rxbuf_setup(ah, bf) == 0); -unlock: - spin_unlock(&ah->rxbuflock); - ah->rx_pending = false; - ath5k_set_current_imask(ah); -} - - -/*************\ -* TX Handling * -\*************/ - -void -ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, - struct ath5k_txq *txq) -{ - struct ath5k_hw *ah = hw->priv; - struct ath5k_buf *bf; - unsigned long flags; - int padsize; - - trace_ath5k_tx(ah, skb, txq); - - /* - * The hardware expects the header padded to 4 byte boundaries. - * If this is not the case, we add the padding after the header. - */ - padsize = ath5k_add_padding(skb); - if (padsize < 0) { - ATH5K_ERR(ah, "tx hdrlen not %%4: not enough" - " headroom to pad"); - goto drop_packet; - } - - if (txq->txq_len >= txq->txq_max && - txq->qnum <= AR5K_TX_QUEUE_ID_DATA_MAX) - ieee80211_stop_queue(hw, txq->qnum); - - spin_lock_irqsave(&ah->txbuflock, flags); - if (list_empty(&ah->txbuf)) { - ATH5K_ERR(ah, "no further txbuf available, dropping packet\n"); - spin_unlock_irqrestore(&ah->txbuflock, flags); - ieee80211_stop_queues(hw); - goto drop_packet; - } - bf = list_first_entry(&ah->txbuf, struct ath5k_buf, list); - list_del(&bf->list); - ah->txbuf_len--; - if (list_empty(&ah->txbuf)) - ieee80211_stop_queues(hw); - spin_unlock_irqrestore(&ah->txbuflock, flags); - - bf->skb = skb; - - if (ath5k_txbuf_setup(ah, bf, txq, padsize)) { - bf->skb = NULL; - spin_lock_irqsave(&ah->txbuflock, flags); - list_add_tail(&bf->list, &ah->txbuf); - ah->txbuf_len++; - spin_unlock_irqrestore(&ah->txbuflock, flags); - goto drop_packet; - } - return; - -drop_packet: - ieee80211_free_txskb(hw, skb); -} - -static void -ath5k_tx_frame_completed(struct ath5k_hw *ah, struct sk_buff *skb, - struct ath5k_txq *txq, struct ath5k_tx_status *ts) -{ - struct ieee80211_tx_info *info; - u8 tries[3]; - int i; - - ah->stats.tx_all_count++; - ah->stats.tx_bytes_count += skb->len; - info = IEEE80211_SKB_CB(skb); - - tries[0] = info->status.rates[0].count; - tries[1] = info->status.rates[1].count; - tries[2] = info->status.rates[2].count; - - ieee80211_tx_info_clear_status(info); - - for (i = 0; i < ts->ts_final_idx; i++) { - struct ieee80211_tx_rate *r = - &info->status.rates[i]; - - r->count = tries[i]; - } - - info->status.rates[ts->ts_final_idx].count = ts->ts_final_retry; - info->status.rates[ts->ts_final_idx + 1].idx = -1; - - if (unlikely(ts->ts_status)) { - ah->stats.ack_fail++; - if (ts->ts_status & AR5K_TXERR_FILT) { - info->flags |= IEEE80211_TX_STAT_TX_FILTERED; - ah->stats.txerr_filt++; - } - if (ts->ts_status & AR5K_TXERR_XRETRY) - ah->stats.txerr_retry++; - if (ts->ts_status & AR5K_TXERR_FIFO) - ah->stats.txerr_fifo++; - } else { - info->flags |= IEEE80211_TX_STAT_ACK; - info->status.ack_signal = ts->ts_rssi; - - /* count the successful attempt as well */ - info->status.rates[ts->ts_final_idx].count++; - } - - /* - * Remove MAC header padding before giving the frame - * back to mac80211. - */ - ath5k_remove_padding(skb); - - if (ts->ts_antenna > 0 && ts->ts_antenna < 5) - ah->stats.antenna_tx[ts->ts_antenna]++; - else - ah->stats.antenna_tx[0]++; /* invalid */ - - trace_ath5k_tx_complete(ah, skb, txq, ts); - ieee80211_tx_status(ah->hw, skb); -} - -static void -ath5k_tx_processq(struct ath5k_hw *ah, struct ath5k_txq *txq) -{ - struct ath5k_tx_status ts = {}; - struct ath5k_buf *bf, *bf0; - struct ath5k_desc *ds; - struct sk_buff *skb; - int ret; - - spin_lock(&txq->lock); - list_for_each_entry_safe(bf, bf0, &txq->q, list) { - - txq->txq_poll_mark = false; - - /* skb might already have been processed last time. */ - if (bf->skb != NULL) { - ds = bf->desc; - - ret = ah->ah_proc_tx_desc(ah, ds, &ts); - if (unlikely(ret == -EINPROGRESS)) - break; - else if (unlikely(ret)) { - ATH5K_ERR(ah, - "error %d while processing " - "queue %u\n", ret, txq->qnum); - break; - } - - skb = bf->skb; - bf->skb = NULL; - - dma_unmap_single(ah->dev, bf->skbaddr, skb->len, - DMA_TO_DEVICE); - ath5k_tx_frame_completed(ah, skb, txq, &ts); - } - - /* - * It's possible that the hardware can say the buffer is - * completed when it hasn't yet loaded the ds_link from - * host memory and moved on. - * Always keep the last descriptor to avoid HW races... - */ - if (ath5k_hw_get_txdp(ah, txq->qnum) != bf->daddr) { - spin_lock(&ah->txbuflock); - list_move_tail(&bf->list, &ah->txbuf); - ah->txbuf_len++; - txq->txq_len--; - spin_unlock(&ah->txbuflock); - } - } - spin_unlock(&txq->lock); - if (txq->txq_len < ATH5K_TXQ_LEN_LOW && txq->qnum < 4) - ieee80211_wake_queue(ah->hw, txq->qnum); -} - -static void -ath5k_tasklet_tx(unsigned long data) -{ - int i; - struct ath5k_hw *ah = (void *)data; - - for (i = 0; i < AR5K_NUM_TX_QUEUES; i++) - if (ah->txqs[i].setup && (ah->ah_txq_isr_txok_all & BIT(i))) - ath5k_tx_processq(ah, &ah->txqs[i]); - - ah->tx_pending = false; - ath5k_set_current_imask(ah); -} - - -/*****************\ -* Beacon handling * -\*****************/ - -/* - * Setup the beacon frame for transmit. - */ -static int -ath5k_beacon_setup(struct ath5k_hw *ah, struct ath5k_buf *bf) -{ - struct sk_buff *skb = bf->skb; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ath5k_desc *ds; - int ret = 0; - u8 antenna; - u32 flags; - const int padsize = 0; - - bf->skbaddr = dma_map_single(ah->dev, skb->data, skb->len, - DMA_TO_DEVICE); - ATH5K_DBG(ah, ATH5K_DEBUG_BEACON, "skb %p [data %p len %u] " - "skbaddr %llx\n", skb, skb->data, skb->len, - (unsigned long long)bf->skbaddr); - - if (dma_mapping_error(ah->dev, bf->skbaddr)) { - ATH5K_ERR(ah, "beacon DMA mapping failed\n"); - dev_kfree_skb_any(skb); - bf->skb = NULL; - return -EIO; - } - - ds = bf->desc; - antenna = ah->ah_tx_ant; - - flags = AR5K_TXDESC_NOACK; - if (ah->opmode == NL80211_IFTYPE_ADHOC && ath5k_hw_hasveol(ah)) { - ds->ds_link = bf->daddr; /* self-linked */ - flags |= AR5K_TXDESC_VEOL; - } else - ds->ds_link = 0; - - /* - * If we use multiple antennas on AP and use - * the Sectored AP scenario, switch antenna every - * 4 beacons to make sure everybody hears our AP. - * When a client tries to associate, hw will keep - * track of the tx antenna to be used for this client - * automatically, based on ACKed packets. - * - * Note: AP still listens and transmits RTS on the - * default antenna which is supposed to be an omni. - * - * Note2: On sectored scenarios it's possible to have - * multiple antennas (1 omni -- the default -- and 14 - * sectors), so if we choose to actually support this - * mode, we need to allow the user to set how many antennas - * we have and tweak the code below to send beacons - * on all of them. - */ - if (ah->ah_ant_mode == AR5K_ANTMODE_SECTOR_AP) - antenna = ah->bsent & 4 ? 2 : 1; - - - /* FIXME: If we are in g mode and rate is a CCK rate - * subtract ah->ah_txpower.txp_cck_ofdm_pwr_delta - * from tx power (value is in dB units already) */ - ds->ds_data = bf->skbaddr; - ret = ah->ah_setup_tx_desc(ah, ds, skb->len, - ieee80211_get_hdrlen_from_skb(skb), padsize, - AR5K_PKT_TYPE_BEACON, - (ah->ah_txpower.txp_requested * 2), - ieee80211_get_tx_rate(ah->hw, info)->hw_value, - 1, AR5K_TXKEYIX_INVALID, - antenna, flags, 0, 0); - if (ret) - goto err_unmap; - - return 0; -err_unmap: - dma_unmap_single(ah->dev, bf->skbaddr, skb->len, DMA_TO_DEVICE); - return ret; -} - -/* - * Updates the beacon that is sent by ath5k_beacon_send. For adhoc, - * this is called only once at config_bss time, for AP we do it every - * SWBA interrupt so that the TIM will reflect buffered frames. - * - * Called with the beacon lock. - */ -int -ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - int ret; - struct ath5k_hw *ah = hw->priv; - struct ath5k_vif *avf; - struct sk_buff *skb; - - if (WARN_ON(!vif)) { - ret = -EINVAL; - goto out; - } - - skb = ieee80211_beacon_get(hw, vif); - - if (!skb) { - ret = -ENOMEM; - goto out; - } - - avf = (void *)vif->drv_priv; - ath5k_txbuf_free_skb(ah, avf->bbuf); - avf->bbuf->skb = skb; - ret = ath5k_beacon_setup(ah, avf->bbuf); -out: - return ret; -} - -/* - * Transmit a beacon frame at SWBA. Dynamic updates to the - * frame contents are done as needed and the slot time is - * also adjusted based on current state. - * - * This is called from software irq context (beacontq tasklets) - * or user context from ath5k_beacon_config. - */ -static void -ath5k_beacon_send(struct ath5k_hw *ah) -{ - struct ieee80211_vif *vif; - struct ath5k_vif *avf; - struct ath5k_buf *bf; - struct sk_buff *skb; - int err; - - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_BEACON, "in beacon_send\n"); - - /* - * Check if the previous beacon has gone out. If - * not, don't don't try to post another: skip this - * period and wait for the next. Missed beacons - * indicate a problem and should not occur. If we - * miss too many consecutive beacons reset the device. - */ - if (unlikely(ath5k_hw_num_tx_pending(ah, ah->bhalq) != 0)) { - ah->bmisscount++; - ATH5K_DBG(ah, ATH5K_DEBUG_BEACON, - "missed %u consecutive beacons\n", ah->bmisscount); - if (ah->bmisscount > 10) { /* NB: 10 is a guess */ - ATH5K_DBG(ah, ATH5K_DEBUG_BEACON, - "stuck beacon time (%u missed)\n", - ah->bmisscount); - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, - "stuck beacon, resetting\n"); - ieee80211_queue_work(ah->hw, &ah->reset_work); - } - return; - } - if (unlikely(ah->bmisscount != 0)) { - ATH5K_DBG(ah, ATH5K_DEBUG_BEACON, - "resume beacon xmit after %u misses\n", - ah->bmisscount); - ah->bmisscount = 0; - } - - if ((ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs + - ah->num_mesh_vifs > 1) || - ah->opmode == NL80211_IFTYPE_MESH_POINT) { - u64 tsf = ath5k_hw_get_tsf64(ah); - u32 tsftu = TSF_TO_TU(tsf); - int slot = ((tsftu % ah->bintval) * ATH_BCBUF) / ah->bintval; - vif = ah->bslot[(slot + 1) % ATH_BCBUF]; - ATH5K_DBG(ah, ATH5K_DEBUG_BEACON, - "tsf %llx tsftu %x intval %u slot %u vif %p\n", - (unsigned long long)tsf, tsftu, ah->bintval, slot, vif); - } else /* only one interface */ - vif = ah->bslot[0]; - - if (!vif) - return; - - avf = (void *)vif->drv_priv; - bf = avf->bbuf; - - /* - * Stop any current dma and put the new frame on the queue. - * This should never fail since we check above that no frames - * are still pending on the queue. - */ - if (unlikely(ath5k_hw_stop_beacon_queue(ah, ah->bhalq))) { - ATH5K_WARN(ah, "beacon queue %u didn't start/stop ?\n", ah->bhalq); - /* NB: hw still stops DMA, so proceed */ - } - - /* refresh the beacon for AP or MESH mode */ - if (ah->opmode == NL80211_IFTYPE_AP || - ah->opmode == NL80211_IFTYPE_MESH_POINT) { - err = ath5k_beacon_update(ah->hw, vif); - if (err) - return; - } - - if (unlikely(bf->skb == NULL || ah->opmode == NL80211_IFTYPE_STATION || - ah->opmode == NL80211_IFTYPE_MONITOR)) { - ATH5K_WARN(ah, "bf=%p bf_skb=%p\n", bf, bf->skb); - return; - } - - trace_ath5k_tx(ah, bf->skb, &ah->txqs[ah->bhalq]); - - ath5k_hw_set_txdp(ah, ah->bhalq, bf->daddr); - ath5k_hw_start_tx_dma(ah, ah->bhalq); - ATH5K_DBG(ah, ATH5K_DEBUG_BEACON, "TXDP[%u] = %llx (%p)\n", - ah->bhalq, (unsigned long long)bf->daddr, bf->desc); - - skb = ieee80211_get_buffered_bc(ah->hw, vif); - while (skb) { - ath5k_tx_queue(ah->hw, skb, ah->cabq); - - if (ah->cabq->txq_len >= ah->cabq->txq_max) - break; - - skb = ieee80211_get_buffered_bc(ah->hw, vif); - } - - ah->bsent++; -} - -/** - * ath5k_beacon_update_timers - update beacon timers - * - * @ah: struct ath5k_hw pointer we are operating on - * @bc_tsf: the timestamp of the beacon. 0 to reset the TSF. -1 to perform a - * beacon timer update based on the current HW TSF. - * - * Calculate the next target beacon transmit time (TBTT) based on the timestamp - * of a received beacon or the current local hardware TSF and write it to the - * beacon timer registers. - * - * This is called in a variety of situations, e.g. when a beacon is received, - * when a TSF update has been detected, but also when an new IBSS is created or - * when we otherwise know we have to update the timers, but we keep it in this - * function to have it all together in one place. - */ -void -ath5k_beacon_update_timers(struct ath5k_hw *ah, u64 bc_tsf) -{ - u32 nexttbtt, intval, hw_tu, bc_tu; - u64 hw_tsf; - - intval = ah->bintval & AR5K_BEACON_PERIOD; - if (ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs - + ah->num_mesh_vifs > 1) { - intval /= ATH_BCBUF; /* staggered multi-bss beacons */ - if (intval < 15) - ATH5K_WARN(ah, "intval %u is too low, min 15\n", - intval); - } - if (WARN_ON(!intval)) - return; - - /* beacon TSF converted to TU */ - bc_tu = TSF_TO_TU(bc_tsf); - - /* current TSF converted to TU */ - hw_tsf = ath5k_hw_get_tsf64(ah); - hw_tu = TSF_TO_TU(hw_tsf); - -#define FUDGE (AR5K_TUNE_SW_BEACON_RESP + 3) - /* We use FUDGE to make sure the next TBTT is ahead of the current TU. - * Since we later subtract AR5K_TUNE_SW_BEACON_RESP (10) in the timer - * configuration we need to make sure it is bigger than that. */ - - if (bc_tsf == -1) { - /* - * no beacons received, called internally. - * just need to refresh timers based on HW TSF. - */ - nexttbtt = roundup(hw_tu + FUDGE, intval); - } else if (bc_tsf == 0) { - /* - * no beacon received, probably called by ath5k_reset_tsf(). - * reset TSF to start with 0. - */ - nexttbtt = intval; - intval |= AR5K_BEACON_RESET_TSF; - } else if (bc_tsf > hw_tsf) { - /* - * beacon received, SW merge happened but HW TSF not yet updated. - * not possible to reconfigure timers yet, but next time we - * receive a beacon with the same BSSID, the hardware will - * automatically update the TSF and then we need to reconfigure - * the timers. - */ - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_BEACON, - "need to wait for HW TSF sync\n"); - return; - } else { - /* - * most important case for beacon synchronization between STA. - * - * beacon received and HW TSF has been already updated by HW. - * update next TBTT based on the TSF of the beacon, but make - * sure it is ahead of our local TSF timer. - */ - nexttbtt = bc_tu + roundup(hw_tu + FUDGE - bc_tu, intval); - } -#undef FUDGE - - ah->nexttbtt = nexttbtt; - - intval |= AR5K_BEACON_ENA; - ath5k_hw_init_beacon_timers(ah, nexttbtt, intval); - - /* - * debugging output last in order to preserve the time critical aspect - * of this function - */ - if (bc_tsf == -1) - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_BEACON, - "reconfigured timers based on HW TSF\n"); - else if (bc_tsf == 0) - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_BEACON, - "reset HW TSF and timers\n"); - else - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_BEACON, - "updated timers based on beacon TSF\n"); - - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_BEACON, - "bc_tsf %llx hw_tsf %llx bc_tu %u hw_tu %u nexttbtt %u\n", - (unsigned long long) bc_tsf, - (unsigned long long) hw_tsf, bc_tu, hw_tu, nexttbtt); - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_BEACON, "intval %u %s %s\n", - intval & AR5K_BEACON_PERIOD, - intval & AR5K_BEACON_ENA ? "AR5K_BEACON_ENA" : "", - intval & AR5K_BEACON_RESET_TSF ? "AR5K_BEACON_RESET_TSF" : ""); -} - -/** - * ath5k_beacon_config - Configure the beacon queues and interrupts - * - * @ah: struct ath5k_hw pointer we are operating on - * - * In IBSS mode we use a self-linked tx descriptor if possible. We enable SWBA - * interrupts to detect TSF updates only. - */ -void -ath5k_beacon_config(struct ath5k_hw *ah) -{ - spin_lock_bh(&ah->block); - ah->bmisscount = 0; - ah->imask &= ~(AR5K_INT_BMISS | AR5K_INT_SWBA); - - if (ah->enable_beacon) { - /* - * In IBSS mode we use a self-linked tx descriptor and let the - * hardware send the beacons automatically. We have to load it - * only once here. - * We use the SWBA interrupt only to keep track of the beacon - * timers in order to detect automatic TSF updates. - */ - ath5k_beaconq_config(ah); - - ah->imask |= AR5K_INT_SWBA; - - if (ah->opmode == NL80211_IFTYPE_ADHOC) { - if (ath5k_hw_hasveol(ah)) - ath5k_beacon_send(ah); - } else - ath5k_beacon_update_timers(ah, -1); - } else { - ath5k_hw_stop_beacon_queue(ah, ah->bhalq); - } - - ath5k_hw_set_imr(ah, ah->imask); - mmiowb(); - spin_unlock_bh(&ah->block); -} - -static void ath5k_tasklet_beacon(unsigned long data) -{ - struct ath5k_hw *ah = (struct ath5k_hw *) data; - - /* - * Software beacon alert--time to send a beacon. - * - * In IBSS mode we use this interrupt just to - * keep track of the next TBTT (target beacon - * transmission time) in order to detect whether - * automatic TSF updates happened. - */ - if (ah->opmode == NL80211_IFTYPE_ADHOC) { - /* XXX: only if VEOL supported */ - u64 tsf = ath5k_hw_get_tsf64(ah); - ah->nexttbtt += ah->bintval; - ATH5K_DBG(ah, ATH5K_DEBUG_BEACON, - "SWBA nexttbtt: %x hw_tu: %x " - "TSF: %llx\n", - ah->nexttbtt, - TSF_TO_TU(tsf), - (unsigned long long) tsf); - } else { - spin_lock(&ah->block); - ath5k_beacon_send(ah); - spin_unlock(&ah->block); - } -} - - -/********************\ -* Interrupt handling * -\********************/ - -static void -ath5k_intr_calibration_poll(struct ath5k_hw *ah) -{ - if (time_is_before_eq_jiffies(ah->ah_cal_next_ani) && - !(ah->ah_cal_mask & AR5K_CALIBRATION_FULL) && - !(ah->ah_cal_mask & AR5K_CALIBRATION_SHORT)) { - - /* Run ANI only when calibration is not active */ - - ah->ah_cal_next_ani = jiffies + - msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_ANI); - tasklet_schedule(&ah->ani_tasklet); - - } else if (time_is_before_eq_jiffies(ah->ah_cal_next_short) && - !(ah->ah_cal_mask & AR5K_CALIBRATION_FULL) && - !(ah->ah_cal_mask & AR5K_CALIBRATION_SHORT)) { - - /* Run calibration only when another calibration - * is not running. - * - * Note: This is for both full/short calibration, - * if it's time for a full one, ath5k_calibrate_work will deal - * with it. */ - - ah->ah_cal_next_short = jiffies + - msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_SHORT); - ieee80211_queue_work(ah->hw, &ah->calib_work); - } - /* we could use SWI to generate enough interrupts to meet our - * calibration interval requirements, if necessary: - * AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI); */ -} - -static void -ath5k_schedule_rx(struct ath5k_hw *ah) -{ - ah->rx_pending = true; - tasklet_schedule(&ah->rxtq); -} - -static void -ath5k_schedule_tx(struct ath5k_hw *ah) -{ - ah->tx_pending = true; - tasklet_schedule(&ah->txtq); -} - -static irqreturn_t -ath5k_intr(int irq, void *dev_id) -{ - struct ath5k_hw *ah = dev_id; - enum ath5k_int status; - unsigned int counter = 1000; - - - /* - * If hw is not ready (or detached) and we get an - * interrupt, or if we have no interrupts pending - * (that means it's not for us) skip it. - * - * NOTE: Group 0/1 PCI interface registers are not - * supported on WiSOCs, so we can't check for pending - * interrupts (ISR belongs to another register group - * so we are ok). - */ - if (unlikely(test_bit(ATH_STAT_INVALID, ah->status) || - ((ath5k_get_bus_type(ah) != ATH_AHB) && - !ath5k_hw_is_intr_pending(ah)))) - return IRQ_NONE; - - /** Main loop **/ - do { - ath5k_hw_get_isr(ah, &status); /* NB: clears IRQ too */ - - ATH5K_DBG(ah, ATH5K_DEBUG_INTR, "status 0x%x/0x%x\n", - status, ah->imask); - - /* - * Fatal hw error -> Log and reset - * - * Fatal errors are unrecoverable so we have to - * reset the card. These errors include bus and - * dma errors. - */ - if (unlikely(status & AR5K_INT_FATAL)) { - - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, - "fatal int, resetting\n"); - ieee80211_queue_work(ah->hw, &ah->reset_work); - - /* - * RX Overrun -> Count and reset if needed - * - * Receive buffers are full. Either the bus is busy or - * the CPU is not fast enough to process all received - * frames. - */ - } else if (unlikely(status & AR5K_INT_RXORN)) { - - /* - * Older chipsets need a reset to come out of this - * condition, but we treat it as RX for newer chips. - * We don't know exactly which versions need a reset - * this guess is copied from the HAL. - */ - ah->stats.rxorn_intr++; - - if (ah->ah_mac_srev < AR5K_SREV_AR5212) { - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, - "rx overrun, resetting\n"); - ieee80211_queue_work(ah->hw, &ah->reset_work); - } else - ath5k_schedule_rx(ah); - - } else { - - /* Software Beacon Alert -> Schedule beacon tasklet */ - if (status & AR5K_INT_SWBA) - tasklet_hi_schedule(&ah->beacontq); - - /* - * No more RX descriptors -> Just count - * - * NB: the hardware should re-read the link when - * RXE bit is written, but it doesn't work at - * least on older hardware revs. - */ - if (status & AR5K_INT_RXEOL) - ah->stats.rxeol_intr++; - - - /* TX Underrun -> Bump tx trigger level */ - if (status & AR5K_INT_TXURN) - ath5k_hw_update_tx_triglevel(ah, true); - - /* RX -> Schedule rx tasklet */ - if (status & (AR5K_INT_RXOK | AR5K_INT_RXERR)) - ath5k_schedule_rx(ah); - - /* TX -> Schedule tx tasklet */ - if (status & (AR5K_INT_TXOK - | AR5K_INT_TXDESC - | AR5K_INT_TXERR - | AR5K_INT_TXEOL)) - ath5k_schedule_tx(ah); - - /* Missed beacon -> TODO - if (status & AR5K_INT_BMISS) - */ - - /* MIB event -> Update counters and notify ANI */ - if (status & AR5K_INT_MIB) { - ah->stats.mib_intr++; - ath5k_hw_update_mib_counters(ah); - ath5k_ani_mib_intr(ah); - } - - /* GPIO -> Notify RFKill layer */ - if (status & AR5K_INT_GPIO) - tasklet_schedule(&ah->rf_kill.toggleq); - - } - - if (ath5k_get_bus_type(ah) == ATH_AHB) - break; - - } while (ath5k_hw_is_intr_pending(ah) && --counter > 0); - - /* - * Until we handle rx/tx interrupts mask them on IMR - * - * NOTE: ah->(rx/tx)_pending are set when scheduling the tasklets - * and unset after we 've handled the interrupts. - */ - if (ah->rx_pending || ah->tx_pending) - ath5k_set_current_imask(ah); - - if (unlikely(!counter)) - ATH5K_WARN(ah, "too many interrupts, giving up for now\n"); - - /* Fire up calibration poll */ - ath5k_intr_calibration_poll(ah); - - return IRQ_HANDLED; -} - -/* - * Periodically recalibrate the PHY to account - * for temperature/environment changes. - */ -static void -ath5k_calibrate_work(struct work_struct *work) -{ - struct ath5k_hw *ah = container_of(work, struct ath5k_hw, - calib_work); - - /* Should we run a full calibration ? */ - if (time_is_before_eq_jiffies(ah->ah_cal_next_full)) { - - ah->ah_cal_next_full = jiffies + - msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_FULL); - ah->ah_cal_mask |= AR5K_CALIBRATION_FULL; - - ATH5K_DBG(ah, ATH5K_DEBUG_CALIBRATE, - "running full calibration\n"); - - if (ath5k_hw_gainf_calibrate(ah) == AR5K_RFGAIN_NEED_CHANGE) { - /* - * Rfgain is out of bounds, reset the chip - * to load new gain values. - */ - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, - "got new rfgain, resetting\n"); - ieee80211_queue_work(ah->hw, &ah->reset_work); - } - } else - ah->ah_cal_mask |= AR5K_CALIBRATION_SHORT; - - - ATH5K_DBG(ah, ATH5K_DEBUG_CALIBRATE, "channel %u/%x\n", - ieee80211_frequency_to_channel(ah->curchan->center_freq), - ah->curchan->hw_value); - - if (ath5k_hw_phy_calibrate(ah, ah->curchan)) - ATH5K_ERR(ah, "calibration of channel %u failed\n", - ieee80211_frequency_to_channel( - ah->curchan->center_freq)); - - /* Clear calibration flags */ - if (ah->ah_cal_mask & AR5K_CALIBRATION_FULL) - ah->ah_cal_mask &= ~AR5K_CALIBRATION_FULL; - else if (ah->ah_cal_mask & AR5K_CALIBRATION_SHORT) - ah->ah_cal_mask &= ~AR5K_CALIBRATION_SHORT; -} - - -static void -ath5k_tasklet_ani(unsigned long data) -{ - struct ath5k_hw *ah = (void *)data; - - ah->ah_cal_mask |= AR5K_CALIBRATION_ANI; - ath5k_ani_calibration(ah); - ah->ah_cal_mask &= ~AR5K_CALIBRATION_ANI; -} - - -static void -ath5k_tx_complete_poll_work(struct work_struct *work) -{ - struct ath5k_hw *ah = container_of(work, struct ath5k_hw, - tx_complete_work.work); - struct ath5k_txq *txq; - int i; - bool needreset = false; - - if (!test_bit(ATH_STAT_STARTED, ah->status)) - return; - - mutex_lock(&ah->lock); - - for (i = 0; i < ARRAY_SIZE(ah->txqs); i++) { - if (ah->txqs[i].setup) { - txq = &ah->txqs[i]; - spin_lock_bh(&txq->lock); - if (txq->txq_len > 1) { - if (txq->txq_poll_mark) { - ATH5K_DBG(ah, ATH5K_DEBUG_XMIT, - "TX queue stuck %d\n", - txq->qnum); - needreset = true; - txq->txq_stuck++; - spin_unlock_bh(&txq->lock); - break; - } else { - txq->txq_poll_mark = true; - } - } - spin_unlock_bh(&txq->lock); - } - } - - if (needreset) { - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, - "TX queues stuck, resetting\n"); - ath5k_reset(ah, NULL, true); - } - - mutex_unlock(&ah->lock); - - ieee80211_queue_delayed_work(ah->hw, &ah->tx_complete_work, - msecs_to_jiffies(ATH5K_TX_COMPLETE_POLL_INT)); -} - - -/*************************\ -* Initialization routines * -\*************************/ - -static const struct ieee80211_iface_limit if_limits[] = { - { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) }, - { .max = 4, .types = -#ifdef CONFIG_MAC80211_MESH - BIT(NL80211_IFTYPE_MESH_POINT) | -#endif - BIT(NL80211_IFTYPE_AP) }, -}; - -static const struct ieee80211_iface_combination if_comb = { - .limits = if_limits, - .n_limits = ARRAY_SIZE(if_limits), - .max_interfaces = 2048, - .num_different_channels = 1, -}; - -int -ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops) -{ - struct ieee80211_hw *hw = ah->hw; - struct ath_common *common; - int ret; - int csz; - - /* Initialize driver private data */ - SET_IEEE80211_DEV(hw, ah->dev); - hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_MFP_CAPABLE | - IEEE80211_HW_REPORTS_TX_ACK_STATUS; - - hw->wiphy->interface_modes = - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_MESH_POINT); - - hw->wiphy->iface_combinations = &if_comb; - hw->wiphy->n_iface_combinations = 1; - - /* SW support for IBSS_RSN is provided by mac80211 */ - hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; - - /* both antennas can be configured as RX or TX */ - hw->wiphy->available_antennas_tx = 0x3; - hw->wiphy->available_antennas_rx = 0x3; - - hw->extra_tx_headroom = 2; - hw->channel_change_time = 5000; - - /* - * Mark the device as detached to avoid processing - * interrupts until setup is complete. - */ - __set_bit(ATH_STAT_INVALID, ah->status); - - ah->opmode = NL80211_IFTYPE_STATION; - ah->bintval = 1000; - mutex_init(&ah->lock); - spin_lock_init(&ah->rxbuflock); - spin_lock_init(&ah->txbuflock); - spin_lock_init(&ah->block); - spin_lock_init(&ah->irqlock); - - /* Setup interrupt handler */ - ret = request_irq(ah->irq, ath5k_intr, IRQF_SHARED, "ath", ah); - if (ret) { - ATH5K_ERR(ah, "request_irq failed\n"); - goto err; - } - - common = ath5k_hw_common(ah); - common->ops = &ath5k_common_ops; - common->bus_ops = bus_ops; - common->ah = ah; - common->hw = hw; - common->priv = ah; - common->clockrate = 40; - - /* - * Cache line size is used to size and align various - * structures used to communicate with the hardware. - */ - ath5k_read_cachesize(common, &csz); - common->cachelsz = csz << 2; /* convert to bytes */ - - spin_lock_init(&common->cc_lock); - - /* Initialize device */ - ret = ath5k_hw_init(ah); - if (ret) - goto err_irq; - - /* Set up multi-rate retry capabilities */ - if (ah->ah_capabilities.cap_has_mrr_support) { - hw->max_rates = 4; - hw->max_rate_tries = max(AR5K_INIT_RETRY_SHORT, - AR5K_INIT_RETRY_LONG); - } - - hw->vif_data_size = sizeof(struct ath5k_vif); - - /* Finish private driver data initialization */ - ret = ath5k_init(hw); - if (ret) - goto err_ah; - - ATH5K_INFO(ah, "Atheros AR%s chip found (MAC: 0x%x, PHY: 0x%x)\n", - ath5k_chip_name(AR5K_VERSION_MAC, ah->ah_mac_srev), - ah->ah_mac_srev, - ah->ah_phy_revision); - - if (!ah->ah_single_chip) { - /* Single chip radio (!RF5111) */ - if (ah->ah_radio_5ghz_revision && - !ah->ah_radio_2ghz_revision) { - /* No 5GHz support -> report 2GHz radio */ - if (!test_bit(AR5K_MODE_11A, - ah->ah_capabilities.cap_mode)) { - ATH5K_INFO(ah, "RF%s 2GHz radio found (0x%x)\n", - ath5k_chip_name(AR5K_VERSION_RAD, - ah->ah_radio_5ghz_revision), - ah->ah_radio_5ghz_revision); - /* No 2GHz support (5110 and some - * 5GHz only cards) -> report 5GHz radio */ - } else if (!test_bit(AR5K_MODE_11B, - ah->ah_capabilities.cap_mode)) { - ATH5K_INFO(ah, "RF%s 5GHz radio found (0x%x)\n", - ath5k_chip_name(AR5K_VERSION_RAD, - ah->ah_radio_5ghz_revision), - ah->ah_radio_5ghz_revision); - /* Multiband radio */ - } else { - ATH5K_INFO(ah, "RF%s multiband radio found" - " (0x%x)\n", - ath5k_chip_name(AR5K_VERSION_RAD, - ah->ah_radio_5ghz_revision), - ah->ah_radio_5ghz_revision); - } - } - /* Multi chip radio (RF5111 - RF2111) -> - * report both 2GHz/5GHz radios */ - else if (ah->ah_radio_5ghz_revision && - ah->ah_radio_2ghz_revision) { - ATH5K_INFO(ah, "RF%s 5GHz radio found (0x%x)\n", - ath5k_chip_name(AR5K_VERSION_RAD, - ah->ah_radio_5ghz_revision), - ah->ah_radio_5ghz_revision); - ATH5K_INFO(ah, "RF%s 2GHz radio found (0x%x)\n", - ath5k_chip_name(AR5K_VERSION_RAD, - ah->ah_radio_2ghz_revision), - ah->ah_radio_2ghz_revision); - } - } - - ath5k_debug_init_device(ah); - - /* ready to process interrupts */ - __clear_bit(ATH_STAT_INVALID, ah->status); - - return 0; -err_ah: - ath5k_hw_deinit(ah); -err_irq: - free_irq(ah->irq, ah); -err: - return ret; -} - -static int -ath5k_stop_locked(struct ath5k_hw *ah) -{ - - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "invalid %u\n", - test_bit(ATH_STAT_INVALID, ah->status)); - - /* - * Shutdown the hardware and driver: - * stop output from above - * disable interrupts - * turn off timers - * turn off the radio - * clear transmit machinery - * clear receive machinery - * drain and release tx queues - * reclaim beacon resources - * power down hardware - * - * Note that some of this work is not possible if the - * hardware is gone (invalid). - */ - ieee80211_stop_queues(ah->hw); - - if (!test_bit(ATH_STAT_INVALID, ah->status)) { - ath5k_led_off(ah); - ath5k_hw_set_imr(ah, 0); - synchronize_irq(ah->irq); - ath5k_rx_stop(ah); - ath5k_hw_dma_stop(ah); - ath5k_drain_tx_buffs(ah); - ath5k_hw_phy_disable(ah); - } - - return 0; -} - -int ath5k_start(struct ieee80211_hw *hw) -{ - struct ath5k_hw *ah = hw->priv; - struct ath_common *common = ath5k_hw_common(ah); - int ret, i; - - mutex_lock(&ah->lock); - - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "mode %d\n", ah->opmode); - - /* - * Stop anything previously setup. This is safe - * no matter this is the first time through or not. - */ - ath5k_stop_locked(ah); - - /* - * The basic interface to setting the hardware in a good - * state is ``reset''. On return the hardware is known to - * be powered up and with interrupts disabled. This must - * be followed by initialization of the appropriate bits - * and then setup of the interrupt mask. - */ - ah->curchan = ah->hw->conf.chandef.chan; - ah->imask = AR5K_INT_RXOK - | AR5K_INT_RXERR - | AR5K_INT_RXEOL - | AR5K_INT_RXORN - | AR5K_INT_TXDESC - | AR5K_INT_TXEOL - | AR5K_INT_FATAL - | AR5K_INT_GLOBAL - | AR5K_INT_MIB; - - ret = ath5k_reset(ah, NULL, false); - if (ret) - goto done; - - if (!ath5k_modparam_no_hw_rfkill_switch) - ath5k_rfkill_hw_start(ah); - - /* - * Reset the key cache since some parts do not reset the - * contents on initial power up or resume from suspend. - */ - for (i = 0; i < common->keymax; i++) - ath_hw_keyreset(common, (u16) i); - - /* Use higher rates for acks instead of base - * rate */ - ah->ah_ack_bitrate_high = true; - - for (i = 0; i < ARRAY_SIZE(ah->bslot); i++) - ah->bslot[i] = NULL; - - ret = 0; -done: - mmiowb(); - mutex_unlock(&ah->lock); - - set_bit(ATH_STAT_STARTED, ah->status); - ieee80211_queue_delayed_work(ah->hw, &ah->tx_complete_work, - msecs_to_jiffies(ATH5K_TX_COMPLETE_POLL_INT)); - - return ret; -} - -static void ath5k_stop_tasklets(struct ath5k_hw *ah) -{ - ah->rx_pending = false; - ah->tx_pending = false; - tasklet_kill(&ah->rxtq); - tasklet_kill(&ah->txtq); - tasklet_kill(&ah->beacontq); - tasklet_kill(&ah->ani_tasklet); -} - -/* - * Stop the device, grabbing the top-level lock to protect - * against concurrent entry through ath5k_init (which can happen - * if another thread does a system call and the thread doing the - * stop is preempted). - */ -void ath5k_stop(struct ieee80211_hw *hw) -{ - struct ath5k_hw *ah = hw->priv; - int ret; - - mutex_lock(&ah->lock); - ret = ath5k_stop_locked(ah); - if (ret == 0 && !test_bit(ATH_STAT_INVALID, ah->status)) { - /* - * Don't set the card in full sleep mode! - * - * a) When the device is in this state it must be carefully - * woken up or references to registers in the PCI clock - * domain may freeze the bus (and system). This varies - * by chip and is mostly an issue with newer parts - * (madwifi sources mentioned srev >= 0x78) that go to - * sleep more quickly. - * - * b) On older chips full sleep results a weird behaviour - * during wakeup. I tested various cards with srev < 0x78 - * and they don't wake up after module reload, a second - * module reload is needed to bring the card up again. - * - * Until we figure out what's going on don't enable - * full chip reset on any chip (this is what Legacy HAL - * and Sam's HAL do anyway). Instead Perform a full reset - * on the device (same as initial state after attach) and - * leave it idle (keep MAC/BB on warm reset) */ - ret = ath5k_hw_on_hold(ah); - - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, - "putting device to sleep\n"); - } - - mmiowb(); - mutex_unlock(&ah->lock); - - ath5k_stop_tasklets(ah); - - clear_bit(ATH_STAT_STARTED, ah->status); - cancel_delayed_work_sync(&ah->tx_complete_work); - - if (!ath5k_modparam_no_hw_rfkill_switch) - ath5k_rfkill_hw_stop(ah); -} - -/* - * Reset the hardware. If chan is not NULL, then also pause rx/tx - * and change to the given channel. - * - * This should be called with ah->lock. - */ -static int -ath5k_reset(struct ath5k_hw *ah, struct ieee80211_channel *chan, - bool skip_pcu) -{ - struct ath_common *common = ath5k_hw_common(ah); - int ret, ani_mode; - bool fast; - - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "resetting\n"); - - ath5k_hw_set_imr(ah, 0); - synchronize_irq(ah->irq); - ath5k_stop_tasklets(ah); - - /* Save ani mode and disable ANI during - * reset. If we don't we might get false - * PHY error interrupts. */ - ani_mode = ah->ani_state.ani_mode; - ath5k_ani_init(ah, ATH5K_ANI_MODE_OFF); - - /* We are going to empty hw queues - * so we should also free any remaining - * tx buffers */ - ath5k_drain_tx_buffs(ah); - if (chan) - ah->curchan = chan; - - fast = ((chan != NULL) && modparam_fastchanswitch) ? 1 : 0; - - ret = ath5k_hw_reset(ah, ah->opmode, ah->curchan, fast, skip_pcu); - if (ret) { - ATH5K_ERR(ah, "can't reset hardware (%d)\n", ret); - goto err; - } - - ret = ath5k_rx_start(ah); - if (ret) { - ATH5K_ERR(ah, "can't start recv logic\n"); - goto err; - } - - ath5k_ani_init(ah, ani_mode); - - /* - * Set calibration intervals - * - * Note: We don't need to run calibration imediately - * since some initial calibration is done on reset - * even for fast channel switching. Also on scanning - * this will get set again and again and it won't get - * executed unless we connect somewhere and spend some - * time on the channel (that's what calibration needs - * anyway to be accurate). - */ - ah->ah_cal_next_full = jiffies + - msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_FULL); - ah->ah_cal_next_ani = jiffies + - msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_ANI); - ah->ah_cal_next_short = jiffies + - msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_SHORT); - - ewma_init(&ah->ah_beacon_rssi_avg, 1024, 8); - - /* clear survey data and cycle counters */ - memset(&ah->survey, 0, sizeof(ah->survey)); - spin_lock_bh(&common->cc_lock); - ath_hw_cycle_counters_update(common); - memset(&common->cc_survey, 0, sizeof(common->cc_survey)); - memset(&common->cc_ani, 0, sizeof(common->cc_ani)); - spin_unlock_bh(&common->cc_lock); - - /* - * Change channels and update the h/w rate map if we're switching; - * e.g. 11a to 11b/g. - * - * We may be doing a reset in response to an ioctl that changes the - * channel so update any state that might change as a result. - * - * XXX needed? - */ -/* ath5k_chan_change(ah, c); */ - - ath5k_beacon_config(ah); - /* intrs are enabled by ath5k_beacon_config */ - - ieee80211_wake_queues(ah->hw); - - return 0; -err: - return ret; -} - -static void ath5k_reset_work(struct work_struct *work) -{ - struct ath5k_hw *ah = container_of(work, struct ath5k_hw, - reset_work); - - mutex_lock(&ah->lock); - ath5k_reset(ah, NULL, true); - mutex_unlock(&ah->lock); -} - -static int -ath5k_init(struct ieee80211_hw *hw) -{ - - struct ath5k_hw *ah = hw->priv; - struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah); - struct ath5k_txq *txq; - u8 mac[ETH_ALEN] = {}; - int ret; - - - /* - * Collect the channel list. The 802.11 layer - * is responsible for filtering this list based - * on settings like the phy mode and regulatory - * domain restrictions. - */ - ret = ath5k_setup_bands(hw); - if (ret) { - ATH5K_ERR(ah, "can't get channels\n"); - goto err; - } - - /* - * Allocate tx+rx descriptors and populate the lists. - */ - ret = ath5k_desc_alloc(ah); - if (ret) { - ATH5K_ERR(ah, "can't allocate descriptors\n"); - goto err; - } - - /* - * Allocate hardware transmit queues: one queue for - * beacon frames and one data queue for each QoS - * priority. Note that hw functions handle resetting - * these queues at the needed time. - */ - ret = ath5k_beaconq_setup(ah); - if (ret < 0) { - ATH5K_ERR(ah, "can't setup a beacon xmit queue\n"); - goto err_desc; - } - ah->bhalq = ret; - ah->cabq = ath5k_txq_setup(ah, AR5K_TX_QUEUE_CAB, 0); - if (IS_ERR(ah->cabq)) { - ATH5K_ERR(ah, "can't setup cab queue\n"); - ret = PTR_ERR(ah->cabq); - goto err_bhal; - } - - /* 5211 and 5212 usually support 10 queues but we better rely on the - * capability information */ - if (ah->ah_capabilities.cap_queues.q_tx_num >= 6) { - /* This order matches mac80211's queue priority, so we can - * directly use the mac80211 queue number without any mapping */ - txq = ath5k_txq_setup(ah, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_VO); - if (IS_ERR(txq)) { - ATH5K_ERR(ah, "can't setup xmit queue\n"); - ret = PTR_ERR(txq); - goto err_queues; - } - txq = ath5k_txq_setup(ah, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_VI); - if (IS_ERR(txq)) { - ATH5K_ERR(ah, "can't setup xmit queue\n"); - ret = PTR_ERR(txq); - goto err_queues; - } - txq = ath5k_txq_setup(ah, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BE); - if (IS_ERR(txq)) { - ATH5K_ERR(ah, "can't setup xmit queue\n"); - ret = PTR_ERR(txq); - goto err_queues; - } - txq = ath5k_txq_setup(ah, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BK); - if (IS_ERR(txq)) { - ATH5K_ERR(ah, "can't setup xmit queue\n"); - ret = PTR_ERR(txq); - goto err_queues; - } - hw->queues = 4; - } else { - /* older hardware (5210) can only support one data queue */ - txq = ath5k_txq_setup(ah, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BE); - if (IS_ERR(txq)) { - ATH5K_ERR(ah, "can't setup xmit queue\n"); - ret = PTR_ERR(txq); - goto err_queues; - } - hw->queues = 1; - } - - tasklet_init(&ah->rxtq, ath5k_tasklet_rx, (unsigned long)ah); - tasklet_init(&ah->txtq, ath5k_tasklet_tx, (unsigned long)ah); - tasklet_init(&ah->beacontq, ath5k_tasklet_beacon, (unsigned long)ah); - tasklet_init(&ah->ani_tasklet, ath5k_tasklet_ani, (unsigned long)ah); - - INIT_WORK(&ah->reset_work, ath5k_reset_work); - INIT_WORK(&ah->calib_work, ath5k_calibrate_work); - INIT_DELAYED_WORK(&ah->tx_complete_work, ath5k_tx_complete_poll_work); - - ret = ath5k_hw_common(ah)->bus_ops->eeprom_read_mac(ah, mac); - if (ret) { - ATH5K_ERR(ah, "unable to read address from EEPROM\n"); - goto err_queues; - } - - SET_IEEE80211_PERM_ADDR(hw, mac); - /* All MAC address bits matter for ACKs */ - ath5k_update_bssid_mask_and_opmode(ah, NULL); - - regulatory->current_rd = ah->ah_capabilities.cap_eeprom.ee_regdomain; - ret = ath_regd_init(regulatory, hw->wiphy, ath5k_reg_notifier); - if (ret) { - ATH5K_ERR(ah, "can't initialize regulatory system\n"); - goto err_queues; - } - - ret = ieee80211_register_hw(hw); - if (ret) { - ATH5K_ERR(ah, "can't register ieee80211 hw\n"); - goto err_queues; - } - - if (!ath_is_world_regd(regulatory)) - regulatory_hint(hw->wiphy, regulatory->alpha2); - - ath5k_init_leds(ah); - - ath5k_sysfs_register(ah); - - return 0; -err_queues: - ath5k_txq_release(ah); -err_bhal: - ath5k_hw_release_tx_queue(ah, ah->bhalq); -err_desc: - ath5k_desc_free(ah); -err: - return ret; -} - -void -ath5k_deinit_ah(struct ath5k_hw *ah) -{ - struct ieee80211_hw *hw = ah->hw; - - /* - * NB: the order of these is important: - * o call the 802.11 layer before detaching ath5k_hw to - * ensure callbacks into the driver to delete global - * key cache entries can be handled - * o reclaim the tx queue data structures after calling - * the 802.11 layer as we'll get called back to reclaim - * node state and potentially want to use them - * o to cleanup the tx queues the hal is called, so detach - * it last - * XXX: ??? detach ath5k_hw ??? - * Other than that, it's straightforward... - */ - ieee80211_unregister_hw(hw); - ath5k_desc_free(ah); - ath5k_txq_release(ah); - ath5k_hw_release_tx_queue(ah, ah->bhalq); - ath5k_unregister_leds(ah); - - ath5k_sysfs_unregister(ah); - /* - * NB: can't reclaim these until after ieee80211_ifdetach - * returns because we'll get called back to reclaim node - * state and potentially want to use them. - */ - ath5k_hw_deinit(ah); - free_irq(ah->irq, ah); -} - -bool -ath5k_any_vif_assoc(struct ath5k_hw *ah) -{ - struct ath5k_vif_iter_data iter_data; - iter_data.hw_macaddr = NULL; - iter_data.any_assoc = false; - iter_data.need_set_hw_addr = false; - iter_data.found_active = true; - - ieee80211_iterate_active_interfaces_atomic( - ah->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - ath5k_vif_iter, &iter_data); - return iter_data.any_assoc; -} - -void -ath5k_set_beacon_filter(struct ieee80211_hw *hw, bool enable) -{ - struct ath5k_hw *ah = hw->priv; - u32 rfilt; - rfilt = ath5k_hw_get_rx_filter(ah); - if (enable) - rfilt |= AR5K_RX_FILTER_BEACON; - else - rfilt &= ~AR5K_RX_FILTER_BEACON; - ath5k_hw_set_rx_filter(ah, rfilt); - ah->filter_flags = rfilt; -} - -void _ath5k_printk(const struct ath5k_hw *ah, const char *level, - const char *fmt, ...) -{ - struct va_format vaf; - va_list args; - - va_start(args, fmt); - - vaf.fmt = fmt; - vaf.va = &args; - - if (ah && ah->hw) - printk("%s" pr_fmt("%s: %pV"), - level, wiphy_name(ah->hw->wiphy), &vaf); - else - printk("%s" pr_fmt("%pV"), level, &vaf); - - va_end(args); -} diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h deleted file mode 100644 index 6c94c7ff2350..000000000000 --- a/drivers/net/wireless/ath/ath5k/base.h +++ /dev/null @@ -1,119 +0,0 @@ -/*- - * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any - * redistribution must be conditioned upon including a substantially - * similar Disclaimer requirement for further binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGES. - * - */ - -/* - * Definitions for the Atheros Wireless LAN controller driver. - */ -#ifndef _DEV_ATH5K_BASE_H -#define _DEV_ATH5K_BASE_H - -struct ieee80211_vif; -struct ieee80211_hw; -struct ath5k_hw; -struct ath5k_txq; -struct ieee80211_channel; -struct ath_bus_ops; -enum nl80211_iftype; - -enum ath5k_srev_type { - AR5K_VERSION_MAC, - AR5K_VERSION_RAD, -}; - -struct ath5k_srev_name { - const char *sr_name; - enum ath5k_srev_type sr_type; - u_int sr_val; -}; - -struct ath5k_buf { - struct list_head list; - struct ath5k_desc *desc; /* virtual addr of desc */ - dma_addr_t daddr; /* physical addr of desc */ - struct sk_buff *skb; /* skbuff for buf */ - dma_addr_t skbaddr;/* physical addr of skb data */ -}; - -struct ath5k_vif { - bool assoc; /* are we associated or not */ - enum nl80211_iftype opmode; - int bslot; - struct ath5k_buf *bbuf; /* beacon buffer */ -}; - -struct ath5k_vif_iter_data { - const u8 *hw_macaddr; - u8 mask[ETH_ALEN]; - u8 active_mac[ETH_ALEN]; /* first active MAC */ - bool need_set_hw_addr; - bool found_active; - bool any_assoc; - enum nl80211_iftype opmode; - int n_stas; -}; - -void ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif); -bool ath5k_any_vif_assoc(struct ath5k_hw *ah); - -int ath5k_start(struct ieee80211_hw *hw); -void ath5k_stop(struct ieee80211_hw *hw); - -void ath5k_beacon_update_timers(struct ath5k_hw *ah, u64 bc_tsf); -int ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif); -void ath5k_beacon_config(struct ath5k_hw *ah); -void ath5k_set_beacon_filter(struct ieee80211_hw *hw, bool enable); - -void ath5k_update_bssid_mask_and_opmode(struct ath5k_hw *ah, - struct ieee80211_vif *vif); -int ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan); -void ath5k_txbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf); -void ath5k_rxbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf); -void ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, - struct ath5k_txq *txq); - -const char *ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val); - -int ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops); -void ath5k_deinit_ah(struct ath5k_hw *ah); - -/* Check whether BSSID mask is supported */ -#define ath5k_hw_hasbssidmask(_ah) (ah->ah_version == AR5K_AR5212) - -/* Check whether virtual EOL is supported */ -#define ath5k_hw_hasveol(_ah) (ah->ah_version != AR5K_AR5210) - -#endif /* _DEV_ATH5K_BASE_H */ diff --git a/drivers/net/wireless/ath/ath5k/caps.c b/drivers/net/wireless/ath/ath5k/caps.c deleted file mode 100644 index 994169ad39cb..000000000000 --- a/drivers/net/wireless/ath/ath5k/caps.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2004-2008 Reyk Floeter - * Copyright (c) 2006-2008 Nick Kossifidis - * Copyright (c) 2007-2008 Jiri Slaby - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/**************\ -* Capabilities * -\**************/ - -#include "ath5k.h" -#include "reg.h" -#include "debug.h" -#include "../regd.h" - -/* - * Fill the capabilities struct - * TODO: Merge this with EEPROM code when we are done with it - */ -int ath5k_hw_set_capabilities(struct ath5k_hw *ah) -{ - struct ath5k_capabilities *caps = &ah->ah_capabilities; - u16 ee_header; - - /* Capabilities stored in the EEPROM */ - ee_header = caps->cap_eeprom.ee_header; - - if (ah->ah_version == AR5K_AR5210) { - /* - * Set radio capabilities - * (The AR5110 only supports the middle 5GHz band) - */ - caps->cap_range.range_5ghz_min = 5120; - caps->cap_range.range_5ghz_max = 5430; - caps->cap_range.range_2ghz_min = 0; - caps->cap_range.range_2ghz_max = 0; - - /* Set supported modes */ - __set_bit(AR5K_MODE_11A, caps->cap_mode); - } else { - /* - * XXX The transceiver supports frequencies from 4920 to 6100MHz - * XXX and from 2312 to 2732MHz. There are problems with the - * XXX current ieee80211 implementation because the IEEE - * XXX channel mapping does not support negative channel - * XXX numbers (2312MHz is channel -19). Of course, this - * XXX doesn't matter because these channels are out of the - * XXX legal range. - */ - - /* - * Set radio capabilities - */ - - if (AR5K_EEPROM_HDR_11A(ee_header)) { - if (ath_is_49ghz_allowed(caps->cap_eeprom.ee_regdomain)) - caps->cap_range.range_5ghz_min = 4920; - else - caps->cap_range.range_5ghz_min = 5005; - caps->cap_range.range_5ghz_max = 6100; - - /* Set supported modes */ - __set_bit(AR5K_MODE_11A, caps->cap_mode); - } - - /* Enable 802.11b if a 2GHz capable radio (2111/5112) is - * connected */ - if (AR5K_EEPROM_HDR_11B(ee_header) || - (AR5K_EEPROM_HDR_11G(ee_header) && - ah->ah_version != AR5K_AR5211)) { - /* 2312 */ - caps->cap_range.range_2ghz_min = 2412; - caps->cap_range.range_2ghz_max = 2732; - - /* Override 2GHz modes on SoCs that need it - * NOTE: cap_needs_2GHz_ovr gets set from - * ath_ahb_probe */ - if (!caps->cap_needs_2GHz_ovr) { - if (AR5K_EEPROM_HDR_11B(ee_header)) - __set_bit(AR5K_MODE_11B, - caps->cap_mode); - - if (AR5K_EEPROM_HDR_11G(ee_header) && - ah->ah_version != AR5K_AR5211) - __set_bit(AR5K_MODE_11G, - caps->cap_mode); - } - } - } - - if ((ah->ah_radio_5ghz_revision & 0xf0) == AR5K_SREV_RAD_2112) - __clear_bit(AR5K_MODE_11A, caps->cap_mode); - - /* Set number of supported TX queues */ - if (ah->ah_version == AR5K_AR5210) - caps->cap_queues.q_tx_num = AR5K_NUM_TX_QUEUES_NOQCU; - else - caps->cap_queues.q_tx_num = AR5K_NUM_TX_QUEUES; - - /* Newer hardware has PHY error counters */ - if (ah->ah_mac_srev >= AR5K_SREV_AR5213A) - caps->cap_has_phyerr_counters = true; - else - caps->cap_has_phyerr_counters = false; - - /* MACs since AR5212 have MRR support */ - if (ah->ah_version == AR5K_AR5212) - caps->cap_has_mrr_support = true; - else - caps->cap_has_mrr_support = false; - - return 0; -} - -/* - * TODO: Following functions should be part of a new function - * set_capability - */ - -int ath5k_hw_enable_pspoll(struct ath5k_hw *ah, u8 *bssid, - u16 assoc_id) -{ - if (ah->ah_version == AR5K_AR5210) { - AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1, - AR5K_STA_ID1_NO_PSPOLL | AR5K_STA_ID1_DEFAULT_ANTENNA); - return 0; - } - - return -EIO; -} - -int ath5k_hw_disable_pspoll(struct ath5k_hw *ah) -{ - if (ah->ah_version == AR5K_AR5210) { - AR5K_REG_ENABLE_BITS(ah, AR5K_STA_ID1, - AR5K_STA_ID1_NO_PSPOLL | AR5K_STA_ID1_DEFAULT_ANTENNA); - return 0; - } - - return -EIO; -} diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c deleted file mode 100644 index 9d00dab666a8..000000000000 --- a/drivers/net/wireless/ath/ath5k/debug.c +++ /dev/null @@ -1,1029 +0,0 @@ -/* - * Copyright (c) 2007-2008 Bruno Randolf - * - * This file is free software: you may copy, redistribute and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 2 of the License, or (at your - * option) any later version. - * - * This file 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, see . - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting - * Copyright (c) 2004-2005 Atheros Communications, Inc. - * Copyright (c) 2006 Devicescape Software, Inc. - * Copyright (c) 2007 Jiri Slaby - * Copyright (c) 2007 Luis R. Rodriguez - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any - * redistribution must be conditioned upon including a substantially - * similar Disclaimer requirement for further binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGES. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include - -#include -#include -#include "debug.h" -#include "ath5k.h" -#include "reg.h" -#include "base.h" - -static unsigned int ath5k_debug; -module_param_named(debug, ath5k_debug, uint, 0); - - -/* debugfs: registers */ - -struct reg { - const char *name; - int addr; -}; - -#define REG_STRUCT_INIT(r) { #r, r } - -/* just a few random registers, might want to add more */ -static const struct reg regs[] = { - REG_STRUCT_INIT(AR5K_CR), - REG_STRUCT_INIT(AR5K_RXDP), - REG_STRUCT_INIT(AR5K_CFG), - REG_STRUCT_INIT(AR5K_IER), - REG_STRUCT_INIT(AR5K_BCR), - REG_STRUCT_INIT(AR5K_RTSD0), - REG_STRUCT_INIT(AR5K_RTSD1), - REG_STRUCT_INIT(AR5K_TXCFG), - REG_STRUCT_INIT(AR5K_RXCFG), - REG_STRUCT_INIT(AR5K_RXJLA), - REG_STRUCT_INIT(AR5K_MIBC), - REG_STRUCT_INIT(AR5K_TOPS), - REG_STRUCT_INIT(AR5K_RXNOFRM), - REG_STRUCT_INIT(AR5K_TXNOFRM), - REG_STRUCT_INIT(AR5K_RPGTO), - REG_STRUCT_INIT(AR5K_RFCNT), - REG_STRUCT_INIT(AR5K_MISC), - REG_STRUCT_INIT(AR5K_QCUDCU_CLKGT), - REG_STRUCT_INIT(AR5K_ISR), - REG_STRUCT_INIT(AR5K_PISR), - REG_STRUCT_INIT(AR5K_SISR0), - REG_STRUCT_INIT(AR5K_SISR1), - REG_STRUCT_INIT(AR5K_SISR2), - REG_STRUCT_INIT(AR5K_SISR3), - REG_STRUCT_INIT(AR5K_SISR4), - REG_STRUCT_INIT(AR5K_IMR), - REG_STRUCT_INIT(AR5K_PIMR), - REG_STRUCT_INIT(AR5K_SIMR0), - REG_STRUCT_INIT(AR5K_SIMR1), - REG_STRUCT_INIT(AR5K_SIMR2), - REG_STRUCT_INIT(AR5K_SIMR3), - REG_STRUCT_INIT(AR5K_SIMR4), - REG_STRUCT_INIT(AR5K_DCM_ADDR), - REG_STRUCT_INIT(AR5K_DCCFG), - REG_STRUCT_INIT(AR5K_CCFG), - REG_STRUCT_INIT(AR5K_CPC0), - REG_STRUCT_INIT(AR5K_CPC1), - REG_STRUCT_INIT(AR5K_CPC2), - REG_STRUCT_INIT(AR5K_CPC3), - REG_STRUCT_INIT(AR5K_CPCOVF), - REG_STRUCT_INIT(AR5K_RESET_CTL), - REG_STRUCT_INIT(AR5K_SLEEP_CTL), - REG_STRUCT_INIT(AR5K_INTPEND), - REG_STRUCT_INIT(AR5K_SFR), - REG_STRUCT_INIT(AR5K_PCICFG), - REG_STRUCT_INIT(AR5K_GPIOCR), - REG_STRUCT_INIT(AR5K_GPIODO), - REG_STRUCT_INIT(AR5K_SREV), -}; - -static void *reg_start(struct seq_file *seq, loff_t *pos) -{ - return *pos < ARRAY_SIZE(regs) ? (void *)®s[*pos] : NULL; -} - -static void reg_stop(struct seq_file *seq, void *p) -{ - /* nothing to do */ -} - -static void *reg_next(struct seq_file *seq, void *p, loff_t *pos) -{ - ++*pos; - return *pos < ARRAY_SIZE(regs) ? (void *)®s[*pos] : NULL; -} - -static int reg_show(struct seq_file *seq, void *p) -{ - struct ath5k_hw *ah = seq->private; - struct reg *r = p; - seq_printf(seq, "%-25s0x%08x\n", r->name, - ath5k_hw_reg_read(ah, r->addr)); - return 0; -} - -static const struct seq_operations register_seq_ops = { - .start = reg_start, - .next = reg_next, - .stop = reg_stop, - .show = reg_show -}; - -static int open_file_registers(struct inode *inode, struct file *file) -{ - struct seq_file *s; - int res; - res = seq_open(file, ®ister_seq_ops); - if (res == 0) { - s = file->private_data; - s->private = inode->i_private; - } - return res; -} - -static const struct file_operations fops_registers = { - .open = open_file_registers, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, - .owner = THIS_MODULE, -}; - - -/* debugfs: beacons */ - -static ssize_t read_file_beacon(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath5k_hw *ah = file->private_data; - char buf[500]; - unsigned int len = 0; - unsigned int v; - u64 tsf; - - v = ath5k_hw_reg_read(ah, AR5K_BEACON); - len += snprintf(buf + len, sizeof(buf) - len, - "%-24s0x%08x\tintval: %d\tTIM: 0x%x\n", - "AR5K_BEACON", v, v & AR5K_BEACON_PERIOD, - (v & AR5K_BEACON_TIM) >> AR5K_BEACON_TIM_S); - - len += snprintf(buf + len, sizeof(buf) - len, "%-24s0x%08x\n", - "AR5K_LAST_TSTP", ath5k_hw_reg_read(ah, AR5K_LAST_TSTP)); - - len += snprintf(buf + len, sizeof(buf) - len, "%-24s0x%08x\n\n", - "AR5K_BEACON_CNT", ath5k_hw_reg_read(ah, AR5K_BEACON_CNT)); - - v = ath5k_hw_reg_read(ah, AR5K_TIMER0); - len += snprintf(buf + len, sizeof(buf) - len, "%-24s0x%08x\tTU: %08x\n", - "AR5K_TIMER0 (TBTT)", v, v); - - v = ath5k_hw_reg_read(ah, AR5K_TIMER1); - len += snprintf(buf + len, sizeof(buf) - len, "%-24s0x%08x\tTU: %08x\n", - "AR5K_TIMER1 (DMA)", v, v >> 3); - - v = ath5k_hw_reg_read(ah, AR5K_TIMER2); - len += snprintf(buf + len, sizeof(buf) - len, "%-24s0x%08x\tTU: %08x\n", - "AR5K_TIMER2 (SWBA)", v, v >> 3); - - v = ath5k_hw_reg_read(ah, AR5K_TIMER3); - len += snprintf(buf + len, sizeof(buf) - len, "%-24s0x%08x\tTU: %08x\n", - "AR5K_TIMER3 (ATIM)", v, v); - - tsf = ath5k_hw_get_tsf64(ah); - len += snprintf(buf + len, sizeof(buf) - len, - "TSF\t\t0x%016llx\tTU: %08x\n", - (unsigned long long)tsf, TSF_TO_TU(tsf)); - - if (len > sizeof(buf)) - len = sizeof(buf); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_beacon(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct ath5k_hw *ah = file->private_data; - char buf[20]; - - if (copy_from_user(buf, userbuf, min(count, sizeof(buf)))) - return -EFAULT; - - if (strncmp(buf, "disable", 7) == 0) { - AR5K_REG_DISABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE); - pr_info("debugfs disable beacons\n"); - } else if (strncmp(buf, "enable", 6) == 0) { - AR5K_REG_ENABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE); - pr_info("debugfs enable beacons\n"); - } - return count; -} - -static const struct file_operations fops_beacon = { - .read = read_file_beacon, - .write = write_file_beacon, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - - -/* debugfs: reset */ - -static ssize_t write_file_reset(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct ath5k_hw *ah = file->private_data; - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "debug file triggered reset\n"); - ieee80211_queue_work(ah->hw, &ah->reset_work); - return count; -} - -static const struct file_operations fops_reset = { - .write = write_file_reset, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = noop_llseek, -}; - - -/* debugfs: debug level */ - -static const struct { - enum ath5k_debug_level level; - const char *name; - const char *desc; -} dbg_info[] = { - { ATH5K_DEBUG_RESET, "reset", "reset and initialization" }, - { ATH5K_DEBUG_INTR, "intr", "interrupt handling" }, - { ATH5K_DEBUG_MODE, "mode", "mode init/setup" }, - { ATH5K_DEBUG_XMIT, "xmit", "basic xmit operation" }, - { ATH5K_DEBUG_BEACON, "beacon", "beacon handling" }, - { ATH5K_DEBUG_CALIBRATE, "calib", "periodic calibration" }, - { ATH5K_DEBUG_TXPOWER, "txpower", "transmit power setting" }, - { ATH5K_DEBUG_LED, "led", "LED management" }, - { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" }, - { ATH5K_DEBUG_DMA, "dma", "dma start/stop" }, - { ATH5K_DEBUG_ANI, "ani", "adaptive noise immunity" }, - { ATH5K_DEBUG_DESC, "desc", "descriptor chains" }, - { ATH5K_DEBUG_ANY, "all", "show all debug levels" }, -}; - -static ssize_t read_file_debug(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath5k_hw *ah = file->private_data; - char buf[700]; - unsigned int len = 0; - unsigned int i; - - len += snprintf(buf + len, sizeof(buf) - len, - "DEBUG LEVEL: 0x%08x\n\n", ah->debug.level); - - for (i = 0; i < ARRAY_SIZE(dbg_info) - 1; i++) { - len += snprintf(buf + len, sizeof(buf) - len, - "%10s %c 0x%08x - %s\n", dbg_info[i].name, - ah->debug.level & dbg_info[i].level ? '+' : ' ', - dbg_info[i].level, dbg_info[i].desc); - } - len += snprintf(buf + len, sizeof(buf) - len, - "%10s %c 0x%08x - %s\n", dbg_info[i].name, - ah->debug.level == dbg_info[i].level ? '+' : ' ', - dbg_info[i].level, dbg_info[i].desc); - - if (len > sizeof(buf)) - len = sizeof(buf); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_debug(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct ath5k_hw *ah = file->private_data; - unsigned int i; - char buf[20]; - - if (copy_from_user(buf, userbuf, min(count, sizeof(buf)))) - return -EFAULT; - - for (i = 0; i < ARRAY_SIZE(dbg_info); i++) { - if (strncmp(buf, dbg_info[i].name, - strlen(dbg_info[i].name)) == 0) { - ah->debug.level ^= dbg_info[i].level; /* toggle bit */ - break; - } - } - return count; -} - -static const struct file_operations fops_debug = { - .read = read_file_debug, - .write = write_file_debug, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - - -/* debugfs: antenna */ - -static ssize_t read_file_antenna(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath5k_hw *ah = file->private_data; - char buf[700]; - unsigned int len = 0; - unsigned int i; - unsigned int v; - - len += snprintf(buf + len, sizeof(buf) - len, "antenna mode\t%d\n", - ah->ah_ant_mode); - len += snprintf(buf + len, sizeof(buf) - len, "default antenna\t%d\n", - ah->ah_def_ant); - len += snprintf(buf + len, sizeof(buf) - len, "tx antenna\t%d\n", - ah->ah_tx_ant); - - len += snprintf(buf + len, sizeof(buf) - len, "\nANTENNA\t\tRX\tTX\n"); - for (i = 1; i < ARRAY_SIZE(ah->stats.antenna_rx); i++) { - len += snprintf(buf + len, sizeof(buf) - len, - "[antenna %d]\t%d\t%d\n", - i, ah->stats.antenna_rx[i], ah->stats.antenna_tx[i]); - } - len += snprintf(buf + len, sizeof(buf) - len, "[invalid]\t%d\t%d\n", - ah->stats.antenna_rx[0], ah->stats.antenna_tx[0]); - - v = ath5k_hw_reg_read(ah, AR5K_DEFAULT_ANTENNA); - len += snprintf(buf + len, sizeof(buf) - len, - "\nAR5K_DEFAULT_ANTENNA\t0x%08x\n", v); - - v = ath5k_hw_reg_read(ah, AR5K_STA_ID1); - len += snprintf(buf + len, sizeof(buf) - len, - "AR5K_STA_ID1_DEFAULT_ANTENNA\t%d\n", - (v & AR5K_STA_ID1_DEFAULT_ANTENNA) != 0); - len += snprintf(buf + len, sizeof(buf) - len, - "AR5K_STA_ID1_DESC_ANTENNA\t%d\n", - (v & AR5K_STA_ID1_DESC_ANTENNA) != 0); - len += snprintf(buf + len, sizeof(buf) - len, - "AR5K_STA_ID1_RTS_DEF_ANTENNA\t%d\n", - (v & AR5K_STA_ID1_RTS_DEF_ANTENNA) != 0); - len += snprintf(buf + len, sizeof(buf) - len, - "AR5K_STA_ID1_SELFGEN_DEF_ANT\t%d\n", - (v & AR5K_STA_ID1_SELFGEN_DEF_ANT) != 0); - - v = ath5k_hw_reg_read(ah, AR5K_PHY_AGCCTL); - len += snprintf(buf + len, sizeof(buf) - len, - "\nAR5K_PHY_AGCCTL_OFDM_DIV_DIS\t%d\n", - (v & AR5K_PHY_AGCCTL_OFDM_DIV_DIS) != 0); - - v = ath5k_hw_reg_read(ah, AR5K_PHY_RESTART); - len += snprintf(buf + len, sizeof(buf) - len, - "AR5K_PHY_RESTART_DIV_GC\t\t%x\n", - (v & AR5K_PHY_RESTART_DIV_GC) >> AR5K_PHY_RESTART_DIV_GC_S); - - v = ath5k_hw_reg_read(ah, AR5K_PHY_FAST_ANT_DIV); - len += snprintf(buf + len, sizeof(buf) - len, - "AR5K_PHY_FAST_ANT_DIV_EN\t%d\n", - (v & AR5K_PHY_FAST_ANT_DIV_EN) != 0); - - v = ath5k_hw_reg_read(ah, AR5K_PHY_ANT_SWITCH_TABLE_0); - len += snprintf(buf + len, sizeof(buf) - len, - "\nAR5K_PHY_ANT_SWITCH_TABLE_0\t0x%08x\n", v); - v = ath5k_hw_reg_read(ah, AR5K_PHY_ANT_SWITCH_TABLE_1); - len += snprintf(buf + len, sizeof(buf) - len, - "AR5K_PHY_ANT_SWITCH_TABLE_1\t0x%08x\n", v); - - if (len > sizeof(buf)) - len = sizeof(buf); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_antenna(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct ath5k_hw *ah = file->private_data; - unsigned int i; - char buf[20]; - - if (copy_from_user(buf, userbuf, min(count, sizeof(buf)))) - return -EFAULT; - - if (strncmp(buf, "diversity", 9) == 0) { - ath5k_hw_set_antenna_mode(ah, AR5K_ANTMODE_DEFAULT); - pr_info("debug: enable diversity\n"); - } else if (strncmp(buf, "fixed-a", 7) == 0) { - ath5k_hw_set_antenna_mode(ah, AR5K_ANTMODE_FIXED_A); - pr_info("debug: fixed antenna A\n"); - } else if (strncmp(buf, "fixed-b", 7) == 0) { - ath5k_hw_set_antenna_mode(ah, AR5K_ANTMODE_FIXED_B); - pr_info("debug: fixed antenna B\n"); - } else if (strncmp(buf, "clear", 5) == 0) { - for (i = 0; i < ARRAY_SIZE(ah->stats.antenna_rx); i++) { - ah->stats.antenna_rx[i] = 0; - ah->stats.antenna_tx[i] = 0; - } - pr_info("debug: cleared antenna stats\n"); - } - return count; -} - -static const struct file_operations fops_antenna = { - .read = read_file_antenna, - .write = write_file_antenna, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -/* debugfs: misc */ - -static ssize_t read_file_misc(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath5k_hw *ah = file->private_data; - char buf[700]; - unsigned int len = 0; - u32 filt = ath5k_hw_get_rx_filter(ah); - - len += snprintf(buf + len, sizeof(buf) - len, "bssid-mask: %pM\n", - ah->bssidmask); - len += snprintf(buf + len, sizeof(buf) - len, "filter-flags: 0x%x ", - filt); - if (filt & AR5K_RX_FILTER_UCAST) - len += snprintf(buf + len, sizeof(buf) - len, " UCAST"); - if (filt & AR5K_RX_FILTER_MCAST) - len += snprintf(buf + len, sizeof(buf) - len, " MCAST"); - if (filt & AR5K_RX_FILTER_BCAST) - len += snprintf(buf + len, sizeof(buf) - len, " BCAST"); - if (filt & AR5K_RX_FILTER_CONTROL) - len += snprintf(buf + len, sizeof(buf) - len, " CONTROL"); - if (filt & AR5K_RX_FILTER_BEACON) - len += snprintf(buf + len, sizeof(buf) - len, " BEACON"); - if (filt & AR5K_RX_FILTER_PROM) - len += snprintf(buf + len, sizeof(buf) - len, " PROM"); - if (filt & AR5K_RX_FILTER_XRPOLL) - len += snprintf(buf + len, sizeof(buf) - len, " XRPOLL"); - if (filt & AR5K_RX_FILTER_PROBEREQ) - len += snprintf(buf + len, sizeof(buf) - len, " PROBEREQ"); - if (filt & AR5K_RX_FILTER_PHYERR_5212) - len += snprintf(buf + len, sizeof(buf) - len, " PHYERR-5212"); - if (filt & AR5K_RX_FILTER_RADARERR_5212) - len += snprintf(buf + len, sizeof(buf) - len, " RADARERR-5212"); - if (filt & AR5K_RX_FILTER_PHYERR_5211) - snprintf(buf + len, sizeof(buf) - len, " PHYERR-5211"); - if (filt & AR5K_RX_FILTER_RADARERR_5211) - len += snprintf(buf + len, sizeof(buf) - len, " RADARERR-5211"); - - len += snprintf(buf + len, sizeof(buf) - len, "\nopmode: %s (%d)\n", - ath_opmode_to_string(ah->opmode), ah->opmode); - - if (len > sizeof(buf)) - len = sizeof(buf); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static const struct file_operations fops_misc = { - .read = read_file_misc, - .open = simple_open, - .owner = THIS_MODULE, -}; - - -/* debugfs: frameerrors */ - -static ssize_t read_file_frameerrors(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath5k_hw *ah = file->private_data; - struct ath5k_statistics *st = &ah->stats; - char buf[700]; - unsigned int len = 0; - int i; - - len += snprintf(buf + len, sizeof(buf) - len, - "RX\n---------------------\n"); - len += snprintf(buf + len, sizeof(buf) - len, "CRC\t%u\t(%u%%)\n", - st->rxerr_crc, - st->rx_all_count > 0 ? - st->rxerr_crc * 100 / st->rx_all_count : 0); - len += snprintf(buf + len, sizeof(buf) - len, "PHY\t%u\t(%u%%)\n", - st->rxerr_phy, - st->rx_all_count > 0 ? - st->rxerr_phy * 100 / st->rx_all_count : 0); - for (i = 0; i < 32; i++) { - if (st->rxerr_phy_code[i]) - len += snprintf(buf + len, sizeof(buf) - len, - " phy_err[%u]\t%u\n", - i, st->rxerr_phy_code[i]); - } - - len += snprintf(buf + len, sizeof(buf) - len, "FIFO\t%u\t(%u%%)\n", - st->rxerr_fifo, - st->rx_all_count > 0 ? - st->rxerr_fifo * 100 / st->rx_all_count : 0); - len += snprintf(buf + len, sizeof(buf) - len, "decrypt\t%u\t(%u%%)\n", - st->rxerr_decrypt, - st->rx_all_count > 0 ? - st->rxerr_decrypt * 100 / st->rx_all_count : 0); - len += snprintf(buf + len, sizeof(buf) - len, "MIC\t%u\t(%u%%)\n", - st->rxerr_mic, - st->rx_all_count > 0 ? - st->rxerr_mic * 100 / st->rx_all_count : 0); - len += snprintf(buf + len, sizeof(buf) - len, "process\t%u\t(%u%%)\n", - st->rxerr_proc, - st->rx_all_count > 0 ? - st->rxerr_proc * 100 / st->rx_all_count : 0); - len += snprintf(buf + len, sizeof(buf) - len, "jumbo\t%u\t(%u%%)\n", - st->rxerr_jumbo, - st->rx_all_count > 0 ? - st->rxerr_jumbo * 100 / st->rx_all_count : 0); - len += snprintf(buf + len, sizeof(buf) - len, "[RX all\t%u]\n", - st->rx_all_count); - len += snprintf(buf + len, sizeof(buf) - len, "RX-all-bytes\t%u\n", - st->rx_bytes_count); - - len += snprintf(buf + len, sizeof(buf) - len, - "\nTX\n---------------------\n"); - len += snprintf(buf + len, sizeof(buf) - len, "retry\t%u\t(%u%%)\n", - st->txerr_retry, - st->tx_all_count > 0 ? - st->txerr_retry * 100 / st->tx_all_count : 0); - len += snprintf(buf + len, sizeof(buf) - len, "FIFO\t%u\t(%u%%)\n", - st->txerr_fifo, - st->tx_all_count > 0 ? - st->txerr_fifo * 100 / st->tx_all_count : 0); - len += snprintf(buf + len, sizeof(buf) - len, "filter\t%u\t(%u%%)\n", - st->txerr_filt, - st->tx_all_count > 0 ? - st->txerr_filt * 100 / st->tx_all_count : 0); - len += snprintf(buf + len, sizeof(buf) - len, "[TX all\t%u]\n", - st->tx_all_count); - len += snprintf(buf + len, sizeof(buf) - len, "TX-all-bytes\t%u\n", - st->tx_bytes_count); - - if (len > sizeof(buf)) - len = sizeof(buf); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_frameerrors(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct ath5k_hw *ah = file->private_data; - struct ath5k_statistics *st = &ah->stats; - char buf[20]; - - if (copy_from_user(buf, userbuf, min(count, sizeof(buf)))) - return -EFAULT; - - if (strncmp(buf, "clear", 5) == 0) { - st->rxerr_crc = 0; - st->rxerr_phy = 0; - st->rxerr_fifo = 0; - st->rxerr_decrypt = 0; - st->rxerr_mic = 0; - st->rxerr_proc = 0; - st->rxerr_jumbo = 0; - st->rx_all_count = 0; - st->txerr_retry = 0; - st->txerr_fifo = 0; - st->txerr_filt = 0; - st->tx_all_count = 0; - pr_info("debug: cleared frameerrors stats\n"); - } - return count; -} - -static const struct file_operations fops_frameerrors = { - .read = read_file_frameerrors, - .write = write_file_frameerrors, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - - -/* debugfs: ani */ - -static ssize_t read_file_ani(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath5k_hw *ah = file->private_data; - struct ath5k_statistics *st = &ah->stats; - struct ath5k_ani_state *as = &ah->ani_state; - - char buf[700]; - unsigned int len = 0; - - len += snprintf(buf + len, sizeof(buf) - len, - "HW has PHY error counters:\t%s\n", - ah->ah_capabilities.cap_has_phyerr_counters ? - "yes" : "no"); - len += snprintf(buf + len, sizeof(buf) - len, - "HW max spur immunity level:\t%d\n", - as->max_spur_level); - len += snprintf(buf + len, sizeof(buf) - len, - "\nANI state\n--------------------------------------------\n"); - len += snprintf(buf + len, sizeof(buf) - len, "operating mode:\t\t\t"); - switch (as->ani_mode) { - case ATH5K_ANI_MODE_OFF: - len += snprintf(buf + len, sizeof(buf) - len, "OFF\n"); - break; - case ATH5K_ANI_MODE_MANUAL_LOW: - len += snprintf(buf + len, sizeof(buf) - len, - "MANUAL LOW\n"); - break; - case ATH5K_ANI_MODE_MANUAL_HIGH: - len += snprintf(buf + len, sizeof(buf) - len, - "MANUAL HIGH\n"); - break; - case ATH5K_ANI_MODE_AUTO: - len += snprintf(buf + len, sizeof(buf) - len, "AUTO\n"); - break; - default: - len += snprintf(buf + len, sizeof(buf) - len, - "??? (not good)\n"); - break; - } - len += snprintf(buf + len, sizeof(buf) - len, - "noise immunity level:\t\t%d\n", - as->noise_imm_level); - len += snprintf(buf + len, sizeof(buf) - len, - "spur immunity level:\t\t%d\n", - as->spur_level); - len += snprintf(buf + len, sizeof(buf) - len, - "firstep level:\t\t\t%d\n", - as->firstep_level); - len += snprintf(buf + len, sizeof(buf) - len, - "OFDM weak signal detection:\t%s\n", - as->ofdm_weak_sig ? "on" : "off"); - len += snprintf(buf + len, sizeof(buf) - len, - "CCK weak signal detection:\t%s\n", - as->cck_weak_sig ? "on" : "off"); - - len += snprintf(buf + len, sizeof(buf) - len, - "\nMIB INTERRUPTS:\t\t%u\n", - st->mib_intr); - len += snprintf(buf + len, sizeof(buf) - len, - "beacon RSSI average:\t%d\n", - (int)ewma_read(&ah->ah_beacon_rssi_avg)); - -#define CC_PRINT(_struct, _field) \ - _struct._field, \ - _struct.cycles > 0 ? \ - _struct._field * 100 / _struct.cycles : 0 - - len += snprintf(buf + len, sizeof(buf) - len, - "profcnt tx\t\t%u\t(%d%%)\n", - CC_PRINT(as->last_cc, tx_frame)); - len += snprintf(buf + len, sizeof(buf) - len, - "profcnt rx\t\t%u\t(%d%%)\n", - CC_PRINT(as->last_cc, rx_frame)); - len += snprintf(buf + len, sizeof(buf) - len, - "profcnt busy\t\t%u\t(%d%%)\n", - CC_PRINT(as->last_cc, rx_busy)); -#undef CC_PRINT - len += snprintf(buf + len, sizeof(buf) - len, "profcnt cycles\t\t%u\n", - as->last_cc.cycles); - len += snprintf(buf + len, sizeof(buf) - len, - "listen time\t\t%d\tlast: %d\n", - as->listen_time, as->last_listen); - len += snprintf(buf + len, sizeof(buf) - len, - "OFDM errors\t\t%u\tlast: %u\tsum: %u\n", - as->ofdm_errors, as->last_ofdm_errors, - as->sum_ofdm_errors); - len += snprintf(buf + len, sizeof(buf) - len, - "CCK errors\t\t%u\tlast: %u\tsum: %u\n", - as->cck_errors, as->last_cck_errors, - as->sum_cck_errors); - len += snprintf(buf + len, sizeof(buf) - len, - "AR5K_PHYERR_CNT1\t%x\t(=%d)\n", - ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT1), - ATH5K_ANI_OFDM_TRIG_HIGH - (ATH5K_PHYERR_CNT_MAX - - ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT1))); - len += snprintf(buf + len, sizeof(buf) - len, - "AR5K_PHYERR_CNT2\t%x\t(=%d)\n", - ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT2), - ATH5K_ANI_CCK_TRIG_HIGH - (ATH5K_PHYERR_CNT_MAX - - ath5k_hw_reg_read(ah, AR5K_PHYERR_CNT2))); - - if (len > sizeof(buf)) - len = sizeof(buf); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_ani(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct ath5k_hw *ah = file->private_data; - char buf[20]; - - if (copy_from_user(buf, userbuf, min(count, sizeof(buf)))) - return -EFAULT; - - if (strncmp(buf, "sens-low", 8) == 0) { - ath5k_ani_init(ah, ATH5K_ANI_MODE_MANUAL_HIGH); - } else if (strncmp(buf, "sens-high", 9) == 0) { - ath5k_ani_init(ah, ATH5K_ANI_MODE_MANUAL_LOW); - } else if (strncmp(buf, "ani-off", 7) == 0) { - ath5k_ani_init(ah, ATH5K_ANI_MODE_OFF); - } else if (strncmp(buf, "ani-on", 6) == 0) { - ath5k_ani_init(ah, ATH5K_ANI_MODE_AUTO); - } else if (strncmp(buf, "noise-low", 9) == 0) { - ath5k_ani_set_noise_immunity_level(ah, 0); - } else if (strncmp(buf, "noise-high", 10) == 0) { - ath5k_ani_set_noise_immunity_level(ah, - ATH5K_ANI_MAX_NOISE_IMM_LVL); - } else if (strncmp(buf, "spur-low", 8) == 0) { - ath5k_ani_set_spur_immunity_level(ah, 0); - } else if (strncmp(buf, "spur-high", 9) == 0) { - ath5k_ani_set_spur_immunity_level(ah, - ah->ani_state.max_spur_level); - } else if (strncmp(buf, "fir-low", 7) == 0) { - ath5k_ani_set_firstep_level(ah, 0); - } else if (strncmp(buf, "fir-high", 8) == 0) { - ath5k_ani_set_firstep_level(ah, ATH5K_ANI_MAX_FIRSTEP_LVL); - } else if (strncmp(buf, "ofdm-off", 8) == 0) { - ath5k_ani_set_ofdm_weak_signal_detection(ah, false); - } else if (strncmp(buf, "ofdm-on", 7) == 0) { - ath5k_ani_set_ofdm_weak_signal_detection(ah, true); - } else if (strncmp(buf, "cck-off", 7) == 0) { - ath5k_ani_set_cck_weak_signal_detection(ah, false); - } else if (strncmp(buf, "cck-on", 6) == 0) { - ath5k_ani_set_cck_weak_signal_detection(ah, true); - } - return count; -} - -static const struct file_operations fops_ani = { - .read = read_file_ani, - .write = write_file_ani, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - - -/* debugfs: queues etc */ - -static ssize_t read_file_queue(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath5k_hw *ah = file->private_data; - char buf[700]; - unsigned int len = 0; - - struct ath5k_txq *txq; - struct ath5k_buf *bf, *bf0; - int i, n; - - len += snprintf(buf + len, sizeof(buf) - len, - "available txbuffers: %d\n", ah->txbuf_len); - - for (i = 0; i < ARRAY_SIZE(ah->txqs); i++) { - txq = &ah->txqs[i]; - - len += snprintf(buf + len, sizeof(buf) - len, - "%02d: %ssetup\n", i, txq->setup ? "" : "not "); - - if (!txq->setup) - continue; - - n = 0; - spin_lock_bh(&txq->lock); - list_for_each_entry_safe(bf, bf0, &txq->q, list) - n++; - spin_unlock_bh(&txq->lock); - - len += snprintf(buf + len, sizeof(buf) - len, - " len: %d bufs: %d\n", txq->txq_len, n); - len += snprintf(buf + len, sizeof(buf) - len, - " stuck: %d\n", txq->txq_stuck); - } - - if (len > sizeof(buf)) - len = sizeof(buf); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_queue(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct ath5k_hw *ah = file->private_data; - char buf[20]; - - if (copy_from_user(buf, userbuf, min(count, sizeof(buf)))) - return -EFAULT; - - if (strncmp(buf, "start", 5) == 0) - ieee80211_wake_queues(ah->hw); - else if (strncmp(buf, "stop", 4) == 0) - ieee80211_stop_queues(ah->hw); - - return count; -} - - -static const struct file_operations fops_queue = { - .read = read_file_queue, - .write = write_file_queue, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - - -void -ath5k_debug_init_device(struct ath5k_hw *ah) -{ - struct dentry *phydir; - - ah->debug.level = ath5k_debug; - - phydir = debugfs_create_dir("ath5k", ah->hw->wiphy->debugfsdir); - if (!phydir) - return; - - debugfs_create_file("debug", S_IWUSR | S_IRUSR, phydir, ah, - &fops_debug); - - debugfs_create_file("registers", S_IRUSR, phydir, ah, &fops_registers); - - debugfs_create_file("beacon", S_IWUSR | S_IRUSR, phydir, ah, - &fops_beacon); - - debugfs_create_file("reset", S_IWUSR, phydir, ah, &fops_reset); - - debugfs_create_file("antenna", S_IWUSR | S_IRUSR, phydir, ah, - &fops_antenna); - - debugfs_create_file("misc", S_IRUSR, phydir, ah, &fops_misc); - - debugfs_create_file("frameerrors", S_IWUSR | S_IRUSR, phydir, ah, - &fops_frameerrors); - - debugfs_create_file("ani", S_IWUSR | S_IRUSR, phydir, ah, &fops_ani); - - debugfs_create_file("queue", S_IWUSR | S_IRUSR, phydir, ah, - &fops_queue); - - debugfs_create_bool("32khz_clock", S_IWUSR | S_IRUSR, phydir, - &ah->ah_use_32khz_clock); -} - -/* functions used in other places */ - -void -ath5k_debug_dump_bands(struct ath5k_hw *ah) -{ - unsigned int b, i; - - if (likely(!(ah->debug.level & ATH5K_DEBUG_DUMPBANDS))) - return; - - BUG_ON(!ah->sbands); - - for (b = 0; b < IEEE80211_NUM_BANDS; b++) { - struct ieee80211_supported_band *band = &ah->sbands[b]; - char bname[6]; - switch (band->band) { - case IEEE80211_BAND_2GHZ: - strcpy(bname, "2 GHz"); - break; - case IEEE80211_BAND_5GHZ: - strcpy(bname, "5 GHz"); - break; - default: - printk(KERN_DEBUG "Band not supported: %d\n", - band->band); - return; - } - printk(KERN_DEBUG "Band %s: channels %d, rates %d\n", bname, - band->n_channels, band->n_bitrates); - printk(KERN_DEBUG " channels:\n"); - for (i = 0; i < band->n_channels; i++) - printk(KERN_DEBUG " %3d %d %.4x %.4x\n", - ieee80211_frequency_to_channel( - band->channels[i].center_freq), - band->channels[i].center_freq, - band->channels[i].hw_value, - band->channels[i].flags); - printk(KERN_DEBUG " rates:\n"); - for (i = 0; i < band->n_bitrates; i++) - printk(KERN_DEBUG " %4d %.4x %.4x %.4x\n", - band->bitrates[i].bitrate, - band->bitrates[i].hw_value, - band->bitrates[i].flags, - band->bitrates[i].hw_value_short); - } -} - -static inline void -ath5k_debug_printrxbuf(struct ath5k_buf *bf, int done, - struct ath5k_rx_status *rs) -{ - struct ath5k_desc *ds = bf->desc; - struct ath5k_hw_all_rx_desc *rd = &ds->ud.ds_rx; - - printk(KERN_DEBUG "R (%p %llx) %08x %08x %08x %08x %08x %08x %c\n", - ds, (unsigned long long)bf->daddr, - ds->ds_link, ds->ds_data, - rd->rx_ctl.rx_control_0, rd->rx_ctl.rx_control_1, - rd->rx_stat.rx_status_0, rd->rx_stat.rx_status_1, - !done ? ' ' : (rs->rs_status == 0) ? '*' : '!'); -} - -void -ath5k_debug_printrxbuffs(struct ath5k_hw *ah) -{ - struct ath5k_desc *ds; - struct ath5k_buf *bf; - struct ath5k_rx_status rs = {}; - int status; - - if (likely(!(ah->debug.level & ATH5K_DEBUG_DESC))) - return; - - printk(KERN_DEBUG "rxdp %x, rxlink %p\n", - ath5k_hw_get_rxdp(ah), ah->rxlink); - - spin_lock_bh(&ah->rxbuflock); - list_for_each_entry(bf, &ah->rxbuf, list) { - ds = bf->desc; - status = ah->ah_proc_rx_desc(ah, ds, &rs); - if (!status) - ath5k_debug_printrxbuf(bf, status == 0, &rs); - } - spin_unlock_bh(&ah->rxbuflock); -} - -void -ath5k_debug_printtxbuf(struct ath5k_hw *ah, struct ath5k_buf *bf) -{ - struct ath5k_desc *ds = bf->desc; - struct ath5k_hw_5212_tx_desc *td = &ds->ud.ds_tx5212; - struct ath5k_tx_status ts = {}; - int done; - - if (likely(!(ah->debug.level & ATH5K_DEBUG_DESC))) - return; - - done = ah->ah_proc_tx_desc(ah, bf->desc, &ts); - - printk(KERN_DEBUG "T (%p %llx) %08x %08x %08x %08x %08x %08x %08x " - "%08x %c\n", ds, (unsigned long long)bf->daddr, ds->ds_link, - ds->ds_data, td->tx_ctl.tx_control_0, td->tx_ctl.tx_control_1, - td->tx_ctl.tx_control_2, td->tx_ctl.tx_control_3, - td->tx_stat.tx_status_0, td->tx_stat.tx_status_1, - done ? ' ' : (ts.ts_status == 0) ? '*' : '!'); -} diff --git a/drivers/net/wireless/ath/ath5k/debug.h b/drivers/net/wireless/ath/ath5k/debug.h deleted file mode 100644 index 0a3f916a1ef3..000000000000 --- a/drivers/net/wireless/ath/ath5k/debug.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2007 Bruno Randolf - * - * This file is free software: you may copy, redistribute and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 2 of the License, or (at your - * option) any later version. - * - * This file 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, see . - * - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting - * Copyright (c) 2004-2005 Atheros Communications, Inc. - * Copyright (c) 2006 Devicescape Software, Inc. - * Copyright (c) 2007 Jiri Slaby - * Copyright (c) 2007 Luis R. Rodriguez - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any - * redistribution must be conditioned upon including a substantially - * similar Disclaimer requirement for further binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGES. - */ - -#ifndef _ATH5K_DEBUG_H -#define _ATH5K_DEBUG_H - -struct ath5k_hw; -struct sk_buff; -struct ath5k_buf; - -struct ath5k_dbg_info { - unsigned int level; /* debug level */ -}; - -/** - * enum ath5k_debug_level - ath5k debug level - * - * @ATH5K_DEBUG_RESET: reset processing - * @ATH5K_DEBUG_INTR: interrupt handling - * @ATH5K_DEBUG_MODE: mode init/setup - * @ATH5K_DEBUG_XMIT: basic xmit operation - * @ATH5K_DEBUG_BEACON: beacon handling - * @ATH5K_DEBUG_CALIBRATE: periodic calibration - * @ATH5K_DEBUG_TXPOWER: transmit power setting - * @ATH5K_DEBUG_LED: led management - * @ATH5K_DEBUG_DUMP_RX: print received skb content - * @ATH5K_DEBUG_DUMP_TX: print transmit skb content - * @ATH5K_DEBUG_DUMPBANDS: dump bands - * @ATH5K_DEBUG_DMA: debug dma start/stop - * @ATH5K_DEBUG_TRACE: trace function calls - * @ATH5K_DEBUG_DESC: descriptor setup - * @ATH5K_DEBUG_ANY: show at any debug level - * - * The debug level is used to control the amount and type of debugging output - * we want to see. The debug level is given in calls to ATH5K_DBG to specify - * where the message should appear, and the user can control the debugging - * messages he wants to see, either by the module parameter 'debug' on module - * load, or dynamically by using debugfs 'ath5k/phyX/debug'. these levels can - * be combined together by bitwise OR. - */ -enum ath5k_debug_level { - ATH5K_DEBUG_RESET = 0x00000001, - ATH5K_DEBUG_INTR = 0x00000002, - ATH5K_DEBUG_MODE = 0x00000004, - ATH5K_DEBUG_XMIT = 0x00000008, - ATH5K_DEBUG_BEACON = 0x00000010, - ATH5K_DEBUG_CALIBRATE = 0x00000020, - ATH5K_DEBUG_TXPOWER = 0x00000040, - ATH5K_DEBUG_LED = 0x00000080, - ATH5K_DEBUG_DUMPBANDS = 0x00000400, - ATH5K_DEBUG_DMA = 0x00000800, - ATH5K_DEBUG_ANI = 0x00002000, - ATH5K_DEBUG_DESC = 0x00004000, - ATH5K_DEBUG_ANY = 0xffffffff -}; - -#ifdef CONFIG_ATH5K_DEBUG - -#define ATH5K_DBG(_sc, _m, _fmt, ...) do { \ - if (unlikely((_sc)->debug.level & (_m) && net_ratelimit())) \ - ATH5K_PRINTK(_sc, KERN_DEBUG, "(%s:%d): " _fmt, \ - __func__, __LINE__, ##__VA_ARGS__); \ - } while (0) - -#define ATH5K_DBG_UNLIMIT(_sc, _m, _fmt, ...) do { \ - if (unlikely((_sc)->debug.level & (_m))) \ - ATH5K_PRINTK(_sc, KERN_DEBUG, "(%s:%d): " _fmt, \ - __func__, __LINE__, ##__VA_ARGS__); \ - } while (0) - -void -ath5k_debug_init_device(struct ath5k_hw *ah); - -void -ath5k_debug_printrxbuffs(struct ath5k_hw *ah); - -void -ath5k_debug_dump_bands(struct ath5k_hw *ah); - -void -ath5k_debug_printtxbuf(struct ath5k_hw *ah, struct ath5k_buf *bf); - -#else /* no debugging */ - -#include - -static inline __printf(3, 4) void -ATH5K_DBG(struct ath5k_hw *ah, unsigned int m, const char *fmt, ...) {} - -static inline __printf(3, 4) void -ATH5K_DBG_UNLIMIT(struct ath5k_hw *ah, unsigned int m, const char *fmt, ...) -{} - -static inline void -ath5k_debug_init_device(struct ath5k_hw *ah) {} - -static inline void -ath5k_debug_printrxbuffs(struct ath5k_hw *ah) {} - -static inline void -ath5k_debug_dump_bands(struct ath5k_hw *ah) {} - -static inline void -ath5k_debug_printtxbuf(struct ath5k_hw *ah, struct ath5k_buf *bf) {} - -#endif /* ifdef CONFIG_ATH5K_DEBUG */ - -#endif /* ifndef _ATH5K_DEBUG_H */ diff --git a/drivers/net/wireless/ath/ath5k/desc.c b/drivers/net/wireless/ath/ath5k/desc.c deleted file mode 100644 index bd8d4392d68b..000000000000 --- a/drivers/net/wireless/ath/ath5k/desc.c +++ /dev/null @@ -1,786 +0,0 @@ -/* - * Copyright (c) 2004-2008 Reyk Floeter - * Copyright (c) 2006-2008 Nick Kossifidis - * Copyright (c) 2007-2008 Pavel Roskin - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/******************************\ - Hardware Descriptor Functions -\******************************/ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include "ath5k.h" -#include "reg.h" -#include "debug.h" - - -/** - * DOC: Hardware descriptor functions - * - * Here we handle the processing of the low-level hw descriptors - * that hw reads and writes via DMA for each TX and RX attempt (that means - * we can also have descriptors for failed TX/RX tries). We have two kind of - * descriptors for RX and TX, control descriptors tell the hw how to send or - * receive a packet where to read/write it from/to etc and status descriptors - * that contain information about how the packet was sent or received (errors - * included). - * - * Descriptor format is not exactly the same for each MAC chip version so we - * have function pointers on &struct ath5k_hw we initialize at runtime based on - * the chip used. - */ - - -/************************\ -* TX Control descriptors * -\************************/ - -/** - * ath5k_hw_setup_2word_tx_desc() - Initialize a 2-word tx control descriptor - * @ah: The &struct ath5k_hw - * @desc: The &struct ath5k_desc - * @pkt_len: Frame length in bytes - * @hdr_len: Header length in bytes (only used on AR5210) - * @padsize: Any padding we've added to the frame length - * @type: One of enum ath5k_pkt_type - * @tx_power: Tx power in 0.5dB steps - * @tx_rate0: HW idx for transmission rate - * @tx_tries0: Max number of retransmissions - * @key_index: Index on key table to use for encryption - * @antenna_mode: Which antenna to use (0 for auto) - * @flags: One of AR5K_TXDESC_* flags (desc.h) - * @rtscts_rate: HW idx for RTS/CTS transmission rate - * @rtscts_duration: What to put on duration field on the header of RTS/CTS - * - * Internal function to initialize a 2-Word TX control descriptor - * found on AR5210 and AR5211 MACs chips. - * - * Returns 0 on success or -EINVAL on false input - */ -static int -ath5k_hw_setup_2word_tx_desc(struct ath5k_hw *ah, - struct ath5k_desc *desc, - unsigned int pkt_len, unsigned int hdr_len, - int padsize, - enum ath5k_pkt_type type, - unsigned int tx_power, - unsigned int tx_rate0, unsigned int tx_tries0, - unsigned int key_index, - unsigned int antenna_mode, - unsigned int flags, - unsigned int rtscts_rate, unsigned int rtscts_duration) -{ - u32 frame_type; - struct ath5k_hw_2w_tx_ctl *tx_ctl; - unsigned int frame_len; - - tx_ctl = &desc->ud.ds_tx5210.tx_ctl; - - /* - * Validate input - * - Zero retries don't make sense. - * - A zero rate will put the HW into a mode where it continuously sends - * noise on the channel, so it is important to avoid this. - */ - if (unlikely(tx_tries0 == 0)) { - ATH5K_ERR(ah, "zero retries\n"); - WARN_ON(1); - return -EINVAL; - } - if (unlikely(tx_rate0 == 0)) { - ATH5K_ERR(ah, "zero rate\n"); - WARN_ON(1); - return -EINVAL; - } - - /* Clear descriptor */ - memset(&desc->ud.ds_tx5210, 0, sizeof(struct ath5k_hw_5210_tx_desc)); - - /* Setup control descriptor */ - - /* Verify and set frame length */ - - /* remove padding we might have added before */ - frame_len = pkt_len - padsize + FCS_LEN; - - if (frame_len & ~AR5K_2W_TX_DESC_CTL0_FRAME_LEN) - return -EINVAL; - - tx_ctl->tx_control_0 = frame_len & AR5K_2W_TX_DESC_CTL0_FRAME_LEN; - - /* Verify and set buffer length */ - - /* NB: beacon's BufLen must be a multiple of 4 bytes */ - if (type == AR5K_PKT_TYPE_BEACON) - pkt_len = roundup(pkt_len, 4); - - if (pkt_len & ~AR5K_2W_TX_DESC_CTL1_BUF_LEN) - return -EINVAL; - - tx_ctl->tx_control_1 = pkt_len & AR5K_2W_TX_DESC_CTL1_BUF_LEN; - - /* - * Verify and set header length (only 5210) - */ - if (ah->ah_version == AR5K_AR5210) { - if (hdr_len & ~AR5K_2W_TX_DESC_CTL0_HEADER_LEN_5210) - return -EINVAL; - tx_ctl->tx_control_0 |= - AR5K_REG_SM(hdr_len, AR5K_2W_TX_DESC_CTL0_HEADER_LEN_5210); - } - - /*Differences between 5210-5211*/ - if (ah->ah_version == AR5K_AR5210) { - switch (type) { - case AR5K_PKT_TYPE_BEACON: - case AR5K_PKT_TYPE_PROBE_RESP: - frame_type = AR5K_AR5210_TX_DESC_FRAME_TYPE_NO_DELAY; - break; - case AR5K_PKT_TYPE_PIFS: - frame_type = AR5K_AR5210_TX_DESC_FRAME_TYPE_PIFS; - break; - default: - frame_type = type; - break; - } - - tx_ctl->tx_control_0 |= - AR5K_REG_SM(frame_type, AR5K_2W_TX_DESC_CTL0_FRAME_TYPE_5210) | - AR5K_REG_SM(tx_rate0, AR5K_2W_TX_DESC_CTL0_XMIT_RATE); - - } else { - tx_ctl->tx_control_0 |= - AR5K_REG_SM(tx_rate0, AR5K_2W_TX_DESC_CTL0_XMIT_RATE) | - AR5K_REG_SM(antenna_mode, - AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT); - tx_ctl->tx_control_1 |= - AR5K_REG_SM(type, AR5K_2W_TX_DESC_CTL1_FRAME_TYPE_5211); - } - -#define _TX_FLAGS(_c, _flag) \ - if (flags & AR5K_TXDESC_##_flag) { \ - tx_ctl->tx_control_##_c |= \ - AR5K_2W_TX_DESC_CTL##_c##_##_flag; \ - } -#define _TX_FLAGS_5211(_c, _flag) \ - if (flags & AR5K_TXDESC_##_flag) { \ - tx_ctl->tx_control_##_c |= \ - AR5K_2W_TX_DESC_CTL##_c##_##_flag##_5211; \ - } - _TX_FLAGS(0, CLRDMASK); - _TX_FLAGS(0, INTREQ); - _TX_FLAGS(0, RTSENA); - - if (ah->ah_version == AR5K_AR5211) { - _TX_FLAGS_5211(0, VEOL); - _TX_FLAGS_5211(1, NOACK); - } - -#undef _TX_FLAGS -#undef _TX_FLAGS_5211 - - /* - * WEP crap - */ - if (key_index != AR5K_TXKEYIX_INVALID) { - tx_ctl->tx_control_0 |= - AR5K_2W_TX_DESC_CTL0_ENCRYPT_KEY_VALID; - tx_ctl->tx_control_1 |= - AR5K_REG_SM(key_index, - AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX); - } - - /* - * RTS/CTS Duration [5210 ?] - */ - if ((ah->ah_version == AR5K_AR5210) && - (flags & (AR5K_TXDESC_RTSENA | AR5K_TXDESC_CTSENA))) - tx_ctl->tx_control_1 |= rtscts_duration & - AR5K_2W_TX_DESC_CTL1_RTS_DURATION_5210; - - return 0; -} - -/** - * ath5k_hw_setup_4word_tx_desc() - Initialize a 4-word tx control descriptor - * @ah: The &struct ath5k_hw - * @desc: The &struct ath5k_desc - * @pkt_len: Frame length in bytes - * @hdr_len: Header length in bytes (only used on AR5210) - * @padsize: Any padding we've added to the frame length - * @type: One of enum ath5k_pkt_type - * @tx_power: Tx power in 0.5dB steps - * @tx_rate0: HW idx for transmission rate - * @tx_tries0: Max number of retransmissions - * @key_index: Index on key table to use for encryption - * @antenna_mode: Which antenna to use (0 for auto) - * @flags: One of AR5K_TXDESC_* flags (desc.h) - * @rtscts_rate: HW idx for RTS/CTS transmission rate - * @rtscts_duration: What to put on duration field on the header of RTS/CTS - * - * Internal function to initialize a 4-Word TX control descriptor - * found on AR5212 and later MACs chips. - * - * Returns 0 on success or -EINVAL on false input - */ -static int -ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah, - struct ath5k_desc *desc, - unsigned int pkt_len, unsigned int hdr_len, - int padsize, - enum ath5k_pkt_type type, - unsigned int tx_power, - unsigned int tx_rate0, unsigned int tx_tries0, - unsigned int key_index, - unsigned int antenna_mode, - unsigned int flags, - unsigned int rtscts_rate, unsigned int rtscts_duration) -{ - struct ath5k_hw_4w_tx_ctl *tx_ctl; - unsigned int frame_len; - - /* - * Use local variables for these to reduce load/store access on - * uncached memory - */ - u32 txctl0 = 0, txctl1 = 0, txctl2 = 0, txctl3 = 0; - - tx_ctl = &desc->ud.ds_tx5212.tx_ctl; - - /* - * Validate input - * - Zero retries don't make sense. - * - A zero rate will put the HW into a mode where it continuously sends - * noise on the channel, so it is important to avoid this. - */ - if (unlikely(tx_tries0 == 0)) { - ATH5K_ERR(ah, "zero retries\n"); - WARN_ON(1); - return -EINVAL; - } - if (unlikely(tx_rate0 == 0)) { - ATH5K_ERR(ah, "zero rate\n"); - WARN_ON(1); - return -EINVAL; - } - - tx_power += ah->ah_txpower.txp_offset; - if (tx_power > AR5K_TUNE_MAX_TXPOWER) - tx_power = AR5K_TUNE_MAX_TXPOWER; - - /* Clear descriptor status area */ - memset(&desc->ud.ds_tx5212.tx_stat, 0, - sizeof(desc->ud.ds_tx5212.tx_stat)); - - /* Setup control descriptor */ - - /* Verify and set frame length */ - - /* remove padding we might have added before */ - frame_len = pkt_len - padsize + FCS_LEN; - - if (frame_len & ~AR5K_4W_TX_DESC_CTL0_FRAME_LEN) - return -EINVAL; - - txctl0 = frame_len & AR5K_4W_TX_DESC_CTL0_FRAME_LEN; - - /* Verify and set buffer length */ - - /* NB: beacon's BufLen must be a multiple of 4 bytes */ - if (type == AR5K_PKT_TYPE_BEACON) - pkt_len = roundup(pkt_len, 4); - - if (pkt_len & ~AR5K_4W_TX_DESC_CTL1_BUF_LEN) - return -EINVAL; - - txctl1 = pkt_len & AR5K_4W_TX_DESC_CTL1_BUF_LEN; - - txctl0 |= AR5K_REG_SM(tx_power, AR5K_4W_TX_DESC_CTL0_XMIT_POWER) | - AR5K_REG_SM(antenna_mode, AR5K_4W_TX_DESC_CTL0_ANT_MODE_XMIT); - txctl1 |= AR5K_REG_SM(type, AR5K_4W_TX_DESC_CTL1_FRAME_TYPE); - txctl2 = AR5K_REG_SM(tx_tries0, AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0); - txctl3 = tx_rate0 & AR5K_4W_TX_DESC_CTL3_XMIT_RATE0; - -#define _TX_FLAGS(_c, _flag) \ - if (flags & AR5K_TXDESC_##_flag) { \ - txctl##_c |= AR5K_4W_TX_DESC_CTL##_c##_##_flag; \ - } - - _TX_FLAGS(0, CLRDMASK); - _TX_FLAGS(0, VEOL); - _TX_FLAGS(0, INTREQ); - _TX_FLAGS(0, RTSENA); - _TX_FLAGS(0, CTSENA); - _TX_FLAGS(1, NOACK); - -#undef _TX_FLAGS - - /* - * WEP crap - */ - if (key_index != AR5K_TXKEYIX_INVALID) { - txctl0 |= AR5K_4W_TX_DESC_CTL0_ENCRYPT_KEY_VALID; - txctl1 |= AR5K_REG_SM(key_index, - AR5K_4W_TX_DESC_CTL1_ENCRYPT_KEY_IDX); - } - - /* - * RTS/CTS - */ - if (flags & (AR5K_TXDESC_RTSENA | AR5K_TXDESC_CTSENA)) { - if ((flags & AR5K_TXDESC_RTSENA) && - (flags & AR5K_TXDESC_CTSENA)) - return -EINVAL; - txctl2 |= rtscts_duration & AR5K_4W_TX_DESC_CTL2_RTS_DURATION; - txctl3 |= AR5K_REG_SM(rtscts_rate, - AR5K_4W_TX_DESC_CTL3_RTS_CTS_RATE); - } - - tx_ctl->tx_control_0 = txctl0; - tx_ctl->tx_control_1 = txctl1; - tx_ctl->tx_control_2 = txctl2; - tx_ctl->tx_control_3 = txctl3; - - return 0; -} - -/** - * ath5k_hw_setup_mrr_tx_desc() - Initialize an MRR tx control descriptor - * @ah: The &struct ath5k_hw - * @desc: The &struct ath5k_desc - * @tx_rate1: HW idx for rate used on transmission series 1 - * @tx_tries1: Max number of retransmissions for transmission series 1 - * @tx_rate2: HW idx for rate used on transmission series 2 - * @tx_tries2: Max number of retransmissions for transmission series 2 - * @tx_rate3: HW idx for rate used on transmission series 3 - * @tx_tries3: Max number of retransmissions for transmission series 3 - * - * Multi rate retry (MRR) tx control descriptors are available only on AR5212 - * MACs, they are part of the normal 4-word tx control descriptor (see above) - * but we handle them through a separate function for better abstraction. - * - * Returns 0 on success or -EINVAL on invalid input - */ -int -ath5k_hw_setup_mrr_tx_desc(struct ath5k_hw *ah, - struct ath5k_desc *desc, - u_int tx_rate1, u_int tx_tries1, - u_int tx_rate2, u_int tx_tries2, - u_int tx_rate3, u_int tx_tries3) -{ - struct ath5k_hw_4w_tx_ctl *tx_ctl; - - /* no mrr support for cards older than 5212 */ - if (ah->ah_version < AR5K_AR5212) - return 0; - - /* - * Rates can be 0 as long as the retry count is 0 too. - * A zero rate and nonzero retry count will put the HW into a mode where - * it continuously sends noise on the channel, so it is important to - * avoid this. - */ - if (unlikely((tx_rate1 == 0 && tx_tries1 != 0) || - (tx_rate2 == 0 && tx_tries2 != 0) || - (tx_rate3 == 0 && tx_tries3 != 0))) { - ATH5K_ERR(ah, "zero rate\n"); - WARN_ON(1); - return -EINVAL; - } - - if (ah->ah_version == AR5K_AR5212) { - tx_ctl = &desc->ud.ds_tx5212.tx_ctl; - -#define _XTX_TRIES(_n) \ - if (tx_tries##_n) { \ - tx_ctl->tx_control_2 |= \ - AR5K_REG_SM(tx_tries##_n, \ - AR5K_4W_TX_DESC_CTL2_XMIT_TRIES##_n); \ - tx_ctl->tx_control_3 |= \ - AR5K_REG_SM(tx_rate##_n, \ - AR5K_4W_TX_DESC_CTL3_XMIT_RATE##_n); \ - } - - _XTX_TRIES(1); - _XTX_TRIES(2); - _XTX_TRIES(3); - -#undef _XTX_TRIES - - return 1; - } - - return 0; -} - - -/***********************\ -* TX Status descriptors * -\***********************/ - -/** - * ath5k_hw_proc_2word_tx_status() - Process a tx status descriptor on 5210/1 - * @ah: The &struct ath5k_hw - * @desc: The &struct ath5k_desc - * @ts: The &struct ath5k_tx_status - */ -static int -ath5k_hw_proc_2word_tx_status(struct ath5k_hw *ah, - struct ath5k_desc *desc, - struct ath5k_tx_status *ts) -{ - struct ath5k_hw_tx_status *tx_status; - - tx_status = &desc->ud.ds_tx5210.tx_stat; - - /* No frame has been send or error */ - if (unlikely((tx_status->tx_status_1 & AR5K_DESC_TX_STATUS1_DONE) == 0)) - return -EINPROGRESS; - - /* - * Get descriptor status - */ - ts->ts_tstamp = AR5K_REG_MS(tx_status->tx_status_0, - AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP); - ts->ts_shortretry = AR5K_REG_MS(tx_status->tx_status_0, - AR5K_DESC_TX_STATUS0_SHORT_RETRY_COUNT); - ts->ts_final_retry = AR5K_REG_MS(tx_status->tx_status_0, - AR5K_DESC_TX_STATUS0_LONG_RETRY_COUNT); - /*TODO: ts->ts_virtcol + test*/ - ts->ts_seqnum = AR5K_REG_MS(tx_status->tx_status_1, - AR5K_DESC_TX_STATUS1_SEQ_NUM); - ts->ts_rssi = AR5K_REG_MS(tx_status->tx_status_1, - AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH); - ts->ts_antenna = 1; - ts->ts_status = 0; - ts->ts_final_idx = 0; - - if (!(tx_status->tx_status_0 & AR5K_DESC_TX_STATUS0_FRAME_XMIT_OK)) { - if (tx_status->tx_status_0 & - AR5K_DESC_TX_STATUS0_EXCESSIVE_RETRIES) - ts->ts_status |= AR5K_TXERR_XRETRY; - - if (tx_status->tx_status_0 & AR5K_DESC_TX_STATUS0_FIFO_UNDERRUN) - ts->ts_status |= AR5K_TXERR_FIFO; - - if (tx_status->tx_status_0 & AR5K_DESC_TX_STATUS0_FILTERED) - ts->ts_status |= AR5K_TXERR_FILT; - } - - return 0; -} - -/** - * ath5k_hw_proc_4word_tx_status() - Process a tx status descriptor on 5212 - * @ah: The &struct ath5k_hw - * @desc: The &struct ath5k_desc - * @ts: The &struct ath5k_tx_status - */ -static int -ath5k_hw_proc_4word_tx_status(struct ath5k_hw *ah, - struct ath5k_desc *desc, - struct ath5k_tx_status *ts) -{ - struct ath5k_hw_tx_status *tx_status; - u32 txstat0, txstat1; - - tx_status = &desc->ud.ds_tx5212.tx_stat; - - txstat1 = ACCESS_ONCE(tx_status->tx_status_1); - - /* No frame has been send or error */ - if (unlikely(!(txstat1 & AR5K_DESC_TX_STATUS1_DONE))) - return -EINPROGRESS; - - txstat0 = ACCESS_ONCE(tx_status->tx_status_0); - - /* - * Get descriptor status - */ - ts->ts_tstamp = AR5K_REG_MS(txstat0, - AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP); - ts->ts_shortretry = AR5K_REG_MS(txstat0, - AR5K_DESC_TX_STATUS0_SHORT_RETRY_COUNT); - ts->ts_final_retry = AR5K_REG_MS(txstat0, - AR5K_DESC_TX_STATUS0_LONG_RETRY_COUNT); - ts->ts_seqnum = AR5K_REG_MS(txstat1, - AR5K_DESC_TX_STATUS1_SEQ_NUM); - ts->ts_rssi = AR5K_REG_MS(txstat1, - AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH); - ts->ts_antenna = (txstat1 & - AR5K_DESC_TX_STATUS1_XMIT_ANTENNA_5212) ? 2 : 1; - ts->ts_status = 0; - - ts->ts_final_idx = AR5K_REG_MS(txstat1, - AR5K_DESC_TX_STATUS1_FINAL_TS_IX_5212); - - /* TX error */ - if (!(txstat0 & AR5K_DESC_TX_STATUS0_FRAME_XMIT_OK)) { - if (txstat0 & AR5K_DESC_TX_STATUS0_EXCESSIVE_RETRIES) - ts->ts_status |= AR5K_TXERR_XRETRY; - - if (txstat0 & AR5K_DESC_TX_STATUS0_FIFO_UNDERRUN) - ts->ts_status |= AR5K_TXERR_FIFO; - - if (txstat0 & AR5K_DESC_TX_STATUS0_FILTERED) - ts->ts_status |= AR5K_TXERR_FILT; - } - - return 0; -} - - -/****************\ -* RX Descriptors * -\****************/ - -/** - * ath5k_hw_setup_rx_desc() - Initialize an rx control descriptor - * @ah: The &struct ath5k_hw - * @desc: The &struct ath5k_desc - * @size: RX buffer length in bytes - * @flags: One of AR5K_RXDESC_* flags - */ -int -ath5k_hw_setup_rx_desc(struct ath5k_hw *ah, - struct ath5k_desc *desc, - u32 size, unsigned int flags) -{ - struct ath5k_hw_rx_ctl *rx_ctl; - - rx_ctl = &desc->ud.ds_rx.rx_ctl; - - /* - * Clear the descriptor - * If we don't clean the status descriptor, - * while scanning we get too many results, - * most of them virtual, after some secs - * of scanning system hangs. M.F. - */ - memset(&desc->ud.ds_rx, 0, sizeof(struct ath5k_hw_all_rx_desc)); - - if (unlikely(size & ~AR5K_DESC_RX_CTL1_BUF_LEN)) - return -EINVAL; - - /* Setup descriptor */ - rx_ctl->rx_control_1 = size & AR5K_DESC_RX_CTL1_BUF_LEN; - - if (flags & AR5K_RXDESC_INTREQ) - rx_ctl->rx_control_1 |= AR5K_DESC_RX_CTL1_INTREQ; - - return 0; -} - -/** - * ath5k_hw_proc_5210_rx_status() - Process the rx status descriptor on 5210/1 - * @ah: The &struct ath5k_hw - * @desc: The &struct ath5k_desc - * @rs: The &struct ath5k_rx_status - * - * Internal function used to process an RX status descriptor - * on AR5210/5211 MAC. - * - * Returns 0 on success or -EINPROGRESS in case we haven't received the who;e - * frame yet. - */ -static int -ath5k_hw_proc_5210_rx_status(struct ath5k_hw *ah, - struct ath5k_desc *desc, - struct ath5k_rx_status *rs) -{ - struct ath5k_hw_rx_status *rx_status; - - rx_status = &desc->ud.ds_rx.rx_stat; - - /* No frame received / not ready */ - if (unlikely(!(rx_status->rx_status_1 & - AR5K_5210_RX_DESC_STATUS1_DONE))) - return -EINPROGRESS; - - memset(rs, 0, sizeof(struct ath5k_rx_status)); - - /* - * Frame receive status - */ - rs->rs_datalen = rx_status->rx_status_0 & - AR5K_5210_RX_DESC_STATUS0_DATA_LEN; - rs->rs_rssi = AR5K_REG_MS(rx_status->rx_status_0, - AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL); - rs->rs_rate = AR5K_REG_MS(rx_status->rx_status_0, - AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE); - rs->rs_more = !!(rx_status->rx_status_0 & - AR5K_5210_RX_DESC_STATUS0_MORE); - /* TODO: this timestamp is 13 bit, later on we assume 15 bit! - * also the HAL code for 5210 says the timestamp is bits [10..22] of the - * TSF, and extends the timestamp here to 15 bit. - * we need to check on 5210... - */ - rs->rs_tstamp = AR5K_REG_MS(rx_status->rx_status_1, - AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP); - - if (ah->ah_version == AR5K_AR5211) - rs->rs_antenna = AR5K_REG_MS(rx_status->rx_status_0, - AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5211); - else - rs->rs_antenna = (rx_status->rx_status_0 & - AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5210) - ? 2 : 1; - - /* - * Key table status - */ - if (rx_status->rx_status_1 & AR5K_5210_RX_DESC_STATUS1_KEY_INDEX_VALID) - rs->rs_keyix = AR5K_REG_MS(rx_status->rx_status_1, - AR5K_5210_RX_DESC_STATUS1_KEY_INDEX); - else - rs->rs_keyix = AR5K_RXKEYIX_INVALID; - - /* - * Receive/descriptor errors - */ - if (!(rx_status->rx_status_1 & - AR5K_5210_RX_DESC_STATUS1_FRAME_RECEIVE_OK)) { - if (rx_status->rx_status_1 & - AR5K_5210_RX_DESC_STATUS1_CRC_ERROR) - rs->rs_status |= AR5K_RXERR_CRC; - - /* only on 5210 */ - if ((ah->ah_version == AR5K_AR5210) && - (rx_status->rx_status_1 & - AR5K_5210_RX_DESC_STATUS1_FIFO_OVERRUN_5210)) - rs->rs_status |= AR5K_RXERR_FIFO; - - if (rx_status->rx_status_1 & - AR5K_5210_RX_DESC_STATUS1_PHY_ERROR) { - rs->rs_status |= AR5K_RXERR_PHY; - rs->rs_phyerr = AR5K_REG_MS(rx_status->rx_status_1, - AR5K_5210_RX_DESC_STATUS1_PHY_ERROR); - } - - if (rx_status->rx_status_1 & - AR5K_5210_RX_DESC_STATUS1_DECRYPT_CRC_ERROR) - rs->rs_status |= AR5K_RXERR_DECRYPT; - } - - return 0; -} - -/** - * ath5k_hw_proc_5212_rx_status() - Process the rx status descriptor on 5212 - * @ah: The &struct ath5k_hw - * @desc: The &struct ath5k_desc - * @rs: The &struct ath5k_rx_status - * - * Internal function used to process an RX status descriptor - * on AR5212 and later MAC. - * - * Returns 0 on success or -EINPROGRESS in case we haven't received the who;e - * frame yet. - */ -static int -ath5k_hw_proc_5212_rx_status(struct ath5k_hw *ah, - struct ath5k_desc *desc, - struct ath5k_rx_status *rs) -{ - struct ath5k_hw_rx_status *rx_status; - u32 rxstat0, rxstat1; - - rx_status = &desc->ud.ds_rx.rx_stat; - rxstat1 = ACCESS_ONCE(rx_status->rx_status_1); - - /* No frame received / not ready */ - if (unlikely(!(rxstat1 & AR5K_5212_RX_DESC_STATUS1_DONE))) - return -EINPROGRESS; - - memset(rs, 0, sizeof(struct ath5k_rx_status)); - rxstat0 = ACCESS_ONCE(rx_status->rx_status_0); - - /* - * Frame receive status - */ - rs->rs_datalen = rxstat0 & AR5K_5212_RX_DESC_STATUS0_DATA_LEN; - rs->rs_rssi = AR5K_REG_MS(rxstat0, - AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL); - rs->rs_rate = AR5K_REG_MS(rxstat0, - AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE); - rs->rs_antenna = AR5K_REG_MS(rxstat0, - AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA); - rs->rs_more = !!(rxstat0 & AR5K_5212_RX_DESC_STATUS0_MORE); - rs->rs_tstamp = AR5K_REG_MS(rxstat1, - AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP); - - /* - * Key table status - */ - if (rxstat1 & AR5K_5212_RX_DESC_STATUS1_KEY_INDEX_VALID) - rs->rs_keyix = AR5K_REG_MS(rxstat1, - AR5K_5212_RX_DESC_STATUS1_KEY_INDEX); - else - rs->rs_keyix = AR5K_RXKEYIX_INVALID; - - /* - * Receive/descriptor errors - */ - if (!(rxstat1 & AR5K_5212_RX_DESC_STATUS1_FRAME_RECEIVE_OK)) { - if (rxstat1 & AR5K_5212_RX_DESC_STATUS1_CRC_ERROR) - rs->rs_status |= AR5K_RXERR_CRC; - - if (rxstat1 & AR5K_5212_RX_DESC_STATUS1_PHY_ERROR) { - rs->rs_status |= AR5K_RXERR_PHY; - rs->rs_phyerr = AR5K_REG_MS(rxstat1, - AR5K_5212_RX_DESC_STATUS1_PHY_ERROR_CODE); - if (!ah->ah_capabilities.cap_has_phyerr_counters) - ath5k_ani_phy_error_report(ah, rs->rs_phyerr); - } - - if (rxstat1 & AR5K_5212_RX_DESC_STATUS1_DECRYPT_CRC_ERROR) - rs->rs_status |= AR5K_RXERR_DECRYPT; - - if (rxstat1 & AR5K_5212_RX_DESC_STATUS1_MIC_ERROR) - rs->rs_status |= AR5K_RXERR_MIC; - } - return 0; -} - - -/********\ -* Attach * -\********/ - -/** - * ath5k_hw_init_desc_functions() - Init function pointers inside ah - * @ah: The &struct ath5k_hw - * - * Maps the internal descriptor functions to the function pointers on ah, used - * from above. This is used as an abstraction layer to handle the various chips - * the same way. - */ -int -ath5k_hw_init_desc_functions(struct ath5k_hw *ah) -{ - if (ah->ah_version == AR5K_AR5212) { - ah->ah_setup_tx_desc = ath5k_hw_setup_4word_tx_desc; - ah->ah_proc_tx_desc = ath5k_hw_proc_4word_tx_status; - ah->ah_proc_rx_desc = ath5k_hw_proc_5212_rx_status; - } else if (ah->ah_version <= AR5K_AR5211) { - ah->ah_setup_tx_desc = ath5k_hw_setup_2word_tx_desc; - ah->ah_proc_tx_desc = ath5k_hw_proc_2word_tx_status; - ah->ah_proc_rx_desc = ath5k_hw_proc_5210_rx_status; - } else - return -ENOTSUPP; - return 0; -} diff --git a/drivers/net/wireless/ath/ath5k/desc.h b/drivers/net/wireless/ath/ath5k/desc.h deleted file mode 100644 index 8d6c01a49ea3..000000000000 --- a/drivers/net/wireless/ath/ath5k/desc.h +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Copyright (c) 2004-2008 Reyk Floeter - * Copyright (c) 2006-2008 Nick Kossifidis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* - * RX/TX descriptor structures - */ - -/** - * struct ath5k_hw_rx_ctl - Common hardware RX control descriptor - * @rx_control_0: RX control word 0 - * @rx_control_1: RX control word 1 - */ -struct ath5k_hw_rx_ctl { - u32 rx_control_0; - u32 rx_control_1; -} __packed __aligned(4); - -/* RX control word 1 fields/flags */ -#define AR5K_DESC_RX_CTL1_BUF_LEN 0x00000fff /* data buffer length */ -#define AR5K_DESC_RX_CTL1_INTREQ 0x00002000 /* RX interrupt request */ - -/** - * struct ath5k_hw_rx_status - Common hardware RX status descriptor - * @rx_status_0: RX status word 0 - * @rx_status_1: RX status word 1 - * - * 5210, 5211 and 5212 differ only in the fields and flags defined below - */ -struct ath5k_hw_rx_status { - u32 rx_status_0; - u32 rx_status_1; -} __packed __aligned(4); - -/* 5210/5211 */ -/* RX status word 0 fields/flags */ -#define AR5K_5210_RX_DESC_STATUS0_DATA_LEN 0x00000fff /* RX data length */ -#define AR5K_5210_RX_DESC_STATUS0_MORE 0x00001000 /* more desc for this frame */ -#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5210 0x00004000 /* [5210] receive on ant 1 */ -#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE 0x00078000 /* reception rate */ -#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE_S 15 -#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL 0x07f80000 /* rssi */ -#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL_S 19 -#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5211 0x38000000 /* [5211] receive antenna */ -#define AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5211_S 27 - -/* RX status word 1 fields/flags */ -#define AR5K_5210_RX_DESC_STATUS1_DONE 0x00000001 /* descriptor complete */ -#define AR5K_5210_RX_DESC_STATUS1_FRAME_RECEIVE_OK 0x00000002 /* reception success */ -#define AR5K_5210_RX_DESC_STATUS1_CRC_ERROR 0x00000004 /* CRC error */ -#define AR5K_5210_RX_DESC_STATUS1_FIFO_OVERRUN_5210 0x00000008 /* [5210] FIFO overrun */ -#define AR5K_5210_RX_DESC_STATUS1_DECRYPT_CRC_ERROR 0x00000010 /* decryption CRC failure */ -#define AR5K_5210_RX_DESC_STATUS1_PHY_ERROR 0x000000e0 /* PHY error */ -#define AR5K_5210_RX_DESC_STATUS1_PHY_ERROR_S 5 -#define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX_VALID 0x00000100 /* key index valid */ -#define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX 0x00007e00 /* decryption key index */ -#define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX_S 9 -#define AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP 0x0fff8000 /* 13 bit of TSF */ -#define AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP_S 15 -#define AR5K_5210_RX_DESC_STATUS1_KEY_CACHE_MISS 0x10000000 /* key cache miss */ - -/* 5212 */ -/* RX status word 0 fields/flags */ -#define AR5K_5212_RX_DESC_STATUS0_DATA_LEN 0x00000fff /* RX data length */ -#define AR5K_5212_RX_DESC_STATUS0_MORE 0x00001000 /* more desc for this frame */ -#define AR5K_5212_RX_DESC_STATUS0_DECOMP_CRC_ERROR 0x00002000 /* decompression CRC error */ -#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE 0x000f8000 /* reception rate */ -#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE_S 15 -#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL 0x0ff00000 /* rssi */ -#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL_S 20 -#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA 0xf0000000 /* receive antenna */ -#define AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA_S 28 - -/* RX status word 1 fields/flags */ -#define AR5K_5212_RX_DESC_STATUS1_DONE 0x00000001 /* descriptor complete */ -#define AR5K_5212_RX_DESC_STATUS1_FRAME_RECEIVE_OK 0x00000002 /* frame reception success */ -#define AR5K_5212_RX_DESC_STATUS1_CRC_ERROR 0x00000004 /* CRC error */ -#define AR5K_5212_RX_DESC_STATUS1_DECRYPT_CRC_ERROR 0x00000008 /* decryption CRC failure */ -#define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR 0x00000010 /* PHY error */ -#define AR5K_5212_RX_DESC_STATUS1_MIC_ERROR 0x00000020 /* MIC decrypt error */ -#define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX_VALID 0x00000100 /* key index valid */ -#define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX 0x0000fe00 /* decryption key index */ -#define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX_S 9 -#define AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP 0x7fff0000 /* first 15bit of the TSF */ -#define AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP_S 16 -#define AR5K_5212_RX_DESC_STATUS1_KEY_CACHE_MISS 0x80000000 /* key cache miss */ -#define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR_CODE 0x0000ff00 /* phy error code overlays key index and valid fields */ -#define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR_CODE_S 8 - -/** - * enum ath5k_phy_error_code - PHY Error codes - * @AR5K_RX_PHY_ERROR_UNDERRUN: Transmit underrun, [5210] No error - * @AR5K_RX_PHY_ERROR_TIMING: Timing error - * @AR5K_RX_PHY_ERROR_PARITY: Illegal parity - * @AR5K_RX_PHY_ERROR_RATE: Illegal rate - * @AR5K_RX_PHY_ERROR_LENGTH: Illegal length - * @AR5K_RX_PHY_ERROR_RADAR: Radar detect, [5210] 64 QAM rate - * @AR5K_RX_PHY_ERROR_SERVICE: Illegal service - * @AR5K_RX_PHY_ERROR_TOR: Transmit override receive - * @AR5K_RX_PHY_ERROR_OFDM_TIMING: OFDM Timing error [5212+] - * @AR5K_RX_PHY_ERROR_OFDM_SIGNAL_PARITY: OFDM Signal parity error [5212+] - * @AR5K_RX_PHY_ERROR_OFDM_RATE_ILLEGAL: OFDM Illegal rate [5212+] - * @AR5K_RX_PHY_ERROR_OFDM_LENGTH_ILLEGAL: OFDM Illegal length [5212+] - * @AR5K_RX_PHY_ERROR_OFDM_POWER_DROP: OFDM Power drop [5212+] - * @AR5K_RX_PHY_ERROR_OFDM_SERVICE: OFDM Service (?) [5212+] - * @AR5K_RX_PHY_ERROR_OFDM_RESTART: OFDM Restart (?) [5212+] - * @AR5K_RX_PHY_ERROR_CCK_TIMING: CCK Timing error [5212+] - * @AR5K_RX_PHY_ERROR_CCK_HEADER_CRC: Header CRC error [5212+] - * @AR5K_RX_PHY_ERROR_CCK_RATE_ILLEGAL: Illegal rate [5212+] - * @AR5K_RX_PHY_ERROR_CCK_SERVICE: CCK Service (?) [5212+] - * @AR5K_RX_PHY_ERROR_CCK_RESTART: CCK Restart (?) [5212+] - */ -enum ath5k_phy_error_code { - AR5K_RX_PHY_ERROR_UNDERRUN = 0, - AR5K_RX_PHY_ERROR_TIMING = 1, - AR5K_RX_PHY_ERROR_PARITY = 2, - AR5K_RX_PHY_ERROR_RATE = 3, - AR5K_RX_PHY_ERROR_LENGTH = 4, - AR5K_RX_PHY_ERROR_RADAR = 5, - AR5K_RX_PHY_ERROR_SERVICE = 6, - AR5K_RX_PHY_ERROR_TOR = 7, - AR5K_RX_PHY_ERROR_OFDM_TIMING = 17, - AR5K_RX_PHY_ERROR_OFDM_SIGNAL_PARITY = 18, - AR5K_RX_PHY_ERROR_OFDM_RATE_ILLEGAL = 19, - AR5K_RX_PHY_ERROR_OFDM_LENGTH_ILLEGAL = 20, - AR5K_RX_PHY_ERROR_OFDM_POWER_DROP = 21, - AR5K_RX_PHY_ERROR_OFDM_SERVICE = 22, - AR5K_RX_PHY_ERROR_OFDM_RESTART = 23, - AR5K_RX_PHY_ERROR_CCK_TIMING = 25, - AR5K_RX_PHY_ERROR_CCK_HEADER_CRC = 26, - AR5K_RX_PHY_ERROR_CCK_RATE_ILLEGAL = 27, - AR5K_RX_PHY_ERROR_CCK_SERVICE = 30, - AR5K_RX_PHY_ERROR_CCK_RESTART = 31, -}; - -/** - * struct ath5k_hw_2w_tx_ctl - 5210/5211 hardware 2-word TX control descriptor - * @tx_control_0: TX control word 0 - * @tx_control_1: TX control word 1 - */ -struct ath5k_hw_2w_tx_ctl { - u32 tx_control_0; - u32 tx_control_1; -} __packed __aligned(4); - -/* TX control word 0 fields/flags */ -#define AR5K_2W_TX_DESC_CTL0_FRAME_LEN 0x00000fff /* frame length */ -#define AR5K_2W_TX_DESC_CTL0_HEADER_LEN_5210 0x0003f000 /* [5210] header length */ -#define AR5K_2W_TX_DESC_CTL0_HEADER_LEN_5210_S 12 -#define AR5K_2W_TX_DESC_CTL0_XMIT_RATE 0x003c0000 /* tx rate */ -#define AR5K_2W_TX_DESC_CTL0_XMIT_RATE_S 18 -#define AR5K_2W_TX_DESC_CTL0_RTSENA 0x00400000 /* RTS/CTS enable */ -#define AR5K_2W_TX_DESC_CTL0_LONG_PACKET_5210 0x00800000 /* [5210] long packet */ -#define AR5K_2W_TX_DESC_CTL0_VEOL_5211 0x00800000 /* [5211] virtual end-of-list */ -#define AR5K_2W_TX_DESC_CTL0_CLRDMASK 0x01000000 /* clear destination mask */ -#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5210 0x02000000 /* [5210] antenna selection */ -#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5211 0x1e000000 /* [5211] antenna selection */ -#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT \ - (ah->ah_version == AR5K_AR5210 ? \ - AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5210 : \ - AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5211) -#define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_S 25 -#define AR5K_2W_TX_DESC_CTL0_FRAME_TYPE_5210 0x1c000000 /* [5210] frame type */ -#define AR5K_2W_TX_DESC_CTL0_FRAME_TYPE_5210_S 26 -#define AR5K_2W_TX_DESC_CTL0_INTREQ 0x20000000 /* TX interrupt request */ -#define AR5K_2W_TX_DESC_CTL0_ENCRYPT_KEY_VALID 0x40000000 /* key is valid */ - -/* TX control word 1 fields/flags */ -#define AR5K_2W_TX_DESC_CTL1_BUF_LEN 0x00000fff /* data buffer length */ -#define AR5K_2W_TX_DESC_CTL1_MORE 0x00001000 /* more desc for this frame */ -#define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5210 0x0007e000 /* [5210] key table index */ -#define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5211 0x000fe000 /* [5211] key table index */ -#define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX \ - (ah->ah_version == AR5K_AR5210 ? \ - AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5210 : \ - AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5211) -#define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_S 13 -#define AR5K_2W_TX_DESC_CTL1_FRAME_TYPE_5211 0x00700000 /* [5211] frame type */ -#define AR5K_2W_TX_DESC_CTL1_FRAME_TYPE_5211_S 20 -#define AR5K_2W_TX_DESC_CTL1_NOACK_5211 0x00800000 /* [5211] no ACK */ -#define AR5K_2W_TX_DESC_CTL1_RTS_DURATION_5210 0xfff80000 /* [5210] lower 13 bit of duration */ - -/* Frame types */ -#define AR5K_AR5210_TX_DESC_FRAME_TYPE_NORMAL 0 -#define AR5K_AR5210_TX_DESC_FRAME_TYPE_ATIM 1 -#define AR5K_AR5210_TX_DESC_FRAME_TYPE_PSPOLL 2 -#define AR5K_AR5210_TX_DESC_FRAME_TYPE_NO_DELAY 3 -#define AR5K_AR5211_TX_DESC_FRAME_TYPE_BEACON 3 -#define AR5K_AR5210_TX_DESC_FRAME_TYPE_PIFS 4 -#define AR5K_AR5211_TX_DESC_FRAME_TYPE_PRESP 4 - -/** - * struct ath5k_hw_4w_tx_ctl - 5212 hardware 4-word TX control descriptor - * @tx_control_0: TX control word 0 - * @tx_control_1: TX control word 1 - * @tx_control_2: TX control word 2 - * @tx_control_3: TX control word 3 - */ -struct ath5k_hw_4w_tx_ctl { - u32 tx_control_0; - u32 tx_control_1; - u32 tx_control_2; - u32 tx_control_3; -} __packed __aligned(4); - -/* TX control word 0 fields/flags */ -#define AR5K_4W_TX_DESC_CTL0_FRAME_LEN 0x00000fff /* frame length */ -#define AR5K_4W_TX_DESC_CTL0_XMIT_POWER 0x003f0000 /* transmit power */ -#define AR5K_4W_TX_DESC_CTL0_XMIT_POWER_S 16 -#define AR5K_4W_TX_DESC_CTL0_RTSENA 0x00400000 /* RTS/CTS enable */ -#define AR5K_4W_TX_DESC_CTL0_VEOL 0x00800000 /* virtual end-of-list */ -#define AR5K_4W_TX_DESC_CTL0_CLRDMASK 0x01000000 /* clear destination mask */ -#define AR5K_4W_TX_DESC_CTL0_ANT_MODE_XMIT 0x1e000000 /* TX antenna selection */ -#define AR5K_4W_TX_DESC_CTL0_ANT_MODE_XMIT_S 25 -#define AR5K_4W_TX_DESC_CTL0_INTREQ 0x20000000 /* TX interrupt request */ -#define AR5K_4W_TX_DESC_CTL0_ENCRYPT_KEY_VALID 0x40000000 /* destination index valid */ -#define AR5K_4W_TX_DESC_CTL0_CTSENA 0x80000000 /* precede frame with CTS */ - -/* TX control word 1 fields/flags */ -#define AR5K_4W_TX_DESC_CTL1_BUF_LEN 0x00000fff /* data buffer length */ -#define AR5K_4W_TX_DESC_CTL1_MORE 0x00001000 /* more desc for this frame */ -#define AR5K_4W_TX_DESC_CTL1_ENCRYPT_KEY_IDX 0x000fe000 /* destination table index */ -#define AR5K_4W_TX_DESC_CTL1_ENCRYPT_KEY_IDX_S 13 -#define AR5K_4W_TX_DESC_CTL1_FRAME_TYPE 0x00f00000 /* frame type */ -#define AR5K_4W_TX_DESC_CTL1_FRAME_TYPE_S 20 -#define AR5K_4W_TX_DESC_CTL1_NOACK 0x01000000 /* no ACK */ -#define AR5K_4W_TX_DESC_CTL1_COMP_PROC 0x06000000 /* compression processing */ -#define AR5K_4W_TX_DESC_CTL1_COMP_PROC_S 25 -#define AR5K_4W_TX_DESC_CTL1_COMP_IV_LEN 0x18000000 /* length of frame IV */ -#define AR5K_4W_TX_DESC_CTL1_COMP_IV_LEN_S 27 -#define AR5K_4W_TX_DESC_CTL1_COMP_ICV_LEN 0x60000000 /* length of frame ICV */ -#define AR5K_4W_TX_DESC_CTL1_COMP_ICV_LEN_S 29 - -/* TX control word 2 fields/flags */ -#define AR5K_4W_TX_DESC_CTL2_RTS_DURATION 0x00007fff /* RTS/CTS duration */ -#define AR5K_4W_TX_DESC_CTL2_DURATION_UPD_EN 0x00008000 /* frame duration update */ -#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0 0x000f0000 /* series 0 max attempts */ -#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0_S 16 -#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES1 0x00f00000 /* series 1 max attempts */ -#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES1_S 20 -#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES2 0x0f000000 /* series 2 max attempts */ -#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES2_S 24 -#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES3 0xf0000000 /* series 3 max attempts */ -#define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES3_S 28 - -/* TX control word 3 fields/flags */ -#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE0 0x0000001f /* series 0 tx rate */ -#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE1 0x000003e0 /* series 1 tx rate */ -#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE1_S 5 -#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE2 0x00007c00 /* series 2 tx rate */ -#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE2_S 10 -#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE3 0x000f8000 /* series 3 tx rate */ -#define AR5K_4W_TX_DESC_CTL3_XMIT_RATE3_S 15 -#define AR5K_4W_TX_DESC_CTL3_RTS_CTS_RATE 0x01f00000 /* RTS or CTS rate */ -#define AR5K_4W_TX_DESC_CTL3_RTS_CTS_RATE_S 20 - -/** - * struct ath5k_hw_tx_status - Common TX status descriptor - * @tx_status_0: TX status word 0 - * @tx_status_1: TX status word 1 - */ -struct ath5k_hw_tx_status { - u32 tx_status_0; - u32 tx_status_1; -} __packed __aligned(4); - -/* TX status word 0 fields/flags */ -#define AR5K_DESC_TX_STATUS0_FRAME_XMIT_OK 0x00000001 /* TX success */ -#define AR5K_DESC_TX_STATUS0_EXCESSIVE_RETRIES 0x00000002 /* excessive retries */ -#define AR5K_DESC_TX_STATUS0_FIFO_UNDERRUN 0x00000004 /* FIFO underrun */ -#define AR5K_DESC_TX_STATUS0_FILTERED 0x00000008 /* TX filter indication */ -/* according to the HAL sources the spec has short/long retry counts reversed. - * we have it reversed to the HAL sources as well, for 5210 and 5211. - * For 5212 these fields are defined as RTS_FAIL_COUNT and DATA_FAIL_COUNT, - * but used respectively as SHORT and LONG retry count in the code later. This - * is consistent with the definitions here... TODO: check */ -#define AR5K_DESC_TX_STATUS0_SHORT_RETRY_COUNT 0x000000f0 /* short retry count */ -#define AR5K_DESC_TX_STATUS0_SHORT_RETRY_COUNT_S 4 -#define AR5K_DESC_TX_STATUS0_LONG_RETRY_COUNT 0x00000f00 /* long retry count */ -#define AR5K_DESC_TX_STATUS0_LONG_RETRY_COUNT_S 8 -#define AR5K_DESC_TX_STATUS0_VIRTCOLL_CT_5211 0x0000f000 /* [5211+] virtual collision count */ -#define AR5K_DESC_TX_STATUS0_VIRTCOLL_CT_5212_S 12 -#define AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP 0xffff0000 /* TX timestamp */ -#define AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP_S 16 - -/* TX status word 1 fields/flags */ -#define AR5K_DESC_TX_STATUS1_DONE 0x00000001 /* descriptor complete */ -#define AR5K_DESC_TX_STATUS1_SEQ_NUM 0x00001ffe /* TX sequence number */ -#define AR5K_DESC_TX_STATUS1_SEQ_NUM_S 1 -#define AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH 0x001fe000 /* signal strength of ACK */ -#define AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH_S 13 -#define AR5K_DESC_TX_STATUS1_FINAL_TS_IX_5212 0x00600000 /* [5212] final TX attempt series ix */ -#define AR5K_DESC_TX_STATUS1_FINAL_TS_IX_5212_S 21 -#define AR5K_DESC_TX_STATUS1_COMP_SUCCESS_5212 0x00800000 /* [5212] compression status */ -#define AR5K_DESC_TX_STATUS1_XMIT_ANTENNA_5212 0x01000000 /* [5212] transmit antenna */ - -/** - * struct ath5k_hw_5210_tx_desc - 5210/5211 hardware TX descriptor - * @tx_ctl: The &struct ath5k_hw_2w_tx_ctl - * @tx_stat: The &struct ath5k_hw_tx_status - */ -struct ath5k_hw_5210_tx_desc { - struct ath5k_hw_2w_tx_ctl tx_ctl; - struct ath5k_hw_tx_status tx_stat; -} __packed __aligned(4); - -/** - * struct ath5k_hw_5212_tx_desc - 5212 hardware TX descriptor - * @tx_ctl: The &struct ath5k_hw_4w_tx_ctl - * @tx_stat: The &struct ath5k_hw_tx_status - */ -struct ath5k_hw_5212_tx_desc { - struct ath5k_hw_4w_tx_ctl tx_ctl; - struct ath5k_hw_tx_status tx_stat; -} __packed __aligned(4); - -/** - * struct ath5k_hw_all_rx_desc - Common hardware RX descriptor - * @rx_ctl: The &struct ath5k_hw_rx_ctl - * @rx_stat: The &struct ath5k_hw_rx_status - */ -struct ath5k_hw_all_rx_desc { - struct ath5k_hw_rx_ctl rx_ctl; - struct ath5k_hw_rx_status rx_stat; -} __packed __aligned(4); - -/** - * struct ath5k_desc - Atheros hardware DMA descriptor - * @ds_link: Physical address of the next descriptor - * @ds_data: Physical address of data buffer (skb) - * @ud: Union containing hw_5xxx_tx_desc structs and hw_all_rx_desc - * - * This is read and written to by the hardware - */ -struct ath5k_desc { - u32 ds_link; - u32 ds_data; - - union { - struct ath5k_hw_5210_tx_desc ds_tx5210; - struct ath5k_hw_5212_tx_desc ds_tx5212; - struct ath5k_hw_all_rx_desc ds_rx; - } ud; -} __packed __aligned(4); - -#define AR5K_RXDESC_INTREQ 0x0020 - -#define AR5K_TXDESC_CLRDMASK 0x0001 -#define AR5K_TXDESC_NOACK 0x0002 /*[5211+]*/ -#define AR5K_TXDESC_RTSENA 0x0004 -#define AR5K_TXDESC_CTSENA 0x0008 -#define AR5K_TXDESC_INTREQ 0x0010 -#define AR5K_TXDESC_VEOL 0x0020 /*[5211+]*/ diff --git a/drivers/net/wireless/ath/ath5k/dma.c b/drivers/net/wireless/ath/ath5k/dma.c deleted file mode 100644 index ce86f158423b..000000000000 --- a/drivers/net/wireless/ath/ath5k/dma.c +++ /dev/null @@ -1,919 +0,0 @@ -/* - * Copyright (c) 2004-2008 Reyk Floeter - * Copyright (c) 2006-2008 Nick Kossifidis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/*************************************\ -* DMA and interrupt masking functions * -\*************************************/ - -/** - * DOC: DMA and interrupt masking functions - * - * Here we setup descriptor pointers (rxdp/txdp) start/stop dma engine and - * handle queue setup for 5210 chipset (rest are handled on qcu.c). - * Also we setup interrupt mask register (IMR) and read the various interrupt - * status registers (ISR). - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include "ath5k.h" -#include "reg.h" -#include "debug.h" - - -/*********\ -* Receive * -\*********/ - -/** - * ath5k_hw_start_rx_dma() - Start DMA receive - * @ah: The &struct ath5k_hw - */ -void -ath5k_hw_start_rx_dma(struct ath5k_hw *ah) -{ - ath5k_hw_reg_write(ah, AR5K_CR_RXE, AR5K_CR); - ath5k_hw_reg_read(ah, AR5K_CR); -} - -/** - * ath5k_hw_stop_rx_dma() - Stop DMA receive - * @ah: The &struct ath5k_hw - */ -static int -ath5k_hw_stop_rx_dma(struct ath5k_hw *ah) -{ - unsigned int i; - - ath5k_hw_reg_write(ah, AR5K_CR_RXD, AR5K_CR); - - /* - * It may take some time to disable the DMA receive unit - */ - for (i = 1000; i > 0 && - (ath5k_hw_reg_read(ah, AR5K_CR) & AR5K_CR_RXE) != 0; - i--) - udelay(100); - - if (!i) - ATH5K_DBG(ah, ATH5K_DEBUG_DMA, - "failed to stop RX DMA !\n"); - - return i ? 0 : -EBUSY; -} - -/** - * ath5k_hw_get_rxdp() - Get RX Descriptor's address - * @ah: The &struct ath5k_hw - */ -u32 -ath5k_hw_get_rxdp(struct ath5k_hw *ah) -{ - return ath5k_hw_reg_read(ah, AR5K_RXDP); -} - -/** - * ath5k_hw_set_rxdp() - Set RX Descriptor's address - * @ah: The &struct ath5k_hw - * @phys_addr: RX descriptor address - * - * Returns -EIO if rx is active - */ -int -ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr) -{ - if (ath5k_hw_reg_read(ah, AR5K_CR) & AR5K_CR_RXE) { - ATH5K_DBG(ah, ATH5K_DEBUG_DMA, - "tried to set RXDP while rx was active !\n"); - return -EIO; - } - - ath5k_hw_reg_write(ah, phys_addr, AR5K_RXDP); - return 0; -} - - -/**********\ -* Transmit * -\**********/ - -/** - * ath5k_hw_start_tx_dma() - Start DMA transmit for a specific queue - * @ah: The &struct ath5k_hw - * @queue: The hw queue number - * - * Start DMA transmit for a specific queue and since 5210 doesn't have - * QCU/DCU, set up queue parameters for 5210 here based on queue type (one - * queue for normal data and one queue for beacons). For queue setup - * on newer chips check out qcu.c. Returns -EINVAL if queue number is out - * of range or if queue is already disabled. - * - * NOTE: Must be called after setting up tx control descriptor for that - * queue (see below). - */ -int -ath5k_hw_start_tx_dma(struct ath5k_hw *ah, unsigned int queue) -{ - u32 tx_queue; - - AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num); - - /* Return if queue is declared inactive */ - if (ah->ah_txq[queue].tqi_type == AR5K_TX_QUEUE_INACTIVE) - return -EINVAL; - - if (ah->ah_version == AR5K_AR5210) { - tx_queue = ath5k_hw_reg_read(ah, AR5K_CR); - - /* - * Set the queue by type on 5210 - */ - switch (ah->ah_txq[queue].tqi_type) { - case AR5K_TX_QUEUE_DATA: - tx_queue |= AR5K_CR_TXE0 & ~AR5K_CR_TXD0; - break; - case AR5K_TX_QUEUE_BEACON: - tx_queue |= AR5K_CR_TXE1 & ~AR5K_CR_TXD1; - ath5k_hw_reg_write(ah, AR5K_BCR_TQ1V | AR5K_BCR_BDMAE, - AR5K_BSR); - break; - case AR5K_TX_QUEUE_CAB: - tx_queue |= AR5K_CR_TXE1 & ~AR5K_CR_TXD1; - ath5k_hw_reg_write(ah, AR5K_BCR_TQ1FV | AR5K_BCR_TQ1V | - AR5K_BCR_BDMAE, AR5K_BSR); - break; - default: - return -EINVAL; - } - /* Start queue */ - ath5k_hw_reg_write(ah, tx_queue, AR5K_CR); - ath5k_hw_reg_read(ah, AR5K_CR); - } else { - /* Return if queue is disabled */ - if (AR5K_REG_READ_Q(ah, AR5K_QCU_TXD, queue)) - return -EIO; - - /* Start queue */ - AR5K_REG_WRITE_Q(ah, AR5K_QCU_TXE, queue); - } - - return 0; -} - -/** - * ath5k_hw_stop_tx_dma() - Stop DMA transmit on a specific queue - * @ah: The &struct ath5k_hw - * @queue: The hw queue number - * - * Stop DMA transmit on a specific hw queue and drain queue so we don't - * have any pending frames. Returns -EBUSY if we still have pending frames, - * -EINVAL if queue number is out of range or inactive. - */ -static int -ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue) -{ - unsigned int i = 40; - u32 tx_queue, pending; - - AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num); - - /* Return if queue is declared inactive */ - if (ah->ah_txq[queue].tqi_type == AR5K_TX_QUEUE_INACTIVE) - return -EINVAL; - - if (ah->ah_version == AR5K_AR5210) { - tx_queue = ath5k_hw_reg_read(ah, AR5K_CR); - - /* - * Set by queue type - */ - switch (ah->ah_txq[queue].tqi_type) { - case AR5K_TX_QUEUE_DATA: - tx_queue |= AR5K_CR_TXD0 & ~AR5K_CR_TXE0; - break; - case AR5K_TX_QUEUE_BEACON: - case AR5K_TX_QUEUE_CAB: - /* XXX Fix me... */ - tx_queue |= AR5K_CR_TXD1 & ~AR5K_CR_TXD1; - ath5k_hw_reg_write(ah, 0, AR5K_BSR); - break; - default: - return -EINVAL; - } - - /* Stop queue */ - ath5k_hw_reg_write(ah, tx_queue, AR5K_CR); - ath5k_hw_reg_read(ah, AR5K_CR); - } else { - - /* - * Enable DCU early termination to quickly - * flush any pending frames from QCU - */ - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), - AR5K_QCU_MISC_DCU_EARLY); - - /* - * Schedule TX disable and wait until queue is empty - */ - AR5K_REG_WRITE_Q(ah, AR5K_QCU_TXD, queue); - - /* Wait for queue to stop */ - for (i = 1000; i > 0 && - (AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue) != 0); - i--) - udelay(100); - - if (AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue)) - ATH5K_DBG(ah, ATH5K_DEBUG_DMA, - "queue %i didn't stop !\n", queue); - - /* Check for pending frames */ - i = 1000; - do { - pending = ath5k_hw_reg_read(ah, - AR5K_QUEUE_STATUS(queue)) & - AR5K_QCU_STS_FRMPENDCNT; - udelay(100); - } while (--i && pending); - - /* For 2413+ order PCU to drop packets using - * QUIET mechanism */ - if (ah->ah_mac_version >= (AR5K_SREV_AR2414 >> 4) && - pending) { - /* Set periodicity and duration */ - ath5k_hw_reg_write(ah, - AR5K_REG_SM(100, AR5K_QUIET_CTL2_QT_PER)| - AR5K_REG_SM(10, AR5K_QUIET_CTL2_QT_DUR), - AR5K_QUIET_CTL2); - - /* Enable quiet period for current TSF */ - ath5k_hw_reg_write(ah, - AR5K_QUIET_CTL1_QT_EN | - AR5K_REG_SM(ath5k_hw_reg_read(ah, - AR5K_TSF_L32_5211) >> 10, - AR5K_QUIET_CTL1_NEXT_QT_TSF), - AR5K_QUIET_CTL1); - - /* Force channel idle high */ - AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW_5211, - AR5K_DIAG_SW_CHANNEL_IDLE_HIGH); - - /* Wait a while and disable mechanism */ - udelay(400); - AR5K_REG_DISABLE_BITS(ah, AR5K_QUIET_CTL1, - AR5K_QUIET_CTL1_QT_EN); - - /* Re-check for pending frames */ - i = 100; - do { - pending = ath5k_hw_reg_read(ah, - AR5K_QUEUE_STATUS(queue)) & - AR5K_QCU_STS_FRMPENDCNT; - udelay(100); - } while (--i && pending); - - AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW_5211, - AR5K_DIAG_SW_CHANNEL_IDLE_HIGH); - - if (pending) - ATH5K_DBG(ah, ATH5K_DEBUG_DMA, - "quiet mechanism didn't work q:%i !\n", - queue); - } - - /* - * Disable DCU early termination - */ - AR5K_REG_DISABLE_BITS(ah, AR5K_QUEUE_MISC(queue), - AR5K_QCU_MISC_DCU_EARLY); - - /* Clear register */ - ath5k_hw_reg_write(ah, 0, AR5K_QCU_TXD); - if (pending) { - ATH5K_DBG(ah, ATH5K_DEBUG_DMA, - "tx dma didn't stop (q:%i, frm:%i) !\n", - queue, pending); - return -EBUSY; - } - } - - /* TODO: Check for success on 5210 else return error */ - return 0; -} - -/** - * ath5k_hw_stop_beacon_queue() - Stop beacon queue - * @ah: The &struct ath5k_hw - * @queue: The queue number - * - * Returns -EIO if queue didn't stop - */ -int -ath5k_hw_stop_beacon_queue(struct ath5k_hw *ah, unsigned int queue) -{ - int ret; - ret = ath5k_hw_stop_tx_dma(ah, queue); - if (ret) { - ATH5K_DBG(ah, ATH5K_DEBUG_DMA, - "beacon queue didn't stop !\n"); - return -EIO; - } - return 0; -} - -/** - * ath5k_hw_get_txdp() - Get TX Descriptor's address for a specific queue - * @ah: The &struct ath5k_hw - * @queue: The hw queue number - * - * Get TX descriptor's address for a specific queue. For 5210 we ignore - * the queue number and use tx queue type since we only have 2 queues. - * We use TXDP0 for normal data queue and TXDP1 for beacon queue. - * For newer chips with QCU/DCU we just read the corresponding TXDP register. - * - * XXX: Is TXDP read and clear ? - */ -u32 -ath5k_hw_get_txdp(struct ath5k_hw *ah, unsigned int queue) -{ - u16 tx_reg; - - AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num); - - /* - * Get the transmit queue descriptor pointer from the selected queue - */ - /*5210 doesn't have QCU*/ - if (ah->ah_version == AR5K_AR5210) { - switch (ah->ah_txq[queue].tqi_type) { - case AR5K_TX_QUEUE_DATA: - tx_reg = AR5K_NOQCU_TXDP0; - break; - case AR5K_TX_QUEUE_BEACON: - case AR5K_TX_QUEUE_CAB: - tx_reg = AR5K_NOQCU_TXDP1; - break; - default: - return 0xffffffff; - } - } else { - tx_reg = AR5K_QUEUE_TXDP(queue); - } - - return ath5k_hw_reg_read(ah, tx_reg); -} - -/** - * ath5k_hw_set_txdp() - Set TX Descriptor's address for a specific queue - * @ah: The &struct ath5k_hw - * @queue: The hw queue number - * @phys_addr: The physical address - * - * Set TX descriptor's address for a specific queue. For 5210 we ignore - * the queue number and we use tx queue type since we only have 2 queues - * so as above we use TXDP0 for normal data queue and TXDP1 for beacon queue. - * For newer chips with QCU/DCU we just set the corresponding TXDP register. - * Returns -EINVAL if queue type is invalid for 5210 and -EIO if queue is still - * active. - */ -int -ath5k_hw_set_txdp(struct ath5k_hw *ah, unsigned int queue, u32 phys_addr) -{ - u16 tx_reg; - - AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num); - - /* - * Set the transmit queue descriptor pointer register by type - * on 5210 - */ - if (ah->ah_version == AR5K_AR5210) { - switch (ah->ah_txq[queue].tqi_type) { - case AR5K_TX_QUEUE_DATA: - tx_reg = AR5K_NOQCU_TXDP0; - break; - case AR5K_TX_QUEUE_BEACON: - case AR5K_TX_QUEUE_CAB: - tx_reg = AR5K_NOQCU_TXDP1; - break; - default: - return -EINVAL; - } - } else { - /* - * Set the transmit queue descriptor pointer for - * the selected queue on QCU for 5211+ - * (this won't work if the queue is still active) - */ - if (AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue)) - return -EIO; - - tx_reg = AR5K_QUEUE_TXDP(queue); - } - - /* Set descriptor pointer */ - ath5k_hw_reg_write(ah, phys_addr, tx_reg); - - return 0; -} - -/** - * ath5k_hw_update_tx_triglevel() - Update tx trigger level - * @ah: The &struct ath5k_hw - * @increase: Flag to force increase of trigger level - * - * This function increases/decreases the tx trigger level for the tx fifo - * buffer (aka FIFO threshold) that is used to indicate when PCU flushes - * the buffer and transmits its data. Lowering this results sending small - * frames more quickly but can lead to tx underruns, raising it a lot can - * result other problems. Right now we start with the lowest possible - * (64Bytes) and if we get tx underrun we increase it using the increase - * flag. Returns -EIO if we have reached maximum/minimum. - * - * XXX: Link this with tx DMA size ? - * XXX2: Use it to save interrupts ? - */ -int -ath5k_hw_update_tx_triglevel(struct ath5k_hw *ah, bool increase) -{ - u32 trigger_level, imr; - int ret = -EIO; - - /* - * Disable interrupts by setting the mask - */ - imr = ath5k_hw_set_imr(ah, ah->ah_imr & ~AR5K_INT_GLOBAL); - - trigger_level = AR5K_REG_MS(ath5k_hw_reg_read(ah, AR5K_TXCFG), - AR5K_TXCFG_TXFULL); - - if (!increase) { - if (--trigger_level < AR5K_TUNE_MIN_TX_FIFO_THRES) - goto done; - } else - trigger_level += - ((AR5K_TUNE_MAX_TX_FIFO_THRES - trigger_level) / 2); - - /* - * Update trigger level on success - */ - if (ah->ah_version == AR5K_AR5210) - ath5k_hw_reg_write(ah, trigger_level, AR5K_TRIG_LVL); - else - AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG, - AR5K_TXCFG_TXFULL, trigger_level); - - ret = 0; - -done: - /* - * Restore interrupt mask - */ - ath5k_hw_set_imr(ah, imr); - - return ret; -} - - -/*******************\ -* Interrupt masking * -\*******************/ - -/** - * ath5k_hw_is_intr_pending() - Check if we have pending interrupts - * @ah: The &struct ath5k_hw - * - * Check if we have pending interrupts to process. Returns 1 if we - * have pending interrupts and 0 if we haven't. - */ -bool -ath5k_hw_is_intr_pending(struct ath5k_hw *ah) -{ - return ath5k_hw_reg_read(ah, AR5K_INTPEND) == 1 ? 1 : 0; -} - -/** - * ath5k_hw_get_isr() - Get interrupt status - * @ah: The @struct ath5k_hw - * @interrupt_mask: Driver's interrupt mask used to filter out - * interrupts in sw. - * - * This function is used inside our interrupt handler to determine the reason - * for the interrupt by reading Primary Interrupt Status Register. Returns an - * abstract interrupt status mask which is mostly ISR with some uncommon bits - * being mapped on some standard non hw-specific positions - * (check out &ath5k_int). - * - * NOTE: We do write-to-clear, so the active PISR/SISR bits at the time this - * function gets called are cleared on return. - */ -int -ath5k_hw_get_isr(struct ath5k_hw *ah, enum ath5k_int *interrupt_mask) -{ - u32 data = 0; - - /* - * Read interrupt status from Primary Interrupt - * Register. - * - * Note: PISR/SISR Not available on 5210 - */ - if (ah->ah_version == AR5K_AR5210) { - u32 isr = 0; - isr = ath5k_hw_reg_read(ah, AR5K_ISR); - if (unlikely(isr == AR5K_INT_NOCARD)) { - *interrupt_mask = isr; - return -ENODEV; - } - - /* - * Filter out the non-common bits from the interrupt - * status. - */ - *interrupt_mask = (isr & AR5K_INT_COMMON) & ah->ah_imr; - - /* Hanlde INT_FATAL */ - if (unlikely(isr & (AR5K_ISR_SSERR | AR5K_ISR_MCABT - | AR5K_ISR_DPERR))) - *interrupt_mask |= AR5K_INT_FATAL; - - /* - * XXX: BMISS interrupts may occur after association. - * I found this on 5210 code but it needs testing. If this is - * true we should disable them before assoc and re-enable them - * after a successful assoc + some jiffies. - interrupt_mask &= ~AR5K_INT_BMISS; - */ - - data = isr; - } else { - u32 pisr = 0; - u32 pisr_clear = 0; - u32 sisr0 = 0; - u32 sisr1 = 0; - u32 sisr2 = 0; - u32 sisr3 = 0; - u32 sisr4 = 0; - - /* Read PISR and SISRs... */ - pisr = ath5k_hw_reg_read(ah, AR5K_PISR); - if (unlikely(pisr == AR5K_INT_NOCARD)) { - *interrupt_mask = pisr; - return -ENODEV; - } - - sisr0 = ath5k_hw_reg_read(ah, AR5K_SISR0); - sisr1 = ath5k_hw_reg_read(ah, AR5K_SISR1); - sisr2 = ath5k_hw_reg_read(ah, AR5K_SISR2); - sisr3 = ath5k_hw_reg_read(ah, AR5K_SISR3); - sisr4 = ath5k_hw_reg_read(ah, AR5K_SISR4); - - /* - * PISR holds the logical OR of interrupt bits - * from SISR registers: - * - * TXOK and TXDESC -> Logical OR of TXOK and TXDESC - * per-queue bits on SISR0 - * - * TXERR and TXEOL -> Logical OR of TXERR and TXEOL - * per-queue bits on SISR1 - * - * TXURN -> Logical OR of TXURN per-queue bits on SISR2 - * - * HIUERR -> Logical OR of MCABT, SSERR and DPER bits on SISR2 - * - * BCNMISC -> Logical OR of TIM, CAB_END, DTIM_SYNC - * BCN_TIMEOUT, CAB_TIMEOUT and DTIM - * (and TSFOOR ?) bits on SISR2 - * - * QCBRORN and QCBRURN -> Logical OR of QCBRORN and - * QCBRURN per-queue bits on SISR3 - * QTRIG -> Logical OR of QTRIG per-queue bits on SISR4 - * - * If we clean these bits on PISR we 'll also clear all - * related bits from SISRs, e.g. if we write the TXOK bit on - * PISR we 'll clean all TXOK bits from SISR0 so if a new TXOK - * interrupt got fired for another queue while we were reading - * the interrupt registers and we write back the TXOK bit on - * PISR we 'll lose it. So make sure that we don't write back - * on PISR any bits that come from SISRs. Clearing them from - * SISRs will also clear PISR so no need to worry here. - */ - - pisr_clear = pisr & ~AR5K_ISR_BITS_FROM_SISRS; - - /* - * Write to clear them... - * Note: This means that each bit we write back - * to the registers will get cleared, leaving the - * rest unaffected. So this won't affect new interrupts - * we didn't catch while reading/processing, we 'll get - * them next time get_isr gets called. - */ - ath5k_hw_reg_write(ah, sisr0, AR5K_SISR0); - ath5k_hw_reg_write(ah, sisr1, AR5K_SISR1); - ath5k_hw_reg_write(ah, sisr2, AR5K_SISR2); - ath5k_hw_reg_write(ah, sisr3, AR5K_SISR3); - ath5k_hw_reg_write(ah, sisr4, AR5K_SISR4); - ath5k_hw_reg_write(ah, pisr_clear, AR5K_PISR); - /* Flush previous write */ - ath5k_hw_reg_read(ah, AR5K_PISR); - - /* - * Filter out the non-common bits from the interrupt - * status. - */ - *interrupt_mask = (pisr & AR5K_INT_COMMON) & ah->ah_imr; - - - /* We treat TXOK,TXDESC, TXERR and TXEOL - * the same way (schedule the tx tasklet) - * so we track them all together per queue */ - if (pisr & AR5K_ISR_TXOK) - ah->ah_txq_isr_txok_all |= AR5K_REG_MS(sisr0, - AR5K_SISR0_QCU_TXOK); - - if (pisr & AR5K_ISR_TXDESC) - ah->ah_txq_isr_txok_all |= AR5K_REG_MS(sisr0, - AR5K_SISR0_QCU_TXDESC); - - if (pisr & AR5K_ISR_TXERR) - ah->ah_txq_isr_txok_all |= AR5K_REG_MS(sisr1, - AR5K_SISR1_QCU_TXERR); - - if (pisr & AR5K_ISR_TXEOL) - ah->ah_txq_isr_txok_all |= AR5K_REG_MS(sisr1, - AR5K_SISR1_QCU_TXEOL); - - /* Currently this is not much usefull since we treat - * all queues the same way if we get a TXURN (update - * tx trigger level) but we might need it later on*/ - if (pisr & AR5K_ISR_TXURN) - ah->ah_txq_isr_txurn |= AR5K_REG_MS(sisr2, - AR5K_SISR2_QCU_TXURN); - - /* Misc Beacon related interrupts */ - - /* For AR5211 */ - if (pisr & AR5K_ISR_TIM) - *interrupt_mask |= AR5K_INT_TIM; - - /* For AR5212+ */ - if (pisr & AR5K_ISR_BCNMISC) { - if (sisr2 & AR5K_SISR2_TIM) - *interrupt_mask |= AR5K_INT_TIM; - if (sisr2 & AR5K_SISR2_DTIM) - *interrupt_mask |= AR5K_INT_DTIM; - if (sisr2 & AR5K_SISR2_DTIM_SYNC) - *interrupt_mask |= AR5K_INT_DTIM_SYNC; - if (sisr2 & AR5K_SISR2_BCN_TIMEOUT) - *interrupt_mask |= AR5K_INT_BCN_TIMEOUT; - if (sisr2 & AR5K_SISR2_CAB_TIMEOUT) - *interrupt_mask |= AR5K_INT_CAB_TIMEOUT; - } - - /* Below interrupts are unlikely to happen */ - - /* HIU = Host Interface Unit (PCI etc) - * Can be one of MCABT, SSERR, DPERR from SISR2 */ - if (unlikely(pisr & (AR5K_ISR_HIUERR))) - *interrupt_mask |= AR5K_INT_FATAL; - - /*Beacon Not Ready*/ - if (unlikely(pisr & (AR5K_ISR_BNR))) - *interrupt_mask |= AR5K_INT_BNR; - - /* A queue got CBR overrun */ - if (unlikely(pisr & (AR5K_ISR_QCBRORN))) { - *interrupt_mask |= AR5K_INT_QCBRORN; - ah->ah_txq_isr_qcborn |= AR5K_REG_MS(sisr3, - AR5K_SISR3_QCBRORN); - } - - /* A queue got CBR underrun */ - if (unlikely(pisr & (AR5K_ISR_QCBRURN))) { - *interrupt_mask |= AR5K_INT_QCBRURN; - ah->ah_txq_isr_qcburn |= AR5K_REG_MS(sisr3, - AR5K_SISR3_QCBRURN); - } - - /* A queue got triggered */ - if (unlikely(pisr & (AR5K_ISR_QTRIG))) { - *interrupt_mask |= AR5K_INT_QTRIG; - ah->ah_txq_isr_qtrig |= AR5K_REG_MS(sisr4, - AR5K_SISR4_QTRIG); - } - - data = pisr; - } - - /* - * In case we didn't handle anything, - * print the register value. - */ - if (unlikely(*interrupt_mask == 0 && net_ratelimit())) - ATH5K_PRINTF("ISR: 0x%08x IMR: 0x%08x\n", data, ah->ah_imr); - - return 0; -} - -/** - * ath5k_hw_set_imr() - Set interrupt mask - * @ah: The &struct ath5k_hw - * @new_mask: The new interrupt mask to be set - * - * Set the interrupt mask in hw to save interrupts. We do that by mapping - * ath5k_int bits to hw-specific bits to remove abstraction and writing - * Interrupt Mask Register. - */ -enum ath5k_int -ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask) -{ - enum ath5k_int old_mask, int_mask; - - old_mask = ah->ah_imr; - - /* - * Disable card interrupts to prevent any race conditions - * (they will be re-enabled afterwards if AR5K_INT GLOBAL - * is set again on the new mask). - */ - if (old_mask & AR5K_INT_GLOBAL) { - ath5k_hw_reg_write(ah, AR5K_IER_DISABLE, AR5K_IER); - ath5k_hw_reg_read(ah, AR5K_IER); - } - - /* - * Add additional, chipset-dependent interrupt mask flags - * and write them to the IMR (interrupt mask register). - */ - int_mask = new_mask & AR5K_INT_COMMON; - - if (ah->ah_version != AR5K_AR5210) { - /* Preserve per queue TXURN interrupt mask */ - u32 simr2 = ath5k_hw_reg_read(ah, AR5K_SIMR2) - & AR5K_SIMR2_QCU_TXURN; - - /* Fatal interrupt abstraction for 5211+ */ - if (new_mask & AR5K_INT_FATAL) { - int_mask |= AR5K_IMR_HIUERR; - simr2 |= (AR5K_SIMR2_MCABT | AR5K_SIMR2_SSERR - | AR5K_SIMR2_DPERR); - } - - /* Misc beacon related interrupts */ - if (new_mask & AR5K_INT_TIM) - int_mask |= AR5K_IMR_TIM; - - if (new_mask & AR5K_INT_TIM) - simr2 |= AR5K_SISR2_TIM; - if (new_mask & AR5K_INT_DTIM) - simr2 |= AR5K_SISR2_DTIM; - if (new_mask & AR5K_INT_DTIM_SYNC) - simr2 |= AR5K_SISR2_DTIM_SYNC; - if (new_mask & AR5K_INT_BCN_TIMEOUT) - simr2 |= AR5K_SISR2_BCN_TIMEOUT; - if (new_mask & AR5K_INT_CAB_TIMEOUT) - simr2 |= AR5K_SISR2_CAB_TIMEOUT; - - /*Beacon Not Ready*/ - if (new_mask & AR5K_INT_BNR) - int_mask |= AR5K_INT_BNR; - - /* Note: Per queue interrupt masks - * are set via ath5k_hw_reset_tx_queue() (qcu.c) */ - ath5k_hw_reg_write(ah, int_mask, AR5K_PIMR); - ath5k_hw_reg_write(ah, simr2, AR5K_SIMR2); - - } else { - /* Fatal interrupt abstraction for 5210 */ - if (new_mask & AR5K_INT_FATAL) - int_mask |= (AR5K_IMR_SSERR | AR5K_IMR_MCABT - | AR5K_IMR_HIUERR | AR5K_IMR_DPERR); - - /* Only common interrupts left for 5210 (no SIMRs) */ - ath5k_hw_reg_write(ah, int_mask, AR5K_IMR); - } - - /* If RXNOFRM interrupt is masked disable it - * by setting AR5K_RXNOFRM to zero */ - if (!(new_mask & AR5K_INT_RXNOFRM)) - ath5k_hw_reg_write(ah, 0, AR5K_RXNOFRM); - - /* Store new interrupt mask */ - ah->ah_imr = new_mask; - - /* ..re-enable interrupts if AR5K_INT_GLOBAL is set */ - if (new_mask & AR5K_INT_GLOBAL) { - ath5k_hw_reg_write(ah, AR5K_IER_ENABLE, AR5K_IER); - ath5k_hw_reg_read(ah, AR5K_IER); - } - - return old_mask; -} - - -/********************\ - Init/Stop functions -\********************/ - -/** - * ath5k_hw_dma_init() - Initialize DMA unit - * @ah: The &struct ath5k_hw - * - * Set DMA size and pre-enable interrupts - * (driver handles tx/rx buffer setup and - * dma start/stop) - * - * XXX: Save/restore RXDP/TXDP registers ? - */ -void -ath5k_hw_dma_init(struct ath5k_hw *ah) -{ - /* - * Set Rx/Tx DMA Configuration - * - * Set standard DMA size (128). Note that - * a DMA size of 512 causes rx overruns and tx errors - * on pci-e cards (tested on 5424 but since rx overruns - * also occur on 5416/5418 with madwifi we set 128 - * for all PCI-E cards to be safe). - * - * XXX: need to check 5210 for this - * TODO: Check out tx trigger level, it's always 64 on dumps but I - * guess we can tweak it and see how it goes ;-) - */ - if (ah->ah_version != AR5K_AR5210) { - AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG, - AR5K_TXCFG_SDMAMR, AR5K_DMASIZE_128B); - AR5K_REG_WRITE_BITS(ah, AR5K_RXCFG, - AR5K_RXCFG_SDMAMW, AR5K_DMASIZE_128B); - } - - /* Pre-enable interrupts on 5211/5212*/ - if (ah->ah_version != AR5K_AR5210) - ath5k_hw_set_imr(ah, ah->ah_imr); - -} - -/** - * ath5k_hw_dma_stop() - stop DMA unit - * @ah: The &struct ath5k_hw - * - * Stop tx/rx DMA and interrupts. Returns - * -EBUSY if tx or rx dma failed to stop. - * - * XXX: Sometimes DMA unit hangs and we have - * stuck frames on tx queues, only a reset - * can fix that. - */ -int -ath5k_hw_dma_stop(struct ath5k_hw *ah) -{ - int i, qmax, err; - err = 0; - - /* Disable interrupts */ - ath5k_hw_set_imr(ah, 0); - - /* Stop rx dma */ - err = ath5k_hw_stop_rx_dma(ah); - if (err) - return err; - - /* Clear any pending interrupts - * and disable tx dma */ - if (ah->ah_version != AR5K_AR5210) { - ath5k_hw_reg_write(ah, 0xffffffff, AR5K_PISR); - qmax = AR5K_NUM_TX_QUEUES; - } else { - /* PISR/SISR Not available on 5210 */ - ath5k_hw_reg_read(ah, AR5K_ISR); - qmax = AR5K_NUM_TX_QUEUES_NOQCU; - } - - for (i = 0; i < qmax; i++) { - err = ath5k_hw_stop_tx_dma(ah, i); - /* -EINVAL -> queue inactive */ - if (err && err != -EINVAL) - return err; - } - - return 0; -} diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c deleted file mode 100644 index 94d34ee02265..000000000000 --- a/drivers/net/wireless/ath/ath5k/eeprom.c +++ /dev/null @@ -1,1796 +0,0 @@ -/* - * Copyright (c) 2004-2008 Reyk Floeter - * Copyright (c) 2006-2009 Nick Kossifidis - * Copyright (c) 2008-2009 Felix Fietkau - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/*************************************\ -* EEPROM access functions and helpers * -\*************************************/ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include - -#include "ath5k.h" -#include "reg.h" -#include "debug.h" - - -/******************\ -* Helper functions * -\******************/ - -/* - * Translate binary channel representation in EEPROM to frequency - */ -static u16 ath5k_eeprom_bin2freq(struct ath5k_eeprom_info *ee, u16 bin, - unsigned int mode) -{ - u16 val; - - if (bin == AR5K_EEPROM_CHANNEL_DIS) - return bin; - - if (mode == AR5K_EEPROM_MODE_11A) { - if (ee->ee_version > AR5K_EEPROM_VERSION_3_2) - val = (5 * bin) + 4800; - else - val = bin > 62 ? (10 * 62) + (5 * (bin - 62)) + 5100 : - (bin * 10) + 5100; - } else { - if (ee->ee_version > AR5K_EEPROM_VERSION_3_2) - val = bin + 2300; - else - val = bin + 2400; - } - - return val; -} - - -/*********\ -* Parsers * -\*********/ - -/* - * Initialize eeprom & capabilities structs - */ -static int -ath5k_eeprom_init_header(struct ath5k_hw *ah) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - u16 val; - u32 cksum, offset, eep_max = AR5K_EEPROM_INFO_MAX; - - /* - * Read values from EEPROM and store them in the capability structure - */ - AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MAGIC, ee_magic); - AR5K_EEPROM_READ_HDR(AR5K_EEPROM_PROTECT, ee_protect); - AR5K_EEPROM_READ_HDR(AR5K_EEPROM_REG_DOMAIN, ee_regdomain); - AR5K_EEPROM_READ_HDR(AR5K_EEPROM_VERSION, ee_version); - AR5K_EEPROM_READ_HDR(AR5K_EEPROM_HDR, ee_header); - - /* Return if we have an old EEPROM */ - if (ah->ah_ee_version < AR5K_EEPROM_VERSION_3_0) - return 0; - - /* - * Validate the checksum of the EEPROM date. There are some - * devices with invalid EEPROMs. - */ - AR5K_EEPROM_READ(AR5K_EEPROM_SIZE_UPPER, val); - if (val) { - eep_max = (val & AR5K_EEPROM_SIZE_UPPER_MASK) << - AR5K_EEPROM_SIZE_ENDLOC_SHIFT; - AR5K_EEPROM_READ(AR5K_EEPROM_SIZE_LOWER, val); - eep_max = (eep_max | val) - AR5K_EEPROM_INFO_BASE; - - /* - * Fail safe check to prevent stupid loops due - * to busted EEPROMs. XXX: This value is likely too - * big still, waiting on a better value. - */ - if (eep_max > (3 * AR5K_EEPROM_INFO_MAX)) { - ATH5K_ERR(ah, "Invalid max custom EEPROM size: " - "%d (0x%04x) max expected: %d (0x%04x)\n", - eep_max, eep_max, - 3 * AR5K_EEPROM_INFO_MAX, - 3 * AR5K_EEPROM_INFO_MAX); - return -EIO; - } - } - - for (cksum = 0, offset = 0; offset < eep_max; offset++) { - AR5K_EEPROM_READ(AR5K_EEPROM_INFO(offset), val); - cksum ^= val; - } - if (cksum != AR5K_EEPROM_INFO_CKSUM) { - ATH5K_ERR(ah, "Invalid EEPROM " - "checksum: 0x%04x eep_max: 0x%04x (%s)\n", - cksum, eep_max, - eep_max == AR5K_EEPROM_INFO_MAX ? - "default size" : "custom size"); - return -EIO; - } - - AR5K_EEPROM_READ_HDR(AR5K_EEPROM_ANT_GAIN(ah->ah_ee_version), - ee_ant_gain); - - if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_0) { - AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MISC0, ee_misc0); - AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MISC1, ee_misc1); - - /* XXX: Don't know which versions include these two */ - AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MISC2, ee_misc2); - - if (ee->ee_version >= AR5K_EEPROM_VERSION_4_3) - AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MISC3, ee_misc3); - - if (ee->ee_version >= AR5K_EEPROM_VERSION_5_0) { - AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MISC4, ee_misc4); - AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MISC5, ee_misc5); - AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MISC6, ee_misc6); - } - } - - if (ah->ah_ee_version < AR5K_EEPROM_VERSION_3_3) { - AR5K_EEPROM_READ(AR5K_EEPROM_OBDB0_2GHZ, val); - ee->ee_ob[AR5K_EEPROM_MODE_11B][0] = val & 0x7; - ee->ee_db[AR5K_EEPROM_MODE_11B][0] = (val >> 3) & 0x7; - - AR5K_EEPROM_READ(AR5K_EEPROM_OBDB1_2GHZ, val); - ee->ee_ob[AR5K_EEPROM_MODE_11G][0] = val & 0x7; - ee->ee_db[AR5K_EEPROM_MODE_11G][0] = (val >> 3) & 0x7; - } - - AR5K_EEPROM_READ(AR5K_EEPROM_IS_HB63, val); - - if ((ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4)) && val) - ee->ee_is_hb63 = true; - else - ee->ee_is_hb63 = false; - - AR5K_EEPROM_READ(AR5K_EEPROM_RFKILL, val); - ee->ee_rfkill_pin = (u8) AR5K_REG_MS(val, AR5K_EEPROM_RFKILL_GPIO_SEL); - ee->ee_rfkill_pol = val & AR5K_EEPROM_RFKILL_POLARITY ? true : false; - - /* Check if PCIE_OFFSET points to PCIE_SERDES_SECTION - * and enable serdes programming if needed. - * - * XXX: Serdes values seem to be fixed so - * no need to read them here, we write them - * during ath5k_hw_init */ - AR5K_EEPROM_READ(AR5K_EEPROM_PCIE_OFFSET, val); - ee->ee_serdes = (val == AR5K_EEPROM_PCIE_SERDES_SECTION) ? - true : false; - - return 0; -} - - -/* - * Read antenna infos from eeprom - */ -static int ath5k_eeprom_read_ants(struct ath5k_hw *ah, u32 *offset, - unsigned int mode) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - u32 o = *offset; - u16 val; - int i = 0; - - AR5K_EEPROM_READ(o++, val); - ee->ee_switch_settling[mode] = (val >> 8) & 0x7f; - ee->ee_atn_tx_rx[mode] = (val >> 2) & 0x3f; - ee->ee_ant_control[mode][i] = (val << 4) & 0x3f; - - AR5K_EEPROM_READ(o++, val); - ee->ee_ant_control[mode][i++] |= (val >> 12) & 0xf; - ee->ee_ant_control[mode][i++] = (val >> 6) & 0x3f; - ee->ee_ant_control[mode][i++] = val & 0x3f; - - AR5K_EEPROM_READ(o++, val); - ee->ee_ant_control[mode][i++] = (val >> 10) & 0x3f; - ee->ee_ant_control[mode][i++] = (val >> 4) & 0x3f; - ee->ee_ant_control[mode][i] = (val << 2) & 0x3f; - - AR5K_EEPROM_READ(o++, val); - ee->ee_ant_control[mode][i++] |= (val >> 14) & 0x3; - ee->ee_ant_control[mode][i++] = (val >> 8) & 0x3f; - ee->ee_ant_control[mode][i++] = (val >> 2) & 0x3f; - ee->ee_ant_control[mode][i] = (val << 4) & 0x3f; - - AR5K_EEPROM_READ(o++, val); - ee->ee_ant_control[mode][i++] |= (val >> 12) & 0xf; - ee->ee_ant_control[mode][i++] = (val >> 6) & 0x3f; - ee->ee_ant_control[mode][i++] = val & 0x3f; - - /* Get antenna switch tables */ - ah->ah_ant_ctl[mode][AR5K_ANT_CTL] = - (ee->ee_ant_control[mode][0] << 4); - ah->ah_ant_ctl[mode][AR5K_ANT_SWTABLE_A] = - ee->ee_ant_control[mode][1] | - (ee->ee_ant_control[mode][2] << 6) | - (ee->ee_ant_control[mode][3] << 12) | - (ee->ee_ant_control[mode][4] << 18) | - (ee->ee_ant_control[mode][5] << 24); - ah->ah_ant_ctl[mode][AR5K_ANT_SWTABLE_B] = - ee->ee_ant_control[mode][6] | - (ee->ee_ant_control[mode][7] << 6) | - (ee->ee_ant_control[mode][8] << 12) | - (ee->ee_ant_control[mode][9] << 18) | - (ee->ee_ant_control[mode][10] << 24); - - /* return new offset */ - *offset = o; - - return 0; -} - -/* - * Read supported modes and some mode-specific calibration data - * from eeprom - */ -static int ath5k_eeprom_read_modes(struct ath5k_hw *ah, u32 *offset, - unsigned int mode) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - u32 o = *offset; - u16 val; - - ee->ee_n_piers[mode] = 0; - AR5K_EEPROM_READ(o++, val); - ee->ee_adc_desired_size[mode] = (s8)((val >> 8) & 0xff); - switch (mode) { - case AR5K_EEPROM_MODE_11A: - ee->ee_ob[mode][3] = (val >> 5) & 0x7; - ee->ee_db[mode][3] = (val >> 2) & 0x7; - ee->ee_ob[mode][2] = (val << 1) & 0x7; - - AR5K_EEPROM_READ(o++, val); - ee->ee_ob[mode][2] |= (val >> 15) & 0x1; - ee->ee_db[mode][2] = (val >> 12) & 0x7; - ee->ee_ob[mode][1] = (val >> 9) & 0x7; - ee->ee_db[mode][1] = (val >> 6) & 0x7; - ee->ee_ob[mode][0] = (val >> 3) & 0x7; - ee->ee_db[mode][0] = val & 0x7; - break; - case AR5K_EEPROM_MODE_11G: - case AR5K_EEPROM_MODE_11B: - ee->ee_ob[mode][1] = (val >> 4) & 0x7; - ee->ee_db[mode][1] = val & 0x7; - break; - } - - AR5K_EEPROM_READ(o++, val); - ee->ee_tx_end2xlna_enable[mode] = (val >> 8) & 0xff; - ee->ee_thr_62[mode] = val & 0xff; - - if (ah->ah_ee_version <= AR5K_EEPROM_VERSION_3_2) - ee->ee_thr_62[mode] = mode == AR5K_EEPROM_MODE_11A ? 15 : 28; - - AR5K_EEPROM_READ(o++, val); - ee->ee_tx_end2xpa_disable[mode] = (val >> 8) & 0xff; - ee->ee_tx_frm2xpa_enable[mode] = val & 0xff; - - AR5K_EEPROM_READ(o++, val); - ee->ee_pga_desired_size[mode] = (val >> 8) & 0xff; - - if ((val & 0xff) & 0x80) - ee->ee_noise_floor_thr[mode] = -((((val & 0xff) ^ 0xff)) + 1); - else - ee->ee_noise_floor_thr[mode] = val & 0xff; - - if (ah->ah_ee_version <= AR5K_EEPROM_VERSION_3_2) - ee->ee_noise_floor_thr[mode] = - mode == AR5K_EEPROM_MODE_11A ? -54 : -1; - - AR5K_EEPROM_READ(o++, val); - ee->ee_xlna_gain[mode] = (val >> 5) & 0xff; - ee->ee_x_gain[mode] = (val >> 1) & 0xf; - ee->ee_xpd[mode] = val & 0x1; - - if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_0 && - mode != AR5K_EEPROM_MODE_11B) - ee->ee_fixed_bias[mode] = (val >> 13) & 0x1; - - if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_3_3) { - AR5K_EEPROM_READ(o++, val); - ee->ee_false_detect[mode] = (val >> 6) & 0x7f; - - if (mode == AR5K_EEPROM_MODE_11A) - ee->ee_xr_power[mode] = val & 0x3f; - else { - /* b_DB_11[bg] and b_OB_11[bg] */ - ee->ee_ob[mode][0] = val & 0x7; - ee->ee_db[mode][0] = (val >> 3) & 0x7; - } - } - - if (ah->ah_ee_version < AR5K_EEPROM_VERSION_3_4) { - ee->ee_i_gain[mode] = AR5K_EEPROM_I_GAIN; - ee->ee_cck_ofdm_power_delta = AR5K_EEPROM_CCK_OFDM_DELTA; - } else { - ee->ee_i_gain[mode] = (val >> 13) & 0x7; - - AR5K_EEPROM_READ(o++, val); - ee->ee_i_gain[mode] |= (val << 3) & 0x38; - - if (mode == AR5K_EEPROM_MODE_11G) { - ee->ee_cck_ofdm_power_delta = (val >> 3) & 0xff; - if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_6) - ee->ee_scaled_cck_delta = (val >> 11) & 0x1f; - } - } - - if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_0 && - mode == AR5K_EEPROM_MODE_11A) { - ee->ee_i_cal[mode] = (val >> 8) & 0x3f; - ee->ee_q_cal[mode] = (val >> 3) & 0x1f; - } - - if (ah->ah_ee_version < AR5K_EEPROM_VERSION_4_0) - goto done; - - /* Note: >= v5 have bg freq piers on another location - * so these freq piers are ignored for >= v5 (should be 0xff - * anyway) */ - switch (mode) { - case AR5K_EEPROM_MODE_11A: - if (ah->ah_ee_version < AR5K_EEPROM_VERSION_4_1) - break; - - AR5K_EEPROM_READ(o++, val); - ee->ee_margin_tx_rx[mode] = val & 0x3f; - break; - case AR5K_EEPROM_MODE_11B: - AR5K_EEPROM_READ(o++, val); - - ee->ee_pwr_cal_b[0].freq = - ath5k_eeprom_bin2freq(ee, val & 0xff, mode); - if (ee->ee_pwr_cal_b[0].freq != AR5K_EEPROM_CHANNEL_DIS) - ee->ee_n_piers[mode]++; - - ee->ee_pwr_cal_b[1].freq = - ath5k_eeprom_bin2freq(ee, (val >> 8) & 0xff, mode); - if (ee->ee_pwr_cal_b[1].freq != AR5K_EEPROM_CHANNEL_DIS) - ee->ee_n_piers[mode]++; - - AR5K_EEPROM_READ(o++, val); - ee->ee_pwr_cal_b[2].freq = - ath5k_eeprom_bin2freq(ee, val & 0xff, mode); - if (ee->ee_pwr_cal_b[2].freq != AR5K_EEPROM_CHANNEL_DIS) - ee->ee_n_piers[mode]++; - - if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_1) - ee->ee_margin_tx_rx[mode] = (val >> 8) & 0x3f; - break; - case AR5K_EEPROM_MODE_11G: - AR5K_EEPROM_READ(o++, val); - - ee->ee_pwr_cal_g[0].freq = - ath5k_eeprom_bin2freq(ee, val & 0xff, mode); - if (ee->ee_pwr_cal_g[0].freq != AR5K_EEPROM_CHANNEL_DIS) - ee->ee_n_piers[mode]++; - - ee->ee_pwr_cal_g[1].freq = - ath5k_eeprom_bin2freq(ee, (val >> 8) & 0xff, mode); - if (ee->ee_pwr_cal_g[1].freq != AR5K_EEPROM_CHANNEL_DIS) - ee->ee_n_piers[mode]++; - - AR5K_EEPROM_READ(o++, val); - ee->ee_turbo_max_power[mode] = val & 0x7f; - ee->ee_xr_power[mode] = (val >> 7) & 0x3f; - - AR5K_EEPROM_READ(o++, val); - ee->ee_pwr_cal_g[2].freq = - ath5k_eeprom_bin2freq(ee, val & 0xff, mode); - if (ee->ee_pwr_cal_g[2].freq != AR5K_EEPROM_CHANNEL_DIS) - ee->ee_n_piers[mode]++; - - if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_1) - ee->ee_margin_tx_rx[mode] = (val >> 8) & 0x3f; - - AR5K_EEPROM_READ(o++, val); - ee->ee_i_cal[mode] = (val >> 5) & 0x3f; - ee->ee_q_cal[mode] = val & 0x1f; - - if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_2) { - AR5K_EEPROM_READ(o++, val); - ee->ee_cck_ofdm_gain_delta = val & 0xff; - } - break; - } - - /* - * Read turbo mode information on newer EEPROM versions - */ - if (ee->ee_version < AR5K_EEPROM_VERSION_5_0) - goto done; - - switch (mode) { - case AR5K_EEPROM_MODE_11A: - ee->ee_switch_settling_turbo[mode] = (val >> 6) & 0x7f; - - ee->ee_atn_tx_rx_turbo[mode] = (val >> 13) & 0x7; - AR5K_EEPROM_READ(o++, val); - ee->ee_atn_tx_rx_turbo[mode] |= (val & 0x7) << 3; - ee->ee_margin_tx_rx_turbo[mode] = (val >> 3) & 0x3f; - - ee->ee_adc_desired_size_turbo[mode] = (val >> 9) & 0x7f; - AR5K_EEPROM_READ(o++, val); - ee->ee_adc_desired_size_turbo[mode] |= (val & 0x1) << 7; - ee->ee_pga_desired_size_turbo[mode] = (val >> 1) & 0xff; - - if (AR5K_EEPROM_EEMAP(ee->ee_misc0) >= 2) - ee->ee_pd_gain_overlap = (val >> 9) & 0xf; - break; - case AR5K_EEPROM_MODE_11G: - ee->ee_switch_settling_turbo[mode] = (val >> 8) & 0x7f; - - ee->ee_atn_tx_rx_turbo[mode] = (val >> 15) & 0x7; - AR5K_EEPROM_READ(o++, val); - ee->ee_atn_tx_rx_turbo[mode] |= (val & 0x1f) << 1; - ee->ee_margin_tx_rx_turbo[mode] = (val >> 5) & 0x3f; - - ee->ee_adc_desired_size_turbo[mode] = (val >> 11) & 0x7f; - AR5K_EEPROM_READ(o++, val); - ee->ee_adc_desired_size_turbo[mode] |= (val & 0x7) << 5; - ee->ee_pga_desired_size_turbo[mode] = (val >> 3) & 0xff; - break; - } - -done: - /* return new offset */ - *offset = o; - - return 0; -} - -/* Read mode-specific data (except power calibration data) */ -static int -ath5k_eeprom_init_modes(struct ath5k_hw *ah) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - u32 mode_offset[3]; - unsigned int mode; - u32 offset; - int ret; - - /* - * Get values for all modes - */ - mode_offset[AR5K_EEPROM_MODE_11A] = AR5K_EEPROM_MODES_11A(ah->ah_ee_version); - mode_offset[AR5K_EEPROM_MODE_11B] = AR5K_EEPROM_MODES_11B(ah->ah_ee_version); - mode_offset[AR5K_EEPROM_MODE_11G] = AR5K_EEPROM_MODES_11G(ah->ah_ee_version); - - ee->ee_turbo_max_power[AR5K_EEPROM_MODE_11A] = - AR5K_EEPROM_HDR_T_5GHZ_DBM(ee->ee_header); - - for (mode = AR5K_EEPROM_MODE_11A; mode <= AR5K_EEPROM_MODE_11G; mode++) { - offset = mode_offset[mode]; - - ret = ath5k_eeprom_read_ants(ah, &offset, mode); - if (ret) - return ret; - - ret = ath5k_eeprom_read_modes(ah, &offset, mode); - if (ret) - return ret; - } - - /* override for older eeprom versions for better performance */ - if (ah->ah_ee_version <= AR5K_EEPROM_VERSION_3_2) { - ee->ee_thr_62[AR5K_EEPROM_MODE_11A] = 15; - ee->ee_thr_62[AR5K_EEPROM_MODE_11B] = 28; - ee->ee_thr_62[AR5K_EEPROM_MODE_11G] = 28; - } - - return 0; -} - -/* Read the frequency piers for each mode (mostly used on newer eeproms with 0xff - * frequency mask) */ -static inline int -ath5k_eeprom_read_freq_list(struct ath5k_hw *ah, int *offset, int max, - struct ath5k_chan_pcal_info *pc, unsigned int mode) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - int o = *offset; - int i = 0; - u8 freq1, freq2; - u16 val; - - ee->ee_n_piers[mode] = 0; - while (i < max) { - AR5K_EEPROM_READ(o++, val); - - freq1 = val & 0xff; - if (!freq1) - break; - - pc[i++].freq = ath5k_eeprom_bin2freq(ee, - freq1, mode); - ee->ee_n_piers[mode]++; - - freq2 = (val >> 8) & 0xff; - if (!freq2) - break; - - pc[i++].freq = ath5k_eeprom_bin2freq(ee, - freq2, mode); - ee->ee_n_piers[mode]++; - } - - /* return new offset */ - *offset = o; - - return 0; -} - -/* Read frequency piers for 802.11a */ -static int -ath5k_eeprom_init_11a_pcal_freq(struct ath5k_hw *ah, int offset) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - struct ath5k_chan_pcal_info *pcal = ee->ee_pwr_cal_a; - int i; - u16 val; - u8 mask; - - if (ee->ee_version >= AR5K_EEPROM_VERSION_3_3) { - ath5k_eeprom_read_freq_list(ah, &offset, - AR5K_EEPROM_N_5GHZ_CHAN, pcal, - AR5K_EEPROM_MODE_11A); - } else { - mask = AR5K_EEPROM_FREQ_M(ah->ah_ee_version); - - AR5K_EEPROM_READ(offset++, val); - pcal[0].freq = (val >> 9) & mask; - pcal[1].freq = (val >> 2) & mask; - pcal[2].freq = (val << 5) & mask; - - AR5K_EEPROM_READ(offset++, val); - pcal[2].freq |= (val >> 11) & 0x1f; - pcal[3].freq = (val >> 4) & mask; - pcal[4].freq = (val << 3) & mask; - - AR5K_EEPROM_READ(offset++, val); - pcal[4].freq |= (val >> 13) & 0x7; - pcal[5].freq = (val >> 6) & mask; - pcal[6].freq = (val << 1) & mask; - - AR5K_EEPROM_READ(offset++, val); - pcal[6].freq |= (val >> 15) & 0x1; - pcal[7].freq = (val >> 8) & mask; - pcal[8].freq = (val >> 1) & mask; - pcal[9].freq = (val << 6) & mask; - - AR5K_EEPROM_READ(offset++, val); - pcal[9].freq |= (val >> 10) & 0x3f; - - /* Fixed number of piers */ - ee->ee_n_piers[AR5K_EEPROM_MODE_11A] = 10; - - for (i = 0; i < AR5K_EEPROM_N_5GHZ_CHAN; i++) { - pcal[i].freq = ath5k_eeprom_bin2freq(ee, - pcal[i].freq, AR5K_EEPROM_MODE_11A); - } - } - - return 0; -} - -/* Read frequency piers for 802.11bg on eeprom versions >= 5 and eemap >= 2 */ -static inline int -ath5k_eeprom_init_11bg_2413(struct ath5k_hw *ah, unsigned int mode, int offset) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - struct ath5k_chan_pcal_info *pcal; - - switch (mode) { - case AR5K_EEPROM_MODE_11B: - pcal = ee->ee_pwr_cal_b; - break; - case AR5K_EEPROM_MODE_11G: - pcal = ee->ee_pwr_cal_g; - break; - default: - return -EINVAL; - } - - ath5k_eeprom_read_freq_list(ah, &offset, - AR5K_EEPROM_N_2GHZ_CHAN_2413, pcal, - mode); - - return 0; -} - - -/* - * Read power calibration for RF5111 chips - * - * For RF5111 we have an XPD -eXternal Power Detector- curve - * for each calibrated channel. Each curve has 0,5dB Power steps - * on x axis and PCDAC steps (offsets) on y axis and looks like an - * exponential function. To recreate the curve we read 11 points - * here and interpolate later. - */ - -/* Used to match PCDAC steps with power values on RF5111 chips - * (eeprom versions < 4). For RF5111 we have 11 pre-defined PCDAC - * steps that match with the power values we read from eeprom. On - * older eeprom versions (< 3.2) these steps are equally spaced at - * 10% of the pcdac curve -until the curve reaches its maximum- - * (11 steps from 0 to 100%) but on newer eeprom versions (>= 3.2) - * these 11 steps are spaced in a different way. This function returns - * the pcdac steps based on eeprom version and curve min/max so that we - * can have pcdac/pwr points. - */ -static inline void -ath5k_get_pcdac_intercepts(struct ath5k_hw *ah, u8 min, u8 max, u8 *vp) -{ - static const u16 intercepts3[] = { - 0, 5, 10, 20, 30, 50, 70, 85, 90, 95, 100 - }; - static const u16 intercepts3_2[] = { - 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 - }; - const u16 *ip; - int i; - - if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_3_2) - ip = intercepts3_2; - else - ip = intercepts3; - - for (i = 0; i < ARRAY_SIZE(intercepts3); i++) - vp[i] = (ip[i] * max + (100 - ip[i]) * min) / 100; -} - -static int -ath5k_eeprom_free_pcal_info(struct ath5k_hw *ah, int mode) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - struct ath5k_chan_pcal_info *chinfo; - u8 pier, pdg; - - switch (mode) { - case AR5K_EEPROM_MODE_11A: - if (!AR5K_EEPROM_HDR_11A(ee->ee_header)) - return 0; - chinfo = ee->ee_pwr_cal_a; - break; - case AR5K_EEPROM_MODE_11B: - if (!AR5K_EEPROM_HDR_11B(ee->ee_header)) - return 0; - chinfo = ee->ee_pwr_cal_b; - break; - case AR5K_EEPROM_MODE_11G: - if (!AR5K_EEPROM_HDR_11G(ee->ee_header)) - return 0; - chinfo = ee->ee_pwr_cal_g; - break; - default: - return -EINVAL; - } - - for (pier = 0; pier < ee->ee_n_piers[mode]; pier++) { - if (!chinfo[pier].pd_curves) - continue; - - for (pdg = 0; pdg < AR5K_EEPROM_N_PD_CURVES; pdg++) { - struct ath5k_pdgain_info *pd = - &chinfo[pier].pd_curves[pdg]; - - kfree(pd->pd_step); - kfree(pd->pd_pwr); - } - - kfree(chinfo[pier].pd_curves); - } - - return 0; -} - -/* Convert RF5111 specific data to generic raw data - * used by interpolation code */ -static int -ath5k_eeprom_convert_pcal_info_5111(struct ath5k_hw *ah, int mode, - struct ath5k_chan_pcal_info *chinfo) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - struct ath5k_chan_pcal_info_rf5111 *pcinfo; - struct ath5k_pdgain_info *pd; - u8 pier, point, idx; - u8 *pdgain_idx = ee->ee_pdc_to_idx[mode]; - - /* Fill raw data for each calibration pier */ - for (pier = 0; pier < ee->ee_n_piers[mode]; pier++) { - - pcinfo = &chinfo[pier].rf5111_info; - - /* Allocate pd_curves for this cal pier */ - chinfo[pier].pd_curves = - kcalloc(AR5K_EEPROM_N_PD_CURVES, - sizeof(struct ath5k_pdgain_info), - GFP_KERNEL); - - if (!chinfo[pier].pd_curves) - goto err_out; - - /* Only one curve for RF5111 - * find out which one and place - * in pd_curves. - * Note: ee_x_gain is reversed here */ - for (idx = 0; idx < AR5K_EEPROM_N_PD_CURVES; idx++) { - - if (!((ee->ee_x_gain[mode] >> idx) & 0x1)) { - pdgain_idx[0] = idx; - break; - } - } - - ee->ee_pd_gains[mode] = 1; - - pd = &chinfo[pier].pd_curves[idx]; - - pd->pd_points = AR5K_EEPROM_N_PWR_POINTS_5111; - - /* Allocate pd points for this curve */ - pd->pd_step = kcalloc(AR5K_EEPROM_N_PWR_POINTS_5111, - sizeof(u8), GFP_KERNEL); - if (!pd->pd_step) - goto err_out; - - pd->pd_pwr = kcalloc(AR5K_EEPROM_N_PWR_POINTS_5111, - sizeof(s16), GFP_KERNEL); - if (!pd->pd_pwr) - goto err_out; - - /* Fill raw dataset - * (convert power to 0.25dB units - * for RF5112 compatibility) */ - for (point = 0; point < pd->pd_points; point++) { - - /* Absolute values */ - pd->pd_pwr[point] = 2 * pcinfo->pwr[point]; - - /* Already sorted */ - pd->pd_step[point] = pcinfo->pcdac[point]; - } - - /* Set min/max pwr */ - chinfo[pier].min_pwr = pd->pd_pwr[0]; - chinfo[pier].max_pwr = pd->pd_pwr[10]; - - } - - return 0; - -err_out: - ath5k_eeprom_free_pcal_info(ah, mode); - return -ENOMEM; -} - -/* Parse EEPROM data */ -static int -ath5k_eeprom_read_pcal_info_5111(struct ath5k_hw *ah, int mode) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - struct ath5k_chan_pcal_info *pcal; - int offset, ret; - int i; - u16 val; - - offset = AR5K_EEPROM_GROUPS_START(ee->ee_version); - switch (mode) { - case AR5K_EEPROM_MODE_11A: - if (!AR5K_EEPROM_HDR_11A(ee->ee_header)) - return 0; - - ret = ath5k_eeprom_init_11a_pcal_freq(ah, - offset + AR5K_EEPROM_GROUP1_OFFSET); - if (ret < 0) - return ret; - - offset += AR5K_EEPROM_GROUP2_OFFSET; - pcal = ee->ee_pwr_cal_a; - break; - case AR5K_EEPROM_MODE_11B: - if (!AR5K_EEPROM_HDR_11B(ee->ee_header) && - !AR5K_EEPROM_HDR_11G(ee->ee_header)) - return 0; - - pcal = ee->ee_pwr_cal_b; - offset += AR5K_EEPROM_GROUP3_OFFSET; - - /* fixed piers */ - pcal[0].freq = 2412; - pcal[1].freq = 2447; - pcal[2].freq = 2484; - ee->ee_n_piers[mode] = 3; - break; - case AR5K_EEPROM_MODE_11G: - if (!AR5K_EEPROM_HDR_11G(ee->ee_header)) - return 0; - - pcal = ee->ee_pwr_cal_g; - offset += AR5K_EEPROM_GROUP4_OFFSET; - - /* fixed piers */ - pcal[0].freq = 2312; - pcal[1].freq = 2412; - pcal[2].freq = 2484; - ee->ee_n_piers[mode] = 3; - break; - default: - return -EINVAL; - } - - for (i = 0; i < ee->ee_n_piers[mode]; i++) { - struct ath5k_chan_pcal_info_rf5111 *cdata = - &pcal[i].rf5111_info; - - AR5K_EEPROM_READ(offset++, val); - cdata->pcdac_max = ((val >> 10) & AR5K_EEPROM_PCDAC_M); - cdata->pcdac_min = ((val >> 4) & AR5K_EEPROM_PCDAC_M); - cdata->pwr[0] = ((val << 2) & AR5K_EEPROM_POWER_M); - - AR5K_EEPROM_READ(offset++, val); - cdata->pwr[0] |= ((val >> 14) & 0x3); - cdata->pwr[1] = ((val >> 8) & AR5K_EEPROM_POWER_M); - cdata->pwr[2] = ((val >> 2) & AR5K_EEPROM_POWER_M); - cdata->pwr[3] = ((val << 4) & AR5K_EEPROM_POWER_M); - - AR5K_EEPROM_READ(offset++, val); - cdata->pwr[3] |= ((val >> 12) & 0xf); - cdata->pwr[4] = ((val >> 6) & AR5K_EEPROM_POWER_M); - cdata->pwr[5] = (val & AR5K_EEPROM_POWER_M); - - AR5K_EEPROM_READ(offset++, val); - cdata->pwr[6] = ((val >> 10) & AR5K_EEPROM_POWER_M); - cdata->pwr[7] = ((val >> 4) & AR5K_EEPROM_POWER_M); - cdata->pwr[8] = ((val << 2) & AR5K_EEPROM_POWER_M); - - AR5K_EEPROM_READ(offset++, val); - cdata->pwr[8] |= ((val >> 14) & 0x3); - cdata->pwr[9] = ((val >> 8) & AR5K_EEPROM_POWER_M); - cdata->pwr[10] = ((val >> 2) & AR5K_EEPROM_POWER_M); - - ath5k_get_pcdac_intercepts(ah, cdata->pcdac_min, - cdata->pcdac_max, cdata->pcdac); - } - - return ath5k_eeprom_convert_pcal_info_5111(ah, mode, pcal); -} - - -/* - * Read power calibration for RF5112 chips - * - * For RF5112 we have 4 XPD -eXternal Power Detector- curves - * for each calibrated channel on 0, -6, -12 and -18dBm but we only - * use the higher (3) and the lower (0) curves. Each curve has 0.5dB - * power steps on x axis and PCDAC steps on y axis and looks like a - * linear function. To recreate the curve and pass the power values - * on hw, we read 4 points for xpd 0 (lower gain -> max power) - * and 3 points for xpd 3 (higher gain -> lower power) here and - * interpolate later. - * - * Note: Many vendors just use xpd 0 so xpd 3 is zeroed. - */ - -/* Convert RF5112 specific data to generic raw data - * used by interpolation code */ -static int -ath5k_eeprom_convert_pcal_info_5112(struct ath5k_hw *ah, int mode, - struct ath5k_chan_pcal_info *chinfo) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - struct ath5k_chan_pcal_info_rf5112 *pcinfo; - u8 *pdgain_idx = ee->ee_pdc_to_idx[mode]; - unsigned int pier, pdg, point; - - /* Fill raw data for each calibration pier */ - for (pier = 0; pier < ee->ee_n_piers[mode]; pier++) { - - pcinfo = &chinfo[pier].rf5112_info; - - /* Allocate pd_curves for this cal pier */ - chinfo[pier].pd_curves = - kcalloc(AR5K_EEPROM_N_PD_CURVES, - sizeof(struct ath5k_pdgain_info), - GFP_KERNEL); - - if (!chinfo[pier].pd_curves) - goto err_out; - - /* Fill pd_curves */ - for (pdg = 0; pdg < ee->ee_pd_gains[mode]; pdg++) { - - u8 idx = pdgain_idx[pdg]; - struct ath5k_pdgain_info *pd = - &chinfo[pier].pd_curves[idx]; - - /* Lowest gain curve (max power) */ - if (pdg == 0) { - /* One more point for better accuracy */ - pd->pd_points = AR5K_EEPROM_N_XPD0_POINTS; - - /* Allocate pd points for this curve */ - pd->pd_step = kcalloc(pd->pd_points, - sizeof(u8), GFP_KERNEL); - - if (!pd->pd_step) - goto err_out; - - pd->pd_pwr = kcalloc(pd->pd_points, - sizeof(s16), GFP_KERNEL); - - if (!pd->pd_pwr) - goto err_out; - - /* Fill raw dataset - * (all power levels are in 0.25dB units) */ - pd->pd_step[0] = pcinfo->pcdac_x0[0]; - pd->pd_pwr[0] = pcinfo->pwr_x0[0]; - - for (point = 1; point < pd->pd_points; - point++) { - /* Absolute values */ - pd->pd_pwr[point] = - pcinfo->pwr_x0[point]; - - /* Deltas */ - pd->pd_step[point] = - pd->pd_step[point - 1] + - pcinfo->pcdac_x0[point]; - } - - /* Set min power for this frequency */ - chinfo[pier].min_pwr = pd->pd_pwr[0]; - - /* Highest gain curve (min power) */ - } else if (pdg == 1) { - - pd->pd_points = AR5K_EEPROM_N_XPD3_POINTS; - - /* Allocate pd points for this curve */ - pd->pd_step = kcalloc(pd->pd_points, - sizeof(u8), GFP_KERNEL); - - if (!pd->pd_step) - goto err_out; - - pd->pd_pwr = kcalloc(pd->pd_points, - sizeof(s16), GFP_KERNEL); - - if (!pd->pd_pwr) - goto err_out; - - /* Fill raw dataset - * (all power levels are in 0.25dB units) */ - for (point = 0; point < pd->pd_points; - point++) { - /* Absolute values */ - pd->pd_pwr[point] = - pcinfo->pwr_x3[point]; - - /* Fixed points */ - pd->pd_step[point] = - pcinfo->pcdac_x3[point]; - } - - /* Since we have a higher gain curve - * override min power */ - chinfo[pier].min_pwr = pd->pd_pwr[0]; - } - } - } - - return 0; - -err_out: - ath5k_eeprom_free_pcal_info(ah, mode); - return -ENOMEM; -} - -/* Parse EEPROM data */ -static int -ath5k_eeprom_read_pcal_info_5112(struct ath5k_hw *ah, int mode) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - struct ath5k_chan_pcal_info_rf5112 *chan_pcal_info; - struct ath5k_chan_pcal_info *gen_chan_info; - u8 *pdgain_idx = ee->ee_pdc_to_idx[mode]; - u32 offset; - u8 i, c; - u16 val; - u8 pd_gains = 0; - - /* Count how many curves we have and - * identify them (which one of the 4 - * available curves we have on each count). - * Curves are stored from lower (x0) to - * higher (x3) gain */ - for (i = 0; i < AR5K_EEPROM_N_PD_CURVES; i++) { - /* ee_x_gain[mode] is x gain mask */ - if ((ee->ee_x_gain[mode] >> i) & 0x1) - pdgain_idx[pd_gains++] = i; - } - ee->ee_pd_gains[mode] = pd_gains; - - if (pd_gains == 0 || pd_gains > 2) - return -EINVAL; - - switch (mode) { - case AR5K_EEPROM_MODE_11A: - /* - * Read 5GHz EEPROM channels - */ - offset = AR5K_EEPROM_GROUPS_START(ee->ee_version); - ath5k_eeprom_init_11a_pcal_freq(ah, offset); - - offset += AR5K_EEPROM_GROUP2_OFFSET; - gen_chan_info = ee->ee_pwr_cal_a; - break; - case AR5K_EEPROM_MODE_11B: - offset = AR5K_EEPROM_GROUPS_START(ee->ee_version); - if (AR5K_EEPROM_HDR_11A(ee->ee_header)) - offset += AR5K_EEPROM_GROUP3_OFFSET; - - /* NB: frequency piers parsed during mode init */ - gen_chan_info = ee->ee_pwr_cal_b; - break; - case AR5K_EEPROM_MODE_11G: - offset = AR5K_EEPROM_GROUPS_START(ee->ee_version); - if (AR5K_EEPROM_HDR_11A(ee->ee_header)) - offset += AR5K_EEPROM_GROUP4_OFFSET; - else if (AR5K_EEPROM_HDR_11B(ee->ee_header)) - offset += AR5K_EEPROM_GROUP2_OFFSET; - - /* NB: frequency piers parsed during mode init */ - gen_chan_info = ee->ee_pwr_cal_g; - break; - default: - return -EINVAL; - } - - for (i = 0; i < ee->ee_n_piers[mode]; i++) { - chan_pcal_info = &gen_chan_info[i].rf5112_info; - - /* Power values in quarter dB - * for the lower xpd gain curve - * (0 dBm -> higher output power) */ - for (c = 0; c < AR5K_EEPROM_N_XPD0_POINTS; c++) { - AR5K_EEPROM_READ(offset++, val); - chan_pcal_info->pwr_x0[c] = (s8) (val & 0xff); - chan_pcal_info->pwr_x0[++c] = (s8) ((val >> 8) & 0xff); - } - - /* PCDAC steps - * corresponding to the above power - * measurements */ - AR5K_EEPROM_READ(offset++, val); - chan_pcal_info->pcdac_x0[1] = (val & 0x1f); - chan_pcal_info->pcdac_x0[2] = ((val >> 5) & 0x1f); - chan_pcal_info->pcdac_x0[3] = ((val >> 10) & 0x1f); - - /* Power values in quarter dB - * for the higher xpd gain curve - * (18 dBm -> lower output power) */ - AR5K_EEPROM_READ(offset++, val); - chan_pcal_info->pwr_x3[0] = (s8) (val & 0xff); - chan_pcal_info->pwr_x3[1] = (s8) ((val >> 8) & 0xff); - - AR5K_EEPROM_READ(offset++, val); - chan_pcal_info->pwr_x3[2] = (val & 0xff); - - /* PCDAC steps - * corresponding to the above power - * measurements (fixed) */ - chan_pcal_info->pcdac_x3[0] = 20; - chan_pcal_info->pcdac_x3[1] = 35; - chan_pcal_info->pcdac_x3[2] = 63; - - if (ee->ee_version >= AR5K_EEPROM_VERSION_4_3) { - chan_pcal_info->pcdac_x0[0] = ((val >> 8) & 0x3f); - - /* Last xpd0 power level is also channel maximum */ - gen_chan_info[i].max_pwr = chan_pcal_info->pwr_x0[3]; - } else { - chan_pcal_info->pcdac_x0[0] = 1; - gen_chan_info[i].max_pwr = (s8) ((val >> 8) & 0xff); - } - - } - - return ath5k_eeprom_convert_pcal_info_5112(ah, mode, gen_chan_info); -} - - -/* - * Read power calibration for RF2413 chips - * - * For RF2413 we have a Power to PDDAC table (Power Detector) - * instead of a PCDAC and 4 pd gain curves for each calibrated channel. - * Each curve has power on x axis in 0.5 db steps and PDDADC steps on y - * axis and looks like an exponential function like the RF5111 curve. - * - * To recreate the curves we read here the points and interpolate - * later. Note that in most cases only 2 (higher and lower) curves are - * used (like RF5112) but vendors have the opportunity to include all - * 4 curves on eeprom. The final curve (higher power) has an extra - * point for better accuracy like RF5112. - */ - -/* For RF2413 power calibration data doesn't start on a fixed location and - * if a mode is not supported, its section is missing -not zeroed-. - * So we need to calculate the starting offset for each section by using - * these two functions */ - -/* Return the size of each section based on the mode and the number of pd - * gains available (maximum 4). */ -static inline unsigned int -ath5k_pdgains_size_2413(struct ath5k_eeprom_info *ee, unsigned int mode) -{ - static const unsigned int pdgains_size[] = { 4, 6, 9, 12 }; - unsigned int sz; - - sz = pdgains_size[ee->ee_pd_gains[mode] - 1]; - sz *= ee->ee_n_piers[mode]; - - return sz; -} - -/* Return the starting offset for a section based on the modes supported - * and each section's size. */ -static unsigned int -ath5k_cal_data_offset_2413(struct ath5k_eeprom_info *ee, int mode) -{ - u32 offset = AR5K_EEPROM_CAL_DATA_START(ee->ee_misc4); - - switch (mode) { - case AR5K_EEPROM_MODE_11G: - if (AR5K_EEPROM_HDR_11B(ee->ee_header)) - offset += ath5k_pdgains_size_2413(ee, - AR5K_EEPROM_MODE_11B) + - AR5K_EEPROM_N_2GHZ_CHAN_2413 / 2; - /* fall through */ - case AR5K_EEPROM_MODE_11B: - if (AR5K_EEPROM_HDR_11A(ee->ee_header)) - offset += ath5k_pdgains_size_2413(ee, - AR5K_EEPROM_MODE_11A) + - AR5K_EEPROM_N_5GHZ_CHAN / 2; - /* fall through */ - case AR5K_EEPROM_MODE_11A: - break; - default: - break; - } - - return offset; -} - -/* Convert RF2413 specific data to generic raw data - * used by interpolation code */ -static int -ath5k_eeprom_convert_pcal_info_2413(struct ath5k_hw *ah, int mode, - struct ath5k_chan_pcal_info *chinfo) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - struct ath5k_chan_pcal_info_rf2413 *pcinfo; - u8 *pdgain_idx = ee->ee_pdc_to_idx[mode]; - unsigned int pier, pdg, point; - - /* Fill raw data for each calibration pier */ - for (pier = 0; pier < ee->ee_n_piers[mode]; pier++) { - - pcinfo = &chinfo[pier].rf2413_info; - - /* Allocate pd_curves for this cal pier */ - chinfo[pier].pd_curves = - kcalloc(AR5K_EEPROM_N_PD_CURVES, - sizeof(struct ath5k_pdgain_info), - GFP_KERNEL); - - if (!chinfo[pier].pd_curves) - goto err_out; - - /* Fill pd_curves */ - for (pdg = 0; pdg < ee->ee_pd_gains[mode]; pdg++) { - - u8 idx = pdgain_idx[pdg]; - struct ath5k_pdgain_info *pd = - &chinfo[pier].pd_curves[idx]; - - /* One more point for the highest power - * curve (lowest gain) */ - if (pdg == ee->ee_pd_gains[mode] - 1) - pd->pd_points = AR5K_EEPROM_N_PD_POINTS; - else - pd->pd_points = AR5K_EEPROM_N_PD_POINTS - 1; - - /* Allocate pd points for this curve */ - pd->pd_step = kcalloc(pd->pd_points, - sizeof(u8), GFP_KERNEL); - - if (!pd->pd_step) - goto err_out; - - pd->pd_pwr = kcalloc(pd->pd_points, - sizeof(s16), GFP_KERNEL); - - if (!pd->pd_pwr) - goto err_out; - - /* Fill raw dataset - * convert all pwr levels to - * quarter dB for RF5112 compatibility */ - pd->pd_step[0] = pcinfo->pddac_i[pdg]; - pd->pd_pwr[0] = 4 * pcinfo->pwr_i[pdg]; - - for (point = 1; point < pd->pd_points; point++) { - - pd->pd_pwr[point] = pd->pd_pwr[point - 1] + - 2 * pcinfo->pwr[pdg][point - 1]; - - pd->pd_step[point] = pd->pd_step[point - 1] + - pcinfo->pddac[pdg][point - 1]; - - } - - /* Highest gain curve -> min power */ - if (pdg == 0) - chinfo[pier].min_pwr = pd->pd_pwr[0]; - - /* Lowest gain curve -> max power */ - if (pdg == ee->ee_pd_gains[mode] - 1) - chinfo[pier].max_pwr = - pd->pd_pwr[pd->pd_points - 1]; - } - } - - return 0; - -err_out: - ath5k_eeprom_free_pcal_info(ah, mode); - return -ENOMEM; -} - -/* Parse EEPROM data */ -static int -ath5k_eeprom_read_pcal_info_2413(struct ath5k_hw *ah, int mode) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - struct ath5k_chan_pcal_info_rf2413 *pcinfo; - struct ath5k_chan_pcal_info *chinfo; - u8 *pdgain_idx = ee->ee_pdc_to_idx[mode]; - u32 offset; - int idx, i; - u16 val; - u8 pd_gains = 0; - - /* Count how many curves we have and - * identify them (which one of the 4 - * available curves we have on each count). - * Curves are stored from higher to - * lower gain so we go backwards */ - for (idx = AR5K_EEPROM_N_PD_CURVES - 1; idx >= 0; idx--) { - /* ee_x_gain[mode] is x gain mask */ - if ((ee->ee_x_gain[mode] >> idx) & 0x1) - pdgain_idx[pd_gains++] = idx; - - } - ee->ee_pd_gains[mode] = pd_gains; - - if (pd_gains == 0) - return -EINVAL; - - offset = ath5k_cal_data_offset_2413(ee, mode); - switch (mode) { - case AR5K_EEPROM_MODE_11A: - if (!AR5K_EEPROM_HDR_11A(ee->ee_header)) - return 0; - - ath5k_eeprom_init_11a_pcal_freq(ah, offset); - offset += AR5K_EEPROM_N_5GHZ_CHAN / 2; - chinfo = ee->ee_pwr_cal_a; - break; - case AR5K_EEPROM_MODE_11B: - if (!AR5K_EEPROM_HDR_11B(ee->ee_header)) - return 0; - - ath5k_eeprom_init_11bg_2413(ah, mode, offset); - offset += AR5K_EEPROM_N_2GHZ_CHAN_2413 / 2; - chinfo = ee->ee_pwr_cal_b; - break; - case AR5K_EEPROM_MODE_11G: - if (!AR5K_EEPROM_HDR_11G(ee->ee_header)) - return 0; - - ath5k_eeprom_init_11bg_2413(ah, mode, offset); - offset += AR5K_EEPROM_N_2GHZ_CHAN_2413 / 2; - chinfo = ee->ee_pwr_cal_g; - break; - default: - return -EINVAL; - } - - for (i = 0; i < ee->ee_n_piers[mode]; i++) { - pcinfo = &chinfo[i].rf2413_info; - - /* - * Read pwr_i, pddac_i and the first - * 2 pd points (pwr, pddac) - */ - AR5K_EEPROM_READ(offset++, val); - pcinfo->pwr_i[0] = val & 0x1f; - pcinfo->pddac_i[0] = (val >> 5) & 0x7f; - pcinfo->pwr[0][0] = (val >> 12) & 0xf; - - AR5K_EEPROM_READ(offset++, val); - pcinfo->pddac[0][0] = val & 0x3f; - pcinfo->pwr[0][1] = (val >> 6) & 0xf; - pcinfo->pddac[0][1] = (val >> 10) & 0x3f; - - AR5K_EEPROM_READ(offset++, val); - pcinfo->pwr[0][2] = val & 0xf; - pcinfo->pddac[0][2] = (val >> 4) & 0x3f; - - pcinfo->pwr[0][3] = 0; - pcinfo->pddac[0][3] = 0; - - if (pd_gains > 1) { - /* - * Pd gain 0 is not the last pd gain - * so it only has 2 pd points. - * Continue with pd gain 1. - */ - pcinfo->pwr_i[1] = (val >> 10) & 0x1f; - - pcinfo->pddac_i[1] = (val >> 15) & 0x1; - AR5K_EEPROM_READ(offset++, val); - pcinfo->pddac_i[1] |= (val & 0x3F) << 1; - - pcinfo->pwr[1][0] = (val >> 6) & 0xf; - pcinfo->pddac[1][0] = (val >> 10) & 0x3f; - - AR5K_EEPROM_READ(offset++, val); - pcinfo->pwr[1][1] = val & 0xf; - pcinfo->pddac[1][1] = (val >> 4) & 0x3f; - pcinfo->pwr[1][2] = (val >> 10) & 0xf; - - pcinfo->pddac[1][2] = (val >> 14) & 0x3; - AR5K_EEPROM_READ(offset++, val); - pcinfo->pddac[1][2] |= (val & 0xF) << 2; - - pcinfo->pwr[1][3] = 0; - pcinfo->pddac[1][3] = 0; - } else if (pd_gains == 1) { - /* - * Pd gain 0 is the last one so - * read the extra point. - */ - pcinfo->pwr[0][3] = (val >> 10) & 0xf; - - pcinfo->pddac[0][3] = (val >> 14) & 0x3; - AR5K_EEPROM_READ(offset++, val); - pcinfo->pddac[0][3] |= (val & 0xF) << 2; - } - - /* - * Proceed with the other pd_gains - * as above. - */ - if (pd_gains > 2) { - pcinfo->pwr_i[2] = (val >> 4) & 0x1f; - pcinfo->pddac_i[2] = (val >> 9) & 0x7f; - - AR5K_EEPROM_READ(offset++, val); - pcinfo->pwr[2][0] = (val >> 0) & 0xf; - pcinfo->pddac[2][0] = (val >> 4) & 0x3f; - pcinfo->pwr[2][1] = (val >> 10) & 0xf; - - pcinfo->pddac[2][1] = (val >> 14) & 0x3; - AR5K_EEPROM_READ(offset++, val); - pcinfo->pddac[2][1] |= (val & 0xF) << 2; - - pcinfo->pwr[2][2] = (val >> 4) & 0xf; - pcinfo->pddac[2][2] = (val >> 8) & 0x3f; - - pcinfo->pwr[2][3] = 0; - pcinfo->pddac[2][3] = 0; - } else if (pd_gains == 2) { - pcinfo->pwr[1][3] = (val >> 4) & 0xf; - pcinfo->pddac[1][3] = (val >> 8) & 0x3f; - } - - if (pd_gains > 3) { - pcinfo->pwr_i[3] = (val >> 14) & 0x3; - AR5K_EEPROM_READ(offset++, val); - pcinfo->pwr_i[3] |= ((val >> 0) & 0x7) << 2; - - pcinfo->pddac_i[3] = (val >> 3) & 0x7f; - pcinfo->pwr[3][0] = (val >> 10) & 0xf; - pcinfo->pddac[3][0] = (val >> 14) & 0x3; - - AR5K_EEPROM_READ(offset++, val); - pcinfo->pddac[3][0] |= (val & 0xF) << 2; - pcinfo->pwr[3][1] = (val >> 4) & 0xf; - pcinfo->pddac[3][1] = (val >> 8) & 0x3f; - - pcinfo->pwr[3][2] = (val >> 14) & 0x3; - AR5K_EEPROM_READ(offset++, val); - pcinfo->pwr[3][2] |= ((val >> 0) & 0x3) << 2; - - pcinfo->pddac[3][2] = (val >> 2) & 0x3f; - pcinfo->pwr[3][3] = (val >> 8) & 0xf; - - pcinfo->pddac[3][3] = (val >> 12) & 0xF; - AR5K_EEPROM_READ(offset++, val); - pcinfo->pddac[3][3] |= ((val >> 0) & 0x3) << 4; - } else if (pd_gains == 3) { - pcinfo->pwr[2][3] = (val >> 14) & 0x3; - AR5K_EEPROM_READ(offset++, val); - pcinfo->pwr[2][3] |= ((val >> 0) & 0x3) << 2; - - pcinfo->pddac[2][3] = (val >> 2) & 0x3f; - } - } - - return ath5k_eeprom_convert_pcal_info_2413(ah, mode, chinfo); -} - - -/* - * Read per rate target power (this is the maximum tx power - * supported by the card). This info is used when setting - * tx power, no matter the channel. - * - * This also works for v5 EEPROMs. - */ -static int -ath5k_eeprom_read_target_rate_pwr_info(struct ath5k_hw *ah, unsigned int mode) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - struct ath5k_rate_pcal_info *rate_pcal_info; - u8 *rate_target_pwr_num; - u32 offset; - u16 val; - int i; - - offset = AR5K_EEPROM_TARGET_PWRSTART(ee->ee_misc1); - rate_target_pwr_num = &ee->ee_rate_target_pwr_num[mode]; - switch (mode) { - case AR5K_EEPROM_MODE_11A: - offset += AR5K_EEPROM_TARGET_PWR_OFF_11A(ee->ee_version); - rate_pcal_info = ee->ee_rate_tpwr_a; - ee->ee_rate_target_pwr_num[mode] = AR5K_EEPROM_N_5GHZ_RATE_CHAN; - break; - case AR5K_EEPROM_MODE_11B: - offset += AR5K_EEPROM_TARGET_PWR_OFF_11B(ee->ee_version); - rate_pcal_info = ee->ee_rate_tpwr_b; - ee->ee_rate_target_pwr_num[mode] = 2; /* 3rd is g mode's 1st */ - break; - case AR5K_EEPROM_MODE_11G: - offset += AR5K_EEPROM_TARGET_PWR_OFF_11G(ee->ee_version); - rate_pcal_info = ee->ee_rate_tpwr_g; - ee->ee_rate_target_pwr_num[mode] = AR5K_EEPROM_N_2GHZ_CHAN; - break; - default: - return -EINVAL; - } - - /* Different freq mask for older eeproms (<= v3.2) */ - if (ee->ee_version <= AR5K_EEPROM_VERSION_3_2) { - for (i = 0; i < (*rate_target_pwr_num); i++) { - AR5K_EEPROM_READ(offset++, val); - rate_pcal_info[i].freq = - ath5k_eeprom_bin2freq(ee, (val >> 9) & 0x7f, mode); - - rate_pcal_info[i].target_power_6to24 = ((val >> 3) & 0x3f); - rate_pcal_info[i].target_power_36 = (val << 3) & 0x3f; - - AR5K_EEPROM_READ(offset++, val); - - if (rate_pcal_info[i].freq == AR5K_EEPROM_CHANNEL_DIS || - val == 0) { - (*rate_target_pwr_num) = i; - break; - } - - rate_pcal_info[i].target_power_36 |= ((val >> 13) & 0x7); - rate_pcal_info[i].target_power_48 = ((val >> 7) & 0x3f); - rate_pcal_info[i].target_power_54 = ((val >> 1) & 0x3f); - } - } else { - for (i = 0; i < (*rate_target_pwr_num); i++) { - AR5K_EEPROM_READ(offset++, val); - rate_pcal_info[i].freq = - ath5k_eeprom_bin2freq(ee, (val >> 8) & 0xff, mode); - - rate_pcal_info[i].target_power_6to24 = ((val >> 2) & 0x3f); - rate_pcal_info[i].target_power_36 = (val << 4) & 0x3f; - - AR5K_EEPROM_READ(offset++, val); - - if (rate_pcal_info[i].freq == AR5K_EEPROM_CHANNEL_DIS || - val == 0) { - (*rate_target_pwr_num) = i; - break; - } - - rate_pcal_info[i].target_power_36 |= (val >> 12) & 0xf; - rate_pcal_info[i].target_power_48 = ((val >> 6) & 0x3f); - rate_pcal_info[i].target_power_54 = (val & 0x3f); - } - } - - return 0; -} - - -/* - * Read per channel calibration info from EEPROM - * - * This info is used to calibrate the baseband power table. Imagine - * that for each channel there is a power curve that's hw specific - * (depends on amplifier etc) and we try to "correct" this curve using - * offsets we pass on to phy chip (baseband -> before amplifier) so that - * it can use accurate power values when setting tx power (takes amplifier's - * performance on each channel into account). - * - * EEPROM provides us with the offsets for some pre-calibrated channels - * and we have to interpolate to create the full table for these channels and - * also the table for any channel. - */ -static int -ath5k_eeprom_read_pcal_info(struct ath5k_hw *ah) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - int (*read_pcal)(struct ath5k_hw *hw, int mode); - int mode; - int err; - - if ((ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_0) && - (AR5K_EEPROM_EEMAP(ee->ee_misc0) == 1)) - read_pcal = ath5k_eeprom_read_pcal_info_5112; - else if ((ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_0) && - (AR5K_EEPROM_EEMAP(ee->ee_misc0) == 2)) - read_pcal = ath5k_eeprom_read_pcal_info_2413; - else - read_pcal = ath5k_eeprom_read_pcal_info_5111; - - - for (mode = AR5K_EEPROM_MODE_11A; mode <= AR5K_EEPROM_MODE_11G; - mode++) { - err = read_pcal(ah, mode); - if (err) - return err; - - err = ath5k_eeprom_read_target_rate_pwr_info(ah, mode); - if (err < 0) - return err; - } - - return 0; -} - -/* Read conformance test limits used for regulatory control */ -static int -ath5k_eeprom_read_ctl_info(struct ath5k_hw *ah) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - struct ath5k_edge_power *rep; - unsigned int fmask, pmask; - unsigned int ctl_mode; - int i, j; - u32 offset; - u16 val; - - pmask = AR5K_EEPROM_POWER_M; - fmask = AR5K_EEPROM_FREQ_M(ee->ee_version); - offset = AR5K_EEPROM_CTL(ee->ee_version); - ee->ee_ctls = AR5K_EEPROM_N_CTLS(ee->ee_version); - for (i = 0; i < ee->ee_ctls; i += 2) { - AR5K_EEPROM_READ(offset++, val); - ee->ee_ctl[i] = (val >> 8) & 0xff; - ee->ee_ctl[i + 1] = val & 0xff; - } - - offset = AR5K_EEPROM_GROUP8_OFFSET; - if (ee->ee_version >= AR5K_EEPROM_VERSION_4_0) - offset += AR5K_EEPROM_TARGET_PWRSTART(ee->ee_misc1) - - AR5K_EEPROM_GROUP5_OFFSET; - else - offset += AR5K_EEPROM_GROUPS_START(ee->ee_version); - - rep = ee->ee_ctl_pwr; - for (i = 0; i < ee->ee_ctls; i++) { - switch (ee->ee_ctl[i] & AR5K_CTL_MODE_M) { - case AR5K_CTL_11A: - case AR5K_CTL_TURBO: - ctl_mode = AR5K_EEPROM_MODE_11A; - break; - default: - ctl_mode = AR5K_EEPROM_MODE_11G; - break; - } - if (ee->ee_ctl[i] == 0) { - if (ee->ee_version >= AR5K_EEPROM_VERSION_3_3) - offset += 8; - else - offset += 7; - rep += AR5K_EEPROM_N_EDGES; - continue; - } - if (ee->ee_version >= AR5K_EEPROM_VERSION_3_3) { - for (j = 0; j < AR5K_EEPROM_N_EDGES; j += 2) { - AR5K_EEPROM_READ(offset++, val); - rep[j].freq = (val >> 8) & fmask; - rep[j + 1].freq = val & fmask; - } - for (j = 0; j < AR5K_EEPROM_N_EDGES; j += 2) { - AR5K_EEPROM_READ(offset++, val); - rep[j].edge = (val >> 8) & pmask; - rep[j].flag = (val >> 14) & 1; - rep[j + 1].edge = val & pmask; - rep[j + 1].flag = (val >> 6) & 1; - } - } else { - AR5K_EEPROM_READ(offset++, val); - rep[0].freq = (val >> 9) & fmask; - rep[1].freq = (val >> 2) & fmask; - rep[2].freq = (val << 5) & fmask; - - AR5K_EEPROM_READ(offset++, val); - rep[2].freq |= (val >> 11) & 0x1f; - rep[3].freq = (val >> 4) & fmask; - rep[4].freq = (val << 3) & fmask; - - AR5K_EEPROM_READ(offset++, val); - rep[4].freq |= (val >> 13) & 0x7; - rep[5].freq = (val >> 6) & fmask; - rep[6].freq = (val << 1) & fmask; - - AR5K_EEPROM_READ(offset++, val); - rep[6].freq |= (val >> 15) & 0x1; - rep[7].freq = (val >> 8) & fmask; - - rep[0].edge = (val >> 2) & pmask; - rep[1].edge = (val << 4) & pmask; - - AR5K_EEPROM_READ(offset++, val); - rep[1].edge |= (val >> 12) & 0xf; - rep[2].edge = (val >> 6) & pmask; - rep[3].edge = val & pmask; - - AR5K_EEPROM_READ(offset++, val); - rep[4].edge = (val >> 10) & pmask; - rep[5].edge = (val >> 4) & pmask; - rep[6].edge = (val << 2) & pmask; - - AR5K_EEPROM_READ(offset++, val); - rep[6].edge |= (val >> 14) & 0x3; - rep[7].edge = (val >> 8) & pmask; - } - for (j = 0; j < AR5K_EEPROM_N_EDGES; j++) { - rep[j].freq = ath5k_eeprom_bin2freq(ee, - rep[j].freq, ctl_mode); - } - rep += AR5K_EEPROM_N_EDGES; - } - - return 0; -} - -static int -ath5k_eeprom_read_spur_chans(struct ath5k_hw *ah) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - u32 offset; - u16 val; - int ret = 0, i; - - offset = AR5K_EEPROM_CTL(ee->ee_version) + - AR5K_EEPROM_N_CTLS(ee->ee_version); - - if (ee->ee_version < AR5K_EEPROM_VERSION_5_3) { - /* No spur info for 5GHz */ - ee->ee_spur_chans[0][0] = AR5K_EEPROM_NO_SPUR; - /* 2 channels for 2GHz (2464/2420) */ - ee->ee_spur_chans[0][1] = AR5K_EEPROM_5413_SPUR_CHAN_1; - ee->ee_spur_chans[1][1] = AR5K_EEPROM_5413_SPUR_CHAN_2; - ee->ee_spur_chans[2][1] = AR5K_EEPROM_NO_SPUR; - } else if (ee->ee_version >= AR5K_EEPROM_VERSION_5_3) { - for (i = 0; i < AR5K_EEPROM_N_SPUR_CHANS; i++) { - AR5K_EEPROM_READ(offset, val); - ee->ee_spur_chans[i][0] = val; - AR5K_EEPROM_READ(offset + AR5K_EEPROM_N_SPUR_CHANS, - val); - ee->ee_spur_chans[i][1] = val; - offset++; - } - } - - return ret; -} - - -/***********************\ -* Init/Detach functions * -\***********************/ - -/* - * Initialize eeprom data structure - */ -int -ath5k_eeprom_init(struct ath5k_hw *ah) -{ - int err; - - err = ath5k_eeprom_init_header(ah); - if (err < 0) - return err; - - err = ath5k_eeprom_init_modes(ah); - if (err < 0) - return err; - - err = ath5k_eeprom_read_pcal_info(ah); - if (err < 0) - return err; - - err = ath5k_eeprom_read_ctl_info(ah); - if (err < 0) - return err; - - err = ath5k_eeprom_read_spur_chans(ah); - if (err < 0) - return err; - - return 0; -} - -void -ath5k_eeprom_detach(struct ath5k_hw *ah) -{ - u8 mode; - - for (mode = AR5K_EEPROM_MODE_11A; mode <= AR5K_EEPROM_MODE_11G; mode++) - ath5k_eeprom_free_pcal_info(ah, mode); -} - -int -ath5k_eeprom_mode_from_channel(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - switch (channel->hw_value) { - case AR5K_MODE_11A: - return AR5K_EEPROM_MODE_11A; - case AR5K_MODE_11G: - return AR5K_EEPROM_MODE_11G; - case AR5K_MODE_11B: - return AR5K_EEPROM_MODE_11B; - default: - ATH5K_WARN(ah, "channel is not A/B/G!"); - return AR5K_EEPROM_MODE_11A; - } -} diff --git a/drivers/net/wireless/ath/ath5k/eeprom.h b/drivers/net/wireless/ath/ath5k/eeprom.h deleted file mode 100644 index 693296ee9693..000000000000 --- a/drivers/net/wireless/ath/ath5k/eeprom.h +++ /dev/null @@ -1,495 +0,0 @@ -/* - * Copyright (c) 2004-2008 Reyk Floeter - * Copyright (c) 2006-2008 Nick Kossifidis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* - * Common ar5xxx EEPROM data offsets (set these on AR5K_EEPROM_BASE) - */ -#define AR5K_EEPROM_PCIE_OFFSET 0x02 /* Contains offset to PCI-E infos */ -#define AR5K_EEPROM_PCIE_SERDES_SECTION 0x40 /* PCIE_OFFSET points here when - * SERDES infos are present */ -#define AR5K_EEPROM_MAGIC 0x003d /* EEPROM Magic number */ -#define AR5K_EEPROM_MAGIC_VALUE 0x5aa5 /* Default - found on EEPROM */ - -#define AR5K_EEPROM_IS_HB63 0x000b /* Talon detect */ - -#define AR5K_EEPROM_RFKILL 0x0f -#define AR5K_EEPROM_RFKILL_GPIO_SEL 0x0000001c -#define AR5K_EEPROM_RFKILL_GPIO_SEL_S 2 -#define AR5K_EEPROM_RFKILL_POLARITY 0x00000002 -#define AR5K_EEPROM_RFKILL_POLARITY_S 1 - -#define AR5K_EEPROM_REG_DOMAIN 0x00bf /* EEPROM regdom */ - -/* FLASH(EEPROM) Defines for AR531X chips */ -#define AR5K_EEPROM_SIZE_LOWER 0x1b /* size info -- lower */ -#define AR5K_EEPROM_SIZE_UPPER 0x1c /* size info -- upper */ -#define AR5K_EEPROM_SIZE_UPPER_MASK 0xfff0 -#define AR5K_EEPROM_SIZE_UPPER_SHIFT 4 -#define AR5K_EEPROM_SIZE_ENDLOC_SHIFT 12 - -#define AR5K_EEPROM_CHECKSUM 0x00c0 /* EEPROM checksum */ -#define AR5K_EEPROM_INFO_BASE 0x00c0 /* EEPROM header */ -#define AR5K_EEPROM_INFO_MAX (0x400 - AR5K_EEPROM_INFO_BASE) -#define AR5K_EEPROM_INFO_CKSUM 0xffff -#define AR5K_EEPROM_INFO(_n) (AR5K_EEPROM_INFO_BASE + (_n)) - -#define AR5K_EEPROM_VERSION AR5K_EEPROM_INFO(1) /* EEPROM Version */ -#define AR5K_EEPROM_VERSION_3_0 0x3000 /* No idea what's going on before this version */ -#define AR5K_EEPROM_VERSION_3_1 0x3001 /* ob/db values for 2GHz (ar5211_rfregs) */ -#define AR5K_EEPROM_VERSION_3_2 0x3002 /* different frequency representation (eeprom_bin2freq) */ -#define AR5K_EEPROM_VERSION_3_3 0x3003 /* offsets changed, has 32 CTLs (see below) and ee_false_detect (eeprom_read_modes) */ -#define AR5K_EEPROM_VERSION_3_4 0x3004 /* has ee_i_gain, ee_cck_ofdm_power_delta (eeprom_read_modes) */ -#define AR5K_EEPROM_VERSION_4_0 0x4000 /* has ee_misc, ee_cal_pier, ee_turbo_max_power and ee_xr_power (eeprom_init) */ -#define AR5K_EEPROM_VERSION_4_1 0x4001 /* has ee_margin_tx_rx (eeprom_init) */ -#define AR5K_EEPROM_VERSION_4_2 0x4002 /* has ee_cck_ofdm_gain_delta (eeprom_init) */ -#define AR5K_EEPROM_VERSION_4_3 0x4003 /* power calibration changes */ -#define AR5K_EEPROM_VERSION_4_4 0x4004 -#define AR5K_EEPROM_VERSION_4_5 0x4005 -#define AR5K_EEPROM_VERSION_4_6 0x4006 /* has ee_scaled_cck_delta */ -#define AR5K_EEPROM_VERSION_4_7 0x3007 /* 4007 ? */ -#define AR5K_EEPROM_VERSION_4_9 0x4009 /* EAR futureproofing */ -#define AR5K_EEPROM_VERSION_5_0 0x5000 /* Has 2413 PDADC calibration etc */ -#define AR5K_EEPROM_VERSION_5_1 0x5001 /* Has capability values */ -#define AR5K_EEPROM_VERSION_5_3 0x5003 /* Has spur mitigation tables */ - -#define AR5K_EEPROM_MODE_11A 0 -#define AR5K_EEPROM_MODE_11B 1 -#define AR5K_EEPROM_MODE_11G 2 - -#define AR5K_EEPROM_HDR AR5K_EEPROM_INFO(2) /* Header that contains the device caps */ -#define AR5K_EEPROM_HDR_11A(_v) (((_v) >> AR5K_EEPROM_MODE_11A) & 0x1) -#define AR5K_EEPROM_HDR_11B(_v) (((_v) >> AR5K_EEPROM_MODE_11B) & 0x1) -#define AR5K_EEPROM_HDR_11G(_v) (((_v) >> AR5K_EEPROM_MODE_11G) & 0x1) -#define AR5K_EEPROM_HDR_T_2GHZ_DIS(_v) (((_v) >> 3) & 0x1) /* Disable turbo for 2GHz */ -#define AR5K_EEPROM_HDR_T_5GHZ_DBM(_v) (((_v) >> 4) & 0x7f) /* Max turbo power for < 2W power consumption */ -#define AR5K_EEPROM_HDR_DEVICE(_v) (((_v) >> 11) & 0x7) /* Device type (1 Cardbus, 2 PCI, 3 MiniPCI, 4 AP) */ -#define AR5K_EEPROM_HDR_RFKILL(_v) (((_v) >> 14) & 0x1) /* Device has RFKill support */ -#define AR5K_EEPROM_HDR_T_5GHZ_DIS(_v) (((_v) >> 15) & 0x1) /* Disable turbo for 5GHz */ - -/* Newer EEPROMs are using a different offset */ -#define AR5K_EEPROM_OFF(_v, _v3_0, _v3_3) \ - (((_v) >= AR5K_EEPROM_VERSION_3_3) ? _v3_3 : _v3_0) - -#define AR5K_EEPROM_ANT_GAIN(_v) AR5K_EEPROM_OFF(_v, 0x00c4, 0x00c3) -#define AR5K_EEPROM_ANT_GAIN_5GHZ(_v) ((s8)(((_v) >> 8) & 0xff)) -#define AR5K_EEPROM_ANT_GAIN_2GHZ(_v) ((s8)((_v) & 0xff)) - -/* Misc values available since EEPROM 4.0 */ -#define AR5K_EEPROM_MISC0 AR5K_EEPROM_INFO(4) -#define AR5K_EEPROM_EARSTART(_v) ((_v) & 0xfff) -#define AR5K_EEPROM_HDR_XR2_DIS(_v) (((_v) >> 12) & 0x1) -#define AR5K_EEPROM_HDR_XR5_DIS(_v) (((_v) >> 13) & 0x1) -#define AR5K_EEPROM_EEMAP(_v) (((_v) >> 14) & 0x3) - -#define AR5K_EEPROM_MISC1 AR5K_EEPROM_INFO(5) -#define AR5K_EEPROM_TARGET_PWRSTART(_v) ((_v) & 0xfff) -#define AR5K_EEPROM_HAS32KHZCRYSTAL(_v) (((_v) >> 14) & 0x1) /* has 32KHz crystal for sleep mode */ -#define AR5K_EEPROM_HAS32KHZCRYSTAL_OLD(_v) (((_v) >> 15) & 0x1) - -#define AR5K_EEPROM_MISC2 AR5K_EEPROM_INFO(6) -#define AR5K_EEPROM_EEP_FILE_VERSION(_v) (((_v) >> 8) & 0xff) -#define AR5K_EEPROM_EAR_FILE_VERSION(_v) ((_v) & 0xff) - -#define AR5K_EEPROM_MISC3 AR5K_EEPROM_INFO(7) -#define AR5K_EEPROM_ART_BUILD_NUM(_v) (((_v) >> 10) & 0x3f) -#define AR5K_EEPROM_EAR_FILE_ID(_v) ((_v) & 0xff) - -#define AR5K_EEPROM_MISC4 AR5K_EEPROM_INFO(8) -#define AR5K_EEPROM_CAL_DATA_START(_v) (((_v) >> 4) & 0xfff) -#define AR5K_EEPROM_MASK_R0(_v) (((_v) >> 2) & 0x3) /* modes supported by radio 0 (bit 1: G, bit 2: A) */ -#define AR5K_EEPROM_MASK_R1(_v) ((_v) & 0x3) /* modes supported by radio 1 (bit 1: G, bit 2: A) */ - -#define AR5K_EEPROM_MISC5 AR5K_EEPROM_INFO(9) -#define AR5K_EEPROM_COMP_DIS(_v) ((_v) & 0x1) /* disable compression */ -#define AR5K_EEPROM_AES_DIS(_v) (((_v) >> 1) & 0x1) /* disable AES */ -#define AR5K_EEPROM_FF_DIS(_v) (((_v) >> 2) & 0x1) /* disable fast frames */ -#define AR5K_EEPROM_BURST_DIS(_v) (((_v) >> 3) & 0x1) /* disable bursting */ -#define AR5K_EEPROM_MAX_QCU(_v) (((_v) >> 4) & 0xf) /* max number of QCUs. defaults to 10 */ -#define AR5K_EEPROM_HEAVY_CLIP_EN(_v) (((_v) >> 8) & 0x1) /* enable heavy clipping */ -#define AR5K_EEPROM_KEY_CACHE_SIZE(_v) (((_v) >> 12) & 0xf) /* key cache size. defaults to 128 */ - -#define AR5K_EEPROM_MISC6 AR5K_EEPROM_INFO(10) -#define AR5K_EEPROM_TX_CHAIN_DIS ((_v) & 0x7) /* MIMO chains disabled for TX bitmask */ -#define AR5K_EEPROM_RX_CHAIN_DIS (((_v) >> 3) & 0x7) /* MIMO chains disabled for RX bitmask */ -#define AR5K_EEPROM_FCC_MID_EN (((_v) >> 6) & 0x1) /* 5.47-5.7GHz supported */ -#define AR5K_EEPROM_JAP_U1EVEN_EN (((_v) >> 7) & 0x1) /* Japan UNII1 band (5.15-5.25GHz) on even channels (5180, 5200, 5220, 5240) supported */ -#define AR5K_EEPROM_JAP_U2_EN (((_v) >> 8) & 0x1) /* Japan UNII2 band (5.25-5.35GHz) supported */ -#define AR5K_EEPROM_JAP_MID_EN (((_v) >> 9) & 0x1) /* Japan band from 5.47-5.7GHz supported */ -#define AR5K_EEPROM_JAP_U1ODD_EN (((_v) >> 10) & 0x1) /* Japan UNII2 band (5.15-5.25GHz) on odd channels (5170, 5190, 5210, 5230) supported */ -#define AR5K_EEPROM_JAP_11A_NEW_EN (((_v) >> 11) & 0x1) /* Japan A mode enabled (using even channels) */ - -/* calibration settings */ -#define AR5K_EEPROM_MODES_11A(_v) AR5K_EEPROM_OFF(_v, 0x00c5, 0x00d4) -#define AR5K_EEPROM_MODES_11B(_v) AR5K_EEPROM_OFF(_v, 0x00d0, 0x00f2) -#define AR5K_EEPROM_MODES_11G(_v) AR5K_EEPROM_OFF(_v, 0x00da, 0x010d) -#define AR5K_EEPROM_CTL(_v) AR5K_EEPROM_OFF(_v, 0x00e4, 0x0128) /* Conformance test limits */ -#define AR5K_EEPROM_GROUPS_START(_v) AR5K_EEPROM_OFF(_v, 0x0100, 0x0150) /* Start of Groups */ -#define AR5K_EEPROM_GROUP1_OFFSET 0x0 -#define AR5K_EEPROM_GROUP2_OFFSET 0x5 -#define AR5K_EEPROM_GROUP3_OFFSET 0x37 -#define AR5K_EEPROM_GROUP4_OFFSET 0x46 -#define AR5K_EEPROM_GROUP5_OFFSET 0x55 -#define AR5K_EEPROM_GROUP6_OFFSET 0x65 -#define AR5K_EEPROM_GROUP7_OFFSET 0x69 -#define AR5K_EEPROM_GROUP8_OFFSET 0x6f - -#define AR5K_EEPROM_TARGET_PWR_OFF_11A(_v) AR5K_EEPROM_OFF(_v, AR5K_EEPROM_GROUPS_START(_v) + \ - AR5K_EEPROM_GROUP5_OFFSET, 0x0000) -#define AR5K_EEPROM_TARGET_PWR_OFF_11B(_v) AR5K_EEPROM_OFF(_v, AR5K_EEPROM_GROUPS_START(_v) + \ - AR5K_EEPROM_GROUP6_OFFSET, 0x0010) -#define AR5K_EEPROM_TARGET_PWR_OFF_11G(_v) AR5K_EEPROM_OFF(_v, AR5K_EEPROM_GROUPS_START(_v) + \ - AR5K_EEPROM_GROUP7_OFFSET, 0x0014) - -/* [3.1 - 3.3] */ -#define AR5K_EEPROM_OBDB0_2GHZ 0x00ec -#define AR5K_EEPROM_OBDB1_2GHZ 0x00ed - -#define AR5K_EEPROM_PROTECT 0x003f /* EEPROM protect status */ -#define AR5K_EEPROM_PROTECT_RD_0_31 0x0001 /* Read protection bit for offsets 0x0 - 0x1f */ -#define AR5K_EEPROM_PROTECT_WR_0_31 0x0002 /* Write protection bit for offsets 0x0 - 0x1f */ -#define AR5K_EEPROM_PROTECT_RD_32_63 0x0004 /* 0x20 - 0x3f */ -#define AR5K_EEPROM_PROTECT_WR_32_63 0x0008 -#define AR5K_EEPROM_PROTECT_RD_64_127 0x0010 /* 0x40 - 0x7f */ -#define AR5K_EEPROM_PROTECT_WR_64_127 0x0020 -#define AR5K_EEPROM_PROTECT_RD_128_191 0x0040 /* 0x80 - 0xbf (regdom) */ -#define AR5K_EEPROM_PROTECT_WR_128_191 0x0080 -#define AR5K_EEPROM_PROTECT_RD_192_207 0x0100 /* 0xc0 - 0xcf */ -#define AR5K_EEPROM_PROTECT_WR_192_207 0x0200 -#define AR5K_EEPROM_PROTECT_RD_208_223 0x0400 /* 0xd0 - 0xdf */ -#define AR5K_EEPROM_PROTECT_WR_208_223 0x0800 -#define AR5K_EEPROM_PROTECT_RD_224_239 0x1000 /* 0xe0 - 0xef */ -#define AR5K_EEPROM_PROTECT_WR_224_239 0x2000 -#define AR5K_EEPROM_PROTECT_RD_240_255 0x4000 /* 0xf0 - 0xff */ -#define AR5K_EEPROM_PROTECT_WR_240_255 0x8000 - -/* Some EEPROM defines */ -#define AR5K_EEPROM_EEP_SCALE 100 -#define AR5K_EEPROM_EEP_DELTA 10 -#define AR5K_EEPROM_N_MODES 3 -#define AR5K_EEPROM_N_5GHZ_CHAN 10 -#define AR5K_EEPROM_N_5GHZ_RATE_CHAN 8 -#define AR5K_EEPROM_N_2GHZ_CHAN 3 -#define AR5K_EEPROM_N_2GHZ_CHAN_2413 4 -#define AR5K_EEPROM_N_2GHZ_CHAN_MAX 4 -#define AR5K_EEPROM_MAX_CHAN 10 -#define AR5K_EEPROM_N_PWR_POINTS_5111 11 -#define AR5K_EEPROM_N_PCDAC 11 -#define AR5K_EEPROM_N_PHASE_CAL 5 -#define AR5K_EEPROM_N_TEST_FREQ 8 -#define AR5K_EEPROM_N_EDGES 8 -#define AR5K_EEPROM_N_INTERCEPTS 11 -#define AR5K_EEPROM_FREQ_M(_v) AR5K_EEPROM_OFF(_v, 0x7f, 0xff) -#define AR5K_EEPROM_PCDAC_M 0x3f -#define AR5K_EEPROM_PCDAC_START 1 -#define AR5K_EEPROM_PCDAC_STOP 63 -#define AR5K_EEPROM_PCDAC_STEP 1 -#define AR5K_EEPROM_NON_EDGE_M 0x40 -#define AR5K_EEPROM_CHANNEL_POWER 8 -#define AR5K_EEPROM_N_OBDB 4 -#define AR5K_EEPROM_OBDB_DIS 0xffff -#define AR5K_EEPROM_CHANNEL_DIS 0xff -#define AR5K_EEPROM_SCALE_OC_DELTA(_x) (((_x) * 2) / 10) -#define AR5K_EEPROM_N_CTLS(_v) AR5K_EEPROM_OFF(_v, 16, 32) -#define AR5K_EEPROM_MAX_CTLS 32 -#define AR5K_EEPROM_N_PD_CURVES 4 -#define AR5K_EEPROM_N_XPD0_POINTS 4 -#define AR5K_EEPROM_N_XPD3_POINTS 3 -#define AR5K_EEPROM_N_PD_GAINS 4 -#define AR5K_EEPROM_N_PD_POINTS 5 -#define AR5K_EEPROM_N_INTERCEPT_10_2GHZ 35 -#define AR5K_EEPROM_N_INTERCEPT_10_5GHZ 55 -#define AR5K_EEPROM_POWER_M 0x3f -#define AR5K_EEPROM_POWER_MIN 0 -#define AR5K_EEPROM_POWER_MAX 3150 -#define AR5K_EEPROM_POWER_STEP 50 -#define AR5K_EEPROM_POWER_TABLE_SIZE 64 -#define AR5K_EEPROM_N_POWER_LOC_11B 4 -#define AR5K_EEPROM_N_POWER_LOC_11G 6 -#define AR5K_EEPROM_I_GAIN 10 -#define AR5K_EEPROM_CCK_OFDM_DELTA 15 -#define AR5K_EEPROM_N_IQ_CAL 2 -/* 5GHz/2GHz */ -enum ath5k_eeprom_freq_bands { - AR5K_EEPROM_BAND_5GHZ = 0, - AR5K_EEPROM_BAND_2GHZ = 1, - AR5K_EEPROM_N_FREQ_BANDS, -}; -/* Spur chans per freq band */ -#define AR5K_EEPROM_N_SPUR_CHANS 5 -/* fbin value for chan 2464 x2 */ -#define AR5K_EEPROM_5413_SPUR_CHAN_1 1640 -/* fbin value for chan 2420 x2 */ -#define AR5K_EEPROM_5413_SPUR_CHAN_2 1200 -#define AR5K_EEPROM_SPUR_CHAN_MASK 0x3FFF -#define AR5K_EEPROM_NO_SPUR 0x8000 -#define AR5K_SPUR_CHAN_WIDTH 87 -#define AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz 3125 -#define AR5K_SPUR_SYMBOL_WIDTH_TURBO_100Hz 6250 - -#define AR5K_EEPROM_READ(_o, _v) do { \ - if (!ath5k_hw_nvram_read(ah, (_o), &(_v))) \ - return -EIO; \ -} while (0) - -#define AR5K_EEPROM_READ_HDR(_o, _v) \ - AR5K_EEPROM_READ(_o, ah->ah_capabilities.cap_eeprom._v); \ - -enum ath5k_ant_table { - AR5K_ANT_CTL = 0, /* Idle switch table settings */ - AR5K_ANT_SWTABLE_A = 1, /* Switch table for antenna A */ - AR5K_ANT_SWTABLE_B = 2, /* Switch table for antenna B */ - AR5K_ANT_MAX, -}; - -enum ath5k_ctl_mode { - AR5K_CTL_11A = 0, - AR5K_CTL_11B = 1, - AR5K_CTL_11G = 2, - AR5K_CTL_TURBO = 3, - AR5K_CTL_TURBOG = 4, - AR5K_CTL_2GHT20 = 5, - AR5K_CTL_5GHT20 = 6, - AR5K_CTL_2GHT40 = 7, - AR5K_CTL_5GHT40 = 8, - AR5K_CTL_MODE_M = 15, -}; - -/* Per channel calibration data, used for power table setup */ -struct ath5k_chan_pcal_info_rf5111 { - /* Power levels in half dBm units - * for one power curve. */ - u8 pwr[AR5K_EEPROM_N_PWR_POINTS_5111]; - /* PCDAC table steps - * for the above values */ - u8 pcdac[AR5K_EEPROM_N_PWR_POINTS_5111]; - /* Starting PCDAC step */ - u8 pcdac_min; - /* Final PCDAC step */ - u8 pcdac_max; -}; - -struct ath5k_chan_pcal_info_rf5112 { - /* Power levels in quarter dBm units - * for lower (0) and higher (3) - * level curves in 0.25dB units */ - s8 pwr_x0[AR5K_EEPROM_N_XPD0_POINTS]; - s8 pwr_x3[AR5K_EEPROM_N_XPD3_POINTS]; - /* PCDAC table steps - * for the above values */ - u8 pcdac_x0[AR5K_EEPROM_N_XPD0_POINTS]; - u8 pcdac_x3[AR5K_EEPROM_N_XPD3_POINTS]; -}; - -struct ath5k_chan_pcal_info_rf2413 { - /* Starting pwr/pddac values */ - s8 pwr_i[AR5K_EEPROM_N_PD_GAINS]; - u8 pddac_i[AR5K_EEPROM_N_PD_GAINS]; - /* (pwr,pddac) points - * power levels in 0.5dB units */ - s8 pwr[AR5K_EEPROM_N_PD_GAINS] - [AR5K_EEPROM_N_PD_POINTS]; - u8 pddac[AR5K_EEPROM_N_PD_GAINS] - [AR5K_EEPROM_N_PD_POINTS]; -}; - -enum ath5k_powertable_type { - AR5K_PWRTABLE_PWR_TO_PCDAC = 0, - AR5K_PWRTABLE_LINEAR_PCDAC = 1, - AR5K_PWRTABLE_PWR_TO_PDADC = 2, -}; - -struct ath5k_pdgain_info { - u8 pd_points; - u8 *pd_step; - /* Power values are in - * 0.25dB units */ - s16 *pd_pwr; -}; - -struct ath5k_chan_pcal_info { - /* Frequency */ - u16 freq; - /* Tx power boundaries */ - s16 max_pwr; - s16 min_pwr; - union { - struct ath5k_chan_pcal_info_rf5111 rf5111_info; - struct ath5k_chan_pcal_info_rf5112 rf5112_info; - struct ath5k_chan_pcal_info_rf2413 rf2413_info; - }; - /* Raw values used by phy code - * Curves are stored in order from lower - * gain to higher gain (max txpower -> min txpower) */ - struct ath5k_pdgain_info *pd_curves; -}; - -/* Per rate calibration data for each mode, - * used for rate power table setup. - * Note: Values in 0.5dB units */ -struct ath5k_rate_pcal_info { - u16 freq; /* Frequency */ - /* Power level for 6-24Mbit/s rates or - * 1Mb rate */ - u16 target_power_6to24; - /* Power level for 36Mbit rate or - * 2Mb rate */ - u16 target_power_36; - /* Power level for 48Mbit rate or - * 5.5Mbit rate */ - u16 target_power_48; - /* Power level for 54Mbit rate or - * 11Mbit rate */ - u16 target_power_54; -}; - -/* Power edges for conformance test limits */ -struct ath5k_edge_power { - u16 freq; - u16 edge; /* in half dBm */ - bool flag; -}; - -/** - * struct ath5k_eeprom_info - EEPROM calibration data - * - * @ee_regdomain: ath/regd.c takes care of COUNTRY_ERD and WORLDWIDE_ROAMING - * flags - * @ee_ant_gain: Antenna gain in 0.5dB steps signed [5211 only?] - * @ee_cck_ofdm_gain_delta: difference in gainF to output the same power for - * OFDM and CCK packets - * @ee_cck_ofdm_power_delta: power difference between OFDM (6Mbps) and CCK - * (11Mbps) rate in G mode. 0.1dB steps - * @ee_scaled_cck_delta: for Japan Channel 14: 0.1dB resolution - * - * @ee_i_cal: Initial I coefficient to correct I/Q mismatch in the receive path - * @ee_q_cal: Initial Q coefficient to correct I/Q mismatch in the receive path - * @ee_fixed_bias: use ee_ob and ee_db settings or use automatic control - * @ee_switch_settling: RX/TX Switch settling time - * @ee_atn_tx_rx: Difference in attenuation between TX and RX in 1dB steps - * @ee_ant_control: Antenna Control Settings - * @ee_ob: Bias current for Output stage of PA - * B/G mode: Index [0] is used for AR2112/5112, otherwise [1] - * A mode: [0] 5.15-5.25 [1] 5.25-5.50 [2] 5.50-5.70 [3] 5.70-5.85 GHz - * @ee_db: Bias current for Output stage of PA. see @ee_ob - * @ee_tx_end2xlna_enable: Time difference from when BB finishes sending a frame - * to when the external LNA is activated - * @ee_tx_end2xpa_disable: Time difference from when BB finishes sending a frame - * to when the external PA switch is deactivated - * @ee_tx_frm2xpa_enable: Time difference from when MAC sends frame to when - * external PA switch is activated - * @ee_thr_62: Clear Channel Assessment (CCA) sensitivity - * (IEEE802.11a section 17.3.10.5 ) - * @ee_xlna_gain: Total gain of the LNA (information only) - * @ee_xpd: Use external (1) or internal power detector - * @ee_x_gain: Gain for external power detector output (differences in EEMAP - * versions!) - * @ee_i_gain: Initial gain value after reset - * @ee_margin_tx_rx: Margin in dB when final attenuation stage should be used - * - * @ee_false_detect: Backoff in Sensitivity (dB) on channels with spur signals - * @ee_noise_floor_thr: Noise floor threshold in 1dB steps - * @ee_adc_desired_size: Desired amplitude for ADC, used by AGC; in 0.5 dB steps - * @ee_pga_desired_size: Desired output of PGA (for BB gain) in 0.5 dB steps - * @ee_pd_gain_overlap: PD ADC curves need to overlap in 0.5dB steps (ee_map>=2) - */ -struct ath5k_eeprom_info { - - /* Header information */ - u16 ee_magic; - u16 ee_protect; - u16 ee_regdomain; - u16 ee_version; - u16 ee_header; - u16 ee_ant_gain; - u8 ee_rfkill_pin; - bool ee_rfkill_pol; - bool ee_is_hb63; - bool ee_serdes; - u16 ee_misc0; - u16 ee_misc1; - u16 ee_misc2; - u16 ee_misc3; - u16 ee_misc4; - u16 ee_misc5; - u16 ee_misc6; - u16 ee_cck_ofdm_gain_delta; - u16 ee_cck_ofdm_power_delta; - u16 ee_scaled_cck_delta; - - /* RF Calibration settings (reset, rfregs) */ - u16 ee_i_cal[AR5K_EEPROM_N_MODES]; - u16 ee_q_cal[AR5K_EEPROM_N_MODES]; - u16 ee_fixed_bias[AR5K_EEPROM_N_MODES]; - u16 ee_turbo_max_power[AR5K_EEPROM_N_MODES]; - u16 ee_xr_power[AR5K_EEPROM_N_MODES]; - u16 ee_switch_settling[AR5K_EEPROM_N_MODES]; - u16 ee_atn_tx_rx[AR5K_EEPROM_N_MODES]; - u16 ee_ant_control[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_PCDAC]; - u16 ee_ob[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_OBDB]; - u16 ee_db[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_OBDB]; - u16 ee_tx_end2xlna_enable[AR5K_EEPROM_N_MODES]; - u16 ee_tx_end2xpa_disable[AR5K_EEPROM_N_MODES]; - u16 ee_tx_frm2xpa_enable[AR5K_EEPROM_N_MODES]; - u16 ee_thr_62[AR5K_EEPROM_N_MODES]; - u16 ee_xlna_gain[AR5K_EEPROM_N_MODES]; - u16 ee_xpd[AR5K_EEPROM_N_MODES]; - u16 ee_x_gain[AR5K_EEPROM_N_MODES]; - u16 ee_i_gain[AR5K_EEPROM_N_MODES]; - u16 ee_margin_tx_rx[AR5K_EEPROM_N_MODES]; - u16 ee_switch_settling_turbo[AR5K_EEPROM_N_MODES]; - u16 ee_margin_tx_rx_turbo[AR5K_EEPROM_N_MODES]; - u16 ee_atn_tx_rx_turbo[AR5K_EEPROM_N_MODES]; - - /* Power calibration data */ - u16 ee_false_detect[AR5K_EEPROM_N_MODES]; - - /* Number of pd gain curves per mode */ - u8 ee_pd_gains[AR5K_EEPROM_N_MODES]; - /* Back mapping pdcurve number -> pdcurve index in pd->pd_curves */ - u8 ee_pdc_to_idx[AR5K_EEPROM_N_MODES][AR5K_EEPROM_N_PD_GAINS]; - - u8 ee_n_piers[AR5K_EEPROM_N_MODES]; - struct ath5k_chan_pcal_info ee_pwr_cal_a[AR5K_EEPROM_N_5GHZ_CHAN]; - struct ath5k_chan_pcal_info ee_pwr_cal_b[AR5K_EEPROM_N_2GHZ_CHAN_MAX]; - struct ath5k_chan_pcal_info ee_pwr_cal_g[AR5K_EEPROM_N_2GHZ_CHAN_MAX]; - - /* Per rate target power levels */ - u8 ee_rate_target_pwr_num[AR5K_EEPROM_N_MODES]; - struct ath5k_rate_pcal_info ee_rate_tpwr_a[AR5K_EEPROM_N_5GHZ_CHAN]; - struct ath5k_rate_pcal_info ee_rate_tpwr_b[AR5K_EEPROM_N_2GHZ_CHAN_MAX]; - struct ath5k_rate_pcal_info ee_rate_tpwr_g[AR5K_EEPROM_N_2GHZ_CHAN_MAX]; - - /* Conformance test limits (Unused) */ - u8 ee_ctls; - u8 ee_ctl[AR5K_EEPROM_MAX_CTLS]; - struct ath5k_edge_power ee_ctl_pwr[AR5K_EEPROM_N_EDGES * AR5K_EEPROM_MAX_CTLS]; - - /* Noise Floor Calibration settings */ - s16 ee_noise_floor_thr[AR5K_EEPROM_N_MODES]; - s8 ee_adc_desired_size[AR5K_EEPROM_N_MODES]; - s8 ee_pga_desired_size[AR5K_EEPROM_N_MODES]; - s8 ee_adc_desired_size_turbo[AR5K_EEPROM_N_MODES]; - s8 ee_pga_desired_size_turbo[AR5K_EEPROM_N_MODES]; - s8 ee_pd_gain_overlap; - - /* Spur mitigation data (fbin values for spur channels) */ - u16 ee_spur_chans[AR5K_EEPROM_N_SPUR_CHANS][AR5K_EEPROM_N_FREQ_BANDS]; - - /* Antenna raw switch tables */ - u32 ee_antenna[AR5K_EEPROM_N_MODES][AR5K_ANT_MAX]; -}; diff --git a/drivers/net/wireless/ath/ath5k/gpio.c b/drivers/net/wireless/ath/ath5k/gpio.c deleted file mode 100644 index 73d3dd8a306a..000000000000 --- a/drivers/net/wireless/ath/ath5k/gpio.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2004-2008 Reyk Floeter - * Copyright (c) 2006-2008 Nick Kossifidis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/****************\ - GPIO Functions -\****************/ - -#include "ath5k.h" -#include "reg.h" -#include "debug.h" - - -/** - * DOC: GPIO/LED functions - * - * Here we control the 6 bidirectional GPIO pins provided by the hw. - * We can set a GPIO pin to be an input or an output pin on GPIO control - * register and then read or set its status from GPIO data input/output - * registers. - * - * We also control the two LED pins provided by the hw, LED_0 is our - * "power" LED and LED_1 is our "network activity" LED but many scenarios - * are available from hw. Vendors might also provide LEDs connected to the - * GPIO pins, we handle them through the LED subsystem on led.c - */ - - -/** - * ath5k_hw_set_ledstate() - Set led state - * @ah: The &struct ath5k_hw - * @state: One of AR5K_LED_* - * - * Used to set the LED blinking state. This only - * works for the LED connected to the LED_0, LED_1 pins, - * not the GPIO based. - */ -void -ath5k_hw_set_ledstate(struct ath5k_hw *ah, unsigned int state) -{ - u32 led; - /*5210 has different led mode handling*/ - u32 led_5210; - - /*Reset led status*/ - if (ah->ah_version != AR5K_AR5210) - AR5K_REG_DISABLE_BITS(ah, AR5K_PCICFG, - AR5K_PCICFG_LEDMODE | AR5K_PCICFG_LED); - else - AR5K_REG_DISABLE_BITS(ah, AR5K_PCICFG, AR5K_PCICFG_LED); - - /* - * Some blinking values, define at your wish - */ - switch (state) { - case AR5K_LED_SCAN: - case AR5K_LED_AUTH: - led = AR5K_PCICFG_LEDMODE_PROP | AR5K_PCICFG_LED_PEND; - led_5210 = AR5K_PCICFG_LED_PEND | AR5K_PCICFG_LED_BCTL; - break; - - case AR5K_LED_INIT: - led = AR5K_PCICFG_LEDMODE_PROP | AR5K_PCICFG_LED_NONE; - led_5210 = AR5K_PCICFG_LED_PEND; - break; - - case AR5K_LED_ASSOC: - case AR5K_LED_RUN: - led = AR5K_PCICFG_LEDMODE_PROP | AR5K_PCICFG_LED_ASSOC; - led_5210 = AR5K_PCICFG_LED_ASSOC; - break; - - default: - led = AR5K_PCICFG_LEDMODE_PROM | AR5K_PCICFG_LED_NONE; - led_5210 = AR5K_PCICFG_LED_PEND; - break; - } - - /*Write new status to the register*/ - if (ah->ah_version != AR5K_AR5210) - AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, led); - else - AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, led_5210); -} - -/** - * ath5k_hw_set_gpio_input() - Set GPIO inputs - * @ah: The &struct ath5k_hw - * @gpio: GPIO pin to set as input - */ -int -ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio) -{ - if (gpio >= AR5K_NUM_GPIO) - return -EINVAL; - - ath5k_hw_reg_write(ah, - (ath5k_hw_reg_read(ah, AR5K_GPIOCR) & ~AR5K_GPIOCR_OUT(gpio)) - | AR5K_GPIOCR_IN(gpio), AR5K_GPIOCR); - - return 0; -} - -/** - * ath5k_hw_set_gpio_output() - Set GPIO outputs - * @ah: The &struct ath5k_hw - * @gpio: The GPIO pin to set as output - */ -int -ath5k_hw_set_gpio_output(struct ath5k_hw *ah, u32 gpio) -{ - if (gpio >= AR5K_NUM_GPIO) - return -EINVAL; - - ath5k_hw_reg_write(ah, - (ath5k_hw_reg_read(ah, AR5K_GPIOCR) & ~AR5K_GPIOCR_OUT(gpio)) - | AR5K_GPIOCR_OUT(gpio), AR5K_GPIOCR); - - return 0; -} - -/** - * ath5k_hw_get_gpio() - Get GPIO state - * @ah: The &struct ath5k_hw - * @gpio: The GPIO pin to read - */ -u32 -ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio) -{ - if (gpio >= AR5K_NUM_GPIO) - return 0xffffffff; - - /* GPIO input magic */ - return ((ath5k_hw_reg_read(ah, AR5K_GPIODI) & AR5K_GPIODI_M) >> gpio) & - 0x1; -} - -/** - * ath5k_hw_set_gpio() - Set GPIO state - * @ah: The &struct ath5k_hw - * @gpio: The GPIO pin to set - * @val: Value to set (boolean) - */ -int -ath5k_hw_set_gpio(struct ath5k_hw *ah, u32 gpio, u32 val) -{ - u32 data; - - if (gpio >= AR5K_NUM_GPIO) - return -EINVAL; - - /* GPIO output magic */ - data = ath5k_hw_reg_read(ah, AR5K_GPIODO); - - data &= ~(1 << gpio); - data |= (val & 1) << gpio; - - ath5k_hw_reg_write(ah, data, AR5K_GPIODO); - - return 0; -} - -/** - * ath5k_hw_set_gpio_intr() - Initialize the GPIO interrupt (RFKill switch) - * @ah: The &struct ath5k_hw - * @gpio: The GPIO pin to use - * @interrupt_level: True to generate interrupt on active pin (high) - * - * This function is used to set up the GPIO interrupt for the hw RFKill switch. - * That switch is connected to a GPIO pin and it's number is stored on EEPROM. - * It can either open or close the circuit to indicate that we should disable - * RF/Wireless to save power (we also get that from EEPROM). - */ -void -ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio, - u32 interrupt_level) -{ - u32 data; - - if (gpio >= AR5K_NUM_GPIO) - return; - - /* - * Set the GPIO interrupt - */ - data = (ath5k_hw_reg_read(ah, AR5K_GPIOCR) & - ~(AR5K_GPIOCR_INT_SEL(gpio) | AR5K_GPIOCR_INT_SELH | - AR5K_GPIOCR_INT_ENA | AR5K_GPIOCR_OUT(gpio))) | - (AR5K_GPIOCR_INT_SEL(gpio) | AR5K_GPIOCR_INT_ENA); - - ath5k_hw_reg_write(ah, interrupt_level ? data : - (data | AR5K_GPIOCR_INT_SELH), AR5K_GPIOCR); - - ah->ah_imr |= AR5K_IMR_GPIO; - - /* Enable GPIO interrupts */ - AR5K_REG_ENABLE_BITS(ah, AR5K_PIMR, AR5K_IMR_GPIO); -} - diff --git a/drivers/net/wireless/ath/ath5k/initvals.c b/drivers/net/wireless/ath/ath5k/initvals.c deleted file mode 100644 index ee1c2fa8b591..000000000000 --- a/drivers/net/wireless/ath/ath5k/initvals.c +++ /dev/null @@ -1,1605 +0,0 @@ -/* - * Initial register settings functions - * - * Copyright (c) 2004-2007 Reyk Floeter - * Copyright (c) 2006-2009 Nick Kossifidis - * Copyright (c) 2007-2008 Jiri Slaby - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include "ath5k.h" -#include "reg.h" -#include "debug.h" - -/** - * struct ath5k_ini - Mode-independent initial register writes - * @ini_register: Register address - * @ini_value: Default value - * @ini_mode: 0 to write 1 to read (and clear) - */ -struct ath5k_ini { - u16 ini_register; - u32 ini_value; - - enum { - AR5K_INI_WRITE = 0, /* Default */ - AR5K_INI_READ = 1, - } ini_mode; -}; - -/** - * struct ath5k_ini_mode - Mode specific initial register values - * @mode_register: Register address - * @mode_value: Set of values for each enum ath5k_driver_mode - */ -struct ath5k_ini_mode { - u16 mode_register; - u32 mode_value[3]; -}; - -/* Initial register settings for AR5210 */ -static const struct ath5k_ini ar5210_ini[] = { - /* PCU and MAC registers */ - { AR5K_NOQCU_TXDP0, 0 }, - { AR5K_NOQCU_TXDP1, 0 }, - { AR5K_RXDP, 0 }, - { AR5K_CR, 0 }, - { AR5K_ISR, 0, AR5K_INI_READ }, - { AR5K_IMR, 0 }, - { AR5K_IER, AR5K_IER_DISABLE }, - { AR5K_BSR, 0, AR5K_INI_READ }, - { AR5K_TXCFG, AR5K_DMASIZE_128B }, - { AR5K_RXCFG, AR5K_DMASIZE_128B }, - { AR5K_CFG, AR5K_INIT_CFG }, - { AR5K_TOPS, 8 }, - { AR5K_RXNOFRM, 8 }, - { AR5K_RPGTO, 0 }, - { AR5K_TXNOFRM, 0 }, - { AR5K_SFR, 0 }, - { AR5K_MIBC, 0 }, - { AR5K_MISC, 0 }, - { AR5K_RX_FILTER_5210, 0 }, - { AR5K_MCAST_FILTER0_5210, 0 }, - { AR5K_MCAST_FILTER1_5210, 0 }, - { AR5K_TX_MASK0, 0 }, - { AR5K_TX_MASK1, 0 }, - { AR5K_CLR_TMASK, 0 }, - { AR5K_TRIG_LVL, AR5K_TUNE_MIN_TX_FIFO_THRES }, - { AR5K_DIAG_SW_5210, 0 }, - { AR5K_RSSI_THR, AR5K_TUNE_RSSI_THRES }, - { AR5K_TSF_L32_5210, 0 }, - { AR5K_TIMER0_5210, 0 }, - { AR5K_TIMER1_5210, 0xffffffff }, - { AR5K_TIMER2_5210, 0xffffffff }, - { AR5K_TIMER3_5210, 1 }, - { AR5K_CFP_DUR_5210, 0 }, - { AR5K_CFP_PERIOD_5210, 0 }, - /* PHY registers */ - { AR5K_PHY(0), 0x00000047 }, - { AR5K_PHY_AGC, 0x00000000 }, - { AR5K_PHY(3), 0x09848ea6 }, - { AR5K_PHY(4), 0x3d32e000 }, - { AR5K_PHY(5), 0x0000076b }, - { AR5K_PHY_ACT, AR5K_PHY_ACT_DISABLE }, - { AR5K_PHY(8), 0x02020200 }, - { AR5K_PHY(9), 0x00000e0e }, - { AR5K_PHY(10), 0x0a020201 }, - { AR5K_PHY(11), 0x00036ffc }, - { AR5K_PHY(12), 0x00000000 }, - { AR5K_PHY(13), 0x00000e0e }, - { AR5K_PHY(14), 0x00000007 }, - { AR5K_PHY(15), 0x00020100 }, - { AR5K_PHY(16), 0x89630000 }, - { AR5K_PHY(17), 0x1372169c }, - { AR5K_PHY(18), 0x0018b633 }, - { AR5K_PHY(19), 0x1284613c }, - { AR5K_PHY(20), 0x0de8b8e0 }, - { AR5K_PHY(21), 0x00074859 }, - { AR5K_PHY(22), 0x7e80beba }, - { AR5K_PHY(23), 0x313a665e }, - { AR5K_PHY_AGCCTL, 0x00001d08 }, - { AR5K_PHY(25), 0x0001ce00 }, - { AR5K_PHY(26), 0x409a4190 }, - { AR5K_PHY(28), 0x0000000f }, - { AR5K_PHY(29), 0x00000080 }, - { AR5K_PHY(30), 0x00000004 }, - { AR5K_PHY(31), 0x00000018 }, /* 0x987c */ - { AR5K_PHY(64), 0x00000000 }, /* 0x9900 */ - { AR5K_PHY(65), 0x00000000 }, - { AR5K_PHY(66), 0x00000000 }, - { AR5K_PHY(67), 0x00800000 }, - { AR5K_PHY(68), 0x00000003 }, - /* BB gain table (64bytes) */ - { AR5K_BB_GAIN(0), 0x00000000 }, - { AR5K_BB_GAIN(1), 0x00000020 }, - { AR5K_BB_GAIN(2), 0x00000010 }, - { AR5K_BB_GAIN(3), 0x00000030 }, - { AR5K_BB_GAIN(4), 0x00000008 }, - { AR5K_BB_GAIN(5), 0x00000028 }, - { AR5K_BB_GAIN(6), 0x00000028 }, - { AR5K_BB_GAIN(7), 0x00000004 }, - { AR5K_BB_GAIN(8), 0x00000024 }, - { AR5K_BB_GAIN(9), 0x00000014 }, - { AR5K_BB_GAIN(10), 0x00000034 }, - { AR5K_BB_GAIN(11), 0x0000000c }, - { AR5K_BB_GAIN(12), 0x0000002c }, - { AR5K_BB_GAIN(13), 0x00000002 }, - { AR5K_BB_GAIN(14), 0x00000022 }, - { AR5K_BB_GAIN(15), 0x00000012 }, - { AR5K_BB_GAIN(16), 0x00000032 }, - { AR5K_BB_GAIN(17), 0x0000000a }, - { AR5K_BB_GAIN(18), 0x0000002a }, - { AR5K_BB_GAIN(19), 0x00000001 }, - { AR5K_BB_GAIN(20), 0x00000021 }, - { AR5K_BB_GAIN(21), 0x00000011 }, - { AR5K_BB_GAIN(22), 0x00000031 }, - { AR5K_BB_GAIN(23), 0x00000009 }, - { AR5K_BB_GAIN(24), 0x00000029 }, - { AR5K_BB_GAIN(25), 0x00000005 }, - { AR5K_BB_GAIN(26), 0x00000025 }, - { AR5K_BB_GAIN(27), 0x00000015 }, - { AR5K_BB_GAIN(28), 0x00000035 }, - { AR5K_BB_GAIN(29), 0x0000000d }, - { AR5K_BB_GAIN(30), 0x0000002d }, - { AR5K_BB_GAIN(31), 0x00000003 }, - { AR5K_BB_GAIN(32), 0x00000023 }, - { AR5K_BB_GAIN(33), 0x00000013 }, - { AR5K_BB_GAIN(34), 0x00000033 }, - { AR5K_BB_GAIN(35), 0x0000000b }, - { AR5K_BB_GAIN(36), 0x0000002b }, - { AR5K_BB_GAIN(37), 0x00000007 }, - { AR5K_BB_GAIN(38), 0x00000027 }, - { AR5K_BB_GAIN(39), 0x00000017 }, - { AR5K_BB_GAIN(40), 0x00000037 }, - { AR5K_BB_GAIN(41), 0x0000000f }, - { AR5K_BB_GAIN(42), 0x0000002f }, - { AR5K_BB_GAIN(43), 0x0000002f }, - { AR5K_BB_GAIN(44), 0x0000002f }, - { AR5K_BB_GAIN(45), 0x0000002f }, - { AR5K_BB_GAIN(46), 0x0000002f }, - { AR5K_BB_GAIN(47), 0x0000002f }, - { AR5K_BB_GAIN(48), 0x0000002f }, - { AR5K_BB_GAIN(49), 0x0000002f }, - { AR5K_BB_GAIN(50), 0x0000002f }, - { AR5K_BB_GAIN(51), 0x0000002f }, - { AR5K_BB_GAIN(52), 0x0000002f }, - { AR5K_BB_GAIN(53), 0x0000002f }, - { AR5K_BB_GAIN(54), 0x0000002f }, - { AR5K_BB_GAIN(55), 0x0000002f }, - { AR5K_BB_GAIN(56), 0x0000002f }, - { AR5K_BB_GAIN(57), 0x0000002f }, - { AR5K_BB_GAIN(58), 0x0000002f }, - { AR5K_BB_GAIN(59), 0x0000002f }, - { AR5K_BB_GAIN(60), 0x0000002f }, - { AR5K_BB_GAIN(61), 0x0000002f }, - { AR5K_BB_GAIN(62), 0x0000002f }, - { AR5K_BB_GAIN(63), 0x0000002f }, - /* 5110 RF gain table (64btes) */ - { AR5K_RF_GAIN(0), 0x0000001d }, - { AR5K_RF_GAIN(1), 0x0000005d }, - { AR5K_RF_GAIN(2), 0x0000009d }, - { AR5K_RF_GAIN(3), 0x000000dd }, - { AR5K_RF_GAIN(4), 0x0000011d }, - { AR5K_RF_GAIN(5), 0x00000021 }, - { AR5K_RF_GAIN(6), 0x00000061 }, - { AR5K_RF_GAIN(7), 0x000000a1 }, - { AR5K_RF_GAIN(8), 0x000000e1 }, - { AR5K_RF_GAIN(9), 0x00000031 }, - { AR5K_RF_GAIN(10), 0x00000071 }, - { AR5K_RF_GAIN(11), 0x000000b1 }, - { AR5K_RF_GAIN(12), 0x0000001c }, - { AR5K_RF_GAIN(13), 0x0000005c }, - { AR5K_RF_GAIN(14), 0x00000029 }, - { AR5K_RF_GAIN(15), 0x00000069 }, - { AR5K_RF_GAIN(16), 0x000000a9 }, - { AR5K_RF_GAIN(17), 0x00000020 }, - { AR5K_RF_GAIN(18), 0x00000019 }, - { AR5K_RF_GAIN(19), 0x00000059 }, - { AR5K_RF_GAIN(20), 0x00000099 }, - { AR5K_RF_GAIN(21), 0x00000030 }, - { AR5K_RF_GAIN(22), 0x00000005 }, - { AR5K_RF_GAIN(23), 0x00000025 }, - { AR5K_RF_GAIN(24), 0x00000065 }, - { AR5K_RF_GAIN(25), 0x000000a5 }, - { AR5K_RF_GAIN(26), 0x00000028 }, - { AR5K_RF_GAIN(27), 0x00000068 }, - { AR5K_RF_GAIN(28), 0x0000001f }, - { AR5K_RF_GAIN(29), 0x0000001e }, - { AR5K_RF_GAIN(30), 0x00000018 }, - { AR5K_RF_GAIN(31), 0x00000058 }, - { AR5K_RF_GAIN(32), 0x00000098 }, - { AR5K_RF_GAIN(33), 0x00000003 }, - { AR5K_RF_GAIN(34), 0x00000004 }, - { AR5K_RF_GAIN(35), 0x00000044 }, - { AR5K_RF_GAIN(36), 0x00000084 }, - { AR5K_RF_GAIN(37), 0x00000013 }, - { AR5K_RF_GAIN(38), 0x00000012 }, - { AR5K_RF_GAIN(39), 0x00000052 }, - { AR5K_RF_GAIN(40), 0x00000092 }, - { AR5K_RF_GAIN(41), 0x000000d2 }, - { AR5K_RF_GAIN(42), 0x0000002b }, - { AR5K_RF_GAIN(43), 0x0000002a }, - { AR5K_RF_GAIN(44), 0x0000006a }, - { AR5K_RF_GAIN(45), 0x000000aa }, - { AR5K_RF_GAIN(46), 0x0000001b }, - { AR5K_RF_GAIN(47), 0x0000001a }, - { AR5K_RF_GAIN(48), 0x0000005a }, - { AR5K_RF_GAIN(49), 0x0000009a }, - { AR5K_RF_GAIN(50), 0x000000da }, - { AR5K_RF_GAIN(51), 0x00000006 }, - { AR5K_RF_GAIN(52), 0x00000006 }, - { AR5K_RF_GAIN(53), 0x00000006 }, - { AR5K_RF_GAIN(54), 0x00000006 }, - { AR5K_RF_GAIN(55), 0x00000006 }, - { AR5K_RF_GAIN(56), 0x00000006 }, - { AR5K_RF_GAIN(57), 0x00000006 }, - { AR5K_RF_GAIN(58), 0x00000006 }, - { AR5K_RF_GAIN(59), 0x00000006 }, - { AR5K_RF_GAIN(60), 0x00000006 }, - { AR5K_RF_GAIN(61), 0x00000006 }, - { AR5K_RF_GAIN(62), 0x00000006 }, - { AR5K_RF_GAIN(63), 0x00000006 }, - /* PHY activation */ - { AR5K_PHY(53), 0x00000020 }, - { AR5K_PHY(51), 0x00000004 }, - { AR5K_PHY(50), 0x00060106 }, - { AR5K_PHY(39), 0x0000006d }, - { AR5K_PHY(48), 0x00000000 }, - { AR5K_PHY(52), 0x00000014 }, - { AR5K_PHY_ACT, AR5K_PHY_ACT_ENABLE }, -}; - -/* Initial register settings for AR5211 */ -static const struct ath5k_ini ar5211_ini[] = { - { AR5K_RXDP, 0x00000000 }, - { AR5K_RTSD0, 0x84849c9c }, - { AR5K_RTSD1, 0x7c7c7c7c }, - { AR5K_RXCFG, 0x00000005 }, - { AR5K_MIBC, 0x00000000 }, - { AR5K_TOPS, 0x00000008 }, - { AR5K_RXNOFRM, 0x00000008 }, - { AR5K_TXNOFRM, 0x00000010 }, - { AR5K_RPGTO, 0x00000000 }, - { AR5K_RFCNT, 0x0000001f }, - { AR5K_QUEUE_TXDP(0), 0x00000000 }, - { AR5K_QUEUE_TXDP(1), 0x00000000 }, - { AR5K_QUEUE_TXDP(2), 0x00000000 }, - { AR5K_QUEUE_TXDP(3), 0x00000000 }, - { AR5K_QUEUE_TXDP(4), 0x00000000 }, - { AR5K_QUEUE_TXDP(5), 0x00000000 }, - { AR5K_QUEUE_TXDP(6), 0x00000000 }, - { AR5K_QUEUE_TXDP(7), 0x00000000 }, - { AR5K_QUEUE_TXDP(8), 0x00000000 }, - { AR5K_QUEUE_TXDP(9), 0x00000000 }, - { AR5K_DCU_FP, 0x00000000 }, - { AR5K_STA_ID1, 0x00000000 }, - { AR5K_BSS_ID0, 0x00000000 }, - { AR5K_BSS_ID1, 0x00000000 }, - { AR5K_RSSI_THR, 0x00000000 }, - { AR5K_CFP_PERIOD_5211, 0x00000000 }, - { AR5K_TIMER0_5211, 0x00000030 }, - { AR5K_TIMER1_5211, 0x0007ffff }, - { AR5K_TIMER2_5211, 0x01ffffff }, - { AR5K_TIMER3_5211, 0x00000031 }, - { AR5K_CFP_DUR_5211, 0x00000000 }, - { AR5K_RX_FILTER_5211, 0x00000000 }, - { AR5K_MCAST_FILTER0_5211, 0x00000000 }, - { AR5K_MCAST_FILTER1_5211, 0x00000002 }, - { AR5K_DIAG_SW_5211, 0x00000000 }, - { AR5K_ADDAC_TEST, 0x00000000 }, - { AR5K_DEFAULT_ANTENNA, 0x00000000 }, - /* PHY registers */ - { AR5K_PHY_AGC, 0x00000000 }, - { AR5K_PHY(3), 0x2d849093 }, - { AR5K_PHY(4), 0x7d32e000 }, - { AR5K_PHY(5), 0x00000f6b }, - { AR5K_PHY_ACT, 0x00000000 }, - { AR5K_PHY(11), 0x00026ffe }, - { AR5K_PHY(12), 0x00000000 }, - { AR5K_PHY(15), 0x00020100 }, - { AR5K_PHY(16), 0x206a017a }, - { AR5K_PHY(19), 0x1284613c }, - { AR5K_PHY(21), 0x00000859 }, - { AR5K_PHY(26), 0x409a4190 }, /* 0x9868 */ - { AR5K_PHY(27), 0x050cb081 }, - { AR5K_PHY(28), 0x0000000f }, - { AR5K_PHY(29), 0x00000080 }, - { AR5K_PHY(30), 0x0000000c }, - { AR5K_PHY(64), 0x00000000 }, - { AR5K_PHY(65), 0x00000000 }, - { AR5K_PHY(66), 0x00000000 }, - { AR5K_PHY(67), 0x00800000 }, - { AR5K_PHY(68), 0x00000001 }, - { AR5K_PHY(71), 0x0000092a }, - { AR5K_PHY_IQ, 0x00000000 }, - { AR5K_PHY(73), 0x00058a05 }, - { AR5K_PHY(74), 0x00000001 }, - { AR5K_PHY(75), 0x00000000 }, - { AR5K_PHY_PAPD_PROBE, 0x00000000 }, - { AR5K_PHY(77), 0x00000000 }, /* 0x9934 */ - { AR5K_PHY(78), 0x00000000 }, /* 0x9938 */ - { AR5K_PHY(79), 0x0000003f }, /* 0x993c */ - { AR5K_PHY(80), 0x00000004 }, - { AR5K_PHY(82), 0x00000000 }, - { AR5K_PHY(83), 0x00000000 }, - { AR5K_PHY(84), 0x00000000 }, - { AR5K_PHY_RADAR, 0x5d50f14c }, - { AR5K_PHY(86), 0x00000018 }, - { AR5K_PHY(87), 0x004b6a8e }, - /* Initial Power table (32bytes) - * common on all cards/modes. - * Note: Table is rewritten during - * txpower setup later using calibration - * data etc. so next write is non-common */ - { AR5K_PHY_PCDAC_TXPOWER(1), 0x06ff05ff }, - { AR5K_PHY_PCDAC_TXPOWER(2), 0x07ff07ff }, - { AR5K_PHY_PCDAC_TXPOWER(3), 0x08ff08ff }, - { AR5K_PHY_PCDAC_TXPOWER(4), 0x09ff09ff }, - { AR5K_PHY_PCDAC_TXPOWER(5), 0x0aff0aff }, - { AR5K_PHY_PCDAC_TXPOWER(6), 0x0bff0bff }, - { AR5K_PHY_PCDAC_TXPOWER(7), 0x0cff0cff }, - { AR5K_PHY_PCDAC_TXPOWER(8), 0x0dff0dff }, - { AR5K_PHY_PCDAC_TXPOWER(9), 0x0fff0eff }, - { AR5K_PHY_PCDAC_TXPOWER(10), 0x12ff12ff }, - { AR5K_PHY_PCDAC_TXPOWER(11), 0x14ff13ff }, - { AR5K_PHY_PCDAC_TXPOWER(12), 0x16ff15ff }, - { AR5K_PHY_PCDAC_TXPOWER(13), 0x19ff17ff }, - { AR5K_PHY_PCDAC_TXPOWER(14), 0x1bff1aff }, - { AR5K_PHY_PCDAC_TXPOWER(15), 0x1eff1dff }, - { AR5K_PHY_PCDAC_TXPOWER(16), 0x23ff20ff }, - { AR5K_PHY_PCDAC_TXPOWER(17), 0x27ff25ff }, - { AR5K_PHY_PCDAC_TXPOWER(18), 0x2cff29ff }, - { AR5K_PHY_PCDAC_TXPOWER(19), 0x31ff2fff }, - { AR5K_PHY_PCDAC_TXPOWER(20), 0x37ff34ff }, - { AR5K_PHY_PCDAC_TXPOWER(21), 0x3aff3aff }, - { AR5K_PHY_PCDAC_TXPOWER(22), 0x3aff3aff }, - { AR5K_PHY_PCDAC_TXPOWER(23), 0x3aff3aff }, - { AR5K_PHY_PCDAC_TXPOWER(24), 0x3aff3aff }, - { AR5K_PHY_PCDAC_TXPOWER(25), 0x3aff3aff }, - { AR5K_PHY_PCDAC_TXPOWER(26), 0x3aff3aff }, - { AR5K_PHY_PCDAC_TXPOWER(27), 0x3aff3aff }, - { AR5K_PHY_PCDAC_TXPOWER(28), 0x3aff3aff }, - { AR5K_PHY_PCDAC_TXPOWER(29), 0x3aff3aff }, - { AR5K_PHY_PCDAC_TXPOWER(30), 0x3aff3aff }, - { AR5K_PHY_PCDAC_TXPOWER(31), 0x3aff3aff }, - { AR5K_PHY_CCKTXCTL, 0x00000000 }, - { AR5K_PHY(642), 0x503e4646 }, - { AR5K_PHY_GAIN_2GHZ, 0x6480416c }, - { AR5K_PHY(644), 0x0199a003 }, - { AR5K_PHY(645), 0x044cd610 }, - { AR5K_PHY(646), 0x13800040 }, - { AR5K_PHY(647), 0x1be00060 }, - { AR5K_PHY(648), 0x0c53800a }, - { AR5K_PHY(649), 0x0014df3b }, - { AR5K_PHY(650), 0x000001b5 }, - { AR5K_PHY(651), 0x00000020 }, -}; - -/* Initial mode-specific settings for AR5211 - * 5211 supports OFDM-only g (draft g) but we - * need to test it ! */ -static const struct ath5k_ini_mode ar5211_ini_mode[] = { - { AR5K_TXCFG, - /* A B G */ - { 0x00000015, 0x0000001d, 0x00000015 } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(0), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(1), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(2), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(3), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(4), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(5), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(6), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(7), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(8), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(9), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_DCU_GBL_IFS_SLOT, - { 0x00000168, 0x000001b8, 0x00000168 } }, - { AR5K_DCU_GBL_IFS_SIFS, - { 0x00000230, 0x000000b0, 0x00000230 } }, - { AR5K_DCU_GBL_IFS_EIFS, - { 0x00000d98, 0x00001f48, 0x00000d98 } }, - { AR5K_DCU_GBL_IFS_MISC, - { 0x0000a0e0, 0x00005880, 0x0000a0e0 } }, - { AR5K_TIME_OUT, - { 0x04000400, 0x20003000, 0x04000400 } }, - { AR5K_USEC_5211, - { 0x0e8d8fa7, 0x01608f95, 0x0e8d8fa7 } }, - { AR5K_PHY(8), - { 0x02020200, 0x02010200, 0x02020200 } }, - { AR5K_PHY_RF_CTL2, - { 0x00000e0e, 0x00000707, 0x00000e0e } }, - { AR5K_PHY_RF_CTL3, - { 0x0a020001, 0x05010000, 0x0a020001 } }, - { AR5K_PHY_RF_CTL4, - { 0x00000e0e, 0x00000e0e, 0x00000e0e } }, - { AR5K_PHY_PA_CTL, - { 0x00000007, 0x0000000b, 0x0000000b } }, - { AR5K_PHY_SETTLING, - { 0x1372169c, 0x137216a8, 0x1372169c } }, - { AR5K_PHY_GAIN, - { 0x0018ba67, 0x0018ba69, 0x0018ba69 } }, - { AR5K_PHY_DESIRED_SIZE, - { 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0 } }, - { AR5K_PHY_SIG, - { 0x7e800d2e, 0x7ec00d2e, 0x7e800d2e } }, - { AR5K_PHY_AGCCOARSE, - { 0x31375d5e, 0x313a5d5e, 0x31375d5e } }, - { AR5K_PHY_AGCCTL, - { 0x0000bd10, 0x0000bd38, 0x0000bd10 } }, - { AR5K_PHY_NF, - { 0x0001ce00, 0x0001ce00, 0x0001ce00 } }, - { AR5K_PHY_RX_DELAY, - { 0x00002710, 0x0000157c, 0x00002710 } }, - { AR5K_PHY(70), - { 0x00000190, 0x00000084, 0x00000190 } }, - { AR5K_PHY_FRAME_CTL_5211, - { 0x6fe01020, 0x6fe00920, 0x6fe01020 } }, - { AR5K_PHY_PCDAC_TXPOWER_BASE, - { 0x05ff14ff, 0x05ff14ff, 0x05ff19ff } }, - { AR5K_RF_BUFFER_CONTROL_4, - { 0x00000010, 0x00000010, 0x00000010 } }, -}; - -/* Initial register settings for AR5212 and newer chips */ -static const struct ath5k_ini ar5212_ini_common_start[] = { - { AR5K_RXDP, 0x00000000 }, - { AR5K_RXCFG, 0x00000005 }, - { AR5K_MIBC, 0x00000000 }, - { AR5K_TOPS, 0x00000008 }, - { AR5K_RXNOFRM, 0x00000008 }, - { AR5K_TXNOFRM, 0x00000010 }, - { AR5K_RPGTO, 0x00000000 }, - { AR5K_RFCNT, 0x0000001f }, - { AR5K_QUEUE_TXDP(0), 0x00000000 }, - { AR5K_QUEUE_TXDP(1), 0x00000000 }, - { AR5K_QUEUE_TXDP(2), 0x00000000 }, - { AR5K_QUEUE_TXDP(3), 0x00000000 }, - { AR5K_QUEUE_TXDP(4), 0x00000000 }, - { AR5K_QUEUE_TXDP(5), 0x00000000 }, - { AR5K_QUEUE_TXDP(6), 0x00000000 }, - { AR5K_QUEUE_TXDP(7), 0x00000000 }, - { AR5K_QUEUE_TXDP(8), 0x00000000 }, - { AR5K_QUEUE_TXDP(9), 0x00000000 }, - { AR5K_DCU_FP, 0x00000000 }, - { AR5K_DCU_TXP, 0x00000000 }, - /* Tx filter table 0 (32 entries) */ - { AR5K_DCU_TX_FILTER_0(0), 0x00000000 }, /* DCU 0 */ - { AR5K_DCU_TX_FILTER_0(1), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(2), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(3), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(4), 0x00000000 }, /* DCU 1 */ - { AR5K_DCU_TX_FILTER_0(5), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(6), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(7), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(8), 0x00000000 }, /* DCU 2 */ - { AR5K_DCU_TX_FILTER_0(9), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(10), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(11), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(12), 0x00000000 }, /* DCU 3 */ - { AR5K_DCU_TX_FILTER_0(13), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(14), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(15), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(16), 0x00000000 }, /* DCU 4 */ - { AR5K_DCU_TX_FILTER_0(17), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(18), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(19), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(20), 0x00000000 }, /* DCU 5 */ - { AR5K_DCU_TX_FILTER_0(21), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(22), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(23), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(24), 0x00000000 }, /* DCU 6 */ - { AR5K_DCU_TX_FILTER_0(25), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(26), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(27), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(28), 0x00000000 }, /* DCU 7 */ - { AR5K_DCU_TX_FILTER_0(29), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(30), 0x00000000 }, - { AR5K_DCU_TX_FILTER_0(31), 0x00000000 }, - /* Tx filter table 1 (16 entries) */ - { AR5K_DCU_TX_FILTER_1(0), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(1), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(2), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(3), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(4), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(5), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(6), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(7), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(8), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(9), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(10), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(11), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(12), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(13), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(14), 0x00000000 }, - { AR5K_DCU_TX_FILTER_1(15), 0x00000000 }, - { AR5K_DCU_TX_FILTER_CLR, 0x00000000 }, - { AR5K_DCU_TX_FILTER_SET, 0x00000000 }, - { AR5K_STA_ID1, 0x00000000 }, - { AR5K_BSS_ID0, 0x00000000 }, - { AR5K_BSS_ID1, 0x00000000 }, - { AR5K_BEACON_5211, 0x00000000 }, - { AR5K_CFP_PERIOD_5211, 0x00000000 }, - { AR5K_TIMER0_5211, 0x00000030 }, - { AR5K_TIMER1_5211, 0x0007ffff }, - { AR5K_TIMER2_5211, 0x01ffffff }, - { AR5K_TIMER3_5211, 0x00000031 }, - { AR5K_CFP_DUR_5211, 0x00000000 }, - { AR5K_RX_FILTER_5211, 0x00000000 }, - { AR5K_DIAG_SW_5211, 0x00000000 }, - { AR5K_ADDAC_TEST, 0x00000000 }, - { AR5K_DEFAULT_ANTENNA, 0x00000000 }, - { AR5K_FRAME_CTL_QOSM, 0x000fc78f }, - { AR5K_XRMODE, 0x2a82301a }, - { AR5K_XRDELAY, 0x05dc01e0 }, - { AR5K_XRTIMEOUT, 0x1f402710 }, - { AR5K_XRCHIRP, 0x01f40000 }, - { AR5K_XRSTOMP, 0x00001e1c }, - { AR5K_SLEEP0, 0x0002aaaa }, - { AR5K_SLEEP1, 0x02005555 }, - { AR5K_SLEEP2, 0x00000000 }, - { AR_BSSMSKL, 0xffffffff }, - { AR_BSSMSKU, 0x0000ffff }, - { AR5K_TXPC, 0x00000000 }, - { AR5K_PROFCNT_TX, 0x00000000 }, - { AR5K_PROFCNT_RX, 0x00000000 }, - { AR5K_PROFCNT_RXCLR, 0x00000000 }, - { AR5K_PROFCNT_CYCLE, 0x00000000 }, - { AR5K_QUIET_CTL1, 0x00000088 }, - /* Initial rate duration table (32 entries )*/ - { AR5K_RATE_DUR(0), 0x00000000 }, - { AR5K_RATE_DUR(1), 0x0000008c }, - { AR5K_RATE_DUR(2), 0x000000e4 }, - { AR5K_RATE_DUR(3), 0x000002d5 }, - { AR5K_RATE_DUR(4), 0x00000000 }, - { AR5K_RATE_DUR(5), 0x00000000 }, - { AR5K_RATE_DUR(6), 0x000000a0 }, - { AR5K_RATE_DUR(7), 0x000001c9 }, - { AR5K_RATE_DUR(8), 0x0000002c }, - { AR5K_RATE_DUR(9), 0x0000002c }, - { AR5K_RATE_DUR(10), 0x00000030 }, - { AR5K_RATE_DUR(11), 0x0000003c }, - { AR5K_RATE_DUR(12), 0x0000002c }, - { AR5K_RATE_DUR(13), 0x0000002c }, - { AR5K_RATE_DUR(14), 0x00000030 }, - { AR5K_RATE_DUR(15), 0x0000003c }, - { AR5K_RATE_DUR(16), 0x00000000 }, - { AR5K_RATE_DUR(17), 0x00000000 }, - { AR5K_RATE_DUR(18), 0x00000000 }, - { AR5K_RATE_DUR(19), 0x00000000 }, - { AR5K_RATE_DUR(20), 0x00000000 }, - { AR5K_RATE_DUR(21), 0x00000000 }, - { AR5K_RATE_DUR(22), 0x00000000 }, - { AR5K_RATE_DUR(23), 0x00000000 }, - { AR5K_RATE_DUR(24), 0x000000d5 }, - { AR5K_RATE_DUR(25), 0x000000df }, - { AR5K_RATE_DUR(26), 0x00000102 }, - { AR5K_RATE_DUR(27), 0x0000013a }, - { AR5K_RATE_DUR(28), 0x00000075 }, - { AR5K_RATE_DUR(29), 0x0000007f }, - { AR5K_RATE_DUR(30), 0x000000a2 }, - { AR5K_RATE_DUR(31), 0x00000000 }, - { AR5K_QUIET_CTL2, 0x00010002 }, - { AR5K_TSF_PARM, 0x00000001 }, - { AR5K_QOS_NOACK, 0x000000c0 }, - { AR5K_PHY_ERR_FIL, 0x00000000 }, - { AR5K_XRLAT_TX, 0x00000168 }, - { AR5K_ACKSIFS, 0x00000000 }, - /* Rate -> db table - * notice ...03<-02<-01<-00 ! */ - { AR5K_RATE2DB(0), 0x03020100 }, - { AR5K_RATE2DB(1), 0x07060504 }, - { AR5K_RATE2DB(2), 0x0b0a0908 }, - { AR5K_RATE2DB(3), 0x0f0e0d0c }, - { AR5K_RATE2DB(4), 0x13121110 }, - { AR5K_RATE2DB(5), 0x17161514 }, - { AR5K_RATE2DB(6), 0x1b1a1918 }, - { AR5K_RATE2DB(7), 0x1f1e1d1c }, - /* Db -> Rate table */ - { AR5K_DB2RATE(0), 0x03020100 }, - { AR5K_DB2RATE(1), 0x07060504 }, - { AR5K_DB2RATE(2), 0x0b0a0908 }, - { AR5K_DB2RATE(3), 0x0f0e0d0c }, - { AR5K_DB2RATE(4), 0x13121110 }, - { AR5K_DB2RATE(5), 0x17161514 }, - { AR5K_DB2RATE(6), 0x1b1a1918 }, - { AR5K_DB2RATE(7), 0x1f1e1d1c }, - /* PHY registers (Common settings - * for all chips/modes) */ - { AR5K_PHY(3), 0xad848e19 }, - { AR5K_PHY(4), 0x7d28e000 }, - { AR5K_PHY_TIMING_3, 0x9c0a9f6b }, - { AR5K_PHY_ACT, 0x00000000 }, - { AR5K_PHY(16), 0x206a017a }, - { AR5K_PHY(21), 0x00000859 }, - { AR5K_PHY_BIN_MASK_1, 0x00000000 }, - { AR5K_PHY_BIN_MASK_2, 0x00000000 }, - { AR5K_PHY_BIN_MASK_3, 0x00000000 }, - { AR5K_PHY_BIN_MASK_CTL, 0x00800000 }, - { AR5K_PHY_ANT_CTL, 0x00000001 }, - /*{ AR5K_PHY(71), 0x0000092a },*/ /* Old value */ - { AR5K_PHY_MAX_RX_LEN, 0x00000c80 }, - { AR5K_PHY_IQ, 0x05100000 }, - { AR5K_PHY_WARM_RESET, 0x00000001 }, - { AR5K_PHY_CTL, 0x00000004 }, - { AR5K_PHY_TXPOWER_RATE1, 0x1e1f2022 }, - { AR5K_PHY_TXPOWER_RATE2, 0x0a0b0c0d }, - { AR5K_PHY_TXPOWER_RATE_MAX, 0x0000003f }, - { AR5K_PHY(82), 0x9280b212 }, - { AR5K_PHY_RADAR, 0x5d50e188 }, - /*{ AR5K_PHY(86), 0x000000ff },*/ - { AR5K_PHY(87), 0x004b6a8e }, - { AR5K_PHY_NFTHRES, 0x000003ce }, - { AR5K_PHY_RESTART, 0x192fb515 }, - { AR5K_PHY(94), 0x00000001 }, - { AR5K_PHY_RFBUS_REQ, 0x00000000 }, - /*{ AR5K_PHY(644), 0x0080a333 },*/ /* Old value */ - /*{ AR5K_PHY(645), 0x00206c10 },*/ /* Old value */ - { AR5K_PHY(644), 0x00806333 }, - { AR5K_PHY(645), 0x00106c10 }, - { AR5K_PHY(646), 0x009c4060 }, - /* { AR5K_PHY(647), 0x1483800a }, */ - /* { AR5K_PHY(648), 0x01831061 }, */ /* Old value */ - { AR5K_PHY(648), 0x018830c6 }, - { AR5K_PHY(649), 0x00000400 }, - /*{ AR5K_PHY(650), 0x000001b5 },*/ - { AR5K_PHY(651), 0x00000000 }, - { AR5K_PHY_TXPOWER_RATE3, 0x20202020 }, - { AR5K_PHY_TXPOWER_RATE4, 0x20202020 }, - /*{ AR5K_PHY(655), 0x13c889af },*/ - { AR5K_PHY(656), 0x38490a20 }, - { AR5K_PHY(657), 0x00007bb6 }, - { AR5K_PHY(658), 0x0fff3ffc }, -}; - -/* Initial mode-specific settings for AR5212 (Written before ar5212_ini) */ -static const struct ath5k_ini_mode ar5212_ini_mode_start[] = { - { AR5K_QUEUE_DFS_LOCAL_IFS(0), - /* A/XR B G */ - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(1), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(2), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(3), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(4), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(5), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(6), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(7), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(8), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_QUEUE_DFS_LOCAL_IFS(9), - { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, - { AR5K_DCU_GBL_IFS_SIFS, - { 0x00000230, 0x000000b0, 0x00000160 } }, - { AR5K_DCU_GBL_IFS_SLOT, - { 0x00000168, 0x000001b8, 0x0000018c } }, - { AR5K_DCU_GBL_IFS_EIFS, - { 0x00000e60, 0x00001f1c, 0x00003e38 } }, - { AR5K_DCU_GBL_IFS_MISC, - { 0x0000a0e0, 0x00005880, 0x0000b0e0 } }, - { AR5K_TIME_OUT, - { 0x03e803e8, 0x04200420, 0x08400840 } }, - { AR5K_PHY(8), - { 0x02020200, 0x02010200, 0x02020200 } }, - { AR5K_PHY_RF_CTL2, - { 0x00000e0e, 0x00000707, 0x00000e0e } }, - { AR5K_PHY_SETTLING, - { 0x1372161c, 0x13721722, 0x137216a2 } }, - { AR5K_PHY_AGCCTL, - { 0x00009d10, 0x00009d18, 0x00009d18 } }, - { AR5K_PHY_NF, - { 0x0001ce00, 0x0001ce00, 0x0001ce00 } }, - { AR5K_PHY_WEAK_OFDM_HIGH_THR, - { 0x409a4190, 0x409a4190, 0x409a4190 } }, - { AR5K_PHY(70), - { 0x000001b8, 0x00000084, 0x00000108 } }, - { AR5K_PHY_OFDM_SELFCORR, - { 0x10058a05, 0x10058a05, 0x10058a05 } }, - { 0xa230, - { 0x00000000, 0x00000000, 0x00000108 } }, -}; - -/* Initial mode-specific settings for AR5212 + RF5111 - * (Written after ar5212_ini) */ -static const struct ath5k_ini_mode rf5111_ini_mode_end[] = { - { AR5K_TXCFG, - /* A/XR B G */ - { 0x00008015, 0x00008015, 0x00008015 } }, - { AR5K_USEC_5211, - { 0x128d8fa7, 0x04e00f95, 0x12e00fab } }, - { AR5K_PHY_RF_CTL3, - { 0x0a020001, 0x05010100, 0x0a020001 } }, - { AR5K_PHY_RF_CTL4, - { 0x00000e0e, 0x00000e0e, 0x00000e0e } }, - { AR5K_PHY_PA_CTL, - { 0x00000007, 0x0000000b, 0x0000000b } }, - { AR5K_PHY_GAIN, - { 0x0018da5a, 0x0018ca69, 0x0018ca69 } }, - { AR5K_PHY_DESIRED_SIZE, - { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } }, - { AR5K_PHY_SIG, - { 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e } }, - { AR5K_PHY_AGCCOARSE, - { 0x3137665e, 0x3137665e, 0x3137665e } }, - { AR5K_PHY_WEAK_OFDM_LOW_THR, - { 0x050cb081, 0x050cb081, 0x050cb080 } }, - { AR5K_PHY_RX_DELAY, - { 0x00002710, 0x0000157c, 0x00002af8 } }, - { AR5K_PHY_FRAME_CTL_5211, - { 0xf7b81020, 0xf7b80d20, 0xf7b81020 } }, - { AR5K_PHY_GAIN_2GHZ, - { 0x642c416a, 0x6440416a, 0x6440416a } }, - { AR5K_PHY_CCK_RX_CTL_4, - { 0x1883800a, 0x1873800a, 0x1883800a } }, -}; - -/* Common for all modes */ -static const struct ath5k_ini rf5111_ini_common_end[] = { - { AR5K_DCU_FP, 0x00000000 }, - { AR5K_PHY_AGC, 0x00000000 }, - { AR5K_PHY_ADC_CTL, 0x00022ffe }, - { 0x983c, 0x00020100 }, - { AR5K_PHY_GAIN_OFFSET, 0x1284613c }, - { AR5K_PHY_PAPD_PROBE, 0x00004883 }, - { 0x9940, 0x00000004 }, - { 0x9958, 0x000000ff }, - { 0x9974, 0x00000000 }, - { AR5K_PHY_SPENDING, 0x00000018 }, - { AR5K_PHY_CCKTXCTL, 0x00000000 }, - { AR5K_PHY_CCK_CROSSCORR, 0xd03e6788 }, - { AR5K_PHY_DAG_CCK_CTL, 0x000001b5 }, - { 0xa23c, 0x13c889af }, -}; - - -/* Initial mode-specific settings for AR5212 + RF5112 - * (Written after ar5212_ini) */ -static const struct ath5k_ini_mode rf5112_ini_mode_end[] = { - { AR5K_TXCFG, - /* A/XR B G */ - { 0x00008015, 0x00008015, 0x00008015 } }, - { AR5K_USEC_5211, - { 0x128d93a7, 0x04e01395, 0x12e013ab } }, - { AR5K_PHY_RF_CTL3, - { 0x0a020001, 0x05020100, 0x0a020001 } }, - { AR5K_PHY_RF_CTL4, - { 0x00000e0e, 0x00000e0e, 0x00000e0e } }, - { AR5K_PHY_PA_CTL, - { 0x00000007, 0x0000000b, 0x0000000b } }, - { AR5K_PHY_GAIN, - { 0x0018da6d, 0x0018ca75, 0x0018ca75 } }, - { AR5K_PHY_DESIRED_SIZE, - { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } }, - { AR5K_PHY_SIG, - { 0x7e800d2e, 0x7ee80d2e, 0x7ee80d2e } }, - { AR5K_PHY_AGCCOARSE, - { 0x3137665e, 0x3137665e, 0x3137665e } }, - { AR5K_PHY_WEAK_OFDM_LOW_THR, - { 0x050cb081, 0x050cb081, 0x050cb081 } }, - { AR5K_PHY_RX_DELAY, - { 0x000007d0, 0x0000044c, 0x00000898 } }, - { AR5K_PHY_FRAME_CTL_5211, - { 0xf7b81020, 0xf7b80d10, 0xf7b81010 } }, - { AR5K_PHY_CCKTXCTL, - { 0x00000000, 0x00000008, 0x00000008 } }, - { AR5K_PHY_CCK_CROSSCORR, - { 0xd6be6788, 0xd03e6788, 0xd03e6788 } }, - { AR5K_PHY_GAIN_2GHZ, - { 0x642c0140, 0x6442c160, 0x6442c160 } }, - { AR5K_PHY_CCK_RX_CTL_4, - { 0x1883800a, 0x1873800a, 0x1883800a } }, -}; - -static const struct ath5k_ini rf5112_ini_common_end[] = { - { AR5K_DCU_FP, 0x00000000 }, - { AR5K_PHY_AGC, 0x00000000 }, - { AR5K_PHY_ADC_CTL, 0x00022ffe }, - { 0x983c, 0x00020100 }, - { AR5K_PHY_GAIN_OFFSET, 0x1284613c }, - { AR5K_PHY_PAPD_PROBE, 0x00004882 }, - { 0x9940, 0x00000004 }, - { 0x9958, 0x000000ff }, - { 0x9974, 0x00000000 }, - { AR5K_PHY_DAG_CCK_CTL, 0x000001b5 }, - { 0xa23c, 0x13c889af }, -}; - - -/* Initial mode-specific settings for RF5413/5414 - * (Written after ar5212_ini) */ -static const struct ath5k_ini_mode rf5413_ini_mode_end[] = { - { AR5K_TXCFG, - /* A/XR B G */ - { 0x00000015, 0x00000015, 0x00000015 } }, - { AR5K_USEC_5211, - { 0x128d93a7, 0x04e01395, 0x12e013ab } }, - { AR5K_PHY_RF_CTL3, - { 0x0a020001, 0x05020100, 0x0a020001 } }, - { AR5K_PHY_RF_CTL4, - { 0x00000e0e, 0x00000e0e, 0x00000e0e } }, - { AR5K_PHY_PA_CTL, - { 0x00000007, 0x0000000b, 0x0000000b } }, - { AR5K_PHY_GAIN, - { 0x0018fa61, 0x001a1a63, 0x001a1a63 } }, - { AR5K_PHY_DESIRED_SIZE, - { 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da } }, - { AR5K_PHY_SIG, - { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } }, - { AR5K_PHY_AGCCOARSE, - { 0x3139605e, 0x3139605e, 0x3139605e } }, - { AR5K_PHY_WEAK_OFDM_LOW_THR, - { 0x050cb081, 0x050cb081, 0x050cb081 } }, - { AR5K_PHY_RX_DELAY, - { 0x000007d0, 0x0000044c, 0x00000898 } }, - { AR5K_PHY_FRAME_CTL_5211, - { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } }, - { AR5K_PHY_CCKTXCTL, - { 0x00000000, 0x00000000, 0x00000000 } }, - { AR5K_PHY_CCK_CROSSCORR, - { 0xd6be6788, 0xd03e6788, 0xd03e6788 } }, - { AR5K_PHY_GAIN_2GHZ, - { 0x002ec1e0, 0x002ac120, 0x002ac120 } }, - { AR5K_PHY_CCK_RX_CTL_4, - { 0x1883800a, 0x1863800a, 0x1883800a } }, - { 0xa300, - { 0x18010000, 0x18010000, 0x18010000 } }, - { 0xa304, - { 0x30032602, 0x30032602, 0x30032602 } }, - { 0xa308, - { 0x48073e06, 0x48073e06, 0x48073e06 } }, - { 0xa30c, - { 0x560b4c0a, 0x560b4c0a, 0x560b4c0a } }, - { 0xa310, - { 0x641a600f, 0x641a600f, 0x641a600f } }, - { 0xa314, - { 0x784f6e1b, 0x784f6e1b, 0x784f6e1b } }, - { 0xa318, - { 0x868f7c5a, 0x868f7c5a, 0x868f7c5a } }, - { 0xa31c, - { 0x90cf865b, 0x8ecf865b, 0x8ecf865b } }, - { 0xa320, - { 0x9d4f970f, 0x9b4f970f, 0x9b4f970f } }, - { 0xa324, - { 0xa7cfa38f, 0xa3cf9f8f, 0xa3cf9f8f } }, - { 0xa328, - { 0xb55faf1f, 0xb35faf1f, 0xb35faf1f } }, - { 0xa32c, - { 0xbddfb99f, 0xbbdfb99f, 0xbbdfb99f } }, - { 0xa330, - { 0xcb7fc53f, 0xcb7fc73f, 0xcb7fc73f } }, - { 0xa334, - { 0xd5ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf } }, -}; - -static const struct ath5k_ini rf5413_ini_common_end[] = { - { AR5K_DCU_FP, 0x000003e0 }, - { AR5K_5414_CBCFG, 0x00000010 }, - { AR5K_SEQ_MASK, 0x0000000f }, - { 0x809c, 0x00000000 }, - { 0x80a0, 0x00000000 }, - { AR5K_MIC_QOS_CTL, 0x00000000 }, - { AR5K_MIC_QOS_SEL, 0x00000000 }, - { AR5K_MISC_MODE, 0x00000000 }, - { AR5K_OFDM_FIL_CNT, 0x00000000 }, - { AR5K_CCK_FIL_CNT, 0x00000000 }, - { AR5K_PHYERR_CNT1, 0x00000000 }, - { AR5K_PHYERR_CNT1_MASK, 0x00000000 }, - { AR5K_PHYERR_CNT2, 0x00000000 }, - { AR5K_PHYERR_CNT2_MASK, 0x00000000 }, - { AR5K_TSF_THRES, 0x00000000 }, - { 0x8140, 0x800003f9 }, - { 0x8144, 0x00000000 }, - { AR5K_PHY_AGC, 0x00000000 }, - { AR5K_PHY_ADC_CTL, 0x0000a000 }, - { 0x983c, 0x00200400 }, - { AR5K_PHY_GAIN_OFFSET, 0x1284233c }, - { AR5K_PHY_SCR, 0x0000001f }, - { AR5K_PHY_SLMT, 0x00000080 }, - { AR5K_PHY_SCAL, 0x0000000e }, - { 0x9958, 0x00081fff }, - { AR5K_PHY_TIMING_7, 0x00000000 }, - { AR5K_PHY_TIMING_8, 0x02800000 }, - { AR5K_PHY_TIMING_11, 0x00000000 }, - { AR5K_PHY_HEAVY_CLIP_ENABLE, 0x00000000 }, - { 0x99e4, 0xaaaaaaaa }, - { 0x99e8, 0x3c466478 }, - { 0x99ec, 0x000000aa }, - { AR5K_PHY_SCLOCK, 0x0000000c }, - { AR5K_PHY_SDELAY, 0x000000ff }, - { AR5K_PHY_SPENDING, 0x00000014 }, - { AR5K_PHY_DAG_CCK_CTL, 0x000009b5 }, - { 0xa23c, 0x93c889af }, - { AR5K_PHY_FAST_ADC, 0x00000001 }, - { 0xa250, 0x0000a000 }, - { AR5K_PHY_BLUETOOTH, 0x00000000 }, - { AR5K_PHY_TPC_RG1, 0x0cc75380 }, - { 0xa25c, 0x0f0f0f01 }, - { 0xa260, 0x5f690f01 }, - { 0xa264, 0x00418a11 }, - { 0xa268, 0x00000000 }, - { AR5K_PHY_TPC_RG5, 0x0c30c16a }, - { 0xa270, 0x00820820 }, - { 0xa274, 0x081b7caa }, - { 0xa278, 0x1ce739ce }, - { 0xa27c, 0x051701ce }, - { 0xa338, 0x00000000 }, - { 0xa33c, 0x00000000 }, - { 0xa340, 0x00000000 }, - { 0xa344, 0x00000000 }, - { 0xa348, 0x3fffffff }, - { 0xa34c, 0x3fffffff }, - { 0xa350, 0x3fffffff }, - { 0xa354, 0x0003ffff }, - { 0xa358, 0x79a8aa1f }, - { 0xa35c, 0x066c420f }, - { 0xa360, 0x0f282207 }, - { 0xa364, 0x17601685 }, - { 0xa368, 0x1f801104 }, - { 0xa36c, 0x37a00c03 }, - { 0xa370, 0x3fc40883 }, - { 0xa374, 0x57c00803 }, - { 0xa378, 0x5fd80682 }, - { 0xa37c, 0x7fe00482 }, - { 0xa380, 0x7f3c7bba }, - { 0xa384, 0xf3307ff0 }, -}; - -/* Initial mode-specific settings for RF2413/2414 - * (Written after ar5212_ini) */ -/* XXX: a mode ? */ -static const struct ath5k_ini_mode rf2413_ini_mode_end[] = { - { AR5K_TXCFG, - /* A/XR B G */ - { 0x00000015, 0x00000015, 0x00000015 } }, - { AR5K_USEC_5211, - { 0x128d93a7, 0x04e01395, 0x12e013ab } }, - { AR5K_PHY_RF_CTL3, - { 0x0a020001, 0x05020000, 0x0a020001 } }, - { AR5K_PHY_RF_CTL4, - { 0x00000e00, 0x00000e00, 0x00000e00 } }, - { AR5K_PHY_PA_CTL, - { 0x00000002, 0x0000000a, 0x0000000a } }, - { AR5K_PHY_GAIN, - { 0x0018da6d, 0x001a6a64, 0x001a6a64 } }, - { AR5K_PHY_DESIRED_SIZE, - { 0x0de8b4e0, 0x0de8b0da, 0x0c98b0da } }, - { AR5K_PHY_SIG, - { 0x7e800d2e, 0x7ee80d2e, 0x7ec80d2e } }, - { AR5K_PHY_AGCCOARSE, - { 0x3137665e, 0x3137665e, 0x3139605e } }, - { AR5K_PHY_WEAK_OFDM_LOW_THR, - { 0x050cb081, 0x050cb081, 0x050cb081 } }, - { AR5K_PHY_RX_DELAY, - { 0x000007d0, 0x0000044c, 0x00000898 } }, - { AR5K_PHY_FRAME_CTL_5211, - { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } }, - { AR5K_PHY_CCKTXCTL, - { 0x00000000, 0x00000000, 0x00000000 } }, - { AR5K_PHY_CCK_CROSSCORR, - { 0xd6be6788, 0xd03e6788, 0xd03e6788 } }, - { AR5K_PHY_GAIN_2GHZ, - { 0x002c0140, 0x0042c140, 0x0042c140 } }, - { AR5K_PHY_CCK_RX_CTL_4, - { 0x1883800a, 0x1863800a, 0x1883800a } }, -}; - -static const struct ath5k_ini rf2413_ini_common_end[] = { - { AR5K_DCU_FP, 0x000003e0 }, - { AR5K_SEQ_MASK, 0x0000000f }, - { AR5K_MIC_QOS_CTL, 0x00000000 }, - { AR5K_MIC_QOS_SEL, 0x00000000 }, - { AR5K_MISC_MODE, 0x00000000 }, - { AR5K_OFDM_FIL_CNT, 0x00000000 }, - { AR5K_CCK_FIL_CNT, 0x00000000 }, - { AR5K_PHYERR_CNT1, 0x00000000 }, - { AR5K_PHYERR_CNT1_MASK, 0x00000000 }, - { AR5K_PHYERR_CNT2, 0x00000000 }, - { AR5K_PHYERR_CNT2_MASK, 0x00000000 }, - { AR5K_TSF_THRES, 0x00000000 }, - { 0x8140, 0x800000a8 }, - { 0x8144, 0x00000000 }, - { AR5K_PHY_AGC, 0x00000000 }, - { AR5K_PHY_ADC_CTL, 0x0000a000 }, - { 0x983c, 0x00200400 }, - { AR5K_PHY_GAIN_OFFSET, 0x1284233c }, - { AR5K_PHY_SCR, 0x0000001f }, - { AR5K_PHY_SLMT, 0x00000080 }, - { AR5K_PHY_SCAL, 0x0000000e }, - { 0x9958, 0x000000ff }, - { AR5K_PHY_TIMING_7, 0x00000000 }, - { AR5K_PHY_TIMING_8, 0x02800000 }, - { AR5K_PHY_TIMING_11, 0x00000000 }, - { AR5K_PHY_HEAVY_CLIP_ENABLE, 0x00000000 }, - { 0x99e4, 0xaaaaaaaa }, - { 0x99e8, 0x3c466478 }, - { 0x99ec, 0x000000aa }, - { AR5K_PHY_SCLOCK, 0x0000000c }, - { AR5K_PHY_SDELAY, 0x000000ff }, - { AR5K_PHY_SPENDING, 0x00000014 }, - { AR5K_PHY_DAG_CCK_CTL, 0x000009b5 }, - { 0xa23c, 0x93c889af }, - { AR5K_PHY_FAST_ADC, 0x00000001 }, - { 0xa250, 0x0000a000 }, - { AR5K_PHY_BLUETOOTH, 0x00000000 }, - { AR5K_PHY_TPC_RG1, 0x0cc75380 }, - { 0xa25c, 0x0f0f0f01 }, - { 0xa260, 0x5f690f01 }, - { 0xa264, 0x00418a11 }, - { 0xa268, 0x00000000 }, - { AR5K_PHY_TPC_RG5, 0x0c30c16a }, - { 0xa270, 0x00820820 }, - { 0xa274, 0x001b7caa }, - { 0xa278, 0x1ce739ce }, - { 0xa27c, 0x051701ce }, - { 0xa300, 0x18010000 }, - { 0xa304, 0x30032602 }, - { 0xa308, 0x48073e06 }, - { 0xa30c, 0x560b4c0a }, - { 0xa310, 0x641a600f }, - { 0xa314, 0x784f6e1b }, - { 0xa318, 0x868f7c5a }, - { 0xa31c, 0x8ecf865b }, - { 0xa320, 0x9d4f970f }, - { 0xa324, 0xa5cfa18f }, - { 0xa328, 0xb55faf1f }, - { 0xa32c, 0xbddfb99f }, - { 0xa330, 0xcd7fc73f }, - { 0xa334, 0xd5ffd1bf }, - { 0xa338, 0x00000000 }, - { 0xa33c, 0x00000000 }, - { 0xa340, 0x00000000 }, - { 0xa344, 0x00000000 }, - { 0xa348, 0x3fffffff }, - { 0xa34c, 0x3fffffff }, - { 0xa350, 0x3fffffff }, - { 0xa354, 0x0003ffff }, - { 0xa358, 0x79a8aa1f }, - { 0xa35c, 0x066c420f }, - { 0xa360, 0x0f282207 }, - { 0xa364, 0x17601685 }, - { 0xa368, 0x1f801104 }, - { 0xa36c, 0x37a00c03 }, - { 0xa370, 0x3fc40883 }, - { 0xa374, 0x57c00803 }, - { 0xa378, 0x5fd80682 }, - { 0xa37c, 0x7fe00482 }, - { 0xa380, 0x7f3c7bba }, - { 0xa384, 0xf3307ff0 }, -}; - -/* Initial mode-specific settings for RF2425 - * (Written after ar5212_ini) */ -/* XXX: a mode ? */ -static const struct ath5k_ini_mode rf2425_ini_mode_end[] = { - { AR5K_TXCFG, - /* A/XR B G */ - { 0x00000015, 0x00000015, 0x00000015 } }, - { AR5K_USEC_5211, - { 0x128d93a7, 0x04e01395, 0x12e013ab } }, - { AR5K_PHY_RF_CTL3, - { 0x0a020001, 0x05020100, 0x0a020001 } }, - { AR5K_PHY_RF_CTL4, - { 0x00000e0e, 0x00000e0e, 0x00000e0e } }, - { AR5K_PHY_PA_CTL, - { 0x00000003, 0x0000000b, 0x0000000b } }, - { AR5K_PHY_SETTLING, - { 0x1372161c, 0x13721722, 0x13721422 } }, - { AR5K_PHY_GAIN, - { 0x0018fa61, 0x00199a65, 0x00199a65 } }, - { AR5K_PHY_DESIRED_SIZE, - { 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da } }, - { AR5K_PHY_SIG, - { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } }, - { AR5K_PHY_AGCCOARSE, - { 0x3139605e, 0x3139605e, 0x3139605e } }, - { AR5K_PHY_WEAK_OFDM_LOW_THR, - { 0x050cb081, 0x050cb081, 0x050cb081 } }, - { AR5K_PHY_RX_DELAY, - { 0x000007d0, 0x0000044c, 0x00000898 } }, - { AR5K_PHY_FRAME_CTL_5211, - { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } }, - { AR5K_PHY_CCKTXCTL, - { 0x00000000, 0x00000000, 0x00000000 } }, - { AR5K_PHY_CCK_CROSSCORR, - { 0xd6be6788, 0xd03e6788, 0xd03e6788 } }, - { AR5K_PHY_GAIN_2GHZ, - { 0x00000140, 0x0052c140, 0x0052c140 } }, - { AR5K_PHY_CCK_RX_CTL_4, - { 0x1883800a, 0x1863800a, 0x1883800a } }, - { 0xa324, - { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, - { 0xa328, - { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, - { 0xa32c, - { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, - { 0xa330, - { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, - { 0xa334, - { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, -}; - -static const struct ath5k_ini rf2425_ini_common_end[] = { - { AR5K_DCU_FP, 0x000003e0 }, - { AR5K_SEQ_MASK, 0x0000000f }, - { 0x809c, 0x00000000 }, - { 0x80a0, 0x00000000 }, - { AR5K_MIC_QOS_CTL, 0x00000000 }, - { AR5K_MIC_QOS_SEL, 0x00000000 }, - { AR5K_MISC_MODE, 0x00000000 }, - { AR5K_OFDM_FIL_CNT, 0x00000000 }, - { AR5K_CCK_FIL_CNT, 0x00000000 }, - { AR5K_PHYERR_CNT1, 0x00000000 }, - { AR5K_PHYERR_CNT1_MASK, 0x00000000 }, - { AR5K_PHYERR_CNT2, 0x00000000 }, - { AR5K_PHYERR_CNT2_MASK, 0x00000000 }, - { AR5K_TSF_THRES, 0x00000000 }, - { 0x8140, 0x800003f9 }, - { 0x8144, 0x00000000 }, - { AR5K_PHY_AGC, 0x00000000 }, - { AR5K_PHY_ADC_CTL, 0x0000a000 }, - { 0x983c, 0x00200400 }, - { AR5K_PHY_GAIN_OFFSET, 0x1284233c }, - { AR5K_PHY_SCR, 0x0000001f }, - { AR5K_PHY_SLMT, 0x00000080 }, - { AR5K_PHY_SCAL, 0x0000000e }, - { 0x9958, 0x00081fff }, - { AR5K_PHY_TIMING_7, 0x00000000 }, - { AR5K_PHY_TIMING_8, 0x02800000 }, - { AR5K_PHY_TIMING_11, 0x00000000 }, - { 0x99dc, 0xfebadbe8 }, - { AR5K_PHY_HEAVY_CLIP_ENABLE, 0x00000000 }, - { 0x99e4, 0xaaaaaaaa }, - { 0x99e8, 0x3c466478 }, - { 0x99ec, 0x000000aa }, - { AR5K_PHY_SCLOCK, 0x0000000c }, - { AR5K_PHY_SDELAY, 0x000000ff }, - { AR5K_PHY_SPENDING, 0x00000014 }, - { AR5K_PHY_DAG_CCK_CTL, 0x000009b5 }, - { AR5K_PHY_TXPOWER_RATE3, 0x20202020 }, - { AR5K_PHY_TXPOWER_RATE4, 0x20202020 }, - { 0xa23c, 0x93c889af }, - { AR5K_PHY_FAST_ADC, 0x00000001 }, - { 0xa250, 0x0000a000 }, - { AR5K_PHY_BLUETOOTH, 0x00000000 }, - { AR5K_PHY_TPC_RG1, 0x0cc75380 }, - { 0xa25c, 0x0f0f0f01 }, - { 0xa260, 0x5f690f01 }, - { 0xa264, 0x00418a11 }, - { 0xa268, 0x00000000 }, - { AR5K_PHY_TPC_RG5, 0x0c30c166 }, - { 0xa270, 0x00820820 }, - { 0xa274, 0x081a3caa }, - { 0xa278, 0x1ce739ce }, - { 0xa27c, 0x051701ce }, - { 0xa300, 0x16010000 }, - { 0xa304, 0x2c032402 }, - { 0xa308, 0x48433e42 }, - { 0xa30c, 0x5a0f500b }, - { 0xa310, 0x6c4b624a }, - { 0xa314, 0x7e8b748a }, - { 0xa318, 0x96cf8ccb }, - { 0xa31c, 0xa34f9d0f }, - { 0xa320, 0xa7cfa58f }, - { 0xa348, 0x3fffffff }, - { 0xa34c, 0x3fffffff }, - { 0xa350, 0x3fffffff }, - { 0xa354, 0x0003ffff }, - { 0xa358, 0x79a8aa1f }, - { 0xa35c, 0x066c420f }, - { 0xa360, 0x0f282207 }, - { 0xa364, 0x17601685 }, - { 0xa368, 0x1f801104 }, - { 0xa36c, 0x37a00c03 }, - { 0xa370, 0x3fc40883 }, - { 0xa374, 0x57c00803 }, - { 0xa378, 0x5fd80682 }, - { 0xa37c, 0x7fe00482 }, - { 0xa380, 0x7f3c7bba }, - { 0xa384, 0xf3307ff0 }, -}; - -/* - * Initial BaseBand Gain settings for RF5111/5112 (AR5210 comes with - * RF5110 only so initial BB Gain settings are included in AR5K_AR5210_INI) - */ - -/* RF5111 Initial BaseBand Gain settings */ -static const struct ath5k_ini rf5111_ini_bbgain[] = { - { AR5K_BB_GAIN(0), 0x00000000 }, - { AR5K_BB_GAIN(1), 0x00000020 }, - { AR5K_BB_GAIN(2), 0x00000010 }, - { AR5K_BB_GAIN(3), 0x00000030 }, - { AR5K_BB_GAIN(4), 0x00000008 }, - { AR5K_BB_GAIN(5), 0x00000028 }, - { AR5K_BB_GAIN(6), 0x00000004 }, - { AR5K_BB_GAIN(7), 0x00000024 }, - { AR5K_BB_GAIN(8), 0x00000014 }, - { AR5K_BB_GAIN(9), 0x00000034 }, - { AR5K_BB_GAIN(10), 0x0000000c }, - { AR5K_BB_GAIN(11), 0x0000002c }, - { AR5K_BB_GAIN(12), 0x00000002 }, - { AR5K_BB_GAIN(13), 0x00000022 }, - { AR5K_BB_GAIN(14), 0x00000012 }, - { AR5K_BB_GAIN(15), 0x00000032 }, - { AR5K_BB_GAIN(16), 0x0000000a }, - { AR5K_BB_GAIN(17), 0x0000002a }, - { AR5K_BB_GAIN(18), 0x00000006 }, - { AR5K_BB_GAIN(19), 0x00000026 }, - { AR5K_BB_GAIN(20), 0x00000016 }, - { AR5K_BB_GAIN(21), 0x00000036 }, - { AR5K_BB_GAIN(22), 0x0000000e }, - { AR5K_BB_GAIN(23), 0x0000002e }, - { AR5K_BB_GAIN(24), 0x00000001 }, - { AR5K_BB_GAIN(25), 0x00000021 }, - { AR5K_BB_GAIN(26), 0x00000011 }, - { AR5K_BB_GAIN(27), 0x00000031 }, - { AR5K_BB_GAIN(28), 0x00000009 }, - { AR5K_BB_GAIN(29), 0x00000029 }, - { AR5K_BB_GAIN(30), 0x00000005 }, - { AR5K_BB_GAIN(31), 0x00000025 }, - { AR5K_BB_GAIN(32), 0x00000015 }, - { AR5K_BB_GAIN(33), 0x00000035 }, - { AR5K_BB_GAIN(34), 0x0000000d }, - { AR5K_BB_GAIN(35), 0x0000002d }, - { AR5K_BB_GAIN(36), 0x00000003 }, - { AR5K_BB_GAIN(37), 0x00000023 }, - { AR5K_BB_GAIN(38), 0x00000013 }, - { AR5K_BB_GAIN(39), 0x00000033 }, - { AR5K_BB_GAIN(40), 0x0000000b }, - { AR5K_BB_GAIN(41), 0x0000002b }, - { AR5K_BB_GAIN(42), 0x0000002b }, - { AR5K_BB_GAIN(43), 0x0000002b }, - { AR5K_BB_GAIN(44), 0x0000002b }, - { AR5K_BB_GAIN(45), 0x0000002b }, - { AR5K_BB_GAIN(46), 0x0000002b }, - { AR5K_BB_GAIN(47), 0x0000002b }, - { AR5K_BB_GAIN(48), 0x0000002b }, - { AR5K_BB_GAIN(49), 0x0000002b }, - { AR5K_BB_GAIN(50), 0x0000002b }, - { AR5K_BB_GAIN(51), 0x0000002b }, - { AR5K_BB_GAIN(52), 0x0000002b }, - { AR5K_BB_GAIN(53), 0x0000002b }, - { AR5K_BB_GAIN(54), 0x0000002b }, - { AR5K_BB_GAIN(55), 0x0000002b }, - { AR5K_BB_GAIN(56), 0x0000002b }, - { AR5K_BB_GAIN(57), 0x0000002b }, - { AR5K_BB_GAIN(58), 0x0000002b }, - { AR5K_BB_GAIN(59), 0x0000002b }, - { AR5K_BB_GAIN(60), 0x0000002b }, - { AR5K_BB_GAIN(61), 0x0000002b }, - { AR5K_BB_GAIN(62), 0x00000002 }, - { AR5K_BB_GAIN(63), 0x00000016 }, -}; - -/* RF5112 Initial BaseBand Gain settings (Same for RF5413/5414+) */ -static const struct ath5k_ini rf5112_ini_bbgain[] = { - { AR5K_BB_GAIN(0), 0x00000000 }, - { AR5K_BB_GAIN(1), 0x00000001 }, - { AR5K_BB_GAIN(2), 0x00000002 }, - { AR5K_BB_GAIN(3), 0x00000003 }, - { AR5K_BB_GAIN(4), 0x00000004 }, - { AR5K_BB_GAIN(5), 0x00000005 }, - { AR5K_BB_GAIN(6), 0x00000008 }, - { AR5K_BB_GAIN(7), 0x00000009 }, - { AR5K_BB_GAIN(8), 0x0000000a }, - { AR5K_BB_GAIN(9), 0x0000000b }, - { AR5K_BB_GAIN(10), 0x0000000c }, - { AR5K_BB_GAIN(11), 0x0000000d }, - { AR5K_BB_GAIN(12), 0x00000010 }, - { AR5K_BB_GAIN(13), 0x00000011 }, - { AR5K_BB_GAIN(14), 0x00000012 }, - { AR5K_BB_GAIN(15), 0x00000013 }, - { AR5K_BB_GAIN(16), 0x00000014 }, - { AR5K_BB_GAIN(17), 0x00000015 }, - { AR5K_BB_GAIN(18), 0x00000018 }, - { AR5K_BB_GAIN(19), 0x00000019 }, - { AR5K_BB_GAIN(20), 0x0000001a }, - { AR5K_BB_GAIN(21), 0x0000001b }, - { AR5K_BB_GAIN(22), 0x0000001c }, - { AR5K_BB_GAIN(23), 0x0000001d }, - { AR5K_BB_GAIN(24), 0x00000020 }, - { AR5K_BB_GAIN(25), 0x00000021 }, - { AR5K_BB_GAIN(26), 0x00000022 }, - { AR5K_BB_GAIN(27), 0x00000023 }, - { AR5K_BB_GAIN(28), 0x00000024 }, - { AR5K_BB_GAIN(29), 0x00000025 }, - { AR5K_BB_GAIN(30), 0x00000028 }, - { AR5K_BB_GAIN(31), 0x00000029 }, - { AR5K_BB_GAIN(32), 0x0000002a }, - { AR5K_BB_GAIN(33), 0x0000002b }, - { AR5K_BB_GAIN(34), 0x0000002c }, - { AR5K_BB_GAIN(35), 0x0000002d }, - { AR5K_BB_GAIN(36), 0x00000030 }, - { AR5K_BB_GAIN(37), 0x00000031 }, - { AR5K_BB_GAIN(38), 0x00000032 }, - { AR5K_BB_GAIN(39), 0x00000033 }, - { AR5K_BB_GAIN(40), 0x00000034 }, - { AR5K_BB_GAIN(41), 0x00000035 }, - { AR5K_BB_GAIN(42), 0x00000035 }, - { AR5K_BB_GAIN(43), 0x00000035 }, - { AR5K_BB_GAIN(44), 0x00000035 }, - { AR5K_BB_GAIN(45), 0x00000035 }, - { AR5K_BB_GAIN(46), 0x00000035 }, - { AR5K_BB_GAIN(47), 0x00000035 }, - { AR5K_BB_GAIN(48), 0x00000035 }, - { AR5K_BB_GAIN(49), 0x00000035 }, - { AR5K_BB_GAIN(50), 0x00000035 }, - { AR5K_BB_GAIN(51), 0x00000035 }, - { AR5K_BB_GAIN(52), 0x00000035 }, - { AR5K_BB_GAIN(53), 0x00000035 }, - { AR5K_BB_GAIN(54), 0x00000035 }, - { AR5K_BB_GAIN(55), 0x00000035 }, - { AR5K_BB_GAIN(56), 0x00000035 }, - { AR5K_BB_GAIN(57), 0x00000035 }, - { AR5K_BB_GAIN(58), 0x00000035 }, - { AR5K_BB_GAIN(59), 0x00000035 }, - { AR5K_BB_GAIN(60), 0x00000035 }, - { AR5K_BB_GAIN(61), 0x00000035 }, - { AR5K_BB_GAIN(62), 0x00000010 }, - { AR5K_BB_GAIN(63), 0x0000001a }, -}; - - -/** - * ath5k_hw_ini_registers() - Write initial register dump common for all modes - * @ah: The &struct ath5k_hw - * @size: Dump size - * @ini_regs: The array of &struct ath5k_ini - * @skip_pcu: Skip PCU registers - */ -static void -ath5k_hw_ini_registers(struct ath5k_hw *ah, unsigned int size, - const struct ath5k_ini *ini_regs, bool skip_pcu) -{ - unsigned int i; - - /* Write initial registers */ - for (i = 0; i < size; i++) { - /* Skip PCU registers if - * requested */ - if (skip_pcu && - ini_regs[i].ini_register >= AR5K_PCU_MIN && - ini_regs[i].ini_register <= AR5K_PCU_MAX) - continue; - - switch (ini_regs[i].ini_mode) { - case AR5K_INI_READ: - /* Cleared on read */ - ath5k_hw_reg_read(ah, ini_regs[i].ini_register); - break; - case AR5K_INI_WRITE: - default: - AR5K_REG_WAIT(i); - ath5k_hw_reg_write(ah, ini_regs[i].ini_value, - ini_regs[i].ini_register); - } - } -} - -/** - * ath5k_hw_ini_mode_registers() - Write initial mode-specific register dump - * @ah: The &struct ath5k_hw - * @size: Dump size - * @ini_mode: The array of &struct ath5k_ini_mode - * @mode: One of enum ath5k_driver_mode - */ -static void -ath5k_hw_ini_mode_registers(struct ath5k_hw *ah, - unsigned int size, const struct ath5k_ini_mode *ini_mode, - u8 mode) -{ - unsigned int i; - - for (i = 0; i < size; i++) { - AR5K_REG_WAIT(i); - ath5k_hw_reg_write(ah, ini_mode[i].mode_value[mode], - (u32)ini_mode[i].mode_register); - } - -} - -/** - * ath5k_hw_write_initvals() - Write initial chip-specific register dump - * @ah: The &struct ath5k_hw - * @mode: One of enum ath5k_driver_mode - * @skip_pcu: Skip PCU registers - * - * Write initial chip-specific register dump, to get the chipset on a - * clean and ready-to-work state after warm reset. - */ -int -ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool skip_pcu) -{ - /* - * Write initial register settings - */ - - /* For AR5212 and compatible */ - if (ah->ah_version == AR5K_AR5212) { - - /* First set of mode-specific settings */ - ath5k_hw_ini_mode_registers(ah, - ARRAY_SIZE(ar5212_ini_mode_start), - ar5212_ini_mode_start, mode); - - /* - * Write initial settings common for all modes - */ - ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5212_ini_common_start), - ar5212_ini_common_start, skip_pcu); - - /* Second set of mode-specific settings */ - switch (ah->ah_radio) { - case AR5K_RF5111: - - ath5k_hw_ini_mode_registers(ah, - ARRAY_SIZE(rf5111_ini_mode_end), - rf5111_ini_mode_end, mode); - - ath5k_hw_ini_registers(ah, - ARRAY_SIZE(rf5111_ini_common_end), - rf5111_ini_common_end, skip_pcu); - - /* Baseband gain table */ - ath5k_hw_ini_registers(ah, - ARRAY_SIZE(rf5111_ini_bbgain), - rf5111_ini_bbgain, skip_pcu); - - break; - case AR5K_RF5112: - - ath5k_hw_ini_mode_registers(ah, - ARRAY_SIZE(rf5112_ini_mode_end), - rf5112_ini_mode_end, mode); - - ath5k_hw_ini_registers(ah, - ARRAY_SIZE(rf5112_ini_common_end), - rf5112_ini_common_end, skip_pcu); - - ath5k_hw_ini_registers(ah, - ARRAY_SIZE(rf5112_ini_bbgain), - rf5112_ini_bbgain, skip_pcu); - - break; - case AR5K_RF5413: - - ath5k_hw_ini_mode_registers(ah, - ARRAY_SIZE(rf5413_ini_mode_end), - rf5413_ini_mode_end, mode); - - ath5k_hw_ini_registers(ah, - ARRAY_SIZE(rf5413_ini_common_end), - rf5413_ini_common_end, skip_pcu); - - ath5k_hw_ini_registers(ah, - ARRAY_SIZE(rf5112_ini_bbgain), - rf5112_ini_bbgain, skip_pcu); - - break; - case AR5K_RF2316: - case AR5K_RF2413: - - ath5k_hw_ini_mode_registers(ah, - ARRAY_SIZE(rf2413_ini_mode_end), - rf2413_ini_mode_end, mode); - - ath5k_hw_ini_registers(ah, - ARRAY_SIZE(rf2413_ini_common_end), - rf2413_ini_common_end, skip_pcu); - - /* Override settings from rf2413_ini_common_end */ - if (ah->ah_radio == AR5K_RF2316) { - ath5k_hw_reg_write(ah, 0x00004000, - AR5K_PHY_AGC); - ath5k_hw_reg_write(ah, 0x081b7caa, - 0xa274); - } - - ath5k_hw_ini_registers(ah, - ARRAY_SIZE(rf5112_ini_bbgain), - rf5112_ini_bbgain, skip_pcu); - break; - case AR5K_RF2317: - - ath5k_hw_ini_mode_registers(ah, - ARRAY_SIZE(rf2413_ini_mode_end), - rf2413_ini_mode_end, mode); - - ath5k_hw_ini_registers(ah, - ARRAY_SIZE(rf2425_ini_common_end), - rf2425_ini_common_end, skip_pcu); - - /* Override settings from rf2413_ini_mode_end */ - ath5k_hw_reg_write(ah, 0x00180a65, AR5K_PHY_GAIN); - - /* Override settings from rf2413_ini_common_end */ - ath5k_hw_reg_write(ah, 0x00004000, AR5K_PHY_AGC); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TPC_RG5, - AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP, 0xa); - ath5k_hw_reg_write(ah, 0x800000a8, 0x8140); - ath5k_hw_reg_write(ah, 0x000000ff, 0x9958); - - ath5k_hw_ini_registers(ah, - ARRAY_SIZE(rf5112_ini_bbgain), - rf5112_ini_bbgain, skip_pcu); - break; - case AR5K_RF2425: - - ath5k_hw_ini_mode_registers(ah, - ARRAY_SIZE(rf2425_ini_mode_end), - rf2425_ini_mode_end, mode); - - ath5k_hw_ini_registers(ah, - ARRAY_SIZE(rf2425_ini_common_end), - rf2425_ini_common_end, skip_pcu); - - ath5k_hw_ini_registers(ah, - ARRAY_SIZE(rf5112_ini_bbgain), - rf5112_ini_bbgain, skip_pcu); - break; - default: - return -EINVAL; - - } - - /* For AR5211 */ - } else if (ah->ah_version == AR5K_AR5211) { - - /* AR5K_MODE_11B */ - if (mode > 2) { - ATH5K_ERR(ah, "unsupported channel mode: %d\n", mode); - return -EINVAL; - } - - /* Mode-specific settings */ - ath5k_hw_ini_mode_registers(ah, ARRAY_SIZE(ar5211_ini_mode), - ar5211_ini_mode, mode); - - /* - * Write initial settings common for all modes - */ - ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5211_ini), - ar5211_ini, skip_pcu); - - /* AR5211 only comes with 5111 */ - - /* Baseband gain table */ - ath5k_hw_ini_registers(ah, ARRAY_SIZE(rf5111_ini_bbgain), - rf5111_ini_bbgain, skip_pcu); - /* For AR5210 (for mode settings check out ath5k_hw_reset_tx_queue) */ - } else if (ah->ah_version == AR5K_AR5210) { - ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5210_ini), - ar5210_ini, skip_pcu); - } - - return 0; -} diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c deleted file mode 100644 index f77ef36acf87..000000000000 --- a/drivers/net/wireless/ath/ath5k/led.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting - * Copyright (c) 2004-2005 Atheros Communications, Inc. - * Copyright (c) 2007 Jiri Slaby - * Copyright (c) 2009 Bob Copeland - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any - * redistribution must be conditioned upon including a substantially - * similar Disclaimer requirement for further binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGES. - * - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include "ath5k.h" - -#define ATH_SDEVICE(subv, subd) \ - .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \ - .subvendor = (subv), .subdevice = (subd) - -#define ATH_LED(pin, polarity) .driver_data = (((pin) << 8) | (polarity)) -#define ATH_PIN(data) ((data) >> 8) -#define ATH_POLARITY(data) ((data) & 0xff) - -/* Devices we match on for LED config info (typically laptops) */ -static DEFINE_PCI_DEVICE_TABLE(ath5k_led_devices) = { - /* AR5211 */ - { PCI_VDEVICE(ATHEROS, PCI_DEVICE_ID_ATHEROS_AR5211), ATH_LED(0, 0) }, - /* HP Compaq nc6xx, nc4000, nx6000 */ - { ATH_SDEVICE(PCI_VENDOR_ID_COMPAQ, PCI_ANY_ID), ATH_LED(1, 1) }, - /* Acer Aspire One A150 (maximlevitsky@gmail.com) */ - { ATH_SDEVICE(PCI_VENDOR_ID_FOXCONN, 0xe008), ATH_LED(3, 0) }, - /* Acer Aspire One AO531h AO751h (keng-yu.lin@canonical.com) */ - { ATH_SDEVICE(PCI_VENDOR_ID_FOXCONN, 0xe00d), ATH_LED(3, 0) }, - /* Acer Ferrari 5000 (russ.dill@gmail.com) */ - { ATH_SDEVICE(PCI_VENDOR_ID_AMBIT, 0x0422), ATH_LED(1, 1) }, - /* E-machines E510 (tuliom@gmail.com) */ - { ATH_SDEVICE(PCI_VENDOR_ID_AMBIT, 0x0428), ATH_LED(3, 0) }, - /* BenQ Joybook R55v (nowymarluk@wp.pl) */ - { ATH_SDEVICE(PCI_VENDOR_ID_QMI, 0x0100), ATH_LED(1, 0) }, - /* Acer Extensa 5620z (nekoreeve@gmail.com) */ - { ATH_SDEVICE(PCI_VENDOR_ID_QMI, 0x0105), ATH_LED(3, 0) }, - /* Fukato Datacask Jupiter 1014a (mrb74@gmx.at) */ - { ATH_SDEVICE(PCI_VENDOR_ID_AZWAVE, 0x1026), ATH_LED(3, 0) }, - /* IBM ThinkPad AR5BXB6 (legovini@spiro.fisica.unipd.it) */ - { ATH_SDEVICE(PCI_VENDOR_ID_IBM, 0x058a), ATH_LED(1, 0) }, - /* HP Compaq CQ60-206US (ddreggors@jumptv.com) */ - { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137a), ATH_LED(3, 1) }, - /* HP Compaq C700 (nitrousnrg@gmail.com) */ - { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137b), ATH_LED(3, 1) }, - /* LiteOn AR5BXB63 (magooz@salug.it) */ - { ATH_SDEVICE(PCI_VENDOR_ID_ATHEROS, 0x3067), ATH_LED(3, 0) }, - /* IBM-specific AR5212 (all others) */ - { PCI_VDEVICE(ATHEROS, PCI_DEVICE_ID_ATHEROS_AR5212_IBM), ATH_LED(0, 0) }, - /* Dell Vostro A860 (shahar@shahar-or.co.il) */ - { ATH_SDEVICE(PCI_VENDOR_ID_QMI, 0x0112), ATH_LED(3, 0) }, - { } -}; - -void ath5k_led_enable(struct ath5k_hw *ah) -{ - if (test_bit(ATH_STAT_LEDSOFT, ah->status)) { - ath5k_hw_set_gpio_output(ah, ah->led_pin); - ath5k_led_off(ah); - } -} - -static void ath5k_led_on(struct ath5k_hw *ah) -{ - if (!test_bit(ATH_STAT_LEDSOFT, ah->status)) - return; - ath5k_hw_set_gpio(ah, ah->led_pin, ah->led_on); -} - -void ath5k_led_off(struct ath5k_hw *ah) -{ - if (!test_bit(ATH_STAT_LEDSOFT, ah->status)) - return; - ath5k_hw_set_gpio(ah, ah->led_pin, !ah->led_on); -} - -static void -ath5k_led_brightness_set(struct led_classdev *led_dev, - enum led_brightness brightness) -{ - struct ath5k_led *led = container_of(led_dev, struct ath5k_led, - led_dev); - - if (brightness == LED_OFF) - ath5k_led_off(led->ah); - else - ath5k_led_on(led->ah); -} - -static int -ath5k_register_led(struct ath5k_hw *ah, struct ath5k_led *led, - const char *name, char *trigger) -{ - int err; - - led->ah = ah; - strncpy(led->name, name, sizeof(led->name)); - led->led_dev.name = led->name; - led->led_dev.default_trigger = trigger; - led->led_dev.brightness_set = ath5k_led_brightness_set; - - err = led_classdev_register(ah->dev, &led->led_dev); - if (err) { - ATH5K_WARN(ah, "could not register LED %s\n", name); - led->ah = NULL; - } - return err; -} - -static void -ath5k_unregister_led(struct ath5k_led *led) -{ - if (!led->ah) - return; - led_classdev_unregister(&led->led_dev); - ath5k_led_off(led->ah); - led->ah = NULL; -} - -void ath5k_unregister_leds(struct ath5k_hw *ah) -{ - ath5k_unregister_led(&ah->rx_led); - ath5k_unregister_led(&ah->tx_led); -} - -int ath5k_init_leds(struct ath5k_hw *ah) -{ - int ret = 0; - struct ieee80211_hw *hw = ah->hw; -#ifndef CONFIG_ATHEROS_AR231X - struct pci_dev *pdev = ah->pdev; -#endif - char name[ATH5K_LED_MAX_NAME_LEN + 1]; - const struct pci_device_id *match; - - if (!ah->pdev) - return 0; - -#ifdef CONFIG_ATHEROS_AR231X - match = NULL; -#else - match = pci_match_id(&ath5k_led_devices[0], pdev); -#endif - if (match) { - __set_bit(ATH_STAT_LEDSOFT, ah->status); - ah->led_pin = ATH_PIN(match->driver_data); - ah->led_on = ATH_POLARITY(match->driver_data); - } - - if (!test_bit(ATH_STAT_LEDSOFT, ah->status)) - goto out; - - ath5k_led_enable(ah); - - snprintf(name, sizeof(name), "ath5k-%s::rx", wiphy_name(hw->wiphy)); - ret = ath5k_register_led(ah, &ah->rx_led, name, - ieee80211_get_rx_led_name(hw)); - if (ret) - goto out; - - snprintf(name, sizeof(name), "ath5k-%s::tx", wiphy_name(hw->wiphy)); - ret = ath5k_register_led(ah, &ah->tx_led, name, - ieee80211_get_tx_led_name(hw)); -out: - return ret; -} - diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c deleted file mode 100644 index 06f86f435711..000000000000 --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c +++ /dev/null @@ -1,829 +0,0 @@ -/*- - * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting - * Copyright (c) 2004-2005 Atheros Communications, Inc. - * Copyright (c) 2006 Devicescape Software, Inc. - * Copyright (c) 2007 Jiri Slaby - * Copyright (c) 2007 Luis R. Rodriguez - * Copyright (c) 2010 Bruno Randolf - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any - * redistribution must be conditioned upon including a substantially - * similar Disclaimer requirement for further binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGES. - * - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include - -#include "ath5k.h" -#include "base.h" -#include "reg.h" - -/********************\ -* Mac80211 functions * -\********************/ - -static void -ath5k_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct ath5k_hw *ah = hw->priv; - u16 qnum = skb_get_queue_mapping(skb); - - if (WARN_ON(qnum >= ah->ah_capabilities.cap_queues.q_tx_num)) { - ieee80211_free_txskb(hw, skb); - return; - } - - ath5k_tx_queue(hw, skb, &ah->txqs[qnum]); -} - - -static int -ath5k_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct ath5k_hw *ah = hw->priv; - int ret; - struct ath5k_vif *avf = (void *)vif->drv_priv; - - mutex_lock(&ah->lock); - - if ((vif->type == NL80211_IFTYPE_AP || - vif->type == NL80211_IFTYPE_ADHOC) - && (ah->num_ap_vifs + ah->num_adhoc_vifs) >= ATH_BCBUF) { - ret = -ELNRNG; - goto end; - } - - /* Don't allow other interfaces if one ad-hoc is configured. - * TODO: Fix the problems with ad-hoc and multiple other interfaces. - * We would need to operate the HW in ad-hoc mode to allow TSF updates - * for the IBSS, but this breaks with additional AP or STA interfaces - * at the moment. */ - if (ah->num_adhoc_vifs || - (ah->nvifs && vif->type == NL80211_IFTYPE_ADHOC)) { - ATH5K_ERR(ah, "Only one single ad-hoc interface is allowed.\n"); - ret = -ELNRNG; - goto end; - } - - switch (vif->type) { - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_MESH_POINT: - avf->opmode = vif->type; - break; - default: - ret = -EOPNOTSUPP; - goto end; - } - - ah->nvifs++; - ATH5K_DBG(ah, ATH5K_DEBUG_MODE, "add interface mode %d\n", avf->opmode); - - /* Assign the vap/adhoc to a beacon xmit slot. */ - if ((avf->opmode == NL80211_IFTYPE_AP) || - (avf->opmode == NL80211_IFTYPE_ADHOC) || - (avf->opmode == NL80211_IFTYPE_MESH_POINT)) { - int slot; - - WARN_ON(list_empty(&ah->bcbuf)); - avf->bbuf = list_first_entry(&ah->bcbuf, struct ath5k_buf, - list); - list_del(&avf->bbuf->list); - - avf->bslot = 0; - for (slot = 0; slot < ATH_BCBUF; slot++) { - if (!ah->bslot[slot]) { - avf->bslot = slot; - break; - } - } - BUG_ON(ah->bslot[avf->bslot] != NULL); - ah->bslot[avf->bslot] = vif; - if (avf->opmode == NL80211_IFTYPE_AP) - ah->num_ap_vifs++; - else if (avf->opmode == NL80211_IFTYPE_ADHOC) - ah->num_adhoc_vifs++; - else if (avf->opmode == NL80211_IFTYPE_MESH_POINT) - ah->num_mesh_vifs++; - } - - /* Any MAC address is fine, all others are included through the - * filter. - */ - ath5k_hw_set_lladdr(ah, vif->addr); - - ath5k_update_bssid_mask_and_opmode(ah, vif); - ret = 0; -end: - mutex_unlock(&ah->lock); - return ret; -} - - -static void -ath5k_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ath5k_hw *ah = hw->priv; - struct ath5k_vif *avf = (void *)vif->drv_priv; - unsigned int i; - - mutex_lock(&ah->lock); - ah->nvifs--; - - if (avf->bbuf) { - ath5k_txbuf_free_skb(ah, avf->bbuf); - list_add_tail(&avf->bbuf->list, &ah->bcbuf); - for (i = 0; i < ATH_BCBUF; i++) { - if (ah->bslot[i] == vif) { - ah->bslot[i] = NULL; - break; - } - } - avf->bbuf = NULL; - } - if (avf->opmode == NL80211_IFTYPE_AP) - ah->num_ap_vifs--; - else if (avf->opmode == NL80211_IFTYPE_ADHOC) - ah->num_adhoc_vifs--; - else if (avf->opmode == NL80211_IFTYPE_MESH_POINT) - ah->num_mesh_vifs--; - - ath5k_update_bssid_mask_and_opmode(ah, NULL); - mutex_unlock(&ah->lock); -} - - -/* - * TODO: Phy disable/diversity etc - */ -static int -ath5k_config(struct ieee80211_hw *hw, u32 changed) -{ - struct ath5k_hw *ah = hw->priv; - struct ieee80211_conf *conf = &hw->conf; - int ret = 0; - int i; - - mutex_lock(&ah->lock); - - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { - ret = ath5k_chan_set(ah, conf->chandef.chan); - if (ret < 0) - goto unlock; - } - - if ((changed & IEEE80211_CONF_CHANGE_POWER) && - (ah->ah_txpower.txp_requested != conf->power_level)) { - ah->ah_txpower.txp_requested = conf->power_level; - - /* Half dB steps */ - ath5k_hw_set_txpower_limit(ah, (conf->power_level * 2)); - } - - if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) { - ah->ah_retry_long = conf->long_frame_max_tx_count; - ah->ah_retry_short = conf->short_frame_max_tx_count; - - for (i = 0; i < ah->ah_capabilities.cap_queues.q_tx_num; i++) - ath5k_hw_set_tx_retry_limits(ah, i); - } - - /* TODO: - * 1) Move this on config_interface and handle each case - * separately eg. when we have only one STA vif, use - * AR5K_ANTMODE_SINGLE_AP - * - * 2) Allow the user to change antenna mode eg. when only - * one antenna is present - * - * 3) Allow the user to set default/tx antenna when possible - * - * 4) Default mode should handle 90% of the cases, together - * with fixed a/b and single AP modes we should be able to - * handle 99%. Sectored modes are extreme cases and i still - * haven't found a usage for them. If we decide to support them, - * then we must allow the user to set how many tx antennas we - * have available - */ - ath5k_hw_set_antenna_mode(ah, ah->ah_ant_mode); - -unlock: - mutex_unlock(&ah->lock); - return ret; -} - - -static void -ath5k_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, u32 changes) -{ - struct ath5k_vif *avf = (void *)vif->drv_priv; - struct ath5k_hw *ah = hw->priv; - struct ath_common *common = ath5k_hw_common(ah); - - mutex_lock(&ah->lock); - - if (changes & BSS_CHANGED_BSSID) { - /* Cache for later use during resets */ - memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); - common->curaid = 0; - ath5k_hw_set_bssid(ah); - mmiowb(); - } - - if (changes & BSS_CHANGED_BEACON_INT) - ah->bintval = bss_conf->beacon_int; - - if (changes & BSS_CHANGED_ERP_SLOT) { - int slot_time; - - ah->ah_short_slot = bss_conf->use_short_slot; - slot_time = ath5k_hw_get_default_slottime(ah) + - 3 * ah->ah_coverage_class; - ath5k_hw_set_ifs_intervals(ah, slot_time); - } - - if (changes & BSS_CHANGED_ASSOC) { - avf->assoc = bss_conf->assoc; - if (bss_conf->assoc) - ah->assoc = bss_conf->assoc; - else - ah->assoc = ath5k_any_vif_assoc(ah); - - if (ah->opmode == NL80211_IFTYPE_STATION) - ath5k_set_beacon_filter(hw, ah->assoc); - ath5k_hw_set_ledstate(ah, ah->assoc ? - AR5K_LED_ASSOC : AR5K_LED_INIT); - if (bss_conf->assoc) { - ATH5K_DBG(ah, ATH5K_DEBUG_ANY, - "Bss Info ASSOC %d, bssid: %pM\n", - bss_conf->aid, common->curbssid); - common->curaid = bss_conf->aid; - ath5k_hw_set_bssid(ah); - /* Once ANI is available you would start it here */ - } - } - - if (changes & BSS_CHANGED_BEACON) { - spin_lock_bh(&ah->block); - ath5k_beacon_update(hw, vif); - spin_unlock_bh(&ah->block); - } - - if (changes & BSS_CHANGED_BEACON_ENABLED) - ah->enable_beacon = bss_conf->enable_beacon; - - if (changes & (BSS_CHANGED_BEACON | BSS_CHANGED_BEACON_ENABLED | - BSS_CHANGED_BEACON_INT)) - ath5k_beacon_config(ah); - - mutex_unlock(&ah->lock); -} - - -static u64 -ath5k_prepare_multicast(struct ieee80211_hw *hw, - struct netdev_hw_addr_list *mc_list) -{ - u32 mfilt[2], val; - u8 pos; - struct netdev_hw_addr *ha; - - mfilt[0] = 0; - mfilt[1] = 1; - - netdev_hw_addr_list_for_each(ha, mc_list) { - /* calculate XOR of eight 6-bit values */ - val = get_unaligned_le32(ha->addr + 0); - pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val; - val = get_unaligned_le32(ha->addr + 3); - pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val; - pos &= 0x3f; - mfilt[pos / 32] |= (1 << (pos % 32)); - /* XXX: we might be able to just do this instead, - * but not sure, needs testing, if we do use this we'd - * need to inform below not to reset the mcast */ - /* ath5k_hw_set_mcast_filterindex(ah, - * ha->addr[5]); */ - } - - return ((u64)(mfilt[1]) << 32) | mfilt[0]; -} - - -/* - * o always accept unicast, broadcast, and multicast traffic - * o multicast traffic for all BSSIDs will be enabled if mac80211 - * says it should be - * o maintain current state of phy ofdm or phy cck error reception. - * If the hardware detects any of these type of errors then - * ath5k_hw_get_rx_filter() will pass to us the respective - * hardware filters to be able to receive these type of frames. - * o probe request frames are accepted only when operating in - * hostap, adhoc, or monitor modes - * o enable promiscuous mode according to the interface state - * o accept beacons: - * - when operating in adhoc mode so the 802.11 layer creates - * node table entries for peers, - * - when operating in station mode for collecting rssi data when - * the station is otherwise quiet, or - * - when scanning - */ -static void -ath5k_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, - unsigned int *new_flags, u64 multicast) -{ -#define SUPPORTED_FIF_FLAGS \ - (FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL | \ - FIF_PLCPFAIL | FIF_CONTROL | FIF_OTHER_BSS | \ - FIF_BCN_PRBRESP_PROMISC) - - struct ath5k_hw *ah = hw->priv; - u32 mfilt[2], rfilt; - struct ath5k_vif_iter_data iter_data; /* to count STA interfaces */ - - mutex_lock(&ah->lock); - - mfilt[0] = multicast; - mfilt[1] = multicast >> 32; - - /* Only deal with supported flags */ - changed_flags &= SUPPORTED_FIF_FLAGS; - *new_flags &= SUPPORTED_FIF_FLAGS; - - /* If HW detects any phy or radar errors, leave those filters on. - * Also, always enable Unicast, Broadcasts and Multicast - * XXX: move unicast, bssid broadcasts and multicast to mac80211 */ - rfilt = (ath5k_hw_get_rx_filter(ah) & (AR5K_RX_FILTER_PHYERR)) | - (AR5K_RX_FILTER_UCAST | AR5K_RX_FILTER_BCAST | - AR5K_RX_FILTER_MCAST); - - if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) { - if (*new_flags & FIF_PROMISC_IN_BSS) - __set_bit(ATH_STAT_PROMISC, ah->status); - else - __clear_bit(ATH_STAT_PROMISC, ah->status); - } - - if (test_bit(ATH_STAT_PROMISC, ah->status)) - rfilt |= AR5K_RX_FILTER_PROM; - - /* Note, AR5K_RX_FILTER_MCAST is already enabled */ - if (*new_flags & FIF_ALLMULTI) { - mfilt[0] = ~0; - mfilt[1] = ~0; - } - - /* This is the best we can do */ - if (*new_flags & (FIF_FCSFAIL | FIF_PLCPFAIL)) - rfilt |= AR5K_RX_FILTER_PHYERR; - - /* FIF_BCN_PRBRESP_PROMISC really means to enable beacons - * and probes for any BSSID */ - if ((*new_flags & FIF_BCN_PRBRESP_PROMISC) || (ah->nvifs > 1)) - rfilt |= AR5K_RX_FILTER_BEACON; - - /* FIF_CONTROL doc says that if FIF_PROMISC_IN_BSS is not - * set we should only pass on control frames for this - * station. This needs testing. I believe right now this - * enables *all* control frames, which is OK.. but - * but we should see if we can improve on granularity */ - if (*new_flags & FIF_CONTROL) - rfilt |= AR5K_RX_FILTER_CONTROL; - - /* Additional settings per mode -- this is per ath5k */ - - /* XXX move these to mac80211, and add a beacon IFF flag to mac80211 */ - - switch (ah->opmode) { - case NL80211_IFTYPE_MESH_POINT: - rfilt |= AR5K_RX_FILTER_CONTROL | - AR5K_RX_FILTER_BEACON | - AR5K_RX_FILTER_PROBEREQ | - AR5K_RX_FILTER_PROM; - break; - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_ADHOC: - rfilt |= AR5K_RX_FILTER_PROBEREQ | - AR5K_RX_FILTER_BEACON; - break; - case NL80211_IFTYPE_STATION: - if (ah->assoc) - rfilt |= AR5K_RX_FILTER_BEACON; - default: - break; - } - - iter_data.hw_macaddr = NULL; - iter_data.n_stas = 0; - iter_data.need_set_hw_addr = false; - ieee80211_iterate_active_interfaces_atomic( - ah->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - ath5k_vif_iter, &iter_data); - - /* Set up RX Filter */ - if (iter_data.n_stas > 1) { - /* If you have multiple STA interfaces connected to - * different APs, ARPs are not received (most of the time?) - * Enabling PROMISC appears to fix that problem. - */ - rfilt |= AR5K_RX_FILTER_PROM; - } - - /* Set filters */ - ath5k_hw_set_rx_filter(ah, rfilt); - - /* Set multicast bits */ - ath5k_hw_set_mcast_filter(ah, mfilt[0], mfilt[1]); - /* Set the cached hw filter flags, this will later actually - * be set in HW */ - ah->filter_flags = rfilt; - - mutex_unlock(&ah->lock); -} - - -static int -ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct ath5k_hw *ah = hw->priv; - struct ath_common *common = ath5k_hw_common(ah); - int ret = 0; - - if (ath5k_modparam_nohwcrypt) - return -EOPNOTSUPP; - - if (key->flags & IEEE80211_KEY_FLAG_RX_MGMT) - return -EOPNOTSUPP; - - if (vif->type == NL80211_IFTYPE_ADHOC && - (key->cipher == WLAN_CIPHER_SUITE_TKIP || - key->cipher == WLAN_CIPHER_SUITE_CCMP) && - !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { - /* don't program group keys when using IBSS_RSN */ - return -EOPNOTSUPP; - } - - switch (key->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - case WLAN_CIPHER_SUITE_TKIP: - break; - case WLAN_CIPHER_SUITE_CCMP: - if (common->crypt_caps & ATH_CRYPT_CAP_CIPHER_AESCCM) - break; - return -EOPNOTSUPP; - default: - WARN_ON(1); - return -EINVAL; - } - - mutex_lock(&ah->lock); - - switch (cmd) { - case SET_KEY: - ret = ath_key_config(common, vif, sta, key); - if (ret >= 0) { - key->hw_key_idx = ret; - /* push IV and Michael MIC generation to stack */ - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - if (key->cipher == WLAN_CIPHER_SUITE_TKIP) - key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; - if (key->cipher == WLAN_CIPHER_SUITE_CCMP) - key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; - ret = 0; - } - break; - case DISABLE_KEY: - ath_key_delete(common, key); - break; - default: - ret = -EINVAL; - } - - mmiowb(); - mutex_unlock(&ah->lock); - return ret; -} - - -static void -ath5k_sw_scan_start(struct ieee80211_hw *hw) -{ - struct ath5k_hw *ah = hw->priv; - if (!ah->assoc) - ath5k_hw_set_ledstate(ah, AR5K_LED_SCAN); -} - - -static void -ath5k_sw_scan_complete(struct ieee80211_hw *hw) -{ - struct ath5k_hw *ah = hw->priv; - ath5k_hw_set_ledstate(ah, ah->assoc ? - AR5K_LED_ASSOC : AR5K_LED_INIT); -} - - -static int -ath5k_get_stats(struct ieee80211_hw *hw, - struct ieee80211_low_level_stats *stats) -{ - struct ath5k_hw *ah = hw->priv; - - /* Force update */ - ath5k_hw_update_mib_counters(ah); - - stats->dot11ACKFailureCount = ah->stats.ack_fail; - stats->dot11RTSFailureCount = ah->stats.rts_fail; - stats->dot11RTSSuccessCount = ah->stats.rts_ok; - stats->dot11FCSErrorCount = ah->stats.fcs_error; - - return 0; -} - - -static int -ath5k_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - struct ath5k_hw *ah = hw->priv; - struct ath5k_txq_info qi; - int ret = 0; - - if (queue >= ah->ah_capabilities.cap_queues.q_tx_num) - return 0; - - mutex_lock(&ah->lock); - - ath5k_hw_get_tx_queueprops(ah, queue, &qi); - - qi.tqi_aifs = params->aifs; - qi.tqi_cw_min = params->cw_min; - qi.tqi_cw_max = params->cw_max; - qi.tqi_burst_time = params->txop * 32; - - ATH5K_DBG(ah, ATH5K_DEBUG_ANY, - "Configure tx [queue %d], " - "aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n", - queue, params->aifs, params->cw_min, - params->cw_max, params->txop); - - if (ath5k_hw_set_tx_queueprops(ah, queue, &qi)) { - ATH5K_ERR(ah, - "Unable to update hardware queue %u!\n", queue); - ret = -EIO; - } else - ath5k_hw_reset_tx_queue(ah, queue); - - mutex_unlock(&ah->lock); - - return ret; -} - - -static u64 -ath5k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct ath5k_hw *ah = hw->priv; - - return ath5k_hw_get_tsf64(ah); -} - - -static void -ath5k_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u64 tsf) -{ - struct ath5k_hw *ah = hw->priv; - - ath5k_hw_set_tsf64(ah, tsf); -} - - -static void -ath5k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct ath5k_hw *ah = hw->priv; - - /* - * in IBSS mode we need to update the beacon timers too. - * this will also reset the TSF if we call it with 0 - */ - if (ah->opmode == NL80211_IFTYPE_ADHOC) - ath5k_beacon_update_timers(ah, 0); - else - ath5k_hw_reset_tsf(ah); -} - - -static int -ath5k_get_survey(struct ieee80211_hw *hw, int idx, struct survey_info *survey) -{ - struct ath5k_hw *ah = hw->priv; - struct ieee80211_conf *conf = &hw->conf; - struct ath_common *common = ath5k_hw_common(ah); - struct ath_cycle_counters *cc = &common->cc_survey; - unsigned int div = common->clockrate * 1000; - - if (idx != 0) - return -ENOENT; - - spin_lock_bh(&common->cc_lock); - ath_hw_cycle_counters_update(common); - if (cc->cycles > 0) { - ah->survey.channel_time += cc->cycles / div; - ah->survey.channel_time_busy += cc->rx_busy / div; - ah->survey.channel_time_rx += cc->rx_frame / div; - ah->survey.channel_time_tx += cc->tx_frame / div; - } - memset(cc, 0, sizeof(*cc)); - spin_unlock_bh(&common->cc_lock); - - memcpy(survey, &ah->survey, sizeof(*survey)); - - survey->channel = conf->chandef.chan; - survey->noise = ah->ah_noise_floor; - survey->filled = SURVEY_INFO_NOISE_DBM | - SURVEY_INFO_CHANNEL_TIME | - SURVEY_INFO_CHANNEL_TIME_BUSY | - SURVEY_INFO_CHANNEL_TIME_RX | - SURVEY_INFO_CHANNEL_TIME_TX; - - return 0; -} - - -/** - * ath5k_set_coverage_class - Set IEEE 802.11 coverage class - * - * @hw: struct ieee80211_hw pointer - * @coverage_class: IEEE 802.11 coverage class number - * - * Mac80211 callback. Sets slot time, ACK timeout and CTS timeout for given - * coverage class. The values are persistent, they are restored after device - * reset. - */ -static void -ath5k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class) -{ - struct ath5k_hw *ah = hw->priv; - - mutex_lock(&ah->lock); - ath5k_hw_set_coverage_class(ah, coverage_class); - mutex_unlock(&ah->lock); -} - - -static int -ath5k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) -{ - struct ath5k_hw *ah = hw->priv; - - if (tx_ant == 1 && rx_ant == 1) - ath5k_hw_set_antenna_mode(ah, AR5K_ANTMODE_FIXED_A); - else if (tx_ant == 2 && rx_ant == 2) - ath5k_hw_set_antenna_mode(ah, AR5K_ANTMODE_FIXED_B); - else if ((tx_ant & 3) == 3 && (rx_ant & 3) == 3) - ath5k_hw_set_antenna_mode(ah, AR5K_ANTMODE_DEFAULT); - else - return -EINVAL; - return 0; -} - - -static int -ath5k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) -{ - struct ath5k_hw *ah = hw->priv; - - switch (ah->ah_ant_mode) { - case AR5K_ANTMODE_FIXED_A: - *tx_ant = 1; *rx_ant = 1; break; - case AR5K_ANTMODE_FIXED_B: - *tx_ant = 2; *rx_ant = 2; break; - case AR5K_ANTMODE_DEFAULT: - *tx_ant = 3; *rx_ant = 3; break; - } - return 0; -} - - -static void ath5k_get_ringparam(struct ieee80211_hw *hw, - u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) -{ - struct ath5k_hw *ah = hw->priv; - - *tx = ah->txqs[AR5K_TX_QUEUE_ID_DATA_MIN].txq_max; - - *tx_max = ATH5K_TXQ_LEN_MAX; - *rx = *rx_max = ATH_RXBUF; -} - - -static int ath5k_set_ringparam(struct ieee80211_hw *hw, u32 tx, u32 rx) -{ - struct ath5k_hw *ah = hw->priv; - u16 qnum; - - /* only support setting tx ring size for now */ - if (rx != ATH_RXBUF) - return -EINVAL; - - /* restrict tx ring size min/max */ - if (!tx || tx > ATH5K_TXQ_LEN_MAX) - return -EINVAL; - - for (qnum = 0; qnum < ARRAY_SIZE(ah->txqs); qnum++) { - if (!ah->txqs[qnum].setup) - continue; - if (ah->txqs[qnum].qnum < AR5K_TX_QUEUE_ID_DATA_MIN || - ah->txqs[qnum].qnum > AR5K_TX_QUEUE_ID_DATA_MAX) - continue; - - ah->txqs[qnum].txq_max = tx; - if (ah->txqs[qnum].txq_len >= ah->txqs[qnum].txq_max) - ieee80211_stop_queue(hw, ah->txqs[qnum].qnum); - } - - return 0; -} - - -const struct ieee80211_ops ath5k_hw_ops = { - .tx = ath5k_tx, - .start = ath5k_start, - .stop = ath5k_stop, - .add_interface = ath5k_add_interface, - /* .change_interface = not implemented */ - .remove_interface = ath5k_remove_interface, - .config = ath5k_config, - .bss_info_changed = ath5k_bss_info_changed, - .prepare_multicast = ath5k_prepare_multicast, - .configure_filter = ath5k_configure_filter, - /* .set_tim = not implemented */ - .set_key = ath5k_set_key, - /* .update_tkip_key = not implemented */ - /* .hw_scan = not implemented */ - .sw_scan_start = ath5k_sw_scan_start, - .sw_scan_complete = ath5k_sw_scan_complete, - .get_stats = ath5k_get_stats, - /* .get_tkip_seq = not implemented */ - /* .set_frag_threshold = not implemented */ - /* .set_rts_threshold = not implemented */ - /* .sta_add = not implemented */ - /* .sta_remove = not implemented */ - /* .sta_notify = not implemented */ - .conf_tx = ath5k_conf_tx, - .get_tsf = ath5k_get_tsf, - .set_tsf = ath5k_set_tsf, - .reset_tsf = ath5k_reset_tsf, - /* .tx_last_beacon = not implemented */ - /* .ampdu_action = not needed */ - .get_survey = ath5k_get_survey, - .set_coverage_class = ath5k_set_coverage_class, - /* .rfkill_poll = not implemented */ - /* .flush = not implemented */ - /* .channel_switch = not implemented */ - /* .napi_poll = not implemented */ - .set_antenna = ath5k_set_antenna, - .get_antenna = ath5k_get_antenna, - .set_ringparam = ath5k_set_ringparam, - .get_ringparam = ath5k_get_ringparam, -}; diff --git a/drivers/net/wireless/ath/ath5k/pci.c b/drivers/net/wireless/ath/ath5k/pci.c deleted file mode 100644 index 859db7c34f87..000000000000 --- a/drivers/net/wireless/ath/ath5k/pci.c +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Copyright (c) 2008-2009 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include "../ath.h" -#include "ath5k.h" -#include "debug.h" -#include "base.h" -#include "reg.h" - -/* Known PCI ids */ -static DEFINE_PCI_DEVICE_TABLE(ath5k_pci_id_table) = { - { PCI_VDEVICE(ATHEROS, 0x0207) }, /* 5210 early */ - { PCI_VDEVICE(ATHEROS, 0x0007) }, /* 5210 */ - { PCI_VDEVICE(ATHEROS, 0x0011) }, /* 5311 - this is on AHB bus !*/ - { PCI_VDEVICE(ATHEROS, 0x0012) }, /* 5211 */ - { PCI_VDEVICE(ATHEROS, 0x0013) }, /* 5212 */ - { PCI_VDEVICE(3COM_2, 0x0013) }, /* 3com 5212 */ - { PCI_VDEVICE(3COM, 0x0013) }, /* 3com 3CRDAG675 5212 */ - { PCI_VDEVICE(ATHEROS, 0x1014) }, /* IBM minipci 5212 */ - { PCI_VDEVICE(ATHEROS, 0x0014) }, /* 5212 compatible */ - { PCI_VDEVICE(ATHEROS, 0x0015) }, /* 5212 compatible */ - { PCI_VDEVICE(ATHEROS, 0x0016) }, /* 5212 compatible */ - { PCI_VDEVICE(ATHEROS, 0x0017) }, /* 5212 compatible */ - { PCI_VDEVICE(ATHEROS, 0x0018) }, /* 5212 compatible */ - { PCI_VDEVICE(ATHEROS, 0x0019) }, /* 5212 compatible */ - { PCI_VDEVICE(ATHEROS, 0x001a) }, /* 2413 Griffin-lite */ - { PCI_VDEVICE(ATHEROS, 0x001b) }, /* 5413 Eagle */ - { PCI_VDEVICE(ATHEROS, 0x001c) }, /* PCI-E cards */ - { PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */ - { PCI_VDEVICE(ATHEROS, 0xff1b) }, /* AR5BXB63 */ - { 0 } -}; -MODULE_DEVICE_TABLE(pci, ath5k_pci_id_table); - -/* return bus cachesize in 4B word units */ -static void ath5k_pci_read_cachesize(struct ath_common *common, int *csz) -{ - struct ath5k_hw *ah = (struct ath5k_hw *) common->priv; - u8 u8tmp; - - pci_read_config_byte(ah->pdev, PCI_CACHE_LINE_SIZE, &u8tmp); - *csz = (int)u8tmp; - - /* - * This check was put in to avoid "unpleasant" consequences if - * the bootrom has not fully initialized all PCI devices. - * Sometimes the cache line size register is not set - */ - - if (*csz == 0) - *csz = L1_CACHE_BYTES >> 2; /* Use the default size */ -} - -/* - * Read from eeprom - */ -static bool -ath5k_pci_eeprom_read(struct ath_common *common, u32 offset, u16 *data) -{ - struct ath5k_hw *ah = (struct ath5k_hw *) common->ah; - u32 status, timeout; - - /* - * Initialize EEPROM access - */ - if (ah->ah_version == AR5K_AR5210) { - AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, AR5K_PCICFG_EEAE); - (void)ath5k_hw_reg_read(ah, AR5K_EEPROM_BASE + (4 * offset)); - } else { - ath5k_hw_reg_write(ah, offset, AR5K_EEPROM_BASE); - AR5K_REG_ENABLE_BITS(ah, AR5K_EEPROM_CMD, - AR5K_EEPROM_CMD_READ); - } - - for (timeout = AR5K_TUNE_REGISTER_TIMEOUT; timeout > 0; timeout--) { - status = ath5k_hw_reg_read(ah, AR5K_EEPROM_STATUS); - if (status & AR5K_EEPROM_STAT_RDDONE) { - if (status & AR5K_EEPROM_STAT_RDERR) - return false; - *data = (u16)(ath5k_hw_reg_read(ah, AR5K_EEPROM_DATA) & - 0xffff); - return true; - } - usleep_range(15, 20); - } - - return false; -} - -int ath5k_hw_read_srev(struct ath5k_hw *ah) -{ - ah->ah_mac_srev = ath5k_hw_reg_read(ah, AR5K_SREV); - return 0; -} - -/* - * Read the MAC address from eeprom or platform_data - */ -static int ath5k_pci_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac) -{ - u8 mac_d[ETH_ALEN] = {}; - u32 total, offset; - u16 data; - int octet; - - AR5K_EEPROM_READ(0x20, data); - - for (offset = 0x1f, octet = 0, total = 0; offset >= 0x1d; offset--) { - AR5K_EEPROM_READ(offset, data); - - total += data; - mac_d[octet + 1] = data & 0xff; - mac_d[octet] = data >> 8; - octet += 2; - } - - if (!total || total == 3 * 0xffff) - return -EINVAL; - - memcpy(mac, mac_d, ETH_ALEN); - - return 0; -} - - -/* Common ath_bus_opts structure */ -static const struct ath_bus_ops ath_pci_bus_ops = { - .ath_bus_type = ATH_PCI, - .read_cachesize = ath5k_pci_read_cachesize, - .eeprom_read = ath5k_pci_eeprom_read, - .eeprom_read_mac = ath5k_pci_eeprom_read_mac, -}; - -/********************\ -* PCI Initialization * -\********************/ - -static int -ath5k_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *id) -{ - void __iomem *mem; - struct ath5k_hw *ah; - struct ieee80211_hw *hw; - int ret; - u8 csz; - - /* - * L0s needs to be disabled on all ath5k cards. - * - * For distributions shipping with CONFIG_PCIEASPM (this will be enabled - * by default in the future in 2.6.36) this will also mean both L1 and - * L0s will be disabled when a pre 1.1 PCIe device is detected. We do - * know L1 works correctly even for all ath5k pre 1.1 PCIe devices - * though but cannot currently undue the effect of a blacklist, for - * details you can read pcie_aspm_sanity_check() and see how it adjusts - * the device link capability. - * - * It may be possible in the future to implement some PCI API to allow - * drivers to override blacklists for pre 1.1 PCIe but for now it is - * best to accept that both L0s and L1 will be disabled completely for - * distributions shipping with CONFIG_PCIEASPM rather than having this - * issue present. Motivation for adding this new API will be to help - * with power consumption for some of these devices. - */ - pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S); - - ret = pci_enable_device(pdev); - if (ret) { - dev_err(&pdev->dev, "can't enable device\n"); - goto err; - } - - /* XXX 32-bit addressing only */ - ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); - if (ret) { - dev_err(&pdev->dev, "32-bit DMA not available\n"); - goto err_dis; - } - - /* - * Cache line size is used to size and align various - * structures used to communicate with the hardware. - */ - pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &csz); - if (csz == 0) { - /* - * Linux 2.4.18 (at least) writes the cache line size - * register as a 16-bit wide register which is wrong. - * We must have this setup properly for rx buffer - * DMA to work so force a reasonable value here if it - * comes up zero. - */ - csz = L1_CACHE_BYTES >> 2; - pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, csz); - } - /* - * The default setting of latency timer yields poor results, - * set it to the value used by other systems. It may be worth - * tweaking this setting more. - */ - pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xa8); - - /* Enable bus mastering */ - pci_set_master(pdev); - - /* - * Disable the RETRY_TIMEOUT register (0x41) to keep - * PCI Tx retries from interfering with C3 CPU state. - */ - pci_write_config_byte(pdev, 0x41, 0); - - ret = pci_request_region(pdev, 0, "ath5k"); - if (ret) { - dev_err(&pdev->dev, "cannot reserve PCI memory region\n"); - goto err_dis; - } - - mem = pci_iomap(pdev, 0, 0); - if (!mem) { - dev_err(&pdev->dev, "cannot remap PCI memory region\n"); - ret = -EIO; - goto err_reg; - } - - /* - * Allocate hw (mac80211 main struct) - * and hw->priv (driver private data) - */ - hw = ieee80211_alloc_hw(sizeof(*ah), &ath5k_hw_ops); - if (hw == NULL) { - dev_err(&pdev->dev, "cannot allocate ieee80211_hw\n"); - ret = -ENOMEM; - goto err_map; - } - - dev_info(&pdev->dev, "registered as '%s'\n", wiphy_name(hw->wiphy)); - - ah = hw->priv; - ah->hw = hw; - ah->pdev = pdev; - ah->dev = &pdev->dev; - ah->irq = pdev->irq; - ah->devid = id->device; - ah->iobase = mem; /* So we can unmap it on detach */ - - /* Initialize */ - ret = ath5k_init_ah(ah, &ath_pci_bus_ops); - if (ret) - goto err_free; - - /* Set private data */ - pci_set_drvdata(pdev, hw); - - return 0; -err_free: - ieee80211_free_hw(hw); -err_map: - pci_iounmap(pdev, mem); -err_reg: - pci_release_region(pdev, 0); -err_dis: - pci_disable_device(pdev); -err: - return ret; -} - -static void -ath5k_pci_remove(struct pci_dev *pdev) -{ - struct ieee80211_hw *hw = pci_get_drvdata(pdev); - struct ath5k_hw *ah = hw->priv; - - ath5k_deinit_ah(ah); - pci_iounmap(pdev, ah->iobase); - pci_release_region(pdev, 0); - pci_disable_device(pdev); - ieee80211_free_hw(hw); -} - -#ifdef CONFIG_PM_SLEEP -static int ath5k_pci_suspend(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct ieee80211_hw *hw = pci_get_drvdata(pdev); - struct ath5k_hw *ah = hw->priv; - - ath5k_led_off(ah); - return 0; -} - -static int ath5k_pci_resume(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct ieee80211_hw *hw = pci_get_drvdata(pdev); - struct ath5k_hw *ah = hw->priv; - - /* - * Suspend/Resume resets the PCI configuration space, so we have to - * re-disable the RETRY_TIMEOUT register (0x41) to keep - * PCI Tx retries from interfering with C3 CPU state - */ - pci_write_config_byte(pdev, 0x41, 0); - - ath5k_led_enable(ah); - return 0; -} - -static SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume); -#define ATH5K_PM_OPS (&ath5k_pm_ops) -#else -#define ATH5K_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ - -static struct pci_driver ath5k_pci_driver = { - .name = KBUILD_MODNAME, - .id_table = ath5k_pci_id_table, - .probe = ath5k_pci_probe, - .remove = ath5k_pci_remove, - .driver.pm = ATH5K_PM_OPS, -}; - -module_pci_driver(ath5k_pci_driver); diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c deleted file mode 100644 index 1f16b4227d8f..000000000000 --- a/drivers/net/wireless/ath/ath5k/pcu.c +++ /dev/null @@ -1,1007 +0,0 @@ -/* - * Copyright (c) 2004-2008 Reyk Floeter - * Copyright (c) 2006-2008 Nick Kossifidis - * Copyright (c) 2007-2008 Matthew W. S. Bell - * Copyright (c) 2007-2008 Luis Rodriguez - * Copyright (c) 2007-2008 Pavel Roskin - * Copyright (c) 2007-2008 Jiri Slaby - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/*********************************\ -* Protocol Control Unit Functions * -\*********************************/ - -#include - -#include "ath5k.h" -#include "reg.h" -#include "debug.h" - -/** - * DOC: Protocol Control Unit (PCU) functions - * - * Protocol control unit is responsible to maintain various protocol - * properties before a frame is send and after a frame is received to/from - * baseband. To be more specific, PCU handles: - * - * - Buffering of RX and TX frames (after QCU/DCUs) - * - * - Encrypting and decrypting (using the built-in engine) - * - * - Generating ACKs, RTS/CTS frames - * - * - Maintaining TSF - * - * - FCS - * - * - Updating beacon data (with TSF etc) - * - * - Generating virtual CCA - * - * - RX/Multicast filtering - * - * - BSSID filtering - * - * - Various statistics - * - * -Different operating modes: AP, STA, IBSS - * - * Note: Most of these functions can be tweaked/bypassed so you can do - * them on sw above for debugging or research. For more infos check out PCU - * registers on reg.h. - */ - -/** - * DOC: ACK rates - * - * AR5212+ can use higher rates for ack transmission - * based on current tx rate instead of the base rate. - * It does this to better utilize channel usage. - * There is a mapping between G rates (that cover both - * CCK and OFDM) and ack rates that we use when setting - * rate -> duration table. This mapping is hw-based so - * don't change anything. - * - * To enable this functionality we must set - * ah->ah_ack_bitrate_high to true else base rate is - * used (1Mb for CCK, 6Mb for OFDM). - */ -static const unsigned int ack_rates_high[] = -/* Tx -> ACK */ -/* 1Mb -> 1Mb */ { 0, -/* 2MB -> 2Mb */ 1, -/* 5.5Mb -> 2Mb */ 1, -/* 11Mb -> 2Mb */ 1, -/* 6Mb -> 6Mb */ 4, -/* 9Mb -> 6Mb */ 4, -/* 12Mb -> 12Mb */ 6, -/* 18Mb -> 12Mb */ 6, -/* 24Mb -> 24Mb */ 8, -/* 36Mb -> 24Mb */ 8, -/* 48Mb -> 24Mb */ 8, -/* 54Mb -> 24Mb */ 8 }; - -/*******************\ -* Helper functions * -\*******************/ - -/** - * ath5k_hw_get_frame_duration() - Get tx time of a frame - * @ah: The &struct ath5k_hw - * @len: Frame's length in bytes - * @rate: The @struct ieee80211_rate - * @shortpre: Indicate short preample - * - * Calculate tx duration of a frame given it's rate and length - * It extends ieee80211_generic_frame_duration for non standard - * bwmodes. - */ -int -ath5k_hw_get_frame_duration(struct ath5k_hw *ah, enum ieee80211_band band, - int len, struct ieee80211_rate *rate, bool shortpre) -{ - int sifs, preamble, plcp_bits, sym_time; - int bitrate, bits, symbols, symbol_bits; - int dur; - - /* Fallback */ - if (!ah->ah_bwmode) { - __le16 raw_dur = ieee80211_generic_frame_duration(ah->hw, - NULL, band, len, rate); - - /* subtract difference between long and short preamble */ - dur = le16_to_cpu(raw_dur); - if (shortpre) - dur -= 96; - - return dur; - } - - bitrate = rate->bitrate; - preamble = AR5K_INIT_OFDM_PREAMPLE_TIME; - plcp_bits = AR5K_INIT_OFDM_PLCP_BITS; - sym_time = AR5K_INIT_OFDM_SYMBOL_TIME; - - switch (ah->ah_bwmode) { - case AR5K_BWMODE_40MHZ: - sifs = AR5K_INIT_SIFS_TURBO; - preamble = AR5K_INIT_OFDM_PREAMBLE_TIME_MIN; - break; - case AR5K_BWMODE_10MHZ: - sifs = AR5K_INIT_SIFS_HALF_RATE; - preamble *= 2; - sym_time *= 2; - break; - case AR5K_BWMODE_5MHZ: - sifs = AR5K_INIT_SIFS_QUARTER_RATE; - preamble *= 4; - sym_time *= 4; - break; - default: - sifs = AR5K_INIT_SIFS_DEFAULT_BG; - break; - } - - bits = plcp_bits + (len << 3); - /* Bit rate is in 100Kbits */ - symbol_bits = bitrate * sym_time; - symbols = DIV_ROUND_UP(bits * 10, symbol_bits); - - dur = sifs + preamble + (sym_time * symbols); - - return dur; -} - -/** - * ath5k_hw_get_default_slottime() - Get the default slot time for current mode - * @ah: The &struct ath5k_hw - */ -unsigned int -ath5k_hw_get_default_slottime(struct ath5k_hw *ah) -{ - struct ieee80211_channel *channel = ah->ah_current_channel; - unsigned int slot_time; - - switch (ah->ah_bwmode) { - case AR5K_BWMODE_40MHZ: - slot_time = AR5K_INIT_SLOT_TIME_TURBO; - break; - case AR5K_BWMODE_10MHZ: - slot_time = AR5K_INIT_SLOT_TIME_HALF_RATE; - break; - case AR5K_BWMODE_5MHZ: - slot_time = AR5K_INIT_SLOT_TIME_QUARTER_RATE; - break; - case AR5K_BWMODE_DEFAULT: - default: - slot_time = AR5K_INIT_SLOT_TIME_DEFAULT; - if ((channel->hw_value == AR5K_MODE_11B) && !ah->ah_short_slot) - slot_time = AR5K_INIT_SLOT_TIME_B; - break; - } - - return slot_time; -} - -/** - * ath5k_hw_get_default_sifs() - Get the default SIFS for current mode - * @ah: The &struct ath5k_hw - */ -unsigned int -ath5k_hw_get_default_sifs(struct ath5k_hw *ah) -{ - struct ieee80211_channel *channel = ah->ah_current_channel; - unsigned int sifs; - - switch (ah->ah_bwmode) { - case AR5K_BWMODE_40MHZ: - sifs = AR5K_INIT_SIFS_TURBO; - break; - case AR5K_BWMODE_10MHZ: - sifs = AR5K_INIT_SIFS_HALF_RATE; - break; - case AR5K_BWMODE_5MHZ: - sifs = AR5K_INIT_SIFS_QUARTER_RATE; - break; - case AR5K_BWMODE_DEFAULT: - sifs = AR5K_INIT_SIFS_DEFAULT_BG; - default: - if (channel->band == IEEE80211_BAND_5GHZ) - sifs = AR5K_INIT_SIFS_DEFAULT_A; - break; - } - - return sifs; -} - -/** - * ath5k_hw_update_mib_counters() - Update MIB counters (mac layer statistics) - * @ah: The &struct ath5k_hw - * - * Reads MIB counters from PCU and updates sw statistics. Is called after a - * MIB interrupt, because one of these counters might have reached their maximum - * and triggered the MIB interrupt, to let us read and clear the counter. - * - * NOTE: Is called in interrupt context! - */ -void -ath5k_hw_update_mib_counters(struct ath5k_hw *ah) -{ - struct ath5k_statistics *stats = &ah->stats; - - /* Read-And-Clear */ - stats->ack_fail += ath5k_hw_reg_read(ah, AR5K_ACK_FAIL); - stats->rts_fail += ath5k_hw_reg_read(ah, AR5K_RTS_FAIL); - stats->rts_ok += ath5k_hw_reg_read(ah, AR5K_RTS_OK); - stats->fcs_error += ath5k_hw_reg_read(ah, AR5K_FCS_FAIL); - stats->beacons += ath5k_hw_reg_read(ah, AR5K_BEACON_CNT); -} - - -/******************\ -* ACK/CTS Timeouts * -\******************/ - -/** - * ath5k_hw_write_rate_duration() - Fill rate code to duration table - * @ah: The &struct ath5k_hw - * - * Write the rate code to duration table upon hw reset. This is a helper for - * ath5k_hw_pcu_init(). It seems all this is doing is setting an ACK timeout on - * the hardware, based on current mode, for each rate. The rates which are - * capable of short preamble (802.11b rates 2Mbps, 5.5Mbps, and 11Mbps) have - * different rate code so we write their value twice (one for long preamble - * and one for short). - * - * Note: Band doesn't matter here, if we set the values for OFDM it works - * on both a and g modes. So all we have to do is set values for all g rates - * that include all OFDM and CCK rates. - * - */ -static inline void -ath5k_hw_write_rate_duration(struct ath5k_hw *ah) -{ - struct ieee80211_rate *rate; - unsigned int i; - /* 802.11g covers both OFDM and CCK */ - u8 band = IEEE80211_BAND_2GHZ; - - /* Write rate duration table */ - for (i = 0; i < ah->sbands[band].n_bitrates; i++) { - u32 reg; - u16 tx_time; - - if (ah->ah_ack_bitrate_high) - rate = &ah->sbands[band].bitrates[ack_rates_high[i]]; - /* CCK -> 1Mb */ - else if (i < 4) - rate = &ah->sbands[band].bitrates[0]; - /* OFDM -> 6Mb */ - else - rate = &ah->sbands[band].bitrates[4]; - - /* Set ACK timeout */ - reg = AR5K_RATE_DUR(rate->hw_value); - - /* An ACK frame consists of 10 bytes. If you add the FCS, - * which ieee80211_generic_frame_duration() adds, - * its 14 bytes. Note we use the control rate and not the - * actual rate for this rate. See mac80211 tx.c - * ieee80211_duration() for a brief description of - * what rate we should choose to TX ACKs. */ - tx_time = ath5k_hw_get_frame_duration(ah, band, 10, - rate, false); - - ath5k_hw_reg_write(ah, tx_time, reg); - - if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE)) - continue; - - tx_time = ath5k_hw_get_frame_duration(ah, band, 10, rate, true); - ath5k_hw_reg_write(ah, tx_time, - reg + (AR5K_SET_SHORT_PREAMBLE << 2)); - } -} - -/** - * ath5k_hw_set_ack_timeout() - Set ACK timeout on PCU - * @ah: The &struct ath5k_hw - * @timeout: Timeout in usec - */ -static int -ath5k_hw_set_ack_timeout(struct ath5k_hw *ah, unsigned int timeout) -{ - if (ath5k_hw_clocktoh(ah, AR5K_REG_MS(0xffffffff, AR5K_TIME_OUT_ACK)) - <= timeout) - return -EINVAL; - - AR5K_REG_WRITE_BITS(ah, AR5K_TIME_OUT, AR5K_TIME_OUT_ACK, - ath5k_hw_htoclock(ah, timeout)); - - return 0; -} - -/** - * ath5k_hw_set_cts_timeout() - Set CTS timeout on PCU - * @ah: The &struct ath5k_hw - * @timeout: Timeout in usec - */ -static int -ath5k_hw_set_cts_timeout(struct ath5k_hw *ah, unsigned int timeout) -{ - if (ath5k_hw_clocktoh(ah, AR5K_REG_MS(0xffffffff, AR5K_TIME_OUT_CTS)) - <= timeout) - return -EINVAL; - - AR5K_REG_WRITE_BITS(ah, AR5K_TIME_OUT, AR5K_TIME_OUT_CTS, - ath5k_hw_htoclock(ah, timeout)); - - return 0; -} - - -/*******************\ -* RX filter Control * -\*******************/ - -/** - * ath5k_hw_set_lladdr() - Set station id - * @ah: The &struct ath5k_hw - * @mac: The card's mac address (array of octets) - * - * Set station id on hw using the provided mac address - */ -int -ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac) -{ - struct ath_common *common = ath5k_hw_common(ah); - u32 low_id, high_id; - u32 pcu_reg; - - /* Set new station ID */ - memcpy(common->macaddr, mac, ETH_ALEN); - - pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000; - - low_id = get_unaligned_le32(mac); - high_id = get_unaligned_le16(mac + 4); - - ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0); - ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1); - - return 0; -} - -/** - * ath5k_hw_set_bssid() - Set current BSSID on hw - * @ah: The &struct ath5k_hw - * - * Sets the current BSSID and BSSID mask we have from the - * common struct into the hardware - */ -void -ath5k_hw_set_bssid(struct ath5k_hw *ah) -{ - struct ath_common *common = ath5k_hw_common(ah); - u16 tim_offset = 0; - - /* - * Set BSSID mask on 5212 - */ - if (ah->ah_version == AR5K_AR5212) - ath_hw_setbssidmask(common); - - /* - * Set BSSID - */ - ath5k_hw_reg_write(ah, - get_unaligned_le32(common->curbssid), - AR5K_BSS_ID0); - ath5k_hw_reg_write(ah, - get_unaligned_le16(common->curbssid + 4) | - ((common->curaid & 0x3fff) << AR5K_BSS_ID1_AID_S), - AR5K_BSS_ID1); - - if (common->curaid == 0) { - ath5k_hw_disable_pspoll(ah); - return; - } - - AR5K_REG_WRITE_BITS(ah, AR5K_BEACON, AR5K_BEACON_TIM, - tim_offset ? tim_offset + 4 : 0); - - ath5k_hw_enable_pspoll(ah, NULL, 0); -} - -/** - * ath5k_hw_set_bssid_mask() - Filter out bssids we listen - * @ah: The &struct ath5k_hw - * @mask: The BSSID mask to set (array of octets) - * - * BSSID masking is a method used by AR5212 and newer hardware to inform PCU - * which bits of the interface's MAC address should be looked at when trying - * to decide which packets to ACK. In station mode and AP mode with a single - * BSS every bit matters since we lock to only one BSS. In AP mode with - * multiple BSSes (virtual interfaces) not every bit matters because hw must - * accept frames for all BSSes and so we tweak some bits of our mac address - * in order to have multiple BSSes. - * - * For more information check out ../hw.c of the common ath module. - */ -void -ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask) -{ - struct ath_common *common = ath5k_hw_common(ah); - - /* Cache bssid mask so that we can restore it - * on reset */ - memcpy(common->bssidmask, mask, ETH_ALEN); - if (ah->ah_version == AR5K_AR5212) - ath_hw_setbssidmask(common); -} - -/** - * ath5k_hw_set_mcast_filter() - Set multicast filter - * @ah: The &struct ath5k_hw - * @filter0: Lower 32bits of muticast filter - * @filter1: Higher 16bits of multicast filter - */ -void -ath5k_hw_set_mcast_filter(struct ath5k_hw *ah, u32 filter0, u32 filter1) -{ - ath5k_hw_reg_write(ah, filter0, AR5K_MCAST_FILTER0); - ath5k_hw_reg_write(ah, filter1, AR5K_MCAST_FILTER1); -} - -/** - * ath5k_hw_get_rx_filter() - Get current rx filter - * @ah: The &struct ath5k_hw - * - * Returns the RX filter by reading rx filter and - * phy error filter registers. RX filter is used - * to set the allowed frame types that PCU will accept - * and pass to the driver. For a list of frame types - * check out reg.h. - */ -u32 -ath5k_hw_get_rx_filter(struct ath5k_hw *ah) -{ - u32 data, filter = 0; - - filter = ath5k_hw_reg_read(ah, AR5K_RX_FILTER); - - /*Radar detection for 5212*/ - if (ah->ah_version == AR5K_AR5212) { - data = ath5k_hw_reg_read(ah, AR5K_PHY_ERR_FIL); - - if (data & AR5K_PHY_ERR_FIL_RADAR) - filter |= AR5K_RX_FILTER_RADARERR; - if (data & (AR5K_PHY_ERR_FIL_OFDM | AR5K_PHY_ERR_FIL_CCK)) - filter |= AR5K_RX_FILTER_PHYERR; - } - - return filter; -} - -/** - * ath5k_hw_set_rx_filter() - Set rx filter - * @ah: The &struct ath5k_hw - * @filter: RX filter mask (see reg.h) - * - * Sets RX filter register and also handles PHY error filter - * register on 5212 and newer chips so that we have proper PHY - * error reporting. - */ -void -ath5k_hw_set_rx_filter(struct ath5k_hw *ah, u32 filter) -{ - u32 data = 0; - - /* Set PHY error filter register on 5212*/ - if (ah->ah_version == AR5K_AR5212) { - if (filter & AR5K_RX_FILTER_RADARERR) - data |= AR5K_PHY_ERR_FIL_RADAR; - if (filter & AR5K_RX_FILTER_PHYERR) - data |= AR5K_PHY_ERR_FIL_OFDM | AR5K_PHY_ERR_FIL_CCK; - } - - /* - * The AR5210 uses promiscuous mode to detect radar activity - */ - if (ah->ah_version == AR5K_AR5210 && - (filter & AR5K_RX_FILTER_RADARERR)) { - filter &= ~AR5K_RX_FILTER_RADARERR; - filter |= AR5K_RX_FILTER_PROM; - } - - /*Zero length DMA (phy error reporting) */ - if (data) - AR5K_REG_ENABLE_BITS(ah, AR5K_RXCFG, AR5K_RXCFG_ZLFDMA); - else - AR5K_REG_DISABLE_BITS(ah, AR5K_RXCFG, AR5K_RXCFG_ZLFDMA); - - /*Write RX Filter register*/ - ath5k_hw_reg_write(ah, filter & 0xff, AR5K_RX_FILTER); - - /*Write PHY error filter register on 5212*/ - if (ah->ah_version == AR5K_AR5212) - ath5k_hw_reg_write(ah, data, AR5K_PHY_ERR_FIL); - -} - - -/****************\ -* Beacon control * -\****************/ - -#define ATH5K_MAX_TSF_READ 10 - -/** - * ath5k_hw_get_tsf64() - Get the full 64bit TSF - * @ah: The &struct ath5k_hw - * - * Returns the current TSF - */ -u64 -ath5k_hw_get_tsf64(struct ath5k_hw *ah) -{ - u32 tsf_lower, tsf_upper1, tsf_upper2; - int i; - unsigned long flags; - - /* This code is time critical - we don't want to be interrupted here */ - local_irq_save(flags); - - /* - * While reading TSF upper and then lower part, the clock is still - * counting (or jumping in case of IBSS merge) so we might get - * inconsistent values. To avoid this, we read the upper part again - * and check it has not been changed. We make the hypothesis that a - * maximum of 3 changes can happens in a row (we use 10 as a safe - * value). - * - * Impact on performance is pretty small, since in most cases, only - * 3 register reads are needed. - */ - - tsf_upper1 = ath5k_hw_reg_read(ah, AR5K_TSF_U32); - for (i = 0; i < ATH5K_MAX_TSF_READ; i++) { - tsf_lower = ath5k_hw_reg_read(ah, AR5K_TSF_L32); - tsf_upper2 = ath5k_hw_reg_read(ah, AR5K_TSF_U32); - if (tsf_upper2 == tsf_upper1) - break; - tsf_upper1 = tsf_upper2; - } - - local_irq_restore(flags); - - WARN_ON(i == ATH5K_MAX_TSF_READ); - - return ((u64)tsf_upper1 << 32) | tsf_lower; -} - -#undef ATH5K_MAX_TSF_READ - -/** - * ath5k_hw_set_tsf64() - Set a new 64bit TSF - * @ah: The &struct ath5k_hw - * @tsf64: The new 64bit TSF - * - * Sets the new TSF - */ -void -ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64) -{ - ath5k_hw_reg_write(ah, tsf64 & 0xffffffff, AR5K_TSF_L32); - ath5k_hw_reg_write(ah, (tsf64 >> 32) & 0xffffffff, AR5K_TSF_U32); -} - -/** - * ath5k_hw_reset_tsf() - Force a TSF reset - * @ah: The &struct ath5k_hw - * - * Forces a TSF reset on PCU - */ -void -ath5k_hw_reset_tsf(struct ath5k_hw *ah) -{ - u32 val; - - val = ath5k_hw_reg_read(ah, AR5K_BEACON) | AR5K_BEACON_RESET_TSF; - - /* - * Each write to the RESET_TSF bit toggles a hardware internal - * signal to reset TSF, but if left high it will cause a TSF reset - * on the next chip reset as well. Thus we always write the value - * twice to clear the signal. - */ - ath5k_hw_reg_write(ah, val, AR5K_BEACON); - ath5k_hw_reg_write(ah, val, AR5K_BEACON); -} - -/** - * ath5k_hw_init_beacon_timers() - Initialize beacon timers - * @ah: The &struct ath5k_hw - * @next_beacon: Next TBTT - * @interval: Current beacon interval - * - * This function is used to initialize beacon timers based on current - * operation mode and settings. - */ -void -ath5k_hw_init_beacon_timers(struct ath5k_hw *ah, u32 next_beacon, u32 interval) -{ - u32 timer1, timer2, timer3; - - /* - * Set the additional timers by mode - */ - switch (ah->opmode) { - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_STATION: - /* In STA mode timer1 is used as next wakeup - * timer and timer2 as next CFP duration start - * timer. Both in 1/8TUs. */ - /* TODO: PCF handling */ - if (ah->ah_version == AR5K_AR5210) { - timer1 = 0xffffffff; - timer2 = 0xffffffff; - } else { - timer1 = 0x0000ffff; - timer2 = 0x0007ffff; - } - /* Mark associated AP as PCF incapable for now */ - AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1, AR5K_STA_ID1_PCF); - break; - case NL80211_IFTYPE_ADHOC: - AR5K_REG_ENABLE_BITS(ah, AR5K_TXCFG, AR5K_TXCFG_ADHOC_BCN_ATIM); - default: - /* On non-STA modes timer1 is used as next DMA - * beacon alert (DBA) timer and timer2 as next - * software beacon alert. Both in 1/8TUs. */ - timer1 = (next_beacon - AR5K_TUNE_DMA_BEACON_RESP) << 3; - timer2 = (next_beacon - AR5K_TUNE_SW_BEACON_RESP) << 3; - break; - } - - /* Timer3 marks the end of our ATIM window - * a zero length window is not allowed because - * we 'll get no beacons */ - timer3 = next_beacon + 1; - - /* - * Set the beacon register and enable all timers. - */ - /* When in AP or Mesh Point mode zero timer0 to start TSF */ - if (ah->opmode == NL80211_IFTYPE_AP || - ah->opmode == NL80211_IFTYPE_MESH_POINT) - ath5k_hw_reg_write(ah, 0, AR5K_TIMER0); - - ath5k_hw_reg_write(ah, next_beacon, AR5K_TIMER0); - ath5k_hw_reg_write(ah, timer1, AR5K_TIMER1); - ath5k_hw_reg_write(ah, timer2, AR5K_TIMER2); - ath5k_hw_reg_write(ah, timer3, AR5K_TIMER3); - - /* Force a TSF reset if requested and enable beacons */ - if (interval & AR5K_BEACON_RESET_TSF) - ath5k_hw_reset_tsf(ah); - - ath5k_hw_reg_write(ah, interval & (AR5K_BEACON_PERIOD | - AR5K_BEACON_ENABLE), - AR5K_BEACON); - - /* Flush any pending BMISS interrupts on ISR by - * performing a clear-on-write operation on PISR - * register for the BMISS bit (writing a bit on - * ISR toggles a reset for that bit and leaves - * the remaining bits intact) */ - if (ah->ah_version == AR5K_AR5210) - ath5k_hw_reg_write(ah, AR5K_ISR_BMISS, AR5K_ISR); - else - ath5k_hw_reg_write(ah, AR5K_ISR_BMISS, AR5K_PISR); - - /* TODO: Set enhanced sleep registers on AR5212 - * based on vif->bss_conf params, until then - * disable power save reporting.*/ - AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1, AR5K_STA_ID1_PWR_SV); - -} - -/** - * ath5k_check_timer_win() - Check if timer B is timer A + window - * @a: timer a (before b) - * @b: timer b (after a) - * @window: difference between a and b - * @intval: timers are increased by this interval - * - * This helper function checks if timer B is timer A + window and covers - * cases where timer A or B might have already been updated or wrapped - * around (Timers are 16 bit). - * - * Returns true if O.K. - */ -static inline bool -ath5k_check_timer_win(int a, int b, int window, int intval) -{ - /* - * 1.) usually B should be A + window - * 2.) A already updated, B not updated yet - * 3.) A already updated and has wrapped around - * 4.) B has wrapped around - */ - if ((b - a == window) || /* 1.) */ - (a - b == intval - window) || /* 2.) */ - ((a | 0x10000) - b == intval - window) || /* 3.) */ - ((b | 0x10000) - a == window)) /* 4.) */ - return true; /* O.K. */ - return false; -} - -/** - * ath5k_hw_check_beacon_timers() - Check if the beacon timers are correct - * @ah: The &struct ath5k_hw - * @intval: beacon interval - * - * This is a workaround for IBSS mode - * - * The need for this function arises from the fact that we have 4 separate - * HW timer registers (TIMER0 - TIMER3), which are closely related to the - * next beacon target time (NBTT), and that the HW updates these timers - * separately based on the current TSF value. The hardware increments each - * timer by the beacon interval, when the local TSF converted to TU is equal - * to the value stored in the timer. - * - * The reception of a beacon with the same BSSID can update the local HW TSF - * at any time - this is something we can't avoid. If the TSF jumps to a - * time which is later than the time stored in a timer, this timer will not - * be updated until the TSF in TU wraps around at 16 bit (the size of the - * timers) and reaches the time which is stored in the timer. - * - * The problem is that these timers are closely related to TIMER0 (NBTT) and - * that they define a time "window". When the TSF jumps between two timers - * (e.g. ATIM and NBTT), the one in the past will be left behind (not - * updated), while the one in the future will be updated every beacon - * interval. This causes the window to get larger, until the TSF wraps - * around as described above and the timer which was left behind gets - * updated again. But - because the beacon interval is usually not an exact - * divisor of the size of the timers (16 bit), an unwanted "window" between - * these timers has developed! - * - * This is especially important with the ATIM window, because during - * the ATIM window only ATIM frames and no data frames are allowed to be - * sent, which creates transmission pauses after each beacon. This symptom - * has been described as "ramping ping" because ping times increase linearly - * for some time and then drop down again. A wrong window on the DMA beacon - * timer has the same effect, so we check for these two conditions. - * - * Returns true if O.K. - */ -bool -ath5k_hw_check_beacon_timers(struct ath5k_hw *ah, int intval) -{ - unsigned int nbtt, atim, dma; - - nbtt = ath5k_hw_reg_read(ah, AR5K_TIMER0); - atim = ath5k_hw_reg_read(ah, AR5K_TIMER3); - dma = ath5k_hw_reg_read(ah, AR5K_TIMER1) >> 3; - - /* NOTE: SWBA is different. Having a wrong window there does not - * stop us from sending data and this condition is caught by - * other means (SWBA interrupt) */ - - if (ath5k_check_timer_win(nbtt, atim, 1, intval) && - ath5k_check_timer_win(dma, nbtt, AR5K_TUNE_DMA_BEACON_RESP, - intval)) - return true; /* O.K. */ - return false; -} - -/** - * ath5k_hw_set_coverage_class() - Set IEEE 802.11 coverage class - * @ah: The &struct ath5k_hw - * @coverage_class: IEEE 802.11 coverage class number - * - * Sets IFS intervals and ACK/CTS timeouts for given coverage class. - */ -void -ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class) -{ - /* As defined by IEEE 802.11-2007 17.3.8.6 */ - int slot_time = ath5k_hw_get_default_slottime(ah) + 3 * coverage_class; - int ack_timeout = ath5k_hw_get_default_sifs(ah) + slot_time; - int cts_timeout = ack_timeout; - - ath5k_hw_set_ifs_intervals(ah, slot_time); - ath5k_hw_set_ack_timeout(ah, ack_timeout); - ath5k_hw_set_cts_timeout(ah, cts_timeout); - - ah->ah_coverage_class = coverage_class; -} - -/***************************\ -* Init/Start/Stop functions * -\***************************/ - -/** - * ath5k_hw_start_rx_pcu() - Start RX engine - * @ah: The &struct ath5k_hw - * - * Starts RX engine on PCU so that hw can process RXed frames - * (ACK etc). - * - * NOTE: RX DMA should be already enabled using ath5k_hw_start_rx_dma - */ -void -ath5k_hw_start_rx_pcu(struct ath5k_hw *ah) -{ - AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX); -} - -/** - * at5k_hw_stop_rx_pcu() - Stop RX engine - * @ah: The &struct ath5k_hw - * - * Stops RX engine on PCU - */ -void -ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah) -{ - AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX); -} - -/** - * ath5k_hw_set_opmode() - Set PCU operating mode - * @ah: The &struct ath5k_hw - * @op_mode: One of enum nl80211_iftype - * - * Configure PCU for the various operating modes (AP/STA etc) - */ -int -ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype op_mode) -{ - struct ath_common *common = ath5k_hw_common(ah); - u32 pcu_reg, beacon_reg, low_id, high_id; - - ATH5K_DBG(ah, ATH5K_DEBUG_MODE, "mode %d\n", op_mode); - - /* Preserve rest settings */ - pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000; - pcu_reg &= ~(AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_AP - | AR5K_STA_ID1_KEYSRCH_MODE - | (ah->ah_version == AR5K_AR5210 ? - (AR5K_STA_ID1_PWR_SV | AR5K_STA_ID1_NO_PSPOLL) : 0)); - - beacon_reg = 0; - - switch (op_mode) { - case NL80211_IFTYPE_ADHOC: - pcu_reg |= AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_KEYSRCH_MODE; - beacon_reg |= AR5K_BCR_ADHOC; - if (ah->ah_version == AR5K_AR5210) - pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; - else - AR5K_REG_ENABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS); - break; - - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_MESH_POINT: - pcu_reg |= AR5K_STA_ID1_AP | AR5K_STA_ID1_KEYSRCH_MODE; - beacon_reg |= AR5K_BCR_AP; - if (ah->ah_version == AR5K_AR5210) - pcu_reg |= AR5K_STA_ID1_NO_PSPOLL; - else - AR5K_REG_DISABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS); - break; - - case NL80211_IFTYPE_STATION: - pcu_reg |= AR5K_STA_ID1_KEYSRCH_MODE - | (ah->ah_version == AR5K_AR5210 ? - AR5K_STA_ID1_PWR_SV : 0); - case NL80211_IFTYPE_MONITOR: - pcu_reg |= AR5K_STA_ID1_KEYSRCH_MODE - | (ah->ah_version == AR5K_AR5210 ? - AR5K_STA_ID1_NO_PSPOLL : 0); - break; - - default: - return -EINVAL; - } - - /* - * Set PCU registers - */ - low_id = get_unaligned_le32(common->macaddr); - high_id = get_unaligned_le16(common->macaddr + 4); - ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0); - ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1); - - /* - * Set Beacon Control Register on 5210 - */ - if (ah->ah_version == AR5K_AR5210) - ath5k_hw_reg_write(ah, beacon_reg, AR5K_BCR); - - return 0; -} - -/** - * ath5k_hw_pcu_init() - Initialize PCU - * @ah: The &struct ath5k_hw - * @op_mode: One of enum nl80211_iftype - * @mode: One of enum ath5k_driver_mode - * - * This function is used to initialize PCU by setting current - * operation mode and various other settings. - */ -void -ath5k_hw_pcu_init(struct ath5k_hw *ah, enum nl80211_iftype op_mode) -{ - /* Set bssid and bssid mask */ - ath5k_hw_set_bssid(ah); - - /* Set PCU config */ - ath5k_hw_set_opmode(ah, op_mode); - - /* Write rate duration table only on AR5212 and if - * virtual interface has already been brought up - * XXX: rethink this after new mode changes to - * mac80211 are integrated */ - if (ah->ah_version == AR5K_AR5212 && - ah->nvifs) - ath5k_hw_write_rate_duration(ah); - - /* Set RSSI/BRSSI thresholds - * - * Note: If we decide to set this value - * dynamically, have in mind that when AR5K_RSSI_THR - * register is read it might return 0x40 if we haven't - * wrote anything to it plus BMISS RSSI threshold is zeroed. - * So doing a save/restore procedure here isn't the right - * choice. Instead store it on ath5k_hw */ - ath5k_hw_reg_write(ah, (AR5K_TUNE_RSSI_THRES | - AR5K_TUNE_BMISS_THRES << - AR5K_RSSI_THR_BMISS_S), - AR5K_RSSI_THR); - - /* MIC QoS support */ - if (ah->ah_mac_srev >= AR5K_SREV_AR2413) { - ath5k_hw_reg_write(ah, 0x000100aa, AR5K_MIC_QOS_CTL); - ath5k_hw_reg_write(ah, 0x00003210, AR5K_MIC_QOS_SEL); - } - - /* QoS NOACK Policy */ - if (ah->ah_version == AR5K_AR5212) { - ath5k_hw_reg_write(ah, - AR5K_REG_SM(2, AR5K_QOS_NOACK_2BIT_VALUES) | - AR5K_REG_SM(5, AR5K_QOS_NOACK_BIT_OFFSET) | - AR5K_REG_SM(0, AR5K_QOS_NOACK_BYTE_OFFSET), - AR5K_QOS_NOACK); - } - - /* Restore slot time and ACK timeouts */ - if (ah->ah_coverage_class > 0) - ath5k_hw_set_coverage_class(ah, ah->ah_coverage_class); - - /* Set ACK bitrate mode (see ack_rates_high) */ - if (ah->ah_version == AR5K_AR5212) { - u32 val = AR5K_STA_ID1_BASE_RATE_11B | AR5K_STA_ID1_ACKCTS_6MB; - if (ah->ah_ack_bitrate_high) - AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1, val); - else - AR5K_REG_ENABLE_BITS(ah, AR5K_STA_ID1, val); - } - return; -} diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c deleted file mode 100644 index d6bc7cb61bfb..000000000000 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ /dev/null @@ -1,3965 +0,0 @@ -/* - * Copyright (c) 2004-2007 Reyk Floeter - * Copyright (c) 2006-2009 Nick Kossifidis - * Copyright (c) 2007-2008 Jiri Slaby - * Copyright (c) 2008-2009 Felix Fietkau - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/***********************\ -* PHY related functions * -\***********************/ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include - -#include "ath5k.h" -#include "reg.h" -#include "rfbuffer.h" -#include "rfgain.h" -#include "../regd.h" - - -/** - * DOC: PHY related functions - * - * Here we handle the low-level functions related to baseband - * and analog frontend (RF) parts. This is by far the most complex - * part of the hw code so make sure you know what you are doing. - * - * Here is a list of what this is all about: - * - * - Channel setting/switching - * - * - Automatic Gain Control (AGC) calibration - * - * - Noise Floor calibration - * - * - I/Q imbalance calibration (QAM correction) - * - * - Calibration due to thermal changes (gain_F) - * - * - Spur noise mitigation - * - * - RF/PHY initialization for the various operating modes and bwmodes - * - * - Antenna control - * - * - TX power control per channel/rate/packet type - * - * Also have in mind we never got documentation for most of these - * functions, what we have comes mostly from Atheros's code, reverse - * engineering and patent docs/presentations etc. - */ - - -/******************\ -* Helper functions * -\******************/ - -/** - * ath5k_hw_radio_revision() - Get the PHY Chip revision - * @ah: The &struct ath5k_hw - * @band: One of enum ieee80211_band - * - * Returns the revision number of a 2GHz, 5GHz or single chip - * radio. - */ -u16 -ath5k_hw_radio_revision(struct ath5k_hw *ah, enum ieee80211_band band) -{ - unsigned int i; - u32 srev; - u16 ret; - - /* - * Set the radio chip access register - */ - switch (band) { - case IEEE80211_BAND_2GHZ: - ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_2GHZ, AR5K_PHY(0)); - break; - case IEEE80211_BAND_5GHZ: - ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0)); - break; - default: - return 0; - } - - usleep_range(2000, 2500); - - /* ...wait until PHY is ready and read the selected radio revision */ - ath5k_hw_reg_write(ah, 0x00001c16, AR5K_PHY(0x34)); - - for (i = 0; i < 8; i++) - ath5k_hw_reg_write(ah, 0x00010000, AR5K_PHY(0x20)); - - if (ah->ah_version == AR5K_AR5210) { - srev = ath5k_hw_reg_read(ah, AR5K_PHY(256) >> 28) & 0xf; - ret = (u16)ath5k_hw_bitswap(srev, 4) + 1; - } else { - srev = (ath5k_hw_reg_read(ah, AR5K_PHY(0x100)) >> 24) & 0xff; - ret = (u16)ath5k_hw_bitswap(((srev & 0xf0) >> 4) | - ((srev & 0x0f) << 4), 8); - } - - /* Reset to the 5GHz mode */ - ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0)); - - return ret; -} - -/** - * ath5k_channel_ok() - Check if a channel is supported by the hw - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * - * Note: We don't do any regulatory domain checks here, it's just - * a sanity check. - */ -bool -ath5k_channel_ok(struct ath5k_hw *ah, struct ieee80211_channel *channel) -{ - u16 freq = channel->center_freq; - - /* Check if the channel is in our supported range */ - if (channel->band == IEEE80211_BAND_2GHZ) { - if ((freq >= ah->ah_capabilities.cap_range.range_2ghz_min) && - (freq <= ah->ah_capabilities.cap_range.range_2ghz_max)) - return true; - } else if (channel->band == IEEE80211_BAND_5GHZ) - if ((freq >= ah->ah_capabilities.cap_range.range_5ghz_min) && - (freq <= ah->ah_capabilities.cap_range.range_5ghz_max)) - return true; - - return false; -} - -/** - * ath5k_hw_chan_has_spur_noise() - Check if channel is sensitive to spur noise - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - */ -bool -ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - u8 refclk_freq; - - if ((ah->ah_radio == AR5K_RF5112) || - (ah->ah_radio == AR5K_RF5413) || - (ah->ah_radio == AR5K_RF2413) || - (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) - refclk_freq = 40; - else - refclk_freq = 32; - - if ((channel->center_freq % refclk_freq != 0) && - ((channel->center_freq % refclk_freq < 10) || - (channel->center_freq % refclk_freq > 22))) - return true; - else - return false; -} - -/** - * ath5k_hw_rfb_op() - Perform an operation on the given RF Buffer - * @ah: The &struct ath5k_hw - * @rf_regs: The struct ath5k_rf_reg - * @val: New value - * @reg_id: RF register ID - * @set: Indicate we need to swap data - * - * This is an internal function used to modify RF Banks before - * writing them to AR5K_RF_BUFFER. Check out rfbuffer.h for more - * infos. - */ -static unsigned int -ath5k_hw_rfb_op(struct ath5k_hw *ah, const struct ath5k_rf_reg *rf_regs, - u32 val, u8 reg_id, bool set) -{ - const struct ath5k_rf_reg *rfreg = NULL; - u8 offset, bank, num_bits, col, position; - u16 entry; - u32 mask, data, last_bit, bits_shifted, first_bit; - u32 *rfb; - s32 bits_left; - int i; - - data = 0; - rfb = ah->ah_rf_banks; - - for (i = 0; i < ah->ah_rf_regs_count; i++) { - if (rf_regs[i].index == reg_id) { - rfreg = &rf_regs[i]; - break; - } - } - - if (rfb == NULL || rfreg == NULL) { - ATH5K_PRINTF("Rf register not found!\n"); - /* should not happen */ - return 0; - } - - bank = rfreg->bank; - num_bits = rfreg->field.len; - first_bit = rfreg->field.pos; - col = rfreg->field.col; - - /* first_bit is an offset from bank's - * start. Since we have all banks on - * the same array, we use this offset - * to mark each bank's start */ - offset = ah->ah_offset[bank]; - - /* Boundary check */ - if (!(col <= 3 && num_bits <= 32 && first_bit + num_bits <= 319)) { - ATH5K_PRINTF("invalid values at offset %u\n", offset); - return 0; - } - - entry = ((first_bit - 1) / 8) + offset; - position = (first_bit - 1) % 8; - - if (set) - data = ath5k_hw_bitswap(val, num_bits); - - for (bits_shifted = 0, bits_left = num_bits; bits_left > 0; - position = 0, entry++) { - - last_bit = (position + bits_left > 8) ? 8 : - position + bits_left; - - mask = (((1 << last_bit) - 1) ^ ((1 << position) - 1)) << - (col * 8); - - if (set) { - rfb[entry] &= ~mask; - rfb[entry] |= ((data << position) << (col * 8)) & mask; - data >>= (8 - position); - } else { - data |= (((rfb[entry] & mask) >> (col * 8)) >> position) - << bits_shifted; - bits_shifted += last_bit - position; - } - - bits_left -= 8 - position; - } - - data = set ? 1 : ath5k_hw_bitswap(data, num_bits); - - return data; -} - -/** - * ath5k_hw_write_ofdm_timings() - set OFDM timings on AR5212 - * @ah: the &struct ath5k_hw - * @channel: the currently set channel upon reset - * - * Write the delta slope coefficient (used on pilot tracking ?) for OFDM - * operation on the AR5212 upon reset. This is a helper for ath5k_hw_phy_init. - * - * Since delta slope is floating point we split it on its exponent and - * mantissa and provide these values on hw. - * - * For more infos i think this patent is related - * "http://www.freepatentsonline.com/7184495.html" - */ -static inline int -ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - /* Get exponent and mantissa and set it */ - u32 coef_scaled, coef_exp, coef_man, - ds_coef_exp, ds_coef_man, clock; - - BUG_ON(!(ah->ah_version == AR5K_AR5212) || - (channel->hw_value == AR5K_MODE_11B)); - - /* Get coefficient - * ALGO: coef = (5 * clock / carrier_freq) / 2 - * we scale coef by shifting clock value by 24 for - * better precision since we use integers */ - switch (ah->ah_bwmode) { - case AR5K_BWMODE_40MHZ: - clock = 40 * 2; - break; - case AR5K_BWMODE_10MHZ: - clock = 40 / 2; - break; - case AR5K_BWMODE_5MHZ: - clock = 40 / 4; - break; - default: - clock = 40; - break; - } - coef_scaled = ((5 * (clock << 24)) / 2) / channel->center_freq; - - /* Get exponent - * ALGO: coef_exp = 14 - highest set bit position */ - coef_exp = ilog2(coef_scaled); - - /* Doesn't make sense if it's zero*/ - if (!coef_scaled || !coef_exp) - return -EINVAL; - - /* Note: we've shifted coef_scaled by 24 */ - coef_exp = 14 - (coef_exp - 24); - - - /* Get mantissa (significant digits) - * ALGO: coef_mant = floor(coef_scaled* 2^coef_exp+0.5) */ - coef_man = coef_scaled + - (1 << (24 - coef_exp - 1)); - - /* Calculate delta slope coefficient exponent - * and mantissa (remove scaling) and set them on hw */ - ds_coef_man = coef_man >> (24 - coef_exp); - ds_coef_exp = coef_exp - 16; - - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TIMING_3, - AR5K_PHY_TIMING_3_DSC_MAN, ds_coef_man); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TIMING_3, - AR5K_PHY_TIMING_3_DSC_EXP, ds_coef_exp); - - return 0; -} - -/** - * ath5k_hw_phy_disable() - Disable PHY - * @ah: The &struct ath5k_hw - */ -int ath5k_hw_phy_disable(struct ath5k_hw *ah) -{ - /*Just a try M.F.*/ - ath5k_hw_reg_write(ah, AR5K_PHY_ACT_DISABLE, AR5K_PHY_ACT); - - return 0; -} - -/** - * ath5k_hw_wait_for_synth() - Wait for synth to settle - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - */ -static void -ath5k_hw_wait_for_synth(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - /* - * On 5211+ read activation -> rx delay - * and use it (100ns steps). - */ - if (ah->ah_version != AR5K_AR5210) { - u32 delay; - delay = ath5k_hw_reg_read(ah, AR5K_PHY_RX_DELAY) & - AR5K_PHY_RX_DELAY_M; - delay = (channel->hw_value == AR5K_MODE_11B) ? - ((delay << 2) / 22) : (delay / 10); - if (ah->ah_bwmode == AR5K_BWMODE_10MHZ) - delay = delay << 1; - if (ah->ah_bwmode == AR5K_BWMODE_5MHZ) - delay = delay << 2; - /* XXX: /2 on turbo ? Let's be safe - * for now */ - usleep_range(100 + delay, 100 + (2 * delay)); - } else { - usleep_range(1000, 1500); - } -} - - -/**********************\ -* RF Gain optimization * -\**********************/ - -/** - * DOC: RF Gain optimization - * - * This code is used to optimize RF gain on different environments - * (temperature mostly) based on feedback from a power detector. - * - * It's only used on RF5111 and RF5112, later RF chips seem to have - * auto adjustment on hw -notice they have a much smaller BANK 7 and - * no gain optimization ladder-. - * - * For more infos check out this patent doc - * "http://www.freepatentsonline.com/7400691.html" - * - * This paper describes power drops as seen on the receiver due to - * probe packets - * "http://www.cnri.dit.ie/publications/ICT08%20-%20Practical%20Issues - * %20of%20Power%20Control.pdf" - * - * And this is the MadWiFi bug entry related to the above - * "http://madwifi-project.org/ticket/1659" - * with various measurements and diagrams - */ - -/** - * ath5k_hw_rfgain_opt_init() - Initialize ah_gain during attach - * @ah: The &struct ath5k_hw - */ -int ath5k_hw_rfgain_opt_init(struct ath5k_hw *ah) -{ - /* Initialize the gain optimization values */ - switch (ah->ah_radio) { - case AR5K_RF5111: - ah->ah_gain.g_step_idx = rfgain_opt_5111.go_default; - ah->ah_gain.g_low = 20; - ah->ah_gain.g_high = 35; - ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE; - break; - case AR5K_RF5112: - ah->ah_gain.g_step_idx = rfgain_opt_5112.go_default; - ah->ah_gain.g_low = 20; - ah->ah_gain.g_high = 85; - ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE; - break; - default: - return -EINVAL; - } - - return 0; -} - -/** - * ath5k_hw_request_rfgain_probe() - Request a PAPD probe packet - * @ah: The &struct ath5k_hw - * - * Schedules a gain probe check on the next transmitted packet. - * That means our next packet is going to be sent with lower - * tx power and a Peak to Average Power Detector (PAPD) will try - * to measure the gain. - * - * TODO: Force a tx packet (bypassing PCU arbitrator etc) - * just after we enable the probe so that we don't mess with - * standard traffic. - */ -static void -ath5k_hw_request_rfgain_probe(struct ath5k_hw *ah) -{ - - /* Skip if gain calibration is inactive or - * we already handle a probe request */ - if (ah->ah_gain.g_state != AR5K_RFGAIN_ACTIVE) - return; - - /* Send the packet with 2dB below max power as - * patent doc suggest */ - ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txpower.txp_ofdm - 4, - AR5K_PHY_PAPD_PROBE_TXPOWER) | - AR5K_PHY_PAPD_PROBE_TX_NEXT, AR5K_PHY_PAPD_PROBE); - - ah->ah_gain.g_state = AR5K_RFGAIN_READ_REQUESTED; - -} - -/** - * ath5k_hw_rf_gainf_corr() - Calculate Gain_F measurement correction - * @ah: The &struct ath5k_hw - * - * Calculate Gain_F measurement correction - * based on the current step for RF5112 rev. 2 - */ -static u32 -ath5k_hw_rf_gainf_corr(struct ath5k_hw *ah) -{ - u32 mix, step; - u32 *rf; - const struct ath5k_gain_opt *go; - const struct ath5k_gain_opt_step *g_step; - const struct ath5k_rf_reg *rf_regs; - - /* Only RF5112 Rev. 2 supports it */ - if ((ah->ah_radio != AR5K_RF5112) || - (ah->ah_radio_5ghz_revision <= AR5K_SREV_RAD_5112A)) - return 0; - - go = &rfgain_opt_5112; - rf_regs = rf_regs_5112a; - ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5112a); - - g_step = &go->go_step[ah->ah_gain.g_step_idx]; - - if (ah->ah_rf_banks == NULL) - return 0; - - rf = ah->ah_rf_banks; - ah->ah_gain.g_f_corr = 0; - - /* No VGA (Variable Gain Amplifier) override, skip */ - if (ath5k_hw_rfb_op(ah, rf_regs, 0, AR5K_RF_MIXVGA_OVR, false) != 1) - return 0; - - /* Mix gain stepping */ - step = ath5k_hw_rfb_op(ah, rf_regs, 0, AR5K_RF_MIXGAIN_STEP, false); - - /* Mix gain override */ - mix = g_step->gos_param[0]; - - switch (mix) { - case 3: - ah->ah_gain.g_f_corr = step * 2; - break; - case 2: - ah->ah_gain.g_f_corr = (step - 5) * 2; - break; - case 1: - ah->ah_gain.g_f_corr = step; - break; - default: - ah->ah_gain.g_f_corr = 0; - break; - } - - return ah->ah_gain.g_f_corr; -} - -/** - * ath5k_hw_rf_check_gainf_readback() - Validate Gain_F feedback from detector - * @ah: The &struct ath5k_hw - * - * Check if current gain_F measurement is in the range of our - * power detector windows. If we get a measurement outside range - * we know it's not accurate (detectors can't measure anything outside - * their detection window) so we must ignore it. - * - * Returns true if readback was O.K. or false on failure - */ -static bool -ath5k_hw_rf_check_gainf_readback(struct ath5k_hw *ah) -{ - const struct ath5k_rf_reg *rf_regs; - u32 step, mix_ovr, level[4]; - u32 *rf; - - if (ah->ah_rf_banks == NULL) - return false; - - rf = ah->ah_rf_banks; - - if (ah->ah_radio == AR5K_RF5111) { - - rf_regs = rf_regs_5111; - ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5111); - - step = ath5k_hw_rfb_op(ah, rf_regs, 0, AR5K_RF_RFGAIN_STEP, - false); - - level[0] = 0; - level[1] = (step == 63) ? 50 : step + 4; - level[2] = (step != 63) ? 64 : level[0]; - level[3] = level[2] + 50; - - ah->ah_gain.g_high = level[3] - - (step == 63 ? AR5K_GAIN_DYN_ADJUST_HI_MARGIN : -5); - ah->ah_gain.g_low = level[0] + - (step == 63 ? AR5K_GAIN_DYN_ADJUST_LO_MARGIN : 0); - } else { - - rf_regs = rf_regs_5112; - ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5112); - - mix_ovr = ath5k_hw_rfb_op(ah, rf_regs, 0, AR5K_RF_MIXVGA_OVR, - false); - - level[0] = level[2] = 0; - - if (mix_ovr == 1) { - level[1] = level[3] = 83; - } else { - level[1] = level[3] = 107; - ah->ah_gain.g_high = 55; - } - } - - return (ah->ah_gain.g_current >= level[0] && - ah->ah_gain.g_current <= level[1]) || - (ah->ah_gain.g_current >= level[2] && - ah->ah_gain.g_current <= level[3]); -} - -/** - * ath5k_hw_rf_gainf_adjust() - Perform Gain_F adjustment - * @ah: The &struct ath5k_hw - * - * Choose the right target gain based on current gain - * and RF gain optimization ladder - */ -static s8 -ath5k_hw_rf_gainf_adjust(struct ath5k_hw *ah) -{ - const struct ath5k_gain_opt *go; - const struct ath5k_gain_opt_step *g_step; - int ret = 0; - - switch (ah->ah_radio) { - case AR5K_RF5111: - go = &rfgain_opt_5111; - break; - case AR5K_RF5112: - go = &rfgain_opt_5112; - break; - default: - return 0; - } - - g_step = &go->go_step[ah->ah_gain.g_step_idx]; - - if (ah->ah_gain.g_current >= ah->ah_gain.g_high) { - - /* Reached maximum */ - if (ah->ah_gain.g_step_idx == 0) - return -1; - - for (ah->ah_gain.g_target = ah->ah_gain.g_current; - ah->ah_gain.g_target >= ah->ah_gain.g_high && - ah->ah_gain.g_step_idx > 0; - g_step = &go->go_step[ah->ah_gain.g_step_idx]) - ah->ah_gain.g_target -= 2 * - (go->go_step[--(ah->ah_gain.g_step_idx)].gos_gain - - g_step->gos_gain); - - ret = 1; - goto done; - } - - if (ah->ah_gain.g_current <= ah->ah_gain.g_low) { - - /* Reached minimum */ - if (ah->ah_gain.g_step_idx == (go->go_steps_count - 1)) - return -2; - - for (ah->ah_gain.g_target = ah->ah_gain.g_current; - ah->ah_gain.g_target <= ah->ah_gain.g_low && - ah->ah_gain.g_step_idx < go->go_steps_count - 1; - g_step = &go->go_step[ah->ah_gain.g_step_idx]) - ah->ah_gain.g_target -= 2 * - (go->go_step[++ah->ah_gain.g_step_idx].gos_gain - - g_step->gos_gain); - - ret = 2; - goto done; - } - -done: - ATH5K_DBG(ah, ATH5K_DEBUG_CALIBRATE, - "ret %d, gain step %u, current gain %u, target gain %u\n", - ret, ah->ah_gain.g_step_idx, ah->ah_gain.g_current, - ah->ah_gain.g_target); - - return ret; -} - -/** - * ath5k_hw_gainf_calibrate() - Do a gain_F calibration - * @ah: The &struct ath5k_hw - * - * Main callback for thermal RF gain calibration engine - * Check for a new gain reading and schedule an adjustment - * if needed. - * - * Returns one of enum ath5k_rfgain codes - */ -enum ath5k_rfgain -ath5k_hw_gainf_calibrate(struct ath5k_hw *ah) -{ - u32 data, type; - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - - if (ah->ah_rf_banks == NULL || - ah->ah_gain.g_state == AR5K_RFGAIN_INACTIVE) - return AR5K_RFGAIN_INACTIVE; - - /* No check requested, either engine is inactive - * or an adjustment is already requested */ - if (ah->ah_gain.g_state != AR5K_RFGAIN_READ_REQUESTED) - goto done; - - /* Read the PAPD (Peak to Average Power Detector) - * register */ - data = ath5k_hw_reg_read(ah, AR5K_PHY_PAPD_PROBE); - - /* No probe is scheduled, read gain_F measurement */ - if (!(data & AR5K_PHY_PAPD_PROBE_TX_NEXT)) { - ah->ah_gain.g_current = data >> AR5K_PHY_PAPD_PROBE_GAINF_S; - type = AR5K_REG_MS(data, AR5K_PHY_PAPD_PROBE_TYPE); - - /* If tx packet is CCK correct the gain_F measurement - * by cck ofdm gain delta */ - if (type == AR5K_PHY_PAPD_PROBE_TYPE_CCK) { - if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A) - ah->ah_gain.g_current += - ee->ee_cck_ofdm_gain_delta; - else - ah->ah_gain.g_current += - AR5K_GAIN_CCK_PROBE_CORR; - } - - /* Further correct gain_F measurement for - * RF5112A radios */ - if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A) { - ath5k_hw_rf_gainf_corr(ah); - ah->ah_gain.g_current = - ah->ah_gain.g_current >= ah->ah_gain.g_f_corr ? - (ah->ah_gain.g_current - ah->ah_gain.g_f_corr) : - 0; - } - - /* Check if measurement is ok and if we need - * to adjust gain, schedule a gain adjustment, - * else switch back to the active state */ - if (ath5k_hw_rf_check_gainf_readback(ah) && - AR5K_GAIN_CHECK_ADJUST(&ah->ah_gain) && - ath5k_hw_rf_gainf_adjust(ah)) { - ah->ah_gain.g_state = AR5K_RFGAIN_NEED_CHANGE; - } else { - ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE; - } - } - -done: - return ah->ah_gain.g_state; -} - -/** - * ath5k_hw_rfgain_init() - Write initial RF gain settings to hw - * @ah: The &struct ath5k_hw - * @band: One of enum ieee80211_band - * - * Write initial RF gain table to set the RF sensitivity. - * - * NOTE: This one works on all RF chips and has nothing to do - * with Gain_F calibration - */ -static int -ath5k_hw_rfgain_init(struct ath5k_hw *ah, enum ieee80211_band band) -{ - const struct ath5k_ini_rfgain *ath5k_rfg; - unsigned int i, size, index; - - switch (ah->ah_radio) { - case AR5K_RF5111: - ath5k_rfg = rfgain_5111; - size = ARRAY_SIZE(rfgain_5111); - break; - case AR5K_RF5112: - ath5k_rfg = rfgain_5112; - size = ARRAY_SIZE(rfgain_5112); - break; - case AR5K_RF2413: - ath5k_rfg = rfgain_2413; - size = ARRAY_SIZE(rfgain_2413); - break; - case AR5K_RF2316: - ath5k_rfg = rfgain_2316; - size = ARRAY_SIZE(rfgain_2316); - break; - case AR5K_RF5413: - ath5k_rfg = rfgain_5413; - size = ARRAY_SIZE(rfgain_5413); - break; - case AR5K_RF2317: - case AR5K_RF2425: - ath5k_rfg = rfgain_2425; - size = ARRAY_SIZE(rfgain_2425); - break; - default: - return -EINVAL; - } - - index = (band == IEEE80211_BAND_2GHZ) ? 1 : 0; - - for (i = 0; i < size; i++) { - AR5K_REG_WAIT(i); - ath5k_hw_reg_write(ah, ath5k_rfg[i].rfg_value[index], - (u32)ath5k_rfg[i].rfg_register); - } - - return 0; -} - - -/********************\ -* RF Registers setup * -\********************/ - -/** - * ath5k_hw_rfregs_init() - Initialize RF register settings - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * @mode: One of enum ath5k_driver_mode - * - * Setup RF registers by writing RF buffer on hw. For - * more infos on this, check out rfbuffer.h - */ -static int -ath5k_hw_rfregs_init(struct ath5k_hw *ah, - struct ieee80211_channel *channel, - unsigned int mode) -{ - const struct ath5k_rf_reg *rf_regs; - const struct ath5k_ini_rfbuffer *ini_rfb; - const struct ath5k_gain_opt *go = NULL; - const struct ath5k_gain_opt_step *g_step; - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - u8 ee_mode = 0; - u32 *rfb; - int i, obdb = -1, bank = -1; - - switch (ah->ah_radio) { - case AR5K_RF5111: - rf_regs = rf_regs_5111; - ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5111); - ini_rfb = rfb_5111; - ah->ah_rf_banks_size = ARRAY_SIZE(rfb_5111); - go = &rfgain_opt_5111; - break; - case AR5K_RF5112: - if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A) { - rf_regs = rf_regs_5112a; - ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5112a); - ini_rfb = rfb_5112a; - ah->ah_rf_banks_size = ARRAY_SIZE(rfb_5112a); - } else { - rf_regs = rf_regs_5112; - ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5112); - ini_rfb = rfb_5112; - ah->ah_rf_banks_size = ARRAY_SIZE(rfb_5112); - } - go = &rfgain_opt_5112; - break; - case AR5K_RF2413: - rf_regs = rf_regs_2413; - ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_2413); - ini_rfb = rfb_2413; - ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2413); - break; - case AR5K_RF2316: - rf_regs = rf_regs_2316; - ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_2316); - ini_rfb = rfb_2316; - ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2316); - break; - case AR5K_RF5413: - rf_regs = rf_regs_5413; - ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5413); - ini_rfb = rfb_5413; - ah->ah_rf_banks_size = ARRAY_SIZE(rfb_5413); - break; - case AR5K_RF2317: - rf_regs = rf_regs_2425; - ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_2425); - ini_rfb = rfb_2317; - ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2317); - break; - case AR5K_RF2425: - rf_regs = rf_regs_2425; - ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_2425); - if (ah->ah_mac_srev < AR5K_SREV_AR2417) { - ini_rfb = rfb_2425; - ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2425); - } else { - ini_rfb = rfb_2417; - ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2417); - } - break; - default: - return -EINVAL; - } - - /* If it's the first time we set RF buffer, allocate - * ah->ah_rf_banks based on ah->ah_rf_banks_size - * we set above */ - if (ah->ah_rf_banks == NULL) { - ah->ah_rf_banks = kmalloc(sizeof(u32) * ah->ah_rf_banks_size, - GFP_KERNEL); - if (ah->ah_rf_banks == NULL) { - ATH5K_ERR(ah, "out of memory\n"); - return -ENOMEM; - } - } - - /* Copy values to modify them */ - rfb = ah->ah_rf_banks; - - for (i = 0; i < ah->ah_rf_banks_size; i++) { - if (ini_rfb[i].rfb_bank >= AR5K_MAX_RF_BANKS) { - ATH5K_ERR(ah, "invalid bank\n"); - return -EINVAL; - } - - /* Bank changed, write down the offset */ - if (bank != ini_rfb[i].rfb_bank) { - bank = ini_rfb[i].rfb_bank; - ah->ah_offset[bank] = i; - } - - rfb[i] = ini_rfb[i].rfb_mode_data[mode]; - } - - /* Set Output and Driver bias current (OB/DB) */ - if (channel->band == IEEE80211_BAND_2GHZ) { - - if (channel->hw_value == AR5K_MODE_11B) - ee_mode = AR5K_EEPROM_MODE_11B; - else - ee_mode = AR5K_EEPROM_MODE_11G; - - /* For RF511X/RF211X combination we - * use b_OB and b_DB parameters stored - * in eeprom on ee->ee_ob[ee_mode][0] - * - * For all other chips we use OB/DB for 2GHz - * stored in the b/g modal section just like - * 802.11a on ee->ee_ob[ee_mode][1] */ - if ((ah->ah_radio == AR5K_RF5111) || - (ah->ah_radio == AR5K_RF5112)) - obdb = 0; - else - obdb = 1; - - ath5k_hw_rfb_op(ah, rf_regs, ee->ee_ob[ee_mode][obdb], - AR5K_RF_OB_2GHZ, true); - - ath5k_hw_rfb_op(ah, rf_regs, ee->ee_db[ee_mode][obdb], - AR5K_RF_DB_2GHZ, true); - - /* RF5111 always needs OB/DB for 5GHz, even if we use 2GHz */ - } else if ((channel->band == IEEE80211_BAND_5GHZ) || - (ah->ah_radio == AR5K_RF5111)) { - - /* For 11a, Turbo and XR we need to choose - * OB/DB based on frequency range */ - ee_mode = AR5K_EEPROM_MODE_11A; - obdb = channel->center_freq >= 5725 ? 3 : - (channel->center_freq >= 5500 ? 2 : - (channel->center_freq >= 5260 ? 1 : - (channel->center_freq > 4000 ? 0 : -1))); - - if (obdb < 0) - return -EINVAL; - - ath5k_hw_rfb_op(ah, rf_regs, ee->ee_ob[ee_mode][obdb], - AR5K_RF_OB_5GHZ, true); - - ath5k_hw_rfb_op(ah, rf_regs, ee->ee_db[ee_mode][obdb], - AR5K_RF_DB_5GHZ, true); - } - - g_step = &go->go_step[ah->ah_gain.g_step_idx]; - - /* Set turbo mode (N/A on RF5413) */ - if ((ah->ah_bwmode == AR5K_BWMODE_40MHZ) && - (ah->ah_radio != AR5K_RF5413)) - ath5k_hw_rfb_op(ah, rf_regs, 1, AR5K_RF_TURBO, false); - - /* Bank Modifications (chip-specific) */ - if (ah->ah_radio == AR5K_RF5111) { - - /* Set gain_F settings according to current step */ - if (channel->hw_value != AR5K_MODE_11B) { - - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_FRAME_CTL, - AR5K_PHY_FRAME_CTL_TX_CLIP, - g_step->gos_param[0]); - - ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[1], - AR5K_RF_PWD_90, true); - - ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[2], - AR5K_RF_PWD_84, true); - - ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[3], - AR5K_RF_RFGAIN_SEL, true); - - /* We programmed gain_F parameters, switch back - * to active state */ - ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE; - - } - - /* Bank 6/7 setup */ - - ath5k_hw_rfb_op(ah, rf_regs, !ee->ee_xpd[ee_mode], - AR5K_RF_PWD_XPD, true); - - ath5k_hw_rfb_op(ah, rf_regs, ee->ee_x_gain[ee_mode], - AR5K_RF_XPD_GAIN, true); - - ath5k_hw_rfb_op(ah, rf_regs, ee->ee_i_gain[ee_mode], - AR5K_RF_GAIN_I, true); - - ath5k_hw_rfb_op(ah, rf_regs, ee->ee_xpd[ee_mode], - AR5K_RF_PLO_SEL, true); - - /* Tweak power detectors for half/quarter rate support */ - if (ah->ah_bwmode == AR5K_BWMODE_5MHZ || - ah->ah_bwmode == AR5K_BWMODE_10MHZ) { - u8 wait_i; - - ath5k_hw_rfb_op(ah, rf_regs, 0x1f, - AR5K_RF_WAIT_S, true); - - wait_i = (ah->ah_bwmode == AR5K_BWMODE_5MHZ) ? - 0x1f : 0x10; - - ath5k_hw_rfb_op(ah, rf_regs, wait_i, - AR5K_RF_WAIT_I, true); - ath5k_hw_rfb_op(ah, rf_regs, 3, - AR5K_RF_MAX_TIME, true); - - } - } - - if (ah->ah_radio == AR5K_RF5112) { - - /* Set gain_F settings according to current step */ - if (channel->hw_value != AR5K_MODE_11B) { - - ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[0], - AR5K_RF_MIXGAIN_OVR, true); - - ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[1], - AR5K_RF_PWD_138, true); - - ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[2], - AR5K_RF_PWD_137, true); - - ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[3], - AR5K_RF_PWD_136, true); - - ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[4], - AR5K_RF_PWD_132, true); - - ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[5], - AR5K_RF_PWD_131, true); - - ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[6], - AR5K_RF_PWD_130, true); - - /* We programmed gain_F parameters, switch back - * to active state */ - ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE; - } - - /* Bank 6/7 setup */ - - ath5k_hw_rfb_op(ah, rf_regs, ee->ee_xpd[ee_mode], - AR5K_RF_XPD_SEL, true); - - if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112A) { - /* Rev. 1 supports only one xpd */ - ath5k_hw_rfb_op(ah, rf_regs, - ee->ee_x_gain[ee_mode], - AR5K_RF_XPD_GAIN, true); - - } else { - u8 *pdg_curve_to_idx = ee->ee_pdc_to_idx[ee_mode]; - if (ee->ee_pd_gains[ee_mode] > 1) { - ath5k_hw_rfb_op(ah, rf_regs, - pdg_curve_to_idx[0], - AR5K_RF_PD_GAIN_LO, true); - ath5k_hw_rfb_op(ah, rf_regs, - pdg_curve_to_idx[1], - AR5K_RF_PD_GAIN_HI, true); - } else { - ath5k_hw_rfb_op(ah, rf_regs, - pdg_curve_to_idx[0], - AR5K_RF_PD_GAIN_LO, true); - ath5k_hw_rfb_op(ah, rf_regs, - pdg_curve_to_idx[0], - AR5K_RF_PD_GAIN_HI, true); - } - - /* Lower synth voltage on Rev 2 */ - if (ah->ah_radio == AR5K_RF5112 && - (ah->ah_radio_5ghz_revision & AR5K_SREV_REV) > 0) { - ath5k_hw_rfb_op(ah, rf_regs, 2, - AR5K_RF_HIGH_VC_CP, true); - - ath5k_hw_rfb_op(ah, rf_regs, 2, - AR5K_RF_MID_VC_CP, true); - - ath5k_hw_rfb_op(ah, rf_regs, 2, - AR5K_RF_LOW_VC_CP, true); - - ath5k_hw_rfb_op(ah, rf_regs, 2, - AR5K_RF_PUSH_UP, true); - } - - /* Decrease power consumption on 5213+ BaseBand */ - if (ah->ah_phy_revision >= AR5K_SREV_PHY_5212A) { - ath5k_hw_rfb_op(ah, rf_regs, 1, - AR5K_RF_PAD2GND, true); - - ath5k_hw_rfb_op(ah, rf_regs, 1, - AR5K_RF_XB2_LVL, true); - - ath5k_hw_rfb_op(ah, rf_regs, 1, - AR5K_RF_XB5_LVL, true); - - ath5k_hw_rfb_op(ah, rf_regs, 1, - AR5K_RF_PWD_167, true); - - ath5k_hw_rfb_op(ah, rf_regs, 1, - AR5K_RF_PWD_166, true); - } - } - - ath5k_hw_rfb_op(ah, rf_regs, ee->ee_i_gain[ee_mode], - AR5K_RF_GAIN_I, true); - - /* Tweak power detector for half/quarter rates */ - if (ah->ah_bwmode == AR5K_BWMODE_5MHZ || - ah->ah_bwmode == AR5K_BWMODE_10MHZ) { - u8 pd_delay; - - pd_delay = (ah->ah_bwmode == AR5K_BWMODE_5MHZ) ? - 0xf : 0x8; - - ath5k_hw_rfb_op(ah, rf_regs, pd_delay, - AR5K_RF_PD_PERIOD_A, true); - ath5k_hw_rfb_op(ah, rf_regs, 0xf, - AR5K_RF_PD_DELAY_A, true); - - } - } - - if (ah->ah_radio == AR5K_RF5413 && - channel->band == IEEE80211_BAND_2GHZ) { - - ath5k_hw_rfb_op(ah, rf_regs, 1, AR5K_RF_DERBY_CHAN_SEL_MODE, - true); - - /* Set optimum value for early revisions (on pci-e chips) */ - if (ah->ah_mac_srev >= AR5K_SREV_AR5424 && - ah->ah_mac_srev < AR5K_SREV_AR5413) - ath5k_hw_rfb_op(ah, rf_regs, ath5k_hw_bitswap(6, 3), - AR5K_RF_PWD_ICLOBUF_2G, true); - - } - - /* Write RF banks on hw */ - for (i = 0; i < ah->ah_rf_banks_size; i++) { - AR5K_REG_WAIT(i); - ath5k_hw_reg_write(ah, rfb[i], ini_rfb[i].rfb_ctrl_register); - } - - return 0; -} - - -/**************************\ - PHY/RF channel functions -\**************************/ - -/** - * ath5k_hw_rf5110_chan2athchan() - Convert channel freq on RF5110 - * @channel: The &struct ieee80211_channel - * - * Map channel frequency to IEEE channel number and convert it - * to an internal channel value used by the RF5110 chipset. - */ -static u32 -ath5k_hw_rf5110_chan2athchan(struct ieee80211_channel *channel) -{ - u32 athchan; - - athchan = (ath5k_hw_bitswap( - (ieee80211_frequency_to_channel( - channel->center_freq) - 24) / 2, 5) - << 1) | (1 << 6) | 0x1; - return athchan; -} - -/** - * ath5k_hw_rf5110_channel() - Set channel frequency on RF5110 - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - */ -static int -ath5k_hw_rf5110_channel(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - u32 data; - - /* - * Set the channel and wait - */ - data = ath5k_hw_rf5110_chan2athchan(channel); - ath5k_hw_reg_write(ah, data, AR5K_RF_BUFFER); - ath5k_hw_reg_write(ah, 0, AR5K_RF_BUFFER_CONTROL_0); - usleep_range(1000, 1500); - - return 0; -} - -/** - * ath5k_hw_rf5111_chan2athchan() - Handle 2GHz channels on RF5111/2111 - * @ieee: IEEE channel number - * @athchan: The &struct ath5k_athchan_2ghz - * - * In order to enable the RF2111 frequency converter on RF5111/2111 setups - * we need to add some offsets and extra flags to the data values we pass - * on to the PHY. So for every 2GHz channel this function gets called - * to do the conversion. - */ -static int -ath5k_hw_rf5111_chan2athchan(unsigned int ieee, - struct ath5k_athchan_2ghz *athchan) -{ - int channel; - - /* Cast this value to catch negative channel numbers (>= -19) */ - channel = (int)ieee; - - /* - * Map 2GHz IEEE channel to 5GHz Atheros channel - */ - if (channel <= 13) { - athchan->a2_athchan = 115 + channel; - athchan->a2_flags = 0x46; - } else if (channel == 14) { - athchan->a2_athchan = 124; - athchan->a2_flags = 0x44; - } else if (channel >= 15 && channel <= 26) { - athchan->a2_athchan = ((channel - 14) * 4) + 132; - athchan->a2_flags = 0x46; - } else - return -EINVAL; - - return 0; -} - -/** - * ath5k_hw_rf5111_channel() - Set channel frequency on RF5111/2111 - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - */ -static int -ath5k_hw_rf5111_channel(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - struct ath5k_athchan_2ghz ath5k_channel_2ghz; - unsigned int ath5k_channel = - ieee80211_frequency_to_channel(channel->center_freq); - u32 data0, data1, clock; - int ret; - - /* - * Set the channel on the RF5111 radio - */ - data0 = data1 = 0; - - if (channel->band == IEEE80211_BAND_2GHZ) { - /* Map 2GHz channel to 5GHz Atheros channel ID */ - ret = ath5k_hw_rf5111_chan2athchan( - ieee80211_frequency_to_channel(channel->center_freq), - &ath5k_channel_2ghz); - if (ret) - return ret; - - ath5k_channel = ath5k_channel_2ghz.a2_athchan; - data0 = ((ath5k_hw_bitswap(ath5k_channel_2ghz.a2_flags, 8) & 0xff) - << 5) | (1 << 4); - } - - if (ath5k_channel < 145 || !(ath5k_channel & 1)) { - clock = 1; - data1 = ((ath5k_hw_bitswap(ath5k_channel - 24, 8) & 0xff) << 2) | - (clock << 1) | (1 << 10) | 1; - } else { - clock = 0; - data1 = ((ath5k_hw_bitswap((ath5k_channel - 24) / 2, 8) & 0xff) - << 2) | (clock << 1) | (1 << 10) | 1; - } - - ath5k_hw_reg_write(ah, (data1 & 0xff) | ((data0 & 0xff) << 8), - AR5K_RF_BUFFER); - ath5k_hw_reg_write(ah, ((data1 >> 8) & 0xff) | (data0 & 0xff00), - AR5K_RF_BUFFER_CONTROL_3); - - return 0; -} - -/** - * ath5k_hw_rf5112_channel() - Set channel frequency on 5112 and newer - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * - * On RF5112/2112 and newer we don't need to do any conversion. - * We pass the frequency value after a few modifications to the - * chip directly. - * - * NOTE: Make sure channel frequency given is within our range or else - * we might damage the chip ! Use ath5k_channel_ok before calling this one. - */ -static int -ath5k_hw_rf5112_channel(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - u32 data, data0, data1, data2; - u16 c; - - data = data0 = data1 = data2 = 0; - c = channel->center_freq; - - /* My guess based on code: - * 2GHz RF has 2 synth modes, one with a Local Oscillator - * at 2224Hz and one with a LO at 2192Hz. IF is 1520Hz - * (3040/2). data0 is used to set the PLL divider and data1 - * selects synth mode. */ - if (c < 4800) { - /* Channel 14 and all frequencies with 2Hz spacing - * below/above (non-standard channels) */ - if (!((c - 2224) % 5)) { - /* Same as (c - 2224) / 5 */ - data0 = ((2 * (c - 704)) - 3040) / 10; - data1 = 1; - /* Channel 1 and all frequencies with 5Hz spacing - * below/above (standard channels without channel 14) */ - } else if (!((c - 2192) % 5)) { - /* Same as (c - 2192) / 5 */ - data0 = ((2 * (c - 672)) - 3040) / 10; - data1 = 0; - } else - return -EINVAL; - - data0 = ath5k_hw_bitswap((data0 << 2) & 0xff, 8); - /* This is more complex, we have a single synthesizer with - * 4 reference clock settings (?) based on frequency spacing - * and set using data2. LO is at 4800Hz and data0 is again used - * to set some divider. - * - * NOTE: There is an old atheros presentation at Stanford - * that mentions a method called dual direct conversion - * with 1GHz sliding IF for RF5110. Maybe that's what we - * have here, or an updated version. */ - } else if ((c % 5) != 2 || c > 5435) { - if (!(c % 20) && c >= 5120) { - data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8); - data2 = ath5k_hw_bitswap(3, 2); - } else if (!(c % 10)) { - data0 = ath5k_hw_bitswap(((c - 4800) / 10 << 1), 8); - data2 = ath5k_hw_bitswap(2, 2); - } else if (!(c % 5)) { - data0 = ath5k_hw_bitswap((c - 4800) / 5, 8); - data2 = ath5k_hw_bitswap(1, 2); - } else - return -EINVAL; - } else { - data0 = ath5k_hw_bitswap((10 * (c - 2 - 4800)) / 25 + 1, 8); - data2 = ath5k_hw_bitswap(0, 2); - } - - data = (data0 << 4) | (data1 << 1) | (data2 << 2) | 0x1001; - - ath5k_hw_reg_write(ah, data & 0xff, AR5K_RF_BUFFER); - ath5k_hw_reg_write(ah, (data >> 8) & 0x7f, AR5K_RF_BUFFER_CONTROL_5); - - return 0; -} - -/** - * ath5k_hw_rf2425_channel() - Set channel frequency on RF2425 - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * - * AR2425/2417 have a different 2GHz RF so code changes - * a little bit from RF5112. - */ -static int -ath5k_hw_rf2425_channel(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - u32 data, data0, data2; - u16 c; - - data = data0 = data2 = 0; - c = channel->center_freq; - - if (c < 4800) { - data0 = ath5k_hw_bitswap((c - 2272), 8); - data2 = 0; - /* ? 5GHz ? */ - } else if ((c % 5) != 2 || c > 5435) { - if (!(c % 20) && c < 5120) - data0 = ath5k_hw_bitswap(((c - 4800) / 20 << 2), 8); - else if (!(c % 10)) - data0 = ath5k_hw_bitswap(((c - 4800) / 10 << 1), 8); - else if (!(c % 5)) - data0 = ath5k_hw_bitswap((c - 4800) / 5, 8); - else - return -EINVAL; - data2 = ath5k_hw_bitswap(1, 2); - } else { - data0 = ath5k_hw_bitswap((10 * (c - 2 - 4800)) / 25 + 1, 8); - data2 = ath5k_hw_bitswap(0, 2); - } - - data = (data0 << 4) | data2 << 2 | 0x1001; - - ath5k_hw_reg_write(ah, data & 0xff, AR5K_RF_BUFFER); - ath5k_hw_reg_write(ah, (data >> 8) & 0x7f, AR5K_RF_BUFFER_CONTROL_5); - - return 0; -} - -/** - * ath5k_hw_channel() - Set a channel on the radio chip - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * - * This is the main function called to set a channel on the - * radio chip based on the radio chip version. - */ -static int -ath5k_hw_channel(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - int ret; - /* - * Check bounds supported by the PHY (we don't care about regulatory - * restrictions at this point). - */ - if (!ath5k_channel_ok(ah, channel)) { - ATH5K_ERR(ah, - "channel frequency (%u MHz) out of supported " - "band range\n", - channel->center_freq); - return -EINVAL; - } - - /* - * Set the channel and wait - */ - switch (ah->ah_radio) { - case AR5K_RF5110: - ret = ath5k_hw_rf5110_channel(ah, channel); - break; - case AR5K_RF5111: - ret = ath5k_hw_rf5111_channel(ah, channel); - break; - case AR5K_RF2317: - case AR5K_RF2425: - ret = ath5k_hw_rf2425_channel(ah, channel); - break; - default: - ret = ath5k_hw_rf5112_channel(ah, channel); - break; - } - - if (ret) - return ret; - - /* Set JAPAN setting for channel 14 */ - if (channel->center_freq == 2484) { - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_CCKTXCTL, - AR5K_PHY_CCKTXCTL_JAPAN); - } else { - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_CCKTXCTL, - AR5K_PHY_CCKTXCTL_WORLD); - } - - ah->ah_current_channel = channel; - - return 0; -} - - -/*****************\ - PHY calibration -\*****************/ - -/** - * DOC: PHY Calibration routines - * - * Noise floor calibration: When we tell the hardware to - * perform a noise floor calibration by setting the - * AR5K_PHY_AGCCTL_NF bit on AR5K_PHY_AGCCTL, it will periodically - * sample-and-hold the minimum noise level seen at the antennas. - * This value is then stored in a ring buffer of recently measured - * noise floor values so we have a moving window of the last few - * samples. The median of the values in the history is then loaded - * into the hardware for its own use for RSSI and CCA measurements. - * This type of calibration doesn't interfere with traffic. - * - * AGC calibration: When we tell the hardware to perform - * an AGC (Automatic Gain Control) calibration by setting the - * AR5K_PHY_AGCCTL_CAL, hw disconnects the antennas and does - * a calibration on the DC offsets of ADCs. During this period - * rx/tx gets disabled so we have to deal with it on the driver - * part. - * - * I/Q calibration: When we tell the hardware to perform - * an I/Q calibration, it tries to correct I/Q imbalance and - * fix QAM constellation by sampling data from rxed frames. - * It doesn't interfere with traffic. - * - * For more infos on AGC and I/Q calibration check out patent doc - * #03/094463. - */ - -/** - * ath5k_hw_read_measured_noise_floor() - Read measured NF from hw - * @ah: The &struct ath5k_hw - */ -static s32 -ath5k_hw_read_measured_noise_floor(struct ath5k_hw *ah) -{ - s32 val; - - val = ath5k_hw_reg_read(ah, AR5K_PHY_NF); - return sign_extend32(AR5K_REG_MS(val, AR5K_PHY_NF_MINCCA_PWR), 8); -} - -/** - * ath5k_hw_init_nfcal_hist() - Initialize NF calibration history buffer - * @ah: The &struct ath5k_hw - */ -void -ath5k_hw_init_nfcal_hist(struct ath5k_hw *ah) -{ - int i; - - ah->ah_nfcal_hist.index = 0; - for (i = 0; i < ATH5K_NF_CAL_HIST_MAX; i++) - ah->ah_nfcal_hist.nfval[i] = AR5K_TUNE_CCA_MAX_GOOD_VALUE; -} - -/** - * ath5k_hw_update_nfcal_hist() - Update NF calibration history buffer - * @ah: The &struct ath5k_hw - * @noise_floor: The NF we got from hw - */ -static void ath5k_hw_update_nfcal_hist(struct ath5k_hw *ah, s16 noise_floor) -{ - struct ath5k_nfcal_hist *hist = &ah->ah_nfcal_hist; - hist->index = (hist->index + 1) & (ATH5K_NF_CAL_HIST_MAX - 1); - hist->nfval[hist->index] = noise_floor; -} - -/** - * ath5k_hw_get_median_noise_floor() - Get median NF from history buffer - * @ah: The &struct ath5k_hw - */ -static s16 -ath5k_hw_get_median_noise_floor(struct ath5k_hw *ah) -{ - s16 sort[ATH5K_NF_CAL_HIST_MAX]; - s16 tmp; - int i, j; - - memcpy(sort, ah->ah_nfcal_hist.nfval, sizeof(sort)); - for (i = 0; i < ATH5K_NF_CAL_HIST_MAX - 1; i++) { - for (j = 1; j < ATH5K_NF_CAL_HIST_MAX - i; j++) { - if (sort[j] > sort[j - 1]) { - tmp = sort[j]; - sort[j] = sort[j - 1]; - sort[j - 1] = tmp; - } - } - } - for (i = 0; i < ATH5K_NF_CAL_HIST_MAX; i++) { - ATH5K_DBG(ah, ATH5K_DEBUG_CALIBRATE, - "cal %d:%d\n", i, sort[i]); - } - return sort[(ATH5K_NF_CAL_HIST_MAX - 1) / 2]; -} - -/** - * ath5k_hw_update_noise_floor() - Update NF on hardware - * @ah: The &struct ath5k_hw - * - * This is the main function we call to perform a NF calibration, - * it reads NF from hardware, calculates the median and updates - * NF on hw. - */ -void -ath5k_hw_update_noise_floor(struct ath5k_hw *ah) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - u32 val; - s16 nf, threshold; - u8 ee_mode; - - /* keep last value if calibration hasn't completed */ - if (ath5k_hw_reg_read(ah, AR5K_PHY_AGCCTL) & AR5K_PHY_AGCCTL_NF) { - ATH5K_DBG(ah, ATH5K_DEBUG_CALIBRATE, - "NF did not complete in calibration window\n"); - - return; - } - - ah->ah_cal_mask |= AR5K_CALIBRATION_NF; - - ee_mode = ath5k_eeprom_mode_from_channel(ah, ah->ah_current_channel); - - /* completed NF calibration, test threshold */ - nf = ath5k_hw_read_measured_noise_floor(ah); - threshold = ee->ee_noise_floor_thr[ee_mode]; - - if (nf > threshold) { - ATH5K_DBG(ah, ATH5K_DEBUG_CALIBRATE, - "noise floor failure detected; " - "read %d, threshold %d\n", - nf, threshold); - - nf = AR5K_TUNE_CCA_MAX_GOOD_VALUE; - } - - ath5k_hw_update_nfcal_hist(ah, nf); - nf = ath5k_hw_get_median_noise_floor(ah); - - /* load noise floor (in .5 dBm) so the hardware will use it */ - val = ath5k_hw_reg_read(ah, AR5K_PHY_NF) & ~AR5K_PHY_NF_M; - val |= (nf * 2) & AR5K_PHY_NF_M; - ath5k_hw_reg_write(ah, val, AR5K_PHY_NF); - - AR5K_REG_MASKED_BITS(ah, AR5K_PHY_AGCCTL, AR5K_PHY_AGCCTL_NF, - ~(AR5K_PHY_AGCCTL_NF_EN | AR5K_PHY_AGCCTL_NF_NOUPDATE)); - - ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL, AR5K_PHY_AGCCTL_NF, - 0, false); - - /* - * Load a high max CCA Power value (-50 dBm in .5 dBm units) - * so that we're not capped by the median we just loaded. - * This will be used as the initial value for the next noise - * floor calibration. - */ - val = (val & ~AR5K_PHY_NF_M) | ((-50 * 2) & AR5K_PHY_NF_M); - ath5k_hw_reg_write(ah, val, AR5K_PHY_NF); - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL, - AR5K_PHY_AGCCTL_NF_EN | - AR5K_PHY_AGCCTL_NF_NOUPDATE | - AR5K_PHY_AGCCTL_NF); - - ah->ah_noise_floor = nf; - - ah->ah_cal_mask &= ~AR5K_CALIBRATION_NF; - - ATH5K_DBG(ah, ATH5K_DEBUG_CALIBRATE, - "noise floor calibrated: %d\n", nf); -} - -/** - * ath5k_hw_rf5110_calibrate() - Perform a PHY calibration on RF5110 - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * - * Do a complete PHY calibration (AGC + NF + I/Q) on RF5110 - */ -static int -ath5k_hw_rf5110_calibrate(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - u32 phy_sig, phy_agc, phy_sat, beacon; - int ret; - - if (!(ah->ah_cal_mask & AR5K_CALIBRATION_FULL)) - return 0; - - /* - * Disable beacons and RX/TX queues, wait - */ - AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW_5210, - AR5K_DIAG_SW_DIS_TX_5210 | AR5K_DIAG_SW_DIS_RX_5210); - beacon = ath5k_hw_reg_read(ah, AR5K_BEACON_5210); - ath5k_hw_reg_write(ah, beacon & ~AR5K_BEACON_ENABLE, AR5K_BEACON_5210); - - usleep_range(2000, 2500); - - /* - * Set the channel (with AGC turned off) - */ - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGC, AR5K_PHY_AGC_DISABLE); - udelay(10); - ret = ath5k_hw_channel(ah, channel); - - /* - * Activate PHY and wait - */ - ath5k_hw_reg_write(ah, AR5K_PHY_ACT_ENABLE, AR5K_PHY_ACT); - usleep_range(1000, 1500); - - AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_AGC, AR5K_PHY_AGC_DISABLE); - - if (ret) - return ret; - - /* - * Calibrate the radio chip - */ - - /* Remember normal state */ - phy_sig = ath5k_hw_reg_read(ah, AR5K_PHY_SIG); - phy_agc = ath5k_hw_reg_read(ah, AR5K_PHY_AGCCOARSE); - phy_sat = ath5k_hw_reg_read(ah, AR5K_PHY_ADCSAT); - - /* Update radio registers */ - ath5k_hw_reg_write(ah, (phy_sig & ~(AR5K_PHY_SIG_FIRPWR)) | - AR5K_REG_SM(-1, AR5K_PHY_SIG_FIRPWR), AR5K_PHY_SIG); - - ath5k_hw_reg_write(ah, (phy_agc & ~(AR5K_PHY_AGCCOARSE_HI | - AR5K_PHY_AGCCOARSE_LO)) | - AR5K_REG_SM(-1, AR5K_PHY_AGCCOARSE_HI) | - AR5K_REG_SM(-127, AR5K_PHY_AGCCOARSE_LO), AR5K_PHY_AGCCOARSE); - - ath5k_hw_reg_write(ah, (phy_sat & ~(AR5K_PHY_ADCSAT_ICNT | - AR5K_PHY_ADCSAT_THR)) | - AR5K_REG_SM(2, AR5K_PHY_ADCSAT_ICNT) | - AR5K_REG_SM(12, AR5K_PHY_ADCSAT_THR), AR5K_PHY_ADCSAT); - - udelay(20); - - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGC, AR5K_PHY_AGC_DISABLE); - udelay(10); - ath5k_hw_reg_write(ah, AR5K_PHY_RFSTG_DISABLE, AR5K_PHY_RFSTG); - AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_AGC, AR5K_PHY_AGC_DISABLE); - - usleep_range(1000, 1500); - - /* - * Enable calibration and wait until completion - */ - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL, AR5K_PHY_AGCCTL_CAL); - - ret = ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL, - AR5K_PHY_AGCCTL_CAL, 0, false); - - /* Reset to normal state */ - ath5k_hw_reg_write(ah, phy_sig, AR5K_PHY_SIG); - ath5k_hw_reg_write(ah, phy_agc, AR5K_PHY_AGCCOARSE); - ath5k_hw_reg_write(ah, phy_sat, AR5K_PHY_ADCSAT); - - if (ret) { - ATH5K_ERR(ah, "calibration timeout (%uMHz)\n", - channel->center_freq); - return ret; - } - - /* - * Re-enable RX/TX and beacons - */ - AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW_5210, - AR5K_DIAG_SW_DIS_TX_5210 | AR5K_DIAG_SW_DIS_RX_5210); - ath5k_hw_reg_write(ah, beacon, AR5K_BEACON_5210); - - return 0; -} - -/** - * ath5k_hw_rf511x_iq_calibrate() - Perform I/Q calibration on RF5111 and newer - * @ah: The &struct ath5k_hw - */ -static int -ath5k_hw_rf511x_iq_calibrate(struct ath5k_hw *ah) -{ - u32 i_pwr, q_pwr; - s32 iq_corr, i_coff, i_coffd, q_coff, q_coffd; - int i; - - /* Skip if I/Q calibration is not needed or if it's still running */ - if (!ah->ah_iq_cal_needed) - return -EINVAL; - else if (ath5k_hw_reg_read(ah, AR5K_PHY_IQ) & AR5K_PHY_IQ_RUN) { - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_CALIBRATE, - "I/Q calibration still running"); - return -EBUSY; - } - - /* Calibration has finished, get the results and re-run */ - - /* Work around for empty results which can apparently happen on 5212: - * Read registers up to 10 times until we get both i_pr and q_pwr */ - for (i = 0; i <= 10; i++) { - iq_corr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_CORR); - i_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_I); - q_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_Q); - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_CALIBRATE, - "iq_corr:%x i_pwr:%x q_pwr:%x", iq_corr, i_pwr, q_pwr); - if (i_pwr && q_pwr) - break; - } - - i_coffd = ((i_pwr >> 1) + (q_pwr >> 1)) >> 7; - - if (ah->ah_version == AR5K_AR5211) - q_coffd = q_pwr >> 6; - else - q_coffd = q_pwr >> 7; - - /* In case i_coffd became zero, cancel calibration - * not only it's too small, it'll also result a divide - * by zero later on. */ - if (i_coffd == 0 || q_coffd < 2) - return -ECANCELED; - - /* Protect against loss of sign bits */ - - i_coff = (-iq_corr) / i_coffd; - i_coff = clamp(i_coff, -32, 31); /* signed 6 bit */ - - if (ah->ah_version == AR5K_AR5211) - q_coff = (i_pwr / q_coffd) - 64; - else - q_coff = (i_pwr / q_coffd) - 128; - q_coff = clamp(q_coff, -16, 15); /* signed 5 bit */ - - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_CALIBRATE, - "new I:%d Q:%d (i_coffd:%x q_coffd:%x)", - i_coff, q_coff, i_coffd, q_coffd); - - /* Commit new I/Q values (set enable bit last to match HAL sources) */ - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_Q_I_COFF, i_coff); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_Q_Q_COFF, q_coff); - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_ENABLE); - - /* Re-enable calibration -if we don't we'll commit - * the same values again and again */ - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, - AR5K_PHY_IQ_CAL_NUM_LOG_MAX, 15); - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_RUN); - - return 0; -} - -/** - * ath5k_hw_phy_calibrate() - Perform a PHY calibration - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * - * The main function we call from above to perform - * a short or full PHY calibration based on RF chip - * and current channel - */ -int -ath5k_hw_phy_calibrate(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - int ret; - - if (ah->ah_radio == AR5K_RF5110) - return ath5k_hw_rf5110_calibrate(ah, channel); - - ret = ath5k_hw_rf511x_iq_calibrate(ah); - if (ret) { - ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_CALIBRATE, - "No I/Q correction performed (%uMHz)\n", - channel->center_freq); - - /* Happens all the time if there is not much - * traffic, consider it normal behaviour. */ - ret = 0; - } - - /* On full calibration request a PAPD probe for - * gainf calibration if needed */ - if ((ah->ah_cal_mask & AR5K_CALIBRATION_FULL) && - (ah->ah_radio == AR5K_RF5111 || - ah->ah_radio == AR5K_RF5112) && - channel->hw_value != AR5K_MODE_11B) - ath5k_hw_request_rfgain_probe(ah); - - /* Update noise floor */ - if (!(ah->ah_cal_mask & AR5K_CALIBRATION_NF)) - ath5k_hw_update_noise_floor(ah); - - return ret; -} - - -/***************************\ -* Spur mitigation functions * -\***************************/ - -/** - * ath5k_hw_set_spur_mitigation_filter() - Configure SPUR filter - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * - * This function gets called during PHY initialization to - * configure the spur filter for the given channel. Spur is noise - * generated due to "reflection" effects, for more information on this - * method check out patent US7643810 - */ -static void -ath5k_hw_set_spur_mitigation_filter(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - u32 mag_mask[4] = {0, 0, 0, 0}; - u32 pilot_mask[2] = {0, 0}; - /* Note: fbin values are scaled up by 2 */ - u16 spur_chan_fbin, chan_fbin, symbol_width, spur_detection_window; - s32 spur_delta_phase, spur_freq_sigma_delta; - s32 spur_offset, num_symbols_x16; - u8 num_symbol_offsets, i, freq_band; - - /* Convert current frequency to fbin value (the same way channels - * are stored on EEPROM, check out ath5k_eeprom_bin2freq) and scale - * up by 2 so we can compare it later */ - if (channel->band == IEEE80211_BAND_2GHZ) { - chan_fbin = (channel->center_freq - 2300) * 10; - freq_band = AR5K_EEPROM_BAND_2GHZ; - } else { - chan_fbin = (channel->center_freq - 4900) * 10; - freq_band = AR5K_EEPROM_BAND_5GHZ; - } - - /* Check if any spur_chan_fbin from EEPROM is - * within our current channel's spur detection range */ - spur_chan_fbin = AR5K_EEPROM_NO_SPUR; - spur_detection_window = AR5K_SPUR_CHAN_WIDTH; - /* XXX: Half/Quarter channels ?*/ - if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) - spur_detection_window *= 2; - - for (i = 0; i < AR5K_EEPROM_N_SPUR_CHANS; i++) { - spur_chan_fbin = ee->ee_spur_chans[i][freq_band]; - - /* Note: mask cleans AR5K_EEPROM_NO_SPUR flag - * so it's zero if we got nothing from EEPROM */ - if (spur_chan_fbin == AR5K_EEPROM_NO_SPUR) { - spur_chan_fbin &= AR5K_EEPROM_SPUR_CHAN_MASK; - break; - } - - if ((chan_fbin - spur_detection_window <= - (spur_chan_fbin & AR5K_EEPROM_SPUR_CHAN_MASK)) && - (chan_fbin + spur_detection_window >= - (spur_chan_fbin & AR5K_EEPROM_SPUR_CHAN_MASK))) { - spur_chan_fbin &= AR5K_EEPROM_SPUR_CHAN_MASK; - break; - } - } - - /* We need to enable spur filter for this channel */ - if (spur_chan_fbin) { - spur_offset = spur_chan_fbin - chan_fbin; - /* - * Calculate deltas: - * spur_freq_sigma_delta -> spur_offset / sample_freq << 21 - * spur_delta_phase -> spur_offset / chip_freq << 11 - * Note: Both values have 100Hz resolution - */ - switch (ah->ah_bwmode) { - case AR5K_BWMODE_40MHZ: - /* Both sample_freq and chip_freq are 80MHz */ - spur_delta_phase = (spur_offset << 16) / 25; - spur_freq_sigma_delta = (spur_delta_phase >> 10); - symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz * 2; - break; - case AR5K_BWMODE_10MHZ: - /* Both sample_freq and chip_freq are 20MHz (?) */ - spur_delta_phase = (spur_offset << 18) / 25; - spur_freq_sigma_delta = (spur_delta_phase >> 10); - symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz / 2; - break; - case AR5K_BWMODE_5MHZ: - /* Both sample_freq and chip_freq are 10MHz (?) */ - spur_delta_phase = (spur_offset << 19) / 25; - spur_freq_sigma_delta = (spur_delta_phase >> 10); - symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz / 4; - break; - default: - if (channel->band == IEEE80211_BAND_5GHZ) { - /* Both sample_freq and chip_freq are 40MHz */ - spur_delta_phase = (spur_offset << 17) / 25; - spur_freq_sigma_delta = - (spur_delta_phase >> 10); - symbol_width = - AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz; - } else { - /* sample_freq -> 40MHz chip_freq -> 44MHz - * (for b compatibility) */ - spur_delta_phase = (spur_offset << 17) / 25; - spur_freq_sigma_delta = - (spur_offset << 8) / 55; - symbol_width = - AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz; - } - break; - } - - /* Calculate pilot and magnitude masks */ - - /* Scale up spur_offset by 1000 to switch to 100HZ resolution - * and divide by symbol_width to find how many symbols we have - * Note: number of symbols is scaled up by 16 */ - num_symbols_x16 = ((spur_offset * 1000) << 4) / symbol_width; - - /* Spur is on a symbol if num_symbols_x16 % 16 is zero */ - if (!(num_symbols_x16 & 0xF)) - /* _X_ */ - num_symbol_offsets = 3; - else - /* _xx_ */ - num_symbol_offsets = 4; - - for (i = 0; i < num_symbol_offsets; i++) { - - /* Calculate pilot mask */ - s32 curr_sym_off = - (num_symbols_x16 / 16) + i + 25; - - /* Pilot magnitude mask seems to be a way to - * declare the boundaries for our detection - * window or something, it's 2 for the middle - * value(s) where the symbol is expected to be - * and 1 on the boundary values */ - u8 plt_mag_map = - (i == 0 || i == (num_symbol_offsets - 1)) - ? 1 : 2; - - if (curr_sym_off >= 0 && curr_sym_off <= 32) { - if (curr_sym_off <= 25) - pilot_mask[0] |= 1 << curr_sym_off; - else if (curr_sym_off >= 27) - pilot_mask[0] |= 1 << (curr_sym_off - 1); - } else if (curr_sym_off >= 33 && curr_sym_off <= 52) - pilot_mask[1] |= 1 << (curr_sym_off - 33); - - /* Calculate magnitude mask (for viterbi decoder) */ - if (curr_sym_off >= -1 && curr_sym_off <= 14) - mag_mask[0] |= - plt_mag_map << (curr_sym_off + 1) * 2; - else if (curr_sym_off >= 15 && curr_sym_off <= 30) - mag_mask[1] |= - plt_mag_map << (curr_sym_off - 15) * 2; - else if (curr_sym_off >= 31 && curr_sym_off <= 46) - mag_mask[2] |= - plt_mag_map << (curr_sym_off - 31) * 2; - else if (curr_sym_off >= 47 && curr_sym_off <= 53) - mag_mask[3] |= - plt_mag_map << (curr_sym_off - 47) * 2; - - } - - /* Write settings on hw to enable spur filter */ - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_BIN_MASK_CTL, - AR5K_PHY_BIN_MASK_CTL_RATE, 0xff); - /* XXX: Self correlator also ? */ - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, - AR5K_PHY_IQ_PILOT_MASK_EN | - AR5K_PHY_IQ_CHAN_MASK_EN | - AR5K_PHY_IQ_SPUR_FILT_EN); - - /* Set delta phase and freq sigma delta */ - ath5k_hw_reg_write(ah, - AR5K_REG_SM(spur_delta_phase, - AR5K_PHY_TIMING_11_SPUR_DELTA_PHASE) | - AR5K_REG_SM(spur_freq_sigma_delta, - AR5K_PHY_TIMING_11_SPUR_FREQ_SD) | - AR5K_PHY_TIMING_11_USE_SPUR_IN_AGC, - AR5K_PHY_TIMING_11); - - /* Write pilot masks */ - ath5k_hw_reg_write(ah, pilot_mask[0], AR5K_PHY_TIMING_7); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TIMING_8, - AR5K_PHY_TIMING_8_PILOT_MASK_2, - pilot_mask[1]); - - ath5k_hw_reg_write(ah, pilot_mask[0], AR5K_PHY_TIMING_9); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TIMING_10, - AR5K_PHY_TIMING_10_PILOT_MASK_2, - pilot_mask[1]); - - /* Write magnitude masks */ - ath5k_hw_reg_write(ah, mag_mask[0], AR5K_PHY_BIN_MASK_1); - ath5k_hw_reg_write(ah, mag_mask[1], AR5K_PHY_BIN_MASK_2); - ath5k_hw_reg_write(ah, mag_mask[2], AR5K_PHY_BIN_MASK_3); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_BIN_MASK_CTL, - AR5K_PHY_BIN_MASK_CTL_MASK_4, - mag_mask[3]); - - ath5k_hw_reg_write(ah, mag_mask[0], AR5K_PHY_BIN_MASK2_1); - ath5k_hw_reg_write(ah, mag_mask[1], AR5K_PHY_BIN_MASK2_2); - ath5k_hw_reg_write(ah, mag_mask[2], AR5K_PHY_BIN_MASK2_3); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_BIN_MASK2_4, - AR5K_PHY_BIN_MASK2_4_MASK_4, - mag_mask[3]); - - } else if (ath5k_hw_reg_read(ah, AR5K_PHY_IQ) & - AR5K_PHY_IQ_SPUR_FILT_EN) { - /* Clean up spur mitigation settings and disable filter */ - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_BIN_MASK_CTL, - AR5K_PHY_BIN_MASK_CTL_RATE, 0); - AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_IQ, - AR5K_PHY_IQ_PILOT_MASK_EN | - AR5K_PHY_IQ_CHAN_MASK_EN | - AR5K_PHY_IQ_SPUR_FILT_EN); - ath5k_hw_reg_write(ah, 0, AR5K_PHY_TIMING_11); - - /* Clear pilot masks */ - ath5k_hw_reg_write(ah, 0, AR5K_PHY_TIMING_7); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TIMING_8, - AR5K_PHY_TIMING_8_PILOT_MASK_2, - 0); - - ath5k_hw_reg_write(ah, 0, AR5K_PHY_TIMING_9); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TIMING_10, - AR5K_PHY_TIMING_10_PILOT_MASK_2, - 0); - - /* Clear magnitude masks */ - ath5k_hw_reg_write(ah, 0, AR5K_PHY_BIN_MASK_1); - ath5k_hw_reg_write(ah, 0, AR5K_PHY_BIN_MASK_2); - ath5k_hw_reg_write(ah, 0, AR5K_PHY_BIN_MASK_3); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_BIN_MASK_CTL, - AR5K_PHY_BIN_MASK_CTL_MASK_4, - 0); - - ath5k_hw_reg_write(ah, 0, AR5K_PHY_BIN_MASK2_1); - ath5k_hw_reg_write(ah, 0, AR5K_PHY_BIN_MASK2_2); - ath5k_hw_reg_write(ah, 0, AR5K_PHY_BIN_MASK2_3); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_BIN_MASK2_4, - AR5K_PHY_BIN_MASK2_4_MASK_4, - 0); - } -} - - -/*****************\ -* Antenna control * -\*****************/ - -/** - * DOC: Antenna control - * - * Hw supports up to 14 antennas ! I haven't found any card that implements - * that. The maximum number of antennas I've seen is up to 4 (2 for 2GHz and 2 - * for 5GHz). Antenna 1 (MAIN) should be omnidirectional, 2 (AUX) - * omnidirectional or sectorial and antennas 3-14 sectorial (or directional). - * - * We can have a single antenna for RX and multiple antennas for TX. - * RX antenna is our "default" antenna (usually antenna 1) set on - * DEFAULT_ANTENNA register and TX antenna is set on each TX control descriptor - * (0 for automatic selection, 1 - 14 antenna number). - * - * We can let hw do all the work doing fast antenna diversity for both - * tx and rx or we can do things manually. Here are the options we have - * (all are bits of STA_ID1 register): - * - * AR5K_STA_ID1_DEFAULT_ANTENNA -> When 0 is set as the TX antenna on TX - * control descriptor, use the default antenna to transmit or else use the last - * antenna on which we received an ACK. - * - * AR5K_STA_ID1_DESC_ANTENNA -> Update default antenna after each TX frame to - * the antenna on which we got the ACK for that frame. - * - * AR5K_STA_ID1_RTS_DEF_ANTENNA -> Use default antenna for RTS or else use the - * one on the TX descriptor. - * - * AR5K_STA_ID1_SELFGEN_DEF_ANT -> Use default antenna for self generated frames - * (ACKs etc), or else use current antenna (the one we just used for TX). - * - * Using the above we support the following scenarios: - * - * AR5K_ANTMODE_DEFAULT -> Hw handles antenna diversity etc automatically - * - * AR5K_ANTMODE_FIXED_A -> Only antenna A (MAIN) is present - * - * AR5K_ANTMODE_FIXED_B -> Only antenna B (AUX) is present - * - * AR5K_ANTMODE_SINGLE_AP -> Sta locked on a single ap - * - * AR5K_ANTMODE_SECTOR_AP -> AP with tx antenna set on tx desc - * - * AR5K_ANTMODE_SECTOR_STA -> STA with tx antenna set on tx desc - * - * AR5K_ANTMODE_DEBUG Debug mode -A -> Rx, B-> Tx- - * - * Also note that when setting antenna to F on tx descriptor card inverts - * current tx antenna. - */ - -/** - * ath5k_hw_set_def_antenna() - Set default rx antenna on AR5211/5212 and newer - * @ah: The &struct ath5k_hw - * @ant: Antenna number - */ -static void -ath5k_hw_set_def_antenna(struct ath5k_hw *ah, u8 ant) -{ - if (ah->ah_version != AR5K_AR5210) - ath5k_hw_reg_write(ah, ant & 0x7, AR5K_DEFAULT_ANTENNA); -} - -/** - * ath5k_hw_set_fast_div() - Enable/disable fast rx antenna diversity - * @ah: The &struct ath5k_hw - * @ee_mode: One of enum ath5k_driver_mode - * @enable: True to enable, false to disable - */ -static void -ath5k_hw_set_fast_div(struct ath5k_hw *ah, u8 ee_mode, bool enable) -{ - switch (ee_mode) { - case AR5K_EEPROM_MODE_11G: - /* XXX: This is set to - * disabled on initvals !!! */ - case AR5K_EEPROM_MODE_11A: - if (enable) - AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_AGCCTL, - AR5K_PHY_AGCCTL_OFDM_DIV_DIS); - else - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL, - AR5K_PHY_AGCCTL_OFDM_DIV_DIS); - break; - case AR5K_EEPROM_MODE_11B: - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL, - AR5K_PHY_AGCCTL_OFDM_DIV_DIS); - break; - default: - return; - } - - if (enable) { - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_RESTART, - AR5K_PHY_RESTART_DIV_GC, 4); - - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_FAST_ANT_DIV, - AR5K_PHY_FAST_ANT_DIV_EN); - } else { - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_RESTART, - AR5K_PHY_RESTART_DIV_GC, 0); - - AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_FAST_ANT_DIV, - AR5K_PHY_FAST_ANT_DIV_EN); - } -} - -/** - * ath5k_hw_set_antenna_switch() - Set up antenna switch table - * @ah: The &struct ath5k_hw - * @ee_mode: One of enum ath5k_driver_mode - * - * Switch table comes from EEPROM and includes information on controlling - * the 2 antenna RX attenuators - */ -void -ath5k_hw_set_antenna_switch(struct ath5k_hw *ah, u8 ee_mode) -{ - u8 ant0, ant1; - - /* - * In case a fixed antenna was set as default - * use the same switch table twice. - */ - if (ah->ah_ant_mode == AR5K_ANTMODE_FIXED_A) - ant0 = ant1 = AR5K_ANT_SWTABLE_A; - else if (ah->ah_ant_mode == AR5K_ANTMODE_FIXED_B) - ant0 = ant1 = AR5K_ANT_SWTABLE_B; - else { - ant0 = AR5K_ANT_SWTABLE_A; - ant1 = AR5K_ANT_SWTABLE_B; - } - - /* Set antenna idle switch table */ - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_ANT_CTL, - AR5K_PHY_ANT_CTL_SWTABLE_IDLE, - (ah->ah_ant_ctl[ee_mode][AR5K_ANT_CTL] | - AR5K_PHY_ANT_CTL_TXRX_EN)); - - /* Set antenna switch tables */ - ath5k_hw_reg_write(ah, ah->ah_ant_ctl[ee_mode][ant0], - AR5K_PHY_ANT_SWITCH_TABLE_0); - ath5k_hw_reg_write(ah, ah->ah_ant_ctl[ee_mode][ant1], - AR5K_PHY_ANT_SWITCH_TABLE_1); -} - -/** - * ath5k_hw_set_antenna_mode() - Set antenna operating mode - * @ah: The &struct ath5k_hw - * @ant_mode: One of enum ath5k_ant_mode - */ -void -ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode) -{ - struct ieee80211_channel *channel = ah->ah_current_channel; - bool use_def_for_tx, update_def_on_tx, use_def_for_rts, fast_div; - bool use_def_for_sg; - int ee_mode; - u8 def_ant, tx_ant; - u32 sta_id1 = 0; - - /* if channel is not initialized yet we can't set the antennas - * so just store the mode. it will be set on the next reset */ - if (channel == NULL) { - ah->ah_ant_mode = ant_mode; - return; - } - - def_ant = ah->ah_def_ant; - - ee_mode = ath5k_eeprom_mode_from_channel(ah, channel); - - switch (ant_mode) { - case AR5K_ANTMODE_DEFAULT: - tx_ant = 0; - use_def_for_tx = false; - update_def_on_tx = false; - use_def_for_rts = false; - use_def_for_sg = false; - fast_div = true; - break; - case AR5K_ANTMODE_FIXED_A: - def_ant = 1; - tx_ant = 1; - use_def_for_tx = true; - update_def_on_tx = false; - use_def_for_rts = true; - use_def_for_sg = true; - fast_div = false; - break; - case AR5K_ANTMODE_FIXED_B: - def_ant = 2; - tx_ant = 2; - use_def_for_tx = true; - update_def_on_tx = false; - use_def_for_rts = true; - use_def_for_sg = true; - fast_div = false; - break; - case AR5K_ANTMODE_SINGLE_AP: - def_ant = 1; /* updated on tx */ - tx_ant = 0; - use_def_for_tx = true; - update_def_on_tx = true; - use_def_for_rts = true; - use_def_for_sg = true; - fast_div = true; - break; - case AR5K_ANTMODE_SECTOR_AP: - tx_ant = 1; /* variable */ - use_def_for_tx = false; - update_def_on_tx = false; - use_def_for_rts = true; - use_def_for_sg = false; - fast_div = false; - break; - case AR5K_ANTMODE_SECTOR_STA: - tx_ant = 1; /* variable */ - use_def_for_tx = true; - update_def_on_tx = false; - use_def_for_rts = true; - use_def_for_sg = false; - fast_div = true; - break; - case AR5K_ANTMODE_DEBUG: - def_ant = 1; - tx_ant = 2; - use_def_for_tx = false; - update_def_on_tx = false; - use_def_for_rts = false; - use_def_for_sg = false; - fast_div = false; - break; - default: - return; - } - - ah->ah_tx_ant = tx_ant; - ah->ah_ant_mode = ant_mode; - ah->ah_def_ant = def_ant; - - sta_id1 |= use_def_for_tx ? AR5K_STA_ID1_DEFAULT_ANTENNA : 0; - sta_id1 |= update_def_on_tx ? AR5K_STA_ID1_DESC_ANTENNA : 0; - sta_id1 |= use_def_for_rts ? AR5K_STA_ID1_RTS_DEF_ANTENNA : 0; - sta_id1 |= use_def_for_sg ? AR5K_STA_ID1_SELFGEN_DEF_ANT : 0; - - AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1, AR5K_STA_ID1_ANTENNA_SETTINGS); - - if (sta_id1) - AR5K_REG_ENABLE_BITS(ah, AR5K_STA_ID1, sta_id1); - - ath5k_hw_set_antenna_switch(ah, ee_mode); - /* Note: set diversity before default antenna - * because it won't work correctly */ - ath5k_hw_set_fast_div(ah, ee_mode, fast_div); - ath5k_hw_set_def_antenna(ah, def_ant); -} - - -/****************\ -* TX power setup * -\****************/ - -/* - * Helper functions - */ - -/** - * ath5k_get_interpolated_value() - Get interpolated Y val between two points - * @target: X value of the middle point - * @x_left: X value of the left point - * @x_right: X value of the right point - * @y_left: Y value of the left point - * @y_right: Y value of the right point - */ -static s16 -ath5k_get_interpolated_value(s16 target, s16 x_left, s16 x_right, - s16 y_left, s16 y_right) -{ - s16 ratio, result; - - /* Avoid divide by zero and skip interpolation - * if we have the same point */ - if ((x_left == x_right) || (y_left == y_right)) - return y_left; - - /* - * Since we use ints and not fps, we need to scale up in - * order to get a sane ratio value (or else we 'll eg. get - * always 1 instead of 1.25, 1.75 etc). We scale up by 100 - * to have some accuracy both for 0.5 and 0.25 steps. - */ - ratio = ((100 * y_right - 100 * y_left) / (x_right - x_left)); - - /* Now scale down to be in range */ - result = y_left + (ratio * (target - x_left) / 100); - - return result; -} - -/** - * ath5k_get_linear_pcdac_min() - Find vertical boundary (min pwr) for the - * linear PCDAC curve - * @stepL: Left array with y values (pcdac steps) - * @stepR: Right array with y values (pcdac steps) - * @pwrL: Left array with x values (power steps) - * @pwrR: Right array with x values (power steps) - * - * Since we have the top of the curve and we draw the line below - * until we reach 1 (1 pcdac step) we need to know which point - * (x value) that is so that we don't go below x axis and have negative - * pcdac values when creating the curve, or fill the table with zeros. - */ -static s16 -ath5k_get_linear_pcdac_min(const u8 *stepL, const u8 *stepR, - const s16 *pwrL, const s16 *pwrR) -{ - s8 tmp; - s16 min_pwrL, min_pwrR; - s16 pwr_i; - - /* Some vendors write the same pcdac value twice !!! */ - if (stepL[0] == stepL[1] || stepR[0] == stepR[1]) - return max(pwrL[0], pwrR[0]); - - if (pwrL[0] == pwrL[1]) - min_pwrL = pwrL[0]; - else { - pwr_i = pwrL[0]; - do { - pwr_i--; - tmp = (s8) ath5k_get_interpolated_value(pwr_i, - pwrL[0], pwrL[1], - stepL[0], stepL[1]); - } while (tmp > 1); - - min_pwrL = pwr_i; - } - - if (pwrR[0] == pwrR[1]) - min_pwrR = pwrR[0]; - else { - pwr_i = pwrR[0]; - do { - pwr_i--; - tmp = (s8) ath5k_get_interpolated_value(pwr_i, - pwrR[0], pwrR[1], - stepR[0], stepR[1]); - } while (tmp > 1); - - min_pwrR = pwr_i; - } - - /* Keep the right boundary so that it works for both curves */ - return max(min_pwrL, min_pwrR); -} - -/** - * ath5k_create_power_curve() - Create a Power to PDADC or PCDAC curve - * @pmin: Minimum power value (xmin) - * @pmax: Maximum power value (xmax) - * @pwr: Array of power steps (x values) - * @vpd: Array of matching PCDAC/PDADC steps (y values) - * @num_points: Number of provided points - * @vpd_table: Array to fill with the full PCDAC/PDADC values (y values) - * @type: One of enum ath5k_powertable_type (eeprom.h) - * - * Interpolate (pwr,vpd) points to create a Power to PDADC or a - * Power to PCDAC curve. - * - * Each curve has power on x axis (in 0.5dB units) and PCDAC/PDADC - * steps (offsets) on y axis. Power can go up to 31.5dB and max - * PCDAC/PDADC step for each curve is 64 but we can write more than - * one curves on hw so we can go up to 128 (which is the max step we - * can write on the final table). - * - * We write y values (PCDAC/PDADC steps) on hw. - */ -static void -ath5k_create_power_curve(s16 pmin, s16 pmax, - const s16 *pwr, const u8 *vpd, - u8 num_points, - u8 *vpd_table, u8 type) -{ - u8 idx[2] = { 0, 1 }; - s16 pwr_i = 2 * pmin; - int i; - - if (num_points < 2) - return; - - /* We want the whole line, so adjust boundaries - * to cover the entire power range. Note that - * power values are already 0.25dB so no need - * to multiply pwr_i by 2 */ - if (type == AR5K_PWRTABLE_LINEAR_PCDAC) { - pwr_i = pmin; - pmin = 0; - pmax = 63; - } - - /* Find surrounding turning points (TPs) - * and interpolate between them */ - for (i = 0; (i <= (u16) (pmax - pmin)) && - (i < AR5K_EEPROM_POWER_TABLE_SIZE); i++) { - - /* We passed the right TP, move to the next set of TPs - * if we pass the last TP, extrapolate above using the last - * two TPs for ratio */ - if ((pwr_i > pwr[idx[1]]) && (idx[1] < num_points - 1)) { - idx[0]++; - idx[1]++; - } - - vpd_table[i] = (u8) ath5k_get_interpolated_value(pwr_i, - pwr[idx[0]], pwr[idx[1]], - vpd[idx[0]], vpd[idx[1]]); - - /* Increase by 0.5dB - * (0.25 dB units) */ - pwr_i += 2; - } -} - -/** - * ath5k_get_chan_pcal_surrounding_piers() - Get surrounding calibration piers - * for a given channel. - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * @pcinfo_l: The &struct ath5k_chan_pcal_info to put the left cal. pier - * @pcinfo_r: The &struct ath5k_chan_pcal_info to put the right cal. pier - * - * Get the surrounding per-channel power calibration piers - * for a given frequency so that we can interpolate between - * them and come up with an appropriate dataset for our current - * channel. - */ -static void -ath5k_get_chan_pcal_surrounding_piers(struct ath5k_hw *ah, - struct ieee80211_channel *channel, - struct ath5k_chan_pcal_info **pcinfo_l, - struct ath5k_chan_pcal_info **pcinfo_r) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - struct ath5k_chan_pcal_info *pcinfo; - u8 idx_l, idx_r; - u8 mode, max, i; - u32 target = channel->center_freq; - - idx_l = 0; - idx_r = 0; - - switch (channel->hw_value) { - case AR5K_EEPROM_MODE_11A: - pcinfo = ee->ee_pwr_cal_a; - mode = AR5K_EEPROM_MODE_11A; - break; - case AR5K_EEPROM_MODE_11B: - pcinfo = ee->ee_pwr_cal_b; - mode = AR5K_EEPROM_MODE_11B; - break; - case AR5K_EEPROM_MODE_11G: - default: - pcinfo = ee->ee_pwr_cal_g; - mode = AR5K_EEPROM_MODE_11G; - break; - } - max = ee->ee_n_piers[mode] - 1; - - /* Frequency is below our calibrated - * range. Use the lowest power curve - * we have */ - if (target < pcinfo[0].freq) { - idx_l = idx_r = 0; - goto done; - } - - /* Frequency is above our calibrated - * range. Use the highest power curve - * we have */ - if (target > pcinfo[max].freq) { - idx_l = idx_r = max; - goto done; - } - - /* Frequency is inside our calibrated - * channel range. Pick the surrounding - * calibration piers so that we can - * interpolate */ - for (i = 0; i <= max; i++) { - - /* Frequency matches one of our calibration - * piers, no need to interpolate, just use - * that calibration pier */ - if (pcinfo[i].freq == target) { - idx_l = idx_r = i; - goto done; - } - - /* We found a calibration pier that's above - * frequency, use this pier and the previous - * one to interpolate */ - if (target < pcinfo[i].freq) { - idx_r = i; - idx_l = idx_r - 1; - goto done; - } - } - -done: - *pcinfo_l = &pcinfo[idx_l]; - *pcinfo_r = &pcinfo[idx_r]; -} - -/** - * ath5k_get_rate_pcal_data() - Get the interpolated per-rate power - * calibration data - * @ah: The &struct ath5k_hw *ah, - * @channel: The &struct ieee80211_channel - * @rates: The &struct ath5k_rate_pcal_info to fill - * - * Get the surrounding per-rate power calibration data - * for a given frequency and interpolate between power - * values to set max target power supported by hw for - * each rate on this frequency. - */ -static void -ath5k_get_rate_pcal_data(struct ath5k_hw *ah, - struct ieee80211_channel *channel, - struct ath5k_rate_pcal_info *rates) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - struct ath5k_rate_pcal_info *rpinfo; - u8 idx_l, idx_r; - u8 mode, max, i; - u32 target = channel->center_freq; - - idx_l = 0; - idx_r = 0; - - switch (channel->hw_value) { - case AR5K_MODE_11A: - rpinfo = ee->ee_rate_tpwr_a; - mode = AR5K_EEPROM_MODE_11A; - break; - case AR5K_MODE_11B: - rpinfo = ee->ee_rate_tpwr_b; - mode = AR5K_EEPROM_MODE_11B; - break; - case AR5K_MODE_11G: - default: - rpinfo = ee->ee_rate_tpwr_g; - mode = AR5K_EEPROM_MODE_11G; - break; - } - max = ee->ee_rate_target_pwr_num[mode] - 1; - - /* Get the surrounding calibration - * piers - same as above */ - if (target < rpinfo[0].freq) { - idx_l = idx_r = 0; - goto done; - } - - if (target > rpinfo[max].freq) { - idx_l = idx_r = max; - goto done; - } - - for (i = 0; i <= max; i++) { - - if (rpinfo[i].freq == target) { - idx_l = idx_r = i; - goto done; - } - - if (target < rpinfo[i].freq) { - idx_r = i; - idx_l = idx_r - 1; - goto done; - } - } - -done: - /* Now interpolate power value, based on the frequency */ - rates->freq = target; - - rates->target_power_6to24 = - ath5k_get_interpolated_value(target, rpinfo[idx_l].freq, - rpinfo[idx_r].freq, - rpinfo[idx_l].target_power_6to24, - rpinfo[idx_r].target_power_6to24); - - rates->target_power_36 = - ath5k_get_interpolated_value(target, rpinfo[idx_l].freq, - rpinfo[idx_r].freq, - rpinfo[idx_l].target_power_36, - rpinfo[idx_r].target_power_36); - - rates->target_power_48 = - ath5k_get_interpolated_value(target, rpinfo[idx_l].freq, - rpinfo[idx_r].freq, - rpinfo[idx_l].target_power_48, - rpinfo[idx_r].target_power_48); - - rates->target_power_54 = - ath5k_get_interpolated_value(target, rpinfo[idx_l].freq, - rpinfo[idx_r].freq, - rpinfo[idx_l].target_power_54, - rpinfo[idx_r].target_power_54); -} - -/** - * ath5k_get_max_ctl_power() - Get max edge power for a given frequency - * @ah: the &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * - * Get the max edge power for this channel if - * we have such data from EEPROM's Conformance Test - * Limits (CTL), and limit max power if needed. - */ -static void -ath5k_get_max_ctl_power(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah); - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - struct ath5k_edge_power *rep = ee->ee_ctl_pwr; - u8 *ctl_val = ee->ee_ctl; - s16 max_chan_pwr = ah->ah_txpower.txp_max_pwr / 4; - s16 edge_pwr = 0; - u8 rep_idx; - u8 i, ctl_mode; - u8 ctl_idx = 0xFF; - u32 target = channel->center_freq; - - ctl_mode = ath_regd_get_band_ctl(regulatory, channel->band); - - switch (channel->hw_value) { - case AR5K_MODE_11A: - if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) - ctl_mode |= AR5K_CTL_TURBO; - else - ctl_mode |= AR5K_CTL_11A; - break; - case AR5K_MODE_11G: - if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) - ctl_mode |= AR5K_CTL_TURBOG; - else - ctl_mode |= AR5K_CTL_11G; - break; - case AR5K_MODE_11B: - ctl_mode |= AR5K_CTL_11B; - break; - default: - return; - } - - for (i = 0; i < ee->ee_ctls; i++) { - if (ctl_val[i] == ctl_mode) { - ctl_idx = i; - break; - } - } - - /* If we have a CTL dataset available grab it and find the - * edge power for our frequency */ - if (ctl_idx == 0xFF) - return; - - /* Edge powers are sorted by frequency from lower - * to higher. Each CTL corresponds to 8 edge power - * measurements. */ - rep_idx = ctl_idx * AR5K_EEPROM_N_EDGES; - - /* Don't do boundaries check because we - * might have more that one bands defined - * for this mode */ - - /* Get the edge power that's closer to our - * frequency */ - for (i = 0; i < AR5K_EEPROM_N_EDGES; i++) { - rep_idx += i; - if (target <= rep[rep_idx].freq) - edge_pwr = (s16) rep[rep_idx].edge; - } - - if (edge_pwr) - ah->ah_txpower.txp_max_pwr = 4 * min(edge_pwr, max_chan_pwr); -} - - -/* - * Power to PCDAC table functions - */ - -/** - * DOC: Power to PCDAC table functions - * - * For RF5111 we have an XPD -eXternal Power Detector- curve - * for each calibrated channel. Each curve has 0,5dB Power steps - * on x axis and PCDAC steps (offsets) on y axis and looks like an - * exponential function. To recreate the curve we read 11 points - * from eeprom (eeprom.c) and interpolate here. - * - * For RF5112 we have 4 XPD -eXternal Power Detector- curves - * for each calibrated channel on 0, -6, -12 and -18dBm but we only - * use the higher (3) and the lower (0) curves. Each curve again has 0.5dB - * power steps on x axis and PCDAC steps on y axis and looks like a - * linear function. To recreate the curve and pass the power values - * on hw, we get 4 points for xpd 0 (lower gain -> max power) - * and 3 points for xpd 3 (higher gain -> lower power) from eeprom (eeprom.c) - * and interpolate here. - * - * For a given channel we get the calibrated points (piers) for it or - * -if we don't have calibration data for this specific channel- from the - * available surrounding channels we have calibration data for, after we do a - * linear interpolation between them. Then since we have our calibrated points - * for this channel, we do again a linear interpolation between them to get the - * whole curve. - * - * We finally write the Y values of the curve(s) (the PCDAC values) on hw - */ - -/** - * ath5k_fill_pwr_to_pcdac_table() - Fill Power to PCDAC table on RF5111 - * @ah: The &struct ath5k_hw - * @table_min: Minimum power (x min) - * @table_max: Maximum power (x max) - * - * No further processing is needed for RF5111, the only thing we have to - * do is fill the values below and above calibration range since eeprom data - * may not cover the entire PCDAC table. - */ -static void -ath5k_fill_pwr_to_pcdac_table(struct ath5k_hw *ah, s16* table_min, - s16 *table_max) -{ - u8 *pcdac_out = ah->ah_txpower.txp_pd_table; - u8 *pcdac_tmp = ah->ah_txpower.tmpL[0]; - u8 pcdac_0, pcdac_n, pcdac_i, pwr_idx, i; - s16 min_pwr, max_pwr; - - /* Get table boundaries */ - min_pwr = table_min[0]; - pcdac_0 = pcdac_tmp[0]; - - max_pwr = table_max[0]; - pcdac_n = pcdac_tmp[table_max[0] - table_min[0]]; - - /* Extrapolate below minimum using pcdac_0 */ - pcdac_i = 0; - for (i = 0; i < min_pwr; i++) - pcdac_out[pcdac_i++] = pcdac_0; - - /* Copy values from pcdac_tmp */ - pwr_idx = min_pwr; - for (i = 0; pwr_idx <= max_pwr && - pcdac_i < AR5K_EEPROM_POWER_TABLE_SIZE; i++) { - pcdac_out[pcdac_i++] = pcdac_tmp[i]; - pwr_idx++; - } - - /* Extrapolate above maximum */ - while (pcdac_i < AR5K_EEPROM_POWER_TABLE_SIZE) - pcdac_out[pcdac_i++] = pcdac_n; - -} - -/** - * ath5k_combine_linear_pcdac_curves() - Combine available PCDAC Curves - * @ah: The &struct ath5k_hw - * @table_min: Minimum power (x min) - * @table_max: Maximum power (x max) - * @pdcurves: Number of pd curves - * - * Combine available XPD Curves and fill Linear Power to PCDAC table on RF5112 - * RFX112 can have up to 2 curves (one for low txpower range and one for - * higher txpower range). We need to put them both on pcdac_out and place - * them in the correct location. In case we only have one curve available - * just fit it on pcdac_out (it's supposed to cover the entire range of - * available pwr levels since it's always the higher power curve). Extrapolate - * below and above final table if needed. - */ -static void -ath5k_combine_linear_pcdac_curves(struct ath5k_hw *ah, s16* table_min, - s16 *table_max, u8 pdcurves) -{ - u8 *pcdac_out = ah->ah_txpower.txp_pd_table; - u8 *pcdac_low_pwr; - u8 *pcdac_high_pwr; - u8 *pcdac_tmp; - u8 pwr; - s16 max_pwr_idx; - s16 min_pwr_idx; - s16 mid_pwr_idx = 0; - /* Edge flag turns on the 7nth bit on the PCDAC - * to declare the higher power curve (force values - * to be greater than 64). If we only have one curve - * we don't need to set this, if we have 2 curves and - * fill the table backwards this can also be used to - * switch from higher power curve to lower power curve */ - u8 edge_flag; - int i; - - /* When we have only one curve available - * that's the higher power curve. If we have - * two curves the first is the high power curve - * and the next is the low power curve. */ - if (pdcurves > 1) { - pcdac_low_pwr = ah->ah_txpower.tmpL[1]; - pcdac_high_pwr = ah->ah_txpower.tmpL[0]; - mid_pwr_idx = table_max[1] - table_min[1] - 1; - max_pwr_idx = (table_max[0] - table_min[0]) / 2; - - /* If table size goes beyond 31.5dB, keep the - * upper 31.5dB range when setting tx power. - * Note: 126 = 31.5 dB in quarter dB steps */ - if (table_max[0] - table_min[1] > 126) - min_pwr_idx = table_max[0] - 126; - else - min_pwr_idx = table_min[1]; - - /* Since we fill table backwards - * start from high power curve */ - pcdac_tmp = pcdac_high_pwr; - - edge_flag = 0x40; - } else { - pcdac_low_pwr = ah->ah_txpower.tmpL[1]; /* Zeroed */ - pcdac_high_pwr = ah->ah_txpower.tmpL[0]; - min_pwr_idx = table_min[0]; - max_pwr_idx = (table_max[0] - table_min[0]) / 2; - pcdac_tmp = pcdac_high_pwr; - edge_flag = 0; - } - - /* This is used when setting tx power*/ - ah->ah_txpower.txp_min_idx = min_pwr_idx / 2; - - /* Fill Power to PCDAC table backwards */ - pwr = max_pwr_idx; - for (i = 63; i >= 0; i--) { - /* Entering lower power range, reset - * edge flag and set pcdac_tmp to lower - * power curve.*/ - if (edge_flag == 0x40 && - (2 * pwr <= (table_max[1] - table_min[0]) || pwr == 0)) { - edge_flag = 0x00; - pcdac_tmp = pcdac_low_pwr; - pwr = mid_pwr_idx / 2; - } - - /* Don't go below 1, extrapolate below if we have - * already switched to the lower power curve -or - * we only have one curve and edge_flag is zero - * anyway */ - if (pcdac_tmp[pwr] < 1 && (edge_flag == 0x00)) { - while (i >= 0) { - pcdac_out[i] = pcdac_out[i + 1]; - i--; - } - break; - } - - pcdac_out[i] = pcdac_tmp[pwr] | edge_flag; - - /* Extrapolate above if pcdac is greater than - * 126 -this can happen because we OR pcdac_out - * value with edge_flag on high power curve */ - if (pcdac_out[i] > 126) - pcdac_out[i] = 126; - - /* Decrease by a 0.5dB step */ - pwr--; - } -} - -/** - * ath5k_write_pcdac_table() - Write the PCDAC values on hw - * @ah: The &struct ath5k_hw - */ -static void -ath5k_write_pcdac_table(struct ath5k_hw *ah) -{ - u8 *pcdac_out = ah->ah_txpower.txp_pd_table; - int i; - - /* - * Write TX power values - */ - for (i = 0; i < (AR5K_EEPROM_POWER_TABLE_SIZE / 2); i++) { - ath5k_hw_reg_write(ah, - (((pcdac_out[2 * i + 0] << 8 | 0xff) & 0xffff) << 0) | - (((pcdac_out[2 * i + 1] << 8 | 0xff) & 0xffff) << 16), - AR5K_PHY_PCDAC_TXPOWER(i)); - } -} - - -/* - * Power to PDADC table functions - */ - -/** - * DOC: Power to PDADC table functions - * - * For RF2413 and later we have a Power to PDADC table (Power Detector) - * instead of a PCDAC (Power Control) and 4 pd gain curves for each - * calibrated channel. Each curve has power on x axis in 0.5 db steps and - * PDADC steps on y axis and looks like an exponential function like the - * RF5111 curve. - * - * To recreate the curves we read the points from eeprom (eeprom.c) - * and interpolate here. Note that in most cases only 2 (higher and lower) - * curves are used (like RF5112) but vendors have the opportunity to include - * all 4 curves on eeprom. The final curve (higher power) has an extra - * point for better accuracy like RF5112. - * - * The process is similar to what we do above for RF5111/5112 - */ - -/** - * ath5k_combine_pwr_to_pdadc_curves() - Combine the various PDADC curves - * @ah: The &struct ath5k_hw - * @pwr_min: Minimum power (x min) - * @pwr_max: Maximum power (x max) - * @pdcurves: Number of available curves - * - * Combine the various pd curves and create the final Power to PDADC table - * We can have up to 4 pd curves, we need to do a similar process - * as we do for RF5112. This time we don't have an edge_flag but we - * set the gain boundaries on a separate register. - */ -static void -ath5k_combine_pwr_to_pdadc_curves(struct ath5k_hw *ah, - s16 *pwr_min, s16 *pwr_max, u8 pdcurves) -{ - u8 gain_boundaries[AR5K_EEPROM_N_PD_GAINS]; - u8 *pdadc_out = ah->ah_txpower.txp_pd_table; - u8 *pdadc_tmp; - s16 pdadc_0; - u8 pdadc_i, pdadc_n, pwr_step, pdg, max_idx, table_size; - u8 pd_gain_overlap; - - /* Note: Register value is initialized on initvals - * there is no feedback from hw. - * XXX: What about pd_gain_overlap from EEPROM ? */ - pd_gain_overlap = (u8) ath5k_hw_reg_read(ah, AR5K_PHY_TPC_RG5) & - AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP; - - /* Create final PDADC table */ - for (pdg = 0, pdadc_i = 0; pdg < pdcurves; pdg++) { - pdadc_tmp = ah->ah_txpower.tmpL[pdg]; - - if (pdg == pdcurves - 1) - /* 2 dB boundary stretch for last - * (higher power) curve */ - gain_boundaries[pdg] = pwr_max[pdg] + 4; - else - /* Set gain boundary in the middle - * between this curve and the next one */ - gain_boundaries[pdg] = - (pwr_max[pdg] + pwr_min[pdg + 1]) / 2; - - /* Sanity check in case our 2 db stretch got out of - * range. */ - if (gain_boundaries[pdg] > AR5K_TUNE_MAX_TXPOWER) - gain_boundaries[pdg] = AR5K_TUNE_MAX_TXPOWER; - - /* For the first curve (lower power) - * start from 0 dB */ - if (pdg == 0) - pdadc_0 = 0; - else - /* For the other curves use the gain overlap */ - pdadc_0 = (gain_boundaries[pdg - 1] - pwr_min[pdg]) - - pd_gain_overlap; - - /* Force each power step to be at least 0.5 dB */ - if ((pdadc_tmp[1] - pdadc_tmp[0]) > 1) - pwr_step = pdadc_tmp[1] - pdadc_tmp[0]; - else - pwr_step = 1; - - /* If pdadc_0 is negative, we need to extrapolate - * below this pdgain by a number of pwr_steps */ - while ((pdadc_0 < 0) && (pdadc_i < 128)) { - s16 tmp = pdadc_tmp[0] + pdadc_0 * pwr_step; - pdadc_out[pdadc_i++] = (tmp < 0) ? 0 : (u8) tmp; - pdadc_0++; - } - - /* Set last pwr level, using gain boundaries */ - pdadc_n = gain_boundaries[pdg] + pd_gain_overlap - pwr_min[pdg]; - /* Limit it to be inside pwr range */ - table_size = pwr_max[pdg] - pwr_min[pdg]; - max_idx = (pdadc_n < table_size) ? pdadc_n : table_size; - - /* Fill pdadc_out table */ - while (pdadc_0 < max_idx && pdadc_i < 128) - pdadc_out[pdadc_i++] = pdadc_tmp[pdadc_0++]; - - /* Need to extrapolate above this pdgain? */ - if (pdadc_n <= max_idx) - continue; - - /* Force each power step to be at least 0.5 dB */ - if ((pdadc_tmp[table_size - 1] - pdadc_tmp[table_size - 2]) > 1) - pwr_step = pdadc_tmp[table_size - 1] - - pdadc_tmp[table_size - 2]; - else - pwr_step = 1; - - /* Extrapolate above */ - while ((pdadc_0 < (s16) pdadc_n) && - (pdadc_i < AR5K_EEPROM_POWER_TABLE_SIZE * 2)) { - s16 tmp = pdadc_tmp[table_size - 1] + - (pdadc_0 - max_idx) * pwr_step; - pdadc_out[pdadc_i++] = (tmp > 127) ? 127 : (u8) tmp; - pdadc_0++; - } - } - - while (pdg < AR5K_EEPROM_N_PD_GAINS) { - gain_boundaries[pdg] = gain_boundaries[pdg - 1]; - pdg++; - } - - while (pdadc_i < AR5K_EEPROM_POWER_TABLE_SIZE * 2) { - pdadc_out[pdadc_i] = pdadc_out[pdadc_i - 1]; - pdadc_i++; - } - - /* Set gain boundaries */ - ath5k_hw_reg_write(ah, - AR5K_REG_SM(pd_gain_overlap, - AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP) | - AR5K_REG_SM(gain_boundaries[0], - AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_1) | - AR5K_REG_SM(gain_boundaries[1], - AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_2) | - AR5K_REG_SM(gain_boundaries[2], - AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_3) | - AR5K_REG_SM(gain_boundaries[3], - AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4), - AR5K_PHY_TPC_RG5); - - /* Used for setting rate power table */ - ah->ah_txpower.txp_min_idx = pwr_min[0]; - -} - -/** - * ath5k_write_pwr_to_pdadc_table() - Write the PDADC values on hw - * @ah: The &struct ath5k_hw - * @ee_mode: One of enum ath5k_driver_mode - */ -static void -ath5k_write_pwr_to_pdadc_table(struct ath5k_hw *ah, u8 ee_mode) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - u8 *pdadc_out = ah->ah_txpower.txp_pd_table; - u8 *pdg_to_idx = ee->ee_pdc_to_idx[ee_mode]; - u8 pdcurves = ee->ee_pd_gains[ee_mode]; - u32 reg; - u8 i; - - /* Select the right pdgain curves */ - - /* Clear current settings */ - reg = ath5k_hw_reg_read(ah, AR5K_PHY_TPC_RG1); - reg &= ~(AR5K_PHY_TPC_RG1_PDGAIN_1 | - AR5K_PHY_TPC_RG1_PDGAIN_2 | - AR5K_PHY_TPC_RG1_PDGAIN_3 | - AR5K_PHY_TPC_RG1_NUM_PD_GAIN); - - /* - * Use pd_gains curve from eeprom - * - * This overrides the default setting from initvals - * in case some vendors (e.g. Zcomax) don't use the default - * curves. If we don't honor their settings we 'll get a - * 5dB (1 * gain overlap ?) drop. - */ - reg |= AR5K_REG_SM(pdcurves, AR5K_PHY_TPC_RG1_NUM_PD_GAIN); - - switch (pdcurves) { - case 3: - reg |= AR5K_REG_SM(pdg_to_idx[2], AR5K_PHY_TPC_RG1_PDGAIN_3); - /* Fall through */ - case 2: - reg |= AR5K_REG_SM(pdg_to_idx[1], AR5K_PHY_TPC_RG1_PDGAIN_2); - /* Fall through */ - case 1: - reg |= AR5K_REG_SM(pdg_to_idx[0], AR5K_PHY_TPC_RG1_PDGAIN_1); - break; - } - ath5k_hw_reg_write(ah, reg, AR5K_PHY_TPC_RG1); - - /* - * Write TX power values - */ - for (i = 0; i < (AR5K_EEPROM_POWER_TABLE_SIZE / 2); i++) { - u32 val = get_unaligned_le32(&pdadc_out[4 * i]); - ath5k_hw_reg_write(ah, val, AR5K_PHY_PDADC_TXPOWER(i)); - } -} - - -/* - * Common code for PCDAC/PDADC tables - */ - -/** - * ath5k_setup_channel_powertable() - Set up power table for this channel - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * @ee_mode: One of enum ath5k_driver_mode - * @type: One of enum ath5k_powertable_type (eeprom.h) - * - * This is the main function that uses all of the above - * to set PCDAC/PDADC table on hw for the current channel. - * This table is used for tx power calibration on the baseband, - * without it we get weird tx power levels and in some cases - * distorted spectral mask - */ -static int -ath5k_setup_channel_powertable(struct ath5k_hw *ah, - struct ieee80211_channel *channel, - u8 ee_mode, u8 type) -{ - struct ath5k_pdgain_info *pdg_L, *pdg_R; - struct ath5k_chan_pcal_info *pcinfo_L; - struct ath5k_chan_pcal_info *pcinfo_R; - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - u8 *pdg_curve_to_idx = ee->ee_pdc_to_idx[ee_mode]; - s16 table_min[AR5K_EEPROM_N_PD_GAINS]; - s16 table_max[AR5K_EEPROM_N_PD_GAINS]; - u8 *tmpL; - u8 *tmpR; - u32 target = channel->center_freq; - int pdg, i; - - /* Get surrounding freq piers for this channel */ - ath5k_get_chan_pcal_surrounding_piers(ah, channel, - &pcinfo_L, - &pcinfo_R); - - /* Loop over pd gain curves on - * surrounding freq piers by index */ - for (pdg = 0; pdg < ee->ee_pd_gains[ee_mode]; pdg++) { - - /* Fill curves in reverse order - * from lower power (max gain) - * to higher power. Use curve -> idx - * backmapping we did on eeprom init */ - u8 idx = pdg_curve_to_idx[pdg]; - - /* Grab the needed curves by index */ - pdg_L = &pcinfo_L->pd_curves[idx]; - pdg_R = &pcinfo_R->pd_curves[idx]; - - /* Initialize the temp tables */ - tmpL = ah->ah_txpower.tmpL[pdg]; - tmpR = ah->ah_txpower.tmpR[pdg]; - - /* Set curve's x boundaries and create - * curves so that they cover the same - * range (if we don't do that one table - * will have values on some range and the - * other one won't have any so interpolation - * will fail) */ - table_min[pdg] = min(pdg_L->pd_pwr[0], - pdg_R->pd_pwr[0]) / 2; - - table_max[pdg] = max(pdg_L->pd_pwr[pdg_L->pd_points - 1], - pdg_R->pd_pwr[pdg_R->pd_points - 1]) / 2; - - /* Now create the curves on surrounding channels - * and interpolate if needed to get the final - * curve for this gain on this channel */ - switch (type) { - case AR5K_PWRTABLE_LINEAR_PCDAC: - /* Override min/max so that we don't loose - * accuracy (don't divide by 2) */ - table_min[pdg] = min(pdg_L->pd_pwr[0], - pdg_R->pd_pwr[0]); - - table_max[pdg] = - max(pdg_L->pd_pwr[pdg_L->pd_points - 1], - pdg_R->pd_pwr[pdg_R->pd_points - 1]); - - /* Override minimum so that we don't get - * out of bounds while extrapolating - * below. Don't do this when we have 2 - * curves and we are on the high power curve - * because table_min is ok in this case */ - if (!(ee->ee_pd_gains[ee_mode] > 1 && pdg == 0)) { - - table_min[pdg] = - ath5k_get_linear_pcdac_min(pdg_L->pd_step, - pdg_R->pd_step, - pdg_L->pd_pwr, - pdg_R->pd_pwr); - - /* Don't go too low because we will - * miss the upper part of the curve. - * Note: 126 = 31.5dB (max power supported) - * in 0.25dB units */ - if (table_max[pdg] - table_min[pdg] > 126) - table_min[pdg] = table_max[pdg] - 126; - } - - /* Fall through */ - case AR5K_PWRTABLE_PWR_TO_PCDAC: - case AR5K_PWRTABLE_PWR_TO_PDADC: - - ath5k_create_power_curve(table_min[pdg], - table_max[pdg], - pdg_L->pd_pwr, - pdg_L->pd_step, - pdg_L->pd_points, tmpL, type); - - /* We are in a calibration - * pier, no need to interpolate - * between freq piers */ - if (pcinfo_L == pcinfo_R) - continue; - - ath5k_create_power_curve(table_min[pdg], - table_max[pdg], - pdg_R->pd_pwr, - pdg_R->pd_step, - pdg_R->pd_points, tmpR, type); - break; - default: - return -EINVAL; - } - - /* Interpolate between curves - * of surrounding freq piers to - * get the final curve for this - * pd gain. Re-use tmpL for interpolation - * output */ - for (i = 0; (i < (u16) (table_max[pdg] - table_min[pdg])) && - (i < AR5K_EEPROM_POWER_TABLE_SIZE); i++) { - tmpL[i] = (u8) ath5k_get_interpolated_value(target, - (s16) pcinfo_L->freq, - (s16) pcinfo_R->freq, - (s16) tmpL[i], - (s16) tmpR[i]); - } - } - - /* Now we have a set of curves for this - * channel on tmpL (x range is table_max - table_min - * and y values are tmpL[pdg][]) sorted in the same - * order as EEPROM (because we've used the backmapping). - * So for RF5112 it's from higher power to lower power - * and for RF2413 it's from lower power to higher power. - * For RF5111 we only have one curve. */ - - /* Fill min and max power levels for this - * channel by interpolating the values on - * surrounding channels to complete the dataset */ - ah->ah_txpower.txp_min_pwr = ath5k_get_interpolated_value(target, - (s16) pcinfo_L->freq, - (s16) pcinfo_R->freq, - pcinfo_L->min_pwr, pcinfo_R->min_pwr); - - ah->ah_txpower.txp_max_pwr = ath5k_get_interpolated_value(target, - (s16) pcinfo_L->freq, - (s16) pcinfo_R->freq, - pcinfo_L->max_pwr, pcinfo_R->max_pwr); - - /* Fill PCDAC/PDADC table */ - switch (type) { - case AR5K_PWRTABLE_LINEAR_PCDAC: - /* For RF5112 we can have one or two curves - * and each curve covers a certain power lvl - * range so we need to do some more processing */ - ath5k_combine_linear_pcdac_curves(ah, table_min, table_max, - ee->ee_pd_gains[ee_mode]); - - /* Set txp.offset so that we can - * match max power value with max - * table index */ - ah->ah_txpower.txp_offset = 64 - (table_max[0] / 2); - break; - case AR5K_PWRTABLE_PWR_TO_PCDAC: - /* We are done for RF5111 since it has only - * one curve, just fit the curve on the table */ - ath5k_fill_pwr_to_pcdac_table(ah, table_min, table_max); - - /* No rate powertable adjustment for RF5111 */ - ah->ah_txpower.txp_min_idx = 0; - ah->ah_txpower.txp_offset = 0; - break; - case AR5K_PWRTABLE_PWR_TO_PDADC: - /* Set PDADC boundaries and fill - * final PDADC table */ - ath5k_combine_pwr_to_pdadc_curves(ah, table_min, table_max, - ee->ee_pd_gains[ee_mode]); - - /* Set txp.offset, note that table_min - * can be negative */ - ah->ah_txpower.txp_offset = table_min[0]; - break; - default: - return -EINVAL; - } - - ah->ah_txpower.txp_setup = true; - - return 0; -} - -/** - * ath5k_write_channel_powertable() - Set power table for current channel on hw - * @ah: The &struct ath5k_hw - * @ee_mode: One of enum ath5k_driver_mode - * @type: One of enum ath5k_powertable_type (eeprom.h) - */ -static void -ath5k_write_channel_powertable(struct ath5k_hw *ah, u8 ee_mode, u8 type) -{ - if (type == AR5K_PWRTABLE_PWR_TO_PDADC) - ath5k_write_pwr_to_pdadc_table(ah, ee_mode); - else - ath5k_write_pcdac_table(ah); -} - - -/** - * DOC: Per-rate tx power setting - * - * This is the code that sets the desired tx power limit (below - * maximum) on hw for each rate (we also have TPC that sets - * power per packet type). We do that by providing an index on the - * PCDAC/PDADC table we set up above, for each rate. - * - * For now we only limit txpower based on maximum tx power - * supported by hw (what's inside rate_info) + conformance test - * limits. We need to limit this even more, based on regulatory domain - * etc to be safe. Normally this is done from above so we don't care - * here, all we care is that the tx power we set will be O.K. - * for the hw (e.g. won't create noise on PA etc). - * - * Rate power table contains indices to PCDAC/PDADC table (0.5dB steps - - * x values) and is indexed as follows: - * rates[0] - rates[7] -> OFDM rates - * rates[8] - rates[14] -> CCK rates - * rates[15] -> XR rates (they all have the same power) - */ - -/** - * ath5k_setup_rate_powertable() - Set up rate power table for a given tx power - * @ah: The &struct ath5k_hw - * @max_pwr: The maximum tx power requested in 0.5dB steps - * @rate_info: The &struct ath5k_rate_pcal_info to fill - * @ee_mode: One of enum ath5k_driver_mode - */ -static void -ath5k_setup_rate_powertable(struct ath5k_hw *ah, u16 max_pwr, - struct ath5k_rate_pcal_info *rate_info, - u8 ee_mode) -{ - unsigned int i; - u16 *rates; - s16 rate_idx_scaled = 0; - - /* max_pwr is power level we got from driver/user in 0.5dB - * units, switch to 0.25dB units so we can compare */ - max_pwr *= 2; - max_pwr = min(max_pwr, (u16) ah->ah_txpower.txp_max_pwr) / 2; - - /* apply rate limits */ - rates = ah->ah_txpower.txp_rates_power_table; - - /* OFDM rates 6 to 24Mb/s */ - for (i = 0; i < 5; i++) - rates[i] = min(max_pwr, rate_info->target_power_6to24); - - /* Rest OFDM rates */ - rates[5] = min(rates[0], rate_info->target_power_36); - rates[6] = min(rates[0], rate_info->target_power_48); - rates[7] = min(rates[0], rate_info->target_power_54); - - /* CCK rates */ - /* 1L */ - rates[8] = min(rates[0], rate_info->target_power_6to24); - /* 2L */ - rates[9] = min(rates[0], rate_info->target_power_36); - /* 2S */ - rates[10] = min(rates[0], rate_info->target_power_36); - /* 5L */ - rates[11] = min(rates[0], rate_info->target_power_48); - /* 5S */ - rates[12] = min(rates[0], rate_info->target_power_48); - /* 11L */ - rates[13] = min(rates[0], rate_info->target_power_54); - /* 11S */ - rates[14] = min(rates[0], rate_info->target_power_54); - - /* XR rates */ - rates[15] = min(rates[0], rate_info->target_power_6to24); - - /* CCK rates have different peak to average ratio - * so we have to tweak their power so that gainf - * correction works ok. For this we use OFDM to - * CCK delta from eeprom */ - if ((ee_mode == AR5K_EEPROM_MODE_11G) && - (ah->ah_phy_revision < AR5K_SREV_PHY_5212A)) - for (i = 8; i <= 15; i++) - rates[i] -= ah->ah_txpower.txp_cck_ofdm_gainf_delta; - - /* Save min/max and current tx power for this channel - * in 0.25dB units. - * - * Note: We use rates[0] for current tx power because - * it covers most of the rates, in most cases. It's our - * tx power limit and what the user expects to see. */ - ah->ah_txpower.txp_min_pwr = 2 * rates[7]; - ah->ah_txpower.txp_cur_pwr = 2 * rates[0]; - - /* Set max txpower for correct OFDM operation on all rates - * -that is the txpower for 54Mbit-, it's used for the PAPD - * gain probe and it's in 0.5dB units */ - ah->ah_txpower.txp_ofdm = rates[7]; - - /* Now that we have all rates setup use table offset to - * match the power range set by user with the power indices - * on PCDAC/PDADC table */ - for (i = 0; i < 16; i++) { - rate_idx_scaled = rates[i] + ah->ah_txpower.txp_offset; - /* Don't get out of bounds */ - if (rate_idx_scaled > 63) - rate_idx_scaled = 63; - if (rate_idx_scaled < 0) - rate_idx_scaled = 0; - rates[i] = rate_idx_scaled; - } -} - - -/** - * ath5k_hw_txpower() - Set transmission power limit for a given channel - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * @txpower: Requested tx power in 0.5dB steps - * - * Combines all of the above to set the requested tx power limit - * on hw. - */ -static int -ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, - u8 txpower) -{ - struct ath5k_rate_pcal_info rate_info; - struct ieee80211_channel *curr_channel = ah->ah_current_channel; - int ee_mode; - u8 type; - int ret; - - if (txpower > AR5K_TUNE_MAX_TXPOWER) { - ATH5K_ERR(ah, "invalid tx power: %u\n", txpower); - return -EINVAL; - } - - ee_mode = ath5k_eeprom_mode_from_channel(ah, channel); - - /* Initialize TX power table */ - switch (ah->ah_radio) { - case AR5K_RF5110: - /* TODO */ - return 0; - case AR5K_RF5111: - type = AR5K_PWRTABLE_PWR_TO_PCDAC; - break; - case AR5K_RF5112: - type = AR5K_PWRTABLE_LINEAR_PCDAC; - break; - case AR5K_RF2413: - case AR5K_RF5413: - case AR5K_RF2316: - case AR5K_RF2317: - case AR5K_RF2425: - type = AR5K_PWRTABLE_PWR_TO_PDADC; - break; - default: - return -EINVAL; - } - - /* - * If we don't change channel/mode skip tx powertable calculation - * and use the cached one. - */ - if (!ah->ah_txpower.txp_setup || - (channel->hw_value != curr_channel->hw_value) || - (channel->center_freq != curr_channel->center_freq)) { - /* Reset TX power values but preserve requested - * tx power from above */ - int requested_txpower = ah->ah_txpower.txp_requested; - - memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower)); - - /* Restore TPC setting and requested tx power */ - ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER; - - ah->ah_txpower.txp_requested = requested_txpower; - - /* Calculate the powertable */ - ret = ath5k_setup_channel_powertable(ah, channel, - ee_mode, type); - if (ret) - return ret; - } - - /* Write table on hw */ - ath5k_write_channel_powertable(ah, ee_mode, type); - - /* Limit max power if we have a CTL available */ - ath5k_get_max_ctl_power(ah, channel); - - /* FIXME: Antenna reduction stuff */ - - /* FIXME: Limit power on turbo modes */ - - /* FIXME: TPC scale reduction */ - - /* Get surrounding channels for per-rate power table - * calibration */ - ath5k_get_rate_pcal_data(ah, channel, &rate_info); - - /* Setup rate power table */ - ath5k_setup_rate_powertable(ah, txpower, &rate_info, ee_mode); - - /* Write rate power table on hw */ - ath5k_hw_reg_write(ah, AR5K_TXPOWER_OFDM(3, 24) | - AR5K_TXPOWER_OFDM(2, 16) | AR5K_TXPOWER_OFDM(1, 8) | - AR5K_TXPOWER_OFDM(0, 0), AR5K_PHY_TXPOWER_RATE1); - - ath5k_hw_reg_write(ah, AR5K_TXPOWER_OFDM(7, 24) | - AR5K_TXPOWER_OFDM(6, 16) | AR5K_TXPOWER_OFDM(5, 8) | - AR5K_TXPOWER_OFDM(4, 0), AR5K_PHY_TXPOWER_RATE2); - - ath5k_hw_reg_write(ah, AR5K_TXPOWER_CCK(10, 24) | - AR5K_TXPOWER_CCK(9, 16) | AR5K_TXPOWER_CCK(15, 8) | - AR5K_TXPOWER_CCK(8, 0), AR5K_PHY_TXPOWER_RATE3); - - ath5k_hw_reg_write(ah, AR5K_TXPOWER_CCK(14, 24) | - AR5K_TXPOWER_CCK(13, 16) | AR5K_TXPOWER_CCK(12, 8) | - AR5K_TXPOWER_CCK(11, 0), AR5K_PHY_TXPOWER_RATE4); - - /* FIXME: TPC support */ - if (ah->ah_txpower.txp_tpc) { - ath5k_hw_reg_write(ah, AR5K_PHY_TXPOWER_RATE_MAX_TPC_ENABLE | - AR5K_TUNE_MAX_TXPOWER, AR5K_PHY_TXPOWER_RATE_MAX); - - ath5k_hw_reg_write(ah, - AR5K_REG_MS(AR5K_TUNE_MAX_TXPOWER, AR5K_TPC_ACK) | - AR5K_REG_MS(AR5K_TUNE_MAX_TXPOWER, AR5K_TPC_CTS) | - AR5K_REG_MS(AR5K_TUNE_MAX_TXPOWER, AR5K_TPC_CHIRP), - AR5K_TPC); - } else { - ath5k_hw_reg_write(ah, AR5K_PHY_TXPOWER_RATE_MAX | - AR5K_TUNE_MAX_TXPOWER, AR5K_PHY_TXPOWER_RATE_MAX); - } - - return 0; -} - -/** - * ath5k_hw_set_txpower_limit() - Set txpower limit for the current channel - * @ah: The &struct ath5k_hw - * @txpower: The requested tx power limit in 0.5dB steps - * - * This function provides access to ath5k_hw_txpower to the driver in - * case user or an application changes it while PHY is running. - */ -int -ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower) -{ - ATH5K_DBG(ah, ATH5K_DEBUG_TXPOWER, - "changing txpower to %d\n", txpower); - - return ath5k_hw_txpower(ah, ah->ah_current_channel, txpower); -} - - -/*************\ - Init function -\*************/ - -/** - * ath5k_hw_phy_init() - Initialize PHY - * @ah: The &struct ath5k_hw - * @channel: The @struct ieee80211_channel - * @mode: One of enum ath5k_driver_mode - * @fast: Try a fast channel switch instead - * - * This is the main function used during reset to initialize PHY - * or do a fast channel change if possible. - * - * NOTE: Do not call this one from the driver, it assumes PHY is in a - * warm reset state ! - */ -int -ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, - u8 mode, bool fast) -{ - struct ieee80211_channel *curr_channel; - int ret, i; - u32 phy_tst1; - ret = 0; - - /* - * Sanity check for fast flag - * Don't try fast channel change when changing modulation - * mode/band. We check for chip compatibility on - * ath5k_hw_reset. - */ - curr_channel = ah->ah_current_channel; - if (fast && (channel->hw_value != curr_channel->hw_value)) - return -EINVAL; - - /* - * On fast channel change we only set the synth parameters - * while PHY is running, enable calibration and skip the rest. - */ - if (fast) { - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_RFBUS_REQ, - AR5K_PHY_RFBUS_REQ_REQUEST); - for (i = 0; i < 100; i++) { - if (ath5k_hw_reg_read(ah, AR5K_PHY_RFBUS_GRANT)) - break; - udelay(5); - } - /* Failed */ - if (i >= 100) - return -EIO; - - /* Set channel and wait for synth */ - ret = ath5k_hw_channel(ah, channel); - if (ret) - return ret; - - ath5k_hw_wait_for_synth(ah, channel); - } - - /* - * Set TX power - * - * Note: We need to do that before we set - * RF buffer settings on 5211/5212+ so that we - * properly set curve indices. - */ - ret = ath5k_hw_txpower(ah, channel, ah->ah_txpower.txp_requested ? - ah->ah_txpower.txp_requested * 2 : - AR5K_TUNE_MAX_TXPOWER); - if (ret) - return ret; - - /* Write OFDM timings on 5212*/ - if (ah->ah_version == AR5K_AR5212 && - channel->hw_value != AR5K_MODE_11B) { - - ret = ath5k_hw_write_ofdm_timings(ah, channel); - if (ret) - return ret; - - /* Spur info is available only from EEPROM versions - * greater than 5.3, but the EEPROM routines will use - * static values for older versions */ - if (ah->ah_mac_srev >= AR5K_SREV_AR5424) - ath5k_hw_set_spur_mitigation_filter(ah, - channel); - } - - /* If we used fast channel switching - * we are done, release RF bus and - * fire up NF calibration. - * - * Note: Only NF calibration due to - * channel change, not AGC calibration - * since AGC is still running ! - */ - if (fast) { - /* - * Release RF Bus grant - */ - AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_RFBUS_REQ, - AR5K_PHY_RFBUS_REQ_REQUEST); - - /* - * Start NF calibration - */ - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL, - AR5K_PHY_AGCCTL_NF); - - return ret; - } - - /* - * For 5210 we do all initialization using - * initvals, so we don't have to modify - * any settings (5210 also only supports - * a/aturbo modes) - */ - if (ah->ah_version != AR5K_AR5210) { - - /* - * Write initial RF gain settings - * This should work for both 5111/5112 - */ - ret = ath5k_hw_rfgain_init(ah, channel->band); - if (ret) - return ret; - - usleep_range(1000, 1500); - - /* - * Write RF buffer - */ - ret = ath5k_hw_rfregs_init(ah, channel, mode); - if (ret) - return ret; - - /*Enable/disable 802.11b mode on 5111 - (enable 2111 frequency converter + CCK)*/ - if (ah->ah_radio == AR5K_RF5111) { - if (mode == AR5K_MODE_11B) - AR5K_REG_ENABLE_BITS(ah, AR5K_TXCFG, - AR5K_TXCFG_B_MODE); - else - AR5K_REG_DISABLE_BITS(ah, AR5K_TXCFG, - AR5K_TXCFG_B_MODE); - } - - } else if (ah->ah_version == AR5K_AR5210) { - usleep_range(1000, 1500); - /* Disable phy and wait */ - ath5k_hw_reg_write(ah, AR5K_PHY_ACT_DISABLE, AR5K_PHY_ACT); - usleep_range(1000, 1500); - } - - /* Set channel on PHY */ - ret = ath5k_hw_channel(ah, channel); - if (ret) - return ret; - - /* - * Enable the PHY and wait until completion - * This includes BaseBand and Synthesizer - * activation. - */ - ath5k_hw_reg_write(ah, AR5K_PHY_ACT_ENABLE, AR5K_PHY_ACT); - - ath5k_hw_wait_for_synth(ah, channel); - - /* - * Perform ADC test to see if baseband is ready - * Set tx hold and check adc test register - */ - phy_tst1 = ath5k_hw_reg_read(ah, AR5K_PHY_TST1); - ath5k_hw_reg_write(ah, AR5K_PHY_TST1_TXHOLD, AR5K_PHY_TST1); - for (i = 0; i <= 20; i++) { - if (!(ath5k_hw_reg_read(ah, AR5K_PHY_ADC_TEST) & 0x10)) - break; - usleep_range(200, 250); - } - ath5k_hw_reg_write(ah, phy_tst1, AR5K_PHY_TST1); - - /* - * Start automatic gain control calibration - * - * During AGC calibration RX path is re-routed to - * a power detector so we don't receive anything. - * - * This method is used to calibrate some static offsets - * used together with on-the fly I/Q calibration (the - * one performed via ath5k_hw_phy_calibrate), which doesn't - * interrupt rx path. - * - * While rx path is re-routed to the power detector we also - * start a noise floor calibration to measure the - * card's noise floor (the noise we measure when we are not - * transmitting or receiving anything). - * - * If we are in a noisy environment, AGC calibration may time - * out and/or noise floor calibration might timeout. - */ - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL, - AR5K_PHY_AGCCTL_CAL | AR5K_PHY_AGCCTL_NF); - - /* At the same time start I/Q calibration for QAM constellation - * -no need for CCK- */ - ah->ah_iq_cal_needed = false; - if (!(mode == AR5K_MODE_11B)) { - ah->ah_iq_cal_needed = true; - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, - AR5K_PHY_IQ_CAL_NUM_LOG_MAX, 15); - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, - AR5K_PHY_IQ_RUN); - } - - /* Wait for gain calibration to finish (we check for I/Q calibration - * during ath5k_phy_calibrate) */ - if (ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL, - AR5K_PHY_AGCCTL_CAL, 0, false)) { - ATH5K_ERR(ah, "gain calibration timeout (%uMHz)\n", - channel->center_freq); - } - - /* Restore antenna mode */ - ath5k_hw_set_antenna_mode(ah, ah->ah_ant_mode); - - return ret; -} diff --git a/drivers/net/wireless/ath/ath5k/qcu.c b/drivers/net/wireless/ath/ath5k/qcu.c deleted file mode 100644 index 65fe929529a8..000000000000 --- a/drivers/net/wireless/ath/ath5k/qcu.c +++ /dev/null @@ -1,714 +0,0 @@ -/* - * Copyright (c) 2004-2008 Reyk Floeter - * Copyright (c) 2006-2008 Nick Kossifidis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/********************************************\ -Queue Control Unit, DCF Control Unit Functions -\********************************************/ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include "ath5k.h" -#include "reg.h" -#include "debug.h" -#include - -/** - * DOC: Queue Control Unit (QCU)/DCF Control Unit (DCU) functions - * - * Here we setup parameters for the 12 available TX queues. Note that - * on the various registers we can usually only map the first 10 of them so - * basically we have 10 queues to play with. Each queue has a matching - * QCU that controls when the queue will get triggered and multiple QCUs - * can be mapped to a single DCU that controls the various DFS parameters - * for the various queues. In our setup we have a 1:1 mapping between QCUs - * and DCUs allowing us to have different DFS settings for each queue. - * - * When a frame goes into a TX queue, QCU decides when it'll trigger a - * transmission based on various criteria (such as how many data we have inside - * it's buffer or -if it's a beacon queue- if it's time to fire up the queue - * based on TSF etc), DCU adds backoff, IFSes etc and then a scheduler - * (arbitrator) decides the priority of each QCU based on it's configuration - * (e.g. beacons are always transmitted when they leave DCU bypassing all other - * frames from other queues waiting to be transmitted). After a frame leaves - * the DCU it goes to PCU for further processing and then to PHY for - * the actual transmission. - */ - - -/******************\ -* Helper functions * -\******************/ - -/** - * ath5k_hw_num_tx_pending() - Get number of pending frames for a given queue - * @ah: The &struct ath5k_hw - * @queue: One of enum ath5k_tx_queue_id - */ -u32 -ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue) -{ - u32 pending; - AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num); - - /* Return if queue is declared inactive */ - if (ah->ah_txq[queue].tqi_type == AR5K_TX_QUEUE_INACTIVE) - return false; - - /* XXX: How about AR5K_CFG_TXCNT ? */ - if (ah->ah_version == AR5K_AR5210) - return false; - - pending = ath5k_hw_reg_read(ah, AR5K_QUEUE_STATUS(queue)); - pending &= AR5K_QCU_STS_FRMPENDCNT; - - /* It's possible to have no frames pending even if TXE - * is set. To indicate that q has not stopped return - * true */ - if (!pending && AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue)) - return true; - - return pending; -} - -/** - * ath5k_hw_release_tx_queue() - Set a transmit queue inactive - * @ah: The &struct ath5k_hw - * @queue: One of enum ath5k_tx_queue_id - */ -void -ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue) -{ - if (WARN_ON(queue >= ah->ah_capabilities.cap_queues.q_tx_num)) - return; - - /* This queue will be skipped in further operations */ - ah->ah_txq[queue].tqi_type = AR5K_TX_QUEUE_INACTIVE; - /*For SIMR setup*/ - AR5K_Q_DISABLE_BITS(ah->ah_txq_status, queue); -} - -/** - * ath5k_cw_validate() - Make sure the given cw is valid - * @cw_req: The contention window value to check - * - * Make sure cw is a power of 2 minus 1 and smaller than 1024 - */ -static u16 -ath5k_cw_validate(u16 cw_req) -{ - cw_req = min(cw_req, (u16)1023); - - /* Check if cw_req + 1 a power of 2 */ - if (is_power_of_2(cw_req + 1)) - return cw_req; - - /* Check if cw_req is a power of 2 */ - if (is_power_of_2(cw_req)) - return cw_req - 1; - - /* If none of the above is correct - * find the closest power of 2 */ - cw_req = (u16) roundup_pow_of_two(cw_req) - 1; - - return cw_req; -} - -/** - * ath5k_hw_get_tx_queueprops() - Get properties for a transmit queue - * @ah: The &struct ath5k_hw - * @queue: One of enum ath5k_tx_queue_id - * @queue_info: The &struct ath5k_txq_info to fill - */ -int -ath5k_hw_get_tx_queueprops(struct ath5k_hw *ah, int queue, - struct ath5k_txq_info *queue_info) -{ - memcpy(queue_info, &ah->ah_txq[queue], sizeof(struct ath5k_txq_info)); - return 0; -} - -/** - * ath5k_hw_set_tx_queueprops() - Set properties for a transmit queue - * @ah: The &struct ath5k_hw - * @queue: One of enum ath5k_tx_queue_id - * @qinfo: The &struct ath5k_txq_info to use - * - * Returns 0 on success or -EIO if queue is inactive - */ -int -ath5k_hw_set_tx_queueprops(struct ath5k_hw *ah, int queue, - const struct ath5k_txq_info *qinfo) -{ - struct ath5k_txq_info *qi; - - AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num); - - qi = &ah->ah_txq[queue]; - - if (qi->tqi_type == AR5K_TX_QUEUE_INACTIVE) - return -EIO; - - /* copy and validate values */ - qi->tqi_type = qinfo->tqi_type; - qi->tqi_subtype = qinfo->tqi_subtype; - qi->tqi_flags = qinfo->tqi_flags; - /* - * According to the docs: Although the AIFS field is 8 bit wide, - * the maximum supported value is 0xFC. Setting it higher than that - * will cause the DCU to hang. - */ - qi->tqi_aifs = min(qinfo->tqi_aifs, (u8)0xFC); - qi->tqi_cw_min = ath5k_cw_validate(qinfo->tqi_cw_min); - qi->tqi_cw_max = ath5k_cw_validate(qinfo->tqi_cw_max); - qi->tqi_cbr_period = qinfo->tqi_cbr_period; - qi->tqi_cbr_overflow_limit = qinfo->tqi_cbr_overflow_limit; - qi->tqi_burst_time = qinfo->tqi_burst_time; - qi->tqi_ready_time = qinfo->tqi_ready_time; - - /*XXX: Is this supported on 5210 ?*/ - /*XXX: Is this correct for AR5K_WME_AC_VI,VO ???*/ - if ((qinfo->tqi_type == AR5K_TX_QUEUE_DATA && - ((qinfo->tqi_subtype == AR5K_WME_AC_VI) || - (qinfo->tqi_subtype == AR5K_WME_AC_VO))) || - qinfo->tqi_type == AR5K_TX_QUEUE_UAPSD) - qi->tqi_flags |= AR5K_TXQ_FLAG_POST_FR_BKOFF_DIS; - - return 0; -} - -/** - * ath5k_hw_setup_tx_queue() - Initialize a transmit queue - * @ah: The &struct ath5k_hw - * @queue_type: One of enum ath5k_tx_queue - * @queue_info: The &struct ath5k_txq_info to use - * - * Returns 0 on success, -EINVAL on invalid arguments - */ -int -ath5k_hw_setup_tx_queue(struct ath5k_hw *ah, enum ath5k_tx_queue queue_type, - struct ath5k_txq_info *queue_info) -{ - unsigned int queue; - int ret; - - /* - * Get queue by type - */ - /* 5210 only has 2 queues */ - if (ah->ah_capabilities.cap_queues.q_tx_num == 2) { - switch (queue_type) { - case AR5K_TX_QUEUE_DATA: - queue = AR5K_TX_QUEUE_ID_NOQCU_DATA; - break; - case AR5K_TX_QUEUE_BEACON: - case AR5K_TX_QUEUE_CAB: - queue = AR5K_TX_QUEUE_ID_NOQCU_BEACON; - break; - default: - return -EINVAL; - } - } else { - switch (queue_type) { - case AR5K_TX_QUEUE_DATA: - for (queue = AR5K_TX_QUEUE_ID_DATA_MIN; - ah->ah_txq[queue].tqi_type != - AR5K_TX_QUEUE_INACTIVE; queue++) { - - if (queue > AR5K_TX_QUEUE_ID_DATA_MAX) - return -EINVAL; - } - break; - case AR5K_TX_QUEUE_UAPSD: - queue = AR5K_TX_QUEUE_ID_UAPSD; - break; - case AR5K_TX_QUEUE_BEACON: - queue = AR5K_TX_QUEUE_ID_BEACON; - break; - case AR5K_TX_QUEUE_CAB: - queue = AR5K_TX_QUEUE_ID_CAB; - break; - default: - return -EINVAL; - } - } - - /* - * Setup internal queue structure - */ - memset(&ah->ah_txq[queue], 0, sizeof(struct ath5k_txq_info)); - ah->ah_txq[queue].tqi_type = queue_type; - - if (queue_info != NULL) { - queue_info->tqi_type = queue_type; - ret = ath5k_hw_set_tx_queueprops(ah, queue, queue_info); - if (ret) - return ret; - } - - /* - * We use ah_txq_status to hold a temp value for - * the Secondary interrupt mask registers on 5211+ - * check out ath5k_hw_reset_tx_queue - */ - AR5K_Q_ENABLE_BITS(ah->ah_txq_status, queue); - - return queue; -} - - -/*******************************\ -* Single QCU/DCU initialization * -\*******************************/ - -/** - * ath5k_hw_set_tx_retry_limits() - Set tx retry limits on DCU - * @ah: The &struct ath5k_hw - * @queue: One of enum ath5k_tx_queue_id - * - * This function is used when initializing a queue, to set - * retry limits based on ah->ah_retry_* and the chipset used. - */ -void -ath5k_hw_set_tx_retry_limits(struct ath5k_hw *ah, - unsigned int queue) -{ - /* Single data queue on AR5210 */ - if (ah->ah_version == AR5K_AR5210) { - struct ath5k_txq_info *tq = &ah->ah_txq[queue]; - - if (queue > 0) - return; - - ath5k_hw_reg_write(ah, - (tq->tqi_cw_min << AR5K_NODCU_RETRY_LMT_CW_MIN_S) - | AR5K_REG_SM(ah->ah_retry_long, - AR5K_NODCU_RETRY_LMT_SLG_RETRY) - | AR5K_REG_SM(ah->ah_retry_short, - AR5K_NODCU_RETRY_LMT_SSH_RETRY) - | AR5K_REG_SM(ah->ah_retry_long, - AR5K_NODCU_RETRY_LMT_LG_RETRY) - | AR5K_REG_SM(ah->ah_retry_short, - AR5K_NODCU_RETRY_LMT_SH_RETRY), - AR5K_NODCU_RETRY_LMT); - /* DCU on AR5211+ */ - } else { - ath5k_hw_reg_write(ah, - AR5K_REG_SM(ah->ah_retry_long, - AR5K_DCU_RETRY_LMT_RTS) - | AR5K_REG_SM(ah->ah_retry_long, - AR5K_DCU_RETRY_LMT_STA_RTS) - | AR5K_REG_SM(max(ah->ah_retry_long, ah->ah_retry_short), - AR5K_DCU_RETRY_LMT_STA_DATA), - AR5K_QUEUE_DFS_RETRY_LIMIT(queue)); - } -} - -/** - * ath5k_hw_reset_tx_queue() - Initialize a single hw queue - * @ah: The &struct ath5k_hw - * @queue: One of enum ath5k_tx_queue_id - * - * Set DCF properties for the given transmit queue on DCU - * and configures all queue-specific parameters. - */ -int -ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue) -{ - struct ath5k_txq_info *tq = &ah->ah_txq[queue]; - - AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num); - - tq = &ah->ah_txq[queue]; - - /* Skip if queue inactive or if we are on AR5210 - * that doesn't have QCU/DCU */ - if ((ah->ah_version == AR5K_AR5210) || - (tq->tqi_type == AR5K_TX_QUEUE_INACTIVE)) - return 0; - - /* - * Set contention window (cw_min/cw_max) - * and arbitrated interframe space (aifs)... - */ - ath5k_hw_reg_write(ah, - AR5K_REG_SM(tq->tqi_cw_min, AR5K_DCU_LCL_IFS_CW_MIN) | - AR5K_REG_SM(tq->tqi_cw_max, AR5K_DCU_LCL_IFS_CW_MAX) | - AR5K_REG_SM(tq->tqi_aifs, AR5K_DCU_LCL_IFS_AIFS), - AR5K_QUEUE_DFS_LOCAL_IFS(queue)); - - /* - * Set tx retry limits for this queue - */ - ath5k_hw_set_tx_retry_limits(ah, queue); - - - /* - * Set misc registers - */ - - /* Enable DCU to wait for next fragment from QCU */ - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), - AR5K_DCU_MISC_FRAG_WAIT); - - /* On Maui and Spirit use the global seqnum on DCU */ - if (ah->ah_mac_version < AR5K_SREV_AR5211) - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), - AR5K_DCU_MISC_SEQNUM_CTL); - - /* Constant bit rate period */ - if (tq->tqi_cbr_period) { - ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_cbr_period, - AR5K_QCU_CBRCFG_INTVAL) | - AR5K_REG_SM(tq->tqi_cbr_overflow_limit, - AR5K_QCU_CBRCFG_ORN_THRES), - AR5K_QUEUE_CBRCFG(queue)); - - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), - AR5K_QCU_MISC_FRSHED_CBR); - - if (tq->tqi_cbr_overflow_limit) - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), - AR5K_QCU_MISC_CBR_THRES_ENABLE); - } - - /* Ready time interval */ - if (tq->tqi_ready_time && (tq->tqi_type != AR5K_TX_QUEUE_CAB)) - ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_ready_time, - AR5K_QCU_RDYTIMECFG_INTVAL) | - AR5K_QCU_RDYTIMECFG_ENABLE, - AR5K_QUEUE_RDYTIMECFG(queue)); - - if (tq->tqi_burst_time) { - ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_burst_time, - AR5K_DCU_CHAN_TIME_DUR) | - AR5K_DCU_CHAN_TIME_ENABLE, - AR5K_QUEUE_DFS_CHANNEL_TIME(queue)); - - if (tq->tqi_flags & AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE) - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), - AR5K_QCU_MISC_RDY_VEOL_POLICY); - } - - /* Enable/disable Post frame backoff */ - if (tq->tqi_flags & AR5K_TXQ_FLAG_BACKOFF_DISABLE) - ath5k_hw_reg_write(ah, AR5K_DCU_MISC_POST_FR_BKOFF_DIS, - AR5K_QUEUE_DFS_MISC(queue)); - - /* Enable/disable fragmentation burst backoff */ - if (tq->tqi_flags & AR5K_TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE) - ath5k_hw_reg_write(ah, AR5K_DCU_MISC_BACKOFF_FRAG, - AR5K_QUEUE_DFS_MISC(queue)); - - /* - * Set registers by queue type - */ - switch (tq->tqi_type) { - case AR5K_TX_QUEUE_BEACON: - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), - AR5K_QCU_MISC_FRSHED_DBA_GT | - AR5K_QCU_MISC_CBREXP_BCN_DIS | - AR5K_QCU_MISC_BCN_ENABLE); - - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), - (AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL << - AR5K_DCU_MISC_ARBLOCK_CTL_S) | - AR5K_DCU_MISC_ARBLOCK_IGNORE | - AR5K_DCU_MISC_POST_FR_BKOFF_DIS | - AR5K_DCU_MISC_BCN_ENABLE); - break; - - case AR5K_TX_QUEUE_CAB: - /* XXX: use BCN_SENT_GT, if we can figure out how */ - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), - AR5K_QCU_MISC_FRSHED_DBA_GT | - AR5K_QCU_MISC_CBREXP_DIS | - AR5K_QCU_MISC_CBREXP_BCN_DIS); - - ath5k_hw_reg_write(ah, ((tq->tqi_ready_time - - (AR5K_TUNE_SW_BEACON_RESP - - AR5K_TUNE_DMA_BEACON_RESP) - - AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF) * 1024) | - AR5K_QCU_RDYTIMECFG_ENABLE, - AR5K_QUEUE_RDYTIMECFG(queue)); - - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), - (AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL << - AR5K_DCU_MISC_ARBLOCK_CTL_S)); - break; - - case AR5K_TX_QUEUE_UAPSD: - AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), - AR5K_QCU_MISC_CBREXP_DIS); - break; - - case AR5K_TX_QUEUE_DATA: - default: - break; - } - - /* TODO: Handle frame compression */ - - /* - * Enable interrupts for this tx queue - * in the secondary interrupt mask registers - */ - if (tq->tqi_flags & AR5K_TXQ_FLAG_TXOKINT_ENABLE) - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txok, queue); - - if (tq->tqi_flags & AR5K_TXQ_FLAG_TXERRINT_ENABLE) - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txerr, queue); - - if (tq->tqi_flags & AR5K_TXQ_FLAG_TXURNINT_ENABLE) - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txurn, queue); - - if (tq->tqi_flags & AR5K_TXQ_FLAG_TXDESCINT_ENABLE) - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txdesc, queue); - - if (tq->tqi_flags & AR5K_TXQ_FLAG_TXEOLINT_ENABLE) - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txeol, queue); - - if (tq->tqi_flags & AR5K_TXQ_FLAG_CBRORNINT_ENABLE) - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_cbrorn, queue); - - if (tq->tqi_flags & AR5K_TXQ_FLAG_CBRURNINT_ENABLE) - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_cbrurn, queue); - - if (tq->tqi_flags & AR5K_TXQ_FLAG_QTRIGINT_ENABLE) - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_qtrig, queue); - - if (tq->tqi_flags & AR5K_TXQ_FLAG_TXNOFRMINT_ENABLE) - AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_nofrm, queue); - - /* Update secondary interrupt mask registers */ - - /* Filter out inactive queues */ - ah->ah_txq_imr_txok &= ah->ah_txq_status; - ah->ah_txq_imr_txerr &= ah->ah_txq_status; - ah->ah_txq_imr_txurn &= ah->ah_txq_status; - ah->ah_txq_imr_txdesc &= ah->ah_txq_status; - ah->ah_txq_imr_txeol &= ah->ah_txq_status; - ah->ah_txq_imr_cbrorn &= ah->ah_txq_status; - ah->ah_txq_imr_cbrurn &= ah->ah_txq_status; - ah->ah_txq_imr_qtrig &= ah->ah_txq_status; - ah->ah_txq_imr_nofrm &= ah->ah_txq_status; - - ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_txok, - AR5K_SIMR0_QCU_TXOK) | - AR5K_REG_SM(ah->ah_txq_imr_txdesc, - AR5K_SIMR0_QCU_TXDESC), - AR5K_SIMR0); - - ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_txerr, - AR5K_SIMR1_QCU_TXERR) | - AR5K_REG_SM(ah->ah_txq_imr_txeol, - AR5K_SIMR1_QCU_TXEOL), - AR5K_SIMR1); - - /* Update SIMR2 but don't overwrite rest simr2 settings */ - AR5K_REG_DISABLE_BITS(ah, AR5K_SIMR2, AR5K_SIMR2_QCU_TXURN); - AR5K_REG_ENABLE_BITS(ah, AR5K_SIMR2, - AR5K_REG_SM(ah->ah_txq_imr_txurn, - AR5K_SIMR2_QCU_TXURN)); - - ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_cbrorn, - AR5K_SIMR3_QCBRORN) | - AR5K_REG_SM(ah->ah_txq_imr_cbrurn, - AR5K_SIMR3_QCBRURN), - AR5K_SIMR3); - - ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_qtrig, - AR5K_SIMR4_QTRIG), AR5K_SIMR4); - - /* Set TXNOFRM_QCU for the queues with TXNOFRM enabled */ - ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_nofrm, - AR5K_TXNOFRM_QCU), AR5K_TXNOFRM); - - /* No queue has TXNOFRM enabled, disable the interrupt - * by setting AR5K_TXNOFRM to zero */ - if (ah->ah_txq_imr_nofrm == 0) - ath5k_hw_reg_write(ah, 0, AR5K_TXNOFRM); - - /* Set QCU mask for this DCU to save power */ - AR5K_REG_WRITE_Q(ah, AR5K_QUEUE_QCUMASK(queue), queue); - - return 0; -} - - -/**************************\ -* Global QCU/DCU functions * -\**************************/ - -/** - * ath5k_hw_set_ifs_intervals() - Set global inter-frame spaces on DCU - * @ah: The &struct ath5k_hw - * @slot_time: Slot time in us - * - * Sets the global IFS intervals on DCU (also works on AR5210) for - * the given slot time and the current bwmode. - */ -int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time) -{ - struct ieee80211_channel *channel = ah->ah_current_channel; - enum ieee80211_band band; - struct ieee80211_rate *rate; - u32 ack_tx_time, eifs, eifs_clock, sifs, sifs_clock; - u32 slot_time_clock = ath5k_hw_htoclock(ah, slot_time); - - if (slot_time < 6 || slot_time_clock > AR5K_SLOT_TIME_MAX) - return -EINVAL; - - sifs = ath5k_hw_get_default_sifs(ah); - sifs_clock = ath5k_hw_htoclock(ah, sifs - 2); - - /* EIFS - * Txtime of ack at lowest rate + SIFS + DIFS - * (DIFS = SIFS + 2 * Slot time) - * - * Note: HAL has some predefined values for EIFS - * Turbo: (37 + 2 * 6) - * Default: (74 + 2 * 9) - * Half: (149 + 2 * 13) - * Quarter: (298 + 2 * 21) - * - * (74 + 2 * 6) for AR5210 default and turbo ! - * - * According to the formula we have - * ack_tx_time = 25 for turbo and - * ack_tx_time = 42.5 * clock multiplier - * for default/half/quarter. - * - * This can't be right, 42 is what we would get - * from ath5k_hw_get_frame_dur_for_bwmode or - * ieee80211_generic_frame_duration for zero frame - * length and without SIFS ! - * - * Also we have different lowest rate for 802.11a - */ - if (channel->band == IEEE80211_BAND_5GHZ) - band = IEEE80211_BAND_5GHZ; - else - band = IEEE80211_BAND_2GHZ; - - rate = &ah->sbands[band].bitrates[0]; - ack_tx_time = ath5k_hw_get_frame_duration(ah, band, 10, rate, false); - - /* ack_tx_time includes an SIFS already */ - eifs = ack_tx_time + sifs + 2 * slot_time; - eifs_clock = ath5k_hw_htoclock(ah, eifs); - - /* Set IFS settings on AR5210 */ - if (ah->ah_version == AR5K_AR5210) { - u32 pifs, pifs_clock, difs, difs_clock; - - /* Set slot time */ - ath5k_hw_reg_write(ah, slot_time_clock, AR5K_SLOT_TIME); - - /* Set EIFS */ - eifs_clock = AR5K_REG_SM(eifs_clock, AR5K_IFS1_EIFS); - - /* PIFS = Slot time + SIFS */ - pifs = slot_time + sifs; - pifs_clock = ath5k_hw_htoclock(ah, pifs); - pifs_clock = AR5K_REG_SM(pifs_clock, AR5K_IFS1_PIFS); - - /* DIFS = SIFS + 2 * Slot time */ - difs = sifs + 2 * slot_time; - difs_clock = ath5k_hw_htoclock(ah, difs); - - /* Set SIFS/DIFS */ - ath5k_hw_reg_write(ah, (difs_clock << - AR5K_IFS0_DIFS_S) | sifs_clock, - AR5K_IFS0); - - /* Set PIFS/EIFS and preserve AR5K_INIT_CARR_SENSE_EN */ - ath5k_hw_reg_write(ah, pifs_clock | eifs_clock | - (AR5K_INIT_CARR_SENSE_EN << AR5K_IFS1_CS_EN_S), - AR5K_IFS1); - - return 0; - } - - /* Set IFS slot time */ - ath5k_hw_reg_write(ah, slot_time_clock, AR5K_DCU_GBL_IFS_SLOT); - - /* Set EIFS interval */ - ath5k_hw_reg_write(ah, eifs_clock, AR5K_DCU_GBL_IFS_EIFS); - - /* Set SIFS interval in usecs */ - AR5K_REG_WRITE_BITS(ah, AR5K_DCU_GBL_IFS_MISC, - AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC, - sifs); - - /* Set SIFS interval in clock cycles */ - ath5k_hw_reg_write(ah, sifs_clock, AR5K_DCU_GBL_IFS_SIFS); - - return 0; -} - - -/** - * ath5k_hw_init_queues() - Initialize tx queues - * @ah: The &struct ath5k_hw - * - * Initializes all tx queues based on information on - * ah->ah_txq* set by the driver - */ -int -ath5k_hw_init_queues(struct ath5k_hw *ah) -{ - int i, ret; - - /* TODO: HW Compression support for data queues */ - /* TODO: Burst prefetch for data queues */ - - /* - * Reset queues and start beacon timers at the end of the reset routine - * This also sets QCU mask on each DCU for 1:1 qcu to dcu mapping - * Note: If we want we can assign multiple qcus on one dcu. - */ - if (ah->ah_version != AR5K_AR5210) - for (i = 0; i < ah->ah_capabilities.cap_queues.q_tx_num; i++) { - ret = ath5k_hw_reset_tx_queue(ah, i); - if (ret) { - ATH5K_ERR(ah, - "failed to reset TX queue #%d\n", i); - return ret; - } - } - else - /* No QCU/DCU on AR5210, just set tx - * retry limits. We set IFS parameters - * on ath5k_hw_set_ifs_intervals */ - ath5k_hw_set_tx_retry_limits(ah, 0); - - /* Set the turbo flag when operating on 40MHz */ - if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) - AR5K_REG_ENABLE_BITS(ah, AR5K_DCU_GBL_IFS_MISC, - AR5K_DCU_GBL_IFS_MISC_TURBO_MODE); - - /* If we didn't set IFS timings through - * ath5k_hw_set_coverage_class make sure - * we set them here */ - if (!ah->ah_coverage_class) { - unsigned int slot_time = ath5k_hw_get_default_slottime(ah); - ath5k_hw_set_ifs_intervals(ah, slot_time); - } - - return 0; -} diff --git a/drivers/net/wireless/ath/ath5k/reg.h b/drivers/net/wireless/ath/ath5k/reg.h deleted file mode 100644 index 0ea1608b47fd..000000000000 --- a/drivers/net/wireless/ath/ath5k/reg.h +++ /dev/null @@ -1,2604 +0,0 @@ -/* - * Copyright (c) 2006-2008 Nick Kossifidis - * Copyright (c) 2004-2008 Reyk Floeter - * Copyright (c) 2007-2008 Michael Taylor - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* - * Register values for Atheros 5210/5211/5212 cards from OpenBSD's ar5k - * maintained by Reyk Floeter - * - * I tried to document those registers by looking at ar5k code, some - * 802.11 (802.11e mostly) papers and by reading various public available - * Atheros presentations and papers like these: - * - * 5210 - http://nova.stanford.edu/~bbaas/ps/isscc2002_slides.pdf - * - * 5211 - http://www.hotchips.org/archives/hc14/3_Tue/16_mcfarland.pdf - * - * This file also contains register values found on a memory dump of - * Atheros's ART program (Atheros Radio Test), on ath9k, on legacy-hal - * released by Atheros and on various debug messages found on the net. - */ - -#include "../reg.h" - -/*====MAC DMA REGISTERS====*/ - -/* - * AR5210-Specific TXDP registers - * 5210 has only 2 transmit queues so no DCU/QCU, just - * 2 transmit descriptor pointers... - */ -#define AR5K_NOQCU_TXDP0 0x0000 /* Queue 0 - data */ -#define AR5K_NOQCU_TXDP1 0x0004 /* Queue 1 - beacons */ - -/* - * Mac Control Register - */ -#define AR5K_CR 0x0008 /* Register Address */ -#define AR5K_CR_TXE0 0x00000001 /* TX Enable for queue 0 on 5210 */ -#define AR5K_CR_TXE1 0x00000002 /* TX Enable for queue 1 on 5210 */ -#define AR5K_CR_RXE 0x00000004 /* RX Enable */ -#define AR5K_CR_TXD0 0x00000008 /* TX Disable for queue 0 on 5210 */ -#define AR5K_CR_TXD1 0x00000010 /* TX Disable for queue 1 on 5210 */ -#define AR5K_CR_RXD 0x00000020 /* RX Disable */ -#define AR5K_CR_SWI 0x00000040 /* Software Interrupt */ - -/* - * RX Descriptor Pointer register - */ -#define AR5K_RXDP 0x000c - -/* - * Configuration and status register - */ -#define AR5K_CFG 0x0014 /* Register Address */ -#define AR5K_CFG_SWTD 0x00000001 /* Byte-swap TX descriptor (for big endian archs) */ -#define AR5K_CFG_SWTB 0x00000002 /* Byte-swap TX buffer */ -#define AR5K_CFG_SWRD 0x00000004 /* Byte-swap RX descriptor */ -#define AR5K_CFG_SWRB 0x00000008 /* Byte-swap RX buffer */ -#define AR5K_CFG_SWRG 0x00000010 /* Byte-swap Register access */ -#define AR5K_CFG_IBSS 0x00000020 /* 0-BSS, 1-IBSS [5211+] */ -#define AR5K_CFG_PHY_OK 0x00000100 /* [5211+] */ -#define AR5K_CFG_EEBS 0x00000200 /* EEPROM is busy */ -#define AR5K_CFG_CLKGD 0x00000400 /* Clock gated (Disable dynamic clock) */ -#define AR5K_CFG_TXCNT 0x00007800 /* Tx frame count (?) [5210] */ -#define AR5K_CFG_TXCNT_S 11 -#define AR5K_CFG_TXFSTAT 0x00008000 /* Tx frame status (?) [5210] */ -#define AR5K_CFG_TXFSTRT 0x00010000 /* [5210] */ -#define AR5K_CFG_PCI_THRES 0x00060000 /* PCI Master req q threshold [5211+] */ -#define AR5K_CFG_PCI_THRES_S 17 - -/* - * Interrupt enable register - */ -#define AR5K_IER 0x0024 /* Register Address */ -#define AR5K_IER_DISABLE 0x00000000 /* Disable card interrupts */ -#define AR5K_IER_ENABLE 0x00000001 /* Enable card interrupts */ - - -/* - * 0x0028 is Beacon Control Register on 5210 - * and first RTS duration register on 5211 - */ - -/* - * Beacon control register [5210] - */ -#define AR5K_BCR 0x0028 /* Register Address */ -#define AR5K_BCR_AP 0x00000000 /* AP mode */ -#define AR5K_BCR_ADHOC 0x00000001 /* Ad-Hoc mode */ -#define AR5K_BCR_BDMAE 0x00000002 /* DMA enable */ -#define AR5K_BCR_TQ1FV 0x00000004 /* Use Queue1 for CAB traffic */ -#define AR5K_BCR_TQ1V 0x00000008 /* Use Queue1 for Beacon traffic */ -#define AR5K_BCR_BCGET 0x00000010 - -/* - * First RTS duration register [5211] - */ -#define AR5K_RTSD0 0x0028 /* Register Address */ -#define AR5K_RTSD0_6 0x000000ff /* 6Mb RTS duration mask (?) */ -#define AR5K_RTSD0_6_S 0 /* 6Mb RTS duration shift (?) */ -#define AR5K_RTSD0_9 0x0000ff00 /* 9Mb*/ -#define AR5K_RTSD0_9_S 8 -#define AR5K_RTSD0_12 0x00ff0000 /* 12Mb*/ -#define AR5K_RTSD0_12_S 16 -#define AR5K_RTSD0_18 0xff000000 /* 16Mb*/ -#define AR5K_RTSD0_18_S 24 - - -/* - * 0x002c is Beacon Status Register on 5210 - * and second RTS duration register on 5211 - */ - -/* - * Beacon status register [5210] - * - * As i can see in ar5k_ar5210_tx_start Reyk uses some of the values of BCR - * for this register, so i guess TQ1V,TQ1FV and BDMAE have the same meaning - * here and SNP/SNAP means "snapshot" (so this register gets synced with BCR). - * So SNAPPEDBCRVALID should also stand for "snapped BCR -values- valid", so i - * renamed it to SNAPSHOTSVALID to make more sense. I really have no idea what - * else can it be. I also renamed SNPBCMD to SNPADHOC to match BCR. - */ -#define AR5K_BSR 0x002c /* Register Address */ -#define AR5K_BSR_BDLYSW 0x00000001 /* SW Beacon delay (?) */ -#define AR5K_BSR_BDLYDMA 0x00000002 /* DMA Beacon delay (?) */ -#define AR5K_BSR_TXQ1F 0x00000004 /* Beacon queue (1) finished */ -#define AR5K_BSR_ATIMDLY 0x00000008 /* ATIM delay (?) */ -#define AR5K_BSR_SNPADHOC 0x00000100 /* Ad-hoc mode set (?) */ -#define AR5K_BSR_SNPBDMAE 0x00000200 /* Beacon DMA enabled (?) */ -#define AR5K_BSR_SNPTQ1FV 0x00000400 /* Queue1 is used for CAB traffic (?) */ -#define AR5K_BSR_SNPTQ1V 0x00000800 /* Queue1 is used for Beacon traffic (?) */ -#define AR5K_BSR_SNAPSHOTSVALID 0x00001000 /* BCR snapshots are valid (?) */ -#define AR5K_BSR_SWBA_CNT 0x00ff0000 - -/* - * Second RTS duration register [5211] - */ -#define AR5K_RTSD1 0x002c /* Register Address */ -#define AR5K_RTSD1_24 0x000000ff /* 24Mb */ -#define AR5K_RTSD1_24_S 0 -#define AR5K_RTSD1_36 0x0000ff00 /* 36Mb */ -#define AR5K_RTSD1_36_S 8 -#define AR5K_RTSD1_48 0x00ff0000 /* 48Mb */ -#define AR5K_RTSD1_48_S 16 -#define AR5K_RTSD1_54 0xff000000 /* 54Mb */ -#define AR5K_RTSD1_54_S 24 - - -/* - * Transmit configuration register - */ -#define AR5K_TXCFG 0x0030 /* Register Address */ -#define AR5K_TXCFG_SDMAMR 0x00000007 /* DMA size (read) */ -#define AR5K_TXCFG_SDMAMR_S 0 -#define AR5K_TXCFG_B_MODE 0x00000008 /* Set b mode for 5111 (enable 2111) */ -#define AR5K_TXCFG_TXFSTP 0x00000008 /* TX DMA full Stop [5210] */ -#define AR5K_TXCFG_TXFULL 0x000003f0 /* TX Trigger level mask */ -#define AR5K_TXCFG_TXFULL_S 4 -#define AR5K_TXCFG_TXFULL_0B 0x00000000 -#define AR5K_TXCFG_TXFULL_64B 0x00000010 -#define AR5K_TXCFG_TXFULL_128B 0x00000020 -#define AR5K_TXCFG_TXFULL_192B 0x00000030 -#define AR5K_TXCFG_TXFULL_256B 0x00000040 -#define AR5K_TXCFG_TXCONT_EN 0x00000080 -#define AR5K_TXCFG_DMASIZE 0x00000100 /* Flag for passing DMA size [5210] */ -#define AR5K_TXCFG_JUMBO_DESC_EN 0x00000400 /* Enable jumbo tx descriptors [5211+] */ -#define AR5K_TXCFG_ADHOC_BCN_ATIM 0x00000800 /* Adhoc Beacon ATIM Policy */ -#define AR5K_TXCFG_ATIM_WINDOW_DEF_DIS 0x00001000 /* Disable ATIM window defer [5211+] */ -#define AR5K_TXCFG_RTSRND 0x00001000 /* [5211+] */ -#define AR5K_TXCFG_FRMPAD_DIS 0x00002000 /* [5211+] */ -#define AR5K_TXCFG_RDY_CBR_DIS 0x00004000 /* Ready time CBR disable [5211+] */ -#define AR5K_TXCFG_JUMBO_FRM_MODE 0x00008000 /* Jumbo frame mode [5211+] */ -#define AR5K_TXCFG_DCU_DBL_BUF_DIS 0x00008000 /* Disable double buffering on DCU */ -#define AR5K_TXCFG_DCU_CACHING_DIS 0x00010000 /* Disable DCU caching */ - -/* - * Receive configuration register - */ -#define AR5K_RXCFG 0x0034 /* Register Address */ -#define AR5K_RXCFG_SDMAMW 0x00000007 /* DMA size (write) */ -#define AR5K_RXCFG_SDMAMW_S 0 -#define AR5K_RXCFG_ZLFDMA 0x00000008 /* Enable Zero-length frame DMA */ -#define AR5K_RXCFG_DEF_ANTENNA 0x00000010 /* Default antenna (?) */ -#define AR5K_RXCFG_JUMBO_RXE 0x00000020 /* Enable jumbo rx descriptors [5211+] */ -#define AR5K_RXCFG_JUMBO_WRAP 0x00000040 /* Wrap jumbo frames [5211+] */ -#define AR5K_RXCFG_SLE_ENTRY 0x00000080 /* Sleep entry policy */ - -/* - * Receive jumbo descriptor last address register - * Only found in 5211 (?) - */ -#define AR5K_RXJLA 0x0038 - -/* - * MIB control register - */ -#define AR5K_MIBC 0x0040 /* Register Address */ -#define AR5K_MIBC_COW 0x00000001 /* Counter Overflow Warning */ -#define AR5K_MIBC_FMC 0x00000002 /* Freeze MIB Counters */ -#define AR5K_MIBC_CMC 0x00000004 /* Clear MIB Counters */ -#define AR5K_MIBC_MCS 0x00000008 /* MIB counter strobe, increment all */ - -/* - * Timeout prescale register - */ -#define AR5K_TOPS 0x0044 -#define AR5K_TOPS_M 0x0000ffff - -/* - * Receive timeout register (no frame received) - */ -#define AR5K_RXNOFRM 0x0048 -#define AR5K_RXNOFRM_M 0x000003ff - -/* - * Transmit timeout register (no frame sent) - */ -#define AR5K_TXNOFRM 0x004c -#define AR5K_TXNOFRM_M 0x000003ff -#define AR5K_TXNOFRM_QCU 0x000ffc00 -#define AR5K_TXNOFRM_QCU_S 10 - -/* - * Receive frame gap timeout register - */ -#define AR5K_RPGTO 0x0050 -#define AR5K_RPGTO_M 0x000003ff - -/* - * Receive frame count limit register - */ -#define AR5K_RFCNT 0x0054 -#define AR5K_RFCNT_M 0x0000001f /* [5211+] (?) */ -#define AR5K_RFCNT_RFCL 0x0000000f /* [5210] */ - -/* - * Misc settings register - * (reserved0-3) - */ -#define AR5K_MISC 0x0058 /* Register Address */ -#define AR5K_MISC_DMA_OBS_M 0x000001e0 -#define AR5K_MISC_DMA_OBS_S 5 -#define AR5K_MISC_MISC_OBS_M 0x00000e00 -#define AR5K_MISC_MISC_OBS_S 9 -#define AR5K_MISC_MAC_OBS_LSB_M 0x00007000 -#define AR5K_MISC_MAC_OBS_LSB_S 12 -#define AR5K_MISC_MAC_OBS_MSB_M 0x00038000 -#define AR5K_MISC_MAC_OBS_MSB_S 15 -#define AR5K_MISC_LED_DECAY 0x001c0000 /* [5210] */ -#define AR5K_MISC_LED_BLINK 0x00e00000 /* [5210] */ - -/* - * QCU/DCU clock gating register (5311) - * (reserved4-5) - */ -#define AR5K_QCUDCU_CLKGT 0x005c /* Register Address (?) */ -#define AR5K_QCUDCU_CLKGT_QCU 0x0000ffff /* Mask for QCU clock */ -#define AR5K_QCUDCU_CLKGT_DCU 0x07ff0000 /* Mask for DCU clock */ - -/* - * Interrupt Status Registers - * - * For 5210 there is only one status register but for - * 5211/5212 we have one primary and 4 secondary registers. - * So we have AR5K_ISR for 5210 and AR5K_PISR /SISRx for 5211/5212. - * Most of these bits are common for all chipsets. - * - * NOTE: On 5211+ TXOK, TXDESC, TXERR, TXEOL and TXURN contain - * the logical OR from per-queue interrupt bits found on SISR registers - * (see below). - */ -#define AR5K_ISR 0x001c /* Register Address [5210] */ -#define AR5K_PISR 0x0080 /* Register Address [5211+] */ -#define AR5K_ISR_RXOK 0x00000001 /* Frame successfully received */ -#define AR5K_ISR_RXDESC 0x00000002 /* RX descriptor request */ -#define AR5K_ISR_RXERR 0x00000004 /* Receive error */ -#define AR5K_ISR_RXNOFRM 0x00000008 /* No frame received (receive timeout) */ -#define AR5K_ISR_RXEOL 0x00000010 /* Empty RX descriptor */ -#define AR5K_ISR_RXORN 0x00000020 /* Receive FIFO overrun */ -#define AR5K_ISR_TXOK 0x00000040 /* Frame successfully transmitted */ -#define AR5K_ISR_TXDESC 0x00000080 /* TX descriptor request */ -#define AR5K_ISR_TXERR 0x00000100 /* Transmit error */ -#define AR5K_ISR_TXNOFRM 0x00000200 /* No frame transmitted (transmit timeout) - * NOTE: We don't have per-queue info for this - * one, but we can enable it per-queue through - * TXNOFRM_QCU field on TXNOFRM register */ -#define AR5K_ISR_TXEOL 0x00000400 /* Empty TX descriptor */ -#define AR5K_ISR_TXURN 0x00000800 /* Transmit FIFO underrun */ -#define AR5K_ISR_MIB 0x00001000 /* Update MIB counters */ -#define AR5K_ISR_SWI 0x00002000 /* Software interrupt */ -#define AR5K_ISR_RXPHY 0x00004000 /* PHY error */ -#define AR5K_ISR_RXKCM 0x00008000 /* RX Key cache miss */ -#define AR5K_ISR_SWBA 0x00010000 /* Software beacon alert */ -#define AR5K_ISR_BRSSI 0x00020000 /* Beacon rssi below threshold (?) */ -#define AR5K_ISR_BMISS 0x00040000 /* Beacon missed */ -#define AR5K_ISR_HIUERR 0x00080000 /* Host Interface Unit error [5211+] - * 'or' of MCABT, SSERR, DPERR from SISR2 */ -#define AR5K_ISR_BNR 0x00100000 /* Beacon not ready [5211+] */ -#define AR5K_ISR_MCABT 0x00100000 /* Master Cycle Abort [5210] */ -#define AR5K_ISR_RXCHIRP 0x00200000 /* CHIRP Received [5212+] */ -#define AR5K_ISR_SSERR 0x00200000 /* Signaled System Error [5210] */ -#define AR5K_ISR_DPERR 0x00400000 /* Bus parity error [5210] */ -#define AR5K_ISR_RXDOPPLER 0x00400000 /* Doppler chirp received [5212+] */ -#define AR5K_ISR_TIM 0x00800000 /* [5211+] */ -#define AR5K_ISR_BCNMISC 0x00800000 /* Misc beacon related interrupt - * 'or' of TIM, CAB_END, DTIM_SYNC, BCN_TIMEOUT, - * CAB_TIMEOUT and DTIM bits from SISR2 [5212+] */ -#define AR5K_ISR_GPIO 0x01000000 /* GPIO (rf kill) */ -#define AR5K_ISR_QCBRORN 0x02000000 /* QCU CBR overrun [5211+] */ -#define AR5K_ISR_QCBRURN 0x04000000 /* QCU CBR underrun [5211+] */ -#define AR5K_ISR_QTRIG 0x08000000 /* QCU scheduling trigger [5211+] */ - -#define AR5K_ISR_BITS_FROM_SISRS (AR5K_ISR_TXOK | AR5K_ISR_TXDESC |\ - AR5K_ISR_TXERR | AR5K_ISR_TXEOL |\ - AR5K_ISR_TXURN | AR5K_ISR_HIUERR |\ - AR5K_ISR_BCNMISC | AR5K_ISR_QCBRORN |\ - AR5K_ISR_QCBRURN | AR5K_ISR_QTRIG) - -/* - * Secondary status registers [5211+] (0 - 4) - * - * These give the status for each QCU, only QCUs 0-9 are - * represented. - */ -#define AR5K_SISR0 0x0084 /* Register Address [5211+] */ -#define AR5K_SISR0_QCU_TXOK 0x000003ff /* Mask for QCU_TXOK */ -#define AR5K_SISR0_QCU_TXOK_S 0 -#define AR5K_SISR0_QCU_TXDESC 0x03ff0000 /* Mask for QCU_TXDESC */ -#define AR5K_SISR0_QCU_TXDESC_S 16 - -#define AR5K_SISR1 0x0088 /* Register Address [5211+] */ -#define AR5K_SISR1_QCU_TXERR 0x000003ff /* Mask for QCU_TXERR */ -#define AR5K_SISR1_QCU_TXERR_S 0 -#define AR5K_SISR1_QCU_TXEOL 0x03ff0000 /* Mask for QCU_TXEOL */ -#define AR5K_SISR1_QCU_TXEOL_S 16 - -#define AR5K_SISR2 0x008c /* Register Address [5211+] */ -#define AR5K_SISR2_QCU_TXURN 0x000003ff /* Mask for QCU_TXURN */ -#define AR5K_SISR2_QCU_TXURN_S 0 -#define AR5K_SISR2_MCABT 0x00010000 /* Master Cycle Abort */ -#define AR5K_SISR2_SSERR 0x00020000 /* Signaled System Error */ -#define AR5K_SISR2_DPERR 0x00040000 /* Bus parity error */ -#define AR5K_SISR2_TIM 0x01000000 /* [5212+] */ -#define AR5K_SISR2_CAB_END 0x02000000 /* [5212+] */ -#define AR5K_SISR2_DTIM_SYNC 0x04000000 /* DTIM sync lost [5212+] */ -#define AR5K_SISR2_BCN_TIMEOUT 0x08000000 /* Beacon Timeout [5212+] */ -#define AR5K_SISR2_CAB_TIMEOUT 0x10000000 /* CAB Timeout [5212+] */ -#define AR5K_SISR2_DTIM 0x20000000 /* [5212+] */ -#define AR5K_SISR2_TSFOOR 0x80000000 /* TSF Out of range */ - -#define AR5K_SISR3 0x0090 /* Register Address [5211+] */ -#define AR5K_SISR3_QCBRORN 0x000003ff /* Mask for QCBRORN */ -#define AR5K_SISR3_QCBRORN_S 0 -#define AR5K_SISR3_QCBRURN 0x03ff0000 /* Mask for QCBRURN */ -#define AR5K_SISR3_QCBRURN_S 16 - -#define AR5K_SISR4 0x0094 /* Register Address [5211+] */ -#define AR5K_SISR4_QTRIG 0x000003ff /* Mask for QTRIG */ -#define AR5K_SISR4_QTRIG_S 0 - -/* - * Shadow read-and-clear interrupt status registers [5211+] - */ -#define AR5K_RAC_PISR 0x00c0 /* Read and clear PISR */ -#define AR5K_RAC_SISR0 0x00c4 /* Read and clear SISR0 */ -#define AR5K_RAC_SISR1 0x00c8 /* Read and clear SISR1 */ -#define AR5K_RAC_SISR2 0x00cc /* Read and clear SISR2 */ -#define AR5K_RAC_SISR3 0x00d0 /* Read and clear SISR3 */ -#define AR5K_RAC_SISR4 0x00d4 /* Read and clear SISR4 */ - -/* - * Interrupt Mask Registers - * - * As with ISRs 5210 has one IMR (AR5K_IMR) and 5211/5212 has one primary - * (AR5K_PIMR) and 4 secondary IMRs (AR5K_SIMRx). Note that ISR/IMR flags match. - */ -#define AR5K_IMR 0x0020 /* Register Address [5210] */ -#define AR5K_PIMR 0x00a0 /* Register Address [5211+] */ -#define AR5K_IMR_RXOK 0x00000001 /* Frame successfully received*/ -#define AR5K_IMR_RXDESC 0x00000002 /* RX descriptor request*/ -#define AR5K_IMR_RXERR 0x00000004 /* Receive error*/ -#define AR5K_IMR_RXNOFRM 0x00000008 /* No frame received (receive timeout)*/ -#define AR5K_IMR_RXEOL 0x00000010 /* Empty RX descriptor*/ -#define AR5K_IMR_RXORN 0x00000020 /* Receive FIFO overrun*/ -#define AR5K_IMR_TXOK 0x00000040 /* Frame successfully transmitted*/ -#define AR5K_IMR_TXDESC 0x00000080 /* TX descriptor request*/ -#define AR5K_IMR_TXERR 0x00000100 /* Transmit error*/ -#define AR5K_IMR_TXNOFRM 0x00000200 /* No frame transmitted (transmit timeout)*/ -#define AR5K_IMR_TXEOL 0x00000400 /* Empty TX descriptor*/ -#define AR5K_IMR_TXURN 0x00000800 /* Transmit FIFO underrun*/ -#define AR5K_IMR_MIB 0x00001000 /* Update MIB counters*/ -#define AR5K_IMR_SWI 0x00002000 /* Software interrupt */ -#define AR5K_IMR_RXPHY 0x00004000 /* PHY error*/ -#define AR5K_IMR_RXKCM 0x00008000 /* RX Key cache miss */ -#define AR5K_IMR_SWBA 0x00010000 /* Software beacon alert*/ -#define AR5K_IMR_BRSSI 0x00020000 /* Beacon rssi below threshold (?) */ -#define AR5K_IMR_BMISS 0x00040000 /* Beacon missed*/ -#define AR5K_IMR_HIUERR 0x00080000 /* Host Interface Unit error [5211+] */ -#define AR5K_IMR_BNR 0x00100000 /* Beacon not ready [5211+] */ -#define AR5K_IMR_MCABT 0x00100000 /* Master Cycle Abort [5210] */ -#define AR5K_IMR_RXCHIRP 0x00200000 /* CHIRP Received [5212+]*/ -#define AR5K_IMR_SSERR 0x00200000 /* Signaled System Error [5210] */ -#define AR5K_IMR_DPERR 0x00400000 /* Det par Error (?) [5210] */ -#define AR5K_IMR_RXDOPPLER 0x00400000 /* Doppler chirp received [5212+] */ -#define AR5K_IMR_TIM 0x00800000 /* [5211+] */ -#define AR5K_IMR_BCNMISC 0x00800000 /* 'or' of TIM, CAB_END, DTIM_SYNC, BCN_TIMEOUT, - CAB_TIMEOUT and DTIM bits from SISR2 [5212+] */ -#define AR5K_IMR_GPIO 0x01000000 /* GPIO (rf kill)*/ -#define AR5K_IMR_QCBRORN 0x02000000 /* QCU CBR overrun (?) [5211+] */ -#define AR5K_IMR_QCBRURN 0x04000000 /* QCU CBR underrun (?) [5211+] */ -#define AR5K_IMR_QTRIG 0x08000000 /* QCU scheduling trigger [5211+] */ - -/* - * Secondary interrupt mask registers [5211+] (0 - 4) - */ -#define AR5K_SIMR0 0x00a4 /* Register Address [5211+] */ -#define AR5K_SIMR0_QCU_TXOK 0x000003ff /* Mask for QCU_TXOK */ -#define AR5K_SIMR0_QCU_TXOK_S 0 -#define AR5K_SIMR0_QCU_TXDESC 0x03ff0000 /* Mask for QCU_TXDESC */ -#define AR5K_SIMR0_QCU_TXDESC_S 16 - -#define AR5K_SIMR1 0x00a8 /* Register Address [5211+] */ -#define AR5K_SIMR1_QCU_TXERR 0x000003ff /* Mask for QCU_TXERR */ -#define AR5K_SIMR1_QCU_TXERR_S 0 -#define AR5K_SIMR1_QCU_TXEOL 0x03ff0000 /* Mask for QCU_TXEOL */ -#define AR5K_SIMR1_QCU_TXEOL_S 16 - -#define AR5K_SIMR2 0x00ac /* Register Address [5211+] */ -#define AR5K_SIMR2_QCU_TXURN 0x000003ff /* Mask for QCU_TXURN */ -#define AR5K_SIMR2_QCU_TXURN_S 0 -#define AR5K_SIMR2_MCABT 0x00010000 /* Master Cycle Abort */ -#define AR5K_SIMR2_SSERR 0x00020000 /* Signaled System Error */ -#define AR5K_SIMR2_DPERR 0x00040000 /* Bus parity error */ -#define AR5K_SIMR2_TIM 0x01000000 /* [5212+] */ -#define AR5K_SIMR2_CAB_END 0x02000000 /* [5212+] */ -#define AR5K_SIMR2_DTIM_SYNC 0x04000000 /* DTIM Sync lost [5212+] */ -#define AR5K_SIMR2_BCN_TIMEOUT 0x08000000 /* Beacon Timeout [5212+] */ -#define AR5K_SIMR2_CAB_TIMEOUT 0x10000000 /* CAB Timeout [5212+] */ -#define AR5K_SIMR2_DTIM 0x20000000 /* [5212+] */ -#define AR5K_SIMR2_TSFOOR 0x80000000 /* TSF OOR (?) */ - -#define AR5K_SIMR3 0x00b0 /* Register Address [5211+] */ -#define AR5K_SIMR3_QCBRORN 0x000003ff /* Mask for QCBRORN */ -#define AR5K_SIMR3_QCBRORN_S 0 -#define AR5K_SIMR3_QCBRURN 0x03ff0000 /* Mask for QCBRURN */ -#define AR5K_SIMR3_QCBRURN_S 16 - -#define AR5K_SIMR4 0x00b4 /* Register Address [5211+] */ -#define AR5K_SIMR4_QTRIG 0x000003ff /* Mask for QTRIG */ -#define AR5K_SIMR4_QTRIG_S 0 - -/* - * DMA Debug registers 0-7 - * 0xe0 - 0xfc - */ - -/* - * Decompression mask registers [5212+] - */ -#define AR5K_DCM_ADDR 0x0400 /*Decompression mask address (index) */ -#define AR5K_DCM_DATA 0x0404 /*Decompression mask data */ - -/* - * Wake On Wireless pattern control register [5212+] - */ -#define AR5K_WOW_PCFG 0x0410 /* Register Address */ -#define AR5K_WOW_PCFG_PAT_MATCH_EN 0x00000001 /* Pattern match enable */ -#define AR5K_WOW_PCFG_LONG_FRAME_POL 0x00000002 /* Long frame policy */ -#define AR5K_WOW_PCFG_WOBMISS 0x00000004 /* Wake on bea(con) miss (?) */ -#define AR5K_WOW_PCFG_PAT_0_EN 0x00000100 /* Enable pattern 0 */ -#define AR5K_WOW_PCFG_PAT_1_EN 0x00000200 /* Enable pattern 1 */ -#define AR5K_WOW_PCFG_PAT_2_EN 0x00000400 /* Enable pattern 2 */ -#define AR5K_WOW_PCFG_PAT_3_EN 0x00000800 /* Enable pattern 3 */ -#define AR5K_WOW_PCFG_PAT_4_EN 0x00001000 /* Enable pattern 4 */ -#define AR5K_WOW_PCFG_PAT_5_EN 0x00002000 /* Enable pattern 5 */ - -/* - * Wake On Wireless pattern index register (?) [5212+] - */ -#define AR5K_WOW_PAT_IDX 0x0414 - -/* - * Wake On Wireless pattern data register [5212+] - */ -#define AR5K_WOW_PAT_DATA 0x0418 /* Register Address */ -#define AR5K_WOW_PAT_DATA_0_3_V 0x00000001 /* Pattern 0, 3 value */ -#define AR5K_WOW_PAT_DATA_1_4_V 0x00000100 /* Pattern 1, 4 value */ -#define AR5K_WOW_PAT_DATA_2_5_V 0x00010000 /* Pattern 2, 5 value */ -#define AR5K_WOW_PAT_DATA_0_3_M 0x01000000 /* Pattern 0, 3 mask */ -#define AR5K_WOW_PAT_DATA_1_4_M 0x04000000 /* Pattern 1, 4 mask */ -#define AR5K_WOW_PAT_DATA_2_5_M 0x10000000 /* Pattern 2, 5 mask */ - -/* - * Decompression configuration registers [5212+] - */ -#define AR5K_DCCFG 0x0420 /* Register Address */ -#define AR5K_DCCFG_GLOBAL_EN 0x00000001 /* Enable decompression on all queues */ -#define AR5K_DCCFG_BYPASS_EN 0x00000002 /* Bypass decompression */ -#define AR5K_DCCFG_BCAST_EN 0x00000004 /* Enable decompression for bcast frames */ -#define AR5K_DCCFG_MCAST_EN 0x00000008 /* Enable decompression for mcast frames */ - -/* - * Compression configuration registers [5212+] - */ -#define AR5K_CCFG 0x0600 /* Register Address */ -#define AR5K_CCFG_WINDOW_SIZE 0x00000007 /* Compression window size */ -#define AR5K_CCFG_CPC_EN 0x00000008 /* Enable performance counters */ - -#define AR5K_CCFG_CCU 0x0604 /* Register Address */ -#define AR5K_CCFG_CCU_CUP_EN 0x00000001 /* CCU Catchup enable */ -#define AR5K_CCFG_CCU_CREDIT 0x00000002 /* CCU Credit (field) */ -#define AR5K_CCFG_CCU_CD_THRES 0x00000080 /* CCU Cyc(lic?) debt threshold (field) */ -#define AR5K_CCFG_CCU_CUP_LCNT 0x00010000 /* CCU Catchup lit(?) count */ -#define AR5K_CCFG_CCU_INIT 0x00100200 /* Initial value during reset */ - -/* - * Compression performance counter registers [5212+] - */ -#define AR5K_CPC0 0x0610 /* Compression performance counter 0 */ -#define AR5K_CPC1 0x0614 /* Compression performance counter 1*/ -#define AR5K_CPC2 0x0618 /* Compression performance counter 2 */ -#define AR5K_CPC3 0x061c /* Compression performance counter 3 */ -#define AR5K_CPCOVF 0x0620 /* Compression performance overflow */ - - -/* - * Queue control unit (QCU) registers [5211+] - * - * Card has 12 TX Queues but i see that only 0-9 are used (?) - * both in binary HAL (see ah.h) and ar5k. Each queue has it's own - * TXDP at addresses 0x0800 - 0x082c, a CBR (Constant Bit Rate) - * configuration register (0x08c0 - 0x08ec), a ready time configuration - * register (0x0900 - 0x092c), a misc configuration register (0x09c0 - - * 0x09ec) and a status register (0x0a00 - 0x0a2c). We also have some - * global registers, QCU transmit enable/disable and "one shot arm (?)" - * set/clear, which contain status for all queues (we shift by 1 for each - * queue). To access these registers easily we define some macros here - * that are used inside HAL. For more infos check out *_tx_queue functs. - */ - -/* - * Generic QCU Register access macros - */ -#define AR5K_QUEUE_REG(_r, _q) (((_q) << 2) + _r) -#define AR5K_QCU_GLOBAL_READ(_r, _q) (AR5K_REG_READ(_r) & (1 << _q)) -#define AR5K_QCU_GLOBAL_WRITE(_r, _q) AR5K_REG_WRITE(_r, (1 << _q)) - -/* - * QCU Transmit descriptor pointer registers - */ -#define AR5K_QCU_TXDP_BASE 0x0800 /* Register Address - Queue0 TXDP */ -#define AR5K_QUEUE_TXDP(_q) AR5K_QUEUE_REG(AR5K_QCU_TXDP_BASE, _q) - -/* - * QCU Transmit enable register - */ -#define AR5K_QCU_TXE 0x0840 -#define AR5K_ENABLE_QUEUE(_q) AR5K_QCU_GLOBAL_WRITE(AR5K_QCU_TXE, _q) -#define AR5K_QUEUE_ENABLED(_q) AR5K_QCU_GLOBAL_READ(AR5K_QCU_TXE, _q) - -/* - * QCU Transmit disable register - */ -#define AR5K_QCU_TXD 0x0880 -#define AR5K_DISABLE_QUEUE(_q) AR5K_QCU_GLOBAL_WRITE(AR5K_QCU_TXD, _q) -#define AR5K_QUEUE_DISABLED(_q) AR5K_QCU_GLOBAL_READ(AR5K_QCU_TXD, _q) - -/* - * QCU Constant Bit Rate configuration registers - */ -#define AR5K_QCU_CBRCFG_BASE 0x08c0 /* Register Address - Queue0 CBRCFG */ -#define AR5K_QCU_CBRCFG_INTVAL 0x00ffffff /* CBR Interval mask */ -#define AR5K_QCU_CBRCFG_INTVAL_S 0 -#define AR5K_QCU_CBRCFG_ORN_THRES 0xff000000 /* CBR overrun threshold mask */ -#define AR5K_QCU_CBRCFG_ORN_THRES_S 24 -#define AR5K_QUEUE_CBRCFG(_q) AR5K_QUEUE_REG(AR5K_QCU_CBRCFG_BASE, _q) - -/* - * QCU Ready time configuration registers - */ -#define AR5K_QCU_RDYTIMECFG_BASE 0x0900 /* Register Address - Queue0 RDYTIMECFG */ -#define AR5K_QCU_RDYTIMECFG_INTVAL 0x00ffffff /* Ready time interval mask */ -#define AR5K_QCU_RDYTIMECFG_INTVAL_S 0 -#define AR5K_QCU_RDYTIMECFG_ENABLE 0x01000000 /* Ready time enable mask */ -#define AR5K_QUEUE_RDYTIMECFG(_q) AR5K_QUEUE_REG(AR5K_QCU_RDYTIMECFG_BASE, _q) - -/* - * QCU one shot arm set registers - */ -#define AR5K_QCU_ONESHOTARM_SET 0x0940 /* Register Address -QCU "one shot arm set (?)" */ -#define AR5K_QCU_ONESHOTARM_SET_M 0x0000ffff - -/* - * QCU one shot arm clear registers - */ -#define AR5K_QCU_ONESHOTARM_CLEAR 0x0980 /* Register Address -QCU "one shot arm clear (?)" */ -#define AR5K_QCU_ONESHOTARM_CLEAR_M 0x0000ffff - -/* - * QCU misc registers - */ -#define AR5K_QCU_MISC_BASE 0x09c0 /* Register Address -Queue0 MISC */ -#define AR5K_QCU_MISC_FRSHED_M 0x0000000f /* Frame scheduling mask */ -#define AR5K_QCU_MISC_FRSHED_ASAP 0 /* ASAP */ -#define AR5K_QCU_MISC_FRSHED_CBR 1 /* Constant Bit Rate */ -#define AR5K_QCU_MISC_FRSHED_DBA_GT 2 /* DMA Beacon alert gated */ -#define AR5K_QCU_MISC_FRSHED_TIM_GT 3 /* TIMT gated */ -#define AR5K_QCU_MISC_FRSHED_BCN_SENT_GT 4 /* Beacon sent gated */ -#define AR5K_QCU_MISC_ONESHOT_ENABLE 0x00000010 /* Oneshot enable */ -#define AR5K_QCU_MISC_CBREXP_DIS 0x00000020 /* Disable CBR expired counter (normal queue) */ -#define AR5K_QCU_MISC_CBREXP_BCN_DIS 0x00000040 /* Disable CBR expired counter (beacon queue) */ -#define AR5K_QCU_MISC_BCN_ENABLE 0x00000080 /* Enable Beacon use */ -#define AR5K_QCU_MISC_CBR_THRES_ENABLE 0x00000100 /* CBR expired threshold enabled */ -#define AR5K_QCU_MISC_RDY_VEOL_POLICY 0x00000200 /* TXE reset when RDYTIME expired or VEOL */ -#define AR5K_QCU_MISC_CBR_RESET_CNT 0x00000400 /* CBR threshold (counter) reset */ -#define AR5K_QCU_MISC_DCU_EARLY 0x00000800 /* DCU early termination */ -#define AR5K_QCU_MISC_DCU_CMP_EN 0x00001000 /* Enable frame compression */ -#define AR5K_QUEUE_MISC(_q) AR5K_QUEUE_REG(AR5K_QCU_MISC_BASE, _q) - - -/* - * QCU status registers - */ -#define AR5K_QCU_STS_BASE 0x0a00 /* Register Address - Queue0 STS */ -#define AR5K_QCU_STS_FRMPENDCNT 0x00000003 /* Frames pending counter */ -#define AR5K_QCU_STS_CBREXPCNT 0x0000ff00 /* CBR expired counter */ -#define AR5K_QUEUE_STATUS(_q) AR5K_QUEUE_REG(AR5K_QCU_STS_BASE, _q) - -/* - * QCU ready time shutdown register - */ -#define AR5K_QCU_RDYTIMESHDN 0x0a40 -#define AR5K_QCU_RDYTIMESHDN_M 0x000003ff - -/* - * QCU compression buffer base registers [5212+] - */ -#define AR5K_QCU_CBB_SELECT 0x0b00 -#define AR5K_QCU_CBB_ADDR 0x0b04 -#define AR5K_QCU_CBB_ADDR_S 9 - -/* - * QCU compression buffer configuration register [5212+] - * (buffer size) - */ -#define AR5K_QCU_CBCFG 0x0b08 - - - -/* - * Distributed Coordination Function (DCF) control unit (DCU) - * registers [5211+] - * - * These registers control the various characteristics of each queue - * for 802.11e (WME) compatibility so they go together with - * QCU registers in pairs. For each queue we have a QCU mask register, - * (0x1000 - 0x102c), a local-IFS settings register (0x1040 - 0x106c), - * a retry limit register (0x1080 - 0x10ac), a channel time register - * (0x10c0 - 0x10ec), a misc-settings register (0x1100 - 0x112c) and - * a sequence number register (0x1140 - 0x116c). It seems that "global" - * registers here affect all queues (see use of DCU_GBL_IFS_SLOT in ar5k). - * We use the same macros here for easier register access. - * - */ - -/* - * DCU QCU mask registers - */ -#define AR5K_DCU_QCUMASK_BASE 0x1000 /* Register Address -Queue0 DCU_QCUMASK */ -#define AR5K_DCU_QCUMASK_M 0x000003ff -#define AR5K_QUEUE_QCUMASK(_q) AR5K_QUEUE_REG(AR5K_DCU_QCUMASK_BASE, _q) - -/* - * DCU local Inter Frame Space settings register - */ -#define AR5K_DCU_LCL_IFS_BASE 0x1040 /* Register Address -Queue0 DCU_LCL_IFS */ -#define AR5K_DCU_LCL_IFS_CW_MIN 0x000003ff /* Minimum Contention Window */ -#define AR5K_DCU_LCL_IFS_CW_MIN_S 0 -#define AR5K_DCU_LCL_IFS_CW_MAX 0x000ffc00 /* Maximum Contention Window */ -#define AR5K_DCU_LCL_IFS_CW_MAX_S 10 -#define AR5K_DCU_LCL_IFS_AIFS 0x0ff00000 /* Arbitrated Interframe Space */ -#define AR5K_DCU_LCL_IFS_AIFS_S 20 -#define AR5K_DCU_LCL_IFS_AIFS_MAX 0xfc /* Anything above that can cause DCU to hang */ -#define AR5K_QUEUE_DFS_LOCAL_IFS(_q) AR5K_QUEUE_REG(AR5K_DCU_LCL_IFS_BASE, _q) - -/* - * DCU retry limit registers - * all these fields don't allow zero values - */ -#define AR5K_DCU_RETRY_LMT_BASE 0x1080 /* Register Address -Queue0 DCU_RETRY_LMT */ -#define AR5K_DCU_RETRY_LMT_RTS 0x0000000f /* RTS failure limit. Transmission fails if no CTS is received for this number of times */ -#define AR5K_DCU_RETRY_LMT_RTS_S 0 -#define AR5K_DCU_RETRY_LMT_STA_RTS 0x00003f00 /* STA RTS failure limit. If exceeded CW reset */ -#define AR5K_DCU_RETRY_LMT_STA_RTS_S 8 -#define AR5K_DCU_RETRY_LMT_STA_DATA 0x000fc000 /* STA data failure limit. If exceeded CW reset. */ -#define AR5K_DCU_RETRY_LMT_STA_DATA_S 14 -#define AR5K_QUEUE_DFS_RETRY_LIMIT(_q) AR5K_QUEUE_REG(AR5K_DCU_RETRY_LMT_BASE, _q) - -/* - * DCU channel time registers - */ -#define AR5K_DCU_CHAN_TIME_BASE 0x10c0 /* Register Address -Queue0 DCU_CHAN_TIME */ -#define AR5K_DCU_CHAN_TIME_DUR 0x000fffff /* Channel time duration */ -#define AR5K_DCU_CHAN_TIME_DUR_S 0 -#define AR5K_DCU_CHAN_TIME_ENABLE 0x00100000 /* Enable channel time */ -#define AR5K_QUEUE_DFS_CHANNEL_TIME(_q) AR5K_QUEUE_REG(AR5K_DCU_CHAN_TIME_BASE, _q) - -/* - * DCU misc registers [5211+] - * - * Note: Arbiter lockout control controls the - * behaviour on low priority queues when we have multiple queues - * with pending frames. Intra-frame lockout means we wait until - * the queue's current frame transmits (with post frame backoff and bursting) - * before we transmit anything else and global lockout means we - * wait for the whole queue to finish before higher priority queues - * can transmit (this is used on beacon and CAB queues). - * No lockout means there is no special handling. - */ -#define AR5K_DCU_MISC_BASE 0x1100 /* Register Address -Queue0 DCU_MISC */ -#define AR5K_DCU_MISC_BACKOFF 0x0000003f /* Mask for backoff threshold */ -#define AR5K_DCU_MISC_ETS_RTS_POL 0x00000040 /* End of transmission series - station RTS/data failure count - reset policy (?) */ -#define AR5K_DCU_MISC_ETS_CW_POL 0x00000080 /* End of transmission series - CW reset policy */ -#define AR5K_DCU_MISC_FRAG_WAIT 0x00000100 /* Wait for next fragment */ -#define AR5K_DCU_MISC_BACKOFF_FRAG 0x00000200 /* Enable backoff while bursting */ -#define AR5K_DCU_MISC_HCFPOLL_ENABLE 0x00000800 /* CF - Poll enable */ -#define AR5K_DCU_MISC_BACKOFF_PERSIST 0x00001000 /* Persistent backoff */ -#define AR5K_DCU_MISC_FRMPRFTCH_ENABLE 0x00002000 /* Enable frame pre-fetch */ -#define AR5K_DCU_MISC_VIRTCOL 0x0000c000 /* Mask for Virtual Collision (?) */ -#define AR5K_DCU_MISC_VIRTCOL_NORMAL 0 -#define AR5K_DCU_MISC_VIRTCOL_IGNORE 1 -#define AR5K_DCU_MISC_BCN_ENABLE 0x00010000 /* Enable Beacon use */ -#define AR5K_DCU_MISC_ARBLOCK_CTL 0x00060000 /* Arbiter lockout control mask */ -#define AR5K_DCU_MISC_ARBLOCK_CTL_S 17 -#define AR5K_DCU_MISC_ARBLOCK_CTL_NONE 0 /* No arbiter lockout */ -#define AR5K_DCU_MISC_ARBLOCK_CTL_INTFRM 1 /* Intra-frame lockout */ -#define AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL 2 /* Global lockout */ -#define AR5K_DCU_MISC_ARBLOCK_IGNORE 0x00080000 /* Ignore Arbiter lockout */ -#define AR5K_DCU_MISC_SEQ_NUM_INCR_DIS 0x00100000 /* Disable sequence number increment */ -#define AR5K_DCU_MISC_POST_FR_BKOFF_DIS 0x00200000 /* Disable post-frame backoff */ -#define AR5K_DCU_MISC_VIRT_COLL_POLICY 0x00400000 /* Virtual Collision cw policy */ -#define AR5K_DCU_MISC_BLOWN_IFS_POLICY 0x00800000 /* Blown IFS policy (?) */ -#define AR5K_DCU_MISC_SEQNUM_CTL 0x01000000 /* Sequence number control (?) */ -#define AR5K_QUEUE_DFS_MISC(_q) AR5K_QUEUE_REG(AR5K_DCU_MISC_BASE, _q) - -/* - * DCU frame sequence number registers - */ -#define AR5K_DCU_SEQNUM_BASE 0x1140 -#define AR5K_DCU_SEQNUM_M 0x00000fff -#define AR5K_QUEUE_DCU_SEQNUM(_q) AR5K_QUEUE_REG(AR5K_DCU_SEQNUM_BASE, _q) - -/* - * DCU global IFS SIFS register - */ -#define AR5K_DCU_GBL_IFS_SIFS 0x1030 -#define AR5K_DCU_GBL_IFS_SIFS_M 0x0000ffff - -/* - * DCU global IFS slot interval register - */ -#define AR5K_DCU_GBL_IFS_SLOT 0x1070 -#define AR5K_DCU_GBL_IFS_SLOT_M 0x0000ffff - -/* - * DCU global IFS EIFS register - */ -#define AR5K_DCU_GBL_IFS_EIFS 0x10b0 -#define AR5K_DCU_GBL_IFS_EIFS_M 0x0000ffff - -/* - * DCU global IFS misc register - * - * LFSR stands for Linear Feedback Shift Register - * and it's used for generating pseudo-random - * number sequences. - * - * (If i understand correctly, random numbers are - * used for idle sensing -multiplied with cwmin/max etc-) - */ -#define AR5K_DCU_GBL_IFS_MISC 0x10f0 /* Register Address */ -#define AR5K_DCU_GBL_IFS_MISC_LFSR_SLICE 0x00000007 /* LFSR Slice Select */ -#define AR5K_DCU_GBL_IFS_MISC_TURBO_MODE 0x00000008 /* Turbo mode */ -#define AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC 0x000003f0 /* SIFS Duration mask */ -#define AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC_S 4 -#define AR5K_DCU_GBL_IFS_MISC_USEC_DUR 0x000ffc00 /* USEC Duration mask */ -#define AR5K_DCU_GBL_IFS_MISC_USEC_DUR_S 10 -#define AR5K_DCU_GBL_IFS_MISC_DCU_ARB_DELAY 0x00300000 /* DCU Arbiter delay mask */ -#define AR5K_DCU_GBL_IFS_MISC_SIFS_CNT_RST 0x00400000 /* SIFS cnt reset policy (?) */ -#define AR5K_DCU_GBL_IFS_MISC_AIFS_CNT_RST 0x00800000 /* AIFS cnt reset policy (?) */ -#define AR5K_DCU_GBL_IFS_MISC_RND_LFSR_SL_DIS 0x01000000 /* Disable random LFSR slice */ - -/* - * DCU frame prefetch control register - */ -#define AR5K_DCU_FP 0x1230 /* Register Address */ -#define AR5K_DCU_FP_NOBURST_DCU_EN 0x00000001 /* Enable non-burst prefetch on DCU (?) */ -#define AR5K_DCU_FP_NOBURST_EN 0x00000010 /* Enable non-burst prefetch (?) */ -#define AR5K_DCU_FP_BURST_DCU_EN 0x00000020 /* Enable burst prefetch on DCU (?) */ - -/* - * DCU transmit pause control/status register - */ -#define AR5K_DCU_TXP 0x1270 /* Register Address */ -#define AR5K_DCU_TXP_M 0x000003ff /* Tx pause mask */ -#define AR5K_DCU_TXP_STATUS 0x00010000 /* Tx pause status */ - -/* - * DCU transmit filter table 0 (32 entries) - * each entry contains a 32bit slice of the - * 128bit tx filter for each DCU (4 slices per DCU) - */ -#define AR5K_DCU_TX_FILTER_0_BASE 0x1038 -#define AR5K_DCU_TX_FILTER_0(_n) (AR5K_DCU_TX_FILTER_0_BASE + (_n * 64)) - -/* - * DCU transmit filter table 1 (16 entries) - */ -#define AR5K_DCU_TX_FILTER_1_BASE 0x103c -#define AR5K_DCU_TX_FILTER_1(_n) (AR5K_DCU_TX_FILTER_1_BASE + (_n * 64)) - -/* - * DCU clear transmit filter register - */ -#define AR5K_DCU_TX_FILTER_CLR 0x143c - -/* - * DCU set transmit filter register - */ -#define AR5K_DCU_TX_FILTER_SET 0x147c - -/* - * Reset control register - */ -#define AR5K_RESET_CTL 0x4000 /* Register Address */ -#define AR5K_RESET_CTL_PCU 0x00000001 /* Protocol Control Unit reset */ -#define AR5K_RESET_CTL_DMA 0x00000002 /* DMA (Rx/Tx) reset [5210] */ -#define AR5K_RESET_CTL_BASEBAND 0x00000002 /* Baseband reset [5211+] */ -#define AR5K_RESET_CTL_MAC 0x00000004 /* MAC reset (PCU+Baseband ?) [5210] */ -#define AR5K_RESET_CTL_PHY 0x00000008 /* PHY reset [5210] */ -#define AR5K_RESET_CTL_PCI 0x00000010 /* PCI Core reset (interrupts etc) */ - -/* - * Sleep control register - */ -#define AR5K_SLEEP_CTL 0x4004 /* Register Address */ -#define AR5K_SLEEP_CTL_SLDUR 0x0000ffff /* Sleep duration mask */ -#define AR5K_SLEEP_CTL_SLDUR_S 0 -#define AR5K_SLEEP_CTL_SLE 0x00030000 /* Sleep enable mask */ -#define AR5K_SLEEP_CTL_SLE_S 16 -#define AR5K_SLEEP_CTL_SLE_WAKE 0x00000000 /* Force chip awake */ -#define AR5K_SLEEP_CTL_SLE_SLP 0x00010000 /* Force chip sleep */ -#define AR5K_SLEEP_CTL_SLE_ALLOW 0x00020000 /* Normal sleep policy */ -#define AR5K_SLEEP_CTL_SLE_UNITS 0x00000008 /* [5211+] */ -#define AR5K_SLEEP_CTL_DUR_TIM_POL 0x00040000 /* Sleep duration timing policy */ -#define AR5K_SLEEP_CTL_DUR_WRITE_POL 0x00080000 /* Sleep duration write policy */ -#define AR5K_SLEEP_CTL_SLE_POL 0x00100000 /* Sleep policy mode */ - -/* - * Interrupt pending register - */ -#define AR5K_INTPEND 0x4008 -#define AR5K_INTPEND_M 0x00000001 - -/* - * Sleep force register - */ -#define AR5K_SFR 0x400c -#define AR5K_SFR_EN 0x00000001 - -/* - * PCI configuration register - * TODO: Fix LED stuff - */ -#define AR5K_PCICFG 0x4010 /* Register Address */ -#define AR5K_PCICFG_EEAE 0x00000001 /* Eeprom access enable [5210] */ -#define AR5K_PCICFG_SLEEP_CLOCK_EN 0x00000002 /* Enable sleep clock */ -#define AR5K_PCICFG_CLKRUNEN 0x00000004 /* CLKRUN enable [5211+] */ -#define AR5K_PCICFG_EESIZE 0x00000018 /* Mask for EEPROM size [5211+] */ -#define AR5K_PCICFG_EESIZE_S 3 -#define AR5K_PCICFG_EESIZE_4K 0 /* 4K */ -#define AR5K_PCICFG_EESIZE_8K 1 /* 8K */ -#define AR5K_PCICFG_EESIZE_16K 2 /* 16K */ -#define AR5K_PCICFG_EESIZE_FAIL 3 /* Failed to get size [5211+] */ -#define AR5K_PCICFG_LED 0x00000060 /* Led status [5211+] */ -#define AR5K_PCICFG_LED_NONE 0x00000000 /* Default [5211+] */ -#define AR5K_PCICFG_LED_PEND 0x00000020 /* Scan / Auth pending */ -#define AR5K_PCICFG_LED_ASSOC 0x00000040 /* Associated */ -#define AR5K_PCICFG_BUS_SEL 0x00000380 /* Mask for "bus select" [5211+] (?) */ -#define AR5K_PCICFG_CBEFIX_DIS 0x00000400 /* Disable CBE fix */ -#define AR5K_PCICFG_SL_INTEN 0x00000800 /* Enable interrupts when asleep */ -#define AR5K_PCICFG_LED_BCTL 0x00001000 /* Led blink (?) [5210] */ -#define AR5K_PCICFG_RETRY_FIX 0x00001000 /* Enable pci core retry fix */ -#define AR5K_PCICFG_SL_INPEN 0x00002000 /* Sleep even with pending interrupts*/ -#define AR5K_PCICFG_SPWR_DN 0x00010000 /* Mask for power status */ -#define AR5K_PCICFG_LEDMODE 0x000e0000 /* Ledmode [5211+] */ -#define AR5K_PCICFG_LEDMODE_PROP 0x00000000 /* Blink on standard traffic [5211+] */ -#define AR5K_PCICFG_LEDMODE_PROM 0x00020000 /* Default mode (blink on any traffic) [5211+] */ -#define AR5K_PCICFG_LEDMODE_PWR 0x00040000 /* Some other blinking mode (?) [5211+] */ -#define AR5K_PCICFG_LEDMODE_RAND 0x00060000 /* Random blinking (?) [5211+] */ -#define AR5K_PCICFG_LEDBLINK 0x00700000 /* Led blink rate */ -#define AR5K_PCICFG_LEDBLINK_S 20 -#define AR5K_PCICFG_LEDSLOW 0x00800000 /* Slowest led blink rate [5211+] */ -#define AR5K_PCICFG_LEDSTATE \ - (AR5K_PCICFG_LED | AR5K_PCICFG_LEDMODE | \ - AR5K_PCICFG_LEDBLINK | AR5K_PCICFG_LEDSLOW) -#define AR5K_PCICFG_SLEEP_CLOCK_RATE 0x03000000 /* Sleep clock rate */ -#define AR5K_PCICFG_SLEEP_CLOCK_RATE_S 24 - -/* - * "General Purpose Input/Output" (GPIO) control register - * - * I'm not sure about this but after looking at the code - * for all chipsets here is what i got. - * - * We have 6 GPIOs (pins), each GPIO has 4 modes (2 bits) - * Mode 0 -> always input - * Mode 1 -> output when GPIODO for this GPIO is set to 0 - * Mode 2 -> output when GPIODO for this GPIO is set to 1 - * Mode 3 -> always output - * - * For more infos check out get_gpio/set_gpio and - * set_gpio_input/set_gpio_output functs. - * For more infos on gpio interrupt check out set_gpio_intr. - */ -#define AR5K_NUM_GPIO 6 - -#define AR5K_GPIOCR 0x4014 /* Register Address */ -#define AR5K_GPIOCR_INT_ENA 0x00008000 /* Enable GPIO interrupt */ -#define AR5K_GPIOCR_INT_SELL 0x00000000 /* Generate interrupt when pin is low */ -#define AR5K_GPIOCR_INT_SELH 0x00010000 /* Generate interrupt when pin is high */ -#define AR5K_GPIOCR_IN(n) (0 << ((n) * 2)) /* Mode 0 for pin n */ -#define AR5K_GPIOCR_OUT0(n) (1 << ((n) * 2)) /* Mode 1 for pin n */ -#define AR5K_GPIOCR_OUT1(n) (2 << ((n) * 2)) /* Mode 2 for pin n */ -#define AR5K_GPIOCR_OUT(n) (3 << ((n) * 2)) /* Mode 3 for pin n */ -#define AR5K_GPIOCR_INT_SEL(n) ((n) << 12) /* Interrupt for GPIO pin n */ - -/* - * "General Purpose Input/Output" (GPIO) data output register - */ -#define AR5K_GPIODO 0x4018 - -/* - * "General Purpose Input/Output" (GPIO) data input register - */ -#define AR5K_GPIODI 0x401c -#define AR5K_GPIODI_M 0x0000002f - -/* - * Silicon revision register - */ -#define AR5K_SREV 0x4020 /* Register Address */ -#define AR5K_SREV_REV 0x0000000f /* Mask for revision */ -#define AR5K_SREV_REV_S 0 -#define AR5K_SREV_VER 0x000000ff /* Mask for version */ -#define AR5K_SREV_VER_S 4 - -/* - * TXE write posting register - */ -#define AR5K_TXEPOST 0x4028 - -/* - * QCU sleep mask - */ -#define AR5K_QCU_SLEEP_MASK 0x402c - -/* 0x4068 is compression buffer configuration - * register on 5414 and pm configuration register - * on 5424 and newer pci-e chips. */ - -/* - * Compression buffer configuration - * register (enable/disable) [5414] - */ -#define AR5K_5414_CBCFG 0x4068 -#define AR5K_5414_CBCFG_BUF_DIS 0x10 /* Disable buffer */ - -/* - * PCI-E Power management configuration - * and status register [5424+] - */ -#define AR5K_PCIE_PM_CTL 0x4068 /* Register address */ -/* Only 5424 */ -#define AR5K_PCIE_PM_CTL_L1_WHEN_D2 0x00000001 /* enable PCIe core enter L1 - when d2_sleep_en is asserted */ -#define AR5K_PCIE_PM_CTL_L0_L0S_CLEAR 0x00000002 /* Clear L0 and L0S counters */ -#define AR5K_PCIE_PM_CTL_L0_L0S_EN 0x00000004 /* Start L0 nd L0S counters */ -#define AR5K_PCIE_PM_CTL_LDRESET_EN 0x00000008 /* Enable reset when link goes - down */ -/* Wake On Wireless */ -#define AR5K_PCIE_PM_CTL_PME_EN 0x00000010 /* PME Enable */ -#define AR5K_PCIE_PM_CTL_AUX_PWR_DET 0x00000020 /* Aux power detect */ -#define AR5K_PCIE_PM_CTL_PME_CLEAR 0x00000040 /* Clear PME */ -#define AR5K_PCIE_PM_CTL_PSM_D0 0x00000080 -#define AR5K_PCIE_PM_CTL_PSM_D1 0x00000100 -#define AR5K_PCIE_PM_CTL_PSM_D2 0x00000200 -#define AR5K_PCIE_PM_CTL_PSM_D3 0x00000400 - -/* - * PCI-E Workaround enable register - */ -#define AR5K_PCIE_WAEN 0x407c - -/* - * PCI-E Serializer/Deserializer - * registers - */ -#define AR5K_PCIE_SERDES 0x4080 -#define AR5K_PCIE_SERDES_RESET 0x4084 - -/*====EEPROM REGISTERS====*/ - -/* - * EEPROM access registers - * - * Here we got a difference between 5210/5211-12 - * read data register for 5210 is at 0x6800 and - * status register is at 0x6c00. There is also - * no eeprom command register on 5210 and the - * offsets are different. - * - * To read eeprom data for a specific offset: - * 5210 - enable eeprom access (AR5K_PCICFG_EEAE) - * read AR5K_EEPROM_BASE +(4 * offset) - * check the eeprom status register - * and read eeprom data register. - * - * 5211 - write offset to AR5K_EEPROM_BASE - * 5212 write AR5K_EEPROM_CMD_READ on AR5K_EEPROM_CMD - * check the eeprom status register - * and read eeprom data register. - * - * To write eeprom data for a specific offset: - * 5210 - enable eeprom access (AR5K_PCICFG_EEAE) - * write data to AR5K_EEPROM_BASE +(4 * offset) - * check the eeprom status register - * 5211 - write AR5K_EEPROM_CMD_RESET on AR5K_EEPROM_CMD - * 5212 write offset to AR5K_EEPROM_BASE - * write data to data register - * write AR5K_EEPROM_CMD_WRITE on AR5K_EEPROM_CMD - * check the eeprom status register - * - * For more infos check eeprom_* functs and the ar5k.c - * file posted in madwifi-devel mailing list. - * http://sourceforge.net/mailarchive/message.php?msg_id=8966525 - * - */ -#define AR5K_EEPROM_BASE 0x6000 - -/* - * EEPROM data register - */ -#define AR5K_EEPROM_DATA_5211 0x6004 -#define AR5K_EEPROM_DATA_5210 0x6800 -#define AR5K_EEPROM_DATA (ah->ah_version == AR5K_AR5210 ? \ - AR5K_EEPROM_DATA_5210 : AR5K_EEPROM_DATA_5211) - -/* - * EEPROM command register - */ -#define AR5K_EEPROM_CMD 0x6008 /* Register Address */ -#define AR5K_EEPROM_CMD_READ 0x00000001 /* EEPROM read */ -#define AR5K_EEPROM_CMD_WRITE 0x00000002 /* EEPROM write */ -#define AR5K_EEPROM_CMD_RESET 0x00000004 /* EEPROM reset */ - -/* - * EEPROM status register - */ -#define AR5K_EEPROM_STAT_5210 0x6c00 /* Register Address [5210] */ -#define AR5K_EEPROM_STAT_5211 0x600c /* Register Address [5211+] */ -#define AR5K_EEPROM_STATUS (ah->ah_version == AR5K_AR5210 ? \ - AR5K_EEPROM_STAT_5210 : AR5K_EEPROM_STAT_5211) -#define AR5K_EEPROM_STAT_RDERR 0x00000001 /* EEPROM read failed */ -#define AR5K_EEPROM_STAT_RDDONE 0x00000002 /* EEPROM read successful */ -#define AR5K_EEPROM_STAT_WRERR 0x00000004 /* EEPROM write failed */ -#define AR5K_EEPROM_STAT_WRDONE 0x00000008 /* EEPROM write successful */ - -/* - * EEPROM config register - */ -#define AR5K_EEPROM_CFG 0x6010 /* Register Address */ -#define AR5K_EEPROM_CFG_SIZE 0x00000003 /* Size determination override */ -#define AR5K_EEPROM_CFG_SIZE_AUTO 0 -#define AR5K_EEPROM_CFG_SIZE_4KBIT 1 -#define AR5K_EEPROM_CFG_SIZE_8KBIT 2 -#define AR5K_EEPROM_CFG_SIZE_16KBIT 3 -#define AR5K_EEPROM_CFG_WR_WAIT_DIS 0x00000004 /* Disable write wait */ -#define AR5K_EEPROM_CFG_CLK_RATE 0x00000018 /* Clock rate */ -#define AR5K_EEPROM_CFG_CLK_RATE_S 3 -#define AR5K_EEPROM_CFG_CLK_RATE_156KHZ 0 -#define AR5K_EEPROM_CFG_CLK_RATE_312KHZ 1 -#define AR5K_EEPROM_CFG_CLK_RATE_625KHZ 2 -#define AR5K_EEPROM_CFG_PROT_KEY 0x00ffff00 /* Protection key */ -#define AR5K_EEPROM_CFG_PROT_KEY_S 8 -#define AR5K_EEPROM_CFG_LIND_EN 0x01000000 /* Enable length indicator (?) */ - - -/* - * TODO: Wake On Wireless registers - * Range 0x7000 - 0x7ce0 - */ - -/* - * Protocol Control Unit (PCU) registers - */ -/* - * Used for checking initial register writes - * during channel reset (see reset func) - */ -#define AR5K_PCU_MIN 0x8000 -#define AR5K_PCU_MAX 0x8fff - -/* - * First station id register (Lower 32 bits of MAC address) - */ -#define AR5K_STA_ID0 0x8000 -#define AR5K_STA_ID0_ARRD_L32 0xffffffff - -/* - * Second station id register (Upper 16 bits of MAC address + PCU settings) - */ -#define AR5K_STA_ID1 0x8004 /* Register Address */ -#define AR5K_STA_ID1_ADDR_U16 0x0000ffff /* Upper 16 bits of MAC address */ -#define AR5K_STA_ID1_AP 0x00010000 /* Set AP mode */ -#define AR5K_STA_ID1_ADHOC 0x00020000 /* Set Ad-Hoc mode */ -#define AR5K_STA_ID1_PWR_SV 0x00040000 /* Power save reporting */ -#define AR5K_STA_ID1_NO_KEYSRCH 0x00080000 /* No key search */ -#define AR5K_STA_ID1_NO_PSPOLL 0x00100000 /* No power save polling [5210] */ -#define AR5K_STA_ID1_PCF_5211 0x00100000 /* Enable PCF on [5211+] */ -#define AR5K_STA_ID1_PCF_5210 0x00200000 /* Enable PCF on [5210]*/ -#define AR5K_STA_ID1_PCF (ah->ah_version == AR5K_AR5210 ? \ - AR5K_STA_ID1_PCF_5210 : AR5K_STA_ID1_PCF_5211) -#define AR5K_STA_ID1_DEFAULT_ANTENNA 0x00200000 /* Use default antenna */ -#define AR5K_STA_ID1_DESC_ANTENNA 0x00400000 /* Update antenna from descriptor */ -#define AR5K_STA_ID1_RTS_DEF_ANTENNA 0x00800000 /* Use default antenna for RTS */ -#define AR5K_STA_ID1_ACKCTS_6MB 0x01000000 /* Rate to use for ACK/CTS. 0: highest mandatory rate <= RX rate; 1: 1Mbps in B mode */ -#define AR5K_STA_ID1_BASE_RATE_11B 0x02000000 /* 802.11b base rate. 0: 1, 2, 5.5 and 11Mbps; 1: 1 and 2Mbps. [5211+] */ -#define AR5K_STA_ID1_SELFGEN_DEF_ANT 0x04000000 /* Use def. antenna for self generated frames */ -#define AR5K_STA_ID1_CRYPT_MIC_EN 0x08000000 /* Enable MIC */ -#define AR5K_STA_ID1_KEYSRCH_MODE 0x10000000 /* Look up key when key id != 0 */ -#define AR5K_STA_ID1_PRESERVE_SEQ_NUM 0x20000000 /* Preserve sequence number */ -#define AR5K_STA_ID1_CBCIV_ENDIAN 0x40000000 /* ??? */ -#define AR5K_STA_ID1_KEYSRCH_MCAST 0x80000000 /* Do key cache search for mcast frames */ - -#define AR5K_STA_ID1_ANTENNA_SETTINGS (AR5K_STA_ID1_DEFAULT_ANTENNA | \ - AR5K_STA_ID1_DESC_ANTENNA | \ - AR5K_STA_ID1_RTS_DEF_ANTENNA | \ - AR5K_STA_ID1_SELFGEN_DEF_ANT) - -/* - * First BSSID register (MAC address, lower 32bits) - */ -#define AR5K_BSS_ID0 0x8008 - -/* - * Second BSSID register (MAC address in upper 16 bits) - * - * AID: Association ID - */ -#define AR5K_BSS_ID1 0x800c -#define AR5K_BSS_ID1_AID 0xffff0000 -#define AR5K_BSS_ID1_AID_S 16 - -/* - * Backoff slot time register - */ -#define AR5K_SLOT_TIME 0x8010 - -/* - * ACK/CTS timeout register - */ -#define AR5K_TIME_OUT 0x8014 /* Register Address */ -#define AR5K_TIME_OUT_ACK 0x00001fff /* ACK timeout mask */ -#define AR5K_TIME_OUT_ACK_S 0 -#define AR5K_TIME_OUT_CTS 0x1fff0000 /* CTS timeout mask */ -#define AR5K_TIME_OUT_CTS_S 16 - -/* - * RSSI threshold register - */ -#define AR5K_RSSI_THR 0x8018 /* Register Address */ -#define AR5K_RSSI_THR_M 0x000000ff /* Mask for RSSI threshold [5211+] */ -#define AR5K_RSSI_THR_BMISS_5210 0x00000700 /* Mask for Beacon Missed threshold [5210] */ -#define AR5K_RSSI_THR_BMISS_5210_S 8 -#define AR5K_RSSI_THR_BMISS_5211 0x0000ff00 /* Mask for Beacon Missed threshold [5211+] */ -#define AR5K_RSSI_THR_BMISS_5211_S 8 -#define AR5K_RSSI_THR_BMISS (ah->ah_version == AR5K_AR5210 ? \ - AR5K_RSSI_THR_BMISS_5210 : AR5K_RSSI_THR_BMISS_5211) -#define AR5K_RSSI_THR_BMISS_S 8 - -/* - * 5210 has more PCU registers because there is no QCU/DCU - * so queue parameters are set here, this way a lot common - * registers have different address for 5210. To make things - * easier we define a macro based on ah->ah_version for common - * registers with different addresses and common flags. - */ - -/* - * Retry limit register - * - * Retry limit register for 5210 (no QCU/DCU so it's done in PCU) - */ -#define AR5K_NODCU_RETRY_LMT 0x801c /* Register Address */ -#define AR5K_NODCU_RETRY_LMT_SH_RETRY 0x0000000f /* Short retry limit mask */ -#define AR5K_NODCU_RETRY_LMT_SH_RETRY_S 0 -#define AR5K_NODCU_RETRY_LMT_LG_RETRY 0x000000f0 /* Long retry mask */ -#define AR5K_NODCU_RETRY_LMT_LG_RETRY_S 4 -#define AR5K_NODCU_RETRY_LMT_SSH_RETRY 0x00003f00 /* Station short retry limit mask */ -#define AR5K_NODCU_RETRY_LMT_SSH_RETRY_S 8 -#define AR5K_NODCU_RETRY_LMT_SLG_RETRY 0x000fc000 /* Station long retry limit mask */ -#define AR5K_NODCU_RETRY_LMT_SLG_RETRY_S 14 -#define AR5K_NODCU_RETRY_LMT_CW_MIN 0x3ff00000 /* Minimum contention window mask */ -#define AR5K_NODCU_RETRY_LMT_CW_MIN_S 20 - -/* - * Transmit latency register - */ -#define AR5K_USEC_5210 0x8020 /* Register Address [5210] */ -#define AR5K_USEC_5211 0x801c /* Register Address [5211+] */ -#define AR5K_USEC (ah->ah_version == AR5K_AR5210 ? \ - AR5K_USEC_5210 : AR5K_USEC_5211) -#define AR5K_USEC_1 0x0000007f /* clock cycles for 1us */ -#define AR5K_USEC_1_S 0 -#define AR5K_USEC_32 0x00003f80 /* clock cycles for 1us while on 32MHz clock */ -#define AR5K_USEC_32_S 7 -#define AR5K_USEC_TX_LATENCY_5211 0x007fc000 -#define AR5K_USEC_TX_LATENCY_5211_S 14 -#define AR5K_USEC_RX_LATENCY_5211 0x1f800000 -#define AR5K_USEC_RX_LATENCY_5211_S 23 -#define AR5K_USEC_TX_LATENCY_5210 0x000fc000 /* also for 5311 */ -#define AR5K_USEC_TX_LATENCY_5210_S 14 -#define AR5K_USEC_RX_LATENCY_5210 0x03f00000 /* also for 5311 */ -#define AR5K_USEC_RX_LATENCY_5210_S 20 - -/* - * PCU beacon control register - */ -#define AR5K_BEACON_5210 0x8024 /*Register Address [5210] */ -#define AR5K_BEACON_5211 0x8020 /*Register Address [5211+] */ -#define AR5K_BEACON (ah->ah_version == AR5K_AR5210 ? \ - AR5K_BEACON_5210 : AR5K_BEACON_5211) -#define AR5K_BEACON_PERIOD 0x0000ffff /* Mask for beacon period */ -#define AR5K_BEACON_PERIOD_S 0 -#define AR5K_BEACON_TIM 0x007f0000 /* Mask for TIM offset */ -#define AR5K_BEACON_TIM_S 16 -#define AR5K_BEACON_ENABLE 0x00800000 /* Enable beacons */ -#define AR5K_BEACON_RESET_TSF 0x01000000 /* Force TSF reset */ - -/* - * CFP period register - */ -#define AR5K_CFP_PERIOD_5210 0x8028 -#define AR5K_CFP_PERIOD_5211 0x8024 -#define AR5K_CFP_PERIOD (ah->ah_version == AR5K_AR5210 ? \ - AR5K_CFP_PERIOD_5210 : AR5K_CFP_PERIOD_5211) - -/* - * Next beacon time register - */ -#define AR5K_TIMER0_5210 0x802c -#define AR5K_TIMER0_5211 0x8028 -#define AR5K_TIMER0 (ah->ah_version == AR5K_AR5210 ? \ - AR5K_TIMER0_5210 : AR5K_TIMER0_5211) - -/* - * Next DMA beacon alert register - */ -#define AR5K_TIMER1_5210 0x8030 -#define AR5K_TIMER1_5211 0x802c -#define AR5K_TIMER1 (ah->ah_version == AR5K_AR5210 ? \ - AR5K_TIMER1_5210 : AR5K_TIMER1_5211) - -/* - * Next software beacon alert register - */ -#define AR5K_TIMER2_5210 0x8034 -#define AR5K_TIMER2_5211 0x8030 -#define AR5K_TIMER2 (ah->ah_version == AR5K_AR5210 ? \ - AR5K_TIMER2_5210 : AR5K_TIMER2_5211) - -/* - * Next ATIM window time register - */ -#define AR5K_TIMER3_5210 0x8038 -#define AR5K_TIMER3_5211 0x8034 -#define AR5K_TIMER3 (ah->ah_version == AR5K_AR5210 ? \ - AR5K_TIMER3_5210 : AR5K_TIMER3_5211) - - -/* - * 5210 First inter frame spacing register (IFS) - */ -#define AR5K_IFS0 0x8040 -#define AR5K_IFS0_SIFS 0x000007ff -#define AR5K_IFS0_SIFS_S 0 -#define AR5K_IFS0_DIFS 0x007ff800 -#define AR5K_IFS0_DIFS_S 11 - -/* - * 5210 Second inter frame spacing register (IFS) - */ -#define AR5K_IFS1 0x8044 -#define AR5K_IFS1_PIFS 0x00000fff -#define AR5K_IFS1_PIFS_S 0 -#define AR5K_IFS1_EIFS 0x03fff000 -#define AR5K_IFS1_EIFS_S 12 -#define AR5K_IFS1_CS_EN 0x04000000 -#define AR5K_IFS1_CS_EN_S 26 - -/* - * CFP duration register - */ -#define AR5K_CFP_DUR_5210 0x8048 -#define AR5K_CFP_DUR_5211 0x8038 -#define AR5K_CFP_DUR (ah->ah_version == AR5K_AR5210 ? \ - AR5K_CFP_DUR_5210 : AR5K_CFP_DUR_5211) - -/* - * Receive filter register - */ -#define AR5K_RX_FILTER_5210 0x804c /* Register Address [5210] */ -#define AR5K_RX_FILTER_5211 0x803c /* Register Address [5211+] */ -#define AR5K_RX_FILTER (ah->ah_version == AR5K_AR5210 ? \ - AR5K_RX_FILTER_5210 : AR5K_RX_FILTER_5211) -#define AR5K_RX_FILTER_UCAST 0x00000001 /* Don't filter unicast frames */ -#define AR5K_RX_FILTER_MCAST 0x00000002 /* Don't filter multicast frames */ -#define AR5K_RX_FILTER_BCAST 0x00000004 /* Don't filter broadcast frames */ -#define AR5K_RX_FILTER_CONTROL 0x00000008 /* Don't filter control frames */ -#define AR5K_RX_FILTER_BEACON 0x00000010 /* Don't filter beacon frames */ -#define AR5K_RX_FILTER_PROM 0x00000020 /* Set promiscuous mode */ -#define AR5K_RX_FILTER_XRPOLL 0x00000040 /* Don't filter XR poll frame [5212+] */ -#define AR5K_RX_FILTER_PROBEREQ 0x00000080 /* Don't filter probe requests [5212+] */ -#define AR5K_RX_FILTER_PHYERR_5212 0x00000100 /* Don't filter phy errors [5212+] */ -#define AR5K_RX_FILTER_RADARERR_5212 0x00000200 /* Don't filter phy radar errors [5212+] */ -#define AR5K_RX_FILTER_PHYERR_5211 0x00000040 /* [5211] */ -#define AR5K_RX_FILTER_RADARERR_5211 0x00000080 /* [5211] */ -#define AR5K_RX_FILTER_PHYERR \ - ((ah->ah_version == AR5K_AR5211 ? \ - AR5K_RX_FILTER_PHYERR_5211 : AR5K_RX_FILTER_PHYERR_5212)) -#define AR5K_RX_FILTER_RADARERR \ - ((ah->ah_version == AR5K_AR5211 ? \ - AR5K_RX_FILTER_RADARERR_5211 : AR5K_RX_FILTER_RADARERR_5212)) - -/* - * Multicast filter register (lower 32 bits) - */ -#define AR5K_MCAST_FILTER0_5210 0x8050 -#define AR5K_MCAST_FILTER0_5211 0x8040 -#define AR5K_MCAST_FILTER0 (ah->ah_version == AR5K_AR5210 ? \ - AR5K_MCAST_FILTER0_5210 : AR5K_MCAST_FILTER0_5211) - -/* - * Multicast filter register (higher 16 bits) - */ -#define AR5K_MCAST_FILTER1_5210 0x8054 -#define AR5K_MCAST_FILTER1_5211 0x8044 -#define AR5K_MCAST_FILTER1 (ah->ah_version == AR5K_AR5210 ? \ - AR5K_MCAST_FILTER1_5210 : AR5K_MCAST_FILTER1_5211) - - -/* - * Transmit mask register (lower 32 bits) [5210] - */ -#define AR5K_TX_MASK0 0x8058 - -/* - * Transmit mask register (higher 16 bits) [5210] - */ -#define AR5K_TX_MASK1 0x805c - -/* - * Clear transmit mask [5210] - */ -#define AR5K_CLR_TMASK 0x8060 - -/* - * Trigger level register (before transmission) [5210] - */ -#define AR5K_TRIG_LVL 0x8064 - - -/* - * PCU Diagnostic register - * - * Used for tweaking/diagnostics. - */ -#define AR5K_DIAG_SW_5210 0x8068 /* Register Address [5210] */ -#define AR5K_DIAG_SW_5211 0x8048 /* Register Address [5211+] */ -#define AR5K_DIAG_SW (ah->ah_version == AR5K_AR5210 ? \ - AR5K_DIAG_SW_5210 : AR5K_DIAG_SW_5211) -#define AR5K_DIAG_SW_DIS_WEP_ACK 0x00000001 /* Disable ACKs if WEP key is invalid */ -#define AR5K_DIAG_SW_DIS_ACK 0x00000002 /* Disable ACKs */ -#define AR5K_DIAG_SW_DIS_CTS 0x00000004 /* Disable CTSs */ -#define AR5K_DIAG_SW_DIS_ENC 0x00000008 /* Disable HW encryption */ -#define AR5K_DIAG_SW_DIS_DEC 0x00000010 /* Disable HW decryption */ -#define AR5K_DIAG_SW_DIS_TX_5210 0x00000020 /* Disable transmit [5210] */ -#define AR5K_DIAG_SW_DIS_RX_5210 0x00000040 /* Disable receive */ -#define AR5K_DIAG_SW_DIS_RX_5211 0x00000020 -#define AR5K_DIAG_SW_DIS_RX (ah->ah_version == AR5K_AR5210 ? \ - AR5K_DIAG_SW_DIS_RX_5210 : AR5K_DIAG_SW_DIS_RX_5211) -#define AR5K_DIAG_SW_LOOP_BACK_5210 0x00000080 /* TX Data Loopback (i guess it goes with DIS_TX) [5210] */ -#define AR5K_DIAG_SW_LOOP_BACK_5211 0x00000040 -#define AR5K_DIAG_SW_LOOP_BACK (ah->ah_version == AR5K_AR5210 ? \ - AR5K_DIAG_SW_LOOP_BACK_5210 : AR5K_DIAG_SW_LOOP_BACK_5211) -#define AR5K_DIAG_SW_CORR_FCS_5210 0x00000100 /* Generate invalid TX FCS */ -#define AR5K_DIAG_SW_CORR_FCS_5211 0x00000080 -#define AR5K_DIAG_SW_CORR_FCS (ah->ah_version == AR5K_AR5210 ? \ - AR5K_DIAG_SW_CORR_FCS_5210 : AR5K_DIAG_SW_CORR_FCS_5211) -#define AR5K_DIAG_SW_CHAN_INFO_5210 0x00000200 /* Add 56 bytes of channel info before the frame data in the RX buffer */ -#define AR5K_DIAG_SW_CHAN_INFO_5211 0x00000100 -#define AR5K_DIAG_SW_CHAN_INFO (ah->ah_version == AR5K_AR5210 ? \ - AR5K_DIAG_SW_CHAN_INFO_5210 : AR5K_DIAG_SW_CHAN_INFO_5211) -#define AR5K_DIAG_SW_EN_SCRAM_SEED_5210 0x00000400 /* Enable fixed scrambler seed */ -#define AR5K_DIAG_SW_EN_SCRAM_SEED_5211 0x00000200 -#define AR5K_DIAG_SW_EN_SCRAM_SEED (ah->ah_version == AR5K_AR5210 ? \ - AR5K_DIAG_SW_EN_SCRAM_SEED_5210 : AR5K_DIAG_SW_EN_SCRAM_SEED_5211) -#define AR5K_DIAG_SW_ECO_ENABLE 0x00000400 /* [5211+] */ -#define AR5K_DIAG_SW_SCVRAM_SEED 0x0003f800 /* [5210] */ -#define AR5K_DIAG_SW_SCRAM_SEED_M 0x0001fc00 /* Scrambler seed mask */ -#define AR5K_DIAG_SW_SCRAM_SEED_S 10 -#define AR5K_DIAG_SW_DIS_SEQ_INC_5210 0x00040000 /* Disable seqnum increment (?)[5210] */ -#define AR5K_DIAG_SW_FRAME_NV0_5210 0x00080000 -#define AR5K_DIAG_SW_FRAME_NV0_5211 0x00020000 /* Accept frames of non-zero protocol number */ -#define AR5K_DIAG_SW_FRAME_NV0 (ah->ah_version == AR5K_AR5210 ? \ - AR5K_DIAG_SW_FRAME_NV0_5210 : AR5K_DIAG_SW_FRAME_NV0_5211) -#define AR5K_DIAG_SW_OBSPT_M 0x000c0000 /* Observation point select (?) */ -#define AR5K_DIAG_SW_OBSPT_S 18 -#define AR5K_DIAG_SW_RX_CLEAR_HIGH 0x00100000 /* Ignore carrier sense */ -#define AR5K_DIAG_SW_IGNORE_CARR_SENSE 0x00200000 /* Ignore virtual carrier sense */ -#define AR5K_DIAG_SW_CHANNEL_IDLE_HIGH 0x00400000 /* Force channel idle high */ -#define AR5K_DIAG_SW_PHEAR_ME 0x00800000 /* ??? */ - -/* - * TSF (clock) register (lower 32 bits) - */ -#define AR5K_TSF_L32_5210 0x806c -#define AR5K_TSF_L32_5211 0x804c -#define AR5K_TSF_L32 (ah->ah_version == AR5K_AR5210 ? \ - AR5K_TSF_L32_5210 : AR5K_TSF_L32_5211) - -/* - * TSF (clock) register (higher 32 bits) - */ -#define AR5K_TSF_U32_5210 0x8070 -#define AR5K_TSF_U32_5211 0x8050 -#define AR5K_TSF_U32 (ah->ah_version == AR5K_AR5210 ? \ - AR5K_TSF_U32_5210 : AR5K_TSF_U32_5211) - -/* - * Last beacon timestamp register (Read Only) - */ -#define AR5K_LAST_TSTP 0x8080 - -/* - * ADDAC test register [5211+] - */ -#define AR5K_ADDAC_TEST 0x8054 /* Register Address */ -#define AR5K_ADDAC_TEST_TXCONT 0x00000001 /* Test continuous tx */ -#define AR5K_ADDAC_TEST_TST_MODE 0x00000002 /* Test mode */ -#define AR5K_ADDAC_TEST_LOOP_EN 0x00000004 /* Enable loop */ -#define AR5K_ADDAC_TEST_LOOP_LEN 0x00000008 /* Loop length (field) */ -#define AR5K_ADDAC_TEST_USE_U8 0x00004000 /* Use upper 8 bits */ -#define AR5K_ADDAC_TEST_MSB 0x00008000 /* State of MSB */ -#define AR5K_ADDAC_TEST_TRIG_SEL 0x00010000 /* Trigger select */ -#define AR5K_ADDAC_TEST_TRIG_PTY 0x00020000 /* Trigger polarity */ -#define AR5K_ADDAC_TEST_RXCONT 0x00040000 /* Continuous capture */ -#define AR5K_ADDAC_TEST_CAPTURE 0x00080000 /* Begin capture */ -#define AR5K_ADDAC_TEST_TST_ARM 0x00100000 /* ARM rx buffer for capture */ - -/* - * Default antenna register [5211+] - */ -#define AR5K_DEFAULT_ANTENNA 0x8058 - -/* - * Frame control QoS mask register (?) [5211+] - * (FC_QOS_MASK) - */ -#define AR5K_FRAME_CTL_QOSM 0x805c - -/* - * Seq mask register (?) [5211+] - */ -#define AR5K_SEQ_MASK 0x8060 - -/* - * Retry count register [5210] - */ -#define AR5K_RETRY_CNT 0x8084 /* Register Address [5210] */ -#define AR5K_RETRY_CNT_SSH 0x0000003f /* Station short retry count (?) */ -#define AR5K_RETRY_CNT_SLG 0x00000fc0 /* Station long retry count (?) */ - -/* - * Back-off status register [5210] - */ -#define AR5K_BACKOFF 0x8088 /* Register Address [5210] */ -#define AR5K_BACKOFF_CW 0x000003ff /* Backoff Contention Window (?) */ -#define AR5K_BACKOFF_CNT 0x03ff0000 /* Backoff count (?) */ - - - -/* - * NAV register (current) - */ -#define AR5K_NAV_5210 0x808c -#define AR5K_NAV_5211 0x8084 -#define AR5K_NAV (ah->ah_version == AR5K_AR5210 ? \ - AR5K_NAV_5210 : AR5K_NAV_5211) - -/* - * MIB counters: - * - * max value is 0xc000, if this is reached we get a MIB interrupt. - * they can be controlled via AR5K_MIBC and are cleared on read. - */ - -/* - * RTS success (MIB counter) - */ -#define AR5K_RTS_OK_5210 0x8090 -#define AR5K_RTS_OK_5211 0x8088 -#define AR5K_RTS_OK (ah->ah_version == AR5K_AR5210 ? \ - AR5K_RTS_OK_5210 : AR5K_RTS_OK_5211) - -/* - * RTS failure (MIB counter) - */ -#define AR5K_RTS_FAIL_5210 0x8094 -#define AR5K_RTS_FAIL_5211 0x808c -#define AR5K_RTS_FAIL (ah->ah_version == AR5K_AR5210 ? \ - AR5K_RTS_FAIL_5210 : AR5K_RTS_FAIL_5211) - -/* - * ACK failure (MIB counter) - */ -#define AR5K_ACK_FAIL_5210 0x8098 -#define AR5K_ACK_FAIL_5211 0x8090 -#define AR5K_ACK_FAIL (ah->ah_version == AR5K_AR5210 ? \ - AR5K_ACK_FAIL_5210 : AR5K_ACK_FAIL_5211) - -/* - * FCS failure (MIB counter) - */ -#define AR5K_FCS_FAIL_5210 0x809c -#define AR5K_FCS_FAIL_5211 0x8094 -#define AR5K_FCS_FAIL (ah->ah_version == AR5K_AR5210 ? \ - AR5K_FCS_FAIL_5210 : AR5K_FCS_FAIL_5211) - -/* - * Beacon count register - */ -#define AR5K_BEACON_CNT_5210 0x80a0 -#define AR5K_BEACON_CNT_5211 0x8098 -#define AR5K_BEACON_CNT (ah->ah_version == AR5K_AR5210 ? \ - AR5K_BEACON_CNT_5210 : AR5K_BEACON_CNT_5211) - - -/*===5212 Specific PCU registers===*/ - -/* - * Transmit power control register - */ -#define AR5K_TPC 0x80e8 -#define AR5K_TPC_ACK 0x0000003f /* ack frames */ -#define AR5K_TPC_ACK_S 0 -#define AR5K_TPC_CTS 0x00003f00 /* cts frames */ -#define AR5K_TPC_CTS_S 8 -#define AR5K_TPC_CHIRP 0x003f0000 /* chirp frames */ -#define AR5K_TPC_CHIRP_S 16 -#define AR5K_TPC_DOPPLER 0x0f000000 /* doppler chirp span */ -#define AR5K_TPC_DOPPLER_S 24 - -/* - * XR (eXtended Range) mode register - */ -#define AR5K_XRMODE 0x80c0 /* Register Address */ -#define AR5K_XRMODE_POLL_TYPE_M 0x0000003f /* Mask for Poll type (?) */ -#define AR5K_XRMODE_POLL_TYPE_S 0 -#define AR5K_XRMODE_POLL_SUBTYPE_M 0x0000003c /* Mask for Poll subtype (?) */ -#define AR5K_XRMODE_POLL_SUBTYPE_S 2 -#define AR5K_XRMODE_POLL_WAIT_ALL 0x00000080 /* Wait for poll */ -#define AR5K_XRMODE_SIFS_DELAY 0x000fff00 /* Mask for SIFS delay */ -#define AR5K_XRMODE_FRAME_HOLD_M 0xfff00000 /* Mask for frame hold (?) */ -#define AR5K_XRMODE_FRAME_HOLD_S 20 - -/* - * XR delay register - */ -#define AR5K_XRDELAY 0x80c4 /* Register Address */ -#define AR5K_XRDELAY_SLOT_DELAY_M 0x0000ffff /* Mask for slot delay */ -#define AR5K_XRDELAY_SLOT_DELAY_S 0 -#define AR5K_XRDELAY_CHIRP_DELAY_M 0xffff0000 /* Mask for CHIRP data delay */ -#define AR5K_XRDELAY_CHIRP_DELAY_S 16 - -/* - * XR timeout register - */ -#define AR5K_XRTIMEOUT 0x80c8 /* Register Address */ -#define AR5K_XRTIMEOUT_CHIRP_M 0x0000ffff /* Mask for CHIRP timeout */ -#define AR5K_XRTIMEOUT_CHIRP_S 0 -#define AR5K_XRTIMEOUT_POLL_M 0xffff0000 /* Mask for Poll timeout */ -#define AR5K_XRTIMEOUT_POLL_S 16 - -/* - * XR chirp register - */ -#define AR5K_XRCHIRP 0x80cc /* Register Address */ -#define AR5K_XRCHIRP_SEND 0x00000001 /* Send CHIRP */ -#define AR5K_XRCHIRP_GAP 0xffff0000 /* Mask for CHIRP gap (?) */ - -/* - * XR stomp register - */ -#define AR5K_XRSTOMP 0x80d0 /* Register Address */ -#define AR5K_XRSTOMP_TX 0x00000001 /* Stomp Tx (?) */ -#define AR5K_XRSTOMP_RX 0x00000002 /* Stomp Rx (?) */ -#define AR5K_XRSTOMP_TX_RSSI 0x00000004 /* Stomp Tx RSSI (?) */ -#define AR5K_XRSTOMP_TX_BSSID 0x00000008 /* Stomp Tx BSSID (?) */ -#define AR5K_XRSTOMP_DATA 0x00000010 /* Stomp data (?)*/ -#define AR5K_XRSTOMP_RSSI_THRES 0x0000ff00 /* Mask for XR RSSI threshold */ - -/* - * First enhanced sleep register - */ -#define AR5K_SLEEP0 0x80d4 /* Register Address */ -#define AR5K_SLEEP0_NEXT_DTIM 0x0007ffff /* Mask for next DTIM (?) */ -#define AR5K_SLEEP0_NEXT_DTIM_S 0 -#define AR5K_SLEEP0_ASSUME_DTIM 0x00080000 /* Assume DTIM */ -#define AR5K_SLEEP0_ENH_SLEEP_EN 0x00100000 /* Enable enhanced sleep control */ -#define AR5K_SLEEP0_CABTO 0xff000000 /* Mask for CAB Time Out */ -#define AR5K_SLEEP0_CABTO_S 24 - -/* - * Second enhanced sleep register - */ -#define AR5K_SLEEP1 0x80d8 /* Register Address */ -#define AR5K_SLEEP1_NEXT_TIM 0x0007ffff /* Mask for next TIM (?) */ -#define AR5K_SLEEP1_NEXT_TIM_S 0 -#define AR5K_SLEEP1_BEACON_TO 0xff000000 /* Mask for Beacon Time Out */ -#define AR5K_SLEEP1_BEACON_TO_S 24 - -/* - * Third enhanced sleep register - */ -#define AR5K_SLEEP2 0x80dc /* Register Address */ -#define AR5K_SLEEP2_TIM_PER 0x0000ffff /* Mask for TIM period (?) */ -#define AR5K_SLEEP2_TIM_PER_S 0 -#define AR5K_SLEEP2_DTIM_PER 0xffff0000 /* Mask for DTIM period (?) */ -#define AR5K_SLEEP2_DTIM_PER_S 16 - -/* - * TX power control (TPC) register - * - * XXX: PCDAC steps (0.5dBm) or dBm ? - * - */ -#define AR5K_TXPC 0x80e8 /* Register Address */ -#define AR5K_TXPC_ACK_M 0x0000003f /* ACK tx power */ -#define AR5K_TXPC_ACK_S 0 -#define AR5K_TXPC_CTS_M 0x00003f00 /* CTS tx power */ -#define AR5K_TXPC_CTS_S 8 -#define AR5K_TXPC_CHIRP_M 0x003f0000 /* CHIRP tx power */ -#define AR5K_TXPC_CHIRP_S 16 -#define AR5K_TXPC_DOPPLER 0x0f000000 /* Doppler chirp span (?) */ -#define AR5K_TXPC_DOPPLER_S 24 - -/* - * Profile count registers - * - * These registers can be cleared and frozen with ATH5K_MIBC, but they do not - * generate a MIB interrupt. - * Instead of overflowing, they shift by one bit to the right. All registers - * shift together, i.e. when one reaches the max, all shift at the same time by - * one bit to the right. This way we should always get consistent values. - */ -#define AR5K_PROFCNT_TX 0x80ec /* Tx count */ -#define AR5K_PROFCNT_RX 0x80f0 /* Rx count */ -#define AR5K_PROFCNT_RXCLR 0x80f4 /* Busy count */ -#define AR5K_PROFCNT_CYCLE 0x80f8 /* Cycle counter */ - -/* - * Quiet period control registers - */ -#define AR5K_QUIET_CTL1 0x80fc /* Register Address */ -#define AR5K_QUIET_CTL1_NEXT_QT_TSF 0x0000ffff /* Next quiet period TSF (TU) */ -#define AR5K_QUIET_CTL1_NEXT_QT_TSF_S 0 -#define AR5K_QUIET_CTL1_QT_EN 0x00010000 /* Enable quiet period */ -#define AR5K_QUIET_CTL1_ACK_CTS_EN 0x00020000 /* Send ACK/CTS during quiet period */ - -#define AR5K_QUIET_CTL2 0x8100 /* Register Address */ -#define AR5K_QUIET_CTL2_QT_PER 0x0000ffff /* Mask for quiet period periodicity */ -#define AR5K_QUIET_CTL2_QT_PER_S 0 -#define AR5K_QUIET_CTL2_QT_DUR 0xffff0000 /* Mask for quiet period duration */ -#define AR5K_QUIET_CTL2_QT_DUR_S 16 - -/* - * TSF parameter register - */ -#define AR5K_TSF_PARM 0x8104 /* Register Address */ -#define AR5K_TSF_PARM_INC 0x000000ff /* Mask for TSF increment */ -#define AR5K_TSF_PARM_INC_S 0 - -/* - * QoS NOACK policy - */ -#define AR5K_QOS_NOACK 0x8108 /* Register Address */ -#define AR5K_QOS_NOACK_2BIT_VALUES 0x0000000f /* ??? */ -#define AR5K_QOS_NOACK_2BIT_VALUES_S 0 -#define AR5K_QOS_NOACK_BIT_OFFSET 0x00000070 /* ??? */ -#define AR5K_QOS_NOACK_BIT_OFFSET_S 4 -#define AR5K_QOS_NOACK_BYTE_OFFSET 0x00000180 /* ??? */ -#define AR5K_QOS_NOACK_BYTE_OFFSET_S 7 - -/* - * PHY error filter register - */ -#define AR5K_PHY_ERR_FIL 0x810c -#define AR5K_PHY_ERR_FIL_RADAR 0x00000020 /* Radar signal */ -#define AR5K_PHY_ERR_FIL_OFDM 0x00020000 /* OFDM false detect (ANI) */ -#define AR5K_PHY_ERR_FIL_CCK 0x02000000 /* CCK false detect (ANI) */ - -/* - * XR latency register - */ -#define AR5K_XRLAT_TX 0x8110 - -/* - * ACK SIFS register - */ -#define AR5K_ACKSIFS 0x8114 /* Register Address */ -#define AR5K_ACKSIFS_INC 0x00000000 /* ACK SIFS Increment (field) */ - -/* - * MIC QoS control register (?) - */ -#define AR5K_MIC_QOS_CTL 0x8118 /* Register Address */ -#define AR5K_MIC_QOS_CTL_OFF(_n) (1 << (_n * 2)) -#define AR5K_MIC_QOS_CTL_MQ_EN 0x00010000 /* Enable MIC QoS */ - -/* - * MIC QoS select register (?) - */ -#define AR5K_MIC_QOS_SEL 0x811c -#define AR5K_MIC_QOS_SEL_OFF(_n) (1 << (_n * 4)) - -/* - * Misc mode control register (?) - */ -#define AR5K_MISC_MODE 0x8120 /* Register Address */ -#define AR5K_MISC_MODE_FBSSID_MATCH 0x00000001 /* Force BSSID match */ -#define AR5K_MISC_MODE_ACKSIFS_MEM 0x00000002 /* ACK SIFS memory (?) */ -#define AR5K_MISC_MODE_COMBINED_MIC 0x00000004 /* use rx/tx MIC key */ -/* more bits */ - -/* - * OFDM Filter counter - */ -#define AR5K_OFDM_FIL_CNT 0x8124 - -/* - * CCK Filter counter - */ -#define AR5K_CCK_FIL_CNT 0x8128 - -/* - * PHY Error Counters (same masks as AR5K_PHY_ERR_FIL) - */ -#define AR5K_PHYERR_CNT1 0x812c -#define AR5K_PHYERR_CNT1_MASK 0x8130 - -#define AR5K_PHYERR_CNT2 0x8134 -#define AR5K_PHYERR_CNT2_MASK 0x8138 - -/* if the PHY Error Counters reach this maximum, we get MIB interrupts */ -#define ATH5K_PHYERR_CNT_MAX 0x00c00000 - -/* - * TSF Threshold register (?) - */ -#define AR5K_TSF_THRES 0x813c - -/* - * TODO: Wake On Wireless registers - * Range: 0x8147 - 0x818c - */ - -/* - * Rate -> ACK SIFS mapping table (32 entries) - */ -#define AR5K_RATE_ACKSIFS_BASE 0x8680 /* Register Address */ -#define AR5K_RATE_ACKSIFS(_n) (AR5K_RATE_ACKSIFS_BSE + ((_n) << 2)) -#define AR5K_RATE_ACKSIFS_NORMAL 0x00000001 /* Normal SIFS (field) */ -#define AR5K_RATE_ACKSIFS_TURBO 0x00000400 /* Turbo SIFS (field) */ - -/* - * Rate -> duration mapping table (32 entries) - */ -#define AR5K_RATE_DUR_BASE 0x8700 -#define AR5K_RATE_DUR(_n) (AR5K_RATE_DUR_BASE + ((_n) << 2)) - -/* - * Rate -> db mapping table - * (8 entries, each one has 4 8bit fields) - */ -#define AR5K_RATE2DB_BASE 0x87c0 -#define AR5K_RATE2DB(_n) (AR5K_RATE2DB_BASE + ((_n) << 2)) - -/* - * db -> Rate mapping table - * (8 entries, each one has 4 8bit fields) - */ -#define AR5K_DB2RATE_BASE 0x87e0 -#define AR5K_DB2RATE(_n) (AR5K_DB2RATE_BASE + ((_n) << 2)) - -/*===5212 end===*/ - -#define AR5K_KEYTABLE_SIZE_5210 64 -#define AR5K_KEYTABLE_SIZE_5211 128 - -/*===PHY REGISTERS===*/ - -/* - * PHY registers start - */ -#define AR5K_PHY_BASE 0x9800 -#define AR5K_PHY(_n) (AR5K_PHY_BASE + ((_n) << 2)) - -/* - * TST_2 (Misc config parameters) - */ -#define AR5K_PHY_TST2 0x9800 /* Register Address */ -#define AR5K_PHY_TST2_TRIG_SEL 0x00000007 /* Trigger select (?)*/ -#define AR5K_PHY_TST2_TRIG 0x00000010 /* Trigger (?) */ -#define AR5K_PHY_TST2_CBUS_MODE 0x00000060 /* Cardbus mode (?) */ -#define AR5K_PHY_TST2_CLK32 0x00000400 /* CLK_OUT is CLK32 (32kHz external) */ -#define AR5K_PHY_TST2_CHANCOR_DUMP_EN 0x00000800 /* Enable Chancor dump (?) */ -#define AR5K_PHY_TST2_EVEN_CHANCOR_DUMP 0x00001000 /* Even Chancor dump (?) */ -#define AR5K_PHY_TST2_RFSILENT_EN 0x00002000 /* Enable RFSILENT */ -#define AR5K_PHY_TST2_ALT_RFDATA 0x00004000 /* Alternate RFDATA (5-2GHz switch ?) */ -#define AR5K_PHY_TST2_MINI_OBS_EN 0x00008000 /* Enable mini OBS (?) */ -#define AR5K_PHY_TST2_RX2_IS_RX5_INV 0x00010000 /* 2GHz rx path is the 5GHz path inverted (?) */ -#define AR5K_PHY_TST2_SLOW_CLK160 0x00020000 /* Slow CLK160 (?) */ -#define AR5K_PHY_TST2_AGC_OBS_SEL_3 0x00040000 /* AGC OBS Select 3 (?) */ -#define AR5K_PHY_TST2_BBB_OBS_SEL 0x00080000 /* BB OBS Select (field ?) */ -#define AR5K_PHY_TST2_ADC_OBS_SEL 0x00800000 /* ADC OBS Select (field ?) */ -#define AR5K_PHY_TST2_RX_CLR_SEL 0x08000000 /* RX Clear Select (?) */ -#define AR5K_PHY_TST2_FORCE_AGC_CLR 0x10000000 /* Force AGC clear (?) */ -#define AR5K_PHY_SHIFT_2GHZ 0x00004007 /* Used to access 2GHz radios */ -#define AR5K_PHY_SHIFT_5GHZ 0x00000007 /* Used to access 5GHz radios (default) */ - -/* - * PHY frame control register [5110] /turbo mode register [5111+] - * - * There is another frame control register for [5111+] - * at address 0x9944 (see below) but the 2 first flags - * are common here between 5110 frame control register - * and [5111+] turbo mode register, so this also works as - * a "turbo mode register" for 5110. We treat this one as - * a frame control register for 5110 below. - */ -#define AR5K_PHY_TURBO 0x9804 /* Register Address */ -#define AR5K_PHY_TURBO_MODE 0x00000001 /* Enable turbo mode */ -#define AR5K_PHY_TURBO_SHORT 0x00000002 /* Set short symbols to turbo mode */ -#define AR5K_PHY_TURBO_MIMO 0x00000004 /* Set turbo for mimo */ - -/* - * PHY agility command register - * (aka TST_1) - */ -#define AR5K_PHY_AGC 0x9808 /* Register Address */ -#define AR5K_PHY_TST1 0x9808 -#define AR5K_PHY_AGC_DISABLE 0x08000000 /* Disable AGC to A2 (?)*/ -#define AR5K_PHY_TST1_TXHOLD 0x00003800 /* Set tx hold (?) */ -#define AR5K_PHY_TST1_TXSRC_SRC 0x00000002 /* Used with bit 7 (?) */ -#define AR5K_PHY_TST1_TXSRC_SRC_S 1 -#define AR5K_PHY_TST1_TXSRC_ALT 0x00000080 /* Set input to tsdac (?) */ -#define AR5K_PHY_TST1_TXSRC_ALT_S 7 - - -/* - * PHY timing register 3 [5112+] - */ -#define AR5K_PHY_TIMING_3 0x9814 -#define AR5K_PHY_TIMING_3_DSC_MAN 0xfffe0000 -#define AR5K_PHY_TIMING_3_DSC_MAN_S 17 -#define AR5K_PHY_TIMING_3_DSC_EXP 0x0001e000 -#define AR5K_PHY_TIMING_3_DSC_EXP_S 13 - -/* - * PHY chip revision register - */ -#define AR5K_PHY_CHIP_ID 0x9818 - -/* - * PHY activation register - */ -#define AR5K_PHY_ACT 0x981c /* Register Address */ -#define AR5K_PHY_ACT_ENABLE 0x00000001 /* Activate PHY */ -#define AR5K_PHY_ACT_DISABLE 0x00000002 /* Deactivate PHY */ - -/* - * PHY RF control registers - */ -#define AR5K_PHY_RF_CTL2 0x9824 /* Register Address */ -#define AR5K_PHY_RF_CTL2_TXF2TXD_START 0x0000000f /* TX frame to TX data start */ -#define AR5K_PHY_RF_CTL2_TXF2TXD_START_S 0 - -#define AR5K_PHY_RF_CTL3 0x9828 /* Register Address */ -#define AR5K_PHY_RF_CTL3_TXE2XLNA_ON 0x0000ff00 /* TX end to XLNA on */ -#define AR5K_PHY_RF_CTL3_TXE2XLNA_ON_S 8 - -#define AR5K_PHY_ADC_CTL 0x982c -#define AR5K_PHY_ADC_CTL_INBUFGAIN_OFF 0x00000003 -#define AR5K_PHY_ADC_CTL_INBUFGAIN_OFF_S 0 -#define AR5K_PHY_ADC_CTL_PWD_DAC_OFF 0x00002000 -#define AR5K_PHY_ADC_CTL_PWD_BAND_GAP_OFF 0x00004000 -#define AR5K_PHY_ADC_CTL_PWD_ADC_OFF 0x00008000 -#define AR5K_PHY_ADC_CTL_INBUFGAIN_ON 0x00030000 -#define AR5K_PHY_ADC_CTL_INBUFGAIN_ON_S 16 - -#define AR5K_PHY_RF_CTL4 0x9834 /* Register Address */ -#define AR5K_PHY_RF_CTL4_TXF2XPA_A_ON 0x00000001 /* TX frame to XPA A on (field) */ -#define AR5K_PHY_RF_CTL4_TXF2XPA_B_ON 0x00000100 /* TX frame to XPA B on (field) */ -#define AR5K_PHY_RF_CTL4_TXE2XPA_A_OFF 0x00010000 /* TX end to XPA A off (field) */ -#define AR5K_PHY_RF_CTL4_TXE2XPA_B_OFF 0x01000000 /* TX end to XPA B off (field) */ - -/* - * Pre-Amplifier control register - * (XPA -> external pre-amplifier) - */ -#define AR5K_PHY_PA_CTL 0x9838 /* Register Address */ -#define AR5K_PHY_PA_CTL_XPA_A_HI 0x00000001 /* XPA A high (?) */ -#define AR5K_PHY_PA_CTL_XPA_B_HI 0x00000002 /* XPA B high (?) */ -#define AR5K_PHY_PA_CTL_XPA_A_EN 0x00000004 /* Enable XPA A */ -#define AR5K_PHY_PA_CTL_XPA_B_EN 0x00000008 /* Enable XPA B */ - -/* - * PHY settling register - */ -#define AR5K_PHY_SETTLING 0x9844 /* Register Address */ -#define AR5K_PHY_SETTLING_AGC 0x0000007f /* AGC settling time */ -#define AR5K_PHY_SETTLING_AGC_S 0 -#define AR5K_PHY_SETTLING_SWITCH 0x00003f80 /* Switch settling time */ -#define AR5K_PHY_SETTLING_SWITCH_S 7 - -/* - * PHY Gain registers - */ -#define AR5K_PHY_GAIN 0x9848 /* Register Address */ -#define AR5K_PHY_GAIN_TXRX_ATTEN 0x0003f000 /* TX-RX Attenuation */ -#define AR5K_PHY_GAIN_TXRX_ATTEN_S 12 -#define AR5K_PHY_GAIN_TXRX_RF_MAX 0x007c0000 -#define AR5K_PHY_GAIN_TXRX_RF_MAX_S 18 - -#define AR5K_PHY_GAIN_OFFSET 0x984c /* Register Address */ -#define AR5K_PHY_GAIN_OFFSET_RXTX_FLAG 0x00020000 /* RX-TX flag (?) */ - -/* - * Desired ADC/PGA size register - * (for more infos read ANI patent) - */ -#define AR5K_PHY_DESIRED_SIZE 0x9850 /* Register Address */ -#define AR5K_PHY_DESIRED_SIZE_ADC 0x000000ff /* ADC desired size */ -#define AR5K_PHY_DESIRED_SIZE_ADC_S 0 -#define AR5K_PHY_DESIRED_SIZE_PGA 0x0000ff00 /* PGA desired size */ -#define AR5K_PHY_DESIRED_SIZE_PGA_S 8 -#define AR5K_PHY_DESIRED_SIZE_TOT 0x0ff00000 /* Total desired size */ -#define AR5K_PHY_DESIRED_SIZE_TOT_S 20 - -/* - * PHY signal register - * (for more infos read ANI patent) - */ -#define AR5K_PHY_SIG 0x9858 /* Register Address */ -#define AR5K_PHY_SIG_FIRSTEP 0x0003f000 /* FIRSTEP */ -#define AR5K_PHY_SIG_FIRSTEP_S 12 -#define AR5K_PHY_SIG_FIRPWR 0x03fc0000 /* FIPWR */ -#define AR5K_PHY_SIG_FIRPWR_S 18 - -/* - * PHY coarse agility control register - * (for more infos read ANI patent) - */ -#define AR5K_PHY_AGCCOARSE 0x985c /* Register Address */ -#define AR5K_PHY_AGCCOARSE_LO 0x00007f80 /* AGC Coarse low */ -#define AR5K_PHY_AGCCOARSE_LO_S 7 -#define AR5K_PHY_AGCCOARSE_HI 0x003f8000 /* AGC Coarse high */ -#define AR5K_PHY_AGCCOARSE_HI_S 15 - -/* - * PHY agility control register - */ -#define AR5K_PHY_AGCCTL 0x9860 /* Register address */ -#define AR5K_PHY_AGCCTL_CAL 0x00000001 /* Enable PHY calibration */ -#define AR5K_PHY_AGCCTL_NF 0x00000002 /* Enable Noise Floor calibration */ -#define AR5K_PHY_AGCCTL_OFDM_DIV_DIS 0x00000008 /* Disable antenna diversity on OFDM modes */ -#define AR5K_PHY_AGCCTL_NF_EN 0x00008000 /* Enable nf calibration to happen (?) */ -#define AR5K_PHY_AGCTL_FLTR_CAL 0x00010000 /* Allow filter calibration (?) */ -#define AR5K_PHY_AGCCTL_NF_NOUPDATE 0x00020000 /* Don't update nf automatically */ - -/* - * PHY noise floor status register (CCA = Clear Channel Assessment) - */ -#define AR5K_PHY_NF 0x9864 /* Register address */ -#define AR5K_PHY_NF_M 0x000001ff /* Noise floor, written to hardware in 1/2 dBm units */ -#define AR5K_PHY_NF_SVAL(_n) (((_n) & AR5K_PHY_NF_M) | (1 << 9)) -#define AR5K_PHY_NF_THRESH62 0x0007f000 /* Thresh62 -check ANI patent- (field) */ -#define AR5K_PHY_NF_THRESH62_S 12 -#define AR5K_PHY_NF_MINCCA_PWR 0x0ff80000 /* Minimum measured noise level, read from hardware in 1 dBm units */ -#define AR5K_PHY_NF_MINCCA_PWR_S 19 - -/* - * PHY ADC saturation register [5110] - */ -#define AR5K_PHY_ADCSAT 0x9868 -#define AR5K_PHY_ADCSAT_ICNT 0x0001f800 -#define AR5K_PHY_ADCSAT_ICNT_S 11 -#define AR5K_PHY_ADCSAT_THR 0x000007e0 -#define AR5K_PHY_ADCSAT_THR_S 5 - -/* - * PHY Weak ofdm signal detection threshold registers (ANI) [5212+] - */ - -/* High thresholds */ -#define AR5K_PHY_WEAK_OFDM_HIGH_THR 0x9868 -#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_COUNT 0x0000001f -#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_COUNT_S 0 -#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M1 0x00fe0000 -#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M1_S 17 -#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2 0x7f000000 -#define AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_S 24 - -/* Low thresholds */ -#define AR5K_PHY_WEAK_OFDM_LOW_THR 0x986c -#define AR5K_PHY_WEAK_OFDM_LOW_THR_SELFCOR_EN 0x00000001 -#define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_COUNT 0x00003f00 -#define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_COUNT_S 8 -#define AR5K_PHY_WEAK_OFDM_LOW_THR_M1 0x001fc000 -#define AR5K_PHY_WEAK_OFDM_LOW_THR_M1_S 14 -#define AR5K_PHY_WEAK_OFDM_LOW_THR_M2 0x0fe00000 -#define AR5K_PHY_WEAK_OFDM_LOW_THR_M2_S 21 - - -/* - * PHY sleep registers [5112+] - */ -#define AR5K_PHY_SCR 0x9870 - -#define AR5K_PHY_SLMT 0x9874 -#define AR5K_PHY_SLMT_32MHZ 0x0000007f - -#define AR5K_PHY_SCAL 0x9878 -#define AR5K_PHY_SCAL_32MHZ 0x0000000e -#define AR5K_PHY_SCAL_32MHZ_5311 0x00000008 -#define AR5K_PHY_SCAL_32MHZ_2417 0x0000000a -#define AR5K_PHY_SCAL_32MHZ_HB63 0x00000032 - -/* - * PHY PLL (Phase Locked Loop) control register - */ -#define AR5K_PHY_PLL 0x987c -#define AR5K_PHY_PLL_20MHZ 0x00000013 /* For half rate (?) */ -/* 40MHz -> 5GHz band */ -#define AR5K_PHY_PLL_40MHZ_5211 0x00000018 -#define AR5K_PHY_PLL_40MHZ_5212 0x000000aa -#define AR5K_PHY_PLL_40MHZ_5413 0x00000004 -#define AR5K_PHY_PLL_40MHZ (ah->ah_version == AR5K_AR5211 ? \ - AR5K_PHY_PLL_40MHZ_5211 : AR5K_PHY_PLL_40MHZ_5212) -/* 44MHz -> 2.4GHz band */ -#define AR5K_PHY_PLL_44MHZ_5211 0x00000019 -#define AR5K_PHY_PLL_44MHZ_5212 0x000000ab -#define AR5K_PHY_PLL_44MHZ (ah->ah_version == AR5K_AR5211 ? \ - AR5K_PHY_PLL_44MHZ_5211 : AR5K_PHY_PLL_44MHZ_5212) - -#define AR5K_PHY_PLL_RF5111 0x00000000 -#define AR5K_PHY_PLL_RF5112 0x00000040 -#define AR5K_PHY_PLL_HALF_RATE 0x00000100 -#define AR5K_PHY_PLL_QUARTER_RATE 0x00000200 - -/* - * RF Buffer register - * - * It's obvious from the code that 0x989c is the buffer register but - * for the other special registers that we write to after sending each - * packet, i have no idea. So I'll name them BUFFER_CONTROL_X registers - * for now. It's interesting that they are also used for some other operations. - */ - -#define AR5K_RF_BUFFER 0x989c -#define AR5K_RF_BUFFER_CONTROL_0 0x98c0 /* Channel on 5110 */ -#define AR5K_RF_BUFFER_CONTROL_1 0x98c4 /* Bank 7 on 5112 */ -#define AR5K_RF_BUFFER_CONTROL_2 0x98cc /* Bank 7 on 5111 */ - -#define AR5K_RF_BUFFER_CONTROL_3 0x98d0 /* Bank 2 on 5112 */ - /* Channel set on 5111 */ - /* Used to read radio revision*/ - -#define AR5K_RF_BUFFER_CONTROL_4 0x98d4 /* RF Stage register on 5110 */ - /* Bank 0,1,2,6 on 5111 */ - /* Bank 1 on 5112 */ - /* Used during activation on 5111 */ - -#define AR5K_RF_BUFFER_CONTROL_5 0x98d8 /* Bank 3 on 5111 */ - /* Used during activation on 5111 */ - /* Channel on 5112 */ - /* Bank 6 on 5112 */ - -#define AR5K_RF_BUFFER_CONTROL_6 0x98dc /* Bank 3 on 5112 */ - -/* - * PHY RF stage register [5210] - */ -#define AR5K_PHY_RFSTG 0x98d4 -#define AR5K_PHY_RFSTG_DISABLE 0x00000021 - -/* - * BIN masks (?) - */ -#define AR5K_PHY_BIN_MASK_1 0x9900 -#define AR5K_PHY_BIN_MASK_2 0x9904 -#define AR5K_PHY_BIN_MASK_3 0x9908 - -#define AR5K_PHY_BIN_MASK_CTL 0x990c -#define AR5K_PHY_BIN_MASK_CTL_MASK_4 0x00003fff -#define AR5K_PHY_BIN_MASK_CTL_MASK_4_S 0 -#define AR5K_PHY_BIN_MASK_CTL_RATE 0xff000000 -#define AR5K_PHY_BIN_MASK_CTL_RATE_S 24 - -/* - * PHY Antenna control register - */ -#define AR5K_PHY_ANT_CTL 0x9910 /* Register Address */ -#define AR5K_PHY_ANT_CTL_TXRX_EN 0x00000001 /* Enable TX/RX (?) */ -#define AR5K_PHY_ANT_CTL_SECTORED_ANT 0x00000004 /* Sectored Antenna */ -#define AR5K_PHY_ANT_CTL_HITUNE5 0x00000008 /* Hitune5 (?) */ -#define AR5K_PHY_ANT_CTL_SWTABLE_IDLE 0x000003f0 /* Switch table idle (?) */ -#define AR5K_PHY_ANT_CTL_SWTABLE_IDLE_S 4 - -/* - * PHY receiver delay register [5111+] - */ -#define AR5K_PHY_RX_DELAY 0x9914 /* Register Address */ -#define AR5K_PHY_RX_DELAY_M 0x00003fff /* Mask for RX activate to receive delay (/100ns) */ - -/* - * PHY max rx length register (?) [5111] - */ -#define AR5K_PHY_MAX_RX_LEN 0x991c - -/* - * PHY timing register 4 - * I(nphase)/Q(adrature) calibration register [5111+] - */ -#define AR5K_PHY_IQ 0x9920 /* Register Address */ -#define AR5K_PHY_IQ_CORR_Q_Q_COFF 0x0000001f /* Mask for q correction info */ -#define AR5K_PHY_IQ_CORR_Q_Q_COFF_S 0 -#define AR5K_PHY_IQ_CORR_Q_I_COFF 0x000007e0 /* Mask for i correction info */ -#define AR5K_PHY_IQ_CORR_Q_I_COFF_S 5 -#define AR5K_PHY_IQ_CORR_ENABLE 0x00000800 /* Enable i/q correction */ -#define AR5K_PHY_IQ_CAL_NUM_LOG_MAX 0x0000f000 /* Mask for max number of samples in log scale */ -#define AR5K_PHY_IQ_CAL_NUM_LOG_MAX_S 12 -#define AR5K_PHY_IQ_RUN 0x00010000 /* Run i/q calibration */ -#define AR5K_PHY_IQ_USE_PT_DF 0x00020000 /* Use pilot track df (?) */ -#define AR5K_PHY_IQ_EARLY_TRIG_THR 0x00200000 /* Early trigger threshold (?) (field) */ -#define AR5K_PHY_IQ_PILOT_MASK_EN 0x10000000 /* Enable pilot mask (?) */ -#define AR5K_PHY_IQ_CHAN_MASK_EN 0x20000000 /* Enable channel mask (?) */ -#define AR5K_PHY_IQ_SPUR_FILT_EN 0x40000000 /* Enable spur filter */ -#define AR5K_PHY_IQ_SPUR_RSSI_EN 0x80000000 /* Enable spur rssi */ - -/* - * PHY timing register 5 - * OFDM Self-correlator Cyclic RSSI threshold params - * (Check out bb_cycpwr_thr1 on ANI patent) - */ -#define AR5K_PHY_OFDM_SELFCORR 0x9924 /* Register Address */ -#define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_EN 0x00000001 /* Enable cyclic RSSI thr 1 */ -#define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1 0x000000fe /* Mask for Cyclic RSSI threshold 1 */ -#define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_S 1 -#define AR5K_PHY_OFDM_SELFCORR_CYPWR_THR3 0x00000100 /* Cyclic RSSI threshold 3 (field) (?) */ -#define AR5K_PHY_OFDM_SELFCORR_RSSI_1ATHR_EN 0x00008000 /* Enable 1A RSSI threshold (?) */ -#define AR5K_PHY_OFDM_SELFCORR_RSSI_1ATHR 0x00010000 /* 1A RSSI threshold (field) (?) */ -#define AR5K_PHY_OFDM_SELFCORR_LSCTHR_HIRSSI 0x00800000 /* Long sc threshold hi rssi (?) */ - -/* - * PHY-only warm reset register - */ -#define AR5K_PHY_WARM_RESET 0x9928 - -/* - * PHY-only control register - */ -#define AR5K_PHY_CTL 0x992c /* Register Address */ -#define AR5K_PHY_CTL_RX_DRAIN_RATE 0x00000001 /* RX drain rate (?) */ -#define AR5K_PHY_CTL_LATE_TX_SIG_SYM 0x00000002 /* Late tx signal symbol (?) */ -#define AR5K_PHY_CTL_GEN_SCRAMBLER 0x00000004 /* Generate scrambler */ -#define AR5K_PHY_CTL_TX_ANT_SEL 0x00000008 /* TX antenna select */ -#define AR5K_PHY_CTL_TX_ANT_STATIC 0x00000010 /* Static TX antenna */ -#define AR5K_PHY_CTL_RX_ANT_SEL 0x00000020 /* RX antenna select */ -#define AR5K_PHY_CTL_RX_ANT_STATIC 0x00000040 /* Static RX antenna */ -#define AR5K_PHY_CTL_LOW_FREQ_SLE_EN 0x00000080 /* Enable low freq sleep */ - -/* - * PHY PAPD probe register [5111+] - */ -#define AR5K_PHY_PAPD_PROBE 0x9930 -#define AR5K_PHY_PAPD_PROBE_SH_HI_PAR 0x00000001 -#define AR5K_PHY_PAPD_PROBE_PCDAC_BIAS 0x00000002 -#define AR5K_PHY_PAPD_PROBE_COMP_GAIN 0x00000040 -#define AR5K_PHY_PAPD_PROBE_TXPOWER 0x00007e00 -#define AR5K_PHY_PAPD_PROBE_TXPOWER_S 9 -#define AR5K_PHY_PAPD_PROBE_TX_NEXT 0x00008000 -#define AR5K_PHY_PAPD_PROBE_PREDIST_EN 0x00010000 -#define AR5K_PHY_PAPD_PROBE_TYPE 0x01800000 /* [5112+] */ -#define AR5K_PHY_PAPD_PROBE_TYPE_S 23 -#define AR5K_PHY_PAPD_PROBE_TYPE_OFDM 0 -#define AR5K_PHY_PAPD_PROBE_TYPE_XR 1 -#define AR5K_PHY_PAPD_PROBE_TYPE_CCK 2 -#define AR5K_PHY_PAPD_PROBE_GAINF 0xfe000000 -#define AR5K_PHY_PAPD_PROBE_GAINF_S 25 -#define AR5K_PHY_PAPD_PROBE_INI_5111 0x00004883 /* [5212+] */ -#define AR5K_PHY_PAPD_PROBE_INI_5112 0x00004882 /* [5212+] */ - -/* - * PHY TX rate power registers [5112+] - */ -#define AR5K_PHY_TXPOWER_RATE1 0x9934 -#define AR5K_PHY_TXPOWER_RATE2 0x9938 -#define AR5K_PHY_TXPOWER_RATE_MAX 0x993c -#define AR5K_PHY_TXPOWER_RATE_MAX_TPC_ENABLE 0x00000040 -#define AR5K_PHY_TXPOWER_RATE3 0xa234 -#define AR5K_PHY_TXPOWER_RATE4 0xa238 - -/* - * PHY frame control register [5111+] - */ -#define AR5K_PHY_FRAME_CTL_5210 0x9804 -#define AR5K_PHY_FRAME_CTL_5211 0x9944 -#define AR5K_PHY_FRAME_CTL (ah->ah_version == AR5K_AR5210 ? \ - AR5K_PHY_FRAME_CTL_5210 : AR5K_PHY_FRAME_CTL_5211) -/*---[5111+]---*/ -#define AR5K_PHY_FRAME_CTL_WIN_LEN 0x00000003 /* Force window length (?) */ -#define AR5K_PHY_FRAME_CTL_WIN_LEN_S 0 -#define AR5K_PHY_FRAME_CTL_TX_CLIP 0x00000038 /* Mask for tx clip (?) */ -#define AR5K_PHY_FRAME_CTL_TX_CLIP_S 3 -#define AR5K_PHY_FRAME_CTL_PREP_CHINFO 0x00010000 /* Prepend chan info */ -#define AR5K_PHY_FRAME_CTL_EMU 0x80000000 -#define AR5K_PHY_FRAME_CTL_EMU_S 31 -/*---[5110/5111]---*/ -#define AR5K_PHY_FRAME_CTL_TIMING_ERR 0x01000000 /* PHY timing error */ -#define AR5K_PHY_FRAME_CTL_PARITY_ERR 0x02000000 /* Parity error */ -#define AR5K_PHY_FRAME_CTL_ILLRATE_ERR 0x04000000 /* Illegal rate */ -#define AR5K_PHY_FRAME_CTL_ILLLEN_ERR 0x08000000 /* Illegal length */ -#define AR5K_PHY_FRAME_CTL_SERVICE_ERR 0x20000000 -#define AR5K_PHY_FRAME_CTL_TXURN_ERR 0x40000000 /* TX underrun */ -#define AR5K_PHY_FRAME_CTL_INI \ - (AR5K_PHY_FRAME_CTL_SERVICE_ERR | \ - AR5K_PHY_FRAME_CTL_TXURN_ERR | \ - AR5K_PHY_FRAME_CTL_ILLLEN_ERR | \ - AR5K_PHY_FRAME_CTL_ILLRATE_ERR | \ - AR5K_PHY_FRAME_CTL_PARITY_ERR | \ - AR5K_PHY_FRAME_CTL_TIMING_ERR) - -/* - * PHY Tx Power adjustment register [5212A+] - */ -#define AR5K_PHY_TX_PWR_ADJ 0x994c -#define AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA 0x00000fc0 -#define AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA_S 6 -#define AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX 0x00fc0000 -#define AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX_S 18 - -/* - * PHY radar detection register [5111+] - */ -#define AR5K_PHY_RADAR 0x9954 -#define AR5K_PHY_RADAR_ENABLE 0x00000001 -#define AR5K_PHY_RADAR_DISABLE 0x00000000 -#define AR5K_PHY_RADAR_INBANDTHR 0x0000003e /* Inband threshold - 5-bits, units unknown {0..31} - (? MHz ?) */ -#define AR5K_PHY_RADAR_INBANDTHR_S 1 - -#define AR5K_PHY_RADAR_PRSSI_THR 0x00000fc0 /* Pulse RSSI/SNR threshold - 6-bits, dBm range {0..63} - in dBm units. */ -#define AR5K_PHY_RADAR_PRSSI_THR_S 6 - -#define AR5K_PHY_RADAR_PHEIGHT_THR 0x0003f000 /* Pulse height threshold - 6-bits, dBm range {0..63} - in dBm units. */ -#define AR5K_PHY_RADAR_PHEIGHT_THR_S 12 - -#define AR5K_PHY_RADAR_RSSI_THR 0x00fc0000 /* Radar RSSI/SNR threshold. - 6-bits, dBm range {0..63} - in dBm units. */ -#define AR5K_PHY_RADAR_RSSI_THR_S 18 - -#define AR5K_PHY_RADAR_FIRPWR_THR 0x7f000000 /* Finite Impulse Response - filter power out threshold. - 7-bits, standard power range - {0..127} in 1/2 dBm units. */ -#define AR5K_PHY_RADAR_FIRPWR_THRS 24 - -/* - * PHY antenna switch table registers - */ -#define AR5K_PHY_ANT_SWITCH_TABLE_0 0x9960 -#define AR5K_PHY_ANT_SWITCH_TABLE_1 0x9964 - -/* - * PHY Noise floor threshold - */ -#define AR5K_PHY_NFTHRES 0x9968 - -/* - * Sigma Delta register (?) [5213] - */ -#define AR5K_PHY_SIGMA_DELTA 0x996C -#define AR5K_PHY_SIGMA_DELTA_ADC_SEL 0x00000003 -#define AR5K_PHY_SIGMA_DELTA_ADC_SEL_S 0 -#define AR5K_PHY_SIGMA_DELTA_FILT2 0x000000f8 -#define AR5K_PHY_SIGMA_DELTA_FILT2_S 3 -#define AR5K_PHY_SIGMA_DELTA_FILT1 0x00001f00 -#define AR5K_PHY_SIGMA_DELTA_FILT1_S 8 -#define AR5K_PHY_SIGMA_DELTA_ADC_CLIP 0x01ffe000 -#define AR5K_PHY_SIGMA_DELTA_ADC_CLIP_S 13 - -/* - * RF restart register [5112+] (?) - */ -#define AR5K_PHY_RESTART 0x9970 /* restart */ -#define AR5K_PHY_RESTART_DIV_GC 0x001c0000 /* Fast diversity gc_limit (?) */ -#define AR5K_PHY_RESTART_DIV_GC_S 18 - -/* - * RF Bus access request register (for synth-only channel switching) - */ -#define AR5K_PHY_RFBUS_REQ 0x997C -#define AR5K_PHY_RFBUS_REQ_REQUEST 0x00000001 - -/* - * Spur mitigation masks (?) - */ -#define AR5K_PHY_TIMING_7 0x9980 -#define AR5K_PHY_TIMING_8 0x9984 -#define AR5K_PHY_TIMING_8_PILOT_MASK_2 0x000fffff -#define AR5K_PHY_TIMING_8_PILOT_MASK_2_S 0 - -#define AR5K_PHY_BIN_MASK2_1 0x9988 -#define AR5K_PHY_BIN_MASK2_2 0x998c -#define AR5K_PHY_BIN_MASK2_3 0x9990 - -#define AR5K_PHY_BIN_MASK2_4 0x9994 -#define AR5K_PHY_BIN_MASK2_4_MASK_4 0x00003fff -#define AR5K_PHY_BIN_MASK2_4_MASK_4_S 0 - -#define AR5K_PHY_TIMING_9 0x9998 -#define AR5K_PHY_TIMING_10 0x999c -#define AR5K_PHY_TIMING_10_PILOT_MASK_2 0x000fffff -#define AR5K_PHY_TIMING_10_PILOT_MASK_2_S 0 - -/* - * Spur mitigation control - */ -#define AR5K_PHY_TIMING_11 0x99a0 /* Register address */ -#define AR5K_PHY_TIMING_11_SPUR_DELTA_PHASE 0x000fffff /* Spur delta phase */ -#define AR5K_PHY_TIMING_11_SPUR_DELTA_PHASE_S 0 -#define AR5K_PHY_TIMING_11_SPUR_FREQ_SD 0x3ff00000 /* Freq sigma delta */ -#define AR5K_PHY_TIMING_11_SPUR_FREQ_SD_S 20 -#define AR5K_PHY_TIMING_11_USE_SPUR_IN_AGC 0x40000000 /* Spur filter in AGC detector */ -#define AR5K_PHY_TIMING_11_USE_SPUR_IN_SELFCOR 0x80000000 /* Spur filter in OFDM self correlator */ - -/* - * Gain tables - */ -#define AR5K_BB_GAIN_BASE 0x9b00 /* BaseBand Amplifier Gain table base address */ -#define AR5K_BB_GAIN(_n) (AR5K_BB_GAIN_BASE + ((_n) << 2)) -#define AR5K_RF_GAIN_BASE 0x9a00 /* RF Amplifier Gain table base address */ -#define AR5K_RF_GAIN(_n) (AR5K_RF_GAIN_BASE + ((_n) << 2)) - -/* - * PHY timing IQ calibration result register [5111+] - */ -#define AR5K_PHY_IQRES_CAL_PWR_I 0x9c10 /* I (Inphase) power value */ -#define AR5K_PHY_IQRES_CAL_PWR_Q 0x9c14 /* Q (Quadrature) power value */ -#define AR5K_PHY_IQRES_CAL_CORR 0x9c18 /* I/Q Correlation */ - -/* - * PHY current RSSI register [5111+] - */ -#define AR5K_PHY_CURRENT_RSSI 0x9c1c - -/* - * PHY RF Bus grant register - */ -#define AR5K_PHY_RFBUS_GRANT 0x9c20 -#define AR5K_PHY_RFBUS_GRANT_OK 0x00000001 - -/* - * PHY ADC test register - */ -#define AR5K_PHY_ADC_TEST 0x9c24 -#define AR5K_PHY_ADC_TEST_I 0x00000001 -#define AR5K_PHY_ADC_TEST_Q 0x00000200 - -/* - * PHY DAC test register - */ -#define AR5K_PHY_DAC_TEST 0x9c28 -#define AR5K_PHY_DAC_TEST_I 0x00000001 -#define AR5K_PHY_DAC_TEST_Q 0x00000200 - -/* - * PHY PTAT register (?) - */ -#define AR5K_PHY_PTAT 0x9c2c - -/* - * PHY Illegal TX rate register [5112+] - */ -#define AR5K_PHY_BAD_TX_RATE 0x9c30 - -/* - * PHY SPUR Power register [5112+] - */ -#define AR5K_PHY_SPUR_PWR 0x9c34 /* Register Address */ -#define AR5K_PHY_SPUR_PWR_I 0x00000001 /* SPUR Power estimate for I (field) */ -#define AR5K_PHY_SPUR_PWR_Q 0x00000100 /* SPUR Power estimate for Q (field) */ -#define AR5K_PHY_SPUR_PWR_FILT 0x00010000 /* Power with SPUR removed (field) */ - -/* - * PHY Channel status register [5112+] (?) - */ -#define AR5K_PHY_CHAN_STATUS 0x9c38 -#define AR5K_PHY_CHAN_STATUS_BT_ACT 0x00000001 -#define AR5K_PHY_CHAN_STATUS_RX_CLR_RAW 0x00000002 -#define AR5K_PHY_CHAN_STATUS_RX_CLR_MAC 0x00000004 -#define AR5K_PHY_CHAN_STATUS_RX_CLR_PAP 0x00000008 - -/* - * Heavy clip enable register - */ -#define AR5K_PHY_HEAVY_CLIP_ENABLE 0x99e0 - -/* - * PHY clock sleep registers [5112+] - */ -#define AR5K_PHY_SCLOCK 0x99f0 -#define AR5K_PHY_SCLOCK_32MHZ 0x0000000c -#define AR5K_PHY_SDELAY 0x99f4 -#define AR5K_PHY_SDELAY_32MHZ 0x000000ff -#define AR5K_PHY_SPENDING 0x99f8 - - -/* - * PHY PAPD I (power?) table (?) - * (92! entries) - */ -#define AR5K_PHY_PAPD_I_BASE 0xa000 -#define AR5K_PHY_PAPD_I(_n) (AR5K_PHY_PAPD_I_BASE + ((_n) << 2)) - -/* - * PHY PCDAC TX power table - */ -#define AR5K_PHY_PCDAC_TXPOWER_BASE 0xa180 -#define AR5K_PHY_PCDAC_TXPOWER(_n) (AR5K_PHY_PCDAC_TXPOWER_BASE + ((_n) << 2)) - -/* - * PHY mode register [5111+] - */ -#define AR5K_PHY_MODE 0x0a200 /* Register Address */ -#define AR5K_PHY_MODE_MOD 0x00000001 /* PHY Modulation bit */ -#define AR5K_PHY_MODE_MOD_OFDM 0 -#define AR5K_PHY_MODE_MOD_CCK 1 -#define AR5K_PHY_MODE_FREQ 0x00000002 /* Freq mode bit */ -#define AR5K_PHY_MODE_FREQ_5GHZ 0 -#define AR5K_PHY_MODE_FREQ_2GHZ 2 -#define AR5K_PHY_MODE_MOD_DYN 0x00000004 /* Enable Dynamic OFDM/CCK mode [5112+] */ -#define AR5K_PHY_MODE_RAD 0x00000008 /* [5212+] */ -#define AR5K_PHY_MODE_RAD_RF5111 0 -#define AR5K_PHY_MODE_RAD_RF5112 8 -#define AR5K_PHY_MODE_XR 0x00000010 /* Enable XR mode [5112+] */ -#define AR5K_PHY_MODE_HALF_RATE 0x00000020 /* Enable Half rate (test) */ -#define AR5K_PHY_MODE_QUARTER_RATE 0x00000040 /* Enable Quarter rat (test) */ - -/* - * PHY CCK transmit control register [5111+ (?)] - */ -#define AR5K_PHY_CCKTXCTL 0xa204 -#define AR5K_PHY_CCKTXCTL_WORLD 0x00000000 -#define AR5K_PHY_CCKTXCTL_JAPAN 0x00000010 -#define AR5K_PHY_CCKTXCTL_SCRAMBLER_DIS 0x00000001 -#define AR5K_PHY_CCKTXCTK_DAC_SCALE 0x00000004 - -/* - * PHY CCK Cross-correlator Barker RSSI threshold register [5212+] - */ -#define AR5K_PHY_CCK_CROSSCORR 0xa208 -#define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR 0x0000003f -#define AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR_S 0 - -/* Same address is used for antenna diversity activation */ -#define AR5K_PHY_FAST_ANT_DIV 0xa208 -#define AR5K_PHY_FAST_ANT_DIV_EN 0x00002000 - -/* - * PHY 2GHz gain register [5111+] - */ -#define AR5K_PHY_GAIN_2GHZ 0xa20c -#define AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX 0x00fc0000 -#define AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX_S 18 -#define AR5K_PHY_GAIN_2GHZ_INI_5111 0x6480416c - -#define AR5K_PHY_CCK_RX_CTL_4 0xa21c -#define AR5K_PHY_CCK_RX_CTL_4_FREQ_EST_SHORT 0x01f80000 -#define AR5K_PHY_CCK_RX_CTL_4_FREQ_EST_SHORT_S 19 - -#define AR5K_PHY_DAG_CCK_CTL 0xa228 -#define AR5K_PHY_DAG_CCK_CTL_EN_RSSI_THR 0x00000200 -#define AR5K_PHY_DAG_CCK_CTL_RSSI_THR 0x0001fc00 -#define AR5K_PHY_DAG_CCK_CTL_RSSI_THR_S 10 - -#define AR5K_PHY_FAST_ADC 0xa24c - -#define AR5K_PHY_BLUETOOTH 0xa254 - -/* - * Transmit Power Control register - * [2413+] - */ -#define AR5K_PHY_TPC_RG1 0xa258 -#define AR5K_PHY_TPC_RG1_NUM_PD_GAIN 0x0000c000 -#define AR5K_PHY_TPC_RG1_NUM_PD_GAIN_S 14 -#define AR5K_PHY_TPC_RG1_PDGAIN_1 0x00030000 -#define AR5K_PHY_TPC_RG1_PDGAIN_1_S 16 -#define AR5K_PHY_TPC_RG1_PDGAIN_2 0x000c0000 -#define AR5K_PHY_TPC_RG1_PDGAIN_2_S 18 -#define AR5K_PHY_TPC_RG1_PDGAIN_3 0x00300000 -#define AR5K_PHY_TPC_RG1_PDGAIN_3_S 20 - -#define AR5K_PHY_TPC_RG5 0xa26C -#define AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP 0x0000000F -#define AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP_S 0 -#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_1 0x000003F0 -#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_1_S 4 -#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_2 0x0000FC00 -#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_2_S 10 -#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_3 0x003F0000 -#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_3_S 16 -#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4 0x0FC00000 -#define AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4_S 22 - -/* - * PHY PDADC Tx power table - */ -#define AR5K_PHY_PDADC_TXPOWER_BASE 0xa280 -#define AR5K_PHY_PDADC_TXPOWER(_n) (AR5K_PHY_PDADC_TXPOWER_BASE + ((_n) << 2)) - -/* - * Platform registers for WiSoC - */ -#define AR5K_AR5312_RESET 0xbc003020 -#define AR5K_AR5312_RESET_BB0_COLD 0x00000004 -#define AR5K_AR5312_RESET_BB1_COLD 0x00000200 -#define AR5K_AR5312_RESET_WMAC0 0x00002000 -#define AR5K_AR5312_RESET_BB0_WARM 0x00004000 -#define AR5K_AR5312_RESET_WMAC1 0x00020000 -#define AR5K_AR5312_RESET_BB1_WARM 0x00040000 - -#define AR5K_AR5312_ENABLE 0xbc003080 -#define AR5K_AR5312_ENABLE_WLAN0 0x00000001 -#define AR5K_AR5312_ENABLE_WLAN1 0x00000008 - -#define AR5K_AR2315_RESET 0xb1000004 -#define AR5K_AR2315_RESET_WMAC 0x00000001 -#define AR5K_AR2315_RESET_BB_WARM 0x00000002 - -#define AR5K_AR2315_AHB_ARB_CTL 0xb1000008 -#define AR5K_AR2315_AHB_ARB_CTL_WLAN 0x00000002 - -#define AR5K_AR2315_BYTESWAP 0xb100000c -#define AR5K_AR2315_BYTESWAP_WMAC 0x00000002 diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c deleted file mode 100644 index a3399c4f13a9..000000000000 --- a/drivers/net/wireless/ath/ath5k/reset.c +++ /dev/null @@ -1,1404 +0,0 @@ -/* - * Copyright (c) 2004-2008 Reyk Floeter - * Copyright (c) 2006-2008 Nick Kossifidis - * Copyright (c) 2007-2008 Luis Rodriguez - * Copyright (c) 2007-2008 Pavel Roskin - * Copyright (c) 2007-2008 Jiri Slaby - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/****************************\ - Reset function and helpers -\****************************/ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include - -#include /* To determine if a card is pci-e */ -#include -#include -#include "ath5k.h" -#include "reg.h" -#include "debug.h" - - -/** - * DOC: Reset function and helpers - * - * Here we implement the main reset routine, used to bring the card - * to a working state and ready to receive. We also handle routines - * that don't fit on other places such as clock, sleep and power control - */ - - -/******************\ -* Helper functions * -\******************/ - -/** - * ath5k_hw_register_timeout() - Poll a register for a flag/field change - * @ah: The &struct ath5k_hw - * @reg: The register to read - * @flag: The flag/field to check on the register - * @val: The field value we expect (if we check a field) - * @is_set: Instead of checking if the flag got cleared, check if it got set - * - * Some registers contain flags that indicate that an operation is - * running. We use this function to poll these registers and check - * if these flags get cleared. We also use it to poll a register - * field (containing multiple flags) until it gets a specific value. - * - * Returns -EAGAIN if we exceeded AR5K_TUNE_REGISTER_TIMEOUT * 15us or 0 - */ -int -ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag, u32 val, - bool is_set) -{ - int i; - u32 data; - - for (i = AR5K_TUNE_REGISTER_TIMEOUT; i > 0; i--) { - data = ath5k_hw_reg_read(ah, reg); - if (is_set && (data & flag)) - break; - else if ((data & flag) == val) - break; - udelay(15); - } - - return (i <= 0) ? -EAGAIN : 0; -} - - -/*************************\ -* Clock related functions * -\*************************/ - -/** - * ath5k_hw_htoclock() - Translate usec to hw clock units - * @ah: The &struct ath5k_hw - * @usec: value in microseconds - * - * Translate usecs to hw clock units based on the current - * hw clock rate. - * - * Returns number of clock units - */ -unsigned int -ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec) -{ - struct ath_common *common = ath5k_hw_common(ah); - return usec * common->clockrate; -} - -/** - * ath5k_hw_clocktoh() - Translate hw clock units to usec - * @ah: The &struct ath5k_hw - * @clock: value in hw clock units - * - * Translate hw clock units to usecs based on the current - * hw clock rate. - * - * Returns number of usecs - */ -unsigned int -ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock) -{ - struct ath_common *common = ath5k_hw_common(ah); - return clock / common->clockrate; -} - -/** - * ath5k_hw_init_core_clock() - Initialize core clock - * @ah: The &struct ath5k_hw - * - * Initialize core clock parameters (usec, usec32, latencies etc), - * based on current bwmode and chipset properties. - */ -static void -ath5k_hw_init_core_clock(struct ath5k_hw *ah) -{ - struct ieee80211_channel *channel = ah->ah_current_channel; - struct ath_common *common = ath5k_hw_common(ah); - u32 usec_reg, txlat, rxlat, usec, clock, sclock, txf2txs; - - /* - * Set core clock frequency - */ - switch (channel->hw_value) { - case AR5K_MODE_11A: - clock = 40; - break; - case AR5K_MODE_11B: - clock = 22; - break; - case AR5K_MODE_11G: - default: - clock = 44; - break; - } - - /* Use clock multiplier for non-default - * bwmode */ - switch (ah->ah_bwmode) { - case AR5K_BWMODE_40MHZ: - clock *= 2; - break; - case AR5K_BWMODE_10MHZ: - clock /= 2; - break; - case AR5K_BWMODE_5MHZ: - clock /= 4; - break; - default: - break; - } - - common->clockrate = clock; - - /* - * Set USEC parameters - */ - /* Set USEC counter on PCU*/ - usec = clock - 1; - usec = AR5K_REG_SM(usec, AR5K_USEC_1); - - /* Set usec duration on DCU */ - if (ah->ah_version != AR5K_AR5210) - AR5K_REG_WRITE_BITS(ah, AR5K_DCU_GBL_IFS_MISC, - AR5K_DCU_GBL_IFS_MISC_USEC_DUR, - clock); - - /* Set 32MHz USEC counter */ - if ((ah->ah_radio == AR5K_RF5112) || - (ah->ah_radio == AR5K_RF2413) || - (ah->ah_radio == AR5K_RF5413) || - (ah->ah_radio == AR5K_RF2316) || - (ah->ah_radio == AR5K_RF2317)) - /* Remain on 40MHz clock ? */ - sclock = 40 - 1; - else - sclock = 32 - 1; - sclock = AR5K_REG_SM(sclock, AR5K_USEC_32); - - /* - * Set tx/rx latencies - */ - usec_reg = ath5k_hw_reg_read(ah, AR5K_USEC_5211); - txlat = AR5K_REG_MS(usec_reg, AR5K_USEC_TX_LATENCY_5211); - rxlat = AR5K_REG_MS(usec_reg, AR5K_USEC_RX_LATENCY_5211); - - /* - * Set default Tx frame to Tx data start delay - */ - txf2txs = AR5K_INIT_TXF2TXD_START_DEFAULT; - - /* - * 5210 initvals don't include usec settings - * so we need to use magic values here for - * tx/rx latencies - */ - if (ah->ah_version == AR5K_AR5210) { - /* same for turbo */ - txlat = AR5K_INIT_TX_LATENCY_5210; - rxlat = AR5K_INIT_RX_LATENCY_5210; - } - - if (ah->ah_mac_srev < AR5K_SREV_AR5211) { - /* 5311 has different tx/rx latency masks - * from 5211, since we deal 5311 the same - * as 5211 when setting initvals, shift - * values here to their proper locations - * - * Note: Initvals indicate tx/rx/ latencies - * are the same for turbo mode */ - txlat = AR5K_REG_SM(txlat, AR5K_USEC_TX_LATENCY_5210); - rxlat = AR5K_REG_SM(rxlat, AR5K_USEC_RX_LATENCY_5210); - } else - switch (ah->ah_bwmode) { - case AR5K_BWMODE_10MHZ: - txlat = AR5K_REG_SM(txlat * 2, - AR5K_USEC_TX_LATENCY_5211); - rxlat = AR5K_REG_SM(AR5K_INIT_RX_LAT_MAX, - AR5K_USEC_RX_LATENCY_5211); - txf2txs = AR5K_INIT_TXF2TXD_START_DELAY_10MHZ; - break; - case AR5K_BWMODE_5MHZ: - txlat = AR5K_REG_SM(txlat * 4, - AR5K_USEC_TX_LATENCY_5211); - rxlat = AR5K_REG_SM(AR5K_INIT_RX_LAT_MAX, - AR5K_USEC_RX_LATENCY_5211); - txf2txs = AR5K_INIT_TXF2TXD_START_DELAY_5MHZ; - break; - case AR5K_BWMODE_40MHZ: - txlat = AR5K_INIT_TX_LAT_MIN; - rxlat = AR5K_REG_SM(rxlat / 2, - AR5K_USEC_RX_LATENCY_5211); - txf2txs = AR5K_INIT_TXF2TXD_START_DEFAULT; - break; - default: - break; - } - - usec_reg = (usec | sclock | txlat | rxlat); - ath5k_hw_reg_write(ah, usec_reg, AR5K_USEC); - - /* On 5112 set tx frame to tx data start delay */ - if (ah->ah_radio == AR5K_RF5112) { - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_RF_CTL2, - AR5K_PHY_RF_CTL2_TXF2TXD_START, - txf2txs); - } -} - -/** - * ath5k_hw_set_sleep_clock() - Setup sleep clock operation - * @ah: The &struct ath5k_hw - * @enable: Enable sleep clock operation (false to disable) - * - * If there is an external 32KHz crystal available, use it - * as ref. clock instead of 32/40MHz clock and baseband clocks - * to save power during sleep or restore normal 32/40MHz - * operation. - * - * NOTE: When operating on 32KHz certain PHY registers (27 - 31, - * 123 - 127) require delay on access. - */ -static void -ath5k_hw_set_sleep_clock(struct ath5k_hw *ah, bool enable) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - u32 scal, spending, sclock; - - /* Only set 32KHz settings if we have an external - * 32KHz crystal present */ - if ((AR5K_EEPROM_HAS32KHZCRYSTAL(ee->ee_misc1) || - AR5K_EEPROM_HAS32KHZCRYSTAL_OLD(ee->ee_misc1)) && - enable) { - - /* 1 usec/cycle */ - AR5K_REG_WRITE_BITS(ah, AR5K_USEC_5211, AR5K_USEC_32, 1); - /* Set up tsf increment on each cycle */ - AR5K_REG_WRITE_BITS(ah, AR5K_TSF_PARM, AR5K_TSF_PARM_INC, 61); - - /* Set baseband sleep control registers - * and sleep control rate */ - ath5k_hw_reg_write(ah, 0x1f, AR5K_PHY_SCR); - - if ((ah->ah_radio == AR5K_RF5112) || - (ah->ah_radio == AR5K_RF5413) || - (ah->ah_radio == AR5K_RF2316) || - (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) - spending = 0x14; - else - spending = 0x18; - ath5k_hw_reg_write(ah, spending, AR5K_PHY_SPENDING); - - if ((ah->ah_radio == AR5K_RF5112) || - (ah->ah_radio == AR5K_RF5413) || - (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) { - ath5k_hw_reg_write(ah, 0x26, AR5K_PHY_SLMT); - ath5k_hw_reg_write(ah, 0x0d, AR5K_PHY_SCAL); - ath5k_hw_reg_write(ah, 0x07, AR5K_PHY_SCLOCK); - ath5k_hw_reg_write(ah, 0x3f, AR5K_PHY_SDELAY); - AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG, - AR5K_PCICFG_SLEEP_CLOCK_RATE, 0x02); - } else { - ath5k_hw_reg_write(ah, 0x0a, AR5K_PHY_SLMT); - ath5k_hw_reg_write(ah, 0x0c, AR5K_PHY_SCAL); - ath5k_hw_reg_write(ah, 0x03, AR5K_PHY_SCLOCK); - ath5k_hw_reg_write(ah, 0x20, AR5K_PHY_SDELAY); - AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG, - AR5K_PCICFG_SLEEP_CLOCK_RATE, 0x03); - } - - /* Enable sleep clock operation */ - AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, - AR5K_PCICFG_SLEEP_CLOCK_EN); - - } else { - - /* Disable sleep clock operation and - * restore default parameters */ - AR5K_REG_DISABLE_BITS(ah, AR5K_PCICFG, - AR5K_PCICFG_SLEEP_CLOCK_EN); - - AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG, - AR5K_PCICFG_SLEEP_CLOCK_RATE, 0); - - /* Set DAC/ADC delays */ - ath5k_hw_reg_write(ah, 0x1f, AR5K_PHY_SCR); - ath5k_hw_reg_write(ah, AR5K_PHY_SLMT_32MHZ, AR5K_PHY_SLMT); - - if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4)) - scal = AR5K_PHY_SCAL_32MHZ_2417; - else if (ee->ee_is_hb63) - scal = AR5K_PHY_SCAL_32MHZ_HB63; - else - scal = AR5K_PHY_SCAL_32MHZ; - ath5k_hw_reg_write(ah, scal, AR5K_PHY_SCAL); - - ath5k_hw_reg_write(ah, AR5K_PHY_SCLOCK_32MHZ, AR5K_PHY_SCLOCK); - ath5k_hw_reg_write(ah, AR5K_PHY_SDELAY_32MHZ, AR5K_PHY_SDELAY); - - if ((ah->ah_radio == AR5K_RF5112) || - (ah->ah_radio == AR5K_RF5413) || - (ah->ah_radio == AR5K_RF2316) || - (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) - spending = 0x14; - else - spending = 0x18; - ath5k_hw_reg_write(ah, spending, AR5K_PHY_SPENDING); - - /* Set up tsf increment on each cycle */ - AR5K_REG_WRITE_BITS(ah, AR5K_TSF_PARM, AR5K_TSF_PARM_INC, 1); - - if ((ah->ah_radio == AR5K_RF5112) || - (ah->ah_radio == AR5K_RF5413) || - (ah->ah_radio == AR5K_RF2316) || - (ah->ah_radio == AR5K_RF2317)) - sclock = 40 - 1; - else - sclock = 32 - 1; - AR5K_REG_WRITE_BITS(ah, AR5K_USEC_5211, AR5K_USEC_32, sclock); - } -} - - -/*********************\ -* Reset/Sleep control * -\*********************/ - -/** - * ath5k_hw_nic_reset() - Reset the various chipset units - * @ah: The &struct ath5k_hw - * @val: Mask to indicate what units to reset - * - * To reset the various chipset units we need to write - * the mask to AR5K_RESET_CTL and poll the register until - * all flags are cleared. - * - * Returns 0 if we are O.K. or -EAGAIN (from athk5_hw_register_timeout) - */ -static int -ath5k_hw_nic_reset(struct ath5k_hw *ah, u32 val) -{ - int ret; - u32 mask = val ? val : ~0U; - - /* Read-and-clear RX Descriptor Pointer*/ - ath5k_hw_reg_read(ah, AR5K_RXDP); - - /* - * Reset the device and wait until success - */ - ath5k_hw_reg_write(ah, val, AR5K_RESET_CTL); - - /* Wait at least 128 PCI clocks */ - usleep_range(15, 20); - - if (ah->ah_version == AR5K_AR5210) { - val &= AR5K_RESET_CTL_PCU | AR5K_RESET_CTL_DMA - | AR5K_RESET_CTL_MAC | AR5K_RESET_CTL_PHY; - mask &= AR5K_RESET_CTL_PCU | AR5K_RESET_CTL_DMA - | AR5K_RESET_CTL_MAC | AR5K_RESET_CTL_PHY; - } else { - val &= AR5K_RESET_CTL_PCU | AR5K_RESET_CTL_BASEBAND; - mask &= AR5K_RESET_CTL_PCU | AR5K_RESET_CTL_BASEBAND; - } - - ret = ath5k_hw_register_timeout(ah, AR5K_RESET_CTL, mask, val, false); - - /* - * Reset configuration register (for hw byte-swap). Note that this - * is only set for big endian. We do the necessary magic in - * AR5K_INIT_CFG. - */ - if ((val & AR5K_RESET_CTL_PCU) == 0) - ath5k_hw_reg_write(ah, AR5K_INIT_CFG, AR5K_CFG); - - return ret; -} - -/** - * ath5k_hw_wisoc_reset() - Reset AHB chipset - * @ah: The &struct ath5k_hw - * @flags: Mask to indicate what units to reset - * - * Same as ath5k_hw_nic_reset but for AHB based devices - * - * Returns 0 if we are O.K. or -EAGAIN (from athk5_hw_register_timeout) - */ -static int -ath5k_hw_wisoc_reset(struct ath5k_hw *ah, u32 flags) -{ - u32 mask = flags ? flags : ~0U; - u32 __iomem *reg; - u32 regval; - u32 val = 0; - - /* ah->ah_mac_srev is not available at this point yet */ - if (ah->devid >= AR5K_SREV_AR2315_R6) { - reg = (u32 __iomem *) AR5K_AR2315_RESET; - if (mask & AR5K_RESET_CTL_PCU) - val |= AR5K_AR2315_RESET_WMAC; - if (mask & AR5K_RESET_CTL_BASEBAND) - val |= AR5K_AR2315_RESET_BB_WARM; - } else { - reg = (u32 __iomem *) AR5K_AR5312_RESET; - if (to_platform_device(ah->dev)->id == 0) { - if (mask & AR5K_RESET_CTL_PCU) - val |= AR5K_AR5312_RESET_WMAC0; - if (mask & AR5K_RESET_CTL_BASEBAND) - val |= AR5K_AR5312_RESET_BB0_COLD | - AR5K_AR5312_RESET_BB0_WARM; - } else { - if (mask & AR5K_RESET_CTL_PCU) - val |= AR5K_AR5312_RESET_WMAC1; - if (mask & AR5K_RESET_CTL_BASEBAND) - val |= AR5K_AR5312_RESET_BB1_COLD | - AR5K_AR5312_RESET_BB1_WARM; - } - } - - /* Put BB/MAC into reset */ - regval = ioread32(reg); - iowrite32(regval | val, reg); - regval = ioread32(reg); - usleep_range(100, 150); - - /* Bring BB/MAC out of reset */ - iowrite32(regval & ~val, reg); - regval = ioread32(reg); - - /* - * Reset configuration register (for hw byte-swap). Note that this - * is only set for big endian. We do the necessary magic in - * AR5K_INIT_CFG. - */ - if ((flags & AR5K_RESET_CTL_PCU) == 0) - ath5k_hw_reg_write(ah, AR5K_INIT_CFG, AR5K_CFG); - - return 0; -} - -/** - * ath5k_hw_set_power_mode() - Set power mode - * @ah: The &struct ath5k_hw - * @mode: One of enum ath5k_power_mode - * @set_chip: Set to true to write sleep control register - * @sleep_duration: How much time the device is allowed to sleep - * when sleep logic is enabled (in 128 microsecond increments). - * - * This function is used to configure sleep policy and allowed - * sleep modes. For more information check out the sleep control - * register on reg.h and STA_ID1. - * - * Returns 0 on success, -EIO if chip didn't wake up or -EINVAL if an invalid - * mode is requested. - */ -static int -ath5k_hw_set_power_mode(struct ath5k_hw *ah, enum ath5k_power_mode mode, - bool set_chip, u16 sleep_duration) -{ - unsigned int i; - u32 staid, data; - - staid = ath5k_hw_reg_read(ah, AR5K_STA_ID1); - - switch (mode) { - case AR5K_PM_AUTO: - staid &= ~AR5K_STA_ID1_DEFAULT_ANTENNA; - /* fallthrough */ - case AR5K_PM_NETWORK_SLEEP: - if (set_chip) - ath5k_hw_reg_write(ah, - AR5K_SLEEP_CTL_SLE_ALLOW | - sleep_duration, - AR5K_SLEEP_CTL); - - staid |= AR5K_STA_ID1_PWR_SV; - break; - - case AR5K_PM_FULL_SLEEP: - if (set_chip) - ath5k_hw_reg_write(ah, AR5K_SLEEP_CTL_SLE_SLP, - AR5K_SLEEP_CTL); - - staid |= AR5K_STA_ID1_PWR_SV; - break; - - case AR5K_PM_AWAKE: - - staid &= ~AR5K_STA_ID1_PWR_SV; - - if (!set_chip) - goto commit; - - data = ath5k_hw_reg_read(ah, AR5K_SLEEP_CTL); - - /* If card is down we 'll get 0xffff... so we - * need to clean this up before we write the register - */ - if (data & 0xffc00000) - data = 0; - else - /* Preserve sleep duration etc */ - data = data & ~AR5K_SLEEP_CTL_SLE; - - ath5k_hw_reg_write(ah, data | AR5K_SLEEP_CTL_SLE_WAKE, - AR5K_SLEEP_CTL); - usleep_range(15, 20); - - for (i = 200; i > 0; i--) { - /* Check if the chip did wake up */ - if ((ath5k_hw_reg_read(ah, AR5K_PCICFG) & - AR5K_PCICFG_SPWR_DN) == 0) - break; - - /* Wait a bit and retry */ - usleep_range(50, 75); - ath5k_hw_reg_write(ah, data | AR5K_SLEEP_CTL_SLE_WAKE, - AR5K_SLEEP_CTL); - } - - /* Fail if the chip didn't wake up */ - if (i == 0) - return -EIO; - - break; - - default: - return -EINVAL; - } - -commit: - ath5k_hw_reg_write(ah, staid, AR5K_STA_ID1); - - return 0; -} - -/** - * ath5k_hw_on_hold() - Put device on hold - * @ah: The &struct ath5k_hw - * - * Put MAC and Baseband on warm reset and keep that state - * (don't clean sleep control register). After this MAC - * and Baseband are disabled and a full reset is needed - * to come back. This way we save as much power as possible - * without putting the card on full sleep. - * - * Returns 0 on success or -EIO on error - */ -int -ath5k_hw_on_hold(struct ath5k_hw *ah) -{ - struct pci_dev *pdev = ah->pdev; - u32 bus_flags; - int ret; - - if (ath5k_get_bus_type(ah) == ATH_AHB) - return 0; - - /* Make sure device is awake */ - ret = ath5k_hw_set_power_mode(ah, AR5K_PM_AWAKE, true, 0); - if (ret) { - ATH5K_ERR(ah, "failed to wakeup the MAC Chip\n"); - return ret; - } - - /* - * Put chipset on warm reset... - * - * Note: putting PCI core on warm reset on PCI-E cards - * results card to hang and always return 0xffff... so - * we ignore that flag for PCI-E cards. On PCI cards - * this flag gets cleared after 64 PCI clocks. - */ - bus_flags = (pdev && pci_is_pcie(pdev)) ? 0 : AR5K_RESET_CTL_PCI; - - if (ah->ah_version == AR5K_AR5210) { - ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | - AR5K_RESET_CTL_MAC | AR5K_RESET_CTL_DMA | - AR5K_RESET_CTL_PHY | AR5K_RESET_CTL_PCI); - usleep_range(2000, 2500); - } else { - ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | - AR5K_RESET_CTL_BASEBAND | bus_flags); - } - - if (ret) { - ATH5K_ERR(ah, "failed to put device on warm reset\n"); - return -EIO; - } - - /* ...wakeup again!*/ - ret = ath5k_hw_set_power_mode(ah, AR5K_PM_AWAKE, true, 0); - if (ret) { - ATH5K_ERR(ah, "failed to put device on hold\n"); - return ret; - } - - return ret; -} - -/** - * ath5k_hw_nic_wakeup() - Force card out of sleep - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * - * Bring up MAC + PHY Chips and program PLL - * NOTE: Channel is NULL for the initial wakeup. - * - * Returns 0 on success, -EIO on hw failure or -EINVAL for false channel infos - */ -int -ath5k_hw_nic_wakeup(struct ath5k_hw *ah, struct ieee80211_channel *channel) -{ - struct pci_dev *pdev = ah->pdev; - u32 turbo, mode, clock, bus_flags; - int ret; - - turbo = 0; - mode = 0; - clock = 0; - - if ((ath5k_get_bus_type(ah) != ATH_AHB) || channel) { - /* Wakeup the device */ - ret = ath5k_hw_set_power_mode(ah, AR5K_PM_AWAKE, true, 0); - if (ret) { - ATH5K_ERR(ah, "failed to wakeup the MAC Chip\n"); - return ret; - } - } - - /* - * Put chipset on warm reset... - * - * Note: putting PCI core on warm reset on PCI-E cards - * results card to hang and always return 0xffff... so - * we ignore that flag for PCI-E cards. On PCI cards - * this flag gets cleared after 64 PCI clocks. - */ - bus_flags = (pdev && pci_is_pcie(pdev)) ? 0 : AR5K_RESET_CTL_PCI; - - if (ah->ah_version == AR5K_AR5210) { - ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | - AR5K_RESET_CTL_MAC | AR5K_RESET_CTL_DMA | - AR5K_RESET_CTL_PHY | AR5K_RESET_CTL_PCI); - usleep_range(2000, 2500); - } else { - if (ath5k_get_bus_type(ah) == ATH_AHB) - ret = ath5k_hw_wisoc_reset(ah, AR5K_RESET_CTL_PCU | - AR5K_RESET_CTL_BASEBAND); - else - ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | - AR5K_RESET_CTL_BASEBAND | bus_flags); - } - - if (ret) { - ATH5K_ERR(ah, "failed to reset the MAC Chip\n"); - return -EIO; - } - - /* ...wakeup again!...*/ - ret = ath5k_hw_set_power_mode(ah, AR5K_PM_AWAKE, true, 0); - if (ret) { - ATH5K_ERR(ah, "failed to resume the MAC Chip\n"); - return ret; - } - - /* ...reset configuration register on Wisoc ... - * ...clear reset control register and pull device out of - * warm reset on others */ - if (ath5k_get_bus_type(ah) == ATH_AHB) - ret = ath5k_hw_wisoc_reset(ah, 0); - else - ret = ath5k_hw_nic_reset(ah, 0); - - if (ret) { - ATH5K_ERR(ah, "failed to warm reset the MAC Chip\n"); - return -EIO; - } - - /* On initialization skip PLL programming since we don't have - * a channel / mode set yet */ - if (!channel) - return 0; - - if (ah->ah_version != AR5K_AR5210) { - /* - * Get channel mode flags - */ - - if (ah->ah_radio >= AR5K_RF5112) { - mode = AR5K_PHY_MODE_RAD_RF5112; - clock = AR5K_PHY_PLL_RF5112; - } else { - mode = AR5K_PHY_MODE_RAD_RF5111; /*Zero*/ - clock = AR5K_PHY_PLL_RF5111; /*Zero*/ - } - - if (channel->band == IEEE80211_BAND_2GHZ) { - mode |= AR5K_PHY_MODE_FREQ_2GHZ; - clock |= AR5K_PHY_PLL_44MHZ; - - if (channel->hw_value == AR5K_MODE_11B) { - mode |= AR5K_PHY_MODE_MOD_CCK; - } else { - /* XXX Dynamic OFDM/CCK is not supported by the - * AR5211 so we set MOD_OFDM for plain g (no - * CCK headers) operation. We need to test - * this, 5211 might support ofdm-only g after - * all, there are also initial register values - * in the code for g mode (see initvals.c). - */ - if (ah->ah_version == AR5K_AR5211) - mode |= AR5K_PHY_MODE_MOD_OFDM; - else - mode |= AR5K_PHY_MODE_MOD_DYN; - } - } else if (channel->band == IEEE80211_BAND_5GHZ) { - mode |= (AR5K_PHY_MODE_FREQ_5GHZ | - AR5K_PHY_MODE_MOD_OFDM); - - /* Different PLL setting for 5413 */ - if (ah->ah_radio == AR5K_RF5413) - clock = AR5K_PHY_PLL_40MHZ_5413; - else - clock |= AR5K_PHY_PLL_40MHZ; - } else { - ATH5K_ERR(ah, "invalid radio frequency mode\n"); - return -EINVAL; - } - - /*XXX: Can bwmode be used with dynamic mode ? - * (I don't think it supports 44MHz) */ - /* On 2425 initvals TURBO_SHORT is not present */ - if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) { - turbo = AR5K_PHY_TURBO_MODE; - if (ah->ah_radio != AR5K_RF2425) - turbo |= AR5K_PHY_TURBO_SHORT; - } else if (ah->ah_bwmode != AR5K_BWMODE_DEFAULT) { - if (ah->ah_radio == AR5K_RF5413) { - mode |= (ah->ah_bwmode == AR5K_BWMODE_10MHZ) ? - AR5K_PHY_MODE_HALF_RATE : - AR5K_PHY_MODE_QUARTER_RATE; - } else if (ah->ah_version == AR5K_AR5212) { - clock |= (ah->ah_bwmode == AR5K_BWMODE_10MHZ) ? - AR5K_PHY_PLL_HALF_RATE : - AR5K_PHY_PLL_QUARTER_RATE; - } - } - - } else { /* Reset the device */ - - /* ...enable Atheros turbo mode if requested */ - if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) - ath5k_hw_reg_write(ah, AR5K_PHY_TURBO_MODE, - AR5K_PHY_TURBO); - } - - if (ah->ah_version != AR5K_AR5210) { - - /* ...update PLL if needed */ - if (ath5k_hw_reg_read(ah, AR5K_PHY_PLL) != clock) { - ath5k_hw_reg_write(ah, clock, AR5K_PHY_PLL); - usleep_range(300, 350); - } - - /* ...set the PHY operating mode */ - ath5k_hw_reg_write(ah, mode, AR5K_PHY_MODE); - ath5k_hw_reg_write(ah, turbo, AR5K_PHY_TURBO); - } - - return 0; -} - - -/**************************************\ -* Post-initvals register modifications * -\**************************************/ - -/** - * ath5k_hw_tweak_initval_settings() - Tweak initial settings - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * - * Some settings are not handled on initvals, e.g. bwmode - * settings, some phy settings, workarounds etc that in general - * don't fit anywhere else or are too small to introduce a separate - * function for each one. So we have this function to handle - * them all during reset and complete card's initialization. - */ -static void -ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - if (ah->ah_version == AR5K_AR5212 && - ah->ah_phy_revision >= AR5K_SREV_PHY_5212A) { - - /* Setup ADC control */ - ath5k_hw_reg_write(ah, - (AR5K_REG_SM(2, - AR5K_PHY_ADC_CTL_INBUFGAIN_OFF) | - AR5K_REG_SM(2, - AR5K_PHY_ADC_CTL_INBUFGAIN_ON) | - AR5K_PHY_ADC_CTL_PWD_DAC_OFF | - AR5K_PHY_ADC_CTL_PWD_ADC_OFF), - AR5K_PHY_ADC_CTL); - - - - /* Disable barker RSSI threshold */ - AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_DAG_CCK_CTL, - AR5K_PHY_DAG_CCK_CTL_EN_RSSI_THR); - - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_DAG_CCK_CTL, - AR5K_PHY_DAG_CCK_CTL_RSSI_THR, 2); - - /* Set the mute mask */ - ath5k_hw_reg_write(ah, 0x0000000f, AR5K_SEQ_MASK); - } - - /* Clear PHY_BLUETOOTH to allow RX_CLEAR line debug */ - if (ah->ah_phy_revision >= AR5K_SREV_PHY_5212B) - ath5k_hw_reg_write(ah, 0, AR5K_PHY_BLUETOOTH); - - /* Enable DCU double buffering */ - if (ah->ah_phy_revision > AR5K_SREV_PHY_5212B) - AR5K_REG_DISABLE_BITS(ah, AR5K_TXCFG, - AR5K_TXCFG_DCU_DBL_BUF_DIS); - - /* Set fast ADC */ - if ((ah->ah_radio == AR5K_RF5413) || - (ah->ah_radio == AR5K_RF2317) || - (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) { - u32 fast_adc = true; - - if (channel->center_freq == 2462 || - channel->center_freq == 2467) - fast_adc = 0; - - /* Only update if needed */ - if (ath5k_hw_reg_read(ah, AR5K_PHY_FAST_ADC) != fast_adc) - ath5k_hw_reg_write(ah, fast_adc, - AR5K_PHY_FAST_ADC); - } - - /* Fix for first revision of the RF5112 RF chipset */ - if (ah->ah_radio == AR5K_RF5112 && - ah->ah_radio_5ghz_revision < - AR5K_SREV_RAD_5112A) { - u32 data; - ath5k_hw_reg_write(ah, AR5K_PHY_CCKTXCTL_WORLD, - AR5K_PHY_CCKTXCTL); - if (channel->band == IEEE80211_BAND_5GHZ) - data = 0xffb81020; - else - data = 0xffb80d20; - ath5k_hw_reg_write(ah, data, AR5K_PHY_FRAME_CTL); - } - - if (ah->ah_mac_srev < AR5K_SREV_AR5211) { - /* Clear QCU/DCU clock gating register */ - ath5k_hw_reg_write(ah, 0, AR5K_QCUDCU_CLKGT); - /* Set DAC/ADC delays */ - ath5k_hw_reg_write(ah, AR5K_PHY_SCAL_32MHZ_5311, - AR5K_PHY_SCAL); - /* Enable PCU FIFO corruption ECO */ - AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW_5211, - AR5K_DIAG_SW_ECO_ENABLE); - } - - if (ah->ah_bwmode) { - /* Increase PHY switch and AGC settling time - * on turbo mode (ath5k_hw_commit_eeprom_settings - * will override settling time if available) */ - if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) { - - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SETTLING, - AR5K_PHY_SETTLING_AGC, - AR5K_AGC_SETTLING_TURBO); - - /* XXX: Initvals indicate we only increase - * switch time on AR5212, 5211 and 5210 - * only change agc time (bug?) */ - if (ah->ah_version == AR5K_AR5212) - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SETTLING, - AR5K_PHY_SETTLING_SWITCH, - AR5K_SWITCH_SETTLING_TURBO); - - if (ah->ah_version == AR5K_AR5210) { - /* Set Frame Control Register */ - ath5k_hw_reg_write(ah, - (AR5K_PHY_FRAME_CTL_INI | - AR5K_PHY_TURBO_MODE | - AR5K_PHY_TURBO_SHORT | 0x2020), - AR5K_PHY_FRAME_CTL_5210); - } - /* On 5413 PHY force window length for half/quarter rate*/ - } else if ((ah->ah_mac_srev >= AR5K_SREV_AR5424) && - (ah->ah_mac_srev <= AR5K_SREV_AR5414)) { - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_FRAME_CTL_5211, - AR5K_PHY_FRAME_CTL_WIN_LEN, - 3); - } - } else if (ah->ah_version == AR5K_AR5210) { - /* Set Frame Control Register for normal operation */ - ath5k_hw_reg_write(ah, (AR5K_PHY_FRAME_CTL_INI | 0x1020), - AR5K_PHY_FRAME_CTL_5210); - } -} - -/** - * ath5k_hw_commit_eeprom_settings() - Commit settings from EEPROM - * @ah: The &struct ath5k_hw - * @channel: The &struct ieee80211_channel - * - * Use settings stored on EEPROM to properly initialize the card - * based on various infos and per-mode calibration data. - */ -static void -ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah, - struct ieee80211_channel *channel) -{ - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; - s16 cck_ofdm_pwr_delta; - u8 ee_mode; - - /* TODO: Add support for AR5210 EEPROM */ - if (ah->ah_version == AR5K_AR5210) - return; - - ee_mode = ath5k_eeprom_mode_from_channel(ah, channel); - - /* Adjust power delta for channel 14 */ - if (channel->center_freq == 2484) - cck_ofdm_pwr_delta = - ((ee->ee_cck_ofdm_power_delta - - ee->ee_scaled_cck_delta) * 2) / 10; - else - cck_ofdm_pwr_delta = - (ee->ee_cck_ofdm_power_delta * 2) / 10; - - /* Set CCK to OFDM power delta on tx power - * adjustment register */ - if (ah->ah_phy_revision >= AR5K_SREV_PHY_5212A) { - if (channel->hw_value == AR5K_MODE_11G) - ath5k_hw_reg_write(ah, - AR5K_REG_SM((ee->ee_cck_ofdm_gain_delta * -1), - AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA) | - AR5K_REG_SM((cck_ofdm_pwr_delta * -1), - AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX), - AR5K_PHY_TX_PWR_ADJ); - else - ath5k_hw_reg_write(ah, 0, AR5K_PHY_TX_PWR_ADJ); - } else { - /* For older revs we scale power on sw during tx power - * setup */ - ah->ah_txpower.txp_cck_ofdm_pwr_delta = cck_ofdm_pwr_delta; - ah->ah_txpower.txp_cck_ofdm_gainf_delta = - ee->ee_cck_ofdm_gain_delta; - } - - /* XXX: necessary here? is called from ath5k_hw_set_antenna_mode() - * too */ - ath5k_hw_set_antenna_switch(ah, ee_mode); - - /* Noise floor threshold */ - ath5k_hw_reg_write(ah, - AR5K_PHY_NF_SVAL(ee->ee_noise_floor_thr[ee_mode]), - AR5K_PHY_NFTHRES); - - if ((ah->ah_bwmode == AR5K_BWMODE_40MHZ) && - (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_0)) { - /* Switch settling time (Turbo) */ - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SETTLING, - AR5K_PHY_SETTLING_SWITCH, - ee->ee_switch_settling_turbo[ee_mode]); - - /* Tx/Rx attenuation (Turbo) */ - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_GAIN, - AR5K_PHY_GAIN_TXRX_ATTEN, - ee->ee_atn_tx_rx_turbo[ee_mode]); - - /* ADC/PGA desired size (Turbo) */ - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_DESIRED_SIZE, - AR5K_PHY_DESIRED_SIZE_ADC, - ee->ee_adc_desired_size_turbo[ee_mode]); - - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_DESIRED_SIZE, - AR5K_PHY_DESIRED_SIZE_PGA, - ee->ee_pga_desired_size_turbo[ee_mode]); - - /* Tx/Rx margin (Turbo) */ - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_GAIN_2GHZ, - AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX, - ee->ee_margin_tx_rx_turbo[ee_mode]); - - } else { - /* Switch settling time */ - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SETTLING, - AR5K_PHY_SETTLING_SWITCH, - ee->ee_switch_settling[ee_mode]); - - /* Tx/Rx attenuation */ - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_GAIN, - AR5K_PHY_GAIN_TXRX_ATTEN, - ee->ee_atn_tx_rx[ee_mode]); - - /* ADC/PGA desired size */ - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_DESIRED_SIZE, - AR5K_PHY_DESIRED_SIZE_ADC, - ee->ee_adc_desired_size[ee_mode]); - - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_DESIRED_SIZE, - AR5K_PHY_DESIRED_SIZE_PGA, - ee->ee_pga_desired_size[ee_mode]); - - /* Tx/Rx margin */ - if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_1) - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_GAIN_2GHZ, - AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX, - ee->ee_margin_tx_rx[ee_mode]); - } - - /* XPA delays */ - ath5k_hw_reg_write(ah, - (ee->ee_tx_end2xpa_disable[ee_mode] << 24) | - (ee->ee_tx_end2xpa_disable[ee_mode] << 16) | - (ee->ee_tx_frm2xpa_enable[ee_mode] << 8) | - (ee->ee_tx_frm2xpa_enable[ee_mode]), AR5K_PHY_RF_CTL4); - - /* XLNA delay */ - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_RF_CTL3, - AR5K_PHY_RF_CTL3_TXE2XLNA_ON, - ee->ee_tx_end2xlna_enable[ee_mode]); - - /* Thresh64 (ANI) */ - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_NF, - AR5K_PHY_NF_THRESH62, - ee->ee_thr_62[ee_mode]); - - /* False detect backoff for channels - * that have spur noise. Write the new - * cyclic power RSSI threshold. */ - if (ath5k_hw_chan_has_spur_noise(ah, channel)) - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_OFDM_SELFCORR, - AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1, - AR5K_INIT_CYCRSSI_THR1 + - ee->ee_false_detect[ee_mode]); - else - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_OFDM_SELFCORR, - AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1, - AR5K_INIT_CYCRSSI_THR1); - - /* I/Q correction (set enable bit last to match HAL sources) */ - /* TODO: Per channel i/q infos ? */ - if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_0) { - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_Q_I_COFF, - ee->ee_i_cal[ee_mode]); - AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_Q_Q_COFF, - ee->ee_q_cal[ee_mode]); - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_ENABLE); - } - - /* Heavy clipping -disable for now */ - if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_1) - ath5k_hw_reg_write(ah, 0, AR5K_PHY_HEAVY_CLIP_ENABLE); -} - - -/*********************\ -* Main reset function * -\*********************/ - -/** - * ath5k_hw_reset() - The main reset function - * @ah: The &struct ath5k_hw - * @op_mode: One of enum nl80211_iftype - * @channel: The &struct ieee80211_channel - * @fast: Enable fast channel switching - * @skip_pcu: Skip pcu initialization - * - * This is the function we call each time we want to (re)initialize the - * card and pass new settings to hw. We also call it when hw runs into - * trouble to make it come back to a working state. - * - * Returns 0 on success, -EINVAL on false op_mode or channel infos, or -EIO - * on failure. - */ -int -ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, - struct ieee80211_channel *channel, bool fast, bool skip_pcu) -{ - u32 s_seq[10], s_led[3], tsf_up, tsf_lo; - u8 mode; - int i, ret; - - tsf_up = 0; - tsf_lo = 0; - mode = 0; - - /* - * Sanity check for fast flag - * Fast channel change only available - * on AR2413/AR5413. - */ - if (fast && (ah->ah_radio != AR5K_RF2413) && - (ah->ah_radio != AR5K_RF5413)) - fast = false; - - /* Disable sleep clock operation - * to avoid register access delay on certain - * PHY registers */ - if (ah->ah_version == AR5K_AR5212) - ath5k_hw_set_sleep_clock(ah, false); - - /* - * Stop PCU - */ - ath5k_hw_stop_rx_pcu(ah); - - /* - * Stop DMA - * - * Note: If DMA didn't stop continue - * since only a reset will fix it. - */ - ret = ath5k_hw_dma_stop(ah); - - /* RF Bus grant won't work if we have pending - * frames */ - if (ret && fast) { - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, - "DMA didn't stop, falling back to normal reset\n"); - fast = false; - /* Non fatal, just continue with - * normal reset */ - ret = 0; - } - - mode = channel->hw_value; - switch (mode) { - case AR5K_MODE_11A: - break; - case AR5K_MODE_11G: - if (ah->ah_version <= AR5K_AR5211) { - ATH5K_ERR(ah, - "G mode not available on 5210/5211"); - return -EINVAL; - } - break; - case AR5K_MODE_11B: - if (ah->ah_version < AR5K_AR5211) { - ATH5K_ERR(ah, - "B mode not available on 5210"); - return -EINVAL; - } - break; - default: - ATH5K_ERR(ah, - "invalid channel: %d\n", channel->center_freq); - return -EINVAL; - } - - /* - * If driver requested fast channel change and DMA has stopped - * go on. If it fails continue with a normal reset. - */ - if (fast) { - ret = ath5k_hw_phy_init(ah, channel, mode, true); - if (ret) { - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, - "fast chan change failed, falling back to normal reset\n"); - /* Non fatal, can happen eg. - * on mode change */ - ret = 0; - } else { - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, - "fast chan change successful\n"); - return 0; - } - } - - /* - * Save some registers before a reset - */ - if (ah->ah_version != AR5K_AR5210) { - /* - * Save frame sequence count - * For revs. after Oahu, only save - * seq num for DCU 0 (Global seq num) - */ - if (ah->ah_mac_srev < AR5K_SREV_AR5211) { - - for (i = 0; i < 10; i++) - s_seq[i] = ath5k_hw_reg_read(ah, - AR5K_QUEUE_DCU_SEQNUM(i)); - - } else { - s_seq[0] = ath5k_hw_reg_read(ah, - AR5K_QUEUE_DCU_SEQNUM(0)); - } - - /* TSF accelerates on AR5211 during reset - * As a workaround save it here and restore - * it later so that it's back in time after - * reset. This way it'll get re-synced on the - * next beacon without breaking ad-hoc. - * - * On AR5212 TSF is almost preserved across a - * reset so it stays back in time anyway and - * we don't have to save/restore it. - * - * XXX: Since this breaks power saving we have - * to disable power saving until we receive the - * next beacon, so we can resync beacon timers */ - if (ah->ah_version == AR5K_AR5211) { - tsf_up = ath5k_hw_reg_read(ah, AR5K_TSF_U32); - tsf_lo = ath5k_hw_reg_read(ah, AR5K_TSF_L32); - } - } - - - /*GPIOs*/ - s_led[0] = ath5k_hw_reg_read(ah, AR5K_PCICFG) & - AR5K_PCICFG_LEDSTATE; - s_led[1] = ath5k_hw_reg_read(ah, AR5K_GPIOCR); - s_led[2] = ath5k_hw_reg_read(ah, AR5K_GPIODO); - - - /* - * Since we are going to write rf buffer - * check if we have any pending gain_F - * optimization settings - */ - if (ah->ah_version == AR5K_AR5212 && - (ah->ah_radio <= AR5K_RF5112)) { - if (!fast && ah->ah_rf_banks != NULL) - ath5k_hw_gainf_calibrate(ah); - } - - /* Wakeup the device */ - ret = ath5k_hw_nic_wakeup(ah, channel); - if (ret) - return ret; - - /* PHY access enable */ - if (ah->ah_mac_srev >= AR5K_SREV_AR5211) - ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0)); - else - ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ | 0x40, - AR5K_PHY(0)); - - /* Write initial settings */ - ret = ath5k_hw_write_initvals(ah, mode, skip_pcu); - if (ret) - return ret; - - /* Initialize core clock settings */ - ath5k_hw_init_core_clock(ah); - - /* - * Tweak initval settings for revised - * chipsets and add some more config - * bits - */ - ath5k_hw_tweak_initval_settings(ah, channel); - - /* Commit values from EEPROM */ - ath5k_hw_commit_eeprom_settings(ah, channel); - - - /* - * Restore saved values - */ - - /* Seqnum, TSF */ - if (ah->ah_version != AR5K_AR5210) { - if (ah->ah_mac_srev < AR5K_SREV_AR5211) { - for (i = 0; i < 10; i++) - ath5k_hw_reg_write(ah, s_seq[i], - AR5K_QUEUE_DCU_SEQNUM(i)); - } else { - ath5k_hw_reg_write(ah, s_seq[0], - AR5K_QUEUE_DCU_SEQNUM(0)); - } - - if (ah->ah_version == AR5K_AR5211) { - ath5k_hw_reg_write(ah, tsf_up, AR5K_TSF_U32); - ath5k_hw_reg_write(ah, tsf_lo, AR5K_TSF_L32); - } - } - - /* Ledstate */ - AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, s_led[0]); - - /* Gpio settings */ - ath5k_hw_reg_write(ah, s_led[1], AR5K_GPIOCR); - ath5k_hw_reg_write(ah, s_led[2], AR5K_GPIODO); - - /* - * Initialize PCU - */ - ath5k_hw_pcu_init(ah, op_mode); - - /* - * Initialize PHY - */ - ret = ath5k_hw_phy_init(ah, channel, mode, false); - if (ret) { - ATH5K_ERR(ah, - "failed to initialize PHY (%i) !\n", ret); - return ret; - } - - /* - * Configure QCUs/DCUs - */ - ret = ath5k_hw_init_queues(ah); - if (ret) - return ret; - - - /* - * Initialize DMA/Interrupts - */ - ath5k_hw_dma_init(ah); - - - /* - * Enable 32KHz clock function for AR5212+ chips - * Set clocks to 32KHz operation and use an - * external 32KHz crystal when sleeping if one - * exists. - * Disabled by default because it is also disabled in - * other drivers and it is known to cause stability - * issues on some devices - */ - if (ah->ah_use_32khz_clock && ah->ah_version == AR5K_AR5212 && - op_mode != NL80211_IFTYPE_AP) - ath5k_hw_set_sleep_clock(ah, true); - - /* - * Disable beacons and reset the TSF - */ - AR5K_REG_DISABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE); - ath5k_hw_reset_tsf(ah); - return 0; -} diff --git a/drivers/net/wireless/ath/ath5k/rfbuffer.h b/drivers/net/wireless/ath/ath5k/rfbuffer.h deleted file mode 100644 index aed34d9954c0..000000000000 --- a/drivers/net/wireless/ath/ath5k/rfbuffer.h +++ /dev/null @@ -1,853 +0,0 @@ -/* - * RF Buffer handling functions - * - * Copyright (c) 2009 Nick Kossifidis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - - -/** - * DOC: RF Buffer registers - * - * There are some special registers on the RF chip - * that control various operation settings related mostly to - * the analog parts (channel, gain adjustment etc). - * - * We don't write on those registers directly but - * we send a data packet on the chip, using a special register, - * that holds all the settings we need. After we've sent the - * data packet, we write on another special register to notify hw - * to apply the settings. This is done so that control registers - * can be dynamically programmed during operation and the settings - * are applied faster on the hw. - * - * We call each data packet an "RF Bank" and all the data we write - * (all RF Banks) "RF Buffer". This file holds initial RF Buffer - * data for the different RF chips, and various info to match RF - * Buffer offsets with specific RF registers so that we can access - * them. We tweak these settings on rfregs_init function. - * - * Also check out reg.h and U.S. Patent 6677779 B1 (about buffer - * registers and control registers): - * - * http://www.google.com/patents?id=qNURAAAAEBAJ - */ - - -/** - * struct ath5k_ini_rfbuffer - Initial RF Buffer settings - * @rfb_bank: RF Bank number - * @rfb_ctrl_register: RF Buffer control register - * @rfb_mode_data: RF Buffer data for each mode - * - * Struct to hold default mode specific RF - * register values (RF Banks) for each chip. - */ -struct ath5k_ini_rfbuffer { - u8 rfb_bank; - u16 rfb_ctrl_register; - u32 rfb_mode_data[3]; -}; - -/** - * struct ath5k_rfb_field - An RF Buffer field (register/value) - * @len: Field length - * @pos: Offset on the raw packet - * @col: Used for shifting - * - * Struct to hold RF Buffer field - * infos used to access certain RF - * analog registers - */ -struct ath5k_rfb_field { - u8 len; - u16 pos; - u8 col; -}; - -/** - * struct ath5k_rf_reg - RF analog register definition - * @bank: RF Buffer Bank number - * @index: Register's index on ath5k_rf_regx_idx - * @field: The &struct ath5k_rfb_field - * - * We use this struct to define the set of RF registers - * on each chip that we want to tweak. Some RF registers - * are common between different chip versions so this saves - * us space and complexity because we can refer to an rf - * register by it's index no matter what chip we work with - * as long as it has that register. - */ -struct ath5k_rf_reg { - u8 bank; - u8 index; - struct ath5k_rfb_field field; -}; - -/** - * enum ath5k_rf_regs_idx - Map RF registers to indexes - * - * We do this to handle common bits and make our - * life easier by using an index for each register - * instead of a full rfb_field - */ -enum ath5k_rf_regs_idx { - /* BANK 2 */ - AR5K_RF_TURBO = 0, - /* BANK 6 */ - AR5K_RF_OB_2GHZ, - AR5K_RF_OB_5GHZ, - AR5K_RF_DB_2GHZ, - AR5K_RF_DB_5GHZ, - AR5K_RF_FIXED_BIAS_A, - AR5K_RF_FIXED_BIAS_B, - AR5K_RF_PWD_XPD, - AR5K_RF_XPD_SEL, - AR5K_RF_XPD_GAIN, - AR5K_RF_PD_GAIN_LO, - AR5K_RF_PD_GAIN_HI, - AR5K_RF_HIGH_VC_CP, - AR5K_RF_MID_VC_CP, - AR5K_RF_LOW_VC_CP, - AR5K_RF_PUSH_UP, - AR5K_RF_PAD2GND, - AR5K_RF_XB2_LVL, - AR5K_RF_XB5_LVL, - AR5K_RF_PWD_ICLOBUF_2G, - AR5K_RF_PWD_84, - AR5K_RF_PWD_90, - AR5K_RF_PWD_130, - AR5K_RF_PWD_131, - AR5K_RF_PWD_132, - AR5K_RF_PWD_136, - AR5K_RF_PWD_137, - AR5K_RF_PWD_138, - AR5K_RF_PWD_166, - AR5K_RF_PWD_167, - AR5K_RF_DERBY_CHAN_SEL_MODE, - /* BANK 7 */ - AR5K_RF_GAIN_I, - AR5K_RF_PLO_SEL, - AR5K_RF_RFGAIN_SEL, - AR5K_RF_RFGAIN_STEP, - AR5K_RF_WAIT_S, - AR5K_RF_WAIT_I, - AR5K_RF_MAX_TIME, - AR5K_RF_MIXVGA_OVR, - AR5K_RF_MIXGAIN_OVR, - AR5K_RF_MIXGAIN_STEP, - AR5K_RF_PD_DELAY_A, - AR5K_RF_PD_DELAY_B, - AR5K_RF_PD_DELAY_XR, - AR5K_RF_PD_PERIOD_A, - AR5K_RF_PD_PERIOD_B, - AR5K_RF_PD_PERIOD_XR, -}; - - -/*******************\ -* RF5111 (Sombrero) * -\*******************/ - -/* BANK 2 len pos col */ -#define AR5K_RF5111_RF_TURBO { 1, 3, 0 } - -/* BANK 6 len pos col */ -#define AR5K_RF5111_OB_2GHZ { 3, 119, 0 } -#define AR5K_RF5111_DB_2GHZ { 3, 122, 0 } - -#define AR5K_RF5111_OB_5GHZ { 3, 104, 0 } -#define AR5K_RF5111_DB_5GHZ { 3, 107, 0 } - -#define AR5K_RF5111_PWD_XPD { 1, 95, 0 } -#define AR5K_RF5111_XPD_GAIN { 4, 96, 0 } - -/* Access to PWD registers */ -#define AR5K_RF5111_PWD(_n) { 1, (135 - _n), 3 } - -/* BANK 7 len pos col */ -#define AR5K_RF5111_GAIN_I { 6, 29, 0 } -#define AR5K_RF5111_PLO_SEL { 1, 4, 0 } -#define AR5K_RF5111_RFGAIN_SEL { 1, 36, 0 } -#define AR5K_RF5111_RFGAIN_STEP { 6, 37, 0 } -/* Only on AR5212 BaseBand and up */ -#define AR5K_RF5111_WAIT_S { 5, 19, 0 } -#define AR5K_RF5111_WAIT_I { 5, 24, 0 } -#define AR5K_RF5111_MAX_TIME { 2, 49, 0 } - -static const struct ath5k_rf_reg rf_regs_5111[] = { - {2, AR5K_RF_TURBO, AR5K_RF5111_RF_TURBO}, - {6, AR5K_RF_OB_2GHZ, AR5K_RF5111_OB_2GHZ}, - {6, AR5K_RF_DB_2GHZ, AR5K_RF5111_DB_2GHZ}, - {6, AR5K_RF_OB_5GHZ, AR5K_RF5111_OB_5GHZ}, - {6, AR5K_RF_DB_5GHZ, AR5K_RF5111_DB_5GHZ}, - {6, AR5K_RF_PWD_XPD, AR5K_RF5111_PWD_XPD}, - {6, AR5K_RF_XPD_GAIN, AR5K_RF5111_XPD_GAIN}, - {6, AR5K_RF_PWD_84, AR5K_RF5111_PWD(84)}, - {6, AR5K_RF_PWD_90, AR5K_RF5111_PWD(90)}, - {7, AR5K_RF_GAIN_I, AR5K_RF5111_GAIN_I}, - {7, AR5K_RF_PLO_SEL, AR5K_RF5111_PLO_SEL}, - {7, AR5K_RF_RFGAIN_SEL, AR5K_RF5111_RFGAIN_SEL}, - {7, AR5K_RF_RFGAIN_STEP, AR5K_RF5111_RFGAIN_STEP}, - {7, AR5K_RF_WAIT_S, AR5K_RF5111_WAIT_S}, - {7, AR5K_RF_WAIT_I, AR5K_RF5111_WAIT_I}, - {7, AR5K_RF_MAX_TIME, AR5K_RF5111_MAX_TIME} -}; - -/* Default mode specific settings */ -static const struct ath5k_ini_rfbuffer rfb_5111[] = { - /* BANK / C.R. A/XR B G */ - { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 0, 0x989c, { 0x00380000, 0x00380000, 0x00380000 } }, - { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 0, 0x989c, { 0x00000000, 0x000000c0, 0x00000080 } }, - { 0, 0x989c, { 0x000400f9, 0x000400ff, 0x000400fd } }, - { 0, 0x98d4, { 0x00000000, 0x00000004, 0x00000004 } }, - { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, - { 2, 0x98d4, { 0x00000010, 0x00000010, 0x00000010 } }, - { 3, 0x98d8, { 0x00601068, 0x00601068, 0x00601068 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x10000000, 0x10000000, 0x10000000 } }, - { 6, 0x989c, { 0x04000000, 0x04000000, 0x04000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x0a000000, 0x00000000 } }, - { 6, 0x989c, { 0x003800c0, 0x023800c0, 0x003800c0 } }, - { 6, 0x989c, { 0x00020006, 0x00000006, 0x00020006 } }, - { 6, 0x989c, { 0x00000089, 0x00000089, 0x00000089 } }, - { 6, 0x989c, { 0x000000a0, 0x000000a0, 0x000000a0 } }, - { 6, 0x989c, { 0x00040007, 0x00040007, 0x00040007 } }, - { 6, 0x98d4, { 0x0000001a, 0x0000001a, 0x0000001a } }, - { 7, 0x989c, { 0x00000040, 0x00000040, 0x00000040 } }, - { 7, 0x989c, { 0x00000010, 0x00000010, 0x00000010 } }, - { 7, 0x989c, { 0x00000008, 0x00000008, 0x00000008 } }, - { 7, 0x989c, { 0x0000004f, 0x0000004f, 0x0000004f } }, - { 7, 0x989c, { 0x000000f1, 0x00000061, 0x000000f1 } }, - { 7, 0x989c, { 0x0000904f, 0x0000904c, 0x0000904f } }, - { 7, 0x989c, { 0x0000125a, 0x0000129a, 0x0000125a } }, - { 7, 0x98cc, { 0x0000000e, 0x0000000f, 0x0000000e } }, -}; - - - -/***********************\ -* RF5112/RF2112 (Derby) * -\***********************/ - -/* BANK 2 (Common) len pos col */ -#define AR5K_RF5112X_RF_TURBO { 1, 1, 2 } - -/* BANK 7 (Common) len pos col */ -#define AR5K_RF5112X_GAIN_I { 6, 14, 0 } -#define AR5K_RF5112X_MIXVGA_OVR { 1, 36, 0 } -#define AR5K_RF5112X_MIXGAIN_OVR { 2, 37, 0 } -#define AR5K_RF5112X_MIXGAIN_STEP { 4, 32, 0 } -#define AR5K_RF5112X_PD_DELAY_A { 4, 58, 0 } -#define AR5K_RF5112X_PD_DELAY_B { 4, 62, 0 } -#define AR5K_RF5112X_PD_DELAY_XR { 4, 66, 0 } -#define AR5K_RF5112X_PD_PERIOD_A { 4, 70, 0 } -#define AR5K_RF5112X_PD_PERIOD_B { 4, 74, 0 } -#define AR5K_RF5112X_PD_PERIOD_XR { 4, 78, 0 } - -/* RFX112 (Derby 1) */ - -/* BANK 6 len pos col */ -#define AR5K_RF5112_OB_2GHZ { 3, 269, 0 } -#define AR5K_RF5112_DB_2GHZ { 3, 272, 0 } - -#define AR5K_RF5112_OB_5GHZ { 3, 261, 0 } -#define AR5K_RF5112_DB_5GHZ { 3, 264, 0 } - -#define AR5K_RF5112_FIXED_BIAS_A { 1, 260, 0 } -#define AR5K_RF5112_FIXED_BIAS_B { 1, 259, 0 } - -#define AR5K_RF5112_XPD_SEL { 1, 284, 0 } -#define AR5K_RF5112_XPD_GAIN { 2, 252, 0 } - -/* Access to PWD registers */ -#define AR5K_RF5112_PWD(_n) { 1, (302 - _n), 3 } - -static const struct ath5k_rf_reg rf_regs_5112[] = { - {2, AR5K_RF_TURBO, AR5K_RF5112X_RF_TURBO}, - {6, AR5K_RF_OB_2GHZ, AR5K_RF5112_OB_2GHZ}, - {6, AR5K_RF_DB_2GHZ, AR5K_RF5112_DB_2GHZ}, - {6, AR5K_RF_OB_5GHZ, AR5K_RF5112_OB_5GHZ}, - {6, AR5K_RF_DB_5GHZ, AR5K_RF5112_DB_5GHZ}, - {6, AR5K_RF_FIXED_BIAS_A, AR5K_RF5112_FIXED_BIAS_A}, - {6, AR5K_RF_FIXED_BIAS_B, AR5K_RF5112_FIXED_BIAS_B}, - {6, AR5K_RF_XPD_SEL, AR5K_RF5112_XPD_SEL}, - {6, AR5K_RF_XPD_GAIN, AR5K_RF5112_XPD_GAIN}, - {6, AR5K_RF_PWD_130, AR5K_RF5112_PWD(130)}, - {6, AR5K_RF_PWD_131, AR5K_RF5112_PWD(131)}, - {6, AR5K_RF_PWD_132, AR5K_RF5112_PWD(132)}, - {6, AR5K_RF_PWD_136, AR5K_RF5112_PWD(136)}, - {6, AR5K_RF_PWD_137, AR5K_RF5112_PWD(137)}, - {6, AR5K_RF_PWD_138, AR5K_RF5112_PWD(138)}, - {7, AR5K_RF_GAIN_I, AR5K_RF5112X_GAIN_I}, - {7, AR5K_RF_MIXVGA_OVR, AR5K_RF5112X_MIXVGA_OVR}, - {7, AR5K_RF_MIXGAIN_OVR, AR5K_RF5112X_MIXGAIN_OVR}, - {7, AR5K_RF_MIXGAIN_STEP, AR5K_RF5112X_MIXGAIN_STEP}, - {7, AR5K_RF_PD_DELAY_A, AR5K_RF5112X_PD_DELAY_A}, - {7, AR5K_RF_PD_DELAY_B, AR5K_RF5112X_PD_DELAY_B}, - {7, AR5K_RF_PD_DELAY_XR, AR5K_RF5112X_PD_DELAY_XR}, - {7, AR5K_RF_PD_PERIOD_A, AR5K_RF5112X_PD_PERIOD_A}, - {7, AR5K_RF_PD_PERIOD_B, AR5K_RF5112X_PD_PERIOD_B}, - {7, AR5K_RF_PD_PERIOD_XR, AR5K_RF5112X_PD_PERIOD_XR}, -}; - -/* Default mode specific settings */ -static const struct ath5k_ini_rfbuffer rfb_5112[] = { - /* BANK / C.R. A/XR B G */ - { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, - { 2, 0x98d0, { 0x03060408, 0x03060408, 0x03060408 } }, - { 3, 0x98dc, { 0x00a0c0c0, 0x00e0c0c0, 0x00e0c0c0 } }, - { 6, 0x989c, { 0x00a00000, 0x00a00000, 0x00a00000 } }, - { 6, 0x989c, { 0x000a0000, 0x000a0000, 0x000a0000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00660000, 0x00660000, 0x00660000 } }, - { 6, 0x989c, { 0x00db0000, 0x00db0000, 0x00db0000 } }, - { 6, 0x989c, { 0x00f10000, 0x00f10000, 0x00f10000 } }, - { 6, 0x989c, { 0x00120000, 0x00120000, 0x00120000 } }, - { 6, 0x989c, { 0x00120000, 0x00120000, 0x00120000 } }, - { 6, 0x989c, { 0x00730000, 0x00730000, 0x00730000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x000c0000, 0x000c0000, 0x000c0000 } }, - { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, - { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, - { 6, 0x989c, { 0x008b0000, 0x008b0000, 0x008b0000 } }, - { 6, 0x989c, { 0x00600000, 0x00600000, 0x00600000 } }, - { 6, 0x989c, { 0x000c0000, 0x000c0000, 0x000c0000 } }, - { 6, 0x989c, { 0x00840000, 0x00840000, 0x00840000 } }, - { 6, 0x989c, { 0x00640000, 0x00640000, 0x00640000 } }, - { 6, 0x989c, { 0x00200000, 0x00200000, 0x00200000 } }, - { 6, 0x989c, { 0x00240000, 0x00240000, 0x00240000 } }, - { 6, 0x989c, { 0x00250000, 0x00250000, 0x00250000 } }, - { 6, 0x989c, { 0x00110000, 0x00110000, 0x00110000 } }, - { 6, 0x989c, { 0x00110000, 0x00110000, 0x00110000 } }, - { 6, 0x989c, { 0x00510000, 0x00510000, 0x00510000 } }, - { 6, 0x989c, { 0x1c040000, 0x1c040000, 0x1c040000 } }, - { 6, 0x989c, { 0x000a0000, 0x000a0000, 0x000a0000 } }, - { 6, 0x989c, { 0x00a10000, 0x00a10000, 0x00a10000 } }, - { 6, 0x989c, { 0x00400000, 0x00400000, 0x00400000 } }, - { 6, 0x989c, { 0x03090000, 0x03090000, 0x03090000 } }, - { 6, 0x989c, { 0x06000000, 0x06000000, 0x06000000 } }, - { 6, 0x989c, { 0x000000b0, 0x000000a8, 0x000000a8 } }, - { 6, 0x989c, { 0x0000002e, 0x0000002e, 0x0000002e } }, - { 6, 0x989c, { 0x006c4a41, 0x006c4af1, 0x006c4a61 } }, - { 6, 0x989c, { 0x0050892a, 0x0050892b, 0x0050892b } }, - { 6, 0x989c, { 0x00842400, 0x00842400, 0x00842400 } }, - { 6, 0x989c, { 0x00c69200, 0x00c69200, 0x00c69200 } }, - { 6, 0x98d0, { 0x0002000c, 0x0002000c, 0x0002000c } }, - { 7, 0x989c, { 0x00000094, 0x00000094, 0x00000094 } }, - { 7, 0x989c, { 0x00000091, 0x00000091, 0x00000091 } }, - { 7, 0x989c, { 0x0000000a, 0x00000012, 0x00000012 } }, - { 7, 0x989c, { 0x00000080, 0x00000080, 0x00000080 } }, - { 7, 0x989c, { 0x000000c1, 0x000000c1, 0x000000c1 } }, - { 7, 0x989c, { 0x00000060, 0x00000060, 0x00000060 } }, - { 7, 0x989c, { 0x000000f0, 0x000000f0, 0x000000f0 } }, - { 7, 0x989c, { 0x00000022, 0x00000022, 0x00000022 } }, - { 7, 0x989c, { 0x00000092, 0x00000092, 0x00000092 } }, - { 7, 0x989c, { 0x000000d4, 0x000000d4, 0x000000d4 } }, - { 7, 0x989c, { 0x000014cc, 0x000014cc, 0x000014cc } }, - { 7, 0x989c, { 0x0000048c, 0x0000048c, 0x0000048c } }, - { 7, 0x98c4, { 0x00000003, 0x00000003, 0x00000003 } }, -}; - -/* RFX112A (Derby 2) */ - -/* BANK 6 len pos col */ -#define AR5K_RF5112A_OB_2GHZ { 3, 287, 0 } -#define AR5K_RF5112A_DB_2GHZ { 3, 290, 0 } - -#define AR5K_RF5112A_OB_5GHZ { 3, 279, 0 } -#define AR5K_RF5112A_DB_5GHZ { 3, 282, 0 } - -#define AR5K_RF5112A_FIXED_BIAS_A { 1, 278, 0 } -#define AR5K_RF5112A_FIXED_BIAS_B { 1, 277, 0 } - -#define AR5K_RF5112A_XPD_SEL { 1, 302, 0 } -#define AR5K_RF5112A_PDGAINLO { 2, 270, 0 } -#define AR5K_RF5112A_PDGAINHI { 2, 257, 0 } - -/* Access to PWD registers */ -#define AR5K_RF5112A_PWD(_n) { 1, (306 - _n), 3 } - -/* Voltage regulators */ -#define AR5K_RF5112A_HIGH_VC_CP { 2, 90, 2 } -#define AR5K_RF5112A_MID_VC_CP { 2, 92, 2 } -#define AR5K_RF5112A_LOW_VC_CP { 2, 94, 2 } -#define AR5K_RF5112A_PUSH_UP { 1, 254, 2 } - -/* Power consumption */ -#define AR5K_RF5112A_PAD2GND { 1, 281, 1 } -#define AR5K_RF5112A_XB2_LVL { 2, 1, 3 } -#define AR5K_RF5112A_XB5_LVL { 2, 3, 3 } - -static const struct ath5k_rf_reg rf_regs_5112a[] = { - {2, AR5K_RF_TURBO, AR5K_RF5112X_RF_TURBO}, - {6, AR5K_RF_OB_2GHZ, AR5K_RF5112A_OB_2GHZ}, - {6, AR5K_RF_DB_2GHZ, AR5K_RF5112A_DB_2GHZ}, - {6, AR5K_RF_OB_5GHZ, AR5K_RF5112A_OB_5GHZ}, - {6, AR5K_RF_DB_5GHZ, AR5K_RF5112A_DB_5GHZ}, - {6, AR5K_RF_FIXED_BIAS_A, AR5K_RF5112A_FIXED_BIAS_A}, - {6, AR5K_RF_FIXED_BIAS_B, AR5K_RF5112A_FIXED_BIAS_B}, - {6, AR5K_RF_XPD_SEL, AR5K_RF5112A_XPD_SEL}, - {6, AR5K_RF_PD_GAIN_LO, AR5K_RF5112A_PDGAINLO}, - {6, AR5K_RF_PD_GAIN_HI, AR5K_RF5112A_PDGAINHI}, - {6, AR5K_RF_PWD_130, AR5K_RF5112A_PWD(130)}, - {6, AR5K_RF_PWD_131, AR5K_RF5112A_PWD(131)}, - {6, AR5K_RF_PWD_132, AR5K_RF5112A_PWD(132)}, - {6, AR5K_RF_PWD_136, AR5K_RF5112A_PWD(136)}, - {6, AR5K_RF_PWD_137, AR5K_RF5112A_PWD(137)}, - {6, AR5K_RF_PWD_138, AR5K_RF5112A_PWD(138)}, - {6, AR5K_RF_PWD_166, AR5K_RF5112A_PWD(166)}, - {6, AR5K_RF_PWD_167, AR5K_RF5112A_PWD(167)}, - {6, AR5K_RF_HIGH_VC_CP, AR5K_RF5112A_HIGH_VC_CP}, - {6, AR5K_RF_MID_VC_CP, AR5K_RF5112A_MID_VC_CP}, - {6, AR5K_RF_LOW_VC_CP, AR5K_RF5112A_LOW_VC_CP}, - {6, AR5K_RF_PUSH_UP, AR5K_RF5112A_PUSH_UP}, - {6, AR5K_RF_PAD2GND, AR5K_RF5112A_PAD2GND}, - {6, AR5K_RF_XB2_LVL, AR5K_RF5112A_XB2_LVL}, - {6, AR5K_RF_XB5_LVL, AR5K_RF5112A_XB5_LVL}, - {7, AR5K_RF_GAIN_I, AR5K_RF5112X_GAIN_I}, - {7, AR5K_RF_MIXVGA_OVR, AR5K_RF5112X_MIXVGA_OVR}, - {7, AR5K_RF_MIXGAIN_OVR, AR5K_RF5112X_MIXGAIN_OVR}, - {7, AR5K_RF_MIXGAIN_STEP, AR5K_RF5112X_MIXGAIN_STEP}, - {7, AR5K_RF_PD_DELAY_A, AR5K_RF5112X_PD_DELAY_A}, - {7, AR5K_RF_PD_DELAY_B, AR5K_RF5112X_PD_DELAY_B}, - {7, AR5K_RF_PD_DELAY_XR, AR5K_RF5112X_PD_DELAY_XR}, - {7, AR5K_RF_PD_PERIOD_A, AR5K_RF5112X_PD_PERIOD_A}, - {7, AR5K_RF_PD_PERIOD_B, AR5K_RF5112X_PD_PERIOD_B}, - {7, AR5K_RF_PD_PERIOD_XR, AR5K_RF5112X_PD_PERIOD_XR}, -}; - -/* Default mode specific settings */ -static const struct ath5k_ini_rfbuffer rfb_5112a[] = { - /* BANK / C.R. A/XR B G */ - { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, - { 2, 0x98d0, { 0x03060408, 0x03060408, 0x03060408 } }, - { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } }, - { 6, 0x989c, { 0x0f000000, 0x0f000000, 0x0f000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00800000, 0x00800000, 0x00800000 } }, - { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } }, - { 6, 0x989c, { 0x00010000, 0x00010000, 0x00010000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00180000, 0x00180000, 0x00180000 } }, - { 6, 0x989c, { 0x00600000, 0x006e0000, 0x006e0000 } }, - { 6, 0x989c, { 0x00c70000, 0x00c70000, 0x00c70000 } }, - { 6, 0x989c, { 0x004b0000, 0x004b0000, 0x004b0000 } }, - { 6, 0x989c, { 0x04480000, 0x04480000, 0x04480000 } }, - { 6, 0x989c, { 0x004c0000, 0x004c0000, 0x004c0000 } }, - { 6, 0x989c, { 0x00e40000, 0x00e40000, 0x00e40000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00fc0000, 0x00fc0000, 0x00fc0000 } }, - { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, - { 6, 0x989c, { 0x043f0000, 0x043f0000, 0x043f0000 } }, - { 6, 0x989c, { 0x000c0000, 0x000c0000, 0x000c0000 } }, - { 6, 0x989c, { 0x02190000, 0x02190000, 0x02190000 } }, - { 6, 0x989c, { 0x00240000, 0x00240000, 0x00240000 } }, - { 6, 0x989c, { 0x00b40000, 0x00b40000, 0x00b40000 } }, - { 6, 0x989c, { 0x00990000, 0x00990000, 0x00990000 } }, - { 6, 0x989c, { 0x00500000, 0x00500000, 0x00500000 } }, - { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } }, - { 6, 0x989c, { 0x00120000, 0x00120000, 0x00120000 } }, - { 6, 0x989c, { 0xc0320000, 0xc0320000, 0xc0320000 } }, - { 6, 0x989c, { 0x01740000, 0x01740000, 0x01740000 } }, - { 6, 0x989c, { 0x00110000, 0x00110000, 0x00110000 } }, - { 6, 0x989c, { 0x86280000, 0x86280000, 0x86280000 } }, - { 6, 0x989c, { 0x31840000, 0x31840000, 0x31840000 } }, - { 6, 0x989c, { 0x00f20080, 0x00f20080, 0x00f20080 } }, - { 6, 0x989c, { 0x00270019, 0x00270019, 0x00270019 } }, - { 6, 0x989c, { 0x00000003, 0x00000003, 0x00000003 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x000000b2, 0x000000b2, 0x000000b2 } }, - { 6, 0x989c, { 0x00b02084, 0x00b02084, 0x00b02084 } }, - { 6, 0x989c, { 0x004125a4, 0x004125a4, 0x004125a4 } }, - { 6, 0x989c, { 0x00119220, 0x00119220, 0x00119220 } }, - { 6, 0x989c, { 0x001a4800, 0x001a4800, 0x001a4800 } }, - { 6, 0x98d8, { 0x000b0230, 0x000b0230, 0x000b0230 } }, - { 7, 0x989c, { 0x00000094, 0x00000094, 0x00000094 } }, - { 7, 0x989c, { 0x00000091, 0x00000091, 0x00000091 } }, - { 7, 0x989c, { 0x00000012, 0x00000012, 0x00000012 } }, - { 7, 0x989c, { 0x00000080, 0x00000080, 0x00000080 } }, - { 7, 0x989c, { 0x000000d9, 0x000000d9, 0x000000d9 } }, - { 7, 0x989c, { 0x00000060, 0x00000060, 0x00000060 } }, - { 7, 0x989c, { 0x000000f0, 0x000000f0, 0x000000f0 } }, - { 7, 0x989c, { 0x000000a2, 0x000000a2, 0x000000a2 } }, - { 7, 0x989c, { 0x00000052, 0x00000052, 0x00000052 } }, - { 7, 0x989c, { 0x000000d4, 0x000000d4, 0x000000d4 } }, - { 7, 0x989c, { 0x000014cc, 0x000014cc, 0x000014cc } }, - { 7, 0x989c, { 0x0000048c, 0x0000048c, 0x0000048c } }, - { 7, 0x98c4, { 0x00000003, 0x00000003, 0x00000003 } }, -}; - - - -/******************\ -* RF2413 (Griffin) * -\******************/ - -/* BANK 2 len pos col */ -#define AR5K_RF2413_RF_TURBO { 1, 1, 2 } - -/* BANK 6 len pos col */ -#define AR5K_RF2413_OB_2GHZ { 3, 168, 0 } -#define AR5K_RF2413_DB_2GHZ { 3, 165, 0 } - -static const struct ath5k_rf_reg rf_regs_2413[] = { - {2, AR5K_RF_TURBO, AR5K_RF2413_RF_TURBO}, - {6, AR5K_RF_OB_2GHZ, AR5K_RF2413_OB_2GHZ}, - {6, AR5K_RF_DB_2GHZ, AR5K_RF2413_DB_2GHZ}, -}; - -/* Default mode specific settings - * XXX: a/aTurbo ??? - */ -static const struct ath5k_ini_rfbuffer rfb_2413[] = { - /* BANK / C.R. A/XR B G */ - { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, - { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } }, - { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } }, - { 6, 0x989c, { 0xf0000000, 0xf0000000, 0xf0000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x03000000, 0x03000000, 0x03000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x40400000, 0x40400000, 0x40400000 } }, - { 6, 0x989c, { 0x65050000, 0x65050000, 0x65050000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00420000, 0x00420000, 0x00420000 } }, - { 6, 0x989c, { 0x00b50000, 0x00b50000, 0x00b50000 } }, - { 6, 0x989c, { 0x00030000, 0x00030000, 0x00030000 } }, - { 6, 0x989c, { 0x00f70000, 0x00f70000, 0x00f70000 } }, - { 6, 0x989c, { 0x009d0000, 0x009d0000, 0x009d0000 } }, - { 6, 0x989c, { 0x00220000, 0x00220000, 0x00220000 } }, - { 6, 0x989c, { 0x04220000, 0x04220000, 0x04220000 } }, - { 6, 0x989c, { 0x00230018, 0x00230018, 0x00230018 } }, - { 6, 0x989c, { 0x00280000, 0x00280060, 0x00280060 } }, - { 6, 0x989c, { 0x005000c0, 0x005000c3, 0x005000c3 } }, - { 6, 0x989c, { 0x0004007f, 0x0004007f, 0x0004007f } }, - { 6, 0x989c, { 0x00000458, 0x00000458, 0x00000458 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x0000c000, 0x0000c000, 0x0000c000 } }, - { 6, 0x98d8, { 0x00400230, 0x00400230, 0x00400230 } }, - { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } }, - { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } }, - { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } }, -}; - - - -/***************************\ -* RF2315/RF2316 (Cobra SoC) * -\***************************/ - -/* BANK 2 len pos col */ -#define AR5K_RF2316_RF_TURBO { 1, 1, 2 } - -/* BANK 6 len pos col */ -#define AR5K_RF2316_OB_2GHZ { 3, 178, 0 } -#define AR5K_RF2316_DB_2GHZ { 3, 175, 0 } - -static const struct ath5k_rf_reg rf_regs_2316[] = { - {2, AR5K_RF_TURBO, AR5K_RF2316_RF_TURBO}, - {6, AR5K_RF_OB_2GHZ, AR5K_RF2316_OB_2GHZ}, - {6, AR5K_RF_DB_2GHZ, AR5K_RF2316_DB_2GHZ}, -}; - -/* Default mode specific settings */ -static const struct ath5k_ini_rfbuffer rfb_2316[] = { - /* BANK / C.R. A/XR B G */ - { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, - { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } }, - { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0xc0000000, 0xc0000000, 0xc0000000 } }, - { 6, 0x989c, { 0x0f000000, 0x0f000000, 0x0f000000 } }, - { 6, 0x989c, { 0x02000000, 0x02000000, 0x02000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0xf8000000, 0xf8000000, 0xf8000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x95150000, 0x95150000, 0x95150000 } }, - { 6, 0x989c, { 0xc1000000, 0xc1000000, 0xc1000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00080000, 0x00080000, 0x00080000 } }, - { 6, 0x989c, { 0x00d50000, 0x00d50000, 0x00d50000 } }, - { 6, 0x989c, { 0x000e0000, 0x000e0000, 0x000e0000 } }, - { 6, 0x989c, { 0x00dc0000, 0x00dc0000, 0x00dc0000 } }, - { 6, 0x989c, { 0x00770000, 0x00770000, 0x00770000 } }, - { 6, 0x989c, { 0x008a0000, 0x008a0000, 0x008a0000 } }, - { 6, 0x989c, { 0x10880000, 0x10880000, 0x10880000 } }, - { 6, 0x989c, { 0x008c0060, 0x008c0060, 0x008c0060 } }, - { 6, 0x989c, { 0x00a00000, 0x00a00080, 0x00a00080 } }, - { 6, 0x989c, { 0x00400000, 0x0040000d, 0x0040000d } }, - { 6, 0x989c, { 0x00110400, 0x00110400, 0x00110400 } }, - { 6, 0x989c, { 0x00000060, 0x00000060, 0x00000060 } }, - { 6, 0x989c, { 0x00000001, 0x00000001, 0x00000001 } }, - { 6, 0x989c, { 0x00000b00, 0x00000b00, 0x00000b00 } }, - { 6, 0x989c, { 0x00000be8, 0x00000be8, 0x00000be8 } }, - { 6, 0x98c0, { 0x00010000, 0x00010000, 0x00010000 } }, - { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } }, - { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } }, - { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } }, -}; - - - -/******************************\ -* RF5413/RF5424 (Eagle/Condor) * -\******************************/ - -/* BANK 6 len pos col */ -#define AR5K_RF5413_OB_2GHZ { 3, 241, 0 } -#define AR5K_RF5413_DB_2GHZ { 3, 238, 0 } - -#define AR5K_RF5413_OB_5GHZ { 3, 247, 0 } -#define AR5K_RF5413_DB_5GHZ { 3, 244, 0 } - -#define AR5K_RF5413_PWD_ICLOBUF2G { 3, 131, 3 } -#define AR5K_RF5413_DERBY_CHAN_SEL_MODE { 1, 291, 2 } - -static const struct ath5k_rf_reg rf_regs_5413[] = { - {6, AR5K_RF_OB_2GHZ, AR5K_RF5413_OB_2GHZ}, - {6, AR5K_RF_DB_2GHZ, AR5K_RF5413_DB_2GHZ}, - {6, AR5K_RF_OB_5GHZ, AR5K_RF5413_OB_5GHZ}, - {6, AR5K_RF_DB_5GHZ, AR5K_RF5413_DB_5GHZ}, - {6, AR5K_RF_PWD_ICLOBUF_2G, AR5K_RF5413_PWD_ICLOBUF2G}, - {6, AR5K_RF_DERBY_CHAN_SEL_MODE, AR5K_RF5413_DERBY_CHAN_SEL_MODE}, -}; - -/* Default mode specific settings */ -static const struct ath5k_ini_rfbuffer rfb_5413[] = { - /* BANK / C.R. A/XR B G */ - { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, - { 2, 0x98d0, { 0x00000008, 0x00000008, 0x00000008 } }, - { 3, 0x98dc, { 0x00a000c0, 0x00e000c0, 0x00e000c0 } }, - { 6, 0x989c, { 0x33000000, 0x33000000, 0x33000000 } }, - { 6, 0x989c, { 0x01000000, 0x01000000, 0x01000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x1f000000, 0x1f000000, 0x1f000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00b80000, 0x00b80000, 0x00b80000 } }, - { 6, 0x989c, { 0x00b70000, 0x00b70000, 0x00b70000 } }, - { 6, 0x989c, { 0x00840000, 0x00840000, 0x00840000 } }, - { 6, 0x989c, { 0x00980000, 0x00980000, 0x00980000 } }, - { 6, 0x989c, { 0x00c00000, 0x00c00000, 0x00c00000 } }, - { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, - { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, - { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, - { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, - { 6, 0x989c, { 0x00d70000, 0x00d70000, 0x00d70000 } }, - { 6, 0x989c, { 0x00610000, 0x00610000, 0x00610000 } }, - { 6, 0x989c, { 0x00fe0000, 0x00fe0000, 0x00fe0000 } }, - { 6, 0x989c, { 0x00de0000, 0x00de0000, 0x00de0000 } }, - { 6, 0x989c, { 0x007f0000, 0x007f0000, 0x007f0000 } }, - { 6, 0x989c, { 0x043d0000, 0x043d0000, 0x043d0000 } }, - { 6, 0x989c, { 0x00770000, 0x00770000, 0x00770000 } }, - { 6, 0x989c, { 0x00440000, 0x00440000, 0x00440000 } }, - { 6, 0x989c, { 0x00980000, 0x00980000, 0x00980000 } }, - { 6, 0x989c, { 0x00100080, 0x00100080, 0x00100080 } }, - { 6, 0x989c, { 0x0005c034, 0x0005c034, 0x0005c034 } }, - { 6, 0x989c, { 0x003100f0, 0x003100f0, 0x003100f0 } }, - { 6, 0x989c, { 0x000c011f, 0x000c011f, 0x000c011f } }, - { 6, 0x989c, { 0x00510040, 0x00510040, 0x00510040 } }, - { 6, 0x989c, { 0x005000da, 0x005000da, 0x005000da } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00004044, 0x00004044, 0x00004044 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x000060c0, 0x000060c0, 0x000060c0 } }, - { 6, 0x989c, { 0x00002c00, 0x00003600, 0x00003600 } }, - { 6, 0x98c8, { 0x00000403, 0x00040403, 0x00040403 } }, - { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } }, - { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } }, - { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } }, -}; - - - -/***************************\ -* RF2425/RF2417 (Swan/Nala) * -* AR2317 (Spider SoC) * -\***************************/ - -/* BANK 2 len pos col */ -#define AR5K_RF2425_RF_TURBO { 1, 1, 2 } - -/* BANK 6 len pos col */ -#define AR5K_RF2425_OB_2GHZ { 3, 193, 0 } -#define AR5K_RF2425_DB_2GHZ { 3, 190, 0 } - -static const struct ath5k_rf_reg rf_regs_2425[] = { - {2, AR5K_RF_TURBO, AR5K_RF2425_RF_TURBO}, - {6, AR5K_RF_OB_2GHZ, AR5K_RF2425_OB_2GHZ}, - {6, AR5K_RF_DB_2GHZ, AR5K_RF2425_DB_2GHZ}, -}; - -/* Default mode specific settings - */ -static const struct ath5k_ini_rfbuffer rfb_2425[] = { - /* BANK / C.R. A/XR B G */ - { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, - { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } }, - { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } }, - { 6, 0x989c, { 0x10000000, 0x10000000, 0x10000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00100000, 0x00100000, 0x00100000 } }, - { 6, 0x989c, { 0x00020000, 0x00020000, 0x00020000 } }, - { 6, 0x989c, { 0x00730000, 0x00730000, 0x00730000 } }, - { 6, 0x989c, { 0x00f80000, 0x00f80000, 0x00f80000 } }, - { 6, 0x989c, { 0x00e70000, 0x00e70000, 0x00e70000 } }, - { 6, 0x989c, { 0x00140000, 0x00140000, 0x00140000 } }, - { 6, 0x989c, { 0x00910040, 0x00910040, 0x00910040 } }, - { 6, 0x989c, { 0x0007001a, 0x0007001a, 0x0007001a } }, - { 6, 0x989c, { 0x00410000, 0x00410000, 0x00410000 } }, - { 6, 0x989c, { 0x00810000, 0x00810060, 0x00810060 } }, - { 6, 0x989c, { 0x00020800, 0x00020803, 0x00020803 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00001660, 0x00001660, 0x00001660 } }, - { 6, 0x989c, { 0x00001688, 0x00001688, 0x00001688 } }, - { 6, 0x98c4, { 0x00000001, 0x00000001, 0x00000001 } }, - { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } }, - { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } }, - { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } }, -}; - -/* - * TODO: Handle the few differences with swan during - * bank modification and get rid of this - */ -static const struct ath5k_ini_rfbuffer rfb_2317[] = { - /* BANK / C.R. A/XR B G */ - { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, - { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } }, - { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } }, - { 6, 0x989c, { 0x10000000, 0x10000000, 0x10000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00100000, 0x00100000, 0x00100000 } }, - { 6, 0x989c, { 0x00020000, 0x00020000, 0x00020000 } }, - { 6, 0x989c, { 0x00730000, 0x00730000, 0x00730000 } }, - { 6, 0x989c, { 0x00f80000, 0x00f80000, 0x00f80000 } }, - { 6, 0x989c, { 0x00e70000, 0x00e70000, 0x00e70000 } }, - { 6, 0x989c, { 0x00140100, 0x00140100, 0x00140100 } }, - { 6, 0x989c, { 0x00910040, 0x00910040, 0x00910040 } }, - { 6, 0x989c, { 0x0007001a, 0x0007001a, 0x0007001a } }, - { 6, 0x989c, { 0x00410000, 0x00410000, 0x00410000 } }, - { 6, 0x989c, { 0x00810000, 0x00810060, 0x00810060 } }, - { 6, 0x989c, { 0x00020800, 0x00020803, 0x00020803 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00001660, 0x00001660, 0x00001660 } }, - { 6, 0x989c, { 0x00009688, 0x00009688, 0x00009688 } }, - { 6, 0x98c4, { 0x00000001, 0x00000001, 0x00000001 } }, - { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } }, - { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } }, - { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } }, -}; - -/* - * TODO: Handle the few differences with swan during - * bank modification and get rid of this - */ -static const struct ath5k_ini_rfbuffer rfb_2417[] = { - /* BANK / C.R. A/XR B G */ - { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } }, - { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } }, - { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } }, - { 6, 0x989c, { 0x10000000, 0x10000000, 0x10000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00100000, 0x00100000, 0x00100000 } }, - { 6, 0x989c, { 0x00020000, 0x00020000, 0x00020000 } }, - { 6, 0x989c, { 0x00730000, 0x00730000, 0x00730000 } }, - { 6, 0x989c, { 0x00f80000, 0x00f80000, 0x00f80000 } }, - { 6, 0x989c, { 0x00e70000, 0x80e70000, 0x80e70000 } }, - { 6, 0x989c, { 0x00140000, 0x00140000, 0x00140000 } }, - { 6, 0x989c, { 0x00910040, 0x00910040, 0x00910040 } }, - { 6, 0x989c, { 0x0007001a, 0x0207001a, 0x0207001a } }, - { 6, 0x989c, { 0x00410000, 0x00410000, 0x00410000 } }, - { 6, 0x989c, { 0x00810000, 0x00810060, 0x00810060 } }, - { 6, 0x989c, { 0x00020800, 0x00020803, 0x00020803 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } }, - { 6, 0x989c, { 0x00001660, 0x00001660, 0x00001660 } }, - { 6, 0x989c, { 0x00001688, 0x00001688, 0x00001688 } }, - { 6, 0x98c4, { 0x00000001, 0x00000001, 0x00000001 } }, - { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } }, - { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } }, - { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } }, -}; diff --git a/drivers/net/wireless/ath/ath5k/rfgain.h b/drivers/net/wireless/ath/ath5k/rfgain.h deleted file mode 100644 index 4d21df0e5975..000000000000 --- a/drivers/net/wireless/ath/ath5k/rfgain.h +++ /dev/null @@ -1,534 +0,0 @@ -/* - * RF Gain optimization - * - * Copyright (c) 2004-2009 Reyk Floeter - * Copyright (c) 2006-2009 Nick Kossifidis - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/** - * struct ath5k_ini_rfgain - RF Gain table - * @rfg_register: RF Gain register address - * @rfg_value: Register value for 5 and 2GHz - * - * Mode-specific RF Gain table (64bytes) for RF5111/5112 - * (RF5110 only comes with AR5210 and only supports a/turbo a mode so initial - * RF Gain values are included in AR5K_AR5210_INI) - */ -struct ath5k_ini_rfgain { - u16 rfg_register; - u32 rfg_value[2]; /* [freq (see below)] */ -}; - -/* Initial RF Gain settings for RF5111 */ -static const struct ath5k_ini_rfgain rfgain_5111[] = { - /* 5GHz 2GHz */ - { AR5K_RF_GAIN(0), { 0x000001a9, 0x00000000 } }, - { AR5K_RF_GAIN(1), { 0x000001e9, 0x00000040 } }, - { AR5K_RF_GAIN(2), { 0x00000029, 0x00000080 } }, - { AR5K_RF_GAIN(3), { 0x00000069, 0x00000150 } }, - { AR5K_RF_GAIN(4), { 0x00000199, 0x00000190 } }, - { AR5K_RF_GAIN(5), { 0x000001d9, 0x000001d0 } }, - { AR5K_RF_GAIN(6), { 0x00000019, 0x00000010 } }, - { AR5K_RF_GAIN(7), { 0x00000059, 0x00000044 } }, - { AR5K_RF_GAIN(8), { 0x00000099, 0x00000084 } }, - { AR5K_RF_GAIN(9), { 0x000001a5, 0x00000148 } }, - { AR5K_RF_GAIN(10), { 0x000001e5, 0x00000188 } }, - { AR5K_RF_GAIN(11), { 0x00000025, 0x000001c8 } }, - { AR5K_RF_GAIN(12), { 0x000001c8, 0x00000014 } }, - { AR5K_RF_GAIN(13), { 0x00000008, 0x00000042 } }, - { AR5K_RF_GAIN(14), { 0x00000048, 0x00000082 } }, - { AR5K_RF_GAIN(15), { 0x00000088, 0x00000178 } }, - { AR5K_RF_GAIN(16), { 0x00000198, 0x000001b8 } }, - { AR5K_RF_GAIN(17), { 0x000001d8, 0x000001f8 } }, - { AR5K_RF_GAIN(18), { 0x00000018, 0x00000012 } }, - { AR5K_RF_GAIN(19), { 0x00000058, 0x00000052 } }, - { AR5K_RF_GAIN(20), { 0x00000098, 0x00000092 } }, - { AR5K_RF_GAIN(21), { 0x000001a4, 0x0000017c } }, - { AR5K_RF_GAIN(22), { 0x000001e4, 0x000001bc } }, - { AR5K_RF_GAIN(23), { 0x00000024, 0x000001fc } }, - { AR5K_RF_GAIN(24), { 0x00000064, 0x0000000a } }, - { AR5K_RF_GAIN(25), { 0x000000a4, 0x0000004a } }, - { AR5K_RF_GAIN(26), { 0x000000e4, 0x0000008a } }, - { AR5K_RF_GAIN(27), { 0x0000010a, 0x0000015a } }, - { AR5K_RF_GAIN(28), { 0x0000014a, 0x0000019a } }, - { AR5K_RF_GAIN(29), { 0x0000018a, 0x000001da } }, - { AR5K_RF_GAIN(30), { 0x000001ca, 0x0000000e } }, - { AR5K_RF_GAIN(31), { 0x0000000a, 0x0000004e } }, - { AR5K_RF_GAIN(32), { 0x0000004a, 0x0000008e } }, - { AR5K_RF_GAIN(33), { 0x0000008a, 0x0000015e } }, - { AR5K_RF_GAIN(34), { 0x000001ba, 0x0000019e } }, - { AR5K_RF_GAIN(35), { 0x000001fa, 0x000001de } }, - { AR5K_RF_GAIN(36), { 0x0000003a, 0x00000009 } }, - { AR5K_RF_GAIN(37), { 0x0000007a, 0x00000049 } }, - { AR5K_RF_GAIN(38), { 0x00000186, 0x00000089 } }, - { AR5K_RF_GAIN(39), { 0x000001c6, 0x00000179 } }, - { AR5K_RF_GAIN(40), { 0x00000006, 0x000001b9 } }, - { AR5K_RF_GAIN(41), { 0x00000046, 0x000001f9 } }, - { AR5K_RF_GAIN(42), { 0x00000086, 0x00000039 } }, - { AR5K_RF_GAIN(43), { 0x000000c6, 0x00000079 } }, - { AR5K_RF_GAIN(44), { 0x000000c6, 0x000000b9 } }, - { AR5K_RF_GAIN(45), { 0x000000c6, 0x000001bd } }, - { AR5K_RF_GAIN(46), { 0x000000c6, 0x000001fd } }, - { AR5K_RF_GAIN(47), { 0x000000c6, 0x0000003d } }, - { AR5K_RF_GAIN(48), { 0x000000c6, 0x0000007d } }, - { AR5K_RF_GAIN(49), { 0x000000c6, 0x000000bd } }, - { AR5K_RF_GAIN(50), { 0x000000c6, 0x000000fd } }, - { AR5K_RF_GAIN(51), { 0x000000c6, 0x000000fd } }, - { AR5K_RF_GAIN(52), { 0x000000c6, 0x000000fd } }, - { AR5K_RF_GAIN(53), { 0x000000c6, 0x000000fd } }, - { AR5K_RF_GAIN(54), { 0x000000c6, 0x000000fd } }, - { AR5K_RF_GAIN(55), { 0x000000c6, 0x000000fd } }, - { AR5K_RF_GAIN(56), { 0x000000c6, 0x000000fd } }, - { AR5K_RF_GAIN(57), { 0x000000c6, 0x000000fd } }, - { AR5K_RF_GAIN(58), { 0x000000c6, 0x000000fd } }, - { AR5K_RF_GAIN(59), { 0x000000c6, 0x000000fd } }, - { AR5K_RF_GAIN(60), { 0x000000c6, 0x000000fd } }, - { AR5K_RF_GAIN(61), { 0x000000c6, 0x000000fd } }, - { AR5K_RF_GAIN(62), { 0x000000c6, 0x000000fd } }, - { AR5K_RF_GAIN(63), { 0x000000c6, 0x000000fd } }, -}; - -/* Initial RF Gain settings for RF5112 */ -static const struct ath5k_ini_rfgain rfgain_5112[] = { - /* 5GHz 2GHz */ - { AR5K_RF_GAIN(0), { 0x00000007, 0x00000007 } }, - { AR5K_RF_GAIN(1), { 0x00000047, 0x00000047 } }, - { AR5K_RF_GAIN(2), { 0x00000087, 0x00000087 } }, - { AR5K_RF_GAIN(3), { 0x000001a0, 0x000001a0 } }, - { AR5K_RF_GAIN(4), { 0x000001e0, 0x000001e0 } }, - { AR5K_RF_GAIN(5), { 0x00000020, 0x00000020 } }, - { AR5K_RF_GAIN(6), { 0x00000060, 0x00000060 } }, - { AR5K_RF_GAIN(7), { 0x000001a1, 0x000001a1 } }, - { AR5K_RF_GAIN(8), { 0x000001e1, 0x000001e1 } }, - { AR5K_RF_GAIN(9), { 0x00000021, 0x00000021 } }, - { AR5K_RF_GAIN(10), { 0x00000061, 0x00000061 } }, - { AR5K_RF_GAIN(11), { 0x00000162, 0x00000162 } }, - { AR5K_RF_GAIN(12), { 0x000001a2, 0x000001a2 } }, - { AR5K_RF_GAIN(13), { 0x000001e2, 0x000001e2 } }, - { AR5K_RF_GAIN(14), { 0x00000022, 0x00000022 } }, - { AR5K_RF_GAIN(15), { 0x00000062, 0x00000062 } }, - { AR5K_RF_GAIN(16), { 0x00000163, 0x00000163 } }, - { AR5K_RF_GAIN(17), { 0x000001a3, 0x000001a3 } }, - { AR5K_RF_GAIN(18), { 0x000001e3, 0x000001e3 } }, - { AR5K_RF_GAIN(19), { 0x00000023, 0x00000023 } }, - { AR5K_RF_GAIN(20), { 0x00000063, 0x00000063 } }, - { AR5K_RF_GAIN(21), { 0x00000184, 0x00000184 } }, - { AR5K_RF_GAIN(22), { 0x000001c4, 0x000001c4 } }, - { AR5K_RF_GAIN(23), { 0x00000004, 0x00000004 } }, - { AR5K_RF_GAIN(24), { 0x000001ea, 0x0000000b } }, - { AR5K_RF_GAIN(25), { 0x0000002a, 0x0000004b } }, - { AR5K_RF_GAIN(26), { 0x0000006a, 0x0000008b } }, - { AR5K_RF_GAIN(27), { 0x000000aa, 0x000001ac } }, - { AR5K_RF_GAIN(28), { 0x000001ab, 0x000001ec } }, - { AR5K_RF_GAIN(29), { 0x000001eb, 0x0000002c } }, - { AR5K_RF_GAIN(30), { 0x0000002b, 0x00000012 } }, - { AR5K_RF_GAIN(31), { 0x0000006b, 0x00000052 } }, - { AR5K_RF_GAIN(32), { 0x000000ab, 0x00000092 } }, - { AR5K_RF_GAIN(33), { 0x000001ac, 0x00000193 } }, - { AR5K_RF_GAIN(34), { 0x000001ec, 0x000001d3 } }, - { AR5K_RF_GAIN(35), { 0x0000002c, 0x00000013 } }, - { AR5K_RF_GAIN(36), { 0x0000003a, 0x00000053 } }, - { AR5K_RF_GAIN(37), { 0x0000007a, 0x00000093 } }, - { AR5K_RF_GAIN(38), { 0x000000ba, 0x00000194 } }, - { AR5K_RF_GAIN(39), { 0x000001bb, 0x000001d4 } }, - { AR5K_RF_GAIN(40), { 0x000001fb, 0x00000014 } }, - { AR5K_RF_GAIN(41), { 0x0000003b, 0x0000003a } }, - { AR5K_RF_GAIN(42), { 0x0000007b, 0x0000007a } }, - { AR5K_RF_GAIN(43), { 0x000000bb, 0x000000ba } }, - { AR5K_RF_GAIN(44), { 0x000001bc, 0x000001bb } }, - { AR5K_RF_GAIN(45), { 0x000001fc, 0x000001fb } }, - { AR5K_RF_GAIN(46), { 0x0000003c, 0x0000003b } }, - { AR5K_RF_GAIN(47), { 0x0000007c, 0x0000007b } }, - { AR5K_RF_GAIN(48), { 0x000000bc, 0x000000bb } }, - { AR5K_RF_GAIN(49), { 0x000000fc, 0x000001bc } }, - { AR5K_RF_GAIN(50), { 0x000000fc, 0x000001fc } }, - { AR5K_RF_GAIN(51), { 0x000000fc, 0x0000003c } }, - { AR5K_RF_GAIN(52), { 0x000000fc, 0x0000007c } }, - { AR5K_RF_GAIN(53), { 0x000000fc, 0x000000bc } }, - { AR5K_RF_GAIN(54), { 0x000000fc, 0x000000fc } }, - { AR5K_RF_GAIN(55), { 0x000000fc, 0x000000fc } }, - { AR5K_RF_GAIN(56), { 0x000000fc, 0x000000fc } }, - { AR5K_RF_GAIN(57), { 0x000000fc, 0x000000fc } }, - { AR5K_RF_GAIN(58), { 0x000000fc, 0x000000fc } }, - { AR5K_RF_GAIN(59), { 0x000000fc, 0x000000fc } }, - { AR5K_RF_GAIN(60), { 0x000000fc, 0x000000fc } }, - { AR5K_RF_GAIN(61), { 0x000000fc, 0x000000fc } }, - { AR5K_RF_GAIN(62), { 0x000000fc, 0x000000fc } }, - { AR5K_RF_GAIN(63), { 0x000000fc, 0x000000fc } }, -}; - -/* Initial RF Gain settings for RF2413 */ -static const struct ath5k_ini_rfgain rfgain_2413[] = { - { AR5K_RF_GAIN(0), { 0x00000000, 0x00000000 } }, - { AR5K_RF_GAIN(1), { 0x00000000, 0x00000040 } }, - { AR5K_RF_GAIN(2), { 0x00000000, 0x00000080 } }, - { AR5K_RF_GAIN(3), { 0x00000000, 0x00000181 } }, - { AR5K_RF_GAIN(4), { 0x00000000, 0x000001c1 } }, - { AR5K_RF_GAIN(5), { 0x00000000, 0x00000001 } }, - { AR5K_RF_GAIN(6), { 0x00000000, 0x00000041 } }, - { AR5K_RF_GAIN(7), { 0x00000000, 0x00000081 } }, - { AR5K_RF_GAIN(8), { 0x00000000, 0x00000168 } }, - { AR5K_RF_GAIN(9), { 0x00000000, 0x000001a8 } }, - { AR5K_RF_GAIN(10), { 0x00000000, 0x000001e8 } }, - { AR5K_RF_GAIN(11), { 0x00000000, 0x00000028 } }, - { AR5K_RF_GAIN(12), { 0x00000000, 0x00000068 } }, - { AR5K_RF_GAIN(13), { 0x00000000, 0x00000189 } }, - { AR5K_RF_GAIN(14), { 0x00000000, 0x000001c9 } }, - { AR5K_RF_GAIN(15), { 0x00000000, 0x00000009 } }, - { AR5K_RF_GAIN(16), { 0x00000000, 0x00000049 } }, - { AR5K_RF_GAIN(17), { 0x00000000, 0x00000089 } }, - { AR5K_RF_GAIN(18), { 0x00000000, 0x00000190 } }, - { AR5K_RF_GAIN(19), { 0x00000000, 0x000001d0 } }, - { AR5K_RF_GAIN(20), { 0x00000000, 0x00000010 } }, - { AR5K_RF_GAIN(21), { 0x00000000, 0x00000050 } }, - { AR5K_RF_GAIN(22), { 0x00000000, 0x00000090 } }, - { AR5K_RF_GAIN(23), { 0x00000000, 0x00000191 } }, - { AR5K_RF_GAIN(24), { 0x00000000, 0x000001d1 } }, - { AR5K_RF_GAIN(25), { 0x00000000, 0x00000011 } }, - { AR5K_RF_GAIN(26), { 0x00000000, 0x00000051 } }, - { AR5K_RF_GAIN(27), { 0x00000000, 0x00000091 } }, - { AR5K_RF_GAIN(28), { 0x00000000, 0x00000178 } }, - { AR5K_RF_GAIN(29), { 0x00000000, 0x000001b8 } }, - { AR5K_RF_GAIN(30), { 0x00000000, 0x000001f8 } }, - { AR5K_RF_GAIN(31), { 0x00000000, 0x00000038 } }, - { AR5K_RF_GAIN(32), { 0x00000000, 0x00000078 } }, - { AR5K_RF_GAIN(33), { 0x00000000, 0x00000199 } }, - { AR5K_RF_GAIN(34), { 0x00000000, 0x000001d9 } }, - { AR5K_RF_GAIN(35), { 0x00000000, 0x00000019 } }, - { AR5K_RF_GAIN(36), { 0x00000000, 0x00000059 } }, - { AR5K_RF_GAIN(37), { 0x00000000, 0x00000099 } }, - { AR5K_RF_GAIN(38), { 0x00000000, 0x000000d9 } }, - { AR5K_RF_GAIN(39), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(40), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(41), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(42), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(43), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(44), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(45), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(46), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(47), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(48), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(49), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(50), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(51), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(52), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(53), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(54), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(55), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(56), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(57), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(58), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(59), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(60), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(61), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(62), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(63), { 0x00000000, 0x000000f9 } }, -}; - -/* Initial RF Gain settings for AR2316 */ -static const struct ath5k_ini_rfgain rfgain_2316[] = { - { AR5K_RF_GAIN(0), { 0x00000000, 0x00000000 } }, - { AR5K_RF_GAIN(1), { 0x00000000, 0x00000040 } }, - { AR5K_RF_GAIN(2), { 0x00000000, 0x00000080 } }, - { AR5K_RF_GAIN(3), { 0x00000000, 0x000000c0 } }, - { AR5K_RF_GAIN(4), { 0x00000000, 0x000000e0 } }, - { AR5K_RF_GAIN(5), { 0x00000000, 0x000000e0 } }, - { AR5K_RF_GAIN(6), { 0x00000000, 0x00000128 } }, - { AR5K_RF_GAIN(7), { 0x00000000, 0x00000128 } }, - { AR5K_RF_GAIN(8), { 0x00000000, 0x00000128 } }, - { AR5K_RF_GAIN(9), { 0x00000000, 0x00000168 } }, - { AR5K_RF_GAIN(10), { 0x00000000, 0x000001a8 } }, - { AR5K_RF_GAIN(11), { 0x00000000, 0x000001e8 } }, - { AR5K_RF_GAIN(12), { 0x00000000, 0x00000028 } }, - { AR5K_RF_GAIN(13), { 0x00000000, 0x00000068 } }, - { AR5K_RF_GAIN(14), { 0x00000000, 0x000000a8 } }, - { AR5K_RF_GAIN(15), { 0x00000000, 0x000000e8 } }, - { AR5K_RF_GAIN(16), { 0x00000000, 0x000000e8 } }, - { AR5K_RF_GAIN(17), { 0x00000000, 0x00000130 } }, - { AR5K_RF_GAIN(18), { 0x00000000, 0x00000130 } }, - { AR5K_RF_GAIN(19), { 0x00000000, 0x00000170 } }, - { AR5K_RF_GAIN(20), { 0x00000000, 0x000001b0 } }, - { AR5K_RF_GAIN(21), { 0x00000000, 0x000001f0 } }, - { AR5K_RF_GAIN(22), { 0x00000000, 0x00000030 } }, - { AR5K_RF_GAIN(23), { 0x00000000, 0x00000070 } }, - { AR5K_RF_GAIN(24), { 0x00000000, 0x000000b0 } }, - { AR5K_RF_GAIN(25), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(26), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(27), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(28), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(29), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(30), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(31), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(32), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(33), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(34), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(35), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(36), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(37), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(38), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(39), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(40), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(41), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(42), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(43), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(44), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(45), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(46), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(47), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(48), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(49), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(50), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(51), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(52), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(53), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(54), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(55), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(56), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(57), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(58), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(59), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(60), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(61), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(62), { 0x00000000, 0x000000f0 } }, - { AR5K_RF_GAIN(63), { 0x00000000, 0x000000f0 } }, -}; - - -/* Initial RF Gain settings for RF5413 */ -static const struct ath5k_ini_rfgain rfgain_5413[] = { - /* 5GHz 2GHz */ - { AR5K_RF_GAIN(0), { 0x00000000, 0x00000000 } }, - { AR5K_RF_GAIN(1), { 0x00000040, 0x00000040 } }, - { AR5K_RF_GAIN(2), { 0x00000080, 0x00000080 } }, - { AR5K_RF_GAIN(3), { 0x000001a1, 0x00000161 } }, - { AR5K_RF_GAIN(4), { 0x000001e1, 0x000001a1 } }, - { AR5K_RF_GAIN(5), { 0x00000021, 0x000001e1 } }, - { AR5K_RF_GAIN(6), { 0x00000061, 0x00000021 } }, - { AR5K_RF_GAIN(7), { 0x00000188, 0x00000061 } }, - { AR5K_RF_GAIN(8), { 0x000001c8, 0x00000188 } }, - { AR5K_RF_GAIN(9), { 0x00000008, 0x000001c8 } }, - { AR5K_RF_GAIN(10), { 0x00000048, 0x00000008 } }, - { AR5K_RF_GAIN(11), { 0x00000088, 0x00000048 } }, - { AR5K_RF_GAIN(12), { 0x000001a9, 0x00000088 } }, - { AR5K_RF_GAIN(13), { 0x000001e9, 0x00000169 } }, - { AR5K_RF_GAIN(14), { 0x00000029, 0x000001a9 } }, - { AR5K_RF_GAIN(15), { 0x00000069, 0x000001e9 } }, - { AR5K_RF_GAIN(16), { 0x000001d0, 0x00000029 } }, - { AR5K_RF_GAIN(17), { 0x00000010, 0x00000069 } }, - { AR5K_RF_GAIN(18), { 0x00000050, 0x00000190 } }, - { AR5K_RF_GAIN(19), { 0x00000090, 0x000001d0 } }, - { AR5K_RF_GAIN(20), { 0x000001b1, 0x00000010 } }, - { AR5K_RF_GAIN(21), { 0x000001f1, 0x00000050 } }, - { AR5K_RF_GAIN(22), { 0x00000031, 0x00000090 } }, - { AR5K_RF_GAIN(23), { 0x00000071, 0x00000171 } }, - { AR5K_RF_GAIN(24), { 0x000001b8, 0x000001b1 } }, - { AR5K_RF_GAIN(25), { 0x000001f8, 0x000001f1 } }, - { AR5K_RF_GAIN(26), { 0x00000038, 0x00000031 } }, - { AR5K_RF_GAIN(27), { 0x00000078, 0x00000071 } }, - { AR5K_RF_GAIN(28), { 0x00000199, 0x00000198 } }, - { AR5K_RF_GAIN(29), { 0x000001d9, 0x000001d8 } }, - { AR5K_RF_GAIN(30), { 0x00000019, 0x00000018 } }, - { AR5K_RF_GAIN(31), { 0x00000059, 0x00000058 } }, - { AR5K_RF_GAIN(32), { 0x00000099, 0x00000098 } }, - { AR5K_RF_GAIN(33), { 0x000000d9, 0x00000179 } }, - { AR5K_RF_GAIN(34), { 0x000000f9, 0x000001b9 } }, - { AR5K_RF_GAIN(35), { 0x000000f9, 0x000001f9 } }, - { AR5K_RF_GAIN(36), { 0x000000f9, 0x00000039 } }, - { AR5K_RF_GAIN(37), { 0x000000f9, 0x00000079 } }, - { AR5K_RF_GAIN(38), { 0x000000f9, 0x000000b9 } }, - { AR5K_RF_GAIN(39), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(40), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(41), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(42), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(43), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(44), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(45), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(46), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(47), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(48), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(49), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(50), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(51), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(52), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(53), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(54), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(55), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(56), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(57), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(58), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(59), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(60), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(61), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(62), { 0x000000f9, 0x000000f9 } }, - { AR5K_RF_GAIN(63), { 0x000000f9, 0x000000f9 } }, -}; - - -/* Initial RF Gain settings for RF2425 */ -static const struct ath5k_ini_rfgain rfgain_2425[] = { - { AR5K_RF_GAIN(0), { 0x00000000, 0x00000000 } }, - { AR5K_RF_GAIN(1), { 0x00000000, 0x00000040 } }, - { AR5K_RF_GAIN(2), { 0x00000000, 0x00000080 } }, - { AR5K_RF_GAIN(3), { 0x00000000, 0x00000181 } }, - { AR5K_RF_GAIN(4), { 0x00000000, 0x000001c1 } }, - { AR5K_RF_GAIN(5), { 0x00000000, 0x00000001 } }, - { AR5K_RF_GAIN(6), { 0x00000000, 0x00000041 } }, - { AR5K_RF_GAIN(7), { 0x00000000, 0x00000081 } }, - { AR5K_RF_GAIN(8), { 0x00000000, 0x00000188 } }, - { AR5K_RF_GAIN(9), { 0x00000000, 0x000001c8 } }, - { AR5K_RF_GAIN(10), { 0x00000000, 0x00000008 } }, - { AR5K_RF_GAIN(11), { 0x00000000, 0x00000048 } }, - { AR5K_RF_GAIN(12), { 0x00000000, 0x00000088 } }, - { AR5K_RF_GAIN(13), { 0x00000000, 0x00000189 } }, - { AR5K_RF_GAIN(14), { 0x00000000, 0x000001c9 } }, - { AR5K_RF_GAIN(15), { 0x00000000, 0x00000009 } }, - { AR5K_RF_GAIN(16), { 0x00000000, 0x00000049 } }, - { AR5K_RF_GAIN(17), { 0x00000000, 0x00000089 } }, - { AR5K_RF_GAIN(18), { 0x00000000, 0x000001b0 } }, - { AR5K_RF_GAIN(19), { 0x00000000, 0x000001f0 } }, - { AR5K_RF_GAIN(20), { 0x00000000, 0x00000030 } }, - { AR5K_RF_GAIN(21), { 0x00000000, 0x00000070 } }, - { AR5K_RF_GAIN(22), { 0x00000000, 0x00000171 } }, - { AR5K_RF_GAIN(23), { 0x00000000, 0x000001b1 } }, - { AR5K_RF_GAIN(24), { 0x00000000, 0x000001f1 } }, - { AR5K_RF_GAIN(25), { 0x00000000, 0x00000031 } }, - { AR5K_RF_GAIN(26), { 0x00000000, 0x00000071 } }, - { AR5K_RF_GAIN(27), { 0x00000000, 0x000001b8 } }, - { AR5K_RF_GAIN(28), { 0x00000000, 0x000001f8 } }, - { AR5K_RF_GAIN(29), { 0x00000000, 0x00000038 } }, - { AR5K_RF_GAIN(30), { 0x00000000, 0x00000078 } }, - { AR5K_RF_GAIN(31), { 0x00000000, 0x000000b8 } }, - { AR5K_RF_GAIN(32), { 0x00000000, 0x000001b9 } }, - { AR5K_RF_GAIN(33), { 0x00000000, 0x000001f9 } }, - { AR5K_RF_GAIN(34), { 0x00000000, 0x00000039 } }, - { AR5K_RF_GAIN(35), { 0x00000000, 0x00000079 } }, - { AR5K_RF_GAIN(36), { 0x00000000, 0x000000b9 } }, - { AR5K_RF_GAIN(37), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(38), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(39), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(40), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(41), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(42), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(43), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(44), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(45), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(46), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(47), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(48), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(49), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(50), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(51), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(52), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(53), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(54), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(55), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(56), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(57), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(58), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(59), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(60), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(61), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(62), { 0x00000000, 0x000000f9 } }, - { AR5K_RF_GAIN(63), { 0x00000000, 0x000000f9 } }, -}; - -#define AR5K_GAIN_CRN_FIX_BITS_5111 4 -#define AR5K_GAIN_CRN_FIX_BITS_5112 7 -#define AR5K_GAIN_CRN_MAX_FIX_BITS AR5K_GAIN_CRN_FIX_BITS_5112 -#define AR5K_GAIN_DYN_ADJUST_HI_MARGIN 15 -#define AR5K_GAIN_DYN_ADJUST_LO_MARGIN 20 -#define AR5K_GAIN_CCK_PROBE_CORR 5 -#define AR5K_GAIN_CCK_OFDM_GAIN_DELTA 15 -#define AR5K_GAIN_STEP_COUNT 10 - -/* Check if our current measurement is inside our - * current variable attenuation window */ -#define AR5K_GAIN_CHECK_ADJUST(_g) \ - ((_g)->g_current <= (_g)->g_low || (_g)->g_current >= (_g)->g_high) - -/** - * struct ath5k_gain_opt_step - An RF gain optimization step - * @gos_param: Set of parameters - * @gos_gain: Gain - */ -struct ath5k_gain_opt_step { - s8 gos_param[AR5K_GAIN_CRN_MAX_FIX_BITS]; - s8 gos_gain; -}; - -/** - * struct ath5k_gain_opt - RF Gain optimization ladder - * @go_default: The default step - * @go_steps_count: How many optimization steps - * @go_step: Array of &struct ath5k_gain_opt_step - */ -struct ath5k_gain_opt { - u8 go_default; - u8 go_steps_count; - const struct ath5k_gain_opt_step go_step[AR5K_GAIN_STEP_COUNT]; -}; - - -/* - * RF5111 - * Parameters on gos_param: - * 1) Tx clip PHY register - * 2) PWD 90 RF register - * 3) PWD 84 RF register - * 4) RFGainSel RF register - */ -static const struct ath5k_gain_opt rfgain_opt_5111 = { - 4, - 9, - { - { { 4, 1, 1, 1 }, 6 }, - { { 4, 0, 1, 1 }, 4 }, - { { 3, 1, 1, 1 }, 3 }, - { { 4, 0, 0, 1 }, 1 }, - { { 4, 1, 1, 0 }, 0 }, - { { 4, 0, 1, 0 }, -2 }, - { { 3, 1, 1, 0 }, -3 }, - { { 4, 0, 0, 0 }, -4 }, - { { 2, 1, 1, 0 }, -6 } - } -}; - -/* - * RF5112 - * Parameters on gos_param: - * 1) Mixgain ovr RF register - * 2) PWD 138 RF register - * 3) PWD 137 RF register - * 4) PWD 136 RF register - * 5) PWD 132 RF register - * 6) PWD 131 RF register - * 7) PWD 130 RF register - */ -static const struct ath5k_gain_opt rfgain_opt_5112 = { - 1, - 8, - { - { { 3, 0, 0, 0, 0, 0, 0 }, 6 }, - { { 2, 0, 0, 0, 0, 0, 0 }, 0 }, - { { 1, 0, 0, 0, 0, 0, 0 }, -3 }, - { { 0, 0, 0, 0, 0, 0, 0 }, -6 }, - { { 0, 1, 1, 0, 0, 0, 0 }, -8 }, - { { 0, 1, 1, 0, 1, 1, 0 }, -10 }, - { { 0, 1, 0, 1, 1, 1, 0 }, -13 }, - { { 0, 1, 0, 1, 1, 0, 1 }, -16 }, - } -}; - diff --git a/drivers/net/wireless/ath/ath5k/rfkill.c b/drivers/net/wireless/ath/ath5k/rfkill.c deleted file mode 100644 index 270a319f3aeb..000000000000 --- a/drivers/net/wireless/ath/ath5k/rfkill.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * RFKILL support for ath5k - * - * Copyright (c) 2009 Tobias Doerffel - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any - * redistribution must be conditioned upon including a substantially - * similar Disclaimer requirement for further binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGES. - */ - -#include "ath5k.h" - - -static inline void ath5k_rfkill_disable(struct ath5k_hw *ah) -{ - ATH5K_DBG(ah, ATH5K_DEBUG_ANY, "rfkill disable (gpio:%d polarity:%d)\n", - ah->rf_kill.gpio, ah->rf_kill.polarity); - ath5k_hw_set_gpio_output(ah, ah->rf_kill.gpio); - ath5k_hw_set_gpio(ah, ah->rf_kill.gpio, !ah->rf_kill.polarity); -} - - -static inline void ath5k_rfkill_enable(struct ath5k_hw *ah) -{ - ATH5K_DBG(ah, ATH5K_DEBUG_ANY, "rfkill enable (gpio:%d polarity:%d)\n", - ah->rf_kill.gpio, ah->rf_kill.polarity); - ath5k_hw_set_gpio_output(ah, ah->rf_kill.gpio); - ath5k_hw_set_gpio(ah, ah->rf_kill.gpio, ah->rf_kill.polarity); -} - -static inline void ath5k_rfkill_set_intr(struct ath5k_hw *ah, bool enable) -{ - u32 curval; - - ath5k_hw_set_gpio_input(ah, ah->rf_kill.gpio); - curval = ath5k_hw_get_gpio(ah, ah->rf_kill.gpio); - ath5k_hw_set_gpio_intr(ah, ah->rf_kill.gpio, enable ? - !!curval : !curval); -} - -static bool -ath5k_is_rfkill_set(struct ath5k_hw *ah) -{ - /* configuring GPIO for input for some reason disables rfkill */ - /*ath5k_hw_set_gpio_input(ah, ah->rf_kill.gpio);*/ - return ath5k_hw_get_gpio(ah, ah->rf_kill.gpio) == - ah->rf_kill.polarity; -} - -static void -ath5k_tasklet_rfkill_toggle(unsigned long data) -{ - struct ath5k_hw *ah = (void *)data; - bool blocked; - - blocked = ath5k_is_rfkill_set(ah); - wiphy_rfkill_set_hw_state(ah->hw->wiphy, blocked); -} - - -void -ath5k_rfkill_hw_start(struct ath5k_hw *ah) -{ - /* read rfkill GPIO configuration from EEPROM header */ - ah->rf_kill.gpio = ah->ah_capabilities.cap_eeprom.ee_rfkill_pin; - ah->rf_kill.polarity = ah->ah_capabilities.cap_eeprom.ee_rfkill_pol; - - tasklet_init(&ah->rf_kill.toggleq, ath5k_tasklet_rfkill_toggle, - (unsigned long)ah); - - ath5k_rfkill_disable(ah); - - /* enable interrupt for rfkill switch */ - if (AR5K_EEPROM_HDR_RFKILL(ah->ah_capabilities.cap_eeprom.ee_header)) - ath5k_rfkill_set_intr(ah, true); -} - - -void -ath5k_rfkill_hw_stop(struct ath5k_hw *ah) -{ - /* disable interrupt for rfkill switch */ - if (AR5K_EEPROM_HDR_RFKILL(ah->ah_capabilities.cap_eeprom.ee_header)) - ath5k_rfkill_set_intr(ah, false); - - tasklet_kill(&ah->rf_kill.toggleq); - - /* enable RFKILL when stopping HW so Wifi LED is turned off */ - ath5k_rfkill_enable(ah); -} - diff --git a/drivers/net/wireless/ath/ath5k/sysfs.c b/drivers/net/wireless/ath/ath5k/sysfs.c deleted file mode 100644 index 04cf0ca72610..000000000000 --- a/drivers/net/wireless/ath/ath5k/sysfs.c +++ /dev/null @@ -1,122 +0,0 @@ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include - -#include "ath5k.h" -#include "reg.h" - -#define SIMPLE_SHOW_STORE(name, get, set) \ -static ssize_t ath5k_attr_show_##name(struct device *dev, \ - struct device_attribute *attr, \ - char *buf) \ -{ \ - struct ieee80211_hw *hw = dev_get_drvdata(dev); \ - struct ath5k_hw *ah = hw->priv; \ - return snprintf(buf, PAGE_SIZE, "%d\n", get); \ -} \ - \ -static ssize_t ath5k_attr_store_##name(struct device *dev, \ - struct device_attribute *attr, \ - const char *buf, size_t count) \ -{ \ - struct ieee80211_hw *hw = dev_get_drvdata(dev); \ - struct ath5k_hw *ah = hw->priv; \ - int val, ret; \ - \ - ret = kstrtoint(buf, 10, &val); \ - if (ret < 0) \ - return ret; \ - set(ah, val); \ - return count; \ -} \ -static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, \ - ath5k_attr_show_##name, ath5k_attr_store_##name) - -#define SIMPLE_SHOW(name, get) \ -static ssize_t ath5k_attr_show_##name(struct device *dev, \ - struct device_attribute *attr, \ - char *buf) \ -{ \ - struct ieee80211_hw *hw = dev_get_drvdata(dev); \ - struct ath5k_hw *ah = hw->priv; \ - return snprintf(buf, PAGE_SIZE, "%d\n", get); \ -} \ -static DEVICE_ATTR(name, S_IRUGO, ath5k_attr_show_##name, NULL) - -/*** ANI ***/ - -SIMPLE_SHOW_STORE(ani_mode, ah->ani_state.ani_mode, ath5k_ani_init); -SIMPLE_SHOW_STORE(noise_immunity_level, ah->ani_state.noise_imm_level, - ath5k_ani_set_noise_immunity_level); -SIMPLE_SHOW_STORE(spur_level, ah->ani_state.spur_level, - ath5k_ani_set_spur_immunity_level); -SIMPLE_SHOW_STORE(firstep_level, ah->ani_state.firstep_level, - ath5k_ani_set_firstep_level); -SIMPLE_SHOW_STORE(ofdm_weak_signal_detection, ah->ani_state.ofdm_weak_sig, - ath5k_ani_set_ofdm_weak_signal_detection); -SIMPLE_SHOW_STORE(cck_weak_signal_detection, ah->ani_state.cck_weak_sig, - ath5k_ani_set_cck_weak_signal_detection); -SIMPLE_SHOW(spur_level_max, ah->ani_state.max_spur_level); - -static ssize_t ath5k_attr_show_noise_immunity_level_max(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return snprintf(buf, PAGE_SIZE, "%d\n", ATH5K_ANI_MAX_NOISE_IMM_LVL); -} -static DEVICE_ATTR(noise_immunity_level_max, S_IRUGO, - ath5k_attr_show_noise_immunity_level_max, NULL); - -static ssize_t ath5k_attr_show_firstep_level_max(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return snprintf(buf, PAGE_SIZE, "%d\n", ATH5K_ANI_MAX_FIRSTEP_LVL); -} -static DEVICE_ATTR(firstep_level_max, S_IRUGO, - ath5k_attr_show_firstep_level_max, NULL); - -static struct attribute *ath5k_sysfs_entries_ani[] = { - &dev_attr_ani_mode.attr, - &dev_attr_noise_immunity_level.attr, - &dev_attr_spur_level.attr, - &dev_attr_firstep_level.attr, - &dev_attr_ofdm_weak_signal_detection.attr, - &dev_attr_cck_weak_signal_detection.attr, - &dev_attr_noise_immunity_level_max.attr, - &dev_attr_spur_level_max.attr, - &dev_attr_firstep_level_max.attr, - NULL -}; - -static struct attribute_group ath5k_attribute_group_ani = { - .name = "ani", - .attrs = ath5k_sysfs_entries_ani, -}; - - -/*** register / unregister ***/ - -int -ath5k_sysfs_register(struct ath5k_hw *ah) -{ - struct device *dev = ah->dev; - int err; - - err = sysfs_create_group(&dev->kobj, &ath5k_attribute_group_ani); - if (err) { - ATH5K_ERR(ah, "failed to create sysfs group\n"); - return err; - } - - return 0; -} - -void -ath5k_sysfs_unregister(struct ath5k_hw *ah) -{ - struct device *dev = ah->dev; - - sysfs_remove_group(&dev->kobj, &ath5k_attribute_group_ani); -} diff --git a/drivers/net/wireless/ath/ath5k/trace.h b/drivers/net/wireless/ath/ath5k/trace.h deleted file mode 100644 index c6eef519bb61..000000000000 --- a/drivers/net/wireless/ath/ath5k/trace.h +++ /dev/null @@ -1,106 +0,0 @@ -#if !defined(__TRACE_ATH5K_H) || defined(TRACE_HEADER_MULTI_READ) -#define __TRACE_ATH5K_H - -#include - - -#if !defined(CONFIG_ATH5K_TRACER) || defined(__CHECKER__) -#undef TRACE_EVENT -#define TRACE_EVENT(name, proto, ...) \ -static inline void trace_ ## name(proto) {} -#endif - -struct sk_buff; -struct ath5k_txq; -struct ath5k_tx_status; - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM ath5k - -TRACE_EVENT(ath5k_rx, - TP_PROTO(struct ath5k_hw *priv, struct sk_buff *skb), - TP_ARGS(priv, skb), - TP_STRUCT__entry( - __field(struct ath5k_hw *, priv) - __field(unsigned long, skbaddr) - __dynamic_array(u8, frame, skb->len) - ), - TP_fast_assign( - __entry->priv = priv; - __entry->skbaddr = (unsigned long) skb; - memcpy(__get_dynamic_array(frame), skb->data, skb->len); - ), - TP_printk( - "[%p] RX skb=%lx", __entry->priv, __entry->skbaddr - ) -); - -TRACE_EVENT(ath5k_tx, - TP_PROTO(struct ath5k_hw *priv, struct sk_buff *skb, - struct ath5k_txq *q), - - TP_ARGS(priv, skb, q), - - TP_STRUCT__entry( - __field(struct ath5k_hw *, priv) - __field(unsigned long, skbaddr) - __field(u8, qnum) - __dynamic_array(u8, frame, skb->len) - ), - - TP_fast_assign( - __entry->priv = priv; - __entry->skbaddr = (unsigned long) skb; - __entry->qnum = (u8) q->qnum; - memcpy(__get_dynamic_array(frame), skb->data, skb->len); - ), - - TP_printk( - "[%p] TX skb=%lx q=%d", __entry->priv, __entry->skbaddr, - __entry->qnum - ) -); - -TRACE_EVENT(ath5k_tx_complete, - TP_PROTO(struct ath5k_hw *priv, struct sk_buff *skb, - struct ath5k_txq *q, struct ath5k_tx_status *ts), - - TP_ARGS(priv, skb, q, ts), - - TP_STRUCT__entry( - __field(struct ath5k_hw *, priv) - __field(unsigned long, skbaddr) - __field(u8, qnum) - __field(u8, ts_status) - __field(s8, ts_rssi) - __field(u8, ts_antenna) - ), - - TP_fast_assign( - __entry->priv = priv; - __entry->skbaddr = (unsigned long) skb; - __entry->qnum = (u8) q->qnum; - __entry->ts_status = ts->ts_status; - __entry->ts_rssi = ts->ts_rssi; - __entry->ts_antenna = ts->ts_antenna; - ), - - TP_printk( - "[%p] TX end skb=%lx q=%d stat=%x rssi=%d ant=%x", - __entry->priv, __entry->skbaddr, __entry->qnum, - __entry->ts_status, __entry->ts_rssi, __entry->ts_antenna - ) -); - -#endif /* __TRACE_ATH5K_H */ - -#if defined(CONFIG_ATH5K_TRACER) && !defined(__CHECKER__) - -#undef TRACE_INCLUDE_PATH -#define TRACE_INCLUDE_PATH . -#undef TRACE_INCLUDE_FILE -#define TRACE_INCLUDE_FILE trace - -#include - -#endif diff --git a/drivers/net/wireless/ath/ath6kl/Kconfig b/drivers/net/wireless/ath/ath6kl/Kconfig deleted file mode 100644 index e39e5860a2e9..000000000000 --- a/drivers/net/wireless/ath/ath6kl/Kconfig +++ /dev/null @@ -1,49 +0,0 @@ -config ATH6KL - tristate "Atheros mobile chipsets support" - -config ATH6KL_SDIO - tristate "Atheros ath6kl SDIO support" - depends on ATH6KL - depends on MMC - depends on CFG80211 - ---help--- - This module adds support for wireless adapters based on - Atheros AR6003 and AR6004 chipsets running over SDIO. If you - choose to build it as a module, it will be called ath6kl_sdio. - Please note that AR6002 and AR6001 are not supported by this - driver. - -config ATH6KL_USB - tristate "Atheros ath6kl USB support" - depends on ATH6KL - depends on USB - depends on CFG80211 - ---help--- - This module adds support for wireless adapters based on - Atheros AR6004 chipset running over USB. This is still under - implementation and it isn't functional. If you choose to - build it as a module, it will be called ath6kl_usb. - -config ATH6KL_DEBUG - bool "Atheros ath6kl debugging" - depends on ATH6KL - ---help--- - Enables debug support - -config ATH6KL_TRACING - bool "Atheros ath6kl tracing support" - depends on ATH6KL - depends on EVENT_TRACING - ---help--- - Select this to ath6kl use tracing infrastructure. - - If unsure, say Y to make it easier to debug problems. - -config ATH6KL_REGDOMAIN - bool "Atheros ath6kl regdomain support" - depends on ATH6KL - depends on CFG80211_CERTIFICATION_ONUS - ---help--- - Enabling this makes it possible to change the regdomain in - the firmware. This can be only enabled if regulatory requirements - are taken into account. diff --git a/drivers/net/wireless/ath/ath6kl/Makefile b/drivers/net/wireless/ath/ath6kl/Makefile deleted file mode 100644 index dc2b3b46781e..000000000000 --- a/drivers/net/wireless/ath/ath6kl/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -#------------------------------------------------------------------------------ -# Copyright (c) 2004-2011 Atheros Communications Inc. -# Copyright (c) 2011-2012 Qualcomm Atheros, Inc. -# All rights reserved. -# -# -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# -# -# Author(s): ="Atheros" -#------------------------------------------------------------------------------ - -obj-$(CONFIG_ATH6KL) += ath6kl_core.o -ath6kl_core-y += debug.o -ath6kl_core-y += hif.o -ath6kl_core-y += htc_mbox.o -ath6kl_core-y += htc_pipe.o -ath6kl_core-y += bmi.o -ath6kl_core-y += cfg80211.o -ath6kl_core-y += init.o -ath6kl_core-y += main.o -ath6kl_core-y += txrx.o -ath6kl_core-y += wmi.o -ath6kl_core-y += core.o -ath6kl_core-y += recovery.o - -ath6kl_core-$(CONFIG_NL80211_TESTMODE) += testmode.o -ath6kl_core-$(CONFIG_ATH6KL_TRACING) += trace.o - -obj-$(CONFIG_ATH6KL_SDIO) += ath6kl_sdio.o -ath6kl_sdio-y += sdio.o - -obj-$(CONFIG_ATH6KL_USB) += ath6kl_usb.o -ath6kl_usb-y += usb.o - -# for tracing framework to find trace.h -CFLAGS_trace.o := -I$(src) diff --git a/drivers/net/wireless/ath/ath6kl/bmi.c b/drivers/net/wireless/ath/ath6kl/bmi.c deleted file mode 100644 index 334dbd834b3a..000000000000 --- a/drivers/net/wireless/ath/ath6kl/bmi.c +++ /dev/null @@ -1,548 +0,0 @@ -/* - * Copyright (c) 2004-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "core.h" -#include "hif-ops.h" -#include "target.h" -#include "debug.h" - -int ath6kl_bmi_done(struct ath6kl *ar) -{ - int ret; - u32 cid = BMI_DONE; - - if (ar->bmi.done_sent) { - ath6kl_dbg(ATH6KL_DBG_BMI, "bmi done skipped\n"); - return 0; - } - - ar->bmi.done_sent = true; - - ret = ath6kl_hif_bmi_write(ar, (u8 *)&cid, sizeof(cid)); - if (ret) { - ath6kl_err("Unable to send bmi done: %d\n", ret); - return ret; - } - - return 0; -} - -int ath6kl_bmi_get_target_info(struct ath6kl *ar, - struct ath6kl_bmi_target_info *targ_info) -{ - int ret; - u32 cid = BMI_GET_TARGET_INFO; - - if (ar->bmi.done_sent) { - ath6kl_err("bmi done sent already, cmd %d disallowed\n", cid); - return -EACCES; - } - - ret = ath6kl_hif_bmi_write(ar, (u8 *)&cid, sizeof(cid)); - if (ret) { - ath6kl_err("Unable to send get target info: %d\n", ret); - return ret; - } - - if (ar->hif_type == ATH6KL_HIF_TYPE_USB) { - ret = ath6kl_hif_bmi_read(ar, (u8 *)targ_info, - sizeof(*targ_info)); - } else { - ret = ath6kl_hif_bmi_read(ar, (u8 *)&targ_info->version, - sizeof(targ_info->version)); - } - - if (ret) { - ath6kl_err("Unable to recv target info: %d\n", ret); - return ret; - } - - if (le32_to_cpu(targ_info->version) == TARGET_VERSION_SENTINAL) { - /* Determine how many bytes are in the Target's targ_info */ - ret = ath6kl_hif_bmi_read(ar, - (u8 *)&targ_info->byte_count, - sizeof(targ_info->byte_count)); - if (ret) { - ath6kl_err("unable to read target info byte count: %d\n", - ret); - return ret; - } - - /* - * The target's targ_info doesn't match the host's targ_info. - * We need to do some backwards compatibility to make this work. - */ - if (le32_to_cpu(targ_info->byte_count) != sizeof(*targ_info)) { - WARN_ON(1); - return -EINVAL; - } - - /* Read the remainder of the targ_info */ - ret = ath6kl_hif_bmi_read(ar, - ((u8 *)targ_info) + - sizeof(targ_info->byte_count), - sizeof(*targ_info) - - sizeof(targ_info->byte_count)); - - if (ret) { - ath6kl_err("Unable to read target info (%d bytes): %d\n", - targ_info->byte_count, ret); - return ret; - } - } - - ath6kl_dbg(ATH6KL_DBG_BMI, "target info (ver: 0x%x type: 0x%x)\n", - targ_info->version, targ_info->type); - - return 0; -} - -int ath6kl_bmi_read(struct ath6kl *ar, u32 addr, u8 *buf, u32 len) -{ - u32 cid = BMI_READ_MEMORY; - int ret; - u32 offset; - u32 len_remain, rx_len; - u16 size; - - if (ar->bmi.done_sent) { - ath6kl_err("bmi done sent already, cmd %d disallowed\n", cid); - return -EACCES; - } - - size = ar->bmi.max_data_size + sizeof(cid) + sizeof(addr) + sizeof(len); - if (size > ar->bmi.max_cmd_size) { - WARN_ON(1); - return -EINVAL; - } - memset(ar->bmi.cmd_buf, 0, size); - - ath6kl_dbg(ATH6KL_DBG_BMI, - "bmi read memory: device: addr: 0x%x, len: %d\n", - addr, len); - - len_remain = len; - - while (len_remain) { - rx_len = (len_remain < ar->bmi.max_data_size) ? - len_remain : ar->bmi.max_data_size; - offset = 0; - memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); - offset += sizeof(addr); - memcpy(&(ar->bmi.cmd_buf[offset]), &rx_len, sizeof(rx_len)); - offset += sizeof(len); - - ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); - if (ret) { - ath6kl_err("Unable to write to the device: %d\n", - ret); - return ret; - } - ret = ath6kl_hif_bmi_read(ar, ar->bmi.cmd_buf, rx_len); - if (ret) { - ath6kl_err("Unable to read from the device: %d\n", - ret); - return ret; - } - memcpy(&buf[len - len_remain], ar->bmi.cmd_buf, rx_len); - len_remain -= rx_len; addr += rx_len; - } - - return 0; -} - -int ath6kl_bmi_write(struct ath6kl *ar, u32 addr, u8 *buf, u32 len) -{ - u32 cid = BMI_WRITE_MEMORY; - int ret; - u32 offset; - u32 len_remain, tx_len; - const u32 header = sizeof(cid) + sizeof(addr) + sizeof(len); - u8 aligned_buf[400]; - u8 *src; - - if (ar->bmi.done_sent) { - ath6kl_err("bmi done sent already, cmd %d disallowed\n", cid); - return -EACCES; - } - - if ((ar->bmi.max_data_size + header) > ar->bmi.max_cmd_size) { - WARN_ON(1); - return -EINVAL; - } - - if (WARN_ON(ar->bmi.max_data_size > sizeof(aligned_buf))) - return -E2BIG; - - memset(ar->bmi.cmd_buf, 0, ar->bmi.max_data_size + header); - - ath6kl_dbg(ATH6KL_DBG_BMI, - "bmi write memory: addr: 0x%x, len: %d\n", addr, len); - - len_remain = len; - while (len_remain) { - src = &buf[len - len_remain]; - - if (len_remain < (ar->bmi.max_data_size - header)) { - if (len_remain & 3) { - /* align it with 4 bytes */ - len_remain = len_remain + - (4 - (len_remain & 3)); - memcpy(aligned_buf, src, len_remain); - src = aligned_buf; - } - tx_len = len_remain; - } else { - tx_len = (ar->bmi.max_data_size - header); - } - - offset = 0; - memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); - offset += sizeof(addr); - memcpy(&(ar->bmi.cmd_buf[offset]), &tx_len, sizeof(tx_len)); - offset += sizeof(tx_len); - memcpy(&(ar->bmi.cmd_buf[offset]), src, tx_len); - offset += tx_len; - - ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); - if (ret) { - ath6kl_err("Unable to write to the device: %d\n", - ret); - return ret; - } - len_remain -= tx_len; addr += tx_len; - } - - return 0; -} - -int ath6kl_bmi_execute(struct ath6kl *ar, u32 addr, u32 *param) -{ - u32 cid = BMI_EXECUTE; - int ret; - u32 offset; - u16 size; - - if (ar->bmi.done_sent) { - ath6kl_err("bmi done sent already, cmd %d disallowed\n", cid); - return -EACCES; - } - - size = sizeof(cid) + sizeof(addr) + sizeof(param); - if (size > ar->bmi.max_cmd_size) { - WARN_ON(1); - return -EINVAL; - } - memset(ar->bmi.cmd_buf, 0, size); - - ath6kl_dbg(ATH6KL_DBG_BMI, "bmi execute: addr: 0x%x, param: %d)\n", - addr, *param); - - offset = 0; - memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); - offset += sizeof(addr); - memcpy(&(ar->bmi.cmd_buf[offset]), param, sizeof(*param)); - offset += sizeof(*param); - - ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); - if (ret) { - ath6kl_err("Unable to write to the device: %d\n", ret); - return ret; - } - - ret = ath6kl_hif_bmi_read(ar, ar->bmi.cmd_buf, sizeof(*param)); - if (ret) { - ath6kl_err("Unable to read from the device: %d\n", ret); - return ret; - } - - memcpy(param, ar->bmi.cmd_buf, sizeof(*param)); - - return 0; -} - -int ath6kl_bmi_set_app_start(struct ath6kl *ar, u32 addr) -{ - u32 cid = BMI_SET_APP_START; - int ret; - u32 offset; - u16 size; - - if (ar->bmi.done_sent) { - ath6kl_err("bmi done sent already, cmd %d disallowed\n", cid); - return -EACCES; - } - - size = sizeof(cid) + sizeof(addr); - if (size > ar->bmi.max_cmd_size) { - WARN_ON(1); - return -EINVAL; - } - memset(ar->bmi.cmd_buf, 0, size); - - ath6kl_dbg(ATH6KL_DBG_BMI, "bmi set app start: addr: 0x%x\n", addr); - - offset = 0; - memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); - offset += sizeof(addr); - - ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); - if (ret) { - ath6kl_err("Unable to write to the device: %d\n", ret); - return ret; - } - - return 0; -} - -int ath6kl_bmi_reg_read(struct ath6kl *ar, u32 addr, u32 *param) -{ - u32 cid = BMI_READ_SOC_REGISTER; - int ret; - u32 offset; - u16 size; - - if (ar->bmi.done_sent) { - ath6kl_err("bmi done sent already, cmd %d disallowed\n", cid); - return -EACCES; - } - - size = sizeof(cid) + sizeof(addr); - if (size > ar->bmi.max_cmd_size) { - WARN_ON(1); - return -EINVAL; - } - memset(ar->bmi.cmd_buf, 0, size); - - ath6kl_dbg(ATH6KL_DBG_BMI, "bmi read SOC reg: addr: 0x%x\n", addr); - - offset = 0; - memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); - offset += sizeof(addr); - - ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); - if (ret) { - ath6kl_err("Unable to write to the device: %d\n", ret); - return ret; - } - - ret = ath6kl_hif_bmi_read(ar, ar->bmi.cmd_buf, sizeof(*param)); - if (ret) { - ath6kl_err("Unable to read from the device: %d\n", ret); - return ret; - } - memcpy(param, ar->bmi.cmd_buf, sizeof(*param)); - - return 0; -} - -int ath6kl_bmi_reg_write(struct ath6kl *ar, u32 addr, u32 param) -{ - u32 cid = BMI_WRITE_SOC_REGISTER; - int ret; - u32 offset; - u16 size; - - if (ar->bmi.done_sent) { - ath6kl_err("bmi done sent already, cmd %d disallowed\n", cid); - return -EACCES; - } - - size = sizeof(cid) + sizeof(addr) + sizeof(param); - if (size > ar->bmi.max_cmd_size) { - WARN_ON(1); - return -EINVAL; - } - memset(ar->bmi.cmd_buf, 0, size); - - ath6kl_dbg(ATH6KL_DBG_BMI, - "bmi write SOC reg: addr: 0x%x, param: %d\n", - addr, param); - - offset = 0; - memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); - offset += sizeof(addr); - memcpy(&(ar->bmi.cmd_buf[offset]), ¶m, sizeof(param)); - offset += sizeof(param); - - ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); - if (ret) { - ath6kl_err("Unable to write to the device: %d\n", ret); - return ret; - } - - return 0; -} - -int ath6kl_bmi_lz_data(struct ath6kl *ar, u8 *buf, u32 len) -{ - u32 cid = BMI_LZ_DATA; - int ret; - u32 offset; - u32 len_remain, tx_len; - const u32 header = sizeof(cid) + sizeof(len); - u16 size; - - if (ar->bmi.done_sent) { - ath6kl_err("bmi done sent already, cmd %d disallowed\n", cid); - return -EACCES; - } - - size = ar->bmi.max_data_size + header; - if (size > ar->bmi.max_cmd_size) { - WARN_ON(1); - return -EINVAL; - } - memset(ar->bmi.cmd_buf, 0, size); - - ath6kl_dbg(ATH6KL_DBG_BMI, "bmi send LZ data: len: %d)\n", - len); - - len_remain = len; - while (len_remain) { - tx_len = (len_remain < (ar->bmi.max_data_size - header)) ? - len_remain : (ar->bmi.max_data_size - header); - - offset = 0; - memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - memcpy(&(ar->bmi.cmd_buf[offset]), &tx_len, sizeof(tx_len)); - offset += sizeof(tx_len); - memcpy(&(ar->bmi.cmd_buf[offset]), &buf[len - len_remain], - tx_len); - offset += tx_len; - - ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); - if (ret) { - ath6kl_err("Unable to write to the device: %d\n", - ret); - return ret; - } - - len_remain -= tx_len; - } - - return 0; -} - -int ath6kl_bmi_lz_stream_start(struct ath6kl *ar, u32 addr) -{ - u32 cid = BMI_LZ_STREAM_START; - int ret; - u32 offset; - u16 size; - - if (ar->bmi.done_sent) { - ath6kl_err("bmi done sent already, cmd %d disallowed\n", cid); - return -EACCES; - } - - size = sizeof(cid) + sizeof(addr); - if (size > ar->bmi.max_cmd_size) { - WARN_ON(1); - return -EINVAL; - } - memset(ar->bmi.cmd_buf, 0, size); - - ath6kl_dbg(ATH6KL_DBG_BMI, - "bmi LZ stream start: addr: 0x%x)\n", - addr); - - offset = 0; - memcpy(&(ar->bmi.cmd_buf[offset]), &cid, sizeof(cid)); - offset += sizeof(cid); - memcpy(&(ar->bmi.cmd_buf[offset]), &addr, sizeof(addr)); - offset += sizeof(addr); - - ret = ath6kl_hif_bmi_write(ar, ar->bmi.cmd_buf, offset); - if (ret) { - ath6kl_err("Unable to start LZ stream to the device: %d\n", - ret); - return ret; - } - - return 0; -} - -int ath6kl_bmi_fast_download(struct ath6kl *ar, u32 addr, u8 *buf, u32 len) -{ - int ret; - u32 last_word = 0; - u32 last_word_offset = len & ~0x3; - u32 unaligned_bytes = len & 0x3; - - ret = ath6kl_bmi_lz_stream_start(ar, addr); - if (ret) - return ret; - - if (unaligned_bytes) { - /* copy the last word into a zero padded buffer */ - memcpy(&last_word, &buf[last_word_offset], unaligned_bytes); - } - - ret = ath6kl_bmi_lz_data(ar, buf, last_word_offset); - if (ret) - return ret; - - if (unaligned_bytes) - ret = ath6kl_bmi_lz_data(ar, (u8 *)&last_word, 4); - - if (!ret) { - /* Close compressed stream and open a new (fake) one. - * This serves mainly to flush Target caches. */ - ret = ath6kl_bmi_lz_stream_start(ar, 0x00); - } - return ret; -} - -void ath6kl_bmi_reset(struct ath6kl *ar) -{ - ar->bmi.done_sent = false; -} - -int ath6kl_bmi_init(struct ath6kl *ar) -{ - if (WARN_ON(ar->bmi.max_data_size == 0)) - return -EINVAL; - - /* cmd + addr + len + data_size */ - ar->bmi.max_cmd_size = ar->bmi.max_data_size + (sizeof(u32) * 3); - - ar->bmi.cmd_buf = kzalloc(ar->bmi.max_cmd_size, GFP_ATOMIC); - if (!ar->bmi.cmd_buf) - return -ENOMEM; - - return 0; -} - -void ath6kl_bmi_cleanup(struct ath6kl *ar) -{ - kfree(ar->bmi.cmd_buf); - ar->bmi.cmd_buf = NULL; -} diff --git a/drivers/net/wireless/ath/ath6kl/bmi.h b/drivers/net/wireless/ath/ath6kl/bmi.h deleted file mode 100644 index 18fdd69e1f71..000000000000 --- a/drivers/net/wireless/ath/ath6kl/bmi.h +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (c) 2004-2011 Atheros Communications Inc. - * Copyright (c) 2011 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef BMI_H -#define BMI_H - -/* - * Bootloader Messaging Interface (BMI) - * - * BMI is a very simple messaging interface used during initialization - * to read memory, write memory, execute code, and to define an - * application entry PC. - * - * It is used to download an application to ATH6KL, to provide - * patches to code that is already resident on ATH6KL, and generally - * to examine and modify state. The Host has an opportunity to use - * BMI only once during bootup. Once the Host issues a BMI_DONE - * command, this opportunity ends. - * - * The Host writes BMI requests to mailbox0, and reads BMI responses - * from mailbox0. BMI requests all begin with a command - * (see below for specific commands), and are followed by - * command-specific data. - * - * Flow control: - * The Host can only issue a command once the Target gives it a - * "BMI Command Credit", using ATH6KL Counter #4. As soon as the - * Target has completed a command, it issues another BMI Command - * Credit (so the Host can issue the next command). - * - * BMI handles all required Target-side cache flushing. - */ - -/* BMI Commands */ - -#define BMI_NO_COMMAND 0 - -#define BMI_DONE 1 -/* - * Semantics: Host is done using BMI - * Request format: - * u32 command (BMI_DONE) - * Response format: none - */ - -#define BMI_READ_MEMORY 2 -/* - * Semantics: Host reads ATH6KL memory - * Request format: - * u32 command (BMI_READ_MEMORY) - * u32 address - * u32 length, at most BMI_DATASZ_MAX - * Response format: - * u8 data[length] - */ - -#define BMI_WRITE_MEMORY 3 -/* - * Semantics: Host writes ATH6KL memory - * Request format: - * u32 command (BMI_WRITE_MEMORY) - * u32 address - * u32 length, at most BMI_DATASZ_MAX - * u8 data[length] - * Response format: none - */ - -#define BMI_EXECUTE 4 -/* - * Semantics: Causes ATH6KL to execute code - * Request format: - * u32 command (BMI_EXECUTE) - * u32 address - * u32 parameter - * Response format: - * u32 return value - */ - -#define BMI_SET_APP_START 5 -/* - * Semantics: Set Target application starting address - * Request format: - * u32 command (BMI_SET_APP_START) - * u32 address - * Response format: none - */ - -#define BMI_READ_SOC_REGISTER 6 -/* - * Semantics: Read a 32-bit Target SOC register. - * Request format: - * u32 command (BMI_READ_REGISTER) - * u32 address - * Response format: - * u32 value - */ - -#define BMI_WRITE_SOC_REGISTER 7 -/* - * Semantics: Write a 32-bit Target SOC register. - * Request format: - * u32 command (BMI_WRITE_REGISTER) - * u32 address - * u32 value - * - * Response format: none - */ - -#define BMI_GET_TARGET_ID 8 -#define BMI_GET_TARGET_INFO 8 -/* - * Semantics: Fetch the 4-byte Target information - * Request format: - * u32 command (BMI_GET_TARGET_ID/INFO) - * Response format1 (old firmware): - * u32 TargetVersionID - * Response format2 (newer firmware): - * u32 TARGET_VERSION_SENTINAL - * struct bmi_target_info; - */ - -#define TARGET_VERSION_SENTINAL 0xffffffff -#define TARGET_TYPE_AR6003 3 -#define TARGET_TYPE_AR6004 5 -#define BMI_ROMPATCH_INSTALL 9 -/* - * Semantics: Install a ROM Patch. - * Request format: - * u32 command (BMI_ROMPATCH_INSTALL) - * u32 Target ROM Address - * u32 Target RAM Address or Value (depending on Target Type) - * u32 Size, in bytes - * u32 Activate? 1-->activate; - * 0-->install but do not activate - * Response format: - * u32 PatchID - */ - -#define BMI_ROMPATCH_UNINSTALL 10 -/* - * Semantics: Uninstall a previously-installed ROM Patch, - * automatically deactivating, if necessary. - * Request format: - * u32 command (BMI_ROMPATCH_UNINSTALL) - * u32 PatchID - * - * Response format: none - */ - -#define BMI_ROMPATCH_ACTIVATE 11 -/* - * Semantics: Activate a list of previously-installed ROM Patches. - * Request format: - * u32 command (BMI_ROMPATCH_ACTIVATE) - * u32 rompatch_count - * u32 PatchID[rompatch_count] - * - * Response format: none - */ - -#define BMI_ROMPATCH_DEACTIVATE 12 -/* - * Semantics: Deactivate a list of active ROM Patches. - * Request format: - * u32 command (BMI_ROMPATCH_DEACTIVATE) - * u32 rompatch_count - * u32 PatchID[rompatch_count] - * - * Response format: none - */ - - -#define BMI_LZ_STREAM_START 13 -/* - * Semantics: Begin an LZ-compressed stream of input - * which is to be uncompressed by the Target to an - * output buffer at address. The output buffer must - * be sufficiently large to hold the uncompressed - * output from the compressed input stream. This BMI - * command should be followed by a series of 1 or more - * BMI_LZ_DATA commands. - * u32 command (BMI_LZ_STREAM_START) - * u32 address - * Note: Not supported on all versions of ROM firmware. - */ - -#define BMI_LZ_DATA 14 -/* - * Semantics: Host writes ATH6KL memory with LZ-compressed - * data which is uncompressed by the Target. This command - * must be preceded by a BMI_LZ_STREAM_START command. A series - * of BMI_LZ_DATA commands are considered part of a single - * input stream until another BMI_LZ_STREAM_START is issued. - * Request format: - * u32 command (BMI_LZ_DATA) - * u32 length (of compressed data), - * at most BMI_DATASZ_MAX - * u8 CompressedData[length] - * Response format: none - * Note: Not supported on all versions of ROM firmware. - */ - -#define BMI_COMMUNICATION_TIMEOUT 1000 /* in msec */ - -struct ath6kl; -struct ath6kl_bmi_target_info { - __le32 byte_count; /* size of this structure */ - __le32 version; /* target version id */ - __le32 type; /* target type */ -} __packed; - -#define ath6kl_bmi_write_hi32(ar, item, val) \ - ({ \ - u32 addr; \ - __le32 v; \ - \ - addr = ath6kl_get_hi_item_addr(ar, HI_ITEM(item)); \ - v = cpu_to_le32(val); \ - ath6kl_bmi_write(ar, addr, (u8 *) &v, sizeof(v)); \ - }) - -#define ath6kl_bmi_read_hi32(ar, item, val) \ - ({ \ - u32 addr, *check_type = val; \ - __le32 tmp; \ - int ret; \ - \ - (void) (check_type == val); \ - addr = ath6kl_get_hi_item_addr(ar, HI_ITEM(item)); \ - ret = ath6kl_bmi_read(ar, addr, (u8 *) &tmp, 4); \ - *val = le32_to_cpu(tmp); \ - ret; \ - }) - -int ath6kl_bmi_init(struct ath6kl *ar); -void ath6kl_bmi_cleanup(struct ath6kl *ar); -void ath6kl_bmi_reset(struct ath6kl *ar); - -int ath6kl_bmi_done(struct ath6kl *ar); -int ath6kl_bmi_get_target_info(struct ath6kl *ar, - struct ath6kl_bmi_target_info *targ_info); -int ath6kl_bmi_read(struct ath6kl *ar, u32 addr, u8 *buf, u32 len); -int ath6kl_bmi_write(struct ath6kl *ar, u32 addr, u8 *buf, u32 len); -int ath6kl_bmi_execute(struct ath6kl *ar, - u32 addr, u32 *param); -int ath6kl_bmi_set_app_start(struct ath6kl *ar, - u32 addr); -int ath6kl_bmi_reg_read(struct ath6kl *ar, u32 addr, u32 *param); -int ath6kl_bmi_reg_write(struct ath6kl *ar, u32 addr, u32 param); -int ath6kl_bmi_lz_data(struct ath6kl *ar, - u8 *buf, u32 len); -int ath6kl_bmi_lz_stream_start(struct ath6kl *ar, - u32 addr); -int ath6kl_bmi_fast_download(struct ath6kl *ar, - u32 addr, u8 *buf, u32 len); -#endif diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c deleted file mode 100644 index 5c9736a94e54..000000000000 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ /dev/null @@ -1,3852 +0,0 @@ -/* - * Copyright (c) 2004-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include - -#include "core.h" -#include "cfg80211.h" -#include "debug.h" -#include "hif-ops.h" -#include "testmode.h" - -#define RATETAB_ENT(_rate, _rateid, _flags) { \ - .bitrate = (_rate), \ - .flags = (_flags), \ - .hw_value = (_rateid), \ -} - -#define CHAN2G(_channel, _freq, _flags) { \ - .band = IEEE80211_BAND_2GHZ, \ - .hw_value = (_channel), \ - .center_freq = (_freq), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -#define CHAN5G(_channel, _flags) { \ - .band = IEEE80211_BAND_5GHZ, \ - .hw_value = (_channel), \ - .center_freq = 5000 + (5 * (_channel)), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -#define DEFAULT_BG_SCAN_PERIOD 60 - -struct ath6kl_cfg80211_match_probe_ssid { - struct cfg80211_ssid ssid; - u8 flag; -}; - -static struct ieee80211_rate ath6kl_rates[] = { - RATETAB_ENT(10, 0x1, 0), - RATETAB_ENT(20, 0x2, 0), - RATETAB_ENT(55, 0x4, 0), - RATETAB_ENT(110, 0x8, 0), - RATETAB_ENT(60, 0x10, 0), - RATETAB_ENT(90, 0x20, 0), - RATETAB_ENT(120, 0x40, 0), - RATETAB_ENT(180, 0x80, 0), - RATETAB_ENT(240, 0x100, 0), - RATETAB_ENT(360, 0x200, 0), - RATETAB_ENT(480, 0x400, 0), - RATETAB_ENT(540, 0x800, 0), -}; - -#define ath6kl_a_rates (ath6kl_rates + 4) -#define ath6kl_a_rates_size 8 -#define ath6kl_g_rates (ath6kl_rates + 0) -#define ath6kl_g_rates_size 12 - -#define ath6kl_g_htcap IEEE80211_HT_CAP_SGI_20 -#define ath6kl_a_htcap (IEEE80211_HT_CAP_SUP_WIDTH_20_40 | \ - IEEE80211_HT_CAP_SGI_20 | \ - IEEE80211_HT_CAP_SGI_40) - -static struct ieee80211_channel ath6kl_2ghz_channels[] = { - CHAN2G(1, 2412, 0), - CHAN2G(2, 2417, 0), - CHAN2G(3, 2422, 0), - CHAN2G(4, 2427, 0), - CHAN2G(5, 2432, 0), - CHAN2G(6, 2437, 0), - CHAN2G(7, 2442, 0), - CHAN2G(8, 2447, 0), - CHAN2G(9, 2452, 0), - CHAN2G(10, 2457, 0), - CHAN2G(11, 2462, 0), - CHAN2G(12, 2467, 0), - CHAN2G(13, 2472, 0), - CHAN2G(14, 2484, 0), -}; - -static struct ieee80211_channel ath6kl_5ghz_a_channels[] = { - CHAN5G(34, 0), CHAN5G(36, 0), - CHAN5G(38, 0), CHAN5G(40, 0), - CHAN5G(42, 0), CHAN5G(44, 0), - CHAN5G(46, 0), CHAN5G(48, 0), - CHAN5G(52, 0), CHAN5G(56, 0), - CHAN5G(60, 0), CHAN5G(64, 0), - CHAN5G(100, 0), CHAN5G(104, 0), - CHAN5G(108, 0), CHAN5G(112, 0), - CHAN5G(116, 0), CHAN5G(120, 0), - CHAN5G(124, 0), CHAN5G(128, 0), - CHAN5G(132, 0), CHAN5G(136, 0), - CHAN5G(140, 0), CHAN5G(149, 0), - CHAN5G(153, 0), CHAN5G(157, 0), - CHAN5G(161, 0), CHAN5G(165, 0), - CHAN5G(184, 0), CHAN5G(188, 0), - CHAN5G(192, 0), CHAN5G(196, 0), - CHAN5G(200, 0), CHAN5G(204, 0), - CHAN5G(208, 0), CHAN5G(212, 0), - CHAN5G(216, 0), -}; - -static struct ieee80211_supported_band ath6kl_band_2ghz = { - .n_channels = ARRAY_SIZE(ath6kl_2ghz_channels), - .channels = ath6kl_2ghz_channels, - .n_bitrates = ath6kl_g_rates_size, - .bitrates = ath6kl_g_rates, - .ht_cap.cap = ath6kl_g_htcap, - .ht_cap.ht_supported = true, -}; - -static struct ieee80211_supported_band ath6kl_band_5ghz = { - .n_channels = ARRAY_SIZE(ath6kl_5ghz_a_channels), - .channels = ath6kl_5ghz_a_channels, - .n_bitrates = ath6kl_a_rates_size, - .bitrates = ath6kl_a_rates, - .ht_cap.cap = ath6kl_a_htcap, - .ht_cap.ht_supported = true, -}; - -#define CCKM_KRK_CIPHER_SUITE 0x004096ff /* use for KRK */ - -/* returns true if scheduled scan was stopped */ -static bool __ath6kl_cfg80211_sscan_stop(struct ath6kl_vif *vif) -{ - struct ath6kl *ar = vif->ar; - - if (!test_and_clear_bit(SCHED_SCANNING, &vif->flags)) - return false; - - del_timer_sync(&vif->sched_scan_timer); - - if (ar->state == ATH6KL_STATE_RECOVERY) - return true; - - ath6kl_wmi_enable_sched_scan_cmd(ar->wmi, vif->fw_vif_idx, false); - - return true; -} - -static void ath6kl_cfg80211_sscan_disable(struct ath6kl_vif *vif) -{ - struct ath6kl *ar = vif->ar; - bool stopped; - - stopped = __ath6kl_cfg80211_sscan_stop(vif); - - if (!stopped) - return; - - cfg80211_sched_scan_stopped(ar->wiphy); -} - -static int ath6kl_set_wpa_version(struct ath6kl_vif *vif, - enum nl80211_wpa_versions wpa_version) -{ - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: %u\n", __func__, wpa_version); - - if (!wpa_version) { - vif->auth_mode = NONE_AUTH; - } else if (wpa_version & NL80211_WPA_VERSION_2) { - vif->auth_mode = WPA2_AUTH; - } else if (wpa_version & NL80211_WPA_VERSION_1) { - vif->auth_mode = WPA_AUTH; - } else { - ath6kl_err("%s: %u not supported\n", __func__, wpa_version); - return -ENOTSUPP; - } - - return 0; -} - -static int ath6kl_set_auth_type(struct ath6kl_vif *vif, - enum nl80211_auth_type auth_type) -{ - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: 0x%x\n", __func__, auth_type); - - switch (auth_type) { - case NL80211_AUTHTYPE_OPEN_SYSTEM: - vif->dot11_auth_mode = OPEN_AUTH; - break; - case NL80211_AUTHTYPE_SHARED_KEY: - vif->dot11_auth_mode = SHARED_AUTH; - break; - case NL80211_AUTHTYPE_NETWORK_EAP: - vif->dot11_auth_mode = LEAP_AUTH; - break; - - case NL80211_AUTHTYPE_AUTOMATIC: - vif->dot11_auth_mode = OPEN_AUTH | SHARED_AUTH; - break; - - default: - ath6kl_err("%s: 0x%x not supported\n", __func__, auth_type); - return -ENOTSUPP; - } - - return 0; -} - -static int ath6kl_set_cipher(struct ath6kl_vif *vif, u32 cipher, bool ucast) -{ - u8 *ar_cipher = ucast ? &vif->prwise_crypto : &vif->grp_crypto; - u8 *ar_cipher_len = ucast ? &vif->prwise_crypto_len : - &vif->grp_crypto_len; - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: cipher 0x%x, ucast %u\n", - __func__, cipher, ucast); - - switch (cipher) { - case 0: - /* our own hack to use value 0 as no crypto used */ - *ar_cipher = NONE_CRYPT; - *ar_cipher_len = 0; - break; - case WLAN_CIPHER_SUITE_WEP40: - *ar_cipher = WEP_CRYPT; - *ar_cipher_len = 5; - break; - case WLAN_CIPHER_SUITE_WEP104: - *ar_cipher = WEP_CRYPT; - *ar_cipher_len = 13; - break; - case WLAN_CIPHER_SUITE_TKIP: - *ar_cipher = TKIP_CRYPT; - *ar_cipher_len = 0; - break; - case WLAN_CIPHER_SUITE_CCMP: - *ar_cipher = AES_CRYPT; - *ar_cipher_len = 0; - break; - case WLAN_CIPHER_SUITE_SMS4: - *ar_cipher = WAPI_CRYPT; - *ar_cipher_len = 0; - break; - default: - ath6kl_err("cipher 0x%x not supported\n", cipher); - return -ENOTSUPP; - } - - return 0; -} - -static void ath6kl_set_key_mgmt(struct ath6kl_vif *vif, u32 key_mgmt) -{ - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: 0x%x\n", __func__, key_mgmt); - - if (key_mgmt == WLAN_AKM_SUITE_PSK) { - if (vif->auth_mode == WPA_AUTH) - vif->auth_mode = WPA_PSK_AUTH; - else if (vif->auth_mode == WPA2_AUTH) - vif->auth_mode = WPA2_PSK_AUTH; - } else if (key_mgmt == 0x00409600) { - if (vif->auth_mode == WPA_AUTH) - vif->auth_mode = WPA_AUTH_CCKM; - else if (vif->auth_mode == WPA2_AUTH) - vif->auth_mode = WPA2_AUTH_CCKM; - } else if (key_mgmt != WLAN_AKM_SUITE_8021X) { - vif->auth_mode = NONE_AUTH; - } -} - -static bool ath6kl_cfg80211_ready(struct ath6kl_vif *vif) -{ - struct ath6kl *ar = vif->ar; - - if (!test_bit(WMI_READY, &ar->flag)) { - ath6kl_err("wmi is not ready\n"); - return false; - } - - if (!test_bit(WLAN_ENABLED, &vif->flags)) { - ath6kl_err("wlan disabled\n"); - return false; - } - - return true; -} - -static bool ath6kl_is_wpa_ie(const u8 *pos) -{ - return pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 && - pos[2] == 0x00 && pos[3] == 0x50 && - pos[4] == 0xf2 && pos[5] == 0x01; -} - -static bool ath6kl_is_rsn_ie(const u8 *pos) -{ - return pos[0] == WLAN_EID_RSN; -} - -static bool ath6kl_is_wps_ie(const u8 *pos) -{ - return (pos[0] == WLAN_EID_VENDOR_SPECIFIC && - pos[1] >= 4 && - pos[2] == 0x00 && pos[3] == 0x50 && pos[4] == 0xf2 && - pos[5] == 0x04); -} - -static int ath6kl_set_assoc_req_ies(struct ath6kl_vif *vif, const u8 *ies, - size_t ies_len) -{ - struct ath6kl *ar = vif->ar; - const u8 *pos; - u8 *buf = NULL; - size_t len = 0; - int ret; - - /* - * Clear previously set flag - */ - - ar->connect_ctrl_flags &= ~CONNECT_WPS_FLAG; - - /* - * Filter out RSN/WPA IE(s) - */ - - if (ies && ies_len) { - buf = kmalloc(ies_len, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - pos = ies; - - while (pos + 1 < ies + ies_len) { - if (pos + 2 + pos[1] > ies + ies_len) - break; - if (!(ath6kl_is_wpa_ie(pos) || ath6kl_is_rsn_ie(pos))) { - memcpy(buf + len, pos, 2 + pos[1]); - len += 2 + pos[1]; - } - - if (ath6kl_is_wps_ie(pos)) - ar->connect_ctrl_flags |= CONNECT_WPS_FLAG; - - pos += 2 + pos[1]; - } - } - - ret = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx, - WMI_FRAME_ASSOC_REQ, buf, len); - kfree(buf); - return ret; -} - -static int ath6kl_nliftype_to_drv_iftype(enum nl80211_iftype type, u8 *nw_type) -{ - switch (type) { - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_P2P_CLIENT: - *nw_type = INFRA_NETWORK; - break; - case NL80211_IFTYPE_ADHOC: - *nw_type = ADHOC_NETWORK; - break; - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_P2P_GO: - *nw_type = AP_NETWORK; - break; - default: - ath6kl_err("invalid interface type %u\n", type); - return -ENOTSUPP; - } - - return 0; -} - -static bool ath6kl_is_valid_iftype(struct ath6kl *ar, enum nl80211_iftype type, - u8 *if_idx, u8 *nw_type) -{ - int i; - - if (ath6kl_nliftype_to_drv_iftype(type, nw_type)) - return false; - - if (ar->ibss_if_active || ((type == NL80211_IFTYPE_ADHOC) && - ar->num_vif)) - return false; - - if (type == NL80211_IFTYPE_STATION || - type == NL80211_IFTYPE_AP || type == NL80211_IFTYPE_ADHOC) { - for (i = 0; i < ar->vif_max; i++) { - if ((ar->avail_idx_map) & BIT(i)) { - *if_idx = i; - return true; - } - } - } - - if (type == NL80211_IFTYPE_P2P_CLIENT || - type == NL80211_IFTYPE_P2P_GO) { - for (i = ar->max_norm_iface; i < ar->vif_max; i++) { - if ((ar->avail_idx_map) & BIT(i)) { - *if_idx = i; - return true; - } - } - } - - return false; -} - -static bool ath6kl_is_tx_pending(struct ath6kl *ar) -{ - return ar->tx_pending[ath6kl_wmi_get_control_ep(ar->wmi)] == 0; -} - -static void ath6kl_cfg80211_sta_bmiss_enhance(struct ath6kl_vif *vif, - bool enable) -{ - int err; - - if (WARN_ON(!test_bit(WMI_READY, &vif->ar->flag))) - return; - - if (vif->nw_type != INFRA_NETWORK) - return; - - if (!test_bit(ATH6KL_FW_CAPABILITY_BMISS_ENHANCE, - vif->ar->fw_capabilities)) - return; - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s fw bmiss enhance\n", - enable ? "enable" : "disable"); - - err = ath6kl_wmi_sta_bmiss_enhance_cmd(vif->ar->wmi, - vif->fw_vif_idx, enable); - if (err) - ath6kl_err("failed to %s enhanced bmiss detection: %d\n", - enable ? "enable" : "disable", err); -} - -static int ath6kl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_connect_params *sme) -{ - struct ath6kl *ar = ath6kl_priv(dev); - struct ath6kl_vif *vif = netdev_priv(dev); - int status; - u8 nw_subtype = (ar->p2p) ? SUBTYPE_P2PDEV : SUBTYPE_NONE; - u16 interval; - - ath6kl_cfg80211_sscan_disable(vif); - - vif->sme_state = SME_CONNECTING; - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - if (test_bit(DESTROY_IN_PROGRESS, &ar->flag)) { - ath6kl_err("destroy in progress\n"); - return -EBUSY; - } - - if (test_bit(SKIP_SCAN, &ar->flag) && - ((sme->channel && sme->channel->center_freq == 0) || - (sme->bssid && is_zero_ether_addr(sme->bssid)))) { - ath6kl_err("SkipScan: channel or bssid invalid\n"); - return -EINVAL; - } - - if (down_interruptible(&ar->sem)) { - ath6kl_err("busy, couldn't get access\n"); - return -ERESTARTSYS; - } - - if (test_bit(DESTROY_IN_PROGRESS, &ar->flag)) { - ath6kl_err("busy, destroy in progress\n"); - up(&ar->sem); - return -EBUSY; - } - - if (ar->tx_pending[ath6kl_wmi_get_control_ep(ar->wmi)]) { - /* - * sleep until the command queue drains - */ - wait_event_interruptible_timeout(ar->event_wq, - ath6kl_is_tx_pending(ar), - WMI_TIMEOUT); - if (signal_pending(current)) { - ath6kl_err("cmd queue drain timeout\n"); - up(&ar->sem); - return -EINTR; - } - } - - status = ath6kl_set_assoc_req_ies(vif, sme->ie, sme->ie_len); - if (status) { - up(&ar->sem); - return status; - } - - if (sme->ie == NULL || sme->ie_len == 0) - ar->connect_ctrl_flags &= ~CONNECT_WPS_FLAG; - - if (test_bit(CONNECTED, &vif->flags) && - vif->ssid_len == sme->ssid_len && - !memcmp(vif->ssid, sme->ssid, vif->ssid_len)) { - vif->reconnect_flag = true; - status = ath6kl_wmi_reconnect_cmd(ar->wmi, vif->fw_vif_idx, - vif->req_bssid, - vif->ch_hint); - - up(&ar->sem); - if (status) { - ath6kl_err("wmi_reconnect_cmd failed\n"); - return -EIO; - } - return 0; - } else if (vif->ssid_len == sme->ssid_len && - !memcmp(vif->ssid, sme->ssid, vif->ssid_len)) { - ath6kl_disconnect(vif); - } - - memset(vif->ssid, 0, sizeof(vif->ssid)); - vif->ssid_len = sme->ssid_len; - memcpy(vif->ssid, sme->ssid, sme->ssid_len); - - if (sme->channel) - vif->ch_hint = sme->channel->center_freq; - - memset(vif->req_bssid, 0, sizeof(vif->req_bssid)); - if (sme->bssid && !is_broadcast_ether_addr(sme->bssid)) - memcpy(vif->req_bssid, sme->bssid, sizeof(vif->req_bssid)); - - ath6kl_set_wpa_version(vif, sme->crypto.wpa_versions); - - status = ath6kl_set_auth_type(vif, sme->auth_type); - if (status) { - up(&ar->sem); - return status; - } - - if (sme->crypto.n_ciphers_pairwise) - ath6kl_set_cipher(vif, sme->crypto.ciphers_pairwise[0], true); - else - ath6kl_set_cipher(vif, 0, true); - - ath6kl_set_cipher(vif, sme->crypto.cipher_group, false); - - if (sme->crypto.n_akm_suites) - ath6kl_set_key_mgmt(vif, sme->crypto.akm_suites[0]); - - if ((sme->key_len) && - (vif->auth_mode == NONE_AUTH) && - (vif->prwise_crypto == WEP_CRYPT)) { - struct ath6kl_key *key = NULL; - - if (sme->key_idx > WMI_MAX_KEY_INDEX) { - ath6kl_err("key index %d out of bounds\n", - sme->key_idx); - up(&ar->sem); - return -ENOENT; - } - - key = &vif->keys[sme->key_idx]; - key->key_len = sme->key_len; - memcpy(key->key, sme->key, key->key_len); - key->cipher = vif->prwise_crypto; - vif->def_txkey_index = sme->key_idx; - - ath6kl_wmi_addkey_cmd(ar->wmi, vif->fw_vif_idx, sme->key_idx, - vif->prwise_crypto, - GROUP_USAGE | TX_USAGE, - key->key_len, - NULL, 0, - key->key, KEY_OP_INIT_VAL, NULL, - NO_SYNC_WMIFLAG); - } - - if (!ar->usr_bss_filter) { - clear_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags); - if (ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, - ALL_BSS_FILTER, 0) != 0) { - ath6kl_err("couldn't set bss filtering\n"); - up(&ar->sem); - return -EIO; - } - } - - vif->nw_type = vif->next_mode; - - /* enable enhanced bmiss detection if applicable */ - ath6kl_cfg80211_sta_bmiss_enhance(vif, true); - - if (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) - nw_subtype = SUBTYPE_P2PCLIENT; - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "%s: connect called with authmode %d dot11 auth %d" - " PW crypto %d PW crypto len %d GRP crypto %d" - " GRP crypto len %d channel hint %u\n", - __func__, - vif->auth_mode, vif->dot11_auth_mode, vif->prwise_crypto, - vif->prwise_crypto_len, vif->grp_crypto, - vif->grp_crypto_len, vif->ch_hint); - - vif->reconnect_flag = 0; - - if (vif->nw_type == INFRA_NETWORK) { - interval = max_t(u16, vif->listen_intvl_t, - ATH6KL_MAX_WOW_LISTEN_INTL); - status = ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx, - interval, - 0); - if (status) { - ath6kl_err("couldn't set listen intervel\n"); - up(&ar->sem); - return status; - } - } - - status = ath6kl_wmi_connect_cmd(ar->wmi, vif->fw_vif_idx, vif->nw_type, - vif->dot11_auth_mode, vif->auth_mode, - vif->prwise_crypto, - vif->prwise_crypto_len, - vif->grp_crypto, vif->grp_crypto_len, - vif->ssid_len, vif->ssid, - vif->req_bssid, vif->ch_hint, - ar->connect_ctrl_flags, nw_subtype); - - if (sme->bg_scan_period == 0) { - /* disable background scan if period is 0 */ - sme->bg_scan_period = 0xffff; - } else if (sme->bg_scan_period == -1) { - /* configure default value if not specified */ - sme->bg_scan_period = DEFAULT_BG_SCAN_PERIOD; - } - - ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, 0, 0, - sme->bg_scan_period, 0, 0, 0, 3, 0, 0, 0); - - up(&ar->sem); - - if (status == -EINVAL) { - memset(vif->ssid, 0, sizeof(vif->ssid)); - vif->ssid_len = 0; - ath6kl_err("invalid request\n"); - return -ENOENT; - } else if (status) { - ath6kl_err("ath6kl_wmi_connect_cmd failed\n"); - return -EIO; - } - - if ((!(ar->connect_ctrl_flags & CONNECT_DO_WPA_OFFLOAD)) && - ((vif->auth_mode == WPA_PSK_AUTH) || - (vif->auth_mode == WPA2_PSK_AUTH))) { - mod_timer(&vif->disconnect_timer, - jiffies + msecs_to_jiffies(DISCON_TIMER_INTVAL)); - } - - ar->connect_ctrl_flags &= ~CONNECT_DO_WPA_OFFLOAD; - set_bit(CONNECT_PEND, &vif->flags); - - return 0; -} - -static struct cfg80211_bss * -ath6kl_add_bss_if_needed(struct ath6kl_vif *vif, - enum network_type nw_type, - const u8 *bssid, - struct ieee80211_channel *chan, - const u8 *beacon_ie, - size_t beacon_ie_len) -{ - struct ath6kl *ar = vif->ar; - struct cfg80211_bss *bss; - u16 cap_mask, cap_val; - u8 *ie; - - if (nw_type & ADHOC_NETWORK) { - cap_mask = WLAN_CAPABILITY_IBSS; - cap_val = WLAN_CAPABILITY_IBSS; - } else { - cap_mask = WLAN_CAPABILITY_ESS; - cap_val = WLAN_CAPABILITY_ESS; - } - - bss = cfg80211_get_bss(ar->wiphy, chan, bssid, - vif->ssid, vif->ssid_len, - cap_mask, cap_val); - if (bss == NULL) { - /* - * Since cfg80211 may not yet know about the BSS, - * generate a partial entry until the first BSS info - * event becomes available. - * - * Prepend SSID element since it is not included in the Beacon - * IEs from the target. - */ - ie = kmalloc(2 + vif->ssid_len + beacon_ie_len, GFP_KERNEL); - if (ie == NULL) - return NULL; - ie[0] = WLAN_EID_SSID; - ie[1] = vif->ssid_len; - memcpy(ie + 2, vif->ssid, vif->ssid_len); - memcpy(ie + 2 + vif->ssid_len, beacon_ie, beacon_ie_len); - bss = cfg80211_inform_bss(ar->wiphy, chan, - bssid, 0, cap_val, 100, - ie, 2 + vif->ssid_len + beacon_ie_len, - 0, GFP_KERNEL); - if (bss) - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "added bss %pM to cfg80211\n", bssid); - kfree(ie); - } else - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "cfg80211 already has a bss\n"); - - return bss; -} - -void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel, - u8 *bssid, u16 listen_intvl, - u16 beacon_intvl, - enum network_type nw_type, - u8 beacon_ie_len, u8 assoc_req_len, - u8 assoc_resp_len, u8 *assoc_info) -{ - struct ieee80211_channel *chan; - struct ath6kl *ar = vif->ar; - struct cfg80211_bss *bss; - - /* capinfo + listen interval */ - u8 assoc_req_ie_offset = sizeof(u16) + sizeof(u16); - - /* capinfo + status code + associd */ - u8 assoc_resp_ie_offset = sizeof(u16) + sizeof(u16) + sizeof(u16); - - u8 *assoc_req_ie = assoc_info + beacon_ie_len + assoc_req_ie_offset; - u8 *assoc_resp_ie = assoc_info + beacon_ie_len + assoc_req_len + - assoc_resp_ie_offset; - - assoc_req_len -= assoc_req_ie_offset; - assoc_resp_len -= assoc_resp_ie_offset; - - /* - * Store Beacon interval here; DTIM period will be available only once - * a Beacon frame from the AP is seen. - */ - vif->assoc_bss_beacon_int = beacon_intvl; - clear_bit(DTIM_PERIOD_AVAIL, &vif->flags); - - if (nw_type & ADHOC_NETWORK) { - if (vif->wdev.iftype != NL80211_IFTYPE_ADHOC) { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "%s: ath6k not in ibss mode\n", __func__); - return; - } - } - - if (nw_type & INFRA_NETWORK) { - if (vif->wdev.iftype != NL80211_IFTYPE_STATION && - vif->wdev.iftype != NL80211_IFTYPE_P2P_CLIENT) { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "%s: ath6k not in station mode\n", __func__); - return; - } - } - - chan = ieee80211_get_channel(ar->wiphy, (int) channel); - - bss = ath6kl_add_bss_if_needed(vif, nw_type, bssid, chan, - assoc_info, beacon_ie_len); - if (!bss) { - ath6kl_err("could not add cfg80211 bss entry\n"); - return; - } - - if (nw_type & ADHOC_NETWORK) { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "ad-hoc %s selected\n", - nw_type & ADHOC_CREATOR ? "creator" : "joiner"); - cfg80211_ibss_joined(vif->ndev, bssid, GFP_KERNEL); - cfg80211_put_bss(ar->wiphy, bss); - return; - } - - if (vif->sme_state == SME_CONNECTING) { - /* inform connect result to cfg80211 */ - vif->sme_state = SME_CONNECTED; - cfg80211_connect_result(vif->ndev, bssid, - assoc_req_ie, assoc_req_len, - assoc_resp_ie, assoc_resp_len, - WLAN_STATUS_SUCCESS, GFP_KERNEL); - cfg80211_put_bss(ar->wiphy, bss); - } else if (vif->sme_state == SME_CONNECTED) { - /* inform roam event to cfg80211 */ - cfg80211_roamed_bss(vif->ndev, bss, assoc_req_ie, assoc_req_len, - assoc_resp_ie, assoc_resp_len, GFP_KERNEL); - } -} - -static int ath6kl_cfg80211_disconnect(struct wiphy *wiphy, - struct net_device *dev, u16 reason_code) -{ - struct ath6kl *ar = ath6kl_priv(dev); - struct ath6kl_vif *vif = netdev_priv(dev); - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: reason=%u\n", __func__, - reason_code); - - ath6kl_cfg80211_sscan_disable(vif); - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - if (test_bit(DESTROY_IN_PROGRESS, &ar->flag)) { - ath6kl_err("busy, destroy in progress\n"); - return -EBUSY; - } - - if (down_interruptible(&ar->sem)) { - ath6kl_err("busy, couldn't get access\n"); - return -ERESTARTSYS; - } - - vif->reconnect_flag = 0; - ath6kl_disconnect(vif); - memset(vif->ssid, 0, sizeof(vif->ssid)); - vif->ssid_len = 0; - - if (!test_bit(SKIP_SCAN, &ar->flag)) - memset(vif->req_bssid, 0, sizeof(vif->req_bssid)); - - up(&ar->sem); - - vif->sme_state = SME_DISCONNECTED; - - return 0; -} - -void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason, - u8 *bssid, u8 assoc_resp_len, - u8 *assoc_info, u16 proto_reason) -{ - struct ath6kl *ar = vif->ar; - - if (vif->scan_req) { - cfg80211_scan_done(vif->scan_req, true); - vif->scan_req = NULL; - } - - if (vif->nw_type & ADHOC_NETWORK) { - if (vif->wdev.iftype != NL80211_IFTYPE_ADHOC) { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "%s: ath6k not in ibss mode\n", __func__); - return; - } - memset(bssid, 0, ETH_ALEN); - cfg80211_ibss_joined(vif->ndev, bssid, GFP_KERNEL); - return; - } - - if (vif->nw_type & INFRA_NETWORK) { - if (vif->wdev.iftype != NL80211_IFTYPE_STATION && - vif->wdev.iftype != NL80211_IFTYPE_P2P_CLIENT) { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "%s: ath6k not in station mode\n", __func__); - return; - } - } - - clear_bit(CONNECT_PEND, &vif->flags); - - if (vif->sme_state == SME_CONNECTING) { - cfg80211_connect_result(vif->ndev, - bssid, NULL, 0, - NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, - GFP_KERNEL); - } else if (vif->sme_state == SME_CONNECTED) { - cfg80211_disconnected(vif->ndev, proto_reason, - NULL, 0, GFP_KERNEL); - } - - vif->sme_state = SME_DISCONNECTED; - - /* - * Send a disconnect command to target when a disconnect event is - * received with reason code other than 3 (DISCONNECT_CMD - disconnect - * request from host) to make the firmware stop trying to connect even - * after giving disconnect event. There will be one more disconnect - * event for this disconnect command with reason code DISCONNECT_CMD - * which won't be notified to cfg80211. - */ - if (reason != DISCONNECT_CMD) - ath6kl_wmi_disconnect_cmd(ar->wmi, vif->fw_vif_idx); -} - -static int ath6kl_set_probed_ssids(struct ath6kl *ar, - struct ath6kl_vif *vif, - struct cfg80211_ssid *ssids, int n_ssids, - struct cfg80211_match_set *match_set, - int n_match_ssid) -{ - u8 i, j, index_to_add, ssid_found = false; - struct ath6kl_cfg80211_match_probe_ssid ssid_list[MAX_PROBED_SSIDS]; - - memset(ssid_list, 0, sizeof(ssid_list)); - - if (n_ssids > MAX_PROBED_SSIDS || - n_match_ssid > MAX_PROBED_SSIDS) - return -EINVAL; - - for (i = 0; i < n_ssids; i++) { - memcpy(ssid_list[i].ssid.ssid, - ssids[i].ssid, - ssids[i].ssid_len); - ssid_list[i].ssid.ssid_len = ssids[i].ssid_len; - - if (ssids[i].ssid_len) - ssid_list[i].flag = SPECIFIC_SSID_FLAG; - else - ssid_list[i].flag = ANY_SSID_FLAG; - - if (n_match_ssid == 0) - ssid_list[i].flag |= MATCH_SSID_FLAG; - } - - index_to_add = i; - - for (i = 0; i < n_match_ssid; i++) { - ssid_found = false; - - for (j = 0; j < n_ssids; j++) { - if ((match_set[i].ssid.ssid_len == - ssid_list[j].ssid.ssid_len) && - (!memcmp(ssid_list[j].ssid.ssid, - match_set[i].ssid.ssid, - match_set[i].ssid.ssid_len))) { - ssid_list[j].flag |= MATCH_SSID_FLAG; - ssid_found = true; - break; - } - } - - if (ssid_found) - continue; - - if (index_to_add >= MAX_PROBED_SSIDS) - continue; - - ssid_list[index_to_add].ssid.ssid_len = - match_set[i].ssid.ssid_len; - memcpy(ssid_list[index_to_add].ssid.ssid, - match_set[i].ssid.ssid, - match_set[i].ssid.ssid_len); - ssid_list[index_to_add].flag |= MATCH_SSID_FLAG; - index_to_add++; - } - - for (i = 0; i < index_to_add; i++) { - ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, i, - ssid_list[i].flag, - ssid_list[i].ssid.ssid_len, - ssid_list[i].ssid.ssid); - - } - - /* Make sure no old entries are left behind */ - for (i = index_to_add; i < MAX_PROBED_SSIDS; i++) { - ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, i, - DISABLE_SSID_FLAG, 0, NULL); - } - - return 0; -} - -static int ath6kl_cfg80211_scan(struct wiphy *wiphy, - struct cfg80211_scan_request *request) -{ - struct ath6kl_vif *vif = ath6kl_vif_from_wdev(request->wdev); - struct ath6kl *ar = ath6kl_priv(vif->ndev); - s8 n_channels = 0; - u16 *channels = NULL; - int ret = 0; - u32 force_fg_scan = 0; - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - ath6kl_cfg80211_sscan_disable(vif); - - if (!ar->usr_bss_filter) { - clear_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags); - ret = ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, - ALL_BSS_FILTER, 0); - if (ret) { - ath6kl_err("couldn't set bss filtering\n"); - return ret; - } - } - - ret = ath6kl_set_probed_ssids(ar, vif, request->ssids, - request->n_ssids, NULL, 0); - if (ret < 0) - return ret; - - /* this also clears IE in fw if it's not set */ - ret = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx, - WMI_FRAME_PROBE_REQ, - request->ie, request->ie_len); - if (ret) { - ath6kl_err("failed to set Probe Request appie for scan\n"); - return ret; - } - - /* - * Scan only the requested channels if the request specifies a set of - * channels. If the list is longer than the target supports, do not - * configure the list and instead, scan all available channels. - */ - if (request->n_channels > 0 && - request->n_channels <= WMI_MAX_CHANNELS) { - u8 i; - - n_channels = request->n_channels; - - channels = kzalloc(n_channels * sizeof(u16), GFP_KERNEL); - if (channels == NULL) { - ath6kl_warn("failed to set scan channels, scan all channels"); - n_channels = 0; - } - - for (i = 0; i < n_channels; i++) - channels[i] = request->channels[i]->center_freq; - } - - if (test_bit(CONNECTED, &vif->flags)) - force_fg_scan = 1; - - vif->scan_req = request; - - ret = ath6kl_wmi_beginscan_cmd(ar->wmi, vif->fw_vif_idx, - WMI_LONG_SCAN, force_fg_scan, - false, 0, - ATH6KL_FG_SCAN_INTERVAL, - n_channels, channels, - request->no_cck, - request->rates); - if (ret) { - ath6kl_err("failed to start scan: %d\n", ret); - vif->scan_req = NULL; - } - - kfree(channels); - - return ret; -} - -void ath6kl_cfg80211_scan_complete_event(struct ath6kl_vif *vif, bool aborted) -{ - struct ath6kl *ar = vif->ar; - int i; - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: status%s\n", __func__, - aborted ? " aborted" : ""); - - if (!vif->scan_req) - return; - - if (aborted) - goto out; - - if (vif->scan_req->n_ssids && vif->scan_req->ssids[0].ssid_len) { - for (i = 0; i < vif->scan_req->n_ssids; i++) { - ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, - i + 1, DISABLE_SSID_FLAG, - 0, NULL); - } - } - -out: - cfg80211_scan_done(vif->scan_req, aborted); - vif->scan_req = NULL; -} - -void ath6kl_cfg80211_ch_switch_notify(struct ath6kl_vif *vif, int freq, - enum wmi_phy_mode mode) -{ - struct cfg80211_chan_def chandef; - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "channel switch notify nw_type %d freq %d mode %d\n", - vif->nw_type, freq, mode); - - cfg80211_chandef_create(&chandef, - ieee80211_get_channel(vif->ar->wiphy, freq), - (mode == WMI_11G_HT20) ? - NL80211_CHAN_HT20 : NL80211_CHAN_NO_HT); - - cfg80211_ch_switch_notify(vif->ndev, &chandef); -} - -static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, - u8 key_index, bool pairwise, - const u8 *mac_addr, - struct key_params *params) -{ - struct ath6kl *ar = ath6kl_priv(ndev); - struct ath6kl_vif *vif = netdev_priv(ndev); - struct ath6kl_key *key = NULL; - int seq_len; - u8 key_usage; - u8 key_type; - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - if (params->cipher == CCKM_KRK_CIPHER_SUITE) { - if (params->key_len != WMI_KRK_LEN) - return -EINVAL; - return ath6kl_wmi_add_krk_cmd(ar->wmi, vif->fw_vif_idx, - params->key); - } - - if (key_index > WMI_MAX_KEY_INDEX) { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "%s: key index %d out of bounds\n", __func__, - key_index); - return -ENOENT; - } - - key = &vif->keys[key_index]; - memset(key, 0, sizeof(struct ath6kl_key)); - - if (pairwise) - key_usage = PAIRWISE_USAGE; - else - key_usage = GROUP_USAGE; - - seq_len = params->seq_len; - if (params->cipher == WLAN_CIPHER_SUITE_SMS4 && - seq_len > ATH6KL_KEY_SEQ_LEN) { - /* Only first half of the WPI PN is configured */ - seq_len = ATH6KL_KEY_SEQ_LEN; - } - if (params->key_len > WLAN_MAX_KEY_LEN || - seq_len > sizeof(key->seq)) - return -EINVAL; - - key->key_len = params->key_len; - memcpy(key->key, params->key, key->key_len); - key->seq_len = seq_len; - memcpy(key->seq, params->seq, key->seq_len); - key->cipher = params->cipher; - - switch (key->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - key_type = WEP_CRYPT; - break; - - case WLAN_CIPHER_SUITE_TKIP: - key_type = TKIP_CRYPT; - break; - - case WLAN_CIPHER_SUITE_CCMP: - key_type = AES_CRYPT; - break; - case WLAN_CIPHER_SUITE_SMS4: - key_type = WAPI_CRYPT; - break; - - default: - return -ENOTSUPP; - } - - if (((vif->auth_mode == WPA_PSK_AUTH) || - (vif->auth_mode == WPA2_PSK_AUTH)) && - (key_usage & GROUP_USAGE)) - del_timer(&vif->disconnect_timer); - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "%s: index %d, key_len %d, key_type 0x%x, key_usage 0x%x, seq_len %d\n", - __func__, key_index, key->key_len, key_type, - key_usage, key->seq_len); - - if (vif->nw_type == AP_NETWORK && !pairwise && - (key_type == TKIP_CRYPT || key_type == AES_CRYPT || - key_type == WAPI_CRYPT)) { - ar->ap_mode_bkey.valid = true; - ar->ap_mode_bkey.key_index = key_index; - ar->ap_mode_bkey.key_type = key_type; - ar->ap_mode_bkey.key_len = key->key_len; - memcpy(ar->ap_mode_bkey.key, key->key, key->key_len); - if (!test_bit(CONNECTED, &vif->flags)) { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "Delay initial group key configuration until AP mode has been started\n"); - /* - * The key will be set in ath6kl_connect_ap_mode() once - * the connected event is received from the target. - */ - return 0; - } - } - - if (vif->next_mode == AP_NETWORK && key_type == WEP_CRYPT && - !test_bit(CONNECTED, &vif->flags)) { - /* - * Store the key locally so that it can be re-configured after - * the AP mode has properly started - * (ath6kl_install_statioc_wep_keys). - */ - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "Delay WEP key configuration until AP mode has been started\n"); - vif->wep_key_list[key_index].key_len = key->key_len; - memcpy(vif->wep_key_list[key_index].key, key->key, - key->key_len); - return 0; - } - - return ath6kl_wmi_addkey_cmd(ar->wmi, vif->fw_vif_idx, key_index, - key_type, key_usage, key->key_len, - key->seq, key->seq_len, key->key, - KEY_OP_INIT_VAL, - (u8 *) mac_addr, SYNC_BOTH_WMIFLAG); -} - -static int ath6kl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, - u8 key_index, bool pairwise, - const u8 *mac_addr) -{ - struct ath6kl *ar = ath6kl_priv(ndev); - struct ath6kl_vif *vif = netdev_priv(ndev); - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: index %d\n", __func__, key_index); - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - if (key_index > WMI_MAX_KEY_INDEX) { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "%s: key index %d out of bounds\n", __func__, - key_index); - return -ENOENT; - } - - if (!vif->keys[key_index].key_len) { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "%s: index %d is empty\n", __func__, key_index); - return 0; - } - - vif->keys[key_index].key_len = 0; - - return ath6kl_wmi_deletekey_cmd(ar->wmi, vif->fw_vif_idx, key_index); -} - -static int ath6kl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, - u8 key_index, bool pairwise, - const u8 *mac_addr, void *cookie, - void (*callback) (void *cookie, - struct key_params *)) -{ - struct ath6kl_vif *vif = netdev_priv(ndev); - struct ath6kl_key *key = NULL; - struct key_params params; - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: index %d\n", __func__, key_index); - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - if (key_index > WMI_MAX_KEY_INDEX) { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "%s: key index %d out of bounds\n", __func__, - key_index); - return -ENOENT; - } - - key = &vif->keys[key_index]; - memset(¶ms, 0, sizeof(params)); - params.cipher = key->cipher; - params.key_len = key->key_len; - params.seq_len = key->seq_len; - params.seq = key->seq; - params.key = key->key; - - callback(cookie, ¶ms); - - return key->key_len ? 0 : -ENOENT; -} - -static int ath6kl_cfg80211_set_default_key(struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, bool unicast, - bool multicast) -{ - struct ath6kl *ar = ath6kl_priv(ndev); - struct ath6kl_vif *vif = netdev_priv(ndev); - struct ath6kl_key *key = NULL; - u8 key_usage; - enum crypto_type key_type = NONE_CRYPT; - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: index %d\n", __func__, key_index); - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - if (key_index > WMI_MAX_KEY_INDEX) { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "%s: key index %d out of bounds\n", - __func__, key_index); - return -ENOENT; - } - - if (!vif->keys[key_index].key_len) { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: invalid key index %d\n", - __func__, key_index); - return -EINVAL; - } - - vif->def_txkey_index = key_index; - key = &vif->keys[vif->def_txkey_index]; - key_usage = GROUP_USAGE; - if (vif->prwise_crypto == WEP_CRYPT) - key_usage |= TX_USAGE; - if (unicast) - key_type = vif->prwise_crypto; - if (multicast) - key_type = vif->grp_crypto; - - if (vif->next_mode == AP_NETWORK && !test_bit(CONNECTED, &vif->flags)) - return 0; /* Delay until AP mode has been started */ - - return ath6kl_wmi_addkey_cmd(ar->wmi, vif->fw_vif_idx, - vif->def_txkey_index, - key_type, key_usage, - key->key_len, key->seq, key->seq_len, - key->key, - KEY_OP_INIT_VAL, NULL, - SYNC_BOTH_WMIFLAG); -} - -void ath6kl_cfg80211_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid, - bool ismcast) -{ - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "%s: keyid %d, ismcast %d\n", __func__, keyid, ismcast); - - cfg80211_michael_mic_failure(vif->ndev, vif->bssid, - (ismcast ? NL80211_KEYTYPE_GROUP : - NL80211_KEYTYPE_PAIRWISE), keyid, NULL, - GFP_KERNEL); -} - -static int ath6kl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) -{ - struct ath6kl *ar = (struct ath6kl *)wiphy_priv(wiphy); - struct ath6kl_vif *vif; - int ret; - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: changed 0x%x\n", __func__, - changed); - - vif = ath6kl_vif_first(ar); - if (!vif) - return -EIO; - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - if (changed & WIPHY_PARAM_RTS_THRESHOLD) { - ret = ath6kl_wmi_set_rts_cmd(ar->wmi, wiphy->rts_threshold); - if (ret != 0) { - ath6kl_err("ath6kl_wmi_set_rts_cmd failed\n"); - return -EIO; - } - } - - return 0; -} - -static int ath6kl_cfg80211_set_txpower(struct wiphy *wiphy, - struct wireless_dev *wdev, - enum nl80211_tx_power_setting type, - int mbm) -{ - struct ath6kl *ar = (struct ath6kl *)wiphy_priv(wiphy); - struct ath6kl_vif *vif; - int dbm = MBM_TO_DBM(mbm); - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: type 0x%x, dbm %d\n", __func__, - type, dbm); - - vif = ath6kl_vif_first(ar); - if (!vif) - return -EIO; - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - switch (type) { - case NL80211_TX_POWER_AUTOMATIC: - return 0; - case NL80211_TX_POWER_LIMITED: - ar->tx_pwr = dbm; - break; - default: - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: type 0x%x not supported\n", - __func__, type); - return -EOPNOTSUPP; - } - - ath6kl_wmi_set_tx_pwr_cmd(ar->wmi, vif->fw_vif_idx, dbm); - - return 0; -} - -static int ath6kl_cfg80211_get_txpower(struct wiphy *wiphy, - struct wireless_dev *wdev, - int *dbm) -{ - struct ath6kl *ar = (struct ath6kl *)wiphy_priv(wiphy); - struct ath6kl_vif *vif; - - vif = ath6kl_vif_first(ar); - if (!vif) - return -EIO; - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - if (test_bit(CONNECTED, &vif->flags)) { - ar->tx_pwr = 0; - - if (ath6kl_wmi_get_tx_pwr_cmd(ar->wmi, vif->fw_vif_idx) != 0) { - ath6kl_err("ath6kl_wmi_get_tx_pwr_cmd failed\n"); - return -EIO; - } - - wait_event_interruptible_timeout(ar->event_wq, ar->tx_pwr != 0, - 5 * HZ); - - if (signal_pending(current)) { - ath6kl_err("target did not respond\n"); - return -EINTR; - } - } - - *dbm = ar->tx_pwr; - return 0; -} - -static int ath6kl_cfg80211_set_power_mgmt(struct wiphy *wiphy, - struct net_device *dev, - bool pmgmt, int timeout) -{ - struct ath6kl *ar = ath6kl_priv(dev); - struct wmi_power_mode_cmd mode; - struct ath6kl_vif *vif = netdev_priv(dev); - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: pmgmt %d, timeout %d\n", - __func__, pmgmt, timeout); - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - if (pmgmt) { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: rec power\n", __func__); - mode.pwr_mode = REC_POWER; - } else { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: max perf\n", __func__); - mode.pwr_mode = MAX_PERF_POWER; - } - - if (ath6kl_wmi_powermode_cmd(ar->wmi, vif->fw_vif_idx, - mode.pwr_mode) != 0) { - ath6kl_err("wmi_powermode_cmd failed\n"); - return -EIO; - } - - return 0; -} - -static struct wireless_dev *ath6kl_cfg80211_add_iface(struct wiphy *wiphy, - const char *name, - enum nl80211_iftype type, - u32 *flags, - struct vif_params *params) -{ - struct ath6kl *ar = wiphy_priv(wiphy); - struct wireless_dev *wdev; - u8 if_idx, nw_type; - - if (ar->num_vif == ar->vif_max) { - ath6kl_err("Reached maximum number of supported vif\n"); - return ERR_PTR(-EINVAL); - } - - if (!ath6kl_is_valid_iftype(ar, type, &if_idx, &nw_type)) { - ath6kl_err("Not a supported interface type\n"); - return ERR_PTR(-EINVAL); - } - - wdev = ath6kl_interface_add(ar, name, type, if_idx, nw_type); - if (!wdev) - return ERR_PTR(-ENOMEM); - - ar->num_vif++; - - return wdev; -} - -static int ath6kl_cfg80211_del_iface(struct wiphy *wiphy, - struct wireless_dev *wdev) -{ - struct ath6kl *ar = wiphy_priv(wiphy); - struct ath6kl_vif *vif = netdev_priv(wdev->netdev); - - spin_lock_bh(&ar->list_lock); - list_del(&vif->list); - spin_unlock_bh(&ar->list_lock); - - ath6kl_cfg80211_vif_stop(vif, test_bit(WMI_READY, &ar->flag)); - - rtnl_lock(); - ath6kl_cfg80211_vif_cleanup(vif); - rtnl_unlock(); - - return 0; -} - -static int ath6kl_cfg80211_change_iface(struct wiphy *wiphy, - struct net_device *ndev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -{ - struct ath6kl_vif *vif = netdev_priv(ndev); - int i; - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: type %u\n", __func__, type); - - /* - * Don't bring up p2p on an interface which is not initialized - * for p2p operation where fw does not have capability to switch - * dynamically between non-p2p and p2p type interface. - */ - if (!test_bit(ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX, - vif->ar->fw_capabilities) && - (type == NL80211_IFTYPE_P2P_CLIENT || - type == NL80211_IFTYPE_P2P_GO)) { - if (vif->ar->vif_max == 1) { - if (vif->fw_vif_idx != 0) - return -EINVAL; - else - goto set_iface_type; - } - - for (i = vif->ar->max_norm_iface; i < vif->ar->vif_max; i++) { - if (i == vif->fw_vif_idx) - break; - } - - if (i == vif->ar->vif_max) { - ath6kl_err("Invalid interface to bring up P2P\n"); - return -EINVAL; - } - } - - /* need to clean up enhanced bmiss detection fw state */ - ath6kl_cfg80211_sta_bmiss_enhance(vif, false); - -set_iface_type: - switch (type) { - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_P2P_CLIENT: - vif->next_mode = INFRA_NETWORK; - break; - case NL80211_IFTYPE_ADHOC: - vif->next_mode = ADHOC_NETWORK; - break; - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_P2P_GO: - vif->next_mode = AP_NETWORK; - break; - default: - ath6kl_err("invalid interface type %u\n", type); - return -EOPNOTSUPP; - } - - vif->wdev.iftype = type; - - return 0; -} - -static int ath6kl_cfg80211_join_ibss(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_ibss_params *ibss_param) -{ - struct ath6kl *ar = ath6kl_priv(dev); - struct ath6kl_vif *vif = netdev_priv(dev); - int status; - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - vif->ssid_len = ibss_param->ssid_len; - memcpy(vif->ssid, ibss_param->ssid, vif->ssid_len); - - if (ibss_param->chandef.chan) - vif->ch_hint = ibss_param->chandef.chan->center_freq; - - if (ibss_param->channel_fixed) { - /* - * TODO: channel_fixed: The channel should be fixed, do not - * search for IBSSs to join on other channels. Target - * firmware does not support this feature, needs to be - * updated. - */ - return -EOPNOTSUPP; - } - - memset(vif->req_bssid, 0, sizeof(vif->req_bssid)); - if (ibss_param->bssid && !is_broadcast_ether_addr(ibss_param->bssid)) - memcpy(vif->req_bssid, ibss_param->bssid, - sizeof(vif->req_bssid)); - - ath6kl_set_wpa_version(vif, 0); - - status = ath6kl_set_auth_type(vif, NL80211_AUTHTYPE_OPEN_SYSTEM); - if (status) - return status; - - if (ibss_param->privacy) { - ath6kl_set_cipher(vif, WLAN_CIPHER_SUITE_WEP40, true); - ath6kl_set_cipher(vif, WLAN_CIPHER_SUITE_WEP40, false); - } else { - ath6kl_set_cipher(vif, 0, true); - ath6kl_set_cipher(vif, 0, false); - } - - vif->nw_type = vif->next_mode; - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "%s: connect called with authmode %d dot11 auth %d" - " PW crypto %d PW crypto len %d GRP crypto %d" - " GRP crypto len %d channel hint %u\n", - __func__, - vif->auth_mode, vif->dot11_auth_mode, vif->prwise_crypto, - vif->prwise_crypto_len, vif->grp_crypto, - vif->grp_crypto_len, vif->ch_hint); - - status = ath6kl_wmi_connect_cmd(ar->wmi, vif->fw_vif_idx, vif->nw_type, - vif->dot11_auth_mode, vif->auth_mode, - vif->prwise_crypto, - vif->prwise_crypto_len, - vif->grp_crypto, vif->grp_crypto_len, - vif->ssid_len, vif->ssid, - vif->req_bssid, vif->ch_hint, - ar->connect_ctrl_flags, SUBTYPE_NONE); - set_bit(CONNECT_PEND, &vif->flags); - - return 0; -} - -static int ath6kl_cfg80211_leave_ibss(struct wiphy *wiphy, - struct net_device *dev) -{ - struct ath6kl_vif *vif = netdev_priv(dev); - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - ath6kl_disconnect(vif); - memset(vif->ssid, 0, sizeof(vif->ssid)); - vif->ssid_len = 0; - - return 0; -} - -static const u32 cipher_suites[] = { - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, - CCKM_KRK_CIPHER_SUITE, - WLAN_CIPHER_SUITE_SMS4, -}; - -static bool is_rate_legacy(s32 rate) -{ - static const s32 legacy[] = { 1000, 2000, 5500, 11000, - 6000, 9000, 12000, 18000, 24000, - 36000, 48000, 54000 - }; - u8 i; - - for (i = 0; i < ARRAY_SIZE(legacy); i++) - if (rate == legacy[i]) - return true; - - return false; -} - -static bool is_rate_ht20(s32 rate, u8 *mcs, bool *sgi) -{ - static const s32 ht20[] = { 6500, 13000, 19500, 26000, 39000, - 52000, 58500, 65000, 72200 - }; - u8 i; - - for (i = 0; i < ARRAY_SIZE(ht20); i++) { - if (rate == ht20[i]) { - if (i == ARRAY_SIZE(ht20) - 1) - /* last rate uses sgi */ - *sgi = true; - else - *sgi = false; - - *mcs = i; - return true; - } - } - return false; -} - -static bool is_rate_ht40(s32 rate, u8 *mcs, bool *sgi) -{ - static const s32 ht40[] = { 13500, 27000, 40500, 54000, - 81000, 108000, 121500, 135000, - 150000 - }; - u8 i; - - for (i = 0; i < ARRAY_SIZE(ht40); i++) { - if (rate == ht40[i]) { - if (i == ARRAY_SIZE(ht40) - 1) - /* last rate uses sgi */ - *sgi = true; - else - *sgi = false; - - *mcs = i; - return true; - } - } - - return false; -} - -static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, - u8 *mac, struct station_info *sinfo) -{ - struct ath6kl *ar = ath6kl_priv(dev); - struct ath6kl_vif *vif = netdev_priv(dev); - long left; - bool sgi; - s32 rate; - int ret; - u8 mcs; - - if (memcmp(mac, vif->bssid, ETH_ALEN) != 0) - return -ENOENT; - - if (down_interruptible(&ar->sem)) - return -EBUSY; - - set_bit(STATS_UPDATE_PEND, &vif->flags); - - ret = ath6kl_wmi_get_stats_cmd(ar->wmi, vif->fw_vif_idx); - - if (ret != 0) { - up(&ar->sem); - return -EIO; - } - - left = wait_event_interruptible_timeout(ar->event_wq, - !test_bit(STATS_UPDATE_PEND, - &vif->flags), - WMI_TIMEOUT); - - up(&ar->sem); - - if (left == 0) - return -ETIMEDOUT; - else if (left < 0) - return left; - - if (vif->target_stats.rx_byte) { - sinfo->rx_bytes = vif->target_stats.rx_byte; - sinfo->filled |= STATION_INFO_RX_BYTES64; - sinfo->rx_packets = vif->target_stats.rx_pkt; - sinfo->filled |= STATION_INFO_RX_PACKETS; - } - - if (vif->target_stats.tx_byte) { - sinfo->tx_bytes = vif->target_stats.tx_byte; - sinfo->filled |= STATION_INFO_TX_BYTES64; - sinfo->tx_packets = vif->target_stats.tx_pkt; - sinfo->filled |= STATION_INFO_TX_PACKETS; - } - - sinfo->signal = vif->target_stats.cs_rssi; - sinfo->filled |= STATION_INFO_SIGNAL; - - rate = vif->target_stats.tx_ucast_rate; - - if (is_rate_legacy(rate)) { - sinfo->txrate.legacy = rate / 100; - } else if (is_rate_ht20(rate, &mcs, &sgi)) { - if (sgi) { - sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; - sinfo->txrate.mcs = mcs - 1; - } else { - sinfo->txrate.mcs = mcs; - } - - sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; - } else if (is_rate_ht40(rate, &mcs, &sgi)) { - if (sgi) { - sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; - sinfo->txrate.mcs = mcs - 1; - } else { - sinfo->txrate.mcs = mcs; - } - - sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; - sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; - } else { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "invalid rate from stats: %d\n", rate); - ath6kl_debug_war(ar, ATH6KL_WAR_INVALID_RATE); - return 0; - } - - sinfo->filled |= STATION_INFO_TX_BITRATE; - - if (test_bit(CONNECTED, &vif->flags) && - test_bit(DTIM_PERIOD_AVAIL, &vif->flags) && - vif->nw_type == INFRA_NETWORK) { - sinfo->filled |= STATION_INFO_BSS_PARAM; - sinfo->bss_param.flags = 0; - sinfo->bss_param.dtim_period = vif->assoc_bss_dtim_period; - sinfo->bss_param.beacon_interval = vif->assoc_bss_beacon_int; - } - - return 0; -} - -static int ath6kl_set_pmksa(struct wiphy *wiphy, struct net_device *netdev, - struct cfg80211_pmksa *pmksa) -{ - struct ath6kl *ar = ath6kl_priv(netdev); - struct ath6kl_vif *vif = netdev_priv(netdev); - - return ath6kl_wmi_setpmkid_cmd(ar->wmi, vif->fw_vif_idx, pmksa->bssid, - pmksa->pmkid, true); -} - -static int ath6kl_del_pmksa(struct wiphy *wiphy, struct net_device *netdev, - struct cfg80211_pmksa *pmksa) -{ - struct ath6kl *ar = ath6kl_priv(netdev); - struct ath6kl_vif *vif = netdev_priv(netdev); - - return ath6kl_wmi_setpmkid_cmd(ar->wmi, vif->fw_vif_idx, pmksa->bssid, - pmksa->pmkid, false); -} - -static int ath6kl_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) -{ - struct ath6kl *ar = ath6kl_priv(netdev); - struct ath6kl_vif *vif = netdev_priv(netdev); - - if (test_bit(CONNECTED, &vif->flags)) - return ath6kl_wmi_setpmkid_cmd(ar->wmi, vif->fw_vif_idx, - vif->bssid, NULL, false); - return 0; -} - -static int ath6kl_wow_usr(struct ath6kl *ar, struct ath6kl_vif *vif, - struct cfg80211_wowlan *wow, u32 *filter) -{ - int ret, pos; - u8 mask[WOW_PATTERN_SIZE]; - u16 i; - - /* Configure the patterns that we received from the user. */ - for (i = 0; i < wow->n_patterns; i++) { - - /* - * Convert given nl80211 specific mask value to equivalent - * driver specific mask value and send it to the chip along - * with patterns. For example, If the mask value defined in - * struct cfg80211_wowlan is 0xA (equivalent binary is 1010), - * then equivalent driver specific mask value is - * "0xFF 0x00 0xFF 0x00". - */ - memset(&mask, 0, sizeof(mask)); - for (pos = 0; pos < wow->patterns[i].pattern_len; pos++) { - if (wow->patterns[i].mask[pos / 8] & (0x1 << (pos % 8))) - mask[pos] = 0xFF; - } - /* - * Note: Pattern's offset is not passed as part of wowlan - * parameter from CFG layer. So it's always passed as ZERO - * to the firmware. It means, given WOW patterns are always - * matched from the first byte of received pkt in the firmware. - */ - ret = ath6kl_wmi_add_wow_pattern_cmd(ar->wmi, - vif->fw_vif_idx, WOW_LIST_ID, - wow->patterns[i].pattern_len, - 0 /* pattern offset */, - wow->patterns[i].pattern, mask); - if (ret) - return ret; - } - - if (wow->disconnect) - *filter |= WOW_FILTER_OPTION_NWK_DISASSOC; - - if (wow->magic_pkt) - *filter |= WOW_FILTER_OPTION_MAGIC_PACKET; - - if (wow->gtk_rekey_failure) - *filter |= WOW_FILTER_OPTION_GTK_ERROR; - - if (wow->eap_identity_req) - *filter |= WOW_FILTER_OPTION_EAP_REQ; - - if (wow->four_way_handshake) - *filter |= WOW_FILTER_OPTION_8021X_4WAYHS; - - return 0; -} - -static int ath6kl_wow_ap(struct ath6kl *ar, struct ath6kl_vif *vif) -{ - static const u8 unicst_pattern[] = { 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x08 }; - static const u8 unicst_mask[] = { 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x7f }; - u8 unicst_offset = 0; - static const u8 arp_pattern[] = { 0x08, 0x06 }; - static const u8 arp_mask[] = { 0xff, 0xff }; - u8 arp_offset = 20; - static const u8 discvr_pattern[] = { 0xe0, 0x00, 0x00, 0xf8 }; - static const u8 discvr_mask[] = { 0xf0, 0x00, 0x00, 0xf8 }; - u8 discvr_offset = 38; - static const u8 dhcp_pattern[] = { 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x43 /* port 67 */ }; - static const u8 dhcp_mask[] = { 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff /* port 67 */ }; - u8 dhcp_offset = 0; - int ret; - - /* Setup unicast IP, EAPOL-like and ARP pkt pattern */ - ret = ath6kl_wmi_add_wow_pattern_cmd(ar->wmi, - vif->fw_vif_idx, WOW_LIST_ID, - sizeof(unicst_pattern), unicst_offset, - unicst_pattern, unicst_mask); - if (ret) { - ath6kl_err("failed to add WOW unicast IP pattern\n"); - return ret; - } - - /* Setup all ARP pkt pattern */ - ret = ath6kl_wmi_add_wow_pattern_cmd(ar->wmi, - vif->fw_vif_idx, WOW_LIST_ID, - sizeof(arp_pattern), arp_offset, - arp_pattern, arp_mask); - if (ret) { - ath6kl_err("failed to add WOW ARP pattern\n"); - return ret; - } - - /* - * Setup multicast pattern for mDNS 224.0.0.251, - * SSDP 239.255.255.250 and LLMNR 224.0.0.252 - */ - ret = ath6kl_wmi_add_wow_pattern_cmd(ar->wmi, - vif->fw_vif_idx, WOW_LIST_ID, - sizeof(discvr_pattern), discvr_offset, - discvr_pattern, discvr_mask); - if (ret) { - ath6kl_err("failed to add WOW mDNS/SSDP/LLMNR pattern\n"); - return ret; - } - - /* Setup all DHCP broadcast pkt pattern */ - ret = ath6kl_wmi_add_wow_pattern_cmd(ar->wmi, - vif->fw_vif_idx, WOW_LIST_ID, - sizeof(dhcp_pattern), dhcp_offset, - dhcp_pattern, dhcp_mask); - if (ret) { - ath6kl_err("failed to add WOW DHCP broadcast pattern\n"); - return ret; - } - - return 0; -} - -static int ath6kl_wow_sta(struct ath6kl *ar, struct ath6kl_vif *vif) -{ - struct net_device *ndev = vif->ndev; - static const u8 discvr_pattern[] = { 0xe0, 0x00, 0x00, 0xf8 }; - static const u8 discvr_mask[] = { 0xf0, 0x00, 0x00, 0xf8 }; - u8 discvr_offset = 38; - u8 mac_mask[ETH_ALEN]; - int ret; - - /* Setup unicast pkt pattern */ - memset(mac_mask, 0xff, ETH_ALEN); - ret = ath6kl_wmi_add_wow_pattern_cmd(ar->wmi, - vif->fw_vif_idx, WOW_LIST_ID, - ETH_ALEN, 0, ndev->dev_addr, - mac_mask); - if (ret) { - ath6kl_err("failed to add WOW unicast pattern\n"); - return ret; - } - - /* - * Setup multicast pattern for mDNS 224.0.0.251, - * SSDP 239.255.255.250 and LLMNR 224.0.0.252 - */ - if ((ndev->flags & IFF_ALLMULTI) || - (ndev->flags & IFF_MULTICAST && netdev_mc_count(ndev) > 0)) { - ret = ath6kl_wmi_add_wow_pattern_cmd(ar->wmi, - vif->fw_vif_idx, WOW_LIST_ID, - sizeof(discvr_pattern), discvr_offset, - discvr_pattern, discvr_mask); - if (ret) { - ath6kl_err("failed to add WOW mDNS/SSDP/LLMNR pattern\n"); - return ret; - } - } - - return 0; -} - -static int is_hsleep_mode_procsed(struct ath6kl_vif *vif) -{ - return test_bit(HOST_SLEEP_MODE_CMD_PROCESSED, &vif->flags); -} - -static bool is_ctrl_ep_empty(struct ath6kl *ar) -{ - return !ar->tx_pending[ar->ctrl_ep]; -} - -static int ath6kl_cfg80211_host_sleep(struct ath6kl *ar, struct ath6kl_vif *vif) -{ - int ret, left; - - clear_bit(HOST_SLEEP_MODE_CMD_PROCESSED, &vif->flags); - - ret = ath6kl_wmi_set_host_sleep_mode_cmd(ar->wmi, vif->fw_vif_idx, - ATH6KL_HOST_MODE_ASLEEP); - if (ret) - return ret; - - left = wait_event_interruptible_timeout(ar->event_wq, - is_hsleep_mode_procsed(vif), - WMI_TIMEOUT); - if (left == 0) { - ath6kl_warn("timeout, didn't get host sleep cmd processed event\n"); - ret = -ETIMEDOUT; - } else if (left < 0) { - ath6kl_warn("error while waiting for host sleep cmd processed event %d\n", - left); - ret = left; - } - - if (ar->tx_pending[ar->ctrl_ep]) { - left = wait_event_interruptible_timeout(ar->event_wq, - is_ctrl_ep_empty(ar), - WMI_TIMEOUT); - if (left == 0) { - ath6kl_warn("clear wmi ctrl data timeout\n"); - ret = -ETIMEDOUT; - } else if (left < 0) { - ath6kl_warn("clear wmi ctrl data failed: %d\n", left); - ret = left; - } - } - - return ret; -} - -static int ath6kl_wow_suspend_vif(struct ath6kl_vif *vif, - struct cfg80211_wowlan *wow, u32 *filter) -{ - struct ath6kl *ar = vif->ar; - struct in_device *in_dev; - struct in_ifaddr *ifa; - int ret; - u16 i, bmiss_time; - __be32 ips[MAX_IP_ADDRS]; - u8 index = 0; - - if (!test_bit(NETDEV_MCAST_ALL_ON, &vif->flags) && - test_bit(ATH6KL_FW_CAPABILITY_WOW_MULTICAST_FILTER, - ar->fw_capabilities)) { - ret = ath6kl_wmi_mcast_filter_cmd(vif->ar->wmi, - vif->fw_vif_idx, false); - if (ret) - return ret; - } - - /* Clear existing WOW patterns */ - for (i = 0; i < WOW_MAX_FILTERS_PER_LIST; i++) - ath6kl_wmi_del_wow_pattern_cmd(ar->wmi, vif->fw_vif_idx, - WOW_LIST_ID, i); - - /* - * Skip the default WOW pattern configuration - * if the driver receives any WOW patterns from - * the user. - */ - if (wow) - ret = ath6kl_wow_usr(ar, vif, wow, filter); - else if (vif->nw_type == AP_NETWORK) - ret = ath6kl_wow_ap(ar, vif); - else - ret = ath6kl_wow_sta(ar, vif); - - if (ret) - return ret; - - netif_stop_queue(vif->ndev); - - if (vif->nw_type != AP_NETWORK) { - ret = ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx, - ATH6KL_MAX_WOW_LISTEN_INTL, - 0); - if (ret) - return ret; - - /* Set listen interval x 15 times as bmiss time */ - bmiss_time = ATH6KL_MAX_WOW_LISTEN_INTL * 15; - if (bmiss_time > ATH6KL_MAX_BMISS_TIME) - bmiss_time = ATH6KL_MAX_BMISS_TIME; - - ret = ath6kl_wmi_bmisstime_cmd(ar->wmi, vif->fw_vif_idx, - bmiss_time, 0); - if (ret) - return ret; - - ret = ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, - 0xFFFF, 0, 0xFFFF, 0, 0, 0, - 0, 0, 0, 0); - if (ret) - return ret; - } - - /* Setup own IP addr for ARP agent. */ - in_dev = __in_dev_get_rtnl(vif->ndev); - if (!in_dev) - return 0; - - ifa = in_dev->ifa_list; - memset(&ips, 0, sizeof(ips)); - - /* Configure IP addr only if IP address count < MAX_IP_ADDRS */ - while (index < MAX_IP_ADDRS && ifa) { - ips[index] = ifa->ifa_local; - ifa = ifa->ifa_next; - index++; - } - - if (ifa) { - ath6kl_err("total IP addr count is exceeding fw limit\n"); - return -EINVAL; - } - - ret = ath6kl_wmi_set_ip_cmd(ar->wmi, vif->fw_vif_idx, ips[0], ips[1]); - if (ret) { - ath6kl_err("fail to setup ip for arp agent\n"); - return ret; - } - - return ret; -} - -static int ath6kl_wow_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow) -{ - struct ath6kl_vif *first_vif, *vif; - int ret = 0; - u32 filter = 0; - bool connected = false; - - /* enter / leave wow suspend on first vif always */ - first_vif = ath6kl_vif_first(ar); - if (WARN_ON(unlikely(!first_vif)) || - !ath6kl_cfg80211_ready(first_vif)) - return -EIO; - - if (wow && (wow->n_patterns > WOW_MAX_FILTERS_PER_LIST)) - return -EINVAL; - - /* install filters for each connected vif */ - spin_lock_bh(&ar->list_lock); - list_for_each_entry(vif, &ar->vif_list, list) { - if (!test_bit(CONNECTED, &vif->flags) || - !ath6kl_cfg80211_ready(vif)) - continue; - connected = true; - - ret = ath6kl_wow_suspend_vif(vif, wow, &filter); - if (ret) - break; - } - spin_unlock_bh(&ar->list_lock); - - if (!connected) - return -ENOTCONN; - else if (ret) - return ret; - - ar->state = ATH6KL_STATE_SUSPENDING; - - ret = ath6kl_wmi_set_wow_mode_cmd(ar->wmi, first_vif->fw_vif_idx, - ATH6KL_WOW_MODE_ENABLE, - filter, - WOW_HOST_REQ_DELAY); - if (ret) - return ret; - - return ath6kl_cfg80211_host_sleep(ar, first_vif); -} - -static int ath6kl_wow_resume_vif(struct ath6kl_vif *vif) -{ - struct ath6kl *ar = vif->ar; - int ret; - - if (vif->nw_type != AP_NETWORK) { - ret = ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, - 0, 0, 0, 0, 0, 0, 3, 0, 0, 0); - if (ret) - return ret; - - ret = ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx, - vif->listen_intvl_t, 0); - if (ret) - return ret; - - ret = ath6kl_wmi_bmisstime_cmd(ar->wmi, vif->fw_vif_idx, - vif->bmiss_time_t, 0); - if (ret) - return ret; - } - - if (!test_bit(NETDEV_MCAST_ALL_OFF, &vif->flags) && - test_bit(ATH6KL_FW_CAPABILITY_WOW_MULTICAST_FILTER, - ar->fw_capabilities)) { - ret = ath6kl_wmi_mcast_filter_cmd(vif->ar->wmi, - vif->fw_vif_idx, true); - if (ret) - return ret; - } - - netif_wake_queue(vif->ndev); - - return 0; -} - -static int ath6kl_wow_resume(struct ath6kl *ar) -{ - struct ath6kl_vif *vif; - int ret; - - vif = ath6kl_vif_first(ar); - if (WARN_ON(unlikely(!vif)) || - !ath6kl_cfg80211_ready(vif)) - return -EIO; - - ar->state = ATH6KL_STATE_RESUMING; - - ret = ath6kl_wmi_set_host_sleep_mode_cmd(ar->wmi, vif->fw_vif_idx, - ATH6KL_HOST_MODE_AWAKE); - if (ret) { - ath6kl_warn("Failed to configure host sleep mode for wow resume: %d\n", - ret); - goto cleanup; - } - - spin_lock_bh(&ar->list_lock); - list_for_each_entry(vif, &ar->vif_list, list) { - if (!test_bit(CONNECTED, &vif->flags) || - !ath6kl_cfg80211_ready(vif)) - continue; - ret = ath6kl_wow_resume_vif(vif); - if (ret) - break; - } - spin_unlock_bh(&ar->list_lock); - - if (ret) - goto cleanup; - - ar->state = ATH6KL_STATE_ON; - return 0; - -cleanup: - ar->state = ATH6KL_STATE_WOW; - return ret; -} - -static int ath6kl_cfg80211_deepsleep_suspend(struct ath6kl *ar) -{ - struct ath6kl_vif *vif; - int ret; - - vif = ath6kl_vif_first(ar); - if (!vif) - return -EIO; - - if (!test_bit(WMI_READY, &ar->flag)) { - ath6kl_err("deepsleep failed as wmi is not ready\n"); - return -EIO; - } - - ath6kl_cfg80211_stop_all(ar); - - /* Save the current power mode before enabling power save */ - ar->wmi->saved_pwr_mode = ar->wmi->pwr_mode; - - ret = ath6kl_wmi_powermode_cmd(ar->wmi, 0, REC_POWER); - if (ret) - return ret; - - /* Disable WOW mode */ - ret = ath6kl_wmi_set_wow_mode_cmd(ar->wmi, vif->fw_vif_idx, - ATH6KL_WOW_MODE_DISABLE, - 0, 0); - if (ret) - return ret; - - /* Flush all non control pkts in TX path */ - ath6kl_tx_data_cleanup(ar); - - ret = ath6kl_cfg80211_host_sleep(ar, vif); - if (ret) - return ret; - - return 0; -} - -static int ath6kl_cfg80211_deepsleep_resume(struct ath6kl *ar) -{ - struct ath6kl_vif *vif; - int ret; - - vif = ath6kl_vif_first(ar); - - if (!vif) - return -EIO; - - if (ar->wmi->pwr_mode != ar->wmi->saved_pwr_mode) { - ret = ath6kl_wmi_powermode_cmd(ar->wmi, 0, - ar->wmi->saved_pwr_mode); - if (ret) - return ret; - } - - ret = ath6kl_wmi_set_host_sleep_mode_cmd(ar->wmi, vif->fw_vif_idx, - ATH6KL_HOST_MODE_AWAKE); - if (ret) - return ret; - - ar->state = ATH6KL_STATE_ON; - - /* Reset scan parameter to default values */ - ret = ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, - 0, 0, 0, 0, 0, 0, 3, 0, 0, 0); - if (ret) - return ret; - - return 0; -} - -int ath6kl_cfg80211_suspend(struct ath6kl *ar, - enum ath6kl_cfg_suspend_mode mode, - struct cfg80211_wowlan *wow) -{ - struct ath6kl_vif *vif; - enum ath6kl_state prev_state; - int ret; - - switch (mode) { - case ATH6KL_CFG_SUSPEND_WOW: - - ath6kl_dbg(ATH6KL_DBG_SUSPEND, "wow mode suspend\n"); - - /* Flush all non control pkts in TX path */ - ath6kl_tx_data_cleanup(ar); - - prev_state = ar->state; - - ret = ath6kl_wow_suspend(ar, wow); - if (ret) { - ar->state = prev_state; - return ret; - } - - ar->state = ATH6KL_STATE_WOW; - break; - - case ATH6KL_CFG_SUSPEND_DEEPSLEEP: - - ath6kl_dbg(ATH6KL_DBG_SUSPEND, "deep sleep suspend\n"); - - ret = ath6kl_cfg80211_deepsleep_suspend(ar); - if (ret) { - ath6kl_err("deepsleep suspend failed: %d\n", ret); - return ret; - } - - ar->state = ATH6KL_STATE_DEEPSLEEP; - - break; - - case ATH6KL_CFG_SUSPEND_CUTPOWER: - - ath6kl_cfg80211_stop_all(ar); - - if (ar->state == ATH6KL_STATE_OFF) { - ath6kl_dbg(ATH6KL_DBG_SUSPEND, - "suspend hw off, no action for cutpower\n"); - break; - } - - ath6kl_dbg(ATH6KL_DBG_SUSPEND, "suspend cutting power\n"); - - ret = ath6kl_init_hw_stop(ar); - if (ret) { - ath6kl_warn("failed to stop hw during suspend: %d\n", - ret); - } - - ar->state = ATH6KL_STATE_CUTPOWER; - - break; - - default: - break; - } - - list_for_each_entry(vif, &ar->vif_list, list) - ath6kl_cfg80211_scan_complete_event(vif, true); - - return 0; -} -EXPORT_SYMBOL(ath6kl_cfg80211_suspend); - -int ath6kl_cfg80211_resume(struct ath6kl *ar) -{ - int ret; - - switch (ar->state) { - case ATH6KL_STATE_WOW: - ath6kl_dbg(ATH6KL_DBG_SUSPEND, "wow mode resume\n"); - - ret = ath6kl_wow_resume(ar); - if (ret) { - ath6kl_warn("wow mode resume failed: %d\n", ret); - return ret; - } - - break; - - case ATH6KL_STATE_DEEPSLEEP: - ath6kl_dbg(ATH6KL_DBG_SUSPEND, "deep sleep resume\n"); - - ret = ath6kl_cfg80211_deepsleep_resume(ar); - if (ret) { - ath6kl_warn("deep sleep resume failed: %d\n", ret); - return ret; - } - break; - - case ATH6KL_STATE_CUTPOWER: - ath6kl_dbg(ATH6KL_DBG_SUSPEND, "resume restoring power\n"); - - ret = ath6kl_init_hw_start(ar); - if (ret) { - ath6kl_warn("Failed to boot hw in resume: %d\n", ret); - return ret; - } - break; - - default: - break; - } - - return 0; -} -EXPORT_SYMBOL(ath6kl_cfg80211_resume); - -#ifdef CONFIG_PM - -/* hif layer decides what suspend mode to use */ -static int __ath6kl_cfg80211_suspend(struct wiphy *wiphy, - struct cfg80211_wowlan *wow) -{ - struct ath6kl *ar = wiphy_priv(wiphy); - - ath6kl_recovery_suspend(ar); - - return ath6kl_hif_suspend(ar, wow); -} - -static int __ath6kl_cfg80211_resume(struct wiphy *wiphy) -{ - struct ath6kl *ar = wiphy_priv(wiphy); - int err; - - err = ath6kl_hif_resume(ar); - if (err) - return err; - - ath6kl_recovery_resume(ar); - - return 0; -} - -/* - * FIXME: WOW suspend mode is selected if the host sdio controller supports - * both sdio irq wake up and keep power. The target pulls sdio data line to - * wake up the host when WOW pattern matches. This causes sdio irq handler - * is being called in the host side which internally hits ath6kl's RX path. - * - * Since sdio interrupt is not disabled, RX path executes even before - * the host executes the actual resume operation from PM module. - * - * In the current scenario, WOW resume should happen before start processing - * any data from the target. So It's required to perform WOW resume in RX path. - * Ideally we should perform WOW resume only in the actual platform - * resume path. This area needs bit rework to avoid WOW resume in RX path. - * - * ath6kl_check_wow_status() is called from ath6kl_rx(). - */ -void ath6kl_check_wow_status(struct ath6kl *ar) -{ - if (ar->state == ATH6KL_STATE_SUSPENDING) - return; - - if (ar->state == ATH6KL_STATE_WOW) - ath6kl_cfg80211_resume(ar); -} - -#else - -void ath6kl_check_wow_status(struct ath6kl *ar) -{ -} -#endif - -static int ath6kl_set_htcap(struct ath6kl_vif *vif, enum ieee80211_band band, - bool ht_enable) -{ - struct ath6kl_htcap *htcap = &vif->htcap[band]; - - if (htcap->ht_enable == ht_enable) - return 0; - - if (ht_enable) { - /* Set default ht capabilities */ - htcap->ht_enable = true; - htcap->cap_info = (band == IEEE80211_BAND_2GHZ) ? - ath6kl_g_htcap : ath6kl_a_htcap; - htcap->ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K; - } else /* Disable ht */ - memset(htcap, 0, sizeof(*htcap)); - - return ath6kl_wmi_set_htcap_cmd(vif->ar->wmi, vif->fw_vif_idx, - band, htcap); -} - -static int ath6kl_restore_htcap(struct ath6kl_vif *vif) -{ - struct wiphy *wiphy = vif->ar->wiphy; - int band, ret = 0; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - if (!wiphy->bands[band]) - continue; - - ret = ath6kl_set_htcap(vif, band, - wiphy->bands[band]->ht_cap.ht_supported); - if (ret) - return ret; - } - - return ret; -} - -static bool ath6kl_is_p2p_ie(const u8 *pos) -{ - return pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 && - pos[2] == 0x50 && pos[3] == 0x6f && - pos[4] == 0x9a && pos[5] == 0x09; -} - -static int ath6kl_set_ap_probe_resp_ies(struct ath6kl_vif *vif, - const u8 *ies, size_t ies_len) -{ - struct ath6kl *ar = vif->ar; - const u8 *pos; - u8 *buf = NULL; - size_t len = 0; - int ret; - - /* - * Filter out P2P IE(s) since they will be included depending on - * the Probe Request frame in ath6kl_send_go_probe_resp(). - */ - - if (ies && ies_len) { - buf = kmalloc(ies_len, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - pos = ies; - while (pos + 1 < ies + ies_len) { - if (pos + 2 + pos[1] > ies + ies_len) - break; - if (!ath6kl_is_p2p_ie(pos)) { - memcpy(buf + len, pos, 2 + pos[1]); - len += 2 + pos[1]; - } - pos += 2 + pos[1]; - } - } - - ret = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx, - WMI_FRAME_PROBE_RESP, buf, len); - kfree(buf); - return ret; -} - -static int ath6kl_set_ies(struct ath6kl_vif *vif, - struct cfg80211_beacon_data *info) -{ - struct ath6kl *ar = vif->ar; - int res; - - /* this also clears IE in fw if it's not set */ - res = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx, - WMI_FRAME_BEACON, - info->beacon_ies, - info->beacon_ies_len); - if (res) - return res; - - /* this also clears IE in fw if it's not set */ - res = ath6kl_set_ap_probe_resp_ies(vif, info->proberesp_ies, - info->proberesp_ies_len); - if (res) - return res; - - /* this also clears IE in fw if it's not set */ - res = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx, - WMI_FRAME_ASSOC_RESP, - info->assocresp_ies, - info->assocresp_ies_len); - if (res) - return res; - - return 0; -} - -static int ath6kl_get_rsn_capab(struct cfg80211_beacon_data *beacon, - u8 *rsn_capab) -{ - const u8 *rsn_ie; - size_t rsn_ie_len; - u16 cnt; - - if (!beacon->tail) - return -EINVAL; - - rsn_ie = cfg80211_find_ie(WLAN_EID_RSN, beacon->tail, beacon->tail_len); - if (!rsn_ie) - return -EINVAL; - - rsn_ie_len = *(rsn_ie + 1); - /* skip element id and length */ - rsn_ie += 2; - - /* skip version */ - if (rsn_ie_len < 2) - return -EINVAL; - rsn_ie += 2; - rsn_ie_len -= 2; - - /* skip group cipher suite */ - if (rsn_ie_len < 4) - return 0; - rsn_ie += 4; - rsn_ie_len -= 4; - - /* skip pairwise cipher suite */ - if (rsn_ie_len < 2) - return 0; - cnt = get_unaligned_le16(rsn_ie); - rsn_ie += (2 + cnt * 4); - rsn_ie_len -= (2 + cnt * 4); - - /* skip akm suite */ - if (rsn_ie_len < 2) - return 0; - cnt = get_unaligned_le16(rsn_ie); - rsn_ie += (2 + cnt * 4); - rsn_ie_len -= (2 + cnt * 4); - - if (rsn_ie_len < 2) - return 0; - - memcpy(rsn_capab, rsn_ie, 2); - - return 0; -} - -static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ap_settings *info) -{ - struct ath6kl *ar = ath6kl_priv(dev); - struct ath6kl_vif *vif = netdev_priv(dev); - struct ieee80211_mgmt *mgmt; - bool hidden = false; - u8 *ies; - int ies_len; - struct wmi_connect_cmd p; - int res; - int i, ret; - u16 rsn_capab = 0; - int inactivity_timeout = 0; - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s:\n", __func__); - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - if (vif->next_mode != AP_NETWORK) - return -EOPNOTSUPP; - - res = ath6kl_set_ies(vif, &info->beacon); - - ar->ap_mode_bkey.valid = false; - - ret = ath6kl_wmi_ap_set_beacon_intvl_cmd(ar->wmi, vif->fw_vif_idx, - info->beacon_interval); - - if (ret) - ath6kl_warn("Failed to set beacon interval: %d\n", ret); - - ret = ath6kl_wmi_ap_set_dtim_cmd(ar->wmi, vif->fw_vif_idx, - info->dtim_period); - - /* ignore error, just print a warning and continue normally */ - if (ret) - ath6kl_warn("Failed to set dtim_period in beacon: %d\n", ret); - - if (info->beacon.head == NULL) - return -EINVAL; - mgmt = (struct ieee80211_mgmt *) info->beacon.head; - ies = mgmt->u.beacon.variable; - if (ies > info->beacon.head + info->beacon.head_len) - return -EINVAL; - ies_len = info->beacon.head + info->beacon.head_len - ies; - - if (info->ssid == NULL) - return -EINVAL; - memcpy(vif->ssid, info->ssid, info->ssid_len); - vif->ssid_len = info->ssid_len; - if (info->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) - hidden = true; - - res = ath6kl_wmi_ap_hidden_ssid(ar->wmi, vif->fw_vif_idx, hidden); - if (res) - return res; - - ret = ath6kl_set_auth_type(vif, info->auth_type); - if (ret) - return ret; - - memset(&p, 0, sizeof(p)); - - for (i = 0; i < info->crypto.n_akm_suites; i++) { - switch (info->crypto.akm_suites[i]) { - case WLAN_AKM_SUITE_8021X: - if (info->crypto.wpa_versions & NL80211_WPA_VERSION_1) - p.auth_mode |= WPA_AUTH; - if (info->crypto.wpa_versions & NL80211_WPA_VERSION_2) - p.auth_mode |= WPA2_AUTH; - break; - case WLAN_AKM_SUITE_PSK: - if (info->crypto.wpa_versions & NL80211_WPA_VERSION_1) - p.auth_mode |= WPA_PSK_AUTH; - if (info->crypto.wpa_versions & NL80211_WPA_VERSION_2) - p.auth_mode |= WPA2_PSK_AUTH; - break; - } - } - if (p.auth_mode == 0) - p.auth_mode = NONE_AUTH; - vif->auth_mode = p.auth_mode; - - for (i = 0; i < info->crypto.n_ciphers_pairwise; i++) { - switch (info->crypto.ciphers_pairwise[i]) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - p.prwise_crypto_type |= WEP_CRYPT; - break; - case WLAN_CIPHER_SUITE_TKIP: - p.prwise_crypto_type |= TKIP_CRYPT; - break; - case WLAN_CIPHER_SUITE_CCMP: - p.prwise_crypto_type |= AES_CRYPT; - break; - case WLAN_CIPHER_SUITE_SMS4: - p.prwise_crypto_type |= WAPI_CRYPT; - break; - } - } - if (p.prwise_crypto_type == 0) { - p.prwise_crypto_type = NONE_CRYPT; - ath6kl_set_cipher(vif, 0, true); - } else if (info->crypto.n_ciphers_pairwise == 1) - ath6kl_set_cipher(vif, info->crypto.ciphers_pairwise[0], true); - - switch (info->crypto.cipher_group) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - p.grp_crypto_type = WEP_CRYPT; - break; - case WLAN_CIPHER_SUITE_TKIP: - p.grp_crypto_type = TKIP_CRYPT; - break; - case WLAN_CIPHER_SUITE_CCMP: - p.grp_crypto_type = AES_CRYPT; - break; - case WLAN_CIPHER_SUITE_SMS4: - p.grp_crypto_type = WAPI_CRYPT; - break; - default: - p.grp_crypto_type = NONE_CRYPT; - break; - } - ath6kl_set_cipher(vif, info->crypto.cipher_group, false); - - p.nw_type = AP_NETWORK; - vif->nw_type = vif->next_mode; - - p.ssid_len = vif->ssid_len; - memcpy(p.ssid, vif->ssid, vif->ssid_len); - p.dot11_auth_mode = vif->dot11_auth_mode; - p.ch = cpu_to_le16(info->chandef.chan->center_freq); - - /* Enable uAPSD support by default */ - res = ath6kl_wmi_ap_set_apsd(ar->wmi, vif->fw_vif_idx, true); - if (res < 0) - return res; - - if (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO) { - p.nw_subtype = SUBTYPE_P2PGO; - } else { - /* - * Due to firmware limitation, it is not possible to - * do P2P mgmt operations in AP mode - */ - p.nw_subtype = SUBTYPE_NONE; - } - - if (info->inactivity_timeout) { - - inactivity_timeout = info->inactivity_timeout; - - if (ar->hw.flags & ATH6KL_HW_AP_INACTIVITY_MINS) - inactivity_timeout = DIV_ROUND_UP(inactivity_timeout, - 60); - - res = ath6kl_wmi_set_inact_period(ar->wmi, vif->fw_vif_idx, - inactivity_timeout); - if (res < 0) - return res; - } - - if (ath6kl_set_htcap(vif, info->chandef.chan->band, - cfg80211_get_chandef_type(&info->chandef) - != NL80211_CHAN_NO_HT)) - return -EIO; - - /* - * Get the PTKSA replay counter in the RSN IE. Supplicant - * will use the RSN IE in M3 message and firmware has to - * advertise the same in beacon/probe response. Send - * the complete RSN IE capability field to firmware - */ - if (!ath6kl_get_rsn_capab(&info->beacon, (u8 *) &rsn_capab) && - test_bit(ATH6KL_FW_CAPABILITY_RSN_CAP_OVERRIDE, - ar->fw_capabilities)) { - res = ath6kl_wmi_set_ie_cmd(ar->wmi, vif->fw_vif_idx, - WLAN_EID_RSN, WMI_RSN_IE_CAPB, - (const u8 *) &rsn_capab, - sizeof(rsn_capab)); - vif->rsn_capab = rsn_capab; - if (res < 0) - return res; - } - - memcpy(&vif->profile, &p, sizeof(p)); - res = ath6kl_wmi_ap_profile_commit(ar->wmi, vif->fw_vif_idx, &p); - if (res < 0) - return res; - - return 0; -} - -static int ath6kl_change_beacon(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_beacon_data *beacon) -{ - struct ath6kl_vif *vif = netdev_priv(dev); - - if (!ath6kl_cfg80211_ready(vif)) - return -EIO; - - if (vif->next_mode != AP_NETWORK) - return -EOPNOTSUPP; - - return ath6kl_set_ies(vif, beacon); -} - -static int ath6kl_stop_ap(struct wiphy *wiphy, struct net_device *dev) -{ - struct ath6kl *ar = ath6kl_priv(dev); - struct ath6kl_vif *vif = netdev_priv(dev); - - if (vif->nw_type != AP_NETWORK) - return -EOPNOTSUPP; - if (!test_bit(CONNECTED, &vif->flags)) - return -ENOTCONN; - - ath6kl_wmi_disconnect_cmd(ar->wmi, vif->fw_vif_idx); - clear_bit(CONNECTED, &vif->flags); - - /* Restore ht setting in firmware */ - return ath6kl_restore_htcap(vif); -} - -static const u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - -static int ath6kl_del_station(struct wiphy *wiphy, struct net_device *dev, - u8 *mac) -{ - struct ath6kl *ar = ath6kl_priv(dev); - struct ath6kl_vif *vif = netdev_priv(dev); - const u8 *addr = mac ? mac : bcast_addr; - - return ath6kl_wmi_ap_set_mlme(ar->wmi, vif->fw_vif_idx, WMI_AP_DEAUTH, - addr, WLAN_REASON_PREV_AUTH_NOT_VALID); -} - -static int ath6kl_change_station(struct wiphy *wiphy, struct net_device *dev, - u8 *mac, struct station_parameters *params) -{ - struct ath6kl *ar = ath6kl_priv(dev); - struct ath6kl_vif *vif = netdev_priv(dev); - int err; - - if (vif->nw_type != AP_NETWORK) - return -EOPNOTSUPP; - - err = cfg80211_check_station_change(wiphy, params, - CFG80211_STA_AP_MLME_CLIENT); - if (err) - return err; - - if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) - return ath6kl_wmi_ap_set_mlme(ar->wmi, vif->fw_vif_idx, - WMI_AP_MLME_AUTHORIZE, mac, 0); - return ath6kl_wmi_ap_set_mlme(ar->wmi, vif->fw_vif_idx, - WMI_AP_MLME_UNAUTHORIZE, mac, 0); -} - -static int ath6kl_remain_on_channel(struct wiphy *wiphy, - struct wireless_dev *wdev, - struct ieee80211_channel *chan, - unsigned int duration, - u64 *cookie) -{ - struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev); - struct ath6kl *ar = ath6kl_priv(vif->ndev); - u32 id; - - /* TODO: if already pending or ongoing remain-on-channel, - * return -EBUSY */ - id = ++vif->last_roc_id; - if (id == 0) { - /* Do not use 0 as the cookie value */ - id = ++vif->last_roc_id; - } - *cookie = id; - - return ath6kl_wmi_remain_on_chnl_cmd(ar->wmi, vif->fw_vif_idx, - chan->center_freq, duration); -} - -static int ath6kl_cancel_remain_on_channel(struct wiphy *wiphy, - struct wireless_dev *wdev, - u64 cookie) -{ - struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev); - struct ath6kl *ar = ath6kl_priv(vif->ndev); - - if (cookie != vif->last_roc_id) - return -ENOENT; - vif->last_cancel_roc_id = cookie; - - return ath6kl_wmi_cancel_remain_on_chnl_cmd(ar->wmi, vif->fw_vif_idx); -} - -static int ath6kl_send_go_probe_resp(struct ath6kl_vif *vif, - const u8 *buf, size_t len, - unsigned int freq) -{ - struct ath6kl *ar = vif->ar; - const u8 *pos; - u8 *p2p; - int p2p_len; - int ret; - const struct ieee80211_mgmt *mgmt; - - mgmt = (const struct ieee80211_mgmt *) buf; - - /* Include P2P IE(s) from the frame generated in user space. */ - - p2p = kmalloc(len, GFP_KERNEL); - if (p2p == NULL) - return -ENOMEM; - p2p_len = 0; - - pos = mgmt->u.probe_resp.variable; - while (pos + 1 < buf + len) { - if (pos + 2 + pos[1] > buf + len) - break; - if (ath6kl_is_p2p_ie(pos)) { - memcpy(p2p + p2p_len, pos, 2 + pos[1]); - p2p_len += 2 + pos[1]; - } - pos += 2 + pos[1]; - } - - ret = ath6kl_wmi_send_probe_response_cmd(ar->wmi, vif->fw_vif_idx, freq, - mgmt->da, p2p, p2p_len); - kfree(p2p); - return ret; -} - -static bool ath6kl_mgmt_powersave_ap(struct ath6kl_vif *vif, - u32 id, - u32 freq, - u32 wait, - const u8 *buf, - size_t len, - bool *more_data, - bool no_cck) -{ - struct ieee80211_mgmt *mgmt; - struct ath6kl_sta *conn; - bool is_psq_empty = false; - struct ath6kl_mgmt_buff *mgmt_buf; - size_t mgmt_buf_size; - struct ath6kl *ar = vif->ar; - - mgmt = (struct ieee80211_mgmt *) buf; - if (is_multicast_ether_addr(mgmt->da)) - return false; - - conn = ath6kl_find_sta(vif, mgmt->da); - if (!conn) - return false; - - if (conn->sta_flags & STA_PS_SLEEP) { - if (!(conn->sta_flags & STA_PS_POLLED)) { - /* Queue the frames if the STA is sleeping */ - mgmt_buf_size = len + sizeof(struct ath6kl_mgmt_buff); - mgmt_buf = kmalloc(mgmt_buf_size, GFP_KERNEL); - if (!mgmt_buf) - return false; - - INIT_LIST_HEAD(&mgmt_buf->list); - mgmt_buf->id = id; - mgmt_buf->freq = freq; - mgmt_buf->wait = wait; - mgmt_buf->len = len; - mgmt_buf->no_cck = no_cck; - memcpy(mgmt_buf->buf, buf, len); - spin_lock_bh(&conn->psq_lock); - is_psq_empty = skb_queue_empty(&conn->psq) && - (conn->mgmt_psq_len == 0); - list_add_tail(&mgmt_buf->list, &conn->mgmt_psq); - conn->mgmt_psq_len++; - spin_unlock_bh(&conn->psq_lock); - - /* - * If this is the first pkt getting queued - * for this STA, update the PVB for this - * STA. - */ - if (is_psq_empty) - ath6kl_wmi_set_pvb_cmd(ar->wmi, vif->fw_vif_idx, - conn->aid, 1); - return true; - } - - /* - * This tx is because of a PsPoll. - * Determine if MoreData bit has to be set. - */ - spin_lock_bh(&conn->psq_lock); - if (!skb_queue_empty(&conn->psq) || (conn->mgmt_psq_len != 0)) - *more_data = true; - spin_unlock_bh(&conn->psq_lock); - } - - return false; -} - -/* Check if SSID length is greater than DIRECT- */ -static bool ath6kl_is_p2p_go_ssid(const u8 *buf, size_t len) -{ - const struct ieee80211_mgmt *mgmt; - mgmt = (const struct ieee80211_mgmt *) buf; - - /* variable[1] contains the SSID tag length */ - if (buf + len >= &mgmt->u.probe_resp.variable[1] && - (mgmt->u.probe_resp.variable[1] > P2P_WILDCARD_SSID_LEN)) { - return true; - } - - return false; -} - -static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, - struct ieee80211_channel *chan, bool offchan, - unsigned int wait, const u8 *buf, size_t len, - bool no_cck, bool dont_wait_for_ack, u64 *cookie) -{ - struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev); - struct ath6kl *ar = ath6kl_priv(vif->ndev); - u32 id; - const struct ieee80211_mgmt *mgmt; - bool more_data, queued; - - mgmt = (const struct ieee80211_mgmt *) buf; - if (vif->nw_type == AP_NETWORK && test_bit(CONNECTED, &vif->flags) && - ieee80211_is_probe_resp(mgmt->frame_control) && - ath6kl_is_p2p_go_ssid(buf, len)) { - /* - * Send Probe Response frame in GO mode using a separate WMI - * command to allow the target to fill in the generic IEs. - */ - *cookie = 0; /* TX status not supported */ - return ath6kl_send_go_probe_resp(vif, buf, len, - chan->center_freq); - } - - id = vif->send_action_id++; - if (id == 0) { - /* - * 0 is a reserved value in the WMI command and shall not be - * used for the command. - */ - id = vif->send_action_id++; - } - - *cookie = id; - - /* AP mode Power saving processing */ - if (vif->nw_type == AP_NETWORK) { - queued = ath6kl_mgmt_powersave_ap(vif, - id, chan->center_freq, - wait, buf, - len, &more_data, no_cck); - if (queued) - return 0; - } - - return ath6kl_wmi_send_mgmt_cmd(ar->wmi, vif->fw_vif_idx, id, - chan->center_freq, wait, - buf, len, no_cck); -} - -static void ath6kl_mgmt_frame_register(struct wiphy *wiphy, - struct wireless_dev *wdev, - u16 frame_type, bool reg) -{ - struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev); - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: frame_type=0x%x reg=%d\n", - __func__, frame_type, reg); - if (frame_type == IEEE80211_STYPE_PROBE_REQ) { - /* - * Note: This notification callback is not allowed to sleep, so - * we cannot send WMI_PROBE_REQ_REPORT_CMD here. Instead, we - * hardcode target to report Probe Request frames all the time. - */ - vif->probe_req_report = reg; - } -} - -static int ath6kl_cfg80211_sscan_start(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_sched_scan_request *request) -{ - struct ath6kl *ar = ath6kl_priv(dev); - struct ath6kl_vif *vif = netdev_priv(dev); - u16 interval; - int ret, rssi_thold; - - if (ar->state != ATH6KL_STATE_ON) - return -EIO; - - if (vif->sme_state != SME_DISCONNECTED) - return -EBUSY; - - ath6kl_cfg80211_scan_complete_event(vif, true); - - ret = ath6kl_set_probed_ssids(ar, vif, request->ssids, - request->n_ssids, - request->match_sets, - request->n_match_sets); - if (ret < 0) - return ret; - - if (!request->n_match_sets) { - ret = ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, - ALL_BSS_FILTER, 0); - if (ret < 0) - return ret; - } else { - ret = ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, - MATCHED_SSID_FILTER, 0); - if (ret < 0) - return ret; - } - - if (test_bit(ATH6KL_FW_CAPABILITY_RSSI_SCAN_THOLD, - ar->fw_capabilities)) { - if (request->rssi_thold <= NL80211_SCAN_RSSI_THOLD_OFF) - rssi_thold = 0; - else if (request->rssi_thold < -127) - rssi_thold = -127; - else - rssi_thold = request->rssi_thold; - - ret = ath6kl_wmi_set_rssi_filter_cmd(ar->wmi, vif->fw_vif_idx, - rssi_thold); - if (ret) { - ath6kl_err("failed to set RSSI threshold for scan\n"); - return ret; - } - } - - /* fw uses seconds, also make sure that it's >0 */ - interval = max_t(u16, 1, request->interval / 1000); - - ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx, - interval, interval, - vif->bg_scan_period, 0, 0, 0, 3, 0, 0, 0); - - /* this also clears IE in fw if it's not set */ - ret = ath6kl_wmi_set_appie_cmd(ar->wmi, vif->fw_vif_idx, - WMI_FRAME_PROBE_REQ, - request->ie, request->ie_len); - if (ret) { - ath6kl_warn("Failed to set probe request IE for scheduled scan: %d\n", - ret); - return ret; - } - - ret = ath6kl_wmi_enable_sched_scan_cmd(ar->wmi, vif->fw_vif_idx, true); - if (ret) - return ret; - - set_bit(SCHED_SCANNING, &vif->flags); - - return 0; -} - -static int ath6kl_cfg80211_sscan_stop(struct wiphy *wiphy, - struct net_device *dev) -{ - struct ath6kl_vif *vif = netdev_priv(dev); - bool stopped; - - stopped = __ath6kl_cfg80211_sscan_stop(vif); - - if (!stopped) - return -EIO; - - return 0; -} - -static int ath6kl_cfg80211_set_bitrate(struct wiphy *wiphy, - struct net_device *dev, - const u8 *addr, - const struct cfg80211_bitrate_mask *mask) -{ - struct ath6kl *ar = ath6kl_priv(dev); - struct ath6kl_vif *vif = netdev_priv(dev); - - return ath6kl_wmi_set_bitrate_mask(ar->wmi, vif->fw_vif_idx, - mask); -} - -static int ath6kl_cfg80211_set_txe_config(struct wiphy *wiphy, - struct net_device *dev, - u32 rate, u32 pkts, u32 intvl) -{ - struct ath6kl *ar = ath6kl_priv(dev); - struct ath6kl_vif *vif = netdev_priv(dev); - - if (vif->nw_type != INFRA_NETWORK || - !test_bit(ATH6KL_FW_CAPABILITY_TX_ERR_NOTIFY, ar->fw_capabilities)) - return -EOPNOTSUPP; - - if (vif->sme_state != SME_CONNECTED) - return -ENOTCONN; - - /* save this since the firmware won't report the interval */ - vif->txe_intvl = intvl; - - return ath6kl_wmi_set_txe_notify(ar->wmi, vif->fw_vif_idx, - rate, pkts, intvl); -} - -static const struct ieee80211_txrx_stypes -ath6kl_mgmt_stypes[NUM_NL80211_IFTYPES] = { - [NL80211_IFTYPE_STATION] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_AP] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_P2P_CLIENT] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_P2P_GO] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, -}; - -static struct cfg80211_ops ath6kl_cfg80211_ops = { - .add_virtual_intf = ath6kl_cfg80211_add_iface, - .del_virtual_intf = ath6kl_cfg80211_del_iface, - .change_virtual_intf = ath6kl_cfg80211_change_iface, - .scan = ath6kl_cfg80211_scan, - .connect = ath6kl_cfg80211_connect, - .disconnect = ath6kl_cfg80211_disconnect, - .add_key = ath6kl_cfg80211_add_key, - .get_key = ath6kl_cfg80211_get_key, - .del_key = ath6kl_cfg80211_del_key, - .set_default_key = ath6kl_cfg80211_set_default_key, - .set_wiphy_params = ath6kl_cfg80211_set_wiphy_params, - .set_tx_power = ath6kl_cfg80211_set_txpower, - .get_tx_power = ath6kl_cfg80211_get_txpower, - .set_power_mgmt = ath6kl_cfg80211_set_power_mgmt, - .join_ibss = ath6kl_cfg80211_join_ibss, - .leave_ibss = ath6kl_cfg80211_leave_ibss, - .get_station = ath6kl_get_station, - .set_pmksa = ath6kl_set_pmksa, - .del_pmksa = ath6kl_del_pmksa, - .flush_pmksa = ath6kl_flush_pmksa, - CFG80211_TESTMODE_CMD(ath6kl_tm_cmd) -#ifdef CONFIG_PM - .suspend = __ath6kl_cfg80211_suspend, - .resume = __ath6kl_cfg80211_resume, -#endif - .start_ap = ath6kl_start_ap, - .change_beacon = ath6kl_change_beacon, - .stop_ap = ath6kl_stop_ap, - .del_station = ath6kl_del_station, - .change_station = ath6kl_change_station, - .remain_on_channel = ath6kl_remain_on_channel, - .cancel_remain_on_channel = ath6kl_cancel_remain_on_channel, - .mgmt_tx = ath6kl_mgmt_tx, - .mgmt_frame_register = ath6kl_mgmt_frame_register, - .sched_scan_start = ath6kl_cfg80211_sscan_start, - .sched_scan_stop = ath6kl_cfg80211_sscan_stop, - .set_bitrate_mask = ath6kl_cfg80211_set_bitrate, - .set_cqm_txe_config = ath6kl_cfg80211_set_txe_config, -}; - -void ath6kl_cfg80211_stop(struct ath6kl_vif *vif) -{ - ath6kl_cfg80211_sscan_disable(vif); - - switch (vif->sme_state) { - case SME_DISCONNECTED: - break; - case SME_CONNECTING: - cfg80211_connect_result(vif->ndev, vif->bssid, NULL, 0, - NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, - GFP_KERNEL); - break; - case SME_CONNECTED: - cfg80211_disconnected(vif->ndev, 0, NULL, 0, GFP_KERNEL); - break; - } - - if (vif->ar->state != ATH6KL_STATE_RECOVERY && - (test_bit(CONNECTED, &vif->flags) || - test_bit(CONNECT_PEND, &vif->flags))) - ath6kl_wmi_disconnect_cmd(vif->ar->wmi, vif->fw_vif_idx); - - vif->sme_state = SME_DISCONNECTED; - clear_bit(CONNECTED, &vif->flags); - clear_bit(CONNECT_PEND, &vif->flags); - - /* Stop netdev queues, needed during recovery */ - netif_stop_queue(vif->ndev); - netif_carrier_off(vif->ndev); - - /* disable scanning */ - if (vif->ar->state != ATH6KL_STATE_RECOVERY && - ath6kl_wmi_scanparams_cmd(vif->ar->wmi, vif->fw_vif_idx, 0xFFFF, - 0, 0, 0, 0, 0, 0, 0, 0, 0) != 0) - ath6kl_warn("failed to disable scan during stop\n"); - - ath6kl_cfg80211_scan_complete_event(vif, true); -} - -void ath6kl_cfg80211_stop_all(struct ath6kl *ar) -{ - struct ath6kl_vif *vif; - - vif = ath6kl_vif_first(ar); - if (!vif && ar->state != ATH6KL_STATE_RECOVERY) { - /* save the current power mode before enabling power save */ - ar->wmi->saved_pwr_mode = ar->wmi->pwr_mode; - - if (ath6kl_wmi_powermode_cmd(ar->wmi, 0, REC_POWER) != 0) - ath6kl_warn("ath6kl_deep_sleep_enable: wmi_powermode_cmd failed\n"); - return; - } - - /* - * FIXME: we should take ar->list_lock to protect changes in the - * vif_list, but that's not trivial to do as ath6kl_cfg80211_stop() - * sleeps. - */ - list_for_each_entry(vif, &ar->vif_list, list) - ath6kl_cfg80211_stop(vif); -} - -static void ath6kl_cfg80211_reg_notify(struct wiphy *wiphy, - struct regulatory_request *request) -{ - struct ath6kl *ar = wiphy_priv(wiphy); - u32 rates[IEEE80211_NUM_BANDS]; - int ret, i; - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "cfg reg_notify %c%c%s%s initiator %d hint_type %d\n", - request->alpha2[0], request->alpha2[1], - request->intersect ? " intersect" : "", - request->processed ? " processed" : "", - request->initiator, request->user_reg_hint_type); - - if (request->user_reg_hint_type != NL80211_USER_REG_HINT_CELL_BASE) - return; - - ret = ath6kl_wmi_set_regdomain_cmd(ar->wmi, request->alpha2); - if (ret) { - ath6kl_err("failed to set regdomain: %d\n", ret); - return; - } - - /* - * Firmware will apply the regdomain change only after a scan is - * issued and it will send a WMI_REGDOMAIN_EVENTID when it has been - * changed. - */ - - for (i = 0; i < IEEE80211_NUM_BANDS; i++) - if (wiphy->bands[i]) - rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1; - - - ret = ath6kl_wmi_beginscan_cmd(ar->wmi, 0, WMI_LONG_SCAN, false, - false, 0, ATH6KL_FG_SCAN_INTERVAL, - 0, NULL, false, rates); - if (ret) { - ath6kl_err("failed to start scan for a regdomain change: %d\n", - ret); - return; - } -} - -static int ath6kl_cfg80211_vif_init(struct ath6kl_vif *vif) -{ - vif->aggr_cntxt = aggr_init(vif); - if (!vif->aggr_cntxt) { - ath6kl_err("failed to initialize aggr\n"); - return -ENOMEM; - } - - setup_timer(&vif->disconnect_timer, disconnect_timer_handler, - (unsigned long) vif->ndev); - setup_timer(&vif->sched_scan_timer, ath6kl_wmi_sscan_timer, - (unsigned long) vif); - - set_bit(WMM_ENABLED, &vif->flags); - spin_lock_init(&vif->if_lock); - - INIT_LIST_HEAD(&vif->mc_filter); - - return 0; -} - -void ath6kl_cfg80211_vif_stop(struct ath6kl_vif *vif, bool wmi_ready) -{ - static u8 bcast_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - bool discon_issued; - - netif_stop_queue(vif->ndev); - - clear_bit(WLAN_ENABLED, &vif->flags); - - if (wmi_ready) { - discon_issued = test_bit(CONNECTED, &vif->flags) || - test_bit(CONNECT_PEND, &vif->flags); - ath6kl_disconnect(vif); - del_timer(&vif->disconnect_timer); - - if (discon_issued) - ath6kl_disconnect_event(vif, DISCONNECT_CMD, - (vif->nw_type & AP_NETWORK) ? - bcast_mac : vif->bssid, - 0, NULL, 0); - } - - if (vif->scan_req) { - cfg80211_scan_done(vif->scan_req, true); - vif->scan_req = NULL; - } - - /* need to clean up enhanced bmiss detection fw state */ - ath6kl_cfg80211_sta_bmiss_enhance(vif, false); -} - -void ath6kl_cfg80211_vif_cleanup(struct ath6kl_vif *vif) -{ - struct ath6kl *ar = vif->ar; - struct ath6kl_mc_filter *mc_filter, *tmp; - - aggr_module_destroy(vif->aggr_cntxt); - - ar->avail_idx_map |= BIT(vif->fw_vif_idx); - - if (vif->nw_type == ADHOC_NETWORK) - ar->ibss_if_active = false; - - list_for_each_entry_safe(mc_filter, tmp, &vif->mc_filter, list) { - list_del(&mc_filter->list); - kfree(mc_filter); - } - - unregister_netdevice(vif->ndev); - - ar->num_vif--; -} - -struct wireless_dev *ath6kl_interface_add(struct ath6kl *ar, const char *name, - enum nl80211_iftype type, - u8 fw_vif_idx, u8 nw_type) -{ - struct net_device *ndev; - struct ath6kl_vif *vif; - - ndev = alloc_netdev(sizeof(*vif), name, ether_setup); - if (!ndev) - return NULL; - - vif = netdev_priv(ndev); - ndev->ieee80211_ptr = &vif->wdev; - vif->wdev.wiphy = ar->wiphy; - vif->ar = ar; - vif->ndev = ndev; - SET_NETDEV_DEV(ndev, wiphy_dev(vif->wdev.wiphy)); - vif->wdev.netdev = ndev; - vif->wdev.iftype = type; - vif->fw_vif_idx = fw_vif_idx; - vif->nw_type = nw_type; - vif->next_mode = nw_type; - vif->listen_intvl_t = ATH6KL_DEFAULT_LISTEN_INTVAL; - vif->bmiss_time_t = ATH6KL_DEFAULT_BMISS_TIME; - vif->bg_scan_period = 0; - vif->htcap[IEEE80211_BAND_2GHZ].ht_enable = true; - vif->htcap[IEEE80211_BAND_5GHZ].ht_enable = true; - - memcpy(ndev->dev_addr, ar->mac_addr, ETH_ALEN); - if (fw_vif_idx != 0) { - ndev->dev_addr[0] = (ndev->dev_addr[0] ^ (1 << fw_vif_idx)) | - 0x2; - if (test_bit(ATH6KL_FW_CAPABILITY_CUSTOM_MAC_ADDR, - ar->fw_capabilities)) - ndev->dev_addr[4] ^= 0x80; - } - - init_netdev(ndev); - - ath6kl_init_control_info(vif); - - if (ath6kl_cfg80211_vif_init(vif)) - goto err; - - if (register_netdevice(ndev)) - goto err; - - ar->avail_idx_map &= ~BIT(fw_vif_idx); - vif->sme_state = SME_DISCONNECTED; - set_bit(WLAN_ENABLED, &vif->flags); - ar->wlan_pwr_state = WLAN_POWER_STATE_ON; - - if (type == NL80211_IFTYPE_ADHOC) - ar->ibss_if_active = true; - - spin_lock_bh(&ar->list_lock); - list_add_tail(&vif->list, &ar->vif_list); - spin_unlock_bh(&ar->list_lock); - - return &vif->wdev; - -err: - aggr_module_destroy(vif->aggr_cntxt); - free_netdev(ndev); - return NULL; -} - -int ath6kl_cfg80211_init(struct ath6kl *ar) -{ - struct wiphy *wiphy = ar->wiphy; - bool band_2gig = false, band_5gig = false, ht = false; - int ret; - - wiphy->mgmt_stypes = ath6kl_mgmt_stypes; - - wiphy->max_remain_on_channel_duration = 5000; - - /* set device pointer for wiphy */ - set_wiphy_dev(wiphy, ar->dev); - - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_AP); - if (ar->p2p) { - wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_GO) | - BIT(NL80211_IFTYPE_P2P_CLIENT); - } - - if (config_enabled(CONFIG_ATH6KL_REGDOMAIN) && - test_bit(ATH6KL_FW_CAPABILITY_REGDOMAIN, ar->fw_capabilities)) { - wiphy->reg_notifier = ath6kl_cfg80211_reg_notify; - ar->wiphy->features |= NL80211_FEATURE_CELL_BASE_REG_HINTS; - } - - /* max num of ssids that can be probed during scanning */ - wiphy->max_scan_ssids = MAX_PROBED_SSIDS; - - /* max num of ssids that can be matched after scan */ - if (test_bit(ATH6KL_FW_CAPABILITY_SCHED_SCAN_MATCH_LIST, - ar->fw_capabilities)) - wiphy->max_match_sets = MAX_PROBED_SSIDS; - - wiphy->max_scan_ie_len = 1000; /* FIX: what is correct limit? */ - switch (ar->hw.cap) { - case WMI_11AN_CAP: - ht = true; - case WMI_11A_CAP: - band_5gig = true; - break; - case WMI_11GN_CAP: - ht = true; - case WMI_11G_CAP: - band_2gig = true; - break; - case WMI_11AGN_CAP: - ht = true; - case WMI_11AG_CAP: - band_2gig = true; - band_5gig = true; - break; - default: - ath6kl_err("invalid phy capability!\n"); - return -EINVAL; - } - - /* - * Even if the fw has HT support, advertise HT cap only when - * the firmware has support to override RSN capability, otherwise - * 4-way handshake would fail. - */ - if (!(ht && - test_bit(ATH6KL_FW_CAPABILITY_RSN_CAP_OVERRIDE, - ar->fw_capabilities))) { - ath6kl_band_2ghz.ht_cap.cap = 0; - ath6kl_band_2ghz.ht_cap.ht_supported = false; - ath6kl_band_5ghz.ht_cap.cap = 0; - ath6kl_band_5ghz.ht_cap.ht_supported = false; - } - - if (ar->hw.flags & ATH6KL_HW_64BIT_RATES) { - ath6kl_band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff; - ath6kl_band_5ghz.ht_cap.mcs.rx_mask[0] = 0xff; - ath6kl_band_2ghz.ht_cap.mcs.rx_mask[1] = 0xff; - ath6kl_band_5ghz.ht_cap.mcs.rx_mask[1] = 0xff; - } else { - ath6kl_band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff; - ath6kl_band_5ghz.ht_cap.mcs.rx_mask[0] = 0xff; - } - - if (band_2gig) - wiphy->bands[IEEE80211_BAND_2GHZ] = &ath6kl_band_2ghz; - if (band_5gig) - wiphy->bands[IEEE80211_BAND_5GHZ] = &ath6kl_band_5ghz; - - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - - wiphy->cipher_suites = cipher_suites; - wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); - -#ifdef CONFIG_PM - wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | - WIPHY_WOWLAN_DISCONNECT | - WIPHY_WOWLAN_GTK_REKEY_FAILURE | - WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | - WIPHY_WOWLAN_EAP_IDENTITY_REQ | - WIPHY_WOWLAN_4WAY_HANDSHAKE; - wiphy->wowlan.n_patterns = WOW_MAX_FILTERS_PER_LIST; - wiphy->wowlan.pattern_min_len = 1; - wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE; -#endif - - wiphy->max_sched_scan_ssids = MAX_PROBED_SSIDS; - - ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM | - WIPHY_FLAG_HAVE_AP_SME | - WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL | - WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD; - - if (test_bit(ATH6KL_FW_CAPABILITY_SCHED_SCAN_V2, ar->fw_capabilities)) - ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; - - if (test_bit(ATH6KL_FW_CAPABILITY_INACTIVITY_TIMEOUT, - ar->fw_capabilities)) - ar->wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER; - - ar->wiphy->probe_resp_offload = - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS | - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 | - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P; - - ret = wiphy_register(wiphy); - if (ret < 0) { - ath6kl_err("couldn't register wiphy device\n"); - return ret; - } - - ar->wiphy_registered = true; - - return 0; -} - -void ath6kl_cfg80211_cleanup(struct ath6kl *ar) -{ - wiphy_unregister(ar->wiphy); - - ar->wiphy_registered = false; -} - -struct ath6kl *ath6kl_cfg80211_create(void) -{ - struct ath6kl *ar; - struct wiphy *wiphy; - - /* create a new wiphy for use with cfg80211 */ - wiphy = wiphy_new(&ath6kl_cfg80211_ops, sizeof(struct ath6kl)); - - if (!wiphy) { - ath6kl_err("couldn't allocate wiphy device\n"); - return NULL; - } - - ar = wiphy_priv(wiphy); - ar->wiphy = wiphy; - - return ar; -} - -/* Note: ar variable must not be accessed after calling this! */ -void ath6kl_cfg80211_destroy(struct ath6kl *ar) -{ - int i; - - for (i = 0; i < AP_MAX_NUM_STA; i++) - kfree(ar->sta_list[i].aggr_conn); - - wiphy_free(ar->wiphy); -} - diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.h b/drivers/net/wireless/ath/ath6kl/cfg80211.h deleted file mode 100644 index b59becd91aea..000000000000 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef ATH6KL_CFG80211_H -#define ATH6KL_CFG80211_H - -enum ath6kl_cfg_suspend_mode { - ATH6KL_CFG_SUSPEND_DEEPSLEEP, - ATH6KL_CFG_SUSPEND_CUTPOWER, - ATH6KL_CFG_SUSPEND_WOW, -}; - -struct wireless_dev *ath6kl_interface_add(struct ath6kl *ar, const char *name, - enum nl80211_iftype type, - u8 fw_vif_idx, u8 nw_type); -void ath6kl_cfg80211_ch_switch_notify(struct ath6kl_vif *vif, int freq, - enum wmi_phy_mode mode); -void ath6kl_cfg80211_scan_complete_event(struct ath6kl_vif *vif, bool aborted); - -void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel, - u8 *bssid, u16 listen_intvl, - u16 beacon_intvl, - enum network_type nw_type, - u8 beacon_ie_len, u8 assoc_req_len, - u8 assoc_resp_len, u8 *assoc_info); - -void ath6kl_cfg80211_disconnect_event(struct ath6kl_vif *vif, u8 reason, - u8 *bssid, u8 assoc_resp_len, - u8 *assoc_info, u16 proto_reason); - -void ath6kl_cfg80211_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid, - bool ismcast); - -int ath6kl_cfg80211_suspend(struct ath6kl *ar, - enum ath6kl_cfg_suspend_mode mode, - struct cfg80211_wowlan *wow); - -int ath6kl_cfg80211_resume(struct ath6kl *ar); - -void ath6kl_cfg80211_vif_cleanup(struct ath6kl_vif *vif); - -void ath6kl_cfg80211_stop(struct ath6kl_vif *vif); -void ath6kl_cfg80211_stop_all(struct ath6kl *ar); - -int ath6kl_cfg80211_init(struct ath6kl *ar); -void ath6kl_cfg80211_cleanup(struct ath6kl *ar); - -struct ath6kl *ath6kl_cfg80211_create(void); -void ath6kl_cfg80211_destroy(struct ath6kl *ar); - -#endif /* ATH6KL_CFG80211_H */ diff --git a/drivers/net/wireless/ath/ath6kl/common.h b/drivers/net/wireless/ath/ath6kl/common.h deleted file mode 100644 index 98a886154d9c..000000000000 --- a/drivers/net/wireless/ath/ath6kl/common.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef COMMON_H -#define COMMON_H - -#include - -#define ATH6KL_MAX_IE 256 - -extern __printf(2, 3) -int ath6kl_printk(const char *level, const char *fmt, ...); - -/* - * Reflects the version of binary interface exposed by ATH6KL target - * firmware. Needs to be incremented by 1 for any change in the firmware - * that requires upgrade of the driver on the host side for the change to - * work correctly - */ -#define ATH6KL_ABI_VERSION 1 - -#define SIGNAL_QUALITY_METRICS_NUM_MAX 2 - -enum { - SIGNAL_QUALITY_METRICS_SNR = 0, - SIGNAL_QUALITY_METRICS_RSSI, - SIGNAL_QUALITY_METRICS_ALL, -}; - -/* - * Data Path - */ - -#define WMI_MAX_TX_DATA_FRAME_LENGTH \ - (1500 + sizeof(struct wmi_data_hdr) + \ - sizeof(struct ethhdr) + \ - sizeof(struct ath6kl_llc_snap_hdr)) - -/* An AMSDU frame */ /* The MAX AMSDU length of AR6003 is 3839 */ -#define WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH \ - (3840 + sizeof(struct wmi_data_hdr) + \ - sizeof(struct ethhdr) + \ - sizeof(struct ath6kl_llc_snap_hdr)) - -#define EPPING_ALIGNMENT_PAD \ - (((sizeof(struct htc_frame_hdr) + 3) & (~0x3)) \ - - sizeof(struct htc_frame_hdr)) - -struct ath6kl_llc_snap_hdr { - u8 dsap; - u8 ssap; - u8 cntl; - u8 org_code[3]; - __be16 eth_type; -} __packed; - -enum crypto_type { - NONE_CRYPT = 0x01, - WEP_CRYPT = 0x02, - TKIP_CRYPT = 0x04, - AES_CRYPT = 0x08, - WAPI_CRYPT = 0x10, -}; - -struct htc_endpoint_credit_dist; -struct ath6kl; -struct ath6kl_htcap; -enum htc_credit_dist_reason; -struct ath6kl_htc_credit_info; - -struct sk_buff *ath6kl_buf_alloc(int size); -#endif /* COMMON_H */ diff --git a/drivers/net/wireless/ath/ath6kl/core.c b/drivers/net/wireless/ath/ath6kl/core.c deleted file mode 100644 index 4b46adbe8c92..000000000000 --- a/drivers/net/wireless/ath/ath6kl/core.c +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Copyright (c) 2004-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "core.h" - -#include -#include -#include -#include - -#include "debug.h" -#include "hif-ops.h" -#include "htc-ops.h" -#include "cfg80211.h" - -unsigned int debug_mask; -static unsigned int suspend_mode; -static unsigned int wow_mode; -static unsigned int uart_debug; -static unsigned int ath6kl_p2p; -static unsigned int testmode; -static unsigned int recovery_enable; -static unsigned int heart_beat_poll; - -module_param(debug_mask, uint, 0644); -module_param(suspend_mode, uint, 0644); -module_param(wow_mode, uint, 0644); -module_param(uart_debug, uint, 0644); -module_param(ath6kl_p2p, uint, 0644); -module_param(testmode, uint, 0644); -module_param(recovery_enable, uint, 0644); -module_param(heart_beat_poll, uint, 0644); -MODULE_PARM_DESC(recovery_enable, "Enable recovery from firmware error"); -MODULE_PARM_DESC(heart_beat_poll, "Enable fw error detection periodic" \ - "polling. This also specifies the polling interval in" \ - "msecs. Set reocvery_enable for this to be effective"); - -void ath6kl_core_tx_complete(struct ath6kl *ar, struct sk_buff *skb) -{ - ath6kl_htc_tx_complete(ar, skb); -} -EXPORT_SYMBOL(ath6kl_core_tx_complete); - -void ath6kl_core_rx_complete(struct ath6kl *ar, struct sk_buff *skb, u8 pipe) -{ - ath6kl_htc_rx_complete(ar, skb, pipe); -} -EXPORT_SYMBOL(ath6kl_core_rx_complete); - -int ath6kl_core_init(struct ath6kl *ar, enum ath6kl_htc_type htc_type) -{ - struct ath6kl_bmi_target_info targ_info; - struct wireless_dev *wdev; - int ret = 0, i; - - switch (htc_type) { - case ATH6KL_HTC_TYPE_MBOX: - ath6kl_htc_mbox_attach(ar); - break; - case ATH6KL_HTC_TYPE_PIPE: - ath6kl_htc_pipe_attach(ar); - break; - default: - WARN_ON(1); - return -ENOMEM; - } - - ar->ath6kl_wq = create_singlethread_workqueue("ath6kl"); - if (!ar->ath6kl_wq) - return -ENOMEM; - - ret = ath6kl_bmi_init(ar); - if (ret) - goto err_wq; - - /* - * Turn on power to get hardware (target) version and leave power - * on delibrately as we will boot the hardware anyway within few - * seconds. - */ - ret = ath6kl_hif_power_on(ar); - if (ret) - goto err_bmi_cleanup; - - ret = ath6kl_bmi_get_target_info(ar, &targ_info); - if (ret) - goto err_power_off; - - ar->version.target_ver = le32_to_cpu(targ_info.version); - ar->target_type = le32_to_cpu(targ_info.type); - ar->wiphy->hw_version = le32_to_cpu(targ_info.version); - - ret = ath6kl_init_hw_params(ar); - if (ret) - goto err_power_off; - - ar->htc_target = ath6kl_htc_create(ar); - - if (!ar->htc_target) { - ret = -ENOMEM; - goto err_power_off; - } - - ar->testmode = testmode; - - ret = ath6kl_init_fetch_firmwares(ar); - if (ret) - goto err_htc_cleanup; - - /* FIXME: we should free all firmwares in the error cases below */ - - /* Indicate that WMI is enabled (although not ready yet) */ - set_bit(WMI_ENABLED, &ar->flag); - ar->wmi = ath6kl_wmi_init(ar); - if (!ar->wmi) { - ath6kl_err("failed to initialize wmi\n"); - ret = -EIO; - goto err_htc_cleanup; - } - - ath6kl_dbg(ATH6KL_DBG_TRC, "%s: got wmi @ 0x%p.\n", __func__, ar->wmi); - - /* setup access class priority mappings */ - ar->ac_stream_pri_map[WMM_AC_BK] = 0; /* lowest */ - ar->ac_stream_pri_map[WMM_AC_BE] = 1; - ar->ac_stream_pri_map[WMM_AC_VI] = 2; - ar->ac_stream_pri_map[WMM_AC_VO] = 3; /* highest */ - - /* allocate some buffers that handle larger AMSDU frames */ - ath6kl_refill_amsdu_rxbufs(ar, ATH6KL_MAX_AMSDU_RX_BUFFERS); - - ath6kl_cookie_init(ar); - - ar->conf_flags = ATH6KL_CONF_IGNORE_ERP_BARKER | - ATH6KL_CONF_ENABLE_11N | ATH6KL_CONF_ENABLE_TX_BURST; - - if (suspend_mode && - suspend_mode >= WLAN_POWER_STATE_CUT_PWR && - suspend_mode <= WLAN_POWER_STATE_WOW) - ar->suspend_mode = suspend_mode; - else - ar->suspend_mode = 0; - - if (suspend_mode == WLAN_POWER_STATE_WOW && - (wow_mode == WLAN_POWER_STATE_CUT_PWR || - wow_mode == WLAN_POWER_STATE_DEEP_SLEEP)) - ar->wow_suspend_mode = wow_mode; - else - ar->wow_suspend_mode = 0; - - if (uart_debug) - ar->conf_flags |= ATH6KL_CONF_UART_DEBUG; - - set_bit(FIRST_BOOT, &ar->flag); - - ath6kl_debug_init(ar); - - ret = ath6kl_init_hw_start(ar); - if (ret) { - ath6kl_err("Failed to start hardware: %d\n", ret); - goto err_rxbuf_cleanup; - } - - /* give our connected endpoints some buffers */ - ath6kl_rx_refill(ar->htc_target, ar->ctrl_ep); - ath6kl_rx_refill(ar->htc_target, ar->ac2ep_map[WMM_AC_BE]); - - ret = ath6kl_cfg80211_init(ar); - if (ret) - goto err_rxbuf_cleanup; - - ret = ath6kl_debug_init_fs(ar); - if (ret) { - wiphy_unregister(ar->wiphy); - goto err_rxbuf_cleanup; - } - - for (i = 0; i < ar->vif_max; i++) - ar->avail_idx_map |= BIT(i); - - rtnl_lock(); - - /* Add an initial station interface */ - wdev = ath6kl_interface_add(ar, "wlan%d", NL80211_IFTYPE_STATION, 0, - INFRA_NETWORK); - - rtnl_unlock(); - - if (!wdev) { - ath6kl_err("Failed to instantiate a network device\n"); - ret = -ENOMEM; - wiphy_unregister(ar->wiphy); - goto err_rxbuf_cleanup; - } - - ath6kl_dbg(ATH6KL_DBG_TRC, "%s: name=%s dev=0x%p, ar=0x%p\n", - __func__, wdev->netdev->name, wdev->netdev, ar); - - ar->fw_recovery.enable = !!recovery_enable; - if (!ar->fw_recovery.enable) - return ret; - - if (heart_beat_poll && - test_bit(ATH6KL_FW_CAPABILITY_HEART_BEAT_POLL, - ar->fw_capabilities)) - ar->fw_recovery.hb_poll = heart_beat_poll; - - ath6kl_recovery_init(ar); - - return ret; - -err_rxbuf_cleanup: - ath6kl_debug_cleanup(ar); - ath6kl_htc_flush_rx_buf(ar->htc_target); - ath6kl_cleanup_amsdu_rxbufs(ar); - ath6kl_wmi_shutdown(ar->wmi); - clear_bit(WMI_ENABLED, &ar->flag); - ar->wmi = NULL; -err_htc_cleanup: - ath6kl_htc_cleanup(ar->htc_target); -err_power_off: - ath6kl_hif_power_off(ar); -err_bmi_cleanup: - ath6kl_bmi_cleanup(ar); -err_wq: - destroy_workqueue(ar->ath6kl_wq); - - return ret; -} -EXPORT_SYMBOL(ath6kl_core_init); - -struct ath6kl *ath6kl_core_create(struct device *dev) -{ - struct ath6kl *ar; - u8 ctr; - - ar = ath6kl_cfg80211_create(); - if (!ar) - return NULL; - - ar->p2p = !!ath6kl_p2p; - ar->dev = dev; - - ar->vif_max = 1; - - ar->max_norm_iface = 1; - - spin_lock_init(&ar->lock); - spin_lock_init(&ar->mcastpsq_lock); - spin_lock_init(&ar->list_lock); - - init_waitqueue_head(&ar->event_wq); - sema_init(&ar->sem, 1); - - INIT_LIST_HEAD(&ar->amsdu_rx_buffer_queue); - INIT_LIST_HEAD(&ar->vif_list); - - clear_bit(WMI_ENABLED, &ar->flag); - clear_bit(SKIP_SCAN, &ar->flag); - clear_bit(DESTROY_IN_PROGRESS, &ar->flag); - - ar->tx_pwr = 0; - ar->intra_bss = 1; - ar->lrssi_roam_threshold = DEF_LRSSI_ROAM_THRESHOLD; - - ar->state = ATH6KL_STATE_OFF; - - memset((u8 *)ar->sta_list, 0, - AP_MAX_NUM_STA * sizeof(struct ath6kl_sta)); - - /* Init the PS queues */ - for (ctr = 0; ctr < AP_MAX_NUM_STA; ctr++) { - spin_lock_init(&ar->sta_list[ctr].psq_lock); - skb_queue_head_init(&ar->sta_list[ctr].psq); - skb_queue_head_init(&ar->sta_list[ctr].apsdq); - ar->sta_list[ctr].mgmt_psq_len = 0; - INIT_LIST_HEAD(&ar->sta_list[ctr].mgmt_psq); - ar->sta_list[ctr].aggr_conn = - kzalloc(sizeof(struct aggr_info_conn), GFP_KERNEL); - if (!ar->sta_list[ctr].aggr_conn) { - ath6kl_err("Failed to allocate memory for sta aggregation information\n"); - ath6kl_core_destroy(ar); - return NULL; - } - } - - skb_queue_head_init(&ar->mcastpsq); - - memcpy(ar->ap_country_code, DEF_AP_COUNTRY_CODE, 3); - - return ar; -} -EXPORT_SYMBOL(ath6kl_core_create); - -void ath6kl_core_cleanup(struct ath6kl *ar) -{ - ath6kl_hif_power_off(ar); - - ath6kl_recovery_cleanup(ar); - - destroy_workqueue(ar->ath6kl_wq); - - if (ar->htc_target) - ath6kl_htc_cleanup(ar->htc_target); - - ath6kl_cookie_cleanup(ar); - - ath6kl_cleanup_amsdu_rxbufs(ar); - - ath6kl_bmi_cleanup(ar); - - ath6kl_debug_cleanup(ar); - - kfree(ar->fw_board); - kfree(ar->fw_otp); - vfree(ar->fw); - kfree(ar->fw_patch); - kfree(ar->fw_testscript); - - ath6kl_cfg80211_cleanup(ar); -} -EXPORT_SYMBOL(ath6kl_core_cleanup); - -void ath6kl_core_destroy(struct ath6kl *ar) -{ - ath6kl_cfg80211_destroy(ar); -} -EXPORT_SYMBOL(ath6kl_core_destroy); - -MODULE_AUTHOR("Qualcomm Atheros"); -MODULE_DESCRIPTION("Core module for AR600x SDIO and USB devices."); -MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h deleted file mode 100644 index 26b0f92424e1..000000000000 --- a/drivers/net/wireless/ath/ath6kl/core.h +++ /dev/null @@ -1,964 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef CORE_H -#define CORE_H - -#include -#include -#include -#include -#include -#include -#include "htc.h" -#include "wmi.h" -#include "bmi.h" -#include "target.h" - -#define MAX_ATH6KL 1 -#define ATH6KL_MAX_RX_BUFFERS 16 -#define ATH6KL_BUFFER_SIZE 1664 -#define ATH6KL_MAX_AMSDU_RX_BUFFERS 4 -#define ATH6KL_AMSDU_REFILL_THRESHOLD 3 -#define ATH6KL_AMSDU_BUFFER_SIZE (WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH + 128) -#define MAX_MSDU_SUBFRAME_PAYLOAD_LEN 1508 -#define MIN_MSDU_SUBFRAME_PAYLOAD_LEN 46 - -#define USER_SAVEDKEYS_STAT_INIT 0 -#define USER_SAVEDKEYS_STAT_RUN 1 - -#define ATH6KL_TX_TIMEOUT 10 -#define ATH6KL_MAX_ENDPOINTS 4 -#define MAX_NODE_NUM 15 - -#define ATH6KL_APSD_ALL_FRAME 0xFFFF -#define ATH6KL_APSD_NUM_OF_AC 0x4 -#define ATH6KL_APSD_FRAME_MASK 0xF - -/* Extra bytes for htc header alignment */ -#define ATH6KL_HTC_ALIGN_BYTES 3 - -/* MAX_HI_COOKIE_NUM are reserved for high priority traffic */ -#define MAX_DEF_COOKIE_NUM 180 -#define MAX_HI_COOKIE_NUM 18 /* 10% of MAX_COOKIE_NUM */ -#define MAX_COOKIE_NUM (MAX_DEF_COOKIE_NUM + MAX_HI_COOKIE_NUM) - -#define MAX_DEFAULT_SEND_QUEUE_DEPTH (MAX_DEF_COOKIE_NUM / WMM_NUM_AC) - -#define DISCON_TIMER_INTVAL 10000 /* in msec */ - -/* Channel dwell time in fg scan */ -#define ATH6KL_FG_SCAN_INTERVAL 50 /* in ms */ - -/* includes also the null byte */ -#define ATH6KL_FIRMWARE_MAGIC "QCA-ATH6KL" - -enum ath6kl_fw_ie_type { - ATH6KL_FW_IE_FW_VERSION = 0, - ATH6KL_FW_IE_TIMESTAMP = 1, - ATH6KL_FW_IE_OTP_IMAGE = 2, - ATH6KL_FW_IE_FW_IMAGE = 3, - ATH6KL_FW_IE_PATCH_IMAGE = 4, - ATH6KL_FW_IE_RESERVED_RAM_SIZE = 5, - ATH6KL_FW_IE_CAPABILITIES = 6, - ATH6KL_FW_IE_PATCH_ADDR = 7, - ATH6KL_FW_IE_BOARD_ADDR = 8, - ATH6KL_FW_IE_VIF_MAX = 9, -}; - -enum ath6kl_fw_capability { - ATH6KL_FW_CAPABILITY_HOST_P2P = 0, - ATH6KL_FW_CAPABILITY_SCHED_SCAN = 1, - - /* - * Firmware is capable of supporting P2P mgmt operations on a - * station interface. After group formation, the station - * interface will become a P2P client/GO interface as the case may be - */ - ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX, - - /* - * Firmware has support to cleanup inactive stations - * in AP mode. - */ - ATH6KL_FW_CAPABILITY_INACTIVITY_TIMEOUT, - - /* Firmware has support to override rsn cap of rsn ie */ - ATH6KL_FW_CAPABILITY_RSN_CAP_OVERRIDE, - - /* - * Multicast support in WOW and host awake mode. - * Allow all multicast in host awake mode. - * Apply multicast filter in WOW mode. - */ - ATH6KL_FW_CAPABILITY_WOW_MULTICAST_FILTER, - - /* Firmware supports enhanced bmiss detection */ - ATH6KL_FW_CAPABILITY_BMISS_ENHANCE, - - /* - * FW supports matching of ssid in schedule scan - */ - ATH6KL_FW_CAPABILITY_SCHED_SCAN_MATCH_LIST, - - /* Firmware supports filtering BSS results by RSSI */ - ATH6KL_FW_CAPABILITY_RSSI_SCAN_THOLD, - - /* FW sets mac_addr[4] ^= 0x80 for newly created interfaces */ - ATH6KL_FW_CAPABILITY_CUSTOM_MAC_ADDR, - - /* Firmware supports TX error rate notification */ - ATH6KL_FW_CAPABILITY_TX_ERR_NOTIFY, - - /* supports WMI_SET_REGDOMAIN_CMDID command */ - ATH6KL_FW_CAPABILITY_REGDOMAIN, - - /* Firmware supports sched scan decoupled from host sleep */ - ATH6KL_FW_CAPABILITY_SCHED_SCAN_V2, - - /* - * Firmware capability for hang detection through heart beat - * challenge messages. - */ - ATH6KL_FW_CAPABILITY_HEART_BEAT_POLL, - - /* this needs to be last */ - ATH6KL_FW_CAPABILITY_MAX, -}; - -#define ATH6KL_CAPABILITY_LEN (ALIGN(ATH6KL_FW_CAPABILITY_MAX, 32) / 32) - -struct ath6kl_fw_ie { - __le32 id; - __le32 len; - u8 data[0]; -}; - -enum ath6kl_hw_flags { - ATH6KL_HW_64BIT_RATES = BIT(0), - ATH6KL_HW_AP_INACTIVITY_MINS = BIT(1), - ATH6KL_HW_MAP_LP_ENDPOINT = BIT(2), - ATH6KL_HW_SDIO_CRC_ERROR_WAR = BIT(3), -}; - -#define ATH6KL_FW_API2_FILE "fw-2.bin" -#define ATH6KL_FW_API3_FILE "fw-3.bin" -#define ATH6KL_FW_API4_FILE "fw-4.bin" - -/* AR6003 1.0 definitions */ -#define AR6003_HW_1_0_VERSION 0x300002ba - -/* AR6003 2.0 definitions */ -#define AR6003_HW_2_0_VERSION 0x30000384 -#define AR6003_HW_2_0_PATCH_DOWNLOAD_ADDRESS 0x57e910 -#define AR6003_HW_2_0_FW_DIR "ath6k/AR6003/hw2.0" -#define AR6003_HW_2_0_OTP_FILE "otp.bin.z77" -#define AR6003_HW_2_0_FIRMWARE_FILE "athwlan.bin.z77" -#define AR6003_HW_2_0_TCMD_FIRMWARE_FILE "athtcmd_ram.bin" -#define AR6003_HW_2_0_PATCH_FILE "data.patch.bin" -#define AR6003_HW_2_0_BOARD_DATA_FILE AR6003_HW_2_0_FW_DIR "/bdata.bin" -#define AR6003_HW_2_0_DEFAULT_BOARD_DATA_FILE \ - AR6003_HW_2_0_FW_DIR "/bdata.SD31.bin" - -/* AR6003 3.0 definitions */ -#define AR6003_HW_2_1_1_VERSION 0x30000582 -#define AR6003_HW_2_1_1_FW_DIR "ath6k/AR6003/hw2.1.1" -#define AR6003_HW_2_1_1_OTP_FILE "otp.bin" -#define AR6003_HW_2_1_1_FIRMWARE_FILE "athwlan.bin" -#define AR6003_HW_2_1_1_TCMD_FIRMWARE_FILE "athtcmd_ram.bin" -#define AR6003_HW_2_1_1_UTF_FIRMWARE_FILE "utf.bin" -#define AR6003_HW_2_1_1_TESTSCRIPT_FILE "nullTestFlow.bin" -#define AR6003_HW_2_1_1_PATCH_FILE "data.patch.bin" -#define AR6003_HW_2_1_1_BOARD_DATA_FILE AR6003_HW_2_1_1_FW_DIR "/bdata.bin" -#define AR6003_HW_2_1_1_DEFAULT_BOARD_DATA_FILE \ - AR6003_HW_2_1_1_FW_DIR "/bdata.SD31.bin" - -/* AR6004 1.0 definitions */ -#define AR6004_HW_1_0_VERSION 0x30000623 -#define AR6004_HW_1_0_FW_DIR "ath6k/AR6004/hw1.0" -#define AR6004_HW_1_0_FIRMWARE_FILE "fw.ram.bin" -#define AR6004_HW_1_0_BOARD_DATA_FILE AR6004_HW_1_0_FW_DIR "/bdata.bin" -#define AR6004_HW_1_0_DEFAULT_BOARD_DATA_FILE \ - AR6004_HW_1_0_FW_DIR "/bdata.DB132.bin" - -/* AR6004 1.1 definitions */ -#define AR6004_HW_1_1_VERSION 0x30000001 -#define AR6004_HW_1_1_FW_DIR "ath6k/AR6004/hw1.1" -#define AR6004_HW_1_1_FIRMWARE_FILE "fw.ram.bin" -#define AR6004_HW_1_1_BOARD_DATA_FILE AR6004_HW_1_1_FW_DIR "/bdata.bin" -#define AR6004_HW_1_1_DEFAULT_BOARD_DATA_FILE \ - AR6004_HW_1_1_FW_DIR "/bdata.DB132.bin" - -/* AR6004 1.2 definitions */ -#define AR6004_HW_1_2_VERSION 0x300007e8 -#define AR6004_HW_1_2_FW_DIR "ath6k/AR6004/hw1.2" -#define AR6004_HW_1_2_FIRMWARE_FILE "fw.ram.bin" -#define AR6004_HW_1_2_BOARD_DATA_FILE AR6004_HW_1_2_FW_DIR "/bdata.bin" -#define AR6004_HW_1_2_DEFAULT_BOARD_DATA_FILE \ - AR6004_HW_1_2_FW_DIR "/bdata.bin" - -/* AR6004 1.3 definitions */ -#define AR6004_HW_1_3_VERSION 0x31c8088a -#define AR6004_HW_1_3_FW_DIR "ath6k/AR6004/hw1.3" -#define AR6004_HW_1_3_FIRMWARE_FILE "fw.ram.bin" -#define AR6004_HW_1_3_BOARD_DATA_FILE "ath6k/AR6004/hw1.3/bdata.bin" -#define AR6004_HW_1_3_DEFAULT_BOARD_DATA_FILE "ath6k/AR6004/hw1.3/bdata.bin" - -/* Per STA data, used in AP mode */ -#define STA_PS_AWAKE BIT(0) -#define STA_PS_SLEEP BIT(1) -#define STA_PS_POLLED BIT(2) -#define STA_PS_APSD_TRIGGER BIT(3) -#define STA_PS_APSD_EOSP BIT(4) - -/* HTC TX packet tagging definitions */ -#define ATH6KL_CONTROL_PKT_TAG HTC_TX_PACKET_TAG_USER_DEFINED -#define ATH6KL_DATA_PKT_TAG (ATH6KL_CONTROL_PKT_TAG + 1) - -#define AR6003_CUST_DATA_SIZE 16 - -#define AGGR_WIN_IDX(x, y) ((x) % (y)) -#define AGGR_INCR_IDX(x, y) AGGR_WIN_IDX(((x) + 1), (y)) -#define AGGR_DCRM_IDX(x, y) AGGR_WIN_IDX(((x) - 1), (y)) -#define ATH6KL_MAX_SEQ_NO 0xFFF -#define ATH6KL_NEXT_SEQ_NO(x) (((x) + 1) & ATH6KL_MAX_SEQ_NO) - -#define NUM_OF_TIDS 8 -#define AGGR_SZ_DEFAULT 8 - -#define AGGR_WIN_SZ_MIN 2 -#define AGGR_WIN_SZ_MAX 8 - -#define TID_WINDOW_SZ(_x) ((_x) << 1) - -#define AGGR_NUM_OF_FREE_NETBUFS 16 - -#define AGGR_RX_TIMEOUT 100 /* in ms */ - -#define WMI_TIMEOUT (2 * HZ) - -#define MBOX_YIELD_LIMIT 99 - -#define ATH6KL_DEFAULT_LISTEN_INTVAL 100 /* in TUs */ -#define ATH6KL_DEFAULT_BMISS_TIME 1500 -#define ATH6KL_MAX_WOW_LISTEN_INTL 300 /* in TUs */ -#define ATH6KL_MAX_BMISS_TIME 5000 - -/* configuration lags */ -/* - * ATH6KL_CONF_IGNORE_ERP_BARKER: Ignore the barker premable in - * ERP IE of beacon to determine the short premable support when - * sending (Re)Assoc req. - * ATH6KL_CONF_IGNORE_PS_FAIL_EVT_IN_SCAN: Don't send the power - * module state transition failure events which happen during - * scan, to the host. - */ -#define ATH6KL_CONF_IGNORE_ERP_BARKER BIT(0) -#define ATH6KL_CONF_IGNORE_PS_FAIL_EVT_IN_SCAN BIT(1) -#define ATH6KL_CONF_ENABLE_11N BIT(2) -#define ATH6KL_CONF_ENABLE_TX_BURST BIT(3) -#define ATH6KL_CONF_UART_DEBUG BIT(4) - -#define P2P_WILDCARD_SSID_LEN 7 /* DIRECT- */ - -enum wlan_low_pwr_state { - WLAN_POWER_STATE_ON, - WLAN_POWER_STATE_CUT_PWR, - WLAN_POWER_STATE_DEEP_SLEEP, - WLAN_POWER_STATE_WOW -}; - -enum sme_state { - SME_DISCONNECTED, - SME_CONNECTING, - SME_CONNECTED -}; - -struct skb_hold_q { - struct sk_buff *skb; - bool is_amsdu; - u16 seq_no; -}; - -struct rxtid { - bool aggr; - bool timer_mon; - u16 win_sz; - u16 seq_next; - u32 hold_q_sz; - struct skb_hold_q *hold_q; - struct sk_buff_head q; - - /* - * lock mainly protects seq_next and hold_q. Movement of seq_next - * needs to be protected between aggr_timeout() and - * aggr_process_recv_frm(). hold_q will be holding the pending - * reorder frames and it's access should also be protected. - * Some of the other fields like hold_q_sz, win_sz and aggr are - * initialized/reset when receiving addba/delba req, also while - * deleting aggr state all the pending buffers are flushed before - * resetting these fields, so there should not be any race in accessing - * these fields. - */ - spinlock_t lock; -}; - -struct rxtid_stats { - u32 num_into_aggr; - u32 num_dups; - u32 num_oow; - u32 num_mpdu; - u32 num_amsdu; - u32 num_delivered; - u32 num_timeouts; - u32 num_hole; - u32 num_bar; -}; - -struct aggr_info_conn { - u8 aggr_sz; - u8 timer_scheduled; - struct timer_list timer; - struct net_device *dev; - struct rxtid rx_tid[NUM_OF_TIDS]; - struct rxtid_stats stat[NUM_OF_TIDS]; - struct aggr_info *aggr_info; -}; - -struct aggr_info { - struct aggr_info_conn *aggr_conn; - struct sk_buff_head rx_amsdu_freeq; -}; - -struct ath6kl_wep_key { - u8 key_index; - u8 key_len; - u8 key[64]; -}; - -#define ATH6KL_KEY_SEQ_LEN 8 - -struct ath6kl_key { - u8 key[WLAN_MAX_KEY_LEN]; - u8 key_len; - u8 seq[ATH6KL_KEY_SEQ_LEN]; - u8 seq_len; - u32 cipher; -}; - -struct ath6kl_node_mapping { - u8 mac_addr[ETH_ALEN]; - u8 ep_id; - u8 tx_pend; -}; - -struct ath6kl_cookie { - struct sk_buff *skb; - u32 map_no; - struct htc_packet htc_pkt; - struct ath6kl_cookie *arc_list_next; -}; - -struct ath6kl_mgmt_buff { - struct list_head list; - u32 freq; - u32 wait; - u32 id; - bool no_cck; - size_t len; - u8 buf[0]; -}; - -struct ath6kl_sta { - u16 sta_flags; - u8 mac[ETH_ALEN]; - u8 aid; - u8 keymgmt; - u8 ucipher; - u8 auth; - u8 wpa_ie[ATH6KL_MAX_IE]; - struct sk_buff_head psq; - - /* protects psq, mgmt_psq, apsdq, and mgmt_psq_len fields */ - spinlock_t psq_lock; - - struct list_head mgmt_psq; - size_t mgmt_psq_len; - u8 apsd_info; - struct sk_buff_head apsdq; - struct aggr_info_conn *aggr_conn; -}; - -struct ath6kl_version { - u32 target_ver; - u32 wlan_ver; - u32 abi_ver; -}; - -struct ath6kl_bmi { - u32 cmd_credits; - bool done_sent; - u8 *cmd_buf; - u32 max_data_size; - u32 max_cmd_size; -}; - -struct target_stats { - u64 tx_pkt; - u64 tx_byte; - u64 tx_ucast_pkt; - u64 tx_ucast_byte; - u64 tx_mcast_pkt; - u64 tx_mcast_byte; - u64 tx_bcast_pkt; - u64 tx_bcast_byte; - u64 tx_rts_success_cnt; - u64 tx_pkt_per_ac[4]; - - u64 tx_err; - u64 tx_fail_cnt; - u64 tx_retry_cnt; - u64 tx_mult_retry_cnt; - u64 tx_rts_fail_cnt; - - u64 rx_pkt; - u64 rx_byte; - u64 rx_ucast_pkt; - u64 rx_ucast_byte; - u64 rx_mcast_pkt; - u64 rx_mcast_byte; - u64 rx_bcast_pkt; - u64 rx_bcast_byte; - u64 rx_frgment_pkt; - - u64 rx_err; - u64 rx_crc_err; - u64 rx_key_cache_miss; - u64 rx_decrypt_err; - u64 rx_dupl_frame; - - u64 tkip_local_mic_fail; - u64 tkip_cnter_measures_invoked; - u64 tkip_replays; - u64 tkip_fmt_err; - u64 ccmp_fmt_err; - u64 ccmp_replays; - - u64 pwr_save_fail_cnt; - - u64 cs_bmiss_cnt; - u64 cs_low_rssi_cnt; - u64 cs_connect_cnt; - u64 cs_discon_cnt; - - s32 tx_ucast_rate; - s32 rx_ucast_rate; - - u32 lq_val; - - u32 wow_pkt_dropped; - u16 wow_evt_discarded; - - s16 noise_floor_calib; - s16 cs_rssi; - s16 cs_ave_beacon_rssi; - u8 cs_ave_beacon_snr; - u8 cs_last_roam_msec; - u8 cs_snr; - - u8 wow_host_pkt_wakeups; - u8 wow_host_evt_wakeups; - - u32 arp_received; - u32 arp_matched; - u32 arp_replied; -}; - -struct ath6kl_mbox_info { - u32 htc_addr; - u32 htc_ext_addr; - u32 htc_ext_sz; - - u32 block_size; - - u32 gmbox_addr; - - u32 gmbox_sz; -}; - -/* - * 802.11i defines an extended IV for use with non-WEP ciphers. - * When the EXTIV bit is set in the key id byte an additional - * 4 bytes immediately follow the IV for TKIP. For CCMP the - * EXTIV bit is likewise set but the 8 bytes represent the - * CCMP header rather than IV+extended-IV. - */ - -#define ATH6KL_KEYBUF_SIZE 16 -#define ATH6KL_MICBUF_SIZE (8+8) /* space for both tx and rx */ - -#define ATH6KL_KEY_XMIT 0x01 -#define ATH6KL_KEY_RECV 0x02 -#define ATH6KL_KEY_DEFAULT 0x80 /* default xmit key */ - -/* Initial group key for AP mode */ -struct ath6kl_req_key { - bool valid; - u8 key_index; - int key_type; - u8 key[WLAN_MAX_KEY_LEN]; - u8 key_len; -}; - -enum ath6kl_hif_type { - ATH6KL_HIF_TYPE_SDIO, - ATH6KL_HIF_TYPE_USB, -}; - -enum ath6kl_htc_type { - ATH6KL_HTC_TYPE_MBOX, - ATH6KL_HTC_TYPE_PIPE, -}; - -/* Max number of filters that hw supports */ -#define ATH6K_MAX_MC_FILTERS_PER_LIST 7 -struct ath6kl_mc_filter { - struct list_head list; - char hw_addr[ATH6KL_MCAST_FILTER_MAC_ADDR_SIZE]; -}; - -struct ath6kl_htcap { - bool ht_enable; - u8 ampdu_factor; - unsigned short cap_info; -}; - -/* - * Driver's maximum limit, note that some firmwares support only one vif - * and the runtime (current) limit must be checked from ar->vif_max. - */ -#define ATH6KL_VIF_MAX 3 - -/* vif flags info */ -enum ath6kl_vif_state { - CONNECTED, - CONNECT_PEND, - WMM_ENABLED, - NETQ_STOPPED, - DTIM_EXPIRED, - CLEAR_BSSFILTER_ON_BEACON, - DTIM_PERIOD_AVAIL, - WLAN_ENABLED, - STATS_UPDATE_PEND, - HOST_SLEEP_MODE_CMD_PROCESSED, - NETDEV_MCAST_ALL_ON, - NETDEV_MCAST_ALL_OFF, - SCHED_SCANNING, -}; - -struct ath6kl_vif { - struct list_head list; - struct wireless_dev wdev; - struct net_device *ndev; - struct ath6kl *ar; - /* Lock to protect vif specific net_stats and flags */ - spinlock_t if_lock; - u8 fw_vif_idx; - unsigned long flags; - int ssid_len; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - u8 dot11_auth_mode; - u8 auth_mode; - u8 prwise_crypto; - u8 prwise_crypto_len; - u8 grp_crypto; - u8 grp_crypto_len; - u8 def_txkey_index; - u8 next_mode; - u8 nw_type; - u8 bssid[ETH_ALEN]; - u8 req_bssid[ETH_ALEN]; - u16 ch_hint; - u16 bss_ch; - struct ath6kl_wep_key wep_key_list[WMI_MAX_KEY_INDEX + 1]; - struct ath6kl_key keys[WMI_MAX_KEY_INDEX + 1]; - struct aggr_info *aggr_cntxt; - struct ath6kl_htcap htcap[IEEE80211_NUM_BANDS]; - - struct timer_list disconnect_timer; - struct timer_list sched_scan_timer; - - struct cfg80211_scan_request *scan_req; - enum sme_state sme_state; - int reconnect_flag; - u32 last_roc_id; - u32 last_cancel_roc_id; - u32 send_action_id; - bool probe_req_report; - u16 assoc_bss_beacon_int; - u16 listen_intvl_t; - u16 bmiss_time_t; - u32 txe_intvl; - u16 bg_scan_period; - u8 assoc_bss_dtim_period; - struct net_device_stats net_stats; - struct target_stats target_stats; - struct wmi_connect_cmd profile; - u16 rsn_capab; - - struct list_head mc_filter; -}; - -static inline struct ath6kl_vif *ath6kl_vif_from_wdev(struct wireless_dev *wdev) -{ - return container_of(wdev, struct ath6kl_vif, wdev); -} - -#define WOW_LIST_ID 0 -#define WOW_HOST_REQ_DELAY 500 /* ms */ - -#define ATH6KL_SCHED_SCAN_RESULT_DELAY 5000 /* ms */ - -/* Flag info */ -enum ath6kl_dev_state { - WMI_ENABLED, - WMI_READY, - WMI_CTRL_EP_FULL, - TESTMODE, - DESTROY_IN_PROGRESS, - SKIP_SCAN, - ROAM_TBL_PEND, - FIRST_BOOT, - RECOVERY_CLEANUP, -}; - -enum ath6kl_state { - ATH6KL_STATE_OFF, - ATH6KL_STATE_ON, - ATH6KL_STATE_SUSPENDING, - ATH6KL_STATE_RESUMING, - ATH6KL_STATE_DEEPSLEEP, - ATH6KL_STATE_CUTPOWER, - ATH6KL_STATE_WOW, - ATH6KL_STATE_RECOVERY, -}; - -/* Fw error recovery */ -#define ATH6KL_HB_RESP_MISS_THRES 5 - -enum ath6kl_fw_err { - ATH6KL_FW_ASSERT, - ATH6KL_FW_HB_RESP_FAILURE, - ATH6KL_FW_EP_FULL, -}; - -struct ath6kl { - struct device *dev; - struct wiphy *wiphy; - - enum ath6kl_state state; - unsigned int testmode; - - struct ath6kl_bmi bmi; - const struct ath6kl_hif_ops *hif_ops; - const struct ath6kl_htc_ops *htc_ops; - struct wmi *wmi; - int tx_pending[ENDPOINT_MAX]; - int total_tx_data_pend; - struct htc_target *htc_target; - enum ath6kl_hif_type hif_type; - void *hif_priv; - struct list_head vif_list; - /* Lock to avoid race in vif_list entries among add/del/traverse */ - spinlock_t list_lock; - u8 num_vif; - unsigned int vif_max; - u8 max_norm_iface; - u8 avail_idx_map; - - /* - * Protects at least amsdu_rx_buffer_queue, ath6kl_alloc_cookie() - * calls, tx_pending and total_tx_data_pend. - */ - spinlock_t lock; - - struct semaphore sem; - u8 lrssi_roam_threshold; - struct ath6kl_version version; - u32 target_type; - u8 tx_pwr; - struct ath6kl_node_mapping node_map[MAX_NODE_NUM]; - u8 ibss_ps_enable; - bool ibss_if_active; - u8 node_num; - u8 next_ep_id; - struct ath6kl_cookie *cookie_list; - u32 cookie_count; - enum htc_endpoint_id ac2ep_map[WMM_NUM_AC]; - bool ac_stream_active[WMM_NUM_AC]; - u8 ac_stream_pri_map[WMM_NUM_AC]; - u8 hiac_stream_active_pri; - u8 ep2ac_map[ENDPOINT_MAX]; - enum htc_endpoint_id ctrl_ep; - struct ath6kl_htc_credit_info credit_state_info; - u32 connect_ctrl_flags; - u32 user_key_ctrl; - u8 usr_bss_filter; - struct ath6kl_sta sta_list[AP_MAX_NUM_STA]; - u8 sta_list_index; - struct ath6kl_req_key ap_mode_bkey; - struct sk_buff_head mcastpsq; - u32 want_ch_switch; - u16 last_ch; - - /* - * FIXME: protects access to mcastpsq but is actually useless as - * all skbe_queue_*() functions provide serialisation themselves - */ - spinlock_t mcastpsq_lock; - - u8 intra_bss; - struct wmi_ap_mode_stat ap_stats; - u8 ap_country_code[3]; - struct list_head amsdu_rx_buffer_queue; - u8 rx_meta_ver; - enum wlan_low_pwr_state wlan_pwr_state; - u8 mac_addr[ETH_ALEN]; -#define AR_MCAST_FILTER_MAC_ADDR_SIZE 4 - struct { - void *rx_report; - size_t rx_report_len; - } tm; - - struct ath6kl_hw { - u32 id; - const char *name; - u32 dataset_patch_addr; - u32 app_load_addr; - u32 app_start_override_addr; - u32 board_ext_data_addr; - u32 reserved_ram_size; - u32 board_addr; - u32 refclk_hz; - u32 uarttx_pin; - u32 testscript_addr; - enum wmi_phy_cap cap; - - u32 flags; - - struct ath6kl_hw_fw { - const char *dir; - const char *otp; - const char *fw; - const char *tcmd; - const char *patch; - const char *utf; - const char *testscript; - } fw; - - const char *fw_board; - const char *fw_default_board; - } hw; - - u16 conf_flags; - u16 suspend_mode; - u16 wow_suspend_mode; - wait_queue_head_t event_wq; - struct ath6kl_mbox_info mbox_info; - - struct ath6kl_cookie cookie_mem[MAX_COOKIE_NUM]; - unsigned long flag; - - u8 *fw_board; - size_t fw_board_len; - - u8 *fw_otp; - size_t fw_otp_len; - - u8 *fw; - size_t fw_len; - - u8 *fw_patch; - size_t fw_patch_len; - - u8 *fw_testscript; - size_t fw_testscript_len; - - unsigned int fw_api; - unsigned long fw_capabilities[ATH6KL_CAPABILITY_LEN]; - - struct workqueue_struct *ath6kl_wq; - - struct dentry *debugfs_phy; - - bool p2p; - - bool wiphy_registered; - - struct ath6kl_fw_recovery { - struct work_struct recovery_work; - unsigned long err_reason; - unsigned long hb_poll; - struct timer_list hb_timer; - u32 seq_num; - bool hb_pending; - u8 hb_misscnt; - bool enable; - } fw_recovery; - -#ifdef CONFIG_ATH6KL_DEBUG - struct { - struct sk_buff_head fwlog_queue; - struct completion fwlog_completion; - bool fwlog_open; - - u32 fwlog_mask; - - unsigned int dbgfs_diag_reg; - u32 diag_reg_addr_wr; - u32 diag_reg_val_wr; - - struct { - unsigned int invalid_rate; - } war_stats; - - u8 *roam_tbl; - unsigned int roam_tbl_len; - - u8 keepalive; - u8 disc_timeout; - } debug; -#endif /* CONFIG_ATH6KL_DEBUG */ -}; - -static inline struct ath6kl *ath6kl_priv(struct net_device *dev) -{ - return ((struct ath6kl_vif *) netdev_priv(dev))->ar; -} - -static inline u32 ath6kl_get_hi_item_addr(struct ath6kl *ar, - u32 item_offset) -{ - u32 addr = 0; - - if (ar->target_type == TARGET_TYPE_AR6003) - addr = ATH6KL_AR6003_HI_START_ADDR + item_offset; - else if (ar->target_type == TARGET_TYPE_AR6004) - addr = ATH6KL_AR6004_HI_START_ADDR + item_offset; - - return addr; -} - -int ath6kl_configure_target(struct ath6kl *ar); -void ath6kl_detect_error(unsigned long ptr); -void disconnect_timer_handler(unsigned long ptr); -void init_netdev(struct net_device *dev); -void ath6kl_cookie_init(struct ath6kl *ar); -void ath6kl_cookie_cleanup(struct ath6kl *ar); -void ath6kl_rx(struct htc_target *target, struct htc_packet *packet); -void ath6kl_tx_complete(struct htc_target *context, - struct list_head *packet_queue); -enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target, - struct htc_packet *packet); -void ath6kl_stop_txrx(struct ath6kl *ar); -void ath6kl_cleanup_amsdu_rxbufs(struct ath6kl *ar); -int ath6kl_diag_write32(struct ath6kl *ar, u32 address, __le32 value); -int ath6kl_diag_write(struct ath6kl *ar, u32 address, void *data, u32 length); -int ath6kl_diag_read32(struct ath6kl *ar, u32 address, u32 *value); -int ath6kl_diag_read(struct ath6kl *ar, u32 address, void *data, u32 length); -int ath6kl_read_fwlogs(struct ath6kl *ar); -void ath6kl_init_profile_info(struct ath6kl_vif *vif); -void ath6kl_tx_data_cleanup(struct ath6kl *ar); - -struct ath6kl_cookie *ath6kl_alloc_cookie(struct ath6kl *ar); -void ath6kl_free_cookie(struct ath6kl *ar, struct ath6kl_cookie *cookie); -int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev); - -struct aggr_info *aggr_init(struct ath6kl_vif *vif); -void aggr_conn_init(struct ath6kl_vif *vif, struct aggr_info *aggr_info, - struct aggr_info_conn *aggr_conn); -void ath6kl_rx_refill(struct htc_target *target, - enum htc_endpoint_id endpoint); -void ath6kl_refill_amsdu_rxbufs(struct ath6kl *ar, int count); -struct htc_packet *ath6kl_alloc_amsdu_rxbuf(struct htc_target *target, - enum htc_endpoint_id endpoint, - int len); -void aggr_module_destroy(struct aggr_info *aggr_info); -void aggr_reset_state(struct aggr_info_conn *aggr_conn); - -struct ath6kl_sta *ath6kl_find_sta(struct ath6kl_vif *vif, u8 *node_addr); -struct ath6kl_sta *ath6kl_find_sta_by_aid(struct ath6kl *ar, u8 aid); - -void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver, - enum wmi_phy_cap cap); -int ath6kl_control_tx(void *devt, struct sk_buff *skb, - enum htc_endpoint_id eid); -void ath6kl_connect_event(struct ath6kl_vif *vif, u16 channel, - u8 *bssid, u16 listen_int, - u16 beacon_int, enum network_type net_type, - u8 beacon_ie_len, u8 assoc_req_len, - u8 assoc_resp_len, u8 *assoc_info); -void ath6kl_connect_ap_mode_bss(struct ath6kl_vif *vif, u16 channel); -void ath6kl_connect_ap_mode_sta(struct ath6kl_vif *vif, u16 aid, u8 *mac_addr, - u8 keymgmt, u8 ucipher, u8 auth, - u8 assoc_req_len, u8 *assoc_info, u8 apsd_info); -void ath6kl_disconnect_event(struct ath6kl_vif *vif, u8 reason, - u8 *bssid, u8 assoc_resp_len, - u8 *assoc_info, u16 prot_reason_status); -void ath6kl_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid, bool ismcast); -void ath6kl_txpwr_rx_evt(void *devt, u8 tx_pwr); -void ath6kl_scan_complete_evt(struct ath6kl_vif *vif, int status); -void ath6kl_tgt_stats_event(struct ath6kl_vif *vif, u8 *ptr, u32 len); -void ath6kl_indicate_tx_activity(void *devt, u8 traffic_class, bool active); -enum htc_endpoint_id ath6kl_ac2_endpoint_id(void *devt, u8 ac); - -void ath6kl_pspoll_event(struct ath6kl_vif *vif, u8 aid); - -void ath6kl_dtimexpiry_event(struct ath6kl_vif *vif); -void ath6kl_disconnect(struct ath6kl_vif *vif); -void aggr_recv_delba_req_evt(struct ath6kl_vif *vif, u8 tid); -void aggr_recv_addba_req_evt(struct ath6kl_vif *vif, u8 tid, u16 seq_no, - u8 win_sz); -void ath6kl_wakeup_event(void *dev); - -void ath6kl_init_control_info(struct ath6kl_vif *vif); -struct ath6kl_vif *ath6kl_vif_first(struct ath6kl *ar); -void ath6kl_cfg80211_vif_stop(struct ath6kl_vif *vif, bool wmi_ready); -int ath6kl_init_hw_start(struct ath6kl *ar); -int ath6kl_init_hw_stop(struct ath6kl *ar); -int ath6kl_init_fetch_firmwares(struct ath6kl *ar); -int ath6kl_init_hw_params(struct ath6kl *ar); - -void ath6kl_check_wow_status(struct ath6kl *ar); - -void ath6kl_core_tx_complete(struct ath6kl *ar, struct sk_buff *skb); -void ath6kl_core_rx_complete(struct ath6kl *ar, struct sk_buff *skb, u8 pipe); - -struct ath6kl *ath6kl_core_create(struct device *dev); -int ath6kl_core_init(struct ath6kl *ar, enum ath6kl_htc_type htc_type); -void ath6kl_core_cleanup(struct ath6kl *ar); -void ath6kl_core_destroy(struct ath6kl *ar); - -/* Fw error recovery */ -void ath6kl_init_hw_restart(struct ath6kl *ar); -void ath6kl_recovery_err_notify(struct ath6kl *ar, enum ath6kl_fw_err reason); -void ath6kl_recovery_hb_event(struct ath6kl *ar, u32 cookie); -void ath6kl_recovery_init(struct ath6kl *ar); -void ath6kl_recovery_cleanup(struct ath6kl *ar); -void ath6kl_recovery_suspend(struct ath6kl *ar); -void ath6kl_recovery_resume(struct ath6kl *ar); -#endif /* CORE_H */ diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c deleted file mode 100644 index fe38b836cb26..000000000000 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ /dev/null @@ -1,1885 +0,0 @@ -/* - * Copyright (c) 2004-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "core.h" - -#include -#include -#include -#include - -#include "debug.h" -#include "target.h" - -struct ath6kl_fwlog_slot { - __le32 timestamp; - __le32 length; - - /* max ATH6KL_FWLOG_PAYLOAD_SIZE bytes */ - u8 payload[0]; -}; - -#define ATH6KL_FWLOG_MAX_ENTRIES 20 - -#define ATH6KL_FWLOG_VALID_MASK 0x1ffff - -int ath6kl_printk(const char *level, const char *fmt, ...) -{ - struct va_format vaf; - va_list args; - int rtn; - - va_start(args, fmt); - - vaf.fmt = fmt; - vaf.va = &args; - - rtn = printk("%sath6kl: %pV", level, &vaf); - - va_end(args); - - return rtn; -} -EXPORT_SYMBOL(ath6kl_printk); - -int ath6kl_info(const char *fmt, ...) -{ - struct va_format vaf = { - .fmt = fmt, - }; - va_list args; - int ret; - - va_start(args, fmt); - vaf.va = &args; - ret = ath6kl_printk(KERN_INFO, "%pV", &vaf); - trace_ath6kl_log_info(&vaf); - va_end(args); - - return ret; -} -EXPORT_SYMBOL(ath6kl_info); - -int ath6kl_err(const char *fmt, ...) -{ - struct va_format vaf = { - .fmt = fmt, - }; - va_list args; - int ret; - - va_start(args, fmt); - vaf.va = &args; - ret = ath6kl_printk(KERN_ERR, "%pV", &vaf); - trace_ath6kl_log_err(&vaf); - va_end(args); - - return ret; -} -EXPORT_SYMBOL(ath6kl_err); - -int ath6kl_warn(const char *fmt, ...) -{ - struct va_format vaf = { - .fmt = fmt, - }; - va_list args; - int ret; - - va_start(args, fmt); - vaf.va = &args; - ret = ath6kl_printk(KERN_WARNING, "%pV", &vaf); - trace_ath6kl_log_warn(&vaf); - va_end(args); - - return ret; -} -EXPORT_SYMBOL(ath6kl_warn); - -#ifdef CONFIG_ATH6KL_DEBUG - -void ath6kl_dbg(enum ATH6K_DEBUG_MASK mask, const char *fmt, ...) -{ - struct va_format vaf; - va_list args; - - va_start(args, fmt); - - vaf.fmt = fmt; - vaf.va = &args; - - if (debug_mask & mask) - ath6kl_printk(KERN_DEBUG, "%pV", &vaf); - - trace_ath6kl_log_dbg(mask, &vaf); - - va_end(args); -} -EXPORT_SYMBOL(ath6kl_dbg); - -void ath6kl_dbg_dump(enum ATH6K_DEBUG_MASK mask, - const char *msg, const char *prefix, - const void *buf, size_t len) -{ - if (debug_mask & mask) { - if (msg) - ath6kl_dbg(mask, "%s\n", msg); - - print_hex_dump_bytes(prefix, DUMP_PREFIX_OFFSET, buf, len); - } - - /* tracing code doesn't like null strings :/ */ - trace_ath6kl_log_dbg_dump(msg ? msg : "", prefix ? prefix : "", - buf, len); -} -EXPORT_SYMBOL(ath6kl_dbg_dump); - -#define REG_OUTPUT_LEN_PER_LINE 25 -#define REGTYPE_STR_LEN 100 - -struct ath6kl_diag_reg_info { - u32 reg_start; - u32 reg_end; - const char *reg_info; -}; - -static const struct ath6kl_diag_reg_info diag_reg[] = { - { 0x20000, 0x200fc, "General DMA and Rx registers" }, - { 0x28000, 0x28900, "MAC PCU register & keycache" }, - { 0x20800, 0x20a40, "QCU" }, - { 0x21000, 0x212f0, "DCU" }, - { 0x4000, 0x42e4, "RTC" }, - { 0x540000, 0x540000 + (256 * 1024), "RAM" }, - { 0x29800, 0x2B210, "Base Band" }, - { 0x1C000, 0x1C748, "Analog" }, -}; - -void ath6kl_dump_registers(struct ath6kl_device *dev, - struct ath6kl_irq_proc_registers *irq_proc_reg, - struct ath6kl_irq_enable_reg *irq_enable_reg) -{ - - ath6kl_dbg(ATH6KL_DBG_IRQ, ("<------- Register Table -------->\n")); - - if (irq_proc_reg != NULL) { - ath6kl_dbg(ATH6KL_DBG_IRQ, - "Host Int status: 0x%x\n", - irq_proc_reg->host_int_status); - ath6kl_dbg(ATH6KL_DBG_IRQ, - "CPU Int status: 0x%x\n", - irq_proc_reg->cpu_int_status); - ath6kl_dbg(ATH6KL_DBG_IRQ, - "Error Int status: 0x%x\n", - irq_proc_reg->error_int_status); - ath6kl_dbg(ATH6KL_DBG_IRQ, - "Counter Int status: 0x%x\n", - irq_proc_reg->counter_int_status); - ath6kl_dbg(ATH6KL_DBG_IRQ, - "Mbox Frame: 0x%x\n", - irq_proc_reg->mbox_frame); - ath6kl_dbg(ATH6KL_DBG_IRQ, - "Rx Lookahead Valid: 0x%x\n", - irq_proc_reg->rx_lkahd_valid); - ath6kl_dbg(ATH6KL_DBG_IRQ, - "Rx Lookahead 0: 0x%x\n", - irq_proc_reg->rx_lkahd[0]); - ath6kl_dbg(ATH6KL_DBG_IRQ, - "Rx Lookahead 1: 0x%x\n", - irq_proc_reg->rx_lkahd[1]); - - if (dev->ar->mbox_info.gmbox_addr != 0) { - /* - * If the target supports GMBOX hardware, dump some - * additional state. - */ - ath6kl_dbg(ATH6KL_DBG_IRQ, - "GMBOX Host Int status 2: 0x%x\n", - irq_proc_reg->host_int_status2); - ath6kl_dbg(ATH6KL_DBG_IRQ, - "GMBOX RX Avail: 0x%x\n", - irq_proc_reg->gmbox_rx_avail); - ath6kl_dbg(ATH6KL_DBG_IRQ, - "GMBOX lookahead alias 0: 0x%x\n", - irq_proc_reg->rx_gmbox_lkahd_alias[0]); - ath6kl_dbg(ATH6KL_DBG_IRQ, - "GMBOX lookahead alias 1: 0x%x\n", - irq_proc_reg->rx_gmbox_lkahd_alias[1]); - } - - } - - if (irq_enable_reg != NULL) { - ath6kl_dbg(ATH6KL_DBG_IRQ, - "Int status Enable: 0x%x\n", - irq_enable_reg->int_status_en); - ath6kl_dbg(ATH6KL_DBG_IRQ, "Counter Int status Enable: 0x%x\n", - irq_enable_reg->cntr_int_status_en); - } - ath6kl_dbg(ATH6KL_DBG_IRQ, "<------------------------------->\n"); -} - -static void dump_cred_dist(struct htc_endpoint_credit_dist *ep_dist) -{ - ath6kl_dbg(ATH6KL_DBG_CREDIT, - "--- endpoint: %d svc_id: 0x%X ---\n", - ep_dist->endpoint, ep_dist->svc_id); - ath6kl_dbg(ATH6KL_DBG_CREDIT, " dist_flags : 0x%X\n", - ep_dist->dist_flags); - ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_norm : %d\n", - ep_dist->cred_norm); - ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_min : %d\n", - ep_dist->cred_min); - ath6kl_dbg(ATH6KL_DBG_CREDIT, " credits : %d\n", - ep_dist->credits); - ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_assngd : %d\n", - ep_dist->cred_assngd); - ath6kl_dbg(ATH6KL_DBG_CREDIT, " seek_cred : %d\n", - ep_dist->seek_cred); - ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_sz : %d\n", - ep_dist->cred_sz); - ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_per_msg : %d\n", - ep_dist->cred_per_msg); - ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_to_dist : %d\n", - ep_dist->cred_to_dist); - ath6kl_dbg(ATH6KL_DBG_CREDIT, " txq_depth : %d\n", - get_queue_depth(&ep_dist->htc_ep->txq)); - ath6kl_dbg(ATH6KL_DBG_CREDIT, - "----------------------------------\n"); -} - -/* FIXME: move to htc.c */ -void dump_cred_dist_stats(struct htc_target *target) -{ - struct htc_endpoint_credit_dist *ep_list; - - list_for_each_entry(ep_list, &target->cred_dist_list, list) - dump_cred_dist(ep_list); - - ath6kl_dbg(ATH6KL_DBG_CREDIT, - "credit distribution total %d free %d\n", - target->credit_info->total_avail_credits, - target->credit_info->cur_free_credits); -} - -void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war) -{ - switch (war) { - case ATH6KL_WAR_INVALID_RATE: - ar->debug.war_stats.invalid_rate++; - break; - } -} - -static ssize_t read_file_war_stats(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - char *buf; - unsigned int len = 0, buf_len = 1500; - ssize_t ret_cnt; - - buf = kzalloc(buf_len, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - len += scnprintf(buf + len, buf_len - len, "\n"); - len += scnprintf(buf + len, buf_len - len, "%25s\n", - "Workaround stats"); - len += scnprintf(buf + len, buf_len - len, "%25s\n\n", - "================="); - len += scnprintf(buf + len, buf_len - len, "%20s %10u\n", - "Invalid rates", ar->debug.war_stats.invalid_rate); - - if (WARN_ON(len > buf_len)) - len = buf_len; - - ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len); - - kfree(buf); - return ret_cnt; -} - -static const struct file_operations fops_war_stats = { - .read = read_file_war_stats, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -void ath6kl_debug_fwlog_event(struct ath6kl *ar, const void *buf, size_t len) -{ - struct ath6kl_fwlog_slot *slot; - struct sk_buff *skb; - size_t slot_len; - - if (WARN_ON(len > ATH6KL_FWLOG_PAYLOAD_SIZE)) - return; - - slot_len = sizeof(*slot) + ATH6KL_FWLOG_PAYLOAD_SIZE; - - skb = alloc_skb(slot_len, GFP_KERNEL); - if (!skb) - return; - - slot = (struct ath6kl_fwlog_slot *) skb_put(skb, slot_len); - slot->timestamp = cpu_to_le32(jiffies); - slot->length = cpu_to_le32(len); - memcpy(slot->payload, buf, len); - - /* Need to pad each record to fixed length ATH6KL_FWLOG_PAYLOAD_SIZE */ - memset(slot->payload + len, 0, ATH6KL_FWLOG_PAYLOAD_SIZE - len); - - spin_lock(&ar->debug.fwlog_queue.lock); - - __skb_queue_tail(&ar->debug.fwlog_queue, skb); - complete(&ar->debug.fwlog_completion); - - /* drop oldest entries */ - while (skb_queue_len(&ar->debug.fwlog_queue) > - ATH6KL_FWLOG_MAX_ENTRIES) { - skb = __skb_dequeue(&ar->debug.fwlog_queue); - kfree_skb(skb); - } - - spin_unlock(&ar->debug.fwlog_queue.lock); - - return; -} - -static int ath6kl_fwlog_open(struct inode *inode, struct file *file) -{ - struct ath6kl *ar = inode->i_private; - - if (ar->debug.fwlog_open) - return -EBUSY; - - ar->debug.fwlog_open = true; - - file->private_data = inode->i_private; - return 0; -} - -static int ath6kl_fwlog_release(struct inode *inode, struct file *file) -{ - struct ath6kl *ar = inode->i_private; - - ar->debug.fwlog_open = false; - - return 0; -} - -static ssize_t ath6kl_fwlog_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - struct sk_buff *skb; - ssize_t ret_cnt; - size_t len = 0; - char *buf; - - buf = vmalloc(count); - if (!buf) - return -ENOMEM; - - /* read undelivered logs from firmware */ - ath6kl_read_fwlogs(ar); - - spin_lock(&ar->debug.fwlog_queue.lock); - - while ((skb = __skb_dequeue(&ar->debug.fwlog_queue))) { - if (skb->len > count - len) { - /* not enough space, put skb back and leave */ - __skb_queue_head(&ar->debug.fwlog_queue, skb); - break; - } - - - memcpy(buf + len, skb->data, skb->len); - len += skb->len; - - kfree_skb(skb); - } - - spin_unlock(&ar->debug.fwlog_queue.lock); - - /* FIXME: what to do if len == 0? */ - - ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len); - - vfree(buf); - - return ret_cnt; -} - -static const struct file_operations fops_fwlog = { - .open = ath6kl_fwlog_open, - .release = ath6kl_fwlog_release, - .read = ath6kl_fwlog_read, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t ath6kl_fwlog_block_read(struct file *file, - char __user *user_buf, - size_t count, - loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - struct sk_buff *skb; - ssize_t ret_cnt; - size_t len = 0, not_copied; - char *buf; - int ret; - - buf = vmalloc(count); - if (!buf) - return -ENOMEM; - - spin_lock(&ar->debug.fwlog_queue.lock); - - if (skb_queue_len(&ar->debug.fwlog_queue) == 0) { - /* we must init under queue lock */ - init_completion(&ar->debug.fwlog_completion); - - spin_unlock(&ar->debug.fwlog_queue.lock); - - ret = wait_for_completion_interruptible( - &ar->debug.fwlog_completion); - if (ret == -ERESTARTSYS) { - vfree(buf); - return ret; - } - - spin_lock(&ar->debug.fwlog_queue.lock); - } - - while ((skb = __skb_dequeue(&ar->debug.fwlog_queue))) { - if (skb->len > count - len) { - /* not enough space, put skb back and leave */ - __skb_queue_head(&ar->debug.fwlog_queue, skb); - break; - } - - - memcpy(buf + len, skb->data, skb->len); - len += skb->len; - - kfree_skb(skb); - } - - spin_unlock(&ar->debug.fwlog_queue.lock); - - /* FIXME: what to do if len == 0? */ - - not_copied = copy_to_user(user_buf, buf, len); - if (not_copied != 0) { - ret_cnt = -EFAULT; - goto out; - } - - *ppos = *ppos + len; - - ret_cnt = len; - -out: - vfree(buf); - - return ret_cnt; -} - -static const struct file_operations fops_fwlog_block = { - .open = ath6kl_fwlog_open, - .release = ath6kl_fwlog_release, - .read = ath6kl_fwlog_block_read, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t ath6kl_fwlog_mask_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - char buf[16]; - int len; - - len = snprintf(buf, sizeof(buf), "0x%x\n", ar->debug.fwlog_mask); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t ath6kl_fwlog_mask_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - int ret; - - ret = kstrtou32_from_user(user_buf, count, 0, &ar->debug.fwlog_mask); - if (ret) - return ret; - - ret = ath6kl_wmi_config_debug_module_cmd(ar->wmi, - ATH6KL_FWLOG_VALID_MASK, - ar->debug.fwlog_mask); - if (ret) - return ret; - - return count; -} - -static const struct file_operations fops_fwlog_mask = { - .open = simple_open, - .read = ath6kl_fwlog_mask_read, - .write = ath6kl_fwlog_mask_write, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - struct ath6kl_vif *vif; - struct target_stats *tgt_stats; - char *buf; - unsigned int len = 0, buf_len = 1500; - int i; - long left; - ssize_t ret_cnt; - - vif = ath6kl_vif_first(ar); - if (!vif) - return -EIO; - - tgt_stats = &vif->target_stats; - - buf = kzalloc(buf_len, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - if (down_interruptible(&ar->sem)) { - kfree(buf); - return -EBUSY; - } - - set_bit(STATS_UPDATE_PEND, &vif->flags); - - if (ath6kl_wmi_get_stats_cmd(ar->wmi, 0)) { - up(&ar->sem); - kfree(buf); - return -EIO; - } - - left = wait_event_interruptible_timeout(ar->event_wq, - !test_bit(STATS_UPDATE_PEND, - &vif->flags), WMI_TIMEOUT); - - up(&ar->sem); - - if (left <= 0) { - kfree(buf); - return -ETIMEDOUT; - } - - len += scnprintf(buf + len, buf_len - len, "\n"); - len += scnprintf(buf + len, buf_len - len, "%25s\n", - "Target Tx stats"); - len += scnprintf(buf + len, buf_len - len, "%25s\n\n", - "================="); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Ucast packets", tgt_stats->tx_ucast_pkt); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Bcast packets", tgt_stats->tx_bcast_pkt); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Ucast byte", tgt_stats->tx_ucast_byte); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Bcast byte", tgt_stats->tx_bcast_byte); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Rts success cnt", tgt_stats->tx_rts_success_cnt); - for (i = 0; i < 4; i++) - len += scnprintf(buf + len, buf_len - len, - "%18s %d %10llu\n", "PER on ac", - i, tgt_stats->tx_pkt_per_ac[i]); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Error", tgt_stats->tx_err); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Fail count", tgt_stats->tx_fail_cnt); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Retry count", tgt_stats->tx_retry_cnt); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Multi retry cnt", tgt_stats->tx_mult_retry_cnt); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Rts fail cnt", tgt_stats->tx_rts_fail_cnt); - len += scnprintf(buf + len, buf_len - len, "%25s %10llu\n\n", - "TKIP counter measure used", - tgt_stats->tkip_cnter_measures_invoked); - - len += scnprintf(buf + len, buf_len - len, "%25s\n", - "Target Rx stats"); - len += scnprintf(buf + len, buf_len - len, "%25s\n", - "================="); - - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Ucast packets", tgt_stats->rx_ucast_pkt); - len += scnprintf(buf + len, buf_len - len, "%20s %10d\n", - "Ucast Rate", tgt_stats->rx_ucast_rate); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Bcast packets", tgt_stats->rx_bcast_pkt); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Ucast byte", tgt_stats->rx_ucast_byte); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Bcast byte", tgt_stats->rx_bcast_byte); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Fragmented pkt", tgt_stats->rx_frgment_pkt); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Error", tgt_stats->rx_err); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "CRC Err", tgt_stats->rx_crc_err); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Key chache miss", tgt_stats->rx_key_cache_miss); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Decrypt Err", tgt_stats->rx_decrypt_err); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Duplicate frame", tgt_stats->rx_dupl_frame); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Tkip Mic failure", tgt_stats->tkip_local_mic_fail); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "TKIP format err", tgt_stats->tkip_fmt_err); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "CCMP format Err", tgt_stats->ccmp_fmt_err); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n\n", - "CCMP Replay Err", tgt_stats->ccmp_replays); - - len += scnprintf(buf + len, buf_len - len, "%25s\n", - "Misc Target stats"); - len += scnprintf(buf + len, buf_len - len, "%25s\n", - "================="); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Beacon Miss count", tgt_stats->cs_bmiss_cnt); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Num Connects", tgt_stats->cs_connect_cnt); - len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n", - "Num disconnects", tgt_stats->cs_discon_cnt); - len += scnprintf(buf + len, buf_len - len, "%20s %10d\n", - "Beacon avg rssi", tgt_stats->cs_ave_beacon_rssi); - len += scnprintf(buf + len, buf_len - len, "%20s %10d\n", - "ARP pkt received", tgt_stats->arp_received); - len += scnprintf(buf + len, buf_len - len, "%20s %10d\n", - "ARP pkt matched", tgt_stats->arp_matched); - len += scnprintf(buf + len, buf_len - len, "%20s %10d\n", - "ARP pkt replied", tgt_stats->arp_replied); - - if (len > buf_len) - len = buf_len; - - ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len); - - kfree(buf); - return ret_cnt; -} - -static const struct file_operations fops_tgt_stats = { - .read = read_file_tgt_stats, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -#define print_credit_info(fmt_str, ep_list_field) \ - (len += scnprintf(buf + len, buf_len - len, fmt_str, \ - ep_list->ep_list_field)) -#define CREDIT_INFO_DISPLAY_STRING_LEN 200 -#define CREDIT_INFO_LEN 128 - -static ssize_t read_file_credit_dist_stats(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - struct htc_target *target = ar->htc_target; - struct htc_endpoint_credit_dist *ep_list; - char *buf; - unsigned int buf_len, len = 0; - ssize_t ret_cnt; - - buf_len = CREDIT_INFO_DISPLAY_STRING_LEN + - get_queue_depth(&target->cred_dist_list) * CREDIT_INFO_LEN; - buf = kzalloc(buf_len, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - len += scnprintf(buf + len, buf_len - len, "%25s%5d\n", - "Total Avail Credits: ", - target->credit_info->total_avail_credits); - len += scnprintf(buf + len, buf_len - len, "%25s%5d\n", - "Free credits :", - target->credit_info->cur_free_credits); - - len += scnprintf(buf + len, buf_len - len, - " Epid Flags Cred_norm Cred_min Credits Cred_assngd" - " Seek_cred Cred_sz Cred_per_msg Cred_to_dist" - " qdepth\n"); - - list_for_each_entry(ep_list, &target->cred_dist_list, list) { - print_credit_info(" %2d", endpoint); - print_credit_info("%10x", dist_flags); - print_credit_info("%8d", cred_norm); - print_credit_info("%9d", cred_min); - print_credit_info("%9d", credits); - print_credit_info("%10d", cred_assngd); - print_credit_info("%13d", seek_cred); - print_credit_info("%12d", cred_sz); - print_credit_info("%9d", cred_per_msg); - print_credit_info("%14d", cred_to_dist); - len += scnprintf(buf + len, buf_len - len, "%12d\n", - get_queue_depth(&ep_list->htc_ep->txq)); - } - - if (len > buf_len) - len = buf_len; - - ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - return ret_cnt; -} - -static const struct file_operations fops_credit_dist_stats = { - .read = read_file_credit_dist_stats, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static unsigned int print_endpoint_stat(struct htc_target *target, char *buf, - unsigned int buf_len, unsigned int len, - int offset, const char *name) -{ - int i; - struct htc_endpoint_stats *ep_st; - u32 *counter; - - len += scnprintf(buf + len, buf_len - len, "%s:", name); - for (i = 0; i < ENDPOINT_MAX; i++) { - ep_st = &target->endpoint[i].ep_st; - counter = ((u32 *) ep_st) + (offset / 4); - len += scnprintf(buf + len, buf_len - len, " %u", *counter); - } - len += scnprintf(buf + len, buf_len - len, "\n"); - - return len; -} - -static ssize_t ath6kl_endpoint_stats_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - struct htc_target *target = ar->htc_target; - char *buf; - unsigned int buf_len, len = 0; - ssize_t ret_cnt; - - buf_len = sizeof(struct htc_endpoint_stats) / sizeof(u32) * - (25 + ENDPOINT_MAX * 11); - buf = kmalloc(buf_len, GFP_KERNEL); - if (!buf) - return -ENOMEM; - -#define EPSTAT(name) \ - do { \ - len = print_endpoint_stat(target, buf, buf_len, len, \ - offsetof(struct htc_endpoint_stats, \ - name), \ - #name); \ - } while (0) - - EPSTAT(cred_low_indicate); - EPSTAT(tx_issued); - EPSTAT(tx_pkt_bundled); - EPSTAT(tx_bundles); - EPSTAT(tx_dropped); - EPSTAT(tx_cred_rpt); - EPSTAT(cred_rpt_from_rx); - EPSTAT(cred_rpt_from_other); - EPSTAT(cred_rpt_ep0); - EPSTAT(cred_from_rx); - EPSTAT(cred_from_other); - EPSTAT(cred_from_ep0); - EPSTAT(cred_cosumd); - EPSTAT(cred_retnd); - EPSTAT(rx_pkts); - EPSTAT(rx_lkahds); - EPSTAT(rx_bundl); - EPSTAT(rx_bundle_lkahd); - EPSTAT(rx_bundle_from_hdr); - EPSTAT(rx_alloc_thresh_hit); - EPSTAT(rxalloc_thresh_byte); -#undef EPSTAT - - if (len > buf_len) - len = buf_len; - - ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - return ret_cnt; -} - -static ssize_t ath6kl_endpoint_stats_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - struct htc_target *target = ar->htc_target; - int ret, i; - u32 val; - struct htc_endpoint_stats *ep_st; - - ret = kstrtou32_from_user(user_buf, count, 0, &val); - if (ret) - return ret; - if (val == 0) { - for (i = 0; i < ENDPOINT_MAX; i++) { - ep_st = &target->endpoint[i].ep_st; - memset(ep_st, 0, sizeof(*ep_st)); - } - } - - return count; -} - -static const struct file_operations fops_endpoint_stats = { - .open = simple_open, - .read = ath6kl_endpoint_stats_read, - .write = ath6kl_endpoint_stats_write, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static unsigned long ath6kl_get_num_reg(void) -{ - int i; - unsigned long n_reg = 0; - - for (i = 0; i < ARRAY_SIZE(diag_reg); i++) - n_reg = n_reg + - (diag_reg[i].reg_end - diag_reg[i].reg_start) / 4 + 1; - - return n_reg; -} - -static bool ath6kl_dbg_is_diag_reg_valid(u32 reg_addr) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(diag_reg); i++) { - if (reg_addr >= diag_reg[i].reg_start && - reg_addr <= diag_reg[i].reg_end) - return true; - } - - return false; -} - -static ssize_t ath6kl_regread_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - u8 buf[50]; - unsigned int len = 0; - - if (ar->debug.dbgfs_diag_reg) - len += scnprintf(buf + len, sizeof(buf) - len, "0x%x\n", - ar->debug.dbgfs_diag_reg); - else - len += scnprintf(buf + len, sizeof(buf) - len, - "All diag registers\n"); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t ath6kl_regread_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - unsigned long reg_addr; - - if (kstrtoul_from_user(user_buf, count, 0, ®_addr)) - return -EINVAL; - - if ((reg_addr % 4) != 0) - return -EINVAL; - - if (reg_addr && !ath6kl_dbg_is_diag_reg_valid(reg_addr)) - return -EINVAL; - - ar->debug.dbgfs_diag_reg = reg_addr; - - return count; -} - -static const struct file_operations fops_diag_reg_read = { - .read = ath6kl_regread_read, - .write = ath6kl_regread_write, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static int ath6kl_regdump_open(struct inode *inode, struct file *file) -{ - struct ath6kl *ar = inode->i_private; - u8 *buf; - unsigned long int reg_len; - unsigned int len = 0, n_reg; - u32 addr; - __le32 reg_val; - int i, status; - - /* Dump all the registers if no register is specified */ - if (!ar->debug.dbgfs_diag_reg) - n_reg = ath6kl_get_num_reg(); - else - n_reg = 1; - - reg_len = n_reg * REG_OUTPUT_LEN_PER_LINE; - if (n_reg > 1) - reg_len += REGTYPE_STR_LEN; - - buf = vmalloc(reg_len); - if (!buf) - return -ENOMEM; - - if (n_reg == 1) { - addr = ar->debug.dbgfs_diag_reg; - - status = ath6kl_diag_read32(ar, - TARG_VTOP(ar->target_type, addr), - (u32 *)®_val); - if (status) - goto fail_reg_read; - - len += scnprintf(buf + len, reg_len - len, - "0x%06x 0x%08x\n", addr, le32_to_cpu(reg_val)); - goto done; - } - - for (i = 0; i < ARRAY_SIZE(diag_reg); i++) { - len += scnprintf(buf + len, reg_len - len, - "%s\n", diag_reg[i].reg_info); - for (addr = diag_reg[i].reg_start; - addr <= diag_reg[i].reg_end; addr += 4) { - status = ath6kl_diag_read32(ar, - TARG_VTOP(ar->target_type, addr), - (u32 *)®_val); - if (status) - goto fail_reg_read; - - len += scnprintf(buf + len, reg_len - len, - "0x%06x 0x%08x\n", - addr, le32_to_cpu(reg_val)); - } - } - -done: - file->private_data = buf; - return 0; - -fail_reg_read: - ath6kl_warn("Unable to read memory:%u\n", addr); - vfree(buf); - return -EIO; -} - -static ssize_t ath6kl_regdump_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - u8 *buf = file->private_data; - return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); -} - -static int ath6kl_regdump_release(struct inode *inode, struct file *file) -{ - vfree(file->private_data); - return 0; -} - -static const struct file_operations fops_reg_dump = { - .open = ath6kl_regdump_open, - .read = ath6kl_regdump_read, - .release = ath6kl_regdump_release, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t ath6kl_lrssi_roam_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - unsigned long lrssi_roam_threshold; - - if (kstrtoul_from_user(user_buf, count, 0, &lrssi_roam_threshold)) - return -EINVAL; - - ar->lrssi_roam_threshold = lrssi_roam_threshold; - - ath6kl_wmi_set_roam_lrssi_cmd(ar->wmi, ar->lrssi_roam_threshold); - - return count; -} - -static ssize_t ath6kl_lrssi_roam_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - char buf[32]; - unsigned int len; - - len = snprintf(buf, sizeof(buf), "%u\n", ar->lrssi_roam_threshold); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static const struct file_operations fops_lrssi_roam_threshold = { - .read = ath6kl_lrssi_roam_read, - .write = ath6kl_lrssi_roam_write, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t ath6kl_regwrite_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - u8 buf[32]; - unsigned int len = 0; - - len = scnprintf(buf, sizeof(buf), "Addr: 0x%x Val: 0x%x\n", - ar->debug.diag_reg_addr_wr, ar->debug.diag_reg_val_wr); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t ath6kl_regwrite_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - char buf[32]; - char *sptr, *token; - unsigned int len = 0; - u32 reg_addr, reg_val; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - sptr = buf; - - token = strsep(&sptr, "="); - if (!token) - return -EINVAL; - - if (kstrtou32(token, 0, ®_addr)) - return -EINVAL; - - if (!ath6kl_dbg_is_diag_reg_valid(reg_addr)) - return -EINVAL; - - if (kstrtou32(sptr, 0, ®_val)) - return -EINVAL; - - ar->debug.diag_reg_addr_wr = reg_addr; - ar->debug.diag_reg_val_wr = reg_val; - - if (ath6kl_diag_write32(ar, ar->debug.diag_reg_addr_wr, - cpu_to_le32(ar->debug.diag_reg_val_wr))) - return -EIO; - - return count; -} - -static const struct file_operations fops_diag_reg_write = { - .read = ath6kl_regwrite_read, - .write = ath6kl_regwrite_write, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, const void *buf, - size_t len) -{ - const struct wmi_target_roam_tbl *tbl; - u16 num_entries; - - if (len < sizeof(*tbl)) - return -EINVAL; - - tbl = (const struct wmi_target_roam_tbl *) buf; - num_entries = le16_to_cpu(tbl->num_entries); - if (sizeof(*tbl) + num_entries * sizeof(struct wmi_bss_roam_info) > - len) - return -EINVAL; - - if (ar->debug.roam_tbl == NULL || - ar->debug.roam_tbl_len < (unsigned int) len) { - kfree(ar->debug.roam_tbl); - ar->debug.roam_tbl = kmalloc(len, GFP_ATOMIC); - if (ar->debug.roam_tbl == NULL) - return -ENOMEM; - } - - memcpy(ar->debug.roam_tbl, buf, len); - ar->debug.roam_tbl_len = len; - - if (test_bit(ROAM_TBL_PEND, &ar->flag)) { - clear_bit(ROAM_TBL_PEND, &ar->flag); - wake_up(&ar->event_wq); - } - - return 0; -} - -static ssize_t ath6kl_roam_table_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - int ret; - long left; - struct wmi_target_roam_tbl *tbl; - u16 num_entries, i; - char *buf; - unsigned int len, buf_len; - ssize_t ret_cnt; - - if (down_interruptible(&ar->sem)) - return -EBUSY; - - set_bit(ROAM_TBL_PEND, &ar->flag); - - ret = ath6kl_wmi_get_roam_tbl_cmd(ar->wmi); - if (ret) { - up(&ar->sem); - return ret; - } - - left = wait_event_interruptible_timeout( - ar->event_wq, !test_bit(ROAM_TBL_PEND, &ar->flag), WMI_TIMEOUT); - up(&ar->sem); - - if (left <= 0) - return -ETIMEDOUT; - - if (ar->debug.roam_tbl == NULL) - return -ENOMEM; - - tbl = (struct wmi_target_roam_tbl *) ar->debug.roam_tbl; - num_entries = le16_to_cpu(tbl->num_entries); - - buf_len = 100 + num_entries * 100; - buf = kzalloc(buf_len, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - len = 0; - len += scnprintf(buf + len, buf_len - len, - "roam_mode=%u\n\n" - "# roam_util bssid rssi rssidt last_rssi util bias\n", - le16_to_cpu(tbl->roam_mode)); - - for (i = 0; i < num_entries; i++) { - struct wmi_bss_roam_info *info = &tbl->info[i]; - len += scnprintf(buf + len, buf_len - len, - "%d %pM %d %d %d %d %d\n", - a_sle32_to_cpu(info->roam_util), info->bssid, - info->rssi, info->rssidt, info->last_rssi, - info->util, info->bias); - } - - if (len > buf_len) - len = buf_len; - - ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len); - - kfree(buf); - return ret_cnt; -} - -static const struct file_operations fops_roam_table = { - .read = ath6kl_roam_table_read, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t ath6kl_force_roam_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - int ret; - char buf[20]; - size_t len; - u8 bssid[ETH_ALEN]; - int i; - int addr[ETH_ALEN]; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - buf[len] = '\0'; - - if (sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", - &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5]) - != ETH_ALEN) - return -EINVAL; - for (i = 0; i < ETH_ALEN; i++) - bssid[i] = addr[i]; - - ret = ath6kl_wmi_force_roam_cmd(ar->wmi, bssid); - if (ret) - return ret; - - return count; -} - -static const struct file_operations fops_force_roam = { - .write = ath6kl_force_roam_write, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t ath6kl_roam_mode_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - int ret; - char buf[20]; - size_t len; - enum wmi_roam_mode mode; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - buf[len] = '\0'; - if (len > 0 && buf[len - 1] == '\n') - buf[len - 1] = '\0'; - - if (strcasecmp(buf, "default") == 0) - mode = WMI_DEFAULT_ROAM_MODE; - else if (strcasecmp(buf, "bssbias") == 0) - mode = WMI_HOST_BIAS_ROAM_MODE; - else if (strcasecmp(buf, "lock") == 0) - mode = WMI_LOCK_BSS_MODE; - else - return -EINVAL; - - ret = ath6kl_wmi_set_roam_mode_cmd(ar->wmi, mode); - if (ret) - return ret; - - return count; -} - -static const struct file_operations fops_roam_mode = { - .write = ath6kl_roam_mode_write, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive) -{ - ar->debug.keepalive = keepalive; -} - -static ssize_t ath6kl_keepalive_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - char buf[16]; - int len; - - len = snprintf(buf, sizeof(buf), "%u\n", ar->debug.keepalive); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t ath6kl_keepalive_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - int ret; - u8 val; - - ret = kstrtou8_from_user(user_buf, count, 0, &val); - if (ret) - return ret; - - ret = ath6kl_wmi_set_keepalive_cmd(ar->wmi, 0, val); - if (ret) - return ret; - - return count; -} - -static const struct file_operations fops_keepalive = { - .open = simple_open, - .read = ath6kl_keepalive_read, - .write = ath6kl_keepalive_write, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, u8 timeout) -{ - ar->debug.disc_timeout = timeout; -} - -static ssize_t ath6kl_disconnect_timeout_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - char buf[16]; - int len; - - len = snprintf(buf, sizeof(buf), "%u\n", ar->debug.disc_timeout); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t ath6kl_disconnect_timeout_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - int ret; - u8 val; - - ret = kstrtou8_from_user(user_buf, count, 0, &val); - if (ret) - return ret; - - ret = ath6kl_wmi_disctimeout_cmd(ar->wmi, 0, val); - if (ret) - return ret; - - return count; -} - -static const struct file_operations fops_disconnect_timeout = { - .open = simple_open, - .read = ath6kl_disconnect_timeout_read, - .write = ath6kl_disconnect_timeout_write, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t ath6kl_create_qos_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - - struct ath6kl *ar = file->private_data; - struct ath6kl_vif *vif; - char buf[200]; - ssize_t len; - char *sptr, *token; - struct wmi_create_pstream_cmd pstream; - u32 val32; - u16 val16; - - vif = ath6kl_vif_first(ar); - if (!vif) - return -EIO; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - buf[len] = '\0'; - sptr = buf; - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou8(token, 0, &pstream.user_pri)) - return -EINVAL; - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou8(token, 0, &pstream.traffic_direc)) - return -EINVAL; - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou8(token, 0, &pstream.traffic_class)) - return -EINVAL; - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou8(token, 0, &pstream.traffic_type)) - return -EINVAL; - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou8(token, 0, &pstream.voice_psc_cap)) - return -EINVAL; - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou32(token, 0, &val32)) - return -EINVAL; - pstream.min_service_int = cpu_to_le32(val32); - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou32(token, 0, &val32)) - return -EINVAL; - pstream.max_service_int = cpu_to_le32(val32); - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou32(token, 0, &val32)) - return -EINVAL; - pstream.inactivity_int = cpu_to_le32(val32); - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou32(token, 0, &val32)) - return -EINVAL; - pstream.suspension_int = cpu_to_le32(val32); - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou32(token, 0, &val32)) - return -EINVAL; - pstream.service_start_time = cpu_to_le32(val32); - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou8(token, 0, &pstream.tsid)) - return -EINVAL; - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou16(token, 0, &val16)) - return -EINVAL; - pstream.nominal_msdu = cpu_to_le16(val16); - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou16(token, 0, &val16)) - return -EINVAL; - pstream.max_msdu = cpu_to_le16(val16); - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou32(token, 0, &val32)) - return -EINVAL; - pstream.min_data_rate = cpu_to_le32(val32); - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou32(token, 0, &val32)) - return -EINVAL; - pstream.mean_data_rate = cpu_to_le32(val32); - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou32(token, 0, &val32)) - return -EINVAL; - pstream.peak_data_rate = cpu_to_le32(val32); - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou32(token, 0, &val32)) - return -EINVAL; - pstream.max_burst_size = cpu_to_le32(val32); - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou32(token, 0, &val32)) - return -EINVAL; - pstream.delay_bound = cpu_to_le32(val32); - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou32(token, 0, &val32)) - return -EINVAL; - pstream.min_phy_rate = cpu_to_le32(val32); - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou32(token, 0, &val32)) - return -EINVAL; - pstream.sba = cpu_to_le32(val32); - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou32(token, 0, &val32)) - return -EINVAL; - pstream.medium_time = cpu_to_le32(val32); - - pstream.nominal_phy = le32_to_cpu(pstream.min_phy_rate) / 1000000; - - ath6kl_wmi_create_pstream_cmd(ar->wmi, vif->fw_vif_idx, &pstream); - - return count; -} - -static const struct file_operations fops_create_qos = { - .write = ath6kl_create_qos_write, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t ath6kl_delete_qos_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - - struct ath6kl *ar = file->private_data; - struct ath6kl_vif *vif; - char buf[100]; - ssize_t len; - char *sptr, *token; - u8 traffic_class; - u8 tsid; - - vif = ath6kl_vif_first(ar); - if (!vif) - return -EIO; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - buf[len] = '\0'; - sptr = buf; - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou8(token, 0, &traffic_class)) - return -EINVAL; - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou8(token, 0, &tsid)) - return -EINVAL; - - ath6kl_wmi_delete_pstream_cmd(ar->wmi, vif->fw_vif_idx, - traffic_class, tsid); - - return count; -} - -static const struct file_operations fops_delete_qos = { - .write = ath6kl_delete_qos_write, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t ath6kl_bgscan_int_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - struct ath6kl_vif *vif; - u16 bgscan_int; - char buf[32]; - ssize_t len; - - vif = ath6kl_vif_first(ar); - if (!vif) - return -EIO; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (kstrtou16(buf, 0, &bgscan_int)) - return -EINVAL; - - if (bgscan_int == 0) - bgscan_int = 0xffff; - - vif->bg_scan_period = bgscan_int; - - ath6kl_wmi_scanparams_cmd(ar->wmi, 0, 0, 0, bgscan_int, 0, 0, 0, 3, - 0, 0, 0); - - return count; -} - -static const struct file_operations fops_bgscan_int = { - .write = ath6kl_bgscan_int_write, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t ath6kl_listen_int_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - struct ath6kl_vif *vif; - u16 listen_interval; - char buf[32]; - ssize_t len; - - vif = ath6kl_vif_first(ar); - if (!vif) - return -EIO; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (kstrtou16(buf, 0, &listen_interval)) - return -EINVAL; - - if ((listen_interval < 15) || (listen_interval > 3000)) - return -EINVAL; - - vif->listen_intvl_t = listen_interval; - ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx, - vif->listen_intvl_t, 0); - - return count; -} - -static ssize_t ath6kl_listen_int_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - struct ath6kl_vif *vif; - char buf[32]; - int len; - - vif = ath6kl_vif_first(ar); - if (!vif) - return -EIO; - - len = scnprintf(buf, sizeof(buf), "%u\n", vif->listen_intvl_t); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static const struct file_operations fops_listen_int = { - .read = ath6kl_listen_int_read, - .write = ath6kl_listen_int_write, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t ath6kl_power_params_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath6kl *ar = file->private_data; - u8 buf[100]; - unsigned int len = 0; - char *sptr, *token; - u16 idle_period, ps_poll_num, dtim, - tx_wakeup, num_tx; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - buf[len] = '\0'; - sptr = buf; - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou16(token, 0, &idle_period)) - return -EINVAL; - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou16(token, 0, &ps_poll_num)) - return -EINVAL; - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou16(token, 0, &dtim)) - return -EINVAL; - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou16(token, 0, &tx_wakeup)) - return -EINVAL; - - token = strsep(&sptr, " "); - if (!token) - return -EINVAL; - if (kstrtou16(token, 0, &num_tx)) - return -EINVAL; - - ath6kl_wmi_pmparams_cmd(ar->wmi, 0, idle_period, ps_poll_num, - dtim, tx_wakeup, num_tx, 0); - - return count; -} - -static const struct file_operations fops_power_params = { - .write = ath6kl_power_params_write, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -void ath6kl_debug_init(struct ath6kl *ar) -{ - skb_queue_head_init(&ar->debug.fwlog_queue); - init_completion(&ar->debug.fwlog_completion); - - /* - * Actually we are lying here but don't know how to read the mask - * value from the firmware. - */ - ar->debug.fwlog_mask = 0; -} - -/* - * Initialisation needs to happen in two stages as fwlog events can come - * before cfg80211 is initialised, and debugfs depends on cfg80211 - * initialisation. - */ -int ath6kl_debug_init_fs(struct ath6kl *ar) -{ - ar->debugfs_phy = debugfs_create_dir("ath6kl", - ar->wiphy->debugfsdir); - if (!ar->debugfs_phy) - return -ENOMEM; - - debugfs_create_file("tgt_stats", S_IRUSR, ar->debugfs_phy, ar, - &fops_tgt_stats); - - if (ar->hif_type == ATH6KL_HIF_TYPE_SDIO) - debugfs_create_file("credit_dist_stats", S_IRUSR, - ar->debugfs_phy, ar, - &fops_credit_dist_stats); - - debugfs_create_file("endpoint_stats", S_IRUSR | S_IWUSR, - ar->debugfs_phy, ar, &fops_endpoint_stats); - - debugfs_create_file("fwlog", S_IRUSR, ar->debugfs_phy, ar, - &fops_fwlog); - - debugfs_create_file("fwlog_block", S_IRUSR, ar->debugfs_phy, ar, - &fops_fwlog_block); - - debugfs_create_file("fwlog_mask", S_IRUSR | S_IWUSR, ar->debugfs_phy, - ar, &fops_fwlog_mask); - - debugfs_create_file("reg_addr", S_IRUSR | S_IWUSR, ar->debugfs_phy, ar, - &fops_diag_reg_read); - - debugfs_create_file("reg_dump", S_IRUSR, ar->debugfs_phy, ar, - &fops_reg_dump); - - debugfs_create_file("lrssi_roam_threshold", S_IRUSR | S_IWUSR, - ar->debugfs_phy, ar, &fops_lrssi_roam_threshold); - - debugfs_create_file("reg_write", S_IRUSR | S_IWUSR, - ar->debugfs_phy, ar, &fops_diag_reg_write); - - debugfs_create_file("war_stats", S_IRUSR, ar->debugfs_phy, ar, - &fops_war_stats); - - debugfs_create_file("roam_table", S_IRUSR, ar->debugfs_phy, ar, - &fops_roam_table); - - debugfs_create_file("force_roam", S_IWUSR, ar->debugfs_phy, ar, - &fops_force_roam); - - debugfs_create_file("roam_mode", S_IWUSR, ar->debugfs_phy, ar, - &fops_roam_mode); - - debugfs_create_file("keepalive", S_IRUSR | S_IWUSR, ar->debugfs_phy, ar, - &fops_keepalive); - - debugfs_create_file("disconnect_timeout", S_IRUSR | S_IWUSR, - ar->debugfs_phy, ar, &fops_disconnect_timeout); - - debugfs_create_file("create_qos", S_IWUSR, ar->debugfs_phy, ar, - &fops_create_qos); - - debugfs_create_file("delete_qos", S_IWUSR, ar->debugfs_phy, ar, - &fops_delete_qos); - - debugfs_create_file("bgscan_interval", S_IWUSR, - ar->debugfs_phy, ar, &fops_bgscan_int); - - debugfs_create_file("listen_interval", S_IRUSR | S_IWUSR, - ar->debugfs_phy, ar, &fops_listen_int); - - debugfs_create_file("power_params", S_IWUSR, ar->debugfs_phy, ar, - &fops_power_params); - - return 0; -} - -void ath6kl_debug_cleanup(struct ath6kl *ar) -{ - skb_queue_purge(&ar->debug.fwlog_queue); - complete(&ar->debug.fwlog_completion); - kfree(ar->debug.roam_tbl); -} - -#endif diff --git a/drivers/net/wireless/ath/ath6kl/debug.h b/drivers/net/wireless/ath/ath6kl/debug.h deleted file mode 100644 index 74369de00fb5..000000000000 --- a/drivers/net/wireless/ath/ath6kl/debug.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef DEBUG_H -#define DEBUG_H - -#include "hif.h" -#include "trace.h" - -enum ATH6K_DEBUG_MASK { - ATH6KL_DBG_CREDIT = BIT(0), - /* hole */ - ATH6KL_DBG_WLAN_TX = BIT(2), /* wlan tx */ - ATH6KL_DBG_WLAN_RX = BIT(3), /* wlan rx */ - ATH6KL_DBG_BMI = BIT(4), /* bmi tracing */ - ATH6KL_DBG_HTC = BIT(5), - ATH6KL_DBG_HIF = BIT(6), - ATH6KL_DBG_IRQ = BIT(7), /* interrupt processing */ - /* hole */ - /* hole */ - ATH6KL_DBG_WMI = BIT(10), /* wmi tracing */ - ATH6KL_DBG_TRC = BIT(11), /* generic func tracing */ - ATH6KL_DBG_SCATTER = BIT(12), /* hif scatter tracing */ - ATH6KL_DBG_WLAN_CFG = BIT(13), /* cfg80211 i/f file tracing */ - ATH6KL_DBG_RAW_BYTES = BIT(14), /* dump tx/rx frames */ - ATH6KL_DBG_AGGR = BIT(15), /* aggregation */ - ATH6KL_DBG_SDIO = BIT(16), - ATH6KL_DBG_SDIO_DUMP = BIT(17), - ATH6KL_DBG_BOOT = BIT(18), /* driver init and fw boot */ - ATH6KL_DBG_WMI_DUMP = BIT(19), - ATH6KL_DBG_SUSPEND = BIT(20), - ATH6KL_DBG_USB = BIT(21), - ATH6KL_DBG_USB_BULK = BIT(22), - ATH6KL_DBG_RECOVERY = BIT(23), - ATH6KL_DBG_ANY = 0xffffffff /* enable all logs */ -}; - -extern unsigned int debug_mask; -extern __printf(2, 3) -int ath6kl_printk(const char *level, const char *fmt, ...); -extern __printf(1, 2) int ath6kl_info(const char *fmt, ...); -extern __printf(1, 2) int ath6kl_err(const char *fmt, ...); -extern __printf(1, 2) int ath6kl_warn(const char *fmt, ...); - -enum ath6kl_war { - ATH6KL_WAR_INVALID_RATE, -}; - -#ifdef CONFIG_ATH6KL_DEBUG - -void ath6kl_dbg(enum ATH6K_DEBUG_MASK mask, const char *fmt, ...); -void ath6kl_dbg_dump(enum ATH6K_DEBUG_MASK mask, - const char *msg, const char *prefix, - const void *buf, size_t len); - -void ath6kl_dump_registers(struct ath6kl_device *dev, - struct ath6kl_irq_proc_registers *irq_proc_reg, - struct ath6kl_irq_enable_reg *irq_en_reg); -void dump_cred_dist_stats(struct htc_target *target); -void ath6kl_debug_fwlog_event(struct ath6kl *ar, const void *buf, size_t len); -void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war); -int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, const void *buf, - size_t len); -void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive); -void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, u8 timeout); -void ath6kl_debug_init(struct ath6kl *ar); -int ath6kl_debug_init_fs(struct ath6kl *ar); -void ath6kl_debug_cleanup(struct ath6kl *ar); - -#else -static inline int ath6kl_dbg(enum ATH6K_DEBUG_MASK dbg_mask, - const char *fmt, ...) -{ - return 0; -} - -static inline void ath6kl_dbg_dump(enum ATH6K_DEBUG_MASK mask, - const char *msg, const char *prefix, - const void *buf, size_t len) -{ -} - -static inline void ath6kl_dump_registers(struct ath6kl_device *dev, - struct ath6kl_irq_proc_registers *irq_proc_reg, - struct ath6kl_irq_enable_reg *irq_en_reg) -{ - -} -static inline void dump_cred_dist_stats(struct htc_target *target) -{ -} - -static inline void ath6kl_debug_fwlog_event(struct ath6kl *ar, - const void *buf, size_t len) -{ -} - -static inline void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war) -{ -} - -static inline int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, - const void *buf, size_t len) -{ - return 0; -} - -static inline void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive) -{ -} - -static inline void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, - u8 timeout) -{ -} - -static inline void ath6kl_debug_init(struct ath6kl *ar) -{ -} - -static inline int ath6kl_debug_init_fs(struct ath6kl *ar) -{ - return 0; -} - -static inline void ath6kl_debug_cleanup(struct ath6kl *ar) -{ -} - -#endif -#endif diff --git a/drivers/net/wireless/ath/ath6kl/hif-ops.h b/drivers/net/wireless/ath/ath6kl/hif-ops.h deleted file mode 100644 index 8c9e72d5250d..000000000000 --- a/drivers/net/wireless/ath/ath6kl/hif-ops.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2004-2011 Atheros Communications Inc. - * Copyright (c) 2011 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef HIF_OPS_H -#define HIF_OPS_H - -#include "hif.h" -#include "debug.h" - -static inline int hif_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf, - u32 len, u32 request) -{ - ath6kl_dbg(ATH6KL_DBG_HIF, - "hif %s sync addr 0x%x buf 0x%p len %d request 0x%x\n", - (request & HIF_WRITE) ? "write" : "read", - addr, buf, len, request); - - return ar->hif_ops->read_write_sync(ar, addr, buf, len, request); -} - -static inline int hif_write_async(struct ath6kl *ar, u32 address, u8 *buffer, - u32 length, u32 request, - struct htc_packet *packet) -{ - ath6kl_dbg(ATH6KL_DBG_HIF, - "hif write async addr 0x%x buf 0x%p len %d request 0x%x\n", - address, buffer, length, request); - - return ar->hif_ops->write_async(ar, address, buffer, length, - request, packet); -} -static inline void ath6kl_hif_irq_enable(struct ath6kl *ar) -{ - ath6kl_dbg(ATH6KL_DBG_HIF, "hif irq enable\n"); - - return ar->hif_ops->irq_enable(ar); -} - -static inline void ath6kl_hif_irq_disable(struct ath6kl *ar) -{ - ath6kl_dbg(ATH6KL_DBG_HIF, "hif irq disable\n"); - - return ar->hif_ops->irq_disable(ar); -} - -static inline struct hif_scatter_req *hif_scatter_req_get(struct ath6kl *ar) -{ - return ar->hif_ops->scatter_req_get(ar); -} - -static inline void hif_scatter_req_add(struct ath6kl *ar, - struct hif_scatter_req *s_req) -{ - return ar->hif_ops->scatter_req_add(ar, s_req); -} - -static inline int ath6kl_hif_enable_scatter(struct ath6kl *ar) -{ - return ar->hif_ops->enable_scatter(ar); -} - -static inline int ath6kl_hif_scat_req_rw(struct ath6kl *ar, - struct hif_scatter_req *scat_req) -{ - return ar->hif_ops->scat_req_rw(ar, scat_req); -} - -static inline void ath6kl_hif_cleanup_scatter(struct ath6kl *ar) -{ - return ar->hif_ops->cleanup_scatter(ar); -} - -static inline int ath6kl_hif_suspend(struct ath6kl *ar, - struct cfg80211_wowlan *wow) -{ - ath6kl_dbg(ATH6KL_DBG_HIF, "hif suspend\n"); - - return ar->hif_ops->suspend(ar, wow); -} - -/* - * Read from the ATH6KL through its diagnostic window. No cooperation from - * the Target is required for this. - */ -static inline int ath6kl_hif_diag_read32(struct ath6kl *ar, u32 address, - u32 *value) -{ - return ar->hif_ops->diag_read32(ar, address, value); -} - -/* - * Write to the ATH6KL through its diagnostic window. No cooperation from - * the Target is required for this. - */ -static inline int ath6kl_hif_diag_write32(struct ath6kl *ar, u32 address, - __le32 value) -{ - return ar->hif_ops->diag_write32(ar, address, value); -} - -static inline int ath6kl_hif_bmi_read(struct ath6kl *ar, u8 *buf, u32 len) -{ - return ar->hif_ops->bmi_read(ar, buf, len); -} - -static inline int ath6kl_hif_bmi_write(struct ath6kl *ar, u8 *buf, u32 len) -{ - return ar->hif_ops->bmi_write(ar, buf, len); -} - -static inline int ath6kl_hif_resume(struct ath6kl *ar) -{ - ath6kl_dbg(ATH6KL_DBG_HIF, "hif resume\n"); - - return ar->hif_ops->resume(ar); -} - -static inline int ath6kl_hif_power_on(struct ath6kl *ar) -{ - ath6kl_dbg(ATH6KL_DBG_HIF, "hif power on\n"); - - return ar->hif_ops->power_on(ar); -} - -static inline int ath6kl_hif_power_off(struct ath6kl *ar) -{ - ath6kl_dbg(ATH6KL_DBG_HIF, "hif power off\n"); - - return ar->hif_ops->power_off(ar); -} - -static inline void ath6kl_hif_stop(struct ath6kl *ar) -{ - ath6kl_dbg(ATH6KL_DBG_HIF, "hif stop\n"); - - ar->hif_ops->stop(ar); -} - -static inline int ath6kl_hif_pipe_send(struct ath6kl *ar, - u8 pipe, struct sk_buff *hdr_buf, - struct sk_buff *buf) -{ - ath6kl_dbg(ATH6KL_DBG_HIF, "hif pipe send\n"); - - return ar->hif_ops->pipe_send(ar, pipe, hdr_buf, buf); -} - -static inline void ath6kl_hif_pipe_get_default(struct ath6kl *ar, - u8 *ul_pipe, u8 *dl_pipe) -{ - ath6kl_dbg(ATH6KL_DBG_HIF, "hif pipe get default\n"); - - ar->hif_ops->pipe_get_default(ar, ul_pipe, dl_pipe); -} - -static inline int ath6kl_hif_pipe_map_service(struct ath6kl *ar, - u16 service_id, u8 *ul_pipe, - u8 *dl_pipe) -{ - ath6kl_dbg(ATH6KL_DBG_HIF, "hif pipe get default\n"); - - return ar->hif_ops->pipe_map_service(ar, service_id, ul_pipe, dl_pipe); -} - -static inline u16 ath6kl_hif_pipe_get_free_queue_number(struct ath6kl *ar, - u8 pipe) -{ - ath6kl_dbg(ATH6KL_DBG_HIF, "hif pipe get free queue number\n"); - - return ar->hif_ops->pipe_get_free_queue_number(ar, pipe); -} - -#endif diff --git a/drivers/net/wireless/ath/ath6kl/hif.c b/drivers/net/wireless/ath/ath6kl/hif.c deleted file mode 100644 index fea7709b5dda..000000000000 --- a/drivers/net/wireless/ath/ath6kl/hif.c +++ /dev/null @@ -1,705 +0,0 @@ -/* - * Copyright (c) 2007-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#include "hif.h" - -#include - -#include "core.h" -#include "target.h" -#include "hif-ops.h" -#include "debug.h" -#include "trace.h" - -#define MAILBOX_FOR_BLOCK_SIZE 1 - -#define ATH6KL_TIME_QUANTUM 10 /* in ms */ - -static int ath6kl_hif_cp_scat_dma_buf(struct hif_scatter_req *req, - bool from_dma) -{ - u8 *buf; - int i; - - buf = req->virt_dma_buf; - - for (i = 0; i < req->scat_entries; i++) { - - if (from_dma) - memcpy(req->scat_list[i].buf, buf, - req->scat_list[i].len); - else - memcpy(buf, req->scat_list[i].buf, - req->scat_list[i].len); - - buf += req->scat_list[i].len; - } - - return 0; -} - -int ath6kl_hif_rw_comp_handler(void *context, int status) -{ - struct htc_packet *packet = context; - - ath6kl_dbg(ATH6KL_DBG_HIF, "hif rw completion pkt 0x%p status %d\n", - packet, status); - - packet->status = status; - packet->completion(packet->context, packet); - - return 0; -} -EXPORT_SYMBOL(ath6kl_hif_rw_comp_handler); - -#define REG_DUMP_COUNT_AR6003 60 -#define REGISTER_DUMP_LEN_MAX 60 - -static void ath6kl_hif_dump_fw_crash(struct ath6kl *ar) -{ - __le32 regdump_val[REGISTER_DUMP_LEN_MAX]; - u32 i, address, regdump_addr = 0; - int ret; - - if (ar->target_type != TARGET_TYPE_AR6003) - return; - - /* the reg dump pointer is copied to the host interest area */ - address = ath6kl_get_hi_item_addr(ar, HI_ITEM(hi_failure_state)); - address = TARG_VTOP(ar->target_type, address); - - /* read RAM location through diagnostic window */ - ret = ath6kl_diag_read32(ar, address, ®dump_addr); - - if (ret || !regdump_addr) { - ath6kl_warn("failed to get ptr to register dump area: %d\n", - ret); - return; - } - - ath6kl_dbg(ATH6KL_DBG_IRQ, "register dump data address 0x%x\n", - regdump_addr); - regdump_addr = TARG_VTOP(ar->target_type, regdump_addr); - - /* fetch register dump data */ - ret = ath6kl_diag_read(ar, regdump_addr, (u8 *)®dump_val[0], - REG_DUMP_COUNT_AR6003 * (sizeof(u32))); - if (ret) { - ath6kl_warn("failed to get register dump: %d\n", ret); - return; - } - - ath6kl_info("crash dump:\n"); - ath6kl_info("hw 0x%x fw %s\n", ar->wiphy->hw_version, - ar->wiphy->fw_version); - - BUILD_BUG_ON(REG_DUMP_COUNT_AR6003 % 4); - - for (i = 0; i < REG_DUMP_COUNT_AR6003; i += 4) { - ath6kl_info("%d: 0x%8.8x 0x%8.8x 0x%8.8x 0x%8.8x\n", - i, - le32_to_cpu(regdump_val[i]), - le32_to_cpu(regdump_val[i + 1]), - le32_to_cpu(regdump_val[i + 2]), - le32_to_cpu(regdump_val[i + 3])); - } - -} - -static int ath6kl_hif_proc_dbg_intr(struct ath6kl_device *dev) -{ - u32 dummy; - int ret; - - ath6kl_warn("firmware crashed\n"); - - /* - * read counter to clear the interrupt, the debug error interrupt is - * counter 0. - */ - ret = hif_read_write_sync(dev->ar, COUNT_DEC_ADDRESS, - (u8 *)&dummy, 4, HIF_RD_SYNC_BYTE_INC); - if (ret) - ath6kl_warn("Failed to clear debug interrupt: %d\n", ret); - - ath6kl_hif_dump_fw_crash(dev->ar); - ath6kl_read_fwlogs(dev->ar); - ath6kl_recovery_err_notify(dev->ar, ATH6KL_FW_ASSERT); - - return ret; -} - -/* mailbox recv message polling */ -int ath6kl_hif_poll_mboxmsg_rx(struct ath6kl_device *dev, u32 *lk_ahd, - int timeout) -{ - struct ath6kl_irq_proc_registers *rg; - int status = 0, i; - u8 htc_mbox = 1 << HTC_MAILBOX; - - for (i = timeout / ATH6KL_TIME_QUANTUM; i > 0; i--) { - /* this is the standard HIF way, load the reg table */ - status = hif_read_write_sync(dev->ar, HOST_INT_STATUS_ADDRESS, - (u8 *) &dev->irq_proc_reg, - sizeof(dev->irq_proc_reg), - HIF_RD_SYNC_BYTE_INC); - - if (status) { - ath6kl_err("failed to read reg table\n"); - return status; - } - - /* check for MBOX data and valid lookahead */ - if (dev->irq_proc_reg.host_int_status & htc_mbox) { - if (dev->irq_proc_reg.rx_lkahd_valid & - htc_mbox) { - /* - * Mailbox has a message and the look ahead - * is valid. - */ - rg = &dev->irq_proc_reg; - *lk_ahd = - le32_to_cpu(rg->rx_lkahd[HTC_MAILBOX]); - break; - } - } - - /* delay a little */ - mdelay(ATH6KL_TIME_QUANTUM); - ath6kl_dbg(ATH6KL_DBG_HIF, "hif retry mbox poll try %d\n", i); - } - - if (i == 0) { - ath6kl_err("timeout waiting for recv message\n"); - status = -ETIME; - /* check if the target asserted */ - if (dev->irq_proc_reg.counter_int_status & - ATH6KL_TARGET_DEBUG_INTR_MASK) - /* - * Target failure handler will be called in case of - * an assert. - */ - ath6kl_hif_proc_dbg_intr(dev); - } - - return status; -} - -/* - * Disable packet reception (used in case the host runs out of buffers) - * using the interrupt enable registers through the host I/F - */ -int ath6kl_hif_rx_control(struct ath6kl_device *dev, bool enable_rx) -{ - struct ath6kl_irq_enable_reg regs; - int status = 0; - - ath6kl_dbg(ATH6KL_DBG_HIF, "hif rx %s\n", - enable_rx ? "enable" : "disable"); - - /* take the lock to protect interrupt enable shadows */ - spin_lock_bh(&dev->lock); - - if (enable_rx) - dev->irq_en_reg.int_status_en |= - SM(INT_STATUS_ENABLE_MBOX_DATA, 0x01); - else - dev->irq_en_reg.int_status_en &= - ~SM(INT_STATUS_ENABLE_MBOX_DATA, 0x01); - - memcpy(®s, &dev->irq_en_reg, sizeof(regs)); - - spin_unlock_bh(&dev->lock); - - status = hif_read_write_sync(dev->ar, INT_STATUS_ENABLE_ADDRESS, - ®s.int_status_en, - sizeof(struct ath6kl_irq_enable_reg), - HIF_WR_SYNC_BYTE_INC); - - return status; -} - -int ath6kl_hif_submit_scat_req(struct ath6kl_device *dev, - struct hif_scatter_req *scat_req, bool read) -{ - int status = 0; - - if (read) { - scat_req->req = HIF_RD_SYNC_BLOCK_FIX; - scat_req->addr = dev->ar->mbox_info.htc_addr; - } else { - scat_req->req = HIF_WR_ASYNC_BLOCK_INC; - - scat_req->addr = - (scat_req->len > HIF_MBOX_WIDTH) ? - dev->ar->mbox_info.htc_ext_addr : - dev->ar->mbox_info.htc_addr; - } - - ath6kl_dbg(ATH6KL_DBG_HIF, - "hif submit scatter request entries %d len %d mbox 0x%x %s %s\n", - scat_req->scat_entries, scat_req->len, - scat_req->addr, !read ? "async" : "sync", - (read) ? "rd" : "wr"); - - if (!read && scat_req->virt_scat) { - status = ath6kl_hif_cp_scat_dma_buf(scat_req, false); - if (status) { - scat_req->status = status; - scat_req->complete(dev->ar->htc_target, scat_req); - return 0; - } - } - - status = ath6kl_hif_scat_req_rw(dev->ar, scat_req); - - if (read) { - /* in sync mode, we can touch the scatter request */ - scat_req->status = status; - if (!status && scat_req->virt_scat) - scat_req->status = - ath6kl_hif_cp_scat_dma_buf(scat_req, true); - } - - return status; -} - -static int ath6kl_hif_proc_counter_intr(struct ath6kl_device *dev) -{ - u8 counter_int_status; - - ath6kl_dbg(ATH6KL_DBG_IRQ, "counter interrupt\n"); - - counter_int_status = dev->irq_proc_reg.counter_int_status & - dev->irq_en_reg.cntr_int_status_en; - - ath6kl_dbg(ATH6KL_DBG_IRQ, - "valid interrupt source(s) in COUNTER_INT_STATUS: 0x%x\n", - counter_int_status); - - /* - * NOTE: other modules like GMBOX may use the counter interrupt for - * credit flow control on other counters, we only need to check for - * the debug assertion counter interrupt. - */ - if (counter_int_status & ATH6KL_TARGET_DEBUG_INTR_MASK) - return ath6kl_hif_proc_dbg_intr(dev); - - return 0; -} - -static int ath6kl_hif_proc_err_intr(struct ath6kl_device *dev) -{ - int status; - u8 error_int_status; - u8 reg_buf[4]; - - ath6kl_dbg(ATH6KL_DBG_IRQ, "error interrupt\n"); - - error_int_status = dev->irq_proc_reg.error_int_status & 0x0F; - if (!error_int_status) { - WARN_ON(1); - return -EIO; - } - - ath6kl_dbg(ATH6KL_DBG_IRQ, - "valid interrupt source(s) in ERROR_INT_STATUS: 0x%x\n", - error_int_status); - - if (MS(ERROR_INT_STATUS_WAKEUP, error_int_status)) - ath6kl_dbg(ATH6KL_DBG_IRQ, "error : wakeup\n"); - - if (MS(ERROR_INT_STATUS_RX_UNDERFLOW, error_int_status)) - ath6kl_err("rx underflow\n"); - - if (MS(ERROR_INT_STATUS_TX_OVERFLOW, error_int_status)) - ath6kl_err("tx overflow\n"); - - /* Clear the interrupt */ - dev->irq_proc_reg.error_int_status &= ~error_int_status; - - /* set W1C value to clear the interrupt, this hits the register first */ - reg_buf[0] = error_int_status; - reg_buf[1] = 0; - reg_buf[2] = 0; - reg_buf[3] = 0; - - status = hif_read_write_sync(dev->ar, ERROR_INT_STATUS_ADDRESS, - reg_buf, 4, HIF_WR_SYNC_BYTE_FIX); - - WARN_ON(status); - - return status; -} - -static int ath6kl_hif_proc_cpu_intr(struct ath6kl_device *dev) -{ - int status; - u8 cpu_int_status; - u8 reg_buf[4]; - - ath6kl_dbg(ATH6KL_DBG_IRQ, "cpu interrupt\n"); - - cpu_int_status = dev->irq_proc_reg.cpu_int_status & - dev->irq_en_reg.cpu_int_status_en; - if (!cpu_int_status) { - WARN_ON(1); - return -EIO; - } - - ath6kl_dbg(ATH6KL_DBG_IRQ, - "valid interrupt source(s) in CPU_INT_STATUS: 0x%x\n", - cpu_int_status); - - /* Clear the interrupt */ - dev->irq_proc_reg.cpu_int_status &= ~cpu_int_status; - - /* - * Set up the register transfer buffer to hit the register 4 times , - * this is done to make the access 4-byte aligned to mitigate issues - * with host bus interconnects that restrict bus transfer lengths to - * be a multiple of 4-bytes. - */ - - /* set W1C value to clear the interrupt, this hits the register first */ - reg_buf[0] = cpu_int_status; - /* the remaining are set to zero which have no-effect */ - reg_buf[1] = 0; - reg_buf[2] = 0; - reg_buf[3] = 0; - - status = hif_read_write_sync(dev->ar, CPU_INT_STATUS_ADDRESS, - reg_buf, 4, HIF_WR_SYNC_BYTE_FIX); - - WARN_ON(status); - - return status; -} - -/* process pending interrupts synchronously */ -static int proc_pending_irqs(struct ath6kl_device *dev, bool *done) -{ - struct ath6kl_irq_proc_registers *rg; - int status = 0; - u8 host_int_status = 0; - u32 lk_ahd = 0; - u8 htc_mbox = 1 << HTC_MAILBOX; - - ath6kl_dbg(ATH6KL_DBG_IRQ, "proc_pending_irqs: (dev: 0x%p)\n", dev); - - /* - * NOTE: HIF implementation guarantees that the context of this - * call allows us to perform SYNCHRONOUS I/O, that is we can block, - * sleep or call any API that can block or switch thread/task - * contexts. This is a fully schedulable context. - */ - - /* - * Process pending intr only when int_status_en is clear, it may - * result in unnecessary bus transaction otherwise. Target may be - * unresponsive at the time. - */ - if (dev->irq_en_reg.int_status_en) { - /* - * Read the first 28 bytes of the HTC register table. This - * will yield us the value of different int status - * registers and the lookahead registers. - * - * length = sizeof(int_status) + sizeof(cpu_int_status) - * + sizeof(error_int_status) + - * sizeof(counter_int_status) + - * sizeof(mbox_frame) + sizeof(rx_lkahd_valid) - * + sizeof(hole) + sizeof(rx_lkahd) + - * sizeof(int_status_en) + - * sizeof(cpu_int_status_en) + - * sizeof(err_int_status_en) + - * sizeof(cntr_int_status_en); - */ - status = hif_read_write_sync(dev->ar, HOST_INT_STATUS_ADDRESS, - (u8 *) &dev->irq_proc_reg, - sizeof(dev->irq_proc_reg), - HIF_RD_SYNC_BYTE_INC); - if (status) - goto out; - - ath6kl_dump_registers(dev, &dev->irq_proc_reg, - &dev->irq_en_reg); - trace_ath6kl_sdio_irq(&dev->irq_en_reg, - sizeof(dev->irq_en_reg)); - - /* Update only those registers that are enabled */ - host_int_status = dev->irq_proc_reg.host_int_status & - dev->irq_en_reg.int_status_en; - - /* Look at mbox status */ - if (host_int_status & htc_mbox) { - /* - * Mask out pending mbox value, we use "lookAhead as - * the real flag for mbox processing. - */ - host_int_status &= ~htc_mbox; - if (dev->irq_proc_reg.rx_lkahd_valid & - htc_mbox) { - rg = &dev->irq_proc_reg; - lk_ahd = le32_to_cpu(rg->rx_lkahd[HTC_MAILBOX]); - if (!lk_ahd) - ath6kl_err("lookAhead is zero!\n"); - } - } - } - - if (!host_int_status && !lk_ahd) { - *done = true; - goto out; - } - - if (lk_ahd) { - int fetched = 0; - - ath6kl_dbg(ATH6KL_DBG_IRQ, - "pending mailbox msg, lk_ahd: 0x%X\n", lk_ahd); - /* - * Mailbox Interrupt, the HTC layer may issue async - * requests to empty the mailbox. When emptying the recv - * mailbox we use the async handler above called from the - * completion routine of the callers read request. This can - * improve performance by reducing context switching when - * we rapidly pull packets. - */ - status = ath6kl_htc_rxmsg_pending_handler(dev->htc_cnxt, - lk_ahd, &fetched); - if (status) - goto out; - - if (!fetched) - /* - * HTC could not pull any messages out due to lack - * of resources. - */ - dev->htc_cnxt->chk_irq_status_cnt = 0; - } - - /* now handle the rest of them */ - ath6kl_dbg(ATH6KL_DBG_IRQ, - "valid interrupt source(s) for other interrupts: 0x%x\n", - host_int_status); - - if (MS(HOST_INT_STATUS_CPU, host_int_status)) { - /* CPU Interrupt */ - status = ath6kl_hif_proc_cpu_intr(dev); - if (status) - goto out; - } - - if (MS(HOST_INT_STATUS_ERROR, host_int_status)) { - /* Error Interrupt */ - status = ath6kl_hif_proc_err_intr(dev); - if (status) - goto out; - } - - if (MS(HOST_INT_STATUS_COUNTER, host_int_status)) - /* Counter Interrupt */ - status = ath6kl_hif_proc_counter_intr(dev); - -out: - /* - * An optimization to bypass reading the IRQ status registers - * unecessarily which can re-wake the target, if upper layers - * determine that we are in a low-throughput mode, we can rely on - * taking another interrupt rather than re-checking the status - * registers which can re-wake the target. - * - * NOTE : for host interfaces that makes use of detecting pending - * mbox messages at hif can not use this optimization due to - * possible side effects, SPI requires the host to drain all - * messages from the mailbox before exiting the ISR routine. - */ - - ath6kl_dbg(ATH6KL_DBG_IRQ, - "bypassing irq status re-check, forcing done\n"); - - if (!dev->htc_cnxt->chk_irq_status_cnt) - *done = true; - - ath6kl_dbg(ATH6KL_DBG_IRQ, - "proc_pending_irqs: (done:%d, status=%d\n", *done, status); - - return status; -} - -/* interrupt handler, kicks off all interrupt processing */ -int ath6kl_hif_intr_bh_handler(struct ath6kl *ar) -{ - struct ath6kl_device *dev = ar->htc_target->dev; - unsigned long timeout; - int status = 0; - bool done = false; - - /* - * Reset counter used to flag a re-scan of IRQ status registers on - * the target. - */ - dev->htc_cnxt->chk_irq_status_cnt = 0; - - /* - * IRQ processing is synchronous, interrupt status registers can be - * re-read. - */ - timeout = jiffies + msecs_to_jiffies(ATH6KL_HIF_COMMUNICATION_TIMEOUT); - while (time_before(jiffies, timeout) && !done) { - status = proc_pending_irqs(dev, &done); - if (status) - break; - } - - return status; -} -EXPORT_SYMBOL(ath6kl_hif_intr_bh_handler); - -static int ath6kl_hif_enable_intrs(struct ath6kl_device *dev) -{ - struct ath6kl_irq_enable_reg regs; - int status; - - spin_lock_bh(&dev->lock); - - /* Enable all but ATH6KL CPU interrupts */ - dev->irq_en_reg.int_status_en = - SM(INT_STATUS_ENABLE_ERROR, 0x01) | - SM(INT_STATUS_ENABLE_CPU, 0x01) | - SM(INT_STATUS_ENABLE_COUNTER, 0x01); - - /* - * NOTE: There are some cases where HIF can do detection of - * pending mbox messages which is disabled now. - */ - dev->irq_en_reg.int_status_en |= SM(INT_STATUS_ENABLE_MBOX_DATA, 0x01); - - /* Set up the CPU Interrupt status Register */ - dev->irq_en_reg.cpu_int_status_en = 0; - - /* Set up the Error Interrupt status Register */ - dev->irq_en_reg.err_int_status_en = - SM(ERROR_STATUS_ENABLE_RX_UNDERFLOW, 0x01) | - SM(ERROR_STATUS_ENABLE_TX_OVERFLOW, 0x1); - - /* - * Enable Counter interrupt status register to get fatal errors for - * debugging. - */ - dev->irq_en_reg.cntr_int_status_en = SM(COUNTER_INT_STATUS_ENABLE_BIT, - ATH6KL_TARGET_DEBUG_INTR_MASK); - memcpy(®s, &dev->irq_en_reg, sizeof(regs)); - - spin_unlock_bh(&dev->lock); - - status = hif_read_write_sync(dev->ar, INT_STATUS_ENABLE_ADDRESS, - ®s.int_status_en, sizeof(regs), - HIF_WR_SYNC_BYTE_INC); - - if (status) - ath6kl_err("failed to update interrupt ctl reg err: %d\n", - status); - - return status; -} - -int ath6kl_hif_disable_intrs(struct ath6kl_device *dev) -{ - struct ath6kl_irq_enable_reg regs; - - spin_lock_bh(&dev->lock); - /* Disable all interrupts */ - dev->irq_en_reg.int_status_en = 0; - dev->irq_en_reg.cpu_int_status_en = 0; - dev->irq_en_reg.err_int_status_en = 0; - dev->irq_en_reg.cntr_int_status_en = 0; - memcpy(®s, &dev->irq_en_reg, sizeof(regs)); - spin_unlock_bh(&dev->lock); - - return hif_read_write_sync(dev->ar, INT_STATUS_ENABLE_ADDRESS, - ®s.int_status_en, sizeof(regs), - HIF_WR_SYNC_BYTE_INC); -} - -/* enable device interrupts */ -int ath6kl_hif_unmask_intrs(struct ath6kl_device *dev) -{ - int status = 0; - - /* - * Make sure interrupt are disabled before unmasking at the HIF - * layer. The rationale here is that between device insertion - * (where we clear the interrupts the first time) and when HTC - * is finally ready to handle interrupts, other software can perform - * target "soft" resets. The ATH6KL interrupt enables reset back to an - * "enabled" state when this happens. - */ - ath6kl_hif_disable_intrs(dev); - - /* unmask the host controller interrupts */ - ath6kl_hif_irq_enable(dev->ar); - status = ath6kl_hif_enable_intrs(dev); - - return status; -} - -/* disable all device interrupts */ -int ath6kl_hif_mask_intrs(struct ath6kl_device *dev) -{ - /* - * Mask the interrupt at the HIF layer to avoid any stray interrupt - * taken while we zero out our shadow registers in - * ath6kl_hif_disable_intrs(). - */ - ath6kl_hif_irq_disable(dev->ar); - - return ath6kl_hif_disable_intrs(dev); -} - -int ath6kl_hif_setup(struct ath6kl_device *dev) -{ - int status = 0; - - spin_lock_init(&dev->lock); - - /* - * NOTE: we actually get the block size of a mailbox other than 0, - * for SDIO the block size on mailbox 0 is artificially set to 1. - * So we use the block size that is set for the other 3 mailboxes. - */ - dev->htc_cnxt->block_sz = dev->ar->mbox_info.block_size; - - /* must be a power of 2 */ - if ((dev->htc_cnxt->block_sz & (dev->htc_cnxt->block_sz - 1)) != 0) { - WARN_ON(1); - status = -EINVAL; - goto fail_setup; - } - - /* assemble mask, used for padding to a block */ - dev->htc_cnxt->block_mask = dev->htc_cnxt->block_sz - 1; - - ath6kl_dbg(ATH6KL_DBG_HIF, "hif block size %d mbox addr 0x%x\n", - dev->htc_cnxt->block_sz, dev->ar->mbox_info.htc_addr); - - status = ath6kl_hif_disable_intrs(dev); - -fail_setup: - return status; - -} diff --git a/drivers/net/wireless/ath/ath6kl/hif.h b/drivers/net/wireless/ath/ath6kl/hif.h deleted file mode 100644 index 61f6b21fb0ae..000000000000 --- a/drivers/net/wireless/ath/ath6kl/hif.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (c) 2004-2011 Atheros Communications Inc. - * Copyright (c) 2011 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef HIF_H -#define HIF_H - -#include "common.h" -#include "core.h" - -#include - -#define BUS_REQUEST_MAX_NUM 64 -#define HIF_MBOX_BLOCK_SIZE 128 -#define HIF_MBOX0_BLOCK_SIZE 1 - -#define HIF_DMA_BUFFER_SIZE (32 * 1024) -#define CMD53_FIXED_ADDRESS 1 -#define CMD53_INCR_ADDRESS 2 - -#define MAX_SCATTER_REQUESTS 4 -#define MAX_SCATTER_ENTRIES_PER_REQ 16 -#define MAX_SCATTER_REQ_TRANSFER_SIZE (32 * 1024) - -#define MANUFACTURER_ID_AR6003_BASE 0x300 -#define MANUFACTURER_ID_AR6004_BASE 0x400 - /* SDIO manufacturer ID and Codes */ -#define MANUFACTURER_ID_ATH6KL_BASE_MASK 0xFF00 -#define MANUFACTURER_CODE 0x271 /* Atheros */ - -/* Mailbox address in SDIO address space */ -#define HIF_MBOX_BASE_ADDR 0x800 -#define HIF_MBOX_WIDTH 0x800 - -#define HIF_MBOX_END_ADDR (HTC_MAILBOX_NUM_MAX * HIF_MBOX_WIDTH - 1) - -/* version 1 of the chip has only a 12K extended mbox range */ -#define HIF_MBOX0_EXT_BASE_ADDR 0x4000 -#define HIF_MBOX0_EXT_WIDTH (12*1024) - -/* GMBOX addresses */ -#define HIF_GMBOX_BASE_ADDR 0x7000 -#define HIF_GMBOX_WIDTH 0x4000 - -/* interrupt mode register */ -#define CCCR_SDIO_IRQ_MODE_REG 0xF0 - -/* mode to enable special 4-bit interrupt assertion without clock */ -#define SDIO_IRQ_MODE_ASYNC_4BIT_IRQ (1 << 0) - -/* HTC runs over mailbox 0 */ -#define HTC_MAILBOX 0 - -#define ATH6KL_TARGET_DEBUG_INTR_MASK 0x01 - -/* FIXME: are these duplicates with MAX_SCATTER_ values in hif.h? */ -#define ATH6KL_SCATTER_ENTRIES_PER_REQ 16 -#define ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER (16 * 1024) -#define ATH6KL_SCATTER_REQS 4 - -#define ATH6KL_HIF_COMMUNICATION_TIMEOUT 1000 - -struct bus_request { - struct list_head list; - - /* request data */ - u32 address; - - u8 *buffer; - u32 length; - u32 request; - struct htc_packet *packet; - int status; - - /* this is a scatter request */ - struct hif_scatter_req *scat_req; -}; - -/* direction of transfer (read/write) */ -#define HIF_READ 0x00000001 -#define HIF_WRITE 0x00000002 -#define HIF_DIR_MASK (HIF_READ | HIF_WRITE) - -/* - * emode - This indicates the whether the command is to be executed in a - * blocking or non-blocking fashion (HIF_SYNCHRONOUS/ - * HIF_ASYNCHRONOUS). The read/write data paths in HTC have been - * implemented using the asynchronous mode allowing the the bus - * driver to indicate the completion of operation through the - * registered callback routine. The requirement primarily comes - * from the contexts these operations get called from (a driver's - * transmit context or the ISR context in case of receive). - * Support for both of these modes is essential. - */ -#define HIF_SYNCHRONOUS 0x00000010 -#define HIF_ASYNCHRONOUS 0x00000020 -#define HIF_EMODE_MASK (HIF_SYNCHRONOUS | HIF_ASYNCHRONOUS) - -/* - * dmode - An interface may support different kinds of commands based on - * the tradeoff between the amount of data it can carry and the - * setup time. Byte and Block modes are supported (HIF_BYTE_BASIS/ - * HIF_BLOCK_BASIS). In case of latter, the data is rounded off - * to the nearest block size by padding. The size of the block is - * configurable at compile time using the HIF_BLOCK_SIZE and is - * negotiated with the target during initialization after the - * ATH6KL interrupts are enabled. - */ -#define HIF_BYTE_BASIS 0x00000040 -#define HIF_BLOCK_BASIS 0x00000080 -#define HIF_DMODE_MASK (HIF_BYTE_BASIS | HIF_BLOCK_BASIS) - -/* - * amode - This indicates if the address has to be incremented on ATH6KL - * after every read/write operation (HIF?FIXED_ADDRESS/ - * HIF_INCREMENTAL_ADDRESS). - */ -#define HIF_FIXED_ADDRESS 0x00000100 -#define HIF_INCREMENTAL_ADDRESS 0x00000200 -#define HIF_AMODE_MASK (HIF_FIXED_ADDRESS | HIF_INCREMENTAL_ADDRESS) - -#define HIF_WR_ASYNC_BYTE_INC \ - (HIF_WRITE | HIF_ASYNCHRONOUS | \ - HIF_BYTE_BASIS | HIF_INCREMENTAL_ADDRESS) - -#define HIF_WR_ASYNC_BLOCK_INC \ - (HIF_WRITE | HIF_ASYNCHRONOUS | \ - HIF_BLOCK_BASIS | HIF_INCREMENTAL_ADDRESS) - -#define HIF_WR_SYNC_BYTE_FIX \ - (HIF_WRITE | HIF_SYNCHRONOUS | \ - HIF_BYTE_BASIS | HIF_FIXED_ADDRESS) - -#define HIF_WR_SYNC_BYTE_INC \ - (HIF_WRITE | HIF_SYNCHRONOUS | \ - HIF_BYTE_BASIS | HIF_INCREMENTAL_ADDRESS) - -#define HIF_WR_SYNC_BLOCK_INC \ - (HIF_WRITE | HIF_SYNCHRONOUS | \ - HIF_BLOCK_BASIS | HIF_INCREMENTAL_ADDRESS) - -#define HIF_RD_SYNC_BYTE_INC \ - (HIF_READ | HIF_SYNCHRONOUS | \ - HIF_BYTE_BASIS | HIF_INCREMENTAL_ADDRESS) - -#define HIF_RD_SYNC_BYTE_FIX \ - (HIF_READ | HIF_SYNCHRONOUS | \ - HIF_BYTE_BASIS | HIF_FIXED_ADDRESS) - -#define HIF_RD_ASYNC_BLOCK_FIX \ - (HIF_READ | HIF_ASYNCHRONOUS | \ - HIF_BLOCK_BASIS | HIF_FIXED_ADDRESS) - -#define HIF_RD_SYNC_BLOCK_FIX \ - (HIF_READ | HIF_SYNCHRONOUS | \ - HIF_BLOCK_BASIS | HIF_FIXED_ADDRESS) - -struct hif_scatter_item { - u8 *buf; - int len; - struct htc_packet *packet; -}; - -struct hif_scatter_req { - struct list_head list; - /* address for the read/write operation */ - u32 addr; - - /* request flags */ - u32 req; - - /* total length of entire transfer */ - u32 len; - - bool virt_scat; - - void (*complete) (struct htc_target *, struct hif_scatter_req *); - int status; - int scat_entries; - - struct bus_request *busrequest; - struct scatterlist *sgentries; - - /* bounce buffer for upper layers to copy to/from */ - u8 *virt_dma_buf; - - struct hif_scatter_item scat_list[1]; - - u32 scat_q_depth; -}; - -struct ath6kl_irq_proc_registers { - u8 host_int_status; - u8 cpu_int_status; - u8 error_int_status; - u8 counter_int_status; - u8 mbox_frame; - u8 rx_lkahd_valid; - u8 host_int_status2; - u8 gmbox_rx_avail; - __le32 rx_lkahd[2]; - __le32 rx_gmbox_lkahd_alias[2]; -} __packed; - -struct ath6kl_irq_enable_reg { - u8 int_status_en; - u8 cpu_int_status_en; - u8 err_int_status_en; - u8 cntr_int_status_en; -} __packed; - -struct ath6kl_device { - /* protects irq_proc_reg and irq_en_reg below */ - spinlock_t lock; - struct ath6kl_irq_proc_registers irq_proc_reg; - struct ath6kl_irq_enable_reg irq_en_reg; - struct htc_target *htc_cnxt; - struct ath6kl *ar; -}; - -struct ath6kl_hif_ops { - int (*read_write_sync)(struct ath6kl *ar, u32 addr, u8 *buf, - u32 len, u32 request); - int (*write_async)(struct ath6kl *ar, u32 address, u8 *buffer, - u32 length, u32 request, struct htc_packet *packet); - - void (*irq_enable)(struct ath6kl *ar); - void (*irq_disable)(struct ath6kl *ar); - - struct hif_scatter_req *(*scatter_req_get)(struct ath6kl *ar); - void (*scatter_req_add)(struct ath6kl *ar, - struct hif_scatter_req *s_req); - int (*enable_scatter)(struct ath6kl *ar); - int (*scat_req_rw) (struct ath6kl *ar, - struct hif_scatter_req *scat_req); - void (*cleanup_scatter)(struct ath6kl *ar); - int (*suspend)(struct ath6kl *ar, struct cfg80211_wowlan *wow); - int (*resume)(struct ath6kl *ar); - int (*diag_read32)(struct ath6kl *ar, u32 address, u32 *value); - int (*diag_write32)(struct ath6kl *ar, u32 address, __le32 value); - int (*bmi_read)(struct ath6kl *ar, u8 *buf, u32 len); - int (*bmi_write)(struct ath6kl *ar, u8 *buf, u32 len); - int (*power_on)(struct ath6kl *ar); - int (*power_off)(struct ath6kl *ar); - void (*stop)(struct ath6kl *ar); - int (*pipe_send)(struct ath6kl *ar, u8 pipe, struct sk_buff *hdr_buf, - struct sk_buff *buf); - void (*pipe_get_default)(struct ath6kl *ar, u8 *pipe_ul, u8 *pipe_dl); - int (*pipe_map_service)(struct ath6kl *ar, u16 service_id, u8 *pipe_ul, - u8 *pipe_dl); - u16 (*pipe_get_free_queue_number)(struct ath6kl *ar, u8 pipe); -}; - -int ath6kl_hif_setup(struct ath6kl_device *dev); -int ath6kl_hif_unmask_intrs(struct ath6kl_device *dev); -int ath6kl_hif_mask_intrs(struct ath6kl_device *dev); -int ath6kl_hif_poll_mboxmsg_rx(struct ath6kl_device *dev, - u32 *lk_ahd, int timeout); -int ath6kl_hif_rx_control(struct ath6kl_device *dev, bool enable_rx); -int ath6kl_hif_disable_intrs(struct ath6kl_device *dev); - -int ath6kl_hif_rw_comp_handler(void *context, int status); -int ath6kl_hif_intr_bh_handler(struct ath6kl *ar); - -/* Scatter Function and Definitions */ -int ath6kl_hif_submit_scat_req(struct ath6kl_device *dev, - struct hif_scatter_req *scat_req, bool read); - -#endif diff --git a/drivers/net/wireless/ath/ath6kl/htc-ops.h b/drivers/net/wireless/ath/ath6kl/htc-ops.h deleted file mode 100644 index 2d4eed55cfd1..000000000000 --- a/drivers/net/wireless/ath/ath6kl/htc-ops.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2004-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef HTC_OPS_H -#define HTC_OPS_H - -#include "htc.h" -#include "debug.h" - -static inline void *ath6kl_htc_create(struct ath6kl *ar) -{ - return ar->htc_ops->create(ar); -} - -static inline int ath6kl_htc_wait_target(struct htc_target *target) -{ - return target->dev->ar->htc_ops->wait_target(target); -} - -static inline int ath6kl_htc_start(struct htc_target *target) -{ - return target->dev->ar->htc_ops->start(target); -} - -static inline int ath6kl_htc_conn_service(struct htc_target *target, - struct htc_service_connect_req *req, - struct htc_service_connect_resp *resp) -{ - return target->dev->ar->htc_ops->conn_service(target, req, resp); -} - -static inline int ath6kl_htc_tx(struct htc_target *target, - struct htc_packet *packet) -{ - return target->dev->ar->htc_ops->tx(target, packet); -} - -static inline void ath6kl_htc_stop(struct htc_target *target) -{ - return target->dev->ar->htc_ops->stop(target); -} - -static inline void ath6kl_htc_cleanup(struct htc_target *target) -{ - return target->dev->ar->htc_ops->cleanup(target); -} - -static inline void ath6kl_htc_flush_txep(struct htc_target *target, - enum htc_endpoint_id endpoint, - u16 tag) -{ - return target->dev->ar->htc_ops->flush_txep(target, endpoint, tag); -} - -static inline void ath6kl_htc_flush_rx_buf(struct htc_target *target) -{ - return target->dev->ar->htc_ops->flush_rx_buf(target); -} - -static inline void ath6kl_htc_activity_changed(struct htc_target *target, - enum htc_endpoint_id endpoint, - bool active) -{ - return target->dev->ar->htc_ops->activity_changed(target, endpoint, - active); -} - -static inline int ath6kl_htc_get_rxbuf_num(struct htc_target *target, - enum htc_endpoint_id endpoint) -{ - return target->dev->ar->htc_ops->get_rxbuf_num(target, endpoint); -} - -static inline int ath6kl_htc_add_rxbuf_multiple(struct htc_target *target, - struct list_head *pktq) -{ - return target->dev->ar->htc_ops->add_rxbuf_multiple(target, pktq); -} - -static inline int ath6kl_htc_credit_setup(struct htc_target *target, - struct ath6kl_htc_credit_info *info) -{ - return target->dev->ar->htc_ops->credit_setup(target, info); -} - -static inline void ath6kl_htc_tx_complete(struct ath6kl *ar, - struct sk_buff *skb) -{ - ar->htc_ops->tx_complete(ar, skb); -} - - -static inline void ath6kl_htc_rx_complete(struct ath6kl *ar, - struct sk_buff *skb, u8 pipe) -{ - ar->htc_ops->rx_complete(ar, skb, pipe); -} - - -#endif diff --git a/drivers/net/wireless/ath/ath6kl/htc.h b/drivers/net/wireless/ath/ath6kl/htc.h deleted file mode 100644 index a2c8ff809793..000000000000 --- a/drivers/net/wireless/ath/ath6kl/htc.h +++ /dev/null @@ -1,677 +0,0 @@ -/* - * Copyright (c) 2004-2011 Atheros Communications Inc. - * Copyright (c) 2011 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef HTC_H -#define HTC_H - -#include "common.h" - -/* frame header flags */ - -/* send direction */ -#define HTC_FLAGS_NEED_CREDIT_UPDATE (1 << 0) -#define HTC_FLAGS_SEND_BUNDLE (1 << 1) -#define HTC_FLAGS_TX_FIXUP_NETBUF (1 << 2) - -/* receive direction */ -#define HTC_FLG_RX_UNUSED (1 << 0) -#define HTC_FLG_RX_TRAILER (1 << 1) -/* Bundle count maske and shift */ -#define HTC_FLG_RX_BNDL_CNT (0xF0) -#define HTC_FLG_RX_BNDL_CNT_S 4 - -#define HTC_HDR_LENGTH (sizeof(struct htc_frame_hdr)) -#define HTC_MAX_PAYLOAD_LENGTH (4096 - sizeof(struct htc_frame_hdr)) - -/* HTC control message IDs */ - -#define HTC_MSG_READY_ID 1 -#define HTC_MSG_CONN_SVC_ID 2 -#define HTC_MSG_CONN_SVC_RESP_ID 3 -#define HTC_MSG_SETUP_COMPLETE_ID 4 -#define HTC_MSG_SETUP_COMPLETE_EX_ID 5 - -#define HTC_MAX_CTRL_MSG_LEN 256 - -#define HTC_VERSION_2P0 0x00 -#define HTC_VERSION_2P1 0x01 - -#define HTC_SERVICE_META_DATA_MAX_LENGTH 128 - -#define HTC_CONN_FLGS_THRESH_LVL_QUAT 0x0 -#define HTC_CONN_FLGS_THRESH_LVL_HALF 0x1 -#define HTC_CONN_FLGS_THRESH_LVL_THREE_QUAT 0x2 -#define HTC_CONN_FLGS_REDUCE_CRED_DRIB 0x4 -#define HTC_CONN_FLGS_THRESH_MASK 0x3 -/* disable credit flow control on a specific service */ -#define HTC_CONN_FLGS_DISABLE_CRED_FLOW_CTRL (1 << 3) -#define HTC_CONN_FLGS_SET_RECV_ALLOC_SHIFT 8 -#define HTC_CONN_FLGS_SET_RECV_ALLOC_MASK 0xFF00 - -/* connect response status codes */ -#define HTC_SERVICE_SUCCESS 0 -#define HTC_SERVICE_NOT_FOUND 1 -#define HTC_SERVICE_FAILED 2 - -/* no resources (i.e. no more endpoints) */ -#define HTC_SERVICE_NO_RESOURCES 3 - -/* specific service is not allowing any more endpoints */ -#define HTC_SERVICE_NO_MORE_EP 4 - -/* report record IDs */ -#define HTC_RECORD_NULL 0 -#define HTC_RECORD_CREDITS 1 -#define HTC_RECORD_LOOKAHEAD 2 -#define HTC_RECORD_LOOKAHEAD_BUNDLE 3 - -#define HTC_SETUP_COMP_FLG_RX_BNDL_EN (1 << 0) -#define HTC_SETUP_COMP_FLG_DISABLE_TX_CREDIT_FLOW (1 << 1) - -#define MAKE_SERVICE_ID(group, index) \ - (int)(((int)group << 8) | (int)(index)) - -/* NOTE: service ID of 0x0000 is reserved and should never be used */ -#define HTC_CTRL_RSVD_SVC MAKE_SERVICE_ID(RSVD_SERVICE_GROUP, 1) -#define WMI_CONTROL_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 0) -#define WMI_DATA_BE_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 1) -#define WMI_DATA_BK_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 2) -#define WMI_DATA_VI_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 3) -#define WMI_DATA_VO_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 4) -#define WMI_MAX_SERVICES 5 - -#define WMM_NUM_AC 4 - -/* reserved and used to flush ALL packets */ -#define HTC_TX_PACKET_TAG_ALL 0 -#define HTC_SERVICE_TX_PACKET_TAG 1 -#define HTC_TX_PACKET_TAG_USER_DEFINED (HTC_SERVICE_TX_PACKET_TAG + 9) - -/* more packets on this endpoint are being fetched */ -#define HTC_RX_FLAGS_INDICATE_MORE_PKTS (1 << 0) - -/* TODO.. for BMI */ -#define ENDPOINT1 0 -/* TODO -remove me, but we have to fix BMI first */ -#define HTC_MAILBOX_NUM_MAX 4 - -/* enable send bundle padding for this endpoint */ -#define HTC_FLGS_TX_BNDL_PAD_EN (1 << 0) -#define HTC_EP_ACTIVE ((u32) (1u << 31)) - -/* HTC operational parameters */ -#define HTC_TARGET_RESPONSE_TIMEOUT 2000 /* in ms */ -#define HTC_TARGET_RESPONSE_POLL_WAIT 10 -#define HTC_TARGET_RESPONSE_POLL_COUNT 200 -#define HTC_TARGET_DEBUG_INTR_MASK 0x01 -#define HTC_TARGET_CREDIT_INTR_MASK 0xF0 - -#define HTC_HOST_MAX_MSG_PER_BUNDLE 8 -#define HTC_MIN_HTC_MSGS_TO_BUNDLE 2 - -/* packet flags */ - -#define HTC_RX_PKT_IGNORE_LOOKAHEAD (1 << 0) -#define HTC_RX_PKT_REFRESH_HDR (1 << 1) -#define HTC_RX_PKT_PART_OF_BUNDLE (1 << 2) -#define HTC_RX_PKT_NO_RECYCLE (1 << 3) - -#define NUM_CONTROL_BUFFERS 8 -#define NUM_CONTROL_TX_BUFFERS 2 -#define NUM_CONTROL_RX_BUFFERS (NUM_CONTROL_BUFFERS - NUM_CONTROL_TX_BUFFERS) - -#define HTC_RECV_WAIT_BUFFERS (1 << 0) -#define HTC_OP_STATE_STOPPING (1 << 0) -#define HTC_OP_STATE_SETUP_COMPLETE (1 << 1) - -/* - * The frame header length and message formats defined herein were selected - * to accommodate optimal alignment for target processing. This reduces - * code size and improves performance. Any changes to the header length may - * alter the alignment and cause exceptions on the target. When adding to - * the messagestructures insure that fields are properly aligned. - */ - -/* HTC frame header - * - * NOTE: do not remove or re-arrange the fields, these are minimally - * required to take advantage of 4-byte lookaheads in some hardware - * implementations. - */ -struct htc_frame_hdr { - u8 eid; - u8 flags; - - /* length of data (including trailer) that follows the header */ - __le16 payld_len; - - /* end of 4-byte lookahead */ - - u8 ctrl[2]; -} __packed; - -/* HTC ready message */ -struct htc_ready_msg { - __le16 msg_id; - __le16 cred_cnt; - __le16 cred_sz; - u8 max_ep; - u8 pad; -} __packed; - -/* extended HTC ready message */ -struct htc_ready_ext_msg { - struct htc_ready_msg ver2_0_info; - u8 htc_ver; - u8 msg_per_htc_bndl; -} __packed; - -/* connect service */ -struct htc_conn_service_msg { - __le16 msg_id; - __le16 svc_id; - __le16 conn_flags; - u8 svc_meta_len; - u8 pad; -} __packed; - -/* connect response */ -struct htc_conn_service_resp { - __le16 msg_id; - __le16 svc_id; - u8 status; - u8 eid; - __le16 max_msg_sz; - u8 svc_meta_len; - u8 pad; -} __packed; - -struct htc_setup_comp_msg { - __le16 msg_id; -} __packed; - -/* extended setup completion message */ -struct htc_setup_comp_ext_msg { - __le16 msg_id; - __le32 flags; - u8 msg_per_rxbndl; - u8 Rsvd[3]; -} __packed; - -struct htc_record_hdr { - u8 rec_id; - u8 len; -} __packed; - -struct htc_credit_report { - u8 eid; - u8 credits; -} __packed; - -/* - * NOTE: The lk_ahd array is guarded by a pre_valid - * and Post Valid guard bytes. The pre_valid bytes must - * equal the inverse of the post_valid byte. - */ -struct htc_lookahead_report { - u8 pre_valid; - u8 lk_ahd[4]; - u8 post_valid; -} __packed; - -struct htc_bundle_lkahd_rpt { - u8 lk_ahd[4]; -} __packed; - -/* Current service IDs */ - -enum htc_service_grp_ids { - RSVD_SERVICE_GROUP = 0, - WMI_SERVICE_GROUP = 1, - - HTC_TEST_GROUP = 254, - HTC_SERVICE_GROUP_LAST = 255 -}; - -/* ------ endpoint IDS ------ */ - -enum htc_endpoint_id { - ENDPOINT_UNUSED = -1, - ENDPOINT_0 = 0, - ENDPOINT_1 = 1, - ENDPOINT_2 = 2, - ENDPOINT_3, - ENDPOINT_4, - ENDPOINT_5, - ENDPOINT_6, - ENDPOINT_7, - ENDPOINT_8, - ENDPOINT_MAX, -}; - -struct htc_tx_packet_info { - u16 tag; - int cred_used; - u8 flags; - int seqno; -}; - -struct htc_rx_packet_info { - u32 exp_hdr; - u32 rx_flags; - u32 indicat_flags; -}; - -struct htc_target; - -/* wrapper around endpoint-specific packets */ -struct htc_packet { - struct list_head list; - - /* caller's per packet specific context */ - void *pkt_cntxt; - - /* - * the true buffer start , the caller can store the real - * buffer start here. In receive callbacks, the HTC layer - * sets buf to the start of the payload past the header. - * This field allows the caller to reset buf when it recycles - * receive packets back to HTC. - */ - u8 *buf_start; - - /* - * Pointer to the start of the buffer. In the transmit - * direction this points to the start of the payload. In the - * receive direction, however, the buffer when queued up - * points to the start of the HTC header but when returned - * to the caller points to the start of the payload - */ - u8 *buf; - u32 buf_len; - - /* actual length of payload */ - u32 act_len; - - /* endpoint that this packet was sent/recv'd from */ - enum htc_endpoint_id endpoint; - - /* completion status */ - - int status; - union { - struct htc_tx_packet_info tx; - struct htc_rx_packet_info rx; - } info; - - void (*completion) (struct htc_target *, struct htc_packet *); - struct htc_target *context; - - /* - * optimization for network-oriented data, the HTC packet - * can pass the network buffer corresponding to the HTC packet - * lower layers may optimized the transfer knowing this is - * a network buffer - */ - struct sk_buff *skb; -}; - -enum htc_send_full_action { - HTC_SEND_FULL_KEEP = 0, - HTC_SEND_FULL_DROP = 1, -}; - -struct htc_ep_callbacks { - void (*tx_complete) (struct htc_target *, struct htc_packet *); - void (*rx) (struct htc_target *, struct htc_packet *); - void (*rx_refill) (struct htc_target *, enum htc_endpoint_id endpoint); - enum htc_send_full_action (*tx_full) (struct htc_target *, - struct htc_packet *); - struct htc_packet *(*rx_allocthresh) (struct htc_target *, - enum htc_endpoint_id, int); - void (*tx_comp_multi) (struct htc_target *, struct list_head *); - int rx_alloc_thresh; - int rx_refill_thresh; -}; - -/* service connection information */ -struct htc_service_connect_req { - u16 svc_id; - u16 conn_flags; - struct htc_ep_callbacks ep_cb; - int max_txq_depth; - u32 flags; - unsigned int max_rxmsg_sz; -}; - -/* service connection response information */ -struct htc_service_connect_resp { - u8 buf_len; - u8 act_len; - enum htc_endpoint_id endpoint; - unsigned int len_max; - u8 resp_code; -}; - -/* endpoint distributionstructure */ -struct htc_endpoint_credit_dist { - struct list_head list; - - /* Service ID (set by HTC) */ - u16 svc_id; - - /* endpoint for this distributionstruct (set by HTC) */ - enum htc_endpoint_id endpoint; - - u32 dist_flags; - - /* - * credits for normal operation, anything above this - * indicates the endpoint is over-subscribed. - */ - int cred_norm; - - /* floor for credit distribution */ - int cred_min; - - int cred_assngd; - - /* current credits available */ - int credits; - - /* - * pending credits to distribute on this endpoint, this - * is set by HTC when credit reports arrive. The credit - * distribution functions sets this to zero when it distributes - * the credits. - */ - int cred_to_dist; - - /* - * the number of credits that the current pending TX packet needs - * to transmit. This is set by HTC when endpoint needs credits in - * order to transmit. - */ - int seek_cred; - - /* size in bytes of each credit */ - int cred_sz; - - /* credits required for a maximum sized messages */ - int cred_per_msg; - - /* reserved for HTC use */ - struct htc_endpoint *htc_ep; - - /* - * current depth of TX queue , i.e. messages waiting for credits - * This field is valid only when HTC_CREDIT_DIST_ACTIVITY_CHANGE - * or HTC_CREDIT_DIST_SEND_COMPLETE is indicated on an endpoint - * that has non-zero credits to recover. - */ - int txq_depth; -}; - -/* - * credit distibution code that is passed into the distrbution function, - * there are mandatory and optional codes that must be handled - */ -enum htc_credit_dist_reason { - HTC_CREDIT_DIST_SEND_COMPLETE = 0, - HTC_CREDIT_DIST_ACTIVITY_CHANGE = 1, - HTC_CREDIT_DIST_SEEK_CREDITS, -}; - -struct ath6kl_htc_credit_info { - int total_avail_credits; - int cur_free_credits; - - /* list of lowest priority endpoints */ - struct list_head lowestpri_ep_dist; -}; - -/* endpoint statistics */ -struct htc_endpoint_stats { - /* - * number of times the host set the credit-low flag in a send - * message on this endpoint - */ - u32 cred_low_indicate; - - u32 tx_issued; - u32 tx_pkt_bundled; - u32 tx_bundles; - u32 tx_dropped; - - /* running count of total credit reports received for this endpoint */ - u32 tx_cred_rpt; - - /* credit reports received from this endpoint's RX packets */ - u32 cred_rpt_from_rx; - - /* credit reports received from RX packets of other endpoints */ - u32 cred_rpt_from_other; - - /* credit reports received from endpoint 0 RX packets */ - u32 cred_rpt_ep0; - - /* count of credits received via Rx packets on this endpoint */ - u32 cred_from_rx; - - /* count of credits received via another endpoint */ - u32 cred_from_other; - - /* count of credits received via another endpoint */ - u32 cred_from_ep0; - - /* count of consummed credits */ - u32 cred_cosumd; - - /* count of credits returned */ - u32 cred_retnd; - - u32 rx_pkts; - - /* count of lookahead records found in Rx msg */ - u32 rx_lkahds; - - /* count of recv packets received in a bundle */ - u32 rx_bundl; - - /* count of number of bundled lookaheads */ - u32 rx_bundle_lkahd; - - /* count of the number of bundle indications from the HTC header */ - u32 rx_bundle_from_hdr; - - /* the number of times the recv allocation threshold was hit */ - u32 rx_alloc_thresh_hit; - - /* total number of bytes */ - u32 rxalloc_thresh_byte; -}; - -struct htc_endpoint { - enum htc_endpoint_id eid; - u16 svc_id; - struct list_head txq; - struct list_head rx_bufq; - struct htc_endpoint_credit_dist cred_dist; - struct htc_ep_callbacks ep_cb; - int max_txq_depth; - int len_max; - int tx_proc_cnt; - int rx_proc_cnt; - struct htc_target *target; - u8 seqno; - u32 conn_flags; - struct htc_endpoint_stats ep_st; - u16 tx_drop_packet_threshold; - - struct { - u8 pipeid_ul; - u8 pipeid_dl; - struct list_head tx_lookup_queue; - bool tx_credit_flow_enabled; - } pipe; -}; - -struct htc_control_buffer { - struct htc_packet packet; - u8 *buf; -}; - -struct htc_pipe_txcredit_alloc { - u16 service_id; - u8 credit_alloc; -}; - -enum htc_send_queue_result { - HTC_SEND_QUEUE_OK = 0, /* packet was queued */ - HTC_SEND_QUEUE_DROP = 1, /* this packet should be dropped */ -}; - -struct ath6kl_htc_ops { - void* (*create)(struct ath6kl *ar); - int (*wait_target)(struct htc_target *target); - int (*start)(struct htc_target *target); - int (*conn_service)(struct htc_target *target, - struct htc_service_connect_req *req, - struct htc_service_connect_resp *resp); - int (*tx)(struct htc_target *target, struct htc_packet *packet); - void (*stop)(struct htc_target *target); - void (*cleanup)(struct htc_target *target); - void (*flush_txep)(struct htc_target *target, - enum htc_endpoint_id endpoint, u16 tag); - void (*flush_rx_buf)(struct htc_target *target); - void (*activity_changed)(struct htc_target *target, - enum htc_endpoint_id endpoint, - bool active); - int (*get_rxbuf_num)(struct htc_target *target, - enum htc_endpoint_id endpoint); - int (*add_rxbuf_multiple)(struct htc_target *target, - struct list_head *pktq); - int (*credit_setup)(struct htc_target *target, - struct ath6kl_htc_credit_info *cred_info); - int (*tx_complete)(struct ath6kl *ar, struct sk_buff *skb); - int (*rx_complete)(struct ath6kl *ar, struct sk_buff *skb, u8 pipe); -}; - -struct ath6kl_device; - -/* our HTC target state */ -struct htc_target { - struct htc_endpoint endpoint[ENDPOINT_MAX]; - - /* contains struct htc_endpoint_credit_dist */ - struct list_head cred_dist_list; - - struct list_head free_ctrl_txbuf; - struct list_head free_ctrl_rxbuf; - struct ath6kl_htc_credit_info *credit_info; - int tgt_creds; - unsigned int tgt_cred_sz; - - /* protects free_ctrl_txbuf and free_ctrl_rxbuf */ - spinlock_t htc_lock; - - /* FIXME: does this protext rx_bufq and endpoint structures or what? */ - spinlock_t rx_lock; - - /* protects endpoint->txq */ - spinlock_t tx_lock; - - struct ath6kl_device *dev; - u32 htc_flags; - u32 rx_st_flags; - enum htc_endpoint_id ep_waiting; - u8 htc_tgt_ver; - - /* max messages per bundle for HTC */ - int msg_per_bndl_max; - - u32 tx_bndl_mask; - int rx_bndl_enable; - int max_rx_bndl_sz; - int max_tx_bndl_sz; - - u32 block_sz; - u32 block_mask; - - int max_scat_entries; - int max_xfer_szper_scatreq; - - int chk_irq_status_cnt; - - /* counts the number of Tx without bundling continously per AC */ - u32 ac_tx_count[WMM_NUM_AC]; - - struct { - struct htc_packet *htc_packet_pool; - u8 ctrl_response_buf[HTC_MAX_CTRL_MSG_LEN]; - int ctrl_response_len; - bool ctrl_response_valid; - struct htc_pipe_txcredit_alloc txcredit_alloc[ENDPOINT_MAX]; - } pipe; -}; - -int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target, - u32 msg_look_ahead, int *n_pkts); - -static inline void set_htc_pkt_info(struct htc_packet *packet, void *context, - u8 *buf, unsigned int len, - enum htc_endpoint_id eid, u16 tag) -{ - packet->pkt_cntxt = context; - packet->buf = buf; - packet->act_len = len; - packet->endpoint = eid; - packet->info.tx.tag = tag; -} - -static inline void htc_rxpkt_reset(struct htc_packet *packet) -{ - packet->buf = packet->buf_start; - packet->act_len = 0; -} - -static inline void set_htc_rxpkt_info(struct htc_packet *packet, void *context, - u8 *buf, unsigned long len, - enum htc_endpoint_id eid) -{ - packet->pkt_cntxt = context; - packet->buf = buf; - packet->buf_start = buf; - packet->buf_len = len; - packet->endpoint = eid; -} - -static inline int get_queue_depth(struct list_head *queue) -{ - struct list_head *tmp_list; - int depth = 0; - - list_for_each(tmp_list, queue) - depth++; - - return depth; -} - -void ath6kl_htc_pipe_attach(struct ath6kl *ar); -void ath6kl_htc_mbox_attach(struct ath6kl *ar); - -#endif diff --git a/drivers/net/wireless/ath/ath6kl/htc_mbox.c b/drivers/net/wireless/ath/ath6kl/htc_mbox.c deleted file mode 100644 index 65e5b719093d..000000000000 --- a/drivers/net/wireless/ath/ath6kl/htc_mbox.c +++ /dev/null @@ -1,2946 +0,0 @@ -/* - * Copyright (c) 2007-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "core.h" -#include "hif.h" -#include "debug.h" -#include "hif-ops.h" -#include "trace.h" - -#include - -#define CALC_TXRX_PADDED_LEN(dev, len) (__ALIGN_MASK((len), (dev)->block_mask)) - -static void ath6kl_htc_mbox_cleanup(struct htc_target *target); -static void ath6kl_htc_mbox_stop(struct htc_target *target); -static int ath6kl_htc_mbox_add_rxbuf_multiple(struct htc_target *target, - struct list_head *pkt_queue); -static void ath6kl_htc_set_credit_dist(struct htc_target *target, - struct ath6kl_htc_credit_info *cred_info, - u16 svc_pri_order[], int len); - -/* threshold to re-enable Tx bundling for an AC*/ -#define TX_RESUME_BUNDLE_THRESHOLD 1500 - -/* Functions for Tx credit handling */ -static void ath6kl_credit_deposit(struct ath6kl_htc_credit_info *cred_info, - struct htc_endpoint_credit_dist *ep_dist, - int credits) -{ - ath6kl_dbg(ATH6KL_DBG_CREDIT, "credit deposit ep %d credits %d\n", - ep_dist->endpoint, credits); - - ep_dist->credits += credits; - ep_dist->cred_assngd += credits; - cred_info->cur_free_credits -= credits; -} - -static void ath6kl_credit_init(struct ath6kl_htc_credit_info *cred_info, - struct list_head *ep_list, - int tot_credits) -{ - struct htc_endpoint_credit_dist *cur_ep_dist; - int count; - - ath6kl_dbg(ATH6KL_DBG_CREDIT, "credit init total %d\n", tot_credits); - - cred_info->cur_free_credits = tot_credits; - cred_info->total_avail_credits = tot_credits; - - list_for_each_entry(cur_ep_dist, ep_list, list) { - if (cur_ep_dist->endpoint == ENDPOINT_0) - continue; - - cur_ep_dist->cred_min = cur_ep_dist->cred_per_msg; - - if (tot_credits > 4) { - if ((cur_ep_dist->svc_id == WMI_DATA_BK_SVC) || - (cur_ep_dist->svc_id == WMI_DATA_BE_SVC)) { - ath6kl_credit_deposit(cred_info, - cur_ep_dist, - cur_ep_dist->cred_min); - cur_ep_dist->dist_flags |= HTC_EP_ACTIVE; - } - } - - if (cur_ep_dist->svc_id == WMI_CONTROL_SVC) { - ath6kl_credit_deposit(cred_info, cur_ep_dist, - cur_ep_dist->cred_min); - /* - * Control service is always marked active, it - * never goes inactive EVER. - */ - cur_ep_dist->dist_flags |= HTC_EP_ACTIVE; - } - - /* - * Streams have to be created (explicit | implicit) for all - * kinds of traffic. BE endpoints are also inactive in the - * beginning. When BE traffic starts it creates implicit - * streams that redistributes credits. - * - * Note: all other endpoints have minimums set but are - * initially given NO credits. credits will be distributed - * as traffic activity demands - */ - } - - /* - * For ath6kl_credit_seek function, - * it use list_for_each_entry_reverse to walk around the whole ep list. - * Therefore assign this lowestpri_ep_dist after walk around the ep_list - */ - cred_info->lowestpri_ep_dist = cur_ep_dist->list; - - WARN_ON(cred_info->cur_free_credits <= 0); - - list_for_each_entry(cur_ep_dist, ep_list, list) { - if (cur_ep_dist->endpoint == ENDPOINT_0) - continue; - - if (cur_ep_dist->svc_id == WMI_CONTROL_SVC) - cur_ep_dist->cred_norm = cur_ep_dist->cred_per_msg; - else { - /* - * For the remaining data endpoints, we assume that - * each cred_per_msg are the same. We use a simple - * calculation here, we take the remaining credits - * and determine how many max messages this can - * cover and then set each endpoint's normal value - * equal to 3/4 this amount. - */ - count = (cred_info->cur_free_credits / - cur_ep_dist->cred_per_msg) - * cur_ep_dist->cred_per_msg; - count = (count * 3) >> 2; - count = max(count, cur_ep_dist->cred_per_msg); - cur_ep_dist->cred_norm = count; - - } - - ath6kl_dbg(ATH6KL_DBG_CREDIT, - "credit ep %d svc_id %d credits %d per_msg %d norm %d min %d\n", - cur_ep_dist->endpoint, - cur_ep_dist->svc_id, - cur_ep_dist->credits, - cur_ep_dist->cred_per_msg, - cur_ep_dist->cred_norm, - cur_ep_dist->cred_min); - } -} - -/* initialize and setup credit distribution */ -static int ath6kl_htc_mbox_credit_setup(struct htc_target *htc_target, - struct ath6kl_htc_credit_info *cred_info) -{ - u16 servicepriority[5]; - - memset(cred_info, 0, sizeof(struct ath6kl_htc_credit_info)); - - servicepriority[0] = WMI_CONTROL_SVC; /* highest */ - servicepriority[1] = WMI_DATA_VO_SVC; - servicepriority[2] = WMI_DATA_VI_SVC; - servicepriority[3] = WMI_DATA_BE_SVC; - servicepriority[4] = WMI_DATA_BK_SVC; /* lowest */ - - /* set priority list */ - ath6kl_htc_set_credit_dist(htc_target, cred_info, servicepriority, 5); - - return 0; -} - -/* reduce an ep's credits back to a set limit */ -static void ath6kl_credit_reduce(struct ath6kl_htc_credit_info *cred_info, - struct htc_endpoint_credit_dist *ep_dist, - int limit) -{ - int credits; - - ath6kl_dbg(ATH6KL_DBG_CREDIT, "credit reduce ep %d limit %d\n", - ep_dist->endpoint, limit); - - ep_dist->cred_assngd = limit; - - if (ep_dist->credits <= limit) - return; - - credits = ep_dist->credits - limit; - ep_dist->credits -= credits; - cred_info->cur_free_credits += credits; -} - -static void ath6kl_credit_update(struct ath6kl_htc_credit_info *cred_info, - struct list_head *epdist_list) -{ - struct htc_endpoint_credit_dist *cur_list; - - list_for_each_entry(cur_list, epdist_list, list) { - if (cur_list->endpoint == ENDPOINT_0) - continue; - - if (cur_list->cred_to_dist > 0) { - cur_list->credits += cur_list->cred_to_dist; - cur_list->cred_to_dist = 0; - - if (cur_list->credits > cur_list->cred_assngd) - ath6kl_credit_reduce(cred_info, - cur_list, - cur_list->cred_assngd); - - if (cur_list->credits > cur_list->cred_norm) - ath6kl_credit_reduce(cred_info, cur_list, - cur_list->cred_norm); - - if (!(cur_list->dist_flags & HTC_EP_ACTIVE)) { - if (cur_list->txq_depth == 0) - ath6kl_credit_reduce(cred_info, - cur_list, 0); - } - } - } -} - -/* - * HTC has an endpoint that needs credits, ep_dist is the endpoint in - * question. - */ -static void ath6kl_credit_seek(struct ath6kl_htc_credit_info *cred_info, - struct htc_endpoint_credit_dist *ep_dist) -{ - struct htc_endpoint_credit_dist *curdist_list; - int credits = 0; - int need; - - if (ep_dist->svc_id == WMI_CONTROL_SVC) - goto out; - - if ((ep_dist->svc_id == WMI_DATA_VI_SVC) || - (ep_dist->svc_id == WMI_DATA_VO_SVC)) - if ((ep_dist->cred_assngd >= ep_dist->cred_norm)) - goto out; - - /* - * For all other services, we follow a simple algorithm of: - * - * 1. checking the free pool for credits - * 2. checking lower priority endpoints for credits to take - */ - - credits = min(cred_info->cur_free_credits, ep_dist->seek_cred); - - if (credits >= ep_dist->seek_cred) - goto out; - - /* - * We don't have enough in the free pool, try taking away from - * lower priority services The rule for taking away credits: - * - * 1. Only take from lower priority endpoints - * 2. Only take what is allocated above the minimum (never - * starve an endpoint completely) - * 3. Only take what you need. - */ - - list_for_each_entry_reverse(curdist_list, - &cred_info->lowestpri_ep_dist, - list) { - if (curdist_list == ep_dist) - break; - - need = ep_dist->seek_cred - cred_info->cur_free_credits; - - if ((curdist_list->cred_assngd - need) >= - curdist_list->cred_min) { - /* - * The current one has been allocated more than - * it's minimum and it has enough credits assigned - * above it's minimum to fulfill our need try to - * take away just enough to fulfill our need. - */ - ath6kl_credit_reduce(cred_info, curdist_list, - curdist_list->cred_assngd - need); - - if (cred_info->cur_free_credits >= - ep_dist->seek_cred) - break; - } - - if (curdist_list->endpoint == ENDPOINT_0) - break; - } - - credits = min(cred_info->cur_free_credits, ep_dist->seek_cred); - -out: - /* did we find some credits? */ - if (credits) - ath6kl_credit_deposit(cred_info, ep_dist, credits); - - ep_dist->seek_cred = 0; -} - -/* redistribute credits based on activity change */ -static void ath6kl_credit_redistribute(struct ath6kl_htc_credit_info *info, - struct list_head *ep_dist_list) -{ - struct htc_endpoint_credit_dist *curdist_list; - - list_for_each_entry(curdist_list, ep_dist_list, list) { - if (curdist_list->endpoint == ENDPOINT_0) - continue; - - if ((curdist_list->svc_id == WMI_DATA_BK_SVC) || - (curdist_list->svc_id == WMI_DATA_BE_SVC)) - curdist_list->dist_flags |= HTC_EP_ACTIVE; - - if ((curdist_list->svc_id != WMI_CONTROL_SVC) && - !(curdist_list->dist_flags & HTC_EP_ACTIVE)) { - if (curdist_list->txq_depth == 0) - ath6kl_credit_reduce(info, curdist_list, 0); - else - ath6kl_credit_reduce(info, - curdist_list, - curdist_list->cred_min); - } - } -} - -/* - * - * This function is invoked whenever endpoints require credit - * distributions. A lock is held while this function is invoked, this - * function shall NOT block. The ep_dist_list is a list of distribution - * structures in prioritized order as defined by the call to the - * htc_set_credit_dist() api. - */ -static void ath6kl_credit_distribute(struct ath6kl_htc_credit_info *cred_info, - struct list_head *ep_dist_list, - enum htc_credit_dist_reason reason) -{ - switch (reason) { - case HTC_CREDIT_DIST_SEND_COMPLETE: - ath6kl_credit_update(cred_info, ep_dist_list); - break; - case HTC_CREDIT_DIST_ACTIVITY_CHANGE: - ath6kl_credit_redistribute(cred_info, ep_dist_list); - break; - default: - break; - } - - WARN_ON(cred_info->cur_free_credits > cred_info->total_avail_credits); - WARN_ON(cred_info->cur_free_credits < 0); -} - -static void ath6kl_htc_tx_buf_align(u8 **buf, unsigned long len) -{ - u8 *align_addr; - - if (!IS_ALIGNED((unsigned long) *buf, 4)) { - align_addr = PTR_ALIGN(*buf - 4, 4); - memmove(align_addr, *buf, len); - *buf = align_addr; - } -} - -static void ath6kl_htc_tx_prep_pkt(struct htc_packet *packet, u8 flags, - int ctrl0, int ctrl1) -{ - struct htc_frame_hdr *hdr; - - packet->buf -= HTC_HDR_LENGTH; - hdr = (struct htc_frame_hdr *)packet->buf; - - /* Endianess? */ - put_unaligned((u16)packet->act_len, &hdr->payld_len); - hdr->flags = flags; - hdr->eid = packet->endpoint; - hdr->ctrl[0] = ctrl0; - hdr->ctrl[1] = ctrl1; -} - -static void htc_reclaim_txctrl_buf(struct htc_target *target, - struct htc_packet *pkt) -{ - spin_lock_bh(&target->htc_lock); - list_add_tail(&pkt->list, &target->free_ctrl_txbuf); - spin_unlock_bh(&target->htc_lock); -} - -static struct htc_packet *htc_get_control_buf(struct htc_target *target, - bool tx) -{ - struct htc_packet *packet = NULL; - struct list_head *buf_list; - - buf_list = tx ? &target->free_ctrl_txbuf : &target->free_ctrl_rxbuf; - - spin_lock_bh(&target->htc_lock); - - if (list_empty(buf_list)) { - spin_unlock_bh(&target->htc_lock); - return NULL; - } - - packet = list_first_entry(buf_list, struct htc_packet, list); - list_del(&packet->list); - spin_unlock_bh(&target->htc_lock); - - if (tx) - packet->buf = packet->buf_start + HTC_HDR_LENGTH; - - return packet; -} - -static void htc_tx_comp_update(struct htc_target *target, - struct htc_endpoint *endpoint, - struct htc_packet *packet) -{ - packet->completion = NULL; - packet->buf += HTC_HDR_LENGTH; - - if (!packet->status) - return; - - ath6kl_err("req failed (status:%d, ep:%d, len:%d creds:%d)\n", - packet->status, packet->endpoint, packet->act_len, - packet->info.tx.cred_used); - - /* on failure to submit, reclaim credits for this packet */ - spin_lock_bh(&target->tx_lock); - endpoint->cred_dist.cred_to_dist += - packet->info.tx.cred_used; - endpoint->cred_dist.txq_depth = get_queue_depth(&endpoint->txq); - - ath6kl_dbg(ATH6KL_DBG_HTC, "htc tx ctxt 0x%p dist 0x%p\n", - target->credit_info, &target->cred_dist_list); - - ath6kl_credit_distribute(target->credit_info, - &target->cred_dist_list, - HTC_CREDIT_DIST_SEND_COMPLETE); - - spin_unlock_bh(&target->tx_lock); -} - -static void htc_tx_complete(struct htc_endpoint *endpoint, - struct list_head *txq) -{ - if (list_empty(txq)) - return; - - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc tx complete ep %d pkts %d\n", - endpoint->eid, get_queue_depth(txq)); - - ath6kl_tx_complete(endpoint->target, txq); -} - -static void htc_tx_comp_handler(struct htc_target *target, - struct htc_packet *packet) -{ - struct htc_endpoint *endpoint = &target->endpoint[packet->endpoint]; - struct list_head container; - - ath6kl_dbg(ATH6KL_DBG_HTC, "htc tx complete seqno %d\n", - packet->info.tx.seqno); - - htc_tx_comp_update(target, endpoint, packet); - INIT_LIST_HEAD(&container); - list_add_tail(&packet->list, &container); - /* do completion */ - htc_tx_complete(endpoint, &container); -} - -static void htc_async_tx_scat_complete(struct htc_target *target, - struct hif_scatter_req *scat_req) -{ - struct htc_endpoint *endpoint; - struct htc_packet *packet; - struct list_head tx_compq; - int i; - - INIT_LIST_HEAD(&tx_compq); - - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc tx scat complete len %d entries %d\n", - scat_req->len, scat_req->scat_entries); - - if (scat_req->status) - ath6kl_err("send scatter req failed: %d\n", scat_req->status); - - packet = scat_req->scat_list[0].packet; - endpoint = &target->endpoint[packet->endpoint]; - - /* walk through the scatter list and process */ - for (i = 0; i < scat_req->scat_entries; i++) { - packet = scat_req->scat_list[i].packet; - if (!packet) { - WARN_ON(1); - return; - } - - packet->status = scat_req->status; - htc_tx_comp_update(target, endpoint, packet); - list_add_tail(&packet->list, &tx_compq); - } - - /* free scatter request */ - hif_scatter_req_add(target->dev->ar, scat_req); - - /* complete all packets */ - htc_tx_complete(endpoint, &tx_compq); -} - -static int ath6kl_htc_tx_issue(struct htc_target *target, - struct htc_packet *packet) -{ - int status; - bool sync = false; - u32 padded_len, send_len; - - if (!packet->completion) - sync = true; - - send_len = packet->act_len + HTC_HDR_LENGTH; - - padded_len = CALC_TXRX_PADDED_LEN(target, send_len); - - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc tx issue len %d seqno %d padded_len %d mbox 0x%X %s\n", - send_len, packet->info.tx.seqno, padded_len, - target->dev->ar->mbox_info.htc_addr, - sync ? "sync" : "async"); - - if (sync) { - status = hif_read_write_sync(target->dev->ar, - target->dev->ar->mbox_info.htc_addr, - packet->buf, padded_len, - HIF_WR_SYNC_BLOCK_INC); - - packet->status = status; - packet->buf += HTC_HDR_LENGTH; - } else - status = hif_write_async(target->dev->ar, - target->dev->ar->mbox_info.htc_addr, - packet->buf, padded_len, - HIF_WR_ASYNC_BLOCK_INC, packet); - - trace_ath6kl_htc_tx(status, packet->endpoint, packet->buf, send_len); - - return status; -} - -static int htc_check_credits(struct htc_target *target, - struct htc_endpoint *ep, u8 *flags, - enum htc_endpoint_id eid, unsigned int len, - int *req_cred) -{ - - *req_cred = (len > target->tgt_cred_sz) ? - DIV_ROUND_UP(len, target->tgt_cred_sz) : 1; - - ath6kl_dbg(ATH6KL_DBG_CREDIT, "credit check need %d got %d\n", - *req_cred, ep->cred_dist.credits); - - if (ep->cred_dist.credits < *req_cred) { - if (eid == ENDPOINT_0) - return -EINVAL; - - /* Seek more credits */ - ep->cred_dist.seek_cred = *req_cred - ep->cred_dist.credits; - - ath6kl_credit_seek(target->credit_info, &ep->cred_dist); - - ep->cred_dist.seek_cred = 0; - - if (ep->cred_dist.credits < *req_cred) { - ath6kl_dbg(ATH6KL_DBG_CREDIT, - "credit not found for ep %d\n", - eid); - return -EINVAL; - } - } - - ep->cred_dist.credits -= *req_cred; - ep->ep_st.cred_cosumd += *req_cred; - - /* When we are getting low on credits, ask for more */ - if (ep->cred_dist.credits < ep->cred_dist.cred_per_msg) { - ep->cred_dist.seek_cred = - ep->cred_dist.cred_per_msg - ep->cred_dist.credits; - - ath6kl_credit_seek(target->credit_info, &ep->cred_dist); - - /* see if we were successful in getting more */ - if (ep->cred_dist.credits < ep->cred_dist.cred_per_msg) { - /* tell the target we need credits ASAP! */ - *flags |= HTC_FLAGS_NEED_CREDIT_UPDATE; - ep->ep_st.cred_low_indicate += 1; - ath6kl_dbg(ATH6KL_DBG_CREDIT, - "credit we need credits asap\n"); - } - } - - return 0; -} - -static void ath6kl_htc_tx_pkts_get(struct htc_target *target, - struct htc_endpoint *endpoint, - struct list_head *queue) -{ - int req_cred; - u8 flags; - struct htc_packet *packet; - unsigned int len; - - while (true) { - - flags = 0; - - if (list_empty(&endpoint->txq)) - break; - packet = list_first_entry(&endpoint->txq, struct htc_packet, - list); - - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc tx got packet 0x%p queue depth %d\n", - packet, get_queue_depth(&endpoint->txq)); - - len = CALC_TXRX_PADDED_LEN(target, - packet->act_len + HTC_HDR_LENGTH); - - if (htc_check_credits(target, endpoint, &flags, - packet->endpoint, len, &req_cred)) - break; - - /* now we can fully move onto caller's queue */ - packet = list_first_entry(&endpoint->txq, struct htc_packet, - list); - list_move_tail(&packet->list, queue); - - /* save the number of credits this packet consumed */ - packet->info.tx.cred_used = req_cred; - - /* all TX packets are handled asynchronously */ - packet->completion = htc_tx_comp_handler; - packet->context = target; - endpoint->ep_st.tx_issued += 1; - - /* save send flags */ - packet->info.tx.flags = flags; - packet->info.tx.seqno = endpoint->seqno; - endpoint->seqno++; - } -} - -/* See if the padded tx length falls on a credit boundary */ -static int htc_get_credit_padding(unsigned int cred_sz, int *len, - struct htc_endpoint *ep) -{ - int rem_cred, cred_pad; - - rem_cred = *len % cred_sz; - - /* No padding needed */ - if (!rem_cred) - return 0; - - if (!(ep->conn_flags & HTC_FLGS_TX_BNDL_PAD_EN)) - return -1; - - /* - * The transfer consumes a "partial" credit, this - * packet cannot be bundled unless we add - * additional "dummy" padding (max 255 bytes) to - * consume the entire credit. - */ - cred_pad = *len < cred_sz ? (cred_sz - *len) : rem_cred; - - if ((cred_pad > 0) && (cred_pad <= 255)) - *len += cred_pad; - else - /* The amount of padding is too large, send as non-bundled */ - return -1; - - return cred_pad; -} - -static int ath6kl_htc_tx_setup_scat_list(struct htc_target *target, - struct htc_endpoint *endpoint, - struct hif_scatter_req *scat_req, - int n_scat, - struct list_head *queue) -{ - struct htc_packet *packet; - int i, len, rem_scat, cred_pad; - int status = 0; - u8 flags; - - rem_scat = target->max_tx_bndl_sz; - - for (i = 0; i < n_scat; i++) { - scat_req->scat_list[i].packet = NULL; - - if (list_empty(queue)) - break; - - packet = list_first_entry(queue, struct htc_packet, list); - len = CALC_TXRX_PADDED_LEN(target, - packet->act_len + HTC_HDR_LENGTH); - - cred_pad = htc_get_credit_padding(target->tgt_cred_sz, - &len, endpoint); - if (cred_pad < 0 || rem_scat < len) { - status = -ENOSPC; - break; - } - - rem_scat -= len; - /* now remove it from the queue */ - list_del(&packet->list); - - scat_req->scat_list[i].packet = packet; - /* prepare packet and flag message as part of a send bundle */ - flags = packet->info.tx.flags | HTC_FLAGS_SEND_BUNDLE; - ath6kl_htc_tx_prep_pkt(packet, flags, - cred_pad, packet->info.tx.seqno); - /* Make sure the buffer is 4-byte aligned */ - ath6kl_htc_tx_buf_align(&packet->buf, - packet->act_len + HTC_HDR_LENGTH); - scat_req->scat_list[i].buf = packet->buf; - scat_req->scat_list[i].len = len; - - scat_req->len += len; - scat_req->scat_entries++; - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc tx adding (%d) pkt 0x%p seqno %d len %d remaining %d\n", - i, packet, packet->info.tx.seqno, len, rem_scat); - } - - /* Roll back scatter setup in case of any failure */ - if (scat_req->scat_entries < HTC_MIN_HTC_MSGS_TO_BUNDLE) { - for (i = scat_req->scat_entries - 1; i >= 0; i--) { - packet = scat_req->scat_list[i].packet; - if (packet) { - packet->buf += HTC_HDR_LENGTH; - list_add(&packet->list, queue); - } - } - return -EAGAIN; - } - - return status; -} - -/* - * Drain a queue and send as bundles this function may return without fully - * draining the queue when - * - * 1. scatter resources are exhausted - * 2. a message that will consume a partial credit will stop the - * bundling process early - * 3. we drop below the minimum number of messages for a bundle - */ -static void ath6kl_htc_tx_bundle(struct htc_endpoint *endpoint, - struct list_head *queue, - int *sent_bundle, int *n_bundle_pkts) -{ - struct htc_target *target = endpoint->target; - struct hif_scatter_req *scat_req = NULL; - int n_scat, n_sent_bundle = 0, tot_pkts_bundle = 0, i; - struct htc_packet *packet; - int status; - u32 txb_mask; - u8 ac = WMM_NUM_AC; - - if ((HTC_CTRL_RSVD_SVC != endpoint->svc_id) && - (WMI_CONTROL_SVC != endpoint->svc_id)) - ac = target->dev->ar->ep2ac_map[endpoint->eid]; - - while (true) { - status = 0; - n_scat = get_queue_depth(queue); - n_scat = min(n_scat, target->msg_per_bndl_max); - - if (n_scat < HTC_MIN_HTC_MSGS_TO_BUNDLE) - /* not enough to bundle */ - break; - - scat_req = hif_scatter_req_get(target->dev->ar); - - if (!scat_req) { - /* no scatter resources */ - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc tx no more scatter resources\n"); - break; - } - - if ((ac < WMM_NUM_AC) && (ac != WMM_AC_BK)) { - if (WMM_AC_BE == ac) - /* - * BE, BK have priorities and bit - * positions reversed - */ - txb_mask = (1 << WMM_AC_BK); - else - /* - * any AC with priority lower than - * itself - */ - txb_mask = ((1 << ac) - 1); - - /* - * when the scatter request resources drop below a - * certain threshold, disable Tx bundling for all - * AC's with priority lower than the current requesting - * AC. Otherwise re-enable Tx bundling for them - */ - if (scat_req->scat_q_depth < ATH6KL_SCATTER_REQS) - target->tx_bndl_mask &= ~txb_mask; - else - target->tx_bndl_mask |= txb_mask; - } - - ath6kl_dbg(ATH6KL_DBG_HTC, "htc tx pkts to scatter: %d\n", - n_scat); - - scat_req->len = 0; - scat_req->scat_entries = 0; - - status = ath6kl_htc_tx_setup_scat_list(target, endpoint, - scat_req, n_scat, - queue); - if (status == -EAGAIN) { - hif_scatter_req_add(target->dev->ar, scat_req); - break; - } - - /* send path is always asynchronous */ - scat_req->complete = htc_async_tx_scat_complete; - n_sent_bundle++; - tot_pkts_bundle += scat_req->scat_entries; - - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc tx scatter bytes %d entries %d\n", - scat_req->len, scat_req->scat_entries); - - for (i = 0; i < scat_req->scat_entries; i++) { - packet = scat_req->scat_list[i].packet; - trace_ath6kl_htc_tx(packet->status, packet->endpoint, - packet->buf, packet->act_len); - } - - ath6kl_hif_submit_scat_req(target->dev, scat_req, false); - - if (status) - break; - } - - *sent_bundle = n_sent_bundle; - *n_bundle_pkts = tot_pkts_bundle; - ath6kl_dbg(ATH6KL_DBG_HTC, "htc tx bundle sent %d pkts\n", - n_sent_bundle); - - return; -} - -static void ath6kl_htc_tx_from_queue(struct htc_target *target, - struct htc_endpoint *endpoint) -{ - struct list_head txq; - struct htc_packet *packet; - int bundle_sent; - int n_pkts_bundle; - u8 ac = WMM_NUM_AC; - int status; - - spin_lock_bh(&target->tx_lock); - - endpoint->tx_proc_cnt++; - if (endpoint->tx_proc_cnt > 1) { - endpoint->tx_proc_cnt--; - spin_unlock_bh(&target->tx_lock); - ath6kl_dbg(ATH6KL_DBG_HTC, "htc tx busy\n"); - return; - } - - /* - * drain the endpoint TX queue for transmission as long - * as we have enough credits. - */ - INIT_LIST_HEAD(&txq); - - if ((HTC_CTRL_RSVD_SVC != endpoint->svc_id) && - (WMI_CONTROL_SVC != endpoint->svc_id)) - ac = target->dev->ar->ep2ac_map[endpoint->eid]; - - while (true) { - - if (list_empty(&endpoint->txq)) - break; - - ath6kl_htc_tx_pkts_get(target, endpoint, &txq); - - if (list_empty(&txq)) - break; - - spin_unlock_bh(&target->tx_lock); - - bundle_sent = 0; - n_pkts_bundle = 0; - - while (true) { - /* try to send a bundle on each pass */ - if ((target->tx_bndl_mask) && - (get_queue_depth(&txq) >= - HTC_MIN_HTC_MSGS_TO_BUNDLE)) { - int temp1 = 0, temp2 = 0; - - /* check if bundling is enabled for an AC */ - if (target->tx_bndl_mask & (1 << ac)) { - ath6kl_htc_tx_bundle(endpoint, &txq, - &temp1, &temp2); - bundle_sent += temp1; - n_pkts_bundle += temp2; - } - } - - if (list_empty(&txq)) - break; - - packet = list_first_entry(&txq, struct htc_packet, - list); - list_del(&packet->list); - - ath6kl_htc_tx_prep_pkt(packet, packet->info.tx.flags, - 0, packet->info.tx.seqno); - status = ath6kl_htc_tx_issue(target, packet); - - if (status) { - packet->status = status; - packet->completion(packet->context, packet); - } - } - - spin_lock_bh(&target->tx_lock); - - endpoint->ep_st.tx_bundles += bundle_sent; - endpoint->ep_st.tx_pkt_bundled += n_pkts_bundle; - - /* - * if an AC has bundling disabled and no tx bundling - * has occured continously for a certain number of TX, - * enable tx bundling for this AC - */ - if (!bundle_sent) { - if (!(target->tx_bndl_mask & (1 << ac)) && - (ac < WMM_NUM_AC)) { - if (++target->ac_tx_count[ac] >= - TX_RESUME_BUNDLE_THRESHOLD) { - target->ac_tx_count[ac] = 0; - target->tx_bndl_mask |= (1 << ac); - } - } - } else { - /* tx bundling will reset the counter */ - if (ac < WMM_NUM_AC) - target->ac_tx_count[ac] = 0; - } - } - - endpoint->tx_proc_cnt = 0; - spin_unlock_bh(&target->tx_lock); -} - -static bool ath6kl_htc_tx_try(struct htc_target *target, - struct htc_endpoint *endpoint, - struct htc_packet *tx_pkt) -{ - struct htc_ep_callbacks ep_cb; - int txq_depth; - bool overflow = false; - - ep_cb = endpoint->ep_cb; - - spin_lock_bh(&target->tx_lock); - txq_depth = get_queue_depth(&endpoint->txq); - spin_unlock_bh(&target->tx_lock); - - if (txq_depth >= endpoint->max_txq_depth) - overflow = true; - - if (overflow) - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc tx overflow ep %d depth %d max %d\n", - endpoint->eid, txq_depth, - endpoint->max_txq_depth); - - if (overflow && ep_cb.tx_full) { - if (ep_cb.tx_full(endpoint->target, tx_pkt) == - HTC_SEND_FULL_DROP) { - endpoint->ep_st.tx_dropped += 1; - return false; - } - } - - spin_lock_bh(&target->tx_lock); - list_add_tail(&tx_pkt->list, &endpoint->txq); - spin_unlock_bh(&target->tx_lock); - - ath6kl_htc_tx_from_queue(target, endpoint); - - return true; -} - -static void htc_chk_ep_txq(struct htc_target *target) -{ - struct htc_endpoint *endpoint; - struct htc_endpoint_credit_dist *cred_dist; - - /* - * Run through the credit distribution list to see if there are - * packets queued. NOTE: no locks need to be taken since the - * distribution list is not dynamic (cannot be re-ordered) and we - * are not modifying any state. - */ - list_for_each_entry(cred_dist, &target->cred_dist_list, list) { - endpoint = cred_dist->htc_ep; - - spin_lock_bh(&target->tx_lock); - if (!list_empty(&endpoint->txq)) { - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc creds ep %d credits %d pkts %d\n", - cred_dist->endpoint, - endpoint->cred_dist.credits, - get_queue_depth(&endpoint->txq)); - spin_unlock_bh(&target->tx_lock); - /* - * Try to start the stalled queue, this list is - * ordered by priority. If there are credits - * available the highest priority queue will get a - * chance to reclaim credits from lower priority - * ones. - */ - ath6kl_htc_tx_from_queue(target, endpoint); - spin_lock_bh(&target->tx_lock); - } - spin_unlock_bh(&target->tx_lock); - } -} - -static int htc_setup_tx_complete(struct htc_target *target) -{ - struct htc_packet *send_pkt = NULL; - int status; - - send_pkt = htc_get_control_buf(target, true); - - if (!send_pkt) - return -ENOMEM; - - if (target->htc_tgt_ver >= HTC_VERSION_2P1) { - struct htc_setup_comp_ext_msg *setup_comp_ext; - u32 flags = 0; - - setup_comp_ext = - (struct htc_setup_comp_ext_msg *)send_pkt->buf; - memset(setup_comp_ext, 0, sizeof(*setup_comp_ext)); - setup_comp_ext->msg_id = - cpu_to_le16(HTC_MSG_SETUP_COMPLETE_EX_ID); - - if (target->msg_per_bndl_max > 0) { - /* Indicate HTC bundling to the target */ - flags |= HTC_SETUP_COMP_FLG_RX_BNDL_EN; - setup_comp_ext->msg_per_rxbndl = - target->msg_per_bndl_max; - } - - memcpy(&setup_comp_ext->flags, &flags, - sizeof(setup_comp_ext->flags)); - set_htc_pkt_info(send_pkt, NULL, (u8 *) setup_comp_ext, - sizeof(struct htc_setup_comp_ext_msg), - ENDPOINT_0, HTC_SERVICE_TX_PACKET_TAG); - - } else { - struct htc_setup_comp_msg *setup_comp; - setup_comp = (struct htc_setup_comp_msg *)send_pkt->buf; - memset(setup_comp, 0, sizeof(struct htc_setup_comp_msg)); - setup_comp->msg_id = cpu_to_le16(HTC_MSG_SETUP_COMPLETE_ID); - set_htc_pkt_info(send_pkt, NULL, (u8 *) setup_comp, - sizeof(struct htc_setup_comp_msg), - ENDPOINT_0, HTC_SERVICE_TX_PACKET_TAG); - } - - /* we want synchronous operation */ - send_pkt->completion = NULL; - ath6kl_htc_tx_prep_pkt(send_pkt, 0, 0, 0); - status = ath6kl_htc_tx_issue(target, send_pkt); - - if (send_pkt != NULL) - htc_reclaim_txctrl_buf(target, send_pkt); - - return status; -} - -static void ath6kl_htc_set_credit_dist(struct htc_target *target, - struct ath6kl_htc_credit_info *credit_info, - u16 srvc_pri_order[], int list_len) -{ - struct htc_endpoint *endpoint; - int i, ep; - - target->credit_info = credit_info; - - list_add_tail(&target->endpoint[ENDPOINT_0].cred_dist.list, - &target->cred_dist_list); - - for (i = 0; i < list_len; i++) { - for (ep = ENDPOINT_1; ep < ENDPOINT_MAX; ep++) { - endpoint = &target->endpoint[ep]; - if (endpoint->svc_id == srvc_pri_order[i]) { - list_add_tail(&endpoint->cred_dist.list, - &target->cred_dist_list); - break; - } - } - if (ep >= ENDPOINT_MAX) { - WARN_ON(1); - return; - } - } -} - -static int ath6kl_htc_mbox_tx(struct htc_target *target, - struct htc_packet *packet) -{ - struct htc_endpoint *endpoint; - struct list_head queue; - - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc tx ep id %d buf 0x%p len %d\n", - packet->endpoint, packet->buf, packet->act_len); - - if (packet->endpoint >= ENDPOINT_MAX) { - WARN_ON(1); - return -EINVAL; - } - - endpoint = &target->endpoint[packet->endpoint]; - - if (!ath6kl_htc_tx_try(target, endpoint, packet)) { - packet->status = (target->htc_flags & HTC_OP_STATE_STOPPING) ? - -ECANCELED : -ENOSPC; - INIT_LIST_HEAD(&queue); - list_add(&packet->list, &queue); - htc_tx_complete(endpoint, &queue); - } - - return 0; -} - -/* flush endpoint TX queue */ -static void ath6kl_htc_mbox_flush_txep(struct htc_target *target, - enum htc_endpoint_id eid, u16 tag) -{ - struct htc_packet *packet, *tmp_pkt; - struct list_head discard_q, container; - struct htc_endpoint *endpoint = &target->endpoint[eid]; - - if (!endpoint->svc_id) { - WARN_ON(1); - return; - } - - /* initialize the discard queue */ - INIT_LIST_HEAD(&discard_q); - - spin_lock_bh(&target->tx_lock); - - list_for_each_entry_safe(packet, tmp_pkt, &endpoint->txq, list) { - if ((tag == HTC_TX_PACKET_TAG_ALL) || - (tag == packet->info.tx.tag)) - list_move_tail(&packet->list, &discard_q); - } - - spin_unlock_bh(&target->tx_lock); - - list_for_each_entry_safe(packet, tmp_pkt, &discard_q, list) { - packet->status = -ECANCELED; - list_del(&packet->list); - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc tx flushing pkt 0x%p len %d ep %d tag 0x%x\n", - packet, packet->act_len, - packet->endpoint, packet->info.tx.tag); - - INIT_LIST_HEAD(&container); - list_add_tail(&packet->list, &container); - htc_tx_complete(endpoint, &container); - } - -} - -static void ath6kl_htc_flush_txep_all(struct htc_target *target) -{ - struct htc_endpoint *endpoint; - int i; - - dump_cred_dist_stats(target); - - for (i = ENDPOINT_0; i < ENDPOINT_MAX; i++) { - endpoint = &target->endpoint[i]; - if (endpoint->svc_id == 0) - /* not in use.. */ - continue; - ath6kl_htc_mbox_flush_txep(target, i, HTC_TX_PACKET_TAG_ALL); - } -} - -static void ath6kl_htc_mbox_activity_changed(struct htc_target *target, - enum htc_endpoint_id eid, - bool active) -{ - struct htc_endpoint *endpoint = &target->endpoint[eid]; - bool dist = false; - - if (endpoint->svc_id == 0) { - WARN_ON(1); - return; - } - - spin_lock_bh(&target->tx_lock); - - if (active) { - if (!(endpoint->cred_dist.dist_flags & HTC_EP_ACTIVE)) { - endpoint->cred_dist.dist_flags |= HTC_EP_ACTIVE; - dist = true; - } - } else { - if (endpoint->cred_dist.dist_flags & HTC_EP_ACTIVE) { - endpoint->cred_dist.dist_flags &= ~HTC_EP_ACTIVE; - dist = true; - } - } - - if (dist) { - endpoint->cred_dist.txq_depth = - get_queue_depth(&endpoint->txq); - - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc tx activity ctxt 0x%p dist 0x%p\n", - target->credit_info, &target->cred_dist_list); - - ath6kl_credit_distribute(target->credit_info, - &target->cred_dist_list, - HTC_CREDIT_DIST_ACTIVITY_CHANGE); - } - - spin_unlock_bh(&target->tx_lock); - - if (dist && !active) - htc_chk_ep_txq(target); -} - -/* HTC Rx */ - -static inline void ath6kl_htc_rx_update_stats(struct htc_endpoint *endpoint, - int n_look_ahds) -{ - endpoint->ep_st.rx_pkts++; - if (n_look_ahds == 1) - endpoint->ep_st.rx_lkahds++; - else if (n_look_ahds > 1) - endpoint->ep_st.rx_bundle_lkahd++; -} - -static inline bool htc_valid_rx_frame_len(struct htc_target *target, - enum htc_endpoint_id eid, int len) -{ - return (eid == target->dev->ar->ctrl_ep) ? - len <= ATH6KL_BUFFER_SIZE : len <= ATH6KL_AMSDU_BUFFER_SIZE; -} - -static int htc_add_rxbuf(struct htc_target *target, struct htc_packet *packet) -{ - struct list_head queue; - - INIT_LIST_HEAD(&queue); - list_add_tail(&packet->list, &queue); - return ath6kl_htc_mbox_add_rxbuf_multiple(target, &queue); -} - -static void htc_reclaim_rxbuf(struct htc_target *target, - struct htc_packet *packet, - struct htc_endpoint *ep) -{ - if (packet->info.rx.rx_flags & HTC_RX_PKT_NO_RECYCLE) { - htc_rxpkt_reset(packet); - packet->status = -ECANCELED; - ep->ep_cb.rx(ep->target, packet); - } else { - htc_rxpkt_reset(packet); - htc_add_rxbuf((void *)(target), packet); - } -} - -static void reclaim_rx_ctrl_buf(struct htc_target *target, - struct htc_packet *packet) -{ - spin_lock_bh(&target->htc_lock); - list_add_tail(&packet->list, &target->free_ctrl_rxbuf); - spin_unlock_bh(&target->htc_lock); -} - -static int ath6kl_htc_rx_packet(struct htc_target *target, - struct htc_packet *packet, - u32 rx_len) -{ - struct ath6kl_device *dev = target->dev; - u32 padded_len; - int status; - - padded_len = CALC_TXRX_PADDED_LEN(target, rx_len); - - if (padded_len > packet->buf_len) { - ath6kl_err("not enough receive space for packet - padlen %d recvlen %d bufferlen %d\n", - padded_len, rx_len, packet->buf_len); - return -ENOMEM; - } - - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc rx 0x%p hdr 0x%x len %d mbox 0x%x\n", - packet, packet->info.rx.exp_hdr, - padded_len, dev->ar->mbox_info.htc_addr); - - status = hif_read_write_sync(dev->ar, - dev->ar->mbox_info.htc_addr, - packet->buf, padded_len, - HIF_RD_SYNC_BLOCK_FIX); - - packet->status = status; - - return status; -} - -/* - * optimization for recv packets, we can indicate a - * "hint" that there are more single-packets to fetch - * on this endpoint. - */ -static void ath6kl_htc_rx_set_indicate(u32 lk_ahd, - struct htc_endpoint *endpoint, - struct htc_packet *packet) -{ - struct htc_frame_hdr *htc_hdr = (struct htc_frame_hdr *)&lk_ahd; - - if (htc_hdr->eid == packet->endpoint) { - if (!list_empty(&endpoint->rx_bufq)) - packet->info.rx.indicat_flags |= - HTC_RX_FLAGS_INDICATE_MORE_PKTS; - } -} - -static void ath6kl_htc_rx_chk_water_mark(struct htc_endpoint *endpoint) -{ - struct htc_ep_callbacks ep_cb = endpoint->ep_cb; - - if (ep_cb.rx_refill_thresh > 0) { - spin_lock_bh(&endpoint->target->rx_lock); - if (get_queue_depth(&endpoint->rx_bufq) - < ep_cb.rx_refill_thresh) { - spin_unlock_bh(&endpoint->target->rx_lock); - ep_cb.rx_refill(endpoint->target, endpoint->eid); - return; - } - spin_unlock_bh(&endpoint->target->rx_lock); - } -} - -/* This function is called with rx_lock held */ -static int ath6kl_htc_rx_setup(struct htc_target *target, - struct htc_endpoint *ep, - u32 *lk_ahds, struct list_head *queue, int n_msg) -{ - struct htc_packet *packet; - /* FIXME: type of lk_ahds can't be right */ - struct htc_frame_hdr *htc_hdr = (struct htc_frame_hdr *)lk_ahds; - struct htc_ep_callbacks ep_cb; - int status = 0, j, full_len; - bool no_recycle; - - full_len = CALC_TXRX_PADDED_LEN(target, - le16_to_cpu(htc_hdr->payld_len) + - sizeof(*htc_hdr)); - - if (!htc_valid_rx_frame_len(target, ep->eid, full_len)) { - ath6kl_warn("Rx buffer requested with invalid length htc_hdr:eid %d, flags 0x%x, len %d\n", - htc_hdr->eid, htc_hdr->flags, - le16_to_cpu(htc_hdr->payld_len)); - return -EINVAL; - } - - ep_cb = ep->ep_cb; - for (j = 0; j < n_msg; j++) { - - /* - * Reset flag, any packets allocated using the - * rx_alloc() API cannot be recycled on - * cleanup,they must be explicitly returned. - */ - no_recycle = false; - - if (ep_cb.rx_allocthresh && - (full_len > ep_cb.rx_alloc_thresh)) { - ep->ep_st.rx_alloc_thresh_hit += 1; - ep->ep_st.rxalloc_thresh_byte += - le16_to_cpu(htc_hdr->payld_len); - - spin_unlock_bh(&target->rx_lock); - no_recycle = true; - - packet = ep_cb.rx_allocthresh(ep->target, ep->eid, - full_len); - spin_lock_bh(&target->rx_lock); - } else { - /* refill handler is being used */ - if (list_empty(&ep->rx_bufq)) { - if (ep_cb.rx_refill) { - spin_unlock_bh(&target->rx_lock); - ep_cb.rx_refill(ep->target, ep->eid); - spin_lock_bh(&target->rx_lock); - } - } - - if (list_empty(&ep->rx_bufq)) - packet = NULL; - else { - packet = list_first_entry(&ep->rx_bufq, - struct htc_packet, list); - list_del(&packet->list); - } - } - - if (!packet) { - target->rx_st_flags |= HTC_RECV_WAIT_BUFFERS; - target->ep_waiting = ep->eid; - return -ENOSPC; - } - - /* clear flags */ - packet->info.rx.rx_flags = 0; - packet->info.rx.indicat_flags = 0; - packet->status = 0; - - if (no_recycle) - /* - * flag that these packets cannot be - * recycled, they have to be returned to - * the user - */ - packet->info.rx.rx_flags |= HTC_RX_PKT_NO_RECYCLE; - - /* Caller needs to free this upon any failure */ - list_add_tail(&packet->list, queue); - - if (target->htc_flags & HTC_OP_STATE_STOPPING) { - status = -ECANCELED; - break; - } - - if (j) { - packet->info.rx.rx_flags |= HTC_RX_PKT_REFRESH_HDR; - packet->info.rx.exp_hdr = 0xFFFFFFFF; - } else - /* set expected look ahead */ - packet->info.rx.exp_hdr = *lk_ahds; - - packet->act_len = le16_to_cpu(htc_hdr->payld_len) + - HTC_HDR_LENGTH; - } - - return status; -} - -static int ath6kl_htc_rx_alloc(struct htc_target *target, - u32 lk_ahds[], int msg, - struct htc_endpoint *endpoint, - struct list_head *queue) -{ - int status = 0; - struct htc_packet *packet, *tmp_pkt; - struct htc_frame_hdr *htc_hdr; - int i, n_msg; - - spin_lock_bh(&target->rx_lock); - - for (i = 0; i < msg; i++) { - - htc_hdr = (struct htc_frame_hdr *)&lk_ahds[i]; - - if (htc_hdr->eid >= ENDPOINT_MAX) { - ath6kl_err("invalid ep in look-ahead: %d\n", - htc_hdr->eid); - status = -ENOMEM; - break; - } - - if (htc_hdr->eid != endpoint->eid) { - ath6kl_err("invalid ep in look-ahead: %d should be : %d (index:%d)\n", - htc_hdr->eid, endpoint->eid, i); - status = -ENOMEM; - break; - } - - if (le16_to_cpu(htc_hdr->payld_len) > HTC_MAX_PAYLOAD_LENGTH) { - ath6kl_err("payload len %d exceeds max htc : %d !\n", - htc_hdr->payld_len, - (u32) HTC_MAX_PAYLOAD_LENGTH); - status = -ENOMEM; - break; - } - - if (endpoint->svc_id == 0) { - ath6kl_err("ep %d is not connected !\n", htc_hdr->eid); - status = -ENOMEM; - break; - } - - if (htc_hdr->flags & HTC_FLG_RX_BNDL_CNT) { - /* - * HTC header indicates that every packet to follow - * has the same padded length so that it can be - * optimally fetched as a full bundle. - */ - n_msg = (htc_hdr->flags & HTC_FLG_RX_BNDL_CNT) >> - HTC_FLG_RX_BNDL_CNT_S; - - /* the count doesn't include the starter frame */ - n_msg++; - if (n_msg > target->msg_per_bndl_max) { - status = -ENOMEM; - break; - } - - endpoint->ep_st.rx_bundle_from_hdr += 1; - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc rx bundle pkts %d\n", - n_msg); - } else - /* HTC header only indicates 1 message to fetch */ - n_msg = 1; - - /* Setup packet buffers for each message */ - status = ath6kl_htc_rx_setup(target, endpoint, &lk_ahds[i], - queue, n_msg); - - /* - * This is due to unavailabilty of buffers to rx entire data. - * Return no error so that free buffers from queue can be used - * to receive partial data. - */ - if (status == -ENOSPC) { - spin_unlock_bh(&target->rx_lock); - return 0; - } - - if (status) - break; - } - - spin_unlock_bh(&target->rx_lock); - - if (status) { - list_for_each_entry_safe(packet, tmp_pkt, queue, list) { - list_del(&packet->list); - htc_reclaim_rxbuf(target, packet, - &target->endpoint[packet->endpoint]); - } - } - - return status; -} - -static void htc_ctrl_rx(struct htc_target *context, struct htc_packet *packets) -{ - if (packets->endpoint != ENDPOINT_0) { - WARN_ON(1); - return; - } - - if (packets->status == -ECANCELED) { - reclaim_rx_ctrl_buf(context, packets); - return; - } - - if (packets->act_len > 0) { - ath6kl_err("htc_ctrl_rx, got message with len:%zu\n", - packets->act_len + HTC_HDR_LENGTH); - - ath6kl_dbg_dump(ATH6KL_DBG_HTC, - "htc rx unexpected endpoint 0 message", "", - packets->buf - HTC_HDR_LENGTH, - packets->act_len + HTC_HDR_LENGTH); - } - - htc_reclaim_rxbuf(context, packets, &context->endpoint[0]); -} - -static void htc_proc_cred_rpt(struct htc_target *target, - struct htc_credit_report *rpt, - int n_entries, - enum htc_endpoint_id from_ep) -{ - struct htc_endpoint *endpoint; - int tot_credits = 0, i; - bool dist = false; - - spin_lock_bh(&target->tx_lock); - - for (i = 0; i < n_entries; i++, rpt++) { - if (rpt->eid >= ENDPOINT_MAX) { - WARN_ON(1); - spin_unlock_bh(&target->tx_lock); - return; - } - - endpoint = &target->endpoint[rpt->eid]; - - ath6kl_dbg(ATH6KL_DBG_CREDIT, - "credit report ep %d credits %d\n", - rpt->eid, rpt->credits); - - endpoint->ep_st.tx_cred_rpt += 1; - endpoint->ep_st.cred_retnd += rpt->credits; - - if (from_ep == rpt->eid) { - /* - * This credit report arrived on the same endpoint - * indicating it arrived in an RX packet. - */ - endpoint->ep_st.cred_from_rx += rpt->credits; - endpoint->ep_st.cred_rpt_from_rx += 1; - } else if (from_ep == ENDPOINT_0) { - /* credit arrived on endpoint 0 as a NULL message */ - endpoint->ep_st.cred_from_ep0 += rpt->credits; - endpoint->ep_st.cred_rpt_ep0 += 1; - } else { - endpoint->ep_st.cred_from_other += rpt->credits; - endpoint->ep_st.cred_rpt_from_other += 1; - } - - if (rpt->eid == ENDPOINT_0) - /* always give endpoint 0 credits back */ - endpoint->cred_dist.credits += rpt->credits; - else { - endpoint->cred_dist.cred_to_dist += rpt->credits; - dist = true; - } - - /* - * Refresh tx depth for distribution function that will - * recover these credits NOTE: this is only valid when - * there are credits to recover! - */ - endpoint->cred_dist.txq_depth = - get_queue_depth(&endpoint->txq); - - tot_credits += rpt->credits; - } - - if (dist) { - /* - * This was a credit return based on a completed send - * operations note, this is done with the lock held - */ - ath6kl_credit_distribute(target->credit_info, - &target->cred_dist_list, - HTC_CREDIT_DIST_SEND_COMPLETE); - } - - spin_unlock_bh(&target->tx_lock); - - if (tot_credits) - htc_chk_ep_txq(target); -} - -static int htc_parse_trailer(struct htc_target *target, - struct htc_record_hdr *record, - u8 *record_buf, u32 *next_lk_ahds, - enum htc_endpoint_id endpoint, - int *n_lk_ahds) -{ - struct htc_bundle_lkahd_rpt *bundle_lkahd_rpt; - struct htc_lookahead_report *lk_ahd; - int len; - - switch (record->rec_id) { - case HTC_RECORD_CREDITS: - len = record->len / sizeof(struct htc_credit_report); - if (!len) { - WARN_ON(1); - return -EINVAL; - } - - htc_proc_cred_rpt(target, - (struct htc_credit_report *) record_buf, - len, endpoint); - break; - case HTC_RECORD_LOOKAHEAD: - len = record->len / sizeof(*lk_ahd); - if (!len) { - WARN_ON(1); - return -EINVAL; - } - - lk_ahd = (struct htc_lookahead_report *) record_buf; - if ((lk_ahd->pre_valid == ((~lk_ahd->post_valid) & 0xFF)) && - next_lk_ahds) { - - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc rx lk_ahd found pre_valid 0x%x post_valid 0x%x\n", - lk_ahd->pre_valid, lk_ahd->post_valid); - - /* look ahead bytes are valid, copy them over */ - memcpy((u8 *)&next_lk_ahds[0], lk_ahd->lk_ahd, 4); - - ath6kl_dbg_dump(ATH6KL_DBG_HTC, - "htc rx next look ahead", - "", next_lk_ahds, 4); - - *n_lk_ahds = 1; - } - break; - case HTC_RECORD_LOOKAHEAD_BUNDLE: - len = record->len / sizeof(*bundle_lkahd_rpt); - if (!len || (len > HTC_HOST_MAX_MSG_PER_BUNDLE)) { - WARN_ON(1); - return -EINVAL; - } - - if (next_lk_ahds) { - int i; - - bundle_lkahd_rpt = - (struct htc_bundle_lkahd_rpt *) record_buf; - - ath6kl_dbg_dump(ATH6KL_DBG_HTC, "htc rx bundle lk_ahd", - "", record_buf, record->len); - - for (i = 0; i < len; i++) { - memcpy((u8 *)&next_lk_ahds[i], - bundle_lkahd_rpt->lk_ahd, 4); - bundle_lkahd_rpt++; - } - - *n_lk_ahds = i; - } - break; - default: - ath6kl_err("unhandled record: id:%d len:%d\n", - record->rec_id, record->len); - break; - } - - return 0; - -} - -static int htc_proc_trailer(struct htc_target *target, - u8 *buf, int len, u32 *next_lk_ahds, - int *n_lk_ahds, enum htc_endpoint_id endpoint) -{ - struct htc_record_hdr *record; - int orig_len; - int status; - u8 *record_buf; - u8 *orig_buf; - - ath6kl_dbg(ATH6KL_DBG_HTC, "htc rx trailer len %d\n", len); - ath6kl_dbg_dump(ATH6KL_DBG_HTC, NULL, "", buf, len); - - orig_buf = buf; - orig_len = len; - status = 0; - - while (len > 0) { - - if (len < sizeof(struct htc_record_hdr)) { - status = -ENOMEM; - break; - } - /* these are byte aligned structs */ - record = (struct htc_record_hdr *) buf; - len -= sizeof(struct htc_record_hdr); - buf += sizeof(struct htc_record_hdr); - - if (record->len > len) { - ath6kl_err("invalid record len: %d (id:%d) buf has: %d bytes left\n", - record->len, record->rec_id, len); - status = -ENOMEM; - break; - } - record_buf = buf; - - status = htc_parse_trailer(target, record, record_buf, - next_lk_ahds, endpoint, n_lk_ahds); - - if (status) - break; - - /* advance buffer past this record for next time around */ - buf += record->len; - len -= record->len; - } - - if (status) - ath6kl_dbg_dump(ATH6KL_DBG_HTC, "htc rx bad trailer", - "", orig_buf, orig_len); - - return status; -} - -static int ath6kl_htc_rx_process_hdr(struct htc_target *target, - struct htc_packet *packet, - u32 *next_lkahds, int *n_lkahds) -{ - int status = 0; - u16 payload_len; - u32 lk_ahd; - struct htc_frame_hdr *htc_hdr = (struct htc_frame_hdr *)packet->buf; - - if (n_lkahds != NULL) - *n_lkahds = 0; - - /* - * NOTE: we cannot assume the alignment of buf, so we use the safe - * macros to retrieve 16 bit fields. - */ - payload_len = le16_to_cpu(get_unaligned(&htc_hdr->payld_len)); - - memcpy((u8 *)&lk_ahd, packet->buf, sizeof(lk_ahd)); - - if (packet->info.rx.rx_flags & HTC_RX_PKT_REFRESH_HDR) { - /* - * Refresh the expected header and the actual length as it - * was unknown when this packet was grabbed as part of the - * bundle. - */ - packet->info.rx.exp_hdr = lk_ahd; - packet->act_len = payload_len + HTC_HDR_LENGTH; - - /* validate the actual header that was refreshed */ - if (packet->act_len > packet->buf_len) { - ath6kl_err("refreshed hdr payload len (%d) in bundled recv is invalid (hdr: 0x%X)\n", - payload_len, lk_ahd); - /* - * Limit this to max buffer just to print out some - * of the buffer. - */ - packet->act_len = min(packet->act_len, packet->buf_len); - status = -ENOMEM; - goto fail_rx; - } - - if (packet->endpoint != htc_hdr->eid) { - ath6kl_err("refreshed hdr ep (%d) does not match expected ep (%d)\n", - htc_hdr->eid, packet->endpoint); - status = -ENOMEM; - goto fail_rx; - } - } - - if (lk_ahd != packet->info.rx.exp_hdr) { - ath6kl_err("%s(): lk_ahd mismatch! (pPkt:0x%p flags:0x%X)\n", - __func__, packet, packet->info.rx.rx_flags); - ath6kl_dbg_dump(ATH6KL_DBG_HTC, "htc rx expected lk_ahd", - "", &packet->info.rx.exp_hdr, 4); - ath6kl_dbg_dump(ATH6KL_DBG_HTC, "htc rx current header", - "", (u8 *)&lk_ahd, sizeof(lk_ahd)); - status = -ENOMEM; - goto fail_rx; - } - - if (htc_hdr->flags & HTC_FLG_RX_TRAILER) { - if (htc_hdr->ctrl[0] < sizeof(struct htc_record_hdr) || - htc_hdr->ctrl[0] > payload_len) { - ath6kl_err("%s(): invalid hdr (payload len should be :%d, CB[0] is:%d)\n", - __func__, payload_len, htc_hdr->ctrl[0]); - status = -ENOMEM; - goto fail_rx; - } - - if (packet->info.rx.rx_flags & HTC_RX_PKT_IGNORE_LOOKAHEAD) { - next_lkahds = NULL; - n_lkahds = NULL; - } - - status = htc_proc_trailer(target, packet->buf + HTC_HDR_LENGTH - + payload_len - htc_hdr->ctrl[0], - htc_hdr->ctrl[0], next_lkahds, - n_lkahds, packet->endpoint); - - if (status) - goto fail_rx; - - packet->act_len -= htc_hdr->ctrl[0]; - } - - packet->buf += HTC_HDR_LENGTH; - packet->act_len -= HTC_HDR_LENGTH; - -fail_rx: - if (status) - ath6kl_dbg_dump(ATH6KL_DBG_HTC, "htc rx bad packet", - "", packet->buf, packet->act_len); - - return status; -} - -static void ath6kl_htc_rx_complete(struct htc_endpoint *endpoint, - struct htc_packet *packet) -{ - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc rx complete ep %d packet 0x%p\n", - endpoint->eid, packet); - - endpoint->ep_cb.rx(endpoint->target, packet); -} - -static int ath6kl_htc_rx_bundle(struct htc_target *target, - struct list_head *rxq, - struct list_head *sync_compq, - int *n_pkt_fetched, bool part_bundle) -{ - struct hif_scatter_req *scat_req; - struct htc_packet *packet; - int rem_space = target->max_rx_bndl_sz; - int n_scat_pkt, status = 0, i, len; - - n_scat_pkt = get_queue_depth(rxq); - n_scat_pkt = min(n_scat_pkt, target->msg_per_bndl_max); - - if ((get_queue_depth(rxq) - n_scat_pkt) > 0) { - /* - * We were forced to split this bundle receive operation - * all packets in this partial bundle must have their - * lookaheads ignored. - */ - part_bundle = true; - - /* - * This would only happen if the target ignored our max - * bundle limit. - */ - ath6kl_warn("%s(): partial bundle detected num:%d , %d\n", - __func__, get_queue_depth(rxq), n_scat_pkt); - } - - len = 0; - - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc rx bundle depth %d pkts %d\n", - get_queue_depth(rxq), n_scat_pkt); - - scat_req = hif_scatter_req_get(target->dev->ar); - - if (scat_req == NULL) - goto fail_rx_pkt; - - for (i = 0; i < n_scat_pkt; i++) { - int pad_len; - - packet = list_first_entry(rxq, struct htc_packet, list); - list_del(&packet->list); - - pad_len = CALC_TXRX_PADDED_LEN(target, - packet->act_len); - - if ((rem_space - pad_len) < 0) { - list_add(&packet->list, rxq); - break; - } - - rem_space -= pad_len; - - if (part_bundle || (i < (n_scat_pkt - 1))) - /* - * Packet 0..n-1 cannot be checked for look-aheads - * since we are fetching a bundle the last packet - * however can have it's lookahead used - */ - packet->info.rx.rx_flags |= - HTC_RX_PKT_IGNORE_LOOKAHEAD; - - /* NOTE: 1 HTC packet per scatter entry */ - scat_req->scat_list[i].buf = packet->buf; - scat_req->scat_list[i].len = pad_len; - - packet->info.rx.rx_flags |= HTC_RX_PKT_PART_OF_BUNDLE; - - list_add_tail(&packet->list, sync_compq); - - WARN_ON(!scat_req->scat_list[i].len); - len += scat_req->scat_list[i].len; - } - - scat_req->len = len; - scat_req->scat_entries = i; - - status = ath6kl_hif_submit_scat_req(target->dev, scat_req, true); - - if (!status) - *n_pkt_fetched = i; - - /* free scatter request */ - hif_scatter_req_add(target->dev->ar, scat_req); - -fail_rx_pkt: - - return status; -} - -static int ath6kl_htc_rx_process_packets(struct htc_target *target, - struct list_head *comp_pktq, - u32 lk_ahds[], - int *n_lk_ahd) -{ - struct htc_packet *packet, *tmp_pkt; - struct htc_endpoint *ep; - int status = 0; - - list_for_each_entry_safe(packet, tmp_pkt, comp_pktq, list) { - ep = &target->endpoint[packet->endpoint]; - - trace_ath6kl_htc_rx(packet->status, packet->endpoint, - packet->buf, packet->act_len); - - /* process header for each of the recv packet */ - status = ath6kl_htc_rx_process_hdr(target, packet, lk_ahds, - n_lk_ahd); - if (status) - return status; - - list_del(&packet->list); - - if (list_empty(comp_pktq)) { - /* - * Last packet's more packet flag is set - * based on the lookahead. - */ - if (*n_lk_ahd > 0) - ath6kl_htc_rx_set_indicate(lk_ahds[0], - ep, packet); - } else - /* - * Packets in a bundle automatically have - * this flag set. - */ - packet->info.rx.indicat_flags |= - HTC_RX_FLAGS_INDICATE_MORE_PKTS; - - ath6kl_htc_rx_update_stats(ep, *n_lk_ahd); - - if (packet->info.rx.rx_flags & HTC_RX_PKT_PART_OF_BUNDLE) - ep->ep_st.rx_bundl += 1; - - ath6kl_htc_rx_complete(ep, packet); - } - - return status; -} - -static int ath6kl_htc_rx_fetch(struct htc_target *target, - struct list_head *rx_pktq, - struct list_head *comp_pktq) -{ - int fetched_pkts; - bool part_bundle = false; - int status = 0; - struct list_head tmp_rxq; - struct htc_packet *packet, *tmp_pkt; - - /* now go fetch the list of HTC packets */ - while (!list_empty(rx_pktq)) { - fetched_pkts = 0; - - INIT_LIST_HEAD(&tmp_rxq); - - if (target->rx_bndl_enable && (get_queue_depth(rx_pktq) > 1)) { - /* - * There are enough packets to attempt a - * bundle transfer and recv bundling is - * allowed. - */ - status = ath6kl_htc_rx_bundle(target, rx_pktq, - &tmp_rxq, - &fetched_pkts, - part_bundle); - if (status) - goto fail_rx; - - if (!list_empty(rx_pktq)) - part_bundle = true; - - list_splice_tail_init(&tmp_rxq, comp_pktq); - } - - if (!fetched_pkts) { - - packet = list_first_entry(rx_pktq, struct htc_packet, - list); - - /* fully synchronous */ - packet->completion = NULL; - - if (!list_is_singular(rx_pktq)) - /* - * look_aheads in all packet - * except the last one in the - * bundle must be ignored - */ - packet->info.rx.rx_flags |= - HTC_RX_PKT_IGNORE_LOOKAHEAD; - - /* go fetch the packet */ - status = ath6kl_htc_rx_packet(target, packet, - packet->act_len); - - list_move_tail(&packet->list, &tmp_rxq); - - if (status) - goto fail_rx; - - list_splice_tail_init(&tmp_rxq, comp_pktq); - } - } - - return 0; - -fail_rx: - - /* - * Cleanup any packets we allocated but didn't use to - * actually fetch any packets. - */ - - list_for_each_entry_safe(packet, tmp_pkt, rx_pktq, list) { - list_del(&packet->list); - htc_reclaim_rxbuf(target, packet, - &target->endpoint[packet->endpoint]); - } - - list_for_each_entry_safe(packet, tmp_pkt, &tmp_rxq, list) { - list_del(&packet->list); - htc_reclaim_rxbuf(target, packet, - &target->endpoint[packet->endpoint]); - } - - return status; -} - -int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target, - u32 msg_look_ahead, int *num_pkts) -{ - struct htc_packet *packets, *tmp_pkt; - struct htc_endpoint *endpoint; - struct list_head rx_pktq, comp_pktq; - int status = 0; - u32 look_aheads[HTC_HOST_MAX_MSG_PER_BUNDLE]; - int num_look_ahead = 1; - enum htc_endpoint_id id; - int n_fetched = 0; - - INIT_LIST_HEAD(&comp_pktq); - *num_pkts = 0; - - /* - * On first entry copy the look_aheads into our temp array for - * processing - */ - look_aheads[0] = msg_look_ahead; - - while (true) { - - /* - * First lookahead sets the expected endpoint IDs for all - * packets in a bundle. - */ - id = ((struct htc_frame_hdr *)&look_aheads[0])->eid; - endpoint = &target->endpoint[id]; - - if (id >= ENDPOINT_MAX) { - ath6kl_err("MsgPend, invalid endpoint in look-ahead: %d\n", - id); - status = -ENOMEM; - break; - } - - INIT_LIST_HEAD(&rx_pktq); - INIT_LIST_HEAD(&comp_pktq); - - /* - * Try to allocate as many HTC RX packets indicated by the - * look_aheads. - */ - status = ath6kl_htc_rx_alloc(target, look_aheads, - num_look_ahead, endpoint, - &rx_pktq); - if (status) - break; - - if (get_queue_depth(&rx_pktq) >= 2) - /* - * A recv bundle was detected, force IRQ status - * re-check again - */ - target->chk_irq_status_cnt = 1; - - n_fetched += get_queue_depth(&rx_pktq); - - num_look_ahead = 0; - - status = ath6kl_htc_rx_fetch(target, &rx_pktq, &comp_pktq); - - if (!status) - ath6kl_htc_rx_chk_water_mark(endpoint); - - /* Process fetched packets */ - status = ath6kl_htc_rx_process_packets(target, &comp_pktq, - look_aheads, - &num_look_ahead); - - if (!num_look_ahead || status) - break; - - /* - * For SYNCH processing, if we get here, we are running - * through the loop again due to a detected lookahead. Set - * flag that we should re-check IRQ status registers again - * before leaving IRQ processing, this can net better - * performance in high throughput situations. - */ - target->chk_irq_status_cnt = 1; - } - - if (status) { - ath6kl_err("failed to get pending recv messages: %d\n", - status); - - /* cleanup any packets in sync completion queue */ - list_for_each_entry_safe(packets, tmp_pkt, &comp_pktq, list) { - list_del(&packets->list); - htc_reclaim_rxbuf(target, packets, - &target->endpoint[packets->endpoint]); - } - - if (target->htc_flags & HTC_OP_STATE_STOPPING) { - ath6kl_warn("host is going to stop blocking receiver for htc_stop\n"); - ath6kl_hif_rx_control(target->dev, false); - } - } - - /* - * Before leaving, check to see if host ran out of buffers and - * needs to stop the receiver. - */ - if (target->rx_st_flags & HTC_RECV_WAIT_BUFFERS) { - ath6kl_warn("host has no rx buffers blocking receiver to prevent overrun\n"); - ath6kl_hif_rx_control(target->dev, false); - } - *num_pkts = n_fetched; - - return status; -} - -/* - * Synchronously wait for a control message from the target, - * This function is used at initialization time ONLY. At init messages - * on ENDPOINT 0 are expected. - */ -static struct htc_packet *htc_wait_for_ctrl_msg(struct htc_target *target) -{ - struct htc_packet *packet = NULL; - struct htc_frame_hdr *htc_hdr; - u32 look_ahead; - - if (ath6kl_hif_poll_mboxmsg_rx(target->dev, &look_ahead, - HTC_TARGET_RESPONSE_TIMEOUT)) - return NULL; - - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc rx wait ctrl look_ahead 0x%X\n", look_ahead); - - htc_hdr = (struct htc_frame_hdr *)&look_ahead; - - if (htc_hdr->eid != ENDPOINT_0) - return NULL; - - packet = htc_get_control_buf(target, false); - - if (!packet) - return NULL; - - packet->info.rx.rx_flags = 0; - packet->info.rx.exp_hdr = look_ahead; - packet->act_len = le16_to_cpu(htc_hdr->payld_len) + HTC_HDR_LENGTH; - - if (packet->act_len > packet->buf_len) - goto fail_ctrl_rx; - - /* we want synchronous operation */ - packet->completion = NULL; - - /* get the message from the device, this will block */ - if (ath6kl_htc_rx_packet(target, packet, packet->act_len)) - goto fail_ctrl_rx; - - trace_ath6kl_htc_rx(packet->status, packet->endpoint, - packet->buf, packet->act_len); - - /* process receive header */ - packet->status = ath6kl_htc_rx_process_hdr(target, packet, NULL, NULL); - - if (packet->status) { - ath6kl_err("htc_wait_for_ctrl_msg, ath6kl_htc_rx_process_hdr failed (status = %d)\n", - packet->status); - goto fail_ctrl_rx; - } - - return packet; - -fail_ctrl_rx: - if (packet != NULL) { - htc_rxpkt_reset(packet); - reclaim_rx_ctrl_buf(target, packet); - } - - return NULL; -} - -static int ath6kl_htc_mbox_add_rxbuf_multiple(struct htc_target *target, - struct list_head *pkt_queue) -{ - struct htc_endpoint *endpoint; - struct htc_packet *first_pkt; - bool rx_unblock = false; - int status = 0, depth; - - if (list_empty(pkt_queue)) - return -ENOMEM; - - first_pkt = list_first_entry(pkt_queue, struct htc_packet, list); - - if (first_pkt->endpoint >= ENDPOINT_MAX) - return status; - - depth = get_queue_depth(pkt_queue); - - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc rx add multiple ep id %d cnt %d len %d\n", - first_pkt->endpoint, depth, first_pkt->buf_len); - - endpoint = &target->endpoint[first_pkt->endpoint]; - - if (target->htc_flags & HTC_OP_STATE_STOPPING) { - struct htc_packet *packet, *tmp_pkt; - - /* walk through queue and mark each one canceled */ - list_for_each_entry_safe(packet, tmp_pkt, pkt_queue, list) { - packet->status = -ECANCELED; - list_del(&packet->list); - ath6kl_htc_rx_complete(endpoint, packet); - } - - return status; - } - - spin_lock_bh(&target->rx_lock); - - list_splice_tail_init(pkt_queue, &endpoint->rx_bufq); - - /* check if we are blocked waiting for a new buffer */ - if (target->rx_st_flags & HTC_RECV_WAIT_BUFFERS) { - if (target->ep_waiting == first_pkt->endpoint) { - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc rx blocked on ep %d, unblocking\n", - target->ep_waiting); - target->rx_st_flags &= ~HTC_RECV_WAIT_BUFFERS; - target->ep_waiting = ENDPOINT_MAX; - rx_unblock = true; - } - } - - spin_unlock_bh(&target->rx_lock); - - if (rx_unblock && !(target->htc_flags & HTC_OP_STATE_STOPPING)) - /* TODO : implement a buffer threshold count? */ - ath6kl_hif_rx_control(target->dev, true); - - return status; -} - -static void ath6kl_htc_mbox_flush_rx_buf(struct htc_target *target) -{ - struct htc_endpoint *endpoint; - struct htc_packet *packet, *tmp_pkt; - int i; - - for (i = ENDPOINT_0; i < ENDPOINT_MAX; i++) { - endpoint = &target->endpoint[i]; - if (!endpoint->svc_id) - /* not in use.. */ - continue; - - spin_lock_bh(&target->rx_lock); - list_for_each_entry_safe(packet, tmp_pkt, - &endpoint->rx_bufq, list) { - list_del(&packet->list); - spin_unlock_bh(&target->rx_lock); - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc rx flush pkt 0x%p len %d ep %d\n", - packet, packet->buf_len, - packet->endpoint); - /* - * packets in rx_bufq of endpoint 0 have originally - * been queued from target->free_ctrl_rxbuf where - * packet and packet->buf_start are allocated - * separately using kmalloc(). For other endpoint - * rx_bufq, it is allocated as skb where packet is - * skb->head. Take care of this difference while freeing - * the memory. - */ - if (packet->endpoint == ENDPOINT_0) { - kfree(packet->buf_start); - kfree(packet); - } else { - dev_kfree_skb(packet->pkt_cntxt); - } - spin_lock_bh(&target->rx_lock); - } - spin_unlock_bh(&target->rx_lock); - } -} - -static int ath6kl_htc_mbox_conn_service(struct htc_target *target, - struct htc_service_connect_req *conn_req, - struct htc_service_connect_resp *conn_resp) -{ - struct htc_packet *rx_pkt = NULL; - struct htc_packet *tx_pkt = NULL; - struct htc_conn_service_resp *resp_msg; - struct htc_conn_service_msg *conn_msg; - struct htc_endpoint *endpoint; - enum htc_endpoint_id assigned_ep = ENDPOINT_MAX; - unsigned int max_msg_sz = 0; - int status = 0; - u16 msg_id; - - ath6kl_dbg(ATH6KL_DBG_HTC, - "htc connect service target 0x%p service id 0x%x\n", - target, conn_req->svc_id); - - if (conn_req->svc_id == HTC_CTRL_RSVD_SVC) { - /* special case for pseudo control service */ - assigned_ep = ENDPOINT_0; - max_msg_sz = HTC_MAX_CTRL_MSG_LEN; - } else { - /* allocate a packet to send to the target */ - tx_pkt = htc_get_control_buf(target, true); - - if (!tx_pkt) - return -ENOMEM; - - conn_msg = (struct htc_conn_service_msg *)tx_pkt->buf; - memset(conn_msg, 0, sizeof(*conn_msg)); - conn_msg->msg_id = cpu_to_le16(HTC_MSG_CONN_SVC_ID); - conn_msg->svc_id = cpu_to_le16(conn_req->svc_id); - conn_msg->conn_flags = cpu_to_le16(conn_req->conn_flags); - - set_htc_pkt_info(tx_pkt, NULL, (u8 *) conn_msg, - sizeof(*conn_msg) + conn_msg->svc_meta_len, - ENDPOINT_0, HTC_SERVICE_TX_PACKET_TAG); - - /* we want synchronous operation */ - tx_pkt->completion = NULL; - ath6kl_htc_tx_prep_pkt(tx_pkt, 0, 0, 0); - status = ath6kl_htc_tx_issue(target, tx_pkt); - - if (status) - goto fail_tx; - - /* wait for response */ - rx_pkt = htc_wait_for_ctrl_msg(target); - - if (!rx_pkt) { - status = -ENOMEM; - goto fail_tx; - } - - resp_msg = (struct htc_conn_service_resp *)rx_pkt->buf; - msg_id = le16_to_cpu(resp_msg->msg_id); - - if ((msg_id != HTC_MSG_CONN_SVC_RESP_ID) || - (rx_pkt->act_len < sizeof(*resp_msg))) { - status = -ENOMEM; - goto fail_tx; - } - - conn_resp->resp_code = resp_msg->status; - /* check response status */ - if (resp_msg->status != HTC_SERVICE_SUCCESS) { - ath6kl_err("target failed service 0x%X connect request (status:%d)\n", - resp_msg->svc_id, resp_msg->status); - status = -ENOMEM; - goto fail_tx; - } - - assigned_ep = (enum htc_endpoint_id)resp_msg->eid; - max_msg_sz = le16_to_cpu(resp_msg->max_msg_sz); - } - - if (WARN_ON_ONCE(assigned_ep == ENDPOINT_UNUSED || - assigned_ep >= ENDPOINT_MAX || !max_msg_sz)) { - status = -ENOMEM; - goto fail_tx; - } - - endpoint = &target->endpoint[assigned_ep]; - endpoint->eid = assigned_ep; - if (endpoint->svc_id) { - status = -ENOMEM; - goto fail_tx; - } - - /* return assigned endpoint to caller */ - conn_resp->endpoint = assigned_ep; - conn_resp->len_max = max_msg_sz; - - /* setup the endpoint */ - - /* this marks the endpoint in use */ - endpoint->svc_id = conn_req->svc_id; - - endpoint->max_txq_depth = conn_req->max_txq_depth; - endpoint->len_max = max_msg_sz; - endpoint->ep_cb = conn_req->ep_cb; - endpoint->cred_dist.svc_id = conn_req->svc_id; - endpoint->cred_dist.htc_ep = endpoint; - endpoint->cred_dist.endpoint = assigned_ep; - endpoint->cred_dist.cred_sz = target->tgt_cred_sz; - - switch (endpoint->svc_id) { - case WMI_DATA_BK_SVC: - endpoint->tx_drop_packet_threshold = MAX_DEF_COOKIE_NUM / 3; - break; - default: - endpoint->tx_drop_packet_threshold = MAX_HI_COOKIE_NUM; - break; - } - - if (conn_req->max_rxmsg_sz) { - /* - * Override cred_per_msg calculation, this optimizes - * the credit-low indications since the host will actually - * issue smaller messages in the Send path. - */ - if (conn_req->max_rxmsg_sz > max_msg_sz) { - status = -ENOMEM; - goto fail_tx; - } - endpoint->cred_dist.cred_per_msg = - conn_req->max_rxmsg_sz / target->tgt_cred_sz; - } else - endpoint->cred_dist.cred_per_msg = - max_msg_sz / target->tgt_cred_sz; - - if (!endpoint->cred_dist.cred_per_msg) - endpoint->cred_dist.cred_per_msg = 1; - - /* save local connection flags */ - endpoint->conn_flags = conn_req->flags; - -fail_tx: - if (tx_pkt) - htc_reclaim_txctrl_buf(target, tx_pkt); - - if (rx_pkt) { - htc_rxpkt_reset(rx_pkt); - reclaim_rx_ctrl_buf(target, rx_pkt); - } - - return status; -} - -static void reset_ep_state(struct htc_target *target) -{ - struct htc_endpoint *endpoint; - int i; - - for (i = ENDPOINT_0; i < ENDPOINT_MAX; i++) { - endpoint = &target->endpoint[i]; - memset(&endpoint->cred_dist, 0, sizeof(endpoint->cred_dist)); - endpoint->svc_id = 0; - endpoint->len_max = 0; - endpoint->max_txq_depth = 0; - memset(&endpoint->ep_st, 0, - sizeof(endpoint->ep_st)); - INIT_LIST_HEAD(&endpoint->rx_bufq); - INIT_LIST_HEAD(&endpoint->txq); - endpoint->target = target; - } - - /* reset distribution list */ - /* FIXME: free existing entries */ - INIT_LIST_HEAD(&target->cred_dist_list); -} - -static int ath6kl_htc_mbox_get_rxbuf_num(struct htc_target *target, - enum htc_endpoint_id endpoint) -{ - int num; - - spin_lock_bh(&target->rx_lock); - num = get_queue_depth(&(target->endpoint[endpoint].rx_bufq)); - spin_unlock_bh(&target->rx_lock); - return num; -} - -static void htc_setup_msg_bndl(struct htc_target *target) -{ - /* limit what HTC can handle */ - target->msg_per_bndl_max = min(HTC_HOST_MAX_MSG_PER_BUNDLE, - target->msg_per_bndl_max); - - if (ath6kl_hif_enable_scatter(target->dev->ar)) { - target->msg_per_bndl_max = 0; - return; - } - - /* limit bundle what the device layer can handle */ - target->msg_per_bndl_max = min(target->max_scat_entries, - target->msg_per_bndl_max); - - ath6kl_dbg(ATH6KL_DBG_BOOT, - "htc bundling allowed msg_per_bndl_max %d\n", - target->msg_per_bndl_max); - - /* Max rx bundle size is limited by the max tx bundle size */ - target->max_rx_bndl_sz = target->max_xfer_szper_scatreq; - /* Max tx bundle size if limited by the extended mbox address range */ - target->max_tx_bndl_sz = min(HIF_MBOX0_EXT_WIDTH, - target->max_xfer_szper_scatreq); - - ath6kl_dbg(ATH6KL_DBG_BOOT, "htc max_rx_bndl_sz %d max_tx_bndl_sz %d\n", - target->max_rx_bndl_sz, target->max_tx_bndl_sz); - - if (target->max_tx_bndl_sz) - /* tx_bndl_mask is enabled per AC, each has 1 bit */ - target->tx_bndl_mask = (1 << WMM_NUM_AC) - 1; - - if (target->max_rx_bndl_sz) - target->rx_bndl_enable = true; - - if ((target->tgt_cred_sz % target->block_sz) != 0) { - ath6kl_warn("credit size: %d is not block aligned! Disabling send bundling\n", - target->tgt_cred_sz); - - /* - * Disallow send bundling since the credit size is - * not aligned to a block size the I/O block - * padding will spill into the next credit buffer - * which is fatal. - */ - target->tx_bndl_mask = 0; - } -} - -static int ath6kl_htc_mbox_wait_target(struct htc_target *target) -{ - struct htc_packet *packet = NULL; - struct htc_ready_ext_msg *rdy_msg; - struct htc_service_connect_req connect; - struct htc_service_connect_resp resp; - int status; - - /* we should be getting 1 control message that the target is ready */ - packet = htc_wait_for_ctrl_msg(target); - - if (!packet) - return -ENOMEM; - - /* we controlled the buffer creation so it's properly aligned */ - rdy_msg = (struct htc_ready_ext_msg *)packet->buf; - - if ((le16_to_cpu(rdy_msg->ver2_0_info.msg_id) != HTC_MSG_READY_ID) || - (packet->act_len < sizeof(struct htc_ready_msg))) { - status = -ENOMEM; - goto fail_wait_target; - } - - if (!rdy_msg->ver2_0_info.cred_cnt || !rdy_msg->ver2_0_info.cred_sz) { - status = -ENOMEM; - goto fail_wait_target; - } - - target->tgt_creds = le16_to_cpu(rdy_msg->ver2_0_info.cred_cnt); - target->tgt_cred_sz = le16_to_cpu(rdy_msg->ver2_0_info.cred_sz); - - ath6kl_dbg(ATH6KL_DBG_BOOT, - "htc target ready credits %d size %d\n", - target->tgt_creds, target->tgt_cred_sz); - - /* check if this is an extended ready message */ - if (packet->act_len >= sizeof(struct htc_ready_ext_msg)) { - /* this is an extended message */ - target->htc_tgt_ver = rdy_msg->htc_ver; - target->msg_per_bndl_max = rdy_msg->msg_per_htc_bndl; - } else { - /* legacy */ - target->htc_tgt_ver = HTC_VERSION_2P0; - target->msg_per_bndl_max = 0; - } - - ath6kl_dbg(ATH6KL_DBG_BOOT, "htc using protocol %s (%d)\n", - (target->htc_tgt_ver == HTC_VERSION_2P0) ? "2.0" : ">= 2.1", - target->htc_tgt_ver); - - if (target->msg_per_bndl_max > 0) - htc_setup_msg_bndl(target); - - /* setup our pseudo HTC control endpoint connection */ - memset(&connect, 0, sizeof(connect)); - memset(&resp, 0, sizeof(resp)); - connect.ep_cb.rx = htc_ctrl_rx; - connect.ep_cb.rx_refill = NULL; - connect.ep_cb.tx_full = NULL; - connect.max_txq_depth = NUM_CONTROL_BUFFERS; - connect.svc_id = HTC_CTRL_RSVD_SVC; - - /* connect fake service */ - status = ath6kl_htc_mbox_conn_service((void *)target, &connect, &resp); - - if (status) - /* - * FIXME: this call doesn't make sense, the caller should - * call ath6kl_htc_mbox_cleanup() when it wants remove htc - */ - ath6kl_hif_cleanup_scatter(target->dev->ar); - -fail_wait_target: - if (packet) { - htc_rxpkt_reset(packet); - reclaim_rx_ctrl_buf(target, packet); - } - - return status; -} - -/* - * Start HTC, enable interrupts and let the target know - * host has finished setup. - */ -static int ath6kl_htc_mbox_start(struct htc_target *target) -{ - struct htc_packet *packet; - int status; - - memset(&target->dev->irq_proc_reg, 0, - sizeof(target->dev->irq_proc_reg)); - - /* Disable interrupts at the chip level */ - ath6kl_hif_disable_intrs(target->dev); - - target->htc_flags = 0; - target->rx_st_flags = 0; - - /* Push control receive buffers into htc control endpoint */ - while ((packet = htc_get_control_buf(target, false)) != NULL) { - status = htc_add_rxbuf(target, packet); - if (status) - return status; - } - - /* NOTE: the first entry in the distribution list is ENDPOINT_0 */ - ath6kl_credit_init(target->credit_info, &target->cred_dist_list, - target->tgt_creds); - - dump_cred_dist_stats(target); - - /* Indicate to the target of the setup completion */ - status = htc_setup_tx_complete(target); - - if (status) - return status; - - /* unmask interrupts */ - status = ath6kl_hif_unmask_intrs(target->dev); - - if (status) - ath6kl_htc_mbox_stop(target); - - return status; -} - -static int ath6kl_htc_reset(struct htc_target *target) -{ - u32 block_size, ctrl_bufsz; - struct htc_packet *packet; - int i; - - reset_ep_state(target); - - block_size = target->dev->ar->mbox_info.block_size; - - ctrl_bufsz = (block_size > HTC_MAX_CTRL_MSG_LEN) ? - (block_size + HTC_HDR_LENGTH) : - (HTC_MAX_CTRL_MSG_LEN + HTC_HDR_LENGTH); - - for (i = 0; i < NUM_CONTROL_BUFFERS; i++) { - packet = kzalloc(sizeof(*packet), GFP_KERNEL); - if (!packet) - return -ENOMEM; - - packet->buf_start = kzalloc(ctrl_bufsz, GFP_KERNEL); - if (!packet->buf_start) { - kfree(packet); - return -ENOMEM; - } - - packet->buf_len = ctrl_bufsz; - if (i < NUM_CONTROL_RX_BUFFERS) { - packet->act_len = 0; - packet->buf = packet->buf_start; - packet->endpoint = ENDPOINT_0; - list_add_tail(&packet->list, &target->free_ctrl_rxbuf); - } else - list_add_tail(&packet->list, &target->free_ctrl_txbuf); - } - - return 0; -} - -/* htc_stop: stop interrupt reception, and flush all queued buffers */ -static void ath6kl_htc_mbox_stop(struct htc_target *target) -{ - spin_lock_bh(&target->htc_lock); - target->htc_flags |= HTC_OP_STATE_STOPPING; - spin_unlock_bh(&target->htc_lock); - - /* - * Masking interrupts is a synchronous operation, when this - * function returns all pending HIF I/O has completed, we can - * safely flush the queues. - */ - ath6kl_hif_mask_intrs(target->dev); - - ath6kl_htc_flush_txep_all(target); - - ath6kl_htc_mbox_flush_rx_buf(target); - - ath6kl_htc_reset(target); -} - -static void *ath6kl_htc_mbox_create(struct ath6kl *ar) -{ - struct htc_target *target = NULL; - int status = 0; - - target = kzalloc(sizeof(*target), GFP_KERNEL); - if (!target) { - ath6kl_err("unable to allocate memory\n"); - return NULL; - } - - target->dev = kzalloc(sizeof(*target->dev), GFP_KERNEL); - if (!target->dev) { - ath6kl_err("unable to allocate memory\n"); - status = -ENOMEM; - goto err_htc_cleanup; - } - - spin_lock_init(&target->htc_lock); - spin_lock_init(&target->rx_lock); - spin_lock_init(&target->tx_lock); - - INIT_LIST_HEAD(&target->free_ctrl_txbuf); - INIT_LIST_HEAD(&target->free_ctrl_rxbuf); - INIT_LIST_HEAD(&target->cred_dist_list); - - target->dev->ar = ar; - target->dev->htc_cnxt = target; - target->ep_waiting = ENDPOINT_MAX; - - status = ath6kl_hif_setup(target->dev); - if (status) - goto err_htc_cleanup; - - status = ath6kl_htc_reset(target); - if (status) - goto err_htc_cleanup; - - return target; - -err_htc_cleanup: - ath6kl_htc_mbox_cleanup(target); - - return NULL; -} - -/* cleanup the HTC instance */ -static void ath6kl_htc_mbox_cleanup(struct htc_target *target) -{ - struct htc_packet *packet, *tmp_packet; - - ath6kl_hif_cleanup_scatter(target->dev->ar); - - list_for_each_entry_safe(packet, tmp_packet, - &target->free_ctrl_txbuf, list) { - list_del(&packet->list); - kfree(packet->buf_start); - kfree(packet); - } - - list_for_each_entry_safe(packet, tmp_packet, - &target->free_ctrl_rxbuf, list) { - list_del(&packet->list); - kfree(packet->buf_start); - kfree(packet); - } - - kfree(target->dev); - kfree(target); -} - -static const struct ath6kl_htc_ops ath6kl_htc_mbox_ops = { - .create = ath6kl_htc_mbox_create, - .wait_target = ath6kl_htc_mbox_wait_target, - .start = ath6kl_htc_mbox_start, - .conn_service = ath6kl_htc_mbox_conn_service, - .tx = ath6kl_htc_mbox_tx, - .stop = ath6kl_htc_mbox_stop, - .cleanup = ath6kl_htc_mbox_cleanup, - .flush_txep = ath6kl_htc_mbox_flush_txep, - .flush_rx_buf = ath6kl_htc_mbox_flush_rx_buf, - .activity_changed = ath6kl_htc_mbox_activity_changed, - .get_rxbuf_num = ath6kl_htc_mbox_get_rxbuf_num, - .add_rxbuf_multiple = ath6kl_htc_mbox_add_rxbuf_multiple, - .credit_setup = ath6kl_htc_mbox_credit_setup, -}; - -void ath6kl_htc_mbox_attach(struct ath6kl *ar) -{ - ar->htc_ops = &ath6kl_htc_mbox_ops; -} diff --git a/drivers/net/wireless/ath/ath6kl/htc_pipe.c b/drivers/net/wireless/ath/ath6kl/htc_pipe.c deleted file mode 100644 index 67aa924ed8b3..000000000000 --- a/drivers/net/wireless/ath/ath6kl/htc_pipe.c +++ /dev/null @@ -1,1719 +0,0 @@ -/* - * Copyright (c) 2007-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "core.h" -#include "debug.h" -#include "hif-ops.h" - -#define HTC_PACKET_CONTAINER_ALLOCATION 32 -#define HTC_CONTROL_BUFFER_SIZE (HTC_MAX_CTRL_MSG_LEN + HTC_HDR_LENGTH) - -static int ath6kl_htc_pipe_tx(struct htc_target *handle, - struct htc_packet *packet); -static void ath6kl_htc_pipe_cleanup(struct htc_target *handle); - -/* htc pipe tx path */ -static inline void restore_tx_packet(struct htc_packet *packet) -{ - if (packet->info.tx.flags & HTC_FLAGS_TX_FIXUP_NETBUF) { - skb_pull(packet->skb, sizeof(struct htc_frame_hdr)); - packet->info.tx.flags &= ~HTC_FLAGS_TX_FIXUP_NETBUF; - } -} - -static void do_send_completion(struct htc_endpoint *ep, - struct list_head *queue_to_indicate) -{ - struct htc_packet *packet; - - if (list_empty(queue_to_indicate)) { - /* nothing to indicate */ - return; - } - - if (ep->ep_cb.tx_comp_multi != NULL) { - ath6kl_dbg(ATH6KL_DBG_HTC, - "%s: calling ep %d, send complete multiple callback (%d pkts)\n", - __func__, ep->eid, - get_queue_depth(queue_to_indicate)); - /* - * a multiple send complete handler is being used, - * pass the queue to the handler - */ - ep->ep_cb.tx_comp_multi(ep->target, queue_to_indicate); - /* - * all packets are now owned by the callback, - * reset queue to be safe - */ - INIT_LIST_HEAD(queue_to_indicate); - } else { - /* using legacy EpTxComplete */ - do { - packet = list_first_entry(queue_to_indicate, - struct htc_packet, list); - - list_del(&packet->list); - ath6kl_dbg(ATH6KL_DBG_HTC, - "%s: calling ep %d send complete callback on packet 0x%p\n", - __func__, ep->eid, packet); - ep->ep_cb.tx_complete(ep->target, packet); - } while (!list_empty(queue_to_indicate)); - } -} - -static void send_packet_completion(struct htc_target *target, - struct htc_packet *packet) -{ - struct htc_endpoint *ep = &target->endpoint[packet->endpoint]; - struct list_head container; - - restore_tx_packet(packet); - INIT_LIST_HEAD(&container); - list_add_tail(&packet->list, &container); - - /* do completion */ - do_send_completion(ep, &container); -} - -static void get_htc_packet_credit_based(struct htc_target *target, - struct htc_endpoint *ep, - struct list_head *queue) -{ - int credits_required; - int remainder; - u8 send_flags; - struct htc_packet *packet; - unsigned int transfer_len; - - /* NOTE : the TX lock is held when this function is called */ - - /* loop until we can grab as many packets out of the queue as we can */ - while (true) { - send_flags = 0; - if (list_empty(&ep->txq)) - break; - - /* get packet at head, but don't remove it */ - packet = list_first_entry(&ep->txq, struct htc_packet, list); - - ath6kl_dbg(ATH6KL_DBG_HTC, - "%s: got head packet:0x%p , queue depth: %d\n", - __func__, packet, get_queue_depth(&ep->txq)); - - transfer_len = packet->act_len + HTC_HDR_LENGTH; - - if (transfer_len <= target->tgt_cred_sz) { - credits_required = 1; - } else { - /* figure out how many credits this message requires */ - credits_required = transfer_len / target->tgt_cred_sz; - remainder = transfer_len % target->tgt_cred_sz; - - if (remainder) - credits_required++; - } - - ath6kl_dbg(ATH6KL_DBG_HTC, "%s: creds required:%d got:%d\n", - __func__, credits_required, ep->cred_dist.credits); - - if (ep->eid == ENDPOINT_0) { - /* - * endpoint 0 is special, it always has a credit and - * does not require credit based flow control - */ - credits_required = 0; - - } else { - - if (ep->cred_dist.credits < credits_required) - break; - - ep->cred_dist.credits -= credits_required; - ep->ep_st.cred_cosumd += credits_required; - - /* check if we need credits back from the target */ - if (ep->cred_dist.credits < - ep->cred_dist.cred_per_msg) { - /* tell the target we need credits ASAP! */ - send_flags |= HTC_FLAGS_NEED_CREDIT_UPDATE; - ep->ep_st.cred_low_indicate += 1; - ath6kl_dbg(ATH6KL_DBG_HTC, - "%s: host needs credits\n", - __func__); - } - } - - /* now we can fully dequeue */ - packet = list_first_entry(&ep->txq, struct htc_packet, list); - - list_del(&packet->list); - /* save the number of credits this packet consumed */ - packet->info.tx.cred_used = credits_required; - /* save send flags */ - packet->info.tx.flags = send_flags; - packet->info.tx.seqno = ep->seqno; - ep->seqno++; - /* queue this packet into the caller's queue */ - list_add_tail(&packet->list, queue); - } - -} - -static void get_htc_packet(struct htc_target *target, - struct htc_endpoint *ep, - struct list_head *queue, int resources) -{ - struct htc_packet *packet; - - /* NOTE : the TX lock is held when this function is called */ - - /* loop until we can grab as many packets out of the queue as we can */ - while (resources) { - if (list_empty(&ep->txq)) - break; - - packet = list_first_entry(&ep->txq, struct htc_packet, list); - list_del(&packet->list); - - ath6kl_dbg(ATH6KL_DBG_HTC, - "%s: got packet:0x%p , new queue depth: %d\n", - __func__, packet, get_queue_depth(&ep->txq)); - packet->info.tx.seqno = ep->seqno; - packet->info.tx.flags = 0; - packet->info.tx.cred_used = 0; - ep->seqno++; - - /* queue this packet into the caller's queue */ - list_add_tail(&packet->list, queue); - resources--; - } -} - -static int htc_issue_packets(struct htc_target *target, - struct htc_endpoint *ep, - struct list_head *pkt_queue) -{ - int status = 0; - u16 payload_len; - struct sk_buff *skb; - struct htc_frame_hdr *htc_hdr; - struct htc_packet *packet; - - ath6kl_dbg(ATH6KL_DBG_HTC, - "%s: queue: 0x%p, pkts %d\n", __func__, - pkt_queue, get_queue_depth(pkt_queue)); - - while (!list_empty(pkt_queue)) { - packet = list_first_entry(pkt_queue, struct htc_packet, list); - list_del(&packet->list); - - skb = packet->skb; - if (!skb) { - WARN_ON_ONCE(1); - status = -EINVAL; - break; - } - - payload_len = packet->act_len; - - /* setup HTC frame header */ - htc_hdr = (struct htc_frame_hdr *) skb_push(skb, - sizeof(*htc_hdr)); - if (!htc_hdr) { - WARN_ON_ONCE(1); - status = -EINVAL; - break; - } - - packet->info.tx.flags |= HTC_FLAGS_TX_FIXUP_NETBUF; - - /* Endianess? */ - put_unaligned((u16) payload_len, &htc_hdr->payld_len); - htc_hdr->flags = packet->info.tx.flags; - htc_hdr->eid = (u8) packet->endpoint; - htc_hdr->ctrl[0] = 0; - htc_hdr->ctrl[1] = (u8) packet->info.tx.seqno; - - spin_lock_bh(&target->tx_lock); - - /* store in look up queue to match completions */ - list_add_tail(&packet->list, &ep->pipe.tx_lookup_queue); - ep->ep_st.tx_issued += 1; - spin_unlock_bh(&target->tx_lock); - - status = ath6kl_hif_pipe_send(target->dev->ar, - ep->pipe.pipeid_ul, NULL, skb); - - if (status != 0) { - if (status != -ENOMEM) { - /* TODO: if more than 1 endpoint maps to the - * same PipeID, it is possible to run out of - * resources in the HIF layer. - * Don't emit the error - */ - ath6kl_dbg(ATH6KL_DBG_HTC, - "%s: failed status:%d\n", - __func__, status); - } - spin_lock_bh(&target->tx_lock); - list_del(&packet->list); - - /* reclaim credits */ - ep->cred_dist.credits += packet->info.tx.cred_used; - spin_unlock_bh(&target->tx_lock); - - /* put it back into the callers queue */ - list_add(&packet->list, pkt_queue); - break; - } - - } - - if (status != 0) { - while (!list_empty(pkt_queue)) { - if (status != -ENOMEM) { - ath6kl_dbg(ATH6KL_DBG_HTC, - "%s: failed pkt:0x%p status:%d\n", - __func__, packet, status); - } - - packet = list_first_entry(pkt_queue, - struct htc_packet, list); - list_del(&packet->list); - packet->status = status; - send_packet_completion(target, packet); - } - } - - return status; -} - -static enum htc_send_queue_result htc_try_send(struct htc_target *target, - struct htc_endpoint *ep, - struct list_head *txq) -{ - struct list_head send_queue; /* temp queue to hold packets */ - struct htc_packet *packet, *tmp_pkt; - struct ath6kl *ar = target->dev->ar; - enum htc_send_full_action action; - int tx_resources, overflow, txqueue_depth, i, good_pkts; - u8 pipeid; - - ath6kl_dbg(ATH6KL_DBG_HTC, "%s: (queue:0x%p depth:%d)\n", - __func__, txq, - (txq == NULL) ? 0 : get_queue_depth(txq)); - - /* init the local send queue */ - INIT_LIST_HEAD(&send_queue); - - /* - * txq equals to NULL means - * caller didn't provide a queue, just wants us to - * check queues and send - */ - if (txq != NULL) { - if (list_empty(txq)) { - /* empty queue */ - return HTC_SEND_QUEUE_DROP; - } - - spin_lock_bh(&target->tx_lock); - txqueue_depth = get_queue_depth(&ep->txq); - spin_unlock_bh(&target->tx_lock); - - if (txqueue_depth >= ep->max_txq_depth) { - /* we've already overflowed */ - overflow = get_queue_depth(txq); - } else { - /* get how much we will overflow by */ - overflow = txqueue_depth; - overflow += get_queue_depth(txq); - /* get how much we will overflow the TX queue by */ - overflow -= ep->max_txq_depth; - } - - /* if overflow is negative or zero, we are okay */ - if (overflow > 0) { - ath6kl_dbg(ATH6KL_DBG_HTC, - "%s: Endpoint %d, TX queue will overflow :%d, Tx Depth:%d, Max:%d\n", - __func__, ep->eid, overflow, txqueue_depth, - ep->max_txq_depth); - } - if ((overflow <= 0) || - (ep->ep_cb.tx_full == NULL)) { - /* - * all packets will fit or caller did not provide send - * full indication handler -- just move all of them - * to the local send_queue object - */ - list_splice_tail_init(txq, &send_queue); - } else { - good_pkts = get_queue_depth(txq) - overflow; - if (good_pkts < 0) { - WARN_ON_ONCE(1); - return HTC_SEND_QUEUE_DROP; - } - - /* we have overflowed, and a callback is provided */ - /* dequeue all non-overflow packets to the sendqueue */ - for (i = 0; i < good_pkts; i++) { - /* pop off caller's queue */ - packet = list_first_entry(txq, - struct htc_packet, - list); - /* move to local queue */ - list_move_tail(&packet->list, &send_queue); - } - - /* - * the caller's queue has all the packets that won't fit - * walk through the caller's queue and indicate each to - * the send full handler - */ - list_for_each_entry_safe(packet, tmp_pkt, - txq, list) { - - ath6kl_dbg(ATH6KL_DBG_HTC, - "%s: Indicat overflowed TX pkts: %p\n", - __func__, packet); - action = ep->ep_cb.tx_full(ep->target, packet); - if (action == HTC_SEND_FULL_DROP) { - /* callback wants the packet dropped */ - ep->ep_st.tx_dropped += 1; - - /* leave this one in the caller's queue - * for cleanup */ - } else { - /* callback wants to keep this packet, - * move from caller's queue to the send - * queue */ - list_move_tail(&packet->list, - &send_queue); - } - - } - - if (list_empty(&send_queue)) { - /* no packets made it in, caller will cleanup */ - return HTC_SEND_QUEUE_DROP; - } - } - } - - if (!ep->pipe.tx_credit_flow_enabled) { - tx_resources = - ath6kl_hif_pipe_get_free_queue_number(ar, - ep->pipe.pipeid_ul); - } else { - tx_resources = 0; - } - - spin_lock_bh(&target->tx_lock); - if (!list_empty(&send_queue)) { - /* transfer packets to tail */ - list_splice_tail_init(&send_queue, &ep->txq); - if (!list_empty(&send_queue)) { - WARN_ON_ONCE(1); - spin_unlock_bh(&target->tx_lock); - return HTC_SEND_QUEUE_DROP; - } - INIT_LIST_HEAD(&send_queue); - } - - /* increment tx processing count on entry */ - ep->tx_proc_cnt++; - - if (ep->tx_proc_cnt > 1) { - /* - * Another thread or task is draining the TX queues on this - * endpoint that thread will reset the tx processing count - * when the queue is drained. - */ - ep->tx_proc_cnt--; - spin_unlock_bh(&target->tx_lock); - return HTC_SEND_QUEUE_OK; - } - - /***** beyond this point only 1 thread may enter ******/ - - /* - * Now drain the endpoint TX queue for transmission as long as we have - * enough transmit resources. - */ - while (true) { - - if (get_queue_depth(&ep->txq) == 0) - break; - - if (ep->pipe.tx_credit_flow_enabled) { - /* - * Credit based mechanism provides flow control - * based on target transmit resource availability, - * we assume that the HIF layer will always have - * bus resources greater than target transmit - * resources. - */ - get_htc_packet_credit_based(target, ep, &send_queue); - } else { - /* - * Get all packets for this endpoint that we can - * for this pass. - */ - get_htc_packet(target, ep, &send_queue, tx_resources); - } - - if (get_queue_depth(&send_queue) == 0) { - /* - * Didn't get packets due to out of resources or TX - * queue was drained. - */ - break; - } - - spin_unlock_bh(&target->tx_lock); - - /* send what we can */ - htc_issue_packets(target, ep, &send_queue); - - if (!ep->pipe.tx_credit_flow_enabled) { - pipeid = ep->pipe.pipeid_ul; - tx_resources = - ath6kl_hif_pipe_get_free_queue_number(ar, pipeid); - } - - spin_lock_bh(&target->tx_lock); - - } - /* done with this endpoint, we can clear the count */ - ep->tx_proc_cnt = 0; - spin_unlock_bh(&target->tx_lock); - - return HTC_SEND_QUEUE_OK; -} - -/* htc control packet manipulation */ -static void destroy_htc_txctrl_packet(struct htc_packet *packet) -{ - struct sk_buff *skb; - skb = packet->skb; - dev_kfree_skb(skb); - kfree(packet); -} - -static struct htc_packet *build_htc_txctrl_packet(void) -{ - struct htc_packet *packet = NULL; - struct sk_buff *skb; - - packet = kzalloc(sizeof(struct htc_packet), GFP_KERNEL); - if (packet == NULL) - return NULL; - - skb = __dev_alloc_skb(HTC_CONTROL_BUFFER_SIZE, GFP_KERNEL); - - if (skb == NULL) { - kfree(packet); - return NULL; - } - packet->skb = skb; - - return packet; -} - -static void htc_free_txctrl_packet(struct htc_target *target, - struct htc_packet *packet) -{ - destroy_htc_txctrl_packet(packet); -} - -static struct htc_packet *htc_alloc_txctrl_packet(struct htc_target *target) -{ - return build_htc_txctrl_packet(); -} - -static void htc_txctrl_complete(struct htc_target *target, - struct htc_packet *packet) -{ - htc_free_txctrl_packet(target, packet); -} - -#define MAX_MESSAGE_SIZE 1536 - -static int htc_setup_target_buffer_assignments(struct htc_target *target) -{ - int status, credits, credit_per_maxmsg, i; - struct htc_pipe_txcredit_alloc *entry; - unsigned int hif_usbaudioclass = 0; - - credit_per_maxmsg = MAX_MESSAGE_SIZE / target->tgt_cred_sz; - if (MAX_MESSAGE_SIZE % target->tgt_cred_sz) - credit_per_maxmsg++; - - /* TODO, this should be configured by the caller! */ - - credits = target->tgt_creds; - entry = &target->pipe.txcredit_alloc[0]; - - status = -ENOMEM; - - /* FIXME: hif_usbaudioclass is always zero */ - if (hif_usbaudioclass) { - ath6kl_dbg(ATH6KL_DBG_HTC, - "%s: For USB Audio Class- Total:%d\n", - __func__, credits); - entry++; - entry++; - /* Setup VO Service To have Max Credits */ - entry->service_id = WMI_DATA_VO_SVC; - entry->credit_alloc = (credits - 6); - if (entry->credit_alloc == 0) - entry->credit_alloc++; - - credits -= (int) entry->credit_alloc; - if (credits <= 0) - return status; - - entry++; - entry->service_id = WMI_CONTROL_SVC; - entry->credit_alloc = credit_per_maxmsg; - credits -= (int) entry->credit_alloc; - if (credits <= 0) - return status; - - /* leftovers go to best effort */ - entry++; - entry++; - entry->service_id = WMI_DATA_BE_SVC; - entry->credit_alloc = (u8) credits; - status = 0; - } else { - entry++; - entry->service_id = WMI_DATA_VI_SVC; - entry->credit_alloc = credits / 4; - if (entry->credit_alloc == 0) - entry->credit_alloc++; - - credits -= (int) entry->credit_alloc; - if (credits <= 0) - return status; - - entry++; - entry->service_id = WMI_DATA_VO_SVC; - entry->credit_alloc = credits / 4; - if (entry->credit_alloc == 0) - entry->credit_alloc++; - - credits -= (int) entry->credit_alloc; - if (credits <= 0) - return status; - - entry++; - entry->service_id = WMI_CONTROL_SVC; - entry->credit_alloc = credit_per_maxmsg; - credits -= (int) entry->credit_alloc; - if (credits <= 0) - return status; - - entry++; - entry->service_id = WMI_DATA_BK_SVC; - entry->credit_alloc = credit_per_maxmsg; - credits -= (int) entry->credit_alloc; - if (credits <= 0) - return status; - - /* leftovers go to best effort */ - entry++; - entry->service_id = WMI_DATA_BE_SVC; - entry->credit_alloc = (u8) credits; - status = 0; - } - - if (status == 0) { - for (i = 0; i < ENDPOINT_MAX; i++) { - if (target->pipe.txcredit_alloc[i].service_id != 0) { - ath6kl_dbg(ATH6KL_DBG_HTC, - "HTC Service Index : %d TX : 0x%2.2X : alloc:%d\n", - i, - target->pipe.txcredit_alloc[i]. - service_id, - target->pipe.txcredit_alloc[i]. - credit_alloc); - } - } - } - return status; -} - -/* process credit reports and call distribution function */ -static void htc_process_credit_report(struct htc_target *target, - struct htc_credit_report *rpt, - int num_entries, - enum htc_endpoint_id from_ep) -{ - int total_credits = 0, i; - struct htc_endpoint *ep; - - /* lock out TX while we update credits */ - spin_lock_bh(&target->tx_lock); - - for (i = 0; i < num_entries; i++, rpt++) { - if (rpt->eid >= ENDPOINT_MAX) { - WARN_ON_ONCE(1); - spin_unlock_bh(&target->tx_lock); - return; - } - - ep = &target->endpoint[rpt->eid]; - ep->cred_dist.credits += rpt->credits; - - if (ep->cred_dist.credits && get_queue_depth(&ep->txq)) { - spin_unlock_bh(&target->tx_lock); - htc_try_send(target, ep, NULL); - spin_lock_bh(&target->tx_lock); - } - - total_credits += rpt->credits; - } - ath6kl_dbg(ATH6KL_DBG_HTC, - "Report indicated %d credits to distribute\n", - total_credits); - - spin_unlock_bh(&target->tx_lock); -} - -/* flush endpoint TX queue */ -static void htc_flush_tx_endpoint(struct htc_target *target, - struct htc_endpoint *ep, u16 tag) -{ - struct htc_packet *packet; - - spin_lock_bh(&target->tx_lock); - while (get_queue_depth(&ep->txq)) { - packet = list_first_entry(&ep->txq, struct htc_packet, list); - list_del(&packet->list); - packet->status = 0; - send_packet_completion(target, packet); - } - spin_unlock_bh(&target->tx_lock); -} - -/* - * In the adapted HIF layer, struct sk_buff * are passed between HIF and HTC, - * since upper layers expects struct htc_packet containers we use the completed - * skb and lookup it's corresponding HTC packet buffer from a lookup list. - * This is extra overhead that can be fixed by re-aligning HIF interfaces with - * HTC. - */ -static struct htc_packet *htc_lookup_tx_packet(struct htc_target *target, - struct htc_endpoint *ep, - struct sk_buff *skb) -{ - struct htc_packet *packet, *tmp_pkt, *found_packet = NULL; - - spin_lock_bh(&target->tx_lock); - - /* - * interate from the front of tx lookup queue - * this lookup should be fast since lower layers completes in-order and - * so the completed packet should be at the head of the list generally - */ - list_for_each_entry_safe(packet, tmp_pkt, &ep->pipe.tx_lookup_queue, - list) { - /* check for removal */ - if (skb == packet->skb) { - /* found it */ - list_del(&packet->list); - found_packet = packet; - break; - } - } - - spin_unlock_bh(&target->tx_lock); - - return found_packet; -} - -static int ath6kl_htc_pipe_tx_complete(struct ath6kl *ar, struct sk_buff *skb) -{ - struct htc_target *target = ar->htc_target; - struct htc_frame_hdr *htc_hdr; - struct htc_endpoint *ep; - struct htc_packet *packet; - u8 ep_id, *netdata; - u32 netlen; - - netdata = skb->data; - netlen = skb->len; - - htc_hdr = (struct htc_frame_hdr *) netdata; - - ep_id = htc_hdr->eid; - ep = &target->endpoint[ep_id]; - - packet = htc_lookup_tx_packet(target, ep, skb); - if (packet == NULL) { - /* may have already been flushed and freed */ - ath6kl_err("HTC TX lookup failed!\n"); - } else { - /* will be giving this buffer back to upper layers */ - packet->status = 0; - send_packet_completion(target, packet); - } - skb = NULL; - - if (!ep->pipe.tx_credit_flow_enabled) { - /* - * note: when using TX credit flow, the re-checking of queues - * happens when credits flow back from the target. in the - * non-TX credit case, we recheck after the packet completes - */ - htc_try_send(target, ep, NULL); - } - - return 0; -} - -static int htc_send_packets_multiple(struct htc_target *target, - struct list_head *pkt_queue) -{ - struct htc_endpoint *ep; - struct htc_packet *packet, *tmp_pkt; - - if (list_empty(pkt_queue)) - return -EINVAL; - - /* get first packet to find out which ep the packets will go into */ - packet = list_first_entry(pkt_queue, struct htc_packet, list); - - if (packet->endpoint >= ENDPOINT_MAX) { - WARN_ON_ONCE(1); - return -EINVAL; - } - ep = &target->endpoint[packet->endpoint]; - - htc_try_send(target, ep, pkt_queue); - - /* do completion on any packets that couldn't get in */ - if (!list_empty(pkt_queue)) { - list_for_each_entry_safe(packet, tmp_pkt, pkt_queue, list) { - packet->status = -ENOMEM; - } - - do_send_completion(ep, pkt_queue); - } - - return 0; -} - -/* htc pipe rx path */ -static struct htc_packet *alloc_htc_packet_container(struct htc_target *target) -{ - struct htc_packet *packet; - spin_lock_bh(&target->rx_lock); - - if (target->pipe.htc_packet_pool == NULL) { - spin_unlock_bh(&target->rx_lock); - return NULL; - } - - packet = target->pipe.htc_packet_pool; - target->pipe.htc_packet_pool = (struct htc_packet *) packet->list.next; - - spin_unlock_bh(&target->rx_lock); - - packet->list.next = NULL; - return packet; -} - -static void free_htc_packet_container(struct htc_target *target, - struct htc_packet *packet) -{ - struct list_head *lh; - - spin_lock_bh(&target->rx_lock); - - if (target->pipe.htc_packet_pool == NULL) { - target->pipe.htc_packet_pool = packet; - packet->list.next = NULL; - } else { - lh = (struct list_head *) target->pipe.htc_packet_pool; - packet->list.next = lh; - target->pipe.htc_packet_pool = packet; - } - - spin_unlock_bh(&target->rx_lock); -} - -static int htc_process_trailer(struct htc_target *target, u8 *buffer, - int len, enum htc_endpoint_id from_ep) -{ - struct htc_credit_report *report; - struct htc_record_hdr *record; - u8 *record_buf, *orig_buf; - int orig_len, status; - - orig_buf = buffer; - orig_len = len; - status = 0; - - while (len > 0) { - if (len < sizeof(struct htc_record_hdr)) { - status = -EINVAL; - break; - } - - /* these are byte aligned structs */ - record = (struct htc_record_hdr *) buffer; - len -= sizeof(struct htc_record_hdr); - buffer += sizeof(struct htc_record_hdr); - - if (record->len > len) { - /* no room left in buffer for record */ - ath6kl_dbg(ATH6KL_DBG_HTC, - "invalid length: %d (id:%d) buffer has: %d bytes left\n", - record->len, record->rec_id, len); - status = -EINVAL; - break; - } - - /* start of record follows the header */ - record_buf = buffer; - - switch (record->rec_id) { - case HTC_RECORD_CREDITS: - if (record->len < sizeof(struct htc_credit_report)) { - WARN_ON_ONCE(1); - return -EINVAL; - } - - report = (struct htc_credit_report *) record_buf; - htc_process_credit_report(target, report, - record->len / sizeof(*report), - from_ep); - break; - default: - ath6kl_dbg(ATH6KL_DBG_HTC, - "unhandled record: id:%d length:%d\n", - record->rec_id, record->len); - break; - } - - if (status != 0) - break; - - /* advance buffer past this record for next time around */ - buffer += record->len; - len -= record->len; - } - - return status; -} - -static void do_recv_completion(struct htc_endpoint *ep, - struct list_head *queue_to_indicate) -{ - struct htc_packet *packet; - - if (list_empty(queue_to_indicate)) { - /* nothing to indicate */ - return; - } - - /* using legacy EpRecv */ - while (!list_empty(queue_to_indicate)) { - packet = list_first_entry(queue_to_indicate, - struct htc_packet, list); - list_del(&packet->list); - ep->ep_cb.rx(ep->target, packet); - } - - return; -} - -static void recv_packet_completion(struct htc_target *target, - struct htc_endpoint *ep, - struct htc_packet *packet) -{ - struct list_head container; - INIT_LIST_HEAD(&container); - list_add_tail(&packet->list, &container); - - /* do completion */ - do_recv_completion(ep, &container); -} - -static int ath6kl_htc_pipe_rx_complete(struct ath6kl *ar, struct sk_buff *skb, - u8 pipeid) -{ - struct htc_target *target = ar->htc_target; - u8 *netdata, *trailer, hdr_info; - struct htc_frame_hdr *htc_hdr; - u32 netlen, trailerlen = 0; - struct htc_packet *packet; - struct htc_endpoint *ep; - u16 payload_len; - int status = 0; - - /* - * ar->htc_target can be NULL due to a race condition that can occur - * during driver initialization(we do 'ath6kl_hif_power_on' before - * initializing 'ar->htc_target' via 'ath6kl_htc_create'). - * 'ath6kl_hif_power_on' assigns 'ath6kl_recv_complete' as - * usb_complete_t/callback function for 'usb_fill_bulk_urb'. - * Thus the possibility of ar->htc_target being NULL - * via ath6kl_recv_complete -> ath6kl_usb_io_comp_work. - */ - if (WARN_ON_ONCE(!target)) { - ath6kl_err("Target not yet initialized\n"); - status = -EINVAL; - goto free_skb; - } - - - netdata = skb->data; - netlen = skb->len; - - htc_hdr = (struct htc_frame_hdr *) netdata; - - if (htc_hdr->eid >= ENDPOINT_MAX) { - ath6kl_dbg(ATH6KL_DBG_HTC, - "HTC Rx: invalid EndpointID=%d\n", - htc_hdr->eid); - status = -EINVAL; - goto free_skb; - } - ep = &target->endpoint[htc_hdr->eid]; - - payload_len = le16_to_cpu(get_unaligned(&htc_hdr->payld_len)); - - if (netlen < (payload_len + HTC_HDR_LENGTH)) { - ath6kl_dbg(ATH6KL_DBG_HTC, - "HTC Rx: insufficient length, got:%d expected =%u\n", - netlen, payload_len + HTC_HDR_LENGTH); - status = -EINVAL; - goto free_skb; - } - - /* get flags to check for trailer */ - hdr_info = htc_hdr->flags; - if (hdr_info & HTC_FLG_RX_TRAILER) { - /* extract the trailer length */ - hdr_info = htc_hdr->ctrl[0]; - if ((hdr_info < sizeof(struct htc_record_hdr)) || - (hdr_info > payload_len)) { - ath6kl_dbg(ATH6KL_DBG_HTC, - "invalid header: payloadlen should be %d, CB[0]: %d\n", - payload_len, hdr_info); - status = -EINVAL; - goto free_skb; - } - - trailerlen = hdr_info; - /* process trailer after hdr/apps payload */ - trailer = (u8 *) htc_hdr + HTC_HDR_LENGTH + - payload_len - hdr_info; - status = htc_process_trailer(target, trailer, hdr_info, - htc_hdr->eid); - if (status != 0) - goto free_skb; - } - - if (((int) payload_len - (int) trailerlen) <= 0) { - /* zero length packet with trailer, just drop these */ - goto free_skb; - } - - if (htc_hdr->eid == ENDPOINT_0) { - /* handle HTC control message */ - if (target->htc_flags & HTC_OP_STATE_SETUP_COMPLETE) { - /* - * fatal: target should not send unsolicited - * messageson the endpoint 0 - */ - ath6kl_dbg(ATH6KL_DBG_HTC, - "HTC ignores Rx Ctrl after setup complete\n"); - status = -EINVAL; - goto free_skb; - } - - /* remove HTC header */ - skb_pull(skb, HTC_HDR_LENGTH); - - netdata = skb->data; - netlen = skb->len; - - spin_lock_bh(&target->rx_lock); - - target->pipe.ctrl_response_valid = true; - target->pipe.ctrl_response_len = min_t(int, netlen, - HTC_MAX_CTRL_MSG_LEN); - memcpy(target->pipe.ctrl_response_buf, netdata, - target->pipe.ctrl_response_len); - - spin_unlock_bh(&target->rx_lock); - - dev_kfree_skb(skb); - skb = NULL; - - goto free_skb; - } - - /* - * TODO: the message based HIF architecture allocates net bufs - * for recv packets since it bridges that HIF to upper layers, - * which expects HTC packets, we form the packets here - */ - packet = alloc_htc_packet_container(target); - if (packet == NULL) { - status = -ENOMEM; - goto free_skb; - } - - packet->status = 0; - packet->endpoint = htc_hdr->eid; - packet->pkt_cntxt = skb; - - /* TODO: for backwards compatibility */ - packet->buf = skb_push(skb, 0) + HTC_HDR_LENGTH; - packet->act_len = netlen - HTC_HDR_LENGTH - trailerlen; - - /* - * TODO: this is a hack because the driver layer will set the - * actual len of the skb again which will just double the len - */ - skb_trim(skb, 0); - - recv_packet_completion(target, ep, packet); - - /* recover the packet container */ - free_htc_packet_container(target, packet); - skb = NULL; - -free_skb: - dev_kfree_skb(skb); - - return status; - -} - -static void htc_flush_rx_queue(struct htc_target *target, - struct htc_endpoint *ep) -{ - struct list_head container; - struct htc_packet *packet; - - spin_lock_bh(&target->rx_lock); - - while (1) { - if (list_empty(&ep->rx_bufq)) - break; - - packet = list_first_entry(&ep->rx_bufq, - struct htc_packet, list); - list_del(&packet->list); - - spin_unlock_bh(&target->rx_lock); - packet->status = -ECANCELED; - packet->act_len = 0; - - ath6kl_dbg(ATH6KL_DBG_HTC, - "Flushing RX packet:0x%p, length:%d, ep:%d\n", - packet, packet->buf_len, - packet->endpoint); - - INIT_LIST_HEAD(&container); - list_add_tail(&packet->list, &container); - - /* give the packet back */ - do_recv_completion(ep, &container); - spin_lock_bh(&target->rx_lock); - } - - spin_unlock_bh(&target->rx_lock); -} - -/* polling routine to wait for a control packet to be received */ -static int htc_wait_recv_ctrl_message(struct htc_target *target) -{ - int count = HTC_TARGET_RESPONSE_POLL_COUNT; - - while (count > 0) { - spin_lock_bh(&target->rx_lock); - - if (target->pipe.ctrl_response_valid) { - target->pipe.ctrl_response_valid = false; - spin_unlock_bh(&target->rx_lock); - break; - } - - spin_unlock_bh(&target->rx_lock); - - count--; - - msleep_interruptible(HTC_TARGET_RESPONSE_POLL_WAIT); - } - - if (count <= 0) { - ath6kl_warn("htc pipe control receive timeout!\n"); - return -ETIMEDOUT; - } - - return 0; -} - -static void htc_rxctrl_complete(struct htc_target *context, - struct htc_packet *packet) -{ - /* TODO, can't really receive HTC control messages yet.... */ - ath6kl_dbg(ATH6KL_DBG_HTC, "%s: invalid call function\n", __func__); -} - -/* htc pipe initialization */ -static void reset_endpoint_states(struct htc_target *target) -{ - struct htc_endpoint *ep; - int i; - - for (i = ENDPOINT_0; i < ENDPOINT_MAX; i++) { - ep = &target->endpoint[i]; - ep->svc_id = 0; - ep->len_max = 0; - ep->max_txq_depth = 0; - ep->eid = i; - INIT_LIST_HEAD(&ep->txq); - INIT_LIST_HEAD(&ep->pipe.tx_lookup_queue); - INIT_LIST_HEAD(&ep->rx_bufq); - ep->target = target; - ep->pipe.tx_credit_flow_enabled = true; - } -} - -/* start HTC, this is called after all services are connected */ -static int htc_config_target_hif_pipe(struct htc_target *target) -{ - return 0; -} - -/* htc service functions */ -static u8 htc_get_credit_alloc(struct htc_target *target, u16 service_id) -{ - u8 allocation = 0; - int i; - - for (i = 0; i < ENDPOINT_MAX; i++) { - if (target->pipe.txcredit_alloc[i].service_id == service_id) - allocation = - target->pipe.txcredit_alloc[i].credit_alloc; - } - - if (allocation == 0) { - ath6kl_dbg(ATH6KL_DBG_HTC, - "HTC Service TX : 0x%2.2X : allocation is zero!\n", - service_id); - } - - return allocation; -} - -static int ath6kl_htc_pipe_conn_service(struct htc_target *target, - struct htc_service_connect_req *conn_req, - struct htc_service_connect_resp *conn_resp) -{ - struct ath6kl *ar = target->dev->ar; - struct htc_packet *packet = NULL; - struct htc_conn_service_resp *resp_msg; - struct htc_conn_service_msg *conn_msg; - enum htc_endpoint_id assigned_epid = ENDPOINT_MAX; - bool disable_credit_flowctrl = false; - unsigned int max_msg_size = 0; - struct htc_endpoint *ep; - int length, status = 0; - struct sk_buff *skb; - u8 tx_alloc; - u16 flags; - - if (conn_req->svc_id == 0) { - WARN_ON_ONCE(1); - status = -EINVAL; - goto free_packet; - } - - if (conn_req->svc_id == HTC_CTRL_RSVD_SVC) { - /* special case for pseudo control service */ - assigned_epid = ENDPOINT_0; - max_msg_size = HTC_MAX_CTRL_MSG_LEN; - tx_alloc = 0; - - } else { - - tx_alloc = htc_get_credit_alloc(target, conn_req->svc_id); - if (tx_alloc == 0) { - status = -ENOMEM; - goto free_packet; - } - - /* allocate a packet to send to the target */ - packet = htc_alloc_txctrl_packet(target); - - if (packet == NULL) { - WARN_ON_ONCE(1); - status = -ENOMEM; - goto free_packet; - } - - skb = packet->skb; - length = sizeof(struct htc_conn_service_msg); - - /* assemble connect service message */ - conn_msg = (struct htc_conn_service_msg *) skb_put(skb, - length); - if (conn_msg == NULL) { - WARN_ON_ONCE(1); - status = -EINVAL; - goto free_packet; - } - - memset(conn_msg, 0, - sizeof(struct htc_conn_service_msg)); - conn_msg->msg_id = cpu_to_le16(HTC_MSG_CONN_SVC_ID); - conn_msg->svc_id = cpu_to_le16(conn_req->svc_id); - conn_msg->conn_flags = cpu_to_le16(conn_req->conn_flags & - ~HTC_CONN_FLGS_SET_RECV_ALLOC_MASK); - - /* tell target desired recv alloc for this ep */ - flags = tx_alloc << HTC_CONN_FLGS_SET_RECV_ALLOC_SHIFT; - conn_msg->conn_flags |= cpu_to_le16(flags); - - if (conn_req->conn_flags & - HTC_CONN_FLGS_DISABLE_CRED_FLOW_CTRL) { - disable_credit_flowctrl = true; - } - - set_htc_pkt_info(packet, NULL, (u8 *) conn_msg, - length, - ENDPOINT_0, HTC_SERVICE_TX_PACKET_TAG); - - status = ath6kl_htc_pipe_tx(target, packet); - - /* we don't own it anymore */ - packet = NULL; - if (status != 0) - goto free_packet; - - /* wait for response */ - status = htc_wait_recv_ctrl_message(target); - if (status != 0) - goto free_packet; - - /* we controlled the buffer creation so it has to be - * properly aligned - */ - resp_msg = (struct htc_conn_service_resp *) - target->pipe.ctrl_response_buf; - - if (resp_msg->msg_id != cpu_to_le16(HTC_MSG_CONN_SVC_RESP_ID) || - (target->pipe.ctrl_response_len < sizeof(*resp_msg))) { - /* this message is not valid */ - WARN_ON_ONCE(1); - status = -EINVAL; - goto free_packet; - } - - ath6kl_dbg(ATH6KL_DBG_TRC, - "%s: service 0x%X conn resp: status: %d ep: %d\n", - __func__, resp_msg->svc_id, resp_msg->status, - resp_msg->eid); - - conn_resp->resp_code = resp_msg->status; - /* check response status */ - if (resp_msg->status != HTC_SERVICE_SUCCESS) { - ath6kl_dbg(ATH6KL_DBG_HTC, - "Target failed service 0x%X connect request (status:%d)\n", - resp_msg->svc_id, resp_msg->status); - status = -EINVAL; - goto free_packet; - } - - assigned_epid = (enum htc_endpoint_id) resp_msg->eid; - max_msg_size = le16_to_cpu(resp_msg->max_msg_sz); - } - - /* the rest are parameter checks so set the error status */ - status = -EINVAL; - - if (assigned_epid >= ENDPOINT_MAX) { - WARN_ON_ONCE(1); - goto free_packet; - } - - if (max_msg_size == 0) { - WARN_ON_ONCE(1); - goto free_packet; - } - - ep = &target->endpoint[assigned_epid]; - ep->eid = assigned_epid; - if (ep->svc_id != 0) { - /* endpoint already in use! */ - WARN_ON_ONCE(1); - goto free_packet; - } - - /* return assigned endpoint to caller */ - conn_resp->endpoint = assigned_epid; - conn_resp->len_max = max_msg_size; - - /* setup the endpoint */ - ep->svc_id = conn_req->svc_id; /* this marks ep in use */ - ep->max_txq_depth = conn_req->max_txq_depth; - ep->len_max = max_msg_size; - ep->cred_dist.credits = tx_alloc; - ep->cred_dist.cred_sz = target->tgt_cred_sz; - ep->cred_dist.cred_per_msg = max_msg_size / target->tgt_cred_sz; - if (max_msg_size % target->tgt_cred_sz) - ep->cred_dist.cred_per_msg++; - - /* copy all the callbacks */ - ep->ep_cb = conn_req->ep_cb; - - /* initialize tx_drop_packet_threshold */ - ep->tx_drop_packet_threshold = MAX_HI_COOKIE_NUM; - - status = ath6kl_hif_pipe_map_service(ar, ep->svc_id, - &ep->pipe.pipeid_ul, - &ep->pipe.pipeid_dl); - if (status != 0) - goto free_packet; - - ath6kl_dbg(ATH6KL_DBG_HTC, - "SVC Ready: 0x%4.4X: ULpipe:%d DLpipe:%d id:%d\n", - ep->svc_id, ep->pipe.pipeid_ul, - ep->pipe.pipeid_dl, ep->eid); - - if (disable_credit_flowctrl && ep->pipe.tx_credit_flow_enabled) { - ep->pipe.tx_credit_flow_enabled = false; - ath6kl_dbg(ATH6KL_DBG_HTC, - "SVC: 0x%4.4X ep:%d TX flow control off\n", - ep->svc_id, assigned_epid); - } - -free_packet: - if (packet != NULL) - htc_free_txctrl_packet(target, packet); - return status; -} - -/* htc export functions */ -static void *ath6kl_htc_pipe_create(struct ath6kl *ar) -{ - int status = 0; - struct htc_endpoint *ep = NULL; - struct htc_target *target = NULL; - struct htc_packet *packet; - int i; - - target = kzalloc(sizeof(struct htc_target), GFP_KERNEL); - if (target == NULL) { - ath6kl_err("htc create unable to allocate memory\n"); - status = -ENOMEM; - goto fail_htc_create; - } - - spin_lock_init(&target->htc_lock); - spin_lock_init(&target->rx_lock); - spin_lock_init(&target->tx_lock); - - reset_endpoint_states(target); - - for (i = 0; i < HTC_PACKET_CONTAINER_ALLOCATION; i++) { - packet = kzalloc(sizeof(struct htc_packet), GFP_KERNEL); - - if (packet != NULL) - free_htc_packet_container(target, packet); - } - - target->dev = kzalloc(sizeof(*target->dev), GFP_KERNEL); - if (!target->dev) { - ath6kl_err("unable to allocate memory\n"); - status = -ENOMEM; - goto fail_htc_create; - } - target->dev->ar = ar; - target->dev->htc_cnxt = target; - - /* Get HIF default pipe for HTC message exchange */ - ep = &target->endpoint[ENDPOINT_0]; - - ath6kl_hif_pipe_get_default(ar, &ep->pipe.pipeid_ul, - &ep->pipe.pipeid_dl); - - return target; - -fail_htc_create: - if (status != 0) { - if (target != NULL) - ath6kl_htc_pipe_cleanup(target); - - target = NULL; - } - return target; -} - -/* cleanup the HTC instance */ -static void ath6kl_htc_pipe_cleanup(struct htc_target *target) -{ - struct htc_packet *packet; - - while (true) { - packet = alloc_htc_packet_container(target); - if (packet == NULL) - break; - kfree(packet); - } - - kfree(target->dev); - - /* kfree our instance */ - kfree(target); -} - -static int ath6kl_htc_pipe_start(struct htc_target *target) -{ - struct sk_buff *skb; - struct htc_setup_comp_ext_msg *setup; - struct htc_packet *packet; - - htc_config_target_hif_pipe(target); - - /* allocate a buffer to send */ - packet = htc_alloc_txctrl_packet(target); - if (packet == NULL) { - WARN_ON_ONCE(1); - return -ENOMEM; - } - - skb = packet->skb; - - /* assemble setup complete message */ - setup = (struct htc_setup_comp_ext_msg *) skb_put(skb, - sizeof(*setup)); - memset(setup, 0, sizeof(struct htc_setup_comp_ext_msg)); - setup->msg_id = cpu_to_le16(HTC_MSG_SETUP_COMPLETE_EX_ID); - - ath6kl_dbg(ATH6KL_DBG_HTC, "HTC using TX credit flow control\n"); - - set_htc_pkt_info(packet, NULL, (u8 *) setup, - sizeof(struct htc_setup_comp_ext_msg), - ENDPOINT_0, HTC_SERVICE_TX_PACKET_TAG); - - target->htc_flags |= HTC_OP_STATE_SETUP_COMPLETE; - - return ath6kl_htc_pipe_tx(target, packet); -} - -static void ath6kl_htc_pipe_stop(struct htc_target *target) -{ - int i; - struct htc_endpoint *ep; - - /* cleanup endpoints */ - for (i = 0; i < ENDPOINT_MAX; i++) { - ep = &target->endpoint[i]; - htc_flush_rx_queue(target, ep); - htc_flush_tx_endpoint(target, ep, HTC_TX_PACKET_TAG_ALL); - } - - reset_endpoint_states(target); - target->htc_flags &= ~HTC_OP_STATE_SETUP_COMPLETE; -} - -static int ath6kl_htc_pipe_get_rxbuf_num(struct htc_target *target, - enum htc_endpoint_id endpoint) -{ - int num; - - spin_lock_bh(&target->rx_lock); - num = get_queue_depth(&(target->endpoint[endpoint].rx_bufq)); - spin_unlock_bh(&target->rx_lock); - - return num; -} - -static int ath6kl_htc_pipe_tx(struct htc_target *target, - struct htc_packet *packet) -{ - struct list_head queue; - - ath6kl_dbg(ATH6KL_DBG_HTC, - "%s: endPointId: %d, buffer: 0x%p, length: %d\n", - __func__, packet->endpoint, packet->buf, - packet->act_len); - - INIT_LIST_HEAD(&queue); - list_add_tail(&packet->list, &queue); - - return htc_send_packets_multiple(target, &queue); -} - -static int ath6kl_htc_pipe_wait_target(struct htc_target *target) -{ - struct htc_ready_ext_msg *ready_msg; - struct htc_service_connect_req connect; - struct htc_service_connect_resp resp; - int status = 0; - - status = htc_wait_recv_ctrl_message(target); - - if (status != 0) - return status; - - if (target->pipe.ctrl_response_len < sizeof(*ready_msg)) { - ath6kl_warn("invalid htc pipe ready msg len: %d\n", - target->pipe.ctrl_response_len); - return -ECOMM; - } - - ready_msg = (struct htc_ready_ext_msg *) target->pipe.ctrl_response_buf; - - if (ready_msg->ver2_0_info.msg_id != cpu_to_le16(HTC_MSG_READY_ID)) { - ath6kl_warn("invalid htc pipe ready msg: 0x%x\n", - ready_msg->ver2_0_info.msg_id); - return -ECOMM; - } - - ath6kl_dbg(ATH6KL_DBG_HTC, - "Target Ready! : transmit resources : %d size:%d\n", - ready_msg->ver2_0_info.cred_cnt, - ready_msg->ver2_0_info.cred_sz); - - target->tgt_creds = le16_to_cpu(ready_msg->ver2_0_info.cred_cnt); - target->tgt_cred_sz = le16_to_cpu(ready_msg->ver2_0_info.cred_sz); - - if ((target->tgt_creds == 0) || (target->tgt_cred_sz == 0)) - return -ECOMM; - - htc_setup_target_buffer_assignments(target); - - /* setup our pseudo HTC control endpoint connection */ - memset(&connect, 0, sizeof(connect)); - memset(&resp, 0, sizeof(resp)); - connect.ep_cb.tx_complete = htc_txctrl_complete; - connect.ep_cb.rx = htc_rxctrl_complete; - connect.max_txq_depth = NUM_CONTROL_TX_BUFFERS; - connect.svc_id = HTC_CTRL_RSVD_SVC; - - /* connect fake service */ - status = ath6kl_htc_pipe_conn_service(target, &connect, &resp); - - return status; -} - -static void ath6kl_htc_pipe_flush_txep(struct htc_target *target, - enum htc_endpoint_id endpoint, u16 tag) -{ - struct htc_endpoint *ep = &target->endpoint[endpoint]; - - if (ep->svc_id == 0) { - WARN_ON_ONCE(1); - /* not in use.. */ - return; - } - - htc_flush_tx_endpoint(target, ep, tag); -} - -static int ath6kl_htc_pipe_add_rxbuf_multiple(struct htc_target *target, - struct list_head *pkt_queue) -{ - struct htc_packet *packet, *tmp_pkt, *first; - struct htc_endpoint *ep; - int status = 0; - - if (list_empty(pkt_queue)) - return -EINVAL; - - first = list_first_entry(pkt_queue, struct htc_packet, list); - - if (first->endpoint >= ENDPOINT_MAX) { - WARN_ON_ONCE(1); - return -EINVAL; - } - - ath6kl_dbg(ATH6KL_DBG_HTC, "%s: epid: %d, cnt:%d, len: %d\n", - __func__, first->endpoint, get_queue_depth(pkt_queue), - first->buf_len); - - ep = &target->endpoint[first->endpoint]; - - spin_lock_bh(&target->rx_lock); - - /* store receive packets */ - list_splice_tail_init(pkt_queue, &ep->rx_bufq); - - spin_unlock_bh(&target->rx_lock); - - if (status != 0) { - /* walk through queue and mark each one canceled */ - list_for_each_entry_safe(packet, tmp_pkt, pkt_queue, list) { - packet->status = -ECANCELED; - } - - do_recv_completion(ep, pkt_queue); - } - - return status; -} - -static void ath6kl_htc_pipe_activity_changed(struct htc_target *target, - enum htc_endpoint_id ep, - bool active) -{ - /* TODO */ -} - -static void ath6kl_htc_pipe_flush_rx_buf(struct htc_target *target) -{ - /* TODO */ -} - -static int ath6kl_htc_pipe_credit_setup(struct htc_target *target, - struct ath6kl_htc_credit_info *info) -{ - return 0; -} - -static const struct ath6kl_htc_ops ath6kl_htc_pipe_ops = { - .create = ath6kl_htc_pipe_create, - .wait_target = ath6kl_htc_pipe_wait_target, - .start = ath6kl_htc_pipe_start, - .conn_service = ath6kl_htc_pipe_conn_service, - .tx = ath6kl_htc_pipe_tx, - .stop = ath6kl_htc_pipe_stop, - .cleanup = ath6kl_htc_pipe_cleanup, - .flush_txep = ath6kl_htc_pipe_flush_txep, - .flush_rx_buf = ath6kl_htc_pipe_flush_rx_buf, - .activity_changed = ath6kl_htc_pipe_activity_changed, - .get_rxbuf_num = ath6kl_htc_pipe_get_rxbuf_num, - .add_rxbuf_multiple = ath6kl_htc_pipe_add_rxbuf_multiple, - .credit_setup = ath6kl_htc_pipe_credit_setup, - .tx_complete = ath6kl_htc_pipe_tx_complete, - .rx_complete = ath6kl_htc_pipe_rx_complete, -}; - -void ath6kl_htc_pipe_attach(struct ath6kl *ar) -{ - ar->htc_ops = &ath6kl_htc_pipe_ops; -} diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c deleted file mode 100644 index 40ffee6184fd..000000000000 --- a/drivers/net/wireless/ath/ath6kl/init.c +++ /dev/null @@ -1,1864 +0,0 @@ - -/* - * Copyright (c) 2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include - -#include "core.h" -#include "cfg80211.h" -#include "target.h" -#include "debug.h" -#include "hif-ops.h" -#include "htc-ops.h" - -static const struct ath6kl_hw hw_list[] = { - { - .id = AR6003_HW_2_0_VERSION, - .name = "ar6003 hw 2.0", - .dataset_patch_addr = 0x57e884, - .app_load_addr = 0x543180, - .board_ext_data_addr = 0x57e500, - .reserved_ram_size = 6912, - .refclk_hz = 26000000, - .uarttx_pin = 8, - .flags = ATH6KL_HW_SDIO_CRC_ERROR_WAR, - - /* hw2.0 needs override address hardcoded */ - .app_start_override_addr = 0x944C00, - - .fw = { - .dir = AR6003_HW_2_0_FW_DIR, - .otp = AR6003_HW_2_0_OTP_FILE, - .fw = AR6003_HW_2_0_FIRMWARE_FILE, - .tcmd = AR6003_HW_2_0_TCMD_FIRMWARE_FILE, - .patch = AR6003_HW_2_0_PATCH_FILE, - }, - - .fw_board = AR6003_HW_2_0_BOARD_DATA_FILE, - .fw_default_board = AR6003_HW_2_0_DEFAULT_BOARD_DATA_FILE, - }, - { - .id = AR6003_HW_2_1_1_VERSION, - .name = "ar6003 hw 2.1.1", - .dataset_patch_addr = 0x57ff74, - .app_load_addr = 0x1234, - .board_ext_data_addr = 0x542330, - .reserved_ram_size = 512, - .refclk_hz = 26000000, - .uarttx_pin = 8, - .testscript_addr = 0x57ef74, - .flags = ATH6KL_HW_SDIO_CRC_ERROR_WAR, - - .fw = { - .dir = AR6003_HW_2_1_1_FW_DIR, - .otp = AR6003_HW_2_1_1_OTP_FILE, - .fw = AR6003_HW_2_1_1_FIRMWARE_FILE, - .tcmd = AR6003_HW_2_1_1_TCMD_FIRMWARE_FILE, - .patch = AR6003_HW_2_1_1_PATCH_FILE, - .utf = AR6003_HW_2_1_1_UTF_FIRMWARE_FILE, - .testscript = AR6003_HW_2_1_1_TESTSCRIPT_FILE, - }, - - .fw_board = AR6003_HW_2_1_1_BOARD_DATA_FILE, - .fw_default_board = AR6003_HW_2_1_1_DEFAULT_BOARD_DATA_FILE, - }, - { - .id = AR6004_HW_1_0_VERSION, - .name = "ar6004 hw 1.0", - .dataset_patch_addr = 0x57e884, - .app_load_addr = 0x1234, - .board_ext_data_addr = 0x437000, - .reserved_ram_size = 19456, - .board_addr = 0x433900, - .refclk_hz = 26000000, - .uarttx_pin = 11, - .flags = ATH6KL_HW_64BIT_RATES | - ATH6KL_HW_AP_INACTIVITY_MINS, - - .fw = { - .dir = AR6004_HW_1_0_FW_DIR, - .fw = AR6004_HW_1_0_FIRMWARE_FILE, - }, - - .fw_board = AR6004_HW_1_0_BOARD_DATA_FILE, - .fw_default_board = AR6004_HW_1_0_DEFAULT_BOARD_DATA_FILE, - }, - { - .id = AR6004_HW_1_1_VERSION, - .name = "ar6004 hw 1.1", - .dataset_patch_addr = 0x57e884, - .app_load_addr = 0x1234, - .board_ext_data_addr = 0x437000, - .reserved_ram_size = 11264, - .board_addr = 0x43d400, - .refclk_hz = 40000000, - .uarttx_pin = 11, - .flags = ATH6KL_HW_64BIT_RATES | - ATH6KL_HW_AP_INACTIVITY_MINS, - .fw = { - .dir = AR6004_HW_1_1_FW_DIR, - .fw = AR6004_HW_1_1_FIRMWARE_FILE, - }, - - .fw_board = AR6004_HW_1_1_BOARD_DATA_FILE, - .fw_default_board = AR6004_HW_1_1_DEFAULT_BOARD_DATA_FILE, - }, - { - .id = AR6004_HW_1_2_VERSION, - .name = "ar6004 hw 1.2", - .dataset_patch_addr = 0x436ecc, - .app_load_addr = 0x1234, - .board_ext_data_addr = 0x437000, - .reserved_ram_size = 9216, - .board_addr = 0x435c00, - .refclk_hz = 40000000, - .uarttx_pin = 11, - .flags = ATH6KL_HW_64BIT_RATES | - ATH6KL_HW_AP_INACTIVITY_MINS, - - .fw = { - .dir = AR6004_HW_1_2_FW_DIR, - .fw = AR6004_HW_1_2_FIRMWARE_FILE, - }, - .fw_board = AR6004_HW_1_2_BOARD_DATA_FILE, - .fw_default_board = AR6004_HW_1_2_DEFAULT_BOARD_DATA_FILE, - }, - { - .id = AR6004_HW_1_3_VERSION, - .name = "ar6004 hw 1.3", - .dataset_patch_addr = 0x437860, - .app_load_addr = 0x1234, - .board_ext_data_addr = 0x437000, - .reserved_ram_size = 7168, - .board_addr = 0x436400, - .refclk_hz = 40000000, - .uarttx_pin = 11, - .flags = ATH6KL_HW_64BIT_RATES | - ATH6KL_HW_AP_INACTIVITY_MINS | - ATH6KL_HW_MAP_LP_ENDPOINT, - - .fw = { - .dir = AR6004_HW_1_3_FW_DIR, - .fw = AR6004_HW_1_3_FIRMWARE_FILE, - }, - - .fw_board = AR6004_HW_1_3_BOARD_DATA_FILE, - .fw_default_board = AR6004_HW_1_3_DEFAULT_BOARD_DATA_FILE, - }, -}; - -/* - * Include definitions here that can be used to tune the WLAN module - * behavior. Different customers can tune the behavior as per their needs, - * here. - */ - -/* - * This configuration item enable/disable keepalive support. - * Keepalive support: In the absence of any data traffic to AP, null - * frames will be sent to the AP at periodic interval, to keep the association - * active. This configuration item defines the periodic interval. - * Use value of zero to disable keepalive support - * Default: 60 seconds - */ -#define WLAN_CONFIG_KEEP_ALIVE_INTERVAL 60 - -/* - * This configuration item sets the value of disconnect timeout - * Firmware delays sending the disconnec event to the host for this - * timeout after is gets disconnected from the current AP. - * If the firmware successly roams within the disconnect timeout - * it sends a new connect event - */ -#define WLAN_CONFIG_DISCONNECT_TIMEOUT 10 - - -#define ATH6KL_DATA_OFFSET 64 -struct sk_buff *ath6kl_buf_alloc(int size) -{ - struct sk_buff *skb; - u16 reserved; - - /* Add chacheline space at front and back of buffer */ - reserved = roundup((2 * L1_CACHE_BYTES) + ATH6KL_DATA_OFFSET + - sizeof(struct htc_packet) + ATH6KL_HTC_ALIGN_BYTES, 4); - skb = dev_alloc_skb(size + reserved); - - if (skb) - skb_reserve(skb, reserved - L1_CACHE_BYTES); - return skb; -} - -void ath6kl_init_profile_info(struct ath6kl_vif *vif) -{ - vif->ssid_len = 0; - memset(vif->ssid, 0, sizeof(vif->ssid)); - - vif->dot11_auth_mode = OPEN_AUTH; - vif->auth_mode = NONE_AUTH; - vif->prwise_crypto = NONE_CRYPT; - vif->prwise_crypto_len = 0; - vif->grp_crypto = NONE_CRYPT; - vif->grp_crypto_len = 0; - memset(vif->wep_key_list, 0, sizeof(vif->wep_key_list)); - memset(vif->req_bssid, 0, sizeof(vif->req_bssid)); - memset(vif->bssid, 0, sizeof(vif->bssid)); - vif->bss_ch = 0; -} - -static int ath6kl_set_host_app_area(struct ath6kl *ar) -{ - u32 address, data; - struct host_app_area host_app_area; - - /* Fetch the address of the host_app_area_s - * instance in the host interest area */ - address = ath6kl_get_hi_item_addr(ar, HI_ITEM(hi_app_host_interest)); - address = TARG_VTOP(ar->target_type, address); - - if (ath6kl_diag_read32(ar, address, &data)) - return -EIO; - - address = TARG_VTOP(ar->target_type, data); - host_app_area.wmi_protocol_ver = cpu_to_le32(WMI_PROTOCOL_VERSION); - if (ath6kl_diag_write(ar, address, (u8 *) &host_app_area, - sizeof(struct host_app_area))) - return -EIO; - - return 0; -} - -static inline void set_ac2_ep_map(struct ath6kl *ar, - u8 ac, - enum htc_endpoint_id ep) -{ - ar->ac2ep_map[ac] = ep; - ar->ep2ac_map[ep] = ac; -} - -/* connect to a service */ -static int ath6kl_connectservice(struct ath6kl *ar, - struct htc_service_connect_req *con_req, - char *desc) -{ - int status; - struct htc_service_connect_resp response; - - memset(&response, 0, sizeof(response)); - - status = ath6kl_htc_conn_service(ar->htc_target, con_req, &response); - if (status) { - ath6kl_err("failed to connect to %s service status:%d\n", - desc, status); - return status; - } - - switch (con_req->svc_id) { - case WMI_CONTROL_SVC: - if (test_bit(WMI_ENABLED, &ar->flag)) - ath6kl_wmi_set_control_ep(ar->wmi, response.endpoint); - ar->ctrl_ep = response.endpoint; - break; - case WMI_DATA_BE_SVC: - set_ac2_ep_map(ar, WMM_AC_BE, response.endpoint); - break; - case WMI_DATA_BK_SVC: - set_ac2_ep_map(ar, WMM_AC_BK, response.endpoint); - break; - case WMI_DATA_VI_SVC: - set_ac2_ep_map(ar, WMM_AC_VI, response.endpoint); - break; - case WMI_DATA_VO_SVC: - set_ac2_ep_map(ar, WMM_AC_VO, response.endpoint); - break; - default: - ath6kl_err("service id is not mapped %d\n", con_req->svc_id); - return -EINVAL; - } - - return 0; -} - -static int ath6kl_init_service_ep(struct ath6kl *ar) -{ - struct htc_service_connect_req connect; - - memset(&connect, 0, sizeof(connect)); - - /* these fields are the same for all service endpoints */ - connect.ep_cb.tx_comp_multi = ath6kl_tx_complete; - connect.ep_cb.rx = ath6kl_rx; - connect.ep_cb.rx_refill = ath6kl_rx_refill; - connect.ep_cb.tx_full = ath6kl_tx_queue_full; - - /* - * Set the max queue depth so that our ath6kl_tx_queue_full handler - * gets called. - */ - connect.max_txq_depth = MAX_DEFAULT_SEND_QUEUE_DEPTH; - connect.ep_cb.rx_refill_thresh = ATH6KL_MAX_RX_BUFFERS / 4; - if (!connect.ep_cb.rx_refill_thresh) - connect.ep_cb.rx_refill_thresh++; - - /* connect to control service */ - connect.svc_id = WMI_CONTROL_SVC; - if (ath6kl_connectservice(ar, &connect, "WMI CONTROL")) - return -EIO; - - connect.flags |= HTC_FLGS_TX_BNDL_PAD_EN; - - /* - * Limit the HTC message size on the send path, although e can - * receive A-MSDU frames of 4K, we will only send ethernet-sized - * (802.3) frames on the send path. - */ - connect.max_rxmsg_sz = WMI_MAX_TX_DATA_FRAME_LENGTH; - - /* - * To reduce the amount of committed memory for larger A_MSDU - * frames, use the recv-alloc threshold mechanism for larger - * packets. - */ - connect.ep_cb.rx_alloc_thresh = ATH6KL_BUFFER_SIZE; - connect.ep_cb.rx_allocthresh = ath6kl_alloc_amsdu_rxbuf; - - /* - * For the remaining data services set the connection flag to - * reduce dribbling, if configured to do so. - */ - connect.conn_flags |= HTC_CONN_FLGS_REDUCE_CRED_DRIB; - connect.conn_flags &= ~HTC_CONN_FLGS_THRESH_MASK; - connect.conn_flags |= HTC_CONN_FLGS_THRESH_LVL_HALF; - - connect.svc_id = WMI_DATA_BE_SVC; - - if (ath6kl_connectservice(ar, &connect, "WMI DATA BE")) - return -EIO; - - /* connect to back-ground map this to WMI LOW_PRI */ - connect.svc_id = WMI_DATA_BK_SVC; - if (ath6kl_connectservice(ar, &connect, "WMI DATA BK")) - return -EIO; - - /* connect to Video service, map this to HI PRI */ - connect.svc_id = WMI_DATA_VI_SVC; - if (ath6kl_connectservice(ar, &connect, "WMI DATA VI")) - return -EIO; - - /* - * Connect to VO service, this is currently not mapped to a WMI - * priority stream due to historical reasons. WMI originally - * defined 3 priorities over 3 mailboxes We can change this when - * WMI is reworked so that priorities are not dependent on - * mailboxes. - */ - connect.svc_id = WMI_DATA_VO_SVC; - if (ath6kl_connectservice(ar, &connect, "WMI DATA VO")) - return -EIO; - - return 0; -} - -void ath6kl_init_control_info(struct ath6kl_vif *vif) -{ - ath6kl_init_profile_info(vif); - vif->def_txkey_index = 0; - memset(vif->wep_key_list, 0, sizeof(vif->wep_key_list)); - vif->ch_hint = 0; -} - -/* - * Set HTC/Mbox operational parameters, this can only be called when the - * target is in the BMI phase. - */ -static int ath6kl_set_htc_params(struct ath6kl *ar, u32 mbox_isr_yield_val, - u8 htc_ctrl_buf) -{ - int status; - u32 blk_size; - - blk_size = ar->mbox_info.block_size; - - if (htc_ctrl_buf) - blk_size |= ((u32)htc_ctrl_buf) << 16; - - /* set the host interest area for the block size */ - status = ath6kl_bmi_write_hi32(ar, hi_mbox_io_block_sz, blk_size); - if (status) { - ath6kl_err("bmi_write_memory for IO block size failed\n"); - goto out; - } - - ath6kl_dbg(ATH6KL_DBG_TRC, "block size set: %d (target addr:0x%X)\n", - blk_size, - ath6kl_get_hi_item_addr(ar, HI_ITEM(hi_mbox_io_block_sz))); - - if (mbox_isr_yield_val) { - /* set the host interest area for the mbox ISR yield limit */ - status = ath6kl_bmi_write_hi32(ar, hi_mbox_isr_yield_limit, - mbox_isr_yield_val); - if (status) { - ath6kl_err("bmi_write_memory for yield limit failed\n"); - goto out; - } - } - -out: - return status; -} - -static int ath6kl_target_config_wlan_params(struct ath6kl *ar, int idx) -{ - int ret; - - /* - * Configure the device for rx dot11 header rules. "0,0" are the - * default values. Required if checksum offload is needed. Set - * RxMetaVersion to 2. - */ - ret = ath6kl_wmi_set_rx_frame_format_cmd(ar->wmi, idx, - ar->rx_meta_ver, 0, 0); - if (ret) { - ath6kl_err("unable to set the rx frame format: %d\n", ret); - return ret; - } - - if (ar->conf_flags & ATH6KL_CONF_IGNORE_PS_FAIL_EVT_IN_SCAN) { - ret = ath6kl_wmi_pmparams_cmd(ar->wmi, idx, 0, 1, 0, 0, 1, - IGNORE_PS_FAIL_DURING_SCAN); - if (ret) { - ath6kl_err("unable to set power save fail event policy: %d\n", - ret); - return ret; - } - } - - if (!(ar->conf_flags & ATH6KL_CONF_IGNORE_ERP_BARKER)) { - ret = ath6kl_wmi_set_lpreamble_cmd(ar->wmi, idx, 0, - WMI_FOLLOW_BARKER_IN_ERP); - if (ret) { - ath6kl_err("unable to set barker preamble policy: %d\n", - ret); - return ret; - } - } - - ret = ath6kl_wmi_set_keepalive_cmd(ar->wmi, idx, - WLAN_CONFIG_KEEP_ALIVE_INTERVAL); - if (ret) { - ath6kl_err("unable to set keep alive interval: %d\n", ret); - return ret; - } - - ret = ath6kl_wmi_disctimeout_cmd(ar->wmi, idx, - WLAN_CONFIG_DISCONNECT_TIMEOUT); - if (ret) { - ath6kl_err("unable to set disconnect timeout: %d\n", ret); - return ret; - } - - if (!(ar->conf_flags & ATH6KL_CONF_ENABLE_TX_BURST)) { - ret = ath6kl_wmi_set_wmm_txop(ar->wmi, idx, WMI_TXOP_DISABLED); - if (ret) { - ath6kl_err("unable to set txop bursting: %d\n", ret); - return ret; - } - } - - if (ar->p2p && (ar->vif_max == 1 || idx)) { - ret = ath6kl_wmi_info_req_cmd(ar->wmi, idx, - P2P_FLAG_CAPABILITIES_REQ | - P2P_FLAG_MACADDR_REQ | - P2P_FLAG_HMODEL_REQ); - if (ret) { - ath6kl_dbg(ATH6KL_DBG_TRC, - "failed to request P2P capabilities (%d) - assuming P2P not supported\n", - ret); - ar->p2p = false; - } - } - - if (ar->p2p && (ar->vif_max == 1 || idx)) { - /* Enable Probe Request reporting for P2P */ - ret = ath6kl_wmi_probe_report_req_cmd(ar->wmi, idx, true); - if (ret) { - ath6kl_dbg(ATH6KL_DBG_TRC, - "failed to enable Probe Request reporting (%d)\n", - ret); - } - } - - return ret; -} - -int ath6kl_configure_target(struct ath6kl *ar) -{ - u32 param, ram_reserved_size; - u8 fw_iftype, fw_mode = 0, fw_submode = 0; - int i, status; - - param = !!(ar->conf_flags & ATH6KL_CONF_UART_DEBUG); - if (ath6kl_bmi_write_hi32(ar, hi_serial_enable, param)) { - ath6kl_err("bmi_write_memory for uart debug failed\n"); - return -EIO; - } - - /* - * Note: Even though the firmware interface type is - * chosen as BSS_STA for all three interfaces, can - * be configured to IBSS/AP as long as the fw submode - * remains normal mode (0 - AP, STA and IBSS). But - * due to an target assert in firmware only one interface is - * configured for now. - */ - fw_iftype = HI_OPTION_FW_MODE_BSS_STA; - - for (i = 0; i < ar->vif_max; i++) - fw_mode |= fw_iftype << (i * HI_OPTION_FW_MODE_BITS); - - /* - * Submodes when fw does not support dynamic interface - * switching: - * vif[0] - AP/STA/IBSS - * vif[1] - "P2P dev"/"P2P GO"/"P2P Client" - * vif[2] - "P2P dev"/"P2P GO"/"P2P Client" - * Otherwise, All the interface are initialized to p2p dev. - */ - - if (test_bit(ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX, - ar->fw_capabilities)) { - for (i = 0; i < ar->vif_max; i++) - fw_submode |= HI_OPTION_FW_SUBMODE_P2PDEV << - (i * HI_OPTION_FW_SUBMODE_BITS); - } else { - for (i = 0; i < ar->max_norm_iface; i++) - fw_submode |= HI_OPTION_FW_SUBMODE_NONE << - (i * HI_OPTION_FW_SUBMODE_BITS); - - for (i = ar->max_norm_iface; i < ar->vif_max; i++) - fw_submode |= HI_OPTION_FW_SUBMODE_P2PDEV << - (i * HI_OPTION_FW_SUBMODE_BITS); - - if (ar->p2p && ar->vif_max == 1) - fw_submode = HI_OPTION_FW_SUBMODE_P2PDEV; - } - - if (ath6kl_bmi_write_hi32(ar, hi_app_host_interest, - HTC_PROTOCOL_VERSION) != 0) { - ath6kl_err("bmi_write_memory for htc version failed\n"); - return -EIO; - } - - /* set the firmware mode to STA/IBSS/AP */ - param = 0; - - if (ath6kl_bmi_read_hi32(ar, hi_option_flag, ¶m) != 0) { - ath6kl_err("bmi_read_memory for setting fwmode failed\n"); - return -EIO; - } - - param |= (ar->vif_max << HI_OPTION_NUM_DEV_SHIFT); - param |= fw_mode << HI_OPTION_FW_MODE_SHIFT; - param |= fw_submode << HI_OPTION_FW_SUBMODE_SHIFT; - - param |= (0 << HI_OPTION_MAC_ADDR_METHOD_SHIFT); - param |= (0 << HI_OPTION_FW_BRIDGE_SHIFT); - - if (ath6kl_bmi_write_hi32(ar, hi_option_flag, param) != 0) { - ath6kl_err("bmi_write_memory for setting fwmode failed\n"); - return -EIO; - } - - ath6kl_dbg(ATH6KL_DBG_TRC, "firmware mode set\n"); - - /* - * Hardcode the address use for the extended board data - * Ideally this should be pre-allocate by the OS at boot time - * But since it is a new feature and board data is loaded - * at init time, we have to workaround this from host. - * It is difficult to patch the firmware boot code, - * but possible in theory. - */ - - if (ar->target_type == TARGET_TYPE_AR6003) { - param = ar->hw.board_ext_data_addr; - ram_reserved_size = ar->hw.reserved_ram_size; - - if (ath6kl_bmi_write_hi32(ar, hi_board_ext_data, param) != 0) { - ath6kl_err("bmi_write_memory for hi_board_ext_data failed\n"); - return -EIO; - } - - if (ath6kl_bmi_write_hi32(ar, hi_end_ram_reserve_sz, - ram_reserved_size) != 0) { - ath6kl_err("bmi_write_memory for hi_end_ram_reserve_sz failed\n"); - return -EIO; - } - } - - /* set the block size for the target */ - if (ath6kl_set_htc_params(ar, MBOX_YIELD_LIMIT, 0)) - /* use default number of control buffers */ - return -EIO; - - /* Configure GPIO AR600x UART */ - status = ath6kl_bmi_write_hi32(ar, hi_dbg_uart_txpin, - ar->hw.uarttx_pin); - if (status) - return status; - - /* Configure target refclk_hz */ - status = ath6kl_bmi_write_hi32(ar, hi_refclk_hz, ar->hw.refclk_hz); - if (status) - return status; - - return 0; -} - -/* firmware upload */ -static int ath6kl_get_fw(struct ath6kl *ar, const char *filename, - u8 **fw, size_t *fw_len) -{ - const struct firmware *fw_entry; - int ret; - - ret = request_firmware(&fw_entry, filename, ar->dev); - if (ret) - return ret; - - *fw_len = fw_entry->size; - *fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL); - - if (*fw == NULL) - ret = -ENOMEM; - - release_firmware(fw_entry); - - return ret; -} - -#ifdef CONFIG_OF -/* - * Check the device tree for a board-id and use it to construct - * the pathname to the firmware file. Used (for now) to find a - * fallback to the "bdata.bin" file--typically a symlink to the - * appropriate board-specific file. - */ -static bool check_device_tree(struct ath6kl *ar) -{ - static const char *board_id_prop = "atheros,board-id"; - struct device_node *node; - char board_filename[64]; - const char *board_id; - int ret; - - for_each_compatible_node(node, NULL, "atheros,ath6kl") { - board_id = of_get_property(node, board_id_prop, NULL); - if (board_id == NULL) { - ath6kl_warn("No \"%s\" property on %s node.\n", - board_id_prop, node->name); - continue; - } - snprintf(board_filename, sizeof(board_filename), - "%s/bdata.%s.bin", ar->hw.fw.dir, board_id); - - ret = ath6kl_get_fw(ar, board_filename, &ar->fw_board, - &ar->fw_board_len); - if (ret) { - ath6kl_err("Failed to get DT board file %s: %d\n", - board_filename, ret); - continue; - } - return true; - } - return false; -} -#else -static bool check_device_tree(struct ath6kl *ar) -{ - return false; -} -#endif /* CONFIG_OF */ - -static int ath6kl_fetch_board_file(struct ath6kl *ar) -{ - const char *filename; - int ret; - - if (ar->fw_board != NULL) - return 0; - - if (WARN_ON(ar->hw.fw_board == NULL)) - return -EINVAL; - - filename = ar->hw.fw_board; - - ret = ath6kl_get_fw(ar, filename, &ar->fw_board, - &ar->fw_board_len); - if (ret == 0) { - /* managed to get proper board file */ - return 0; - } - - if (check_device_tree(ar)) { - /* got board file from device tree */ - return 0; - } - - /* there was no proper board file, try to use default instead */ - ath6kl_warn("Failed to get board file %s (%d), trying to find default board file.\n", - filename, ret); - - filename = ar->hw.fw_default_board; - - ret = ath6kl_get_fw(ar, filename, &ar->fw_board, - &ar->fw_board_len); - if (ret) { - ath6kl_err("Failed to get default board file %s: %d\n", - filename, ret); - return ret; - } - - ath6kl_warn("WARNING! No proper board file was not found, instead using a default board file.\n"); - ath6kl_warn("Most likely your hardware won't work as specified. Install correct board file!\n"); - - return 0; -} - -static int ath6kl_fetch_otp_file(struct ath6kl *ar) -{ - char filename[100]; - int ret; - - if (ar->fw_otp != NULL) - return 0; - - if (ar->hw.fw.otp == NULL) { - ath6kl_dbg(ATH6KL_DBG_BOOT, - "no OTP file configured for this hw\n"); - return 0; - } - - snprintf(filename, sizeof(filename), "%s/%s", - ar->hw.fw.dir, ar->hw.fw.otp); - - ret = ath6kl_get_fw(ar, filename, &ar->fw_otp, - &ar->fw_otp_len); - if (ret) { - ath6kl_err("Failed to get OTP file %s: %d\n", - filename, ret); - return ret; - } - - return 0; -} - -static int ath6kl_fetch_testmode_file(struct ath6kl *ar) -{ - char filename[100]; - int ret; - - if (ar->testmode == 0) - return 0; - - ath6kl_dbg(ATH6KL_DBG_BOOT, "testmode %d\n", ar->testmode); - - if (ar->testmode == 2) { - if (ar->hw.fw.utf == NULL) { - ath6kl_warn("testmode 2 not supported\n"); - return -EOPNOTSUPP; - } - - snprintf(filename, sizeof(filename), "%s/%s", - ar->hw.fw.dir, ar->hw.fw.utf); - } else { - if (ar->hw.fw.tcmd == NULL) { - ath6kl_warn("testmode 1 not supported\n"); - return -EOPNOTSUPP; - } - - snprintf(filename, sizeof(filename), "%s/%s", - ar->hw.fw.dir, ar->hw.fw.tcmd); - } - - set_bit(TESTMODE, &ar->flag); - - ret = ath6kl_get_fw(ar, filename, &ar->fw, &ar->fw_len); - if (ret) { - ath6kl_err("Failed to get testmode %d firmware file %s: %d\n", - ar->testmode, filename, ret); - return ret; - } - - return 0; -} - -static int ath6kl_fetch_fw_file(struct ath6kl *ar) -{ - char filename[100]; - int ret; - - if (ar->fw != NULL) - return 0; - - /* FIXME: remove WARN_ON() as we won't support FW API 1 for long */ - if (WARN_ON(ar->hw.fw.fw == NULL)) - return -EINVAL; - - snprintf(filename, sizeof(filename), "%s/%s", - ar->hw.fw.dir, ar->hw.fw.fw); - - ret = ath6kl_get_fw(ar, filename, &ar->fw, &ar->fw_len); - if (ret) { - ath6kl_err("Failed to get firmware file %s: %d\n", - filename, ret); - return ret; - } - - return 0; -} - -static int ath6kl_fetch_patch_file(struct ath6kl *ar) -{ - char filename[100]; - int ret; - - if (ar->fw_patch != NULL) - return 0; - - if (ar->hw.fw.patch == NULL) - return 0; - - snprintf(filename, sizeof(filename), "%s/%s", - ar->hw.fw.dir, ar->hw.fw.patch); - - ret = ath6kl_get_fw(ar, filename, &ar->fw_patch, - &ar->fw_patch_len); - if (ret) { - ath6kl_err("Failed to get patch file %s: %d\n", - filename, ret); - return ret; - } - - return 0; -} - -static int ath6kl_fetch_testscript_file(struct ath6kl *ar) -{ - char filename[100]; - int ret; - - if (ar->testmode != 2) - return 0; - - if (ar->fw_testscript != NULL) - return 0; - - if (ar->hw.fw.testscript == NULL) - return 0; - - snprintf(filename, sizeof(filename), "%s/%s", - ar->hw.fw.dir, ar->hw.fw.testscript); - - ret = ath6kl_get_fw(ar, filename, &ar->fw_testscript, - &ar->fw_testscript_len); - if (ret) { - ath6kl_err("Failed to get testscript file %s: %d\n", - filename, ret); - return ret; - } - - return 0; -} - -static int ath6kl_fetch_fw_api1(struct ath6kl *ar) -{ - int ret; - - ret = ath6kl_fetch_otp_file(ar); - if (ret) - return ret; - - ret = ath6kl_fetch_fw_file(ar); - if (ret) - return ret; - - ret = ath6kl_fetch_patch_file(ar); - if (ret) - return ret; - - ret = ath6kl_fetch_testscript_file(ar); - if (ret) - return ret; - - return 0; -} - -static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name) -{ - size_t magic_len, len, ie_len; - const struct firmware *fw; - struct ath6kl_fw_ie *hdr; - char filename[100]; - const u8 *data; - int ret, ie_id, i, index, bit; - __le32 *val; - - snprintf(filename, sizeof(filename), "%s/%s", ar->hw.fw.dir, name); - - ret = request_firmware(&fw, filename, ar->dev); - if (ret) - return ret; - - data = fw->data; - len = fw->size; - - /* magic also includes the null byte, check that as well */ - magic_len = strlen(ATH6KL_FIRMWARE_MAGIC) + 1; - - if (len < magic_len) { - ret = -EINVAL; - goto out; - } - - if (memcmp(data, ATH6KL_FIRMWARE_MAGIC, magic_len) != 0) { - ret = -EINVAL; - goto out; - } - - len -= magic_len; - data += magic_len; - - /* loop elements */ - while (len > sizeof(struct ath6kl_fw_ie)) { - /* hdr is unaligned! */ - hdr = (struct ath6kl_fw_ie *) data; - - ie_id = le32_to_cpup(&hdr->id); - ie_len = le32_to_cpup(&hdr->len); - - len -= sizeof(*hdr); - data += sizeof(*hdr); - - if (len < ie_len) { - ret = -EINVAL; - goto out; - } - - switch (ie_id) { - case ATH6KL_FW_IE_FW_VERSION: - strlcpy(ar->wiphy->fw_version, data, - sizeof(ar->wiphy->fw_version)); - - ath6kl_dbg(ATH6KL_DBG_BOOT, - "found fw version %s\n", - ar->wiphy->fw_version); - break; - case ATH6KL_FW_IE_OTP_IMAGE: - ath6kl_dbg(ATH6KL_DBG_BOOT, "found otp image ie (%zd B)\n", - ie_len); - - ar->fw_otp = kmemdup(data, ie_len, GFP_KERNEL); - - if (ar->fw_otp == NULL) { - ret = -ENOMEM; - goto out; - } - - ar->fw_otp_len = ie_len; - break; - case ATH6KL_FW_IE_FW_IMAGE: - ath6kl_dbg(ATH6KL_DBG_BOOT, "found fw image ie (%zd B)\n", - ie_len); - - /* in testmode we already might have a fw file */ - if (ar->fw != NULL) - break; - - ar->fw = vmalloc(ie_len); - - if (ar->fw == NULL) { - ret = -ENOMEM; - goto out; - } - - memcpy(ar->fw, data, ie_len); - ar->fw_len = ie_len; - break; - case ATH6KL_FW_IE_PATCH_IMAGE: - ath6kl_dbg(ATH6KL_DBG_BOOT, "found patch image ie (%zd B)\n", - ie_len); - - ar->fw_patch = kmemdup(data, ie_len, GFP_KERNEL); - - if (ar->fw_patch == NULL) { - ret = -ENOMEM; - goto out; - } - - ar->fw_patch_len = ie_len; - break; - case ATH6KL_FW_IE_RESERVED_RAM_SIZE: - val = (__le32 *) data; - ar->hw.reserved_ram_size = le32_to_cpup(val); - - ath6kl_dbg(ATH6KL_DBG_BOOT, - "found reserved ram size ie 0x%d\n", - ar->hw.reserved_ram_size); - break; - case ATH6KL_FW_IE_CAPABILITIES: - ath6kl_dbg(ATH6KL_DBG_BOOT, - "found firmware capabilities ie (%zd B)\n", - ie_len); - - for (i = 0; i < ATH6KL_FW_CAPABILITY_MAX; i++) { - index = i / 8; - bit = i % 8; - - if (index == ie_len) - break; - - if (data[index] & (1 << bit)) - __set_bit(i, ar->fw_capabilities); - } - - ath6kl_dbg_dump(ATH6KL_DBG_BOOT, "capabilities", "", - ar->fw_capabilities, - sizeof(ar->fw_capabilities)); - break; - case ATH6KL_FW_IE_PATCH_ADDR: - if (ie_len != sizeof(*val)) - break; - - val = (__le32 *) data; - ar->hw.dataset_patch_addr = le32_to_cpup(val); - - ath6kl_dbg(ATH6KL_DBG_BOOT, - "found patch address ie 0x%x\n", - ar->hw.dataset_patch_addr); - break; - case ATH6KL_FW_IE_BOARD_ADDR: - if (ie_len != sizeof(*val)) - break; - - val = (__le32 *) data; - ar->hw.board_addr = le32_to_cpup(val); - - ath6kl_dbg(ATH6KL_DBG_BOOT, - "found board address ie 0x%x\n", - ar->hw.board_addr); - break; - case ATH6KL_FW_IE_VIF_MAX: - if (ie_len != sizeof(*val)) - break; - - val = (__le32 *) data; - ar->vif_max = min_t(unsigned int, le32_to_cpup(val), - ATH6KL_VIF_MAX); - - if (ar->vif_max > 1 && !ar->p2p) - ar->max_norm_iface = 2; - - ath6kl_dbg(ATH6KL_DBG_BOOT, - "found vif max ie %d\n", ar->vif_max); - break; - default: - ath6kl_dbg(ATH6KL_DBG_BOOT, "Unknown fw ie: %u\n", - le32_to_cpup(&hdr->id)); - break; - } - - len -= ie_len; - data += ie_len; - }; - - ret = 0; -out: - release_firmware(fw); - - return ret; -} - -int ath6kl_init_fetch_firmwares(struct ath6kl *ar) -{ - int ret; - - ret = ath6kl_fetch_board_file(ar); - if (ret) - return ret; - - ret = ath6kl_fetch_testmode_file(ar); - if (ret) - return ret; - - ret = ath6kl_fetch_fw_apin(ar, ATH6KL_FW_API4_FILE); - if (ret == 0) { - ar->fw_api = 4; - goto out; - } - - ret = ath6kl_fetch_fw_apin(ar, ATH6KL_FW_API3_FILE); - if (ret == 0) { - ar->fw_api = 3; - goto out; - } - - ret = ath6kl_fetch_fw_apin(ar, ATH6KL_FW_API2_FILE); - if (ret == 0) { - ar->fw_api = 2; - goto out; - } - - ret = ath6kl_fetch_fw_api1(ar); - if (ret) - return ret; - - ar->fw_api = 1; - -out: - ath6kl_dbg(ATH6KL_DBG_BOOT, "using fw api %d\n", ar->fw_api); - - return 0; -} - -static int ath6kl_upload_board_file(struct ath6kl *ar) -{ - u32 board_address, board_ext_address, param; - u32 board_data_size, board_ext_data_size; - int ret; - - if (WARN_ON(ar->fw_board == NULL)) - return -ENOENT; - - /* - * Determine where in Target RAM to write Board Data. - * For AR6004, host determine Target RAM address for - * writing board data. - */ - if (ar->hw.board_addr != 0) { - board_address = ar->hw.board_addr; - ath6kl_bmi_write_hi32(ar, hi_board_data, - board_address); - } else { - ath6kl_bmi_read_hi32(ar, hi_board_data, &board_address); - } - - /* determine where in target ram to write extended board data */ - ath6kl_bmi_read_hi32(ar, hi_board_ext_data, &board_ext_address); - - if (ar->target_type == TARGET_TYPE_AR6003 && - board_ext_address == 0) { - ath6kl_err("Failed to get board file target address.\n"); - return -EINVAL; - } - - switch (ar->target_type) { - case TARGET_TYPE_AR6003: - board_data_size = AR6003_BOARD_DATA_SZ; - board_ext_data_size = AR6003_BOARD_EXT_DATA_SZ; - if (ar->fw_board_len > (board_data_size + board_ext_data_size)) - board_ext_data_size = AR6003_BOARD_EXT_DATA_SZ_V2; - break; - case TARGET_TYPE_AR6004: - board_data_size = AR6004_BOARD_DATA_SZ; - board_ext_data_size = AR6004_BOARD_EXT_DATA_SZ; - break; - default: - WARN_ON(1); - return -EINVAL; - break; - } - - if (board_ext_address && - ar->fw_board_len == (board_data_size + board_ext_data_size)) { - - /* write extended board data */ - ath6kl_dbg(ATH6KL_DBG_BOOT, - "writing extended board data to 0x%x (%d B)\n", - board_ext_address, board_ext_data_size); - - ret = ath6kl_bmi_write(ar, board_ext_address, - ar->fw_board + board_data_size, - board_ext_data_size); - if (ret) { - ath6kl_err("Failed to write extended board data: %d\n", - ret); - return ret; - } - - /* record that extended board data is initialized */ - param = (board_ext_data_size << 16) | 1; - - ath6kl_bmi_write_hi32(ar, hi_board_ext_data_config, param); - } - - if (ar->fw_board_len < board_data_size) { - ath6kl_err("Too small board file: %zu\n", ar->fw_board_len); - ret = -EINVAL; - return ret; - } - - ath6kl_dbg(ATH6KL_DBG_BOOT, "writing board file to 0x%x (%d B)\n", - board_address, board_data_size); - - ret = ath6kl_bmi_write(ar, board_address, ar->fw_board, - board_data_size); - - if (ret) { - ath6kl_err("Board file bmi write failed: %d\n", ret); - return ret; - } - - /* record the fact that Board Data IS initialized */ - ath6kl_bmi_write_hi32(ar, hi_board_data_initialized, 1); - - return ret; -} - -static int ath6kl_upload_otp(struct ath6kl *ar) -{ - u32 address, param; - bool from_hw = false; - int ret; - - if (ar->fw_otp == NULL) - return 0; - - address = ar->hw.app_load_addr; - - ath6kl_dbg(ATH6KL_DBG_BOOT, "writing otp to 0x%x (%zd B)\n", address, - ar->fw_otp_len); - - ret = ath6kl_bmi_fast_download(ar, address, ar->fw_otp, - ar->fw_otp_len); - if (ret) { - ath6kl_err("Failed to upload OTP file: %d\n", ret); - return ret; - } - - /* read firmware start address */ - ret = ath6kl_bmi_read_hi32(ar, hi_app_start, &address); - - if (ret) { - ath6kl_err("Failed to read hi_app_start: %d\n", ret); - return ret; - } - - if (ar->hw.app_start_override_addr == 0) { - ar->hw.app_start_override_addr = address; - from_hw = true; - } - - ath6kl_dbg(ATH6KL_DBG_BOOT, "app_start_override_addr%s 0x%x\n", - from_hw ? " (from hw)" : "", - ar->hw.app_start_override_addr); - - /* execute the OTP code */ - ath6kl_dbg(ATH6KL_DBG_BOOT, "executing OTP at 0x%x\n", - ar->hw.app_start_override_addr); - param = 0; - ath6kl_bmi_execute(ar, ar->hw.app_start_override_addr, ¶m); - - return ret; -} - -static int ath6kl_upload_firmware(struct ath6kl *ar) -{ - u32 address; - int ret; - - if (WARN_ON(ar->fw == NULL)) - return 0; - - address = ar->hw.app_load_addr; - - ath6kl_dbg(ATH6KL_DBG_BOOT, "writing firmware to 0x%x (%zd B)\n", - address, ar->fw_len); - - ret = ath6kl_bmi_fast_download(ar, address, ar->fw, ar->fw_len); - - if (ret) { - ath6kl_err("Failed to write firmware: %d\n", ret); - return ret; - } - - /* - * Set starting address for firmware - * Don't need to setup app_start override addr on AR6004 - */ - if (ar->target_type != TARGET_TYPE_AR6004) { - address = ar->hw.app_start_override_addr; - ath6kl_bmi_set_app_start(ar, address); - } - return ret; -} - -static int ath6kl_upload_patch(struct ath6kl *ar) -{ - u32 address; - int ret; - - if (ar->fw_patch == NULL) - return 0; - - address = ar->hw.dataset_patch_addr; - - ath6kl_dbg(ATH6KL_DBG_BOOT, "writing patch to 0x%x (%zd B)\n", - address, ar->fw_patch_len); - - ret = ath6kl_bmi_write(ar, address, ar->fw_patch, ar->fw_patch_len); - if (ret) { - ath6kl_err("Failed to write patch file: %d\n", ret); - return ret; - } - - ath6kl_bmi_write_hi32(ar, hi_dset_list_head, address); - - return 0; -} - -static int ath6kl_upload_testscript(struct ath6kl *ar) -{ - u32 address; - int ret; - - if (ar->testmode != 2) - return 0; - - if (ar->fw_testscript == NULL) - return 0; - - address = ar->hw.testscript_addr; - - ath6kl_dbg(ATH6KL_DBG_BOOT, "writing testscript to 0x%x (%zd B)\n", - address, ar->fw_testscript_len); - - ret = ath6kl_bmi_write(ar, address, ar->fw_testscript, - ar->fw_testscript_len); - if (ret) { - ath6kl_err("Failed to write testscript file: %d\n", ret); - return ret; - } - - ath6kl_bmi_write_hi32(ar, hi_ota_testscript, address); - ath6kl_bmi_write_hi32(ar, hi_end_ram_reserve_sz, 4096); - ath6kl_bmi_write_hi32(ar, hi_test_apps_related, 1); - - return 0; -} - -static int ath6kl_init_upload(struct ath6kl *ar) -{ - u32 param, options, sleep, address; - int status = 0; - - if (ar->target_type != TARGET_TYPE_AR6003 && - ar->target_type != TARGET_TYPE_AR6004) - return -EINVAL; - - /* temporarily disable system sleep */ - address = MBOX_BASE_ADDRESS + LOCAL_SCRATCH_ADDRESS; - status = ath6kl_bmi_reg_read(ar, address, ¶m); - if (status) - return status; - - options = param; - - param |= ATH6KL_OPTION_SLEEP_DISABLE; - status = ath6kl_bmi_reg_write(ar, address, param); - if (status) - return status; - - address = RTC_BASE_ADDRESS + SYSTEM_SLEEP_ADDRESS; - status = ath6kl_bmi_reg_read(ar, address, ¶m); - if (status) - return status; - - sleep = param; - - param |= SM(SYSTEM_SLEEP_DISABLE, 1); - status = ath6kl_bmi_reg_write(ar, address, param); - if (status) - return status; - - ath6kl_dbg(ATH6KL_DBG_TRC, "old options: %d, old sleep: %d\n", - options, sleep); - - /* program analog PLL register */ - /* no need to control 40/44MHz clock on AR6004 */ - if (ar->target_type != TARGET_TYPE_AR6004) { - status = ath6kl_bmi_reg_write(ar, ATH6KL_ANALOG_PLL_REGISTER, - 0xF9104001); - - if (status) - return status; - - /* Run at 80/88MHz by default */ - param = SM(CPU_CLOCK_STANDARD, 1); - - address = RTC_BASE_ADDRESS + CPU_CLOCK_ADDRESS; - status = ath6kl_bmi_reg_write(ar, address, param); - if (status) - return status; - } - - param = 0; - address = RTC_BASE_ADDRESS + LPO_CAL_ADDRESS; - param = SM(LPO_CAL_ENABLE, 1); - status = ath6kl_bmi_reg_write(ar, address, param); - if (status) - return status; - - /* WAR to avoid SDIO CRC err */ - if (ar->hw.flags & ATH6KL_HW_SDIO_CRC_ERROR_WAR) { - ath6kl_err("temporary war to avoid sdio crc error\n"); - - param = 0x28; - address = GPIO_BASE_ADDRESS + GPIO_PIN9_ADDRESS; - status = ath6kl_bmi_reg_write(ar, address, param); - if (status) - return status; - - param = 0x20; - - address = GPIO_BASE_ADDRESS + GPIO_PIN10_ADDRESS; - status = ath6kl_bmi_reg_write(ar, address, param); - if (status) - return status; - - address = GPIO_BASE_ADDRESS + GPIO_PIN11_ADDRESS; - status = ath6kl_bmi_reg_write(ar, address, param); - if (status) - return status; - - address = GPIO_BASE_ADDRESS + GPIO_PIN12_ADDRESS; - status = ath6kl_bmi_reg_write(ar, address, param); - if (status) - return status; - - address = GPIO_BASE_ADDRESS + GPIO_PIN13_ADDRESS; - status = ath6kl_bmi_reg_write(ar, address, param); - if (status) - return status; - } - - /* write EEPROM data to Target RAM */ - status = ath6kl_upload_board_file(ar); - if (status) - return status; - - /* transfer One time Programmable data */ - status = ath6kl_upload_otp(ar); - if (status) - return status; - - /* Download Target firmware */ - status = ath6kl_upload_firmware(ar); - if (status) - return status; - - status = ath6kl_upload_patch(ar); - if (status) - return status; - - /* Download the test script */ - status = ath6kl_upload_testscript(ar); - if (status) - return status; - - /* Restore system sleep */ - address = RTC_BASE_ADDRESS + SYSTEM_SLEEP_ADDRESS; - status = ath6kl_bmi_reg_write(ar, address, sleep); - if (status) - return status; - - address = MBOX_BASE_ADDRESS + LOCAL_SCRATCH_ADDRESS; - param = options | 0x20; - status = ath6kl_bmi_reg_write(ar, address, param); - if (status) - return status; - - return status; -} - -int ath6kl_init_hw_params(struct ath6kl *ar) -{ - const struct ath6kl_hw *uninitialized_var(hw); - int i; - - for (i = 0; i < ARRAY_SIZE(hw_list); i++) { - hw = &hw_list[i]; - - if (hw->id == ar->version.target_ver) - break; - } - - if (i == ARRAY_SIZE(hw_list)) { - ath6kl_err("Unsupported hardware version: 0x%x\n", - ar->version.target_ver); - return -EINVAL; - } - - ar->hw = *hw; - - ath6kl_dbg(ATH6KL_DBG_BOOT, - "target_ver 0x%x target_type 0x%x dataset_patch 0x%x app_load_addr 0x%x\n", - ar->version.target_ver, ar->target_type, - ar->hw.dataset_patch_addr, ar->hw.app_load_addr); - ath6kl_dbg(ATH6KL_DBG_BOOT, - "app_start_override_addr 0x%x board_ext_data_addr 0x%x reserved_ram_size 0x%x", - ar->hw.app_start_override_addr, ar->hw.board_ext_data_addr, - ar->hw.reserved_ram_size); - ath6kl_dbg(ATH6KL_DBG_BOOT, - "refclk_hz %d uarttx_pin %d", - ar->hw.refclk_hz, ar->hw.uarttx_pin); - - return 0; -} - -static const char *ath6kl_init_get_hif_name(enum ath6kl_hif_type type) -{ - switch (type) { - case ATH6KL_HIF_TYPE_SDIO: - return "sdio"; - case ATH6KL_HIF_TYPE_USB: - return "usb"; - } - - return NULL; -} - - -static const struct fw_capa_str_map { - int id; - const char *name; -} fw_capa_map[] = { - { ATH6KL_FW_CAPABILITY_HOST_P2P, "host-p2p" }, - { ATH6KL_FW_CAPABILITY_SCHED_SCAN, "sched-scan" }, - { ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX, "sta-p2pdev-duplex" }, - { ATH6KL_FW_CAPABILITY_INACTIVITY_TIMEOUT, "inactivity-timeout" }, - { ATH6KL_FW_CAPABILITY_RSN_CAP_OVERRIDE, "rsn-cap-override" }, - { ATH6KL_FW_CAPABILITY_WOW_MULTICAST_FILTER, "wow-mc-filter" }, - { ATH6KL_FW_CAPABILITY_BMISS_ENHANCE, "bmiss-enhance" }, - { ATH6KL_FW_CAPABILITY_SCHED_SCAN_MATCH_LIST, "sscan-match-list" }, - { ATH6KL_FW_CAPABILITY_RSSI_SCAN_THOLD, "rssi-scan-thold" }, - { ATH6KL_FW_CAPABILITY_CUSTOM_MAC_ADDR, "custom-mac-addr" }, - { ATH6KL_FW_CAPABILITY_TX_ERR_NOTIFY, "tx-err-notify" }, - { ATH6KL_FW_CAPABILITY_REGDOMAIN, "regdomain" }, - { ATH6KL_FW_CAPABILITY_SCHED_SCAN_V2, "sched-scan-v2" }, - { ATH6KL_FW_CAPABILITY_HEART_BEAT_POLL, "hb-poll" }, -}; - -static const char *ath6kl_init_get_fw_capa_name(unsigned int id) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(fw_capa_map); i++) { - if (fw_capa_map[i].id == id) - return fw_capa_map[i].name; - } - - return ""; -} - -static void ath6kl_init_get_fwcaps(struct ath6kl *ar, char *buf, size_t buf_len) -{ - u8 *data = (u8 *) ar->fw_capabilities; - size_t trunc_len, len = 0; - int i, index, bit; - char *trunc = "..."; - - for (i = 0; i < ATH6KL_FW_CAPABILITY_MAX; i++) { - index = i / 8; - bit = i % 8; - - if (index >= sizeof(ar->fw_capabilities) * 4) - break; - - if (buf_len - len < 4) { - ath6kl_warn("firmware capability buffer too small!\n"); - - /* add "..." to the end of string */ - trunc_len = strlen(trunc) + 1; - strncpy(buf + buf_len - trunc_len, trunc, trunc_len); - - return; - } - - if (data[index] & (1 << bit)) { - len += scnprintf(buf + len, buf_len - len, "%s,", - ath6kl_init_get_fw_capa_name(i)); - } - } - - /* overwrite the last comma */ - if (len > 0) - len--; - - buf[len] = '\0'; -} - -static int ath6kl_init_hw_reset(struct ath6kl *ar) -{ - ath6kl_dbg(ATH6KL_DBG_BOOT, "cold resetting the device"); - - return ath6kl_diag_write32(ar, RESET_CONTROL_ADDRESS, - cpu_to_le32(RESET_CONTROL_COLD_RST)); -} - -static int __ath6kl_init_hw_start(struct ath6kl *ar) -{ - long timeleft; - int ret, i; - char buf[200]; - - ath6kl_dbg(ATH6KL_DBG_BOOT, "hw start\n"); - - ret = ath6kl_hif_power_on(ar); - if (ret) - return ret; - - ret = ath6kl_configure_target(ar); - if (ret) - goto err_power_off; - - ret = ath6kl_init_upload(ar); - if (ret) - goto err_power_off; - - /* Do we need to finish the BMI phase */ - ret = ath6kl_bmi_done(ar); - if (ret) - goto err_power_off; - - /* - * The reason we have to wait for the target here is that the - * driver layer has to init BMI in order to set the host block - * size. - */ - ret = ath6kl_htc_wait_target(ar->htc_target); - - if (ret == -ETIMEDOUT) { - /* - * Most likely USB target is in odd state after reboot and - * needs a reset. A cold reset makes the whole device - * disappear from USB bus and initialisation starts from - * beginning. - */ - ath6kl_warn("htc wait target timed out, resetting device\n"); - ath6kl_init_hw_reset(ar); - goto err_power_off; - } else if (ret) { - ath6kl_err("htc wait target failed: %d\n", ret); - goto err_power_off; - } - - ret = ath6kl_init_service_ep(ar); - if (ret) { - ath6kl_err("Endpoint service initilisation failed: %d\n", ret); - goto err_cleanup_scatter; - } - - /* setup credit distribution */ - ath6kl_htc_credit_setup(ar->htc_target, &ar->credit_state_info); - - /* start HTC */ - ret = ath6kl_htc_start(ar->htc_target); - if (ret) { - /* FIXME: call this */ - ath6kl_cookie_cleanup(ar); - goto err_cleanup_scatter; - } - - /* Wait for Wmi event to be ready */ - timeleft = wait_event_interruptible_timeout(ar->event_wq, - test_bit(WMI_READY, - &ar->flag), - WMI_TIMEOUT); - - ath6kl_dbg(ATH6KL_DBG_BOOT, "firmware booted\n"); - - - if (test_and_clear_bit(FIRST_BOOT, &ar->flag)) { - ath6kl_info("%s %s fw %s api %d%s\n", - ar->hw.name, - ath6kl_init_get_hif_name(ar->hif_type), - ar->wiphy->fw_version, - ar->fw_api, - test_bit(TESTMODE, &ar->flag) ? " testmode" : ""); - ath6kl_init_get_fwcaps(ar, buf, sizeof(buf)); - ath6kl_info("firmware supports: %s\n", buf); - } - - if (ar->version.abi_ver != ATH6KL_ABI_VERSION) { - ath6kl_err("abi version mismatch: host(0x%x), target(0x%x)\n", - ATH6KL_ABI_VERSION, ar->version.abi_ver); - ret = -EIO; - goto err_htc_stop; - } - - if (!timeleft || signal_pending(current)) { - ath6kl_err("wmi is not ready or wait was interrupted\n"); - ret = -EIO; - goto err_htc_stop; - } - - ath6kl_dbg(ATH6KL_DBG_TRC, "%s: wmi is ready\n", __func__); - - /* communicate the wmi protocol verision to the target */ - /* FIXME: return error */ - if ((ath6kl_set_host_app_area(ar)) != 0) - ath6kl_err("unable to set the host app area\n"); - - for (i = 0; i < ar->vif_max; i++) { - ret = ath6kl_target_config_wlan_params(ar, i); - if (ret) - goto err_htc_stop; - } - - return 0; - -err_htc_stop: - ath6kl_htc_stop(ar->htc_target); -err_cleanup_scatter: - ath6kl_hif_cleanup_scatter(ar); -err_power_off: - ath6kl_hif_power_off(ar); - - return ret; -} - -int ath6kl_init_hw_start(struct ath6kl *ar) -{ - int err; - - err = __ath6kl_init_hw_start(ar); - if (err) - return err; - ar->state = ATH6KL_STATE_ON; - return 0; -} - -static int __ath6kl_init_hw_stop(struct ath6kl *ar) -{ - int ret; - - ath6kl_dbg(ATH6KL_DBG_BOOT, "hw stop\n"); - - ath6kl_htc_stop(ar->htc_target); - - ath6kl_hif_stop(ar); - - ath6kl_bmi_reset(ar); - - ret = ath6kl_hif_power_off(ar); - if (ret) - ath6kl_warn("failed to power off hif: %d\n", ret); - - return 0; -} - -int ath6kl_init_hw_stop(struct ath6kl *ar) -{ - int err; - - err = __ath6kl_init_hw_stop(ar); - if (err) - return err; - ar->state = ATH6KL_STATE_OFF; - return 0; -} - -void ath6kl_init_hw_restart(struct ath6kl *ar) -{ - clear_bit(WMI_READY, &ar->flag); - - ath6kl_cfg80211_stop_all(ar); - - if (__ath6kl_init_hw_stop(ar)) { - ath6kl_dbg(ATH6KL_DBG_RECOVERY, "Failed to stop during fw error recovery\n"); - return; - } - - if (__ath6kl_init_hw_start(ar)) { - ath6kl_dbg(ATH6KL_DBG_RECOVERY, "Failed to restart during fw error recovery\n"); - return; - } -} - -void ath6kl_stop_txrx(struct ath6kl *ar) -{ - struct ath6kl_vif *vif, *tmp_vif; - int i; - - set_bit(DESTROY_IN_PROGRESS, &ar->flag); - - if (down_interruptible(&ar->sem)) { - ath6kl_err("down_interruptible failed\n"); - return; - } - - for (i = 0; i < AP_MAX_NUM_STA; i++) - aggr_reset_state(ar->sta_list[i].aggr_conn); - - spin_lock_bh(&ar->list_lock); - list_for_each_entry_safe(vif, tmp_vif, &ar->vif_list, list) { - list_del(&vif->list); - spin_unlock_bh(&ar->list_lock); - ath6kl_cfg80211_vif_stop(vif, test_bit(WMI_READY, &ar->flag)); - rtnl_lock(); - ath6kl_cfg80211_vif_cleanup(vif); - rtnl_unlock(); - spin_lock_bh(&ar->list_lock); - } - spin_unlock_bh(&ar->list_lock); - - clear_bit(WMI_READY, &ar->flag); - - /* - * After wmi_shudown all WMI events will be dropped. We - * need to cleanup the buffers allocated in AP mode and - * give disconnect notification to stack, which usually - * happens in the disconnect_event. Simulate the disconnect - * event by calling the function directly. Sometimes - * disconnect_event will be received when the debug logs - * are collected. - */ - ath6kl_wmi_shutdown(ar->wmi); - - clear_bit(WMI_ENABLED, &ar->flag); - if (ar->htc_target) { - ath6kl_dbg(ATH6KL_DBG_TRC, "%s: shut down htc\n", __func__); - ath6kl_htc_stop(ar->htc_target); - } - - /* - * Try to reset the device if we can. The driver may have been - * configure NOT to reset the target during a debug session. - */ - ath6kl_init_hw_reset(ar); - - up(&ar->sem); -} -EXPORT_SYMBOL(ath6kl_stop_txrx); diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c deleted file mode 100644 index d4fcfcad57d0..000000000000 --- a/drivers/net/wireless/ath/ath6kl/main.c +++ /dev/null @@ -1,1306 +0,0 @@ -/* - * Copyright (c) 2004-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include "core.h" -#include "hif-ops.h" -#include "cfg80211.h" -#include "target.h" -#include "debug.h" - -struct ath6kl_sta *ath6kl_find_sta(struct ath6kl_vif *vif, u8 *node_addr) -{ - struct ath6kl *ar = vif->ar; - struct ath6kl_sta *conn = NULL; - u8 i, max_conn; - - max_conn = (vif->nw_type == AP_NETWORK) ? AP_MAX_NUM_STA : 0; - - for (i = 0; i < max_conn; i++) { - if (memcmp(node_addr, ar->sta_list[i].mac, ETH_ALEN) == 0) { - conn = &ar->sta_list[i]; - break; - } - } - - return conn; -} - -struct ath6kl_sta *ath6kl_find_sta_by_aid(struct ath6kl *ar, u8 aid) -{ - struct ath6kl_sta *conn = NULL; - u8 ctr; - - for (ctr = 0; ctr < AP_MAX_NUM_STA; ctr++) { - if (ar->sta_list[ctr].aid == aid) { - conn = &ar->sta_list[ctr]; - break; - } - } - return conn; -} - -static void ath6kl_add_new_sta(struct ath6kl_vif *vif, u8 *mac, u16 aid, - u8 *wpaie, size_t ielen, u8 keymgmt, - u8 ucipher, u8 auth, u8 apsd_info) -{ - struct ath6kl *ar = vif->ar; - struct ath6kl_sta *sta; - u8 free_slot; - - free_slot = aid - 1; - - sta = &ar->sta_list[free_slot]; - memcpy(sta->mac, mac, ETH_ALEN); - if (ielen <= ATH6KL_MAX_IE) - memcpy(sta->wpa_ie, wpaie, ielen); - sta->aid = aid; - sta->keymgmt = keymgmt; - sta->ucipher = ucipher; - sta->auth = auth; - sta->apsd_info = apsd_info; - - ar->sta_list_index = ar->sta_list_index | (1 << free_slot); - ar->ap_stats.sta[free_slot].aid = cpu_to_le32(aid); - aggr_conn_init(vif, vif->aggr_cntxt, sta->aggr_conn); -} - -static void ath6kl_sta_cleanup(struct ath6kl *ar, u8 i) -{ - struct ath6kl_sta *sta = &ar->sta_list[i]; - struct ath6kl_mgmt_buff *entry, *tmp; - - /* empty the queued pkts in the PS queue if any */ - spin_lock_bh(&sta->psq_lock); - skb_queue_purge(&sta->psq); - skb_queue_purge(&sta->apsdq); - - if (sta->mgmt_psq_len != 0) { - list_for_each_entry_safe(entry, tmp, &sta->mgmt_psq, list) { - kfree(entry); - } - INIT_LIST_HEAD(&sta->mgmt_psq); - sta->mgmt_psq_len = 0; - } - - spin_unlock_bh(&sta->psq_lock); - - memset(&ar->ap_stats.sta[sta->aid - 1], 0, - sizeof(struct wmi_per_sta_stat)); - memset(sta->mac, 0, ETH_ALEN); - memset(sta->wpa_ie, 0, ATH6KL_MAX_IE); - sta->aid = 0; - sta->sta_flags = 0; - - ar->sta_list_index = ar->sta_list_index & ~(1 << i); - aggr_reset_state(sta->aggr_conn); -} - -static u8 ath6kl_remove_sta(struct ath6kl *ar, u8 *mac, u16 reason) -{ - u8 i, removed = 0; - - if (is_zero_ether_addr(mac)) - return removed; - - if (is_broadcast_ether_addr(mac)) { - ath6kl_dbg(ATH6KL_DBG_TRC, "deleting all station\n"); - - for (i = 0; i < AP_MAX_NUM_STA; i++) { - if (!is_zero_ether_addr(ar->sta_list[i].mac)) { - ath6kl_sta_cleanup(ar, i); - removed = 1; - } - } - } else { - for (i = 0; i < AP_MAX_NUM_STA; i++) { - if (memcmp(ar->sta_list[i].mac, mac, ETH_ALEN) == 0) { - ath6kl_dbg(ATH6KL_DBG_TRC, - "deleting station %pM aid=%d reason=%d\n", - mac, ar->sta_list[i].aid, reason); - ath6kl_sta_cleanup(ar, i); - removed = 1; - break; - } - } - } - - return removed; -} - -enum htc_endpoint_id ath6kl_ac2_endpoint_id(void *devt, u8 ac) -{ - struct ath6kl *ar = devt; - return ar->ac2ep_map[ac]; -} - -struct ath6kl_cookie *ath6kl_alloc_cookie(struct ath6kl *ar) -{ - struct ath6kl_cookie *cookie; - - cookie = ar->cookie_list; - if (cookie != NULL) { - ar->cookie_list = cookie->arc_list_next; - ar->cookie_count--; - } - - return cookie; -} - -void ath6kl_cookie_init(struct ath6kl *ar) -{ - u32 i; - - ar->cookie_list = NULL; - ar->cookie_count = 0; - - memset(ar->cookie_mem, 0, sizeof(ar->cookie_mem)); - - for (i = 0; i < MAX_COOKIE_NUM; i++) - ath6kl_free_cookie(ar, &ar->cookie_mem[i]); -} - -void ath6kl_cookie_cleanup(struct ath6kl *ar) -{ - ar->cookie_list = NULL; - ar->cookie_count = 0; -} - -void ath6kl_free_cookie(struct ath6kl *ar, struct ath6kl_cookie *cookie) -{ - /* Insert first */ - - if (!ar || !cookie) - return; - - cookie->arc_list_next = ar->cookie_list; - ar->cookie_list = cookie; - ar->cookie_count++; -} - -/* - * Read from the hardware through its diagnostic window. No cooperation - * from the firmware is required for this. - */ -int ath6kl_diag_read32(struct ath6kl *ar, u32 address, u32 *value) -{ - int ret; - - ret = ath6kl_hif_diag_read32(ar, address, value); - if (ret) { - ath6kl_warn("failed to read32 through diagnose window: %d\n", - ret); - return ret; - } - - return 0; -} - -/* - * Write to the ATH6KL through its diagnostic window. No cooperation from - * the Target is required for this. - */ -int ath6kl_diag_write32(struct ath6kl *ar, u32 address, __le32 value) -{ - int ret; - - ret = ath6kl_hif_diag_write32(ar, address, value); - - if (ret) { - ath6kl_err("failed to write 0x%x during diagnose window to 0x%d\n", - address, value); - return ret; - } - - return 0; -} - -int ath6kl_diag_read(struct ath6kl *ar, u32 address, void *data, u32 length) -{ - u32 count, *buf = data; - int ret; - - if (WARN_ON(length % 4)) - return -EINVAL; - - for (count = 0; count < length / 4; count++, address += 4) { - ret = ath6kl_diag_read32(ar, address, &buf[count]); - if (ret) - return ret; - } - - return 0; -} - -int ath6kl_diag_write(struct ath6kl *ar, u32 address, void *data, u32 length) -{ - u32 count; - __le32 *buf = data; - int ret; - - if (WARN_ON(length % 4)) - return -EINVAL; - - for (count = 0; count < length / 4; count++, address += 4) { - ret = ath6kl_diag_write32(ar, address, buf[count]); - if (ret) - return ret; - } - - return 0; -} - -int ath6kl_read_fwlogs(struct ath6kl *ar) -{ - struct ath6kl_dbglog_hdr debug_hdr; - struct ath6kl_dbglog_buf debug_buf; - u32 address, length, dropped, firstbuf, debug_hdr_addr; - int ret, loop; - u8 *buf; - - buf = kmalloc(ATH6KL_FWLOG_PAYLOAD_SIZE, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - address = TARG_VTOP(ar->target_type, - ath6kl_get_hi_item_addr(ar, - HI_ITEM(hi_dbglog_hdr))); - - ret = ath6kl_diag_read32(ar, address, &debug_hdr_addr); - if (ret) - goto out; - - /* Get the contents of the ring buffer */ - if (debug_hdr_addr == 0) { - ath6kl_warn("Invalid address for debug_hdr_addr\n"); - ret = -EINVAL; - goto out; - } - - address = TARG_VTOP(ar->target_type, debug_hdr_addr); - ret = ath6kl_diag_read(ar, address, &debug_hdr, sizeof(debug_hdr)); - if (ret) - goto out; - - address = TARG_VTOP(ar->target_type, - le32_to_cpu(debug_hdr.dbuf_addr)); - firstbuf = address; - dropped = le32_to_cpu(debug_hdr.dropped); - ret = ath6kl_diag_read(ar, address, &debug_buf, sizeof(debug_buf)); - if (ret) - goto out; - - loop = 100; - - do { - address = TARG_VTOP(ar->target_type, - le32_to_cpu(debug_buf.buffer_addr)); - length = le32_to_cpu(debug_buf.length); - - if (length != 0 && (le32_to_cpu(debug_buf.length) <= - le32_to_cpu(debug_buf.bufsize))) { - length = ALIGN(length, 4); - - ret = ath6kl_diag_read(ar, address, - buf, length); - if (ret) - goto out; - - ath6kl_debug_fwlog_event(ar, buf, length); - } - - address = TARG_VTOP(ar->target_type, - le32_to_cpu(debug_buf.next)); - ret = ath6kl_diag_read(ar, address, &debug_buf, - sizeof(debug_buf)); - if (ret) - goto out; - - loop--; - - if (WARN_ON(loop == 0)) { - ret = -ETIMEDOUT; - goto out; - } - } while (address != firstbuf); - -out: - kfree(buf); - - return ret; -} - -static void ath6kl_install_static_wep_keys(struct ath6kl_vif *vif) -{ - u8 index; - u8 keyusage; - - for (index = 0; index <= WMI_MAX_KEY_INDEX; index++) { - if (vif->wep_key_list[index].key_len) { - keyusage = GROUP_USAGE; - if (index == vif->def_txkey_index) - keyusage |= TX_USAGE; - - ath6kl_wmi_addkey_cmd(vif->ar->wmi, vif->fw_vif_idx, - index, - WEP_CRYPT, - keyusage, - vif->wep_key_list[index].key_len, - NULL, 0, - vif->wep_key_list[index].key, - KEY_OP_INIT_VAL, NULL, - NO_SYNC_WMIFLAG); - } - } -} - -void ath6kl_connect_ap_mode_bss(struct ath6kl_vif *vif, u16 channel) -{ - struct ath6kl *ar = vif->ar; - struct ath6kl_req_key *ik; - int res; - u8 key_rsc[ATH6KL_KEY_SEQ_LEN]; - - ik = &ar->ap_mode_bkey; - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "AP mode started on %u MHz\n", channel); - - switch (vif->auth_mode) { - case NONE_AUTH: - if (vif->prwise_crypto == WEP_CRYPT) - ath6kl_install_static_wep_keys(vif); - if (!ik->valid || ik->key_type != WAPI_CRYPT) - break; - /* for WAPI, we need to set the delayed group key, continue: */ - case WPA_PSK_AUTH: - case WPA2_PSK_AUTH: - case (WPA_PSK_AUTH | WPA2_PSK_AUTH): - if (!ik->valid) - break; - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "Delayed addkey for the initial group key for AP mode\n"); - memset(key_rsc, 0, sizeof(key_rsc)); - res = ath6kl_wmi_addkey_cmd( - ar->wmi, vif->fw_vif_idx, ik->key_index, ik->key_type, - GROUP_USAGE, ik->key_len, key_rsc, ATH6KL_KEY_SEQ_LEN, - ik->key, - KEY_OP_INIT_VAL, NULL, SYNC_BOTH_WMIFLAG); - if (res) { - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, - "Delayed addkey failed: %d\n", res); - } - break; - } - - if (ar->last_ch != channel) - /* we actually don't know the phymode, default to HT20 */ - ath6kl_cfg80211_ch_switch_notify(vif, channel, WMI_11G_HT20); - - ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, NONE_BSS_FILTER, 0); - set_bit(CONNECTED, &vif->flags); - netif_carrier_on(vif->ndev); -} - -void ath6kl_connect_ap_mode_sta(struct ath6kl_vif *vif, u16 aid, u8 *mac_addr, - u8 keymgmt, u8 ucipher, u8 auth, - u8 assoc_req_len, u8 *assoc_info, u8 apsd_info) -{ - u8 *ies = NULL, *wpa_ie = NULL, *pos; - size_t ies_len = 0; - struct station_info sinfo; - - ath6kl_dbg(ATH6KL_DBG_TRC, "new station %pM aid=%d\n", mac_addr, aid); - - if (assoc_req_len > sizeof(struct ieee80211_hdr_3addr)) { - struct ieee80211_mgmt *mgmt = - (struct ieee80211_mgmt *) assoc_info; - if (ieee80211_is_assoc_req(mgmt->frame_control) && - assoc_req_len >= sizeof(struct ieee80211_hdr_3addr) + - sizeof(mgmt->u.assoc_req)) { - ies = mgmt->u.assoc_req.variable; - ies_len = assoc_info + assoc_req_len - ies; - } else if (ieee80211_is_reassoc_req(mgmt->frame_control) && - assoc_req_len >= sizeof(struct ieee80211_hdr_3addr) - + sizeof(mgmt->u.reassoc_req)) { - ies = mgmt->u.reassoc_req.variable; - ies_len = assoc_info + assoc_req_len - ies; - } - } - - pos = ies; - while (pos && pos + 1 < ies + ies_len) { - if (pos + 2 + pos[1] > ies + ies_len) - break; - if (pos[0] == WLAN_EID_RSN) - wpa_ie = pos; /* RSN IE */ - else if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && - pos[1] >= 4 && - pos[2] == 0x00 && pos[3] == 0x50 && pos[4] == 0xf2) { - if (pos[5] == 0x01) - wpa_ie = pos; /* WPA IE */ - else if (pos[5] == 0x04) { - wpa_ie = pos; /* WPS IE */ - break; /* overrides WPA/RSN IE */ - } - } else if (pos[0] == 0x44 && wpa_ie == NULL) { - /* - * Note: WAPI Parameter Set IE re-uses Element ID that - * was officially allocated for BSS AC Access Delay. As - * such, we need to be a bit more careful on when - * parsing the frame. However, BSS AC Access Delay - * element is not supposed to be included in - * (Re)Association Request frames, so this should not - * cause problems. - */ - wpa_ie = pos; /* WAPI IE */ - break; - } - pos += 2 + pos[1]; - } - - ath6kl_add_new_sta(vif, mac_addr, aid, wpa_ie, - wpa_ie ? 2 + wpa_ie[1] : 0, - keymgmt, ucipher, auth, apsd_info); - - /* send event to application */ - memset(&sinfo, 0, sizeof(sinfo)); - - /* TODO: sinfo.generation */ - - sinfo.assoc_req_ies = ies; - sinfo.assoc_req_ies_len = ies_len; - sinfo.filled |= STATION_INFO_ASSOC_REQ_IES; - - cfg80211_new_sta(vif->ndev, mac_addr, &sinfo, GFP_KERNEL); - - netif_wake_queue(vif->ndev); -} - -void disconnect_timer_handler(unsigned long ptr) -{ - struct net_device *dev = (struct net_device *)ptr; - struct ath6kl_vif *vif = netdev_priv(dev); - - ath6kl_init_profile_info(vif); - ath6kl_disconnect(vif); -} - -void ath6kl_disconnect(struct ath6kl_vif *vif) -{ - if (test_bit(CONNECTED, &vif->flags) || - test_bit(CONNECT_PEND, &vif->flags)) { - ath6kl_wmi_disconnect_cmd(vif->ar->wmi, vif->fw_vif_idx); - /* - * Disconnect command is issued, clear the connect pending - * flag. The connected flag will be cleared in - * disconnect event notification. - */ - clear_bit(CONNECT_PEND, &vif->flags); - } -} - -/* WMI Event handlers */ - -void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver, - enum wmi_phy_cap cap) -{ - struct ath6kl *ar = devt; - - memcpy(ar->mac_addr, datap, ETH_ALEN); - - ath6kl_dbg(ATH6KL_DBG_BOOT, - "ready event mac addr %pM sw_ver 0x%x abi_ver 0x%x cap 0x%x\n", - ar->mac_addr, sw_ver, abi_ver, cap); - - ar->version.wlan_ver = sw_ver; - ar->version.abi_ver = abi_ver; - ar->hw.cap = cap; - - if (strlen(ar->wiphy->fw_version) == 0) { - snprintf(ar->wiphy->fw_version, - sizeof(ar->wiphy->fw_version), - "%u.%u.%u.%u", - (ar->version.wlan_ver & 0xf0000000) >> 28, - (ar->version.wlan_ver & 0x0f000000) >> 24, - (ar->version.wlan_ver & 0x00ff0000) >> 16, - (ar->version.wlan_ver & 0x0000ffff)); - } - - /* indicate to the waiting thread that the ready event was received */ - set_bit(WMI_READY, &ar->flag); - wake_up(&ar->event_wq); -} - -void ath6kl_scan_complete_evt(struct ath6kl_vif *vif, int status) -{ - struct ath6kl *ar = vif->ar; - bool aborted = false; - - if (status != WMI_SCAN_STATUS_SUCCESS) - aborted = true; - - ath6kl_cfg80211_scan_complete_event(vif, aborted); - - if (!ar->usr_bss_filter) { - clear_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags); - ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, - NONE_BSS_FILTER, 0); - } - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "scan complete: %d\n", status); -} - -static int ath6kl_commit_ch_switch(struct ath6kl_vif *vif, u16 channel) -{ - - struct ath6kl *ar = vif->ar; - - vif->profile.ch = cpu_to_le16(channel); - - switch (vif->nw_type) { - case AP_NETWORK: - /* - * reconfigure any saved RSN IE capabilites in the beacon / - * probe response to stay in sync with the supplicant. - */ - if (vif->rsn_capab && - test_bit(ATH6KL_FW_CAPABILITY_RSN_CAP_OVERRIDE, - ar->fw_capabilities)) - ath6kl_wmi_set_ie_cmd(ar->wmi, vif->fw_vif_idx, - WLAN_EID_RSN, WMI_RSN_IE_CAPB, - (const u8 *) &vif->rsn_capab, - sizeof(vif->rsn_capab)); - - return ath6kl_wmi_ap_profile_commit(ar->wmi, vif->fw_vif_idx, - &vif->profile); - default: - ath6kl_err("won't switch channels nw_type=%d\n", vif->nw_type); - return -ENOTSUPP; - } -} - -static void ath6kl_check_ch_switch(struct ath6kl *ar, u16 channel) -{ - - struct ath6kl_vif *vif; - int res = 0; - - if (!ar->want_ch_switch) - return; - - spin_lock_bh(&ar->list_lock); - list_for_each_entry(vif, &ar->vif_list, list) { - if (ar->want_ch_switch & (1 << vif->fw_vif_idx)) - res = ath6kl_commit_ch_switch(vif, channel); - - /* if channel switch failed, oh well we tried */ - ar->want_ch_switch &= ~(1 << vif->fw_vif_idx); - - if (res) - ath6kl_err("channel switch failed nw_type %d res %d\n", - vif->nw_type, res); - } - spin_unlock_bh(&ar->list_lock); -} - -void ath6kl_connect_event(struct ath6kl_vif *vif, u16 channel, u8 *bssid, - u16 listen_int, u16 beacon_int, - enum network_type net_type, u8 beacon_ie_len, - u8 assoc_req_len, u8 assoc_resp_len, - u8 *assoc_info) -{ - struct ath6kl *ar = vif->ar; - - ath6kl_cfg80211_connect_event(vif, channel, bssid, - listen_int, beacon_int, - net_type, beacon_ie_len, - assoc_req_len, assoc_resp_len, - assoc_info); - - memcpy(vif->bssid, bssid, sizeof(vif->bssid)); - vif->bss_ch = channel; - - if ((vif->nw_type == INFRA_NETWORK)) { - ath6kl_wmi_listeninterval_cmd(ar->wmi, vif->fw_vif_idx, - vif->listen_intvl_t, 0); - ath6kl_check_ch_switch(ar, channel); - } - - netif_wake_queue(vif->ndev); - - /* Update connect & link status atomically */ - spin_lock_bh(&vif->if_lock); - set_bit(CONNECTED, &vif->flags); - clear_bit(CONNECT_PEND, &vif->flags); - netif_carrier_on(vif->ndev); - spin_unlock_bh(&vif->if_lock); - - aggr_reset_state(vif->aggr_cntxt->aggr_conn); - vif->reconnect_flag = 0; - - if ((vif->nw_type == ADHOC_NETWORK) && ar->ibss_ps_enable) { - memset(ar->node_map, 0, sizeof(ar->node_map)); - ar->node_num = 0; - ar->next_ep_id = ENDPOINT_2; - } - - if (!ar->usr_bss_filter) { - set_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags); - ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, - CURRENT_BSS_FILTER, 0); - } -} - -void ath6kl_tkip_micerr_event(struct ath6kl_vif *vif, u8 keyid, bool ismcast) -{ - struct ath6kl_sta *sta; - struct ath6kl *ar = vif->ar; - u8 tsc[6]; - - /* - * For AP case, keyid will have aid of STA which sent pkt with - * MIC error. Use this aid to get MAC & send it to hostapd. - */ - if (vif->nw_type == AP_NETWORK) { - sta = ath6kl_find_sta_by_aid(ar, (keyid >> 2)); - if (!sta) - return; - - ath6kl_dbg(ATH6KL_DBG_TRC, - "ap tkip mic error received from aid=%d\n", keyid); - - memset(tsc, 0, sizeof(tsc)); /* FIX: get correct TSC */ - cfg80211_michael_mic_failure(vif->ndev, sta->mac, - NL80211_KEYTYPE_PAIRWISE, keyid, - tsc, GFP_KERNEL); - } else - ath6kl_cfg80211_tkip_micerr_event(vif, keyid, ismcast); - -} - -static void ath6kl_update_target_stats(struct ath6kl_vif *vif, u8 *ptr, u32 len) -{ - struct wmi_target_stats *tgt_stats = - (struct wmi_target_stats *) ptr; - struct ath6kl *ar = vif->ar; - struct target_stats *stats = &vif->target_stats; - struct tkip_ccmp_stats *ccmp_stats; - u8 ac; - - if (len < sizeof(*tgt_stats)) - return; - - ath6kl_dbg(ATH6KL_DBG_TRC, "updating target stats\n"); - - stats->tx_pkt += le32_to_cpu(tgt_stats->stats.tx.pkt); - stats->tx_byte += le32_to_cpu(tgt_stats->stats.tx.byte); - stats->tx_ucast_pkt += le32_to_cpu(tgt_stats->stats.tx.ucast_pkt); - stats->tx_ucast_byte += le32_to_cpu(tgt_stats->stats.tx.ucast_byte); - stats->tx_mcast_pkt += le32_to_cpu(tgt_stats->stats.tx.mcast_pkt); - stats->tx_mcast_byte += le32_to_cpu(tgt_stats->stats.tx.mcast_byte); - stats->tx_bcast_pkt += le32_to_cpu(tgt_stats->stats.tx.bcast_pkt); - stats->tx_bcast_byte += le32_to_cpu(tgt_stats->stats.tx.bcast_byte); - stats->tx_rts_success_cnt += - le32_to_cpu(tgt_stats->stats.tx.rts_success_cnt); - - for (ac = 0; ac < WMM_NUM_AC; ac++) - stats->tx_pkt_per_ac[ac] += - le32_to_cpu(tgt_stats->stats.tx.pkt_per_ac[ac]); - - stats->tx_err += le32_to_cpu(tgt_stats->stats.tx.err); - stats->tx_fail_cnt += le32_to_cpu(tgt_stats->stats.tx.fail_cnt); - stats->tx_retry_cnt += le32_to_cpu(tgt_stats->stats.tx.retry_cnt); - stats->tx_mult_retry_cnt += - le32_to_cpu(tgt_stats->stats.tx.mult_retry_cnt); - stats->tx_rts_fail_cnt += - le32_to_cpu(tgt_stats->stats.tx.rts_fail_cnt); - stats->tx_ucast_rate = - ath6kl_wmi_get_rate(a_sle32_to_cpu(tgt_stats->stats.tx.ucast_rate)); - - stats->rx_pkt += le32_to_cpu(tgt_stats->stats.rx.pkt); - stats->rx_byte += le32_to_cpu(tgt_stats->stats.rx.byte); - stats->rx_ucast_pkt += le32_to_cpu(tgt_stats->stats.rx.ucast_pkt); - stats->rx_ucast_byte += le32_to_cpu(tgt_stats->stats.rx.ucast_byte); - stats->rx_mcast_pkt += le32_to_cpu(tgt_stats->stats.rx.mcast_pkt); - stats->rx_mcast_byte += le32_to_cpu(tgt_stats->stats.rx.mcast_byte); - stats->rx_bcast_pkt += le32_to_cpu(tgt_stats->stats.rx.bcast_pkt); - stats->rx_bcast_byte += le32_to_cpu(tgt_stats->stats.rx.bcast_byte); - stats->rx_frgment_pkt += le32_to_cpu(tgt_stats->stats.rx.frgment_pkt); - stats->rx_err += le32_to_cpu(tgt_stats->stats.rx.err); - stats->rx_crc_err += le32_to_cpu(tgt_stats->stats.rx.crc_err); - stats->rx_key_cache_miss += - le32_to_cpu(tgt_stats->stats.rx.key_cache_miss); - stats->rx_decrypt_err += le32_to_cpu(tgt_stats->stats.rx.decrypt_err); - stats->rx_dupl_frame += le32_to_cpu(tgt_stats->stats.rx.dupl_frame); - stats->rx_ucast_rate = - ath6kl_wmi_get_rate(a_sle32_to_cpu(tgt_stats->stats.rx.ucast_rate)); - - ccmp_stats = &tgt_stats->stats.tkip_ccmp_stats; - - stats->tkip_local_mic_fail += - le32_to_cpu(ccmp_stats->tkip_local_mic_fail); - stats->tkip_cnter_measures_invoked += - le32_to_cpu(ccmp_stats->tkip_cnter_measures_invoked); - stats->tkip_fmt_err += le32_to_cpu(ccmp_stats->tkip_fmt_err); - - stats->ccmp_fmt_err += le32_to_cpu(ccmp_stats->ccmp_fmt_err); - stats->ccmp_replays += le32_to_cpu(ccmp_stats->ccmp_replays); - - stats->pwr_save_fail_cnt += - le32_to_cpu(tgt_stats->pm_stats.pwr_save_failure_cnt); - stats->noise_floor_calib = - a_sle32_to_cpu(tgt_stats->noise_floor_calib); - - stats->cs_bmiss_cnt += - le32_to_cpu(tgt_stats->cserv_stats.cs_bmiss_cnt); - stats->cs_low_rssi_cnt += - le32_to_cpu(tgt_stats->cserv_stats.cs_low_rssi_cnt); - stats->cs_connect_cnt += - le16_to_cpu(tgt_stats->cserv_stats.cs_connect_cnt); - stats->cs_discon_cnt += - le16_to_cpu(tgt_stats->cserv_stats.cs_discon_cnt); - - stats->cs_ave_beacon_rssi = - a_sle16_to_cpu(tgt_stats->cserv_stats.cs_ave_beacon_rssi); - - stats->cs_last_roam_msec = - tgt_stats->cserv_stats.cs_last_roam_msec; - stats->cs_snr = tgt_stats->cserv_stats.cs_snr; - stats->cs_rssi = a_sle16_to_cpu(tgt_stats->cserv_stats.cs_rssi); - - stats->lq_val = le32_to_cpu(tgt_stats->lq_val); - - stats->wow_pkt_dropped += - le32_to_cpu(tgt_stats->wow_stats.wow_pkt_dropped); - stats->wow_host_pkt_wakeups += - tgt_stats->wow_stats.wow_host_pkt_wakeups; - stats->wow_host_evt_wakeups += - tgt_stats->wow_stats.wow_host_evt_wakeups; - stats->wow_evt_discarded += - le16_to_cpu(tgt_stats->wow_stats.wow_evt_discarded); - - stats->arp_received = le32_to_cpu(tgt_stats->arp_stats.arp_received); - stats->arp_replied = le32_to_cpu(tgt_stats->arp_stats.arp_replied); - stats->arp_matched = le32_to_cpu(tgt_stats->arp_stats.arp_matched); - - if (test_bit(STATS_UPDATE_PEND, &vif->flags)) { - clear_bit(STATS_UPDATE_PEND, &vif->flags); - wake_up(&ar->event_wq); - } -} - -static void ath6kl_add_le32(__le32 *var, __le32 val) -{ - *var = cpu_to_le32(le32_to_cpu(*var) + le32_to_cpu(val)); -} - -void ath6kl_tgt_stats_event(struct ath6kl_vif *vif, u8 *ptr, u32 len) -{ - struct wmi_ap_mode_stat *p = (struct wmi_ap_mode_stat *) ptr; - struct ath6kl *ar = vif->ar; - struct wmi_ap_mode_stat *ap = &ar->ap_stats; - struct wmi_per_sta_stat *st_ap, *st_p; - u8 ac; - - if (vif->nw_type == AP_NETWORK) { - if (len < sizeof(*p)) - return; - - for (ac = 0; ac < AP_MAX_NUM_STA; ac++) { - st_ap = &ap->sta[ac]; - st_p = &p->sta[ac]; - - ath6kl_add_le32(&st_ap->tx_bytes, st_p->tx_bytes); - ath6kl_add_le32(&st_ap->tx_pkts, st_p->tx_pkts); - ath6kl_add_le32(&st_ap->tx_error, st_p->tx_error); - ath6kl_add_le32(&st_ap->tx_discard, st_p->tx_discard); - ath6kl_add_le32(&st_ap->rx_bytes, st_p->rx_bytes); - ath6kl_add_le32(&st_ap->rx_pkts, st_p->rx_pkts); - ath6kl_add_le32(&st_ap->rx_error, st_p->rx_error); - ath6kl_add_le32(&st_ap->rx_discard, st_p->rx_discard); - } - - } else { - ath6kl_update_target_stats(vif, ptr, len); - } -} - -void ath6kl_wakeup_event(void *dev) -{ - struct ath6kl *ar = (struct ath6kl *) dev; - - wake_up(&ar->event_wq); -} - -void ath6kl_txpwr_rx_evt(void *devt, u8 tx_pwr) -{ - struct ath6kl *ar = (struct ath6kl *) devt; - - ar->tx_pwr = tx_pwr; - wake_up(&ar->event_wq); -} - -void ath6kl_pspoll_event(struct ath6kl_vif *vif, u8 aid) -{ - struct ath6kl_sta *conn; - struct sk_buff *skb; - bool psq_empty = false; - struct ath6kl *ar = vif->ar; - struct ath6kl_mgmt_buff *mgmt_buf; - - conn = ath6kl_find_sta_by_aid(ar, aid); - - if (!conn) - return; - /* - * Send out a packet queued on ps queue. When the ps queue - * becomes empty update the PVB for this station. - */ - spin_lock_bh(&conn->psq_lock); - psq_empty = skb_queue_empty(&conn->psq) && (conn->mgmt_psq_len == 0); - spin_unlock_bh(&conn->psq_lock); - - if (psq_empty) - /* TODO: Send out a NULL data frame */ - return; - - spin_lock_bh(&conn->psq_lock); - if (conn->mgmt_psq_len > 0) { - mgmt_buf = list_first_entry(&conn->mgmt_psq, - struct ath6kl_mgmt_buff, list); - list_del(&mgmt_buf->list); - conn->mgmt_psq_len--; - spin_unlock_bh(&conn->psq_lock); - - conn->sta_flags |= STA_PS_POLLED; - ath6kl_wmi_send_mgmt_cmd(ar->wmi, vif->fw_vif_idx, - mgmt_buf->id, mgmt_buf->freq, - mgmt_buf->wait, mgmt_buf->buf, - mgmt_buf->len, mgmt_buf->no_cck); - conn->sta_flags &= ~STA_PS_POLLED; - kfree(mgmt_buf); - } else { - skb = skb_dequeue(&conn->psq); - spin_unlock_bh(&conn->psq_lock); - - conn->sta_flags |= STA_PS_POLLED; - ath6kl_data_tx(skb, vif->ndev); - conn->sta_flags &= ~STA_PS_POLLED; - } - - spin_lock_bh(&conn->psq_lock); - psq_empty = skb_queue_empty(&conn->psq) && (conn->mgmt_psq_len == 0); - spin_unlock_bh(&conn->psq_lock); - - if (psq_empty) - ath6kl_wmi_set_pvb_cmd(ar->wmi, vif->fw_vif_idx, conn->aid, 0); -} - -void ath6kl_dtimexpiry_event(struct ath6kl_vif *vif) -{ - bool mcastq_empty = false; - struct sk_buff *skb; - struct ath6kl *ar = vif->ar; - - /* - * If there are no associated STAs, ignore the DTIM expiry event. - * There can be potential race conditions where the last associated - * STA may disconnect & before the host could clear the 'Indicate - * DTIM' request to the firmware, the firmware would have just - * indicated a DTIM expiry event. The race is between 'clear DTIM - * expiry cmd' going from the host to the firmware & the DTIM - * expiry event happening from the firmware to the host. - */ - if (!ar->sta_list_index) - return; - - spin_lock_bh(&ar->mcastpsq_lock); - mcastq_empty = skb_queue_empty(&ar->mcastpsq); - spin_unlock_bh(&ar->mcastpsq_lock); - - if (mcastq_empty) - return; - - /* set the STA flag to dtim_expired for the frame to go out */ - set_bit(DTIM_EXPIRED, &vif->flags); - - spin_lock_bh(&ar->mcastpsq_lock); - while ((skb = skb_dequeue(&ar->mcastpsq)) != NULL) { - spin_unlock_bh(&ar->mcastpsq_lock); - - ath6kl_data_tx(skb, vif->ndev); - - spin_lock_bh(&ar->mcastpsq_lock); - } - spin_unlock_bh(&ar->mcastpsq_lock); - - clear_bit(DTIM_EXPIRED, &vif->flags); - - /* clear the LSB of the BitMapCtl field of the TIM IE */ - ath6kl_wmi_set_pvb_cmd(ar->wmi, vif->fw_vif_idx, MCAST_AID, 0); -} - -void ath6kl_disconnect_event(struct ath6kl_vif *vif, u8 reason, u8 *bssid, - u8 assoc_resp_len, u8 *assoc_info, - u16 prot_reason_status) -{ - struct ath6kl *ar = vif->ar; - - if (vif->nw_type == AP_NETWORK) { - /* disconnect due to other STA vif switching channels */ - if (reason == BSS_DISCONNECTED && - prot_reason_status == WMI_AP_REASON_STA_ROAM) { - ar->want_ch_switch |= 1 << vif->fw_vif_idx; - /* bail back to this channel if STA vif fails connect */ - ar->last_ch = le16_to_cpu(vif->profile.ch); - } - - if (prot_reason_status == WMI_AP_REASON_MAX_STA) { - /* send max client reached notification to user space */ - cfg80211_conn_failed(vif->ndev, bssid, - NL80211_CONN_FAIL_MAX_CLIENTS, - GFP_KERNEL); - } - - if (prot_reason_status == WMI_AP_REASON_ACL) { - /* send blocked client notification to user space */ - cfg80211_conn_failed(vif->ndev, bssid, - NL80211_CONN_FAIL_BLOCKED_CLIENT, - GFP_KERNEL); - } - - if (!ath6kl_remove_sta(ar, bssid, prot_reason_status)) - return; - - /* if no more associated STAs, empty the mcast PS q */ - if (ar->sta_list_index == 0) { - spin_lock_bh(&ar->mcastpsq_lock); - skb_queue_purge(&ar->mcastpsq); - spin_unlock_bh(&ar->mcastpsq_lock); - - /* clear the LSB of the TIM IE's BitMapCtl field */ - if (test_bit(WMI_READY, &ar->flag)) - ath6kl_wmi_set_pvb_cmd(ar->wmi, vif->fw_vif_idx, - MCAST_AID, 0); - } - - if (!is_broadcast_ether_addr(bssid)) { - /* send event to application */ - cfg80211_del_sta(vif->ndev, bssid, GFP_KERNEL); - } - - if (memcmp(vif->ndev->dev_addr, bssid, ETH_ALEN) == 0) { - memset(vif->wep_key_list, 0, sizeof(vif->wep_key_list)); - clear_bit(CONNECTED, &vif->flags); - } - return; - } - - ath6kl_cfg80211_disconnect_event(vif, reason, bssid, - assoc_resp_len, assoc_info, - prot_reason_status); - - aggr_reset_state(vif->aggr_cntxt->aggr_conn); - - del_timer(&vif->disconnect_timer); - - ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "disconnect reason is %d\n", reason); - - /* - * If the event is due to disconnect cmd from the host, only they - * the target would stop trying to connect. Under any other - * condition, target would keep trying to connect. - */ - if (reason == DISCONNECT_CMD) { - if (!ar->usr_bss_filter && test_bit(WMI_READY, &ar->flag)) - ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, - NONE_BSS_FILTER, 0); - } else { - set_bit(CONNECT_PEND, &vif->flags); - if (((reason == ASSOC_FAILED) && - (prot_reason_status == 0x11)) || - ((reason == ASSOC_FAILED) && (prot_reason_status == 0x0) && - (vif->reconnect_flag == 1))) { - set_bit(CONNECTED, &vif->flags); - return; - } - } - - /* restart disconnected concurrent vifs waiting for new channel */ - ath6kl_check_ch_switch(ar, ar->last_ch); - - /* update connect & link status atomically */ - spin_lock_bh(&vif->if_lock); - clear_bit(CONNECTED, &vif->flags); - netif_carrier_off(vif->ndev); - spin_unlock_bh(&vif->if_lock); - - if ((reason != CSERV_DISCONNECT) || (vif->reconnect_flag != 1)) - vif->reconnect_flag = 0; - - if (reason != CSERV_DISCONNECT) - ar->user_key_ctrl = 0; - - netif_stop_queue(vif->ndev); - memset(vif->bssid, 0, sizeof(vif->bssid)); - vif->bss_ch = 0; - - ath6kl_tx_data_cleanup(ar); -} - -struct ath6kl_vif *ath6kl_vif_first(struct ath6kl *ar) -{ - struct ath6kl_vif *vif; - - spin_lock_bh(&ar->list_lock); - if (list_empty(&ar->vif_list)) { - spin_unlock_bh(&ar->list_lock); - return NULL; - } - - vif = list_first_entry(&ar->vif_list, struct ath6kl_vif, list); - - spin_unlock_bh(&ar->list_lock); - - return vif; -} - -static int ath6kl_open(struct net_device *dev) -{ - struct ath6kl_vif *vif = netdev_priv(dev); - - set_bit(WLAN_ENABLED, &vif->flags); - - if (test_bit(CONNECTED, &vif->flags)) { - netif_carrier_on(dev); - netif_wake_queue(dev); - } else - netif_carrier_off(dev); - - return 0; -} - -static int ath6kl_close(struct net_device *dev) -{ - struct ath6kl_vif *vif = netdev_priv(dev); - - netif_stop_queue(dev); - - ath6kl_cfg80211_stop(vif); - - clear_bit(WLAN_ENABLED, &vif->flags); - - return 0; -} - -static struct net_device_stats *ath6kl_get_stats(struct net_device *dev) -{ - struct ath6kl_vif *vif = netdev_priv(dev); - - return &vif->net_stats; -} - -static int ath6kl_set_features(struct net_device *dev, - netdev_features_t features) -{ - struct ath6kl_vif *vif = netdev_priv(dev); - struct ath6kl *ar = vif->ar; - int err = 0; - - if ((features & NETIF_F_RXCSUM) && - (ar->rx_meta_ver != WMI_META_VERSION_2)) { - ar->rx_meta_ver = WMI_META_VERSION_2; - err = ath6kl_wmi_set_rx_frame_format_cmd(ar->wmi, - vif->fw_vif_idx, - ar->rx_meta_ver, 0, 0); - if (err) { - dev->features = features & ~NETIF_F_RXCSUM; - return err; - } - } else if (!(features & NETIF_F_RXCSUM) && - (ar->rx_meta_ver == WMI_META_VERSION_2)) { - ar->rx_meta_ver = 0; - err = ath6kl_wmi_set_rx_frame_format_cmd(ar->wmi, - vif->fw_vif_idx, - ar->rx_meta_ver, 0, 0); - if (err) { - dev->features = features | NETIF_F_RXCSUM; - return err; - } - - } - - return err; -} - -static void ath6kl_set_multicast_list(struct net_device *ndev) -{ - struct ath6kl_vif *vif = netdev_priv(ndev); - bool mc_all_on = false; - int mc_count = netdev_mc_count(ndev); - struct netdev_hw_addr *ha; - bool found; - struct ath6kl_mc_filter *mc_filter, *tmp; - struct list_head mc_filter_new; - int ret; - - if (!test_bit(WMI_READY, &vif->ar->flag) || - !test_bit(WLAN_ENABLED, &vif->flags)) - return; - - /* Enable multicast-all filter. */ - mc_all_on = !!(ndev->flags & IFF_PROMISC) || - !!(ndev->flags & IFF_ALLMULTI) || - !!(mc_count > ATH6K_MAX_MC_FILTERS_PER_LIST); - - if (mc_all_on) - set_bit(NETDEV_MCAST_ALL_ON, &vif->flags); - else - clear_bit(NETDEV_MCAST_ALL_ON, &vif->flags); - - if (test_bit(ATH6KL_FW_CAPABILITY_WOW_MULTICAST_FILTER, - vif->ar->fw_capabilities)) { - mc_all_on = mc_all_on || (vif->ar->state == ATH6KL_STATE_ON); - } - - if (!(ndev->flags & IFF_MULTICAST)) { - mc_all_on = false; - set_bit(NETDEV_MCAST_ALL_OFF, &vif->flags); - } else { - clear_bit(NETDEV_MCAST_ALL_OFF, &vif->flags); - } - - /* Enable/disable "multicast-all" filter*/ - ath6kl_dbg(ATH6KL_DBG_TRC, "%s multicast-all filter\n", - mc_all_on ? "enabling" : "disabling"); - - ret = ath6kl_wmi_mcast_filter_cmd(vif->ar->wmi, vif->fw_vif_idx, - mc_all_on); - if (ret) { - ath6kl_warn("Failed to %s multicast-all receive\n", - mc_all_on ? "enable" : "disable"); - return; - } - - if (test_bit(NETDEV_MCAST_ALL_ON, &vif->flags)) - return; - - /* Keep the driver and firmware mcast list in sync. */ - list_for_each_entry_safe(mc_filter, tmp, &vif->mc_filter, list) { - found = false; - netdev_for_each_mc_addr(ha, ndev) { - if (memcmp(ha->addr, mc_filter->hw_addr, - ATH6KL_MCAST_FILTER_MAC_ADDR_SIZE) == 0) { - found = true; - break; - } - } - - if (!found) { - /* - * Delete the filter which was previously set - * but not in the new request. - */ - ath6kl_dbg(ATH6KL_DBG_TRC, - "Removing %pM from multicast filter\n", - mc_filter->hw_addr); - ret = ath6kl_wmi_add_del_mcast_filter_cmd(vif->ar->wmi, - vif->fw_vif_idx, mc_filter->hw_addr, - false); - if (ret) { - ath6kl_warn("Failed to remove multicast filter:%pM\n", - mc_filter->hw_addr); - return; - } - - list_del(&mc_filter->list); - kfree(mc_filter); - } - } - - INIT_LIST_HEAD(&mc_filter_new); - - netdev_for_each_mc_addr(ha, ndev) { - found = false; - list_for_each_entry(mc_filter, &vif->mc_filter, list) { - if (memcmp(ha->addr, mc_filter->hw_addr, - ATH6KL_MCAST_FILTER_MAC_ADDR_SIZE) == 0) { - found = true; - break; - } - } - - if (!found) { - mc_filter = kzalloc(sizeof(struct ath6kl_mc_filter), - GFP_ATOMIC); - if (!mc_filter) { - WARN_ON(1); - goto out; - } - - memcpy(mc_filter->hw_addr, ha->addr, - ATH6KL_MCAST_FILTER_MAC_ADDR_SIZE); - /* Set the multicast filter */ - ath6kl_dbg(ATH6KL_DBG_TRC, - "Adding %pM to multicast filter list\n", - mc_filter->hw_addr); - ret = ath6kl_wmi_add_del_mcast_filter_cmd(vif->ar->wmi, - vif->fw_vif_idx, mc_filter->hw_addr, - true); - if (ret) { - ath6kl_warn("Failed to add multicast filter :%pM\n", - mc_filter->hw_addr); - kfree(mc_filter); - goto out; - } - - list_add_tail(&mc_filter->list, &mc_filter_new); - } - } - -out: - list_splice_tail(&mc_filter_new, &vif->mc_filter); -} - -static const struct net_device_ops ath6kl_netdev_ops = { - .ndo_open = ath6kl_open, - .ndo_stop = ath6kl_close, - .ndo_start_xmit = ath6kl_data_tx, - .ndo_get_stats = ath6kl_get_stats, - .ndo_set_features = ath6kl_set_features, - .ndo_set_rx_mode = ath6kl_set_multicast_list, -}; - -void init_netdev(struct net_device *dev) -{ - dev->netdev_ops = &ath6kl_netdev_ops; - dev->destructor = free_netdev; - dev->watchdog_timeo = ATH6KL_TX_TIMEOUT; - - dev->needed_headroom = ETH_HLEN; - dev->needed_headroom += roundup(sizeof(struct ath6kl_llc_snap_hdr) + - sizeof(struct wmi_data_hdr) + - HTC_HDR_LENGTH + - WMI_MAX_TX_META_SZ + - ATH6KL_HTC_ALIGN_BYTES, 4); - - dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM; - - return; -} diff --git a/drivers/net/wireless/ath/ath6kl/recovery.c b/drivers/net/wireless/ath/ath6kl/recovery.c deleted file mode 100644 index 3a8d5e97dc8e..000000000000 --- a/drivers/net/wireless/ath/ath6kl/recovery.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "core.h" -#include "cfg80211.h" -#include "debug.h" - -static void ath6kl_recovery_work(struct work_struct *work) -{ - struct ath6kl *ar = container_of(work, struct ath6kl, - fw_recovery.recovery_work); - - ar->state = ATH6KL_STATE_RECOVERY; - - del_timer_sync(&ar->fw_recovery.hb_timer); - - ath6kl_init_hw_restart(ar); - - ar->state = ATH6KL_STATE_ON; - clear_bit(WMI_CTRL_EP_FULL, &ar->flag); - - ar->fw_recovery.err_reason = 0; - - if (ar->fw_recovery.hb_poll) - mod_timer(&ar->fw_recovery.hb_timer, jiffies + - msecs_to_jiffies(ar->fw_recovery.hb_poll)); -} - -void ath6kl_recovery_err_notify(struct ath6kl *ar, enum ath6kl_fw_err reason) -{ - if (!ar->fw_recovery.enable) - return; - - ath6kl_dbg(ATH6KL_DBG_RECOVERY, "Fw error detected, reason:%d\n", - reason); - - set_bit(reason, &ar->fw_recovery.err_reason); - - if (!test_bit(RECOVERY_CLEANUP, &ar->flag) && - ar->state != ATH6KL_STATE_RECOVERY) - queue_work(ar->ath6kl_wq, &ar->fw_recovery.recovery_work); -} - -void ath6kl_recovery_hb_event(struct ath6kl *ar, u32 cookie) -{ - if (cookie == ar->fw_recovery.seq_num) - ar->fw_recovery.hb_pending = false; -} - -static void ath6kl_recovery_hb_timer(unsigned long data) -{ - struct ath6kl *ar = (struct ath6kl *) data; - int err; - - if (test_bit(RECOVERY_CLEANUP, &ar->flag) || - (ar->state == ATH6KL_STATE_RECOVERY)) - return; - - if (ar->fw_recovery.hb_pending) - ar->fw_recovery.hb_misscnt++; - else - ar->fw_recovery.hb_misscnt = 0; - - if (ar->fw_recovery.hb_misscnt > ATH6KL_HB_RESP_MISS_THRES) { - ar->fw_recovery.hb_misscnt = 0; - ar->fw_recovery.seq_num = 0; - ar->fw_recovery.hb_pending = false; - ath6kl_recovery_err_notify(ar, ATH6KL_FW_HB_RESP_FAILURE); - return; - } - - ar->fw_recovery.seq_num++; - ar->fw_recovery.hb_pending = true; - - err = ath6kl_wmi_get_challenge_resp_cmd(ar->wmi, - ar->fw_recovery.seq_num, 0); - if (err) - ath6kl_warn("Failed to send hb challenge request, err:%d\n", - err); - - mod_timer(&ar->fw_recovery.hb_timer, jiffies + - msecs_to_jiffies(ar->fw_recovery.hb_poll)); -} - -void ath6kl_recovery_init(struct ath6kl *ar) -{ - struct ath6kl_fw_recovery *recovery = &ar->fw_recovery; - - clear_bit(RECOVERY_CLEANUP, &ar->flag); - INIT_WORK(&recovery->recovery_work, ath6kl_recovery_work); - recovery->seq_num = 0; - recovery->hb_misscnt = 0; - ar->fw_recovery.hb_pending = false; - ar->fw_recovery.hb_timer.function = ath6kl_recovery_hb_timer; - ar->fw_recovery.hb_timer.data = (unsigned long) ar; - init_timer_deferrable(&ar->fw_recovery.hb_timer); - - if (ar->fw_recovery.hb_poll) - mod_timer(&ar->fw_recovery.hb_timer, jiffies + - msecs_to_jiffies(ar->fw_recovery.hb_poll)); -} - -void ath6kl_recovery_cleanup(struct ath6kl *ar) -{ - if (!ar->fw_recovery.enable) - return; - - set_bit(RECOVERY_CLEANUP, &ar->flag); - - del_timer_sync(&ar->fw_recovery.hb_timer); - cancel_work_sync(&ar->fw_recovery.recovery_work); -} - -void ath6kl_recovery_suspend(struct ath6kl *ar) -{ - if (!ar->fw_recovery.enable) - return; - - ath6kl_recovery_cleanup(ar); - - if (!ar->fw_recovery.err_reason) - return; - - /* Process pending fw error detection */ - ar->fw_recovery.err_reason = 0; - WARN_ON(ar->state != ATH6KL_STATE_ON); - ar->state = ATH6KL_STATE_RECOVERY; - ath6kl_init_hw_restart(ar); - ar->state = ATH6KL_STATE_ON; -} - -void ath6kl_recovery_resume(struct ath6kl *ar) -{ - if (!ar->fw_recovery.enable) - return; - - clear_bit(RECOVERY_CLEANUP, &ar->flag); - - if (!ar->fw_recovery.hb_poll) - return; - - ar->fw_recovery.hb_pending = false; - ar->fw_recovery.seq_num = 0; - ar->fw_recovery.hb_misscnt = 0; - mod_timer(&ar->fw_recovery.hb_timer, - jiffies + msecs_to_jiffies(ar->fw_recovery.hb_poll)); -} diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c deleted file mode 100644 index fb141454c6d2..000000000000 --- a/drivers/net/wireless/ath/ath6kl/sdio.c +++ /dev/null @@ -1,1463 +0,0 @@ -/* - * Copyright (c) 2004-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "hif.h" -#include "hif-ops.h" -#include "target.h" -#include "debug.h" -#include "cfg80211.h" -#include "trace.h" - -struct ath6kl_sdio { - struct sdio_func *func; - - /* protects access to bus_req_freeq */ - spinlock_t lock; - - /* free list */ - struct list_head bus_req_freeq; - - /* available bus requests */ - struct bus_request bus_req[BUS_REQUEST_MAX_NUM]; - - struct ath6kl *ar; - - u8 *dma_buffer; - - /* protects access to dma_buffer */ - struct mutex dma_buffer_mutex; - - /* scatter request list head */ - struct list_head scat_req; - - atomic_t irq_handling; - wait_queue_head_t irq_wq; - - /* protects access to scat_req */ - spinlock_t scat_lock; - - bool scatter_enabled; - - bool is_disabled; - const struct sdio_device_id *id; - struct work_struct wr_async_work; - struct list_head wr_asyncq; - - /* protects access to wr_asyncq */ - spinlock_t wr_async_lock; -}; - -#define CMD53_ARG_READ 0 -#define CMD53_ARG_WRITE 1 -#define CMD53_ARG_BLOCK_BASIS 1 -#define CMD53_ARG_FIXED_ADDRESS 0 -#define CMD53_ARG_INCR_ADDRESS 1 - -static inline struct ath6kl_sdio *ath6kl_sdio_priv(struct ath6kl *ar) -{ - return ar->hif_priv; -} - -/* - * Macro to check if DMA buffer is WORD-aligned and DMA-able. - * Most host controllers assume the buffer is DMA'able and will - * bug-check otherwise (i.e. buffers on the stack). virt_addr_valid - * check fails on stack memory. - */ -static inline bool buf_needs_bounce(u8 *buf) -{ - return ((unsigned long) buf & 0x3) || !virt_addr_valid(buf); -} - -static void ath6kl_sdio_set_mbox_info(struct ath6kl *ar) -{ - struct ath6kl_mbox_info *mbox_info = &ar->mbox_info; - - /* EP1 has an extended range */ - mbox_info->htc_addr = HIF_MBOX_BASE_ADDR; - mbox_info->htc_ext_addr = HIF_MBOX0_EXT_BASE_ADDR; - mbox_info->htc_ext_sz = HIF_MBOX0_EXT_WIDTH; - mbox_info->block_size = HIF_MBOX_BLOCK_SIZE; - mbox_info->gmbox_addr = HIF_GMBOX_BASE_ADDR; - mbox_info->gmbox_sz = HIF_GMBOX_WIDTH; -} - -static inline void ath6kl_sdio_set_cmd53_arg(u32 *arg, u8 rw, u8 func, - u8 mode, u8 opcode, u32 addr, - u16 blksz) -{ - *arg = (((rw & 1) << 31) | - ((func & 0x7) << 28) | - ((mode & 1) << 27) | - ((opcode & 1) << 26) | - ((addr & 0x1FFFF) << 9) | - (blksz & 0x1FF)); -} - -static inline void ath6kl_sdio_set_cmd52_arg(u32 *arg, u8 write, u8 raw, - unsigned int address, - unsigned char val) -{ - const u8 func = 0; - - *arg = ((write & 1) << 31) | - ((func & 0x7) << 28) | - ((raw & 1) << 27) | - (1 << 26) | - ((address & 0x1FFFF) << 9) | - (1 << 8) | - (val & 0xFF); -} - -static int ath6kl_sdio_func0_cmd52_wr_byte(struct mmc_card *card, - unsigned int address, - unsigned char byte) -{ - struct mmc_command io_cmd; - - memset(&io_cmd, 0, sizeof(io_cmd)); - ath6kl_sdio_set_cmd52_arg(&io_cmd.arg, 1, 0, address, byte); - io_cmd.opcode = SD_IO_RW_DIRECT; - io_cmd.flags = MMC_RSP_R5 | MMC_CMD_AC; - - return mmc_wait_for_cmd(card->host, &io_cmd, 0); -} - -static int ath6kl_sdio_io(struct sdio_func *func, u32 request, u32 addr, - u8 *buf, u32 len) -{ - int ret = 0; - - sdio_claim_host(func); - - if (request & HIF_WRITE) { - /* FIXME: looks like ugly workaround for something */ - if (addr >= HIF_MBOX_BASE_ADDR && - addr <= HIF_MBOX_END_ADDR) - addr += (HIF_MBOX_WIDTH - len); - - /* FIXME: this also looks like ugly workaround */ - if (addr == HIF_MBOX0_EXT_BASE_ADDR) - addr += HIF_MBOX0_EXT_WIDTH - len; - - if (request & HIF_FIXED_ADDRESS) - ret = sdio_writesb(func, addr, buf, len); - else - ret = sdio_memcpy_toio(func, addr, buf, len); - } else { - if (request & HIF_FIXED_ADDRESS) - ret = sdio_readsb(func, buf, addr, len); - else - ret = sdio_memcpy_fromio(func, buf, addr, len); - } - - sdio_release_host(func); - - ath6kl_dbg(ATH6KL_DBG_SDIO, "%s addr 0x%x%s buf 0x%p len %d\n", - request & HIF_WRITE ? "wr" : "rd", addr, - request & HIF_FIXED_ADDRESS ? " (fixed)" : "", buf, len); - ath6kl_dbg_dump(ATH6KL_DBG_SDIO_DUMP, NULL, "sdio ", buf, len); - - trace_ath6kl_sdio(addr, request, buf, len); - - return ret; -} - -static struct bus_request *ath6kl_sdio_alloc_busreq(struct ath6kl_sdio *ar_sdio) -{ - struct bus_request *bus_req; - - spin_lock_bh(&ar_sdio->lock); - - if (list_empty(&ar_sdio->bus_req_freeq)) { - spin_unlock_bh(&ar_sdio->lock); - return NULL; - } - - bus_req = list_first_entry(&ar_sdio->bus_req_freeq, - struct bus_request, list); - list_del(&bus_req->list); - - spin_unlock_bh(&ar_sdio->lock); - ath6kl_dbg(ATH6KL_DBG_SCATTER, "%s: bus request 0x%p\n", - __func__, bus_req); - - return bus_req; -} - -static void ath6kl_sdio_free_bus_req(struct ath6kl_sdio *ar_sdio, - struct bus_request *bus_req) -{ - ath6kl_dbg(ATH6KL_DBG_SCATTER, "%s: bus request 0x%p\n", - __func__, bus_req); - - spin_lock_bh(&ar_sdio->lock); - list_add_tail(&bus_req->list, &ar_sdio->bus_req_freeq); - spin_unlock_bh(&ar_sdio->lock); -} - -static void ath6kl_sdio_setup_scat_data(struct hif_scatter_req *scat_req, - struct mmc_data *data) -{ - struct scatterlist *sg; - int i; - - data->blksz = HIF_MBOX_BLOCK_SIZE; - data->blocks = scat_req->len / HIF_MBOX_BLOCK_SIZE; - - ath6kl_dbg(ATH6KL_DBG_SCATTER, - "hif-scatter: (%s) addr: 0x%X, (block len: %d, block count: %d) , (tot:%d,sg:%d)\n", - (scat_req->req & HIF_WRITE) ? "WR" : "RD", scat_req->addr, - data->blksz, data->blocks, scat_req->len, - scat_req->scat_entries); - - data->flags = (scat_req->req & HIF_WRITE) ? MMC_DATA_WRITE : - MMC_DATA_READ; - - /* fill SG entries */ - sg = scat_req->sgentries; - sg_init_table(sg, scat_req->scat_entries); - - /* assemble SG list */ - for (i = 0; i < scat_req->scat_entries; i++, sg++) { - ath6kl_dbg(ATH6KL_DBG_SCATTER, "%d: addr:0x%p, len:%d\n", - i, scat_req->scat_list[i].buf, - scat_req->scat_list[i].len); - - sg_set_buf(sg, scat_req->scat_list[i].buf, - scat_req->scat_list[i].len); - } - - /* set scatter-gather table for request */ - data->sg = scat_req->sgentries; - data->sg_len = scat_req->scat_entries; -} - -static int ath6kl_sdio_scat_rw(struct ath6kl_sdio *ar_sdio, - struct bus_request *req) -{ - struct mmc_request mmc_req; - struct mmc_command cmd; - struct mmc_data data; - struct hif_scatter_req *scat_req; - u8 opcode, rw; - int status, len; - - scat_req = req->scat_req; - - if (scat_req->virt_scat) { - len = scat_req->len; - if (scat_req->req & HIF_BLOCK_BASIS) - len = round_down(len, HIF_MBOX_BLOCK_SIZE); - - status = ath6kl_sdio_io(ar_sdio->func, scat_req->req, - scat_req->addr, scat_req->virt_dma_buf, - len); - goto scat_complete; - } - - memset(&mmc_req, 0, sizeof(struct mmc_request)); - memset(&cmd, 0, sizeof(struct mmc_command)); - memset(&data, 0, sizeof(struct mmc_data)); - - ath6kl_sdio_setup_scat_data(scat_req, &data); - - opcode = (scat_req->req & HIF_FIXED_ADDRESS) ? - CMD53_ARG_FIXED_ADDRESS : CMD53_ARG_INCR_ADDRESS; - - rw = (scat_req->req & HIF_WRITE) ? CMD53_ARG_WRITE : CMD53_ARG_READ; - - /* Fixup the address so that the last byte will fall on MBOX EOM */ - if (scat_req->req & HIF_WRITE) { - if (scat_req->addr == HIF_MBOX_BASE_ADDR) - scat_req->addr += HIF_MBOX_WIDTH - scat_req->len; - else - /* Uses extended address range */ - scat_req->addr += HIF_MBOX0_EXT_WIDTH - scat_req->len; - } - - /* set command argument */ - ath6kl_sdio_set_cmd53_arg(&cmd.arg, rw, ar_sdio->func->num, - CMD53_ARG_BLOCK_BASIS, opcode, scat_req->addr, - data.blocks); - - cmd.opcode = SD_IO_RW_EXTENDED; - cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_ADTC; - - mmc_req.cmd = &cmd; - mmc_req.data = &data; - - sdio_claim_host(ar_sdio->func); - - mmc_set_data_timeout(&data, ar_sdio->func->card); - - trace_ath6kl_sdio_scat(scat_req->addr, - scat_req->req, - scat_req->len, - scat_req->scat_entries, - scat_req->scat_list); - - /* synchronous call to process request */ - mmc_wait_for_req(ar_sdio->func->card->host, &mmc_req); - - sdio_release_host(ar_sdio->func); - - status = cmd.error ? cmd.error : data.error; - -scat_complete: - scat_req->status = status; - - if (scat_req->status) - ath6kl_err("Scatter write request failed:%d\n", - scat_req->status); - - if (scat_req->req & HIF_ASYNCHRONOUS) - scat_req->complete(ar_sdio->ar->htc_target, scat_req); - - return status; -} - -static int ath6kl_sdio_alloc_prep_scat_req(struct ath6kl_sdio *ar_sdio, - int n_scat_entry, int n_scat_req, - bool virt_scat) -{ - struct hif_scatter_req *s_req; - struct bus_request *bus_req; - int i, scat_req_sz, scat_list_sz, sg_sz, buf_sz; - u8 *virt_buf; - - scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item); - scat_req_sz = sizeof(*s_req) + scat_list_sz; - - if (!virt_scat) - sg_sz = sizeof(struct scatterlist) * n_scat_entry; - else - buf_sz = 2 * L1_CACHE_BYTES + - ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER; - - for (i = 0; i < n_scat_req; i++) { - /* allocate the scatter request */ - s_req = kzalloc(scat_req_sz, GFP_KERNEL); - if (!s_req) - return -ENOMEM; - - if (virt_scat) { - virt_buf = kzalloc(buf_sz, GFP_KERNEL); - if (!virt_buf) { - kfree(s_req); - return -ENOMEM; - } - - s_req->virt_dma_buf = - (u8 *)L1_CACHE_ALIGN((unsigned long)virt_buf); - } else { - /* allocate sglist */ - s_req->sgentries = kzalloc(sg_sz, GFP_KERNEL); - - if (!s_req->sgentries) { - kfree(s_req); - return -ENOMEM; - } - } - - /* allocate a bus request for this scatter request */ - bus_req = ath6kl_sdio_alloc_busreq(ar_sdio); - if (!bus_req) { - kfree(s_req->sgentries); - kfree(s_req->virt_dma_buf); - kfree(s_req); - return -ENOMEM; - } - - /* assign the scatter request to this bus request */ - bus_req->scat_req = s_req; - s_req->busrequest = bus_req; - - s_req->virt_scat = virt_scat; - - /* add it to the scatter pool */ - hif_scatter_req_add(ar_sdio->ar, s_req); - } - - return 0; -} - -static int ath6kl_sdio_read_write_sync(struct ath6kl *ar, u32 addr, u8 *buf, - u32 len, u32 request) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - u8 *tbuf = NULL; - int ret; - bool bounced = false; - - if (request & HIF_BLOCK_BASIS) - len = round_down(len, HIF_MBOX_BLOCK_SIZE); - - if (buf_needs_bounce(buf)) { - if (!ar_sdio->dma_buffer) - return -ENOMEM; - mutex_lock(&ar_sdio->dma_buffer_mutex); - tbuf = ar_sdio->dma_buffer; - - if (request & HIF_WRITE) - memcpy(tbuf, buf, len); - - bounced = true; - } else - tbuf = buf; - - ret = ath6kl_sdio_io(ar_sdio->func, request, addr, tbuf, len); - if ((request & HIF_READ) && bounced) - memcpy(buf, tbuf, len); - - if (bounced) - mutex_unlock(&ar_sdio->dma_buffer_mutex); - - return ret; -} - -static void __ath6kl_sdio_write_async(struct ath6kl_sdio *ar_sdio, - struct bus_request *req) -{ - if (req->scat_req) - ath6kl_sdio_scat_rw(ar_sdio, req); - else { - void *context; - int status; - - status = ath6kl_sdio_read_write_sync(ar_sdio->ar, req->address, - req->buffer, req->length, - req->request); - context = req->packet; - ath6kl_sdio_free_bus_req(ar_sdio, req); - ath6kl_hif_rw_comp_handler(context, status); - } -} - -static void ath6kl_sdio_write_async_work(struct work_struct *work) -{ - struct ath6kl_sdio *ar_sdio; - struct bus_request *req, *tmp_req; - - ar_sdio = container_of(work, struct ath6kl_sdio, wr_async_work); - - spin_lock_bh(&ar_sdio->wr_async_lock); - list_for_each_entry_safe(req, tmp_req, &ar_sdio->wr_asyncq, list) { - list_del(&req->list); - spin_unlock_bh(&ar_sdio->wr_async_lock); - __ath6kl_sdio_write_async(ar_sdio, req); - spin_lock_bh(&ar_sdio->wr_async_lock); - } - spin_unlock_bh(&ar_sdio->wr_async_lock); -} - -static void ath6kl_sdio_irq_handler(struct sdio_func *func) -{ - int status; - struct ath6kl_sdio *ar_sdio; - - ath6kl_dbg(ATH6KL_DBG_SDIO, "irq\n"); - - ar_sdio = sdio_get_drvdata(func); - atomic_set(&ar_sdio->irq_handling, 1); - /* - * Release the host during interrups so we can pick it back up when - * we process commands. - */ - sdio_release_host(ar_sdio->func); - - status = ath6kl_hif_intr_bh_handler(ar_sdio->ar); - sdio_claim_host(ar_sdio->func); - - atomic_set(&ar_sdio->irq_handling, 0); - wake_up(&ar_sdio->irq_wq); - - WARN_ON(status && status != -ECANCELED); -} - -static int ath6kl_sdio_power_on(struct ath6kl *ar) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - struct sdio_func *func = ar_sdio->func; - int ret = 0; - - if (!ar_sdio->is_disabled) - return 0; - - ath6kl_dbg(ATH6KL_DBG_BOOT, "sdio power on\n"); - - sdio_claim_host(func); - - ret = sdio_enable_func(func); - if (ret) { - ath6kl_err("Unable to enable sdio func: %d)\n", ret); - sdio_release_host(func); - return ret; - } - - sdio_release_host(func); - - /* - * Wait for hardware to initialise. It should take a lot less than - * 10 ms but let's be conservative here. - */ - msleep(10); - - ar_sdio->is_disabled = false; - - return ret; -} - -static int ath6kl_sdio_power_off(struct ath6kl *ar) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - int ret; - - if (ar_sdio->is_disabled) - return 0; - - ath6kl_dbg(ATH6KL_DBG_BOOT, "sdio power off\n"); - - /* Disable the card */ - sdio_claim_host(ar_sdio->func); - ret = sdio_disable_func(ar_sdio->func); - sdio_release_host(ar_sdio->func); - - if (ret) - return ret; - - ar_sdio->is_disabled = true; - - return ret; -} - -static int ath6kl_sdio_write_async(struct ath6kl *ar, u32 address, u8 *buffer, - u32 length, u32 request, - struct htc_packet *packet) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - struct bus_request *bus_req; - - bus_req = ath6kl_sdio_alloc_busreq(ar_sdio); - - if (WARN_ON_ONCE(!bus_req)) - return -ENOMEM; - - bus_req->address = address; - bus_req->buffer = buffer; - bus_req->length = length; - bus_req->request = request; - bus_req->packet = packet; - - spin_lock_bh(&ar_sdio->wr_async_lock); - list_add_tail(&bus_req->list, &ar_sdio->wr_asyncq); - spin_unlock_bh(&ar_sdio->wr_async_lock); - queue_work(ar->ath6kl_wq, &ar_sdio->wr_async_work); - - return 0; -} - -static void ath6kl_sdio_irq_enable(struct ath6kl *ar) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - int ret; - - sdio_claim_host(ar_sdio->func); - - /* Register the isr */ - ret = sdio_claim_irq(ar_sdio->func, ath6kl_sdio_irq_handler); - if (ret) - ath6kl_err("Failed to claim sdio irq: %d\n", ret); - - sdio_release_host(ar_sdio->func); -} - -static bool ath6kl_sdio_is_on_irq(struct ath6kl *ar) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - - return !atomic_read(&ar_sdio->irq_handling); -} - -static void ath6kl_sdio_irq_disable(struct ath6kl *ar) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - int ret; - - sdio_claim_host(ar_sdio->func); - - if (atomic_read(&ar_sdio->irq_handling)) { - sdio_release_host(ar_sdio->func); - - ret = wait_event_interruptible(ar_sdio->irq_wq, - ath6kl_sdio_is_on_irq(ar)); - if (ret) - return; - - sdio_claim_host(ar_sdio->func); - } - - ret = sdio_release_irq(ar_sdio->func); - if (ret) - ath6kl_err("Failed to release sdio irq: %d\n", ret); - - sdio_release_host(ar_sdio->func); -} - -static struct hif_scatter_req *ath6kl_sdio_scatter_req_get(struct ath6kl *ar) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - struct hif_scatter_req *node = NULL; - - spin_lock_bh(&ar_sdio->scat_lock); - - if (!list_empty(&ar_sdio->scat_req)) { - node = list_first_entry(&ar_sdio->scat_req, - struct hif_scatter_req, list); - list_del(&node->list); - - node->scat_q_depth = get_queue_depth(&ar_sdio->scat_req); - } - - spin_unlock_bh(&ar_sdio->scat_lock); - - return node; -} - -static void ath6kl_sdio_scatter_req_add(struct ath6kl *ar, - struct hif_scatter_req *s_req) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - - spin_lock_bh(&ar_sdio->scat_lock); - - list_add_tail(&s_req->list, &ar_sdio->scat_req); - - spin_unlock_bh(&ar_sdio->scat_lock); - -} - -/* scatter gather read write request */ -static int ath6kl_sdio_async_rw_scatter(struct ath6kl *ar, - struct hif_scatter_req *scat_req) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - u32 request = scat_req->req; - int status = 0; - - if (!scat_req->len) - return -EINVAL; - - ath6kl_dbg(ATH6KL_DBG_SCATTER, - "hif-scatter: total len: %d scatter entries: %d\n", - scat_req->len, scat_req->scat_entries); - - if (request & HIF_SYNCHRONOUS) - status = ath6kl_sdio_scat_rw(ar_sdio, scat_req->busrequest); - else { - spin_lock_bh(&ar_sdio->wr_async_lock); - list_add_tail(&scat_req->busrequest->list, &ar_sdio->wr_asyncq); - spin_unlock_bh(&ar_sdio->wr_async_lock); - queue_work(ar->ath6kl_wq, &ar_sdio->wr_async_work); - } - - return status; -} - -/* clean up scatter support */ -static void ath6kl_sdio_cleanup_scatter(struct ath6kl *ar) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - struct hif_scatter_req *s_req, *tmp_req; - - /* empty the free list */ - spin_lock_bh(&ar_sdio->scat_lock); - list_for_each_entry_safe(s_req, tmp_req, &ar_sdio->scat_req, list) { - list_del(&s_req->list); - spin_unlock_bh(&ar_sdio->scat_lock); - - /* - * FIXME: should we also call completion handler with - * ath6kl_hif_rw_comp_handler() with status -ECANCELED so - * that the packet is properly freed? - */ - if (s_req->busrequest) - ath6kl_sdio_free_bus_req(ar_sdio, s_req->busrequest); - kfree(s_req->virt_dma_buf); - kfree(s_req->sgentries); - kfree(s_req); - - spin_lock_bh(&ar_sdio->scat_lock); - } - spin_unlock_bh(&ar_sdio->scat_lock); -} - -/* setup of HIF scatter resources */ -static int ath6kl_sdio_enable_scatter(struct ath6kl *ar) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - struct htc_target *target = ar->htc_target; - int ret = 0; - bool virt_scat = false; - - if (ar_sdio->scatter_enabled) - return 0; - - ar_sdio->scatter_enabled = true; - - /* check if host supports scatter and it meets our requirements */ - if (ar_sdio->func->card->host->max_segs < MAX_SCATTER_ENTRIES_PER_REQ) { - ath6kl_err("host only supports scatter of :%d entries, need: %d\n", - ar_sdio->func->card->host->max_segs, - MAX_SCATTER_ENTRIES_PER_REQ); - virt_scat = true; - } - - if (!virt_scat) { - ret = ath6kl_sdio_alloc_prep_scat_req(ar_sdio, - MAX_SCATTER_ENTRIES_PER_REQ, - MAX_SCATTER_REQUESTS, virt_scat); - - if (!ret) { - ath6kl_dbg(ATH6KL_DBG_BOOT, - "hif-scatter enabled requests %d entries %d\n", - MAX_SCATTER_REQUESTS, - MAX_SCATTER_ENTRIES_PER_REQ); - - target->max_scat_entries = MAX_SCATTER_ENTRIES_PER_REQ; - target->max_xfer_szper_scatreq = - MAX_SCATTER_REQ_TRANSFER_SIZE; - } else { - ath6kl_sdio_cleanup_scatter(ar); - ath6kl_warn("hif scatter resource setup failed, trying virtual scatter method\n"); - } - } - - if (virt_scat || ret) { - ret = ath6kl_sdio_alloc_prep_scat_req(ar_sdio, - ATH6KL_SCATTER_ENTRIES_PER_REQ, - ATH6KL_SCATTER_REQS, virt_scat); - - if (ret) { - ath6kl_err("failed to alloc virtual scatter resources !\n"); - ath6kl_sdio_cleanup_scatter(ar); - return ret; - } - - ath6kl_dbg(ATH6KL_DBG_BOOT, - "virtual scatter enabled requests %d entries %d\n", - ATH6KL_SCATTER_REQS, ATH6KL_SCATTER_ENTRIES_PER_REQ); - - target->max_scat_entries = ATH6KL_SCATTER_ENTRIES_PER_REQ; - target->max_xfer_szper_scatreq = - ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER; - } - - return 0; -} - -static int ath6kl_sdio_config(struct ath6kl *ar) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - struct sdio_func *func = ar_sdio->func; - int ret; - - sdio_claim_host(func); - - if ((ar_sdio->id->device & MANUFACTURER_ID_ATH6KL_BASE_MASK) >= - MANUFACTURER_ID_AR6003_BASE) { - /* enable 4-bit ASYNC interrupt on AR6003 or later */ - ret = ath6kl_sdio_func0_cmd52_wr_byte(func->card, - CCCR_SDIO_IRQ_MODE_REG, - SDIO_IRQ_MODE_ASYNC_4BIT_IRQ); - if (ret) { - ath6kl_err("Failed to enable 4-bit async irq mode %d\n", - ret); - goto out; - } - - ath6kl_dbg(ATH6KL_DBG_BOOT, "4-bit async irq mode enabled\n"); - } - - /* give us some time to enable, in ms */ - func->enable_timeout = 100; - - ret = sdio_set_block_size(func, HIF_MBOX_BLOCK_SIZE); - if (ret) { - ath6kl_err("Set sdio block size %d failed: %d)\n", - HIF_MBOX_BLOCK_SIZE, ret); - goto out; - } - -out: - sdio_release_host(func); - - return ret; -} - -static int ath6kl_set_sdio_pm_caps(struct ath6kl *ar) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - struct sdio_func *func = ar_sdio->func; - mmc_pm_flag_t flags; - int ret; - - flags = sdio_get_host_pm_caps(func); - - ath6kl_dbg(ATH6KL_DBG_SUSPEND, "sdio suspend pm_caps 0x%x\n", flags); - - if (!(flags & MMC_PM_WAKE_SDIO_IRQ) || - !(flags & MMC_PM_KEEP_POWER)) - return -EINVAL; - - ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); - if (ret) { - ath6kl_err("set sdio keep pwr flag failed: %d\n", ret); - return ret; - } - - /* sdio irq wakes up host */ - ret = sdio_set_host_pm_flags(func, MMC_PM_WAKE_SDIO_IRQ); - if (ret) - ath6kl_err("set sdio wake irq flag failed: %d\n", ret); - - return ret; -} - -static int ath6kl_sdio_suspend(struct ath6kl *ar, struct cfg80211_wowlan *wow) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - struct sdio_func *func = ar_sdio->func; - mmc_pm_flag_t flags; - bool try_deepsleep = false; - int ret; - - if (ar->suspend_mode == WLAN_POWER_STATE_WOW || - (!ar->suspend_mode && wow)) { - - ret = ath6kl_set_sdio_pm_caps(ar); - if (ret) - goto cut_pwr; - - ret = ath6kl_cfg80211_suspend(ar, ATH6KL_CFG_SUSPEND_WOW, wow); - if (ret && ret != -ENOTCONN) - ath6kl_err("wow suspend failed: %d\n", ret); - - if (ret && - (!ar->wow_suspend_mode || - ar->wow_suspend_mode == WLAN_POWER_STATE_DEEP_SLEEP)) - try_deepsleep = true; - else if (ret && - ar->wow_suspend_mode == WLAN_POWER_STATE_CUT_PWR) - goto cut_pwr; - if (!ret) - return 0; - } - - if (ar->suspend_mode == WLAN_POWER_STATE_DEEP_SLEEP || - !ar->suspend_mode || try_deepsleep) { - - flags = sdio_get_host_pm_caps(func); - if (!(flags & MMC_PM_KEEP_POWER)) - goto cut_pwr; - - ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); - if (ret) - goto cut_pwr; - - /* - * Workaround to support Deep Sleep with MSM, set the host pm - * flag as MMC_PM_WAKE_SDIO_IRQ to allow SDCC deiver to disable - * the sdc2_clock and internally allows MSM to enter - * TCXO shutdown properly. - */ - if ((flags & MMC_PM_WAKE_SDIO_IRQ)) { - ret = sdio_set_host_pm_flags(func, - MMC_PM_WAKE_SDIO_IRQ); - if (ret) - goto cut_pwr; - } - - ret = ath6kl_cfg80211_suspend(ar, ATH6KL_CFG_SUSPEND_DEEPSLEEP, - NULL); - if (ret) - goto cut_pwr; - - return 0; - } - -cut_pwr: - if (func->card && func->card->host) - func->card->host->pm_flags &= ~MMC_PM_KEEP_POWER; - - return ath6kl_cfg80211_suspend(ar, ATH6KL_CFG_SUSPEND_CUTPOWER, NULL); -} - -static int ath6kl_sdio_resume(struct ath6kl *ar) -{ - switch (ar->state) { - case ATH6KL_STATE_OFF: - case ATH6KL_STATE_CUTPOWER: - ath6kl_dbg(ATH6KL_DBG_SUSPEND, - "sdio resume configuring sdio\n"); - - /* need to set sdio settings after power is cut from sdio */ - ath6kl_sdio_config(ar); - break; - - case ATH6KL_STATE_ON: - break; - - case ATH6KL_STATE_DEEPSLEEP: - break; - - case ATH6KL_STATE_WOW: - break; - - case ATH6KL_STATE_SUSPENDING: - break; - - case ATH6KL_STATE_RESUMING: - break; - - case ATH6KL_STATE_RECOVERY: - break; - } - - ath6kl_cfg80211_resume(ar); - - return 0; -} - -/* set the window address register (using 4-byte register access ). */ -static int ath6kl_set_addrwin_reg(struct ath6kl *ar, u32 reg_addr, u32 addr) -{ - int status; - u8 addr_val[4]; - s32 i; - - /* - * Write bytes 1,2,3 of the register to set the upper address bytes, - * the LSB is written last to initiate the access cycle - */ - - for (i = 1; i <= 3; i++) { - /* - * Fill the buffer with the address byte value we want to - * hit 4 times. - */ - memset(addr_val, ((u8 *)&addr)[i], 4); - - /* - * Hit each byte of the register address with a 4-byte - * write operation to the same address, this is a harmless - * operation. - */ - status = ath6kl_sdio_read_write_sync(ar, reg_addr + i, addr_val, - 4, HIF_WR_SYNC_BYTE_FIX); - if (status) - break; - } - - if (status) { - ath6kl_err("%s: failed to write initial bytes of 0x%x to window reg: 0x%X\n", - __func__, addr, reg_addr); - return status; - } - - /* - * Write the address register again, this time write the whole - * 4-byte value. The effect here is that the LSB write causes the - * cycle to start, the extra 3 byte write to bytes 1,2,3 has no - * effect since we are writing the same values again - */ - status = ath6kl_sdio_read_write_sync(ar, reg_addr, (u8 *)(&addr), - 4, HIF_WR_SYNC_BYTE_INC); - - if (status) { - ath6kl_err("%s: failed to write 0x%x to window reg: 0x%X\n", - __func__, addr, reg_addr); - return status; - } - - return 0; -} - -static int ath6kl_sdio_diag_read32(struct ath6kl *ar, u32 address, u32 *data) -{ - int status; - - /* set window register to start read cycle */ - status = ath6kl_set_addrwin_reg(ar, WINDOW_READ_ADDR_ADDRESS, - address); - - if (status) - return status; - - /* read the data */ - status = ath6kl_sdio_read_write_sync(ar, WINDOW_DATA_ADDRESS, - (u8 *)data, sizeof(u32), HIF_RD_SYNC_BYTE_INC); - if (status) { - ath6kl_err("%s: failed to read from window data addr\n", - __func__); - return status; - } - - return status; -} - -static int ath6kl_sdio_diag_write32(struct ath6kl *ar, u32 address, - __le32 data) -{ - int status; - u32 val = (__force u32) data; - - /* set write data */ - status = ath6kl_sdio_read_write_sync(ar, WINDOW_DATA_ADDRESS, - (u8 *) &val, sizeof(u32), HIF_WR_SYNC_BYTE_INC); - if (status) { - ath6kl_err("%s: failed to write 0x%x to window data addr\n", - __func__, data); - return status; - } - - /* set window register, which starts the write cycle */ - return ath6kl_set_addrwin_reg(ar, WINDOW_WRITE_ADDR_ADDRESS, - address); -} - -static int ath6kl_sdio_bmi_credits(struct ath6kl *ar) -{ - u32 addr; - unsigned long timeout; - int ret; - - ar->bmi.cmd_credits = 0; - - /* Read the counter register to get the command credits */ - addr = COUNT_DEC_ADDRESS + (HTC_MAILBOX_NUM_MAX + ENDPOINT1) * 4; - - timeout = jiffies + msecs_to_jiffies(BMI_COMMUNICATION_TIMEOUT); - while (time_before(jiffies, timeout) && !ar->bmi.cmd_credits) { - - /* - * Hit the credit counter with a 4-byte access, the first byte - * read will hit the counter and cause a decrement, while the - * remaining 3 bytes has no effect. The rationale behind this - * is to make all HIF accesses 4-byte aligned. - */ - ret = ath6kl_sdio_read_write_sync(ar, addr, - (u8 *)&ar->bmi.cmd_credits, 4, - HIF_RD_SYNC_BYTE_INC); - if (ret) { - ath6kl_err("Unable to decrement the command credit count register: %d\n", - ret); - return ret; - } - - /* The counter is only 8 bits. - * Ignore anything in the upper 3 bytes - */ - ar->bmi.cmd_credits &= 0xFF; - } - - if (!ar->bmi.cmd_credits) { - ath6kl_err("bmi communication timeout\n"); - return -ETIMEDOUT; - } - - return 0; -} - -static int ath6kl_bmi_get_rx_lkahd(struct ath6kl *ar) -{ - unsigned long timeout; - u32 rx_word = 0; - int ret = 0; - - timeout = jiffies + msecs_to_jiffies(BMI_COMMUNICATION_TIMEOUT); - while ((time_before(jiffies, timeout)) && !rx_word) { - ret = ath6kl_sdio_read_write_sync(ar, - RX_LOOKAHEAD_VALID_ADDRESS, - (u8 *)&rx_word, sizeof(rx_word), - HIF_RD_SYNC_BYTE_INC); - if (ret) { - ath6kl_err("unable to read RX_LOOKAHEAD_VALID\n"); - return ret; - } - - /* all we really want is one bit */ - rx_word &= (1 << ENDPOINT1); - } - - if (!rx_word) { - ath6kl_err("bmi_recv_buf FIFO empty\n"); - return -EINVAL; - } - - return ret; -} - -static int ath6kl_sdio_bmi_write(struct ath6kl *ar, u8 *buf, u32 len) -{ - int ret; - u32 addr; - - ret = ath6kl_sdio_bmi_credits(ar); - if (ret) - return ret; - - addr = ar->mbox_info.htc_addr; - - ret = ath6kl_sdio_read_write_sync(ar, addr, buf, len, - HIF_WR_SYNC_BYTE_INC); - if (ret) { - ath6kl_err("unable to send the bmi data to the device\n"); - return ret; - } - - return 0; -} - -static int ath6kl_sdio_bmi_read(struct ath6kl *ar, u8 *buf, u32 len) -{ - int ret; - u32 addr; - - /* - * During normal bootup, small reads may be required. - * Rather than issue an HIF Read and then wait as the Target - * adds successive bytes to the FIFO, we wait here until - * we know that response data is available. - * - * This allows us to cleanly timeout on an unexpected - * Target failure rather than risk problems at the HIF level. - * In particular, this avoids SDIO timeouts and possibly garbage - * data on some host controllers. And on an interconnect - * such as Compact Flash (as well as some SDIO masters) which - * does not provide any indication on data timeout, it avoids - * a potential hang or garbage response. - * - * Synchronization is more difficult for reads larger than the - * size of the MBOX FIFO (128B), because the Target is unable - * to push the 129th byte of data until AFTER the Host posts an - * HIF Read and removes some FIFO data. So for large reads the - * Host proceeds to post an HIF Read BEFORE all the data is - * actually available to read. Fortunately, large BMI reads do - * not occur in practice -- they're supported for debug/development. - * - * So Host/Target BMI synchronization is divided into these cases: - * CASE 1: length < 4 - * Should not happen - * - * CASE 2: 4 <= length <= 128 - * Wait for first 4 bytes to be in FIFO - * If CONSERVATIVE_BMI_READ is enabled, also wait for - * a BMI command credit, which indicates that the ENTIRE - * response is available in the the FIFO - * - * CASE 3: length > 128 - * Wait for the first 4 bytes to be in FIFO - * - * For most uses, a small timeout should be sufficient and we will - * usually see a response quickly; but there may be some unusual - * (debug) cases of BMI_EXECUTE where we want an larger timeout. - * For now, we use an unbounded busy loop while waiting for - * BMI_EXECUTE. - * - * If BMI_EXECUTE ever needs to support longer-latency execution, - * especially in production, this code needs to be enhanced to sleep - * and yield. Also note that BMI_COMMUNICATION_TIMEOUT is currently - * a function of Host processor speed. - */ - if (len >= 4) { /* NB: Currently, always true */ - ret = ath6kl_bmi_get_rx_lkahd(ar); - if (ret) - return ret; - } - - addr = ar->mbox_info.htc_addr; - ret = ath6kl_sdio_read_write_sync(ar, addr, buf, len, - HIF_RD_SYNC_BYTE_INC); - if (ret) { - ath6kl_err("Unable to read the bmi data from the device: %d\n", - ret); - return ret; - } - - return 0; -} - -static void ath6kl_sdio_stop(struct ath6kl *ar) -{ - struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); - struct bus_request *req, *tmp_req; - void *context; - - /* FIXME: make sure that wq is not queued again */ - - cancel_work_sync(&ar_sdio->wr_async_work); - - spin_lock_bh(&ar_sdio->wr_async_lock); - - list_for_each_entry_safe(req, tmp_req, &ar_sdio->wr_asyncq, list) { - list_del(&req->list); - - if (req->scat_req) { - /* this is a scatter gather request */ - req->scat_req->status = -ECANCELED; - req->scat_req->complete(ar_sdio->ar->htc_target, - req->scat_req); - } else { - context = req->packet; - ath6kl_sdio_free_bus_req(ar_sdio, req); - ath6kl_hif_rw_comp_handler(context, -ECANCELED); - } - } - - spin_unlock_bh(&ar_sdio->wr_async_lock); - - WARN_ON(get_queue_depth(&ar_sdio->scat_req) != 4); -} - -static const struct ath6kl_hif_ops ath6kl_sdio_ops = { - .read_write_sync = ath6kl_sdio_read_write_sync, - .write_async = ath6kl_sdio_write_async, - .irq_enable = ath6kl_sdio_irq_enable, - .irq_disable = ath6kl_sdio_irq_disable, - .scatter_req_get = ath6kl_sdio_scatter_req_get, - .scatter_req_add = ath6kl_sdio_scatter_req_add, - .enable_scatter = ath6kl_sdio_enable_scatter, - .scat_req_rw = ath6kl_sdio_async_rw_scatter, - .cleanup_scatter = ath6kl_sdio_cleanup_scatter, - .suspend = ath6kl_sdio_suspend, - .resume = ath6kl_sdio_resume, - .diag_read32 = ath6kl_sdio_diag_read32, - .diag_write32 = ath6kl_sdio_diag_write32, - .bmi_read = ath6kl_sdio_bmi_read, - .bmi_write = ath6kl_sdio_bmi_write, - .power_on = ath6kl_sdio_power_on, - .power_off = ath6kl_sdio_power_off, - .stop = ath6kl_sdio_stop, -}; - -#ifdef CONFIG_PM_SLEEP - -/* - * Empty handlers so that mmc subsystem doesn't remove us entirely during - * suspend. We instead follow cfg80211 suspend/resume handlers. - */ -static int ath6kl_sdio_pm_suspend(struct device *device) -{ - ath6kl_dbg(ATH6KL_DBG_SUSPEND, "sdio pm suspend\n"); - - return 0; -} - -static int ath6kl_sdio_pm_resume(struct device *device) -{ - ath6kl_dbg(ATH6KL_DBG_SUSPEND, "sdio pm resume\n"); - - return 0; -} - -static SIMPLE_DEV_PM_OPS(ath6kl_sdio_pm_ops, ath6kl_sdio_pm_suspend, - ath6kl_sdio_pm_resume); - -#define ATH6KL_SDIO_PM_OPS (&ath6kl_sdio_pm_ops) - -#else - -#define ATH6KL_SDIO_PM_OPS NULL - -#endif /* CONFIG_PM_SLEEP */ - -static int ath6kl_sdio_probe(struct sdio_func *func, - const struct sdio_device_id *id) -{ - int ret; - struct ath6kl_sdio *ar_sdio; - struct ath6kl *ar; - int count; - - ath6kl_dbg(ATH6KL_DBG_BOOT, - "sdio new func %d vendor 0x%x device 0x%x block 0x%x/0x%x\n", - func->num, func->vendor, func->device, - func->max_blksize, func->cur_blksize); - - ar_sdio = kzalloc(sizeof(struct ath6kl_sdio), GFP_KERNEL); - if (!ar_sdio) - return -ENOMEM; - - ar_sdio->dma_buffer = kzalloc(HIF_DMA_BUFFER_SIZE, GFP_KERNEL); - if (!ar_sdio->dma_buffer) { - ret = -ENOMEM; - goto err_hif; - } - - ar_sdio->func = func; - sdio_set_drvdata(func, ar_sdio); - - ar_sdio->id = id; - ar_sdio->is_disabled = true; - - spin_lock_init(&ar_sdio->lock); - spin_lock_init(&ar_sdio->scat_lock); - spin_lock_init(&ar_sdio->wr_async_lock); - mutex_init(&ar_sdio->dma_buffer_mutex); - - INIT_LIST_HEAD(&ar_sdio->scat_req); - INIT_LIST_HEAD(&ar_sdio->bus_req_freeq); - INIT_LIST_HEAD(&ar_sdio->wr_asyncq); - - INIT_WORK(&ar_sdio->wr_async_work, ath6kl_sdio_write_async_work); - - init_waitqueue_head(&ar_sdio->irq_wq); - - for (count = 0; count < BUS_REQUEST_MAX_NUM; count++) - ath6kl_sdio_free_bus_req(ar_sdio, &ar_sdio->bus_req[count]); - - ar = ath6kl_core_create(&ar_sdio->func->dev); - if (!ar) { - ath6kl_err("Failed to alloc ath6kl core\n"); - ret = -ENOMEM; - goto err_dma; - } - - ar_sdio->ar = ar; - ar->hif_type = ATH6KL_HIF_TYPE_SDIO; - ar->hif_priv = ar_sdio; - ar->hif_ops = &ath6kl_sdio_ops; - ar->bmi.max_data_size = 256; - - ath6kl_sdio_set_mbox_info(ar); - - ret = ath6kl_sdio_config(ar); - if (ret) { - ath6kl_err("Failed to config sdio: %d\n", ret); - goto err_core_alloc; - } - - ret = ath6kl_core_init(ar, ATH6KL_HTC_TYPE_MBOX); - if (ret) { - ath6kl_err("Failed to init ath6kl core\n"); - goto err_core_alloc; - } - - return ret; - -err_core_alloc: - ath6kl_core_destroy(ar_sdio->ar); -err_dma: - kfree(ar_sdio->dma_buffer); -err_hif: - kfree(ar_sdio); - - return ret; -} - -static void ath6kl_sdio_remove(struct sdio_func *func) -{ - struct ath6kl_sdio *ar_sdio; - - ath6kl_dbg(ATH6KL_DBG_BOOT, - "sdio removed func %d vendor 0x%x device 0x%x\n", - func->num, func->vendor, func->device); - - ar_sdio = sdio_get_drvdata(func); - - ath6kl_stop_txrx(ar_sdio->ar); - cancel_work_sync(&ar_sdio->wr_async_work); - - ath6kl_core_cleanup(ar_sdio->ar); - ath6kl_core_destroy(ar_sdio->ar); - - kfree(ar_sdio->dma_buffer); - kfree(ar_sdio); -} - -static const struct sdio_device_id ath6kl_sdio_devices[] = { - {SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x0))}, - {SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6003_BASE | 0x1))}, - {SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6004_BASE | 0x0))}, - {SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6004_BASE | 0x1))}, - {}, -}; - -MODULE_DEVICE_TABLE(sdio, ath6kl_sdio_devices); - -static struct sdio_driver ath6kl_sdio_driver = { - .name = "ath6kl_sdio", - .id_table = ath6kl_sdio_devices, - .probe = ath6kl_sdio_probe, - .remove = ath6kl_sdio_remove, - .drv.pm = ATH6KL_SDIO_PM_OPS, -}; - -static int __init ath6kl_sdio_init(void) -{ - int ret; - - ret = sdio_register_driver(&ath6kl_sdio_driver); - if (ret) - ath6kl_err("sdio driver registration failed: %d\n", ret); - - return ret; -} - -static void __exit ath6kl_sdio_exit(void) -{ - sdio_unregister_driver(&ath6kl_sdio_driver); -} - -module_init(ath6kl_sdio_init); -module_exit(ath6kl_sdio_exit); - -MODULE_AUTHOR("Atheros Communications, Inc."); -MODULE_DESCRIPTION("Driver support for Atheros AR600x SDIO devices"); -MODULE_LICENSE("Dual BSD/GPL"); - -MODULE_FIRMWARE(AR6003_HW_2_0_FW_DIR "/" AR6003_HW_2_0_OTP_FILE); -MODULE_FIRMWARE(AR6003_HW_2_0_FW_DIR "/" AR6003_HW_2_0_FIRMWARE_FILE); -MODULE_FIRMWARE(AR6003_HW_2_0_FW_DIR "/" AR6003_HW_2_0_PATCH_FILE); -MODULE_FIRMWARE(AR6003_HW_2_0_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6003_HW_2_0_DEFAULT_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6003_HW_2_1_1_FW_DIR "/" AR6003_HW_2_1_1_OTP_FILE); -MODULE_FIRMWARE(AR6003_HW_2_1_1_FW_DIR "/" AR6003_HW_2_1_1_FIRMWARE_FILE); -MODULE_FIRMWARE(AR6003_HW_2_1_1_FW_DIR "/" AR6003_HW_2_1_1_PATCH_FILE); -MODULE_FIRMWARE(AR6003_HW_2_1_1_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6003_HW_2_1_1_DEFAULT_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_0_FW_DIR "/" AR6004_HW_1_0_FIRMWARE_FILE); -MODULE_FIRMWARE(AR6004_HW_1_0_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_0_DEFAULT_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_1_FW_DIR "/" AR6004_HW_1_1_FIRMWARE_FILE); -MODULE_FIRMWARE(AR6004_HW_1_1_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_1_DEFAULT_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_2_FW_DIR "/" AR6004_HW_1_2_FIRMWARE_FILE); -MODULE_FIRMWARE(AR6004_HW_1_2_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_2_DEFAULT_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_3_FW_DIR "/" AR6004_HW_1_3_FIRMWARE_FILE); -MODULE_FIRMWARE(AR6004_HW_1_3_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_3_DEFAULT_BOARD_DATA_FILE); diff --git a/drivers/net/wireless/ath/ath6kl/target.h b/drivers/net/wireless/ath/ath6kl/target.h deleted file mode 100644 index a580a629a0da..000000000000 --- a/drivers/net/wireless/ath/ath6kl/target.h +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Copyright (c) 2004-2010 Atheros Communications Inc. - * Copyright (c) 2011 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef TARGET_H -#define TARGET_H - -#define AR6003_BOARD_DATA_SZ 1024 -#define AR6003_BOARD_EXT_DATA_SZ 768 -#define AR6003_BOARD_EXT_DATA_SZ_V2 1024 - -#define AR6004_BOARD_DATA_SZ 6144 -#define AR6004_BOARD_EXT_DATA_SZ 0 - -#define RESET_CONTROL_ADDRESS 0x00004000 -#define RESET_CONTROL_COLD_RST 0x00000100 -#define RESET_CONTROL_MBOX_RST 0x00000004 - -#define CPU_CLOCK_STANDARD_S 0 -#define CPU_CLOCK_STANDARD 0x00000003 -#define CPU_CLOCK_ADDRESS 0x00000020 - -#define CLOCK_CONTROL_ADDRESS 0x00000028 -#define CLOCK_CONTROL_LF_CLK32_S 2 -#define CLOCK_CONTROL_LF_CLK32 0x00000004 - -#define SYSTEM_SLEEP_ADDRESS 0x000000c4 -#define SYSTEM_SLEEP_DISABLE_S 0 -#define SYSTEM_SLEEP_DISABLE 0x00000001 - -#define LPO_CAL_ADDRESS 0x000000e0 -#define LPO_CAL_ENABLE_S 20 -#define LPO_CAL_ENABLE 0x00100000 - -#define GPIO_PIN9_ADDRESS 0x0000004c -#define GPIO_PIN10_ADDRESS 0x00000050 -#define GPIO_PIN11_ADDRESS 0x00000054 -#define GPIO_PIN12_ADDRESS 0x00000058 -#define GPIO_PIN13_ADDRESS 0x0000005c - -#define HOST_INT_STATUS_ADDRESS 0x00000400 -#define HOST_INT_STATUS_ERROR_S 7 -#define HOST_INT_STATUS_ERROR 0x00000080 - -#define HOST_INT_STATUS_CPU_S 6 -#define HOST_INT_STATUS_CPU 0x00000040 - -#define HOST_INT_STATUS_COUNTER_S 4 -#define HOST_INT_STATUS_COUNTER 0x00000010 - -#define CPU_INT_STATUS_ADDRESS 0x00000401 - -#define ERROR_INT_STATUS_ADDRESS 0x00000402 -#define ERROR_INT_STATUS_WAKEUP_S 2 -#define ERROR_INT_STATUS_WAKEUP 0x00000004 - -#define ERROR_INT_STATUS_RX_UNDERFLOW_S 1 -#define ERROR_INT_STATUS_RX_UNDERFLOW 0x00000002 - -#define ERROR_INT_STATUS_TX_OVERFLOW_S 0 -#define ERROR_INT_STATUS_TX_OVERFLOW 0x00000001 - -#define COUNTER_INT_STATUS_ADDRESS 0x00000403 -#define COUNTER_INT_STATUS_COUNTER_S 0 -#define COUNTER_INT_STATUS_COUNTER 0x000000ff - -#define RX_LOOKAHEAD_VALID_ADDRESS 0x00000405 - -#define INT_STATUS_ENABLE_ADDRESS 0x00000418 -#define INT_STATUS_ENABLE_ERROR_S 7 -#define INT_STATUS_ENABLE_ERROR 0x00000080 - -#define INT_STATUS_ENABLE_CPU_S 6 -#define INT_STATUS_ENABLE_CPU 0x00000040 - -#define INT_STATUS_ENABLE_INT_S 5 -#define INT_STATUS_ENABLE_INT 0x00000020 -#define INT_STATUS_ENABLE_COUNTER_S 4 -#define INT_STATUS_ENABLE_COUNTER 0x00000010 - -#define INT_STATUS_ENABLE_MBOX_DATA_S 0 -#define INT_STATUS_ENABLE_MBOX_DATA 0x0000000f - -#define CPU_INT_STATUS_ENABLE_ADDRESS 0x00000419 -#define CPU_INT_STATUS_ENABLE_BIT_S 0 -#define CPU_INT_STATUS_ENABLE_BIT 0x000000ff - -#define ERROR_STATUS_ENABLE_ADDRESS 0x0000041a -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW_S 1 -#define ERROR_STATUS_ENABLE_RX_UNDERFLOW 0x00000002 - -#define ERROR_STATUS_ENABLE_TX_OVERFLOW_S 0 -#define ERROR_STATUS_ENABLE_TX_OVERFLOW 0x00000001 - -#define COUNTER_INT_STATUS_ENABLE_ADDRESS 0x0000041b -#define COUNTER_INT_STATUS_ENABLE_BIT_S 0 -#define COUNTER_INT_STATUS_ENABLE_BIT 0x000000ff - -#define COUNT_ADDRESS 0x00000420 - -#define COUNT_DEC_ADDRESS 0x00000440 - -#define WINDOW_DATA_ADDRESS 0x00000474 -#define WINDOW_WRITE_ADDR_ADDRESS 0x00000478 -#define WINDOW_READ_ADDR_ADDRESS 0x0000047c -#define CPU_DBG_SEL_ADDRESS 0x00000483 -#define CPU_DBG_ADDRESS 0x00000484 - -#define LOCAL_SCRATCH_ADDRESS 0x000000c0 -#define ATH6KL_OPTION_SLEEP_DISABLE 0x08 - -#define RTC_BASE_ADDRESS 0x00004000 -#define GPIO_BASE_ADDRESS 0x00014000 -#define MBOX_BASE_ADDRESS 0x00018000 -#define ANALOG_INTF_BASE_ADDRESS 0x0001c000 - -/* real name of the register is unknown */ -#define ATH6KL_ANALOG_PLL_REGISTER (ANALOG_INTF_BASE_ADDRESS + 0x284) - -#define SM(f, v) (((v) << f##_S) & f) -#define MS(f, v) (((v) & f) >> f##_S) - -/* - * xxx_HOST_INTEREST_ADDRESS is the address in Target RAM of the - * host_interest structure. - * - * Host Interest is shared between Host and Target in order to coordinate - * between the two, and is intended to remain constant (with additions only - * at the end). - */ -#define ATH6KL_AR6003_HI_START_ADDR 0x00540600 -#define ATH6KL_AR6004_HI_START_ADDR 0x00400800 - -/* - * These are items that the Host may need to access - * via BMI or via the Diagnostic Window. The position - * of items in this structure must remain constant. - * across firmware revisions! - * - * Types for each item must be fixed size across target and host platforms. - * The structure is used only to calculate offset for each register with - * HI_ITEM() macro, no values are stored to it. - * - * More items may be added at the end. - */ -struct host_interest { - /* - * Pointer to application-defined area, if any. - * Set by Target application during startup. - */ - u32 hi_app_host_interest; /* 0x00 */ - - /* Pointer to register dump area, valid after Target crash. */ - u32 hi_failure_state; /* 0x04 */ - - /* Pointer to debug logging header */ - u32 hi_dbglog_hdr; /* 0x08 */ - - u32 hi_unused1; /* 0x0c */ - - /* - * General-purpose flag bits, similar to ATH6KL_OPTION_* flags. - * Can be used by application rather than by OS. - */ - u32 hi_option_flag; /* 0x10 */ - - /* - * Boolean that determines whether or not to - * display messages on the serial port. - */ - u32 hi_serial_enable; /* 0x14 */ - - /* Start address of DataSet index, if any */ - u32 hi_dset_list_head; /* 0x18 */ - - /* Override Target application start address */ - u32 hi_app_start; /* 0x1c */ - - /* Clock and voltage tuning */ - u32 hi_skip_clock_init; /* 0x20 */ - u32 hi_core_clock_setting; /* 0x24 */ - u32 hi_cpu_clock_setting; /* 0x28 */ - u32 hi_system_sleep_setting; /* 0x2c */ - u32 hi_xtal_control_setting; /* 0x30 */ - u32 hi_pll_ctrl_setting_24ghz; /* 0x34 */ - u32 hi_pll_ctrl_setting_5ghz; /* 0x38 */ - u32 hi_ref_voltage_trim_setting; /* 0x3c */ - u32 hi_clock_info; /* 0x40 */ - - /* - * Flash configuration overrides, used only - * when firmware is not executing from flash. - * (When using flash, modify the global variables - * with equivalent names.) - */ - u32 hi_bank0_addr_value; /* 0x44 */ - u32 hi_bank0_read_value; /* 0x48 */ - u32 hi_bank0_write_value; /* 0x4c */ - u32 hi_bank0_config_value; /* 0x50 */ - - /* Pointer to Board Data */ - u32 hi_board_data; /* 0x54 */ - u32 hi_board_data_initialized; /* 0x58 */ - - u32 hi_dset_ram_index_tbl; /* 0x5c */ - - u32 hi_desired_baud_rate; /* 0x60 */ - u32 hi_dbglog_config; /* 0x64 */ - u32 hi_end_ram_reserve_sz; /* 0x68 */ - u32 hi_mbox_io_block_sz; /* 0x6c */ - - u32 hi_num_bpatch_streams; /* 0x70 -- unused */ - u32 hi_mbox_isr_yield_limit; /* 0x74 */ - - u32 hi_refclk_hz; /* 0x78 */ - u32 hi_ext_clk_detected; /* 0x7c */ - u32 hi_dbg_uart_txpin; /* 0x80 */ - u32 hi_dbg_uart_rxpin; /* 0x84 */ - u32 hi_hci_uart_baud; /* 0x88 */ - u32 hi_hci_uart_pin_assignments; /* 0x8C */ - /* - * NOTE: byte [0] = tx pin, [1] = rx pin, [2] = rts pin, [3] = cts - * pin - */ - u32 hi_hci_uart_baud_scale_val; /* 0x90 */ - u32 hi_hci_uart_baud_step_val; /* 0x94 */ - - u32 hi_allocram_start; /* 0x98 */ - u32 hi_allocram_sz; /* 0x9c */ - u32 hi_hci_bridge_flags; /* 0xa0 */ - u32 hi_hci_uart_support_pins; /* 0xa4 */ - /* - * NOTE: byte [0] = RESET pin (bit 7 is polarity), - * bytes[1]..bytes[3] are for future use - */ - u32 hi_hci_uart_pwr_mgmt_params; /* 0xa8 */ - /* - * 0xa8 - [1]: 0 = UART FC active low, 1 = UART FC active high - * [31:16]: wakeup timeout in ms - */ - - /* Pointer to extended board data */ - u32 hi_board_ext_data; /* 0xac */ - u32 hi_board_ext_data_config; /* 0xb0 */ - - /* - * Bit [0] : valid - * Bit[31:16: size - */ - /* - * hi_reset_flag is used to do some stuff when target reset. - * such as restore app_start after warm reset or - * preserve host Interest area, or preserve ROM data, literals etc. - */ - u32 hi_reset_flag; /* 0xb4 */ - /* indicate hi_reset_flag is valid */ - u32 hi_reset_flag_valid; /* 0xb8 */ - u32 hi_hci_uart_pwr_mgmt_params_ext; /* 0xbc */ - /* - * 0xbc - [31:0]: idle timeout in ms - */ - /* ACS flags */ - u32 hi_acs_flags; /* 0xc0 */ - u32 hi_console_flags; /* 0xc4 */ - u32 hi_nvram_state; /* 0xc8 */ - u32 hi_option_flag2; /* 0xcc */ - - /* If non-zero, override values sent to Host in WMI_READY event. */ - u32 hi_sw_version_override; /* 0xd0 */ - u32 hi_abi_version_override; /* 0xd4 */ - - /* - * Percentage of high priority RX traffic to total expected RX traffic - - * applicable only to ar6004 - */ - u32 hi_hp_rx_traffic_ratio; /* 0xd8 */ - - /* test applications flags */ - u32 hi_test_apps_related ; /* 0xdc */ - /* location of test script */ - u32 hi_ota_testscript; /* 0xe0 */ - /* location of CAL data */ - u32 hi_cal_data; /* 0xe4 */ - /* Number of packet log buffers */ - u32 hi_pktlog_num_buffers; /* 0xe8 */ - -} __packed; - -#define HI_ITEM(item) offsetof(struct host_interest, item) - -#define HI_OPTION_MAC_ADDR_METHOD_SHIFT 3 - -#define HI_OPTION_FW_MODE_IBSS 0x0 -#define HI_OPTION_FW_MODE_BSS_STA 0x1 -#define HI_OPTION_FW_MODE_AP 0x2 - -#define HI_OPTION_FW_SUBMODE_NONE 0x0 -#define HI_OPTION_FW_SUBMODE_P2PDEV 0x1 -#define HI_OPTION_FW_SUBMODE_P2PCLIENT 0x2 -#define HI_OPTION_FW_SUBMODE_P2PGO 0x3 - -#define HI_OPTION_NUM_DEV_SHIFT 0x9 - -#define HI_OPTION_FW_BRIDGE_SHIFT 0x04 - -/* Fw Mode/SubMode Mask -|------------------------------------------------------------------------------| -| SUB | SUB | SUB | SUB | | | | -| MODE[3] | MODE[2] | MODE[1] | MODE[0] | MODE[3] | MODE[2] | MODE[1] | MODE[0| -| (2) | (2) | (2) | (2) | (2) | (2) | (2) | (2) -|------------------------------------------------------------------------------| -*/ -#define HI_OPTION_FW_MODE_BITS 0x2 -#define HI_OPTION_FW_MODE_SHIFT 0xC - -#define HI_OPTION_FW_SUBMODE_BITS 0x2 -#define HI_OPTION_FW_SUBMODE_SHIFT 0x14 - -/* Convert a Target virtual address into a Target physical address */ -#define AR6003_VTOP(vaddr) ((vaddr) & 0x001fffff) -#define AR6004_VTOP(vaddr) (vaddr) - -#define TARG_VTOP(target_type, vaddr) \ - (((target_type) == TARGET_TYPE_AR6003) ? AR6003_VTOP(vaddr) : \ - (((target_type) == TARGET_TYPE_AR6004) ? AR6004_VTOP(vaddr) : 0)) - -#define ATH6KL_FWLOG_PAYLOAD_SIZE 1500 - -struct ath6kl_dbglog_buf { - __le32 next; - __le32 buffer_addr; - __le32 bufsize; - __le32 length; - __le32 count; - __le32 free; -} __packed; - -struct ath6kl_dbglog_hdr { - __le32 dbuf_addr; - __le32 dropped; -} __packed; - -#endif diff --git a/drivers/net/wireless/ath/ath6kl/testmode.c b/drivers/net/wireless/ath/ath6kl/testmode.c deleted file mode 100644 index acc9aa832f76..000000000000 --- a/drivers/net/wireless/ath/ath6kl/testmode.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * Copyright (c) 2011 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "testmode.h" -#include "debug.h" - -#include - -enum ath6kl_tm_attr { - __ATH6KL_TM_ATTR_INVALID = 0, - ATH6KL_TM_ATTR_CMD = 1, - ATH6KL_TM_ATTR_DATA = 2, - - /* keep last */ - __ATH6KL_TM_ATTR_AFTER_LAST, - ATH6KL_TM_ATTR_MAX = __ATH6KL_TM_ATTR_AFTER_LAST - 1, -}; - -enum ath6kl_tm_cmd { - ATH6KL_TM_CMD_TCMD = 0, - ATH6KL_TM_CMD_RX_REPORT = 1, /* not used anymore */ -}; - -#define ATH6KL_TM_DATA_MAX_LEN 5000 - -static const struct nla_policy ath6kl_tm_policy[ATH6KL_TM_ATTR_MAX + 1] = { - [ATH6KL_TM_ATTR_CMD] = { .type = NLA_U32 }, - [ATH6KL_TM_ATTR_DATA] = { .type = NLA_BINARY, - .len = ATH6KL_TM_DATA_MAX_LEN }, -}; - -void ath6kl_tm_rx_event(struct ath6kl *ar, void *buf, size_t buf_len) -{ - struct sk_buff *skb; - - if (!buf || buf_len == 0) - return; - - skb = cfg80211_testmode_alloc_event_skb(ar->wiphy, buf_len, GFP_KERNEL); - if (!skb) { - ath6kl_warn("failed to allocate testmode rx skb!\n"); - return; - } - if (nla_put_u32(skb, ATH6KL_TM_ATTR_CMD, ATH6KL_TM_CMD_TCMD) || - nla_put(skb, ATH6KL_TM_ATTR_DATA, buf_len, buf)) - goto nla_put_failure; - cfg80211_testmode_event(skb, GFP_KERNEL); - return; - -nla_put_failure: - kfree_skb(skb); - ath6kl_warn("nla_put failed on testmode rx skb!\n"); -} - -int ath6kl_tm_cmd(struct wiphy *wiphy, void *data, int len) -{ - struct ath6kl *ar = wiphy_priv(wiphy); - struct nlattr *tb[ATH6KL_TM_ATTR_MAX + 1]; - int err, buf_len; - void *buf; - - err = nla_parse(tb, ATH6KL_TM_ATTR_MAX, data, len, - ath6kl_tm_policy); - if (err) - return err; - - if (!tb[ATH6KL_TM_ATTR_CMD]) - return -EINVAL; - - switch (nla_get_u32(tb[ATH6KL_TM_ATTR_CMD])) { - case ATH6KL_TM_CMD_TCMD: - if (!tb[ATH6KL_TM_ATTR_DATA]) - return -EINVAL; - - buf = nla_data(tb[ATH6KL_TM_ATTR_DATA]); - buf_len = nla_len(tb[ATH6KL_TM_ATTR_DATA]); - - ath6kl_wmi_test_cmd(ar->wmi, buf, buf_len); - - return 0; - - break; - case ATH6KL_TM_CMD_RX_REPORT: - default: - return -EOPNOTSUPP; - } -} diff --git a/drivers/net/wireless/ath/ath6kl/testmode.h b/drivers/net/wireless/ath/ath6kl/testmode.h deleted file mode 100644 index fe651d6707df..000000000000 --- a/drivers/net/wireless/ath/ath6kl/testmode.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * Copyright (c) 2011 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "core.h" - -#ifdef CONFIG_NL80211_TESTMODE - -void ath6kl_tm_rx_event(struct ath6kl *ar, void *buf, size_t buf_len); -int ath6kl_tm_cmd(struct wiphy *wiphy, void *data, int len); - -#else - -static inline void ath6kl_tm_rx_event(struct ath6kl *ar, void *buf, - size_t buf_len) -{ -} - -static inline int ath6kl_tm_cmd(struct wiphy *wiphy, void *data, int len) -{ - return 0; -} - -#endif diff --git a/drivers/net/wireless/ath/ath6kl/trace.c b/drivers/net/wireless/ath/ath6kl/trace.c deleted file mode 100644 index e7d64b1285cb..000000000000 --- a/drivers/net/wireless/ath/ath6kl/trace.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#define CREATE_TRACE_POINTS -#include "trace.h" - -EXPORT_TRACEPOINT_SYMBOL(ath6kl_sdio); -EXPORT_TRACEPOINT_SYMBOL(ath6kl_sdio_scat); diff --git a/drivers/net/wireless/ath/ath6kl/trace.h b/drivers/net/wireless/ath/ath6kl/trace.h deleted file mode 100644 index 1a1ea7881b4d..000000000000 --- a/drivers/net/wireless/ath/ath6kl/trace.h +++ /dev/null @@ -1,332 +0,0 @@ -#if !defined(_ATH6KL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) - -#include -#include -#include -#include "wmi.h" -#include "hif.h" - -#if !defined(_ATH6KL_TRACE_H) -static inline unsigned int ath6kl_get_wmi_id(void *buf, size_t buf_len) -{ - struct wmi_cmd_hdr *hdr = buf; - - if (buf_len < sizeof(*hdr)) - return 0; - - return le16_to_cpu(hdr->cmd_id); -} -#endif /* __ATH6KL_TRACE_H */ - -#define _ATH6KL_TRACE_H - -/* create empty functions when tracing is disabled */ -#if !defined(CONFIG_ATH6KL_TRACING) -#undef TRACE_EVENT -#define TRACE_EVENT(name, proto, ...) \ -static inline void trace_ ## name(proto) {} -#undef DECLARE_EVENT_CLASS -#define DECLARE_EVENT_CLASS(...) -#undef DEFINE_EVENT -#define DEFINE_EVENT(evt_class, name, proto, ...) \ -static inline void trace_ ## name(proto) {} -#endif /* !CONFIG_ATH6KL_TRACING || __CHECKER__ */ - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM ath6kl - -TRACE_EVENT(ath6kl_wmi_cmd, - TP_PROTO(void *buf, size_t buf_len), - - TP_ARGS(buf, buf_len), - - TP_STRUCT__entry( - __field(unsigned int, id) - __field(size_t, buf_len) - __dynamic_array(u8, buf, buf_len) - ), - - TP_fast_assign( - __entry->id = ath6kl_get_wmi_id(buf, buf_len); - __entry->buf_len = buf_len; - memcpy(__get_dynamic_array(buf), buf, buf_len); - ), - - TP_printk( - "id %d len %zd", - __entry->id, __entry->buf_len - ) -); - -TRACE_EVENT(ath6kl_wmi_event, - TP_PROTO(void *buf, size_t buf_len), - - TP_ARGS(buf, buf_len), - - TP_STRUCT__entry( - __field(unsigned int, id) - __field(size_t, buf_len) - __dynamic_array(u8, buf, buf_len) - ), - - TP_fast_assign( - __entry->id = ath6kl_get_wmi_id(buf, buf_len); - __entry->buf_len = buf_len; - memcpy(__get_dynamic_array(buf), buf, buf_len); - ), - - TP_printk( - "id %d len %zd", - __entry->id, __entry->buf_len - ) -); - -TRACE_EVENT(ath6kl_sdio, - TP_PROTO(unsigned int addr, int flags, - void *buf, size_t buf_len), - - TP_ARGS(addr, flags, buf, buf_len), - - TP_STRUCT__entry( - __field(unsigned int, tx) - __field(unsigned int, addr) - __field(int, flags) - __field(size_t, buf_len) - __dynamic_array(u8, buf, buf_len) - ), - - TP_fast_assign( - __entry->addr = addr; - __entry->flags = flags; - __entry->buf_len = buf_len; - memcpy(__get_dynamic_array(buf), buf, buf_len); - - if (flags & HIF_WRITE) - __entry->tx = 1; - else - __entry->tx = 0; - ), - - TP_printk( - "%s addr 0x%x flags 0x%x len %zd\n", - __entry->tx ? "tx" : "rx", - __entry->addr, - __entry->flags, - __entry->buf_len - ) -); - -TRACE_EVENT(ath6kl_sdio_scat, - TP_PROTO(unsigned int addr, int flags, unsigned int total_len, - unsigned int entries, struct hif_scatter_item *list), - - TP_ARGS(addr, flags, total_len, entries, list), - - TP_STRUCT__entry( - __field(unsigned int, tx) - __field(unsigned int, addr) - __field(int, flags) - __field(unsigned int, entries) - __field(size_t, total_len) - __dynamic_array(unsigned int, len_array, entries) - __dynamic_array(u8, data, total_len) - ), - - TP_fast_assign( - unsigned int *len_array; - int i, offset = 0; - size_t len; - - __entry->addr = addr; - __entry->flags = flags; - __entry->entries = entries; - __entry->total_len = total_len; - - if (flags & HIF_WRITE) - __entry->tx = 1; - else - __entry->tx = 0; - - len_array = __get_dynamic_array(len_array); - - for (i = 0; i < entries; i++) { - len = list[i].len; - - memcpy((u8 *) __get_dynamic_array(data) + offset, - list[i].buf, len); - - len_array[i] = len; - offset += len; - } - ), - - TP_printk( - "%s addr 0x%x flags 0x%x entries %d total_len %zd\n", - __entry->tx ? "tx" : "rx", - __entry->addr, - __entry->flags, - __entry->entries, - __entry->total_len - ) -); - -TRACE_EVENT(ath6kl_sdio_irq, - TP_PROTO(void *buf, size_t buf_len), - - TP_ARGS(buf, buf_len), - - TP_STRUCT__entry( - __field(size_t, buf_len) - __dynamic_array(u8, buf, buf_len) - ), - - TP_fast_assign( - __entry->buf_len = buf_len; - memcpy(__get_dynamic_array(buf), buf, buf_len); - ), - - TP_printk( - "irq len %zd\n", __entry->buf_len - ) -); - -TRACE_EVENT(ath6kl_htc_rx, - TP_PROTO(int status, int endpoint, void *buf, - size_t buf_len), - - TP_ARGS(status, endpoint, buf, buf_len), - - TP_STRUCT__entry( - __field(int, status) - __field(int, endpoint) - __field(size_t, buf_len) - __dynamic_array(u8, buf, buf_len) - ), - - TP_fast_assign( - __entry->status = status; - __entry->endpoint = endpoint; - __entry->buf_len = buf_len; - memcpy(__get_dynamic_array(buf), buf, buf_len); - ), - - TP_printk( - "status %d endpoint %d len %zd\n", - __entry->status, - __entry->endpoint, - __entry->buf_len - ) -); - -TRACE_EVENT(ath6kl_htc_tx, - TP_PROTO(int status, int endpoint, void *buf, - size_t buf_len), - - TP_ARGS(status, endpoint, buf, buf_len), - - TP_STRUCT__entry( - __field(int, status) - __field(int, endpoint) - __field(size_t, buf_len) - __dynamic_array(u8, buf, buf_len) - ), - - TP_fast_assign( - __entry->status = status; - __entry->endpoint = endpoint; - __entry->buf_len = buf_len; - memcpy(__get_dynamic_array(buf), buf, buf_len); - ), - - TP_printk( - "status %d endpoint %d len %zd\n", - __entry->status, - __entry->endpoint, - __entry->buf_len - ) -); - -#define ATH6KL_MSG_MAX 200 - -DECLARE_EVENT_CLASS(ath6kl_log_event, - TP_PROTO(struct va_format *vaf), - TP_ARGS(vaf), - TP_STRUCT__entry( - __dynamic_array(char, msg, ATH6KL_MSG_MAX) - ), - TP_fast_assign( - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), - ATH6KL_MSG_MAX, - vaf->fmt, - *vaf->va) >= ATH6KL_MSG_MAX); - ), - TP_printk("%s", __get_str(msg)) -); - -DEFINE_EVENT(ath6kl_log_event, ath6kl_log_err, - TP_PROTO(struct va_format *vaf), - TP_ARGS(vaf) -); - -DEFINE_EVENT(ath6kl_log_event, ath6kl_log_warn, - TP_PROTO(struct va_format *vaf), - TP_ARGS(vaf) -); - -DEFINE_EVENT(ath6kl_log_event, ath6kl_log_info, - TP_PROTO(struct va_format *vaf), - TP_ARGS(vaf) -); - -TRACE_EVENT(ath6kl_log_dbg, - TP_PROTO(unsigned int level, struct va_format *vaf), - TP_ARGS(level, vaf), - TP_STRUCT__entry( - __field(unsigned int, level) - __dynamic_array(char, msg, ATH6KL_MSG_MAX) - ), - TP_fast_assign( - __entry->level = level; - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), - ATH6KL_MSG_MAX, - vaf->fmt, - *vaf->va) >= ATH6KL_MSG_MAX); - ), - TP_printk("%s", __get_str(msg)) -); - -TRACE_EVENT(ath6kl_log_dbg_dump, - TP_PROTO(const char *msg, const char *prefix, - const void *buf, size_t buf_len), - - TP_ARGS(msg, prefix, buf, buf_len), - - TP_STRUCT__entry( - __string(msg, msg) - __string(prefix, prefix) - __field(size_t, buf_len) - __dynamic_array(u8, buf, buf_len) - ), - - TP_fast_assign( - __assign_str(msg, msg); - __assign_str(prefix, prefix); - __entry->buf_len = buf_len; - memcpy(__get_dynamic_array(buf), buf, buf_len); - ), - - TP_printk( - "%s/%s\n", __get_str(prefix), __get_str(msg) - ) -); - -#endif /* _ ATH6KL_TRACE_H || TRACE_HEADER_MULTI_READ*/ - -/* we don't want to use include/trace/events */ -#undef TRACE_INCLUDE_PATH -#define TRACE_INCLUDE_PATH . -#undef TRACE_INCLUDE_FILE -#define TRACE_INCLUDE_FILE trace - -/* This part must be outside protection */ -#include diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c deleted file mode 100644 index ebb24045a8ae..000000000000 --- a/drivers/net/wireless/ath/ath6kl/txrx.c +++ /dev/null @@ -1,1872 +0,0 @@ -/* - * Copyright (c) 2004-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include "core.h" -#include "debug.h" -#include "htc-ops.h" -#include "trace.h" - -/* - * tid - tid_mux0..tid_mux3 - * aid - tid_mux4..tid_mux7 - */ -#define ATH6KL_TID_MASK 0xf -#define ATH6KL_AID_SHIFT 4 - -static inline u8 ath6kl_get_tid(u8 tid_mux) -{ - return tid_mux & ATH6KL_TID_MASK; -} - -static inline u8 ath6kl_get_aid(u8 tid_mux) -{ - return tid_mux >> ATH6KL_AID_SHIFT; -} - -static u8 ath6kl_ibss_map_epid(struct sk_buff *skb, struct net_device *dev, - u32 *map_no) -{ - struct ath6kl *ar = ath6kl_priv(dev); - struct ethhdr *eth_hdr; - u32 i, ep_map = -1; - u8 *datap; - - *map_no = 0; - datap = skb->data; - eth_hdr = (struct ethhdr *) (datap + sizeof(struct wmi_data_hdr)); - - if (is_multicast_ether_addr(eth_hdr->h_dest)) - return ENDPOINT_2; - - for (i = 0; i < ar->node_num; i++) { - if (memcmp(eth_hdr->h_dest, ar->node_map[i].mac_addr, - ETH_ALEN) == 0) { - *map_no = i + 1; - ar->node_map[i].tx_pend++; - return ar->node_map[i].ep_id; - } - - if ((ep_map == -1) && !ar->node_map[i].tx_pend) - ep_map = i; - } - - if (ep_map == -1) { - ep_map = ar->node_num; - ar->node_num++; - if (ar->node_num > MAX_NODE_NUM) - return ENDPOINT_UNUSED; - } - - memcpy(ar->node_map[ep_map].mac_addr, eth_hdr->h_dest, ETH_ALEN); - - for (i = ENDPOINT_2; i <= ENDPOINT_5; i++) { - if (!ar->tx_pending[i]) { - ar->node_map[ep_map].ep_id = i; - break; - } - - /* - * No free endpoint is available, start redistribution on - * the inuse endpoints. - */ - if (i == ENDPOINT_5) { - ar->node_map[ep_map].ep_id = ar->next_ep_id; - ar->next_ep_id++; - if (ar->next_ep_id > ENDPOINT_5) - ar->next_ep_id = ENDPOINT_2; - } - } - - *map_no = ep_map + 1; - ar->node_map[ep_map].tx_pend++; - - return ar->node_map[ep_map].ep_id; -} - -static bool ath6kl_process_uapsdq(struct ath6kl_sta *conn, - struct ath6kl_vif *vif, - struct sk_buff *skb, - u32 *flags) -{ - struct ath6kl *ar = vif->ar; - bool is_apsdq_empty = false; - struct ethhdr *datap = (struct ethhdr *) skb->data; - u8 up = 0, traffic_class, *ip_hdr; - u16 ether_type; - struct ath6kl_llc_snap_hdr *llc_hdr; - - if (conn->sta_flags & STA_PS_APSD_TRIGGER) { - /* - * This tx is because of a uAPSD trigger, determine - * more and EOSP bit. Set EOSP if queue is empty - * or sufficient frames are delivered for this trigger. - */ - spin_lock_bh(&conn->psq_lock); - if (!skb_queue_empty(&conn->apsdq)) - *flags |= WMI_DATA_HDR_FLAGS_MORE; - else if (conn->sta_flags & STA_PS_APSD_EOSP) - *flags |= WMI_DATA_HDR_FLAGS_EOSP; - *flags |= WMI_DATA_HDR_FLAGS_UAPSD; - spin_unlock_bh(&conn->psq_lock); - return false; - } else if (!conn->apsd_info) - return false; - - if (test_bit(WMM_ENABLED, &vif->flags)) { - ether_type = be16_to_cpu(datap->h_proto); - if (is_ethertype(ether_type)) { - /* packet is in DIX format */ - ip_hdr = (u8 *)(datap + 1); - } else { - /* packet is in 802.3 format */ - llc_hdr = (struct ath6kl_llc_snap_hdr *) - (datap + 1); - ether_type = be16_to_cpu(llc_hdr->eth_type); - ip_hdr = (u8 *)(llc_hdr + 1); - } - - if (ether_type == IP_ETHERTYPE) - up = ath6kl_wmi_determine_user_priority( - ip_hdr, 0); - } - - traffic_class = ath6kl_wmi_get_traffic_class(up); - - if ((conn->apsd_info & (1 << traffic_class)) == 0) - return false; - - /* Queue the frames if the STA is sleeping */ - spin_lock_bh(&conn->psq_lock); - is_apsdq_empty = skb_queue_empty(&conn->apsdq); - skb_queue_tail(&conn->apsdq, skb); - spin_unlock_bh(&conn->psq_lock); - - /* - * If this is the first pkt getting queued - * for this STA, update the PVB for this STA - */ - if (is_apsdq_empty) { - ath6kl_wmi_set_apsd_bfrd_traf(ar->wmi, - vif->fw_vif_idx, - conn->aid, 1, 0); - } - *flags |= WMI_DATA_HDR_FLAGS_UAPSD; - - return true; -} - -static bool ath6kl_process_psq(struct ath6kl_sta *conn, - struct ath6kl_vif *vif, - struct sk_buff *skb, - u32 *flags) -{ - bool is_psq_empty = false; - struct ath6kl *ar = vif->ar; - - if (conn->sta_flags & STA_PS_POLLED) { - spin_lock_bh(&conn->psq_lock); - if (!skb_queue_empty(&conn->psq)) - *flags |= WMI_DATA_HDR_FLAGS_MORE; - spin_unlock_bh(&conn->psq_lock); - return false; - } - - /* Queue the frames if the STA is sleeping */ - spin_lock_bh(&conn->psq_lock); - is_psq_empty = skb_queue_empty(&conn->psq); - skb_queue_tail(&conn->psq, skb); - spin_unlock_bh(&conn->psq_lock); - - /* - * If this is the first pkt getting queued - * for this STA, update the PVB for this - * STA. - */ - if (is_psq_empty) - ath6kl_wmi_set_pvb_cmd(ar->wmi, - vif->fw_vif_idx, - conn->aid, 1); - return true; -} - -static bool ath6kl_powersave_ap(struct ath6kl_vif *vif, struct sk_buff *skb, - u32 *flags) -{ - struct ethhdr *datap = (struct ethhdr *) skb->data; - struct ath6kl_sta *conn = NULL; - bool ps_queued = false; - struct ath6kl *ar = vif->ar; - - if (is_multicast_ether_addr(datap->h_dest)) { - u8 ctr = 0; - bool q_mcast = false; - - for (ctr = 0; ctr < AP_MAX_NUM_STA; ctr++) { - if (ar->sta_list[ctr].sta_flags & STA_PS_SLEEP) { - q_mcast = true; - break; - } - } - - if (q_mcast) { - /* - * If this transmit is not because of a Dtim Expiry - * q it. - */ - if (!test_bit(DTIM_EXPIRED, &vif->flags)) { - bool is_mcastq_empty = false; - - spin_lock_bh(&ar->mcastpsq_lock); - is_mcastq_empty = - skb_queue_empty(&ar->mcastpsq); - skb_queue_tail(&ar->mcastpsq, skb); - spin_unlock_bh(&ar->mcastpsq_lock); - - /* - * If this is the first Mcast pkt getting - * queued indicate to the target to set the - * BitmapControl LSB of the TIM IE. - */ - if (is_mcastq_empty) - ath6kl_wmi_set_pvb_cmd(ar->wmi, - vif->fw_vif_idx, - MCAST_AID, 1); - - ps_queued = true; - } else { - /* - * This transmit is because of Dtim expiry. - * Determine if MoreData bit has to be set. - */ - spin_lock_bh(&ar->mcastpsq_lock); - if (!skb_queue_empty(&ar->mcastpsq)) - *flags |= WMI_DATA_HDR_FLAGS_MORE; - spin_unlock_bh(&ar->mcastpsq_lock); - } - } - } else { - conn = ath6kl_find_sta(vif, datap->h_dest); - if (!conn) { - dev_kfree_skb(skb); - - /* Inform the caller that the skb is consumed */ - return true; - } - - if (conn->sta_flags & STA_PS_SLEEP) { - ps_queued = ath6kl_process_uapsdq(conn, - vif, skb, flags); - if (!(*flags & WMI_DATA_HDR_FLAGS_UAPSD)) - ps_queued = ath6kl_process_psq(conn, - vif, skb, flags); - } - } - return ps_queued; -} - -/* Tx functions */ - -int ath6kl_control_tx(void *devt, struct sk_buff *skb, - enum htc_endpoint_id eid) -{ - struct ath6kl *ar = devt; - int status = 0; - struct ath6kl_cookie *cookie = NULL; - - trace_ath6kl_wmi_cmd(skb->data, skb->len); - - if (WARN_ON_ONCE(ar->state == ATH6KL_STATE_WOW)) { - dev_kfree_skb(skb); - return -EACCES; - } - - if (WARN_ON_ONCE(eid == ENDPOINT_UNUSED || - eid >= ENDPOINT_MAX)) { - status = -EINVAL; - goto fail_ctrl_tx; - } - - spin_lock_bh(&ar->lock); - - ath6kl_dbg(ATH6KL_DBG_WLAN_TX, - "%s: skb=0x%p, len=0x%x eid =%d\n", __func__, - skb, skb->len, eid); - - if (test_bit(WMI_CTRL_EP_FULL, &ar->flag) && (eid == ar->ctrl_ep)) { - /* - * Control endpoint is full, don't allocate resources, we - * are just going to drop this packet. - */ - cookie = NULL; - ath6kl_err("wmi ctrl ep full, dropping pkt : 0x%p, len:%d\n", - skb, skb->len); - } else - cookie = ath6kl_alloc_cookie(ar); - - if (cookie == NULL) { - spin_unlock_bh(&ar->lock); - status = -ENOMEM; - goto fail_ctrl_tx; - } - - ar->tx_pending[eid]++; - - if (eid != ar->ctrl_ep) - ar->total_tx_data_pend++; - - spin_unlock_bh(&ar->lock); - - cookie->skb = skb; - cookie->map_no = 0; - set_htc_pkt_info(&cookie->htc_pkt, cookie, skb->data, skb->len, - eid, ATH6KL_CONTROL_PKT_TAG); - cookie->htc_pkt.skb = skb; - - /* - * This interface is asynchronous, if there is an error, cleanup - * will happen in the TX completion callback. - */ - ath6kl_htc_tx(ar->htc_target, &cookie->htc_pkt); - - return 0; - -fail_ctrl_tx: - dev_kfree_skb(skb); - return status; -} - -int ath6kl_data_tx(struct sk_buff *skb, struct net_device *dev) -{ - struct ath6kl *ar = ath6kl_priv(dev); - struct ath6kl_cookie *cookie = NULL; - enum htc_endpoint_id eid = ENDPOINT_UNUSED; - struct ath6kl_vif *vif = netdev_priv(dev); - u32 map_no = 0; - u16 htc_tag = ATH6KL_DATA_PKT_TAG; - u8 ac = 99 ; /* initialize to unmapped ac */ - bool chk_adhoc_ps_mapping = false; - int ret; - struct wmi_tx_meta_v2 meta_v2; - void *meta; - u8 csum_start = 0, csum_dest = 0, csum = skb->ip_summed; - u8 meta_ver = 0; - u32 flags = 0; - - ath6kl_dbg(ATH6KL_DBG_WLAN_TX, - "%s: skb=0x%p, data=0x%p, len=0x%x\n", __func__, - skb, skb->data, skb->len); - - /* If target is not associated */ - if (!test_bit(CONNECTED, &vif->flags)) - goto fail_tx; - - if (WARN_ON_ONCE(ar->state != ATH6KL_STATE_ON)) - goto fail_tx; - - if (!test_bit(WMI_READY, &ar->flag)) - goto fail_tx; - - /* AP mode Power saving processing */ - if (vif->nw_type == AP_NETWORK) { - if (ath6kl_powersave_ap(vif, skb, &flags)) - return 0; - } - - if (test_bit(WMI_ENABLED, &ar->flag)) { - if ((dev->features & NETIF_F_IP_CSUM) && - (csum == CHECKSUM_PARTIAL)) { - csum_start = skb->csum_start - - (skb_network_header(skb) - skb->head) + - sizeof(struct ath6kl_llc_snap_hdr); - csum_dest = skb->csum_offset + csum_start; - } - - if (skb_headroom(skb) < dev->needed_headroom) { - struct sk_buff *tmp_skb = skb; - - skb = skb_realloc_headroom(skb, dev->needed_headroom); - kfree_skb(tmp_skb); - if (skb == NULL) { - vif->net_stats.tx_dropped++; - return 0; - } - } - - if (ath6kl_wmi_dix_2_dot3(ar->wmi, skb)) { - ath6kl_err("ath6kl_wmi_dix_2_dot3 failed\n"); - goto fail_tx; - } - - if ((dev->features & NETIF_F_IP_CSUM) && - (csum == CHECKSUM_PARTIAL)) { - meta_v2.csum_start = csum_start; - meta_v2.csum_dest = csum_dest; - - /* instruct target to calculate checksum */ - meta_v2.csum_flags = WMI_META_V2_FLAG_CSUM_OFFLOAD; - meta_ver = WMI_META_VERSION_2; - meta = &meta_v2; - } else { - meta_ver = 0; - meta = NULL; - } - - ret = ath6kl_wmi_data_hdr_add(ar->wmi, skb, - DATA_MSGTYPE, flags, 0, - meta_ver, - meta, vif->fw_vif_idx); - - if (ret) { - ath6kl_warn("failed to add wmi data header:%d\n" - , ret); - goto fail_tx; - } - - if ((vif->nw_type == ADHOC_NETWORK) && - ar->ibss_ps_enable && test_bit(CONNECTED, &vif->flags)) - chk_adhoc_ps_mapping = true; - else { - /* get the stream mapping */ - ret = ath6kl_wmi_implicit_create_pstream(ar->wmi, - vif->fw_vif_idx, skb, - 0, test_bit(WMM_ENABLED, &vif->flags), &ac); - if (ret) - goto fail_tx; - } - } else - goto fail_tx; - - spin_lock_bh(&ar->lock); - - if (chk_adhoc_ps_mapping) - eid = ath6kl_ibss_map_epid(skb, dev, &map_no); - else - eid = ar->ac2ep_map[ac]; - - if (eid == 0 || eid == ENDPOINT_UNUSED) { - ath6kl_err("eid %d is not mapped!\n", eid); - spin_unlock_bh(&ar->lock); - goto fail_tx; - } - - /* allocate resource for this packet */ - cookie = ath6kl_alloc_cookie(ar); - - if (!cookie) { - spin_unlock_bh(&ar->lock); - goto fail_tx; - } - - /* update counts while the lock is held */ - ar->tx_pending[eid]++; - ar->total_tx_data_pend++; - - spin_unlock_bh(&ar->lock); - - if (!IS_ALIGNED((unsigned long) skb->data - HTC_HDR_LENGTH, 4) && - skb_cloned(skb)) { - /* - * We will touch (move the buffer data to align it. Since the - * skb buffer is cloned and not only the header is changed, we - * have to copy it to allow the changes. Since we are copying - * the data here, we may as well align it by reserving suitable - * headroom to avoid the memmove in ath6kl_htc_tx_buf_align(). - */ - struct sk_buff *nskb; - - nskb = skb_copy_expand(skb, HTC_HDR_LENGTH, 0, GFP_ATOMIC); - if (nskb == NULL) - goto fail_tx; - kfree_skb(skb); - skb = nskb; - } - - cookie->skb = skb; - cookie->map_no = map_no; - set_htc_pkt_info(&cookie->htc_pkt, cookie, skb->data, skb->len, - eid, htc_tag); - cookie->htc_pkt.skb = skb; - - ath6kl_dbg_dump(ATH6KL_DBG_RAW_BYTES, __func__, "tx ", - skb->data, skb->len); - - /* - * HTC interface is asynchronous, if this fails, cleanup will - * happen in the ath6kl_tx_complete callback. - */ - ath6kl_htc_tx(ar->htc_target, &cookie->htc_pkt); - - return 0; - -fail_tx: - dev_kfree_skb(skb); - - vif->net_stats.tx_dropped++; - vif->net_stats.tx_aborted_errors++; - - return 0; -} - -/* indicate tx activity or inactivity on a WMI stream */ -void ath6kl_indicate_tx_activity(void *devt, u8 traffic_class, bool active) -{ - struct ath6kl *ar = devt; - enum htc_endpoint_id eid; - int i; - - eid = ar->ac2ep_map[traffic_class]; - - if (!test_bit(WMI_ENABLED, &ar->flag)) - goto notify_htc; - - spin_lock_bh(&ar->lock); - - ar->ac_stream_active[traffic_class] = active; - - if (active) { - /* - * Keep track of the active stream with the highest - * priority. - */ - if (ar->ac_stream_pri_map[traffic_class] > - ar->hiac_stream_active_pri) - /* set the new highest active priority */ - ar->hiac_stream_active_pri = - ar->ac_stream_pri_map[traffic_class]; - - } else { - /* - * We may have to search for the next active stream - * that is the highest priority. - */ - if (ar->hiac_stream_active_pri == - ar->ac_stream_pri_map[traffic_class]) { - /* - * The highest priority stream just went inactive - * reset and search for the "next" highest "active" - * priority stream. - */ - ar->hiac_stream_active_pri = 0; - - for (i = 0; i < WMM_NUM_AC; i++) { - if (ar->ac_stream_active[i] && - (ar->ac_stream_pri_map[i] > - ar->hiac_stream_active_pri)) - /* - * Set the new highest active - * priority. - */ - ar->hiac_stream_active_pri = - ar->ac_stream_pri_map[i]; - } - } - } - - spin_unlock_bh(&ar->lock); - -notify_htc: - /* notify HTC, this may cause credit distribution changes */ - ath6kl_htc_activity_changed(ar->htc_target, eid, active); -} - -enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target, - struct htc_packet *packet) -{ - struct ath6kl *ar = target->dev->ar; - struct ath6kl_vif *vif; - enum htc_endpoint_id endpoint = packet->endpoint; - enum htc_send_full_action action = HTC_SEND_FULL_KEEP; - - if (endpoint == ar->ctrl_ep) { - /* - * Under normal WMI if this is getting full, then something - * is running rampant the host should not be exhausting the - * WMI queue with too many commands the only exception to - * this is during testing using endpointping. - */ - set_bit(WMI_CTRL_EP_FULL, &ar->flag); - ath6kl_err("wmi ctrl ep is full\n"); - ath6kl_recovery_err_notify(ar, ATH6KL_FW_EP_FULL); - return action; - } - - if (packet->info.tx.tag == ATH6KL_CONTROL_PKT_TAG) - return action; - - /* - * The last MAX_HI_COOKIE_NUM "batch" of cookies are reserved for - * the highest active stream. - */ - if (ar->ac_stream_pri_map[ar->ep2ac_map[endpoint]] < - ar->hiac_stream_active_pri && - ar->cookie_count <= - target->endpoint[endpoint].tx_drop_packet_threshold) - /* - * Give preference to the highest priority stream by - * dropping the packets which overflowed. - */ - action = HTC_SEND_FULL_DROP; - - /* FIXME: Locking */ - spin_lock_bh(&ar->list_lock); - list_for_each_entry(vif, &ar->vif_list, list) { - if (vif->nw_type == ADHOC_NETWORK || - action != HTC_SEND_FULL_DROP) { - spin_unlock_bh(&ar->list_lock); - - set_bit(NETQ_STOPPED, &vif->flags); - netif_stop_queue(vif->ndev); - - return action; - } - } - spin_unlock_bh(&ar->list_lock); - - return action; -} - -/* TODO this needs to be looked at */ -static void ath6kl_tx_clear_node_map(struct ath6kl_vif *vif, - enum htc_endpoint_id eid, u32 map_no) -{ - struct ath6kl *ar = vif->ar; - u32 i; - - if (vif->nw_type != ADHOC_NETWORK) - return; - - if (!ar->ibss_ps_enable) - return; - - if (eid == ar->ctrl_ep) - return; - - if (map_no == 0) - return; - - map_no--; - ar->node_map[map_no].tx_pend--; - - if (ar->node_map[map_no].tx_pend) - return; - - if (map_no != (ar->node_num - 1)) - return; - - for (i = ar->node_num; i > 0; i--) { - if (ar->node_map[i - 1].tx_pend) - break; - - memset(&ar->node_map[i - 1], 0, - sizeof(struct ath6kl_node_mapping)); - ar->node_num--; - } -} - -void ath6kl_tx_complete(struct htc_target *target, - struct list_head *packet_queue) -{ - struct ath6kl *ar = target->dev->ar; - struct sk_buff_head skb_queue; - struct htc_packet *packet; - struct sk_buff *skb; - struct ath6kl_cookie *ath6kl_cookie; - u32 map_no = 0; - int status; - enum htc_endpoint_id eid; - bool wake_event = false; - bool flushing[ATH6KL_VIF_MAX] = {false}; - u8 if_idx; - struct ath6kl_vif *vif; - - skb_queue_head_init(&skb_queue); - - /* lock the driver as we update internal state */ - spin_lock_bh(&ar->lock); - - /* reap completed packets */ - while (!list_empty(packet_queue)) { - - packet = list_first_entry(packet_queue, struct htc_packet, - list); - list_del(&packet->list); - - if (WARN_ON_ONCE(packet->endpoint == ENDPOINT_UNUSED || - packet->endpoint >= ENDPOINT_MAX)) - continue; - - ath6kl_cookie = (struct ath6kl_cookie *)packet->pkt_cntxt; - if (WARN_ON_ONCE(!ath6kl_cookie)) - continue; - - status = packet->status; - skb = ath6kl_cookie->skb; - eid = packet->endpoint; - map_no = ath6kl_cookie->map_no; - - if (WARN_ON_ONCE(!skb || !skb->data)) { - dev_kfree_skb(skb); - ath6kl_free_cookie(ar, ath6kl_cookie); - continue; - } - - __skb_queue_tail(&skb_queue, skb); - - if (WARN_ON_ONCE(!status && (packet->act_len != skb->len))) { - ath6kl_free_cookie(ar, ath6kl_cookie); - continue; - } - - ar->tx_pending[eid]--; - - if (eid != ar->ctrl_ep) - ar->total_tx_data_pend--; - - if (eid == ar->ctrl_ep) { - if (test_bit(WMI_CTRL_EP_FULL, &ar->flag)) - clear_bit(WMI_CTRL_EP_FULL, &ar->flag); - - if (ar->tx_pending[eid] == 0) - wake_event = true; - } - - if (eid == ar->ctrl_ep) { - if_idx = wmi_cmd_hdr_get_if_idx( - (struct wmi_cmd_hdr *) packet->buf); - } else { - if_idx = wmi_data_hdr_get_if_idx( - (struct wmi_data_hdr *) packet->buf); - } - - vif = ath6kl_get_vif_by_index(ar, if_idx); - if (!vif) { - ath6kl_free_cookie(ar, ath6kl_cookie); - continue; - } - - if (status) { - if (status == -ECANCELED) - /* a packet was flushed */ - flushing[if_idx] = true; - - vif->net_stats.tx_errors++; - - if (status != -ENOSPC && status != -ECANCELED) - ath6kl_warn("tx complete error: %d\n", status); - - ath6kl_dbg(ATH6KL_DBG_WLAN_TX, - "%s: skb=0x%p data=0x%p len=0x%x eid=%d %s\n", - __func__, skb, packet->buf, packet->act_len, - eid, "error!"); - } else { - ath6kl_dbg(ATH6KL_DBG_WLAN_TX, - "%s: skb=0x%p data=0x%p len=0x%x eid=%d %s\n", - __func__, skb, packet->buf, packet->act_len, - eid, "OK"); - - flushing[if_idx] = false; - vif->net_stats.tx_packets++; - vif->net_stats.tx_bytes += skb->len; - } - - ath6kl_tx_clear_node_map(vif, eid, map_no); - - ath6kl_free_cookie(ar, ath6kl_cookie); - - if (test_bit(NETQ_STOPPED, &vif->flags)) - clear_bit(NETQ_STOPPED, &vif->flags); - } - - spin_unlock_bh(&ar->lock); - - __skb_queue_purge(&skb_queue); - - /* FIXME: Locking */ - spin_lock_bh(&ar->list_lock); - list_for_each_entry(vif, &ar->vif_list, list) { - if (test_bit(CONNECTED, &vif->flags) && - !flushing[vif->fw_vif_idx]) { - spin_unlock_bh(&ar->list_lock); - netif_wake_queue(vif->ndev); - spin_lock_bh(&ar->list_lock); - } - } - spin_unlock_bh(&ar->list_lock); - - if (wake_event) - wake_up(&ar->event_wq); - - return; -} - -void ath6kl_tx_data_cleanup(struct ath6kl *ar) -{ - int i; - - /* flush all the data (non-control) streams */ - for (i = 0; i < WMM_NUM_AC; i++) - ath6kl_htc_flush_txep(ar->htc_target, ar->ac2ep_map[i], - ATH6KL_DATA_PKT_TAG); -} - -/* Rx functions */ - -static void ath6kl_deliver_frames_to_nw_stack(struct net_device *dev, - struct sk_buff *skb) -{ - if (!skb) - return; - - skb->dev = dev; - - if (!(skb->dev->flags & IFF_UP)) { - dev_kfree_skb(skb); - return; - } - - skb->protocol = eth_type_trans(skb, skb->dev); - - netif_rx_ni(skb); -} - -static void ath6kl_alloc_netbufs(struct sk_buff_head *q, u16 num) -{ - struct sk_buff *skb; - - while (num) { - skb = ath6kl_buf_alloc(ATH6KL_BUFFER_SIZE); - if (!skb) { - ath6kl_err("netbuf allocation failed\n"); - return; - } - skb_queue_tail(q, skb); - num--; - } -} - -static struct sk_buff *aggr_get_free_skb(struct aggr_info *p_aggr) -{ - struct sk_buff *skb = NULL; - - if (skb_queue_len(&p_aggr->rx_amsdu_freeq) < - (AGGR_NUM_OF_FREE_NETBUFS >> 2)) - ath6kl_alloc_netbufs(&p_aggr->rx_amsdu_freeq, - AGGR_NUM_OF_FREE_NETBUFS); - - skb = skb_dequeue(&p_aggr->rx_amsdu_freeq); - - return skb; -} - -void ath6kl_rx_refill(struct htc_target *target, enum htc_endpoint_id endpoint) -{ - struct ath6kl *ar = target->dev->ar; - struct sk_buff *skb; - int rx_buf; - int n_buf_refill; - struct htc_packet *packet; - struct list_head queue; - - n_buf_refill = ATH6KL_MAX_RX_BUFFERS - - ath6kl_htc_get_rxbuf_num(ar->htc_target, endpoint); - - if (n_buf_refill <= 0) - return; - - INIT_LIST_HEAD(&queue); - - ath6kl_dbg(ATH6KL_DBG_WLAN_RX, - "%s: providing htc with %d buffers at eid=%d\n", - __func__, n_buf_refill, endpoint); - - for (rx_buf = 0; rx_buf < n_buf_refill; rx_buf++) { - skb = ath6kl_buf_alloc(ATH6KL_BUFFER_SIZE); - if (!skb) - break; - - packet = (struct htc_packet *) skb->head; - if (!IS_ALIGNED((unsigned long) skb->data, 4)) { - size_t len = skb_headlen(skb); - skb->data = PTR_ALIGN(skb->data - 4, 4); - skb_set_tail_pointer(skb, len); - } - set_htc_rxpkt_info(packet, skb, skb->data, - ATH6KL_BUFFER_SIZE, endpoint); - packet->skb = skb; - list_add_tail(&packet->list, &queue); - } - - if (!list_empty(&queue)) - ath6kl_htc_add_rxbuf_multiple(ar->htc_target, &queue); -} - -void ath6kl_refill_amsdu_rxbufs(struct ath6kl *ar, int count) -{ - struct htc_packet *packet; - struct sk_buff *skb; - - while (count) { - skb = ath6kl_buf_alloc(ATH6KL_AMSDU_BUFFER_SIZE); - if (!skb) - return; - - packet = (struct htc_packet *) skb->head; - if (!IS_ALIGNED((unsigned long) skb->data, 4)) { - size_t len = skb_headlen(skb); - skb->data = PTR_ALIGN(skb->data - 4, 4); - skb_set_tail_pointer(skb, len); - } - set_htc_rxpkt_info(packet, skb, skb->data, - ATH6KL_AMSDU_BUFFER_SIZE, 0); - packet->skb = skb; - - spin_lock_bh(&ar->lock); - list_add_tail(&packet->list, &ar->amsdu_rx_buffer_queue); - spin_unlock_bh(&ar->lock); - count--; - } -} - -/* - * Callback to allocate a receive buffer for a pending packet. We use a - * pre-allocated list of buffers of maximum AMSDU size (4K). - */ -struct htc_packet *ath6kl_alloc_amsdu_rxbuf(struct htc_target *target, - enum htc_endpoint_id endpoint, - int len) -{ - struct ath6kl *ar = target->dev->ar; - struct htc_packet *packet = NULL; - struct list_head *pkt_pos; - int refill_cnt = 0, depth = 0; - - ath6kl_dbg(ATH6KL_DBG_WLAN_RX, "%s: eid=%d, len:%d\n", - __func__, endpoint, len); - - if ((len <= ATH6KL_BUFFER_SIZE) || - (len > ATH6KL_AMSDU_BUFFER_SIZE)) - return NULL; - - spin_lock_bh(&ar->lock); - - if (list_empty(&ar->amsdu_rx_buffer_queue)) { - spin_unlock_bh(&ar->lock); - refill_cnt = ATH6KL_MAX_AMSDU_RX_BUFFERS; - goto refill_buf; - } - - packet = list_first_entry(&ar->amsdu_rx_buffer_queue, - struct htc_packet, list); - list_del(&packet->list); - list_for_each(pkt_pos, &ar->amsdu_rx_buffer_queue) - depth++; - - refill_cnt = ATH6KL_MAX_AMSDU_RX_BUFFERS - depth; - spin_unlock_bh(&ar->lock); - - /* set actual endpoint ID */ - packet->endpoint = endpoint; - -refill_buf: - if (refill_cnt >= ATH6KL_AMSDU_REFILL_THRESHOLD) - ath6kl_refill_amsdu_rxbufs(ar, refill_cnt); - - return packet; -} - -static void aggr_slice_amsdu(struct aggr_info *p_aggr, - struct rxtid *rxtid, struct sk_buff *skb) -{ - struct sk_buff *new_skb; - struct ethhdr *hdr; - u16 frame_8023_len, payload_8023_len, mac_hdr_len, amsdu_len; - u8 *framep; - - mac_hdr_len = sizeof(struct ethhdr); - framep = skb->data + mac_hdr_len; - amsdu_len = skb->len - mac_hdr_len; - - while (amsdu_len > mac_hdr_len) { - hdr = (struct ethhdr *) framep; - payload_8023_len = ntohs(hdr->h_proto); - - if (payload_8023_len < MIN_MSDU_SUBFRAME_PAYLOAD_LEN || - payload_8023_len > MAX_MSDU_SUBFRAME_PAYLOAD_LEN) { - ath6kl_err("802.3 AMSDU frame bound check failed. len %d\n", - payload_8023_len); - break; - } - - frame_8023_len = payload_8023_len + mac_hdr_len; - new_skb = aggr_get_free_skb(p_aggr); - if (!new_skb) { - ath6kl_err("no buffer available\n"); - break; - } - - memcpy(new_skb->data, framep, frame_8023_len); - skb_put(new_skb, frame_8023_len); - if (ath6kl_wmi_dot3_2_dix(new_skb)) { - ath6kl_err("dot3_2_dix error\n"); - dev_kfree_skb(new_skb); - break; - } - - skb_queue_tail(&rxtid->q, new_skb); - - /* Is this the last subframe within this aggregate ? */ - if ((amsdu_len - frame_8023_len) == 0) - break; - - /* Add the length of A-MSDU subframe padding bytes - - * Round to nearest word. - */ - frame_8023_len = ALIGN(frame_8023_len, 4); - - framep += frame_8023_len; - amsdu_len -= frame_8023_len; - } - - dev_kfree_skb(skb); -} - -static void aggr_deque_frms(struct aggr_info_conn *agg_conn, u8 tid, - u16 seq_no, u8 order) -{ - struct sk_buff *skb; - struct rxtid *rxtid; - struct skb_hold_q *node; - u16 idx, idx_end, seq_end; - struct rxtid_stats *stats; - - rxtid = &agg_conn->rx_tid[tid]; - stats = &agg_conn->stat[tid]; - - spin_lock_bh(&rxtid->lock); - idx = AGGR_WIN_IDX(rxtid->seq_next, rxtid->hold_q_sz); - - /* - * idx_end is typically the last possible frame in the window, - * but changes to 'the' seq_no, when BAR comes. If seq_no - * is non-zero, we will go up to that and stop. - * Note: last seq no in current window will occupy the same - * index position as index that is just previous to start. - * An imp point : if win_sz is 7, for seq_no space of 4095, - * then, there would be holes when sequence wrap around occurs. - * Target should judiciously choose the win_sz, based on - * this condition. For 4095, (TID_WINDOW_SZ = 2 x win_sz - * 2, 4, 8, 16 win_sz works fine). - * We must deque from "idx" to "idx_end", including both. - */ - seq_end = seq_no ? seq_no : rxtid->seq_next; - idx_end = AGGR_WIN_IDX(seq_end, rxtid->hold_q_sz); - - do { - node = &rxtid->hold_q[idx]; - if ((order == 1) && (!node->skb)) - break; - - if (node->skb) { - if (node->is_amsdu) - aggr_slice_amsdu(agg_conn->aggr_info, rxtid, - node->skb); - else - skb_queue_tail(&rxtid->q, node->skb); - node->skb = NULL; - } else - stats->num_hole++; - - rxtid->seq_next = ATH6KL_NEXT_SEQ_NO(rxtid->seq_next); - idx = AGGR_WIN_IDX(rxtid->seq_next, rxtid->hold_q_sz); - } while (idx != idx_end); - - spin_unlock_bh(&rxtid->lock); - - stats->num_delivered += skb_queue_len(&rxtid->q); - - while ((skb = skb_dequeue(&rxtid->q))) - ath6kl_deliver_frames_to_nw_stack(agg_conn->dev, skb); -} - -static bool aggr_process_recv_frm(struct aggr_info_conn *agg_conn, u8 tid, - u16 seq_no, - bool is_amsdu, struct sk_buff *frame) -{ - struct rxtid *rxtid; - struct rxtid_stats *stats; - struct sk_buff *skb; - struct skb_hold_q *node; - u16 idx, st, cur, end; - bool is_queued = false; - u16 extended_end; - - rxtid = &agg_conn->rx_tid[tid]; - stats = &agg_conn->stat[tid]; - - stats->num_into_aggr++; - - if (!rxtid->aggr) { - if (is_amsdu) { - aggr_slice_amsdu(agg_conn->aggr_info, rxtid, frame); - is_queued = true; - stats->num_amsdu++; - while ((skb = skb_dequeue(&rxtid->q))) - ath6kl_deliver_frames_to_nw_stack(agg_conn->dev, - skb); - } - return is_queued; - } - - /* Check the incoming sequence no, if it's in the window */ - st = rxtid->seq_next; - cur = seq_no; - end = (st + rxtid->hold_q_sz-1) & ATH6KL_MAX_SEQ_NO; - - if (((st < end) && (cur < st || cur > end)) || - ((st > end) && (cur > end) && (cur < st))) { - extended_end = (end + rxtid->hold_q_sz - 1) & - ATH6KL_MAX_SEQ_NO; - - if (((end < extended_end) && - (cur < end || cur > extended_end)) || - ((end > extended_end) && (cur > extended_end) && - (cur < end))) { - aggr_deque_frms(agg_conn, tid, 0, 0); - spin_lock_bh(&rxtid->lock); - if (cur >= rxtid->hold_q_sz - 1) - rxtid->seq_next = cur - (rxtid->hold_q_sz - 1); - else - rxtid->seq_next = ATH6KL_MAX_SEQ_NO - - (rxtid->hold_q_sz - 2 - cur); - spin_unlock_bh(&rxtid->lock); - } else { - /* - * Dequeue only those frames that are outside the - * new shifted window. - */ - if (cur >= rxtid->hold_q_sz - 1) - st = cur - (rxtid->hold_q_sz - 1); - else - st = ATH6KL_MAX_SEQ_NO - - (rxtid->hold_q_sz - 2 - cur); - - aggr_deque_frms(agg_conn, tid, st, 0); - } - - stats->num_oow++; - } - - idx = AGGR_WIN_IDX(seq_no, rxtid->hold_q_sz); - - node = &rxtid->hold_q[idx]; - - spin_lock_bh(&rxtid->lock); - - /* - * Is the cur frame duplicate or something beyond our window(hold_q - * -> which is 2x, already)? - * - * 1. Duplicate is easy - drop incoming frame. - * 2. Not falling in current sliding window. - * 2a. is the frame_seq_no preceding current tid_seq_no? - * -> drop the frame. perhaps sender did not get our ACK. - * this is taken care of above. - * 2b. is the frame_seq_no beyond window(st, TID_WINDOW_SZ); - * -> Taken care of it above, by moving window forward. - */ - dev_kfree_skb(node->skb); - stats->num_dups++; - - node->skb = frame; - is_queued = true; - node->is_amsdu = is_amsdu; - node->seq_no = seq_no; - - if (node->is_amsdu) - stats->num_amsdu++; - else - stats->num_mpdu++; - - spin_unlock_bh(&rxtid->lock); - - aggr_deque_frms(agg_conn, tid, 0, 1); - - if (agg_conn->timer_scheduled) - return is_queued; - - spin_lock_bh(&rxtid->lock); - for (idx = 0 ; idx < rxtid->hold_q_sz; idx++) { - if (rxtid->hold_q[idx].skb) { - /* - * There is a frame in the queue and no - * timer so start a timer to ensure that - * the frame doesn't remain stuck - * forever. - */ - agg_conn->timer_scheduled = true; - mod_timer(&agg_conn->timer, - (jiffies + (HZ * AGGR_RX_TIMEOUT) / 1000)); - rxtid->timer_mon = true; - break; - } - } - spin_unlock_bh(&rxtid->lock); - - return is_queued; -} - -static void ath6kl_uapsd_trigger_frame_rx(struct ath6kl_vif *vif, - struct ath6kl_sta *conn) -{ - struct ath6kl *ar = vif->ar; - bool is_apsdq_empty, is_apsdq_empty_at_start; - u32 num_frames_to_deliver, flags; - struct sk_buff *skb = NULL; - - /* - * If the APSD q for this STA is not empty, dequeue and - * send a pkt from the head of the q. Also update the - * More data bit in the WMI_DATA_HDR if there are - * more pkts for this STA in the APSD q. - * If there are no more pkts for this STA, - * update the APSD bitmap for this STA. - */ - - num_frames_to_deliver = (conn->apsd_info >> ATH6KL_APSD_NUM_OF_AC) & - ATH6KL_APSD_FRAME_MASK; - /* - * Number of frames to send in a service period is - * indicated by the station - * in the QOS_INFO of the association request - * If it is zero, send all frames - */ - if (!num_frames_to_deliver) - num_frames_to_deliver = ATH6KL_APSD_ALL_FRAME; - - spin_lock_bh(&conn->psq_lock); - is_apsdq_empty = skb_queue_empty(&conn->apsdq); - spin_unlock_bh(&conn->psq_lock); - is_apsdq_empty_at_start = is_apsdq_empty; - - while ((!is_apsdq_empty) && (num_frames_to_deliver)) { - - spin_lock_bh(&conn->psq_lock); - skb = skb_dequeue(&conn->apsdq); - is_apsdq_empty = skb_queue_empty(&conn->apsdq); - spin_unlock_bh(&conn->psq_lock); - - /* - * Set the STA flag to Trigger delivery, - * so that the frame will go out - */ - conn->sta_flags |= STA_PS_APSD_TRIGGER; - num_frames_to_deliver--; - - /* Last frame in the service period, set EOSP or queue empty */ - if ((is_apsdq_empty) || (!num_frames_to_deliver)) - conn->sta_flags |= STA_PS_APSD_EOSP; - - ath6kl_data_tx(skb, vif->ndev); - conn->sta_flags &= ~(STA_PS_APSD_TRIGGER); - conn->sta_flags &= ~(STA_PS_APSD_EOSP); - } - - if (is_apsdq_empty) { - if (is_apsdq_empty_at_start) - flags = WMI_AP_APSD_NO_DELIVERY_FRAMES; - else - flags = 0; - - ath6kl_wmi_set_apsd_bfrd_traf(ar->wmi, - vif->fw_vif_idx, - conn->aid, 0, flags); - } - - return; -} - -void ath6kl_rx(struct htc_target *target, struct htc_packet *packet) -{ - struct ath6kl *ar = target->dev->ar; - struct sk_buff *skb = packet->pkt_cntxt; - struct wmi_rx_meta_v2 *meta; - struct wmi_data_hdr *dhdr; - int min_hdr_len; - u8 meta_type, dot11_hdr = 0; - u8 pad_before_data_start; - int status = packet->status; - enum htc_endpoint_id ept = packet->endpoint; - bool is_amsdu, prev_ps, ps_state = false; - bool trig_state = false; - struct ath6kl_sta *conn = NULL; - struct sk_buff *skb1 = NULL; - struct ethhdr *datap = NULL; - struct ath6kl_vif *vif; - struct aggr_info_conn *aggr_conn; - u16 seq_no, offset; - u8 tid, if_idx; - - ath6kl_dbg(ATH6KL_DBG_WLAN_RX, - "%s: ar=0x%p eid=%d, skb=0x%p, data=0x%p, len=0x%x status:%d", - __func__, ar, ept, skb, packet->buf, - packet->act_len, status); - - if (status || packet->act_len < HTC_HDR_LENGTH) { - dev_kfree_skb(skb); - return; - } - - skb_put(skb, packet->act_len + HTC_HDR_LENGTH); - skb_pull(skb, HTC_HDR_LENGTH); - - ath6kl_dbg_dump(ATH6KL_DBG_RAW_BYTES, __func__, "rx ", - skb->data, skb->len); - - if (ept == ar->ctrl_ep) { - if (test_bit(WMI_ENABLED, &ar->flag)) { - ath6kl_check_wow_status(ar); - ath6kl_wmi_control_rx(ar->wmi, skb); - return; - } - if_idx = - wmi_cmd_hdr_get_if_idx((struct wmi_cmd_hdr *) skb->data); - } else { - if_idx = - wmi_data_hdr_get_if_idx((struct wmi_data_hdr *) skb->data); - } - - vif = ath6kl_get_vif_by_index(ar, if_idx); - if (!vif) { - dev_kfree_skb(skb); - return; - } - - /* - * Take lock to protect buffer counts and adaptive power throughput - * state. - */ - spin_lock_bh(&vif->if_lock); - - vif->net_stats.rx_packets++; - vif->net_stats.rx_bytes += packet->act_len; - - spin_unlock_bh(&vif->if_lock); - - skb->dev = vif->ndev; - - if (!test_bit(WMI_ENABLED, &ar->flag)) { - if (EPPING_ALIGNMENT_PAD > 0) - skb_pull(skb, EPPING_ALIGNMENT_PAD); - ath6kl_deliver_frames_to_nw_stack(vif->ndev, skb); - return; - } - - ath6kl_check_wow_status(ar); - - min_hdr_len = sizeof(struct ethhdr) + sizeof(struct wmi_data_hdr) + - sizeof(struct ath6kl_llc_snap_hdr); - - dhdr = (struct wmi_data_hdr *) skb->data; - - /* - * In the case of AP mode we may receive NULL data frames - * that do not have LLC hdr. They are 16 bytes in size. - * Allow these frames in the AP mode. - */ - if (vif->nw_type != AP_NETWORK && - ((packet->act_len < min_hdr_len) || - (packet->act_len > WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH))) { - ath6kl_info("frame len is too short or too long\n"); - vif->net_stats.rx_errors++; - vif->net_stats.rx_length_errors++; - dev_kfree_skb(skb); - return; - } - - /* Get the Power save state of the STA */ - if (vif->nw_type == AP_NETWORK) { - meta_type = wmi_data_hdr_get_meta(dhdr); - - ps_state = !!((dhdr->info >> WMI_DATA_HDR_PS_SHIFT) & - WMI_DATA_HDR_PS_MASK); - - offset = sizeof(struct wmi_data_hdr); - trig_state = !!(le16_to_cpu(dhdr->info3) & WMI_DATA_HDR_TRIG); - - switch (meta_type) { - case 0: - break; - case WMI_META_VERSION_1: - offset += sizeof(struct wmi_rx_meta_v1); - break; - case WMI_META_VERSION_2: - offset += sizeof(struct wmi_rx_meta_v2); - break; - default: - break; - } - - datap = (struct ethhdr *) (skb->data + offset); - conn = ath6kl_find_sta(vif, datap->h_source); - - if (!conn) { - dev_kfree_skb(skb); - return; - } - - /* - * If there is a change in PS state of the STA, - * take appropriate steps: - * - * 1. If Sleep-->Awake, flush the psq for the STA - * Clear the PVB for the STA. - * 2. If Awake-->Sleep, Starting queueing frames - * the STA. - */ - prev_ps = !!(conn->sta_flags & STA_PS_SLEEP); - - if (ps_state) - conn->sta_flags |= STA_PS_SLEEP; - else - conn->sta_flags &= ~STA_PS_SLEEP; - - /* Accept trigger only when the station is in sleep */ - if ((conn->sta_flags & STA_PS_SLEEP) && trig_state) - ath6kl_uapsd_trigger_frame_rx(vif, conn); - - if (prev_ps ^ !!(conn->sta_flags & STA_PS_SLEEP)) { - if (!(conn->sta_flags & STA_PS_SLEEP)) { - struct sk_buff *skbuff = NULL; - bool is_apsdq_empty; - struct ath6kl_mgmt_buff *mgmt; - u8 idx; - - spin_lock_bh(&conn->psq_lock); - while (conn->mgmt_psq_len > 0) { - mgmt = list_first_entry( - &conn->mgmt_psq, - struct ath6kl_mgmt_buff, - list); - list_del(&mgmt->list); - conn->mgmt_psq_len--; - spin_unlock_bh(&conn->psq_lock); - idx = vif->fw_vif_idx; - - ath6kl_wmi_send_mgmt_cmd(ar->wmi, - idx, - mgmt->id, - mgmt->freq, - mgmt->wait, - mgmt->buf, - mgmt->len, - mgmt->no_cck); - - kfree(mgmt); - spin_lock_bh(&conn->psq_lock); - } - conn->mgmt_psq_len = 0; - while ((skbuff = skb_dequeue(&conn->psq))) { - spin_unlock_bh(&conn->psq_lock); - ath6kl_data_tx(skbuff, vif->ndev); - spin_lock_bh(&conn->psq_lock); - } - - is_apsdq_empty = skb_queue_empty(&conn->apsdq); - while ((skbuff = skb_dequeue(&conn->apsdq))) { - spin_unlock_bh(&conn->psq_lock); - ath6kl_data_tx(skbuff, vif->ndev); - spin_lock_bh(&conn->psq_lock); - } - spin_unlock_bh(&conn->psq_lock); - - if (!is_apsdq_empty) - ath6kl_wmi_set_apsd_bfrd_traf( - ar->wmi, - vif->fw_vif_idx, - conn->aid, 0, 0); - - /* Clear the PVB for this STA */ - ath6kl_wmi_set_pvb_cmd(ar->wmi, vif->fw_vif_idx, - conn->aid, 0); - } - } - - /* drop NULL data frames here */ - if ((packet->act_len < min_hdr_len) || - (packet->act_len > - WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH)) { - dev_kfree_skb(skb); - return; - } - } - - is_amsdu = wmi_data_hdr_is_amsdu(dhdr) ? true : false; - tid = wmi_data_hdr_get_up(dhdr); - seq_no = wmi_data_hdr_get_seqno(dhdr); - meta_type = wmi_data_hdr_get_meta(dhdr); - dot11_hdr = wmi_data_hdr_get_dot11(dhdr); - pad_before_data_start = - (le16_to_cpu(dhdr->info3) >> WMI_DATA_HDR_PAD_BEFORE_DATA_SHIFT) - & WMI_DATA_HDR_PAD_BEFORE_DATA_MASK; - - skb_pull(skb, sizeof(struct wmi_data_hdr)); - - switch (meta_type) { - case WMI_META_VERSION_1: - skb_pull(skb, sizeof(struct wmi_rx_meta_v1)); - break; - case WMI_META_VERSION_2: - meta = (struct wmi_rx_meta_v2 *) skb->data; - if (meta->csum_flags & 0x1) { - skb->ip_summed = CHECKSUM_COMPLETE; - skb->csum = (__force __wsum) meta->csum; - } - skb_pull(skb, sizeof(struct wmi_rx_meta_v2)); - break; - default: - break; - } - - skb_pull(skb, pad_before_data_start); - - if (dot11_hdr) - status = ath6kl_wmi_dot11_hdr_remove(ar->wmi, skb); - else if (!is_amsdu) - status = ath6kl_wmi_dot3_2_dix(skb); - - if (status) { - /* - * Drop frames that could not be processed (lack of - * memory, etc.) - */ - dev_kfree_skb(skb); - return; - } - - if (!(vif->ndev->flags & IFF_UP)) { - dev_kfree_skb(skb); - return; - } - - if (vif->nw_type == AP_NETWORK) { - datap = (struct ethhdr *) skb->data; - if (is_multicast_ether_addr(datap->h_dest)) - /* - * Bcast/Mcast frames should be sent to the - * OS stack as well as on the air. - */ - skb1 = skb_copy(skb, GFP_ATOMIC); - else { - /* - * Search for a connected STA with dstMac - * as the Mac address. If found send the - * frame to it on the air else send the - * frame up the stack. - */ - conn = ath6kl_find_sta(vif, datap->h_dest); - - if (conn && ar->intra_bss) { - skb1 = skb; - skb = NULL; - } else if (conn && !ar->intra_bss) { - dev_kfree_skb(skb); - skb = NULL; - } - } - if (skb1) - ath6kl_data_tx(skb1, vif->ndev); - - if (skb == NULL) { - /* nothing to deliver up the stack */ - return; - } - } - - datap = (struct ethhdr *) skb->data; - - if (is_unicast_ether_addr(datap->h_dest)) { - if (vif->nw_type == AP_NETWORK) { - conn = ath6kl_find_sta(vif, datap->h_source); - if (!conn) - return; - aggr_conn = conn->aggr_conn; - } else - aggr_conn = vif->aggr_cntxt->aggr_conn; - - if (aggr_process_recv_frm(aggr_conn, tid, seq_no, - is_amsdu, skb)) { - /* aggregation code will handle the skb */ - return; - } - } else if (!is_broadcast_ether_addr(datap->h_dest)) - vif->net_stats.multicast++; - - ath6kl_deliver_frames_to_nw_stack(vif->ndev, skb); -} - -static void aggr_timeout(unsigned long arg) -{ - u8 i, j; - struct aggr_info_conn *aggr_conn = (struct aggr_info_conn *) arg; - struct rxtid *rxtid; - struct rxtid_stats *stats; - - for (i = 0; i < NUM_OF_TIDS; i++) { - rxtid = &aggr_conn->rx_tid[i]; - stats = &aggr_conn->stat[i]; - - if (!rxtid->aggr || !rxtid->timer_mon) - continue; - - stats->num_timeouts++; - ath6kl_dbg(ATH6KL_DBG_AGGR, - "aggr timeout (st %d end %d)\n", - rxtid->seq_next, - ((rxtid->seq_next + rxtid->hold_q_sz-1) & - ATH6KL_MAX_SEQ_NO)); - aggr_deque_frms(aggr_conn, i, 0, 0); - } - - aggr_conn->timer_scheduled = false; - - for (i = 0; i < NUM_OF_TIDS; i++) { - rxtid = &aggr_conn->rx_tid[i]; - - if (rxtid->aggr && rxtid->hold_q) { - spin_lock_bh(&rxtid->lock); - for (j = 0; j < rxtid->hold_q_sz; j++) { - if (rxtid->hold_q[j].skb) { - aggr_conn->timer_scheduled = true; - rxtid->timer_mon = true; - break; - } - } - spin_unlock_bh(&rxtid->lock); - - if (j >= rxtid->hold_q_sz) - rxtid->timer_mon = false; - } - } - - if (aggr_conn->timer_scheduled) - mod_timer(&aggr_conn->timer, - jiffies + msecs_to_jiffies(AGGR_RX_TIMEOUT)); -} - -static void aggr_delete_tid_state(struct aggr_info_conn *aggr_conn, u8 tid) -{ - struct rxtid *rxtid; - struct rxtid_stats *stats; - - if (!aggr_conn || tid >= NUM_OF_TIDS) - return; - - rxtid = &aggr_conn->rx_tid[tid]; - stats = &aggr_conn->stat[tid]; - - if (rxtid->aggr) - aggr_deque_frms(aggr_conn, tid, 0, 0); - - rxtid->aggr = false; - rxtid->timer_mon = false; - rxtid->win_sz = 0; - rxtid->seq_next = 0; - rxtid->hold_q_sz = 0; - - kfree(rxtid->hold_q); - rxtid->hold_q = NULL; - - memset(stats, 0, sizeof(struct rxtid_stats)); -} - -void aggr_recv_addba_req_evt(struct ath6kl_vif *vif, u8 tid_mux, u16 seq_no, - u8 win_sz) -{ - struct ath6kl_sta *sta; - struct aggr_info_conn *aggr_conn = NULL; - struct rxtid *rxtid; - struct rxtid_stats *stats; - u16 hold_q_size; - u8 tid, aid; - - if (vif->nw_type == AP_NETWORK) { - aid = ath6kl_get_aid(tid_mux); - sta = ath6kl_find_sta_by_aid(vif->ar, aid); - if (sta) - aggr_conn = sta->aggr_conn; - } else - aggr_conn = vif->aggr_cntxt->aggr_conn; - - if (!aggr_conn) - return; - - tid = ath6kl_get_tid(tid_mux); - if (tid >= NUM_OF_TIDS) - return; - - rxtid = &aggr_conn->rx_tid[tid]; - stats = &aggr_conn->stat[tid]; - - if (win_sz < AGGR_WIN_SZ_MIN || win_sz > AGGR_WIN_SZ_MAX) - ath6kl_dbg(ATH6KL_DBG_WLAN_RX, "%s: win_sz %d, tid %d\n", - __func__, win_sz, tid); - - if (rxtid->aggr) - aggr_delete_tid_state(aggr_conn, tid); - - rxtid->seq_next = seq_no; - hold_q_size = TID_WINDOW_SZ(win_sz) * sizeof(struct skb_hold_q); - rxtid->hold_q = kzalloc(hold_q_size, GFP_KERNEL); - if (!rxtid->hold_q) - return; - - rxtid->win_sz = win_sz; - rxtid->hold_q_sz = TID_WINDOW_SZ(win_sz); - if (!skb_queue_empty(&rxtid->q)) - return; - - rxtid->aggr = true; -} - -void aggr_conn_init(struct ath6kl_vif *vif, struct aggr_info *aggr_info, - struct aggr_info_conn *aggr_conn) -{ - struct rxtid *rxtid; - u8 i; - - aggr_conn->aggr_sz = AGGR_SZ_DEFAULT; - aggr_conn->dev = vif->ndev; - init_timer(&aggr_conn->timer); - aggr_conn->timer.function = aggr_timeout; - aggr_conn->timer.data = (unsigned long) aggr_conn; - aggr_conn->aggr_info = aggr_info; - - aggr_conn->timer_scheduled = false; - - for (i = 0; i < NUM_OF_TIDS; i++) { - rxtid = &aggr_conn->rx_tid[i]; - rxtid->aggr = false; - rxtid->timer_mon = false; - skb_queue_head_init(&rxtid->q); - spin_lock_init(&rxtid->lock); - } - -} - -struct aggr_info *aggr_init(struct ath6kl_vif *vif) -{ - struct aggr_info *p_aggr = NULL; - - p_aggr = kzalloc(sizeof(struct aggr_info), GFP_KERNEL); - if (!p_aggr) { - ath6kl_err("failed to alloc memory for aggr_node\n"); - return NULL; - } - - p_aggr->aggr_conn = kzalloc(sizeof(struct aggr_info_conn), GFP_KERNEL); - if (!p_aggr->aggr_conn) { - ath6kl_err("failed to alloc memory for connection specific aggr info\n"); - kfree(p_aggr); - return NULL; - } - - aggr_conn_init(vif, p_aggr, p_aggr->aggr_conn); - - skb_queue_head_init(&p_aggr->rx_amsdu_freeq); - ath6kl_alloc_netbufs(&p_aggr->rx_amsdu_freeq, AGGR_NUM_OF_FREE_NETBUFS); - - return p_aggr; -} - -void aggr_recv_delba_req_evt(struct ath6kl_vif *vif, u8 tid_mux) -{ - struct ath6kl_sta *sta; - struct rxtid *rxtid; - struct aggr_info_conn *aggr_conn = NULL; - u8 tid, aid; - - if (vif->nw_type == AP_NETWORK) { - aid = ath6kl_get_aid(tid_mux); - sta = ath6kl_find_sta_by_aid(vif->ar, aid); - if (sta) - aggr_conn = sta->aggr_conn; - } else - aggr_conn = vif->aggr_cntxt->aggr_conn; - - if (!aggr_conn) - return; - - tid = ath6kl_get_tid(tid_mux); - if (tid >= NUM_OF_TIDS) - return; - - rxtid = &aggr_conn->rx_tid[tid]; - - if (rxtid->aggr) - aggr_delete_tid_state(aggr_conn, tid); -} - -void aggr_reset_state(struct aggr_info_conn *aggr_conn) -{ - u8 tid; - - if (!aggr_conn) - return; - - if (aggr_conn->timer_scheduled) { - del_timer(&aggr_conn->timer); - aggr_conn->timer_scheduled = false; - } - - for (tid = 0; tid < NUM_OF_TIDS; tid++) - aggr_delete_tid_state(aggr_conn, tid); -} - -/* clean up our amsdu buffer list */ -void ath6kl_cleanup_amsdu_rxbufs(struct ath6kl *ar) -{ - struct htc_packet *packet, *tmp_pkt; - - spin_lock_bh(&ar->lock); - if (list_empty(&ar->amsdu_rx_buffer_queue)) { - spin_unlock_bh(&ar->lock); - return; - } - - list_for_each_entry_safe(packet, tmp_pkt, &ar->amsdu_rx_buffer_queue, - list) { - list_del(&packet->list); - spin_unlock_bh(&ar->lock); - dev_kfree_skb(packet->pkt_cntxt); - spin_lock_bh(&ar->lock); - } - - spin_unlock_bh(&ar->lock); -} - -void aggr_module_destroy(struct aggr_info *aggr_info) -{ - if (!aggr_info) - return; - - aggr_reset_state(aggr_info->aggr_conn); - skb_queue_purge(&aggr_info->rx_amsdu_freeq); - kfree(aggr_info->aggr_conn); - kfree(aggr_info); -} diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c deleted file mode 100644 index bed0d337712d..000000000000 --- a/drivers/net/wireless/ath/ath6kl/usb.c +++ /dev/null @@ -1,1248 +0,0 @@ -/* - * Copyright (c) 2007-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -#include "debug.h" -#include "core.h" - -/* constants */ -#define TX_URB_COUNT 32 -#define RX_URB_COUNT 32 -#define ATH6KL_USB_RX_BUFFER_SIZE 1700 - -/* tx/rx pipes for usb */ -enum ATH6KL_USB_PIPE_ID { - ATH6KL_USB_PIPE_TX_CTRL = 0, - ATH6KL_USB_PIPE_TX_DATA_LP, - ATH6KL_USB_PIPE_TX_DATA_MP, - ATH6KL_USB_PIPE_TX_DATA_HP, - ATH6KL_USB_PIPE_RX_CTRL, - ATH6KL_USB_PIPE_RX_DATA, - ATH6KL_USB_PIPE_RX_DATA2, - ATH6KL_USB_PIPE_RX_INT, - ATH6KL_USB_PIPE_MAX -}; - -#define ATH6KL_USB_PIPE_INVALID ATH6KL_USB_PIPE_MAX - -struct ath6kl_usb_pipe { - struct list_head urb_list_head; - struct usb_anchor urb_submitted; - u32 urb_alloc; - u32 urb_cnt; - u32 urb_cnt_thresh; - unsigned int usb_pipe_handle; - u32 flags; - u8 ep_address; - u8 logical_pipe_num; - struct ath6kl_usb *ar_usb; - u16 max_packet_size; - struct work_struct io_complete_work; - struct sk_buff_head io_comp_queue; - struct usb_endpoint_descriptor *ep_desc; -}; - -#define ATH6KL_USB_PIPE_FLAG_TX (1 << 0) - -/* usb device object */ -struct ath6kl_usb { - /* protects pipe->urb_list_head and pipe->urb_cnt */ - spinlock_t cs_lock; - - struct usb_device *udev; - struct usb_interface *interface; - struct ath6kl_usb_pipe pipes[ATH6KL_USB_PIPE_MAX]; - u8 *diag_cmd_buffer; - u8 *diag_resp_buffer; - struct ath6kl *ar; -}; - -/* usb urb object */ -struct ath6kl_urb_context { - struct list_head link; - struct ath6kl_usb_pipe *pipe; - struct sk_buff *skb; - struct ath6kl *ar; -}; - -/* USB endpoint definitions */ -#define ATH6KL_USB_EP_ADDR_APP_CTRL_IN 0x81 -#define ATH6KL_USB_EP_ADDR_APP_DATA_IN 0x82 -#define ATH6KL_USB_EP_ADDR_APP_DATA2_IN 0x83 -#define ATH6KL_USB_EP_ADDR_APP_INT_IN 0x84 - -#define ATH6KL_USB_EP_ADDR_APP_CTRL_OUT 0x01 -#define ATH6KL_USB_EP_ADDR_APP_DATA_LP_OUT 0x02 -#define ATH6KL_USB_EP_ADDR_APP_DATA_MP_OUT 0x03 -#define ATH6KL_USB_EP_ADDR_APP_DATA_HP_OUT 0x04 - -/* diagnostic command defnitions */ -#define ATH6KL_USB_CONTROL_REQ_SEND_BMI_CMD 1 -#define ATH6KL_USB_CONTROL_REQ_RECV_BMI_RESP 2 -#define ATH6KL_USB_CONTROL_REQ_DIAG_CMD 3 -#define ATH6KL_USB_CONTROL_REQ_DIAG_RESP 4 - -#define ATH6KL_USB_CTRL_DIAG_CC_READ 0 -#define ATH6KL_USB_CTRL_DIAG_CC_WRITE 1 - -struct ath6kl_usb_ctrl_diag_cmd_write { - __le32 cmd; - __le32 address; - __le32 value; - __le32 _pad[1]; -} __packed; - -struct ath6kl_usb_ctrl_diag_cmd_read { - __le32 cmd; - __le32 address; -} __packed; - -struct ath6kl_usb_ctrl_diag_resp_read { - __le32 value; -} __packed; - -/* function declarations */ -static void ath6kl_usb_recv_complete(struct urb *urb); - -#define ATH6KL_USB_IS_BULK_EP(attr) (((attr) & 3) == 0x02) -#define ATH6KL_USB_IS_INT_EP(attr) (((attr) & 3) == 0x03) -#define ATH6KL_USB_IS_ISOC_EP(attr) (((attr) & 3) == 0x01) -#define ATH6KL_USB_IS_DIR_IN(addr) ((addr) & 0x80) - -/* pipe/urb operations */ -static struct ath6kl_urb_context * -ath6kl_usb_alloc_urb_from_pipe(struct ath6kl_usb_pipe *pipe) -{ - struct ath6kl_urb_context *urb_context = NULL; - unsigned long flags; - - spin_lock_irqsave(&pipe->ar_usb->cs_lock, flags); - if (!list_empty(&pipe->urb_list_head)) { - urb_context = - list_first_entry(&pipe->urb_list_head, - struct ath6kl_urb_context, link); - list_del(&urb_context->link); - pipe->urb_cnt--; - } - spin_unlock_irqrestore(&pipe->ar_usb->cs_lock, flags); - - return urb_context; -} - -static void ath6kl_usb_free_urb_to_pipe(struct ath6kl_usb_pipe *pipe, - struct ath6kl_urb_context *urb_context) -{ - unsigned long flags; - - spin_lock_irqsave(&pipe->ar_usb->cs_lock, flags); - pipe->urb_cnt++; - - list_add(&urb_context->link, &pipe->urb_list_head); - spin_unlock_irqrestore(&pipe->ar_usb->cs_lock, flags); -} - -static void ath6kl_usb_cleanup_recv_urb(struct ath6kl_urb_context *urb_context) -{ - dev_kfree_skb(urb_context->skb); - urb_context->skb = NULL; - - ath6kl_usb_free_urb_to_pipe(urb_context->pipe, urb_context); -} - -static inline struct ath6kl_usb *ath6kl_usb_priv(struct ath6kl *ar) -{ - return ar->hif_priv; -} - -/* pipe resource allocation/cleanup */ -static int ath6kl_usb_alloc_pipe_resources(struct ath6kl_usb_pipe *pipe, - int urb_cnt) -{ - struct ath6kl_urb_context *urb_context; - int status = 0, i; - - INIT_LIST_HEAD(&pipe->urb_list_head); - init_usb_anchor(&pipe->urb_submitted); - - for (i = 0; i < urb_cnt; i++) { - urb_context = kzalloc(sizeof(struct ath6kl_urb_context), - GFP_KERNEL); - if (urb_context == NULL) { - status = -ENOMEM; - goto fail_alloc_pipe_resources; - } - - urb_context->pipe = pipe; - - /* - * we are only allocate the urb contexts here, the actual URB - * is allocated from the kernel as needed to do a transaction - */ - pipe->urb_alloc++; - ath6kl_usb_free_urb_to_pipe(pipe, urb_context); - } - - ath6kl_dbg(ATH6KL_DBG_USB, - "ath6kl usb: alloc resources lpipe:%d hpipe:0x%X urbs:%d\n", - pipe->logical_pipe_num, pipe->usb_pipe_handle, - pipe->urb_alloc); - -fail_alloc_pipe_resources: - return status; -} - -static void ath6kl_usb_free_pipe_resources(struct ath6kl_usb_pipe *pipe) -{ - struct ath6kl_urb_context *urb_context; - - if (pipe->ar_usb == NULL) { - /* nothing allocated for this pipe */ - return; - } - - ath6kl_dbg(ATH6KL_DBG_USB, - "ath6kl usb: free resources lpipe:%d" - "hpipe:0x%X urbs:%d avail:%d\n", - pipe->logical_pipe_num, pipe->usb_pipe_handle, - pipe->urb_alloc, pipe->urb_cnt); - - if (pipe->urb_alloc != pipe->urb_cnt) { - ath6kl_dbg(ATH6KL_DBG_USB, - "ath6kl usb: urb leak! lpipe:%d" - "hpipe:0x%X urbs:%d avail:%d\n", - pipe->logical_pipe_num, pipe->usb_pipe_handle, - pipe->urb_alloc, pipe->urb_cnt); - } - - while (true) { - urb_context = ath6kl_usb_alloc_urb_from_pipe(pipe); - if (urb_context == NULL) - break; - kfree(urb_context); - } - -} - -static void ath6kl_usb_cleanup_pipe_resources(struct ath6kl_usb *ar_usb) -{ - int i; - - for (i = 0; i < ATH6KL_USB_PIPE_MAX; i++) - ath6kl_usb_free_pipe_resources(&ar_usb->pipes[i]); - -} - -static u8 ath6kl_usb_get_logical_pipe_num(struct ath6kl_usb *ar_usb, - u8 ep_address, int *urb_count) -{ - u8 pipe_num = ATH6KL_USB_PIPE_INVALID; - - switch (ep_address) { - case ATH6KL_USB_EP_ADDR_APP_CTRL_IN: - pipe_num = ATH6KL_USB_PIPE_RX_CTRL; - *urb_count = RX_URB_COUNT; - break; - case ATH6KL_USB_EP_ADDR_APP_DATA_IN: - pipe_num = ATH6KL_USB_PIPE_RX_DATA; - *urb_count = RX_URB_COUNT; - break; - case ATH6KL_USB_EP_ADDR_APP_INT_IN: - pipe_num = ATH6KL_USB_PIPE_RX_INT; - *urb_count = RX_URB_COUNT; - break; - case ATH6KL_USB_EP_ADDR_APP_DATA2_IN: - pipe_num = ATH6KL_USB_PIPE_RX_DATA2; - *urb_count = RX_URB_COUNT; - break; - case ATH6KL_USB_EP_ADDR_APP_CTRL_OUT: - pipe_num = ATH6KL_USB_PIPE_TX_CTRL; - *urb_count = TX_URB_COUNT; - break; - case ATH6KL_USB_EP_ADDR_APP_DATA_LP_OUT: - pipe_num = ATH6KL_USB_PIPE_TX_DATA_LP; - *urb_count = TX_URB_COUNT; - break; - case ATH6KL_USB_EP_ADDR_APP_DATA_MP_OUT: - pipe_num = ATH6KL_USB_PIPE_TX_DATA_MP; - *urb_count = TX_URB_COUNT; - break; - case ATH6KL_USB_EP_ADDR_APP_DATA_HP_OUT: - pipe_num = ATH6KL_USB_PIPE_TX_DATA_HP; - *urb_count = TX_URB_COUNT; - break; - default: - /* note: there may be endpoints not currently used */ - break; - } - - return pipe_num; -} - -static int ath6kl_usb_setup_pipe_resources(struct ath6kl_usb *ar_usb) -{ - struct usb_interface *interface = ar_usb->interface; - struct usb_host_interface *iface_desc = interface->cur_altsetting; - struct usb_endpoint_descriptor *endpoint; - struct ath6kl_usb_pipe *pipe; - int i, urbcount, status = 0; - u8 pipe_num; - - ath6kl_dbg(ATH6KL_DBG_USB, "setting up USB Pipes using interface\n"); - - /* walk decriptors and setup pipes */ - for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { - endpoint = &iface_desc->endpoint[i].desc; - - if (ATH6KL_USB_IS_BULK_EP(endpoint->bmAttributes)) { - ath6kl_dbg(ATH6KL_DBG_USB, - "%s Bulk Ep:0x%2.2X maxpktsz:%d\n", - ATH6KL_USB_IS_DIR_IN - (endpoint->bEndpointAddress) ? - "RX" : "TX", endpoint->bEndpointAddress, - le16_to_cpu(endpoint->wMaxPacketSize)); - } else if (ATH6KL_USB_IS_INT_EP(endpoint->bmAttributes)) { - ath6kl_dbg(ATH6KL_DBG_USB, - "%s Int Ep:0x%2.2X maxpktsz:%d interval:%d\n", - ATH6KL_USB_IS_DIR_IN - (endpoint->bEndpointAddress) ? - "RX" : "TX", endpoint->bEndpointAddress, - le16_to_cpu(endpoint->wMaxPacketSize), - endpoint->bInterval); - } else if (ATH6KL_USB_IS_ISOC_EP(endpoint->bmAttributes)) { - /* TODO for ISO */ - ath6kl_dbg(ATH6KL_DBG_USB, - "%s ISOC Ep:0x%2.2X maxpktsz:%d interval:%d\n", - ATH6KL_USB_IS_DIR_IN - (endpoint->bEndpointAddress) ? - "RX" : "TX", endpoint->bEndpointAddress, - le16_to_cpu(endpoint->wMaxPacketSize), - endpoint->bInterval); - } - urbcount = 0; - - pipe_num = - ath6kl_usb_get_logical_pipe_num(ar_usb, - endpoint->bEndpointAddress, - &urbcount); - if (pipe_num == ATH6KL_USB_PIPE_INVALID) - continue; - - pipe = &ar_usb->pipes[pipe_num]; - if (pipe->ar_usb != NULL) { - /* hmmm..pipe was already setup */ - continue; - } - - pipe->ar_usb = ar_usb; - pipe->logical_pipe_num = pipe_num; - pipe->ep_address = endpoint->bEndpointAddress; - pipe->max_packet_size = le16_to_cpu(endpoint->wMaxPacketSize); - - if (ATH6KL_USB_IS_BULK_EP(endpoint->bmAttributes)) { - if (ATH6KL_USB_IS_DIR_IN(pipe->ep_address)) { - pipe->usb_pipe_handle = - usb_rcvbulkpipe(ar_usb->udev, - pipe->ep_address); - } else { - pipe->usb_pipe_handle = - usb_sndbulkpipe(ar_usb->udev, - pipe->ep_address); - } - } else if (ATH6KL_USB_IS_INT_EP(endpoint->bmAttributes)) { - if (ATH6KL_USB_IS_DIR_IN(pipe->ep_address)) { - pipe->usb_pipe_handle = - usb_rcvintpipe(ar_usb->udev, - pipe->ep_address); - } else { - pipe->usb_pipe_handle = - usb_sndintpipe(ar_usb->udev, - pipe->ep_address); - } - } else if (ATH6KL_USB_IS_ISOC_EP(endpoint->bmAttributes)) { - /* TODO for ISO */ - if (ATH6KL_USB_IS_DIR_IN(pipe->ep_address)) { - pipe->usb_pipe_handle = - usb_rcvisocpipe(ar_usb->udev, - pipe->ep_address); - } else { - pipe->usb_pipe_handle = - usb_sndisocpipe(ar_usb->udev, - pipe->ep_address); - } - } - - pipe->ep_desc = endpoint; - - if (!ATH6KL_USB_IS_DIR_IN(pipe->ep_address)) - pipe->flags |= ATH6KL_USB_PIPE_FLAG_TX; - - status = ath6kl_usb_alloc_pipe_resources(pipe, urbcount); - if (status != 0) - break; - } - - return status; -} - -/* pipe operations */ -static void ath6kl_usb_post_recv_transfers(struct ath6kl_usb_pipe *recv_pipe, - int buffer_length) -{ - struct ath6kl_urb_context *urb_context; - struct urb *urb; - int usb_status; - - while (true) { - urb_context = ath6kl_usb_alloc_urb_from_pipe(recv_pipe); - if (urb_context == NULL) - break; - - urb_context->skb = dev_alloc_skb(buffer_length); - if (urb_context->skb == NULL) - goto err_cleanup_urb; - - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (urb == NULL) - goto err_cleanup_urb; - - usb_fill_bulk_urb(urb, - recv_pipe->ar_usb->udev, - recv_pipe->usb_pipe_handle, - urb_context->skb->data, - buffer_length, - ath6kl_usb_recv_complete, urb_context); - - ath6kl_dbg(ATH6KL_DBG_USB_BULK, - "ath6kl usb: bulk recv submit:%d, 0x%X (ep:0x%2.2X), %d bytes buf:0x%p\n", - recv_pipe->logical_pipe_num, - recv_pipe->usb_pipe_handle, recv_pipe->ep_address, - buffer_length, urb_context->skb); - - usb_anchor_urb(urb, &recv_pipe->urb_submitted); - usb_status = usb_submit_urb(urb, GFP_ATOMIC); - - if (usb_status) { - ath6kl_dbg(ATH6KL_DBG_USB_BULK, - "ath6kl usb : usb bulk recv failed %d\n", - usb_status); - usb_unanchor_urb(urb); - usb_free_urb(urb); - goto err_cleanup_urb; - } - usb_free_urb(urb); - } - return; - -err_cleanup_urb: - ath6kl_usb_cleanup_recv_urb(urb_context); - return; -} - -static void ath6kl_usb_flush_all(struct ath6kl_usb *ar_usb) -{ - int i; - - for (i = 0; i < ATH6KL_USB_PIPE_MAX; i++) { - if (ar_usb->pipes[i].ar_usb != NULL) - usb_kill_anchored_urbs(&ar_usb->pipes[i].urb_submitted); - } - - /* - * Flushing any pending I/O may schedule work this call will block - * until all scheduled work runs to completion. - */ - flush_scheduled_work(); -} - -static void ath6kl_usb_start_recv_pipes(struct ath6kl_usb *ar_usb) -{ - /* - * note: control pipe is no longer used - * ar_usb->pipes[ATH6KL_USB_PIPE_RX_CTRL].urb_cnt_thresh = - * ar_usb->pipes[ATH6KL_USB_PIPE_RX_CTRL].urb_alloc/2; - * ath6kl_usb_post_recv_transfers(&ar_usb-> - * pipes[ATH6KL_USB_PIPE_RX_CTRL], - * ATH6KL_USB_RX_BUFFER_SIZE); - */ - - ar_usb->pipes[ATH6KL_USB_PIPE_RX_DATA].urb_cnt_thresh = - ar_usb->pipes[ATH6KL_USB_PIPE_RX_DATA].urb_alloc / 2; - ath6kl_usb_post_recv_transfers(&ar_usb->pipes[ATH6KL_USB_PIPE_RX_DATA], - ATH6KL_USB_RX_BUFFER_SIZE); -} - -/* hif usb rx/tx completion functions */ -static void ath6kl_usb_recv_complete(struct urb *urb) -{ - struct ath6kl_urb_context *urb_context = urb->context; - struct ath6kl_usb_pipe *pipe = urb_context->pipe; - struct sk_buff *skb = NULL; - int status = 0; - - ath6kl_dbg(ATH6KL_DBG_USB_BULK, - "%s: recv pipe: %d, stat:%d, len:%d urb:0x%p\n", __func__, - pipe->logical_pipe_num, urb->status, urb->actual_length, - urb); - - if (urb->status != 0) { - status = -EIO; - switch (urb->status) { - case -ECONNRESET: - case -ENOENT: - case -ESHUTDOWN: - /* - * no need to spew these errors when device - * removed or urb killed due to driver shutdown - */ - status = -ECANCELED; - break; - default: - ath6kl_dbg(ATH6KL_DBG_USB_BULK, - "%s recv pipe: %d (ep:0x%2.2X), failed:%d\n", - __func__, pipe->logical_pipe_num, - pipe->ep_address, urb->status); - break; - } - goto cleanup_recv_urb; - } - - if (urb->actual_length == 0) - goto cleanup_recv_urb; - - skb = urb_context->skb; - - /* we are going to pass it up */ - urb_context->skb = NULL; - skb_put(skb, urb->actual_length); - - /* note: queue implements a lock */ - skb_queue_tail(&pipe->io_comp_queue, skb); - schedule_work(&pipe->io_complete_work); - -cleanup_recv_urb: - ath6kl_usb_cleanup_recv_urb(urb_context); - - if (status == 0 && - pipe->urb_cnt >= pipe->urb_cnt_thresh) { - /* our free urbs are piling up, post more transfers */ - ath6kl_usb_post_recv_transfers(pipe, ATH6KL_USB_RX_BUFFER_SIZE); - } -} - -static void ath6kl_usb_usb_transmit_complete(struct urb *urb) -{ - struct ath6kl_urb_context *urb_context = urb->context; - struct ath6kl_usb_pipe *pipe = urb_context->pipe; - struct sk_buff *skb; - - ath6kl_dbg(ATH6KL_DBG_USB_BULK, - "%s: pipe: %d, stat:%d, len:%d\n", - __func__, pipe->logical_pipe_num, urb->status, - urb->actual_length); - - if (urb->status != 0) { - ath6kl_dbg(ATH6KL_DBG_USB_BULK, - "%s: pipe: %d, failed:%d\n", - __func__, pipe->logical_pipe_num, urb->status); - } - - skb = urb_context->skb; - urb_context->skb = NULL; - ath6kl_usb_free_urb_to_pipe(urb_context->pipe, urb_context); - - /* note: queue implements a lock */ - skb_queue_tail(&pipe->io_comp_queue, skb); - schedule_work(&pipe->io_complete_work); -} - -static void ath6kl_usb_io_comp_work(struct work_struct *work) -{ - struct ath6kl_usb_pipe *pipe = container_of(work, - struct ath6kl_usb_pipe, - io_complete_work); - struct ath6kl_usb *ar_usb; - struct sk_buff *skb; - - ar_usb = pipe->ar_usb; - - while ((skb = skb_dequeue(&pipe->io_comp_queue))) { - if (pipe->flags & ATH6KL_USB_PIPE_FLAG_TX) { - ath6kl_dbg(ATH6KL_DBG_USB_BULK, - "ath6kl usb xmit callback buf:0x%p\n", skb); - ath6kl_core_tx_complete(ar_usb->ar, skb); - } else { - ath6kl_dbg(ATH6KL_DBG_USB_BULK, - "ath6kl usb recv callback buf:0x%p\n", skb); - ath6kl_core_rx_complete(ar_usb->ar, skb, - pipe->logical_pipe_num); - } - } -} - -#define ATH6KL_USB_MAX_DIAG_CMD (sizeof(struct ath6kl_usb_ctrl_diag_cmd_write)) -#define ATH6KL_USB_MAX_DIAG_RESP (sizeof(struct ath6kl_usb_ctrl_diag_resp_read)) - -static void ath6kl_usb_destroy(struct ath6kl_usb *ar_usb) -{ - ath6kl_usb_flush_all(ar_usb); - - ath6kl_usb_cleanup_pipe_resources(ar_usb); - - usb_set_intfdata(ar_usb->interface, NULL); - - kfree(ar_usb->diag_cmd_buffer); - kfree(ar_usb->diag_resp_buffer); - - kfree(ar_usb); -} - -static struct ath6kl_usb *ath6kl_usb_create(struct usb_interface *interface) -{ - struct usb_device *dev = interface_to_usbdev(interface); - struct ath6kl_usb *ar_usb; - struct ath6kl_usb_pipe *pipe; - int status = 0; - int i; - - ar_usb = kzalloc(sizeof(struct ath6kl_usb), GFP_KERNEL); - if (ar_usb == NULL) - goto fail_ath6kl_usb_create; - - usb_set_intfdata(interface, ar_usb); - spin_lock_init(&(ar_usb->cs_lock)); - ar_usb->udev = dev; - ar_usb->interface = interface; - - for (i = 0; i < ATH6KL_USB_PIPE_MAX; i++) { - pipe = &ar_usb->pipes[i]; - INIT_WORK(&pipe->io_complete_work, - ath6kl_usb_io_comp_work); - skb_queue_head_init(&pipe->io_comp_queue); - } - - ar_usb->diag_cmd_buffer = kzalloc(ATH6KL_USB_MAX_DIAG_CMD, GFP_KERNEL); - if (ar_usb->diag_cmd_buffer == NULL) { - status = -ENOMEM; - goto fail_ath6kl_usb_create; - } - - ar_usb->diag_resp_buffer = kzalloc(ATH6KL_USB_MAX_DIAG_RESP, - GFP_KERNEL); - if (ar_usb->diag_resp_buffer == NULL) { - status = -ENOMEM; - goto fail_ath6kl_usb_create; - } - - status = ath6kl_usb_setup_pipe_resources(ar_usb); - -fail_ath6kl_usb_create: - if (status != 0) { - ath6kl_usb_destroy(ar_usb); - ar_usb = NULL; - } - return ar_usb; -} - -static void ath6kl_usb_device_detached(struct usb_interface *interface) -{ - struct ath6kl_usb *ar_usb; - - ar_usb = usb_get_intfdata(interface); - if (ar_usb == NULL) - return; - - ath6kl_stop_txrx(ar_usb->ar); - - /* Delay to wait for the target to reboot */ - mdelay(20); - ath6kl_core_cleanup(ar_usb->ar); - ath6kl_usb_destroy(ar_usb); -} - -/* exported hif usb APIs for htc pipe */ -static void hif_start(struct ath6kl *ar) -{ - struct ath6kl_usb *device = ath6kl_usb_priv(ar); - int i; - - ath6kl_usb_start_recv_pipes(device); - - /* set the TX resource avail threshold for each TX pipe */ - for (i = ATH6KL_USB_PIPE_TX_CTRL; - i <= ATH6KL_USB_PIPE_TX_DATA_HP; i++) { - device->pipes[i].urb_cnt_thresh = - device->pipes[i].urb_alloc / 2; - } -} - -static int ath6kl_usb_send(struct ath6kl *ar, u8 PipeID, - struct sk_buff *hdr_skb, struct sk_buff *skb) -{ - struct ath6kl_usb *device = ath6kl_usb_priv(ar); - struct ath6kl_usb_pipe *pipe = &device->pipes[PipeID]; - struct ath6kl_urb_context *urb_context; - int usb_status, status = 0; - struct urb *urb; - u8 *data; - u32 len; - - ath6kl_dbg(ATH6KL_DBG_USB_BULK, "+%s pipe : %d, buf:0x%p\n", - __func__, PipeID, skb); - - urb_context = ath6kl_usb_alloc_urb_from_pipe(pipe); - - if (urb_context == NULL) { - /* - * TODO: it is possible to run out of urbs if - * 2 endpoints map to the same pipe ID - */ - ath6kl_dbg(ATH6KL_DBG_USB_BULK, - "%s pipe:%d no urbs left. URB Cnt : %d\n", - __func__, PipeID, pipe->urb_cnt); - status = -ENOMEM; - goto fail_hif_send; - } - - urb_context->skb = skb; - - data = skb->data; - len = skb->len; - - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (urb == NULL) { - status = -ENOMEM; - ath6kl_usb_free_urb_to_pipe(urb_context->pipe, - urb_context); - goto fail_hif_send; - } - - usb_fill_bulk_urb(urb, - device->udev, - pipe->usb_pipe_handle, - data, - len, - ath6kl_usb_usb_transmit_complete, urb_context); - - if ((len % pipe->max_packet_size) == 0) { - /* hit a max packet boundary on this pipe */ - urb->transfer_flags |= URB_ZERO_PACKET; - } - - ath6kl_dbg(ATH6KL_DBG_USB_BULK, - "athusb bulk send submit:%d, 0x%X (ep:0x%2.2X), %d bytes\n", - pipe->logical_pipe_num, pipe->usb_pipe_handle, - pipe->ep_address, len); - - usb_anchor_urb(urb, &pipe->urb_submitted); - usb_status = usb_submit_urb(urb, GFP_ATOMIC); - - if (usb_status) { - ath6kl_dbg(ATH6KL_DBG_USB_BULK, - "ath6kl usb : usb bulk transmit failed %d\n", - usb_status); - usb_unanchor_urb(urb); - ath6kl_usb_free_urb_to_pipe(urb_context->pipe, - urb_context); - status = -EINVAL; - } - usb_free_urb(urb); - -fail_hif_send: - return status; -} - -static void hif_stop(struct ath6kl *ar) -{ - struct ath6kl_usb *device = ath6kl_usb_priv(ar); - - ath6kl_usb_flush_all(device); -} - -static void ath6kl_usb_get_default_pipe(struct ath6kl *ar, - u8 *ul_pipe, u8 *dl_pipe) -{ - *ul_pipe = ATH6KL_USB_PIPE_TX_CTRL; - *dl_pipe = ATH6KL_USB_PIPE_RX_CTRL; -} - -static int ath6kl_usb_map_service_pipe(struct ath6kl *ar, u16 svc_id, - u8 *ul_pipe, u8 *dl_pipe) -{ - int status = 0; - - switch (svc_id) { - case HTC_CTRL_RSVD_SVC: - case WMI_CONTROL_SVC: - *ul_pipe = ATH6KL_USB_PIPE_TX_CTRL; - /* due to large control packets, shift to data pipe */ - *dl_pipe = ATH6KL_USB_PIPE_RX_DATA; - break; - case WMI_DATA_BE_SVC: - case WMI_DATA_BK_SVC: - *ul_pipe = ATH6KL_USB_PIPE_TX_DATA_LP; - /* - * Disable rxdata2 directly, it will be enabled - * if FW enable rxdata2 - */ - *dl_pipe = ATH6KL_USB_PIPE_RX_DATA; - break; - case WMI_DATA_VI_SVC: - - if (ar->hw.flags & ATH6KL_HW_MAP_LP_ENDPOINT) - *ul_pipe = ATH6KL_USB_PIPE_TX_DATA_LP; - else - *ul_pipe = ATH6KL_USB_PIPE_TX_DATA_MP; - /* - * Disable rxdata2 directly, it will be enabled - * if FW enable rxdata2 - */ - *dl_pipe = ATH6KL_USB_PIPE_RX_DATA; - break; - case WMI_DATA_VO_SVC: - - if (ar->hw.flags & ATH6KL_HW_MAP_LP_ENDPOINT) - *ul_pipe = ATH6KL_USB_PIPE_TX_DATA_LP; - else - *ul_pipe = ATH6KL_USB_PIPE_TX_DATA_MP; - /* - * Disable rxdata2 directly, it will be enabled - * if FW enable rxdata2 - */ - *dl_pipe = ATH6KL_USB_PIPE_RX_DATA; - break; - default: - status = -EPERM; - break; - } - - return status; -} - -static u16 ath6kl_usb_get_free_queue_number(struct ath6kl *ar, u8 pipe_id) -{ - struct ath6kl_usb *device = ath6kl_usb_priv(ar); - - return device->pipes[pipe_id].urb_cnt; -} - -static void hif_detach_htc(struct ath6kl *ar) -{ - struct ath6kl_usb *device = ath6kl_usb_priv(ar); - - ath6kl_usb_flush_all(device); -} - -static int ath6kl_usb_submit_ctrl_out(struct ath6kl_usb *ar_usb, - u8 req, u16 value, u16 index, void *data, - u32 size) -{ - u8 *buf = NULL; - int ret; - - if (size > 0) { - buf = kmemdup(data, size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - } - - /* note: if successful returns number of bytes transfered */ - ret = usb_control_msg(ar_usb->udev, - usb_sndctrlpipe(ar_usb->udev, 0), - req, - USB_DIR_OUT | USB_TYPE_VENDOR | - USB_RECIP_DEVICE, value, index, buf, - size, 1000); - - if (ret < 0) { - ath6kl_warn("Failed to submit usb control message: %d\n", ret); - kfree(buf); - return ret; - } - - kfree(buf); - - return 0; -} - -static int ath6kl_usb_submit_ctrl_in(struct ath6kl_usb *ar_usb, - u8 req, u16 value, u16 index, void *data, - u32 size) -{ - u8 *buf = NULL; - int ret; - - if (size > 0) { - buf = kmalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - } - - /* note: if successful returns number of bytes transfered */ - ret = usb_control_msg(ar_usb->udev, - usb_rcvctrlpipe(ar_usb->udev, 0), - req, - USB_DIR_IN | USB_TYPE_VENDOR | - USB_RECIP_DEVICE, value, index, buf, - size, 2 * HZ); - - if (ret < 0) { - ath6kl_warn("Failed to read usb control message: %d\n", ret); - kfree(buf); - return ret; - } - - memcpy((u8 *) data, buf, size); - - kfree(buf); - - return 0; -} - -static int ath6kl_usb_ctrl_msg_exchange(struct ath6kl_usb *ar_usb, - u8 req_val, u8 *req_buf, u32 req_len, - u8 resp_val, u8 *resp_buf, u32 *resp_len) -{ - int ret; - - /* send command */ - ret = ath6kl_usb_submit_ctrl_out(ar_usb, req_val, 0, 0, - req_buf, req_len); - - if (ret != 0) - return ret; - - if (resp_buf == NULL) { - /* no expected response */ - return ret; - } - - /* get response */ - ret = ath6kl_usb_submit_ctrl_in(ar_usb, resp_val, 0, 0, - resp_buf, *resp_len); - - return ret; -} - -static int ath6kl_usb_diag_read32(struct ath6kl *ar, u32 address, u32 *data) -{ - struct ath6kl_usb *ar_usb = ar->hif_priv; - struct ath6kl_usb_ctrl_diag_resp_read *resp; - struct ath6kl_usb_ctrl_diag_cmd_read *cmd; - u32 resp_len; - int ret; - - cmd = (struct ath6kl_usb_ctrl_diag_cmd_read *) ar_usb->diag_cmd_buffer; - - memset(cmd, 0, sizeof(*cmd)); - cmd->cmd = ATH6KL_USB_CTRL_DIAG_CC_READ; - cmd->address = cpu_to_le32(address); - resp_len = sizeof(*resp); - - ret = ath6kl_usb_ctrl_msg_exchange(ar_usb, - ATH6KL_USB_CONTROL_REQ_DIAG_CMD, - (u8 *) cmd, - sizeof(struct ath6kl_usb_ctrl_diag_cmd_write), - ATH6KL_USB_CONTROL_REQ_DIAG_RESP, - ar_usb->diag_resp_buffer, &resp_len); - - if (ret) { - ath6kl_warn("diag read32 failed: %d\n", ret); - return ret; - } - - resp = (struct ath6kl_usb_ctrl_diag_resp_read *) - ar_usb->diag_resp_buffer; - - *data = le32_to_cpu(resp->value); - - return ret; -} - -static int ath6kl_usb_diag_write32(struct ath6kl *ar, u32 address, __le32 data) -{ - struct ath6kl_usb *ar_usb = ar->hif_priv; - struct ath6kl_usb_ctrl_diag_cmd_write *cmd; - int ret; - - cmd = (struct ath6kl_usb_ctrl_diag_cmd_write *) ar_usb->diag_cmd_buffer; - - memset(cmd, 0, sizeof(struct ath6kl_usb_ctrl_diag_cmd_write)); - cmd->cmd = cpu_to_le32(ATH6KL_USB_CTRL_DIAG_CC_WRITE); - cmd->address = cpu_to_le32(address); - cmd->value = data; - - ret = ath6kl_usb_ctrl_msg_exchange(ar_usb, - ATH6KL_USB_CONTROL_REQ_DIAG_CMD, - (u8 *) cmd, - sizeof(*cmd), - 0, NULL, NULL); - if (ret) { - ath6kl_warn("diag_write32 failed: %d\n", ret); - return ret; - } - - return 0; -} - -static int ath6kl_usb_bmi_read(struct ath6kl *ar, u8 *buf, u32 len) -{ - struct ath6kl_usb *ar_usb = ar->hif_priv; - int ret; - - /* get response */ - ret = ath6kl_usb_submit_ctrl_in(ar_usb, - ATH6KL_USB_CONTROL_REQ_RECV_BMI_RESP, - 0, 0, buf, len); - if (ret) { - ath6kl_err("Unable to read the bmi data from the device: %d\n", - ret); - return ret; - } - - return 0; -} - -static int ath6kl_usb_bmi_write(struct ath6kl *ar, u8 *buf, u32 len) -{ - struct ath6kl_usb *ar_usb = ar->hif_priv; - int ret; - - /* send command */ - ret = ath6kl_usb_submit_ctrl_out(ar_usb, - ATH6KL_USB_CONTROL_REQ_SEND_BMI_CMD, - 0, 0, buf, len); - if (ret) { - ath6kl_err("unable to send the bmi data to the device: %d\n", - ret); - return ret; - } - - return 0; -} - -static int ath6kl_usb_power_on(struct ath6kl *ar) -{ - hif_start(ar); - return 0; -} - -static int ath6kl_usb_power_off(struct ath6kl *ar) -{ - hif_detach_htc(ar); - return 0; -} - -static void ath6kl_usb_stop(struct ath6kl *ar) -{ - hif_stop(ar); -} - -static void ath6kl_usb_cleanup_scatter(struct ath6kl *ar) -{ - /* - * USB doesn't support it. Just return. - */ - return; -} - -static const struct ath6kl_hif_ops ath6kl_usb_ops = { - .diag_read32 = ath6kl_usb_diag_read32, - .diag_write32 = ath6kl_usb_diag_write32, - .bmi_read = ath6kl_usb_bmi_read, - .bmi_write = ath6kl_usb_bmi_write, - .power_on = ath6kl_usb_power_on, - .power_off = ath6kl_usb_power_off, - .stop = ath6kl_usb_stop, - .pipe_send = ath6kl_usb_send, - .pipe_get_default = ath6kl_usb_get_default_pipe, - .pipe_map_service = ath6kl_usb_map_service_pipe, - .pipe_get_free_queue_number = ath6kl_usb_get_free_queue_number, - .cleanup_scatter = ath6kl_usb_cleanup_scatter, -}; - -/* ath6kl usb driver registered functions */ -static int ath6kl_usb_probe(struct usb_interface *interface, - const struct usb_device_id *id) -{ - struct usb_device *dev = interface_to_usbdev(interface); - struct ath6kl *ar; - struct ath6kl_usb *ar_usb = NULL; - int vendor_id, product_id; - int ret = 0; - - usb_get_dev(dev); - - vendor_id = le16_to_cpu(dev->descriptor.idVendor); - product_id = le16_to_cpu(dev->descriptor.idProduct); - - ath6kl_dbg(ATH6KL_DBG_USB, "vendor_id = %04x\n", vendor_id); - ath6kl_dbg(ATH6KL_DBG_USB, "product_id = %04x\n", product_id); - - if (interface->cur_altsetting) - ath6kl_dbg(ATH6KL_DBG_USB, "USB Interface %d\n", - interface->cur_altsetting->desc.bInterfaceNumber); - - - if (dev->speed == USB_SPEED_HIGH) - ath6kl_dbg(ATH6KL_DBG_USB, "USB 2.0 Host\n"); - else - ath6kl_dbg(ATH6KL_DBG_USB, "USB 1.1 Host\n"); - - ar_usb = ath6kl_usb_create(interface); - - if (ar_usb == NULL) { - ret = -ENOMEM; - goto err_usb_put; - } - - ar = ath6kl_core_create(&ar_usb->udev->dev); - if (ar == NULL) { - ath6kl_err("Failed to alloc ath6kl core\n"); - ret = -ENOMEM; - goto err_usb_destroy; - } - - ar->hif_priv = ar_usb; - ar->hif_type = ATH6KL_HIF_TYPE_USB; - ar->hif_ops = &ath6kl_usb_ops; - ar->mbox_info.block_size = 16; - ar->bmi.max_data_size = 252; - - ar_usb->ar = ar; - - ret = ath6kl_core_init(ar, ATH6KL_HTC_TYPE_PIPE); - if (ret) { - ath6kl_err("Failed to init ath6kl core: %d\n", ret); - goto err_core_free; - } - - return ret; - -err_core_free: - ath6kl_core_destroy(ar); -err_usb_destroy: - ath6kl_usb_destroy(ar_usb); -err_usb_put: - usb_put_dev(dev); - - return ret; -} - -static void ath6kl_usb_remove(struct usb_interface *interface) -{ - usb_put_dev(interface_to_usbdev(interface)); - ath6kl_usb_device_detached(interface); -} - -#ifdef CONFIG_PM - -static int ath6kl_usb_suspend(struct usb_interface *interface, - pm_message_t message) -{ - struct ath6kl_usb *device; - device = usb_get_intfdata(interface); - - ath6kl_usb_flush_all(device); - return 0; -} - -static int ath6kl_usb_resume(struct usb_interface *interface) -{ - struct ath6kl_usb *device; - device = usb_get_intfdata(interface); - - ath6kl_usb_post_recv_transfers(&device->pipes[ATH6KL_USB_PIPE_RX_DATA], - ATH6KL_USB_RX_BUFFER_SIZE); - ath6kl_usb_post_recv_transfers(&device->pipes[ATH6KL_USB_PIPE_RX_DATA2], - ATH6KL_USB_RX_BUFFER_SIZE); - - return 0; -} - -static int ath6kl_usb_reset_resume(struct usb_interface *intf) -{ - if (usb_get_intfdata(intf)) - ath6kl_usb_remove(intf); - return 0; -} - -#else - -#define ath6kl_usb_suspend NULL -#define ath6kl_usb_resume NULL -#define ath6kl_usb_reset_resume NULL - -#endif - -/* table of devices that work with this driver */ -static struct usb_device_id ath6kl_usb_ids[] = { - {USB_DEVICE(0x0cf3, 0x9374)}, - { /* Terminating entry */ }, -}; - -MODULE_DEVICE_TABLE(usb, ath6kl_usb_ids); - -static struct usb_driver ath6kl_usb_driver = { - .name = "ath6kl_usb", - .probe = ath6kl_usb_probe, - .suspend = ath6kl_usb_suspend, - .resume = ath6kl_usb_resume, - .reset_resume = ath6kl_usb_reset_resume, - .disconnect = ath6kl_usb_remove, - .id_table = ath6kl_usb_ids, - .supports_autosuspend = true, - .disable_hub_initiated_lpm = 1, -}; - -static int ath6kl_usb_init(void) -{ - int ret; - - ret = usb_register(&ath6kl_usb_driver); - if (ret) { - ath6kl_err("usb registration failed: %d\n", ret); - return ret; - } - - return 0; -} - -static void ath6kl_usb_exit(void) -{ - usb_deregister(&ath6kl_usb_driver); -} - -module_init(ath6kl_usb_init); -module_exit(ath6kl_usb_exit); - -MODULE_AUTHOR("Atheros Communications, Inc."); -MODULE_DESCRIPTION("Driver support for Atheros AR600x USB devices"); -MODULE_LICENSE("Dual BSD/GPL"); -MODULE_FIRMWARE(AR6004_HW_1_0_FIRMWARE_FILE); -MODULE_FIRMWARE(AR6004_HW_1_0_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_0_DEFAULT_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_1_FIRMWARE_FILE); -MODULE_FIRMWARE(AR6004_HW_1_1_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_1_DEFAULT_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_2_FIRMWARE_FILE); -MODULE_FIRMWARE(AR6004_HW_1_2_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_2_DEFAULT_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_3_FW_DIR "/" AR6004_HW_1_3_FIRMWARE_FILE); -MODULE_FIRMWARE(AR6004_HW_1_3_BOARD_DATA_FILE); -MODULE_FIRMWARE(AR6004_HW_1_3_DEFAULT_BOARD_DATA_FILE); diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c deleted file mode 100644 index 87aefb4c4c23..000000000000 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ /dev/null @@ -1,4134 +0,0 @@ -/* - * Copyright (c) 2004-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include "core.h" -#include "debug.h" -#include "testmode.h" -#include "trace.h" -#include "../regd.h" -#include "../regd_common.h" - -static int ath6kl_wmi_sync_point(struct wmi *wmi, u8 if_idx); - -static const s32 wmi_rate_tbl[][2] = { - /* {W/O SGI, with SGI} */ - {1000, 1000}, - {2000, 2000}, - {5500, 5500}, - {11000, 11000}, - {6000, 6000}, - {9000, 9000}, - {12000, 12000}, - {18000, 18000}, - {24000, 24000}, - {36000, 36000}, - {48000, 48000}, - {54000, 54000}, - {6500, 7200}, - {13000, 14400}, - {19500, 21700}, - {26000, 28900}, - {39000, 43300}, - {52000, 57800}, - {58500, 65000}, - {65000, 72200}, - {13500, 15000}, - {27000, 30000}, - {40500, 45000}, - {54000, 60000}, - {81000, 90000}, - {108000, 120000}, - {121500, 135000}, - {135000, 150000}, - {0, 0} -}; - -/* 802.1d to AC mapping. Refer pg 57 of WMM-test-plan-v1.2 */ -static const u8 up_to_ac[] = { - WMM_AC_BE, - WMM_AC_BK, - WMM_AC_BK, - WMM_AC_BE, - WMM_AC_VI, - WMM_AC_VI, - WMM_AC_VO, - WMM_AC_VO, -}; - -void ath6kl_wmi_set_control_ep(struct wmi *wmi, enum htc_endpoint_id ep_id) -{ - if (WARN_ON(ep_id == ENDPOINT_UNUSED || ep_id >= ENDPOINT_MAX)) - return; - - wmi->ep_id = ep_id; -} - -enum htc_endpoint_id ath6kl_wmi_get_control_ep(struct wmi *wmi) -{ - return wmi->ep_id; -} - -struct ath6kl_vif *ath6kl_get_vif_by_index(struct ath6kl *ar, u8 if_idx) -{ - struct ath6kl_vif *vif, *found = NULL; - - if (WARN_ON(if_idx > (ar->vif_max - 1))) - return NULL; - - /* FIXME: Locking */ - spin_lock_bh(&ar->list_lock); - list_for_each_entry(vif, &ar->vif_list, list) { - if (vif->fw_vif_idx == if_idx) { - found = vif; - break; - } - } - spin_unlock_bh(&ar->list_lock); - - return found; -} - -/* Performs DIX to 802.3 encapsulation for transmit packets. - * Assumes the entire DIX header is contigous and that there is - * enough room in the buffer for a 802.3 mac header and LLC+SNAP headers. - */ -int ath6kl_wmi_dix_2_dot3(struct wmi *wmi, struct sk_buff *skb) -{ - struct ath6kl_llc_snap_hdr *llc_hdr; - struct ethhdr *eth_hdr; - size_t new_len; - __be16 type; - u8 *datap; - u16 size; - - if (WARN_ON(skb == NULL)) - return -EINVAL; - - size = sizeof(struct ath6kl_llc_snap_hdr) + sizeof(struct wmi_data_hdr); - if (skb_headroom(skb) < size) - return -ENOMEM; - - eth_hdr = (struct ethhdr *) skb->data; - type = eth_hdr->h_proto; - - if (!is_ethertype(be16_to_cpu(type))) { - ath6kl_dbg(ATH6KL_DBG_WMI, - "%s: pkt is already in 802.3 format\n", __func__); - return 0; - } - - new_len = skb->len - sizeof(*eth_hdr) + sizeof(*llc_hdr); - - skb_push(skb, sizeof(struct ath6kl_llc_snap_hdr)); - datap = skb->data; - - eth_hdr->h_proto = cpu_to_be16(new_len); - - memcpy(datap, eth_hdr, sizeof(*eth_hdr)); - - llc_hdr = (struct ath6kl_llc_snap_hdr *)(datap + sizeof(*eth_hdr)); - llc_hdr->dsap = 0xAA; - llc_hdr->ssap = 0xAA; - llc_hdr->cntl = 0x03; - llc_hdr->org_code[0] = 0x0; - llc_hdr->org_code[1] = 0x0; - llc_hdr->org_code[2] = 0x0; - llc_hdr->eth_type = type; - - return 0; -} - -static int ath6kl_wmi_meta_add(struct wmi *wmi, struct sk_buff *skb, - u8 *version, void *tx_meta_info) -{ - struct wmi_tx_meta_v1 *v1; - struct wmi_tx_meta_v2 *v2; - - if (WARN_ON(skb == NULL || version == NULL)) - return -EINVAL; - - switch (*version) { - case WMI_META_VERSION_1: - skb_push(skb, WMI_MAX_TX_META_SZ); - v1 = (struct wmi_tx_meta_v1 *) skb->data; - v1->pkt_id = 0; - v1->rate_plcy_id = 0; - *version = WMI_META_VERSION_1; - break; - case WMI_META_VERSION_2: - skb_push(skb, WMI_MAX_TX_META_SZ); - v2 = (struct wmi_tx_meta_v2 *) skb->data; - memcpy(v2, (struct wmi_tx_meta_v2 *) tx_meta_info, - sizeof(struct wmi_tx_meta_v2)); - break; - } - - return 0; -} - -int ath6kl_wmi_data_hdr_add(struct wmi *wmi, struct sk_buff *skb, - u8 msg_type, u32 flags, - enum wmi_data_hdr_data_type data_type, - u8 meta_ver, void *tx_meta_info, u8 if_idx) -{ - struct wmi_data_hdr *data_hdr; - int ret; - - if (WARN_ON(skb == NULL || (if_idx > wmi->parent_dev->vif_max - 1))) - return -EINVAL; - - if (tx_meta_info) { - ret = ath6kl_wmi_meta_add(wmi, skb, &meta_ver, tx_meta_info); - if (ret) - return ret; - } - - skb_push(skb, sizeof(struct wmi_data_hdr)); - - data_hdr = (struct wmi_data_hdr *)skb->data; - memset(data_hdr, 0, sizeof(struct wmi_data_hdr)); - - data_hdr->info = msg_type << WMI_DATA_HDR_MSG_TYPE_SHIFT; - data_hdr->info |= data_type << WMI_DATA_HDR_DATA_TYPE_SHIFT; - - if (flags & WMI_DATA_HDR_FLAGS_MORE) - data_hdr->info |= WMI_DATA_HDR_MORE; - - if (flags & WMI_DATA_HDR_FLAGS_EOSP) - data_hdr->info3 |= cpu_to_le16(WMI_DATA_HDR_EOSP); - - data_hdr->info2 |= cpu_to_le16(meta_ver << WMI_DATA_HDR_META_SHIFT); - data_hdr->info3 |= cpu_to_le16(if_idx & WMI_DATA_HDR_IF_IDX_MASK); - - return 0; -} - -u8 ath6kl_wmi_determine_user_priority(u8 *pkt, u32 layer2_pri) -{ - struct iphdr *ip_hdr = (struct iphdr *) pkt; - u8 ip_pri; - - /* - * Determine IPTOS priority - * - * IP-TOS - 8bits - * : DSCP(6-bits) ECN(2-bits) - * : DSCP - P2 P1 P0 X X X - * where (P2 P1 P0) form 802.1D - */ - ip_pri = ip_hdr->tos >> 5; - ip_pri &= 0x7; - - if ((layer2_pri & 0x7) > ip_pri) - return (u8) layer2_pri & 0x7; - else - return ip_pri; -} - -u8 ath6kl_wmi_get_traffic_class(u8 user_priority) -{ - return up_to_ac[user_priority & 0x7]; -} - -int ath6kl_wmi_implicit_create_pstream(struct wmi *wmi, u8 if_idx, - struct sk_buff *skb, - u32 layer2_priority, bool wmm_enabled, - u8 *ac) -{ - struct wmi_data_hdr *data_hdr; - struct ath6kl_llc_snap_hdr *llc_hdr; - struct wmi_create_pstream_cmd cmd; - u32 meta_size, hdr_size; - u16 ip_type = IP_ETHERTYPE; - u8 stream_exist, usr_pri; - u8 traffic_class = WMM_AC_BE; - u8 *datap; - - if (WARN_ON(skb == NULL)) - return -EINVAL; - - datap = skb->data; - data_hdr = (struct wmi_data_hdr *) datap; - - meta_size = ((le16_to_cpu(data_hdr->info2) >> WMI_DATA_HDR_META_SHIFT) & - WMI_DATA_HDR_META_MASK) ? WMI_MAX_TX_META_SZ : 0; - - if (!wmm_enabled) { - /* If WMM is disabled all traffic goes as BE traffic */ - usr_pri = 0; - } else { - hdr_size = sizeof(struct ethhdr); - - llc_hdr = (struct ath6kl_llc_snap_hdr *)(datap + - sizeof(struct - wmi_data_hdr) + - meta_size + hdr_size); - - if (llc_hdr->eth_type == htons(ip_type)) { - /* - * Extract the endpoint info from the TOS field - * in the IP header. - */ - usr_pri = - ath6kl_wmi_determine_user_priority(((u8 *) llc_hdr) + - sizeof(struct ath6kl_llc_snap_hdr), - layer2_priority); - } else - usr_pri = layer2_priority & 0x7; - - /* - * Queue the EAPOL frames in the same WMM_AC_VO queue - * as that of management frames. - */ - if (skb->protocol == cpu_to_be16(ETH_P_PAE)) - usr_pri = WMI_VOICE_USER_PRIORITY; - } - - /* - * workaround for WMM S5 - * - * FIXME: wmi->traffic_class is always 100 so this test doesn't - * make sense - */ - if ((wmi->traffic_class == WMM_AC_VI) && - ((usr_pri == 5) || (usr_pri == 4))) - usr_pri = 1; - - /* Convert user priority to traffic class */ - traffic_class = up_to_ac[usr_pri & 0x7]; - - wmi_data_hdr_set_up(data_hdr, usr_pri); - - spin_lock_bh(&wmi->lock); - stream_exist = wmi->fat_pipe_exist; - spin_unlock_bh(&wmi->lock); - - if (!(stream_exist & (1 << traffic_class))) { - memset(&cmd, 0, sizeof(cmd)); - cmd.traffic_class = traffic_class; - cmd.user_pri = usr_pri; - cmd.inactivity_int = - cpu_to_le32(WMI_IMPLICIT_PSTREAM_INACTIVITY_INT); - /* Implicit streams are created with TSID 0xFF */ - cmd.tsid = WMI_IMPLICIT_PSTREAM; - ath6kl_wmi_create_pstream_cmd(wmi, if_idx, &cmd); - } - - *ac = traffic_class; - - return 0; -} - -int ath6kl_wmi_dot11_hdr_remove(struct wmi *wmi, struct sk_buff *skb) -{ - struct ieee80211_hdr_3addr *pwh, wh; - struct ath6kl_llc_snap_hdr *llc_hdr; - struct ethhdr eth_hdr; - u32 hdr_size; - u8 *datap; - __le16 sub_type; - - if (WARN_ON(skb == NULL)) - return -EINVAL; - - datap = skb->data; - pwh = (struct ieee80211_hdr_3addr *) datap; - - sub_type = pwh->frame_control & cpu_to_le16(IEEE80211_FCTL_STYPE); - - memcpy((u8 *) &wh, datap, sizeof(struct ieee80211_hdr_3addr)); - - /* Strip off the 802.11 header */ - if (sub_type == cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { - hdr_size = roundup(sizeof(struct ieee80211_qos_hdr), - sizeof(u32)); - skb_pull(skb, hdr_size); - } else if (sub_type == cpu_to_le16(IEEE80211_STYPE_DATA)) - skb_pull(skb, sizeof(struct ieee80211_hdr_3addr)); - - datap = skb->data; - llc_hdr = (struct ath6kl_llc_snap_hdr *)(datap); - - memset(ð_hdr, 0, sizeof(eth_hdr)); - eth_hdr.h_proto = llc_hdr->eth_type; - - switch ((le16_to_cpu(wh.frame_control)) & - (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { - case 0: - memcpy(eth_hdr.h_dest, wh.addr1, ETH_ALEN); - memcpy(eth_hdr.h_source, wh.addr2, ETH_ALEN); - break; - case IEEE80211_FCTL_TODS: - memcpy(eth_hdr.h_dest, wh.addr3, ETH_ALEN); - memcpy(eth_hdr.h_source, wh.addr2, ETH_ALEN); - break; - case IEEE80211_FCTL_FROMDS: - memcpy(eth_hdr.h_dest, wh.addr1, ETH_ALEN); - memcpy(eth_hdr.h_source, wh.addr3, ETH_ALEN); - break; - case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: - break; - } - - skb_pull(skb, sizeof(struct ath6kl_llc_snap_hdr)); - skb_push(skb, sizeof(eth_hdr)); - - datap = skb->data; - - memcpy(datap, ð_hdr, sizeof(eth_hdr)); - - return 0; -} - -/* - * Performs 802.3 to DIX encapsulation for received packets. - * Assumes the entire 802.3 header is contigous. - */ -int ath6kl_wmi_dot3_2_dix(struct sk_buff *skb) -{ - struct ath6kl_llc_snap_hdr *llc_hdr; - struct ethhdr eth_hdr; - u8 *datap; - - if (WARN_ON(skb == NULL)) - return -EINVAL; - - datap = skb->data; - - memcpy(ð_hdr, datap, sizeof(eth_hdr)); - - llc_hdr = (struct ath6kl_llc_snap_hdr *) (datap + sizeof(eth_hdr)); - eth_hdr.h_proto = llc_hdr->eth_type; - - skb_pull(skb, sizeof(struct ath6kl_llc_snap_hdr)); - datap = skb->data; - - memcpy(datap, ð_hdr, sizeof(eth_hdr)); - - return 0; -} - -static int ath6kl_wmi_tx_complete_event_rx(u8 *datap, int len) -{ - struct tx_complete_msg_v1 *msg_v1; - struct wmi_tx_complete_event *evt; - int index; - u16 size; - - evt = (struct wmi_tx_complete_event *) datap; - - ath6kl_dbg(ATH6KL_DBG_WMI, "comp: %d %d %d\n", - evt->num_msg, evt->msg_len, evt->msg_type); - - for (index = 0; index < evt->num_msg; index++) { - size = sizeof(struct wmi_tx_complete_event) + - (index * sizeof(struct tx_complete_msg_v1)); - msg_v1 = (struct tx_complete_msg_v1 *)(datap + size); - - ath6kl_dbg(ATH6KL_DBG_WMI, "msg: %d %d %d %d\n", - msg_v1->status, msg_v1->pkt_id, - msg_v1->rate_idx, msg_v1->ack_failures); - } - - return 0; -} - -static int ath6kl_wmi_remain_on_chnl_event_rx(struct wmi *wmi, u8 *datap, - int len, struct ath6kl_vif *vif) -{ - struct wmi_remain_on_chnl_event *ev; - u32 freq; - u32 dur; - struct ieee80211_channel *chan; - struct ath6kl *ar = wmi->parent_dev; - u32 id; - - if (len < sizeof(*ev)) - return -EINVAL; - - ev = (struct wmi_remain_on_chnl_event *) datap; - freq = le32_to_cpu(ev->freq); - dur = le32_to_cpu(ev->duration); - ath6kl_dbg(ATH6KL_DBG_WMI, "remain_on_chnl: freq=%u dur=%u\n", - freq, dur); - chan = ieee80211_get_channel(ar->wiphy, freq); - if (!chan) { - ath6kl_dbg(ATH6KL_DBG_WMI, - "remain_on_chnl: Unknown channel (freq=%u)\n", - freq); - return -EINVAL; - } - id = vif->last_roc_id; - cfg80211_ready_on_channel(&vif->wdev, id, chan, - dur, GFP_ATOMIC); - - return 0; -} - -static int ath6kl_wmi_cancel_remain_on_chnl_event_rx(struct wmi *wmi, - u8 *datap, int len, - struct ath6kl_vif *vif) -{ - struct wmi_cancel_remain_on_chnl_event *ev; - u32 freq; - u32 dur; - struct ieee80211_channel *chan; - struct ath6kl *ar = wmi->parent_dev; - u32 id; - - if (len < sizeof(*ev)) - return -EINVAL; - - ev = (struct wmi_cancel_remain_on_chnl_event *) datap; - freq = le32_to_cpu(ev->freq); - dur = le32_to_cpu(ev->duration); - ath6kl_dbg(ATH6KL_DBG_WMI, - "cancel_remain_on_chnl: freq=%u dur=%u status=%u\n", - freq, dur, ev->status); - chan = ieee80211_get_channel(ar->wiphy, freq); - if (!chan) { - ath6kl_dbg(ATH6KL_DBG_WMI, - "cancel_remain_on_chnl: Unknown channel (freq=%u)\n", - freq); - return -EINVAL; - } - if (vif->last_cancel_roc_id && - vif->last_cancel_roc_id + 1 == vif->last_roc_id) - id = vif->last_cancel_roc_id; /* event for cancel command */ - else - id = vif->last_roc_id; /* timeout on uncanceled r-o-c */ - vif->last_cancel_roc_id = 0; - cfg80211_remain_on_channel_expired(&vif->wdev, id, chan, GFP_ATOMIC); - - return 0; -} - -static int ath6kl_wmi_tx_status_event_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - struct wmi_tx_status_event *ev; - u32 id; - - if (len < sizeof(*ev)) - return -EINVAL; - - ev = (struct wmi_tx_status_event *) datap; - id = le32_to_cpu(ev->id); - ath6kl_dbg(ATH6KL_DBG_WMI, "tx_status: id=%x ack_status=%u\n", - id, ev->ack_status); - if (wmi->last_mgmt_tx_frame) { - cfg80211_mgmt_tx_status(&vif->wdev, id, - wmi->last_mgmt_tx_frame, - wmi->last_mgmt_tx_frame_len, - !!ev->ack_status, GFP_ATOMIC); - kfree(wmi->last_mgmt_tx_frame); - wmi->last_mgmt_tx_frame = NULL; - wmi->last_mgmt_tx_frame_len = 0; - } - - return 0; -} - -static int ath6kl_wmi_rx_probe_req_event_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - struct wmi_p2p_rx_probe_req_event *ev; - u32 freq; - u16 dlen; - - if (len < sizeof(*ev)) - return -EINVAL; - - ev = (struct wmi_p2p_rx_probe_req_event *) datap; - freq = le32_to_cpu(ev->freq); - dlen = le16_to_cpu(ev->len); - if (datap + len < ev->data + dlen) { - ath6kl_err("invalid wmi_p2p_rx_probe_req_event: len=%d dlen=%u\n", - len, dlen); - return -EINVAL; - } - ath6kl_dbg(ATH6KL_DBG_WMI, - "rx_probe_req: len=%u freq=%u probe_req_report=%d\n", - dlen, freq, vif->probe_req_report); - - if (vif->probe_req_report || vif->nw_type == AP_NETWORK) - cfg80211_rx_mgmt(&vif->wdev, freq, 0, - ev->data, dlen, GFP_ATOMIC); - - return 0; -} - -static int ath6kl_wmi_p2p_capabilities_event_rx(u8 *datap, int len) -{ - struct wmi_p2p_capabilities_event *ev; - u16 dlen; - - if (len < sizeof(*ev)) - return -EINVAL; - - ev = (struct wmi_p2p_capabilities_event *) datap; - dlen = le16_to_cpu(ev->len); - ath6kl_dbg(ATH6KL_DBG_WMI, "p2p_capab: len=%u\n", dlen); - - return 0; -} - -static int ath6kl_wmi_rx_action_event_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - struct wmi_rx_action_event *ev; - u32 freq; - u16 dlen; - - if (len < sizeof(*ev)) - return -EINVAL; - - ev = (struct wmi_rx_action_event *) datap; - freq = le32_to_cpu(ev->freq); - dlen = le16_to_cpu(ev->len); - if (datap + len < ev->data + dlen) { - ath6kl_err("invalid wmi_rx_action_event: len=%d dlen=%u\n", - len, dlen); - return -EINVAL; - } - ath6kl_dbg(ATH6KL_DBG_WMI, "rx_action: len=%u freq=%u\n", dlen, freq); - cfg80211_rx_mgmt(&vif->wdev, freq, 0, - ev->data, dlen, GFP_ATOMIC); - - return 0; -} - -static int ath6kl_wmi_p2p_info_event_rx(u8 *datap, int len) -{ - struct wmi_p2p_info_event *ev; - u32 flags; - u16 dlen; - - if (len < sizeof(*ev)) - return -EINVAL; - - ev = (struct wmi_p2p_info_event *) datap; - flags = le32_to_cpu(ev->info_req_flags); - dlen = le16_to_cpu(ev->len); - ath6kl_dbg(ATH6KL_DBG_WMI, "p2p_info: flags=%x len=%d\n", flags, dlen); - - if (flags & P2P_FLAG_CAPABILITIES_REQ) { - struct wmi_p2p_capabilities *cap; - if (dlen < sizeof(*cap)) - return -EINVAL; - cap = (struct wmi_p2p_capabilities *) ev->data; - ath6kl_dbg(ATH6KL_DBG_WMI, "p2p_info: GO Power Save = %d\n", - cap->go_power_save); - } - - if (flags & P2P_FLAG_MACADDR_REQ) { - struct wmi_p2p_macaddr *mac; - if (dlen < sizeof(*mac)) - return -EINVAL; - mac = (struct wmi_p2p_macaddr *) ev->data; - ath6kl_dbg(ATH6KL_DBG_WMI, "p2p_info: MAC Address = %pM\n", - mac->mac_addr); - } - - if (flags & P2P_FLAG_HMODEL_REQ) { - struct wmi_p2p_hmodel *mod; - if (dlen < sizeof(*mod)) - return -EINVAL; - mod = (struct wmi_p2p_hmodel *) ev->data; - ath6kl_dbg(ATH6KL_DBG_WMI, "p2p_info: P2P Model = %d (%s)\n", - mod->p2p_model, - mod->p2p_model ? "host" : "firmware"); - } - return 0; -} - -static inline struct sk_buff *ath6kl_wmi_get_new_buf(u32 size) -{ - struct sk_buff *skb; - - skb = ath6kl_buf_alloc(size); - if (!skb) - return NULL; - - skb_put(skb, size); - if (size) - memset(skb->data, 0, size); - - return skb; -} - -/* Send a "simple" wmi command -- one with no arguments */ -static int ath6kl_wmi_simple_cmd(struct wmi *wmi, u8 if_idx, - enum wmi_cmd_id cmd_id) -{ - struct sk_buff *skb; - int ret; - - skb = ath6kl_wmi_get_new_buf(0); - if (!skb) - return -ENOMEM; - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, cmd_id, NO_SYNC_WMIFLAG); - - return ret; -} - -static int ath6kl_wmi_ready_event_rx(struct wmi *wmi, u8 *datap, int len) -{ - struct wmi_ready_event_2 *ev = (struct wmi_ready_event_2 *) datap; - - if (len < sizeof(struct wmi_ready_event_2)) - return -EINVAL; - - ath6kl_ready_event(wmi->parent_dev, ev->mac_addr, - le32_to_cpu(ev->sw_version), - le32_to_cpu(ev->abi_version), ev->phy_cap); - - return 0; -} - -/* - * Mechanism to modify the roaming behavior in the firmware. The lower rssi - * at which the station has to roam can be passed with - * WMI_SET_LRSSI_SCAN_PARAMS. Subtract 96 from RSSI to get the signal level - * in dBm. - */ -int ath6kl_wmi_set_roam_lrssi_cmd(struct wmi *wmi, u8 lrssi) -{ - struct sk_buff *skb; - struct roam_ctrl_cmd *cmd; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct roam_ctrl_cmd *) skb->data; - - cmd->info.params.lrssi_scan_period = cpu_to_le16(DEF_LRSSI_SCAN_PERIOD); - cmd->info.params.lrssi_scan_threshold = a_cpu_to_sle16(lrssi + - DEF_SCAN_FOR_ROAM_INTVL); - cmd->info.params.lrssi_roam_threshold = a_cpu_to_sle16(lrssi); - cmd->info.params.roam_rssi_floor = DEF_LRSSI_ROAM_FLOOR; - cmd->roam_ctrl = WMI_SET_LRSSI_SCAN_PARAMS; - - ath6kl_wmi_cmd_send(wmi, 0, skb, WMI_SET_ROAM_CTRL_CMDID, - NO_SYNC_WMIFLAG); - - return 0; -} - -int ath6kl_wmi_force_roam_cmd(struct wmi *wmi, const u8 *bssid) -{ - struct sk_buff *skb; - struct roam_ctrl_cmd *cmd; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct roam_ctrl_cmd *) skb->data; - - memcpy(cmd->info.bssid, bssid, ETH_ALEN); - cmd->roam_ctrl = WMI_FORCE_ROAM; - - ath6kl_dbg(ATH6KL_DBG_WMI, "force roam to %pM\n", bssid); - return ath6kl_wmi_cmd_send(wmi, 0, skb, WMI_SET_ROAM_CTRL_CMDID, - NO_SYNC_WMIFLAG); -} - -int ath6kl_wmi_ap_set_beacon_intvl_cmd(struct wmi *wmi, u8 if_idx, - u32 beacon_intvl) -{ - struct sk_buff *skb; - struct set_beacon_int_cmd *cmd; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct set_beacon_int_cmd *) skb->data; - - cmd->beacon_intvl = cpu_to_le32(beacon_intvl); - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, - WMI_SET_BEACON_INT_CMDID, NO_SYNC_WMIFLAG); -} - -int ath6kl_wmi_ap_set_dtim_cmd(struct wmi *wmi, u8 if_idx, u32 dtim_period) -{ - struct sk_buff *skb; - struct set_dtim_cmd *cmd; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct set_dtim_cmd *) skb->data; - - cmd->dtim_period = cpu_to_le32(dtim_period); - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, - WMI_AP_SET_DTIM_CMDID, NO_SYNC_WMIFLAG); -} - -int ath6kl_wmi_set_roam_mode_cmd(struct wmi *wmi, enum wmi_roam_mode mode) -{ - struct sk_buff *skb; - struct roam_ctrl_cmd *cmd; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct roam_ctrl_cmd *) skb->data; - - cmd->info.roam_mode = mode; - cmd->roam_ctrl = WMI_SET_ROAM_MODE; - - ath6kl_dbg(ATH6KL_DBG_WMI, "set roam mode %d\n", mode); - return ath6kl_wmi_cmd_send(wmi, 0, skb, WMI_SET_ROAM_CTRL_CMDID, - NO_SYNC_WMIFLAG); -} - -static int ath6kl_wmi_connect_event_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - struct wmi_connect_event *ev; - u8 *pie, *peie; - - if (len < sizeof(struct wmi_connect_event)) - return -EINVAL; - - ev = (struct wmi_connect_event *) datap; - - if (vif->nw_type == AP_NETWORK) { - /* AP mode start/STA connected event */ - struct net_device *dev = vif->ndev; - if (memcmp(dev->dev_addr, ev->u.ap_bss.bssid, ETH_ALEN) == 0) { - ath6kl_dbg(ATH6KL_DBG_WMI, - "%s: freq %d bssid %pM (AP started)\n", - __func__, le16_to_cpu(ev->u.ap_bss.ch), - ev->u.ap_bss.bssid); - ath6kl_connect_ap_mode_bss( - vif, le16_to_cpu(ev->u.ap_bss.ch)); - } else { - ath6kl_dbg(ATH6KL_DBG_WMI, - "%s: aid %u mac_addr %pM auth=%u keymgmt=%u cipher=%u apsd_info=%u (STA connected)\n", - __func__, ev->u.ap_sta.aid, - ev->u.ap_sta.mac_addr, - ev->u.ap_sta.auth, - ev->u.ap_sta.keymgmt, - le16_to_cpu(ev->u.ap_sta.cipher), - ev->u.ap_sta.apsd_info); - - ath6kl_connect_ap_mode_sta( - vif, ev->u.ap_sta.aid, ev->u.ap_sta.mac_addr, - ev->u.ap_sta.keymgmt, - le16_to_cpu(ev->u.ap_sta.cipher), - ev->u.ap_sta.auth, ev->assoc_req_len, - ev->assoc_info + ev->beacon_ie_len, - ev->u.ap_sta.apsd_info); - } - return 0; - } - - /* STA/IBSS mode connection event */ - - ath6kl_dbg(ATH6KL_DBG_WMI, - "wmi event connect freq %d bssid %pM listen_intvl %d beacon_intvl %d type %d\n", - le16_to_cpu(ev->u.sta.ch), ev->u.sta.bssid, - le16_to_cpu(ev->u.sta.listen_intvl), - le16_to_cpu(ev->u.sta.beacon_intvl), - le32_to_cpu(ev->u.sta.nw_type)); - - /* Start of assoc rsp IEs */ - pie = ev->assoc_info + ev->beacon_ie_len + - ev->assoc_req_len + (sizeof(u16) * 3); /* capinfo, status, aid */ - - /* End of assoc rsp IEs */ - peie = ev->assoc_info + ev->beacon_ie_len + ev->assoc_req_len + - ev->assoc_resp_len; - - while (pie < peie) { - switch (*pie) { - case WLAN_EID_VENDOR_SPECIFIC: - if (pie[1] > 3 && pie[2] == 0x00 && pie[3] == 0x50 && - pie[4] == 0xf2 && pie[5] == WMM_OUI_TYPE) { - /* WMM OUT (00:50:F2) */ - if (pie[1] > 5 && - pie[6] == WMM_PARAM_OUI_SUBTYPE) - wmi->is_wmm_enabled = true; - } - break; - } - - if (wmi->is_wmm_enabled) - break; - - pie += pie[1] + 2; - } - - ath6kl_connect_event(vif, le16_to_cpu(ev->u.sta.ch), - ev->u.sta.bssid, - le16_to_cpu(ev->u.sta.listen_intvl), - le16_to_cpu(ev->u.sta.beacon_intvl), - le32_to_cpu(ev->u.sta.nw_type), - ev->beacon_ie_len, ev->assoc_req_len, - ev->assoc_resp_len, ev->assoc_info); - - return 0; -} - -static struct country_code_to_enum_rd * -ath6kl_regd_find_country(u16 countryCode) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(allCountries); i++) { - if (allCountries[i].countryCode == countryCode) - return &allCountries[i]; - } - - return NULL; -} - -static struct reg_dmn_pair_mapping * -ath6kl_get_regpair(u16 regdmn) -{ - int i; - - if (regdmn == NO_ENUMRD) - return NULL; - - for (i = 0; i < ARRAY_SIZE(regDomainPairs); i++) { - if (regDomainPairs[i].regDmnEnum == regdmn) - return ®DomainPairs[i]; - } - - return NULL; -} - -static struct country_code_to_enum_rd * -ath6kl_regd_find_country_by_rd(u16 regdmn) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(allCountries); i++) { - if (allCountries[i].regDmnEnum == regdmn) - return &allCountries[i]; - } - - return NULL; -} - -static void ath6kl_wmi_regdomain_event(struct wmi *wmi, u8 *datap, int len) -{ - - struct ath6kl_wmi_regdomain *ev; - struct country_code_to_enum_rd *country = NULL; - struct reg_dmn_pair_mapping *regpair = NULL; - char alpha2[2]; - u32 reg_code; - - ev = (struct ath6kl_wmi_regdomain *) datap; - reg_code = le32_to_cpu(ev->reg_code); - - if ((reg_code >> ATH6KL_COUNTRY_RD_SHIFT) & COUNTRY_ERD_FLAG) - country = ath6kl_regd_find_country((u16) reg_code); - else if (!(((u16) reg_code & WORLD_SKU_MASK) == WORLD_SKU_PREFIX)) { - - regpair = ath6kl_get_regpair((u16) reg_code); - country = ath6kl_regd_find_country_by_rd((u16) reg_code); - if (regpair) - ath6kl_dbg(ATH6KL_DBG_WMI, "Regpair used: 0x%0x\n", - regpair->regDmnEnum); - else - ath6kl_warn("Regpair not found reg_code 0x%0x\n", - reg_code); - } - - if (country && wmi->parent_dev->wiphy_registered) { - alpha2[0] = country->isoName[0]; - alpha2[1] = country->isoName[1]; - - regulatory_hint(wmi->parent_dev->wiphy, alpha2); - - ath6kl_dbg(ATH6KL_DBG_WMI, "Country alpha2 being used: %c%c\n", - alpha2[0], alpha2[1]); - } -} - -static int ath6kl_wmi_disconnect_event_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - struct wmi_disconnect_event *ev; - wmi->traffic_class = 100; - - if (len < sizeof(struct wmi_disconnect_event)) - return -EINVAL; - - ev = (struct wmi_disconnect_event *) datap; - - ath6kl_dbg(ATH6KL_DBG_WMI, - "wmi event disconnect proto_reason %d bssid %pM wmi_reason %d assoc_resp_len %d\n", - le16_to_cpu(ev->proto_reason_status), ev->bssid, - ev->disconn_reason, ev->assoc_resp_len); - - wmi->is_wmm_enabled = false; - - ath6kl_disconnect_event(vif, ev->disconn_reason, - ev->bssid, ev->assoc_resp_len, ev->assoc_info, - le16_to_cpu(ev->proto_reason_status)); - - return 0; -} - -static int ath6kl_wmi_peer_node_event_rx(struct wmi *wmi, u8 *datap, int len) -{ - struct wmi_peer_node_event *ev; - - if (len < sizeof(struct wmi_peer_node_event)) - return -EINVAL; - - ev = (struct wmi_peer_node_event *) datap; - - if (ev->event_code == PEER_NODE_JOIN_EVENT) - ath6kl_dbg(ATH6KL_DBG_WMI, "joined node with mac addr: %pM\n", - ev->peer_mac_addr); - else if (ev->event_code == PEER_NODE_LEAVE_EVENT) - ath6kl_dbg(ATH6KL_DBG_WMI, "left node with mac addr: %pM\n", - ev->peer_mac_addr); - - return 0; -} - -static int ath6kl_wmi_tkip_micerr_event_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - struct wmi_tkip_micerr_event *ev; - - if (len < sizeof(struct wmi_tkip_micerr_event)) - return -EINVAL; - - ev = (struct wmi_tkip_micerr_event *) datap; - - ath6kl_tkip_micerr_event(vif, ev->key_id, ev->is_mcast); - - return 0; -} - -void ath6kl_wmi_sscan_timer(unsigned long ptr) -{ - struct ath6kl_vif *vif = (struct ath6kl_vif *) ptr; - - cfg80211_sched_scan_results(vif->ar->wiphy); -} - -static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - struct wmi_bss_info_hdr2 *bih; - u8 *buf; - struct ieee80211_channel *channel; - struct ath6kl *ar = wmi->parent_dev; - struct ieee80211_mgmt *mgmt; - struct cfg80211_bss *bss; - - if (len <= sizeof(struct wmi_bss_info_hdr2)) - return -EINVAL; - - bih = (struct wmi_bss_info_hdr2 *) datap; - buf = datap + sizeof(struct wmi_bss_info_hdr2); - len -= sizeof(struct wmi_bss_info_hdr2); - - ath6kl_dbg(ATH6KL_DBG_WMI, - "bss info evt - ch %u, snr %d, rssi %d, bssid \"%pM\" " - "frame_type=%d\n", - bih->ch, bih->snr, bih->snr - 95, bih->bssid, - bih->frame_type); - - if (bih->frame_type != BEACON_FTYPE && - bih->frame_type != PROBERESP_FTYPE) - return 0; /* Only update BSS table for now */ - - if (bih->frame_type == BEACON_FTYPE && - test_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags)) { - clear_bit(CLEAR_BSSFILTER_ON_BEACON, &vif->flags); - ath6kl_wmi_bssfilter_cmd(ar->wmi, vif->fw_vif_idx, - NONE_BSS_FILTER, 0); - } - - channel = ieee80211_get_channel(ar->wiphy, le16_to_cpu(bih->ch)); - if (channel == NULL) - return -EINVAL; - - if (len < 8 + 2 + 2) - return -EINVAL; - - if (bih->frame_type == BEACON_FTYPE && - test_bit(CONNECTED, &vif->flags) && - memcmp(bih->bssid, vif->bssid, ETH_ALEN) == 0) { - const u8 *tim; - tim = cfg80211_find_ie(WLAN_EID_TIM, buf + 8 + 2 + 2, - len - 8 - 2 - 2); - if (tim && tim[1] >= 2) { - vif->assoc_bss_dtim_period = tim[3]; - set_bit(DTIM_PERIOD_AVAIL, &vif->flags); - } - } - - /* - * In theory, use of cfg80211_inform_bss() would be more natural here - * since we do not have the full frame. However, at least for now, - * cfg80211 can only distinguish Beacon and Probe Response frames from - * each other when using cfg80211_inform_bss_frame(), so let's build a - * fake IEEE 802.11 header to be able to take benefit of this. - */ - mgmt = kmalloc(24 + len, GFP_ATOMIC); - if (mgmt == NULL) - return -EINVAL; - - if (bih->frame_type == BEACON_FTYPE) { - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_BEACON); - memset(mgmt->da, 0xff, ETH_ALEN); - } else { - struct net_device *dev = vif->ndev; - - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_PROBE_RESP); - memcpy(mgmt->da, dev->dev_addr, ETH_ALEN); - } - mgmt->duration = cpu_to_le16(0); - memcpy(mgmt->sa, bih->bssid, ETH_ALEN); - memcpy(mgmt->bssid, bih->bssid, ETH_ALEN); - mgmt->seq_ctrl = cpu_to_le16(0); - - memcpy(&mgmt->u.beacon, buf, len); - - bss = cfg80211_inform_bss_frame(ar->wiphy, channel, mgmt, - 24 + len, (bih->snr - 95) * 100, - GFP_ATOMIC); - kfree(mgmt); - if (bss == NULL) - return -ENOMEM; - cfg80211_put_bss(ar->wiphy, bss); - - /* - * Firmware doesn't return any event when scheduled scan has - * finished, so we need to use a timer to find out when there are - * no more results. - * - * The timer is started from the first bss info received, otherwise - * the timer would not ever fire if the scan interval is short - * enough. - */ - if (test_bit(SCHED_SCANNING, &vif->flags) && - !timer_pending(&vif->sched_scan_timer)) { - mod_timer(&vif->sched_scan_timer, jiffies + - msecs_to_jiffies(ATH6KL_SCHED_SCAN_RESULT_DELAY)); - } - - return 0; -} - -/* Inactivity timeout of a fatpipe(pstream) at the target */ -static int ath6kl_wmi_pstream_timeout_event_rx(struct wmi *wmi, u8 *datap, - int len) -{ - struct wmi_pstream_timeout_event *ev; - - if (len < sizeof(struct wmi_pstream_timeout_event)) - return -EINVAL; - - ev = (struct wmi_pstream_timeout_event *) datap; - - /* - * When the pstream (fat pipe == AC) timesout, it means there were - * no thinStreams within this pstream & it got implicitly created - * due to data flow on this AC. We start the inactivity timer only - * for implicitly created pstream. Just reset the host state. - */ - spin_lock_bh(&wmi->lock); - wmi->stream_exist_for_ac[ev->traffic_class] = 0; - wmi->fat_pipe_exist &= ~(1 << ev->traffic_class); - spin_unlock_bh(&wmi->lock); - - /* Indicate inactivity to driver layer for this fatpipe (pstream) */ - ath6kl_indicate_tx_activity(wmi->parent_dev, ev->traffic_class, false); - - return 0; -} - -static int ath6kl_wmi_bitrate_reply_rx(struct wmi *wmi, u8 *datap, int len) -{ - struct wmi_bit_rate_reply *reply; - s32 rate; - u32 sgi, index; - - if (len < sizeof(struct wmi_bit_rate_reply)) - return -EINVAL; - - reply = (struct wmi_bit_rate_reply *) datap; - - ath6kl_dbg(ATH6KL_DBG_WMI, "rateindex %d\n", reply->rate_index); - - if (reply->rate_index == (s8) RATE_AUTO) { - rate = RATE_AUTO; - } else { - index = reply->rate_index & 0x7f; - if (WARN_ON_ONCE(index > (RATE_MCS_7_40 + 1))) - return -EINVAL; - - sgi = (reply->rate_index & 0x80) ? 1 : 0; - rate = wmi_rate_tbl[index][sgi]; - } - - ath6kl_wakeup_event(wmi->parent_dev); - - return 0; -} - -static int ath6kl_wmi_test_rx(struct wmi *wmi, u8 *datap, int len) -{ - ath6kl_tm_rx_event(wmi->parent_dev, datap, len); - - return 0; -} - -static int ath6kl_wmi_ratemask_reply_rx(struct wmi *wmi, u8 *datap, int len) -{ - if (len < sizeof(struct wmi_fix_rates_reply)) - return -EINVAL; - - ath6kl_wakeup_event(wmi->parent_dev); - - return 0; -} - -static int ath6kl_wmi_ch_list_reply_rx(struct wmi *wmi, u8 *datap, int len) -{ - if (len < sizeof(struct wmi_channel_list_reply)) - return -EINVAL; - - ath6kl_wakeup_event(wmi->parent_dev); - - return 0; -} - -static int ath6kl_wmi_tx_pwr_reply_rx(struct wmi *wmi, u8 *datap, int len) -{ - struct wmi_tx_pwr_reply *reply; - - if (len < sizeof(struct wmi_tx_pwr_reply)) - return -EINVAL; - - reply = (struct wmi_tx_pwr_reply *) datap; - ath6kl_txpwr_rx_evt(wmi->parent_dev, reply->dbM); - - return 0; -} - -static int ath6kl_wmi_keepalive_reply_rx(struct wmi *wmi, u8 *datap, int len) -{ - if (len < sizeof(struct wmi_get_keepalive_cmd)) - return -EINVAL; - - ath6kl_wakeup_event(wmi->parent_dev); - - return 0; -} - -static int ath6kl_wmi_scan_complete_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - struct wmi_scan_complete_event *ev; - - ev = (struct wmi_scan_complete_event *) datap; - - ath6kl_scan_complete_evt(vif, a_sle32_to_cpu(ev->status)); - wmi->is_probe_ssid = false; - - return 0; -} - -static int ath6kl_wmi_neighbor_report_event_rx(struct wmi *wmi, u8 *datap, - int len, struct ath6kl_vif *vif) -{ - struct wmi_neighbor_report_event *ev; - u8 i; - - if (len < sizeof(*ev)) - return -EINVAL; - ev = (struct wmi_neighbor_report_event *) datap; - if (sizeof(*ev) + ev->num_neighbors * sizeof(struct wmi_neighbor_info) - > len) { - ath6kl_dbg(ATH6KL_DBG_WMI, - "truncated neighbor event (num=%d len=%d)\n", - ev->num_neighbors, len); - return -EINVAL; - } - for (i = 0; i < ev->num_neighbors; i++) { - ath6kl_dbg(ATH6KL_DBG_WMI, "neighbor %d/%d - %pM 0x%x\n", - i + 1, ev->num_neighbors, ev->neighbor[i].bssid, - ev->neighbor[i].bss_flags); - cfg80211_pmksa_candidate_notify(vif->ndev, i, - ev->neighbor[i].bssid, - !!(ev->neighbor[i].bss_flags & - WMI_PREAUTH_CAPABLE_BSS), - GFP_ATOMIC); - } - - return 0; -} - -/* - * Target is reporting a programming error. This is for - * developer aid only. Target only checks a few common violations - * and it is responsibility of host to do all error checking. - * Behavior of target after wmi error event is undefined. - * A reset is recommended. - */ -static int ath6kl_wmi_error_event_rx(struct wmi *wmi, u8 *datap, int len) -{ - const char *type = "unknown error"; - struct wmi_cmd_error_event *ev; - ev = (struct wmi_cmd_error_event *) datap; - - switch (ev->err_code) { - case INVALID_PARAM: - type = "invalid parameter"; - break; - case ILLEGAL_STATE: - type = "invalid state"; - break; - case INTERNAL_ERROR: - type = "internal error"; - break; - } - - ath6kl_dbg(ATH6KL_DBG_WMI, "programming error, cmd=%d %s\n", - ev->cmd_id, type); - - return 0; -} - -static int ath6kl_wmi_stats_event_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - ath6kl_tgt_stats_event(vif, datap, len); - - return 0; -} - -static u8 ath6kl_wmi_get_upper_threshold(s16 rssi, - struct sq_threshold_params *sq_thresh, - u32 size) -{ - u32 index; - u8 threshold = (u8) sq_thresh->upper_threshold[size - 1]; - - /* The list is already in sorted order. Get the next lower value */ - for (index = 0; index < size; index++) { - if (rssi < sq_thresh->upper_threshold[index]) { - threshold = (u8) sq_thresh->upper_threshold[index]; - break; - } - } - - return threshold; -} - -static u8 ath6kl_wmi_get_lower_threshold(s16 rssi, - struct sq_threshold_params *sq_thresh, - u32 size) -{ - u32 index; - u8 threshold = (u8) sq_thresh->lower_threshold[size - 1]; - - /* The list is already in sorted order. Get the next lower value */ - for (index = 0; index < size; index++) { - if (rssi > sq_thresh->lower_threshold[index]) { - threshold = (u8) sq_thresh->lower_threshold[index]; - break; - } - } - - return threshold; -} - -static int ath6kl_wmi_send_rssi_threshold_params(struct wmi *wmi, - struct wmi_rssi_threshold_params_cmd *rssi_cmd) -{ - struct sk_buff *skb; - struct wmi_rssi_threshold_params_cmd *cmd; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_rssi_threshold_params_cmd *) skb->data; - memcpy(cmd, rssi_cmd, sizeof(struct wmi_rssi_threshold_params_cmd)); - - return ath6kl_wmi_cmd_send(wmi, 0, skb, WMI_RSSI_THRESHOLD_PARAMS_CMDID, - NO_SYNC_WMIFLAG); -} - -static int ath6kl_wmi_rssi_threshold_event_rx(struct wmi *wmi, u8 *datap, - int len) -{ - struct wmi_rssi_threshold_event *reply; - struct wmi_rssi_threshold_params_cmd cmd; - struct sq_threshold_params *sq_thresh; - enum wmi_rssi_threshold_val new_threshold; - u8 upper_rssi_threshold, lower_rssi_threshold; - s16 rssi; - int ret; - - if (len < sizeof(struct wmi_rssi_threshold_event)) - return -EINVAL; - - reply = (struct wmi_rssi_threshold_event *) datap; - new_threshold = (enum wmi_rssi_threshold_val) reply->range; - rssi = a_sle16_to_cpu(reply->rssi); - - sq_thresh = &wmi->sq_threshld[SIGNAL_QUALITY_METRICS_RSSI]; - - /* - * Identify the threshold breached and communicate that to the app. - * After that install a new set of thresholds based on the signal - * quality reported by the target - */ - if (new_threshold) { - /* Upper threshold breached */ - if (rssi < sq_thresh->upper_threshold[0]) { - ath6kl_dbg(ATH6KL_DBG_WMI, - "spurious upper rssi threshold event: %d\n", - rssi); - } else if ((rssi < sq_thresh->upper_threshold[1]) && - (rssi >= sq_thresh->upper_threshold[0])) { - new_threshold = WMI_RSSI_THRESHOLD1_ABOVE; - } else if ((rssi < sq_thresh->upper_threshold[2]) && - (rssi >= sq_thresh->upper_threshold[1])) { - new_threshold = WMI_RSSI_THRESHOLD2_ABOVE; - } else if ((rssi < sq_thresh->upper_threshold[3]) && - (rssi >= sq_thresh->upper_threshold[2])) { - new_threshold = WMI_RSSI_THRESHOLD3_ABOVE; - } else if ((rssi < sq_thresh->upper_threshold[4]) && - (rssi >= sq_thresh->upper_threshold[3])) { - new_threshold = WMI_RSSI_THRESHOLD4_ABOVE; - } else if ((rssi < sq_thresh->upper_threshold[5]) && - (rssi >= sq_thresh->upper_threshold[4])) { - new_threshold = WMI_RSSI_THRESHOLD5_ABOVE; - } else if (rssi >= sq_thresh->upper_threshold[5]) { - new_threshold = WMI_RSSI_THRESHOLD6_ABOVE; - } - } else { - /* Lower threshold breached */ - if (rssi > sq_thresh->lower_threshold[0]) { - ath6kl_dbg(ATH6KL_DBG_WMI, - "spurious lower rssi threshold event: %d %d\n", - rssi, sq_thresh->lower_threshold[0]); - } else if ((rssi > sq_thresh->lower_threshold[1]) && - (rssi <= sq_thresh->lower_threshold[0])) { - new_threshold = WMI_RSSI_THRESHOLD6_BELOW; - } else if ((rssi > sq_thresh->lower_threshold[2]) && - (rssi <= sq_thresh->lower_threshold[1])) { - new_threshold = WMI_RSSI_THRESHOLD5_BELOW; - } else if ((rssi > sq_thresh->lower_threshold[3]) && - (rssi <= sq_thresh->lower_threshold[2])) { - new_threshold = WMI_RSSI_THRESHOLD4_BELOW; - } else if ((rssi > sq_thresh->lower_threshold[4]) && - (rssi <= sq_thresh->lower_threshold[3])) { - new_threshold = WMI_RSSI_THRESHOLD3_BELOW; - } else if ((rssi > sq_thresh->lower_threshold[5]) && - (rssi <= sq_thresh->lower_threshold[4])) { - new_threshold = WMI_RSSI_THRESHOLD2_BELOW; - } else if (rssi <= sq_thresh->lower_threshold[5]) { - new_threshold = WMI_RSSI_THRESHOLD1_BELOW; - } - } - - /* Calculate and install the next set of thresholds */ - lower_rssi_threshold = ath6kl_wmi_get_lower_threshold(rssi, sq_thresh, - sq_thresh->lower_threshold_valid_count); - upper_rssi_threshold = ath6kl_wmi_get_upper_threshold(rssi, sq_thresh, - sq_thresh->upper_threshold_valid_count); - - /* Issue a wmi command to install the thresholds */ - cmd.thresh_above1_val = a_cpu_to_sle16(upper_rssi_threshold); - cmd.thresh_below1_val = a_cpu_to_sle16(lower_rssi_threshold); - cmd.weight = sq_thresh->weight; - cmd.poll_time = cpu_to_le32(sq_thresh->polling_interval); - - ret = ath6kl_wmi_send_rssi_threshold_params(wmi, &cmd); - if (ret) { - ath6kl_err("unable to configure rssi thresholds\n"); - return -EIO; - } - - return 0; -} - -static int ath6kl_wmi_cac_event_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - struct wmi_cac_event *reply; - struct ieee80211_tspec_ie *ts; - u16 active_tsids, tsinfo; - u8 tsid, index; - u8 ts_id; - - if (len < sizeof(struct wmi_cac_event)) - return -EINVAL; - - reply = (struct wmi_cac_event *) datap; - - if ((reply->cac_indication == CAC_INDICATION_ADMISSION_RESP) && - (reply->status_code != IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED)) { - - ts = (struct ieee80211_tspec_ie *) &(reply->tspec_suggestion); - tsinfo = le16_to_cpu(ts->tsinfo); - tsid = (tsinfo >> IEEE80211_WMM_IE_TSPEC_TID_SHIFT) & - IEEE80211_WMM_IE_TSPEC_TID_MASK; - - ath6kl_wmi_delete_pstream_cmd(wmi, vif->fw_vif_idx, - reply->ac, tsid); - } else if (reply->cac_indication == CAC_INDICATION_NO_RESP) { - /* - * Following assumes that there is only one outstanding - * ADDTS request when this event is received - */ - spin_lock_bh(&wmi->lock); - active_tsids = wmi->stream_exist_for_ac[reply->ac]; - spin_unlock_bh(&wmi->lock); - - for (index = 0; index < sizeof(active_tsids) * 8; index++) { - if ((active_tsids >> index) & 1) - break; - } - if (index < (sizeof(active_tsids) * 8)) - ath6kl_wmi_delete_pstream_cmd(wmi, vif->fw_vif_idx, - reply->ac, index); - } - - /* - * Clear active tsids and Add missing handling - * for delete qos stream from AP - */ - else if (reply->cac_indication == CAC_INDICATION_DELETE) { - - ts = (struct ieee80211_tspec_ie *) &(reply->tspec_suggestion); - tsinfo = le16_to_cpu(ts->tsinfo); - ts_id = ((tsinfo >> IEEE80211_WMM_IE_TSPEC_TID_SHIFT) & - IEEE80211_WMM_IE_TSPEC_TID_MASK); - - spin_lock_bh(&wmi->lock); - wmi->stream_exist_for_ac[reply->ac] &= ~(1 << ts_id); - active_tsids = wmi->stream_exist_for_ac[reply->ac]; - spin_unlock_bh(&wmi->lock); - - /* Indicate stream inactivity to driver layer only if all tsids - * within this AC are deleted. - */ - if (!active_tsids) { - ath6kl_indicate_tx_activity(wmi->parent_dev, reply->ac, - false); - wmi->fat_pipe_exist &= ~(1 << reply->ac); - } - } - - return 0; -} - -static int ath6kl_wmi_txe_notify_event_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - struct wmi_txe_notify_event *ev; - u32 rate, pkts; - - if (len < sizeof(*ev)) - return -EINVAL; - - if (vif->sme_state != SME_CONNECTED) - return -ENOTCONN; - - ev = (struct wmi_txe_notify_event *) datap; - rate = le32_to_cpu(ev->rate); - pkts = le32_to_cpu(ev->pkts); - - ath6kl_dbg(ATH6KL_DBG_WMI, "TXE notify event: peer %pM rate %d% pkts %d intvl %ds\n", - vif->bssid, rate, pkts, vif->txe_intvl); - - cfg80211_cqm_txe_notify(vif->ndev, vif->bssid, pkts, - rate, vif->txe_intvl, GFP_KERNEL); - - return 0; -} - -int ath6kl_wmi_set_txe_notify(struct wmi *wmi, u8 idx, - u32 rate, u32 pkts, u32 intvl) -{ - struct sk_buff *skb; - struct wmi_txe_notify_cmd *cmd; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_txe_notify_cmd *) skb->data; - cmd->rate = cpu_to_le32(rate); - cmd->pkts = cpu_to_le32(pkts); - cmd->intvl = cpu_to_le32(intvl); - - return ath6kl_wmi_cmd_send(wmi, idx, skb, WMI_SET_TXE_NOTIFY_CMDID, - NO_SYNC_WMIFLAG); -} - -int ath6kl_wmi_set_rssi_filter_cmd(struct wmi *wmi, u8 if_idx, s8 rssi) -{ - struct sk_buff *skb; - struct wmi_set_rssi_filter_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_set_rssi_filter_cmd *) skb->data; - cmd->rssi = rssi; - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_RSSI_FILTER_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -static int ath6kl_wmi_send_snr_threshold_params(struct wmi *wmi, - struct wmi_snr_threshold_params_cmd *snr_cmd) -{ - struct sk_buff *skb; - struct wmi_snr_threshold_params_cmd *cmd; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_snr_threshold_params_cmd *) skb->data; - memcpy(cmd, snr_cmd, sizeof(struct wmi_snr_threshold_params_cmd)); - - return ath6kl_wmi_cmd_send(wmi, 0, skb, WMI_SNR_THRESHOLD_PARAMS_CMDID, - NO_SYNC_WMIFLAG); -} - -static int ath6kl_wmi_snr_threshold_event_rx(struct wmi *wmi, u8 *datap, - int len) -{ - struct wmi_snr_threshold_event *reply; - struct sq_threshold_params *sq_thresh; - struct wmi_snr_threshold_params_cmd cmd; - enum wmi_snr_threshold_val new_threshold; - u8 upper_snr_threshold, lower_snr_threshold; - s16 snr; - int ret; - - if (len < sizeof(struct wmi_snr_threshold_event)) - return -EINVAL; - - reply = (struct wmi_snr_threshold_event *) datap; - - new_threshold = (enum wmi_snr_threshold_val) reply->range; - snr = reply->snr; - - sq_thresh = &wmi->sq_threshld[SIGNAL_QUALITY_METRICS_SNR]; - - /* - * Identify the threshold breached and communicate that to the app. - * After that install a new set of thresholds based on the signal - * quality reported by the target. - */ - if (new_threshold) { - /* Upper threshold breached */ - if (snr < sq_thresh->upper_threshold[0]) { - ath6kl_dbg(ATH6KL_DBG_WMI, - "spurious upper snr threshold event: %d\n", - snr); - } else if ((snr < sq_thresh->upper_threshold[1]) && - (snr >= sq_thresh->upper_threshold[0])) { - new_threshold = WMI_SNR_THRESHOLD1_ABOVE; - } else if ((snr < sq_thresh->upper_threshold[2]) && - (snr >= sq_thresh->upper_threshold[1])) { - new_threshold = WMI_SNR_THRESHOLD2_ABOVE; - } else if ((snr < sq_thresh->upper_threshold[3]) && - (snr >= sq_thresh->upper_threshold[2])) { - new_threshold = WMI_SNR_THRESHOLD3_ABOVE; - } else if (snr >= sq_thresh->upper_threshold[3]) { - new_threshold = WMI_SNR_THRESHOLD4_ABOVE; - } - } else { - /* Lower threshold breached */ - if (snr > sq_thresh->lower_threshold[0]) { - ath6kl_dbg(ATH6KL_DBG_WMI, - "spurious lower snr threshold event: %d\n", - sq_thresh->lower_threshold[0]); - } else if ((snr > sq_thresh->lower_threshold[1]) && - (snr <= sq_thresh->lower_threshold[0])) { - new_threshold = WMI_SNR_THRESHOLD4_BELOW; - } else if ((snr > sq_thresh->lower_threshold[2]) && - (snr <= sq_thresh->lower_threshold[1])) { - new_threshold = WMI_SNR_THRESHOLD3_BELOW; - } else if ((snr > sq_thresh->lower_threshold[3]) && - (snr <= sq_thresh->lower_threshold[2])) { - new_threshold = WMI_SNR_THRESHOLD2_BELOW; - } else if (snr <= sq_thresh->lower_threshold[3]) { - new_threshold = WMI_SNR_THRESHOLD1_BELOW; - } - } - - /* Calculate and install the next set of thresholds */ - lower_snr_threshold = ath6kl_wmi_get_lower_threshold(snr, sq_thresh, - sq_thresh->lower_threshold_valid_count); - upper_snr_threshold = ath6kl_wmi_get_upper_threshold(snr, sq_thresh, - sq_thresh->upper_threshold_valid_count); - - /* Issue a wmi command to install the thresholds */ - cmd.thresh_above1_val = upper_snr_threshold; - cmd.thresh_below1_val = lower_snr_threshold; - cmd.weight = sq_thresh->weight; - cmd.poll_time = cpu_to_le32(sq_thresh->polling_interval); - - ath6kl_dbg(ATH6KL_DBG_WMI, - "snr: %d, threshold: %d, lower: %d, upper: %d\n", - snr, new_threshold, - lower_snr_threshold, upper_snr_threshold); - - ret = ath6kl_wmi_send_snr_threshold_params(wmi, &cmd); - if (ret) { - ath6kl_err("unable to configure snr threshold\n"); - return -EIO; - } - - return 0; -} - -static int ath6kl_wmi_aplist_event_rx(struct wmi *wmi, u8 *datap, int len) -{ - u16 ap_info_entry_size; - struct wmi_aplist_event *ev = (struct wmi_aplist_event *) datap; - struct wmi_ap_info_v1 *ap_info_v1; - u8 index; - - if (len < sizeof(struct wmi_aplist_event) || - ev->ap_list_ver != APLIST_VER1) - return -EINVAL; - - ap_info_entry_size = sizeof(struct wmi_ap_info_v1); - ap_info_v1 = (struct wmi_ap_info_v1 *) ev->ap_list; - - ath6kl_dbg(ATH6KL_DBG_WMI, - "number of APs in aplist event: %d\n", ev->num_ap); - - if (len < (int) (sizeof(struct wmi_aplist_event) + - (ev->num_ap - 1) * ap_info_entry_size)) - return -EINVAL; - - /* AP list version 1 contents */ - for (index = 0; index < ev->num_ap; index++) { - ath6kl_dbg(ATH6KL_DBG_WMI, "AP#%d BSSID %pM Channel %d\n", - index, ap_info_v1->bssid, ap_info_v1->channel); - ap_info_v1++; - } - - return 0; -} - -int ath6kl_wmi_cmd_send(struct wmi *wmi, u8 if_idx, struct sk_buff *skb, - enum wmi_cmd_id cmd_id, enum wmi_sync_flag sync_flag) -{ - struct wmi_cmd_hdr *cmd_hdr; - enum htc_endpoint_id ep_id = wmi->ep_id; - int ret; - u16 info1; - - if (WARN_ON(skb == NULL || - (if_idx > (wmi->parent_dev->vif_max - 1)))) { - dev_kfree_skb(skb); - return -EINVAL; - } - - ath6kl_dbg(ATH6KL_DBG_WMI, "wmi tx id %d len %d flag %d\n", - cmd_id, skb->len, sync_flag); - ath6kl_dbg_dump(ATH6KL_DBG_WMI_DUMP, NULL, "wmi tx ", - skb->data, skb->len); - - if (sync_flag >= END_WMIFLAG) { - dev_kfree_skb(skb); - return -EINVAL; - } - - if ((sync_flag == SYNC_BEFORE_WMIFLAG) || - (sync_flag == SYNC_BOTH_WMIFLAG)) { - /* - * Make sure all data currently queued is transmitted before - * the cmd execution. Establish a new sync point. - */ - ath6kl_wmi_sync_point(wmi, if_idx); - } - - skb_push(skb, sizeof(struct wmi_cmd_hdr)); - - cmd_hdr = (struct wmi_cmd_hdr *) skb->data; - cmd_hdr->cmd_id = cpu_to_le16(cmd_id); - info1 = if_idx & WMI_CMD_HDR_IF_ID_MASK; - cmd_hdr->info1 = cpu_to_le16(info1); - - /* Only for OPT_TX_CMD, use BE endpoint. */ - if (cmd_id == WMI_OPT_TX_FRAME_CMDID) { - ret = ath6kl_wmi_data_hdr_add(wmi, skb, OPT_MSGTYPE, - false, false, 0, NULL, if_idx); - if (ret) { - dev_kfree_skb(skb); - return ret; - } - ep_id = ath6kl_ac2_endpoint_id(wmi->parent_dev, WMM_AC_BE); - } - - ath6kl_control_tx(wmi->parent_dev, skb, ep_id); - - if ((sync_flag == SYNC_AFTER_WMIFLAG) || - (sync_flag == SYNC_BOTH_WMIFLAG)) { - /* - * Make sure all new data queued waits for the command to - * execute. Establish a new sync point. - */ - ath6kl_wmi_sync_point(wmi, if_idx); - } - - return 0; -} - -int ath6kl_wmi_connect_cmd(struct wmi *wmi, u8 if_idx, - enum network_type nw_type, - enum dot11_auth_mode dot11_auth_mode, - enum auth_mode auth_mode, - enum crypto_type pairwise_crypto, - u8 pairwise_crypto_len, - enum crypto_type group_crypto, - u8 group_crypto_len, int ssid_len, u8 *ssid, - u8 *bssid, u16 channel, u32 ctrl_flags, - u8 nw_subtype) -{ - struct sk_buff *skb; - struct wmi_connect_cmd *cc; - int ret; - - ath6kl_dbg(ATH6KL_DBG_WMI, - "wmi connect bssid %pM freq %d flags 0x%x ssid_len %d " - "type %d dot11_auth %d auth %d pairwise %d group %d\n", - bssid, channel, ctrl_flags, ssid_len, nw_type, - dot11_auth_mode, auth_mode, pairwise_crypto, group_crypto); - ath6kl_dbg_dump(ATH6KL_DBG_WMI, NULL, "ssid ", ssid, ssid_len); - - wmi->traffic_class = 100; - - if ((pairwise_crypto == NONE_CRYPT) && (group_crypto != NONE_CRYPT)) - return -EINVAL; - - if ((pairwise_crypto != NONE_CRYPT) && (group_crypto == NONE_CRYPT)) - return -EINVAL; - - skb = ath6kl_wmi_get_new_buf(sizeof(struct wmi_connect_cmd)); - if (!skb) - return -ENOMEM; - - cc = (struct wmi_connect_cmd *) skb->data; - - if (ssid_len) - memcpy(cc->ssid, ssid, ssid_len); - - cc->ssid_len = ssid_len; - cc->nw_type = nw_type; - cc->dot11_auth_mode = dot11_auth_mode; - cc->auth_mode = auth_mode; - cc->prwise_crypto_type = pairwise_crypto; - cc->prwise_crypto_len = pairwise_crypto_len; - cc->grp_crypto_type = group_crypto; - cc->grp_crypto_len = group_crypto_len; - cc->ch = cpu_to_le16(channel); - cc->ctrl_flags = cpu_to_le32(ctrl_flags); - cc->nw_subtype = nw_subtype; - - if (bssid != NULL) - memcpy(cc->bssid, bssid, ETH_ALEN); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_CONNECT_CMDID, - NO_SYNC_WMIFLAG); - - return ret; -} - -int ath6kl_wmi_reconnect_cmd(struct wmi *wmi, u8 if_idx, u8 *bssid, - u16 channel) -{ - struct sk_buff *skb; - struct wmi_reconnect_cmd *cc; - int ret; - - ath6kl_dbg(ATH6KL_DBG_WMI, "wmi reconnect bssid %pM freq %d\n", - bssid, channel); - - wmi->traffic_class = 100; - - skb = ath6kl_wmi_get_new_buf(sizeof(struct wmi_reconnect_cmd)); - if (!skb) - return -ENOMEM; - - cc = (struct wmi_reconnect_cmd *) skb->data; - cc->channel = cpu_to_le16(channel); - - if (bssid != NULL) - memcpy(cc->bssid, bssid, ETH_ALEN); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_RECONNECT_CMDID, - NO_SYNC_WMIFLAG); - - return ret; -} - -int ath6kl_wmi_disconnect_cmd(struct wmi *wmi, u8 if_idx) -{ - int ret; - - ath6kl_dbg(ATH6KL_DBG_WMI, "wmi disconnect\n"); - - wmi->traffic_class = 100; - - /* Disconnect command does not need to do a SYNC before. */ - ret = ath6kl_wmi_simple_cmd(wmi, if_idx, WMI_DISCONNECT_CMDID); - - return ret; -} - -/* ath6kl_wmi_start_scan_cmd is to be deprecated. Use - * ath6kl_wmi_begin_scan_cmd instead. The new function supports P2P - * mgmt operations using station interface. - */ -static int ath6kl_wmi_startscan_cmd(struct wmi *wmi, u8 if_idx, - enum wmi_scan_type scan_type, - u32 force_fgscan, u32 is_legacy, - u32 home_dwell_time, - u32 force_scan_interval, - s8 num_chan, u16 *ch_list) -{ - struct sk_buff *skb; - struct wmi_start_scan_cmd *sc; - s8 size; - int i, ret; - - size = sizeof(struct wmi_start_scan_cmd); - - if ((scan_type != WMI_LONG_SCAN) && (scan_type != WMI_SHORT_SCAN)) - return -EINVAL; - - if (num_chan > WMI_MAX_CHANNELS) - return -EINVAL; - - if (num_chan) - size += sizeof(u16) * (num_chan - 1); - - skb = ath6kl_wmi_get_new_buf(size); - if (!skb) - return -ENOMEM; - - sc = (struct wmi_start_scan_cmd *) skb->data; - sc->scan_type = scan_type; - sc->force_fg_scan = cpu_to_le32(force_fgscan); - sc->is_legacy = cpu_to_le32(is_legacy); - sc->home_dwell_time = cpu_to_le32(home_dwell_time); - sc->force_scan_intvl = cpu_to_le32(force_scan_interval); - sc->num_ch = num_chan; - - for (i = 0; i < num_chan; i++) - sc->ch_list[i] = cpu_to_le16(ch_list[i]); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_START_SCAN_CMDID, - NO_SYNC_WMIFLAG); - - return ret; -} - -/* - * beginscan supports (compared to old startscan) P2P mgmt operations using - * station interface, send additional information like supported rates to - * advertise and xmit rates for probe requests - */ -int ath6kl_wmi_beginscan_cmd(struct wmi *wmi, u8 if_idx, - enum wmi_scan_type scan_type, - u32 force_fgscan, u32 is_legacy, - u32 home_dwell_time, u32 force_scan_interval, - s8 num_chan, u16 *ch_list, u32 no_cck, u32 *rates) -{ - struct ieee80211_supported_band *sband; - struct sk_buff *skb; - struct wmi_begin_scan_cmd *sc; - s8 size, *supp_rates; - int i, band, ret; - struct ath6kl *ar = wmi->parent_dev; - int num_rates; - u32 ratemask; - - if (!test_bit(ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX, - ar->fw_capabilities)) { - return ath6kl_wmi_startscan_cmd(wmi, if_idx, - scan_type, force_fgscan, - is_legacy, home_dwell_time, - force_scan_interval, - num_chan, ch_list); - } - - size = sizeof(struct wmi_begin_scan_cmd); - - if ((scan_type != WMI_LONG_SCAN) && (scan_type != WMI_SHORT_SCAN)) - return -EINVAL; - - if (num_chan > WMI_MAX_CHANNELS) - return -EINVAL; - - if (num_chan) - size += sizeof(u16) * (num_chan - 1); - - skb = ath6kl_wmi_get_new_buf(size); - if (!skb) - return -ENOMEM; - - sc = (struct wmi_begin_scan_cmd *) skb->data; - sc->scan_type = scan_type; - sc->force_fg_scan = cpu_to_le32(force_fgscan); - sc->is_legacy = cpu_to_le32(is_legacy); - sc->home_dwell_time = cpu_to_le32(home_dwell_time); - sc->force_scan_intvl = cpu_to_le32(force_scan_interval); - sc->no_cck = cpu_to_le32(no_cck); - sc->num_ch = num_chan; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - sband = ar->wiphy->bands[band]; - - if (!sband) - continue; - - if (WARN_ON(band >= ATH6KL_NUM_BANDS)) - break; - - ratemask = rates[band]; - supp_rates = sc->supp_rates[band].rates; - num_rates = 0; - - for (i = 0; i < sband->n_bitrates; i++) { - if ((BIT(i) & ratemask) == 0) - continue; /* skip rate */ - supp_rates[num_rates++] = - (u8) (sband->bitrates[i].bitrate / 5); - } - sc->supp_rates[band].nrates = num_rates; - } - - for (i = 0; i < num_chan; i++) - sc->ch_list[i] = cpu_to_le16(ch_list[i]); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_BEGIN_SCAN_CMDID, - NO_SYNC_WMIFLAG); - - return ret; -} - -int ath6kl_wmi_enable_sched_scan_cmd(struct wmi *wmi, u8 if_idx, bool enable) -{ - struct sk_buff *skb; - struct wmi_enable_sched_scan_cmd *sc; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*sc)); - if (!skb) - return -ENOMEM; - - ath6kl_dbg(ATH6KL_DBG_WMI, "%s scheduled scan on vif %d\n", - enable ? "enabling" : "disabling", if_idx); - sc = (struct wmi_enable_sched_scan_cmd *) skb->data; - sc->enable = enable ? 1 : 0; - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, - WMI_ENABLE_SCHED_SCAN_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_scanparams_cmd(struct wmi *wmi, u8 if_idx, - u16 fg_start_sec, - u16 fg_end_sec, u16 bg_sec, - u16 minact_chdw_msec, u16 maxact_chdw_msec, - u16 pas_chdw_msec, u8 short_scan_ratio, - u8 scan_ctrl_flag, u32 max_dfsch_act_time, - u16 maxact_scan_per_ssid) -{ - struct sk_buff *skb; - struct wmi_scan_params_cmd *sc; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*sc)); - if (!skb) - return -ENOMEM; - - sc = (struct wmi_scan_params_cmd *) skb->data; - sc->fg_start_period = cpu_to_le16(fg_start_sec); - sc->fg_end_period = cpu_to_le16(fg_end_sec); - sc->bg_period = cpu_to_le16(bg_sec); - sc->minact_chdwell_time = cpu_to_le16(minact_chdw_msec); - sc->maxact_chdwell_time = cpu_to_le16(maxact_chdw_msec); - sc->pas_chdwell_time = cpu_to_le16(pas_chdw_msec); - sc->short_scan_ratio = short_scan_ratio; - sc->scan_ctrl_flags = scan_ctrl_flag; - sc->max_dfsch_act_time = cpu_to_le32(max_dfsch_act_time); - sc->maxact_scan_per_ssid = cpu_to_le16(maxact_scan_per_ssid); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_SCAN_PARAMS_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_bssfilter_cmd(struct wmi *wmi, u8 if_idx, u8 filter, u32 ie_mask) -{ - struct sk_buff *skb; - struct wmi_bss_filter_cmd *cmd; - int ret; - - if (filter >= LAST_BSS_FILTER) - return -EINVAL; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_bss_filter_cmd *) skb->data; - cmd->bss_filter = filter; - cmd->ie_mask = cpu_to_le32(ie_mask); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_BSS_FILTER_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_probedssid_cmd(struct wmi *wmi, u8 if_idx, u8 index, u8 flag, - u8 ssid_len, u8 *ssid) -{ - struct sk_buff *skb; - struct wmi_probed_ssid_cmd *cmd; - int ret; - - if (index >= MAX_PROBED_SSIDS) - return -EINVAL; - - if (ssid_len > sizeof(cmd->ssid)) - return -EINVAL; - - if ((flag & (DISABLE_SSID_FLAG | ANY_SSID_FLAG)) && (ssid_len > 0)) - return -EINVAL; - - if ((flag & SPECIFIC_SSID_FLAG) && !ssid_len) - return -EINVAL; - - if (flag & SPECIFIC_SSID_FLAG) - wmi->is_probe_ssid = true; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_probed_ssid_cmd *) skb->data; - cmd->entry_index = index; - cmd->flag = flag; - cmd->ssid_len = ssid_len; - memcpy(cmd->ssid, ssid, ssid_len); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_PROBED_SSID_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_listeninterval_cmd(struct wmi *wmi, u8 if_idx, - u16 listen_interval, - u16 listen_beacons) -{ - struct sk_buff *skb; - struct wmi_listen_int_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_listen_int_cmd *) skb->data; - cmd->listen_intvl = cpu_to_le16(listen_interval); - cmd->num_beacons = cpu_to_le16(listen_beacons); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_LISTEN_INT_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_bmisstime_cmd(struct wmi *wmi, u8 if_idx, - u16 bmiss_time, u16 num_beacons) -{ - struct sk_buff *skb; - struct wmi_bmiss_time_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_bmiss_time_cmd *) skb->data; - cmd->bmiss_time = cpu_to_le16(bmiss_time); - cmd->num_beacons = cpu_to_le16(num_beacons); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_BMISS_TIME_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_powermode_cmd(struct wmi *wmi, u8 if_idx, u8 pwr_mode) -{ - struct sk_buff *skb; - struct wmi_power_mode_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_power_mode_cmd *) skb->data; - cmd->pwr_mode = pwr_mode; - wmi->pwr_mode = pwr_mode; - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_POWER_MODE_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_pmparams_cmd(struct wmi *wmi, u8 if_idx, u16 idle_period, - u16 ps_poll_num, u16 dtim_policy, - u16 tx_wakeup_policy, u16 num_tx_to_wakeup, - u16 ps_fail_event_policy) -{ - struct sk_buff *skb; - struct wmi_power_params_cmd *pm; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*pm)); - if (!skb) - return -ENOMEM; - - pm = (struct wmi_power_params_cmd *)skb->data; - pm->idle_period = cpu_to_le16(idle_period); - pm->pspoll_number = cpu_to_le16(ps_poll_num); - pm->dtim_policy = cpu_to_le16(dtim_policy); - pm->tx_wakeup_policy = cpu_to_le16(tx_wakeup_policy); - pm->num_tx_to_wakeup = cpu_to_le16(num_tx_to_wakeup); - pm->ps_fail_event_policy = cpu_to_le16(ps_fail_event_policy); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_POWER_PARAMS_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_disctimeout_cmd(struct wmi *wmi, u8 if_idx, u8 timeout) -{ - struct sk_buff *skb; - struct wmi_disc_timeout_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_disc_timeout_cmd *) skb->data; - cmd->discon_timeout = timeout; - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_DISC_TIMEOUT_CMDID, - NO_SYNC_WMIFLAG); - - if (ret == 0) - ath6kl_debug_set_disconnect_timeout(wmi->parent_dev, timeout); - - return ret; -} - -int ath6kl_wmi_addkey_cmd(struct wmi *wmi, u8 if_idx, u8 key_index, - enum crypto_type key_type, - u8 key_usage, u8 key_len, - u8 *key_rsc, unsigned int key_rsc_len, - u8 *key_material, - u8 key_op_ctrl, u8 *mac_addr, - enum wmi_sync_flag sync_flag) -{ - struct sk_buff *skb; - struct wmi_add_cipher_key_cmd *cmd; - int ret; - - ath6kl_dbg(ATH6KL_DBG_WMI, - "addkey cmd: key_index=%u key_type=%d key_usage=%d key_len=%d key_op_ctrl=%d\n", - key_index, key_type, key_usage, key_len, key_op_ctrl); - - if ((key_index > WMI_MAX_KEY_INDEX) || (key_len > WMI_MAX_KEY_LEN) || - (key_material == NULL) || key_rsc_len > 8) - return -EINVAL; - - if ((WEP_CRYPT != key_type) && (NULL == key_rsc)) - return -EINVAL; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_add_cipher_key_cmd *) skb->data; - cmd->key_index = key_index; - cmd->key_type = key_type; - cmd->key_usage = key_usage; - cmd->key_len = key_len; - memcpy(cmd->key, key_material, key_len); - - if (key_rsc != NULL) - memcpy(cmd->key_rsc, key_rsc, key_rsc_len); - - cmd->key_op_ctrl = key_op_ctrl; - - if (mac_addr) - memcpy(cmd->key_mac_addr, mac_addr, ETH_ALEN); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_ADD_CIPHER_KEY_CMDID, - sync_flag); - - return ret; -} - -int ath6kl_wmi_add_krk_cmd(struct wmi *wmi, u8 if_idx, u8 *krk) -{ - struct sk_buff *skb; - struct wmi_add_krk_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_add_krk_cmd *) skb->data; - memcpy(cmd->krk, krk, WMI_KRK_LEN); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_ADD_KRK_CMDID, - NO_SYNC_WMIFLAG); - - return ret; -} - -int ath6kl_wmi_deletekey_cmd(struct wmi *wmi, u8 if_idx, u8 key_index) -{ - struct sk_buff *skb; - struct wmi_delete_cipher_key_cmd *cmd; - int ret; - - if (key_index > WMI_MAX_KEY_INDEX) - return -EINVAL; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_delete_cipher_key_cmd *) skb->data; - cmd->key_index = key_index; - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_DELETE_CIPHER_KEY_CMDID, - NO_SYNC_WMIFLAG); - - return ret; -} - -int ath6kl_wmi_setpmkid_cmd(struct wmi *wmi, u8 if_idx, const u8 *bssid, - const u8 *pmkid, bool set) -{ - struct sk_buff *skb; - struct wmi_setpmkid_cmd *cmd; - int ret; - - if (bssid == NULL) - return -EINVAL; - - if (set && pmkid == NULL) - return -EINVAL; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_setpmkid_cmd *) skb->data; - memcpy(cmd->bssid, bssid, ETH_ALEN); - if (set) { - memcpy(cmd->pmkid, pmkid, sizeof(cmd->pmkid)); - cmd->enable = PMKID_ENABLE; - } else { - memset(cmd->pmkid, 0, sizeof(cmd->pmkid)); - cmd->enable = PMKID_DISABLE; - } - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_PMKID_CMDID, - NO_SYNC_WMIFLAG); - - return ret; -} - -static int ath6kl_wmi_data_sync_send(struct wmi *wmi, struct sk_buff *skb, - enum htc_endpoint_id ep_id, u8 if_idx) -{ - struct wmi_data_hdr *data_hdr; - int ret; - - if (WARN_ON(skb == NULL || ep_id == wmi->ep_id)) { - dev_kfree_skb(skb); - return -EINVAL; - } - - skb_push(skb, sizeof(struct wmi_data_hdr)); - - data_hdr = (struct wmi_data_hdr *) skb->data; - data_hdr->info = SYNC_MSGTYPE << WMI_DATA_HDR_MSG_TYPE_SHIFT; - data_hdr->info3 = cpu_to_le16(if_idx & WMI_DATA_HDR_IF_IDX_MASK); - - ret = ath6kl_control_tx(wmi->parent_dev, skb, ep_id); - - return ret; -} - -static int ath6kl_wmi_sync_point(struct wmi *wmi, u8 if_idx) -{ - struct sk_buff *skb; - struct wmi_sync_cmd *cmd; - struct wmi_data_sync_bufs data_sync_bufs[WMM_NUM_AC]; - enum htc_endpoint_id ep_id; - u8 index, num_pri_streams = 0; - int ret = 0; - - memset(data_sync_bufs, 0, sizeof(data_sync_bufs)); - - spin_lock_bh(&wmi->lock); - - for (index = 0; index < WMM_NUM_AC; index++) { - if (wmi->fat_pipe_exist & (1 << index)) { - num_pri_streams++; - data_sync_bufs[num_pri_streams - 1].traffic_class = - index; - } - } - - spin_unlock_bh(&wmi->lock); - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_sync_cmd *) skb->data; - - /* - * In the SYNC cmd sent on the control Ep, send a bitmap - * of the data eps on which the Data Sync will be sent - */ - cmd->data_sync_map = wmi->fat_pipe_exist; - - for (index = 0; index < num_pri_streams; index++) { - data_sync_bufs[index].skb = ath6kl_buf_alloc(0); - if (data_sync_bufs[index].skb == NULL) { - ret = -ENOMEM; - break; - } - } - - /* - * If buffer allocation for any of the dataSync fails, - * then do not send the Synchronize cmd on the control ep - */ - if (ret) - goto free_cmd_skb; - - /* - * Send sync cmd followed by sync data messages on all - * endpoints being used - */ - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SYNCHRONIZE_CMDID, - NO_SYNC_WMIFLAG); - - if (ret) - goto free_data_skb; - - for (index = 0; index < num_pri_streams; index++) { - - if (WARN_ON(!data_sync_bufs[index].skb)) - goto free_data_skb; - - ep_id = ath6kl_ac2_endpoint_id(wmi->parent_dev, - data_sync_bufs[index]. - traffic_class); - ret = - ath6kl_wmi_data_sync_send(wmi, data_sync_bufs[index].skb, - ep_id, if_idx); - - data_sync_bufs[index].skb = NULL; - - if (ret) - goto free_data_skb; - } - - return 0; - -free_cmd_skb: - /* free up any resources left over (possibly due to an error) */ - dev_kfree_skb(skb); - -free_data_skb: - for (index = 0; index < num_pri_streams; index++) - dev_kfree_skb((struct sk_buff *)data_sync_bufs[index].skb); - - return ret; -} - -int ath6kl_wmi_create_pstream_cmd(struct wmi *wmi, u8 if_idx, - struct wmi_create_pstream_cmd *params) -{ - struct sk_buff *skb; - struct wmi_create_pstream_cmd *cmd; - u8 fatpipe_exist_for_ac = 0; - s32 min_phy = 0; - s32 nominal_phy = 0; - int ret; - - if (!((params->user_pri < 8) && - (params->user_pri <= 0x7) && - (up_to_ac[params->user_pri & 0x7] == params->traffic_class) && - (params->traffic_direc == UPLINK_TRAFFIC || - params->traffic_direc == DNLINK_TRAFFIC || - params->traffic_direc == BIDIR_TRAFFIC) && - (params->traffic_type == TRAFFIC_TYPE_APERIODIC || - params->traffic_type == TRAFFIC_TYPE_PERIODIC) && - (params->voice_psc_cap == DISABLE_FOR_THIS_AC || - params->voice_psc_cap == ENABLE_FOR_THIS_AC || - params->voice_psc_cap == ENABLE_FOR_ALL_AC) && - (params->tsid == WMI_IMPLICIT_PSTREAM || - params->tsid <= WMI_MAX_THINSTREAM))) { - return -EINVAL; - } - - /* - * Check nominal PHY rate is >= minimalPHY, - * so that DUT can allow TSRS IE - */ - - /* Get the physical rate (units of bps) */ - min_phy = ((le32_to_cpu(params->min_phy_rate) / 1000) / 1000); - - /* Check minimal phy < nominal phy rate */ - if (params->nominal_phy >= min_phy) { - /* unit of 500 kbps */ - nominal_phy = (params->nominal_phy * 1000) / 500; - ath6kl_dbg(ATH6KL_DBG_WMI, - "TSRS IE enabled::MinPhy %x->NominalPhy ===> %x\n", - min_phy, nominal_phy); - - params->nominal_phy = nominal_phy; - } else { - params->nominal_phy = 0; - } - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - ath6kl_dbg(ATH6KL_DBG_WMI, - "sending create_pstream_cmd: ac=%d tsid:%d\n", - params->traffic_class, params->tsid); - - cmd = (struct wmi_create_pstream_cmd *) skb->data; - memcpy(cmd, params, sizeof(*cmd)); - - /* This is an implicitly created Fat pipe */ - if ((u32) params->tsid == (u32) WMI_IMPLICIT_PSTREAM) { - spin_lock_bh(&wmi->lock); - fatpipe_exist_for_ac = (wmi->fat_pipe_exist & - (1 << params->traffic_class)); - wmi->fat_pipe_exist |= (1 << params->traffic_class); - spin_unlock_bh(&wmi->lock); - } else { - /* explicitly created thin stream within a fat pipe */ - spin_lock_bh(&wmi->lock); - fatpipe_exist_for_ac = (wmi->fat_pipe_exist & - (1 << params->traffic_class)); - wmi->stream_exist_for_ac[params->traffic_class] |= - (1 << params->tsid); - /* - * If a thinstream becomes active, the fat pipe automatically - * becomes active - */ - wmi->fat_pipe_exist |= (1 << params->traffic_class); - spin_unlock_bh(&wmi->lock); - } - - /* - * Indicate activty change to driver layer only if this is the - * first TSID to get created in this AC explicitly or an implicit - * fat pipe is getting created. - */ - if (!fatpipe_exist_for_ac) - ath6kl_indicate_tx_activity(wmi->parent_dev, - params->traffic_class, true); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_CREATE_PSTREAM_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_delete_pstream_cmd(struct wmi *wmi, u8 if_idx, u8 traffic_class, - u8 tsid) -{ - struct sk_buff *skb; - struct wmi_delete_pstream_cmd *cmd; - u16 active_tsids = 0; - int ret; - - if (traffic_class > 3) { - ath6kl_err("invalid traffic class: %d\n", traffic_class); - return -EINVAL; - } - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_delete_pstream_cmd *) skb->data; - cmd->traffic_class = traffic_class; - cmd->tsid = tsid; - - spin_lock_bh(&wmi->lock); - active_tsids = wmi->stream_exist_for_ac[traffic_class]; - spin_unlock_bh(&wmi->lock); - - if (!(active_tsids & (1 << tsid))) { - dev_kfree_skb(skb); - ath6kl_dbg(ATH6KL_DBG_WMI, - "TSID %d doesn't exist for traffic class: %d\n", - tsid, traffic_class); - return -ENODATA; - } - - ath6kl_dbg(ATH6KL_DBG_WMI, - "sending delete_pstream_cmd: traffic class: %d tsid=%d\n", - traffic_class, tsid); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_DELETE_PSTREAM_CMDID, - SYNC_BEFORE_WMIFLAG); - - spin_lock_bh(&wmi->lock); - wmi->stream_exist_for_ac[traffic_class] &= ~(1 << tsid); - active_tsids = wmi->stream_exist_for_ac[traffic_class]; - spin_unlock_bh(&wmi->lock); - - /* - * Indicate stream inactivity to driver layer only if all tsids - * within this AC are deleted. - */ - if (!active_tsids) { - ath6kl_indicate_tx_activity(wmi->parent_dev, - traffic_class, false); - wmi->fat_pipe_exist &= ~(1 << traffic_class); - } - - return ret; -} - -int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, u8 if_idx, - __be32 ips0, __be32 ips1) -{ - struct sk_buff *skb; - struct wmi_set_ip_cmd *cmd; - int ret; - - /* Multicast address are not valid */ - if (ipv4_is_multicast(ips0) || - ipv4_is_multicast(ips1)) - return -EINVAL; - - skb = ath6kl_wmi_get_new_buf(sizeof(struct wmi_set_ip_cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_set_ip_cmd *) skb->data; - cmd->ips[0] = ips0; - cmd->ips[1] = ips1; - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_IP_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -static void ath6kl_wmi_relinquish_implicit_pstream_credits(struct wmi *wmi) -{ - u16 active_tsids; - u8 stream_exist; - int i; - - /* - * Relinquish credits from all implicitly created pstreams - * since when we go to sleep. If user created explicit - * thinstreams exists with in a fatpipe leave them intact - * for the user to delete. - */ - spin_lock_bh(&wmi->lock); - stream_exist = wmi->fat_pipe_exist; - spin_unlock_bh(&wmi->lock); - - for (i = 0; i < WMM_NUM_AC; i++) { - if (stream_exist & (1 << i)) { - - /* - * FIXME: Is this lock & unlock inside - * for loop correct? may need rework. - */ - spin_lock_bh(&wmi->lock); - active_tsids = wmi->stream_exist_for_ac[i]; - spin_unlock_bh(&wmi->lock); - - /* - * If there are no user created thin streams - * delete the fatpipe - */ - if (!active_tsids) { - stream_exist &= ~(1 << i); - /* - * Indicate inactivity to driver layer for - * this fatpipe (pstream) - */ - ath6kl_indicate_tx_activity(wmi->parent_dev, - i, false); - } - } - } - - /* FIXME: Can we do this assignment without locking ? */ - spin_lock_bh(&wmi->lock); - wmi->fat_pipe_exist = stream_exist; - spin_unlock_bh(&wmi->lock); -} - -static int ath6kl_set_bitrate_mask64(struct wmi *wmi, u8 if_idx, - const struct cfg80211_bitrate_mask *mask) -{ - struct sk_buff *skb; - int ret, mode, band; - u64 mcsrate, ratemask[ATH6KL_NUM_BANDS]; - struct wmi_set_tx_select_rates64_cmd *cmd; - - memset(&ratemask, 0, sizeof(ratemask)); - - /* only check 2.4 and 5 GHz bands, skip the rest */ - for (band = 0; band <= IEEE80211_BAND_5GHZ; band++) { - /* copy legacy rate mask */ - ratemask[band] = mask->control[band].legacy; - if (band == IEEE80211_BAND_5GHZ) - ratemask[band] = - mask->control[band].legacy << 4; - - /* copy mcs rate mask */ - mcsrate = mask->control[band].mcs[1]; - mcsrate <<= 8; - mcsrate |= mask->control[band].mcs[0]; - ratemask[band] |= mcsrate << 12; - ratemask[band] |= mcsrate << 28; - } - - ath6kl_dbg(ATH6KL_DBG_WMI, - "Ratemask 64 bit: 2.4:%llx 5:%llx\n", - ratemask[0], ratemask[1]); - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd) * WMI_RATES_MODE_MAX); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_set_tx_select_rates64_cmd *) skb->data; - for (mode = 0; mode < WMI_RATES_MODE_MAX; mode++) { - /* A mode operate in 5GHZ band */ - if (mode == WMI_RATES_MODE_11A || - mode == WMI_RATES_MODE_11A_HT20 || - mode == WMI_RATES_MODE_11A_HT40) - band = IEEE80211_BAND_5GHZ; - else - band = IEEE80211_BAND_2GHZ; - cmd->ratemask[mode] = cpu_to_le64(ratemask[band]); - } - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, - WMI_SET_TX_SELECT_RATES_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -static int ath6kl_set_bitrate_mask32(struct wmi *wmi, u8 if_idx, - const struct cfg80211_bitrate_mask *mask) -{ - struct sk_buff *skb; - int ret, mode, band; - u32 mcsrate, ratemask[ATH6KL_NUM_BANDS]; - struct wmi_set_tx_select_rates32_cmd *cmd; - - memset(&ratemask, 0, sizeof(ratemask)); - - /* only check 2.4 and 5 GHz bands, skip the rest */ - for (band = 0; band <= IEEE80211_BAND_5GHZ; band++) { - /* copy legacy rate mask */ - ratemask[band] = mask->control[band].legacy; - if (band == IEEE80211_BAND_5GHZ) - ratemask[band] = - mask->control[band].legacy << 4; - - /* copy mcs rate mask */ - mcsrate = mask->control[band].mcs[0]; - ratemask[band] |= mcsrate << 12; - ratemask[band] |= mcsrate << 20; - } - - ath6kl_dbg(ATH6KL_DBG_WMI, - "Ratemask 32 bit: 2.4:%x 5:%x\n", - ratemask[0], ratemask[1]); - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd) * WMI_RATES_MODE_MAX); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_set_tx_select_rates32_cmd *) skb->data; - for (mode = 0; mode < WMI_RATES_MODE_MAX; mode++) { - /* A mode operate in 5GHZ band */ - if (mode == WMI_RATES_MODE_11A || - mode == WMI_RATES_MODE_11A_HT20 || - mode == WMI_RATES_MODE_11A_HT40) - band = IEEE80211_BAND_5GHZ; - else - band = IEEE80211_BAND_2GHZ; - cmd->ratemask[mode] = cpu_to_le32(ratemask[band]); - } - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, - WMI_SET_TX_SELECT_RATES_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_set_bitrate_mask(struct wmi *wmi, u8 if_idx, - const struct cfg80211_bitrate_mask *mask) -{ - struct ath6kl *ar = wmi->parent_dev; - - if (ar->hw.flags & ATH6KL_HW_64BIT_RATES) - return ath6kl_set_bitrate_mask64(wmi, if_idx, mask); - else - return ath6kl_set_bitrate_mask32(wmi, if_idx, mask); -} - -int ath6kl_wmi_set_host_sleep_mode_cmd(struct wmi *wmi, u8 if_idx, - enum ath6kl_host_mode host_mode) -{ - struct sk_buff *skb; - struct wmi_set_host_sleep_mode_cmd *cmd; - int ret; - - if ((host_mode != ATH6KL_HOST_MODE_ASLEEP) && - (host_mode != ATH6KL_HOST_MODE_AWAKE)) { - ath6kl_err("invalid host sleep mode: %d\n", host_mode); - return -EINVAL; - } - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_set_host_sleep_mode_cmd *) skb->data; - - if (host_mode == ATH6KL_HOST_MODE_ASLEEP) { - ath6kl_wmi_relinquish_implicit_pstream_credits(wmi); - cmd->asleep = cpu_to_le32(1); - } else - cmd->awake = cpu_to_le32(1); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, - WMI_SET_HOST_SLEEP_MODE_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -/* This command has zero length payload */ -static int ath6kl_wmi_host_sleep_mode_cmd_prcd_evt_rx(struct wmi *wmi, - struct ath6kl_vif *vif) -{ - struct ath6kl *ar = wmi->parent_dev; - - set_bit(HOST_SLEEP_MODE_CMD_PROCESSED, &vif->flags); - wake_up(&ar->event_wq); - - return 0; -} - -int ath6kl_wmi_set_wow_mode_cmd(struct wmi *wmi, u8 if_idx, - enum ath6kl_wow_mode wow_mode, - u32 filter, u16 host_req_delay) -{ - struct sk_buff *skb; - struct wmi_set_wow_mode_cmd *cmd; - int ret; - - if ((wow_mode != ATH6KL_WOW_MODE_ENABLE) && - wow_mode != ATH6KL_WOW_MODE_DISABLE) { - ath6kl_err("invalid wow mode: %d\n", wow_mode); - return -EINVAL; - } - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_set_wow_mode_cmd *) skb->data; - cmd->enable_wow = cpu_to_le32(wow_mode); - cmd->filter = cpu_to_le32(filter); - cmd->host_req_delay = cpu_to_le16(host_req_delay); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_WOW_MODE_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_add_wow_pattern_cmd(struct wmi *wmi, u8 if_idx, - u8 list_id, u8 filter_size, - u8 filter_offset, const u8 *filter, - const u8 *mask) -{ - struct sk_buff *skb; - struct wmi_add_wow_pattern_cmd *cmd; - u16 size; - u8 *filter_mask; - int ret; - - /* - * Allocate additional memory in the buffer to hold - * filter and mask value, which is twice of filter_size. - */ - size = sizeof(*cmd) + (2 * filter_size); - - skb = ath6kl_wmi_get_new_buf(size); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_add_wow_pattern_cmd *) skb->data; - cmd->filter_list_id = list_id; - cmd->filter_size = filter_size; - cmd->filter_offset = filter_offset; - - memcpy(cmd->filter, filter, filter_size); - - filter_mask = (u8 *) (cmd->filter + filter_size); - memcpy(filter_mask, mask, filter_size); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_ADD_WOW_PATTERN_CMDID, - NO_SYNC_WMIFLAG); - - return ret; -} - -int ath6kl_wmi_del_wow_pattern_cmd(struct wmi *wmi, u8 if_idx, - u16 list_id, u16 filter_id) -{ - struct sk_buff *skb; - struct wmi_del_wow_pattern_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_del_wow_pattern_cmd *) skb->data; - cmd->filter_list_id = cpu_to_le16(list_id); - cmd->filter_id = cpu_to_le16(filter_id); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_DEL_WOW_PATTERN_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -static int ath6kl_wmi_cmd_send_xtnd(struct wmi *wmi, struct sk_buff *skb, - enum wmix_command_id cmd_id, - enum wmi_sync_flag sync_flag) -{ - struct wmix_cmd_hdr *cmd_hdr; - int ret; - - skb_push(skb, sizeof(struct wmix_cmd_hdr)); - - cmd_hdr = (struct wmix_cmd_hdr *) skb->data; - cmd_hdr->cmd_id = cpu_to_le32(cmd_id); - - ret = ath6kl_wmi_cmd_send(wmi, 0, skb, WMI_EXTENSION_CMDID, sync_flag); - - return ret; -} - -int ath6kl_wmi_get_challenge_resp_cmd(struct wmi *wmi, u32 cookie, u32 source) -{ - struct sk_buff *skb; - struct wmix_hb_challenge_resp_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmix_hb_challenge_resp_cmd *) skb->data; - cmd->cookie = cpu_to_le32(cookie); - cmd->source = cpu_to_le32(source); - - ret = ath6kl_wmi_cmd_send_xtnd(wmi, skb, WMIX_HB_CHALLENGE_RESP_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_config_debug_module_cmd(struct wmi *wmi, u32 valid, u32 config) -{ - struct ath6kl_wmix_dbglog_cfg_module_cmd *cmd; - struct sk_buff *skb; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct ath6kl_wmix_dbglog_cfg_module_cmd *) skb->data; - cmd->valid = cpu_to_le32(valid); - cmd->config = cpu_to_le32(config); - - ret = ath6kl_wmi_cmd_send_xtnd(wmi, skb, WMIX_DBGLOG_CFG_MODULE_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_get_stats_cmd(struct wmi *wmi, u8 if_idx) -{ - return ath6kl_wmi_simple_cmd(wmi, if_idx, WMI_GET_STATISTICS_CMDID); -} - -int ath6kl_wmi_set_tx_pwr_cmd(struct wmi *wmi, u8 if_idx, u8 dbM) -{ - struct sk_buff *skb; - struct wmi_set_tx_pwr_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(struct wmi_set_tx_pwr_cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_set_tx_pwr_cmd *) skb->data; - cmd->dbM = dbM; - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_TX_PWR_CMDID, - NO_SYNC_WMIFLAG); - - return ret; -} - -int ath6kl_wmi_get_tx_pwr_cmd(struct wmi *wmi, u8 if_idx) -{ - return ath6kl_wmi_simple_cmd(wmi, if_idx, WMI_GET_TX_PWR_CMDID); -} - -int ath6kl_wmi_get_roam_tbl_cmd(struct wmi *wmi) -{ - return ath6kl_wmi_simple_cmd(wmi, 0, WMI_GET_ROAM_TBL_CMDID); -} - -int ath6kl_wmi_set_lpreamble_cmd(struct wmi *wmi, u8 if_idx, u8 status, - u8 preamble_policy) -{ - struct sk_buff *skb; - struct wmi_set_lpreamble_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(struct wmi_set_lpreamble_cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_set_lpreamble_cmd *) skb->data; - cmd->status = status; - cmd->preamble_policy = preamble_policy; - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_LPREAMBLE_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_set_rts_cmd(struct wmi *wmi, u16 threshold) -{ - struct sk_buff *skb; - struct wmi_set_rts_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(struct wmi_set_rts_cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_set_rts_cmd *) skb->data; - cmd->threshold = cpu_to_le16(threshold); - - ret = ath6kl_wmi_cmd_send(wmi, 0, skb, WMI_SET_RTS_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_set_wmm_txop(struct wmi *wmi, u8 if_idx, enum wmi_txop_cfg cfg) -{ - struct sk_buff *skb; - struct wmi_set_wmm_txop_cmd *cmd; - int ret; - - if (!((cfg == WMI_TXOP_DISABLED) || (cfg == WMI_TXOP_ENABLED))) - return -EINVAL; - - skb = ath6kl_wmi_get_new_buf(sizeof(struct wmi_set_wmm_txop_cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_set_wmm_txop_cmd *) skb->data; - cmd->txop_enable = cfg; - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_WMM_TXOP_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_set_keepalive_cmd(struct wmi *wmi, u8 if_idx, - u8 keep_alive_intvl) -{ - struct sk_buff *skb; - struct wmi_set_keepalive_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_set_keepalive_cmd *) skb->data; - cmd->keep_alive_intvl = keep_alive_intvl; - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_KEEPALIVE_CMDID, - NO_SYNC_WMIFLAG); - - if (ret == 0) - ath6kl_debug_set_keepalive(wmi->parent_dev, keep_alive_intvl); - - return ret; -} - -int ath6kl_wmi_set_htcap_cmd(struct wmi *wmi, u8 if_idx, - enum ieee80211_band band, - struct ath6kl_htcap *htcap) -{ - struct sk_buff *skb; - struct wmi_set_htcap_cmd *cmd; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_set_htcap_cmd *) skb->data; - - /* - * NOTE: Band in firmware matches enum ieee80211_band, it is unlikely - * this will be changed in firmware. If at all there is any change in - * band value, the host needs to be fixed. - */ - cmd->band = band; - cmd->ht_enable = !!htcap->ht_enable; - cmd->ht20_sgi = !!(htcap->cap_info & IEEE80211_HT_CAP_SGI_20); - cmd->ht40_supported = - !!(htcap->cap_info & IEEE80211_HT_CAP_SUP_WIDTH_20_40); - cmd->ht40_sgi = !!(htcap->cap_info & IEEE80211_HT_CAP_SGI_40); - cmd->intolerant_40mhz = - !!(htcap->cap_info & IEEE80211_HT_CAP_40MHZ_INTOLERANT); - cmd->max_ampdu_len_exp = htcap->ampdu_factor; - - ath6kl_dbg(ATH6KL_DBG_WMI, - "Set htcap: band:%d ht_enable:%d 40mhz:%d sgi_20mhz:%d sgi_40mhz:%d 40mhz_intolerant:%d ampdu_len_exp:%d\n", - cmd->band, cmd->ht_enable, cmd->ht40_supported, - cmd->ht20_sgi, cmd->ht40_sgi, cmd->intolerant_40mhz, - cmd->max_ampdu_len_exp); - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_HT_CAP_CMDID, - NO_SYNC_WMIFLAG); -} - -int ath6kl_wmi_test_cmd(struct wmi *wmi, void *buf, size_t len) -{ - struct sk_buff *skb; - int ret; - - skb = ath6kl_wmi_get_new_buf(len); - if (!skb) - return -ENOMEM; - - memcpy(skb->data, buf, len); - - ret = ath6kl_wmi_cmd_send(wmi, 0, skb, WMI_TEST_CMDID, NO_SYNC_WMIFLAG); - - return ret; -} - -int ath6kl_wmi_mcast_filter_cmd(struct wmi *wmi, u8 if_idx, bool mc_all_on) -{ - struct sk_buff *skb; - struct wmi_mcast_filter_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_mcast_filter_cmd *) skb->data; - cmd->mcast_all_enable = mc_all_on; - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_MCAST_FILTER_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_add_del_mcast_filter_cmd(struct wmi *wmi, u8 if_idx, - u8 *filter, bool add_filter) -{ - struct sk_buff *skb; - struct wmi_mcast_filter_add_del_cmd *cmd; - int ret; - - if ((filter[0] != 0x33 || filter[1] != 0x33) && - (filter[0] != 0x01 || filter[1] != 0x00 || - filter[2] != 0x5e || filter[3] > 0x7f)) { - ath6kl_warn("invalid multicast filter address\n"); - return -EINVAL; - } - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_mcast_filter_add_del_cmd *) skb->data; - memcpy(cmd->mcast_mac, filter, ATH6KL_MCAST_FILTER_MAC_ADDR_SIZE); - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, - add_filter ? WMI_SET_MCAST_FILTER_CMDID : - WMI_DEL_MCAST_FILTER_CMDID, - NO_SYNC_WMIFLAG); - - return ret; -} - -int ath6kl_wmi_sta_bmiss_enhance_cmd(struct wmi *wmi, u8 if_idx, bool enhance) -{ - struct sk_buff *skb; - struct wmi_sta_bmiss_enhance_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_sta_bmiss_enhance_cmd *) skb->data; - cmd->enable = enhance ? 1 : 0; - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, - WMI_STA_BMISS_ENHANCE_CMDID, - NO_SYNC_WMIFLAG); - return ret; -} - -int ath6kl_wmi_set_regdomain_cmd(struct wmi *wmi, const char *alpha2) -{ - struct sk_buff *skb; - struct wmi_set_regdomain_cmd *cmd; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_set_regdomain_cmd *) skb->data; - memcpy(cmd->iso_name, alpha2, 2); - - return ath6kl_wmi_cmd_send(wmi, 0, skb, - WMI_SET_REGDOMAIN_CMDID, - NO_SYNC_WMIFLAG); -} - -s32 ath6kl_wmi_get_rate(s8 rate_index) -{ - u8 sgi = 0; - - if (rate_index == RATE_AUTO) - return 0; - - /* SGI is stored as the MSB of the rate_index */ - if (rate_index & RATE_INDEX_MSB) { - rate_index &= RATE_INDEX_WITHOUT_SGI_MASK; - sgi = 1; - } - - if (WARN_ON(rate_index > RATE_MCS_7_40)) - rate_index = RATE_MCS_7_40; - - return wmi_rate_tbl[(u32) rate_index][sgi]; -} - -static int ath6kl_wmi_get_pmkid_list_event_rx(struct wmi *wmi, u8 *datap, - u32 len) -{ - struct wmi_pmkid_list_reply *reply; - u32 expected_len; - - if (len < sizeof(struct wmi_pmkid_list_reply)) - return -EINVAL; - - reply = (struct wmi_pmkid_list_reply *)datap; - expected_len = sizeof(reply->num_pmkid) + - le32_to_cpu(reply->num_pmkid) * WMI_PMKID_LEN; - - if (len < expected_len) - return -EINVAL; - - return 0; -} - -static int ath6kl_wmi_addba_req_event_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - struct wmi_addba_req_event *cmd = (struct wmi_addba_req_event *) datap; - - aggr_recv_addba_req_evt(vif, cmd->tid, - le16_to_cpu(cmd->st_seq_no), cmd->win_sz); - - return 0; -} - -static int ath6kl_wmi_delba_req_event_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - struct wmi_delba_event *cmd = (struct wmi_delba_event *) datap; - - aggr_recv_delba_req_evt(vif, cmd->tid); - - return 0; -} - -/* AP mode functions */ - -int ath6kl_wmi_ap_profile_commit(struct wmi *wmip, u8 if_idx, - struct wmi_connect_cmd *p) -{ - struct sk_buff *skb; - struct wmi_connect_cmd *cm; - int res; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cm)); - if (!skb) - return -ENOMEM; - - cm = (struct wmi_connect_cmd *) skb->data; - memcpy(cm, p, sizeof(*cm)); - - res = ath6kl_wmi_cmd_send(wmip, if_idx, skb, WMI_AP_CONFIG_COMMIT_CMDID, - NO_SYNC_WMIFLAG); - ath6kl_dbg(ATH6KL_DBG_WMI, - "%s: nw_type=%u auth_mode=%u ch=%u ctrl_flags=0x%x-> res=%d\n", - __func__, p->nw_type, p->auth_mode, le16_to_cpu(p->ch), - le32_to_cpu(p->ctrl_flags), res); - return res; -} - -int ath6kl_wmi_ap_set_mlme(struct wmi *wmip, u8 if_idx, u8 cmd, const u8 *mac, - u16 reason) -{ - struct sk_buff *skb; - struct wmi_ap_set_mlme_cmd *cm; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cm)); - if (!skb) - return -ENOMEM; - - cm = (struct wmi_ap_set_mlme_cmd *) skb->data; - memcpy(cm->mac, mac, ETH_ALEN); - cm->reason = cpu_to_le16(reason); - cm->cmd = cmd; - - ath6kl_dbg(ATH6KL_DBG_WMI, "ap_set_mlme: cmd=%d reason=%d\n", cm->cmd, - cm->reason); - - return ath6kl_wmi_cmd_send(wmip, if_idx, skb, WMI_AP_SET_MLME_CMDID, - NO_SYNC_WMIFLAG); -} - -int ath6kl_wmi_ap_hidden_ssid(struct wmi *wmi, u8 if_idx, bool enable) -{ - struct sk_buff *skb; - struct wmi_ap_hidden_ssid_cmd *cmd; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_ap_hidden_ssid_cmd *) skb->data; - cmd->hidden_ssid = enable ? 1 : 0; - - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_AP_HIDDEN_SSID_CMDID, - NO_SYNC_WMIFLAG); -} - -/* This command will be used to enable/disable AP uAPSD feature */ -int ath6kl_wmi_ap_set_apsd(struct wmi *wmi, u8 if_idx, u8 enable) -{ - struct wmi_ap_set_apsd_cmd *cmd; - struct sk_buff *skb; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_ap_set_apsd_cmd *)skb->data; - cmd->enable = enable; - - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_AP_SET_APSD_CMDID, - NO_SYNC_WMIFLAG); -} - -int ath6kl_wmi_set_apsd_bfrd_traf(struct wmi *wmi, u8 if_idx, - u16 aid, u16 bitmap, u32 flags) -{ - struct wmi_ap_apsd_buffered_traffic_cmd *cmd; - struct sk_buff *skb; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_ap_apsd_buffered_traffic_cmd *)skb->data; - cmd->aid = cpu_to_le16(aid); - cmd->bitmap = cpu_to_le16(bitmap); - cmd->flags = cpu_to_le32(flags); - - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, - WMI_AP_APSD_BUFFERED_TRAFFIC_CMDID, - NO_SYNC_WMIFLAG); -} - -static int ath6kl_wmi_pspoll_event_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - struct wmi_pspoll_event *ev; - - if (len < sizeof(struct wmi_pspoll_event)) - return -EINVAL; - - ev = (struct wmi_pspoll_event *) datap; - - ath6kl_pspoll_event(vif, le16_to_cpu(ev->aid)); - - return 0; -} - -static int ath6kl_wmi_dtimexpiry_event_rx(struct wmi *wmi, u8 *datap, int len, - struct ath6kl_vif *vif) -{ - ath6kl_dtimexpiry_event(vif); - - return 0; -} - -int ath6kl_wmi_set_pvb_cmd(struct wmi *wmi, u8 if_idx, u16 aid, - bool flag) -{ - struct sk_buff *skb; - struct wmi_ap_set_pvb_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(struct wmi_ap_set_pvb_cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_ap_set_pvb_cmd *) skb->data; - cmd->aid = cpu_to_le16(aid); - cmd->rsvd = cpu_to_le16(0); - cmd->flag = cpu_to_le32(flag); - - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_AP_SET_PVB_CMDID, - NO_SYNC_WMIFLAG); - - return 0; -} - -int ath6kl_wmi_set_rx_frame_format_cmd(struct wmi *wmi, u8 if_idx, - u8 rx_meta_ver, - bool rx_dot11_hdr, bool defrag_on_host) -{ - struct sk_buff *skb; - struct wmi_rx_frame_format_cmd *cmd; - int ret; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_rx_frame_format_cmd *) skb->data; - cmd->dot11_hdr = rx_dot11_hdr ? 1 : 0; - cmd->defrag_on_host = defrag_on_host ? 1 : 0; - cmd->meta_ver = rx_meta_ver; - - /* Delete the local aggr state, on host */ - ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_RX_FRAME_FORMAT_CMDID, - NO_SYNC_WMIFLAG); - - return ret; -} - -int ath6kl_wmi_set_appie_cmd(struct wmi *wmi, u8 if_idx, u8 mgmt_frm_type, - const u8 *ie, u8 ie_len) -{ - struct sk_buff *skb; - struct wmi_set_appie_cmd *p; - - skb = ath6kl_wmi_get_new_buf(sizeof(*p) + ie_len); - if (!skb) - return -ENOMEM; - - ath6kl_dbg(ATH6KL_DBG_WMI, - "set_appie_cmd: mgmt_frm_type=%u ie_len=%u\n", - mgmt_frm_type, ie_len); - p = (struct wmi_set_appie_cmd *) skb->data; - p->mgmt_frm_type = mgmt_frm_type; - p->ie_len = ie_len; - - if (ie != NULL && ie_len > 0) - memcpy(p->ie_info, ie, ie_len); - - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_APPIE_CMDID, - NO_SYNC_WMIFLAG); -} - -int ath6kl_wmi_set_ie_cmd(struct wmi *wmi, u8 if_idx, u8 ie_id, u8 ie_field, - const u8 *ie_info, u8 ie_len) -{ - struct sk_buff *skb; - struct wmi_set_ie_cmd *p; - - skb = ath6kl_wmi_get_new_buf(sizeof(*p) + ie_len); - if (!skb) - return -ENOMEM; - - ath6kl_dbg(ATH6KL_DBG_WMI, "set_ie_cmd: ie_id=%u ie_ie_field=%u ie_len=%u\n", - ie_id, ie_field, ie_len); - p = (struct wmi_set_ie_cmd *) skb->data; - p->ie_id = ie_id; - p->ie_field = ie_field; - p->ie_len = ie_len; - if (ie_info && ie_len > 0) - memcpy(p->ie_info, ie_info, ie_len); - - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SET_IE_CMDID, - NO_SYNC_WMIFLAG); -} - -int ath6kl_wmi_disable_11b_rates_cmd(struct wmi *wmi, bool disable) -{ - struct sk_buff *skb; - struct wmi_disable_11b_rates_cmd *cmd; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - ath6kl_dbg(ATH6KL_DBG_WMI, "disable_11b_rates_cmd: disable=%u\n", - disable); - cmd = (struct wmi_disable_11b_rates_cmd *) skb->data; - cmd->disable = disable ? 1 : 0; - - return ath6kl_wmi_cmd_send(wmi, 0, skb, WMI_DISABLE_11B_RATES_CMDID, - NO_SYNC_WMIFLAG); -} - -int ath6kl_wmi_remain_on_chnl_cmd(struct wmi *wmi, u8 if_idx, u32 freq, u32 dur) -{ - struct sk_buff *skb; - struct wmi_remain_on_chnl_cmd *p; - - skb = ath6kl_wmi_get_new_buf(sizeof(*p)); - if (!skb) - return -ENOMEM; - - ath6kl_dbg(ATH6KL_DBG_WMI, "remain_on_chnl_cmd: freq=%u dur=%u\n", - freq, dur); - p = (struct wmi_remain_on_chnl_cmd *) skb->data; - p->freq = cpu_to_le32(freq); - p->duration = cpu_to_le32(dur); - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_REMAIN_ON_CHNL_CMDID, - NO_SYNC_WMIFLAG); -} - -/* ath6kl_wmi_send_action_cmd is to be deprecated. Use - * ath6kl_wmi_send_mgmt_cmd instead. The new function supports P2P - * mgmt operations using station interface. - */ -static int ath6kl_wmi_send_action_cmd(struct wmi *wmi, u8 if_idx, u32 id, - u32 freq, u32 wait, const u8 *data, - u16 data_len) -{ - struct sk_buff *skb; - struct wmi_send_action_cmd *p; - u8 *buf; - - if (wait) - return -EINVAL; /* Offload for wait not supported */ - - buf = kmalloc(data_len, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - skb = ath6kl_wmi_get_new_buf(sizeof(*p) + data_len); - if (!skb) { - kfree(buf); - return -ENOMEM; - } - - kfree(wmi->last_mgmt_tx_frame); - memcpy(buf, data, data_len); - wmi->last_mgmt_tx_frame = buf; - wmi->last_mgmt_tx_frame_len = data_len; - - ath6kl_dbg(ATH6KL_DBG_WMI, - "send_action_cmd: id=%u freq=%u wait=%u len=%u\n", - id, freq, wait, data_len); - p = (struct wmi_send_action_cmd *) skb->data; - p->id = cpu_to_le32(id); - p->freq = cpu_to_le32(freq); - p->wait = cpu_to_le32(wait); - p->len = cpu_to_le16(data_len); - memcpy(p->data, data, data_len); - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SEND_ACTION_CMDID, - NO_SYNC_WMIFLAG); -} - -static int __ath6kl_wmi_send_mgmt_cmd(struct wmi *wmi, u8 if_idx, u32 id, - u32 freq, u32 wait, const u8 *data, - u16 data_len, u32 no_cck) -{ - struct sk_buff *skb; - struct wmi_send_mgmt_cmd *p; - u8 *buf; - - if (wait) - return -EINVAL; /* Offload for wait not supported */ - - buf = kmalloc(data_len, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - skb = ath6kl_wmi_get_new_buf(sizeof(*p) + data_len); - if (!skb) { - kfree(buf); - return -ENOMEM; - } - - kfree(wmi->last_mgmt_tx_frame); - memcpy(buf, data, data_len); - wmi->last_mgmt_tx_frame = buf; - wmi->last_mgmt_tx_frame_len = data_len; - - ath6kl_dbg(ATH6KL_DBG_WMI, - "send_action_cmd: id=%u freq=%u wait=%u len=%u\n", - id, freq, wait, data_len); - p = (struct wmi_send_mgmt_cmd *) skb->data; - p->id = cpu_to_le32(id); - p->freq = cpu_to_le32(freq); - p->wait = cpu_to_le32(wait); - p->no_cck = cpu_to_le32(no_cck); - p->len = cpu_to_le16(data_len); - memcpy(p->data, data, data_len); - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_SEND_MGMT_CMDID, - NO_SYNC_WMIFLAG); -} - -int ath6kl_wmi_send_mgmt_cmd(struct wmi *wmi, u8 if_idx, u32 id, u32 freq, - u32 wait, const u8 *data, u16 data_len, - u32 no_cck) -{ - int status; - struct ath6kl *ar = wmi->parent_dev; - - if (test_bit(ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX, - ar->fw_capabilities)) { - /* - * If capable of doing P2P mgmt operations using - * station interface, send additional information like - * supported rates to advertise and xmit rates for - * probe requests - */ - status = __ath6kl_wmi_send_mgmt_cmd(ar->wmi, if_idx, id, freq, - wait, data, data_len, - no_cck); - } else { - status = ath6kl_wmi_send_action_cmd(ar->wmi, if_idx, id, freq, - wait, data, data_len); - } - - return status; -} - -int ath6kl_wmi_send_probe_response_cmd(struct wmi *wmi, u8 if_idx, u32 freq, - const u8 *dst, const u8 *data, - u16 data_len) -{ - struct sk_buff *skb; - struct wmi_p2p_probe_response_cmd *p; - size_t cmd_len = sizeof(*p) + data_len; - - if (data_len == 0) - cmd_len++; /* work around target minimum length requirement */ - - skb = ath6kl_wmi_get_new_buf(cmd_len); - if (!skb) - return -ENOMEM; - - ath6kl_dbg(ATH6KL_DBG_WMI, - "send_probe_response_cmd: freq=%u dst=%pM len=%u\n", - freq, dst, data_len); - p = (struct wmi_p2p_probe_response_cmd *) skb->data; - p->freq = cpu_to_le32(freq); - memcpy(p->destination_addr, dst, ETH_ALEN); - p->len = cpu_to_le16(data_len); - memcpy(p->data, data, data_len); - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, - WMI_SEND_PROBE_RESPONSE_CMDID, - NO_SYNC_WMIFLAG); -} - -int ath6kl_wmi_probe_report_req_cmd(struct wmi *wmi, u8 if_idx, bool enable) -{ - struct sk_buff *skb; - struct wmi_probe_req_report_cmd *p; - - skb = ath6kl_wmi_get_new_buf(sizeof(*p)); - if (!skb) - return -ENOMEM; - - ath6kl_dbg(ATH6KL_DBG_WMI, "probe_report_req_cmd: enable=%u\n", - enable); - p = (struct wmi_probe_req_report_cmd *) skb->data; - p->enable = enable ? 1 : 0; - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_PROBE_REQ_REPORT_CMDID, - NO_SYNC_WMIFLAG); -} - -int ath6kl_wmi_info_req_cmd(struct wmi *wmi, u8 if_idx, u32 info_req_flags) -{ - struct sk_buff *skb; - struct wmi_get_p2p_info *p; - - skb = ath6kl_wmi_get_new_buf(sizeof(*p)); - if (!skb) - return -ENOMEM; - - ath6kl_dbg(ATH6KL_DBG_WMI, "info_req_cmd: flags=%x\n", - info_req_flags); - p = (struct wmi_get_p2p_info *) skb->data; - p->info_req_flags = cpu_to_le32(info_req_flags); - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_GET_P2P_INFO_CMDID, - NO_SYNC_WMIFLAG); -} - -int ath6kl_wmi_cancel_remain_on_chnl_cmd(struct wmi *wmi, u8 if_idx) -{ - ath6kl_dbg(ATH6KL_DBG_WMI, "cancel_remain_on_chnl_cmd\n"); - return ath6kl_wmi_simple_cmd(wmi, if_idx, - WMI_CANCEL_REMAIN_ON_CHNL_CMDID); -} - -int ath6kl_wmi_set_inact_period(struct wmi *wmi, u8 if_idx, int inact_timeout) -{ - struct sk_buff *skb; - struct wmi_set_inact_period_cmd *cmd; - - skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); - if (!skb) - return -ENOMEM; - - cmd = (struct wmi_set_inact_period_cmd *) skb->data; - cmd->inact_period = cpu_to_le32(inact_timeout); - cmd->num_null_func = 0; - - return ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_AP_CONN_INACT_CMDID, - NO_SYNC_WMIFLAG); -} - -static void ath6kl_wmi_hb_challenge_resp_event(struct wmi *wmi, u8 *datap, - int len) -{ - struct wmix_hb_challenge_resp_cmd *cmd; - - if (len < sizeof(struct wmix_hb_challenge_resp_cmd)) - return; - - cmd = (struct wmix_hb_challenge_resp_cmd *) datap; - ath6kl_recovery_hb_event(wmi->parent_dev, - le32_to_cpu(cmd->cookie)); -} - -static int ath6kl_wmi_control_rx_xtnd(struct wmi *wmi, struct sk_buff *skb) -{ - struct wmix_cmd_hdr *cmd; - u32 len; - u16 id; - u8 *datap; - int ret = 0; - - if (skb->len < sizeof(struct wmix_cmd_hdr)) { - ath6kl_err("bad packet 1\n"); - return -EINVAL; - } - - cmd = (struct wmix_cmd_hdr *) skb->data; - id = le32_to_cpu(cmd->cmd_id); - - skb_pull(skb, sizeof(struct wmix_cmd_hdr)); - - datap = skb->data; - len = skb->len; - - switch (id) { - case WMIX_HB_CHALLENGE_RESP_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "wmi event hb challenge resp\n"); - ath6kl_wmi_hb_challenge_resp_event(wmi, datap, len); - break; - case WMIX_DBGLOG_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "wmi event dbglog len %d\n", len); - ath6kl_debug_fwlog_event(wmi->parent_dev, datap, len); - break; - default: - ath6kl_warn("unknown cmd id 0x%x\n", id); - ret = -EINVAL; - break; - } - - return ret; -} - -static int ath6kl_wmi_roam_tbl_event_rx(struct wmi *wmi, u8 *datap, int len) -{ - return ath6kl_debug_roam_tbl_event(wmi->parent_dev, datap, len); -} - -/* Process interface specific wmi events, caller would free the datap */ -static int ath6kl_wmi_proc_events_vif(struct wmi *wmi, u16 if_idx, u16 cmd_id, - u8 *datap, u32 len) -{ - struct ath6kl_vif *vif; - - vif = ath6kl_get_vif_by_index(wmi->parent_dev, if_idx); - if (!vif) { - ath6kl_dbg(ATH6KL_DBG_WMI, - "Wmi event for unavailable vif, vif_index:%d\n", - if_idx); - return -EINVAL; - } - - switch (cmd_id) { - case WMI_CONNECT_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_CONNECT_EVENTID\n"); - return ath6kl_wmi_connect_event_rx(wmi, datap, len, vif); - case WMI_DISCONNECT_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_DISCONNECT_EVENTID\n"); - return ath6kl_wmi_disconnect_event_rx(wmi, datap, len, vif); - case WMI_TKIP_MICERR_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_TKIP_MICERR_EVENTID\n"); - return ath6kl_wmi_tkip_micerr_event_rx(wmi, datap, len, vif); - case WMI_BSSINFO_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_BSSINFO_EVENTID\n"); - return ath6kl_wmi_bssinfo_event_rx(wmi, datap, len, vif); - case WMI_NEIGHBOR_REPORT_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_NEIGHBOR_REPORT_EVENTID\n"); - return ath6kl_wmi_neighbor_report_event_rx(wmi, datap, len, - vif); - case WMI_SCAN_COMPLETE_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_SCAN_COMPLETE_EVENTID\n"); - return ath6kl_wmi_scan_complete_rx(wmi, datap, len, vif); - case WMI_REPORT_STATISTICS_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_REPORT_STATISTICS_EVENTID\n"); - return ath6kl_wmi_stats_event_rx(wmi, datap, len, vif); - case WMI_CAC_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_CAC_EVENTID\n"); - return ath6kl_wmi_cac_event_rx(wmi, datap, len, vif); - case WMI_PSPOLL_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_PSPOLL_EVENTID\n"); - return ath6kl_wmi_pspoll_event_rx(wmi, datap, len, vif); - case WMI_DTIMEXPIRY_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_DTIMEXPIRY_EVENTID\n"); - return ath6kl_wmi_dtimexpiry_event_rx(wmi, datap, len, vif); - case WMI_ADDBA_REQ_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_ADDBA_REQ_EVENTID\n"); - return ath6kl_wmi_addba_req_event_rx(wmi, datap, len, vif); - case WMI_DELBA_REQ_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_DELBA_REQ_EVENTID\n"); - return ath6kl_wmi_delba_req_event_rx(wmi, datap, len, vif); - case WMI_SET_HOST_SLEEP_MODE_CMD_PROCESSED_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, - "WMI_SET_HOST_SLEEP_MODE_CMD_PROCESSED_EVENTID"); - return ath6kl_wmi_host_sleep_mode_cmd_prcd_evt_rx(wmi, vif); - case WMI_REMAIN_ON_CHNL_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_REMAIN_ON_CHNL_EVENTID\n"); - return ath6kl_wmi_remain_on_chnl_event_rx(wmi, datap, len, vif); - case WMI_CANCEL_REMAIN_ON_CHNL_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, - "WMI_CANCEL_REMAIN_ON_CHNL_EVENTID\n"); - return ath6kl_wmi_cancel_remain_on_chnl_event_rx(wmi, datap, - len, vif); - case WMI_TX_STATUS_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_TX_STATUS_EVENTID\n"); - return ath6kl_wmi_tx_status_event_rx(wmi, datap, len, vif); - case WMI_RX_PROBE_REQ_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_RX_PROBE_REQ_EVENTID\n"); - return ath6kl_wmi_rx_probe_req_event_rx(wmi, datap, len, vif); - case WMI_RX_ACTION_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_RX_ACTION_EVENTID\n"); - return ath6kl_wmi_rx_action_event_rx(wmi, datap, len, vif); - case WMI_TXE_NOTIFY_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_TXE_NOTIFY_EVENTID\n"); - return ath6kl_wmi_txe_notify_event_rx(wmi, datap, len, vif); - default: - ath6kl_dbg(ATH6KL_DBG_WMI, "unknown cmd id 0x%x\n", cmd_id); - return -EINVAL; - } - - return 0; -} - -static int ath6kl_wmi_proc_events(struct wmi *wmi, struct sk_buff *skb) -{ - struct wmi_cmd_hdr *cmd; - int ret = 0; - u32 len; - u16 id; - u8 if_idx; - u8 *datap; - - cmd = (struct wmi_cmd_hdr *) skb->data; - id = le16_to_cpu(cmd->cmd_id); - if_idx = le16_to_cpu(cmd->info1) & WMI_CMD_HDR_IF_ID_MASK; - - skb_pull(skb, sizeof(struct wmi_cmd_hdr)); - datap = skb->data; - len = skb->len; - - ath6kl_dbg(ATH6KL_DBG_WMI, "wmi rx id %d len %d\n", id, len); - ath6kl_dbg_dump(ATH6KL_DBG_WMI_DUMP, NULL, "wmi rx ", - datap, len); - - switch (id) { - case WMI_GET_BITRATE_CMDID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_GET_BITRATE_CMDID\n"); - ret = ath6kl_wmi_bitrate_reply_rx(wmi, datap, len); - break; - case WMI_GET_CHANNEL_LIST_CMDID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_GET_CHANNEL_LIST_CMDID\n"); - ret = ath6kl_wmi_ch_list_reply_rx(wmi, datap, len); - break; - case WMI_GET_TX_PWR_CMDID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_GET_TX_PWR_CMDID\n"); - ret = ath6kl_wmi_tx_pwr_reply_rx(wmi, datap, len); - break; - case WMI_READY_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_READY_EVENTID\n"); - ret = ath6kl_wmi_ready_event_rx(wmi, datap, len); - break; - case WMI_PEER_NODE_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_PEER_NODE_EVENTID\n"); - ret = ath6kl_wmi_peer_node_event_rx(wmi, datap, len); - break; - case WMI_REGDOMAIN_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_REGDOMAIN_EVENTID\n"); - ath6kl_wmi_regdomain_event(wmi, datap, len); - break; - case WMI_PSTREAM_TIMEOUT_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_PSTREAM_TIMEOUT_EVENTID\n"); - ret = ath6kl_wmi_pstream_timeout_event_rx(wmi, datap, len); - break; - case WMI_CMDERROR_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_CMDERROR_EVENTID\n"); - ret = ath6kl_wmi_error_event_rx(wmi, datap, len); - break; - case WMI_RSSI_THRESHOLD_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_RSSI_THRESHOLD_EVENTID\n"); - ret = ath6kl_wmi_rssi_threshold_event_rx(wmi, datap, len); - break; - case WMI_ERROR_REPORT_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_ERROR_REPORT_EVENTID\n"); - break; - case WMI_OPT_RX_FRAME_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_OPT_RX_FRAME_EVENTID\n"); - /* this event has been deprecated */ - break; - case WMI_REPORT_ROAM_TBL_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_REPORT_ROAM_TBL_EVENTID\n"); - ret = ath6kl_wmi_roam_tbl_event_rx(wmi, datap, len); - break; - case WMI_EXTENSION_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_EXTENSION_EVENTID\n"); - ret = ath6kl_wmi_control_rx_xtnd(wmi, skb); - break; - case WMI_CHANNEL_CHANGE_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_CHANNEL_CHANGE_EVENTID\n"); - break; - case WMI_REPORT_ROAM_DATA_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_REPORT_ROAM_DATA_EVENTID\n"); - break; - case WMI_TEST_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_TEST_EVENTID\n"); - ret = ath6kl_wmi_test_rx(wmi, datap, len); - break; - case WMI_GET_FIXRATES_CMDID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_GET_FIXRATES_CMDID\n"); - ret = ath6kl_wmi_ratemask_reply_rx(wmi, datap, len); - break; - case WMI_TX_RETRY_ERR_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_TX_RETRY_ERR_EVENTID\n"); - break; - case WMI_SNR_THRESHOLD_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_SNR_THRESHOLD_EVENTID\n"); - ret = ath6kl_wmi_snr_threshold_event_rx(wmi, datap, len); - break; - case WMI_LQ_THRESHOLD_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_LQ_THRESHOLD_EVENTID\n"); - break; - case WMI_APLIST_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_APLIST_EVENTID\n"); - ret = ath6kl_wmi_aplist_event_rx(wmi, datap, len); - break; - case WMI_GET_KEEPALIVE_CMDID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_GET_KEEPALIVE_CMDID\n"); - ret = ath6kl_wmi_keepalive_reply_rx(wmi, datap, len); - break; - case WMI_GET_WOW_LIST_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_GET_WOW_LIST_EVENTID\n"); - break; - case WMI_GET_PMKID_LIST_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_GET_PMKID_LIST_EVENTID\n"); - ret = ath6kl_wmi_get_pmkid_list_event_rx(wmi, datap, len); - break; - case WMI_SET_PARAMS_REPLY_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_SET_PARAMS_REPLY_EVENTID\n"); - break; - case WMI_ADDBA_RESP_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_ADDBA_RESP_EVENTID\n"); - break; - case WMI_REPORT_BTCOEX_CONFIG_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, - "WMI_REPORT_BTCOEX_CONFIG_EVENTID\n"); - break; - case WMI_REPORT_BTCOEX_STATS_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, - "WMI_REPORT_BTCOEX_STATS_EVENTID\n"); - break; - case WMI_TX_COMPLETE_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_TX_COMPLETE_EVENTID\n"); - ret = ath6kl_wmi_tx_complete_event_rx(datap, len); - break; - case WMI_P2P_CAPABILITIES_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_P2P_CAPABILITIES_EVENTID\n"); - ret = ath6kl_wmi_p2p_capabilities_event_rx(datap, len); - break; - case WMI_P2P_INFO_EVENTID: - ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_P2P_INFO_EVENTID\n"); - ret = ath6kl_wmi_p2p_info_event_rx(datap, len); - break; - default: - /* may be the event is interface specific */ - ret = ath6kl_wmi_proc_events_vif(wmi, if_idx, id, datap, len); - break; - } - - dev_kfree_skb(skb); - return ret; -} - -/* Control Path */ -int ath6kl_wmi_control_rx(struct wmi *wmi, struct sk_buff *skb) -{ - if (WARN_ON(skb == NULL)) - return -EINVAL; - - if (skb->len < sizeof(struct wmi_cmd_hdr)) { - ath6kl_err("bad packet 1\n"); - dev_kfree_skb(skb); - return -EINVAL; - } - - trace_ath6kl_wmi_event(skb->data, skb->len); - - return ath6kl_wmi_proc_events(wmi, skb); -} - -void ath6kl_wmi_reset(struct wmi *wmi) -{ - spin_lock_bh(&wmi->lock); - - wmi->fat_pipe_exist = 0; - memset(wmi->stream_exist_for_ac, 0, sizeof(wmi->stream_exist_for_ac)); - - spin_unlock_bh(&wmi->lock); -} - -void *ath6kl_wmi_init(struct ath6kl *dev) -{ - struct wmi *wmi; - - wmi = kzalloc(sizeof(struct wmi), GFP_KERNEL); - if (!wmi) - return NULL; - - spin_lock_init(&wmi->lock); - - wmi->parent_dev = dev; - - wmi->pwr_mode = REC_POWER; - - ath6kl_wmi_reset(wmi); - - return wmi; -} - -void ath6kl_wmi_shutdown(struct wmi *wmi) -{ - if (!wmi) - return; - - kfree(wmi->last_mgmt_tx_frame); - kfree(wmi); -} diff --git a/drivers/net/wireless/ath/ath6kl/wmi.h b/drivers/net/wireless/ath/ath6kl/wmi.h deleted file mode 100644 index b5f226503baf..000000000000 --- a/drivers/net/wireless/ath/ath6kl/wmi.h +++ /dev/null @@ -1,2732 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * This file contains the definitions of the WMI protocol specified in the - * Wireless Module Interface (WMI). It includes definitions of all the - * commands and events. Commands are messages from the host to the WM. - * Events and Replies are messages from the WM to the host. - */ - -#ifndef WMI_H -#define WMI_H - -#include - -#include "htc.h" - -#define HTC_PROTOCOL_VERSION 0x0002 -#define WMI_PROTOCOL_VERSION 0x0002 -#define WMI_CONTROL_MSG_MAX_LEN 256 -#define is_ethertype(type_or_len) ((type_or_len) >= 0x0600) - -#define IP_ETHERTYPE 0x0800 - -#define WMI_IMPLICIT_PSTREAM 0xFF -#define WMI_MAX_THINSTREAM 15 - -#define SSID_IE_LEN_INDEX 13 - -/* Host side link management data structures */ -#define SIG_QUALITY_THRESH_LVLS 6 -#define SIG_QUALITY_UPPER_THRESH_LVLS SIG_QUALITY_THRESH_LVLS -#define SIG_QUALITY_LOWER_THRESH_LVLS SIG_QUALITY_THRESH_LVLS - -#define A_BAND_24GHZ 0 -#define A_BAND_5GHZ 1 -#define ATH6KL_NUM_BANDS 2 - -/* in ms */ -#define WMI_IMPLICIT_PSTREAM_INACTIVITY_INT 5000 - -/* - * There are no signed versions of __le16 and __le32, so for a temporary - * solution come up with our own version. The idea is from fs/ntfs/types.h. - * - * Use a_ prefix so that it doesn't conflict if we get proper support to - * linux/types.h. - */ -typedef __s16 __bitwise a_sle16; -typedef __s32 __bitwise a_sle32; - -static inline a_sle32 a_cpu_to_sle32(s32 val) -{ - return (__force a_sle32) cpu_to_le32(val); -} - -static inline s32 a_sle32_to_cpu(a_sle32 val) -{ - return le32_to_cpu((__force __le32) val); -} - -static inline a_sle16 a_cpu_to_sle16(s16 val) -{ - return (__force a_sle16) cpu_to_le16(val); -} - -static inline s16 a_sle16_to_cpu(a_sle16 val) -{ - return le16_to_cpu((__force __le16) val); -} - -struct sq_threshold_params { - s16 upper_threshold[SIG_QUALITY_UPPER_THRESH_LVLS]; - s16 lower_threshold[SIG_QUALITY_LOWER_THRESH_LVLS]; - u32 upper_threshold_valid_count; - u32 lower_threshold_valid_count; - u32 polling_interval; - u8 weight; - u8 last_rssi; - u8 last_rssi_poll_event; -}; - -struct wmi_data_sync_bufs { - u8 traffic_class; - struct sk_buff *skb; -}; - -/* WMM stream classes */ -#define WMM_NUM_AC 4 -#define WMM_AC_BE 0 /* best effort */ -#define WMM_AC_BK 1 /* background */ -#define WMM_AC_VI 2 /* video */ -#define WMM_AC_VO 3 /* voice */ - -#define WMI_VOICE_USER_PRIORITY 0x7 - -struct wmi { - u16 stream_exist_for_ac[WMM_NUM_AC]; - u8 fat_pipe_exist; - struct ath6kl *parent_dev; - u8 pwr_mode; - - /* protects fat_pipe_exist and stream_exist_for_ac */ - spinlock_t lock; - enum htc_endpoint_id ep_id; - struct sq_threshold_params - sq_threshld[SIGNAL_QUALITY_METRICS_NUM_MAX]; - bool is_wmm_enabled; - u8 traffic_class; - bool is_probe_ssid; - - u8 *last_mgmt_tx_frame; - size_t last_mgmt_tx_frame_len; - u8 saved_pwr_mode; -}; - -struct host_app_area { - __le32 wmi_protocol_ver; -} __packed; - -enum wmi_msg_type { - DATA_MSGTYPE = 0x0, - CNTL_MSGTYPE, - SYNC_MSGTYPE, - OPT_MSGTYPE, -}; - -/* - * Macros for operating on WMI_DATA_HDR (info) field - */ - -#define WMI_DATA_HDR_MSG_TYPE_MASK 0x03 -#define WMI_DATA_HDR_MSG_TYPE_SHIFT 0 -#define WMI_DATA_HDR_UP_MASK 0x07 -#define WMI_DATA_HDR_UP_SHIFT 2 - -/* In AP mode, the same bit (b5) is used to indicate Power save state in - * the Rx dir and More data bit state in the tx direction. - */ -#define WMI_DATA_HDR_PS_MASK 0x1 -#define WMI_DATA_HDR_PS_SHIFT 5 - -#define WMI_DATA_HDR_MORE 0x20 - -enum wmi_data_hdr_data_type { - WMI_DATA_HDR_DATA_TYPE_802_3 = 0, - WMI_DATA_HDR_DATA_TYPE_802_11, - - /* used to be used for the PAL */ - WMI_DATA_HDR_DATA_TYPE_ACL, -}; - -/* Bitmap of data header flags */ -enum wmi_data_hdr_flags { - WMI_DATA_HDR_FLAGS_MORE = 0x1, - WMI_DATA_HDR_FLAGS_EOSP = 0x2, - WMI_DATA_HDR_FLAGS_UAPSD = 0x4, -}; - -#define WMI_DATA_HDR_DATA_TYPE_MASK 0x3 -#define WMI_DATA_HDR_DATA_TYPE_SHIFT 6 - -/* Macros for operating on WMI_DATA_HDR (info2) field */ -#define WMI_DATA_HDR_SEQNO_MASK 0xFFF -#define WMI_DATA_HDR_SEQNO_SHIFT 0 - -#define WMI_DATA_HDR_AMSDU_MASK 0x1 -#define WMI_DATA_HDR_AMSDU_SHIFT 12 - -#define WMI_DATA_HDR_META_MASK 0x7 -#define WMI_DATA_HDR_META_SHIFT 13 - -#define WMI_DATA_HDR_PAD_BEFORE_DATA_MASK 0xFF -#define WMI_DATA_HDR_PAD_BEFORE_DATA_SHIFT 0x8 - -/* Macros for operating on WMI_DATA_HDR (info3) field */ -#define WMI_DATA_HDR_IF_IDX_MASK 0xF - -#define WMI_DATA_HDR_TRIG 0x10 -#define WMI_DATA_HDR_EOSP 0x10 - -struct wmi_data_hdr { - s8 rssi; - - /* - * usage of 'info' field(8-bit): - * - * b1:b0 - WMI_MSG_TYPE - * b4:b3:b2 - UP(tid) - * b5 - Used in AP mode. - * More-data in tx dir, PS in rx. - * b7:b6 - Dot3 header(0), - * Dot11 Header(1), - * ACL data(2) - */ - u8 info; - - /* - * usage of 'info2' field(16-bit): - * - * b11:b0 - seq_no - * b12 - A-MSDU? - * b15:b13 - META_DATA_VERSION 0 - 7 - */ - __le16 info2; - - /* - * usage of info3, 16-bit: - * b3:b0 - Interface index - * b4 - uAPSD trigger in rx & EOSP in tx - * b15:b5 - Reserved - */ - __le16 info3; -} __packed; - -static inline u8 wmi_data_hdr_get_up(struct wmi_data_hdr *dhdr) -{ - return (dhdr->info >> WMI_DATA_HDR_UP_SHIFT) & WMI_DATA_HDR_UP_MASK; -} - -static inline void wmi_data_hdr_set_up(struct wmi_data_hdr *dhdr, - u8 usr_pri) -{ - dhdr->info &= ~(WMI_DATA_HDR_UP_MASK << WMI_DATA_HDR_UP_SHIFT); - dhdr->info |= usr_pri << WMI_DATA_HDR_UP_SHIFT; -} - -static inline u8 wmi_data_hdr_get_dot11(struct wmi_data_hdr *dhdr) -{ - u8 data_type; - - data_type = (dhdr->info >> WMI_DATA_HDR_DATA_TYPE_SHIFT) & - WMI_DATA_HDR_DATA_TYPE_MASK; - return (data_type == WMI_DATA_HDR_DATA_TYPE_802_11); -} - -static inline u16 wmi_data_hdr_get_seqno(struct wmi_data_hdr *dhdr) -{ - return (le16_to_cpu(dhdr->info2) >> WMI_DATA_HDR_SEQNO_SHIFT) & - WMI_DATA_HDR_SEQNO_MASK; -} - -static inline u8 wmi_data_hdr_is_amsdu(struct wmi_data_hdr *dhdr) -{ - return (le16_to_cpu(dhdr->info2) >> WMI_DATA_HDR_AMSDU_SHIFT) & - WMI_DATA_HDR_AMSDU_MASK; -} - -static inline u8 wmi_data_hdr_get_meta(struct wmi_data_hdr *dhdr) -{ - return (le16_to_cpu(dhdr->info2) >> WMI_DATA_HDR_META_SHIFT) & - WMI_DATA_HDR_META_MASK; -} - -static inline u8 wmi_data_hdr_get_if_idx(struct wmi_data_hdr *dhdr) -{ - return le16_to_cpu(dhdr->info3) & WMI_DATA_HDR_IF_IDX_MASK; -} - -/* Tx meta version definitions */ -#define WMI_MAX_TX_META_SZ 12 -#define WMI_META_VERSION_1 0x01 -#define WMI_META_VERSION_2 0x02 - -/* Flag to signal to FW to calculate TCP checksum */ -#define WMI_META_V2_FLAG_CSUM_OFFLOAD 0x01 - -struct wmi_tx_meta_v1 { - /* packet ID to identify the tx request */ - u8 pkt_id; - - /* rate policy to be used for the tx of this frame */ - u8 rate_plcy_id; -} __packed; - -struct wmi_tx_meta_v2 { - /* - * Offset from start of the WMI header for csum calculation to - * begin. - */ - u8 csum_start; - - /* offset from start of WMI header where final csum goes */ - u8 csum_dest; - - /* no of bytes over which csum is calculated */ - u8 csum_flags; -} __packed; - -struct wmi_rx_meta_v1 { - u8 status; - - /* rate index mapped to rate at which this packet was received. */ - u8 rix; - - /* rssi of packet */ - u8 rssi; - - /* rf channel during packet reception */ - u8 channel; - - __le16 flags; -} __packed; - -struct wmi_rx_meta_v2 { - __le16 csum; - - /* bit 0 set -partial csum valid bit 1 set -test mode */ - u8 csum_flags; -} __packed; - -#define WMI_CMD_HDR_IF_ID_MASK 0xF - -/* Control Path */ -struct wmi_cmd_hdr { - __le16 cmd_id; - - /* info1 - 16 bits - * b03:b00 - id - * b15:b04 - unused */ - __le16 info1; - - /* for alignment */ - __le16 reserved; -} __packed; - -static inline u8 wmi_cmd_hdr_get_if_idx(struct wmi_cmd_hdr *chdr) -{ - return le16_to_cpu(chdr->info1) & WMI_CMD_HDR_IF_ID_MASK; -} - -/* List of WMI commands */ -enum wmi_cmd_id { - WMI_CONNECT_CMDID = 0x0001, - WMI_RECONNECT_CMDID, - WMI_DISCONNECT_CMDID, - WMI_SYNCHRONIZE_CMDID, - WMI_CREATE_PSTREAM_CMDID, - WMI_DELETE_PSTREAM_CMDID, - /* WMI_START_SCAN_CMDID is to be deprecated. Use - * WMI_BEGIN_SCAN_CMDID instead. The new cmd supports P2P mgmt - * operations using station interface. - */ - WMI_START_SCAN_CMDID, - WMI_SET_SCAN_PARAMS_CMDID, - WMI_SET_BSS_FILTER_CMDID, - WMI_SET_PROBED_SSID_CMDID, /* 10 */ - WMI_SET_LISTEN_INT_CMDID, - WMI_SET_BMISS_TIME_CMDID, - WMI_SET_DISC_TIMEOUT_CMDID, - WMI_GET_CHANNEL_LIST_CMDID, - WMI_SET_BEACON_INT_CMDID, - WMI_GET_STATISTICS_CMDID, - WMI_SET_CHANNEL_PARAMS_CMDID, - WMI_SET_POWER_MODE_CMDID, - WMI_SET_IBSS_PM_CAPS_CMDID, - WMI_SET_POWER_PARAMS_CMDID, /* 20 */ - WMI_SET_POWERSAVE_TIMERS_POLICY_CMDID, - WMI_ADD_CIPHER_KEY_CMDID, - WMI_DELETE_CIPHER_KEY_CMDID, - WMI_ADD_KRK_CMDID, - WMI_DELETE_KRK_CMDID, - WMI_SET_PMKID_CMDID, - WMI_SET_TX_PWR_CMDID, - WMI_GET_TX_PWR_CMDID, - WMI_SET_ASSOC_INFO_CMDID, - WMI_ADD_BAD_AP_CMDID, /* 30 */ - WMI_DELETE_BAD_AP_CMDID, - WMI_SET_TKIP_COUNTERMEASURES_CMDID, - WMI_RSSI_THRESHOLD_PARAMS_CMDID, - WMI_TARGET_ERROR_REPORT_BITMASK_CMDID, - WMI_SET_ACCESS_PARAMS_CMDID, - WMI_SET_RETRY_LIMITS_CMDID, - WMI_SET_OPT_MODE_CMDID, - WMI_OPT_TX_FRAME_CMDID, - WMI_SET_VOICE_PKT_SIZE_CMDID, - WMI_SET_MAX_SP_LEN_CMDID, /* 40 */ - WMI_SET_ROAM_CTRL_CMDID, - WMI_GET_ROAM_TBL_CMDID, - WMI_GET_ROAM_DATA_CMDID, - WMI_ENABLE_RM_CMDID, - WMI_SET_MAX_OFFHOME_DURATION_CMDID, - WMI_EXTENSION_CMDID, /* Non-wireless extensions */ - WMI_SNR_THRESHOLD_PARAMS_CMDID, - WMI_LQ_THRESHOLD_PARAMS_CMDID, - WMI_SET_LPREAMBLE_CMDID, - WMI_SET_RTS_CMDID, /* 50 */ - WMI_CLR_RSSI_SNR_CMDID, - WMI_SET_FIXRATES_CMDID, - WMI_GET_FIXRATES_CMDID, - WMI_SET_AUTH_MODE_CMDID, - WMI_SET_REASSOC_MODE_CMDID, - WMI_SET_WMM_CMDID, - WMI_SET_WMM_TXOP_CMDID, - WMI_TEST_CMDID, - - /* COEX AR6002 only */ - WMI_SET_BT_STATUS_CMDID, - WMI_SET_BT_PARAMS_CMDID, /* 60 */ - - WMI_SET_KEEPALIVE_CMDID, - WMI_GET_KEEPALIVE_CMDID, - WMI_SET_APPIE_CMDID, - WMI_GET_APPIE_CMDID, - WMI_SET_WSC_STATUS_CMDID, - - /* Wake on Wireless */ - WMI_SET_HOST_SLEEP_MODE_CMDID, - WMI_SET_WOW_MODE_CMDID, - WMI_GET_WOW_LIST_CMDID, - WMI_ADD_WOW_PATTERN_CMDID, - WMI_DEL_WOW_PATTERN_CMDID, /* 70 */ - - WMI_SET_FRAMERATES_CMDID, - WMI_SET_AP_PS_CMDID, - WMI_SET_QOS_SUPP_CMDID, - WMI_SET_IE_CMDID, - - /* WMI_THIN_RESERVED_... mark the start and end - * values for WMI_THIN_RESERVED command IDs. These - * command IDs can be found in wmi_thin.h */ - WMI_THIN_RESERVED_START = 0x8000, - WMI_THIN_RESERVED_END = 0x8fff, - - /* Developer commands starts at 0xF000 */ - WMI_SET_BITRATE_CMDID = 0xF000, - WMI_GET_BITRATE_CMDID, - WMI_SET_WHALPARAM_CMDID, - WMI_SET_MAC_ADDRESS_CMDID, - WMI_SET_AKMP_PARAMS_CMDID, - WMI_SET_PMKID_LIST_CMDID, - WMI_GET_PMKID_LIST_CMDID, - WMI_ABORT_SCAN_CMDID, - WMI_SET_TARGET_EVENT_REPORT_CMDID, - - /* Unused */ - WMI_UNUSED1, - WMI_UNUSED2, - - /* AP mode commands */ - WMI_AP_HIDDEN_SSID_CMDID, - WMI_AP_SET_NUM_STA_CMDID, - WMI_AP_ACL_POLICY_CMDID, - WMI_AP_ACL_MAC_LIST_CMDID, - WMI_AP_CONFIG_COMMIT_CMDID, - WMI_AP_SET_MLME_CMDID, - WMI_AP_SET_PVB_CMDID, - WMI_AP_CONN_INACT_CMDID, - WMI_AP_PROT_SCAN_TIME_CMDID, - WMI_AP_SET_COUNTRY_CMDID, - WMI_AP_SET_DTIM_CMDID, - WMI_AP_MODE_STAT_CMDID, - - WMI_SET_IP_CMDID, - WMI_SET_PARAMS_CMDID, - WMI_SET_MCAST_FILTER_CMDID, - WMI_DEL_MCAST_FILTER_CMDID, - - WMI_ALLOW_AGGR_CMDID, - WMI_ADDBA_REQ_CMDID, - WMI_DELBA_REQ_CMDID, - WMI_SET_HT_CAP_CMDID, - WMI_SET_HT_OP_CMDID, - WMI_SET_TX_SELECT_RATES_CMDID, - WMI_SET_TX_SGI_PARAM_CMDID, - WMI_SET_RATE_POLICY_CMDID, - - WMI_HCI_CMD_CMDID, - WMI_RX_FRAME_FORMAT_CMDID, - WMI_SET_THIN_MODE_CMDID, - WMI_SET_BT_WLAN_CONN_PRECEDENCE_CMDID, - - WMI_AP_SET_11BG_RATESET_CMDID, - WMI_SET_PMK_CMDID, - WMI_MCAST_FILTER_CMDID, - - /* COEX CMDID AR6003 */ - WMI_SET_BTCOEX_FE_ANT_CMDID, - WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMDID, - WMI_SET_BTCOEX_SCO_CONFIG_CMDID, - WMI_SET_BTCOEX_A2DP_CONFIG_CMDID, - WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMDID, - WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMDID, - WMI_SET_BTCOEX_DEBUG_CMDID, - WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMDID, - WMI_GET_BTCOEX_STATS_CMDID, - WMI_GET_BTCOEX_CONFIG_CMDID, - - WMI_SET_DFS_ENABLE_CMDID, /* F034 */ - WMI_SET_DFS_MINRSSITHRESH_CMDID, - WMI_SET_DFS_MAXPULSEDUR_CMDID, - WMI_DFS_RADAR_DETECTED_CMDID, - - /* P2P commands */ - WMI_P2P_SET_CONFIG_CMDID, /* F038 */ - WMI_WPS_SET_CONFIG_CMDID, - WMI_SET_REQ_DEV_ATTR_CMDID, - WMI_P2P_FIND_CMDID, - WMI_P2P_STOP_FIND_CMDID, - WMI_P2P_GO_NEG_START_CMDID, - WMI_P2P_LISTEN_CMDID, - - WMI_CONFIG_TX_MAC_RULES_CMDID, /* F040 */ - WMI_SET_PROMISCUOUS_MODE_CMDID, - WMI_RX_FRAME_FILTER_CMDID, - WMI_SET_CHANNEL_CMDID, - - /* WAC commands */ - WMI_ENABLE_WAC_CMDID, - WMI_WAC_SCAN_REPLY_CMDID, - WMI_WAC_CTRL_REQ_CMDID, - WMI_SET_DIV_PARAMS_CMDID, - - WMI_GET_PMK_CMDID, - WMI_SET_PASSPHRASE_CMDID, - WMI_SEND_ASSOC_RES_CMDID, - WMI_SET_ASSOC_REQ_RELAY_CMDID, - - /* ACS command, consists of sub-commands */ - WMI_ACS_CTRL_CMDID, - WMI_SET_EXCESS_TX_RETRY_THRES_CMDID, - WMI_SET_TBD_TIME_CMDID, /*added for wmiconfig command for TBD */ - - /* Pktlog cmds */ - WMI_PKTLOG_ENABLE_CMDID, - WMI_PKTLOG_DISABLE_CMDID, - - /* More P2P Cmds */ - WMI_P2P_GO_NEG_REQ_RSP_CMDID, - WMI_P2P_GRP_INIT_CMDID, - WMI_P2P_GRP_FORMATION_DONE_CMDID, - WMI_P2P_INVITE_CMDID, - WMI_P2P_INVITE_REQ_RSP_CMDID, - WMI_P2P_PROV_DISC_REQ_CMDID, - WMI_P2P_SET_CMDID, - - WMI_GET_RFKILL_MODE_CMDID, - WMI_SET_RFKILL_MODE_CMDID, - WMI_AP_SET_APSD_CMDID, - WMI_AP_APSD_BUFFERED_TRAFFIC_CMDID, - - WMI_P2P_SDPD_TX_CMDID, /* F05C */ - WMI_P2P_STOP_SDPD_CMDID, - WMI_P2P_CANCEL_CMDID, - /* Ultra low power store / recall commands */ - WMI_STORERECALL_CONFIGURE_CMDID, - WMI_STORERECALL_RECALL_CMDID, - WMI_STORERECALL_HOST_READY_CMDID, - WMI_FORCE_TARGET_ASSERT_CMDID, - - WMI_SET_PROBED_SSID_EX_CMDID, - WMI_SET_NETWORK_LIST_OFFLOAD_CMDID, - WMI_SET_ARP_NS_OFFLOAD_CMDID, - WMI_ADD_WOW_EXT_PATTERN_CMDID, - WMI_GTK_OFFLOAD_OP_CMDID, - WMI_REMAIN_ON_CHNL_CMDID, - WMI_CANCEL_REMAIN_ON_CHNL_CMDID, - /* WMI_SEND_ACTION_CMDID is to be deprecated. Use - * WMI_SEND_MGMT_CMDID instead. The new cmd supports P2P mgmt - * operations using station interface. - */ - WMI_SEND_ACTION_CMDID, - WMI_PROBE_REQ_REPORT_CMDID, - WMI_DISABLE_11B_RATES_CMDID, - WMI_SEND_PROBE_RESPONSE_CMDID, - WMI_GET_P2P_INFO_CMDID, - WMI_AP_JOIN_BSS_CMDID, - - WMI_SMPS_ENABLE_CMDID, - WMI_SMPS_CONFIG_CMDID, - WMI_SET_RATECTRL_PARM_CMDID, - /* LPL specific commands*/ - WMI_LPL_FORCE_ENABLE_CMDID, - WMI_LPL_SET_POLICY_CMDID, - WMI_LPL_GET_POLICY_CMDID, - WMI_LPL_GET_HWSTATE_CMDID, - WMI_LPL_SET_PARAMS_CMDID, - WMI_LPL_GET_PARAMS_CMDID, - - WMI_SET_BUNDLE_PARAM_CMDID, - - /*GreenTx specific commands*/ - - WMI_GREENTX_PARAMS_CMDID, - - WMI_RTT_MEASREQ_CMDID, - WMI_RTT_CAPREQ_CMDID, - WMI_RTT_STATUSREQ_CMDID, - - /* WPS Commands */ - WMI_WPS_START_CMDID, - WMI_GET_WPS_STATUS_CMDID, - - /* More P2P commands */ - WMI_SET_NOA_CMDID, - WMI_GET_NOA_CMDID, - WMI_SET_OPPPS_CMDID, - WMI_GET_OPPPS_CMDID, - WMI_ADD_PORT_CMDID, - WMI_DEL_PORT_CMDID, - - /* 802.11w cmd */ - WMI_SET_RSN_CAP_CMDID, - WMI_GET_RSN_CAP_CMDID, - WMI_SET_IGTK_CMDID, - - WMI_RX_FILTER_COALESCE_FILTER_OP_CMDID, - WMI_RX_FILTER_SET_FRAME_TEST_LIST_CMDID, - - WMI_SEND_MGMT_CMDID, - WMI_BEGIN_SCAN_CMDID, - - WMI_SET_BLACK_LIST, - WMI_SET_MCASTRATE, - - WMI_STA_BMISS_ENHANCE_CMDID, - - WMI_SET_REGDOMAIN_CMDID, - - WMI_SET_RSSI_FILTER_CMDID, - - WMI_SET_KEEP_ALIVE_EXT, - - WMI_VOICE_DETECTION_ENABLE_CMDID, - - WMI_SET_TXE_NOTIFY_CMDID, - - WMI_SET_RECOVERY_TEST_PARAMETER_CMDID, /*0xf094*/ - - WMI_ENABLE_SCHED_SCAN_CMDID, -}; - -enum wmi_mgmt_frame_type { - WMI_FRAME_BEACON = 0, - WMI_FRAME_PROBE_REQ, - WMI_FRAME_PROBE_RESP, - WMI_FRAME_ASSOC_REQ, - WMI_FRAME_ASSOC_RESP, - WMI_NUM_MGMT_FRAME -}; - -enum wmi_ie_field_type { - WMI_RSN_IE_CAPB = 0x1, - WMI_IE_FULL = 0xFF, /* indicats full IE */ -}; - -/* WMI_CONNECT_CMDID */ -enum network_type { - INFRA_NETWORK = 0x01, - ADHOC_NETWORK = 0x02, - ADHOC_CREATOR = 0x04, - AP_NETWORK = 0x10, -}; - -enum network_subtype { - SUBTYPE_NONE, - SUBTYPE_BT, - SUBTYPE_P2PDEV, - SUBTYPE_P2PCLIENT, - SUBTYPE_P2PGO, -}; - -enum dot11_auth_mode { - OPEN_AUTH = 0x01, - SHARED_AUTH = 0x02, - - /* different from IEEE_AUTH_MODE definitions */ - LEAP_AUTH = 0x04, -}; - -enum auth_mode { - NONE_AUTH = 0x01, - WPA_AUTH = 0x02, - WPA2_AUTH = 0x04, - WPA_PSK_AUTH = 0x08, - WPA2_PSK_AUTH = 0x10, - WPA_AUTH_CCKM = 0x20, - WPA2_AUTH_CCKM = 0x40, -}; - -#define WMI_MAX_KEY_INDEX 3 - -#define WMI_MAX_KEY_LEN 32 - -/* - * NB: these values are ordered carefully; there are lots of - * of implications in any reordering. In particular beware - * that 4 is not used to avoid conflicting with IEEE80211_F_PRIVACY. - */ -#define ATH6KL_CIPHER_WEP 0 -#define ATH6KL_CIPHER_TKIP 1 -#define ATH6KL_CIPHER_AES_OCB 2 -#define ATH6KL_CIPHER_AES_CCM 3 -#define ATH6KL_CIPHER_CKIP 5 -#define ATH6KL_CIPHER_CCKM_KRK 6 -#define ATH6KL_CIPHER_NONE 7 /* pseudo value */ - -/* - * 802.11 rate set. - */ -#define ATH6KL_RATE_MAXSIZE 15 /* max rates we'll handle */ - -#define ATH_OUI_TYPE 0x01 -#define WPA_OUI_TYPE 0x01 -#define WMM_PARAM_OUI_SUBTYPE 0x01 -#define WMM_OUI_TYPE 0x02 -#define WSC_OUT_TYPE 0x04 - -enum wmi_connect_ctrl_flags_bits { - CONNECT_ASSOC_POLICY_USER = 0x0001, - CONNECT_SEND_REASSOC = 0x0002, - CONNECT_IGNORE_WPAx_GROUP_CIPHER = 0x0004, - CONNECT_PROFILE_MATCH_DONE = 0x0008, - CONNECT_IGNORE_AAC_BEACON = 0x0010, - CONNECT_CSA_FOLLOW_BSS = 0x0020, - CONNECT_DO_WPA_OFFLOAD = 0x0040, - CONNECT_DO_NOT_DEAUTH = 0x0080, - CONNECT_WPS_FLAG = 0x0100, -}; - -struct wmi_connect_cmd { - u8 nw_type; - u8 dot11_auth_mode; - u8 auth_mode; - u8 prwise_crypto_type; - u8 prwise_crypto_len; - u8 grp_crypto_type; - u8 grp_crypto_len; - u8 ssid_len; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - __le16 ch; - u8 bssid[ETH_ALEN]; - __le32 ctrl_flags; - u8 nw_subtype; -} __packed; - -/* WMI_RECONNECT_CMDID */ -struct wmi_reconnect_cmd { - /* channel hint */ - __le16 channel; - - /* mandatory if set */ - u8 bssid[ETH_ALEN]; -} __packed; - -/* WMI_ADD_CIPHER_KEY_CMDID */ -enum key_usage { - PAIRWISE_USAGE = 0x00, - GROUP_USAGE = 0x01, - - /* default Tx Key - static WEP only */ - TX_USAGE = 0x02, -}; - -/* - * Bit Flag - * Bit 0 - Initialise TSC - default is Initialize - */ -#define KEY_OP_INIT_TSC 0x01 -#define KEY_OP_INIT_RSC 0x02 - -/* default initialise the TSC & RSC */ -#define KEY_OP_INIT_VAL 0x03 -#define KEY_OP_VALID_MASK 0x03 - -struct wmi_add_cipher_key_cmd { - u8 key_index; - u8 key_type; - - /* enum key_usage */ - u8 key_usage; - - u8 key_len; - - /* key replay sequence counter */ - u8 key_rsc[8]; - - u8 key[WLAN_MAX_KEY_LEN]; - - /* additional key control info */ - u8 key_op_ctrl; - - u8 key_mac_addr[ETH_ALEN]; -} __packed; - -/* WMI_DELETE_CIPHER_KEY_CMDID */ -struct wmi_delete_cipher_key_cmd { - u8 key_index; -} __packed; - -#define WMI_KRK_LEN 16 - -/* WMI_ADD_KRK_CMDID */ -struct wmi_add_krk_cmd { - u8 krk[WMI_KRK_LEN]; -} __packed; - -/* WMI_SETPMKID_CMDID */ - -#define WMI_PMKID_LEN 16 - -enum pmkid_enable_flg { - PMKID_DISABLE = 0, - PMKID_ENABLE = 1, -}; - -struct wmi_setpmkid_cmd { - u8 bssid[ETH_ALEN]; - - /* enum pmkid_enable_flg */ - u8 enable; - - u8 pmkid[WMI_PMKID_LEN]; -} __packed; - -/* WMI_START_SCAN_CMD */ -enum wmi_scan_type { - WMI_LONG_SCAN = 0, - WMI_SHORT_SCAN = 1, -}; - -struct wmi_supp_rates { - u8 nrates; - u8 rates[ATH6KL_RATE_MAXSIZE]; -}; - -struct wmi_begin_scan_cmd { - __le32 force_fg_scan; - - /* for legacy cisco AP compatibility */ - __le32 is_legacy; - - /* max duration in the home channel(msec) */ - __le32 home_dwell_time; - - /* time interval between scans (msec) */ - __le32 force_scan_intvl; - - /* no CCK rates */ - __le32 no_cck; - - /* enum wmi_scan_type */ - u8 scan_type; - - /* Supported rates to advertise in the probe request frames */ - struct wmi_supp_rates supp_rates[ATH6KL_NUM_BANDS]; - - /* how many channels follow */ - u8 num_ch; - - /* channels in Mhz */ - __le16 ch_list[1]; -} __packed; - -/* wmi_start_scan_cmd is to be deprecated. Use - * wmi_begin_scan_cmd instead. The new structure supports P2P mgmt - * operations using station interface. - */ -struct wmi_start_scan_cmd { - __le32 force_fg_scan; - - /* for legacy cisco AP compatibility */ - __le32 is_legacy; - - /* max duration in the home channel(msec) */ - __le32 home_dwell_time; - - /* time interval between scans (msec) */ - __le32 force_scan_intvl; - - /* enum wmi_scan_type */ - u8 scan_type; - - /* how many channels follow */ - u8 num_ch; - - /* channels in Mhz */ - __le16 ch_list[1]; -} __packed; - -/* - * Warning: scan control flag value of 0xFF is used to disable - * all flags in WMI_SCAN_PARAMS_CMD. Do not add any more - * flags here - */ -enum wmi_scan_ctrl_flags_bits { - - /* set if can scan in the connect cmd */ - CONNECT_SCAN_CTRL_FLAGS = 0x01, - - /* set if scan for the SSID it is already connected to */ - SCAN_CONNECTED_CTRL_FLAGS = 0x02, - - /* set if enable active scan */ - ACTIVE_SCAN_CTRL_FLAGS = 0x04, - - /* set if enable roam scan when bmiss and lowrssi */ - ROAM_SCAN_CTRL_FLAGS = 0x08, - - /* set if follows customer BSSINFO reporting rule */ - REPORT_BSSINFO_CTRL_FLAGS = 0x10, - - /* if disabled, target doesn't scan after a disconnect event */ - ENABLE_AUTO_CTRL_FLAGS = 0x20, - - /* - * Scan complete event with canceled status will be generated when - * a scan is prempted before it gets completed. - */ - ENABLE_SCAN_ABORT_EVENT = 0x40 -}; - -struct wmi_scan_params_cmd { - /* sec */ - __le16 fg_start_period; - - /* sec */ - __le16 fg_end_period; - - /* sec */ - __le16 bg_period; - - /* msec */ - __le16 maxact_chdwell_time; - - /* msec */ - __le16 pas_chdwell_time; - - /* how many shorts scan for one long */ - u8 short_scan_ratio; - - u8 scan_ctrl_flags; - - /* msec */ - __le16 minact_chdwell_time; - - /* max active scans per ssid */ - __le16 maxact_scan_per_ssid; - - /* msecs */ - __le32 max_dfsch_act_time; -} __packed; - -/* WMI_ENABLE_SCHED_SCAN_CMDID */ -struct wmi_enable_sched_scan_cmd { - u8 enable; -} __packed; - -/* WMI_SET_BSS_FILTER_CMDID */ -enum wmi_bss_filter { - /* no beacons forwarded */ - NONE_BSS_FILTER = 0x0, - - /* all beacons forwarded */ - ALL_BSS_FILTER, - - /* only beacons matching profile */ - PROFILE_FILTER, - - /* all but beacons matching profile */ - ALL_BUT_PROFILE_FILTER, - - /* only beacons matching current BSS */ - CURRENT_BSS_FILTER, - - /* all but beacons matching BSS */ - ALL_BUT_BSS_FILTER, - - /* beacons matching probed ssid */ - PROBED_SSID_FILTER, - - /* beacons matching matched ssid */ - MATCHED_SSID_FILTER, - - /* marker only */ - LAST_BSS_FILTER, -}; - -struct wmi_bss_filter_cmd { - /* see, enum wmi_bss_filter */ - u8 bss_filter; - - /* for alignment */ - u8 reserved1; - - /* for alignment */ - __le16 reserved2; - - __le32 ie_mask; -} __packed; - -/* WMI_SET_PROBED_SSID_CMDID */ -#define MAX_PROBED_SSIDS 16 - -enum wmi_ssid_flag { - /* disables entry */ - DISABLE_SSID_FLAG = 0, - - /* probes specified ssid */ - SPECIFIC_SSID_FLAG = 0x01, - - /* probes for any ssid */ - ANY_SSID_FLAG = 0x02, - - /* match for ssid */ - MATCH_SSID_FLAG = 0x08, -}; - -struct wmi_probed_ssid_cmd { - /* 0 to MAX_PROBED_SSIDS - 1 */ - u8 entry_index; - - /* see, enum wmi_ssid_flg */ - u8 flag; - - u8 ssid_len; - u8 ssid[IEEE80211_MAX_SSID_LEN]; -} __packed; - -/* - * WMI_SET_LISTEN_INT_CMDID - * The Listen interval is between 15 and 3000 TUs - */ -struct wmi_listen_int_cmd { - __le16 listen_intvl; - __le16 num_beacons; -} __packed; - -/* WMI_SET_BMISS_TIME_CMDID */ -struct wmi_bmiss_time_cmd { - __le16 bmiss_time; - __le16 num_beacons; -}; - -/* WMI_STA_ENHANCE_BMISS_CMDID */ -struct wmi_sta_bmiss_enhance_cmd { - u8 enable; -} __packed; - -struct wmi_set_regdomain_cmd { - u8 length; - u8 iso_name[2]; -} __packed; - -/* WMI_SET_POWER_MODE_CMDID */ -enum wmi_power_mode { - REC_POWER = 0x01, - MAX_PERF_POWER, -}; - -struct wmi_power_mode_cmd { - /* see, enum wmi_power_mode */ - u8 pwr_mode; -} __packed; - -/* - * Policy to determnine whether power save failure event should be sent to - * host during scanning - */ -enum power_save_fail_event_policy { - SEND_POWER_SAVE_FAIL_EVENT_ALWAYS = 1, - IGNORE_PS_FAIL_DURING_SCAN = 2, -}; - -struct wmi_power_params_cmd { - /* msec */ - __le16 idle_period; - - __le16 pspoll_number; - __le16 dtim_policy; - __le16 tx_wakeup_policy; - __le16 num_tx_to_wakeup; - __le16 ps_fail_event_policy; -} __packed; - -/* - * Ratemask for below modes should be passed - * to WMI_SET_TX_SELECT_RATES_CMDID. - * AR6003 has 32 bit mask for each modes. - * First 12 bits for legacy rates, 13 to 20 - * bits for HT 20 rates and 21 to 28 bits for - * HT 40 rates - */ -enum wmi_mode_phy { - WMI_RATES_MODE_11A = 0, - WMI_RATES_MODE_11G, - WMI_RATES_MODE_11B, - WMI_RATES_MODE_11GONLY, - WMI_RATES_MODE_11A_HT20, - WMI_RATES_MODE_11G_HT20, - WMI_RATES_MODE_11A_HT40, - WMI_RATES_MODE_11G_HT40, - WMI_RATES_MODE_MAX -}; - -/* WMI_SET_TX_SELECT_RATES_CMDID */ -struct wmi_set_tx_select_rates32_cmd { - __le32 ratemask[WMI_RATES_MODE_MAX]; -} __packed; - -/* WMI_SET_TX_SELECT_RATES_CMDID */ -struct wmi_set_tx_select_rates64_cmd { - __le64 ratemask[WMI_RATES_MODE_MAX]; -} __packed; - -/* WMI_SET_DISC_TIMEOUT_CMDID */ -struct wmi_disc_timeout_cmd { - /* seconds */ - u8 discon_timeout; -} __packed; - -enum dir_type { - UPLINK_TRAFFIC = 0, - DNLINK_TRAFFIC = 1, - BIDIR_TRAFFIC = 2, -}; - -enum voiceps_cap_type { - DISABLE_FOR_THIS_AC = 0, - ENABLE_FOR_THIS_AC = 1, - ENABLE_FOR_ALL_AC = 2, -}; - -enum traffic_type { - TRAFFIC_TYPE_APERIODIC = 0, - TRAFFIC_TYPE_PERIODIC = 1, -}; - -/* WMI_SYNCHRONIZE_CMDID */ -struct wmi_sync_cmd { - u8 data_sync_map; -} __packed; - -/* WMI_CREATE_PSTREAM_CMDID */ -struct wmi_create_pstream_cmd { - /* msec */ - __le32 min_service_int; - - /* msec */ - __le32 max_service_int; - - /* msec */ - __le32 inactivity_int; - - /* msec */ - __le32 suspension_int; - - __le32 service_start_time; - - /* in bps */ - __le32 min_data_rate; - - /* in bps */ - __le32 mean_data_rate; - - /* in bps */ - __le32 peak_data_rate; - - __le32 max_burst_size; - __le32 delay_bound; - - /* in bps */ - __le32 min_phy_rate; - - __le32 sba; - __le32 medium_time; - - /* in octects */ - __le16 nominal_msdu; - - /* in octects */ - __le16 max_msdu; - - u8 traffic_class; - - /* see, enum dir_type */ - u8 traffic_direc; - - u8 rx_queue_num; - - /* see, enum traffic_type */ - u8 traffic_type; - - /* see, enum voiceps_cap_type */ - u8 voice_psc_cap; - u8 tsid; - - /* 802.1D user priority */ - u8 user_pri; - - /* nominal phy rate */ - u8 nominal_phy; -} __packed; - -/* WMI_DELETE_PSTREAM_CMDID */ -struct wmi_delete_pstream_cmd { - u8 tx_queue_num; - u8 rx_queue_num; - u8 traffic_direc; - u8 traffic_class; - u8 tsid; -} __packed; - -/* WMI_SET_CHANNEL_PARAMS_CMDID */ -enum wmi_phy_mode { - WMI_11A_MODE = 0x1, - WMI_11G_MODE = 0x2, - WMI_11AG_MODE = 0x3, - WMI_11B_MODE = 0x4, - WMI_11GONLY_MODE = 0x5, - WMI_11G_HT20 = 0x6, -}; - -#define WMI_MAX_CHANNELS 32 - -/* - * WMI_RSSI_THRESHOLD_PARAMS_CMDID - * Setting the polltime to 0 would disable polling. Threshold values are - * in the ascending order, and should agree to: - * (lowThreshold_lowerVal < lowThreshold_upperVal < highThreshold_lowerVal - * < highThreshold_upperVal) - */ - -struct wmi_rssi_threshold_params_cmd { - /* polling time as a factor of LI */ - __le32 poll_time; - - /* lowest of upper */ - a_sle16 thresh_above1_val; - - a_sle16 thresh_above2_val; - a_sle16 thresh_above3_val; - a_sle16 thresh_above4_val; - a_sle16 thresh_above5_val; - - /* highest of upper */ - a_sle16 thresh_above6_val; - - /* lowest of bellow */ - a_sle16 thresh_below1_val; - - a_sle16 thresh_below2_val; - a_sle16 thresh_below3_val; - a_sle16 thresh_below4_val; - a_sle16 thresh_below5_val; - - /* highest of bellow */ - a_sle16 thresh_below6_val; - - /* "alpha" */ - u8 weight; - - u8 reserved[3]; -} __packed; - -/* - * WMI_SNR_THRESHOLD_PARAMS_CMDID - * Setting the polltime to 0 would disable polling. - */ - -struct wmi_snr_threshold_params_cmd { - /* polling time as a factor of LI */ - __le32 poll_time; - - /* "alpha" */ - u8 weight; - - /* lowest of uppper */ - u8 thresh_above1_val; - - u8 thresh_above2_val; - u8 thresh_above3_val; - - /* highest of upper */ - u8 thresh_above4_val; - - /* lowest of bellow */ - u8 thresh_below1_val; - - u8 thresh_below2_val; - u8 thresh_below3_val; - - /* highest of bellow */ - u8 thresh_below4_val; - - u8 reserved[3]; -} __packed; - -/* Don't report BSSs with signal (RSSI) below this threshold */ -struct wmi_set_rssi_filter_cmd { - s8 rssi; -} __packed; - -enum wmi_preamble_policy { - WMI_IGNORE_BARKER_IN_ERP = 0, - WMI_FOLLOW_BARKER_IN_ERP, -}; - -struct wmi_set_lpreamble_cmd { - u8 status; - u8 preamble_policy; -} __packed; - -struct wmi_set_rts_cmd { - __le16 threshold; -} __packed; - -/* WMI_SET_TX_PWR_CMDID */ -struct wmi_set_tx_pwr_cmd { - /* in dbM units */ - u8 dbM; -} __packed; - -struct wmi_tx_pwr_reply { - /* in dbM units */ - u8 dbM; -} __packed; - -struct wmi_report_sleep_state_event { - __le32 sleep_state; -}; - -enum wmi_report_sleep_status { - WMI_REPORT_SLEEP_STATUS_IS_DEEP_SLEEP = 0, - WMI_REPORT_SLEEP_STATUS_IS_AWAKE -}; -enum target_event_report_config { - /* default */ - DISCONN_EVT_IN_RECONN = 0, - - NO_DISCONN_EVT_IN_RECONN -}; - -struct wmi_mcast_filter_cmd { - u8 mcast_all_enable; -} __packed; - -#define ATH6KL_MCAST_FILTER_MAC_ADDR_SIZE 6 -struct wmi_mcast_filter_add_del_cmd { - u8 mcast_mac[ATH6KL_MCAST_FILTER_MAC_ADDR_SIZE]; -} __packed; - -struct wmi_set_htcap_cmd { - u8 band; - u8 ht_enable; - u8 ht40_supported; - u8 ht20_sgi; - u8 ht40_sgi; - u8 intolerant_40mhz; - u8 max_ampdu_len_exp; -} __packed; - -/* Command Replies */ - -/* WMI_GET_CHANNEL_LIST_CMDID reply */ -struct wmi_channel_list_reply { - u8 reserved; - - /* number of channels in reply */ - u8 num_ch; - - /* channel in Mhz */ - __le16 ch_list[1]; -} __packed; - -/* List of Events (target to host) */ -enum wmi_event_id { - WMI_READY_EVENTID = 0x1001, - WMI_CONNECT_EVENTID, - WMI_DISCONNECT_EVENTID, - WMI_BSSINFO_EVENTID, - WMI_CMDERROR_EVENTID, - WMI_REGDOMAIN_EVENTID, - WMI_PSTREAM_TIMEOUT_EVENTID, - WMI_NEIGHBOR_REPORT_EVENTID, - WMI_TKIP_MICERR_EVENTID, - WMI_SCAN_COMPLETE_EVENTID, /* 0x100a */ - WMI_REPORT_STATISTICS_EVENTID, - WMI_RSSI_THRESHOLD_EVENTID, - WMI_ERROR_REPORT_EVENTID, - WMI_OPT_RX_FRAME_EVENTID, - WMI_REPORT_ROAM_TBL_EVENTID, - WMI_EXTENSION_EVENTID, - WMI_CAC_EVENTID, - WMI_SNR_THRESHOLD_EVENTID, - WMI_LQ_THRESHOLD_EVENTID, - WMI_TX_RETRY_ERR_EVENTID, /* 0x1014 */ - WMI_REPORT_ROAM_DATA_EVENTID, - WMI_TEST_EVENTID, - WMI_APLIST_EVENTID, - WMI_GET_WOW_LIST_EVENTID, - WMI_GET_PMKID_LIST_EVENTID, - WMI_CHANNEL_CHANGE_EVENTID, - WMI_PEER_NODE_EVENTID, - WMI_PSPOLL_EVENTID, - WMI_DTIMEXPIRY_EVENTID, - WMI_WLAN_VERSION_EVENTID, - WMI_SET_PARAMS_REPLY_EVENTID, - WMI_ADDBA_REQ_EVENTID, /*0x1020 */ - WMI_ADDBA_RESP_EVENTID, - WMI_DELBA_REQ_EVENTID, - WMI_TX_COMPLETE_EVENTID, - WMI_HCI_EVENT_EVENTID, - WMI_ACL_DATA_EVENTID, - WMI_REPORT_SLEEP_STATE_EVENTID, - WMI_REPORT_BTCOEX_STATS_EVENTID, - WMI_REPORT_BTCOEX_CONFIG_EVENTID, - WMI_GET_PMK_EVENTID, - - /* DFS Events */ - WMI_DFS_HOST_ATTACH_EVENTID, - WMI_DFS_HOST_INIT_EVENTID, - WMI_DFS_RESET_DELAYLINES_EVENTID, - WMI_DFS_RESET_RADARQ_EVENTID, - WMI_DFS_RESET_AR_EVENTID, - WMI_DFS_RESET_ARQ_EVENTID, - WMI_DFS_SET_DUR_MULTIPLIER_EVENTID, - WMI_DFS_SET_BANGRADAR_EVENTID, - WMI_DFS_SET_DEBUGLEVEL_EVENTID, - WMI_DFS_PHYERR_EVENTID, - - /* CCX Evants */ - WMI_CCX_RM_STATUS_EVENTID, - - /* P2P Events */ - WMI_P2P_GO_NEG_RESULT_EVENTID, - - WMI_WAC_SCAN_DONE_EVENTID, - WMI_WAC_REPORT_BSS_EVENTID, - WMI_WAC_START_WPS_EVENTID, - WMI_WAC_CTRL_REQ_REPLY_EVENTID, - - WMI_REPORT_WMM_PARAMS_EVENTID, - WMI_WAC_REJECT_WPS_EVENTID, - - /* More P2P Events */ - WMI_P2P_GO_NEG_REQ_EVENTID, - WMI_P2P_INVITE_REQ_EVENTID, - WMI_P2P_INVITE_RCVD_RESULT_EVENTID, - WMI_P2P_INVITE_SENT_RESULT_EVENTID, - WMI_P2P_PROV_DISC_RESP_EVENTID, - WMI_P2P_PROV_DISC_REQ_EVENTID, - - /* RFKILL Events */ - WMI_RFKILL_STATE_CHANGE_EVENTID, - WMI_RFKILL_GET_MODE_CMD_EVENTID, - - WMI_P2P_START_SDPD_EVENTID, - WMI_P2P_SDPD_RX_EVENTID, - - WMI_SET_HOST_SLEEP_MODE_CMD_PROCESSED_EVENTID = 0x1047, - - WMI_THIN_RESERVED_START_EVENTID = 0x8000, - /* Events in this range are reserved for thinmode */ - WMI_THIN_RESERVED_END_EVENTID = 0x8fff, - - WMI_SET_CHANNEL_EVENTID, - WMI_ASSOC_REQ_EVENTID, - - /* Generic ACS event */ - WMI_ACS_EVENTID, - WMI_STORERECALL_STORE_EVENTID, - WMI_WOW_EXT_WAKE_EVENTID, - WMI_GTK_OFFLOAD_STATUS_EVENTID, - WMI_NETWORK_LIST_OFFLOAD_EVENTID, - WMI_REMAIN_ON_CHNL_EVENTID, - WMI_CANCEL_REMAIN_ON_CHNL_EVENTID, - WMI_TX_STATUS_EVENTID, - WMI_RX_PROBE_REQ_EVENTID, - WMI_P2P_CAPABILITIES_EVENTID, - WMI_RX_ACTION_EVENTID, - WMI_P2P_INFO_EVENTID, - - /* WPS Events */ - WMI_WPS_GET_STATUS_EVENTID, - WMI_WPS_PROFILE_EVENTID, - - /* more P2P events */ - WMI_NOA_INFO_EVENTID, - WMI_OPPPS_INFO_EVENTID, - WMI_PORT_STATUS_EVENTID, - - /* 802.11w */ - WMI_GET_RSN_CAP_EVENTID, - - WMI_TXE_NOTIFY_EVENTID, -}; - -struct wmi_ready_event_2 { - __le32 sw_version; - __le32 abi_version; - u8 mac_addr[ETH_ALEN]; - u8 phy_cap; -} __packed; - -/* WMI_PHY_CAPABILITY */ -enum wmi_phy_cap { - WMI_11A_CAP = 0x01, - WMI_11G_CAP = 0x02, - WMI_11AG_CAP = 0x03, - WMI_11AN_CAP = 0x04, - WMI_11GN_CAP = 0x05, - WMI_11AGN_CAP = 0x06, -}; - -/* Connect Event */ -struct wmi_connect_event { - union { - struct { - __le16 ch; - u8 bssid[ETH_ALEN]; - __le16 listen_intvl; - __le16 beacon_intvl; - __le32 nw_type; - } sta; - struct { - u8 phymode; - u8 aid; - u8 mac_addr[ETH_ALEN]; - u8 auth; - u8 keymgmt; - __le16 cipher; - u8 apsd_info; - u8 unused[3]; - } ap_sta; - struct { - __le16 ch; - u8 bssid[ETH_ALEN]; - u8 unused[8]; - } ap_bss; - } u; - u8 beacon_ie_len; - u8 assoc_req_len; - u8 assoc_resp_len; - u8 assoc_info[1]; -} __packed; - -/* Disconnect Event */ -enum wmi_disconnect_reason { - NO_NETWORK_AVAIL = 0x01, - - /* bmiss */ - LOST_LINK = 0x02, - - DISCONNECT_CMD = 0x03, - BSS_DISCONNECTED = 0x04, - AUTH_FAILED = 0x05, - ASSOC_FAILED = 0x06, - NO_RESOURCES_AVAIL = 0x07, - CSERV_DISCONNECT = 0x08, - INVALID_PROFILE = 0x0a, - DOT11H_CHANNEL_SWITCH = 0x0b, - PROFILE_MISMATCH = 0x0c, - CONNECTION_EVICTED = 0x0d, - IBSS_MERGE = 0xe, -}; - -/* AP mode disconnect proto_reasons */ -enum ap_disconnect_reason { - WMI_AP_REASON_STA_LEFT = 101, - WMI_AP_REASON_FROM_HOST = 102, - WMI_AP_REASON_COMM_TIMEOUT = 103, - WMI_AP_REASON_MAX_STA = 104, - WMI_AP_REASON_ACL = 105, - WMI_AP_REASON_STA_ROAM = 106, - WMI_AP_REASON_DFS_CHANNEL = 107, -}; - -#define ATH6KL_COUNTRY_RD_SHIFT 16 - -struct ath6kl_wmi_regdomain { - __le32 reg_code; -}; - -struct wmi_disconnect_event { - /* reason code, see 802.11 spec. */ - __le16 proto_reason_status; - - /* set if known */ - u8 bssid[ETH_ALEN]; - - /* see WMI_DISCONNECT_REASON */ - u8 disconn_reason; - - u8 assoc_resp_len; - u8 assoc_info[1]; -} __packed; - -/* - * BSS Info Event. - * Mechanism used to inform host of the presence and characteristic of - * wireless networks present. Consists of bss info header followed by - * the beacon or probe-response frame body. The 802.11 header is no included. - */ -enum wmi_bi_ftype { - BEACON_FTYPE = 0x1, - PROBERESP_FTYPE, - ACTION_MGMT_FTYPE, - PROBEREQ_FTYPE, -}; - -#define DEF_LRSSI_SCAN_PERIOD 5 -#define DEF_LRSSI_ROAM_THRESHOLD 20 -#define DEF_LRSSI_ROAM_FLOOR 60 -#define DEF_SCAN_FOR_ROAM_INTVL 2 - -enum wmi_roam_ctrl { - WMI_FORCE_ROAM = 1, - WMI_SET_ROAM_MODE, - WMI_SET_HOST_BIAS, - WMI_SET_LRSSI_SCAN_PARAMS, -}; - -enum wmi_roam_mode { - WMI_DEFAULT_ROAM_MODE = 1, /* RSSI based roam */ - WMI_HOST_BIAS_ROAM_MODE = 2, /* Host bias based roam */ - WMI_LOCK_BSS_MODE = 3, /* Lock to the current BSS */ -}; - -struct bss_bias { - u8 bssid[ETH_ALEN]; - s8 bias; -} __packed; - -struct bss_bias_info { - u8 num_bss; - struct bss_bias bss_bias[0]; -} __packed; - -struct low_rssi_scan_params { - __le16 lrssi_scan_period; - a_sle16 lrssi_scan_threshold; - a_sle16 lrssi_roam_threshold; - u8 roam_rssi_floor; - u8 reserved[1]; -} __packed; - -struct roam_ctrl_cmd { - union { - u8 bssid[ETH_ALEN]; /* WMI_FORCE_ROAM */ - u8 roam_mode; /* WMI_SET_ROAM_MODE */ - struct bss_bias_info bss; /* WMI_SET_HOST_BIAS */ - struct low_rssi_scan_params params; /* WMI_SET_LRSSI_SCAN_PARAMS - */ - } __packed info; - u8 roam_ctrl; -} __packed; - -struct set_beacon_int_cmd { - __le32 beacon_intvl; -} __packed; - -struct set_dtim_cmd { - __le32 dtim_period; -} __packed; - -/* BSS INFO HDR version 2.0 */ -struct wmi_bss_info_hdr2 { - __le16 ch; /* frequency in MHz */ - - /* see, enum wmi_bi_ftype */ - u8 frame_type; - - u8 snr; /* note: rssi = snr - 95 dBm */ - u8 bssid[ETH_ALEN]; - __le16 ie_mask; -} __packed; - -/* Command Error Event */ -enum wmi_error_code { - INVALID_PARAM = 0x01, - ILLEGAL_STATE = 0x02, - INTERNAL_ERROR = 0x03, -}; - -struct wmi_cmd_error_event { - __le16 cmd_id; - u8 err_code; -} __packed; - -struct wmi_pstream_timeout_event { - u8 tx_queue_num; - u8 rx_queue_num; - u8 traffic_direc; - u8 traffic_class; -} __packed; - -/* - * The WMI_NEIGHBOR_REPORT Event is generated by the target to inform - * the host of BSS's it has found that matches the current profile. - * It can be used by the host to cache PMKs and/to initiate pre-authentication - * if the BSS supports it. The first bssid is always the current associated - * BSS. - * The bssid and bssFlags information repeats according to the number - * or APs reported. - */ -enum wmi_bss_flags { - WMI_DEFAULT_BSS_FLAGS = 0x00, - WMI_PREAUTH_CAPABLE_BSS = 0x01, - WMI_PMKID_VALID_BSS = 0x02, -}; - -struct wmi_neighbor_info { - u8 bssid[ETH_ALEN]; - u8 bss_flags; /* enum wmi_bss_flags */ -} __packed; - -struct wmi_neighbor_report_event { - u8 num_neighbors; - struct wmi_neighbor_info neighbor[0]; -} __packed; - -/* TKIP MIC Error Event */ -struct wmi_tkip_micerr_event { - u8 key_id; - u8 is_mcast; -} __packed; - -enum wmi_scan_status { - WMI_SCAN_STATUS_SUCCESS = 0, -}; - -/* WMI_SCAN_COMPLETE_EVENTID */ -struct wmi_scan_complete_event { - a_sle32 status; -} __packed; - -#define MAX_OPT_DATA_LEN 1400 - -/* - * Special frame receive Event. - * Mechanism used to inform host of the receiption of the special frames. - * Consists of special frame info header followed by special frame body. - * The 802.11 header is not included. - */ -struct wmi_opt_rx_info_hdr { - __le16 ch; - u8 frame_type; - s8 snr; - u8 src_addr[ETH_ALEN]; - u8 bssid[ETH_ALEN]; -} __packed; - -/* Reporting statistic */ -struct tx_stats { - __le32 pkt; - __le32 byte; - __le32 ucast_pkt; - __le32 ucast_byte; - __le32 mcast_pkt; - __le32 mcast_byte; - __le32 bcast_pkt; - __le32 bcast_byte; - __le32 rts_success_cnt; - __le32 pkt_per_ac[4]; - __le32 err_per_ac[4]; - - __le32 err; - __le32 fail_cnt; - __le32 retry_cnt; - __le32 mult_retry_cnt; - __le32 rts_fail_cnt; - a_sle32 ucast_rate; -} __packed; - -struct rx_stats { - __le32 pkt; - __le32 byte; - __le32 ucast_pkt; - __le32 ucast_byte; - __le32 mcast_pkt; - __le32 mcast_byte; - __le32 bcast_pkt; - __le32 bcast_byte; - __le32 frgment_pkt; - - __le32 err; - __le32 crc_err; - __le32 key_cache_miss; - __le32 decrypt_err; - __le32 dupl_frame; - a_sle32 ucast_rate; -} __packed; - -#define RATE_INDEX_WITHOUT_SGI_MASK 0x7f -#define RATE_INDEX_MSB 0x80 - -struct tkip_ccmp_stats { - __le32 tkip_local_mic_fail; - __le32 tkip_cnter_measures_invoked; - __le32 tkip_replays; - __le32 tkip_fmt_err; - __le32 ccmp_fmt_err; - __le32 ccmp_replays; -} __packed; - -struct pm_stats { - __le32 pwr_save_failure_cnt; - __le16 stop_tx_failure_cnt; - __le16 atim_tx_failure_cnt; - __le16 atim_rx_failure_cnt; - __le16 bcn_rx_failure_cnt; -} __packed; - -struct cserv_stats { - __le32 cs_bmiss_cnt; - __le32 cs_low_rssi_cnt; - __le16 cs_connect_cnt; - __le16 cs_discon_cnt; - a_sle16 cs_ave_beacon_rssi; - __le16 cs_roam_count; - a_sle16 cs_rssi; - u8 cs_snr; - u8 cs_ave_beacon_snr; - u8 cs_last_roam_msec; -} __packed; - -struct wlan_net_stats { - struct tx_stats tx; - struct rx_stats rx; - struct tkip_ccmp_stats tkip_ccmp_stats; -} __packed; - -struct arp_stats { - __le32 arp_received; - __le32 arp_matched; - __le32 arp_replied; -} __packed; - -struct wlan_wow_stats { - __le32 wow_pkt_dropped; - __le16 wow_evt_discarded; - u8 wow_host_pkt_wakeups; - u8 wow_host_evt_wakeups; -} __packed; - -struct wmi_target_stats { - __le32 lq_val; - a_sle32 noise_floor_calib; - struct pm_stats pm_stats; - struct wlan_net_stats stats; - struct wlan_wow_stats wow_stats; - struct arp_stats arp_stats; - struct cserv_stats cserv_stats; -} __packed; - -/* - * WMI_RSSI_THRESHOLD_EVENTID. - * Indicate the RSSI events to host. Events are indicated when we breach a - * thresold value. - */ -enum wmi_rssi_threshold_val { - WMI_RSSI_THRESHOLD1_ABOVE = 0, - WMI_RSSI_THRESHOLD2_ABOVE, - WMI_RSSI_THRESHOLD3_ABOVE, - WMI_RSSI_THRESHOLD4_ABOVE, - WMI_RSSI_THRESHOLD5_ABOVE, - WMI_RSSI_THRESHOLD6_ABOVE, - WMI_RSSI_THRESHOLD1_BELOW, - WMI_RSSI_THRESHOLD2_BELOW, - WMI_RSSI_THRESHOLD3_BELOW, - WMI_RSSI_THRESHOLD4_BELOW, - WMI_RSSI_THRESHOLD5_BELOW, - WMI_RSSI_THRESHOLD6_BELOW -}; - -struct wmi_rssi_threshold_event { - a_sle16 rssi; - u8 range; -} __packed; - -enum wmi_snr_threshold_val { - WMI_SNR_THRESHOLD1_ABOVE = 1, - WMI_SNR_THRESHOLD1_BELOW, - WMI_SNR_THRESHOLD2_ABOVE, - WMI_SNR_THRESHOLD2_BELOW, - WMI_SNR_THRESHOLD3_ABOVE, - WMI_SNR_THRESHOLD3_BELOW, - WMI_SNR_THRESHOLD4_ABOVE, - WMI_SNR_THRESHOLD4_BELOW -}; - -struct wmi_snr_threshold_event { - /* see, enum wmi_snr_threshold_val */ - u8 range; - - u8 snr; -} __packed; - -/* WMI_REPORT_ROAM_TBL_EVENTID */ -#define MAX_ROAM_TBL_CAND 5 - -struct wmi_bss_roam_info { - a_sle32 roam_util; - u8 bssid[ETH_ALEN]; - s8 rssi; - s8 rssidt; - s8 last_rssi; - s8 util; - s8 bias; - - /* for alignment */ - u8 reserved; -} __packed; - -struct wmi_target_roam_tbl { - __le16 roam_mode; - __le16 num_entries; - struct wmi_bss_roam_info info[]; -} __packed; - -/* WMI_CAC_EVENTID */ -enum cac_indication { - CAC_INDICATION_ADMISSION = 0x00, - CAC_INDICATION_ADMISSION_RESP = 0x01, - CAC_INDICATION_DELETE = 0x02, - CAC_INDICATION_NO_RESP = 0x03, -}; - -#define WMM_TSPEC_IE_LEN 63 - -struct wmi_cac_event { - u8 ac; - u8 cac_indication; - u8 status_code; - u8 tspec_suggestion[WMM_TSPEC_IE_LEN]; -} __packed; - -/* WMI_APLIST_EVENTID */ - -enum aplist_ver { - APLIST_VER1 = 1, -}; - -struct wmi_ap_info_v1 { - u8 bssid[ETH_ALEN]; - __le16 channel; -} __packed; - -union wmi_ap_info { - struct wmi_ap_info_v1 ap_info_v1; -} __packed; - -struct wmi_aplist_event { - u8 ap_list_ver; - u8 num_ap; - union wmi_ap_info ap_list[1]; -} __packed; - -/* Developer Commands */ - -/* - * WMI_SET_BITRATE_CMDID - * - * Get bit rate cmd uses same definition as set bit rate cmd - */ -enum wmi_bit_rate { - RATE_AUTO = -1, - RATE_1Mb = 0, - RATE_2Mb = 1, - RATE_5_5Mb = 2, - RATE_11Mb = 3, - RATE_6Mb = 4, - RATE_9Mb = 5, - RATE_12Mb = 6, - RATE_18Mb = 7, - RATE_24Mb = 8, - RATE_36Mb = 9, - RATE_48Mb = 10, - RATE_54Mb = 11, - RATE_MCS_0_20 = 12, - RATE_MCS_1_20 = 13, - RATE_MCS_2_20 = 14, - RATE_MCS_3_20 = 15, - RATE_MCS_4_20 = 16, - RATE_MCS_5_20 = 17, - RATE_MCS_6_20 = 18, - RATE_MCS_7_20 = 19, - RATE_MCS_0_40 = 20, - RATE_MCS_1_40 = 21, - RATE_MCS_2_40 = 22, - RATE_MCS_3_40 = 23, - RATE_MCS_4_40 = 24, - RATE_MCS_5_40 = 25, - RATE_MCS_6_40 = 26, - RATE_MCS_7_40 = 27, -}; - -struct wmi_bit_rate_reply { - /* see, enum wmi_bit_rate */ - s8 rate_index; -} __packed; - -/* - * WMI_SET_FIXRATES_CMDID - * - * Get fix rates cmd uses same definition as set fix rates cmd - */ -struct wmi_fix_rates_reply { - /* see wmi_bit_rate */ - __le32 fix_rate_mask; -} __packed; - -enum roam_data_type { - /* get the roam time data */ - ROAM_DATA_TIME = 1, -}; - -struct wmi_target_roam_time { - __le32 disassoc_time; - __le32 no_txrx_time; - __le32 assoc_time; - __le32 allow_txrx_time; - u8 disassoc_bssid[ETH_ALEN]; - s8 disassoc_bss_rssi; - u8 assoc_bssid[ETH_ALEN]; - s8 assoc_bss_rssi; -} __packed; - -enum wmi_txop_cfg { - WMI_TXOP_DISABLED = 0, - WMI_TXOP_ENABLED -}; - -struct wmi_set_wmm_txop_cmd { - u8 txop_enable; -} __packed; - -struct wmi_set_keepalive_cmd { - u8 keep_alive_intvl; -} __packed; - -struct wmi_get_keepalive_cmd { - __le32 configured; - u8 keep_alive_intvl; -} __packed; - -struct wmi_set_appie_cmd { - u8 mgmt_frm_type; /* enum wmi_mgmt_frame_type */ - u8 ie_len; - u8 ie_info[0]; -} __packed; - -struct wmi_set_ie_cmd { - u8 ie_id; - u8 ie_field; /* enum wmi_ie_field_type */ - u8 ie_len; - u8 reserved; - u8 ie_info[0]; -} __packed; - -/* Notify the WSC registration status to the target */ -#define WSC_REG_ACTIVE 1 -#define WSC_REG_INACTIVE 0 - -#define WOW_MAX_FILTERS_PER_LIST 4 -#define WOW_PATTERN_SIZE 64 - -#define MAC_MAX_FILTERS_PER_LIST 4 - -struct wow_filter { - u8 wow_valid_filter; - u8 wow_filter_id; - u8 wow_filter_size; - u8 wow_filter_offset; - u8 wow_filter_mask[WOW_PATTERN_SIZE]; - u8 wow_filter_pattern[WOW_PATTERN_SIZE]; -} __packed; - -#define MAX_IP_ADDRS 2 - -struct wmi_set_ip_cmd { - /* IP in network byte order */ - __be32 ips[MAX_IP_ADDRS]; -} __packed; - -enum ath6kl_wow_filters { - WOW_FILTER_SSID = BIT(1), - WOW_FILTER_OPTION_MAGIC_PACKET = BIT(2), - WOW_FILTER_OPTION_EAP_REQ = BIT(3), - WOW_FILTER_OPTION_PATTERNS = BIT(4), - WOW_FILTER_OPTION_OFFLOAD_ARP = BIT(5), - WOW_FILTER_OPTION_OFFLOAD_NS = BIT(6), - WOW_FILTER_OPTION_OFFLOAD_GTK = BIT(7), - WOW_FILTER_OPTION_8021X_4WAYHS = BIT(8), - WOW_FILTER_OPTION_NLO_DISCVRY = BIT(9), - WOW_FILTER_OPTION_NWK_DISASSOC = BIT(10), - WOW_FILTER_OPTION_GTK_ERROR = BIT(11), - WOW_FILTER_OPTION_TEST_MODE = BIT(15), -}; - -enum ath6kl_host_mode { - ATH6KL_HOST_MODE_AWAKE, - ATH6KL_HOST_MODE_ASLEEP, -}; - -struct wmi_set_host_sleep_mode_cmd { - __le32 awake; - __le32 asleep; -} __packed; - -enum ath6kl_wow_mode { - ATH6KL_WOW_MODE_DISABLE, - ATH6KL_WOW_MODE_ENABLE, -}; - -struct wmi_set_wow_mode_cmd { - __le32 enable_wow; - __le32 filter; - __le16 host_req_delay; -} __packed; - -struct wmi_add_wow_pattern_cmd { - u8 filter_list_id; - u8 filter_size; - u8 filter_offset; - u8 filter[0]; -} __packed; - -struct wmi_del_wow_pattern_cmd { - __le16 filter_list_id; - __le16 filter_id; -} __packed; - -/* WMI_SET_TXE_NOTIFY_CMDID */ -struct wmi_txe_notify_cmd { - __le32 rate; - __le32 pkts; - __le32 intvl; -} __packed; - -/* WMI_TXE_NOTIFY_EVENTID */ -struct wmi_txe_notify_event { - __le32 rate; - __le32 pkts; -} __packed; - -/* WMI_SET_AKMP_PARAMS_CMD */ - -struct wmi_pmkid { - u8 pmkid[WMI_PMKID_LEN]; -} __packed; - -/* WMI_GET_PMKID_LIST_CMD Reply */ -struct wmi_pmkid_list_reply { - __le32 num_pmkid; - u8 bssid_list[ETH_ALEN][1]; - struct wmi_pmkid pmkid_list[1]; -} __packed; - -/* WMI_ADDBA_REQ_EVENTID */ -struct wmi_addba_req_event { - u8 tid; - u8 win_sz; - __le16 st_seq_no; - - /* f/w response for ADDBA Req; OK (0) or failure (!=0) */ - u8 status; -} __packed; - -/* WMI_ADDBA_RESP_EVENTID */ -struct wmi_addba_resp_event { - u8 tid; - - /* OK (0), failure (!=0) */ - u8 status; - - /* three values: not supported(0), 3839, 8k */ - __le16 amsdu_sz; -} __packed; - -/* WMI_DELBA_EVENTID - * f/w received a DELBA for peer and processed it. - * Host is notified of this - */ -struct wmi_delba_event { - u8 tid; - u8 is_peer_initiator; - __le16 reason_code; -} __packed; - -#define PEER_NODE_JOIN_EVENT 0x00 -#define PEER_NODE_LEAVE_EVENT 0x01 -#define PEER_FIRST_NODE_JOIN_EVENT 0x10 -#define PEER_LAST_NODE_LEAVE_EVENT 0x11 - -struct wmi_peer_node_event { - u8 event_code; - u8 peer_mac_addr[ETH_ALEN]; -} __packed; - -/* Transmit complete event data structure(s) */ - -/* version 1 of tx complete msg */ -struct tx_complete_msg_v1 { -#define TX_COMPLETE_STATUS_SUCCESS 0 -#define TX_COMPLETE_STATUS_RETRIES 1 -#define TX_COMPLETE_STATUS_NOLINK 2 -#define TX_COMPLETE_STATUS_TIMEOUT 3 -#define TX_COMPLETE_STATUS_OTHER 4 - - u8 status; - - /* packet ID to identify parent packet */ - u8 pkt_id; - - /* rate index on successful transmission */ - u8 rate_idx; - - /* number of ACK failures in tx attempt */ - u8 ack_failures; -} __packed; - -struct wmi_tx_complete_event { - /* no of tx comp msgs following this struct */ - u8 num_msg; - - /* length in bytes for each individual msg following this struct */ - u8 msg_len; - - /* version of tx complete msg data following this struct */ - u8 msg_type; - - /* individual messages follow this header */ - u8 reserved; -} __packed; - -/* - * ------- AP Mode definitions -------------- - */ - -/* - * !!! Warning !!! - * -Changing the following values needs compilation of both driver and firmware - */ -#define AP_MAX_NUM_STA 10 - -/* Spl. AID used to set DTIM flag in the beacons */ -#define MCAST_AID 0xFF - -#define DEF_AP_COUNTRY_CODE "US " - -/* Used with WMI_AP_SET_NUM_STA_CMDID */ - -/* - * Used with WMI_AP_SET_MLME_CMDID - */ - -/* MLME Commands */ -#define WMI_AP_MLME_ASSOC 1 /* associate station */ -#define WMI_AP_DISASSOC 2 /* disassociate station */ -#define WMI_AP_DEAUTH 3 /* deauthenticate station */ -#define WMI_AP_MLME_AUTHORIZE 4 /* authorize station */ -#define WMI_AP_MLME_UNAUTHORIZE 5 /* unauthorize station */ - -struct wmi_ap_set_mlme_cmd { - u8 mac[ETH_ALEN]; - __le16 reason; /* 802.11 reason code */ - u8 cmd; /* operation to perform (WMI_AP_*) */ -} __packed; - -struct wmi_ap_set_pvb_cmd { - __le32 flag; - __le16 rsvd; - __le16 aid; -} __packed; - -struct wmi_rx_frame_format_cmd { - /* version of meta data for rx packets <0 = default> (0-7 = valid) */ - u8 meta_ver; - - /* - * 1 == leave .11 header intact, - * 0 == replace .11 header with .3 - */ - u8 dot11_hdr; - - /* - * 1 == defragmentation is performed by host, - * 0 == performed by target - */ - u8 defrag_on_host; - - /* for alignment */ - u8 reserved[1]; -} __packed; - -struct wmi_ap_hidden_ssid_cmd { - u8 hidden_ssid; -} __packed; - -struct wmi_set_inact_period_cmd { - __le32 inact_period; - u8 num_null_func; -} __packed; - -/* AP mode events */ -struct wmi_ap_set_apsd_cmd { - u8 enable; -} __packed; - -enum wmi_ap_apsd_buffered_traffic_flags { - WMI_AP_APSD_NO_DELIVERY_FRAMES = 0x1, -}; - -struct wmi_ap_apsd_buffered_traffic_cmd { - __le16 aid; - __le16 bitmap; - __le32 flags; -} __packed; - -/* WMI_PS_POLL_EVENT */ -struct wmi_pspoll_event { - __le16 aid; -} __packed; - -struct wmi_per_sta_stat { - __le32 tx_bytes; - __le32 tx_pkts; - __le32 tx_error; - __le32 tx_discard; - __le32 rx_bytes; - __le32 rx_pkts; - __le32 rx_error; - __le32 rx_discard; - __le32 aid; -} __packed; - -struct wmi_ap_mode_stat { - __le32 action; - struct wmi_per_sta_stat sta[AP_MAX_NUM_STA + 1]; -} __packed; - -/* End of AP mode definitions */ - -struct wmi_remain_on_chnl_cmd { - __le32 freq; - __le32 duration; -} __packed; - -/* wmi_send_action_cmd is to be deprecated. Use - * wmi_send_mgmt_cmd instead. The new structure supports P2P mgmt - * operations using station interface. - */ -struct wmi_send_action_cmd { - __le32 id; - __le32 freq; - __le32 wait; - __le16 len; - u8 data[0]; -} __packed; - -struct wmi_send_mgmt_cmd { - __le32 id; - __le32 freq; - __le32 wait; - __le32 no_cck; - __le16 len; - u8 data[0]; -} __packed; - -struct wmi_tx_status_event { - __le32 id; - u8 ack_status; -} __packed; - -struct wmi_probe_req_report_cmd { - u8 enable; -} __packed; - -struct wmi_disable_11b_rates_cmd { - u8 disable; -} __packed; - -struct wmi_set_appie_extended_cmd { - u8 role_id; - u8 mgmt_frm_type; - u8 ie_len; - u8 ie_info[0]; -} __packed; - -struct wmi_remain_on_chnl_event { - __le32 freq; - __le32 duration; -} __packed; - -struct wmi_cancel_remain_on_chnl_event { - __le32 freq; - __le32 duration; - u8 status; -} __packed; - -struct wmi_rx_action_event { - __le32 freq; - __le16 len; - u8 data[0]; -} __packed; - -struct wmi_p2p_capabilities_event { - __le16 len; - u8 data[0]; -} __packed; - -struct wmi_p2p_rx_probe_req_event { - __le32 freq; - __le16 len; - u8 data[0]; -} __packed; - -#define P2P_FLAG_CAPABILITIES_REQ (0x00000001) -#define P2P_FLAG_MACADDR_REQ (0x00000002) -#define P2P_FLAG_HMODEL_REQ (0x00000002) - -struct wmi_get_p2p_info { - __le32 info_req_flags; -} __packed; - -struct wmi_p2p_info_event { - __le32 info_req_flags; - __le16 len; - u8 data[0]; -} __packed; - -struct wmi_p2p_capabilities { - u8 go_power_save; -} __packed; - -struct wmi_p2p_macaddr { - u8 mac_addr[ETH_ALEN]; -} __packed; - -struct wmi_p2p_hmodel { - u8 p2p_model; -} __packed; - -struct wmi_p2p_probe_response_cmd { - __le32 freq; - u8 destination_addr[ETH_ALEN]; - __le16 len; - u8 data[0]; -} __packed; - -/* Extended WMI (WMIX) - * - * Extended WMIX commands are encapsulated in a WMI message with - * cmd=WMI_EXTENSION_CMD. - * - * Extended WMI commands are those that are needed during wireless - * operation, but which are not really wireless commands. This allows, - * for instance, platform-specific commands. Extended WMI commands are - * embedded in a WMI command message with WMI_COMMAND_ID=WMI_EXTENSION_CMDID. - * Extended WMI events are similarly embedded in a WMI event message with - * WMI_EVENT_ID=WMI_EXTENSION_EVENTID. - */ -struct wmix_cmd_hdr { - __le32 cmd_id; -} __packed; - -enum wmix_command_id { - WMIX_DSETOPEN_REPLY_CMDID = 0x2001, - WMIX_DSETDATA_REPLY_CMDID, - WMIX_GPIO_OUTPUT_SET_CMDID, - WMIX_GPIO_INPUT_GET_CMDID, - WMIX_GPIO_REGISTER_SET_CMDID, - WMIX_GPIO_REGISTER_GET_CMDID, - WMIX_GPIO_INTR_ACK_CMDID, - WMIX_HB_CHALLENGE_RESP_CMDID, - WMIX_DBGLOG_CFG_MODULE_CMDID, - WMIX_PROF_CFG_CMDID, /* 0x200a */ - WMIX_PROF_ADDR_SET_CMDID, - WMIX_PROF_START_CMDID, - WMIX_PROF_STOP_CMDID, - WMIX_PROF_COUNT_GET_CMDID, -}; - -enum wmix_event_id { - WMIX_DSETOPENREQ_EVENTID = 0x3001, - WMIX_DSETCLOSE_EVENTID, - WMIX_DSETDATAREQ_EVENTID, - WMIX_GPIO_INTR_EVENTID, - WMIX_GPIO_DATA_EVENTID, - WMIX_GPIO_ACK_EVENTID, - WMIX_HB_CHALLENGE_RESP_EVENTID, - WMIX_DBGLOG_EVENTID, - WMIX_PROF_COUNT_EVENTID, -}; - -/* - * ------Error Detection support------- - */ - -/* - * WMIX_HB_CHALLENGE_RESP_CMDID - * Heartbeat Challenge Response command - */ -struct wmix_hb_challenge_resp_cmd { - __le32 cookie; - __le32 source; -} __packed; - -struct ath6kl_wmix_dbglog_cfg_module_cmd { - __le32 valid; - __le32 config; -} __packed; - -/* End of Extended WMI (WMIX) */ - -enum wmi_sync_flag { - NO_SYNC_WMIFLAG = 0, - - /* transmit all queued data before cmd */ - SYNC_BEFORE_WMIFLAG, - - /* any new data waits until cmd execs */ - SYNC_AFTER_WMIFLAG, - - SYNC_BOTH_WMIFLAG, - - /* end marker */ - END_WMIFLAG -}; - -enum htc_endpoint_id ath6kl_wmi_get_control_ep(struct wmi *wmi); -void ath6kl_wmi_set_control_ep(struct wmi *wmi, enum htc_endpoint_id ep_id); -int ath6kl_wmi_dix_2_dot3(struct wmi *wmi, struct sk_buff *skb); -int ath6kl_wmi_data_hdr_add(struct wmi *wmi, struct sk_buff *skb, - u8 msg_type, u32 flags, - enum wmi_data_hdr_data_type data_type, - u8 meta_ver, void *tx_meta_info, u8 if_idx); - -int ath6kl_wmi_dot11_hdr_remove(struct wmi *wmi, struct sk_buff *skb); -int ath6kl_wmi_dot3_2_dix(struct sk_buff *skb); -int ath6kl_wmi_implicit_create_pstream(struct wmi *wmi, u8 if_idx, - struct sk_buff *skb, u32 layer2_priority, - bool wmm_enabled, u8 *ac); - -int ath6kl_wmi_control_rx(struct wmi *wmi, struct sk_buff *skb); - -int ath6kl_wmi_cmd_send(struct wmi *wmi, u8 if_idx, struct sk_buff *skb, - enum wmi_cmd_id cmd_id, enum wmi_sync_flag sync_flag); - -int ath6kl_wmi_connect_cmd(struct wmi *wmi, u8 if_idx, - enum network_type nw_type, - enum dot11_auth_mode dot11_auth_mode, - enum auth_mode auth_mode, - enum crypto_type pairwise_crypto, - u8 pairwise_crypto_len, - enum crypto_type group_crypto, - u8 group_crypto_len, int ssid_len, u8 *ssid, - u8 *bssid, u16 channel, u32 ctrl_flags, - u8 nw_subtype); - -int ath6kl_wmi_reconnect_cmd(struct wmi *wmi, u8 if_idx, u8 *bssid, - u16 channel); -int ath6kl_wmi_disconnect_cmd(struct wmi *wmi, u8 if_idx); - -int ath6kl_wmi_beginscan_cmd(struct wmi *wmi, u8 if_idx, - enum wmi_scan_type scan_type, - u32 force_fgscan, u32 is_legacy, - u32 home_dwell_time, u32 force_scan_interval, - s8 num_chan, u16 *ch_list, u32 no_cck, - u32 *rates); -int ath6kl_wmi_enable_sched_scan_cmd(struct wmi *wmi, u8 if_idx, bool enable); - -int ath6kl_wmi_scanparams_cmd(struct wmi *wmi, u8 if_idx, u16 fg_start_sec, - u16 fg_end_sec, u16 bg_sec, - u16 minact_chdw_msec, u16 maxact_chdw_msec, - u16 pas_chdw_msec, u8 short_scan_ratio, - u8 scan_ctrl_flag, u32 max_dfsch_act_time, - u16 maxact_scan_per_ssid); -int ath6kl_wmi_bssfilter_cmd(struct wmi *wmi, u8 if_idx, u8 filter, - u32 ie_mask); -int ath6kl_wmi_probedssid_cmd(struct wmi *wmi, u8 if_idx, u8 index, u8 flag, - u8 ssid_len, u8 *ssid); -int ath6kl_wmi_listeninterval_cmd(struct wmi *wmi, u8 if_idx, - u16 listen_interval, - u16 listen_beacons); -int ath6kl_wmi_bmisstime_cmd(struct wmi *wmi, u8 if_idx, - u16 bmiss_time, u16 num_beacons); -int ath6kl_wmi_powermode_cmd(struct wmi *wmi, u8 if_idx, u8 pwr_mode); -int ath6kl_wmi_pmparams_cmd(struct wmi *wmi, u8 if_idx, u16 idle_period, - u16 ps_poll_num, u16 dtim_policy, - u16 tx_wakup_policy, u16 num_tx_to_wakeup, - u16 ps_fail_event_policy); -int ath6kl_wmi_create_pstream_cmd(struct wmi *wmi, u8 if_idx, - struct wmi_create_pstream_cmd *pstream); -int ath6kl_wmi_delete_pstream_cmd(struct wmi *wmi, u8 if_idx, u8 traffic_class, - u8 tsid); -int ath6kl_wmi_disctimeout_cmd(struct wmi *wmi, u8 if_idx, u8 timeout); - -int ath6kl_wmi_set_rts_cmd(struct wmi *wmi, u16 threshold); -int ath6kl_wmi_set_lpreamble_cmd(struct wmi *wmi, u8 if_idx, u8 status, - u8 preamble_policy); - -int ath6kl_wmi_get_challenge_resp_cmd(struct wmi *wmi, u32 cookie, u32 source); -int ath6kl_wmi_config_debug_module_cmd(struct wmi *wmi, u32 valid, u32 config); - -int ath6kl_wmi_get_stats_cmd(struct wmi *wmi, u8 if_idx); -int ath6kl_wmi_addkey_cmd(struct wmi *wmi, u8 if_idx, u8 key_index, - enum crypto_type key_type, - u8 key_usage, u8 key_len, - u8 *key_rsc, unsigned int key_rsc_len, - u8 *key_material, - u8 key_op_ctrl, u8 *mac_addr, - enum wmi_sync_flag sync_flag); -int ath6kl_wmi_add_krk_cmd(struct wmi *wmi, u8 if_idx, u8 *krk); -int ath6kl_wmi_deletekey_cmd(struct wmi *wmi, u8 if_idx, u8 key_index); -int ath6kl_wmi_setpmkid_cmd(struct wmi *wmi, u8 if_idx, const u8 *bssid, - const u8 *pmkid, bool set); -int ath6kl_wmi_set_tx_pwr_cmd(struct wmi *wmi, u8 if_idx, u8 dbM); -int ath6kl_wmi_get_tx_pwr_cmd(struct wmi *wmi, u8 if_idx); -int ath6kl_wmi_get_roam_tbl_cmd(struct wmi *wmi); - -int ath6kl_wmi_set_wmm_txop(struct wmi *wmi, u8 if_idx, enum wmi_txop_cfg cfg); -int ath6kl_wmi_set_keepalive_cmd(struct wmi *wmi, u8 if_idx, - u8 keep_alive_intvl); -int ath6kl_wmi_set_htcap_cmd(struct wmi *wmi, u8 if_idx, - enum ieee80211_band band, - struct ath6kl_htcap *htcap); -int ath6kl_wmi_test_cmd(struct wmi *wmi, void *buf, size_t len); - -s32 ath6kl_wmi_get_rate(s8 rate_index); - -int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, u8 if_idx, - __be32 ips0, __be32 ips1); -int ath6kl_wmi_set_host_sleep_mode_cmd(struct wmi *wmi, u8 if_idx, - enum ath6kl_host_mode host_mode); -int ath6kl_wmi_set_bitrate_mask(struct wmi *wmi, u8 if_idx, - const struct cfg80211_bitrate_mask *mask); -int ath6kl_wmi_set_wow_mode_cmd(struct wmi *wmi, u8 if_idx, - enum ath6kl_wow_mode wow_mode, - u32 filter, u16 host_req_delay); -int ath6kl_wmi_add_wow_pattern_cmd(struct wmi *wmi, u8 if_idx, - u8 list_id, u8 filter_size, - u8 filter_offset, const u8 *filter, - const u8 *mask); -int ath6kl_wmi_del_wow_pattern_cmd(struct wmi *wmi, u8 if_idx, - u16 list_id, u16 filter_id); -int ath6kl_wmi_set_rssi_filter_cmd(struct wmi *wmi, u8 if_idx, s8 rssi); -int ath6kl_wmi_set_roam_lrssi_cmd(struct wmi *wmi, u8 lrssi); -int ath6kl_wmi_ap_set_dtim_cmd(struct wmi *wmi, u8 if_idx, u32 dtim_period); -int ath6kl_wmi_ap_set_beacon_intvl_cmd(struct wmi *wmi, u8 if_idx, - u32 beacon_interval); -int ath6kl_wmi_force_roam_cmd(struct wmi *wmi, const u8 *bssid); -int ath6kl_wmi_set_roam_mode_cmd(struct wmi *wmi, enum wmi_roam_mode mode); -int ath6kl_wmi_mcast_filter_cmd(struct wmi *wmi, u8 if_idx, bool mc_all_on); -int ath6kl_wmi_add_del_mcast_filter_cmd(struct wmi *wmi, u8 if_idx, - u8 *filter, bool add_filter); -int ath6kl_wmi_sta_bmiss_enhance_cmd(struct wmi *wmi, u8 if_idx, bool enable); -int ath6kl_wmi_set_txe_notify(struct wmi *wmi, u8 idx, - u32 rate, u32 pkts, u32 intvl); -int ath6kl_wmi_set_regdomain_cmd(struct wmi *wmi, const char *alpha2); - -/* AP mode uAPSD */ -int ath6kl_wmi_ap_set_apsd(struct wmi *wmi, u8 if_idx, u8 enable); - -int ath6kl_wmi_set_apsd_bfrd_traf(struct wmi *wmi, - u8 if_idx, u16 aid, - u16 bitmap, u32 flags); - -u8 ath6kl_wmi_get_traffic_class(u8 user_priority); - -u8 ath6kl_wmi_determine_user_priority(u8 *pkt, u32 layer2_pri); -/* AP mode */ -int ath6kl_wmi_ap_hidden_ssid(struct wmi *wmi, u8 if_idx, bool enable); -int ath6kl_wmi_ap_profile_commit(struct wmi *wmip, u8 if_idx, - struct wmi_connect_cmd *p); - -int ath6kl_wmi_ap_set_mlme(struct wmi *wmip, u8 if_idx, u8 cmd, - const u8 *mac, u16 reason); - -int ath6kl_wmi_set_pvb_cmd(struct wmi *wmi, u8 if_idx, u16 aid, bool flag); - -int ath6kl_wmi_set_rx_frame_format_cmd(struct wmi *wmi, u8 if_idx, - u8 rx_meta_version, - bool rx_dot11_hdr, bool defrag_on_host); - -int ath6kl_wmi_set_appie_cmd(struct wmi *wmi, u8 if_idx, u8 mgmt_frm_type, - const u8 *ie, u8 ie_len); - -int ath6kl_wmi_set_ie_cmd(struct wmi *wmi, u8 if_idx, u8 ie_id, u8 ie_field, - const u8 *ie_info, u8 ie_len); - -/* P2P */ -int ath6kl_wmi_disable_11b_rates_cmd(struct wmi *wmi, bool disable); - -int ath6kl_wmi_remain_on_chnl_cmd(struct wmi *wmi, u8 if_idx, u32 freq, - u32 dur); - -int ath6kl_wmi_send_mgmt_cmd(struct wmi *wmi, u8 if_idx, u32 id, u32 freq, - u32 wait, const u8 *data, u16 data_len, - u32 no_cck); - -int ath6kl_wmi_send_probe_response_cmd(struct wmi *wmi, u8 if_idx, u32 freq, - const u8 *dst, const u8 *data, - u16 data_len); - -int ath6kl_wmi_probe_report_req_cmd(struct wmi *wmi, u8 if_idx, bool enable); - -int ath6kl_wmi_info_req_cmd(struct wmi *wmi, u8 if_idx, u32 info_req_flags); - -int ath6kl_wmi_cancel_remain_on_chnl_cmd(struct wmi *wmi, u8 if_idx); - -int ath6kl_wmi_set_appie_cmd(struct wmi *wmi, u8 if_idx, u8 mgmt_frm_type, - const u8 *ie, u8 ie_len); - -int ath6kl_wmi_set_inact_period(struct wmi *wmi, u8 if_idx, int inact_timeout); - -void ath6kl_wmi_sscan_timer(unsigned long ptr); - -int ath6kl_wmi_get_challenge_resp_cmd(struct wmi *wmi, u32 cookie, u32 source); - -struct ath6kl_vif *ath6kl_get_vif_by_index(struct ath6kl *ar, u8 if_idx); -void *ath6kl_wmi_init(struct ath6kl *devt); -void ath6kl_wmi_shutdown(struct wmi *wmi); -void ath6kl_wmi_reset(struct wmi *wmi); - -#endif /* WMI_H */ diff --git a/drivers/net/wireless/ath/ath9k/Kconfig b/drivers/net/wireless/ath/ath9k/Kconfig deleted file mode 100644 index 3c2cbc9d6295..000000000000 --- a/drivers/net/wireless/ath/ath9k/Kconfig +++ /dev/null @@ -1,127 +0,0 @@ -config ATH9K_HW - tristate -config ATH9K_COMMON - tristate - select ATH_COMMON -config ATH9K_DFS_DEBUGFS - def_bool y - depends on ATH9K_DEBUGFS && ATH9K_DFS_CERTIFIED - -config ATH9K_BTCOEX_SUPPORT - bool "Atheros bluetooth coexistence support" - depends on (ATH9K || ATH9K_HTC) - default y - ---help--- - Say Y, if you want to use the ath9k/ath9k_htc radios together with - Bluetooth modules in the same system. - -config ATH9K - tristate "Atheros 802.11n wireless cards support" - depends on MAC80211 && HAS_DMA - select ATH9K_HW - select MAC80211_LEDS - select LEDS_CLASS - select NEW_LEDS - select ATH9K_COMMON - ---help--- - This module adds support for wireless adapters based on - Atheros IEEE 802.11n AR5008, AR9001 and AR9002 family - of chipsets. For a specific list of supported external - cards, laptops that already ship with these cards and - APs that come with these cards refer to to ath9k wiki - products page: - - http://wireless.kernel.org/en/users/Drivers/ath9k/products - - If you choose to build a module, it'll be called ath9k. - -config ATH9K_PCI - bool "Atheros ath9k PCI/PCIe bus support" - default y - depends on ATH9K && PCI - ---help--- - This option enables the PCI bus support in ath9k. - - Say Y, if you have a compatible PCI/PCIe wireless card. - -config ATH9K_AHB - bool "Atheros ath9k AHB bus support" - depends on ATH9K - default n - ---help--- - This option enables the AHB bus support in ath9k. - - Say Y, if you have a SoC with a compatible built-in - wireless MAC. Say N if unsure. - -config ATH9K_DEBUGFS - bool "Atheros ath9k debugging" - depends on ATH9K - select MAC80211_DEBUGFS - select RELAY - ---help--- - Say Y, if you need access to ath9k's statistics for - interrupts, rate control, etc. - - Also required for changing debug message flags at run time. - -config ATH9K_DFS_CERTIFIED - bool "Atheros DFS support for certified platforms" - depends on ATH9K && CFG80211_CERTIFICATION_ONUS - default n - ---help--- - This option enables DFS support for initiating radiation on - ath9k. There is no way to dynamically detect if a card was DFS - certified and as such this is left as a build time option. This - option should only be enabled by system integrators that can - guarantee that all the platforms that their kernel will run on - have obtained appropriate regulatory body certification for a - respective Atheros card by using ath9k on the target shipping - platforms. - - This is currently only a placeholder for future DFS support, - as DFS support requires more components that still need to be - developed. At this point enabling this option won't do anything - except increase code size. - -config ATH9K_MAC_DEBUG - bool "Atheros MAC statistics" - depends on ATH9K_DEBUGFS - default y - ---help--- - This option enables collection of statistics for Rx/Tx status - data and some other MAC related statistics - -config ATH9K_LEGACY_RATE_CONTROL - bool "Atheros ath9k rate control" - depends on ATH9K - default n - ---help--- - Say Y, if you want to use the ath9k specific rate control - module instead of minstrel_ht. Be warned that there are various - issues with the ath9k RC and minstrel is a more robust algorithm. - Note that even if this option is selected, "ath9k_rate_control" - has to be passed to mac80211 using the module parameter, - ieee80211_default_rc_algo. - -config ATH9K_HTC - tristate "Atheros HTC based wireless cards support" - depends on USB && MAC80211 - select ATH9K_HW - select MAC80211_LEDS - select LEDS_CLASS - select NEW_LEDS - select ATH9K_COMMON - ---help--- - Support for Atheros HTC based cards. - Chipsets supported: AR9271 - - For more information: http://wireless.kernel.org/en/users/Drivers/ath9k_htc - - The built module will be ath9k_htc. - -config ATH9K_HTC_DEBUGFS - bool "Atheros ath9k_htc debugging" - depends on ATH9K_HTC && DEBUG_FS - ---help--- - Say Y, if you need access to ath9k_htc's statistics. diff --git a/drivers/net/wireless/ath/ath9k/Makefile b/drivers/net/wireless/ath/ath9k/Makefile deleted file mode 100644 index 75ee9e7704ce..000000000000 --- a/drivers/net/wireless/ath/ath9k/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -ath9k-y += beacon.o \ - gpio.o \ - init.o \ - main.o \ - recv.o \ - xmit.o \ - link.o \ - antenna.o - -ath9k-$(CONFIG_ATH9K_BTCOEX_SUPPORT) += mci.o -ath9k-$(CONFIG_ATH9K_LEGACY_RATE_CONTROL) += rc.o -ath9k-$(CONFIG_ATH9K_PCI) += pci.o -ath9k-$(CONFIG_ATH9K_AHB) += ahb.o -ath9k-$(CONFIG_ATH9K_DEBUGFS) += debug.o -ath9k-$(CONFIG_ATH9K_DFS_DEBUGFS) += dfs_debug.o -ath9k-$(CONFIG_ATH9K_DFS_CERTIFIED) += \ - dfs.o \ - dfs_pattern_detector.o \ - dfs_pri_detector.o -ath9k-$(CONFIG_PM_SLEEP) += wow.o - -obj-$(CONFIG_ATH9K) += ath9k.o - -ath9k_hw-y:= \ - ar9002_hw.o \ - ar9003_hw.o \ - hw.o \ - ar9003_phy.o \ - ar9002_phy.o \ - ar5008_phy.o \ - ar9002_calib.o \ - ar9003_calib.o \ - ar9003_rtt.o \ - calib.o \ - eeprom.o \ - eeprom_def.o \ - eeprom_4k.o \ - eeprom_9287.o \ - ani.o \ - mac.o \ - ar9002_mac.o \ - ar9003_mac.o \ - ar9003_eeprom.o \ - ar9003_paprd.o - -ath9k_hw-$(CONFIG_ATH9K_BTCOEX_SUPPORT) += btcoex.o \ - ar9003_mci.o -obj-$(CONFIG_ATH9K_HW) += ath9k_hw.o - -obj-$(CONFIG_ATH9K_COMMON) += ath9k_common.o -ath9k_common-y:= common.o - -ath9k_htc-y += htc_hst.o \ - hif_usb.o \ - wmi.o \ - htc_drv_txrx.o \ - htc_drv_main.o \ - htc_drv_beacon.o \ - htc_drv_init.o \ - htc_drv_gpio.o - -ath9k_htc-$(CONFIG_ATH9K_HTC_DEBUGFS) += htc_drv_debug.o - -obj-$(CONFIG_ATH9K_HTC) += ath9k_htc.o diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c deleted file mode 100644 index d1ff3c246a12..000000000000 --- a/drivers/net/wireless/ath/ath9k/ahb.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * Copyright (c) 2009 Gabor Juhos - * Copyright (c) 2009 Imre Kaloz - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include "ath9k.h" - -static const struct platform_device_id ath9k_platform_id_table[] = { - { - .name = "ath9k", - .driver_data = AR5416_AR9100_DEVID, - }, - { - .name = "ar933x_wmac", - .driver_data = AR9300_DEVID_AR9330, - }, - { - .name = "ar934x_wmac", - .driver_data = AR9300_DEVID_AR9340, - }, - { - .name = "qca955x_wmac", - .driver_data = AR9300_DEVID_QCA955X, - }, - {}, -}; - -/* return bus cachesize in 4B word units */ -static void ath_ahb_read_cachesize(struct ath_common *common, int *csz) -{ - *csz = L1_CACHE_BYTES >> 2; -} - -static bool ath_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data) -{ - struct ath_softc *sc = (struct ath_softc *)common->priv; - struct platform_device *pdev = to_platform_device(sc->dev); - struct ath9k_platform_data *pdata; - - pdata = (struct ath9k_platform_data *) pdev->dev.platform_data; - if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { - ath_err(common, - "%s: flash read failed, offset %08x is out of range\n", - __func__, off); - return false; - } - - *data = pdata->eeprom_data[off]; - return true; -} - -static struct ath_bus_ops ath_ahb_bus_ops = { - .ath_bus_type = ATH_AHB, - .read_cachesize = ath_ahb_read_cachesize, - .eeprom_read = ath_ahb_eeprom_read, -}; - -static int ath_ahb_probe(struct platform_device *pdev) -{ - void __iomem *mem; - struct ath_softc *sc; - struct ieee80211_hw *hw; - struct resource *res; - const struct platform_device_id *id = platform_get_device_id(pdev); - int irq; - int ret = 0; - struct ath_hw *ah; - char hw_name[64]; - - if (!pdev->dev.platform_data) { - dev_err(&pdev->dev, "no platform data specified\n"); - return -EINVAL; - } - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res == NULL) { - dev_err(&pdev->dev, "no memory resource found\n"); - return -ENXIO; - } - - mem = devm_ioremap_nocache(&pdev->dev, res->start, resource_size(res)); - if (mem == NULL) { - dev_err(&pdev->dev, "ioremap failed\n"); - return -ENOMEM; - } - - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (res == NULL) { - dev_err(&pdev->dev, "no IRQ resource found\n"); - return -ENXIO; - } - - irq = res->start; - - hw = ieee80211_alloc_hw(sizeof(struct ath_softc), &ath9k_ops); - if (hw == NULL) { - dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); - return -ENOMEM; - } - - SET_IEEE80211_DEV(hw, &pdev->dev); - platform_set_drvdata(pdev, hw); - - sc = hw->priv; - sc->hw = hw; - sc->dev = &pdev->dev; - sc->mem = mem; - sc->irq = irq; - - /* Will be cleared in ath9k_start() */ - set_bit(SC_OP_INVALID, &sc->sc_flags); - - ret = request_irq(irq, ath_isr, IRQF_SHARED, "ath9k", sc); - if (ret) { - dev_err(&pdev->dev, "request_irq failed\n"); - goto err_free_hw; - } - - ret = ath9k_init_device(id->driver_data, sc, &ath_ahb_bus_ops); - if (ret) { - dev_err(&pdev->dev, "failed to initialize device\n"); - goto err_irq; - } - - ah = sc->sc_ah; - ath9k_hw_name(ah, hw_name, sizeof(hw_name)); - wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n", - hw_name, (unsigned long)mem, irq); - - return 0; - - err_irq: - free_irq(irq, sc); - err_free_hw: - ieee80211_free_hw(hw); - platform_set_drvdata(pdev, NULL); - return ret; -} - -static int ath_ahb_remove(struct platform_device *pdev) -{ - struct ieee80211_hw *hw = platform_get_drvdata(pdev); - - if (hw) { - struct ath_softc *sc = hw->priv; - - ath9k_deinit_device(sc); - free_irq(sc->irq, sc); - ieee80211_free_hw(sc->hw); - platform_set_drvdata(pdev, NULL); - } - - return 0; -} - -static struct platform_driver ath_ahb_driver = { - .probe = ath_ahb_probe, - .remove = ath_ahb_remove, - .driver = { - .name = "ath9k", - .owner = THIS_MODULE, - }, - .id_table = ath9k_platform_id_table, -}; - -MODULE_DEVICE_TABLE(platform, ath9k_platform_id_table); - -int ath_ahb_init(void) -{ - return platform_driver_register(&ath_ahb_driver); -} - -void ath_ahb_exit(void) -{ - platform_driver_unregister(&ath_ahb_driver); -} diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c deleted file mode 100644 index 7ecd40f07a74..000000000000 --- a/drivers/net/wireless/ath/ath9k/ani.c +++ /dev/null @@ -1,532 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include "hw.h" -#include "hw-ops.h" - -struct ani_ofdm_level_entry { - int spur_immunity_level; - int fir_step_level; - int ofdm_weak_signal_on; -}; - -/* values here are relative to the INI */ - -/* - * Legend: - * - * SI: Spur immunity - * FS: FIR Step - * WS: OFDM / CCK Weak Signal detection - * MRC-CCK: Maximal Ratio Combining for CCK - */ - -static const struct ani_ofdm_level_entry ofdm_level_table[] = { - /* SI FS WS */ - { 0, 0, 1 }, /* lvl 0 */ - { 1, 1, 1 }, /* lvl 1 */ - { 2, 2, 1 }, /* lvl 2 */ - { 3, 2, 1 }, /* lvl 3 (default) */ - { 4, 3, 1 }, /* lvl 4 */ - { 5, 4, 1 }, /* lvl 5 */ - { 6, 5, 1 }, /* lvl 6 */ - { 7, 6, 1 }, /* lvl 7 */ - { 7, 6, 0 }, /* lvl 8 */ - { 7, 7, 0 } /* lvl 9 */ -}; -#define ATH9K_ANI_OFDM_NUM_LEVEL \ - ARRAY_SIZE(ofdm_level_table) -#define ATH9K_ANI_OFDM_MAX_LEVEL \ - (ATH9K_ANI_OFDM_NUM_LEVEL-1) -#define ATH9K_ANI_OFDM_DEF_LEVEL \ - 3 /* default level - matches the INI settings */ - -/* - * MRC (Maximal Ratio Combining) has always been used with multi-antenna ofdm. - * With OFDM for single stream you just add up all antenna inputs, you're - * only interested in what you get after FFT. Signal aligment is also not - * required for OFDM because any phase difference adds up in the frequency - * domain. - * - * MRC requires extra work for use with CCK. You need to align the antenna - * signals from the different antenna before you can add the signals together. - * You need aligment of signals as CCK is in time domain, so addition can cancel - * your signal completely if phase is 180 degrees (think of adding sine waves). - * You also need to remove noise before the addition and this is where ANI - * MRC CCK comes into play. One of the antenna inputs may be stronger but - * lower SNR, so just adding after alignment can be dangerous. - * - * Regardless of alignment in time, the antenna signals add constructively after - * FFT and improve your reception. For more information: - * - * http://en.wikipedia.org/wiki/Maximal-ratio_combining - */ - -struct ani_cck_level_entry { - int fir_step_level; - int mrc_cck_on; -}; - -static const struct ani_cck_level_entry cck_level_table[] = { - /* FS MRC-CCK */ - { 0, 1 }, /* lvl 0 */ - { 1, 1 }, /* lvl 1 */ - { 2, 1 }, /* lvl 2 (default) */ - { 3, 1 }, /* lvl 3 */ - { 4, 0 }, /* lvl 4 */ - { 5, 0 }, /* lvl 5 */ - { 6, 0 }, /* lvl 6 */ - { 6, 0 }, /* lvl 7 (only for high rssi) */ - { 7, 0 } /* lvl 8 (only for high rssi) */ -}; - -#define ATH9K_ANI_CCK_NUM_LEVEL \ - ARRAY_SIZE(cck_level_table) -#define ATH9K_ANI_CCK_MAX_LEVEL \ - (ATH9K_ANI_CCK_NUM_LEVEL-1) -#define ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI \ - (ATH9K_ANI_CCK_NUM_LEVEL-3) -#define ATH9K_ANI_CCK_DEF_LEVEL \ - 2 /* default level - matches the INI settings */ - -static void ath9k_hw_update_mibstats(struct ath_hw *ah, - struct ath9k_mib_stats *stats) -{ - stats->ackrcv_bad += REG_READ(ah, AR_ACK_FAIL); - stats->rts_bad += REG_READ(ah, AR_RTS_FAIL); - stats->fcs_bad += REG_READ(ah, AR_FCS_FAIL); - stats->rts_good += REG_READ(ah, AR_RTS_OK); - stats->beacons += REG_READ(ah, AR_BEACON_CNT); -} - -static void ath9k_ani_restart(struct ath_hw *ah) -{ - struct ar5416AniState *aniState; - - if (!DO_ANI(ah)) - return; - - aniState = &ah->curchan->ani; - aniState->listenTime = 0; - - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_PHY_ERR_1, 0); - REG_WRITE(ah, AR_PHY_ERR_2, 0); - REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING); - REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING); - - REGWRITE_BUFFER_FLUSH(ah); - - ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); - - aniState->ofdmPhyErrCount = 0; - aniState->cckPhyErrCount = 0; -} - -/* Adjust the OFDM Noise Immunity Level */ -static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel, - bool scan) -{ - struct ar5416AniState *aniState = &ah->curchan->ani; - struct ath_common *common = ath9k_hw_common(ah); - const struct ani_ofdm_level_entry *entry_ofdm; - const struct ani_cck_level_entry *entry_cck; - bool weak_sig; - - ath_dbg(common, ANI, "**** ofdmlevel %d=>%d, rssi=%d[lo=%d hi=%d]\n", - aniState->ofdmNoiseImmunityLevel, - immunityLevel, BEACON_RSSI(ah), - ATH9K_ANI_RSSI_THR_LOW, - ATH9K_ANI_RSSI_THR_HIGH); - - if (!scan) - aniState->ofdmNoiseImmunityLevel = immunityLevel; - - entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel]; - entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel]; - - if (aniState->spurImmunityLevel != entry_ofdm->spur_immunity_level) - ath9k_hw_ani_control(ah, - ATH9K_ANI_SPUR_IMMUNITY_LEVEL, - entry_ofdm->spur_immunity_level); - - if (aniState->firstepLevel != entry_ofdm->fir_step_level && - entry_ofdm->fir_step_level >= entry_cck->fir_step_level) - ath9k_hw_ani_control(ah, - ATH9K_ANI_FIRSTEP_LEVEL, - entry_ofdm->fir_step_level); - - weak_sig = entry_ofdm->ofdm_weak_signal_on; - if (ah->opmode == NL80211_IFTYPE_STATION && - BEACON_RSSI(ah) <= ATH9K_ANI_RSSI_THR_HIGH) - weak_sig = true; - - if (aniState->ofdmWeakSigDetect != weak_sig) - ath9k_hw_ani_control(ah, - ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION, - entry_ofdm->ofdm_weak_signal_on); - - if (aniState->ofdmNoiseImmunityLevel >= ATH9K_ANI_OFDM_DEF_LEVEL) { - ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH; - ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI; - } else { - ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI; - ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW; - } -} - -static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah) -{ - struct ar5416AniState *aniState; - - if (!DO_ANI(ah)) - return; - - aniState = &ah->curchan->ani; - - if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL) - ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false); -} - -/* - * Set the ANI settings to match an CCK level. - */ -static void ath9k_hw_set_cck_nil(struct ath_hw *ah, u_int8_t immunityLevel, - bool scan) -{ - struct ar5416AniState *aniState = &ah->curchan->ani; - struct ath_common *common = ath9k_hw_common(ah); - const struct ani_ofdm_level_entry *entry_ofdm; - const struct ani_cck_level_entry *entry_cck; - - ath_dbg(common, ANI, "**** ccklevel %d=>%d, rssi=%d[lo=%d hi=%d]\n", - aniState->cckNoiseImmunityLevel, immunityLevel, - BEACON_RSSI(ah), ATH9K_ANI_RSSI_THR_LOW, - ATH9K_ANI_RSSI_THR_HIGH); - - if (ah->opmode == NL80211_IFTYPE_STATION && - BEACON_RSSI(ah) <= ATH9K_ANI_RSSI_THR_LOW && - immunityLevel > ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI) - immunityLevel = ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI; - - if (!scan) - aniState->cckNoiseImmunityLevel = immunityLevel; - - entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel]; - entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel]; - - if (aniState->firstepLevel != entry_cck->fir_step_level && - entry_cck->fir_step_level >= entry_ofdm->fir_step_level) - ath9k_hw_ani_control(ah, - ATH9K_ANI_FIRSTEP_LEVEL, - entry_cck->fir_step_level); - - /* Skip MRC CCK for pre AR9003 families */ - if (!AR_SREV_9300_20_OR_LATER(ah) || AR_SREV_9485(ah) || AR_SREV_9565(ah)) - return; - - if (aniState->mrcCCK != entry_cck->mrc_cck_on) - ath9k_hw_ani_control(ah, - ATH9K_ANI_MRC_CCK, - entry_cck->mrc_cck_on); -} - -static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah) -{ - struct ar5416AniState *aniState; - - if (!DO_ANI(ah)) - return; - - aniState = &ah->curchan->ani; - - if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL) - ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1, - false); -} - -/* - * only lower either OFDM or CCK errors per turn - * we lower the other one next time - */ -static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah) -{ - struct ar5416AniState *aniState; - - aniState = &ah->curchan->ani; - - /* lower OFDM noise immunity */ - if (aniState->ofdmNoiseImmunityLevel > 0 && - (aniState->ofdmsTurn || aniState->cckNoiseImmunityLevel == 0)) { - ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel - 1, - false); - return; - } - - /* lower CCK noise immunity */ - if (aniState->cckNoiseImmunityLevel > 0) - ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel - 1, - false); -} - -/* - * Restore the ANI parameters in the HAL and reset the statistics. - * This routine should be called for every hardware reset and for - * every channel change. - */ -void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) -{ - struct ar5416AniState *aniState = &ah->curchan->ani; - struct ath9k_channel *chan = ah->curchan; - struct ath_common *common = ath9k_hw_common(ah); - int ofdm_nil, cck_nil; - - if (!DO_ANI(ah)) - return; - - BUG_ON(aniState == NULL); - ah->stats.ast_ani_reset++; - - /* only allow a subset of functions in AP mode */ - if (ah->opmode == NL80211_IFTYPE_AP) { - if (IS_CHAN_2GHZ(chan)) { - ah->ani_function = (ATH9K_ANI_SPUR_IMMUNITY_LEVEL | - ATH9K_ANI_FIRSTEP_LEVEL); - if (AR_SREV_9300_20_OR_LATER(ah)) - ah->ani_function |= ATH9K_ANI_MRC_CCK; - } else - ah->ani_function = 0; - } - - /* always allow mode (on/off) to be controlled */ - ah->ani_function |= ATH9K_ANI_MODE; - - ofdm_nil = max_t(int, ATH9K_ANI_OFDM_DEF_LEVEL, - aniState->ofdmNoiseImmunityLevel); - cck_nil = max_t(int, ATH9K_ANI_CCK_DEF_LEVEL, - aniState->cckNoiseImmunityLevel); - - if (is_scanning || - (ah->opmode != NL80211_IFTYPE_STATION && - ah->opmode != NL80211_IFTYPE_ADHOC)) { - /* - * If we're scanning or in AP mode, the defaults (ini) - * should be in place. For an AP we assume the historical - * levels for this channel are probably outdated so start - * from defaults instead. - */ - if (aniState->ofdmNoiseImmunityLevel != - ATH9K_ANI_OFDM_DEF_LEVEL || - aniState->cckNoiseImmunityLevel != - ATH9K_ANI_CCK_DEF_LEVEL) { - ath_dbg(common, ANI, - "Restore defaults: opmode %u chan %d Mhz/0x%x is_scanning=%d ofdm:%d cck:%d\n", - ah->opmode, - chan->channel, - chan->channelFlags, - is_scanning, - aniState->ofdmNoiseImmunityLevel, - aniState->cckNoiseImmunityLevel); - - ofdm_nil = ATH9K_ANI_OFDM_DEF_LEVEL; - cck_nil = ATH9K_ANI_CCK_DEF_LEVEL; - } - } else { - /* - * restore historical levels for this channel - */ - ath_dbg(common, ANI, - "Restore history: opmode %u chan %d Mhz/0x%x is_scanning=%d ofdm:%d cck:%d\n", - ah->opmode, - chan->channel, - chan->channelFlags, - is_scanning, - aniState->ofdmNoiseImmunityLevel, - aniState->cckNoiseImmunityLevel); - } - ath9k_hw_set_ofdm_nil(ah, ofdm_nil, is_scanning); - ath9k_hw_set_cck_nil(ah, cck_nil, is_scanning); - - /* - * enable phy counters if hw supports or if not, enable phy - * interrupts (so we can count each one) - */ - ath9k_ani_restart(ah); - - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING); - REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING); - - REGWRITE_BUFFER_FLUSH(ah); -} - -static bool ath9k_hw_ani_read_counters(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ar5416AniState *aniState = &ah->curchan->ani; - u32 phyCnt1, phyCnt2; - int32_t listenTime; - - ath_hw_cycle_counters_update(common); - listenTime = ath_hw_get_listen_time(common); - - if (listenTime <= 0) { - ah->stats.ast_ani_lneg_or_lzero++; - ath9k_ani_restart(ah); - return false; - } - - aniState->listenTime += listenTime; - - ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); - - phyCnt1 = REG_READ(ah, AR_PHY_ERR_1); - phyCnt2 = REG_READ(ah, AR_PHY_ERR_2); - - ah->stats.ast_ani_ofdmerrs += phyCnt1 - aniState->ofdmPhyErrCount; - aniState->ofdmPhyErrCount = phyCnt1; - - ah->stats.ast_ani_cckerrs += phyCnt2 - aniState->cckPhyErrCount; - aniState->cckPhyErrCount = phyCnt2; - - return true; -} - -void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan) -{ - struct ar5416AniState *aniState; - struct ath_common *common = ath9k_hw_common(ah); - u32 ofdmPhyErrRate, cckPhyErrRate; - - if (!DO_ANI(ah)) - return; - - aniState = &ah->curchan->ani; - if (!ath9k_hw_ani_read_counters(ah)) - return; - - ofdmPhyErrRate = aniState->ofdmPhyErrCount * 1000 / - aniState->listenTime; - cckPhyErrRate = aniState->cckPhyErrCount * 1000 / - aniState->listenTime; - - ath_dbg(common, ANI, - "listenTime=%d OFDM:%d errs=%d/s CCK:%d errs=%d/s ofdm_turn=%d\n", - aniState->listenTime, - aniState->ofdmNoiseImmunityLevel, - ofdmPhyErrRate, aniState->cckNoiseImmunityLevel, - cckPhyErrRate, aniState->ofdmsTurn); - - if (aniState->listenTime > ah->aniperiod) { - if (cckPhyErrRate < ah->config.cck_trig_low && - ofdmPhyErrRate < ah->config.ofdm_trig_low) { - ath9k_hw_ani_lower_immunity(ah); - aniState->ofdmsTurn = !aniState->ofdmsTurn; - } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) { - ath9k_hw_ani_ofdm_err_trigger(ah); - aniState->ofdmsTurn = false; - } else if (cckPhyErrRate > ah->config.cck_trig_high) { - ath9k_hw_ani_cck_err_trigger(ah); - aniState->ofdmsTurn = true; - } - ath9k_ani_restart(ah); - } -} -EXPORT_SYMBOL(ath9k_hw_ani_monitor); - -void ath9k_enable_mib_counters(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - - ath_dbg(common, ANI, "Enable MIB counters\n"); - - ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); - - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_FILT_OFDM, 0); - REG_WRITE(ah, AR_FILT_CCK, 0); - REG_WRITE(ah, AR_MIBC, - ~(AR_MIBC_COW | AR_MIBC_FMC | AR_MIBC_CMC | AR_MIBC_MCS) - & 0x0f); - REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING); - REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING); - - REGWRITE_BUFFER_FLUSH(ah); -} - -/* Freeze the MIB counters, get the stats and then clear them */ -void ath9k_hw_disable_mib_counters(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - - ath_dbg(common, ANI, "Disable MIB counters\n"); - - REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC); - ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); - REG_WRITE(ah, AR_MIBC, AR_MIBC_CMC); - REG_WRITE(ah, AR_FILT_OFDM, 0); - REG_WRITE(ah, AR_FILT_CCK, 0); -} -EXPORT_SYMBOL(ath9k_hw_disable_mib_counters); - -void ath9k_hw_ani_init(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - int i; - - ath_dbg(common, ANI, "Initialize ANI\n"); - - ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH; - ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW; - - ah->config.cck_trig_high = ATH9K_ANI_CCK_TRIG_HIGH; - ah->config.cck_trig_low = ATH9K_ANI_CCK_TRIG_LOW; - - for (i = 0; i < ARRAY_SIZE(ah->channels); i++) { - struct ath9k_channel *chan = &ah->channels[i]; - struct ar5416AniState *ani = &chan->ani; - - ani->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL; - - ani->firstepLevel = ATH9K_ANI_FIRSTEP_LVL; - - ani->mrcCCK = AR_SREV_9300_20_OR_LATER(ah) ? true : false; - - ani->ofdmsTurn = true; - - ani->ofdmWeakSigDetect = ATH9K_ANI_USE_OFDM_WEAK_SIG; - ani->cckNoiseImmunityLevel = ATH9K_ANI_CCK_DEF_LEVEL; - ani->ofdmNoiseImmunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL; - } - - /* - * since we expect some ongoing maintenance on the tables, let's sanity - * check here default level should not modify INI setting. - */ - ah->aniperiod = ATH9K_ANI_PERIOD; - ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL; - - if (ah->config.enable_ani) - ah->proc_phyerr |= HAL_PROCESS_ANI; - - ath9k_ani_restart(ah); - ath9k_enable_mib_counters(ah); -} diff --git a/drivers/net/wireless/ath/ath9k/ani.h b/drivers/net/wireless/ath/ath9k/ani.h deleted file mode 100644 index dddb1361039a..000000000000 --- a/drivers/net/wireless/ath/ath9k/ani.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef ANI_H -#define ANI_H - -#define HAL_PROCESS_ANI 0x00000001 - -#define DO_ANI(ah) (((ah)->proc_phyerr & HAL_PROCESS_ANI) && ah->curchan) - -#define BEACON_RSSI(ahp) (ahp->stats.avgbrssi) - -/* units are errors per second */ -#define ATH9K_ANI_OFDM_TRIG_HIGH 3500 -#define ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI 1000 - -/* units are errors per second */ -#define ATH9K_ANI_OFDM_TRIG_LOW 400 -#define ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI 900 - -/* units are errors per second */ -#define ATH9K_ANI_CCK_TRIG_HIGH 600 - -/* units are errors per second */ -#define ATH9K_ANI_CCK_TRIG_LOW 300 - -#define ATH9K_ANI_NOISE_IMMUNE_LVL 4 -#define ATH9K_ANI_USE_OFDM_WEAK_SIG true -#define ATH9K_ANI_CCK_WEAK_SIG_THR false - -#define ATH9K_ANI_SPUR_IMMUNE_LVL 3 - -#define ATH9K_ANI_FIRSTEP_LVL 2 - -#define ATH9K_ANI_RSSI_THR_HIGH 40 -#define ATH9K_ANI_RSSI_THR_LOW 7 - -#define ATH9K_ANI_PERIOD 300 - -/* in ms */ -#define ATH9K_ANI_POLLINTERVAL 1000 - -#define HAL_NOISE_IMMUNE_MAX 4 -#define HAL_SPUR_IMMUNE_MAX 7 -#define HAL_FIRST_STEP_MAX 2 - -#define ATH9K_SIG_FIRSTEP_SETTING_MIN 0 -#define ATH9K_SIG_FIRSTEP_SETTING_MAX 20 -#define ATH9K_SIG_SPUR_IMM_SETTING_MIN 0 -#define ATH9K_SIG_SPUR_IMM_SETTING_MAX 22 - -/* values here are relative to the INI */ - -enum ath9k_ani_cmd { - ATH9K_ANI_PRESENT = 0x1, - ATH9K_ANI_NOISE_IMMUNITY_LEVEL = 0x2, - ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4, - ATH9K_ANI_CCK_WEAK_SIGNAL_THR = 0x8, - ATH9K_ANI_FIRSTEP_LEVEL = 0x10, - ATH9K_ANI_SPUR_IMMUNITY_LEVEL = 0x20, - ATH9K_ANI_MODE = 0x40, - ATH9K_ANI_PHYERR_RESET = 0x80, - ATH9K_ANI_MRC_CCK = 0x100, - ATH9K_ANI_ALL = 0xfff -}; - -struct ath9k_mib_stats { - u32 ackrcv_bad; - u32 rts_bad; - u32 rts_good; - u32 fcs_bad; - u32 beacons; -}; - -/* INI default values for ANI registers */ -struct ath9k_ani_default { - u16 m1ThreshLow; - u16 m2ThreshLow; - u16 m1Thresh; - u16 m2Thresh; - u16 m2CountThr; - u16 m2CountThrLow; - u16 m1ThreshLowExt; - u16 m2ThreshLowExt; - u16 m1ThreshExt; - u16 m2ThreshExt; - u16 firstep; - u16 firstepLow; - u16 cycpwrThr1; - u16 cycpwrThr1Ext; -}; - -struct ar5416AniState { - u8 noiseImmunityLevel; - u8 ofdmNoiseImmunityLevel; - u8 cckNoiseImmunityLevel; - bool ofdmsTurn; - u8 mrcCCK; - u8 spurImmunityLevel; - u8 firstepLevel; - u8 ofdmWeakSigDetect; - u32 listenTime; - u32 ofdmPhyErrCount; - u32 cckPhyErrCount; - struct ath9k_ani_default iniDef; -}; - -struct ar5416Stats { - u32 ast_ani_niup; - u32 ast_ani_nidown; - u32 ast_ani_spurup; - u32 ast_ani_spurdown; - u32 ast_ani_ofdmon; - u32 ast_ani_ofdmoff; - u32 ast_ani_cckhigh; - u32 ast_ani_ccklow; - u32 ast_ani_stepup; - u32 ast_ani_stepdown; - u32 ast_ani_ofdmerrs; - u32 ast_ani_cckerrs; - u32 ast_ani_reset; - u32 ast_ani_lneg_or_lzero; - u32 avgbrssi; - struct ath9k_mib_stats ast_mibstats; -}; -#define ah_mibStats stats.ast_mibstats - -void ath9k_enable_mib_counters(struct ath_hw *ah); -void ath9k_hw_disable_mib_counters(struct ath_hw *ah); -void ath9k_hw_ani_init(struct ath_hw *ah); - -#endif /* ANI_H */ diff --git a/drivers/net/wireless/ath/ath9k/antenna.c b/drivers/net/wireless/ath/ath9k/antenna.c deleted file mode 100644 index 664844c5d3d5..000000000000 --- a/drivers/net/wireless/ath/ath9k/antenna.c +++ /dev/null @@ -1,797 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "ath9k.h" - -static inline bool ath_is_alt_ant_ratio_better(int alt_ratio, int maxdelta, - int mindelta, int main_rssi_avg, - int alt_rssi_avg, int pkt_count) -{ - return (((alt_ratio >= ATH_ANT_DIV_COMB_ALT_ANT_RATIO2) && - (alt_rssi_avg > main_rssi_avg + maxdelta)) || - (alt_rssi_avg > main_rssi_avg + mindelta)) && (pkt_count > 50); -} - -static inline bool ath_ant_div_comb_alt_check(u8 div_group, int alt_ratio, - int curr_main_set, int curr_alt_set, - int alt_rssi_avg, int main_rssi_avg) -{ - bool result = false; - switch (div_group) { - case 0: - if (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO) - result = true; - break; - case 1: - case 2: - if ((((curr_main_set == ATH_ANT_DIV_COMB_LNA2) && - (curr_alt_set == ATH_ANT_DIV_COMB_LNA1) && - (alt_rssi_avg >= (main_rssi_avg - 5))) || - ((curr_main_set == ATH_ANT_DIV_COMB_LNA1) && - (curr_alt_set == ATH_ANT_DIV_COMB_LNA2) && - (alt_rssi_avg >= (main_rssi_avg - 2)))) && - (alt_rssi_avg >= 4)) - result = true; - else - result = false; - break; - } - - return result; -} - -static void ath_lnaconf_alt_good_scan(struct ath_ant_comb *antcomb, - struct ath_hw_antcomb_conf ant_conf, - int main_rssi_avg) -{ - antcomb->quick_scan_cnt = 0; - - if (ant_conf.main_lna_conf == ATH_ANT_DIV_COMB_LNA2) - antcomb->rssi_lna2 = main_rssi_avg; - else if (ant_conf.main_lna_conf == ATH_ANT_DIV_COMB_LNA1) - antcomb->rssi_lna1 = main_rssi_avg; - - switch ((ant_conf.main_lna_conf << 4) | ant_conf.alt_lna_conf) { - case 0x10: /* LNA2 A-B */ - antcomb->main_conf = ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2; - antcomb->first_quick_scan_conf = - ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; - antcomb->second_quick_scan_conf = ATH_ANT_DIV_COMB_LNA1; - break; - case 0x20: /* LNA1 A-B */ - antcomb->main_conf = ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2; - antcomb->first_quick_scan_conf = - ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; - antcomb->second_quick_scan_conf = ATH_ANT_DIV_COMB_LNA2; - break; - case 0x21: /* LNA1 LNA2 */ - antcomb->main_conf = ATH_ANT_DIV_COMB_LNA2; - antcomb->first_quick_scan_conf = - ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2; - antcomb->second_quick_scan_conf = - ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; - break; - case 0x12: /* LNA2 LNA1 */ - antcomb->main_conf = ATH_ANT_DIV_COMB_LNA1; - antcomb->first_quick_scan_conf = - ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2; - antcomb->second_quick_scan_conf = - ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; - break; - case 0x13: /* LNA2 A+B */ - antcomb->main_conf = ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; - antcomb->first_quick_scan_conf = - ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2; - antcomb->second_quick_scan_conf = ATH_ANT_DIV_COMB_LNA1; - break; - case 0x23: /* LNA1 A+B */ - antcomb->main_conf = ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; - antcomb->first_quick_scan_conf = - ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2; - antcomb->second_quick_scan_conf = ATH_ANT_DIV_COMB_LNA2; - break; - default: - break; - } -} - -static void ath_select_ant_div_from_quick_scan(struct ath_ant_comb *antcomb, - struct ath_hw_antcomb_conf *div_ant_conf, - int main_rssi_avg, int alt_rssi_avg, - int alt_ratio) -{ - /* alt_good */ - switch (antcomb->quick_scan_cnt) { - case 0: - /* set alt to main, and alt to first conf */ - div_ant_conf->main_lna_conf = antcomb->main_conf; - div_ant_conf->alt_lna_conf = antcomb->first_quick_scan_conf; - break; - case 1: - /* set alt to main, and alt to first conf */ - div_ant_conf->main_lna_conf = antcomb->main_conf; - div_ant_conf->alt_lna_conf = antcomb->second_quick_scan_conf; - antcomb->rssi_first = main_rssi_avg; - antcomb->rssi_second = alt_rssi_avg; - - if (antcomb->main_conf == ATH_ANT_DIV_COMB_LNA1) { - /* main is LNA1 */ - if (ath_is_alt_ant_ratio_better(alt_ratio, - ATH_ANT_DIV_COMB_LNA1_DELTA_HI, - ATH_ANT_DIV_COMB_LNA1_DELTA_LOW, - main_rssi_avg, alt_rssi_avg, - antcomb->total_pkt_count)) - antcomb->first_ratio = true; - else - antcomb->first_ratio = false; - } else if (antcomb->main_conf == ATH_ANT_DIV_COMB_LNA2) { - if (ath_is_alt_ant_ratio_better(alt_ratio, - ATH_ANT_DIV_COMB_LNA1_DELTA_MID, - ATH_ANT_DIV_COMB_LNA1_DELTA_LOW, - main_rssi_avg, alt_rssi_avg, - antcomb->total_pkt_count)) - antcomb->first_ratio = true; - else - antcomb->first_ratio = false; - } else { - if ((((alt_ratio >= ATH_ANT_DIV_COMB_ALT_ANT_RATIO2) && - (alt_rssi_avg > main_rssi_avg + - ATH_ANT_DIV_COMB_LNA1_DELTA_HI)) || - (alt_rssi_avg > main_rssi_avg)) && - (antcomb->total_pkt_count > 50)) - antcomb->first_ratio = true; - else - antcomb->first_ratio = false; - } - break; - case 2: - antcomb->alt_good = false; - antcomb->scan_not_start = false; - antcomb->scan = false; - antcomb->rssi_first = main_rssi_avg; - antcomb->rssi_third = alt_rssi_avg; - - if (antcomb->second_quick_scan_conf == ATH_ANT_DIV_COMB_LNA1) - antcomb->rssi_lna1 = alt_rssi_avg; - else if (antcomb->second_quick_scan_conf == - ATH_ANT_DIV_COMB_LNA2) - antcomb->rssi_lna2 = alt_rssi_avg; - else if (antcomb->second_quick_scan_conf == - ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2) { - if (antcomb->main_conf == ATH_ANT_DIV_COMB_LNA2) - antcomb->rssi_lna2 = main_rssi_avg; - else if (antcomb->main_conf == ATH_ANT_DIV_COMB_LNA1) - antcomb->rssi_lna1 = main_rssi_avg; - } - - if (antcomb->rssi_lna2 > antcomb->rssi_lna1 + - ATH_ANT_DIV_COMB_LNA1_LNA2_SWITCH_DELTA) - div_ant_conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA2; - else - div_ant_conf->main_lna_conf = ATH_ANT_DIV_COMB_LNA1; - - if (antcomb->main_conf == ATH_ANT_DIV_COMB_LNA1) { - if (ath_is_alt_ant_ratio_better(alt_ratio, - ATH_ANT_DIV_COMB_LNA1_DELTA_HI, - ATH_ANT_DIV_COMB_LNA1_DELTA_LOW, - main_rssi_avg, alt_rssi_avg, - antcomb->total_pkt_count)) - antcomb->second_ratio = true; - else - antcomb->second_ratio = false; - } else if (antcomb->main_conf == ATH_ANT_DIV_COMB_LNA2) { - if (ath_is_alt_ant_ratio_better(alt_ratio, - ATH_ANT_DIV_COMB_LNA1_DELTA_MID, - ATH_ANT_DIV_COMB_LNA1_DELTA_LOW, - main_rssi_avg, alt_rssi_avg, - antcomb->total_pkt_count)) - antcomb->second_ratio = true; - else - antcomb->second_ratio = false; - } else { - if ((((alt_ratio >= ATH_ANT_DIV_COMB_ALT_ANT_RATIO2) && - (alt_rssi_avg > main_rssi_avg + - ATH_ANT_DIV_COMB_LNA1_DELTA_HI)) || - (alt_rssi_avg > main_rssi_avg)) && - (antcomb->total_pkt_count > 50)) - antcomb->second_ratio = true; - else - antcomb->second_ratio = false; - } - - /* set alt to the conf with maximun ratio */ - if (antcomb->first_ratio && antcomb->second_ratio) { - if (antcomb->rssi_second > antcomb->rssi_third) { - /* first alt*/ - if ((antcomb->first_quick_scan_conf == - ATH_ANT_DIV_COMB_LNA1) || - (antcomb->first_quick_scan_conf == - ATH_ANT_DIV_COMB_LNA2)) - /* Set alt LNA1 or LNA2*/ - if (div_ant_conf->main_lna_conf == - ATH_ANT_DIV_COMB_LNA2) - div_ant_conf->alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - else - div_ant_conf->alt_lna_conf = - ATH_ANT_DIV_COMB_LNA2; - else - /* Set alt to A+B or A-B */ - div_ant_conf->alt_lna_conf = - antcomb->first_quick_scan_conf; - } else if ((antcomb->second_quick_scan_conf == - ATH_ANT_DIV_COMB_LNA1) || - (antcomb->second_quick_scan_conf == - ATH_ANT_DIV_COMB_LNA2)) { - /* Set alt LNA1 or LNA2 */ - if (div_ant_conf->main_lna_conf == - ATH_ANT_DIV_COMB_LNA2) - div_ant_conf->alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - else - div_ant_conf->alt_lna_conf = - ATH_ANT_DIV_COMB_LNA2; - } else { - /* Set alt to A+B or A-B */ - div_ant_conf->alt_lna_conf = - antcomb->second_quick_scan_conf; - } - } else if (antcomb->first_ratio) { - /* first alt */ - if ((antcomb->first_quick_scan_conf == - ATH_ANT_DIV_COMB_LNA1) || - (antcomb->first_quick_scan_conf == - ATH_ANT_DIV_COMB_LNA2)) - /* Set alt LNA1 or LNA2 */ - if (div_ant_conf->main_lna_conf == - ATH_ANT_DIV_COMB_LNA2) - div_ant_conf->alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - else - div_ant_conf->alt_lna_conf = - ATH_ANT_DIV_COMB_LNA2; - else - /* Set alt to A+B or A-B */ - div_ant_conf->alt_lna_conf = - antcomb->first_quick_scan_conf; - } else if (antcomb->second_ratio) { - /* second alt */ - if ((antcomb->second_quick_scan_conf == - ATH_ANT_DIV_COMB_LNA1) || - (antcomb->second_quick_scan_conf == - ATH_ANT_DIV_COMB_LNA2)) - /* Set alt LNA1 or LNA2 */ - if (div_ant_conf->main_lna_conf == - ATH_ANT_DIV_COMB_LNA2) - div_ant_conf->alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - else - div_ant_conf->alt_lna_conf = - ATH_ANT_DIV_COMB_LNA2; - else - /* Set alt to A+B or A-B */ - div_ant_conf->alt_lna_conf = - antcomb->second_quick_scan_conf; - } else { - /* main is largest */ - if ((antcomb->main_conf == ATH_ANT_DIV_COMB_LNA1) || - (antcomb->main_conf == ATH_ANT_DIV_COMB_LNA2)) - /* Set alt LNA1 or LNA2 */ - if (div_ant_conf->main_lna_conf == - ATH_ANT_DIV_COMB_LNA2) - div_ant_conf->alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - else - div_ant_conf->alt_lna_conf = - ATH_ANT_DIV_COMB_LNA2; - else - /* Set alt to A+B or A-B */ - div_ant_conf->alt_lna_conf = antcomb->main_conf; - } - break; - default: - break; - } -} - -static void ath_ant_div_conf_fast_divbias(struct ath_hw_antcomb_conf *ant_conf, - struct ath_ant_comb *antcomb, - int alt_ratio) -{ - ant_conf->main_gaintb = 0; - ant_conf->alt_gaintb = 0; - - if (ant_conf->div_group == 0) { - /* Adjust the fast_div_bias based on main and alt lna conf */ - switch ((ant_conf->main_lna_conf << 4) | - ant_conf->alt_lna_conf) { - case 0x01: /* A-B LNA2 */ - ant_conf->fast_div_bias = 0x3b; - break; - case 0x02: /* A-B LNA1 */ - ant_conf->fast_div_bias = 0x3d; - break; - case 0x03: /* A-B A+B */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x10: /* LNA2 A-B */ - ant_conf->fast_div_bias = 0x7; - break; - case 0x12: /* LNA2 LNA1 */ - ant_conf->fast_div_bias = 0x2; - break; - case 0x13: /* LNA2 A+B */ - ant_conf->fast_div_bias = 0x7; - break; - case 0x20: /* LNA1 A-B */ - ant_conf->fast_div_bias = 0x6; - break; - case 0x21: /* LNA1 LNA2 */ - ant_conf->fast_div_bias = 0x0; - break; - case 0x23: /* LNA1 A+B */ - ant_conf->fast_div_bias = 0x6; - break; - case 0x30: /* A+B A-B */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x31: /* A+B LNA2 */ - ant_conf->fast_div_bias = 0x3b; - break; - case 0x32: /* A+B LNA1 */ - ant_conf->fast_div_bias = 0x3d; - break; - default: - break; - } - } else if (ant_conf->div_group == 1) { - /* Adjust the fast_div_bias based on main and alt_lna_conf */ - switch ((ant_conf->main_lna_conf << 4) | - ant_conf->alt_lna_conf) { - case 0x01: /* A-B LNA2 */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x02: /* A-B LNA1 */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x03: /* A-B A+B */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x10: /* LNA2 A-B */ - if (!(antcomb->scan) && - (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) - ant_conf->fast_div_bias = 0x3f; - else - ant_conf->fast_div_bias = 0x1; - break; - case 0x12: /* LNA2 LNA1 */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x13: /* LNA2 A+B */ - if (!(antcomb->scan) && - (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) - ant_conf->fast_div_bias = 0x3f; - else - ant_conf->fast_div_bias = 0x1; - break; - case 0x20: /* LNA1 A-B */ - if (!(antcomb->scan) && - (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) - ant_conf->fast_div_bias = 0x3f; - else - ant_conf->fast_div_bias = 0x1; - break; - case 0x21: /* LNA1 LNA2 */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x23: /* LNA1 A+B */ - if (!(antcomb->scan) && - (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) - ant_conf->fast_div_bias = 0x3f; - else - ant_conf->fast_div_bias = 0x1; - break; - case 0x30: /* A+B A-B */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x31: /* A+B LNA2 */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x32: /* A+B LNA1 */ - ant_conf->fast_div_bias = 0x1; - break; - default: - break; - } - } else if (ant_conf->div_group == 2) { - /* Adjust the fast_div_bias based on main and alt_lna_conf */ - switch ((ant_conf->main_lna_conf << 4) | - ant_conf->alt_lna_conf) { - case 0x01: /* A-B LNA2 */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x02: /* A-B LNA1 */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x03: /* A-B A+B */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x10: /* LNA2 A-B */ - if (!(antcomb->scan) && - (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) - ant_conf->fast_div_bias = 0x1; - else - ant_conf->fast_div_bias = 0x2; - break; - case 0x12: /* LNA2 LNA1 */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x13: /* LNA2 A+B */ - if (!(antcomb->scan) && - (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) - ant_conf->fast_div_bias = 0x1; - else - ant_conf->fast_div_bias = 0x2; - break; - case 0x20: /* LNA1 A-B */ - if (!(antcomb->scan) && - (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) - ant_conf->fast_div_bias = 0x1; - else - ant_conf->fast_div_bias = 0x2; - break; - case 0x21: /* LNA1 LNA2 */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x23: /* LNA1 A+B */ - if (!(antcomb->scan) && - (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) - ant_conf->fast_div_bias = 0x1; - else - ant_conf->fast_div_bias = 0x2; - break; - case 0x30: /* A+B A-B */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x31: /* A+B LNA2 */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x32: /* A+B LNA1 */ - ant_conf->fast_div_bias = 0x1; - break; - default: - break; - } - } else if (ant_conf->div_group == 3) { - switch ((ant_conf->main_lna_conf << 4) | - ant_conf->alt_lna_conf) { - case 0x01: /* A-B LNA2 */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x02: /* A-B LNA1 */ - ant_conf->fast_div_bias = 0x39; - break; - case 0x03: /* A-B A+B */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x10: /* LNA2 A-B */ - if ((antcomb->scan == 0) && - (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) { - ant_conf->fast_div_bias = 0x3f; - } else { - ant_conf->fast_div_bias = 0x1; - } - break; - case 0x12: /* LNA2 LNA1 */ - ant_conf->fast_div_bias = 0x39; - break; - case 0x13: /* LNA2 A+B */ - if ((antcomb->scan == 0) && - (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) { - ant_conf->fast_div_bias = 0x3f; - } else { - ant_conf->fast_div_bias = 0x1; - } - break; - case 0x20: /* LNA1 A-B */ - if ((antcomb->scan == 0) && - (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) { - ant_conf->fast_div_bias = 0x3f; - } else { - ant_conf->fast_div_bias = 0x4; - } - break; - case 0x21: /* LNA1 LNA2 */ - ant_conf->fast_div_bias = 0x6; - break; - case 0x23: /* LNA1 A+B */ - if ((antcomb->scan == 0) && - (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO)) { - ant_conf->fast_div_bias = 0x3f; - } else { - ant_conf->fast_div_bias = 0x6; - } - break; - case 0x30: /* A+B A-B */ - ant_conf->fast_div_bias = 0x1; - break; - case 0x31: /* A+B LNA2 */ - ant_conf->fast_div_bias = 0x6; - break; - case 0x32: /* A+B LNA1 */ - ant_conf->fast_div_bias = 0x1; - break; - default: - break; - } - } -} - -void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs) -{ - struct ath_hw_antcomb_conf div_ant_conf; - struct ath_ant_comb *antcomb = &sc->ant_comb; - int alt_ratio = 0, alt_rssi_avg = 0, main_rssi_avg = 0, curr_alt_set; - int curr_main_set; - int main_rssi = rs->rs_rssi_ctl0; - int alt_rssi = rs->rs_rssi_ctl1; - int rx_ant_conf, main_ant_conf; - bool short_scan = false; - - rx_ant_conf = (rs->rs_rssi_ctl2 >> ATH_ANT_RX_CURRENT_SHIFT) & - ATH_ANT_RX_MASK; - main_ant_conf = (rs->rs_rssi_ctl2 >> ATH_ANT_RX_MAIN_SHIFT) & - ATH_ANT_RX_MASK; - - /* Record packet only when both main_rssi and alt_rssi is positive */ - if (main_rssi > 0 && alt_rssi > 0) { - antcomb->total_pkt_count++; - antcomb->main_total_rssi += main_rssi; - antcomb->alt_total_rssi += alt_rssi; - if (main_ant_conf == rx_ant_conf) - antcomb->main_recv_cnt++; - else - antcomb->alt_recv_cnt++; - } - - /* Short scan check */ - if (antcomb->scan && antcomb->alt_good) { - if (time_after(jiffies, antcomb->scan_start_time + - msecs_to_jiffies(ATH_ANT_DIV_COMB_SHORT_SCAN_INTR))) - short_scan = true; - else - if (antcomb->total_pkt_count == - ATH_ANT_DIV_COMB_SHORT_SCAN_PKTCOUNT) { - alt_ratio = ((antcomb->alt_recv_cnt * 100) / - antcomb->total_pkt_count); - if (alt_ratio < ATH_ANT_DIV_COMB_ALT_ANT_RATIO) - short_scan = true; - } - } - - if (((antcomb->total_pkt_count < ATH_ANT_DIV_COMB_MAX_PKTCOUNT) || - rs->rs_moreaggr) && !short_scan) - return; - - if (antcomb->total_pkt_count) { - alt_ratio = ((antcomb->alt_recv_cnt * 100) / - antcomb->total_pkt_count); - main_rssi_avg = (antcomb->main_total_rssi / - antcomb->total_pkt_count); - alt_rssi_avg = (antcomb->alt_total_rssi / - antcomb->total_pkt_count); - } - - - ath9k_hw_antdiv_comb_conf_get(sc->sc_ah, &div_ant_conf); - curr_alt_set = div_ant_conf.alt_lna_conf; - curr_main_set = div_ant_conf.main_lna_conf; - - antcomb->count++; - - if (antcomb->count == ATH_ANT_DIV_COMB_MAX_COUNT) { - if (alt_ratio > ATH_ANT_DIV_COMB_ALT_ANT_RATIO) { - ath_lnaconf_alt_good_scan(antcomb, div_ant_conf, - main_rssi_avg); - antcomb->alt_good = true; - } else { - antcomb->alt_good = false; - } - - antcomb->count = 0; - antcomb->scan = true; - antcomb->scan_not_start = true; - } - - if (!antcomb->scan) { - if (ath_ant_div_comb_alt_check(div_ant_conf.div_group, - alt_ratio, curr_main_set, curr_alt_set, - alt_rssi_avg, main_rssi_avg)) { - if (curr_alt_set == ATH_ANT_DIV_COMB_LNA2) { - /* Switch main and alt LNA */ - div_ant_conf.main_lna_conf = - ATH_ANT_DIV_COMB_LNA2; - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - } else if (curr_alt_set == ATH_ANT_DIV_COMB_LNA1) { - div_ant_conf.main_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA2; - } - - goto div_comb_done; - } else if ((curr_alt_set != ATH_ANT_DIV_COMB_LNA1) && - (curr_alt_set != ATH_ANT_DIV_COMB_LNA2)) { - /* Set alt to another LNA */ - if (curr_main_set == ATH_ANT_DIV_COMB_LNA2) - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - else if (curr_main_set == ATH_ANT_DIV_COMB_LNA1) - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA2; - - goto div_comb_done; - } - - if ((alt_rssi_avg < (main_rssi_avg + - div_ant_conf.lna1_lna2_delta))) - goto div_comb_done; - } - - if (!antcomb->scan_not_start) { - switch (curr_alt_set) { - case ATH_ANT_DIV_COMB_LNA2: - antcomb->rssi_lna2 = alt_rssi_avg; - antcomb->rssi_lna1 = main_rssi_avg; - antcomb->scan = true; - /* set to A+B */ - div_ant_conf.main_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; - break; - case ATH_ANT_DIV_COMB_LNA1: - antcomb->rssi_lna1 = alt_rssi_avg; - antcomb->rssi_lna2 = main_rssi_avg; - antcomb->scan = true; - /* set to A+B */ - div_ant_conf.main_lna_conf = ATH_ANT_DIV_COMB_LNA2; - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; - break; - case ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2: - antcomb->rssi_add = alt_rssi_avg; - antcomb->scan = true; - /* set to A-B */ - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2; - break; - case ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2: - antcomb->rssi_sub = alt_rssi_avg; - antcomb->scan = false; - if (antcomb->rssi_lna2 > - (antcomb->rssi_lna1 + - ATH_ANT_DIV_COMB_LNA1_LNA2_SWITCH_DELTA)) { - /* use LNA2 as main LNA */ - if ((antcomb->rssi_add > antcomb->rssi_lna1) && - (antcomb->rssi_add > antcomb->rssi_sub)) { - /* set to A+B */ - div_ant_conf.main_lna_conf = - ATH_ANT_DIV_COMB_LNA2; - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; - } else if (antcomb->rssi_sub > - antcomb->rssi_lna1) { - /* set to A-B */ - div_ant_conf.main_lna_conf = - ATH_ANT_DIV_COMB_LNA2; - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2; - } else { - /* set to LNA1 */ - div_ant_conf.main_lna_conf = - ATH_ANT_DIV_COMB_LNA2; - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - } - } else { - /* use LNA1 as main LNA */ - if ((antcomb->rssi_add > antcomb->rssi_lna2) && - (antcomb->rssi_add > antcomb->rssi_sub)) { - /* set to A+B */ - div_ant_conf.main_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2; - } else if (antcomb->rssi_sub > - antcomb->rssi_lna1) { - /* set to A-B */ - div_ant_conf.main_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2; - } else { - /* set to LNA2 */ - div_ant_conf.main_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA2; - } - } - break; - default: - break; - } - } else { - if (!antcomb->alt_good) { - antcomb->scan_not_start = false; - /* Set alt to another LNA */ - if (curr_main_set == ATH_ANT_DIV_COMB_LNA2) { - div_ant_conf.main_lna_conf = - ATH_ANT_DIV_COMB_LNA2; - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - } else if (curr_main_set == ATH_ANT_DIV_COMB_LNA1) { - div_ant_conf.main_lna_conf = - ATH_ANT_DIV_COMB_LNA1; - div_ant_conf.alt_lna_conf = - ATH_ANT_DIV_COMB_LNA2; - } - goto div_comb_done; - } - } - - ath_select_ant_div_from_quick_scan(antcomb, &div_ant_conf, - main_rssi_avg, alt_rssi_avg, - alt_ratio); - - antcomb->quick_scan_cnt++; - -div_comb_done: - ath_ant_div_conf_fast_divbias(&div_ant_conf, antcomb, alt_ratio); - ath9k_hw_antdiv_comb_conf_set(sc->sc_ah, &div_ant_conf); - - antcomb->scan_start_time = jiffies; - antcomb->total_pkt_count = 0; - antcomb->main_total_rssi = 0; - antcomb->alt_total_rssi = 0; - antcomb->main_recv_cnt = 0; - antcomb->alt_recv_cnt = 0; -} - -void ath_ant_comb_update(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath_hw_antcomb_conf div_ant_conf; - u8 lna_conf; - - ath9k_hw_antdiv_comb_conf_get(ah, &div_ant_conf); - - if (sc->ant_rx == 1) - lna_conf = ATH_ANT_DIV_COMB_LNA1; - else - lna_conf = ATH_ANT_DIV_COMB_LNA2; - - div_ant_conf.main_lna_conf = lna_conf; - div_ant_conf.alt_lna_conf = lna_conf; - - ath9k_hw_antdiv_comb_conf_set(ah, &div_ant_conf); - - if (common->antenna_diversity) - ath9k_hw_antctrl_shared_chain_lnadiv(ah, true); -} diff --git a/drivers/net/wireless/ath/ath9k/ar5008_initvals.h b/drivers/net/wireless/ath/ath9k/ar5008_initvals.h deleted file mode 100644 index 467ccfae2cee..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar5008_initvals.h +++ /dev/null @@ -1,674 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -static const u32 ar5416Modes[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, - {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, - {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, - {0x000010f0, 0x0000a000, 0x00014000, 0x00016000, 0x0000b000}, - {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, - {0x0000801c, 0x128d93a7, 0x128d93cf, 0x12e013d7, 0x12e013ab}, - {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, - {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, - {0x00009804, 0x00000300, 0x000003c4, 0x000003c4, 0x00000300}, - {0x00009820, 0x02020200, 0x02020200, 0x02020200, 0x02020200}, - {0x00009824, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x00009828, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001}, - {0x00009834, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x00009838, 0x00000007, 0x00000007, 0x00000007, 0x00000007}, - {0x00009844, 0x1372161e, 0x1372161e, 0x137216a0, 0x137216a0}, - {0x00009848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68}, - {0x0000a848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68}, - {0x0000b848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68}, - {0x00009850, 0x6c48b4e0, 0x6d48b4e0, 0x6d48b0de, 0x6c48b0de}, - {0x00009858, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e}, - {0x0000985c, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, - {0x00009860, 0x00049d18, 0x00049d18, 0x00049d18, 0x00049d18}, - {0x00009864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00}, - {0x00009868, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190}, - {0x0000986c, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081}, - {0x00009914, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x00009918, 0x000001b8, 0x00000370, 0x00000268, 0x00000134}, - {0x00009924, 0xd0058a0b, 0xd0058a0b, 0xd0058a0b, 0xd0058a0b}, - {0x00009944, 0xffb81020, 0xffb81020, 0xffb81020, 0xffb81020}, - {0x00009960, 0x00000900, 0x00000900, 0x00012d80, 0x00012d80}, - {0x0000a960, 0x00000900, 0x00000900, 0x00012d80, 0x00012d80}, - {0x0000b960, 0x00000900, 0x00000900, 0x00012d80, 0x00012d80}, - {0x00009964, 0x00000000, 0x00000000, 0x00001120, 0x00001120}, - {0x000099bc, 0x001a0a00, 0x001a0a00, 0x001a0a00, 0x001a0a00}, - {0x000099c0, 0x038919be, 0x038919be, 0x038919be, 0x038919be}, - {0x000099c4, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77}, - {0x000099c8, 0x6af6532c, 0x6af6532c, 0x6af6532c, 0x6af6532c}, - {0x000099cc, 0x08f186c8, 0x08f186c8, 0x08f186c8, 0x08f186c8}, - {0x000099d0, 0x00046384, 0x00046384, 0x00046384, 0x00046384}, - {0x000099d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x000099d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a204, 0x00000880, 0x00000880, 0x00000880, 0x00000880}, - {0x0000a208, 0xd6be4788, 0xd6be4788, 0xd03e4788, 0xd03e4788}, - {0x0000a20c, 0x002ec1e0, 0x002ec1e0, 0x002ac120, 0x002ac120}, - {0x0000b20c, 0x002ec1e0, 0x002ec1e0, 0x002ac120, 0x002ac120}, - {0x0000c20c, 0x002ec1e0, 0x002ec1e0, 0x002ac120, 0x002ac120}, - {0x0000a21c, 0x1883800a, 0x1883800a, 0x1883800a, 0x1883800a}, - {0x0000a230, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a274, 0x0a1a9caa, 0x0a1a9caa, 0x0a1a7caa, 0x0a1a7caa}, - {0x0000a300, 0x18010000, 0x18010000, 0x18010000, 0x18010000}, - {0x0000a304, 0x30032602, 0x30032602, 0x2e032402, 0x2e032402}, - {0x0000a308, 0x48073e06, 0x48073e06, 0x4a0a3c06, 0x4a0a3c06}, - {0x0000a30c, 0x560b4c0a, 0x560b4c0a, 0x621a540b, 0x621a540b}, - {0x0000a310, 0x641a600f, 0x641a600f, 0x764f6c1b, 0x764f6c1b}, - {0x0000a314, 0x7a4f6e1b, 0x7a4f6e1b, 0x845b7a5a, 0x845b7a5a}, - {0x0000a318, 0x8c5b7e5a, 0x8c5b7e5a, 0x950f8ccf, 0x950f8ccf}, - {0x0000a31c, 0x9d0f96cf, 0x9d0f96cf, 0xa5cf9b4f, 0xa5cf9b4f}, - {0x0000a320, 0xb51fa69f, 0xb51fa69f, 0xbddfaf1f, 0xbddfaf1f}, - {0x0000a324, 0xcb3fbd07, 0xcb3fbcbf, 0xd1ffc93f, 0xd1ffc93f}, - {0x0000a328, 0x0000d7bf, 0x0000d7bf, 0x00000000, 0x00000000}, - {0x0000a32c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a330, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a334, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, -}; - -static const u32 ar5416Common[][2] = { - /* Addr allmodes */ - {0x0000000c, 0x00000000}, - {0x00000030, 0x00020015}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000008}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00000054, 0x0000001f}, - {0x00000800, 0x00000000}, - {0x00000804, 0x00000000}, - {0x00000808, 0x00000000}, - {0x0000080c, 0x00000000}, - {0x00000810, 0x00000000}, - {0x00000814, 0x00000000}, - {0x00000818, 0x00000000}, - {0x0000081c, 0x00000000}, - {0x00000820, 0x00000000}, - {0x00000824, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x00001230, 0x00000000}, - {0x00001270, 0x00000000}, - {0x00001038, 0x00000000}, - {0x00001078, 0x00000000}, - {0x000010b8, 0x00000000}, - {0x000010f8, 0x00000000}, - {0x00001138, 0x00000000}, - {0x00001178, 0x00000000}, - {0x000011b8, 0x00000000}, - {0x000011f8, 0x00000000}, - {0x00001238, 0x00000000}, - {0x00001278, 0x00000000}, - {0x000012b8, 0x00000000}, - {0x000012f8, 0x00000000}, - {0x00001338, 0x00000000}, - {0x00001378, 0x00000000}, - {0x000013b8, 0x00000000}, - {0x000013f8, 0x00000000}, - {0x00001438, 0x00000000}, - {0x00001478, 0x00000000}, - {0x000014b8, 0x00000000}, - {0x000014f8, 0x00000000}, - {0x00001538, 0x00000000}, - {0x00001578, 0x00000000}, - {0x000015b8, 0x00000000}, - {0x000015f8, 0x00000000}, - {0x00001638, 0x00000000}, - {0x00001678, 0x00000000}, - {0x000016b8, 0x00000000}, - {0x000016f8, 0x00000000}, - {0x00001738, 0x00000000}, - {0x00001778, 0x00000000}, - {0x000017b8, 0x00000000}, - {0x000017f8, 0x00000000}, - {0x0000103c, 0x00000000}, - {0x0000107c, 0x00000000}, - {0x000010bc, 0x00000000}, - {0x000010fc, 0x00000000}, - {0x0000113c, 0x00000000}, - {0x0000117c, 0x00000000}, - {0x000011bc, 0x00000000}, - {0x000011fc, 0x00000000}, - {0x0000123c, 0x00000000}, - {0x0000127c, 0x00000000}, - {0x000012bc, 0x00000000}, - {0x000012fc, 0x00000000}, - {0x0000133c, 0x00000000}, - {0x0000137c, 0x00000000}, - {0x000013bc, 0x00000000}, - {0x000013fc, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00004030, 0x00000002}, - {0x0000403c, 0x00000002}, - {0x00007010, 0x00000000}, - {0x00007038, 0x000004c2}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008018, 0x00000700}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00000000}, - {0x00008048, 0x40000000}, - {0x00008054, 0x00000000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x000080c0, 0x2a82301a}, - {0x000080c4, 0x05dc01e0}, - {0x000080c8, 0x1f402710}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00001e00}, - {0x000080d4, 0x00000000}, - {0x000080d8, 0x00400000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x003f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080f8, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00020000}, - {0x00008104, 0x00000001}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000168}, - {0x00008118, 0x000100aa}, - {0x0000811c, 0x00003210}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x00000000}, - {0x00008144, 0xffffffff}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x00008170, 0x32143320}, - {0x00008174, 0xfaa4fa50}, - {0x00008178, 0x00000100}, - {0x0000817c, 0x00000000}, - {0x000081c4, 0x00000000}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008200, 0x00000000}, - {0x00008204, 0x00000000}, - {0x00008208, 0x00000000}, - {0x0000820c, 0x00000000}, - {0x00008210, 0x00000000}, - {0x00008214, 0x00000000}, - {0x00008218, 0x00000000}, - {0x0000821c, 0x00000000}, - {0x00008220, 0x00000000}, - {0x00008224, 0x00000000}, - {0x00008228, 0x00000000}, - {0x0000822c, 0x00000000}, - {0x00008230, 0x00000000}, - {0x00008234, 0x00000000}, - {0x00008238, 0x00000000}, - {0x0000823c, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008244, 0x0010f400}, - {0x00008248, 0x00000100}, - {0x0000824c, 0x0001e800}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x400000ff}, - {0x00008260, 0x00080922}, - {0x00008264, 0x88000010}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000000}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x00000000}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x00008300, 0x00000000}, - {0x00008304, 0x00000000}, - {0x00008308, 0x00000000}, - {0x0000830c, 0x00000000}, - {0x00008310, 0x00000000}, - {0x00008314, 0x00000000}, - {0x00008318, 0x00000000}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x00000007}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000e00}, - {0x00008338, 0x00070000}, - {0x0000833c, 0x00000000}, - {0x00008340, 0x000107ff}, - {0x00009808, 0x00000000}, - {0x0000980c, 0xad848e19}, - {0x00009810, 0x7d14e000}, - {0x00009814, 0x9c0a9f6b}, - {0x0000981c, 0x00000000}, - {0x0000982c, 0x0000a000}, - {0x00009830, 0x00000000}, - {0x0000983c, 0x00200400}, - {0x00009840, 0x206a002e}, - {0x0000984c, 0x1284233c}, - {0x00009854, 0x00000859}, - {0x00009900, 0x00000000}, - {0x00009904, 0x00000000}, - {0x00009908, 0x00000000}, - {0x0000990c, 0x00000000}, - {0x0000991c, 0x10000fff}, - {0x00009920, 0x05100000}, - {0x0000a920, 0x05100000}, - {0x0000b920, 0x05100000}, - {0x00009928, 0x00000001}, - {0x0000992c, 0x00000004}, - {0x00009934, 0x1e1f2022}, - {0x00009938, 0x0a0b0c0d}, - {0x0000993c, 0x00000000}, - {0x00009948, 0x9280b212}, - {0x0000994c, 0x00020028}, - {0x00009954, 0x5d50e188}, - {0x00009958, 0x00081fff}, - {0x0000c95c, 0x004b6a8e}, - {0x0000c968, 0x000003ce}, - {0x00009970, 0x190fb515}, - {0x00009974, 0x00000000}, - {0x00009978, 0x00000001}, - {0x0000997c, 0x00000000}, - {0x00009980, 0x00000000}, - {0x00009984, 0x00000000}, - {0x00009988, 0x00000000}, - {0x0000998c, 0x00000000}, - {0x00009990, 0x00000000}, - {0x00009994, 0x00000000}, - {0x00009998, 0x00000000}, - {0x0000999c, 0x00000000}, - {0x000099a0, 0x00000000}, - {0x000099a4, 0x00000001}, - {0x000099a8, 0x001fff00}, - {0x000099ac, 0x00000000}, - {0x000099b0, 0x03051000}, - {0x000099dc, 0x00000000}, - {0x000099e0, 0x00000200}, - {0x000099e4, 0xaaaaaaaa}, - {0x000099e8, 0x3c466478}, - {0x000099ec, 0x000000aa}, - {0x000099fc, 0x00001042}, - {0x00009b00, 0x00000000}, - {0x00009b04, 0x00000001}, - {0x00009b08, 0x00000002}, - {0x00009b0c, 0x00000003}, - {0x00009b10, 0x00000004}, - {0x00009b14, 0x00000005}, - {0x00009b18, 0x00000008}, - {0x00009b1c, 0x00000009}, - {0x00009b20, 0x0000000a}, - {0x00009b24, 0x0000000b}, - {0x00009b28, 0x0000000c}, - {0x00009b2c, 0x0000000d}, - {0x00009b30, 0x00000010}, - {0x00009b34, 0x00000011}, - {0x00009b38, 0x00000012}, - {0x00009b3c, 0x00000013}, - {0x00009b40, 0x00000014}, - {0x00009b44, 0x00000015}, - {0x00009b48, 0x00000018}, - {0x00009b4c, 0x00000019}, - {0x00009b50, 0x0000001a}, - {0x00009b54, 0x0000001b}, - {0x00009b58, 0x0000001c}, - {0x00009b5c, 0x0000001d}, - {0x00009b60, 0x00000020}, - {0x00009b64, 0x00000021}, - {0x00009b68, 0x00000022}, - {0x00009b6c, 0x00000023}, - {0x00009b70, 0x00000024}, - {0x00009b74, 0x00000025}, - {0x00009b78, 0x00000028}, - {0x00009b7c, 0x00000029}, - {0x00009b80, 0x0000002a}, - {0x00009b84, 0x0000002b}, - {0x00009b88, 0x0000002c}, - {0x00009b8c, 0x0000002d}, - {0x00009b90, 0x00000030}, - {0x00009b94, 0x00000031}, - {0x00009b98, 0x00000032}, - {0x00009b9c, 0x00000033}, - {0x00009ba0, 0x00000034}, - {0x00009ba4, 0x00000035}, - {0x00009ba8, 0x00000035}, - {0x00009bac, 0x00000035}, - {0x00009bb0, 0x00000035}, - {0x00009bb4, 0x00000035}, - {0x00009bb8, 0x00000035}, - {0x00009bbc, 0x00000035}, - {0x00009bc0, 0x00000035}, - {0x00009bc4, 0x00000035}, - {0x00009bc8, 0x00000035}, - {0x00009bcc, 0x00000035}, - {0x00009bd0, 0x00000035}, - {0x00009bd4, 0x00000035}, - {0x00009bd8, 0x00000035}, - {0x00009bdc, 0x00000035}, - {0x00009be0, 0x00000035}, - {0x00009be4, 0x00000035}, - {0x00009be8, 0x00000035}, - {0x00009bec, 0x00000035}, - {0x00009bf0, 0x00000035}, - {0x00009bf4, 0x00000035}, - {0x00009bf8, 0x00000010}, - {0x00009bfc, 0x0000001a}, - {0x0000a210, 0x40806333}, - {0x0000a214, 0x00106c10}, - {0x0000a218, 0x009c4060}, - {0x0000a220, 0x018830c6}, - {0x0000a224, 0x00000400}, - {0x0000a228, 0x00000bb5}, - {0x0000a22c, 0x00000011}, - {0x0000a234, 0x20202020}, - {0x0000a238, 0x20202020}, - {0x0000a23c, 0x13c889af}, - {0x0000a240, 0x38490a20}, - {0x0000a244, 0x00007bb6}, - {0x0000a248, 0x0fff3ffc}, - {0x0000a24c, 0x00000001}, - {0x0000a250, 0x0000a000}, - {0x0000a254, 0x00000000}, - {0x0000a258, 0x0cc75380}, - {0x0000a25c, 0x0f0f0f01}, - {0x0000a260, 0xdfa91f01}, - {0x0000a268, 0x00000000}, - {0x0000a26c, 0x0e79e5c6}, - {0x0000b26c, 0x0e79e5c6}, - {0x0000c26c, 0x0e79e5c6}, - {0x0000d270, 0x00820820}, - {0x0000a278, 0x1ce739ce}, - {0x0000a27c, 0x051701ce}, - {0x0000a338, 0x00000000}, - {0x0000a33c, 0x00000000}, - {0x0000a340, 0x00000000}, - {0x0000a344, 0x00000000}, - {0x0000a348, 0x3fffffff}, - {0x0000a34c, 0x3fffffff}, - {0x0000a350, 0x3fffffff}, - {0x0000a354, 0x0003ffff}, - {0x0000a358, 0x79a8aa1f}, - {0x0000d35c, 0x07ffffef}, - {0x0000d360, 0x0fffffe7}, - {0x0000d364, 0x17ffffe5}, - {0x0000d368, 0x1fffffe4}, - {0x0000d36c, 0x37ffffe3}, - {0x0000d370, 0x3fffffe3}, - {0x0000d374, 0x57ffffe3}, - {0x0000d378, 0x5fffffe2}, - {0x0000d37c, 0x7fffffe2}, - {0x0000d380, 0x7f3c7bba}, - {0x0000d384, 0xf3307ff0}, - {0x0000a388, 0x08000000}, - {0x0000a38c, 0x20202020}, - {0x0000a390, 0x20202020}, - {0x0000a394, 0x1ce739ce}, - {0x0000a398, 0x000001ce}, - {0x0000a39c, 0x00000001}, - {0x0000a3a0, 0x00000000}, - {0x0000a3a4, 0x00000000}, - {0x0000a3a8, 0x00000000}, - {0x0000a3ac, 0x00000000}, - {0x0000a3b0, 0x00000000}, - {0x0000a3b4, 0x00000000}, - {0x0000a3b8, 0x00000000}, - {0x0000a3bc, 0x00000000}, - {0x0000a3c0, 0x00000000}, - {0x0000a3c4, 0x00000000}, - {0x0000a3c8, 0x00000246}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3dc, 0x1ce739ce}, - {0x0000a3e0, 0x000001ce}, -}; - -static const u32 ar5416Bank0[][2] = { - /* Addr allmodes */ - {0x000098b0, 0x1e5795e5}, - {0x000098e0, 0x02008020}, -}; - -static const u32 ar5416BB_RfGain[][3] = { - /* Addr 5G 2G */ - {0x00009a00, 0x00000000, 0x00000000}, - {0x00009a04, 0x00000040, 0x00000040}, - {0x00009a08, 0x00000080, 0x00000080}, - {0x00009a0c, 0x000001a1, 0x00000141}, - {0x00009a10, 0x000001e1, 0x00000181}, - {0x00009a14, 0x00000021, 0x000001c1}, - {0x00009a18, 0x00000061, 0x00000001}, - {0x00009a1c, 0x00000168, 0x00000041}, - {0x00009a20, 0x000001a8, 0x000001a8}, - {0x00009a24, 0x000001e8, 0x000001e8}, - {0x00009a28, 0x00000028, 0x00000028}, - {0x00009a2c, 0x00000068, 0x00000068}, - {0x00009a30, 0x00000189, 0x000000a8}, - {0x00009a34, 0x000001c9, 0x00000169}, - {0x00009a38, 0x00000009, 0x000001a9}, - {0x00009a3c, 0x00000049, 0x000001e9}, - {0x00009a40, 0x00000089, 0x00000029}, - {0x00009a44, 0x00000170, 0x00000069}, - {0x00009a48, 0x000001b0, 0x00000190}, - {0x00009a4c, 0x000001f0, 0x000001d0}, - {0x00009a50, 0x00000030, 0x00000010}, - {0x00009a54, 0x00000070, 0x00000050}, - {0x00009a58, 0x00000191, 0x00000090}, - {0x00009a5c, 0x000001d1, 0x00000151}, - {0x00009a60, 0x00000011, 0x00000191}, - {0x00009a64, 0x00000051, 0x000001d1}, - {0x00009a68, 0x00000091, 0x00000011}, - {0x00009a6c, 0x000001b8, 0x00000051}, - {0x00009a70, 0x000001f8, 0x00000198}, - {0x00009a74, 0x00000038, 0x000001d8}, - {0x00009a78, 0x00000078, 0x00000018}, - {0x00009a7c, 0x00000199, 0x00000058}, - {0x00009a80, 0x000001d9, 0x00000098}, - {0x00009a84, 0x00000019, 0x00000159}, - {0x00009a88, 0x00000059, 0x00000199}, - {0x00009a8c, 0x00000099, 0x000001d9}, - {0x00009a90, 0x000000d9, 0x00000019}, - {0x00009a94, 0x000000f9, 0x00000059}, - {0x00009a98, 0x000000f9, 0x00000099}, - {0x00009a9c, 0x000000f9, 0x000000d9}, - {0x00009aa0, 0x000000f9, 0x000000f9}, - {0x00009aa4, 0x000000f9, 0x000000f9}, - {0x00009aa8, 0x000000f9, 0x000000f9}, - {0x00009aac, 0x000000f9, 0x000000f9}, - {0x00009ab0, 0x000000f9, 0x000000f9}, - {0x00009ab4, 0x000000f9, 0x000000f9}, - {0x00009ab8, 0x000000f9, 0x000000f9}, - {0x00009abc, 0x000000f9, 0x000000f9}, - {0x00009ac0, 0x000000f9, 0x000000f9}, - {0x00009ac4, 0x000000f9, 0x000000f9}, - {0x00009ac8, 0x000000f9, 0x000000f9}, - {0x00009acc, 0x000000f9, 0x000000f9}, - {0x00009ad0, 0x000000f9, 0x000000f9}, - {0x00009ad4, 0x000000f9, 0x000000f9}, - {0x00009ad8, 0x000000f9, 0x000000f9}, - {0x00009adc, 0x000000f9, 0x000000f9}, - {0x00009ae0, 0x000000f9, 0x000000f9}, - {0x00009ae4, 0x000000f9, 0x000000f9}, - {0x00009ae8, 0x000000f9, 0x000000f9}, - {0x00009aec, 0x000000f9, 0x000000f9}, - {0x00009af0, 0x000000f9, 0x000000f9}, - {0x00009af4, 0x000000f9, 0x000000f9}, - {0x00009af8, 0x000000f9, 0x000000f9}, - {0x00009afc, 0x000000f9, 0x000000f9}, -}; - -static const u32 ar5416Bank1[][2] = { - /* Addr allmodes */ - {0x000098b0, 0x02108421}, - {0x000098ec, 0x00000008}, -}; - -static const u32 ar5416Bank2[][2] = { - /* Addr allmodes */ - {0x000098b0, 0x0e73ff17}, - {0x000098e0, 0x00000420}, -}; - -static const u32 ar5416Bank3[][3] = { - /* Addr 5G 2G */ - {0x000098f0, 0x01400018, 0x01c00018}, -}; - -static const u32 ar5416Bank6[][3] = { - /* Addr 5G 2G */ - {0x0000989c, 0x00000000, 0x00000000}, - {0x0000989c, 0x00000000, 0x00000000}, - {0x0000989c, 0x00000000, 0x00000000}, - {0x0000989c, 0x00e00000, 0x00e00000}, - {0x0000989c, 0x005e0000, 0x005e0000}, - {0x0000989c, 0x00120000, 0x00120000}, - {0x0000989c, 0x00620000, 0x00620000}, - {0x0000989c, 0x00020000, 0x00020000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x40ff0000, 0x40ff0000}, - {0x0000989c, 0x005f0000, 0x005f0000}, - {0x0000989c, 0x00870000, 0x00870000}, - {0x0000989c, 0x00f90000, 0x00f90000}, - {0x0000989c, 0x007b0000, 0x007b0000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x00f50000, 0x00f50000}, - {0x0000989c, 0x00dc0000, 0x00dc0000}, - {0x0000989c, 0x00110000, 0x00110000}, - {0x0000989c, 0x006100a8, 0x006100a8}, - {0x0000989c, 0x004210a2, 0x004210a2}, - {0x0000989c, 0x0014008f, 0x0014008f}, - {0x0000989c, 0x00c40003, 0x00c40003}, - {0x0000989c, 0x003000f2, 0x003000f2}, - {0x0000989c, 0x00440016, 0x00440016}, - {0x0000989c, 0x00410040, 0x00410040}, - {0x0000989c, 0x0001805e, 0x0001805e}, - {0x0000989c, 0x0000c0ab, 0x0000c0ab}, - {0x0000989c, 0x000000f1, 0x000000f1}, - {0x0000989c, 0x00002081, 0x00002081}, - {0x0000989c, 0x000000d4, 0x000000d4}, - {0x000098d0, 0x0000000f, 0x0010000f}, -}; - -static const u32 ar5416Bank6TPC[][3] = { - /* Addr 5G 2G */ - {0x0000989c, 0x00000000, 0x00000000}, - {0x0000989c, 0x00000000, 0x00000000}, - {0x0000989c, 0x00000000, 0x00000000}, - {0x0000989c, 0x00e00000, 0x00e00000}, - {0x0000989c, 0x005e0000, 0x005e0000}, - {0x0000989c, 0x00120000, 0x00120000}, - {0x0000989c, 0x00620000, 0x00620000}, - {0x0000989c, 0x00020000, 0x00020000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x40ff0000, 0x40ff0000}, - {0x0000989c, 0x005f0000, 0x005f0000}, - {0x0000989c, 0x00870000, 0x00870000}, - {0x0000989c, 0x00f90000, 0x00f90000}, - {0x0000989c, 0x007b0000, 0x007b0000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x00f50000, 0x00f50000}, - {0x0000989c, 0x00dc0000, 0x00dc0000}, - {0x0000989c, 0x00110000, 0x00110000}, - {0x0000989c, 0x006100a8, 0x006100a8}, - {0x0000989c, 0x00423022, 0x00423022}, - {0x0000989c, 0x201400df, 0x201400df}, - {0x0000989c, 0x00c40002, 0x00c40002}, - {0x0000989c, 0x003000f2, 0x003000f2}, - {0x0000989c, 0x00440016, 0x00440016}, - {0x0000989c, 0x00410040, 0x00410040}, - {0x0000989c, 0x0001805e, 0x0001805e}, - {0x0000989c, 0x0000c0ab, 0x0000c0ab}, - {0x0000989c, 0x000000e1, 0x000000e1}, - {0x0000989c, 0x00007081, 0x00007081}, - {0x0000989c, 0x000000d4, 0x000000d4}, - {0x000098d0, 0x0000000f, 0x0010000f}, -}; - -static const u32 ar5416Bank7[][2] = { - /* Addr allmodes */ - {0x0000989c, 0x00000500}, - {0x0000989c, 0x00000800}, - {0x000098cc, 0x0000000e}, -}; - -static const u32 ar5416Addac[][2] = { - /* Addr allmodes */ - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000003}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x0000000c}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000030}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000060}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000058}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x000098c4, 0x00000000}, -}; - diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c deleted file mode 100644 index 391da5ad6a99..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ /dev/null @@ -1,1358 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "hw.h" -#include "hw-ops.h" -#include "../regd.h" -#include "ar9002_phy.h" -#include "ar5008_initvals.h" - -/* All code below is for AR5008, AR9001, AR9002 */ - -static const int firstep_table[] = -/* level: 0 1 2 3 4 5 6 7 8 */ - { -4, -2, 0, 2, 4, 6, 8, 10, 12 }; /* lvl 0-8, default 2 */ - -static const int cycpwrThr1_table[] = -/* level: 0 1 2 3 4 5 6 7 8 */ - { -6, -4, -2, 0, 2, 4, 6, 8 }; /* lvl 0-7, default 3 */ - -/* - * register values to turn OFDM weak signal detection OFF - */ -static const int m1ThreshLow_off = 127; -static const int m2ThreshLow_off = 127; -static const int m1Thresh_off = 127; -static const int m2Thresh_off = 127; -static const int m2CountThr_off = 31; -static const int m2CountThrLow_off = 63; -static const int m1ThreshLowExt_off = 127; -static const int m2ThreshLowExt_off = 127; -static const int m1ThreshExt_off = 127; -static const int m2ThreshExt_off = 127; - -static const struct ar5416IniArray bank0 = STATIC_INI_ARRAY(ar5416Bank0); -static const struct ar5416IniArray bank1 = STATIC_INI_ARRAY(ar5416Bank1); -static const struct ar5416IniArray bank2 = STATIC_INI_ARRAY(ar5416Bank2); -static const struct ar5416IniArray bank3 = STATIC_INI_ARRAY(ar5416Bank3); -static const struct ar5416IniArray bank7 = STATIC_INI_ARRAY(ar5416Bank7); - -static void ar5008_write_bank6(struct ath_hw *ah, unsigned int *writecnt) -{ - struct ar5416IniArray *array = &ah->iniBank6; - u32 *data = ah->analogBank6Data; - int r; - - ENABLE_REGWRITE_BUFFER(ah); - - for (r = 0; r < array->ia_rows; r++) { - REG_WRITE(ah, INI_RA(array, r, 0), data[r]); - DO_DELAY(*writecnt); - } - - REGWRITE_BUFFER_FLUSH(ah); -} - -/** - * ar5008_hw_phy_modify_rx_buffer() - perform analog swizzling of parameters - * @rfbuf: - * @reg32: - * @numBits: - * @firstBit: - * @column: - * - * Performs analog "swizzling" of parameters into their location. - * Used on external AR2133/AR5133 radios. - */ -static void ar5008_hw_phy_modify_rx_buffer(u32 *rfBuf, u32 reg32, - u32 numBits, u32 firstBit, - u32 column) -{ - u32 tmp32, mask, arrayEntry, lastBit; - int32_t bitPosition, bitsLeft; - - tmp32 = ath9k_hw_reverse_bits(reg32, numBits); - arrayEntry = (firstBit - 1) / 8; - bitPosition = (firstBit - 1) % 8; - bitsLeft = numBits; - while (bitsLeft > 0) { - lastBit = (bitPosition + bitsLeft > 8) ? - 8 : bitPosition + bitsLeft; - mask = (((1 << lastBit) - 1) ^ ((1 << bitPosition) - 1)) << - (column * 8); - rfBuf[arrayEntry] &= ~mask; - rfBuf[arrayEntry] |= ((tmp32 << bitPosition) << - (column * 8)) & mask; - bitsLeft -= 8 - bitPosition; - tmp32 = tmp32 >> (8 - bitPosition); - bitPosition = 0; - arrayEntry++; - } -} - -/* - * Fix on 2.4 GHz band for orientation sensitivity issue by increasing - * rf_pwd_icsyndiv. - * - * Theoretical Rules: - * if 2 GHz band - * if forceBiasAuto - * if synth_freq < 2412 - * bias = 0 - * else if 2412 <= synth_freq <= 2422 - * bias = 1 - * else // synth_freq > 2422 - * bias = 2 - * else if forceBias > 0 - * bias = forceBias & 7 - * else - * no change, use value from ini file - * else - * no change, invalid band - * - * 1st Mod: - * 2422 also uses value of 2 - * - * - * 2nd Mod: - * Less than 2412 uses value of 0, 2412 and above uses value of 2 - */ -static void ar5008_hw_force_bias(struct ath_hw *ah, u16 synth_freq) -{ - struct ath_common *common = ath9k_hw_common(ah); - u32 tmp_reg; - int reg_writes = 0; - u32 new_bias = 0; - - if (!AR_SREV_5416(ah) || synth_freq >= 3000) - return; - - BUG_ON(AR_SREV_9280_20_OR_LATER(ah)); - - if (synth_freq < 2412) - new_bias = 0; - else if (synth_freq < 2422) - new_bias = 1; - else - new_bias = 2; - - /* pre-reverse this field */ - tmp_reg = ath9k_hw_reverse_bits(new_bias, 3); - - ath_dbg(common, CONFIG, "Force rf_pwd_icsyndiv to %1d on %4d\n", - new_bias, synth_freq); - - /* swizzle rf_pwd_icsyndiv */ - ar5008_hw_phy_modify_rx_buffer(ah->analogBank6Data, tmp_reg, 3, 181, 3); - - /* write Bank 6 with new params */ - ar5008_write_bank6(ah, ®_writes); -} - -/** - * ar5008_hw_set_channel - tune to a channel on the external AR2133/AR5133 radios - * @ah: atheros hardware structure - * @chan: - * - * For the external AR2133/AR5133 radios, takes the MHz channel value and set - * the channel value. Assumes writes enabled to analog bus and bank6 register - * cache in ah->analogBank6Data. - */ -static int ar5008_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan) -{ - struct ath_common *common = ath9k_hw_common(ah); - u32 channelSel = 0; - u32 bModeSynth = 0; - u32 aModeRefSel = 0; - u32 reg32 = 0; - u16 freq; - struct chan_centers centers; - - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - freq = centers.synth_center; - - if (freq < 4800) { - u32 txctl; - - if (((freq - 2192) % 5) == 0) { - channelSel = ((freq - 672) * 2 - 3040) / 10; - bModeSynth = 0; - } else if (((freq - 2224) % 5) == 0) { - channelSel = ((freq - 704) * 2 - 3040) / 10; - bModeSynth = 1; - } else { - ath_err(common, "Invalid channel %u MHz\n", freq); - return -EINVAL; - } - - channelSel = (channelSel << 2) & 0xff; - channelSel = ath9k_hw_reverse_bits(channelSel, 8); - - txctl = REG_READ(ah, AR_PHY_CCK_TX_CTRL); - if (freq == 2484) { - - REG_WRITE(ah, AR_PHY_CCK_TX_CTRL, - txctl | AR_PHY_CCK_TX_CTRL_JAPAN); - } else { - REG_WRITE(ah, AR_PHY_CCK_TX_CTRL, - txctl & ~AR_PHY_CCK_TX_CTRL_JAPAN); - } - - } else if ((freq % 20) == 0 && freq >= 5120) { - channelSel = - ath9k_hw_reverse_bits(((freq - 4800) / 20 << 2), 8); - aModeRefSel = ath9k_hw_reverse_bits(1, 2); - } else if ((freq % 10) == 0) { - channelSel = - ath9k_hw_reverse_bits(((freq - 4800) / 10 << 1), 8); - if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) - aModeRefSel = ath9k_hw_reverse_bits(2, 2); - else - aModeRefSel = ath9k_hw_reverse_bits(1, 2); - } else if ((freq % 5) == 0) { - channelSel = ath9k_hw_reverse_bits((freq - 4800) / 5, 8); - aModeRefSel = ath9k_hw_reverse_bits(1, 2); - } else { - ath_err(common, "Invalid channel %u MHz\n", freq); - return -EINVAL; - } - - ar5008_hw_force_bias(ah, freq); - - reg32 = - (channelSel << 8) | (aModeRefSel << 2) | (bModeSynth << 1) | - (1 << 5) | 0x1; - - REG_WRITE(ah, AR_PHY(0x37), reg32); - - ah->curchan = chan; - - return 0; -} - -/** - * ar5008_hw_spur_mitigate - convert baseband spur frequency for external radios - * @ah: atheros hardware structure - * @chan: - * - * For non single-chip solutions. Converts to baseband spur frequency given the - * input channel frequency and compute register settings below. - */ -static void ar5008_hw_spur_mitigate(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - int bb_spur = AR_NO_SPUR; - int bin, cur_bin; - int spur_freq_sd; - int spur_delta_phase; - int denominator; - int upper, lower, cur_vit_mask; - int tmp, new; - int i; - static int pilot_mask_reg[4] = { - AR_PHY_TIMING7, AR_PHY_TIMING8, - AR_PHY_PILOT_MASK_01_30, AR_PHY_PILOT_MASK_31_60 - }; - static int chan_mask_reg[4] = { - AR_PHY_TIMING9, AR_PHY_TIMING10, - AR_PHY_CHANNEL_MASK_01_30, AR_PHY_CHANNEL_MASK_31_60 - }; - static int inc[4] = { 0, 100, 0, 0 }; - - int8_t mask_m[123]; - int8_t mask_p[123]; - int8_t mask_amt; - int tmp_mask; - int cur_bb_spur; - bool is2GHz = IS_CHAN_2GHZ(chan); - - memset(&mask_m, 0, sizeof(int8_t) * 123); - memset(&mask_p, 0, sizeof(int8_t) * 123); - - for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { - cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz); - if (AR_NO_SPUR == cur_bb_spur) - break; - cur_bb_spur = cur_bb_spur - (chan->channel * 10); - if ((cur_bb_spur > -95) && (cur_bb_spur < 95)) { - bb_spur = cur_bb_spur; - break; - } - } - - if (AR_NO_SPUR == bb_spur) - return; - - bin = bb_spur * 32; - - tmp = REG_READ(ah, AR_PHY_TIMING_CTRL4(0)); - new = tmp | (AR_PHY_TIMING_CTRL4_ENABLE_SPUR_RSSI | - AR_PHY_TIMING_CTRL4_ENABLE_SPUR_FILTER | - AR_PHY_TIMING_CTRL4_ENABLE_CHAN_MASK | - AR_PHY_TIMING_CTRL4_ENABLE_PILOT_MASK); - - REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0), new); - - new = (AR_PHY_SPUR_REG_MASK_RATE_CNTL | - AR_PHY_SPUR_REG_ENABLE_MASK_PPM | - AR_PHY_SPUR_REG_MASK_RATE_SELECT | - AR_PHY_SPUR_REG_ENABLE_VIT_SPUR_RSSI | - SM(SPUR_RSSI_THRESH, AR_PHY_SPUR_REG_SPUR_RSSI_THRESH)); - REG_WRITE(ah, AR_PHY_SPUR_REG, new); - - spur_delta_phase = ((bb_spur * 524288) / 100) & - AR_PHY_TIMING11_SPUR_DELTA_PHASE; - - denominator = IS_CHAN_2GHZ(chan) ? 440 : 400; - spur_freq_sd = ((bb_spur * 2048) / denominator) & 0x3ff; - - new = (AR_PHY_TIMING11_USE_SPUR_IN_AGC | - SM(spur_freq_sd, AR_PHY_TIMING11_SPUR_FREQ_SD) | - SM(spur_delta_phase, AR_PHY_TIMING11_SPUR_DELTA_PHASE)); - REG_WRITE(ah, AR_PHY_TIMING11, new); - - cur_bin = -6000; - upper = bin + 100; - lower = bin - 100; - - for (i = 0; i < 4; i++) { - int pilot_mask = 0; - int chan_mask = 0; - int bp = 0; - for (bp = 0; bp < 30; bp++) { - if ((cur_bin > lower) && (cur_bin < upper)) { - pilot_mask = pilot_mask | 0x1 << bp; - chan_mask = chan_mask | 0x1 << bp; - } - cur_bin += 100; - } - cur_bin += inc[i]; - REG_WRITE(ah, pilot_mask_reg[i], pilot_mask); - REG_WRITE(ah, chan_mask_reg[i], chan_mask); - } - - cur_vit_mask = 6100; - upper = bin + 120; - lower = bin - 120; - - for (i = 0; i < 123; i++) { - if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) { - - /* workaround for gcc bug #37014 */ - volatile int tmp_v = abs(cur_vit_mask - bin); - - if (tmp_v < 75) - mask_amt = 1; - else - mask_amt = 0; - if (cur_vit_mask < 0) - mask_m[abs(cur_vit_mask / 100)] = mask_amt; - else - mask_p[cur_vit_mask / 100] = mask_amt; - } - cur_vit_mask -= 100; - } - - tmp_mask = (mask_m[46] << 30) | (mask_m[47] << 28) - | (mask_m[48] << 26) | (mask_m[49] << 24) - | (mask_m[50] << 22) | (mask_m[51] << 20) - | (mask_m[52] << 18) | (mask_m[53] << 16) - | (mask_m[54] << 14) | (mask_m[55] << 12) - | (mask_m[56] << 10) | (mask_m[57] << 8) - | (mask_m[58] << 6) | (mask_m[59] << 4) - | (mask_m[60] << 2) | (mask_m[61] << 0); - REG_WRITE(ah, AR_PHY_BIN_MASK_1, tmp_mask); - REG_WRITE(ah, AR_PHY_VIT_MASK2_M_46_61, tmp_mask); - - tmp_mask = (mask_m[31] << 28) - | (mask_m[32] << 26) | (mask_m[33] << 24) - | (mask_m[34] << 22) | (mask_m[35] << 20) - | (mask_m[36] << 18) | (mask_m[37] << 16) - | (mask_m[48] << 14) | (mask_m[39] << 12) - | (mask_m[40] << 10) | (mask_m[41] << 8) - | (mask_m[42] << 6) | (mask_m[43] << 4) - | (mask_m[44] << 2) | (mask_m[45] << 0); - REG_WRITE(ah, AR_PHY_BIN_MASK_2, tmp_mask); - REG_WRITE(ah, AR_PHY_MASK2_M_31_45, tmp_mask); - - tmp_mask = (mask_m[16] << 30) | (mask_m[16] << 28) - | (mask_m[18] << 26) | (mask_m[18] << 24) - | (mask_m[20] << 22) | (mask_m[20] << 20) - | (mask_m[22] << 18) | (mask_m[22] << 16) - | (mask_m[24] << 14) | (mask_m[24] << 12) - | (mask_m[25] << 10) | (mask_m[26] << 8) - | (mask_m[27] << 6) | (mask_m[28] << 4) - | (mask_m[29] << 2) | (mask_m[30] << 0); - REG_WRITE(ah, AR_PHY_BIN_MASK_3, tmp_mask); - REG_WRITE(ah, AR_PHY_MASK2_M_16_30, tmp_mask); - - tmp_mask = (mask_m[0] << 30) | (mask_m[1] << 28) - | (mask_m[2] << 26) | (mask_m[3] << 24) - | (mask_m[4] << 22) | (mask_m[5] << 20) - | (mask_m[6] << 18) | (mask_m[7] << 16) - | (mask_m[8] << 14) | (mask_m[9] << 12) - | (mask_m[10] << 10) | (mask_m[11] << 8) - | (mask_m[12] << 6) | (mask_m[13] << 4) - | (mask_m[14] << 2) | (mask_m[15] << 0); - REG_WRITE(ah, AR_PHY_MASK_CTL, tmp_mask); - REG_WRITE(ah, AR_PHY_MASK2_M_00_15, tmp_mask); - - tmp_mask = (mask_p[15] << 28) - | (mask_p[14] << 26) | (mask_p[13] << 24) - | (mask_p[12] << 22) | (mask_p[11] << 20) - | (mask_p[10] << 18) | (mask_p[9] << 16) - | (mask_p[8] << 14) | (mask_p[7] << 12) - | (mask_p[6] << 10) | (mask_p[5] << 8) - | (mask_p[4] << 6) | (mask_p[3] << 4) - | (mask_p[2] << 2) | (mask_p[1] << 0); - REG_WRITE(ah, AR_PHY_BIN_MASK2_1, tmp_mask); - REG_WRITE(ah, AR_PHY_MASK2_P_15_01, tmp_mask); - - tmp_mask = (mask_p[30] << 28) - | (mask_p[29] << 26) | (mask_p[28] << 24) - | (mask_p[27] << 22) | (mask_p[26] << 20) - | (mask_p[25] << 18) | (mask_p[24] << 16) - | (mask_p[23] << 14) | (mask_p[22] << 12) - | (mask_p[21] << 10) | (mask_p[20] << 8) - | (mask_p[19] << 6) | (mask_p[18] << 4) - | (mask_p[17] << 2) | (mask_p[16] << 0); - REG_WRITE(ah, AR_PHY_BIN_MASK2_2, tmp_mask); - REG_WRITE(ah, AR_PHY_MASK2_P_30_16, tmp_mask); - - tmp_mask = (mask_p[45] << 28) - | (mask_p[44] << 26) | (mask_p[43] << 24) - | (mask_p[42] << 22) | (mask_p[41] << 20) - | (mask_p[40] << 18) | (mask_p[39] << 16) - | (mask_p[38] << 14) | (mask_p[37] << 12) - | (mask_p[36] << 10) | (mask_p[35] << 8) - | (mask_p[34] << 6) | (mask_p[33] << 4) - | (mask_p[32] << 2) | (mask_p[31] << 0); - REG_WRITE(ah, AR_PHY_BIN_MASK2_3, tmp_mask); - REG_WRITE(ah, AR_PHY_MASK2_P_45_31, tmp_mask); - - tmp_mask = (mask_p[61] << 30) | (mask_p[60] << 28) - | (mask_p[59] << 26) | (mask_p[58] << 24) - | (mask_p[57] << 22) | (mask_p[56] << 20) - | (mask_p[55] << 18) | (mask_p[54] << 16) - | (mask_p[53] << 14) | (mask_p[52] << 12) - | (mask_p[51] << 10) | (mask_p[50] << 8) - | (mask_p[49] << 6) | (mask_p[48] << 4) - | (mask_p[47] << 2) | (mask_p[46] << 0); - REG_WRITE(ah, AR_PHY_BIN_MASK2_4, tmp_mask); - REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask); -} - -/** - * ar5008_hw_rf_alloc_ext_banks - allocates banks for external radio programming - * @ah: atheros hardware structure - * - * Only required for older devices with external AR2133/AR5133 radios. - */ -static int ar5008_hw_rf_alloc_ext_banks(struct ath_hw *ah) -{ - int size = ah->iniBank6.ia_rows * sizeof(u32); - - if (AR_SREV_9280_20_OR_LATER(ah)) - return 0; - - ah->analogBank6Data = devm_kzalloc(ah->dev, size, GFP_KERNEL); - if (!ah->analogBank6Data) - return -ENOMEM; - - return 0; -} - - -/* * - * ar5008_hw_set_rf_regs - programs rf registers based on EEPROM - * @ah: atheros hardware structure - * @chan: - * @modesIndex: - * - * Used for the external AR2133/AR5133 radios. - * - * Reads the EEPROM header info from the device structure and programs - * all rf registers. This routine requires access to the analog - * rf device. This is not required for single-chip devices. - */ -static bool ar5008_hw_set_rf_regs(struct ath_hw *ah, - struct ath9k_channel *chan, - u16 modesIndex) -{ - u32 eepMinorRev; - u32 ob5GHz = 0, db5GHz = 0; - u32 ob2GHz = 0, db2GHz = 0; - int regWrites = 0; - int i; - - /* - * Software does not need to program bank data - * for single chip devices, that is AR9280 or anything - * after that. - */ - if (AR_SREV_9280_20_OR_LATER(ah)) - return true; - - /* Setup rf parameters */ - eepMinorRev = ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV); - - for (i = 0; i < ah->iniBank6.ia_rows; i++) - ah->analogBank6Data[i] = INI_RA(&ah->iniBank6, i, modesIndex); - - /* Only the 5 or 2 GHz OB/DB need to be set for a mode */ - if (eepMinorRev >= 2) { - if (IS_CHAN_2GHZ(chan)) { - ob2GHz = ah->eep_ops->get_eeprom(ah, EEP_OB_2); - db2GHz = ah->eep_ops->get_eeprom(ah, EEP_DB_2); - ar5008_hw_phy_modify_rx_buffer(ah->analogBank6Data, - ob2GHz, 3, 197, 0); - ar5008_hw_phy_modify_rx_buffer(ah->analogBank6Data, - db2GHz, 3, 194, 0); - } else { - ob5GHz = ah->eep_ops->get_eeprom(ah, EEP_OB_5); - db5GHz = ah->eep_ops->get_eeprom(ah, EEP_DB_5); - ar5008_hw_phy_modify_rx_buffer(ah->analogBank6Data, - ob5GHz, 3, 203, 0); - ar5008_hw_phy_modify_rx_buffer(ah->analogBank6Data, - db5GHz, 3, 200, 0); - } - } - - /* Write Analog registers */ - REG_WRITE_ARRAY(&bank0, 1, regWrites); - REG_WRITE_ARRAY(&bank1, 1, regWrites); - REG_WRITE_ARRAY(&bank2, 1, regWrites); - REG_WRITE_ARRAY(&bank3, modesIndex, regWrites); - ar5008_write_bank6(ah, ®Writes); - REG_WRITE_ARRAY(&bank7, 1, regWrites); - - return true; -} - -static void ar5008_hw_init_bb(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - u32 synthDelay; - - synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; - - REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); - - ath9k_hw_synth_delay(ah, chan, synthDelay); -} - -static void ar5008_hw_init_chain_masks(struct ath_hw *ah) -{ - int rx_chainmask, tx_chainmask; - - rx_chainmask = ah->rxchainmask; - tx_chainmask = ah->txchainmask; - - - switch (rx_chainmask) { - case 0x5: - REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, - AR_PHY_SWAP_ALT_CHAIN); - case 0x3: - if (ah->hw_version.macVersion == AR_SREV_REVISION_5416_10) { - REG_WRITE(ah, AR_PHY_RX_CHAINMASK, 0x7); - REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, 0x7); - break; - } - case 0x1: - case 0x2: - case 0x7: - ENABLE_REGWRITE_BUFFER(ah); - REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx_chainmask); - REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx_chainmask); - break; - default: - ENABLE_REGWRITE_BUFFER(ah); - break; - } - - REG_WRITE(ah, AR_SELFGEN_MASK, tx_chainmask); - - REGWRITE_BUFFER_FLUSH(ah); - - if (tx_chainmask == 0x5) { - REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, - AR_PHY_SWAP_ALT_CHAIN); - } - if (AR_SREV_9100(ah)) - REG_WRITE(ah, AR_PHY_ANALOG_SWAP, - REG_READ(ah, AR_PHY_ANALOG_SWAP) | 0x00000001); -} - -static void ar5008_hw_override_ini(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - u32 val; - - /* - * Set the RX_ABORT and RX_DIS and clear if off only after - * RXE is set for MAC. This prevents frames with corrupted - * descriptor status. - */ - REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); - - if (AR_SREV_9280_20_OR_LATER(ah)) { - val = REG_READ(ah, AR_PCU_MISC_MODE2); - - if (!AR_SREV_9271(ah)) - val &= ~AR_PCU_MISC_MODE2_HWWAR1; - - if (AR_SREV_9287_11_OR_LATER(ah)) - val = val & (~AR_PCU_MISC_MODE2_HWWAR2); - - REG_WRITE(ah, AR_PCU_MISC_MODE2, val); - } - - REG_SET_BIT(ah, AR_PHY_CCK_DETECT, - AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV); - - if (AR_SREV_9280_20_OR_LATER(ah)) - return; - /* - * Disable BB clock gating - * Necessary to avoid issues on AR5416 2.0 - */ - REG_WRITE(ah, 0x9800 + (651 << 2), 0x11); - - /* - * Disable RIFS search on some chips to avoid baseband - * hang issues. - */ - if (AR_SREV_9100(ah) || AR_SREV_9160(ah)) { - val = REG_READ(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS); - val &= ~AR_PHY_RIFS_INIT_DELAY; - REG_WRITE(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS, val); - } -} - -static void ar5008_hw_set_channel_regs(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - u32 phymode; - u32 enableDacFifo = 0; - - if (AR_SREV_9285_12_OR_LATER(ah)) - enableDacFifo = (REG_READ(ah, AR_PHY_TURBO) & - AR_PHY_FC_ENABLE_DAC_FIFO); - - phymode = AR_PHY_FC_HT_EN | AR_PHY_FC_SHORT_GI_40 - | AR_PHY_FC_SINGLE_HT_LTF1 | AR_PHY_FC_WALSH | enableDacFifo; - - if (IS_CHAN_HT40(chan)) { - phymode |= AR_PHY_FC_DYN2040_EN; - - if ((chan->chanmode == CHANNEL_A_HT40PLUS) || - (chan->chanmode == CHANNEL_G_HT40PLUS)) - phymode |= AR_PHY_FC_DYN2040_PRI_CH; - - } - REG_WRITE(ah, AR_PHY_TURBO, phymode); - - ath9k_hw_set11nmac2040(ah); - - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_GTXTO, 25 << AR_GTXTO_TIMEOUT_LIMIT_S); - REG_WRITE(ah, AR_CST, 0xF << AR_CST_TIMEOUT_LIMIT_S); - - REGWRITE_BUFFER_FLUSH(ah); -} - - -static int ar5008_hw_process_ini(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - struct ath_common *common = ath9k_hw_common(ah); - int i, regWrites = 0; - u32 modesIndex, freqIndex; - - switch (chan->chanmode) { - case CHANNEL_A: - case CHANNEL_A_HT20: - modesIndex = 1; - freqIndex = 1; - break; - case CHANNEL_A_HT40PLUS: - case CHANNEL_A_HT40MINUS: - modesIndex = 2; - freqIndex = 1; - break; - case CHANNEL_G: - case CHANNEL_G_HT20: - case CHANNEL_B: - modesIndex = 4; - freqIndex = 2; - break; - case CHANNEL_G_HT40PLUS: - case CHANNEL_G_HT40MINUS: - modesIndex = 3; - freqIndex = 2; - break; - - default: - return -EINVAL; - } - - /* - * Set correct baseband to analog shift setting to - * access analog chips. - */ - REG_WRITE(ah, AR_PHY(0), 0x00000007); - - /* Write ADDAC shifts */ - REG_WRITE(ah, AR_PHY_ADC_SERIAL_CTL, AR_PHY_SEL_EXTERNAL_RADIO); - if (ah->eep_ops->set_addac) - ah->eep_ops->set_addac(ah, chan); - - REG_WRITE_ARRAY(&ah->iniAddac, 1, regWrites); - REG_WRITE(ah, AR_PHY_ADC_SERIAL_CTL, AR_PHY_SEL_INTERNAL_ADDAC); - - ENABLE_REGWRITE_BUFFER(ah); - - for (i = 0; i < ah->iniModes.ia_rows; i++) { - u32 reg = INI_RA(&ah->iniModes, i, 0); - u32 val = INI_RA(&ah->iniModes, i, modesIndex); - - if (reg == AR_AN_TOP2 && ah->need_an_top2_fixup) - val &= ~AR_AN_TOP2_PWDCLKIND; - - REG_WRITE(ah, reg, val); - - if (reg >= 0x7800 && reg < 0x78a0 - && ah->config.analog_shiftreg - && (common->bus_ops->ath_bus_type != ATH_USB)) { - udelay(100); - } - - DO_DELAY(regWrites); - } - - REGWRITE_BUFFER_FLUSH(ah); - - if (AR_SREV_9280(ah) || AR_SREV_9287_11_OR_LATER(ah)) - REG_WRITE_ARRAY(&ah->iniModesRxGain, modesIndex, regWrites); - - if (AR_SREV_9280(ah) || AR_SREV_9285_12_OR_LATER(ah) || - AR_SREV_9287_11_OR_LATER(ah)) - REG_WRITE_ARRAY(&ah->iniModesTxGain, modesIndex, regWrites); - - if (AR_SREV_9271_10(ah)) { - REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENA); - REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_ADC_ON, 0xa); - } - - ENABLE_REGWRITE_BUFFER(ah); - - /* Write common array parameters */ - for (i = 0; i < ah->iniCommon.ia_rows; i++) { - u32 reg = INI_RA(&ah->iniCommon, i, 0); - u32 val = INI_RA(&ah->iniCommon, i, 1); - - REG_WRITE(ah, reg, val); - - if (reg >= 0x7800 && reg < 0x78a0 - && ah->config.analog_shiftreg - && (common->bus_ops->ath_bus_type != ATH_USB)) { - udelay(100); - } - - DO_DELAY(regWrites); - } - - REGWRITE_BUFFER_FLUSH(ah); - - REG_WRITE_ARRAY(&ah->iniBB_RfGain, freqIndex, regWrites); - - if (IS_CHAN_A_FAST_CLOCK(ah, chan)) - REG_WRITE_ARRAY(&ah->iniModesFastClock, modesIndex, - regWrites); - - ar5008_hw_override_ini(ah, chan); - ar5008_hw_set_channel_regs(ah, chan); - ar5008_hw_init_chain_masks(ah); - ath9k_olc_init(ah); - ath9k_hw_apply_txpower(ah, chan, false); - - /* Write analog registers */ - if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { - ath_err(ath9k_hw_common(ah), "ar5416SetRfRegs failed\n"); - return -EIO; - } - - return 0; -} - -static void ar5008_hw_set_rfmode(struct ath_hw *ah, struct ath9k_channel *chan) -{ - u32 rfMode = 0; - - if (chan == NULL) - return; - - rfMode |= (IS_CHAN_B(chan) || IS_CHAN_G(chan)) - ? AR_PHY_MODE_DYNAMIC : AR_PHY_MODE_OFDM; - - if (!AR_SREV_9280_20_OR_LATER(ah)) - rfMode |= (IS_CHAN_5GHZ(chan)) ? - AR_PHY_MODE_RF5GHZ : AR_PHY_MODE_RF2GHZ; - - if (IS_CHAN_A_FAST_CLOCK(ah, chan)) - rfMode |= (AR_PHY_MODE_DYNAMIC | AR_PHY_MODE_DYN_CCK_DISABLE); - - REG_WRITE(ah, AR_PHY_MODE, rfMode); -} - -static void ar5008_hw_mark_phy_inactive(struct ath_hw *ah) -{ - REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS); -} - -static void ar5008_hw_set_delta_slope(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - u32 coef_scaled, ds_coef_exp, ds_coef_man; - u32 clockMhzScaled = 0x64000000; - struct chan_centers centers; - - if (IS_CHAN_HALF_RATE(chan)) - clockMhzScaled = clockMhzScaled >> 1; - else if (IS_CHAN_QUARTER_RATE(chan)) - clockMhzScaled = clockMhzScaled >> 2; - - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - coef_scaled = clockMhzScaled / centers.synth_center; - - ath9k_hw_get_delta_slope_vals(ah, coef_scaled, &ds_coef_man, - &ds_coef_exp); - - REG_RMW_FIELD(ah, AR_PHY_TIMING3, - AR_PHY_TIMING3_DSC_MAN, ds_coef_man); - REG_RMW_FIELD(ah, AR_PHY_TIMING3, - AR_PHY_TIMING3_DSC_EXP, ds_coef_exp); - - coef_scaled = (9 * coef_scaled) / 10; - - ath9k_hw_get_delta_slope_vals(ah, coef_scaled, &ds_coef_man, - &ds_coef_exp); - - REG_RMW_FIELD(ah, AR_PHY_HALFGI, - AR_PHY_HALFGI_DSC_MAN, ds_coef_man); - REG_RMW_FIELD(ah, AR_PHY_HALFGI, - AR_PHY_HALFGI_DSC_EXP, ds_coef_exp); -} - -static bool ar5008_hw_rfbus_req(struct ath_hw *ah) -{ - REG_WRITE(ah, AR_PHY_RFBUS_REQ, AR_PHY_RFBUS_REQ_EN); - return ath9k_hw_wait(ah, AR_PHY_RFBUS_GRANT, AR_PHY_RFBUS_GRANT_EN, - AR_PHY_RFBUS_GRANT_EN, AH_WAIT_TIMEOUT); -} - -static void ar5008_hw_rfbus_done(struct ath_hw *ah) -{ - u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; - - ath9k_hw_synth_delay(ah, ah->curchan, synthDelay); - - REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0); -} - -static void ar5008_restore_chainmask(struct ath_hw *ah) -{ - int rx_chainmask = ah->rxchainmask; - - if ((rx_chainmask == 0x5) || (rx_chainmask == 0x3)) { - REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx_chainmask); - REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx_chainmask); - } -} - -static u32 ar9160_hw_compute_pll_control(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - u32 pll; - - pll = SM(0x5, AR_RTC_9160_PLL_REFDIV); - - if (chan && IS_CHAN_HALF_RATE(chan)) - pll |= SM(0x1, AR_RTC_9160_PLL_CLKSEL); - else if (chan && IS_CHAN_QUARTER_RATE(chan)) - pll |= SM(0x2, AR_RTC_9160_PLL_CLKSEL); - - if (chan && IS_CHAN_5GHZ(chan)) - pll |= SM(0x50, AR_RTC_9160_PLL_DIV); - else - pll |= SM(0x58, AR_RTC_9160_PLL_DIV); - - return pll; -} - -static u32 ar5008_hw_compute_pll_control(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - u32 pll; - - pll = AR_RTC_PLL_REFDIV_5 | AR_RTC_PLL_DIV2; - - if (chan && IS_CHAN_HALF_RATE(chan)) - pll |= SM(0x1, AR_RTC_PLL_CLKSEL); - else if (chan && IS_CHAN_QUARTER_RATE(chan)) - pll |= SM(0x2, AR_RTC_PLL_CLKSEL); - - if (chan && IS_CHAN_5GHZ(chan)) - pll |= SM(0xa, AR_RTC_PLL_DIV); - else - pll |= SM(0xb, AR_RTC_PLL_DIV); - - return pll; -} - -static bool ar5008_hw_ani_control_new(struct ath_hw *ah, - enum ath9k_ani_cmd cmd, - int param) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_channel *chan = ah->curchan; - struct ar5416AniState *aniState = &chan->ani; - s32 value, value2; - - switch (cmd & ah->ani_function) { - case ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION:{ - /* - * on == 1 means ofdm weak signal detection is ON - * on == 1 is the default, for less noise immunity - * - * on == 0 means ofdm weak signal detection is OFF - * on == 0 means more noise imm - */ - u32 on = param ? 1 : 0; - /* - * make register setting for default - * (weak sig detect ON) come from INI file - */ - int m1ThreshLow = on ? - aniState->iniDef.m1ThreshLow : m1ThreshLow_off; - int m2ThreshLow = on ? - aniState->iniDef.m2ThreshLow : m2ThreshLow_off; - int m1Thresh = on ? - aniState->iniDef.m1Thresh : m1Thresh_off; - int m2Thresh = on ? - aniState->iniDef.m2Thresh : m2Thresh_off; - int m2CountThr = on ? - aniState->iniDef.m2CountThr : m2CountThr_off; - int m2CountThrLow = on ? - aniState->iniDef.m2CountThrLow : m2CountThrLow_off; - int m1ThreshLowExt = on ? - aniState->iniDef.m1ThreshLowExt : m1ThreshLowExt_off; - int m2ThreshLowExt = on ? - aniState->iniDef.m2ThreshLowExt : m2ThreshLowExt_off; - int m1ThreshExt = on ? - aniState->iniDef.m1ThreshExt : m1ThreshExt_off; - int m2ThreshExt = on ? - aniState->iniDef.m2ThreshExt : m2ThreshExt_off; - - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW, - AR_PHY_SFCORR_LOW_M1_THRESH_LOW, - m1ThreshLow); - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW, - AR_PHY_SFCORR_LOW_M2_THRESH_LOW, - m2ThreshLow); - REG_RMW_FIELD(ah, AR_PHY_SFCORR, - AR_PHY_SFCORR_M1_THRESH, m1Thresh); - REG_RMW_FIELD(ah, AR_PHY_SFCORR, - AR_PHY_SFCORR_M2_THRESH, m2Thresh); - REG_RMW_FIELD(ah, AR_PHY_SFCORR, - AR_PHY_SFCORR_M2COUNT_THR, m2CountThr); - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW, - AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW, - m2CountThrLow); - - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT, - AR_PHY_SFCORR_EXT_M1_THRESH_LOW, m1ThreshLowExt); - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT, - AR_PHY_SFCORR_EXT_M2_THRESH_LOW, m2ThreshLowExt); - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT, - AR_PHY_SFCORR_EXT_M1_THRESH, m1ThreshExt); - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT, - AR_PHY_SFCORR_EXT_M2_THRESH, m2ThreshExt); - - if (on) - REG_SET_BIT(ah, AR_PHY_SFCORR_LOW, - AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); - else - REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW, - AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); - - if (on != aniState->ofdmWeakSigDetect) { - ath_dbg(common, ANI, - "** ch %d: ofdm weak signal: %s=>%s\n", - chan->channel, - aniState->ofdmWeakSigDetect ? - "on" : "off", - on ? "on" : "off"); - if (on) - ah->stats.ast_ani_ofdmon++; - else - ah->stats.ast_ani_ofdmoff++; - aniState->ofdmWeakSigDetect = on; - } - break; - } - case ATH9K_ANI_FIRSTEP_LEVEL:{ - u32 level = param; - - if (level >= ARRAY_SIZE(firstep_table)) { - ath_dbg(common, ANI, - "ATH9K_ANI_FIRSTEP_LEVEL: level out of range (%u > %zu)\n", - level, ARRAY_SIZE(firstep_table)); - return false; - } - - /* - * make register setting relative to default - * from INI file & cap value - */ - value = firstep_table[level] - - firstep_table[ATH9K_ANI_FIRSTEP_LVL] + - aniState->iniDef.firstep; - if (value < ATH9K_SIG_FIRSTEP_SETTING_MIN) - value = ATH9K_SIG_FIRSTEP_SETTING_MIN; - if (value > ATH9K_SIG_FIRSTEP_SETTING_MAX) - value = ATH9K_SIG_FIRSTEP_SETTING_MAX; - REG_RMW_FIELD(ah, AR_PHY_FIND_SIG, - AR_PHY_FIND_SIG_FIRSTEP, - value); - /* - * we need to set first step low register too - * make register setting relative to default - * from INI file & cap value - */ - value2 = firstep_table[level] - - firstep_table[ATH9K_ANI_FIRSTEP_LVL] + - aniState->iniDef.firstepLow; - if (value2 < ATH9K_SIG_FIRSTEP_SETTING_MIN) - value2 = ATH9K_SIG_FIRSTEP_SETTING_MIN; - if (value2 > ATH9K_SIG_FIRSTEP_SETTING_MAX) - value2 = ATH9K_SIG_FIRSTEP_SETTING_MAX; - - REG_RMW_FIELD(ah, AR_PHY_FIND_SIG_LOW, - AR_PHY_FIND_SIG_FIRSTEP_LOW, value2); - - if (level != aniState->firstepLevel) { - ath_dbg(common, ANI, - "** ch %d: level %d=>%d[def:%d] firstep[level]=%d ini=%d\n", - chan->channel, - aniState->firstepLevel, - level, - ATH9K_ANI_FIRSTEP_LVL, - value, - aniState->iniDef.firstep); - ath_dbg(common, ANI, - "** ch %d: level %d=>%d[def:%d] firstep_low[level]=%d ini=%d\n", - chan->channel, - aniState->firstepLevel, - level, - ATH9K_ANI_FIRSTEP_LVL, - value2, - aniState->iniDef.firstepLow); - if (level > aniState->firstepLevel) - ah->stats.ast_ani_stepup++; - else if (level < aniState->firstepLevel) - ah->stats.ast_ani_stepdown++; - aniState->firstepLevel = level; - } - break; - } - case ATH9K_ANI_SPUR_IMMUNITY_LEVEL:{ - u32 level = param; - - if (level >= ARRAY_SIZE(cycpwrThr1_table)) { - ath_dbg(common, ANI, - "ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level out of range (%u > %zu)\n", - level, ARRAY_SIZE(cycpwrThr1_table)); - return false; - } - /* - * make register setting relative to default - * from INI file & cap value - */ - value = cycpwrThr1_table[level] - - cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL] + - aniState->iniDef.cycpwrThr1; - if (value < ATH9K_SIG_SPUR_IMM_SETTING_MIN) - value = ATH9K_SIG_SPUR_IMM_SETTING_MIN; - if (value > ATH9K_SIG_SPUR_IMM_SETTING_MAX) - value = ATH9K_SIG_SPUR_IMM_SETTING_MAX; - REG_RMW_FIELD(ah, AR_PHY_TIMING5, - AR_PHY_TIMING5_CYCPWR_THR1, - value); - - /* - * set AR_PHY_EXT_CCA for extension channel - * make register setting relative to default - * from INI file & cap value - */ - value2 = cycpwrThr1_table[level] - - cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL] + - aniState->iniDef.cycpwrThr1Ext; - if (value2 < ATH9K_SIG_SPUR_IMM_SETTING_MIN) - value2 = ATH9K_SIG_SPUR_IMM_SETTING_MIN; - if (value2 > ATH9K_SIG_SPUR_IMM_SETTING_MAX) - value2 = ATH9K_SIG_SPUR_IMM_SETTING_MAX; - REG_RMW_FIELD(ah, AR_PHY_EXT_CCA, - AR_PHY_EXT_TIMING5_CYCPWR_THR1, value2); - - if (level != aniState->spurImmunityLevel) { - ath_dbg(common, ANI, - "** ch %d: level %d=>%d[def:%d] cycpwrThr1[level]=%d ini=%d\n", - chan->channel, - aniState->spurImmunityLevel, - level, - ATH9K_ANI_SPUR_IMMUNE_LVL, - value, - aniState->iniDef.cycpwrThr1); - ath_dbg(common, ANI, - "** ch %d: level %d=>%d[def:%d] cycpwrThr1Ext[level]=%d ini=%d\n", - chan->channel, - aniState->spurImmunityLevel, - level, - ATH9K_ANI_SPUR_IMMUNE_LVL, - value2, - aniState->iniDef.cycpwrThr1Ext); - if (level > aniState->spurImmunityLevel) - ah->stats.ast_ani_spurup++; - else if (level < aniState->spurImmunityLevel) - ah->stats.ast_ani_spurdown++; - aniState->spurImmunityLevel = level; - } - break; - } - case ATH9K_ANI_MRC_CCK: - /* - * You should not see this as AR5008, AR9001, AR9002 - * does not have hardware support for MRC CCK. - */ - WARN_ON(1); - break; - case ATH9K_ANI_PRESENT: - break; - default: - ath_dbg(common, ANI, "invalid cmd %u\n", cmd); - return false; - } - - ath_dbg(common, ANI, - "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n", - aniState->spurImmunityLevel, - aniState->ofdmWeakSigDetect ? "on" : "off", - aniState->firstepLevel, - aniState->mrcCCK ? "on" : "off", - aniState->listenTime, - aniState->ofdmPhyErrCount, - aniState->cckPhyErrCount); - return true; -} - -static void ar5008_hw_do_getnf(struct ath_hw *ah, - int16_t nfarray[NUM_NF_READINGS]) -{ - int16_t nf; - - nf = MS(REG_READ(ah, AR_PHY_CCA), AR_PHY_MINCCA_PWR); - nfarray[0] = sign_extend32(nf, 8); - - nf = MS(REG_READ(ah, AR_PHY_CH1_CCA), AR_PHY_CH1_MINCCA_PWR); - nfarray[1] = sign_extend32(nf, 8); - - nf = MS(REG_READ(ah, AR_PHY_CH2_CCA), AR_PHY_CH2_MINCCA_PWR); - nfarray[2] = sign_extend32(nf, 8); - - if (!IS_CHAN_HT40(ah->curchan)) - return; - - nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR_PHY_EXT_MINCCA_PWR); - nfarray[3] = sign_extend32(nf, 8); - - nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA), AR_PHY_CH1_EXT_MINCCA_PWR); - nfarray[4] = sign_extend32(nf, 8); - - nf = MS(REG_READ(ah, AR_PHY_CH2_EXT_CCA), AR_PHY_CH2_EXT_MINCCA_PWR); - nfarray[5] = sign_extend32(nf, 8); -} - -/* - * Initialize the ANI register values with default (ini) values. - * This routine is called during a (full) hardware reset after - * all the registers are initialised from the INI. - */ -static void ar5008_hw_ani_cache_ini_regs(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_channel *chan = ah->curchan; - struct ar5416AniState *aniState = &chan->ani; - struct ath9k_ani_default *iniDef; - u32 val; - - iniDef = &aniState->iniDef; - - ath_dbg(common, ANI, "ver %d.%d opmode %u chan %d Mhz/0x%x\n", - ah->hw_version.macVersion, - ah->hw_version.macRev, - ah->opmode, - chan->channel, - chan->channelFlags); - - val = REG_READ(ah, AR_PHY_SFCORR); - iniDef->m1Thresh = MS(val, AR_PHY_SFCORR_M1_THRESH); - iniDef->m2Thresh = MS(val, AR_PHY_SFCORR_M2_THRESH); - iniDef->m2CountThr = MS(val, AR_PHY_SFCORR_M2COUNT_THR); - - val = REG_READ(ah, AR_PHY_SFCORR_LOW); - iniDef->m1ThreshLow = MS(val, AR_PHY_SFCORR_LOW_M1_THRESH_LOW); - iniDef->m2ThreshLow = MS(val, AR_PHY_SFCORR_LOW_M2_THRESH_LOW); - iniDef->m2CountThrLow = MS(val, AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW); - - val = REG_READ(ah, AR_PHY_SFCORR_EXT); - iniDef->m1ThreshExt = MS(val, AR_PHY_SFCORR_EXT_M1_THRESH); - iniDef->m2ThreshExt = MS(val, AR_PHY_SFCORR_EXT_M2_THRESH); - iniDef->m1ThreshLowExt = MS(val, AR_PHY_SFCORR_EXT_M1_THRESH_LOW); - iniDef->m2ThreshLowExt = MS(val, AR_PHY_SFCORR_EXT_M2_THRESH_LOW); - iniDef->firstep = REG_READ_FIELD(ah, - AR_PHY_FIND_SIG, - AR_PHY_FIND_SIG_FIRSTEP); - iniDef->firstepLow = REG_READ_FIELD(ah, - AR_PHY_FIND_SIG_LOW, - AR_PHY_FIND_SIG_FIRSTEP_LOW); - iniDef->cycpwrThr1 = REG_READ_FIELD(ah, - AR_PHY_TIMING5, - AR_PHY_TIMING5_CYCPWR_THR1); - iniDef->cycpwrThr1Ext = REG_READ_FIELD(ah, - AR_PHY_EXT_CCA, - AR_PHY_EXT_TIMING5_CYCPWR_THR1); - - /* these levels just got reset to defaults by the INI */ - aniState->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL; - aniState->firstepLevel = ATH9K_ANI_FIRSTEP_LVL; - aniState->ofdmWeakSigDetect = ATH9K_ANI_USE_OFDM_WEAK_SIG; - aniState->mrcCCK = false; /* not available on pre AR9003 */ -} - -static void ar5008_hw_set_nf_limits(struct ath_hw *ah) -{ - ah->nf_2g.max = AR_PHY_CCA_MAX_GOOD_VAL_5416_2GHZ; - ah->nf_2g.min = AR_PHY_CCA_MIN_GOOD_VAL_5416_2GHZ; - ah->nf_2g.nominal = AR_PHY_CCA_NOM_VAL_5416_2GHZ; - ah->nf_5g.max = AR_PHY_CCA_MAX_GOOD_VAL_5416_5GHZ; - ah->nf_5g.min = AR_PHY_CCA_MIN_GOOD_VAL_5416_5GHZ; - ah->nf_5g.nominal = AR_PHY_CCA_NOM_VAL_5416_5GHZ; -} - -static void ar5008_hw_set_radar_params(struct ath_hw *ah, - struct ath_hw_radar_conf *conf) -{ - u32 radar_0 = 0, radar_1 = 0; - - if (!conf) { - REG_CLR_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_ENA); - return; - } - - radar_0 |= AR_PHY_RADAR_0_ENA | AR_PHY_RADAR_0_FFT_ENA; - radar_0 |= SM(conf->fir_power, AR_PHY_RADAR_0_FIRPWR); - radar_0 |= SM(conf->radar_rssi, AR_PHY_RADAR_0_RRSSI); - radar_0 |= SM(conf->pulse_height, AR_PHY_RADAR_0_HEIGHT); - radar_0 |= SM(conf->pulse_rssi, AR_PHY_RADAR_0_PRSSI); - radar_0 |= SM(conf->pulse_inband, AR_PHY_RADAR_0_INBAND); - - radar_1 |= AR_PHY_RADAR_1_MAX_RRSSI; - radar_1 |= AR_PHY_RADAR_1_BLOCK_CHECK; - radar_1 |= SM(conf->pulse_maxlen, AR_PHY_RADAR_1_MAXLEN); - radar_1 |= SM(conf->pulse_inband_step, AR_PHY_RADAR_1_RELSTEP_THRESH); - radar_1 |= SM(conf->radar_inband, AR_PHY_RADAR_1_RELPWR_THRESH); - - REG_WRITE(ah, AR_PHY_RADAR_0, radar_0); - REG_WRITE(ah, AR_PHY_RADAR_1, radar_1); - if (conf->ext_channel) - REG_SET_BIT(ah, AR_PHY_RADAR_EXT, AR_PHY_RADAR_EXT_ENA); - else - REG_CLR_BIT(ah, AR_PHY_RADAR_EXT, AR_PHY_RADAR_EXT_ENA); -} - -static void ar5008_hw_set_radar_conf(struct ath_hw *ah) -{ - struct ath_hw_radar_conf *conf = &ah->radar_conf; - - conf->fir_power = -33; - conf->radar_rssi = 20; - conf->pulse_height = 10; - conf->pulse_rssi = 24; - conf->pulse_inband = 15; - conf->pulse_maxlen = 255; - conf->pulse_inband_step = 12; - conf->radar_inband = 8; -} - -int ar5008_hw_attach_phy_ops(struct ath_hw *ah) -{ - struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); - static const u32 ar5416_cca_regs[6] = { - AR_PHY_CCA, - AR_PHY_CH1_CCA, - AR_PHY_CH2_CCA, - AR_PHY_EXT_CCA, - AR_PHY_CH1_EXT_CCA, - AR_PHY_CH2_EXT_CCA - }; - int ret; - - ret = ar5008_hw_rf_alloc_ext_banks(ah); - if (ret) - return ret; - - priv_ops->rf_set_freq = ar5008_hw_set_channel; - priv_ops->spur_mitigate_freq = ar5008_hw_spur_mitigate; - - priv_ops->set_rf_regs = ar5008_hw_set_rf_regs; - priv_ops->set_channel_regs = ar5008_hw_set_channel_regs; - priv_ops->init_bb = ar5008_hw_init_bb; - priv_ops->process_ini = ar5008_hw_process_ini; - priv_ops->set_rfmode = ar5008_hw_set_rfmode; - priv_ops->mark_phy_inactive = ar5008_hw_mark_phy_inactive; - priv_ops->set_delta_slope = ar5008_hw_set_delta_slope; - priv_ops->rfbus_req = ar5008_hw_rfbus_req; - priv_ops->rfbus_done = ar5008_hw_rfbus_done; - priv_ops->restore_chainmask = ar5008_restore_chainmask; - priv_ops->do_getnf = ar5008_hw_do_getnf; - priv_ops->set_radar_params = ar5008_hw_set_radar_params; - - priv_ops->ani_control = ar5008_hw_ani_control_new; - priv_ops->ani_cache_ini_regs = ar5008_hw_ani_cache_ini_regs; - - if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) - priv_ops->compute_pll_control = ar9160_hw_compute_pll_control; - else - priv_ops->compute_pll_control = ar5008_hw_compute_pll_control; - - ar5008_hw_set_nf_limits(ah); - ar5008_hw_set_radar_conf(ah); - memcpy(ah->nf_regs, ar5416_cca_regs, sizeof(ah->nf_regs)); - return 0; -} diff --git a/drivers/net/wireless/ath/ath9k/ar9001_initvals.h b/drivers/net/wireless/ath/ath9k/ar9001_initvals.h deleted file mode 100644 index 59524e1d4678..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9001_initvals.h +++ /dev/null @@ -1,1089 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -static const u32 ar5416Modes_9100[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, - {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, - {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, - {0x000010f0, 0x0000a000, 0x00014000, 0x00016000, 0x0000b000}, - {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, - {0x0000801c, 0x128d93a7, 0x128d93cf, 0x12e013d7, 0x12e013ab}, - {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, - {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, - {0x00009804, 0x00000300, 0x000003c4, 0x000003c4, 0x00000300}, - {0x00009820, 0x02020200, 0x02020200, 0x02020200, 0x02020200}, - {0x00009824, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x00009828, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001}, - {0x00009834, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x00009838, 0x00000007, 0x00000007, 0x00000007, 0x00000007}, - {0x00009844, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, - {0x00009848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68}, - {0x0000a848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68}, - {0x0000b848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68}, - {0x00009850, 0x6c48b4e2, 0x6d48b4e2, 0x6d48b0e2, 0x6c48b0e2}, - {0x00009858, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e}, - {0x0000985c, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, - {0x00009860, 0x00048d18, 0x00048d18, 0x00048d20, 0x00048d20}, - {0x0000c864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00}, - {0x00009868, 0x409a40d0, 0x409a40d0, 0x409a40d0, 0x409a40d0}, - {0x0000986c, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081}, - {0x00009914, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x00009918, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b}, - {0x00009924, 0xd00a8a07, 0xd00a8a07, 0xd00a8a0d, 0xd00a8a0d}, - {0x00009940, 0x00750604, 0x00754604, 0xfff81204, 0xfff81204}, - {0x00009944, 0xdfb81020, 0xdfb81020, 0xdfb81020, 0xdfb81020}, - {0x00009954, 0x5f3ca3de, 0x5f3ca3de, 0xe250a51e, 0xe250a51e}, - {0x00009958, 0x2108ecff, 0x2108ecff, 0x3388ffff, 0x3388ffff}, - {0x00009960, 0x0001bfc0, 0x0001bfc0, 0x0001bfc0, 0x0001bfc0}, - {0x0000a960, 0x0001bfc0, 0x0001bfc0, 0x0001bfc0, 0x0001bfc0}, - {0x0000b960, 0x0001bfc0, 0x0001bfc0, 0x0001bfc0, 0x0001bfc0}, - {0x00009964, 0x00001120, 0x00001120, 0x00001120, 0x00001120}, - {0x0000c9bc, 0x001a0600, 0x001a0600, 0x001a1000, 0x001a0c00}, - {0x000099c0, 0x038919be, 0x038919be, 0x038919be, 0x038919be}, - {0x000099c4, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77}, - {0x000099c8, 0x6af65329, 0x6af65329, 0x6af65329, 0x6af65329}, - {0x000099cc, 0x08f186c8, 0x08f186c8, 0x08f186c8, 0x08f186c8}, - {0x000099d0, 0x00046384, 0x00046384, 0x00046384, 0x00046384}, - {0x000099d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x000099d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a204, 0x00000880, 0x00000880, 0x00000880, 0x00000880}, - {0x0000a208, 0xd6be4788, 0xd6be4788, 0xd03e4788, 0xd03e4788}, - {0x0000a20c, 0x002fc160, 0x002fc160, 0x002ac120, 0x002ac120}, - {0x0000b20c, 0x002fc160, 0x002fc160, 0x002ac120, 0x002ac120}, - {0x0000c20c, 0x002fc160, 0x002fc160, 0x002ac120, 0x002ac120}, - {0x0000a21c, 0x1883800a, 0x1883800a, 0x1883800a, 0x1883800a}, - {0x0000a230, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a274, 0x0a1a9caa, 0x0a1a9caa, 0x0a1a7caa, 0x0a1a7caa}, - {0x0000a300, 0x18010000, 0x18010000, 0x18010000, 0x18010000}, - {0x0000a304, 0x30032602, 0x30032602, 0x2e032402, 0x2e032402}, - {0x0000a308, 0x48073e06, 0x48073e06, 0x4a0a3c06, 0x4a0a3c06}, - {0x0000a30c, 0x560b4c0a, 0x560b4c0a, 0x621a540b, 0x621a540b}, - {0x0000a310, 0x641a600f, 0x641a600f, 0x764f6c1b, 0x764f6c1b}, - {0x0000a314, 0x7a4f6e1b, 0x7a4f6e1b, 0x845b7a5a, 0x845b7a5a}, - {0x0000a318, 0x8c5b7e5a, 0x8c5b7e5a, 0x950f8ccf, 0x950f8ccf}, - {0x0000a31c, 0x9d0f96cf, 0x9d0f96cf, 0xa5cf9b4f, 0xa5cf9b4f}, - {0x0000a320, 0xb51fa69f, 0xb51fa69f, 0xbddfaf1f, 0xbddfaf1f}, - {0x0000a324, 0xcb3fbd07, 0xcb3fbcbf, 0xd1ffc93f, 0xd1ffc93f}, - {0x0000a328, 0x0000d7bf, 0x0000d7bf, 0x00000000, 0x00000000}, - {0x0000a32c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a330, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a334, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, -}; - -static const u32 ar5416Common_9100[][2] = { - /* Addr allmodes */ - {0x0000000c, 0x00000000}, - {0x00000030, 0x00020015}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000008}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00000054, 0x0000001f}, - {0x00000800, 0x00000000}, - {0x00000804, 0x00000000}, - {0x00000808, 0x00000000}, - {0x0000080c, 0x00000000}, - {0x00000810, 0x00000000}, - {0x00000814, 0x00000000}, - {0x00000818, 0x00000000}, - {0x0000081c, 0x00000000}, - {0x00000820, 0x00000000}, - {0x00000824, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x00001230, 0x00000000}, - {0x00001270, 0x00000000}, - {0x00001038, 0x00000000}, - {0x00001078, 0x00000000}, - {0x000010b8, 0x00000000}, - {0x000010f8, 0x00000000}, - {0x00001138, 0x00000000}, - {0x00001178, 0x00000000}, - {0x000011b8, 0x00000000}, - {0x000011f8, 0x00000000}, - {0x00001238, 0x00000000}, - {0x00001278, 0x00000000}, - {0x000012b8, 0x00000000}, - {0x000012f8, 0x00000000}, - {0x00001338, 0x00000000}, - {0x00001378, 0x00000000}, - {0x000013b8, 0x00000000}, - {0x000013f8, 0x00000000}, - {0x00001438, 0x00000000}, - {0x00001478, 0x00000000}, - {0x000014b8, 0x00000000}, - {0x000014f8, 0x00000000}, - {0x00001538, 0x00000000}, - {0x00001578, 0x00000000}, - {0x000015b8, 0x00000000}, - {0x000015f8, 0x00000000}, - {0x00001638, 0x00000000}, - {0x00001678, 0x00000000}, - {0x000016b8, 0x00000000}, - {0x000016f8, 0x00000000}, - {0x00001738, 0x00000000}, - {0x00001778, 0x00000000}, - {0x000017b8, 0x00000000}, - {0x000017f8, 0x00000000}, - {0x0000103c, 0x00000000}, - {0x0000107c, 0x00000000}, - {0x000010bc, 0x00000000}, - {0x000010fc, 0x00000000}, - {0x0000113c, 0x00000000}, - {0x0000117c, 0x00000000}, - {0x000011bc, 0x00000000}, - {0x000011fc, 0x00000000}, - {0x0000123c, 0x00000000}, - {0x0000127c, 0x00000000}, - {0x000012bc, 0x00000000}, - {0x000012fc, 0x00000000}, - {0x0000133c, 0x00000000}, - {0x0000137c, 0x00000000}, - {0x000013bc, 0x00000000}, - {0x000013fc, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00020010, 0x00000003}, - {0x00020038, 0x000004c2}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008018, 0x00000700}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00000000}, - {0x00008048, 0x40000000}, - {0x00008054, 0x00004000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x000080c0, 0x2a82301a}, - {0x000080c4, 0x05dc01e0}, - {0x000080c8, 0x1f402710}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00001e00}, - {0x000080d4, 0x00000000}, - {0x000080d8, 0x00400000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x003f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080f8, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00020000}, - {0x00008104, 0x00000001}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000168}, - {0x00008118, 0x000100aa}, - {0x0000811c, 0x00003210}, - {0x00008120, 0x08f04800}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x00000000}, - {0x00008144, 0x00000000}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x00008170, 0x32143320}, - {0x00008174, 0xfaa4fa50}, - {0x00008178, 0x00000100}, - {0x0000817c, 0x00000000}, - {0x000081c4, 0x00000000}, - {0x000081d0, 0x00003210}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008200, 0x00000000}, - {0x00008204, 0x00000000}, - {0x00008208, 0x00000000}, - {0x0000820c, 0x00000000}, - {0x00008210, 0x00000000}, - {0x00008214, 0x00000000}, - {0x00008218, 0x00000000}, - {0x0000821c, 0x00000000}, - {0x00008220, 0x00000000}, - {0x00008224, 0x00000000}, - {0x00008228, 0x00000000}, - {0x0000822c, 0x00000000}, - {0x00008230, 0x00000000}, - {0x00008234, 0x00000000}, - {0x00008238, 0x00000000}, - {0x0000823c, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008244, 0x0010f400}, - {0x00008248, 0x00000100}, - {0x0000824c, 0x0001e800}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x400000ff}, - {0x00008260, 0x00080922}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000000}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x00000000}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x00008300, 0x00000000}, - {0x00008304, 0x00000000}, - {0x00008308, 0x00000000}, - {0x0000830c, 0x00000000}, - {0x00008310, 0x00000000}, - {0x00008314, 0x00000000}, - {0x00008318, 0x00000000}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x00000007}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000e00}, - {0x00008338, 0x00000000}, - {0x0000833c, 0x00000000}, - {0x00008340, 0x000107ff}, - {0x00009808, 0x00000000}, - {0x0000980c, 0xad848e19}, - {0x00009810, 0x7d14e000}, - {0x00009814, 0x9c0a9f6b}, - {0x0000981c, 0x00000000}, - {0x0000982c, 0x0000a000}, - {0x00009830, 0x00000000}, - {0x0000983c, 0x00200400}, - {0x00009840, 0x206a01ae}, - {0x0000984c, 0x1284233c}, - {0x00009854, 0x00000859}, - {0x00009900, 0x00000000}, - {0x00009904, 0x00000000}, - {0x00009908, 0x00000000}, - {0x0000990c, 0x00000000}, - {0x0000991c, 0x10000fff}, - {0x00009920, 0x05100000}, - {0x0000a920, 0x05100000}, - {0x0000b920, 0x05100000}, - {0x00009928, 0x00000001}, - {0x0000992c, 0x00000004}, - {0x00009934, 0x1e1f2022}, - {0x00009938, 0x0a0b0c0d}, - {0x0000993c, 0x00000000}, - {0x00009948, 0x9280b212}, - {0x0000994c, 0x00020028}, - {0x0000c95c, 0x004b6a8e}, - {0x0000c968, 0x000003ce}, - {0x00009970, 0x190fb515}, - {0x00009974, 0x00000000}, - {0x00009978, 0x00000001}, - {0x0000997c, 0x00000000}, - {0x00009980, 0x00000000}, - {0x00009984, 0x00000000}, - {0x00009988, 0x00000000}, - {0x0000998c, 0x00000000}, - {0x00009990, 0x00000000}, - {0x00009994, 0x00000000}, - {0x00009998, 0x00000000}, - {0x0000999c, 0x00000000}, - {0x000099a0, 0x00000000}, - {0x000099a4, 0x00000001}, - {0x000099a8, 0x201fff00}, - {0x000099ac, 0x006f0000}, - {0x000099b0, 0x03051000}, - {0x000099dc, 0x00000000}, - {0x000099e0, 0x00000200}, - {0x000099e4, 0xaaaaaaaa}, - {0x000099e8, 0x3c466478}, - {0x000099ec, 0x0cc80caa}, - {0x000099fc, 0x00001042}, - {0x00009b00, 0x00000000}, - {0x00009b04, 0x00000001}, - {0x00009b08, 0x00000002}, - {0x00009b0c, 0x00000003}, - {0x00009b10, 0x00000004}, - {0x00009b14, 0x00000005}, - {0x00009b18, 0x00000008}, - {0x00009b1c, 0x00000009}, - {0x00009b20, 0x0000000a}, - {0x00009b24, 0x0000000b}, - {0x00009b28, 0x0000000c}, - {0x00009b2c, 0x0000000d}, - {0x00009b30, 0x00000010}, - {0x00009b34, 0x00000011}, - {0x00009b38, 0x00000012}, - {0x00009b3c, 0x00000013}, - {0x00009b40, 0x00000014}, - {0x00009b44, 0x00000015}, - {0x00009b48, 0x00000018}, - {0x00009b4c, 0x00000019}, - {0x00009b50, 0x0000001a}, - {0x00009b54, 0x0000001b}, - {0x00009b58, 0x0000001c}, - {0x00009b5c, 0x0000001d}, - {0x00009b60, 0x00000020}, - {0x00009b64, 0x00000021}, - {0x00009b68, 0x00000022}, - {0x00009b6c, 0x00000023}, - {0x00009b70, 0x00000024}, - {0x00009b74, 0x00000025}, - {0x00009b78, 0x00000028}, - {0x00009b7c, 0x00000029}, - {0x00009b80, 0x0000002a}, - {0x00009b84, 0x0000002b}, - {0x00009b88, 0x0000002c}, - {0x00009b8c, 0x0000002d}, - {0x00009b90, 0x00000030}, - {0x00009b94, 0x00000031}, - {0x00009b98, 0x00000032}, - {0x00009b9c, 0x00000033}, - {0x00009ba0, 0x00000034}, - {0x00009ba4, 0x00000035}, - {0x00009ba8, 0x00000035}, - {0x00009bac, 0x00000035}, - {0x00009bb0, 0x00000035}, - {0x00009bb4, 0x00000035}, - {0x00009bb8, 0x00000035}, - {0x00009bbc, 0x00000035}, - {0x00009bc0, 0x00000035}, - {0x00009bc4, 0x00000035}, - {0x00009bc8, 0x00000035}, - {0x00009bcc, 0x00000035}, - {0x00009bd0, 0x00000035}, - {0x00009bd4, 0x00000035}, - {0x00009bd8, 0x00000035}, - {0x00009bdc, 0x00000035}, - {0x00009be0, 0x00000035}, - {0x00009be4, 0x00000035}, - {0x00009be8, 0x00000035}, - {0x00009bec, 0x00000035}, - {0x00009bf0, 0x00000035}, - {0x00009bf4, 0x00000035}, - {0x00009bf8, 0x00000010}, - {0x00009bfc, 0x0000001a}, - {0x0000a210, 0x40806333}, - {0x0000a214, 0x00106c10}, - {0x0000a218, 0x009c4060}, - {0x0000a220, 0x018830c6}, - {0x0000a224, 0x00000400}, - {0x0000a228, 0x001a0bb5}, - {0x0000a22c, 0x00000000}, - {0x0000a234, 0x20202020}, - {0x0000a238, 0x20202020}, - {0x0000a23c, 0x13c889af}, - {0x0000a240, 0x38490a20}, - {0x0000a244, 0x00007bb6}, - {0x0000a248, 0x0fff3ffc}, - {0x0000a24c, 0x00000001}, - {0x0000a250, 0x0000e000}, - {0x0000a254, 0x00000000}, - {0x0000a258, 0x0cc75380}, - {0x0000a25c, 0x0f0f0f01}, - {0x0000a260, 0xdfa91f01}, - {0x0000a268, 0x00000001}, - {0x0000a26c, 0x0ebae9c6}, - {0x0000b26c, 0x0ebae9c6}, - {0x0000c26c, 0x0ebae9c6}, - {0x0000d270, 0x00820820}, - {0x0000a278, 0x1ce739ce}, - {0x0000a27c, 0x050701ce}, - {0x0000a338, 0x00000000}, - {0x0000a33c, 0x00000000}, - {0x0000a340, 0x00000000}, - {0x0000a344, 0x00000000}, - {0x0000a348, 0x3fffffff}, - {0x0000a34c, 0x3fffffff}, - {0x0000a350, 0x3fffffff}, - {0x0000a354, 0x0003ffff}, - {0x0000a358, 0x79a8aa33}, - {0x0000d35c, 0x07ffffef}, - {0x0000d360, 0x0fffffe7}, - {0x0000d364, 0x17ffffe5}, - {0x0000d368, 0x1fffffe4}, - {0x0000d36c, 0x37ffffe3}, - {0x0000d370, 0x3fffffe3}, - {0x0000d374, 0x57ffffe3}, - {0x0000d378, 0x5fffffe2}, - {0x0000d37c, 0x7fffffe2}, - {0x0000d380, 0x7f3c7bba}, - {0x0000d384, 0xf3307ff0}, - {0x0000a388, 0x0c000000}, - {0x0000a38c, 0x20202020}, - {0x0000a390, 0x20202020}, - {0x0000a394, 0x1ce739ce}, - {0x0000a398, 0x000001ce}, - {0x0000a39c, 0x00000001}, - {0x0000a3a0, 0x00000000}, - {0x0000a3a4, 0x00000000}, - {0x0000a3a8, 0x00000000}, - {0x0000a3ac, 0x00000000}, - {0x0000a3b0, 0x00000000}, - {0x0000a3b4, 0x00000000}, - {0x0000a3b8, 0x00000000}, - {0x0000a3bc, 0x00000000}, - {0x0000a3c0, 0x00000000}, - {0x0000a3c4, 0x00000000}, - {0x0000a3c8, 0x00000246}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3dc, 0x1ce739ce}, - {0x0000a3e0, 0x000001ce}, -}; - -static const u32 ar5416Bank6_9100[][3] = { - /* Addr 5G 2G */ - {0x0000989c, 0x00000000, 0x00000000}, - {0x0000989c, 0x00000000, 0x00000000}, - {0x0000989c, 0x00000000, 0x00000000}, - {0x0000989c, 0x00e00000, 0x00e00000}, - {0x0000989c, 0x005e0000, 0x005e0000}, - {0x0000989c, 0x00120000, 0x00120000}, - {0x0000989c, 0x00620000, 0x00620000}, - {0x0000989c, 0x00020000, 0x00020000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x005f0000, 0x005f0000}, - {0x0000989c, 0x00870000, 0x00870000}, - {0x0000989c, 0x00f90000, 0x00f90000}, - {0x0000989c, 0x007b0000, 0x007b0000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x00f50000, 0x00f50000}, - {0x0000989c, 0x00dc0000, 0x00dc0000}, - {0x0000989c, 0x00110000, 0x00110000}, - {0x0000989c, 0x006100a8, 0x006100a8}, - {0x0000989c, 0x004210a2, 0x004210a2}, - {0x0000989c, 0x0014000f, 0x0014000f}, - {0x0000989c, 0x00c40002, 0x00c40002}, - {0x0000989c, 0x003000f2, 0x003000f2}, - {0x0000989c, 0x00440016, 0x00440016}, - {0x0000989c, 0x00410040, 0x00410040}, - {0x0000989c, 0x000180d6, 0x000180d6}, - {0x0000989c, 0x0000c0aa, 0x0000c0aa}, - {0x0000989c, 0x000000b1, 0x000000b1}, - {0x0000989c, 0x00002000, 0x00002000}, - {0x0000989c, 0x000000d4, 0x000000d4}, - {0x000098d0, 0x0000000f, 0x0010000f}, -}; - -static const u32 ar5416Bank6TPC_9100[][3] = { - /* Addr 5G 2G */ - {0x0000989c, 0x00000000, 0x00000000}, - {0x0000989c, 0x00000000, 0x00000000}, - {0x0000989c, 0x00000000, 0x00000000}, - {0x0000989c, 0x00e00000, 0x00e00000}, - {0x0000989c, 0x005e0000, 0x005e0000}, - {0x0000989c, 0x00120000, 0x00120000}, - {0x0000989c, 0x00620000, 0x00620000}, - {0x0000989c, 0x00020000, 0x00020000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x40ff0000, 0x40ff0000}, - {0x0000989c, 0x005f0000, 0x005f0000}, - {0x0000989c, 0x00870000, 0x00870000}, - {0x0000989c, 0x00f90000, 0x00f90000}, - {0x0000989c, 0x007b0000, 0x007b0000}, - {0x0000989c, 0x00ff0000, 0x00ff0000}, - {0x0000989c, 0x00f50000, 0x00f50000}, - {0x0000989c, 0x00dc0000, 0x00dc0000}, - {0x0000989c, 0x00110000, 0x00110000}, - {0x0000989c, 0x006100a8, 0x006100a8}, - {0x0000989c, 0x00423022, 0x00423022}, - {0x0000989c, 0x2014008f, 0x2014008f}, - {0x0000989c, 0x00c40002, 0x00c40002}, - {0x0000989c, 0x003000f2, 0x003000f2}, - {0x0000989c, 0x00440016, 0x00440016}, - {0x0000989c, 0x00410040, 0x00410040}, - {0x0000989c, 0x0001805e, 0x0001805e}, - {0x0000989c, 0x0000c0ab, 0x0000c0ab}, - {0x0000989c, 0x000000e1, 0x000000e1}, - {0x0000989c, 0x00007080, 0x00007080}, - {0x0000989c, 0x000000d4, 0x000000d4}, - {0x000098d0, 0x0000000f, 0x0010000f}, -}; - -static const u32 ar5416Addac_9100[][2] = { - /* Addr allmodes */ - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000010}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x000000c0}, - {0x0000989c, 0x00000015}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x000098cc, 0x00000000}, -}; - -static const u32 ar5416Modes_9160[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, - {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, - {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, - {0x000010f0, 0x0000a000, 0x00014000, 0x00016000, 0x0000b000}, - {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, - {0x0000801c, 0x128d93a7, 0x128d93cf, 0x12e013d7, 0x12e013ab}, - {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, - {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, - {0x00009804, 0x00000300, 0x000003c4, 0x000003c4, 0x00000300}, - {0x00009820, 0x02020200, 0x02020200, 0x02020200, 0x02020200}, - {0x00009824, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x00009828, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001}, - {0x00009834, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x00009838, 0x00000007, 0x00000007, 0x00000007, 0x00000007}, - {0x00009844, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, - {0x00009848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68}, - {0x0000a848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68}, - {0x0000b848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68}, - {0x00009850, 0x6c48b4e2, 0x6d48b4e2, 0x6d48b0e2, 0x6c48b0e2}, - {0x00009858, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e, 0x7ec82d2e}, - {0x0000985c, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, - {0x00009860, 0x00048d18, 0x00048d18, 0x00048d20, 0x00048d20}, - {0x00009864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00}, - {0x00009868, 0x409a40d0, 0x409a40d0, 0x409a40d0, 0x409a40d0}, - {0x0000986c, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081}, - {0x00009914, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x00009918, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b}, - {0x00009924, 0xd00a8a07, 0xd00a8a07, 0xd00a8a0d, 0xd00a8a0d}, - {0x00009944, 0xffb81020, 0xffb81020, 0xffb81020, 0xffb81020}, - {0x00009960, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40}, - {0x0000a960, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40}, - {0x0000b960, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40}, - {0x00009964, 0x00001120, 0x00001120, 0x00001120, 0x00001120}, - {0x0000c968, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, - {0x000099bc, 0x001a0600, 0x001a0600, 0x001a0c00, 0x001a0c00}, - {0x000099c0, 0x038919be, 0x038919be, 0x038919be, 0x038919be}, - {0x000099c4, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77}, - {0x000099c8, 0x6af65329, 0x6af65329, 0x6af65329, 0x6af65329}, - {0x000099cc, 0x08f186c8, 0x08f186c8, 0x08f186c8, 0x08f186c8}, - {0x000099d0, 0x00046384, 0x00046384, 0x00046384, 0x00046384}, - {0x000099d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x000099d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a204, 0x00000880, 0x00000880, 0x00000880, 0x00000880}, - {0x0000a208, 0xd6be4788, 0xd6be4788, 0xd03e4788, 0xd03e4788}, - {0x0000a20c, 0x002fc160, 0x002fc160, 0x002ac120, 0x002ac120}, - {0x0000b20c, 0x002fc160, 0x002fc160, 0x002ac120, 0x002ac120}, - {0x0000c20c, 0x002fc160, 0x002fc160, 0x002ac120, 0x002ac120}, - {0x0000a21c, 0x1883800a, 0x1883800a, 0x1883800a, 0x1883800a}, - {0x0000a230, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a274, 0x0a1a9caa, 0x0a1a9caa, 0x0a1a7caa, 0x0a1a7caa}, - {0x0000a300, 0x18010000, 0x18010000, 0x18010000, 0x18010000}, - {0x0000a304, 0x30032602, 0x30032602, 0x2e032402, 0x2e032402}, - {0x0000a308, 0x48073e06, 0x48073e06, 0x4a0a3c06, 0x4a0a3c06}, - {0x0000a30c, 0x560b4c0a, 0x560b4c0a, 0x621a540b, 0x621a540b}, - {0x0000a310, 0x641a600f, 0x641a600f, 0x764f6c1b, 0x764f6c1b}, - {0x0000a314, 0x7a4f6e1b, 0x7a4f6e1b, 0x845b7a5a, 0x845b7a5a}, - {0x0000a318, 0x8c5b7e5a, 0x8c5b7e5a, 0x950f8ccf, 0x950f8ccf}, - {0x0000a31c, 0x9d0f96cf, 0x9d0f96cf, 0xa5cf9b4f, 0xa5cf9b4f}, - {0x0000a320, 0xb51fa69f, 0xb51fa69f, 0xbddfaf1f, 0xbddfaf1f}, - {0x0000a324, 0xcb3fbd07, 0xcb3fbcbf, 0xd1ffc93f, 0xd1ffc93f}, - {0x0000a328, 0x0000d7bf, 0x0000d7bf, 0x00000000, 0x00000000}, - {0x0000a32c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a330, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a334, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, -}; - -static const u32 ar5416Common_9160[][2] = { - /* Addr allmodes */ - {0x0000000c, 0x00000000}, - {0x00000030, 0x00020015}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000008}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00000054, 0x0000001f}, - {0x00000800, 0x00000000}, - {0x00000804, 0x00000000}, - {0x00000808, 0x00000000}, - {0x0000080c, 0x00000000}, - {0x00000810, 0x00000000}, - {0x00000814, 0x00000000}, - {0x00000818, 0x00000000}, - {0x0000081c, 0x00000000}, - {0x00000820, 0x00000000}, - {0x00000824, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x00001230, 0x00000000}, - {0x00001270, 0x00000000}, - {0x00001038, 0x00000000}, - {0x00001078, 0x00000000}, - {0x000010b8, 0x00000000}, - {0x000010f8, 0x00000000}, - {0x00001138, 0x00000000}, - {0x00001178, 0x00000000}, - {0x000011b8, 0x00000000}, - {0x000011f8, 0x00000000}, - {0x00001238, 0x00000000}, - {0x00001278, 0x00000000}, - {0x000012b8, 0x00000000}, - {0x000012f8, 0x00000000}, - {0x00001338, 0x00000000}, - {0x00001378, 0x00000000}, - {0x000013b8, 0x00000000}, - {0x000013f8, 0x00000000}, - {0x00001438, 0x00000000}, - {0x00001478, 0x00000000}, - {0x000014b8, 0x00000000}, - {0x000014f8, 0x00000000}, - {0x00001538, 0x00000000}, - {0x00001578, 0x00000000}, - {0x000015b8, 0x00000000}, - {0x000015f8, 0x00000000}, - {0x00001638, 0x00000000}, - {0x00001678, 0x00000000}, - {0x000016b8, 0x00000000}, - {0x000016f8, 0x00000000}, - {0x00001738, 0x00000000}, - {0x00001778, 0x00000000}, - {0x000017b8, 0x00000000}, - {0x000017f8, 0x00000000}, - {0x0000103c, 0x00000000}, - {0x0000107c, 0x00000000}, - {0x000010bc, 0x00000000}, - {0x000010fc, 0x00000000}, - {0x0000113c, 0x00000000}, - {0x0000117c, 0x00000000}, - {0x000011bc, 0x00000000}, - {0x000011fc, 0x00000000}, - {0x0000123c, 0x00000000}, - {0x0000127c, 0x00000000}, - {0x000012bc, 0x00000000}, - {0x000012fc, 0x00000000}, - {0x0000133c, 0x00000000}, - {0x0000137c, 0x00000000}, - {0x000013bc, 0x00000000}, - {0x000013fc, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00004030, 0x00000002}, - {0x0000403c, 0x00000002}, - {0x00007010, 0x00000020}, - {0x00007038, 0x000004c2}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008018, 0x00000700}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00000000}, - {0x00008048, 0x40000000}, - {0x00008054, 0x00000000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x000080c0, 0x2a82301a}, - {0x000080c4, 0x05dc01e0}, - {0x000080c8, 0x1f402710}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00001e00}, - {0x000080d4, 0x00000000}, - {0x000080d8, 0x00400000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x003f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080f8, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00020000}, - {0x00008104, 0x00000001}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000168}, - {0x00008118, 0x000100aa}, - {0x0000811c, 0x00003210}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x00000000}, - {0x00008144, 0xffffffff}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x00008170, 0x32143320}, - {0x00008174, 0xfaa4fa50}, - {0x00008178, 0x00000100}, - {0x0000817c, 0x00000000}, - {0x000081c4, 0x00000000}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008200, 0x00000000}, - {0x00008204, 0x00000000}, - {0x00008208, 0x00000000}, - {0x0000820c, 0x00000000}, - {0x00008210, 0x00000000}, - {0x00008214, 0x00000000}, - {0x00008218, 0x00000000}, - {0x0000821c, 0x00000000}, - {0x00008220, 0x00000000}, - {0x00008224, 0x00000000}, - {0x00008228, 0x00000000}, - {0x0000822c, 0x00000000}, - {0x00008230, 0x00000000}, - {0x00008234, 0x00000000}, - {0x00008238, 0x00000000}, - {0x0000823c, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008244, 0x0010f400}, - {0x00008248, 0x00000100}, - {0x0000824c, 0x0001e800}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x400000ff}, - {0x00008260, 0x00080922}, - {0x00008264, 0x88a00010}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000000}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x00000000}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x00008300, 0x00000000}, - {0x00008304, 0x00000000}, - {0x00008308, 0x00000000}, - {0x0000830c, 0x00000000}, - {0x00008310, 0x00000000}, - {0x00008314, 0x00000000}, - {0x00008318, 0x00000000}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x00000007}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000e00}, - {0x00008338, 0x00ff0000}, - {0x0000833c, 0x00000000}, - {0x00008340, 0x000107ff}, - {0x00009808, 0x00000000}, - {0x0000980c, 0xad848e19}, - {0x00009810, 0x7d14e000}, - {0x00009814, 0x9c0a9f6b}, - {0x0000981c, 0x00000000}, - {0x0000982c, 0x0000a000}, - {0x00009830, 0x00000000}, - {0x0000983c, 0x00200400}, - {0x00009840, 0x206a01ae}, - {0x0000984c, 0x1284233c}, - {0x00009854, 0x00000859}, - {0x00009900, 0x00000000}, - {0x00009904, 0x00000000}, - {0x00009908, 0x00000000}, - {0x0000990c, 0x00000000}, - {0x0000991c, 0x10000fff}, - {0x00009920, 0x05100000}, - {0x0000a920, 0x05100000}, - {0x0000b920, 0x05100000}, - {0x00009928, 0x00000001}, - {0x0000992c, 0x00000004}, - {0x00009934, 0x1e1f2022}, - {0x00009938, 0x0a0b0c0d}, - {0x0000993c, 0x00000000}, - {0x00009948, 0x9280b212}, - {0x0000994c, 0x00020028}, - {0x00009954, 0x5f3ca3de}, - {0x00009958, 0x2108ecff}, - {0x00009940, 0x00750604}, - {0x0000c95c, 0x004b6a8e}, - {0x00009970, 0x190fb515}, - {0x00009974, 0x00000000}, - {0x00009978, 0x00000001}, - {0x0000997c, 0x00000000}, - {0x00009980, 0x00000000}, - {0x00009984, 0x00000000}, - {0x00009988, 0x00000000}, - {0x0000998c, 0x00000000}, - {0x00009990, 0x00000000}, - {0x00009994, 0x00000000}, - {0x00009998, 0x00000000}, - {0x0000999c, 0x00000000}, - {0x000099a0, 0x00000000}, - {0x000099a4, 0x00000001}, - {0x000099a8, 0x201fff00}, - {0x000099ac, 0x006f0000}, - {0x000099b0, 0x03051000}, - {0x000099dc, 0x00000000}, - {0x000099e0, 0x00000200}, - {0x000099e4, 0xaaaaaaaa}, - {0x000099e8, 0x3c466478}, - {0x000099ec, 0x0cc80caa}, - {0x000099fc, 0x00001042}, - {0x00009b00, 0x00000000}, - {0x00009b04, 0x00000001}, - {0x00009b08, 0x00000002}, - {0x00009b0c, 0x00000003}, - {0x00009b10, 0x00000004}, - {0x00009b14, 0x00000005}, - {0x00009b18, 0x00000008}, - {0x00009b1c, 0x00000009}, - {0x00009b20, 0x0000000a}, - {0x00009b24, 0x0000000b}, - {0x00009b28, 0x0000000c}, - {0x00009b2c, 0x0000000d}, - {0x00009b30, 0x00000010}, - {0x00009b34, 0x00000011}, - {0x00009b38, 0x00000012}, - {0x00009b3c, 0x00000013}, - {0x00009b40, 0x00000014}, - {0x00009b44, 0x00000015}, - {0x00009b48, 0x00000018}, - {0x00009b4c, 0x00000019}, - {0x00009b50, 0x0000001a}, - {0x00009b54, 0x0000001b}, - {0x00009b58, 0x0000001c}, - {0x00009b5c, 0x0000001d}, - {0x00009b60, 0x00000020}, - {0x00009b64, 0x00000021}, - {0x00009b68, 0x00000022}, - {0x00009b6c, 0x00000023}, - {0x00009b70, 0x00000024}, - {0x00009b74, 0x00000025}, - {0x00009b78, 0x00000028}, - {0x00009b7c, 0x00000029}, - {0x00009b80, 0x0000002a}, - {0x00009b84, 0x0000002b}, - {0x00009b88, 0x0000002c}, - {0x00009b8c, 0x0000002d}, - {0x00009b90, 0x00000030}, - {0x00009b94, 0x00000031}, - {0x00009b98, 0x00000032}, - {0x00009b9c, 0x00000033}, - {0x00009ba0, 0x00000034}, - {0x00009ba4, 0x00000035}, - {0x00009ba8, 0x00000035}, - {0x00009bac, 0x00000035}, - {0x00009bb0, 0x00000035}, - {0x00009bb4, 0x00000035}, - {0x00009bb8, 0x00000035}, - {0x00009bbc, 0x00000035}, - {0x00009bc0, 0x00000035}, - {0x00009bc4, 0x00000035}, - {0x00009bc8, 0x00000035}, - {0x00009bcc, 0x00000035}, - {0x00009bd0, 0x00000035}, - {0x00009bd4, 0x00000035}, - {0x00009bd8, 0x00000035}, - {0x00009bdc, 0x00000035}, - {0x00009be0, 0x00000035}, - {0x00009be4, 0x00000035}, - {0x00009be8, 0x00000035}, - {0x00009bec, 0x00000035}, - {0x00009bf0, 0x00000035}, - {0x00009bf4, 0x00000035}, - {0x00009bf8, 0x00000010}, - {0x00009bfc, 0x0000001a}, - {0x0000a210, 0x40806333}, - {0x0000a214, 0x00106c10}, - {0x0000a218, 0x009c4060}, - {0x0000a220, 0x018830c6}, - {0x0000a224, 0x00000400}, - {0x0000a228, 0x001a0bb5}, - {0x0000a22c, 0x00000000}, - {0x0000a234, 0x20202020}, - {0x0000a238, 0x20202020}, - {0x0000a23c, 0x13c889af}, - {0x0000a240, 0x38490a20}, - {0x0000a244, 0x00007bb6}, - {0x0000a248, 0x0fff3ffc}, - {0x0000a24c, 0x00000001}, - {0x0000a250, 0x0000e000}, - {0x0000a254, 0x00000000}, - {0x0000a258, 0x0cc75380}, - {0x0000a25c, 0x0f0f0f01}, - {0x0000a260, 0xdfa91f01}, - {0x0000a268, 0x00000001}, - {0x0000a26c, 0x0e79e5c6}, - {0x0000b26c, 0x0e79e5c6}, - {0x0000c26c, 0x0e79e5c6}, - {0x0000d270, 0x00820820}, - {0x0000a278, 0x1ce739ce}, - {0x0000a27c, 0x050701ce}, - {0x0000a338, 0x00000000}, - {0x0000a33c, 0x00000000}, - {0x0000a340, 0x00000000}, - {0x0000a344, 0x00000000}, - {0x0000a348, 0x3fffffff}, - {0x0000a34c, 0x3fffffff}, - {0x0000a350, 0x3fffffff}, - {0x0000a354, 0x0003ffff}, - {0x0000a358, 0x79bfaa03}, - {0x0000d35c, 0x07ffffef}, - {0x0000d360, 0x0fffffe7}, - {0x0000d364, 0x17ffffe5}, - {0x0000d368, 0x1fffffe4}, - {0x0000d36c, 0x37ffffe3}, - {0x0000d370, 0x3fffffe3}, - {0x0000d374, 0x57ffffe3}, - {0x0000d378, 0x5fffffe2}, - {0x0000d37c, 0x7fffffe2}, - {0x0000d380, 0x7f3c7bba}, - {0x0000d384, 0xf3307ff0}, - {0x0000a388, 0x0c000000}, - {0x0000a38c, 0x20202020}, - {0x0000a390, 0x20202020}, - {0x0000a394, 0x1ce739ce}, - {0x0000a398, 0x000001ce}, - {0x0000a39c, 0x00000001}, - {0x0000a3a0, 0x00000000}, - {0x0000a3a4, 0x00000000}, - {0x0000a3a8, 0x00000000}, - {0x0000a3ac, 0x00000000}, - {0x0000a3b0, 0x00000000}, - {0x0000a3b4, 0x00000000}, - {0x0000a3b8, 0x00000000}, - {0x0000a3bc, 0x00000000}, - {0x0000a3c0, 0x00000000}, - {0x0000a3c4, 0x00000000}, - {0x0000a3c8, 0x00000246}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3dc, 0x1ce739ce}, - {0x0000a3e0, 0x000001ce}, -}; - -static const u32 ar5416Addac_9160[][2] = { - /* Addr allmodes */ - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x000000c0}, - {0x0000989c, 0x00000018}, - {0x0000989c, 0x00000004}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x000000c0}, - {0x0000989c, 0x00000019}, - {0x0000989c, 0x00000004}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000004}, - {0x0000989c, 0x00000003}, - {0x0000989c, 0x00000008}, - {0x0000989c, 0x00000000}, - {0x000098cc, 0x00000000}, -}; - -static const u32 ar5416Addac_9160_1_1[][2] = { - /* Addr allmodes */ - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x000000c0}, - {0x0000989c, 0x00000018}, - {0x0000989c, 0x00000004}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x000000c0}, - {0x0000989c, 0x00000019}, - {0x0000989c, 0x00000004}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x0000989c, 0x00000000}, - {0x000098cc, 0x00000000}, -}; - diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c deleted file mode 100644 index 9f589744a9f9..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c +++ /dev/null @@ -1,992 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "hw.h" -#include "hw-ops.h" -#include "ar9002_phy.h" - -#define AR9285_CLCAL_REDO_THRESH 1 - -enum ar9002_cal_types { - ADC_GAIN_CAL = BIT(0), - ADC_DC_CAL = BIT(1), - IQ_MISMATCH_CAL = BIT(2), -}; - -static bool ar9002_hw_is_cal_supported(struct ath_hw *ah, - struct ath9k_channel *chan, - enum ar9002_cal_types cal_type) -{ - bool supported = false; - switch (ah->supp_cals & cal_type) { - case IQ_MISMATCH_CAL: - /* Run IQ Mismatch for non-CCK only */ - if (!IS_CHAN_B(chan)) - supported = true; - break; - case ADC_GAIN_CAL: - case ADC_DC_CAL: - /* Run ADC Gain Cal for non-CCK & non 2GHz-HT20 only */ - if (!IS_CHAN_B(chan) && - !((IS_CHAN_2GHZ(chan) || IS_CHAN_A_FAST_CLOCK(ah, chan)) && - IS_CHAN_HT20(chan))) - supported = true; - break; - } - return supported; -} - -static void ar9002_hw_setup_calibration(struct ath_hw *ah, - struct ath9k_cal_list *currCal) -{ - struct ath_common *common = ath9k_hw_common(ah); - - REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4(0), - AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX, - currCal->calData->calCountMax); - - switch (currCal->calData->calType) { - case IQ_MISMATCH_CAL: - REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_IQ); - ath_dbg(common, CALIBRATE, - "starting IQ Mismatch Calibration\n"); - break; - case ADC_GAIN_CAL: - REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_GAIN); - ath_dbg(common, CALIBRATE, "starting ADC Gain Calibration\n"); - break; - case ADC_DC_CAL: - REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_DC_PER); - ath_dbg(common, CALIBRATE, "starting ADC DC Calibration\n"); - break; - } - - REG_SET_BIT(ah, AR_PHY_TIMING_CTRL4(0), - AR_PHY_TIMING_CTRL4_DO_CAL); -} - -static bool ar9002_hw_per_calibration(struct ath_hw *ah, - struct ath9k_channel *ichan, - u8 rxchainmask, - struct ath9k_cal_list *currCal) -{ - struct ath9k_hw_cal_data *caldata = ah->caldata; - bool iscaldone = false; - - if (currCal->calState == CAL_RUNNING) { - if (!(REG_READ(ah, AR_PHY_TIMING_CTRL4(0)) & - AR_PHY_TIMING_CTRL4_DO_CAL)) { - - currCal->calData->calCollect(ah); - ah->cal_samples++; - - if (ah->cal_samples >= - currCal->calData->calNumSamples) { - int i, numChains = 0; - for (i = 0; i < AR5416_MAX_CHAINS; i++) { - if (rxchainmask & (1 << i)) - numChains++; - } - - currCal->calData->calPostProc(ah, numChains); - caldata->CalValid |= currCal->calData->calType; - currCal->calState = CAL_DONE; - iscaldone = true; - } else { - ar9002_hw_setup_calibration(ah, currCal); - } - } - } else if (!(caldata->CalValid & currCal->calData->calType)) { - ath9k_hw_reset_calibration(ah, currCal); - } - - return iscaldone; -} - -static void ar9002_hw_iqcal_collect(struct ath_hw *ah) -{ - int i; - - for (i = 0; i < AR5416_MAX_CHAINS; i++) { - ah->totalPowerMeasI[i] += - REG_READ(ah, AR_PHY_CAL_MEAS_0(i)); - ah->totalPowerMeasQ[i] += - REG_READ(ah, AR_PHY_CAL_MEAS_1(i)); - ah->totalIqCorrMeas[i] += - (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i)); - ath_dbg(ath9k_hw_common(ah), CALIBRATE, - "%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n", - ah->cal_samples, i, ah->totalPowerMeasI[i], - ah->totalPowerMeasQ[i], - ah->totalIqCorrMeas[i]); - } -} - -static void ar9002_hw_adc_gaincal_collect(struct ath_hw *ah) -{ - int i; - - for (i = 0; i < AR5416_MAX_CHAINS; i++) { - ah->totalAdcIOddPhase[i] += - REG_READ(ah, AR_PHY_CAL_MEAS_0(i)); - ah->totalAdcIEvenPhase[i] += - REG_READ(ah, AR_PHY_CAL_MEAS_1(i)); - ah->totalAdcQOddPhase[i] += - REG_READ(ah, AR_PHY_CAL_MEAS_2(i)); - ah->totalAdcQEvenPhase[i] += - REG_READ(ah, AR_PHY_CAL_MEAS_3(i)); - - ath_dbg(ath9k_hw_common(ah), CALIBRATE, - "%d: Chn %d oddi=0x%08x; eveni=0x%08x; oddq=0x%08x; evenq=0x%08x;\n", - ah->cal_samples, i, - ah->totalAdcIOddPhase[i], - ah->totalAdcIEvenPhase[i], - ah->totalAdcQOddPhase[i], - ah->totalAdcQEvenPhase[i]); - } -} - -static void ar9002_hw_adc_dccal_collect(struct ath_hw *ah) -{ - int i; - - for (i = 0; i < AR5416_MAX_CHAINS; i++) { - ah->totalAdcDcOffsetIOddPhase[i] += - (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_0(i)); - ah->totalAdcDcOffsetIEvenPhase[i] += - (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_1(i)); - ah->totalAdcDcOffsetQOddPhase[i] += - (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i)); - ah->totalAdcDcOffsetQEvenPhase[i] += - (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_3(i)); - - ath_dbg(ath9k_hw_common(ah), CALIBRATE, - "%d: Chn %d oddi=0x%08x; eveni=0x%08x; oddq=0x%08x; evenq=0x%08x;\n", - ah->cal_samples, i, - ah->totalAdcDcOffsetIOddPhase[i], - ah->totalAdcDcOffsetIEvenPhase[i], - ah->totalAdcDcOffsetQOddPhase[i], - ah->totalAdcDcOffsetQEvenPhase[i]); - } -} - -static void ar9002_hw_iqcalibrate(struct ath_hw *ah, u8 numChains) -{ - struct ath_common *common = ath9k_hw_common(ah); - u32 powerMeasQ, powerMeasI, iqCorrMeas; - u32 qCoffDenom, iCoffDenom; - int32_t qCoff, iCoff; - int iqCorrNeg, i; - - for (i = 0; i < numChains; i++) { - powerMeasI = ah->totalPowerMeasI[i]; - powerMeasQ = ah->totalPowerMeasQ[i]; - iqCorrMeas = ah->totalIqCorrMeas[i]; - - ath_dbg(common, CALIBRATE, - "Starting IQ Cal and Correction for Chain %d\n", - i); - - ath_dbg(common, CALIBRATE, - "Original: Chn %d iq_corr_meas = 0x%08x\n", - i, ah->totalIqCorrMeas[i]); - - iqCorrNeg = 0; - - if (iqCorrMeas > 0x80000000) { - iqCorrMeas = (0xffffffff - iqCorrMeas) + 1; - iqCorrNeg = 1; - } - - ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_i = 0x%08x\n", - i, powerMeasI); - ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_q = 0x%08x\n", - i, powerMeasQ); - ath_dbg(common, CALIBRATE, "iqCorrNeg is 0x%08x\n", iqCorrNeg); - - iCoffDenom = (powerMeasI / 2 + powerMeasQ / 2) / 128; - qCoffDenom = powerMeasQ / 64; - - if ((powerMeasQ != 0) && (iCoffDenom != 0) && - (qCoffDenom != 0)) { - iCoff = iqCorrMeas / iCoffDenom; - qCoff = powerMeasI / qCoffDenom - 64; - ath_dbg(common, CALIBRATE, "Chn %d iCoff = 0x%08x\n", - i, iCoff); - ath_dbg(common, CALIBRATE, "Chn %d qCoff = 0x%08x\n", - i, qCoff); - - iCoff = iCoff & 0x3f; - ath_dbg(common, CALIBRATE, - "New: Chn %d iCoff = 0x%08x\n", i, iCoff); - if (iqCorrNeg == 0x0) - iCoff = 0x40 - iCoff; - - if (qCoff > 15) - qCoff = 15; - else if (qCoff <= -16) - qCoff = -16; - - ath_dbg(common, CALIBRATE, - "Chn %d : iCoff = 0x%x qCoff = 0x%x\n", - i, iCoff, qCoff); - - REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4(i), - AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF, - iCoff); - REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4(i), - AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF, - qCoff); - ath_dbg(common, CALIBRATE, - "IQ Cal and Correction done for Chain %d\n", - i); - } - } - - REG_SET_BIT(ah, AR_PHY_TIMING_CTRL4(0), - AR_PHY_TIMING_CTRL4_IQCORR_ENABLE); -} - -static void ar9002_hw_adc_gaincal_calibrate(struct ath_hw *ah, u8 numChains) -{ - struct ath_common *common = ath9k_hw_common(ah); - u32 iOddMeasOffset, iEvenMeasOffset, qOddMeasOffset, qEvenMeasOffset; - u32 qGainMismatch, iGainMismatch, val, i; - - for (i = 0; i < numChains; i++) { - iOddMeasOffset = ah->totalAdcIOddPhase[i]; - iEvenMeasOffset = ah->totalAdcIEvenPhase[i]; - qOddMeasOffset = ah->totalAdcQOddPhase[i]; - qEvenMeasOffset = ah->totalAdcQEvenPhase[i]; - - ath_dbg(common, CALIBRATE, - "Starting ADC Gain Cal for Chain %d\n", i); - - ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_odd_i = 0x%08x\n", - i, iOddMeasOffset); - ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_even_i = 0x%08x\n", - i, iEvenMeasOffset); - ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_odd_q = 0x%08x\n", - i, qOddMeasOffset); - ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_even_q = 0x%08x\n", - i, qEvenMeasOffset); - - if (iOddMeasOffset != 0 && qEvenMeasOffset != 0) { - iGainMismatch = - ((iEvenMeasOffset * 32) / - iOddMeasOffset) & 0x3f; - qGainMismatch = - ((qOddMeasOffset * 32) / - qEvenMeasOffset) & 0x3f; - - ath_dbg(common, CALIBRATE, - "Chn %d gain_mismatch_i = 0x%08x\n", - i, iGainMismatch); - ath_dbg(common, CALIBRATE, - "Chn %d gain_mismatch_q = 0x%08x\n", - i, qGainMismatch); - - val = REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i)); - val &= 0xfffff000; - val |= (qGainMismatch) | (iGainMismatch << 6); - REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i), val); - - ath_dbg(common, CALIBRATE, - "ADC Gain Cal done for Chain %d\n", i); - } - } - - REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(0), - REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(0)) | - AR_PHY_NEW_ADC_GAIN_CORR_ENABLE); -} - -static void ar9002_hw_adc_dccal_calibrate(struct ath_hw *ah, u8 numChains) -{ - struct ath_common *common = ath9k_hw_common(ah); - u32 iOddMeasOffset, iEvenMeasOffset, val, i; - int32_t qOddMeasOffset, qEvenMeasOffset, qDcMismatch, iDcMismatch; - const struct ath9k_percal_data *calData = - ah->cal_list_curr->calData; - u32 numSamples = - (1 << (calData->calCountMax + 5)) * calData->calNumSamples; - - for (i = 0; i < numChains; i++) { - iOddMeasOffset = ah->totalAdcDcOffsetIOddPhase[i]; - iEvenMeasOffset = ah->totalAdcDcOffsetIEvenPhase[i]; - qOddMeasOffset = ah->totalAdcDcOffsetQOddPhase[i]; - qEvenMeasOffset = ah->totalAdcDcOffsetQEvenPhase[i]; - - ath_dbg(common, CALIBRATE, - "Starting ADC DC Offset Cal for Chain %d\n", i); - - ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_odd_i = %d\n", - i, iOddMeasOffset); - ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_even_i = %d\n", - i, iEvenMeasOffset); - ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_odd_q = %d\n", - i, qOddMeasOffset); - ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_even_q = %d\n", - i, qEvenMeasOffset); - - iDcMismatch = (((iEvenMeasOffset - iOddMeasOffset) * 2) / - numSamples) & 0x1ff; - qDcMismatch = (((qOddMeasOffset - qEvenMeasOffset) * 2) / - numSamples) & 0x1ff; - - ath_dbg(common, CALIBRATE, - "Chn %d dc_offset_mismatch_i = 0x%08x\n", - i, iDcMismatch); - ath_dbg(common, CALIBRATE, - "Chn %d dc_offset_mismatch_q = 0x%08x\n", - i, qDcMismatch); - - val = REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i)); - val &= 0xc0000fff; - val |= (qDcMismatch << 12) | (iDcMismatch << 21); - REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i), val); - - ath_dbg(common, CALIBRATE, - "ADC DC Offset Cal done for Chain %d\n", i); - } - - REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(0), - REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(0)) | - AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE); -} - -static void ar9287_hw_olc_temp_compensation(struct ath_hw *ah) -{ - u32 rddata; - int32_t delta, currPDADC, slope; - - rddata = REG_READ(ah, AR_PHY_TX_PWRCTRL4); - currPDADC = MS(rddata, AR_PHY_TX_PWRCTRL_PD_AVG_OUT); - - if (ah->initPDADC == 0 || currPDADC == 0) { - /* - * Zero value indicates that no frames have been transmitted - * yet, can't do temperature compensation until frames are - * transmitted. - */ - return; - } else { - slope = ah->eep_ops->get_eeprom(ah, EEP_TEMPSENSE_SLOPE); - - if (slope == 0) { /* to avoid divide by zero case */ - delta = 0; - } else { - delta = ((currPDADC - ah->initPDADC)*4) / slope; - } - REG_RMW_FIELD(ah, AR_PHY_CH0_TX_PWRCTRL11, - AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP, delta); - REG_RMW_FIELD(ah, AR_PHY_CH1_TX_PWRCTRL11, - AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP, delta); - } -} - -static void ar9280_hw_olc_temp_compensation(struct ath_hw *ah) -{ - u32 rddata, i; - int delta, currPDADC, regval; - - rddata = REG_READ(ah, AR_PHY_TX_PWRCTRL4); - currPDADC = MS(rddata, AR_PHY_TX_PWRCTRL_PD_AVG_OUT); - - if (ah->initPDADC == 0 || currPDADC == 0) - return; - - if (ah->eep_ops->get_eeprom(ah, EEP_DAC_HPWR_5G)) - delta = (currPDADC - ah->initPDADC + 4) / 8; - else - delta = (currPDADC - ah->initPDADC + 5) / 10; - - if (delta != ah->PDADCdelta) { - ah->PDADCdelta = delta; - for (i = 1; i < AR9280_TX_GAIN_TABLE_SIZE; i++) { - regval = ah->originalGain[i] - delta; - if (regval < 0) - regval = 0; - - REG_RMW_FIELD(ah, - AR_PHY_TX_GAIN_TBL1 + i * 4, - AR_PHY_TX_GAIN, regval); - } - } -} - -static void ar9271_hw_pa_cal(struct ath_hw *ah, bool is_reset) -{ - u32 regVal; - unsigned int i; - u32 regList[][2] = { - { 0x786c, 0 }, - { 0x7854, 0 }, - { 0x7820, 0 }, - { 0x7824, 0 }, - { 0x7868, 0 }, - { 0x783c, 0 }, - { 0x7838, 0 } , - { 0x7828, 0 } , - }; - - for (i = 0; i < ARRAY_SIZE(regList); i++) - regList[i][1] = REG_READ(ah, regList[i][0]); - - regVal = REG_READ(ah, 0x7834); - regVal &= (~(0x1)); - REG_WRITE(ah, 0x7834, regVal); - regVal = REG_READ(ah, 0x9808); - regVal |= (0x1 << 27); - REG_WRITE(ah, 0x9808, regVal); - - /* 786c,b23,1, pwddac=1 */ - REG_RMW_FIELD(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC, 1); - /* 7854, b5,1, pdrxtxbb=1 */ - REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1, 1); - /* 7854, b7,1, pdv2i=1 */ - REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I, 1); - /* 7854, b8,1, pddacinterface=1 */ - REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF, 1); - /* 7824,b12,0, offcal=0 */ - REG_RMW_FIELD(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL, 0); - /* 7838, b1,0, pwddb=0 */ - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB, 0); - /* 7820,b11,0, enpacal=0 */ - REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL, 0); - /* 7820,b25,1, pdpadrv1=0 */ - REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1, 0); - /* 7820,b24,0, pdpadrv2=0 */ - REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2, 0); - /* 7820,b23,0, pdpaout=0 */ - REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT, 0); - /* 783c,b14-16,7, padrvgn2tab_0=7 */ - REG_RMW_FIELD(ah, AR9285_AN_RF2G8, AR9285_AN_RF2G8_PADRVGN2TAB0, 7); - /* - * 7838,b29-31,0, padrvgn1tab_0=0 - * does not matter since we turn it off - */ - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0); - - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff); - - /* Set: - * localmode=1,bmode=1,bmoderxtx=1,synthon=1, - * txon=1,paon=1,oscon=1,synthon_force=1 - */ - REG_WRITE(ah, AR9285_AN_TOP2, 0xca0358a0); - udelay(30); - REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9271_AN_RF2G6_OFFS, 0); - - /* find off_6_1; */ - for (i = 6; i > 0; i--) { - regVal = REG_READ(ah, 0x7834); - regVal |= (1 << (20 + i)); - REG_WRITE(ah, 0x7834, regVal); - udelay(1); - /* regVal = REG_READ(ah, 0x7834); */ - regVal &= (~(0x1 << (20 + i))); - regVal |= (MS(REG_READ(ah, 0x7840), AR9285_AN_RXTXBB1_SPARE9) - << (20 + i)); - REG_WRITE(ah, 0x7834, regVal); - } - - regVal = (regVal >> 20) & 0x7f; - - /* Update PA cal info */ - if ((!is_reset) && (ah->pacal_info.prev_offset == regVal)) { - if (ah->pacal_info.max_skipcount < MAX_PACAL_SKIPCOUNT) - ah->pacal_info.max_skipcount = - 2 * ah->pacal_info.max_skipcount; - ah->pacal_info.skipcount = ah->pacal_info.max_skipcount; - } else { - ah->pacal_info.max_skipcount = 1; - ah->pacal_info.skipcount = 0; - ah->pacal_info.prev_offset = regVal; - } - - ENABLE_REGWRITE_BUFFER(ah); - - regVal = REG_READ(ah, 0x7834); - regVal |= 0x1; - REG_WRITE(ah, 0x7834, regVal); - regVal = REG_READ(ah, 0x9808); - regVal &= (~(0x1 << 27)); - REG_WRITE(ah, 0x9808, regVal); - - for (i = 0; i < ARRAY_SIZE(regList); i++) - REG_WRITE(ah, regList[i][0], regList[i][1]); - - REGWRITE_BUFFER_FLUSH(ah); -} - -static inline void ar9285_hw_pa_cal(struct ath_hw *ah, bool is_reset) -{ - struct ath_common *common = ath9k_hw_common(ah); - u32 regVal; - int i, offset, offs_6_1, offs_0; - u32 ccomp_org, reg_field; - u32 regList[][2] = { - { 0x786c, 0 }, - { 0x7854, 0 }, - { 0x7820, 0 }, - { 0x7824, 0 }, - { 0x7868, 0 }, - { 0x783c, 0 }, - { 0x7838, 0 }, - }; - - ath_dbg(common, CALIBRATE, "Running PA Calibration\n"); - - /* PA CAL is not needed for high power solution */ - if (ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE) == - AR5416_EEP_TXGAIN_HIGH_POWER) - return; - - for (i = 0; i < ARRAY_SIZE(regList); i++) - regList[i][1] = REG_READ(ah, regList[i][0]); - - regVal = REG_READ(ah, 0x7834); - regVal &= (~(0x1)); - REG_WRITE(ah, 0x7834, regVal); - regVal = REG_READ(ah, 0x9808); - regVal |= (0x1 << 27); - REG_WRITE(ah, 0x9808, regVal); - - REG_RMW_FIELD(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC, 1); - REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1, 1); - REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I, 1); - REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF, 1); - REG_RMW_FIELD(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL, 0); - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB, 0); - REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL, 0); - REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1, 0); - REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2, 0); - REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT, 0); - REG_RMW_FIELD(ah, AR9285_AN_RF2G8, AR9285_AN_RF2G8_PADRVGN2TAB0, 7); - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0); - ccomp_org = MS(REG_READ(ah, AR9285_AN_RF2G6), AR9285_AN_RF2G6_CCOMP); - REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9285_AN_RF2G6_CCOMP, 0xf); - - REG_WRITE(ah, AR9285_AN_TOP2, 0xca0358a0); - udelay(30); - REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9285_AN_RF2G6_OFFS, 0); - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9285_AN_RF2G3_PDVCCOMP, 0); - - for (i = 6; i > 0; i--) { - regVal = REG_READ(ah, 0x7834); - regVal |= (1 << (19 + i)); - REG_WRITE(ah, 0x7834, regVal); - udelay(1); - regVal = REG_READ(ah, 0x7834); - regVal &= (~(0x1 << (19 + i))); - reg_field = MS(REG_READ(ah, 0x7840), AR9285_AN_RXTXBB1_SPARE9); - regVal |= (reg_field << (19 + i)); - REG_WRITE(ah, 0x7834, regVal); - } - - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9285_AN_RF2G3_PDVCCOMP, 1); - udelay(1); - reg_field = MS(REG_READ(ah, AR9285_AN_RF2G9), AR9285_AN_RXTXBB1_SPARE9); - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9285_AN_RF2G3_PDVCCOMP, reg_field); - offs_6_1 = MS(REG_READ(ah, AR9285_AN_RF2G6), AR9285_AN_RF2G6_OFFS); - offs_0 = MS(REG_READ(ah, AR9285_AN_RF2G3), AR9285_AN_RF2G3_PDVCCOMP); - - offset = (offs_6_1<<1) | offs_0; - offset = offset - 0; - offs_6_1 = offset>>1; - offs_0 = offset & 1; - - if ((!is_reset) && (ah->pacal_info.prev_offset == offset)) { - if (ah->pacal_info.max_skipcount < MAX_PACAL_SKIPCOUNT) - ah->pacal_info.max_skipcount = - 2 * ah->pacal_info.max_skipcount; - ah->pacal_info.skipcount = ah->pacal_info.max_skipcount; - } else { - ah->pacal_info.max_skipcount = 1; - ah->pacal_info.skipcount = 0; - ah->pacal_info.prev_offset = offset; - } - - REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9285_AN_RF2G6_OFFS, offs_6_1); - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9285_AN_RF2G3_PDVCCOMP, offs_0); - - regVal = REG_READ(ah, 0x7834); - regVal |= 0x1; - REG_WRITE(ah, 0x7834, regVal); - regVal = REG_READ(ah, 0x9808); - regVal &= (~(0x1 << 27)); - REG_WRITE(ah, 0x9808, regVal); - - for (i = 0; i < ARRAY_SIZE(regList); i++) - REG_WRITE(ah, regList[i][0], regList[i][1]); - - REG_RMW_FIELD(ah, AR9285_AN_RF2G6, AR9285_AN_RF2G6_CCOMP, ccomp_org); -} - -static void ar9002_hw_pa_cal(struct ath_hw *ah, bool is_reset) -{ - if (AR_SREV_9271(ah)) { - if (is_reset || !ah->pacal_info.skipcount) - ar9271_hw_pa_cal(ah, is_reset); - else - ah->pacal_info.skipcount--; - } else if (AR_SREV_9285_12_OR_LATER(ah)) { - if (is_reset || !ah->pacal_info.skipcount) - ar9285_hw_pa_cal(ah, is_reset); - else - ah->pacal_info.skipcount--; - } -} - -static void ar9002_hw_olc_temp_compensation(struct ath_hw *ah) -{ - if (OLC_FOR_AR9287_10_LATER) - ar9287_hw_olc_temp_compensation(ah); - else if (OLC_FOR_AR9280_20_LATER) - ar9280_hw_olc_temp_compensation(ah); -} - -static bool ar9002_hw_calibrate(struct ath_hw *ah, - struct ath9k_channel *chan, - u8 rxchainmask, - bool longcal) -{ - bool iscaldone = true; - struct ath9k_cal_list *currCal = ah->cal_list_curr; - bool nfcal, nfcal_pending = false; - - nfcal = !!(REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF); - if (ah->caldata) - nfcal_pending = ah->caldata->nfcal_pending; - - if (currCal && !nfcal && - (currCal->calState == CAL_RUNNING || - currCal->calState == CAL_WAITING)) { - iscaldone = ar9002_hw_per_calibration(ah, chan, - rxchainmask, currCal); - if (iscaldone) { - ah->cal_list_curr = currCal = currCal->calNext; - - if (currCal->calState == CAL_WAITING) { - iscaldone = false; - ath9k_hw_reset_calibration(ah, currCal); - } - } - } - - /* Do NF cal only at longer intervals */ - if (longcal || nfcal_pending) { - /* - * Get the value from the previous NF cal and update - * history buffer. - */ - if (ath9k_hw_getnf(ah, chan)) { - /* - * Load the NF from history buffer of the current - * channel. - * NF is slow time-variant, so it is OK to use a - * historical value. - */ - ath9k_hw_loadnf(ah, ah->curchan); - } - - if (longcal) { - ath9k_hw_start_nfcal(ah, false); - /* Do periodic PAOffset Cal */ - ar9002_hw_pa_cal(ah, false); - ar9002_hw_olc_temp_compensation(ah); - } - } - - return iscaldone; -} - -/* Carrier leakage Calibration fix */ -static bool ar9285_hw_cl_cal(struct ath_hw *ah, struct ath9k_channel *chan) -{ - struct ath_common *common = ath9k_hw_common(ah); - - REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE); - if (IS_CHAN_HT20(chan)) { - REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_PARALLEL_CAL_ENABLE); - REG_SET_BIT(ah, AR_PHY_TURBO, AR_PHY_FC_DYN2040_EN); - REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, - AR_PHY_AGC_CONTROL_FLTR_CAL); - REG_CLR_BIT(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_CAL_ENABLE); - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL); - if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, - AR_PHY_AGC_CONTROL_CAL, 0, AH_WAIT_TIMEOUT)) { - ath_dbg(common, CALIBRATE, - "offset calibration failed to complete in %d ms; noisy environment?\n", - AH_WAIT_TIMEOUT / 1000); - return false; - } - REG_CLR_BIT(ah, AR_PHY_TURBO, AR_PHY_FC_DYN2040_EN); - REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_PARALLEL_CAL_ENABLE); - REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE); - } - REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC); - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL); - REG_SET_BIT(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_CAL_ENABLE); - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL); - if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL, - 0, AH_WAIT_TIMEOUT)) { - ath_dbg(common, CALIBRATE, - "offset calibration failed to complete in %d ms; noisy environment?\n", - AH_WAIT_TIMEOUT / 1000); - return false; - } - - REG_SET_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC); - REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE); - REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL); - - return true; -} - -static bool ar9285_hw_clc(struct ath_hw *ah, struct ath9k_channel *chan) -{ - int i; - u_int32_t txgain_max; - u_int32_t clc_gain, gain_mask = 0, clc_num = 0; - u_int32_t reg_clc_I0, reg_clc_Q0; - u_int32_t i0_num = 0; - u_int32_t q0_num = 0; - u_int32_t total_num = 0; - u_int32_t reg_rf2g5_org; - bool retv = true; - - if (!(ar9285_hw_cl_cal(ah, chan))) - return false; - - txgain_max = MS(REG_READ(ah, AR_PHY_TX_PWRCTRL7), - AR_PHY_TX_PWRCTRL_TX_GAIN_TAB_MAX); - - for (i = 0; i < (txgain_max+1); i++) { - clc_gain = (REG_READ(ah, (AR_PHY_TX_GAIN_TBL1+(i<<2))) & - AR_PHY_TX_GAIN_CLC) >> AR_PHY_TX_GAIN_CLC_S; - if (!(gain_mask & (1 << clc_gain))) { - gain_mask |= (1 << clc_gain); - clc_num++; - } - } - - for (i = 0; i < clc_num; i++) { - reg_clc_I0 = (REG_READ(ah, (AR_PHY_CLC_TBL1 + (i << 2))) - & AR_PHY_CLC_I0) >> AR_PHY_CLC_I0_S; - reg_clc_Q0 = (REG_READ(ah, (AR_PHY_CLC_TBL1 + (i << 2))) - & AR_PHY_CLC_Q0) >> AR_PHY_CLC_Q0_S; - if (reg_clc_I0 == 0) - i0_num++; - - if (reg_clc_Q0 == 0) - q0_num++; - } - total_num = i0_num + q0_num; - if (total_num > AR9285_CLCAL_REDO_THRESH) { - reg_rf2g5_org = REG_READ(ah, AR9285_RF2G5); - if (AR_SREV_9285E_20(ah)) { - REG_WRITE(ah, AR9285_RF2G5, - (reg_rf2g5_org & AR9285_RF2G5_IC50TX) | - AR9285_RF2G5_IC50TX_XE_SET); - } else { - REG_WRITE(ah, AR9285_RF2G5, - (reg_rf2g5_org & AR9285_RF2G5_IC50TX) | - AR9285_RF2G5_IC50TX_SET); - } - retv = ar9285_hw_cl_cal(ah, chan); - REG_WRITE(ah, AR9285_RF2G5, reg_rf2g5_org); - } - return retv; -} - -static bool ar9002_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan) -{ - struct ath_common *common = ath9k_hw_common(ah); - - if (AR_SREV_9271(ah)) { - if (!ar9285_hw_cl_cal(ah, chan)) - return false; - } else if (AR_SREV_9285(ah) && AR_SREV_9285_12_OR_LATER(ah)) { - if (!ar9285_hw_clc(ah, chan)) - return false; - } else { - if (AR_SREV_9280_20_OR_LATER(ah)) { - if (!AR_SREV_9287_11_OR_LATER(ah)) - REG_CLR_BIT(ah, AR_PHY_ADC_CTL, - AR_PHY_ADC_CTL_OFF_PWDADC); - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, - AR_PHY_AGC_CONTROL_FLTR_CAL); - } - - /* Calibrate the AGC */ - REG_WRITE(ah, AR_PHY_AGC_CONTROL, - REG_READ(ah, AR_PHY_AGC_CONTROL) | - AR_PHY_AGC_CONTROL_CAL); - - /* Poll for offset calibration complete */ - if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, - AR_PHY_AGC_CONTROL_CAL, - 0, AH_WAIT_TIMEOUT)) { - ath_dbg(common, CALIBRATE, - "offset calibration failed to complete in %d ms; noisy environment?\n", - AH_WAIT_TIMEOUT / 1000); - return false; - } - - if (AR_SREV_9280_20_OR_LATER(ah)) { - if (!AR_SREV_9287_11_OR_LATER(ah)) - REG_SET_BIT(ah, AR_PHY_ADC_CTL, - AR_PHY_ADC_CTL_OFF_PWDADC); - REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, - AR_PHY_AGC_CONTROL_FLTR_CAL); - } - } - - /* Do PA Calibration */ - ar9002_hw_pa_cal(ah, true); - - if (ah->caldata) - ah->caldata->nfcal_pending = true; - - ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; - - /* Enable IQ, ADC Gain and ADC DC offset CALs */ - if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) { - ah->supp_cals = IQ_MISMATCH_CAL; - - if (AR_SREV_9160_10_OR_LATER(ah)) - ah->supp_cals |= ADC_GAIN_CAL | ADC_DC_CAL; - - if (AR_SREV_9287(ah)) - ah->supp_cals &= ~ADC_GAIN_CAL; - - if (ar9002_hw_is_cal_supported(ah, chan, ADC_GAIN_CAL)) { - INIT_CAL(&ah->adcgain_caldata); - INSERT_CAL(ah, &ah->adcgain_caldata); - ath_dbg(common, CALIBRATE, - "enabling ADC Gain Calibration\n"); - } - - if (ar9002_hw_is_cal_supported(ah, chan, ADC_DC_CAL)) { - INIT_CAL(&ah->adcdc_caldata); - INSERT_CAL(ah, &ah->adcdc_caldata); - ath_dbg(common, CALIBRATE, - "enabling ADC DC Calibration\n"); - } - - if (ar9002_hw_is_cal_supported(ah, chan, IQ_MISMATCH_CAL)) { - INIT_CAL(&ah->iq_caldata); - INSERT_CAL(ah, &ah->iq_caldata); - ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n"); - } - - ah->cal_list_curr = ah->cal_list; - - if (ah->cal_list_curr) - ath9k_hw_reset_calibration(ah, ah->cal_list_curr); - } - - if (ah->caldata) - ah->caldata->CalValid = 0; - - return true; -} - -static const struct ath9k_percal_data iq_cal_multi_sample = { - IQ_MISMATCH_CAL, - MAX_CAL_SAMPLES, - PER_MIN_LOG_COUNT, - ar9002_hw_iqcal_collect, - ar9002_hw_iqcalibrate -}; -static const struct ath9k_percal_data iq_cal_single_sample = { - IQ_MISMATCH_CAL, - MIN_CAL_SAMPLES, - PER_MAX_LOG_COUNT, - ar9002_hw_iqcal_collect, - ar9002_hw_iqcalibrate -}; -static const struct ath9k_percal_data adc_gain_cal_multi_sample = { - ADC_GAIN_CAL, - MAX_CAL_SAMPLES, - PER_MIN_LOG_COUNT, - ar9002_hw_adc_gaincal_collect, - ar9002_hw_adc_gaincal_calibrate -}; -static const struct ath9k_percal_data adc_gain_cal_single_sample = { - ADC_GAIN_CAL, - MIN_CAL_SAMPLES, - PER_MAX_LOG_COUNT, - ar9002_hw_adc_gaincal_collect, - ar9002_hw_adc_gaincal_calibrate -}; -static const struct ath9k_percal_data adc_dc_cal_multi_sample = { - ADC_DC_CAL, - MAX_CAL_SAMPLES, - PER_MIN_LOG_COUNT, - ar9002_hw_adc_dccal_collect, - ar9002_hw_adc_dccal_calibrate -}; -static const struct ath9k_percal_data adc_dc_cal_single_sample = { - ADC_DC_CAL, - MIN_CAL_SAMPLES, - PER_MAX_LOG_COUNT, - ar9002_hw_adc_dccal_collect, - ar9002_hw_adc_dccal_calibrate -}; - -static void ar9002_hw_init_cal_settings(struct ath_hw *ah) -{ - if (AR_SREV_9100(ah)) { - ah->iq_caldata.calData = &iq_cal_multi_sample; - ah->supp_cals = IQ_MISMATCH_CAL; - return; - } - - if (AR_SREV_9160_10_OR_LATER(ah)) { - if (AR_SREV_9280_20_OR_LATER(ah)) { - ah->iq_caldata.calData = &iq_cal_single_sample; - ah->adcgain_caldata.calData = - &adc_gain_cal_single_sample; - ah->adcdc_caldata.calData = - &adc_dc_cal_single_sample; - } else { - ah->iq_caldata.calData = &iq_cal_multi_sample; - ah->adcgain_caldata.calData = - &adc_gain_cal_multi_sample; - ah->adcdc_caldata.calData = - &adc_dc_cal_multi_sample; - } - ah->supp_cals = ADC_GAIN_CAL | ADC_DC_CAL | IQ_MISMATCH_CAL; - - if (AR_SREV_9287(ah)) - ah->supp_cals &= ~ADC_GAIN_CAL; - } -} - -void ar9002_hw_attach_calib_ops(struct ath_hw *ah) -{ - struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); - struct ath_hw_ops *ops = ath9k_hw_ops(ah); - - priv_ops->init_cal_settings = ar9002_hw_init_cal_settings; - priv_ops->init_cal = ar9002_hw_init_cal; - priv_ops->setup_calibration = ar9002_hw_setup_calibration; - - ops->calibrate = ar9002_hw_calibrate; -} diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c deleted file mode 100644 index 830daa12feb6..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c +++ /dev/null @@ -1,474 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "hw.h" -#include "ar5008_initvals.h" -#include "ar9001_initvals.h" -#include "ar9002_initvals.h" -#include "ar9002_phy.h" - -/* General hardware code for the A5008/AR9001/AR9002 hadware families */ - -static int ar9002_hw_init_mode_regs(struct ath_hw *ah) -{ - if (AR_SREV_9271(ah)) { - INIT_INI_ARRAY(&ah->iniModes, ar9271Modes_9271); - INIT_INI_ARRAY(&ah->iniCommon, ar9271Common_9271); - INIT_INI_ARRAY(&ah->iniModes_9271_ANI_reg, ar9271Modes_9271_ANI_reg); - return 0; - } - - if (ah->config.pcie_clock_req) - INIT_INI_ARRAY(&ah->iniPcieSerdes, - ar9280PciePhy_clkreq_off_L1_9280); - else - INIT_INI_ARRAY(&ah->iniPcieSerdes, - ar9280PciePhy_clkreq_always_on_L1_9280); -#ifdef CONFIG_PM_SLEEP - INIT_INI_ARRAY(&ah->iniPcieSerdesWow, - ar9280PciePhy_awow); -#endif - - if (AR_SREV_9287_11_OR_LATER(ah)) { - INIT_INI_ARRAY(&ah->iniModes, ar9287Modes_9287_1_1); - INIT_INI_ARRAY(&ah->iniCommon, ar9287Common_9287_1_1); - } else if (AR_SREV_9285_12_OR_LATER(ah)) { - INIT_INI_ARRAY(&ah->iniModes, ar9285Modes_9285_1_2); - INIT_INI_ARRAY(&ah->iniCommon, ar9285Common_9285_1_2); - } else if (AR_SREV_9280_20_OR_LATER(ah)) { - INIT_INI_ARRAY(&ah->iniModes, ar9280Modes_9280_2); - INIT_INI_ARRAY(&ah->iniCommon, ar9280Common_9280_2); - - INIT_INI_ARRAY(&ah->iniModesFastClock, - ar9280Modes_fast_clock_9280_2); - } else if (AR_SREV_9160_10_OR_LATER(ah)) { - INIT_INI_ARRAY(&ah->iniModes, ar5416Modes_9160); - INIT_INI_ARRAY(&ah->iniCommon, ar5416Common_9160); - if (AR_SREV_9160_11(ah)) { - INIT_INI_ARRAY(&ah->iniAddac, - ar5416Addac_9160_1_1); - } else { - INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac_9160); - } - } else if (AR_SREV_9100_OR_LATER(ah)) { - INIT_INI_ARRAY(&ah->iniModes, ar5416Modes_9100); - INIT_INI_ARRAY(&ah->iniCommon, ar5416Common_9100); - INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac_9100); - } else { - INIT_INI_ARRAY(&ah->iniModes, ar5416Modes); - INIT_INI_ARRAY(&ah->iniCommon, ar5416Common); - INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac); - } - - if (!AR_SREV_9280_20_OR_LATER(ah)) { - /* Common for AR5416, AR913x, AR9160 */ - INIT_INI_ARRAY(&ah->iniBB_RfGain, ar5416BB_RfGain); - - /* Common for AR913x, AR9160 */ - if (!AR_SREV_5416(ah)) - INIT_INI_ARRAY(&ah->iniBank6, ar5416Bank6TPC_9100); - else - INIT_INI_ARRAY(&ah->iniBank6, ar5416Bank6TPC); - } - - /* iniAddac needs to be modified for these chips */ - if (AR_SREV_9160(ah) || !AR_SREV_5416_22_OR_LATER(ah)) { - struct ar5416IniArray *addac = &ah->iniAddac; - u32 size = sizeof(u32) * addac->ia_rows * addac->ia_columns; - u32 *data; - - data = devm_kzalloc(ah->dev, size, GFP_KERNEL); - if (!data) - return -ENOMEM; - - memcpy(data, addac->ia_array, size); - addac->ia_array = data; - - if (!AR_SREV_5416_22_OR_LATER(ah)) { - /* override CLKDRV value */ - INI_RA(addac, 31,1) = 0; - } - } - if (AR_SREV_9287_11_OR_LATER(ah)) { - INIT_INI_ARRAY(&ah->iniCckfirNormal, - ar9287Common_normal_cck_fir_coeff_9287_1_1); - INIT_INI_ARRAY(&ah->iniCckfirJapan2484, - ar9287Common_japan_2484_cck_fir_coeff_9287_1_1); - } - return 0; -} - -static void ar9280_20_hw_init_rxgain_ini(struct ath_hw *ah) -{ - u32 rxgain_type; - - if (ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) >= - AR5416_EEP_MINOR_VER_17) { - rxgain_type = ah->eep_ops->get_eeprom(ah, EEP_RXGAIN_TYPE); - - if (rxgain_type == AR5416_EEP_RXGAIN_13DB_BACKOFF) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9280Modes_backoff_13db_rxgain_9280_2); - else if (rxgain_type == AR5416_EEP_RXGAIN_23DB_BACKOFF) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9280Modes_backoff_23db_rxgain_9280_2); - else - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9280Modes_original_rxgain_9280_2); - } else { - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9280Modes_original_rxgain_9280_2); - } -} - -static void ar9280_20_hw_init_txgain_ini(struct ath_hw *ah, u32 txgain_type) -{ - if (ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) >= - AR5416_EEP_MINOR_VER_19) { - if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9280Modes_high_power_tx_gain_9280_2); - else - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9280Modes_original_tx_gain_9280_2); - } else { - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9280Modes_original_tx_gain_9280_2); - } -} - -static void ar9271_hw_init_txgain_ini(struct ath_hw *ah, u32 txgain_type) -{ - if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9271Modes_high_power_tx_gain_9271); - else - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9271Modes_normal_power_tx_gain_9271); -} - -static void ar9002_hw_init_mode_gain_regs(struct ath_hw *ah) -{ - u32 txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE); - - if (AR_SREV_9287_11_OR_LATER(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9287Modes_rx_gain_9287_1_1); - else if (AR_SREV_9280_20(ah)) - ar9280_20_hw_init_rxgain_ini(ah); - - if (AR_SREV_9271(ah)) { - ar9271_hw_init_txgain_ini(ah, txgain_type); - } else if (AR_SREV_9287_11_OR_LATER(ah)) { - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9287Modes_tx_gain_9287_1_1); - } else if (AR_SREV_9280_20(ah)) { - ar9280_20_hw_init_txgain_ini(ah, txgain_type); - } else if (AR_SREV_9285_12_OR_LATER(ah)) { - /* txgain table */ - if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER) { - if (AR_SREV_9285E_20(ah)) { - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9285Modes_XE2_0_high_power); - } else { - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9285Modes_high_power_tx_gain_9285_1_2); - } - } else { - if (AR_SREV_9285E_20(ah)) { - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9285Modes_XE2_0_normal_power); - } else { - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9285Modes_original_tx_gain_9285_1_2); - } - } - } -} - -/* - * Helper for ASPM support. - * - * Disable PLL when in L0s as well as receiver clock when in L1. - * This power saving option must be enabled through the SerDes. - * - * Programming the SerDes must go through the same 288 bit serial shift - * register as the other analog registers. Hence the 9 writes. - */ -static void ar9002_hw_configpcipowersave(struct ath_hw *ah, - bool power_off) -{ - u8 i; - u32 val; - - /* Nothing to do on restore for 11N */ - if (!power_off /* !restore */) { - if (AR_SREV_9280_20_OR_LATER(ah)) { - /* - * AR9280 2.0 or later chips use SerDes values from the - * initvals.h initialized depending on chipset during - * __ath9k_hw_init() - */ - for (i = 0; i < ah->iniPcieSerdes.ia_rows; i++) { - REG_WRITE(ah, INI_RA(&ah->iniPcieSerdes, i, 0), - INI_RA(&ah->iniPcieSerdes, i, 1)); - } - } else { - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fc00); - REG_WRITE(ah, AR_PCIE_SERDES, 0x24924924); - - /* RX shut off when elecidle is asserted */ - REG_WRITE(ah, AR_PCIE_SERDES, 0x28000039); - REG_WRITE(ah, AR_PCIE_SERDES, 0x53160824); - REG_WRITE(ah, AR_PCIE_SERDES, 0xe5980579); - - /* - * Ignore ah->ah_config.pcie_clock_req setting for - * pre-AR9280 11n - */ - REG_WRITE(ah, AR_PCIE_SERDES, 0x001defff); - - REG_WRITE(ah, AR_PCIE_SERDES, 0x1aaabe40); - REG_WRITE(ah, AR_PCIE_SERDES, 0xbe105554); - REG_WRITE(ah, AR_PCIE_SERDES, 0x000e3007); - - /* Load the new settings */ - REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000); - - REGWRITE_BUFFER_FLUSH(ah); - } - - udelay(1000); - } - - if (power_off) { - /* clear bit 19 to disable L1 */ - REG_CLR_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA); - - val = REG_READ(ah, AR_WA); - - /* - * Set PCIe workaround bits - * In AR9280 and AR9285, bit 14 in WA register (disable L1) - * should only be set when device enters D3 and be - * cleared when device comes back to D0. - */ - if (ah->config.pcie_waen) { - if (ah->config.pcie_waen & AR_WA_D3_L1_DISABLE) - val |= AR_WA_D3_L1_DISABLE; - } else { - if (((AR_SREV_9285(ah) || - AR_SREV_9271(ah) || - AR_SREV_9287(ah)) && - (AR9285_WA_DEFAULT & AR_WA_D3_L1_DISABLE)) || - (AR_SREV_9280(ah) && - (AR9280_WA_DEFAULT & AR_WA_D3_L1_DISABLE))) { - val |= AR_WA_D3_L1_DISABLE; - } - } - - if (AR_SREV_9280(ah) || AR_SREV_9285(ah) || AR_SREV_9287(ah)) { - /* - * Disable bit 6 and 7 before entering D3 to - * prevent system hang. - */ - val &= ~(AR_WA_BIT6 | AR_WA_BIT7); - } - - if (AR_SREV_9280(ah)) - val |= AR_WA_BIT22; - - if (AR_SREV_9285E_20(ah)) - val |= AR_WA_BIT23; - - REG_WRITE(ah, AR_WA, val); - } else { - if (ah->config.pcie_waen) { - val = ah->config.pcie_waen; - if (!power_off) - val &= (~AR_WA_D3_L1_DISABLE); - } else { - if (AR_SREV_9285(ah) || - AR_SREV_9271(ah) || - AR_SREV_9287(ah)) { - val = AR9285_WA_DEFAULT; - if (!power_off) - val &= (~AR_WA_D3_L1_DISABLE); - } - else if (AR_SREV_9280(ah)) { - /* - * For AR9280 chips, bit 22 of 0x4004 - * needs to be set. - */ - val = AR9280_WA_DEFAULT; - if (!power_off) - val &= (~AR_WA_D3_L1_DISABLE); - } else { - val = AR_WA_DEFAULT; - } - } - - /* WAR for ASPM system hang */ - if (AR_SREV_9285(ah) || AR_SREV_9287(ah)) - val |= (AR_WA_BIT6 | AR_WA_BIT7); - - if (AR_SREV_9285E_20(ah)) - val |= AR_WA_BIT23; - - REG_WRITE(ah, AR_WA, val); - - /* set bit 19 to allow forcing of pcie core into L1 state */ - REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA); - } -} - -static int ar9002_hw_get_radiorev(struct ath_hw *ah) -{ - u32 val; - int i; - - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_PHY(0x36), 0x00007058); - for (i = 0; i < 8; i++) - REG_WRITE(ah, AR_PHY(0x20), 0x00010000); - - REGWRITE_BUFFER_FLUSH(ah); - - val = (REG_READ(ah, AR_PHY(256)) >> 24) & 0xff; - val = ((val & 0xf0) >> 4) | ((val & 0x0f) << 4); - - return ath9k_hw_reverse_bits(val, 8); -} - -int ar9002_hw_rf_claim(struct ath_hw *ah) -{ - u32 val; - - REG_WRITE(ah, AR_PHY(0), 0x00000007); - - val = ar9002_hw_get_radiorev(ah); - switch (val & AR_RADIO_SREV_MAJOR) { - case 0: - val = AR_RAD5133_SREV_MAJOR; - break; - case AR_RAD5133_SREV_MAJOR: - case AR_RAD5122_SREV_MAJOR: - case AR_RAD2133_SREV_MAJOR: - case AR_RAD2122_SREV_MAJOR: - break; - default: - ath_err(ath9k_hw_common(ah), - "Radio Chip Rev 0x%02X not supported\n", - val & AR_RADIO_SREV_MAJOR); - return -EOPNOTSUPP; - } - - ah->hw_version.analog5GhzRev = val; - - return 0; -} - -void ar9002_hw_enable_async_fifo(struct ath_hw *ah) -{ - if (AR_SREV_9287_13_OR_LATER(ah)) { - REG_SET_BIT(ah, AR_MAC_PCU_ASYNC_FIFO_REG3, - AR_MAC_PCU_ASYNC_FIFO_REG3_DATAPATH_SEL); - REG_SET_BIT(ah, AR_PHY_MODE, AR_PHY_MODE_ASYNCFIFO); - REG_CLR_BIT(ah, AR_MAC_PCU_ASYNC_FIFO_REG3, - AR_MAC_PCU_ASYNC_FIFO_REG3_SOFT_RESET); - REG_SET_BIT(ah, AR_MAC_PCU_ASYNC_FIFO_REG3, - AR_MAC_PCU_ASYNC_FIFO_REG3_SOFT_RESET); - } -} - -/* Sets up the AR5008/AR9001/AR9002 hardware familiy callbacks */ -int ar9002_hw_attach_ops(struct ath_hw *ah) -{ - struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); - struct ath_hw_ops *ops = ath9k_hw_ops(ah); - int ret; - - ret = ar9002_hw_init_mode_regs(ah); - if (ret) - return ret; - - priv_ops->init_mode_gain_regs = ar9002_hw_init_mode_gain_regs; - - ops->config_pci_powersave = ar9002_hw_configpcipowersave; - - ret = ar5008_hw_attach_phy_ops(ah); - if (ret) - return ret; - - if (AR_SREV_9280_20_OR_LATER(ah)) - ar9002_hw_attach_phy_ops(ah); - - ar9002_hw_attach_calib_ops(ah); - ar9002_hw_attach_mac_ops(ah); - return 0; -} - -void ar9002_hw_load_ani_reg(struct ath_hw *ah, struct ath9k_channel *chan) -{ - u32 modesIndex; - int i; - - switch (chan->chanmode) { - case CHANNEL_A: - case CHANNEL_A_HT20: - modesIndex = 1; - break; - case CHANNEL_A_HT40PLUS: - case CHANNEL_A_HT40MINUS: - modesIndex = 2; - break; - case CHANNEL_G: - case CHANNEL_G_HT20: - case CHANNEL_B: - modesIndex = 4; - break; - case CHANNEL_G_HT40PLUS: - case CHANNEL_G_HT40MINUS: - modesIndex = 3; - break; - - default: - return; - } - - ENABLE_REGWRITE_BUFFER(ah); - - for (i = 0; i < ah->iniModes_9271_ANI_reg.ia_rows; i++) { - u32 reg = INI_RA(&ah->iniModes_9271_ANI_reg, i, 0); - u32 val = INI_RA(&ah->iniModes_9271_ANI_reg, i, modesIndex); - u32 val_orig; - - if (reg == AR_PHY_CCK_DETECT) { - val_orig = REG_READ(ah, reg); - val &= AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK; - val_orig &= ~AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK; - - REG_WRITE(ah, reg, val|val_orig); - } else - REG_WRITE(ah, reg, val); - } - - REGWRITE_BUFFER_FLUSH(ah); -} diff --git a/drivers/net/wireless/ath/ath9k/ar9002_initvals.h b/drivers/net/wireless/ath/ath9k/ar9002_initvals.h deleted file mode 100644 index beb6162cf97c..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9002_initvals.h +++ /dev/null @@ -1,3194 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -static const u32 ar9280Modes_9280_2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, - {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, - {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, - {0x000010f0, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, - {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b}, - {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, - {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, - {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, - {0x00009804, 0x00000300, 0x000003c4, 0x000003c4, 0x00000300}, - {0x00009820, 0x02020200, 0x02020200, 0x02020200, 0x02020200}, - {0x00009824, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, - {0x00009828, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001}, - {0x00009834, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x00009838, 0x00000007, 0x00000007, 0x00000007, 0x00000007}, - {0x00009840, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a012e}, - {0x00009844, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, - {0x00009850, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, - {0x00009858, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e}, - {0x0000985c, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, - {0x00009860, 0x00048d18, 0x00048d18, 0x00048d20, 0x00048d20}, - {0x00009864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00}, - {0x00009868, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, - {0x0000986c, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, - {0x00009914, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x00009918, 0x0000000a, 0x00000014, 0x00000268, 0x0000000b}, - {0x00009924, 0xd00a8a0b, 0xd00a8a0b, 0xd00a8a0d, 0xd00a8a0d}, - {0x00009944, 0xffbc1010, 0xffbc1010, 0xffbc1010, 0xffbc1010}, - {0x00009960, 0x00000010, 0x00000010, 0x00000010, 0x00000010}, - {0x0000a960, 0x00000010, 0x00000010, 0x00000010, 0x00000010}, - {0x00009964, 0x00000210, 0x00000210, 0x00000210, 0x00000210}, - {0x0000c968, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, - {0x000099b8, 0x0000001c, 0x0000001c, 0x0000001c, 0x0000001c}, - {0x000099bc, 0x00000a00, 0x00000a00, 0x00000c00, 0x00000c00}, - {0x000099c0, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, - {0x0000a204, 0x00000444, 0x00000444, 0x00000444, 0x00000444}, - {0x0000a20c, 0x00000014, 0x00000014, 0x0001f019, 0x0001f019}, - {0x0000b20c, 0x00000014, 0x00000014, 0x0001f019, 0x0001f019}, - {0x0000a21c, 0x1883800a, 0x1883800a, 0x1883800a, 0x1883800a}, - {0x0000a230, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a23c, 0x13c88000, 0x13c88000, 0x13c88001, 0x13c88000}, - {0x0000a250, 0x001ff000, 0x001ff000, 0x0004a000, 0x0004a000}, - {0x0000a358, 0x7999aa02, 0x7999aa02, 0x7999aa0e, 0x7999aa0e}, - {0x0000a388, 0x0c000000, 0x0c000000, 0x08000000, 0x0c000000}, - {0x0000a3d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00007894, 0x5a508000, 0x5a508000, 0x5a508000, 0x5a508000}, -}; - -static const u32 ar9280Common_9280_2[][2] = { - /* Addr allmodes */ - {0x0000000c, 0x00000000}, - {0x00000030, 0x00020015}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000008}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00000054, 0x0000001f}, - {0x00000800, 0x00000000}, - {0x00000804, 0x00000000}, - {0x00000808, 0x00000000}, - {0x0000080c, 0x00000000}, - {0x00000810, 0x00000000}, - {0x00000814, 0x00000000}, - {0x00000818, 0x00000000}, - {0x0000081c, 0x00000000}, - {0x00000820, 0x00000000}, - {0x00000824, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x00001230, 0x00000000}, - {0x00001270, 0x00000000}, - {0x00001038, 0x00000000}, - {0x00001078, 0x00000000}, - {0x000010b8, 0x00000000}, - {0x000010f8, 0x00000000}, - {0x00001138, 0x00000000}, - {0x00001178, 0x00000000}, - {0x000011b8, 0x00000000}, - {0x000011f8, 0x00000000}, - {0x00001238, 0x00000000}, - {0x00001278, 0x00000000}, - {0x000012b8, 0x00000000}, - {0x000012f8, 0x00000000}, - {0x00001338, 0x00000000}, - {0x00001378, 0x00000000}, - {0x000013b8, 0x00000000}, - {0x000013f8, 0x00000000}, - {0x00001438, 0x00000000}, - {0x00001478, 0x00000000}, - {0x000014b8, 0x00000000}, - {0x000014f8, 0x00000000}, - {0x00001538, 0x00000000}, - {0x00001578, 0x00000000}, - {0x000015b8, 0x00000000}, - {0x000015f8, 0x00000000}, - {0x00001638, 0x00000000}, - {0x00001678, 0x00000000}, - {0x000016b8, 0x00000000}, - {0x000016f8, 0x00000000}, - {0x00001738, 0x00000000}, - {0x00001778, 0x00000000}, - {0x000017b8, 0x00000000}, - {0x000017f8, 0x00000000}, - {0x0000103c, 0x00000000}, - {0x0000107c, 0x00000000}, - {0x000010bc, 0x00000000}, - {0x000010fc, 0x00000000}, - {0x0000113c, 0x00000000}, - {0x0000117c, 0x00000000}, - {0x000011bc, 0x00000000}, - {0x000011fc, 0x00000000}, - {0x0000123c, 0x00000000}, - {0x0000127c, 0x00000000}, - {0x000012bc, 0x00000000}, - {0x000012fc, 0x00000000}, - {0x0000133c, 0x00000000}, - {0x0000137c, 0x00000000}, - {0x000013bc, 0x00000000}, - {0x000013fc, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00004030, 0x00000002}, - {0x0000403c, 0x00000002}, - {0x00004024, 0x0000001f}, - {0x00004060, 0x00000000}, - {0x00004064, 0x00000000}, - {0x00007010, 0x00000033}, - {0x00007034, 0x00000002}, - {0x00007038, 0x000004c2}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008018, 0x00000700}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00000000}, - {0x00008048, 0x40000000}, - {0x00008054, 0x00000000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x00008070, 0x00000000}, - {0x000080c0, 0x2a80001a}, - {0x000080c4, 0x05dc01e0}, - {0x000080c8, 0x1f402710}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00001e00}, - {0x000080d4, 0x00000000}, - {0x000080d8, 0x00400000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x003f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080f8, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00020000}, - {0x00008104, 0x00000001}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000168}, - {0x00008118, 0x000100aa}, - {0x0000811c, 0x00003210}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x00000000}, - {0x00008144, 0xffffffff}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x00008170, 0x32143320}, - {0x00008174, 0xfaa4fa50}, - {0x00008178, 0x00000100}, - {0x0000817c, 0x00000000}, - {0x000081c0, 0x00000000}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008200, 0x00000000}, - {0x00008204, 0x00000000}, - {0x00008208, 0x00000000}, - {0x0000820c, 0x00000000}, - {0x00008210, 0x00000000}, - {0x00008214, 0x00000000}, - {0x00008218, 0x00000000}, - {0x0000821c, 0x00000000}, - {0x00008220, 0x00000000}, - {0x00008224, 0x00000000}, - {0x00008228, 0x00000000}, - {0x0000822c, 0x00000000}, - {0x00008230, 0x00000000}, - {0x00008234, 0x00000000}, - {0x00008238, 0x00000000}, - {0x0000823c, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008244, 0x0010f400}, - {0x00008248, 0x00000100}, - {0x0000824c, 0x0001e800}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x400000ff}, - {0x00008260, 0x00080922}, - {0x00008264, 0x88a00010}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000000}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x00000000}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x0000829c, 0x00000000}, - {0x00008300, 0x00000040}, - {0x00008314, 0x00000000}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x00000007}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000e00}, - {0x00008338, 0x00ff0000}, - {0x0000833c, 0x00000000}, - {0x00008340, 0x000107ff}, - {0x00008344, 0x00481043}, - {0x00009808, 0x00000000}, - {0x0000980c, 0xafa68e30}, - {0x00009810, 0xfd14e000}, - {0x00009814, 0x9c0a9f6b}, - {0x0000981c, 0x00000000}, - {0x0000982c, 0x0000a000}, - {0x00009830, 0x00000000}, - {0x0000983c, 0x00200400}, - {0x0000984c, 0x0040233c}, - {0x0000a84c, 0x0040233c}, - {0x00009854, 0x00000044}, - {0x00009900, 0x00000000}, - {0x00009904, 0x00000000}, - {0x00009908, 0x00000000}, - {0x0000990c, 0x00000000}, - {0x00009910, 0x01002310}, - {0x0000991c, 0x10000fff}, - {0x00009920, 0x04900000}, - {0x0000a920, 0x04900000}, - {0x00009928, 0x00000001}, - {0x0000992c, 0x00000004}, - {0x00009934, 0x1e1f2022}, - {0x00009938, 0x0a0b0c0d}, - {0x0000993c, 0x00000000}, - {0x00009948, 0x9280c00a}, - {0x0000994c, 0x00020028}, - {0x00009954, 0x5f3ca3de}, - {0x00009958, 0x2108ecff}, - {0x00009940, 0x14750604}, - {0x0000c95c, 0x004b6a8e}, - {0x00009970, 0x190fb514}, - {0x00009974, 0x00000000}, - {0x00009978, 0x00000001}, - {0x0000997c, 0x00000000}, - {0x00009980, 0x00000000}, - {0x00009984, 0x00000000}, - {0x00009988, 0x00000000}, - {0x0000998c, 0x00000000}, - {0x00009990, 0x00000000}, - {0x00009994, 0x00000000}, - {0x00009998, 0x00000000}, - {0x0000999c, 0x00000000}, - {0x000099a0, 0x00000000}, - {0x000099a4, 0x00000001}, - {0x000099a8, 0x201fff00}, - {0x000099ac, 0x006f0000}, - {0x000099b0, 0x03051000}, - {0x000099b4, 0x00000820}, - {0x000099c4, 0x06336f77}, - {0x000099c8, 0x6af6532f}, - {0x000099cc, 0x08f186c8}, - {0x000099d0, 0x00046384}, - {0x000099d4, 0x00000000}, - {0x000099d8, 0x00000000}, - {0x000099dc, 0x00000000}, - {0x000099e0, 0x00000000}, - {0x000099e4, 0xaaaaaaaa}, - {0x000099e8, 0x3c466478}, - {0x000099ec, 0x0cc80caa}, - {0x000099f0, 0x00000000}, - {0x000099fc, 0x00001042}, - {0x0000a208, 0x803e4788}, - {0x0000a210, 0x4080a333}, - {0x0000a214, 0x40206c10}, - {0x0000a218, 0x009c4060}, - {0x0000a220, 0x01834061}, - {0x0000a224, 0x00000400}, - {0x0000a228, 0x000003b5}, - {0x0000a22c, 0x233f7180}, - {0x0000a234, 0x20202020}, - {0x0000a238, 0x20202020}, - {0x0000a240, 0x38490a20}, - {0x0000a244, 0x00007bb6}, - {0x0000a248, 0x0fff3ffc}, - {0x0000a24c, 0x00000000}, - {0x0000a254, 0x00000000}, - {0x0000a258, 0x0cdbd380}, - {0x0000a25c, 0x0f0f0f01}, - {0x0000a260, 0xdfa91f01}, - {0x0000a268, 0x00000000}, - {0x0000a26c, 0x0e79e5c6}, - {0x0000b26c, 0x0e79e5c6}, - {0x0000d270, 0x00820820}, - {0x0000a278, 0x1ce739ce}, - {0x0000d35c, 0x07ffffef}, - {0x0000d360, 0x0fffffe7}, - {0x0000d364, 0x17ffffe5}, - {0x0000d368, 0x1fffffe4}, - {0x0000d36c, 0x37ffffe3}, - {0x0000d370, 0x3fffffe3}, - {0x0000d374, 0x57ffffe3}, - {0x0000d378, 0x5fffffe2}, - {0x0000d37c, 0x7fffffe2}, - {0x0000d380, 0x7f3c7bba}, - {0x0000d384, 0xf3307ff0}, - {0x0000a38c, 0x20202020}, - {0x0000a390, 0x20202020}, - {0x0000a394, 0x1ce739ce}, - {0x0000a398, 0x000001ce}, - {0x0000a39c, 0x00000001}, - {0x0000a3a0, 0x00000000}, - {0x0000a3a4, 0x00000000}, - {0x0000a3a8, 0x00000000}, - {0x0000a3ac, 0x00000000}, - {0x0000a3b0, 0x00000000}, - {0x0000a3b4, 0x00000000}, - {0x0000a3b8, 0x00000000}, - {0x0000a3bc, 0x00000000}, - {0x0000a3c0, 0x00000000}, - {0x0000a3c4, 0x00000000}, - {0x0000a3c8, 0x00000246}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3dc, 0x1ce739ce}, - {0x0000a3e0, 0x000001ce}, - {0x0000a3e4, 0x00000000}, - {0x0000a3e8, 0x18c43433}, - {0x00007800, 0x00040000}, - {0x00007804, 0xdb005012}, - {0x00007808, 0x04924914}, - {0x0000780c, 0x21084210}, - {0x00007810, 0x6d801300}, - {0x00007818, 0x07e41000}, - {0x00007824, 0x00040000}, - {0x00007828, 0xdb005012}, - {0x0000782c, 0x04924914}, - {0x00007830, 0x21084210}, - {0x00007834, 0x6d801300}, - {0x0000783c, 0x07e40000}, - {0x00007848, 0x00100000}, - {0x0000784c, 0x773f0567}, - {0x00007850, 0x54214514}, - {0x00007854, 0x12035828}, - {0x00007858, 0x9259269a}, - {0x00007860, 0x52802000}, - {0x00007864, 0x0a8e370e}, - {0x00007868, 0xc0102850}, - {0x0000786c, 0x812d4000}, - {0x00007870, 0x807ec400}, - {0x00007874, 0x001b6db0}, - {0x00007878, 0x00376b63}, - {0x0000787c, 0x06db6db6}, - {0x00007880, 0x006d8000}, - {0x00007884, 0xffeffffe}, - {0x00007888, 0xffeffffe}, - {0x0000788c, 0x00010000}, - {0x00007890, 0x02060aeb}, - {0x00007898, 0x2a850160}, -}; - -static const u32 ar9280Modes_fast_clock_9280_2[][3] = { - /* Addr 5G_HT20 5G_HT40 */ - {0x00001030, 0x00000268, 0x000004d0}, - {0x00001070, 0x0000018c, 0x00000318}, - {0x000010b0, 0x00000fd0, 0x00001fa0}, - {0x00008014, 0x044c044c, 0x08980898}, - {0x0000801c, 0x148ec02b, 0x148ec057}, - {0x00008318, 0x000044c0, 0x00008980}, - {0x00009820, 0x02020200, 0x02020200}, - {0x00009824, 0x01000f0f, 0x01000f0f}, - {0x00009828, 0x0b020001, 0x0b020001}, - {0x00009834, 0x00000f0f, 0x00000f0f}, - {0x00009844, 0x03721821, 0x03721821}, - {0x00009914, 0x00000898, 0x00001130}, - {0x00009918, 0x0000000b, 0x00000016}, -}; - -static const u32 ar9280Modes_backoff_23db_rxgain_9280_2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009a00, 0x00008184, 0x00008184, 0x00000290, 0x00000290}, - {0x00009a04, 0x00008188, 0x00008188, 0x00000300, 0x00000300}, - {0x00009a08, 0x0000818c, 0x0000818c, 0x00000304, 0x00000304}, - {0x00009a0c, 0x00008190, 0x00008190, 0x00000308, 0x00000308}, - {0x00009a10, 0x00008194, 0x00008194, 0x0000030c, 0x0000030c}, - {0x00009a14, 0x00008200, 0x00008200, 0x00008000, 0x00008000}, - {0x00009a18, 0x00008204, 0x00008204, 0x00008004, 0x00008004}, - {0x00009a1c, 0x00008208, 0x00008208, 0x00008008, 0x00008008}, - {0x00009a20, 0x0000820c, 0x0000820c, 0x0000800c, 0x0000800c}, - {0x00009a24, 0x00008210, 0x00008210, 0x00008080, 0x00008080}, - {0x00009a28, 0x00008214, 0x00008214, 0x00008084, 0x00008084}, - {0x00009a2c, 0x00008280, 0x00008280, 0x00008088, 0x00008088}, - {0x00009a30, 0x00008284, 0x00008284, 0x0000808c, 0x0000808c}, - {0x00009a34, 0x00008288, 0x00008288, 0x00008100, 0x00008100}, - {0x00009a38, 0x0000828c, 0x0000828c, 0x00008104, 0x00008104}, - {0x00009a3c, 0x00008290, 0x00008290, 0x00008108, 0x00008108}, - {0x00009a40, 0x00008300, 0x00008300, 0x0000810c, 0x0000810c}, - {0x00009a44, 0x00008304, 0x00008304, 0x00008110, 0x00008110}, - {0x00009a48, 0x00008308, 0x00008308, 0x00008114, 0x00008114}, - {0x00009a4c, 0x0000830c, 0x0000830c, 0x00008180, 0x00008180}, - {0x00009a50, 0x00008310, 0x00008310, 0x00008184, 0x00008184}, - {0x00009a54, 0x00008314, 0x00008314, 0x00008188, 0x00008188}, - {0x00009a58, 0x00008380, 0x00008380, 0x0000818c, 0x0000818c}, - {0x00009a5c, 0x00008384, 0x00008384, 0x00008190, 0x00008190}, - {0x00009a60, 0x00008388, 0x00008388, 0x00008194, 0x00008194}, - {0x00009a64, 0x0000838c, 0x0000838c, 0x000081a0, 0x000081a0}, - {0x00009a68, 0x00008390, 0x00008390, 0x0000820c, 0x0000820c}, - {0x00009a6c, 0x00008394, 0x00008394, 0x000081a8, 0x000081a8}, - {0x00009a70, 0x0000a380, 0x0000a380, 0x00008284, 0x00008284}, - {0x00009a74, 0x0000a384, 0x0000a384, 0x00008288, 0x00008288}, - {0x00009a78, 0x0000a388, 0x0000a388, 0x00008224, 0x00008224}, - {0x00009a7c, 0x0000a38c, 0x0000a38c, 0x00008290, 0x00008290}, - {0x00009a80, 0x0000a390, 0x0000a390, 0x00008300, 0x00008300}, - {0x00009a84, 0x0000a394, 0x0000a394, 0x00008304, 0x00008304}, - {0x00009a88, 0x0000a780, 0x0000a780, 0x00008308, 0x00008308}, - {0x00009a8c, 0x0000a784, 0x0000a784, 0x0000830c, 0x0000830c}, - {0x00009a90, 0x0000a788, 0x0000a788, 0x00008380, 0x00008380}, - {0x00009a94, 0x0000a78c, 0x0000a78c, 0x00008384, 0x00008384}, - {0x00009a98, 0x0000a790, 0x0000a790, 0x00008700, 0x00008700}, - {0x00009a9c, 0x0000a794, 0x0000a794, 0x00008704, 0x00008704}, - {0x00009aa0, 0x0000ab84, 0x0000ab84, 0x00008708, 0x00008708}, - {0x00009aa4, 0x0000ab88, 0x0000ab88, 0x0000870c, 0x0000870c}, - {0x00009aa8, 0x0000ab8c, 0x0000ab8c, 0x00008780, 0x00008780}, - {0x00009aac, 0x0000ab90, 0x0000ab90, 0x00008784, 0x00008784}, - {0x00009ab0, 0x0000ab94, 0x0000ab94, 0x00008b00, 0x00008b00}, - {0x00009ab4, 0x0000af80, 0x0000af80, 0x00008b04, 0x00008b04}, - {0x00009ab8, 0x0000af84, 0x0000af84, 0x00008b08, 0x00008b08}, - {0x00009abc, 0x0000af88, 0x0000af88, 0x00008b0c, 0x00008b0c}, - {0x00009ac0, 0x0000af8c, 0x0000af8c, 0x00008b10, 0x00008b10}, - {0x00009ac4, 0x0000af90, 0x0000af90, 0x00008b80, 0x00008b80}, - {0x00009ac8, 0x0000af94, 0x0000af94, 0x00008b84, 0x00008b84}, - {0x00009acc, 0x0000b380, 0x0000b380, 0x00008b88, 0x00008b88}, - {0x00009ad0, 0x0000b384, 0x0000b384, 0x00008b8c, 0x00008b8c}, - {0x00009ad4, 0x0000b388, 0x0000b388, 0x00008b90, 0x00008b90}, - {0x00009ad8, 0x0000b38c, 0x0000b38c, 0x00008b94, 0x00008b94}, - {0x00009adc, 0x0000b390, 0x0000b390, 0x00008b98, 0x00008b98}, - {0x00009ae0, 0x0000b394, 0x0000b394, 0x00008ba4, 0x00008ba4}, - {0x00009ae4, 0x0000b398, 0x0000b398, 0x00008ba8, 0x00008ba8}, - {0x00009ae8, 0x0000b780, 0x0000b780, 0x00008bac, 0x00008bac}, - {0x00009aec, 0x0000b784, 0x0000b784, 0x00008bb0, 0x00008bb0}, - {0x00009af0, 0x0000b788, 0x0000b788, 0x00008bb4, 0x00008bb4}, - {0x00009af4, 0x0000b78c, 0x0000b78c, 0x00008ba1, 0x00008ba1}, - {0x00009af8, 0x0000b790, 0x0000b790, 0x00008ba5, 0x00008ba5}, - {0x00009afc, 0x0000b794, 0x0000b794, 0x00008ba9, 0x00008ba9}, - {0x00009b00, 0x0000b798, 0x0000b798, 0x00008bad, 0x00008bad}, - {0x00009b04, 0x0000d784, 0x0000d784, 0x00008bb1, 0x00008bb1}, - {0x00009b08, 0x0000d788, 0x0000d788, 0x00008bb5, 0x00008bb5}, - {0x00009b0c, 0x0000d78c, 0x0000d78c, 0x00008ba2, 0x00008ba2}, - {0x00009b10, 0x0000d790, 0x0000d790, 0x00008ba6, 0x00008ba6}, - {0x00009b14, 0x0000f780, 0x0000f780, 0x00008baa, 0x00008baa}, - {0x00009b18, 0x0000f784, 0x0000f784, 0x00008bae, 0x00008bae}, - {0x00009b1c, 0x0000f788, 0x0000f788, 0x00008bb2, 0x00008bb2}, - {0x00009b20, 0x0000f78c, 0x0000f78c, 0x00008bb6, 0x00008bb6}, - {0x00009b24, 0x0000f790, 0x0000f790, 0x00008ba3, 0x00008ba3}, - {0x00009b28, 0x0000f794, 0x0000f794, 0x00008ba7, 0x00008ba7}, - {0x00009b2c, 0x0000f7a4, 0x0000f7a4, 0x00008bab, 0x00008bab}, - {0x00009b30, 0x0000f7a8, 0x0000f7a8, 0x00008baf, 0x00008baf}, - {0x00009b34, 0x0000f7ac, 0x0000f7ac, 0x00008bb3, 0x00008bb3}, - {0x00009b38, 0x0000f7b0, 0x0000f7b0, 0x00008bb7, 0x00008bb7}, - {0x00009b3c, 0x0000f7b4, 0x0000f7b4, 0x00008bc3, 0x00008bc3}, - {0x00009b40, 0x0000f7a1, 0x0000f7a1, 0x00008bc7, 0x00008bc7}, - {0x00009b44, 0x0000f7a5, 0x0000f7a5, 0x00008bcb, 0x00008bcb}, - {0x00009b48, 0x0000f7a9, 0x0000f7a9, 0x00008bcf, 0x00008bcf}, - {0x00009b4c, 0x0000f7ad, 0x0000f7ad, 0x00008bd3, 0x00008bd3}, - {0x00009b50, 0x0000f7b1, 0x0000f7b1, 0x00008bd7, 0x00008bd7}, - {0x00009b54, 0x0000f7b5, 0x0000f7b5, 0x00008bdb, 0x00008bdb}, - {0x00009b58, 0x0000f7c5, 0x0000f7c5, 0x00008bdb, 0x00008bdb}, - {0x00009b5c, 0x0000f7c9, 0x0000f7c9, 0x00008bdb, 0x00008bdb}, - {0x00009b60, 0x0000f7cd, 0x0000f7cd, 0x00008bdb, 0x00008bdb}, - {0x00009b64, 0x0000f7d1, 0x0000f7d1, 0x00008bdb, 0x00008bdb}, - {0x00009b68, 0x0000f7d5, 0x0000f7d5, 0x00008bdb, 0x00008bdb}, - {0x00009b6c, 0x0000f7c2, 0x0000f7c2, 0x00008bdb, 0x00008bdb}, - {0x00009b70, 0x0000f7c6, 0x0000f7c6, 0x00008bdb, 0x00008bdb}, - {0x00009b74, 0x0000f7ca, 0x0000f7ca, 0x00008bdb, 0x00008bdb}, - {0x00009b78, 0x0000f7ce, 0x0000f7ce, 0x00008bdb, 0x00008bdb}, - {0x00009b7c, 0x0000f7d2, 0x0000f7d2, 0x00008bdb, 0x00008bdb}, - {0x00009b80, 0x0000f7d6, 0x0000f7d6, 0x00008bdb, 0x00008bdb}, - {0x00009b84, 0x0000f7c3, 0x0000f7c3, 0x00008bdb, 0x00008bdb}, - {0x00009b88, 0x0000f7c7, 0x0000f7c7, 0x00008bdb, 0x00008bdb}, - {0x00009b8c, 0x0000f7cb, 0x0000f7cb, 0x00008bdb, 0x00008bdb}, - {0x00009b90, 0x0000f7d3, 0x0000f7d3, 0x00008bdb, 0x00008bdb}, - {0x00009b94, 0x0000f7d7, 0x0000f7d7, 0x00008bdb, 0x00008bdb}, - {0x00009b98, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009b9c, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009ba0, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009ba4, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009ba8, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bac, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bb0, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bb4, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bb8, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bbc, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bc0, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bc4, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bc8, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bcc, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bd0, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bd4, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bd8, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bdc, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009be0, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009be4, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009be8, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bec, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bf0, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bf4, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bf8, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009bfc, 0x0000f7db, 0x0000f7db, 0x00008bdb, 0x00008bdb}, - {0x00009848, 0x00001066, 0x00001066, 0x00001055, 0x00001055}, - {0x0000a848, 0x00001066, 0x00001066, 0x00001055, 0x00001055}, -}; - -static const u32 ar9280Modes_original_rxgain_9280_2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009a00, 0x00008184, 0x00008184, 0x00008000, 0x00008000}, - {0x00009a04, 0x00008188, 0x00008188, 0x00008000, 0x00008000}, - {0x00009a08, 0x0000818c, 0x0000818c, 0x00008000, 0x00008000}, - {0x00009a0c, 0x00008190, 0x00008190, 0x00008000, 0x00008000}, - {0x00009a10, 0x00008194, 0x00008194, 0x00008000, 0x00008000}, - {0x00009a14, 0x00008200, 0x00008200, 0x00008000, 0x00008000}, - {0x00009a18, 0x00008204, 0x00008204, 0x00008004, 0x00008004}, - {0x00009a1c, 0x00008208, 0x00008208, 0x00008008, 0x00008008}, - {0x00009a20, 0x0000820c, 0x0000820c, 0x0000800c, 0x0000800c}, - {0x00009a24, 0x00008210, 0x00008210, 0x00008080, 0x00008080}, - {0x00009a28, 0x00008214, 0x00008214, 0x00008084, 0x00008084}, - {0x00009a2c, 0x00008280, 0x00008280, 0x00008088, 0x00008088}, - {0x00009a30, 0x00008284, 0x00008284, 0x0000808c, 0x0000808c}, - {0x00009a34, 0x00008288, 0x00008288, 0x00008100, 0x00008100}, - {0x00009a38, 0x0000828c, 0x0000828c, 0x00008104, 0x00008104}, - {0x00009a3c, 0x00008290, 0x00008290, 0x00008108, 0x00008108}, - {0x00009a40, 0x00008300, 0x00008300, 0x0000810c, 0x0000810c}, - {0x00009a44, 0x00008304, 0x00008304, 0x00008110, 0x00008110}, - {0x00009a48, 0x00008308, 0x00008308, 0x00008114, 0x00008114}, - {0x00009a4c, 0x0000830c, 0x0000830c, 0x00008180, 0x00008180}, - {0x00009a50, 0x00008310, 0x00008310, 0x00008184, 0x00008184}, - {0x00009a54, 0x00008314, 0x00008314, 0x00008188, 0x00008188}, - {0x00009a58, 0x00008380, 0x00008380, 0x0000818c, 0x0000818c}, - {0x00009a5c, 0x00008384, 0x00008384, 0x00008190, 0x00008190}, - {0x00009a60, 0x00008388, 0x00008388, 0x00008194, 0x00008194}, - {0x00009a64, 0x0000838c, 0x0000838c, 0x000081a0, 0x000081a0}, - {0x00009a68, 0x00008390, 0x00008390, 0x0000820c, 0x0000820c}, - {0x00009a6c, 0x00008394, 0x00008394, 0x000081a8, 0x000081a8}, - {0x00009a70, 0x0000a380, 0x0000a380, 0x00008284, 0x00008284}, - {0x00009a74, 0x0000a384, 0x0000a384, 0x00008288, 0x00008288}, - {0x00009a78, 0x0000a388, 0x0000a388, 0x00008224, 0x00008224}, - {0x00009a7c, 0x0000a38c, 0x0000a38c, 0x00008290, 0x00008290}, - {0x00009a80, 0x0000a390, 0x0000a390, 0x00008300, 0x00008300}, - {0x00009a84, 0x0000a394, 0x0000a394, 0x00008304, 0x00008304}, - {0x00009a88, 0x0000a780, 0x0000a780, 0x00008308, 0x00008308}, - {0x00009a8c, 0x0000a784, 0x0000a784, 0x0000830c, 0x0000830c}, - {0x00009a90, 0x0000a788, 0x0000a788, 0x00008380, 0x00008380}, - {0x00009a94, 0x0000a78c, 0x0000a78c, 0x00008384, 0x00008384}, - {0x00009a98, 0x0000a790, 0x0000a790, 0x00008700, 0x00008700}, - {0x00009a9c, 0x0000a794, 0x0000a794, 0x00008704, 0x00008704}, - {0x00009aa0, 0x0000ab84, 0x0000ab84, 0x00008708, 0x00008708}, - {0x00009aa4, 0x0000ab88, 0x0000ab88, 0x0000870c, 0x0000870c}, - {0x00009aa8, 0x0000ab8c, 0x0000ab8c, 0x00008780, 0x00008780}, - {0x00009aac, 0x0000ab90, 0x0000ab90, 0x00008784, 0x00008784}, - {0x00009ab0, 0x0000ab94, 0x0000ab94, 0x00008b00, 0x00008b00}, - {0x00009ab4, 0x0000af80, 0x0000af80, 0x00008b04, 0x00008b04}, - {0x00009ab8, 0x0000af84, 0x0000af84, 0x00008b08, 0x00008b08}, - {0x00009abc, 0x0000af88, 0x0000af88, 0x00008b0c, 0x00008b0c}, - {0x00009ac0, 0x0000af8c, 0x0000af8c, 0x00008b80, 0x00008b80}, - {0x00009ac4, 0x0000af90, 0x0000af90, 0x00008b84, 0x00008b84}, - {0x00009ac8, 0x0000af94, 0x0000af94, 0x00008b88, 0x00008b88}, - {0x00009acc, 0x0000b380, 0x0000b380, 0x00008b8c, 0x00008b8c}, - {0x00009ad0, 0x0000b384, 0x0000b384, 0x00008b90, 0x00008b90}, - {0x00009ad4, 0x0000b388, 0x0000b388, 0x00008f80, 0x00008f80}, - {0x00009ad8, 0x0000b38c, 0x0000b38c, 0x00008f84, 0x00008f84}, - {0x00009adc, 0x0000b390, 0x0000b390, 0x00008f88, 0x00008f88}, - {0x00009ae0, 0x0000b394, 0x0000b394, 0x00008f8c, 0x00008f8c}, - {0x00009ae4, 0x0000b398, 0x0000b398, 0x00008f90, 0x00008f90}, - {0x00009ae8, 0x0000b780, 0x0000b780, 0x0000930c, 0x0000930c}, - {0x00009aec, 0x0000b784, 0x0000b784, 0x00009310, 0x00009310}, - {0x00009af0, 0x0000b788, 0x0000b788, 0x00009384, 0x00009384}, - {0x00009af4, 0x0000b78c, 0x0000b78c, 0x00009388, 0x00009388}, - {0x00009af8, 0x0000b790, 0x0000b790, 0x00009324, 0x00009324}, - {0x00009afc, 0x0000b794, 0x0000b794, 0x00009704, 0x00009704}, - {0x00009b00, 0x0000b798, 0x0000b798, 0x000096a4, 0x000096a4}, - {0x00009b04, 0x0000d784, 0x0000d784, 0x000096a8, 0x000096a8}, - {0x00009b08, 0x0000d788, 0x0000d788, 0x00009710, 0x00009710}, - {0x00009b0c, 0x0000d78c, 0x0000d78c, 0x00009714, 0x00009714}, - {0x00009b10, 0x0000d790, 0x0000d790, 0x00009720, 0x00009720}, - {0x00009b14, 0x0000f780, 0x0000f780, 0x00009724, 0x00009724}, - {0x00009b18, 0x0000f784, 0x0000f784, 0x00009728, 0x00009728}, - {0x00009b1c, 0x0000f788, 0x0000f788, 0x0000972c, 0x0000972c}, - {0x00009b20, 0x0000f78c, 0x0000f78c, 0x000097a0, 0x000097a0}, - {0x00009b24, 0x0000f790, 0x0000f790, 0x000097a4, 0x000097a4}, - {0x00009b28, 0x0000f794, 0x0000f794, 0x000097a8, 0x000097a8}, - {0x00009b2c, 0x0000f7a4, 0x0000f7a4, 0x000097b0, 0x000097b0}, - {0x00009b30, 0x0000f7a8, 0x0000f7a8, 0x000097b4, 0x000097b4}, - {0x00009b34, 0x0000f7ac, 0x0000f7ac, 0x000097b8, 0x000097b8}, - {0x00009b38, 0x0000f7b0, 0x0000f7b0, 0x000097a5, 0x000097a5}, - {0x00009b3c, 0x0000f7b4, 0x0000f7b4, 0x000097a9, 0x000097a9}, - {0x00009b40, 0x0000f7a1, 0x0000f7a1, 0x000097ad, 0x000097ad}, - {0x00009b44, 0x0000f7a5, 0x0000f7a5, 0x000097b1, 0x000097b1}, - {0x00009b48, 0x0000f7a9, 0x0000f7a9, 0x000097b5, 0x000097b5}, - {0x00009b4c, 0x0000f7ad, 0x0000f7ad, 0x000097b9, 0x000097b9}, - {0x00009b50, 0x0000f7b1, 0x0000f7b1, 0x000097c5, 0x000097c5}, - {0x00009b54, 0x0000f7b5, 0x0000f7b5, 0x000097c9, 0x000097c9}, - {0x00009b58, 0x0000f7c5, 0x0000f7c5, 0x000097d1, 0x000097d1}, - {0x00009b5c, 0x0000f7c9, 0x0000f7c9, 0x000097d5, 0x000097d5}, - {0x00009b60, 0x0000f7cd, 0x0000f7cd, 0x000097d9, 0x000097d9}, - {0x00009b64, 0x0000f7d1, 0x0000f7d1, 0x000097c6, 0x000097c6}, - {0x00009b68, 0x0000f7d5, 0x0000f7d5, 0x000097ca, 0x000097ca}, - {0x00009b6c, 0x0000f7c2, 0x0000f7c2, 0x000097ce, 0x000097ce}, - {0x00009b70, 0x0000f7c6, 0x0000f7c6, 0x000097d2, 0x000097d2}, - {0x00009b74, 0x0000f7ca, 0x0000f7ca, 0x000097d6, 0x000097d6}, - {0x00009b78, 0x0000f7ce, 0x0000f7ce, 0x000097c3, 0x000097c3}, - {0x00009b7c, 0x0000f7d2, 0x0000f7d2, 0x000097c7, 0x000097c7}, - {0x00009b80, 0x0000f7d6, 0x0000f7d6, 0x000097cb, 0x000097cb}, - {0x00009b84, 0x0000f7c3, 0x0000f7c3, 0x000097cf, 0x000097cf}, - {0x00009b88, 0x0000f7c7, 0x0000f7c7, 0x000097d7, 0x000097d7}, - {0x00009b8c, 0x0000f7cb, 0x0000f7cb, 0x000097db, 0x000097db}, - {0x00009b90, 0x0000f7d3, 0x0000f7d3, 0x000097db, 0x000097db}, - {0x00009b94, 0x0000f7d7, 0x0000f7d7, 0x000097db, 0x000097db}, - {0x00009b98, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009b9c, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009ba0, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009ba4, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009ba8, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bac, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bb0, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bb4, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bb8, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bbc, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bc0, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bc4, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bc8, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bcc, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bd0, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bd4, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bd8, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bdc, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009be0, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009be4, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009be8, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bec, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bf0, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bf4, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bf8, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009bfc, 0x0000f7db, 0x0000f7db, 0x000097db, 0x000097db}, - {0x00009848, 0x00001066, 0x00001066, 0x00001063, 0x00001063}, - {0x0000a848, 0x00001066, 0x00001066, 0x00001063, 0x00001063}, -}; - -static const u32 ar9280Modes_backoff_13db_rxgain_9280_2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009a00, 0x00008184, 0x00008184, 0x00000290, 0x00000290}, - {0x00009a04, 0x00008188, 0x00008188, 0x00000300, 0x00000300}, - {0x00009a08, 0x0000818c, 0x0000818c, 0x00000304, 0x00000304}, - {0x00009a0c, 0x00008190, 0x00008190, 0x00000308, 0x00000308}, - {0x00009a10, 0x00008194, 0x00008194, 0x0000030c, 0x0000030c}, - {0x00009a14, 0x00008200, 0x00008200, 0x00008000, 0x00008000}, - {0x00009a18, 0x00008204, 0x00008204, 0x00008004, 0x00008004}, - {0x00009a1c, 0x00008208, 0x00008208, 0x00008008, 0x00008008}, - {0x00009a20, 0x0000820c, 0x0000820c, 0x0000800c, 0x0000800c}, - {0x00009a24, 0x00008210, 0x00008210, 0x00008080, 0x00008080}, - {0x00009a28, 0x00008214, 0x00008214, 0x00008084, 0x00008084}, - {0x00009a2c, 0x00008280, 0x00008280, 0x00008088, 0x00008088}, - {0x00009a30, 0x00008284, 0x00008284, 0x0000808c, 0x0000808c}, - {0x00009a34, 0x00008288, 0x00008288, 0x00008100, 0x00008100}, - {0x00009a38, 0x0000828c, 0x0000828c, 0x00008104, 0x00008104}, - {0x00009a3c, 0x00008290, 0x00008290, 0x00008108, 0x00008108}, - {0x00009a40, 0x00008300, 0x00008300, 0x0000810c, 0x0000810c}, - {0x00009a44, 0x00008304, 0x00008304, 0x00008110, 0x00008110}, - {0x00009a48, 0x00008308, 0x00008308, 0x00008114, 0x00008114}, - {0x00009a4c, 0x0000830c, 0x0000830c, 0x00008180, 0x00008180}, - {0x00009a50, 0x00008310, 0x00008310, 0x00008184, 0x00008184}, - {0x00009a54, 0x00008314, 0x00008314, 0x00008188, 0x00008188}, - {0x00009a58, 0x00008380, 0x00008380, 0x0000818c, 0x0000818c}, - {0x00009a5c, 0x00008384, 0x00008384, 0x00008190, 0x00008190}, - {0x00009a60, 0x00008388, 0x00008388, 0x00008194, 0x00008194}, - {0x00009a64, 0x0000838c, 0x0000838c, 0x000081a0, 0x000081a0}, - {0x00009a68, 0x00008390, 0x00008390, 0x0000820c, 0x0000820c}, - {0x00009a6c, 0x00008394, 0x00008394, 0x000081a8, 0x000081a8}, - {0x00009a70, 0x0000a380, 0x0000a380, 0x00008284, 0x00008284}, - {0x00009a74, 0x0000a384, 0x0000a384, 0x00008288, 0x00008288}, - {0x00009a78, 0x0000a388, 0x0000a388, 0x00008224, 0x00008224}, - {0x00009a7c, 0x0000a38c, 0x0000a38c, 0x00008290, 0x00008290}, - {0x00009a80, 0x0000a390, 0x0000a390, 0x00008300, 0x00008300}, - {0x00009a84, 0x0000a394, 0x0000a394, 0x00008304, 0x00008304}, - {0x00009a88, 0x0000a780, 0x0000a780, 0x00008308, 0x00008308}, - {0x00009a8c, 0x0000a784, 0x0000a784, 0x0000830c, 0x0000830c}, - {0x00009a90, 0x0000a788, 0x0000a788, 0x00008380, 0x00008380}, - {0x00009a94, 0x0000a78c, 0x0000a78c, 0x00008384, 0x00008384}, - {0x00009a98, 0x0000a790, 0x0000a790, 0x00008700, 0x00008700}, - {0x00009a9c, 0x0000a794, 0x0000a794, 0x00008704, 0x00008704}, - {0x00009aa0, 0x0000ab84, 0x0000ab84, 0x00008708, 0x00008708}, - {0x00009aa4, 0x0000ab88, 0x0000ab88, 0x0000870c, 0x0000870c}, - {0x00009aa8, 0x0000ab8c, 0x0000ab8c, 0x00008780, 0x00008780}, - {0x00009aac, 0x0000ab90, 0x0000ab90, 0x00008784, 0x00008784}, - {0x00009ab0, 0x0000ab94, 0x0000ab94, 0x00008b00, 0x00008b00}, - {0x00009ab4, 0x0000af80, 0x0000af80, 0x00008b04, 0x00008b04}, - {0x00009ab8, 0x0000af84, 0x0000af84, 0x00008b08, 0x00008b08}, - {0x00009abc, 0x0000af88, 0x0000af88, 0x00008b0c, 0x00008b0c}, - {0x00009ac0, 0x0000af8c, 0x0000af8c, 0x00008b80, 0x00008b80}, - {0x00009ac4, 0x0000af90, 0x0000af90, 0x00008b84, 0x00008b84}, - {0x00009ac8, 0x0000af94, 0x0000af94, 0x00008b88, 0x00008b88}, - {0x00009acc, 0x0000b380, 0x0000b380, 0x00008b8c, 0x00008b8c}, - {0x00009ad0, 0x0000b384, 0x0000b384, 0x00008b90, 0x00008b90}, - {0x00009ad4, 0x0000b388, 0x0000b388, 0x00008f80, 0x00008f80}, - {0x00009ad8, 0x0000b38c, 0x0000b38c, 0x00008f84, 0x00008f84}, - {0x00009adc, 0x0000b390, 0x0000b390, 0x00008f88, 0x00008f88}, - {0x00009ae0, 0x0000b394, 0x0000b394, 0x00008f8c, 0x00008f8c}, - {0x00009ae4, 0x0000b398, 0x0000b398, 0x00008f90, 0x00008f90}, - {0x00009ae8, 0x0000b780, 0x0000b780, 0x00009310, 0x00009310}, - {0x00009aec, 0x0000b784, 0x0000b784, 0x00009314, 0x00009314}, - {0x00009af0, 0x0000b788, 0x0000b788, 0x00009320, 0x00009320}, - {0x00009af4, 0x0000b78c, 0x0000b78c, 0x00009324, 0x00009324}, - {0x00009af8, 0x0000b790, 0x0000b790, 0x00009328, 0x00009328}, - {0x00009afc, 0x0000b794, 0x0000b794, 0x0000932c, 0x0000932c}, - {0x00009b00, 0x0000b798, 0x0000b798, 0x00009330, 0x00009330}, - {0x00009b04, 0x0000d784, 0x0000d784, 0x00009334, 0x00009334}, - {0x00009b08, 0x0000d788, 0x0000d788, 0x00009321, 0x00009321}, - {0x00009b0c, 0x0000d78c, 0x0000d78c, 0x00009325, 0x00009325}, - {0x00009b10, 0x0000d790, 0x0000d790, 0x00009329, 0x00009329}, - {0x00009b14, 0x0000f780, 0x0000f780, 0x0000932d, 0x0000932d}, - {0x00009b18, 0x0000f784, 0x0000f784, 0x00009331, 0x00009331}, - {0x00009b1c, 0x0000f788, 0x0000f788, 0x00009335, 0x00009335}, - {0x00009b20, 0x0000f78c, 0x0000f78c, 0x00009322, 0x00009322}, - {0x00009b24, 0x0000f790, 0x0000f790, 0x00009326, 0x00009326}, - {0x00009b28, 0x0000f794, 0x0000f794, 0x0000932a, 0x0000932a}, - {0x00009b2c, 0x0000f7a4, 0x0000f7a4, 0x0000932e, 0x0000932e}, - {0x00009b30, 0x0000f7a8, 0x0000f7a8, 0x00009332, 0x00009332}, - {0x00009b34, 0x0000f7ac, 0x0000f7ac, 0x00009336, 0x00009336}, - {0x00009b38, 0x0000f7b0, 0x0000f7b0, 0x00009323, 0x00009323}, - {0x00009b3c, 0x0000f7b4, 0x0000f7b4, 0x00009327, 0x00009327}, - {0x00009b40, 0x0000f7a1, 0x0000f7a1, 0x0000932b, 0x0000932b}, - {0x00009b44, 0x0000f7a5, 0x0000f7a5, 0x0000932f, 0x0000932f}, - {0x00009b48, 0x0000f7a9, 0x0000f7a9, 0x00009333, 0x00009333}, - {0x00009b4c, 0x0000f7ad, 0x0000f7ad, 0x00009337, 0x00009337}, - {0x00009b50, 0x0000f7b1, 0x0000f7b1, 0x00009343, 0x00009343}, - {0x00009b54, 0x0000f7b5, 0x0000f7b5, 0x00009347, 0x00009347}, - {0x00009b58, 0x0000f7c5, 0x0000f7c5, 0x0000934b, 0x0000934b}, - {0x00009b5c, 0x0000f7c9, 0x0000f7c9, 0x0000934f, 0x0000934f}, - {0x00009b60, 0x0000f7cd, 0x0000f7cd, 0x00009353, 0x00009353}, - {0x00009b64, 0x0000f7d1, 0x0000f7d1, 0x00009357, 0x00009357}, - {0x00009b68, 0x0000f7d5, 0x0000f7d5, 0x0000935b, 0x0000935b}, - {0x00009b6c, 0x0000f7c2, 0x0000f7c2, 0x0000935b, 0x0000935b}, - {0x00009b70, 0x0000f7c6, 0x0000f7c6, 0x0000935b, 0x0000935b}, - {0x00009b74, 0x0000f7ca, 0x0000f7ca, 0x0000935b, 0x0000935b}, - {0x00009b78, 0x0000f7ce, 0x0000f7ce, 0x0000935b, 0x0000935b}, - {0x00009b7c, 0x0000f7d2, 0x0000f7d2, 0x0000935b, 0x0000935b}, - {0x00009b80, 0x0000f7d6, 0x0000f7d6, 0x0000935b, 0x0000935b}, - {0x00009b84, 0x0000f7c3, 0x0000f7c3, 0x0000935b, 0x0000935b}, - {0x00009b88, 0x0000f7c7, 0x0000f7c7, 0x0000935b, 0x0000935b}, - {0x00009b8c, 0x0000f7cb, 0x0000f7cb, 0x0000935b, 0x0000935b}, - {0x00009b90, 0x0000f7d3, 0x0000f7d3, 0x0000935b, 0x0000935b}, - {0x00009b94, 0x0000f7d7, 0x0000f7d7, 0x0000935b, 0x0000935b}, - {0x00009b98, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009b9c, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009ba0, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009ba4, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009ba8, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bac, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bb0, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bb4, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bb8, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bbc, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bc0, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bc4, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bc8, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bcc, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bd0, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bd4, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bd8, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bdc, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009be0, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009be4, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009be8, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bec, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bf0, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bf4, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bf8, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009bfc, 0x0000f7db, 0x0000f7db, 0x0000935b, 0x0000935b}, - {0x00009848, 0x00001066, 0x00001066, 0x0000105a, 0x0000105a}, - {0x0000a848, 0x00001066, 0x00001066, 0x0000105a, 0x0000105a}, -}; - -static const u32 ar9280Modes_high_power_tx_gain_9280_2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a274, 0x0a19e652, 0x0a19e652, 0x0a1aa652, 0x0a1aa652}, - {0x0000a27c, 0x050739ce, 0x050739ce, 0x050739ce, 0x050739ce}, - {0x0000a300, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a304, 0x00003002, 0x00003002, 0x00004002, 0x00004002}, - {0x0000a308, 0x00006004, 0x00006004, 0x00007008, 0x00007008}, - {0x0000a30c, 0x0000a006, 0x0000a006, 0x0000c010, 0x0000c010}, - {0x0000a310, 0x0000e012, 0x0000e012, 0x00010012, 0x00010012}, - {0x0000a314, 0x00011014, 0x00011014, 0x00013014, 0x00013014}, - {0x0000a318, 0x0001504a, 0x0001504a, 0x0001820a, 0x0001820a}, - {0x0000a31c, 0x0001904c, 0x0001904c, 0x0001b211, 0x0001b211}, - {0x0000a320, 0x0001c04e, 0x0001c04e, 0x0001e213, 0x0001e213}, - {0x0000a324, 0x00021092, 0x00021092, 0x00022411, 0x00022411}, - {0x0000a328, 0x0002510a, 0x0002510a, 0x00025413, 0x00025413}, - {0x0000a32c, 0x0002910c, 0x0002910c, 0x00029811, 0x00029811}, - {0x0000a330, 0x0002c18b, 0x0002c18b, 0x0002c813, 0x0002c813}, - {0x0000a334, 0x0002f1cc, 0x0002f1cc, 0x00030a14, 0x00030a14}, - {0x0000a338, 0x000321eb, 0x000321eb, 0x00035a50, 0x00035a50}, - {0x0000a33c, 0x000341ec, 0x000341ec, 0x00039c4c, 0x00039c4c}, - {0x0000a340, 0x000341ec, 0x000341ec, 0x0003de8a, 0x0003de8a}, - {0x0000a344, 0x000341ec, 0x000341ec, 0x00042e92, 0x00042e92}, - {0x0000a348, 0x000341ec, 0x000341ec, 0x00046ed2, 0x00046ed2}, - {0x0000a34c, 0x000341ec, 0x000341ec, 0x0004bed5, 0x0004bed5}, - {0x0000a350, 0x000341ec, 0x000341ec, 0x0004ff54, 0x0004ff54}, - {0x0000a354, 0x000341ec, 0x000341ec, 0x00055fd5, 0x00055fd5}, - {0x0000a3ec, 0x00f70081, 0x00f70081, 0x00f70081, 0x00f70081}, - {0x00007814, 0x00198eff, 0x00198eff, 0x00198eff, 0x00198eff}, - {0x00007838, 0x00198eff, 0x00198eff, 0x00198eff, 0x00198eff}, - {0x0000781c, 0x00172000, 0x00172000, 0x00172000, 0x00172000}, - {0x00007840, 0x00172000, 0x00172000, 0x00172000, 0x00172000}, - {0x00007820, 0xf258a480, 0xf258a480, 0xf258a480, 0xf258a480}, - {0x00007844, 0xf258a480, 0xf258a480, 0xf258a480, 0xf258a480}, -}; - -static const u32 ar9280Modes_original_tx_gain_9280_2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a274, 0x0a19c652, 0x0a19c652, 0x0a1aa652, 0x0a1aa652}, - {0x0000a27c, 0x050701ce, 0x050701ce, 0x050701ce, 0x050701ce}, - {0x0000a300, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a304, 0x00003002, 0x00003002, 0x00003002, 0x00003002}, - {0x0000a308, 0x00006004, 0x00006004, 0x00008009, 0x00008009}, - {0x0000a30c, 0x0000a006, 0x0000a006, 0x0000b00b, 0x0000b00b}, - {0x0000a310, 0x0000e012, 0x0000e012, 0x0000e012, 0x0000e012}, - {0x0000a314, 0x00011014, 0x00011014, 0x00012048, 0x00012048}, - {0x0000a318, 0x0001504a, 0x0001504a, 0x0001604a, 0x0001604a}, - {0x0000a31c, 0x0001904c, 0x0001904c, 0x0001a211, 0x0001a211}, - {0x0000a320, 0x0001c04e, 0x0001c04e, 0x0001e213, 0x0001e213}, - {0x0000a324, 0x00020092, 0x00020092, 0x0002121b, 0x0002121b}, - {0x0000a328, 0x0002410a, 0x0002410a, 0x00024412, 0x00024412}, - {0x0000a32c, 0x0002710c, 0x0002710c, 0x00028414, 0x00028414}, - {0x0000a330, 0x0002b18b, 0x0002b18b, 0x0002b44a, 0x0002b44a}, - {0x0000a334, 0x0002e1cc, 0x0002e1cc, 0x00030649, 0x00030649}, - {0x0000a338, 0x000321ec, 0x000321ec, 0x0003364b, 0x0003364b}, - {0x0000a33c, 0x000321ec, 0x000321ec, 0x00038a49, 0x00038a49}, - {0x0000a340, 0x000321ec, 0x000321ec, 0x0003be48, 0x0003be48}, - {0x0000a344, 0x000321ec, 0x000321ec, 0x0003ee4a, 0x0003ee4a}, - {0x0000a348, 0x000321ec, 0x000321ec, 0x00042e88, 0x00042e88}, - {0x0000a34c, 0x000321ec, 0x000321ec, 0x00046e8a, 0x00046e8a}, - {0x0000a350, 0x000321ec, 0x000321ec, 0x00049ec9, 0x00049ec9}, - {0x0000a354, 0x000321ec, 0x000321ec, 0x0004bf42, 0x0004bf42}, - {0x0000a3ec, 0x00f70081, 0x00f70081, 0x00f70081, 0x00f70081}, - {0x00007814, 0x0019beff, 0x0019beff, 0x0019beff, 0x0019beff}, - {0x00007838, 0x0019beff, 0x0019beff, 0x0019beff, 0x0019beff}, - {0x0000781c, 0x00392000, 0x00392000, 0x00392000, 0x00392000}, - {0x00007840, 0x00392000, 0x00392000, 0x00392000, 0x00392000}, - {0x00007820, 0x92592480, 0x92592480, 0x92592480, 0x92592480}, - {0x00007844, 0x92592480, 0x92592480, 0x92592480, 0x92592480}, -}; - -static const u32 ar9280PciePhy_clkreq_off_L1_9280[][2] = { - /* Addr allmodes */ - {0x00004040, 0x9248fd00}, - {0x00004040, 0x24924924}, - {0x00004040, 0xa8000019}, - {0x00004040, 0x13160820}, - {0x00004040, 0xe5980560}, - {0x00004040, 0xc01dcffc}, - {0x00004040, 0x1aaabe41}, - {0x00004040, 0xbe105554}, - {0x00004040, 0x00043007}, - {0x00004044, 0x00000000}, -}; - -static const u32 ar9280PciePhy_clkreq_always_on_L1_9280[][2] = { - /* Addr allmodes */ - {0x00004040, 0x9248fd00}, - {0x00004040, 0x24924924}, - {0x00004040, 0xa8000019}, - {0x00004040, 0x13160820}, - {0x00004040, 0xe5980560}, - {0x00004040, 0xc01dcffd}, - {0x00004040, 0x1aaabe41}, - {0x00004040, 0xbe105554}, - {0x00004040, 0x00043007}, - {0x00004044, 0x00000000}, -}; - -static const u32 ar9280PciePhy_awow[][2] = { - /* Addr allmodes */ - {0x00004040, 0x9248fd00}, - {0x00004040, 0x24924924}, - {0x00004040, 0xa8000019}, - {0x00004040, 0x13160820}, - {0x00004040, 0xe5980560}, - {0x00004040, 0xc01dcffd}, - {0x00004040, 0x1aaabe41}, - {0x00004040, 0xbe105554}, - {0x00004040, 0x00043007}, - {0x00004044, 0x00000000}, -}; - -static const u32 ar9285Modes_9285_1_2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, - {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, - {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, - {0x000010f0, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, - {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b}, - {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, - {0x00009804, 0x00000300, 0x000003c4, 0x000003c4, 0x00000300}, - {0x00009820, 0x02020200, 0x02020200, 0x02020200, 0x02020200}, - {0x00009824, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, - {0x00009828, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001}, - {0x00009834, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x00009838, 0x00000007, 0x00000007, 0x00000007, 0x00000007}, - {0x00009840, 0x206a012e, 0x206a012e, 0x206a012e, 0x206a012e}, - {0x00009844, 0x0372161e, 0x0372161e, 0x03721620, 0x03721620}, - {0x00009848, 0x00001066, 0x00001066, 0x00001053, 0x00001053}, - {0x0000a848, 0x00001066, 0x00001066, 0x00001053, 0x00001053}, - {0x00009850, 0x6d4000e2, 0x6d4000e2, 0x6d4000e2, 0x6d4000e2}, - {0x00009858, 0x7ec84d2e, 0x7ec84d2e, 0x7ec84d2e, 0x7ec84d2e}, - {0x0000985c, 0x3139605e, 0x3139605e, 0x3137605e, 0x3137605e}, - {0x00009860, 0x00058d18, 0x00058d18, 0x00058d20, 0x00058d20}, - {0x00009864, 0x0000fe00, 0x0000fe00, 0x0001ce00, 0x0001ce00}, - {0x00009868, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, - {0x0000986c, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, - {0x00009914, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x00009918, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b}, - {0x00009924, 0xd00a8007, 0xd00a8007, 0xd00a800d, 0xd00a800d}, - {0x00009944, 0xffbc1010, 0xffbc1010, 0xffbc1020, 0xffbc1020}, - {0x00009960, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00009964, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x000099b8, 0x0000421c, 0x0000421c, 0x0000421c, 0x0000421c}, - {0x000099bc, 0x00000600, 0x00000600, 0x00000c00, 0x00000c00}, - {0x000099c0, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, - {0x000099c4, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77}, - {0x000099c8, 0x6af6532f, 0x6af6532f, 0x6af6532f, 0x6af6532f}, - {0x000099cc, 0x08f186c8, 0x08f186c8, 0x08f186c8, 0x08f186c8}, - {0x000099d0, 0x00046384, 0x00046384, 0x00046384, 0x00046384}, - {0x000099d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x000099d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00009a00, 0x00000000, 0x00000000, 0x00058084, 0x00058084}, - {0x00009a04, 0x00000000, 0x00000000, 0x00058088, 0x00058088}, - {0x00009a08, 0x00000000, 0x00000000, 0x0005808c, 0x0005808c}, - {0x00009a0c, 0x00000000, 0x00000000, 0x00058100, 0x00058100}, - {0x00009a10, 0x00000000, 0x00000000, 0x00058104, 0x00058104}, - {0x00009a14, 0x00000000, 0x00000000, 0x00058108, 0x00058108}, - {0x00009a18, 0x00000000, 0x00000000, 0x0005810c, 0x0005810c}, - {0x00009a1c, 0x00000000, 0x00000000, 0x00058110, 0x00058110}, - {0x00009a20, 0x00000000, 0x00000000, 0x00058114, 0x00058114}, - {0x00009a24, 0x00000000, 0x00000000, 0x00058180, 0x00058180}, - {0x00009a28, 0x00000000, 0x00000000, 0x00058184, 0x00058184}, - {0x00009a2c, 0x00000000, 0x00000000, 0x00058188, 0x00058188}, - {0x00009a30, 0x00000000, 0x00000000, 0x0005818c, 0x0005818c}, - {0x00009a34, 0x00000000, 0x00000000, 0x00058190, 0x00058190}, - {0x00009a38, 0x00000000, 0x00000000, 0x00058194, 0x00058194}, - {0x00009a3c, 0x00000000, 0x00000000, 0x000581a0, 0x000581a0}, - {0x00009a40, 0x00000000, 0x00000000, 0x0005820c, 0x0005820c}, - {0x00009a44, 0x00000000, 0x00000000, 0x000581a8, 0x000581a8}, - {0x00009a48, 0x00000000, 0x00000000, 0x00058284, 0x00058284}, - {0x00009a4c, 0x00000000, 0x00000000, 0x00058288, 0x00058288}, - {0x00009a50, 0x00000000, 0x00000000, 0x00058224, 0x00058224}, - {0x00009a54, 0x00000000, 0x00000000, 0x00058290, 0x00058290}, - {0x00009a58, 0x00000000, 0x00000000, 0x00058300, 0x00058300}, - {0x00009a5c, 0x00000000, 0x00000000, 0x00058304, 0x00058304}, - {0x00009a60, 0x00000000, 0x00000000, 0x00058308, 0x00058308}, - {0x00009a64, 0x00000000, 0x00000000, 0x0005830c, 0x0005830c}, - {0x00009a68, 0x00000000, 0x00000000, 0x00058380, 0x00058380}, - {0x00009a6c, 0x00000000, 0x00000000, 0x00058384, 0x00058384}, - {0x00009a70, 0x00000000, 0x00000000, 0x00068700, 0x00068700}, - {0x00009a74, 0x00000000, 0x00000000, 0x00068704, 0x00068704}, - {0x00009a78, 0x00000000, 0x00000000, 0x00068708, 0x00068708}, - {0x00009a7c, 0x00000000, 0x00000000, 0x0006870c, 0x0006870c}, - {0x00009a80, 0x00000000, 0x00000000, 0x00068780, 0x00068780}, - {0x00009a84, 0x00000000, 0x00000000, 0x00068784, 0x00068784}, - {0x00009a88, 0x00000000, 0x00000000, 0x00078b00, 0x00078b00}, - {0x00009a8c, 0x00000000, 0x00000000, 0x00078b04, 0x00078b04}, - {0x00009a90, 0x00000000, 0x00000000, 0x00078b08, 0x00078b08}, - {0x00009a94, 0x00000000, 0x00000000, 0x00078b0c, 0x00078b0c}, - {0x00009a98, 0x00000000, 0x00000000, 0x00078b80, 0x00078b80}, - {0x00009a9c, 0x00000000, 0x00000000, 0x00078b84, 0x00078b84}, - {0x00009aa0, 0x00000000, 0x00000000, 0x00078b88, 0x00078b88}, - {0x00009aa4, 0x00000000, 0x00000000, 0x00078b8c, 0x00078b8c}, - {0x00009aa8, 0x00000000, 0x00000000, 0x00078b90, 0x00078b90}, - {0x00009aac, 0x00000000, 0x00000000, 0x000caf80, 0x000caf80}, - {0x00009ab0, 0x00000000, 0x00000000, 0x000caf84, 0x000caf84}, - {0x00009ab4, 0x00000000, 0x00000000, 0x000caf88, 0x000caf88}, - {0x00009ab8, 0x00000000, 0x00000000, 0x000caf8c, 0x000caf8c}, - {0x00009abc, 0x00000000, 0x00000000, 0x000caf90, 0x000caf90}, - {0x00009ac0, 0x00000000, 0x00000000, 0x000db30c, 0x000db30c}, - {0x00009ac4, 0x00000000, 0x00000000, 0x000db310, 0x000db310}, - {0x00009ac8, 0x00000000, 0x00000000, 0x000db384, 0x000db384}, - {0x00009acc, 0x00000000, 0x00000000, 0x000db388, 0x000db388}, - {0x00009ad0, 0x00000000, 0x00000000, 0x000db324, 0x000db324}, - {0x00009ad4, 0x00000000, 0x00000000, 0x000eb704, 0x000eb704}, - {0x00009ad8, 0x00000000, 0x00000000, 0x000eb6a4, 0x000eb6a4}, - {0x00009adc, 0x00000000, 0x00000000, 0x000eb6a8, 0x000eb6a8}, - {0x00009ae0, 0x00000000, 0x00000000, 0x000eb710, 0x000eb710}, - {0x00009ae4, 0x00000000, 0x00000000, 0x000eb714, 0x000eb714}, - {0x00009ae8, 0x00000000, 0x00000000, 0x000eb720, 0x000eb720}, - {0x00009aec, 0x00000000, 0x00000000, 0x000eb724, 0x000eb724}, - {0x00009af0, 0x00000000, 0x00000000, 0x000eb728, 0x000eb728}, - {0x00009af4, 0x00000000, 0x00000000, 0x000eb72c, 0x000eb72c}, - {0x00009af8, 0x00000000, 0x00000000, 0x000eb7a0, 0x000eb7a0}, - {0x00009afc, 0x00000000, 0x00000000, 0x000eb7a4, 0x000eb7a4}, - {0x00009b00, 0x00000000, 0x00000000, 0x000eb7a8, 0x000eb7a8}, - {0x00009b04, 0x00000000, 0x00000000, 0x000eb7b0, 0x000eb7b0}, - {0x00009b08, 0x00000000, 0x00000000, 0x000eb7b4, 0x000eb7b4}, - {0x00009b0c, 0x00000000, 0x00000000, 0x000eb7b8, 0x000eb7b8}, - {0x00009b10, 0x00000000, 0x00000000, 0x000eb7a5, 0x000eb7a5}, - {0x00009b14, 0x00000000, 0x00000000, 0x000eb7a9, 0x000eb7a9}, - {0x00009b18, 0x00000000, 0x00000000, 0x000eb7ad, 0x000eb7ad}, - {0x00009b1c, 0x00000000, 0x00000000, 0x000eb7b1, 0x000eb7b1}, - {0x00009b20, 0x00000000, 0x00000000, 0x000eb7b5, 0x000eb7b5}, - {0x00009b24, 0x00000000, 0x00000000, 0x000eb7b9, 0x000eb7b9}, - {0x00009b28, 0x00000000, 0x00000000, 0x000eb7c5, 0x000eb7c5}, - {0x00009b2c, 0x00000000, 0x00000000, 0x000eb7c9, 0x000eb7c9}, - {0x00009b30, 0x00000000, 0x00000000, 0x000eb7d1, 0x000eb7d1}, - {0x00009b34, 0x00000000, 0x00000000, 0x000eb7d5, 0x000eb7d5}, - {0x00009b38, 0x00000000, 0x00000000, 0x000eb7d9, 0x000eb7d9}, - {0x00009b3c, 0x00000000, 0x00000000, 0x000eb7c6, 0x000eb7c6}, - {0x00009b40, 0x00000000, 0x00000000, 0x000eb7ca, 0x000eb7ca}, - {0x00009b44, 0x00000000, 0x00000000, 0x000eb7ce, 0x000eb7ce}, - {0x00009b48, 0x00000000, 0x00000000, 0x000eb7d2, 0x000eb7d2}, - {0x00009b4c, 0x00000000, 0x00000000, 0x000eb7d6, 0x000eb7d6}, - {0x00009b50, 0x00000000, 0x00000000, 0x000eb7c3, 0x000eb7c3}, - {0x00009b54, 0x00000000, 0x00000000, 0x000eb7c7, 0x000eb7c7}, - {0x00009b58, 0x00000000, 0x00000000, 0x000eb7cb, 0x000eb7cb}, - {0x00009b5c, 0x00000000, 0x00000000, 0x000eb7cf, 0x000eb7cf}, - {0x00009b60, 0x00000000, 0x00000000, 0x000eb7d7, 0x000eb7d7}, - {0x00009b64, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b68, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b6c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b70, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b74, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b78, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b7c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b80, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b84, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b88, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b8c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b90, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b94, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b98, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b9c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009ba0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009ba4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009ba8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bac, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bb0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bb4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bb8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bbc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bc0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bc4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bc8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bcc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bd0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bd4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bd8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bdc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009be0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009be4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009be8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bec, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bf0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bf4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bf8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bfc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000aa00, 0x00000000, 0x00000000, 0x00058084, 0x00058084}, - {0x0000aa04, 0x00000000, 0x00000000, 0x00058088, 0x00058088}, - {0x0000aa08, 0x00000000, 0x00000000, 0x0005808c, 0x0005808c}, - {0x0000aa0c, 0x00000000, 0x00000000, 0x00058100, 0x00058100}, - {0x0000aa10, 0x00000000, 0x00000000, 0x00058104, 0x00058104}, - {0x0000aa14, 0x00000000, 0x00000000, 0x00058108, 0x00058108}, - {0x0000aa18, 0x00000000, 0x00000000, 0x0005810c, 0x0005810c}, - {0x0000aa1c, 0x00000000, 0x00000000, 0x00058110, 0x00058110}, - {0x0000aa20, 0x00000000, 0x00000000, 0x00058114, 0x00058114}, - {0x0000aa24, 0x00000000, 0x00000000, 0x00058180, 0x00058180}, - {0x0000aa28, 0x00000000, 0x00000000, 0x00058184, 0x00058184}, - {0x0000aa2c, 0x00000000, 0x00000000, 0x00058188, 0x00058188}, - {0x0000aa30, 0x00000000, 0x00000000, 0x0005818c, 0x0005818c}, - {0x0000aa34, 0x00000000, 0x00000000, 0x00058190, 0x00058190}, - {0x0000aa38, 0x00000000, 0x00000000, 0x00058194, 0x00058194}, - {0x0000aa3c, 0x00000000, 0x00000000, 0x000581a0, 0x000581a0}, - {0x0000aa40, 0x00000000, 0x00000000, 0x0005820c, 0x0005820c}, - {0x0000aa44, 0x00000000, 0x00000000, 0x000581a8, 0x000581a8}, - {0x0000aa48, 0x00000000, 0x00000000, 0x00058284, 0x00058284}, - {0x0000aa4c, 0x00000000, 0x00000000, 0x00058288, 0x00058288}, - {0x0000aa50, 0x00000000, 0x00000000, 0x00058224, 0x00058224}, - {0x0000aa54, 0x00000000, 0x00000000, 0x00058290, 0x00058290}, - {0x0000aa58, 0x00000000, 0x00000000, 0x00058300, 0x00058300}, - {0x0000aa5c, 0x00000000, 0x00000000, 0x00058304, 0x00058304}, - {0x0000aa60, 0x00000000, 0x00000000, 0x00058308, 0x00058308}, - {0x0000aa64, 0x00000000, 0x00000000, 0x0005830c, 0x0005830c}, - {0x0000aa68, 0x00000000, 0x00000000, 0x00058380, 0x00058380}, - {0x0000aa6c, 0x00000000, 0x00000000, 0x00058384, 0x00058384}, - {0x0000aa70, 0x00000000, 0x00000000, 0x00068700, 0x00068700}, - {0x0000aa74, 0x00000000, 0x00000000, 0x00068704, 0x00068704}, - {0x0000aa78, 0x00000000, 0x00000000, 0x00068708, 0x00068708}, - {0x0000aa7c, 0x00000000, 0x00000000, 0x0006870c, 0x0006870c}, - {0x0000aa80, 0x00000000, 0x00000000, 0x00068780, 0x00068780}, - {0x0000aa84, 0x00000000, 0x00000000, 0x00068784, 0x00068784}, - {0x0000aa88, 0x00000000, 0x00000000, 0x00078b00, 0x00078b00}, - {0x0000aa8c, 0x00000000, 0x00000000, 0x00078b04, 0x00078b04}, - {0x0000aa90, 0x00000000, 0x00000000, 0x00078b08, 0x00078b08}, - {0x0000aa94, 0x00000000, 0x00000000, 0x00078b0c, 0x00078b0c}, - {0x0000aa98, 0x00000000, 0x00000000, 0x00078b80, 0x00078b80}, - {0x0000aa9c, 0x00000000, 0x00000000, 0x00078b84, 0x00078b84}, - {0x0000aaa0, 0x00000000, 0x00000000, 0x00078b88, 0x00078b88}, - {0x0000aaa4, 0x00000000, 0x00000000, 0x00078b8c, 0x00078b8c}, - {0x0000aaa8, 0x00000000, 0x00000000, 0x00078b90, 0x00078b90}, - {0x0000aaac, 0x00000000, 0x00000000, 0x000caf80, 0x000caf80}, - {0x0000aab0, 0x00000000, 0x00000000, 0x000caf84, 0x000caf84}, - {0x0000aab4, 0x00000000, 0x00000000, 0x000caf88, 0x000caf88}, - {0x0000aab8, 0x00000000, 0x00000000, 0x000caf8c, 0x000caf8c}, - {0x0000aabc, 0x00000000, 0x00000000, 0x000caf90, 0x000caf90}, - {0x0000aac0, 0x00000000, 0x00000000, 0x000db30c, 0x000db30c}, - {0x0000aac4, 0x00000000, 0x00000000, 0x000db310, 0x000db310}, - {0x0000aac8, 0x00000000, 0x00000000, 0x000db384, 0x000db384}, - {0x0000aacc, 0x00000000, 0x00000000, 0x000db388, 0x000db388}, - {0x0000aad0, 0x00000000, 0x00000000, 0x000db324, 0x000db324}, - {0x0000aad4, 0x00000000, 0x00000000, 0x000eb704, 0x000eb704}, - {0x0000aad8, 0x00000000, 0x00000000, 0x000eb6a4, 0x000eb6a4}, - {0x0000aadc, 0x00000000, 0x00000000, 0x000eb6a8, 0x000eb6a8}, - {0x0000aae0, 0x00000000, 0x00000000, 0x000eb710, 0x000eb710}, - {0x0000aae4, 0x00000000, 0x00000000, 0x000eb714, 0x000eb714}, - {0x0000aae8, 0x00000000, 0x00000000, 0x000eb720, 0x000eb720}, - {0x0000aaec, 0x00000000, 0x00000000, 0x000eb724, 0x000eb724}, - {0x0000aaf0, 0x00000000, 0x00000000, 0x000eb728, 0x000eb728}, - {0x0000aaf4, 0x00000000, 0x00000000, 0x000eb72c, 0x000eb72c}, - {0x0000aaf8, 0x00000000, 0x00000000, 0x000eb7a0, 0x000eb7a0}, - {0x0000aafc, 0x00000000, 0x00000000, 0x000eb7a4, 0x000eb7a4}, - {0x0000ab00, 0x00000000, 0x00000000, 0x000eb7a8, 0x000eb7a8}, - {0x0000ab04, 0x00000000, 0x00000000, 0x000eb7b0, 0x000eb7b0}, - {0x0000ab08, 0x00000000, 0x00000000, 0x000eb7b4, 0x000eb7b4}, - {0x0000ab0c, 0x00000000, 0x00000000, 0x000eb7b8, 0x000eb7b8}, - {0x0000ab10, 0x00000000, 0x00000000, 0x000eb7a5, 0x000eb7a5}, - {0x0000ab14, 0x00000000, 0x00000000, 0x000eb7a9, 0x000eb7a9}, - {0x0000ab18, 0x00000000, 0x00000000, 0x000eb7ad, 0x000eb7ad}, - {0x0000ab1c, 0x00000000, 0x00000000, 0x000eb7b1, 0x000eb7b1}, - {0x0000ab20, 0x00000000, 0x00000000, 0x000eb7b5, 0x000eb7b5}, - {0x0000ab24, 0x00000000, 0x00000000, 0x000eb7b9, 0x000eb7b9}, - {0x0000ab28, 0x00000000, 0x00000000, 0x000eb7c5, 0x000eb7c5}, - {0x0000ab2c, 0x00000000, 0x00000000, 0x000eb7c9, 0x000eb7c9}, - {0x0000ab30, 0x00000000, 0x00000000, 0x000eb7d1, 0x000eb7d1}, - {0x0000ab34, 0x00000000, 0x00000000, 0x000eb7d5, 0x000eb7d5}, - {0x0000ab38, 0x00000000, 0x00000000, 0x000eb7d9, 0x000eb7d9}, - {0x0000ab3c, 0x00000000, 0x00000000, 0x000eb7c6, 0x000eb7c6}, - {0x0000ab40, 0x00000000, 0x00000000, 0x000eb7ca, 0x000eb7ca}, - {0x0000ab44, 0x00000000, 0x00000000, 0x000eb7ce, 0x000eb7ce}, - {0x0000ab48, 0x00000000, 0x00000000, 0x000eb7d2, 0x000eb7d2}, - {0x0000ab4c, 0x00000000, 0x00000000, 0x000eb7d6, 0x000eb7d6}, - {0x0000ab50, 0x00000000, 0x00000000, 0x000eb7c3, 0x000eb7c3}, - {0x0000ab54, 0x00000000, 0x00000000, 0x000eb7c7, 0x000eb7c7}, - {0x0000ab58, 0x00000000, 0x00000000, 0x000eb7cb, 0x000eb7cb}, - {0x0000ab5c, 0x00000000, 0x00000000, 0x000eb7cf, 0x000eb7cf}, - {0x0000ab60, 0x00000000, 0x00000000, 0x000eb7d7, 0x000eb7d7}, - {0x0000ab64, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab68, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab6c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab70, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab74, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab78, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab7c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab80, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab84, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab88, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab8c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab90, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab94, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab98, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab9c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000aba0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000aba4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000aba8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abac, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abb0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abb4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abb8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abbc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abc0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abc4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abc8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abcc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abd0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abd4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abd8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abdc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abe0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abe4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abe8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abec, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abf0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abf4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abf8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abfc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000a204, 0x00000004, 0x00000004, 0x00000004, 0x00000004}, - {0x0000a20c, 0x00000014, 0x00000014, 0x0001f000, 0x0001f000}, - {0x0000b20c, 0x00000014, 0x00000014, 0x0001f000, 0x0001f000}, - {0x0000a21c, 0x1883800a, 0x1883800a, 0x1883800a, 0x1883800a}, - {0x0000a230, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a250, 0x0004f000, 0x0004f000, 0x0004a000, 0x0004a000}, - {0x0000a358, 0x7999aa02, 0x7999aa02, 0x7999aa0e, 0x7999aa0e}, -}; - -static const u32 ar9285Common_9285_1_2[][2] = { - /* Addr allmodes */ - {0x0000000c, 0x00000000}, - {0x00000030, 0x00020045}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000008}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00000054, 0x0000001f}, - {0x00000800, 0x00000000}, - {0x00000804, 0x00000000}, - {0x00000808, 0x00000000}, - {0x0000080c, 0x00000000}, - {0x00000810, 0x00000000}, - {0x00000814, 0x00000000}, - {0x00000818, 0x00000000}, - {0x0000081c, 0x00000000}, - {0x00000820, 0x00000000}, - {0x00000824, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x00001230, 0x00000000}, - {0x00001270, 0x00000000}, - {0x00001038, 0x00000000}, - {0x00001078, 0x00000000}, - {0x000010b8, 0x00000000}, - {0x000010f8, 0x00000000}, - {0x00001138, 0x00000000}, - {0x00001178, 0x00000000}, - {0x000011b8, 0x00000000}, - {0x000011f8, 0x00000000}, - {0x00001238, 0x00000000}, - {0x00001278, 0x00000000}, - {0x000012b8, 0x00000000}, - {0x000012f8, 0x00000000}, - {0x00001338, 0x00000000}, - {0x00001378, 0x00000000}, - {0x000013b8, 0x00000000}, - {0x000013f8, 0x00000000}, - {0x00001438, 0x00000000}, - {0x00001478, 0x00000000}, - {0x000014b8, 0x00000000}, - {0x000014f8, 0x00000000}, - {0x00001538, 0x00000000}, - {0x00001578, 0x00000000}, - {0x000015b8, 0x00000000}, - {0x000015f8, 0x00000000}, - {0x00001638, 0x00000000}, - {0x00001678, 0x00000000}, - {0x000016b8, 0x00000000}, - {0x000016f8, 0x00000000}, - {0x00001738, 0x00000000}, - {0x00001778, 0x00000000}, - {0x000017b8, 0x00000000}, - {0x000017f8, 0x00000000}, - {0x0000103c, 0x00000000}, - {0x0000107c, 0x00000000}, - {0x000010bc, 0x00000000}, - {0x000010fc, 0x00000000}, - {0x0000113c, 0x00000000}, - {0x0000117c, 0x00000000}, - {0x000011bc, 0x00000000}, - {0x000011fc, 0x00000000}, - {0x0000123c, 0x00000000}, - {0x0000127c, 0x00000000}, - {0x000012bc, 0x00000000}, - {0x000012fc, 0x00000000}, - {0x0000133c, 0x00000000}, - {0x0000137c, 0x00000000}, - {0x000013bc, 0x00000000}, - {0x000013fc, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00004030, 0x00000002}, - {0x0000403c, 0x00000002}, - {0x00004024, 0x0000001f}, - {0x00004060, 0x00000000}, - {0x00004064, 0x00000000}, - {0x00007010, 0x00000031}, - {0x00007034, 0x00000002}, - {0x00007038, 0x000004c2}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008018, 0x00000700}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00000000}, - {0x00008048, 0x00000000}, - {0x00008054, 0x00000000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x00008070, 0x00000000}, - {0x000080c0, 0x2a80001a}, - {0x000080c4, 0x05dc01e0}, - {0x000080c8, 0x1f402710}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00001e00}, - {0x000080d4, 0x00000000}, - {0x000080d8, 0x00400000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x003f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080f8, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00020000}, - {0x00008104, 0x00000001}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000168}, - {0x00008118, 0x000100aa}, - {0x0000811c, 0x00003210}, - {0x00008120, 0x08f04810}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x00000000}, - {0x00008144, 0xffffffff}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x00008170, 0x32143320}, - {0x00008174, 0xfaa4fa50}, - {0x00008178, 0x00000100}, - {0x0000817c, 0x00000000}, - {0x000081c0, 0x00000000}, - {0x000081d0, 0x0000320a}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008200, 0x00000000}, - {0x00008204, 0x00000000}, - {0x00008208, 0x00000000}, - {0x0000820c, 0x00000000}, - {0x00008210, 0x00000000}, - {0x00008214, 0x00000000}, - {0x00008218, 0x00000000}, - {0x0000821c, 0x00000000}, - {0x00008220, 0x00000000}, - {0x00008224, 0x00000000}, - {0x00008228, 0x00000000}, - {0x0000822c, 0x00000000}, - {0x00008230, 0x00000000}, - {0x00008234, 0x00000000}, - {0x00008238, 0x00000000}, - {0x0000823c, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008244, 0x0010f400}, - {0x00008248, 0x00000100}, - {0x0000824c, 0x0001e800}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x400000ff}, - {0x00008260, 0x00080922}, - {0x00008264, 0x88a00010}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000000}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x00000000}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x0000829c, 0x00000000}, - {0x00008300, 0x00000040}, - {0x00008314, 0x00000000}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x00000001}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000e00}, - {0x00008338, 0x00ff0000}, - {0x0000833c, 0x00000000}, - {0x00008340, 0x00010380}, - {0x00008344, 0x00481043}, - {0x00009808, 0x00000000}, - {0x0000980c, 0xafe68e30}, - {0x00009810, 0xfd14e000}, - {0x00009814, 0x9c0a9f6b}, - {0x0000981c, 0x00000000}, - {0x0000982c, 0x0000a000}, - {0x00009830, 0x00000000}, - {0x0000983c, 0x00200400}, - {0x0000984c, 0x0040233c}, - {0x00009854, 0x00000044}, - {0x00009900, 0x00000000}, - {0x00009904, 0x00000000}, - {0x00009908, 0x00000000}, - {0x0000990c, 0x00000000}, - {0x00009910, 0x01002310}, - {0x0000991c, 0x10000fff}, - {0x00009920, 0x04900000}, - {0x00009928, 0x00000001}, - {0x0000992c, 0x00000004}, - {0x00009934, 0x1e1f2022}, - {0x00009938, 0x0a0b0c0d}, - {0x0000993c, 0x00000000}, - {0x00009940, 0x14750604}, - {0x00009948, 0x9280c00a}, - {0x0000994c, 0x00020028}, - {0x00009954, 0x5f3ca3de}, - {0x00009958, 0x2108ecff}, - {0x00009968, 0x000003ce}, - {0x00009970, 0x192bb514}, - {0x00009974, 0x00000000}, - {0x00009978, 0x00000001}, - {0x0000997c, 0x00000000}, - {0x00009980, 0x00000000}, - {0x00009984, 0x00000000}, - {0x00009988, 0x00000000}, - {0x0000998c, 0x00000000}, - {0x00009990, 0x00000000}, - {0x00009994, 0x00000000}, - {0x00009998, 0x00000000}, - {0x0000999c, 0x00000000}, - {0x000099a0, 0x00000000}, - {0x000099a4, 0x00000001}, - {0x000099a8, 0x201fff00}, - {0x000099ac, 0x2def0400}, - {0x000099b0, 0x03051000}, - {0x000099b4, 0x00000820}, - {0x000099dc, 0x00000000}, - {0x000099e0, 0x00000000}, - {0x000099e4, 0xaaaaaaaa}, - {0x000099e8, 0x3c466478}, - {0x000099ec, 0x0cc80caa}, - {0x000099f0, 0x00000000}, - {0x0000a208, 0x803e68c8}, - {0x0000a210, 0x4080a333}, - {0x0000a214, 0x00206c10}, - {0x0000a218, 0x009c4060}, - {0x0000a220, 0x01834061}, - {0x0000a224, 0x00000400}, - {0x0000a228, 0x000003b5}, - {0x0000a22c, 0x00000000}, - {0x0000a234, 0x20202020}, - {0x0000a238, 0x20202020}, - {0x0000a244, 0x00000000}, - {0x0000a248, 0xfffffffc}, - {0x0000a24c, 0x00000000}, - {0x0000a254, 0x00000000}, - {0x0000a258, 0x0ccb5380}, - {0x0000a25c, 0x15151501}, - {0x0000a260, 0xdfa90f01}, - {0x0000a268, 0x00000000}, - {0x0000a26c, 0x0ebae9e6}, - {0x0000d270, 0x0d820820}, - {0x0000d35c, 0x07ffffef}, - {0x0000d360, 0x0fffffe7}, - {0x0000d364, 0x17ffffe5}, - {0x0000d368, 0x1fffffe4}, - {0x0000d36c, 0x37ffffe3}, - {0x0000d370, 0x3fffffe3}, - {0x0000d374, 0x57ffffe3}, - {0x0000d378, 0x5fffffe2}, - {0x0000d37c, 0x7fffffe2}, - {0x0000d380, 0x7f3c7bba}, - {0x0000d384, 0xf3307ff0}, - {0x0000a388, 0x0c000000}, - {0x0000a38c, 0x20202020}, - {0x0000a390, 0x20202020}, - {0x0000a39c, 0x00000001}, - {0x0000a3a0, 0x00000000}, - {0x0000a3a4, 0x00000000}, - {0x0000a3a8, 0x00000000}, - {0x0000a3ac, 0x00000000}, - {0x0000a3b0, 0x00000000}, - {0x0000a3b4, 0x00000000}, - {0x0000a3b8, 0x00000000}, - {0x0000a3bc, 0x00000000}, - {0x0000a3c0, 0x00000000}, - {0x0000a3c4, 0x00000000}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3e4, 0x00000000}, - {0x0000a3e8, 0x18c43433}, - {0x0000a3ec, 0x00f70081}, - {0x00007800, 0x00140000}, - {0x00007804, 0x0e4548d8}, - {0x00007808, 0x54214514}, - {0x0000780c, 0x02025830}, - {0x00007810, 0x71c0d388}, - {0x0000781c, 0x00000000}, - {0x00007824, 0x00d86fff}, - {0x0000782c, 0x6e36d97b}, - {0x00007834, 0x71400087}, - {0x00007844, 0x000c0db6}, - {0x00007848, 0x6db6246f}, - {0x0000784c, 0x6d9b66db}, - {0x00007850, 0x6d8c6dba}, - {0x00007854, 0x00040000}, - {0x00007858, 0xdb003012}, - {0x0000785c, 0x04924914}, - {0x00007860, 0x21084210}, - {0x00007864, 0xf7d7ffde}, - {0x00007868, 0xc2034080}, - {0x00007870, 0x10142c00}, -}; - -static const u32 ar9285Modes_high_power_tx_gain_9285_1_2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a300, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a304, 0x00000000, 0x00000000, 0x00006200, 0x00006200}, - {0x0000a308, 0x00000000, 0x00000000, 0x00008201, 0x00008201}, - {0x0000a30c, 0x00000000, 0x00000000, 0x0000b240, 0x0000b240}, - {0x0000a310, 0x00000000, 0x00000000, 0x0000d241, 0x0000d241}, - {0x0000a314, 0x00000000, 0x00000000, 0x0000f600, 0x0000f600}, - {0x0000a318, 0x00000000, 0x00000000, 0x00012800, 0x00012800}, - {0x0000a31c, 0x00000000, 0x00000000, 0x00016802, 0x00016802}, - {0x0000a320, 0x00000000, 0x00000000, 0x0001b805, 0x0001b805}, - {0x0000a324, 0x00000000, 0x00000000, 0x00021a80, 0x00021a80}, - {0x0000a328, 0x00000000, 0x00000000, 0x00028b00, 0x00028b00}, - {0x0000a32c, 0x00000000, 0x00000000, 0x0002ab40, 0x0002ab40}, - {0x0000a330, 0x00000000, 0x00000000, 0x0002cd80, 0x0002cd80}, - {0x0000a334, 0x00000000, 0x00000000, 0x00033d82, 0x00033d82}, - {0x0000a338, 0x0003891e, 0x0003891e, 0x0003891e, 0x0003891e}, - {0x0000a33c, 0x0003a95e, 0x0003a95e, 0x0003a95e, 0x0003a95e}, - {0x0000a340, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a344, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a348, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a34c, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a350, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a354, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x00007814, 0x924934a8, 0x924934a8, 0x924934a8, 0x924934a8}, - {0x00007828, 0x26d2491b, 0x26d2491b, 0x26d2491b, 0x26d2491b}, - {0x00007830, 0xedb6d96e, 0xedb6d96e, 0xedb6d96e, 0xedb6d96e}, - {0x00007838, 0xfac68803, 0xfac68803, 0xfac68803, 0xfac68803}, - {0x0000783c, 0x0001fffe, 0x0001fffe, 0x0001fffe, 0x0001fffe}, - {0x00007840, 0xffeb1a20, 0xffeb1a20, 0xffeb1a20, 0xffeb1a20}, - {0x0000786c, 0x08609ebe, 0x08609ebe, 0x08609ebe, 0x08609ebe}, - {0x00007820, 0x00000c00, 0x00000c00, 0x00000c00, 0x00000c00}, - {0x0000a274, 0x0a22a652, 0x0a22a652, 0x0a216652, 0x0a216652}, - {0x0000a278, 0x0e739ce7, 0x0e739ce7, 0x0e739ce7, 0x0e739ce7}, - {0x0000a27c, 0x050380e7, 0x050380e7, 0x050380e7, 0x050380e7}, - {0x0000a394, 0x0e739ce7, 0x0e739ce7, 0x0e739ce7, 0x0e739ce7}, - {0x0000a398, 0x000000e7, 0x000000e7, 0x000000e7, 0x000000e7}, - {0x0000a3dc, 0x0e739ce7, 0x0e739ce7, 0x0e739ce7, 0x0e739ce7}, - {0x0000a3e0, 0x000000e7, 0x000000e7, 0x000000e7, 0x000000e7}, -}; - -static const u32 ar9285Modes_original_tx_gain_9285_1_2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a300, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a304, 0x00000000, 0x00000000, 0x00009200, 0x00009200}, - {0x0000a308, 0x00000000, 0x00000000, 0x00010208, 0x00010208}, - {0x0000a30c, 0x00000000, 0x00000000, 0x00019608, 0x00019608}, - {0x0000a310, 0x00000000, 0x00000000, 0x00022618, 0x00022618}, - {0x0000a314, 0x00000000, 0x00000000, 0x0002a6c9, 0x0002a6c9}, - {0x0000a318, 0x00000000, 0x00000000, 0x00031710, 0x00031710}, - {0x0000a31c, 0x00000000, 0x00000000, 0x00035718, 0x00035718}, - {0x0000a320, 0x00000000, 0x00000000, 0x00038758, 0x00038758}, - {0x0000a324, 0x00000000, 0x00000000, 0x0003c75a, 0x0003c75a}, - {0x0000a328, 0x00000000, 0x00000000, 0x0004075c, 0x0004075c}, - {0x0000a32c, 0x00000000, 0x00000000, 0x0004475e, 0x0004475e}, - {0x0000a330, 0x00000000, 0x00000000, 0x0004679f, 0x0004679f}, - {0x0000a334, 0x00000000, 0x00000000, 0x000487df, 0x000487df}, - {0x0000a338, 0x0003891e, 0x0003891e, 0x0003891e, 0x0003891e}, - {0x0000a33c, 0x0003a95e, 0x0003a95e, 0x0003a95e, 0x0003a95e}, - {0x0000a340, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a344, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a348, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a34c, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a350, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a354, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x00007814, 0x924934a8, 0x924934a8, 0x924934a8, 0x924934a8}, - {0x00007828, 0x26d2491b, 0x26d2491b, 0x26d2491b, 0x26d2491b}, - {0x00007830, 0xedb6d96e, 0xedb6d96e, 0xedb6d96e, 0xedb6d96e}, - {0x00007838, 0xfac68801, 0xfac68801, 0xfac68801, 0xfac68801}, - {0x0000783c, 0x0001fffe, 0x0001fffe, 0x0001fffe, 0x0001fffe}, - {0x00007840, 0xffeb1a20, 0xffeb1a20, 0xffeb1a20, 0xffeb1a20}, - {0x0000786c, 0x48609eb4, 0x48609eb4, 0x48609eb4, 0x48609eb4}, - {0x00007820, 0x00000c04, 0x00000c04, 0x00000c04, 0x00000c04}, - {0x0000a274, 0x0a21c652, 0x0a21c652, 0x0a21a652, 0x0a21a652}, - {0x0000a278, 0x39ce739c, 0x39ce739c, 0x39ce739c, 0x39ce739c}, - {0x0000a27c, 0x050e039c, 0x050e039c, 0x050e039c, 0x050e039c}, - {0x0000a394, 0x39ce739c, 0x39ce739c, 0x39ce739c, 0x39ce739c}, - {0x0000a398, 0x0000039c, 0x0000039c, 0x0000039c, 0x0000039c}, - {0x0000a3dc, 0x39ce739c, 0x39ce739c, 0x39ce739c, 0x39ce739c}, - {0x0000a3e0, 0x0000039c, 0x0000039c, 0x0000039c, 0x0000039c}, -}; - -static const u32 ar9285Modes_XE2_0_normal_power[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a300, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a304, 0x00000000, 0x00000000, 0x00009200, 0x00009200}, - {0x0000a308, 0x00000000, 0x00000000, 0x00010208, 0x00010208}, - {0x0000a30c, 0x00000000, 0x00000000, 0x00019608, 0x00019608}, - {0x0000a310, 0x00000000, 0x00000000, 0x00022618, 0x00022618}, - {0x0000a314, 0x00000000, 0x00000000, 0x0002a6c9, 0x0002a6c9}, - {0x0000a318, 0x00000000, 0x00000000, 0x00031710, 0x00031710}, - {0x0000a31c, 0x00000000, 0x00000000, 0x00035718, 0x00035718}, - {0x0000a320, 0x00000000, 0x00000000, 0x00038758, 0x00038758}, - {0x0000a324, 0x00000000, 0x00000000, 0x0003c75a, 0x0003c75a}, - {0x0000a328, 0x00000000, 0x00000000, 0x0004075c, 0x0004075c}, - {0x0000a32c, 0x00000000, 0x00000000, 0x0004475e, 0x0004475e}, - {0x0000a330, 0x00000000, 0x00000000, 0x0004679f, 0x0004679f}, - {0x0000a334, 0x00000000, 0x00000000, 0x000487df, 0x000487df}, - {0x0000a338, 0x0003891e, 0x0003891e, 0x0003891e, 0x0003891e}, - {0x0000a33c, 0x0003a95e, 0x0003a95e, 0x0003a95e, 0x0003a95e}, - {0x0000a340, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a344, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a348, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a34c, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a350, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a354, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x00007814, 0x92497ca8, 0x92497ca8, 0x92497ca8, 0x92497ca8}, - {0x00007828, 0x4ad2491b, 0x4ad2491b, 0x2ad2491b, 0x4ad2491b}, - {0x00007830, 0xedb6da6e, 0xedb6da6e, 0xedb6da6e, 0xedb6da6e}, - {0x00007838, 0xdac71441, 0xdac71441, 0xdac71441, 0xdac71441}, - {0x0000783c, 0x2481f6fe, 0x2481f6fe, 0x2481f6fe, 0x2481f6fe}, - {0x00007840, 0xba5f638c, 0xba5f638c, 0xba5f638c, 0xba5f638c}, - {0x0000786c, 0x48609eb4, 0x48609eb4, 0x48609eb4, 0x48609eb4}, - {0x00007820, 0x00000c04, 0x00000c04, 0x00000c04, 0x00000c04}, - {0x0000a274, 0x0a21c652, 0x0a21c652, 0x0a21a652, 0x0a21a652}, - {0x0000a278, 0x39ce739c, 0x39ce739c, 0x39ce739c, 0x39ce739c}, - {0x0000a27c, 0x050e039c, 0x050e039c, 0x050e039c, 0x050e039c}, - {0x0000a394, 0x39ce739c, 0x39ce739c, 0x39ce739c, 0x39ce739c}, - {0x0000a398, 0x0000039c, 0x0000039c, 0x0000039c, 0x0000039c}, - {0x0000a3dc, 0x39ce739c, 0x39ce739c, 0x39ce739c, 0x39ce739c}, - {0x0000a3e0, 0x0000039c, 0x0000039c, 0x0000039c, 0x0000039c}, -}; - -static const u32 ar9285Modes_XE2_0_high_power[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a300, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a304, 0x00000000, 0x00000000, 0x00006200, 0x00006200}, - {0x0000a308, 0x00000000, 0x00000000, 0x00008201, 0x00008201}, - {0x0000a30c, 0x00000000, 0x00000000, 0x0000b240, 0x0000b240}, - {0x0000a310, 0x00000000, 0x00000000, 0x0000d241, 0x0000d241}, - {0x0000a314, 0x00000000, 0x00000000, 0x0000f600, 0x0000f600}, - {0x0000a318, 0x00000000, 0x00000000, 0x00012800, 0x00012800}, - {0x0000a31c, 0x00000000, 0x00000000, 0x00016802, 0x00016802}, - {0x0000a320, 0x00000000, 0x00000000, 0x0001b805, 0x0001b805}, - {0x0000a324, 0x00000000, 0x00000000, 0x00021a80, 0x00021a80}, - {0x0000a328, 0x00000000, 0x00000000, 0x00028b00, 0x00028b00}, - {0x0000a32c, 0x00000000, 0x00000000, 0x0002ab40, 0x0002ab40}, - {0x0000a330, 0x00000000, 0x00000000, 0x0002cd80, 0x0002cd80}, - {0x0000a334, 0x00000000, 0x00000000, 0x00033d82, 0x00033d82}, - {0x0000a338, 0x0003891e, 0x0003891e, 0x0003891e, 0x0003891e}, - {0x0000a33c, 0x0003a95e, 0x0003a95e, 0x0003a95e, 0x0003a95e}, - {0x0000a340, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a344, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a348, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a34c, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a350, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a354, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x00007814, 0x92497ca8, 0x92497ca8, 0x92497ca8, 0x92497ca8}, - {0x00007828, 0x4ad2491b, 0x4ad2491b, 0x2ad2491b, 0x4ad2491b}, - {0x00007830, 0xedb6da6e, 0xedb6da6e, 0xedb6da6e, 0xedb6da6e}, - {0x00007838, 0xdac71443, 0xdac71443, 0xdac71443, 0xdac71443}, - {0x0000783c, 0x2481f6fe, 0x2481f6fe, 0x2481f6fe, 0x2481f6fe}, - {0x00007840, 0xba5f638c, 0xba5f638c, 0xba5f638c, 0xba5f638c}, - {0x0000786c, 0x08609ebe, 0x08609ebe, 0x08609ebe, 0x08609ebe}, - {0x00007820, 0x00000c00, 0x00000c00, 0x00000c00, 0x00000c00}, - {0x0000a274, 0x0a22a652, 0x0a22a652, 0x0a216652, 0x0a216652}, - {0x0000a278, 0x0e739ce7, 0x0e739ce7, 0x0e739ce7, 0x0e739ce7}, - {0x0000a27c, 0x050380e7, 0x050380e7, 0x050380e7, 0x050380e7}, - {0x0000a394, 0x0e739ce7, 0x0e739ce7, 0x0e739ce7, 0x0e739ce7}, - {0x0000a398, 0x000000e7, 0x000000e7, 0x000000e7, 0x000000e7}, - {0x0000a3dc, 0x0e739ce7, 0x0e739ce7, 0x0e739ce7, 0x0e739ce7}, - {0x0000a3e0, 0x000000e7, 0x000000e7, 0x000000e7, 0x000000e7}, -}; - -static const u32 ar9287Modes_9287_1_1[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00001030, 0x00000000, 0x00000000, 0x000002c0, 0x00000160}, - {0x00001070, 0x00000000, 0x00000000, 0x00000318, 0x0000018c}, - {0x000010b0, 0x00000000, 0x00000000, 0x00007c70, 0x00003e38}, - {0x000010f0, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00008014, 0x00000000, 0x00000000, 0x10801600, 0x08400b00}, - {0x0000801c, 0x00000000, 0x00000000, 0x12e00057, 0x12e0002b}, - {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, - {0x000081d0, 0x00003200, 0x00003200, 0x0000320a, 0x0000320a}, - {0x00008318, 0x00000000, 0x00000000, 0x00006880, 0x00003440}, - {0x00009804, 0x00000000, 0x00000000, 0x000003c4, 0x00000300}, - {0x00009820, 0x00000000, 0x00000000, 0x02020200, 0x02020200}, - {0x00009824, 0x00000000, 0x00000000, 0x01000e0e, 0x01000e0e}, - {0x00009828, 0x00000000, 0x00000000, 0x3a020001, 0x3a020001}, - {0x00009834, 0x00000000, 0x00000000, 0x00000e0e, 0x00000e0e}, - {0x00009838, 0x00000003, 0x00000003, 0x00000007, 0x00000007}, - {0x00009840, 0x206a002e, 0x206a002e, 0x206a012e, 0x206a012e}, - {0x00009844, 0x03720000, 0x03720000, 0x037216a0, 0x037216a0}, - {0x00009850, 0x60000000, 0x60000000, 0x6d4000e2, 0x6c4000e2}, - {0x00009858, 0x7c000d00, 0x7c000d00, 0x7ec84d2e, 0x7ec84d2e}, - {0x0000985c, 0x3100005e, 0x3100005e, 0x3139605e, 0x31395d5e}, - {0x00009860, 0x00058d00, 0x00058d00, 0x00058d20, 0x00058d20}, - {0x00009864, 0x00000e00, 0x00000e00, 0x0001ce00, 0x0001ce00}, - {0x00009868, 0x000040c0, 0x000040c0, 0x5ac640d0, 0x5ac640d0}, - {0x0000986c, 0x00000080, 0x00000080, 0x06903881, 0x06903881}, - {0x00009914, 0x00000000, 0x00000000, 0x00001130, 0x00000898}, - {0x00009918, 0x00000000, 0x00000000, 0x00000016, 0x0000000b}, - {0x00009924, 0xd00a8a01, 0xd00a8a01, 0xd00a8a0d, 0xd00a8a0d}, - {0x00009944, 0xefbc0000, 0xefbc0000, 0xefbc1010, 0xefbc1010}, - {0x00009960, 0x00000000, 0x00000000, 0x00000010, 0x00000010}, - {0x0000a960, 0x00000000, 0x00000000, 0x00000010, 0x00000010}, - {0x00009964, 0x00000000, 0x00000000, 0x00000210, 0x00000210}, - {0x0000c968, 0x00000200, 0x00000200, 0x000003ce, 0x000003ce}, - {0x000099b8, 0x00000000, 0x00000000, 0x0000001c, 0x0000001c}, - {0x000099bc, 0x00000000, 0x00000000, 0x00000c00, 0x00000c00}, - {0x000099c0, 0x00000000, 0x00000000, 0x05eea6d4, 0x05eea6d4}, - {0x0000a204, 0x00000440, 0x00000440, 0x00000444, 0x00000444}, - {0x0000a20c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b20c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a21c, 0x1803800a, 0x1803800a, 0x1883800a, 0x1883800a}, - {0x0000a230, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a250, 0x00000000, 0x00000000, 0x0004a000, 0x0004a000}, - {0x0000a358, 0x7999aa02, 0x7999aa02, 0x7999aa0e, 0x7999aa0e}, - {0x0000a3d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, -}; - -static const u32 ar9287Common_9287_1_1[][2] = { - /* Addr allmodes */ - {0x0000000c, 0x00000000}, - {0x00000030, 0x00020015}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000008}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00000054, 0x0000001f}, - {0x00000800, 0x00000000}, - {0x00000804, 0x00000000}, - {0x00000808, 0x00000000}, - {0x0000080c, 0x00000000}, - {0x00000810, 0x00000000}, - {0x00000814, 0x00000000}, - {0x00000818, 0x00000000}, - {0x0000081c, 0x00000000}, - {0x00000820, 0x00000000}, - {0x00000824, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x00001230, 0x00000000}, - {0x00001270, 0x00000000}, - {0x00001038, 0x00000000}, - {0x00001078, 0x00000000}, - {0x000010b8, 0x00000000}, - {0x000010f8, 0x00000000}, - {0x00001138, 0x00000000}, - {0x00001178, 0x00000000}, - {0x000011b8, 0x00000000}, - {0x000011f8, 0x00000000}, - {0x00001238, 0x00000000}, - {0x00001278, 0x00000000}, - {0x000012b8, 0x00000000}, - {0x000012f8, 0x00000000}, - {0x00001338, 0x00000000}, - {0x00001378, 0x00000000}, - {0x000013b8, 0x00000000}, - {0x000013f8, 0x00000000}, - {0x00001438, 0x00000000}, - {0x00001478, 0x00000000}, - {0x000014b8, 0x00000000}, - {0x000014f8, 0x00000000}, - {0x00001538, 0x00000000}, - {0x00001578, 0x00000000}, - {0x000015b8, 0x00000000}, - {0x000015f8, 0x00000000}, - {0x00001638, 0x00000000}, - {0x00001678, 0x00000000}, - {0x000016b8, 0x00000000}, - {0x000016f8, 0x00000000}, - {0x00001738, 0x00000000}, - {0x00001778, 0x00000000}, - {0x000017b8, 0x00000000}, - {0x000017f8, 0x00000000}, - {0x0000103c, 0x00000000}, - {0x0000107c, 0x00000000}, - {0x000010bc, 0x00000000}, - {0x000010fc, 0x00000000}, - {0x0000113c, 0x00000000}, - {0x0000117c, 0x00000000}, - {0x000011bc, 0x00000000}, - {0x000011fc, 0x00000000}, - {0x0000123c, 0x00000000}, - {0x0000127c, 0x00000000}, - {0x000012bc, 0x00000000}, - {0x000012fc, 0x00000000}, - {0x0000133c, 0x00000000}, - {0x0000137c, 0x00000000}, - {0x000013bc, 0x00000000}, - {0x000013fc, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00004030, 0x00000002}, - {0x0000403c, 0x00000002}, - {0x00004024, 0x0000001f}, - {0x00004060, 0x00000000}, - {0x00004064, 0x00000000}, - {0x00007010, 0x00000033}, - {0x00007020, 0x00000000}, - {0x00007034, 0x00000002}, - {0x00007038, 0x000004c2}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008018, 0x00000700}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00000000}, - {0x00008048, 0x40000000}, - {0x00008054, 0x00000000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x00008070, 0x00000000}, - {0x000080c0, 0x2a80001a}, - {0x000080c4, 0x05dc01e0}, - {0x000080c8, 0x1f402710}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00001e00}, - {0x000080d4, 0x00000000}, - {0x000080d8, 0x00400000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x003f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080f8, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00020000}, - {0x00008104, 0x00000001}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000168}, - {0x00008118, 0x000100aa}, - {0x0000811c, 0x00003210}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x00000000}, - {0x00008144, 0xffffffff}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x00008170, 0x18487320}, - {0x00008174, 0xfaa4fa50}, - {0x00008178, 0x00000100}, - {0x0000817c, 0x00000000}, - {0x000081c0, 0x00000000}, - {0x000081c4, 0x00000000}, - {0x000081d4, 0x00000000}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008200, 0x00000000}, - {0x00008204, 0x00000000}, - {0x00008208, 0x00000000}, - {0x0000820c, 0x00000000}, - {0x00008210, 0x00000000}, - {0x00008214, 0x00000000}, - {0x00008218, 0x00000000}, - {0x0000821c, 0x00000000}, - {0x00008220, 0x00000000}, - {0x00008224, 0x00000000}, - {0x00008228, 0x00000000}, - {0x0000822c, 0x00000000}, - {0x00008230, 0x00000000}, - {0x00008234, 0x00000000}, - {0x00008238, 0x00000000}, - {0x0000823c, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008244, 0x0010f400}, - {0x00008248, 0x00000100}, - {0x0000824c, 0x0001e800}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x400000ff}, - {0x00008260, 0x00080922}, - {0x00008264, 0x88a00010}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000000}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x000000ff}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x0000829c, 0x00000000}, - {0x00008300, 0x00000040}, - {0x00008314, 0x00000000}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x00000007}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000e00}, - {0x00008338, 0x00ff0000}, - {0x0000833c, 0x00000000}, - {0x00008340, 0x000107ff}, - {0x00008344, 0x01c81043}, - {0x00008360, 0xffffffff}, - {0x00008364, 0xffffffff}, - {0x00008368, 0x00000000}, - {0x00008370, 0x00000000}, - {0x00008374, 0x000000ff}, - {0x00008378, 0x00000000}, - {0x0000837c, 0x00000000}, - {0x00008380, 0xffffffff}, - {0x00008384, 0xffffffff}, - {0x00008390, 0x0fffffff}, - {0x00008394, 0x0fffffff}, - {0x00008398, 0x00000000}, - {0x0000839c, 0x00000000}, - {0x000083a0, 0x00000000}, - {0x00009808, 0x00000000}, - {0x0000980c, 0xafe68e30}, - {0x00009810, 0xfd14e000}, - {0x00009814, 0x9c0a9f6b}, - {0x0000981c, 0x00000000}, - {0x0000982c, 0x0000a000}, - {0x00009830, 0x00000000}, - {0x0000983c, 0x00200400}, - {0x0000984c, 0x0040233c}, - {0x0000a84c, 0x0040233c}, - {0x00009854, 0x00000044}, - {0x00009900, 0x00000000}, - {0x00009904, 0x00000000}, - {0x00009908, 0x00000000}, - {0x0000990c, 0x00000000}, - {0x00009910, 0x10002310}, - {0x0000991c, 0x10000fff}, - {0x00009920, 0x04900000}, - {0x0000a920, 0x04900000}, - {0x00009928, 0x00000001}, - {0x0000992c, 0x00000004}, - {0x00009930, 0x00000000}, - {0x0000a930, 0x00000000}, - {0x00009934, 0x1e1f2022}, - {0x00009938, 0x0a0b0c0d}, - {0x0000993c, 0x00000000}, - {0x00009948, 0x9280c00a}, - {0x0000994c, 0x00020028}, - {0x00009954, 0x5f3ca3de}, - {0x00009958, 0x0108ecff}, - {0x00009940, 0x14750604}, - {0x0000c95c, 0x004b6a8e}, - {0x00009970, 0x990bb514}, - {0x00009974, 0x00000000}, - {0x00009978, 0x00000001}, - {0x0000997c, 0x00000000}, - {0x000099a0, 0x00000000}, - {0x000099a4, 0x00000001}, - {0x000099a8, 0x201fff00}, - {0x000099ac, 0x0c6f0000}, - {0x000099b0, 0x03051000}, - {0x000099b4, 0x00000820}, - {0x000099c4, 0x06336f77}, - {0x000099c8, 0x6af6532f}, - {0x000099cc, 0x08f186c8}, - {0x000099d0, 0x00046384}, - {0x000099dc, 0x00000000}, - {0x000099e0, 0x00000000}, - {0x000099e4, 0xaaaaaaaa}, - {0x000099e8, 0x3c466478}, - {0x000099ec, 0x0cc80caa}, - {0x000099f0, 0x00000000}, - {0x000099fc, 0x00001042}, - {0x0000a208, 0x803e4788}, - {0x0000a210, 0x4080a333}, - {0x0000a214, 0x40206c10}, - {0x0000a218, 0x009c4060}, - {0x0000a220, 0x01834061}, - {0x0000a224, 0x00000400}, - {0x0000a228, 0x000003b5}, - {0x0000a22c, 0x233f7180}, - {0x0000a234, 0x20202020}, - {0x0000a238, 0x20202020}, - {0x0000a23c, 0x13c889af}, - {0x0000a240, 0x38490a20}, - {0x0000a244, 0x00000000}, - {0x0000a248, 0xfffffffc}, - {0x0000a24c, 0x00000000}, - {0x0000a254, 0x00000000}, - {0x0000a258, 0x0cdbd380}, - {0x0000a25c, 0x0f0f0f01}, - {0x0000a260, 0xdfa91f01}, - {0x0000a264, 0x00418a11}, - {0x0000b264, 0x00418a11}, - {0x0000a268, 0x00000000}, - {0x0000a26c, 0x0e79e5c6}, - {0x0000b26c, 0x0e79e5c6}, - {0x0000d270, 0x00820820}, - {0x0000a278, 0x1ce739ce}, - {0x0000a27c, 0x050701ce}, - {0x0000d35c, 0x07ffffef}, - {0x0000d360, 0x0fffffe7}, - {0x0000d364, 0x17ffffe5}, - {0x0000d368, 0x1fffffe4}, - {0x0000d36c, 0x37ffffe3}, - {0x0000d370, 0x3fffffe3}, - {0x0000d374, 0x57ffffe3}, - {0x0000d378, 0x5fffffe2}, - {0x0000d37c, 0x7fffffe2}, - {0x0000d380, 0x7f3c7bba}, - {0x0000d384, 0xf3307ff0}, - {0x0000a388, 0x0c000000}, - {0x0000a38c, 0x20202020}, - {0x0000a390, 0x20202020}, - {0x0000a394, 0x1ce739ce}, - {0x0000a398, 0x000001ce}, - {0x0000b398, 0x000001ce}, - {0x0000a39c, 0x00000001}, - {0x0000a3c8, 0x00000246}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3dc, 0x1ce739ce}, - {0x0000a3e0, 0x000001ce}, - {0x0000a3e4, 0x00000000}, - {0x0000a3e8, 0x18c43433}, - {0x0000a3ec, 0x00f70081}, - {0x0000a3f0, 0x01036a1e}, - {0x0000a3f4, 0x00000000}, - {0x0000b3f4, 0x00000000}, - {0x0000a7d8, 0x000003f1}, - {0x00007800, 0x00000800}, - {0x00007804, 0x6c35ffd2}, - {0x00007808, 0x6db6c000}, - {0x0000780c, 0x6db6cb30}, - {0x00007810, 0x6db6cb6c}, - {0x00007814, 0x0501e200}, - {0x00007818, 0x0094128d}, - {0x0000781c, 0x976ee392}, - {0x00007820, 0xf75ff6fc}, - {0x00007824, 0x00040000}, - {0x00007828, 0xdb003012}, - {0x0000782c, 0x04924914}, - {0x00007830, 0x21084210}, - {0x00007834, 0x00140000}, - {0x00007838, 0x0e4548d8}, - {0x0000783c, 0x54214514}, - {0x00007840, 0x02025830}, - {0x00007844, 0x71c0d388}, - {0x00007848, 0x934934a8}, - {0x00007850, 0x00000000}, - {0x00007854, 0x00000800}, - {0x00007858, 0x6c35ffd2}, - {0x0000785c, 0x6db6c000}, - {0x00007860, 0x6db6cb30}, - {0x00007864, 0x6db6cb6c}, - {0x00007868, 0x0501e200}, - {0x0000786c, 0x0094128d}, - {0x00007870, 0x976ee392}, - {0x00007874, 0xf75ff6fc}, - {0x00007878, 0x00040000}, - {0x0000787c, 0xdb003012}, - {0x00007880, 0x04924914}, - {0x00007884, 0x21084210}, - {0x00007888, 0x001b6db0}, - {0x0000788c, 0x00376b63}, - {0x00007890, 0x06db6db6}, - {0x00007894, 0x006d8000}, - {0x00007898, 0x48100000}, - {0x0000789c, 0x00000000}, - {0x000078a0, 0x08000000}, - {0x000078a4, 0x0007ffd8}, - {0x000078a8, 0x0007ffd8}, - {0x000078ac, 0x001c0020}, - {0x000078b0, 0x00060aeb}, - {0x000078b4, 0x40008080}, - {0x000078b8, 0x2a850160}, -}; - -static const u32 ar9287Common_normal_cck_fir_coeff_9287_1_1[][2] = { - /* Addr allmodes */ - {0x0000a1f4, 0x00fffeff}, - {0x0000a1f8, 0x00f5f9ff}, - {0x0000a1fc, 0xb79f6427}, -}; - -static const u32 ar9287Common_japan_2484_cck_fir_coeff_9287_1_1[][2] = { - /* Addr allmodes */ - {0x0000a1f4, 0x00000000}, - {0x0000a1f8, 0xefff0301}, - {0x0000a1fc, 0xca9228ee}, -}; - -static const u32 ar9287Modes_tx_gain_9287_1_1[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a300, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a304, 0x00000000, 0x00000000, 0x00004002, 0x00004002}, - {0x0000a308, 0x00000000, 0x00000000, 0x00008004, 0x00008004}, - {0x0000a30c, 0x00000000, 0x00000000, 0x0000c00a, 0x0000c00a}, - {0x0000a310, 0x00000000, 0x00000000, 0x0001000c, 0x0001000c}, - {0x0000a314, 0x00000000, 0x00000000, 0x0001420b, 0x0001420b}, - {0x0000a318, 0x00000000, 0x00000000, 0x0001824a, 0x0001824a}, - {0x0000a31c, 0x00000000, 0x00000000, 0x0001c44a, 0x0001c44a}, - {0x0000a320, 0x00000000, 0x00000000, 0x0002064a, 0x0002064a}, - {0x0000a324, 0x00000000, 0x00000000, 0x0002484a, 0x0002484a}, - {0x0000a328, 0x00000000, 0x00000000, 0x00028a4a, 0x00028a4a}, - {0x0000a32c, 0x00000000, 0x00000000, 0x0002cc4a, 0x0002cc4a}, - {0x0000a330, 0x00000000, 0x00000000, 0x00030e4a, 0x00030e4a}, - {0x0000a334, 0x00000000, 0x00000000, 0x00034e8a, 0x00034e8a}, - {0x0000a338, 0x00000000, 0x00000000, 0x00038e8c, 0x00038e8c}, - {0x0000a33c, 0x00000000, 0x00000000, 0x0003cecc, 0x0003cecc}, - {0x0000a340, 0x00000000, 0x00000000, 0x00040ed4, 0x00040ed4}, - {0x0000a344, 0x00000000, 0x00000000, 0x00044edc, 0x00044edc}, - {0x0000a348, 0x00000000, 0x00000000, 0x00048ede, 0x00048ede}, - {0x0000a34c, 0x00000000, 0x00000000, 0x0004cf1e, 0x0004cf1e}, - {0x0000a350, 0x00000000, 0x00000000, 0x00050f5e, 0x00050f5e}, - {0x0000a354, 0x00000000, 0x00000000, 0x00054f9e, 0x00054f9e}, - {0x0000a780, 0x00000000, 0x00000000, 0x00000062, 0x00000062}, - {0x0000a784, 0x00000000, 0x00000000, 0x00004064, 0x00004064}, - {0x0000a788, 0x00000000, 0x00000000, 0x000080a4, 0x000080a4}, - {0x0000a78c, 0x00000000, 0x00000000, 0x0000c0aa, 0x0000c0aa}, - {0x0000a790, 0x00000000, 0x00000000, 0x000100ac, 0x000100ac}, - {0x0000a794, 0x00000000, 0x00000000, 0x000140b4, 0x000140b4}, - {0x0000a798, 0x00000000, 0x00000000, 0x000180f4, 0x000180f4}, - {0x0000a79c, 0x00000000, 0x00000000, 0x0001c134, 0x0001c134}, - {0x0000a7a0, 0x00000000, 0x00000000, 0x00020174, 0x00020174}, - {0x0000a7a4, 0x00000000, 0x00000000, 0x0002417c, 0x0002417c}, - {0x0000a7a8, 0x00000000, 0x00000000, 0x0002817e, 0x0002817e}, - {0x0000a7ac, 0x00000000, 0x00000000, 0x0002c1be, 0x0002c1be}, - {0x0000a7b0, 0x00000000, 0x00000000, 0x000301fe, 0x000301fe}, - {0x0000a7b4, 0x00000000, 0x00000000, 0x000301fe, 0x000301fe}, - {0x0000a7b8, 0x00000000, 0x00000000, 0x000301fe, 0x000301fe}, - {0x0000a7bc, 0x00000000, 0x00000000, 0x000301fe, 0x000301fe}, - {0x0000a7c0, 0x00000000, 0x00000000, 0x000301fe, 0x000301fe}, - {0x0000a7c4, 0x00000000, 0x00000000, 0x000301fe, 0x000301fe}, - {0x0000a7c8, 0x00000000, 0x00000000, 0x000301fe, 0x000301fe}, - {0x0000a7cc, 0x00000000, 0x00000000, 0x000301fe, 0x000301fe}, - {0x0000a7d0, 0x00000000, 0x00000000, 0x000301fe, 0x000301fe}, - {0x0000a7d4, 0x00000000, 0x00000000, 0x000301fe, 0x000301fe}, - {0x0000a274, 0x0a180000, 0x0a180000, 0x0a1aa000, 0x0a1aa000}, -}; - -static const u32 ar9287Modes_rx_gain_9287_1_1[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009a00, 0x00000000, 0x00000000, 0x0000a120, 0x0000a120}, - {0x00009a04, 0x00000000, 0x00000000, 0x0000a124, 0x0000a124}, - {0x00009a08, 0x00000000, 0x00000000, 0x0000a128, 0x0000a128}, - {0x00009a0c, 0x00000000, 0x00000000, 0x0000a12c, 0x0000a12c}, - {0x00009a10, 0x00000000, 0x00000000, 0x0000a130, 0x0000a130}, - {0x00009a14, 0x00000000, 0x00000000, 0x0000a194, 0x0000a194}, - {0x00009a18, 0x00000000, 0x00000000, 0x0000a198, 0x0000a198}, - {0x00009a1c, 0x00000000, 0x00000000, 0x0000a20c, 0x0000a20c}, - {0x00009a20, 0x00000000, 0x00000000, 0x0000a210, 0x0000a210}, - {0x00009a24, 0x00000000, 0x00000000, 0x0000a284, 0x0000a284}, - {0x00009a28, 0x00000000, 0x00000000, 0x0000a288, 0x0000a288}, - {0x00009a2c, 0x00000000, 0x00000000, 0x0000a28c, 0x0000a28c}, - {0x00009a30, 0x00000000, 0x00000000, 0x0000a290, 0x0000a290}, - {0x00009a34, 0x00000000, 0x00000000, 0x0000a294, 0x0000a294}, - {0x00009a38, 0x00000000, 0x00000000, 0x0000a2a0, 0x0000a2a0}, - {0x00009a3c, 0x00000000, 0x00000000, 0x0000a2a4, 0x0000a2a4}, - {0x00009a40, 0x00000000, 0x00000000, 0x0000a2a8, 0x0000a2a8}, - {0x00009a44, 0x00000000, 0x00000000, 0x0000a2ac, 0x0000a2ac}, - {0x00009a48, 0x00000000, 0x00000000, 0x0000a2b0, 0x0000a2b0}, - {0x00009a4c, 0x00000000, 0x00000000, 0x0000a2b4, 0x0000a2b4}, - {0x00009a50, 0x00000000, 0x00000000, 0x0000a2b8, 0x0000a2b8}, - {0x00009a54, 0x00000000, 0x00000000, 0x0000a2c4, 0x0000a2c4}, - {0x00009a58, 0x00000000, 0x00000000, 0x0000a708, 0x0000a708}, - {0x00009a5c, 0x00000000, 0x00000000, 0x0000a70c, 0x0000a70c}, - {0x00009a60, 0x00000000, 0x00000000, 0x0000a710, 0x0000a710}, - {0x00009a64, 0x00000000, 0x00000000, 0x0000ab04, 0x0000ab04}, - {0x00009a68, 0x00000000, 0x00000000, 0x0000ab08, 0x0000ab08}, - {0x00009a6c, 0x00000000, 0x00000000, 0x0000ab0c, 0x0000ab0c}, - {0x00009a70, 0x00000000, 0x00000000, 0x0000ab10, 0x0000ab10}, - {0x00009a74, 0x00000000, 0x00000000, 0x0000ab14, 0x0000ab14}, - {0x00009a78, 0x00000000, 0x00000000, 0x0000ab18, 0x0000ab18}, - {0x00009a7c, 0x00000000, 0x00000000, 0x0000ab8c, 0x0000ab8c}, - {0x00009a80, 0x00000000, 0x00000000, 0x0000ab90, 0x0000ab90}, - {0x00009a84, 0x00000000, 0x00000000, 0x0000ab94, 0x0000ab94}, - {0x00009a88, 0x00000000, 0x00000000, 0x0000ab98, 0x0000ab98}, - {0x00009a8c, 0x00000000, 0x00000000, 0x0000aba4, 0x0000aba4}, - {0x00009a90, 0x00000000, 0x00000000, 0x0000aba8, 0x0000aba8}, - {0x00009a94, 0x00000000, 0x00000000, 0x0000cb04, 0x0000cb04}, - {0x00009a98, 0x00000000, 0x00000000, 0x0000cb08, 0x0000cb08}, - {0x00009a9c, 0x00000000, 0x00000000, 0x0000cb0c, 0x0000cb0c}, - {0x00009aa0, 0x00000000, 0x00000000, 0x0000cb10, 0x0000cb10}, - {0x00009aa4, 0x00000000, 0x00000000, 0x0000cb14, 0x0000cb14}, - {0x00009aa8, 0x00000000, 0x00000000, 0x0000cb18, 0x0000cb18}, - {0x00009aac, 0x00000000, 0x00000000, 0x0000cb8c, 0x0000cb8c}, - {0x00009ab0, 0x00000000, 0x00000000, 0x0000cb90, 0x0000cb90}, - {0x00009ab4, 0x00000000, 0x00000000, 0x0000cf18, 0x0000cf18}, - {0x00009ab8, 0x00000000, 0x00000000, 0x0000cf24, 0x0000cf24}, - {0x00009abc, 0x00000000, 0x00000000, 0x0000cf28, 0x0000cf28}, - {0x00009ac0, 0x00000000, 0x00000000, 0x0000d314, 0x0000d314}, - {0x00009ac4, 0x00000000, 0x00000000, 0x0000d318, 0x0000d318}, - {0x00009ac8, 0x00000000, 0x00000000, 0x0000d38c, 0x0000d38c}, - {0x00009acc, 0x00000000, 0x00000000, 0x0000d390, 0x0000d390}, - {0x00009ad0, 0x00000000, 0x00000000, 0x0000d394, 0x0000d394}, - {0x00009ad4, 0x00000000, 0x00000000, 0x0000d398, 0x0000d398}, - {0x00009ad8, 0x00000000, 0x00000000, 0x0000d3a4, 0x0000d3a4}, - {0x00009adc, 0x00000000, 0x00000000, 0x0000d3a8, 0x0000d3a8}, - {0x00009ae0, 0x00000000, 0x00000000, 0x0000d3ac, 0x0000d3ac}, - {0x00009ae4, 0x00000000, 0x00000000, 0x0000d3b0, 0x0000d3b0}, - {0x00009ae8, 0x00000000, 0x00000000, 0x0000f380, 0x0000f380}, - {0x00009aec, 0x00000000, 0x00000000, 0x0000f384, 0x0000f384}, - {0x00009af0, 0x00000000, 0x00000000, 0x0000f388, 0x0000f388}, - {0x00009af4, 0x00000000, 0x00000000, 0x0000f710, 0x0000f710}, - {0x00009af8, 0x00000000, 0x00000000, 0x0000f714, 0x0000f714}, - {0x00009afc, 0x00000000, 0x00000000, 0x0000f718, 0x0000f718}, - {0x00009b00, 0x00000000, 0x00000000, 0x0000fb10, 0x0000fb10}, - {0x00009b04, 0x00000000, 0x00000000, 0x0000fb14, 0x0000fb14}, - {0x00009b08, 0x00000000, 0x00000000, 0x0000fb18, 0x0000fb18}, - {0x00009b0c, 0x00000000, 0x00000000, 0x0000fb8c, 0x0000fb8c}, - {0x00009b10, 0x00000000, 0x00000000, 0x0000fb90, 0x0000fb90}, - {0x00009b14, 0x00000000, 0x00000000, 0x0000fb94, 0x0000fb94}, - {0x00009b18, 0x00000000, 0x00000000, 0x0000ff8c, 0x0000ff8c}, - {0x00009b1c, 0x00000000, 0x00000000, 0x0000ff90, 0x0000ff90}, - {0x00009b20, 0x00000000, 0x00000000, 0x0000ff94, 0x0000ff94}, - {0x00009b24, 0x00000000, 0x00000000, 0x0000ffa0, 0x0000ffa0}, - {0x00009b28, 0x00000000, 0x00000000, 0x0000ffa4, 0x0000ffa4}, - {0x00009b2c, 0x00000000, 0x00000000, 0x0000ffa8, 0x0000ffa8}, - {0x00009b30, 0x00000000, 0x00000000, 0x0000ffac, 0x0000ffac}, - {0x00009b34, 0x00000000, 0x00000000, 0x0000ffb0, 0x0000ffb0}, - {0x00009b38, 0x00000000, 0x00000000, 0x0000ffb4, 0x0000ffb4}, - {0x00009b3c, 0x00000000, 0x00000000, 0x0000ffa1, 0x0000ffa1}, - {0x00009b40, 0x00000000, 0x00000000, 0x0000ffa5, 0x0000ffa5}, - {0x00009b44, 0x00000000, 0x00000000, 0x0000ffa9, 0x0000ffa9}, - {0x00009b48, 0x00000000, 0x00000000, 0x0000ffad, 0x0000ffad}, - {0x00009b4c, 0x00000000, 0x00000000, 0x0000ffb1, 0x0000ffb1}, - {0x00009b50, 0x00000000, 0x00000000, 0x0000ffb5, 0x0000ffb5}, - {0x00009b54, 0x00000000, 0x00000000, 0x0000ffb9, 0x0000ffb9}, - {0x00009b58, 0x00000000, 0x00000000, 0x0000ffc5, 0x0000ffc5}, - {0x00009b5c, 0x00000000, 0x00000000, 0x0000ffc9, 0x0000ffc9}, - {0x00009b60, 0x00000000, 0x00000000, 0x0000ffcd, 0x0000ffcd}, - {0x00009b64, 0x00000000, 0x00000000, 0x0000ffd1, 0x0000ffd1}, - {0x00009b68, 0x00000000, 0x00000000, 0x0000ffd5, 0x0000ffd5}, - {0x00009b6c, 0x00000000, 0x00000000, 0x0000ffc2, 0x0000ffc2}, - {0x00009b70, 0x00000000, 0x00000000, 0x0000ffc6, 0x0000ffc6}, - {0x00009b74, 0x00000000, 0x00000000, 0x0000ffca, 0x0000ffca}, - {0x00009b78, 0x00000000, 0x00000000, 0x0000ffce, 0x0000ffce}, - {0x00009b7c, 0x00000000, 0x00000000, 0x0000ffd2, 0x0000ffd2}, - {0x00009b80, 0x00000000, 0x00000000, 0x0000ffd6, 0x0000ffd6}, - {0x00009b84, 0x00000000, 0x00000000, 0x0000ffda, 0x0000ffda}, - {0x00009b88, 0x00000000, 0x00000000, 0x0000ffc7, 0x0000ffc7}, - {0x00009b8c, 0x00000000, 0x00000000, 0x0000ffcb, 0x0000ffcb}, - {0x00009b90, 0x00000000, 0x00000000, 0x0000ffcf, 0x0000ffcf}, - {0x00009b94, 0x00000000, 0x00000000, 0x0000ffd3, 0x0000ffd3}, - {0x00009b98, 0x00000000, 0x00000000, 0x0000ffd7, 0x0000ffd7}, - {0x00009b9c, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009ba0, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009ba4, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009ba8, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bac, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bb0, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bb4, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bb8, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bbc, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bc0, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bc4, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bc8, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bcc, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bd0, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bd4, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bd8, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bdc, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009be0, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009be4, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009be8, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bec, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bf0, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bf4, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bf8, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009bfc, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000aa00, 0x00000000, 0x00000000, 0x0000a120, 0x0000a120}, - {0x0000aa04, 0x00000000, 0x00000000, 0x0000a124, 0x0000a124}, - {0x0000aa08, 0x00000000, 0x00000000, 0x0000a128, 0x0000a128}, - {0x0000aa0c, 0x00000000, 0x00000000, 0x0000a12c, 0x0000a12c}, - {0x0000aa10, 0x00000000, 0x00000000, 0x0000a130, 0x0000a130}, - {0x0000aa14, 0x00000000, 0x00000000, 0x0000a194, 0x0000a194}, - {0x0000aa18, 0x00000000, 0x00000000, 0x0000a198, 0x0000a198}, - {0x0000aa1c, 0x00000000, 0x00000000, 0x0000a20c, 0x0000a20c}, - {0x0000aa20, 0x00000000, 0x00000000, 0x0000a210, 0x0000a210}, - {0x0000aa24, 0x00000000, 0x00000000, 0x0000a284, 0x0000a284}, - {0x0000aa28, 0x00000000, 0x00000000, 0x0000a288, 0x0000a288}, - {0x0000aa2c, 0x00000000, 0x00000000, 0x0000a28c, 0x0000a28c}, - {0x0000aa30, 0x00000000, 0x00000000, 0x0000a290, 0x0000a290}, - {0x0000aa34, 0x00000000, 0x00000000, 0x0000a294, 0x0000a294}, - {0x0000aa38, 0x00000000, 0x00000000, 0x0000a2a0, 0x0000a2a0}, - {0x0000aa3c, 0x00000000, 0x00000000, 0x0000a2a4, 0x0000a2a4}, - {0x0000aa40, 0x00000000, 0x00000000, 0x0000a2a8, 0x0000a2a8}, - {0x0000aa44, 0x00000000, 0x00000000, 0x0000a2ac, 0x0000a2ac}, - {0x0000aa48, 0x00000000, 0x00000000, 0x0000a2b0, 0x0000a2b0}, - {0x0000aa4c, 0x00000000, 0x00000000, 0x0000a2b4, 0x0000a2b4}, - {0x0000aa50, 0x00000000, 0x00000000, 0x0000a2b8, 0x0000a2b8}, - {0x0000aa54, 0x00000000, 0x00000000, 0x0000a2c4, 0x0000a2c4}, - {0x0000aa58, 0x00000000, 0x00000000, 0x0000a708, 0x0000a708}, - {0x0000aa5c, 0x00000000, 0x00000000, 0x0000a70c, 0x0000a70c}, - {0x0000aa60, 0x00000000, 0x00000000, 0x0000a710, 0x0000a710}, - {0x0000aa64, 0x00000000, 0x00000000, 0x0000ab04, 0x0000ab04}, - {0x0000aa68, 0x00000000, 0x00000000, 0x0000ab08, 0x0000ab08}, - {0x0000aa6c, 0x00000000, 0x00000000, 0x0000ab0c, 0x0000ab0c}, - {0x0000aa70, 0x00000000, 0x00000000, 0x0000ab10, 0x0000ab10}, - {0x0000aa74, 0x00000000, 0x00000000, 0x0000ab14, 0x0000ab14}, - {0x0000aa78, 0x00000000, 0x00000000, 0x0000ab18, 0x0000ab18}, - {0x0000aa7c, 0x00000000, 0x00000000, 0x0000ab8c, 0x0000ab8c}, - {0x0000aa80, 0x00000000, 0x00000000, 0x0000ab90, 0x0000ab90}, - {0x0000aa84, 0x00000000, 0x00000000, 0x0000ab94, 0x0000ab94}, - {0x0000aa88, 0x00000000, 0x00000000, 0x0000ab98, 0x0000ab98}, - {0x0000aa8c, 0x00000000, 0x00000000, 0x0000aba4, 0x0000aba4}, - {0x0000aa90, 0x00000000, 0x00000000, 0x0000aba8, 0x0000aba8}, - {0x0000aa94, 0x00000000, 0x00000000, 0x0000cb04, 0x0000cb04}, - {0x0000aa98, 0x00000000, 0x00000000, 0x0000cb08, 0x0000cb08}, - {0x0000aa9c, 0x00000000, 0x00000000, 0x0000cb0c, 0x0000cb0c}, - {0x0000aaa0, 0x00000000, 0x00000000, 0x0000cb10, 0x0000cb10}, - {0x0000aaa4, 0x00000000, 0x00000000, 0x0000cb14, 0x0000cb14}, - {0x0000aaa8, 0x00000000, 0x00000000, 0x0000cb18, 0x0000cb18}, - {0x0000aaac, 0x00000000, 0x00000000, 0x0000cb8c, 0x0000cb8c}, - {0x0000aab0, 0x00000000, 0x00000000, 0x0000cb90, 0x0000cb90}, - {0x0000aab4, 0x00000000, 0x00000000, 0x0000cf18, 0x0000cf18}, - {0x0000aab8, 0x00000000, 0x00000000, 0x0000cf24, 0x0000cf24}, - {0x0000aabc, 0x00000000, 0x00000000, 0x0000cf28, 0x0000cf28}, - {0x0000aac0, 0x00000000, 0x00000000, 0x0000d314, 0x0000d314}, - {0x0000aac4, 0x00000000, 0x00000000, 0x0000d318, 0x0000d318}, - {0x0000aac8, 0x00000000, 0x00000000, 0x0000d38c, 0x0000d38c}, - {0x0000aacc, 0x00000000, 0x00000000, 0x0000d390, 0x0000d390}, - {0x0000aad0, 0x00000000, 0x00000000, 0x0000d394, 0x0000d394}, - {0x0000aad4, 0x00000000, 0x00000000, 0x0000d398, 0x0000d398}, - {0x0000aad8, 0x00000000, 0x00000000, 0x0000d3a4, 0x0000d3a4}, - {0x0000aadc, 0x00000000, 0x00000000, 0x0000d3a8, 0x0000d3a8}, - {0x0000aae0, 0x00000000, 0x00000000, 0x0000d3ac, 0x0000d3ac}, - {0x0000aae4, 0x00000000, 0x00000000, 0x0000d3b0, 0x0000d3b0}, - {0x0000aae8, 0x00000000, 0x00000000, 0x0000f380, 0x0000f380}, - {0x0000aaec, 0x00000000, 0x00000000, 0x0000f384, 0x0000f384}, - {0x0000aaf0, 0x00000000, 0x00000000, 0x0000f388, 0x0000f388}, - {0x0000aaf4, 0x00000000, 0x00000000, 0x0000f710, 0x0000f710}, - {0x0000aaf8, 0x00000000, 0x00000000, 0x0000f714, 0x0000f714}, - {0x0000aafc, 0x00000000, 0x00000000, 0x0000f718, 0x0000f718}, - {0x0000ab00, 0x00000000, 0x00000000, 0x0000fb10, 0x0000fb10}, - {0x0000ab04, 0x00000000, 0x00000000, 0x0000fb14, 0x0000fb14}, - {0x0000ab08, 0x00000000, 0x00000000, 0x0000fb18, 0x0000fb18}, - {0x0000ab0c, 0x00000000, 0x00000000, 0x0000fb8c, 0x0000fb8c}, - {0x0000ab10, 0x00000000, 0x00000000, 0x0000fb90, 0x0000fb90}, - {0x0000ab14, 0x00000000, 0x00000000, 0x0000fb94, 0x0000fb94}, - {0x0000ab18, 0x00000000, 0x00000000, 0x0000ff8c, 0x0000ff8c}, - {0x0000ab1c, 0x00000000, 0x00000000, 0x0000ff90, 0x0000ff90}, - {0x0000ab20, 0x00000000, 0x00000000, 0x0000ff94, 0x0000ff94}, - {0x0000ab24, 0x00000000, 0x00000000, 0x0000ffa0, 0x0000ffa0}, - {0x0000ab28, 0x00000000, 0x00000000, 0x0000ffa4, 0x0000ffa4}, - {0x0000ab2c, 0x00000000, 0x00000000, 0x0000ffa8, 0x0000ffa8}, - {0x0000ab30, 0x00000000, 0x00000000, 0x0000ffac, 0x0000ffac}, - {0x0000ab34, 0x00000000, 0x00000000, 0x0000ffb0, 0x0000ffb0}, - {0x0000ab38, 0x00000000, 0x00000000, 0x0000ffb4, 0x0000ffb4}, - {0x0000ab3c, 0x00000000, 0x00000000, 0x0000ffa1, 0x0000ffa1}, - {0x0000ab40, 0x00000000, 0x00000000, 0x0000ffa5, 0x0000ffa5}, - {0x0000ab44, 0x00000000, 0x00000000, 0x0000ffa9, 0x0000ffa9}, - {0x0000ab48, 0x00000000, 0x00000000, 0x0000ffad, 0x0000ffad}, - {0x0000ab4c, 0x00000000, 0x00000000, 0x0000ffb1, 0x0000ffb1}, - {0x0000ab50, 0x00000000, 0x00000000, 0x0000ffb5, 0x0000ffb5}, - {0x0000ab54, 0x00000000, 0x00000000, 0x0000ffb9, 0x0000ffb9}, - {0x0000ab58, 0x00000000, 0x00000000, 0x0000ffc5, 0x0000ffc5}, - {0x0000ab5c, 0x00000000, 0x00000000, 0x0000ffc9, 0x0000ffc9}, - {0x0000ab60, 0x00000000, 0x00000000, 0x0000ffcd, 0x0000ffcd}, - {0x0000ab64, 0x00000000, 0x00000000, 0x0000ffd1, 0x0000ffd1}, - {0x0000ab68, 0x00000000, 0x00000000, 0x0000ffd5, 0x0000ffd5}, - {0x0000ab6c, 0x00000000, 0x00000000, 0x0000ffc2, 0x0000ffc2}, - {0x0000ab70, 0x00000000, 0x00000000, 0x0000ffc6, 0x0000ffc6}, - {0x0000ab74, 0x00000000, 0x00000000, 0x0000ffca, 0x0000ffca}, - {0x0000ab78, 0x00000000, 0x00000000, 0x0000ffce, 0x0000ffce}, - {0x0000ab7c, 0x00000000, 0x00000000, 0x0000ffd2, 0x0000ffd2}, - {0x0000ab80, 0x00000000, 0x00000000, 0x0000ffd6, 0x0000ffd6}, - {0x0000ab84, 0x00000000, 0x00000000, 0x0000ffda, 0x0000ffda}, - {0x0000ab88, 0x00000000, 0x00000000, 0x0000ffc7, 0x0000ffc7}, - {0x0000ab8c, 0x00000000, 0x00000000, 0x0000ffcb, 0x0000ffcb}, - {0x0000ab90, 0x00000000, 0x00000000, 0x0000ffcf, 0x0000ffcf}, - {0x0000ab94, 0x00000000, 0x00000000, 0x0000ffd3, 0x0000ffd3}, - {0x0000ab98, 0x00000000, 0x00000000, 0x0000ffd7, 0x0000ffd7}, - {0x0000ab9c, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000aba0, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000aba4, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000aba8, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abac, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abb0, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abb4, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abb8, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abbc, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abc0, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abc4, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abc8, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abcc, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abd0, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abd4, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abd8, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abdc, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abe0, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abe4, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abe8, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abec, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abf0, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abf4, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abf8, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x0000abfc, 0x00000000, 0x00000000, 0x0000ffdb, 0x0000ffdb}, - {0x00009848, 0x00000000, 0x00000000, 0x00001067, 0x00001067}, - {0x0000a848, 0x00000000, 0x00000000, 0x00001067, 0x00001067}, -}; - -static const u32 ar9271Modes_9271[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, - {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, - {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, - {0x000010f0, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, - {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b}, - {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, - {0x00009804, 0x00000300, 0x000003c4, 0x000003c4, 0x00000300}, - {0x00009820, 0x02020200, 0x02020200, 0x02020200, 0x02020200}, - {0x00009824, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, - {0x00009828, 0x3a020001, 0x3a020001, 0x3a020001, 0x3a020001}, - {0x00009834, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x00009838, 0x00000007, 0x00000007, 0x00000007, 0x00000007}, - {0x00009840, 0x206a012e, 0x206a012e, 0x206a012e, 0x206a012e}, - {0x00009844, 0x0372161e, 0x0372161e, 0x03721620, 0x03721620}, - {0x00009848, 0x00001066, 0x00001066, 0x00001053, 0x00001053}, - {0x0000a848, 0x00001066, 0x00001066, 0x00001053, 0x00001053}, - {0x00009850, 0x6d4000e2, 0x6d4000e2, 0x6d4000e2, 0x6d4000e2}, - {0x00009858, 0x7ec84d2e, 0x7ec84d2e, 0x7ec84d2e, 0x7ec84d2e}, - {0x0000985c, 0x3139605e, 0x3139605e, 0x3137605e, 0x3137605e}, - {0x00009860, 0x00058d18, 0x00058d18, 0x00058d18, 0x00058d18}, - {0x00009864, 0x0000fe00, 0x0000fe00, 0x0001ce00, 0x0001ce00}, - {0x00009868, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, - {0x0000986c, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, - {0x00009910, 0x30002310, 0x30002310, 0x30002310, 0x30002310}, - {0x00009914, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x00009918, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b}, - {0x00009924, 0xd00a8007, 0xd00a8007, 0xd00a800d, 0xd00a800d}, - {0x00009944, 0xffbc1010, 0xffbc1010, 0xffbc1020, 0xffbc1020}, - {0x00009960, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00009964, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x000099b8, 0x0000421c, 0x0000421c, 0x0000421c, 0x0000421c}, - {0x000099bc, 0x00000600, 0x00000600, 0x00000c00, 0x00000c00}, - {0x000099c0, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, - {0x000099c4, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77}, - {0x000099c8, 0x6af6532f, 0x6af6532f, 0x6af6532f, 0x6af6532f}, - {0x000099cc, 0x08f186c8, 0x08f186c8, 0x08f186c8, 0x08f186c8}, - {0x000099d0, 0x00046384, 0x00046384, 0x00046384, 0x00046384}, - {0x000099d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x000099d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00009a00, 0x00000000, 0x00000000, 0x00058084, 0x00058084}, - {0x00009a04, 0x00000000, 0x00000000, 0x00058088, 0x00058088}, - {0x00009a08, 0x00000000, 0x00000000, 0x0005808c, 0x0005808c}, - {0x00009a0c, 0x00000000, 0x00000000, 0x00058100, 0x00058100}, - {0x00009a10, 0x00000000, 0x00000000, 0x00058104, 0x00058104}, - {0x00009a14, 0x00000000, 0x00000000, 0x00058108, 0x00058108}, - {0x00009a18, 0x00000000, 0x00000000, 0x0005810c, 0x0005810c}, - {0x00009a1c, 0x00000000, 0x00000000, 0x00058110, 0x00058110}, - {0x00009a20, 0x00000000, 0x00000000, 0x00058114, 0x00058114}, - {0x00009a24, 0x00000000, 0x00000000, 0x00058180, 0x00058180}, - {0x00009a28, 0x00000000, 0x00000000, 0x00058184, 0x00058184}, - {0x00009a2c, 0x00000000, 0x00000000, 0x00058188, 0x00058188}, - {0x00009a30, 0x00000000, 0x00000000, 0x0005818c, 0x0005818c}, - {0x00009a34, 0x00000000, 0x00000000, 0x00058190, 0x00058190}, - {0x00009a38, 0x00000000, 0x00000000, 0x00058194, 0x00058194}, - {0x00009a3c, 0x00000000, 0x00000000, 0x000581a0, 0x000581a0}, - {0x00009a40, 0x00000000, 0x00000000, 0x0005820c, 0x0005820c}, - {0x00009a44, 0x00000000, 0x00000000, 0x000581a8, 0x000581a8}, - {0x00009a48, 0x00000000, 0x00000000, 0x00058284, 0x00058284}, - {0x00009a4c, 0x00000000, 0x00000000, 0x00058288, 0x00058288}, - {0x00009a50, 0x00000000, 0x00000000, 0x00058224, 0x00058224}, - {0x00009a54, 0x00000000, 0x00000000, 0x00058290, 0x00058290}, - {0x00009a58, 0x00000000, 0x00000000, 0x00058300, 0x00058300}, - {0x00009a5c, 0x00000000, 0x00000000, 0x00058304, 0x00058304}, - {0x00009a60, 0x00000000, 0x00000000, 0x00058308, 0x00058308}, - {0x00009a64, 0x00000000, 0x00000000, 0x0005830c, 0x0005830c}, - {0x00009a68, 0x00000000, 0x00000000, 0x00058380, 0x00058380}, - {0x00009a6c, 0x00000000, 0x00000000, 0x00058384, 0x00058384}, - {0x00009a70, 0x00000000, 0x00000000, 0x00068700, 0x00068700}, - {0x00009a74, 0x00000000, 0x00000000, 0x00068704, 0x00068704}, - {0x00009a78, 0x00000000, 0x00000000, 0x00068708, 0x00068708}, - {0x00009a7c, 0x00000000, 0x00000000, 0x0006870c, 0x0006870c}, - {0x00009a80, 0x00000000, 0x00000000, 0x00068780, 0x00068780}, - {0x00009a84, 0x00000000, 0x00000000, 0x00068784, 0x00068784}, - {0x00009a88, 0x00000000, 0x00000000, 0x00078b00, 0x00078b00}, - {0x00009a8c, 0x00000000, 0x00000000, 0x00078b04, 0x00078b04}, - {0x00009a90, 0x00000000, 0x00000000, 0x00078b08, 0x00078b08}, - {0x00009a94, 0x00000000, 0x00000000, 0x00078b0c, 0x00078b0c}, - {0x00009a98, 0x00000000, 0x00000000, 0x00078b80, 0x00078b80}, - {0x00009a9c, 0x00000000, 0x00000000, 0x00078b84, 0x00078b84}, - {0x00009aa0, 0x00000000, 0x00000000, 0x00078b88, 0x00078b88}, - {0x00009aa4, 0x00000000, 0x00000000, 0x00078b8c, 0x00078b8c}, - {0x00009aa8, 0x00000000, 0x00000000, 0x00078b90, 0x00078b90}, - {0x00009aac, 0x00000000, 0x00000000, 0x000caf80, 0x000caf80}, - {0x00009ab0, 0x00000000, 0x00000000, 0x000caf84, 0x000caf84}, - {0x00009ab4, 0x00000000, 0x00000000, 0x000caf88, 0x000caf88}, - {0x00009ab8, 0x00000000, 0x00000000, 0x000caf8c, 0x000caf8c}, - {0x00009abc, 0x00000000, 0x00000000, 0x000caf90, 0x000caf90}, - {0x00009ac0, 0x00000000, 0x00000000, 0x000db30c, 0x000db30c}, - {0x00009ac4, 0x00000000, 0x00000000, 0x000db310, 0x000db310}, - {0x00009ac8, 0x00000000, 0x00000000, 0x000db384, 0x000db384}, - {0x00009acc, 0x00000000, 0x00000000, 0x000db388, 0x000db388}, - {0x00009ad0, 0x00000000, 0x00000000, 0x000db324, 0x000db324}, - {0x00009ad4, 0x00000000, 0x00000000, 0x000eb704, 0x000eb704}, - {0x00009ad8, 0x00000000, 0x00000000, 0x000eb6a4, 0x000eb6a4}, - {0x00009adc, 0x00000000, 0x00000000, 0x000eb6a8, 0x000eb6a8}, - {0x00009ae0, 0x00000000, 0x00000000, 0x000eb710, 0x000eb710}, - {0x00009ae4, 0x00000000, 0x00000000, 0x000eb714, 0x000eb714}, - {0x00009ae8, 0x00000000, 0x00000000, 0x000eb720, 0x000eb720}, - {0x00009aec, 0x00000000, 0x00000000, 0x000eb724, 0x000eb724}, - {0x00009af0, 0x00000000, 0x00000000, 0x000eb728, 0x000eb728}, - {0x00009af4, 0x00000000, 0x00000000, 0x000eb72c, 0x000eb72c}, - {0x00009af8, 0x00000000, 0x00000000, 0x000eb7a0, 0x000eb7a0}, - {0x00009afc, 0x00000000, 0x00000000, 0x000eb7a4, 0x000eb7a4}, - {0x00009b00, 0x00000000, 0x00000000, 0x000eb7a8, 0x000eb7a8}, - {0x00009b04, 0x00000000, 0x00000000, 0x000eb7b0, 0x000eb7b0}, - {0x00009b08, 0x00000000, 0x00000000, 0x000eb7b4, 0x000eb7b4}, - {0x00009b0c, 0x00000000, 0x00000000, 0x000eb7b8, 0x000eb7b8}, - {0x00009b10, 0x00000000, 0x00000000, 0x000eb7a5, 0x000eb7a5}, - {0x00009b14, 0x00000000, 0x00000000, 0x000eb7a9, 0x000eb7a9}, - {0x00009b18, 0x00000000, 0x00000000, 0x000eb7ad, 0x000eb7ad}, - {0x00009b1c, 0x00000000, 0x00000000, 0x000eb7b1, 0x000eb7b1}, - {0x00009b20, 0x00000000, 0x00000000, 0x000eb7b5, 0x000eb7b5}, - {0x00009b24, 0x00000000, 0x00000000, 0x000eb7b9, 0x000eb7b9}, - {0x00009b28, 0x00000000, 0x00000000, 0x000eb7c5, 0x000eb7c5}, - {0x00009b2c, 0x00000000, 0x00000000, 0x000eb7c9, 0x000eb7c9}, - {0x00009b30, 0x00000000, 0x00000000, 0x000eb7d1, 0x000eb7d1}, - {0x00009b34, 0x00000000, 0x00000000, 0x000eb7d5, 0x000eb7d5}, - {0x00009b38, 0x00000000, 0x00000000, 0x000eb7d9, 0x000eb7d9}, - {0x00009b3c, 0x00000000, 0x00000000, 0x000eb7c6, 0x000eb7c6}, - {0x00009b40, 0x00000000, 0x00000000, 0x000eb7ca, 0x000eb7ca}, - {0x00009b44, 0x00000000, 0x00000000, 0x000eb7ce, 0x000eb7ce}, - {0x00009b48, 0x00000000, 0x00000000, 0x000eb7d2, 0x000eb7d2}, - {0x00009b4c, 0x00000000, 0x00000000, 0x000eb7d6, 0x000eb7d6}, - {0x00009b50, 0x00000000, 0x00000000, 0x000eb7c3, 0x000eb7c3}, - {0x00009b54, 0x00000000, 0x00000000, 0x000eb7c7, 0x000eb7c7}, - {0x00009b58, 0x00000000, 0x00000000, 0x000eb7cb, 0x000eb7cb}, - {0x00009b5c, 0x00000000, 0x00000000, 0x000eb7cf, 0x000eb7cf}, - {0x00009b60, 0x00000000, 0x00000000, 0x000eb7d7, 0x000eb7d7}, - {0x00009b64, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b68, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b6c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b70, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b74, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b78, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b7c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b80, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b84, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b88, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b8c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b90, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b94, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b98, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009b9c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009ba0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009ba4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009ba8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bac, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bb0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bb4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bb8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bbc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bc0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bc4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bc8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bcc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bd0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bd4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bd8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bdc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009be0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009be4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009be8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bec, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bf0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bf4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bf8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x00009bfc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000aa00, 0x00000000, 0x00000000, 0x00058084, 0x00058084}, - {0x0000aa04, 0x00000000, 0x00000000, 0x00058088, 0x00058088}, - {0x0000aa08, 0x00000000, 0x00000000, 0x0005808c, 0x0005808c}, - {0x0000aa0c, 0x00000000, 0x00000000, 0x00058100, 0x00058100}, - {0x0000aa10, 0x00000000, 0x00000000, 0x00058104, 0x00058104}, - {0x0000aa14, 0x00000000, 0x00000000, 0x00058108, 0x00058108}, - {0x0000aa18, 0x00000000, 0x00000000, 0x0005810c, 0x0005810c}, - {0x0000aa1c, 0x00000000, 0x00000000, 0x00058110, 0x00058110}, - {0x0000aa20, 0x00000000, 0x00000000, 0x00058114, 0x00058114}, - {0x0000aa24, 0x00000000, 0x00000000, 0x00058180, 0x00058180}, - {0x0000aa28, 0x00000000, 0x00000000, 0x00058184, 0x00058184}, - {0x0000aa2c, 0x00000000, 0x00000000, 0x00058188, 0x00058188}, - {0x0000aa30, 0x00000000, 0x00000000, 0x0005818c, 0x0005818c}, - {0x0000aa34, 0x00000000, 0x00000000, 0x00058190, 0x00058190}, - {0x0000aa38, 0x00000000, 0x00000000, 0x00058194, 0x00058194}, - {0x0000aa3c, 0x00000000, 0x00000000, 0x000581a0, 0x000581a0}, - {0x0000aa40, 0x00000000, 0x00000000, 0x0005820c, 0x0005820c}, - {0x0000aa44, 0x00000000, 0x00000000, 0x000581a8, 0x000581a8}, - {0x0000aa48, 0x00000000, 0x00000000, 0x00058284, 0x00058284}, - {0x0000aa4c, 0x00000000, 0x00000000, 0x00058288, 0x00058288}, - {0x0000aa50, 0x00000000, 0x00000000, 0x00058224, 0x00058224}, - {0x0000aa54, 0x00000000, 0x00000000, 0x00058290, 0x00058290}, - {0x0000aa58, 0x00000000, 0x00000000, 0x00058300, 0x00058300}, - {0x0000aa5c, 0x00000000, 0x00000000, 0x00058304, 0x00058304}, - {0x0000aa60, 0x00000000, 0x00000000, 0x00058308, 0x00058308}, - {0x0000aa64, 0x00000000, 0x00000000, 0x0005830c, 0x0005830c}, - {0x0000aa68, 0x00000000, 0x00000000, 0x00058380, 0x00058380}, - {0x0000aa6c, 0x00000000, 0x00000000, 0x00058384, 0x00058384}, - {0x0000aa70, 0x00000000, 0x00000000, 0x00068700, 0x00068700}, - {0x0000aa74, 0x00000000, 0x00000000, 0x00068704, 0x00068704}, - {0x0000aa78, 0x00000000, 0x00000000, 0x00068708, 0x00068708}, - {0x0000aa7c, 0x00000000, 0x00000000, 0x0006870c, 0x0006870c}, - {0x0000aa80, 0x00000000, 0x00000000, 0x00068780, 0x00068780}, - {0x0000aa84, 0x00000000, 0x00000000, 0x00068784, 0x00068784}, - {0x0000aa88, 0x00000000, 0x00000000, 0x00078b00, 0x00078b00}, - {0x0000aa8c, 0x00000000, 0x00000000, 0x00078b04, 0x00078b04}, - {0x0000aa90, 0x00000000, 0x00000000, 0x00078b08, 0x00078b08}, - {0x0000aa94, 0x00000000, 0x00000000, 0x00078b0c, 0x00078b0c}, - {0x0000aa98, 0x00000000, 0x00000000, 0x00078b80, 0x00078b80}, - {0x0000aa9c, 0x00000000, 0x00000000, 0x00078b84, 0x00078b84}, - {0x0000aaa0, 0x00000000, 0x00000000, 0x00078b88, 0x00078b88}, - {0x0000aaa4, 0x00000000, 0x00000000, 0x00078b8c, 0x00078b8c}, - {0x0000aaa8, 0x00000000, 0x00000000, 0x00078b90, 0x00078b90}, - {0x0000aaac, 0x00000000, 0x00000000, 0x000caf80, 0x000caf80}, - {0x0000aab0, 0x00000000, 0x00000000, 0x000caf84, 0x000caf84}, - {0x0000aab4, 0x00000000, 0x00000000, 0x000caf88, 0x000caf88}, - {0x0000aab8, 0x00000000, 0x00000000, 0x000caf8c, 0x000caf8c}, - {0x0000aabc, 0x00000000, 0x00000000, 0x000caf90, 0x000caf90}, - {0x0000aac0, 0x00000000, 0x00000000, 0x000db30c, 0x000db30c}, - {0x0000aac4, 0x00000000, 0x00000000, 0x000db310, 0x000db310}, - {0x0000aac8, 0x00000000, 0x00000000, 0x000db384, 0x000db384}, - {0x0000aacc, 0x00000000, 0x00000000, 0x000db388, 0x000db388}, - {0x0000aad0, 0x00000000, 0x00000000, 0x000db324, 0x000db324}, - {0x0000aad4, 0x00000000, 0x00000000, 0x000eb704, 0x000eb704}, - {0x0000aad8, 0x00000000, 0x00000000, 0x000eb6a4, 0x000eb6a4}, - {0x0000aadc, 0x00000000, 0x00000000, 0x000eb6a8, 0x000eb6a8}, - {0x0000aae0, 0x00000000, 0x00000000, 0x000eb710, 0x000eb710}, - {0x0000aae4, 0x00000000, 0x00000000, 0x000eb714, 0x000eb714}, - {0x0000aae8, 0x00000000, 0x00000000, 0x000eb720, 0x000eb720}, - {0x0000aaec, 0x00000000, 0x00000000, 0x000eb724, 0x000eb724}, - {0x0000aaf0, 0x00000000, 0x00000000, 0x000eb728, 0x000eb728}, - {0x0000aaf4, 0x00000000, 0x00000000, 0x000eb72c, 0x000eb72c}, - {0x0000aaf8, 0x00000000, 0x00000000, 0x000eb7a0, 0x000eb7a0}, - {0x0000aafc, 0x00000000, 0x00000000, 0x000eb7a4, 0x000eb7a4}, - {0x0000ab00, 0x00000000, 0x00000000, 0x000eb7a8, 0x000eb7a8}, - {0x0000ab04, 0x00000000, 0x00000000, 0x000eb7b0, 0x000eb7b0}, - {0x0000ab08, 0x00000000, 0x00000000, 0x000eb7b4, 0x000eb7b4}, - {0x0000ab0c, 0x00000000, 0x00000000, 0x000eb7b8, 0x000eb7b8}, - {0x0000ab10, 0x00000000, 0x00000000, 0x000eb7a5, 0x000eb7a5}, - {0x0000ab14, 0x00000000, 0x00000000, 0x000eb7a9, 0x000eb7a9}, - {0x0000ab18, 0x00000000, 0x00000000, 0x000eb7ad, 0x000eb7ad}, - {0x0000ab1c, 0x00000000, 0x00000000, 0x000eb7b1, 0x000eb7b1}, - {0x0000ab20, 0x00000000, 0x00000000, 0x000eb7b5, 0x000eb7b5}, - {0x0000ab24, 0x00000000, 0x00000000, 0x000eb7b9, 0x000eb7b9}, - {0x0000ab28, 0x00000000, 0x00000000, 0x000eb7c5, 0x000eb7c5}, - {0x0000ab2c, 0x00000000, 0x00000000, 0x000eb7c9, 0x000eb7c9}, - {0x0000ab30, 0x00000000, 0x00000000, 0x000eb7d1, 0x000eb7d1}, - {0x0000ab34, 0x00000000, 0x00000000, 0x000eb7d5, 0x000eb7d5}, - {0x0000ab38, 0x00000000, 0x00000000, 0x000eb7d9, 0x000eb7d9}, - {0x0000ab3c, 0x00000000, 0x00000000, 0x000eb7c6, 0x000eb7c6}, - {0x0000ab40, 0x00000000, 0x00000000, 0x000eb7ca, 0x000eb7ca}, - {0x0000ab44, 0x00000000, 0x00000000, 0x000eb7ce, 0x000eb7ce}, - {0x0000ab48, 0x00000000, 0x00000000, 0x000eb7d2, 0x000eb7d2}, - {0x0000ab4c, 0x00000000, 0x00000000, 0x000eb7d6, 0x000eb7d6}, - {0x0000ab50, 0x00000000, 0x00000000, 0x000eb7c3, 0x000eb7c3}, - {0x0000ab54, 0x00000000, 0x00000000, 0x000eb7c7, 0x000eb7c7}, - {0x0000ab58, 0x00000000, 0x00000000, 0x000eb7cb, 0x000eb7cb}, - {0x0000ab5c, 0x00000000, 0x00000000, 0x000eb7cf, 0x000eb7cf}, - {0x0000ab60, 0x00000000, 0x00000000, 0x000eb7d7, 0x000eb7d7}, - {0x0000ab64, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab68, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab6c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab70, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab74, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab78, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab7c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab80, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab84, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab88, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab8c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab90, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab94, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab98, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000ab9c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000aba0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000aba4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000aba8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abac, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abb0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abb4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abb8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abbc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abc0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abc4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abc8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abcc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abd0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abd4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abd8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abdc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abe0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abe4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abe8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abec, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abf0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abf4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abf8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000abfc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db}, - {0x0000a204, 0x00000004, 0x00000004, 0x00000004, 0x00000004}, - {0x0000a20c, 0x00000014, 0x00000014, 0x0001f000, 0x0001f000}, - {0x0000b20c, 0x00000014, 0x00000014, 0x0001f000, 0x0001f000}, - {0x0000a21c, 0x1883800a, 0x1883800a, 0x1883800a, 0x1883800a}, - {0x0000a230, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a250, 0x0004f000, 0x0004f000, 0x0004a000, 0x0004a000}, - {0x0000a358, 0x7999aa02, 0x7999aa02, 0x7999aa0e, 0x7999aa0e}, -}; - -static const u32 ar9271Common_9271[][2] = { - /* Addr allmodes */ - {0x0000000c, 0x00000000}, - {0x00000030, 0x00020045}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000008}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00000054, 0x0000001f}, - {0x00000800, 0x00000000}, - {0x00000804, 0x00000000}, - {0x00000808, 0x00000000}, - {0x0000080c, 0x00000000}, - {0x00000810, 0x00000000}, - {0x00000814, 0x00000000}, - {0x00000818, 0x00000000}, - {0x0000081c, 0x00000000}, - {0x00000820, 0x00000000}, - {0x00000824, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x00001230, 0x00000000}, - {0x00001270, 0x00000000}, - {0x00001038, 0x00000000}, - {0x00001078, 0x00000000}, - {0x000010b8, 0x00000000}, - {0x000010f8, 0x00000000}, - {0x00001138, 0x00000000}, - {0x00001178, 0x00000000}, - {0x000011b8, 0x00000000}, - {0x000011f8, 0x00000000}, - {0x00001238, 0x00000000}, - {0x00001278, 0x00000000}, - {0x000012b8, 0x00000000}, - {0x000012f8, 0x00000000}, - {0x00001338, 0x00000000}, - {0x00001378, 0x00000000}, - {0x000013b8, 0x00000000}, - {0x000013f8, 0x00000000}, - {0x00001438, 0x00000000}, - {0x00001478, 0x00000000}, - {0x000014b8, 0x00000000}, - {0x000014f8, 0x00000000}, - {0x00001538, 0x00000000}, - {0x00001578, 0x00000000}, - {0x000015b8, 0x00000000}, - {0x000015f8, 0x00000000}, - {0x00001638, 0x00000000}, - {0x00001678, 0x00000000}, - {0x000016b8, 0x00000000}, - {0x000016f8, 0x00000000}, - {0x00001738, 0x00000000}, - {0x00001778, 0x00000000}, - {0x000017b8, 0x00000000}, - {0x000017f8, 0x00000000}, - {0x0000103c, 0x00000000}, - {0x0000107c, 0x00000000}, - {0x000010bc, 0x00000000}, - {0x000010fc, 0x00000000}, - {0x0000113c, 0x00000000}, - {0x0000117c, 0x00000000}, - {0x000011bc, 0x00000000}, - {0x000011fc, 0x00000000}, - {0x0000123c, 0x00000000}, - {0x0000127c, 0x00000000}, - {0x000012bc, 0x00000000}, - {0x000012fc, 0x00000000}, - {0x0000133c, 0x00000000}, - {0x0000137c, 0x00000000}, - {0x000013bc, 0x00000000}, - {0x000013fc, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00004030, 0x00000002}, - {0x0000403c, 0x00000002}, - {0x00004024, 0x0000001f}, - {0x00004060, 0x00000000}, - {0x00004064, 0x00000000}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008018, 0x00000700}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00000000}, - {0x00008048, 0x00000000}, - {0x00008054, 0x00000000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x00008070, 0x00000000}, - {0x000080b0, 0x00000000}, - {0x000080b4, 0x00000000}, - {0x000080b8, 0x00000000}, - {0x000080bc, 0x00000000}, - {0x000080c0, 0x2a80001a}, - {0x000080c4, 0x05dc01e0}, - {0x000080c8, 0x1f402710}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00001e00}, - {0x000080d4, 0x00000000}, - {0x000080d8, 0x00400000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x003f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080f8, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00020000}, - {0x00008104, 0x00000001}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000168}, - {0x00008118, 0x000100aa}, - {0x0000811c, 0x00003210}, - {0x00008120, 0x08f04810}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x00000000}, - {0x00008144, 0xffffffff}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x00008170, 0x32143320}, - {0x00008174, 0xfaa4fa50}, - {0x00008178, 0x00000100}, - {0x0000817c, 0x00000000}, - {0x000081c0, 0x00000000}, - {0x000081d0, 0x0000320a}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008200, 0x00000000}, - {0x00008204, 0x00000000}, - {0x00008208, 0x00000000}, - {0x0000820c, 0x00000000}, - {0x00008210, 0x00000000}, - {0x00008214, 0x00000000}, - {0x00008218, 0x00000000}, - {0x0000821c, 0x00000000}, - {0x00008220, 0x00000000}, - {0x00008224, 0x00000000}, - {0x00008228, 0x00000000}, - {0x0000822c, 0x00000000}, - {0x00008230, 0x00000000}, - {0x00008234, 0x00000000}, - {0x00008238, 0x00000000}, - {0x0000823c, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008244, 0x0010f400}, - {0x00008248, 0x00000100}, - {0x0000824c, 0x0001e800}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x400000ff}, - {0x00008260, 0x00080922}, - {0x00008264, 0x88a00010}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000000}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x00000000}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x0000829c, 0x00000000}, - {0x00008300, 0x00000040}, - {0x00008314, 0x00000000}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x00000001}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000e00}, - {0x00008338, 0x00ff0000}, - {0x0000833c, 0x00000000}, - {0x00008340, 0x00010380}, - {0x00008344, 0x00581043}, - {0x00007010, 0x00000030}, - {0x00007034, 0x00000002}, - {0x00007038, 0x000004c2}, - {0x00007800, 0x00140000}, - {0x00007804, 0x0e4548d8}, - {0x00007808, 0x54214514}, - {0x0000780c, 0x02025820}, - {0x00007810, 0x71c0d388}, - {0x00007814, 0x924934a8}, - {0x0000781c, 0x00000000}, - {0x00007828, 0x66964300}, - {0x0000782c, 0x8db6d961}, - {0x00007830, 0x8db6d96c}, - {0x00007834, 0x6140008b}, - {0x0000783c, 0x72ee0a72}, - {0x00007840, 0xbbfffffc}, - {0x00007844, 0x000c0db6}, - {0x00007848, 0x6db6246f}, - {0x0000784c, 0x6d9b66db}, - {0x00007850, 0x6d8c6dba}, - {0x00007854, 0x00040000}, - {0x00007858, 0xdb003012}, - {0x0000785c, 0x04924914}, - {0x00007860, 0x21084210}, - {0x00007864, 0xf7d7ffde}, - {0x00007868, 0xc2034080}, - {0x00007870, 0x10142c00}, - {0x00009808, 0x00000000}, - {0x0000980c, 0xafe68e30}, - {0x00009810, 0xfd14e000}, - {0x00009814, 0x9c0a9f6b}, - {0x0000981c, 0x00000000}, - {0x0000982c, 0x0000a000}, - {0x00009830, 0x00000000}, - {0x0000983c, 0x00200400}, - {0x0000984c, 0x0040233c}, - {0x00009854, 0x00000044}, - {0x00009900, 0x00000000}, - {0x00009904, 0x00000000}, - {0x00009908, 0x00000000}, - {0x0000990c, 0x00000000}, - {0x0000991c, 0x10000fff}, - {0x00009920, 0x04900000}, - {0x00009928, 0x00000001}, - {0x0000992c, 0x00000004}, - {0x00009934, 0x1e1f2022}, - {0x00009938, 0x0a0b0c0d}, - {0x0000993c, 0x00000000}, - {0x00009940, 0x14750604}, - {0x00009948, 0x9280c00a}, - {0x0000994c, 0x00020028}, - {0x00009954, 0x5f3ca3de}, - {0x00009958, 0x0108ecff}, - {0x00009968, 0x000003ce}, - {0x00009970, 0x192bb514}, - {0x00009974, 0x00000000}, - {0x00009978, 0x00000001}, - {0x0000997c, 0x00000000}, - {0x00009980, 0x00000000}, - {0x00009984, 0x00000000}, - {0x00009988, 0x00000000}, - {0x0000998c, 0x00000000}, - {0x00009990, 0x00000000}, - {0x00009994, 0x00000000}, - {0x00009998, 0x00000000}, - {0x0000999c, 0x00000000}, - {0x000099a0, 0x00000000}, - {0x000099a4, 0x00000001}, - {0x000099a8, 0x201fff00}, - {0x000099ac, 0x2def0400}, - {0x000099b0, 0x03051000}, - {0x000099b4, 0x00000820}, - {0x000099dc, 0x00000000}, - {0x000099e0, 0x00000000}, - {0x000099e4, 0xaaaaaaaa}, - {0x000099e8, 0x3c466478}, - {0x000099ec, 0x0cc80caa}, - {0x000099f0, 0x00000000}, - {0x0000a208, 0x803e68c8}, - {0x0000a210, 0x4080a333}, - {0x0000a214, 0x00206c10}, - {0x0000a218, 0x009c4060}, - {0x0000a220, 0x01834061}, - {0x0000a224, 0x00000400}, - {0x0000a228, 0x000003b5}, - {0x0000a22c, 0x00000000}, - {0x0000a234, 0x20202020}, - {0x0000a238, 0x20202020}, - {0x0000a244, 0x00000000}, - {0x0000a248, 0xfffffffc}, - {0x0000a24c, 0x00000000}, - {0x0000a254, 0x00000000}, - {0x0000a258, 0x0ccb5380}, - {0x0000a25c, 0x15151501}, - {0x0000a260, 0xdfa90f01}, - {0x0000a268, 0x00000000}, - {0x0000a26c, 0x0ebae9e6}, - {0x0000a388, 0x0c000000}, - {0x0000a38c, 0x20202020}, - {0x0000a390, 0x20202020}, - {0x0000a39c, 0x00000001}, - {0x0000a3a0, 0x00000000}, - {0x0000a3a4, 0x00000000}, - {0x0000a3a8, 0x00000000}, - {0x0000a3ac, 0x00000000}, - {0x0000a3b0, 0x00000000}, - {0x0000a3b4, 0x00000000}, - {0x0000a3b8, 0x00000000}, - {0x0000a3bc, 0x00000000}, - {0x0000a3c0, 0x00000000}, - {0x0000a3c4, 0x00000000}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3e4, 0x00000000}, - {0x0000a3e8, 0x18c43433}, - {0x0000a3ec, 0x00f70081}, - {0x0000a3f0, 0x01036a2f}, - {0x0000a3f4, 0x00000000}, - {0x0000d270, 0x0d820820}, - {0x0000d35c, 0x07ffffef}, - {0x0000d360, 0x0fffffe7}, - {0x0000d364, 0x17ffffe5}, - {0x0000d368, 0x1fffffe4}, - {0x0000d36c, 0x37ffffe3}, - {0x0000d370, 0x3fffffe3}, - {0x0000d374, 0x57ffffe3}, - {0x0000d378, 0x5fffffe2}, - {0x0000d37c, 0x7fffffe2}, - {0x0000d380, 0x7f3c7bba}, - {0x0000d384, 0xf3307ff0}, -}; - -static const u32 ar9271Modes_9271_ANI_reg[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009850, 0x6d4000e2, 0x6d4000e2, 0x6d4000e2, 0x6d4000e2}, - {0x0000985c, 0x3139605e, 0x3139605e, 0x3137605e, 0x3137605e}, - {0x00009858, 0x7ec84d2e, 0x7ec84d2e, 0x7ec84d2e, 0x7ec84d2e}, - {0x0000986c, 0x06903881, 0x06903881, 0x06903881, 0x06903881}, - {0x00009868, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, - {0x0000a208, 0x803e68c8, 0x803e68c8, 0x803e68c8, 0x803e68c8}, - {0x00009924, 0xd00a8007, 0xd00a8007, 0xd00a800d, 0xd00a800d}, - {0x000099c0, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, -}; - -static const u32 ar9271Modes_normal_power_tx_gain_9271[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a300, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a304, 0x00000000, 0x00000000, 0x00009200, 0x00009200}, - {0x0000a308, 0x00000000, 0x00000000, 0x00010208, 0x00010208}, - {0x0000a30c, 0x00000000, 0x00000000, 0x00019608, 0x00019608}, - {0x0000a310, 0x00000000, 0x00000000, 0x0001e610, 0x0001e610}, - {0x0000a314, 0x00000000, 0x00000000, 0x00024650, 0x00024650}, - {0x0000a318, 0x00000000, 0x00000000, 0x0002d6d0, 0x0002d6d0}, - {0x0000a31c, 0x00000000, 0x00000000, 0x000316d2, 0x000316d2}, - {0x0000a320, 0x00000000, 0x00000000, 0x00039758, 0x00039758}, - {0x0000a324, 0x00000000, 0x00000000, 0x0003b759, 0x0003b759}, - {0x0000a328, 0x00000000, 0x00000000, 0x0003d75a, 0x0003d75a}, - {0x0000a32c, 0x00000000, 0x00000000, 0x0004175c, 0x0004175c}, - {0x0000a330, 0x00000000, 0x00000000, 0x0004575e, 0x0004575e}, - {0x0000a334, 0x000368de, 0x000368de, 0x0004979f, 0x0004979f}, - {0x0000a338, 0x0003891e, 0x0003891e, 0x0004d7df, 0x0004d7df}, - {0x0000a33c, 0x0003a95e, 0x0003a95e, 0x0003a95e, 0x0003a95e}, - {0x0000a340, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a344, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a348, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a34c, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a350, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a354, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x00007838, 0x00000029, 0x00000029, 0x00000029, 0x00000029}, - {0x00007824, 0x00d8abff, 0x00d8abff, 0x00d8abff, 0x00d8abff}, - {0x0000786c, 0x48609eb4, 0x48609eb4, 0x48609eb4, 0x48609eb4}, - {0x00007820, 0x00000c04, 0x00000c04, 0x00000c04, 0x00000c04}, - {0x0000a274, 0x0a21c652, 0x0a21c652, 0x0a21c652, 0x0a21c652}, - {0x0000a278, 0x3bdef7bd, 0x3bdef7bd, 0x3bdef7bd, 0x3bdef7bd}, - {0x0000a27c, 0x050e83bd, 0x050e83bd, 0x050e83bd, 0x050e83bd}, - {0x0000a394, 0x3bdef7bd, 0x3bdef7bd, 0x3bdef7bd, 0x3bdef7bd}, - {0x0000a398, 0x000003bd, 0x000003bd, 0x000003bd, 0x000003bd}, - {0x0000a3dc, 0x3bdef7bd, 0x3bdef7bd, 0x3bdef7bd, 0x3bdef7bd}, - {0x0000a3e0, 0x000003bd, 0x000003bd, 0x000003bd, 0x000003bd}, -}; - -static const u32 ar9271Modes_high_power_tx_gain_9271[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a300, 0x00000000, 0x00000000, 0x00010000, 0x00010000}, - {0x0000a304, 0x00000000, 0x00000000, 0x00016200, 0x00016200}, - {0x0000a308, 0x00000000, 0x00000000, 0x00018201, 0x00018201}, - {0x0000a30c, 0x00000000, 0x00000000, 0x0001b240, 0x0001b240}, - {0x0000a310, 0x00000000, 0x00000000, 0x0001d241, 0x0001d241}, - {0x0000a314, 0x00000000, 0x00000000, 0x0001f600, 0x0001f600}, - {0x0000a318, 0x00000000, 0x00000000, 0x00022800, 0x00022800}, - {0x0000a31c, 0x00000000, 0x00000000, 0x00026802, 0x00026802}, - {0x0000a320, 0x00000000, 0x00000000, 0x0002b805, 0x0002b805}, - {0x0000a324, 0x00000000, 0x00000000, 0x0002ea41, 0x0002ea41}, - {0x0000a328, 0x00000000, 0x00000000, 0x00038b00, 0x00038b00}, - {0x0000a32c, 0x00000000, 0x00000000, 0x0003ab40, 0x0003ab40}, - {0x0000a330, 0x00000000, 0x00000000, 0x0003cd80, 0x0003cd80}, - {0x0000a334, 0x000368de, 0x000368de, 0x000368de, 0x000368de}, - {0x0000a338, 0x0003891e, 0x0003891e, 0x0003891e, 0x0003891e}, - {0x0000a33c, 0x0003a95e, 0x0003a95e, 0x0003a95e, 0x0003a95e}, - {0x0000a340, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a344, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a348, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a34c, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a350, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x0000a354, 0x0003e9df, 0x0003e9df, 0x0003e9df, 0x0003e9df}, - {0x00007838, 0x0000002b, 0x0000002b, 0x0000002b, 0x0000002b}, - {0x00007824, 0x00d8a7ff, 0x00d8a7ff, 0x00d8a7ff, 0x00d8a7ff}, - {0x0000786c, 0x08609eb6, 0x08609eb6, 0x08609eba, 0x08609eba}, - {0x00007820, 0x00000c00, 0x00000c00, 0x00000c00, 0x00000c00}, - {0x0000a274, 0x0a22a652, 0x0a22a652, 0x0a214652, 0x0a214652}, - {0x0000a278, 0x0e739ce7, 0x0e739ce7, 0x0e739ce7, 0x0e739ce7}, - {0x0000a27c, 0x05018063, 0x05038063, 0x05018063, 0x05018063}, - {0x0000a394, 0x06318c63, 0x06318c63, 0x06318c63, 0x06318c63}, - {0x0000a398, 0x00000063, 0x00000063, 0x00000063, 0x00000063}, - {0x0000a3dc, 0x06318c63, 0x06318c63, 0x06318c63, 0x06318c63}, - {0x0000a3e0, 0x00000063, 0x00000063, 0x00000063, 0x00000063}, -}; - diff --git a/drivers/net/wireless/ath/ath9k/ar9002_mac.c b/drivers/net/wireless/ath/ath9k/ar9002_mac.c deleted file mode 100644 index a366d6b4626f..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c +++ /dev/null @@ -1,403 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "hw.h" -#include - -#define AR_BufLen 0x00000fff - -static void ar9002_hw_rx_enable(struct ath_hw *ah) -{ - REG_WRITE(ah, AR_CR, AR_CR_RXE); -} - -static void ar9002_hw_set_desc_link(void *ds, u32 ds_link) -{ - ((struct ath_desc*) ds)->ds_link = ds_link; -} - -static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) -{ - u32 isr = 0; - u32 mask2 = 0; - struct ath9k_hw_capabilities *pCap = &ah->caps; - u32 sync_cause = 0; - bool fatal_int = false; - struct ath_common *common = ath9k_hw_common(ah); - - if (!AR_SREV_9100(ah)) { - if (REG_READ(ah, AR_INTR_ASYNC_CAUSE) & AR_INTR_MAC_IRQ) { - if ((REG_READ(ah, AR_RTC_STATUS) & AR_RTC_STATUS_M) - == AR_RTC_STATUS_ON) { - isr = REG_READ(ah, AR_ISR); - } - } - - sync_cause = REG_READ(ah, AR_INTR_SYNC_CAUSE) & - AR_INTR_SYNC_DEFAULT; - - *masked = 0; - - if (!isr && !sync_cause) - return false; - } else { - *masked = 0; - isr = REG_READ(ah, AR_ISR); - } - - if (isr) { - if (isr & AR_ISR_BCNMISC) { - u32 isr2; - isr2 = REG_READ(ah, AR_ISR_S2); - if (isr2 & AR_ISR_S2_TIM) - mask2 |= ATH9K_INT_TIM; - if (isr2 & AR_ISR_S2_DTIM) - mask2 |= ATH9K_INT_DTIM; - if (isr2 & AR_ISR_S2_DTIMSYNC) - mask2 |= ATH9K_INT_DTIMSYNC; - if (isr2 & (AR_ISR_S2_CABEND)) - mask2 |= ATH9K_INT_CABEND; - if (isr2 & AR_ISR_S2_GTT) - mask2 |= ATH9K_INT_GTT; - if (isr2 & AR_ISR_S2_CST) - mask2 |= ATH9K_INT_CST; - if (isr2 & AR_ISR_S2_TSFOOR) - mask2 |= ATH9K_INT_TSFOOR; - - if (!(pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) { - REG_WRITE(ah, AR_ISR_S2, isr2); - isr &= ~AR_ISR_BCNMISC; - } - } - - if (pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED) - isr = REG_READ(ah, AR_ISR_RAC); - - if (isr == 0xffffffff) { - *masked = 0; - return false; - } - - *masked = isr & ATH9K_INT_COMMON; - - if (isr & (AR_ISR_RXMINTR | AR_ISR_RXINTM | - AR_ISR_RXOK | AR_ISR_RXERR)) - *masked |= ATH9K_INT_RX; - - if (isr & - (AR_ISR_TXOK | AR_ISR_TXDESC | AR_ISR_TXERR | - AR_ISR_TXEOL)) { - u32 s0_s, s1_s; - - *masked |= ATH9K_INT_TX; - - if (pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED) { - s0_s = REG_READ(ah, AR_ISR_S0_S); - s1_s = REG_READ(ah, AR_ISR_S1_S); - } else { - s0_s = REG_READ(ah, AR_ISR_S0); - REG_WRITE(ah, AR_ISR_S0, s0_s); - s1_s = REG_READ(ah, AR_ISR_S1); - REG_WRITE(ah, AR_ISR_S1, s1_s); - - isr &= ~(AR_ISR_TXOK | - AR_ISR_TXDESC | - AR_ISR_TXERR | - AR_ISR_TXEOL); - } - - ah->intr_txqs |= MS(s0_s, AR_ISR_S0_QCU_TXOK); - ah->intr_txqs |= MS(s0_s, AR_ISR_S0_QCU_TXDESC); - ah->intr_txqs |= MS(s1_s, AR_ISR_S1_QCU_TXERR); - ah->intr_txqs |= MS(s1_s, AR_ISR_S1_QCU_TXEOL); - } - - if (isr & AR_ISR_RXORN) { - ath_dbg(common, INTERRUPT, - "receive FIFO overrun interrupt\n"); - } - - *masked |= mask2; - } - - if (!AR_SREV_9100(ah) && (isr & AR_ISR_GENTMR)) { - u32 s5_s; - - if (pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED) { - s5_s = REG_READ(ah, AR_ISR_S5_S); - } else { - s5_s = REG_READ(ah, AR_ISR_S5); - } - - ah->intr_gen_timer_trigger = - MS(s5_s, AR_ISR_S5_GENTIMER_TRIG); - - ah->intr_gen_timer_thresh = - MS(s5_s, AR_ISR_S5_GENTIMER_THRESH); - - if (ah->intr_gen_timer_trigger) - *masked |= ATH9K_INT_GENTIMER; - - if ((s5_s & AR_ISR_S5_TIM_TIMER) && - !(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) - *masked |= ATH9K_INT_TIM_TIMER; - - if (!(pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) { - REG_WRITE(ah, AR_ISR_S5, s5_s); - isr &= ~AR_ISR_GENTMR; - } - } - - if (!(pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) { - REG_WRITE(ah, AR_ISR, isr); - REG_READ(ah, AR_ISR); - } - - if (AR_SREV_9100(ah)) - return true; - - if (sync_cause) { - ath9k_debug_sync_cause(common, sync_cause); - fatal_int = - (sync_cause & - (AR_INTR_SYNC_HOST1_FATAL | AR_INTR_SYNC_HOST1_PERR)) - ? true : false; - - if (fatal_int) { - if (sync_cause & AR_INTR_SYNC_HOST1_FATAL) { - ath_dbg(common, ANY, - "received PCI FATAL interrupt\n"); - } - if (sync_cause & AR_INTR_SYNC_HOST1_PERR) { - ath_dbg(common, ANY, - "received PCI PERR interrupt\n"); - } - *masked |= ATH9K_INT_FATAL; - } - if (sync_cause & AR_INTR_SYNC_RADM_CPL_TIMEOUT) { - ath_dbg(common, INTERRUPT, - "AR_INTR_SYNC_RADM_CPL_TIMEOUT\n"); - REG_WRITE(ah, AR_RC, AR_RC_HOSTIF); - REG_WRITE(ah, AR_RC, 0); - *masked |= ATH9K_INT_FATAL; - } - if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT) { - ath_dbg(common, INTERRUPT, - "AR_INTR_SYNC_LOCAL_TIMEOUT\n"); - } - - REG_WRITE(ah, AR_INTR_SYNC_CAUSE_CLR, sync_cause); - (void) REG_READ(ah, AR_INTR_SYNC_CAUSE_CLR); - } - - return true; -} - -static void -ar9002_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i) -{ - struct ar5416_desc *ads = AR5416DESC(ds); - u32 ctl1, ctl6; - - ads->ds_txstatus0 = ads->ds_txstatus1 = 0; - ads->ds_txstatus2 = ads->ds_txstatus3 = 0; - ads->ds_txstatus4 = ads->ds_txstatus5 = 0; - ads->ds_txstatus6 = ads->ds_txstatus7 = 0; - ads->ds_txstatus8 = ads->ds_txstatus9 = 0; - - ACCESS_ONCE(ads->ds_link) = i->link; - ACCESS_ONCE(ads->ds_data) = i->buf_addr[0]; - - ctl1 = i->buf_len[0] | (i->is_last ? 0 : AR_TxMore); - ctl6 = SM(i->keytype, AR_EncrType); - - if (AR_SREV_9285(ah)) { - ads->ds_ctl8 = 0; - ads->ds_ctl9 = 0; - ads->ds_ctl10 = 0; - ads->ds_ctl11 = 0; - } - - if ((i->is_first || i->is_last) && - i->aggr != AGGR_BUF_MIDDLE && i->aggr != AGGR_BUF_LAST) { - ACCESS_ONCE(ads->ds_ctl2) = set11nTries(i->rates, 0) - | set11nTries(i->rates, 1) - | set11nTries(i->rates, 2) - | set11nTries(i->rates, 3) - | (i->dur_update ? AR_DurUpdateEna : 0) - | SM(0, AR_BurstDur); - - ACCESS_ONCE(ads->ds_ctl3) = set11nRate(i->rates, 0) - | set11nRate(i->rates, 1) - | set11nRate(i->rates, 2) - | set11nRate(i->rates, 3); - } else { - ACCESS_ONCE(ads->ds_ctl2) = 0; - ACCESS_ONCE(ads->ds_ctl3) = 0; - } - - if (!i->is_first) { - ACCESS_ONCE(ads->ds_ctl0) = 0; - ACCESS_ONCE(ads->ds_ctl1) = ctl1; - ACCESS_ONCE(ads->ds_ctl6) = ctl6; - return; - } - - ctl1 |= (i->keyix != ATH9K_TXKEYIX_INVALID ? SM(i->keyix, AR_DestIdx) : 0) - | SM(i->type, AR_FrameType) - | (i->flags & ATH9K_TXDESC_NOACK ? AR_NoAck : 0) - | (i->flags & ATH9K_TXDESC_EXT_ONLY ? AR_ExtOnly : 0) - | (i->flags & ATH9K_TXDESC_EXT_AND_CTL ? AR_ExtAndCtl : 0); - - switch (i->aggr) { - case AGGR_BUF_FIRST: - ctl6 |= SM(i->aggr_len, AR_AggrLen); - /* fall through */ - case AGGR_BUF_MIDDLE: - ctl1 |= AR_IsAggr | AR_MoreAggr; - ctl6 |= SM(i->ndelim, AR_PadDelim); - break; - case AGGR_BUF_LAST: - ctl1 |= AR_IsAggr; - break; - case AGGR_BUF_NONE: - break; - } - - ACCESS_ONCE(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen) - | (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0) - | SM(i->txpower, AR_XmitPower) - | (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0) - | (i->flags & ATH9K_TXDESC_INTREQ ? AR_TxIntrReq : 0) - | (i->keyix != ATH9K_TXKEYIX_INVALID ? AR_DestIdxValid : 0) - | (i->flags & ATH9K_TXDESC_CLRDMASK ? AR_ClrDestMask : 0) - | (i->flags & ATH9K_TXDESC_RTSENA ? AR_RTSEnable : - (i->flags & ATH9K_TXDESC_CTSENA ? AR_CTSEnable : 0)); - - ACCESS_ONCE(ads->ds_ctl1) = ctl1; - ACCESS_ONCE(ads->ds_ctl6) = ctl6; - - if (i->aggr == AGGR_BUF_MIDDLE || i->aggr == AGGR_BUF_LAST) - return; - - ACCESS_ONCE(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0) - | set11nPktDurRTSCTS(i->rates, 1); - - ACCESS_ONCE(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2) - | set11nPktDurRTSCTS(i->rates, 3); - - ACCESS_ONCE(ads->ds_ctl7) = set11nRateFlags(i->rates, 0) - | set11nRateFlags(i->rates, 1) - | set11nRateFlags(i->rates, 2) - | set11nRateFlags(i->rates, 3) - | SM(i->rtscts_rate, AR_RTSCTSRate); -} - -static int ar9002_hw_proc_txdesc(struct ath_hw *ah, void *ds, - struct ath_tx_status *ts) -{ - struct ar5416_desc *ads = AR5416DESC(ds); - u32 status; - - status = ACCESS_ONCE(ads->ds_txstatus9); - if ((status & AR_TxDone) == 0) - return -EINPROGRESS; - - ts->ts_tstamp = ads->AR_SendTimestamp; - ts->ts_status = 0; - ts->ts_flags = 0; - - if (status & AR_TxOpExceeded) - ts->ts_status |= ATH9K_TXERR_XTXOP; - ts->tid = MS(status, AR_TxTid); - ts->ts_rateindex = MS(status, AR_FinalTxIdx); - ts->ts_seqnum = MS(status, AR_SeqNum); - - status = ACCESS_ONCE(ads->ds_txstatus0); - ts->ts_rssi_ctl0 = MS(status, AR_TxRSSIAnt00); - ts->ts_rssi_ctl1 = MS(status, AR_TxRSSIAnt01); - ts->ts_rssi_ctl2 = MS(status, AR_TxRSSIAnt02); - if (status & AR_TxBaStatus) { - ts->ts_flags |= ATH9K_TX_BA; - ts->ba_low = ads->AR_BaBitmapLow; - ts->ba_high = ads->AR_BaBitmapHigh; - } - - status = ACCESS_ONCE(ads->ds_txstatus1); - if (status & AR_FrmXmitOK) - ts->ts_status |= ATH9K_TX_ACKED; - else { - if (status & AR_ExcessiveRetries) - ts->ts_status |= ATH9K_TXERR_XRETRY; - if (status & AR_Filtered) - ts->ts_status |= ATH9K_TXERR_FILT; - if (status & AR_FIFOUnderrun) { - ts->ts_status |= ATH9K_TXERR_FIFO; - ath9k_hw_updatetxtriglevel(ah, true); - } - } - if (status & AR_TxTimerExpired) - ts->ts_status |= ATH9K_TXERR_TIMER_EXPIRED; - if (status & AR_DescCfgErr) - ts->ts_flags |= ATH9K_TX_DESC_CFG_ERR; - if (status & AR_TxDataUnderrun) { - ts->ts_flags |= ATH9K_TX_DATA_UNDERRUN; - ath9k_hw_updatetxtriglevel(ah, true); - } - if (status & AR_TxDelimUnderrun) { - ts->ts_flags |= ATH9K_TX_DELIM_UNDERRUN; - ath9k_hw_updatetxtriglevel(ah, true); - } - ts->ts_shortretry = MS(status, AR_RTSFailCnt); - ts->ts_longretry = MS(status, AR_DataFailCnt); - ts->ts_virtcol = MS(status, AR_VirtRetryCnt); - - status = ACCESS_ONCE(ads->ds_txstatus5); - ts->ts_rssi = MS(status, AR_TxRSSICombined); - ts->ts_rssi_ext0 = MS(status, AR_TxRSSIAnt10); - ts->ts_rssi_ext1 = MS(status, AR_TxRSSIAnt11); - ts->ts_rssi_ext2 = MS(status, AR_TxRSSIAnt12); - - ts->evm0 = ads->AR_TxEVM0; - ts->evm1 = ads->AR_TxEVM1; - ts->evm2 = ads->AR_TxEVM2; - - return 0; -} - -void ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath_desc *ds, - u32 size, u32 flags) -{ - struct ar5416_desc *ads = AR5416DESC(ds); - - ads->ds_ctl1 = size & AR_BufLen; - if (flags & ATH9K_RXDESC_INTREQ) - ads->ds_ctl1 |= AR_RxIntrReq; - - memset(&ads->u.rx, 0, sizeof(ads->u.rx)); -} -EXPORT_SYMBOL(ath9k_hw_setuprxdesc); - -void ar9002_hw_attach_mac_ops(struct ath_hw *ah) -{ - struct ath_hw_ops *ops = ath9k_hw_ops(ah); - - ops->rx_enable = ar9002_hw_rx_enable; - ops->set_desc_link = ar9002_hw_set_desc_link; - ops->get_isr = ar9002_hw_get_isr; - ops->set_txdesc = ar9002_set_txdesc; - ops->proc_txdesc = ar9002_hw_proc_txdesc; -} diff --git a/drivers/net/wireless/ath/ath9k/ar9002_phy.c b/drivers/net/wireless/ath/ath9k/ar9002_phy.c deleted file mode 100644 index f4003512d8d5..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c +++ /dev/null @@ -1,638 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/** - * DOC: Programming Atheros 802.11n analog front end radios - * - * AR5416 MAC based PCI devices and AR518 MAC based PCI-Express - * devices have either an external AR2133 analog front end radio for single - * band 2.4 GHz communication or an AR5133 analog front end radio for dual - * band 2.4 GHz / 5 GHz communication. - * - * All devices after the AR5416 and AR5418 family starting with the AR9280 - * have their analog front radios, MAC/BB and host PCIe/USB interface embedded - * into a single-chip and require less programming. - * - * The following single-chips exist with a respective embedded radio: - * - * AR9280 - 11n dual-band 2x2 MIMO for PCIe - * AR9281 - 11n single-band 1x2 MIMO for PCIe - * AR9285 - 11n single-band 1x1 for PCIe - * AR9287 - 11n single-band 2x2 MIMO for PCIe - * - * AR9220 - 11n dual-band 2x2 MIMO for PCI - * AR9223 - 11n single-band 2x2 MIMO for PCI - * - * AR9287 - 11n single-band 1x1 MIMO for USB - */ - -#include "hw.h" -#include "ar9002_phy.h" - -/** - * ar9002_hw_set_channel - set channel on single-chip device - * @ah: atheros hardware structure - * @chan: - * - * This is the function to change channel on single-chip devices, that is - * all devices after ar9280. - * - * This function takes the channel value in MHz and sets - * hardware channel value. Assumes writes have been enabled to analog bus. - * - * Actual Expression, - * - * For 2GHz channel, - * Channel Frequency = (3/4) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^17) - * (freq_ref = 40MHz) - * - * For 5GHz channel, - * Channel Frequency = (3/2) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^10) - * (freq_ref = 40MHz/(24>>amodeRefSel)) - */ -static int ar9002_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan) -{ - u16 bMode, fracMode, aModeRefSel = 0; - u32 freq, ndiv, channelSel = 0, channelFrac = 0, reg32 = 0; - struct chan_centers centers; - u32 refDivA = 24; - - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - freq = centers.synth_center; - - reg32 = REG_READ(ah, AR_PHY_SYNTH_CONTROL); - reg32 &= 0xc0000000; - - if (freq < 4800) { /* 2 GHz, fractional mode */ - u32 txctl; - int regWrites = 0; - - bMode = 1; - fracMode = 1; - aModeRefSel = 0; - channelSel = CHANSEL_2G(freq); - - if (AR_SREV_9287_11_OR_LATER(ah)) { - if (freq == 2484) { - /* Enable channel spreading for channel 14 */ - REG_WRITE_ARRAY(&ah->iniCckfirJapan2484, - 1, regWrites); - } else { - REG_WRITE_ARRAY(&ah->iniCckfirNormal, - 1, regWrites); - } - } else { - txctl = REG_READ(ah, AR_PHY_CCK_TX_CTRL); - if (freq == 2484) { - /* Enable channel spreading for channel 14 */ - REG_WRITE(ah, AR_PHY_CCK_TX_CTRL, - txctl | AR_PHY_CCK_TX_CTRL_JAPAN); - } else { - REG_WRITE(ah, AR_PHY_CCK_TX_CTRL, - txctl & ~AR_PHY_CCK_TX_CTRL_JAPAN); - } - } - } else { - bMode = 0; - fracMode = 0; - - switch (ah->eep_ops->get_eeprom(ah, EEP_FRAC_N_5G)) { - case 0: - if (IS_CHAN_HALF_RATE(chan) || IS_CHAN_QUARTER_RATE(chan)) - aModeRefSel = 0; - else if ((freq % 20) == 0) - aModeRefSel = 3; - else if ((freq % 10) == 0) - aModeRefSel = 2; - if (aModeRefSel) - break; - case 1: - default: - aModeRefSel = 0; - /* - * Enable 2G (fractional) mode for channels - * which are 5MHz spaced. - */ - fracMode = 1; - refDivA = 1; - channelSel = CHANSEL_5G(freq); - - /* RefDivA setting */ - ath9k_hw_analog_shift_rmw(ah, AR_AN_SYNTH9, - AR_AN_SYNTH9_REFDIVA, - AR_AN_SYNTH9_REFDIVA_S, refDivA); - - } - - if (!fracMode) { - ndiv = (freq * (refDivA >> aModeRefSel)) / 60; - channelSel = ndiv & 0x1ff; - channelFrac = (ndiv & 0xfffffe00) * 2; - channelSel = (channelSel << 17) | channelFrac; - } - } - - reg32 = reg32 | - (bMode << 29) | - (fracMode << 28) | (aModeRefSel << 26) | (channelSel); - - REG_WRITE(ah, AR_PHY_SYNTH_CONTROL, reg32); - - ah->curchan = chan; - - return 0; -} - -/** - * ar9002_hw_spur_mitigate - convert baseband spur frequency - * @ah: atheros hardware structure - * @chan: - * - * For single-chip solutions. Converts to baseband spur frequency given the - * input channel frequency and compute register settings below. - */ -static void ar9002_hw_spur_mitigate(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - int bb_spur = AR_NO_SPUR; - int freq; - int bin, cur_bin; - int bb_spur_off, spur_subchannel_sd; - int spur_freq_sd; - int spur_delta_phase; - int denominator; - int upper, lower, cur_vit_mask; - int tmp, newVal; - int i; - static const int pilot_mask_reg[4] = { - AR_PHY_TIMING7, AR_PHY_TIMING8, - AR_PHY_PILOT_MASK_01_30, AR_PHY_PILOT_MASK_31_60 - }; - static const int chan_mask_reg[4] = { - AR_PHY_TIMING9, AR_PHY_TIMING10, - AR_PHY_CHANNEL_MASK_01_30, AR_PHY_CHANNEL_MASK_31_60 - }; - static const int inc[4] = { 0, 100, 0, 0 }; - struct chan_centers centers; - - int8_t mask_m[123]; - int8_t mask_p[123]; - int8_t mask_amt; - int tmp_mask; - int cur_bb_spur; - bool is2GHz = IS_CHAN_2GHZ(chan); - - memset(&mask_m, 0, sizeof(int8_t) * 123); - memset(&mask_p, 0, sizeof(int8_t) * 123); - - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - freq = centers.synth_center; - - ah->config.spurmode = SPUR_ENABLE_EEPROM; - for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { - cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz); - - if (AR_NO_SPUR == cur_bb_spur) - break; - - if (is2GHz) - cur_bb_spur = (cur_bb_spur / 10) + AR_BASE_FREQ_2GHZ; - else - cur_bb_spur = (cur_bb_spur / 10) + AR_BASE_FREQ_5GHZ; - - cur_bb_spur = cur_bb_spur - freq; - - if (IS_CHAN_HT40(chan)) { - if ((cur_bb_spur > -AR_SPUR_FEEQ_BOUND_HT40) && - (cur_bb_spur < AR_SPUR_FEEQ_BOUND_HT40)) { - bb_spur = cur_bb_spur; - break; - } - } else if ((cur_bb_spur > -AR_SPUR_FEEQ_BOUND_HT20) && - (cur_bb_spur < AR_SPUR_FEEQ_BOUND_HT20)) { - bb_spur = cur_bb_spur; - break; - } - } - - if (AR_NO_SPUR == bb_spur) { - REG_CLR_BIT(ah, AR_PHY_FORCE_CLKEN_CCK, - AR_PHY_FORCE_CLKEN_CCK_MRC_MUX); - return; - } else { - REG_CLR_BIT(ah, AR_PHY_FORCE_CLKEN_CCK, - AR_PHY_FORCE_CLKEN_CCK_MRC_MUX); - } - - bin = bb_spur * 320; - - tmp = REG_READ(ah, AR_PHY_TIMING_CTRL4(0)); - - ENABLE_REGWRITE_BUFFER(ah); - - newVal = tmp | (AR_PHY_TIMING_CTRL4_ENABLE_SPUR_RSSI | - AR_PHY_TIMING_CTRL4_ENABLE_SPUR_FILTER | - AR_PHY_TIMING_CTRL4_ENABLE_CHAN_MASK | - AR_PHY_TIMING_CTRL4_ENABLE_PILOT_MASK); - REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0), newVal); - - newVal = (AR_PHY_SPUR_REG_MASK_RATE_CNTL | - AR_PHY_SPUR_REG_ENABLE_MASK_PPM | - AR_PHY_SPUR_REG_MASK_RATE_SELECT | - AR_PHY_SPUR_REG_ENABLE_VIT_SPUR_RSSI | - SM(SPUR_RSSI_THRESH, AR_PHY_SPUR_REG_SPUR_RSSI_THRESH)); - REG_WRITE(ah, AR_PHY_SPUR_REG, newVal); - - if (IS_CHAN_HT40(chan)) { - if (bb_spur < 0) { - spur_subchannel_sd = 1; - bb_spur_off = bb_spur + 10; - } else { - spur_subchannel_sd = 0; - bb_spur_off = bb_spur - 10; - } - } else { - spur_subchannel_sd = 0; - bb_spur_off = bb_spur; - } - - if (IS_CHAN_HT40(chan)) - spur_delta_phase = - ((bb_spur * 262144) / - 10) & AR_PHY_TIMING11_SPUR_DELTA_PHASE; - else - spur_delta_phase = - ((bb_spur * 524288) / - 10) & AR_PHY_TIMING11_SPUR_DELTA_PHASE; - - denominator = IS_CHAN_2GHZ(chan) ? 44 : 40; - spur_freq_sd = ((bb_spur_off * 2048) / denominator) & 0x3ff; - - newVal = (AR_PHY_TIMING11_USE_SPUR_IN_AGC | - SM(spur_freq_sd, AR_PHY_TIMING11_SPUR_FREQ_SD) | - SM(spur_delta_phase, AR_PHY_TIMING11_SPUR_DELTA_PHASE)); - REG_WRITE(ah, AR_PHY_TIMING11, newVal); - - newVal = spur_subchannel_sd << AR_PHY_SFCORR_SPUR_SUBCHNL_SD_S; - REG_WRITE(ah, AR_PHY_SFCORR_EXT, newVal); - - cur_bin = -6000; - upper = bin + 100; - lower = bin - 100; - - for (i = 0; i < 4; i++) { - int pilot_mask = 0; - int chan_mask = 0; - int bp = 0; - for (bp = 0; bp < 30; bp++) { - if ((cur_bin > lower) && (cur_bin < upper)) { - pilot_mask = pilot_mask | 0x1 << bp; - chan_mask = chan_mask | 0x1 << bp; - } - cur_bin += 100; - } - cur_bin += inc[i]; - REG_WRITE(ah, pilot_mask_reg[i], pilot_mask); - REG_WRITE(ah, chan_mask_reg[i], chan_mask); - } - - cur_vit_mask = 6100; - upper = bin + 120; - lower = bin - 120; - - for (i = 0; i < 123; i++) { - if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) { - - /* workaround for gcc bug #37014 */ - volatile int tmp_v = abs(cur_vit_mask - bin); - - if (tmp_v < 75) - mask_amt = 1; - else - mask_amt = 0; - if (cur_vit_mask < 0) - mask_m[abs(cur_vit_mask / 100)] = mask_amt; - else - mask_p[cur_vit_mask / 100] = mask_amt; - } - cur_vit_mask -= 100; - } - - tmp_mask = (mask_m[46] << 30) | (mask_m[47] << 28) - | (mask_m[48] << 26) | (mask_m[49] << 24) - | (mask_m[50] << 22) | (mask_m[51] << 20) - | (mask_m[52] << 18) | (mask_m[53] << 16) - | (mask_m[54] << 14) | (mask_m[55] << 12) - | (mask_m[56] << 10) | (mask_m[57] << 8) - | (mask_m[58] << 6) | (mask_m[59] << 4) - | (mask_m[60] << 2) | (mask_m[61] << 0); - REG_WRITE(ah, AR_PHY_BIN_MASK_1, tmp_mask); - REG_WRITE(ah, AR_PHY_VIT_MASK2_M_46_61, tmp_mask); - - tmp_mask = (mask_m[31] << 28) - | (mask_m[32] << 26) | (mask_m[33] << 24) - | (mask_m[34] << 22) | (mask_m[35] << 20) - | (mask_m[36] << 18) | (mask_m[37] << 16) - | (mask_m[48] << 14) | (mask_m[39] << 12) - | (mask_m[40] << 10) | (mask_m[41] << 8) - | (mask_m[42] << 6) | (mask_m[43] << 4) - | (mask_m[44] << 2) | (mask_m[45] << 0); - REG_WRITE(ah, AR_PHY_BIN_MASK_2, tmp_mask); - REG_WRITE(ah, AR_PHY_MASK2_M_31_45, tmp_mask); - - tmp_mask = (mask_m[16] << 30) | (mask_m[16] << 28) - | (mask_m[18] << 26) | (mask_m[18] << 24) - | (mask_m[20] << 22) | (mask_m[20] << 20) - | (mask_m[22] << 18) | (mask_m[22] << 16) - | (mask_m[24] << 14) | (mask_m[24] << 12) - | (mask_m[25] << 10) | (mask_m[26] << 8) - | (mask_m[27] << 6) | (mask_m[28] << 4) - | (mask_m[29] << 2) | (mask_m[30] << 0); - REG_WRITE(ah, AR_PHY_BIN_MASK_3, tmp_mask); - REG_WRITE(ah, AR_PHY_MASK2_M_16_30, tmp_mask); - - tmp_mask = (mask_m[0] << 30) | (mask_m[1] << 28) - | (mask_m[2] << 26) | (mask_m[3] << 24) - | (mask_m[4] << 22) | (mask_m[5] << 20) - | (mask_m[6] << 18) | (mask_m[7] << 16) - | (mask_m[8] << 14) | (mask_m[9] << 12) - | (mask_m[10] << 10) | (mask_m[11] << 8) - | (mask_m[12] << 6) | (mask_m[13] << 4) - | (mask_m[14] << 2) | (mask_m[15] << 0); - REG_WRITE(ah, AR_PHY_MASK_CTL, tmp_mask); - REG_WRITE(ah, AR_PHY_MASK2_M_00_15, tmp_mask); - - tmp_mask = (mask_p[15] << 28) - | (mask_p[14] << 26) | (mask_p[13] << 24) - | (mask_p[12] << 22) | (mask_p[11] << 20) - | (mask_p[10] << 18) | (mask_p[9] << 16) - | (mask_p[8] << 14) | (mask_p[7] << 12) - | (mask_p[6] << 10) | (mask_p[5] << 8) - | (mask_p[4] << 6) | (mask_p[3] << 4) - | (mask_p[2] << 2) | (mask_p[1] << 0); - REG_WRITE(ah, AR_PHY_BIN_MASK2_1, tmp_mask); - REG_WRITE(ah, AR_PHY_MASK2_P_15_01, tmp_mask); - - tmp_mask = (mask_p[30] << 28) - | (mask_p[29] << 26) | (mask_p[28] << 24) - | (mask_p[27] << 22) | (mask_p[26] << 20) - | (mask_p[25] << 18) | (mask_p[24] << 16) - | (mask_p[23] << 14) | (mask_p[22] << 12) - | (mask_p[21] << 10) | (mask_p[20] << 8) - | (mask_p[19] << 6) | (mask_p[18] << 4) - | (mask_p[17] << 2) | (mask_p[16] << 0); - REG_WRITE(ah, AR_PHY_BIN_MASK2_2, tmp_mask); - REG_WRITE(ah, AR_PHY_MASK2_P_30_16, tmp_mask); - - tmp_mask = (mask_p[45] << 28) - | (mask_p[44] << 26) | (mask_p[43] << 24) - | (mask_p[42] << 22) | (mask_p[41] << 20) - | (mask_p[40] << 18) | (mask_p[39] << 16) - | (mask_p[38] << 14) | (mask_p[37] << 12) - | (mask_p[36] << 10) | (mask_p[35] << 8) - | (mask_p[34] << 6) | (mask_p[33] << 4) - | (mask_p[32] << 2) | (mask_p[31] << 0); - REG_WRITE(ah, AR_PHY_BIN_MASK2_3, tmp_mask); - REG_WRITE(ah, AR_PHY_MASK2_P_45_31, tmp_mask); - - tmp_mask = (mask_p[61] << 30) | (mask_p[60] << 28) - | (mask_p[59] << 26) | (mask_p[58] << 24) - | (mask_p[57] << 22) | (mask_p[56] << 20) - | (mask_p[55] << 18) | (mask_p[54] << 16) - | (mask_p[53] << 14) | (mask_p[52] << 12) - | (mask_p[51] << 10) | (mask_p[50] << 8) - | (mask_p[49] << 6) | (mask_p[48] << 4) - | (mask_p[47] << 2) | (mask_p[46] << 0); - REG_WRITE(ah, AR_PHY_BIN_MASK2_4, tmp_mask); - REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask); - - REGWRITE_BUFFER_FLUSH(ah); -} - -static void ar9002_olc_init(struct ath_hw *ah) -{ - u32 i; - - if (!OLC_FOR_AR9280_20_LATER) - return; - - if (OLC_FOR_AR9287_10_LATER) { - REG_SET_BIT(ah, AR_PHY_TX_PWRCTRL9, - AR_PHY_TX_PWRCTRL9_RES_DC_REMOVAL); - ath9k_hw_analog_shift_rmw(ah, AR9287_AN_TXPC0, - AR9287_AN_TXPC0_TXPCMODE, - AR9287_AN_TXPC0_TXPCMODE_S, - AR9287_AN_TXPC0_TXPCMODE_TEMPSENSE); - udelay(100); - } else { - for (i = 0; i < AR9280_TX_GAIN_TABLE_SIZE; i++) - ah->originalGain[i] = - MS(REG_READ(ah, AR_PHY_TX_GAIN_TBL1 + i * 4), - AR_PHY_TX_GAIN); - ah->PDADCdelta = 0; - } -} - -static u32 ar9002_hw_compute_pll_control(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - int ref_div = 5; - int pll_div = 0x2c; - u32 pll; - - if (chan && IS_CHAN_5GHZ(chan) && !IS_CHAN_A_FAST_CLOCK(ah, chan)) { - if (AR_SREV_9280_20(ah)) { - ref_div = 10; - pll_div = 0x50; - } else { - pll_div = 0x28; - } - } - - pll = SM(ref_div, AR_RTC_9160_PLL_REFDIV); - pll |= SM(pll_div, AR_RTC_9160_PLL_DIV); - - if (chan && IS_CHAN_HALF_RATE(chan)) - pll |= SM(0x1, AR_RTC_9160_PLL_CLKSEL); - else if (chan && IS_CHAN_QUARTER_RATE(chan)) - pll |= SM(0x2, AR_RTC_9160_PLL_CLKSEL); - - return pll; -} - -static void ar9002_hw_do_getnf(struct ath_hw *ah, - int16_t nfarray[NUM_NF_READINGS]) -{ - int16_t nf; - - nf = MS(REG_READ(ah, AR_PHY_CCA), AR9280_PHY_MINCCA_PWR); - nfarray[0] = sign_extend32(nf, 8); - - nf = MS(REG_READ(ah, AR_PHY_EXT_CCA), AR9280_PHY_EXT_MINCCA_PWR); - if (IS_CHAN_HT40(ah->curchan)) - nfarray[3] = sign_extend32(nf, 8); - - if (AR_SREV_9285(ah) || AR_SREV_9271(ah)) - return; - - nf = MS(REG_READ(ah, AR_PHY_CH1_CCA), AR9280_PHY_CH1_MINCCA_PWR); - nfarray[1] = sign_extend32(nf, 8); - - nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA), AR9280_PHY_CH1_EXT_MINCCA_PWR); - if (IS_CHAN_HT40(ah->curchan)) - nfarray[4] = sign_extend32(nf, 8); -} - -static void ar9002_hw_set_nf_limits(struct ath_hw *ah) -{ - if (AR_SREV_9285(ah)) { - ah->nf_2g.max = AR_PHY_CCA_MAX_GOOD_VAL_9285_2GHZ; - ah->nf_2g.min = AR_PHY_CCA_MIN_GOOD_VAL_9285_2GHZ; - ah->nf_2g.nominal = AR_PHY_CCA_NOM_VAL_9285_2GHZ; - } else if (AR_SREV_9287(ah)) { - ah->nf_2g.max = AR_PHY_CCA_MAX_GOOD_VAL_9287_2GHZ; - ah->nf_2g.min = AR_PHY_CCA_MIN_GOOD_VAL_9287_2GHZ; - ah->nf_2g.nominal = AR_PHY_CCA_NOM_VAL_9287_2GHZ; - } else if (AR_SREV_9271(ah)) { - ah->nf_2g.max = AR_PHY_CCA_MAX_GOOD_VAL_9271_2GHZ; - ah->nf_2g.min = AR_PHY_CCA_MIN_GOOD_VAL_9271_2GHZ; - ah->nf_2g.nominal = AR_PHY_CCA_NOM_VAL_9271_2GHZ; - } else { - ah->nf_2g.max = AR_PHY_CCA_MAX_GOOD_VAL_9280_2GHZ; - ah->nf_2g.min = AR_PHY_CCA_MIN_GOOD_VAL_9280_2GHZ; - ah->nf_2g.nominal = AR_PHY_CCA_NOM_VAL_9280_2GHZ; - ah->nf_5g.max = AR_PHY_CCA_MAX_GOOD_VAL_9280_5GHZ; - ah->nf_5g.min = AR_PHY_CCA_MIN_GOOD_VAL_9280_5GHZ; - ah->nf_5g.nominal = AR_PHY_CCA_NOM_VAL_9280_5GHZ; - } -} - -static void ar9002_hw_antdiv_comb_conf_get(struct ath_hw *ah, - struct ath_hw_antcomb_conf *antconf) -{ - u32 regval; - - regval = REG_READ(ah, AR_PHY_MULTICHAIN_GAIN_CTL); - antconf->main_lna_conf = (regval & AR_PHY_9285_ANT_DIV_MAIN_LNACONF) >> - AR_PHY_9285_ANT_DIV_MAIN_LNACONF_S; - antconf->alt_lna_conf = (regval & AR_PHY_9285_ANT_DIV_ALT_LNACONF) >> - AR_PHY_9285_ANT_DIV_ALT_LNACONF_S; - antconf->fast_div_bias = (regval & AR_PHY_9285_FAST_DIV_BIAS) >> - AR_PHY_9285_FAST_DIV_BIAS_S; - antconf->lna1_lna2_delta = -3; - antconf->div_group = 0; -} - -static void ar9002_hw_antdiv_comb_conf_set(struct ath_hw *ah, - struct ath_hw_antcomb_conf *antconf) -{ - u32 regval; - - regval = REG_READ(ah, AR_PHY_MULTICHAIN_GAIN_CTL); - regval &= ~(AR_PHY_9285_ANT_DIV_MAIN_LNACONF | - AR_PHY_9285_ANT_DIV_ALT_LNACONF | - AR_PHY_9285_FAST_DIV_BIAS); - regval |= ((antconf->main_lna_conf << AR_PHY_9285_ANT_DIV_MAIN_LNACONF_S) - & AR_PHY_9285_ANT_DIV_MAIN_LNACONF); - regval |= ((antconf->alt_lna_conf << AR_PHY_9285_ANT_DIV_ALT_LNACONF_S) - & AR_PHY_9285_ANT_DIV_ALT_LNACONF); - regval |= ((antconf->fast_div_bias << AR_PHY_9285_FAST_DIV_BIAS_S) - & AR_PHY_9285_FAST_DIV_BIAS); - - REG_WRITE(ah, AR_PHY_MULTICHAIN_GAIN_CTL, regval); -} - -static void ar9002_hw_spectral_scan_config(struct ath_hw *ah, - struct ath_spec_scan *param) -{ - u8 count; - - if (!param->enabled) { - REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_ENABLE); - return; - } - REG_SET_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_FFT_ENA); - REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENABLE); - - if (param->short_repeat) - REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT); - else - REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT); - - /* on AR92xx, the highest bit of count will make the the chip send - * spectral samples endlessly. Check if this really was intended, - * and fix otherwise. - */ - count = param->count; - if (param->endless) - count = 0x80; - else if (count & 0x80) - count = 0x7f; - - REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_COUNT, count); - REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_PERIOD, param->period); - REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_FFT_PERIOD, param->fft_period); - - return; -} - -static void ar9002_hw_spectral_scan_trigger(struct ath_hw *ah) -{ - REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENABLE); - /* Activate spectral scan */ - REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_ACTIVE); -} - -static void ar9002_hw_spectral_scan_wait(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - - /* Poll for spectral scan complete */ - if (!ath9k_hw_wait(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_ACTIVE, - 0, AH_WAIT_TIMEOUT)) { - ath_err(common, "spectral scan wait failed\n"); - return; - } -} - -void ar9002_hw_attach_phy_ops(struct ath_hw *ah) -{ - struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); - struct ath_hw_ops *ops = ath9k_hw_ops(ah); - - priv_ops->set_rf_regs = NULL; - priv_ops->rf_set_freq = ar9002_hw_set_channel; - priv_ops->spur_mitigate_freq = ar9002_hw_spur_mitigate; - priv_ops->olc_init = ar9002_olc_init; - priv_ops->compute_pll_control = ar9002_hw_compute_pll_control; - priv_ops->do_getnf = ar9002_hw_do_getnf; - - ops->antdiv_comb_conf_get = ar9002_hw_antdiv_comb_conf_get; - ops->antdiv_comb_conf_set = ar9002_hw_antdiv_comb_conf_set; - ops->spectral_scan_config = ar9002_hw_spectral_scan_config; - ops->spectral_scan_trigger = ar9002_hw_spectral_scan_trigger; - ops->spectral_scan_wait = ar9002_hw_spectral_scan_wait; - - ar9002_hw_set_nf_limits(ah); -} diff --git a/drivers/net/wireless/ath/ath9k/ar9002_phy.h b/drivers/net/wireless/ath/ath9k/ar9002_phy.h deleted file mode 100644 index f9eb2c357169..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h +++ /dev/null @@ -1,615 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef AR9002_PHY_H -#define AR9002_PHY_H - -#define AR_PHY_TEST 0x9800 -#define PHY_AGC_CLR 0x10000000 -#define RFSILENT_BB 0x00002000 - -#define AR_PHY_TURBO 0x9804 -#define AR_PHY_FC_TURBO_MODE 0x00000001 -#define AR_PHY_FC_TURBO_SHORT 0x00000002 -#define AR_PHY_FC_DYN2040_EN 0x00000004 -#define AR_PHY_FC_DYN2040_PRI_ONLY 0x00000008 -#define AR_PHY_FC_DYN2040_PRI_CH 0x00000010 -/* For 25 MHz channel spacing -- not used but supported by hw */ -#define AR_PHY_FC_DYN2040_EXT_CH 0x00000020 -#define AR_PHY_FC_HT_EN 0x00000040 -#define AR_PHY_FC_SHORT_GI_40 0x00000080 -#define AR_PHY_FC_WALSH 0x00000100 -#define AR_PHY_FC_SINGLE_HT_LTF1 0x00000200 -#define AR_PHY_FC_ENABLE_DAC_FIFO 0x00000800 - -#define AR_PHY_TEST2 0x9808 - -#define AR_PHY_TIMING2 0x9810 -#define AR_PHY_TIMING3 0x9814 -#define AR_PHY_TIMING3_DSC_MAN 0xFFFE0000 -#define AR_PHY_TIMING3_DSC_MAN_S 17 -#define AR_PHY_TIMING3_DSC_EXP 0x0001E000 -#define AR_PHY_TIMING3_DSC_EXP_S 13 - -#define AR_PHY_CHIP_ID_REV_0 0x80 -#define AR_PHY_CHIP_ID_REV_1 0x81 -#define AR_PHY_CHIP_ID_9160_REV_0 0xb0 - -#define AR_PHY_ACTIVE 0x981C -#define AR_PHY_ACTIVE_EN 0x00000001 -#define AR_PHY_ACTIVE_DIS 0x00000000 - -#define AR_PHY_RF_CTL2 0x9824 -#define AR_PHY_TX_END_DATA_START 0x000000FF -#define AR_PHY_TX_END_DATA_START_S 0 -#define AR_PHY_TX_END_PA_ON 0x0000FF00 -#define AR_PHY_TX_END_PA_ON_S 8 - -#define AR_PHY_RF_CTL3 0x9828 -#define AR_PHY_TX_END_TO_A2_RX_ON 0x00FF0000 -#define AR_PHY_TX_END_TO_A2_RX_ON_S 16 -#define AR_PHY_TX_END_TO_ADC_ON 0xFF000000 -#define AR_PHY_TX_END_TO_ADC_ON_S 24 - -#define AR_PHY_ADC_CTL 0x982C -#define AR_PHY_ADC_CTL_OFF_INBUFGAIN 0x00000003 -#define AR_PHY_ADC_CTL_OFF_INBUFGAIN_S 0 -#define AR_PHY_ADC_CTL_OFF_PWDDAC 0x00002000 -#define AR_PHY_ADC_CTL_OFF_PWDBANDGAP 0x00004000 -#define AR_PHY_ADC_CTL_OFF_PWDADC 0x00008000 -#define AR_PHY_ADC_CTL_ON_INBUFGAIN 0x00030000 -#define AR_PHY_ADC_CTL_ON_INBUFGAIN_S 16 - -#define AR_PHY_ADC_SERIAL_CTL 0x9830 -#define AR_PHY_SEL_INTERNAL_ADDAC 0x00000000 -#define AR_PHY_SEL_EXTERNAL_RADIO 0x00000001 - -#define AR_PHY_RF_CTL4 0x9834 -#define AR_PHY_RF_CTL4_TX_END_XPAB_OFF 0xFF000000 -#define AR_PHY_RF_CTL4_TX_END_XPAB_OFF_S 24 -#define AR_PHY_RF_CTL4_TX_END_XPAA_OFF 0x00FF0000 -#define AR_PHY_RF_CTL4_TX_END_XPAA_OFF_S 16 -#define AR_PHY_RF_CTL4_FRAME_XPAB_ON 0x0000FF00 -#define AR_PHY_RF_CTL4_FRAME_XPAB_ON_S 8 -#define AR_PHY_RF_CTL4_FRAME_XPAA_ON 0x000000FF -#define AR_PHY_RF_CTL4_FRAME_XPAA_ON_S 0 - -#define AR_PHY_TSTDAC_CONST 0x983c - -#define AR_PHY_SETTLING 0x9844 -#define AR_PHY_SETTLING_SWITCH 0x00003F80 -#define AR_PHY_SETTLING_SWITCH_S 7 - -#define AR_PHY_RXGAIN 0x9848 -#define AR_PHY_RXGAIN_TXRX_ATTEN 0x0003F000 -#define AR_PHY_RXGAIN_TXRX_ATTEN_S 12 -#define AR_PHY_RXGAIN_TXRX_RF_MAX 0x007C0000 -#define AR_PHY_RXGAIN_TXRX_RF_MAX_S 18 -#define AR9280_PHY_RXGAIN_TXRX_ATTEN 0x00003F80 -#define AR9280_PHY_RXGAIN_TXRX_ATTEN_S 7 -#define AR9280_PHY_RXGAIN_TXRX_MARGIN 0x001FC000 -#define AR9280_PHY_RXGAIN_TXRX_MARGIN_S 14 - -#define AR_PHY_DESIRED_SZ 0x9850 -#define AR_PHY_DESIRED_SZ_ADC 0x000000FF -#define AR_PHY_DESIRED_SZ_ADC_S 0 -#define AR_PHY_DESIRED_SZ_PGA 0x0000FF00 -#define AR_PHY_DESIRED_SZ_PGA_S 8 -#define AR_PHY_DESIRED_SZ_TOT_DES 0x0FF00000 -#define AR_PHY_DESIRED_SZ_TOT_DES_S 20 - -#define AR_PHY_FIND_SIG 0x9858 -#define AR_PHY_FIND_SIG_FIRSTEP 0x0003F000 -#define AR_PHY_FIND_SIG_FIRSTEP_S 12 -#define AR_PHY_FIND_SIG_FIRPWR 0x03FC0000 -#define AR_PHY_FIND_SIG_FIRPWR_S 18 - -#define AR_PHY_FIND_SIG_LOW 0x9840 -#define AR_PHY_FIND_SIG_FIRSTEP_LOW 0x00000FC0L -#define AR_PHY_FIND_SIG_FIRSTEP_LOW_S 6 - -#define AR_PHY_AGC_CTL1 0x985C -#define AR_PHY_AGC_CTL1_COARSE_LOW 0x00007F80 -#define AR_PHY_AGC_CTL1_COARSE_LOW_S 7 -#define AR_PHY_AGC_CTL1_COARSE_HIGH 0x003F8000 -#define AR_PHY_AGC_CTL1_COARSE_HIGH_S 15 - -#define AR_PHY_CCA 0x9864 -#define AR_PHY_MINCCA_PWR 0x0FF80000 -#define AR_PHY_MINCCA_PWR_S 19 -#define AR_PHY_CCA_THRESH62 0x0007F000 -#define AR_PHY_CCA_THRESH62_S 12 -#define AR9280_PHY_MINCCA_PWR 0x1FF00000 -#define AR9280_PHY_MINCCA_PWR_S 20 -#define AR9280_PHY_CCA_THRESH62 0x000FF000 -#define AR9280_PHY_CCA_THRESH62_S 12 - -#define AR_PHY_SFCORR_LOW 0x986C -#define AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW 0x00000001 -#define AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW 0x00003F00 -#define AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW_S 8 -#define AR_PHY_SFCORR_LOW_M1_THRESH_LOW 0x001FC000 -#define AR_PHY_SFCORR_LOW_M1_THRESH_LOW_S 14 -#define AR_PHY_SFCORR_LOW_M2_THRESH_LOW 0x0FE00000 -#define AR_PHY_SFCORR_LOW_M2_THRESH_LOW_S 21 - -#define AR_PHY_SFCORR 0x9868 -#define AR_PHY_SFCORR_M2COUNT_THR 0x0000001F -#define AR_PHY_SFCORR_M2COUNT_THR_S 0 -#define AR_PHY_SFCORR_M1_THRESH 0x00FE0000 -#define AR_PHY_SFCORR_M1_THRESH_S 17 -#define AR_PHY_SFCORR_M2_THRESH 0x7F000000 -#define AR_PHY_SFCORR_M2_THRESH_S 24 - -#define AR_PHY_SLEEP_CTR_CONTROL 0x9870 -#define AR_PHY_SLEEP_CTR_LIMIT 0x9874 -#define AR_PHY_SYNTH_CONTROL 0x9874 -#define AR_PHY_SLEEP_SCAL 0x9878 - -#define AR_PHY_PLL_CTL 0x987c -#define AR_PHY_PLL_CTL_40 0xaa -#define AR_PHY_PLL_CTL_40_5413 0x04 -#define AR_PHY_PLL_CTL_44 0xab -#define AR_PHY_PLL_CTL_44_2133 0xeb -#define AR_PHY_PLL_CTL_40_2133 0xea - -#define AR_PHY_SPECTRAL_SCAN 0x9910 /* AR9280 spectral scan configuration register */ -#define AR_PHY_SPECTRAL_SCAN_ENABLE 0x1 -#define AR_PHY_SPECTRAL_SCAN_ENA 0x00000001 /* Enable spectral scan, reg 68, bit 0 */ -#define AR_PHY_SPECTRAL_SCAN_ENA_S 0 /* Enable spectral scan, reg 68, bit 0 */ -#define AR_PHY_SPECTRAL_SCAN_ACTIVE 0x00000002 /* Activate spectral scan reg 68, bit 1*/ -#define AR_PHY_SPECTRAL_SCAN_ACTIVE_S 1 /* Activate spectral scan reg 68, bit 1*/ -#define AR_PHY_SPECTRAL_SCAN_FFT_PERIOD 0x000000F0 /* Interval for FFT reports, reg 68, bits 4-7*/ -#define AR_PHY_SPECTRAL_SCAN_FFT_PERIOD_S 4 -#define AR_PHY_SPECTRAL_SCAN_PERIOD 0x0000FF00 /* Interval for FFT reports, reg 68, bits 8-15*/ -#define AR_PHY_SPECTRAL_SCAN_PERIOD_S 8 -#define AR_PHY_SPECTRAL_SCAN_COUNT 0x00FF0000 /* Number of reports, reg 68, bits 16-23*/ -#define AR_PHY_SPECTRAL_SCAN_COUNT_S 16 -#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x01000000 /* Short repeat, reg 68, bit 24*/ -#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24 /* Short repeat, reg 68, bit 24*/ - -#define AR_PHY_RX_DELAY 0x9914 -#define AR_PHY_SEARCH_START_DELAY 0x9918 -#define AR_PHY_RX_DELAY_DELAY 0x00003FFF - -#define AR_PHY_TIMING_CTRL4(_i) (0x9920 + ((_i) << 12)) -#define AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF 0x01F -#define AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF_S 0 -#define AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF 0x7E0 -#define AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF_S 5 -#define AR_PHY_TIMING_CTRL4_IQCORR_ENABLE 0x800 -#define AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX 0xF000 -#define AR_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX_S 12 -#define AR_PHY_TIMING_CTRL4_DO_CAL 0x10000 - -#define AR_PHY_TIMING_CTRL4_ENABLE_SPUR_RSSI 0x80000000 -#define AR_PHY_TIMING_CTRL4_ENABLE_SPUR_FILTER 0x40000000 -#define AR_PHY_TIMING_CTRL4_ENABLE_CHAN_MASK 0x20000000 -#define AR_PHY_TIMING_CTRL4_ENABLE_PILOT_MASK 0x10000000 - -#define AR_PHY_TIMING5 0x9924 -#define AR_PHY_TIMING5_CYCPWR_THR1 0x000000FE -#define AR_PHY_TIMING5_CYCPWR_THR1_S 1 - -#define AR_PHY_POWER_TX_RATE1 0x9934 -#define AR_PHY_POWER_TX_RATE2 0x9938 -#define AR_PHY_POWER_TX_RATE_MAX 0x993c -#define AR_PHY_POWER_TX_RATE_MAX_TPC_ENABLE 0x00000040 - -#define AR_PHY_FRAME_CTL 0x9944 -#define AR_PHY_FRAME_CTL_TX_CLIP 0x00000038 -#define AR_PHY_FRAME_CTL_TX_CLIP_S 3 - -#define AR_PHY_TXPWRADJ 0x994C -#define AR_PHY_TXPWRADJ_CCK_GAIN_DELTA 0x00000FC0 -#define AR_PHY_TXPWRADJ_CCK_GAIN_DELTA_S 6 -#define AR_PHY_TXPWRADJ_CCK_PCDAC_INDEX 0x00FC0000 -#define AR_PHY_TXPWRADJ_CCK_PCDAC_INDEX_S 18 - -#define AR_PHY_RADAR_EXT 0x9940 -#define AR_PHY_RADAR_EXT_ENA 0x00004000 - -#define AR_PHY_RADAR_0 0x9954 -#define AR_PHY_RADAR_0_ENA 0x00000001 -#define AR_PHY_RADAR_0_FFT_ENA 0x80000000 -#define AR_PHY_RADAR_0_INBAND 0x0000003e -#define AR_PHY_RADAR_0_INBAND_S 1 -#define AR_PHY_RADAR_0_PRSSI 0x00000FC0 -#define AR_PHY_RADAR_0_PRSSI_S 6 -#define AR_PHY_RADAR_0_HEIGHT 0x0003F000 -#define AR_PHY_RADAR_0_HEIGHT_S 12 -#define AR_PHY_RADAR_0_RRSSI 0x00FC0000 -#define AR_PHY_RADAR_0_RRSSI_S 18 -#define AR_PHY_RADAR_0_FIRPWR 0x7F000000 -#define AR_PHY_RADAR_0_FIRPWR_S 24 - -#define AR_PHY_RADAR_1 0x9958 -#define AR_PHY_RADAR_1_RELPWR_ENA 0x00800000 -#define AR_PHY_RADAR_1_USE_FIR128 0x00400000 -#define AR_PHY_RADAR_1_RELPWR_THRESH 0x003F0000 -#define AR_PHY_RADAR_1_RELPWR_THRESH_S 16 -#define AR_PHY_RADAR_1_BLOCK_CHECK 0x00008000 -#define AR_PHY_RADAR_1_MAX_RRSSI 0x00004000 -#define AR_PHY_RADAR_1_RELSTEP_CHECK 0x00002000 -#define AR_PHY_RADAR_1_RELSTEP_THRESH 0x00001F00 -#define AR_PHY_RADAR_1_RELSTEP_THRESH_S 8 -#define AR_PHY_RADAR_1_MAXLEN 0x000000FF -#define AR_PHY_RADAR_1_MAXLEN_S 0 - -#define AR_PHY_SWITCH_CHAIN_0 0x9960 -#define AR_PHY_SWITCH_COM 0x9964 - -#define AR_PHY_SIGMA_DELTA 0x996C -#define AR_PHY_SIGMA_DELTA_ADC_SEL 0x00000003 -#define AR_PHY_SIGMA_DELTA_ADC_SEL_S 0 -#define AR_PHY_SIGMA_DELTA_FILT2 0x000000F8 -#define AR_PHY_SIGMA_DELTA_FILT2_S 3 -#define AR_PHY_SIGMA_DELTA_FILT1 0x00001F00 -#define AR_PHY_SIGMA_DELTA_FILT1_S 8 -#define AR_PHY_SIGMA_DELTA_ADC_CLIP 0x01FFE000 -#define AR_PHY_SIGMA_DELTA_ADC_CLIP_S 13 - -#define AR_PHY_RESTART 0x9970 -#define AR_PHY_RESTART_DIV_GC 0x001C0000 -#define AR_PHY_RESTART_DIV_GC_S 18 - -#define AR_PHY_RFBUS_REQ 0x997C -#define AR_PHY_RFBUS_REQ_EN 0x00000001 - -#define AR_PHY_TIMING7 0x9980 -#define AR_PHY_TIMING8 0x9984 -#define AR_PHY_TIMING8_PILOT_MASK_2 0x000FFFFF -#define AR_PHY_TIMING8_PILOT_MASK_2_S 0 - -#define AR_PHY_BIN_MASK2_1 0x9988 -#define AR_PHY_BIN_MASK2_2 0x998c -#define AR_PHY_BIN_MASK2_3 0x9990 -#define AR_PHY_BIN_MASK2_4 0x9994 - -#define AR_PHY_BIN_MASK_1 0x9900 -#define AR_PHY_BIN_MASK_2 0x9904 -#define AR_PHY_BIN_MASK_3 0x9908 - -#define AR_PHY_MASK_CTL 0x990c - -#define AR_PHY_BIN_MASK2_4_MASK_4 0x00003FFF -#define AR_PHY_BIN_MASK2_4_MASK_4_S 0 - -#define AR_PHY_TIMING9 0x9998 -#define AR_PHY_TIMING10 0x999c -#define AR_PHY_TIMING10_PILOT_MASK_2 0x000FFFFF -#define AR_PHY_TIMING10_PILOT_MASK_2_S 0 - -#define AR_PHY_TIMING11 0x99a0 -#define AR_PHY_TIMING11_SPUR_DELTA_PHASE 0x000FFFFF -#define AR_PHY_TIMING11_SPUR_DELTA_PHASE_S 0 -#define AR_PHY_TIMING11_USE_SPUR_IN_AGC 0x40000000 -#define AR_PHY_TIMING11_USE_SPUR_IN_SELFCOR 0x80000000 - -#define AR_PHY_RX_CHAINMASK 0x99a4 -#define AR_PHY_NEW_ADC_DC_GAIN_CORR(_i) (0x99b4 + ((_i) << 12)) -#define AR_PHY_NEW_ADC_GAIN_CORR_ENABLE 0x40000000 -#define AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE 0x80000000 - -#define AR_PHY_MULTICHAIN_GAIN_CTL 0x99ac -#define AR_PHY_9285_FAST_DIV_BIAS 0x00007E00 -#define AR_PHY_9285_FAST_DIV_BIAS_S 9 -#define AR_PHY_9285_ANT_DIV_CTL_ALL 0x7f000000 -#define AR_PHY_9285_ANT_DIV_CTL 0x01000000 -#define AR_PHY_9285_ANT_DIV_CTL_S 24 -#define AR_PHY_9285_ANT_DIV_ALT_LNACONF 0x06000000 -#define AR_PHY_9285_ANT_DIV_ALT_LNACONF_S 25 -#define AR_PHY_9285_ANT_DIV_MAIN_LNACONF 0x18000000 -#define AR_PHY_9285_ANT_DIV_MAIN_LNACONF_S 27 -#define AR_PHY_9285_ANT_DIV_ALT_GAINTB 0x20000000 -#define AR_PHY_9285_ANT_DIV_ALT_GAINTB_S 29 -#define AR_PHY_9285_ANT_DIV_MAIN_GAINTB 0x40000000 -#define AR_PHY_9285_ANT_DIV_MAIN_GAINTB_S 30 -#define AR_PHY_9285_ANT_DIV_LNA1 2 -#define AR_PHY_9285_ANT_DIV_LNA2 1 -#define AR_PHY_9285_ANT_DIV_LNA1_PLUS_LNA2 3 -#define AR_PHY_9285_ANT_DIV_LNA1_MINUS_LNA2 0 -#define AR_PHY_9285_ANT_DIV_GAINTB_0 0 -#define AR_PHY_9285_ANT_DIV_GAINTB_1 1 - -#define AR_PHY_EXT_CCA0 0x99b8 -#define AR_PHY_EXT_CCA0_THRESH62 0x000000FF -#define AR_PHY_EXT_CCA0_THRESH62_S 0 - -#define AR_PHY_EXT_CCA 0x99bc -#define AR_PHY_EXT_CCA_CYCPWR_THR1 0x0000FE00 -#define AR_PHY_EXT_CCA_CYCPWR_THR1_S 9 -#define AR_PHY_EXT_CCA_THRESH62 0x007F0000 -#define AR_PHY_EXT_CCA_THRESH62_S 16 -#define AR_PHY_EXT_TIMING5_CYCPWR_THR1 0x0000FE00L -#define AR_PHY_EXT_TIMING5_CYCPWR_THR1_S 9 - -#define AR_PHY_EXT_MINCCA_PWR 0xFF800000 -#define AR_PHY_EXT_MINCCA_PWR_S 23 -#define AR9280_PHY_EXT_MINCCA_PWR 0x01FF0000 -#define AR9280_PHY_EXT_MINCCA_PWR_S 16 - -#define AR_PHY_SFCORR_EXT 0x99c0 -#define AR_PHY_SFCORR_EXT_M1_THRESH 0x0000007F -#define AR_PHY_SFCORR_EXT_M1_THRESH_S 0 -#define AR_PHY_SFCORR_EXT_M2_THRESH 0x00003F80 -#define AR_PHY_SFCORR_EXT_M2_THRESH_S 7 -#define AR_PHY_SFCORR_EXT_M1_THRESH_LOW 0x001FC000 -#define AR_PHY_SFCORR_EXT_M1_THRESH_LOW_S 14 -#define AR_PHY_SFCORR_EXT_M2_THRESH_LOW 0x0FE00000 -#define AR_PHY_SFCORR_EXT_M2_THRESH_LOW_S 21 -#define AR_PHY_SFCORR_SPUR_SUBCHNL_SD_S 28 - -#define AR_PHY_HALFGI 0x99D0 -#define AR_PHY_HALFGI_DSC_MAN 0x0007FFF0 -#define AR_PHY_HALFGI_DSC_MAN_S 4 -#define AR_PHY_HALFGI_DSC_EXP 0x0000000F -#define AR_PHY_HALFGI_DSC_EXP_S 0 - -#define AR_PHY_CHAN_INFO_MEMORY 0x99DC -#define AR_PHY_CHAN_INFO_MEMORY_CAPTURE_MASK 0x0001 - -#define AR_PHY_HEAVY_CLIP_ENABLE 0x99E0 - -#define AR_PHY_HEAVY_CLIP_FACTOR_RIFS 0x99EC -#define AR_PHY_RIFS_INIT_DELAY 0x03ff0000 - -#define AR_PHY_M_SLEEP 0x99f0 -#define AR_PHY_REFCLKDLY 0x99f4 -#define AR_PHY_REFCLKPD 0x99f8 - -#define AR_PHY_CALMODE 0x99f0 - -#define AR_PHY_CALMODE_IQ 0x00000000 -#define AR_PHY_CALMODE_ADC_GAIN 0x00000001 -#define AR_PHY_CALMODE_ADC_DC_PER 0x00000002 -#define AR_PHY_CALMODE_ADC_DC_INIT 0x00000003 - -#define AR_PHY_CAL_MEAS_0(_i) (0x9c10 + ((_i) << 12)) -#define AR_PHY_CAL_MEAS_1(_i) (0x9c14 + ((_i) << 12)) -#define AR_PHY_CAL_MEAS_2(_i) (0x9c18 + ((_i) << 12)) -#define AR_PHY_CAL_MEAS_3(_i) (0x9c1c + ((_i) << 12)) - -#define AR_PHY_CURRENT_RSSI 0x9c1c -#define AR9280_PHY_CURRENT_RSSI 0x9c3c - -#define AR_PHY_RFBUS_GRANT 0x9C20 -#define AR_PHY_RFBUS_GRANT_EN 0x00000001 - -#define AR_PHY_CHAN_INFO_GAIN_DIFF 0x9CF4 -#define AR_PHY_CHAN_INFO_GAIN_DIFF_UPPER_LIMIT 320 - -#define AR_PHY_CHAN_INFO_GAIN 0x9CFC - -#define AR_PHY_MODE 0xA200 -#define AR_PHY_MODE_ASYNCFIFO 0x80 -#define AR_PHY_MODE_AR2133 0x08 -#define AR_PHY_MODE_AR5111 0x00 -#define AR_PHY_MODE_AR5112 0x08 -#define AR_PHY_MODE_DYNAMIC 0x04 -#define AR_PHY_MODE_RF2GHZ 0x02 -#define AR_PHY_MODE_RF5GHZ 0x00 -#define AR_PHY_MODE_CCK 0x01 -#define AR_PHY_MODE_OFDM 0x00 -#define AR_PHY_MODE_DYN_CCK_DISABLE 0x100 - -#define AR_PHY_CCK_TX_CTRL 0xA204 -#define AR_PHY_CCK_TX_CTRL_JAPAN 0x00000010 -#define AR_PHY_CCK_TX_CTRL_TX_DAC_SCALE_CCK 0x0000000C -#define AR_PHY_CCK_TX_CTRL_TX_DAC_SCALE_CCK_S 2 - -#define AR_PHY_CCK_DETECT 0xA208 -#define AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK 0x0000003F -#define AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK_S 0 -/* [12:6] settling time for antenna switch */ -#define AR_PHY_CCK_DETECT_ANT_SWITCH_TIME 0x00001FC0 -#define AR_PHY_CCK_DETECT_ANT_SWITCH_TIME_S 6 -#define AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV 0x2000 -#define AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV_S 13 - -#define AR_PHY_GAIN_2GHZ 0xA20C -#define AR_PHY_GAIN_2GHZ_RXTX_MARGIN 0x00FC0000 -#define AR_PHY_GAIN_2GHZ_RXTX_MARGIN_S 18 -#define AR_PHY_GAIN_2GHZ_BSW_MARGIN 0x00003C00 -#define AR_PHY_GAIN_2GHZ_BSW_MARGIN_S 10 -#define AR_PHY_GAIN_2GHZ_BSW_ATTEN 0x0000001F -#define AR_PHY_GAIN_2GHZ_BSW_ATTEN_S 0 - -#define AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN 0x003E0000 -#define AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN_S 17 -#define AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN 0x0001F000 -#define AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN_S 12 -#define AR_PHY_GAIN_2GHZ_XATTEN2_DB 0x00000FC0 -#define AR_PHY_GAIN_2GHZ_XATTEN2_DB_S 6 -#define AR_PHY_GAIN_2GHZ_XATTEN1_DB 0x0000003F -#define AR_PHY_GAIN_2GHZ_XATTEN1_DB_S 0 - -#define AR_PHY_CCK_RXCTRL4 0xA21C -#define AR_PHY_CCK_RXCTRL4_FREQ_EST_SHORT 0x01F80000 -#define AR_PHY_CCK_RXCTRL4_FREQ_EST_SHORT_S 19 - -#define AR_PHY_DAG_CTRLCCK 0xA228 -#define AR_PHY_DAG_CTRLCCK_EN_RSSI_THR 0x00000200 -#define AR_PHY_DAG_CTRLCCK_RSSI_THR 0x0001FC00 -#define AR_PHY_DAG_CTRLCCK_RSSI_THR_S 10 - -#define AR_PHY_FORCE_CLKEN_CCK 0xA22C -#define AR_PHY_FORCE_CLKEN_CCK_MRC_MUX 0x00000040 - -#define AR_PHY_POWER_TX_RATE3 0xA234 -#define AR_PHY_POWER_TX_RATE4 0xA238 - -#define AR_PHY_SCRM_SEQ_XR 0xA23C -#define AR_PHY_HEADER_DETECT_XR 0xA240 -#define AR_PHY_CHIRP_DETECTED_XR 0xA244 -#define AR_PHY_BLUETOOTH 0xA254 - -#define AR_PHY_TPCRG1 0xA258 -#define AR_PHY_TPCRG1_NUM_PD_GAIN 0x0000c000 -#define AR_PHY_TPCRG1_NUM_PD_GAIN_S 14 - -#define AR_PHY_TPCRG1_PD_GAIN_1 0x00030000 -#define AR_PHY_TPCRG1_PD_GAIN_1_S 16 -#define AR_PHY_TPCRG1_PD_GAIN_2 0x000C0000 -#define AR_PHY_TPCRG1_PD_GAIN_2_S 18 -#define AR_PHY_TPCRG1_PD_GAIN_3 0x00300000 -#define AR_PHY_TPCRG1_PD_GAIN_3_S 20 - -#define AR_PHY_TPCRG1_PD_CAL_ENABLE 0x00400000 -#define AR_PHY_TPCRG1_PD_CAL_ENABLE_S 22 - -#define AR_PHY_TX_PWRCTRL4 0xa264 -#define AR_PHY_TX_PWRCTRL_PD_AVG_VALID 0x00000001 -#define AR_PHY_TX_PWRCTRL_PD_AVG_VALID_S 0 -#define AR_PHY_TX_PWRCTRL_PD_AVG_OUT 0x000001FE -#define AR_PHY_TX_PWRCTRL_PD_AVG_OUT_S 1 - -#define AR_PHY_TX_PWRCTRL6_0 0xa270 -#define AR_PHY_TX_PWRCTRL6_1 0xb270 -#define AR_PHY_TX_PWRCTRL_ERR_EST_MODE 0x03000000 -#define AR_PHY_TX_PWRCTRL_ERR_EST_MODE_S 24 - -#define AR_PHY_TX_PWRCTRL7 0xa274 -#define AR_PHY_TX_PWRCTRL_INIT_TX_GAIN 0x01F80000 -#define AR_PHY_TX_PWRCTRL_INIT_TX_GAIN_S 19 - -#define AR_PHY_TX_PWRCTRL8 0xa278 - -#define AR_PHY_TX_PWRCTRL9 0xa27C - -#define AR_PHY_TX_PWRCTRL10 0xa394 -#define AR_PHY_TX_DESIRED_SCALE_CCK 0x00007C00 -#define AR_PHY_TX_DESIRED_SCALE_CCK_S 10 -#define AR_PHY_TX_PWRCTRL9_RES_DC_REMOVAL 0x80000000 -#define AR_PHY_TX_PWRCTRL9_RES_DC_REMOVAL_S 31 - -#define AR_PHY_TX_GAIN_TBL1 0xa300 -#define AR_PHY_TX_GAIN 0x0007F000 -#define AR_PHY_TX_GAIN_S 12 - -#define AR_PHY_CH0_TX_PWRCTRL11 0xa398 -#define AR_PHY_CH1_TX_PWRCTRL11 0xb398 -#define AR_PHY_CH0_TX_PWRCTRL12 0xa3dc -#define AR_PHY_CH0_TX_PWRCTRL13 0xa3e0 -#define AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP 0x0000FC00 -#define AR_PHY_TX_PWRCTRL_OLPC_TEMP_COMP_S 10 - -#define AR_PHY_VIT_MASK2_M_46_61 0xa3a0 -#define AR_PHY_MASK2_M_31_45 0xa3a4 -#define AR_PHY_MASK2_M_16_30 0xa3a8 -#define AR_PHY_MASK2_M_00_15 0xa3ac -#define AR_PHY_MASK2_P_15_01 0xa3b8 -#define AR_PHY_MASK2_P_30_16 0xa3bc -#define AR_PHY_MASK2_P_45_31 0xa3c0 -#define AR_PHY_MASK2_P_61_45 0xa3c4 -#define AR_PHY_SPUR_REG 0x994c - -#define AR_PHY_SPUR_REG_MASK_RATE_CNTL (0xFF << 18) -#define AR_PHY_SPUR_REG_MASK_RATE_CNTL_S 18 - -#define AR_PHY_SPUR_REG_ENABLE_MASK_PPM 0x20000 -#define AR_PHY_SPUR_REG_MASK_RATE_SELECT (0xFF << 9) -#define AR_PHY_SPUR_REG_MASK_RATE_SELECT_S 9 -#define AR_PHY_SPUR_REG_ENABLE_VIT_SPUR_RSSI 0x100 -#define AR_PHY_SPUR_REG_SPUR_RSSI_THRESH 0x7F -#define AR_PHY_SPUR_REG_SPUR_RSSI_THRESH_S 0 - -#define AR_PHY_PILOT_MASK_01_30 0xa3b0 -#define AR_PHY_PILOT_MASK_31_60 0xa3b4 - -#define AR_PHY_CHANNEL_MASK_01_30 0x99d4 -#define AR_PHY_CHANNEL_MASK_31_60 0x99d8 - -#define AR_PHY_ANALOG_SWAP 0xa268 -#define AR_PHY_SWAP_ALT_CHAIN 0x00000040 - -#define AR_PHY_TPCRG5 0xA26C -#define AR_PHY_TPCRG5_PD_GAIN_OVERLAP 0x0000000F -#define AR_PHY_TPCRG5_PD_GAIN_OVERLAP_S 0 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1 0x000003F0 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1_S 4 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2 0x0000FC00 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2_S 10 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3 0x003F0000 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3_S 16 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4 0x0FC00000 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4_S 22 - -/* Carrier leak calibration control, do it after AGC calibration */ -#define AR_PHY_CL_CAL_CTL 0xA358 -#define AR_PHY_CL_CAL_ENABLE 0x00000002 -#define AR_PHY_PARALLEL_CAL_ENABLE 0x00000001 - -#define AR_PHY_POWER_TX_RATE5 0xA38C -#define AR_PHY_POWER_TX_RATE6 0xA390 - -#define AR_PHY_CAL_CHAINMASK 0xA39C - -#define AR_PHY_POWER_TX_SUB 0xA3C8 -#define AR_PHY_POWER_TX_RATE7 0xA3CC -#define AR_PHY_POWER_TX_RATE8 0xA3D0 -#define AR_PHY_POWER_TX_RATE9 0xA3D4 - -#define AR_PHY_XPA_CFG 0xA3D8 -#define AR_PHY_FORCE_XPA_CFG 0x000000001 -#define AR_PHY_FORCE_XPA_CFG_S 0 - -#define AR_PHY_CH1_CCA 0xa864 -#define AR_PHY_CH1_MINCCA_PWR 0x0FF80000 -#define AR_PHY_CH1_MINCCA_PWR_S 19 -#define AR9280_PHY_CH1_MINCCA_PWR 0x1FF00000 -#define AR9280_PHY_CH1_MINCCA_PWR_S 20 - -#define AR_PHY_CH2_CCA 0xb864 -#define AR_PHY_CH2_MINCCA_PWR 0x0FF80000 -#define AR_PHY_CH2_MINCCA_PWR_S 19 - -#define AR_PHY_CH1_EXT_CCA 0xa9bc -#define AR_PHY_CH1_EXT_MINCCA_PWR 0xFF800000 -#define AR_PHY_CH1_EXT_MINCCA_PWR_S 23 -#define AR9280_PHY_CH1_EXT_MINCCA_PWR 0x01FF0000 -#define AR9280_PHY_CH1_EXT_MINCCA_PWR_S 16 - -#define AR_PHY_CH2_EXT_CCA 0xb9bc -#define AR_PHY_CH2_EXT_MINCCA_PWR 0xFF800000 -#define AR_PHY_CH2_EXT_MINCCA_PWR_S 23 - -#define AR_PHY_CCA_NOM_VAL_5416_2GHZ -90 -#define AR_PHY_CCA_NOM_VAL_5416_5GHZ -100 -#define AR_PHY_CCA_MIN_GOOD_VAL_5416_2GHZ -100 -#define AR_PHY_CCA_MIN_GOOD_VAL_5416_5GHZ -110 -#define AR_PHY_CCA_MAX_GOOD_VAL_5416_2GHZ -80 -#define AR_PHY_CCA_MAX_GOOD_VAL_5416_5GHZ -90 - -#define AR_PHY_CCA_NOM_VAL_9280_2GHZ -112 -#define AR_PHY_CCA_NOM_VAL_9280_5GHZ -112 -#define AR_PHY_CCA_MIN_GOOD_VAL_9280_2GHZ -127 -#define AR_PHY_CCA_MIN_GOOD_VAL_9280_5GHZ -122 -#define AR_PHY_CCA_MAX_GOOD_VAL_9280_2GHZ -97 -#define AR_PHY_CCA_MAX_GOOD_VAL_9280_5GHZ -102 - -#define AR_PHY_CCA_NOM_VAL_9285_2GHZ -118 -#define AR_PHY_CCA_MIN_GOOD_VAL_9285_2GHZ -127 -#define AR_PHY_CCA_MAX_GOOD_VAL_9285_2GHZ -108 - -#define AR_PHY_CCA_NOM_VAL_9271_2GHZ -118 -#define AR_PHY_CCA_MIN_GOOD_VAL_9271_2GHZ -127 -#define AR_PHY_CCA_MAX_GOOD_VAL_9271_2GHZ -116 - -#define AR_PHY_CCA_NOM_VAL_9287_2GHZ -120 -#define AR_PHY_CCA_MIN_GOOD_VAL_9287_2GHZ -127 -#define AR_PHY_CCA_MAX_GOOD_VAL_9287_2GHZ -110 - -#endif diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h deleted file mode 100644 index 7546b9a7dcbf..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h +++ /dev/null @@ -1,1741 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef INITVALS_9003_2P2_H -#define INITVALS_9003_2P2_H - -/* AR9003 2.2 */ - -static const u32 ar9300_2p2_radio_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0001609c, 0x0dd08f29, 0x0dd08f29, 0x0b283f31, 0x0b283f31}, - {0x000160ac, 0xa4653c00, 0xa4653c00, 0x24652800, 0x24652800}, - {0x000160b0, 0x03284f3e, 0x03284f3e, 0x05d08f20, 0x05d08f20}, - {0x0001610c, 0xc8000000, 0xc0000000, 0xc0000000, 0xc0000000}, - {0x00016140, 0x10804008, 0x10804008, 0x50804008, 0x50804008}, - {0x0001650c, 0xc8000000, 0xc0000000, 0xc0000000, 0xc0000000}, - {0x00016540, 0x10804008, 0x10804008, 0x50804008, 0x50804008}, - {0x0001690c, 0xc8000000, 0xc0000000, 0xc0000000, 0xc0000000}, - {0x00016940, 0x10804008, 0x10804008, 0x50804008, 0x50804008}, -}; - -static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, - {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402}, - {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, - {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, - {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, - {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, - {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, - {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, - {0x0000a544, 0x52022470, 0x52022470, 0x3f001861, 0x3f001861}, - {0x0000a548, 0x55022490, 0x55022490, 0x43001a81, 0x43001a81}, - {0x0000a54c, 0x59022492, 0x59022492, 0x47001a83, 0x47001a83}, - {0x0000a550, 0x5d022692, 0x5d022692, 0x4a001c84, 0x4a001c84}, - {0x0000a554, 0x61022892, 0x61022892, 0x4e001ce3, 0x4e001ce3}, - {0x0000a558, 0x65024890, 0x65024890, 0x52001ce5, 0x52001ce5}, - {0x0000a55c, 0x69024892, 0x69024892, 0x56001ce9, 0x56001ce9}, - {0x0000a560, 0x6e024c92, 0x6e024c92, 0x5a001ceb, 0x5a001ceb}, - {0x0000a564, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, - {0x0000a568, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, - {0x0000a56c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, - {0x0000a570, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, - {0x0000a574, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, - {0x0000a578, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, - {0x0000a57c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, - {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, - {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, - {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, - {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, - {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, - {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400}, - {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402}, - {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404}, - {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603}, - {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02}, - {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04}, - {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20}, - {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20}, - {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22}, - {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24}, - {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640}, - {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660}, - {0x0000a5c4, 0x52822470, 0x52822470, 0x3f801861, 0x3f801861}, - {0x0000a5c8, 0x55822490, 0x55822490, 0x43801a81, 0x43801a81}, - {0x0000a5cc, 0x59822492, 0x59822492, 0x47801a83, 0x47801a83}, - {0x0000a5d0, 0x5d822692, 0x5d822692, 0x4a801c84, 0x4a801c84}, - {0x0000a5d4, 0x61822892, 0x61822892, 0x4e801ce3, 0x4e801ce3}, - {0x0000a5d8, 0x65824890, 0x65824890, 0x52801ce5, 0x52801ce5}, - {0x0000a5dc, 0x69824892, 0x69824892, 0x56801ce9, 0x56801ce9}, - {0x0000a5e0, 0x6e824c92, 0x6e824c92, 0x5a801ceb, 0x5a801ceb}, - {0x0000a5e4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, - {0x0000a5e8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, - {0x0000a5ec, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, - {0x0000a5f0, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, - {0x0000a5f4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, - {0x0000a5f8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, - {0x0000a5fc, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x02004000, 0x02004000, 0x01404000, 0x01404000}, - {0x0000a618, 0x02004801, 0x02004801, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02808a02, 0x02808a02, 0x02008501, 0x02008501}, - {0x0000a620, 0x0380ce03, 0x0380ce03, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x04411104, 0x04411104, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x04411104, 0x04411104, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000a630, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000a634, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000a638, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000a63c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000c2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, - {0x0000c2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, - {0x0000c2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, - {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016048, 0x62480001, 0x62480001, 0x62480001, 0x62480001}, - {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016448, 0x62480001, 0x62480001, 0x62480001, 0x62480001}, - {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016848, 0x62480001, 0x62480001, 0x62480001, 0x62480001}, - {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, -}; - -static const u32 ar9300Modes_fast_clock_2p2[][3] = { - /* Addr 5G_HT20 5G_HT40 */ - {0x00001030, 0x00000268, 0x000004d0}, - {0x00001070, 0x0000018c, 0x00000318}, - {0x000010b0, 0x00000fd0, 0x00001fa0}, - {0x00008014, 0x044c044c, 0x08980898}, - {0x0000801c, 0x148ec02b, 0x148ec057}, - {0x00008318, 0x000044c0, 0x00008980}, - {0x00009e00, 0x0372131c, 0x0372131c}, - {0x0000a230, 0x0000000b, 0x00000016}, - {0x0000a254, 0x00000898, 0x00001130}, -}; - -static const u32 ar9300_2p2_radio_core[][2] = { - /* Addr allmodes */ - {0x00016000, 0x36db6db6}, - {0x00016004, 0x6db6db40}, - {0x00016008, 0x73f00000}, - {0x0001600c, 0x00000000}, - {0x00016040, 0x7f80fff8}, - {0x0001604c, 0x76d005b5}, - {0x00016050, 0x556cf031}, - {0x00016054, 0x13449440}, - {0x00016058, 0x0c51c92c}, - {0x0001605c, 0x3db7fffc}, - {0x00016060, 0xfffffffc}, - {0x00016064, 0x000f0278}, - {0x0001606c, 0x6db60000}, - {0x00016080, 0x00000000}, - {0x00016084, 0x0e48048c}, - {0x00016088, 0x54214514}, - {0x0001608c, 0x119f481e}, - {0x00016090, 0x24926490}, - {0x00016098, 0xd2888888}, - {0x000160a0, 0x0a108ffe}, - {0x000160a4, 0x812fc370}, - {0x000160a8, 0x423c8000}, - {0x000160b4, 0x92480080}, - {0x000160c0, 0x00adb6d0}, - {0x000160c4, 0x6db6db60}, - {0x000160c8, 0x6db6db6c}, - {0x000160cc, 0x01e6c000}, - {0x00016100, 0x3fffbe01}, - {0x00016104, 0xfff80000}, - {0x00016108, 0x00080010}, - {0x00016144, 0x02084080}, - {0x00016148, 0x00000000}, - {0x00016280, 0x058a0001}, - {0x00016284, 0x3d840208}, - {0x00016288, 0x05a20408}, - {0x0001628c, 0x00038c07}, - {0x00016290, 0x00000004}, - {0x00016294, 0x458a214f}, - {0x00016380, 0x00000000}, - {0x00016384, 0x00000000}, - {0x00016388, 0x00800700}, - {0x0001638c, 0x00800700}, - {0x00016390, 0x00800700}, - {0x00016394, 0x00000000}, - {0x00016398, 0x00000000}, - {0x0001639c, 0x00000000}, - {0x000163a0, 0x00000001}, - {0x000163a4, 0x00000001}, - {0x000163a8, 0x00000000}, - {0x000163ac, 0x00000000}, - {0x000163b0, 0x00000000}, - {0x000163b4, 0x00000000}, - {0x000163b8, 0x00000000}, - {0x000163bc, 0x00000000}, - {0x000163c0, 0x000000a0}, - {0x000163c4, 0x000c0000}, - {0x000163c8, 0x14021402}, - {0x000163cc, 0x00001402}, - {0x000163d0, 0x00000000}, - {0x000163d4, 0x00000000}, - {0x00016400, 0x36db6db6}, - {0x00016404, 0x6db6db40}, - {0x00016408, 0x73f00000}, - {0x0001640c, 0x00000000}, - {0x00016440, 0x7f80fff8}, - {0x0001644c, 0x76d005b5}, - {0x00016450, 0x556cf031}, - {0x00016454, 0x13449440}, - {0x00016458, 0x0c51c92c}, - {0x0001645c, 0x3db7fffc}, - {0x00016460, 0xfffffffc}, - {0x00016464, 0x000f0278}, - {0x0001646c, 0x6db60000}, - {0x00016500, 0x3fffbe01}, - {0x00016504, 0xfff80000}, - {0x00016508, 0x00080010}, - {0x00016544, 0x02084080}, - {0x00016548, 0x00000000}, - {0x00016780, 0x00000000}, - {0x00016784, 0x00000000}, - {0x00016788, 0x00800700}, - {0x0001678c, 0x00800700}, - {0x00016790, 0x00800700}, - {0x00016794, 0x00000000}, - {0x00016798, 0x00000000}, - {0x0001679c, 0x00000000}, - {0x000167a0, 0x00000001}, - {0x000167a4, 0x00000001}, - {0x000167a8, 0x00000000}, - {0x000167ac, 0x00000000}, - {0x000167b0, 0x00000000}, - {0x000167b4, 0x00000000}, - {0x000167b8, 0x00000000}, - {0x000167bc, 0x00000000}, - {0x000167c0, 0x000000a0}, - {0x000167c4, 0x000c0000}, - {0x000167c8, 0x14021402}, - {0x000167cc, 0x00001402}, - {0x000167d0, 0x00000000}, - {0x000167d4, 0x00000000}, - {0x00016800, 0x36db6db6}, - {0x00016804, 0x6db6db40}, - {0x00016808, 0x73f00000}, - {0x0001680c, 0x00000000}, - {0x00016840, 0x7f80fff8}, - {0x0001684c, 0x76d005b5}, - {0x00016850, 0x556cf031}, - {0x00016854, 0x13449440}, - {0x00016858, 0x0c51c92c}, - {0x0001685c, 0x3db7fffc}, - {0x00016860, 0xfffffffc}, - {0x00016864, 0x000f0278}, - {0x0001686c, 0x6db60000}, - {0x00016900, 0x3fffbe01}, - {0x00016904, 0xfff80000}, - {0x00016908, 0x00080010}, - {0x00016944, 0x02084080}, - {0x00016948, 0x00000000}, - {0x00016b80, 0x00000000}, - {0x00016b84, 0x00000000}, - {0x00016b88, 0x00800700}, - {0x00016b8c, 0x00800700}, - {0x00016b90, 0x00800700}, - {0x00016b94, 0x00000000}, - {0x00016b98, 0x00000000}, - {0x00016b9c, 0x00000000}, - {0x00016ba0, 0x00000001}, - {0x00016ba4, 0x00000001}, - {0x00016ba8, 0x00000000}, - {0x00016bac, 0x00000000}, - {0x00016bb0, 0x00000000}, - {0x00016bb4, 0x00000000}, - {0x00016bb8, 0x00000000}, - {0x00016bbc, 0x00000000}, - {0x00016bc0, 0x000000a0}, - {0x00016bc4, 0x000c0000}, - {0x00016bc8, 0x14021402}, - {0x00016bcc, 0x00001402}, - {0x00016bd0, 0x00000000}, - {0x00016bd4, 0x00000000}, -}; - -static const u32 ar9300_2p2_mac_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, - {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, - {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, - {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, - {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b}, - {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, - {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, - {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, -}; - -static const u32 ar9300_2p2_soc_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00007010, 0x00000023, 0x00000023, 0x00000023, 0x00000023}, -}; - -static const u32 ar9300_2p2_baseband_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8011, 0xd00a8011}, - {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a012e}, - {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, - {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, - {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, - {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c}, - {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4}, - {0x00009e00, 0x0372111a, 0x0372111a, 0x037216a0, 0x037216a0}, - {0x00009e04, 0x001c2020, 0x001c2020, 0x001c2020, 0x001c2020}, - {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, - {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e}, - {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3379605e, 0x33795d5e}, - {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, - {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, - {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, - {0x00009e3c, 0xcf946220, 0xcf946220, 0xcf946222, 0xcf946222}, - {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27}, - {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, - {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, - {0x0000a204, 0x000036c0, 0x000036c4, 0x000036c4, 0x000036c0}, - {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, - {0x0000a22c, 0x01026a2f, 0x01026a2f, 0x01026a2f, 0x01026a2f}, - {0x0000a230, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b}, - {0x0000a234, 0x00000fff, 0x10000fff, 0x10000fff, 0x00000fff}, - {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018}, - {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002}, - {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, - {0x0000a260, 0x0a021501, 0x0a021501, 0x3a021501, 0x3a021501}, - {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b}, - {0x0000a284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, - {0x0000a288, 0x00000110, 0x00000110, 0x00000110, 0x00000110}, - {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222}, - {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, - {0x0000a2d0, 0x00041981, 0x00041981, 0x00041981, 0x00041982}, - {0x0000a2d8, 0x7999a83b, 0x7999a83b, 0x7999a83b, 0x7999a83b}, - {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000}, - {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, - {0x0000b284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, - {0x0000b830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000be04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000}, - {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000be1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000be20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, - {0x0000c284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, -}; - -static const u32 ar9300_2p2_baseband_core[][2] = { - /* Addr allmodes */ - {0x00009800, 0xafe68e30}, - {0x00009804, 0xfd14e000}, - {0x00009808, 0x9c0a9f6b}, - {0x0000980c, 0x04900000}, - {0x00009814, 0x9280c00a}, - {0x00009818, 0x00000000}, - {0x0000981c, 0x00020028}, - {0x00009834, 0x6400a290}, - {0x00009838, 0x0108ecff}, - {0x0000983c, 0x0d000600}, - {0x00009880, 0x201fff00}, - {0x00009884, 0x00001042}, - {0x000098a4, 0x00200400}, - {0x000098b0, 0x32840bbe}, - {0x000098d0, 0x004b6a8e}, - {0x000098d4, 0x00000820}, - {0x000098dc, 0x00000000}, - {0x000098f0, 0x00000000}, - {0x000098f4, 0x00000000}, - {0x00009c04, 0xff55ff55}, - {0x00009c08, 0x0320ff55}, - {0x00009c0c, 0x00000000}, - {0x00009c10, 0x00000000}, - {0x00009c14, 0x00046384}, - {0x00009c18, 0x05b6b440}, - {0x00009c1c, 0x00b6b440}, - {0x00009d00, 0xc080a333}, - {0x00009d04, 0x40206c10}, - {0x00009d08, 0x009c4060}, - {0x00009d0c, 0x9883800a}, - {0x00009d10, 0x01834061}, - {0x00009d14, 0x00c0040b}, - {0x00009d18, 0x00000000}, - {0x00009e08, 0x0038230c}, - {0x00009e24, 0x990bb515}, - {0x00009e28, 0x0c6f0000}, - {0x00009e30, 0x06336f77}, - {0x00009e34, 0x6af6532f}, - {0x00009e38, 0x0cc80c00}, - {0x00009e40, 0x0d261820}, - {0x00009e4c, 0x00001004}, - {0x00009e50, 0x00ff03f1}, - {0x00009e54, 0x00000000}, - {0x00009fc0, 0x803e4788}, - {0x00009fc4, 0x0001efb5}, - {0x00009fcc, 0x40000014}, - {0x00009fd0, 0x01193b93}, - {0x0000a20c, 0x00000000}, - {0x0000a220, 0x00000000}, - {0x0000a224, 0x00000000}, - {0x0000a228, 0x10002310}, - {0x0000a23c, 0x00000000}, - {0x0000a244, 0x0c000000}, - {0x0000a2a0, 0x00000001}, - {0x0000a2c0, 0x00000001}, - {0x0000a2c8, 0x00000000}, - {0x0000a2cc, 0x18c43433}, - {0x0000a2d4, 0x00000000}, - {0x0000a2ec, 0x00000000}, - {0x0000a2f0, 0x00000000}, - {0x0000a2f4, 0x00000000}, - {0x0000a2f8, 0x00000000}, - {0x0000a344, 0x00000000}, - {0x0000a34c, 0x00000000}, - {0x0000a350, 0x0000a000}, - {0x0000a364, 0x00000000}, - {0x0000a370, 0x00000000}, - {0x0000a390, 0x00000001}, - {0x0000a394, 0x00000444}, - {0x0000a398, 0x001f0e0f}, - {0x0000a39c, 0x0075393f}, - {0x0000a3a0, 0xb79f6427}, - {0x0000a3a4, 0x00000000}, - {0x0000a3a8, 0xaaaaaaaa}, - {0x0000a3ac, 0x3c466478}, - {0x0000a3c0, 0x20202020}, - {0x0000a3c4, 0x22222220}, - {0x0000a3c8, 0x20200020}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3d8, 0x20202020}, - {0x0000a3dc, 0x20202020}, - {0x0000a3e0, 0x20202020}, - {0x0000a3e4, 0x20202020}, - {0x0000a3e8, 0x20202020}, - {0x0000a3ec, 0x20202020}, - {0x0000a3f0, 0x00000000}, - {0x0000a3f4, 0x00000246}, - {0x0000a3f8, 0x0c9bd380}, - {0x0000a3fc, 0x000f0f01}, - {0x0000a400, 0x8fa91f01}, - {0x0000a404, 0x00000000}, - {0x0000a408, 0x0e79e5c6}, - {0x0000a40c, 0x00820820}, - {0x0000a414, 0x1ce739ce}, - {0x0000a418, 0x2d001dce}, - {0x0000a41c, 0x1ce739ce}, - {0x0000a420, 0x000001ce}, - {0x0000a424, 0x1ce739ce}, - {0x0000a428, 0x000001ce}, - {0x0000a42c, 0x1ce739ce}, - {0x0000a430, 0x1ce739ce}, - {0x0000a434, 0x00000000}, - {0x0000a438, 0x00001801}, - {0x0000a43c, 0x00100000}, - {0x0000a440, 0x00000000}, - {0x0000a444, 0x00000000}, - {0x0000a448, 0x05000080}, - {0x0000a44c, 0x00000001}, - {0x0000a450, 0x00010000}, - {0x0000a458, 0x00000000}, - {0x0000a640, 0x00000000}, - {0x0000a644, 0x3fad9d74}, - {0x0000a648, 0x0048060a}, - {0x0000a64c, 0x00003c37}, - {0x0000a670, 0x03020100}, - {0x0000a674, 0x09080504}, - {0x0000a678, 0x0d0c0b0a}, - {0x0000a67c, 0x13121110}, - {0x0000a680, 0x31301514}, - {0x0000a684, 0x35343332}, - {0x0000a688, 0x00000036}, - {0x0000a690, 0x00000838}, - {0x0000a7c0, 0x00000000}, - {0x0000a7c4, 0xfffffffc}, - {0x0000a7c8, 0x00000000}, - {0x0000a7cc, 0x00000000}, - {0x0000a7d0, 0x00000000}, - {0x0000a7d4, 0x00000004}, - {0x0000a7dc, 0x00000001}, - {0x0000a8d0, 0x004b6a8e}, - {0x0000a8d4, 0x00000820}, - {0x0000a8dc, 0x00000000}, - {0x0000a8f0, 0x00000000}, - {0x0000a8f4, 0x00000000}, - {0x0000b2d0, 0x00000080}, - {0x0000b2d4, 0x00000000}, - {0x0000b2ec, 0x00000000}, - {0x0000b2f0, 0x00000000}, - {0x0000b2f4, 0x00000000}, - {0x0000b2f8, 0x00000000}, - {0x0000b408, 0x0e79e5c0}, - {0x0000b40c, 0x00820820}, - {0x0000b420, 0x00000000}, - {0x0000b8d0, 0x004b6a8e}, - {0x0000b8d4, 0x00000820}, - {0x0000b8dc, 0x00000000}, - {0x0000b8f0, 0x00000000}, - {0x0000b8f4, 0x00000000}, - {0x0000c2d0, 0x00000080}, - {0x0000c2d4, 0x00000000}, - {0x0000c2ec, 0x00000000}, - {0x0000c2f0, 0x00000000}, - {0x0000c2f4, 0x00000000}, - {0x0000c2f8, 0x00000000}, - {0x0000c408, 0x0e79e5c0}, - {0x0000c40c, 0x00820820}, - {0x0000c420, 0x00000000}, -}; - -static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, - {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, - {0x0000a508, 0x09002421, 0x09002421, 0x08000004, 0x08000004}, - {0x0000a50c, 0x0d002621, 0x0d002621, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x13004620, 0x13004620, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x19004a20, 0x19004a20, 0x11000400, 0x11000400}, - {0x0000a518, 0x1d004e20, 0x1d004e20, 0x15000402, 0x15000402}, - {0x0000a51c, 0x21005420, 0x21005420, 0x19000404, 0x19000404}, - {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000603, 0x1b000603}, - {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000a02, 0x1f000a02}, - {0x0000a528, 0x2f005e42, 0x2f005e42, 0x23000a04, 0x23000a04}, - {0x0000a52c, 0x33005e44, 0x33005e44, 0x26000a20, 0x26000a20}, - {0x0000a530, 0x38005e65, 0x38005e65, 0x2a000e20, 0x2a000e20}, - {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2e000e22, 0x2e000e22}, - {0x0000a538, 0x40005e6b, 0x40005e6b, 0x31000e24, 0x31000e24}, - {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x34001640, 0x34001640}, - {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, - {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, - {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, - {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83}, - {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, - {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, - {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, - {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x50001ce9, 0x50001ce9}, - {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x54001ceb, 0x54001ceb}, - {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, - {0x0000a584, 0x04802222, 0x04802222, 0x04800002, 0x04800002}, - {0x0000a588, 0x09802421, 0x09802421, 0x08800004, 0x08800004}, - {0x0000a58c, 0x0d802621, 0x0d802621, 0x0b800200, 0x0b800200}, - {0x0000a590, 0x13804620, 0x13804620, 0x0f800202, 0x0f800202}, - {0x0000a594, 0x19804a20, 0x19804a20, 0x11800400, 0x11800400}, - {0x0000a598, 0x1d804e20, 0x1d804e20, 0x15800402, 0x15800402}, - {0x0000a59c, 0x21805420, 0x21805420, 0x19800404, 0x19800404}, - {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800603, 0x1b800603}, - {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800a02, 0x1f800a02}, - {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x23800a04, 0x23800a04}, - {0x0000a5ac, 0x33805e44, 0x33805e44, 0x26800a20, 0x26800a20}, - {0x0000a5b0, 0x38805e65, 0x38805e65, 0x2a800e20, 0x2a800e20}, - {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2e800e22, 0x2e800e22}, - {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x31800e24, 0x31800e24}, - {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x34801640, 0x34801640}, - {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38801660, 0x38801660}, - {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b801861, 0x3b801861}, - {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e801a81, 0x3e801a81}, - {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42801a83, 0x42801a83}, - {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x44801c84, 0x44801c84}, - {0x0000a5d4, 0x61827f12, 0x61827f12, 0x48801ce3, 0x48801ce3}, - {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c801ce5, 0x4c801ce5}, - {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x50801ce9, 0x50801ce9}, - {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x54801ceb, 0x54801ceb}, - {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, - {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, - {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501}, - {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501}, - {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, - {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016448, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, - {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016848, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, - {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, -}; - -static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x01feee00, 0x01feee00, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x0000f000, 0x0000f000, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x01ff0000, 0x01ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, - {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, - {0x0000a508, 0x09002421, 0x09002421, 0x08000004, 0x08000004}, - {0x0000a50c, 0x0d002621, 0x0d002621, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x13004620, 0x13004620, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x19004a20, 0x19004a20, 0x11000400, 0x11000400}, - {0x0000a518, 0x1d004e20, 0x1d004e20, 0x15000402, 0x15000402}, - {0x0000a51c, 0x21005420, 0x21005420, 0x19000404, 0x19000404}, - {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000603, 0x1b000603}, - {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000a02, 0x1f000a02}, - {0x0000a528, 0x2f005e42, 0x2f005e42, 0x23000a04, 0x23000a04}, - {0x0000a52c, 0x33005e44, 0x33005e44, 0x26000a20, 0x26000a20}, - {0x0000a530, 0x38005e65, 0x38005e65, 0x2a000e20, 0x2a000e20}, - {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2e000e22, 0x2e000e22}, - {0x0000a538, 0x40005e6b, 0x40005e6b, 0x31000e24, 0x31000e24}, - {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x34001640, 0x34001640}, - {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, - {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, - {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, - {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83}, - {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, - {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, - {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, - {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x50001ce9, 0x50001ce9}, - {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x54001ceb, 0x54001ceb}, - {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, - {0x0000a584, 0x04802222, 0x04802222, 0x04800002, 0x04800002}, - {0x0000a588, 0x09802421, 0x09802421, 0x08800004, 0x08800004}, - {0x0000a58c, 0x0d802621, 0x0d802621, 0x0b800200, 0x0b800200}, - {0x0000a590, 0x13804620, 0x13804620, 0x0f800202, 0x0f800202}, - {0x0000a594, 0x19804a20, 0x19804a20, 0x11800400, 0x11800400}, - {0x0000a598, 0x1d804e20, 0x1d804e20, 0x15800402, 0x15800402}, - {0x0000a59c, 0x21805420, 0x21805420, 0x19800404, 0x19800404}, - {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800603, 0x1b800603}, - {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800a02, 0x1f800a02}, - {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x23800a04, 0x23800a04}, - {0x0000a5ac, 0x33805e44, 0x33805e44, 0x26800a20, 0x26800a20}, - {0x0000a5b0, 0x38805e65, 0x38805e65, 0x2a800e20, 0x2a800e20}, - {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2e800e22, 0x2e800e22}, - {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x31800e24, 0x31800e24}, - {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x34801640, 0x34801640}, - {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38801660, 0x38801660}, - {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b801861, 0x3b801861}, - {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e801a81, 0x3e801a81}, - {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42801a83, 0x42801a83}, - {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x44801c84, 0x44801c84}, - {0x0000a5d4, 0x61827f12, 0x61827f12, 0x48801ce3, 0x48801ce3}, - {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c801ce5, 0x4c801ce5}, - {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x50801ce9, 0x50801ce9}, - {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x54801ceb, 0x54801ceb}, - {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, - {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, - {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501}, - {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501}, - {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x01feee00, 0x01feee00, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x0000f000, 0x0000f000, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x01ff0000, 0x01ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000c2dc, 0x01feee00, 0x01feee00, 0x03aaa352, 0x03aaa352}, - {0x0000c2e0, 0x0000f000, 0x0000f000, 0x03ccc584, 0x03ccc584}, - {0x0000c2e4, 0x01ff0000, 0x01ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, - {0x00016048, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001}, - {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016444, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, - {0x00016448, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001}, - {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016844, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, - {0x00016848, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001}, - {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, -}; - -static const u32 ar9300Modes_mixed_ob_db_tx_gain_table_2p2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x1c000223, 0x1c000223, 0x11000400, 0x11000400}, - {0x0000a518, 0x21002220, 0x21002220, 0x15000402, 0x15000402}, - {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, - {0x0000a520, 0x2b022220, 0x2b022220, 0x1b000603, 0x1b000603}, - {0x0000a524, 0x2f022222, 0x2f022222, 0x1f000a02, 0x1f000a02}, - {0x0000a528, 0x34022225, 0x34022225, 0x23000a04, 0x23000a04}, - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x26000a20, 0x26000a20}, - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2a000e20, 0x2a000e20}, - {0x0000a534, 0x4202242a, 0x4202242a, 0x2e000e22, 0x2e000e22}, - {0x0000a538, 0x4702244a, 0x4702244a, 0x31000e24, 0x31000e24}, - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x34001640, 0x34001640}, - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x38001660, 0x38001660}, - {0x0000a544, 0x52022470, 0x52022470, 0x3b001861, 0x3b001861}, - {0x0000a548, 0x55022490, 0x55022490, 0x3e001a81, 0x3e001a81}, - {0x0000a54c, 0x59022492, 0x59022492, 0x42001a83, 0x42001a83}, - {0x0000a550, 0x5d022692, 0x5d022692, 0x44001c84, 0x44001c84}, - {0x0000a554, 0x61022892, 0x61022892, 0x48001ce3, 0x48001ce3}, - {0x0000a558, 0x65024890, 0x65024890, 0x4c001ce5, 0x4c001ce5}, - {0x0000a55c, 0x69024892, 0x69024892, 0x50001ce9, 0x50001ce9}, - {0x0000a560, 0x6e024c92, 0x6e024c92, 0x54001ceb, 0x54001ceb}, - {0x0000a564, 0x74026e92, 0x74026e92, 0x56001eec, 0x56001eec}, - {0x0000a568, 0x74026e92, 0x74026e92, 0x56001eec, 0x56001eec}, - {0x0000a56c, 0x74026e92, 0x74026e92, 0x56001eec, 0x56001eec}, - {0x0000a570, 0x74026e92, 0x74026e92, 0x56001eec, 0x56001eec}, - {0x0000a574, 0x74026e92, 0x74026e92, 0x56001eec, 0x56001eec}, - {0x0000a578, 0x74026e92, 0x74026e92, 0x56001eec, 0x56001eec}, - {0x0000a57c, 0x74026e92, 0x74026e92, 0x56001eec, 0x56001eec}, - {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, - {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, - {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, - {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, - {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, - {0x0000a594, 0x1c800223, 0x1c800223, 0x11800400, 0x11800400}, - {0x0000a598, 0x21802220, 0x21802220, 0x15800402, 0x15800402}, - {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404}, - {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1b800603, 0x1b800603}, - {0x0000a5a4, 0x2f822222, 0x2f822222, 0x1f800a02, 0x1f800a02}, - {0x0000a5a8, 0x34822225, 0x34822225, 0x23800a04, 0x23800a04}, - {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x26800a20, 0x26800a20}, - {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2a800e20, 0x2a800e20}, - {0x0000a5b4, 0x4282242a, 0x4282242a, 0x2e800e22, 0x2e800e22}, - {0x0000a5b8, 0x4782244a, 0x4782244a, 0x31800e24, 0x31800e24}, - {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x34801640, 0x34801640}, - {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x38801660, 0x38801660}, - {0x0000a5c4, 0x52822470, 0x52822470, 0x3b801861, 0x3b801861}, - {0x0000a5c8, 0x55822490, 0x55822490, 0x3e801a81, 0x3e801a81}, - {0x0000a5cc, 0x59822492, 0x59822492, 0x42801a83, 0x42801a83}, - {0x0000a5d0, 0x5d822692, 0x5d822692, 0x44801c84, 0x44801c84}, - {0x0000a5d4, 0x61822892, 0x61822892, 0x48801ce3, 0x48801ce3}, - {0x0000a5d8, 0x65824890, 0x65824890, 0x4c801ce5, 0x4c801ce5}, - {0x0000a5dc, 0x69824892, 0x69824892, 0x50801ce9, 0x50801ce9}, - {0x0000a5e0, 0x6e824c92, 0x6e824c92, 0x54801ceb, 0x54801ceb}, - {0x0000a5e4, 0x74826e92, 0x74826e92, 0x56801eec, 0x56801eec}, - {0x0000a5e8, 0x74826e92, 0x74826e92, 0x56801eec, 0x56801eec}, - {0x0000a5ec, 0x74826e92, 0x74826e92, 0x56801eec, 0x56801eec}, - {0x0000a5f0, 0x74826e92, 0x74826e92, 0x56801eec, 0x56801eec}, - {0x0000a5f4, 0x74826e92, 0x74826e92, 0x56801eec, 0x56801eec}, - {0x0000a5f8, 0x74826e92, 0x74826e92, 0x56801eec, 0x56801eec}, - {0x0000a5fc, 0x74826e92, 0x74826e92, 0x56801eec, 0x56801eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x02004000, 0x02004000, 0x01404000, 0x01404000}, - {0x0000a618, 0x02004801, 0x02004801, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02808a02, 0x02808a02, 0x02008501, 0x02008501}, - {0x0000a620, 0x0380ce03, 0x0380ce03, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x04411104, 0x04411104, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x04411104, 0x04411104, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000a630, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000a634, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000a638, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000a63c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000c2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, - {0x0000c2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, - {0x0000c2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, - {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x012492d4, 0x012492d4, 0x056db2e4, 0x056db2e4}, - {0x00016048, 0x66480001, 0x66480001, 0x8e480001, 0x8e480001}, - {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016444, 0x012492d4, 0x012492d4, 0x056db2e4, 0x056db2e4}, - {0x00016448, 0x66480001, 0x66480001, 0x8e480001, 0x8e480001}, - {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016844, 0x012492d4, 0x012492d4, 0x056db2e4, 0x056db2e4}, - {0x00016848, 0x66480001, 0x66480001, 0x8e480001, 0x8e480001}, - {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, -}; - -static const u32 ar9300Modes_type5_tx_gain_table_2p2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x15000028, 0x15000028, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x1b00002b, 0x1b00002b, 0x12000400, 0x12000400}, - {0x0000a518, 0x1f020028, 0x1f020028, 0x16000402, 0x16000402}, - {0x0000a51c, 0x2502002b, 0x2502002b, 0x19000404, 0x19000404}, - {0x0000a520, 0x2a04002a, 0x2a04002a, 0x1c000603, 0x1c000603}, - {0x0000a524, 0x2e06002a, 0x2e06002a, 0x21000a02, 0x21000a02}, - {0x0000a528, 0x3302202d, 0x3302202d, 0x25000a04, 0x25000a04}, - {0x0000a52c, 0x3804202c, 0x3804202c, 0x28000a20, 0x28000a20}, - {0x0000a530, 0x3c06202c, 0x3c06202c, 0x2c000e20, 0x2c000e20}, - {0x0000a534, 0x4108202d, 0x4108202d, 0x30000e22, 0x30000e22}, - {0x0000a538, 0x4506402d, 0x4506402d, 0x34000e24, 0x34000e24}, - {0x0000a53c, 0x4906222d, 0x4906222d, 0x38001640, 0x38001640}, - {0x0000a540, 0x4d062231, 0x4d062231, 0x3c001660, 0x3c001660}, - {0x0000a544, 0x50082231, 0x50082231, 0x3f001861, 0x3f001861}, - {0x0000a548, 0x5608422e, 0x5608422e, 0x43001a81, 0x43001a81}, - {0x0000a54c, 0x5e08442e, 0x5e08442e, 0x47001a83, 0x47001a83}, - {0x0000a550, 0x620a4431, 0x620a4431, 0x4a001c84, 0x4a001c84}, - {0x0000a554, 0x640a4432, 0x640a4432, 0x4e001ce3, 0x4e001ce3}, - {0x0000a558, 0x680a4434, 0x680a4434, 0x52001ce5, 0x52001ce5}, - {0x0000a55c, 0x6c0a6434, 0x6c0a6434, 0x56001ce9, 0x56001ce9}, - {0x0000a560, 0x6f0a6633, 0x6f0a6633, 0x5a001ceb, 0x5a001ceb}, - {0x0000a564, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, - {0x0000a568, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, - {0x0000a56c, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, - {0x0000a570, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, - {0x0000a574, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, - {0x0000a578, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, - {0x0000a57c, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, - {0x0000a60c, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, - {0x0000a610, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, - {0x0000a614, 0x01804601, 0x01804601, 0x01404000, 0x01404000}, - {0x0000a618, 0x01804601, 0x01804601, 0x01404501, 0x01404501}, - {0x0000a61c, 0x01804601, 0x01804601, 0x02008501, 0x02008501}, - {0x0000a620, 0x03408d02, 0x03408d02, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x03410d04, 0x03410d04, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, - {0x0000a630, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, - {0x0000a634, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, - {0x0000a638, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, - {0x0000a63c, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000c2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, - {0x0000c2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, - {0x0000c2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, - {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016048, 0x65240001, 0x65240001, 0x66480001, 0x66480001}, - {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016448, 0x65240001, 0x65240001, 0x66480001, 0x66480001}, - {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016848, 0x65240001, 0x65240001, 0x66480001, 0x66480001}, - {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, -}; - -static const u32 ar9300Common_rx_gain_table_2p2[][2] = { - /* Addr allmodes */ - {0x0000a000, 0x00010000}, - {0x0000a004, 0x00030002}, - {0x0000a008, 0x00050004}, - {0x0000a00c, 0x00810080}, - {0x0000a010, 0x00830082}, - {0x0000a014, 0x01810180}, - {0x0000a018, 0x01830182}, - {0x0000a01c, 0x01850184}, - {0x0000a020, 0x01890188}, - {0x0000a024, 0x018b018a}, - {0x0000a028, 0x018d018c}, - {0x0000a02c, 0x01910190}, - {0x0000a030, 0x01930192}, - {0x0000a034, 0x01950194}, - {0x0000a038, 0x038a0196}, - {0x0000a03c, 0x038c038b}, - {0x0000a040, 0x0390038d}, - {0x0000a044, 0x03920391}, - {0x0000a048, 0x03940393}, - {0x0000a04c, 0x03960395}, - {0x0000a050, 0x00000000}, - {0x0000a054, 0x00000000}, - {0x0000a058, 0x00000000}, - {0x0000a05c, 0x00000000}, - {0x0000a060, 0x00000000}, - {0x0000a064, 0x00000000}, - {0x0000a068, 0x00000000}, - {0x0000a06c, 0x00000000}, - {0x0000a070, 0x00000000}, - {0x0000a074, 0x00000000}, - {0x0000a078, 0x00000000}, - {0x0000a07c, 0x00000000}, - {0x0000a080, 0x22222229}, - {0x0000a084, 0x1d1d1d1d}, - {0x0000a088, 0x1d1d1d1d}, - {0x0000a08c, 0x1d1d1d1d}, - {0x0000a090, 0x171d1d1d}, - {0x0000a094, 0x11111717}, - {0x0000a098, 0x00030311}, - {0x0000a09c, 0x00000000}, - {0x0000a0a0, 0x00000000}, - {0x0000a0a4, 0x00000000}, - {0x0000a0a8, 0x00000000}, - {0x0000a0ac, 0x00000000}, - {0x0000a0b0, 0x00000000}, - {0x0000a0b4, 0x00000000}, - {0x0000a0b8, 0x00000000}, - {0x0000a0bc, 0x00000000}, - {0x0000a0c0, 0x001f0000}, - {0x0000a0c4, 0x01000101}, - {0x0000a0c8, 0x011e011f}, - {0x0000a0cc, 0x011c011d}, - {0x0000a0d0, 0x02030204}, - {0x0000a0d4, 0x02010202}, - {0x0000a0d8, 0x021f0200}, - {0x0000a0dc, 0x0302021e}, - {0x0000a0e0, 0x03000301}, - {0x0000a0e4, 0x031e031f}, - {0x0000a0e8, 0x0402031d}, - {0x0000a0ec, 0x04000401}, - {0x0000a0f0, 0x041e041f}, - {0x0000a0f4, 0x0502041d}, - {0x0000a0f8, 0x05000501}, - {0x0000a0fc, 0x051e051f}, - {0x0000a100, 0x06010602}, - {0x0000a104, 0x061f0600}, - {0x0000a108, 0x061d061e}, - {0x0000a10c, 0x07020703}, - {0x0000a110, 0x07000701}, - {0x0000a114, 0x00000000}, - {0x0000a118, 0x00000000}, - {0x0000a11c, 0x00000000}, - {0x0000a120, 0x00000000}, - {0x0000a124, 0x00000000}, - {0x0000a128, 0x00000000}, - {0x0000a12c, 0x00000000}, - {0x0000a130, 0x00000000}, - {0x0000a134, 0x00000000}, - {0x0000a138, 0x00000000}, - {0x0000a13c, 0x00000000}, - {0x0000a140, 0x001f0000}, - {0x0000a144, 0x01000101}, - {0x0000a148, 0x011e011f}, - {0x0000a14c, 0x011c011d}, - {0x0000a150, 0x02030204}, - {0x0000a154, 0x02010202}, - {0x0000a158, 0x021f0200}, - {0x0000a15c, 0x0302021e}, - {0x0000a160, 0x03000301}, - {0x0000a164, 0x031e031f}, - {0x0000a168, 0x0402031d}, - {0x0000a16c, 0x04000401}, - {0x0000a170, 0x041e041f}, - {0x0000a174, 0x0502041d}, - {0x0000a178, 0x05000501}, - {0x0000a17c, 0x051e051f}, - {0x0000a180, 0x06010602}, - {0x0000a184, 0x061f0600}, - {0x0000a188, 0x061d061e}, - {0x0000a18c, 0x07020703}, - {0x0000a190, 0x07000701}, - {0x0000a194, 0x00000000}, - {0x0000a198, 0x00000000}, - {0x0000a19c, 0x00000000}, - {0x0000a1a0, 0x00000000}, - {0x0000a1a4, 0x00000000}, - {0x0000a1a8, 0x00000000}, - {0x0000a1ac, 0x00000000}, - {0x0000a1b0, 0x00000000}, - {0x0000a1b4, 0x00000000}, - {0x0000a1b8, 0x00000000}, - {0x0000a1bc, 0x00000000}, - {0x0000a1c0, 0x00000000}, - {0x0000a1c4, 0x00000000}, - {0x0000a1c8, 0x00000000}, - {0x0000a1cc, 0x00000000}, - {0x0000a1d0, 0x00000000}, - {0x0000a1d4, 0x00000000}, - {0x0000a1d8, 0x00000000}, - {0x0000a1dc, 0x00000000}, - {0x0000a1e0, 0x00000000}, - {0x0000a1e4, 0x00000000}, - {0x0000a1e8, 0x00000000}, - {0x0000a1ec, 0x00000000}, - {0x0000a1f0, 0x00000396}, - {0x0000a1f4, 0x00000396}, - {0x0000a1f8, 0x00000396}, - {0x0000a1fc, 0x00000196}, - {0x0000b000, 0x00010000}, - {0x0000b004, 0x00030002}, - {0x0000b008, 0x00050004}, - {0x0000b00c, 0x00810080}, - {0x0000b010, 0x00830082}, - {0x0000b014, 0x01810180}, - {0x0000b018, 0x01830182}, - {0x0000b01c, 0x01850184}, - {0x0000b020, 0x02810280}, - {0x0000b024, 0x02830282}, - {0x0000b028, 0x02850284}, - {0x0000b02c, 0x02890288}, - {0x0000b030, 0x028b028a}, - {0x0000b034, 0x0388028c}, - {0x0000b038, 0x038a0389}, - {0x0000b03c, 0x038c038b}, - {0x0000b040, 0x0390038d}, - {0x0000b044, 0x03920391}, - {0x0000b048, 0x03940393}, - {0x0000b04c, 0x03960395}, - {0x0000b050, 0x00000000}, - {0x0000b054, 0x00000000}, - {0x0000b058, 0x00000000}, - {0x0000b05c, 0x00000000}, - {0x0000b060, 0x00000000}, - {0x0000b064, 0x00000000}, - {0x0000b068, 0x00000000}, - {0x0000b06c, 0x00000000}, - {0x0000b070, 0x00000000}, - {0x0000b074, 0x00000000}, - {0x0000b078, 0x00000000}, - {0x0000b07c, 0x00000000}, - {0x0000b080, 0x2a2d2f32}, - {0x0000b084, 0x21232328}, - {0x0000b088, 0x19191c1e}, - {0x0000b08c, 0x12141417}, - {0x0000b090, 0x07070e0e}, - {0x0000b094, 0x03030305}, - {0x0000b098, 0x00000003}, - {0x0000b09c, 0x00000000}, - {0x0000b0a0, 0x00000000}, - {0x0000b0a4, 0x00000000}, - {0x0000b0a8, 0x00000000}, - {0x0000b0ac, 0x00000000}, - {0x0000b0b0, 0x00000000}, - {0x0000b0b4, 0x00000000}, - {0x0000b0b8, 0x00000000}, - {0x0000b0bc, 0x00000000}, - {0x0000b0c0, 0x003f0020}, - {0x0000b0c4, 0x00400041}, - {0x0000b0c8, 0x0140005f}, - {0x0000b0cc, 0x0160015f}, - {0x0000b0d0, 0x017e017f}, - {0x0000b0d4, 0x02410242}, - {0x0000b0d8, 0x025f0240}, - {0x0000b0dc, 0x027f0260}, - {0x0000b0e0, 0x0341027e}, - {0x0000b0e4, 0x035f0340}, - {0x0000b0e8, 0x037f0360}, - {0x0000b0ec, 0x04400441}, - {0x0000b0f0, 0x0460045f}, - {0x0000b0f4, 0x0541047f}, - {0x0000b0f8, 0x055f0540}, - {0x0000b0fc, 0x057f0560}, - {0x0000b100, 0x06400641}, - {0x0000b104, 0x0660065f}, - {0x0000b108, 0x067e067f}, - {0x0000b10c, 0x07410742}, - {0x0000b110, 0x075f0740}, - {0x0000b114, 0x077f0760}, - {0x0000b118, 0x07800781}, - {0x0000b11c, 0x07a0079f}, - {0x0000b120, 0x07c107bf}, - {0x0000b124, 0x000007c0}, - {0x0000b128, 0x00000000}, - {0x0000b12c, 0x00000000}, - {0x0000b130, 0x00000000}, - {0x0000b134, 0x00000000}, - {0x0000b138, 0x00000000}, - {0x0000b13c, 0x00000000}, - {0x0000b140, 0x003f0020}, - {0x0000b144, 0x00400041}, - {0x0000b148, 0x0140005f}, - {0x0000b14c, 0x0160015f}, - {0x0000b150, 0x017e017f}, - {0x0000b154, 0x02410242}, - {0x0000b158, 0x025f0240}, - {0x0000b15c, 0x027f0260}, - {0x0000b160, 0x0341027e}, - {0x0000b164, 0x035f0340}, - {0x0000b168, 0x037f0360}, - {0x0000b16c, 0x04400441}, - {0x0000b170, 0x0460045f}, - {0x0000b174, 0x0541047f}, - {0x0000b178, 0x055f0540}, - {0x0000b17c, 0x057f0560}, - {0x0000b180, 0x06400641}, - {0x0000b184, 0x0660065f}, - {0x0000b188, 0x067e067f}, - {0x0000b18c, 0x07410742}, - {0x0000b190, 0x075f0740}, - {0x0000b194, 0x077f0760}, - {0x0000b198, 0x07800781}, - {0x0000b19c, 0x07a0079f}, - {0x0000b1a0, 0x07c107bf}, - {0x0000b1a4, 0x000007c0}, - {0x0000b1a8, 0x00000000}, - {0x0000b1ac, 0x00000000}, - {0x0000b1b0, 0x00000000}, - {0x0000b1b4, 0x00000000}, - {0x0000b1b8, 0x00000000}, - {0x0000b1bc, 0x00000000}, - {0x0000b1c0, 0x00000000}, - {0x0000b1c4, 0x00000000}, - {0x0000b1c8, 0x00000000}, - {0x0000b1cc, 0x00000000}, - {0x0000b1d0, 0x00000000}, - {0x0000b1d4, 0x00000000}, - {0x0000b1d8, 0x00000000}, - {0x0000b1dc, 0x00000000}, - {0x0000b1e0, 0x00000000}, - {0x0000b1e4, 0x00000000}, - {0x0000b1e8, 0x00000000}, - {0x0000b1ec, 0x00000000}, - {0x0000b1f0, 0x00000396}, - {0x0000b1f4, 0x00000396}, - {0x0000b1f8, 0x00000396}, - {0x0000b1fc, 0x00000196}, -}; - -static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, - {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402}, - {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, - {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, - {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, - {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, - {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, - {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, - {0x0000a544, 0x52022470, 0x52022470, 0x3f001861, 0x3f001861}, - {0x0000a548, 0x55022490, 0x55022490, 0x43001a81, 0x43001a81}, - {0x0000a54c, 0x59022492, 0x59022492, 0x47001a83, 0x47001a83}, - {0x0000a550, 0x5d022692, 0x5d022692, 0x4a001c84, 0x4a001c84}, - {0x0000a554, 0x61022892, 0x61022892, 0x4e001ce3, 0x4e001ce3}, - {0x0000a558, 0x65024890, 0x65024890, 0x52001ce5, 0x52001ce5}, - {0x0000a55c, 0x69024892, 0x69024892, 0x56001ce9, 0x56001ce9}, - {0x0000a560, 0x6e024c92, 0x6e024c92, 0x5a001ceb, 0x5a001ceb}, - {0x0000a564, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, - {0x0000a568, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, - {0x0000a56c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, - {0x0000a570, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, - {0x0000a574, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, - {0x0000a578, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, - {0x0000a57c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, - {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, - {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, - {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, - {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, - {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, - {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400}, - {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402}, - {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404}, - {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603}, - {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02}, - {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04}, - {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20}, - {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20}, - {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22}, - {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24}, - {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640}, - {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660}, - {0x0000a5c4, 0x52822470, 0x52822470, 0x3f801861, 0x3f801861}, - {0x0000a5c8, 0x55822490, 0x55822490, 0x43801a81, 0x43801a81}, - {0x0000a5cc, 0x59822492, 0x59822492, 0x47801a83, 0x47801a83}, - {0x0000a5d0, 0x5d822692, 0x5d822692, 0x4a801c84, 0x4a801c84}, - {0x0000a5d4, 0x61822892, 0x61822892, 0x4e801ce3, 0x4e801ce3}, - {0x0000a5d8, 0x65824890, 0x65824890, 0x52801ce5, 0x52801ce5}, - {0x0000a5dc, 0x69824892, 0x69824892, 0x56801ce9, 0x56801ce9}, - {0x0000a5e0, 0x6e824c92, 0x6e824c92, 0x5a801ceb, 0x5a801ceb}, - {0x0000a5e4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, - {0x0000a5e8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, - {0x0000a5ec, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, - {0x0000a5f0, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, - {0x0000a5f4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, - {0x0000a5f8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, - {0x0000a5fc, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x02004000, 0x02004000, 0x01404000, 0x01404000}, - {0x0000a618, 0x02004801, 0x02004801, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02808a02, 0x02808a02, 0x02008501, 0x02008501}, - {0x0000a620, 0x0380ce03, 0x0380ce03, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x04411104, 0x04411104, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x04411104, 0x04411104, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000a630, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000a634, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000a638, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000a63c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000c2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, - {0x0000c2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, - {0x0000c2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, - {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, - {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016448, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, - {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016848, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, - {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, -}; - -static const u32 ar9300_2p2_mac_core[][2] = { - /* Addr allmodes */ - {0x00000008, 0x00000000}, - {0x00000030, 0x00020085}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000000}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x000010f0, 0x00000100}, - {0x00001270, 0x00000000}, - {0x000012b0, 0x00000000}, - {0x000012f0, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00008000, 0x00000000}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008018, 0x00000000}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00000000}, - {0x00008040, 0x00000000}, - {0x00008044, 0x00000000}, - {0x00008048, 0x00000000}, - {0x0000804c, 0xffffffff}, - {0x00008054, 0x00000000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x00008070, 0x00000310}, - {0x00008074, 0x00000020}, - {0x00008078, 0x00000000}, - {0x0000809c, 0x0000000f}, - {0x000080a0, 0x00000000}, - {0x000080a4, 0x02ff0000}, - {0x000080a8, 0x0e070605}, - {0x000080ac, 0x0000000d}, - {0x000080b0, 0x00000000}, - {0x000080b4, 0x00000000}, - {0x000080b8, 0x00000000}, - {0x000080bc, 0x00000000}, - {0x000080c0, 0x2a800000}, - {0x000080c4, 0x06900168}, - {0x000080c8, 0x13881c20}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00252500}, - {0x000080d4, 0x00a00000}, - {0x000080d8, 0x00400000}, - {0x000080dc, 0x00000000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x3f3f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00000000}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000000}, - {0x00008114, 0x000007ff}, - {0x00008118, 0x000000aa}, - {0x0000811c, 0x00003210}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x0000ffff}, - {0x00008144, 0xffffffff}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x000081c0, 0x00000000}, - {0x000081c4, 0x33332210}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008244, 0x0010f424}, - {0x00008248, 0x00000800}, - {0x0000824c, 0x0001e848}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x40000000}, - {0x00008260, 0x00080922}, - {0x00008264, 0x9d400010}, - {0x00008268, 0xffffffff}, - {0x0000826c, 0x0000ffff}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000004}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x000000ff}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x0000829c, 0x00000000}, - {0x00008300, 0x00000140}, - {0x00008314, 0x00000000}, - {0x0000831c, 0x0000010d}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x00000007}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000700}, - {0x00008338, 0x00ff0000}, - {0x0000833c, 0x02400000}, - {0x00008340, 0x000107ff}, - {0x00008344, 0xaa48105b}, - {0x00008348, 0x008f0000}, - {0x0000835c, 0x00000000}, - {0x00008360, 0xffffffff}, - {0x00008364, 0xffffffff}, - {0x00008368, 0x00000000}, - {0x00008370, 0x00000000}, - {0x00008374, 0x000000ff}, - {0x00008378, 0x00000000}, - {0x0000837c, 0x00000000}, - {0x00008380, 0xffffffff}, - {0x00008384, 0xffffffff}, - {0x00008390, 0xffffffff}, - {0x00008394, 0xffffffff}, - {0x00008398, 0x00000000}, - {0x0000839c, 0x00000000}, - {0x000083a0, 0x00000000}, - {0x000083a4, 0x0000fa14}, - {0x000083a8, 0x000f0c00}, - {0x000083ac, 0x33332210}, - {0x000083b0, 0x33332210}, - {0x000083b4, 0x33332210}, - {0x000083b8, 0x33332210}, - {0x000083bc, 0x00000000}, - {0x000083c0, 0x00000000}, - {0x000083c4, 0x00000000}, - {0x000083c8, 0x00000000}, - {0x000083cc, 0x00000200}, - {0x000083d0, 0x000301ff}, -}; - -static const u32 ar9300Common_wo_xlna_rx_gain_table_2p2[][2] = { - /* Addr allmodes */ - {0x0000a000, 0x00010000}, - {0x0000a004, 0x00030002}, - {0x0000a008, 0x00050004}, - {0x0000a00c, 0x00810080}, - {0x0000a010, 0x00830082}, - {0x0000a014, 0x01810180}, - {0x0000a018, 0x01830182}, - {0x0000a01c, 0x01850184}, - {0x0000a020, 0x01890188}, - {0x0000a024, 0x018b018a}, - {0x0000a028, 0x018d018c}, - {0x0000a02c, 0x03820190}, - {0x0000a030, 0x03840383}, - {0x0000a034, 0x03880385}, - {0x0000a038, 0x038a0389}, - {0x0000a03c, 0x038c038b}, - {0x0000a040, 0x0390038d}, - {0x0000a044, 0x03920391}, - {0x0000a048, 0x03940393}, - {0x0000a04c, 0x03960395}, - {0x0000a050, 0x00000000}, - {0x0000a054, 0x00000000}, - {0x0000a058, 0x00000000}, - {0x0000a05c, 0x00000000}, - {0x0000a060, 0x00000000}, - {0x0000a064, 0x00000000}, - {0x0000a068, 0x00000000}, - {0x0000a06c, 0x00000000}, - {0x0000a070, 0x00000000}, - {0x0000a074, 0x00000000}, - {0x0000a078, 0x00000000}, - {0x0000a07c, 0x00000000}, - {0x0000a080, 0x29292929}, - {0x0000a084, 0x29292929}, - {0x0000a088, 0x29292929}, - {0x0000a08c, 0x29292929}, - {0x0000a090, 0x22292929}, - {0x0000a094, 0x1d1d2222}, - {0x0000a098, 0x0c111117}, - {0x0000a09c, 0x00030303}, - {0x0000a0a0, 0x00000000}, - {0x0000a0a4, 0x00000000}, - {0x0000a0a8, 0x00000000}, - {0x0000a0ac, 0x00000000}, - {0x0000a0b0, 0x00000000}, - {0x0000a0b4, 0x00000000}, - {0x0000a0b8, 0x00000000}, - {0x0000a0bc, 0x00000000}, - {0x0000a0c0, 0x001f0000}, - {0x0000a0c4, 0x01000101}, - {0x0000a0c8, 0x011e011f}, - {0x0000a0cc, 0x011c011d}, - {0x0000a0d0, 0x02030204}, - {0x0000a0d4, 0x02010202}, - {0x0000a0d8, 0x021f0200}, - {0x0000a0dc, 0x0302021e}, - {0x0000a0e0, 0x03000301}, - {0x0000a0e4, 0x031e031f}, - {0x0000a0e8, 0x0402031d}, - {0x0000a0ec, 0x04000401}, - {0x0000a0f0, 0x041e041f}, - {0x0000a0f4, 0x0502041d}, - {0x0000a0f8, 0x05000501}, - {0x0000a0fc, 0x051e051f}, - {0x0000a100, 0x06010602}, - {0x0000a104, 0x061f0600}, - {0x0000a108, 0x061d061e}, - {0x0000a10c, 0x07020703}, - {0x0000a110, 0x07000701}, - {0x0000a114, 0x00000000}, - {0x0000a118, 0x00000000}, - {0x0000a11c, 0x00000000}, - {0x0000a120, 0x00000000}, - {0x0000a124, 0x00000000}, - {0x0000a128, 0x00000000}, - {0x0000a12c, 0x00000000}, - {0x0000a130, 0x00000000}, - {0x0000a134, 0x00000000}, - {0x0000a138, 0x00000000}, - {0x0000a13c, 0x00000000}, - {0x0000a140, 0x001f0000}, - {0x0000a144, 0x01000101}, - {0x0000a148, 0x011e011f}, - {0x0000a14c, 0x011c011d}, - {0x0000a150, 0x02030204}, - {0x0000a154, 0x02010202}, - {0x0000a158, 0x021f0200}, - {0x0000a15c, 0x0302021e}, - {0x0000a160, 0x03000301}, - {0x0000a164, 0x031e031f}, - {0x0000a168, 0x0402031d}, - {0x0000a16c, 0x04000401}, - {0x0000a170, 0x041e041f}, - {0x0000a174, 0x0502041d}, - {0x0000a178, 0x05000501}, - {0x0000a17c, 0x051e051f}, - {0x0000a180, 0x06010602}, - {0x0000a184, 0x061f0600}, - {0x0000a188, 0x061d061e}, - {0x0000a18c, 0x07020703}, - {0x0000a190, 0x07000701}, - {0x0000a194, 0x00000000}, - {0x0000a198, 0x00000000}, - {0x0000a19c, 0x00000000}, - {0x0000a1a0, 0x00000000}, - {0x0000a1a4, 0x00000000}, - {0x0000a1a8, 0x00000000}, - {0x0000a1ac, 0x00000000}, - {0x0000a1b0, 0x00000000}, - {0x0000a1b4, 0x00000000}, - {0x0000a1b8, 0x00000000}, - {0x0000a1bc, 0x00000000}, - {0x0000a1c0, 0x00000000}, - {0x0000a1c4, 0x00000000}, - {0x0000a1c8, 0x00000000}, - {0x0000a1cc, 0x00000000}, - {0x0000a1d0, 0x00000000}, - {0x0000a1d4, 0x00000000}, - {0x0000a1d8, 0x00000000}, - {0x0000a1dc, 0x00000000}, - {0x0000a1e0, 0x00000000}, - {0x0000a1e4, 0x00000000}, - {0x0000a1e8, 0x00000000}, - {0x0000a1ec, 0x00000000}, - {0x0000a1f0, 0x00000396}, - {0x0000a1f4, 0x00000396}, - {0x0000a1f8, 0x00000396}, - {0x0000a1fc, 0x00000196}, - {0x0000b000, 0x00010000}, - {0x0000b004, 0x00030002}, - {0x0000b008, 0x00050004}, - {0x0000b00c, 0x00810080}, - {0x0000b010, 0x00830082}, - {0x0000b014, 0x01810180}, - {0x0000b018, 0x01830182}, - {0x0000b01c, 0x01850184}, - {0x0000b020, 0x02810280}, - {0x0000b024, 0x02830282}, - {0x0000b028, 0x02850284}, - {0x0000b02c, 0x02890288}, - {0x0000b030, 0x028b028a}, - {0x0000b034, 0x0388028c}, - {0x0000b038, 0x038a0389}, - {0x0000b03c, 0x038c038b}, - {0x0000b040, 0x0390038d}, - {0x0000b044, 0x03920391}, - {0x0000b048, 0x03940393}, - {0x0000b04c, 0x03960395}, - {0x0000b050, 0x00000000}, - {0x0000b054, 0x00000000}, - {0x0000b058, 0x00000000}, - {0x0000b05c, 0x00000000}, - {0x0000b060, 0x00000000}, - {0x0000b064, 0x00000000}, - {0x0000b068, 0x00000000}, - {0x0000b06c, 0x00000000}, - {0x0000b070, 0x00000000}, - {0x0000b074, 0x00000000}, - {0x0000b078, 0x00000000}, - {0x0000b07c, 0x00000000}, - {0x0000b080, 0x32323232}, - {0x0000b084, 0x2f2f3232}, - {0x0000b088, 0x23282a2d}, - {0x0000b08c, 0x1c1e2123}, - {0x0000b090, 0x14171919}, - {0x0000b094, 0x0e0e1214}, - {0x0000b098, 0x03050707}, - {0x0000b09c, 0x00030303}, - {0x0000b0a0, 0x00000000}, - {0x0000b0a4, 0x00000000}, - {0x0000b0a8, 0x00000000}, - {0x0000b0ac, 0x00000000}, - {0x0000b0b0, 0x00000000}, - {0x0000b0b4, 0x00000000}, - {0x0000b0b8, 0x00000000}, - {0x0000b0bc, 0x00000000}, - {0x0000b0c0, 0x003f0020}, - {0x0000b0c4, 0x00400041}, - {0x0000b0c8, 0x0140005f}, - {0x0000b0cc, 0x0160015f}, - {0x0000b0d0, 0x017e017f}, - {0x0000b0d4, 0x02410242}, - {0x0000b0d8, 0x025f0240}, - {0x0000b0dc, 0x027f0260}, - {0x0000b0e0, 0x0341027e}, - {0x0000b0e4, 0x035f0340}, - {0x0000b0e8, 0x037f0360}, - {0x0000b0ec, 0x04400441}, - {0x0000b0f0, 0x0460045f}, - {0x0000b0f4, 0x0541047f}, - {0x0000b0f8, 0x055f0540}, - {0x0000b0fc, 0x057f0560}, - {0x0000b100, 0x06400641}, - {0x0000b104, 0x0660065f}, - {0x0000b108, 0x067e067f}, - {0x0000b10c, 0x07410742}, - {0x0000b110, 0x075f0740}, - {0x0000b114, 0x077f0760}, - {0x0000b118, 0x07800781}, - {0x0000b11c, 0x07a0079f}, - {0x0000b120, 0x07c107bf}, - {0x0000b124, 0x000007c0}, - {0x0000b128, 0x00000000}, - {0x0000b12c, 0x00000000}, - {0x0000b130, 0x00000000}, - {0x0000b134, 0x00000000}, - {0x0000b138, 0x00000000}, - {0x0000b13c, 0x00000000}, - {0x0000b140, 0x003f0020}, - {0x0000b144, 0x00400041}, - {0x0000b148, 0x0140005f}, - {0x0000b14c, 0x0160015f}, - {0x0000b150, 0x017e017f}, - {0x0000b154, 0x02410242}, - {0x0000b158, 0x025f0240}, - {0x0000b15c, 0x027f0260}, - {0x0000b160, 0x0341027e}, - {0x0000b164, 0x035f0340}, - {0x0000b168, 0x037f0360}, - {0x0000b16c, 0x04400441}, - {0x0000b170, 0x0460045f}, - {0x0000b174, 0x0541047f}, - {0x0000b178, 0x055f0540}, - {0x0000b17c, 0x057f0560}, - {0x0000b180, 0x06400641}, - {0x0000b184, 0x0660065f}, - {0x0000b188, 0x067e067f}, - {0x0000b18c, 0x07410742}, - {0x0000b190, 0x075f0740}, - {0x0000b194, 0x077f0760}, - {0x0000b198, 0x07800781}, - {0x0000b19c, 0x07a0079f}, - {0x0000b1a0, 0x07c107bf}, - {0x0000b1a4, 0x000007c0}, - {0x0000b1a8, 0x00000000}, - {0x0000b1ac, 0x00000000}, - {0x0000b1b0, 0x00000000}, - {0x0000b1b4, 0x00000000}, - {0x0000b1b8, 0x00000000}, - {0x0000b1bc, 0x00000000}, - {0x0000b1c0, 0x00000000}, - {0x0000b1c4, 0x00000000}, - {0x0000b1c8, 0x00000000}, - {0x0000b1cc, 0x00000000}, - {0x0000b1d0, 0x00000000}, - {0x0000b1d4, 0x00000000}, - {0x0000b1d8, 0x00000000}, - {0x0000b1dc, 0x00000000}, - {0x0000b1e0, 0x00000000}, - {0x0000b1e4, 0x00000000}, - {0x0000b1e8, 0x00000000}, - {0x0000b1ec, 0x00000000}, - {0x0000b1f0, 0x00000396}, - {0x0000b1f4, 0x00000396}, - {0x0000b1f8, 0x00000396}, - {0x0000b1fc, 0x00000196}, -}; - -static const u32 ar9300_2p2_soc_preamble[][2] = { - /* Addr allmodes */ - {0x000040a4, 0x00a0c1c9}, - {0x00007008, 0x00000000}, - {0x00007020, 0x00000000}, - {0x00007034, 0x00000002}, - {0x00007038, 0x000004c2}, - {0x00007048, 0x00000008}, -}; - -static const u32 ar9300PciePhy_pll_on_clkreq_disable_L1_2p2[][2] = { - /* Addr allmodes */ - {0x00004040, 0x0821265e}, - {0x00004040, 0x0008003b}, - {0x00004044, 0x00000000}, -}; - -static const u32 ar9300PciePhy_clkreq_enable_L1_2p2[][2] = { - /* Addr allmodes */ - {0x00004040, 0x08253e5e}, - {0x00004040, 0x0008003b}, - {0x00004044, 0x00000000}, -}; - -static const u32 ar9300PciePhy_clkreq_disable_L1_2p2[][2] = { - /* Addr allmodes */ - {0x00004040, 0x08213e5e}, - {0x00004040, 0x0008003b}, - {0x00004044, 0x00000000}, -}; - -#endif /* INITVALS_9003_2P2_H */ diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c deleted file mode 100644 index 6988e1d081f2..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c +++ /dev/null @@ -1,1187 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "hw.h" -#include "hw-ops.h" -#include "ar9003_phy.h" -#include "ar9003_rtt.h" -#include "ar9003_mci.h" - -#define MAX_MEASUREMENT MAX_IQCAL_MEASUREMENT -#define MAX_MAG_DELTA 11 -#define MAX_PHS_DELTA 10 - -struct coeff { - int mag_coeff[AR9300_MAX_CHAINS][MAX_MEASUREMENT]; - int phs_coeff[AR9300_MAX_CHAINS][MAX_MEASUREMENT]; - int iqc_coeff[2]; -}; - -enum ar9003_cal_types { - IQ_MISMATCH_CAL = BIT(0), -}; - -static void ar9003_hw_setup_calibration(struct ath_hw *ah, - struct ath9k_cal_list *currCal) -{ - struct ath_common *common = ath9k_hw_common(ah); - - /* Select calibration to run */ - switch (currCal->calData->calType) { - case IQ_MISMATCH_CAL: - /* - * Start calibration with - * 2^(INIT_IQCAL_LOG_COUNT_MAX+1) samples - */ - REG_RMW_FIELD(ah, AR_PHY_TIMING4, - AR_PHY_TIMING4_IQCAL_LOG_COUNT_MAX, - currCal->calData->calCountMax); - REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_IQ); - - ath_dbg(common, CALIBRATE, - "starting IQ Mismatch Calibration\n"); - - /* Kick-off cal */ - REG_SET_BIT(ah, AR_PHY_TIMING4, AR_PHY_TIMING4_DO_CAL); - break; - default: - ath_err(common, "Invalid calibration type\n"); - break; - } -} - -/* - * Generic calibration routine. - * Recalibrate the lower PHY chips to account for temperature/environment - * changes. - */ -static bool ar9003_hw_per_calibration(struct ath_hw *ah, - struct ath9k_channel *ichan, - u8 rxchainmask, - struct ath9k_cal_list *currCal) -{ - struct ath9k_hw_cal_data *caldata = ah->caldata; - /* Cal is assumed not done until explicitly set below */ - bool iscaldone = false; - - /* Calibration in progress. */ - if (currCal->calState == CAL_RUNNING) { - /* Check to see if it has finished. */ - if (!(REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)) { - /* - * Accumulate cal measures for active chains - */ - currCal->calData->calCollect(ah); - ah->cal_samples++; - - if (ah->cal_samples >= - currCal->calData->calNumSamples) { - unsigned int i, numChains = 0; - for (i = 0; i < AR9300_MAX_CHAINS; i++) { - if (rxchainmask & (1 << i)) - numChains++; - } - - /* - * Process accumulated data - */ - currCal->calData->calPostProc(ah, numChains); - - /* Calibration has finished. */ - caldata->CalValid |= currCal->calData->calType; - currCal->calState = CAL_DONE; - iscaldone = true; - } else { - /* - * Set-up collection of another sub-sample until we - * get desired number - */ - ar9003_hw_setup_calibration(ah, currCal); - } - } - } else if (!(caldata->CalValid & currCal->calData->calType)) { - /* If current cal is marked invalid in channel, kick it off */ - ath9k_hw_reset_calibration(ah, currCal); - } - - return iscaldone; -} - -static bool ar9003_hw_calibrate(struct ath_hw *ah, - struct ath9k_channel *chan, - u8 rxchainmask, - bool longcal) -{ - bool iscaldone = true; - struct ath9k_cal_list *currCal = ah->cal_list_curr; - - /* - * For given calibration: - * 1. Call generic cal routine - * 2. When this cal is done (isCalDone) if we have more cals waiting - * (eg after reset), mask this to upper layers by not propagating - * isCalDone if it is set to TRUE. - * Instead, change isCalDone to FALSE and setup the waiting cal(s) - * to be run. - */ - if (currCal && - (currCal->calState == CAL_RUNNING || - currCal->calState == CAL_WAITING)) { - iscaldone = ar9003_hw_per_calibration(ah, chan, - rxchainmask, currCal); - if (iscaldone) { - ah->cal_list_curr = currCal = currCal->calNext; - - if (currCal->calState == CAL_WAITING) { - iscaldone = false; - ath9k_hw_reset_calibration(ah, currCal); - } - } - } - - /* - * Do NF cal only at longer intervals. Get the value from - * the previous NF cal and update history buffer. - */ - if (longcal && ath9k_hw_getnf(ah, chan)) { - /* - * Load the NF from history buffer of the current channel. - * NF is slow time-variant, so it is OK to use a historical - * value. - */ - ath9k_hw_loadnf(ah, ah->curchan); - - /* start NF calibration, without updating BB NF register */ - ath9k_hw_start_nfcal(ah, false); - } - - return iscaldone; -} - -static void ar9003_hw_iqcal_collect(struct ath_hw *ah) -{ - int i; - - /* Accumulate IQ cal measures for active chains */ - for (i = 0; i < AR5416_MAX_CHAINS; i++) { - if (ah->txchainmask & BIT(i)) { - ah->totalPowerMeasI[i] += - REG_READ(ah, AR_PHY_CAL_MEAS_0(i)); - ah->totalPowerMeasQ[i] += - REG_READ(ah, AR_PHY_CAL_MEAS_1(i)); - ah->totalIqCorrMeas[i] += - (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i)); - ath_dbg(ath9k_hw_common(ah), CALIBRATE, - "%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n", - ah->cal_samples, i, ah->totalPowerMeasI[i], - ah->totalPowerMeasQ[i], - ah->totalIqCorrMeas[i]); - } - } -} - -static void ar9003_hw_iqcalibrate(struct ath_hw *ah, u8 numChains) -{ - struct ath_common *common = ath9k_hw_common(ah); - u32 powerMeasQ, powerMeasI, iqCorrMeas; - u32 qCoffDenom, iCoffDenom; - int32_t qCoff, iCoff; - int iqCorrNeg, i; - static const u_int32_t offset_array[3] = { - AR_PHY_RX_IQCAL_CORR_B0, - AR_PHY_RX_IQCAL_CORR_B1, - AR_PHY_RX_IQCAL_CORR_B2, - }; - - for (i = 0; i < numChains; i++) { - powerMeasI = ah->totalPowerMeasI[i]; - powerMeasQ = ah->totalPowerMeasQ[i]; - iqCorrMeas = ah->totalIqCorrMeas[i]; - - ath_dbg(common, CALIBRATE, - "Starting IQ Cal and Correction for Chain %d\n", i); - - ath_dbg(common, CALIBRATE, - "Original: Chn %d iq_corr_meas = 0x%08x\n", - i, ah->totalIqCorrMeas[i]); - - iqCorrNeg = 0; - - if (iqCorrMeas > 0x80000000) { - iqCorrMeas = (0xffffffff - iqCorrMeas) + 1; - iqCorrNeg = 1; - } - - ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_i = 0x%08x\n", - i, powerMeasI); - ath_dbg(common, CALIBRATE, "Chn %d pwr_meas_q = 0x%08x\n", - i, powerMeasQ); - ath_dbg(common, CALIBRATE, "iqCorrNeg is 0x%08x\n", iqCorrNeg); - - iCoffDenom = (powerMeasI / 2 + powerMeasQ / 2) / 256; - qCoffDenom = powerMeasQ / 64; - - if ((iCoffDenom != 0) && (qCoffDenom != 0)) { - iCoff = iqCorrMeas / iCoffDenom; - qCoff = powerMeasI / qCoffDenom - 64; - ath_dbg(common, CALIBRATE, "Chn %d iCoff = 0x%08x\n", - i, iCoff); - ath_dbg(common, CALIBRATE, "Chn %d qCoff = 0x%08x\n", - i, qCoff); - - /* Force bounds on iCoff */ - if (iCoff >= 63) - iCoff = 63; - else if (iCoff <= -63) - iCoff = -63; - - /* Negate iCoff if iqCorrNeg == 0 */ - if (iqCorrNeg == 0x0) - iCoff = -iCoff; - - /* Force bounds on qCoff */ - if (qCoff >= 63) - qCoff = 63; - else if (qCoff <= -63) - qCoff = -63; - - iCoff = iCoff & 0x7f; - qCoff = qCoff & 0x7f; - - ath_dbg(common, CALIBRATE, - "Chn %d : iCoff = 0x%x qCoff = 0x%x\n", - i, iCoff, qCoff); - ath_dbg(common, CALIBRATE, - "Register offset (0x%04x) before update = 0x%x\n", - offset_array[i], - REG_READ(ah, offset_array[i])); - - if (AR_SREV_9565(ah) && - (iCoff == 63 || qCoff == 63 || - iCoff == -63 || qCoff == -63)) - return; - - REG_RMW_FIELD(ah, offset_array[i], - AR_PHY_RX_IQCAL_CORR_IQCORR_Q_I_COFF, - iCoff); - REG_RMW_FIELD(ah, offset_array[i], - AR_PHY_RX_IQCAL_CORR_IQCORR_Q_Q_COFF, - qCoff); - ath_dbg(common, CALIBRATE, - "Register offset (0x%04x) QI COFF (bitfields 0x%08x) after update = 0x%x\n", - offset_array[i], - AR_PHY_RX_IQCAL_CORR_IQCORR_Q_I_COFF, - REG_READ(ah, offset_array[i])); - ath_dbg(common, CALIBRATE, - "Register offset (0x%04x) QQ COFF (bitfields 0x%08x) after update = 0x%x\n", - offset_array[i], - AR_PHY_RX_IQCAL_CORR_IQCORR_Q_Q_COFF, - REG_READ(ah, offset_array[i])); - - ath_dbg(common, CALIBRATE, - "IQ Cal and Correction done for Chain %d\n", i); - } - } - - REG_SET_BIT(ah, AR_PHY_RX_IQCAL_CORR_B0, - AR_PHY_RX_IQCAL_CORR_IQCORR_ENABLE); - ath_dbg(common, CALIBRATE, - "IQ Cal and Correction (offset 0x%04x) enabled (bit position 0x%08x). New Value 0x%08x\n", - (unsigned) (AR_PHY_RX_IQCAL_CORR_B0), - AR_PHY_RX_IQCAL_CORR_IQCORR_ENABLE, - REG_READ(ah, AR_PHY_RX_IQCAL_CORR_B0)); -} - -static const struct ath9k_percal_data iq_cal_single_sample = { - IQ_MISMATCH_CAL, - MIN_CAL_SAMPLES, - PER_MAX_LOG_COUNT, - ar9003_hw_iqcal_collect, - ar9003_hw_iqcalibrate -}; - -static void ar9003_hw_init_cal_settings(struct ath_hw *ah) -{ - ah->iq_caldata.calData = &iq_cal_single_sample; - - if (AR_SREV_9300_20_OR_LATER(ah)) { - ah->enabled_cals |= TX_IQ_CAL; - if (AR_SREV_9485_OR_LATER(ah) && !AR_SREV_9340(ah)) - ah->enabled_cals |= TX_IQ_ON_AGC_CAL; - } - - ah->supp_cals = IQ_MISMATCH_CAL; -} - -/* - * solve 4x4 linear equation used in loopback iq cal. - */ -static bool ar9003_hw_solve_iq_cal(struct ath_hw *ah, - s32 sin_2phi_1, - s32 cos_2phi_1, - s32 sin_2phi_2, - s32 cos_2phi_2, - s32 mag_a0_d0, - s32 phs_a0_d0, - s32 mag_a1_d0, - s32 phs_a1_d0, - s32 solved_eq[]) -{ - s32 f1 = cos_2phi_1 - cos_2phi_2, - f3 = sin_2phi_1 - sin_2phi_2, - f2; - s32 mag_tx, phs_tx, mag_rx, phs_rx; - const s32 result_shift = 1 << 15; - struct ath_common *common = ath9k_hw_common(ah); - - f2 = (f1 * f1 + f3 * f3) / result_shift; - - if (!f2) { - ath_dbg(common, CALIBRATE, "Divide by 0\n"); - return false; - } - - /* mag mismatch, tx */ - mag_tx = f1 * (mag_a0_d0 - mag_a1_d0) + f3 * (phs_a0_d0 - phs_a1_d0); - /* phs mismatch, tx */ - phs_tx = f3 * (-mag_a0_d0 + mag_a1_d0) + f1 * (phs_a0_d0 - phs_a1_d0); - - mag_tx = (mag_tx / f2); - phs_tx = (phs_tx / f2); - - /* mag mismatch, rx */ - mag_rx = mag_a0_d0 - (cos_2phi_1 * mag_tx + sin_2phi_1 * phs_tx) / - result_shift; - /* phs mismatch, rx */ - phs_rx = phs_a0_d0 + (sin_2phi_1 * mag_tx - cos_2phi_1 * phs_tx) / - result_shift; - - solved_eq[0] = mag_tx; - solved_eq[1] = phs_tx; - solved_eq[2] = mag_rx; - solved_eq[3] = phs_rx; - - return true; -} - -static s32 ar9003_hw_find_mag_approx(struct ath_hw *ah, s32 in_re, s32 in_im) -{ - s32 abs_i = abs(in_re), - abs_q = abs(in_im), - max_abs, min_abs; - - if (abs_i > abs_q) { - max_abs = abs_i; - min_abs = abs_q; - } else { - max_abs = abs_q; - min_abs = abs_i; - } - - return max_abs - (max_abs / 32) + (min_abs / 8) + (min_abs / 4); -} - -#define DELPT 32 - -static bool ar9003_hw_calc_iq_corr(struct ath_hw *ah, - s32 chain_idx, - const s32 iq_res[], - s32 iqc_coeff[]) -{ - s32 i2_m_q2_a0_d0, i2_p_q2_a0_d0, iq_corr_a0_d0, - i2_m_q2_a0_d1, i2_p_q2_a0_d1, iq_corr_a0_d1, - i2_m_q2_a1_d0, i2_p_q2_a1_d0, iq_corr_a1_d0, - i2_m_q2_a1_d1, i2_p_q2_a1_d1, iq_corr_a1_d1; - s32 mag_a0_d0, mag_a1_d0, mag_a0_d1, mag_a1_d1, - phs_a0_d0, phs_a1_d0, phs_a0_d1, phs_a1_d1, - sin_2phi_1, cos_2phi_1, - sin_2phi_2, cos_2phi_2; - s32 mag_tx, phs_tx, mag_rx, phs_rx; - s32 solved_eq[4], mag_corr_tx, phs_corr_tx, mag_corr_rx, phs_corr_rx, - q_q_coff, q_i_coff; - const s32 res_scale = 1 << 15; - const s32 delpt_shift = 1 << 8; - s32 mag1, mag2; - struct ath_common *common = ath9k_hw_common(ah); - - i2_m_q2_a0_d0 = iq_res[0] & 0xfff; - i2_p_q2_a0_d0 = (iq_res[0] >> 12) & 0xfff; - iq_corr_a0_d0 = ((iq_res[0] >> 24) & 0xff) + ((iq_res[1] & 0xf) << 8); - - if (i2_m_q2_a0_d0 > 0x800) - i2_m_q2_a0_d0 = -((0xfff - i2_m_q2_a0_d0) + 1); - - if (i2_p_q2_a0_d0 > 0x800) - i2_p_q2_a0_d0 = -((0xfff - i2_p_q2_a0_d0) + 1); - - if (iq_corr_a0_d0 > 0x800) - iq_corr_a0_d0 = -((0xfff - iq_corr_a0_d0) + 1); - - i2_m_q2_a0_d1 = (iq_res[1] >> 4) & 0xfff; - i2_p_q2_a0_d1 = (iq_res[2] & 0xfff); - iq_corr_a0_d1 = (iq_res[2] >> 12) & 0xfff; - - if (i2_m_q2_a0_d1 > 0x800) - i2_m_q2_a0_d1 = -((0xfff - i2_m_q2_a0_d1) + 1); - - if (i2_p_q2_a0_d1 > 0x800) - i2_p_q2_a0_d1 = -((0xfff - i2_p_q2_a0_d1) + 1); - - if (iq_corr_a0_d1 > 0x800) - iq_corr_a0_d1 = -((0xfff - iq_corr_a0_d1) + 1); - - i2_m_q2_a1_d0 = ((iq_res[2] >> 24) & 0xff) + ((iq_res[3] & 0xf) << 8); - i2_p_q2_a1_d0 = (iq_res[3] >> 4) & 0xfff; - iq_corr_a1_d0 = iq_res[4] & 0xfff; - - if (i2_m_q2_a1_d0 > 0x800) - i2_m_q2_a1_d0 = -((0xfff - i2_m_q2_a1_d0) + 1); - - if (i2_p_q2_a1_d0 > 0x800) - i2_p_q2_a1_d0 = -((0xfff - i2_p_q2_a1_d0) + 1); - - if (iq_corr_a1_d0 > 0x800) - iq_corr_a1_d0 = -((0xfff - iq_corr_a1_d0) + 1); - - i2_m_q2_a1_d1 = (iq_res[4] >> 12) & 0xfff; - i2_p_q2_a1_d1 = ((iq_res[4] >> 24) & 0xff) + ((iq_res[5] & 0xf) << 8); - iq_corr_a1_d1 = (iq_res[5] >> 4) & 0xfff; - - if (i2_m_q2_a1_d1 > 0x800) - i2_m_q2_a1_d1 = -((0xfff - i2_m_q2_a1_d1) + 1); - - if (i2_p_q2_a1_d1 > 0x800) - i2_p_q2_a1_d1 = -((0xfff - i2_p_q2_a1_d1) + 1); - - if (iq_corr_a1_d1 > 0x800) - iq_corr_a1_d1 = -((0xfff - iq_corr_a1_d1) + 1); - - if ((i2_p_q2_a0_d0 == 0) || (i2_p_q2_a0_d1 == 0) || - (i2_p_q2_a1_d0 == 0) || (i2_p_q2_a1_d1 == 0)) { - ath_dbg(common, CALIBRATE, - "Divide by 0:\n" - "a0_d0=%d\n" - "a0_d1=%d\n" - "a2_d0=%d\n" - "a1_d1=%d\n", - i2_p_q2_a0_d0, i2_p_q2_a0_d1, - i2_p_q2_a1_d0, i2_p_q2_a1_d1); - return false; - } - - mag_a0_d0 = (i2_m_q2_a0_d0 * res_scale) / i2_p_q2_a0_d0; - phs_a0_d0 = (iq_corr_a0_d0 * res_scale) / i2_p_q2_a0_d0; - - mag_a0_d1 = (i2_m_q2_a0_d1 * res_scale) / i2_p_q2_a0_d1; - phs_a0_d1 = (iq_corr_a0_d1 * res_scale) / i2_p_q2_a0_d1; - - mag_a1_d0 = (i2_m_q2_a1_d0 * res_scale) / i2_p_q2_a1_d0; - phs_a1_d0 = (iq_corr_a1_d0 * res_scale) / i2_p_q2_a1_d0; - - mag_a1_d1 = (i2_m_q2_a1_d1 * res_scale) / i2_p_q2_a1_d1; - phs_a1_d1 = (iq_corr_a1_d1 * res_scale) / i2_p_q2_a1_d1; - - /* w/o analog phase shift */ - sin_2phi_1 = (((mag_a0_d0 - mag_a0_d1) * delpt_shift) / DELPT); - /* w/o analog phase shift */ - cos_2phi_1 = (((phs_a0_d1 - phs_a0_d0) * delpt_shift) / DELPT); - /* w/ analog phase shift */ - sin_2phi_2 = (((mag_a1_d0 - mag_a1_d1) * delpt_shift) / DELPT); - /* w/ analog phase shift */ - cos_2phi_2 = (((phs_a1_d1 - phs_a1_d0) * delpt_shift) / DELPT); - - /* - * force sin^2 + cos^2 = 1; - * find magnitude by approximation - */ - mag1 = ar9003_hw_find_mag_approx(ah, cos_2phi_1, sin_2phi_1); - mag2 = ar9003_hw_find_mag_approx(ah, cos_2phi_2, sin_2phi_2); - - if ((mag1 == 0) || (mag2 == 0)) { - ath_dbg(common, CALIBRATE, "Divide by 0: mag1=%d, mag2=%d\n", - mag1, mag2); - return false; - } - - /* normalization sin and cos by mag */ - sin_2phi_1 = (sin_2phi_1 * res_scale / mag1); - cos_2phi_1 = (cos_2phi_1 * res_scale / mag1); - sin_2phi_2 = (sin_2phi_2 * res_scale / mag2); - cos_2phi_2 = (cos_2phi_2 * res_scale / mag2); - - /* calculate IQ mismatch */ - if (!ar9003_hw_solve_iq_cal(ah, - sin_2phi_1, cos_2phi_1, - sin_2phi_2, cos_2phi_2, - mag_a0_d0, phs_a0_d0, - mag_a1_d0, - phs_a1_d0, solved_eq)) { - ath_dbg(common, CALIBRATE, - "Call to ar9003_hw_solve_iq_cal() failed\n"); - return false; - } - - mag_tx = solved_eq[0]; - phs_tx = solved_eq[1]; - mag_rx = solved_eq[2]; - phs_rx = solved_eq[3]; - - ath_dbg(common, CALIBRATE, - "chain %d: mag mismatch=%d phase mismatch=%d\n", - chain_idx, mag_tx/res_scale, phs_tx/res_scale); - - if (res_scale == mag_tx) { - ath_dbg(common, CALIBRATE, - "Divide by 0: mag_tx=%d, res_scale=%d\n", - mag_tx, res_scale); - return false; - } - - /* calculate and quantize Tx IQ correction factor */ - mag_corr_tx = (mag_tx * res_scale) / (res_scale - mag_tx); - phs_corr_tx = -phs_tx; - - q_q_coff = (mag_corr_tx * 128 / res_scale); - q_i_coff = (phs_corr_tx * 256 / res_scale); - - ath_dbg(common, CALIBRATE, "tx chain %d: mag corr=%d phase corr=%d\n", - chain_idx, q_q_coff, q_i_coff); - - if (q_i_coff < -63) - q_i_coff = -63; - if (q_i_coff > 63) - q_i_coff = 63; - if (q_q_coff < -63) - q_q_coff = -63; - if (q_q_coff > 63) - q_q_coff = 63; - - iqc_coeff[0] = (q_q_coff * 128) + q_i_coff; - - ath_dbg(common, CALIBRATE, "tx chain %d: iq corr coeff=%x\n", - chain_idx, iqc_coeff[0]); - - if (-mag_rx == res_scale) { - ath_dbg(common, CALIBRATE, - "Divide by 0: mag_rx=%d, res_scale=%d\n", - mag_rx, res_scale); - return false; - } - - /* calculate and quantize Rx IQ correction factors */ - mag_corr_rx = (-mag_rx * res_scale) / (res_scale + mag_rx); - phs_corr_rx = -phs_rx; - - q_q_coff = (mag_corr_rx * 128 / res_scale); - q_i_coff = (phs_corr_rx * 256 / res_scale); - - ath_dbg(common, CALIBRATE, "rx chain %d: mag corr=%d phase corr=%d\n", - chain_idx, q_q_coff, q_i_coff); - - if (q_i_coff < -63) - q_i_coff = -63; - if (q_i_coff > 63) - q_i_coff = 63; - if (q_q_coff < -63) - q_q_coff = -63; - if (q_q_coff > 63) - q_q_coff = 63; - - iqc_coeff[1] = (q_q_coff * 128) + q_i_coff; - - ath_dbg(common, CALIBRATE, "rx chain %d: iq corr coeff=%x\n", - chain_idx, iqc_coeff[1]); - - return true; -} - -static void ar9003_hw_detect_outlier(int *mp_coeff, int nmeasurement, - int max_delta) -{ - int mp_max = -64, max_idx = 0; - int mp_min = 63, min_idx = 0; - int mp_avg = 0, i, outlier_idx = 0, mp_count = 0; - - /* find min/max mismatch across all calibrated gains */ - for (i = 0; i < nmeasurement; i++) { - if (mp_coeff[i] > mp_max) { - mp_max = mp_coeff[i]; - max_idx = i; - } else if (mp_coeff[i] < mp_min) { - mp_min = mp_coeff[i]; - min_idx = i; - } - } - - /* find average (exclude max abs value) */ - for (i = 0; i < nmeasurement; i++) { - if ((abs(mp_coeff[i]) < abs(mp_max)) || - (abs(mp_coeff[i]) < abs(mp_min))) { - mp_avg += mp_coeff[i]; - mp_count++; - } - } - - /* - * finding mean magnitude/phase if possible, otherwise - * just use the last value as the mean - */ - if (mp_count) - mp_avg /= mp_count; - else - mp_avg = mp_coeff[nmeasurement - 1]; - - /* detect outlier */ - if (abs(mp_max - mp_min) > max_delta) { - if (abs(mp_max - mp_avg) > abs(mp_min - mp_avg)) - outlier_idx = max_idx; - else - outlier_idx = min_idx; - - mp_coeff[outlier_idx] = mp_avg; - } -} - -static void ar9003_hw_tx_iqcal_load_avg_2_passes(struct ath_hw *ah, - struct coeff *coeff, - bool is_reusable) -{ - int i, im, nmeasurement; - u32 tx_corr_coeff[MAX_MEASUREMENT][AR9300_MAX_CHAINS]; - struct ath9k_hw_cal_data *caldata = ah->caldata; - - memset(tx_corr_coeff, 0, sizeof(tx_corr_coeff)); - for (i = 0; i < MAX_MEASUREMENT / 2; i++) { - tx_corr_coeff[i * 2][0] = tx_corr_coeff[(i * 2) + 1][0] = - AR_PHY_TX_IQCAL_CORR_COEFF_B0(i); - if (!AR_SREV_9485(ah)) { - tx_corr_coeff[i * 2][1] = - tx_corr_coeff[(i * 2) + 1][1] = - AR_PHY_TX_IQCAL_CORR_COEFF_B1(i); - - tx_corr_coeff[i * 2][2] = - tx_corr_coeff[(i * 2) + 1][2] = - AR_PHY_TX_IQCAL_CORR_COEFF_B2(i); - } - } - - /* Load the average of 2 passes */ - for (i = 0; i < AR9300_MAX_CHAINS; i++) { - if (!(ah->txchainmask & (1 << i))) - continue; - nmeasurement = REG_READ_FIELD(ah, - AR_PHY_TX_IQCAL_STATUS_B0, - AR_PHY_CALIBRATED_GAINS_0); - - if (nmeasurement > MAX_MEASUREMENT) - nmeasurement = MAX_MEASUREMENT; - - /* detect outlier only if nmeasurement > 1 */ - if (nmeasurement > 1) { - /* Detect magnitude outlier */ - ar9003_hw_detect_outlier(coeff->mag_coeff[i], - nmeasurement, MAX_MAG_DELTA); - - /* Detect phase outlier */ - ar9003_hw_detect_outlier(coeff->phs_coeff[i], - nmeasurement, MAX_PHS_DELTA); - } - - for (im = 0; im < nmeasurement; im++) { - - coeff->iqc_coeff[0] = (coeff->mag_coeff[i][im] & 0x7f) | - ((coeff->phs_coeff[i][im] & 0x7f) << 7); - - if ((im % 2) == 0) - REG_RMW_FIELD(ah, tx_corr_coeff[im][i], - AR_PHY_TX_IQCAL_CORR_COEFF_00_COEFF_TABLE, - coeff->iqc_coeff[0]); - else - REG_RMW_FIELD(ah, tx_corr_coeff[im][i], - AR_PHY_TX_IQCAL_CORR_COEFF_01_COEFF_TABLE, - coeff->iqc_coeff[0]); - - if (caldata) - caldata->tx_corr_coeff[im][i] = - coeff->iqc_coeff[0]; - } - if (caldata) - caldata->num_measures[i] = nmeasurement; - } - - REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_3, - AR_PHY_TX_IQCAL_CONTROL_3_IQCORR_EN, 0x1); - REG_RMW_FIELD(ah, AR_PHY_RX_IQCAL_CORR_B0, - AR_PHY_RX_IQCAL_CORR_B0_LOOPBACK_IQCORR_EN, 0x1); - - if (caldata) - caldata->done_txiqcal_once = is_reusable; - - return; -} - -static bool ar9003_hw_tx_iq_cal_run(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - u8 tx_gain_forced; - - tx_gain_forced = REG_READ_FIELD(ah, AR_PHY_TX_FORCED_GAIN, - AR_PHY_TXGAIN_FORCE); - if (tx_gain_forced) - REG_RMW_FIELD(ah, AR_PHY_TX_FORCED_GAIN, - AR_PHY_TXGAIN_FORCE, 0); - - REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_START, - AR_PHY_TX_IQCAL_START_DO_CAL, 1); - - if (!ath9k_hw_wait(ah, AR_PHY_TX_IQCAL_START, - AR_PHY_TX_IQCAL_START_DO_CAL, 0, - AH_WAIT_TIMEOUT)) { - ath_dbg(common, CALIBRATE, "Tx IQ Cal is not completed\n"); - return false; - } - return true; -} - -static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah, bool is_reusable) -{ - struct ath_common *common = ath9k_hw_common(ah); - const u32 txiqcal_status[AR9300_MAX_CHAINS] = { - AR_PHY_TX_IQCAL_STATUS_B0, - AR_PHY_TX_IQCAL_STATUS_B1, - AR_PHY_TX_IQCAL_STATUS_B2, - }; - const u_int32_t chan_info_tab[] = { - AR_PHY_CHAN_INFO_TAB_0, - AR_PHY_CHAN_INFO_TAB_1, - AR_PHY_CHAN_INFO_TAB_2, - }; - struct coeff coeff; - s32 iq_res[6]; - int i, im, j; - int nmeasurement; - - for (i = 0; i < AR9300_MAX_CHAINS; i++) { - if (!(ah->txchainmask & (1 << i))) - continue; - - nmeasurement = REG_READ_FIELD(ah, - AR_PHY_TX_IQCAL_STATUS_B0, - AR_PHY_CALIBRATED_GAINS_0); - if (nmeasurement > MAX_MEASUREMENT) - nmeasurement = MAX_MEASUREMENT; - - for (im = 0; im < nmeasurement; im++) { - ath_dbg(common, CALIBRATE, - "Doing Tx IQ Cal for chain %d\n", i); - - if (REG_READ(ah, txiqcal_status[i]) & - AR_PHY_TX_IQCAL_STATUS_FAILED) { - ath_dbg(common, CALIBRATE, - "Tx IQ Cal failed for chain %d\n", i); - goto tx_iqcal_fail; - } - - for (j = 0; j < 3; j++) { - u32 idx = 2 * j, offset = 4 * (3 * im + j); - - REG_RMW_FIELD(ah, - AR_PHY_CHAN_INFO_MEMORY, - AR_PHY_CHAN_INFO_TAB_S2_READ, - 0); - - /* 32 bits */ - iq_res[idx] = REG_READ(ah, - chan_info_tab[i] + - offset); - - REG_RMW_FIELD(ah, - AR_PHY_CHAN_INFO_MEMORY, - AR_PHY_CHAN_INFO_TAB_S2_READ, - 1); - - /* 16 bits */ - iq_res[idx + 1] = 0xffff & REG_READ(ah, - chan_info_tab[i] + offset); - - ath_dbg(common, CALIBRATE, - "IQ_RES[%d]=0x%x IQ_RES[%d]=0x%x\n", - idx, iq_res[idx], idx + 1, - iq_res[idx + 1]); - } - - if (!ar9003_hw_calc_iq_corr(ah, i, iq_res, - coeff.iqc_coeff)) { - ath_dbg(common, CALIBRATE, - "Failed in calculation of IQ correction\n"); - goto tx_iqcal_fail; - } - - coeff.mag_coeff[i][im] = coeff.iqc_coeff[0] & 0x7f; - coeff.phs_coeff[i][im] = - (coeff.iqc_coeff[0] >> 7) & 0x7f; - - if (coeff.mag_coeff[i][im] > 63) - coeff.mag_coeff[i][im] -= 128; - if (coeff.phs_coeff[i][im] > 63) - coeff.phs_coeff[i][im] -= 128; - } - } - ar9003_hw_tx_iqcal_load_avg_2_passes(ah, &coeff, is_reusable); - - return; - -tx_iqcal_fail: - ath_dbg(common, CALIBRATE, "Tx IQ Cal failed\n"); - return; -} - -static void ar9003_hw_tx_iq_cal_reload(struct ath_hw *ah) -{ - struct ath9k_hw_cal_data *caldata = ah->caldata; - u32 tx_corr_coeff[MAX_MEASUREMENT][AR9300_MAX_CHAINS]; - int i, im; - - memset(tx_corr_coeff, 0, sizeof(tx_corr_coeff)); - for (i = 0; i < MAX_MEASUREMENT / 2; i++) { - tx_corr_coeff[i * 2][0] = tx_corr_coeff[(i * 2) + 1][0] = - AR_PHY_TX_IQCAL_CORR_COEFF_B0(i); - if (!AR_SREV_9485(ah)) { - tx_corr_coeff[i * 2][1] = - tx_corr_coeff[(i * 2) + 1][1] = - AR_PHY_TX_IQCAL_CORR_COEFF_B1(i); - - tx_corr_coeff[i * 2][2] = - tx_corr_coeff[(i * 2) + 1][2] = - AR_PHY_TX_IQCAL_CORR_COEFF_B2(i); - } - } - - for (i = 0; i < AR9300_MAX_CHAINS; i++) { - if (!(ah->txchainmask & (1 << i))) - continue; - - for (im = 0; im < caldata->num_measures[i]; im++) { - if ((im % 2) == 0) - REG_RMW_FIELD(ah, tx_corr_coeff[im][i], - AR_PHY_TX_IQCAL_CORR_COEFF_00_COEFF_TABLE, - caldata->tx_corr_coeff[im][i]); - else - REG_RMW_FIELD(ah, tx_corr_coeff[im][i], - AR_PHY_TX_IQCAL_CORR_COEFF_01_COEFF_TABLE, - caldata->tx_corr_coeff[im][i]); - } - } - - REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_3, - AR_PHY_TX_IQCAL_CONTROL_3_IQCORR_EN, 0x1); - REG_RMW_FIELD(ah, AR_PHY_RX_IQCAL_CORR_B0, - AR_PHY_RX_IQCAL_CORR_B0_LOOPBACK_IQCORR_EN, 0x1); -} - -static void ar9003_hw_manual_peak_cal(struct ath_hw *ah, u8 chain, bool is_2g) -{ - int offset[8], total = 0, test; - int agc_out, i; - - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_GAINSTAGES(chain), - AR_PHY_65NM_RXRF_GAINSTAGES_RX_OVERRIDE, 0x1); - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_GAINSTAGES(chain), - AR_PHY_65NM_RXRF_GAINSTAGES_LNAON_CALDC, 0x0); - if (is_2g) - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_GAINSTAGES(chain), - AR_PHY_65NM_RXRF_GAINSTAGES_LNA2G_GAIN_OVR, 0x0); - else - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_GAINSTAGES(chain), - AR_PHY_65NM_RXRF_GAINSTAGES_LNA5G_GAIN_OVR, 0x0); - - REG_RMW_FIELD(ah, AR_PHY_65NM_RXTX2(chain), - AR_PHY_65NM_RXTX2_RXON_OVR, 0x1); - REG_RMW_FIELD(ah, AR_PHY_65NM_RXTX2(chain), - AR_PHY_65NM_RXTX2_RXON, 0x0); - - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), - AR_PHY_65NM_RXRF_AGC_AGC_OVERRIDE, 0x1); - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), - AR_PHY_65NM_RXRF_AGC_AGC_ON_OVR, 0x1); - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), - AR_PHY_65NM_RXRF_AGC_AGC_CAL_OVR, 0x1); - if (is_2g) - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), - AR_PHY_65NM_RXRF_AGC_AGC2G_DBDAC_OVR, 0x0); - else - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), - AR_PHY_65NM_RXRF_AGC_AGC5G_DBDAC_OVR, 0x0); - - for (i = 6; i > 0; i--) { - offset[i] = BIT(i - 1); - test = total + offset[i]; - - if (is_2g) - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), - AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR, - test); - else - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), - AR_PHY_65NM_RXRF_AGC_AGC5G_CALDAC_OVR, - test); - udelay(100); - agc_out = REG_READ_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), - AR_PHY_65NM_RXRF_AGC_AGC_OUT); - offset[i] = (agc_out) ? 0 : 1; - total += (offset[i] << (i - 1)); - } - - if (is_2g) - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), - AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR, total); - else - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), - AR_PHY_65NM_RXRF_AGC_AGC5G_CALDAC_OVR, total); - - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_GAINSTAGES(chain), - AR_PHY_65NM_RXRF_GAINSTAGES_RX_OVERRIDE, 0); - REG_RMW_FIELD(ah, AR_PHY_65NM_RXTX2(chain), - AR_PHY_65NM_RXTX2_RXON_OVR, 0); - REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain), - AR_PHY_65NM_RXRF_AGC_AGC_CAL_OVR, 0); -} - -static void ar9003_hw_do_manual_peak_cal(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - int i; - - if (!AR_SREV_9462(ah) && !AR_SREV_9565(ah) && !AR_SREV_9485(ah)) - return; - - for (i = 0; i < AR9300_MAX_CHAINS; i++) { - if (!(ah->rxchainmask & (1 << i))) - continue; - ar9003_hw_manual_peak_cal(ah, i, IS_CHAN_2GHZ(chan)); - } -} - -static void ar9003_hw_cl_cal_post_proc(struct ath_hw *ah, bool is_reusable) -{ - u32 cl_idx[AR9300_MAX_CHAINS] = { AR_PHY_CL_TAB_0, - AR_PHY_CL_TAB_1, - AR_PHY_CL_TAB_2 }; - struct ath9k_hw_cal_data *caldata = ah->caldata; - bool txclcal_done = false; - int i, j; - - if (!caldata || !(ah->enabled_cals & TX_CL_CAL)) - return; - - txclcal_done = !!(REG_READ(ah, AR_PHY_AGC_CONTROL) & - AR_PHY_AGC_CONTROL_CLC_SUCCESS); - - if (caldata->done_txclcal_once) { - for (i = 0; i < AR9300_MAX_CHAINS; i++) { - if (!(ah->txchainmask & (1 << i))) - continue; - for (j = 0; j < MAX_CL_TAB_ENTRY; j++) - REG_WRITE(ah, CL_TAB_ENTRY(cl_idx[i]), - caldata->tx_clcal[i][j]); - } - } else if (is_reusable && txclcal_done) { - for (i = 0; i < AR9300_MAX_CHAINS; i++) { - if (!(ah->txchainmask & (1 << i))) - continue; - for (j = 0; j < MAX_CL_TAB_ENTRY; j++) - caldata->tx_clcal[i][j] = - REG_READ(ah, CL_TAB_ENTRY(cl_idx[i])); - } - caldata->done_txclcal_once = true; - } -} - -static bool ar9003_hw_init_cal(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_cal_data *caldata = ah->caldata; - bool txiqcal_done = false; - bool is_reusable = true, status = true; - bool run_rtt_cal = false, run_agc_cal, sep_iq_cal = false; - bool rtt = !!(ah->caps.hw_caps & ATH9K_HW_CAP_RTT); - u32 agc_ctrl = 0, agc_supp_cals = AR_PHY_AGC_CONTROL_OFFSET_CAL | - AR_PHY_AGC_CONTROL_FLTR_CAL | - AR_PHY_AGC_CONTROL_PKDET_CAL; - - /* Use chip chainmask only for calibration */ - ar9003_hw_set_chain_masks(ah, ah->caps.rx_chainmask, ah->caps.tx_chainmask); - - if (rtt) { - if (!ar9003_hw_rtt_restore(ah, chan)) - run_rtt_cal = true; - - if (run_rtt_cal) - ath_dbg(common, CALIBRATE, "RTT calibration to be done\n"); - } - - run_agc_cal = run_rtt_cal; - - if (run_rtt_cal) { - ar9003_hw_rtt_enable(ah); - ar9003_hw_rtt_set_mask(ah, 0x00); - ar9003_hw_rtt_clear_hist(ah); - } - - if (rtt && !run_rtt_cal) { - agc_ctrl = REG_READ(ah, AR_PHY_AGC_CONTROL); - agc_supp_cals &= agc_ctrl; - agc_ctrl &= ~(AR_PHY_AGC_CONTROL_OFFSET_CAL | - AR_PHY_AGC_CONTROL_FLTR_CAL | - AR_PHY_AGC_CONTROL_PKDET_CAL); - REG_WRITE(ah, AR_PHY_AGC_CONTROL, agc_ctrl); - } - - if (ah->enabled_cals & TX_CL_CAL) { - if (caldata && caldata->done_txclcal_once) - REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL, - AR_PHY_CL_CAL_ENABLE); - else { - REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, - AR_PHY_CL_CAL_ENABLE); - run_agc_cal = true; - } - } - - if ((IS_CHAN_HALF_RATE(chan) || IS_CHAN_QUARTER_RATE(chan)) || - !(ah->enabled_cals & TX_IQ_CAL)) - goto skip_tx_iqcal; - - /* Do Tx IQ Calibration */ - REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_1, - AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT, - DELPT); - - /* - * For AR9485 or later chips, TxIQ cal runs as part of - * AGC calibration - */ - if (ah->enabled_cals & TX_IQ_ON_AGC_CAL) { - if (caldata && !caldata->done_txiqcal_once) - REG_SET_BIT(ah, AR_PHY_TX_IQCAL_CONTROL_0, - AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL); - else - REG_CLR_BIT(ah, AR_PHY_TX_IQCAL_CONTROL_0, - AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL); - txiqcal_done = run_agc_cal = true; - } else if (caldata && !caldata->done_txiqcal_once) { - run_agc_cal = true; - sep_iq_cal = true; - } - -skip_tx_iqcal: - if (ath9k_hw_mci_is_enabled(ah) && IS_CHAN_2GHZ(chan) && run_agc_cal) - ar9003_mci_init_cal_req(ah, &is_reusable); - - if (sep_iq_cal) { - txiqcal_done = ar9003_hw_tx_iq_cal_run(ah); - REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS); - udelay(5); - REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); - } - - if (run_agc_cal || !(ah->ah_flags & AH_FASTCC)) { - /* Calibrate the AGC */ - REG_WRITE(ah, AR_PHY_AGC_CONTROL, - REG_READ(ah, AR_PHY_AGC_CONTROL) | - AR_PHY_AGC_CONTROL_CAL); - - /* Poll for offset calibration complete */ - status = ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, - AR_PHY_AGC_CONTROL_CAL, - 0, AH_WAIT_TIMEOUT); - - ar9003_hw_do_manual_peak_cal(ah, chan); - } - - if (ath9k_hw_mci_is_enabled(ah) && IS_CHAN_2GHZ(chan) && run_agc_cal) - ar9003_mci_init_cal_done(ah); - - if (rtt && !run_rtt_cal) { - agc_ctrl |= agc_supp_cals; - REG_WRITE(ah, AR_PHY_AGC_CONTROL, agc_ctrl); - } - - if (!status) { - if (run_rtt_cal) - ar9003_hw_rtt_disable(ah); - - ath_dbg(common, CALIBRATE, - "offset calibration failed to complete in %d ms; noisy environment?\n", - AH_WAIT_TIMEOUT / 1000); - return false; - } - - if (txiqcal_done) - ar9003_hw_tx_iq_cal_post_proc(ah, is_reusable); - else if (caldata && caldata->done_txiqcal_once) - ar9003_hw_tx_iq_cal_reload(ah); - - ar9003_hw_cl_cal_post_proc(ah, is_reusable); - - if (run_rtt_cal && caldata) { - if (is_reusable) { - if (!ath9k_hw_rfbus_req(ah)) - ath_err(ath9k_hw_common(ah), - "Could not stop baseband\n"); - else - ar9003_hw_rtt_fill_hist(ah); - - ath9k_hw_rfbus_done(ah); - } - - ar9003_hw_rtt_disable(ah); - } - - /* Revert chainmask to runtime parameters */ - ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); - - /* Initialize list pointers */ - ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; - - INIT_CAL(&ah->iq_caldata); - INSERT_CAL(ah, &ah->iq_caldata); - ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n"); - - /* Initialize current pointer to first element in list */ - ah->cal_list_curr = ah->cal_list; - - if (ah->cal_list_curr) - ath9k_hw_reset_calibration(ah, ah->cal_list_curr); - - if (caldata) - caldata->CalValid = 0; - - return true; -} - -void ar9003_hw_attach_calib_ops(struct ath_hw *ah) -{ - struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); - struct ath_hw_ops *ops = ath9k_hw_ops(ah); - - priv_ops->init_cal_settings = ar9003_hw_init_cal_settings; - priv_ops->init_cal = ar9003_hw_init_cal; - priv_ops->setup_calibration = ar9003_hw_setup_calibration; - - ops->calibrate = ar9003_hw_calibrate; -} diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c deleted file mode 100644 index f71a9eded5a4..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ /dev/null @@ -1,5348 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "hw.h" -#include "ar9003_phy.h" -#include "ar9003_eeprom.h" -#include "ar9003_mci.h" - -#define COMP_HDR_LEN 4 -#define COMP_CKSUM_LEN 2 - -#define LE16(x) __constant_cpu_to_le16(x) -#define LE32(x) __constant_cpu_to_le32(x) - -/* Local defines to distinguish between extension and control CTL's */ -#define EXT_ADDITIVE (0x8000) -#define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE) -#define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE) -#define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE) - -#define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */ -#define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */ - -#define CTL(_tpower, _flag) ((_tpower) | ((_flag) << 6)) - -#define EEPROM_DATA_LEN_9485 1088 - -static int ar9003_hw_power_interpolate(int32_t x, - int32_t *px, int32_t *py, u_int16_t np); - -static const struct ar9300_eeprom ar9300_default = { - .eepromVersion = 2, - .templateVersion = 2, - .macAddr = {0, 2, 3, 4, 5, 6}, - .custData = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .baseEepHeader = { - .regDmn = { LE16(0), LE16(0x1f) }, - .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */ - .opCapFlags = { - .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A, - .eepMisc = 0, - }, - .rfSilent = 0, - .blueToothOptions = 0, - .deviceCap = 0, - .deviceType = 5, /* takes lower byte in eeprom location */ - .pwrTableOffset = AR9300_PWR_TABLE_OFFSET, - .params_for_tuning_caps = {0, 0}, - .featureEnable = 0x0c, - /* - * bit0 - enable tx temp comp - disabled - * bit1 - enable tx volt comp - disabled - * bit2 - enable fastClock - enabled - * bit3 - enable doubling - enabled - * bit4 - enable internal regulator - disabled - * bit5 - enable pa predistortion - disabled - */ - .miscConfiguration = 0, /* bit0 - turn down drivestrength */ - .eepromWriteEnableGpio = 3, - .wlanDisableGpio = 0, - .wlanLedGpio = 8, - .rxBandSelectGpio = 0xff, - .txrxgain = 0, - .swreg = 0, - }, - .modalHeader2G = { - /* ar9300_modal_eep_header 2g */ - /* 4 idle,t1,t2,b(4 bits per setting) */ - .antCtrlCommon = LE32(0x110), - /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */ - .antCtrlCommon2 = LE32(0x22222), - - /* - * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r, - * rx1, rx12, b (2 bits each) - */ - .antCtrlChain = { LE16(0x150), LE16(0x150), LE16(0x150) }, - - /* - * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db - * for ar9280 (0xa20c/b20c 5:0) - */ - .xatten1DB = {0, 0, 0}, - - /* - * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin - * for ar9280 (0xa20c/b20c 16:12 - */ - .xatten1Margin = {0, 0, 0}, - .tempSlope = 36, - .voltSlope = 0, - - /* - * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur - * channels in usual fbin coding format - */ - .spurChans = {0, 0, 0, 0, 0}, - - /* - * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check - * if the register is per chain - */ - .noiseFloorThreshCh = {-1, 0, 0}, - .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .quick_drop = 0, - .xpaBiasLvl = 0, - .txFrameToDataStart = 0x0e, - .txFrameToPaOn = 0x0e, - .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */ - .antennaGain = 0, - .switchSettling = 0x2c, - .adcDesiredSize = -30, - .txEndToXpaOff = 0, - .txEndToRxOn = 0x2, - .txFrameToXpaOn = 0xe, - .thresh62 = 28, - .papdRateMaskHt20 = LE32(0x0cf0e0e0), - .papdRateMaskHt40 = LE32(0x6cf0e0e0), - .xlna_bias_strength = 0, - .futureModal = { - 0, 0, 0, 0, 0, 0, 0, - }, - }, - .base_ext1 = { - .ant_div_control = 0, - .future = {0, 0, 0}, - .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0} - }, - .calFreqPier2G = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1), - }, - /* ar9300_cal_data_per_freq_op_loop 2g */ - .calPierData2G = { - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - }, - .calTarget_freqbin_Cck = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2484, 1), - }, - .calTarget_freqbin_2G = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTarget_freqbin_2GHT20 = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTarget_freqbin_2GHT40 = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTargetPowerCck = { - /* 1L-5L,5S,11L,11S */ - { {36, 36, 36, 36} }, - { {36, 36, 36, 36} }, - }, - .calTargetPower2G = { - /* 6-24,36,48,54 */ - { {32, 32, 28, 24} }, - { {32, 32, 28, 24} }, - { {32, 32, 28, 24} }, - }, - .calTargetPower2GHT20 = { - { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} }, - { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} }, - { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} }, - }, - .calTargetPower2GHT40 = { - { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} }, - { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} }, - { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} }, - }, - .ctlIndex_2G = { - 0x11, 0x12, 0x15, 0x17, 0x41, 0x42, - 0x45, 0x47, 0x31, 0x32, 0x35, 0x37, - }, - .ctl_freqbin_2G = { - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2457, 1), - FREQ2FBIN(2462, 1) - }, - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2462, 1), - 0xFF, - }, - - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2462, 1), - 0xFF, - }, - { - FREQ2FBIN(2422, 1), - FREQ2FBIN(2427, 1), - FREQ2FBIN(2447, 1), - FREQ2FBIN(2452, 1) - }, - - { - /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1), - }, - - { - /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - 0, - }, - - { - /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - FREQ2FBIN(2472, 1), - 0, - }, - - { - /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1), - /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1), - /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1), - /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1), - }, - - { - /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - }, - - { - /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - 0 - }, - - { - /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - 0 - }, - - { - /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1), - /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1), - /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1), - /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1), - } - }, - .ctlPowerData_2G = { - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, - - { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, - }, - .modalHeader5G = { - /* 4 idle,t1,t2,b (4 bits per setting) */ - .antCtrlCommon = LE32(0x110), - /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */ - .antCtrlCommon2 = LE32(0x22222), - /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */ - .antCtrlChain = { - LE16(0x000), LE16(0x000), LE16(0x000), - }, - /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */ - .xatten1DB = {0, 0, 0}, - - /* - * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin - * for merlin (0xa20c/b20c 16:12 - */ - .xatten1Margin = {0, 0, 0}, - .tempSlope = 68, - .voltSlope = 0, - /* spurChans spur channels in usual fbin coding format */ - .spurChans = {0, 0, 0, 0, 0}, - /* noiseFloorThreshCh Check if the register is per chain */ - .noiseFloorThreshCh = {-1, 0, 0}, - .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .quick_drop = 0, - .xpaBiasLvl = 0, - .txFrameToDataStart = 0x0e, - .txFrameToPaOn = 0x0e, - .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */ - .antennaGain = 0, - .switchSettling = 0x2d, - .adcDesiredSize = -30, - .txEndToXpaOff = 0, - .txEndToRxOn = 0x2, - .txFrameToXpaOn = 0xe, - .thresh62 = 28, - .papdRateMaskHt20 = LE32(0x0c80c080), - .papdRateMaskHt40 = LE32(0x0080c080), - .xlna_bias_strength = 0, - .futureModal = { - 0, 0, 0, 0, 0, 0, 0, - }, - }, - .base_ext2 = { - .tempSlopeLow = 0, - .tempSlopeHigh = 0, - .xatten1DBLow = {0, 0, 0}, - .xatten1MarginLow = {0, 0, 0}, - .xatten1DBHigh = {0, 0, 0}, - .xatten1MarginHigh = {0, 0, 0} - }, - .calFreqPier5G = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5220, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5600, 0), - FREQ2FBIN(5725, 0), - FREQ2FBIN(5825, 0) - }, - .calPierData5G = { - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - - }, - .calTarget_freqbin_5G = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5220, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5600, 0), - FREQ2FBIN(5725, 0), - FREQ2FBIN(5825, 0) - }, - .calTarget_freqbin_5GHT20 = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5240, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5700, 0), - FREQ2FBIN(5745, 0), - FREQ2FBIN(5725, 0), - FREQ2FBIN(5825, 0) - }, - .calTarget_freqbin_5GHT40 = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5240, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5700, 0), - FREQ2FBIN(5745, 0), - FREQ2FBIN(5725, 0), - FREQ2FBIN(5825, 0) - }, - .calTargetPower5G = { - /* 6-24,36,48,54 */ - { {20, 20, 20, 10} }, - { {20, 20, 20, 10} }, - { {20, 20, 20, 10} }, - { {20, 20, 20, 10} }, - { {20, 20, 20, 10} }, - { {20, 20, 20, 10} }, - { {20, 20, 20, 10} }, - { {20, 20, 20, 10} }, - }, - .calTargetPower5GHT20 = { - /* - * 0_8_16,1-3_9-11_17-19, - * 4,5,6,7,12,13,14,15,20,21,22,23 - */ - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - }, - .calTargetPower5GHT40 = { - /* - * 0_8_16,1-3_9-11_17-19, - * 4,5,6,7,12,13,14,15,20,21,22,23 - */ - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} }, - }, - .ctlIndex_5G = { - 0x10, 0x16, 0x18, 0x40, 0x46, - 0x48, 0x30, 0x36, 0x38 - }, - .ctl_freqbin_5G = { - { - /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0), - /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0), - /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0), - /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0), - /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0) - }, - { - /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0), - /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0), - /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0), - /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0), - /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0) - }, - - { - /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0), - /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0), - /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0), - /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0), - /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0), - /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0), - /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0), - /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0) - }, - - { - /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0), - /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0), - /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0), - /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0), - /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[3].ctlEdges[6].bChannel */ 0xFF, - /* Data[3].ctlEdges[7].bChannel */ 0xFF, - }, - - { - /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0), - /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0), - /* Data[4].ctlEdges[4].bChannel */ 0xFF, - /* Data[4].ctlEdges[5].bChannel */ 0xFF, - /* Data[4].ctlEdges[6].bChannel */ 0xFF, - /* Data[4].ctlEdges[7].bChannel */ 0xFF, - }, - - { - /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0), - /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0), - /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0), - /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0), - /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0), - /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0), - /* Data[5].ctlEdges[6].bChannel */ 0xFF, - /* Data[5].ctlEdges[7].bChannel */ 0xFF - }, - - { - /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0), - /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0), - /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0), - /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0), - /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0), - /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0), - /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0) - }, - - { - /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0), - /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0), - /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0), - /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0), - /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0) - }, - - { - /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0), - /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0), - /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0), - /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0), - /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0), - /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0), - /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0), - /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0) - } - }, - .ctlPowerData_5G = { - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - } - }, - { - { - CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0), - CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), - } - }, - } -}; - -static const struct ar9300_eeprom ar9300_x113 = { - .eepromVersion = 2, - .templateVersion = 6, - .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0}, - .custData = {"x113-023-f0000"}, - .baseEepHeader = { - .regDmn = { LE16(0), LE16(0x1f) }, - .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */ - .opCapFlags = { - .opFlags = AR5416_OPFLAGS_11A, - .eepMisc = 0, - }, - .rfSilent = 0, - .blueToothOptions = 0, - .deviceCap = 0, - .deviceType = 5, /* takes lower byte in eeprom location */ - .pwrTableOffset = AR9300_PWR_TABLE_OFFSET, - .params_for_tuning_caps = {0, 0}, - .featureEnable = 0x0d, - /* - * bit0 - enable tx temp comp - disabled - * bit1 - enable tx volt comp - disabled - * bit2 - enable fastClock - enabled - * bit3 - enable doubling - enabled - * bit4 - enable internal regulator - disabled - * bit5 - enable pa predistortion - disabled - */ - .miscConfiguration = 0, /* bit0 - turn down drivestrength */ - .eepromWriteEnableGpio = 6, - .wlanDisableGpio = 0, - .wlanLedGpio = 8, - .rxBandSelectGpio = 0xff, - .txrxgain = 0x21, - .swreg = 0, - }, - .modalHeader2G = { - /* ar9300_modal_eep_header 2g */ - /* 4 idle,t1,t2,b(4 bits per setting) */ - .antCtrlCommon = LE32(0x110), - /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */ - .antCtrlCommon2 = LE32(0x44444), - - /* - * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r, - * rx1, rx12, b (2 bits each) - */ - .antCtrlChain = { LE16(0x150), LE16(0x150), LE16(0x150) }, - - /* - * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db - * for ar9280 (0xa20c/b20c 5:0) - */ - .xatten1DB = {0, 0, 0}, - - /* - * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin - * for ar9280 (0xa20c/b20c 16:12 - */ - .xatten1Margin = {0, 0, 0}, - .tempSlope = 25, - .voltSlope = 0, - - /* - * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur - * channels in usual fbin coding format - */ - .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0}, - - /* - * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check - * if the register is per chain - */ - .noiseFloorThreshCh = {-1, 0, 0}, - .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .quick_drop = 0, - .xpaBiasLvl = 0, - .txFrameToDataStart = 0x0e, - .txFrameToPaOn = 0x0e, - .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */ - .antennaGain = 0, - .switchSettling = 0x2c, - .adcDesiredSize = -30, - .txEndToXpaOff = 0, - .txEndToRxOn = 0x2, - .txFrameToXpaOn = 0xe, - .thresh62 = 28, - .papdRateMaskHt20 = LE32(0x0c80c080), - .papdRateMaskHt40 = LE32(0x0080c080), - .xlna_bias_strength = 0, - .futureModal = { - 0, 0, 0, 0, 0, 0, 0, - }, - }, - .base_ext1 = { - .ant_div_control = 0, - .future = {0, 0, 0}, - .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0} - }, - .calFreqPier2G = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1), - }, - /* ar9300_cal_data_per_freq_op_loop 2g */ - .calPierData2G = { - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - }, - .calTarget_freqbin_Cck = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2472, 1), - }, - .calTarget_freqbin_2G = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTarget_freqbin_2GHT20 = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTarget_freqbin_2GHT40 = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTargetPowerCck = { - /* 1L-5L,5S,11L,11S */ - { {34, 34, 34, 34} }, - { {34, 34, 34, 34} }, - }, - .calTargetPower2G = { - /* 6-24,36,48,54 */ - { {34, 34, 32, 32} }, - { {34, 34, 32, 32} }, - { {34, 34, 32, 32} }, - }, - .calTargetPower2GHT20 = { - { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} }, - { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} }, - { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} }, - }, - .calTargetPower2GHT40 = { - { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} }, - { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} }, - { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} }, - }, - .ctlIndex_2G = { - 0x11, 0x12, 0x15, 0x17, 0x41, 0x42, - 0x45, 0x47, 0x31, 0x32, 0x35, 0x37, - }, - .ctl_freqbin_2G = { - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2457, 1), - FREQ2FBIN(2462, 1) - }, - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2462, 1), - 0xFF, - }, - - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2462, 1), - 0xFF, - }, - { - FREQ2FBIN(2422, 1), - FREQ2FBIN(2427, 1), - FREQ2FBIN(2447, 1), - FREQ2FBIN(2452, 1) - }, - - { - /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1), - }, - - { - /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - 0, - }, - - { - /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - FREQ2FBIN(2472, 1), - 0, - }, - - { - /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1), - /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1), - /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1), - /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1), - }, - - { - /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - }, - - { - /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - 0 - }, - - { - /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - 0 - }, - - { - /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1), - /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1), - /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1), - /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1), - } - }, - .ctlPowerData_2G = { - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, - - { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, - }, - .modalHeader5G = { - /* 4 idle,t1,t2,b (4 bits per setting) */ - .antCtrlCommon = LE32(0x220), - /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */ - .antCtrlCommon2 = LE32(0x11111), - /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */ - .antCtrlChain = { - LE16(0x150), LE16(0x150), LE16(0x150), - }, - /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */ - .xatten1DB = {0, 0, 0}, - - /* - * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin - * for merlin (0xa20c/b20c 16:12 - */ - .xatten1Margin = {0, 0, 0}, - .tempSlope = 68, - .voltSlope = 0, - /* spurChans spur channels in usual fbin coding format */ - .spurChans = {FREQ2FBIN(5500, 0), 0, 0, 0, 0}, - /* noiseFloorThreshCh Check if the register is per chain */ - .noiseFloorThreshCh = {-1, 0, 0}, - .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .quick_drop = 0, - .xpaBiasLvl = 0xf, - .txFrameToDataStart = 0x0e, - .txFrameToPaOn = 0x0e, - .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */ - .antennaGain = 0, - .switchSettling = 0x2d, - .adcDesiredSize = -30, - .txEndToXpaOff = 0, - .txEndToRxOn = 0x2, - .txFrameToXpaOn = 0xe, - .thresh62 = 28, - .papdRateMaskHt20 = LE32(0x0cf0e0e0), - .papdRateMaskHt40 = LE32(0x6cf0e0e0), - .xlna_bias_strength = 0, - .futureModal = { - 0, 0, 0, 0, 0, 0, 0, - }, - }, - .base_ext2 = { - .tempSlopeLow = 72, - .tempSlopeHigh = 105, - .xatten1DBLow = {0, 0, 0}, - .xatten1MarginLow = {0, 0, 0}, - .xatten1DBHigh = {0, 0, 0}, - .xatten1MarginHigh = {0, 0, 0} - }, - .calFreqPier5G = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5240, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5600, 0), - FREQ2FBIN(5745, 0), - FREQ2FBIN(5785, 0) - }, - .calPierData5G = { - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - - }, - .calTarget_freqbin_5G = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5220, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5600, 0), - FREQ2FBIN(5745, 0), - FREQ2FBIN(5785, 0) - }, - .calTarget_freqbin_5GHT20 = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5240, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5700, 0), - FREQ2FBIN(5745, 0), - FREQ2FBIN(5825, 0) - }, - .calTarget_freqbin_5GHT40 = { - FREQ2FBIN(5190, 0), - FREQ2FBIN(5230, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5410, 0), - FREQ2FBIN(5510, 0), - FREQ2FBIN(5670, 0), - FREQ2FBIN(5755, 0), - FREQ2FBIN(5825, 0) - }, - .calTargetPower5G = { - /* 6-24,36,48,54 */ - { {42, 40, 40, 34} }, - { {42, 40, 40, 34} }, - { {42, 40, 40, 34} }, - { {42, 40, 40, 34} }, - { {42, 40, 40, 34} }, - { {42, 40, 40, 34} }, - { {42, 40, 40, 34} }, - { {42, 40, 40, 34} }, - }, - .calTargetPower5GHT20 = { - /* - * 0_8_16,1-3_9-11_17-19, - * 4,5,6,7,12,13,14,15,20,21,22,23 - */ - { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} }, - { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} }, - { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} }, - { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} }, - { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} }, - { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} }, - { {38, 38, 38, 38, 32, 28, 38, 38, 32, 28, 38, 38, 32, 26} }, - { {36, 36, 36, 36, 32, 28, 36, 36, 32, 28, 36, 36, 32, 26} }, - }, - .calTargetPower5GHT40 = { - /* - * 0_8_16,1-3_9-11_17-19, - * 4,5,6,7,12,13,14,15,20,21,22,23 - */ - { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} }, - { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} }, - { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} }, - { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} }, - { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} }, - { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} }, - { {36, 36, 36, 36, 30, 26, 36, 36, 30, 26, 36, 36, 30, 24} }, - { {34, 34, 34, 34, 30, 26, 34, 34, 30, 26, 34, 34, 30, 24} }, - }, - .ctlIndex_5G = { - 0x10, 0x16, 0x18, 0x40, 0x46, - 0x48, 0x30, 0x36, 0x38 - }, - .ctl_freqbin_5G = { - { - /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0), - /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0), - /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0), - /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0), - /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0) - }, - { - /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0), - /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0), - /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0), - /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0), - /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0) - }, - - { - /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0), - /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0), - /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0), - /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0), - /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0), - /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0), - /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0), - /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0) - }, - - { - /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0), - /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0), - /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0), - /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0), - /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[3].ctlEdges[6].bChannel */ 0xFF, - /* Data[3].ctlEdges[7].bChannel */ 0xFF, - }, - - { - /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0), - /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0), - /* Data[4].ctlEdges[4].bChannel */ 0xFF, - /* Data[4].ctlEdges[5].bChannel */ 0xFF, - /* Data[4].ctlEdges[6].bChannel */ 0xFF, - /* Data[4].ctlEdges[7].bChannel */ 0xFF, - }, - - { - /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0), - /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0), - /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0), - /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0), - /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0), - /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0), - /* Data[5].ctlEdges[6].bChannel */ 0xFF, - /* Data[5].ctlEdges[7].bChannel */ 0xFF - }, - - { - /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0), - /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0), - /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0), - /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0), - /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0), - /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0), - /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0) - }, - - { - /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0), - /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0), - /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0), - /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0), - /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0) - }, - - { - /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0), - /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0), - /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0), - /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0), - /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0), - /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0), - /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0), - /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0) - } - }, - .ctlPowerData_5G = { - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - } - }, - { - { - CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0), - CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), - } - }, - } -}; - - -static const struct ar9300_eeprom ar9300_h112 = { - .eepromVersion = 2, - .templateVersion = 3, - .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0}, - .custData = {"h112-241-f0000"}, - .baseEepHeader = { - .regDmn = { LE16(0), LE16(0x1f) }, - .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */ - .opCapFlags = { - .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A, - .eepMisc = 0, - }, - .rfSilent = 0, - .blueToothOptions = 0, - .deviceCap = 0, - .deviceType = 5, /* takes lower byte in eeprom location */ - .pwrTableOffset = AR9300_PWR_TABLE_OFFSET, - .params_for_tuning_caps = {0, 0}, - .featureEnable = 0x0d, - /* - * bit0 - enable tx temp comp - disabled - * bit1 - enable tx volt comp - disabled - * bit2 - enable fastClock - enabled - * bit3 - enable doubling - enabled - * bit4 - enable internal regulator - disabled - * bit5 - enable pa predistortion - disabled - */ - .miscConfiguration = 0, /* bit0 - turn down drivestrength */ - .eepromWriteEnableGpio = 6, - .wlanDisableGpio = 0, - .wlanLedGpio = 8, - .rxBandSelectGpio = 0xff, - .txrxgain = 0x10, - .swreg = 0, - }, - .modalHeader2G = { - /* ar9300_modal_eep_header 2g */ - /* 4 idle,t1,t2,b(4 bits per setting) */ - .antCtrlCommon = LE32(0x110), - /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */ - .antCtrlCommon2 = LE32(0x44444), - - /* - * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r, - * rx1, rx12, b (2 bits each) - */ - .antCtrlChain = { LE16(0x150), LE16(0x150), LE16(0x150) }, - - /* - * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db - * for ar9280 (0xa20c/b20c 5:0) - */ - .xatten1DB = {0, 0, 0}, - - /* - * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin - * for ar9280 (0xa20c/b20c 16:12 - */ - .xatten1Margin = {0, 0, 0}, - .tempSlope = 25, - .voltSlope = 0, - - /* - * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur - * channels in usual fbin coding format - */ - .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0}, - - /* - * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check - * if the register is per chain - */ - .noiseFloorThreshCh = {-1, 0, 0}, - .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .quick_drop = 0, - .xpaBiasLvl = 0, - .txFrameToDataStart = 0x0e, - .txFrameToPaOn = 0x0e, - .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */ - .antennaGain = 0, - .switchSettling = 0x2c, - .adcDesiredSize = -30, - .txEndToXpaOff = 0, - .txEndToRxOn = 0x2, - .txFrameToXpaOn = 0xe, - .thresh62 = 28, - .papdRateMaskHt20 = LE32(0x0c80c080), - .papdRateMaskHt40 = LE32(0x0080c080), - .xlna_bias_strength = 0, - .futureModal = { - 0, 0, 0, 0, 0, 0, 0, - }, - }, - .base_ext1 = { - .ant_div_control = 0, - .future = {0, 0, 0}, - .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0} - }, - .calFreqPier2G = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2462, 1), - }, - /* ar9300_cal_data_per_freq_op_loop 2g */ - .calPierData2G = { - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - }, - .calTarget_freqbin_Cck = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2472, 1), - }, - .calTarget_freqbin_2G = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTarget_freqbin_2GHT20 = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTarget_freqbin_2GHT40 = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTargetPowerCck = { - /* 1L-5L,5S,11L,11S */ - { {34, 34, 34, 34} }, - { {34, 34, 34, 34} }, - }, - .calTargetPower2G = { - /* 6-24,36,48,54 */ - { {34, 34, 32, 32} }, - { {34, 34, 32, 32} }, - { {34, 34, 32, 32} }, - }, - .calTargetPower2GHT20 = { - { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} }, - { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} }, - { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} }, - }, - .calTargetPower2GHT40 = { - { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} }, - { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} }, - { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} }, - }, - .ctlIndex_2G = { - 0x11, 0x12, 0x15, 0x17, 0x41, 0x42, - 0x45, 0x47, 0x31, 0x32, 0x35, 0x37, - }, - .ctl_freqbin_2G = { - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2457, 1), - FREQ2FBIN(2462, 1) - }, - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2462, 1), - 0xFF, - }, - - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2462, 1), - 0xFF, - }, - { - FREQ2FBIN(2422, 1), - FREQ2FBIN(2427, 1), - FREQ2FBIN(2447, 1), - FREQ2FBIN(2452, 1) - }, - - { - /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1), - }, - - { - /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - 0, - }, - - { - /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - FREQ2FBIN(2472, 1), - 0, - }, - - { - /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1), - /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1), - /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1), - /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1), - }, - - { - /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - }, - - { - /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - 0 - }, - - { - /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - 0 - }, - - { - /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1), - /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1), - /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1), - /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1), - } - }, - .ctlPowerData_2G = { - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, - - { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, - }, - .modalHeader5G = { - /* 4 idle,t1,t2,b (4 bits per setting) */ - .antCtrlCommon = LE32(0x220), - /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */ - .antCtrlCommon2 = LE32(0x44444), - /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */ - .antCtrlChain = { - LE16(0x150), LE16(0x150), LE16(0x150), - }, - /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */ - .xatten1DB = {0, 0, 0}, - - /* - * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin - * for merlin (0xa20c/b20c 16:12 - */ - .xatten1Margin = {0, 0, 0}, - .tempSlope = 45, - .voltSlope = 0, - /* spurChans spur channels in usual fbin coding format */ - .spurChans = {0, 0, 0, 0, 0}, - /* noiseFloorThreshCh Check if the register is per chain */ - .noiseFloorThreshCh = {-1, 0, 0}, - .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .quick_drop = 0, - .xpaBiasLvl = 0, - .txFrameToDataStart = 0x0e, - .txFrameToPaOn = 0x0e, - .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */ - .antennaGain = 0, - .switchSettling = 0x2d, - .adcDesiredSize = -30, - .txEndToXpaOff = 0, - .txEndToRxOn = 0x2, - .txFrameToXpaOn = 0xe, - .thresh62 = 28, - .papdRateMaskHt20 = LE32(0x0cf0e0e0), - .papdRateMaskHt40 = LE32(0x6cf0e0e0), - .xlna_bias_strength = 0, - .futureModal = { - 0, 0, 0, 0, 0, 0, 0, - }, - }, - .base_ext2 = { - .tempSlopeLow = 40, - .tempSlopeHigh = 50, - .xatten1DBLow = {0, 0, 0}, - .xatten1MarginLow = {0, 0, 0}, - .xatten1DBHigh = {0, 0, 0}, - .xatten1MarginHigh = {0, 0, 0} - }, - .calFreqPier5G = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5220, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5600, 0), - FREQ2FBIN(5700, 0), - FREQ2FBIN(5785, 0) - }, - .calPierData5G = { - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - - }, - .calTarget_freqbin_5G = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5240, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5600, 0), - FREQ2FBIN(5700, 0), - FREQ2FBIN(5825, 0) - }, - .calTarget_freqbin_5GHT20 = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5240, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5700, 0), - FREQ2FBIN(5745, 0), - FREQ2FBIN(5825, 0) - }, - .calTarget_freqbin_5GHT40 = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5240, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5700, 0), - FREQ2FBIN(5745, 0), - FREQ2FBIN(5825, 0) - }, - .calTargetPower5G = { - /* 6-24,36,48,54 */ - { {30, 30, 28, 24} }, - { {30, 30, 28, 24} }, - { {30, 30, 28, 24} }, - { {30, 30, 28, 24} }, - { {30, 30, 28, 24} }, - { {30, 30, 28, 24} }, - { {30, 30, 28, 24} }, - { {30, 30, 28, 24} }, - }, - .calTargetPower5GHT20 = { - /* - * 0_8_16,1-3_9-11_17-19, - * 4,5,6,7,12,13,14,15,20,21,22,23 - */ - { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 20, 20, 20, 16} }, - { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 20, 20, 20, 16} }, - { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 18, 18, 18, 16} }, - { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 18, 18, 18, 16} }, - { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 16, 16, 16, 14} }, - { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 16, 16, 16, 14} }, - { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 14, 14, 14, 12} }, - { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 14, 14, 14, 12} }, - }, - .calTargetPower5GHT40 = { - /* - * 0_8_16,1-3_9-11_17-19, - * 4,5,6,7,12,13,14,15,20,21,22,23 - */ - { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 18, 18, 18, 14} }, - { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 18, 18, 18, 14} }, - { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 16, 16, 16, 12} }, - { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 16, 16, 16, 12} }, - { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 14, 14, 14, 10} }, - { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 14, 14, 14, 10} }, - { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 12, 12, 12, 8} }, - { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 12, 12, 12, 8} }, - }, - .ctlIndex_5G = { - 0x10, 0x16, 0x18, 0x40, 0x46, - 0x48, 0x30, 0x36, 0x38 - }, - .ctl_freqbin_5G = { - { - /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0), - /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0), - /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0), - /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0), - /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0) - }, - { - /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0), - /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0), - /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0), - /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0), - /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0) - }, - - { - /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0), - /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0), - /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0), - /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0), - /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0), - /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0), - /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0), - /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0) - }, - - { - /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0), - /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0), - /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0), - /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0), - /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[3].ctlEdges[6].bChannel */ 0xFF, - /* Data[3].ctlEdges[7].bChannel */ 0xFF, - }, - - { - /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0), - /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0), - /* Data[4].ctlEdges[4].bChannel */ 0xFF, - /* Data[4].ctlEdges[5].bChannel */ 0xFF, - /* Data[4].ctlEdges[6].bChannel */ 0xFF, - /* Data[4].ctlEdges[7].bChannel */ 0xFF, - }, - - { - /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0), - /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0), - /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0), - /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0), - /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0), - /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0), - /* Data[5].ctlEdges[6].bChannel */ 0xFF, - /* Data[5].ctlEdges[7].bChannel */ 0xFF - }, - - { - /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0), - /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0), - /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0), - /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0), - /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0), - /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0), - /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0) - }, - - { - /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0), - /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0), - /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0), - /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0), - /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0) - }, - - { - /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0), - /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0), - /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0), - /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0), - /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0), - /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0), - /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0), - /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0) - } - }, - .ctlPowerData_5G = { - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - } - }, - { - { - CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0), - CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), - } - }, - } -}; - - -static const struct ar9300_eeprom ar9300_x112 = { - .eepromVersion = 2, - .templateVersion = 5, - .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0}, - .custData = {"x112-041-f0000"}, - .baseEepHeader = { - .regDmn = { LE16(0), LE16(0x1f) }, - .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */ - .opCapFlags = { - .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A, - .eepMisc = 0, - }, - .rfSilent = 0, - .blueToothOptions = 0, - .deviceCap = 0, - .deviceType = 5, /* takes lower byte in eeprom location */ - .pwrTableOffset = AR9300_PWR_TABLE_OFFSET, - .params_for_tuning_caps = {0, 0}, - .featureEnable = 0x0d, - /* - * bit0 - enable tx temp comp - disabled - * bit1 - enable tx volt comp - disabled - * bit2 - enable fastclock - enabled - * bit3 - enable doubling - enabled - * bit4 - enable internal regulator - disabled - * bit5 - enable pa predistortion - disabled - */ - .miscConfiguration = 0, /* bit0 - turn down drivestrength */ - .eepromWriteEnableGpio = 6, - .wlanDisableGpio = 0, - .wlanLedGpio = 8, - .rxBandSelectGpio = 0xff, - .txrxgain = 0x0, - .swreg = 0, - }, - .modalHeader2G = { - /* ar9300_modal_eep_header 2g */ - /* 4 idle,t1,t2,b(4 bits per setting) */ - .antCtrlCommon = LE32(0x110), - /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */ - .antCtrlCommon2 = LE32(0x22222), - - /* - * antCtrlChain[ar9300_max_chains]; 6 idle, t, r, - * rx1, rx12, b (2 bits each) - */ - .antCtrlChain = { LE16(0x10), LE16(0x10), LE16(0x10) }, - - /* - * xatten1DB[AR9300_max_chains]; 3 xatten1_db - * for ar9280 (0xa20c/b20c 5:0) - */ - .xatten1DB = {0x1b, 0x1b, 0x1b}, - - /* - * xatten1Margin[ar9300_max_chains]; 3 xatten1_margin - * for ar9280 (0xa20c/b20c 16:12 - */ - .xatten1Margin = {0x15, 0x15, 0x15}, - .tempSlope = 50, - .voltSlope = 0, - - /* - * spurChans[OSPrey_eeprom_modal_sPURS]; spur - * channels in usual fbin coding format - */ - .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0}, - - /* - * noiseFloorThreshch[ar9300_max_cHAINS]; 3 Check - * if the register is per chain - */ - .noiseFloorThreshCh = {-1, 0, 0}, - .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .quick_drop = 0, - .xpaBiasLvl = 0, - .txFrameToDataStart = 0x0e, - .txFrameToPaOn = 0x0e, - .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */ - .antennaGain = 0, - .switchSettling = 0x2c, - .adcDesiredSize = -30, - .txEndToXpaOff = 0, - .txEndToRxOn = 0x2, - .txFrameToXpaOn = 0xe, - .thresh62 = 28, - .papdRateMaskHt20 = LE32(0x0c80c080), - .papdRateMaskHt40 = LE32(0x0080c080), - .xlna_bias_strength = 0, - .futureModal = { - 0, 0, 0, 0, 0, 0, 0, - }, - }, - .base_ext1 = { - .ant_div_control = 0, - .future = {0, 0, 0}, - .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0} - }, - .calFreqPier2G = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1), - }, - /* ar9300_cal_data_per_freq_op_loop 2g */ - .calPierData2G = { - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - }, - .calTarget_freqbin_Cck = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2472, 1), - }, - .calTarget_freqbin_2G = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTarget_freqbin_2GHT20 = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTarget_freqbin_2GHT40 = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTargetPowerCck = { - /* 1L-5L,5S,11L,11s */ - { {38, 38, 38, 38} }, - { {38, 38, 38, 38} }, - }, - .calTargetPower2G = { - /* 6-24,36,48,54 */ - { {38, 38, 36, 34} }, - { {38, 38, 36, 34} }, - { {38, 38, 34, 32} }, - }, - .calTargetPower2GHT20 = { - { {36, 36, 36, 36, 36, 34, 34, 32, 30, 28, 28, 28, 28, 26} }, - { {36, 36, 36, 36, 36, 34, 36, 34, 32, 30, 30, 30, 28, 26} }, - { {36, 36, 36, 36, 36, 34, 34, 32, 30, 28, 28, 28, 28, 26} }, - }, - .calTargetPower2GHT40 = { - { {36, 36, 36, 36, 34, 32, 32, 30, 28, 26, 26, 26, 26, 24} }, - { {36, 36, 36, 36, 34, 32, 34, 32, 30, 28, 28, 28, 28, 24} }, - { {36, 36, 36, 36, 34, 32, 32, 30, 28, 26, 26, 26, 26, 24} }, - }, - .ctlIndex_2G = { - 0x11, 0x12, 0x15, 0x17, 0x41, 0x42, - 0x45, 0x47, 0x31, 0x32, 0x35, 0x37, - }, - .ctl_freqbin_2G = { - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2457, 1), - FREQ2FBIN(2462, 1) - }, - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2462, 1), - 0xFF, - }, - - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2462, 1), - 0xFF, - }, - { - FREQ2FBIN(2422, 1), - FREQ2FBIN(2427, 1), - FREQ2FBIN(2447, 1), - FREQ2FBIN(2452, 1) - }, - - { - /* Data[4].ctledges[0].bchannel */ FREQ2FBIN(2412, 1), - /* Data[4].ctledges[1].bchannel */ FREQ2FBIN(2417, 1), - /* Data[4].ctledges[2].bchannel */ FREQ2FBIN(2472, 1), - /* Data[4].ctledges[3].bchannel */ FREQ2FBIN(2484, 1), - }, - - { - /* Data[5].ctledges[0].bchannel */ FREQ2FBIN(2412, 1), - /* Data[5].ctledges[1].bchannel */ FREQ2FBIN(2417, 1), - /* Data[5].ctledges[2].bchannel */ FREQ2FBIN(2472, 1), - 0, - }, - - { - /* Data[6].ctledges[0].bchannel */ FREQ2FBIN(2412, 1), - /* Data[6].ctledges[1].bchannel */ FREQ2FBIN(2417, 1), - FREQ2FBIN(2472, 1), - 0, - }, - - { - /* Data[7].ctledges[0].bchannel */ FREQ2FBIN(2422, 1), - /* Data[7].ctledges[1].bchannel */ FREQ2FBIN(2427, 1), - /* Data[7].ctledges[2].bchannel */ FREQ2FBIN(2447, 1), - /* Data[7].ctledges[3].bchannel */ FREQ2FBIN(2462, 1), - }, - - { - /* Data[8].ctledges[0].bchannel */ FREQ2FBIN(2412, 1), - /* Data[8].ctledges[1].bchannel */ FREQ2FBIN(2417, 1), - /* Data[8].ctledges[2].bchannel */ FREQ2FBIN(2472, 1), - }, - - { - /* Data[9].ctledges[0].bchannel */ FREQ2FBIN(2412, 1), - /* Data[9].ctledges[1].bchannel */ FREQ2FBIN(2417, 1), - /* Data[9].ctledges[2].bchannel */ FREQ2FBIN(2472, 1), - 0 - }, - - { - /* Data[10].ctledges[0].bchannel */ FREQ2FBIN(2412, 1), - /* Data[10].ctledges[1].bchannel */ FREQ2FBIN(2417, 1), - /* Data[10].ctledges[2].bchannel */ FREQ2FBIN(2472, 1), - 0 - }, - - { - /* Data[11].ctledges[0].bchannel */ FREQ2FBIN(2422, 1), - /* Data[11].ctledges[1].bchannel */ FREQ2FBIN(2427, 1), - /* Data[11].ctledges[2].bchannel */ FREQ2FBIN(2447, 1), - /* Data[11].ctledges[3].bchannel */ FREQ2FBIN(2462, 1), - } - }, - .ctlPowerData_2G = { - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, - - { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, - }, - .modalHeader5G = { - /* 4 idle,t1,t2,b (4 bits per setting) */ - .antCtrlCommon = LE32(0x110), - /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */ - .antCtrlCommon2 = LE32(0x22222), - /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */ - .antCtrlChain = { - LE16(0x0), LE16(0x0), LE16(0x0), - }, - /* xatten1DB 3 xatten1_db for ar9280 (0xa20c/b20c 5:0) */ - .xatten1DB = {0x13, 0x19, 0x17}, - - /* - * xatten1Margin[ar9300_max_chains]; 3 xatten1_margin - * for merlin (0xa20c/b20c 16:12 - */ - .xatten1Margin = {0x19, 0x19, 0x19}, - .tempSlope = 70, - .voltSlope = 15, - /* spurChans spur channels in usual fbin coding format */ - .spurChans = {0, 0, 0, 0, 0}, - /* noiseFloorThreshch check if the register is per chain */ - .noiseFloorThreshCh = {-1, 0, 0}, - .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .quick_drop = 0, - .xpaBiasLvl = 0, - .txFrameToDataStart = 0x0e, - .txFrameToPaOn = 0x0e, - .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */ - .antennaGain = 0, - .switchSettling = 0x2d, - .adcDesiredSize = -30, - .txEndToXpaOff = 0, - .txEndToRxOn = 0x2, - .txFrameToXpaOn = 0xe, - .thresh62 = 28, - .papdRateMaskHt20 = LE32(0x0cf0e0e0), - .papdRateMaskHt40 = LE32(0x6cf0e0e0), - .xlna_bias_strength = 0, - .futureModal = { - 0, 0, 0, 0, 0, 0, 0, - }, - }, - .base_ext2 = { - .tempSlopeLow = 72, - .tempSlopeHigh = 105, - .xatten1DBLow = {0x10, 0x14, 0x10}, - .xatten1MarginLow = {0x19, 0x19 , 0x19}, - .xatten1DBHigh = {0x1d, 0x20, 0x24}, - .xatten1MarginHigh = {0x10, 0x10, 0x10} - }, - .calFreqPier5G = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5220, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5600, 0), - FREQ2FBIN(5700, 0), - FREQ2FBIN(5785, 0) - }, - .calPierData5G = { - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - - }, - .calTarget_freqbin_5G = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5220, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5600, 0), - FREQ2FBIN(5725, 0), - FREQ2FBIN(5825, 0) - }, - .calTarget_freqbin_5GHT20 = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5220, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5600, 0), - FREQ2FBIN(5725, 0), - FREQ2FBIN(5825, 0) - }, - .calTarget_freqbin_5GHT40 = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5220, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5600, 0), - FREQ2FBIN(5725, 0), - FREQ2FBIN(5825, 0) - }, - .calTargetPower5G = { - /* 6-24,36,48,54 */ - { {32, 32, 28, 26} }, - { {32, 32, 28, 26} }, - { {32, 32, 28, 26} }, - { {32, 32, 26, 24} }, - { {32, 32, 26, 24} }, - { {32, 32, 24, 22} }, - { {30, 30, 24, 22} }, - { {30, 30, 24, 22} }, - }, - .calTargetPower5GHT20 = { - /* - * 0_8_16,1-3_9-11_17-19, - * 4,5,6,7,12,13,14,15,20,21,22,23 - */ - { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} }, - { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} }, - { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} }, - { {32, 32, 32, 32, 28, 26, 32, 26, 24, 22, 22, 22, 20, 20} }, - { {32, 32, 32, 32, 28, 26, 32, 26, 24, 22, 20, 18, 16, 16} }, - { {32, 32, 32, 32, 28, 26, 32, 24, 20, 16, 18, 16, 14, 14} }, - { {30, 30, 30, 30, 28, 26, 30, 24, 20, 16, 18, 16, 14, 14} }, - { {30, 30, 30, 30, 28, 26, 30, 24, 20, 16, 18, 16, 14, 14} }, - }, - .calTargetPower5GHT40 = { - /* - * 0_8_16,1-3_9-11_17-19, - * 4,5,6,7,12,13,14,15,20,21,22,23 - */ - { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} }, - { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} }, - { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} }, - { {32, 32, 32, 30, 28, 26, 30, 26, 24, 22, 22, 22, 20, 20} }, - { {32, 32, 32, 30, 28, 26, 30, 26, 24, 22, 20, 18, 16, 16} }, - { {32, 32, 32, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} }, - { {30, 30, 30, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} }, - { {30, 30, 30, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} }, - }, - .ctlIndex_5G = { - 0x10, 0x16, 0x18, 0x40, 0x46, - 0x48, 0x30, 0x36, 0x38 - }, - .ctl_freqbin_5G = { - { - /* Data[0].ctledges[0].bchannel */ FREQ2FBIN(5180, 0), - /* Data[0].ctledges[1].bchannel */ FREQ2FBIN(5260, 0), - /* Data[0].ctledges[2].bchannel */ FREQ2FBIN(5280, 0), - /* Data[0].ctledges[3].bchannel */ FREQ2FBIN(5500, 0), - /* Data[0].ctledges[4].bchannel */ FREQ2FBIN(5600, 0), - /* Data[0].ctledges[5].bchannel */ FREQ2FBIN(5700, 0), - /* Data[0].ctledges[6].bchannel */ FREQ2FBIN(5745, 0), - /* Data[0].ctledges[7].bchannel */ FREQ2FBIN(5825, 0) - }, - { - /* Data[1].ctledges[0].bchannel */ FREQ2FBIN(5180, 0), - /* Data[1].ctledges[1].bchannel */ FREQ2FBIN(5260, 0), - /* Data[1].ctledges[2].bchannel */ FREQ2FBIN(5280, 0), - /* Data[1].ctledges[3].bchannel */ FREQ2FBIN(5500, 0), - /* Data[1].ctledges[4].bchannel */ FREQ2FBIN(5520, 0), - /* Data[1].ctledges[5].bchannel */ FREQ2FBIN(5700, 0), - /* Data[1].ctledges[6].bchannel */ FREQ2FBIN(5745, 0), - /* Data[1].ctledges[7].bchannel */ FREQ2FBIN(5825, 0) - }, - - { - /* Data[2].ctledges[0].bchannel */ FREQ2FBIN(5190, 0), - /* Data[2].ctledges[1].bchannel */ FREQ2FBIN(5230, 0), - /* Data[2].ctledges[2].bchannel */ FREQ2FBIN(5270, 0), - /* Data[2].ctledges[3].bchannel */ FREQ2FBIN(5310, 0), - /* Data[2].ctledges[4].bchannel */ FREQ2FBIN(5510, 0), - /* Data[2].ctledges[5].bchannel */ FREQ2FBIN(5550, 0), - /* Data[2].ctledges[6].bchannel */ FREQ2FBIN(5670, 0), - /* Data[2].ctledges[7].bchannel */ FREQ2FBIN(5755, 0) - }, - - { - /* Data[3].ctledges[0].bchannel */ FREQ2FBIN(5180, 0), - /* Data[3].ctledges[1].bchannel */ FREQ2FBIN(5200, 0), - /* Data[3].ctledges[2].bchannel */ FREQ2FBIN(5260, 0), - /* Data[3].ctledges[3].bchannel */ FREQ2FBIN(5320, 0), - /* Data[3].ctledges[4].bchannel */ FREQ2FBIN(5500, 0), - /* Data[3].ctledges[5].bchannel */ FREQ2FBIN(5700, 0), - /* Data[3].ctledges[6].bchannel */ 0xFF, - /* Data[3].ctledges[7].bchannel */ 0xFF, - }, - - { - /* Data[4].ctledges[0].bchannel */ FREQ2FBIN(5180, 0), - /* Data[4].ctledges[1].bchannel */ FREQ2FBIN(5260, 0), - /* Data[4].ctledges[2].bchannel */ FREQ2FBIN(5500, 0), - /* Data[4].ctledges[3].bchannel */ FREQ2FBIN(5700, 0), - /* Data[4].ctledges[4].bchannel */ 0xFF, - /* Data[4].ctledges[5].bchannel */ 0xFF, - /* Data[4].ctledges[6].bchannel */ 0xFF, - /* Data[4].ctledges[7].bchannel */ 0xFF, - }, - - { - /* Data[5].ctledges[0].bchannel */ FREQ2FBIN(5190, 0), - /* Data[5].ctledges[1].bchannel */ FREQ2FBIN(5270, 0), - /* Data[5].ctledges[2].bchannel */ FREQ2FBIN(5310, 0), - /* Data[5].ctledges[3].bchannel */ FREQ2FBIN(5510, 0), - /* Data[5].ctledges[4].bchannel */ FREQ2FBIN(5590, 0), - /* Data[5].ctledges[5].bchannel */ FREQ2FBIN(5670, 0), - /* Data[5].ctledges[6].bchannel */ 0xFF, - /* Data[5].ctledges[7].bchannel */ 0xFF - }, - - { - /* Data[6].ctledges[0].bchannel */ FREQ2FBIN(5180, 0), - /* Data[6].ctledges[1].bchannel */ FREQ2FBIN(5200, 0), - /* Data[6].ctledges[2].bchannel */ FREQ2FBIN(5220, 0), - /* Data[6].ctledges[3].bchannel */ FREQ2FBIN(5260, 0), - /* Data[6].ctledges[4].bchannel */ FREQ2FBIN(5500, 0), - /* Data[6].ctledges[5].bchannel */ FREQ2FBIN(5600, 0), - /* Data[6].ctledges[6].bchannel */ FREQ2FBIN(5700, 0), - /* Data[6].ctledges[7].bchannel */ FREQ2FBIN(5745, 0) - }, - - { - /* Data[7].ctledges[0].bchannel */ FREQ2FBIN(5180, 0), - /* Data[7].ctledges[1].bchannel */ FREQ2FBIN(5260, 0), - /* Data[7].ctledges[2].bchannel */ FREQ2FBIN(5320, 0), - /* Data[7].ctledges[3].bchannel */ FREQ2FBIN(5500, 0), - /* Data[7].ctledges[4].bchannel */ FREQ2FBIN(5560, 0), - /* Data[7].ctledges[5].bchannel */ FREQ2FBIN(5700, 0), - /* Data[7].ctledges[6].bchannel */ FREQ2FBIN(5745, 0), - /* Data[7].ctledges[7].bchannel */ FREQ2FBIN(5825, 0) - }, - - { - /* Data[8].ctledges[0].bchannel */ FREQ2FBIN(5190, 0), - /* Data[8].ctledges[1].bchannel */ FREQ2FBIN(5230, 0), - /* Data[8].ctledges[2].bchannel */ FREQ2FBIN(5270, 0), - /* Data[8].ctledges[3].bchannel */ FREQ2FBIN(5510, 0), - /* Data[8].ctledges[4].bchannel */ FREQ2FBIN(5550, 0), - /* Data[8].ctledges[5].bchannel */ FREQ2FBIN(5670, 0), - /* Data[8].ctledges[6].bchannel */ FREQ2FBIN(5755, 0), - /* Data[8].ctledges[7].bchannel */ FREQ2FBIN(5795, 0) - } - }, - .ctlPowerData_5G = { - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - } - }, - { - { - CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0), - CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), - } - }, - } -}; - -static const struct ar9300_eeprom ar9300_h116 = { - .eepromVersion = 2, - .templateVersion = 4, - .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0}, - .custData = {"h116-041-f0000"}, - .baseEepHeader = { - .regDmn = { LE16(0), LE16(0x1f) }, - .txrxMask = 0x33, /* 4 bits tx and 4 bits rx */ - .opCapFlags = { - .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A, - .eepMisc = 0, - }, - .rfSilent = 0, - .blueToothOptions = 0, - .deviceCap = 0, - .deviceType = 5, /* takes lower byte in eeprom location */ - .pwrTableOffset = AR9300_PWR_TABLE_OFFSET, - .params_for_tuning_caps = {0, 0}, - .featureEnable = 0x0d, - /* - * bit0 - enable tx temp comp - disabled - * bit1 - enable tx volt comp - disabled - * bit2 - enable fastClock - enabled - * bit3 - enable doubling - enabled - * bit4 - enable internal regulator - disabled - * bit5 - enable pa predistortion - disabled - */ - .miscConfiguration = 0, /* bit0 - turn down drivestrength */ - .eepromWriteEnableGpio = 6, - .wlanDisableGpio = 0, - .wlanLedGpio = 8, - .rxBandSelectGpio = 0xff, - .txrxgain = 0x10, - .swreg = 0, - }, - .modalHeader2G = { - /* ar9300_modal_eep_header 2g */ - /* 4 idle,t1,t2,b(4 bits per setting) */ - .antCtrlCommon = LE32(0x110), - /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */ - .antCtrlCommon2 = LE32(0x44444), - - /* - * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r, - * rx1, rx12, b (2 bits each) - */ - .antCtrlChain = { LE16(0x10), LE16(0x10), LE16(0x10) }, - - /* - * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db - * for ar9280 (0xa20c/b20c 5:0) - */ - .xatten1DB = {0x1f, 0x1f, 0x1f}, - - /* - * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin - * for ar9280 (0xa20c/b20c 16:12 - */ - .xatten1Margin = {0x12, 0x12, 0x12}, - .tempSlope = 25, - .voltSlope = 0, - - /* - * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur - * channels in usual fbin coding format - */ - .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0}, - - /* - * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check - * if the register is per chain - */ - .noiseFloorThreshCh = {-1, 0, 0}, - .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .quick_drop = 0, - .xpaBiasLvl = 0, - .txFrameToDataStart = 0x0e, - .txFrameToPaOn = 0x0e, - .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */ - .antennaGain = 0, - .switchSettling = 0x2c, - .adcDesiredSize = -30, - .txEndToXpaOff = 0, - .txEndToRxOn = 0x2, - .txFrameToXpaOn = 0xe, - .thresh62 = 28, - .papdRateMaskHt20 = LE32(0x0c80C080), - .papdRateMaskHt40 = LE32(0x0080C080), - .xlna_bias_strength = 0, - .futureModal = { - 0, 0, 0, 0, 0, 0, 0, - }, - }, - .base_ext1 = { - .ant_div_control = 0, - .future = {0, 0, 0}, - .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0} - }, - .calFreqPier2G = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2462, 1), - }, - /* ar9300_cal_data_per_freq_op_loop 2g */ - .calPierData2G = { - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} }, - }, - .calTarget_freqbin_Cck = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2472, 1), - }, - .calTarget_freqbin_2G = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTarget_freqbin_2GHT20 = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTarget_freqbin_2GHT40 = { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2437, 1), - FREQ2FBIN(2472, 1) - }, - .calTargetPowerCck = { - /* 1L-5L,5S,11L,11S */ - { {34, 34, 34, 34} }, - { {34, 34, 34, 34} }, - }, - .calTargetPower2G = { - /* 6-24,36,48,54 */ - { {34, 34, 32, 32} }, - { {34, 34, 32, 32} }, - { {34, 34, 32, 32} }, - }, - .calTargetPower2GHT20 = { - { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} }, - { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} }, - { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} }, - }, - .calTargetPower2GHT40 = { - { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} }, - { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} }, - { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} }, - }, - .ctlIndex_2G = { - 0x11, 0x12, 0x15, 0x17, 0x41, 0x42, - 0x45, 0x47, 0x31, 0x32, 0x35, 0x37, - }, - .ctl_freqbin_2G = { - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2457, 1), - FREQ2FBIN(2462, 1) - }, - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2462, 1), - 0xFF, - }, - - { - FREQ2FBIN(2412, 1), - FREQ2FBIN(2417, 1), - FREQ2FBIN(2462, 1), - 0xFF, - }, - { - FREQ2FBIN(2422, 1), - FREQ2FBIN(2427, 1), - FREQ2FBIN(2447, 1), - FREQ2FBIN(2452, 1) - }, - - { - /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1), - }, - - { - /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - 0, - }, - - { - /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - FREQ2FBIN(2472, 1), - 0, - }, - - { - /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1), - /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1), - /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1), - /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1), - }, - - { - /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - }, - - { - /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - 0 - }, - - { - /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1), - /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1), - /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1), - 0 - }, - - { - /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1), - /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1), - /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1), - /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1), - } - }, - .ctlPowerData_2G = { - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, - - { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - - { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, - { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, - }, - .modalHeader5G = { - /* 4 idle,t1,t2,b (4 bits per setting) */ - .antCtrlCommon = LE32(0x220), - /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */ - .antCtrlCommon2 = LE32(0x44444), - /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */ - .antCtrlChain = { - LE16(0x150), LE16(0x150), LE16(0x150), - }, - /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */ - .xatten1DB = {0x19, 0x19, 0x19}, - - /* - * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin - * for merlin (0xa20c/b20c 16:12 - */ - .xatten1Margin = {0x14, 0x14, 0x14}, - .tempSlope = 70, - .voltSlope = 0, - /* spurChans spur channels in usual fbin coding format */ - .spurChans = {0, 0, 0, 0, 0}, - /* noiseFloorThreshCh Check if the register is per chain */ - .noiseFloorThreshCh = {-1, 0, 0}, - .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .quick_drop = 0, - .xpaBiasLvl = 0, - .txFrameToDataStart = 0x0e, - .txFrameToPaOn = 0x0e, - .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */ - .antennaGain = 0, - .switchSettling = 0x2d, - .adcDesiredSize = -30, - .txEndToXpaOff = 0, - .txEndToRxOn = 0x2, - .txFrameToXpaOn = 0xe, - .thresh62 = 28, - .papdRateMaskHt20 = LE32(0x0cf0e0e0), - .papdRateMaskHt40 = LE32(0x6cf0e0e0), - .xlna_bias_strength = 0, - .futureModal = { - 0, 0, 0, 0, 0, 0, 0, - }, - }, - .base_ext2 = { - .tempSlopeLow = 35, - .tempSlopeHigh = 50, - .xatten1DBLow = {0, 0, 0}, - .xatten1MarginLow = {0, 0, 0}, - .xatten1DBHigh = {0, 0, 0}, - .xatten1MarginHigh = {0, 0, 0} - }, - .calFreqPier5G = { - FREQ2FBIN(5160, 0), - FREQ2FBIN(5220, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5600, 0), - FREQ2FBIN(5700, 0), - FREQ2FBIN(5785, 0) - }, - .calPierData5G = { - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - { - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0}, - }, - - }, - .calTarget_freqbin_5G = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5240, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5600, 0), - FREQ2FBIN(5700, 0), - FREQ2FBIN(5825, 0) - }, - .calTarget_freqbin_5GHT20 = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5240, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5700, 0), - FREQ2FBIN(5745, 0), - FREQ2FBIN(5825, 0) - }, - .calTarget_freqbin_5GHT40 = { - FREQ2FBIN(5180, 0), - FREQ2FBIN(5240, 0), - FREQ2FBIN(5320, 0), - FREQ2FBIN(5400, 0), - FREQ2FBIN(5500, 0), - FREQ2FBIN(5700, 0), - FREQ2FBIN(5745, 0), - FREQ2FBIN(5825, 0) - }, - .calTargetPower5G = { - /* 6-24,36,48,54 */ - { {30, 30, 28, 24} }, - { {30, 30, 28, 24} }, - { {30, 30, 28, 24} }, - { {30, 30, 28, 24} }, - { {30, 30, 28, 24} }, - { {30, 30, 28, 24} }, - { {30, 30, 28, 24} }, - { {30, 30, 28, 24} }, - }, - .calTargetPower5GHT20 = { - /* - * 0_8_16,1-3_9-11_17-19, - * 4,5,6,7,12,13,14,15,20,21,22,23 - */ - { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 0, 0, 0, 0} }, - { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 0, 0, 0, 0} }, - { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 0, 0, 0, 0} }, - { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 0, 0, 0, 0} }, - { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 0, 0, 0, 0} }, - { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 0, 0, 0, 0} }, - { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 0, 0, 0, 0} }, - { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 0, 0, 0, 0} }, - }, - .calTargetPower5GHT40 = { - /* - * 0_8_16,1-3_9-11_17-19, - * 4,5,6,7,12,13,14,15,20,21,22,23 - */ - { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 0, 0, 0, 0} }, - { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 0, 0, 0, 0} }, - { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 0, 0, 0, 0} }, - { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 0, 0, 0, 0} }, - { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 0, 0, 0, 0} }, - { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 0, 0, 0, 0} }, - { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 0, 0, 0, 0} }, - { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 0, 0, 0, 0} }, - }, - .ctlIndex_5G = { - 0x10, 0x16, 0x18, 0x40, 0x46, - 0x48, 0x30, 0x36, 0x38 - }, - .ctl_freqbin_5G = { - { - /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0), - /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0), - /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0), - /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0), - /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0) - }, - { - /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0), - /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0), - /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0), - /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0), - /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0) - }, - - { - /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0), - /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0), - /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0), - /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0), - /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0), - /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0), - /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0), - /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0) - }, - - { - /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0), - /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0), - /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0), - /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0), - /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[3].ctlEdges[6].bChannel */ 0xFF, - /* Data[3].ctlEdges[7].bChannel */ 0xFF, - }, - - { - /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0), - /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0), - /* Data[4].ctlEdges[4].bChannel */ 0xFF, - /* Data[4].ctlEdges[5].bChannel */ 0xFF, - /* Data[4].ctlEdges[6].bChannel */ 0xFF, - /* Data[4].ctlEdges[7].bChannel */ 0xFF, - }, - - { - /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0), - /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0), - /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0), - /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0), - /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0), - /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0), - /* Data[5].ctlEdges[6].bChannel */ 0xFF, - /* Data[5].ctlEdges[7].bChannel */ 0xFF - }, - - { - /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0), - /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0), - /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0), - /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0), - /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0), - /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0), - /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0) - }, - - { - /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0), - /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0), - /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0), - /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0), - /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0), - /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0), - /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0), - /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0) - }, - - { - /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0), - /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0), - /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0), - /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0), - /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0), - /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0), - /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0), - /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0) - } - }, - .ctlPowerData_5G = { - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - } - }, - { - { - CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0), - CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - } - }, - { - { - CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { - CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1), - CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), - } - }, - } -}; - - -static const struct ar9300_eeprom *ar9300_eep_templates[] = { - &ar9300_default, - &ar9300_x112, - &ar9300_h116, - &ar9300_h112, - &ar9300_x113, -}; - -static const struct ar9300_eeprom *ar9003_eeprom_struct_find_by_id(int id) -{ -#define N_LOOP (sizeof(ar9300_eep_templates) / sizeof(ar9300_eep_templates[0])) - int it; - - for (it = 0; it < N_LOOP; it++) - if (ar9300_eep_templates[it]->templateVersion == id) - return ar9300_eep_templates[it]; - return NULL; -#undef N_LOOP -} - -static int ath9k_hw_ar9300_check_eeprom(struct ath_hw *ah) -{ - return 0; -} - -static int interpolate(int x, int xa, int xb, int ya, int yb) -{ - int bf, factor, plus; - - bf = 2 * (yb - ya) * (x - xa) / (xb - xa); - factor = bf / 2; - plus = bf % 2; - return ya + factor + plus; -} - -static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah, - enum eeprom_param param) -{ - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader; - - switch (param) { - case EEP_MAC_LSW: - return get_unaligned_be16(eep->macAddr); - case EEP_MAC_MID: - return get_unaligned_be16(eep->macAddr + 2); - case EEP_MAC_MSW: - return get_unaligned_be16(eep->macAddr + 4); - case EEP_REG_0: - return le16_to_cpu(pBase->regDmn[0]); - case EEP_OP_CAP: - return pBase->deviceCap; - case EEP_OP_MODE: - return pBase->opCapFlags.opFlags; - case EEP_RF_SILENT: - return pBase->rfSilent; - case EEP_TX_MASK: - return (pBase->txrxMask >> 4) & 0xf; - case EEP_RX_MASK: - return pBase->txrxMask & 0xf; - case EEP_PAPRD: - return !!(pBase->featureEnable & BIT(5)); - case EEP_CHAIN_MASK_REDUCE: - return (pBase->miscConfiguration >> 0x3) & 0x1; - case EEP_ANT_DIV_CTL1: - return eep->base_ext1.ant_div_control; - case EEP_ANTENNA_GAIN_5G: - return eep->modalHeader5G.antennaGain; - case EEP_ANTENNA_GAIN_2G: - return eep->modalHeader2G.antennaGain; - default: - return 0; - } -} - -static bool ar9300_eeprom_read_byte(struct ath_hw *ah, int address, - u8 *buffer) -{ - u16 val; - - if (unlikely(!ath9k_hw_nvram_read(ah, address / 2, &val))) - return false; - - *buffer = (val >> (8 * (address % 2))) & 0xff; - return true; -} - -static bool ar9300_eeprom_read_word(struct ath_hw *ah, int address, - u8 *buffer) -{ - u16 val; - - if (unlikely(!ath9k_hw_nvram_read(ah, address / 2, &val))) - return false; - - buffer[0] = val >> 8; - buffer[1] = val & 0xff; - - return true; -} - -static bool ar9300_read_eeprom(struct ath_hw *ah, int address, u8 *buffer, - int count) -{ - struct ath_common *common = ath9k_hw_common(ah); - int i; - - if ((address < 0) || ((address + count) / 2 > AR9300_EEPROM_SIZE - 1)) { - ath_dbg(common, EEPROM, "eeprom address not in range\n"); - return false; - } - - /* - * Since we're reading the bytes in reverse order from a little-endian - * word stream, an even address means we only use the lower half of - * the 16-bit word at that address - */ - if (address % 2 == 0) { - if (!ar9300_eeprom_read_byte(ah, address--, buffer++)) - goto error; - - count--; - } - - for (i = 0; i < count / 2; i++) { - if (!ar9300_eeprom_read_word(ah, address, buffer)) - goto error; - - address -= 2; - buffer += 2; - } - - if (count % 2) - if (!ar9300_eeprom_read_byte(ah, address, buffer)) - goto error; - - return true; - -error: - ath_dbg(common, EEPROM, "unable to read eeprom region at offset %d\n", - address); - return false; -} - -static bool ar9300_otp_read_word(struct ath_hw *ah, int addr, u32 *data) -{ - REG_READ(ah, AR9300_OTP_BASE + (4 * addr)); - - if (!ath9k_hw_wait(ah, AR9300_OTP_STATUS, AR9300_OTP_STATUS_TYPE, - AR9300_OTP_STATUS_VALID, 1000)) - return false; - - *data = REG_READ(ah, AR9300_OTP_READ_DATA); - return true; -} - -static bool ar9300_read_otp(struct ath_hw *ah, int address, u8 *buffer, - int count) -{ - u32 data; - int i; - - for (i = 0; i < count; i++) { - int offset = 8 * ((address - i) % 4); - if (!ar9300_otp_read_word(ah, (address - i) / 4, &data)) - return false; - - buffer[i] = (data >> offset) & 0xff; - } - - return true; -} - - -static void ar9300_comp_hdr_unpack(u8 *best, int *code, int *reference, - int *length, int *major, int *minor) -{ - unsigned long value[4]; - - value[0] = best[0]; - value[1] = best[1]; - value[2] = best[2]; - value[3] = best[3]; - *code = ((value[0] >> 5) & 0x0007); - *reference = (value[0] & 0x001f) | ((value[1] >> 2) & 0x0020); - *length = ((value[1] << 4) & 0x07f0) | ((value[2] >> 4) & 0x000f); - *major = (value[2] & 0x000f); - *minor = (value[3] & 0x00ff); -} - -static u16 ar9300_comp_cksum(u8 *data, int dsize) -{ - int it, checksum = 0; - - for (it = 0; it < dsize; it++) { - checksum += data[it]; - checksum &= 0xffff; - } - - return checksum; -} - -static bool ar9300_uncompress_block(struct ath_hw *ah, - u8 *mptr, - int mdataSize, - u8 *block, - int size) -{ - int it; - int spot; - int offset; - int length; - struct ath_common *common = ath9k_hw_common(ah); - - spot = 0; - - for (it = 0; it < size; it += (length+2)) { - offset = block[it]; - offset &= 0xff; - spot += offset; - length = block[it+1]; - length &= 0xff; - - if (length > 0 && spot >= 0 && spot+length <= mdataSize) { - ath_dbg(common, EEPROM, - "Restore at %d: spot=%d offset=%d length=%d\n", - it, spot, offset, length); - memcpy(&mptr[spot], &block[it+2], length); - spot += length; - } else if (length > 0) { - ath_dbg(common, EEPROM, - "Bad restore at %d: spot=%d offset=%d length=%d\n", - it, spot, offset, length); - return false; - } - } - return true; -} - -static int ar9300_compress_decision(struct ath_hw *ah, - int it, - int code, - int reference, - u8 *mptr, - u8 *word, int length, int mdata_size) -{ - struct ath_common *common = ath9k_hw_common(ah); - const struct ar9300_eeprom *eep = NULL; - - switch (code) { - case _CompressNone: - if (length != mdata_size) { - ath_dbg(common, EEPROM, - "EEPROM structure size mismatch memory=%d eeprom=%d\n", - mdata_size, length); - return -1; - } - memcpy(mptr, word + COMP_HDR_LEN, length); - ath_dbg(common, EEPROM, - "restored eeprom %d: uncompressed, length %d\n", - it, length); - break; - case _CompressBlock: - if (reference == 0) { - } else { - eep = ar9003_eeprom_struct_find_by_id(reference); - if (eep == NULL) { - ath_dbg(common, EEPROM, - "can't find reference eeprom struct %d\n", - reference); - return -1; - } - memcpy(mptr, eep, mdata_size); - } - ath_dbg(common, EEPROM, - "restore eeprom %d: block, reference %d, length %d\n", - it, reference, length); - ar9300_uncompress_block(ah, mptr, mdata_size, - (word + COMP_HDR_LEN), length); - break; - default: - ath_dbg(common, EEPROM, "unknown compression code %d\n", code); - return -1; - } - return 0; -} - -typedef bool (*eeprom_read_op)(struct ath_hw *ah, int address, u8 *buffer, - int count); - -static bool ar9300_check_header(void *data) -{ - u32 *word = data; - return !(*word == 0 || *word == ~0); -} - -static bool ar9300_check_eeprom_header(struct ath_hw *ah, eeprom_read_op read, - int base_addr) -{ - u8 header[4]; - - if (!read(ah, base_addr, header, 4)) - return false; - - return ar9300_check_header(header); -} - -static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr, - int mdata_size) -{ - u16 *data = (u16 *) mptr; - int i; - - for (i = 0; i < mdata_size / 2; i++, data++) - ath9k_hw_nvram_read(ah, i, data); - - return 0; -} -/* - * Read the configuration data from the eeprom. - * The data can be put in any specified memory buffer. - * - * Returns -1 on error. - * Returns address of next memory location on success. - */ -static int ar9300_eeprom_restore_internal(struct ath_hw *ah, - u8 *mptr, int mdata_size) -{ -#define MDEFAULT 15 -#define MSTATE 100 - int cptr; - u8 *word; - int code; - int reference, length, major, minor; - int osize; - int it; - u16 checksum, mchecksum; - struct ath_common *common = ath9k_hw_common(ah); - struct ar9300_eeprom *eep; - eeprom_read_op read; - - if (ath9k_hw_use_flash(ah)) { - u8 txrx; - - ar9300_eeprom_restore_flash(ah, mptr, mdata_size); - - /* check if eeprom contains valid data */ - eep = (struct ar9300_eeprom *) mptr; - txrx = eep->baseEepHeader.txrxMask; - if (txrx != 0 && txrx != 0xff) - return 0; - } - - word = kzalloc(2048, GFP_KERNEL); - if (!word) - return -ENOMEM; - - memcpy(mptr, &ar9300_default, mdata_size); - - read = ar9300_read_eeprom; - if (AR_SREV_9485(ah)) - cptr = AR9300_BASE_ADDR_4K; - else if (AR_SREV_9330(ah)) - cptr = AR9300_BASE_ADDR_512; - else - cptr = AR9300_BASE_ADDR; - ath_dbg(common, EEPROM, "Trying EEPROM access at Address 0x%04x\n", - cptr); - if (ar9300_check_eeprom_header(ah, read, cptr)) - goto found; - - cptr = AR9300_BASE_ADDR_512; - ath_dbg(common, EEPROM, "Trying EEPROM access at Address 0x%04x\n", - cptr); - if (ar9300_check_eeprom_header(ah, read, cptr)) - goto found; - - read = ar9300_read_otp; - cptr = AR9300_BASE_ADDR; - ath_dbg(common, EEPROM, "Trying OTP access at Address 0x%04x\n", cptr); - if (ar9300_check_eeprom_header(ah, read, cptr)) - goto found; - - cptr = AR9300_BASE_ADDR_512; - ath_dbg(common, EEPROM, "Trying OTP access at Address 0x%04x\n", cptr); - if (ar9300_check_eeprom_header(ah, read, cptr)) - goto found; - - goto fail; - -found: - ath_dbg(common, EEPROM, "Found valid EEPROM data\n"); - - for (it = 0; it < MSTATE; it++) { - if (!read(ah, cptr, word, COMP_HDR_LEN)) - goto fail; - - if (!ar9300_check_header(word)) - break; - - ar9300_comp_hdr_unpack(word, &code, &reference, - &length, &major, &minor); - ath_dbg(common, EEPROM, - "Found block at %x: code=%d ref=%d length=%d major=%d minor=%d\n", - cptr, code, reference, length, major, minor); - if ((!AR_SREV_9485(ah) && length >= 1024) || - (AR_SREV_9485(ah) && length > EEPROM_DATA_LEN_9485)) { - ath_dbg(common, EEPROM, "Skipping bad header\n"); - cptr -= COMP_HDR_LEN; - continue; - } - - osize = length; - read(ah, cptr, word, COMP_HDR_LEN + osize + COMP_CKSUM_LEN); - checksum = ar9300_comp_cksum(&word[COMP_HDR_LEN], length); - mchecksum = get_unaligned_le16(&word[COMP_HDR_LEN + osize]); - ath_dbg(common, EEPROM, "checksum %x %x\n", - checksum, mchecksum); - if (checksum == mchecksum) { - ar9300_compress_decision(ah, it, code, reference, mptr, - word, length, mdata_size); - } else { - ath_dbg(common, EEPROM, - "skipping block with bad checksum\n"); - } - cptr -= (COMP_HDR_LEN + osize + COMP_CKSUM_LEN); - } - - kfree(word); - return cptr; - -fail: - kfree(word); - return -1; -} - -/* - * Restore the configuration structure by reading the eeprom. - * This function destroys any existing in-memory structure - * content. - */ -static bool ath9k_hw_ar9300_fill_eeprom(struct ath_hw *ah) -{ - u8 *mptr = (u8 *) &ah->eeprom.ar9300_eep; - - if (ar9300_eeprom_restore_internal(ah, mptr, - sizeof(struct ar9300_eeprom)) < 0) - return false; - - return true; -} - -#if defined(CONFIG_ATH9K_DEBUGFS) || defined(CONFIG_ATH9K_HTC_DEBUGFS) -static u32 ar9003_dump_modal_eeprom(char *buf, u32 len, u32 size, - struct ar9300_modal_eep_header *modal_hdr) -{ - PR_EEP("Chain0 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[0])); - PR_EEP("Chain1 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[1])); - PR_EEP("Chain2 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[2])); - PR_EEP("Ant. Common Control", le32_to_cpu(modal_hdr->antCtrlCommon)); - PR_EEP("Ant. Common Control2", le32_to_cpu(modal_hdr->antCtrlCommon2)); - PR_EEP("Ant. Gain", modal_hdr->antennaGain); - PR_EEP("Switch Settle", modal_hdr->switchSettling); - PR_EEP("Chain0 xatten1DB", modal_hdr->xatten1DB[0]); - PR_EEP("Chain1 xatten1DB", modal_hdr->xatten1DB[1]); - PR_EEP("Chain2 xatten1DB", modal_hdr->xatten1DB[2]); - PR_EEP("Chain0 xatten1Margin", modal_hdr->xatten1Margin[0]); - PR_EEP("Chain1 xatten1Margin", modal_hdr->xatten1Margin[1]); - PR_EEP("Chain2 xatten1Margin", modal_hdr->xatten1Margin[2]); - PR_EEP("Temp Slope", modal_hdr->tempSlope); - PR_EEP("Volt Slope", modal_hdr->voltSlope); - PR_EEP("spur Channels0", modal_hdr->spurChans[0]); - PR_EEP("spur Channels1", modal_hdr->spurChans[1]); - PR_EEP("spur Channels2", modal_hdr->spurChans[2]); - PR_EEP("spur Channels3", modal_hdr->spurChans[3]); - PR_EEP("spur Channels4", modal_hdr->spurChans[4]); - PR_EEP("Chain0 NF Threshold", modal_hdr->noiseFloorThreshCh[0]); - PR_EEP("Chain1 NF Threshold", modal_hdr->noiseFloorThreshCh[1]); - PR_EEP("Chain2 NF Threshold", modal_hdr->noiseFloorThreshCh[2]); - PR_EEP("Quick Drop", modal_hdr->quick_drop); - PR_EEP("txEndToXpaOff", modal_hdr->txEndToXpaOff); - PR_EEP("xPA Bias Level", modal_hdr->xpaBiasLvl); - PR_EEP("txFrameToDataStart", modal_hdr->txFrameToDataStart); - PR_EEP("txFrameToPaOn", modal_hdr->txFrameToPaOn); - PR_EEP("txFrameToXpaOn", modal_hdr->txFrameToXpaOn); - PR_EEP("txClip", modal_hdr->txClip); - PR_EEP("ADC Desired size", modal_hdr->adcDesiredSize); - - return len; -} - -static u32 ath9k_hw_ar9003_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr, - u8 *buf, u32 len, u32 size) -{ - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - struct ar9300_base_eep_hdr *pBase; - - if (!dump_base_hdr) { - len += snprintf(buf + len, size - len, - "%20s :\n", "2GHz modal Header"); - len = ar9003_dump_modal_eeprom(buf, len, size, - &eep->modalHeader2G); - len += snprintf(buf + len, size - len, - "%20s :\n", "5GHz modal Header"); - len = ar9003_dump_modal_eeprom(buf, len, size, - &eep->modalHeader5G); - goto out; - } - - pBase = &eep->baseEepHeader; - - PR_EEP("EEPROM Version", ah->eeprom.ar9300_eep.eepromVersion); - PR_EEP("RegDomain1", le16_to_cpu(pBase->regDmn[0])); - PR_EEP("RegDomain2", le16_to_cpu(pBase->regDmn[1])); - PR_EEP("TX Mask", (pBase->txrxMask >> 4)); - PR_EEP("RX Mask", (pBase->txrxMask & 0x0f)); - PR_EEP("Allow 5GHz", !!(pBase->opCapFlags.opFlags & - AR5416_OPFLAGS_11A)); - PR_EEP("Allow 2GHz", !!(pBase->opCapFlags.opFlags & - AR5416_OPFLAGS_11G)); - PR_EEP("Disable 2GHz HT20", !!(pBase->opCapFlags.opFlags & - AR5416_OPFLAGS_N_2G_HT20)); - PR_EEP("Disable 2GHz HT40", !!(pBase->opCapFlags.opFlags & - AR5416_OPFLAGS_N_2G_HT40)); - PR_EEP("Disable 5Ghz HT20", !!(pBase->opCapFlags.opFlags & - AR5416_OPFLAGS_N_5G_HT20)); - PR_EEP("Disable 5Ghz HT40", !!(pBase->opCapFlags.opFlags & - AR5416_OPFLAGS_N_5G_HT40)); - PR_EEP("Big Endian", !!(pBase->opCapFlags.eepMisc & 0x01)); - PR_EEP("RF Silent", pBase->rfSilent); - PR_EEP("BT option", pBase->blueToothOptions); - PR_EEP("Device Cap", pBase->deviceCap); - PR_EEP("Device Type", pBase->deviceType); - PR_EEP("Power Table Offset", pBase->pwrTableOffset); - PR_EEP("Tuning Caps1", pBase->params_for_tuning_caps[0]); - PR_EEP("Tuning Caps2", pBase->params_for_tuning_caps[1]); - PR_EEP("Enable Tx Temp Comp", !!(pBase->featureEnable & BIT(0))); - PR_EEP("Enable Tx Volt Comp", !!(pBase->featureEnable & BIT(1))); - PR_EEP("Enable fast clock", !!(pBase->featureEnable & BIT(2))); - PR_EEP("Enable doubling", !!(pBase->featureEnable & BIT(3))); - PR_EEP("Internal regulator", !!(pBase->featureEnable & BIT(4))); - PR_EEP("Enable Paprd", !!(pBase->featureEnable & BIT(5))); - PR_EEP("Driver Strength", !!(pBase->miscConfiguration & BIT(0))); - PR_EEP("Quick Drop", !!(pBase->miscConfiguration & BIT(1))); - PR_EEP("Chain mask Reduce", (pBase->miscConfiguration >> 0x3) & 0x1); - PR_EEP("Write enable Gpio", pBase->eepromWriteEnableGpio); - PR_EEP("WLAN Disable Gpio", pBase->wlanDisableGpio); - PR_EEP("WLAN LED Gpio", pBase->wlanLedGpio); - PR_EEP("Rx Band Select Gpio", pBase->rxBandSelectGpio); - PR_EEP("Tx Gain", pBase->txrxgain >> 4); - PR_EEP("Rx Gain", pBase->txrxgain & 0xf); - PR_EEP("SW Reg", le32_to_cpu(pBase->swreg)); - - len += snprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress", - ah->eeprom.ar9300_eep.macAddr); -out: - if (len > size) - len = size; - - return len; -} -#else -static u32 ath9k_hw_ar9003_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr, - u8 *buf, u32 len, u32 size) -{ - return 0; -} -#endif - -/* XXX: review hardware docs */ -static int ath9k_hw_ar9300_get_eeprom_ver(struct ath_hw *ah) -{ - return ah->eeprom.ar9300_eep.eepromVersion; -} - -/* XXX: could be read from the eepromVersion, not sure yet */ -static int ath9k_hw_ar9300_get_eeprom_rev(struct ath_hw *ah) -{ - return 0; -} - -static struct ar9300_modal_eep_header *ar9003_modal_header(struct ath_hw *ah, - bool is2ghz) -{ - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - - if (is2ghz) - return &eep->modalHeader2G; - else - return &eep->modalHeader5G; -} - -static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz) -{ - int bias = ar9003_modal_header(ah, is2ghz)->xpaBiasLvl; - - if (AR_SREV_9485(ah) || AR_SREV_9330(ah) || AR_SREV_9340(ah)) - REG_RMW_FIELD(ah, AR_CH0_TOP2, AR_CH0_TOP2_XPABIASLVL, bias); - else if (AR_SREV_9462(ah) || AR_SREV_9550(ah) || AR_SREV_9565(ah)) - REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias); - else { - REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias); - REG_RMW_FIELD(ah, AR_CH0_THERM, - AR_CH0_THERM_XPABIASLVL_MSB, - bias >> 2); - REG_RMW_FIELD(ah, AR_CH0_THERM, - AR_CH0_THERM_XPASHORT2GND, 1); - } -} - -static u16 ar9003_switch_com_spdt_get(struct ath_hw *ah, bool is2ghz) -{ - return le16_to_cpu(ar9003_modal_header(ah, is2ghz)->switchcomspdt); -} - - -static u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz) -{ - return le32_to_cpu(ar9003_modal_header(ah, is2ghz)->antCtrlCommon); -} - -static u32 ar9003_hw_ant_ctrl_common_2_get(struct ath_hw *ah, bool is2ghz) -{ - return le32_to_cpu(ar9003_modal_header(ah, is2ghz)->antCtrlCommon2); -} - -static u16 ar9003_hw_ant_ctrl_chain_get(struct ath_hw *ah, int chain, - bool is2ghz) -{ - __le16 val = ar9003_modal_header(ah, is2ghz)->antCtrlChain[chain]; - return le16_to_cpu(val); -} - -static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz) -{ - struct ath9k_hw_capabilities *pCap = &ah->caps; - int chain; - u32 regval, value; - static const u32 switch_chain_reg[AR9300_MAX_CHAINS] = { - AR_PHY_SWITCH_CHAIN_0, - AR_PHY_SWITCH_CHAIN_1, - AR_PHY_SWITCH_CHAIN_2, - }; - - if (AR_SREV_9485(ah) && (ar9003_hw_get_rx_gain_idx(ah) == 0)) - ath9k_hw_cfg_output(ah, AR9300_EXT_LNA_CTL_GPIO_AR9485, - AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED); - - value = ar9003_hw_ant_ctrl_common_get(ah, is2ghz); - - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) { - REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM, - AR_SWITCH_TABLE_COM_AR9462_ALL, value); - } else if (AR_SREV_9550(ah)) { - REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM, - AR_SWITCH_TABLE_COM_AR9550_ALL, value); - } else - REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM, - AR_SWITCH_TABLE_COM_ALL, value); - - - /* - * AR9462 defines new switch table for BT/WLAN, - * here's new field name in XXX.ref for both 2G and 5G. - * Register: [GLB_CONTROL] GLB_CONTROL (@0x20044) - * 15:12 R/W SWITCH_TABLE_COM_SPDT_WLAN_RX - * SWITCH_TABLE_COM_SPDT_WLAN_RX - * - * 11:8 R/W SWITCH_TABLE_COM_SPDT_WLAN_TX - * SWITCH_TABLE_COM_SPDT_WLAN_TX - * - * 7:4 R/W SWITCH_TABLE_COM_SPDT_WLAN_IDLE - * SWITCH_TABLE_COM_SPDT_WLAN_IDLE - */ - if (AR_SREV_9462_20(ah) || AR_SREV_9565(ah)) { - value = ar9003_switch_com_spdt_get(ah, is2ghz); - REG_RMW_FIELD(ah, AR_PHY_GLB_CONTROL, - AR_SWITCH_TABLE_COM_SPDT_ALL, value); - REG_SET_BIT(ah, AR_PHY_GLB_CONTROL, AR_BTCOEX_CTRL_SPDT_ENABLE); - } - - value = ar9003_hw_ant_ctrl_common_2_get(ah, is2ghz); - REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM_2, AR_SWITCH_TABLE_COM2_ALL, value); - - if ((AR_SREV_9462(ah)) && (ah->rxchainmask == 0x2)) { - value = ar9003_hw_ant_ctrl_chain_get(ah, 1, is2ghz); - REG_RMW_FIELD(ah, switch_chain_reg[0], - AR_SWITCH_TABLE_ALL, value); - } - - for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { - if ((ah->rxchainmask & BIT(chain)) || - (ah->txchainmask & BIT(chain))) { - value = ar9003_hw_ant_ctrl_chain_get(ah, chain, - is2ghz); - REG_RMW_FIELD(ah, switch_chain_reg[chain], - AR_SWITCH_TABLE_ALL, value); - } - } - - if (AR_SREV_9330(ah) || AR_SREV_9485(ah) || AR_SREV_9565(ah)) { - value = ath9k_hw_ar9300_get_eeprom(ah, EEP_ANT_DIV_CTL1); - /* - * main_lnaconf, alt_lnaconf, main_tb, alt_tb - * are the fields present - */ - regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL); - regval &= (~AR_ANT_DIV_CTRL_ALL); - regval |= (value & 0x3f) << AR_ANT_DIV_CTRL_ALL_S; - /* enable_lnadiv */ - regval &= (~AR_PHY_ANT_DIV_LNADIV); - regval |= ((value >> 6) & 0x1) << AR_PHY_ANT_DIV_LNADIV_S; - - if (AR_SREV_9565(ah)) { - if (ah->shared_chain_lnadiv) { - regval |= (1 << AR_PHY_ANT_SW_RX_PROT_S); - } else { - regval &= ~(1 << AR_PHY_ANT_DIV_LNADIV_S); - regval &= ~(1 << AR_PHY_ANT_SW_RX_PROT_S); - } - } - - REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval); - - /*enable fast_div */ - regval = REG_READ(ah, AR_PHY_CCK_DETECT); - regval &= (~AR_FAST_DIV_ENABLE); - regval |= ((value >> 7) & 0x1) << AR_FAST_DIV_ENABLE_S; - REG_WRITE(ah, AR_PHY_CCK_DETECT, regval); - - if (pCap->hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) { - regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL); - /* - * clear bits 25-30 main_lnaconf, alt_lnaconf, - * main_tb, alt_tb - */ - regval &= (~(AR_PHY_ANT_DIV_MAIN_LNACONF | - AR_PHY_ANT_DIV_ALT_LNACONF | - AR_PHY_ANT_DIV_ALT_GAINTB | - AR_PHY_ANT_DIV_MAIN_GAINTB)); - /* by default use LNA1 for the main antenna */ - regval |= (AR_PHY_ANT_DIV_LNA1 << - AR_PHY_ANT_DIV_MAIN_LNACONF_S); - regval |= (AR_PHY_ANT_DIV_LNA2 << - AR_PHY_ANT_DIV_ALT_LNACONF_S); - REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval); - } - } -} - -static void ar9003_hw_drive_strength_apply(struct ath_hw *ah) -{ - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader; - int drive_strength; - unsigned long reg; - - drive_strength = pBase->miscConfiguration & BIT(0); - if (!drive_strength) - return; - - reg = REG_READ(ah, AR_PHY_65NM_CH0_BIAS1); - reg &= ~0x00ffffc0; - reg |= 0x5 << 21; - reg |= 0x5 << 18; - reg |= 0x5 << 15; - reg |= 0x5 << 12; - reg |= 0x5 << 9; - reg |= 0x5 << 6; - REG_WRITE(ah, AR_PHY_65NM_CH0_BIAS1, reg); - - reg = REG_READ(ah, AR_PHY_65NM_CH0_BIAS2); - reg &= ~0xffffffe0; - reg |= 0x5 << 29; - reg |= 0x5 << 26; - reg |= 0x5 << 23; - reg |= 0x5 << 20; - reg |= 0x5 << 17; - reg |= 0x5 << 14; - reg |= 0x5 << 11; - reg |= 0x5 << 8; - reg |= 0x5 << 5; - REG_WRITE(ah, AR_PHY_65NM_CH0_BIAS2, reg); - - reg = REG_READ(ah, AR_PHY_65NM_CH0_BIAS4); - reg &= ~0xff800000; - reg |= 0x5 << 29; - reg |= 0x5 << 26; - reg |= 0x5 << 23; - REG_WRITE(ah, AR_PHY_65NM_CH0_BIAS4, reg); -} - -static u16 ar9003_hw_atten_chain_get(struct ath_hw *ah, int chain, - struct ath9k_channel *chan) -{ - int f[3], t[3]; - u16 value; - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - - if (chain >= 0 && chain < 3) { - if (IS_CHAN_2GHZ(chan)) - return eep->modalHeader2G.xatten1DB[chain]; - else if (eep->base_ext2.xatten1DBLow[chain] != 0) { - t[0] = eep->base_ext2.xatten1DBLow[chain]; - f[0] = 5180; - t[1] = eep->modalHeader5G.xatten1DB[chain]; - f[1] = 5500; - t[2] = eep->base_ext2.xatten1DBHigh[chain]; - f[2] = 5785; - value = ar9003_hw_power_interpolate((s32) chan->channel, - f, t, 3); - return value; - } else - return eep->modalHeader5G.xatten1DB[chain]; - } - - return 0; -} - - -static u16 ar9003_hw_atten_chain_get_margin(struct ath_hw *ah, int chain, - struct ath9k_channel *chan) -{ - int f[3], t[3]; - u16 value; - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - - if (chain >= 0 && chain < 3) { - if (IS_CHAN_2GHZ(chan)) - return eep->modalHeader2G.xatten1Margin[chain]; - else if (eep->base_ext2.xatten1MarginLow[chain] != 0) { - t[0] = eep->base_ext2.xatten1MarginLow[chain]; - f[0] = 5180; - t[1] = eep->modalHeader5G.xatten1Margin[chain]; - f[1] = 5500; - t[2] = eep->base_ext2.xatten1MarginHigh[chain]; - f[2] = 5785; - value = ar9003_hw_power_interpolate((s32) chan->channel, - f, t, 3); - return value; - } else - return eep->modalHeader5G.xatten1Margin[chain]; - } - - return 0; -} - -static void ar9003_hw_atten_apply(struct ath_hw *ah, struct ath9k_channel *chan) -{ - int i; - u16 value; - unsigned long ext_atten_reg[3] = {AR_PHY_EXT_ATTEN_CTL_0, - AR_PHY_EXT_ATTEN_CTL_1, - AR_PHY_EXT_ATTEN_CTL_2, - }; - - if ((AR_SREV_9462(ah)) && (ah->rxchainmask == 0x2)) { - value = ar9003_hw_atten_chain_get(ah, 1, chan); - REG_RMW_FIELD(ah, ext_atten_reg[0], - AR_PHY_EXT_ATTEN_CTL_XATTEN1_DB, value); - - value = ar9003_hw_atten_chain_get_margin(ah, 1, chan); - REG_RMW_FIELD(ah, ext_atten_reg[0], - AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN, - value); - } - - /* Test value. if 0 then attenuation is unused. Don't load anything. */ - for (i = 0; i < 3; i++) { - if (ah->txchainmask & BIT(i)) { - value = ar9003_hw_atten_chain_get(ah, i, chan); - REG_RMW_FIELD(ah, ext_atten_reg[i], - AR_PHY_EXT_ATTEN_CTL_XATTEN1_DB, value); - - value = ar9003_hw_atten_chain_get_margin(ah, i, chan); - REG_RMW_FIELD(ah, ext_atten_reg[i], - AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN, - value); - } - } -} - -static bool is_pmu_set(struct ath_hw *ah, u32 pmu_reg, int pmu_set) -{ - int timeout = 100; - - while (pmu_set != REG_READ(ah, pmu_reg)) { - if (timeout-- == 0) - return false; - REG_WRITE(ah, pmu_reg, pmu_set); - udelay(10); - } - - return true; -} - -void ar9003_hw_internal_regulator_apply(struct ath_hw *ah) -{ - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader; - u32 reg_val; - - if (pBase->featureEnable & BIT(4)) { - if (AR_SREV_9330(ah) || AR_SREV_9485(ah)) { - int reg_pmu_set; - - reg_pmu_set = REG_READ(ah, AR_PHY_PMU2) & ~AR_PHY_PMU2_PGM; - REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set); - if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set)) - return; - - if (AR_SREV_9330(ah)) { - if (ah->is_clk_25mhz) { - reg_pmu_set = (3 << 1) | (8 << 4) | - (3 << 8) | (1 << 14) | - (6 << 17) | (1 << 20) | - (3 << 24); - } else { - reg_pmu_set = (4 << 1) | (7 << 4) | - (3 << 8) | (1 << 14) | - (6 << 17) | (1 << 20) | - (3 << 24); - } - } else { - reg_pmu_set = (5 << 1) | (7 << 4) | - (2 << 8) | (2 << 14) | - (6 << 17) | (1 << 20) | - (3 << 24) | (1 << 28); - } - - REG_WRITE(ah, AR_PHY_PMU1, reg_pmu_set); - if (!is_pmu_set(ah, AR_PHY_PMU1, reg_pmu_set)) - return; - - reg_pmu_set = (REG_READ(ah, AR_PHY_PMU2) & ~0xFFC00000) - | (4 << 26); - REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set); - if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set)) - return; - - reg_pmu_set = (REG_READ(ah, AR_PHY_PMU2) & ~0x00200000) - | (1 << 21); - REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set); - if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set)) - return; - } else if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) { - reg_val = le32_to_cpu(pBase->swreg); - REG_WRITE(ah, AR_PHY_PMU1, reg_val); - } else { - /* Internal regulator is ON. Write swreg register. */ - reg_val = le32_to_cpu(pBase->swreg); - REG_WRITE(ah, AR_RTC_REG_CONTROL1, - REG_READ(ah, AR_RTC_REG_CONTROL1) & - (~AR_RTC_REG_CONTROL1_SWREG_PROGRAM)); - REG_WRITE(ah, AR_RTC_REG_CONTROL0, reg_val); - /* Set REG_CONTROL1.SWREG_PROGRAM */ - REG_WRITE(ah, AR_RTC_REG_CONTROL1, - REG_READ(ah, - AR_RTC_REG_CONTROL1) | - AR_RTC_REG_CONTROL1_SWREG_PROGRAM); - } - } else { - if (AR_SREV_9330(ah) || AR_SREV_9485(ah)) { - REG_RMW_FIELD(ah, AR_PHY_PMU2, AR_PHY_PMU2_PGM, 0); - while (REG_READ_FIELD(ah, AR_PHY_PMU2, - AR_PHY_PMU2_PGM)) - udelay(10); - - REG_RMW_FIELD(ah, AR_PHY_PMU1, AR_PHY_PMU1_PWD, 0x1); - while (!REG_READ_FIELD(ah, AR_PHY_PMU1, - AR_PHY_PMU1_PWD)) - udelay(10); - REG_RMW_FIELD(ah, AR_PHY_PMU2, AR_PHY_PMU2_PGM, 0x1); - while (!REG_READ_FIELD(ah, AR_PHY_PMU2, - AR_PHY_PMU2_PGM)) - udelay(10); - } else if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) - REG_RMW_FIELD(ah, AR_PHY_PMU1, AR_PHY_PMU1_PWD, 0x1); - else { - reg_val = REG_READ(ah, AR_RTC_SLEEP_CLK) | - AR_RTC_FORCE_SWREG_PRD; - REG_WRITE(ah, AR_RTC_SLEEP_CLK, reg_val); - } - } - -} - -static void ar9003_hw_apply_tuning_caps(struct ath_hw *ah) -{ - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - u8 tuning_caps_param = eep->baseEepHeader.params_for_tuning_caps[0]; - - if (AR_SREV_9485(ah) || AR_SREV_9330(ah) || AR_SREV_9340(ah)) - return; - - if (eep->baseEepHeader.featureEnable & 0x40) { - tuning_caps_param &= 0x7f; - REG_RMW_FIELD(ah, AR_CH0_XTAL, AR_CH0_XTAL_CAPINDAC, - tuning_caps_param); - REG_RMW_FIELD(ah, AR_CH0_XTAL, AR_CH0_XTAL_CAPOUTDAC, - tuning_caps_param); - } -} - -static void ar9003_hw_quick_drop_apply(struct ath_hw *ah, u16 freq) -{ - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader; - int quick_drop; - s32 t[3], f[3] = {5180, 5500, 5785}; - - if (!(pBase->miscConfiguration & BIT(4))) - return; - - if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9340(ah)) { - if (freq < 4000) { - quick_drop = eep->modalHeader2G.quick_drop; - } else { - t[0] = eep->base_ext1.quick_drop_low; - t[1] = eep->modalHeader5G.quick_drop; - t[2] = eep->base_ext1.quick_drop_high; - quick_drop = ar9003_hw_power_interpolate(freq, f, t, 3); - } - REG_RMW_FIELD(ah, AR_PHY_AGC, AR_PHY_AGC_QUICK_DROP, quick_drop); - } -} - -static void ar9003_hw_txend_to_xpa_off_apply(struct ath_hw *ah, bool is2ghz) -{ - u32 value; - - value = ar9003_modal_header(ah, is2ghz)->txEndToXpaOff; - - REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL, - AR_PHY_XPA_TIMING_CTL_TX_END_XPAB_OFF, value); - REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL, - AR_PHY_XPA_TIMING_CTL_TX_END_XPAA_OFF, value); -} - -static void ar9003_hw_xpa_timing_control_apply(struct ath_hw *ah, bool is2ghz) -{ - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - u8 xpa_ctl; - - if (!(eep->baseEepHeader.featureEnable & 0x80)) - return; - - if (!AR_SREV_9300(ah) && !AR_SREV_9340(ah) && !AR_SREV_9580(ah)) - return; - - xpa_ctl = ar9003_modal_header(ah, is2ghz)->txFrameToXpaOn; - if (is2ghz) - REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL, - AR_PHY_XPA_TIMING_CTL_FRAME_XPAB_ON, xpa_ctl); - else - REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL, - AR_PHY_XPA_TIMING_CTL_FRAME_XPAA_ON, xpa_ctl); -} - -static void ar9003_hw_xlna_bias_strength_apply(struct ath_hw *ah, bool is2ghz) -{ - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - u8 bias; - - if (!(eep->baseEepHeader.miscConfiguration & 0x40)) - return; - - if (!AR_SREV_9300(ah)) - return; - - bias = ar9003_modal_header(ah, is2ghz)->xlna_bias_strength; - REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_RXTX4, AR_PHY_65NM_RXTX4_XLNA_BIAS, - bias & 0x3); - bias >>= 2; - REG_RMW_FIELD(ah, AR_PHY_65NM_CH1_RXTX4, AR_PHY_65NM_RXTX4_XLNA_BIAS, - bias & 0x3); - bias >>= 2; - REG_RMW_FIELD(ah, AR_PHY_65NM_CH2_RXTX4, AR_PHY_65NM_RXTX4_XLNA_BIAS, - bias & 0x3); -} - -static int ar9003_hw_get_thermometer(struct ath_hw *ah) -{ - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader; - int thermometer = (pBase->miscConfiguration >> 1) & 0x3; - - return --thermometer; -} - -static void ar9003_hw_thermometer_apply(struct ath_hw *ah) -{ - int thermometer = ar9003_hw_get_thermometer(ah); - u8 therm_on = (thermometer < 0) ? 0 : 1; - - REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_RXTX4, - AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR, therm_on); - if (ah->caps.tx_chainmask & BIT(1)) - REG_RMW_FIELD(ah, AR_PHY_65NM_CH1_RXTX4, - AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR, therm_on); - if (ah->caps.tx_chainmask & BIT(2)) - REG_RMW_FIELD(ah, AR_PHY_65NM_CH2_RXTX4, - AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR, therm_on); - - therm_on = (thermometer < 0) ? 0 : (thermometer == 0); - REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_RXTX4, - AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on); - if (ah->caps.tx_chainmask & BIT(1)) { - therm_on = (thermometer < 0) ? 0 : (thermometer == 1); - REG_RMW_FIELD(ah, AR_PHY_65NM_CH1_RXTX4, - AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on); - } - if (ah->caps.tx_chainmask & BIT(2)) { - therm_on = (thermometer < 0) ? 0 : (thermometer == 2); - REG_RMW_FIELD(ah, AR_PHY_65NM_CH2_RXTX4, - AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on); - } -} - -static void ar9003_hw_thermo_cal_apply(struct ath_hw *ah) -{ - u32 data, ko, kg; - - if (!AR_SREV_9462_20(ah)) - return; - ar9300_otp_read_word(ah, 1, &data); - ko = data & 0xff; - kg = (data >> 8) & 0xff; - if (ko || kg) { - REG_RMW_FIELD(ah, AR_PHY_BB_THERM_ADC_3, - AR_PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET, ko); - REG_RMW_FIELD(ah, AR_PHY_BB_THERM_ADC_3, - AR_PHY_BB_THERM_ADC_3_THERM_ADC_SCALE_GAIN, - kg + 256); - } -} - -static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - bool is2ghz = IS_CHAN_2GHZ(chan); - ar9003_hw_xpa_timing_control_apply(ah, is2ghz); - ar9003_hw_xpa_bias_level_apply(ah, is2ghz); - ar9003_hw_ant_ctrl_apply(ah, is2ghz); - ar9003_hw_drive_strength_apply(ah); - ar9003_hw_xlna_bias_strength_apply(ah, is2ghz); - ar9003_hw_atten_apply(ah, chan); - ar9003_hw_quick_drop_apply(ah, chan->channel); - if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && !AR_SREV_9550(ah)) - ar9003_hw_internal_regulator_apply(ah); - ar9003_hw_apply_tuning_caps(ah); - ar9003_hw_txend_to_xpa_off_apply(ah, is2ghz); - ar9003_hw_thermometer_apply(ah); - ar9003_hw_thermo_cal_apply(ah); -} - -static void ath9k_hw_ar9300_set_addac(struct ath_hw *ah, - struct ath9k_channel *chan) -{ -} - -/* - * Returns the interpolated y value corresponding to the specified x value - * from the np ordered pairs of data (px,py). - * The pairs do not have to be in any order. - * If the specified x value is less than any of the px, - * the returned y value is equal to the py for the lowest px. - * If the specified x value is greater than any of the px, - * the returned y value is equal to the py for the highest px. - */ -static int ar9003_hw_power_interpolate(int32_t x, - int32_t *px, int32_t *py, u_int16_t np) -{ - int ip = 0; - int lx = 0, ly = 0, lhave = 0; - int hx = 0, hy = 0, hhave = 0; - int dx = 0; - int y = 0; - - lhave = 0; - hhave = 0; - - /* identify best lower and higher x calibration measurement */ - for (ip = 0; ip < np; ip++) { - dx = x - px[ip]; - - /* this measurement is higher than our desired x */ - if (dx <= 0) { - if (!hhave || dx > (x - hx)) { - /* new best higher x measurement */ - hx = px[ip]; - hy = py[ip]; - hhave = 1; - } - } - /* this measurement is lower than our desired x */ - if (dx >= 0) { - if (!lhave || dx < (x - lx)) { - /* new best lower x measurement */ - lx = px[ip]; - ly = py[ip]; - lhave = 1; - } - } - } - - /* the low x is good */ - if (lhave) { - /* so is the high x */ - if (hhave) { - /* they're the same, so just pick one */ - if (hx == lx) - y = ly; - else /* interpolate */ - y = interpolate(x, lx, hx, ly, hy); - } else /* only low is good, use it */ - y = ly; - } else if (hhave) /* only high is good, use it */ - y = hy; - else /* nothing is good,this should never happen unless np=0, ???? */ - y = -(1 << 30); - return y; -} - -static u8 ar9003_hw_eeprom_get_tgt_pwr(struct ath_hw *ah, - u16 rateIndex, u16 freq, bool is2GHz) -{ - u16 numPiers, i; - s32 targetPowerArray[AR9300_NUM_5G_20_TARGET_POWERS]; - s32 freqArray[AR9300_NUM_5G_20_TARGET_POWERS]; - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - struct cal_tgt_pow_legacy *pEepromTargetPwr; - u8 *pFreqBin; - - if (is2GHz) { - numPiers = AR9300_NUM_2G_20_TARGET_POWERS; - pEepromTargetPwr = eep->calTargetPower2G; - pFreqBin = eep->calTarget_freqbin_2G; - } else { - numPiers = AR9300_NUM_5G_20_TARGET_POWERS; - pEepromTargetPwr = eep->calTargetPower5G; - pFreqBin = eep->calTarget_freqbin_5G; - } - - /* - * create array of channels and targetpower from - * targetpower piers stored on eeprom - */ - for (i = 0; i < numPiers; i++) { - freqArray[i] = ath9k_hw_fbin2freq(pFreqBin[i], is2GHz); - targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex]; - } - - /* interpolate to get target power for given frequency */ - return (u8) ar9003_hw_power_interpolate((s32) freq, - freqArray, - targetPowerArray, numPiers); -} - -static u8 ar9003_hw_eeprom_get_ht20_tgt_pwr(struct ath_hw *ah, - u16 rateIndex, - u16 freq, bool is2GHz) -{ - u16 numPiers, i; - s32 targetPowerArray[AR9300_NUM_5G_20_TARGET_POWERS]; - s32 freqArray[AR9300_NUM_5G_20_TARGET_POWERS]; - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - struct cal_tgt_pow_ht *pEepromTargetPwr; - u8 *pFreqBin; - - if (is2GHz) { - numPiers = AR9300_NUM_2G_20_TARGET_POWERS; - pEepromTargetPwr = eep->calTargetPower2GHT20; - pFreqBin = eep->calTarget_freqbin_2GHT20; - } else { - numPiers = AR9300_NUM_5G_20_TARGET_POWERS; - pEepromTargetPwr = eep->calTargetPower5GHT20; - pFreqBin = eep->calTarget_freqbin_5GHT20; - } - - /* - * create array of channels and targetpower - * from targetpower piers stored on eeprom - */ - for (i = 0; i < numPiers; i++) { - freqArray[i] = ath9k_hw_fbin2freq(pFreqBin[i], is2GHz); - targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex]; - } - - /* interpolate to get target power for given frequency */ - return (u8) ar9003_hw_power_interpolate((s32) freq, - freqArray, - targetPowerArray, numPiers); -} - -static u8 ar9003_hw_eeprom_get_ht40_tgt_pwr(struct ath_hw *ah, - u16 rateIndex, - u16 freq, bool is2GHz) -{ - u16 numPiers, i; - s32 targetPowerArray[AR9300_NUM_5G_40_TARGET_POWERS]; - s32 freqArray[AR9300_NUM_5G_40_TARGET_POWERS]; - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - struct cal_tgt_pow_ht *pEepromTargetPwr; - u8 *pFreqBin; - - if (is2GHz) { - numPiers = AR9300_NUM_2G_40_TARGET_POWERS; - pEepromTargetPwr = eep->calTargetPower2GHT40; - pFreqBin = eep->calTarget_freqbin_2GHT40; - } else { - numPiers = AR9300_NUM_5G_40_TARGET_POWERS; - pEepromTargetPwr = eep->calTargetPower5GHT40; - pFreqBin = eep->calTarget_freqbin_5GHT40; - } - - /* - * create array of channels and targetpower from - * targetpower piers stored on eeprom - */ - for (i = 0; i < numPiers; i++) { - freqArray[i] = ath9k_hw_fbin2freq(pFreqBin[i], is2GHz); - targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex]; - } - - /* interpolate to get target power for given frequency */ - return (u8) ar9003_hw_power_interpolate((s32) freq, - freqArray, - targetPowerArray, numPiers); -} - -static u8 ar9003_hw_eeprom_get_cck_tgt_pwr(struct ath_hw *ah, - u16 rateIndex, u16 freq) -{ - u16 numPiers = AR9300_NUM_2G_CCK_TARGET_POWERS, i; - s32 targetPowerArray[AR9300_NUM_2G_CCK_TARGET_POWERS]; - s32 freqArray[AR9300_NUM_2G_CCK_TARGET_POWERS]; - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - struct cal_tgt_pow_legacy *pEepromTargetPwr = eep->calTargetPowerCck; - u8 *pFreqBin = eep->calTarget_freqbin_Cck; - - /* - * create array of channels and targetpower from - * targetpower piers stored on eeprom - */ - for (i = 0; i < numPiers; i++) { - freqArray[i] = ath9k_hw_fbin2freq(pFreqBin[i], 1); - targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex]; - } - - /* interpolate to get target power for given frequency */ - return (u8) ar9003_hw_power_interpolate((s32) freq, - freqArray, - targetPowerArray, numPiers); -} - -/* Set tx power registers to array of values passed in */ -static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray) -{ -#define POW_SM(_r, _s) (((_r) & 0x3f) << (_s)) - /* make sure forced gain is not set */ - REG_WRITE(ah, AR_PHY_TX_FORCED_GAIN, 0); - - /* Write the OFDM power per rate set */ - - /* 6 (LSB), 9, 12, 18 (MSB) */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE(0), - POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 24) | - POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 16) | - POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 8) | - POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 0)); - - /* 24 (LSB), 36, 48, 54 (MSB) */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE(1), - POW_SM(pPwrArray[ALL_TARGET_LEGACY_54], 24) | - POW_SM(pPwrArray[ALL_TARGET_LEGACY_48], 16) | - POW_SM(pPwrArray[ALL_TARGET_LEGACY_36], 8) | - POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 0)); - - /* Write the CCK power per rate set */ - - /* 1L (LSB), reserved, 2L, 2S (MSB) */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE(2), - POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 24) | - POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 16) | - /* POW_SM(txPowerTimes2, 8) | this is reserved for AR9003 */ - POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0)); - - /* 5.5L (LSB), 5.5S, 11L, 11S (MSB) */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE(3), - POW_SM(pPwrArray[ALL_TARGET_LEGACY_11S], 24) | - POW_SM(pPwrArray[ALL_TARGET_LEGACY_11L], 16) | - POW_SM(pPwrArray[ALL_TARGET_LEGACY_5S], 8) | - POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0) - ); - - /* Write the power for duplicated frames - HT40 */ - - /* dup40_cck (LSB), dup40_ofdm, ext20_cck, ext20_ofdm (MSB) */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE(8), - POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 24) | - POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 16) | - POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 8) | - POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0) - ); - - /* Write the HT20 power per rate set */ - - /* 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB) */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE(4), - POW_SM(pPwrArray[ALL_TARGET_HT20_5], 24) | - POW_SM(pPwrArray[ALL_TARGET_HT20_4], 16) | - POW_SM(pPwrArray[ALL_TARGET_HT20_1_3_9_11_17_19], 8) | - POW_SM(pPwrArray[ALL_TARGET_HT20_0_8_16], 0) - ); - - /* 6 (LSB), 7, 12, 13 (MSB) */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE(5), - POW_SM(pPwrArray[ALL_TARGET_HT20_13], 24) | - POW_SM(pPwrArray[ALL_TARGET_HT20_12], 16) | - POW_SM(pPwrArray[ALL_TARGET_HT20_7], 8) | - POW_SM(pPwrArray[ALL_TARGET_HT20_6], 0) - ); - - /* 14 (LSB), 15, 20, 21 */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE(9), - POW_SM(pPwrArray[ALL_TARGET_HT20_21], 24) | - POW_SM(pPwrArray[ALL_TARGET_HT20_20], 16) | - POW_SM(pPwrArray[ALL_TARGET_HT20_15], 8) | - POW_SM(pPwrArray[ALL_TARGET_HT20_14], 0) - ); - - /* Mixed HT20 and HT40 rates */ - - /* HT20 22 (LSB), HT20 23, HT40 22, HT40 23 (MSB) */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE(10), - POW_SM(pPwrArray[ALL_TARGET_HT40_23], 24) | - POW_SM(pPwrArray[ALL_TARGET_HT40_22], 16) | - POW_SM(pPwrArray[ALL_TARGET_HT20_23], 8) | - POW_SM(pPwrArray[ALL_TARGET_HT20_22], 0) - ); - - /* - * Write the HT40 power per rate set - * correct PAR difference between HT40 and HT20/LEGACY - * 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB) - */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE(6), - POW_SM(pPwrArray[ALL_TARGET_HT40_5], 24) | - POW_SM(pPwrArray[ALL_TARGET_HT40_4], 16) | - POW_SM(pPwrArray[ALL_TARGET_HT40_1_3_9_11_17_19], 8) | - POW_SM(pPwrArray[ALL_TARGET_HT40_0_8_16], 0) - ); - - /* 6 (LSB), 7, 12, 13 (MSB) */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE(7), - POW_SM(pPwrArray[ALL_TARGET_HT40_13], 24) | - POW_SM(pPwrArray[ALL_TARGET_HT40_12], 16) | - POW_SM(pPwrArray[ALL_TARGET_HT40_7], 8) | - POW_SM(pPwrArray[ALL_TARGET_HT40_6], 0) - ); - - /* 14 (LSB), 15, 20, 21 */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE(11), - POW_SM(pPwrArray[ALL_TARGET_HT40_21], 24) | - POW_SM(pPwrArray[ALL_TARGET_HT40_20], 16) | - POW_SM(pPwrArray[ALL_TARGET_HT40_15], 8) | - POW_SM(pPwrArray[ALL_TARGET_HT40_14], 0) - ); - - return 0; -#undef POW_SM -} - -static void ar9003_hw_get_legacy_target_powers(struct ath_hw *ah, u16 freq, - u8 *targetPowerValT2, - bool is2GHz) -{ - targetPowerValT2[ALL_TARGET_LEGACY_6_24] = - ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_6_24, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_LEGACY_36] = - ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_36, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_LEGACY_48] = - ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_48, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_LEGACY_54] = - ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_54, freq, - is2GHz); -} - -static void ar9003_hw_get_cck_target_powers(struct ath_hw *ah, u16 freq, - u8 *targetPowerValT2) -{ - targetPowerValT2[ALL_TARGET_LEGACY_1L_5L] = - ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_1L_5L, - freq); - targetPowerValT2[ALL_TARGET_LEGACY_5S] = - ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_5S, freq); - targetPowerValT2[ALL_TARGET_LEGACY_11L] = - ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11L, freq); - targetPowerValT2[ALL_TARGET_LEGACY_11S] = - ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11S, freq); -} - -static void ar9003_hw_get_ht20_target_powers(struct ath_hw *ah, u16 freq, - u8 *targetPowerValT2, bool is2GHz) -{ - targetPowerValT2[ALL_TARGET_HT20_0_8_16] = - ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_HT20_1_3_9_11_17_19] = - ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_1_3_9_11_17_19, - freq, is2GHz); - targetPowerValT2[ALL_TARGET_HT20_4] = - ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_4, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_HT20_5] = - ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_5, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_HT20_6] = - ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_6, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_HT20_7] = - ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_7, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_HT20_12] = - ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_12, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_HT20_13] = - ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_13, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_HT20_14] = - ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_14, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_HT20_15] = - ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_15, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_HT20_20] = - ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_20, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_HT20_21] = - ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_21, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_HT20_22] = - ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_22, freq, - is2GHz); - targetPowerValT2[ALL_TARGET_HT20_23] = - ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_23, freq, - is2GHz); -} - -static void ar9003_hw_get_ht40_target_powers(struct ath_hw *ah, - u16 freq, - u8 *targetPowerValT2, - bool is2GHz) -{ - /* XXX: hard code for now, need to get from eeprom struct */ - u8 ht40PowerIncForPdadc = 0; - - targetPowerValT2[ALL_TARGET_HT40_0_8_16] = - ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq, - is2GHz) + ht40PowerIncForPdadc; - targetPowerValT2[ALL_TARGET_HT40_1_3_9_11_17_19] = - ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_1_3_9_11_17_19, - freq, - is2GHz) + ht40PowerIncForPdadc; - targetPowerValT2[ALL_TARGET_HT40_4] = - ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_4, freq, - is2GHz) + ht40PowerIncForPdadc; - targetPowerValT2[ALL_TARGET_HT40_5] = - ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_5, freq, - is2GHz) + ht40PowerIncForPdadc; - targetPowerValT2[ALL_TARGET_HT40_6] = - ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_6, freq, - is2GHz) + ht40PowerIncForPdadc; - targetPowerValT2[ALL_TARGET_HT40_7] = - ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_7, freq, - is2GHz) + ht40PowerIncForPdadc; - targetPowerValT2[ALL_TARGET_HT40_12] = - ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_12, freq, - is2GHz) + ht40PowerIncForPdadc; - targetPowerValT2[ALL_TARGET_HT40_13] = - ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_13, freq, - is2GHz) + ht40PowerIncForPdadc; - targetPowerValT2[ALL_TARGET_HT40_14] = - ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_14, freq, - is2GHz) + ht40PowerIncForPdadc; - targetPowerValT2[ALL_TARGET_HT40_15] = - ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_15, freq, - is2GHz) + ht40PowerIncForPdadc; - targetPowerValT2[ALL_TARGET_HT40_20] = - ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_20, freq, - is2GHz) + ht40PowerIncForPdadc; - targetPowerValT2[ALL_TARGET_HT40_21] = - ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_21, freq, - is2GHz) + ht40PowerIncForPdadc; - targetPowerValT2[ALL_TARGET_HT40_22] = - ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_22, freq, - is2GHz) + ht40PowerIncForPdadc; - targetPowerValT2[ALL_TARGET_HT40_23] = - ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_23, freq, - is2GHz) + ht40PowerIncForPdadc; -} - -static void ar9003_hw_get_target_power_eeprom(struct ath_hw *ah, - struct ath9k_channel *chan, - u8 *targetPowerValT2) -{ - bool is2GHz = IS_CHAN_2GHZ(chan); - unsigned int i = 0; - struct ath_common *common = ath9k_hw_common(ah); - u16 freq = chan->channel; - - if (is2GHz) - ar9003_hw_get_cck_target_powers(ah, freq, targetPowerValT2); - - ar9003_hw_get_legacy_target_powers(ah, freq, targetPowerValT2, is2GHz); - ar9003_hw_get_ht20_target_powers(ah, freq, targetPowerValT2, is2GHz); - - if (IS_CHAN_HT40(chan)) - ar9003_hw_get_ht40_target_powers(ah, freq, targetPowerValT2, - is2GHz); - - for (i = 0; i < ar9300RateSize; i++) { - ath_dbg(common, EEPROM, "TPC[%02d] 0x%08x\n", - i, targetPowerValT2[i]); - } -} - -static int ar9003_hw_cal_pier_get(struct ath_hw *ah, - int mode, - int ipier, - int ichain, - int *pfrequency, - int *pcorrection, - int *ptemperature, int *pvoltage) -{ - u8 *pCalPier; - struct ar9300_cal_data_per_freq_op_loop *pCalPierStruct; - int is2GHz; - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - struct ath_common *common = ath9k_hw_common(ah); - - if (ichain >= AR9300_MAX_CHAINS) { - ath_dbg(common, EEPROM, - "Invalid chain index, must be less than %d\n", - AR9300_MAX_CHAINS); - return -1; - } - - if (mode) { /* 5GHz */ - if (ipier >= AR9300_NUM_5G_CAL_PIERS) { - ath_dbg(common, EEPROM, - "Invalid 5GHz cal pier index, must be less than %d\n", - AR9300_NUM_5G_CAL_PIERS); - return -1; - } - pCalPier = &(eep->calFreqPier5G[ipier]); - pCalPierStruct = &(eep->calPierData5G[ichain][ipier]); - is2GHz = 0; - } else { - if (ipier >= AR9300_NUM_2G_CAL_PIERS) { - ath_dbg(common, EEPROM, - "Invalid 2GHz cal pier index, must be less than %d\n", - AR9300_NUM_2G_CAL_PIERS); - return -1; - } - - pCalPier = &(eep->calFreqPier2G[ipier]); - pCalPierStruct = &(eep->calPierData2G[ichain][ipier]); - is2GHz = 1; - } - - *pfrequency = ath9k_hw_fbin2freq(*pCalPier, is2GHz); - *pcorrection = pCalPierStruct->refPower; - *ptemperature = pCalPierStruct->tempMeas; - *pvoltage = pCalPierStruct->voltMeas; - - return 0; -} - -static void ar9003_hw_power_control_override(struct ath_hw *ah, - int frequency, - int *correction, - int *voltage, int *temperature) -{ - int temp_slope = 0, temp_slope1 = 0, temp_slope2 = 0; - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - int f[8], t[8], t1[3], t2[3], i; - - REG_RMW(ah, AR_PHY_TPC_11_B0, - (correction[0] << AR_PHY_TPC_OLPC_GAIN_DELTA_S), - AR_PHY_TPC_OLPC_GAIN_DELTA); - if (ah->caps.tx_chainmask & BIT(1)) - REG_RMW(ah, AR_PHY_TPC_11_B1, - (correction[1] << AR_PHY_TPC_OLPC_GAIN_DELTA_S), - AR_PHY_TPC_OLPC_GAIN_DELTA); - if (ah->caps.tx_chainmask & BIT(2)) - REG_RMW(ah, AR_PHY_TPC_11_B2, - (correction[2] << AR_PHY_TPC_OLPC_GAIN_DELTA_S), - AR_PHY_TPC_OLPC_GAIN_DELTA); - - /* enable open loop power control on chip */ - REG_RMW(ah, AR_PHY_TPC_6_B0, - (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S), - AR_PHY_TPC_6_ERROR_EST_MODE); - if (ah->caps.tx_chainmask & BIT(1)) - REG_RMW(ah, AR_PHY_TPC_6_B1, - (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S), - AR_PHY_TPC_6_ERROR_EST_MODE); - if (ah->caps.tx_chainmask & BIT(2)) - REG_RMW(ah, AR_PHY_TPC_6_B2, - (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S), - AR_PHY_TPC_6_ERROR_EST_MODE); - - /* - * enable temperature compensation - * Need to use register names - */ - if (frequency < 4000) { - temp_slope = eep->modalHeader2G.tempSlope; - } else { - if (AR_SREV_9550(ah)) { - t[0] = eep->base_ext1.tempslopextension[2]; - t1[0] = eep->base_ext1.tempslopextension[3]; - t2[0] = eep->base_ext1.tempslopextension[4]; - f[0] = 5180; - - t[1] = eep->modalHeader5G.tempSlope; - t1[1] = eep->base_ext1.tempslopextension[0]; - t2[1] = eep->base_ext1.tempslopextension[1]; - f[1] = 5500; - - t[2] = eep->base_ext1.tempslopextension[5]; - t1[2] = eep->base_ext1.tempslopextension[6]; - t2[2] = eep->base_ext1.tempslopextension[7]; - f[2] = 5785; - - temp_slope = ar9003_hw_power_interpolate(frequency, - f, t, 3); - temp_slope1 = ar9003_hw_power_interpolate(frequency, - f, t1, 3); - temp_slope2 = ar9003_hw_power_interpolate(frequency, - f, t2, 3); - - goto tempslope; - } - - if ((eep->baseEepHeader.miscConfiguration & 0x20) != 0) { - for (i = 0; i < 8; i++) { - t[i] = eep->base_ext1.tempslopextension[i]; - f[i] = FBIN2FREQ(eep->calFreqPier5G[i], 0); - } - temp_slope = ar9003_hw_power_interpolate((s32) frequency, - f, t, 8); - } else if (eep->base_ext2.tempSlopeLow != 0) { - t[0] = eep->base_ext2.tempSlopeLow; - f[0] = 5180; - t[1] = eep->modalHeader5G.tempSlope; - f[1] = 5500; - t[2] = eep->base_ext2.tempSlopeHigh; - f[2] = 5785; - temp_slope = ar9003_hw_power_interpolate((s32) frequency, - f, t, 3); - } else { - temp_slope = eep->modalHeader5G.tempSlope; - } - } - -tempslope: - if (AR_SREV_9550(ah)) { - /* - * AR955x has tempSlope register for each chain. - * Check whether temp_compensation feature is enabled or not. - */ - if (eep->baseEepHeader.featureEnable & 0x1) { - if (frequency < 4000) { - REG_RMW_FIELD(ah, AR_PHY_TPC_19, - AR_PHY_TPC_19_ALPHA_THERM, - eep->base_ext2.tempSlopeLow); - REG_RMW_FIELD(ah, AR_PHY_TPC_19_B1, - AR_PHY_TPC_19_ALPHA_THERM, - temp_slope); - REG_RMW_FIELD(ah, AR_PHY_TPC_19_B2, - AR_PHY_TPC_19_ALPHA_THERM, - eep->base_ext2.tempSlopeHigh); - } else { - REG_RMW_FIELD(ah, AR_PHY_TPC_19, - AR_PHY_TPC_19_ALPHA_THERM, - temp_slope); - REG_RMW_FIELD(ah, AR_PHY_TPC_19_B1, - AR_PHY_TPC_19_ALPHA_THERM, - temp_slope1); - REG_RMW_FIELD(ah, AR_PHY_TPC_19_B2, - AR_PHY_TPC_19_ALPHA_THERM, - temp_slope2); - } - } else { - /* - * If temp compensation is not enabled, - * set all registers to 0. - */ - REG_RMW_FIELD(ah, AR_PHY_TPC_19, - AR_PHY_TPC_19_ALPHA_THERM, 0); - REG_RMW_FIELD(ah, AR_PHY_TPC_19_B1, - AR_PHY_TPC_19_ALPHA_THERM, 0); - REG_RMW_FIELD(ah, AR_PHY_TPC_19_B2, - AR_PHY_TPC_19_ALPHA_THERM, 0); - } - } else { - REG_RMW_FIELD(ah, AR_PHY_TPC_19, - AR_PHY_TPC_19_ALPHA_THERM, temp_slope); - } - - if (AR_SREV_9462_20(ah)) - REG_RMW_FIELD(ah, AR_PHY_TPC_19_B1, - AR_PHY_TPC_19_B1_ALPHA_THERM, temp_slope); - - - REG_RMW_FIELD(ah, AR_PHY_TPC_18, AR_PHY_TPC_18_THERM_CAL_VALUE, - temperature[0]); -} - -/* Apply the recorded correction values. */ -static int ar9003_hw_calibration_apply(struct ath_hw *ah, int frequency) -{ - int ichain, ipier, npier; - int mode; - int lfrequency[AR9300_MAX_CHAINS], - lcorrection[AR9300_MAX_CHAINS], - ltemperature[AR9300_MAX_CHAINS], lvoltage[AR9300_MAX_CHAINS]; - int hfrequency[AR9300_MAX_CHAINS], - hcorrection[AR9300_MAX_CHAINS], - htemperature[AR9300_MAX_CHAINS], hvoltage[AR9300_MAX_CHAINS]; - int fdiff; - int correction[AR9300_MAX_CHAINS], - voltage[AR9300_MAX_CHAINS], temperature[AR9300_MAX_CHAINS]; - int pfrequency, pcorrection, ptemperature, pvoltage; - struct ath_common *common = ath9k_hw_common(ah); - - mode = (frequency >= 4000); - if (mode) - npier = AR9300_NUM_5G_CAL_PIERS; - else - npier = AR9300_NUM_2G_CAL_PIERS; - - for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) { - lfrequency[ichain] = 0; - hfrequency[ichain] = 100000; - } - /* identify best lower and higher frequency calibration measurement */ - for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) { - for (ipier = 0; ipier < npier; ipier++) { - if (!ar9003_hw_cal_pier_get(ah, mode, ipier, ichain, - &pfrequency, &pcorrection, - &ptemperature, &pvoltage)) { - fdiff = frequency - pfrequency; - - /* - * this measurement is higher than - * our desired frequency - */ - if (fdiff <= 0) { - if (hfrequency[ichain] <= 0 || - hfrequency[ichain] >= 100000 || - fdiff > - (frequency - hfrequency[ichain])) { - /* - * new best higher - * frequency measurement - */ - hfrequency[ichain] = pfrequency; - hcorrection[ichain] = - pcorrection; - htemperature[ichain] = - ptemperature; - hvoltage[ichain] = pvoltage; - } - } - if (fdiff >= 0) { - if (lfrequency[ichain] <= 0 - || fdiff < - (frequency - lfrequency[ichain])) { - /* - * new best lower - * frequency measurement - */ - lfrequency[ichain] = pfrequency; - lcorrection[ichain] = - pcorrection; - ltemperature[ichain] = - ptemperature; - lvoltage[ichain] = pvoltage; - } - } - } - } - } - - /* interpolate */ - for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) { - ath_dbg(common, EEPROM, "ch=%d f=%d low=%d %d h=%d %d\n", - ichain, frequency, lfrequency[ichain], - lcorrection[ichain], hfrequency[ichain], - hcorrection[ichain]); - /* they're the same, so just pick one */ - if (hfrequency[ichain] == lfrequency[ichain]) { - correction[ichain] = lcorrection[ichain]; - voltage[ichain] = lvoltage[ichain]; - temperature[ichain] = ltemperature[ichain]; - } - /* the low frequency is good */ - else if (frequency - lfrequency[ichain] < 1000) { - /* so is the high frequency, interpolate */ - if (hfrequency[ichain] - frequency < 1000) { - - correction[ichain] = interpolate(frequency, - lfrequency[ichain], - hfrequency[ichain], - lcorrection[ichain], - hcorrection[ichain]); - - temperature[ichain] = interpolate(frequency, - lfrequency[ichain], - hfrequency[ichain], - ltemperature[ichain], - htemperature[ichain]); - - voltage[ichain] = interpolate(frequency, - lfrequency[ichain], - hfrequency[ichain], - lvoltage[ichain], - hvoltage[ichain]); - } - /* only low is good, use it */ - else { - correction[ichain] = lcorrection[ichain]; - temperature[ichain] = ltemperature[ichain]; - voltage[ichain] = lvoltage[ichain]; - } - } - /* only high is good, use it */ - else if (hfrequency[ichain] - frequency < 1000) { - correction[ichain] = hcorrection[ichain]; - temperature[ichain] = htemperature[ichain]; - voltage[ichain] = hvoltage[ichain]; - } else { /* nothing is good, presume 0???? */ - correction[ichain] = 0; - temperature[ichain] = 0; - voltage[ichain] = 0; - } - } - - ar9003_hw_power_control_override(ah, frequency, correction, voltage, - temperature); - - ath_dbg(common, EEPROM, - "for frequency=%d, calibration correction = %d %d %d\n", - frequency, correction[0], correction[1], correction[2]); - - return 0; -} - -static u16 ar9003_hw_get_direct_edge_power(struct ar9300_eeprom *eep, - int idx, - int edge, - bool is2GHz) -{ - struct cal_ctl_data_2g *ctl_2g = eep->ctlPowerData_2G; - struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G; - - if (is2GHz) - return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge]); - else - return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge]); -} - -static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep, - int idx, - unsigned int edge, - u16 freq, - bool is2GHz) -{ - struct cal_ctl_data_2g *ctl_2g = eep->ctlPowerData_2G; - struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G; - - u8 *ctl_freqbin = is2GHz ? - &eep->ctl_freqbin_2G[idx][0] : - &eep->ctl_freqbin_5G[idx][0]; - - if (is2GHz) { - if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq && - CTL_EDGE_FLAGS(ctl_2g[idx].ctlEdges[edge - 1])) - return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge - 1]); - } else { - if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq && - CTL_EDGE_FLAGS(ctl_5g[idx].ctlEdges[edge - 1])) - return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge - 1]); - } - - return MAX_RATE_POWER; -} - -/* - * Find the maximum conformance test limit for the given channel and CTL info - */ -static u16 ar9003_hw_get_max_edge_power(struct ar9300_eeprom *eep, - u16 freq, int idx, bool is2GHz) -{ - u16 twiceMaxEdgePower = MAX_RATE_POWER; - u8 *ctl_freqbin = is2GHz ? - &eep->ctl_freqbin_2G[idx][0] : - &eep->ctl_freqbin_5G[idx][0]; - u16 num_edges = is2GHz ? - AR9300_NUM_BAND_EDGES_2G : AR9300_NUM_BAND_EDGES_5G; - unsigned int edge; - - /* Get the edge power */ - for (edge = 0; - (edge < num_edges) && (ctl_freqbin[edge] != AR5416_BCHAN_UNUSED); - edge++) { - /* - * If there's an exact channel match or an inband flag set - * on the lower channel use the given rdEdgePower - */ - if (freq == ath9k_hw_fbin2freq(ctl_freqbin[edge], is2GHz)) { - twiceMaxEdgePower = - ar9003_hw_get_direct_edge_power(eep, idx, - edge, is2GHz); - break; - } else if ((edge > 0) && - (freq < ath9k_hw_fbin2freq(ctl_freqbin[edge], - is2GHz))) { - twiceMaxEdgePower = - ar9003_hw_get_indirect_edge_power(eep, idx, - edge, freq, - is2GHz); - /* - * Leave loop - no more affecting edges possible in - * this monotonic increasing list - */ - break; - } - } - return twiceMaxEdgePower; -} - -static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah, - struct ath9k_channel *chan, - u8 *pPwrArray, u16 cfgCtl, - u8 antenna_reduction, - u16 powerLimit) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ar9300_eeprom *pEepData = &ah->eeprom.ar9300_eep; - u16 twiceMaxEdgePower; - int i; - u16 scaledPower = 0, minCtlPower; - static const u16 ctlModesFor11a[] = { - CTL_11A, CTL_5GHT20, CTL_11A_EXT, CTL_5GHT40 - }; - static const u16 ctlModesFor11g[] = { - CTL_11B, CTL_11G, CTL_2GHT20, CTL_11B_EXT, - CTL_11G_EXT, CTL_2GHT40 - }; - u16 numCtlModes; - const u16 *pCtlMode; - u16 ctlMode, freq; - struct chan_centers centers; - u8 *ctlIndex; - u8 ctlNum; - u16 twiceMinEdgePower; - bool is2ghz = IS_CHAN_2GHZ(chan); - - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - scaledPower = ath9k_hw_get_scaled_power(ah, powerLimit, - antenna_reduction); - - if (is2ghz) { - /* Setup for CTL modes */ - /* CTL_11B, CTL_11G, CTL_2GHT20 */ - numCtlModes = - ARRAY_SIZE(ctlModesFor11g) - - SUB_NUM_CTL_MODES_AT_2G_40; - pCtlMode = ctlModesFor11g; - if (IS_CHAN_HT40(chan)) - /* All 2G CTL's */ - numCtlModes = ARRAY_SIZE(ctlModesFor11g); - } else { - /* Setup for CTL modes */ - /* CTL_11A, CTL_5GHT20 */ - numCtlModes = ARRAY_SIZE(ctlModesFor11a) - - SUB_NUM_CTL_MODES_AT_5G_40; - pCtlMode = ctlModesFor11a; - if (IS_CHAN_HT40(chan)) - /* All 5G CTL's */ - numCtlModes = ARRAY_SIZE(ctlModesFor11a); - } - - /* - * For MIMO, need to apply regulatory caps individually across - * dynamically running modes: CCK, OFDM, HT20, HT40 - * - * The outer loop walks through each possible applicable runtime mode. - * The inner loop walks through each ctlIndex entry in EEPROM. - * The ctl value is encoded as [7:4] == test group, [3:0] == test mode. - */ - for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) { - bool isHt40CtlMode = (pCtlMode[ctlMode] == CTL_5GHT40) || - (pCtlMode[ctlMode] == CTL_2GHT40); - if (isHt40CtlMode) - freq = centers.synth_center; - else if (pCtlMode[ctlMode] & EXT_ADDITIVE) - freq = centers.ext_center; - else - freq = centers.ctl_center; - - ath_dbg(common, REGULATORY, - "LOOP-Mode ctlMode %d < %d, isHt40CtlMode %d, EXT_ADDITIVE %d\n", - ctlMode, numCtlModes, isHt40CtlMode, - (pCtlMode[ctlMode] & EXT_ADDITIVE)); - - /* walk through each CTL index stored in EEPROM */ - if (is2ghz) { - ctlIndex = pEepData->ctlIndex_2G; - ctlNum = AR9300_NUM_CTLS_2G; - } else { - ctlIndex = pEepData->ctlIndex_5G; - ctlNum = AR9300_NUM_CTLS_5G; - } - - twiceMaxEdgePower = MAX_RATE_POWER; - for (i = 0; (i < ctlNum) && ctlIndex[i]; i++) { - ath_dbg(common, REGULATORY, - "LOOP-Ctlidx %d: cfgCtl 0x%2.2x pCtlMode 0x%2.2x ctlIndex 0x%2.2x chan %d\n", - i, cfgCtl, pCtlMode[ctlMode], ctlIndex[i], - chan->channel); - - /* - * compare test group from regulatory - * channel list with test mode from pCtlMode - * list - */ - if ((((cfgCtl & ~CTL_MODE_M) | - (pCtlMode[ctlMode] & CTL_MODE_M)) == - ctlIndex[i]) || - (((cfgCtl & ~CTL_MODE_M) | - (pCtlMode[ctlMode] & CTL_MODE_M)) == - ((ctlIndex[i] & CTL_MODE_M) | - SD_NO_CTL))) { - twiceMinEdgePower = - ar9003_hw_get_max_edge_power(pEepData, - freq, i, - is2ghz); - - if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL) - /* - * Find the minimum of all CTL - * edge powers that apply to - * this channel - */ - twiceMaxEdgePower = - min(twiceMaxEdgePower, - twiceMinEdgePower); - else { - /* specific */ - twiceMaxEdgePower = twiceMinEdgePower; - break; - } - } - } - - minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower); - - ath_dbg(common, REGULATORY, - "SEL-Min ctlMode %d pCtlMode %d 2xMaxEdge %d sP %d minCtlPwr %d\n", - ctlMode, pCtlMode[ctlMode], twiceMaxEdgePower, - scaledPower, minCtlPower); - - /* Apply ctl mode to correct target power set */ - switch (pCtlMode[ctlMode]) { - case CTL_11B: - for (i = ALL_TARGET_LEGACY_1L_5L; - i <= ALL_TARGET_LEGACY_11S; i++) - pPwrArray[i] = (u8)min((u16)pPwrArray[i], - minCtlPower); - break; - case CTL_11A: - case CTL_11G: - for (i = ALL_TARGET_LEGACY_6_24; - i <= ALL_TARGET_LEGACY_54; i++) - pPwrArray[i] = (u8)min((u16)pPwrArray[i], - minCtlPower); - break; - case CTL_5GHT20: - case CTL_2GHT20: - for (i = ALL_TARGET_HT20_0_8_16; - i <= ALL_TARGET_HT20_23; i++) { - pPwrArray[i] = (u8)min((u16)pPwrArray[i], - minCtlPower); - if (ath9k_hw_mci_is_enabled(ah)) - pPwrArray[i] = - (u8)min((u16)pPwrArray[i], - ar9003_mci_get_max_txpower(ah, - pCtlMode[ctlMode])); - } - break; - case CTL_5GHT40: - case CTL_2GHT40: - for (i = ALL_TARGET_HT40_0_8_16; - i <= ALL_TARGET_HT40_23; i++) { - pPwrArray[i] = (u8)min((u16)pPwrArray[i], - minCtlPower); - if (ath9k_hw_mci_is_enabled(ah)) - pPwrArray[i] = - (u8)min((u16)pPwrArray[i], - ar9003_mci_get_max_txpower(ah, - pCtlMode[ctlMode])); - } - break; - default: - break; - } - } /* end ctl mode checking */ -} - -static inline u8 mcsidx_to_tgtpwridx(unsigned int mcs_idx, u8 base_pwridx) -{ - u8 mod_idx = mcs_idx % 8; - - if (mod_idx <= 3) - return mod_idx ? (base_pwridx + 1) : base_pwridx; - else - return base_pwridx + 4 * (mcs_idx / 8) + mod_idx - 2; -} - -static void ar9003_paprd_set_txpower(struct ath_hw *ah, - struct ath9k_channel *chan, - u8 *targetPowerValT2) -{ - int i; - - if (!ar9003_is_paprd_enabled(ah)) - return; - - if (IS_CHAN_HT40(chan)) - i = ALL_TARGET_HT40_7; - else - i = ALL_TARGET_HT20_7; - - if (IS_CHAN_2GHZ(chan)) { - if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && - !AR_SREV_9462(ah) && !AR_SREV_9565(ah)) { - if (IS_CHAN_HT40(chan)) - i = ALL_TARGET_HT40_0_8_16; - else - i = ALL_TARGET_HT20_0_8_16; - } - } - - ah->paprd_target_power = targetPowerValT2[i]; -} - -static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah, - struct ath9k_channel *chan, u16 cfgCtl, - u8 twiceAntennaReduction, - u8 powerLimit, bool test) -{ - struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); - struct ath_common *common = ath9k_hw_common(ah); - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - struct ar9300_modal_eep_header *modal_hdr; - u8 targetPowerValT2[ar9300RateSize]; - u8 target_power_val_t2_eep[ar9300RateSize]; - unsigned int i = 0, paprd_scale_factor = 0; - u8 pwr_idx, min_pwridx = 0; - - memset(targetPowerValT2, 0 , sizeof(targetPowerValT2)); - - /* - * Get target powers from EEPROM - our baseline for TX Power - */ - ar9003_hw_get_target_power_eeprom(ah, chan, targetPowerValT2); - - if (ar9003_is_paprd_enabled(ah)) { - if (IS_CHAN_2GHZ(chan)) - modal_hdr = &eep->modalHeader2G; - else - modal_hdr = &eep->modalHeader5G; - - ah->paprd_ratemask = - le32_to_cpu(modal_hdr->papdRateMaskHt20) & - AR9300_PAPRD_RATE_MASK; - - ah->paprd_ratemask_ht40 = - le32_to_cpu(modal_hdr->papdRateMaskHt40) & - AR9300_PAPRD_RATE_MASK; - - paprd_scale_factor = ar9003_get_paprd_scale_factor(ah, chan); - min_pwridx = IS_CHAN_HT40(chan) ? ALL_TARGET_HT40_0_8_16 : - ALL_TARGET_HT20_0_8_16; - - if (!ah->paprd_table_write_done) { - memcpy(target_power_val_t2_eep, targetPowerValT2, - sizeof(targetPowerValT2)); - for (i = 0; i < 24; i++) { - pwr_idx = mcsidx_to_tgtpwridx(i, min_pwridx); - if (ah->paprd_ratemask & (1 << i)) { - if (targetPowerValT2[pwr_idx] && - targetPowerValT2[pwr_idx] == - target_power_val_t2_eep[pwr_idx]) - targetPowerValT2[pwr_idx] -= - paprd_scale_factor; - } - } - } - memcpy(target_power_val_t2_eep, targetPowerValT2, - sizeof(targetPowerValT2)); - } - - ar9003_hw_set_power_per_rate_table(ah, chan, - targetPowerValT2, cfgCtl, - twiceAntennaReduction, - powerLimit); - - if (ar9003_is_paprd_enabled(ah)) { - for (i = 0; i < ar9300RateSize; i++) { - if ((ah->paprd_ratemask & (1 << i)) && - (abs(targetPowerValT2[i] - - target_power_val_t2_eep[i]) > - paprd_scale_factor)) { - ah->paprd_ratemask &= ~(1 << i); - ath_dbg(common, EEPROM, - "paprd disabled for mcs %d\n", i); - } - } - } - - regulatory->max_power_level = 0; - for (i = 0; i < ar9300RateSize; i++) { - if (targetPowerValT2[i] > regulatory->max_power_level) - regulatory->max_power_level = targetPowerValT2[i]; - } - - ath9k_hw_update_regulatory_maxpower(ah); - - if (test) - return; - - for (i = 0; i < ar9300RateSize; i++) { - ath_dbg(common, EEPROM, "TPC[%02d] 0x%08x\n", - i, targetPowerValT2[i]); - } - - /* Write target power array to registers */ - ar9003_hw_tx_power_regwrite(ah, targetPowerValT2); - ar9003_hw_calibration_apply(ah, chan->channel); - ar9003_paprd_set_txpower(ah, chan, targetPowerValT2); -} - -static u16 ath9k_hw_ar9300_get_spur_channel(struct ath_hw *ah, - u16 i, bool is2GHz) -{ - return AR_NO_SPUR; -} - -s32 ar9003_hw_get_tx_gain_idx(struct ath_hw *ah) -{ - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - - return (eep->baseEepHeader.txrxgain >> 4) & 0xf; /* bits 7:4 */ -} - -s32 ar9003_hw_get_rx_gain_idx(struct ath_hw *ah) -{ - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - - return (eep->baseEepHeader.txrxgain) & 0xf; /* bits 3:0 */ -} - -u8 *ar9003_get_spur_chan_ptr(struct ath_hw *ah, bool is2ghz) -{ - return ar9003_modal_header(ah, is2ghz)->spurChans; -} - -unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - - if (IS_CHAN_2GHZ(chan)) - return MS(le32_to_cpu(eep->modalHeader2G.papdRateMaskHt20), - AR9300_PAPRD_SCALE_1); - else { - if (chan->channel >= 5700) - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20), - AR9300_PAPRD_SCALE_1); - else if (chan->channel >= 5400) - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40), - AR9300_PAPRD_SCALE_2); - else - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40), - AR9300_PAPRD_SCALE_1); - } -} - -const struct eeprom_ops eep_ar9300_ops = { - .check_eeprom = ath9k_hw_ar9300_check_eeprom, - .get_eeprom = ath9k_hw_ar9300_get_eeprom, - .fill_eeprom = ath9k_hw_ar9300_fill_eeprom, - .dump_eeprom = ath9k_hw_ar9003_dump_eeprom, - .get_eeprom_ver = ath9k_hw_ar9300_get_eeprom_ver, - .get_eeprom_rev = ath9k_hw_ar9300_get_eeprom_rev, - .set_board_values = ath9k_hw_ar9300_set_board_values, - .set_addac = ath9k_hw_ar9300_set_addac, - .set_txpower = ath9k_hw_ar9300_set_txpower, - .get_spur_channel = ath9k_hw_ar9300_get_spur_channel -}; diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h deleted file mode 100644 index 874f6570bd1c..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h +++ /dev/null @@ -1,345 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef AR9003_EEPROM_H -#define AR9003_EEPROM_H - -#include - -#define AR9300_EEP_VER 0xD000 -#define AR9300_EEP_VER_MINOR_MASK 0xFFF -#define AR9300_EEP_MINOR_VER_1 0x1 -#define AR9300_EEP_MINOR_VER AR9300_EEP_MINOR_VER_1 - -/* 16-bit offset location start of calibration struct */ -#define AR9300_EEP_START_LOC 256 -#define AR9300_NUM_5G_CAL_PIERS 8 -#define AR9300_NUM_2G_CAL_PIERS 3 -#define AR9300_NUM_5G_20_TARGET_POWERS 8 -#define AR9300_NUM_5G_40_TARGET_POWERS 8 -#define AR9300_NUM_2G_CCK_TARGET_POWERS 2 -#define AR9300_NUM_2G_20_TARGET_POWERS 3 -#define AR9300_NUM_2G_40_TARGET_POWERS 3 -/* #define AR9300_NUM_CTLS 21 */ -#define AR9300_NUM_CTLS_5G 9 -#define AR9300_NUM_CTLS_2G 12 -#define AR9300_NUM_BAND_EDGES_5G 8 -#define AR9300_NUM_BAND_EDGES_2G 4 -#define AR9300_EEPMISC_BIG_ENDIAN 0x01 -#define AR9300_EEPMISC_WOW 0x02 -#define AR9300_CUSTOMER_DATA_SIZE 20 - -#define AR9300_MAX_CHAINS 3 -#define AR9300_ANT_16S 25 -#define AR9300_FUTURE_MODAL_SZ 6 - -#define AR9300_PAPRD_RATE_MASK 0x01ffffff -#define AR9300_PAPRD_SCALE_1 0x0e000000 -#define AR9300_PAPRD_SCALE_1_S 25 -#define AR9300_PAPRD_SCALE_2 0x70000000 -#define AR9300_PAPRD_SCALE_2_S 28 - -/* Delta from which to start power to pdadc table */ -/* This offset is used in both open loop and closed loop power control - * schemes. In open loop power control, it is not really needed, but for - * the "sake of consistency" it was kept. For certain AP designs, this - * value is overwritten by the value in the flag "pwrTableOffset" just - * before writing the pdadc vs pwr into the chip registers. - */ -#define AR9300_PWR_TABLE_OFFSET 0 - -/* byte addressable */ -#define AR9300_EEPROM_SIZE (16*1024) - -#define AR9300_BASE_ADDR_4K 0xfff -#define AR9300_BASE_ADDR 0x3ff -#define AR9300_BASE_ADDR_512 0x1ff - -#define AR9300_OTP_BASE \ - ((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x30000 : 0x14000) -#define AR9300_OTP_STATUS \ - ((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x30018 : 0x15f18) -#define AR9300_OTP_STATUS_TYPE 0x7 -#define AR9300_OTP_STATUS_VALID 0x4 -#define AR9300_OTP_STATUS_ACCESS_BUSY 0x2 -#define AR9300_OTP_STATUS_SM_BUSY 0x1 -#define AR9300_OTP_READ_DATA \ - ((AR_SREV_9340(ah) || AR_SREV_9550(ah)) ? 0x3001c : 0x15f1c) - -enum targetPowerHTRates { - HT_TARGET_RATE_0_8_16, - HT_TARGET_RATE_1_3_9_11_17_19, - HT_TARGET_RATE_4, - HT_TARGET_RATE_5, - HT_TARGET_RATE_6, - HT_TARGET_RATE_7, - HT_TARGET_RATE_12, - HT_TARGET_RATE_13, - HT_TARGET_RATE_14, - HT_TARGET_RATE_15, - HT_TARGET_RATE_20, - HT_TARGET_RATE_21, - HT_TARGET_RATE_22, - HT_TARGET_RATE_23 -}; - -enum targetPowerLegacyRates { - LEGACY_TARGET_RATE_6_24, - LEGACY_TARGET_RATE_36, - LEGACY_TARGET_RATE_48, - LEGACY_TARGET_RATE_54 -}; - -enum targetPowerCckRates { - LEGACY_TARGET_RATE_1L_5L, - LEGACY_TARGET_RATE_5S, - LEGACY_TARGET_RATE_11L, - LEGACY_TARGET_RATE_11S -}; - -enum ar9300_Rates { - ALL_TARGET_LEGACY_6_24, - ALL_TARGET_LEGACY_36, - ALL_TARGET_LEGACY_48, - ALL_TARGET_LEGACY_54, - ALL_TARGET_LEGACY_1L_5L, - ALL_TARGET_LEGACY_5S, - ALL_TARGET_LEGACY_11L, - ALL_TARGET_LEGACY_11S, - ALL_TARGET_HT20_0_8_16, - ALL_TARGET_HT20_1_3_9_11_17_19, - ALL_TARGET_HT20_4, - ALL_TARGET_HT20_5, - ALL_TARGET_HT20_6, - ALL_TARGET_HT20_7, - ALL_TARGET_HT20_12, - ALL_TARGET_HT20_13, - ALL_TARGET_HT20_14, - ALL_TARGET_HT20_15, - ALL_TARGET_HT20_20, - ALL_TARGET_HT20_21, - ALL_TARGET_HT20_22, - ALL_TARGET_HT20_23, - ALL_TARGET_HT40_0_8_16, - ALL_TARGET_HT40_1_3_9_11_17_19, - ALL_TARGET_HT40_4, - ALL_TARGET_HT40_5, - ALL_TARGET_HT40_6, - ALL_TARGET_HT40_7, - ALL_TARGET_HT40_12, - ALL_TARGET_HT40_13, - ALL_TARGET_HT40_14, - ALL_TARGET_HT40_15, - ALL_TARGET_HT40_20, - ALL_TARGET_HT40_21, - ALL_TARGET_HT40_22, - ALL_TARGET_HT40_23, - ar9300RateSize, -}; - - -struct eepFlags { - u8 opFlags; - u8 eepMisc; -} __packed; - -enum CompressAlgorithm { - _CompressNone = 0, - _CompressLzma, - _CompressPairs, - _CompressBlock, - _Compress4, - _Compress5, - _Compress6, - _Compress7, -}; - -struct ar9300_base_eep_hdr { - __le16 regDmn[2]; - /* 4 bits tx and 4 bits rx */ - u8 txrxMask; - struct eepFlags opCapFlags; - u8 rfSilent; - u8 blueToothOptions; - u8 deviceCap; - /* takes lower byte in eeprom location */ - u8 deviceType; - /* offset in dB to be added to beginning - * of pdadc table in calibration - */ - int8_t pwrTableOffset; - u8 params_for_tuning_caps[2]; - /* - * bit0 - enable tx temp comp - * bit1 - enable tx volt comp - * bit2 - enable fastClock - default to 1 - * bit3 - enable doubling - default to 1 - * bit4 - enable internal regulator - default to 1 - */ - u8 featureEnable; - /* misc flags: bit0 - turn down drivestrength */ - u8 miscConfiguration; - u8 eepromWriteEnableGpio; - u8 wlanDisableGpio; - u8 wlanLedGpio; - u8 rxBandSelectGpio; - u8 txrxgain; - /* SW controlled internal regulator fields */ - __le32 swreg; -} __packed; - -struct ar9300_modal_eep_header { - /* 4 idle, t1, t2, b (4 bits per setting) */ - __le32 antCtrlCommon; - /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */ - __le32 antCtrlCommon2; - /* 6 idle, t, r, rx1, rx12, b (2 bits each) */ - __le16 antCtrlChain[AR9300_MAX_CHAINS]; - /* 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */ - u8 xatten1DB[AR9300_MAX_CHAINS]; - /* 3 xatten1_margin for merlin (0xa20c/b20c 16:12 */ - u8 xatten1Margin[AR9300_MAX_CHAINS]; - int8_t tempSlope; - int8_t voltSlope; - /* spur channels in usual fbin coding format */ - u8 spurChans[AR_EEPROM_MODAL_SPURS]; - /* 3 Check if the register is per chain */ - int8_t noiseFloorThreshCh[AR9300_MAX_CHAINS]; - u8 reserved[11]; - int8_t quick_drop; - u8 xpaBiasLvl; - u8 txFrameToDataStart; - u8 txFrameToPaOn; - u8 txClip; - int8_t antennaGain; - u8 switchSettling; - int8_t adcDesiredSize; - u8 txEndToXpaOff; - u8 txEndToRxOn; - u8 txFrameToXpaOn; - u8 thresh62; - __le32 papdRateMaskHt20; - __le32 papdRateMaskHt40; - __le16 switchcomspdt; - u8 xlna_bias_strength; - u8 futureModal[7]; -} __packed; - -struct ar9300_cal_data_per_freq_op_loop { - int8_t refPower; - /* pdadc voltage at power measurement */ - u8 voltMeas; - /* pcdac used for power measurement */ - u8 tempMeas; - /* range is -60 to -127 create a mapping equation 1db resolution */ - int8_t rxNoisefloorCal; - /*range is same as noisefloor */ - int8_t rxNoisefloorPower; - /* temp measured when noisefloor cal was performed */ - u8 rxTempMeas; -} __packed; - -struct cal_tgt_pow_legacy { - u8 tPow2x[4]; -} __packed; - -struct cal_tgt_pow_ht { - u8 tPow2x[14]; -} __packed; - -struct cal_ctl_data_2g { - u8 ctlEdges[AR9300_NUM_BAND_EDGES_2G]; -} __packed; - -struct cal_ctl_data_5g { - u8 ctlEdges[AR9300_NUM_BAND_EDGES_5G]; -} __packed; - -struct ar9300_BaseExtension_1 { - u8 ant_div_control; - u8 future[3]; - u8 tempslopextension[8]; - int8_t quick_drop_low; - int8_t quick_drop_high; -} __packed; - -struct ar9300_BaseExtension_2 { - int8_t tempSlopeLow; - int8_t tempSlopeHigh; - u8 xatten1DBLow[AR9300_MAX_CHAINS]; - u8 xatten1MarginLow[AR9300_MAX_CHAINS]; - u8 xatten1DBHigh[AR9300_MAX_CHAINS]; - u8 xatten1MarginHigh[AR9300_MAX_CHAINS]; -} __packed; - -struct ar9300_eeprom { - u8 eepromVersion; - u8 templateVersion; - u8 macAddr[6]; - u8 custData[AR9300_CUSTOMER_DATA_SIZE]; - - struct ar9300_base_eep_hdr baseEepHeader; - - struct ar9300_modal_eep_header modalHeader2G; - struct ar9300_BaseExtension_1 base_ext1; - u8 calFreqPier2G[AR9300_NUM_2G_CAL_PIERS]; - struct ar9300_cal_data_per_freq_op_loop - calPierData2G[AR9300_MAX_CHAINS][AR9300_NUM_2G_CAL_PIERS]; - u8 calTarget_freqbin_Cck[AR9300_NUM_2G_CCK_TARGET_POWERS]; - u8 calTarget_freqbin_2G[AR9300_NUM_2G_20_TARGET_POWERS]; - u8 calTarget_freqbin_2GHT20[AR9300_NUM_2G_20_TARGET_POWERS]; - u8 calTarget_freqbin_2GHT40[AR9300_NUM_2G_40_TARGET_POWERS]; - struct cal_tgt_pow_legacy - calTargetPowerCck[AR9300_NUM_2G_CCK_TARGET_POWERS]; - struct cal_tgt_pow_legacy - calTargetPower2G[AR9300_NUM_2G_20_TARGET_POWERS]; - struct cal_tgt_pow_ht - calTargetPower2GHT20[AR9300_NUM_2G_20_TARGET_POWERS]; - struct cal_tgt_pow_ht - calTargetPower2GHT40[AR9300_NUM_2G_40_TARGET_POWERS]; - u8 ctlIndex_2G[AR9300_NUM_CTLS_2G]; - u8 ctl_freqbin_2G[AR9300_NUM_CTLS_2G][AR9300_NUM_BAND_EDGES_2G]; - struct cal_ctl_data_2g ctlPowerData_2G[AR9300_NUM_CTLS_2G]; - struct ar9300_modal_eep_header modalHeader5G; - struct ar9300_BaseExtension_2 base_ext2; - u8 calFreqPier5G[AR9300_NUM_5G_CAL_PIERS]; - struct ar9300_cal_data_per_freq_op_loop - calPierData5G[AR9300_MAX_CHAINS][AR9300_NUM_5G_CAL_PIERS]; - u8 calTarget_freqbin_5G[AR9300_NUM_5G_20_TARGET_POWERS]; - u8 calTarget_freqbin_5GHT20[AR9300_NUM_5G_20_TARGET_POWERS]; - u8 calTarget_freqbin_5GHT40[AR9300_NUM_5G_40_TARGET_POWERS]; - struct cal_tgt_pow_legacy - calTargetPower5G[AR9300_NUM_5G_20_TARGET_POWERS]; - struct cal_tgt_pow_ht - calTargetPower5GHT20[AR9300_NUM_5G_20_TARGET_POWERS]; - struct cal_tgt_pow_ht - calTargetPower5GHT40[AR9300_NUM_5G_40_TARGET_POWERS]; - u8 ctlIndex_5G[AR9300_NUM_CTLS_5G]; - u8 ctl_freqbin_5G[AR9300_NUM_CTLS_5G][AR9300_NUM_BAND_EDGES_5G]; - struct cal_ctl_data_5g ctlPowerData_5G[AR9300_NUM_CTLS_5G]; -} __packed; - -s32 ar9003_hw_get_tx_gain_idx(struct ath_hw *ah); -s32 ar9003_hw_get_rx_gain_idx(struct ath_hw *ah); - -u8 *ar9003_get_spur_chan_ptr(struct ath_hw *ah, bool is_2ghz); - -unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah, - struct ath9k_channel *chan); - -void ar9003_hw_internal_regulator_apply(struct ath_hw *ah); - -#endif diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c deleted file mode 100644 index a3523c969a3a..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c +++ /dev/null @@ -1,715 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "hw.h" -#include "ar9003_mac.h" -#include "ar9003_2p2_initvals.h" -#include "ar9485_initvals.h" -#include "ar9340_initvals.h" -#include "ar9330_1p1_initvals.h" -#include "ar9330_1p2_initvals.h" -#include "ar955x_1p0_initvals.h" -#include "ar9580_1p0_initvals.h" -#include "ar9462_2p0_initvals.h" -#include "ar9565_1p0_initvals.h" - -/* General hardware code for the AR9003 hadware family */ - -/* - * The AR9003 family uses a new INI format (pre, core, post - * arrays per subsystem). This provides support for the - * AR9003 2.2 chipsets. - */ -static void ar9003_hw_init_mode_regs(struct ath_hw *ah) -{ - if (AR_SREV_9330_11(ah)) { - /* mac */ - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], - ar9331_1p1_mac_core); - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], - ar9331_1p1_mac_postamble); - - /* bb */ - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], - ar9331_1p1_baseband_core); - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], - ar9331_1p1_baseband_postamble); - - /* radio */ - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], - ar9331_1p1_radio_core); - - /* soc */ - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], - ar9331_1p1_soc_preamble); - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], - ar9331_1p1_soc_postamble); - - /* rx/tx gain */ - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9331_common_rx_gain_1p1); - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9331_modes_lowest_ob_db_tx_gain_1p1); - - /* Japan 2484 Mhz CCK */ - INIT_INI_ARRAY(&ah->iniCckfirJapan2484, - ar9331_1p1_baseband_core_txfir_coeff_japan_2484); - - /* additional clock settings */ - if (ah->is_clk_25mhz) - INIT_INI_ARRAY(&ah->iniAdditional, - ar9331_1p1_xtal_25M); - else - INIT_INI_ARRAY(&ah->iniAdditional, - ar9331_1p1_xtal_40M); - } else if (AR_SREV_9330_12(ah)) { - /* mac */ - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], - ar9331_1p2_mac_core); - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], - ar9331_1p2_mac_postamble); - - /* bb */ - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], - ar9331_1p2_baseband_core); - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], - ar9331_1p2_baseband_postamble); - - /* radio */ - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], - ar9331_1p2_radio_core); - - /* soc */ - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], - ar9331_1p2_soc_preamble); - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], - ar9331_1p2_soc_postamble); - - /* rx/tx gain */ - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9331_common_rx_gain_1p2); - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9331_modes_lowest_ob_db_tx_gain_1p2); - - /* Japan 2484 Mhz CCK */ - INIT_INI_ARRAY(&ah->iniCckfirJapan2484, - ar9331_1p2_baseband_core_txfir_coeff_japan_2484); - - /* additional clock settings */ - if (ah->is_clk_25mhz) - INIT_INI_ARRAY(&ah->iniAdditional, - ar9331_1p2_xtal_25M); - else - INIT_INI_ARRAY(&ah->iniAdditional, - ar9331_1p2_xtal_40M); - } else if (AR_SREV_9340(ah)) { - /* mac */ - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], - ar9340_1p0_mac_core); - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], - ar9340_1p0_mac_postamble); - - /* bb */ - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], - ar9340_1p0_baseband_core); - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], - ar9340_1p0_baseband_postamble); - - /* radio */ - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], - ar9340_1p0_radio_core); - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], - ar9340_1p0_radio_postamble); - - /* soc */ - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], - ar9340_1p0_soc_preamble); - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], - ar9340_1p0_soc_postamble); - - /* rx/tx gain */ - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9340Common_wo_xlna_rx_gain_table_1p0); - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9340Modes_high_ob_db_tx_gain_table_1p0); - - INIT_INI_ARRAY(&ah->iniModesFastClock, - ar9340Modes_fast_clock_1p0); - - if (!ah->is_clk_25mhz) - INIT_INI_ARRAY(&ah->iniAdditional, - ar9340_1p0_radio_core_40M); - } else if (AR_SREV_9485_11(ah)) { - /* mac */ - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], - ar9485_1_1_mac_core); - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], - ar9485_1_1_mac_postamble); - - /* bb */ - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], ar9485_1_1); - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], - ar9485_1_1_baseband_core); - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], - ar9485_1_1_baseband_postamble); - - /* radio */ - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], - ar9485_1_1_radio_core); - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], - ar9485_1_1_radio_postamble); - - /* soc */ - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], - ar9485_1_1_soc_preamble); - - /* rx/tx gain */ - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9485Common_wo_xlna_rx_gain_1_1); - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9485_modes_lowest_ob_db_tx_gain_1_1); - - /* Japan 2484 Mhz CCK */ - INIT_INI_ARRAY(&ah->iniCckfirJapan2484, - ar9485_1_1_baseband_core_txfir_coeff_japan_2484); - - /* Load PCIE SERDES settings from INI */ - - /* Awake Setting */ - - INIT_INI_ARRAY(&ah->iniPcieSerdes, - ar9485_1_1_pcie_phy_clkreq_disable_L1); - - /* Sleep Setting */ - - INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, - ar9485_1_1_pcie_phy_clkreq_disable_L1); - } else if (AR_SREV_9462_20(ah)) { - - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], ar9462_2p0_mac_core); - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], - ar9462_2p0_mac_postamble); - - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], - ar9462_2p0_baseband_core); - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], - ar9462_2p0_baseband_postamble); - - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], - ar9462_2p0_radio_core); - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], - ar9462_2p0_radio_postamble); - INIT_INI_ARRAY(&ah->ini_radio_post_sys2ant, - ar9462_2p0_radio_postamble_sys2ant); - - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], - ar9462_2p0_soc_preamble); - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], - ar9462_2p0_soc_postamble); - - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9462_common_rx_gain_table_2p0); - - /* Awake -> Sleep Setting */ - INIT_INI_ARRAY(&ah->iniPcieSerdes, - ar9462_pciephy_clkreq_disable_L1_2p0); - /* Sleep -> Awake Setting */ - INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, - ar9462_pciephy_clkreq_disable_L1_2p0); - - /* Fast clock modal settings */ - INIT_INI_ARRAY(&ah->iniModesFastClock, - ar9462_modes_fast_clock_2p0); - - INIT_INI_ARRAY(&ah->iniCckfirJapan2484, - ar9462_2p0_baseband_core_txfir_coeff_japan_2484); - } else if (AR_SREV_9550(ah)) { - /* mac */ - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], - ar955x_1p0_mac_core); - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], - ar955x_1p0_mac_postamble); - - /* bb */ - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], - ar955x_1p0_baseband_core); - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], - ar955x_1p0_baseband_postamble); - - /* radio */ - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], - ar955x_1p0_radio_core); - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], - ar955x_1p0_radio_postamble); - - /* soc */ - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], - ar955x_1p0_soc_preamble); - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], - ar955x_1p0_soc_postamble); - - /* rx/tx gain */ - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar955x_1p0_common_wo_xlna_rx_gain_table); - INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds, - ar955x_1p0_common_wo_xlna_rx_gain_bounds); - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar955x_1p0_modes_xpa_tx_gain_table); - - /* Fast clock modal settings */ - INIT_INI_ARRAY(&ah->iniModesFastClock, - ar955x_1p0_modes_fast_clock); - } else if (AR_SREV_9580(ah)) { - /* mac */ - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], - ar9580_1p0_mac_core); - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], - ar9580_1p0_mac_postamble); - - /* bb */ - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], - ar9580_1p0_baseband_core); - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], - ar9580_1p0_baseband_postamble); - - /* radio */ - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], - ar9580_1p0_radio_core); - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], - ar9580_1p0_radio_postamble); - - /* soc */ - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], - ar9580_1p0_soc_preamble); - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], - ar9580_1p0_soc_postamble); - - /* rx/tx gain */ - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9580_1p0_rx_gain_table); - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9580_1p0_low_ob_db_tx_gain_table); - - INIT_INI_ARRAY(&ah->iniModesFastClock, - ar9580_1p0_modes_fast_clock); - } else if (AR_SREV_9565(ah)) { - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], - ar9565_1p0_mac_core); - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], - ar9565_1p0_mac_postamble); - - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], - ar9565_1p0_baseband_core); - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], - ar9565_1p0_baseband_postamble); - - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], - ar9565_1p0_radio_core); - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], - ar9565_1p0_radio_postamble); - - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], - ar9565_1p0_soc_preamble); - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], - ar9565_1p0_soc_postamble); - - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9565_1p0_Common_rx_gain_table); - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9565_1p0_Modes_lowest_ob_db_tx_gain_table); - - INIT_INI_ARRAY(&ah->iniPcieSerdes, - ar9565_1p0_pciephy_clkreq_disable_L1); - INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, - ar9565_1p0_pciephy_clkreq_disable_L1); - - INIT_INI_ARRAY(&ah->iniModesFastClock, - ar9565_1p0_modes_fast_clock); - } else { - /* mac */ - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], - ar9300_2p2_mac_core); - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], - ar9300_2p2_mac_postamble); - - /* bb */ - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], - ar9300_2p2_baseband_core); - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], - ar9300_2p2_baseband_postamble); - - /* radio */ - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], - ar9300_2p2_radio_core); - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], - ar9300_2p2_radio_postamble); - - /* soc */ - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], - ar9300_2p2_soc_preamble); - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], - ar9300_2p2_soc_postamble); - - /* rx/tx gain */ - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9300Common_rx_gain_table_2p2); - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9300Modes_lowest_ob_db_tx_gain_table_2p2); - - /* Load PCIE SERDES settings from INI */ - - /* Awake Setting */ - - INIT_INI_ARRAY(&ah->iniPcieSerdes, - ar9300PciePhy_pll_on_clkreq_disable_L1_2p2); - - /* Sleep Setting */ - - INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, - ar9300PciePhy_pll_on_clkreq_disable_L1_2p2); - - /* Fast clock modal settings */ - INIT_INI_ARRAY(&ah->iniModesFastClock, - ar9300Modes_fast_clock_2p2); - } -} - -static void ar9003_tx_gain_table_mode0(struct ath_hw *ah) -{ - if (AR_SREV_9330_12(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9331_modes_lowest_ob_db_tx_gain_1p2); - else if (AR_SREV_9330_11(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9331_modes_lowest_ob_db_tx_gain_1p1); - else if (AR_SREV_9340(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9340Modes_lowest_ob_db_tx_gain_table_1p0); - else if (AR_SREV_9485_11(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9485_modes_lowest_ob_db_tx_gain_1_1); - else if (AR_SREV_9550(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar955x_1p0_modes_xpa_tx_gain_table); - else if (AR_SREV_9580(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9580_1p0_lowest_ob_db_tx_gain_table); - else if (AR_SREV_9462_20(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9462_modes_low_ob_db_tx_gain_table_2p0); - else if (AR_SREV_9565(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9565_1p0_modes_low_ob_db_tx_gain_table); - else - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9300Modes_lowest_ob_db_tx_gain_table_2p2); -} - -static void ar9003_tx_gain_table_mode1(struct ath_hw *ah) -{ - if (AR_SREV_9330_12(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9331_modes_high_ob_db_tx_gain_1p2); - else if (AR_SREV_9330_11(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9331_modes_high_ob_db_tx_gain_1p1); - else if (AR_SREV_9340(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9340Modes_high_ob_db_tx_gain_table_1p0); - else if (AR_SREV_9485_11(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9485Modes_high_ob_db_tx_gain_1_1); - else if (AR_SREV_9580(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9580_1p0_high_ob_db_tx_gain_table); - else if (AR_SREV_9550(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar955x_1p0_modes_no_xpa_tx_gain_table); - else if (AR_SREV_9462_20(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9462_modes_high_ob_db_tx_gain_table_2p0); - else if (AR_SREV_9565(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9565_1p0_modes_high_ob_db_tx_gain_table); - else - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9300Modes_high_ob_db_tx_gain_table_2p2); -} - -static void ar9003_tx_gain_table_mode2(struct ath_hw *ah) -{ - if (AR_SREV_9330_12(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9331_modes_low_ob_db_tx_gain_1p2); - else if (AR_SREV_9330_11(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9331_modes_low_ob_db_tx_gain_1p1); - else if (AR_SREV_9340(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9340Modes_low_ob_db_tx_gain_table_1p0); - else if (AR_SREV_9485_11(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9485Modes_low_ob_db_tx_gain_1_1); - else if (AR_SREV_9580(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9580_1p0_low_ob_db_tx_gain_table); - else if (AR_SREV_9565(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9565_1p0_modes_low_ob_db_tx_gain_table); - else - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9300Modes_low_ob_db_tx_gain_table_2p2); -} - -static void ar9003_tx_gain_table_mode3(struct ath_hw *ah) -{ - if (AR_SREV_9330_12(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9331_modes_high_power_tx_gain_1p2); - else if (AR_SREV_9330_11(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9331_modes_high_power_tx_gain_1p1); - else if (AR_SREV_9340(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9340Modes_high_power_tx_gain_table_1p0); - else if (AR_SREV_9485_11(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9485Modes_high_power_tx_gain_1_1); - else if (AR_SREV_9580(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9580_1p0_high_power_tx_gain_table); - else if (AR_SREV_9565(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9565_1p0_modes_high_power_tx_gain_table); - else - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9300Modes_high_power_tx_gain_table_2p2); -} - -static void ar9003_tx_gain_table_mode4(struct ath_hw *ah) -{ - if (AR_SREV_9340(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9340Modes_mixed_ob_db_tx_gain_table_1p0); - else if (AR_SREV_9580(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9580_1p0_mixed_ob_db_tx_gain_table); - else - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9300Modes_mixed_ob_db_tx_gain_table_2p2); -} - -static void ar9003_tx_gain_table_mode5(struct ath_hw *ah) -{ - if (AR_SREV_9485_11(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9485Modes_green_ob_db_tx_gain_1_1); - else if (AR_SREV_9340(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9340Modes_ub124_tx_gain_table_1p0); - else if (AR_SREV_9580(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9580_1p0_type5_tx_gain_table); - else if (AR_SREV_9300_22(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9300Modes_type5_tx_gain_table_2p2); -} - -static void ar9003_tx_gain_table_mode6(struct ath_hw *ah) -{ - if (AR_SREV_9340(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9340Modes_low_ob_db_and_spur_tx_gain_table_1p0); - else if (AR_SREV_9485_11(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9485Modes_green_spur_ob_db_tx_gain_1_1); - else if (AR_SREV_9580(ah)) - INIT_INI_ARRAY(&ah->iniModesTxGain, - ar9580_1p0_type6_tx_gain_table); -} - -typedef void (*ath_txgain_tab)(struct ath_hw *ah); - -static void ar9003_tx_gain_table_apply(struct ath_hw *ah) -{ - static const ath_txgain_tab modes[] = { - ar9003_tx_gain_table_mode0, - ar9003_tx_gain_table_mode1, - ar9003_tx_gain_table_mode2, - ar9003_tx_gain_table_mode3, - ar9003_tx_gain_table_mode4, - ar9003_tx_gain_table_mode5, - ar9003_tx_gain_table_mode6, - }; - int idx = ar9003_hw_get_tx_gain_idx(ah); - - if (idx >= ARRAY_SIZE(modes)) - idx = 0; - - modes[idx](ah); -} - -static void ar9003_rx_gain_table_mode0(struct ath_hw *ah) -{ - if (AR_SREV_9330_12(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9331_common_rx_gain_1p2); - else if (AR_SREV_9330_11(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9331_common_rx_gain_1p1); - else if (AR_SREV_9340(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9340Common_rx_gain_table_1p0); - else if (AR_SREV_9485_11(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9485_common_rx_gain_1_1); - else if (AR_SREV_9550(ah)) { - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar955x_1p0_common_rx_gain_table); - INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds, - ar955x_1p0_common_rx_gain_bounds); - } else if (AR_SREV_9580(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9580_1p0_rx_gain_table); - else if (AR_SREV_9462_20(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9462_common_rx_gain_table_2p0); - else - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9300Common_rx_gain_table_2p2); -} - -static void ar9003_rx_gain_table_mode1(struct ath_hw *ah) -{ - if (AR_SREV_9330_12(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9331_common_wo_xlna_rx_gain_1p2); - else if (AR_SREV_9330_11(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9331_common_wo_xlna_rx_gain_1p1); - else if (AR_SREV_9340(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9340Common_wo_xlna_rx_gain_table_1p0); - else if (AR_SREV_9485_11(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9485Common_wo_xlna_rx_gain_1_1); - else if (AR_SREV_9462_20(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9462_common_wo_xlna_rx_gain_table_2p0); - else if (AR_SREV_9550(ah)) { - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar955x_1p0_common_wo_xlna_rx_gain_table); - INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds, - ar955x_1p0_common_wo_xlna_rx_gain_bounds); - } else if (AR_SREV_9580(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9580_1p0_wo_xlna_rx_gain_table); - else if (AR_SREV_9565(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9565_1p0_common_wo_xlna_rx_gain_table); - else - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9300Common_wo_xlna_rx_gain_table_2p2); -} - -static void ar9003_rx_gain_table_mode2(struct ath_hw *ah) -{ - if (AR_SREV_9462_20(ah)) - INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9462_common_mixed_rx_gain_table_2p0); -} - -static void ar9003_rx_gain_table_apply(struct ath_hw *ah) -{ - switch (ar9003_hw_get_rx_gain_idx(ah)) { - case 0: - default: - ar9003_rx_gain_table_mode0(ah); - break; - case 1: - ar9003_rx_gain_table_mode1(ah); - break; - case 2: - ar9003_rx_gain_table_mode2(ah); - break; - } -} - -/* set gain table pointers according to values read from the eeprom */ -static void ar9003_hw_init_mode_gain_regs(struct ath_hw *ah) -{ - ar9003_tx_gain_table_apply(ah); - ar9003_rx_gain_table_apply(ah); -} - -/* - * Helper for ASPM support. - * - * Disable PLL when in L0s as well as receiver clock when in L1. - * This power saving option must be enabled through the SerDes. - * - * Programming the SerDes must go through the same 288 bit serial shift - * register as the other analog registers. Hence the 9 writes. - */ -static void ar9003_hw_configpcipowersave(struct ath_hw *ah, - bool power_off) -{ - /* Nothing to do on restore for 11N */ - if (!power_off /* !restore */) { - /* set bit 19 to allow forcing of pcie core into L1 state */ - REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA); - - /* Several PCIe massages to ensure proper behaviour */ - if (ah->config.pcie_waen) - REG_WRITE(ah, AR_WA, ah->config.pcie_waen); - else - REG_WRITE(ah, AR_WA, ah->WARegVal); - } - - /* - * Configire PCIE after Ini init. SERDES values now come from ini file - * This enables PCIe low power mode. - */ - if (ah->config.pcieSerDesWrite) { - unsigned int i; - struct ar5416IniArray *array; - - array = power_off ? &ah->iniPcieSerdes : - &ah->iniPcieSerdesLowPower; - - for (i = 0; i < array->ia_rows; i++) { - REG_WRITE(ah, - INI_RA(array, i, 0), - INI_RA(array, i, 1)); - } - } -} - -/* Sets up the AR9003 hardware familiy callbacks */ -void ar9003_hw_attach_ops(struct ath_hw *ah) -{ - struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); - struct ath_hw_ops *ops = ath9k_hw_ops(ah); - - ar9003_hw_init_mode_regs(ah); - priv_ops->init_mode_gain_regs = ar9003_hw_init_mode_gain_regs; - - ops->config_pci_powersave = ar9003_hw_configpcipowersave; - - ar9003_hw_attach_phy_ops(ah); - ar9003_hw_attach_calib_ops(ah); - ar9003_hw_attach_mac_ops(ah); -} diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c deleted file mode 100644 index 301bf72c53bf..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c +++ /dev/null @@ -1,589 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#include -#include "hw.h" -#include "ar9003_mac.h" -#include "ar9003_mci.h" - -static void ar9003_hw_rx_enable(struct ath_hw *hw) -{ - REG_WRITE(hw, AR_CR, 0); -} - -static void -ar9003_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i) -{ - struct ar9003_txc *ads = ds; - int checksum = 0; - u32 val, ctl12, ctl17; - u8 desc_len; - - desc_len = ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x18 : 0x17); - - val = (ATHEROS_VENDOR_ID << AR_DescId_S) | - (1 << AR_TxRxDesc_S) | - (1 << AR_CtrlStat_S) | - (i->qcu << AR_TxQcuNum_S) | desc_len; - - checksum += val; - ACCESS_ONCE(ads->info) = val; - - checksum += i->link; - ACCESS_ONCE(ads->link) = i->link; - - checksum += i->buf_addr[0]; - ACCESS_ONCE(ads->data0) = i->buf_addr[0]; - checksum += i->buf_addr[1]; - ACCESS_ONCE(ads->data1) = i->buf_addr[1]; - checksum += i->buf_addr[2]; - ACCESS_ONCE(ads->data2) = i->buf_addr[2]; - checksum += i->buf_addr[3]; - ACCESS_ONCE(ads->data3) = i->buf_addr[3]; - - checksum += (val = (i->buf_len[0] << AR_BufLen_S) & AR_BufLen); - ACCESS_ONCE(ads->ctl3) = val; - checksum += (val = (i->buf_len[1] << AR_BufLen_S) & AR_BufLen); - ACCESS_ONCE(ads->ctl5) = val; - checksum += (val = (i->buf_len[2] << AR_BufLen_S) & AR_BufLen); - ACCESS_ONCE(ads->ctl7) = val; - checksum += (val = (i->buf_len[3] << AR_BufLen_S) & AR_BufLen); - ACCESS_ONCE(ads->ctl9) = val; - - checksum = (u16) (((checksum & 0xffff) + (checksum >> 16)) & 0xffff); - ACCESS_ONCE(ads->ctl10) = checksum; - - if (i->is_first || i->is_last) { - ACCESS_ONCE(ads->ctl13) = set11nTries(i->rates, 0) - | set11nTries(i->rates, 1) - | set11nTries(i->rates, 2) - | set11nTries(i->rates, 3) - | (i->dur_update ? AR_DurUpdateEna : 0) - | SM(0, AR_BurstDur); - - ACCESS_ONCE(ads->ctl14) = set11nRate(i->rates, 0) - | set11nRate(i->rates, 1) - | set11nRate(i->rates, 2) - | set11nRate(i->rates, 3); - } else { - ACCESS_ONCE(ads->ctl13) = 0; - ACCESS_ONCE(ads->ctl14) = 0; - } - - ads->ctl20 = 0; - ads->ctl21 = 0; - ads->ctl22 = 0; - ads->ctl23 = 0; - - ctl17 = SM(i->keytype, AR_EncrType); - if (!i->is_first) { - ACCESS_ONCE(ads->ctl11) = 0; - ACCESS_ONCE(ads->ctl12) = i->is_last ? 0 : AR_TxMore; - ACCESS_ONCE(ads->ctl15) = 0; - ACCESS_ONCE(ads->ctl16) = 0; - ACCESS_ONCE(ads->ctl17) = ctl17; - ACCESS_ONCE(ads->ctl18) = 0; - ACCESS_ONCE(ads->ctl19) = 0; - return; - } - - ACCESS_ONCE(ads->ctl11) = (i->pkt_len & AR_FrameLen) - | (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0) - | SM(i->txpower, AR_XmitPower) - | (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0) - | (i->keyix != ATH9K_TXKEYIX_INVALID ? AR_DestIdxValid : 0) - | (i->flags & ATH9K_TXDESC_LOWRXCHAIN ? AR_LowRxChain : 0) - | (i->flags & ATH9K_TXDESC_CLRDMASK ? AR_ClrDestMask : 0) - | (i->flags & ATH9K_TXDESC_RTSENA ? AR_RTSEnable : - (i->flags & ATH9K_TXDESC_CTSENA ? AR_CTSEnable : 0)); - - ctl12 = (i->keyix != ATH9K_TXKEYIX_INVALID ? - SM(i->keyix, AR_DestIdx) : 0) - | SM(i->type, AR_FrameType) - | (i->flags & ATH9K_TXDESC_NOACK ? AR_NoAck : 0) - | (i->flags & ATH9K_TXDESC_EXT_ONLY ? AR_ExtOnly : 0) - | (i->flags & ATH9K_TXDESC_EXT_AND_CTL ? AR_ExtAndCtl : 0); - - ctl17 |= (i->flags & ATH9K_TXDESC_LDPC ? AR_LDPC : 0); - switch (i->aggr) { - case AGGR_BUF_FIRST: - ctl17 |= SM(i->aggr_len, AR_AggrLen); - /* fall through */ - case AGGR_BUF_MIDDLE: - ctl12 |= AR_IsAggr | AR_MoreAggr; - ctl17 |= SM(i->ndelim, AR_PadDelim); - break; - case AGGR_BUF_LAST: - ctl12 |= AR_IsAggr; - break; - case AGGR_BUF_NONE: - break; - } - - val = (i->flags & ATH9K_TXDESC_PAPRD) >> ATH9K_TXDESC_PAPRD_S; - ctl12 |= SM(val, AR_PAPRDChainMask); - - ACCESS_ONCE(ads->ctl12) = ctl12; - ACCESS_ONCE(ads->ctl17) = ctl17; - - ACCESS_ONCE(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0) - | set11nPktDurRTSCTS(i->rates, 1); - - ACCESS_ONCE(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2) - | set11nPktDurRTSCTS(i->rates, 3); - - ACCESS_ONCE(ads->ctl18) = set11nRateFlags(i->rates, 0) - | set11nRateFlags(i->rates, 1) - | set11nRateFlags(i->rates, 2) - | set11nRateFlags(i->rates, 3) - | SM(i->rtscts_rate, AR_RTSCTSRate); - - ACCESS_ONCE(ads->ctl19) = AR_Not_Sounding; -} - -static u16 ar9003_calc_ptr_chksum(struct ar9003_txc *ads) -{ - int checksum; - - checksum = ads->info + ads->link - + ads->data0 + ads->ctl3 - + ads->data1 + ads->ctl5 - + ads->data2 + ads->ctl7 - + ads->data3 + ads->ctl9; - - return ((checksum & 0xffff) + (checksum >> 16)) & AR_TxPtrChkSum; -} - -static void ar9003_hw_set_desc_link(void *ds, u32 ds_link) -{ - struct ar9003_txc *ads = ds; - - ads->link = ds_link; - ads->ctl10 &= ~AR_TxPtrChkSum; - ads->ctl10 |= ar9003_calc_ptr_chksum(ads); -} - -static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) -{ - u32 isr = 0; - u32 mask2 = 0; - struct ath9k_hw_capabilities *pCap = &ah->caps; - struct ath_common *common = ath9k_hw_common(ah); - u32 sync_cause = 0, async_cause, async_mask = AR_INTR_MAC_IRQ; - bool fatal_int; - - if (ath9k_hw_mci_is_enabled(ah)) - async_mask |= AR_INTR_ASYNC_MASK_MCI; - - async_cause = REG_READ(ah, AR_INTR_ASYNC_CAUSE); - - if (async_cause & async_mask) { - if ((REG_READ(ah, AR_RTC_STATUS) & AR_RTC_STATUS_M) - == AR_RTC_STATUS_ON) - isr = REG_READ(ah, AR_ISR); - } - - - sync_cause = REG_READ(ah, AR_INTR_SYNC_CAUSE) & AR_INTR_SYNC_DEFAULT; - - *masked = 0; - - if (!isr && !sync_cause && !async_cause) - return false; - - if (isr) { - if (isr & AR_ISR_BCNMISC) { - u32 isr2; - isr2 = REG_READ(ah, AR_ISR_S2); - - mask2 |= ((isr2 & AR_ISR_S2_TIM) >> - MAP_ISR_S2_TIM); - mask2 |= ((isr2 & AR_ISR_S2_DTIM) >> - MAP_ISR_S2_DTIM); - mask2 |= ((isr2 & AR_ISR_S2_DTIMSYNC) >> - MAP_ISR_S2_DTIMSYNC); - mask2 |= ((isr2 & AR_ISR_S2_CABEND) >> - MAP_ISR_S2_CABEND); - mask2 |= ((isr2 & AR_ISR_S2_GTT) << - MAP_ISR_S2_GTT); - mask2 |= ((isr2 & AR_ISR_S2_CST) << - MAP_ISR_S2_CST); - mask2 |= ((isr2 & AR_ISR_S2_TSFOOR) >> - MAP_ISR_S2_TSFOOR); - mask2 |= ((isr2 & AR_ISR_S2_BB_WATCHDOG) >> - MAP_ISR_S2_BB_WATCHDOG); - - if (!(pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) { - REG_WRITE(ah, AR_ISR_S2, isr2); - isr &= ~AR_ISR_BCNMISC; - } - } - - if ((pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) - isr = REG_READ(ah, AR_ISR_RAC); - - if (isr == 0xffffffff) { - *masked = 0; - return false; - } - - *masked = isr & ATH9K_INT_COMMON; - - if (ah->config.rx_intr_mitigation) - if (isr & (AR_ISR_RXMINTR | AR_ISR_RXINTM)) - *masked |= ATH9K_INT_RXLP; - - if (ah->config.tx_intr_mitigation) - if (isr & (AR_ISR_TXMINTR | AR_ISR_TXINTM)) - *masked |= ATH9K_INT_TX; - - if (isr & (AR_ISR_LP_RXOK | AR_ISR_RXERR)) - *masked |= ATH9K_INT_RXLP; - - if (isr & AR_ISR_HP_RXOK) - *masked |= ATH9K_INT_RXHP; - - if (isr & (AR_ISR_TXOK | AR_ISR_TXERR | AR_ISR_TXEOL)) { - *masked |= ATH9K_INT_TX; - - if (!(pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) { - u32 s0, s1; - s0 = REG_READ(ah, AR_ISR_S0); - REG_WRITE(ah, AR_ISR_S0, s0); - s1 = REG_READ(ah, AR_ISR_S1); - REG_WRITE(ah, AR_ISR_S1, s1); - - isr &= ~(AR_ISR_TXOK | AR_ISR_TXERR | - AR_ISR_TXEOL); - } - } - - if (isr & AR_ISR_GENTMR) { - u32 s5; - - if (pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED) - s5 = REG_READ(ah, AR_ISR_S5_S); - else - s5 = REG_READ(ah, AR_ISR_S5); - - ah->intr_gen_timer_trigger = - MS(s5, AR_ISR_S5_GENTIMER_TRIG); - - ah->intr_gen_timer_thresh = - MS(s5, AR_ISR_S5_GENTIMER_THRESH); - - if (ah->intr_gen_timer_trigger) - *masked |= ATH9K_INT_GENTIMER; - - if (!(pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) { - REG_WRITE(ah, AR_ISR_S5, s5); - isr &= ~AR_ISR_GENTMR; - } - - } - - *masked |= mask2; - - if (!(pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) { - REG_WRITE(ah, AR_ISR, isr); - - (void) REG_READ(ah, AR_ISR); - } - - if (*masked & ATH9K_INT_BB_WATCHDOG) - ar9003_hw_bb_watchdog_read(ah); - } - - if (async_cause & AR_INTR_ASYNC_MASK_MCI) - ar9003_mci_get_isr(ah, masked); - - if (sync_cause) { - ath9k_debug_sync_cause(common, sync_cause); - fatal_int = - (sync_cause & - (AR_INTR_SYNC_HOST1_FATAL | AR_INTR_SYNC_HOST1_PERR)) - ? true : false; - - if (fatal_int) { - if (sync_cause & AR_INTR_SYNC_HOST1_FATAL) { - ath_dbg(common, ANY, - "received PCI FATAL interrupt\n"); - } - if (sync_cause & AR_INTR_SYNC_HOST1_PERR) { - ath_dbg(common, ANY, - "received PCI PERR interrupt\n"); - } - *masked |= ATH9K_INT_FATAL; - } - - if (sync_cause & AR_INTR_SYNC_RADM_CPL_TIMEOUT) { - REG_WRITE(ah, AR_RC, AR_RC_HOSTIF); - REG_WRITE(ah, AR_RC, 0); - *masked |= ATH9K_INT_FATAL; - } - - if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT) - ath_dbg(common, INTERRUPT, - "AR_INTR_SYNC_LOCAL_TIMEOUT\n"); - - REG_WRITE(ah, AR_INTR_SYNC_CAUSE_CLR, sync_cause); - (void) REG_READ(ah, AR_INTR_SYNC_CAUSE_CLR); - - } - return true; -} - -static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds, - struct ath_tx_status *ts) -{ - struct ar9003_txs *ads; - u32 status; - - ads = &ah->ts_ring[ah->ts_tail]; - - status = ACCESS_ONCE(ads->status8); - if ((status & AR_TxDone) == 0) - return -EINPROGRESS; - - ah->ts_tail = (ah->ts_tail + 1) % ah->ts_size; - - if ((MS(ads->ds_info, AR_DescId) != ATHEROS_VENDOR_ID) || - (MS(ads->ds_info, AR_TxRxDesc) != 1)) { - ath_dbg(ath9k_hw_common(ah), XMIT, - "Tx Descriptor error %x\n", ads->ds_info); - memset(ads, 0, sizeof(*ads)); - return -EIO; - } - - ts->ts_rateindex = MS(status, AR_FinalTxIdx); - ts->ts_seqnum = MS(status, AR_SeqNum); - ts->tid = MS(status, AR_TxTid); - - ts->qid = MS(ads->ds_info, AR_TxQcuNum); - ts->desc_id = MS(ads->status1, AR_TxDescId); - ts->ts_tstamp = ads->status4; - ts->ts_status = 0; - ts->ts_flags = 0; - - if (status & AR_TxOpExceeded) - ts->ts_status |= ATH9K_TXERR_XTXOP; - status = ACCESS_ONCE(ads->status2); - ts->ts_rssi_ctl0 = MS(status, AR_TxRSSIAnt00); - ts->ts_rssi_ctl1 = MS(status, AR_TxRSSIAnt01); - ts->ts_rssi_ctl2 = MS(status, AR_TxRSSIAnt02); - if (status & AR_TxBaStatus) { - ts->ts_flags |= ATH9K_TX_BA; - ts->ba_low = ads->status5; - ts->ba_high = ads->status6; - } - - status = ACCESS_ONCE(ads->status3); - if (status & AR_ExcessiveRetries) - ts->ts_status |= ATH9K_TXERR_XRETRY; - if (status & AR_Filtered) - ts->ts_status |= ATH9K_TXERR_FILT; - if (status & AR_FIFOUnderrun) { - ts->ts_status |= ATH9K_TXERR_FIFO; - ath9k_hw_updatetxtriglevel(ah, true); - } - if (status & AR_TxTimerExpired) - ts->ts_status |= ATH9K_TXERR_TIMER_EXPIRED; - if (status & AR_DescCfgErr) - ts->ts_flags |= ATH9K_TX_DESC_CFG_ERR; - if (status & AR_TxDataUnderrun) { - ts->ts_flags |= ATH9K_TX_DATA_UNDERRUN; - ath9k_hw_updatetxtriglevel(ah, true); - } - if (status & AR_TxDelimUnderrun) { - ts->ts_flags |= ATH9K_TX_DELIM_UNDERRUN; - ath9k_hw_updatetxtriglevel(ah, true); - } - ts->ts_shortretry = MS(status, AR_RTSFailCnt); - ts->ts_longretry = MS(status, AR_DataFailCnt); - ts->ts_virtcol = MS(status, AR_VirtRetryCnt); - - status = ACCESS_ONCE(ads->status7); - ts->ts_rssi = MS(status, AR_TxRSSICombined); - ts->ts_rssi_ext0 = MS(status, AR_TxRSSIAnt10); - ts->ts_rssi_ext1 = MS(status, AR_TxRSSIAnt11); - ts->ts_rssi_ext2 = MS(status, AR_TxRSSIAnt12); - - memset(ads, 0, sizeof(*ads)); - - return 0; -} - -void ar9003_hw_attach_mac_ops(struct ath_hw *hw) -{ - struct ath_hw_ops *ops = ath9k_hw_ops(hw); - - ops->rx_enable = ar9003_hw_rx_enable; - ops->set_desc_link = ar9003_hw_set_desc_link; - ops->get_isr = ar9003_hw_get_isr; - ops->set_txdesc = ar9003_set_txdesc; - ops->proc_txdesc = ar9003_hw_proc_txdesc; -} - -void ath9k_hw_set_rx_bufsize(struct ath_hw *ah, u16 buf_size) -{ - REG_WRITE(ah, AR_DATABUF_SIZE, buf_size & AR_DATABUF_SIZE_MASK); -} -EXPORT_SYMBOL(ath9k_hw_set_rx_bufsize); - -void ath9k_hw_addrxbuf_edma(struct ath_hw *ah, u32 rxdp, - enum ath9k_rx_qtype qtype) -{ - if (qtype == ATH9K_RX_QUEUE_HP) - REG_WRITE(ah, AR_HP_RXDP, rxdp); - else - REG_WRITE(ah, AR_LP_RXDP, rxdp); -} -EXPORT_SYMBOL(ath9k_hw_addrxbuf_edma); - -int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs, - void *buf_addr) -{ - struct ar9003_rxs *rxsp = (struct ar9003_rxs *) buf_addr; - unsigned int phyerr; - - if ((rxsp->status11 & AR_RxDone) == 0) - return -EINPROGRESS; - - if (MS(rxsp->ds_info, AR_DescId) != 0x168c) - return -EINVAL; - - if ((rxsp->ds_info & (AR_TxRxDesc | AR_CtrlStat)) != 0) - return -EINPROGRESS; - - rxs->rs_status = 0; - rxs->rs_flags = 0; - - rxs->rs_datalen = rxsp->status2 & AR_DataLen; - rxs->rs_tstamp = rxsp->status3; - - /* XXX: Keycache */ - rxs->rs_rssi = MS(rxsp->status5, AR_RxRSSICombined); - rxs->rs_rssi_ctl0 = MS(rxsp->status1, AR_RxRSSIAnt00); - rxs->rs_rssi_ctl1 = MS(rxsp->status1, AR_RxRSSIAnt01); - rxs->rs_rssi_ctl2 = MS(rxsp->status1, AR_RxRSSIAnt02); - rxs->rs_rssi_ext0 = MS(rxsp->status5, AR_RxRSSIAnt10); - rxs->rs_rssi_ext1 = MS(rxsp->status5, AR_RxRSSIAnt11); - rxs->rs_rssi_ext2 = MS(rxsp->status5, AR_RxRSSIAnt12); - - if (rxsp->status11 & AR_RxKeyIdxValid) - rxs->rs_keyix = MS(rxsp->status11, AR_KeyIdx); - else - rxs->rs_keyix = ATH9K_RXKEYIX_INVALID; - - rxs->rs_rate = MS(rxsp->status1, AR_RxRate); - rxs->rs_more = (rxsp->status2 & AR_RxMore) ? 1 : 0; - - rxs->rs_isaggr = (rxsp->status11 & AR_RxAggr) ? 1 : 0; - rxs->rs_moreaggr = (rxsp->status11 & AR_RxMoreAggr) ? 1 : 0; - rxs->rs_antenna = (MS(rxsp->status4, AR_RxAntenna) & 0x7); - rxs->rs_flags = (rxsp->status4 & AR_GI) ? ATH9K_RX_GI : 0; - rxs->rs_flags |= (rxsp->status4 & AR_2040) ? ATH9K_RX_2040 : 0; - - rxs->evm0 = rxsp->status6; - rxs->evm1 = rxsp->status7; - rxs->evm2 = rxsp->status8; - rxs->evm3 = rxsp->status9; - rxs->evm4 = (rxsp->status10 & 0xffff); - - if (rxsp->status11 & AR_PreDelimCRCErr) - rxs->rs_flags |= ATH9K_RX_DELIM_CRC_PRE; - - if (rxsp->status11 & AR_PostDelimCRCErr) - rxs->rs_flags |= ATH9K_RX_DELIM_CRC_POST; - - if (rxsp->status11 & AR_DecryptBusyErr) - rxs->rs_flags |= ATH9K_RX_DECRYPT_BUSY; - - if ((rxsp->status11 & AR_RxFrameOK) == 0) { - /* - * AR_CRCErr will bet set to true if we're on the last - * subframe and the AR_PostDelimCRCErr is caught. - * In a way this also gives us a guarantee that when - * (!(AR_CRCErr) && (AR_PostDelimCRCErr)) we cannot - * possibly be reviewing the last subframe. AR_CRCErr - * is the CRC of the actual data. - */ - if (rxsp->status11 & AR_CRCErr) - rxs->rs_status |= ATH9K_RXERR_CRC; - else if (rxsp->status11 & AR_DecryptCRCErr) - rxs->rs_status |= ATH9K_RXERR_DECRYPT; - else if (rxsp->status11 & AR_MichaelErr) - rxs->rs_status |= ATH9K_RXERR_MIC; - if (rxsp->status11 & AR_PHYErr) { - phyerr = MS(rxsp->status11, AR_PHYErrCode); - /* - * If we reach a point here where AR_PostDelimCRCErr is - * true it implies we're *not* on the last subframe. In - * in that case that we know already that the CRC of - * the frame was OK, and MAC would send an ACK for that - * subframe, even if we did get a phy error of type - * ATH9K_PHYERR_OFDM_RESTART. This is only applicable - * to frame that are prior to the last subframe. - * The AR_PostDelimCRCErr is the CRC for the MPDU - * delimiter, which contains the 4 reserved bits, - * the MPDU length (12 bits), and follows the MPDU - * delimiter for an A-MPDU subframe (0x4E = 'N' ASCII). - */ - if ((phyerr == ATH9K_PHYERR_OFDM_RESTART) && - (rxsp->status11 & AR_PostDelimCRCErr)) { - rxs->rs_phyerr = 0; - } else { - rxs->rs_status |= ATH9K_RXERR_PHY; - rxs->rs_phyerr = phyerr; - } - } - } - - if (rxsp->status11 & AR_KeyMiss) - rxs->rs_status |= ATH9K_RXERR_KEYMISS; - - return 0; -} -EXPORT_SYMBOL(ath9k_hw_process_rxdesc_edma); - -void ath9k_hw_reset_txstatus_ring(struct ath_hw *ah) -{ - ah->ts_tail = 0; - - memset((void *) ah->ts_ring, 0, - ah->ts_size * sizeof(struct ar9003_txs)); - - ath_dbg(ath9k_hw_common(ah), XMIT, - "TS Start 0x%x End 0x%x Virt %p, Size %d\n", - ah->ts_paddr_start, ah->ts_paddr_end, - ah->ts_ring, ah->ts_size); - - REG_WRITE(ah, AR_Q_STATUS_RING_START, ah->ts_paddr_start); - REG_WRITE(ah, AR_Q_STATUS_RING_END, ah->ts_paddr_end); -} - -void ath9k_hw_setup_statusring(struct ath_hw *ah, void *ts_start, - u32 ts_paddr_start, - u16 size) -{ - - ah->ts_paddr_start = ts_paddr_start; - ah->ts_paddr_end = ts_paddr_start + (size * sizeof(struct ar9003_txs)); - ah->ts_size = size; - ah->ts_ring = (struct ar9003_txs *) ts_start; - - ath9k_hw_reset_txstatus_ring(ah); -} -EXPORT_SYMBOL(ath9k_hw_setup_statusring); diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.h b/drivers/net/wireless/ath/ath9k/ar9003_mac.h deleted file mode 100644 index cbf60b090bd9..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef AR9003_MAC_H -#define AR9003_MAC_H - -#define AR_DescId 0xffff0000 -#define AR_DescId_S 16 -#define AR_CtrlStat 0x00004000 -#define AR_CtrlStat_S 14 -#define AR_TxRxDesc 0x00008000 -#define AR_TxRxDesc_S 15 -#define AR_TxQcuNum 0x00000f00 -#define AR_TxQcuNum_S 8 - -#define AR_BufLen 0x0fff0000 -#define AR_BufLen_S 16 - -#define AR_TxDescId 0xffff0000 -#define AR_TxDescId_S 16 -#define AR_TxPtrChkSum 0x0000ffff - -#define AR_LowRxChain 0x00004000 - -#define AR_Not_Sounding 0x20000000 - -/* ctl 12 */ -#define AR_PAPRDChainMask 0x00000e00 -#define AR_PAPRDChainMask_S 9 - -#define MAP_ISR_S2_CST 6 -#define MAP_ISR_S2_GTT 6 -#define MAP_ISR_S2_TIM 3 -#define MAP_ISR_S2_CABEND 0 -#define MAP_ISR_S2_DTIMSYNC 7 -#define MAP_ISR_S2_DTIM 7 -#define MAP_ISR_S2_TSFOOR 4 -#define MAP_ISR_S2_BB_WATCHDOG 6 - -#define AR9003TXC_CONST(_ds) ((const struct ar9003_txc *) _ds) - -struct ar9003_rxs { - u32 ds_info; - u32 status1; - u32 status2; - u32 status3; - u32 status4; - u32 status5; - u32 status6; - u32 status7; - u32 status8; - u32 status9; - u32 status10; - u32 status11; -} __packed __aligned(4); - -/* Transmit Control Descriptor */ -struct ar9003_txc { - u32 info; /* descriptor information */ - u32 link; /* link pointer */ - u32 data0; /* data pointer to 1st buffer */ - u32 ctl3; /* DMA control 3 */ - u32 data1; /* data pointer to 2nd buffer */ - u32 ctl5; /* DMA control 5 */ - u32 data2; /* data pointer to 3rd buffer */ - u32 ctl7; /* DMA control 7 */ - u32 data3; /* data pointer to 4th buffer */ - u32 ctl9; /* DMA control 9 */ - u32 ctl10; /* DMA control 10 */ - u32 ctl11; /* DMA control 11 */ - u32 ctl12; /* DMA control 12 */ - u32 ctl13; /* DMA control 13 */ - u32 ctl14; /* DMA control 14 */ - u32 ctl15; /* DMA control 15 */ - u32 ctl16; /* DMA control 16 */ - u32 ctl17; /* DMA control 17 */ - u32 ctl18; /* DMA control 18 */ - u32 ctl19; /* DMA control 19 */ - u32 ctl20; /* DMA control 20 */ - u32 ctl21; /* DMA control 21 */ - u32 ctl22; /* DMA control 22 */ - u32 ctl23; /* DMA control 23 */ - u32 pad[8]; /* pad to cache line (128 bytes/32 dwords) */ -} __packed __aligned(4); - -struct ar9003_txs { - u32 ds_info; - u32 status1; - u32 status2; - u32 status3; - u32 status4; - u32 status5; - u32 status6; - u32 status7; - u32 status8; -} __packed __aligned(4); - -void ar9003_hw_attach_mac_ops(struct ath_hw *hw); -void ath9k_hw_set_rx_bufsize(struct ath_hw *ah, u16 buf_size); -void ath9k_hw_addrxbuf_edma(struct ath_hw *ah, u32 rxdp, - enum ath9k_rx_qtype qtype); - -int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, - struct ath_rx_status *rxs, - void *buf_addr); -void ath9k_hw_reset_txstatus_ring(struct ath_hw *ah); -void ath9k_hw_setup_statusring(struct ath_hw *ah, void *ts_start, - u32 ts_paddr_start, - u16 size); -#endif diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mci.c b/drivers/net/wireless/ath/ath9k/ar9003_mci.c deleted file mode 100644 index 8dd069259e7b..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9003_mci.c +++ /dev/null @@ -1,1485 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "hw.h" -#include "hw-ops.h" -#include "ar9003_phy.h" -#include "ar9003_mci.h" - -static void ar9003_mci_reset_req_wakeup(struct ath_hw *ah) -{ - REG_RMW_FIELD(ah, AR_MCI_COMMAND2, - AR_MCI_COMMAND2_RESET_REQ_WAKEUP, 1); - udelay(1); - REG_RMW_FIELD(ah, AR_MCI_COMMAND2, - AR_MCI_COMMAND2_RESET_REQ_WAKEUP, 0); -} - -static int ar9003_mci_wait_for_interrupt(struct ath_hw *ah, u32 address, - u32 bit_position, int time_out) -{ - struct ath_common *common = ath9k_hw_common(ah); - - while (time_out) { - if (!(REG_READ(ah, address) & bit_position)) { - udelay(10); - time_out -= 10; - - if (time_out < 0) - break; - else - continue; - } - REG_WRITE(ah, address, bit_position); - - if (address != AR_MCI_INTERRUPT_RX_MSG_RAW) - break; - - if (bit_position & AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE) - ar9003_mci_reset_req_wakeup(ah); - - if (bit_position & (AR_MCI_INTERRUPT_RX_MSG_SYS_SLEEPING | - AR_MCI_INTERRUPT_RX_MSG_SYS_WAKING)) - REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, - AR_MCI_INTERRUPT_REMOTE_SLEEP_UPDATE); - - REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, AR_MCI_INTERRUPT_RX_MSG); - break; - } - - if (time_out <= 0) { - ath_dbg(common, MCI, - "MCI Wait for Reg 0x%08x = 0x%08x timeout\n", - address, bit_position); - ath_dbg(common, MCI, - "MCI INT_RAW = 0x%08x, RX_MSG_RAW = 0x%08x\n", - REG_READ(ah, AR_MCI_INTERRUPT_RAW), - REG_READ(ah, AR_MCI_INTERRUPT_RX_MSG_RAW)); - time_out = 0; - } - - return time_out; -} - -static void ar9003_mci_remote_reset(struct ath_hw *ah, bool wait_done) -{ - u32 payload[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffff00}; - - ar9003_mci_send_message(ah, MCI_REMOTE_RESET, 0, payload, 16, - wait_done, false); - udelay(5); -} - -static void ar9003_mci_send_lna_transfer(struct ath_hw *ah, bool wait_done) -{ - u32 payload = 0x00000000; - - ar9003_mci_send_message(ah, MCI_LNA_TRANS, 0, &payload, 1, - wait_done, false); -} - -static void ar9003_mci_send_req_wake(struct ath_hw *ah, bool wait_done) -{ - ar9003_mci_send_message(ah, MCI_REQ_WAKE, MCI_FLAG_DISABLE_TIMESTAMP, - NULL, 0, wait_done, false); - udelay(5); -} - -static void ar9003_mci_send_sys_waking(struct ath_hw *ah, bool wait_done) -{ - ar9003_mci_send_message(ah, MCI_SYS_WAKING, MCI_FLAG_DISABLE_TIMESTAMP, - NULL, 0, wait_done, false); -} - -static void ar9003_mci_send_lna_take(struct ath_hw *ah, bool wait_done) -{ - u32 payload = 0x70000000; - - ar9003_mci_send_message(ah, MCI_LNA_TAKE, 0, &payload, 1, - wait_done, false); -} - -static void ar9003_mci_send_sys_sleeping(struct ath_hw *ah, bool wait_done) -{ - ar9003_mci_send_message(ah, MCI_SYS_SLEEPING, - MCI_FLAG_DISABLE_TIMESTAMP, - NULL, 0, wait_done, false); -} - -static void ar9003_mci_send_coex_version_query(struct ath_hw *ah, - bool wait_done) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 payload[4] = {0, 0, 0, 0}; - - if (mci->bt_version_known || - (mci->bt_state == MCI_BT_SLEEP)) - return; - - MCI_GPM_SET_TYPE_OPCODE(payload, MCI_GPM_COEX_AGENT, - MCI_GPM_COEX_VERSION_QUERY); - ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, wait_done, true); -} - -static void ar9003_mci_send_coex_version_response(struct ath_hw *ah, - bool wait_done) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 payload[4] = {0, 0, 0, 0}; - - MCI_GPM_SET_TYPE_OPCODE(payload, MCI_GPM_COEX_AGENT, - MCI_GPM_COEX_VERSION_RESPONSE); - *(((u8 *)payload) + MCI_GPM_COEX_B_MAJOR_VERSION) = - mci->wlan_ver_major; - *(((u8 *)payload) + MCI_GPM_COEX_B_MINOR_VERSION) = - mci->wlan_ver_minor; - ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, wait_done, true); -} - -static void ar9003_mci_send_coex_wlan_channels(struct ath_hw *ah, - bool wait_done) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 *payload = &mci->wlan_channels[0]; - - if (!mci->wlan_channels_update || - (mci->bt_state == MCI_BT_SLEEP)) - return; - - MCI_GPM_SET_TYPE_OPCODE(payload, MCI_GPM_COEX_AGENT, - MCI_GPM_COEX_WLAN_CHANNELS); - ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, wait_done, true); - MCI_GPM_SET_TYPE_OPCODE(payload, 0xff, 0xff); -} - -static void ar9003_mci_send_coex_bt_status_query(struct ath_hw *ah, - bool wait_done, u8 query_type) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 payload[4] = {0, 0, 0, 0}; - bool query_btinfo; - - if (mci->bt_state == MCI_BT_SLEEP) - return; - - query_btinfo = !!(query_type & (MCI_GPM_COEX_QUERY_BT_ALL_INFO | - MCI_GPM_COEX_QUERY_BT_TOPOLOGY)); - MCI_GPM_SET_TYPE_OPCODE(payload, MCI_GPM_COEX_AGENT, - MCI_GPM_COEX_STATUS_QUERY); - - *(((u8 *)payload) + MCI_GPM_COEX_B_BT_BITMAP) = query_type; - - /* - * If bt_status_query message is not sent successfully, - * then need_flush_btinfo should be set again. - */ - if (!ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, - wait_done, true)) { - if (query_btinfo) - mci->need_flush_btinfo = true; - } - - if (query_btinfo) - mci->query_bt = false; -} - -static void ar9003_mci_send_coex_halt_bt_gpm(struct ath_hw *ah, bool halt, - bool wait_done) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 payload[4] = {0, 0, 0, 0}; - - MCI_GPM_SET_TYPE_OPCODE(payload, MCI_GPM_COEX_AGENT, - MCI_GPM_COEX_HALT_BT_GPM); - - if (halt) { - mci->query_bt = true; - /* Send next unhalt no matter halt sent or not */ - mci->unhalt_bt_gpm = true; - mci->need_flush_btinfo = true; - *(((u8 *)payload) + MCI_GPM_COEX_B_HALT_STATE) = - MCI_GPM_COEX_BT_GPM_HALT; - } else - *(((u8 *)payload) + MCI_GPM_COEX_B_HALT_STATE) = - MCI_GPM_COEX_BT_GPM_UNHALT; - - ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, wait_done, true); -} - -static void ar9003_mci_prep_interface(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 saved_mci_int_en; - u32 mci_timeout = 150; - - mci->bt_state = MCI_BT_SLEEP; - saved_mci_int_en = REG_READ(ah, AR_MCI_INTERRUPT_EN); - - REG_WRITE(ah, AR_MCI_INTERRUPT_EN, 0); - REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, - REG_READ(ah, AR_MCI_INTERRUPT_RX_MSG_RAW)); - REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, - REG_READ(ah, AR_MCI_INTERRUPT_RAW)); - - ar9003_mci_remote_reset(ah, true); - ar9003_mci_send_req_wake(ah, true); - - if (!ar9003_mci_wait_for_interrupt(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, - AR_MCI_INTERRUPT_RX_MSG_SYS_WAKING, 500)) - goto clear_redunt; - - mci->bt_state = MCI_BT_AWAKE; - - /* - * we don't need to send more remote_reset at this moment. - * If BT receive first remote_reset, then BT HW will - * be cleaned up and will be able to receive req_wake - * and BT HW will respond sys_waking. - * In this case, WLAN will receive BT's HW sys_waking. - * Otherwise, if BT SW missed initial remote_reset, - * that remote_reset will still clean up BT MCI RX, - * and the req_wake will wake BT up, - * and BT SW will respond this req_wake with a remote_reset and - * sys_waking. In this case, WLAN will receive BT's SW - * sys_waking. In either case, BT's RX is cleaned up. So we - * don't need to reply BT's remote_reset now, if any. - * Similarly, if in any case, WLAN can receive BT's sys_waking, - * that means WLAN's RX is also fine. - */ - ar9003_mci_send_sys_waking(ah, true); - udelay(10); - - /* - * Set BT priority interrupt value to be 0xff to - * avoid having too many BT PRIORITY interrupts. - */ - REG_WRITE(ah, AR_MCI_BT_PRI0, 0xFFFFFFFF); - REG_WRITE(ah, AR_MCI_BT_PRI1, 0xFFFFFFFF); - REG_WRITE(ah, AR_MCI_BT_PRI2, 0xFFFFFFFF); - REG_WRITE(ah, AR_MCI_BT_PRI3, 0xFFFFFFFF); - REG_WRITE(ah, AR_MCI_BT_PRI, 0X000000FF); - - /* - * A contention reset will be received after send out - * sys_waking. Also BT priority interrupt bits will be set. - * Clear those bits before the next step. - */ - - REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, - AR_MCI_INTERRUPT_RX_MSG_CONT_RST); - REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, AR_MCI_INTERRUPT_BT_PRI); - - if (mci->is_2g) { - ar9003_mci_send_lna_transfer(ah, true); - udelay(5); - } - - if ((mci->is_2g && !mci->update_2g5g)) { - if (ar9003_mci_wait_for_interrupt(ah, - AR_MCI_INTERRUPT_RX_MSG_RAW, - AR_MCI_INTERRUPT_RX_MSG_LNA_INFO, - mci_timeout)) - ath_dbg(common, MCI, - "MCI WLAN has control over the LNA & BT obeys it\n"); - else - ath_dbg(common, MCI, - "MCI BT didn't respond to LNA_TRANS\n"); - } - -clear_redunt: - /* Clear the extra redundant SYS_WAKING from BT */ - if ((mci->bt_state == MCI_BT_AWAKE) && - (REG_READ_FIELD(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, - AR_MCI_INTERRUPT_RX_MSG_SYS_WAKING)) && - (REG_READ_FIELD(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, - AR_MCI_INTERRUPT_RX_MSG_SYS_SLEEPING) == 0)) { - REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, - AR_MCI_INTERRUPT_RX_MSG_SYS_WAKING); - REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, - AR_MCI_INTERRUPT_REMOTE_SLEEP_UPDATE); - } - - REG_WRITE(ah, AR_MCI_INTERRUPT_EN, saved_mci_int_en); -} - -void ar9003_mci_set_full_sleep(struct ath_hw *ah) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - - if (ar9003_mci_state(ah, MCI_STATE_ENABLE) && - (mci->bt_state != MCI_BT_SLEEP) && - !mci->halted_bt_gpm) { - ar9003_mci_send_coex_halt_bt_gpm(ah, true, true); - } - - mci->ready = false; -} - -static void ar9003_mci_disable_interrupt(struct ath_hw *ah) -{ - REG_WRITE(ah, AR_MCI_INTERRUPT_EN, 0); - REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_EN, 0); -} - -static void ar9003_mci_enable_interrupt(struct ath_hw *ah) -{ - REG_WRITE(ah, AR_MCI_INTERRUPT_EN, AR_MCI_INTERRUPT_DEFAULT); - REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_EN, - AR_MCI_INTERRUPT_RX_MSG_DEFAULT); -} - -static bool ar9003_mci_check_int(struct ath_hw *ah, u32 ints) -{ - u32 intr; - - intr = REG_READ(ah, AR_MCI_INTERRUPT_RX_MSG_RAW); - return ((intr & ints) == ints); -} - -void ar9003_mci_get_interrupt(struct ath_hw *ah, u32 *raw_intr, - u32 *rx_msg_intr) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - - *raw_intr = mci->raw_intr; - *rx_msg_intr = mci->rx_msg_intr; - - /* Clean int bits after the values are read. */ - mci->raw_intr = 0; - mci->rx_msg_intr = 0; -} -EXPORT_SYMBOL(ar9003_mci_get_interrupt); - -void ar9003_mci_get_isr(struct ath_hw *ah, enum ath9k_int *masked) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 raw_intr, rx_msg_intr; - - rx_msg_intr = REG_READ(ah, AR_MCI_INTERRUPT_RX_MSG_RAW); - raw_intr = REG_READ(ah, AR_MCI_INTERRUPT_RAW); - - if ((raw_intr == 0xdeadbeef) || (rx_msg_intr == 0xdeadbeef)) { - ath_dbg(common, MCI, - "MCI gets 0xdeadbeef during int processing\n"); - } else { - mci->rx_msg_intr |= rx_msg_intr; - mci->raw_intr |= raw_intr; - *masked |= ATH9K_INT_MCI; - - if (rx_msg_intr & AR_MCI_INTERRUPT_RX_MSG_CONT_INFO) - mci->cont_status = REG_READ(ah, AR_MCI_CONT_STATUS); - - REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, rx_msg_intr); - REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, raw_intr); - } -} - -static void ar9003_mci_2g5g_changed(struct ath_hw *ah, bool is_2g) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - - if (!mci->update_2g5g && - (mci->is_2g != is_2g)) - mci->update_2g5g = true; - - mci->is_2g = is_2g; -} - -static bool ar9003_mci_is_gpm_valid(struct ath_hw *ah, u32 msg_index) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 *payload; - u32 recv_type, offset; - - if (msg_index == MCI_GPM_INVALID) - return false; - - offset = msg_index << 4; - - payload = (u32 *)(mci->gpm_buf + offset); - recv_type = MCI_GPM_TYPE(payload); - - if (recv_type == MCI_GPM_RSVD_PATTERN) - return false; - - return true; -} - -static void ar9003_mci_observation_set_up(struct ath_hw *ah) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - - if (mci->config & ATH_MCI_CONFIG_MCI_OBS_MCI) { - ath9k_hw_cfg_output(ah, 3, AR_GPIO_OUTPUT_MUX_AS_MCI_WLAN_DATA); - ath9k_hw_cfg_output(ah, 2, AR_GPIO_OUTPUT_MUX_AS_MCI_WLAN_CLK); - ath9k_hw_cfg_output(ah, 1, AR_GPIO_OUTPUT_MUX_AS_MCI_BT_DATA); - ath9k_hw_cfg_output(ah, 0, AR_GPIO_OUTPUT_MUX_AS_MCI_BT_CLK); - } else if (mci->config & ATH_MCI_CONFIG_MCI_OBS_TXRX) { - ath9k_hw_cfg_output(ah, 3, AR_GPIO_OUTPUT_MUX_AS_WL_IN_TX); - ath9k_hw_cfg_output(ah, 2, AR_GPIO_OUTPUT_MUX_AS_WL_IN_RX); - ath9k_hw_cfg_output(ah, 1, AR_GPIO_OUTPUT_MUX_AS_BT_IN_TX); - ath9k_hw_cfg_output(ah, 0, AR_GPIO_OUTPUT_MUX_AS_BT_IN_RX); - ath9k_hw_cfg_output(ah, 5, AR_GPIO_OUTPUT_MUX_AS_OUTPUT); - } else if (mci->config & ATH_MCI_CONFIG_MCI_OBS_BT) { - ath9k_hw_cfg_output(ah, 3, AR_GPIO_OUTPUT_MUX_AS_BT_IN_TX); - ath9k_hw_cfg_output(ah, 2, AR_GPIO_OUTPUT_MUX_AS_BT_IN_RX); - ath9k_hw_cfg_output(ah, 1, AR_GPIO_OUTPUT_MUX_AS_MCI_BT_DATA); - ath9k_hw_cfg_output(ah, 0, AR_GPIO_OUTPUT_MUX_AS_MCI_BT_CLK); - } else - return; - - REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE); - - REG_RMW_FIELD(ah, AR_PHY_GLB_CONTROL, AR_GLB_DS_JTAG_DISABLE, 1); - REG_RMW_FIELD(ah, AR_PHY_GLB_CONTROL, AR_GLB_WLAN_UART_INTF_EN, 0); - REG_SET_BIT(ah, AR_GLB_GPIO_CONTROL, ATH_MCI_CONFIG_MCI_OBS_GPIO); - - REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2, AR_BTCOEX_CTRL2_GPIO_OBS_SEL, 0); - REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2, AR_BTCOEX_CTRL2_MAC_BB_OBS_SEL, 1); - REG_WRITE(ah, AR_OBS, 0x4b); - REG_RMW_FIELD(ah, AR_DIAG_SW, AR_DIAG_OBS_PT_SEL1, 0x03); - REG_RMW_FIELD(ah, AR_DIAG_SW, AR_DIAG_OBS_PT_SEL2, 0x01); - REG_RMW_FIELD(ah, AR_MACMISC, AR_MACMISC_MISC_OBS_BUS_LSB, 0x02); - REG_RMW_FIELD(ah, AR_MACMISC, AR_MACMISC_MISC_OBS_BUS_MSB, 0x03); - REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS, - AR_PHY_TEST_CTL_DEBUGPORT_SEL, 0x07); -} - -static bool ar9003_mci_send_coex_bt_flags(struct ath_hw *ah, bool wait_done, - u8 opcode, u32 bt_flags) -{ - u32 pld[4] = {0, 0, 0, 0}; - - MCI_GPM_SET_TYPE_OPCODE(pld, MCI_GPM_COEX_AGENT, - MCI_GPM_COEX_BT_UPDATE_FLAGS); - - *(((u8 *)pld) + MCI_GPM_COEX_B_BT_FLAGS_OP) = opcode; - *(((u8 *)pld) + MCI_GPM_COEX_W_BT_FLAGS + 0) = bt_flags & 0xFF; - *(((u8 *)pld) + MCI_GPM_COEX_W_BT_FLAGS + 1) = (bt_flags >> 8) & 0xFF; - *(((u8 *)pld) + MCI_GPM_COEX_W_BT_FLAGS + 2) = (bt_flags >> 16) & 0xFF; - *(((u8 *)pld) + MCI_GPM_COEX_W_BT_FLAGS + 3) = (bt_flags >> 24) & 0xFF; - - return ar9003_mci_send_message(ah, MCI_GPM, 0, pld, 16, - wait_done, true); -} - -static void ar9003_mci_sync_bt_state(struct ath_hw *ah) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 cur_bt_state; - - cur_bt_state = ar9003_mci_state(ah, MCI_STATE_REMOTE_SLEEP); - - if (mci->bt_state != cur_bt_state) - mci->bt_state = cur_bt_state; - - if (mci->bt_state != MCI_BT_SLEEP) { - - ar9003_mci_send_coex_version_query(ah, true); - ar9003_mci_send_coex_wlan_channels(ah, true); - - if (mci->unhalt_bt_gpm == true) - ar9003_mci_send_coex_halt_bt_gpm(ah, false, true); - } -} - -void ar9003_mci_check_bt(struct ath_hw *ah) -{ - struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; - - if (!mci_hw->ready) - return; - - /* - * check BT state again to make - * sure it's not changed. - */ - ar9003_mci_sync_bt_state(ah); - ar9003_mci_2g5g_switch(ah, true); - - if ((mci_hw->bt_state == MCI_BT_AWAKE) && - (mci_hw->query_bt == true)) { - mci_hw->need_flush_btinfo = true; - } -} - -static void ar9003_mci_process_gpm_extra(struct ath_hw *ah, u8 gpm_type, - u8 gpm_opcode, u32 *p_gpm) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u8 *p_data = (u8 *) p_gpm; - - if (gpm_type != MCI_GPM_COEX_AGENT) - return; - - switch (gpm_opcode) { - case MCI_GPM_COEX_VERSION_QUERY: - ath_dbg(common, MCI, "MCI Recv GPM COEX Version Query\n"); - ar9003_mci_send_coex_version_response(ah, true); - break; - case MCI_GPM_COEX_VERSION_RESPONSE: - ath_dbg(common, MCI, "MCI Recv GPM COEX Version Response\n"); - mci->bt_ver_major = - *(p_data + MCI_GPM_COEX_B_MAJOR_VERSION); - mci->bt_ver_minor = - *(p_data + MCI_GPM_COEX_B_MINOR_VERSION); - mci->bt_version_known = true; - ath_dbg(common, MCI, "MCI BT Coex version: %d.%d\n", - mci->bt_ver_major, mci->bt_ver_minor); - break; - case MCI_GPM_COEX_STATUS_QUERY: - ath_dbg(common, MCI, - "MCI Recv GPM COEX Status Query = 0x%02X\n", - *(p_data + MCI_GPM_COEX_B_WLAN_BITMAP)); - mci->wlan_channels_update = true; - ar9003_mci_send_coex_wlan_channels(ah, true); - break; - case MCI_GPM_COEX_BT_PROFILE_INFO: - mci->query_bt = true; - ath_dbg(common, MCI, "MCI Recv GPM COEX BT_Profile_Info\n"); - break; - case MCI_GPM_COEX_BT_STATUS_UPDATE: - mci->query_bt = true; - ath_dbg(common, MCI, - "MCI Recv GPM COEX BT_Status_Update SEQ=%d (drop&query)\n", - *(p_gpm + 3)); - break; - default: - break; - } -} - -static u32 ar9003_mci_wait_for_gpm(struct ath_hw *ah, u8 gpm_type, - u8 gpm_opcode, int time_out) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 *p_gpm = NULL, mismatch = 0, more_data; - u32 offset; - u8 recv_type = 0, recv_opcode = 0; - bool b_is_bt_cal_done = (gpm_type == MCI_GPM_BT_CAL_DONE); - - more_data = time_out ? MCI_GPM_NOMORE : MCI_GPM_MORE; - - while (time_out > 0) { - if (p_gpm) { - MCI_GPM_RECYCLE(p_gpm); - p_gpm = NULL; - } - - if (more_data != MCI_GPM_MORE) - time_out = ar9003_mci_wait_for_interrupt(ah, - AR_MCI_INTERRUPT_RX_MSG_RAW, - AR_MCI_INTERRUPT_RX_MSG_GPM, - time_out); - - if (!time_out) - break; - - offset = ar9003_mci_get_next_gpm_offset(ah, false, &more_data); - - if (offset == MCI_GPM_INVALID) - continue; - - p_gpm = (u32 *) (mci->gpm_buf + offset); - recv_type = MCI_GPM_TYPE(p_gpm); - recv_opcode = MCI_GPM_OPCODE(p_gpm); - - if (MCI_GPM_IS_CAL_TYPE(recv_type)) { - if (recv_type == gpm_type) { - if ((gpm_type == MCI_GPM_BT_CAL_DONE) && - !b_is_bt_cal_done) { - gpm_type = MCI_GPM_BT_CAL_GRANT; - continue; - } - break; - } - } else if ((recv_type == gpm_type) && - (recv_opcode == gpm_opcode)) - break; - - /* - * check if it's cal_grant - * - * When we're waiting for cal_grant in reset routine, - * it's possible that BT sends out cal_request at the - * same time. Since BT's calibration doesn't happen - * that often, we'll let BT completes calibration then - * we continue to wait for cal_grant from BT. - * Orginal: Wait BT_CAL_GRANT. - * New: Receive BT_CAL_REQ -> send WLAN_CAL_GRANT->wait - * BT_CAL_DONE -> Wait BT_CAL_GRANT. - */ - - if ((gpm_type == MCI_GPM_BT_CAL_GRANT) && - (recv_type == MCI_GPM_BT_CAL_REQ)) { - - u32 payload[4] = {0, 0, 0, 0}; - - gpm_type = MCI_GPM_BT_CAL_DONE; - MCI_GPM_SET_CAL_TYPE(payload, - MCI_GPM_WLAN_CAL_GRANT); - ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, - false, false); - continue; - } else { - ath_dbg(common, MCI, "MCI GPM subtype not match 0x%x\n", - *(p_gpm + 1)); - mismatch++; - ar9003_mci_process_gpm_extra(ah, recv_type, - recv_opcode, p_gpm); - } - } - - if (p_gpm) { - MCI_GPM_RECYCLE(p_gpm); - p_gpm = NULL; - } - - if (time_out <= 0) - time_out = 0; - - while (more_data == MCI_GPM_MORE) { - offset = ar9003_mci_get_next_gpm_offset(ah, false, &more_data); - if (offset == MCI_GPM_INVALID) - break; - - p_gpm = (u32 *) (mci->gpm_buf + offset); - recv_type = MCI_GPM_TYPE(p_gpm); - recv_opcode = MCI_GPM_OPCODE(p_gpm); - - if (!MCI_GPM_IS_CAL_TYPE(recv_type)) - ar9003_mci_process_gpm_extra(ah, recv_type, - recv_opcode, p_gpm); - - MCI_GPM_RECYCLE(p_gpm); - } - - return time_out; -} - -bool ar9003_mci_start_reset(struct ath_hw *ah, struct ath9k_channel *chan) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; - u32 payload[4] = {0, 0, 0, 0}; - - ar9003_mci_2g5g_changed(ah, IS_CHAN_2GHZ(chan)); - - if (mci_hw->bt_state != MCI_BT_CAL_START) - return false; - - mci_hw->bt_state = MCI_BT_CAL; - - /* - * MCI FIX: disable mci interrupt here. This is to avoid - * SW_MSG_DONE or RX_MSG bits to trigger MCI_INT and - * lead to mci_intr reentry. - */ - ar9003_mci_disable_interrupt(ah); - - MCI_GPM_SET_CAL_TYPE(payload, MCI_GPM_WLAN_CAL_GRANT); - ar9003_mci_send_message(ah, MCI_GPM, 0, payload, - 16, true, false); - - /* Wait BT calibration to be completed for 25ms */ - - if (ar9003_mci_wait_for_gpm(ah, MCI_GPM_BT_CAL_DONE, - 0, 25000)) - ath_dbg(common, MCI, "MCI BT_CAL_DONE received\n"); - else - ath_dbg(common, MCI, - "MCI BT_CAL_DONE not received\n"); - - mci_hw->bt_state = MCI_BT_AWAKE; - /* MCI FIX: enable mci interrupt here */ - ar9003_mci_enable_interrupt(ah); - - return true; -} - -int ar9003_mci_end_reset(struct ath_hw *ah, struct ath9k_channel *chan, - struct ath9k_hw_cal_data *caldata) -{ - struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; - - if (!mci_hw->ready) - return 0; - - if (!IS_CHAN_2GHZ(chan) || (mci_hw->bt_state != MCI_BT_SLEEP)) - goto exit; - - if (!ar9003_mci_check_int(ah, AR_MCI_INTERRUPT_RX_MSG_REMOTE_RESET) && - !ar9003_mci_check_int(ah, AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE)) - goto exit; - - /* - * BT is sleeping. Check if BT wakes up during - * WLAN calibration. If BT wakes up during - * WLAN calibration, need to go through all - * message exchanges again and recal. - */ - REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, - (AR_MCI_INTERRUPT_RX_MSG_REMOTE_RESET | - AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE)); - - ar9003_mci_remote_reset(ah, true); - ar9003_mci_send_sys_waking(ah, true); - udelay(1); - - if (IS_CHAN_2GHZ(chan)) - ar9003_mci_send_lna_transfer(ah, true); - - mci_hw->bt_state = MCI_BT_AWAKE; - - REG_CLR_BIT(ah, AR_PHY_TIMING4, - 1 << AR_PHY_TIMING_CONTROL4_DO_GAIN_DC_IQ_CAL_SHIFT); - - if (caldata) { - caldata->done_txiqcal_once = false; - caldata->done_txclcal_once = false; - caldata->rtt_done = false; - } - - if (!ath9k_hw_init_cal(ah, chan)) - return -EIO; - - REG_SET_BIT(ah, AR_PHY_TIMING4, - 1 << AR_PHY_TIMING_CONTROL4_DO_GAIN_DC_IQ_CAL_SHIFT); - -exit: - ar9003_mci_enable_interrupt(ah); - return 0; -} - -static void ar9003_mci_mute_bt(struct ath_hw *ah) -{ - /* disable all MCI messages */ - REG_WRITE(ah, AR_MCI_MSG_ATTRIBUTES_TABLE, 0xffff0000); - REG_SET_BIT(ah, AR_MCI_TX_CTRL, AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE); - - /* wait pending HW messages to flush out */ - udelay(10); - - /* - * Send LNA_TAKE and SYS_SLEEPING when - * 1. reset not after resuming from full sleep - * 2. before reset MCI RX, to quiet BT and avoid MCI RX misalignment - */ - ar9003_mci_send_lna_take(ah, true); - - udelay(5); - - ar9003_mci_send_sys_sleeping(ah, true); -} - -static void ar9003_mci_osla_setup(struct ath_hw *ah, bool enable) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 thresh; - - if (!enable) { - REG_CLR_BIT(ah, AR_BTCOEX_CTRL, - AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN); - return; - } - REG_RMW_FIELD(ah, AR_MCI_SCHD_TABLE_2, AR_MCI_SCHD_TABLE_2_HW_BASED, 1); - REG_RMW_FIELD(ah, AR_MCI_SCHD_TABLE_2, - AR_MCI_SCHD_TABLE_2_MEM_BASED, 1); - - if (AR_SREV_9565(ah)) - REG_RMW_FIELD(ah, AR_MCI_MISC, AR_MCI_MISC_HW_FIX_EN, 1); - - if (!(mci->config & ATH_MCI_CONFIG_DISABLE_AGGR_THRESH)) { - thresh = MS(mci->config, ATH_MCI_CONFIG_AGGR_THRESH); - REG_RMW_FIELD(ah, AR_BTCOEX_CTRL, - AR_BTCOEX_CTRL_AGGR_THRESH, thresh); - REG_RMW_FIELD(ah, AR_BTCOEX_CTRL, - AR_BTCOEX_CTRL_TIME_TO_NEXT_BT_THRESH_EN, 1); - } else - REG_RMW_FIELD(ah, AR_BTCOEX_CTRL, - AR_BTCOEX_CTRL_TIME_TO_NEXT_BT_THRESH_EN, 0); - - REG_RMW_FIELD(ah, AR_BTCOEX_CTRL, - AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN, 1); -} - -int ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g, - bool is_full_sleep) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 regval, i; - - ath_dbg(common, MCI, "MCI Reset (full_sleep = %d, is_2g = %d)\n", - is_full_sleep, is_2g); - - if (!mci->gpm_addr && !mci->sched_addr) { - ath_err(common, "MCI GPM and schedule buffers are not allocated\n"); - return -ENOMEM; - } - - if (REG_READ(ah, AR_BTCOEX_CTRL) == 0xdeadbeef) { - ath_err(common, "BTCOEX control register is dead\n"); - return -EINVAL; - } - - /* Program MCI DMA related registers */ - REG_WRITE(ah, AR_MCI_GPM_0, mci->gpm_addr); - REG_WRITE(ah, AR_MCI_GPM_1, mci->gpm_len); - REG_WRITE(ah, AR_MCI_SCHD_TABLE_0, mci->sched_addr); - - /* - * To avoid MCI state machine be affected by incoming remote MCI msgs, - * MCI mode will be enabled later, right before reset the MCI TX and RX. - */ - - regval = SM(1, AR_BTCOEX_CTRL_AR9462_MODE) | - SM(1, AR_BTCOEX_CTRL_WBTIMER_EN) | - SM(1, AR_BTCOEX_CTRL_PA_SHARED) | - SM(1, AR_BTCOEX_CTRL_LNA_SHARED) | - SM(0, AR_BTCOEX_CTRL_1_CHAIN_ACK) | - SM(0, AR_BTCOEX_CTRL_1_CHAIN_BCN) | - SM(0, AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN); - if (AR_SREV_9565(ah)) { - regval |= SM(1, AR_BTCOEX_CTRL_NUM_ANTENNAS) | - SM(1, AR_BTCOEX_CTRL_RX_CHAIN_MASK); - REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2, - AR_BTCOEX_CTRL2_TX_CHAIN_MASK, 0x1); - } else { - regval |= SM(2, AR_BTCOEX_CTRL_NUM_ANTENNAS) | - SM(3, AR_BTCOEX_CTRL_RX_CHAIN_MASK); - } - - REG_WRITE(ah, AR_BTCOEX_CTRL, regval); - - if (is_2g && !(mci->config & ATH_MCI_CONFIG_DISABLE_OSLA)) - ar9003_mci_osla_setup(ah, true); - else - ar9003_mci_osla_setup(ah, false); - - REG_SET_BIT(ah, AR_PHY_GLB_CONTROL, - AR_BTCOEX_CTRL_SPDT_ENABLE); - REG_RMW_FIELD(ah, AR_BTCOEX_CTRL3, - AR_BTCOEX_CTRL3_CONT_INFO_TIMEOUT, 20); - - REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2, AR_BTCOEX_CTRL2_RX_DEWEIGHT, 0); - REG_RMW_FIELD(ah, AR_PCU_MISC, AR_PCU_BT_ANT_PREVENT_RX, 0); - - /* Set the time out to 3.125ms (5 BT slots) */ - REG_RMW_FIELD(ah, AR_BTCOEX_WL_LNA, AR_BTCOEX_WL_LNA_TIMEOUT, 0x3D090); - - /* concurrent tx priority */ - if (mci->config & ATH_MCI_CONFIG_CONCUR_TX) { - REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2, - AR_BTCOEX_CTRL2_DESC_BASED_TXPWR_ENABLE, 0); - REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2, - AR_BTCOEX_CTRL2_TXPWR_THRESH, 0x7f); - REG_RMW_FIELD(ah, AR_BTCOEX_CTRL, - AR_BTCOEX_CTRL_REDUCE_TXPWR, 0); - for (i = 0; i < 8; i++) - REG_WRITE(ah, AR_BTCOEX_MAX_TXPWR(i), 0x7f7f7f7f); - } - - regval = MS(mci->config, ATH_MCI_CONFIG_CLK_DIV); - REG_RMW_FIELD(ah, AR_MCI_TX_CTRL, AR_MCI_TX_CTRL_CLK_DIV, regval); - REG_SET_BIT(ah, AR_BTCOEX_CTRL, AR_BTCOEX_CTRL_MCI_MODE_EN); - - /* Resetting the Rx and Tx paths of MCI */ - regval = REG_READ(ah, AR_MCI_COMMAND2); - regval |= SM(1, AR_MCI_COMMAND2_RESET_TX); - REG_WRITE(ah, AR_MCI_COMMAND2, regval); - - udelay(1); - - regval &= ~SM(1, AR_MCI_COMMAND2_RESET_TX); - REG_WRITE(ah, AR_MCI_COMMAND2, regval); - - if (is_full_sleep) { - ar9003_mci_mute_bt(ah); - udelay(100); - } - - /* Check pending GPM msg before MCI Reset Rx */ - ar9003_mci_check_gpm_offset(ah); - - regval |= SM(1, AR_MCI_COMMAND2_RESET_RX); - REG_WRITE(ah, AR_MCI_COMMAND2, regval); - udelay(1); - regval &= ~SM(1, AR_MCI_COMMAND2_RESET_RX); - REG_WRITE(ah, AR_MCI_COMMAND2, regval); - - ar9003_mci_get_next_gpm_offset(ah, true, NULL); - - REG_WRITE(ah, AR_MCI_MSG_ATTRIBUTES_TABLE, - (SM(0xe801, AR_MCI_MSG_ATTRIBUTES_TABLE_INVALID_HDR) | - SM(0x0000, AR_MCI_MSG_ATTRIBUTES_TABLE_CHECKSUM))); - - REG_CLR_BIT(ah, AR_MCI_TX_CTRL, - AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE); - - ar9003_mci_observation_set_up(ah); - - mci->ready = true; - ar9003_mci_prep_interface(ah); - - if (AR_SREV_9565(ah)) - REG_RMW_FIELD(ah, AR_MCI_DBG_CNT_CTRL, - AR_MCI_DBG_CNT_CTRL_ENABLE, 0); - if (en_int) - ar9003_mci_enable_interrupt(ah); - - return 0; -} - -void ar9003_mci_stop_bt(struct ath_hw *ah, bool save_fullsleep) -{ - struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; - - ar9003_mci_disable_interrupt(ah); - - if (mci_hw->ready && !save_fullsleep) { - ar9003_mci_mute_bt(ah); - udelay(20); - REG_WRITE(ah, AR_BTCOEX_CTRL, 0); - } - - mci_hw->bt_state = MCI_BT_SLEEP; - mci_hw->ready = false; -} - -static void ar9003_mci_send_2g5g_status(struct ath_hw *ah, bool wait_done) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 new_flags, to_set, to_clear; - - if (!mci->update_2g5g || (mci->bt_state == MCI_BT_SLEEP)) - return; - - if (mci->is_2g) { - new_flags = MCI_2G_FLAGS; - to_clear = MCI_2G_FLAGS_CLEAR_MASK; - to_set = MCI_2G_FLAGS_SET_MASK; - } else { - new_flags = MCI_5G_FLAGS; - to_clear = MCI_5G_FLAGS_CLEAR_MASK; - to_set = MCI_5G_FLAGS_SET_MASK; - } - - if (to_clear) - ar9003_mci_send_coex_bt_flags(ah, wait_done, - MCI_GPM_COEX_BT_FLAGS_CLEAR, - to_clear); - if (to_set) - ar9003_mci_send_coex_bt_flags(ah, wait_done, - MCI_GPM_COEX_BT_FLAGS_SET, - to_set); -} - -static void ar9003_mci_queue_unsent_gpm(struct ath_hw *ah, u8 header, - u32 *payload, bool queue) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u8 type, opcode; - - /* check if the message is to be queued */ - if (header != MCI_GPM) - return; - - type = MCI_GPM_TYPE(payload); - opcode = MCI_GPM_OPCODE(payload); - - if (type != MCI_GPM_COEX_AGENT) - return; - - switch (opcode) { - case MCI_GPM_COEX_BT_UPDATE_FLAGS: - if (*(((u8 *)payload) + MCI_GPM_COEX_B_BT_FLAGS_OP) == - MCI_GPM_COEX_BT_FLAGS_READ) - break; - - mci->update_2g5g = queue; - - break; - case MCI_GPM_COEX_WLAN_CHANNELS: - mci->wlan_channels_update = queue; - break; - case MCI_GPM_COEX_HALT_BT_GPM: - if (*(((u8 *)payload) + MCI_GPM_COEX_B_HALT_STATE) == - MCI_GPM_COEX_BT_GPM_UNHALT) { - mci->unhalt_bt_gpm = queue; - - if (!queue) - mci->halted_bt_gpm = false; - } - - if (*(((u8 *)payload) + MCI_GPM_COEX_B_HALT_STATE) == - MCI_GPM_COEX_BT_GPM_HALT) { - - mci->halted_bt_gpm = !queue; - } - - break; - default: - break; - } -} - -void ar9003_mci_2g5g_switch(struct ath_hw *ah, bool force) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - - if (!mci->update_2g5g && !force) - return; - - if (mci->is_2g) { - ar9003_mci_send_2g5g_status(ah, true); - ar9003_mci_send_lna_transfer(ah, true); - udelay(5); - - REG_CLR_BIT(ah, AR_MCI_TX_CTRL, - AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE); - REG_CLR_BIT(ah, AR_PHY_GLB_CONTROL, - AR_BTCOEX_CTRL_BT_OWN_SPDT_CTRL); - - if (!(mci->config & ATH_MCI_CONFIG_DISABLE_OSLA)) - ar9003_mci_osla_setup(ah, true); - - if (AR_SREV_9462(ah)) - REG_WRITE(ah, AR_SELFGEN_MASK, 0x02); - } else { - ar9003_mci_send_lna_take(ah, true); - udelay(5); - - REG_SET_BIT(ah, AR_MCI_TX_CTRL, - AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE); - REG_SET_BIT(ah, AR_PHY_GLB_CONTROL, - AR_BTCOEX_CTRL_BT_OWN_SPDT_CTRL); - - ar9003_mci_osla_setup(ah, false); - ar9003_mci_send_2g5g_status(ah, true); - } -} - -bool ar9003_mci_send_message(struct ath_hw *ah, u8 header, u32 flag, - u32 *payload, u8 len, bool wait_done, - bool check_bt) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - bool msg_sent = false; - u32 regval; - u32 saved_mci_int_en; - int i; - - saved_mci_int_en = REG_READ(ah, AR_MCI_INTERRUPT_EN); - regval = REG_READ(ah, AR_BTCOEX_CTRL); - - if ((regval == 0xdeadbeef) || !(regval & AR_BTCOEX_CTRL_MCI_MODE_EN)) { - ath_dbg(common, MCI, - "MCI Not sending 0x%x. MCI is not enabled. full_sleep = %d\n", - header, (ah->power_mode == ATH9K_PM_FULL_SLEEP) ? 1 : 0); - ar9003_mci_queue_unsent_gpm(ah, header, payload, true); - return false; - } else if (check_bt && (mci->bt_state == MCI_BT_SLEEP)) { - ath_dbg(common, MCI, - "MCI Don't send message 0x%x. BT is in sleep state\n", - header); - ar9003_mci_queue_unsent_gpm(ah, header, payload, true); - return false; - } - - if (wait_done) - REG_WRITE(ah, AR_MCI_INTERRUPT_EN, 0); - - /* Need to clear SW_MSG_DONE raw bit before wait */ - - REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, - (AR_MCI_INTERRUPT_SW_MSG_DONE | - AR_MCI_INTERRUPT_MSG_FAIL_MASK)); - - if (payload) { - for (i = 0; (i * 4) < len; i++) - REG_WRITE(ah, (AR_MCI_TX_PAYLOAD0 + i * 4), - *(payload + i)); - } - - REG_WRITE(ah, AR_MCI_COMMAND0, - (SM((flag & MCI_FLAG_DISABLE_TIMESTAMP), - AR_MCI_COMMAND0_DISABLE_TIMESTAMP) | - SM(len, AR_MCI_COMMAND0_LEN) | - SM(header, AR_MCI_COMMAND0_HEADER))); - - if (wait_done && - !(ar9003_mci_wait_for_interrupt(ah, AR_MCI_INTERRUPT_RAW, - AR_MCI_INTERRUPT_SW_MSG_DONE, 500))) - ar9003_mci_queue_unsent_gpm(ah, header, payload, true); - else { - ar9003_mci_queue_unsent_gpm(ah, header, payload, false); - msg_sent = true; - } - - if (wait_done) - REG_WRITE(ah, AR_MCI_INTERRUPT_EN, saved_mci_int_en); - - return msg_sent; -} -EXPORT_SYMBOL(ar9003_mci_send_message); - -void ar9003_mci_init_cal_req(struct ath_hw *ah, bool *is_reusable) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; - u32 pld[4] = {0, 0, 0, 0}; - - if ((mci_hw->bt_state != MCI_BT_AWAKE) || - (mci_hw->config & ATH_MCI_CONFIG_DISABLE_MCI_CAL)) - return; - - MCI_GPM_SET_CAL_TYPE(pld, MCI_GPM_WLAN_CAL_REQ); - pld[MCI_GPM_WLAN_CAL_W_SEQUENCE] = mci_hw->wlan_cal_seq++; - - ar9003_mci_send_message(ah, MCI_GPM, 0, pld, 16, true, false); - - if (ar9003_mci_wait_for_gpm(ah, MCI_GPM_BT_CAL_GRANT, 0, 50000)) { - ath_dbg(common, MCI, "MCI BT_CAL_GRANT received\n"); - } else { - *is_reusable = false; - ath_dbg(common, MCI, "MCI BT_CAL_GRANT not received\n"); - } -} - -void ar9003_mci_init_cal_done(struct ath_hw *ah) -{ - struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; - u32 pld[4] = {0, 0, 0, 0}; - - if ((mci_hw->bt_state != MCI_BT_AWAKE) || - (mci_hw->config & ATH_MCI_CONFIG_DISABLE_MCI_CAL)) - return; - - MCI_GPM_SET_CAL_TYPE(pld, MCI_GPM_WLAN_CAL_DONE); - pld[MCI_GPM_WLAN_CAL_W_SEQUENCE] = mci_hw->wlan_cal_done++; - ar9003_mci_send_message(ah, MCI_GPM, 0, pld, 16, true, false); -} - -int ar9003_mci_setup(struct ath_hw *ah, u32 gpm_addr, void *gpm_buf, - u16 len, u32 sched_addr) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - - mci->gpm_addr = gpm_addr; - mci->gpm_buf = gpm_buf; - mci->gpm_len = len; - mci->sched_addr = sched_addr; - - return ar9003_mci_reset(ah, true, true, true); -} -EXPORT_SYMBOL(ar9003_mci_setup); - -void ar9003_mci_cleanup(struct ath_hw *ah) -{ - /* Turn off MCI and Jupiter mode. */ - REG_WRITE(ah, AR_BTCOEX_CTRL, 0x00); - ar9003_mci_disable_interrupt(ah); -} -EXPORT_SYMBOL(ar9003_mci_cleanup); - -u32 ar9003_mci_state(struct ath_hw *ah, u32 state_type) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 value = 0, tsf; - u8 query_type; - - switch (state_type) { - case MCI_STATE_ENABLE: - if (mci->ready) { - value = REG_READ(ah, AR_BTCOEX_CTRL); - - if ((value == 0xdeadbeef) || (value == 0xffffffff)) - value = 0; - } - value &= AR_BTCOEX_CTRL_MCI_MODE_EN; - break; - case MCI_STATE_LAST_SCHD_MSG_OFFSET: - value = MS(REG_READ(ah, AR_MCI_RX_STATUS), - AR_MCI_RX_LAST_SCHD_MSG_INDEX); - /* Make it in bytes */ - value <<= 4; - break; - case MCI_STATE_REMOTE_SLEEP: - value = MS(REG_READ(ah, AR_MCI_RX_STATUS), - AR_MCI_RX_REMOTE_SLEEP) ? - MCI_BT_SLEEP : MCI_BT_AWAKE; - break; - case MCI_STATE_SET_BT_AWAKE: - mci->bt_state = MCI_BT_AWAKE; - ar9003_mci_send_coex_version_query(ah, true); - ar9003_mci_send_coex_wlan_channels(ah, true); - - if (mci->unhalt_bt_gpm) - ar9003_mci_send_coex_halt_bt_gpm(ah, false, true); - - ar9003_mci_2g5g_switch(ah, false); - break; - case MCI_STATE_RESET_REQ_WAKE: - ar9003_mci_reset_req_wakeup(ah); - mci->update_2g5g = true; - - if (mci->config & ATH_MCI_CONFIG_MCI_OBS_MASK) { - /* Check if we still have control of the GPIOs */ - if ((REG_READ(ah, AR_GLB_GPIO_CONTROL) & - ATH_MCI_CONFIG_MCI_OBS_GPIO) != - ATH_MCI_CONFIG_MCI_OBS_GPIO) { - ar9003_mci_observation_set_up(ah); - } - } - break; - case MCI_STATE_SEND_WLAN_COEX_VERSION: - ar9003_mci_send_coex_version_response(ah, true); - break; - case MCI_STATE_SEND_VERSION_QUERY: - ar9003_mci_send_coex_version_query(ah, true); - break; - case MCI_STATE_SEND_STATUS_QUERY: - query_type = MCI_GPM_COEX_QUERY_BT_TOPOLOGY; - ar9003_mci_send_coex_bt_status_query(ah, true, query_type); - break; - case MCI_STATE_RECOVER_RX: - tsf = ath9k_hw_gettsf32(ah); - if ((tsf - mci->last_recovery) <= MCI_RECOVERY_DUR_TSF) { - ath_dbg(ath9k_hw_common(ah), MCI, - "(MCI) ignore Rx recovery\n"); - break; - } - ath_dbg(ath9k_hw_common(ah), MCI, "(MCI) RECOVER RX\n"); - mci->last_recovery = tsf; - ar9003_mci_prep_interface(ah); - mci->query_bt = true; - mci->need_flush_btinfo = true; - ar9003_mci_send_coex_wlan_channels(ah, true); - ar9003_mci_2g5g_switch(ah, false); - break; - case MCI_STATE_NEED_FTP_STOMP: - value = !(mci->config & ATH_MCI_CONFIG_DISABLE_FTP_STOMP); - break; - case MCI_STATE_NEED_FLUSH_BT_INFO: - value = (!mci->unhalt_bt_gpm && mci->need_flush_btinfo) ? 1 : 0; - mci->need_flush_btinfo = false; - break; - default: - break; - } - - return value; -} -EXPORT_SYMBOL(ar9003_mci_state); - -void ar9003_mci_bt_gain_ctrl(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - - ath_dbg(common, MCI, "Give LNA and SPDT control to BT\n"); - - ar9003_mci_send_lna_take(ah, true); - udelay(50); - - REG_SET_BIT(ah, AR_PHY_GLB_CONTROL, AR_BTCOEX_CTRL_BT_OWN_SPDT_CTRL); - mci->is_2g = false; - mci->update_2g5g = true; - ar9003_mci_send_2g5g_status(ah, true); - - /* Force another 2g5g update at next scanning */ - mci->update_2g5g = true; -} - -void ar9003_mci_set_power_awake(struct ath_hw *ah) -{ - u32 btcoex_ctrl2, diag_sw; - int i; - u8 lna_ctrl, bt_sleep; - - for (i = 0; i < AH_WAIT_TIMEOUT; i++) { - btcoex_ctrl2 = REG_READ(ah, AR_BTCOEX_CTRL2); - if (btcoex_ctrl2 != 0xdeadbeef) - break; - udelay(AH_TIME_QUANTUM); - } - REG_WRITE(ah, AR_BTCOEX_CTRL2, (btcoex_ctrl2 | BIT(23))); - - for (i = 0; i < AH_WAIT_TIMEOUT; i++) { - diag_sw = REG_READ(ah, AR_DIAG_SW); - if (diag_sw != 0xdeadbeef) - break; - udelay(AH_TIME_QUANTUM); - } - REG_WRITE(ah, AR_DIAG_SW, (diag_sw | BIT(27) | BIT(19) | BIT(18))); - lna_ctrl = REG_READ(ah, AR_OBS_BUS_CTRL) & 0x3; - bt_sleep = MS(REG_READ(ah, AR_MCI_RX_STATUS), AR_MCI_RX_REMOTE_SLEEP); - - REG_WRITE(ah, AR_BTCOEX_CTRL2, btcoex_ctrl2); - REG_WRITE(ah, AR_DIAG_SW, diag_sw); - - if (bt_sleep && (lna_ctrl == 2)) { - REG_SET_BIT(ah, AR_BTCOEX_RC, 0x1); - REG_CLR_BIT(ah, AR_BTCOEX_RC, 0x1); - udelay(50); - } -} - -void ar9003_mci_check_gpm_offset(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 offset; - - /* - * This should only be called before "MAC Warm Reset" or "MCI Reset Rx". - */ - offset = MS(REG_READ(ah, AR_MCI_GPM_1), AR_MCI_GPM_WRITE_PTR); - if (mci->gpm_idx == offset) - return; - ath_dbg(common, MCI, "GPM cached write pointer mismatch %d %d\n", - mci->gpm_idx, offset); - mci->query_bt = true; - mci->need_flush_btinfo = true; - mci->gpm_idx = 0; -} - -u32 ar9003_mci_get_next_gpm_offset(struct ath_hw *ah, bool first, u32 *more) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - u32 offset, more_gpm = 0, gpm_ptr; - - if (first) { - gpm_ptr = MS(REG_READ(ah, AR_MCI_GPM_1), AR_MCI_GPM_WRITE_PTR); - - if (gpm_ptr >= mci->gpm_len) - gpm_ptr = 0; - - mci->gpm_idx = gpm_ptr; - return gpm_ptr; - } - - /* - * This could be useful to avoid new GPM message interrupt which - * may lead to spurious interrupt after power sleep, or multiple - * entry of ath_mci_intr(). - * Adding empty GPM check by returning HAL_MCI_GPM_INVALID can - * alleviate this effect, but clearing GPM RX interrupt bit is - * safe, because whether this is called from hw or driver code - * there must be an interrupt bit set/triggered initially - */ - REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, - AR_MCI_INTERRUPT_RX_MSG_GPM); - - gpm_ptr = MS(REG_READ(ah, AR_MCI_GPM_1), AR_MCI_GPM_WRITE_PTR); - offset = gpm_ptr; - - if (!offset) - offset = mci->gpm_len - 1; - else if (offset >= mci->gpm_len) { - if (offset != 0xFFFF) - offset = 0; - } else { - offset--; - } - - if ((offset == 0xFFFF) || (gpm_ptr == mci->gpm_idx)) { - offset = MCI_GPM_INVALID; - more_gpm = MCI_GPM_NOMORE; - goto out; - } - for (;;) { - u32 temp_index; - - /* skip reserved GPM if any */ - - if (offset != mci->gpm_idx) - more_gpm = MCI_GPM_MORE; - else - more_gpm = MCI_GPM_NOMORE; - - temp_index = mci->gpm_idx; - - if (temp_index >= mci->gpm_len) - temp_index = 0; - - mci->gpm_idx++; - - if (mci->gpm_idx >= mci->gpm_len) - mci->gpm_idx = 0; - - if (ar9003_mci_is_gpm_valid(ah, temp_index)) { - offset = temp_index; - break; - } - - if (more_gpm == MCI_GPM_NOMORE) { - offset = MCI_GPM_INVALID; - break; - } - } - - if (offset != MCI_GPM_INVALID) - offset <<= 4; -out: - if (more) - *more = more_gpm; - - return offset; -} -EXPORT_SYMBOL(ar9003_mci_get_next_gpm_offset); - -void ar9003_mci_set_bt_version(struct ath_hw *ah, u8 major, u8 minor) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - - mci->bt_ver_major = major; - mci->bt_ver_minor = minor; - mci->bt_version_known = true; - ath_dbg(ath9k_hw_common(ah), MCI, "MCI BT version set: %d.%d\n", - mci->bt_ver_major, mci->bt_ver_minor); -} -EXPORT_SYMBOL(ar9003_mci_set_bt_version); - -void ar9003_mci_send_wlan_channels(struct ath_hw *ah) -{ - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - - mci->wlan_channels_update = true; - ar9003_mci_send_coex_wlan_channels(ah, true); -} -EXPORT_SYMBOL(ar9003_mci_send_wlan_channels); - -u16 ar9003_mci_get_max_txpower(struct ath_hw *ah, u8 ctlmode) -{ - if (!ah->btcoex_hw.mci.concur_tx) - goto out; - - if (ctlmode == CTL_2GHT20) - return ATH_BTCOEX_HT20_MAX_TXPOWER; - else if (ctlmode == CTL_2GHT40) - return ATH_BTCOEX_HT40_MAX_TXPOWER; - -out: - return -1; -} diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mci.h b/drivers/net/wireless/ath/ath9k/ar9003_mci.h deleted file mode 100644 index 66d7ab9f920d..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9003_mci.h +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef AR9003_MCI_H -#define AR9003_MCI_H - -#define MCI_FLAG_DISABLE_TIMESTAMP 0x00000001 /* Disable time stamp */ -#define MCI_RECOVERY_DUR_TSF (100 * 1000) /* 100 ms */ - -/* Default remote BT device MCI COEX version */ -#define MCI_GPM_COEX_MAJOR_VERSION_DEFAULT 3 -#define MCI_GPM_COEX_MINOR_VERSION_DEFAULT 0 - -/* Local WLAN MCI COEX version */ -#define MCI_GPM_COEX_MAJOR_VERSION_WLAN 3 -#define MCI_GPM_COEX_MINOR_VERSION_WLAN 0 - -enum mci_gpm_coex_query_type { - MCI_GPM_COEX_QUERY_BT_ALL_INFO = BIT(0), - MCI_GPM_COEX_QUERY_BT_TOPOLOGY = BIT(1), - MCI_GPM_COEX_QUERY_BT_DEBUG = BIT(2), -}; - -enum mci_gpm_coex_halt_bt_gpm { - MCI_GPM_COEX_BT_GPM_UNHALT, - MCI_GPM_COEX_BT_GPM_HALT -}; - -enum mci_gpm_coex_bt_update_flags_op { - MCI_GPM_COEX_BT_FLAGS_READ, - MCI_GPM_COEX_BT_FLAGS_SET, - MCI_GPM_COEX_BT_FLAGS_CLEAR -}; - -#define MCI_NUM_BT_CHANNELS 79 - -#define MCI_BT_MCI_FLAGS_UPDATE_CORR 0x00000002 -#define MCI_BT_MCI_FLAGS_UPDATE_HDR 0x00000004 -#define MCI_BT_MCI_FLAGS_UPDATE_PLD 0x00000008 -#define MCI_BT_MCI_FLAGS_LNA_CTRL 0x00000010 -#define MCI_BT_MCI_FLAGS_DEBUG 0x00000020 -#define MCI_BT_MCI_FLAGS_SCHED_MSG 0x00000040 -#define MCI_BT_MCI_FLAGS_CONT_MSG 0x00000080 -#define MCI_BT_MCI_FLAGS_COEX_GPM 0x00000100 -#define MCI_BT_MCI_FLAGS_CPU_INT_MSG 0x00000200 -#define MCI_BT_MCI_FLAGS_MCI_MODE 0x00000400 -#define MCI_BT_MCI_FLAGS_AR9462_MODE 0x00001000 -#define MCI_BT_MCI_FLAGS_OTHER 0x00010000 - -#define MCI_DEFAULT_BT_MCI_FLAGS 0x00011dde - -#define MCI_TOGGLE_BT_MCI_FLAGS (MCI_BT_MCI_FLAGS_UPDATE_CORR | \ - MCI_BT_MCI_FLAGS_UPDATE_HDR | \ - MCI_BT_MCI_FLAGS_UPDATE_PLD | \ - MCI_BT_MCI_FLAGS_MCI_MODE) - -#define MCI_2G_FLAGS_CLEAR_MASK 0x00000000 -#define MCI_2G_FLAGS_SET_MASK MCI_TOGGLE_BT_MCI_FLAGS -#define MCI_2G_FLAGS MCI_DEFAULT_BT_MCI_FLAGS - -#define MCI_5G_FLAGS_CLEAR_MASK MCI_TOGGLE_BT_MCI_FLAGS -#define MCI_5G_FLAGS_SET_MASK 0x00000000 -#define MCI_5G_FLAGS (MCI_DEFAULT_BT_MCI_FLAGS & \ - ~MCI_TOGGLE_BT_MCI_FLAGS) - -/* - * Default value for AR9462 is 0x00002201 - */ -#define ATH_MCI_CONFIG_CONCUR_TX 0x00000003 -#define ATH_MCI_CONFIG_MCI_OBS_MCI 0x00000004 -#define ATH_MCI_CONFIG_MCI_OBS_TXRX 0x00000008 -#define ATH_MCI_CONFIG_MCI_OBS_BT 0x00000010 -#define ATH_MCI_CONFIG_DISABLE_MCI_CAL 0x00000020 -#define ATH_MCI_CONFIG_DISABLE_OSLA 0x00000040 -#define ATH_MCI_CONFIG_DISABLE_FTP_STOMP 0x00000080 -#define ATH_MCI_CONFIG_AGGR_THRESH 0x00000700 -#define ATH_MCI_CONFIG_AGGR_THRESH_S 8 -#define ATH_MCI_CONFIG_DISABLE_AGGR_THRESH 0x00000800 -#define ATH_MCI_CONFIG_CLK_DIV 0x00003000 -#define ATH_MCI_CONFIG_CLK_DIV_S 12 -#define ATH_MCI_CONFIG_DISABLE_TUNING 0x00004000 -#define ATH_MCI_CONFIG_MCI_WEIGHT_DBG 0x40000000 -#define ATH_MCI_CONFIG_DISABLE_MCI 0x80000000 - -#define ATH_MCI_CONFIG_MCI_OBS_MASK (ATH_MCI_CONFIG_MCI_OBS_MCI | \ - ATH_MCI_CONFIG_MCI_OBS_TXRX | \ - ATH_MCI_CONFIG_MCI_OBS_BT) -#define ATH_MCI_CONFIG_MCI_OBS_GPIO 0x0000002F - -enum mci_message_header { /* length of payload */ - MCI_LNA_CTRL = 0x10, /* len = 0 */ - MCI_CONT_NACK = 0x20, /* len = 0 */ - MCI_CONT_INFO = 0x30, /* len = 4 */ - MCI_CONT_RST = 0x40, /* len = 0 */ - MCI_SCHD_INFO = 0x50, /* len = 16 */ - MCI_CPU_INT = 0x60, /* len = 4 */ - MCI_SYS_WAKING = 0x70, /* len = 0 */ - MCI_GPM = 0x80, /* len = 16 */ - MCI_LNA_INFO = 0x90, /* len = 1 */ - MCI_LNA_STATE = 0x94, - MCI_LNA_TAKE = 0x98, - MCI_LNA_TRANS = 0x9c, - MCI_SYS_SLEEPING = 0xa0, /* len = 0 */ - MCI_REQ_WAKE = 0xc0, /* len = 0 */ - MCI_DEBUG_16 = 0xfe, /* len = 2 */ - MCI_REMOTE_RESET = 0xff /* len = 16 */ -}; - -enum ath_mci_gpm_coex_profile_type { - MCI_GPM_COEX_PROFILE_UNKNOWN, - MCI_GPM_COEX_PROFILE_RFCOMM, - MCI_GPM_COEX_PROFILE_A2DP, - MCI_GPM_COEX_PROFILE_HID, - MCI_GPM_COEX_PROFILE_BNEP, - MCI_GPM_COEX_PROFILE_VOICE, - MCI_GPM_COEX_PROFILE_A2DPVO, - MCI_GPM_COEX_PROFILE_MAX -}; - -/* MCI GPM/Coex opcode/type definitions */ -enum { - MCI_GPM_COEX_W_GPM_PAYLOAD = 1, - MCI_GPM_COEX_B_GPM_TYPE = 4, - MCI_GPM_COEX_B_GPM_OPCODE = 5, - /* MCI_GPM_WLAN_CAL_REQ, MCI_GPM_WLAN_CAL_DONE */ - MCI_GPM_WLAN_CAL_W_SEQUENCE = 2, - - /* MCI_GPM_COEX_VERSION_QUERY */ - /* MCI_GPM_COEX_VERSION_RESPONSE */ - MCI_GPM_COEX_B_MAJOR_VERSION = 6, - MCI_GPM_COEX_B_MINOR_VERSION = 7, - /* MCI_GPM_COEX_STATUS_QUERY */ - MCI_GPM_COEX_B_BT_BITMAP = 6, - MCI_GPM_COEX_B_WLAN_BITMAP = 7, - /* MCI_GPM_COEX_HALT_BT_GPM */ - MCI_GPM_COEX_B_HALT_STATE = 6, - /* MCI_GPM_COEX_WLAN_CHANNELS */ - MCI_GPM_COEX_B_CHANNEL_MAP = 6, - /* MCI_GPM_COEX_BT_PROFILE_INFO */ - MCI_GPM_COEX_B_PROFILE_TYPE = 6, - MCI_GPM_COEX_B_PROFILE_LINKID = 7, - MCI_GPM_COEX_B_PROFILE_STATE = 8, - MCI_GPM_COEX_B_PROFILE_ROLE = 9, - MCI_GPM_COEX_B_PROFILE_RATE = 10, - MCI_GPM_COEX_B_PROFILE_VOTYPE = 11, - MCI_GPM_COEX_H_PROFILE_T = 12, - MCI_GPM_COEX_B_PROFILE_W = 14, - MCI_GPM_COEX_B_PROFILE_A = 15, - /* MCI_GPM_COEX_BT_STATUS_UPDATE */ - MCI_GPM_COEX_B_STATUS_TYPE = 6, - MCI_GPM_COEX_B_STATUS_LINKID = 7, - MCI_GPM_COEX_B_STATUS_STATE = 8, - /* MCI_GPM_COEX_BT_UPDATE_FLAGS */ - MCI_GPM_COEX_W_BT_FLAGS = 6, - MCI_GPM_COEX_B_BT_FLAGS_OP = 10 -}; - -enum mci_gpm_subtype { - MCI_GPM_BT_CAL_REQ = 0, - MCI_GPM_BT_CAL_GRANT = 1, - MCI_GPM_BT_CAL_DONE = 2, - MCI_GPM_WLAN_CAL_REQ = 3, - MCI_GPM_WLAN_CAL_GRANT = 4, - MCI_GPM_WLAN_CAL_DONE = 5, - MCI_GPM_COEX_AGENT = 0x0c, - MCI_GPM_RSVD_PATTERN = 0xfe, - MCI_GPM_RSVD_PATTERN32 = 0xfefefefe, - MCI_GPM_BT_DEBUG = 0xff -}; - -enum mci_bt_state { - MCI_BT_SLEEP, - MCI_BT_AWAKE, - MCI_BT_CAL_START, - MCI_BT_CAL -}; - -/* Type of state query */ -enum mci_state_type { - MCI_STATE_ENABLE, - MCI_STATE_SET_BT_AWAKE, - MCI_STATE_LAST_SCHD_MSG_OFFSET, - MCI_STATE_REMOTE_SLEEP, - MCI_STATE_RESET_REQ_WAKE, - MCI_STATE_SEND_WLAN_COEX_VERSION, - MCI_STATE_SEND_VERSION_QUERY, - MCI_STATE_SEND_STATUS_QUERY, - MCI_STATE_RECOVER_RX, - MCI_STATE_NEED_FTP_STOMP, - MCI_STATE_DEBUG, - MCI_STATE_NEED_FLUSH_BT_INFO, - MCI_STATE_MAX -}; - -enum mci_gpm_coex_opcode { - MCI_GPM_COEX_VERSION_QUERY, - MCI_GPM_COEX_VERSION_RESPONSE, - MCI_GPM_COEX_STATUS_QUERY, - MCI_GPM_COEX_HALT_BT_GPM, - MCI_GPM_COEX_WLAN_CHANNELS, - MCI_GPM_COEX_BT_PROFILE_INFO, - MCI_GPM_COEX_BT_STATUS_UPDATE, - MCI_GPM_COEX_BT_UPDATE_FLAGS, - MCI_GPM_COEX_NOOP, -}; - -#define MCI_GPM_NOMORE 0 -#define MCI_GPM_MORE 1 -#define MCI_GPM_INVALID 0xffffffff - -#define MCI_GPM_RECYCLE(_p_gpm) do { \ - *(((u32 *)_p_gpm) + MCI_GPM_COEX_W_GPM_PAYLOAD) = \ - MCI_GPM_RSVD_PATTERN32; \ -} while (0) - -#define MCI_GPM_TYPE(_p_gpm) \ - (*(((u8 *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_TYPE) & 0xff) - -#define MCI_GPM_OPCODE(_p_gpm) \ - (*(((u8 *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_OPCODE) & 0xff) - -#define MCI_GPM_SET_CAL_TYPE(_p_gpm, _cal_type) do { \ - *(((u8 *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_TYPE) = (_cal_type) & 0xff;\ -} while (0) - -#define MCI_GPM_SET_TYPE_OPCODE(_p_gpm, _type, _opcode) do { \ - *(((u8 *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_TYPE) = (_type) & 0xff; \ - *(((u8 *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_OPCODE) = (_opcode) & 0xff;\ -} while (0) - -#define MCI_GPM_IS_CAL_TYPE(_type) ((_type) <= MCI_GPM_WLAN_CAL_DONE) - -/* - * Functions that are available to the MCI driver core. - */ -bool ar9003_mci_send_message(struct ath_hw *ah, u8 header, u32 flag, - u32 *payload, u8 len, bool wait_done, - bool check_bt); -u32 ar9003_mci_state(struct ath_hw *ah, u32 state_type); -int ar9003_mci_setup(struct ath_hw *ah, u32 gpm_addr, void *gpm_buf, - u16 len, u32 sched_addr); -void ar9003_mci_cleanup(struct ath_hw *ah); -void ar9003_mci_get_interrupt(struct ath_hw *ah, u32 *raw_intr, - u32 *rx_msg_intr); -u32 ar9003_mci_get_next_gpm_offset(struct ath_hw *ah, bool first, u32 *more); -void ar9003_mci_set_bt_version(struct ath_hw *ah, u8 major, u8 minor); -void ar9003_mci_send_wlan_channels(struct ath_hw *ah); -/* - * These functions are used by ath9k_hw. - */ - -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT - -void ar9003_mci_stop_bt(struct ath_hw *ah, bool save_fullsleep); -void ar9003_mci_init_cal_req(struct ath_hw *ah, bool *is_reusable); -void ar9003_mci_init_cal_done(struct ath_hw *ah); -void ar9003_mci_set_full_sleep(struct ath_hw *ah); -void ar9003_mci_2g5g_switch(struct ath_hw *ah, bool force); -void ar9003_mci_check_bt(struct ath_hw *ah); -bool ar9003_mci_start_reset(struct ath_hw *ah, struct ath9k_channel *chan); -int ar9003_mci_end_reset(struct ath_hw *ah, struct ath9k_channel *chan, - struct ath9k_hw_cal_data *caldata); -int ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g, - bool is_full_sleep); -void ar9003_mci_get_isr(struct ath_hw *ah, enum ath9k_int *masked); -void ar9003_mci_bt_gain_ctrl(struct ath_hw *ah); -void ar9003_mci_set_power_awake(struct ath_hw *ah); -void ar9003_mci_check_gpm_offset(struct ath_hw *ah); -u16 ar9003_mci_get_max_txpower(struct ath_hw *ah, u8 ctlmode); - -#else - -static inline void ar9003_mci_stop_bt(struct ath_hw *ah, bool save_fullsleep) -{ -} -static inline void ar9003_mci_init_cal_req(struct ath_hw *ah, bool *is_reusable) -{ -} -static inline void ar9003_mci_init_cal_done(struct ath_hw *ah) -{ -} -static inline void ar9003_mci_set_full_sleep(struct ath_hw *ah) -{ -} -static inline void ar9003_mci_2g5g_switch(struct ath_hw *ah, bool wait_done) -{ -} -static inline void ar9003_mci_check_bt(struct ath_hw *ah) -{ -} -static inline bool ar9003_mci_start_reset(struct ath_hw *ah, struct ath9k_channel *chan) -{ - return false; -} -static inline int ar9003_mci_end_reset(struct ath_hw *ah, struct ath9k_channel *chan, - struct ath9k_hw_cal_data *caldata) -{ - return 0; -} -static inline void ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g, - bool is_full_sleep) -{ -} -static inline void ar9003_mci_get_isr(struct ath_hw *ah, enum ath9k_int *masked) -{ -} -static inline void ar9003_mci_bt_gain_ctrl(struct ath_hw *ah) -{ -} -static inline void ar9003_mci_set_power_awake(struct ath_hw *ah) -{ -} -static inline void ar9003_mci_check_gpm_offset(struct ath_hw *ah) -{ -} -static inline u16 ar9003_mci_get_max_txpower(struct ath_hw *ah, u8 ctlmode) -{ - return -1; -} -#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ - -#endif diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c deleted file mode 100644 index 09c1f9da67a0..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c +++ /dev/null @@ -1,1010 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "hw.h" -#include "ar9003_phy.h" - -void ar9003_paprd_enable(struct ath_hw *ah, bool val) -{ - struct ath9k_channel *chan = ah->curchan; - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - - /* - * 3 bits for modalHeader5G.papdRateMaskHt20 - * is used for sub-band disabling of PAPRD. - * 5G band is divided into 3 sub-bands -- upper, - * middle, lower. - * if bit 30 of modalHeader5G.papdRateMaskHt20 is set - * -- disable PAPRD for upper band 5GHz - * if bit 29 of modalHeader5G.papdRateMaskHt20 is set - * -- disable PAPRD for middle band 5GHz - * if bit 28 of modalHeader5G.papdRateMaskHt20 is set - * -- disable PAPRD for lower band 5GHz - */ - - if (IS_CHAN_5GHZ(chan)) { - if (chan->channel >= UPPER_5G_SUB_BAND_START) { - if (le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20) - & BIT(30)) - val = false; - } else if (chan->channel >= MID_5G_SUB_BAND_START) { - if (le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20) - & BIT(29)) - val = false; - } else { - if (le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20) - & BIT(28)) - val = false; - } - } - - if (val) { - ah->paprd_table_write_done = true; - ath9k_hw_apply_txpower(ah, chan, false); - } - - REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0, - AR_PHY_PAPRD_CTRL0_PAPRD_ENABLE, !!val); - if (ah->caps.tx_chainmask & BIT(1)) - REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B1, - AR_PHY_PAPRD_CTRL0_PAPRD_ENABLE, !!val); - if (ah->caps.tx_chainmask & BIT(2)) - REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B2, - AR_PHY_PAPRD_CTRL0_PAPRD_ENABLE, !!val); -} -EXPORT_SYMBOL(ar9003_paprd_enable); - -static int ar9003_get_training_power_2g(struct ath_hw *ah) -{ - struct ath9k_channel *chan = ah->curchan; - unsigned int power, scale, delta; - - scale = ar9003_get_paprd_scale_factor(ah, chan); - - if (AR_SREV_9330(ah) || AR_SREV_9340(ah) || - AR_SREV_9462(ah) || AR_SREV_9565(ah)) { - power = ah->paprd_target_power + 2; - } else if (AR_SREV_9485(ah)) { - power = 25; - } else { - power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE5, - AR_PHY_POWERTX_RATE5_POWERTXHT20_0); - - delta = abs((int) ah->paprd_target_power - (int) power); - if (delta > scale) - return -1; - - if (delta < 4) - power -= 4 - delta; - } - - return power; -} - -static int ar9003_get_training_power_5g(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_channel *chan = ah->curchan; - unsigned int power, scale, delta; - - scale = ar9003_get_paprd_scale_factor(ah, chan); - - if (IS_CHAN_HT40(chan)) - power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE8, - AR_PHY_POWERTX_RATE8_POWERTXHT40_5); - else - power = REG_READ_FIELD(ah, AR_PHY_POWERTX_RATE6, - AR_PHY_POWERTX_RATE6_POWERTXHT20_5); - - power += scale; - delta = abs((int) ah->paprd_target_power - (int) power); - if (delta > scale) - return -1; - - switch (get_streams(ah->txchainmask)) { - case 1: - delta = 6; - break; - case 2: - delta = 4; - break; - case 3: - delta = 2; - break; - default: - delta = 0; - ath_dbg(common, CALIBRATE, "Invalid tx-chainmask: %u\n", - ah->txchainmask); - } - - power += delta; - return power; -} - -static int ar9003_paprd_setup_single_table(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - static const u32 ctrl0[3] = { - AR_PHY_PAPRD_CTRL0_B0, - AR_PHY_PAPRD_CTRL0_B1, - AR_PHY_PAPRD_CTRL0_B2 - }; - static const u32 ctrl1[3] = { - AR_PHY_PAPRD_CTRL1_B0, - AR_PHY_PAPRD_CTRL1_B1, - AR_PHY_PAPRD_CTRL1_B2 - }; - int training_power; - int i, val; - u32 am2pm_mask = ah->paprd_ratemask; - - if (IS_CHAN_2GHZ(ah->curchan)) - training_power = ar9003_get_training_power_2g(ah); - else - training_power = ar9003_get_training_power_5g(ah); - - ath_dbg(common, CALIBRATE, "Training power: %d, Target power: %d\n", - training_power, ah->paprd_target_power); - - if (training_power < 0) { - ath_dbg(common, CALIBRATE, - "PAPRD target power delta out of range\n"); - return -ERANGE; - } - ah->paprd_training_power = training_power; - - if (AR_SREV_9330(ah)) - am2pm_mask = 0; - - REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2AM, AR_PHY_PAPRD_AM2AM_MASK, - ah->paprd_ratemask); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2PM, AR_PHY_PAPRD_AM2PM_MASK, - am2pm_mask); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_HT40, AR_PHY_PAPRD_HT40_MASK, - ah->paprd_ratemask_ht40); - - ath_dbg(common, CALIBRATE, "PAPRD HT20 mask: 0x%x, HT40 mask: 0x%x\n", - ah->paprd_ratemask, ah->paprd_ratemask_ht40); - - for (i = 0; i < ah->caps.max_txchains; i++) { - REG_RMW_FIELD(ah, ctrl0[i], - AR_PHY_PAPRD_CTRL0_USE_SINGLE_TABLE_MASK, 1); - REG_RMW_FIELD(ah, ctrl1[i], - AR_PHY_PAPRD_CTRL1_ADAPTIVE_AM2PM_ENABLE, 1); - REG_RMW_FIELD(ah, ctrl1[i], - AR_PHY_PAPRD_CTRL1_ADAPTIVE_AM2AM_ENABLE, 1); - REG_RMW_FIELD(ah, ctrl1[i], - AR_PHY_PAPRD_CTRL1_ADAPTIVE_SCALING_ENA, 0); - REG_RMW_FIELD(ah, ctrl1[i], - AR_PHY_PAPRD_CTRL1_PA_GAIN_SCALE_FACT_MASK, 181); - REG_RMW_FIELD(ah, ctrl1[i], - AR_PHY_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACT, 361); - REG_RMW_FIELD(ah, ctrl1[i], - AR_PHY_PAPRD_CTRL1_ADAPTIVE_SCALING_ENA, 0); - REG_RMW_FIELD(ah, ctrl0[i], - AR_PHY_PAPRD_CTRL0_PAPRD_MAG_THRSH, 3); - } - - ar9003_paprd_enable(ah, false); - - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL1, - AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP, 0x30); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL1, - AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE, 1); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL1, - AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE, 1); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL1, - AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE, 0); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL1, - AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE, 0); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL1, - AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING, 28); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL1, - AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE, 1); - - if (AR_SREV_9485(ah)) { - val = 148; - } else { - if (IS_CHAN_2GHZ(ah->curchan)) { - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) - val = 145; - else - val = 147; - } else { - val = 137; - } - } - - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL2, - AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN, val); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, - AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN, 4); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, - AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN, 4); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, - AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES, 7); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, - AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL, 1); - - if (AR_SREV_9485(ah) || - AR_SREV_9462(ah) || - AR_SREV_9565(ah) || - AR_SREV_9550(ah) || - AR_SREV_9330(ah) || - AR_SREV_9340(ah)) - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, - AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP, -3); - else - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, - AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP, -6); - - val = -10; - - if (IS_CHAN_2GHZ(ah->curchan) && !AR_SREV_9462(ah) && !AR_SREV_9565(ah)) - val = -15; - - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, - AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE, - val); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, - AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE, 1); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL4, - AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA, 0); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL4, - AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR, 400); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL4, - AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES, - 100); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_PRE_POST_SCALE_0_B0, - AR_PHY_PAPRD_PRE_POST_SCALING, 261376); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_PRE_POST_SCALE_1_B0, - AR_PHY_PAPRD_PRE_POST_SCALING, 248079); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_PRE_POST_SCALE_2_B0, - AR_PHY_PAPRD_PRE_POST_SCALING, 233759); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_PRE_POST_SCALE_3_B0, - AR_PHY_PAPRD_PRE_POST_SCALING, 220464); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_PRE_POST_SCALE_4_B0, - AR_PHY_PAPRD_PRE_POST_SCALING, 208194); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_PRE_POST_SCALE_5_B0, - AR_PHY_PAPRD_PRE_POST_SCALING, 196949); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_PRE_POST_SCALE_6_B0, - AR_PHY_PAPRD_PRE_POST_SCALING, 185706); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_PRE_POST_SCALE_7_B0, - AR_PHY_PAPRD_PRE_POST_SCALING, 175487); - return 0; -} - -static void ar9003_paprd_get_gain_table(struct ath_hw *ah) -{ - u32 *entry = ah->paprd_gain_table_entries; - u8 *index = ah->paprd_gain_table_index; - u32 reg = AR_PHY_TXGAIN_TABLE; - int i; - - for (i = 0; i < PAPRD_GAIN_TABLE_ENTRIES; i++) { - entry[i] = REG_READ(ah, reg); - index[i] = (entry[i] >> 24) & 0xff; - reg += 4; - } -} - -static unsigned int ar9003_get_desired_gain(struct ath_hw *ah, int chain, - int target_power) -{ - int olpc_gain_delta = 0, cl_gain_mod; - int alpha_therm, alpha_volt; - int therm_cal_value, volt_cal_value; - int therm_value, volt_value; - int thermal_gain_corr, voltage_gain_corr; - int desired_scale, desired_gain = 0; - u32 reg_olpc = 0, reg_cl_gain = 0; - - REG_CLR_BIT(ah, AR_PHY_PAPRD_TRAINER_STAT1, - AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE); - desired_scale = REG_READ_FIELD(ah, AR_PHY_TPC_12, - AR_PHY_TPC_12_DESIRED_SCALE_HT40_5); - alpha_therm = REG_READ_FIELD(ah, AR_PHY_TPC_19, - AR_PHY_TPC_19_ALPHA_THERM); - alpha_volt = REG_READ_FIELD(ah, AR_PHY_TPC_19, - AR_PHY_TPC_19_ALPHA_VOLT); - therm_cal_value = REG_READ_FIELD(ah, AR_PHY_TPC_18, - AR_PHY_TPC_18_THERM_CAL_VALUE); - volt_cal_value = REG_READ_FIELD(ah, AR_PHY_TPC_18, - AR_PHY_TPC_18_VOLT_CAL_VALUE); - therm_value = REG_READ_FIELD(ah, AR_PHY_BB_THERM_ADC_4, - AR_PHY_BB_THERM_ADC_4_LATEST_THERM_VALUE); - volt_value = REG_READ_FIELD(ah, AR_PHY_BB_THERM_ADC_4, - AR_PHY_BB_THERM_ADC_4_LATEST_VOLT_VALUE); - - switch (chain) { - case 0: - reg_olpc = AR_PHY_TPC_11_B0; - reg_cl_gain = AR_PHY_CL_TAB_0; - break; - case 1: - reg_olpc = AR_PHY_TPC_11_B1; - reg_cl_gain = AR_PHY_CL_TAB_1; - break; - case 2: - reg_olpc = AR_PHY_TPC_11_B2; - reg_cl_gain = AR_PHY_CL_TAB_2; - break; - default: - ath_dbg(ath9k_hw_common(ah), CALIBRATE, - "Invalid chainmask: %d\n", chain); - break; - } - - olpc_gain_delta = REG_READ_FIELD(ah, reg_olpc, - AR_PHY_TPC_11_OLPC_GAIN_DELTA); - cl_gain_mod = REG_READ_FIELD(ah, reg_cl_gain, - AR_PHY_CL_TAB_CL_GAIN_MOD); - - if (olpc_gain_delta >= 128) - olpc_gain_delta = olpc_gain_delta - 256; - - thermal_gain_corr = (alpha_therm * (therm_value - therm_cal_value) + - (256 / 2)) / 256; - voltage_gain_corr = (alpha_volt * (volt_value - volt_cal_value) + - (128 / 2)) / 128; - desired_gain = target_power - olpc_gain_delta - thermal_gain_corr - - voltage_gain_corr + desired_scale + cl_gain_mod; - - return desired_gain; -} - -static void ar9003_tx_force_gain(struct ath_hw *ah, unsigned int gain_index) -{ - int selected_gain_entry, txbb1dbgain, txbb6dbgain, txmxrgain; - int padrvgnA, padrvgnB, padrvgnC, padrvgnD; - u32 *gain_table_entries = ah->paprd_gain_table_entries; - - selected_gain_entry = gain_table_entries[gain_index]; - txbb1dbgain = selected_gain_entry & 0x7; - txbb6dbgain = (selected_gain_entry >> 3) & 0x3; - txmxrgain = (selected_gain_entry >> 5) & 0xf; - padrvgnA = (selected_gain_entry >> 9) & 0xf; - padrvgnB = (selected_gain_entry >> 13) & 0xf; - padrvgnC = (selected_gain_entry >> 17) & 0xf; - padrvgnD = (selected_gain_entry >> 21) & 0x3; - - REG_RMW_FIELD(ah, AR_PHY_TX_FORCED_GAIN, - AR_PHY_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN, txbb1dbgain); - REG_RMW_FIELD(ah, AR_PHY_TX_FORCED_GAIN, - AR_PHY_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN, txbb6dbgain); - REG_RMW_FIELD(ah, AR_PHY_TX_FORCED_GAIN, - AR_PHY_TX_FORCED_GAIN_FORCED_TXMXRGAIN, txmxrgain); - REG_RMW_FIELD(ah, AR_PHY_TX_FORCED_GAIN, - AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNA, padrvgnA); - REG_RMW_FIELD(ah, AR_PHY_TX_FORCED_GAIN, - AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNB, padrvgnB); - REG_RMW_FIELD(ah, AR_PHY_TX_FORCED_GAIN, - AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNC, padrvgnC); - REG_RMW_FIELD(ah, AR_PHY_TX_FORCED_GAIN, - AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGND, padrvgnD); - REG_RMW_FIELD(ah, AR_PHY_TX_FORCED_GAIN, - AR_PHY_TX_FORCED_GAIN_FORCED_ENABLE_PAL, 0); - REG_RMW_FIELD(ah, AR_PHY_TX_FORCED_GAIN, - AR_PHY_TX_FORCED_GAIN_FORCE_TX_GAIN, 0); - REG_RMW_FIELD(ah, AR_PHY_TPC_1, AR_PHY_TPC_1_FORCED_DAC_GAIN, 0); - REG_RMW_FIELD(ah, AR_PHY_TPC_1, AR_PHY_TPC_1_FORCE_DAC_GAIN, 0); -} - -static inline int find_expn(int num) -{ - return fls(num) - 1; -} - -static inline int find_proper_scale(int expn, int N) -{ - return (expn > N) ? expn - 10 : 0; -} - -#define NUM_BIN 23 - -static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain) -{ - unsigned int thresh_accum_cnt; - int x_est[NUM_BIN + 1], Y[NUM_BIN + 1], theta[NUM_BIN + 1]; - int PA_in[NUM_BIN + 1]; - int B1_tmp[NUM_BIN + 1], B2_tmp[NUM_BIN + 1]; - unsigned int B1_abs_max, B2_abs_max; - int max_index, scale_factor; - int y_est[NUM_BIN + 1]; - int x_est_fxp1_nonlin, x_tilde[NUM_BIN + 1]; - unsigned int x_tilde_abs; - int G_fxp, Y_intercept, order_x_by_y, M, I, L, sum_y_sqr, sum_y_quad; - int Q_x, Q_B1, Q_B2, beta_raw, alpha_raw, scale_B; - int Q_scale_B, Q_beta, Q_alpha, alpha, beta, order_1, order_2; - int order1_5x, order2_3x, order1_5x_rem, order2_3x_rem; - int y5, y3, tmp; - int theta_low_bin = 0; - int i; - - /* disregard any bin that contains <= 16 samples */ - thresh_accum_cnt = 16; - scale_factor = 5; - max_index = 0; - memset(theta, 0, sizeof(theta)); - memset(x_est, 0, sizeof(x_est)); - memset(Y, 0, sizeof(Y)); - memset(y_est, 0, sizeof(y_est)); - memset(x_tilde, 0, sizeof(x_tilde)); - - for (i = 0; i < NUM_BIN; i++) { - s32 accum_cnt, accum_tx, accum_rx, accum_ang; - - /* number of samples */ - accum_cnt = data_L[i] & 0xffff; - - if (accum_cnt <= thresh_accum_cnt) - continue; - - /* sum(tx amplitude) */ - accum_tx = ((data_L[i] >> 16) & 0xffff) | - ((data_U[i] & 0x7ff) << 16); - - /* sum(rx amplitude distance to lower bin edge) */ - accum_rx = ((data_U[i] >> 11) & 0x1f) | - ((data_L[i + 23] & 0xffff) << 5); - - /* sum(angles) */ - accum_ang = ((data_L[i + 23] >> 16) & 0xffff) | - ((data_U[i + 23] & 0x7ff) << 16); - - accum_tx <<= scale_factor; - accum_rx <<= scale_factor; - x_est[i + 1] = (((accum_tx + accum_cnt) / accum_cnt) + 32) >> - scale_factor; - - Y[i + 1] = ((((accum_rx + accum_cnt) / accum_cnt) + 32) >> - scale_factor) + - (1 << scale_factor) * max_index + 16; - - if (accum_ang >= (1 << 26)) - accum_ang -= 1 << 27; - - theta[i + 1] = ((accum_ang * (1 << scale_factor)) + accum_cnt) / - accum_cnt; - - max_index++; - } - - /* - * Find average theta of first 5 bin and all of those to same value. - * Curve is linear at that range. - */ - for (i = 1; i < 6; i++) - theta_low_bin += theta[i]; - - theta_low_bin = theta_low_bin / 5; - for (i = 1; i < 6; i++) - theta[i] = theta_low_bin; - - /* Set values at origin */ - theta[0] = theta_low_bin; - for (i = 0; i <= max_index; i++) - theta[i] -= theta_low_bin; - - x_est[0] = 0; - Y[0] = 0; - scale_factor = 8; - - /* low signal gain */ - if (x_est[6] == x_est[3]) - return false; - - G_fxp = - (((Y[6] - Y[3]) * 1 << scale_factor) + - (x_est[6] - x_est[3])) / (x_est[6] - x_est[3]); - - /* prevent division by zero */ - if (G_fxp == 0) - return false; - - Y_intercept = - (G_fxp * (x_est[0] - x_est[3]) + - (1 << scale_factor)) / (1 << scale_factor) + Y[3]; - - for (i = 0; i <= max_index; i++) - y_est[i] = Y[i] - Y_intercept; - - for (i = 0; i <= 3; i++) { - y_est[i] = i * 32; - x_est[i] = ((y_est[i] * 1 << scale_factor) + G_fxp) / G_fxp; - } - - if (y_est[max_index] == 0) - return false; - - x_est_fxp1_nonlin = - x_est[max_index] - ((1 << scale_factor) * y_est[max_index] + - G_fxp) / G_fxp; - - order_x_by_y = - (x_est_fxp1_nonlin + y_est[max_index]) / y_est[max_index]; - - if (order_x_by_y == 0) - M = 10; - else if (order_x_by_y == 1) - M = 9; - else - M = 8; - - I = (max_index > 15) ? 7 : max_index >> 1; - L = max_index - I; - scale_factor = 8; - sum_y_sqr = 0; - sum_y_quad = 0; - x_tilde_abs = 0; - - for (i = 0; i <= L; i++) { - unsigned int y_sqr; - unsigned int y_quad; - unsigned int tmp_abs; - - /* prevent division by zero */ - if (y_est[i + I] == 0) - return false; - - x_est_fxp1_nonlin = - x_est[i + I] - ((1 << scale_factor) * y_est[i + I] + - G_fxp) / G_fxp; - - x_tilde[i] = - (x_est_fxp1_nonlin * (1 << M) + y_est[i + I]) / y_est[i + - I]; - x_tilde[i] = - (x_tilde[i] * (1 << M) + y_est[i + I]) / y_est[i + I]; - x_tilde[i] = - (x_tilde[i] * (1 << M) + y_est[i + I]) / y_est[i + I]; - y_sqr = - (y_est[i + I] * y_est[i + I] + - (scale_factor * scale_factor)) / (scale_factor * - scale_factor); - tmp_abs = abs(x_tilde[i]); - if (tmp_abs > x_tilde_abs) - x_tilde_abs = tmp_abs; - - y_quad = y_sqr * y_sqr; - sum_y_sqr = sum_y_sqr + y_sqr; - sum_y_quad = sum_y_quad + y_quad; - B1_tmp[i] = y_sqr * (L + 1); - B2_tmp[i] = y_sqr; - } - - B1_abs_max = 0; - B2_abs_max = 0; - for (i = 0; i <= L; i++) { - int abs_val; - - B1_tmp[i] -= sum_y_sqr; - B2_tmp[i] = sum_y_quad - sum_y_sqr * B2_tmp[i]; - - abs_val = abs(B1_tmp[i]); - if (abs_val > B1_abs_max) - B1_abs_max = abs_val; - - abs_val = abs(B2_tmp[i]); - if (abs_val > B2_abs_max) - B2_abs_max = abs_val; - } - - Q_x = find_proper_scale(find_expn(x_tilde_abs), 10); - Q_B1 = find_proper_scale(find_expn(B1_abs_max), 10); - Q_B2 = find_proper_scale(find_expn(B2_abs_max), 10); - - beta_raw = 0; - alpha_raw = 0; - for (i = 0; i <= L; i++) { - x_tilde[i] = x_tilde[i] / (1 << Q_x); - B1_tmp[i] = B1_tmp[i] / (1 << Q_B1); - B2_tmp[i] = B2_tmp[i] / (1 << Q_B2); - beta_raw = beta_raw + B1_tmp[i] * x_tilde[i]; - alpha_raw = alpha_raw + B2_tmp[i] * x_tilde[i]; - } - - scale_B = - ((sum_y_quad / scale_factor) * (L + 1) - - (sum_y_sqr / scale_factor) * sum_y_sqr) * scale_factor; - - Q_scale_B = find_proper_scale(find_expn(abs(scale_B)), 10); - scale_B = scale_B / (1 << Q_scale_B); - if (scale_B == 0) - return false; - Q_beta = find_proper_scale(find_expn(abs(beta_raw)), 10); - Q_alpha = find_proper_scale(find_expn(abs(alpha_raw)), 10); - beta_raw = beta_raw / (1 << Q_beta); - alpha_raw = alpha_raw / (1 << Q_alpha); - alpha = (alpha_raw << 10) / scale_B; - beta = (beta_raw << 10) / scale_B; - order_1 = 3 * M - Q_x - Q_B1 - Q_beta + 10 + Q_scale_B; - order_2 = 3 * M - Q_x - Q_B2 - Q_alpha + 10 + Q_scale_B; - order1_5x = order_1 / 5; - order2_3x = order_2 / 3; - order1_5x_rem = order_1 - 5 * order1_5x; - order2_3x_rem = order_2 - 3 * order2_3x; - - for (i = 0; i < PAPRD_TABLE_SZ; i++) { - tmp = i * 32; - y5 = ((beta * tmp) >> 6) >> order1_5x; - y5 = (y5 * tmp) >> order1_5x; - y5 = (y5 * tmp) >> order1_5x; - y5 = (y5 * tmp) >> order1_5x; - y5 = (y5 * tmp) >> order1_5x; - y5 = y5 >> order1_5x_rem; - y3 = (alpha * tmp) >> order2_3x; - y3 = (y3 * tmp) >> order2_3x; - y3 = (y3 * tmp) >> order2_3x; - y3 = y3 >> order2_3x_rem; - PA_in[i] = y5 + y3 + (256 * tmp) / G_fxp; - - if (i >= 2) { - tmp = PA_in[i] - PA_in[i - 1]; - if (tmp < 0) - PA_in[i] = - PA_in[i - 1] + (PA_in[i - 1] - - PA_in[i - 2]); - } - - PA_in[i] = (PA_in[i] < 1400) ? PA_in[i] : 1400; - } - - beta_raw = 0; - alpha_raw = 0; - - for (i = 0; i <= L; i++) { - int theta_tilde = - ((theta[i + I] << M) + y_est[i + I]) / y_est[i + I]; - theta_tilde = - ((theta_tilde << M) + y_est[i + I]) / y_est[i + I]; - theta_tilde = - ((theta_tilde << M) + y_est[i + I]) / y_est[i + I]; - beta_raw = beta_raw + B1_tmp[i] * theta_tilde; - alpha_raw = alpha_raw + B2_tmp[i] * theta_tilde; - } - - Q_beta = find_proper_scale(find_expn(abs(beta_raw)), 10); - Q_alpha = find_proper_scale(find_expn(abs(alpha_raw)), 10); - beta_raw = beta_raw / (1 << Q_beta); - alpha_raw = alpha_raw / (1 << Q_alpha); - - alpha = (alpha_raw << 10) / scale_B; - beta = (beta_raw << 10) / scale_B; - order_1 = 3 * M - Q_x - Q_B1 - Q_beta + 10 + Q_scale_B + 5; - order_2 = 3 * M - Q_x - Q_B2 - Q_alpha + 10 + Q_scale_B + 5; - order1_5x = order_1 / 5; - order2_3x = order_2 / 3; - order1_5x_rem = order_1 - 5 * order1_5x; - order2_3x_rem = order_2 - 3 * order2_3x; - - for (i = 0; i < PAPRD_TABLE_SZ; i++) { - int PA_angle; - - /* pa_table[4] is calculated from PA_angle for i=5 */ - if (i == 4) - continue; - - tmp = i * 32; - if (beta > 0) - y5 = (((beta * tmp - 64) >> 6) - - (1 << order1_5x)) / (1 << order1_5x); - else - y5 = ((((beta * tmp - 64) >> 6) + - (1 << order1_5x)) / (1 << order1_5x)); - - y5 = (y5 * tmp) / (1 << order1_5x); - y5 = (y5 * tmp) / (1 << order1_5x); - y5 = (y5 * tmp) / (1 << order1_5x); - y5 = (y5 * tmp) / (1 << order1_5x); - y5 = y5 / (1 << order1_5x_rem); - - if (beta > 0) - y3 = (alpha * tmp - - (1 << order2_3x)) / (1 << order2_3x); - else - y3 = (alpha * tmp + - (1 << order2_3x)) / (1 << order2_3x); - y3 = (y3 * tmp) / (1 << order2_3x); - y3 = (y3 * tmp) / (1 << order2_3x); - y3 = y3 / (1 << order2_3x_rem); - - if (i < 4) { - PA_angle = 0; - } else { - PA_angle = y5 + y3; - if (PA_angle < -150) - PA_angle = -150; - else if (PA_angle > 150) - PA_angle = 150; - } - - pa_table[i] = ((PA_in[i] & 0x7ff) << 11) + (PA_angle & 0x7ff); - if (i == 5) { - PA_angle = (PA_angle + 2) >> 1; - pa_table[i - 1] = ((PA_in[i - 1] & 0x7ff) << 11) + - (PA_angle & 0x7ff); - } - } - - *gain = G_fxp; - return true; -} - -void ar9003_paprd_populate_single_table(struct ath_hw *ah, - struct ath9k_hw_cal_data *caldata, - int chain) -{ - u32 *paprd_table_val = caldata->pa_table[chain]; - u32 small_signal_gain = caldata->small_signal_gain[chain]; - u32 training_power = ah->paprd_training_power; - u32 reg = 0; - int i; - - if (chain == 0) - reg = AR_PHY_PAPRD_MEM_TAB_B0; - else if (chain == 1) - reg = AR_PHY_PAPRD_MEM_TAB_B1; - else if (chain == 2) - reg = AR_PHY_PAPRD_MEM_TAB_B2; - - for (i = 0; i < PAPRD_TABLE_SZ; i++) { - REG_WRITE(ah, reg, paprd_table_val[i]); - reg = reg + 4; - } - - if (chain == 0) - reg = AR_PHY_PA_GAIN123_B0; - else if (chain == 1) - reg = AR_PHY_PA_GAIN123_B1; - else - reg = AR_PHY_PA_GAIN123_B2; - - REG_RMW_FIELD(ah, reg, AR_PHY_PA_GAIN123_PA_GAIN1, small_signal_gain); - - REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL1_B0, - AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL, - training_power); - - if (ah->caps.tx_chainmask & BIT(1)) - REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL1_B1, - AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL, - training_power); - - if (ah->caps.tx_chainmask & BIT(2)) - /* val AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL correct? */ - REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL1_B2, - AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL, - training_power); -} -EXPORT_SYMBOL(ar9003_paprd_populate_single_table); - -void ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain) -{ - unsigned int i, desired_gain, gain_index; - unsigned int train_power = ah->paprd_training_power; - - desired_gain = ar9003_get_desired_gain(ah, chain, train_power); - - gain_index = 0; - for (i = 0; i < PAPRD_GAIN_TABLE_ENTRIES; i++) { - if (ah->paprd_gain_table_index[i] >= desired_gain) - break; - gain_index++; - } - - ar9003_tx_force_gain(ah, gain_index); - - REG_CLR_BIT(ah, AR_PHY_PAPRD_TRAINER_STAT1, - AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE); -} -EXPORT_SYMBOL(ar9003_paprd_setup_gain_table); - -static bool ar9003_paprd_retrain_pa_in(struct ath_hw *ah, - struct ath9k_hw_cal_data *caldata, - int chain) -{ - u32 *pa_in = caldata->pa_table[chain]; - int capdiv_offset, quick_drop_offset; - int capdiv2g, quick_drop; - int count = 0; - int i; - - if (!AR_SREV_9485(ah) && !AR_SREV_9330(ah)) - return false; - - capdiv2g = REG_READ_FIELD(ah, AR_PHY_65NM_CH0_TXRF3, - AR_PHY_65NM_CH0_TXRF3_CAPDIV2G); - - quick_drop = REG_READ_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, - AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP); - - if (quick_drop) - quick_drop -= 0x40; - - for (i = 0; i < NUM_BIN + 1; i++) { - if (pa_in[i] == 1400) - count++; - } - - if (AR_SREV_9485(ah)) { - if (pa_in[23] < 800) { - capdiv_offset = (int)((1000 - pa_in[23] + 75) / 150); - capdiv2g += capdiv_offset; - if (capdiv2g > 7) { - capdiv2g = 7; - if (pa_in[23] < 600) { - quick_drop++; - if (quick_drop > 0) - quick_drop = 0; - } - } - } else if (pa_in[23] == 1400) { - quick_drop_offset = min_t(int, count / 3, 2); - quick_drop += quick_drop_offset; - capdiv2g += quick_drop_offset / 2; - - if (capdiv2g > 7) - capdiv2g = 7; - - if (quick_drop > 0) { - quick_drop = 0; - capdiv2g -= quick_drop_offset; - if (capdiv2g < 0) - capdiv2g = 0; - } - } else { - return false; - } - } else if (AR_SREV_9330(ah)) { - if (pa_in[23] < 1000) { - capdiv_offset = (1000 - pa_in[23]) / 100; - capdiv2g += capdiv_offset; - if (capdiv_offset > 3) { - capdiv_offset = 1; - quick_drop--; - } - - capdiv2g += capdiv_offset; - if (capdiv2g > 6) - capdiv2g = 6; - if (quick_drop < -4) - quick_drop = -4; - } else if (pa_in[23] == 1400) { - if (count > 3) { - quick_drop++; - capdiv2g -= count / 4; - if (quick_drop > -2) - quick_drop = -2; - } else { - capdiv2g--; - } - - if (capdiv2g < 0) - capdiv2g = 0; - } else { - return false; - } - } - - REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_TXRF3, - AR_PHY_65NM_CH0_TXRF3_CAPDIV2G, capdiv2g); - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, - AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP, - quick_drop); - - return true; -} - -int ar9003_paprd_create_curve(struct ath_hw *ah, - struct ath9k_hw_cal_data *caldata, int chain) -{ - u16 *small_signal_gain = &caldata->small_signal_gain[chain]; - u32 *pa_table = caldata->pa_table[chain]; - u32 *data_L, *data_U; - int i, status = 0; - u32 *buf; - u32 reg; - - memset(caldata->pa_table[chain], 0, sizeof(caldata->pa_table[chain])); - - buf = kmalloc(2 * 48 * sizeof(u32), GFP_KERNEL); - if (!buf) - return -ENOMEM; - - data_L = &buf[0]; - data_U = &buf[48]; - - REG_CLR_BIT(ah, AR_PHY_CHAN_INFO_MEMORY, - AR_PHY_CHAN_INFO_MEMORY_CHANINFOMEM_S2_READ); - - reg = AR_PHY_CHAN_INFO_TAB_0; - for (i = 0; i < 48; i++) - data_L[i] = REG_READ(ah, reg + (i << 2)); - - REG_SET_BIT(ah, AR_PHY_CHAN_INFO_MEMORY, - AR_PHY_CHAN_INFO_MEMORY_CHANINFOMEM_S2_READ); - - for (i = 0; i < 48; i++) - data_U[i] = REG_READ(ah, reg + (i << 2)); - - if (!create_pa_curve(data_L, data_U, pa_table, small_signal_gain)) - status = -2; - - if (ar9003_paprd_retrain_pa_in(ah, caldata, chain)) - status = -EINPROGRESS; - - REG_CLR_BIT(ah, AR_PHY_PAPRD_TRAINER_STAT1, - AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE); - - kfree(buf); - - return status; -} -EXPORT_SYMBOL(ar9003_paprd_create_curve); - -int ar9003_paprd_init_table(struct ath_hw *ah) -{ - int ret; - - ret = ar9003_paprd_setup_single_table(ah); - if (ret < 0) - return ret; - - ar9003_paprd_get_gain_table(ah); - return 0; -} -EXPORT_SYMBOL(ar9003_paprd_init_table); - -bool ar9003_paprd_is_done(struct ath_hw *ah) -{ - int paprd_done, agc2_pwr; - - paprd_done = REG_READ_FIELD(ah, AR_PHY_PAPRD_TRAINER_STAT1, - AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE); - - if (AR_SREV_9485(ah)) - goto exit; - - if (paprd_done == 0x1) { - agc2_pwr = REG_READ_FIELD(ah, AR_PHY_PAPRD_TRAINER_STAT1, - AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR); - - ath_dbg(ath9k_hw_common(ah), CALIBRATE, - "AGC2_PWR = 0x%x training done = 0x%x\n", - agc2_pwr, paprd_done); - /* - * agc2_pwr range should not be less than 'IDEAL_AGC2_PWR_CHANGE' - * when the training is completely done, otherwise retraining is - * done to make sure the value is in ideal range - */ - if (agc2_pwr <= PAPRD_IDEAL_AGC2_PWR_RANGE) - paprd_done = 0; - } -exit: - return !!paprd_done; -} -EXPORT_SYMBOL(ar9003_paprd_is_done); - -bool ar9003_is_paprd_enabled(struct ath_hw *ah) -{ - if ((ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) && ah->config.enable_paprd) - return true; - - return false; -} -EXPORT_SYMBOL(ar9003_is_paprd_enabled); diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c deleted file mode 100644 index 3457ca5382f4..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ /dev/null @@ -1,1685 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "hw.h" -#include "ar9003_phy.h" - -static const int firstep_table[] = -/* level: 0 1 2 3 4 5 6 7 8 */ - { -4, -2, 0, 2, 4, 6, 8, 10, 12 }; /* lvl 0-8, default 2 */ - -static const int cycpwrThr1_table[] = -/* level: 0 1 2 3 4 5 6 7 8 */ - { -6, -4, -2, 0, 2, 4, 6, 8 }; /* lvl 0-7, default 3 */ - -/* - * register values to turn OFDM weak signal detection OFF - */ -static const int m1ThreshLow_off = 127; -static const int m2ThreshLow_off = 127; -static const int m1Thresh_off = 127; -static const int m2Thresh_off = 127; -static const int m2CountThr_off = 31; -static const int m2CountThrLow_off = 63; -static const int m1ThreshLowExt_off = 127; -static const int m2ThreshLowExt_off = 127; -static const int m1ThreshExt_off = 127; -static const int m2ThreshExt_off = 127; - -/** - * ar9003_hw_set_channel - set channel on single-chip device - * @ah: atheros hardware structure - * @chan: - * - * This is the function to change channel on single-chip devices, that is - * for AR9300 family of chipsets. - * - * This function takes the channel value in MHz and sets - * hardware channel value. Assumes writes have been enabled to analog bus. - * - * Actual Expression, - * - * For 2GHz channel, - * Channel Frequency = (3/4) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^17) - * (freq_ref = 40MHz) - * - * For 5GHz channel, - * Channel Frequency = (3/2) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^10) - * (freq_ref = 40MHz/(24>>amodeRefSel)) - * - * For 5GHz channels which are 5MHz spaced, - * Channel Frequency = (3/2) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^17) - * (freq_ref = 40MHz) - */ -static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan) -{ - u16 bMode, fracMode = 0, aModeRefSel = 0; - u32 freq, chan_frac, div, channelSel = 0, reg32 = 0; - struct chan_centers centers; - int loadSynthChannel; - - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - freq = centers.synth_center; - - if (freq < 4800) { /* 2 GHz, fractional mode */ - if (AR_SREV_9330(ah)) { - if (ah->is_clk_25mhz) - div = 75; - else - div = 120; - - channelSel = (freq * 4) / div; - chan_frac = (((freq * 4) % div) * 0x20000) / div; - channelSel = (channelSel << 17) | chan_frac; - } else if (AR_SREV_9485(ah) || AR_SREV_9565(ah)) { - /* - * freq_ref = 40 / (refdiva >> amoderefsel); - * where refdiva=1 and amoderefsel=0 - * ndiv = ((chan_mhz * 4) / 3) / freq_ref; - * chansel = int(ndiv), chanfrac = (ndiv - chansel) * 0x20000 - */ - channelSel = (freq * 4) / 120; - chan_frac = (((freq * 4) % 120) * 0x20000) / 120; - channelSel = (channelSel << 17) | chan_frac; - } else if (AR_SREV_9340(ah)) { - if (ah->is_clk_25mhz) { - channelSel = (freq * 2) / 75; - chan_frac = (((freq * 2) % 75) * 0x20000) / 75; - channelSel = (channelSel << 17) | chan_frac; - } else { - channelSel = CHANSEL_2G(freq) >> 1; - } - } else if (AR_SREV_9550(ah)) { - if (ah->is_clk_25mhz) - div = 75; - else - div = 120; - - channelSel = (freq * 4) / div; - chan_frac = (((freq * 4) % div) * 0x20000) / div; - channelSel = (channelSel << 17) | chan_frac; - } else { - channelSel = CHANSEL_2G(freq); - } - /* Set to 2G mode */ - bMode = 1; - } else { - if ((AR_SREV_9340(ah) || AR_SREV_9550(ah)) && - ah->is_clk_25mhz) { - channelSel = freq / 75; - chan_frac = ((freq % 75) * 0x20000) / 75; - channelSel = (channelSel << 17) | chan_frac; - } else { - channelSel = CHANSEL_5G(freq); - /* Doubler is ON, so, divide channelSel by 2. */ - channelSel >>= 1; - } - /* Set to 5G mode */ - bMode = 0; - } - - /* Enable fractional mode for all channels */ - fracMode = 1; - aModeRefSel = 0; - loadSynthChannel = 0; - - reg32 = (bMode << 29); - REG_WRITE(ah, AR_PHY_SYNTH_CONTROL, reg32); - - /* Enable Long shift Select for Synthesizer */ - REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_SYNTH4, - AR_PHY_SYNTH4_LONG_SHIFT_SELECT, 1); - - /* Program Synth. setting */ - reg32 = (channelSel << 2) | (fracMode << 30) | - (aModeRefSel << 28) | (loadSynthChannel << 31); - REG_WRITE(ah, AR_PHY_65NM_CH0_SYNTH7, reg32); - - /* Toggle Load Synth channel bit */ - loadSynthChannel = 1; - reg32 = (channelSel << 2) | (fracMode << 30) | - (aModeRefSel << 28) | (loadSynthChannel << 31); - REG_WRITE(ah, AR_PHY_65NM_CH0_SYNTH7, reg32); - - ah->curchan = chan; - - return 0; -} - -/** - * ar9003_hw_spur_mitigate_mrc_cck - convert baseband spur frequency - * @ah: atheros hardware structure - * @chan: - * - * For single-chip solutions. Converts to baseband spur frequency given the - * input channel frequency and compute register settings below. - * - * Spur mitigation for MRC CCK - */ -static void ar9003_hw_spur_mitigate_mrc_cck(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - static const u32 spur_freq[4] = { 2420, 2440, 2464, 2480 }; - int cur_bb_spur, negative = 0, cck_spur_freq; - int i; - int range, max_spur_cnts, synth_freq; - u8 *spur_fbin_ptr = ar9003_get_spur_chan_ptr(ah, IS_CHAN_2GHZ(chan)); - - /* - * Need to verify range +/- 10 MHz in control channel, otherwise spur - * is out-of-band and can be ignored. - */ - - if (AR_SREV_9485(ah) || AR_SREV_9340(ah) || AR_SREV_9330(ah) || - AR_SREV_9550(ah)) { - if (spur_fbin_ptr[0] == 0) /* No spur */ - return; - max_spur_cnts = 5; - if (IS_CHAN_HT40(chan)) { - range = 19; - if (REG_READ_FIELD(ah, AR_PHY_GEN_CTRL, - AR_PHY_GC_DYN2040_PRI_CH) == 0) - synth_freq = chan->channel + 10; - else - synth_freq = chan->channel - 10; - } else { - range = 10; - synth_freq = chan->channel; - } - } else { - range = AR_SREV_9462(ah) ? 5 : 10; - max_spur_cnts = 4; - synth_freq = chan->channel; - } - - for (i = 0; i < max_spur_cnts; i++) { - if (AR_SREV_9462(ah) && (i == 0 || i == 3)) - continue; - - negative = 0; - if (AR_SREV_9485(ah) || AR_SREV_9340(ah) || AR_SREV_9330(ah) || - AR_SREV_9550(ah)) - cur_bb_spur = ath9k_hw_fbin2freq(spur_fbin_ptr[i], - IS_CHAN_2GHZ(chan)); - else - cur_bb_spur = spur_freq[i]; - - cur_bb_spur -= synth_freq; - if (cur_bb_spur < 0) { - negative = 1; - cur_bb_spur = -cur_bb_spur; - } - if (cur_bb_spur < range) { - cck_spur_freq = (int)((cur_bb_spur << 19) / 11); - - if (negative == 1) - cck_spur_freq = -cck_spur_freq; - - cck_spur_freq = cck_spur_freq & 0xfffff; - - REG_RMW_FIELD(ah, AR_PHY_AGC_CONTROL, - AR_PHY_AGC_CONTROL_YCOK_MAX, 0x7); - REG_RMW_FIELD(ah, AR_PHY_CCK_SPUR_MIT, - AR_PHY_CCK_SPUR_MIT_SPUR_RSSI_THR, 0x7f); - REG_RMW_FIELD(ah, AR_PHY_CCK_SPUR_MIT, - AR_PHY_CCK_SPUR_MIT_SPUR_FILTER_TYPE, - 0x2); - REG_RMW_FIELD(ah, AR_PHY_CCK_SPUR_MIT, - AR_PHY_CCK_SPUR_MIT_USE_CCK_SPUR_MIT, - 0x1); - REG_RMW_FIELD(ah, AR_PHY_CCK_SPUR_MIT, - AR_PHY_CCK_SPUR_MIT_CCK_SPUR_FREQ, - cck_spur_freq); - - return; - } - } - - REG_RMW_FIELD(ah, AR_PHY_AGC_CONTROL, - AR_PHY_AGC_CONTROL_YCOK_MAX, 0x5); - REG_RMW_FIELD(ah, AR_PHY_CCK_SPUR_MIT, - AR_PHY_CCK_SPUR_MIT_USE_CCK_SPUR_MIT, 0x0); - REG_RMW_FIELD(ah, AR_PHY_CCK_SPUR_MIT, - AR_PHY_CCK_SPUR_MIT_CCK_SPUR_FREQ, 0x0); -} - -/* Clean all spur register fields */ -static void ar9003_hw_spur_ofdm_clear(struct ath_hw *ah) -{ - REG_RMW_FIELD(ah, AR_PHY_TIMING4, - AR_PHY_TIMING4_ENABLE_SPUR_FILTER, 0); - REG_RMW_FIELD(ah, AR_PHY_TIMING11, - AR_PHY_TIMING11_SPUR_FREQ_SD, 0); - REG_RMW_FIELD(ah, AR_PHY_TIMING11, - AR_PHY_TIMING11_SPUR_DELTA_PHASE, 0); - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT, - AR_PHY_SFCORR_EXT_SPUR_SUBCHANNEL_SD, 0); - REG_RMW_FIELD(ah, AR_PHY_TIMING11, - AR_PHY_TIMING11_USE_SPUR_FILTER_IN_AGC, 0); - REG_RMW_FIELD(ah, AR_PHY_TIMING11, - AR_PHY_TIMING11_USE_SPUR_FILTER_IN_SELFCOR, 0); - REG_RMW_FIELD(ah, AR_PHY_TIMING4, - AR_PHY_TIMING4_ENABLE_SPUR_RSSI, 0); - REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, - AR_PHY_SPUR_REG_EN_VIT_SPUR_RSSI, 0); - REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, - AR_PHY_SPUR_REG_ENABLE_NF_RSSI_SPUR_MIT, 0); - - REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, - AR_PHY_SPUR_REG_ENABLE_MASK_PPM, 0); - REG_RMW_FIELD(ah, AR_PHY_TIMING4, - AR_PHY_TIMING4_ENABLE_PILOT_MASK, 0); - REG_RMW_FIELD(ah, AR_PHY_TIMING4, - AR_PHY_TIMING4_ENABLE_CHAN_MASK, 0); - REG_RMW_FIELD(ah, AR_PHY_PILOT_SPUR_MASK, - AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A, 0); - REG_RMW_FIELD(ah, AR_PHY_SPUR_MASK_A, - AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A, 0); - REG_RMW_FIELD(ah, AR_PHY_CHAN_SPUR_MASK, - AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A, 0); - REG_RMW_FIELD(ah, AR_PHY_PILOT_SPUR_MASK, - AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_A, 0); - REG_RMW_FIELD(ah, AR_PHY_CHAN_SPUR_MASK, - AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_A, 0); - REG_RMW_FIELD(ah, AR_PHY_SPUR_MASK_A, - AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A, 0); - REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, - AR_PHY_SPUR_REG_MASK_RATE_CNTL, 0); -} - -static void ar9003_hw_spur_ofdm(struct ath_hw *ah, - int freq_offset, - int spur_freq_sd, - int spur_delta_phase, - int spur_subchannel_sd, - int range, - int synth_freq) -{ - int mask_index = 0; - - /* OFDM Spur mitigation */ - REG_RMW_FIELD(ah, AR_PHY_TIMING4, - AR_PHY_TIMING4_ENABLE_SPUR_FILTER, 0x1); - REG_RMW_FIELD(ah, AR_PHY_TIMING11, - AR_PHY_TIMING11_SPUR_FREQ_SD, spur_freq_sd); - REG_RMW_FIELD(ah, AR_PHY_TIMING11, - AR_PHY_TIMING11_SPUR_DELTA_PHASE, spur_delta_phase); - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT, - AR_PHY_SFCORR_EXT_SPUR_SUBCHANNEL_SD, spur_subchannel_sd); - REG_RMW_FIELD(ah, AR_PHY_TIMING11, - AR_PHY_TIMING11_USE_SPUR_FILTER_IN_AGC, 0x1); - - if (!(AR_SREV_9565(ah) && range == 10 && synth_freq == 2437)) - REG_RMW_FIELD(ah, AR_PHY_TIMING11, - AR_PHY_TIMING11_USE_SPUR_FILTER_IN_SELFCOR, 0x1); - - REG_RMW_FIELD(ah, AR_PHY_TIMING4, - AR_PHY_TIMING4_ENABLE_SPUR_RSSI, 0x1); - REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, - AR_PHY_SPUR_REG_SPUR_RSSI_THRESH, 34); - REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, - AR_PHY_SPUR_REG_EN_VIT_SPUR_RSSI, 1); - - if (!AR_SREV_9340(ah) && - REG_READ_FIELD(ah, AR_PHY_MODE, - AR_PHY_MODE_DYNAMIC) == 0x1) - REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, - AR_PHY_SPUR_REG_ENABLE_NF_RSSI_SPUR_MIT, 1); - - mask_index = (freq_offset << 4) / 5; - if (mask_index < 0) - mask_index = mask_index - 1; - - mask_index = mask_index & 0x7f; - - REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, - AR_PHY_SPUR_REG_ENABLE_MASK_PPM, 0x1); - REG_RMW_FIELD(ah, AR_PHY_TIMING4, - AR_PHY_TIMING4_ENABLE_PILOT_MASK, 0x1); - REG_RMW_FIELD(ah, AR_PHY_TIMING4, - AR_PHY_TIMING4_ENABLE_CHAN_MASK, 0x1); - REG_RMW_FIELD(ah, AR_PHY_PILOT_SPUR_MASK, - AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A, mask_index); - REG_RMW_FIELD(ah, AR_PHY_SPUR_MASK_A, - AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A, mask_index); - REG_RMW_FIELD(ah, AR_PHY_CHAN_SPUR_MASK, - AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A, mask_index); - REG_RMW_FIELD(ah, AR_PHY_PILOT_SPUR_MASK, - AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_A, 0xc); - REG_RMW_FIELD(ah, AR_PHY_CHAN_SPUR_MASK, - AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_A, 0xc); - REG_RMW_FIELD(ah, AR_PHY_SPUR_MASK_A, - AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A, 0xa0); - REG_RMW_FIELD(ah, AR_PHY_SPUR_REG, - AR_PHY_SPUR_REG_MASK_RATE_CNTL, 0xff); -} - -static void ar9003_hw_spur_ofdm_9565(struct ath_hw *ah, - int freq_offset) -{ - int mask_index = 0; - - mask_index = (freq_offset << 4) / 5; - if (mask_index < 0) - mask_index = mask_index - 1; - - mask_index = mask_index & 0x7f; - - REG_RMW_FIELD(ah, AR_PHY_PILOT_SPUR_MASK, - AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B, - mask_index); - - /* A == B */ - REG_RMW_FIELD(ah, AR_PHY_SPUR_MASK_B, - AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A, - mask_index); - - REG_RMW_FIELD(ah, AR_PHY_CHAN_SPUR_MASK, - AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B, - mask_index); - REG_RMW_FIELD(ah, AR_PHY_PILOT_SPUR_MASK, - AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_B, 0xe); - REG_RMW_FIELD(ah, AR_PHY_CHAN_SPUR_MASK, - AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_B, 0xe); - - /* A == B */ - REG_RMW_FIELD(ah, AR_PHY_SPUR_MASK_B, - AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A, 0xa0); -} - -static void ar9003_hw_spur_ofdm_work(struct ath_hw *ah, - struct ath9k_channel *chan, - int freq_offset, - int range, - int synth_freq) -{ - int spur_freq_sd = 0; - int spur_subchannel_sd = 0; - int spur_delta_phase = 0; - - if (IS_CHAN_HT40(chan)) { - if (freq_offset < 0) { - if (REG_READ_FIELD(ah, AR_PHY_GEN_CTRL, - AR_PHY_GC_DYN2040_PRI_CH) == 0x0) - spur_subchannel_sd = 1; - else - spur_subchannel_sd = 0; - - spur_freq_sd = ((freq_offset + 10) << 9) / 11; - - } else { - if (REG_READ_FIELD(ah, AR_PHY_GEN_CTRL, - AR_PHY_GC_DYN2040_PRI_CH) == 0x0) - spur_subchannel_sd = 0; - else - spur_subchannel_sd = 1; - - spur_freq_sd = ((freq_offset - 10) << 9) / 11; - - } - - spur_delta_phase = (freq_offset << 17) / 5; - - } else { - spur_subchannel_sd = 0; - spur_freq_sd = (freq_offset << 9) /11; - spur_delta_phase = (freq_offset << 18) / 5; - } - - spur_freq_sd = spur_freq_sd & 0x3ff; - spur_delta_phase = spur_delta_phase & 0xfffff; - - ar9003_hw_spur_ofdm(ah, - freq_offset, - spur_freq_sd, - spur_delta_phase, - spur_subchannel_sd, - range, synth_freq); -} - -/* Spur mitigation for OFDM */ -static void ar9003_hw_spur_mitigate_ofdm(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - int synth_freq; - int range = 10; - int freq_offset = 0; - int mode; - u8* spurChansPtr; - unsigned int i; - struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; - - if (IS_CHAN_5GHZ(chan)) { - spurChansPtr = &(eep->modalHeader5G.spurChans[0]); - mode = 0; - } - else { - spurChansPtr = &(eep->modalHeader2G.spurChans[0]); - mode = 1; - } - - if (spurChansPtr[0] == 0) - return; /* No spur in the mode */ - - if (IS_CHAN_HT40(chan)) { - range = 19; - if (REG_READ_FIELD(ah, AR_PHY_GEN_CTRL, - AR_PHY_GC_DYN2040_PRI_CH) == 0x0) - synth_freq = chan->channel - 10; - else - synth_freq = chan->channel + 10; - } else { - range = 10; - synth_freq = chan->channel; - } - - ar9003_hw_spur_ofdm_clear(ah); - - for (i = 0; i < AR_EEPROM_MODAL_SPURS && spurChansPtr[i]; i++) { - freq_offset = ath9k_hw_fbin2freq(spurChansPtr[i], mode); - freq_offset -= synth_freq; - if (abs(freq_offset) < range) { - ar9003_hw_spur_ofdm_work(ah, chan, freq_offset, - range, synth_freq); - - if (AR_SREV_9565(ah) && (i < 4)) { - freq_offset = ath9k_hw_fbin2freq(spurChansPtr[i + 1], - mode); - freq_offset -= synth_freq; - if (abs(freq_offset) < range) - ar9003_hw_spur_ofdm_9565(ah, freq_offset); - } - - break; - } - } -} - -static void ar9003_hw_spur_mitigate(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - if (!AR_SREV_9565(ah)) - ar9003_hw_spur_mitigate_mrc_cck(ah, chan); - ar9003_hw_spur_mitigate_ofdm(ah, chan); -} - -static u32 ar9003_hw_compute_pll_control(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - u32 pll; - - pll = SM(0x5, AR_RTC_9300_PLL_REFDIV); - - if (chan && IS_CHAN_HALF_RATE(chan)) - pll |= SM(0x1, AR_RTC_9300_PLL_CLKSEL); - else if (chan && IS_CHAN_QUARTER_RATE(chan)) - pll |= SM(0x2, AR_RTC_9300_PLL_CLKSEL); - - pll |= SM(0x2c, AR_RTC_9300_PLL_DIV); - - return pll; -} - -static void ar9003_hw_set_channel_regs(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - u32 phymode; - u32 enableDacFifo = 0; - - enableDacFifo = - (REG_READ(ah, AR_PHY_GEN_CTRL) & AR_PHY_GC_ENABLE_DAC_FIFO); - - /* Enable 11n HT, 20 MHz */ - phymode = AR_PHY_GC_HT_EN | AR_PHY_GC_SINGLE_HT_LTF1 | - AR_PHY_GC_SHORT_GI_40 | enableDacFifo; - - /* Configure baseband for dynamic 20/40 operation */ - if (IS_CHAN_HT40(chan)) { - phymode |= AR_PHY_GC_DYN2040_EN; - /* Configure control (primary) channel at +-10MHz */ - if ((chan->chanmode == CHANNEL_A_HT40PLUS) || - (chan->chanmode == CHANNEL_G_HT40PLUS)) - phymode |= AR_PHY_GC_DYN2040_PRI_CH; - - } - - /* make sure we preserve INI settings */ - phymode |= REG_READ(ah, AR_PHY_GEN_CTRL); - /* turn off Green Field detection for STA for now */ - phymode &= ~AR_PHY_GC_GF_DETECT_EN; - - REG_WRITE(ah, AR_PHY_GEN_CTRL, phymode); - - /* Configure MAC for 20/40 operation */ - ath9k_hw_set11nmac2040(ah); - - /* global transmit timeout (25 TUs default)*/ - REG_WRITE(ah, AR_GTXTO, 25 << AR_GTXTO_TIMEOUT_LIMIT_S); - /* carrier sense timeout */ - REG_WRITE(ah, AR_CST, 0xF << AR_CST_TIMEOUT_LIMIT_S); -} - -static void ar9003_hw_init_bb(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - u32 synthDelay; - - /* - * Wait for the frequency synth to settle (synth goes on - * via AR_PHY_ACTIVE_EN). Read the phy active delay register. - * Value is in 100ns increments. - */ - synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; - - /* Activate the PHY (includes baseband activate + synthesizer on) */ - REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); - ath9k_hw_synth_delay(ah, chan, synthDelay); -} - -void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx) -{ - if (ah->caps.tx_chainmask == 5 || ah->caps.rx_chainmask == 5) - REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, - AR_PHY_SWAP_ALT_CHAIN); - - REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx); - REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx); - - if ((ah->caps.hw_caps & ATH9K_HW_CAP_APM) && (tx == 0x7)) - tx = 3; - - REG_WRITE(ah, AR_SELFGEN_MASK, tx); -} - -/* - * Override INI values with chip specific configuration. - */ -static void ar9003_hw_override_ini(struct ath_hw *ah) -{ - u32 val; - - /* - * Set the RX_ABORT and RX_DIS and clear it only after - * RXE is set for MAC. This prevents frames with - * corrupted descriptor status. - */ - REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); - - /* - * For AR9280 and above, there is a new feature that allows - * Multicast search based on both MAC Address and Key ID. By default, - * this feature is enabled. But since the driver is not using this - * feature, we switch it off; otherwise multicast search based on - * MAC addr only will fail. - */ - val = REG_READ(ah, AR_PCU_MISC_MODE2) & (~AR_ADHOC_MCAST_KEYID_ENABLE); - REG_WRITE(ah, AR_PCU_MISC_MODE2, - val | AR_AGG_WEP_ENABLE_FIX | AR_AGG_WEP_ENABLE); - - REG_SET_BIT(ah, AR_PHY_CCK_DETECT, - AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV); -} - -static void ar9003_hw_prog_ini(struct ath_hw *ah, - struct ar5416IniArray *iniArr, - int column) -{ - unsigned int i, regWrites = 0; - - /* New INI format: Array may be undefined (pre, core, post arrays) */ - if (!iniArr->ia_array) - return; - - /* - * New INI format: Pre, core, and post arrays for a given subsystem - * may be modal (> 2 columns) or non-modal (2 columns). Determine if - * the array is non-modal and force the column to 1. - */ - if (column >= iniArr->ia_columns) - column = 1; - - for (i = 0; i < iniArr->ia_rows; i++) { - u32 reg = INI_RA(iniArr, i, 0); - u32 val = INI_RA(iniArr, i, column); - - REG_WRITE(ah, reg, val); - - DO_DELAY(regWrites); - } -} - -static int ar9550_hw_get_modes_txgain_index(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - int ret; - - switch (chan->chanmode) { - case CHANNEL_A: - case CHANNEL_A_HT20: - if (chan->channel <= 5350) - ret = 1; - else if ((chan->channel > 5350) && (chan->channel <= 5600)) - ret = 3; - else - ret = 5; - break; - - case CHANNEL_A_HT40PLUS: - case CHANNEL_A_HT40MINUS: - if (chan->channel <= 5350) - ret = 2; - else if ((chan->channel > 5350) && (chan->channel <= 5600)) - ret = 4; - else - ret = 6; - break; - - case CHANNEL_G: - case CHANNEL_G_HT20: - case CHANNEL_B: - ret = 8; - break; - - case CHANNEL_G_HT40PLUS: - case CHANNEL_G_HT40MINUS: - ret = 7; - break; - - default: - ret = -EINVAL; - } - - return ret; -} - -static int ar9003_hw_process_ini(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - unsigned int regWrites = 0, i; - u32 modesIndex; - - switch (chan->chanmode) { - case CHANNEL_A: - case CHANNEL_A_HT20: - modesIndex = 1; - break; - case CHANNEL_A_HT40PLUS: - case CHANNEL_A_HT40MINUS: - modesIndex = 2; - break; - case CHANNEL_G: - case CHANNEL_G_HT20: - case CHANNEL_B: - modesIndex = 4; - break; - case CHANNEL_G_HT40PLUS: - case CHANNEL_G_HT40MINUS: - modesIndex = 3; - break; - - default: - return -EINVAL; - } - - for (i = 0; i < ATH_INI_NUM_SPLIT; i++) { - ar9003_hw_prog_ini(ah, &ah->iniSOC[i], modesIndex); - ar9003_hw_prog_ini(ah, &ah->iniMac[i], modesIndex); - ar9003_hw_prog_ini(ah, &ah->iniBB[i], modesIndex); - ar9003_hw_prog_ini(ah, &ah->iniRadio[i], modesIndex); - if (i == ATH_INI_POST && AR_SREV_9462_20(ah)) - ar9003_hw_prog_ini(ah, - &ah->ini_radio_post_sys2ant, - modesIndex); - } - - REG_WRITE_ARRAY(&ah->iniModesRxGain, 1, regWrites); - if (AR_SREV_9550(ah)) - REG_WRITE_ARRAY(&ah->ini_modes_rx_gain_bounds, modesIndex, - regWrites); - - if (AR_SREV_9550(ah)) { - int modes_txgain_index; - - modes_txgain_index = ar9550_hw_get_modes_txgain_index(ah, chan); - if (modes_txgain_index < 0) - return -EINVAL; - - REG_WRITE_ARRAY(&ah->iniModesTxGain, modes_txgain_index, - regWrites); - } else { - REG_WRITE_ARRAY(&ah->iniModesTxGain, modesIndex, regWrites); - } - - /* - * For 5GHz channels requiring Fast Clock, apply - * different modal values. - */ - if (IS_CHAN_A_FAST_CLOCK(ah, chan)) - REG_WRITE_ARRAY(&ah->iniModesFastClock, - modesIndex, regWrites); - - REG_WRITE_ARRAY(&ah->iniAdditional, 1, regWrites); - - if (chan->channel == 2484) - ar9003_hw_prog_ini(ah, &ah->iniCckfirJapan2484, 1); - - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) - REG_WRITE(ah, AR_GLB_SWREG_DISCONT_MODE, - AR_GLB_SWREG_DISCONT_EN_BT_WLAN); - - ah->modes_index = modesIndex; - ar9003_hw_override_ini(ah); - ar9003_hw_set_channel_regs(ah, chan); - ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); - ath9k_hw_apply_txpower(ah, chan, false); - - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) { - if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0, - AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL)) - ah->enabled_cals |= TX_IQ_CAL; - else - ah->enabled_cals &= ~TX_IQ_CAL; - - if (REG_READ(ah, AR_PHY_CL_CAL_CTL) & AR_PHY_CL_CAL_ENABLE) - ah->enabled_cals |= TX_CL_CAL; - else - ah->enabled_cals &= ~TX_CL_CAL; - } - - return 0; -} - -static void ar9003_hw_set_rfmode(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - u32 rfMode = 0; - - if (chan == NULL) - return; - - rfMode |= (IS_CHAN_B(chan) || IS_CHAN_G(chan)) - ? AR_PHY_MODE_DYNAMIC : AR_PHY_MODE_OFDM; - - if (IS_CHAN_A_FAST_CLOCK(ah, chan)) - rfMode |= (AR_PHY_MODE_DYNAMIC | AR_PHY_MODE_DYN_CCK_DISABLE); - if (IS_CHAN_QUARTER_RATE(chan)) - rfMode |= AR_PHY_MODE_QUARTER; - if (IS_CHAN_HALF_RATE(chan)) - rfMode |= AR_PHY_MODE_HALF; - - if (rfMode & (AR_PHY_MODE_QUARTER | AR_PHY_MODE_HALF)) - REG_RMW_FIELD(ah, AR_PHY_FRAME_CTL, - AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW, 3); - - REG_WRITE(ah, AR_PHY_MODE, rfMode); -} - -static void ar9003_hw_mark_phy_inactive(struct ath_hw *ah) -{ - REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS); -} - -static void ar9003_hw_set_delta_slope(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - u32 coef_scaled, ds_coef_exp, ds_coef_man; - u32 clockMhzScaled = 0x64000000; - struct chan_centers centers; - - /* - * half and quarter rate can divide the scaled clock by 2 or 4 - * scale for selected channel bandwidth - */ - if (IS_CHAN_HALF_RATE(chan)) - clockMhzScaled = clockMhzScaled >> 1; - else if (IS_CHAN_QUARTER_RATE(chan)) - clockMhzScaled = clockMhzScaled >> 2; - - /* - * ALGO -> coef = 1e8/fcarrier*fclock/40; - * scaled coef to provide precision for this floating calculation - */ - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - coef_scaled = clockMhzScaled / centers.synth_center; - - ath9k_hw_get_delta_slope_vals(ah, coef_scaled, &ds_coef_man, - &ds_coef_exp); - - REG_RMW_FIELD(ah, AR_PHY_TIMING3, - AR_PHY_TIMING3_DSC_MAN, ds_coef_man); - REG_RMW_FIELD(ah, AR_PHY_TIMING3, - AR_PHY_TIMING3_DSC_EXP, ds_coef_exp); - - /* - * For Short GI, - * scaled coeff is 9/10 that of normal coeff - */ - coef_scaled = (9 * coef_scaled) / 10; - - ath9k_hw_get_delta_slope_vals(ah, coef_scaled, &ds_coef_man, - &ds_coef_exp); - - /* for short gi */ - REG_RMW_FIELD(ah, AR_PHY_SGI_DELTA, - AR_PHY_SGI_DSC_MAN, ds_coef_man); - REG_RMW_FIELD(ah, AR_PHY_SGI_DELTA, - AR_PHY_SGI_DSC_EXP, ds_coef_exp); -} - -static bool ar9003_hw_rfbus_req(struct ath_hw *ah) -{ - REG_WRITE(ah, AR_PHY_RFBUS_REQ, AR_PHY_RFBUS_REQ_EN); - return ath9k_hw_wait(ah, AR_PHY_RFBUS_GRANT, AR_PHY_RFBUS_GRANT_EN, - AR_PHY_RFBUS_GRANT_EN, AH_WAIT_TIMEOUT); -} - -/* - * Wait for the frequency synth to settle (synth goes on via PHY_ACTIVE_EN). - * Read the phy active delay register. Value is in 100ns increments. - */ -static void ar9003_hw_rfbus_done(struct ath_hw *ah) -{ - u32 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; - - ath9k_hw_synth_delay(ah, ah->curchan, synthDelay); - - REG_WRITE(ah, AR_PHY_RFBUS_REQ, 0); -} - -static bool ar9003_hw_ani_control(struct ath_hw *ah, - enum ath9k_ani_cmd cmd, int param) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_channel *chan = ah->curchan; - struct ar5416AniState *aniState = &chan->ani; - s32 value, value2; - - switch (cmd & ah->ani_function) { - case ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION:{ - /* - * on == 1 means ofdm weak signal detection is ON - * on == 1 is the default, for less noise immunity - * - * on == 0 means ofdm weak signal detection is OFF - * on == 0 means more noise imm - */ - u32 on = param ? 1 : 0; - - if (on) - REG_SET_BIT(ah, AR_PHY_SFCORR_LOW, - AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); - else - REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW, - AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); - - if (on != aniState->ofdmWeakSigDetect) { - ath_dbg(common, ANI, - "** ch %d: ofdm weak signal: %s=>%s\n", - chan->channel, - aniState->ofdmWeakSigDetect ? - "on" : "off", - on ? "on" : "off"); - if (on) - ah->stats.ast_ani_ofdmon++; - else - ah->stats.ast_ani_ofdmoff++; - aniState->ofdmWeakSigDetect = on; - } - break; - } - case ATH9K_ANI_FIRSTEP_LEVEL:{ - u32 level = param; - - if (level >= ARRAY_SIZE(firstep_table)) { - ath_dbg(common, ANI, - "ATH9K_ANI_FIRSTEP_LEVEL: level out of range (%u > %zu)\n", - level, ARRAY_SIZE(firstep_table)); - return false; - } - - /* - * make register setting relative to default - * from INI file & cap value - */ - value = firstep_table[level] - - firstep_table[ATH9K_ANI_FIRSTEP_LVL] + - aniState->iniDef.firstep; - if (value < ATH9K_SIG_FIRSTEP_SETTING_MIN) - value = ATH9K_SIG_FIRSTEP_SETTING_MIN; - if (value > ATH9K_SIG_FIRSTEP_SETTING_MAX) - value = ATH9K_SIG_FIRSTEP_SETTING_MAX; - REG_RMW_FIELD(ah, AR_PHY_FIND_SIG, - AR_PHY_FIND_SIG_FIRSTEP, - value); - /* - * we need to set first step low register too - * make register setting relative to default - * from INI file & cap value - */ - value2 = firstep_table[level] - - firstep_table[ATH9K_ANI_FIRSTEP_LVL] + - aniState->iniDef.firstepLow; - if (value2 < ATH9K_SIG_FIRSTEP_SETTING_MIN) - value2 = ATH9K_SIG_FIRSTEP_SETTING_MIN; - if (value2 > ATH9K_SIG_FIRSTEP_SETTING_MAX) - value2 = ATH9K_SIG_FIRSTEP_SETTING_MAX; - - REG_RMW_FIELD(ah, AR_PHY_FIND_SIG_LOW, - AR_PHY_FIND_SIG_LOW_FIRSTEP_LOW, value2); - - if (level != aniState->firstepLevel) { - ath_dbg(common, ANI, - "** ch %d: level %d=>%d[def:%d] firstep[level]=%d ini=%d\n", - chan->channel, - aniState->firstepLevel, - level, - ATH9K_ANI_FIRSTEP_LVL, - value, - aniState->iniDef.firstep); - ath_dbg(common, ANI, - "** ch %d: level %d=>%d[def:%d] firstep_low[level]=%d ini=%d\n", - chan->channel, - aniState->firstepLevel, - level, - ATH9K_ANI_FIRSTEP_LVL, - value2, - aniState->iniDef.firstepLow); - if (level > aniState->firstepLevel) - ah->stats.ast_ani_stepup++; - else if (level < aniState->firstepLevel) - ah->stats.ast_ani_stepdown++; - aniState->firstepLevel = level; - } - break; - } - case ATH9K_ANI_SPUR_IMMUNITY_LEVEL:{ - u32 level = param; - - if (level >= ARRAY_SIZE(cycpwrThr1_table)) { - ath_dbg(common, ANI, - "ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level out of range (%u > %zu)\n", - level, ARRAY_SIZE(cycpwrThr1_table)); - return false; - } - /* - * make register setting relative to default - * from INI file & cap value - */ - value = cycpwrThr1_table[level] - - cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL] + - aniState->iniDef.cycpwrThr1; - if (value < ATH9K_SIG_SPUR_IMM_SETTING_MIN) - value = ATH9K_SIG_SPUR_IMM_SETTING_MIN; - if (value > ATH9K_SIG_SPUR_IMM_SETTING_MAX) - value = ATH9K_SIG_SPUR_IMM_SETTING_MAX; - REG_RMW_FIELD(ah, AR_PHY_TIMING5, - AR_PHY_TIMING5_CYCPWR_THR1, - value); - - /* - * set AR_PHY_EXT_CCA for extension channel - * make register setting relative to default - * from INI file & cap value - */ - value2 = cycpwrThr1_table[level] - - cycpwrThr1_table[ATH9K_ANI_SPUR_IMMUNE_LVL] + - aniState->iniDef.cycpwrThr1Ext; - if (value2 < ATH9K_SIG_SPUR_IMM_SETTING_MIN) - value2 = ATH9K_SIG_SPUR_IMM_SETTING_MIN; - if (value2 > ATH9K_SIG_SPUR_IMM_SETTING_MAX) - value2 = ATH9K_SIG_SPUR_IMM_SETTING_MAX; - REG_RMW_FIELD(ah, AR_PHY_EXT_CCA, - AR_PHY_EXT_CYCPWR_THR1, value2); - - if (level != aniState->spurImmunityLevel) { - ath_dbg(common, ANI, - "** ch %d: level %d=>%d[def:%d] cycpwrThr1[level]=%d ini=%d\n", - chan->channel, - aniState->spurImmunityLevel, - level, - ATH9K_ANI_SPUR_IMMUNE_LVL, - value, - aniState->iniDef.cycpwrThr1); - ath_dbg(common, ANI, - "** ch %d: level %d=>%d[def:%d] cycpwrThr1Ext[level]=%d ini=%d\n", - chan->channel, - aniState->spurImmunityLevel, - level, - ATH9K_ANI_SPUR_IMMUNE_LVL, - value2, - aniState->iniDef.cycpwrThr1Ext); - if (level > aniState->spurImmunityLevel) - ah->stats.ast_ani_spurup++; - else if (level < aniState->spurImmunityLevel) - ah->stats.ast_ani_spurdown++; - aniState->spurImmunityLevel = level; - } - break; - } - case ATH9K_ANI_MRC_CCK:{ - /* - * is_on == 1 means MRC CCK ON (default, less noise imm) - * is_on == 0 means MRC CCK is OFF (more noise imm) - */ - bool is_on = param ? 1 : 0; - - if (ah->caps.rx_chainmask == 1) - break; - - REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL, - AR_PHY_MRC_CCK_ENABLE, is_on); - REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL, - AR_PHY_MRC_CCK_MUX_REG, is_on); - if (is_on != aniState->mrcCCK) { - ath_dbg(common, ANI, "** ch %d: MRC CCK: %s=>%s\n", - chan->channel, - aniState->mrcCCK ? "on" : "off", - is_on ? "on" : "off"); - if (is_on) - ah->stats.ast_ani_ccklow++; - else - ah->stats.ast_ani_cckhigh++; - aniState->mrcCCK = is_on; - } - break; - } - case ATH9K_ANI_PRESENT: - break; - default: - ath_dbg(common, ANI, "invalid cmd %u\n", cmd); - return false; - } - - ath_dbg(common, ANI, - "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n", - aniState->spurImmunityLevel, - aniState->ofdmWeakSigDetect ? "on" : "off", - aniState->firstepLevel, - aniState->mrcCCK ? "on" : "off", - aniState->listenTime, - aniState->ofdmPhyErrCount, - aniState->cckPhyErrCount); - return true; -} - -static void ar9003_hw_do_getnf(struct ath_hw *ah, - int16_t nfarray[NUM_NF_READINGS]) -{ -#define AR_PHY_CH_MINCCA_PWR 0x1FF00000 -#define AR_PHY_CH_MINCCA_PWR_S 20 -#define AR_PHY_CH_EXT_MINCCA_PWR 0x01FF0000 -#define AR_PHY_CH_EXT_MINCCA_PWR_S 16 - - int16_t nf; - int i; - - for (i = 0; i < AR9300_MAX_CHAINS; i++) { - if (ah->rxchainmask & BIT(i)) { - nf = MS(REG_READ(ah, ah->nf_regs[i]), - AR_PHY_CH_MINCCA_PWR); - nfarray[i] = sign_extend32(nf, 8); - - if (IS_CHAN_HT40(ah->curchan)) { - u8 ext_idx = AR9300_MAX_CHAINS + i; - - nf = MS(REG_READ(ah, ah->nf_regs[ext_idx]), - AR_PHY_CH_EXT_MINCCA_PWR); - nfarray[ext_idx] = sign_extend32(nf, 8); - } - } - } -} - -static void ar9003_hw_set_nf_limits(struct ath_hw *ah) -{ - ah->nf_2g.max = AR_PHY_CCA_MAX_GOOD_VAL_9300_2GHZ; - ah->nf_2g.min = AR_PHY_CCA_MIN_GOOD_VAL_9300_2GHZ; - ah->nf_2g.nominal = AR_PHY_CCA_NOM_VAL_9300_2GHZ; - ah->nf_5g.max = AR_PHY_CCA_MAX_GOOD_VAL_9300_5GHZ; - ah->nf_5g.min = AR_PHY_CCA_MIN_GOOD_VAL_9300_5GHZ; - ah->nf_5g.nominal = AR_PHY_CCA_NOM_VAL_9300_5GHZ; - - if (AR_SREV_9330(ah)) - ah->nf_2g.nominal = AR_PHY_CCA_NOM_VAL_9330_2GHZ; - - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) { - ah->nf_2g.min = AR_PHY_CCA_MIN_GOOD_VAL_9462_2GHZ; - ah->nf_2g.nominal = AR_PHY_CCA_NOM_VAL_9462_2GHZ; - ah->nf_5g.min = AR_PHY_CCA_MIN_GOOD_VAL_9462_5GHZ; - ah->nf_5g.nominal = AR_PHY_CCA_NOM_VAL_9462_5GHZ; - } -} - -/* - * Initialize the ANI register values with default (ini) values. - * This routine is called during a (full) hardware reset after - * all the registers are initialised from the INI. - */ -static void ar9003_hw_ani_cache_ini_regs(struct ath_hw *ah) -{ - struct ar5416AniState *aniState; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_channel *chan = ah->curchan; - struct ath9k_ani_default *iniDef; - u32 val; - - aniState = &ah->curchan->ani; - iniDef = &aniState->iniDef; - - ath_dbg(common, ANI, "ver %d.%d opmode %u chan %d Mhz/0x%x\n", - ah->hw_version.macVersion, - ah->hw_version.macRev, - ah->opmode, - chan->channel, - chan->channelFlags); - - val = REG_READ(ah, AR_PHY_SFCORR); - iniDef->m1Thresh = MS(val, AR_PHY_SFCORR_M1_THRESH); - iniDef->m2Thresh = MS(val, AR_PHY_SFCORR_M2_THRESH); - iniDef->m2CountThr = MS(val, AR_PHY_SFCORR_M2COUNT_THR); - - val = REG_READ(ah, AR_PHY_SFCORR_LOW); - iniDef->m1ThreshLow = MS(val, AR_PHY_SFCORR_LOW_M1_THRESH_LOW); - iniDef->m2ThreshLow = MS(val, AR_PHY_SFCORR_LOW_M2_THRESH_LOW); - iniDef->m2CountThrLow = MS(val, AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW); - - val = REG_READ(ah, AR_PHY_SFCORR_EXT); - iniDef->m1ThreshExt = MS(val, AR_PHY_SFCORR_EXT_M1_THRESH); - iniDef->m2ThreshExt = MS(val, AR_PHY_SFCORR_EXT_M2_THRESH); - iniDef->m1ThreshLowExt = MS(val, AR_PHY_SFCORR_EXT_M1_THRESH_LOW); - iniDef->m2ThreshLowExt = MS(val, AR_PHY_SFCORR_EXT_M2_THRESH_LOW); - iniDef->firstep = REG_READ_FIELD(ah, - AR_PHY_FIND_SIG, - AR_PHY_FIND_SIG_FIRSTEP); - iniDef->firstepLow = REG_READ_FIELD(ah, - AR_PHY_FIND_SIG_LOW, - AR_PHY_FIND_SIG_LOW_FIRSTEP_LOW); - iniDef->cycpwrThr1 = REG_READ_FIELD(ah, - AR_PHY_TIMING5, - AR_PHY_TIMING5_CYCPWR_THR1); - iniDef->cycpwrThr1Ext = REG_READ_FIELD(ah, - AR_PHY_EXT_CCA, - AR_PHY_EXT_CYCPWR_THR1); - - /* these levels just got reset to defaults by the INI */ - aniState->spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL; - aniState->firstepLevel = ATH9K_ANI_FIRSTEP_LVL; - aniState->ofdmWeakSigDetect = ATH9K_ANI_USE_OFDM_WEAK_SIG; - aniState->mrcCCK = true; -} - -static void ar9003_hw_set_radar_params(struct ath_hw *ah, - struct ath_hw_radar_conf *conf) -{ - u32 radar_0 = 0, radar_1 = 0; - - if (!conf) { - REG_CLR_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_ENA); - return; - } - - radar_0 |= AR_PHY_RADAR_0_ENA | AR_PHY_RADAR_0_FFT_ENA; - radar_0 |= SM(conf->fir_power, AR_PHY_RADAR_0_FIRPWR); - radar_0 |= SM(conf->radar_rssi, AR_PHY_RADAR_0_RRSSI); - radar_0 |= SM(conf->pulse_height, AR_PHY_RADAR_0_HEIGHT); - radar_0 |= SM(conf->pulse_rssi, AR_PHY_RADAR_0_PRSSI); - radar_0 |= SM(conf->pulse_inband, AR_PHY_RADAR_0_INBAND); - - radar_1 |= AR_PHY_RADAR_1_MAX_RRSSI; - radar_1 |= AR_PHY_RADAR_1_BLOCK_CHECK; - radar_1 |= SM(conf->pulse_maxlen, AR_PHY_RADAR_1_MAXLEN); - radar_1 |= SM(conf->pulse_inband_step, AR_PHY_RADAR_1_RELSTEP_THRESH); - radar_1 |= SM(conf->radar_inband, AR_PHY_RADAR_1_RELPWR_THRESH); - - REG_WRITE(ah, AR_PHY_RADAR_0, radar_0); - REG_WRITE(ah, AR_PHY_RADAR_1, radar_1); - if (conf->ext_channel) - REG_SET_BIT(ah, AR_PHY_RADAR_EXT, AR_PHY_RADAR_EXT_ENA); - else - REG_CLR_BIT(ah, AR_PHY_RADAR_EXT, AR_PHY_RADAR_EXT_ENA); -} - -static void ar9003_hw_set_radar_conf(struct ath_hw *ah) -{ - struct ath_hw_radar_conf *conf = &ah->radar_conf; - - conf->fir_power = -28; - conf->radar_rssi = 0; - conf->pulse_height = 10; - conf->pulse_rssi = 24; - conf->pulse_inband = 8; - conf->pulse_maxlen = 255; - conf->pulse_inband_step = 12; - conf->radar_inband = 8; -} - -static void ar9003_hw_antdiv_comb_conf_get(struct ath_hw *ah, - struct ath_hw_antcomb_conf *antconf) -{ - u32 regval; - - regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL); - antconf->main_lna_conf = (regval & AR_PHY_ANT_DIV_MAIN_LNACONF) >> - AR_PHY_ANT_DIV_MAIN_LNACONF_S; - antconf->alt_lna_conf = (regval & AR_PHY_ANT_DIV_ALT_LNACONF) >> - AR_PHY_ANT_DIV_ALT_LNACONF_S; - antconf->fast_div_bias = (regval & AR_PHY_ANT_FAST_DIV_BIAS) >> - AR_PHY_ANT_FAST_DIV_BIAS_S; - - if (AR_SREV_9330_11(ah)) { - antconf->lna1_lna2_delta = -9; - antconf->div_group = 1; - } else if (AR_SREV_9485(ah)) { - antconf->lna1_lna2_delta = -9; - antconf->div_group = 2; - } else if (AR_SREV_9565(ah)) { - antconf->lna1_lna2_delta = -3; - antconf->div_group = 3; - } else { - antconf->lna1_lna2_delta = -3; - antconf->div_group = 0; - } -} - -static void ar9003_hw_antdiv_comb_conf_set(struct ath_hw *ah, - struct ath_hw_antcomb_conf *antconf) -{ - u32 regval; - - regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL); - regval &= ~(AR_PHY_ANT_DIV_MAIN_LNACONF | - AR_PHY_ANT_DIV_ALT_LNACONF | - AR_PHY_ANT_FAST_DIV_BIAS | - AR_PHY_ANT_DIV_MAIN_GAINTB | - AR_PHY_ANT_DIV_ALT_GAINTB); - regval |= ((antconf->main_lna_conf << AR_PHY_ANT_DIV_MAIN_LNACONF_S) - & AR_PHY_ANT_DIV_MAIN_LNACONF); - regval |= ((antconf->alt_lna_conf << AR_PHY_ANT_DIV_ALT_LNACONF_S) - & AR_PHY_ANT_DIV_ALT_LNACONF); - regval |= ((antconf->fast_div_bias << AR_PHY_ANT_FAST_DIV_BIAS_S) - & AR_PHY_ANT_FAST_DIV_BIAS); - regval |= ((antconf->main_gaintb << AR_PHY_ANT_DIV_MAIN_GAINTB_S) - & AR_PHY_ANT_DIV_MAIN_GAINTB); - regval |= ((antconf->alt_gaintb << AR_PHY_ANT_DIV_ALT_GAINTB_S) - & AR_PHY_ANT_DIV_ALT_GAINTB); - - REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval); -} - -static void ar9003_hw_antctrl_shared_chain_lnadiv(struct ath_hw *ah, - bool enable) -{ - u8 ant_div_ctl1; - u32 regval; - - if (!AR_SREV_9565(ah)) - return; - - ah->shared_chain_lnadiv = enable; - ant_div_ctl1 = ah->eep_ops->get_eeprom(ah, EEP_ANT_DIV_CTL1); - - regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL); - regval &= (~AR_ANT_DIV_CTRL_ALL); - regval |= (ant_div_ctl1 & 0x3f) << AR_ANT_DIV_CTRL_ALL_S; - regval &= ~AR_PHY_ANT_DIV_LNADIV; - regval |= ((ant_div_ctl1 >> 6) & 0x1) << AR_PHY_ANT_DIV_LNADIV_S; - - if (enable) - regval |= AR_ANT_DIV_ENABLE; - - REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval); - - regval = REG_READ(ah, AR_PHY_CCK_DETECT); - regval &= ~AR_FAST_DIV_ENABLE; - regval |= ((ant_div_ctl1 >> 7) & 0x1) << AR_FAST_DIV_ENABLE_S; - - if (enable) - regval |= AR_FAST_DIV_ENABLE; - - REG_WRITE(ah, AR_PHY_CCK_DETECT, regval); - - if (enable) { - REG_SET_BIT(ah, AR_PHY_MC_GAIN_CTRL, - (1 << AR_PHY_ANT_SW_RX_PROT_S)); - if (ah->curchan && IS_CHAN_2GHZ(ah->curchan)) - REG_SET_BIT(ah, AR_PHY_RESTART, - AR_PHY_RESTART_ENABLE_DIV_M2FLAG); - REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, - AR_BTCOEX_WL_LNADIV_FORCE_ON); - } else { - REG_CLR_BIT(ah, AR_PHY_MC_GAIN_CTRL, AR_ANT_DIV_ENABLE); - REG_CLR_BIT(ah, AR_PHY_MC_GAIN_CTRL, - (1 << AR_PHY_ANT_SW_RX_PROT_S)); - REG_CLR_BIT(ah, AR_PHY_CCK_DETECT, AR_FAST_DIV_ENABLE); - REG_CLR_BIT(ah, AR_BTCOEX_WL_LNADIV, - AR_BTCOEX_WL_LNADIV_FORCE_ON); - - regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL); - regval &= ~(AR_PHY_ANT_DIV_MAIN_LNACONF | - AR_PHY_ANT_DIV_ALT_LNACONF | - AR_PHY_ANT_DIV_MAIN_GAINTB | - AR_PHY_ANT_DIV_ALT_GAINTB); - regval |= (AR_PHY_ANT_DIV_LNA1 << AR_PHY_ANT_DIV_MAIN_LNACONF_S); - regval |= (AR_PHY_ANT_DIV_LNA2 << AR_PHY_ANT_DIV_ALT_LNACONF_S); - REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval); - } -} - -static int ar9003_hw_fast_chan_change(struct ath_hw *ah, - struct ath9k_channel *chan, - u8 *ini_reloaded) -{ - unsigned int regWrites = 0; - u32 modesIndex; - - switch (chan->chanmode) { - case CHANNEL_A: - case CHANNEL_A_HT20: - modesIndex = 1; - break; - case CHANNEL_A_HT40PLUS: - case CHANNEL_A_HT40MINUS: - modesIndex = 2; - break; - case CHANNEL_G: - case CHANNEL_G_HT20: - case CHANNEL_B: - modesIndex = 4; - break; - case CHANNEL_G_HT40PLUS: - case CHANNEL_G_HT40MINUS: - modesIndex = 3; - break; - - default: - return -EINVAL; - } - - if (modesIndex == ah->modes_index) { - *ini_reloaded = false; - goto set_rfmode; - } - - ar9003_hw_prog_ini(ah, &ah->iniSOC[ATH_INI_POST], modesIndex); - ar9003_hw_prog_ini(ah, &ah->iniMac[ATH_INI_POST], modesIndex); - ar9003_hw_prog_ini(ah, &ah->iniBB[ATH_INI_POST], modesIndex); - ar9003_hw_prog_ini(ah, &ah->iniRadio[ATH_INI_POST], modesIndex); - - if (AR_SREV_9462_20(ah)) - ar9003_hw_prog_ini(ah, &ah->ini_radio_post_sys2ant, - modesIndex); - - REG_WRITE_ARRAY(&ah->iniModesTxGain, modesIndex, regWrites); - - /* - * For 5GHz channels requiring Fast Clock, apply - * different modal values. - */ - if (IS_CHAN_A_FAST_CLOCK(ah, chan)) - REG_WRITE_ARRAY(&ah->iniModesFastClock, modesIndex, regWrites); - - if (AR_SREV_9565(ah)) - REG_WRITE_ARRAY(&ah->iniModesFastClock, 1, regWrites); - - REG_WRITE_ARRAY(&ah->iniAdditional, 1, regWrites); - - ah->modes_index = modesIndex; - *ini_reloaded = true; - -set_rfmode: - ar9003_hw_set_rfmode(ah, chan); - return 0; -} - -static void ar9003_hw_spectral_scan_config(struct ath_hw *ah, - struct ath_spec_scan *param) -{ - u8 count; - - if (!param->enabled) { - REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_ENABLE); - return; - } - - REG_SET_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_FFT_ENA); - REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENABLE); - - /* on AR93xx and newer, count = 0 will make the the chip send - * spectral samples endlessly. Check if this really was intended, - * and fix otherwise. - */ - count = param->count; - if (param->endless) - count = 0; - else if (param->count == 0) - count = 1; - - if (param->short_repeat) - REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT); - else - REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT); - - REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_COUNT, count); - REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_PERIOD, param->period); - REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_FFT_PERIOD, param->fft_period); - - return; -} - -static void ar9003_hw_spectral_scan_trigger(struct ath_hw *ah) -{ - /* Activate spectral scan */ - REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_ACTIVE); -} - -static void ar9003_hw_spectral_scan_wait(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - - /* Poll for spectral scan complete */ - if (!ath9k_hw_wait(ah, AR_PHY_SPECTRAL_SCAN, - AR_PHY_SPECTRAL_SCAN_ACTIVE, - 0, AH_WAIT_TIMEOUT)) { - ath_err(common, "spectral scan wait failed\n"); - return; - } -} - -void ar9003_hw_attach_phy_ops(struct ath_hw *ah) -{ - struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); - struct ath_hw_ops *ops = ath9k_hw_ops(ah); - static const u32 ar9300_cca_regs[6] = { - AR_PHY_CCA_0, - AR_PHY_CCA_1, - AR_PHY_CCA_2, - AR_PHY_EXT_CCA, - AR_PHY_EXT_CCA_1, - AR_PHY_EXT_CCA_2, - }; - - priv_ops->rf_set_freq = ar9003_hw_set_channel; - priv_ops->spur_mitigate_freq = ar9003_hw_spur_mitigate; - priv_ops->compute_pll_control = ar9003_hw_compute_pll_control; - priv_ops->set_channel_regs = ar9003_hw_set_channel_regs; - priv_ops->init_bb = ar9003_hw_init_bb; - priv_ops->process_ini = ar9003_hw_process_ini; - priv_ops->set_rfmode = ar9003_hw_set_rfmode; - priv_ops->mark_phy_inactive = ar9003_hw_mark_phy_inactive; - priv_ops->set_delta_slope = ar9003_hw_set_delta_slope; - priv_ops->rfbus_req = ar9003_hw_rfbus_req; - priv_ops->rfbus_done = ar9003_hw_rfbus_done; - priv_ops->ani_control = ar9003_hw_ani_control; - priv_ops->do_getnf = ar9003_hw_do_getnf; - priv_ops->ani_cache_ini_regs = ar9003_hw_ani_cache_ini_regs; - priv_ops->set_radar_params = ar9003_hw_set_radar_params; - priv_ops->fast_chan_change = ar9003_hw_fast_chan_change; - - ops->antdiv_comb_conf_get = ar9003_hw_antdiv_comb_conf_get; - ops->antdiv_comb_conf_set = ar9003_hw_antdiv_comb_conf_set; - ops->antctrl_shared_chain_lnadiv = ar9003_hw_antctrl_shared_chain_lnadiv; - ops->spectral_scan_config = ar9003_hw_spectral_scan_config; - ops->spectral_scan_trigger = ar9003_hw_spectral_scan_trigger; - ops->spectral_scan_wait = ar9003_hw_spectral_scan_wait; - - ar9003_hw_set_nf_limits(ah); - ar9003_hw_set_radar_conf(ah); - memcpy(ah->nf_regs, ar9300_cca_regs, sizeof(ah->nf_regs)); -} - -void ar9003_hw_bb_watchdog_config(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - u32 idle_tmo_ms = ah->bb_watchdog_timeout_ms; - u32 val, idle_count; - - if (!idle_tmo_ms) { - /* disable IRQ, disable chip-reset for BB panic */ - REG_WRITE(ah, AR_PHY_WATCHDOG_CTL_2, - REG_READ(ah, AR_PHY_WATCHDOG_CTL_2) & - ~(AR_PHY_WATCHDOG_RST_ENABLE | - AR_PHY_WATCHDOG_IRQ_ENABLE)); - - /* disable watchdog in non-IDLE mode, disable in IDLE mode */ - REG_WRITE(ah, AR_PHY_WATCHDOG_CTL_1, - REG_READ(ah, AR_PHY_WATCHDOG_CTL_1) & - ~(AR_PHY_WATCHDOG_NON_IDLE_ENABLE | - AR_PHY_WATCHDOG_IDLE_ENABLE)); - - ath_dbg(common, RESET, "Disabled BB Watchdog\n"); - return; - } - - /* enable IRQ, disable chip-reset for BB watchdog */ - val = REG_READ(ah, AR_PHY_WATCHDOG_CTL_2) & AR_PHY_WATCHDOG_CNTL2_MASK; - REG_WRITE(ah, AR_PHY_WATCHDOG_CTL_2, - (val | AR_PHY_WATCHDOG_IRQ_ENABLE) & - ~AR_PHY_WATCHDOG_RST_ENABLE); - - /* bound limit to 10 secs */ - if (idle_tmo_ms > 10000) - idle_tmo_ms = 10000; - - /* - * The time unit for watchdog event is 2^15 44/88MHz cycles. - * - * For HT20 we have a time unit of 2^15/44 MHz = .74 ms per tick - * For HT40 we have a time unit of 2^15/88 MHz = .37 ms per tick - * - * Given we use fast clock now in 5 GHz, these time units should - * be common for both 2 GHz and 5 GHz. - */ - idle_count = (100 * idle_tmo_ms) / 74; - if (ah->curchan && IS_CHAN_HT40(ah->curchan)) - idle_count = (100 * idle_tmo_ms) / 37; - - /* - * enable watchdog in non-IDLE mode, disable in IDLE mode, - * set idle time-out. - */ - REG_WRITE(ah, AR_PHY_WATCHDOG_CTL_1, - AR_PHY_WATCHDOG_NON_IDLE_ENABLE | - AR_PHY_WATCHDOG_IDLE_MASK | - (AR_PHY_WATCHDOG_NON_IDLE_MASK & (idle_count << 2))); - - ath_dbg(common, RESET, "Enabled BB Watchdog timeout (%u ms)\n", - idle_tmo_ms); -} - -void ar9003_hw_bb_watchdog_read(struct ath_hw *ah) -{ - /* - * we want to avoid printing in ISR context so we save the - * watchdog status to be printed later in bottom half context. - */ - ah->bb_watchdog_last_status = REG_READ(ah, AR_PHY_WATCHDOG_STATUS); - - /* - * the watchdog timer should reset on status read but to be sure - * sure we write 0 to the watchdog status bit. - */ - REG_WRITE(ah, AR_PHY_WATCHDOG_STATUS, - ah->bb_watchdog_last_status & ~AR_PHY_WATCHDOG_STATUS_CLR); -} - -void ar9003_hw_bb_watchdog_dbg_info(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - u32 status; - - if (likely(!(common->debug_mask & ATH_DBG_RESET))) - return; - - status = ah->bb_watchdog_last_status; - ath_dbg(common, RESET, - "\n==== BB update: BB status=0x%08x ====\n", status); - ath_dbg(common, RESET, - "** BB state: wd=%u det=%u rdar=%u rOFDM=%d rCCK=%u tOFDM=%u tCCK=%u agc=%u src=%u **\n", - MS(status, AR_PHY_WATCHDOG_INFO), - MS(status, AR_PHY_WATCHDOG_DET_HANG), - MS(status, AR_PHY_WATCHDOG_RADAR_SM), - MS(status, AR_PHY_WATCHDOG_RX_OFDM_SM), - MS(status, AR_PHY_WATCHDOG_RX_CCK_SM), - MS(status, AR_PHY_WATCHDOG_TX_OFDM_SM), - MS(status, AR_PHY_WATCHDOG_TX_CCK_SM), - MS(status, AR_PHY_WATCHDOG_AGC_SM), - MS(status, AR_PHY_WATCHDOG_SRCH_SM)); - - ath_dbg(common, RESET, "** BB WD cntl: cntl1=0x%08x cntl2=0x%08x **\n", - REG_READ(ah, AR_PHY_WATCHDOG_CTL_1), - REG_READ(ah, AR_PHY_WATCHDOG_CTL_2)); - ath_dbg(common, RESET, "** BB mode: BB_gen_controls=0x%08x **\n", - REG_READ(ah, AR_PHY_GEN_CTRL)); - -#define PCT(_field) (common->cc_survey._field * 100 / common->cc_survey.cycles) - if (common->cc_survey.cycles) - ath_dbg(common, RESET, - "** BB busy times: rx_clear=%d%%, rx_frame=%d%%, tx_frame=%d%% **\n", - PCT(rx_busy), PCT(rx_frame), PCT(tx_frame)); - - ath_dbg(common, RESET, "==== BB update: done ====\n\n"); -} -EXPORT_SYMBOL(ar9003_hw_bb_watchdog_dbg_info); - -void ar9003_hw_disable_phy_restart(struct ath_hw *ah) -{ - u32 val; - - /* While receiving unsupported rate frame rx state machine - * gets into a state 0xb and if phy_restart happens in that - * state, BB would go hang. If RXSM is in 0xb state after - * first bb panic, ensure to disable the phy_restart. - */ - if (!((MS(ah->bb_watchdog_last_status, - AR_PHY_WATCHDOG_RX_OFDM_SM) == 0xb) || - ah->bb_hang_rx_ofdm)) - return; - - ah->bb_hang_rx_ofdm = true; - val = REG_READ(ah, AR_PHY_RESTART); - val &= ~AR_PHY_RESTART_ENA; - - REG_WRITE(ah, AR_PHY_RESTART, val); -} -EXPORT_SYMBOL(ar9003_hw_disable_phy_restart); diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h deleted file mode 100644 index 5013c731f9f6..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h +++ /dev/null @@ -1,1322 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef AR9003_PHY_H -#define AR9003_PHY_H - -/* - * Channel Register Map - */ -#define AR_CHAN_BASE 0x9800 - -#define AR_PHY_TIMING1 (AR_CHAN_BASE + 0x0) -#define AR_PHY_TIMING2 (AR_CHAN_BASE + 0x4) -#define AR_PHY_TIMING3 (AR_CHAN_BASE + 0x8) -#define AR_PHY_TIMING4 (AR_CHAN_BASE + 0xc) -#define AR_PHY_TIMING5 (AR_CHAN_BASE + 0x10) -#define AR_PHY_TIMING6 (AR_CHAN_BASE + 0x14) -#define AR_PHY_TIMING11 (AR_CHAN_BASE + 0x18) -#define AR_PHY_SPUR_REG (AR_CHAN_BASE + 0x1c) -#define AR_PHY_RX_IQCAL_CORR_B0 (AR_CHAN_BASE + 0xdc) -#define AR_PHY_TX_IQCAL_CONTROL_3 (AR_CHAN_BASE + 0xb0) -#define AR_PHY_TIMING_CONTROL4_DO_GAIN_DC_IQ_CAL_SHIFT 16 - -#define AR_PHY_TIMING11_SPUR_FREQ_SD 0x3FF00000 -#define AR_PHY_TIMING11_SPUR_FREQ_SD_S 20 - -#define AR_PHY_TIMING11_SPUR_DELTA_PHASE 0x000FFFFF -#define AR_PHY_TIMING11_SPUR_DELTA_PHASE_S 0 - -#define AR_PHY_TIMING11_USE_SPUR_FILTER_IN_AGC 0x40000000 -#define AR_PHY_TIMING11_USE_SPUR_FILTER_IN_AGC_S 30 - -#define AR_PHY_TIMING11_USE_SPUR_FILTER_IN_SELFCOR 0x80000000 -#define AR_PHY_TIMING11_USE_SPUR_FILTER_IN_SELFCOR_S 31 - -#define AR_PHY_SPUR_REG_ENABLE_NF_RSSI_SPUR_MIT 0x4000000 -#define AR_PHY_SPUR_REG_ENABLE_NF_RSSI_SPUR_MIT_S 26 - -#define AR_PHY_SPUR_REG_ENABLE_MASK_PPM 0x20000 /* bins move with freq offset */ -#define AR_PHY_SPUR_REG_ENABLE_MASK_PPM_S 17 -#define AR_PHY_SPUR_REG_SPUR_RSSI_THRESH 0x000000FF -#define AR_PHY_SPUR_REG_SPUR_RSSI_THRESH_S 0 -#define AR_PHY_SPUR_REG_EN_VIT_SPUR_RSSI 0x00000100 -#define AR_PHY_SPUR_REG_EN_VIT_SPUR_RSSI_S 8 -#define AR_PHY_SPUR_REG_MASK_RATE_CNTL 0x03FC0000 -#define AR_PHY_SPUR_REG_MASK_RATE_CNTL_S 18 - -#define AR_PHY_RX_IQCAL_CORR_B0_LOOPBACK_IQCORR_EN 0x20000000 -#define AR_PHY_RX_IQCAL_CORR_B0_LOOPBACK_IQCORR_EN_S 29 - -#define AR_PHY_TX_IQCAL_CONTROL_3_IQCORR_EN 0x80000000 -#define AR_PHY_TX_IQCAL_CONTROL_3_IQCORR_EN_S 31 - -#define AR_PHY_FIND_SIG_LOW (AR_CHAN_BASE + 0x20) - -#define AR_PHY_SFCORR (AR_CHAN_BASE + 0x24) -#define AR_PHY_SFCORR_LOW (AR_CHAN_BASE + 0x28) -#define AR_PHY_SFCORR_EXT (AR_CHAN_BASE + 0x2c) - -#define AR_PHY_EXT_CCA (AR_CHAN_BASE + 0x30) -#define AR_PHY_RADAR_0 (AR_CHAN_BASE + 0x34) -#define AR_PHY_RADAR_1 (AR_CHAN_BASE + 0x38) -#define AR_PHY_RADAR_EXT (AR_CHAN_BASE + 0x3c) -#define AR_PHY_MULTICHAIN_CTRL (AR_CHAN_BASE + 0x80) -#define AR_PHY_PERCHAIN_CSD (AR_CHAN_BASE + 0x84) - -#define AR_PHY_TX_PHASE_RAMP_0 (AR_CHAN_BASE + 0xd0) -#define AR_PHY_ADC_GAIN_DC_CORR_0 (AR_CHAN_BASE + 0xd4) -#define AR_PHY_IQ_ADC_MEAS_0_B0 (AR_CHAN_BASE + 0xc0) -#define AR_PHY_IQ_ADC_MEAS_1_B0 (AR_CHAN_BASE + 0xc4) -#define AR_PHY_IQ_ADC_MEAS_2_B0 (AR_CHAN_BASE + 0xc8) -#define AR_PHY_IQ_ADC_MEAS_3_B0 (AR_CHAN_BASE + 0xcc) - -/* The following registers changed position from AR9300 1.0 to AR9300 2.0 */ -#define AR_PHY_TX_PHASE_RAMP_0_9300_10 (AR_CHAN_BASE + 0xd0 - 0x10) -#define AR_PHY_ADC_GAIN_DC_CORR_0_9300_10 (AR_CHAN_BASE + 0xd4 - 0x10) -#define AR_PHY_IQ_ADC_MEAS_0_B0_9300_10 (AR_CHAN_BASE + 0xc0 + 0x8) -#define AR_PHY_IQ_ADC_MEAS_1_B0_9300_10 (AR_CHAN_BASE + 0xc4 + 0x8) -#define AR_PHY_IQ_ADC_MEAS_2_B0_9300_10 (AR_CHAN_BASE + 0xc8 + 0x8) -#define AR_PHY_IQ_ADC_MEAS_3_B0_9300_10 (AR_CHAN_BASE + 0xcc + 0x8) - -#define AR_PHY_TX_CRC (AR_CHAN_BASE + 0xa0) -#define AR_PHY_TST_DAC_CONST (AR_CHAN_BASE + 0xa4) -#define AR_PHY_SPUR_REPORT_0 (AR_CHAN_BASE + 0xa8) -#define AR_PHY_CHAN_INFO_TAB_0 (AR_CHAN_BASE + 0x300) - -/* - * Channel Field Definitions - */ -#define AR_PHY_TIMING2_USE_FORCE_PPM 0x00001000 -#define AR_PHY_TIMING2_FORCE_PPM_VAL 0x00000fff -#define AR_PHY_TIMING3_DSC_MAN 0xFFFE0000 -#define AR_PHY_TIMING3_DSC_MAN_S 17 -#define AR_PHY_TIMING3_DSC_EXP 0x0001E000 -#define AR_PHY_TIMING3_DSC_EXP_S 13 -#define AR_PHY_TIMING4_IQCAL_LOG_COUNT_MAX 0xF000 -#define AR_PHY_TIMING4_IQCAL_LOG_COUNT_MAX_S 12 -#define AR_PHY_TIMING4_DO_CAL 0x10000 - -#define AR_PHY_TIMING4_ENABLE_PILOT_MASK 0x10000000 -#define AR_PHY_TIMING4_ENABLE_PILOT_MASK_S 28 -#define AR_PHY_TIMING4_ENABLE_CHAN_MASK 0x20000000 -#define AR_PHY_TIMING4_ENABLE_CHAN_MASK_S 29 - -#define AR_PHY_TIMING4_ENABLE_SPUR_FILTER 0x40000000 -#define AR_PHY_TIMING4_ENABLE_SPUR_FILTER_S 30 -#define AR_PHY_TIMING4_ENABLE_SPUR_RSSI 0x80000000 -#define AR_PHY_TIMING4_ENABLE_SPUR_RSSI_S 31 - -#define AR_PHY_NEW_ADC_GAIN_CORR_ENABLE 0x40000000 -#define AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE 0x80000000 -#define AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW 0x00000001 -#define AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW 0x00003F00 -#define AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW_S 8 -#define AR_PHY_SFCORR_LOW_M1_THRESH_LOW 0x001FC000 -#define AR_PHY_SFCORR_LOW_M1_THRESH_LOW_S 14 -#define AR_PHY_SFCORR_LOW_M2_THRESH_LOW 0x0FE00000 -#define AR_PHY_SFCORR_LOW_M2_THRESH_LOW_S 21 -#define AR_PHY_SFCORR_M2COUNT_THR 0x0000001F -#define AR_PHY_SFCORR_M2COUNT_THR_S 0 -#define AR_PHY_SFCORR_M1_THRESH 0x00FE0000 -#define AR_PHY_SFCORR_M1_THRESH_S 17 -#define AR_PHY_SFCORR_M2_THRESH 0x7F000000 -#define AR_PHY_SFCORR_M2_THRESH_S 24 -#define AR_PHY_SFCORR_EXT_M1_THRESH 0x0000007F -#define AR_PHY_SFCORR_EXT_M1_THRESH_S 0 -#define AR_PHY_SFCORR_EXT_M2_THRESH 0x00003F80 -#define AR_PHY_SFCORR_EXT_M2_THRESH_S 7 -#define AR_PHY_SFCORR_EXT_M1_THRESH_LOW 0x001FC000 -#define AR_PHY_SFCORR_EXT_M1_THRESH_LOW_S 14 -#define AR_PHY_SFCORR_EXT_M2_THRESH_LOW 0x0FE00000 -#define AR_PHY_SFCORR_EXT_M2_THRESH_LOW_S 21 -#define AR_PHY_SFCORR_EXT_SPUR_SUBCHANNEL_SD 0x10000000 -#define AR_PHY_SFCORR_EXT_SPUR_SUBCHANNEL_SD_S 28 -#define AR_PHY_SFCORR_SPUR_SUBCHNL_SD_S 28 -#define AR_PHY_EXT_CCA_THRESH62 0x007F0000 -#define AR_PHY_EXT_CCA_THRESH62_S 16 -#define AR_PHY_EXT_MINCCA_PWR 0x01FF0000 -#define AR_PHY_EXT_MINCCA_PWR_S 16 -#define AR_PHY_EXT_CYCPWR_THR1 0x0000FE00L -#define AR_PHY_EXT_CYCPWR_THR1_S 9 -#define AR_PHY_TIMING5_CYCPWR_THR1 0x000000FE -#define AR_PHY_TIMING5_CYCPWR_THR1_S 1 -#define AR_PHY_TIMING5_CYCPWR_THR1_ENABLE 0x00000001 -#define AR_PHY_TIMING5_CYCPWR_THR1_ENABLE_S 0 -#define AR_PHY_TIMING5_CYCPWR_THR1A 0x007F0000 -#define AR_PHY_TIMING5_CYCPWR_THR1A_S 16 -#define AR_PHY_TIMING5_RSSI_THR1A (0x7F << 16) -#define AR_PHY_TIMING5_RSSI_THR1A_S 16 -#define AR_PHY_TIMING5_RSSI_THR1A_ENA (0x1 << 15) -#define AR_PHY_RADAR_0_ENA 0x00000001 -#define AR_PHY_RADAR_0_FFT_ENA 0x80000000 -#define AR_PHY_RADAR_0_INBAND 0x0000003e -#define AR_PHY_RADAR_0_INBAND_S 1 -#define AR_PHY_RADAR_0_PRSSI 0x00000FC0 -#define AR_PHY_RADAR_0_PRSSI_S 6 -#define AR_PHY_RADAR_0_HEIGHT 0x0003F000 -#define AR_PHY_RADAR_0_HEIGHT_S 12 -#define AR_PHY_RADAR_0_RRSSI 0x00FC0000 -#define AR_PHY_RADAR_0_RRSSI_S 18 -#define AR_PHY_RADAR_0_FIRPWR 0x7F000000 -#define AR_PHY_RADAR_0_FIRPWR_S 24 -#define AR_PHY_RADAR_1_RELPWR_ENA 0x00800000 -#define AR_PHY_RADAR_1_USE_FIR128 0x00400000 -#define AR_PHY_RADAR_1_RELPWR_THRESH 0x003F0000 -#define AR_PHY_RADAR_1_RELPWR_THRESH_S 16 -#define AR_PHY_RADAR_1_BLOCK_CHECK 0x00008000 -#define AR_PHY_RADAR_1_MAX_RRSSI 0x00004000 -#define AR_PHY_RADAR_1_RELSTEP_CHECK 0x00002000 -#define AR_PHY_RADAR_1_RELSTEP_THRESH 0x00001F00 -#define AR_PHY_RADAR_1_RELSTEP_THRESH_S 8 -#define AR_PHY_RADAR_1_MAXLEN 0x000000FF -#define AR_PHY_RADAR_1_MAXLEN_S 0 -#define AR_PHY_RADAR_EXT_ENA 0x00004000 -#define AR_PHY_RADAR_DC_PWR_THRESH 0x007f8000 -#define AR_PHY_RADAR_DC_PWR_THRESH_S 15 -#define AR_PHY_RADAR_LB_DC_CAP 0x7f800000 -#define AR_PHY_RADAR_LB_DC_CAP_S 23 -#define AR_PHY_FIND_SIG_LOW_FIRSTEP_LOW (0x3f << 6) -#define AR_PHY_FIND_SIG_LOW_FIRSTEP_LOW_S 6 -#define AR_PHY_FIND_SIG_LOW_FIRPWR (0x7f << 12) -#define AR_PHY_FIND_SIG_LOW_FIRPWR_S 12 -#define AR_PHY_FIND_SIG_LOW_FIRPWR_SIGN_BIT 19 -#define AR_PHY_FIND_SIG_LOW_RELSTEP 0x1f -#define AR_PHY_FIND_SIG_LOW_RELSTEP_S 0 -#define AR_PHY_FIND_SIG_LOW_RELSTEP_SIGN_BIT 5 -#define AR_PHY_CHAN_INFO_TAB_S2_READ 0x00000008 -#define AR_PHY_CHAN_INFO_TAB_S2_READ_S 3 -#define AR_PHY_RX_IQCAL_CORR_IQCORR_Q_Q_COFF 0x0000007F -#define AR_PHY_RX_IQCAL_CORR_IQCORR_Q_Q_COFF_S 0 -#define AR_PHY_RX_IQCAL_CORR_IQCORR_Q_I_COFF 0x00003F80 -#define AR_PHY_RX_IQCAL_CORR_IQCORR_Q_I_COFF_S 7 -#define AR_PHY_RX_IQCAL_CORR_IQCORR_ENABLE 0x00004000 -#define AR_PHY_RX_IQCAL_CORR_LOOPBACK_IQCORR_Q_Q_COFF 0x003f8000 -#define AR_PHY_RX_IQCAL_CORR_LOOPBACK_IQCORR_Q_Q_COFF_S 15 -#define AR_PHY_RX_IQCAL_CORR_LOOPBACK_IQCORR_Q_I_COFF 0x1fc00000 -#define AR_PHY_RX_IQCAL_CORR_LOOPBACK_IQCORR_Q_I_COFF_S 22 - -/* - * MRC Register Map - */ -#define AR_MRC_BASE 0x9c00 - -#define AR_PHY_TIMING_3A (AR_MRC_BASE + 0x0) -#define AR_PHY_LDPC_CNTL1 (AR_MRC_BASE + 0x4) -#define AR_PHY_LDPC_CNTL2 (AR_MRC_BASE + 0x8) -#define AR_PHY_PILOT_SPUR_MASK (AR_MRC_BASE + 0xc) -#define AR_PHY_CHAN_SPUR_MASK (AR_MRC_BASE + 0x10) -#define AR_PHY_SGI_DELTA (AR_MRC_BASE + 0x14) -#define AR_PHY_ML_CNTL_1 (AR_MRC_BASE + 0x18) -#define AR_PHY_ML_CNTL_2 (AR_MRC_BASE + 0x1c) -#define AR_PHY_TST_ADC (AR_MRC_BASE + 0x20) - -#define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A 0x00000FE0 -#define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_A_S 5 -#define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_A 0x1F -#define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_A_S 0 -#define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B 0x00FE0000 -#define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_IDX_B_S 17 -#define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_B 0x0001F000 -#define AR_PHY_PILOT_SPUR_MASK_CF_PILOT_MASK_B_S 12 - -#define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A 0x00000FE0 -#define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_A_S 5 -#define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_A 0x1F -#define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_A_S 0 -#define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B 0x00FE0000 -#define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_IDX_B_S 17 -#define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_B 0x0001F000 -#define AR_PHY_CHAN_SPUR_MASK_CF_CHAN_MASK_B_S 12 - - -/* - * MRC Feild Definitions - */ -#define AR_PHY_SGI_DSC_MAN 0x0007FFF0 -#define AR_PHY_SGI_DSC_MAN_S 4 -#define AR_PHY_SGI_DSC_EXP 0x0000000F -#define AR_PHY_SGI_DSC_EXP_S 0 -/* - * BBB Register Map - */ -#define AR_BBB_BASE 0x9d00 - -/* - * AGC Register Map - */ -#define AR_AGC_BASE 0x9e00 - -#define AR_PHY_SETTLING (AR_AGC_BASE + 0x0) -#define AR_PHY_FORCEMAX_GAINS_0 (AR_AGC_BASE + 0x4) -#define AR_PHY_GAINS_MINOFF0 (AR_AGC_BASE + 0x8) -#define AR_PHY_DESIRED_SZ (AR_AGC_BASE + 0xc) -#define AR_PHY_FIND_SIG (AR_AGC_BASE + 0x10) -#define AR_PHY_AGC (AR_AGC_BASE + 0x14) -#define AR_PHY_EXT_ATTEN_CTL_0 (AR_AGC_BASE + 0x18) -#define AR_PHY_CCA_0 (AR_AGC_BASE + 0x1c) -#define AR_PHY_EXT_CCA0 (AR_AGC_BASE + 0x20) -#define AR_PHY_RESTART (AR_AGC_BASE + 0x24) - -/* - * Antenna Diversity settings - */ -#define AR_PHY_MC_GAIN_CTRL (AR_AGC_BASE + 0x28) -#define AR_ANT_DIV_CTRL_ALL 0x7e000000 -#define AR_ANT_DIV_CTRL_ALL_S 25 -#define AR_ANT_DIV_ENABLE 0x1000000 -#define AR_ANT_DIV_ENABLE_S 24 - - -#define AR_PHY_ANT_FAST_DIV_BIAS 0x00007e00 -#define AR_PHY_ANT_FAST_DIV_BIAS_S 9 -#define AR_PHY_ANT_SW_RX_PROT 0x00800000 -#define AR_PHY_ANT_SW_RX_PROT_S 23 -#define AR_PHY_ANT_DIV_LNADIV 0x01000000 -#define AR_PHY_ANT_DIV_LNADIV_S 24 -#define AR_PHY_ANT_DIV_ALT_LNACONF 0x06000000 -#define AR_PHY_ANT_DIV_ALT_LNACONF_S 25 -#define AR_PHY_ANT_DIV_MAIN_LNACONF 0x18000000 -#define AR_PHY_ANT_DIV_MAIN_LNACONF_S 27 -#define AR_PHY_ANT_DIV_ALT_GAINTB 0x20000000 -#define AR_PHY_ANT_DIV_ALT_GAINTB_S 29 -#define AR_PHY_ANT_DIV_MAIN_GAINTB 0x40000000 -#define AR_PHY_ANT_DIV_MAIN_GAINTB_S 30 - -#define AR_PHY_ANT_DIV_LNA1_MINUS_LNA2 0x0 -#define AR_PHY_ANT_DIV_LNA2 0x1 -#define AR_PHY_ANT_DIV_LNA1 0x2 -#define AR_PHY_ANT_DIV_LNA1_PLUS_LNA2 0x3 - -#define AR_PHY_EXTCHN_PWRTHR1 (AR_AGC_BASE + 0x2c) -#define AR_PHY_EXT_CHN_WIN (AR_AGC_BASE + 0x30) -#define AR_PHY_20_40_DET_THR (AR_AGC_BASE + 0x34) -#define AR_PHY_RIFS_SRCH (AR_AGC_BASE + 0x38) -#define AR_PHY_PEAK_DET_CTRL_1 (AR_AGC_BASE + 0x3c) -#define AR_PHY_PEAK_DET_CTRL_2 (AR_AGC_BASE + 0x40) -#define AR_PHY_RX_GAIN_BOUNDS_1 (AR_AGC_BASE + 0x44) -#define AR_PHY_RX_GAIN_BOUNDS_2 (AR_AGC_BASE + 0x48) -#define AR_PHY_RSSI_0 (AR_AGC_BASE + 0x180) -#define AR_PHY_SPUR_CCK_REP0 (AR_AGC_BASE + 0x184) - -#define AR_PHY_CCK_DETECT (AR_AGC_BASE + 0x1c0) -#define AR_FAST_DIV_ENABLE 0x2000 -#define AR_FAST_DIV_ENABLE_S 13 - -#define AR_PHY_DAG_CTRLCCK (AR_AGC_BASE + 0x1c4) -#define AR_PHY_IQCORR_CTRL_CCK (AR_AGC_BASE + 0x1c8) - -#define AR_PHY_CCK_SPUR_MIT (AR_AGC_BASE + 0x1cc) -#define AR_PHY_CCK_SPUR_MIT_SPUR_RSSI_THR 0x000001fe -#define AR_PHY_CCK_SPUR_MIT_SPUR_RSSI_THR_S 1 -#define AR_PHY_CCK_SPUR_MIT_SPUR_FILTER_TYPE 0x60000000 -#define AR_PHY_CCK_SPUR_MIT_SPUR_FILTER_TYPE_S 29 -#define AR_PHY_CCK_SPUR_MIT_USE_CCK_SPUR_MIT 0x00000001 -#define AR_PHY_CCK_SPUR_MIT_USE_CCK_SPUR_MIT_S 0 -#define AR_PHY_CCK_SPUR_MIT_CCK_SPUR_FREQ 0x1ffffe00 -#define AR_PHY_CCK_SPUR_MIT_CCK_SPUR_FREQ_S 9 - -#define AR_PHY_MRC_CCK_CTRL (AR_AGC_BASE + 0x1d0) -#define AR_PHY_MRC_CCK_ENABLE 0x00000001 -#define AR_PHY_MRC_CCK_ENABLE_S 0 -#define AR_PHY_MRC_CCK_MUX_REG 0x00000002 -#define AR_PHY_MRC_CCK_MUX_REG_S 1 - -#define AR_PHY_RX_OCGAIN (AR_AGC_BASE + 0x200) - -#define AR_PHY_CCA_NOM_VAL_9300_2GHZ -110 -#define AR_PHY_CCA_NOM_VAL_9300_5GHZ -115 -#define AR_PHY_CCA_MIN_GOOD_VAL_9300_2GHZ -125 -#define AR_PHY_CCA_MIN_GOOD_VAL_9300_5GHZ -125 -#define AR_PHY_CCA_MAX_GOOD_VAL_9300_2GHZ -95 -#define AR_PHY_CCA_MAX_GOOD_VAL_9300_5GHZ -100 - -#define AR_PHY_CCA_NOM_VAL_9462_2GHZ -127 -#define AR_PHY_CCA_MIN_GOOD_VAL_9462_2GHZ -127 -#define AR_PHY_CCA_NOM_VAL_9462_5GHZ -127 -#define AR_PHY_CCA_MIN_GOOD_VAL_9462_5GHZ -127 - -#define AR_PHY_CCA_NOM_VAL_9330_2GHZ -118 - -#define AR9300_EXT_LNA_CTL_GPIO_AR9485 9 - -/* - * AGC Field Definitions - */ -#define AR_PHY_EXT_ATTEN_CTL_RXTX_MARGIN 0x00FC0000 -#define AR_PHY_EXT_ATTEN_CTL_RXTX_MARGIN_S 18 -#define AR_PHY_EXT_ATTEN_CTL_BSW_MARGIN 0x00003C00 -#define AR_PHY_EXT_ATTEN_CTL_BSW_MARGIN_S 10 -#define AR_PHY_EXT_ATTEN_CTL_BSW_ATTEN 0x0000001F -#define AR_PHY_EXT_ATTEN_CTL_BSW_ATTEN_S 0 -#define AR_PHY_EXT_ATTEN_CTL_XATTEN2_MARGIN 0x003E0000 -#define AR_PHY_EXT_ATTEN_CTL_XATTEN2_MARGIN_S 17 -#define AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN 0x0001F000 -#define AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN_S 12 -#define AR_PHY_EXT_ATTEN_CTL_XATTEN2_DB 0x00000FC0 -#define AR_PHY_EXT_ATTEN_CTL_XATTEN2_DB_S 6 -#define AR_PHY_EXT_ATTEN_CTL_XATTEN1_DB 0x0000003F -#define AR_PHY_EXT_ATTEN_CTL_XATTEN1_DB_S 0 -#define AR_PHY_RXGAIN_TXRX_ATTEN 0x0003F000 -#define AR_PHY_RXGAIN_TXRX_ATTEN_S 12 -#define AR_PHY_RXGAIN_TXRX_RF_MAX 0x007C0000 -#define AR_PHY_RXGAIN_TXRX_RF_MAX_S 18 -#define AR9280_PHY_RXGAIN_TXRX_ATTEN 0x00003F80 -#define AR9280_PHY_RXGAIN_TXRX_ATTEN_S 7 -#define AR9280_PHY_RXGAIN_TXRX_MARGIN 0x001FC000 -#define AR9280_PHY_RXGAIN_TXRX_MARGIN_S 14 -#define AR_PHY_SETTLING_SWITCH 0x00003F80 -#define AR_PHY_SETTLING_SWITCH_S 7 -#define AR_PHY_DESIRED_SZ_ADC 0x000000FF -#define AR_PHY_DESIRED_SZ_ADC_S 0 -#define AR_PHY_DESIRED_SZ_PGA 0x0000FF00 -#define AR_PHY_DESIRED_SZ_PGA_S 8 -#define AR_PHY_DESIRED_SZ_TOT_DES 0x0FF00000 -#define AR_PHY_DESIRED_SZ_TOT_DES_S 20 -#define AR_PHY_MINCCA_PWR 0x1FF00000 -#define AR_PHY_MINCCA_PWR_S 20 -#define AR_PHY_CCA_THRESH62 0x0007F000 -#define AR_PHY_CCA_THRESH62_S 12 -#define AR9280_PHY_MINCCA_PWR 0x1FF00000 -#define AR9280_PHY_MINCCA_PWR_S 20 -#define AR9280_PHY_CCA_THRESH62 0x000FF000 -#define AR9280_PHY_CCA_THRESH62_S 12 -#define AR_PHY_EXT_CCA0_THRESH62 0x000000FF -#define AR_PHY_EXT_CCA0_THRESH62_S 0 -#define AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK 0x0000003F -#define AR_PHY_CCK_DETECT_WEAK_SIG_THR_CCK_S 0 -#define AR_PHY_CCK_DETECT_ANT_SWITCH_TIME 0x00001FC0 -#define AR_PHY_CCK_DETECT_ANT_SWITCH_TIME_S 6 -#define AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV 0x2000 - -#define AR_PHY_DAG_CTRLCCK_EN_RSSI_THR 0x00000200 -#define AR_PHY_DAG_CTRLCCK_EN_RSSI_THR_S 9 -#define AR_PHY_DAG_CTRLCCK_RSSI_THR 0x0001FC00 -#define AR_PHY_DAG_CTRLCCK_RSSI_THR_S 10 - -#define AR_PHY_RIFS_INIT_DELAY 0x3ff0000 -#define AR_PHY_AGC_QUICK_DROP 0x03c00000 -#define AR_PHY_AGC_QUICK_DROP_S 22 -#define AR_PHY_AGC_COARSE_LOW 0x00007F80 -#define AR_PHY_AGC_COARSE_LOW_S 7 -#define AR_PHY_AGC_COARSE_HIGH 0x003F8000 -#define AR_PHY_AGC_COARSE_HIGH_S 15 -#define AR_PHY_AGC_COARSE_PWR_CONST 0x0000007F -#define AR_PHY_AGC_COARSE_PWR_CONST_S 0 -#define AR_PHY_FIND_SIG_FIRSTEP 0x0003F000 -#define AR_PHY_FIND_SIG_FIRSTEP_S 12 -#define AR_PHY_FIND_SIG_FIRPWR 0x03FC0000 -#define AR_PHY_FIND_SIG_FIRPWR_S 18 -#define AR_PHY_FIND_SIG_FIRPWR_SIGN_BIT 25 -#define AR_PHY_FIND_SIG_RELPWR (0x1f << 6) -#define AR_PHY_FIND_SIG_RELPWR_S 6 -#define AR_PHY_FIND_SIG_RELPWR_SIGN_BIT 11 -#define AR_PHY_FIND_SIG_RELSTEP 0x1f -#define AR_PHY_FIND_SIG_RELSTEP_S 0 -#define AR_PHY_FIND_SIG_RELSTEP_SIGN_BIT 5 -#define AR_PHY_RESTART_ENABLE_DIV_M2FLAG 0x00200000 -#define AR_PHY_RESTART_ENABLE_DIV_M2FLAG_S 21 -#define AR_PHY_RESTART_DIV_GC 0x001C0000 -#define AR_PHY_RESTART_DIV_GC_S 18 -#define AR_PHY_RESTART_ENA 0x01 -#define AR_PHY_DC_RESTART_DIS 0x40000000 - -#define AR_PHY_TPC_OLPC_GAIN_DELTA_PAL_ON 0xFF000000 -#define AR_PHY_TPC_OLPC_GAIN_DELTA_PAL_ON_S 24 -#define AR_PHY_TPC_OLPC_GAIN_DELTA 0x00FF0000 -#define AR_PHY_TPC_OLPC_GAIN_DELTA_S 16 - -#define AR_PHY_TPC_6_ERROR_EST_MODE 0x03000000 -#define AR_PHY_TPC_6_ERROR_EST_MODE_S 24 - -/* - * SM Register Map - */ -#define AR_SM_BASE 0xa200 - -#define AR_PHY_D2_CHIP_ID (AR_SM_BASE + 0x0) -#define AR_PHY_GEN_CTRL (AR_SM_BASE + 0x4) -#define AR_PHY_MODE (AR_SM_BASE + 0x8) -#define AR_PHY_ACTIVE (AR_SM_BASE + 0xc) -#define AR_PHY_SPUR_MASK_A (AR_SM_BASE + 0x20) -#define AR_PHY_SPUR_MASK_B (AR_SM_BASE + 0x24) -#define AR_PHY_SPECTRAL_SCAN (AR_SM_BASE + 0x28) -#define AR_PHY_RADAR_BW_FILTER (AR_SM_BASE + 0x2c) -#define AR_PHY_SEARCH_START_DELAY (AR_SM_BASE + 0x30) -#define AR_PHY_MAX_RX_LEN (AR_SM_BASE + 0x34) -#define AR_PHY_FRAME_CTL (AR_SM_BASE + 0x38) -#define AR_PHY_RFBUS_REQ (AR_SM_BASE + 0x3c) -#define AR_PHY_RFBUS_GRANT (AR_SM_BASE + 0x40) -#define AR_PHY_RIFS (AR_SM_BASE + 0x44) -#define AR_PHY_RX_CLR_DELAY (AR_SM_BASE + 0x50) -#define AR_PHY_RX_DELAY (AR_SM_BASE + 0x54) - -#define AR_PHY_XPA_TIMING_CTL (AR_SM_BASE + 0x64) -#define AR_PHY_MISC_PA_CTL (AR_SM_BASE + 0x80) -#define AR_PHY_SWITCH_CHAIN_0 (AR_SM_BASE + 0x84) -#define AR_PHY_SWITCH_COM (AR_SM_BASE + 0x88) -#define AR_PHY_SWITCH_COM_2 (AR_SM_BASE + 0x8c) -#define AR_PHY_RX_CHAINMASK (AR_SM_BASE + 0xa0) -#define AR_PHY_CAL_CHAINMASK (AR_SM_BASE + 0xc0) -#define AR_PHY_CALMODE (AR_SM_BASE + 0xc8) -#define AR_PHY_FCAL_1 (AR_SM_BASE + 0xcc) -#define AR_PHY_FCAL_2_0 (AR_SM_BASE + 0xd0) -#define AR_PHY_DFT_TONE_CTL_0 (AR_SM_BASE + 0xd4) -#define AR_PHY_CL_CAL_CTL (AR_SM_BASE + 0xd8) -#define AR_PHY_CL_TAB_0 (AR_SM_BASE + 0x100) -#define AR_PHY_SYNTH_CONTROL (AR_SM_BASE + 0x140) -#define AR_PHY_ADDAC_CLK_SEL (AR_SM_BASE + 0x144) -#define AR_PHY_PLL_CTL (AR_SM_BASE + 0x148) -#define AR_PHY_ANALOG_SWAP (AR_SM_BASE + 0x14c) -#define AR_PHY_ADDAC_PARA_CTL (AR_SM_BASE + 0x150) -#define AR_PHY_XPA_CFG (AR_SM_BASE + 0x158) - -#define AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW 3 -#define AR_PHY_FRAME_CTL_CF_OVERLAP_WINDOW_S 0 - -#define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A 0x0001FC00 -#define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_IDX_A_S 10 -#define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A 0x3FF -#define AR_PHY_SPUR_MASK_A_CF_PUNC_MASK_A_S 0 - -#define AR_PHY_TEST (AR_SM_BASE + 0x160) - -#define AR_PHY_TEST_BBB_OBS_SEL 0x780000 -#define AR_PHY_TEST_BBB_OBS_SEL_S 19 - -#define AR_PHY_TEST_RX_OBS_SEL_BIT5_S 23 -#define AR_PHY_TEST_RX_OBS_SEL_BIT5 (1 << AR_PHY_TEST_RX_OBS_SEL_BIT5_S) - -#define AR_PHY_TEST_CHAIN_SEL 0xC0000000 -#define AR_PHY_TEST_CHAIN_SEL_S 30 - -#define AR_PHY_TEST_CTL_STATUS (AR_SM_BASE + 0x164) -#define AR_PHY_TEST_CTL_TSTDAC_EN 0x1 -#define AR_PHY_TEST_CTL_TSTDAC_EN_S 0 -#define AR_PHY_TEST_CTL_TX_OBS_SEL 0x1C -#define AR_PHY_TEST_CTL_TX_OBS_SEL_S 2 -#define AR_PHY_TEST_CTL_TX_OBS_MUX_SEL 0x60 -#define AR_PHY_TEST_CTL_TX_OBS_MUX_SEL_S 5 -#define AR_PHY_TEST_CTL_TSTADC_EN 0x100 -#define AR_PHY_TEST_CTL_TSTADC_EN_S 8 -#define AR_PHY_TEST_CTL_RX_OBS_SEL 0x3C00 -#define AR_PHY_TEST_CTL_RX_OBS_SEL_S 10 -#define AR_PHY_TEST_CTL_DEBUGPORT_SEL 0xe0000000 -#define AR_PHY_TEST_CTL_DEBUGPORT_SEL_S 29 - - -#define AR_PHY_TSTDAC (AR_SM_BASE + 0x168) - -#define AR_PHY_CHAN_STATUS (AR_SM_BASE + 0x16c) - -#define AR_PHY_CHAN_INFO_MEMORY (AR_SM_BASE + 0x170) -#define AR_PHY_CHAN_INFO_MEMORY_CHANINFOMEM_S2_READ 0x00000008 -#define AR_PHY_CHAN_INFO_MEMORY_CHANINFOMEM_S2_READ_S 3 - -#define AR_PHY_CHNINFO_NOISEPWR (AR_SM_BASE + 0x174) -#define AR_PHY_CHNINFO_GAINDIFF (AR_SM_BASE + 0x178) -#define AR_PHY_CHNINFO_FINETIM (AR_SM_BASE + 0x17c) -#define AR_PHY_CHAN_INFO_GAIN_0 (AR_SM_BASE + 0x180) -#define AR_PHY_SCRAMBLER_SEED (AR_SM_BASE + 0x190) -#define AR_PHY_CCK_TX_CTRL (AR_SM_BASE + 0x194) - -#define AR_PHY_HEAVYCLIP_CTL (AR_SM_BASE + 0x1a4) -#define AR_PHY_HEAVYCLIP_20 (AR_SM_BASE + 0x1a8) -#define AR_PHY_HEAVYCLIP_40 (AR_SM_BASE + 0x1ac) -#define AR_PHY_ILLEGAL_TXRATE (AR_SM_BASE + 0x1b0) - -#define AR_PHY_POWER_TX_RATE(_d) (AR_SM_BASE + 0x1c0 + ((_d) << 2)) - -#define AR_PHY_PWRTX_MAX (AR_SM_BASE + 0x1f0) -#define AR_PHY_POWER_TX_SUB (AR_SM_BASE + 0x1f4) - -#define AR_PHY_TPC_1 (AR_SM_BASE + 0x1f8) -#define AR_PHY_TPC_1_FORCED_DAC_GAIN 0x0000003e -#define AR_PHY_TPC_1_FORCED_DAC_GAIN_S 1 -#define AR_PHY_TPC_1_FORCE_DAC_GAIN 0x00000001 -#define AR_PHY_TPC_1_FORCE_DAC_GAIN_S 0 - -#define AR_PHY_TPC_4_B0 (AR_SM_BASE + 0x204) -#define AR_PHY_TPC_5_B0 (AR_SM_BASE + 0x208) -#define AR_PHY_TPC_6_B0 (AR_SM_BASE + 0x20c) - -#define AR_PHY_TPC_11_B0 (AR_SM_BASE + 0x220) -#define AR_PHY_TPC_11_B1 (AR_SM1_BASE + 0x220) -#define AR_PHY_TPC_11_B2 (AR_SM2_BASE + 0x220) -#define AR_PHY_TPC_11_OLPC_GAIN_DELTA 0x00ff0000 -#define AR_PHY_TPC_11_OLPC_GAIN_DELTA_S 16 - -#define AR_PHY_TPC_12 (AR_SM_BASE + 0x224) -#define AR_PHY_TPC_12_DESIRED_SCALE_HT40_5 0x3e000000 -#define AR_PHY_TPC_12_DESIRED_SCALE_HT40_5_S 25 - -#define AR_PHY_TPC_18 (AR_SM_BASE + 0x23c) -#define AR_PHY_TPC_18_THERM_CAL_VALUE 0x000000ff -#define AR_PHY_TPC_18_THERM_CAL_VALUE_S 0 -#define AR_PHY_TPC_18_VOLT_CAL_VALUE 0x0000ff00 -#define AR_PHY_TPC_18_VOLT_CAL_VALUE_S 8 - -#define AR_PHY_TPC_19 (AR_SM_BASE + 0x240) -#define AR_PHY_TPC_19_ALPHA_VOLT 0x001f0000 -#define AR_PHY_TPC_19_ALPHA_VOLT_S 16 -#define AR_PHY_TPC_19_ALPHA_THERM 0xff -#define AR_PHY_TPC_19_ALPHA_THERM_S 0 - -#define AR_PHY_TX_FORCED_GAIN (AR_SM_BASE + 0x258) -#define AR_PHY_TX_FORCED_GAIN_FORCE_TX_GAIN 0x00000001 -#define AR_PHY_TX_FORCED_GAIN_FORCE_TX_GAIN_S 0 -#define AR_PHY_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN 0x0000000e -#define AR_PHY_TX_FORCED_GAIN_FORCED_TXBB1DBGAIN_S 1 -#define AR_PHY_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN 0x00000030 -#define AR_PHY_TX_FORCED_GAIN_FORCED_TXBB6DBGAIN_S 4 -#define AR_PHY_TX_FORCED_GAIN_FORCED_TXMXRGAIN 0x000003c0 -#define AR_PHY_TX_FORCED_GAIN_FORCED_TXMXRGAIN_S 6 -#define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNA 0x00003c00 -#define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNA_S 10 -#define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNB 0x0003c000 -#define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNB_S 14 -#define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNC 0x003c0000 -#define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGNC_S 18 -#define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGND 0x00c00000 -#define AR_PHY_TX_FORCED_GAIN_FORCED_PADRVGND_S 22 -#define AR_PHY_TX_FORCED_GAIN_FORCED_ENABLE_PAL 0x01000000 -#define AR_PHY_TX_FORCED_GAIN_FORCED_ENABLE_PAL_S 24 - - -#define AR_PHY_PDADC_TAB_0 (AR_SM_BASE + 0x280) - -#define AR_PHY_TXGAIN_TABLE (AR_SM_BASE + 0x300) - -#define AR_PHY_TX_IQCAL_CONTROL_0 (AR_SM_BASE + (AR_SREV_9485(ah) ? \ - 0x3c4 : 0x444)) -#define AR_PHY_TX_IQCAL_CONTROL_1 (AR_SM_BASE + (AR_SREV_9485(ah) ? \ - 0x3c8 : 0x448)) -#define AR_PHY_TX_IQCAL_START (AR_SM_BASE + (AR_SREV_9485(ah) ? \ - 0x3c4 : 0x440)) -#define AR_PHY_TX_IQCAL_STATUS_B0 (AR_SM_BASE + (AR_SREV_9485(ah) ? \ - 0x3f0 : 0x48c)) -#define AR_PHY_TX_IQCAL_CORR_COEFF_B0(_i) (AR_SM_BASE + \ - (AR_SREV_9485(ah) ? \ - 0x3d0 : 0x450) + ((_i) << 2)) -#define AR_PHY_RTT_CTRL (AR_SM_BASE + 0x380) - -#define AR_PHY_WATCHDOG_STATUS (AR_SM_BASE + 0x5c0) -#define AR_PHY_WATCHDOG_CTL_1 (AR_SM_BASE + 0x5c4) -#define AR_PHY_WATCHDOG_CTL_2 (AR_SM_BASE + 0x5c8) -#define AR_PHY_WATCHDOG_CTL (AR_SM_BASE + 0x5cc) -#define AR_PHY_ONLY_WARMRESET (AR_SM_BASE + 0x5d0) -#define AR_PHY_ONLY_CTL (AR_SM_BASE + 0x5d4) -#define AR_PHY_ECO_CTRL (AR_SM_BASE + 0x5dc) - -#define AR_PHY_BB_THERM_ADC_1 (AR_SM_BASE + 0x248) -#define AR_PHY_BB_THERM_ADC_1_INIT_THERM 0x000000ff -#define AR_PHY_BB_THERM_ADC_1_INIT_THERM_S 0 - -#define AR_PHY_BB_THERM_ADC_3 (AR_SM_BASE + 0x250) -#define AR_PHY_BB_THERM_ADC_3_THERM_ADC_SCALE_GAIN 0x0001ff00 -#define AR_PHY_BB_THERM_ADC_3_THERM_ADC_SCALE_GAIN_S 8 -#define AR_PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET 0x000000ff -#define AR_PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET_S 0 - -#define AR_PHY_BB_THERM_ADC_4 (AR_SM_BASE + 0x254) -#define AR_PHY_BB_THERM_ADC_4_LATEST_THERM_VALUE 0x000000ff -#define AR_PHY_BB_THERM_ADC_4_LATEST_THERM_VALUE_S 0 -#define AR_PHY_BB_THERM_ADC_4_LATEST_VOLT_VALUE 0x0000ff00 -#define AR_PHY_BB_THERM_ADC_4_LATEST_VOLT_VALUE_S 8 - -/* AIC Registers */ -#define AR_PHY_AIC_CTRL_0_B0 (AR_SM_BASE + 0x4b0) -#define AR_PHY_AIC_CTRL_1_B0 (AR_SM_BASE + 0x4b4) -#define AR_PHY_AIC_CTRL_2_B0 (AR_SM_BASE + 0x4b8) -#define AR_PHY_AIC_CTRL_3_B0 (AR_SM_BASE + 0x4bc) -#define AR_PHY_AIC_STAT_0_B0 (AR_SM_BASE + 0x4c4)) -#define AR_PHY_AIC_STAT_1_B0 (AR_SM_BASE + 0x4c8)) -#define AR_PHY_AIC_CTRL_4_B0 (AR_SM_BASE + 0x4c0) -#define AR_PHY_AIC_STAT_2_B0 (AR_SM_BASE + 0x4cc) - -#define AR_PHY_65NM_CH0_TXRF3 0x16048 -#define AR_PHY_65NM_CH0_TXRF3_CAPDIV2G 0x0000001e -#define AR_PHY_65NM_CH0_TXRF3_CAPDIV2G_S 1 - -#define AR_PHY_65NM_CH0_SYNTH4 0x1608c -#define AR_PHY_SYNTH4_LONG_SHIFT_SELECT ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x00000001 : 0x00000002) -#define AR_PHY_SYNTH4_LONG_SHIFT_SELECT_S ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0 : 1) -#define AR_PHY_65NM_CH0_SYNTH7 0x16098 -#define AR_PHY_65NM_CH0_BIAS1 0x160c0 -#define AR_PHY_65NM_CH0_BIAS2 0x160c4 -#define AR_PHY_65NM_CH0_BIAS4 0x160cc -#define AR_PHY_65NM_CH0_RXTX4 0x1610c -#define AR_PHY_65NM_CH1_RXTX4 0x1650c -#define AR_PHY_65NM_CH2_RXTX4 0x1690c - -#define AR_CH0_TOP (AR_SREV_9300(ah) ? 0x16288 : \ - (((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x1628c : 0x16280))) -#define AR_CH0_TOP_XPABIASLVL (AR_SREV_9550(ah) ? 0x3c0 : 0x300) -#define AR_CH0_TOP_XPABIASLVL_S (AR_SREV_9550(ah) ? 6 : 8) - -#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 : \ - ((AR_SREV_9485(ah) ? 0x1628c : 0x16294))) -#define AR_CH0_THERM_XPABIASLVL_MSB 0x3 -#define AR_CH0_THERM_XPABIASLVL_MSB_S 0 -#define AR_CH0_THERM_XPASHORT2GND 0x4 -#define AR_CH0_THERM_XPASHORT2GND_S 2 - -#define AR_SWITCH_TABLE_COM_ALL (0xffff) -#define AR_SWITCH_TABLE_COM_ALL_S (0) -#define AR_SWITCH_TABLE_COM_AR9462_ALL (0xffffff) -#define AR_SWITCH_TABLE_COM_AR9462_ALL_S (0) -#define AR_SWITCH_TABLE_COM_AR9550_ALL (0xffffff) -#define AR_SWITCH_TABLE_COM_AR9550_ALL_S (0) -#define AR_SWITCH_TABLE_COM_SPDT (0x00f00000) -#define AR_SWITCH_TABLE_COM_SPDT_ALL (0x0000fff0) -#define AR_SWITCH_TABLE_COM_SPDT_ALL_S (4) - -#define AR_SWITCH_TABLE_COM2_ALL (0xffffff) -#define AR_SWITCH_TABLE_COM2_ALL_S (0) - -#define AR_SWITCH_TABLE_ALL (0xfff) -#define AR_SWITCH_TABLE_ALL_S (0) - -#define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\ - ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c)) - -#define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000 -#define AR_PHY_65NM_CH0_THERM_LOCAL_S 31 -#define AR_PHY_65NM_CH0_THERM_START 0x20000000 -#define AR_PHY_65NM_CH0_THERM_START_S 29 -#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT 0x0000ff00 -#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT_S 8 - -#define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \ - (AR_SREV_9462(ah) ? 0x16290 : 0x16284)) -#define AR_CH0_TOP2_XPABIASLVL 0xf000 -#define AR_CH0_TOP2_XPABIASLVL_S 12 - -#define AR_CH0_XTAL (AR_SREV_9300(ah) ? 0x16294 : \ - ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16298 : 0x16290)) -#define AR_CH0_XTAL_CAPINDAC 0x7f000000 -#define AR_CH0_XTAL_CAPINDAC_S 24 -#define AR_CH0_XTAL_CAPOUTDAC 0x00fe0000 -#define AR_CH0_XTAL_CAPOUTDAC_S 17 - -#define AR_PHY_PMU1 ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16340 : 0x16c40) -#define AR_PHY_PMU1_PWD 0x1 -#define AR_PHY_PMU1_PWD_S 0 - -#define AR_PHY_PMU2 ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16344 : 0x16c44) -#define AR_PHY_PMU2_PGM 0x00200000 -#define AR_PHY_PMU2_PGM_S 21 - -#define AR_PHY_RX1DB_BIQUAD_LONG_SHIFT 0x00380000 -#define AR_PHY_RX1DB_BIQUAD_LONG_SHIFT_S 19 -#define AR_PHY_RX6DB_BIQUAD_LONG_SHIFT 0x00c00000 -#define AR_PHY_RX6DB_BIQUAD_LONG_SHIFT_S 22 -#define AR_PHY_LNAGAIN_LONG_SHIFT 0xe0000000 -#define AR_PHY_LNAGAIN_LONG_SHIFT_S 29 -#define AR_PHY_MXRGAIN_LONG_SHIFT 0x03000000 -#define AR_PHY_MXRGAIN_LONG_SHIFT_S 24 -#define AR_PHY_VGAGAIN_LONG_SHIFT 0x1c000000 -#define AR_PHY_VGAGAIN_LONG_SHIFT_S 26 -#define AR_PHY_SCFIR_GAIN_LONG_SHIFT 0x00000001 -#define AR_PHY_SCFIR_GAIN_LONG_SHIFT_S 0 -#define AR_PHY_MANRXGAIN_LONG_SHIFT 0x00000002 -#define AR_PHY_MANRXGAIN_LONG_SHIFT_S 1 - -/* - * SM Field Definitions - */ -#define AR_PHY_CL_CAL_ENABLE 0x00000002 -#define AR_PHY_PARALLEL_CAL_ENABLE 0x00000001 -#define AR_PHY_TPCRG1_PD_CAL_ENABLE 0x00400000 -#define AR_PHY_TPCRG1_PD_CAL_ENABLE_S 22 - -#define AR_PHY_ADDAC_PARACTL_OFF_PWDADC 0x00008000 - -#define AR_PHY_FCAL20_CAP_STATUS_0 0x01f00000 -#define AR_PHY_FCAL20_CAP_STATUS_0_S 20 - -#define AR_PHY_RFBUS_REQ_EN 0x00000001 /* request for RF bus */ -#define AR_PHY_RFBUS_GRANT_EN 0x00000001 /* RF bus granted */ -#define AR_PHY_GC_TURBO_MODE 0x00000001 /* set turbo mode bits */ -#define AR_PHY_GC_TURBO_SHORT 0x00000002 /* set short symbols to turbo mode setting */ -#define AR_PHY_GC_DYN2040_EN 0x00000004 /* enable dyn 20/40 mode */ -#define AR_PHY_GC_DYN2040_PRI_ONLY 0x00000008 /* dyn 20/40 - primary only */ -#define AR_PHY_GC_DYN2040_PRI_CH 0x00000010 /* dyn 20/40 - primary ch offset (0=+10MHz, 1=-10MHz)*/ -#define AR_PHY_GC_DYN2040_PRI_CH_S 4 -#define AR_PHY_GC_DYN2040_EXT_CH 0x00000020 /* dyn 20/40 - ext ch spacing (0=20MHz/ 1=25MHz) */ -#define AR_PHY_GC_HT_EN 0x00000040 /* ht enable */ -#define AR_PHY_GC_SHORT_GI_40 0x00000080 /* allow short GI for HT 40 */ -#define AR_PHY_GC_WALSH 0x00000100 /* walsh spatial spreading for 2 chains,2 streams TX */ -#define AR_PHY_GC_SINGLE_HT_LTF1 0x00000200 /* single length (4us) 1st HT long training symbol */ -#define AR_PHY_GC_GF_DETECT_EN 0x00000400 /* enable Green Field detection. Only affects rx, not tx */ -#define AR_PHY_GC_ENABLE_DAC_FIFO 0x00000800 /* fifo between bb and dac */ -#define AR_PHY_RX_DELAY_DELAY 0x00003FFF /* delay from wakeup to rx ena */ - -#define AR_PHY_CALMODE_IQ 0x00000000 -#define AR_PHY_CALMODE_ADC_GAIN 0x00000001 -#define AR_PHY_CALMODE_ADC_DC_PER 0x00000002 -#define AR_PHY_CALMODE_ADC_DC_INIT 0x00000003 -#define AR_PHY_SWAP_ALT_CHAIN 0x00000040 -#define AR_PHY_MODE_OFDM 0x00000000 -#define AR_PHY_MODE_CCK 0x00000001 -#define AR_PHY_MODE_DYNAMIC 0x00000004 -#define AR_PHY_MODE_DYNAMIC_S 2 -#define AR_PHY_MODE_HALF 0x00000020 -#define AR_PHY_MODE_QUARTER 0x00000040 -#define AR_PHY_MAC_CLK_MODE 0x00000080 -#define AR_PHY_MODE_DYN_CCK_DISABLE 0x00000100 -#define AR_PHY_MODE_SVD_HALF 0x00000200 -#define AR_PHY_ACTIVE_EN 0x00000001 -#define AR_PHY_ACTIVE_DIS 0x00000000 -#define AR_PHY_FORCE_XPA_CFG 0x000000001 -#define AR_PHY_FORCE_XPA_CFG_S 0 -#define AR_PHY_XPA_TIMING_CTL_TX_END_XPAB_OFF 0xFF000000 -#define AR_PHY_XPA_TIMING_CTL_TX_END_XPAB_OFF_S 24 -#define AR_PHY_XPA_TIMING_CTL_TX_END_XPAA_OFF 0x00FF0000 -#define AR_PHY_XPA_TIMING_CTL_TX_END_XPAA_OFF_S 16 -#define AR_PHY_XPA_TIMING_CTL_FRAME_XPAB_ON 0x0000FF00 -#define AR_PHY_XPA_TIMING_CTL_FRAME_XPAB_ON_S 8 -#define AR_PHY_XPA_TIMING_CTL_FRAME_XPAA_ON 0x000000FF -#define AR_PHY_XPA_TIMING_CTL_FRAME_XPAA_ON_S 0 -#define AR_PHY_TX_END_TO_A2_RX_ON 0x00FF0000 -#define AR_PHY_TX_END_TO_A2_RX_ON_S 16 -#define AR_PHY_TX_END_DATA_START 0x000000FF -#define AR_PHY_TX_END_DATA_START_S 0 -#define AR_PHY_TX_END_PA_ON 0x0000FF00 -#define AR_PHY_TX_END_PA_ON_S 8 -#define AR_PHY_TPCRG5_PD_GAIN_OVERLAP 0x0000000F -#define AR_PHY_TPCRG5_PD_GAIN_OVERLAP_S 0 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1 0x000003F0 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1_S 4 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2 0x0000FC00 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2_S 10 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3 0x003F0000 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3_S 16 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4 0x0FC00000 -#define AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4_S 22 -#define AR_PHY_TPCRG1_NUM_PD_GAIN 0x0000c000 -#define AR_PHY_TPCRG1_NUM_PD_GAIN_S 14 -#define AR_PHY_TPCRG1_PD_GAIN_1 0x00030000 -#define AR_PHY_TPCRG1_PD_GAIN_1_S 16 -#define AR_PHY_TPCRG1_PD_GAIN_2 0x000C0000 -#define AR_PHY_TPCRG1_PD_GAIN_2_S 18 -#define AR_PHY_TPCRG1_PD_GAIN_3 0x00300000 -#define AR_PHY_TPCRG1_PD_GAIN_3_S 20 -#define AR_PHY_TPCGR1_FORCED_DAC_GAIN 0x0000003e -#define AR_PHY_TPCGR1_FORCED_DAC_GAIN_S 1 -#define AR_PHY_TPCGR1_FORCE_DAC_GAIN 0x00000001 -#define AR_PHY_TXGAIN_FORCE 0x00000001 -#define AR_PHY_TXGAIN_FORCE_S 0 -#define AR_PHY_TXGAIN_FORCED_PADVGNRA 0x00003c00 -#define AR_PHY_TXGAIN_FORCED_PADVGNRA_S 10 -#define AR_PHY_TXGAIN_FORCED_PADVGNRB 0x0003c000 -#define AR_PHY_TXGAIN_FORCED_PADVGNRB_S 14 -#define AR_PHY_TXGAIN_FORCED_PADVGNRD 0x00c00000 -#define AR_PHY_TXGAIN_FORCED_PADVGNRD_S 22 -#define AR_PHY_TXGAIN_FORCED_TXMXRGAIN 0x000003c0 -#define AR_PHY_TXGAIN_FORCED_TXMXRGAIN_S 6 -#define AR_PHY_TXGAIN_FORCED_TXBB1DBGAIN 0x0000000e -#define AR_PHY_TXGAIN_FORCED_TXBB1DBGAIN_S 1 - -#define AR_PHY_POWER_TX_RATE1 0x9934 -#define AR_PHY_POWER_TX_RATE2 0x9938 -#define AR_PHY_POWER_TX_RATE_MAX 0x993c -#define AR_PHY_POWER_TX_RATE_MAX_TPC_ENABLE 0x00000040 -#define PHY_AGC_CLR 0x10000000 -#define RFSILENT_BB 0x00002000 -#define AR_PHY_CHAN_INFO_GAIN_DIFF_PPM_MASK 0xFFF -#define AR_PHY_CHAN_INFO_GAIN_DIFF_PPM_SIGNED_BIT 0x800 -#define AR_PHY_CHAN_INFO_GAIN_DIFF_UPPER_LIMIT 320 -#define AR_PHY_CHAN_INFO_MEMORY_CAPTURE_MASK 0x0001 -#define AR_PHY_RX_DELAY_DELAY 0x00003FFF -#define AR_PHY_CCK_TX_CTRL_JAPAN 0x00000010 - -#define AR_PHY_SPECTRAL_SCAN_ENABLE 0x00000001 -#define AR_PHY_SPECTRAL_SCAN_ENABLE_S 0 -#define AR_PHY_SPECTRAL_SCAN_ACTIVE 0x00000002 -#define AR_PHY_SPECTRAL_SCAN_ACTIVE_S 1 -#define AR_PHY_SPECTRAL_SCAN_FFT_PERIOD 0x000000F0 -#define AR_PHY_SPECTRAL_SCAN_FFT_PERIOD_S 4 -#define AR_PHY_SPECTRAL_SCAN_PERIOD 0x0000FF00 -#define AR_PHY_SPECTRAL_SCAN_PERIOD_S 8 -#define AR_PHY_SPECTRAL_SCAN_COUNT 0x0FFF0000 -#define AR_PHY_SPECTRAL_SCAN_COUNT_S 16 -#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x10000000 -#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 28 -#define AR_PHY_SPECTRAL_SCAN_PRIORITY 0x20000000 -#define AR_PHY_SPECTRAL_SCAN_PRIORITY_S 29 -#define AR_PHY_SPECTRAL_SCAN_USE_ERR5 0x40000000 -#define AR_PHY_SPECTRAL_SCAN_USE_ERR5_S 30 -#define AR_PHY_SPECTRAL_SCAN_COMPRESSED_RPT 0x80000000 -#define AR_PHY_SPECTRAL_SCAN_COMPRESSED_RPT_S 31 - -#define AR_PHY_CHANNEL_STATUS_RX_CLEAR 0x00000004 -#define AR_PHY_RTT_CTRL_ENA_RADIO_RETENTION 0x00000001 -#define AR_PHY_RTT_CTRL_ENA_RADIO_RETENTION_S 0 -#define AR_PHY_RTT_CTRL_RESTORE_MASK 0x0000007E -#define AR_PHY_RTT_CTRL_RESTORE_MASK_S 1 -#define AR_PHY_RTT_CTRL_FORCE_RADIO_RESTORE 0x00000080 -#define AR_PHY_RTT_CTRL_FORCE_RADIO_RESTORE_S 7 -#define AR_PHY_RTT_SW_RTT_TABLE_ACCESS 0x00000001 -#define AR_PHY_RTT_SW_RTT_TABLE_ACCESS_S 0 -#define AR_PHY_RTT_SW_RTT_TABLE_WRITE 0x00000002 -#define AR_PHY_RTT_SW_RTT_TABLE_WRITE_S 1 -#define AR_PHY_RTT_SW_RTT_TABLE_ADDR 0x0000001C -#define AR_PHY_RTT_SW_RTT_TABLE_ADDR_S 2 -#define AR_PHY_RTT_SW_RTT_TABLE_DATA 0xFFFFFFF0 -#define AR_PHY_RTT_SW_RTT_TABLE_DATA_S 4 -#define AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL 0x80000000 -#define AR_PHY_TX_IQCAL_CONTROL_0_ENABLE_TXIQ_CAL_S 31 -#define AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT 0x01fc0000 -#define AR_PHY_TX_IQCAL_CONTROL_1_IQCORR_I_Q_COFF_DELPT_S 18 -#define AR_PHY_TX_IQCAL_START_DO_CAL 0x00000001 -#define AR_PHY_TX_IQCAL_START_DO_CAL_S 0 - -#define AR_PHY_TX_IQCAL_STATUS_FAILED 0x00000001 -#define AR_PHY_CALIBRATED_GAINS_0 0x3e -#define AR_PHY_CALIBRATED_GAINS_0_S 1 - -#define AR_PHY_TX_IQCAL_CORR_COEFF_00_COEFF_TABLE 0x00003fff -#define AR_PHY_TX_IQCAL_CORR_COEFF_00_COEFF_TABLE_S 0 -#define AR_PHY_TX_IQCAL_CORR_COEFF_01_COEFF_TABLE 0x0fffc000 -#define AR_PHY_TX_IQCAL_CORR_COEFF_01_COEFF_TABLE_S 14 - -#define AR_PHY_65NM_CH0_RXTX4_THERM_ON 0x10000000 -#define AR_PHY_65NM_CH0_RXTX4_THERM_ON_S 28 -#define AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR 0x20000000 -#define AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR_S 29 - -#define AR_PHY_65NM_RXTX4_XLNA_BIAS 0xC0000000 -#define AR_PHY_65NM_RXTX4_XLNA_BIAS_S 30 - -/* - * Channel 1 Register Map - */ -#define AR_CHAN1_BASE 0xa800 - -#define AR_PHY_EXT_CCA_1 (AR_CHAN1_BASE + 0x30) -#define AR_PHY_TX_PHASE_RAMP_1 (AR_CHAN1_BASE + 0xd0) -#define AR_PHY_ADC_GAIN_DC_CORR_1 (AR_CHAN1_BASE + 0xd4) - -#define AR_PHY_SPUR_REPORT_1 (AR_CHAN1_BASE + 0xa8) -#define AR_PHY_CHAN_INFO_TAB_1 (AR_CHAN1_BASE + 0x300) -#define AR_PHY_RX_IQCAL_CORR_B1 (AR_CHAN1_BASE + 0xdc) - -/* - * Channel 1 Field Definitions - */ -#define AR_PHY_CH1_EXT_MINCCA_PWR 0x01FF0000 -#define AR_PHY_CH1_EXT_MINCCA_PWR_S 16 - -/* - * AGC 1 Register Map - */ -#define AR_AGC1_BASE 0xae00 - -#define AR_PHY_FORCEMAX_GAINS_1 (AR_AGC1_BASE + 0x4) -#define AR_PHY_EXT_ATTEN_CTL_1 (AR_AGC1_BASE + 0x18) -#define AR_PHY_CCA_1 (AR_AGC1_BASE + 0x1c) -#define AR_PHY_CCA_CTRL_1 (AR_AGC1_BASE + 0x20) -#define AR_PHY_RSSI_1 (AR_AGC1_BASE + 0x180) -#define AR_PHY_SPUR_CCK_REP_1 (AR_AGC1_BASE + 0x184) -#define AR_PHY_RX_OCGAIN_2 (AR_AGC1_BASE + 0x200) - -/* - * AGC 1 Field Definitions - */ -#define AR_PHY_CH1_MINCCA_PWR 0x1FF00000 -#define AR_PHY_CH1_MINCCA_PWR_S 20 - -/* - * SM 1 Register Map - */ -#define AR_SM1_BASE 0xb200 - -#define AR_PHY_SWITCH_CHAIN_1 (AR_SM1_BASE + 0x84) -#define AR_PHY_FCAL_2_1 (AR_SM1_BASE + 0xd0) -#define AR_PHY_DFT_TONE_CTL_1 (AR_SM1_BASE + 0xd4) -#define AR_PHY_CL_TAB_1 (AR_SM1_BASE + 0x100) -#define AR_PHY_CHAN_INFO_GAIN_1 (AR_SM1_BASE + 0x180) -#define AR_PHY_TPC_4_B1 (AR_SM1_BASE + 0x204) -#define AR_PHY_TPC_5_B1 (AR_SM1_BASE + 0x208) -#define AR_PHY_TPC_6_B1 (AR_SM1_BASE + 0x20c) -#define AR_PHY_TPC_11_B1 (AR_SM1_BASE + 0x220) -#define AR_PHY_PDADC_TAB_1 (AR_SM1_BASE + (AR_SREV_AR9462(ah) ? \ - 0x280 : 0x240)) -#define AR_PHY_TPC_19_B1 (AR_SM1_BASE + 0x240) -#define AR_PHY_TPC_19_B1_ALPHA_THERM 0xff -#define AR_PHY_TPC_19_B1_ALPHA_THERM_S 0 -#define AR_PHY_TX_IQCAL_STATUS_B1 (AR_SM1_BASE + 0x48c) -#define AR_PHY_TX_IQCAL_CORR_COEFF_B1(_i) (AR_SM1_BASE + 0x450 + ((_i) << 2)) - -/* SM 1 AIC Registers */ - -#define AR_PHY_AIC_CTRL_0_B1 (AR_SM1_BASE + 0x4b0) -#define AR_PHY_AIC_CTRL_1_B1 (AR_SM1_BASE + 0x4b4) -#define AR_PHY_AIC_CTRL_2_B1 (AR_SM1_BASE + 0x4b8) -#define AR_PHY_AIC_STAT_0_B1 (AR_SM1_BASE + (AR_SREV_9462_10(ah) ? \ - 0x4c0 : 0x4c4)) -#define AR_PHY_AIC_STAT_1_B1 (AR_SM1_BASE + (AR_SREV_9462_10(ah) ? \ - 0x4c4 : 0x4c8)) -#define AR_PHY_AIC_CTRL_4_B1 (AR_SM1_BASE + 0x4c0) -#define AR_PHY_AIC_STAT_2_B1 (AR_SM1_BASE + 0x4cc) - -#define AR_PHY_AIC_SRAM_ADDR_B1 (AR_SM1_BASE + 0x5f0) -#define AR_PHY_AIC_SRAM_DATA_B1 (AR_SM1_BASE + 0x5f4) - -#define AR_PHY_RTT_TABLE_SW_INTF_B(i) (0x384 + ((i) ? \ - AR_SM1_BASE : AR_SM_BASE)) -#define AR_PHY_RTT_TABLE_SW_INTF_1_B(i) (0x388 + ((i) ? \ - AR_SM1_BASE : AR_SM_BASE)) -/* - * Channel 2 Register Map - */ -#define AR_CHAN2_BASE 0xb800 - -#define AR_PHY_EXT_CCA_2 (AR_CHAN2_BASE + 0x30) -#define AR_PHY_TX_PHASE_RAMP_2 (AR_CHAN2_BASE + 0xd0) -#define AR_PHY_ADC_GAIN_DC_CORR_2 (AR_CHAN2_BASE + 0xd4) - -#define AR_PHY_SPUR_REPORT_2 (AR_CHAN2_BASE + 0xa8) -#define AR_PHY_CHAN_INFO_TAB_2 (AR_CHAN2_BASE + 0x300) -#define AR_PHY_RX_IQCAL_CORR_B2 (AR_CHAN2_BASE + 0xdc) - -/* - * Channel 2 Field Definitions - */ -#define AR_PHY_CH2_EXT_MINCCA_PWR 0x01FF0000 -#define AR_PHY_CH2_EXT_MINCCA_PWR_S 16 -/* - * AGC 2 Register Map - */ -#define AR_AGC2_BASE 0xbe00 - -#define AR_PHY_FORCEMAX_GAINS_2 (AR_AGC2_BASE + 0x4) -#define AR_PHY_EXT_ATTEN_CTL_2 (AR_AGC2_BASE + 0x18) -#define AR_PHY_CCA_2 (AR_AGC2_BASE + 0x1c) -#define AR_PHY_CCA_CTRL_2 (AR_AGC2_BASE + 0x20) -#define AR_PHY_RSSI_2 (AR_AGC2_BASE + 0x180) - -/* - * AGC 2 Field Definitions - */ -#define AR_PHY_CH2_MINCCA_PWR 0x1FF00000 -#define AR_PHY_CH2_MINCCA_PWR_S 20 - -/* - * SM 2 Register Map - */ -#define AR_SM2_BASE 0xc200 - -#define AR_PHY_SWITCH_CHAIN_2 (AR_SM2_BASE + 0x84) -#define AR_PHY_FCAL_2_2 (AR_SM2_BASE + 0xd0) -#define AR_PHY_DFT_TONE_CTL_2 (AR_SM2_BASE + 0xd4) -#define AR_PHY_CL_TAB_2 (AR_SM2_BASE + 0x100) -#define AR_PHY_CHAN_INFO_GAIN_2 (AR_SM2_BASE + 0x180) -#define AR_PHY_TPC_4_B2 (AR_SM2_BASE + 0x204) -#define AR_PHY_TPC_5_B2 (AR_SM2_BASE + 0x208) -#define AR_PHY_TPC_6_B2 (AR_SM2_BASE + 0x20c) -#define AR_PHY_TPC_11_B2 (AR_SM2_BASE + 0x220) -#define AR_PHY_TPC_19_B2 (AR_SM2_BASE + 0x240) -#define AR_PHY_TX_IQCAL_STATUS_B2 (AR_SM2_BASE + 0x48c) -#define AR_PHY_TX_IQCAL_CORR_COEFF_B2(_i) (AR_SM2_BASE + 0x450 + ((_i) << 2)) - -#define AR_PHY_TX_IQCAL_STATUS_B2_FAILED 0x00000001 - -/* - * AGC 3 Register Map - */ -#define AR_AGC3_BASE 0xce00 - -#define AR_PHY_RSSI_3 (AR_AGC3_BASE + 0x180) - -/* GLB Registers */ -#define AR_GLB_BASE 0x20000 -#define AR_GLB_GPIO_CONTROL (AR_GLB_BASE) -#define AR_PHY_GLB_CONTROL (AR_GLB_BASE + 0x44) -#define AR_GLB_SCRATCH(_ah) (AR_GLB_BASE + \ - (AR_SREV_9462_20(_ah) ? 0x4c : 0x50)) -#define AR_GLB_STATUS (AR_GLB_BASE + 0x48) - -/* - * Misc helper defines - */ -#define AR_PHY_CHAIN_OFFSET (AR_CHAN1_BASE - AR_CHAN_BASE) - -#define AR_PHY_NEW_ADC_DC_GAIN_CORR(_i) (AR_PHY_ADC_GAIN_DC_CORR_0 + (AR_PHY_CHAIN_OFFSET * (_i))) -#define AR_PHY_NEW_ADC_DC_GAIN_CORR_9300_10(_i) (AR_PHY_ADC_GAIN_DC_CORR_0_9300_10 + (AR_PHY_CHAIN_OFFSET * (_i))) -#define AR_PHY_SWITCH_CHAIN(_i) (AR_PHY_SWITCH_CHAIN_0 + (AR_PHY_CHAIN_OFFSET * (_i))) -#define AR_PHY_EXT_ATTEN_CTL(_i) (AR_PHY_EXT_ATTEN_CTL_0 + (AR_PHY_CHAIN_OFFSET * (_i))) - -#define AR_PHY_RXGAIN(_i) (AR_PHY_FORCEMAX_GAINS_0 + (AR_PHY_CHAIN_OFFSET * (_i))) -#define AR_PHY_TPCRG5(_i) (AR_PHY_TPC_5_B0 + (AR_PHY_CHAIN_OFFSET * (_i))) -#define AR_PHY_PDADC_TAB(_i) (AR_PHY_PDADC_TAB_0 + (AR_PHY_CHAIN_OFFSET * (_i))) - -#define AR_PHY_CAL_MEAS_0(_i) (AR_PHY_IQ_ADC_MEAS_0_B0 + (AR_PHY_CHAIN_OFFSET * (_i))) -#define AR_PHY_CAL_MEAS_1(_i) (AR_PHY_IQ_ADC_MEAS_1_B0 + (AR_PHY_CHAIN_OFFSET * (_i))) -#define AR_PHY_CAL_MEAS_2(_i) (AR_PHY_IQ_ADC_MEAS_2_B0 + (AR_PHY_CHAIN_OFFSET * (_i))) -#define AR_PHY_CAL_MEAS_3(_i) (AR_PHY_IQ_ADC_MEAS_3_B0 + (AR_PHY_CHAIN_OFFSET * (_i))) -#define AR_PHY_CAL_MEAS_0_9300_10(_i) (AR_PHY_IQ_ADC_MEAS_0_B0_9300_10 + (AR_PHY_CHAIN_OFFSET * (_i))) -#define AR_PHY_CAL_MEAS_1_9300_10(_i) (AR_PHY_IQ_ADC_MEAS_1_B0_9300_10 + (AR_PHY_CHAIN_OFFSET * (_i))) -#define AR_PHY_CAL_MEAS_2_9300_10(_i) (AR_PHY_IQ_ADC_MEAS_2_B0_9300_10 + (AR_PHY_CHAIN_OFFSET * (_i))) -#define AR_PHY_CAL_MEAS_3_9300_10(_i) (AR_PHY_IQ_ADC_MEAS_3_B0_9300_10 + (AR_PHY_CHAIN_OFFSET * (_i))) - -#define AR_PHY_WATCHDOG_NON_IDLE_ENABLE 0x00000001 -#define AR_PHY_WATCHDOG_IDLE_ENABLE 0x00000002 -#define AR_PHY_WATCHDOG_IDLE_MASK 0xFFFF0000 -#define AR_PHY_WATCHDOG_NON_IDLE_MASK 0x0000FFFC - -#define AR_PHY_WATCHDOG_RST_ENABLE 0x00000002 -#define AR_PHY_WATCHDOG_IRQ_ENABLE 0x00000004 -#define AR_PHY_WATCHDOG_CNTL2_MASK 0xFFFFFFF9 - -#define AR_PHY_WATCHDOG_INFO 0x00000007 -#define AR_PHY_WATCHDOG_INFO_S 0 -#define AR_PHY_WATCHDOG_DET_HANG 0x00000008 -#define AR_PHY_WATCHDOG_DET_HANG_S 3 -#define AR_PHY_WATCHDOG_RADAR_SM 0x000000F0 -#define AR_PHY_WATCHDOG_RADAR_SM_S 4 -#define AR_PHY_WATCHDOG_RX_OFDM_SM 0x00000F00 -#define AR_PHY_WATCHDOG_RX_OFDM_SM_S 8 -#define AR_PHY_WATCHDOG_RX_CCK_SM 0x0000F000 -#define AR_PHY_WATCHDOG_RX_CCK_SM_S 12 -#define AR_PHY_WATCHDOG_TX_OFDM_SM 0x000F0000 -#define AR_PHY_WATCHDOG_TX_OFDM_SM_S 16 -#define AR_PHY_WATCHDOG_TX_CCK_SM 0x00F00000 -#define AR_PHY_WATCHDOG_TX_CCK_SM_S 20 -#define AR_PHY_WATCHDOG_AGC_SM 0x0F000000 -#define AR_PHY_WATCHDOG_AGC_SM_S 24 -#define AR_PHY_WATCHDOG_SRCH_SM 0xF0000000 -#define AR_PHY_WATCHDOG_SRCH_SM_S 28 - -#define AR_PHY_WATCHDOG_STATUS_CLR 0x00000008 - -/* - * PAPRD registers - */ -#define AR_PHY_XPA_TIMING_CTL (AR_SM_BASE + 0x64) - -#define AR_PHY_PAPRD_AM2AM (AR_CHAN_BASE + 0xe4) -#define AR_PHY_PAPRD_AM2AM_MASK 0x01ffffff -#define AR_PHY_PAPRD_AM2AM_MASK_S 0 - -#define AR_PHY_PAPRD_AM2PM (AR_CHAN_BASE + 0xe8) -#define AR_PHY_PAPRD_AM2PM_MASK 0x01ffffff -#define AR_PHY_PAPRD_AM2PM_MASK_S 0 - -#define AR_PHY_PAPRD_HT40 (AR_CHAN_BASE + 0xec) -#define AR_PHY_PAPRD_HT40_MASK 0x01ffffff -#define AR_PHY_PAPRD_HT40_MASK_S 0 - -#define AR_PHY_PAPRD_CTRL0_B0 (AR_CHAN_BASE + 0xf0) -#define AR_PHY_PAPRD_CTRL0_B1 (AR_CHAN1_BASE + 0xf0) -#define AR_PHY_PAPRD_CTRL0_B2 (AR_CHAN2_BASE + 0xf0) -#define AR_PHY_PAPRD_CTRL0_PAPRD_ENABLE 0x00000001 -#define AR_PHY_PAPRD_CTRL0_PAPRD_ENABLE_S 0 -#define AR_PHY_PAPRD_CTRL0_USE_SINGLE_TABLE_MASK 0x00000002 -#define AR_PHY_PAPRD_CTRL0_USE_SINGLE_TABLE_MASK_S 1 -#define AR_PHY_PAPRD_CTRL0_PAPRD_MAG_THRSH 0xf8000000 -#define AR_PHY_PAPRD_CTRL0_PAPRD_MAG_THRSH_S 27 - -#define AR_PHY_PAPRD_CTRL1_B0 (AR_CHAN_BASE + 0xf4) -#define AR_PHY_PAPRD_CTRL1_B1 (AR_CHAN1_BASE + 0xf4) -#define AR_PHY_PAPRD_CTRL1_B2 (AR_CHAN2_BASE + 0xf4) -#define AR_PHY_PAPRD_CTRL1_ADAPTIVE_SCALING_ENA 0x00000001 -#define AR_PHY_PAPRD_CTRL1_ADAPTIVE_SCALING_ENA_S 0 -#define AR_PHY_PAPRD_CTRL1_ADAPTIVE_AM2AM_ENABLE 0x00000002 -#define AR_PHY_PAPRD_CTRL1_ADAPTIVE_AM2AM_ENABLE_S 1 -#define AR_PHY_PAPRD_CTRL1_ADAPTIVE_AM2PM_ENABLE 0x00000004 -#define AR_PHY_PAPRD_CTRL1_ADAPTIVE_AM2PM_ENABLE_S 2 -#define AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL 0x000001f8 -#define AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL_S 3 -#define AR_PHY_PAPRD_CTRL1_PA_GAIN_SCALE_FACT_MASK 0x0001fe00 -#define AR_PHY_PAPRD_CTRL1_PA_GAIN_SCALE_FACT_MASK_S 9 -#define AR_PHY_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACT 0x0ffe0000 -#define AR_PHY_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACT_S 17 - -#define AR_PHY_PAPRD_TRAINER_CNTL1 (AR_SM_BASE + (AR_SREV_9485(ah) ? 0x580 : 0x490)) - -#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE 0x00000001 -#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE_S 0 -#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING 0x0000007e -#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING_S 1 -#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE 0x00000100 -#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_IQCORR_ENABLE_S 8 -#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE 0x00000200 -#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_RX_BB_GAIN_FORCE_S 9 -#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE 0x00000400 -#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_TX_GAIN_FORCE_S 10 -#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE 0x00000800 -#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_ENABLE_S 11 -#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP 0x0003f000 -#define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_S 12 - -#define AR_PHY_PAPRD_TRAINER_CNTL2 (AR_SM_BASE + (AR_SREV_9485(ah) ? 0x584 : 0x494)) - -#define AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN 0xFFFFFFFF -#define AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_S 0 - -#define AR_PHY_PAPRD_TRAINER_CNTL3 (AR_SM_BASE + (AR_SREV_9485(ah) ? 0x588 : 0x498)) - -#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE 0x0000003f -#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_S 0 -#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP 0x00000fc0 -#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP_S 6 -#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL 0x0001f000 -#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL_S 12 -#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES 0x000e0000 -#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES_S 17 -#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN 0x00f00000 -#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_COARSE_CORR_LEN_S 20 -#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN 0x0f000000 -#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN_S 24 -#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE 0x20000000 -#define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_S 29 - -#define AR_PHY_PAPRD_TRAINER_CNTL4 (AR_SM_BASE + (AR_SREV_9485(ah) ? 0x58c : 0x49c)) - -#define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES 0x03ff0000 -#define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_S 16 -#define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA 0x0000f000 -#define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA_S 12 -#define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR 0x00000fff -#define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_MIN_CORR_S 0 - -#define AR_PHY_PAPRD_PRE_POST_SCALE_0_B0 (AR_CHAN_BASE + 0x100) -#define AR_PHY_PAPRD_PRE_POST_SCALE_1_B0 (AR_CHAN_BASE + 0x104) -#define AR_PHY_PAPRD_PRE_POST_SCALE_2_B0 (AR_CHAN_BASE + 0x108) -#define AR_PHY_PAPRD_PRE_POST_SCALE_3_B0 (AR_CHAN_BASE + 0x10c) -#define AR_PHY_PAPRD_PRE_POST_SCALE_4_B0 (AR_CHAN_BASE + 0x110) -#define AR_PHY_PAPRD_PRE_POST_SCALE_5_B0 (AR_CHAN_BASE + 0x114) -#define AR_PHY_PAPRD_PRE_POST_SCALE_6_B0 (AR_CHAN_BASE + 0x118) -#define AR_PHY_PAPRD_PRE_POST_SCALE_7_B0 (AR_CHAN_BASE + 0x11c) -#define AR_PHY_PAPRD_PRE_POST_SCALING 0x3FFFF -#define AR_PHY_PAPRD_PRE_POST_SCALING_S 0 - -#define AR_PHY_PAPRD_TRAINER_STAT1 (AR_SM_BASE + (AR_SREV_9485(ah) ? 0x590 : 0x4a0)) - -#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE 0x00000001 -#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_DONE_S 0 -#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_INCOMPLETE 0x00000002 -#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_INCOMPLETE_S 1 -#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_CORR_ERR 0x00000004 -#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_CORR_ERR_S 2 -#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_ACTIVE 0x00000008 -#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_TRAIN_ACTIVE_S 3 -#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_RX_GAIN_IDX 0x000001f0 -#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_RX_GAIN_IDX_S 4 -#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR 0x0001fe00 -#define AR_PHY_PAPRD_TRAINER_STAT1_PAPRD_AGC2_PWR_S 9 - -#define AR_PHY_PAPRD_TRAINER_STAT2 (AR_SM_BASE + (AR_SREV_9485(ah) ? 0x594 : 0x4a4)) - -#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL 0x0000ffff -#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_VAL_S 0 -#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_COARSE_IDX 0x001f0000 -#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_COARSE_IDX_S 16 -#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX 0x00600000 -#define AR_PHY_PAPRD_TRAINER_STAT2_PAPRD_FINE_IDX_S 21 - -#define AR_PHY_PAPRD_TRAINER_STAT3 (AR_SM_BASE + (AR_SREV_9485(ah) ? 0x598 : 0x4a8)) - -#define AR_PHY_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT 0x000fffff -#define AR_PHY_PAPRD_TRAINER_STAT3_PAPRD_TRAIN_SAMPLES_CNT_S 0 - -#define AR_PHY_PAPRD_MEM_TAB_B0 (AR_CHAN_BASE + 0x120) -#define AR_PHY_PAPRD_MEM_TAB_B1 (AR_CHAN1_BASE + 0x120) -#define AR_PHY_PAPRD_MEM_TAB_B2 (AR_CHAN2_BASE + 0x120) - -#define AR_PHY_PA_GAIN123_B0 (AR_CHAN_BASE + 0xf8) -#define AR_PHY_PA_GAIN123_B1 (AR_CHAN1_BASE + 0xf8) -#define AR_PHY_PA_GAIN123_B2 (AR_CHAN2_BASE + 0xf8) -#define AR_PHY_PA_GAIN123_PA_GAIN1 0x3FF -#define AR_PHY_PA_GAIN123_PA_GAIN1_S 0 - -#define AR_PHY_POWERTX_RATE5 (AR_SM_BASE + 0x1d0) -#define AR_PHY_POWERTX_RATE5_POWERTXHT20_0 0x3F -#define AR_PHY_POWERTX_RATE5_POWERTXHT20_0_S 0 - -#define AR_PHY_POWERTX_RATE6 (AR_SM_BASE + 0x1d4) -#define AR_PHY_POWERTX_RATE6_POWERTXHT20_5 0x3F00 -#define AR_PHY_POWERTX_RATE6_POWERTXHT20_5_S 8 - -#define AR_PHY_POWERTX_RATE8 (AR_SM_BASE + 0x1dc) -#define AR_PHY_POWERTX_RATE8_POWERTXHT40_5 0x3F00 -#define AR_PHY_POWERTX_RATE8_POWERTXHT40_5_S 8 - -#define AR_PHY_CL_TAB_CL_GAIN_MOD 0x1f -#define AR_PHY_CL_TAB_CL_GAIN_MOD_S 0 - -#define AR_BTCOEX_WL_LNADIV 0x1a64 -#define AR_BTCOEX_WL_LNADIV_PREDICTED_PERIOD 0x00003FFF -#define AR_BTCOEX_WL_LNADIV_PREDICTED_PERIOD_S 0 -#define AR_BTCOEX_WL_LNADIV_DPDT_IGNORE_PRIORITY 0x00004000 -#define AR_BTCOEX_WL_LNADIV_DPDT_IGNORE_PRIORITY_S 14 -#define AR_BTCOEX_WL_LNADIV_FORCE_ON 0x00008000 -#define AR_BTCOEX_WL_LNADIV_FORCE_ON_S 15 -#define AR_BTCOEX_WL_LNADIV_MODE_OPTION 0x00030000 -#define AR_BTCOEX_WL_LNADIV_MODE_OPTION_S 16 -#define AR_BTCOEX_WL_LNADIV_MODE 0x007c0000 -#define AR_BTCOEX_WL_LNADIV_MODE_S 18 -#define AR_BTCOEX_WL_LNADIV_ALLOWED_TX_ANTDIV_WL_TX_REQ 0x00800000 -#define AR_BTCOEX_WL_LNADIV_ALLOWED_TX_ANTDIV_WL_TX_REQ_S 23 -#define AR_BTCOEX_WL_LNADIV_DISABLE_TX_ANTDIV_ENABLE 0x01000000 -#define AR_BTCOEX_WL_LNADIV_DISABLE_TX_ANTDIV_ENABLE_S 24 -#define AR_BTCOEX_WL_LNADIV_CONTINUOUS_BT_ACTIVE_PROTECT 0x02000000 -#define AR_BTCOEX_WL_LNADIV_CONTINUOUS_BT_ACTIVE_PROTECT_S 25 -#define AR_BTCOEX_WL_LNADIV_BT_INACTIVE_THRESHOLD 0xFC000000 -#define AR_BTCOEX_WL_LNADIV_BT_INACTIVE_THRESHOLD_S 26 - -/* Manual Peak detector calibration */ -#define AR_PHY_65NM_BASE 0x16000 -#define AR_PHY_65NM_RXRF_GAINSTAGES(i) (AR_PHY_65NM_BASE + \ - (i * 0x400) + 0x8) -#define AR_PHY_65NM_RXRF_GAINSTAGES_RX_OVERRIDE 0x80000000 -#define AR_PHY_65NM_RXRF_GAINSTAGES_RX_OVERRIDE_S 31 -#define AR_PHY_65NM_RXRF_GAINSTAGES_LNAON_CALDC 0x00000002 -#define AR_PHY_65NM_RXRF_GAINSTAGES_LNAON_CALDC_S 1 -#define AR_PHY_65NM_RXRF_GAINSTAGES_LNA2G_GAIN_OVR 0x70000000 -#define AR_PHY_65NM_RXRF_GAINSTAGES_LNA2G_GAIN_OVR_S 28 -#define AR_PHY_65NM_RXRF_GAINSTAGES_LNA5G_GAIN_OVR 0x03800000 -#define AR_PHY_65NM_RXRF_GAINSTAGES_LNA5G_GAIN_OVR_S 23 - -#define AR_PHY_65NM_RXTX2(i) (AR_PHY_65NM_BASE + \ - (i * 0x400) + 0x104) -#define AR_PHY_65NM_RXTX2_RXON_OVR 0x00001000 -#define AR_PHY_65NM_RXTX2_RXON_OVR_S 12 -#define AR_PHY_65NM_RXTX2_RXON 0x00000800 -#define AR_PHY_65NM_RXTX2_RXON_S 11 - -#define AR_PHY_65NM_RXRF_AGC(i) (AR_PHY_65NM_BASE + \ - (i * 0x400) + 0xc) -#define AR_PHY_65NM_RXRF_AGC_AGC_OVERRIDE 0x80000000 -#define AR_PHY_65NM_RXRF_AGC_AGC_OVERRIDE_S 31 -#define AR_PHY_65NM_RXRF_AGC_AGC_ON_OVR 0x40000000 -#define AR_PHY_65NM_RXRF_AGC_AGC_ON_OVR_S 30 -#define AR_PHY_65NM_RXRF_AGC_AGC_CAL_OVR 0x20000000 -#define AR_PHY_65NM_RXRF_AGC_AGC_CAL_OVR_S 29 -#define AR_PHY_65NM_RXRF_AGC_AGC2G_DBDAC_OVR 0x1E000000 -#define AR_PHY_65NM_RXRF_AGC_AGC2G_DBDAC_OVR_S 25 -#define AR_PHY_65NM_RXRF_AGC_AGC5G_DBDAC_OVR 0x00078000 -#define AR_PHY_65NM_RXRF_AGC_AGC5G_DBDAC_OVR_S 15 -#define AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR 0x01F80000 -#define AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR_S 19 -#define AR_PHY_65NM_RXRF_AGC_AGC5G_CALDAC_OVR 0x00007e00 -#define AR_PHY_65NM_RXRF_AGC_AGC5G_CALDAC_OVR_S 9 -#define AR_PHY_65NM_RXRF_AGC_AGC_OUT 0x00000004 -#define AR_PHY_65NM_RXRF_AGC_AGC_OUT_S 2 - -#endif /* AR9003_PHY_H */ diff --git a/drivers/net/wireless/ath/ath9k/ar9003_rtt.c b/drivers/net/wireless/ath/ath9k/ar9003_rtt.c deleted file mode 100644 index 74de3539c2c8..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9003_rtt.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "hw.h" -#include "hw-ops.h" -#include "ar9003_phy.h" -#include "ar9003_rtt.h" - -#define RTT_RESTORE_TIMEOUT 1000 -#define RTT_ACCESS_TIMEOUT 100 -#define RTT_BAD_VALUE 0x0bad0bad - -/* - * RTT (Radio Retention Table) hardware implementation information - * - * There is an internal table (i.e. the rtt) for each chain (or bank). - * Each table contains 6 entries and each entry is corresponding to - * a specific calibration parameter as depicted below. - * 0~2 - DC offset DAC calibration: loop, low, high (offsetI/Q_...) - * 3 - Filter cal (filterfc) - * 4 - RX gain settings - * 5 - Peak detector offset calibration (agc_caldac) - */ - -void ar9003_hw_rtt_enable(struct ath_hw *ah) -{ - REG_WRITE(ah, AR_PHY_RTT_CTRL, 1); -} - -void ar9003_hw_rtt_disable(struct ath_hw *ah) -{ - REG_WRITE(ah, AR_PHY_RTT_CTRL, 0); -} - -void ar9003_hw_rtt_set_mask(struct ath_hw *ah, u32 rtt_mask) -{ - REG_RMW_FIELD(ah, AR_PHY_RTT_CTRL, - AR_PHY_RTT_CTRL_RESTORE_MASK, rtt_mask); -} - -bool ar9003_hw_rtt_force_restore(struct ath_hw *ah) -{ - if (!ath9k_hw_wait(ah, AR_PHY_RTT_CTRL, - AR_PHY_RTT_CTRL_FORCE_RADIO_RESTORE, - 0, RTT_RESTORE_TIMEOUT)) - return false; - - REG_RMW_FIELD(ah, AR_PHY_RTT_CTRL, - AR_PHY_RTT_CTRL_FORCE_RADIO_RESTORE, 1); - - if (!ath9k_hw_wait(ah, AR_PHY_RTT_CTRL, - AR_PHY_RTT_CTRL_FORCE_RADIO_RESTORE, - 0, RTT_RESTORE_TIMEOUT)) - return false; - - return true; -} - -static void ar9003_hw_rtt_load_hist_entry(struct ath_hw *ah, u8 chain, - u32 index, u32 data28) -{ - u32 val; - - val = SM(data28, AR_PHY_RTT_SW_RTT_TABLE_DATA); - REG_WRITE(ah, AR_PHY_RTT_TABLE_SW_INTF_1_B(chain), val); - - val = SM(0, AR_PHY_RTT_SW_RTT_TABLE_ACCESS) | - SM(1, AR_PHY_RTT_SW_RTT_TABLE_WRITE) | - SM(index, AR_PHY_RTT_SW_RTT_TABLE_ADDR); - REG_WRITE(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), val); - udelay(1); - - val |= SM(1, AR_PHY_RTT_SW_RTT_TABLE_ACCESS); - REG_WRITE(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), val); - udelay(1); - - if (!ath9k_hw_wait(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), - AR_PHY_RTT_SW_RTT_TABLE_ACCESS, 0, - RTT_ACCESS_TIMEOUT)) - return; - - val &= ~SM(1, AR_PHY_RTT_SW_RTT_TABLE_WRITE); - REG_WRITE(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), val); - udelay(1); - - ath9k_hw_wait(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), - AR_PHY_RTT_SW_RTT_TABLE_ACCESS, 0, - RTT_ACCESS_TIMEOUT); -} - -void ar9003_hw_rtt_load_hist(struct ath_hw *ah) -{ - int chain, i; - - for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { - if (!(ah->rxchainmask & (1 << chain))) - continue; - for (i = 0; i < MAX_RTT_TABLE_ENTRY; i++) { - ar9003_hw_rtt_load_hist_entry(ah, chain, i, - ah->caldata->rtt_table[chain][i]); - ath_dbg(ath9k_hw_common(ah), CALIBRATE, - "Load RTT value at idx %d, chain %d: 0x%x\n", - i, chain, ah->caldata->rtt_table[chain][i]); - } - } -} - -static int ar9003_hw_rtt_fill_hist_entry(struct ath_hw *ah, u8 chain, u32 index) -{ - u32 val; - - val = SM(0, AR_PHY_RTT_SW_RTT_TABLE_ACCESS) | - SM(0, AR_PHY_RTT_SW_RTT_TABLE_WRITE) | - SM(index, AR_PHY_RTT_SW_RTT_TABLE_ADDR); - - REG_WRITE(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), val); - udelay(1); - - val |= SM(1, AR_PHY_RTT_SW_RTT_TABLE_ACCESS); - REG_WRITE(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), val); - udelay(1); - - if (!ath9k_hw_wait(ah, AR_PHY_RTT_TABLE_SW_INTF_B(chain), - AR_PHY_RTT_SW_RTT_TABLE_ACCESS, 0, - RTT_ACCESS_TIMEOUT)) - return RTT_BAD_VALUE; - - val = MS(REG_READ(ah, AR_PHY_RTT_TABLE_SW_INTF_1_B(chain)), - AR_PHY_RTT_SW_RTT_TABLE_DATA); - - - return val; -} - -void ar9003_hw_rtt_fill_hist(struct ath_hw *ah) -{ - int chain, i; - - for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { - if (!(ah->rxchainmask & (1 << chain))) - continue; - for (i = 0; i < MAX_RTT_TABLE_ENTRY; i++) { - ah->caldata->rtt_table[chain][i] = - ar9003_hw_rtt_fill_hist_entry(ah, chain, i); - ath_dbg(ath9k_hw_common(ah), CALIBRATE, - "RTT value at idx %d, chain %d is: 0x%x\n", - i, chain, ah->caldata->rtt_table[chain][i]); - } - } - - ah->caldata->rtt_done = true; -} - -void ar9003_hw_rtt_clear_hist(struct ath_hw *ah) -{ - int chain, i; - - for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { - if (!(ah->rxchainmask & (1 << chain))) - continue; - for (i = 0; i < MAX_RTT_TABLE_ENTRY; i++) - ar9003_hw_rtt_load_hist_entry(ah, chain, i, 0); - } - - if (ah->caldata) - ah->caldata->rtt_done = false; -} - -bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan) -{ - bool restore; - - if (!ah->caldata) - return false; - - if (!ah->caldata->rtt_done) - return false; - - ar9003_hw_rtt_enable(ah); - ar9003_hw_rtt_set_mask(ah, 0x10); - - if (!ath9k_hw_rfbus_req(ah)) { - ath_err(ath9k_hw_common(ah), "Could not stop baseband\n"); - restore = false; - goto fail; - } - - ar9003_hw_rtt_load_hist(ah); - restore = ar9003_hw_rtt_force_restore(ah); - -fail: - ath9k_hw_rfbus_done(ah); - ar9003_hw_rtt_disable(ah); - return restore; -} diff --git a/drivers/net/wireless/ath/ath9k/ar9003_rtt.h b/drivers/net/wireless/ath/ath9k/ar9003_rtt.h deleted file mode 100644 index a43b30d723a4..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9003_rtt.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef AR9003_RTT_H -#define AR9003_RTT_H - -void ar9003_hw_rtt_enable(struct ath_hw *ah); -void ar9003_hw_rtt_disable(struct ath_hw *ah); -void ar9003_hw_rtt_set_mask(struct ath_hw *ah, u32 rtt_mask); -bool ar9003_hw_rtt_force_restore(struct ath_hw *ah); -void ar9003_hw_rtt_load_hist(struct ath_hw *ah); -void ar9003_hw_rtt_fill_hist(struct ath_hw *ah); -void ar9003_hw_rtt_clear_hist(struct ath_hw *ah); -bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan); - -#endif diff --git a/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h b/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h deleted file mode 100644 index 6e1756bc3833..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9330_1p1_initvals.h +++ /dev/null @@ -1,1100 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef INITVALS_9330_1P1_H -#define INITVALS_9330_1P1_H - -static const u32 ar9331_1p1_baseband_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8005}, - {0x00009820, 0x206a002e, 0x206a002e, 0x206a002e, 0x206a002e}, - {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, - {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, - {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, - {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c}, - {0x00009c00, 0x00000044, 0x00000044, 0x00000044, 0x00000044}, - {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a4, 0x037216a4}, - {0x00009e04, 0x00202020, 0x00202020, 0x00202020, 0x00202020}, - {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, - {0x00009e10, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e}, - {0x00009e14, 0x31365d5e, 0x3136605e, 0x3136605e, 0x31365d5e}, - {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, - {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, - {0x00009e2c, 0x0000001c, 0x0000001c, 0x00003221, 0x00003221}, - {0x00009e3c, 0xcf946222, 0xcf946222, 0xcf946222, 0xcf946222}, - {0x00009e44, 0x02321e27, 0x02321e27, 0x02282324, 0x02282324}, - {0x00009e48, 0x5030201a, 0x5030201a, 0x50302010, 0x50302010}, - {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, - {0x0000a204, 0x00003fc0, 0x00003fc4, 0x00003fc4, 0x00003fc0}, - {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, - {0x0000a230, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b}, - {0x0000a234, 0x00000fff, 0x00000fff, 0x10000fff, 0x00000fff}, - {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018}, - {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002}, - {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, - {0x0000a260, 0x3a021501, 0x3a021501, 0x3a021501, 0x3a021501}, - {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b}, - {0x0000a284, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, - {0x0000a2d0, 0x00071982, 0x00071982, 0x00071982, 0x00071982}, - {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, - {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000ae04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, - {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, -}; - -static const u32 ar9331_modes_lowest_ob_db_tx_gain_1p1[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a}, - {0x0000a2dc, 0xffff2a52, 0xffff2a52, 0xffff2a52, 0xffff2a52}, - {0x0000a2e0, 0xffffcc84, 0xffffcc84, 0xffffcc84, 0xffffcc84}, - {0x0000a2e4, 0xfffff000, 0xfffff000, 0xfffff000, 0xfffff000}, - {0x0000a2e8, 0xfffe0000, 0xfffe0000, 0xfffe0000, 0xfffe0000}, - {0x0000a410, 0x000050d7, 0x000050d7, 0x000050d0, 0x000050d0}, - {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, - {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, - {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, - {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, - {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, - {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, - {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, - {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, - {0x0000a520, 0x2f001f04, 0x2f001f04, 0x23000a00, 0x23000a00}, - {0x0000a524, 0x35001fc4, 0x35001fc4, 0x27000a02, 0x27000a02}, - {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2b000a04, 0x2b000a04}, - {0x0000a52c, 0x41023e85, 0x41023e85, 0x2d000a20, 0x2d000a20}, - {0x0000a530, 0x48023ec6, 0x48023ec6, 0x31000a22, 0x31000a22}, - {0x0000a534, 0x4d023f01, 0x4d023f01, 0x35000a24, 0x35000a24}, - {0x0000a538, 0x53023f4b, 0x53023f4b, 0x38000a43, 0x38000a43}, - {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x3b000e42, 0x3b000e42}, - {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x3f000e44, 0x3f000e44}, - {0x0000a544, 0x6502feca, 0x6502feca, 0x42000e64, 0x42000e64}, - {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x46000e66, 0x46000e66}, - {0x0000a54c, 0x7203feca, 0x7203feca, 0x4a000ea6, 0x4a000ea6}, - {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x4a000ea6, 0x4a000ea6}, - {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x4a000ea6, 0x4a000ea6}, - {0x0000a560, 0x900fff0b, 0x900fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a564, 0x960fffcb, 0x960fffcb, 0x4a000ea6, 0x4a000ea6}, - {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a580, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, - {0x0000a584, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, - {0x0000a588, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, - {0x0000a58c, 0x11062202, 0x11062202, 0x0b000200, 0x0b000200}, - {0x0000a590, 0x17022e00, 0x17022e00, 0x0f000202, 0x0f000202}, - {0x0000a594, 0x1d000ec2, 0x1d000ec2, 0x11000400, 0x11000400}, - {0x0000a598, 0x25020ec0, 0x25020ec0, 0x15000402, 0x15000402}, - {0x0000a59c, 0x2b020ec3, 0x2b020ec3, 0x19000404, 0x19000404}, - {0x0000a5a0, 0x2f001f04, 0x2f001f04, 0x1b000603, 0x1b000603}, - {0x0000a5a4, 0x35001fc4, 0x35001fc4, 0x1f000a02, 0x1f000a02}, - {0x0000a5a8, 0x3c022f04, 0x3c022f04, 0x23000a04, 0x23000a04}, - {0x0000a5ac, 0x41023e85, 0x41023e85, 0x26000a20, 0x26000a20}, - {0x0000a5b0, 0x48023ec6, 0x48023ec6, 0x2a000e20, 0x2a000e20}, - {0x0000a5b4, 0x4d023f01, 0x4d023f01, 0x2e000e22, 0x2e000e22}, - {0x0000a5b8, 0x53023f4b, 0x53023f4b, 0x31000e24, 0x31000e24}, - {0x0000a5bc, 0x5a027f09, 0x5a027f09, 0x34001640, 0x34001640}, - {0x0000a5c0, 0x5f027fc9, 0x5f027fc9, 0x38001660, 0x38001660}, - {0x0000a5c4, 0x6502feca, 0x6502feca, 0x3b001861, 0x3b001861}, - {0x0000a5c8, 0x6b02ff4a, 0x6b02ff4a, 0x3e001a81, 0x3e001a81}, - {0x0000a5cc, 0x7203feca, 0x7203feca, 0x42001a83, 0x42001a83}, - {0x0000a5d0, 0x7703ff0b, 0x7703ff0b, 0x44001c84, 0x44001c84}, - {0x0000a5d4, 0x7d06ffcb, 0x7d06ffcb, 0x48001ce3, 0x48001ce3}, - {0x0000a5d8, 0x8407ff0b, 0x8407ff0b, 0x4c001ce5, 0x4c001ce5}, - {0x0000a5dc, 0x8907ffcb, 0x8907ffcb, 0x50001ce9, 0x50001ce9}, - {0x0000a5e0, 0x900fff0b, 0x900fff0b, 0x54001ceb, 0x54001ceb}, - {0x0000a5e4, 0x960fffcb, 0x960fffcb, 0x56001eec, 0x56001eec}, - {0x0000a5e8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5ec, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f0, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f4, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5fc, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, - {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02008802, 0x02008802, 0x02008802, 0x02008802}, - {0x0000a620, 0x0280c802, 0x0280c802, 0x0280c802, 0x0280c802}, - {0x0000a624, 0x03010a03, 0x03010a03, 0x03010a03, 0x03010a03}, - {0x0000a628, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a62c, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a630, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a634, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a638, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a63c, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x00016044, 0x034922db, 0x034922db, 0x034922db, 0x034922db}, - {0x00016284, 0x14d3f000, 0x14d3f000, 0x14d3f000, 0x14d3f000}, -}; - -static const u32 ar9331_modes_high_ob_db_tx_gain_1p1[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a}, - {0x0000a2dc, 0xffaa9a52, 0xffaa9a52, 0xffaa9a52, 0xffaa9a52}, - {0x0000a2e0, 0xffb31c84, 0xffb31c84, 0xffb31c84, 0xffb31c84}, - {0x0000a2e4, 0xff43e000, 0xff43e000, 0xff43e000, 0xff43e000}, - {0x0000a2e8, 0xfffc0000, 0xfffc0000, 0xfffc0000, 0xfffc0000}, - {0x0000a410, 0x000050d7, 0x000050d7, 0x000050d7, 0x000050d7}, - {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, - {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, - {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, - {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, - {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, - {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, - {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, - {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, - {0x0000a520, 0x2f001f04, 0x2f001f04, 0x23000a00, 0x23000a00}, - {0x0000a524, 0x35001fc4, 0x35001fc4, 0x27000a02, 0x27000a02}, - {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2b000a04, 0x2b000a04}, - {0x0000a52c, 0x41023e85, 0x41023e85, 0x3d001620, 0x3d001620}, - {0x0000a530, 0x48023ec6, 0x48023ec6, 0x3f001621, 0x3f001621}, - {0x0000a534, 0x4d023f01, 0x4d023f01, 0x42001640, 0x42001640}, - {0x0000a538, 0x53023f4b, 0x53023f4b, 0x44001641, 0x44001641}, - {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x46001642, 0x46001642}, - {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x49001644, 0x49001644}, - {0x0000a544, 0x6502feca, 0x6502feca, 0x4c001a81, 0x4c001a81}, - {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x4f001a83, 0x4f001a83}, - {0x0000a54c, 0x7203feca, 0x7203feca, 0x52001c84, 0x52001c84}, - {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x55001ce3, 0x55001ce3}, - {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x59001ce5, 0x59001ce5}, - {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x5d001ce9, 0x5d001ce9}, - {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x64001eec, 0x64001eec}, - {0x0000a560, 0x900fff0b, 0x900fff0b, 0x64001eec, 0x64001eec}, - {0x0000a564, 0x960fffcb, 0x960fffcb, 0x64001eec, 0x64001eec}, - {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x64001eec, 0x64001eec}, - {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x64001eec, 0x64001eec}, - {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x64001eec, 0x64001eec}, - {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x64001eec, 0x64001eec}, - {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x64001eec, 0x64001eec}, - {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x64001eec, 0x64001eec}, - {0x0000a580, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, - {0x0000a584, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, - {0x0000a588, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, - {0x0000a58c, 0x11062202, 0x11062202, 0x0b000200, 0x0b000200}, - {0x0000a590, 0x17022e00, 0x17022e00, 0x0f000202, 0x0f000202}, - {0x0000a594, 0x1d000ec2, 0x1d000ec2, 0x11000400, 0x11000400}, - {0x0000a598, 0x25020ec0, 0x25020ec0, 0x15000402, 0x15000402}, - {0x0000a59c, 0x2b020ec3, 0x2b020ec3, 0x19000404, 0x19000404}, - {0x0000a5a0, 0x2f001f04, 0x2f001f04, 0x1b000603, 0x1b000603}, - {0x0000a5a4, 0x35001fc4, 0x35001fc4, 0x1f000a02, 0x1f000a02}, - {0x0000a5a8, 0x3c022f04, 0x3c022f04, 0x23000a04, 0x23000a04}, - {0x0000a5ac, 0x41023e85, 0x41023e85, 0x26000a20, 0x26000a20}, - {0x0000a5b0, 0x48023ec6, 0x48023ec6, 0x2a000e20, 0x2a000e20}, - {0x0000a5b4, 0x4d023f01, 0x4d023f01, 0x2e000e22, 0x2e000e22}, - {0x0000a5b8, 0x53023f4b, 0x53023f4b, 0x31000e24, 0x31000e24}, - {0x0000a5bc, 0x5a027f09, 0x5a027f09, 0x34001640, 0x34001640}, - {0x0000a5c0, 0x5f027fc9, 0x5f027fc9, 0x38001660, 0x38001660}, - {0x0000a5c4, 0x6502feca, 0x6502feca, 0x3b001861, 0x3b001861}, - {0x0000a5c8, 0x6b02ff4a, 0x6b02ff4a, 0x3e001a81, 0x3e001a81}, - {0x0000a5cc, 0x7203feca, 0x7203feca, 0x42001a83, 0x42001a83}, - {0x0000a5d0, 0x7703ff0b, 0x7703ff0b, 0x44001c84, 0x44001c84}, - {0x0000a5d4, 0x7d06ffcb, 0x7d06ffcb, 0x48001ce3, 0x48001ce3}, - {0x0000a5d8, 0x8407ff0b, 0x8407ff0b, 0x4c001ce5, 0x4c001ce5}, - {0x0000a5dc, 0x8907ffcb, 0x8907ffcb, 0x50001ce9, 0x50001ce9}, - {0x0000a5e0, 0x900fff0b, 0x900fff0b, 0x54001ceb, 0x54001ceb}, - {0x0000a5e4, 0x960fffcb, 0x960fffcb, 0x56001eec, 0x56001eec}, - {0x0000a5e8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5ec, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f0, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f4, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5fc, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, - {0x0000a618, 0x02008501, 0x02008501, 0x02008501, 0x02008501}, - {0x0000a61c, 0x02008802, 0x02008802, 0x02008802, 0x02008802}, - {0x0000a620, 0x0280c802, 0x0280c802, 0x0280c802, 0x0280c802}, - {0x0000a624, 0x0280ca03, 0x0280ca03, 0x0280ca03, 0x0280ca03}, - {0x0000a628, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a62c, 0x04015005, 0x04015005, 0x04015005, 0x04015005}, - {0x0000a630, 0x04015005, 0x04015005, 0x04015005, 0x04015005}, - {0x0000a634, 0x04015005, 0x04015005, 0x04015005, 0x04015005}, - {0x0000a638, 0x04015005, 0x04015005, 0x04015005, 0x04015005}, - {0x0000a63c, 0x04015005, 0x04015005, 0x04015005, 0x04015005}, -}; - -static const u32 ar9331_modes_low_ob_db_tx_gain_1p1[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a}, - {0x0000a2dc, 0xffff2a52, 0xffff2a52, 0xffff2a52, 0xffff2a52}, - {0x0000a2e0, 0xffffcc84, 0xffffcc84, 0xffffcc84, 0xffffcc84}, - {0x0000a2e4, 0xfffff000, 0xfffff000, 0xfffff000, 0xfffff000}, - {0x0000a2e8, 0xfffe0000, 0xfffe0000, 0xfffe0000, 0xfffe0000}, - {0x0000a410, 0x000050d7, 0x000050d7, 0x000050d0, 0x000050d0}, - {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, - {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, - {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, - {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, - {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, - {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, - {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, - {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, - {0x0000a520, 0x2f001f04, 0x2f001f04, 0x23000a00, 0x23000a00}, - {0x0000a524, 0x35001fc4, 0x35001fc4, 0x27000a02, 0x27000a02}, - {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2b000a04, 0x2b000a04}, - {0x0000a52c, 0x41023e85, 0x41023e85, 0x2d000a20, 0x2d000a20}, - {0x0000a530, 0x48023ec6, 0x48023ec6, 0x31000a22, 0x31000a22}, - {0x0000a534, 0x4d023f01, 0x4d023f01, 0x35000a24, 0x35000a24}, - {0x0000a538, 0x53023f4b, 0x53023f4b, 0x38000a43, 0x38000a43}, - {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x3b000e42, 0x3b000e42}, - {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x3f000e44, 0x3f000e44}, - {0x0000a544, 0x6502feca, 0x6502feca, 0x42000e64, 0x42000e64}, - {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x46000e66, 0x46000e66}, - {0x0000a54c, 0x7203feca, 0x7203feca, 0x4a000ea6, 0x4a000ea6}, - {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x4a000ea6, 0x4a000ea6}, - {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x4a000ea6, 0x4a000ea6}, - {0x0000a560, 0x900fff0b, 0x900fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a564, 0x960fffcb, 0x960fffcb, 0x4a000ea6, 0x4a000ea6}, - {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a580, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, - {0x0000a584, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, - {0x0000a588, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, - {0x0000a58c, 0x11062202, 0x11062202, 0x0b000200, 0x0b000200}, - {0x0000a590, 0x17022e00, 0x17022e00, 0x0f000202, 0x0f000202}, - {0x0000a594, 0x1d000ec2, 0x1d000ec2, 0x11000400, 0x11000400}, - {0x0000a598, 0x25020ec0, 0x25020ec0, 0x15000402, 0x15000402}, - {0x0000a59c, 0x2b020ec3, 0x2b020ec3, 0x19000404, 0x19000404}, - {0x0000a5a0, 0x2f001f04, 0x2f001f04, 0x1b000603, 0x1b000603}, - {0x0000a5a4, 0x35001fc4, 0x35001fc4, 0x1f000a02, 0x1f000a02}, - {0x0000a5a8, 0x3c022f04, 0x3c022f04, 0x23000a04, 0x23000a04}, - {0x0000a5ac, 0x41023e85, 0x41023e85, 0x26000a20, 0x26000a20}, - {0x0000a5b0, 0x48023ec6, 0x48023ec6, 0x2a000e20, 0x2a000e20}, - {0x0000a5b4, 0x4d023f01, 0x4d023f01, 0x2e000e22, 0x2e000e22}, - {0x0000a5b8, 0x53023f4b, 0x53023f4b, 0x31000e24, 0x31000e24}, - {0x0000a5bc, 0x5a027f09, 0x5a027f09, 0x34001640, 0x34001640}, - {0x0000a5c0, 0x5f027fc9, 0x5f027fc9, 0x38001660, 0x38001660}, - {0x0000a5c4, 0x6502feca, 0x6502feca, 0x3b001861, 0x3b001861}, - {0x0000a5c8, 0x6b02ff4a, 0x6b02ff4a, 0x3e001a81, 0x3e001a81}, - {0x0000a5cc, 0x7203feca, 0x7203feca, 0x42001a83, 0x42001a83}, - {0x0000a5d0, 0x7703ff0b, 0x7703ff0b, 0x44001c84, 0x44001c84}, - {0x0000a5d4, 0x7d06ffcb, 0x7d06ffcb, 0x48001ce3, 0x48001ce3}, - {0x0000a5d8, 0x8407ff0b, 0x8407ff0b, 0x4c001ce5, 0x4c001ce5}, - {0x0000a5dc, 0x8907ffcb, 0x8907ffcb, 0x50001ce9, 0x50001ce9}, - {0x0000a5e0, 0x900fff0b, 0x900fff0b, 0x54001ceb, 0x54001ceb}, - {0x0000a5e4, 0x960fffcb, 0x960fffcb, 0x56001eec, 0x56001eec}, - {0x0000a5e8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5ec, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f0, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f4, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5fc, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, - {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02008802, 0x02008802, 0x02008802, 0x02008802}, - {0x0000a620, 0x0280c802, 0x0280c802, 0x0280c802, 0x0280c802}, - {0x0000a624, 0x03010a03, 0x03010a03, 0x03010a03, 0x03010a03}, - {0x0000a628, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a62c, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a630, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a634, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a638, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a63c, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x00016044, 0x034922db, 0x034922db, 0x034922db, 0x034922db}, - {0x00016284, 0x14d3f000, 0x14d3f000, 0x14d3f000, 0x14d3f000}, -}; - -#define ar9331_1p1_baseband_core_txfir_coeff_japan_2484 ar9462_2p0_baseband_core_txfir_coeff_japan_2484 - -static const u32 ar9331_1p1_xtal_25M[][2] = { - /* Addr allmodes */ - {0x00007038, 0x000002f8}, - {0x00008244, 0x0010f3d7}, - {0x0000824c, 0x0001e7ae}, - {0x0001609c, 0x0f508f29}, -}; - -static const u32 ar9331_1p1_radio_core[][2] = { - /* Addr allmodes */ - {0x00016000, 0x36db6db6}, - {0x00016004, 0x6db6db40}, - {0x00016008, 0x73800000}, - {0x0001600c, 0x00000000}, - {0x00016040, 0x7f80fff8}, - {0x00016044, 0x03db62db}, - {0x00016048, 0x6c924268}, - {0x0001604c, 0x000f0278}, - {0x00016050, 0x4db6db8c}, - {0x00016054, 0x6db60000}, - {0x00016080, 0x00080000}, - {0x00016084, 0x0e48048c}, - {0x00016088, 0x14214514}, - {0x0001608c, 0x119f081c}, - {0x00016090, 0x24926490}, - {0x00016098, 0xd411eb84}, - {0x000160a0, 0xc2108ffe}, - {0x000160a4, 0x812fc370}, - {0x000160a8, 0x423c8000}, - {0x000160ac, 0x24651800}, - {0x000160b0, 0x03284f3e}, - {0x000160b4, 0x92480040}, - {0x000160c0, 0x006db6db}, - {0x000160c4, 0x0186db60}, - {0x000160c8, 0x6db4db6c}, - {0x000160cc, 0x6de6c300}, - {0x000160d0, 0x14500820}, - {0x00016100, 0x04cb0001}, - {0x00016104, 0xfff80015}, - {0x00016108, 0x00080010}, - {0x0001610c, 0x00170000}, - {0x00016140, 0x10800000}, - {0x00016144, 0x01884080}, - {0x00016148, 0x000080c0}, - {0x00016280, 0x01000015}, - {0x00016284, 0x14d20000}, - {0x00016288, 0x00318000}, - {0x0001628c, 0x50000000}, - {0x00016290, 0x4b96210f}, - {0x00016380, 0x00000000}, - {0x00016384, 0x00000000}, - {0x00016388, 0x00800700}, - {0x0001638c, 0x00800700}, - {0x00016390, 0x00800700}, - {0x00016394, 0x00000000}, - {0x00016398, 0x00000000}, - {0x0001639c, 0x00000000}, - {0x000163a0, 0x00000001}, - {0x000163a4, 0x00000001}, - {0x000163a8, 0x00000000}, - {0x000163ac, 0x00000000}, - {0x000163b0, 0x00000000}, - {0x000163b4, 0x00000000}, - {0x000163b8, 0x00000000}, - {0x000163bc, 0x00000000}, - {0x000163c0, 0x000000a0}, - {0x000163c4, 0x000c0000}, - {0x000163c8, 0x14021402}, - {0x000163cc, 0x00001402}, - {0x000163d0, 0x00000000}, - {0x000163d4, 0x00000000}, -}; - -static const u32 ar9331_1p1_soc_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00007010, 0x00000022, 0x00000022, 0x00000022, 0x00000022}, -}; - -static const u32 ar9331_common_wo_xlna_rx_gain_1p1[][2] = { - /* Addr allmodes */ - {0x0000a000, 0x00060005}, - {0x0000a004, 0x00810080}, - {0x0000a008, 0x00830082}, - {0x0000a00c, 0x00850084}, - {0x0000a010, 0x01820181}, - {0x0000a014, 0x01840183}, - {0x0000a018, 0x01880185}, - {0x0000a01c, 0x018a0189}, - {0x0000a020, 0x02850284}, - {0x0000a024, 0x02890288}, - {0x0000a028, 0x028b028a}, - {0x0000a02c, 0x03850384}, - {0x0000a030, 0x03890388}, - {0x0000a034, 0x038b038a}, - {0x0000a038, 0x038d038c}, - {0x0000a03c, 0x03910390}, - {0x0000a040, 0x03930392}, - {0x0000a044, 0x03950394}, - {0x0000a048, 0x00000396}, - {0x0000a04c, 0x00000000}, - {0x0000a050, 0x00000000}, - {0x0000a054, 0x00000000}, - {0x0000a058, 0x00000000}, - {0x0000a05c, 0x00000000}, - {0x0000a060, 0x00000000}, - {0x0000a064, 0x00000000}, - {0x0000a068, 0x00000000}, - {0x0000a06c, 0x00000000}, - {0x0000a070, 0x00000000}, - {0x0000a074, 0x00000000}, - {0x0000a078, 0x00000000}, - {0x0000a07c, 0x00000000}, - {0x0000a080, 0x28282828}, - {0x0000a084, 0x28282828}, - {0x0000a088, 0x28282828}, - {0x0000a08c, 0x28282828}, - {0x0000a090, 0x28282828}, - {0x0000a094, 0x24242428}, - {0x0000a098, 0x171e1e1e}, - {0x0000a09c, 0x02020b0b}, - {0x0000a0a0, 0x02020202}, - {0x0000a0a4, 0x00000000}, - {0x0000a0a8, 0x00000000}, - {0x0000a0ac, 0x00000000}, - {0x0000a0b0, 0x00000000}, - {0x0000a0b4, 0x00000000}, - {0x0000a0b8, 0x00000000}, - {0x0000a0bc, 0x00000000}, - {0x0000a0c0, 0x22072208}, - {0x0000a0c4, 0x22052206}, - {0x0000a0c8, 0x22032204}, - {0x0000a0cc, 0x22012202}, - {0x0000a0d0, 0x221f2200}, - {0x0000a0d4, 0x221d221e}, - {0x0000a0d8, 0x33023303}, - {0x0000a0dc, 0x33003301}, - {0x0000a0e0, 0x331e331f}, - {0x0000a0e4, 0x4402331d}, - {0x0000a0e8, 0x44004401}, - {0x0000a0ec, 0x441e441f}, - {0x0000a0f0, 0x55025503}, - {0x0000a0f4, 0x55005501}, - {0x0000a0f8, 0x551e551f}, - {0x0000a0fc, 0x6602551d}, - {0x0000a100, 0x66006601}, - {0x0000a104, 0x661e661f}, - {0x0000a108, 0x7703661d}, - {0x0000a10c, 0x77017702}, - {0x0000a110, 0x00007700}, - {0x0000a114, 0x00000000}, - {0x0000a118, 0x00000000}, - {0x0000a11c, 0x00000000}, - {0x0000a120, 0x00000000}, - {0x0000a124, 0x00000000}, - {0x0000a128, 0x00000000}, - {0x0000a12c, 0x00000000}, - {0x0000a130, 0x00000000}, - {0x0000a134, 0x00000000}, - {0x0000a138, 0x00000000}, - {0x0000a13c, 0x00000000}, - {0x0000a140, 0x001f0000}, - {0x0000a144, 0x111f1100}, - {0x0000a148, 0x111d111e}, - {0x0000a14c, 0x111b111c}, - {0x0000a150, 0x22032204}, - {0x0000a154, 0x22012202}, - {0x0000a158, 0x221f2200}, - {0x0000a15c, 0x221d221e}, - {0x0000a160, 0x33013302}, - {0x0000a164, 0x331f3300}, - {0x0000a168, 0x4402331e}, - {0x0000a16c, 0x44004401}, - {0x0000a170, 0x441e441f}, - {0x0000a174, 0x55015502}, - {0x0000a178, 0x551f5500}, - {0x0000a17c, 0x6602551e}, - {0x0000a180, 0x66006601}, - {0x0000a184, 0x661e661f}, - {0x0000a188, 0x7703661d}, - {0x0000a18c, 0x77017702}, - {0x0000a190, 0x00007700}, - {0x0000a194, 0x00000000}, - {0x0000a198, 0x00000000}, - {0x0000a19c, 0x00000000}, - {0x0000a1a0, 0x00000000}, - {0x0000a1a4, 0x00000000}, - {0x0000a1a8, 0x00000000}, - {0x0000a1ac, 0x00000000}, - {0x0000a1b0, 0x00000000}, - {0x0000a1b4, 0x00000000}, - {0x0000a1b8, 0x00000000}, - {0x0000a1bc, 0x00000000}, - {0x0000a1c0, 0x00000000}, - {0x0000a1c4, 0x00000000}, - {0x0000a1c8, 0x00000000}, - {0x0000a1cc, 0x00000000}, - {0x0000a1d0, 0x00000000}, - {0x0000a1d4, 0x00000000}, - {0x0000a1d8, 0x00000000}, - {0x0000a1dc, 0x00000000}, - {0x0000a1e0, 0x00000000}, - {0x0000a1e4, 0x00000000}, - {0x0000a1e8, 0x00000000}, - {0x0000a1ec, 0x00000000}, - {0x0000a1f0, 0x00000396}, - {0x0000a1f4, 0x00000396}, - {0x0000a1f8, 0x00000396}, - {0x0000a1fc, 0x00000296}, -}; - -static const u32 ar9331_1p1_baseband_core[][2] = { - /* Addr allmodes */ - {0x00009800, 0xafe68e30}, - {0x00009804, 0xfd14e000}, - {0x00009808, 0x9c0a8f6b}, - {0x0000980c, 0x04800000}, - {0x00009814, 0x9280c00a}, - {0x00009818, 0x00000000}, - {0x0000981c, 0x00020028}, - {0x00009834, 0x5f3ca3de}, - {0x00009838, 0x0108ecff}, - {0x0000983c, 0x14750600}, - {0x00009880, 0x201fff00}, - {0x00009884, 0x00001042}, - {0x000098a4, 0x00200400}, - {0x000098b0, 0x32840bbe}, - {0x000098d0, 0x004b6a8e}, - {0x000098d4, 0x00000820}, - {0x000098dc, 0x00000000}, - {0x000098f0, 0x00000000}, - {0x000098f4, 0x00000000}, - {0x00009c04, 0x00000000}, - {0x00009c08, 0x03200000}, - {0x00009c0c, 0x00000000}, - {0x00009c10, 0x00000000}, - {0x00009c14, 0x00046384}, - {0x00009c18, 0x05b6b440}, - {0x00009c1c, 0x00b6b440}, - {0x00009d00, 0xc080a333}, - {0x00009d04, 0x40206c10}, - {0x00009d08, 0x009c4060}, - {0x00009d0c, 0x1883800a}, - {0x00009d10, 0x01834061}, - {0x00009d14, 0x00c00400}, - {0x00009d18, 0x00000000}, - {0x00009e08, 0x0038233c}, - {0x00009e24, 0x9927b515}, - {0x00009e28, 0x12ef0200}, - {0x00009e30, 0x06336f77}, - {0x00009e34, 0x6af6532f}, - {0x00009e38, 0x0cc80c00}, - {0x00009e40, 0x0d261820}, - {0x00009e4c, 0x00001004}, - {0x00009e50, 0x00ff03f1}, - {0x00009fc0, 0x803e4788}, - {0x00009fc4, 0x0001efb5}, - {0x00009fcc, 0x40000014}, - {0x0000a20c, 0x00000000}, - {0x0000a220, 0x00000000}, - {0x0000a224, 0x00000000}, - {0x0000a228, 0x10002310}, - {0x0000a23c, 0x00000000}, - {0x0000a244, 0x0c000000}, - {0x0000a2a0, 0x00000001}, - {0x0000a2c0, 0x00000001}, - {0x0000a2c8, 0x00000000}, - {0x0000a2cc, 0x18c43433}, - {0x0000a2d4, 0x00000000}, - {0x0000a2dc, 0x00000000}, - {0x0000a2e0, 0x00000000}, - {0x0000a2e4, 0x00000000}, - {0x0000a2e8, 0x00000000}, - {0x0000a2ec, 0x00000000}, - {0x0000a2f0, 0x00000000}, - {0x0000a2f4, 0x00000000}, - {0x0000a2f8, 0x00000000}, - {0x0000a344, 0x00000000}, - {0x0000a34c, 0x00000000}, - {0x0000a350, 0x0000a000}, - {0x0000a364, 0x00000000}, - {0x0000a370, 0x00000000}, - {0x0000a390, 0x00000001}, - {0x0000a394, 0x00000444}, - {0x0000a398, 0x001f0e0f}, - {0x0000a39c, 0x0075393f}, - {0x0000a3a0, 0xb79f6427}, - {0x0000a3a4, 0x00000000}, - {0x0000a3a8, 0xaaaaaaaa}, - {0x0000a3ac, 0x3c466478}, - {0x0000a3c0, 0x20202020}, - {0x0000a3c4, 0x22222220}, - {0x0000a3c8, 0x20200020}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3d8, 0x20202020}, - {0x0000a3dc, 0x20202020}, - {0x0000a3e0, 0x20202020}, - {0x0000a3e4, 0x20202020}, - {0x0000a3e8, 0x20202020}, - {0x0000a3ec, 0x20202020}, - {0x0000a3f0, 0x00000000}, - {0x0000a3f4, 0x00000006}, - {0x0000a3f8, 0x0cdbd380}, - {0x0000a3fc, 0x000f0f01}, - {0x0000a400, 0x8fa91f01}, - {0x0000a404, 0x00000000}, - {0x0000a408, 0x0e79e5c6}, - {0x0000a40c, 0x00820820}, - {0x0000a414, 0x1ce739ce}, - {0x0000a418, 0x2d001dce}, - {0x0000a41c, 0x1ce739ce}, - {0x0000a420, 0x000001ce}, - {0x0000a424, 0x1ce739ce}, - {0x0000a428, 0x000001ce}, - {0x0000a42c, 0x1ce739ce}, - {0x0000a430, 0x1ce739ce}, - {0x0000a434, 0x00000000}, - {0x0000a438, 0x00001801}, - {0x0000a43c, 0x00000000}, - {0x0000a440, 0x00000000}, - {0x0000a444, 0x00000000}, - {0x0000a448, 0x04000000}, - {0x0000a44c, 0x00000001}, - {0x0000a450, 0x00010000}, - {0x0000a458, 0x00000000}, - {0x0000a640, 0x00000000}, - {0x0000a644, 0x3fad9d74}, - {0x0000a648, 0x0048060a}, - {0x0000a64c, 0x00003c37}, - {0x0000a670, 0x03020100}, - {0x0000a674, 0x09080504}, - {0x0000a678, 0x0d0c0b0a}, - {0x0000a67c, 0x13121110}, - {0x0000a680, 0x31301514}, - {0x0000a684, 0x35343332}, - {0x0000a688, 0x00000036}, - {0x0000a690, 0x00000838}, - {0x0000a7c0, 0x00000000}, - {0x0000a7c4, 0xfffffffc}, - {0x0000a7c8, 0x00000000}, - {0x0000a7cc, 0x00000000}, - {0x0000a7d0, 0x00000000}, - {0x0000a7d4, 0x00000004}, - {0x0000a7dc, 0x00000001}, -}; - -static const u32 ar9331_modes_high_power_tx_gain_1p1[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a}, - {0x0000a2dc, 0xffff2a52, 0xffff2a52, 0xffff2a52, 0xffff2a52}, - {0x0000a2e0, 0xffffcc84, 0xffffcc84, 0xffffcc84, 0xffffcc84}, - {0x0000a2e4, 0xfffff000, 0xfffff000, 0xfffff000, 0xfffff000}, - {0x0000a2e8, 0xfffe0000, 0xfffe0000, 0xfffe0000, 0xfffe0000}, - {0x0000a410, 0x000050d7, 0x000050d7, 0x000050d0, 0x000050d0}, - {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, - {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, - {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, - {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, - {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, - {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, - {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, - {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, - {0x0000a520, 0x2f001f04, 0x2f001f04, 0x23000a00, 0x23000a00}, - {0x0000a524, 0x35001fc4, 0x35001fc4, 0x27000a02, 0x27000a02}, - {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2b000a04, 0x2b000a04}, - {0x0000a52c, 0x41023e85, 0x41023e85, 0x2d000a20, 0x2d000a20}, - {0x0000a530, 0x48023ec6, 0x48023ec6, 0x31000a22, 0x31000a22}, - {0x0000a534, 0x4d023f01, 0x4d023f01, 0x35000a24, 0x35000a24}, - {0x0000a538, 0x53023f4b, 0x53023f4b, 0x38000a43, 0x38000a43}, - {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x3b000e42, 0x3b000e42}, - {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x3f000e44, 0x3f000e44}, - {0x0000a544, 0x6502feca, 0x6502feca, 0x42000e64, 0x42000e64}, - {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x46000e66, 0x46000e66}, - {0x0000a54c, 0x7203feca, 0x7203feca, 0x4a000ea6, 0x4a000ea6}, - {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x4a000ea6, 0x4a000ea6}, - {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x4a000ea6, 0x4a000ea6}, - {0x0000a560, 0x900fff0b, 0x900fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a564, 0x960fffcb, 0x960fffcb, 0x4a000ea6, 0x4a000ea6}, - {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x4a000ea6, 0x4a000ea6}, - {0x0000a580, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, - {0x0000a584, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, - {0x0000a588, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, - {0x0000a58c, 0x11062202, 0x11062202, 0x0b000200, 0x0b000200}, - {0x0000a590, 0x17022e00, 0x17022e00, 0x0f000202, 0x0f000202}, - {0x0000a594, 0x1d000ec2, 0x1d000ec2, 0x11000400, 0x11000400}, - {0x0000a598, 0x25020ec0, 0x25020ec0, 0x15000402, 0x15000402}, - {0x0000a59c, 0x2b020ec3, 0x2b020ec3, 0x19000404, 0x19000404}, - {0x0000a5a0, 0x2f001f04, 0x2f001f04, 0x1b000603, 0x1b000603}, - {0x0000a5a4, 0x35001fc4, 0x35001fc4, 0x1f000a02, 0x1f000a02}, - {0x0000a5a8, 0x3c022f04, 0x3c022f04, 0x23000a04, 0x23000a04}, - {0x0000a5ac, 0x41023e85, 0x41023e85, 0x26000a20, 0x26000a20}, - {0x0000a5b0, 0x48023ec6, 0x48023ec6, 0x2a000e20, 0x2a000e20}, - {0x0000a5b4, 0x4d023f01, 0x4d023f01, 0x2e000e22, 0x2e000e22}, - {0x0000a5b8, 0x53023f4b, 0x53023f4b, 0x31000e24, 0x31000e24}, - {0x0000a5bc, 0x5a027f09, 0x5a027f09, 0x34001640, 0x34001640}, - {0x0000a5c0, 0x5f027fc9, 0x5f027fc9, 0x38001660, 0x38001660}, - {0x0000a5c4, 0x6502feca, 0x6502feca, 0x3b001861, 0x3b001861}, - {0x0000a5c8, 0x6b02ff4a, 0x6b02ff4a, 0x3e001a81, 0x3e001a81}, - {0x0000a5cc, 0x7203feca, 0x7203feca, 0x42001a83, 0x42001a83}, - {0x0000a5d0, 0x7703ff0b, 0x7703ff0b, 0x44001c84, 0x44001c84}, - {0x0000a5d4, 0x7d06ffcb, 0x7d06ffcb, 0x48001ce3, 0x48001ce3}, - {0x0000a5d8, 0x8407ff0b, 0x8407ff0b, 0x4c001ce5, 0x4c001ce5}, - {0x0000a5dc, 0x8907ffcb, 0x8907ffcb, 0x50001ce9, 0x50001ce9}, - {0x0000a5e0, 0x900fff0b, 0x900fff0b, 0x54001ceb, 0x54001ceb}, - {0x0000a5e4, 0x960fffcb, 0x960fffcb, 0x56001eec, 0x56001eec}, - {0x0000a5e8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5ec, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f0, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f4, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5fc, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, - {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02008802, 0x02008802, 0x02008802, 0x02008802}, - {0x0000a620, 0x0280c802, 0x0280c802, 0x0280c802, 0x0280c802}, - {0x0000a624, 0x03010a03, 0x03010a03, 0x03010a03, 0x03010a03}, - {0x0000a628, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a62c, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a630, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a634, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a638, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x0000a63c, 0x03010c04, 0x03010c04, 0x03010c04, 0x03010c04}, - {0x00016044, 0x034922db, 0x034922db, 0x034922db, 0x034922db}, - {0x00016284, 0x14d3f000, 0x14d3f000, 0x14d3f000, 0x14d3f000}, -}; - -#define ar9331_1p1_mac_postamble ar9300_2p2_mac_postamble - -static const u32 ar9331_1p1_soc_preamble[][2] = { - /* Addr allmodes */ - {0x00007020, 0x00000000}, - {0x00007034, 0x00000002}, - {0x00007038, 0x000002f8}, -}; - -static const u32 ar9331_1p1_xtal_40M[][2] = { - /* Addr allmodes */ - {0x00007038, 0x000004c2}, - {0x00008244, 0x0010f400}, - {0x0000824c, 0x0001e800}, - {0x0001609c, 0x0b283f31}, -}; - -static const u32 ar9331_1p1_mac_core[][2] = { - /* Addr allmodes */ - {0x00000008, 0x00000000}, - {0x00000030, 0x00020085}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000000}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x000010f0, 0x00000100}, - {0x00001270, 0x00000000}, - {0x000012b0, 0x00000000}, - {0x000012f0, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00008000, 0x00000000}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008018, 0x00000000}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00000000}, - {0x00008040, 0x00000000}, - {0x00008044, 0x00000000}, - {0x00008048, 0x00000000}, - {0x0000804c, 0xffffffff}, - {0x00008054, 0x00000000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x00008070, 0x00000310}, - {0x00008074, 0x00000020}, - {0x00008078, 0x00000000}, - {0x0000809c, 0x0000000f}, - {0x000080a0, 0x00000000}, - {0x000080a4, 0x02ff0000}, - {0x000080a8, 0x0e070605}, - {0x000080ac, 0x0000000d}, - {0x000080b0, 0x00000000}, - {0x000080b4, 0x00000000}, - {0x000080b8, 0x00000000}, - {0x000080bc, 0x00000000}, - {0x000080c0, 0x2a800000}, - {0x000080c4, 0x06900168}, - {0x000080c8, 0x13881c20}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00252500}, - {0x000080d4, 0x00a00000}, - {0x000080d8, 0x00400000}, - {0x000080dc, 0x00000000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x3f3f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00000000}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000000}, - {0x00008114, 0x000007ff}, - {0x00008118, 0x000000aa}, - {0x0000811c, 0x00003210}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x0000ffff}, - {0x00008144, 0xffffffff}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x00008170, 0x18486200}, - {0x00008174, 0x33332210}, - {0x00008178, 0x00000000}, - {0x0000817c, 0x00020000}, - {0x000081c0, 0x00000000}, - {0x000081c4, 0x33332210}, - {0x000081c8, 0x00000000}, - {0x000081cc, 0x00000000}, - {0x000081d4, 0x00000000}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008248, 0x00000800}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x40000000}, - {0x00008260, 0x00080922}, - {0x00008264, 0x9d400010}, - {0x00008268, 0xffffffff}, - {0x0000826c, 0x0000ffff}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000004}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x000000ff}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x0000829c, 0x00000000}, - {0x00008300, 0x00000140}, - {0x00008314, 0x00000000}, - {0x0000831c, 0x0000010d}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x00000007}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000700}, - {0x00008338, 0x00ff0000}, - {0x0000833c, 0x02400000}, - {0x00008340, 0x000107ff}, - {0x00008344, 0xaa48105b}, - {0x00008348, 0x008f0000}, - {0x0000835c, 0x00000000}, - {0x00008360, 0xffffffff}, - {0x00008364, 0xffffffff}, - {0x00008368, 0x00000000}, - {0x00008370, 0x00000000}, - {0x00008374, 0x000000ff}, - {0x00008378, 0x00000000}, - {0x0000837c, 0x00000000}, - {0x00008380, 0xffffffff}, - {0x00008384, 0xffffffff}, - {0x00008390, 0xffffffff}, - {0x00008394, 0xffffffff}, - {0x00008398, 0x00000000}, - {0x0000839c, 0x00000000}, - {0x000083a0, 0x00000000}, - {0x000083a4, 0x0000fa14}, - {0x000083a8, 0x000f0c00}, - {0x000083ac, 0x33332210}, - {0x000083b0, 0x33332210}, - {0x000083b4, 0x33332210}, - {0x000083b8, 0x33332210}, - {0x000083bc, 0x00000000}, - {0x000083c0, 0x00000000}, - {0x000083c4, 0x00000000}, - {0x000083c8, 0x00000000}, - {0x000083cc, 0x00000200}, - {0x000083d0, 0x000301ff}, -}; - -static const u32 ar9331_common_rx_gain_1p1[][2] = { - /* Addr allmodes */ - {0x00009e18, 0x05000000}, - {0x0000a000, 0x00060005}, - {0x0000a004, 0x00810080}, - {0x0000a008, 0x00830082}, - {0x0000a00c, 0x00850084}, - {0x0000a010, 0x01820181}, - {0x0000a014, 0x01840183}, - {0x0000a018, 0x01880185}, - {0x0000a01c, 0x018a0189}, - {0x0000a020, 0x02850284}, - {0x0000a024, 0x02890288}, - {0x0000a028, 0x028b028a}, - {0x0000a02c, 0x03850384}, - {0x0000a030, 0x03890388}, - {0x0000a034, 0x038b038a}, - {0x0000a038, 0x038d038c}, - {0x0000a03c, 0x03910390}, - {0x0000a040, 0x03930392}, - {0x0000a044, 0x03950394}, - {0x0000a048, 0x00000396}, - {0x0000a04c, 0x00000000}, - {0x0000a050, 0x00000000}, - {0x0000a054, 0x00000000}, - {0x0000a058, 0x00000000}, - {0x0000a05c, 0x00000000}, - {0x0000a060, 0x00000000}, - {0x0000a064, 0x00000000}, - {0x0000a068, 0x00000000}, - {0x0000a06c, 0x00000000}, - {0x0000a070, 0x00000000}, - {0x0000a074, 0x00000000}, - {0x0000a078, 0x00000000}, - {0x0000a07c, 0x00000000}, - {0x0000a080, 0x28282828}, - {0x0000a084, 0x28282828}, - {0x0000a088, 0x28282828}, - {0x0000a08c, 0x28282828}, - {0x0000a090, 0x28282828}, - {0x0000a094, 0x24242428}, - {0x0000a098, 0x171e1e1e}, - {0x0000a09c, 0x02020b0b}, - {0x0000a0a0, 0x02020202}, - {0x0000a0a4, 0x00000000}, - {0x0000a0a8, 0x00000000}, - {0x0000a0ac, 0x00000000}, - {0x0000a0b0, 0x00000000}, - {0x0000a0b4, 0x00000000}, - {0x0000a0b8, 0x00000000}, - {0x0000a0bc, 0x00000000}, - {0x0000a0c0, 0x22072208}, - {0x0000a0c4, 0x22052206}, - {0x0000a0c8, 0x22032204}, - {0x0000a0cc, 0x22012202}, - {0x0000a0d0, 0x221f2200}, - {0x0000a0d4, 0x221d221e}, - {0x0000a0d8, 0x33023303}, - {0x0000a0dc, 0x33003301}, - {0x0000a0e0, 0x331e331f}, - {0x0000a0e4, 0x4402331d}, - {0x0000a0e8, 0x44004401}, - {0x0000a0ec, 0x441e441f}, - {0x0000a0f0, 0x55025503}, - {0x0000a0f4, 0x55005501}, - {0x0000a0f8, 0x551e551f}, - {0x0000a0fc, 0x6602551d}, - {0x0000a100, 0x66006601}, - {0x0000a104, 0x661e661f}, - {0x0000a108, 0x7703661d}, - {0x0000a10c, 0x77017702}, - {0x0000a110, 0x00007700}, - {0x0000a114, 0x00000000}, - {0x0000a118, 0x00000000}, - {0x0000a11c, 0x00000000}, - {0x0000a120, 0x00000000}, - {0x0000a124, 0x00000000}, - {0x0000a128, 0x00000000}, - {0x0000a12c, 0x00000000}, - {0x0000a130, 0x00000000}, - {0x0000a134, 0x00000000}, - {0x0000a138, 0x00000000}, - {0x0000a13c, 0x00000000}, - {0x0000a140, 0x001f0000}, - {0x0000a144, 0x111f1100}, - {0x0000a148, 0x111d111e}, - {0x0000a14c, 0x111b111c}, - {0x0000a150, 0x22032204}, - {0x0000a154, 0x22012202}, - {0x0000a158, 0x221f2200}, - {0x0000a15c, 0x221d221e}, - {0x0000a160, 0x33013302}, - {0x0000a164, 0x331f3300}, - {0x0000a168, 0x4402331e}, - {0x0000a16c, 0x44004401}, - {0x0000a170, 0x441e441f}, - {0x0000a174, 0x55015502}, - {0x0000a178, 0x551f5500}, - {0x0000a17c, 0x6602551e}, - {0x0000a180, 0x66006601}, - {0x0000a184, 0x661e661f}, - {0x0000a188, 0x7703661d}, - {0x0000a18c, 0x77017702}, - {0x0000a190, 0x00007700}, - {0x0000a194, 0x00000000}, - {0x0000a198, 0x00000000}, - {0x0000a19c, 0x00000000}, - {0x0000a1a0, 0x00000000}, - {0x0000a1a4, 0x00000000}, - {0x0000a1a8, 0x00000000}, - {0x0000a1ac, 0x00000000}, - {0x0000a1b0, 0x00000000}, - {0x0000a1b4, 0x00000000}, - {0x0000a1b8, 0x00000000}, - {0x0000a1bc, 0x00000000}, - {0x0000a1c0, 0x00000000}, - {0x0000a1c4, 0x00000000}, - {0x0000a1c8, 0x00000000}, - {0x0000a1cc, 0x00000000}, - {0x0000a1d0, 0x00000000}, - {0x0000a1d4, 0x00000000}, - {0x0000a1d8, 0x00000000}, - {0x0000a1dc, 0x00000000}, - {0x0000a1e0, 0x00000000}, - {0x0000a1e4, 0x00000000}, - {0x0000a1e8, 0x00000000}, - {0x0000a1ec, 0x00000000}, - {0x0000a1f0, 0x00000396}, - {0x0000a1f4, 0x00000396}, - {0x0000a1f8, 0x00000396}, - {0x0000a1fc, 0x00000296}, -}; - -static const u32 ar9331_common_tx_gain_offset1_1[][1] = { - {0x00000000}, - {0x00000003}, - {0x00000000}, - {0x00000000}, -}; - -#endif /* INITVALS_9330_1P1_H */ diff --git a/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h deleted file mode 100644 index 57ed8a112173..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9330_1p2_initvals.h +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef INITVALS_9330_1P2_H -#define INITVALS_9330_1P2_H - -static const u32 ar9331_modes_high_ob_db_tx_gain_1p2[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a410, 0x000050d7, 0x000050d7, 0x000050d7, 0x000050d7}, - {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, - {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, - {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, - {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, - {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, - {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, - {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, - {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, - {0x0000a520, 0x2f001f04, 0x2f001f04, 0x23000a00, 0x23000a00}, - {0x0000a524, 0x35001fc4, 0x35001fc4, 0x27000a02, 0x27000a02}, - {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2b000a04, 0x2b000a04}, - {0x0000a52c, 0x41023e85, 0x41023e85, 0x3f001620, 0x3f001620}, - {0x0000a530, 0x48023ec6, 0x48023ec6, 0x41001621, 0x41001621}, - {0x0000a534, 0x4d023f01, 0x4d023f01, 0x44001640, 0x44001640}, - {0x0000a538, 0x53023f4b, 0x53023f4b, 0x46001641, 0x46001641}, - {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x48001642, 0x48001642}, - {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x4b001644, 0x4b001644}, - {0x0000a544, 0x6502feca, 0x6502feca, 0x4e001a81, 0x4e001a81}, - {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x51001a83, 0x51001a83}, - {0x0000a54c, 0x7203feca, 0x7203feca, 0x54001c84, 0x54001c84}, - {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x57001ce3, 0x57001ce3}, - {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x5b001ce5, 0x5b001ce5}, - {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x5f001ce9, 0x5f001ce9}, - {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x66001eec, 0x66001eec}, - {0x0000a560, 0x900fff0b, 0x900fff0b, 0x66001eec, 0x66001eec}, - {0x0000a564, 0x960fffcb, 0x960fffcb, 0x66001eec, 0x66001eec}, - {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, - {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, - {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, - {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, - {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, - {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x66001eec, 0x66001eec}, - {0x0000a580, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, - {0x0000a584, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, - {0x0000a588, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, - {0x0000a58c, 0x11062202, 0x11062202, 0x0b000200, 0x0b000200}, - {0x0000a590, 0x17022e00, 0x17022e00, 0x0f000202, 0x0f000202}, - {0x0000a594, 0x1d000ec2, 0x1d000ec2, 0x11000400, 0x11000400}, - {0x0000a598, 0x25020ec0, 0x25020ec0, 0x15000402, 0x15000402}, - {0x0000a59c, 0x2b020ec3, 0x2b020ec3, 0x19000404, 0x19000404}, - {0x0000a5a0, 0x2f001f04, 0x2f001f04, 0x1b000603, 0x1b000603}, - {0x0000a5a4, 0x35001fc4, 0x35001fc4, 0x1f000a02, 0x1f000a02}, - {0x0000a5a8, 0x3c022f04, 0x3c022f04, 0x23000a04, 0x23000a04}, - {0x0000a5ac, 0x41023e85, 0x41023e85, 0x26000a20, 0x26000a20}, - {0x0000a5b0, 0x48023ec6, 0x48023ec6, 0x2a000e20, 0x2a000e20}, - {0x0000a5b4, 0x4d023f01, 0x4d023f01, 0x2e000e22, 0x2e000e22}, - {0x0000a5b8, 0x53023f4b, 0x53023f4b, 0x31000e24, 0x31000e24}, - {0x0000a5bc, 0x5a027f09, 0x5a027f09, 0x34001640, 0x34001640}, - {0x0000a5c0, 0x5f027fc9, 0x5f027fc9, 0x38001660, 0x38001660}, - {0x0000a5c4, 0x6502feca, 0x6502feca, 0x3b001861, 0x3b001861}, - {0x0000a5c8, 0x6b02ff4a, 0x6b02ff4a, 0x3e001a81, 0x3e001a81}, - {0x0000a5cc, 0x7203feca, 0x7203feca, 0x42001a83, 0x42001a83}, - {0x0000a5d0, 0x7703ff0b, 0x7703ff0b, 0x44001c84, 0x44001c84}, - {0x0000a5d4, 0x7d06ffcb, 0x7d06ffcb, 0x48001ce3, 0x48001ce3}, - {0x0000a5d8, 0x8407ff0b, 0x8407ff0b, 0x4c001ce5, 0x4c001ce5}, - {0x0000a5dc, 0x8907ffcb, 0x8907ffcb, 0x50001ce9, 0x50001ce9}, - {0x0000a5e0, 0x900fff0b, 0x900fff0b, 0x54001ceb, 0x54001ceb}, - {0x0000a5e4, 0x960fffcb, 0x960fffcb, 0x56001eec, 0x56001eec}, - {0x0000a5e8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5ec, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f0, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f4, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5f8, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a5fc, 0x9c1fff0b, 0x9c1fff0b, 0x56001eec, 0x56001eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, - {0x0000a618, 0x02008501, 0x02008501, 0x02008501, 0x02008501}, - {0x0000a61c, 0x02008802, 0x02008802, 0x02008802, 0x02008802}, - {0x0000a620, 0x0300c802, 0x0300c802, 0x0300c802, 0x0300c802}, - {0x0000a624, 0x0300cc03, 0x0300cc03, 0x0300cc03, 0x0300cc03}, - {0x0000a628, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, - {0x0000a62c, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, - {0x0000a630, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, - {0x0000a634, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, - {0x0000a638, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, - {0x0000a63c, 0x04011004, 0x04011004, 0x04011004, 0x04011004}, -}; - -#define ar9331_modes_high_power_tx_gain_1p2 ar9331_modes_high_ob_db_tx_gain_1p2 - -#define ar9331_modes_low_ob_db_tx_gain_1p2 ar9331_modes_high_power_tx_gain_1p2 - -#define ar9331_modes_lowest_ob_db_tx_gain_1p2 ar9331_modes_low_ob_db_tx_gain_1p2 - -static const u32 ar9331_1p2_baseband_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8005}, - {0x00009820, 0x206a002e, 0x206a002e, 0x206a002e, 0x206a002e}, - {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, - {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, - {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, - {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c}, - {0x00009c00, 0x00000044, 0x00000044, 0x00000044, 0x00000044}, - {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a4, 0x037216a4}, - {0x00009e04, 0x00182020, 0x00182020, 0x00182020, 0x00182020}, - {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, - {0x00009e10, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e}, - {0x00009e14, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, - {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, - {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, - {0x00009e2c, 0x0000001c, 0x0000001c, 0x00003221, 0x00003221}, - {0x00009e3c, 0xcf946222, 0xcf946222, 0xcf946222, 0xcf946222}, - {0x00009e44, 0x02321e27, 0x02321e27, 0x02282324, 0x02282324}, - {0x00009e48, 0x5030201a, 0x5030201a, 0x50302010, 0x50302010}, - {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, - {0x0000a204, 0x00003fc0, 0x00003fc4, 0x00003fc4, 0x00003fc0}, - {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, - {0x0000a230, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b}, - {0x0000a234, 0x00000fff, 0x00000fff, 0x10000fff, 0x00000fff}, - {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018}, - {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002}, - {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, - {0x0000a260, 0x3a021501, 0x3a021501, 0x3a021501, 0x3a021501}, - {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b}, - {0x0000a284, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, - {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071981}, - {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, - {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000ae04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, - {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, -}; - -static const u32 ar9331_1p2_radio_core[][2] = { - /* Addr allmodes */ - {0x00016000, 0x36db6db6}, - {0x00016004, 0x6db6db40}, - {0x00016008, 0x73800000}, - {0x0001600c, 0x00000000}, - {0x00016040, 0x7f80fff8}, - {0x00016044, 0x03d6d2db}, - {0x00016048, 0x6c924268}, - {0x0001604c, 0x000f0278}, - {0x00016050, 0x4db6db8c}, - {0x00016054, 0x6db60000}, - {0x00016080, 0x00080000}, - {0x00016084, 0x0e48048c}, - {0x00016088, 0x14214514}, - {0x0001608c, 0x119f081c}, - {0x00016090, 0x24926490}, - {0x00016098, 0xd411eb84}, - {0x000160a0, 0xc2108ffe}, - {0x000160a4, 0x812fc370}, - {0x000160a8, 0x423c8000}, - {0x000160ac, 0x24651800}, - {0x000160b0, 0x03284f3e}, - {0x000160b4, 0x92480040}, - {0x000160c0, 0x006db6db}, - {0x000160c4, 0x0186db60}, - {0x000160c8, 0x6db6db6c}, - {0x000160cc, 0x6de6c300}, - {0x000160d0, 0x14500820}, - {0x00016100, 0x04cb0001}, - {0x00016104, 0xfff80015}, - {0x00016108, 0x00080010}, - {0x0001610c, 0x00170000}, - {0x00016140, 0x10804000}, - {0x00016144, 0x01884080}, - {0x00016148, 0x000080c0}, - {0x00016280, 0x01000015}, - {0x00016284, 0x14d20000}, - {0x00016288, 0x00318000}, - {0x0001628c, 0x50000000}, - {0x00016290, 0x4b96210f}, - {0x00016380, 0x00000000}, - {0x00016384, 0x00000000}, - {0x00016388, 0x00800700}, - {0x0001638c, 0x00800700}, - {0x00016390, 0x00800700}, - {0x00016394, 0x00000000}, - {0x00016398, 0x00000000}, - {0x0001639c, 0x00000000}, - {0x000163a0, 0x00000001}, - {0x000163a4, 0x00000001}, - {0x000163a8, 0x00000000}, - {0x000163ac, 0x00000000}, - {0x000163b0, 0x00000000}, - {0x000163b4, 0x00000000}, - {0x000163b8, 0x00000000}, - {0x000163bc, 0x00000000}, - {0x000163c0, 0x000000a0}, - {0x000163c4, 0x000c0000}, - {0x000163c8, 0x14021402}, - {0x000163cc, 0x00001402}, - {0x000163d0, 0x00000000}, - {0x000163d4, 0x00000000}, -}; - -#define ar9331_1p2_baseband_core_txfir_coeff_japan_2484 ar9331_1p1_baseband_core_txfir_coeff_japan_2484 - -#define ar9331_1p2_xtal_25M ar9331_1p1_xtal_25M - -#define ar9331_1p2_xtal_40M ar9331_1p1_xtal_40M - -#define ar9331_1p2_baseband_core ar9331_1p1_baseband_core - -#define ar9331_1p2_soc_postamble ar9331_1p1_soc_postamble - -#define ar9331_1p2_mac_postamble ar9331_1p1_mac_postamble - -#define ar9331_1p2_soc_preamble ar9331_1p1_soc_preamble - -#define ar9331_1p2_mac_core ar9331_1p1_mac_core - -#define ar9331_common_wo_xlna_rx_gain_1p2 ar9331_common_wo_xlna_rx_gain_1p1 - -#define ar9331_common_rx_gain_1p2 ar9485_common_rx_gain_1_1 - -#endif /* INITVALS_9330_1P2_H */ diff --git a/drivers/net/wireless/ath/ath9k/ar9340_initvals.h b/drivers/net/wireless/ath/ath9k/ar9340_initvals.h deleted file mode 100644 index 25db9215985a..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9340_initvals.h +++ /dev/null @@ -1,1450 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef INITVALS_9340_H -#define INITVALS_9340_H - -static const u32 ar9340_1p0_radio_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x000160ac, 0xa4646800, 0xa4646800, 0xa4646800, 0xa4646800}, - {0x0001610c, 0x08000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00016140, 0x10804000, 0x10804000, 0x50804000, 0x50804000}, - {0x0001650c, 0x08000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00016540, 0x10804000, 0x10804000, 0x50804000, 0x50804000}, -}; - -static const u32 ar9340Modes_lowest_ob_db_tx_gain_table_1p0[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, - {0x0000a518, 0x21020220, 0x21020220, 0x16000402, 0x16000402}, - {0x0000a51c, 0x27020223, 0x27020223, 0x19000404, 0x19000404}, - {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, - {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, - {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, - {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, - {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, - {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861}, - {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81}, - {0x0000a54c, 0x5c04286b, 0x5c04286b, 0x47001a83, 0x47001a83}, - {0x0000a550, 0x61042a6c, 0x61042a6c, 0x4a001c84, 0x4a001c84}, - {0x0000a554, 0x66062a6c, 0x66062a6c, 0x4e001ce3, 0x4e001ce3}, - {0x0000a558, 0x6b062e6c, 0x6b062e6c, 0x52001ce5, 0x52001ce5}, - {0x0000a55c, 0x7006308c, 0x7006308c, 0x56001ce9, 0x56001ce9}, - {0x0000a560, 0x730a308a, 0x730a308a, 0x5a001ceb, 0x5a001ceb}, - {0x0000a564, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a568, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a56c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a570, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a574, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a578, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a57c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, - {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, - {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, - {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, - {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, - {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400}, - {0x0000a598, 0x21820220, 0x21820220, 0x16800402, 0x16800402}, - {0x0000a59c, 0x27820223, 0x27820223, 0x19800404, 0x19800404}, - {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603}, - {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02}, - {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04}, - {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20}, - {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20}, - {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22}, - {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24}, - {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640}, - {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660}, - {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3f801861, 0x3f801861}, - {0x0000a5c8, 0x5782286c, 0x5782286c, 0x43801a81, 0x43801a81}, - {0x0000a5cc, 0x5c84286b, 0x5c84286b, 0x47801a83, 0x47801a83}, - {0x0000a5d0, 0x61842a6c, 0x61842a6c, 0x4a801c84, 0x4a801c84}, - {0x0000a5d4, 0x66862a6c, 0x66862a6c, 0x4e801ce3, 0x4e801ce3}, - {0x0000a5d8, 0x6b862e6c, 0x6b862e6c, 0x52801ce5, 0x52801ce5}, - {0x0000a5dc, 0x7086308c, 0x7086308c, 0x56801ce9, 0x56801ce9}, - {0x0000a5e0, 0x738a308a, 0x738a308a, 0x5a801ceb, 0x5a801ceb}, - {0x0000a5e4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, - {0x0000a5e8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, - {0x0000a5ec, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, - {0x0000a5f0, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, - {0x0000a5f4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, - {0x0000a5f8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, - {0x0000a5fc, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, - {0x00016044, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, - {0x00016048, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, - {0x00016444, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, - {0x00016448, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, -}; - -#define ar9340Modes_fast_clock_1p0 ar9300Modes_fast_clock_2p2 - -static const u32 ar9340_1p0_radio_core[][2] = { - /* Addr allmodes */ - {0x00016000, 0x36db6db6}, - {0x00016004, 0x6db6db40}, - {0x00016008, 0x73f00000}, - {0x0001600c, 0x00000000}, - {0x00016040, 0x7f80fff8}, - {0x00016044, 0x03b6d2db}, - {0x00016048, 0x24925266}, - {0x0001604c, 0x000f0278}, - {0x00016050, 0x6db6db6c}, - {0x00016054, 0x6db60000}, - {0x00016080, 0x00080000}, - {0x00016084, 0x0e48048c}, - {0x00016088, 0x14214514}, - {0x0001608c, 0x119f081c}, - {0x00016090, 0x24926490}, - {0x00016094, 0x00000000}, - {0x00016098, 0xd411eb84}, - {0x0001609c, 0x03e47f32}, - {0x000160a0, 0xc2108ffe}, - {0x000160a4, 0x812fc370}, - {0x000160a8, 0x423c8000}, - {0x000160ac, 0xa4646800}, - {0x000160b0, 0x00fe7f46}, - {0x000160b4, 0x92480000}, - {0x000160c0, 0x006db6db}, - {0x000160c4, 0x6db6db60}, - {0x000160c8, 0x6db6db6c}, - {0x000160cc, 0x6de6db6c}, - {0x000160d0, 0xb6da4924}, - {0x00016100, 0x04cb0001}, - {0x00016104, 0xfff80000}, - {0x00016108, 0x00080010}, - {0x00016140, 0x50804008}, - {0x00016144, 0x01884080}, - {0x00016148, 0x000080c0}, - {0x00016280, 0x01000015}, - {0x00016284, 0x15530000}, - {0x00016288, 0x00318000}, - {0x0001628c, 0x50000000}, - {0x00016380, 0x00000000}, - {0x00016384, 0x00000000}, - {0x00016388, 0x00800700}, - {0x0001638c, 0x00800700}, - {0x00016390, 0x00800700}, - {0x00016394, 0x00000000}, - {0x00016398, 0x00000000}, - {0x0001639c, 0x00000000}, - {0x000163a0, 0x00000001}, - {0x000163a4, 0x00000001}, - {0x000163a8, 0x00000000}, - {0x000163ac, 0x00000000}, - {0x000163b0, 0x00000000}, - {0x000163b4, 0x00000000}, - {0x000163b8, 0x00000000}, - {0x000163bc, 0x00000000}, - {0x000163c0, 0x000000a0}, - {0x000163c4, 0x000c0000}, - {0x000163c8, 0x14021402}, - {0x000163cc, 0x00001402}, - {0x000163d0, 0x00000000}, - {0x000163d4, 0x00000000}, - {0x00016400, 0x36db6db6}, - {0x00016404, 0x6db6db40}, - {0x00016408, 0x73f00000}, - {0x0001640c, 0x00000000}, - {0x00016440, 0x7f80fff8}, - {0x00016444, 0x03b6d2db}, - {0x00016448, 0x24927266}, - {0x0001644c, 0x000f0278}, - {0x00016450, 0x6db6db6c}, - {0x00016454, 0x6db60000}, - {0x00016500, 0x04cb0001}, - {0x00016504, 0xfff80000}, - {0x00016508, 0x00080010}, - {0x0001650c, 0x00000000}, - {0x00016540, 0x50804008}, - {0x00016544, 0x01884080}, - {0x00016548, 0x000080c0}, - {0x00016780, 0x00000000}, - {0x00016784, 0x00000000}, - {0x00016788, 0x00800700}, - {0x0001678c, 0x00800700}, - {0x00016790, 0x00800700}, - {0x00016794, 0x00000000}, - {0x00016798, 0x00000000}, - {0x0001679c, 0x00000000}, - {0x000167a0, 0x00000001}, - {0x000167a4, 0x00000001}, - {0x000167a8, 0x00000000}, - {0x000167ac, 0x00000000}, - {0x000167b0, 0x00000000}, - {0x000167b4, 0x00000000}, - {0x000167b8, 0x00000000}, - {0x000167bc, 0x00000000}, - {0x000167c0, 0x000000a0}, - {0x000167c4, 0x000c0000}, - {0x000167c8, 0x14021402}, - {0x000167cc, 0x00001402}, - {0x000167d0, 0x00000000}, - {0x000167d4, 0x00000000}, -}; - -static const u32 ar9340_1p0_radio_core_40M[][2] = { - /* Addr allmodes */ - {0x0001609c, 0x02566f3a}, - {0x000160ac, 0xa4647c00}, - {0x000160b0, 0x01885f5a}, - {0x00008244, 0x0010f400}, - {0x0000824c, 0x0001e800}, -}; - -#define ar9340_1p0_mac_postamble ar9300_2p2_mac_postamble - -#define ar9340_1p0_soc_postamble ar9300_2p2_soc_postamble - -static const u32 ar9340_1p0_baseband_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8011, 0xd00a8011}, - {0x00009820, 0x206a022e, 0x206a022e, 0x206a022e, 0x206a022e}, - {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, - {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, - {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, - {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c}, - {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4}, - {0x00009e00, 0x0372111a, 0x0372111a, 0x037216a0, 0x037216a0}, - {0x00009e04, 0x001c2020, 0x001c2020, 0x001c2020, 0x001c2020}, - {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, - {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec88d2e, 0x7ec88d2e}, - {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3379605e, 0x33795d5e}, - {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, - {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, - {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, - {0x00009e3c, 0xcf946220, 0xcf946220, 0xcf946222, 0xcf946222}, - {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27}, - {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, - {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, - {0x0000a204, 0x00003ec0, 0x00003ec4, 0x00003ec4, 0x00003ec0}, - {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, - {0x0000a22c, 0x07e26a2f, 0x07e26a2f, 0x01026a2f, 0x01026a2f}, - {0x0000a230, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b}, - {0x0000a234, 0x00000fff, 0x10000fff, 0x10000fff, 0x00000fff}, - {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018}, - {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002}, - {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, - {0x0000a260, 0x0a021501, 0x0a021501, 0x3a021501, 0x3a021501}, - {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b}, - {0x0000a284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, - {0x0000a288, 0x00000220, 0x00000220, 0x00000110, 0x00000110}, - {0x0000a28c, 0x00011111, 0x00011111, 0x00022222, 0x00022222}, - {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, - {0x0000a2d0, 0x00041983, 0x00041983, 0x00041982, 0x00041982}, - {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a}, - {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000}, - {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, - {0x0000b284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, -}; - -static const u32 ar9340_1p0_baseband_core[][2] = { - /* Addr allmodes */ - {0x00009800, 0xafe68e30}, - {0x00009804, 0xfd14e000}, - {0x00009808, 0x9c0a9f6b}, - {0x0000980c, 0x04900000}, - {0x00009814, 0x3280c00a}, - {0x00009818, 0x00000000}, - {0x0000981c, 0x00020028}, - {0x00009834, 0x6400a190}, - {0x00009838, 0x0108ecff}, - {0x0000983c, 0x14000600}, - {0x00009880, 0x201fff00}, - {0x00009884, 0x00001042}, - {0x000098a4, 0x00200400}, - {0x000098b0, 0x32840bbe}, - {0x000098d0, 0x004b6a8e}, - {0x000098d4, 0x00000820}, - {0x000098dc, 0x00000000}, - {0x000098f0, 0x00000000}, - {0x000098f4, 0x00000000}, - {0x00009c04, 0xff55ff55}, - {0x00009c08, 0x0320ff55}, - {0x00009c0c, 0x00000000}, - {0x00009c10, 0x00000000}, - {0x00009c14, 0x00046384}, - {0x00009c18, 0x05b6b440}, - {0x00009c1c, 0x00b6b440}, - {0x00009d00, 0xc080a333}, - {0x00009d04, 0x40206c10}, - {0x00009d08, 0x009c4060}, - {0x00009d0c, 0x9883800a}, - {0x00009d10, 0x01834061}, - {0x00009d14, 0x00c0040b}, - {0x00009d18, 0x00000000}, - {0x00009e08, 0x0038230c}, - {0x00009e24, 0x990bb515}, - {0x00009e28, 0x0c6f0000}, - {0x00009e30, 0x06336f77}, - {0x00009e34, 0x6af6532f}, - {0x00009e38, 0x0cc80c00}, - {0x00009e40, 0x0d261820}, - {0x00009e4c, 0x00001004}, - {0x00009e50, 0x00ff03f1}, - {0x00009e54, 0x00000000}, - {0x00009fc0, 0x803e4788}, - {0x00009fc4, 0x0001efb5}, - {0x00009fcc, 0x40000014}, - {0x00009fd0, 0x01193b93}, - {0x0000a20c, 0x00000000}, - {0x0000a220, 0x00000000}, - {0x0000a224, 0x00000000}, - {0x0000a228, 0x10002310}, - {0x0000a23c, 0x00000000}, - {0x0000a244, 0x0c000000}, - {0x0000a2a0, 0x00000001}, - {0x0000a2c0, 0x00000001}, - {0x0000a2c8, 0x00000000}, - {0x0000a2cc, 0x18c43433}, - {0x0000a2d4, 0x00000000}, - {0x0000a2ec, 0x00000000}, - {0x0000a2f0, 0x00000000}, - {0x0000a2f4, 0x00000000}, - {0x0000a2f8, 0x00000000}, - {0x0000a344, 0x00000000}, - {0x0000a34c, 0x00000000}, - {0x0000a350, 0x0000a000}, - {0x0000a364, 0x00000000}, - {0x0000a370, 0x00000000}, - {0x0000a390, 0x00000001}, - {0x0000a394, 0x00000444}, - {0x0000a398, 0x001f0e0f}, - {0x0000a39c, 0x0075393f}, - {0x0000a3a0, 0xb79f6427}, - {0x0000a3a4, 0x00000000}, - {0x0000a3a8, 0xaaaaaaaa}, - {0x0000a3ac, 0x3c466478}, - {0x0000a3c0, 0x20202020}, - {0x0000a3c4, 0x22222220}, - {0x0000a3c8, 0x20200020}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3d8, 0x20202020}, - {0x0000a3dc, 0x20202020}, - {0x0000a3e0, 0x20202020}, - {0x0000a3e4, 0x20202020}, - {0x0000a3e8, 0x20202020}, - {0x0000a3ec, 0x20202020}, - {0x0000a3f0, 0x00000000}, - {0x0000a3f4, 0x00000000}, - {0x0000a3f8, 0x0cdbd380}, - {0x0000a3fc, 0x000f0f01}, - {0x0000a400, 0x8fa91f01}, - {0x0000a404, 0x00000000}, - {0x0000a408, 0x0e79e5c6}, - {0x0000a40c, 0x00820820}, - {0x0000a414, 0x1ce739ce}, - {0x0000a418, 0x2d001dce}, - {0x0000a41c, 0x1ce739ce}, - {0x0000a420, 0x000001ce}, - {0x0000a424, 0x1ce739ce}, - {0x0000a428, 0x000001ce}, - {0x0000a42c, 0x1ce739ce}, - {0x0000a430, 0x1ce739ce}, - {0x0000a434, 0x00000000}, - {0x0000a438, 0x00001801}, - {0x0000a43c, 0x00100000}, - {0x0000a440, 0x00000000}, - {0x0000a444, 0x00000000}, - {0x0000a448, 0x05000080}, - {0x0000a44c, 0x00000001}, - {0x0000a450, 0x00010000}, - {0x0000a458, 0x00000000}, - {0x0000a640, 0x00000000}, - {0x0000a644, 0x3fad9d74}, - {0x0000a648, 0x0048060a}, - {0x0000a64c, 0x00003c37}, - {0x0000a670, 0x03020100}, - {0x0000a674, 0x09080504}, - {0x0000a678, 0x0d0c0b0a}, - {0x0000a67c, 0x13121110}, - {0x0000a680, 0x31301514}, - {0x0000a684, 0x35343332}, - {0x0000a688, 0x00000036}, - {0x0000a690, 0x00000838}, - {0x0000a7c0, 0x00000000}, - {0x0000a7c4, 0xfffffffc}, - {0x0000a7c8, 0x00000000}, - {0x0000a7cc, 0x00000000}, - {0x0000a7d0, 0x00000000}, - {0x0000a7d4, 0x00000004}, - {0x0000a7dc, 0x00000000}, - {0x0000a8d0, 0x004b6a8e}, - {0x0000a8d4, 0x00000820}, - {0x0000a8dc, 0x00000000}, - {0x0000a8f0, 0x00000000}, - {0x0000a8f4, 0x00000000}, - {0x0000b2d0, 0x00000080}, - {0x0000b2d4, 0x00000000}, - {0x0000b2ec, 0x00000000}, - {0x0000b2f0, 0x00000000}, - {0x0000b2f4, 0x00000000}, - {0x0000b2f8, 0x00000000}, - {0x0000b408, 0x0e79e5c0}, - {0x0000b40c, 0x00820820}, - {0x0000b420, 0x00000000}, -}; - -static const u32 ar9340Modes_high_power_tx_gain_table_1p0[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, - {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, - {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, - {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, - {0x0000a504, 0x04002222, 0x04002222, 0x02000001, 0x02000001}, - {0x0000a508, 0x09002421, 0x09002421, 0x05000003, 0x05000003}, - {0x0000a50c, 0x0d002621, 0x0d002621, 0x0a000005, 0x0a000005}, - {0x0000a510, 0x13004620, 0x13004620, 0x0e000201, 0x0e000201}, - {0x0000a514, 0x19004a20, 0x19004a20, 0x11000203, 0x11000203}, - {0x0000a518, 0x1d004e20, 0x1d004e20, 0x14000401, 0x14000401}, - {0x0000a51c, 0x21005420, 0x21005420, 0x18000403, 0x18000403}, - {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000602, 0x1b000602}, - {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000802, 0x1f000802}, - {0x0000a528, 0x2f005e42, 0x2f005e42, 0x21000620, 0x21000620}, - {0x0000a52c, 0x33005e44, 0x33005e44, 0x25000820, 0x25000820}, - {0x0000a530, 0x38005e65, 0x38005e65, 0x29000822, 0x29000822}, - {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2d000824, 0x2d000824}, - {0x0000a538, 0x40005e6b, 0x40005e6b, 0x30000828, 0x30000828}, - {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x3400082a, 0x3400082a}, - {0x0000a540, 0x49005e72, 0x49005e72, 0x38000849, 0x38000849}, - {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b000a2c, 0x3b000a2c}, - {0x0000a548, 0x53005f12, 0x53005f12, 0x3e000e2b, 0x3e000e2b}, - {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42000e2d, 0x42000e2d}, - {0x0000a550, 0x5e025f12, 0x5e025f12, 0x4500124a, 0x4500124a}, - {0x0000a554, 0x61027f12, 0x61027f12, 0x4900124c, 0x4900124c}, - {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c00126c, 0x4c00126c}, - {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x4f00128c, 0x4f00128c}, - {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x52001290, 0x52001290}, - {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001292, 0x56001292}, - {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001292, 0x56001292}, - {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001292, 0x56001292}, - {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001292, 0x56001292}, - {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001292, 0x56001292}, - {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001292, 0x56001292}, - {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001292, 0x56001292}, - {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, - {0x0000a584, 0x04802222, 0x04802222, 0x02800001, 0x02800001}, - {0x0000a588, 0x09802421, 0x09802421, 0x05800003, 0x05800003}, - {0x0000a58c, 0x0d802621, 0x0d802621, 0x0a800005, 0x0a800005}, - {0x0000a590, 0x13804620, 0x13804620, 0x0e800201, 0x0e800201}, - {0x0000a594, 0x19804a20, 0x19804a20, 0x11800203, 0x11800203}, - {0x0000a598, 0x1d804e20, 0x1d804e20, 0x14800401, 0x14800401}, - {0x0000a59c, 0x21805420, 0x21805420, 0x18800403, 0x18800403}, - {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800602, 0x1b800602}, - {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800802, 0x1f800802}, - {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x21800620, 0x21800620}, - {0x0000a5ac, 0x33805e44, 0x33805e44, 0x25800820, 0x25800820}, - {0x0000a5b0, 0x38805e65, 0x38805e65, 0x29800822, 0x29800822}, - {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2d800824, 0x2d800824}, - {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x30800828, 0x30800828}, - {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x3480082a, 0x3480082a}, - {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38800849, 0x38800849}, - {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b800a2c, 0x3b800a2c}, - {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e800e2b, 0x3e800e2b}, - {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42800e2d, 0x42800e2d}, - {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x4580124a, 0x4580124a}, - {0x0000a5d4, 0x61827f12, 0x61827f12, 0x4980124c, 0x4980124c}, - {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c80126c, 0x4c80126c}, - {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x4f80128c, 0x4f80128c}, - {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x52801290, 0x52801290}, - {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801292, 0x56801292}, - {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801292, 0x56801292}, - {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801292, 0x56801292}, - {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801292, 0x56801292}, - {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801292, 0x56801292}, - {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801292, 0x56801292}, - {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801292, 0x56801292}, - {0x00016044, 0x056db2db, 0x056db2db, 0x022492db, 0x022492db}, - {0x00016048, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, - {0x00016444, 0x056db2db, 0x056db2db, 0x022492db, 0x022492db}, - {0x00016448, 0x24925266, 0x24925266, 0x24925266, 0x24925266}, -}; - -static const u32 ar9340Modes_high_ob_db_tx_gain_table_1p0[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x01feee00, 0x01feee00, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x0000f000, 0x0000f000, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x01ff0000, 0x01ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, - {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, - {0x0000a508, 0x09002421, 0x09002421, 0x08000004, 0x08000004}, - {0x0000a50c, 0x0d002621, 0x0d002621, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x13004620, 0x13004620, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x19004a20, 0x19004a20, 0x11000400, 0x11000400}, - {0x0000a518, 0x1d004e20, 0x1d004e20, 0x15000402, 0x15000402}, - {0x0000a51c, 0x21005420, 0x21005420, 0x19000404, 0x19000404}, - {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000603, 0x1b000603}, - {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000a02, 0x1f000a02}, - {0x0000a528, 0x2f005e42, 0x2f005e42, 0x23000a04, 0x23000a04}, - {0x0000a52c, 0x33005e44, 0x33005e44, 0x26000a20, 0x26000a20}, - {0x0000a530, 0x38005e65, 0x38005e65, 0x2a000e20, 0x2a000e20}, - {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2e000e22, 0x2e000e22}, - {0x0000a538, 0x40005e6b, 0x40005e6b, 0x31000e24, 0x31000e24}, - {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x34001640, 0x34001640}, - {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, - {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, - {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, - {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83}, - {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, - {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, - {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, - {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x50001ce9, 0x50001ce9}, - {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x54001ceb, 0x54001ceb}, - {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, - {0x0000a584, 0x04802222, 0x04802222, 0x04800002, 0x04800002}, - {0x0000a588, 0x09802421, 0x09802421, 0x08800004, 0x08800004}, - {0x0000a58c, 0x0d802621, 0x0d802621, 0x0b800200, 0x0b800200}, - {0x0000a590, 0x13804620, 0x13804620, 0x0f800202, 0x0f800202}, - {0x0000a594, 0x19804a20, 0x19804a20, 0x11800400, 0x11800400}, - {0x0000a598, 0x1d804e20, 0x1d804e20, 0x15800402, 0x15800402}, - {0x0000a59c, 0x21805420, 0x21805420, 0x19800404, 0x19800404}, - {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800603, 0x1b800603}, - {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800a02, 0x1f800a02}, - {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x23800a04, 0x23800a04}, - {0x0000a5ac, 0x33805e44, 0x33805e44, 0x26800a20, 0x26800a20}, - {0x0000a5b0, 0x38805e65, 0x38805e65, 0x2a800e20, 0x2a800e20}, - {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2e800e22, 0x2e800e22}, - {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x31800e24, 0x31800e24}, - {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x34801640, 0x34801640}, - {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38801660, 0x38801660}, - {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b801861, 0x3b801861}, - {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e801a81, 0x3e801a81}, - {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42801a83, 0x42801a83}, - {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x44801c84, 0x44801c84}, - {0x0000a5d4, 0x61827f12, 0x61827f12, 0x48801ce3, 0x48801ce3}, - {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c801ce5, 0x4c801ce5}, - {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x50801ce9, 0x50801ce9}, - {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x54801ceb, 0x54801ceb}, - {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, - {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, - {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501}, - {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501}, - {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x01feee00, 0x01feee00, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x0000f000, 0x0000f000, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x01ff0000, 0x01ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4}, - {0x00016048, 0x8e481666, 0x8e481666, 0x8e481266, 0x8e481266}, - {0x00016280, 0x01000015, 0x01000015, 0x01001015, 0x01001015}, - {0x00016444, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4}, - {0x00016448, 0x8e481666, 0x8e481666, 0x8e481266, 0x8e481266}, -}; - -static const u32 ar9340Modes_ub124_tx_gain_table_1p0[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8005}, - {0x00009820, 0x206a022e, 0x206a022e, 0x206a00ae, 0x206a00ae}, - {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c}, - {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec82d2e, 0x7ec82d2e}, - {0x0000a2dc, 0xfef5d402, 0xfef5d402, 0xfdab5b52, 0xfdab5b52}, - {0x0000a2e0, 0xfe896600, 0xfe896600, 0xfd339c84, 0xfd339c84}, - {0x0000a2e4, 0xff01f800, 0xff01f800, 0xfec3e000, 0xfec3e000}, - {0x0000a2e8, 0xfffe0000, 0xfffe0000, 0xfffc0000, 0xfffc0000}, - {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, - {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, - {0x0000a508, 0x09002421, 0x09002421, 0x08000004, 0x08000004}, - {0x0000a50c, 0x0d002621, 0x0d002621, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x13004620, 0x13004620, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x19004a20, 0x19004a20, 0x11000400, 0x11000400}, - {0x0000a518, 0x1d004e20, 0x1d004e20, 0x15000402, 0x15000402}, - {0x0000a51c, 0x21005420, 0x21005420, 0x19000404, 0x19000404}, - {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000603, 0x1b000603}, - {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000a02, 0x1f000a02}, - {0x0000a528, 0x2f005e42, 0x2f005e42, 0x23000a04, 0x23000a04}, - {0x0000a52c, 0x33005e44, 0x33005e44, 0x26000a20, 0x26000a20}, - {0x0000a530, 0x38005e65, 0x38005e65, 0x2a000e20, 0x2a000e20}, - {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2e000e22, 0x2e000e22}, - {0x0000a538, 0x40005e6b, 0x40005e6b, 0x31000e24, 0x31000e24}, - {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x34001640, 0x34001640}, - {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, - {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, - {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, - {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, - {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, - {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, - {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, - {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x50001ce9, 0x50001ce9}, - {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x54001ceb, 0x54001ceb}, - {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, - {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, - {0x0000a584, 0x04802222, 0x04802222, 0x04800002, 0x04800002}, - {0x0000a588, 0x09802421, 0x09802421, 0x08800004, 0x08800004}, - {0x0000a58c, 0x0d802621, 0x0d802621, 0x0b800200, 0x0b800200}, - {0x0000a590, 0x13804620, 0x13804620, 0x0f800202, 0x0f800202}, - {0x0000a594, 0x19804a20, 0x19804a20, 0x11800400, 0x11800400}, - {0x0000a598, 0x1d804e20, 0x1d804e20, 0x15800402, 0x15800402}, - {0x0000a59c, 0x21805420, 0x21805420, 0x19800404, 0x19800404}, - {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800603, 0x1b800603}, - {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800a02, 0x1f800a02}, - {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x23800a04, 0x23800a04}, - {0x0000a5ac, 0x33805e44, 0x33805e44, 0x26800a20, 0x26800a20}, - {0x0000a5b0, 0x38805e65, 0x38805e65, 0x2a800e20, 0x2a800e20}, - {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2e800e22, 0x2e800e22}, - {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x31800e24, 0x31800e24}, - {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x34801640, 0x34801640}, - {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38801660, 0x38801660}, - {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b801861, 0x3b801861}, - {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e801a81, 0x3e801a81}, - {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42801a83, 0x42801a83}, - {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x44801c84, 0x44801c84}, - {0x0000a5d4, 0x61827f12, 0x61827f12, 0x48801ce3, 0x48801ce3}, - {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c801ce5, 0x4c801ce5}, - {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x50801ce9, 0x50801ce9}, - {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x54801ceb, 0x54801ceb}, - {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, - {0x00016044, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4}, - {0x00016048, 0x8e480086, 0x8e480086, 0x8e480086, 0x8e480086}, - {0x00016444, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4, 0x03b6d2e4}, - {0x00016448, 0x8e480086, 0x8e480086, 0x8e480086, 0x8e480086}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, - {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, - {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501}, - {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501}, - {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000b2dc, 0xfef5d402, 0xfef5d402, 0xfdab5b52, 0xfdab5b52}, - {0x0000b2e0, 0xfe896600, 0xfe896600, 0xfd339c84, 0xfd339c84}, - {0x0000b2e4, 0xff01f800, 0xff01f800, 0xfec3e000, 0xfec3e000}, - {0x0000b2e8, 0xfffe0000, 0xfffe0000, 0xfffc0000, 0xfffc0000}, -}; - -static const u32 ar9340Common_rx_gain_table_1p0[][2] = { - /* Addr allmodes */ - {0x0000a000, 0x00010000}, - {0x0000a004, 0x00030002}, - {0x0000a008, 0x00050004}, - {0x0000a00c, 0x00810080}, - {0x0000a010, 0x00830082}, - {0x0000a014, 0x01810180}, - {0x0000a018, 0x01830182}, - {0x0000a01c, 0x01850184}, - {0x0000a020, 0x01890188}, - {0x0000a024, 0x018b018a}, - {0x0000a028, 0x018d018c}, - {0x0000a02c, 0x01910190}, - {0x0000a030, 0x01930192}, - {0x0000a034, 0x01950194}, - {0x0000a038, 0x038a0196}, - {0x0000a03c, 0x038c038b}, - {0x0000a040, 0x0390038d}, - {0x0000a044, 0x03920391}, - {0x0000a048, 0x03940393}, - {0x0000a04c, 0x03960395}, - {0x0000a050, 0x00000000}, - {0x0000a054, 0x00000000}, - {0x0000a058, 0x00000000}, - {0x0000a05c, 0x00000000}, - {0x0000a060, 0x00000000}, - {0x0000a064, 0x00000000}, - {0x0000a068, 0x00000000}, - {0x0000a06c, 0x00000000}, - {0x0000a070, 0x00000000}, - {0x0000a074, 0x00000000}, - {0x0000a078, 0x00000000}, - {0x0000a07c, 0x00000000}, - {0x0000a080, 0x22222229}, - {0x0000a084, 0x1d1d1d1d}, - {0x0000a088, 0x1d1d1d1d}, - {0x0000a08c, 0x1d1d1d1d}, - {0x0000a090, 0x171d1d1d}, - {0x0000a094, 0x11111717}, - {0x0000a098, 0x00030311}, - {0x0000a09c, 0x00000000}, - {0x0000a0a0, 0x00000000}, - {0x0000a0a4, 0x00000000}, - {0x0000a0a8, 0x00000000}, - {0x0000a0ac, 0x00000000}, - {0x0000a0b0, 0x00000000}, - {0x0000a0b4, 0x00000000}, - {0x0000a0b8, 0x00000000}, - {0x0000a0bc, 0x00000000}, - {0x0000a0c0, 0x001f0000}, - {0x0000a0c4, 0x01000101}, - {0x0000a0c8, 0x011e011f}, - {0x0000a0cc, 0x011c011d}, - {0x0000a0d0, 0x02030204}, - {0x0000a0d4, 0x02010202}, - {0x0000a0d8, 0x021f0200}, - {0x0000a0dc, 0x0302021e}, - {0x0000a0e0, 0x03000301}, - {0x0000a0e4, 0x031e031f}, - {0x0000a0e8, 0x0402031d}, - {0x0000a0ec, 0x04000401}, - {0x0000a0f0, 0x041e041f}, - {0x0000a0f4, 0x0502041d}, - {0x0000a0f8, 0x05000501}, - {0x0000a0fc, 0x051e051f}, - {0x0000a100, 0x06010602}, - {0x0000a104, 0x061f0600}, - {0x0000a108, 0x061d061e}, - {0x0000a10c, 0x07020703}, - {0x0000a110, 0x07000701}, - {0x0000a114, 0x00000000}, - {0x0000a118, 0x00000000}, - {0x0000a11c, 0x00000000}, - {0x0000a120, 0x00000000}, - {0x0000a124, 0x00000000}, - {0x0000a128, 0x00000000}, - {0x0000a12c, 0x00000000}, - {0x0000a130, 0x00000000}, - {0x0000a134, 0x00000000}, - {0x0000a138, 0x00000000}, - {0x0000a13c, 0x00000000}, - {0x0000a140, 0x001f0000}, - {0x0000a144, 0x01000101}, - {0x0000a148, 0x011e011f}, - {0x0000a14c, 0x011c011d}, - {0x0000a150, 0x02030204}, - {0x0000a154, 0x02010202}, - {0x0000a158, 0x021f0200}, - {0x0000a15c, 0x0302021e}, - {0x0000a160, 0x03000301}, - {0x0000a164, 0x031e031f}, - {0x0000a168, 0x0402031d}, - {0x0000a16c, 0x04000401}, - {0x0000a170, 0x041e041f}, - {0x0000a174, 0x0502041d}, - {0x0000a178, 0x05000501}, - {0x0000a17c, 0x051e051f}, - {0x0000a180, 0x06010602}, - {0x0000a184, 0x061f0600}, - {0x0000a188, 0x061d061e}, - {0x0000a18c, 0x07020703}, - {0x0000a190, 0x07000701}, - {0x0000a194, 0x00000000}, - {0x0000a198, 0x00000000}, - {0x0000a19c, 0x00000000}, - {0x0000a1a0, 0x00000000}, - {0x0000a1a4, 0x00000000}, - {0x0000a1a8, 0x00000000}, - {0x0000a1ac, 0x00000000}, - {0x0000a1b0, 0x00000000}, - {0x0000a1b4, 0x00000000}, - {0x0000a1b8, 0x00000000}, - {0x0000a1bc, 0x00000000}, - {0x0000a1c0, 0x00000000}, - {0x0000a1c4, 0x00000000}, - {0x0000a1c8, 0x00000000}, - {0x0000a1cc, 0x00000000}, - {0x0000a1d0, 0x00000000}, - {0x0000a1d4, 0x00000000}, - {0x0000a1d8, 0x00000000}, - {0x0000a1dc, 0x00000000}, - {0x0000a1e0, 0x00000000}, - {0x0000a1e4, 0x00000000}, - {0x0000a1e8, 0x00000000}, - {0x0000a1ec, 0x00000000}, - {0x0000a1f0, 0x00000396}, - {0x0000a1f4, 0x00000396}, - {0x0000a1f8, 0x00000396}, - {0x0000a1fc, 0x00000196}, - {0x0000b000, 0x00010000}, - {0x0000b004, 0x00030002}, - {0x0000b008, 0x00050004}, - {0x0000b00c, 0x00810080}, - {0x0000b010, 0x00830082}, - {0x0000b014, 0x01810180}, - {0x0000b018, 0x01830182}, - {0x0000b01c, 0x01850184}, - {0x0000b020, 0x02810280}, - {0x0000b024, 0x02830282}, - {0x0000b028, 0x02850284}, - {0x0000b02c, 0x02890288}, - {0x0000b030, 0x028b028a}, - {0x0000b034, 0x0388028c}, - {0x0000b038, 0x038a0389}, - {0x0000b03c, 0x038c038b}, - {0x0000b040, 0x0390038d}, - {0x0000b044, 0x03920391}, - {0x0000b048, 0x03940393}, - {0x0000b04c, 0x03960395}, - {0x0000b050, 0x00000000}, - {0x0000b054, 0x00000000}, - {0x0000b058, 0x00000000}, - {0x0000b05c, 0x00000000}, - {0x0000b060, 0x00000000}, - {0x0000b064, 0x00000000}, - {0x0000b068, 0x00000000}, - {0x0000b06c, 0x00000000}, - {0x0000b070, 0x00000000}, - {0x0000b074, 0x00000000}, - {0x0000b078, 0x00000000}, - {0x0000b07c, 0x00000000}, - {0x0000b080, 0x23232323}, - {0x0000b084, 0x21232323}, - {0x0000b088, 0x19191c1e}, - {0x0000b08c, 0x12141417}, - {0x0000b090, 0x07070e0e}, - {0x0000b094, 0x03030305}, - {0x0000b098, 0x00000003}, - {0x0000b09c, 0x00000000}, - {0x0000b0a0, 0x00000000}, - {0x0000b0a4, 0x00000000}, - {0x0000b0a8, 0x00000000}, - {0x0000b0ac, 0x00000000}, - {0x0000b0b0, 0x00000000}, - {0x0000b0b4, 0x00000000}, - {0x0000b0b8, 0x00000000}, - {0x0000b0bc, 0x00000000}, - {0x0000b0c0, 0x003f0020}, - {0x0000b0c4, 0x00400041}, - {0x0000b0c8, 0x0140005f}, - {0x0000b0cc, 0x0160015f}, - {0x0000b0d0, 0x017e017f}, - {0x0000b0d4, 0x02410242}, - {0x0000b0d8, 0x025f0240}, - {0x0000b0dc, 0x027f0260}, - {0x0000b0e0, 0x0341027e}, - {0x0000b0e4, 0x035f0340}, - {0x0000b0e8, 0x037f0360}, - {0x0000b0ec, 0x04400441}, - {0x0000b0f0, 0x0460045f}, - {0x0000b0f4, 0x0541047f}, - {0x0000b0f8, 0x055f0540}, - {0x0000b0fc, 0x057f0560}, - {0x0000b100, 0x06400641}, - {0x0000b104, 0x0660065f}, - {0x0000b108, 0x067e067f}, - {0x0000b10c, 0x07410742}, - {0x0000b110, 0x075f0740}, - {0x0000b114, 0x077f0760}, - {0x0000b118, 0x07800781}, - {0x0000b11c, 0x07a0079f}, - {0x0000b120, 0x07c107bf}, - {0x0000b124, 0x000007c0}, - {0x0000b128, 0x00000000}, - {0x0000b12c, 0x00000000}, - {0x0000b130, 0x00000000}, - {0x0000b134, 0x00000000}, - {0x0000b138, 0x00000000}, - {0x0000b13c, 0x00000000}, - {0x0000b140, 0x003f0020}, - {0x0000b144, 0x00400041}, - {0x0000b148, 0x0140005f}, - {0x0000b14c, 0x0160015f}, - {0x0000b150, 0x017e017f}, - {0x0000b154, 0x02410242}, - {0x0000b158, 0x025f0240}, - {0x0000b15c, 0x027f0260}, - {0x0000b160, 0x0341027e}, - {0x0000b164, 0x035f0340}, - {0x0000b168, 0x037f0360}, - {0x0000b16c, 0x04400441}, - {0x0000b170, 0x0460045f}, - {0x0000b174, 0x0541047f}, - {0x0000b178, 0x055f0540}, - {0x0000b17c, 0x057f0560}, - {0x0000b180, 0x06400641}, - {0x0000b184, 0x0660065f}, - {0x0000b188, 0x067e067f}, - {0x0000b18c, 0x07410742}, - {0x0000b190, 0x075f0740}, - {0x0000b194, 0x077f0760}, - {0x0000b198, 0x07800781}, - {0x0000b19c, 0x07a0079f}, - {0x0000b1a0, 0x07c107bf}, - {0x0000b1a4, 0x000007c0}, - {0x0000b1a8, 0x00000000}, - {0x0000b1ac, 0x00000000}, - {0x0000b1b0, 0x00000000}, - {0x0000b1b4, 0x00000000}, - {0x0000b1b8, 0x00000000}, - {0x0000b1bc, 0x00000000}, - {0x0000b1c0, 0x00000000}, - {0x0000b1c4, 0x00000000}, - {0x0000b1c8, 0x00000000}, - {0x0000b1cc, 0x00000000}, - {0x0000b1d0, 0x00000000}, - {0x0000b1d4, 0x00000000}, - {0x0000b1d8, 0x00000000}, - {0x0000b1dc, 0x00000000}, - {0x0000b1e0, 0x00000000}, - {0x0000b1e4, 0x00000000}, - {0x0000b1e8, 0x00000000}, - {0x0000b1ec, 0x00000000}, - {0x0000b1f0, 0x00000396}, - {0x0000b1f4, 0x00000396}, - {0x0000b1f8, 0x00000396}, - {0x0000b1fc, 0x00000196}, -}; - -static const u32 ar9340Modes_low_ob_db_tx_gain_table_1p0[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, - {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402}, - {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, - {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, - {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, - {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, - {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, - {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, - {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861}, - {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81}, - {0x0000a54c, 0x5c02486b, 0x5c02486b, 0x47001a83, 0x47001a83}, - {0x0000a550, 0x61024a6c, 0x61024a6c, 0x4a001c84, 0x4a001c84}, - {0x0000a554, 0x66026a6c, 0x66026a6c, 0x4e001ce3, 0x4e001ce3}, - {0x0000a558, 0x6b026e6c, 0x6b026e6c, 0x52001ce5, 0x52001ce5}, - {0x0000a55c, 0x7002708c, 0x7002708c, 0x56001ce9, 0x56001ce9}, - {0x0000a560, 0x7302b08a, 0x7302b08a, 0x5a001ceb, 0x5a001ceb}, - {0x0000a564, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a568, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a56c, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a570, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a574, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a578, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a57c, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, - {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, - {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, - {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, - {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, - {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400}, - {0x0000a598, 0x21820220, 0x21820220, 0x16800402, 0x16800402}, - {0x0000a59c, 0x27820223, 0x27820223, 0x19800404, 0x19800404}, - {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603}, - {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02}, - {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04}, - {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20}, - {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20}, - {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22}, - {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24}, - {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640}, - {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660}, - {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3f801861, 0x3f801861}, - {0x0000a5c8, 0x5782286c, 0x5782286c, 0x43801a81, 0x43801a81}, - {0x0000a5cc, 0x5c84286b, 0x5c84286b, 0x47801a83, 0x47801a83}, - {0x0000a5d0, 0x61842a6c, 0x61842a6c, 0x4a801c84, 0x4a801c84}, - {0x0000a5d4, 0x66862a6c, 0x66862a6c, 0x4e801ce3, 0x4e801ce3}, - {0x0000a5d8, 0x6b862e6c, 0x6b862e6c, 0x52801ce5, 0x52801ce5}, - {0x0000a5dc, 0x7086308c, 0x7086308c, 0x56801ce9, 0x56801ce9}, - {0x0000a5e0, 0x738a308a, 0x738a308a, 0x5a801ceb, 0x5a801ceb}, - {0x0000a5e4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, - {0x0000a5e8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, - {0x0000a5ec, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, - {0x0000a5f0, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, - {0x0000a5f4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, - {0x0000a5f8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, - {0x0000a5fc, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, - {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, - {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, - {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, - {0x00016048, 0x24925666, 0x24925666, 0x24925266, 0x24925266}, - {0x00016280, 0x01000015, 0x01000015, 0x01001015, 0x01001015}, - {0x00016288, 0xf0318000, 0xf0318000, 0xf0318000, 0xf0318000}, - {0x00016444, 0x056db2db, 0x056db2db, 0x056db2db, 0x056db2db}, - {0x00016448, 0x24925666, 0x24925666, 0x24925266, 0x24925266}, -}; - -static const u32 ar9340Modes_mixed_ob_db_tx_gain_table_1p0[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x1c000223, 0x1c000223, 0x11000400, 0x11000400}, - {0x0000a518, 0x21002220, 0x21002220, 0x15000402, 0x15000402}, - {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, - {0x0000a520, 0x2b022220, 0x2b022220, 0x1b000603, 0x1b000603}, - {0x0000a524, 0x2f022222, 0x2f022222, 0x1f000a02, 0x1f000a02}, - {0x0000a528, 0x34022225, 0x34022225, 0x23000a04, 0x23000a04}, - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x26000a20, 0x26000a20}, - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2a000e20, 0x2a000e20}, - {0x0000a534, 0x4202242a, 0x4202242a, 0x2e000e22, 0x2e000e22}, - {0x0000a538, 0x4702244a, 0x4702244a, 0x31000e24, 0x31000e24}, - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x34001640, 0x34001640}, - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x38001660, 0x38001660}, - {0x0000a544, 0x5302266c, 0x5302266c, 0x3b001861, 0x3b001861}, - {0x0000a548, 0x5702286c, 0x5702286c, 0x3e001a81, 0x3e001a81}, - {0x0000a54c, 0x5c02486b, 0x5c02486b, 0x42001a83, 0x42001a83}, - {0x0000a550, 0x61024a6c, 0x61024a6c, 0x44001c84, 0x44001c84}, - {0x0000a554, 0x66026a6c, 0x66026a6c, 0x48001ce3, 0x48001ce3}, - {0x0000a558, 0x6b026e6c, 0x6b026e6c, 0x4c001ce5, 0x4c001ce5}, - {0x0000a55c, 0x7002708c, 0x7002708c, 0x50001ce9, 0x50001ce9}, - {0x0000a560, 0x7302b08a, 0x7302b08a, 0x54001ceb, 0x54001ceb}, - {0x0000a564, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, - {0x0000a568, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, - {0x0000a56c, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, - {0x0000a570, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, - {0x0000a574, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, - {0x0000a578, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, - {0x0000a57c, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, - {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, - {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, - {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, - {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, - {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, - {0x0000a594, 0x1c800223, 0x1c800223, 0x11800400, 0x11800400}, - {0x0000a598, 0x21820220, 0x21820220, 0x15800402, 0x15800402}, - {0x0000a59c, 0x27820223, 0x27820223, 0x19800404, 0x19800404}, - {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1b800603, 0x1b800603}, - {0x0000a5a4, 0x2f822222, 0x2f822222, 0x1f800a02, 0x1f800a02}, - {0x0000a5a8, 0x34822225, 0x34822225, 0x23800a04, 0x23800a04}, - {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x26800a20, 0x26800a20}, - {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2a800e20, 0x2a800e20}, - {0x0000a5b4, 0x4282242a, 0x4282242a, 0x2e800e22, 0x2e800e22}, - {0x0000a5b8, 0x4782244a, 0x4782244a, 0x31800e24, 0x31800e24}, - {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x34801640, 0x34801640}, - {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x38801660, 0x38801660}, - {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3b801861, 0x3b801861}, - {0x0000a5c8, 0x5782286c, 0x5782286c, 0x3e801a81, 0x3e801a81}, - {0x0000a5cc, 0x5c84286b, 0x5c84286b, 0x42801a83, 0x42801a83}, - {0x0000a5d0, 0x61842a6c, 0x61842a6c, 0x44801c84, 0x44801c84}, - {0x0000a5d4, 0x66862a6c, 0x66862a6c, 0x48801ce3, 0x48801ce3}, - {0x0000a5d8, 0x6b862e6c, 0x6b862e6c, 0x4c801ce5, 0x4c801ce5}, - {0x0000a5dc, 0x7086308c, 0x7086308c, 0x50801ce9, 0x50801ce9}, - {0x0000a5e0, 0x738a308a, 0x738a308a, 0x54801ceb, 0x54801ceb}, - {0x0000a5e4, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, - {0x0000a5e8, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, - {0x0000a5ec, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, - {0x0000a5f0, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, - {0x0000a5f4, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, - {0x0000a5f8, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, - {0x0000a5fc, 0x778a308c, 0x778a308c, 0x56801eec, 0x56801eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, - {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, - {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, - {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x056db2db, 0x056db2db, 0x03b6d2e4, 0x03b6d2e4}, - {0x00016048, 0x24925666, 0x24925666, 0x8e481266, 0x8e481266}, - {0x00016280, 0x01000015, 0x01000015, 0x01001015, 0x01001015}, - {0x00016288, 0x30318000, 0x30318000, 0x00318000, 0x00318000}, - {0x00016444, 0x056db2db, 0x056db2db, 0x03b6d2e4, 0x03b6d2e4}, - {0x00016448, 0x24925666, 0x24925666, 0x8e481266, 0x8e481266}, -}; - -static const u32 ar9340Modes_low_ob_db_and_spur_tx_gain_table_1p0[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03eaac5a, 0x03eaac5a}, - {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03f330ac, 0x03f330ac}, - {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03fc3f00, 0x03fc3f00}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ffc000, 0x03ffc000}, - {0x0000a394, 0x00000444, 0x00000444, 0x00000404, 0x00000404}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x02000001, 0x02000001}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x05000003, 0x05000003}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0a000005, 0x0a000005}, - {0x0000a510, 0x16000220, 0x16000220, 0x0e000201, 0x0e000201}, - {0x0000a514, 0x1c000223, 0x1c000223, 0x11000203, 0x11000203}, - {0x0000a518, 0x21002220, 0x21002220, 0x14000401, 0x14000401}, - {0x0000a51c, 0x27002223, 0x27002223, 0x18000403, 0x18000403}, - {0x0000a520, 0x2b022220, 0x2b022220, 0x1b000602, 0x1b000602}, - {0x0000a524, 0x2f022222, 0x2f022222, 0x1f000802, 0x1f000802}, - {0x0000a528, 0x34022225, 0x34022225, 0x21000620, 0x21000620}, - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x25000820, 0x25000820}, - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x29000822, 0x29000822}, - {0x0000a534, 0x4202242a, 0x4202242a, 0x2d000824, 0x2d000824}, - {0x0000a538, 0x4702244a, 0x4702244a, 0x30000828, 0x30000828}, - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x3400082a, 0x3400082a}, - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x38000849, 0x38000849}, - {0x0000a544, 0x5302266c, 0x5302266c, 0x3b000a2c, 0x3b000a2c}, - {0x0000a548, 0x5702286c, 0x5702286c, 0x3e000e2b, 0x3e000e2b}, - {0x0000a54c, 0x5c02486b, 0x5c02486b, 0x42000e2d, 0x42000e2d}, - {0x0000a550, 0x61024a6c, 0x61024a6c, 0x4500124a, 0x4500124a}, - {0x0000a554, 0x66026a6c, 0x66026a6c, 0x4900124c, 0x4900124c}, - {0x0000a558, 0x6b026e6c, 0x6b026e6c, 0x4c00126c, 0x4c00126c}, - {0x0000a55c, 0x7002708c, 0x7002708c, 0x4f00128c, 0x4f00128c}, - {0x0000a560, 0x7302b08a, 0x7302b08a, 0x52001290, 0x52001290}, - {0x0000a564, 0x7702b08c, 0x7702b08c, 0x56001292, 0x56001292}, - {0x0000a568, 0x7702b08c, 0x7702b08c, 0x56001292, 0x56001292}, - {0x0000a56c, 0x7702b08c, 0x7702b08c, 0x56001292, 0x56001292}, - {0x0000a570, 0x7702b08c, 0x7702b08c, 0x56001292, 0x56001292}, - {0x0000a574, 0x7702b08c, 0x7702b08c, 0x56001292, 0x56001292}, - {0x0000a578, 0x7702b08c, 0x7702b08c, 0x56001292, 0x56001292}, - {0x0000a57c, 0x7702b08c, 0x7702b08c, 0x56001292, 0x56001292}, - {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, - {0x0000a584, 0x06800003, 0x06800003, 0x02800001, 0x02800001}, - {0x0000a588, 0x0a800020, 0x0a800020, 0x05800003, 0x05800003}, - {0x0000a58c, 0x10800023, 0x10800023, 0x0a800005, 0x0a800005}, - {0x0000a590, 0x16800220, 0x16800220, 0x0e800201, 0x0e800201}, - {0x0000a594, 0x1c800223, 0x1c800223, 0x11800203, 0x11800203}, - {0x0000a598, 0x21820220, 0x21820220, 0x14800401, 0x14800401}, - {0x0000a59c, 0x27820223, 0x27820223, 0x18800403, 0x18800403}, - {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1b800602, 0x1b800602}, - {0x0000a5a4, 0x2f822222, 0x2f822222, 0x1f800802, 0x1f800802}, - {0x0000a5a8, 0x34822225, 0x34822225, 0x21800620, 0x21800620}, - {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x25800820, 0x25800820}, - {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x29800822, 0x29800822}, - {0x0000a5b4, 0x4282242a, 0x4282242a, 0x2d800824, 0x2d800824}, - {0x0000a5b8, 0x4782244a, 0x4782244a, 0x30800828, 0x30800828}, - {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x3480082a, 0x3480082a}, - {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x38800849, 0x38800849}, - {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3b800a2c, 0x3b800a2c}, - {0x0000a5c8, 0x5782286c, 0x5782286c, 0x3e800e2b, 0x3e800e2b}, - {0x0000a5cc, 0x5c84286b, 0x5c84286b, 0x42800e2d, 0x42800e2d}, - {0x0000a5d0, 0x61842a6c, 0x61842a6c, 0x4580124a, 0x4580124a}, - {0x0000a5d4, 0x66862a6c, 0x66862a6c, 0x4980124c, 0x4980124c}, - {0x0000a5d8, 0x6b862e6c, 0x6b862e6c, 0x4c80126c, 0x4c80126c}, - {0x0000a5dc, 0x7086308c, 0x7086308c, 0x4f80128c, 0x4f80128c}, - {0x0000a5e0, 0x738a308a, 0x738a308a, 0x52801290, 0x52801290}, - {0x0000a5e4, 0x778a308c, 0x778a308c, 0x56801292, 0x56801292}, - {0x0000a5e8, 0x778a308c, 0x778a308c, 0x56801292, 0x56801292}, - {0x0000a5ec, 0x778a308c, 0x778a308c, 0x56801292, 0x56801292}, - {0x0000a5f0, 0x778a308c, 0x778a308c, 0x56801292, 0x56801292}, - {0x0000a5f4, 0x778a308c, 0x778a308c, 0x56801292, 0x56801292}, - {0x0000a5f8, 0x778a308c, 0x778a308c, 0x56801292, 0x56801292}, - {0x0000a5fc, 0x778a308c, 0x778a308c, 0x56801292, 0x56801292}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x01404000, 0x01404000, 0x01404501, 0x01404501}, - {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02008802, 0x02008802, 0x01404501, 0x01404501}, - {0x0000a620, 0x0300cc03, 0x0300cc03, 0x03c0cf02, 0x03c0cf02}, - {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03c0cf03, 0x03c0cf03}, - {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04011004, 0x04011004}, - {0x0000a62c, 0x03810c03, 0x03810c03, 0x05419405, 0x05419405}, - {0x0000a630, 0x03810e04, 0x03810e04, 0x05419506, 0x05419506}, - {0x0000a634, 0x03810e04, 0x03810e04, 0x05419506, 0x05419506}, - {0x0000a638, 0x03810e04, 0x03810e04, 0x05419506, 0x05419506}, - {0x0000a63c, 0x03810e04, 0x03810e04, 0x05419506, 0x05419506}, - {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03eaac5a, 0x03eaac5a}, - {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03f330ac, 0x03f330ac}, - {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03fc3f00, 0x03fc3f00}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ffc000, 0x03ffc000}, - {0x00016044, 0x022492db, 0x022492db, 0x022492db, 0x022492db}, - {0x00016048, 0x24925666, 0x24925666, 0x24925266, 0x24925266}, - {0x00016280, 0x01000015, 0x01000015, 0x01001015, 0x01001015}, - {0x00016288, 0xf0318000, 0xf0318000, 0xf0318000, 0xf0318000}, - {0x00016444, 0x022492db, 0x022492db, 0x022492db, 0x022492db}, - {0x00016448, 0x24925666, 0x24925666, 0x24925266, 0x24925266}, -}; - -static const u32 ar9340_1p0_mac_core[][2] = { - /* Addr allmodes */ - {0x00000008, 0x00000000}, - {0x00000030, 0x00020085}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000000}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x000010f0, 0x00000100}, - {0x00001270, 0x00000000}, - {0x000012b0, 0x00000000}, - {0x000012f0, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00008000, 0x00000000}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008010, 0x00080800}, - {0x00008018, 0x00000000}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00000000}, - {0x00008040, 0x00000000}, - {0x00008044, 0x00000000}, - {0x00008048, 0x00000000}, - {0x0000804c, 0xffffffff}, - {0x00008054, 0x00000000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x00008070, 0x00000310}, - {0x00008074, 0x00000020}, - {0x00008078, 0x00000000}, - {0x0000809c, 0x0000000f}, - {0x000080a0, 0x00000000}, - {0x000080a4, 0x02ff0000}, - {0x000080a8, 0x0e070605}, - {0x000080ac, 0x0000000d}, - {0x000080b0, 0x00000000}, - {0x000080b4, 0x00000000}, - {0x000080b8, 0x00000000}, - {0x000080bc, 0x00000000}, - {0x000080c0, 0x2a800000}, - {0x000080c4, 0x06900168}, - {0x000080c8, 0x13881c22}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00252500}, - {0x000080d4, 0x00a00000}, - {0x000080d8, 0x00400000}, - {0x000080dc, 0x00000000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x3f3f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00000000}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000000}, - {0x00008114, 0x000007ff}, - {0x00008118, 0x000000aa}, - {0x0000811c, 0x00003210}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x0000ffff}, - {0x00008144, 0xffffffff}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x00008170, 0x18486200}, - {0x00008174, 0x33332210}, - {0x00008178, 0x00000000}, - {0x0000817c, 0x00020000}, - {0x000081c0, 0x00000000}, - {0x000081c4, 0x33332210}, - {0x000081c8, 0x00000000}, - {0x000081cc, 0x00000000}, - {0x000081d4, 0x00000000}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008244, 0x0010f3d7}, - {0x00008248, 0x00000800}, - {0x0000824c, 0x0001e7ae}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x40000000}, - {0x00008260, 0x00080922}, - {0x00008264, 0x9d400010}, - {0x00008268, 0xffffffff}, - {0x0000826c, 0x0000ffff}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000004}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x000000ff}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x0000829c, 0x00000000}, - {0x00008300, 0x00000140}, - {0x00008314, 0x00000000}, - {0x0000831c, 0x0000010d}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x00000007}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000700}, - {0x00008338, 0x00ff0000}, - {0x0000833c, 0x02400000}, - {0x00008340, 0x000107ff}, - {0x00008344, 0xaa48105b}, - {0x00008348, 0x008f0000}, - {0x0000835c, 0x00000000}, - {0x00008360, 0xffffffff}, - {0x00008364, 0xffffffff}, - {0x00008368, 0x00000000}, - {0x00008370, 0x00000000}, - {0x00008374, 0x000000ff}, - {0x00008378, 0x00000000}, - {0x0000837c, 0x00000000}, - {0x00008380, 0xffffffff}, - {0x00008384, 0xffffffff}, - {0x00008390, 0xffffffff}, - {0x00008394, 0xffffffff}, - {0x00008398, 0x00000000}, - {0x0000839c, 0x00000000}, - {0x000083a0, 0x00000000}, - {0x000083a4, 0x0000fa14}, - {0x000083a8, 0x000f0c00}, - {0x000083ac, 0x33332210}, - {0x000083b0, 0x33332210}, - {0x000083b4, 0x33332210}, - {0x000083b8, 0x33332210}, - {0x000083bc, 0x00000000}, - {0x000083c0, 0x00000000}, - {0x000083c4, 0x00000000}, - {0x000083c8, 0x00000000}, - {0x000083cc, 0x00000200}, - {0x000083d0, 0x000101ff}, -}; - -#define ar9340Common_wo_xlna_rx_gain_table_1p0 ar9300Common_wo_xlna_rx_gain_table_2p2 - -static const u32 ar9340_1p0_soc_preamble[][2] = { - /* Addr allmodes */ - {0x00007008, 0x00000000}, - {0x00007020, 0x00000000}, - {0x00007034, 0x00000002}, - {0x00007038, 0x000004c2}, -}; - -#endif /* INITVALS_9340_H */ diff --git a/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h b/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h deleted file mode 100644 index 999ab08c34e6..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h +++ /dev/null @@ -1,1452 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef INITVALS_9462_2P0_H -#define INITVALS_9462_2P0_H - -/* AR9462 2.0 */ - -static const u32 ar9462_modes_fast_clock_2p0[][3] = { - /* Addr 5G_HT20 5G_HT40 */ - {0x00001030, 0x00000268, 0x000004d0}, - {0x00001070, 0x0000018c, 0x00000318}, - {0x000010b0, 0x00000fd0, 0x00001fa0}, - {0x00008014, 0x044c044c, 0x08980898}, - {0x0000801c, 0x148ec02b, 0x148ec057}, - {0x00008318, 0x000044c0, 0x00008980}, - {0x00009e00, 0x0372131c, 0x0372131c}, - {0x0000a230, 0x0000400b, 0x00004016}, - {0x0000a254, 0x00000898, 0x00001130}, -}; - -static const u32 ar9462_pciephy_clkreq_enable_L1_2p0[][2] = { - /* Addr allmodes */ - {0x00018c00, 0x18253ede}, - {0x00018c04, 0x000801d8}, - {0x00018c08, 0x0003780c}, -}; - -static const u32 ar9462_2p0_baseband_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8011, 0xd00a800d}, - {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a01ae}, - {0x00009824, 0x63c640de, 0x5ac640d0, 0x5ac640d0, 0x63c640da}, - {0x00009828, 0x0796be89, 0x0696b081, 0x0696b881, 0x09143e81}, - {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, - {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c}, - {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4}, - {0x00009e00, 0x0372111a, 0x0372111a, 0x037216a0, 0x037216a2}, - {0x00009e04, 0x001c2020, 0x001c2020, 0x001c2020, 0x001c2020}, - {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000d8}, - {0x00009e10, 0x92c88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec86d2e}, - {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3236605e, 0x32365a5e}, - {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, - {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, - {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, - {0x00009e3c, 0xcf946220, 0xcf946220, 0xcfd5c782, 0xcfd5c282}, - {0x00009e44, 0x62321e27, 0x62321e27, 0xfe291e27, 0xfe291e27}, - {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, - {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, - {0x0000a204, 0x01318fc0, 0x01318fc4, 0x01318fc4, 0x01318fc0}, - {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, - {0x0000a22c, 0x01026a2f, 0x01026a27, 0x01026a2f, 0x01026a2f}, - {0x0000a230, 0x0000400a, 0x00004014, 0x00004016, 0x0000400b}, - {0x0000a234, 0x00000fff, 0x10000fff, 0x10000fff, 0x00000fff}, - {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018}, - {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002}, - {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, - {0x0000a260, 0x0a021501, 0x0a021501, 0x3a021501, 0x3a021501}, - {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b}, - {0x0000a284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, - {0x0000a288, 0x00000110, 0x00000110, 0x00000110, 0x00000110}, - {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222}, - {0x0000a2c4, 0x00058d18, 0x00058d18, 0x00058d18, 0x00058d18}, - {0x0000a2d0, 0x00041981, 0x00041981, 0x00041981, 0x00041982}, - {0x0000a2d8, 0x7999a83b, 0x7999a83b, 0x7999a83b, 0x7999a83b}, - {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a3a4, 0x00000050, 0x00000050, 0x00000000, 0x00000000}, - {0x0000a3a8, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa}, - {0x0000a3ac, 0xaaaaaa00, 0xaa30aa30, 0xaaaaaa00, 0xaaaaaa00}, - {0x0000a41c, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce}, - {0x0000a420, 0x000001ce, 0x000001ce, 0x000001ce, 0x000001ce}, - {0x0000a424, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce}, - {0x0000a428, 0x000001ce, 0x000001ce, 0x000001ce, 0x000001ce}, - {0x0000a42c, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce}, - {0x0000a430, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce}, - {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x00100000}, - {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, - {0x0000b284, 0x00000000, 0x00000000, 0x00000550, 0x00000550}, -}; - -static const u32 ar9462_common_rx_gain_table_2p0[][2] = { - /* Addr allmodes */ - {0x0000a000, 0x00010000}, - {0x0000a004, 0x00030002}, - {0x0000a008, 0x00050004}, - {0x0000a00c, 0x00810080}, - {0x0000a010, 0x00830082}, - {0x0000a014, 0x01810180}, - {0x0000a018, 0x01830182}, - {0x0000a01c, 0x01850184}, - {0x0000a020, 0x01890188}, - {0x0000a024, 0x018b018a}, - {0x0000a028, 0x018d018c}, - {0x0000a02c, 0x01910190}, - {0x0000a030, 0x01930192}, - {0x0000a034, 0x01950194}, - {0x0000a038, 0x038a0196}, - {0x0000a03c, 0x038c038b}, - {0x0000a040, 0x0390038d}, - {0x0000a044, 0x03920391}, - {0x0000a048, 0x03940393}, - {0x0000a04c, 0x03960395}, - {0x0000a050, 0x00000000}, - {0x0000a054, 0x00000000}, - {0x0000a058, 0x00000000}, - {0x0000a05c, 0x00000000}, - {0x0000a060, 0x00000000}, - {0x0000a064, 0x00000000}, - {0x0000a068, 0x00000000}, - {0x0000a06c, 0x00000000}, - {0x0000a070, 0x00000000}, - {0x0000a074, 0x00000000}, - {0x0000a078, 0x00000000}, - {0x0000a07c, 0x00000000}, - {0x0000a080, 0x22222229}, - {0x0000a084, 0x1d1d1d1d}, - {0x0000a088, 0x1d1d1d1d}, - {0x0000a08c, 0x1d1d1d1d}, - {0x0000a090, 0x171d1d1d}, - {0x0000a094, 0x11111717}, - {0x0000a098, 0x00030311}, - {0x0000a09c, 0x00000000}, - {0x0000a0a0, 0x00000000}, - {0x0000a0a4, 0x00000000}, - {0x0000a0a8, 0x00000000}, - {0x0000a0ac, 0x00000000}, - {0x0000a0b0, 0x00000000}, - {0x0000a0b4, 0x00000000}, - {0x0000a0b8, 0x00000000}, - {0x0000a0bc, 0x00000000}, - {0x0000a0c0, 0x001f0000}, - {0x0000a0c4, 0x01000101}, - {0x0000a0c8, 0x011e011f}, - {0x0000a0cc, 0x011c011d}, - {0x0000a0d0, 0x02030204}, - {0x0000a0d4, 0x02010202}, - {0x0000a0d8, 0x021f0200}, - {0x0000a0dc, 0x0302021e}, - {0x0000a0e0, 0x03000301}, - {0x0000a0e4, 0x031e031f}, - {0x0000a0e8, 0x0402031d}, - {0x0000a0ec, 0x04000401}, - {0x0000a0f0, 0x041e041f}, - {0x0000a0f4, 0x0502041d}, - {0x0000a0f8, 0x05000501}, - {0x0000a0fc, 0x051e051f}, - {0x0000a100, 0x06010602}, - {0x0000a104, 0x061f0600}, - {0x0000a108, 0x061d061e}, - {0x0000a10c, 0x07020703}, - {0x0000a110, 0x07000701}, - {0x0000a114, 0x00000000}, - {0x0000a118, 0x00000000}, - {0x0000a11c, 0x00000000}, - {0x0000a120, 0x00000000}, - {0x0000a124, 0x00000000}, - {0x0000a128, 0x00000000}, - {0x0000a12c, 0x00000000}, - {0x0000a130, 0x00000000}, - {0x0000a134, 0x00000000}, - {0x0000a138, 0x00000000}, - {0x0000a13c, 0x00000000}, - {0x0000a140, 0x001f0000}, - {0x0000a144, 0x01000101}, - {0x0000a148, 0x011e011f}, - {0x0000a14c, 0x011c011d}, - {0x0000a150, 0x02030204}, - {0x0000a154, 0x02010202}, - {0x0000a158, 0x021f0200}, - {0x0000a15c, 0x0302021e}, - {0x0000a160, 0x03000301}, - {0x0000a164, 0x031e031f}, - {0x0000a168, 0x0402031d}, - {0x0000a16c, 0x04000401}, - {0x0000a170, 0x041e041f}, - {0x0000a174, 0x0502041d}, - {0x0000a178, 0x05000501}, - {0x0000a17c, 0x051e051f}, - {0x0000a180, 0x06010602}, - {0x0000a184, 0x061f0600}, - {0x0000a188, 0x061d061e}, - {0x0000a18c, 0x07020703}, - {0x0000a190, 0x07000701}, - {0x0000a194, 0x00000000}, - {0x0000a198, 0x00000000}, - {0x0000a19c, 0x00000000}, - {0x0000a1a0, 0x00000000}, - {0x0000a1a4, 0x00000000}, - {0x0000a1a8, 0x00000000}, - {0x0000a1ac, 0x00000000}, - {0x0000a1b0, 0x00000000}, - {0x0000a1b4, 0x00000000}, - {0x0000a1b8, 0x00000000}, - {0x0000a1bc, 0x00000000}, - {0x0000a1c0, 0x00000000}, - {0x0000a1c4, 0x00000000}, - {0x0000a1c8, 0x00000000}, - {0x0000a1cc, 0x00000000}, - {0x0000a1d0, 0x00000000}, - {0x0000a1d4, 0x00000000}, - {0x0000a1d8, 0x00000000}, - {0x0000a1dc, 0x00000000}, - {0x0000a1e0, 0x00000000}, - {0x0000a1e4, 0x00000000}, - {0x0000a1e8, 0x00000000}, - {0x0000a1ec, 0x00000000}, - {0x0000a1f0, 0x00000396}, - {0x0000a1f4, 0x00000396}, - {0x0000a1f8, 0x00000396}, - {0x0000a1fc, 0x00000196}, - {0x0000b000, 0x00010000}, - {0x0000b004, 0x00030002}, - {0x0000b008, 0x00050004}, - {0x0000b00c, 0x00810080}, - {0x0000b010, 0x00830082}, - {0x0000b014, 0x01810180}, - {0x0000b018, 0x01830182}, - {0x0000b01c, 0x01850184}, - {0x0000b020, 0x02810280}, - {0x0000b024, 0x02830282}, - {0x0000b028, 0x02850284}, - {0x0000b02c, 0x02890288}, - {0x0000b030, 0x028b028a}, - {0x0000b034, 0x0388028c}, - {0x0000b038, 0x038a0389}, - {0x0000b03c, 0x038c038b}, - {0x0000b040, 0x0390038d}, - {0x0000b044, 0x03920391}, - {0x0000b048, 0x03940393}, - {0x0000b04c, 0x03960395}, - {0x0000b050, 0x00000000}, - {0x0000b054, 0x00000000}, - {0x0000b058, 0x00000000}, - {0x0000b05c, 0x00000000}, - {0x0000b060, 0x00000000}, - {0x0000b064, 0x00000000}, - {0x0000b068, 0x00000000}, - {0x0000b06c, 0x00000000}, - {0x0000b070, 0x00000000}, - {0x0000b074, 0x00000000}, - {0x0000b078, 0x00000000}, - {0x0000b07c, 0x00000000}, - {0x0000b080, 0x2a2d2f32}, - {0x0000b084, 0x21232328}, - {0x0000b088, 0x19191c1e}, - {0x0000b08c, 0x12141417}, - {0x0000b090, 0x07070e0e}, - {0x0000b094, 0x03030305}, - {0x0000b098, 0x00000003}, - {0x0000b09c, 0x00000000}, - {0x0000b0a0, 0x00000000}, - {0x0000b0a4, 0x00000000}, - {0x0000b0a8, 0x00000000}, - {0x0000b0ac, 0x00000000}, - {0x0000b0b0, 0x00000000}, - {0x0000b0b4, 0x00000000}, - {0x0000b0b8, 0x00000000}, - {0x0000b0bc, 0x00000000}, - {0x0000b0c0, 0x003f0020}, - {0x0000b0c4, 0x00400041}, - {0x0000b0c8, 0x0140005f}, - {0x0000b0cc, 0x0160015f}, - {0x0000b0d0, 0x017e017f}, - {0x0000b0d4, 0x02410242}, - {0x0000b0d8, 0x025f0240}, - {0x0000b0dc, 0x027f0260}, - {0x0000b0e0, 0x0341027e}, - {0x0000b0e4, 0x035f0340}, - {0x0000b0e8, 0x037f0360}, - {0x0000b0ec, 0x04400441}, - {0x0000b0f0, 0x0460045f}, - {0x0000b0f4, 0x0541047f}, - {0x0000b0f8, 0x055f0540}, - {0x0000b0fc, 0x057f0560}, - {0x0000b100, 0x06400641}, - {0x0000b104, 0x0660065f}, - {0x0000b108, 0x067e067f}, - {0x0000b10c, 0x07410742}, - {0x0000b110, 0x075f0740}, - {0x0000b114, 0x077f0760}, - {0x0000b118, 0x07800781}, - {0x0000b11c, 0x07a0079f}, - {0x0000b120, 0x07c107bf}, - {0x0000b124, 0x000007c0}, - {0x0000b128, 0x00000000}, - {0x0000b12c, 0x00000000}, - {0x0000b130, 0x00000000}, - {0x0000b134, 0x00000000}, - {0x0000b138, 0x00000000}, - {0x0000b13c, 0x00000000}, - {0x0000b140, 0x003f0020}, - {0x0000b144, 0x00400041}, - {0x0000b148, 0x0140005f}, - {0x0000b14c, 0x0160015f}, - {0x0000b150, 0x017e017f}, - {0x0000b154, 0x02410242}, - {0x0000b158, 0x025f0240}, - {0x0000b15c, 0x027f0260}, - {0x0000b160, 0x0341027e}, - {0x0000b164, 0x035f0340}, - {0x0000b168, 0x037f0360}, - {0x0000b16c, 0x04400441}, - {0x0000b170, 0x0460045f}, - {0x0000b174, 0x0541047f}, - {0x0000b178, 0x055f0540}, - {0x0000b17c, 0x057f0560}, - {0x0000b180, 0x06400641}, - {0x0000b184, 0x0660065f}, - {0x0000b188, 0x067e067f}, - {0x0000b18c, 0x07410742}, - {0x0000b190, 0x075f0740}, - {0x0000b194, 0x077f0760}, - {0x0000b198, 0x07800781}, - {0x0000b19c, 0x07a0079f}, - {0x0000b1a0, 0x07c107bf}, - {0x0000b1a4, 0x000007c0}, - {0x0000b1a8, 0x00000000}, - {0x0000b1ac, 0x00000000}, - {0x0000b1b0, 0x00000000}, - {0x0000b1b4, 0x00000000}, - {0x0000b1b8, 0x00000000}, - {0x0000b1bc, 0x00000000}, - {0x0000b1c0, 0x00000000}, - {0x0000b1c4, 0x00000000}, - {0x0000b1c8, 0x00000000}, - {0x0000b1cc, 0x00000000}, - {0x0000b1d0, 0x00000000}, - {0x0000b1d4, 0x00000000}, - {0x0000b1d8, 0x00000000}, - {0x0000b1dc, 0x00000000}, - {0x0000b1e0, 0x00000000}, - {0x0000b1e4, 0x00000000}, - {0x0000b1e8, 0x00000000}, - {0x0000b1ec, 0x00000000}, - {0x0000b1f0, 0x00000396}, - {0x0000b1f4, 0x00000396}, - {0x0000b1f8, 0x00000396}, - {0x0000b1fc, 0x00000196}, -}; - -static const u32 ar9462_pciephy_clkreq_disable_L1_2p0[][2] = { - /* Addr allmodes */ - {0x00018c00, 0x18213ede}, - {0x00018c04, 0x000801d8}, - {0x00018c08, 0x0003780c}, -}; - -static const u32 ar9462_pciephy_pll_on_clkreq_disable_L1_2p0[][2] = { - /* Addr allmodes */ - {0x00018c00, 0x18212ede}, - {0x00018c04, 0x000801d8}, - {0x00018c08, 0x0003780c}, -}; - -static const u32 ar9462_2p0_radio_postamble_sys2ant[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x000160ac, 0xa4646c08, 0xa4646c08, 0x24645808, 0x24645808}, - {0x00016140, 0x10804008, 0x10804008, 0x50804008, 0x50804008}, - {0x00016540, 0x10804008, 0x10804008, 0x50804008, 0x50804008}, -}; - -static const u32 ar9462_common_wo_xlna_rx_gain_table_2p0[][2] = { - /* Addr allmodes */ - {0x0000a000, 0x00010000}, - {0x0000a004, 0x00030002}, - {0x0000a008, 0x00050004}, - {0x0000a00c, 0x00810080}, - {0x0000a010, 0x00830082}, - {0x0000a014, 0x01810180}, - {0x0000a018, 0x01830182}, - {0x0000a01c, 0x01850184}, - {0x0000a020, 0x01890188}, - {0x0000a024, 0x018b018a}, - {0x0000a028, 0x018d018c}, - {0x0000a02c, 0x03820190}, - {0x0000a030, 0x03840383}, - {0x0000a034, 0x03880385}, - {0x0000a038, 0x038a0389}, - {0x0000a03c, 0x038c038b}, - {0x0000a040, 0x0390038d}, - {0x0000a044, 0x03920391}, - {0x0000a048, 0x03940393}, - {0x0000a04c, 0x03960395}, - {0x0000a050, 0x00000000}, - {0x0000a054, 0x00000000}, - {0x0000a058, 0x00000000}, - {0x0000a05c, 0x00000000}, - {0x0000a060, 0x00000000}, - {0x0000a064, 0x00000000}, - {0x0000a068, 0x00000000}, - {0x0000a06c, 0x00000000}, - {0x0000a070, 0x00000000}, - {0x0000a074, 0x00000000}, - {0x0000a078, 0x00000000}, - {0x0000a07c, 0x00000000}, - {0x0000a080, 0x29292929}, - {0x0000a084, 0x29292929}, - {0x0000a088, 0x29292929}, - {0x0000a08c, 0x29292929}, - {0x0000a090, 0x22292929}, - {0x0000a094, 0x1d1d2222}, - {0x0000a098, 0x0c111117}, - {0x0000a09c, 0x00030303}, - {0x0000a0a0, 0x00000000}, - {0x0000a0a4, 0x00000000}, - {0x0000a0a8, 0x00000000}, - {0x0000a0ac, 0x00000000}, - {0x0000a0b0, 0x00000000}, - {0x0000a0b4, 0x00000000}, - {0x0000a0b8, 0x00000000}, - {0x0000a0bc, 0x00000000}, - {0x0000a0c0, 0x001f0000}, - {0x0000a0c4, 0x01000101}, - {0x0000a0c8, 0x011e011f}, - {0x0000a0cc, 0x011c011d}, - {0x0000a0d0, 0x02030204}, - {0x0000a0d4, 0x02010202}, - {0x0000a0d8, 0x021f0200}, - {0x0000a0dc, 0x0302021e}, - {0x0000a0e0, 0x03000301}, - {0x0000a0e4, 0x031e031f}, - {0x0000a0e8, 0x0402031d}, - {0x0000a0ec, 0x04000401}, - {0x0000a0f0, 0x041e041f}, - {0x0000a0f4, 0x0502041d}, - {0x0000a0f8, 0x05000501}, - {0x0000a0fc, 0x051e051f}, - {0x0000a100, 0x06010602}, - {0x0000a104, 0x061f0600}, - {0x0000a108, 0x061d061e}, - {0x0000a10c, 0x07020703}, - {0x0000a110, 0x07000701}, - {0x0000a114, 0x00000000}, - {0x0000a118, 0x00000000}, - {0x0000a11c, 0x00000000}, - {0x0000a120, 0x00000000}, - {0x0000a124, 0x00000000}, - {0x0000a128, 0x00000000}, - {0x0000a12c, 0x00000000}, - {0x0000a130, 0x00000000}, - {0x0000a134, 0x00000000}, - {0x0000a138, 0x00000000}, - {0x0000a13c, 0x00000000}, - {0x0000a140, 0x001f0000}, - {0x0000a144, 0x01000101}, - {0x0000a148, 0x011e011f}, - {0x0000a14c, 0x011c011d}, - {0x0000a150, 0x02030204}, - {0x0000a154, 0x02010202}, - {0x0000a158, 0x021f0200}, - {0x0000a15c, 0x0302021e}, - {0x0000a160, 0x03000301}, - {0x0000a164, 0x031e031f}, - {0x0000a168, 0x0402031d}, - {0x0000a16c, 0x04000401}, - {0x0000a170, 0x041e041f}, - {0x0000a174, 0x0502041d}, - {0x0000a178, 0x05000501}, - {0x0000a17c, 0x051e051f}, - {0x0000a180, 0x06010602}, - {0x0000a184, 0x061f0600}, - {0x0000a188, 0x061d061e}, - {0x0000a18c, 0x07020703}, - {0x0000a190, 0x07000701}, - {0x0000a194, 0x00000000}, - {0x0000a198, 0x00000000}, - {0x0000a19c, 0x00000000}, - {0x0000a1a0, 0x00000000}, - {0x0000a1a4, 0x00000000}, - {0x0000a1a8, 0x00000000}, - {0x0000a1ac, 0x00000000}, - {0x0000a1b0, 0x00000000}, - {0x0000a1b4, 0x00000000}, - {0x0000a1b8, 0x00000000}, - {0x0000a1bc, 0x00000000}, - {0x0000a1c0, 0x00000000}, - {0x0000a1c4, 0x00000000}, - {0x0000a1c8, 0x00000000}, - {0x0000a1cc, 0x00000000}, - {0x0000a1d0, 0x00000000}, - {0x0000a1d4, 0x00000000}, - {0x0000a1d8, 0x00000000}, - {0x0000a1dc, 0x00000000}, - {0x0000a1e0, 0x00000000}, - {0x0000a1e4, 0x00000000}, - {0x0000a1e8, 0x00000000}, - {0x0000a1ec, 0x00000000}, - {0x0000a1f0, 0x00000396}, - {0x0000a1f4, 0x00000396}, - {0x0000a1f8, 0x00000396}, - {0x0000a1fc, 0x00000196}, - {0x0000b000, 0x00010000}, - {0x0000b004, 0x00030002}, - {0x0000b008, 0x00050004}, - {0x0000b00c, 0x00810080}, - {0x0000b010, 0x00830082}, - {0x0000b014, 0x01810180}, - {0x0000b018, 0x01830182}, - {0x0000b01c, 0x01850184}, - {0x0000b020, 0x02810280}, - {0x0000b024, 0x02830282}, - {0x0000b028, 0x02850284}, - {0x0000b02c, 0x02890288}, - {0x0000b030, 0x028b028a}, - {0x0000b034, 0x0388028c}, - {0x0000b038, 0x038a0389}, - {0x0000b03c, 0x038c038b}, - {0x0000b040, 0x0390038d}, - {0x0000b044, 0x03920391}, - {0x0000b048, 0x03940393}, - {0x0000b04c, 0x03960395}, - {0x0000b050, 0x00000000}, - {0x0000b054, 0x00000000}, - {0x0000b058, 0x00000000}, - {0x0000b05c, 0x00000000}, - {0x0000b060, 0x00000000}, - {0x0000b064, 0x00000000}, - {0x0000b068, 0x00000000}, - {0x0000b06c, 0x00000000}, - {0x0000b070, 0x00000000}, - {0x0000b074, 0x00000000}, - {0x0000b078, 0x00000000}, - {0x0000b07c, 0x00000000}, - {0x0000b080, 0x32323232}, - {0x0000b084, 0x2f2f3232}, - {0x0000b088, 0x23282a2d}, - {0x0000b08c, 0x1c1e2123}, - {0x0000b090, 0x14171919}, - {0x0000b094, 0x0e0e1214}, - {0x0000b098, 0x03050707}, - {0x0000b09c, 0x00030303}, - {0x0000b0a0, 0x00000000}, - {0x0000b0a4, 0x00000000}, - {0x0000b0a8, 0x00000000}, - {0x0000b0ac, 0x00000000}, - {0x0000b0b0, 0x00000000}, - {0x0000b0b4, 0x00000000}, - {0x0000b0b8, 0x00000000}, - {0x0000b0bc, 0x00000000}, - {0x0000b0c0, 0x003f0020}, - {0x0000b0c4, 0x00400041}, - {0x0000b0c8, 0x0140005f}, - {0x0000b0cc, 0x0160015f}, - {0x0000b0d0, 0x017e017f}, - {0x0000b0d4, 0x02410242}, - {0x0000b0d8, 0x025f0240}, - {0x0000b0dc, 0x027f0260}, - {0x0000b0e0, 0x0341027e}, - {0x0000b0e4, 0x035f0340}, - {0x0000b0e8, 0x037f0360}, - {0x0000b0ec, 0x04400441}, - {0x0000b0f0, 0x0460045f}, - {0x0000b0f4, 0x0541047f}, - {0x0000b0f8, 0x055f0540}, - {0x0000b0fc, 0x057f0560}, - {0x0000b100, 0x06400641}, - {0x0000b104, 0x0660065f}, - {0x0000b108, 0x067e067f}, - {0x0000b10c, 0x07410742}, - {0x0000b110, 0x075f0740}, - {0x0000b114, 0x077f0760}, - {0x0000b118, 0x07800781}, - {0x0000b11c, 0x07a0079f}, - {0x0000b120, 0x07c107bf}, - {0x0000b124, 0x000007c0}, - {0x0000b128, 0x00000000}, - {0x0000b12c, 0x00000000}, - {0x0000b130, 0x00000000}, - {0x0000b134, 0x00000000}, - {0x0000b138, 0x00000000}, - {0x0000b13c, 0x00000000}, - {0x0000b140, 0x003f0020}, - {0x0000b144, 0x00400041}, - {0x0000b148, 0x0140005f}, - {0x0000b14c, 0x0160015f}, - {0x0000b150, 0x017e017f}, - {0x0000b154, 0x02410242}, - {0x0000b158, 0x025f0240}, - {0x0000b15c, 0x027f0260}, - {0x0000b160, 0x0341027e}, - {0x0000b164, 0x035f0340}, - {0x0000b168, 0x037f0360}, - {0x0000b16c, 0x04400441}, - {0x0000b170, 0x0460045f}, - {0x0000b174, 0x0541047f}, - {0x0000b178, 0x055f0540}, - {0x0000b17c, 0x057f0560}, - {0x0000b180, 0x06400641}, - {0x0000b184, 0x0660065f}, - {0x0000b188, 0x067e067f}, - {0x0000b18c, 0x07410742}, - {0x0000b190, 0x075f0740}, - {0x0000b194, 0x077f0760}, - {0x0000b198, 0x07800781}, - {0x0000b19c, 0x07a0079f}, - {0x0000b1a0, 0x07c107bf}, - {0x0000b1a4, 0x000007c0}, - {0x0000b1a8, 0x00000000}, - {0x0000b1ac, 0x00000000}, - {0x0000b1b0, 0x00000000}, - {0x0000b1b4, 0x00000000}, - {0x0000b1b8, 0x00000000}, - {0x0000b1bc, 0x00000000}, - {0x0000b1c0, 0x00000000}, - {0x0000b1c4, 0x00000000}, - {0x0000b1c8, 0x00000000}, - {0x0000b1cc, 0x00000000}, - {0x0000b1d0, 0x00000000}, - {0x0000b1d4, 0x00000000}, - {0x0000b1d8, 0x00000000}, - {0x0000b1dc, 0x00000000}, - {0x0000b1e0, 0x00000000}, - {0x0000b1e4, 0x00000000}, - {0x0000b1e8, 0x00000000}, - {0x0000b1ec, 0x00000000}, - {0x0000b1f0, 0x00000396}, - {0x0000b1f4, 0x00000396}, - {0x0000b1f8, 0x00000396}, - {0x0000b1fc, 0x00000196}, -}; - -static const u32 ar9462_2p0_baseband_core_txfir_coeff_japan_2484[][2] = { - /* Addr allmodes */ - {0x0000a398, 0x00000000}, - {0x0000a39c, 0x6f7f0301}, - {0x0000a3a0, 0xca9228ee}, -}; - -static const u32 ar9462_modes_low_ob_db_tx_gain_table_2p0[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x000098bc, 0x00000002, 0x00000002, 0x00000002, 0x00000002}, - {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a458, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, - {0x0000a518, 0x21020220, 0x21020220, 0x16000402, 0x16000402}, - {0x0000a51c, 0x27020223, 0x27020223, 0x19000404, 0x19000404}, - {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, - {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, - {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, - {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, - {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, - {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861}, - {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81}, - {0x0000a54c, 0x5c04286b, 0x5c04286b, 0x47001a83, 0x47001a83}, - {0x0000a550, 0x61042a6c, 0x61042a6c, 0x4a001c84, 0x4a001c84}, - {0x0000a554, 0x66062a6c, 0x66062a6c, 0x4e001ce3, 0x4e001ce3}, - {0x0000a558, 0x6b062e6c, 0x6b062e6c, 0x52001ce5, 0x52001ce5}, - {0x0000a55c, 0x7006308c, 0x7006308c, 0x56001ce9, 0x56001ce9}, - {0x0000a560, 0x730a308a, 0x730a308a, 0x5a001ceb, 0x5a001ceb}, - {0x0000a564, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a568, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a56c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a570, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a574, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a578, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a57c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, - {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, - {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, - {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x012482d4, 0x012482d4, 0x012482d4, 0x012482d4}, - {0x00016048, 0x64992060, 0x64992060, 0x64992060, 0x64992060}, - {0x00016054, 0x6db60000, 0x6db60000, 0x6db60000, 0x6db60000}, - {0x00016444, 0x012482d4, 0x012482d4, 0x012482d4, 0x012482d4}, - {0x00016448, 0x64992000, 0x64992000, 0x64992000, 0x64992000}, - {0x00016454, 0x6db60000, 0x6db60000, 0x6db60000, 0x6db60000}, -}; - -static const u32 ar9462_2p0_soc_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00007010, 0x00000033, 0x00000033, 0x00000033, 0x00000033}, -}; - -static const u32 ar9462_2p0_baseband_core[][2] = { - /* Addr allmodes */ - {0x00009800, 0xafe68e30}, - {0x00009804, 0xfd14e000}, - {0x00009808, 0x9c0a9f6b}, - {0x0000980c, 0x04900000}, - {0x00009814, 0x9280c00a}, - {0x00009818, 0x00000000}, - {0x0000981c, 0x00020028}, - {0x00009834, 0x6400a290}, - {0x00009838, 0x0108ecff}, - {0x0000983c, 0x0d000600}, - {0x00009880, 0x201fff00}, - {0x00009884, 0x00001042}, - {0x000098a4, 0x00200400}, - {0x000098b0, 0x32440bbe}, - {0x000098d0, 0x004b6a8e}, - {0x000098d4, 0x00000820}, - {0x000098dc, 0x00000000}, - {0x000098e4, 0x01ffffff}, - {0x000098e8, 0x01ffffff}, - {0x000098ec, 0x01ffffff}, - {0x000098f0, 0x00000000}, - {0x000098f4, 0x00000000}, - {0x00009bf0, 0x80000000}, - {0x00009c04, 0xff55ff55}, - {0x00009c08, 0x0320ff55}, - {0x00009c0c, 0x00000000}, - {0x00009c10, 0x00000000}, - {0x00009c14, 0x00046384}, - {0x00009c18, 0x05b6b440}, - {0x00009c1c, 0x00b6b440}, - {0x00009d00, 0xc080a333}, - {0x00009d04, 0x40206c10}, - {0x00009d08, 0x009c4060}, - {0x00009d0c, 0x9883800a}, - {0x00009d10, 0x01834061}, - {0x00009d14, 0x00c0040b}, - {0x00009d18, 0x00000000}, - {0x00009e08, 0x0038230c}, - {0x00009e24, 0x990bb515}, - {0x00009e28, 0x0c6f0000}, - {0x00009e30, 0x06336f77}, - {0x00009e34, 0x6af6532f}, - {0x00009e38, 0x0cc80c00}, - {0x00009e40, 0x15262820}, - {0x00009e4c, 0x00001004}, - {0x00009e50, 0x00ff03f1}, - {0x00009e54, 0xe4c555c2}, - {0x00009e58, 0xfd857722}, - {0x00009e5c, 0xe9198724}, - {0x00009fc0, 0x803e4788}, - {0x00009fc4, 0x0001efb5}, - {0x00009fcc, 0x40000014}, - {0x00009fd0, 0x0a193b93}, - {0x0000a20c, 0x00000000}, - {0x0000a220, 0x00000000}, - {0x0000a224, 0x00000000}, - {0x0000a228, 0x10002310}, - {0x0000a23c, 0x00000000}, - {0x0000a244, 0x0c000000}, - {0x0000a2a0, 0x00000001}, - {0x0000a2c0, 0x00000001}, - {0x0000a2c8, 0x00000000}, - {0x0000a2cc, 0x18c43433}, - {0x0000a2d4, 0x00000000}, - {0x0000a2ec, 0x00000000}, - {0x0000a2f0, 0x00000000}, - {0x0000a2f4, 0x00000000}, - {0x0000a2f8, 0x00000000}, - {0x0000a344, 0x00000000}, - {0x0000a34c, 0x00000000}, - {0x0000a350, 0x0000a000}, - {0x0000a364, 0x00000000}, - {0x0000a370, 0x00000000}, - {0x0000a390, 0x00000001}, - {0x0000a394, 0x00000444}, - {0x0000a398, 0x001f0e0f}, - {0x0000a39c, 0x0075393f}, - {0x0000a3a0, 0xb79f6427}, - {0x0000a3c0, 0x20202020}, - {0x0000a3c4, 0x22222220}, - {0x0000a3c8, 0x20200020}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3d8, 0x20202020}, - {0x0000a3dc, 0x20202020}, - {0x0000a3e0, 0x20202020}, - {0x0000a3e4, 0x20202020}, - {0x0000a3e8, 0x20202020}, - {0x0000a3ec, 0x20202020}, - {0x0000a3f0, 0x00000000}, - {0x0000a3f4, 0x00000006}, - {0x0000a3f8, 0x0c9bd380}, - {0x0000a3fc, 0x000f0f01}, - {0x0000a400, 0x8fa91f01}, - {0x0000a404, 0x00000000}, - {0x0000a408, 0x0e79e5c6}, - {0x0000a40c, 0x00820820}, - {0x0000a414, 0x1ce739ce}, - {0x0000a418, 0x2d001dce}, - {0x0000a434, 0x00000000}, - {0x0000a438, 0x00001801}, - {0x0000a43c, 0x00100000}, - {0x0000a444, 0x00000000}, - {0x0000a448, 0x05000080}, - {0x0000a44c, 0x00000001}, - {0x0000a450, 0x00010000}, - {0x0000a454, 0x07000000}, - {0x0000a644, 0xbfad9d74}, - {0x0000a648, 0x0048060a}, - {0x0000a64c, 0x00002037}, - {0x0000a670, 0x03020100}, - {0x0000a674, 0x09080504}, - {0x0000a678, 0x0d0c0b0a}, - {0x0000a67c, 0x13121110}, - {0x0000a680, 0x31301514}, - {0x0000a684, 0x35343332}, - {0x0000a688, 0x00000036}, - {0x0000a690, 0x00000838}, - {0x0000a6b0, 0x0000000a}, - {0x0000a6b4, 0x00512c01}, - {0x0000a7c0, 0x00000000}, - {0x0000a7c4, 0xfffffffc}, - {0x0000a7c8, 0x00000000}, - {0x0000a7cc, 0x00000000}, - {0x0000a7d0, 0x00000000}, - {0x0000a7d4, 0x00000004}, - {0x0000a7dc, 0x00000000}, - {0x0000a7f0, 0x80000000}, - {0x0000a8d0, 0x004b6a8e}, - {0x0000a8d4, 0x00000820}, - {0x0000a8dc, 0x00000000}, - {0x0000a8f0, 0x00000000}, - {0x0000a8f4, 0x00000000}, - {0x0000abf0, 0x80000000}, - {0x0000b2d0, 0x00000080}, - {0x0000b2d4, 0x00000000}, - {0x0000b2ec, 0x00000000}, - {0x0000b2f0, 0x00000000}, - {0x0000b2f4, 0x00000000}, - {0x0000b2f8, 0x00000000}, - {0x0000b408, 0x0e79e5c0}, - {0x0000b40c, 0x00820820}, - {0x0000b420, 0x00000000}, - {0x0000b6b0, 0x0000000a}, - {0x0000b6b4, 0x00000001}, -}; - -static const u32 ar9462_2p0_radio_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0001609c, 0x0b8ee524, 0x0b8ee524, 0x0b8ee524, 0x0b8ee524}, - {0x000160b0, 0x01d67f70, 0x01d67f70, 0x01d67f70, 0x01d67f70}, - {0x0001610c, 0x48000000, 0x40000000, 0x40000000, 0x40000000}, - {0x0001650c, 0x48000000, 0x40000000, 0x40000000, 0x40000000}, -}; - -static const u32 ar9462_modes_high_ob_db_tx_gain_table_2p0[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x000098bc, 0x00000002, 0x00000002, 0x00000002, 0x00000002}, - {0x0000a2dc, 0x01feee00, 0x01feee00, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x0000f000, 0x0000f000, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x01ff0000, 0x01ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050da, 0x000050da, 0x000050de, 0x000050de}, - {0x0000a458, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, - {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004}, - {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x18022622, 0x18022622, 0x11000400, 0x11000400}, - {0x0000a518, 0x1b022822, 0x1b022822, 0x15000402, 0x15000402}, - {0x0000a51c, 0x20022842, 0x20022842, 0x19000404, 0x19000404}, - {0x0000a520, 0x22022c41, 0x22022c41, 0x1b000603, 0x1b000603}, - {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02}, - {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04}, - {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20}, - {0x0000a530, 0x34025643, 0x34025643, 0x2a000e20, 0x2a000e20}, - {0x0000a534, 0x38025a44, 0x38025a44, 0x2e000e22, 0x2e000e22}, - {0x0000a538, 0x3b025e45, 0x3b025e45, 0x31000e24, 0x31000e24}, - {0x0000a53c, 0x41025e4a, 0x41025e4a, 0x34001640, 0x34001640}, - {0x0000a540, 0x48025e6c, 0x48025e6c, 0x38001660, 0x38001660}, - {0x0000a544, 0x4e025e8e, 0x4e025e8e, 0x3b001861, 0x3b001861}, - {0x0000a548, 0x55025eb3, 0x55025eb3, 0x3e001a81, 0x3e001a81}, - {0x0000a54c, 0x58025ef3, 0x58025ef3, 0x42001a83, 0x42001a83}, - {0x0000a550, 0x5d025ef6, 0x5d025ef6, 0x44001a84, 0x44001a84}, - {0x0000a554, 0x62025f56, 0x62025f56, 0x48001ce3, 0x48001ce3}, - {0x0000a558, 0x66027f56, 0x66027f56, 0x4c001ce5, 0x4c001ce5}, - {0x0000a55c, 0x6a029f56, 0x6a029f56, 0x50001ce9, 0x50001ce9}, - {0x0000a560, 0x70049f56, 0x70049f56, 0x54001ceb, 0x54001ceb}, - {0x0000a564, 0x751ffff6, 0x751ffff6, 0x56001eec, 0x56001eec}, - {0x0000a568, 0x751ffff6, 0x751ffff6, 0x58001ef0, 0x58001ef0}, - {0x0000a56c, 0x751ffff6, 0x751ffff6, 0x5a001ef4, 0x5a001ef4}, - {0x0000a570, 0x751ffff6, 0x751ffff6, 0x5c001ff6, 0x5c001ff6}, - {0x0000a574, 0x751ffff6, 0x751ffff6, 0x5c001ff6, 0x5c001ff6}, - {0x0000a578, 0x751ffff6, 0x751ffff6, 0x5c001ff6, 0x5c001ff6}, - {0x0000a57c, 0x751ffff6, 0x751ffff6, 0x5c001ff6, 0x5c001ff6}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, - {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, - {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501}, - {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501}, - {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x01feee00, 0x01feee00, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x0000f000, 0x0000f000, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x01ff0000, 0x01ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x056d82e4, 0x056d82e4, 0x056d82e4, 0x056d82e4}, - {0x00016048, 0x8db49060, 0x8db49060, 0x8db49060, 0x8db49060}, - {0x00016054, 0x6db60000, 0x6db60000, 0x6db60000, 0x6db60000}, - {0x00016444, 0x056d82e4, 0x056d82e4, 0x056d82e4, 0x056d82e4}, - {0x00016448, 0x8db49000, 0x8db49000, 0x8db49000, 0x8db49000}, - {0x00016454, 0x6db60000, 0x6db60000, 0x6db60000, 0x6db60000}, -}; - -static const u32 ar9462_2p0_radio_core[][2] = { - /* Addr allmodes */ - {0x00016000, 0x36db6db6}, - {0x00016004, 0x6db6db40}, - {0x00016008, 0x73f00000}, - {0x0001600c, 0x00000000}, - {0x00016010, 0x6d820001}, - {0x00016040, 0x7f80fff8}, - {0x0001604c, 0x2699e04f}, - {0x00016050, 0x6db6db6c}, - {0x00016058, 0x6c200000}, - {0x00016080, 0x000c0000}, - {0x00016084, 0x9a68048c}, - {0x00016088, 0x54214514}, - {0x0001608c, 0x1203040b}, - {0x00016090, 0x24926490}, - {0x00016098, 0xd2888888}, - {0x000160a0, 0x0a108ffe}, - {0x000160a4, 0x812fc491}, - {0x000160a8, 0x423c8000}, - {0x000160b4, 0x92000000}, - {0x000160b8, 0x0285dddc}, - {0x000160bc, 0x02908888}, - {0x000160c0, 0x00adb6d0}, - {0x000160c4, 0x6db6db60}, - {0x000160c8, 0x6db6db6c}, - {0x000160cc, 0x0de6c1b0}, - {0x00016100, 0x3fffbe04}, - {0x00016104, 0xfff80000}, - {0x00016108, 0x00200400}, - {0x00016110, 0x00000000}, - {0x00016144, 0x02084080}, - {0x00016148, 0x000080c0}, - {0x00016280, 0x050a0001}, - {0x00016284, 0x3d841418}, - {0x00016288, 0x00000000}, - {0x0001628c, 0xe3000000}, - {0x00016290, 0xa1005080}, - {0x00016294, 0x00000020}, - {0x00016298, 0x54a82900}, - {0x00016340, 0x121e4276}, - {0x00016344, 0x00300000}, - {0x00016400, 0x36db6db6}, - {0x00016404, 0x6db6db40}, - {0x00016408, 0x73f00000}, - {0x0001640c, 0x00000000}, - {0x00016410, 0x6c800001}, - {0x00016440, 0x7f80fff8}, - {0x0001644c, 0x4699e04f}, - {0x00016450, 0x6db6db6c}, - {0x00016500, 0x3fffbe04}, - {0x00016504, 0xfff80000}, - {0x00016508, 0x00200400}, - {0x00016510, 0x00000000}, - {0x00016544, 0x02084080}, - {0x00016548, 0x000080c0}, -}; - -static const u32 ar9462_2p0_soc_preamble[][2] = { - /* Addr allmodes */ - {0x000040a4, 0x00a0c1c9}, - {0x00007020, 0x00000000}, - {0x00007034, 0x00000002}, - {0x00007038, 0x000004c2}, -}; - -static const u32 ar9462_2p0_mac_core[][2] = { - /* Addr allmodes */ - {0x00000008, 0x00000000}, - {0x00000030, 0x000e0085}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000000}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x000010f0, 0x00000100}, - {0x00001270, 0x00000000}, - {0x000012b0, 0x00000000}, - {0x000012f0, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00001810, 0x0f000003}, - {0x00008000, 0x00000000}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008018, 0x00000000}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00080000}, - {0x00008040, 0x00000000}, - {0x00008044, 0x00000000}, - {0x00008048, 0x00000000}, - {0x0000804c, 0xffffffff}, - {0x00008054, 0x00000000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x00008070, 0x00000310}, - {0x00008074, 0x00000020}, - {0x00008078, 0x00000000}, - {0x0000809c, 0x0000000f}, - {0x000080a0, 0x00000000}, - {0x000080a4, 0x02ff0000}, - {0x000080a8, 0x0e070605}, - {0x000080ac, 0x0000000d}, - {0x000080b0, 0x00000000}, - {0x000080b4, 0x00000000}, - {0x000080b8, 0x00000000}, - {0x000080bc, 0x00000000}, - {0x000080c0, 0x2a800000}, - {0x000080c4, 0x06900168}, - {0x000080c8, 0x13881c20}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00252500}, - {0x000080d4, 0x00b00005}, - {0x000080d8, 0x00400002}, - {0x000080dc, 0x00000000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x3f3f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00000000}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000000}, - {0x00008114, 0x000007ff}, - {0x00008118, 0x000000aa}, - {0x0000811c, 0x00003210}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x0000ffff}, - {0x00008144, 0xffffffff}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x00008170, 0x18486e00}, - {0x00008174, 0x33332210}, - {0x00008178, 0x00000000}, - {0x0000817c, 0x00020000}, - {0x000081c4, 0x33332210}, - {0x000081c8, 0x00000000}, - {0x000081cc, 0x00000000}, - {0x000081d4, 0x00000000}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008244, 0x0010f400}, - {0x00008248, 0x00000800}, - {0x0000824c, 0x0001e800}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x40000000}, - {0x00008260, 0x00080922}, - {0x00008264, 0x99c00010}, - {0x00008268, 0xffffffff}, - {0x0000826c, 0x0000ffff}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000004}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x000000ff}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x0000829c, 0x00000000}, - {0x00008300, 0x00000140}, - {0x00008314, 0x00000000}, - {0x0000831c, 0x0000010d}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x0000001f}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000700}, - {0x00008338, 0xffff0000}, - {0x0000833c, 0x02400000}, - {0x00008340, 0x000107ff}, - {0x00008344, 0xaa48105b}, - {0x00008348, 0x008f0000}, - {0x0000835c, 0x00000000}, - {0x00008360, 0xffffffff}, - {0x00008364, 0xffffffff}, - {0x00008368, 0x00000000}, - {0x00008370, 0x00000000}, - {0x00008374, 0x000000ff}, - {0x00008378, 0x00000000}, - {0x0000837c, 0x00000000}, - {0x00008380, 0xffffffff}, - {0x00008384, 0xffffffff}, - {0x00008390, 0xffffffff}, - {0x00008394, 0xffffffff}, - {0x00008398, 0x00000000}, - {0x0000839c, 0x00000000}, - {0x000083a4, 0x0000fa14}, - {0x000083a8, 0x000f0c00}, - {0x000083ac, 0x33332210}, - {0x000083b0, 0x33332210}, - {0x000083b4, 0x33332210}, - {0x000083b8, 0x33332210}, - {0x000083bc, 0x00000000}, - {0x000083c0, 0x00000000}, - {0x000083c4, 0x00000000}, - {0x000083c8, 0x00000000}, - {0x000083cc, 0x00000200}, - {0x000083d0, 0x000301ff}, -}; - -static const u32 ar9462_2p0_mac_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, - {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, - {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, - {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, - {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b}, - {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, - {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, - {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, -}; - -static const u32 ar9462_common_mixed_rx_gain_table_2p0[][2] = { - /* Addr allmodes */ - {0x0000a000, 0x00010000}, - {0x0000a004, 0x00030002}, - {0x0000a008, 0x00050004}, - {0x0000a00c, 0x00810080}, - {0x0000a010, 0x00830082}, - {0x0000a014, 0x01810180}, - {0x0000a018, 0x01830182}, - {0x0000a01c, 0x01850184}, - {0x0000a020, 0x01890188}, - {0x0000a024, 0x018b018a}, - {0x0000a028, 0x018d018c}, - {0x0000a02c, 0x03820190}, - {0x0000a030, 0x03840383}, - {0x0000a034, 0x03880385}, - {0x0000a038, 0x038a0389}, - {0x0000a03c, 0x038c038b}, - {0x0000a040, 0x0390038d}, - {0x0000a044, 0x03920391}, - {0x0000a048, 0x03940393}, - {0x0000a04c, 0x03960395}, - {0x0000a050, 0x00000000}, - {0x0000a054, 0x00000000}, - {0x0000a058, 0x00000000}, - {0x0000a05c, 0x00000000}, - {0x0000a060, 0x00000000}, - {0x0000a064, 0x00000000}, - {0x0000a068, 0x00000000}, - {0x0000a06c, 0x00000000}, - {0x0000a070, 0x00000000}, - {0x0000a074, 0x00000000}, - {0x0000a078, 0x00000000}, - {0x0000a07c, 0x00000000}, - {0x0000a080, 0x29292929}, - {0x0000a084, 0x29292929}, - {0x0000a088, 0x29292929}, - {0x0000a08c, 0x29292929}, - {0x0000a090, 0x22292929}, - {0x0000a094, 0x1d1d2222}, - {0x0000a098, 0x0c111117}, - {0x0000a09c, 0x00030303}, - {0x0000a0a0, 0x00000000}, - {0x0000a0a4, 0x00000000}, - {0x0000a0a8, 0x00000000}, - {0x0000a0ac, 0x00000000}, - {0x0000a0b0, 0x00000000}, - {0x0000a0b4, 0x00000000}, - {0x0000a0b8, 0x00000000}, - {0x0000a0bc, 0x00000000}, - {0x0000a0c0, 0x001f0000}, - {0x0000a0c4, 0x01000101}, - {0x0000a0c8, 0x011e011f}, - {0x0000a0cc, 0x011c011d}, - {0x0000a0d0, 0x02030204}, - {0x0000a0d4, 0x02010202}, - {0x0000a0d8, 0x021f0200}, - {0x0000a0dc, 0x0302021e}, - {0x0000a0e0, 0x03000301}, - {0x0000a0e4, 0x031e031f}, - {0x0000a0e8, 0x0402031d}, - {0x0000a0ec, 0x04000401}, - {0x0000a0f0, 0x041e041f}, - {0x0000a0f4, 0x0502041d}, - {0x0000a0f8, 0x05000501}, - {0x0000a0fc, 0x051e051f}, - {0x0000a100, 0x06010602}, - {0x0000a104, 0x061f0600}, - {0x0000a108, 0x061d061e}, - {0x0000a10c, 0x07020703}, - {0x0000a110, 0x07000701}, - {0x0000a114, 0x00000000}, - {0x0000a118, 0x00000000}, - {0x0000a11c, 0x00000000}, - {0x0000a120, 0x00000000}, - {0x0000a124, 0x00000000}, - {0x0000a128, 0x00000000}, - {0x0000a12c, 0x00000000}, - {0x0000a130, 0x00000000}, - {0x0000a134, 0x00000000}, - {0x0000a138, 0x00000000}, - {0x0000a13c, 0x00000000}, - {0x0000a140, 0x001f0000}, - {0x0000a144, 0x01000101}, - {0x0000a148, 0x011e011f}, - {0x0000a14c, 0x011c011d}, - {0x0000a150, 0x02030204}, - {0x0000a154, 0x02010202}, - {0x0000a158, 0x021f0200}, - {0x0000a15c, 0x0302021e}, - {0x0000a160, 0x03000301}, - {0x0000a164, 0x031e031f}, - {0x0000a168, 0x0402031d}, - {0x0000a16c, 0x04000401}, - {0x0000a170, 0x041e041f}, - {0x0000a174, 0x0502041d}, - {0x0000a178, 0x05000501}, - {0x0000a17c, 0x051e051f}, - {0x0000a180, 0x06010602}, - {0x0000a184, 0x061f0600}, - {0x0000a188, 0x061d061e}, - {0x0000a18c, 0x07020703}, - {0x0000a190, 0x07000701}, - {0x0000a194, 0x00000000}, - {0x0000a198, 0x00000000}, - {0x0000a19c, 0x00000000}, - {0x0000a1a0, 0x00000000}, - {0x0000a1a4, 0x00000000}, - {0x0000a1a8, 0x00000000}, - {0x0000a1ac, 0x00000000}, - {0x0000a1b0, 0x00000000}, - {0x0000a1b4, 0x00000000}, - {0x0000a1b8, 0x00000000}, - {0x0000a1bc, 0x00000000}, - {0x0000a1c0, 0x00000000}, - {0x0000a1c4, 0x00000000}, - {0x0000a1c8, 0x00000000}, - {0x0000a1cc, 0x00000000}, - {0x0000a1d0, 0x00000000}, - {0x0000a1d4, 0x00000000}, - {0x0000a1d8, 0x00000000}, - {0x0000a1dc, 0x00000000}, - {0x0000a1e0, 0x00000000}, - {0x0000a1e4, 0x00000000}, - {0x0000a1e8, 0x00000000}, - {0x0000a1ec, 0x00000000}, - {0x0000a1f0, 0x00000396}, - {0x0000a1f4, 0x00000396}, - {0x0000a1f8, 0x00000396}, - {0x0000a1fc, 0x00000196}, - {0x0000b000, 0x00010000}, - {0x0000b004, 0x00030002}, - {0x0000b008, 0x00050004}, - {0x0000b00c, 0x00810080}, - {0x0000b010, 0x00830082}, - {0x0000b014, 0x01810180}, - {0x0000b018, 0x01830182}, - {0x0000b01c, 0x01850184}, - {0x0000b020, 0x02810280}, - {0x0000b024, 0x02830282}, - {0x0000b028, 0x02850284}, - {0x0000b02c, 0x02890288}, - {0x0000b030, 0x028b028a}, - {0x0000b034, 0x0388028c}, - {0x0000b038, 0x038a0389}, - {0x0000b03c, 0x038c038b}, - {0x0000b040, 0x0390038d}, - {0x0000b044, 0x03920391}, - {0x0000b048, 0x03940393}, - {0x0000b04c, 0x03960395}, - {0x0000b050, 0x00000000}, - {0x0000b054, 0x00000000}, - {0x0000b058, 0x00000000}, - {0x0000b05c, 0x00000000}, - {0x0000b060, 0x00000000}, - {0x0000b064, 0x00000000}, - {0x0000b068, 0x00000000}, - {0x0000b06c, 0x00000000}, - {0x0000b070, 0x00000000}, - {0x0000b074, 0x00000000}, - {0x0000b078, 0x00000000}, - {0x0000b07c, 0x00000000}, - {0x0000b080, 0x2a2d2f32}, - {0x0000b084, 0x21232328}, - {0x0000b088, 0x19191c1e}, - {0x0000b08c, 0x12141417}, - {0x0000b090, 0x07070e0e}, - {0x0000b094, 0x03030305}, - {0x0000b098, 0x00000003}, - {0x0000b09c, 0x00000000}, - {0x0000b0a0, 0x00000000}, - {0x0000b0a4, 0x00000000}, - {0x0000b0a8, 0x00000000}, - {0x0000b0ac, 0x00000000}, - {0x0000b0b0, 0x00000000}, - {0x0000b0b4, 0x00000000}, - {0x0000b0b8, 0x00000000}, - {0x0000b0bc, 0x00000000}, - {0x0000b0c0, 0x003f0020}, - {0x0000b0c4, 0x00400041}, - {0x0000b0c8, 0x0140005f}, - {0x0000b0cc, 0x0160015f}, - {0x0000b0d0, 0x017e017f}, - {0x0000b0d4, 0x02410242}, - {0x0000b0d8, 0x025f0240}, - {0x0000b0dc, 0x027f0260}, - {0x0000b0e0, 0x0341027e}, - {0x0000b0e4, 0x035f0340}, - {0x0000b0e8, 0x037f0360}, - {0x0000b0ec, 0x04400441}, - {0x0000b0f0, 0x0460045f}, - {0x0000b0f4, 0x0541047f}, - {0x0000b0f8, 0x055f0540}, - {0x0000b0fc, 0x057f0560}, - {0x0000b100, 0x06400641}, - {0x0000b104, 0x0660065f}, - {0x0000b108, 0x067e067f}, - {0x0000b10c, 0x07410742}, - {0x0000b110, 0x075f0740}, - {0x0000b114, 0x077f0760}, - {0x0000b118, 0x07800781}, - {0x0000b11c, 0x07a0079f}, - {0x0000b120, 0x07c107bf}, - {0x0000b124, 0x000007c0}, - {0x0000b128, 0x00000000}, - {0x0000b12c, 0x00000000}, - {0x0000b130, 0x00000000}, - {0x0000b134, 0x00000000}, - {0x0000b138, 0x00000000}, - {0x0000b13c, 0x00000000}, - {0x0000b140, 0x003f0020}, - {0x0000b144, 0x00400041}, - {0x0000b148, 0x0140005f}, - {0x0000b14c, 0x0160015f}, - {0x0000b150, 0x017e017f}, - {0x0000b154, 0x02410242}, - {0x0000b158, 0x025f0240}, - {0x0000b15c, 0x027f0260}, - {0x0000b160, 0x0341027e}, - {0x0000b164, 0x035f0340}, - {0x0000b168, 0x037f0360}, - {0x0000b16c, 0x04400441}, - {0x0000b170, 0x0460045f}, - {0x0000b174, 0x0541047f}, - {0x0000b178, 0x055f0540}, - {0x0000b17c, 0x057f0560}, - {0x0000b180, 0x06400641}, - {0x0000b184, 0x0660065f}, - {0x0000b188, 0x067e067f}, - {0x0000b18c, 0x07410742}, - {0x0000b190, 0x075f0740}, - {0x0000b194, 0x077f0760}, - {0x0000b198, 0x07800781}, - {0x0000b19c, 0x07a0079f}, - {0x0000b1a0, 0x07c107bf}, - {0x0000b1a4, 0x000007c0}, - {0x0000b1a8, 0x00000000}, - {0x0000b1ac, 0x00000000}, - {0x0000b1b0, 0x00000000}, - {0x0000b1b4, 0x00000000}, - {0x0000b1b8, 0x00000000}, - {0x0000b1bc, 0x00000000}, - {0x0000b1c0, 0x00000000}, - {0x0000b1c4, 0x00000000}, - {0x0000b1c8, 0x00000000}, - {0x0000b1cc, 0x00000000}, - {0x0000b1d0, 0x00000000}, - {0x0000b1d4, 0x00000000}, - {0x0000b1d8, 0x00000000}, - {0x0000b1dc, 0x00000000}, - {0x0000b1e0, 0x00000000}, - {0x0000b1e4, 0x00000000}, - {0x0000b1e8, 0x00000000}, - {0x0000b1ec, 0x00000000}, - {0x0000b1f0, 0x00000396}, - {0x0000b1f4, 0x00000396}, - {0x0000b1f8, 0x00000396}, - {0x0000b1fc, 0x00000196}, -}; - -#endif /* INITVALS_9462_2P0_H */ diff --git a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h b/drivers/net/wireless/ath/ath9k/ar9485_initvals.h deleted file mode 100644 index 88ff1d7b53ab..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9485_initvals.h +++ /dev/null @@ -1,1211 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef INITVALS_9485_H -#define INITVALS_9485_H - -/* AR9485 1.1 */ - -#define ar9485_1_1_mac_postamble ar9300_2p2_mac_postamble - -static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_disable_L1[][2] = { - /* Addr allmodes */ - {0x00018c00, 0x18012e5e}, - {0x00018c04, 0x000801d8}, - {0x00018c08, 0x0000080c}, -}; - -static const u32 ar9485Common_wo_xlna_rx_gain_1_1[][2] = { - /* Addr allmodes */ - {0x00009e00, 0x037216a0}, - {0x00009e04, 0x00182020}, - {0x00009e18, 0x00000000}, - {0x00009e2c, 0x00004121}, - {0x00009e44, 0x02282324}, - {0x0000a000, 0x00060005}, - {0x0000a004, 0x00810080}, - {0x0000a008, 0x00830082}, - {0x0000a00c, 0x00850084}, - {0x0000a010, 0x01820181}, - {0x0000a014, 0x01840183}, - {0x0000a018, 0x01880185}, - {0x0000a01c, 0x018a0189}, - {0x0000a020, 0x02850284}, - {0x0000a024, 0x02890288}, - {0x0000a028, 0x028b028a}, - {0x0000a02c, 0x03850384}, - {0x0000a030, 0x03890388}, - {0x0000a034, 0x038b038a}, - {0x0000a038, 0x038d038c}, - {0x0000a03c, 0x03910390}, - {0x0000a040, 0x03930392}, - {0x0000a044, 0x03950394}, - {0x0000a048, 0x00000396}, - {0x0000a04c, 0x00000000}, - {0x0000a050, 0x00000000}, - {0x0000a054, 0x00000000}, - {0x0000a058, 0x00000000}, - {0x0000a05c, 0x00000000}, - {0x0000a060, 0x00000000}, - {0x0000a064, 0x00000000}, - {0x0000a068, 0x00000000}, - {0x0000a06c, 0x00000000}, - {0x0000a070, 0x00000000}, - {0x0000a074, 0x00000000}, - {0x0000a078, 0x00000000}, - {0x0000a07c, 0x00000000}, - {0x0000a080, 0x28282828}, - {0x0000a084, 0x28282828}, - {0x0000a088, 0x28282828}, - {0x0000a08c, 0x28282828}, - {0x0000a090, 0x28282828}, - {0x0000a094, 0x24242428}, - {0x0000a098, 0x171e1e1e}, - {0x0000a09c, 0x02020b0b}, - {0x0000a0a0, 0x02020202}, - {0x0000a0a4, 0x00000000}, - {0x0000a0a8, 0x00000000}, - {0x0000a0ac, 0x00000000}, - {0x0000a0b0, 0x00000000}, - {0x0000a0b4, 0x00000000}, - {0x0000a0b8, 0x00000000}, - {0x0000a0bc, 0x00000000}, - {0x0000a0c0, 0x22072208}, - {0x0000a0c4, 0x22052206}, - {0x0000a0c8, 0x22032204}, - {0x0000a0cc, 0x22012202}, - {0x0000a0d0, 0x221f2200}, - {0x0000a0d4, 0x221d221e}, - {0x0000a0d8, 0x33023303}, - {0x0000a0dc, 0x33003301}, - {0x0000a0e0, 0x331e331f}, - {0x0000a0e4, 0x4402331d}, - {0x0000a0e8, 0x44004401}, - {0x0000a0ec, 0x441e441f}, - {0x0000a0f0, 0x55025503}, - {0x0000a0f4, 0x55005501}, - {0x0000a0f8, 0x551e551f}, - {0x0000a0fc, 0x6602551d}, - {0x0000a100, 0x66006601}, - {0x0000a104, 0x661e661f}, - {0x0000a108, 0x7703661d}, - {0x0000a10c, 0x77017702}, - {0x0000a110, 0x00007700}, - {0x0000a114, 0x00000000}, - {0x0000a118, 0x00000000}, - {0x0000a11c, 0x00000000}, - {0x0000a120, 0x00000000}, - {0x0000a124, 0x00000000}, - {0x0000a128, 0x00000000}, - {0x0000a12c, 0x00000000}, - {0x0000a130, 0x00000000}, - {0x0000a134, 0x00000000}, - {0x0000a138, 0x00000000}, - {0x0000a13c, 0x00000000}, - {0x0000a140, 0x001f0000}, - {0x0000a144, 0x111f1100}, - {0x0000a148, 0x111d111e}, - {0x0000a14c, 0x111b111c}, - {0x0000a150, 0x22032204}, - {0x0000a154, 0x22012202}, - {0x0000a158, 0x221f2200}, - {0x0000a15c, 0x221d221e}, - {0x0000a160, 0x33013302}, - {0x0000a164, 0x331f3300}, - {0x0000a168, 0x4402331e}, - {0x0000a16c, 0x44004401}, - {0x0000a170, 0x441e441f}, - {0x0000a174, 0x55015502}, - {0x0000a178, 0x551f5500}, - {0x0000a17c, 0x6602551e}, - {0x0000a180, 0x66006601}, - {0x0000a184, 0x661e661f}, - {0x0000a188, 0x7703661d}, - {0x0000a18c, 0x77017702}, - {0x0000a190, 0x00007700}, - {0x0000a194, 0x00000000}, - {0x0000a198, 0x00000000}, - {0x0000a19c, 0x00000000}, - {0x0000a1a0, 0x00000000}, - {0x0000a1a4, 0x00000000}, - {0x0000a1a8, 0x00000000}, - {0x0000a1ac, 0x00000000}, - {0x0000a1b0, 0x00000000}, - {0x0000a1b4, 0x00000000}, - {0x0000a1b8, 0x00000000}, - {0x0000a1bc, 0x00000000}, - {0x0000a1c0, 0x00000000}, - {0x0000a1c4, 0x00000000}, - {0x0000a1c8, 0x00000000}, - {0x0000a1cc, 0x00000000}, - {0x0000a1d0, 0x00000000}, - {0x0000a1d4, 0x00000000}, - {0x0000a1d8, 0x00000000}, - {0x0000a1dc, 0x00000000}, - {0x0000a1e0, 0x00000000}, - {0x0000a1e4, 0x00000000}, - {0x0000a1e8, 0x00000000}, - {0x0000a1ec, 0x00000000}, - {0x0000a1f0, 0x00000396}, - {0x0000a1f4, 0x00000396}, - {0x0000a1f8, 0x00000396}, - {0x0000a1fc, 0x00000296}, -}; - -static const u32 ar9485Modes_high_power_tx_gain_1_1[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x000098bc, 0x00000002, 0x00000002, 0x00000002, 0x00000002}, - {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0x7999a83a, 0x7999a83a}, - {0x0000a2dc, 0x00000000, 0x00000000, 0xfe2d3552, 0xfe2d3552}, - {0x0000a2e0, 0x00000000, 0x00000000, 0xfe2d3552, 0xfe2d3552}, - {0x0000a2e4, 0x00000000, 0x00000000, 0xfe2d3552, 0xfe2d3552}, - {0x0000a2e8, 0x00000000, 0x00000000, 0xfe2d3552, 0xfe2d3552}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, - {0x0000a458, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, - {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, - {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, - {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, - {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, - {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, - {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, - {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, - {0x0000a520, 0x2f001f04, 0x2f001f04, 0x21000603, 0x21000603}, - {0x0000a524, 0x35001fc4, 0x35001fc4, 0x25000605, 0x25000605}, - {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2a000a03, 0x2a000a03}, - {0x0000a52c, 0x41023e85, 0x41023e85, 0x2c000a04, 0x2c000a04}, - {0x0000a530, 0x48023ec6, 0x48023ec6, 0x34000e20, 0x34000e20}, - {0x0000a534, 0x4d023f01, 0x4d023f01, 0x35000e21, 0x35000e21}, - {0x0000a538, 0x53023f4b, 0x53023f4b, 0x43000e62, 0x43000e62}, - {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x45000e63, 0x45000e63}, - {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x49000e65, 0x49000e65}, - {0x0000a544, 0x6502feca, 0x6502feca, 0x4b000e66, 0x4b000e66}, - {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x4d001645, 0x4d001645}, - {0x0000a54c, 0x7203feca, 0x7203feca, 0x51001865, 0x51001865}, - {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x55001a86, 0x55001a86}, - {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x57001ce9, 0x57001ce9}, - {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x5a001ceb, 0x5a001ceb}, - {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x5e001eeb, 0x5e001eeb}, - {0x0000a560, 0x900fff0b, 0x900fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a564, 0x960fffcb, 0x960fffcb, 0x5e001eeb, 0x5e001eeb}, - {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a580, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a584, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a588, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a58c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a590, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a594, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a598, 0x00000000, 0x00000000, 0x01404501, 0x01404501}, - {0x0000a59c, 0x00000000, 0x00000000, 0x02808a02, 0x02808a02}, - {0x0000a5a0, 0x00000000, 0x00000000, 0x02808a02, 0x02808a02}, - {0x0000a5a4, 0x00000000, 0x00000000, 0x02808803, 0x02808803}, - {0x0000a5a8, 0x00000000, 0x00000000, 0x04c14b04, 0x04c14b04}, - {0x0000a5ac, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000a5b0, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000a5b4, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000a5b8, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000a5bc, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000b500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b504, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b508, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b50c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b510, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b514, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b518, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b51c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b520, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b524, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b528, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b52c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b530, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b534, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b538, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b53c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b540, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b544, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b548, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b54c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b550, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b554, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b558, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b55c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b560, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b564, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b568, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b56c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b570, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b574, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b578, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b57c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00016044, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db}, - {0x00016048, 0x6c924260, 0x6c924260, 0x6c924260, 0x6c924260}, -}; - -static const u32 ar9485Modes_green_ob_db_tx_gain_1_1[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x000098bc, 0x00000003, 0x00000003, 0x00000003, 0x00000003}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, - {0x0000a458, 0x80000000, 0x80000000, 0x80000000, 0x80000000}, - {0x0000a500, 0x00022200, 0x00022200, 0x00000006, 0x00000006}, - {0x0000a504, 0x05062002, 0x05062002, 0x03000201, 0x03000201}, - {0x0000a508, 0x0c002e00, 0x0c002e00, 0x06000203, 0x06000203}, - {0x0000a50c, 0x11062202, 0x11062202, 0x0a000401, 0x0a000401}, - {0x0000a510, 0x17022e00, 0x17022e00, 0x0e000403, 0x0e000403}, - {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x12000405, 0x12000405}, - {0x0000a518, 0x25020ec0, 0x25020ec0, 0x15000604, 0x15000604}, - {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x18000605, 0x18000605}, - {0x0000a520, 0x2f001f04, 0x2f001f04, 0x1c000a04, 0x1c000a04}, - {0x0000a524, 0x35001fc4, 0x35001fc4, 0x21000a06, 0x21000a06}, - {0x0000a528, 0x3c022f04, 0x3c022f04, 0x29000a24, 0x29000a24}, - {0x0000a52c, 0x41023e85, 0x41023e85, 0x2f000e21, 0x2f000e21}, - {0x0000a530, 0x48023ec6, 0x48023ec6, 0x31000e20, 0x31000e20}, - {0x0000a534, 0x4d023f01, 0x4d023f01, 0x33000e20, 0x33000e20}, - {0x0000a538, 0x53023f4b, 0x53023f4b, 0x43000e62, 0x43000e62}, - {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x45000e63, 0x45000e63}, - {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x49000e65, 0x49000e65}, - {0x0000a544, 0x6502feca, 0x6502feca, 0x4b000e66, 0x4b000e66}, - {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x4d001645, 0x4d001645}, - {0x0000a54c, 0x7203feca, 0x7203feca, 0x51001865, 0x51001865}, - {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x55001a86, 0x55001a86}, - {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x57001ce9, 0x57001ce9}, - {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x5a001ceb, 0x5a001ceb}, - {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x5e001eeb, 0x5e001eeb}, - {0x0000a560, 0x900fff0b, 0x900fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a564, 0x960fffcb, 0x960fffcb, 0x5e001eeb, 0x5e001eeb}, - {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000b500, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b504, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b508, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b50c, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b510, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b514, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b518, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b51c, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b520, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b524, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b528, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b52c, 0x0000002a, 0x0000002a, 0x0000002a, 0x0000002a}, - {0x0000b530, 0x0000003a, 0x0000003a, 0x0000003a, 0x0000003a}, - {0x0000b534, 0x0000004a, 0x0000004a, 0x0000004a, 0x0000004a}, - {0x0000b538, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b53c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b540, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b544, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b548, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b54c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b550, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b554, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b558, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b55c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b560, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b564, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b568, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b56c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b570, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b574, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b578, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b57c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x00016044, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db}, - {0x00016048, 0x6c924260, 0x6c924260, 0x6c924260, 0x6c924260}, -}; - -static const u32 ar9485Modes_high_ob_db_tx_gain_1_1[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x000098bc, 0x00000002, 0x00000002, 0x00000002, 0x00000002}, - {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0x7999a83a, 0x7999a83a}, - {0x0000a2dc, 0x00000000, 0x00000000, 0xfe2d3552, 0xfe2d3552}, - {0x0000a2e0, 0x00000000, 0x00000000, 0xffc63a84, 0xffc63a84}, - {0x0000a2e4, 0x00000000, 0x00000000, 0xfe0fc000, 0xfe0fc000}, - {0x0000a2e8, 0x00000000, 0x00000000, 0xfff00000, 0xfff00000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, - {0x0000a458, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, - {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, - {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, - {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, - {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, - {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, - {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, - {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, - {0x0000a520, 0x2f001f04, 0x2f001f04, 0x21000603, 0x21000603}, - {0x0000a524, 0x35001fc4, 0x35001fc4, 0x25000605, 0x25000605}, - {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2a000a03, 0x2a000a03}, - {0x0000a52c, 0x41023e85, 0x41023e85, 0x2c000a04, 0x2c000a04}, - {0x0000a530, 0x48023ec6, 0x48023ec6, 0x34000e20, 0x34000e20}, - {0x0000a534, 0x4d023f01, 0x4d023f01, 0x35000e21, 0x35000e21}, - {0x0000a538, 0x53023f4b, 0x53023f4b, 0x43000e62, 0x43000e62}, - {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x45000e63, 0x45000e63}, - {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x49000e65, 0x49000e65}, - {0x0000a544, 0x6502feca, 0x6502feca, 0x4b000e66, 0x4b000e66}, - {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x4d001645, 0x4d001645}, - {0x0000a54c, 0x7203feca, 0x7203feca, 0x51001865, 0x51001865}, - {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x55001a86, 0x55001a86}, - {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x57001ce9, 0x57001ce9}, - {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x5a001ceb, 0x5a001ceb}, - {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x5e001eeb, 0x5e001eeb}, - {0x0000a560, 0x900fff0b, 0x900fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a564, 0x960fffcb, 0x960fffcb, 0x5e001eeb, 0x5e001eeb}, - {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a580, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a584, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a588, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a58c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a590, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a594, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a598, 0x00000000, 0x00000000, 0x01404501, 0x01404501}, - {0x0000a59c, 0x00000000, 0x00000000, 0x02808a02, 0x02808a02}, - {0x0000a5a0, 0x00000000, 0x00000000, 0x02808a02, 0x02808a02}, - {0x0000a5a4, 0x00000000, 0x00000000, 0x02808803, 0x02808803}, - {0x0000a5a8, 0x00000000, 0x00000000, 0x04c14b04, 0x04c14b04}, - {0x0000a5ac, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000a5b0, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000a5b4, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000a5b8, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000a5bc, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000b500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b504, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b508, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b50c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b510, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b514, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b518, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b51c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b520, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b524, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b528, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b52c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b530, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b534, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b538, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b53c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b540, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b544, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b548, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b54c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b550, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b554, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b558, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b55c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b560, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b564, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b568, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b56c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b570, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b574, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b578, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b57c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00016044, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db}, - {0x00016048, 0x6c924260, 0x6c924260, 0x6c924260, 0x6c924260}, -}; - -static const u32 ar9485Modes_low_ob_db_tx_gain_1_1[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x000098bc, 0x00000002, 0x00000002, 0x00000002, 0x00000002}, - {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0x7999a83a, 0x7999a83a}, - {0x0000a2dc, 0x00000000, 0x00000000, 0xfe2d3552, 0xfe2d3552}, - {0x0000a2e0, 0x00000000, 0x00000000, 0xfe2d3552, 0xfe2d3552}, - {0x0000a2e4, 0x00000000, 0x00000000, 0xfe2d3552, 0xfe2d3552}, - {0x0000a2e8, 0x00000000, 0x00000000, 0xfe2d3552, 0xfe2d3552}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, - {0x0000a458, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, - {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, - {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, - {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, - {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, - {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, - {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, - {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, - {0x0000a520, 0x2f001f04, 0x2f001f04, 0x21000603, 0x21000603}, - {0x0000a524, 0x35001fc4, 0x35001fc4, 0x25000605, 0x25000605}, - {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2a000a03, 0x2a000a03}, - {0x0000a52c, 0x41023e85, 0x41023e85, 0x2c000a04, 0x2c000a04}, - {0x0000a530, 0x48023ec6, 0x48023ec6, 0x34000e20, 0x34000e20}, - {0x0000a534, 0x4d023f01, 0x4d023f01, 0x35000e21, 0x35000e21}, - {0x0000a538, 0x53023f4b, 0x53023f4b, 0x43000e62, 0x43000e62}, - {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x45000e63, 0x45000e63}, - {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x49000e65, 0x49000e65}, - {0x0000a544, 0x6502feca, 0x6502feca, 0x4b000e66, 0x4b000e66}, - {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x4d001645, 0x4d001645}, - {0x0000a54c, 0x7203feca, 0x7203feca, 0x51001865, 0x51001865}, - {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x55001a86, 0x55001a86}, - {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x57001ce9, 0x57001ce9}, - {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x5a001ceb, 0x5a001ceb}, - {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x5e001eeb, 0x5e001eeb}, - {0x0000a560, 0x900fff0b, 0x900fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a564, 0x960fffcb, 0x960fffcb, 0x5e001eeb, 0x5e001eeb}, - {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x5e001eeb, 0x5e001eeb}, - {0x0000a580, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a584, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a588, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a58c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a590, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a594, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a598, 0x00000000, 0x00000000, 0x01404501, 0x01404501}, - {0x0000a59c, 0x00000000, 0x00000000, 0x02808a02, 0x02808a02}, - {0x0000a5a0, 0x00000000, 0x00000000, 0x02808a02, 0x02808a02}, - {0x0000a5a4, 0x00000000, 0x00000000, 0x02808803, 0x02808803}, - {0x0000a5a8, 0x00000000, 0x00000000, 0x04c14b04, 0x04c14b04}, - {0x0000a5ac, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000a5b0, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000a5b4, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000a5b8, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000a5bc, 0x00000000, 0x00000000, 0x04c15305, 0x04c15305}, - {0x0000b500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b504, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b508, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b50c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b510, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b514, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b518, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b51c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b520, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b524, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b528, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b52c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b530, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b534, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b538, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b53c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b540, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b544, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b548, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b54c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b550, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b554, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b558, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b55c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b560, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b564, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b568, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b56c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b570, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b574, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b578, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000b57c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00016044, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db}, - {0x00016048, 0x6c924260, 0x6c924260, 0x6c924260, 0x6c924260}, -}; - -#define ar9485_modes_lowest_ob_db_tx_gain_1_1 ar9485Modes_low_ob_db_tx_gain_1_1 - -static const u32 ar9485Modes_green_spur_ob_db_tx_gain_1_1[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x000098bc, 0x00000003, 0x00000003, 0x00000003, 0x00000003}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, - {0x0000a458, 0x80000000, 0x80000000, 0x80000000, 0x80000000}, - {0x0000a500, 0x00022200, 0x00022200, 0x00000006, 0x00000006}, - {0x0000a504, 0x05062002, 0x05062002, 0x03000201, 0x03000201}, - {0x0000a508, 0x0c002e00, 0x0c002e00, 0x07000203, 0x07000203}, - {0x0000a50c, 0x11062202, 0x11062202, 0x0a000401, 0x0a000401}, - {0x0000a510, 0x17022e00, 0x17022e00, 0x0e000403, 0x0e000403}, - {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x12000405, 0x12000405}, - {0x0000a518, 0x25020ec0, 0x25020ec0, 0x14000406, 0x14000406}, - {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1800040a, 0x1800040a}, - {0x0000a520, 0x2f001f04, 0x2f001f04, 0x1c000460, 0x1c000460}, - {0x0000a524, 0x35001fc4, 0x35001fc4, 0x22000463, 0x22000463}, - {0x0000a528, 0x3c022f04, 0x3c022f04, 0x26000465, 0x26000465}, - {0x0000a52c, 0x41023e85, 0x41023e85, 0x2e0006e0, 0x2e0006e0}, - {0x0000a530, 0x48023ec6, 0x48023ec6, 0x310006e0, 0x310006e0}, - {0x0000a534, 0x4d023f01, 0x4d023f01, 0x330006e0, 0x330006e0}, - {0x0000a538, 0x53023f4b, 0x53023f4b, 0x3e0008e3, 0x3e0008e3}, - {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x410008e5, 0x410008e5}, - {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x430008e6, 0x430008e6}, - {0x0000a544, 0x6502feca, 0x6502feca, 0x4a0008ec, 0x4a0008ec}, - {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x4e0008f1, 0x4e0008f1}, - {0x0000a54c, 0x7203feca, 0x7203feca, 0x520008f3, 0x520008f3}, - {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x54000eed, 0x54000eed}, - {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x58000ef1, 0x58000ef1}, - {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x5c000ef3, 0x5c000ef3}, - {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x60000ef5, 0x60000ef5}, - {0x0000a560, 0x900fff0b, 0x900fff0b, 0x62000ef6, 0x62000ef6}, - {0x0000a564, 0x960fffcb, 0x960fffcb, 0x62000ef6, 0x62000ef6}, - {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x62000ef6, 0x62000ef6}, - {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x62000ef6, 0x62000ef6}, - {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x62000ef6, 0x62000ef6}, - {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x62000ef6, 0x62000ef6}, - {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x62000ef6, 0x62000ef6}, - {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x62000ef6, 0x62000ef6}, - {0x0000b500, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b504, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b508, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b50c, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b510, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b514, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b518, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b51c, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b520, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b524, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b528, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a}, - {0x0000b52c, 0x0000002a, 0x0000002a, 0x0000002a, 0x0000002a}, - {0x0000b530, 0x0000003a, 0x0000003a, 0x0000003a, 0x0000003a}, - {0x0000b534, 0x0000004a, 0x0000004a, 0x0000004a, 0x0000004a}, - {0x0000b538, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b53c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b540, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b544, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b548, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b54c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b550, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b554, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b558, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b55c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b560, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b564, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b568, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b56c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b570, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b574, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b578, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x0000b57c, 0x0000005b, 0x0000005b, 0x0000005b, 0x0000005b}, - {0x00016044, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db, 0x05d6b2db}, - {0x00016048, 0x6c924260, 0x6c924260, 0x6c924260, 0x6c924260}, -}; - -static const u32 ar9485_1_1[][2] = { - /* Addr allmodes */ - {0x0000a580, 0x00000000}, - {0x0000a584, 0x00000000}, - {0x0000a588, 0x00000000}, - {0x0000a58c, 0x01804000}, - {0x0000a590, 0x02808a02}, - {0x0000a594, 0x0340ca02}, - {0x0000a598, 0x0340cd03}, - {0x0000a59c, 0x0340cd03}, - {0x0000a5a0, 0x06415304}, - {0x0000a5a4, 0x04c11905}, - {0x0000a5a8, 0x06415905}, - {0x0000a5ac, 0x06415905}, - {0x0000a5b0, 0x06415905}, - {0x0000a5b4, 0x06415905}, - {0x0000a5b8, 0x06415905}, - {0x0000a5bc, 0x06415905}, -}; - -static const u32 ar9485_1_1_radio_core[][2] = { - /* Addr allmodes */ - {0x00016000, 0x36db6db6}, - {0x00016004, 0x6db6db40}, - {0x00016008, 0x73800000}, - {0x0001600c, 0x00000000}, - {0x00016040, 0x7f80fff8}, - {0x0001604c, 0x000f0278}, - {0x00016050, 0x4db6db8c}, - {0x00016054, 0x6db60000}, - {0x00016080, 0x00080000}, - {0x00016084, 0x0e48048c}, - {0x00016088, 0x14214514}, - {0x0001608c, 0x119f081e}, - {0x00016090, 0x24926490}, - {0x00016098, 0xd28b3330}, - {0x000160a0, 0xc2108ffe}, - {0x000160a4, 0x812fc370}, - {0x000160a8, 0x423c8000}, - {0x000160b4, 0x92480040}, - {0x000160c0, 0x006db6db}, - {0x000160c4, 0x0186db60}, - {0x000160c8, 0x6db6db6c}, - {0x000160cc, 0x6de6fbe0}, - {0x000160d0, 0xf7dfcf3c}, - {0x00016100, 0x04cb0001}, - {0x00016104, 0xfff80015}, - {0x00016108, 0x00080010}, - {0x00016144, 0x01884080}, - {0x00016148, 0x00008040}, - {0x00016240, 0x08400000}, - {0x00016244, 0x1bf90f00}, - {0x00016248, 0x00000000}, - {0x0001624c, 0x00000000}, - {0x00016280, 0x01000015}, - {0x00016284, 0x00d30000}, - {0x00016288, 0x00318000}, - {0x0001628c, 0x50000000}, - {0x00016290, 0x4b96210f}, - {0x00016380, 0x00000000}, - {0x00016384, 0x00000000}, - {0x00016388, 0x00800700}, - {0x0001638c, 0x00800700}, - {0x00016390, 0x00800700}, - {0x00016394, 0x00000000}, - {0x00016398, 0x00000000}, - {0x0001639c, 0x00000000}, - {0x000163a0, 0x00000001}, - {0x000163a4, 0x00000001}, - {0x000163a8, 0x00000000}, - {0x000163ac, 0x00000000}, - {0x000163b0, 0x00000000}, - {0x000163b4, 0x00000000}, - {0x000163b8, 0x00000000}, - {0x000163bc, 0x00000000}, - {0x000163c0, 0x000000a0}, - {0x000163c4, 0x000c0000}, - {0x000163c8, 0x14021402}, - {0x000163cc, 0x00001402}, - {0x000163d0, 0x00000000}, - {0x000163d4, 0x00000000}, - {0x00016c40, 0x13188278}, - {0x00016c44, 0x12000000}, -}; - -static const u32 ar9485_1_1_baseband_core[][2] = { - /* Addr allmodes */ - {0x00009800, 0xafe68e30}, - {0x00009804, 0xfd14e000}, - {0x00009808, 0x9c0a8f6b}, - {0x0000980c, 0x04800000}, - {0x00009814, 0x9280c00a}, - {0x00009818, 0x00000000}, - {0x0000981c, 0x00020028}, - {0x00009834, 0x5f3ca3de}, - {0x00009838, 0x0108ecff}, - {0x0000983c, 0x14750600}, - {0x00009880, 0x201fff00}, - {0x00009884, 0x00001042}, - {0x000098a4, 0x00200400}, - {0x000098b0, 0x32840bbe}, - {0x000098d0, 0x004b6a8e}, - {0x000098d4, 0x00000820}, - {0x000098dc, 0x00000000}, - {0x000098f0, 0x00000000}, - {0x000098f4, 0x00000000}, - {0x00009c04, 0x00000000}, - {0x00009c08, 0x03200000}, - {0x00009c0c, 0x00000000}, - {0x00009c10, 0x00000000}, - {0x00009c14, 0x00046384}, - {0x00009c18, 0x05b6b440}, - {0x00009c1c, 0x00b6b440}, - {0x00009d00, 0xc080a333}, - {0x00009d04, 0x40206c10}, - {0x00009d08, 0x009c4060}, - {0x00009d0c, 0x1883800a}, - {0x00009d10, 0x01834061}, - {0x00009d14, 0x00c00400}, - {0x00009d18, 0x00000000}, - {0x00009d1c, 0x00000000}, - {0x00009e08, 0x0038233c}, - {0x00009e24, 0x992bb515}, - {0x00009e28, 0x12ef0200}, - {0x00009e30, 0x06336f77}, - {0x00009e34, 0x6af6532f}, - {0x00009e38, 0x0cc80c00}, - {0x00009e40, 0x0d261820}, - {0x00009e4c, 0x00001004}, - {0x00009e50, 0x00ff03f1}, - {0x00009fc0, 0x80be4788}, - {0x00009fc4, 0x0001efb5}, - {0x00009fcc, 0x40000014}, - {0x0000a20c, 0x00000000}, - {0x0000a210, 0x00000000}, - {0x0000a220, 0x00000000}, - {0x0000a224, 0x00000000}, - {0x0000a228, 0x10002310}, - {0x0000a23c, 0x00000000}, - {0x0000a244, 0x0c000000}, - {0x0000a2a0, 0x00000001}, - {0x0000a2c0, 0x00000001}, - {0x0000a2c8, 0x00000000}, - {0x0000a2cc, 0x18c43433}, - {0x0000a2d4, 0x00000000}, - {0x0000a2dc, 0x00000000}, - {0x0000a2e0, 0x00000000}, - {0x0000a2e4, 0x00000000}, - {0x0000a2e8, 0x00000000}, - {0x0000a2ec, 0x00000000}, - {0x0000a2f0, 0x00000000}, - {0x0000a2f4, 0x00000000}, - {0x0000a2f8, 0x00000000}, - {0x0000a344, 0x00000000}, - {0x0000a34c, 0x00000000}, - {0x0000a350, 0x0000a000}, - {0x0000a364, 0x00000000}, - {0x0000a370, 0x00000000}, - {0x0000a390, 0x00000001}, - {0x0000a394, 0x00000444}, - {0x0000a398, 0x001f0e0f}, - {0x0000a39c, 0x0075393f}, - {0x0000a3a0, 0xb79f6427}, - {0x0000a3a4, 0x000000ff}, - {0x0000a3a8, 0x3b3b3b3b}, - {0x0000a3ac, 0x2f2f2f2f}, - {0x0000a3c0, 0x20202020}, - {0x0000a3c4, 0x22222220}, - {0x0000a3c8, 0x20200020}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3d8, 0x20202020}, - {0x0000a3dc, 0x20202020}, - {0x0000a3e0, 0x20202020}, - {0x0000a3e4, 0x20202020}, - {0x0000a3e8, 0x20202020}, - {0x0000a3ec, 0x20202020}, - {0x0000a3f0, 0x00000000}, - {0x0000a3f4, 0x00000006}, - {0x0000a3f8, 0x0cdbd380}, - {0x0000a3fc, 0x000f0f01}, - {0x0000a400, 0x8fa91f01}, - {0x0000a404, 0x00000000}, - {0x0000a408, 0x0e79e5c6}, - {0x0000a40c, 0x00820820}, - {0x0000a414, 0x1ce739cf}, - {0x0000a418, 0x2d0021ce}, - {0x0000a41c, 0x1ce739ce}, - {0x0000a420, 0x000001ce}, - {0x0000a424, 0x1ce739ce}, - {0x0000a428, 0x000001ce}, - {0x0000a42c, 0x1ce739ce}, - {0x0000a430, 0x1ce739ce}, - {0x0000a434, 0x00000000}, - {0x0000a438, 0x00001801}, - {0x0000a43c, 0x00000000}, - {0x0000a440, 0x00000000}, - {0x0000a444, 0x00000000}, - {0x0000a448, 0x04000000}, - {0x0000a44c, 0x00000001}, - {0x0000a450, 0x00010000}, - {0x0000a5c4, 0xbfad9d74}, - {0x0000a5c8, 0x00480605}, - {0x0000a5cc, 0x00002e37}, - {0x0000a760, 0x03020100}, - {0x0000a764, 0x09080504}, - {0x0000a768, 0x0d0c0b0a}, - {0x0000a76c, 0x13121110}, - {0x0000a770, 0x31301514}, - {0x0000a774, 0x35343332}, - {0x0000a778, 0x00000036}, - {0x0000a780, 0x00000838}, - {0x0000a7c0, 0x00000000}, - {0x0000a7c4, 0xfffffffc}, - {0x0000a7c8, 0x00000000}, - {0x0000a7cc, 0x00000000}, - {0x0000a7d0, 0x00000000}, - {0x0000a7d4, 0x00000004}, - {0x0000a7dc, 0x00000000}, -}; - -static const u32 ar9485_common_rx_gain_1_1[][2] = { - /* Addr allmodes */ - {0x00009e00, 0x03721b20}, - {0x00009e04, 0x00082020}, - {0x00009e18, 0x0300501e}, - {0x00009e2c, 0x00002e21}, - {0x00009e44, 0x02182324}, - {0x0000a000, 0x00060005}, - {0x0000a004, 0x00810080}, - {0x0000a008, 0x00830082}, - {0x0000a00c, 0x00850084}, - {0x0000a010, 0x01820181}, - {0x0000a014, 0x01840183}, - {0x0000a018, 0x01880185}, - {0x0000a01c, 0x018a0189}, - {0x0000a020, 0x02850284}, - {0x0000a024, 0x02890288}, - {0x0000a028, 0x028b028a}, - {0x0000a02c, 0x03850384}, - {0x0000a030, 0x03890388}, - {0x0000a034, 0x038b038a}, - {0x0000a038, 0x038d038c}, - {0x0000a03c, 0x03910390}, - {0x0000a040, 0x03930392}, - {0x0000a044, 0x03950394}, - {0x0000a048, 0x00000396}, - {0x0000a04c, 0x00000000}, - {0x0000a050, 0x00000000}, - {0x0000a054, 0x00000000}, - {0x0000a058, 0x00000000}, - {0x0000a05c, 0x00000000}, - {0x0000a060, 0x00000000}, - {0x0000a064, 0x00000000}, - {0x0000a068, 0x00000000}, - {0x0000a06c, 0x00000000}, - {0x0000a070, 0x00000000}, - {0x0000a074, 0x00000000}, - {0x0000a078, 0x00000000}, - {0x0000a07c, 0x00000000}, - {0x0000a080, 0x18181818}, - {0x0000a084, 0x18181818}, - {0x0000a088, 0x18181818}, - {0x0000a08c, 0x18181818}, - {0x0000a090, 0x18181818}, - {0x0000a094, 0x18181818}, - {0x0000a098, 0x17181818}, - {0x0000a09c, 0x02020b0b}, - {0x0000a0a0, 0x02020202}, - {0x0000a0a4, 0x00000000}, - {0x0000a0a8, 0x00000000}, - {0x0000a0ac, 0x00000000}, - {0x0000a0b0, 0x00000000}, - {0x0000a0b4, 0x00000000}, - {0x0000a0b8, 0x00000000}, - {0x0000a0bc, 0x00000000}, - {0x0000a0c0, 0x22072208}, - {0x0000a0c4, 0x22052206}, - {0x0000a0c8, 0x22032204}, - {0x0000a0cc, 0x22012202}, - {0x0000a0d0, 0x221f2200}, - {0x0000a0d4, 0x221d221e}, - {0x0000a0d8, 0x33023303}, - {0x0000a0dc, 0x33003301}, - {0x0000a0e0, 0x331e331f}, - {0x0000a0e4, 0x4402331d}, - {0x0000a0e8, 0x44004401}, - {0x0000a0ec, 0x441e441f}, - {0x0000a0f0, 0x55025503}, - {0x0000a0f4, 0x55005501}, - {0x0000a0f8, 0x551e551f}, - {0x0000a0fc, 0x6602551d}, - {0x0000a100, 0x66006601}, - {0x0000a104, 0x661e661f}, - {0x0000a108, 0x7703661d}, - {0x0000a10c, 0x77017702}, - {0x0000a110, 0x00007700}, - {0x0000a114, 0x00000000}, - {0x0000a118, 0x00000000}, - {0x0000a11c, 0x00000000}, - {0x0000a120, 0x00000000}, - {0x0000a124, 0x00000000}, - {0x0000a128, 0x00000000}, - {0x0000a12c, 0x00000000}, - {0x0000a130, 0x00000000}, - {0x0000a134, 0x00000000}, - {0x0000a138, 0x00000000}, - {0x0000a13c, 0x00000000}, - {0x0000a140, 0x001f0000}, - {0x0000a144, 0x111f1100}, - {0x0000a148, 0x111d111e}, - {0x0000a14c, 0x111b111c}, - {0x0000a150, 0x22032204}, - {0x0000a154, 0x22012202}, - {0x0000a158, 0x221f2200}, - {0x0000a15c, 0x221d221e}, - {0x0000a160, 0x33013302}, - {0x0000a164, 0x331f3300}, - {0x0000a168, 0x4402331e}, - {0x0000a16c, 0x44004401}, - {0x0000a170, 0x441e441f}, - {0x0000a174, 0x55015502}, - {0x0000a178, 0x551f5500}, - {0x0000a17c, 0x6602551e}, - {0x0000a180, 0x66006601}, - {0x0000a184, 0x661e661f}, - {0x0000a188, 0x7703661d}, - {0x0000a18c, 0x77017702}, - {0x0000a190, 0x00007700}, - {0x0000a194, 0x00000000}, - {0x0000a198, 0x00000000}, - {0x0000a19c, 0x00000000}, - {0x0000a1a0, 0x00000000}, - {0x0000a1a4, 0x00000000}, - {0x0000a1a8, 0x00000000}, - {0x0000a1ac, 0x00000000}, - {0x0000a1b0, 0x00000000}, - {0x0000a1b4, 0x00000000}, - {0x0000a1b8, 0x00000000}, - {0x0000a1bc, 0x00000000}, - {0x0000a1c0, 0x00000000}, - {0x0000a1c4, 0x00000000}, - {0x0000a1c8, 0x00000000}, - {0x0000a1cc, 0x00000000}, - {0x0000a1d0, 0x00000000}, - {0x0000a1d4, 0x00000000}, - {0x0000a1d8, 0x00000000}, - {0x0000a1dc, 0x00000000}, - {0x0000a1e0, 0x00000000}, - {0x0000a1e4, 0x00000000}, - {0x0000a1e8, 0x00000000}, - {0x0000a1ec, 0x00000000}, - {0x0000a1f0, 0x00000396}, - {0x0000a1f4, 0x00000396}, - {0x0000a1f8, 0x00000396}, - {0x0000a1fc, 0x00000296}, -}; - -static const u32 ar9485_1_1_pcie_phy_pll_on_clkreq_enable_L1[][2] = { - /* Addr allmodes */ - {0x00018c00, 0x18052e5e}, - {0x00018c04, 0x000801d8}, - {0x00018c08, 0x0000080c}, -}; - -static const u32 ar9485_1_1_pcie_phy_clkreq_enable_L1[][2] = { - /* Addr allmodes */ - {0x00018c00, 0x18053e5e}, - {0x00018c04, 0x000801d8}, - {0x00018c08, 0x0000080c}, -}; - -static const u32 ar9485_1_1_soc_preamble[][2] = { - /* Addr allmodes */ - {0x00004014, 0xba280400}, - {0x00004090, 0x00aa10aa}, - {0x000040a4, 0x00a0c9c9}, - {0x00007010, 0x00000022}, - {0x00007020, 0x00000000}, - {0x00007034, 0x00000002}, - {0x00007038, 0x000004c2}, - {0x00007048, 0x00000002}, -}; - -static const u32 ar9485_fast_clock_1_1_baseband_postamble[][3] = { - /* Addr 5G_HT20 5G_HT40 */ - {0x00009e00, 0x03721821, 0x03721821}, - {0x0000a230, 0x0000400b, 0x00004016}, - {0x0000a254, 0x00000898, 0x00001130}, -}; - -static const u32 ar9485_1_1_baseband_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8005}, - {0x00009820, 0x206a002e, 0x206a002e, 0x206a002e, 0x206a002e}, - {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, - {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, - {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, - {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c}, - {0x00009c00, 0x00000044, 0x00000044, 0x00000044, 0x00000044}, - {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, - {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec80d2e, 0x7ec80d2e}, - {0x00009e14, 0x31395d53, 0x31396053, 0x312e6053, 0x312e5d53}, - {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, - {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, - {0x00009e3c, 0xcf946220, 0xcf946220, 0xcf946222, 0xcf946222}, - {0x00009e48, 0x5030201a, 0x5030201a, 0x50302010, 0x50302010}, - {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, - {0x0000a204, 0x01303fc0, 0x01303fc4, 0x01303fc4, 0x01303fc0}, - {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, - {0x0000a230, 0x0000400a, 0x00004014, 0x00004016, 0x0000400b}, - {0x0000a234, 0x10000fff, 0x10000fff, 0x10000fff, 0x10000fff}, - {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018}, - {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002}, - {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, - {0x0000a260, 0x3a021501, 0x3a021501, 0x3a021501, 0x3a021501}, - {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b}, - {0x0000a284, 0x00000000, 0x00000000, 0x000002a0, 0x000002a0}, - {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00058d18, 0x00058d18}, - {0x0000a2d0, 0x00071981, 0x00071981, 0x00071982, 0x00071982}, - {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, - {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000be04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, - {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, -}; - -static const u32 ar9485_1_1_pcie_phy_clkreq_disable_L1[][2] = { - /* Addr allmodes */ - {0x00018c00, 0x18013e5e}, - {0x00018c04, 0x000801d8}, - {0x00018c08, 0x0000080c}, -}; - -static const u32 ar9485_1_1_radio_postamble[][2] = { - /* Addr allmodes */ - {0x0001609c, 0x0b283f31}, - {0x000160ac, 0x24611800}, - {0x000160b0, 0x03284f3e}, - {0x0001610c, 0x00170000}, - {0x00016140, 0x50804008}, -}; - -static const u32 ar9485_1_1_mac_core[][2] = { - /* Addr allmodes */ - {0x00000008, 0x00000000}, - {0x00000030, 0x00020085}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000000}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x000010f0, 0x00000100}, - {0x00001270, 0x00000000}, - {0x000012b0, 0x00000000}, - {0x000012f0, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00008000, 0x00000000}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008018, 0x00000000}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00000000}, - {0x00008040, 0x00000000}, - {0x00008044, 0x00000000}, - {0x00008048, 0x00000000}, - {0x0000804c, 0xffffffff}, - {0x00008054, 0x00000000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x00008070, 0x00000310}, - {0x00008074, 0x00000020}, - {0x00008078, 0x00000000}, - {0x0000809c, 0x0000000f}, - {0x000080a0, 0x00000000}, - {0x000080a4, 0x02ff0000}, - {0x000080a8, 0x0e070605}, - {0x000080ac, 0x0000000d}, - {0x000080b0, 0x00000000}, - {0x000080b4, 0x00000000}, - {0x000080b8, 0x00000000}, - {0x000080bc, 0x00000000}, - {0x000080c0, 0x2a800000}, - {0x000080c4, 0x06900168}, - {0x000080c8, 0x13881c22}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00252500}, - {0x000080d4, 0x00a00000}, - {0x000080d8, 0x00400000}, - {0x000080dc, 0x00000000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x3f3f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00000000}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000000}, - {0x00008114, 0x000007ff}, - {0x00008118, 0x000000aa}, - {0x0000811c, 0x00003210}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x0000ffff}, - {0x00008144, 0xffffffff}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x00008170, 0x18486200}, - {0x00008174, 0x33332210}, - {0x00008178, 0x00000000}, - {0x0000817c, 0x00020000}, - {0x000081c0, 0x00000000}, - {0x000081c4, 0x33332210}, - {0x000081d4, 0x00000000}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008244, 0x0010f400}, - {0x00008248, 0x00000800}, - {0x0000824c, 0x0001e800}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x40000000}, - {0x00008260, 0x00080922}, - {0x00008264, 0x9ca00010}, - {0x00008268, 0xffffffff}, - {0x0000826c, 0x0000ffff}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000004}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x000000ff}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x0000829c, 0x00000000}, - {0x00008300, 0x00000140}, - {0x00008314, 0x00000000}, - {0x0000831c, 0x0000010d}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x00000007}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000700}, - {0x00008338, 0x00ff0000}, - {0x0000833c, 0x02400000}, - {0x00008340, 0x000107ff}, - {0x00008344, 0xa248105b}, - {0x00008348, 0x008f0000}, - {0x0000835c, 0x00000000}, - {0x00008360, 0xffffffff}, - {0x00008364, 0xffffffff}, - {0x00008368, 0x00000000}, - {0x00008370, 0x00000000}, - {0x00008374, 0x000000ff}, - {0x00008378, 0x00000000}, - {0x0000837c, 0x00000000}, - {0x00008380, 0xffffffff}, - {0x00008384, 0xffffffff}, - {0x00008390, 0xffffffff}, - {0x00008394, 0xffffffff}, - {0x00008398, 0x00000000}, - {0x0000839c, 0x00000000}, - {0x000083a0, 0x00000000}, - {0x000083a4, 0x0000fa14}, - {0x000083a8, 0x000f0c00}, - {0x000083ac, 0x33332210}, - {0x000083b0, 0x33332210}, - {0x000083b4, 0x33332210}, - {0x000083b8, 0x33332210}, - {0x000083bc, 0x00000000}, - {0x000083c0, 0x00000000}, - {0x000083c4, 0x00000000}, - {0x000083c8, 0x00000000}, - {0x000083cc, 0x00000200}, - {0x000083d0, 0x000301ff}, -}; - -#define ar9485_1_1_baseband_core_txfir_coeff_japan_2484 ar9462_2p0_baseband_core_txfir_coeff_japan_2484 - -#endif /* INITVALS_9485_H */ diff --git a/drivers/net/wireless/ath/ath9k/ar955x_1p0_initvals.h b/drivers/net/wireless/ath/ath9k/ar955x_1p0_initvals.h deleted file mode 100644 index ccc5b6c99add..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar955x_1p0_initvals.h +++ /dev/null @@ -1,1284 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef INITVALS_955X_1P0_H -#define INITVALS_955X_1P0_H - -/* AR955X 1.0 */ - -static const u32 ar955x_1p0_radio_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00016098, 0xd2dd5554, 0xd2dd5554, 0xd28b3330, 0xd28b3330}, - {0x0001609c, 0x0a566f3a, 0x0a566f3a, 0x0a566f3a, 0x0a566f3a}, - {0x000160ac, 0xa4647c00, 0xa4647c00, 0x24647c00, 0x24647c00}, - {0x000160b0, 0x01885f52, 0x01885f52, 0x01885f52, 0x01885f52}, - {0x00016104, 0xb7a00000, 0xb7a00000, 0xb7a00001, 0xb7a00001}, - {0x0001610c, 0xc0000000, 0xc0000000, 0xc0000000, 0xc0000000}, - {0x00016140, 0x10804008, 0x10804008, 0x10804008, 0x10804008}, - {0x00016504, 0xb7a00000, 0xb7a00000, 0xb7a00001, 0xb7a00001}, - {0x0001650c, 0xc0000000, 0xc0000000, 0xc0000000, 0xc0000000}, - {0x00016540, 0x10804008, 0x10804008, 0x10804008, 0x10804008}, - {0x00016904, 0xb7a00000, 0xb7a00000, 0xb7a00001, 0xb7a00001}, - {0x0001690c, 0xc0000000, 0xc0000000, 0xc0000000, 0xc0000000}, - {0x00016940, 0x10804008, 0x10804008, 0x10804008, 0x10804008}, -}; - -static const u32 ar955x_1p0_baseband_core_txfir_coeff_japan_2484[][2] = { - /* Addr allmodes */ - {0x0000a398, 0x00000000}, - {0x0000a39c, 0x6f7f0301}, - {0x0000a3a0, 0xca9228ee}, -}; - -static const u32 ar955x_1p0_baseband_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8011, 0xd00a8011}, - {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a012e}, - {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, - {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, - {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, - {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c}, - {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4}, - {0x00009e00, 0x0372111a, 0x0372111a, 0x037216a0, 0x037216a0}, - {0x00009e04, 0x001c2020, 0x001c2020, 0x001c2020, 0x001c2020}, - {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, - {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e}, - {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3379605e, 0x33795d5e}, - {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, - {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, - {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, - {0x00009e3c, 0xcfa10820, 0xcfa10820, 0xcfa10822, 0xcfa10822}, - {0x00009e44, 0xfe321e27, 0xfe321e27, 0xfe291e27, 0xfe291e27}, - {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, - {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, - {0x0000a204, 0x005c0ec0, 0x005c0ec4, 0x005c0ec4, 0x005c0ec0}, - {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, - {0x0000a22c, 0x07e26a2f, 0x07e26a2f, 0x01026a2f, 0x01026a2f}, - {0x0000a230, 0x0000400a, 0x00004014, 0x00004016, 0x0000400b}, - {0x0000a234, 0x00000fff, 0x10000fff, 0x10000fff, 0x00000fff}, - {0x0000a238, 0xffb01018, 0xffb01018, 0xffb01018, 0xffb01018}, - {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002}, - {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01010e0e, 0x01010e0e}, - {0x0000a260, 0x0a021501, 0x0a021501, 0x3a021501, 0x3a021501}, - {0x0000a264, 0x00000e0e, 0x00000e0e, 0x01000e0e, 0x01000e0e}, - {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b}, - {0x0000a284, 0x00000000, 0x00000000, 0x00000010, 0x00000010}, - {0x0000a288, 0x00000110, 0x00000110, 0x00000110, 0x00000110}, - {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222}, - {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, - {0x0000a2cc, 0x18c50033, 0x18c43433, 0x18c41033, 0x18c44c33}, - {0x0000a2d0, 0x00041982, 0x00041982, 0x00041982, 0x00041982}, - {0x0000a2d8, 0x7999a83b, 0x7999a83b, 0x7999a83b, 0x7999a83b}, - {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000}, - {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, - {0x0000b284, 0x00000000, 0x00000000, 0x00000010, 0x00000010}, - {0x0000b830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000be04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000}, - {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000be1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000be20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, - {0x0000c284, 0x00000000, 0x00000000, 0x00000010, 0x00000010}, -}; - -static const u32 ar955x_1p0_radio_core[][2] = { - /* Addr allmodes */ - {0x00016000, 0x36db6db6}, - {0x00016004, 0x6db6db40}, - {0x00016008, 0x73f00000}, - {0x0001600c, 0x00000000}, - {0x00016040, 0x7f80fff8}, - {0x0001604c, 0x76d005b5}, - {0x00016050, 0x557cf031}, - {0x00016054, 0x13449440}, - {0x00016058, 0x0c51c92c}, - {0x0001605c, 0x3db7fffc}, - {0x00016060, 0xfffffffc}, - {0x00016064, 0x000f0278}, - {0x00016068, 0x6db6db6c}, - {0x0001606c, 0x6db60000}, - {0x00016080, 0x00080000}, - {0x00016084, 0x0e48048c}, - {0x00016088, 0x14214514}, - {0x0001608c, 0x119f101e}, - {0x00016090, 0x24926490}, - {0x00016094, 0x00000000}, - {0x000160a0, 0x0a108ffe}, - {0x000160a4, 0x812fc370}, - {0x000160a8, 0x423c8100}, - {0x000160b4, 0x92480080}, - {0x000160c0, 0x006db6d0}, - {0x000160c4, 0x6db6db60}, - {0x000160c8, 0x6db6db6c}, - {0x000160cc, 0x01e6c000}, - {0x00016100, 0x11999601}, - {0x00016108, 0x00080010}, - {0x00016144, 0x02084080}, - {0x00016148, 0x00008040}, - {0x00016280, 0x01800804}, - {0x00016284, 0x00038dc5}, - {0x00016288, 0x00000000}, - {0x0001628c, 0x00000040}, - {0x00016380, 0x00000000}, - {0x00016384, 0x00000000}, - {0x00016388, 0x00400705}, - {0x0001638c, 0x00800700}, - {0x00016390, 0x00800700}, - {0x00016394, 0x00000000}, - {0x00016398, 0x00000000}, - {0x0001639c, 0x00000000}, - {0x000163a0, 0x00000001}, - {0x000163a4, 0x00000001}, - {0x000163a8, 0x00000000}, - {0x000163ac, 0x00000000}, - {0x000163b0, 0x00000000}, - {0x000163b4, 0x00000000}, - {0x000163b8, 0x00000000}, - {0x000163bc, 0x00000000}, - {0x000163c0, 0x000000a0}, - {0x000163c4, 0x000c0000}, - {0x000163c8, 0x14021402}, - {0x000163cc, 0x00001402}, - {0x000163d0, 0x00000000}, - {0x000163d4, 0x00000000}, - {0x00016400, 0x36db6db6}, - {0x00016404, 0x6db6db40}, - {0x00016408, 0x73f00000}, - {0x0001640c, 0x00000000}, - {0x00016440, 0x7f80fff8}, - {0x0001644c, 0x76d005b5}, - {0x00016450, 0x557cf031}, - {0x00016454, 0x13449440}, - {0x00016458, 0x0c51c92c}, - {0x0001645c, 0x3db7fffc}, - {0x00016460, 0xfffffffc}, - {0x00016464, 0x000f0278}, - {0x00016468, 0x6db6db6c}, - {0x0001646c, 0x6db60000}, - {0x00016500, 0x11999601}, - {0x00016508, 0x00080010}, - {0x00016544, 0x02084080}, - {0x00016548, 0x00008040}, - {0x00016780, 0x00000000}, - {0x00016784, 0x00000000}, - {0x00016788, 0x00400705}, - {0x0001678c, 0x00800700}, - {0x00016790, 0x00800700}, - {0x00016794, 0x00000000}, - {0x00016798, 0x00000000}, - {0x0001679c, 0x00000000}, - {0x000167a0, 0x00000001}, - {0x000167a4, 0x00000001}, - {0x000167a8, 0x00000000}, - {0x000167ac, 0x00000000}, - {0x000167b0, 0x00000000}, - {0x000167b4, 0x00000000}, - {0x000167b8, 0x00000000}, - {0x000167bc, 0x00000000}, - {0x000167c0, 0x000000a0}, - {0x000167c4, 0x000c0000}, - {0x000167c8, 0x14021402}, - {0x000167cc, 0x00001402}, - {0x000167d0, 0x00000000}, - {0x000167d4, 0x00000000}, - {0x00016800, 0x36db6db6}, - {0x00016804, 0x6db6db40}, - {0x00016808, 0x73f00000}, - {0x0001680c, 0x00000000}, - {0x00016840, 0x7f80fff8}, - {0x0001684c, 0x76d005b5}, - {0x00016850, 0x557cf031}, - {0x00016854, 0x13449440}, - {0x00016858, 0x0c51c92c}, - {0x0001685c, 0x3db7fffc}, - {0x00016860, 0xfffffffc}, - {0x00016864, 0x000f0278}, - {0x00016868, 0x6db6db6c}, - {0x0001686c, 0x6db60000}, - {0x00016900, 0x11999601}, - {0x00016908, 0x00080010}, - {0x00016944, 0x02084080}, - {0x00016948, 0x00008040}, - {0x00016b80, 0x00000000}, - {0x00016b84, 0x00000000}, - {0x00016b88, 0x00400705}, - {0x00016b8c, 0x00800700}, - {0x00016b90, 0x00800700}, - {0x00016b94, 0x00000000}, - {0x00016b98, 0x00000000}, - {0x00016b9c, 0x00000000}, - {0x00016ba0, 0x00000001}, - {0x00016ba4, 0x00000001}, - {0x00016ba8, 0x00000000}, - {0x00016bac, 0x00000000}, - {0x00016bb0, 0x00000000}, - {0x00016bb4, 0x00000000}, - {0x00016bb8, 0x00000000}, - {0x00016bbc, 0x00000000}, - {0x00016bc0, 0x000000a0}, - {0x00016bc4, 0x000c0000}, - {0x00016bc8, 0x14021402}, - {0x00016bcc, 0x00001402}, - {0x00016bd0, 0x00000000}, - {0x00016bd4, 0x00000000}, -}; - -static const u32 ar955x_1p0_modes_xpa_tx_gain_table[][9] = { - /* Addr 5G_HT20_L 5G_HT40_L 5G_HT20_M 5G_HT40_M 5G_HT20_H 5G_HT40_H 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0xffff6aaa, 0xffff6aaa, 0xffff6aaa, 0xffff6aaa, 0xffff6aaa, 0xffff6aaa, 0xfffd5aaa, 0xfffd5aaa}, - {0x0000a2e0, 0xfffdcccc, 0xfffdcccc, 0xfffdcccc, 0xfffdcccc, 0xfffdcccc, 0xfffdcccc, 0xfffe9ccc, 0xfffe9ccc}, - {0x0000a2e4, 0xffe3b0f0, 0xffe3b0f0, 0xffe3b0f0, 0xffe3b0f0, 0xffe3b0f0, 0xffe3b0f0, 0xffffe0f0, 0xffffe0f0}, - {0x0000a2e8, 0xffffff00, 0xffffff00, 0xffffff00, 0xffffff00, 0xffffff00, 0xffffff00, 0xfffcff00, 0xfffcff00}, - {0x0000a410, 0x000050de, 0x000050de, 0x000050de, 0x000050de, 0x000050de, 0x000050de, 0x000050da, 0x000050da}, - {0x0000a500, 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000000, 0x00000000}, - {0x0000a504, 0x04000005, 0x04000005, 0x04000005, 0x04000005, 0x04000005, 0x04000005, 0x04000002, 0x04000002}, - {0x0000a508, 0x08000009, 0x08000009, 0x08000009, 0x08000009, 0x08000009, 0x08000009, 0x08000004, 0x08000004}, - {0x0000a50c, 0x0c00000b, 0x0c00000b, 0x0c00000b, 0x0c00000b, 0x0c00000b, 0x0c00000b, 0x0c000006, 0x0c000006}, - {0x0000a510, 0x1000000d, 0x1000000d, 0x1000000d, 0x1000000d, 0x1000000d, 0x1000000d, 0x0f00000a, 0x0f00000a}, - {0x0000a514, 0x14000011, 0x14000011, 0x14000011, 0x14000011, 0x14000011, 0x14000011, 0x1300000c, 0x1300000c}, - {0x0000a518, 0x1700002b, 0x1700002b, 0x1700002b, 0x1700002b, 0x1600002b, 0x1600002b, 0x1700000e, 0x1700000e}, - {0x0000a51c, 0x1b00002d, 0x1b00002d, 0x1b00002d, 0x1b00002d, 0x1a00002d, 0x1a00002d, 0x1b000064, 0x1b000064}, - {0x0000a520, 0x20000031, 0x20000031, 0x1f000031, 0x1f000031, 0x1e000031, 0x1e000031, 0x1f000242, 0x1f000242}, - {0x0000a524, 0x24000051, 0x24000051, 0x23000051, 0x23000051, 0x23000051, 0x23000051, 0x23000229, 0x23000229}, - {0x0000a528, 0x27000071, 0x27000071, 0x27000071, 0x27000071, 0x26000071, 0x26000071, 0x270002a2, 0x270002a2}, - {0x0000a52c, 0x2b000092, 0x2b000092, 0x2b000092, 0x2b000092, 0x2b000092, 0x2b000092, 0x2c001203, 0x2c001203}, - {0x0000a530, 0x3000028c, 0x3000028c, 0x2f00028c, 0x2f00028c, 0x2e00028c, 0x2e00028c, 0x30001803, 0x30001803}, - {0x0000a534, 0x34000290, 0x34000290, 0x33000290, 0x33000290, 0x32000290, 0x32000290, 0x33000881, 0x33000881}, - {0x0000a538, 0x37000292, 0x37000292, 0x36000292, 0x36000292, 0x35000292, 0x35000292, 0x38001809, 0x38001809}, - {0x0000a53c, 0x3b02028d, 0x3b02028d, 0x3a02028d, 0x3a02028d, 0x3902028d, 0x3902028d, 0x3a000814, 0x3a000814}, - {0x0000a540, 0x3f020291, 0x3f020291, 0x3e020291, 0x3e020291, 0x3d020291, 0x3d020291, 0x3f001a0c, 0x3f001a0c}, - {0x0000a544, 0x44020490, 0x44020490, 0x43020490, 0x43020490, 0x42020490, 0x42020490, 0x43001a0e, 0x43001a0e}, - {0x0000a548, 0x48020492, 0x48020492, 0x47020492, 0x47020492, 0x46020492, 0x46020492, 0x46001812, 0x46001812}, - {0x0000a54c, 0x4c020692, 0x4c020692, 0x4b020692, 0x4b020692, 0x4a020692, 0x4a020692, 0x49001884, 0x49001884}, - {0x0000a550, 0x50020892, 0x50020892, 0x4f020892, 0x4f020892, 0x4e020892, 0x4e020892, 0x4d001e84, 0x4d001e84}, - {0x0000a554, 0x53040891, 0x53040891, 0x53040891, 0x53040891, 0x52040891, 0x52040891, 0x50001e69, 0x50001e69}, - {0x0000a558, 0x58040893, 0x58040893, 0x57040893, 0x57040893, 0x56040893, 0x56040893, 0x550006f4, 0x550006f4}, - {0x0000a55c, 0x5c0408b4, 0x5c0408b4, 0x5a0408b4, 0x5a0408b4, 0x5a0408b4, 0x5a0408b4, 0x59000ad3, 0x59000ad3}, - {0x0000a560, 0x610408b6, 0x610408b6, 0x5e0408b6, 0x5e0408b6, 0x5e0408b6, 0x5e0408b6, 0x5e000ad5, 0x5e000ad5}, - {0x0000a564, 0x670408f6, 0x670408f6, 0x620408f6, 0x620408f6, 0x620408f6, 0x620408f6, 0x61001ced, 0x61001ced}, - {0x0000a568, 0x6a040cf6, 0x6a040cf6, 0x66040cf6, 0x66040cf6, 0x66040cf6, 0x66040cf6, 0x660018d4, 0x660018d4}, - {0x0000a56c, 0x6d040d76, 0x6d040d76, 0x6a040d76, 0x6a040d76, 0x6a040d76, 0x6a040d76, 0x660018d4, 0x660018d4}, - {0x0000a570, 0x70060db6, 0x70060db6, 0x6e060db6, 0x6e060db6, 0x6e060db6, 0x6e060db6, 0x660018d4, 0x660018d4}, - {0x0000a574, 0x730a0df6, 0x730a0df6, 0x720a0df6, 0x720a0df6, 0x720a0df6, 0x720a0df6, 0x660018d4, 0x660018d4}, - {0x0000a578, 0x770a13f6, 0x770a13f6, 0x760a13f6, 0x760a13f6, 0x760a13f6, 0x760a13f6, 0x660018d4, 0x660018d4}, - {0x0000a57c, 0x770a13f6, 0x770a13f6, 0x760a13f6, 0x760a13f6, 0x760a13f6, 0x760a13f6, 0x660018d4, 0x660018d4}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x02c04b01, 0x02c04b01, 0x02c04b01, 0x02c04b01, 0x02c04b01, 0x02c04b01, 0x03804000, 0x03804000}, - {0x0000a610, 0x04008b01, 0x04008b01, 0x04008b01, 0x04008b01, 0x03c08b01, 0x03c08b01, 0x0300ca02, 0x0300ca02}, - {0x0000a614, 0x05811403, 0x05811403, 0x05411303, 0x05411303, 0x05411303, 0x05411303, 0x00000e04, 0x00000e04}, - {0x0000a618, 0x05811604, 0x05811604, 0x05411504, 0x05411504, 0x05411504, 0x05411504, 0x03014000, 0x03014000}, - {0x0000a61c, 0x05811604, 0x05811604, 0x05411504, 0x05411504, 0x05411504, 0x05411504, 0x00000000, 0x00000000}, - {0x0000a620, 0x05811604, 0x05811604, 0x05411504, 0x05411504, 0x05411504, 0x05411504, 0x00000000, 0x00000000}, - {0x0000a624, 0x05811604, 0x05811604, 0x05411504, 0x05411504, 0x05411504, 0x05411504, 0x03014000, 0x03014000}, - {0x0000a628, 0x05811604, 0x05811604, 0x05411504, 0x05411504, 0x05411504, 0x05411504, 0x03804c05, 0x03804c05}, - {0x0000a62c, 0x06815604, 0x06815604, 0x06415504, 0x06415504, 0x06015504, 0x06015504, 0x0701de06, 0x0701de06}, - {0x0000a630, 0x07819a05, 0x07819a05, 0x07419905, 0x07419905, 0x07019805, 0x07019805, 0x07819c07, 0x07819c07}, - {0x0000a634, 0x07819e06, 0x07819e06, 0x07419d06, 0x07419d06, 0x07019c06, 0x07019c06, 0x0701dc07, 0x0701dc07}, - {0x0000a638, 0x07819e06, 0x07819e06, 0x07419d06, 0x07419d06, 0x07019c06, 0x07019c06, 0x0701dc07, 0x0701dc07}, - {0x0000a63c, 0x07819e06, 0x07819e06, 0x07419d06, 0x07419d06, 0x07019c06, 0x07019c06, 0x0701dc07, 0x0701dc07}, - {0x0000b2dc, 0xffff6aaa, 0xffff6aaa, 0xffff6aaa, 0xffff6aaa, 0xffff6aaa, 0xffff6aaa, 0xfffd5aaa, 0xfffd5aaa}, - {0x0000b2e0, 0xfffdcccc, 0xfffdcccc, 0xfffdcccc, 0xfffdcccc, 0xfffdcccc, 0xfffdcccc, 0xfffe9ccc, 0xfffe9ccc}, - {0x0000b2e4, 0xffe3b0f0, 0xffe3b0f0, 0xffe3b0f0, 0xffe3b0f0, 0xffe3b0f0, 0xffe3b0f0, 0xffffe0f0, 0xffffe0f0}, - {0x0000b2e8, 0xffffff00, 0xffffff00, 0xffffff00, 0xffffff00, 0xffffff00, 0xffffff00, 0xfffcff00, 0xfffcff00}, - {0x0000c2dc, 0xffff6aaa, 0xffff6aaa, 0xffff6aaa, 0xffff6aaa, 0xffff6aaa, 0xffff6aaa, 0xfffd5aaa, 0xfffd5aaa}, - {0x0000c2e0, 0xfffdcccc, 0xfffdcccc, 0xfffdcccc, 0xfffdcccc, 0xfffdcccc, 0xfffdcccc, 0xfffe9ccc, 0xfffe9ccc}, - {0x0000c2e4, 0xffe3b0f0, 0xffe3b0f0, 0xffe3b0f0, 0xffe3b0f0, 0xffe3b0f0, 0xffe3b0f0, 0xffffe0f0, 0xffffe0f0}, - {0x0000c2e8, 0xffffff00, 0xffffff00, 0xffffff00, 0xffffff00, 0xffffff00, 0xffffff00, 0xfffcff00, 0xfffcff00}, - {0x00016044, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x010002d4, 0x010002d4}, - {0x00016048, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401}, - {0x00016280, 0x01801e84, 0x01801e84, 0x01801e84, 0x01801e84, 0x01801e84, 0x01801e84, 0x01808e84, 0x01808e84}, - {0x00016444, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x010002d4, 0x010002d4}, - {0x00016448, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401}, - {0x00016844, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x010002d4, 0x010002d4}, - {0x00016848, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401}, -}; - -static const u32 ar955x_1p0_mac_core[][2] = { - /* Addr allmodes */ - {0x00000008, 0x00000000}, - {0x00000030, 0x00020085}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000000}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x000010f0, 0x00000100}, - {0x00001270, 0x00000000}, - {0x000012b0, 0x00000000}, - {0x000012f0, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00008000, 0x00000000}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008018, 0x00000000}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00000000}, - {0x00008040, 0x00000000}, - {0x00008044, 0x00000000}, - {0x00008048, 0x00000000}, - {0x0000804c, 0xffffffff}, - {0x00008054, 0x00000000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x00008070, 0x00000310}, - {0x00008074, 0x00000020}, - {0x00008078, 0x00000000}, - {0x0000809c, 0x0000000f}, - {0x000080a0, 0x00000000}, - {0x000080a4, 0x02ff0000}, - {0x000080a8, 0x0e070605}, - {0x000080ac, 0x0000000d}, - {0x000080b0, 0x00000000}, - {0x000080b4, 0x00000000}, - {0x000080b8, 0x00000000}, - {0x000080bc, 0x00000000}, - {0x000080c0, 0x2a800000}, - {0x000080c4, 0x06900168}, - {0x000080c8, 0x13881c22}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00252500}, - {0x000080d4, 0x00a00000}, - {0x000080d8, 0x00400000}, - {0x000080dc, 0x00000000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x3f3f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00000000}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000000}, - {0x00008114, 0x000007ff}, - {0x00008118, 0x000000aa}, - {0x0000811c, 0x00003210}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x0000ffff}, - {0x00008140, 0x000000fe}, - {0x00008144, 0xffffffff}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x000081c0, 0x00000000}, - {0x000081c4, 0x33332210}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008244, 0x0010f400}, - {0x00008248, 0x00000800}, - {0x0000824c, 0x0001e800}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x40000000}, - {0x00008260, 0x00080922}, - {0x00008264, 0x9d400010}, - {0x00008268, 0xffffffff}, - {0x0000826c, 0x0000ffff}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000004}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x000000ff}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x0000829c, 0x00000000}, - {0x00008300, 0x00001d40}, - {0x00008314, 0x00000000}, - {0x0000831c, 0x0000010d}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x0000001f}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000700}, - {0x00008338, 0xffff0000}, - {0x0000833c, 0x02400000}, - {0x00008340, 0x000107ff}, - {0x00008344, 0xaa48107b}, - {0x00008348, 0x008f0000}, - {0x0000835c, 0x00000000}, - {0x00008360, 0xffffffff}, - {0x00008364, 0xffffffff}, - {0x00008368, 0x00000000}, - {0x00008370, 0x00000000}, - {0x00008374, 0x000000ff}, - {0x00008378, 0x00000000}, - {0x0000837c, 0x00000000}, - {0x00008380, 0xffffffff}, - {0x00008384, 0xffffffff}, - {0x00008390, 0xffffffff}, - {0x00008394, 0xffffffff}, - {0x00008398, 0x00000000}, - {0x0000839c, 0x00000000}, - {0x000083a0, 0x00000000}, - {0x000083a4, 0x0000fa14}, - {0x000083a8, 0x000f0c00}, - {0x000083ac, 0x33332210}, - {0x000083b0, 0x33332210}, - {0x000083b4, 0x33332210}, - {0x000083b8, 0x33332210}, - {0x000083bc, 0x00000000}, - {0x000083c0, 0x00000000}, - {0x000083c4, 0x00000000}, - {0x000083c8, 0x00000000}, - {0x000083cc, 0x00000200}, - {0x000083d0, 0x8c7901ff}, -}; - -static const u32 ar955x_1p0_common_rx_gain_table[][2] = { - /* Addr allmodes */ - {0x0000a000, 0x00010000}, - {0x0000a004, 0x00030002}, - {0x0000a008, 0x00050004}, - {0x0000a00c, 0x00810080}, - {0x0000a010, 0x00830082}, - {0x0000a014, 0x01810180}, - {0x0000a018, 0x01830182}, - {0x0000a01c, 0x01850184}, - {0x0000a020, 0x01890188}, - {0x0000a024, 0x018b018a}, - {0x0000a028, 0x018d018c}, - {0x0000a02c, 0x01910190}, - {0x0000a030, 0x01930192}, - {0x0000a034, 0x01950194}, - {0x0000a038, 0x038a0196}, - {0x0000a03c, 0x038c038b}, - {0x0000a040, 0x0390038d}, - {0x0000a044, 0x03920391}, - {0x0000a048, 0x03940393}, - {0x0000a04c, 0x03960395}, - {0x0000a050, 0x00000000}, - {0x0000a054, 0x00000000}, - {0x0000a058, 0x00000000}, - {0x0000a05c, 0x00000000}, - {0x0000a060, 0x00000000}, - {0x0000a064, 0x00000000}, - {0x0000a068, 0x00000000}, - {0x0000a06c, 0x00000000}, - {0x0000a070, 0x00000000}, - {0x0000a074, 0x00000000}, - {0x0000a078, 0x00000000}, - {0x0000a07c, 0x00000000}, - {0x0000a080, 0x22222229}, - {0x0000a084, 0x1d1d1d1d}, - {0x0000a088, 0x1d1d1d1d}, - {0x0000a08c, 0x1d1d1d1d}, - {0x0000a090, 0x171d1d1d}, - {0x0000a094, 0x11111717}, - {0x0000a098, 0x00030311}, - {0x0000a09c, 0x00000000}, - {0x0000a0a0, 0x00000000}, - {0x0000a0a4, 0x00000000}, - {0x0000a0a8, 0x00000000}, - {0x0000a0ac, 0x00000000}, - {0x0000a0b0, 0x00000000}, - {0x0000a0b4, 0x00000000}, - {0x0000a0b8, 0x00000000}, - {0x0000a0bc, 0x00000000}, - {0x0000a0c0, 0x001f0000}, - {0x0000a0c4, 0x01000101}, - {0x0000a0c8, 0x011e011f}, - {0x0000a0cc, 0x011c011d}, - {0x0000a0d0, 0x02030204}, - {0x0000a0d4, 0x02010202}, - {0x0000a0d8, 0x021f0200}, - {0x0000a0dc, 0x0302021e}, - {0x0000a0e0, 0x03000301}, - {0x0000a0e4, 0x031e031f}, - {0x0000a0e8, 0x0402031d}, - {0x0000a0ec, 0x04000401}, - {0x0000a0f0, 0x041e041f}, - {0x0000a0f4, 0x0502041d}, - {0x0000a0f8, 0x05000501}, - {0x0000a0fc, 0x051e051f}, - {0x0000a100, 0x06010602}, - {0x0000a104, 0x061f0600}, - {0x0000a108, 0x061d061e}, - {0x0000a10c, 0x07020703}, - {0x0000a110, 0x07000701}, - {0x0000a114, 0x00000000}, - {0x0000a118, 0x00000000}, - {0x0000a11c, 0x00000000}, - {0x0000a120, 0x00000000}, - {0x0000a124, 0x00000000}, - {0x0000a128, 0x00000000}, - {0x0000a12c, 0x00000000}, - {0x0000a130, 0x00000000}, - {0x0000a134, 0x00000000}, - {0x0000a138, 0x00000000}, - {0x0000a13c, 0x00000000}, - {0x0000a140, 0x001f0000}, - {0x0000a144, 0x01000101}, - {0x0000a148, 0x011e011f}, - {0x0000a14c, 0x011c011d}, - {0x0000a150, 0x02030204}, - {0x0000a154, 0x02010202}, - {0x0000a158, 0x021f0200}, - {0x0000a15c, 0x0302021e}, - {0x0000a160, 0x03000301}, - {0x0000a164, 0x031e031f}, - {0x0000a168, 0x0402031d}, - {0x0000a16c, 0x04000401}, - {0x0000a170, 0x041e041f}, - {0x0000a174, 0x0502041d}, - {0x0000a178, 0x05000501}, - {0x0000a17c, 0x051e051f}, - {0x0000a180, 0x06010602}, - {0x0000a184, 0x061f0600}, - {0x0000a188, 0x061d061e}, - {0x0000a18c, 0x07020703}, - {0x0000a190, 0x07000701}, - {0x0000a194, 0x00000000}, - {0x0000a198, 0x00000000}, - {0x0000a19c, 0x00000000}, - {0x0000a1a0, 0x00000000}, - {0x0000a1a4, 0x00000000}, - {0x0000a1a8, 0x00000000}, - {0x0000a1ac, 0x00000000}, - {0x0000a1b0, 0x00000000}, - {0x0000a1b4, 0x00000000}, - {0x0000a1b8, 0x00000000}, - {0x0000a1bc, 0x00000000}, - {0x0000a1c0, 0x00000000}, - {0x0000a1c4, 0x00000000}, - {0x0000a1c8, 0x00000000}, - {0x0000a1cc, 0x00000000}, - {0x0000a1d0, 0x00000000}, - {0x0000a1d4, 0x00000000}, - {0x0000a1d8, 0x00000000}, - {0x0000a1dc, 0x00000000}, - {0x0000a1e0, 0x00000000}, - {0x0000a1e4, 0x00000000}, - {0x0000a1e8, 0x00000000}, - {0x0000a1ec, 0x00000000}, - {0x0000a1f0, 0x00000396}, - {0x0000a1f4, 0x00000396}, - {0x0000a1f8, 0x00000396}, - {0x0000a1fc, 0x00000196}, - {0x0000b000, 0x00010000}, - {0x0000b004, 0x00030002}, - {0x0000b008, 0x00050004}, - {0x0000b00c, 0x00810080}, - {0x0000b010, 0x00830082}, - {0x0000b014, 0x01810180}, - {0x0000b018, 0x01830182}, - {0x0000b01c, 0x01850184}, - {0x0000b020, 0x02810280}, - {0x0000b024, 0x02830282}, - {0x0000b028, 0x02850284}, - {0x0000b02c, 0x02890288}, - {0x0000b030, 0x028b028a}, - {0x0000b034, 0x0388028c}, - {0x0000b038, 0x038a0389}, - {0x0000b03c, 0x038c038b}, - {0x0000b040, 0x0390038d}, - {0x0000b044, 0x03920391}, - {0x0000b048, 0x03940393}, - {0x0000b04c, 0x03960395}, - {0x0000b050, 0x00000000}, - {0x0000b054, 0x00000000}, - {0x0000b058, 0x00000000}, - {0x0000b05c, 0x00000000}, - {0x0000b060, 0x00000000}, - {0x0000b064, 0x00000000}, - {0x0000b068, 0x00000000}, - {0x0000b06c, 0x00000000}, - {0x0000b070, 0x00000000}, - {0x0000b074, 0x00000000}, - {0x0000b078, 0x00000000}, - {0x0000b07c, 0x00000000}, - {0x0000b080, 0x23232323}, - {0x0000b084, 0x21232323}, - {0x0000b088, 0x19191c1e}, - {0x0000b08c, 0x12141417}, - {0x0000b090, 0x07070e0e}, - {0x0000b094, 0x03030305}, - {0x0000b098, 0x00000003}, - {0x0000b09c, 0x00000000}, - {0x0000b0a0, 0x00000000}, - {0x0000b0a4, 0x00000000}, - {0x0000b0a8, 0x00000000}, - {0x0000b0ac, 0x00000000}, - {0x0000b0b0, 0x00000000}, - {0x0000b0b4, 0x00000000}, - {0x0000b0b8, 0x00000000}, - {0x0000b0bc, 0x00000000}, - {0x0000b0c0, 0x003f0020}, - {0x0000b0c4, 0x00400041}, - {0x0000b0c8, 0x0140005f}, - {0x0000b0cc, 0x0160015f}, - {0x0000b0d0, 0x017e017f}, - {0x0000b0d4, 0x02410242}, - {0x0000b0d8, 0x025f0240}, - {0x0000b0dc, 0x027f0260}, - {0x0000b0e0, 0x0341027e}, - {0x0000b0e4, 0x035f0340}, - {0x0000b0e8, 0x037f0360}, - {0x0000b0ec, 0x04400441}, - {0x0000b0f0, 0x0460045f}, - {0x0000b0f4, 0x0541047f}, - {0x0000b0f8, 0x055f0540}, - {0x0000b0fc, 0x057f0560}, - {0x0000b100, 0x06400641}, - {0x0000b104, 0x0660065f}, - {0x0000b108, 0x067e067f}, - {0x0000b10c, 0x07410742}, - {0x0000b110, 0x075f0740}, - {0x0000b114, 0x077f0760}, - {0x0000b118, 0x07800781}, - {0x0000b11c, 0x07a0079f}, - {0x0000b120, 0x07c107bf}, - {0x0000b124, 0x000007c0}, - {0x0000b128, 0x00000000}, - {0x0000b12c, 0x00000000}, - {0x0000b130, 0x00000000}, - {0x0000b134, 0x00000000}, - {0x0000b138, 0x00000000}, - {0x0000b13c, 0x00000000}, - {0x0000b140, 0x003f0020}, - {0x0000b144, 0x00400041}, - {0x0000b148, 0x0140005f}, - {0x0000b14c, 0x0160015f}, - {0x0000b150, 0x017e017f}, - {0x0000b154, 0x02410242}, - {0x0000b158, 0x025f0240}, - {0x0000b15c, 0x027f0260}, - {0x0000b160, 0x0341027e}, - {0x0000b164, 0x035f0340}, - {0x0000b168, 0x037f0360}, - {0x0000b16c, 0x04400441}, - {0x0000b170, 0x0460045f}, - {0x0000b174, 0x0541047f}, - {0x0000b178, 0x055f0540}, - {0x0000b17c, 0x057f0560}, - {0x0000b180, 0x06400641}, - {0x0000b184, 0x0660065f}, - {0x0000b188, 0x067e067f}, - {0x0000b18c, 0x07410742}, - {0x0000b190, 0x075f0740}, - {0x0000b194, 0x077f0760}, - {0x0000b198, 0x07800781}, - {0x0000b19c, 0x07a0079f}, - {0x0000b1a0, 0x07c107bf}, - {0x0000b1a4, 0x000007c0}, - {0x0000b1a8, 0x00000000}, - {0x0000b1ac, 0x00000000}, - {0x0000b1b0, 0x00000000}, - {0x0000b1b4, 0x00000000}, - {0x0000b1b8, 0x00000000}, - {0x0000b1bc, 0x00000000}, - {0x0000b1c0, 0x00000000}, - {0x0000b1c4, 0x00000000}, - {0x0000b1c8, 0x00000000}, - {0x0000b1cc, 0x00000000}, - {0x0000b1d0, 0x00000000}, - {0x0000b1d4, 0x00000000}, - {0x0000b1d8, 0x00000000}, - {0x0000b1dc, 0x00000000}, - {0x0000b1e0, 0x00000000}, - {0x0000b1e4, 0x00000000}, - {0x0000b1e8, 0x00000000}, - {0x0000b1ec, 0x00000000}, - {0x0000b1f0, 0x00000396}, - {0x0000b1f4, 0x00000396}, - {0x0000b1f8, 0x00000396}, - {0x0000b1fc, 0x00000196}, -}; - -static const u32 ar955x_1p0_baseband_core[][2] = { - /* Addr allmodes */ - {0x00009800, 0xafe68e30}, - {0x00009804, 0xfd14e000}, - {0x00009808, 0x9c0a9f6b}, - {0x0000980c, 0x04900000}, - {0x00009814, 0x0280c00a}, - {0x00009818, 0x00000000}, - {0x0000981c, 0x00020028}, - {0x00009834, 0x6400a190}, - {0x00009838, 0x0108ecff}, - {0x0000983c, 0x14000600}, - {0x00009880, 0x201fff00}, - {0x00009884, 0x00001042}, - {0x000098a4, 0x00200400}, - {0x000098b0, 0x32840bbe}, - {0x000098bc, 0x00000002}, - {0x000098d0, 0x004b6a8e}, - {0x000098d4, 0x00000820}, - {0x000098dc, 0x00000000}, - {0x000098f0, 0x00000000}, - {0x000098f4, 0x00000000}, - {0x00009c04, 0xff55ff55}, - {0x00009c08, 0x0320ff55}, - {0x00009c0c, 0x00000000}, - {0x00009c10, 0x00000000}, - {0x00009c14, 0x00046384}, - {0x00009c18, 0x05b6b440}, - {0x00009c1c, 0x00b6b440}, - {0x00009d00, 0xc080a333}, - {0x00009d04, 0x40206c10}, - {0x00009d08, 0x009c4060}, - {0x00009d0c, 0x9883800a}, - {0x00009d10, 0x01834061}, - {0x00009d14, 0x00c0040b}, - {0x00009d18, 0x00000000}, - {0x00009e08, 0x0038230c}, - {0x00009e24, 0x990bb515}, - {0x00009e28, 0x0c6f0000}, - {0x00009e30, 0x06336f77}, - {0x00009e34, 0x6af6532f}, - {0x00009e38, 0x0cc80c00}, - {0x00009e40, 0x0d261820}, - {0x00009e4c, 0x00001004}, - {0x00009e50, 0x00ff03f1}, - {0x00009fc0, 0x813e4788}, - {0x00009fc4, 0x0001efb5}, - {0x00009fcc, 0x40000014}, - {0x00009fd0, 0x01193b93}, - {0x0000a20c, 0x00000000}, - {0x0000a220, 0x00000000}, - {0x0000a224, 0x00000000}, - {0x0000a228, 0x10002310}, - {0x0000a23c, 0x00000000}, - {0x0000a244, 0x0c000000}, - {0x0000a248, 0x00000140}, - {0x0000a2a0, 0x00000007}, - {0x0000a2c0, 0x00000007}, - {0x0000a2c8, 0x00000000}, - {0x0000a2d4, 0x00000000}, - {0x0000a2ec, 0x00000000}, - {0x0000a2f0, 0x00000000}, - {0x0000a2f4, 0x00000000}, - {0x0000a2f8, 0x00000000}, - {0x0000a344, 0x00000000}, - {0x0000a34c, 0x00000000}, - {0x0000a350, 0x0000a000}, - {0x0000a364, 0x00000000}, - {0x0000a370, 0x00000000}, - {0x0000a390, 0x00000001}, - {0x0000a394, 0x00000444}, - {0x0000a398, 0x1f020503}, - {0x0000a39c, 0x29180c03}, - {0x0000a3a0, 0x9a8b6844}, - {0x0000a3a4, 0x00000000}, - {0x0000a3a8, 0xaaaaaaaa}, - {0x0000a3ac, 0x3c466478}, - {0x0000a3c0, 0x20202020}, - {0x0000a3c4, 0x22222220}, - {0x0000a3c8, 0x20200020}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3d8, 0x20202020}, - {0x0000a3dc, 0x20202020}, - {0x0000a3e0, 0x20202020}, - {0x0000a3e4, 0x20202020}, - {0x0000a3e8, 0x20202020}, - {0x0000a3ec, 0x20202020}, - {0x0000a3f0, 0x00000000}, - {0x0000a3f4, 0x00000000}, - {0x0000a3f8, 0x0c9bd380}, - {0x0000a3fc, 0x000f0f01}, - {0x0000a400, 0x8fa91f01}, - {0x0000a404, 0x00000000}, - {0x0000a408, 0x0e79e5c6}, - {0x0000a40c, 0x00820820}, - {0x0000a414, 0x1ce739ce}, - {0x0000a418, 0x2d001dce}, - {0x0000a41c, 0x1ce739ce}, - {0x0000a420, 0x000001ce}, - {0x0000a424, 0x1ce739ce}, - {0x0000a428, 0x000001ce}, - {0x0000a42c, 0x1ce739ce}, - {0x0000a430, 0x1ce739ce}, - {0x0000a434, 0x00000000}, - {0x0000a438, 0x00001801}, - {0x0000a43c, 0x00100000}, - {0x0000a444, 0x00000000}, - {0x0000a448, 0x05000080}, - {0x0000a44c, 0x00000001}, - {0x0000a450, 0x00010000}, - {0x0000a458, 0x00000000}, - {0x0000a644, 0xbfad9d74}, - {0x0000a648, 0x0048060a}, - {0x0000a64c, 0x00003c37}, - {0x0000a670, 0x03020100}, - {0x0000a674, 0x09080504}, - {0x0000a678, 0x0d0c0b0a}, - {0x0000a67c, 0x13121110}, - {0x0000a680, 0x31301514}, - {0x0000a684, 0x35343332}, - {0x0000a688, 0x00000036}, - {0x0000a690, 0x00000838}, - {0x0000a7cc, 0x00000000}, - {0x0000a7d0, 0x00000000}, - {0x0000a7d4, 0x00000004}, - {0x0000a7dc, 0x00000000}, - {0x0000a8d0, 0x004b6a8e}, - {0x0000a8d4, 0x00000820}, - {0x0000a8dc, 0x00000000}, - {0x0000a8f0, 0x00000000}, - {0x0000a8f4, 0x00000000}, - {0x0000b2d0, 0x00000080}, - {0x0000b2d4, 0x00000000}, - {0x0000b2ec, 0x00000000}, - {0x0000b2f0, 0x00000000}, - {0x0000b2f4, 0x00000000}, - {0x0000b2f8, 0x00000000}, - {0x0000b408, 0x0e79e5c0}, - {0x0000b40c, 0x00820820}, - {0x0000b420, 0x00000000}, - {0x0000b8d0, 0x004b6a8e}, - {0x0000b8d4, 0x00000820}, - {0x0000b8dc, 0x00000000}, - {0x0000b8f0, 0x00000000}, - {0x0000b8f4, 0x00000000}, - {0x0000c2d0, 0x00000080}, - {0x0000c2d4, 0x00000000}, - {0x0000c2ec, 0x00000000}, - {0x0000c2f0, 0x00000000}, - {0x0000c2f4, 0x00000000}, - {0x0000c2f8, 0x00000000}, - {0x0000c408, 0x0e79e5c0}, - {0x0000c40c, 0x00820820}, - {0x0000c420, 0x00000000}, -}; - -static const u32 ar955x_1p0_common_wo_xlna_rx_gain_table[][2] = { - /* Addr allmodes */ - {0x0000a000, 0x00010000}, - {0x0000a004, 0x00030002}, - {0x0000a008, 0x00050004}, - {0x0000a00c, 0x00810080}, - {0x0000a010, 0x00830082}, - {0x0000a014, 0x01810180}, - {0x0000a018, 0x01830182}, - {0x0000a01c, 0x01850184}, - {0x0000a020, 0x01890188}, - {0x0000a024, 0x018b018a}, - {0x0000a028, 0x018d018c}, - {0x0000a02c, 0x03820190}, - {0x0000a030, 0x03840383}, - {0x0000a034, 0x03880385}, - {0x0000a038, 0x038a0389}, - {0x0000a03c, 0x038c038b}, - {0x0000a040, 0x0390038d}, - {0x0000a044, 0x03920391}, - {0x0000a048, 0x03940393}, - {0x0000a04c, 0x03960395}, - {0x0000a050, 0x00000000}, - {0x0000a054, 0x00000000}, - {0x0000a058, 0x00000000}, - {0x0000a05c, 0x00000000}, - {0x0000a060, 0x00000000}, - {0x0000a064, 0x00000000}, - {0x0000a068, 0x00000000}, - {0x0000a06c, 0x00000000}, - {0x0000a070, 0x00000000}, - {0x0000a074, 0x00000000}, - {0x0000a078, 0x00000000}, - {0x0000a07c, 0x00000000}, - {0x0000a080, 0x29292929}, - {0x0000a084, 0x29292929}, - {0x0000a088, 0x29292929}, - {0x0000a08c, 0x29292929}, - {0x0000a090, 0x22292929}, - {0x0000a094, 0x1d1d2222}, - {0x0000a098, 0x0c111117}, - {0x0000a09c, 0x00030303}, - {0x0000a0a0, 0x00000000}, - {0x0000a0a4, 0x00000000}, - {0x0000a0a8, 0x00000000}, - {0x0000a0ac, 0x00000000}, - {0x0000a0b0, 0x00000000}, - {0x0000a0b4, 0x00000000}, - {0x0000a0b8, 0x00000000}, - {0x0000a0bc, 0x00000000}, - {0x0000a0c0, 0x001f0000}, - {0x0000a0c4, 0x01000101}, - {0x0000a0c8, 0x011e011f}, - {0x0000a0cc, 0x011c011d}, - {0x0000a0d0, 0x02030204}, - {0x0000a0d4, 0x02010202}, - {0x0000a0d8, 0x021f0200}, - {0x0000a0dc, 0x0302021e}, - {0x0000a0e0, 0x03000301}, - {0x0000a0e4, 0x031e031f}, - {0x0000a0e8, 0x0402031d}, - {0x0000a0ec, 0x04000401}, - {0x0000a0f0, 0x041e041f}, - {0x0000a0f4, 0x0502041d}, - {0x0000a0f8, 0x05000501}, - {0x0000a0fc, 0x051e051f}, - {0x0000a100, 0x06010602}, - {0x0000a104, 0x061f0600}, - {0x0000a108, 0x061d061e}, - {0x0000a10c, 0x07020703}, - {0x0000a110, 0x07000701}, - {0x0000a114, 0x00000000}, - {0x0000a118, 0x00000000}, - {0x0000a11c, 0x00000000}, - {0x0000a120, 0x00000000}, - {0x0000a124, 0x00000000}, - {0x0000a128, 0x00000000}, - {0x0000a12c, 0x00000000}, - {0x0000a130, 0x00000000}, - {0x0000a134, 0x00000000}, - {0x0000a138, 0x00000000}, - {0x0000a13c, 0x00000000}, - {0x0000a140, 0x001f0000}, - {0x0000a144, 0x01000101}, - {0x0000a148, 0x011e011f}, - {0x0000a14c, 0x011c011d}, - {0x0000a150, 0x02030204}, - {0x0000a154, 0x02010202}, - {0x0000a158, 0x021f0200}, - {0x0000a15c, 0x0302021e}, - {0x0000a160, 0x03000301}, - {0x0000a164, 0x031e031f}, - {0x0000a168, 0x0402031d}, - {0x0000a16c, 0x04000401}, - {0x0000a170, 0x041e041f}, - {0x0000a174, 0x0502041d}, - {0x0000a178, 0x05000501}, - {0x0000a17c, 0x051e051f}, - {0x0000a180, 0x06010602}, - {0x0000a184, 0x061f0600}, - {0x0000a188, 0x061d061e}, - {0x0000a18c, 0x07020703}, - {0x0000a190, 0x07000701}, - {0x0000a194, 0x00000000}, - {0x0000a198, 0x00000000}, - {0x0000a19c, 0x00000000}, - {0x0000a1a0, 0x00000000}, - {0x0000a1a4, 0x00000000}, - {0x0000a1a8, 0x00000000}, - {0x0000a1ac, 0x00000000}, - {0x0000a1b0, 0x00000000}, - {0x0000a1b4, 0x00000000}, - {0x0000a1b8, 0x00000000}, - {0x0000a1bc, 0x00000000}, - {0x0000a1c0, 0x00000000}, - {0x0000a1c4, 0x00000000}, - {0x0000a1c8, 0x00000000}, - {0x0000a1cc, 0x00000000}, - {0x0000a1d0, 0x00000000}, - {0x0000a1d4, 0x00000000}, - {0x0000a1d8, 0x00000000}, - {0x0000a1dc, 0x00000000}, - {0x0000a1e0, 0x00000000}, - {0x0000a1e4, 0x00000000}, - {0x0000a1e8, 0x00000000}, - {0x0000a1ec, 0x00000000}, - {0x0000a1f0, 0x00000396}, - {0x0000a1f4, 0x00000396}, - {0x0000a1f8, 0x00000396}, - {0x0000a1fc, 0x00000196}, - {0x0000b000, 0x00010000}, - {0x0000b004, 0x00030002}, - {0x0000b008, 0x00050004}, - {0x0000b00c, 0x00810080}, - {0x0000b010, 0x00830082}, - {0x0000b014, 0x01810180}, - {0x0000b018, 0x01830182}, - {0x0000b01c, 0x01850184}, - {0x0000b020, 0x02810280}, - {0x0000b024, 0x02830282}, - {0x0000b028, 0x02850284}, - {0x0000b02c, 0x02890288}, - {0x0000b030, 0x028b028a}, - {0x0000b034, 0x0388028c}, - {0x0000b038, 0x038a0389}, - {0x0000b03c, 0x038c038b}, - {0x0000b040, 0x0390038d}, - {0x0000b044, 0x03920391}, - {0x0000b048, 0x03940393}, - {0x0000b04c, 0x03960395}, - {0x0000b050, 0x00000000}, - {0x0000b054, 0x00000000}, - {0x0000b058, 0x00000000}, - {0x0000b05c, 0x00000000}, - {0x0000b060, 0x00000000}, - {0x0000b064, 0x00000000}, - {0x0000b068, 0x00000000}, - {0x0000b06c, 0x00000000}, - {0x0000b070, 0x00000000}, - {0x0000b074, 0x00000000}, - {0x0000b078, 0x00000000}, - {0x0000b07c, 0x00000000}, - {0x0000b080, 0x32323232}, - {0x0000b084, 0x2f2f3232}, - {0x0000b088, 0x23282a2d}, - {0x0000b08c, 0x1c1e2123}, - {0x0000b090, 0x14171919}, - {0x0000b094, 0x0e0e1214}, - {0x0000b098, 0x03050707}, - {0x0000b09c, 0x00030303}, - {0x0000b0a0, 0x00000000}, - {0x0000b0a4, 0x00000000}, - {0x0000b0a8, 0x00000000}, - {0x0000b0ac, 0x00000000}, - {0x0000b0b0, 0x00000000}, - {0x0000b0b4, 0x00000000}, - {0x0000b0b8, 0x00000000}, - {0x0000b0bc, 0x00000000}, - {0x0000b0c0, 0x003f0020}, - {0x0000b0c4, 0x00400041}, - {0x0000b0c8, 0x0140005f}, - {0x0000b0cc, 0x0160015f}, - {0x0000b0d0, 0x017e017f}, - {0x0000b0d4, 0x02410242}, - {0x0000b0d8, 0x025f0240}, - {0x0000b0dc, 0x027f0260}, - {0x0000b0e0, 0x0341027e}, - {0x0000b0e4, 0x035f0340}, - {0x0000b0e8, 0x037f0360}, - {0x0000b0ec, 0x04400441}, - {0x0000b0f0, 0x0460045f}, - {0x0000b0f4, 0x0541047f}, - {0x0000b0f8, 0x055f0540}, - {0x0000b0fc, 0x057f0560}, - {0x0000b100, 0x06400641}, - {0x0000b104, 0x0660065f}, - {0x0000b108, 0x067e067f}, - {0x0000b10c, 0x07410742}, - {0x0000b110, 0x075f0740}, - {0x0000b114, 0x077f0760}, - {0x0000b118, 0x07800781}, - {0x0000b11c, 0x07a0079f}, - {0x0000b120, 0x07c107bf}, - {0x0000b124, 0x000007c0}, - {0x0000b128, 0x00000000}, - {0x0000b12c, 0x00000000}, - {0x0000b130, 0x00000000}, - {0x0000b134, 0x00000000}, - {0x0000b138, 0x00000000}, - {0x0000b13c, 0x00000000}, - {0x0000b140, 0x003f0020}, - {0x0000b144, 0x00400041}, - {0x0000b148, 0x0140005f}, - {0x0000b14c, 0x0160015f}, - {0x0000b150, 0x017e017f}, - {0x0000b154, 0x02410242}, - {0x0000b158, 0x025f0240}, - {0x0000b15c, 0x027f0260}, - {0x0000b160, 0x0341027e}, - {0x0000b164, 0x035f0340}, - {0x0000b168, 0x037f0360}, - {0x0000b16c, 0x04400441}, - {0x0000b170, 0x0460045f}, - {0x0000b174, 0x0541047f}, - {0x0000b178, 0x055f0540}, - {0x0000b17c, 0x057f0560}, - {0x0000b180, 0x06400641}, - {0x0000b184, 0x0660065f}, - {0x0000b188, 0x067e067f}, - {0x0000b18c, 0x07410742}, - {0x0000b190, 0x075f0740}, - {0x0000b194, 0x077f0760}, - {0x0000b198, 0x07800781}, - {0x0000b19c, 0x07a0079f}, - {0x0000b1a0, 0x07c107bf}, - {0x0000b1a4, 0x000007c0}, - {0x0000b1a8, 0x00000000}, - {0x0000b1ac, 0x00000000}, - {0x0000b1b0, 0x00000000}, - {0x0000b1b4, 0x00000000}, - {0x0000b1b8, 0x00000000}, - {0x0000b1bc, 0x00000000}, - {0x0000b1c0, 0x00000000}, - {0x0000b1c4, 0x00000000}, - {0x0000b1c8, 0x00000000}, - {0x0000b1cc, 0x00000000}, - {0x0000b1d0, 0x00000000}, - {0x0000b1d4, 0x00000000}, - {0x0000b1d8, 0x00000000}, - {0x0000b1dc, 0x00000000}, - {0x0000b1e0, 0x00000000}, - {0x0000b1e4, 0x00000000}, - {0x0000b1e8, 0x00000000}, - {0x0000b1ec, 0x00000000}, - {0x0000b1f0, 0x00000396}, - {0x0000b1f4, 0x00000396}, - {0x0000b1f8, 0x00000396}, - {0x0000b1fc, 0x00000196}, -}; - -static const u32 ar955x_1p0_soc_preamble[][2] = { - /* Addr allmodes */ - {0x00007000, 0x00000000}, - {0x00007004, 0x00000000}, - {0x00007008, 0x00000000}, - {0x0000700c, 0x00000000}, - {0x0000701c, 0x00000000}, - {0x00007020, 0x00000000}, - {0x00007024, 0x00000000}, - {0x00007028, 0x00000000}, - {0x0000702c, 0x00000000}, - {0x00007030, 0x00000000}, - {0x00007034, 0x00000002}, - {0x00007038, 0x000004c2}, - {0x00007048, 0x00000000}, -}; - -static const u32 ar955x_1p0_common_wo_xlna_rx_gain_bounds[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009e44, 0xfe321e27, 0xfe321e27, 0xfe291e27, 0xfe291e27}, - {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, -}; - -static const u32 ar955x_1p0_mac_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, - {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, - {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, - {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, - {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b}, - {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, - {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, - {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, -}; - -static const u32 ar955x_1p0_common_rx_gain_bounds[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009e44, 0xfe321e27, 0xfe321e27, 0xfe291e27, 0xfe291e27}, - {0x00009e48, 0x5030201a, 0x5030201a, 0x50302018, 0x50302018}, -}; - -static const u32 ar955x_1p0_modes_no_xpa_tx_gain_table[][9] = { - /* Addr 5G_HT20_L 5G_HT40_L 5G_HT20_M 5G_HT40_M 5G_HT20_H 5G_HT40_H 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x01feee00, 0x01feee00, 0x01feee00, 0x01feee00, 0x01feee00, 0x01feee00, 0xfffe5aaa, 0xfffe5aaa}, - {0x0000a2e0, 0x0000f000, 0x0000f000, 0x0000f000, 0x0000f000, 0x0000f000, 0x0000f000, 0xfffe9ccc, 0xfffe9ccc}, - {0x0000a2e4, 0x01ff0000, 0x01ff0000, 0x01ff0000, 0x01ff0000, 0x01ff0000, 0x01ff0000, 0xffffe0f0, 0xffffe0f0}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffef00, 0xffffef00}, - {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d8, 0x000050d8, 0x000050d8, 0x000050d8, 0x000050d7, 0x000050d7}, - {0x0000a500, 0x00002220, 0x00002220, 0x00002220, 0x00002220, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, - {0x0000a504, 0x04002222, 0x04002222, 0x04002222, 0x04002222, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, - {0x0000a508, 0x09002421, 0x09002421, 0x09002421, 0x09002421, 0x09002421, 0x09002421, 0x08000004, 0x08000004}, - {0x0000a50c, 0x0d002621, 0x0d002621, 0x0d002621, 0x0d002621, 0x0d002621, 0x0d002621, 0x0b000006, 0x0b000006}, - {0x0000a510, 0x13004620, 0x13004620, 0x13004620, 0x13004620, 0x13004620, 0x13004620, 0x0f00000a, 0x0f00000a}, - {0x0000a514, 0x19004a20, 0x19004a20, 0x19004a20, 0x19004a20, 0x19004a20, 0x19004a20, 0x1300000c, 0x1300000c}, - {0x0000a518, 0x1d004e20, 0x1d004e20, 0x1d004e20, 0x1d004e20, 0x1d004e20, 0x1d004e20, 0x1700000e, 0x1700000e}, - {0x0000a51c, 0x21005420, 0x21005420, 0x21005420, 0x21005420, 0x21005420, 0x21005420, 0x1b000012, 0x1b000012}, - {0x0000a520, 0x26005e20, 0x26005e20, 0x26005e20, 0x26005e20, 0x26005e20, 0x26005e20, 0x1f00004a, 0x1f00004a}, - {0x0000a524, 0x2b005e40, 0x2b005e40, 0x2b005e40, 0x2b005e40, 0x2b005e40, 0x2b005e40, 0x23000244, 0x23000244}, - {0x0000a528, 0x2f005e42, 0x2f005e42, 0x2f005e42, 0x2f005e42, 0x2f005e42, 0x2f005e42, 0x2700022b, 0x2700022b}, - {0x0000a52c, 0x33005e44, 0x33005e44, 0x33005e44, 0x33005e44, 0x33005e44, 0x33005e44, 0x2b000625, 0x2b000625}, - {0x0000a530, 0x38005e65, 0x38005e65, 0x38005e65, 0x38005e65, 0x38005e65, 0x38005e65, 0x2f001006, 0x2f001006}, - {0x0000a534, 0x3c005e69, 0x3c005e69, 0x3c005e69, 0x3c005e69, 0x3c005e69, 0x3c005e69, 0x330008a0, 0x330008a0}, - {0x0000a538, 0x40005e6b, 0x40005e6b, 0x40005e6b, 0x40005e6b, 0x40005e6b, 0x40005e6b, 0x37000a2a, 0x37000a2a}, - {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x44005e6d, 0x44005e6d, 0x44005e6d, 0x44005e6d, 0x3b001c23, 0x3b001c23}, - {0x0000a540, 0x49005e72, 0x49005e72, 0x49005e72, 0x49005e72, 0x49005e72, 0x49005e72, 0x3f0014a0, 0x3f0014a0}, - {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x4e005eb2, 0x4e005eb2, 0x4e005eb2, 0x4e005eb2, 0x43001882, 0x43001882}, - {0x0000a548, 0x53005f12, 0x53005f12, 0x53005f12, 0x53005f12, 0x53005f12, 0x53005f12, 0x47001ca2, 0x47001ca2}, - {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x59025eb2, 0x59025eb2, 0x59025eb2, 0x59025eb2, 0x4b001ec3, 0x4b001ec3}, - {0x0000a550, 0x5e025f12, 0x5e025f12, 0x5e025f12, 0x5e025f12, 0x5e025f12, 0x5e025f12, 0x4f00148c, 0x4f00148c}, - {0x0000a554, 0x61027f12, 0x61027f12, 0x61027f12, 0x61027f12, 0x61027f12, 0x61027f12, 0x53001c6e, 0x53001c6e}, - {0x0000a558, 0x6702bf12, 0x6702bf12, 0x6702bf12, 0x6702bf12, 0x6702bf12, 0x6702bf12, 0x57001c92, 0x57001c92}, - {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x6b02bf14, 0x6b02bf14, 0x6b02bf14, 0x6b02bf14, 0x5c001af6, 0x5c001af6}, - {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x5c001af6, 0x5c001af6}, - {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x5c001af6, 0x5c001af6}, - {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x5c001af6, 0x5c001af6}, - {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x5c001af6, 0x5c001af6}, - {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x5c001af6, 0x5c001af6}, - {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x5c001af6, 0x5c001af6}, - {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x5c001af6, 0x5c001af6}, - {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x6f02bf16, 0x5c001af6, 0x5c001af6}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00804000, 0x00804000, 0x00804000, 0x00804000, 0x00804000, 0x00804000, 0x04005001, 0x04005001}, - {0x0000a614, 0x00804201, 0x00804201, 0x00804201, 0x00804201, 0x00804201, 0x00804201, 0x03808e02, 0x03808e02}, - {0x0000a618, 0x0280c802, 0x0280c802, 0x0280c802, 0x0280c802, 0x0280c802, 0x0280c802, 0x0300c000, 0x0300c000}, - {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x0280ca03, 0x0280ca03, 0x0280ca03, 0x0280ca03, 0x03808e02, 0x03808e02}, - {0x0000a620, 0x04c15104, 0x04c15104, 0x04c15104, 0x04c15104, 0x04c15104, 0x04c15104, 0x03410c03, 0x03410c03}, - {0x0000a624, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04014c03, 0x04014c03}, - {0x0000a628, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x05818d04, 0x05818d04}, - {0x0000a62c, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x0801cd04, 0x0801cd04}, - {0x0000a630, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x0801e007, 0x0801e007}, - {0x0000a634, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x0801e007, 0x0801e007}, - {0x0000a638, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x0801e007, 0x0801e007}, - {0x0000a63c, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x04c15305, 0x0801e007, 0x0801e007}, - {0x0000b2dc, 0x01feee00, 0x01feee00, 0x01feee00, 0x01feee00, 0x01feee00, 0x01feee00, 0xfffe5aaa, 0xfffe5aaa}, - {0x0000b2e0, 0x0000f000, 0x0000f000, 0x0000f000, 0x0000f000, 0x0000f000, 0x0000f000, 0xfffe9ccc, 0xfffe9ccc}, - {0x0000b2e4, 0x01ff0000, 0x01ff0000, 0x01ff0000, 0x01ff0000, 0x01ff0000, 0x01ff0000, 0xffffe0f0, 0xffffe0f0}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffef00, 0xffffef00}, - {0x0000c2dc, 0x01feee00, 0x01feee00, 0x01feee00, 0x01feee00, 0x01feee00, 0x01feee00, 0xfffe5aaa, 0xfffe5aaa}, - {0x0000c2e0, 0x0000f000, 0x0000f000, 0x0000f000, 0x0000f000, 0x0000f000, 0x0000f000, 0xfffe9ccc, 0xfffe9ccc}, - {0x0000c2e4, 0x01ff0000, 0x01ff0000, 0x01ff0000, 0x01ff0000, 0x01ff0000, 0x01ff0000, 0xffffe0f0, 0xffffe0f0}, - {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffef00, 0xffffef00}, - {0x00016044, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x054922d4, 0x054922d4}, - {0x00016048, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401}, - {0x00016444, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x054922d4, 0x054922d4}, - {0x00016448, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401}, - {0x00016844, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x056db2d4, 0x054922d4, 0x054922d4}, - {0x00016848, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401, 0x66482401}, -}; - -static const u32 ar955x_1p0_soc_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00007010, 0x00000023, 0x00000023, 0x00000023, 0x00000023}, -}; - -static const u32 ar955x_1p0_modes_fast_clock[][3] = { - /* Addr 5G_HT20 5G_HT40 */ - {0x00001030, 0x00000268, 0x000004d0}, - {0x00001070, 0x0000018c, 0x00000318}, - {0x000010b0, 0x00000fd0, 0x00001fa0}, - {0x00008014, 0x044c044c, 0x08980898}, - {0x0000801c, 0x148ec02b, 0x148ec057}, - {0x00008318, 0x000044c0, 0x00008980}, - {0x00009e00, 0x0372131c, 0x0372131c}, - {0x0000a230, 0x0000400b, 0x00004016}, - {0x0000a254, 0x00000898, 0x00001130}, -}; - -#endif /* INITVALS_955X_1P0_H */ diff --git a/drivers/net/wireless/ath/ath9k/ar9565_1p0_initvals.h b/drivers/net/wireless/ath/ath9k/ar9565_1p0_initvals.h deleted file mode 100644 index e85a8b076c22..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9565_1p0_initvals.h +++ /dev/null @@ -1,1233 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef INITVALS_9565_1P0_H -#define INITVALS_9565_1P0_H - -/* AR9565 1.0 */ - -static const u32 ar9565_1p0_mac_core[][2] = { - /* Addr allmodes */ - {0x00000008, 0x00000000}, - {0x00000030, 0x000a0085}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000000}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x000010f0, 0x00000100}, - {0x00001270, 0x00000000}, - {0x000012b0, 0x00000000}, - {0x000012f0, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00001810, 0x0f000003}, - {0x00008000, 0x00000000}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008018, 0x00000000}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00000000}, - {0x00008040, 0x00000000}, - {0x00008044, 0x00000000}, - {0x00008048, 0x00000000}, - {0x00008054, 0x00000000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x00008070, 0x00000310}, - {0x00008074, 0x00000020}, - {0x00008078, 0x00000000}, - {0x0000809c, 0x0000000f}, - {0x000080a0, 0x00000000}, - {0x000080a4, 0x02ff0000}, - {0x000080a8, 0x0e070605}, - {0x000080ac, 0x0000000d}, - {0x000080b0, 0x00000000}, - {0x000080b4, 0x00000000}, - {0x000080b8, 0x00000000}, - {0x000080bc, 0x00000000}, - {0x000080c0, 0x2a800000}, - {0x000080c4, 0x06900168}, - {0x000080c8, 0x13881c20}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00252500}, - {0x000080d4, 0x00b00005}, - {0x000080d8, 0x00400002}, - {0x000080dc, 0x00000000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x3f3f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00000000}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000000}, - {0x00008114, 0x000007ff}, - {0x00008118, 0x000000aa}, - {0x0000811c, 0x00003210}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x0000ffff}, - {0x00008144, 0xffffffff}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x00008170, 0x18486200}, - {0x00008174, 0x33332210}, - {0x00008178, 0x00000000}, - {0x0000817c, 0x00020000}, - {0x000081c4, 0x33332210}, - {0x000081c8, 0x00000000}, - {0x000081cc, 0x00000000}, - {0x000081d4, 0x00000000}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008244, 0x0010f424}, - {0x00008248, 0x00000800}, - {0x0000824c, 0x0001e848}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x40000000}, - {0x00008260, 0x00080922}, - {0x00008264, 0x9d400010}, - {0x00008268, 0xffffffff}, - {0x0000826c, 0x0000ffff}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000004}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x000000ff}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x0000829c, 0x00000000}, - {0x00008300, 0x00000140}, - {0x00008314, 0x00000000}, - {0x0000831c, 0x0000010d}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x0000001f}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000700}, - {0x00008338, 0xffff0000}, - {0x0000833c, 0x02400000}, - {0x00008340, 0x000107ff}, - {0x00008344, 0xaa48105b}, - {0x00008348, 0x008f0000}, - {0x0000835c, 0x00000000}, - {0x00008360, 0xffffffff}, - {0x00008364, 0xffffffff}, - {0x00008368, 0x00000000}, - {0x00008370, 0x00000000}, - {0x00008374, 0x000000ff}, - {0x00008378, 0x00000000}, - {0x0000837c, 0x00000000}, - {0x00008380, 0xffffffff}, - {0x00008384, 0xffffffff}, - {0x00008390, 0xffffffff}, - {0x00008394, 0xffffffff}, - {0x00008398, 0x00000000}, - {0x0000839c, 0x00000000}, - {0x000083a4, 0x0000fa14}, - {0x000083a8, 0x000f0c00}, - {0x000083ac, 0x33332210}, - {0x000083b0, 0x33332210}, - {0x000083b4, 0x33332210}, - {0x000083b8, 0x33332210}, - {0x000083bc, 0x00000000}, - {0x000083c0, 0x00000000}, - {0x000083c4, 0x00000000}, - {0x000083c8, 0x00000000}, - {0x000083cc, 0x00000200}, - {0x000083d0, 0x800301ff}, -}; - -static const u32 ar9565_1p0_mac_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, - {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, - {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, - {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, - {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b}, - {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, - {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, - {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, -}; - -static const u32 ar9565_1p0_baseband_core[][2] = { - /* Addr allmodes */ - {0x00009800, 0xafe68e30}, - {0x00009804, 0xfd14e000}, - {0x00009808, 0x9c0a8f6b}, - {0x0000980c, 0x04800000}, - {0x00009814, 0x9280c00a}, - {0x00009818, 0x00000000}, - {0x0000981c, 0x00020028}, - {0x00009834, 0x6400a290}, - {0x00009838, 0x0108ecff}, - {0x0000983c, 0x0d000600}, - {0x00009880, 0x201fff00}, - {0x00009884, 0x00001042}, - {0x000098a4, 0x00200400}, - {0x000098b0, 0x32840bbe}, - {0x000098d0, 0x004b6a8e}, - {0x000098d4, 0x00000820}, - {0x000098dc, 0x00000000}, - {0x000098e4, 0x01ffffff}, - {0x000098e8, 0x01ffffff}, - {0x000098ec, 0x01ffffff}, - {0x000098f0, 0x00000000}, - {0x000098f4, 0x00000000}, - {0x00009bf0, 0x80000000}, - {0x00009c04, 0xff55ff55}, - {0x00009c08, 0x0320ff55}, - {0x00009c0c, 0x00000000}, - {0x00009c10, 0x00000000}, - {0x00009c14, 0x00046384}, - {0x00009c18, 0x05b6b440}, - {0x00009c1c, 0x00b6b440}, - {0x00009d00, 0xc080a333}, - {0x00009d04, 0x40206c10}, - {0x00009d08, 0x009c4060}, - {0x00009d0c, 0x1883800a}, - {0x00009d10, 0x01834061}, - {0x00009d14, 0x00c00400}, - {0x00009d18, 0x00000000}, - {0x00009e08, 0x0038230c}, - {0x00009e24, 0x9907b515}, - {0x00009e28, 0x126f0600}, - {0x00009e30, 0x06336f77}, - {0x00009e34, 0x6af6532f}, - {0x00009e38, 0x0cc80c00}, - {0x00009e40, 0x0d261820}, - {0x00009e4c, 0x00001004}, - {0x00009e50, 0x00ff03f1}, - {0x00009e54, 0xe4c355c7}, - {0x00009e5c, 0xe9198724}, - {0x00009fc0, 0x823e4fc8}, - {0x00009fc4, 0x0001efb5}, - {0x00009fcc, 0x40000014}, - {0x0000a20c, 0x00000000}, - {0x0000a220, 0x00000000}, - {0x0000a224, 0x00000000}, - {0x0000a228, 0x10002310}, - {0x0000a23c, 0x00000000}, - {0x0000a244, 0x0c000000}, - {0x0000a2a0, 0x00000001}, - {0x0000a2c0, 0x00000001}, - {0x0000a2c8, 0x00000000}, - {0x0000a2cc, 0x18c43433}, - {0x0000a2d4, 0x00000000}, - {0x0000a2ec, 0x00000000}, - {0x0000a2f0, 0x00000000}, - {0x0000a2f4, 0x00000000}, - {0x0000a2f8, 0x00000000}, - {0x0000a344, 0x00000000}, - {0x0000a34c, 0x00000000}, - {0x0000a350, 0x0000a000}, - {0x0000a364, 0x00000000}, - {0x0000a370, 0x00000000}, - {0x0000a390, 0x00000001}, - {0x0000a394, 0x00000444}, - {0x0000a398, 0x001f0e0f}, - {0x0000a39c, 0x0075393f}, - {0x0000a3a0, 0xb79f6427}, - {0x0000a3a4, 0x00000000}, - {0x0000a3a8, 0xaaaaaaaa}, - {0x0000a3ac, 0x3c466478}, - {0x0000a3c0, 0x20202020}, - {0x0000a3c4, 0x22222220}, - {0x0000a3c8, 0x20200020}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3d8, 0x20202020}, - {0x0000a3dc, 0x20202020}, - {0x0000a3e0, 0x20202020}, - {0x0000a3e4, 0x20202020}, - {0x0000a3e8, 0x20202020}, - {0x0000a3ec, 0x20202020}, - {0x0000a3f0, 0x00000000}, - {0x0000a3f4, 0x00000006}, - {0x0000a3f8, 0x0c9bd380}, - {0x0000a3fc, 0x000f0f01}, - {0x0000a400, 0x8fa91f01}, - {0x0000a404, 0x00000000}, - {0x0000a408, 0x0e79e5c6}, - {0x0000a40c, 0x00820820}, - {0x0000a414, 0x1ce739ce}, - {0x0000a418, 0x2d001dce}, - {0x0000a41c, 0x1ce739ce}, - {0x0000a420, 0x000001ce}, - {0x0000a424, 0x1ce739ce}, - {0x0000a428, 0x000001ce}, - {0x0000a42c, 0x1ce739ce}, - {0x0000a430, 0x1ce739ce}, - {0x0000a434, 0x00000000}, - {0x0000a438, 0x00001801}, - {0x0000a43c, 0x00000000}, - {0x0000a440, 0x00000000}, - {0x0000a444, 0x00000000}, - {0x0000a448, 0x05000096}, - {0x0000a44c, 0x00000001}, - {0x0000a450, 0x00010000}, - {0x0000a454, 0x03000000}, - {0x0000a458, 0x00000000}, - {0x0000a644, 0xbfad9d74}, - {0x0000a648, 0x0048060a}, - {0x0000a64c, 0x00003c37}, - {0x0000a670, 0x03020100}, - {0x0000a674, 0x09080504}, - {0x0000a678, 0x0d0c0b0a}, - {0x0000a67c, 0x13121110}, - {0x0000a680, 0x31301514}, - {0x0000a684, 0x35343332}, - {0x0000a688, 0x00000036}, - {0x0000a690, 0x00000838}, - {0x0000a6b4, 0x00512c01}, - {0x0000a7c0, 0x00000000}, - {0x0000a7c4, 0xfffffffc}, - {0x0000a7c8, 0x00000000}, - {0x0000a7cc, 0x00000000}, - {0x0000a7d0, 0x00000000}, - {0x0000a7d4, 0x00000004}, - {0x0000a7dc, 0x00000001}, - {0x0000a7f0, 0x80000000}, -}; - -static const u32 ar9565_1p0_baseband_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8009}, - {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a01ae}, - {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x63c640da}, - {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x09143c81}, - {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, - {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c}, - {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4}, - {0x00009e00, 0x0372111a, 0x0372111a, 0x037216a0, 0x037216a0}, - {0x00009e04, 0x00802020, 0x00802020, 0x00142020, 0x00142020}, - {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, - {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e}, - {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3379605e, 0x33795d5e}, - {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, - {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, - {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, - {0x00009e3c, 0xcf946222, 0xcf946222, 0xcf946222, 0xcf946222}, - {0x00009e44, 0xfe321e27, 0xfe321e27, 0xfe291e27, 0xfe291e27}, - {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, - {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, - {0x0000a204, 0x07318fc0, 0x07318fc4, 0x07318fc4, 0x07318fc0}, - {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, - {0x0000a22c, 0x01026a2f, 0x01026a27, 0x01026a2f, 0x01026a2f}, - {0x0000a230, 0x0000400a, 0x00004014, 0x00004016, 0x0000400b}, - {0x0000a234, 0x00000fff, 0x10000fff, 0x10000fff, 0x00000fff}, - {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018}, - {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002}, - {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, - {0x0000a260, 0x0a021501, 0x0a021501, 0x3a021501, 0x3a021501}, - {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b}, - {0x0000a284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, - {0x0000a288, 0x00100510, 0x00100510, 0x00100510, 0x00100510}, - {0x0000a28c, 0x00021551, 0x00021551, 0x00021551, 0x00021551}, - {0x0000a2c4, 0x00058d18, 0x00058d18, 0x00058d18, 0x00058d18}, - {0x0000a2d0, 0x00071982, 0x00071982, 0x00071982, 0x00071982}, - {0x0000a2d8, 0x7999a83b, 0x7999a83b, 0x7999a83b, 0x7999a83b}, - {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000ae04, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, - {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, -}; - -static const u32 ar9565_1p0_radio_core[][2] = { - /* Addr allmodes */ - {0x00016000, 0x36db6db6}, - {0x00016004, 0x6db6db40}, - {0x00016008, 0x73f00000}, - {0x0001600c, 0x00000000}, - {0x00016010, 0x6d823601}, - {0x00016040, 0x7f80fff8}, - {0x0001604c, 0x1c99e04f}, - {0x00016050, 0x6db6db6c}, - {0x00016058, 0x6c200000}, - {0x00016080, 0x000c0000}, - {0x00016084, 0x9a68048c}, - {0x00016088, 0x54214514}, - {0x0001608c, 0x1203040b}, - {0x00016090, 0x24926490}, - {0x00016098, 0xd28b3330}, - {0x000160a0, 0x0a108ffe}, - {0x000160a4, 0x812fc491}, - {0x000160a8, 0x423c8000}, - {0x000160b4, 0x92000000}, - {0x000160b8, 0x0285dddc}, - {0x000160bc, 0x02908888}, - {0x000160c0, 0x006db6d0}, - {0x000160c4, 0x6dd6db60}, - {0x000160c8, 0x6db6db6c}, - {0x000160cc, 0x6de6c1b0}, - {0x00016100, 0x3fffbe04}, - {0x00016104, 0xfff80000}, - {0x00016108, 0x00200400}, - {0x00016110, 0x00000000}, - {0x00016144, 0x02084080}, - {0x00016148, 0x000080c0}, - {0x00016280, 0x050a0001}, - {0x00016284, 0x3d841440}, - {0x00016288, 0x00000000}, - {0x0001628c, 0xe3000000}, - {0x00016290, 0xa1004080}, - {0x00016294, 0x40000028}, - {0x00016298, 0x55aa2900}, - {0x00016340, 0x131c827a}, - {0x00016344, 0x00300000}, -}; - -static const u32 ar9565_1p0_radio_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0001609c, 0x0b8ee524, 0x0b8ee524, 0x0b8ee524, 0x0b8ee524}, - {0x000160ac, 0xa4646c08, 0xa4646c08, 0xa4646c08, 0xa4646c08}, - {0x000160b0, 0x01d67f70, 0x01d67f70, 0x01d67f70, 0x01d67f70}, - {0x0001610c, 0x40000000, 0x40000000, 0x40000000, 0x40000000}, - {0x00016140, 0x10804008, 0x10804008, 0x50804008, 0x50804008}, -}; - -static const u32 ar9565_1p0_soc_preamble[][2] = { - /* Addr allmodes */ - {0x00004078, 0x00000002}, - {0x000040a4, 0x00a0c9c9}, - {0x00007020, 0x00000000}, - {0x00007034, 0x00000002}, - {0x00007038, 0x000004c2}, -}; - -static const u32 ar9565_1p0_soc_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00007010, 0x00002233, 0x00002233, 0x00002233, 0x00002233}, -}; - -static const u32 ar9565_1p0_Common_rx_gain_table[][2] = { - /* Addr allmodes */ - {0x00004050, 0x00300300}, - {0x0000406c, 0x00100000}, - {0x0000a000, 0x00010000}, - {0x0000a004, 0x00030002}, - {0x0000a008, 0x00050004}, - {0x0000a00c, 0x00810080}, - {0x0000a010, 0x00830082}, - {0x0000a014, 0x01810180}, - {0x0000a018, 0x01830182}, - {0x0000a01c, 0x01850184}, - {0x0000a020, 0x01890188}, - {0x0000a024, 0x018b018a}, - {0x0000a028, 0x018d018c}, - {0x0000a02c, 0x01910190}, - {0x0000a030, 0x01930192}, - {0x0000a034, 0x01950194}, - {0x0000a038, 0x038a0196}, - {0x0000a03c, 0x038c038b}, - {0x0000a040, 0x0390038d}, - {0x0000a044, 0x03920391}, - {0x0000a048, 0x03940393}, - {0x0000a04c, 0x03960395}, - {0x0000a050, 0x00000000}, - {0x0000a054, 0x00000000}, - {0x0000a058, 0x00000000}, - {0x0000a05c, 0x00000000}, - {0x0000a060, 0x00000000}, - {0x0000a064, 0x00000000}, - {0x0000a068, 0x00000000}, - {0x0000a06c, 0x00000000}, - {0x0000a070, 0x00000000}, - {0x0000a074, 0x00000000}, - {0x0000a078, 0x00000000}, - {0x0000a07c, 0x00000000}, - {0x0000a080, 0x22222229}, - {0x0000a084, 0x1d1d1d1d}, - {0x0000a088, 0x1d1d1d1d}, - {0x0000a08c, 0x1d1d1d1d}, - {0x0000a090, 0x171d1d1d}, - {0x0000a094, 0x11111717}, - {0x0000a098, 0x00030311}, - {0x0000a09c, 0x00000000}, - {0x0000a0a0, 0x00000000}, - {0x0000a0a4, 0x00000000}, - {0x0000a0a8, 0x00000000}, - {0x0000a0ac, 0x00000000}, - {0x0000a0b0, 0x00000000}, - {0x0000a0b4, 0x00000000}, - {0x0000a0b8, 0x00000000}, - {0x0000a0bc, 0x00000000}, - {0x0000a0c0, 0x00bf00a0}, - {0x0000a0c4, 0x11a011a1}, - {0x0000a0c8, 0x11be11bf}, - {0x0000a0cc, 0x11bc11bd}, - {0x0000a0d0, 0x22632264}, - {0x0000a0d4, 0x22612262}, - {0x0000a0d8, 0x227f2260}, - {0x0000a0dc, 0x4322227e}, - {0x0000a0e0, 0x43204321}, - {0x0000a0e4, 0x433e433f}, - {0x0000a0e8, 0x4462433d}, - {0x0000a0ec, 0x44604461}, - {0x0000a0f0, 0x447e447f}, - {0x0000a0f4, 0x5582447d}, - {0x0000a0f8, 0x55805581}, - {0x0000a0fc, 0x559e559f}, - {0x0000a100, 0x66816682}, - {0x0000a104, 0x669f6680}, - {0x0000a108, 0x669d669e}, - {0x0000a10c, 0x77627763}, - {0x0000a110, 0x77607761}, - {0x0000a114, 0x00000000}, - {0x0000a118, 0x00000000}, - {0x0000a11c, 0x00000000}, - {0x0000a120, 0x00000000}, - {0x0000a124, 0x00000000}, - {0x0000a128, 0x00000000}, - {0x0000a12c, 0x00000000}, - {0x0000a130, 0x00000000}, - {0x0000a134, 0x00000000}, - {0x0000a138, 0x00000000}, - {0x0000a13c, 0x00000000}, - {0x0000a140, 0x00bf00a0}, - {0x0000a144, 0x11a011a1}, - {0x0000a148, 0x11be11bf}, - {0x0000a14c, 0x11bc11bd}, - {0x0000a150, 0x22632264}, - {0x0000a154, 0x22612262}, - {0x0000a158, 0x227f2260}, - {0x0000a15c, 0x4322227e}, - {0x0000a160, 0x43204321}, - {0x0000a164, 0x433e433f}, - {0x0000a168, 0x4462433d}, - {0x0000a16c, 0x44604461}, - {0x0000a170, 0x447e447f}, - {0x0000a174, 0x5582447d}, - {0x0000a178, 0x55805581}, - {0x0000a17c, 0x559e559f}, - {0x0000a180, 0x66816682}, - {0x0000a184, 0x669f6680}, - {0x0000a188, 0x669d669e}, - {0x0000a18c, 0x77e677e7}, - {0x0000a190, 0x77e477e5}, - {0x0000a194, 0x00000000}, - {0x0000a198, 0x00000000}, - {0x0000a19c, 0x00000000}, - {0x0000a1a0, 0x00000000}, - {0x0000a1a4, 0x00000000}, - {0x0000a1a8, 0x00000000}, - {0x0000a1ac, 0x00000000}, - {0x0000a1b0, 0x00000000}, - {0x0000a1b4, 0x00000000}, - {0x0000a1b8, 0x00000000}, - {0x0000a1bc, 0x00000000}, - {0x0000a1c0, 0x00000000}, - {0x0000a1c4, 0x00000000}, - {0x0000a1c8, 0x00000000}, - {0x0000a1cc, 0x00000000}, - {0x0000a1d0, 0x00000000}, - {0x0000a1d4, 0x00000000}, - {0x0000a1d8, 0x00000000}, - {0x0000a1dc, 0x00000000}, - {0x0000a1e0, 0x00000000}, - {0x0000a1e4, 0x00000000}, - {0x0000a1e8, 0x00000000}, - {0x0000a1ec, 0x00000000}, - {0x0000a1f0, 0x00000396}, - {0x0000a1f4, 0x00000396}, - {0x0000a1f8, 0x00000396}, - {0x0000a1fc, 0x00000196}, - {0x0000b000, 0x00010000}, - {0x0000b004, 0x00030002}, - {0x0000b008, 0x00050004}, - {0x0000b00c, 0x00810080}, - {0x0000b010, 0x00830082}, - {0x0000b014, 0x01810180}, - {0x0000b018, 0x01830182}, - {0x0000b01c, 0x01850184}, - {0x0000b020, 0x02810280}, - {0x0000b024, 0x02830282}, - {0x0000b028, 0x02850284}, - {0x0000b02c, 0x02890288}, - {0x0000b030, 0x028b028a}, - {0x0000b034, 0x0388028c}, - {0x0000b038, 0x038a0389}, - {0x0000b03c, 0x038c038b}, - {0x0000b040, 0x0390038d}, - {0x0000b044, 0x03920391}, - {0x0000b048, 0x03940393}, - {0x0000b04c, 0x03960395}, - {0x0000b050, 0x00000000}, - {0x0000b054, 0x00000000}, - {0x0000b058, 0x00000000}, - {0x0000b05c, 0x00000000}, - {0x0000b060, 0x00000000}, - {0x0000b064, 0x00000000}, - {0x0000b068, 0x00000000}, - {0x0000b06c, 0x00000000}, - {0x0000b070, 0x00000000}, - {0x0000b074, 0x00000000}, - {0x0000b078, 0x00000000}, - {0x0000b07c, 0x00000000}, - {0x0000b080, 0x32323232}, - {0x0000b084, 0x2f2f3232}, - {0x0000b088, 0x23282a2d}, - {0x0000b08c, 0x1c1e2123}, - {0x0000b090, 0x14171919}, - {0x0000b094, 0x0e0e1214}, - {0x0000b098, 0x03050707}, - {0x0000b09c, 0x00030303}, - {0x0000b0a0, 0x00000000}, - {0x0000b0a4, 0x00000000}, - {0x0000b0a8, 0x00000000}, - {0x0000b0ac, 0x00000000}, - {0x0000b0b0, 0x00000000}, - {0x0000b0b4, 0x00000000}, - {0x0000b0b8, 0x00000000}, - {0x0000b0bc, 0x00000000}, - {0x0000b0c0, 0x003f0020}, - {0x0000b0c4, 0x00400041}, - {0x0000b0c8, 0x0140005f}, - {0x0000b0cc, 0x0160015f}, - {0x0000b0d0, 0x017e017f}, - {0x0000b0d4, 0x02410242}, - {0x0000b0d8, 0x025f0240}, - {0x0000b0dc, 0x027f0260}, - {0x0000b0e0, 0x0341027e}, - {0x0000b0e4, 0x035f0340}, - {0x0000b0e8, 0x037f0360}, - {0x0000b0ec, 0x04400441}, - {0x0000b0f0, 0x0460045f}, - {0x0000b0f4, 0x0541047f}, - {0x0000b0f8, 0x055f0540}, - {0x0000b0fc, 0x057f0560}, - {0x0000b100, 0x06400641}, - {0x0000b104, 0x0660065f}, - {0x0000b108, 0x067e067f}, - {0x0000b10c, 0x07410742}, - {0x0000b110, 0x075f0740}, - {0x0000b114, 0x077f0760}, - {0x0000b118, 0x07800781}, - {0x0000b11c, 0x07a0079f}, - {0x0000b120, 0x07c107bf}, - {0x0000b124, 0x000007c0}, - {0x0000b128, 0x00000000}, - {0x0000b12c, 0x00000000}, - {0x0000b130, 0x00000000}, - {0x0000b134, 0x00000000}, - {0x0000b138, 0x00000000}, - {0x0000b13c, 0x00000000}, - {0x0000b140, 0x003f0020}, - {0x0000b144, 0x00400041}, - {0x0000b148, 0x0140005f}, - {0x0000b14c, 0x0160015f}, - {0x0000b150, 0x017e017f}, - {0x0000b154, 0x02410242}, - {0x0000b158, 0x025f0240}, - {0x0000b15c, 0x027f0260}, - {0x0000b160, 0x0341027e}, - {0x0000b164, 0x035f0340}, - {0x0000b168, 0x037f0360}, - {0x0000b16c, 0x04400441}, - {0x0000b170, 0x0460045f}, - {0x0000b174, 0x0541047f}, - {0x0000b178, 0x055f0540}, - {0x0000b17c, 0x057f0560}, - {0x0000b180, 0x06400641}, - {0x0000b184, 0x0660065f}, - {0x0000b188, 0x067e067f}, - {0x0000b18c, 0x07410742}, - {0x0000b190, 0x075f0740}, - {0x0000b194, 0x077f0760}, - {0x0000b198, 0x07800781}, - {0x0000b19c, 0x07a0079f}, - {0x0000b1a0, 0x07c107bf}, - {0x0000b1a4, 0x000007c0}, - {0x0000b1a8, 0x00000000}, - {0x0000b1ac, 0x00000000}, - {0x0000b1b0, 0x00000000}, - {0x0000b1b4, 0x00000000}, - {0x0000b1b8, 0x00000000}, - {0x0000b1bc, 0x00000000}, - {0x0000b1c0, 0x00000000}, - {0x0000b1c4, 0x00000000}, - {0x0000b1c8, 0x00000000}, - {0x0000b1cc, 0x00000000}, - {0x0000b1d0, 0x00000000}, - {0x0000b1d4, 0x00000000}, - {0x0000b1d8, 0x00000000}, - {0x0000b1dc, 0x00000000}, - {0x0000b1e0, 0x00000000}, - {0x0000b1e4, 0x00000000}, - {0x0000b1e8, 0x00000000}, - {0x0000b1ec, 0x00000000}, - {0x0000b1f0, 0x00000396}, - {0x0000b1f4, 0x00000396}, - {0x0000b1f8, 0x00000396}, - {0x0000b1fc, 0x00000196}, -}; - -static const u32 ar9565_1p0_Modes_lowest_ob_db_tx_gain_table[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0xfc0a9380, 0xfc0a9380, 0xfdab5b52, 0xfdab5b52}, - {0x0000a2e0, 0xffecec00, 0xffecec00, 0xfd339c84, 0xfd339c84}, - {0x0000a2e4, 0xfc0f0000, 0xfc0f0000, 0xfec3e000, 0xfec3e000}, - {0x0000a2e8, 0xfc100000, 0xfc100000, 0xfffc0000, 0xfffc0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, - {0x0000a518, 0x21020220, 0x21020220, 0x16000402, 0x16000402}, - {0x0000a51c, 0x27020223, 0x27020223, 0x19000404, 0x19000404}, - {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, - {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, - {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, - {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, - {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, - {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861}, - {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81}, - {0x0000a54c, 0x5c04286b, 0x5c04286b, 0x47001a83, 0x47001a83}, - {0x0000a550, 0x61042a6c, 0x61042a6c, 0x4a001c84, 0x4a001c84}, - {0x0000a554, 0x66062a6c, 0x66062a6c, 0x4e001ce3, 0x4e001ce3}, - {0x0000a558, 0x6b062e6c, 0x6b062e6c, 0x52001ce5, 0x52001ce5}, - {0x0000a55c, 0x7006308c, 0x7006308c, 0x56001ce9, 0x56001ce9}, - {0x0000a560, 0x730a308a, 0x730a308a, 0x5a001ceb, 0x5a001ceb}, - {0x0000a564, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a568, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a56c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a570, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a574, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a578, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a57c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a618, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a61c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a620, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a624, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a628, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a62c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a630, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a634, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a638, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a63c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00016044, 0x012482d4, 0x012482d4, 0x012482d4, 0x012482d4}, - {0x00016048, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00016054, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, -}; - -static const u32 ar9565_1p0_pciephy_clkreq_disable_L1[][2] = { - /* Addr allmodes */ - {0x00018c00, 0x18212ede}, - {0x00018c04, 0x000801d8}, - {0x00018c08, 0x0003780c}, -}; - -static const u32 ar9565_1p0_modes_fast_clock[][3] = { - /* Addr 5G_HT20 5G_HT40 */ - {0x00001030, 0x00000268, 0x000004d0}, - {0x00001070, 0x0000018c, 0x00000318}, - {0x000010b0, 0x00000fd0, 0x00001fa0}, - {0x00008014, 0x044c044c, 0x08980898}, - {0x0000801c, 0x148ec02b, 0x148ec057}, - {0x00008318, 0x000044c0, 0x00008980}, - {0x00009e00, 0x03721821, 0x03721821}, - {0x0000a230, 0x0000400b, 0x00004016}, - {0x0000a254, 0x00000898, 0x00001130}, -}; - -static const u32 ar9565_1p0_common_wo_xlna_rx_gain_table[][2] = { - /* Addr allmodes */ - {0x0000a000, 0x00010000}, - {0x0000a004, 0x00030002}, - {0x0000a008, 0x00050004}, - {0x0000a00c, 0x00810080}, - {0x0000a010, 0x00830082}, - {0x0000a014, 0x01810180}, - {0x0000a018, 0x01830182}, - {0x0000a01c, 0x01850184}, - {0x0000a020, 0x01890188}, - {0x0000a024, 0x018b018a}, - {0x0000a028, 0x018d018c}, - {0x0000a02c, 0x03820190}, - {0x0000a030, 0x03840383}, - {0x0000a034, 0x03880385}, - {0x0000a038, 0x038a0389}, - {0x0000a03c, 0x038c038b}, - {0x0000a040, 0x0390038d}, - {0x0000a044, 0x03920391}, - {0x0000a048, 0x03940393}, - {0x0000a04c, 0x03960395}, - {0x0000a050, 0x00000000}, - {0x0000a054, 0x00000000}, - {0x0000a058, 0x00000000}, - {0x0000a05c, 0x00000000}, - {0x0000a060, 0x00000000}, - {0x0000a064, 0x00000000}, - {0x0000a068, 0x00000000}, - {0x0000a06c, 0x00000000}, - {0x0000a070, 0x00000000}, - {0x0000a074, 0x00000000}, - {0x0000a078, 0x00000000}, - {0x0000a07c, 0x00000000}, - {0x0000a080, 0x29292929}, - {0x0000a084, 0x29292929}, - {0x0000a088, 0x29292929}, - {0x0000a08c, 0x29292929}, - {0x0000a090, 0x22292929}, - {0x0000a094, 0x1d1d2222}, - {0x0000a098, 0x0c111117}, - {0x0000a09c, 0x00030303}, - {0x0000a0a0, 0x00000000}, - {0x0000a0a4, 0x00000000}, - {0x0000a0a8, 0x00000000}, - {0x0000a0ac, 0x00000000}, - {0x0000a0b0, 0x00000000}, - {0x0000a0b4, 0x00000000}, - {0x0000a0b8, 0x00000000}, - {0x0000a0bc, 0x00000000}, - {0x0000a0c0, 0x00bf00a0}, - {0x0000a0c4, 0x11a011a1}, - {0x0000a0c8, 0x11be11bf}, - {0x0000a0cc, 0x11bc11bd}, - {0x0000a0d0, 0x22632264}, - {0x0000a0d4, 0x22612262}, - {0x0000a0d8, 0x227f2260}, - {0x0000a0dc, 0x4322227e}, - {0x0000a0e0, 0x43204321}, - {0x0000a0e4, 0x433e433f}, - {0x0000a0e8, 0x4462433d}, - {0x0000a0ec, 0x44604461}, - {0x0000a0f0, 0x447e447f}, - {0x0000a0f4, 0x5582447d}, - {0x0000a0f8, 0x55805581}, - {0x0000a0fc, 0x559e559f}, - {0x0000a100, 0x66816682}, - {0x0000a104, 0x669f6680}, - {0x0000a108, 0x669d669e}, - {0x0000a10c, 0x77627763}, - {0x0000a110, 0x77607761}, - {0x0000a114, 0x00000000}, - {0x0000a118, 0x00000000}, - {0x0000a11c, 0x00000000}, - {0x0000a120, 0x00000000}, - {0x0000a124, 0x00000000}, - {0x0000a128, 0x00000000}, - {0x0000a12c, 0x00000000}, - {0x0000a130, 0x00000000}, - {0x0000a134, 0x00000000}, - {0x0000a138, 0x00000000}, - {0x0000a13c, 0x00000000}, - {0x0000a140, 0x00bf00a0}, - {0x0000a144, 0x11a011a1}, - {0x0000a148, 0x11be11bf}, - {0x0000a14c, 0x11bc11bd}, - {0x0000a150, 0x22632264}, - {0x0000a154, 0x22612262}, - {0x0000a158, 0x227f2260}, - {0x0000a15c, 0x4322227e}, - {0x0000a160, 0x43204321}, - {0x0000a164, 0x433e433f}, - {0x0000a168, 0x4462433d}, - {0x0000a16c, 0x44604461}, - {0x0000a170, 0x447e447f}, - {0x0000a174, 0x5582447d}, - {0x0000a178, 0x55805581}, - {0x0000a17c, 0x559e559f}, - {0x0000a180, 0x66816682}, - {0x0000a184, 0x669f6680}, - {0x0000a188, 0x669d669e}, - {0x0000a18c, 0x77e677e7}, - {0x0000a190, 0x77e477e5}, - {0x0000a194, 0x00000000}, - {0x0000a198, 0x00000000}, - {0x0000a19c, 0x00000000}, - {0x0000a1a0, 0x00000000}, - {0x0000a1a4, 0x00000000}, - {0x0000a1a8, 0x00000000}, - {0x0000a1ac, 0x00000000}, - {0x0000a1b0, 0x00000000}, - {0x0000a1b4, 0x00000000}, - {0x0000a1b8, 0x00000000}, - {0x0000a1bc, 0x00000000}, - {0x0000a1c0, 0x00000000}, - {0x0000a1c4, 0x00000000}, - {0x0000a1c8, 0x00000000}, - {0x0000a1cc, 0x00000000}, - {0x0000a1d0, 0x00000000}, - {0x0000a1d4, 0x00000000}, - {0x0000a1d8, 0x00000000}, - {0x0000a1dc, 0x00000000}, - {0x0000a1e0, 0x00000000}, - {0x0000a1e4, 0x00000000}, - {0x0000a1e8, 0x00000000}, - {0x0000a1ec, 0x00000000}, - {0x0000a1f0, 0x00000396}, - {0x0000a1f4, 0x00000396}, - {0x0000a1f8, 0x00000396}, - {0x0000a1fc, 0x00000196}, - {0x0000b000, 0x00010000}, - {0x0000b004, 0x00030002}, - {0x0000b008, 0x00050004}, - {0x0000b00c, 0x00810080}, - {0x0000b010, 0x00830082}, - {0x0000b014, 0x01810180}, - {0x0000b018, 0x01830182}, - {0x0000b01c, 0x01850184}, - {0x0000b020, 0x02810280}, - {0x0000b024, 0x02830282}, - {0x0000b028, 0x02850284}, - {0x0000b02c, 0x02890288}, - {0x0000b030, 0x028b028a}, - {0x0000b034, 0x0388028c}, - {0x0000b038, 0x038a0389}, - {0x0000b03c, 0x038c038b}, - {0x0000b040, 0x0390038d}, - {0x0000b044, 0x03920391}, - {0x0000b048, 0x03940393}, - {0x0000b04c, 0x03960395}, - {0x0000b050, 0x00000000}, - {0x0000b054, 0x00000000}, - {0x0000b058, 0x00000000}, - {0x0000b05c, 0x00000000}, - {0x0000b060, 0x00000000}, - {0x0000b064, 0x00000000}, - {0x0000b068, 0x00000000}, - {0x0000b06c, 0x00000000}, - {0x0000b070, 0x00000000}, - {0x0000b074, 0x00000000}, - {0x0000b078, 0x00000000}, - {0x0000b07c, 0x00000000}, - {0x0000b080, 0x32323232}, - {0x0000b084, 0x2f2f3232}, - {0x0000b088, 0x23282a2d}, - {0x0000b08c, 0x1c1e2123}, - {0x0000b090, 0x14171919}, - {0x0000b094, 0x0e0e1214}, - {0x0000b098, 0x03050707}, - {0x0000b09c, 0x00030303}, - {0x0000b0a0, 0x00000000}, - {0x0000b0a4, 0x00000000}, - {0x0000b0a8, 0x00000000}, - {0x0000b0ac, 0x00000000}, - {0x0000b0b0, 0x00000000}, - {0x0000b0b4, 0x00000000}, - {0x0000b0b8, 0x00000000}, - {0x0000b0bc, 0x00000000}, - {0x0000b0c0, 0x003f0020}, - {0x0000b0c4, 0x00400041}, - {0x0000b0c8, 0x0140005f}, - {0x0000b0cc, 0x0160015f}, - {0x0000b0d0, 0x017e017f}, - {0x0000b0d4, 0x02410242}, - {0x0000b0d8, 0x025f0240}, - {0x0000b0dc, 0x027f0260}, - {0x0000b0e0, 0x0341027e}, - {0x0000b0e4, 0x035f0340}, - {0x0000b0e8, 0x037f0360}, - {0x0000b0ec, 0x04400441}, - {0x0000b0f0, 0x0460045f}, - {0x0000b0f4, 0x0541047f}, - {0x0000b0f8, 0x055f0540}, - {0x0000b0fc, 0x057f0560}, - {0x0000b100, 0x06400641}, - {0x0000b104, 0x0660065f}, - {0x0000b108, 0x067e067f}, - {0x0000b10c, 0x07410742}, - {0x0000b110, 0x075f0740}, - {0x0000b114, 0x077f0760}, - {0x0000b118, 0x07800781}, - {0x0000b11c, 0x07a0079f}, - {0x0000b120, 0x07c107bf}, - {0x0000b124, 0x000007c0}, - {0x0000b128, 0x00000000}, - {0x0000b12c, 0x00000000}, - {0x0000b130, 0x00000000}, - {0x0000b134, 0x00000000}, - {0x0000b138, 0x00000000}, - {0x0000b13c, 0x00000000}, - {0x0000b140, 0x003f0020}, - {0x0000b144, 0x00400041}, - {0x0000b148, 0x0140005f}, - {0x0000b14c, 0x0160015f}, - {0x0000b150, 0x017e017f}, - {0x0000b154, 0x02410242}, - {0x0000b158, 0x025f0240}, - {0x0000b15c, 0x027f0260}, - {0x0000b160, 0x0341027e}, - {0x0000b164, 0x035f0340}, - {0x0000b168, 0x037f0360}, - {0x0000b16c, 0x04400441}, - {0x0000b170, 0x0460045f}, - {0x0000b174, 0x0541047f}, - {0x0000b178, 0x055f0540}, - {0x0000b17c, 0x057f0560}, - {0x0000b180, 0x06400641}, - {0x0000b184, 0x0660065f}, - {0x0000b188, 0x067e067f}, - {0x0000b18c, 0x07410742}, - {0x0000b190, 0x075f0740}, - {0x0000b194, 0x077f0760}, - {0x0000b198, 0x07800781}, - {0x0000b19c, 0x07a0079f}, - {0x0000b1a0, 0x07c107bf}, - {0x0000b1a4, 0x000007c0}, - {0x0000b1a8, 0x00000000}, - {0x0000b1ac, 0x00000000}, - {0x0000b1b0, 0x00000000}, - {0x0000b1b4, 0x00000000}, - {0x0000b1b8, 0x00000000}, - {0x0000b1bc, 0x00000000}, - {0x0000b1c0, 0x00000000}, - {0x0000b1c4, 0x00000000}, - {0x0000b1c8, 0x00000000}, - {0x0000b1cc, 0x00000000}, - {0x0000b1d0, 0x00000000}, - {0x0000b1d4, 0x00000000}, - {0x0000b1d8, 0x00000000}, - {0x0000b1dc, 0x00000000}, - {0x0000b1e0, 0x00000000}, - {0x0000b1e4, 0x00000000}, - {0x0000b1e8, 0x00000000}, - {0x0000b1ec, 0x00000000}, - {0x0000b1f0, 0x00000396}, - {0x0000b1f4, 0x00000396}, - {0x0000b1f8, 0x00000396}, - {0x0000b1fc, 0x00000196}, -}; - -static const u32 ar9565_1p0_modes_low_ob_db_tx_gain_table[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0xfc0a9380, 0xfc0a9380, 0xfdab5b52, 0xfdab5b52}, - {0x0000a2e0, 0xffecec00, 0xffecec00, 0xfd339c84, 0xfd339c84}, - {0x0000a2e4, 0xfc0f0000, 0xfc0f0000, 0xfec3e000, 0xfec3e000}, - {0x0000a2e8, 0xfc100000, 0xfc100000, 0xfffc0000, 0xfffc0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, - {0x0000a518, 0x21020220, 0x21020220, 0x16000402, 0x16000402}, - {0x0000a51c, 0x27020223, 0x27020223, 0x19000404, 0x19000404}, - {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, - {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, - {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, - {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, - {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, - {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861}, - {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81}, - {0x0000a54c, 0x5c04286b, 0x5c04286b, 0x47001a83, 0x47001a83}, - {0x0000a550, 0x61042a6c, 0x61042a6c, 0x4a001c84, 0x4a001c84}, - {0x0000a554, 0x66062a6c, 0x66062a6c, 0x4e001ce3, 0x4e001ce3}, - {0x0000a558, 0x6b062e6c, 0x6b062e6c, 0x52001ce5, 0x52001ce5}, - {0x0000a55c, 0x7006308c, 0x7006308c, 0x56001ce9, 0x56001ce9}, - {0x0000a560, 0x730a308a, 0x730a308a, 0x5a001ceb, 0x5a001ceb}, - {0x0000a564, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a568, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a56c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a570, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a574, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a578, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a57c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a618, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a61c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a620, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a624, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a628, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a62c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a630, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a634, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a638, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a63c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00016044, 0x012482d4, 0x012482d4, 0x012482d4, 0x012482d4}, - {0x00016048, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00016054, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, -}; - -static const u32 ar9565_1p0_modes_high_ob_db_tx_gain_table[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0xfc0a9380, 0xfc0a9380, 0xfdab5b52, 0xfdab5b52}, - {0x0000a2e0, 0xffecec00, 0xffecec00, 0xfd339c84, 0xfd339c84}, - {0x0000a2e4, 0xfc0f0000, 0xfc0f0000, 0xfec3e000, 0xfec3e000}, - {0x0000a2e8, 0xfc100000, 0xfc100000, 0xfffc0000, 0xfffc0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050df, 0x000050df}, - {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, - {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002}, - {0x0000a508, 0x0b022220, 0x0b022220, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10022223, 0x10022223, 0x0c000200, 0x0c000200}, - {0x0000a510, 0x15022620, 0x15022620, 0x10000202, 0x10000202}, - {0x0000a514, 0x19022622, 0x19022622, 0x13000400, 0x13000400}, - {0x0000a518, 0x1c022822, 0x1c022822, 0x17000402, 0x17000402}, - {0x0000a51c, 0x21022842, 0x21022842, 0x1b000404, 0x1b000404}, - {0x0000a520, 0x24022c41, 0x24022c41, 0x1e000603, 0x1e000603}, - {0x0000a524, 0x29023042, 0x29023042, 0x23000a02, 0x23000a02}, - {0x0000a528, 0x2d023044, 0x2d023044, 0x27000a04, 0x27000a04}, - {0x0000a52c, 0x31023644, 0x31023644, 0x2a000a20, 0x2a000a20}, - {0x0000a530, 0x36025643, 0x36025643, 0x2e000e20, 0x2e000e20}, - {0x0000a534, 0x3a025a44, 0x3a025a44, 0x32000e22, 0x32000e22}, - {0x0000a538, 0x3d025e45, 0x3d025e45, 0x36000e24, 0x36000e24}, - {0x0000a53c, 0x43025e4a, 0x43025e4a, 0x3a001640, 0x3a001640}, - {0x0000a540, 0x4a025e6c, 0x4a025e6c, 0x3e001660, 0x3e001660}, - {0x0000a544, 0x50025e8e, 0x50025e8e, 0x41001861, 0x41001861}, - {0x0000a548, 0x56025eb2, 0x56025eb2, 0x45001a81, 0x45001a81}, - {0x0000a54c, 0x5c025eb5, 0x5c025eb5, 0x49001a83, 0x49001a83}, - {0x0000a550, 0x62025ef6, 0x62025ef6, 0x4c001c84, 0x4c001c84}, - {0x0000a554, 0x65025f56, 0x65025f56, 0x4f001ce3, 0x4f001ce3}, - {0x0000a558, 0x69027f56, 0x69027f56, 0x53001ce5, 0x53001ce5}, - {0x0000a55c, 0x6d029f56, 0x6d029f56, 0x57001ce9, 0x57001ce9}, - {0x0000a560, 0x73049f56, 0x73049f56, 0x5b001ceb, 0x5b001ceb}, - {0x0000a564, 0x7804ff56, 0x7804ff56, 0x60001cf0, 0x60001cf0}, - {0x0000a568, 0x7804ff56, 0x7804ff56, 0x61001cf1, 0x61001cf1}, - {0x0000a56c, 0x7804ff56, 0x7804ff56, 0x62001cf2, 0x62001cf2}, - {0x0000a570, 0x7804ff56, 0x7804ff56, 0x63001cf3, 0x63001cf3}, - {0x0000a574, 0x7804ff56, 0x7804ff56, 0x64001cf4, 0x64001cf4}, - {0x0000a578, 0x7804ff56, 0x7804ff56, 0x66001ff6, 0x66001ff6}, - {0x0000a57c, 0x7804ff56, 0x7804ff56, 0x66001ff6, 0x66001ff6}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00804201, 0x00804201, 0x00000000, 0x00000000}, - {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, - {0x0000a618, 0x00804201, 0x00804201, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02008201, 0x02008201, 0x02008501, 0x02008501}, - {0x0000a620, 0x02c10a03, 0x02c10a03, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x04815205, 0x04815205, 0x02c10b04, 0x02c10b04}, - {0x0000a628, 0x0581d406, 0x0581d406, 0x03814b04, 0x03814b04}, - {0x0000a62c, 0x0581d607, 0x0581d607, 0x05018e05, 0x05018e05}, - {0x0000a630, 0x0581d607, 0x0581d607, 0x05019406, 0x05019406}, - {0x0000a634, 0x0581d607, 0x0581d607, 0x05019406, 0x05019406}, - {0x0000a638, 0x0581d607, 0x0581d607, 0x05019406, 0x05019406}, - {0x0000a63c, 0x0581d607, 0x0581d607, 0x05019406, 0x05019406}, - {0x00016044, 0x056d82e4, 0x056d82e4, 0x056d82e4, 0x056d82e4}, - {0x00016048, 0x8db49060, 0x8db49060, 0x8db49060, 0x8db49060}, - {0x00016054, 0x6db60000, 0x6db60000, 0x6db60000, 0x6db60000}, -}; - -static const u32 ar9565_1p0_modes_high_power_tx_gain_table[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0xfc0a9380, 0xfc0a9380, 0xfdab5b52, 0xfdab5b52}, - {0x0000a2e0, 0xffecec00, 0xffecec00, 0xfd339c84, 0xfd339c84}, - {0x0000a2e4, 0xfc0f0000, 0xfc0f0000, 0xfec3e000, 0xfec3e000}, - {0x0000a2e8, 0xfc100000, 0xfc100000, 0xfffc0000, 0xfffc0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050df, 0x000050df}, - {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, - {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004}, - {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x18022622, 0x18022622, 0x11000400, 0x11000400}, - {0x0000a518, 0x1b022822, 0x1b022822, 0x15000402, 0x15000402}, - {0x0000a51c, 0x20022842, 0x20022842, 0x19000404, 0x19000404}, - {0x0000a520, 0x22022c41, 0x22022c41, 0x1b000603, 0x1b000603}, - {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02}, - {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04}, - {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20}, - {0x0000a530, 0x34025643, 0x34025643, 0x2a000e20, 0x2a000e20}, - {0x0000a534, 0x38025a44, 0x38025a44, 0x2e000e22, 0x2e000e22}, - {0x0000a538, 0x3b025e45, 0x3b025e45, 0x31000e24, 0x31000e24}, - {0x0000a53c, 0x41025e4a, 0x41025e4a, 0x34001640, 0x34001640}, - {0x0000a540, 0x48025e6c, 0x48025e6c, 0x38001660, 0x38001660}, - {0x0000a544, 0x4e025e8e, 0x4e025e8e, 0x3b001861, 0x3b001861}, - {0x0000a548, 0x53025eb2, 0x53025eb2, 0x3e001a81, 0x3e001a81}, - {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, - {0x0000a550, 0x5f025ef6, 0x5f025ef6, 0x44001c84, 0x44001c84}, - {0x0000a554, 0x62025f56, 0x62025f56, 0x48001ce3, 0x48001ce3}, - {0x0000a558, 0x66027f56, 0x66027f56, 0x4c001ce5, 0x4c001ce5}, - {0x0000a55c, 0x6a029f56, 0x6a029f56, 0x50001ce9, 0x50001ce9}, - {0x0000a560, 0x70049f56, 0x70049f56, 0x54001ceb, 0x54001ceb}, - {0x0000a564, 0x7504ff56, 0x7504ff56, 0x59001cf0, 0x59001cf0}, - {0x0000a568, 0x7504ff56, 0x7504ff56, 0x5a001cf1, 0x5a001cf1}, - {0x0000a56c, 0x7504ff56, 0x7504ff56, 0x5b001cf2, 0x5b001cf2}, - {0x0000a570, 0x7504ff56, 0x7504ff56, 0x5c001cf3, 0x5c001cf3}, - {0x0000a574, 0x7504ff56, 0x7504ff56, 0x5d001cf4, 0x5d001cf4}, - {0x0000a578, 0x7504ff56, 0x7504ff56, 0x5f001ff6, 0x5f001ff6}, - {0x0000a57c, 0x7504ff56, 0x7504ff56, 0x5f001ff6, 0x5f001ff6}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a618, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a61c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a620, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a624, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a628, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a62c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a630, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a634, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a638, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a63c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00016044, 0x056d82e6, 0x056d82e6, 0x056d82e6, 0x056d82e6}, - {0x00016048, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00016054, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, -}; - -#endif /* INITVALS_9565_1P0_H */ diff --git a/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h b/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h deleted file mode 100644 index bdee2ed67219..000000000000 --- a/drivers/net/wireless/ath/ath9k/ar9580_1p0_initvals.h +++ /dev/null @@ -1,997 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * Copyright (c) 2011-2012 Qualcomm Atheros Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef INITVALS_9580_1P0_H -#define INITVALS_9580_1P0_H - -/* AR9580 1.0 */ - -#define ar9580_1p0_modes_fast_clock ar9300Modes_fast_clock_2p2 - -static const u32 ar9580_1p0_radio_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0001609c, 0x0dd08f29, 0x0dd08f29, 0x0b283f31, 0x0b283f31}, - {0x000160ac, 0xa4653c00, 0xa4653c00, 0x24652800, 0x24652800}, - {0x000160b0, 0x03284f3e, 0x03284f3e, 0x05d08f20, 0x05d08f20}, - {0x0001610c, 0x08000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00016140, 0x10804008, 0x10804008, 0x50804008, 0x50804008}, - {0x0001650c, 0x08000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00016540, 0x10804008, 0x10804008, 0x50804008, 0x50804008}, - {0x0001690c, 0x08000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00016940, 0x10804008, 0x10804008, 0x50804008, 0x50804008}, -}; - -static const u32 ar9580_1p0_baseband_core[][2] = { - /* Addr allmodes */ - {0x00009800, 0xafe68e30}, - {0x00009804, 0xfd14e000}, - {0x00009808, 0x9c0a9f6b}, - {0x0000980c, 0x04900000}, - {0x00009814, 0x3280c00a}, - {0x00009818, 0x00000000}, - {0x0000981c, 0x00020028}, - {0x00009834, 0x6400a290}, - {0x00009838, 0x0108ecff}, - {0x0000983c, 0x0d000600}, - {0x00009880, 0x201fff00}, - {0x00009884, 0x00001042}, - {0x000098a4, 0x00200400}, - {0x000098b0, 0x32840bbe}, - {0x000098d0, 0x004b6a8e}, - {0x000098d4, 0x00000820}, - {0x000098dc, 0x00000000}, - {0x000098f0, 0x00000000}, - {0x000098f4, 0x00000000}, - {0x00009c04, 0xff55ff55}, - {0x00009c08, 0x0320ff55}, - {0x00009c0c, 0x00000000}, - {0x00009c10, 0x00000000}, - {0x00009c14, 0x00046384}, - {0x00009c18, 0x05b6b440}, - {0x00009c1c, 0x00b6b440}, - {0x00009d00, 0xc080a333}, - {0x00009d04, 0x40206c10}, - {0x00009d08, 0x009c4060}, - {0x00009d0c, 0x9883800a}, - {0x00009d10, 0x01834061}, - {0x00009d14, 0x00c0040b}, - {0x00009d18, 0x00000000}, - {0x00009e08, 0x0038230c}, - {0x00009e24, 0x990bb515}, - {0x00009e28, 0x0c6f0000}, - {0x00009e30, 0x06336f77}, - {0x00009e34, 0x6af6532f}, - {0x00009e38, 0x0cc80c00}, - {0x00009e40, 0x0d261820}, - {0x00009e4c, 0x00001004}, - {0x00009e50, 0x00ff03f1}, - {0x00009e54, 0x00000000}, - {0x00009fc0, 0x803e4788}, - {0x00009fc4, 0x0001efb5}, - {0x00009fcc, 0x40000014}, - {0x00009fd0, 0x01193b93}, - {0x0000a20c, 0x00000000}, - {0x0000a220, 0x00000000}, - {0x0000a224, 0x00000000}, - {0x0000a228, 0x10002310}, - {0x0000a23c, 0x00000000}, - {0x0000a244, 0x0c000000}, - {0x0000a2a0, 0x00000001}, - {0x0000a2c0, 0x00000001}, - {0x0000a2c8, 0x00000000}, - {0x0000a2cc, 0x18c43433}, - {0x0000a2d4, 0x00000000}, - {0x0000a2ec, 0x00000000}, - {0x0000a2f0, 0x00000000}, - {0x0000a2f4, 0x00000000}, - {0x0000a2f8, 0x00000000}, - {0x0000a344, 0x00000000}, - {0x0000a34c, 0x00000000}, - {0x0000a350, 0x0000a000}, - {0x0000a364, 0x00000000}, - {0x0000a370, 0x00000000}, - {0x0000a390, 0x00000001}, - {0x0000a394, 0x00000444}, - {0x0000a398, 0x001f0e0f}, - {0x0000a39c, 0x0075393f}, - {0x0000a3a0, 0xb79f6427}, - {0x0000a3a4, 0x00000000}, - {0x0000a3a8, 0xaaaaaaaa}, - {0x0000a3ac, 0x3c466478}, - {0x0000a3c0, 0x20202020}, - {0x0000a3c4, 0x22222220}, - {0x0000a3c8, 0x20200020}, - {0x0000a3cc, 0x20202020}, - {0x0000a3d0, 0x20202020}, - {0x0000a3d4, 0x20202020}, - {0x0000a3d8, 0x20202020}, - {0x0000a3dc, 0x20202020}, - {0x0000a3e0, 0x20202020}, - {0x0000a3e4, 0x20202020}, - {0x0000a3e8, 0x20202020}, - {0x0000a3ec, 0x20202020}, - {0x0000a3f0, 0x00000000}, - {0x0000a3f4, 0x00000000}, - {0x0000a3f8, 0x0c9bd380}, - {0x0000a3fc, 0x000f0f01}, - {0x0000a400, 0x8fa91f01}, - {0x0000a404, 0x00000000}, - {0x0000a408, 0x0e79e5c6}, - {0x0000a40c, 0x00820820}, - {0x0000a414, 0x1ce739ce}, - {0x0000a418, 0x2d001dce}, - {0x0000a41c, 0x1ce739ce}, - {0x0000a420, 0x000001ce}, - {0x0000a424, 0x1ce739ce}, - {0x0000a428, 0x000001ce}, - {0x0000a42c, 0x1ce739ce}, - {0x0000a430, 0x1ce739ce}, - {0x0000a434, 0x00000000}, - {0x0000a438, 0x00001801}, - {0x0000a43c, 0x00100000}, - {0x0000a440, 0x00000000}, - {0x0000a444, 0x00000000}, - {0x0000a448, 0x05000080}, - {0x0000a44c, 0x00000001}, - {0x0000a450, 0x00010000}, - {0x0000a458, 0x00000000}, - {0x0000a640, 0x00000000}, - {0x0000a644, 0x3fad9d74}, - {0x0000a648, 0x0048060a}, - {0x0000a64c, 0x00003c37}, - {0x0000a670, 0x03020100}, - {0x0000a674, 0x09080504}, - {0x0000a678, 0x0d0c0b0a}, - {0x0000a67c, 0x13121110}, - {0x0000a680, 0x31301514}, - {0x0000a684, 0x35343332}, - {0x0000a688, 0x00000036}, - {0x0000a690, 0x00000838}, - {0x0000a7c0, 0x00000000}, - {0x0000a7c4, 0xfffffffc}, - {0x0000a7c8, 0x00000000}, - {0x0000a7cc, 0x00000000}, - {0x0000a7d0, 0x00000000}, - {0x0000a7d4, 0x00000004}, - {0x0000a7dc, 0x00000000}, - {0x0000a8d0, 0x004b6a8e}, - {0x0000a8d4, 0x00000820}, - {0x0000a8dc, 0x00000000}, - {0x0000a8f0, 0x00000000}, - {0x0000a8f4, 0x00000000}, - {0x0000b2d0, 0x00000080}, - {0x0000b2d4, 0x00000000}, - {0x0000b2ec, 0x00000000}, - {0x0000b2f0, 0x00000000}, - {0x0000b2f4, 0x00000000}, - {0x0000b2f8, 0x00000000}, - {0x0000b408, 0x0e79e5c0}, - {0x0000b40c, 0x00820820}, - {0x0000b420, 0x00000000}, - {0x0000b8d0, 0x004b6a8e}, - {0x0000b8d4, 0x00000820}, - {0x0000b8dc, 0x00000000}, - {0x0000b8f0, 0x00000000}, - {0x0000b8f4, 0x00000000}, - {0x0000c2d0, 0x00000080}, - {0x0000c2d4, 0x00000000}, - {0x0000c2ec, 0x00000000}, - {0x0000c2f0, 0x00000000}, - {0x0000c2f4, 0x00000000}, - {0x0000c2f8, 0x00000000}, - {0x0000c408, 0x0e79e5c0}, - {0x0000c40c, 0x00820820}, - {0x0000c420, 0x00000000}, -}; - -#define ar9580_1p0_mac_postamble ar9300_2p2_mac_postamble - -static const u32 ar9580_1p0_low_ob_db_tx_gain_table[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, - {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402}, - {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, - {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, - {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, - {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, - {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, - {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, - {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861}, - {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81}, - {0x0000a54c, 0x5c02486b, 0x5c02486b, 0x47001a83, 0x47001a83}, - {0x0000a550, 0x61024a6c, 0x61024a6c, 0x4a001c84, 0x4a001c84}, - {0x0000a554, 0x66026a6c, 0x66026a6c, 0x4e001ce3, 0x4e001ce3}, - {0x0000a558, 0x6b026e6c, 0x6b026e6c, 0x52001ce5, 0x52001ce5}, - {0x0000a55c, 0x7002708c, 0x7002708c, 0x56001ce9, 0x56001ce9}, - {0x0000a560, 0x7302b08a, 0x7302b08a, 0x5a001ceb, 0x5a001ceb}, - {0x0000a564, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a568, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a56c, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a570, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a574, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a578, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a57c, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, - {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, - {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, - {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, - {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, - {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400}, - {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402}, - {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404}, - {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603}, - {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02}, - {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04}, - {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20}, - {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20}, - {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22}, - {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24}, - {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640}, - {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660}, - {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3f801861, 0x3f801861}, - {0x0000a5c8, 0x5782286c, 0x5782286c, 0x43801a81, 0x43801a81}, - {0x0000a5cc, 0x5c82486b, 0x5c82486b, 0x47801a83, 0x47801a83}, - {0x0000a5d0, 0x61824a6c, 0x61824a6c, 0x4a801c84, 0x4a801c84}, - {0x0000a5d4, 0x66826a6c, 0x66826a6c, 0x4e801ce3, 0x4e801ce3}, - {0x0000a5d8, 0x6b826e6c, 0x6b826e6c, 0x52801ce5, 0x52801ce5}, - {0x0000a5dc, 0x7082708c, 0x7082708c, 0x56801ce9, 0x56801ce9}, - {0x0000a5e0, 0x7382b08a, 0x7382b08a, 0x5a801ceb, 0x5a801ceb}, - {0x0000a5e4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, - {0x0000a5e8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, - {0x0000a5ec, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, - {0x0000a5f0, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, - {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, - {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, - {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, - {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, - {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, - {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, - {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016448, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, - {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016848, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, - {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, -}; - -#define ar9580_1p0_high_power_tx_gain_table ar9580_1p0_low_ob_db_tx_gain_table - -static const u32 ar9580_1p0_lowest_ob_db_tx_gain_table[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, - {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402}, - {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, - {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, - {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, - {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, - {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, - {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, - {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861}, - {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81}, - {0x0000a54c, 0x5c02486b, 0x5c02486b, 0x47001a83, 0x47001a83}, - {0x0000a550, 0x61024a6c, 0x61024a6c, 0x4a001c84, 0x4a001c84}, - {0x0000a554, 0x66026a6c, 0x66026a6c, 0x4e001ce3, 0x4e001ce3}, - {0x0000a558, 0x6b026e6c, 0x6b026e6c, 0x52001ce5, 0x52001ce5}, - {0x0000a55c, 0x7002708c, 0x7002708c, 0x56001ce9, 0x56001ce9}, - {0x0000a560, 0x7302b08a, 0x7302b08a, 0x5a001ceb, 0x5a001ceb}, - {0x0000a564, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a568, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a56c, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a570, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a574, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a578, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a57c, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec}, - {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, - {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, - {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, - {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, - {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, - {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400}, - {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402}, - {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404}, - {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603}, - {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02}, - {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04}, - {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20}, - {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20}, - {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22}, - {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24}, - {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640}, - {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660}, - {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3f801861, 0x3f801861}, - {0x0000a5c8, 0x5782286c, 0x5782286c, 0x43801a81, 0x43801a81}, - {0x0000a5cc, 0x5c82486b, 0x5c82486b, 0x47801a83, 0x47801a83}, - {0x0000a5d0, 0x61824a6c, 0x61824a6c, 0x4a801c84, 0x4a801c84}, - {0x0000a5d4, 0x66826a6c, 0x66826a6c, 0x4e801ce3, 0x4e801ce3}, - {0x0000a5d8, 0x6b826e6c, 0x6b826e6c, 0x52801ce5, 0x52801ce5}, - {0x0000a5dc, 0x7082708c, 0x7082708c, 0x56801ce9, 0x56801ce9}, - {0x0000a5e0, 0x7382b08a, 0x7382b08a, 0x5a801ceb, 0x5a801ceb}, - {0x0000a5e4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, - {0x0000a5e8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, - {0x0000a5ec, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, - {0x0000a5f0, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, - {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, - {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, - {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, - {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, - {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, - {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016048, 0x62480001, 0x62480001, 0x62480001, 0x62480001}, - {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016448, 0x62480001, 0x62480001, 0x62480001, 0x62480001}, - {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016848, 0x62480001, 0x62480001, 0x62480001, 0x62480001}, - {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, -}; - -#define ar9580_1p0_baseband_core_txfir_coeff_japan_2484 ar9462_2p0_baseband_core_txfir_coeff_japan_2484 - -static const u32 ar9580_1p0_mac_core[][2] = { - /* Addr allmodes */ - {0x00000008, 0x00000000}, - {0x00000030, 0x00020085}, - {0x00000034, 0x00000005}, - {0x00000040, 0x00000000}, - {0x00000044, 0x00000000}, - {0x00000048, 0x00000008}, - {0x0000004c, 0x00000010}, - {0x00000050, 0x00000000}, - {0x00001040, 0x002ffc0f}, - {0x00001044, 0x002ffc0f}, - {0x00001048, 0x002ffc0f}, - {0x0000104c, 0x002ffc0f}, - {0x00001050, 0x002ffc0f}, - {0x00001054, 0x002ffc0f}, - {0x00001058, 0x002ffc0f}, - {0x0000105c, 0x002ffc0f}, - {0x00001060, 0x002ffc0f}, - {0x00001064, 0x002ffc0f}, - {0x000010f0, 0x00000100}, - {0x00001270, 0x00000000}, - {0x000012b0, 0x00000000}, - {0x000012f0, 0x00000000}, - {0x0000143c, 0x00000000}, - {0x0000147c, 0x00000000}, - {0x00008000, 0x00000000}, - {0x00008004, 0x00000000}, - {0x00008008, 0x00000000}, - {0x0000800c, 0x00000000}, - {0x00008018, 0x00000000}, - {0x00008020, 0x00000000}, - {0x00008038, 0x00000000}, - {0x0000803c, 0x00000000}, - {0x00008040, 0x00000000}, - {0x00008044, 0x00000000}, - {0x00008048, 0x00000000}, - {0x0000804c, 0xffffffff}, - {0x00008054, 0x00000000}, - {0x00008058, 0x00000000}, - {0x0000805c, 0x000fc78f}, - {0x00008060, 0x0000000f}, - {0x00008064, 0x00000000}, - {0x00008070, 0x00000310}, - {0x00008074, 0x00000020}, - {0x00008078, 0x00000000}, - {0x0000809c, 0x0000000f}, - {0x000080a0, 0x00000000}, - {0x000080a4, 0x02ff0000}, - {0x000080a8, 0x0e070605}, - {0x000080ac, 0x0000000d}, - {0x000080b0, 0x00000000}, - {0x000080b4, 0x00000000}, - {0x000080b8, 0x00000000}, - {0x000080bc, 0x00000000}, - {0x000080c0, 0x2a800000}, - {0x000080c4, 0x06900168}, - {0x000080c8, 0x13881c22}, - {0x000080cc, 0x01f40000}, - {0x000080d0, 0x00252500}, - {0x000080d4, 0x00a00000}, - {0x000080d8, 0x00400000}, - {0x000080dc, 0x00000000}, - {0x000080e0, 0xffffffff}, - {0x000080e4, 0x0000ffff}, - {0x000080e8, 0x3f3f3f3f}, - {0x000080ec, 0x00000000}, - {0x000080f0, 0x00000000}, - {0x000080f4, 0x00000000}, - {0x000080fc, 0x00020000}, - {0x00008100, 0x00000000}, - {0x00008108, 0x00000052}, - {0x0000810c, 0x00000000}, - {0x00008110, 0x00000000}, - {0x00008114, 0x000007ff}, - {0x00008118, 0x000000aa}, - {0x0000811c, 0x00003210}, - {0x00008124, 0x00000000}, - {0x00008128, 0x00000000}, - {0x0000812c, 0x00000000}, - {0x00008130, 0x00000000}, - {0x00008134, 0x00000000}, - {0x00008138, 0x00000000}, - {0x0000813c, 0x0000ffff}, - {0x00008144, 0xffffffff}, - {0x00008168, 0x00000000}, - {0x0000816c, 0x00000000}, - {0x000081c0, 0x00000000}, - {0x000081c4, 0x33332210}, - {0x000081ec, 0x00000000}, - {0x000081f0, 0x00000000}, - {0x000081f4, 0x00000000}, - {0x000081f8, 0x00000000}, - {0x000081fc, 0x00000000}, - {0x00008240, 0x00100000}, - {0x00008244, 0x0010f400}, - {0x00008248, 0x00000800}, - {0x0000824c, 0x0001e800}, - {0x00008250, 0x00000000}, - {0x00008254, 0x00000000}, - {0x00008258, 0x00000000}, - {0x0000825c, 0x40000000}, - {0x00008260, 0x00080922}, - {0x00008264, 0x9d400010}, - {0x00008268, 0xffffffff}, - {0x0000826c, 0x0000ffff}, - {0x00008270, 0x00000000}, - {0x00008274, 0x40000000}, - {0x00008278, 0x003e4180}, - {0x0000827c, 0x00000004}, - {0x00008284, 0x0000002c}, - {0x00008288, 0x0000002c}, - {0x0000828c, 0x000000ff}, - {0x00008294, 0x00000000}, - {0x00008298, 0x00000000}, - {0x0000829c, 0x00000000}, - {0x00008300, 0x00000140}, - {0x00008314, 0x00000000}, - {0x0000831c, 0x0000010d}, - {0x00008328, 0x00000000}, - {0x0000832c, 0x00000007}, - {0x00008330, 0x00000302}, - {0x00008334, 0x00000700}, - {0x00008338, 0x00ff0000}, - {0x0000833c, 0x02400000}, - {0x00008340, 0x000107ff}, - {0x00008344, 0xaa48105b}, - {0x00008348, 0x008f0000}, - {0x0000835c, 0x00000000}, - {0x00008360, 0xffffffff}, - {0x00008364, 0xffffffff}, - {0x00008368, 0x00000000}, - {0x00008370, 0x00000000}, - {0x00008374, 0x000000ff}, - {0x00008378, 0x00000000}, - {0x0000837c, 0x00000000}, - {0x00008380, 0xffffffff}, - {0x00008384, 0xffffffff}, - {0x00008390, 0xffffffff}, - {0x00008394, 0xffffffff}, - {0x00008398, 0x00000000}, - {0x0000839c, 0x00000000}, - {0x000083a0, 0x00000000}, - {0x000083a4, 0x0000fa14}, - {0x000083a8, 0x000f0c00}, - {0x000083ac, 0x33332210}, - {0x000083b0, 0x33332210}, - {0x000083b4, 0x33332210}, - {0x000083b8, 0x33332210}, - {0x000083bc, 0x00000000}, - {0x000083c0, 0x00000000}, - {0x000083c4, 0x00000000}, - {0x000083c8, 0x00000000}, - {0x000083cc, 0x00000200}, - {0x000083d0, 0x000301ff}, -}; - -static const u32 ar9580_1p0_mixed_ob_db_tx_gain_table[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x1c000223, 0x1c000223, 0x11000400, 0x11000400}, - {0x0000a518, 0x21002220, 0x21002220, 0x15000402, 0x15000402}, - {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, - {0x0000a520, 0x2b022220, 0x2b022220, 0x1b000603, 0x1b000603}, - {0x0000a524, 0x2f022222, 0x2f022222, 0x1f000a02, 0x1f000a02}, - {0x0000a528, 0x34022225, 0x34022225, 0x23000a04, 0x23000a04}, - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x26000a20, 0x26000a20}, - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2a000e20, 0x2a000e20}, - {0x0000a534, 0x4202242a, 0x4202242a, 0x2e000e22, 0x2e000e22}, - {0x0000a538, 0x4702244a, 0x4702244a, 0x31000e24, 0x31000e24}, - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x34001640, 0x34001640}, - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x38001660, 0x38001660}, - {0x0000a544, 0x5302266c, 0x5302266c, 0x3b001861, 0x3b001861}, - {0x0000a548, 0x5702286c, 0x5702286c, 0x3e001a81, 0x3e001a81}, - {0x0000a54c, 0x5c02486b, 0x5c02486b, 0x42001a83, 0x42001a83}, - {0x0000a550, 0x61024a6c, 0x61024a6c, 0x44001c84, 0x44001c84}, - {0x0000a554, 0x66026a6c, 0x66026a6c, 0x48001ce3, 0x48001ce3}, - {0x0000a558, 0x6b026e6c, 0x6b026e6c, 0x4c001ce5, 0x4c001ce5}, - {0x0000a55c, 0x7002708c, 0x7002708c, 0x50001ce9, 0x50001ce9}, - {0x0000a560, 0x7302b08a, 0x7302b08a, 0x54001ceb, 0x54001ceb}, - {0x0000a564, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, - {0x0000a568, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, - {0x0000a56c, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, - {0x0000a570, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, - {0x0000a574, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, - {0x0000a578, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, - {0x0000a57c, 0x7702b08c, 0x7702b08c, 0x56001eec, 0x56001eec}, - {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, - {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, - {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, - {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, - {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, - {0x0000a594, 0x1c800223, 0x1c800223, 0x11800400, 0x11800400}, - {0x0000a598, 0x21802220, 0x21802220, 0x15800402, 0x15800402}, - {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404}, - {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1b800603, 0x1b800603}, - {0x0000a5a4, 0x2f822222, 0x2f822222, 0x1f800a02, 0x1f800a02}, - {0x0000a5a8, 0x34822225, 0x34822225, 0x23800a04, 0x23800a04}, - {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x26800a20, 0x26800a20}, - {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2a800e20, 0x2a800e20}, - {0x0000a5b4, 0x4282242a, 0x4282242a, 0x2e800e22, 0x2e800e22}, - {0x0000a5b8, 0x4782244a, 0x4782244a, 0x31800e24, 0x31800e24}, - {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x34801640, 0x34801640}, - {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x38801660, 0x38801660}, - {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3b801861, 0x3b801861}, - {0x0000a5c8, 0x5782286c, 0x5782286c, 0x3e801a81, 0x3e801a81}, - {0x0000a5cc, 0x5c82486b, 0x5c82486b, 0x42801a83, 0x42801a83}, - {0x0000a5d0, 0x61824a6c, 0x61824a6c, 0x44801c84, 0x44801c84}, - {0x0000a5d4, 0x66826a6c, 0x66826a6c, 0x48801ce3, 0x48801ce3}, - {0x0000a5d8, 0x6b826e6c, 0x6b826e6c, 0x4c801ce5, 0x4c801ce5}, - {0x0000a5dc, 0x7082708c, 0x7082708c, 0x50801ce9, 0x50801ce9}, - {0x0000a5e0, 0x7382b08a, 0x7382b08a, 0x54801ceb, 0x54801ceb}, - {0x0000a5e4, 0x7782b08c, 0x7782b08c, 0x56801eec, 0x56801eec}, - {0x0000a5e8, 0x7782b08c, 0x7782b08c, 0x56801eec, 0x56801eec}, - {0x0000a5ec, 0x7782b08c, 0x7782b08c, 0x56801eec, 0x56801eec}, - {0x0000a5f0, 0x7782b08c, 0x7782b08c, 0x56801eec, 0x56801eec}, - {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x56801eec, 0x56801eec}, - {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x56801eec, 0x56801eec}, - {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x56801eec, 0x56801eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, - {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, - {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, - {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, - {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, - {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, - {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, - {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x012492d4, 0x012492d4, 0x056db2e4, 0x056db2e4}, - {0x00016048, 0x66480001, 0x66480001, 0x8e480001, 0x8e480001}, - {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016444, 0x012492d4, 0x012492d4, 0x056db2e4, 0x056db2e4}, - {0x00016448, 0x66480001, 0x66480001, 0x8e480001, 0x8e480001}, - {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016844, 0x012492d4, 0x012492d4, 0x056db2e4, 0x056db2e4}, - {0x00016848, 0x66480001, 0x66480001, 0x8e480001, 0x8e480001}, - {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, -}; - -#define ar9580_1p0_wo_xlna_rx_gain_table ar9300Common_wo_xlna_rx_gain_table_2p2 - -#define ar9580_1p0_soc_postamble ar9300_2p2_soc_postamble - -#define ar9580_1p0_high_ob_db_tx_gain_table ar9300Modes_high_ob_db_tx_gain_table_2p2 - -#define ar9580_1p0_type5_tx_gain_table ar9300Modes_type5_tx_gain_table_2p2 - -static const u32 ar9580_1p0_type6_tx_gain_table[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x0000a2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, - {0x0000a2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, - {0x0000a2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, - {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, - {0x0000a510, 0x15000028, 0x15000028, 0x0f000202, 0x0f000202}, - {0x0000a514, 0x1b00002b, 0x1b00002b, 0x12000400, 0x12000400}, - {0x0000a518, 0x1f020028, 0x1f020028, 0x16000402, 0x16000402}, - {0x0000a51c, 0x2502002b, 0x2502002b, 0x19000404, 0x19000404}, - {0x0000a520, 0x2a04002a, 0x2a04002a, 0x1c000603, 0x1c000603}, - {0x0000a524, 0x2e06002a, 0x2e06002a, 0x21000a02, 0x21000a02}, - {0x0000a528, 0x3302202d, 0x3302202d, 0x25000a04, 0x25000a04}, - {0x0000a52c, 0x3804202c, 0x3804202c, 0x28000a20, 0x28000a20}, - {0x0000a530, 0x3c06202c, 0x3c06202c, 0x2c000e20, 0x2c000e20}, - {0x0000a534, 0x4108202d, 0x4108202d, 0x30000e22, 0x30000e22}, - {0x0000a538, 0x4506402d, 0x4506402d, 0x34000e24, 0x34000e24}, - {0x0000a53c, 0x4906222d, 0x4906222d, 0x38001640, 0x38001640}, - {0x0000a540, 0x4d062231, 0x4d062231, 0x3c001660, 0x3c001660}, - {0x0000a544, 0x50082231, 0x50082231, 0x3f001861, 0x3f001861}, - {0x0000a548, 0x5608422e, 0x5608422e, 0x43001a81, 0x43001a81}, - {0x0000a54c, 0x5e08442e, 0x5e08442e, 0x47001a83, 0x47001a83}, - {0x0000a550, 0x620a4431, 0x620a4431, 0x4a001c84, 0x4a001c84}, - {0x0000a554, 0x640a4432, 0x640a4432, 0x4e001ce3, 0x4e001ce3}, - {0x0000a558, 0x680a4434, 0x680a4434, 0x52001ce5, 0x52001ce5}, - {0x0000a55c, 0x6c0a6434, 0x6c0a6434, 0x56001ce9, 0x56001ce9}, - {0x0000a560, 0x6f0a6633, 0x6f0a6633, 0x5a001ceb, 0x5a001ceb}, - {0x0000a564, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, - {0x0000a568, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, - {0x0000a56c, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, - {0x0000a570, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, - {0x0000a574, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, - {0x0000a578, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, - {0x0000a57c, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, - {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a608, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, - {0x0000a60c, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, - {0x0000a610, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, - {0x0000a614, 0x01804601, 0x01804601, 0x01404000, 0x01404000}, - {0x0000a618, 0x01804601, 0x01804601, 0x01404501, 0x01404501}, - {0x0000a61c, 0x01804601, 0x01804601, 0x02008501, 0x02008501}, - {0x0000a620, 0x03408d02, 0x03408d02, 0x0280ca03, 0x0280ca03}, - {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, - {0x0000a628, 0x03410d04, 0x03410d04, 0x04014c04, 0x04014c04}, - {0x0000a62c, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, - {0x0000a630, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, - {0x0000a634, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, - {0x0000a638, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, - {0x0000a63c, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, - {0x0000b2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, - {0x0000b2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, - {0x0000b2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, - {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x0000c2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, - {0x0000c2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, - {0x0000c2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, - {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, - {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016048, 0x61200001, 0x61200001, 0x66480001, 0x66480001}, - {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016448, 0x61200001, 0x61200001, 0x66480001, 0x66480001}, - {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, - {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, - {0x00016848, 0x61200001, 0x61200001, 0x66480001, 0x66480001}, - {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, -}; - -static const u32 ar9580_1p0_soc_preamble[][2] = { - /* Addr allmodes */ - {0x000040a4, 0x00a0c1c9}, - {0x00007008, 0x00000000}, - {0x00007020, 0x00000000}, - {0x00007034, 0x00000002}, - {0x00007038, 0x000004c2}, - {0x00007048, 0x00000008}, -}; - -#define ar9580_1p0_rx_gain_table ar9462_common_rx_gain_table_2p0 - -static const u32 ar9580_1p0_radio_core[][2] = { - /* Addr allmodes */ - {0x00016000, 0x36db6db6}, - {0x00016004, 0x6db6db40}, - {0x00016008, 0x73f00000}, - {0x0001600c, 0x00000000}, - {0x00016040, 0x7f80fff8}, - {0x0001604c, 0x76d005b5}, - {0x00016050, 0x556cf031}, - {0x00016054, 0x13449440}, - {0x00016058, 0x0c51c92c}, - {0x0001605c, 0x3db7fffc}, - {0x00016060, 0xfffffffc}, - {0x00016064, 0x000f0278}, - {0x0001606c, 0x6db60000}, - {0x00016080, 0x00000000}, - {0x00016084, 0x0e48048c}, - {0x00016088, 0x54214514}, - {0x0001608c, 0x119f481e}, - {0x00016090, 0x24926490}, - {0x00016098, 0xd2888888}, - {0x000160a0, 0x0a108ffe}, - {0x000160a4, 0x812fc370}, - {0x000160a8, 0x423c8000}, - {0x000160b4, 0x92480080}, - {0x000160c0, 0x00adb6d0}, - {0x000160c4, 0x6db6db60}, - {0x000160c8, 0x6db6db6c}, - {0x000160cc, 0x01e6c000}, - {0x00016100, 0x3fffbe01}, - {0x00016104, 0xfff80000}, - {0x00016108, 0x00080010}, - {0x00016144, 0x02084080}, - {0x00016148, 0x00000000}, - {0x00016280, 0x058a0001}, - {0x00016284, 0x3d840208}, - {0x00016288, 0x05a20408}, - {0x0001628c, 0x00038c07}, - {0x00016290, 0x00000004}, - {0x00016294, 0x458aa14f}, - {0x00016380, 0x00000000}, - {0x00016384, 0x00000000}, - {0x00016388, 0x00800700}, - {0x0001638c, 0x00800700}, - {0x00016390, 0x00800700}, - {0x00016394, 0x00000000}, - {0x00016398, 0x00000000}, - {0x0001639c, 0x00000000}, - {0x000163a0, 0x00000001}, - {0x000163a4, 0x00000001}, - {0x000163a8, 0x00000000}, - {0x000163ac, 0x00000000}, - {0x000163b0, 0x00000000}, - {0x000163b4, 0x00000000}, - {0x000163b8, 0x00000000}, - {0x000163bc, 0x00000000}, - {0x000163c0, 0x000000a0}, - {0x000163c4, 0x000c0000}, - {0x000163c8, 0x14021402}, - {0x000163cc, 0x00001402}, - {0x000163d0, 0x00000000}, - {0x000163d4, 0x00000000}, - {0x00016400, 0x36db6db6}, - {0x00016404, 0x6db6db40}, - {0x00016408, 0x73f00000}, - {0x0001640c, 0x00000000}, - {0x00016440, 0x7f80fff8}, - {0x0001644c, 0x76d005b5}, - {0x00016450, 0x556cf031}, - {0x00016454, 0x13449440}, - {0x00016458, 0x0c51c92c}, - {0x0001645c, 0x3db7fffc}, - {0x00016460, 0xfffffffc}, - {0x00016464, 0x000f0278}, - {0x0001646c, 0x6db60000}, - {0x00016500, 0x3fffbe01}, - {0x00016504, 0xfff80000}, - {0x00016508, 0x00080010}, - {0x00016544, 0x02084080}, - {0x00016548, 0x00000000}, - {0x00016780, 0x00000000}, - {0x00016784, 0x00000000}, - {0x00016788, 0x00800700}, - {0x0001678c, 0x00800700}, - {0x00016790, 0x00800700}, - {0x00016794, 0x00000000}, - {0x00016798, 0x00000000}, - {0x0001679c, 0x00000000}, - {0x000167a0, 0x00000001}, - {0x000167a4, 0x00000001}, - {0x000167a8, 0x00000000}, - {0x000167ac, 0x00000000}, - {0x000167b0, 0x00000000}, - {0x000167b4, 0x00000000}, - {0x000167b8, 0x00000000}, - {0x000167bc, 0x00000000}, - {0x000167c0, 0x000000a0}, - {0x000167c4, 0x000c0000}, - {0x000167c8, 0x14021402}, - {0x000167cc, 0x00001402}, - {0x000167d0, 0x00000000}, - {0x000167d4, 0x00000000}, - {0x00016800, 0x36db6db6}, - {0x00016804, 0x6db6db40}, - {0x00016808, 0x73f00000}, - {0x0001680c, 0x00000000}, - {0x00016840, 0x7f80fff8}, - {0x0001684c, 0x76d005b5}, - {0x00016850, 0x556cf031}, - {0x00016854, 0x13449440}, - {0x00016858, 0x0c51c92c}, - {0x0001685c, 0x3db7fffc}, - {0x00016860, 0xfffffffc}, - {0x00016864, 0x000f0278}, - {0x0001686c, 0x6db60000}, - {0x00016900, 0x3fffbe01}, - {0x00016904, 0xfff80000}, - {0x00016908, 0x00080010}, - {0x00016944, 0x02084080}, - {0x00016948, 0x00000000}, - {0x00016b80, 0x00000000}, - {0x00016b84, 0x00000000}, - {0x00016b88, 0x00800700}, - {0x00016b8c, 0x00800700}, - {0x00016b90, 0x00800700}, - {0x00016b94, 0x00000000}, - {0x00016b98, 0x00000000}, - {0x00016b9c, 0x00000000}, - {0x00016ba0, 0x00000001}, - {0x00016ba4, 0x00000001}, - {0x00016ba8, 0x00000000}, - {0x00016bac, 0x00000000}, - {0x00016bb0, 0x00000000}, - {0x00016bb4, 0x00000000}, - {0x00016bb8, 0x00000000}, - {0x00016bbc, 0x00000000}, - {0x00016bc0, 0x000000a0}, - {0x00016bc4, 0x000c0000}, - {0x00016bc8, 0x14021402}, - {0x00016bcc, 0x00001402}, - {0x00016bd0, 0x00000000}, - {0x00016bd4, 0x00000000}, -}; - -static const u32 ar9580_1p0_baseband_postamble[][5] = { - /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ - {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8011, 0xd00a8011}, - {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a012e}, - {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, - {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, - {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, - {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c}, - {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4}, - {0x00009e00, 0x0372111a, 0x0372111a, 0x037216a0, 0x037216a0}, - {0x00009e04, 0x001c2020, 0x001c2020, 0x001c2020, 0x001c2020}, - {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, - {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e}, - {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3379605e, 0x33795d5e}, - {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, - {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, - {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, - {0x00009e3c, 0xcf946220, 0xcf946220, 0xcf946222, 0xcf946222}, - {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27}, - {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, - {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, - {0x0000a204, 0x000036c0, 0x000036c4, 0x000036c4, 0x000036c0}, - {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, - {0x0000a22c, 0x07e26a2f, 0x07e26a2f, 0x01026a2f, 0x01026a2f}, - {0x0000a230, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b}, - {0x0000a234, 0x00000fff, 0x10000fff, 0x10000fff, 0x00000fff}, - {0x0000a238, 0xffb01018, 0xffb01018, 0xffb01018, 0xffb01018}, - {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, - {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, - {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002}, - {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, - {0x0000a260, 0x0a021501, 0x0a021501, 0x3a021501, 0x3a021501}, - {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, - {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b}, - {0x0000a284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, - {0x0000a288, 0x00000110, 0x00000110, 0x00000110, 0x00000110}, - {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222}, - {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, - {0x0000a2d0, 0x00041981, 0x00041981, 0x00041981, 0x00041982}, - {0x0000a2d8, 0x7999a83b, 0x7999a83b, 0x7999a83b, 0x7999a83b}, - {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000}, - {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, - {0x0000b284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, - {0x0000b830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000be04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000}, - {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, - {0x0000be1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, - {0x0000be20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, - {0x0000c284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, -}; - -static const u32 ar9580_1p0_pcie_phy_clkreq_enable_L1[][2] = { - /* Addr allmodes */ - {0x00004040, 0x0835365e}, - {0x00004040, 0x0008003b}, - {0x00004044, 0x00000000}, -}; - -static const u32 ar9580_1p0_pcie_phy_clkreq_disable_L1[][2] = { - /* Addr allmodes */ - {0x00004040, 0x0831365e}, - {0x00004040, 0x0008003b}, - {0x00004044, 0x00000000}, -}; - -static const u32 ar9580_1p0_pcie_phy_pll_on_clkreq[][2] = { - /* Addr allmodes */ - {0x00004040, 0x0831265e}, - {0x00004040, 0x0008003b}, - {0x00004044, 0x00000000}, -}; - -#endif /* INITVALS_9580_1P0_H */ diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h deleted file mode 100644 index 4ebd9fd8a0a4..000000000000 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ /dev/null @@ -1,945 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef ATH9K_H -#define ATH9K_H - -#include -#include -#include -#include -#include - -#include "debug.h" -#include "common.h" -#include "mci.h" -#include "dfs.h" - -/* - * Header for the ath9k.ko driver core *only* -- hw code nor any other driver - * should rely on this file or its contents. - */ - -struct ath_node; - -/* Macro to expand scalars to 64-bit objects */ - -#define ito64(x) (sizeof(x) == 1) ? \ - (((unsigned long long int)(x)) & (0xff)) : \ - (sizeof(x) == 2) ? \ - (((unsigned long long int)(x)) & 0xffff) : \ - ((sizeof(x) == 4) ? \ - (((unsigned long long int)(x)) & 0xffffffff) : \ - (unsigned long long int)(x)) - -/* increment with wrap-around */ -#define INCR(_l, _sz) do { \ - (_l)++; \ - (_l) &= ((_sz) - 1); \ - } while (0) - -/* decrement with wrap-around */ -#define DECR(_l, _sz) do { \ - (_l)--; \ - (_l) &= ((_sz) - 1); \ - } while (0) - -#define TSF_TO_TU(_h,_l) \ - ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10)) - -#define ATH_TXQ_SETUP(sc, i) ((sc)->tx.txqsetup & (1<bf_stale = false; \ - (_bf)->bf_lastbf = NULL; \ - (_bf)->bf_next = NULL; \ - memset(&((_bf)->bf_state), 0, \ - sizeof(struct ath_buf_state)); \ - } while (0) - -/** - * enum buffer_type - Buffer type flags - * - * @BUF_AMPDU: This buffer is an ampdu, as part of an aggregate (during TX) - * @BUF_AGGR: Indicates whether the buffer can be aggregated - * (used in aggregation scheduling) - */ -enum buffer_type { - BUF_AMPDU = BIT(0), - BUF_AGGR = BIT(1), -}; - -#define bf_isampdu(bf) (bf->bf_state.bf_type & BUF_AMPDU) -#define bf_isaggr(bf) (bf->bf_state.bf_type & BUF_AGGR) - -#define ATH_TXSTATUS_RING_SIZE 512 - -#define DS2PHYS(_dd, _ds) \ - ((_dd)->dd_desc_paddr + ((caddr_t)(_ds) - (caddr_t)(_dd)->dd_desc)) -#define ATH_DESC_4KB_BOUND_CHECK(_daddr) ((((_daddr) & 0xFFF) > 0xF7F) ? 1 : 0) -#define ATH_DESC_4KB_BOUND_NUM_SKIPPED(_len) ((_len) / 4096) - -struct ath_descdma { - void *dd_desc; - dma_addr_t dd_desc_paddr; - u32 dd_desc_len; -}; - -int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, - struct list_head *head, const char *name, - int nbuf, int ndesc, bool is_tx); - -/***********/ -/* RX / TX */ -/***********/ - -#define ATH_RXBUF 512 -#define ATH_TXBUF 512 -#define ATH_TXBUF_RESERVE 5 -#define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE) -#define ATH_TXMAXTRY 13 - -#define TID_TO_WME_AC(_tid) \ - ((((_tid) == 0) || ((_tid) == 3)) ? IEEE80211_AC_BE : \ - (((_tid) == 1) || ((_tid) == 2)) ? IEEE80211_AC_BK : \ - (((_tid) == 4) || ((_tid) == 5)) ? IEEE80211_AC_VI : \ - IEEE80211_AC_VO) - -#define ATH_AGGR_DELIM_SZ 4 -#define ATH_AGGR_MINPLEN 256 /* in bytes, minimum packet length */ -/* number of delimiters for encryption padding */ -#define ATH_AGGR_ENCRYPTDELIM 10 -/* minimum h/w qdepth to be sustained to maximize aggregation */ -#define ATH_AGGR_MIN_QDEPTH 2 -#define ATH_AMPDU_SUBFRAME_DEFAULT 32 - -#define IEEE80211_SEQ_SEQ_SHIFT 4 -#define IEEE80211_SEQ_MAX 4096 -#define IEEE80211_WEP_IVLEN 3 -#define IEEE80211_WEP_KIDLEN 1 -#define IEEE80211_WEP_CRCLEN 4 -#define IEEE80211_MAX_MPDU_LEN (3840 + FCS_LEN + \ - (IEEE80211_WEP_IVLEN + \ - IEEE80211_WEP_KIDLEN + \ - IEEE80211_WEP_CRCLEN)) - -/* return whether a bit at index _n in bitmap _bm is set - * _sz is the size of the bitmap */ -#define ATH_BA_ISSET(_bm, _n) (((_n) < (WME_BA_BMP_SIZE)) && \ - ((_bm)[(_n) >> 5] & (1 << ((_n) & 31)))) - -/* return block-ack bitmap index given sequence and starting sequence */ -#define ATH_BA_INDEX(_st, _seq) (((_seq) - (_st)) & (IEEE80211_SEQ_MAX - 1)) - -/* return the seqno for _start + _offset */ -#define ATH_BA_INDEX2SEQ(_seq, _offset) (((_seq) + (_offset)) & (IEEE80211_SEQ_MAX - 1)) - -/* returns delimiter padding required given the packet length */ -#define ATH_AGGR_GET_NDELIM(_len) \ - (((_len) >= ATH_AGGR_MINPLEN) ? 0 : \ - DIV_ROUND_UP(ATH_AGGR_MINPLEN - (_len), ATH_AGGR_DELIM_SZ)) - -#define BAW_WITHIN(_start, _bawsz, _seqno) \ - ((((_seqno) - (_start)) & 4095) < (_bawsz)) - -#define ATH_AN_2_TID(_an, _tidno) (&(_an)->tid[(_tidno)]) - -#define IS_CCK_RATE(rate) ((rate >= 0x18) && (rate <= 0x1e)) - -#define ATH_TX_COMPLETE_POLL_INT 1000 - -enum ATH_AGGR_STATUS { - ATH_AGGR_DONE, - ATH_AGGR_BAW_CLOSED, - ATH_AGGR_LIMITED, -}; - -#define ATH_TXFIFO_DEPTH 8 -struct ath_txq { - int mac80211_qnum; /* mac80211 queue number, -1 means not mac80211 Q */ - u32 axq_qnum; /* ath9k hardware queue number */ - void *axq_link; - struct list_head axq_q; - spinlock_t axq_lock; - u32 axq_depth; - u32 axq_ampdu_depth; - bool stopped; - bool axq_tx_inprogress; - struct list_head axq_acq; - struct list_head txq_fifo[ATH_TXFIFO_DEPTH]; - u8 txq_headidx; - u8 txq_tailidx; - int pending_frames; - struct sk_buff_head complete_q; -}; - -struct ath_atx_ac { - struct ath_txq *txq; - int sched; - struct list_head list; - struct list_head tid_q; - bool clear_ps_filter; -}; - -struct ath_frame_info { - struct ath_buf *bf; - int framelen; - enum ath9k_key_type keytype; - u8 keyix; - u8 retries; - u8 rtscts_rate; -}; - -struct ath_buf_state { - u8 bf_type; - u8 bfs_paprd; - u8 ndelim; - u16 seqno; - unsigned long bfs_paprd_timestamp; -}; - -struct ath_buf { - struct list_head list; - struct ath_buf *bf_lastbf; /* last buf of this unit (a frame or - an aggregate) */ - struct ath_buf *bf_next; /* next subframe in the aggregate */ - struct sk_buff *bf_mpdu; /* enclosing frame structure */ - void *bf_desc; /* virtual addr of desc */ - dma_addr_t bf_daddr; /* physical addr of desc */ - dma_addr_t bf_buf_addr; /* physical addr of data buffer, for DMA */ - bool bf_stale; - struct ieee80211_tx_rate rates[4]; - struct ath_buf_state bf_state; -}; - -struct ath_atx_tid { - struct list_head list; - struct sk_buff_head buf_q; - struct ath_node *an; - struct ath_atx_ac *ac; - unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)]; - int bar_index; - u16 seq_start; - u16 seq_next; - u16 baw_size; - int tidno; - int baw_head; /* first un-acked tx buffer */ - int baw_tail; /* next unused tx buffer slot */ - bool sched; - bool paused; - bool active; -}; - -struct ath_node { - struct ath_softc *sc; - struct ieee80211_sta *sta; /* station struct we're part of */ - struct ieee80211_vif *vif; /* interface with which we're associated */ - struct ath_atx_tid tid[IEEE80211_NUM_TIDS]; - struct ath_atx_ac ac[IEEE80211_NUM_ACS]; - int ps_key; - - u16 maxampdu; - u8 mpdudensity; - - bool sleeping; - -#if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS) - struct dentry *node_stat; -#endif -}; - -struct ath_tx_control { - struct ath_txq *txq; - struct ath_node *an; - u8 paprd; - struct ieee80211_sta *sta; -}; - -#define ATH_TX_ERROR 0x01 - -/** - * @txq_map: Index is mac80211 queue number. This is - * not necessarily the same as the hardware queue number - * (axq_qnum). - */ -struct ath_tx { - u16 seq_no; - u32 txqsetup; - spinlock_t txbuflock; - struct list_head txbuf; - struct ath_txq txq[ATH9K_NUM_TX_QUEUES]; - struct ath_descdma txdma; - struct ath_txq *txq_map[IEEE80211_NUM_ACS]; - u32 txq_max_pending[IEEE80211_NUM_ACS]; - u16 max_aggr_framelen[IEEE80211_NUM_ACS][4][32]; -}; - -struct ath_rx_edma { - struct sk_buff_head rx_fifo; - u32 rx_fifo_hwsize; -}; - -struct ath_rx { - u8 defant; - u8 rxotherant; - bool discard_next; - u32 *rxlink; - u32 num_pkts; - unsigned int rxfilter; - struct list_head rxbuf; - struct ath_descdma rxdma; - struct ath_rx_edma rx_edma[ATH9K_RX_QUEUE_MAX]; - - struct ath_buf *buf_hold; - struct sk_buff *frag; - - u32 ampdu_ref; -}; - -int ath_startrecv(struct ath_softc *sc); -bool ath_stoprecv(struct ath_softc *sc); -u32 ath_calcrxfilter(struct ath_softc *sc); -int ath_rx_init(struct ath_softc *sc, int nbufs); -void ath_rx_cleanup(struct ath_softc *sc); -int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp); -struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype); -void ath_txq_lock(struct ath_softc *sc, struct ath_txq *txq); -void ath_txq_unlock(struct ath_softc *sc, struct ath_txq *txq); -void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq); -void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq); -bool ath_drain_all_txq(struct ath_softc *sc); -void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq); -void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an); -void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an); -void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq); -int ath_tx_init(struct ath_softc *sc, int nbufs); -int ath_txq_update(struct ath_softc *sc, int qnum, - struct ath9k_tx_queue_info *q); -void ath_update_max_aggr_framelen(struct ath_softc *sc, int queue, int txop); -int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, - struct ath_tx_control *txctl); -void ath_tx_tasklet(struct ath_softc *sc); -void ath_tx_edma_tasklet(struct ath_softc *sc); -int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, - u16 tid, u16 *ssn); -void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); -void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); - -void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an); -void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc, - struct ath_node *an); - -/********/ -/* VIFs */ -/********/ - -struct ath_vif { - int av_bslot; - bool primary_sta_vif; - __le64 tsf_adjust; /* TSF adjustment for staggered beacons */ - struct ath_buf *av_bcbuf; -}; - -/*******************/ -/* Beacon Handling */ -/*******************/ - -/* - * Regardless of the number of beacons we stagger, (i.e. regardless of the - * number of BSSIDs) if a given beacon does not go out even after waiting this - * number of beacon intervals, the game's up. - */ -#define BSTUCK_THRESH 9 -#define ATH_BCBUF 8 -#define ATH_DEFAULT_BINTVAL 100 /* TU */ -#define ATH_DEFAULT_BMISS_LIMIT 10 -#define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024) - -struct ath_beacon_config { - int beacon_interval; - u16 listen_interval; - u16 dtim_period; - u16 bmiss_timeout; - u8 dtim_count; - bool enable_beacon; - bool ibss_creator; -}; - -struct ath_beacon { - enum { - OK, /* no change needed */ - UPDATE, /* update pending */ - COMMIT /* beacon sent, commit change */ - } updateslot; /* slot time update fsm */ - - u32 beaconq; - u32 bmisscnt; - u32 bc_tstamp; - struct ieee80211_vif *bslot[ATH_BCBUF]; - int slottime; - int slotupdate; - struct ath9k_tx_queue_info beacon_qi; - struct ath_descdma bdma; - struct ath_txq *cabq; - struct list_head bbuf; - - bool tx_processed; - bool tx_last; -}; - -void ath9k_beacon_tasklet(unsigned long data); -bool ath9k_allow_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif); -void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif, - u32 changed); -void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif); -void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif); -void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif); -void ath9k_set_beacon(struct ath_softc *sc); - -/*******************/ -/* Link Monitoring */ -/*******************/ - -#define ATH_STA_SHORT_CALINTERVAL 1000 /* 1 second */ -#define ATH_AP_SHORT_CALINTERVAL 100 /* 100 ms */ -#define ATH_ANI_POLLINTERVAL_OLD 100 /* 100 ms */ -#define ATH_ANI_POLLINTERVAL_NEW 1000 /* 1000 ms */ -#define ATH_LONG_CALINTERVAL_INT 1000 /* 1000 ms */ -#define ATH_LONG_CALINTERVAL 30000 /* 30 seconds */ -#define ATH_RESTART_CALINTERVAL 1200000 /* 20 minutes */ -#define ATH_ANI_MAX_SKIP_COUNT 10 - -#define ATH_PAPRD_TIMEOUT 100 /* msecs */ -#define ATH_PLL_WORK_INTERVAL 100 - -void ath_tx_complete_poll_work(struct work_struct *work); -void ath_reset_work(struct work_struct *work); -void ath_hw_check(struct work_struct *work); -void ath_hw_pll_work(struct work_struct *work); -void ath_rx_poll(unsigned long data); -void ath_start_rx_poll(struct ath_softc *sc, u8 nbeacon); -void ath_paprd_calibrate(struct work_struct *work); -void ath_ani_calibrate(unsigned long data); -void ath_start_ani(struct ath_softc *sc); -void ath_stop_ani(struct ath_softc *sc); -void ath_check_ani(struct ath_softc *sc); -int ath_update_survey_stats(struct ath_softc *sc); -void ath_update_survey_nf(struct ath_softc *sc, int channel); -void ath9k_queue_reset(struct ath_softc *sc, enum ath_reset_type type); - -/**********/ -/* BTCOEX */ -/**********/ - -#define ATH_DUMP_BTCOEX(_s, _val) \ - do { \ - len += snprintf(buf + len, size - len, \ - "%20s : %10d\n", _s, (_val)); \ - } while (0) - -enum bt_op_flags { - BT_OP_PRIORITY_DETECTED, - BT_OP_SCAN, -}; - -struct ath_btcoex { - bool hw_timer_enabled; - spinlock_t btcoex_lock; - struct timer_list period_timer; /* Timer for BT period */ - u32 bt_priority_cnt; - unsigned long bt_priority_time; - unsigned long op_flags; - int bt_stomp_type; /* Types of BT stomping */ - u32 btcoex_no_stomp; /* in usec */ - u32 btcoex_period; /* in msec */ - u32 btscan_no_stomp; /* in usec */ - u32 duty_cycle; - u32 bt_wait_time; - int rssi_count; - struct ath_gen_timer *no_stomp_timer; /* Timer for no BT stomping */ - struct ath_mci_profile mci; - u8 stomp_audio; -}; - -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT -int ath9k_init_btcoex(struct ath_softc *sc); -void ath9k_deinit_btcoex(struct ath_softc *sc); -void ath9k_start_btcoex(struct ath_softc *sc); -void ath9k_stop_btcoex(struct ath_softc *sc); -void ath9k_btcoex_timer_resume(struct ath_softc *sc); -void ath9k_btcoex_timer_pause(struct ath_softc *sc); -void ath9k_btcoex_handle_interrupt(struct ath_softc *sc, u32 status); -u16 ath9k_btcoex_aggr_limit(struct ath_softc *sc, u32 max_4ms_framelen); -void ath9k_btcoex_stop_gen_timer(struct ath_softc *sc); -int ath9k_dump_btcoex(struct ath_softc *sc, u8 *buf, u32 size); -#else -static inline int ath9k_init_btcoex(struct ath_softc *sc) -{ - return 0; -} -static inline void ath9k_deinit_btcoex(struct ath_softc *sc) -{ -} -static inline void ath9k_start_btcoex(struct ath_softc *sc) -{ -} -static inline void ath9k_stop_btcoex(struct ath_softc *sc) -{ -} -static inline void ath9k_btcoex_handle_interrupt(struct ath_softc *sc, - u32 status) -{ -} -static inline u16 ath9k_btcoex_aggr_limit(struct ath_softc *sc, - u32 max_4ms_framelen) -{ - return 0; -} -static inline void ath9k_btcoex_stop_gen_timer(struct ath_softc *sc) -{ -} -static inline int ath9k_dump_btcoex(struct ath_softc *sc, u8 *buf, u32 size) -{ - return 0; -} -#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ - -struct ath9k_wow_pattern { - u8 pattern_bytes[MAX_PATTERN_SIZE]; - u8 mask_bytes[MAX_PATTERN_SIZE]; - u32 pattern_len; -}; - -/********************/ -/* LED Control */ -/********************/ - -#define ATH_LED_PIN_DEF 1 -#define ATH_LED_PIN_9287 8 -#define ATH_LED_PIN_9300 10 -#define ATH_LED_PIN_9485 6 -#define ATH_LED_PIN_9462 4 - -#ifdef CONFIG_MAC80211_LEDS -void ath_init_leds(struct ath_softc *sc); -void ath_deinit_leds(struct ath_softc *sc); -void ath_fill_led_pin(struct ath_softc *sc); -#else -static inline void ath_init_leds(struct ath_softc *sc) -{ -} - -static inline void ath_deinit_leds(struct ath_softc *sc) -{ -} -static inline void ath_fill_led_pin(struct ath_softc *sc) -{ -} -#endif - -/*******************************/ -/* Antenna diversity/combining */ -/*******************************/ - -#define ATH_ANT_RX_CURRENT_SHIFT 4 -#define ATH_ANT_RX_MAIN_SHIFT 2 -#define ATH_ANT_RX_MASK 0x3 - -#define ATH_ANT_DIV_COMB_SHORT_SCAN_INTR 50 -#define ATH_ANT_DIV_COMB_SHORT_SCAN_PKTCOUNT 0x100 -#define ATH_ANT_DIV_COMB_MAX_PKTCOUNT 0x200 -#define ATH_ANT_DIV_COMB_INIT_COUNT 95 -#define ATH_ANT_DIV_COMB_MAX_COUNT 100 -#define ATH_ANT_DIV_COMB_ALT_ANT_RATIO 30 -#define ATH_ANT_DIV_COMB_ALT_ANT_RATIO2 20 - -#define ATH_ANT_DIV_COMB_LNA1_LNA2_SWITCH_DELTA -1 -#define ATH_ANT_DIV_COMB_LNA1_DELTA_HI -4 -#define ATH_ANT_DIV_COMB_LNA1_DELTA_MID -2 -#define ATH_ANT_DIV_COMB_LNA1_DELTA_LOW 2 - -enum ath9k_ant_div_comb_lna_conf { - ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2, - ATH_ANT_DIV_COMB_LNA2, - ATH_ANT_DIV_COMB_LNA1, - ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2, -}; - -struct ath_ant_comb { - u16 count; - u16 total_pkt_count; - bool scan; - bool scan_not_start; - int main_total_rssi; - int alt_total_rssi; - int alt_recv_cnt; - int main_recv_cnt; - int rssi_lna1; - int rssi_lna2; - int rssi_add; - int rssi_sub; - int rssi_first; - int rssi_second; - int rssi_third; - bool alt_good; - int quick_scan_cnt; - int main_conf; - enum ath9k_ant_div_comb_lna_conf first_quick_scan_conf; - enum ath9k_ant_div_comb_lna_conf second_quick_scan_conf; - bool first_ratio; - bool second_ratio; - unsigned long scan_start_time; -}; - -void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs); -void ath_ant_comb_update(struct ath_softc *sc); - -/********************/ -/* Main driver core */ -/********************/ - -/* - * Default cache line size, in bytes. - * Used when PCI device not fully initialized by bootrom/BIOS -*/ -#define DEFAULT_CACHELINE 32 -#define ATH_REGCLASSIDS_MAX 10 -#define ATH_CABQ_READY_TIME 80 /* % of beacon interval */ -#define ATH_MAX_SW_RETRIES 30 -#define ATH_CHAN_MAX 255 - -#define ATH_TXPOWER_MAX 100 /* .5 dBm units */ -#define ATH_RATE_DUMMY_MARKER 0 - -enum sc_op_flags { - SC_OP_INVALID, - SC_OP_BEACONS, - SC_OP_ANI_RUN, - SC_OP_PRIM_STA_VIF, - SC_OP_HW_RESET, -}; - -/* Powersave flags */ -#define PS_WAIT_FOR_BEACON BIT(0) -#define PS_WAIT_FOR_CAB BIT(1) -#define PS_WAIT_FOR_PSPOLL_DATA BIT(2) -#define PS_WAIT_FOR_TX_ACK BIT(3) -#define PS_BEACON_SYNC BIT(4) -#define PS_WAIT_FOR_ANI BIT(5) - -struct ath_rate_table; - -struct ath9k_vif_iter_data { - u8 hw_macaddr[ETH_ALEN]; /* address of the first vif */ - u8 mask[ETH_ALEN]; /* bssid mask */ - bool has_hw_macaddr; - - int naps; /* number of AP vifs */ - int nmeshes; /* number of mesh vifs */ - int nstations; /* number of station vifs */ - int nwds; /* number of WDS vifs */ - int nadhocs; /* number of adhoc vifs */ -}; - -/* enum spectral_mode: - * - * @SPECTRAL_DISABLED: spectral mode is disabled - * @SPECTRAL_BACKGROUND: hardware sends samples when it is not busy with - * something else. - * @SPECTRAL_MANUAL: spectral scan is enabled, triggering for samples - * is performed manually. - * @SPECTRAL_CHANSCAN: Like manual, but also triggered when changing channels - * during a channel scan. - */ -enum spectral_mode { - SPECTRAL_DISABLED = 0, - SPECTRAL_BACKGROUND, - SPECTRAL_MANUAL, - SPECTRAL_CHANSCAN, -}; - -struct ath_softc { - struct ieee80211_hw *hw; - struct device *dev; - - struct survey_info *cur_survey; - struct survey_info survey[ATH9K_NUM_CHANNELS]; - - struct tasklet_struct intr_tq; - struct tasklet_struct bcon_tasklet; - struct ath_hw *sc_ah; - void __iomem *mem; - int irq; - spinlock_t sc_serial_rw; - spinlock_t sc_pm_lock; - spinlock_t sc_pcu_lock; - struct mutex mutex; - struct work_struct paprd_work; - struct work_struct hw_check_work; - struct work_struct hw_reset_work; - struct completion paprd_complete; - - unsigned int hw_busy_count; - unsigned long sc_flags; - - u32 intrstatus; - u16 ps_flags; /* PS_* */ - u16 curtxpow; - bool ps_enabled; - bool ps_idle; - short nbcnvifs; - short nvifs; - unsigned long ps_usecount; - - struct ath_config config; - struct ath_rx rx; - struct ath_tx tx; - struct ath_beacon beacon; - struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; - -#ifdef CONFIG_MAC80211_LEDS - bool led_registered; - char led_name[32]; - struct led_classdev led_cdev; -#endif - - struct ath9k_hw_cal_data caldata; - int last_rssi; - -#ifdef CONFIG_ATH9K_DEBUGFS - struct ath9k_debug debug; -#endif - struct ath_beacon_config cur_beacon_conf; - struct delayed_work tx_complete_work; - struct delayed_work hw_pll_work; - struct timer_list rx_poll_timer; - -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT - struct ath_btcoex btcoex; - struct ath_mci_coex mci_coex; - struct work_struct mci_work; -#endif - - struct ath_descdma txsdma; - - struct ath_ant_comb ant_comb; - u8 ant_tx, ant_rx; - struct dfs_pattern_detector *dfs_detector; - u32 wow_enabled; - /* relay(fs) channel for spectral scan */ - struct rchan *rfs_chan_spec_scan; - enum spectral_mode spectral_mode; - struct ath_spec_scan spec_config; - int scanning; - -#ifdef CONFIG_PM_SLEEP - atomic_t wow_got_bmiss_intr; - atomic_t wow_sleep_proc_intr; /* in the middle of WoW sleep ? */ - u32 wow_intr_before_sleep; -#endif -}; - -#define SPECTRAL_SCAN_BITMASK 0x10 -/* Radar info packet format, used for DFS and spectral formats. */ -struct ath_radar_info { - u8 pulse_length_pri; - u8 pulse_length_ext; - u8 pulse_bw_info; -} __packed; - -/* The HT20 spectral data has 4 bytes of additional information at it's end. - * - * [7:0]: all bins {max_magnitude[1:0], bitmap_weight[5:0]} - * [7:0]: all bins max_magnitude[9:2] - * [7:0]: all bins {max_index[5:0], max_magnitude[11:10]} - * [3:0]: max_exp (shift amount to size max bin to 8-bit unsigned) - */ -struct ath_ht20_mag_info { - u8 all_bins[3]; - u8 max_exp; -} __packed; - -#define SPECTRAL_HT20_NUM_BINS 56 - -/* WARNING: don't actually use this struct! MAC may vary the amount of - * data by -1/+2. This struct is for reference only. - */ -struct ath_ht20_fft_packet { - u8 data[SPECTRAL_HT20_NUM_BINS]; - struct ath_ht20_mag_info mag_info; - struct ath_radar_info radar_info; -} __packed; - -#define SPECTRAL_HT20_TOTAL_DATA_LEN (sizeof(struct ath_ht20_fft_packet)) - -/* Dynamic 20/40 mode: - * - * [7:0]: lower bins {max_magnitude[1:0], bitmap_weight[5:0]} - * [7:0]: lower bins max_magnitude[9:2] - * [7:0]: lower bins {max_index[5:0], max_magnitude[11:10]} - * [7:0]: upper bins {max_magnitude[1:0], bitmap_weight[5:0]} - * [7:0]: upper bins max_magnitude[9:2] - * [7:0]: upper bins {max_index[5:0], max_magnitude[11:10]} - * [3:0]: max_exp (shift amount to size max bin to 8-bit unsigned) - */ -struct ath_ht20_40_mag_info { - u8 lower_bins[3]; - u8 upper_bins[3]; - u8 max_exp; -} __packed; - -#define SPECTRAL_HT20_40_NUM_BINS 128 - -/* WARNING: don't actually use this struct! MAC may vary the amount of - * data. This struct is for reference only. - */ -struct ath_ht20_40_fft_packet { - u8 data[SPECTRAL_HT20_40_NUM_BINS]; - struct ath_ht20_40_mag_info mag_info; - struct ath_radar_info radar_info; -} __packed; - - -#define SPECTRAL_HT20_40_TOTAL_DATA_LEN (sizeof(struct ath_ht20_40_fft_packet)) - -/* grabs the max magnitude from the all/upper/lower bins */ -static inline u16 spectral_max_magnitude(u8 *bins) -{ - return (bins[0] & 0xc0) >> 6 | - (bins[1] & 0xff) << 2 | - (bins[2] & 0x03) << 10; -} - -/* return the max magnitude from the all/upper/lower bins */ -static inline u8 spectral_max_index(u8 *bins) -{ - s8 m = (bins[2] & 0xfc) >> 2; - - /* TODO: this still doesn't always report the right values ... */ - if (m > 32) - m |= 0xe0; - else - m &= ~0xe0; - - return m + 29; -} - -/* return the bitmap weight from the all/upper/lower bins */ -static inline u8 spectral_bitmap_weight(u8 *bins) -{ - return bins[0] & 0x3f; -} - -/* FFT sample format given to userspace via debugfs. - * - * Please keep the type/length at the front position and change - * other fields after adding another sample type - * - * TODO: this might need rework when switching to nl80211-based - * interface. - */ -enum ath_fft_sample_type { - ATH_FFT_SAMPLE_HT20 = 1, -}; - -struct fft_sample_tlv { - u8 type; /* see ath_fft_sample */ - __be16 length; - /* type dependent data follows */ -} __packed; - -struct fft_sample_ht20 { - struct fft_sample_tlv tlv; - - u8 max_exp; - - __be16 freq; - s8 rssi; - s8 noise; - - __be16 max_magnitude; - u8 max_index; - u8 bitmap_weight; - - __be64 tsf; - - u8 data[SPECTRAL_HT20_NUM_BINS]; -} __packed; - -void ath9k_tasklet(unsigned long data); -int ath_cabq_update(struct ath_softc *); - -static inline void ath_read_cachesize(struct ath_common *common, int *csz) -{ - common->bus_ops->read_cachesize(common, csz); -} - -extern struct ieee80211_ops ath9k_ops; -extern int ath9k_modparam_nohwcrypt; -extern int led_blink; -extern bool is_ath9k_unloaded; - -u8 ath9k_parse_mpdudensity(u8 mpdudensity); -irqreturn_t ath_isr(int irq, void *dev); -int ath9k_init_device(u16 devid, struct ath_softc *sc, - const struct ath_bus_ops *bus_ops); -void ath9k_deinit_device(struct ath_softc *sc); -void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw); -void ath9k_reload_chainmask_settings(struct ath_softc *sc); - -bool ath9k_uses_beacons(int type); -void ath9k_spectral_scan_trigger(struct ieee80211_hw *hw); -int ath9k_spectral_scan_config(struct ieee80211_hw *hw, - enum spectral_mode spectral_mode); - - -#ifdef CONFIG_ATH9K_PCI -int ath_pci_init(void); -void ath_pci_exit(void); -#else -static inline int ath_pci_init(void) { return 0; }; -static inline void ath_pci_exit(void) {}; -#endif - -#ifdef CONFIG_ATH9K_AHB -int ath_ahb_init(void); -void ath_ahb_exit(void); -#else -static inline int ath_ahb_init(void) { return 0; }; -static inline void ath_ahb_exit(void) {}; -#endif - -void ath9k_ps_wakeup(struct ath_softc *sc); -void ath9k_ps_restore(struct ath_softc *sc); - -u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate); - -void ath_start_rfkill_poll(struct ath_softc *sc); -extern void ath9k_rfkill_poll_state(struct ieee80211_hw *hw); -void ath9k_calculate_iter_data(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ath9k_vif_iter_data *iter_data); - -#endif /* ATH9K_H */ diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c deleted file mode 100644 index 2ff570f7f8ff..000000000000 --- a/drivers/net/wireless/ath/ath9k/beacon.c +++ /dev/null @@ -1,781 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "ath9k.h" - -#define FUDGE 2 - -static void ath9k_reset_beacon_status(struct ath_softc *sc) -{ - sc->beacon.tx_processed = false; - sc->beacon.tx_last = false; -} - -/* - * This function will modify certain transmit queue properties depending on - * the operating mode of the station (AP or AdHoc). Parameters are AIFS - * settings and channel width min/max -*/ -static void ath9k_beaconq_config(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_tx_queue_info qi, qi_be; - struct ath_txq *txq; - - ath9k_hw_get_txq_props(ah, sc->beacon.beaconq, &qi); - - if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) { - /* Always burst out beacon and CAB traffic. */ - qi.tqi_aifs = 1; - qi.tqi_cwmin = 0; - qi.tqi_cwmax = 0; - } else { - /* Adhoc mode; important thing is to use 2x cwmin. */ - txq = sc->tx.txq_map[IEEE80211_AC_BE]; - ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be); - qi.tqi_aifs = qi_be.tqi_aifs; - if (ah->slottime == ATH9K_SLOT_TIME_20) - qi.tqi_cwmin = 2*qi_be.tqi_cwmin; - else - qi.tqi_cwmin = 4*qi_be.tqi_cwmin; - qi.tqi_cwmax = qi_be.tqi_cwmax; - } - - if (!ath9k_hw_set_txq_props(ah, sc->beacon.beaconq, &qi)) { - ath_err(common, "Unable to update h/w beacon queue parameters\n"); - } else { - ath9k_hw_resettxqueue(ah, sc->beacon.beaconq); - } -} - -/* - * Associates the beacon frame buffer with a transmit descriptor. Will set - * up rate codes, and channel flags. Beacons are always sent out at the - * lowest rate, and are not retried. -*/ -static void ath9k_beacon_setup(struct ath_softc *sc, struct ieee80211_vif *vif, - struct ath_buf *bf, int rateidx) -{ - struct sk_buff *skb = bf->bf_mpdu; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath_tx_info info; - struct ieee80211_supported_band *sband; - u8 chainmask = ah->txchainmask; - u8 rate = 0; - - sband = &sc->sbands[common->hw->conf.chandef.chan->band]; - rate = sband->bitrates[rateidx].hw_value; - if (vif->bss_conf.use_short_preamble) - rate |= sband->bitrates[rateidx].hw_value_short; - - memset(&info, 0, sizeof(info)); - info.pkt_len = skb->len + FCS_LEN; - info.type = ATH9K_PKT_TYPE_BEACON; - info.txpower = MAX_RATE_POWER; - info.keyix = ATH9K_TXKEYIX_INVALID; - info.keytype = ATH9K_KEY_TYPE_CLEAR; - info.flags = ATH9K_TXDESC_NOACK | ATH9K_TXDESC_CLRDMASK; - - info.buf_addr[0] = bf->bf_buf_addr; - info.buf_len[0] = roundup(skb->len, 4); - - info.is_first = true; - info.is_last = true; - - info.qcu = sc->beacon.beaconq; - - info.rates[0].Tries = 1; - info.rates[0].Rate = rate; - info.rates[0].ChSel = ath_txchainmask_reduction(sc, chainmask, rate); - - ath9k_hw_set_txdesc(ah, bf->bf_desc, &info); -} - -static void ath9k_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) -{ - struct ath_softc *sc = hw->priv; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_tx_control txctl; - - memset(&txctl, 0, sizeof(struct ath_tx_control)); - txctl.txq = sc->beacon.cabq; - - ath_dbg(common, XMIT, "transmitting CABQ packet, skb: %p\n", skb); - - if (ath_tx_start(hw, skb, &txctl) != 0) { - ath_dbg(common, XMIT, "CABQ TX failed\n"); - ieee80211_free_txskb(hw, skb); - } -} - -static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ath_softc *sc = hw->priv; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_buf *bf; - struct ath_vif *avp = (void *)vif->drv_priv; - struct sk_buff *skb; - struct ath_txq *cabq = sc->beacon.cabq; - struct ieee80211_tx_info *info; - struct ieee80211_mgmt *mgmt_hdr; - int cabq_depth; - - if (avp->av_bcbuf == NULL) - return NULL; - - bf = avp->av_bcbuf; - skb = bf->bf_mpdu; - if (skb) { - dma_unmap_single(sc->dev, bf->bf_buf_addr, - skb->len, DMA_TO_DEVICE); - dev_kfree_skb_any(skb); - bf->bf_buf_addr = 0; - bf->bf_mpdu = NULL; - } - - skb = ieee80211_beacon_get(hw, vif); - if (skb == NULL) - return NULL; - - bf->bf_mpdu = skb; - - mgmt_hdr = (struct ieee80211_mgmt *)skb->data; - mgmt_hdr->u.beacon.timestamp = avp->tsf_adjust; - - info = IEEE80211_SKB_CB(skb); - if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { - /* - * TODO: make sure the seq# gets assigned properly (vs. other - * TX frames) - */ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - sc->tx.seq_no += 0x10; - hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); - hdr->seq_ctrl |= cpu_to_le16(sc->tx.seq_no); - } - - bf->bf_buf_addr = dma_map_single(sc->dev, skb->data, - skb->len, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) { - dev_kfree_skb_any(skb); - bf->bf_mpdu = NULL; - bf->bf_buf_addr = 0; - ath_err(common, "dma_mapping_error on beaconing\n"); - return NULL; - } - - skb = ieee80211_get_buffered_bc(hw, vif); - - /* - * if the CABQ traffic from previous DTIM is pending and the current - * beacon is also a DTIM. - * 1) if there is only one vif let the cab traffic continue. - * 2) if there are more than one vif and we are using staggered - * beacons, then drain the cabq by dropping all the frames in - * the cabq so that the current vifs cab traffic can be scheduled. - */ - spin_lock_bh(&cabq->axq_lock); - cabq_depth = cabq->axq_depth; - spin_unlock_bh(&cabq->axq_lock); - - if (skb && cabq_depth) { - if (sc->nvifs > 1) { - ath_dbg(common, BEACON, - "Flushing previous cabq traffic\n"); - ath_draintxq(sc, cabq); - } - } - - ath9k_beacon_setup(sc, vif, bf, info->control.rates[0].idx); - - while (skb) { - ath9k_tx_cabq(hw, skb); - skb = ieee80211_get_buffered_bc(hw, vif); - } - - return bf; -} - -void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_vif *avp = (void *)vif->drv_priv; - int slot; - - avp->av_bcbuf = list_first_entry(&sc->beacon.bbuf, struct ath_buf, list); - list_del(&avp->av_bcbuf->list); - - for (slot = 0; slot < ATH_BCBUF; slot++) { - if (sc->beacon.bslot[slot] == NULL) { - avp->av_bslot = slot; - break; - } - } - - sc->beacon.bslot[avp->av_bslot] = vif; - sc->nbcnvifs++; - - ath_dbg(common, CONFIG, "Added interface at beacon slot: %d\n", - avp->av_bslot); -} - -void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_vif *avp = (void *)vif->drv_priv; - struct ath_buf *bf = avp->av_bcbuf; - - ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n", - avp->av_bslot); - - tasklet_disable(&sc->bcon_tasklet); - - if (bf && bf->bf_mpdu) { - struct sk_buff *skb = bf->bf_mpdu; - dma_unmap_single(sc->dev, bf->bf_buf_addr, - skb->len, DMA_TO_DEVICE); - dev_kfree_skb_any(skb); - bf->bf_mpdu = NULL; - bf->bf_buf_addr = 0; - } - - avp->av_bcbuf = NULL; - sc->beacon.bslot[avp->av_bslot] = NULL; - sc->nbcnvifs--; - list_add_tail(&bf->list, &sc->beacon.bbuf); - - tasklet_enable(&sc->bcon_tasklet); -} - -static int ath9k_beacon_choose_slot(struct ath_softc *sc) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_beacon_config *cur_conf = &sc->cur_beacon_conf; - u16 intval; - u32 tsftu; - u64 tsf; - int slot; - - if (sc->sc_ah->opmode != NL80211_IFTYPE_AP) { - ath_dbg(common, BEACON, "slot 0, tsf: %llu\n", - ath9k_hw_gettsf64(sc->sc_ah)); - return 0; - } - - intval = cur_conf->beacon_interval ? : ATH_DEFAULT_BINTVAL; - tsf = ath9k_hw_gettsf64(sc->sc_ah); - tsf += TU_TO_USEC(sc->sc_ah->config.sw_beacon_response_time); - tsftu = TSF_TO_TU((tsf * ATH_BCBUF) >>32, tsf * ATH_BCBUF); - slot = (tsftu % (intval * ATH_BCBUF)) / intval; - - ath_dbg(common, BEACON, "slot: %d tsf: %llu tsftu: %u\n", - slot, tsf, tsftu / ATH_BCBUF); - - return slot; -} - -void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_beacon_config *cur_conf = &sc->cur_beacon_conf; - struct ath_vif *avp = (void *)vif->drv_priv; - u64 tsfadjust; - - if (avp->av_bslot == 0) - return; - - tsfadjust = cur_conf->beacon_interval * avp->av_bslot / ATH_BCBUF; - avp->tsf_adjust = cpu_to_le64(TU_TO_USEC(tsfadjust)); - - ath_dbg(common, CONFIG, "tsfadjust is: %llu for bslot: %d\n", - (unsigned long long)tsfadjust, avp->av_bslot); -} - -void ath9k_beacon_tasklet(unsigned long data) -{ - struct ath_softc *sc = (struct ath_softc *)data; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath_buf *bf = NULL; - struct ieee80211_vif *vif; - bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA); - int slot; - - if (test_bit(SC_OP_HW_RESET, &sc->sc_flags)) { - ath_dbg(common, RESET, - "reset work is pending, skip beaconing now\n"); - return; - } - - /* - * Check if the previous beacon has gone out. If - * not don't try to post another, skip this period - * and wait for the next. Missed beacons indicate - * a problem and should not occur. If we miss too - * many consecutive beacons reset the device. - */ - if (ath9k_hw_numtxpending(ah, sc->beacon.beaconq) != 0) { - sc->beacon.bmisscnt++; - - if (!ath9k_hw_check_alive(ah)) - ieee80211_queue_work(sc->hw, &sc->hw_check_work); - - if (sc->beacon.bmisscnt < BSTUCK_THRESH * sc->nbcnvifs) { - ath_dbg(common, BSTUCK, - "missed %u consecutive beacons\n", - sc->beacon.bmisscnt); - ath9k_hw_stop_dma_queue(ah, sc->beacon.beaconq); - if (sc->beacon.bmisscnt > 3) - ath9k_hw_bstuck_nfcal(ah); - } else if (sc->beacon.bmisscnt >= BSTUCK_THRESH) { - ath_dbg(common, BSTUCK, "beacon is officially stuck\n"); - sc->beacon.bmisscnt = 0; - ath9k_queue_reset(sc, RESET_TYPE_BEACON_STUCK); - } - - return; - } - - slot = ath9k_beacon_choose_slot(sc); - vif = sc->beacon.bslot[slot]; - - if (!vif || !vif->bss_conf.enable_beacon) - return; - - bf = ath9k_beacon_generate(sc->hw, vif); - - if (sc->beacon.bmisscnt != 0) { - ath_dbg(common, BSTUCK, "resume beacon xmit after %u misses\n", - sc->beacon.bmisscnt); - sc->beacon.bmisscnt = 0; - } - - /* - * Handle slot time change when a non-ERP station joins/leaves - * an 11g network. The 802.11 layer notifies us via callback, - * we mark updateslot, then wait one beacon before effecting - * the change. This gives associated stations at least one - * beacon interval to note the state change. - * - * NB: The slot time change state machine is clocked according - * to whether we are bursting or staggering beacons. We - * recognize the request to update and record the current - * slot then don't transition until that slot is reached - * again. If we miss a beacon for that slot then we'll be - * slow to transition but we'll be sure at least one beacon - * interval has passed. When bursting slot is always left - * set to ATH_BCBUF so this check is a noop. - */ - if (sc->beacon.updateslot == UPDATE) { - sc->beacon.updateslot = COMMIT; - sc->beacon.slotupdate = slot; - } else if (sc->beacon.updateslot == COMMIT && - sc->beacon.slotupdate == slot) { - ah->slottime = sc->beacon.slottime; - ath9k_hw_init_global_settings(ah); - sc->beacon.updateslot = OK; - } - - if (bf) { - ath9k_reset_beacon_status(sc); - - ath_dbg(common, BEACON, - "Transmitting beacon for slot: %d\n", slot); - - /* NB: cabq traffic should already be queued and primed */ - ath9k_hw_puttxbuf(ah, sc->beacon.beaconq, bf->bf_daddr); - - if (!edma) - ath9k_hw_txstart(ah, sc->beacon.beaconq); - } -} - -/* - * Both nexttbtt and intval have to be in usecs. - */ -static void ath9k_beacon_init(struct ath_softc *sc, u32 nexttbtt, - u32 intval, bool reset_tsf) -{ - struct ath_hw *ah = sc->sc_ah; - - ath9k_hw_disable_interrupts(ah); - if (reset_tsf) - ath9k_hw_reset_tsf(ah); - ath9k_beaconq_config(sc); - ath9k_hw_beaconinit(ah, nexttbtt, intval); - sc->beacon.bmisscnt = 0; - ath9k_hw_set_interrupts(ah); - ath9k_hw_enable_interrupts(ah); -} - -/* - * For multi-bss ap support beacons are either staggered evenly over N slots or - * burst together. For the former arrange for the SWBA to be delivered for each - * slot. Slots that are not occupied will generate nothing. - */ -static void ath9k_beacon_config_ap(struct ath_softc *sc, - struct ath_beacon_config *conf) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - u32 nexttbtt, intval; - - /* NB: the beacon interval is kept internally in TU's */ - intval = TU_TO_USEC(conf->beacon_interval); - intval /= ATH_BCBUF; - nexttbtt = intval; - - if (conf->enable_beacon) - ah->imask |= ATH9K_INT_SWBA; - else - ah->imask &= ~ATH9K_INT_SWBA; - - ath_dbg(common, BEACON, - "AP (%s) nexttbtt: %u intval: %u conf_intval: %u\n", - (conf->enable_beacon) ? "Enable" : "Disable", - nexttbtt, intval, conf->beacon_interval); - - ath9k_beacon_init(sc, nexttbtt, intval, true); -} - -/* - * This sets up the beacon timers according to the timestamp of the last - * received beacon and the current TSF, configures PCF and DTIM - * handling, programs the sleep registers so the hardware will wakeup in - * time to receive beacons, and configures the beacon miss handling so - * we'll receive a BMISS interrupt when we stop seeing beacons from the AP - * we've associated with. - */ -static void ath9k_beacon_config_sta(struct ath_softc *sc, - struct ath_beacon_config *conf) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_beacon_state bs; - int dtimperiod, dtimcount, sleepduration; - int cfpperiod, cfpcount; - u32 nexttbtt = 0, intval, tsftu; - u64 tsf; - int num_beacons, offset, dtim_dec_count, cfp_dec_count; - - /* No need to configure beacon if we are not associated */ - if (!test_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags)) { - ath_dbg(common, BEACON, - "STA is not yet associated..skipping beacon config\n"); - return; - } - - memset(&bs, 0, sizeof(bs)); - intval = conf->beacon_interval; - - /* - * Setup dtim and cfp parameters according to - * last beacon we received (which may be none). - */ - dtimperiod = conf->dtim_period; - dtimcount = conf->dtim_count; - if (dtimcount >= dtimperiod) /* NB: sanity check */ - dtimcount = 0; - cfpperiod = 1; /* NB: no PCF support yet */ - cfpcount = 0; - - sleepduration = conf->listen_interval * intval; - - /* - * Pull nexttbtt forward to reflect the current - * TSF and calculate dtim+cfp state for the result. - */ - tsf = ath9k_hw_gettsf64(ah); - tsftu = TSF_TO_TU(tsf>>32, tsf) + FUDGE; - - num_beacons = tsftu / intval + 1; - offset = tsftu % intval; - nexttbtt = tsftu - offset; - if (offset) - nexttbtt += intval; - - /* DTIM Beacon every dtimperiod Beacon */ - dtim_dec_count = num_beacons % dtimperiod; - /* CFP every cfpperiod DTIM Beacon */ - cfp_dec_count = (num_beacons / dtimperiod) % cfpperiod; - if (dtim_dec_count) - cfp_dec_count++; - - dtimcount -= dtim_dec_count; - if (dtimcount < 0) - dtimcount += dtimperiod; - - cfpcount -= cfp_dec_count; - if (cfpcount < 0) - cfpcount += cfpperiod; - - bs.bs_intval = intval; - bs.bs_nexttbtt = nexttbtt; - bs.bs_dtimperiod = dtimperiod*intval; - bs.bs_nextdtim = bs.bs_nexttbtt + dtimcount*intval; - bs.bs_cfpperiod = cfpperiod*bs.bs_dtimperiod; - bs.bs_cfpnext = bs.bs_nextdtim + cfpcount*bs.bs_dtimperiod; - bs.bs_cfpmaxduration = 0; - - /* - * Calculate the number of consecutive beacons to miss* before taking - * a BMISS interrupt. The configuration is specified in TU so we only - * need calculate based on the beacon interval. Note that we clamp the - * result to at most 15 beacons. - */ - if (sleepduration > intval) { - bs.bs_bmissthreshold = conf->listen_interval * - ATH_DEFAULT_BMISS_LIMIT / 2; - } else { - bs.bs_bmissthreshold = DIV_ROUND_UP(conf->bmiss_timeout, intval); - if (bs.bs_bmissthreshold > 15) - bs.bs_bmissthreshold = 15; - else if (bs.bs_bmissthreshold <= 0) - bs.bs_bmissthreshold = 1; - } - - /* - * Calculate sleep duration. The configuration is given in ms. - * We ensure a multiple of the beacon period is used. Also, if the sleep - * duration is greater than the DTIM period then it makes senses - * to make it a multiple of that. - * - * XXX fixed at 100ms - */ - - bs.bs_sleepduration = roundup(IEEE80211_MS_TO_TU(100), sleepduration); - if (bs.bs_sleepduration > bs.bs_dtimperiod) - bs.bs_sleepduration = bs.bs_dtimperiod; - - /* TSF out of range threshold fixed at 1 second */ - bs.bs_tsfoor_threshold = ATH9K_TSFOOR_THRESHOLD; - - ath_dbg(common, BEACON, "tsf: %llu tsftu: %u\n", tsf, tsftu); - ath_dbg(common, BEACON, - "bmiss: %u sleep: %u cfp-period: %u maxdur: %u next: %u\n", - bs.bs_bmissthreshold, bs.bs_sleepduration, - bs.bs_cfpperiod, bs.bs_cfpmaxduration, bs.bs_cfpnext); - - /* Set the computed STA beacon timers */ - - ath9k_hw_disable_interrupts(ah); - ath9k_hw_set_sta_beacon_timers(ah, &bs); - ah->imask |= ATH9K_INT_BMISS; - - ath9k_hw_set_interrupts(ah); - ath9k_hw_enable_interrupts(ah); -} - -static void ath9k_beacon_config_adhoc(struct ath_softc *sc, - struct ath_beacon_config *conf) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - u32 intval, nexttbtt; - - ath9k_reset_beacon_status(sc); - - intval = TU_TO_USEC(conf->beacon_interval); - - if (conf->ibss_creator) { - nexttbtt = intval; - } else { - u32 tbtt, offset, tsftu; - u64 tsf; - - /* - * Pull nexttbtt forward to reflect the current - * sync'd TSF. - */ - tsf = ath9k_hw_gettsf64(ah); - tsftu = TSF_TO_TU(tsf >> 32, tsf) + FUDGE; - offset = tsftu % conf->beacon_interval; - tbtt = tsftu - offset; - if (offset) - tbtt += conf->beacon_interval; - - nexttbtt = TU_TO_USEC(tbtt); - } - - if (conf->enable_beacon) - ah->imask |= ATH9K_INT_SWBA; - else - ah->imask &= ~ATH9K_INT_SWBA; - - ath_dbg(common, BEACON, - "IBSS (%s) nexttbtt: %u intval: %u conf_intval: %u\n", - (conf->enable_beacon) ? "Enable" : "Disable", - nexttbtt, intval, conf->beacon_interval); - - ath9k_beacon_init(sc, nexttbtt, intval, conf->ibss_creator); - - /* - * Set the global 'beacon has been configured' flag for the - * joiner case in IBSS mode. - */ - if (!conf->ibss_creator && conf->enable_beacon) - set_bit(SC_OP_BEACONS, &sc->sc_flags); -} - -bool ath9k_allow_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_vif *avp = (void *)vif->drv_priv; - - if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) { - if ((vif->type != NL80211_IFTYPE_AP) || - (sc->nbcnvifs > 1)) { - ath_dbg(common, CONFIG, - "An AP interface is already present !\n"); - return false; - } - } - - if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) { - if ((vif->type == NL80211_IFTYPE_STATION) && - test_bit(SC_OP_BEACONS, &sc->sc_flags) && - !avp->primary_sta_vif) { - ath_dbg(common, CONFIG, - "Beacon already configured for a station interface\n"); - return false; - } - } - - return true; -} - -static void ath9k_cache_beacon_config(struct ath_softc *sc, - struct ieee80211_bss_conf *bss_conf) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_beacon_config *cur_conf = &sc->cur_beacon_conf; - - ath_dbg(common, BEACON, - "Caching beacon data for BSS: %pM\n", bss_conf->bssid); - - cur_conf->beacon_interval = bss_conf->beacon_int; - cur_conf->dtim_period = bss_conf->dtim_period; - cur_conf->listen_interval = 1; - cur_conf->dtim_count = 1; - cur_conf->ibss_creator = bss_conf->ibss_creator; - cur_conf->bmiss_timeout = - ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval; - - /* - * It looks like mac80211 may end up using beacon interval of zero in - * some cases (at least for mesh point). Avoid getting into an - * infinite loop by using a bit safer value instead. To be safe, - * do sanity check on beacon interval for all operating modes. - */ - if (cur_conf->beacon_interval == 0) - cur_conf->beacon_interval = 100; - - /* - * We don't parse dtim period from mac80211 during the driver - * initialization as it breaks association with hidden-ssid - * AP and it causes latency in roaming - */ - if (cur_conf->dtim_period == 0) - cur_conf->dtim_period = 1; - -} - -void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif, - u32 changed) -{ - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; - struct ath_beacon_config *cur_conf = &sc->cur_beacon_conf; - unsigned long flags; - bool skip_beacon = false; - - if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) { - ath9k_cache_beacon_config(sc, bss_conf); - ath9k_set_beacon(sc); - set_bit(SC_OP_BEACONS, &sc->sc_flags); - return; - - } - - /* - * Take care of multiple interfaces when - * enabling/disabling SWBA. - */ - if (changed & BSS_CHANGED_BEACON_ENABLED) { - if (!bss_conf->enable_beacon && - (sc->nbcnvifs <= 1)) { - cur_conf->enable_beacon = false; - } else if (bss_conf->enable_beacon) { - cur_conf->enable_beacon = true; - ath9k_cache_beacon_config(sc, bss_conf); - } - } - - /* - * Configure the HW beacon registers only when we have a valid - * beacon interval. - */ - if (cur_conf->beacon_interval) { - /* - * If we are joining an existing IBSS network, start beaconing - * only after a TSF-sync has taken place. Ensure that this - * happens by setting the appropriate flags. - */ - if ((changed & BSS_CHANGED_IBSS) && !bss_conf->ibss_creator && - bss_conf->enable_beacon) { - spin_lock_irqsave(&sc->sc_pm_lock, flags); - sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON; - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - skip_beacon = true; - } else { - ath9k_set_beacon(sc); - } - - /* - * Do not set the SC_OP_BEACONS flag for IBSS joiner mode - * here, it is done in ath9k_beacon_config_adhoc(). - */ - if (cur_conf->enable_beacon && !skip_beacon) - set_bit(SC_OP_BEACONS, &sc->sc_flags); - else - clear_bit(SC_OP_BEACONS, &sc->sc_flags); - } -} - -void ath9k_set_beacon(struct ath_softc *sc) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_beacon_config *cur_conf = &sc->cur_beacon_conf; - - switch (sc->sc_ah->opmode) { - case NL80211_IFTYPE_AP: - ath9k_beacon_config_ap(sc, cur_conf); - break; - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_MESH_POINT: - ath9k_beacon_config_adhoc(sc, cur_conf); - break; - case NL80211_IFTYPE_STATION: - ath9k_beacon_config_sta(sc, cur_conf); - break; - default: - ath_dbg(common, CONFIG, "Unsupported beaconing mode\n"); - return; - } -} diff --git a/drivers/net/wireless/ath/ath9k/btcoex.c b/drivers/net/wireless/ath/ath9k/btcoex.c deleted file mode 100644 index 9963b0bf9f72..000000000000 --- a/drivers/net/wireless/ath/ath9k/btcoex.c +++ /dev/null @@ -1,416 +0,0 @@ -/* - * Copyright (c) 2009-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "hw.h" - -enum ath_bt_mode { - ATH_BT_COEX_MODE_LEGACY, /* legacy rx_clear mode */ - ATH_BT_COEX_MODE_UNSLOTTED, /* untimed/unslotted mode */ - ATH_BT_COEX_MODE_SLOTTED, /* slotted mode */ - ATH_BT_COEX_MODE_DISABLED, /* coexistence disabled */ -}; - -struct ath_btcoex_config { - u8 bt_time_extend; - bool bt_txstate_extend; - bool bt_txframe_extend; - enum ath_bt_mode bt_mode; /* coexistence mode */ - bool bt_quiet_collision; - bool bt_rxclear_polarity; /* invert rx_clear as WLAN_ACTIVE*/ - u8 bt_priority_time; - u8 bt_first_slot_time; - bool bt_hold_rx_clear; -}; - -static const u32 ar9003_wlan_weights[ATH_BTCOEX_STOMP_MAX] - [AR9300_NUM_WLAN_WEIGHTS] = { - { 0xfffffff0, 0xfffffff0, 0xfffffff0, 0xfffffff0 }, /* STOMP_ALL */ - { 0x88888880, 0x88888880, 0x88888880, 0x88888880 }, /* STOMP_LOW */ - { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* STOMP_NONE */ -}; - -static const u32 mci_wlan_weights[ATH_BTCOEX_STOMP_MAX] - [AR9300_NUM_WLAN_WEIGHTS] = { - { 0x01017d01, 0x41414101, 0x41414101, 0x41414141 }, /* STOMP_ALL */ - { 0x01017d01, 0x3b3b3b01, 0x3b3b3b01, 0x3b3b3b3b }, /* STOMP_LOW */ - { 0x01017d01, 0x01010101, 0x01010101, 0x01010101 }, /* STOMP_NONE */ - { 0x01017d01, 0x013b0101, 0x3b3b0101, 0x3b3b013b }, /* STOMP_LOW_FTP */ - { 0xffffff01, 0xffffffff, 0xffffff01, 0xffffffff }, /* STOMP_AUDIO */ -}; - -void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum) -{ - struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; - const struct ath_btcoex_config ath_bt_config = { - .bt_time_extend = 0, - .bt_txstate_extend = true, - .bt_txframe_extend = true, - .bt_mode = ATH_BT_COEX_MODE_SLOTTED, - .bt_quiet_collision = true, - .bt_rxclear_polarity = true, - .bt_priority_time = 2, - .bt_first_slot_time = 5, - .bt_hold_rx_clear = true, - }; - u32 i, idx; - bool rxclear_polarity = ath_bt_config.bt_rxclear_polarity; - - if (AR_SREV_9300_20_OR_LATER(ah)) - rxclear_polarity = !ath_bt_config.bt_rxclear_polarity; - - btcoex_hw->bt_coex_mode = - (btcoex_hw->bt_coex_mode & AR_BT_QCU_THRESH) | - SM(ath_bt_config.bt_time_extend, AR_BT_TIME_EXTEND) | - SM(ath_bt_config.bt_txstate_extend, AR_BT_TXSTATE_EXTEND) | - SM(ath_bt_config.bt_txframe_extend, AR_BT_TX_FRAME_EXTEND) | - SM(ath_bt_config.bt_mode, AR_BT_MODE) | - SM(ath_bt_config.bt_quiet_collision, AR_BT_QUIET) | - SM(rxclear_polarity, AR_BT_RX_CLEAR_POLARITY) | - SM(ath_bt_config.bt_priority_time, AR_BT_PRIORITY_TIME) | - SM(ath_bt_config.bt_first_slot_time, AR_BT_FIRST_SLOT_TIME) | - SM(qnum, AR_BT_QCU_THRESH); - - btcoex_hw->bt_coex_mode2 = - SM(ath_bt_config.bt_hold_rx_clear, AR_BT_HOLD_RX_CLEAR) | - SM(ATH_BTCOEX_BMISS_THRESH, AR_BT_BCN_MISS_THRESH) | - AR_BT_DISABLE_BT_ANT; - - for (i = 0; i < 32; i++) { - idx = (debruijn32 << i) >> 27; - ah->hw_gen_timers.gen_timer_index[idx] = i; - } -} -EXPORT_SYMBOL(ath9k_hw_init_btcoex_hw); - -void ath9k_hw_btcoex_init_scheme(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; - - /* - * Check if BTCOEX is globally disabled. - */ - if (!common->btcoex_enabled) { - btcoex_hw->scheme = ATH_BTCOEX_CFG_NONE; - return; - } - - if (AR_SREV_9300_20_OR_LATER(ah)) { - btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE; - btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9300; - btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9300; - btcoex_hw->btpriority_gpio = ATH_BTPRIORITY_GPIO_9300; - } else if (AR_SREV_9280_20_OR_LATER(ah)) { - btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO_9280; - btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO_9280; - - if (AR_SREV_9285(ah)) { - btcoex_hw->scheme = ATH_BTCOEX_CFG_3WIRE; - btcoex_hw->btpriority_gpio = ATH_BTPRIORITY_GPIO_9285; - } else { - btcoex_hw->scheme = ATH_BTCOEX_CFG_2WIRE; - } - } -} -EXPORT_SYMBOL(ath9k_hw_btcoex_init_scheme); - -void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah) -{ - struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; - - /* connect bt_active to baseband */ - REG_CLR_BIT(ah, AR_GPIO_INPUT_EN_VAL, - (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF | - AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_DEF)); - - REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, - AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB); - - /* Set input mux for bt_active to gpio pin */ - REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1, - AR_GPIO_INPUT_MUX1_BT_ACTIVE, - btcoex_hw->btactive_gpio); - - /* Configure the desired gpio port for input */ - ath9k_hw_cfg_gpio_input(ah, btcoex_hw->btactive_gpio); -} -EXPORT_SYMBOL(ath9k_hw_btcoex_init_2wire); - -void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah) -{ - struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; - - /* btcoex 3-wire */ - REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, - (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB | - AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB)); - - /* Set input mux for bt_prority_async and - * bt_active_async to GPIO pins */ - REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1, - AR_GPIO_INPUT_MUX1_BT_ACTIVE, - btcoex_hw->btactive_gpio); - - REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1, - AR_GPIO_INPUT_MUX1_BT_PRIORITY, - btcoex_hw->btpriority_gpio); - - /* Configure the desired GPIO ports for input */ - - ath9k_hw_cfg_gpio_input(ah, btcoex_hw->btactive_gpio); - ath9k_hw_cfg_gpio_input(ah, btcoex_hw->btpriority_gpio); -} -EXPORT_SYMBOL(ath9k_hw_btcoex_init_3wire); - -void ath9k_hw_btcoex_init_mci(struct ath_hw *ah) -{ - ah->btcoex_hw.mci.ready = false; - ah->btcoex_hw.mci.bt_state = 0; - ah->btcoex_hw.mci.bt_ver_major = 3; - ah->btcoex_hw.mci.bt_ver_minor = 0; - ah->btcoex_hw.mci.bt_version_known = false; - ah->btcoex_hw.mci.update_2g5g = true; - ah->btcoex_hw.mci.is_2g = true; - ah->btcoex_hw.mci.wlan_channels_update = false; - ah->btcoex_hw.mci.wlan_channels[0] = 0x00000000; - ah->btcoex_hw.mci.wlan_channels[1] = 0xffffffff; - ah->btcoex_hw.mci.wlan_channels[2] = 0xffffffff; - ah->btcoex_hw.mci.wlan_channels[3] = 0x7fffffff; - ah->btcoex_hw.mci.query_bt = true; - ah->btcoex_hw.mci.unhalt_bt_gpm = true; - ah->btcoex_hw.mci.halted_bt_gpm = false; - ah->btcoex_hw.mci.need_flush_btinfo = false; - ah->btcoex_hw.mci.wlan_cal_seq = 0; - ah->btcoex_hw.mci.wlan_cal_done = 0; - ah->btcoex_hw.mci.config = (AR_SREV_9462(ah)) ? 0x2201 : 0xa4c1; -} -EXPORT_SYMBOL(ath9k_hw_btcoex_init_mci); - -static void ath9k_hw_btcoex_enable_2wire(struct ath_hw *ah) -{ - struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; - - /* Configure the desired GPIO port for TX_FRAME output */ - ath9k_hw_cfg_output(ah, btcoex_hw->wlanactive_gpio, - AR_GPIO_OUTPUT_MUX_AS_TX_FRAME); -} - -/* - * For AR9002, bt_weight/wlan_weight are used. - * For AR9003 and above, stomp_type is used. - */ -void ath9k_hw_btcoex_set_weight(struct ath_hw *ah, - u32 bt_weight, - u32 wlan_weight, - enum ath_stomp_type stomp_type) -{ - struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; - struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; - u8 txprio_shift[] = { 24, 16, 16, 0 }; /* tx priority weight */ - bool concur_tx = (mci_hw->concur_tx && btcoex_hw->tx_prio[stomp_type]); - const u32 *weight = ar9003_wlan_weights[stomp_type]; - int i; - - if (!AR_SREV_9300_20_OR_LATER(ah)) { - btcoex_hw->bt_coex_weights = - SM(bt_weight, AR_BTCOEX_BT_WGHT) | - SM(wlan_weight, AR_BTCOEX_WL_WGHT); - return; - } - - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) { - enum ath_stomp_type stype = - ((stomp_type == ATH_BTCOEX_STOMP_LOW) && - btcoex_hw->mci.stomp_ftp) ? - ATH_BTCOEX_STOMP_LOW_FTP : stomp_type; - weight = mci_wlan_weights[stype]; - } - - for (i = 0; i < AR9300_NUM_WLAN_WEIGHTS; i++) { - btcoex_hw->bt_weight[i] = AR9300_BT_WGHT; - btcoex_hw->wlan_weight[i] = weight[i]; - if (concur_tx && i) { - btcoex_hw->wlan_weight[i] &= - ~(0xff << txprio_shift[i-1]); - btcoex_hw->wlan_weight[i] |= - (btcoex_hw->tx_prio[stomp_type] << - txprio_shift[i-1]); - } - } - /* Last WLAN weight has to be adjusted wrt tx priority */ - if (concur_tx) { - btcoex_hw->wlan_weight[i-1] &= ~(0xff << txprio_shift[i-1]); - btcoex_hw->wlan_weight[i-1] |= (btcoex_hw->tx_prio[stomp_type] - << txprio_shift[i-1]); - } - -} -EXPORT_SYMBOL(ath9k_hw_btcoex_set_weight); - - -static void ath9k_hw_btcoex_enable_3wire(struct ath_hw *ah) -{ - struct ath_btcoex_hw *btcoex = &ah->btcoex_hw; - u32 val; - int i; - - /* - * Program coex mode and weight registers to - * enable coex 3-wire - */ - REG_WRITE(ah, AR_BT_COEX_MODE, btcoex->bt_coex_mode); - REG_WRITE(ah, AR_BT_COEX_MODE2, btcoex->bt_coex_mode2); - - - if (AR_SREV_9300_20_OR_LATER(ah)) { - REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS0, btcoex->wlan_weight[0]); - REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS1, btcoex->wlan_weight[1]); - for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) - REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS(i), - btcoex->bt_weight[i]); - } else - REG_WRITE(ah, AR_BT_COEX_WEIGHT, btcoex->bt_coex_weights); - - - - if (AR_SREV_9271(ah)) { - val = REG_READ(ah, 0x50040); - val &= 0xFFFFFEFF; - REG_WRITE(ah, 0x50040, val); - } - - REG_RMW_FIELD(ah, AR_QUIET1, AR_QUIET1_QUIET_ACK_CTS_ENABLE, 1); - REG_RMW_FIELD(ah, AR_PCU_MISC, AR_PCU_BT_ANT_PREVENT_RX, 0); - - ath9k_hw_cfg_output(ah, btcoex->wlanactive_gpio, - AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL); -} - -static void ath9k_hw_btcoex_enable_mci(struct ath_hw *ah) -{ - struct ath_btcoex_hw *btcoex = &ah->btcoex_hw; - int i; - - for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) - REG_WRITE(ah, AR_MCI_COEX_WL_WEIGHTS(i), - btcoex->wlan_weight[i]); - - REG_RMW_FIELD(ah, AR_QUIET1, AR_QUIET1_QUIET_ACK_CTS_ENABLE, 1); - btcoex->enabled = true; -} - -void ath9k_hw_btcoex_enable(struct ath_hw *ah) -{ - struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; - - switch (ath9k_hw_get_btcoex_scheme(ah)) { - case ATH_BTCOEX_CFG_NONE: - return; - case ATH_BTCOEX_CFG_2WIRE: - ath9k_hw_btcoex_enable_2wire(ah); - break; - case ATH_BTCOEX_CFG_3WIRE: - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) { - ath9k_hw_btcoex_enable_mci(ah); - return; - } - ath9k_hw_btcoex_enable_3wire(ah); - break; - } - - REG_RMW(ah, AR_GPIO_PDPU, - (0x2 << (btcoex_hw->btactive_gpio * 2)), - (0x3 << (btcoex_hw->btactive_gpio * 2))); - - ah->btcoex_hw.enabled = true; -} -EXPORT_SYMBOL(ath9k_hw_btcoex_enable); - -void ath9k_hw_btcoex_disable(struct ath_hw *ah) -{ - struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; - int i; - - btcoex_hw->enabled = false; - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) { - ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); - for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) - REG_WRITE(ah, AR_MCI_COEX_WL_WEIGHTS(i), - btcoex_hw->wlan_weight[i]); - return; - } - ath9k_hw_set_gpio(ah, btcoex_hw->wlanactive_gpio, 0); - - ath9k_hw_cfg_output(ah, btcoex_hw->wlanactive_gpio, - AR_GPIO_OUTPUT_MUX_AS_OUTPUT); - - if (btcoex_hw->scheme == ATH_BTCOEX_CFG_3WIRE) { - REG_WRITE(ah, AR_BT_COEX_MODE, AR_BT_QUIET | AR_BT_MODE); - REG_WRITE(ah, AR_BT_COEX_MODE2, 0); - - if (AR_SREV_9300_20_OR_LATER(ah)) { - REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS0, 0); - REG_WRITE(ah, AR_BT_COEX_WL_WEIGHTS1, 0); - for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) - REG_WRITE(ah, AR_BT_COEX_BT_WEIGHTS(i), 0); - } else - REG_WRITE(ah, AR_BT_COEX_WEIGHT, 0); - - } -} -EXPORT_SYMBOL(ath9k_hw_btcoex_disable); - -/* - * Configures appropriate weight based on stomp type. - */ -void ath9k_hw_btcoex_bt_stomp(struct ath_hw *ah, - enum ath_stomp_type stomp_type) -{ - if (AR_SREV_9300_20_OR_LATER(ah)) { - ath9k_hw_btcoex_set_weight(ah, 0, 0, stomp_type); - return; - } - - switch (stomp_type) { - case ATH_BTCOEX_STOMP_ALL: - ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, - AR_STOMP_ALL_WLAN_WGHT, 0); - break; - case ATH_BTCOEX_STOMP_LOW: - ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, - AR_STOMP_LOW_WLAN_WGHT, 0); - break; - case ATH_BTCOEX_STOMP_NONE: - ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, - AR_STOMP_NONE_WLAN_WGHT, 0); - break; - default: - ath_dbg(ath9k_hw_common(ah), BTCOEX, "Invalid Stomptype\n"); - break; - } -} -EXPORT_SYMBOL(ath9k_hw_btcoex_bt_stomp); - -void ath9k_hw_btcoex_set_concur_txprio(struct ath_hw *ah, u8 *stomp_txprio) -{ - struct ath_btcoex_hw *btcoex = &ah->btcoex_hw; - int i; - - for (i = 0; i < ATH_BTCOEX_STOMP_MAX; i++) - btcoex->tx_prio[i] = stomp_txprio[i]; -} -EXPORT_SYMBOL(ath9k_hw_btcoex_set_concur_txprio); diff --git a/drivers/net/wireless/ath/ath9k/btcoex.h b/drivers/net/wireless/ath/ath9k/btcoex.h deleted file mode 100644 index 6de26ea5d5fa..000000000000 --- a/drivers/net/wireless/ath/ath9k/btcoex.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2009-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef BTCOEX_H -#define BTCOEX_H - -#include "hw.h" - -#define ATH_WLANACTIVE_GPIO_9280 5 -#define ATH_BTACTIVE_GPIO_9280 6 -#define ATH_BTPRIORITY_GPIO_9285 7 - -#define ATH_WLANACTIVE_GPIO_9300 5 -#define ATH_BTACTIVE_GPIO_9300 4 -#define ATH_BTPRIORITY_GPIO_9300 8 - -#define ATH_BTCOEX_DEF_BT_PERIOD 45 -#define ATH_BTCOEX_DEF_DUTY_CYCLE 55 -#define ATH_BTCOEX_BTSCAN_DUTY_CYCLE 90 -#define ATH_BTCOEX_BMISS_THRESH 50 - -#define ATH_BT_PRIORITY_TIME_THRESHOLD 1000 /* ms */ -#define ATH_BT_CNT_THRESHOLD 3 -#define ATH_BT_CNT_SCAN_THRESHOLD 15 - -#define ATH_BTCOEX_RX_WAIT_TIME 100 -#define ATH_BTCOEX_STOMP_FTP_THRESH 5 - -#define ATH_BTCOEX_HT20_MAX_TXPOWER 0x14 -#define ATH_BTCOEX_HT40_MAX_TXPOWER 0x10 - -#define AR9300_NUM_BT_WEIGHTS 4 -#define AR9300_NUM_WLAN_WEIGHTS 4 -/* Defines the BT AR_BT_COEX_WGHT used */ -enum ath_stomp_type { - ATH_BTCOEX_STOMP_ALL, - ATH_BTCOEX_STOMP_LOW, - ATH_BTCOEX_STOMP_NONE, - ATH_BTCOEX_STOMP_LOW_FTP, - ATH_BTCOEX_STOMP_AUDIO, - ATH_BTCOEX_STOMP_MAX -}; - -enum ath_btcoex_scheme { - ATH_BTCOEX_CFG_NONE, - ATH_BTCOEX_CFG_2WIRE, - ATH_BTCOEX_CFG_3WIRE, -}; - -struct ath9k_hw_mci { - u32 raw_intr; - u32 rx_msg_intr; - u32 cont_status; - u32 gpm_addr; - u32 gpm_len; - u32 gpm_idx; - u32 sched_addr; - u32 wlan_channels[4]; - u32 wlan_cal_seq; - u32 wlan_cal_done; - u32 config; - u8 *gpm_buf; - bool ready; - bool update_2g5g; - bool is_2g; - bool query_bt; - bool unhalt_bt_gpm; /* need send UNHALT */ - bool halted_bt_gpm; /* HALT sent */ - bool need_flush_btinfo; - bool bt_version_known; - bool wlan_channels_update; - u8 wlan_ver_major; - u8 wlan_ver_minor; - u8 bt_ver_major; - u8 bt_ver_minor; - u8 bt_state; - u8 stomp_ftp; - bool concur_tx; - u32 last_recovery; -}; - -struct ath_btcoex_hw { - enum ath_btcoex_scheme scheme; - struct ath9k_hw_mci mci; - bool enabled; - u8 wlanactive_gpio; - u8 btactive_gpio; - u8 btpriority_gpio; - u32 bt_coex_mode; /* Register setting for AR_BT_COEX_MODE */ - u32 bt_coex_weights; /* Register setting for AR_BT_COEX_WEIGHT */ - u32 bt_coex_mode2; /* Register setting for AR_BT_COEX_MODE2 */ - u32 bt_weight[AR9300_NUM_BT_WEIGHTS]; - u32 wlan_weight[AR9300_NUM_WLAN_WEIGHTS]; - u8 tx_prio[ATH_BTCOEX_STOMP_MAX]; -}; - -void ath9k_hw_btcoex_init_scheme(struct ath_hw *ah); -void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah); -void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah); -void ath9k_hw_btcoex_init_mci(struct ath_hw *ah); -void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum); -void ath9k_hw_btcoex_set_weight(struct ath_hw *ah, - u32 bt_weight, - u32 wlan_weight, - enum ath_stomp_type stomp_type); -void ath9k_hw_btcoex_disable(struct ath_hw *ah); -void ath9k_hw_btcoex_bt_stomp(struct ath_hw *ah, - enum ath_stomp_type stomp_type); -void ath9k_hw_btcoex_set_concur_txprio(struct ath_hw *ah, u8 *stomp_txprio); - -#endif diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c deleted file mode 100644 index 5e8219a91e25..000000000000 --- a/drivers/net/wireless/ath/ath9k/calib.c +++ /dev/null @@ -1,448 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "hw.h" -#include "hw-ops.h" -#include - -/* Common calibration code */ - - -static int16_t ath9k_hw_get_nf_hist_mid(int16_t *nfCalBuffer) -{ - int16_t nfval; - int16_t sort[ATH9K_NF_CAL_HIST_MAX]; - int i, j; - - for (i = 0; i < ATH9K_NF_CAL_HIST_MAX; i++) - sort[i] = nfCalBuffer[i]; - - for (i = 0; i < ATH9K_NF_CAL_HIST_MAX - 1; i++) { - for (j = 1; j < ATH9K_NF_CAL_HIST_MAX - i; j++) { - if (sort[j] > sort[j - 1]) { - nfval = sort[j]; - sort[j] = sort[j - 1]; - sort[j - 1] = nfval; - } - } - } - nfval = sort[(ATH9K_NF_CAL_HIST_MAX - 1) >> 1]; - - return nfval; -} - -static struct ath_nf_limits *ath9k_hw_get_nf_limits(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - struct ath_nf_limits *limit; - - if (!chan || IS_CHAN_2GHZ(chan)) - limit = &ah->nf_2g; - else - limit = &ah->nf_5g; - - return limit; -} - -static s16 ath9k_hw_get_default_nf(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - return ath9k_hw_get_nf_limits(ah, chan)->nominal; -} - -s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan) -{ - s8 noise = ATH_DEFAULT_NOISE_FLOOR; - - if (chan && chan->noisefloor) { - s8 delta = chan->noisefloor - - ATH9K_NF_CAL_NOISE_THRESH - - ath9k_hw_get_default_nf(ah, chan); - if (delta > 0) - noise += delta; - } - return noise; -} -EXPORT_SYMBOL(ath9k_hw_getchan_noise); - -static void ath9k_hw_update_nfcal_hist_buffer(struct ath_hw *ah, - struct ath9k_hw_cal_data *cal, - int16_t *nfarray) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath_nf_limits *limit; - struct ath9k_nfcal_hist *h; - bool high_nf_mid = false; - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; - int i; - - h = cal->nfCalHist; - limit = ath9k_hw_get_nf_limits(ah, ah->curchan); - - for (i = 0; i < NUM_NF_READINGS; i++) { - if (!(chainmask & (1 << i)) || - ((i >= AR5416_MAX_CHAINS) && !IS_CHAN_HT40(ah->curchan))) - continue; - - h[i].nfCalBuffer[h[i].currIndex] = nfarray[i]; - - if (++h[i].currIndex >= ATH9K_NF_CAL_HIST_MAX) - h[i].currIndex = 0; - - if (h[i].invalidNFcount > 0) { - h[i].invalidNFcount--; - h[i].privNF = nfarray[i]; - } else { - h[i].privNF = - ath9k_hw_get_nf_hist_mid(h[i].nfCalBuffer); - } - - if (!h[i].privNF) - continue; - - if (h[i].privNF > limit->max) { - high_nf_mid = true; - - ath_dbg(common, CALIBRATE, - "NFmid[%d] (%d) > MAX (%d), %s\n", - i, h[i].privNF, limit->max, - (cal->nfcal_interference ? - "not corrected (due to interference)" : - "correcting to MAX")); - - /* - * Normally we limit the average noise floor by the - * hardware specific maximum here. However if we have - * encountered stuck beacons because of interference, - * we bypass this limit here in order to better deal - * with our environment. - */ - if (!cal->nfcal_interference) - h[i].privNF = limit->max; - } - } - - /* - * If the noise floor seems normal for all chains, assume that - * there is no significant interference in the environment anymore. - * Re-enable the enforcement of the NF maximum again. - */ - if (!high_nf_mid) - cal->nfcal_interference = false; -} - -static bool ath9k_hw_get_nf_thresh(struct ath_hw *ah, - enum ieee80211_band band, - int16_t *nft) -{ - switch (band) { - case IEEE80211_BAND_5GHZ: - *nft = (int8_t)ah->eep_ops->get_eeprom(ah, EEP_NFTHRESH_5); - break; - case IEEE80211_BAND_2GHZ: - *nft = (int8_t)ah->eep_ops->get_eeprom(ah, EEP_NFTHRESH_2); - break; - default: - BUG_ON(1); - return false; - } - - return true; -} - -void ath9k_hw_reset_calibration(struct ath_hw *ah, - struct ath9k_cal_list *currCal) -{ - int i; - - ath9k_hw_setup_calibration(ah, currCal); - - currCal->calState = CAL_RUNNING; - - for (i = 0; i < AR5416_MAX_CHAINS; i++) { - ah->meas0.sign[i] = 0; - ah->meas1.sign[i] = 0; - ah->meas2.sign[i] = 0; - ah->meas3.sign[i] = 0; - } - - ah->cal_samples = 0; -} - -/* This is done for the currently configured channel */ -bool ath9k_hw_reset_calvalid(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ieee80211_conf *conf = &common->hw->conf; - struct ath9k_cal_list *currCal = ah->cal_list_curr; - - if (!ah->caldata) - return true; - - if (!AR_SREV_9100(ah) && !AR_SREV_9160_10_OR_LATER(ah)) - return true; - - if (currCal == NULL) - return true; - - if (currCal->calState != CAL_DONE) { - ath_dbg(common, CALIBRATE, "Calibration state incorrect, %d\n", - currCal->calState); - return true; - } - - if (!(ah->supp_cals & currCal->calData->calType)) - return true; - - ath_dbg(common, CALIBRATE, "Resetting Cal %d state for channel %u\n", - currCal->calData->calType, conf->chandef.chan->center_freq); - - ah->caldata->CalValid &= ~currCal->calData->calType; - currCal->calState = CAL_WAITING; - - return false; -} -EXPORT_SYMBOL(ath9k_hw_reset_calvalid); - -void ath9k_hw_start_nfcal(struct ath_hw *ah, bool update) -{ - if (ah->caldata) - ah->caldata->nfcal_pending = true; - - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, - AR_PHY_AGC_CONTROL_ENABLE_NF); - - if (update) - REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, - AR_PHY_AGC_CONTROL_NO_UPDATE_NF); - else - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, - AR_PHY_AGC_CONTROL_NO_UPDATE_NF); - - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF); -} - -void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan) -{ - struct ath9k_nfcal_hist *h = NULL; - unsigned i, j; - int32_t val; - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; - struct ath_common *common = ath9k_hw_common(ah); - struct ieee80211_conf *conf = &common->hw->conf; - s16 default_nf = ath9k_hw_get_default_nf(ah, chan); - - if (ah->caldata) - h = ah->caldata->nfCalHist; - - for (i = 0; i < NUM_NF_READINGS; i++) { - if (chainmask & (1 << i)) { - s16 nfval; - - if ((i >= AR5416_MAX_CHAINS) && !conf_is_ht40(conf)) - continue; - - if (h) - nfval = h[i].privNF; - else - nfval = default_nf; - - val = REG_READ(ah, ah->nf_regs[i]); - val &= 0xFFFFFE00; - val |= (((u32) nfval << 1) & 0x1ff); - REG_WRITE(ah, ah->nf_regs[i], val); - } - } - - /* - * Load software filtered NF value into baseband internal minCCApwr - * variable. - */ - REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, - AR_PHY_AGC_CONTROL_ENABLE_NF); - REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, - AR_PHY_AGC_CONTROL_NO_UPDATE_NF); - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF); - - /* - * Wait for load to complete, should be fast, a few 10s of us. - * The max delay was changed from an original 250us to 10000us - * since 250us often results in NF load timeout and causes deaf - * condition during stress testing 12/12/2009 - */ - for (j = 0; j < 10000; j++) { - if ((REG_READ(ah, AR_PHY_AGC_CONTROL) & - AR_PHY_AGC_CONTROL_NF) == 0) - break; - udelay(10); - } - - /* - * We timed out waiting for the noisefloor to load, probably due to an - * in-progress rx. Simply return here and allow the load plenty of time - * to complete before the next calibration interval. We need to avoid - * trying to load -50 (which happens below) while the previous load is - * still in progress as this can cause rx deafness. Instead by returning - * here, the baseband nf cal will just be capped by our present - * noisefloor until the next calibration timer. - */ - if (j == 10000) { - ath_dbg(common, ANY, - "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n", - REG_READ(ah, AR_PHY_AGC_CONTROL)); - return; - } - - /* - * Restore maxCCAPower register parameter again so that we're not capped - * by the median we just loaded. This will be initial (and max) value - * of next noise floor calibration the baseband does. - */ - ENABLE_REGWRITE_BUFFER(ah); - for (i = 0; i < NUM_NF_READINGS; i++) { - if (chainmask & (1 << i)) { - if ((i >= AR5416_MAX_CHAINS) && !conf_is_ht40(conf)) - continue; - - val = REG_READ(ah, ah->nf_regs[i]); - val &= 0xFFFFFE00; - val |= (((u32) (-50) << 1) & 0x1ff); - REG_WRITE(ah, ah->nf_regs[i], val); - } - } - REGWRITE_BUFFER_FLUSH(ah); -} - - -static void ath9k_hw_nf_sanitize(struct ath_hw *ah, s16 *nf) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath_nf_limits *limit; - int i; - - if (IS_CHAN_2GHZ(ah->curchan)) - limit = &ah->nf_2g; - else - limit = &ah->nf_5g; - - for (i = 0; i < NUM_NF_READINGS; i++) { - if (!nf[i]) - continue; - - ath_dbg(common, CALIBRATE, - "NF calibrated [%s] [chain %d] is %d\n", - (i >= 3 ? "ext" : "ctl"), i % 3, nf[i]); - - if (nf[i] > limit->max) { - ath_dbg(common, CALIBRATE, - "NF[%d] (%d) > MAX (%d), correcting to MAX\n", - i, nf[i], limit->max); - nf[i] = limit->max; - } else if (nf[i] < limit->min) { - ath_dbg(common, CALIBRATE, - "NF[%d] (%d) < MIN (%d), correcting to NOM\n", - i, nf[i], limit->min); - nf[i] = limit->nominal; - } - } -} - -bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan) -{ - struct ath_common *common = ath9k_hw_common(ah); - int16_t nf, nfThresh; - int16_t nfarray[NUM_NF_READINGS] = { 0 }; - struct ath9k_nfcal_hist *h; - struct ieee80211_channel *c = chan->chan; - struct ath9k_hw_cal_data *caldata = ah->caldata; - - if (REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) { - ath_dbg(common, CALIBRATE, - "NF did not complete in calibration window\n"); - return false; - } - - ath9k_hw_do_getnf(ah, nfarray); - ath9k_hw_nf_sanitize(ah, nfarray); - nf = nfarray[0]; - if (ath9k_hw_get_nf_thresh(ah, c->band, &nfThresh) - && nf > nfThresh) { - ath_dbg(common, CALIBRATE, - "noise floor failed detected; detected %d, threshold %d\n", - nf, nfThresh); - } - - if (!caldata) { - chan->noisefloor = nf; - return false; - } - - h = caldata->nfCalHist; - caldata->nfcal_pending = false; - ath9k_hw_update_nfcal_hist_buffer(ah, caldata, nfarray); - chan->noisefloor = h[0].privNF; - ah->noise = ath9k_hw_getchan_noise(ah, chan); - return true; -} -EXPORT_SYMBOL(ath9k_hw_getnf); - -void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - struct ath9k_nfcal_hist *h; - s16 default_nf; - int i, j; - - ah->caldata->channel = chan->channel; - ah->caldata->channelFlags = chan->channelFlags; - ah->caldata->chanmode = chan->chanmode; - h = ah->caldata->nfCalHist; - default_nf = ath9k_hw_get_default_nf(ah, chan); - for (i = 0; i < NUM_NF_READINGS; i++) { - h[i].currIndex = 0; - h[i].privNF = default_nf; - h[i].invalidNFcount = AR_PHY_CCA_FILTERWINDOW_LENGTH; - for (j = 0; j < ATH9K_NF_CAL_HIST_MAX; j++) { - h[i].nfCalBuffer[j] = default_nf; - } - } -} - - -void ath9k_hw_bstuck_nfcal(struct ath_hw *ah) -{ - struct ath9k_hw_cal_data *caldata = ah->caldata; - - if (unlikely(!caldata)) - return; - - /* - * If beacons are stuck, the most likely cause is interference. - * Triggering a noise floor calibration at this point helps the - * hardware adapt to a noisy environment much faster. - * To ensure that we recover from stuck beacons quickly, let - * the baseband update the internal NF value itself, similar to - * what is being done after a full reset. - */ - if (!caldata->nfcal_pending) - ath9k_hw_start_nfcal(ah, true); - else if (!(REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF)) - ath9k_hw_getnf(ah, ah->curchan); - - caldata->nfcal_interference = true; -} -EXPORT_SYMBOL(ath9k_hw_bstuck_nfcal); - diff --git a/drivers/net/wireless/ath/ath9k/calib.h b/drivers/net/wireless/ath/ath9k/calib.h deleted file mode 100644 index 3d70b8c2bcdd..000000000000 --- a/drivers/net/wireless/ath/ath9k/calib.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef CALIB_H -#define CALIB_H - -#include "hw.h" - -#define AR_PHY_CCA_FILTERWINDOW_LENGTH 5 - -/* Internal noise floor can vary by about 6db depending on the frequency */ -#define ATH9K_NF_CAL_NOISE_THRESH 6 - -#define NUM_NF_READINGS 6 -#define ATH9K_NF_CAL_HIST_MAX 5 - -struct ar5416IniArray { - u32 *ia_array; - u32 ia_rows; - u32 ia_columns; -}; - -#define STATIC_INI_ARRAY(array) { \ - .ia_array = (u32 *)(array), \ - .ia_rows = ARRAY_SIZE(array), \ - .ia_columns = ARRAY_SIZE(array[0]), \ - } - -#define INIT_INI_ARRAY(iniarray, array) do { \ - (iniarray)->ia_array = (u32 *)(array); \ - (iniarray)->ia_rows = ARRAY_SIZE(array); \ - (iniarray)->ia_columns = ARRAY_SIZE(array[0]); \ - } while (0) - -#define INI_RA(iniarray, row, column) \ - (((iniarray)->ia_array)[(row) * ((iniarray)->ia_columns) + (column)]) - -#define INIT_CAL(_perCal) do { \ - (_perCal)->calState = CAL_WAITING; \ - (_perCal)->calNext = NULL; \ - } while (0) - -#define INSERT_CAL(_ahp, _perCal) \ - do { \ - if ((_ahp)->cal_list_last == NULL) { \ - (_ahp)->cal_list = \ - (_ahp)->cal_list_last = (_perCal); \ - ((_ahp)->cal_list_last)->calNext = (_perCal); \ - } else { \ - ((_ahp)->cal_list_last)->calNext = (_perCal); \ - (_ahp)->cal_list_last = (_perCal); \ - (_perCal)->calNext = (_ahp)->cal_list; \ - } \ - } while (0) - -enum ath9k_cal_state { - CAL_INACTIVE, - CAL_WAITING, - CAL_RUNNING, - CAL_DONE -}; - -#define MIN_CAL_SAMPLES 1 -#define MAX_CAL_SAMPLES 64 -#define INIT_LOG_COUNT 5 -#define PER_MIN_LOG_COUNT 2 -#define PER_MAX_LOG_COUNT 10 - -struct ath9k_percal_data { - u32 calType; - u32 calNumSamples; - u32 calCountMax; - void (*calCollect) (struct ath_hw *); - void (*calPostProc) (struct ath_hw *, u8); -}; - -struct ath9k_cal_list { - const struct ath9k_percal_data *calData; - enum ath9k_cal_state calState; - struct ath9k_cal_list *calNext; -}; - -struct ath9k_nfcal_hist { - int16_t nfCalBuffer[ATH9K_NF_CAL_HIST_MAX]; - u8 currIndex; - int16_t privNF; - u8 invalidNFcount; -}; - -#define MAX_PACAL_SKIPCOUNT 8 -struct ath9k_pacal_info{ - int32_t prev_offset; /* Previous value of PA offset value */ - int8_t max_skipcount; /* Max No. of times PACAL can be skipped */ - int8_t skipcount; /* No. of times the PACAL to be skipped */ -}; - -bool ath9k_hw_reset_calvalid(struct ath_hw *ah); -void ath9k_hw_start_nfcal(struct ath_hw *ah, bool update); -void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan); -bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan); -void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah, - struct ath9k_channel *chan); -void ath9k_hw_bstuck_nfcal(struct ath_hw *ah); -void ath9k_hw_reset_calibration(struct ath_hw *ah, - struct ath9k_cal_list *currCal); -s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan); - - -#endif /* CALIB_H */ diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c deleted file mode 100644 index 344fdde1d7a3..000000000000 --- a/drivers/net/wireless/ath/ath9k/common.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2009-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * Module for common driver code between ath9k and ath9k_htc - */ - -#include -#include - -#include "common.h" - -MODULE_AUTHOR("Atheros Communications"); -MODULE_DESCRIPTION("Shared library for Atheros wireless 802.11n LAN cards."); -MODULE_LICENSE("Dual BSD/GPL"); - -int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - - if (tx_info->control.hw_key) { - switch (tx_info->control.hw_key->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - return ATH9K_KEY_TYPE_WEP; - case WLAN_CIPHER_SUITE_TKIP: - return ATH9K_KEY_TYPE_TKIP; - case WLAN_CIPHER_SUITE_CCMP: - return ATH9K_KEY_TYPE_AES; - default: - break; - } - } - - return ATH9K_KEY_TYPE_CLEAR; -} -EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_keytype); - -static u32 ath9k_get_extchanmode(struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type) -{ - u32 chanmode = 0; - - switch (chan->band) { - case IEEE80211_BAND_2GHZ: - switch (channel_type) { - case NL80211_CHAN_NO_HT: - case NL80211_CHAN_HT20: - chanmode = CHANNEL_G_HT20; - break; - case NL80211_CHAN_HT40PLUS: - chanmode = CHANNEL_G_HT40PLUS; - break; - case NL80211_CHAN_HT40MINUS: - chanmode = CHANNEL_G_HT40MINUS; - break; - } - break; - case IEEE80211_BAND_5GHZ: - switch (channel_type) { - case NL80211_CHAN_NO_HT: - case NL80211_CHAN_HT20: - chanmode = CHANNEL_A_HT20; - break; - case NL80211_CHAN_HT40PLUS: - chanmode = CHANNEL_A_HT40PLUS; - break; - case NL80211_CHAN_HT40MINUS: - chanmode = CHANNEL_A_HT40MINUS; - break; - } - break; - default: - break; - } - - return chanmode; -} - -/* - * Update internal channel flags. - */ -void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type) -{ - ichan->channel = chan->center_freq; - ichan->chan = chan; - - if (chan->band == IEEE80211_BAND_2GHZ) { - ichan->chanmode = CHANNEL_G; - ichan->channelFlags = CHANNEL_2GHZ | CHANNEL_OFDM; - } else { - ichan->chanmode = CHANNEL_A; - ichan->channelFlags = CHANNEL_5GHZ | CHANNEL_OFDM; - } - - if (channel_type != NL80211_CHAN_NO_HT) - ichan->chanmode = ath9k_get_extchanmode(chan, channel_type); -} -EXPORT_SYMBOL(ath9k_cmn_update_ichannel); - -/* - * Get the internal channel reference. - */ -struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw, - struct ath_hw *ah) -{ - struct ieee80211_channel *curchan = hw->conf.chandef.chan; - struct ath9k_channel *channel; - u8 chan_idx; - - chan_idx = curchan->hw_value; - channel = &ah->channels[chan_idx]; - ath9k_cmn_update_ichannel(channel, curchan, - cfg80211_get_chandef_type(&hw->conf.chandef)); - - return channel; -} -EXPORT_SYMBOL(ath9k_cmn_get_curchannel); - -int ath9k_cmn_count_streams(unsigned int chainmask, int max) -{ - int streams = 0; - - do { - if (++streams == max) - break; - } while ((chainmask = chainmask & (chainmask - 1))); - - return streams; -} -EXPORT_SYMBOL(ath9k_cmn_count_streams); - -void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow, - u16 new_txpow, u16 *txpower) -{ - struct ath_regulatory *reg = ath9k_hw_regulatory(ah); - - if (reg->power_limit != new_txpow) { - ath9k_hw_set_txpowerlimit(ah, new_txpow, false); - /* read back in case value is clamped */ - *txpower = reg->max_power_level; - } -} -EXPORT_SYMBOL(ath9k_cmn_update_txpow); - -void ath9k_cmn_init_crypto(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - int i = 0; - - /* Get the hardware key cache size. */ - common->keymax = AR_KEYTABLE_SIZE; - - /* - * Check whether the separate key cache entries - * are required to handle both tx+rx MIC keys. - * With split mic keys the number of stations is limited - * to 27 otherwise 59. - */ - if (ah->misc_mode & AR_PCU_MIC_NEW_LOC_ENA) - common->crypt_caps |= ATH_CRYPT_CAP_MIC_COMBINED; - - /* - * Reset the key cache since some parts do not - * reset the contents on initial power up. - */ - for (i = 0; i < common->keymax; i++) - ath_hw_keyreset(common, (u16) i); -} -EXPORT_SYMBOL(ath9k_cmn_init_crypto); - -static int __init ath9k_cmn_init(void) -{ - return 0; -} -module_init(ath9k_cmn_init); - -static void __exit ath9k_cmn_exit(void) -{ - return; -} -module_exit(ath9k_cmn_exit); diff --git a/drivers/net/wireless/ath/ath9k/common.h b/drivers/net/wireless/ath/ath9k/common.h deleted file mode 100644 index 207d06995b15..000000000000 --- a/drivers/net/wireless/ath/ath9k/common.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2009-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#include "../ath.h" - -#include "hw.h" -#include "hw-ops.h" - -/* Common header for Atheros 802.11n base driver cores */ - -#define WME_BA_BMP_SIZE 64 -#define WME_MAX_BA WME_BA_BMP_SIZE -#define ATH_TID_MAX_BUFS (2 * WME_MAX_BA) - -#define ATH_RSSI_DUMMY_MARKER 127 -#define ATH_RSSI_LPF_LEN 10 -#define RSSI_LPF_THRESHOLD -20 -#define ATH_RSSI_EP_MULTIPLIER (1<<7) -#define ATH_EP_MUL(x, mul) ((x) * (mul)) -#define ATH_RSSI_IN(x) (ATH_EP_MUL((x), ATH_RSSI_EP_MULTIPLIER)) -#define ATH_LPF_RSSI(x, y, len) \ - ((x != ATH_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y)) -#define ATH_RSSI_LPF(x, y) do { \ - if ((y) >= RSSI_LPF_THRESHOLD) \ - x = ATH_LPF_RSSI((x), ATH_RSSI_IN((y)), ATH_RSSI_LPF_LEN); \ -} while (0) -#define ATH_EP_RND(x, mul) \ - (((x) + ((mul)/2)) / (mul)) - -int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb); -void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type); -struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw, - struct ath_hw *ah); -int ath9k_cmn_count_streams(unsigned int chainmask, int max); -void ath9k_cmn_btcoex_bt_stomp(struct ath_common *common, - enum ath_stomp_type stomp_type); -void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow, - u16 new_txpow, u16 *txpower); -void ath9k_cmn_init_crypto(struct ath_hw *ah); diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c deleted file mode 100644 index b37eb8d38811..000000000000 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ /dev/null @@ -1,2114 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include - -#include "ath9k.h" - -#define REG_WRITE_D(_ah, _reg, _val) \ - ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg)) -#define REG_READ_D(_ah, _reg) \ - ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) - - -static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - u8 *buf = file->private_data; - return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); -} - -static int ath9k_debugfs_release_buf(struct inode *inode, struct file *file) -{ - vfree(file->private_data); - return 0; -} - -#ifdef CONFIG_ATH_DEBUG - -static ssize_t read_file_debug(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - char buf[32]; - unsigned int len; - - len = sprintf(buf, "0x%08x\n", common->debug_mask); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_debug(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - unsigned long mask; - char buf[32]; - ssize_t len; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (strict_strtoul(buf, 0, &mask)) - return -EINVAL; - - common->debug_mask = mask; - return count; -} - -static const struct file_operations fops_debug = { - .read = read_file_debug, - .write = write_file_debug, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -#endif - -#define DMA_BUF_LEN 1024 - -static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_hw *ah = sc->sc_ah; - char buf[32]; - unsigned int len; - - len = sprintf(buf, "0x%08x\n", ah->txchainmask); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_tx_chainmask(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_hw *ah = sc->sc_ah; - unsigned long mask; - char buf[32]; - ssize_t len; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (strict_strtoul(buf, 0, &mask)) - return -EINVAL; - - ah->txchainmask = mask; - ah->caps.tx_chainmask = mask; - return count; -} - -static const struct file_operations fops_tx_chainmask = { - .read = read_file_tx_chainmask, - .write = write_file_tx_chainmask, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - - -static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_hw *ah = sc->sc_ah; - char buf[32]; - unsigned int len; - - len = sprintf(buf, "0x%08x\n", ah->rxchainmask); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_rx_chainmask(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_hw *ah = sc->sc_ah; - unsigned long mask; - char buf[32]; - ssize_t len; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (strict_strtoul(buf, 0, &mask)) - return -EINVAL; - - ah->rxchainmask = mask; - ah->caps.rx_chainmask = mask; - return count; -} - -static const struct file_operations fops_rx_chainmask = { - .read = read_file_rx_chainmask, - .write = write_file_rx_chainmask, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_disable_ani(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - char buf[32]; - unsigned int len; - - len = sprintf(buf, "%d\n", common->disable_ani); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_disable_ani(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - unsigned long disable_ani; - char buf[32]; - ssize_t len; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (strict_strtoul(buf, 0, &disable_ani)) - return -EINVAL; - - common->disable_ani = !!disable_ani; - - if (disable_ani) { - clear_bit(SC_OP_ANI_RUN, &sc->sc_flags); - ath_stop_ani(sc); - } else { - ath_check_ani(sc); - } - - return count; -} - -static const struct file_operations fops_disable_ani = { - .read = read_file_disable_ani, - .write = write_file_disable_ani, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_ant_diversity(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - char buf[32]; - unsigned int len; - - len = sprintf(buf, "%d\n", common->antenna_diversity); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_ant_diversity(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - unsigned long antenna_diversity; - char buf[32]; - ssize_t len; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - if (!AR_SREV_9565(sc->sc_ah)) - goto exit; - - buf[len] = '\0'; - if (strict_strtoul(buf, 0, &antenna_diversity)) - return -EINVAL; - - common->antenna_diversity = !!antenna_diversity; - ath9k_ps_wakeup(sc); - ath_ant_comb_update(sc); - ath_dbg(common, CONFIG, "Antenna diversity: %d\n", - common->antenna_diversity); - ath9k_ps_restore(sc); -exit: - return count; -} - -static const struct file_operations fops_ant_diversity = { - .read = read_file_ant_diversity, - .write = write_file_ant_diversity, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_dma(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_hw *ah = sc->sc_ah; - char *buf; - int retval; - unsigned int len = 0; - u32 val[ATH9K_NUM_DMA_DEBUG_REGS]; - int i, qcuOffset = 0, dcuOffset = 0; - u32 *qcuBase = &val[0], *dcuBase = &val[4]; - - buf = kmalloc(DMA_BUF_LEN, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - ath9k_ps_wakeup(sc); - - REG_WRITE_D(ah, AR_MACMISC, - ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) | - (AR_MACMISC_MISC_OBS_BUS_1 << - AR_MACMISC_MISC_OBS_BUS_MSB_S))); - - len += snprintf(buf + len, DMA_BUF_LEN - len, - "Raw DMA Debug values:\n"); - - for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++) { - if (i % 4 == 0) - len += snprintf(buf + len, DMA_BUF_LEN - len, "\n"); - - val[i] = REG_READ_D(ah, AR_DMADBG_0 + (i * sizeof(u32))); - len += snprintf(buf + len, DMA_BUF_LEN - len, "%d: %08x ", - i, val[i]); - } - - len += snprintf(buf + len, DMA_BUF_LEN - len, "\n\n"); - len += snprintf(buf + len, DMA_BUF_LEN - len, - "Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n"); - - for (i = 0; i < ATH9K_NUM_QUEUES; i++, qcuOffset += 4, dcuOffset += 5) { - if (i == 8) { - qcuOffset = 0; - qcuBase++; - } - - if (i == 6) { - dcuOffset = 0; - dcuBase++; - } - - len += snprintf(buf + len, DMA_BUF_LEN - len, - "%2d %2x %1x %2x %2x\n", - i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset, - (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3), - val[2] & (0x7 << (i * 3)) >> (i * 3), - (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset); - } - - len += snprintf(buf + len, DMA_BUF_LEN - len, "\n"); - - len += snprintf(buf + len, DMA_BUF_LEN - len, - "qcu_stitch state: %2x qcu_fetch state: %2x\n", - (val[3] & 0x003c0000) >> 18, (val[3] & 0x03c00000) >> 22); - len += snprintf(buf + len, DMA_BUF_LEN - len, - "qcu_complete state: %2x dcu_complete state: %2x\n", - (val[3] & 0x1c000000) >> 26, (val[6] & 0x3)); - len += snprintf(buf + len, DMA_BUF_LEN - len, - "dcu_arb state: %2x dcu_fp state: %2x\n", - (val[5] & 0x06000000) >> 25, (val[5] & 0x38000000) >> 27); - len += snprintf(buf + len, DMA_BUF_LEN - len, - "chan_idle_dur: %3d chan_idle_dur_valid: %1d\n", - (val[6] & 0x000003fc) >> 2, (val[6] & 0x00000400) >> 10); - len += snprintf(buf + len, DMA_BUF_LEN - len, - "txfifo_valid_0: %1d txfifo_valid_1: %1d\n", - (val[6] & 0x00000800) >> 11, (val[6] & 0x00001000) >> 12); - len += snprintf(buf + len, DMA_BUF_LEN - len, - "txfifo_dcu_num_0: %2d txfifo_dcu_num_1: %2d\n", - (val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17); - - len += snprintf(buf + len, DMA_BUF_LEN - len, "pcu observe: 0x%x\n", - REG_READ_D(ah, AR_OBS_BUS_1)); - len += snprintf(buf + len, DMA_BUF_LEN - len, - "AR_CR: 0x%x\n", REG_READ_D(ah, AR_CR)); - - ath9k_ps_restore(sc); - - if (len > DMA_BUF_LEN) - len = DMA_BUF_LEN; - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - return retval; -} - -static const struct file_operations fops_dma = { - .read = read_file_dma, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - - -void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status) -{ - if (status) - sc->debug.stats.istats.total++; - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { - if (status & ATH9K_INT_RXLP) - sc->debug.stats.istats.rxlp++; - if (status & ATH9K_INT_RXHP) - sc->debug.stats.istats.rxhp++; - if (status & ATH9K_INT_BB_WATCHDOG) - sc->debug.stats.istats.bb_watchdog++; - } else { - if (status & ATH9K_INT_RX) - sc->debug.stats.istats.rxok++; - } - if (status & ATH9K_INT_RXEOL) - sc->debug.stats.istats.rxeol++; - if (status & ATH9K_INT_RXORN) - sc->debug.stats.istats.rxorn++; - if (status & ATH9K_INT_TX) - sc->debug.stats.istats.txok++; - if (status & ATH9K_INT_TXURN) - sc->debug.stats.istats.txurn++; - if (status & ATH9K_INT_RXPHY) - sc->debug.stats.istats.rxphyerr++; - if (status & ATH9K_INT_RXKCM) - sc->debug.stats.istats.rx_keycache_miss++; - if (status & ATH9K_INT_SWBA) - sc->debug.stats.istats.swba++; - if (status & ATH9K_INT_BMISS) - sc->debug.stats.istats.bmiss++; - if (status & ATH9K_INT_BNR) - sc->debug.stats.istats.bnr++; - if (status & ATH9K_INT_CST) - sc->debug.stats.istats.cst++; - if (status & ATH9K_INT_GTT) - sc->debug.stats.istats.gtt++; - if (status & ATH9K_INT_TIM) - sc->debug.stats.istats.tim++; - if (status & ATH9K_INT_CABEND) - sc->debug.stats.istats.cabend++; - if (status & ATH9K_INT_DTIMSYNC) - sc->debug.stats.istats.dtimsync++; - if (status & ATH9K_INT_DTIM) - sc->debug.stats.istats.dtim++; - if (status & ATH9K_INT_TSFOOR) - sc->debug.stats.istats.tsfoor++; - if (status & ATH9K_INT_MCI) - sc->debug.stats.istats.mci++; - if (status & ATH9K_INT_GENTIMER) - sc->debug.stats.istats.gen_timer++; -} - -static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - unsigned int len = 0; - int rv; - int mxlen = 4000; - char *buf = kmalloc(mxlen, GFP_KERNEL); - if (!buf) - return -ENOMEM; - -#define PR_IS(a, s) \ - do { \ - len += snprintf(buf + len, mxlen - len, \ - "%21s: %10u\n", a, \ - sc->debug.stats.istats.s); \ - } while (0) - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { - PR_IS("RXLP", rxlp); - PR_IS("RXHP", rxhp); - PR_IS("WATHDOG", bb_watchdog); - } else { - PR_IS("RX", rxok); - } - PR_IS("RXEOL", rxeol); - PR_IS("RXORN", rxorn); - PR_IS("TX", txok); - PR_IS("TXURN", txurn); - PR_IS("MIB", mib); - PR_IS("RXPHY", rxphyerr); - PR_IS("RXKCM", rx_keycache_miss); - PR_IS("SWBA", swba); - PR_IS("BMISS", bmiss); - PR_IS("BNR", bnr); - PR_IS("CST", cst); - PR_IS("GTT", gtt); - PR_IS("TIM", tim); - PR_IS("CABEND", cabend); - PR_IS("DTIMSYNC", dtimsync); - PR_IS("DTIM", dtim); - PR_IS("TSFOOR", tsfoor); - PR_IS("MCI", mci); - PR_IS("GENTIMER", gen_timer); - PR_IS("TOTAL", total); - - len += snprintf(buf + len, mxlen - len, - "SYNC_CAUSE stats:\n"); - - PR_IS("Sync-All", sync_cause_all); - PR_IS("RTC-IRQ", sync_rtc_irq); - PR_IS("MAC-IRQ", sync_mac_irq); - PR_IS("EEPROM-Illegal-Access", eeprom_illegal_access); - PR_IS("APB-Timeout", apb_timeout); - PR_IS("PCI-Mode-Conflict", pci_mode_conflict); - PR_IS("HOST1-Fatal", host1_fatal); - PR_IS("HOST1-Perr", host1_perr); - PR_IS("TRCV-FIFO-Perr", trcv_fifo_perr); - PR_IS("RADM-CPL-EP", radm_cpl_ep); - PR_IS("RADM-CPL-DLLP-Abort", radm_cpl_dllp_abort); - PR_IS("RADM-CPL-TLP-Abort", radm_cpl_tlp_abort); - PR_IS("RADM-CPL-ECRC-Err", radm_cpl_ecrc_err); - PR_IS("RADM-CPL-Timeout", radm_cpl_timeout); - PR_IS("Local-Bus-Timeout", local_timeout); - PR_IS("PM-Access", pm_access); - PR_IS("MAC-Awake", mac_awake); - PR_IS("MAC-Asleep", mac_asleep); - PR_IS("MAC-Sleep-Access", mac_sleep_access); - - if (len > mxlen) - len = mxlen; - - rv = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - return rv; -} - -static const struct file_operations fops_interrupt = { - .read = read_file_interrupt, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_xmit(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - char *buf; - unsigned int len = 0, size = 2048; - ssize_t retval = 0; - - buf = kzalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - len += sprintf(buf, "%30s %10s%10s%10s\n\n", - "BE", "BK", "VI", "VO"); - - PR("MPDUs Queued: ", queued); - PR("MPDUs Completed: ", completed); - PR("MPDUs XRetried: ", xretries); - PR("Aggregates: ", a_aggr); - PR("AMPDUs Queued HW:", a_queued_hw); - PR("AMPDUs Queued SW:", a_queued_sw); - PR("AMPDUs Completed:", a_completed); - PR("AMPDUs Retried: ", a_retries); - PR("AMPDUs XRetried: ", a_xretries); - PR("TXERR Filtered: ", txerr_filtered); - PR("FIFO Underrun: ", fifo_underrun); - PR("TXOP Exceeded: ", xtxop); - PR("TXTIMER Expiry: ", timer_exp); - PR("DESC CFG Error: ", desc_cfg_err); - PR("DATA Underrun: ", data_underrun); - PR("DELIM Underrun: ", delim_underrun); - PR("TX-Pkts-All: ", tx_pkts_all); - PR("TX-Bytes-All: ", tx_bytes_all); - PR("HW-put-tx-buf: ", puttxbuf); - PR("HW-tx-start: ", txstart); - PR("HW-tx-proc-desc: ", txprocdesc); - PR("TX-Failed: ", txfailed); - - if (len > size) - len = size; - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return retval; -} - -static ssize_t read_file_queues(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_txq *txq; - char *buf; - unsigned int len = 0, size = 1024; - ssize_t retval = 0; - int i; - char *qname[4] = {"VO", "VI", "BE", "BK"}; - - buf = kzalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - txq = sc->tx.txq_map[i]; - len += snprintf(buf + len, size - len, "(%s): ", qname[i]); - - ath_txq_lock(sc, txq); - - len += snprintf(buf + len, size - len, "%s: %d ", - "qnum", txq->axq_qnum); - len += snprintf(buf + len, size - len, "%s: %2d ", - "qdepth", txq->axq_depth); - len += snprintf(buf + len, size - len, "%s: %2d ", - "ampdu-depth", txq->axq_ampdu_depth); - len += snprintf(buf + len, size - len, "%s: %3d ", - "pending", txq->pending_frames); - len += snprintf(buf + len, size - len, "%s: %d\n", - "stopped", txq->stopped); - - ath_txq_unlock(sc, txq); - } - - if (len > size) - len = size; - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return retval; -} - -static ssize_t read_file_misc(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ieee80211_hw *hw = sc->hw; - struct ath9k_vif_iter_data iter_data; - char buf[512]; - unsigned int len = 0; - ssize_t retval = 0; - unsigned int reg; - u32 rxfilter; - - len += snprintf(buf + len, sizeof(buf) - len, - "BSSID: %pM\n", common->curbssid); - len += snprintf(buf + len, sizeof(buf) - len, - "BSSID-MASK: %pM\n", common->bssidmask); - len += snprintf(buf + len, sizeof(buf) - len, - "OPMODE: %s\n", ath_opmode_to_string(sc->sc_ah->opmode)); - - ath9k_ps_wakeup(sc); - rxfilter = ath9k_hw_getrxfilter(sc->sc_ah); - ath9k_ps_restore(sc); - - len += snprintf(buf + len, sizeof(buf) - len, - "RXFILTER: 0x%x", rxfilter); - - if (rxfilter & ATH9K_RX_FILTER_UCAST) - len += snprintf(buf + len, sizeof(buf) - len, " UCAST"); - if (rxfilter & ATH9K_RX_FILTER_MCAST) - len += snprintf(buf + len, sizeof(buf) - len, " MCAST"); - if (rxfilter & ATH9K_RX_FILTER_BCAST) - len += snprintf(buf + len, sizeof(buf) - len, " BCAST"); - if (rxfilter & ATH9K_RX_FILTER_CONTROL) - len += snprintf(buf + len, sizeof(buf) - len, " CONTROL"); - if (rxfilter & ATH9K_RX_FILTER_BEACON) - len += snprintf(buf + len, sizeof(buf) - len, " BEACON"); - if (rxfilter & ATH9K_RX_FILTER_PROM) - len += snprintf(buf + len, sizeof(buf) - len, " PROM"); - if (rxfilter & ATH9K_RX_FILTER_PROBEREQ) - len += snprintf(buf + len, sizeof(buf) - len, " PROBEREQ"); - if (rxfilter & ATH9K_RX_FILTER_PHYERR) - len += snprintf(buf + len, sizeof(buf) - len, " PHYERR"); - if (rxfilter & ATH9K_RX_FILTER_MYBEACON) - len += snprintf(buf + len, sizeof(buf) - len, " MYBEACON"); - if (rxfilter & ATH9K_RX_FILTER_COMP_BAR) - len += snprintf(buf + len, sizeof(buf) - len, " COMP_BAR"); - if (rxfilter & ATH9K_RX_FILTER_PSPOLL) - len += snprintf(buf + len, sizeof(buf) - len, " PSPOLL"); - if (rxfilter & ATH9K_RX_FILTER_PHYRADAR) - len += snprintf(buf + len, sizeof(buf) - len, " PHYRADAR"); - if (rxfilter & ATH9K_RX_FILTER_MCAST_BCAST_ALL) - len += snprintf(buf + len, sizeof(buf) - len, " MCAST_BCAST_ALL"); - if (rxfilter & ATH9K_RX_FILTER_CONTROL_WRAPPER) - len += snprintf(buf + len, sizeof(buf) - len, " CONTROL_WRAPPER"); - - len += snprintf(buf + len, sizeof(buf) - len, "\n"); - - reg = sc->sc_ah->imask; - - len += snprintf(buf + len, sizeof(buf) - len, "INTERRUPT-MASK: 0x%x", reg); - - if (reg & ATH9K_INT_SWBA) - len += snprintf(buf + len, sizeof(buf) - len, " SWBA"); - if (reg & ATH9K_INT_BMISS) - len += snprintf(buf + len, sizeof(buf) - len, " BMISS"); - if (reg & ATH9K_INT_CST) - len += snprintf(buf + len, sizeof(buf) - len, " CST"); - if (reg & ATH9K_INT_RX) - len += snprintf(buf + len, sizeof(buf) - len, " RX"); - if (reg & ATH9K_INT_RXHP) - len += snprintf(buf + len, sizeof(buf) - len, " RXHP"); - if (reg & ATH9K_INT_RXLP) - len += snprintf(buf + len, sizeof(buf) - len, " RXLP"); - if (reg & ATH9K_INT_BB_WATCHDOG) - len += snprintf(buf + len, sizeof(buf) - len, " BB_WATCHDOG"); - - len += snprintf(buf + len, sizeof(buf) - len, "\n"); - - ath9k_calculate_iter_data(hw, NULL, &iter_data); - - len += snprintf(buf + len, sizeof(buf) - len, - "VIF-COUNTS: AP: %i STA: %i MESH: %i WDS: %i" - " ADHOC: %i TOTAL: %hi BEACON-VIF: %hi\n", - iter_data.naps, iter_data.nstations, iter_data.nmeshes, - iter_data.nwds, iter_data.nadhocs, - sc->nvifs, sc->nbcnvifs); - - if (len > sizeof(buf)) - len = sizeof(buf); - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - return retval; -} - -static ssize_t read_file_reset(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - char buf[512]; - unsigned int len = 0; - - len += snprintf(buf + len, sizeof(buf) - len, - "%17s: %2d\n", "Baseband Hang", - sc->debug.stats.reset[RESET_TYPE_BB_HANG]); - len += snprintf(buf + len, sizeof(buf) - len, - "%17s: %2d\n", "Baseband Watchdog", - sc->debug.stats.reset[RESET_TYPE_BB_WATCHDOG]); - len += snprintf(buf + len, sizeof(buf) - len, - "%17s: %2d\n", "Fatal HW Error", - sc->debug.stats.reset[RESET_TYPE_FATAL_INT]); - len += snprintf(buf + len, sizeof(buf) - len, - "%17s: %2d\n", "TX HW error", - sc->debug.stats.reset[RESET_TYPE_TX_ERROR]); - len += snprintf(buf + len, sizeof(buf) - len, - "%17s: %2d\n", "TX Path Hang", - sc->debug.stats.reset[RESET_TYPE_TX_HANG]); - len += snprintf(buf + len, sizeof(buf) - len, - "%17s: %2d\n", "PLL RX Hang", - sc->debug.stats.reset[RESET_TYPE_PLL_HANG]); - len += snprintf(buf + len, sizeof(buf) - len, - "%17s: %2d\n", "MCI Reset", - sc->debug.stats.reset[RESET_TYPE_MCI]); - - if (len > sizeof(buf)) - len = sizeof(buf); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, - struct ath_tx_status *ts, struct ath_txq *txq, - unsigned int flags) -{ -#define TX_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].ts\ - [sc->debug.tsidx].c) - int qnum = txq->axq_qnum; - - TX_STAT_INC(qnum, tx_pkts_all); - sc->debug.stats.txstats[qnum].tx_bytes_all += bf->bf_mpdu->len; - - if (bf_isampdu(bf)) { - if (flags & ATH_TX_ERROR) - TX_STAT_INC(qnum, a_xretries); - else - TX_STAT_INC(qnum, a_completed); - } else { - if (ts->ts_status & ATH9K_TXERR_XRETRY) - TX_STAT_INC(qnum, xretries); - else - TX_STAT_INC(qnum, completed); - } - - if (ts->ts_status & ATH9K_TXERR_FILT) - TX_STAT_INC(qnum, txerr_filtered); - if (ts->ts_status & ATH9K_TXERR_FIFO) - TX_STAT_INC(qnum, fifo_underrun); - if (ts->ts_status & ATH9K_TXERR_XTXOP) - TX_STAT_INC(qnum, xtxop); - if (ts->ts_status & ATH9K_TXERR_TIMER_EXPIRED) - TX_STAT_INC(qnum, timer_exp); - if (ts->ts_flags & ATH9K_TX_DESC_CFG_ERR) - TX_STAT_INC(qnum, desc_cfg_err); - if (ts->ts_flags & ATH9K_TX_DATA_UNDERRUN) - TX_STAT_INC(qnum, data_underrun); - if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN) - TX_STAT_INC(qnum, delim_underrun); - -#ifdef CONFIG_ATH9K_MAC_DEBUG - spin_lock(&sc->debug.samp_lock); - TX_SAMP_DBG(jiffies) = jiffies; - TX_SAMP_DBG(rssi_ctl0) = ts->ts_rssi_ctl0; - TX_SAMP_DBG(rssi_ctl1) = ts->ts_rssi_ctl1; - TX_SAMP_DBG(rssi_ctl2) = ts->ts_rssi_ctl2; - TX_SAMP_DBG(rssi_ext0) = ts->ts_rssi_ext0; - TX_SAMP_DBG(rssi_ext1) = ts->ts_rssi_ext1; - TX_SAMP_DBG(rssi_ext2) = ts->ts_rssi_ext2; - TX_SAMP_DBG(rateindex) = ts->ts_rateindex; - TX_SAMP_DBG(isok) = !!(ts->ts_status & ATH9K_TXERR_MASK); - TX_SAMP_DBG(rts_fail_cnt) = ts->ts_shortretry; - TX_SAMP_DBG(data_fail_cnt) = ts->ts_longretry; - TX_SAMP_DBG(rssi) = ts->ts_rssi; - TX_SAMP_DBG(tid) = ts->tid; - TX_SAMP_DBG(qid) = ts->qid; - - if (ts->ts_flags & ATH9K_TX_BA) { - TX_SAMP_DBG(ba_low) = ts->ba_low; - TX_SAMP_DBG(ba_high) = ts->ba_high; - } else { - TX_SAMP_DBG(ba_low) = 0; - TX_SAMP_DBG(ba_high) = 0; - } - - sc->debug.tsidx = (sc->debug.tsidx + 1) % ATH_DBG_MAX_SAMPLES; - spin_unlock(&sc->debug.samp_lock); -#endif - -#undef TX_SAMP_DBG -} - -static const struct file_operations fops_xmit = { - .read = read_file_xmit, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static const struct file_operations fops_queues = { - .read = read_file_queues, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static const struct file_operations fops_misc = { - .read = read_file_misc, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static const struct file_operations fops_reset = { - .read = read_file_reset, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_recv(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ -#define PHY_ERR(s, p) \ - len += snprintf(buf + len, size - len, "%22s : %10u\n", s, \ - sc->debug.stats.rxstats.phy_err_stats[p]); - -#define RXS_ERR(s, e) \ - do { \ - len += snprintf(buf + len, size - len, \ - "%22s : %10u\n", s, \ - sc->debug.stats.rxstats.e); \ - } while (0) - - struct ath_softc *sc = file->private_data; - char *buf; - unsigned int len = 0, size = 1600; - ssize_t retval = 0; - - buf = kzalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - RXS_ERR("CRC ERR", crc_err); - RXS_ERR("DECRYPT CRC ERR", decrypt_crc_err); - RXS_ERR("PHY ERR", phy_err); - RXS_ERR("MIC ERR", mic_err); - RXS_ERR("PRE-DELIM CRC ERR", pre_delim_crc_err); - RXS_ERR("POST-DELIM CRC ERR", post_delim_crc_err); - RXS_ERR("DECRYPT BUSY ERR", decrypt_busy_err); - RXS_ERR("RX-LENGTH-ERR", rx_len_err); - RXS_ERR("RX-OOM-ERR", rx_oom_err); - RXS_ERR("RX-RATE-ERR", rx_rate_err); - RXS_ERR("RX-TOO-MANY-FRAGS", rx_too_many_frags_err); - - PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN); - PHY_ERR("TIMING ERR", ATH9K_PHYERR_TIMING); - PHY_ERR("PARITY ERR", ATH9K_PHYERR_PARITY); - PHY_ERR("RATE ERR", ATH9K_PHYERR_RATE); - PHY_ERR("LENGTH ERR", ATH9K_PHYERR_LENGTH); - PHY_ERR("RADAR ERR", ATH9K_PHYERR_RADAR); - PHY_ERR("SERVICE ERR", ATH9K_PHYERR_SERVICE); - PHY_ERR("TOR ERR", ATH9K_PHYERR_TOR); - PHY_ERR("OFDM-TIMING ERR", ATH9K_PHYERR_OFDM_TIMING); - PHY_ERR("OFDM-SIGNAL-PARITY ERR", ATH9K_PHYERR_OFDM_SIGNAL_PARITY); - PHY_ERR("OFDM-RATE ERR", ATH9K_PHYERR_OFDM_RATE_ILLEGAL); - PHY_ERR("OFDM-LENGTH ERR", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL); - PHY_ERR("OFDM-POWER-DROP ERR", ATH9K_PHYERR_OFDM_POWER_DROP); - PHY_ERR("OFDM-SERVICE ERR", ATH9K_PHYERR_OFDM_SERVICE); - PHY_ERR("OFDM-RESTART ERR", ATH9K_PHYERR_OFDM_RESTART); - PHY_ERR("FALSE-RADAR-EXT ERR", ATH9K_PHYERR_FALSE_RADAR_EXT); - PHY_ERR("CCK-TIMING ERR", ATH9K_PHYERR_CCK_TIMING); - PHY_ERR("CCK-HEADER-CRC ERR", ATH9K_PHYERR_CCK_HEADER_CRC); - PHY_ERR("CCK-RATE ERR", ATH9K_PHYERR_CCK_RATE_ILLEGAL); - PHY_ERR("CCK-SERVICE ERR", ATH9K_PHYERR_CCK_SERVICE); - PHY_ERR("CCK-RESTART ERR", ATH9K_PHYERR_CCK_RESTART); - PHY_ERR("CCK-LENGTH ERR", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL); - PHY_ERR("CCK-POWER-DROP ERR", ATH9K_PHYERR_CCK_POWER_DROP); - PHY_ERR("HT-CRC ERR", ATH9K_PHYERR_HT_CRC_ERROR); - PHY_ERR("HT-LENGTH ERR", ATH9K_PHYERR_HT_LENGTH_ILLEGAL); - PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL); - - RXS_ERR("RX-Pkts-All", rx_pkts_all); - RXS_ERR("RX-Bytes-All", rx_bytes_all); - RXS_ERR("RX-Beacons", rx_beacons); - RXS_ERR("RX-Frags", rx_frags); - RXS_ERR("RX-Spectral", rx_spectral); - - if (len > size) - len = size; - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return retval; - -#undef RXS_ERR -#undef PHY_ERR -} - -void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) -{ -#define RX_PHY_ERR_INC(c) sc->debug.stats.rxstats.phy_err_stats[c]++ -#define RX_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].rs\ - [sc->debug.rsidx].c) - - RX_STAT_INC(rx_pkts_all); - sc->debug.stats.rxstats.rx_bytes_all += rs->rs_datalen; - - if (rs->rs_status & ATH9K_RXERR_CRC) - RX_STAT_INC(crc_err); - if (rs->rs_status & ATH9K_RXERR_DECRYPT) - RX_STAT_INC(decrypt_crc_err); - if (rs->rs_status & ATH9K_RXERR_MIC) - RX_STAT_INC(mic_err); - if (rs->rs_status & ATH9K_RX_DELIM_CRC_PRE) - RX_STAT_INC(pre_delim_crc_err); - if (rs->rs_status & ATH9K_RX_DELIM_CRC_POST) - RX_STAT_INC(post_delim_crc_err); - if (rs->rs_status & ATH9K_RX_DECRYPT_BUSY) - RX_STAT_INC(decrypt_busy_err); - - if (rs->rs_status & ATH9K_RXERR_PHY) { - RX_STAT_INC(phy_err); - if (rs->rs_phyerr < ATH9K_PHYERR_MAX) - RX_PHY_ERR_INC(rs->rs_phyerr); - } - -#ifdef CONFIG_ATH9K_MAC_DEBUG - spin_lock(&sc->debug.samp_lock); - RX_SAMP_DBG(jiffies) = jiffies; - RX_SAMP_DBG(rssi_ctl0) = rs->rs_rssi_ctl0; - RX_SAMP_DBG(rssi_ctl1) = rs->rs_rssi_ctl1; - RX_SAMP_DBG(rssi_ctl2) = rs->rs_rssi_ctl2; - RX_SAMP_DBG(rssi_ext0) = rs->rs_rssi_ext0; - RX_SAMP_DBG(rssi_ext1) = rs->rs_rssi_ext1; - RX_SAMP_DBG(rssi_ext2) = rs->rs_rssi_ext2; - RX_SAMP_DBG(antenna) = rs->rs_antenna; - RX_SAMP_DBG(rssi) = rs->rs_rssi; - RX_SAMP_DBG(rate) = rs->rs_rate; - RX_SAMP_DBG(is_mybeacon) = rs->is_mybeacon; - - sc->debug.rsidx = (sc->debug.rsidx + 1) % ATH_DBG_MAX_SAMPLES; - spin_unlock(&sc->debug.samp_lock); - -#endif - -#undef RX_PHY_ERR_INC -#undef RX_SAMP_DBG -} - -static const struct file_operations fops_recv = { - .read = read_file_recv, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_spec_scan_ctl(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - char *mode = ""; - unsigned int len; - - switch (sc->spectral_mode) { - case SPECTRAL_DISABLED: - mode = "disable"; - break; - case SPECTRAL_BACKGROUND: - mode = "background"; - break; - case SPECTRAL_CHANSCAN: - mode = "chanscan"; - break; - case SPECTRAL_MANUAL: - mode = "manual"; - break; - } - len = strlen(mode); - return simple_read_from_buffer(user_buf, count, ppos, mode, len); -} - -static ssize_t write_file_spec_scan_ctl(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - char buf[32]; - ssize_t len; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - - if (strncmp("trigger", buf, 7) == 0) { - ath9k_spectral_scan_trigger(sc->hw); - } else if (strncmp("background", buf, 9) == 0) { - ath9k_spectral_scan_config(sc->hw, SPECTRAL_BACKGROUND); - ath_dbg(common, CONFIG, "spectral scan: background mode enabled\n"); - } else if (strncmp("chanscan", buf, 8) == 0) { - ath9k_spectral_scan_config(sc->hw, SPECTRAL_CHANSCAN); - ath_dbg(common, CONFIG, "spectral scan: channel scan mode enabled\n"); - } else if (strncmp("manual", buf, 6) == 0) { - ath9k_spectral_scan_config(sc->hw, SPECTRAL_MANUAL); - ath_dbg(common, CONFIG, "spectral scan: manual mode enabled\n"); - } else if (strncmp("disable", buf, 7) == 0) { - ath9k_spectral_scan_config(sc->hw, SPECTRAL_DISABLED); - ath_dbg(common, CONFIG, "spectral scan: disabled\n"); - } else { - return -EINVAL; - } - - return count; -} - -static const struct file_operations fops_spec_scan_ctl = { - .read = read_file_spec_scan_ctl, - .write = write_file_spec_scan_ctl, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_spectral_short_repeat(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - char buf[32]; - unsigned int len; - - len = sprintf(buf, "%d\n", sc->spec_config.short_repeat); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_spectral_short_repeat(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - unsigned long val; - char buf[32]; - ssize_t len; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (kstrtoul(buf, 0, &val)) - return -EINVAL; - - if (val < 0 || val > 1) - return -EINVAL; - - sc->spec_config.short_repeat = val; - return count; -} - -static const struct file_operations fops_spectral_short_repeat = { - .read = read_file_spectral_short_repeat, - .write = write_file_spectral_short_repeat, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_spectral_count(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - char buf[32]; - unsigned int len; - - len = sprintf(buf, "%d\n", sc->spec_config.count); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_spectral_count(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - unsigned long val; - char buf[32]; - ssize_t len; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (kstrtoul(buf, 0, &val)) - return -EINVAL; - - if (val < 0 || val > 255) - return -EINVAL; - - sc->spec_config.count = val; - return count; -} - -static const struct file_operations fops_spectral_count = { - .read = read_file_spectral_count, - .write = write_file_spectral_count, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_spectral_period(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - char buf[32]; - unsigned int len; - - len = sprintf(buf, "%d\n", sc->spec_config.period); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_spectral_period(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - unsigned long val; - char buf[32]; - ssize_t len; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (kstrtoul(buf, 0, &val)) - return -EINVAL; - - if (val < 0 || val > 255) - return -EINVAL; - - sc->spec_config.period = val; - return count; -} - -static const struct file_operations fops_spectral_period = { - .read = read_file_spectral_period, - .write = write_file_spectral_period, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_spectral_fft_period(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - char buf[32]; - unsigned int len; - - len = sprintf(buf, "%d\n", sc->spec_config.fft_period); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_spectral_fft_period(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - unsigned long val; - char buf[32]; - ssize_t len; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (kstrtoul(buf, 0, &val)) - return -EINVAL; - - if (val < 0 || val > 15) - return -EINVAL; - - sc->spec_config.fft_period = val; - return count; -} - -static const struct file_operations fops_spectral_fft_period = { - .read = read_file_spectral_fft_period, - .write = write_file_spectral_fft_period, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static struct dentry *create_buf_file_handler(const char *filename, - struct dentry *parent, - umode_t mode, - struct rchan_buf *buf, - int *is_global) -{ - struct dentry *buf_file; - - buf_file = debugfs_create_file(filename, mode, parent, buf, - &relay_file_operations); - *is_global = 1; - return buf_file; -} - -static int remove_buf_file_handler(struct dentry *dentry) -{ - debugfs_remove(dentry); - - return 0; -} - -void ath_debug_send_fft_sample(struct ath_softc *sc, - struct fft_sample_tlv *fft_sample_tlv) -{ - int length; - if (!sc->rfs_chan_spec_scan) - return; - - length = __be16_to_cpu(fft_sample_tlv->length) + - sizeof(*fft_sample_tlv); - relay_write(sc->rfs_chan_spec_scan, fft_sample_tlv, length); -} - -static struct rchan_callbacks rfs_spec_scan_cb = { - .create_buf_file = create_buf_file_handler, - .remove_buf_file = remove_buf_file_handler, -}; - - -static ssize_t read_file_regidx(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - char buf[32]; - unsigned int len; - - len = sprintf(buf, "0x%08x\n", sc->debug.regidx); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_regidx(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - unsigned long regidx; - char buf[32]; - ssize_t len; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (strict_strtoul(buf, 0, ®idx)) - return -EINVAL; - - sc->debug.regidx = regidx; - return count; -} - -static const struct file_operations fops_regidx = { - .read = read_file_regidx, - .write = write_file_regidx, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_regval(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_hw *ah = sc->sc_ah; - char buf[32]; - unsigned int len; - u32 regval; - - ath9k_ps_wakeup(sc); - regval = REG_READ_D(ah, sc->debug.regidx); - ath9k_ps_restore(sc); - len = sprintf(buf, "0x%08x\n", regval); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_regval(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_hw *ah = sc->sc_ah; - unsigned long regval; - char buf[32]; - ssize_t len; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (strict_strtoul(buf, 0, ®val)) - return -EINVAL; - - ath9k_ps_wakeup(sc); - REG_WRITE_D(ah, sc->debug.regidx, regval); - ath9k_ps_restore(sc); - return count; -} - -static const struct file_operations fops_regval = { - .read = read_file_regval, - .write = write_file_regval, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -#define REGDUMP_LINE_SIZE 20 - -static int open_file_regdump(struct inode *inode, struct file *file) -{ - struct ath_softc *sc = inode->i_private; - unsigned int len = 0; - u8 *buf; - int i; - unsigned long num_regs, regdump_len, max_reg_offset; - - max_reg_offset = AR_SREV_9300_20_OR_LATER(sc->sc_ah) ? 0x16bd4 : 0xb500; - num_regs = max_reg_offset / 4 + 1; - regdump_len = num_regs * REGDUMP_LINE_SIZE + 1; - buf = vmalloc(regdump_len); - if (!buf) - return -ENOMEM; - - ath9k_ps_wakeup(sc); - for (i = 0; i < num_regs; i++) - len += scnprintf(buf + len, regdump_len - len, - "0x%06x 0x%08x\n", i << 2, REG_READ(sc->sc_ah, i << 2)); - ath9k_ps_restore(sc); - - file->private_data = buf; - - return 0; -} - -static const struct file_operations fops_regdump = { - .open = open_file_regdump, - .read = ath9k_debugfs_read_buf, - .release = ath9k_debugfs_release_buf, - .owner = THIS_MODULE, - .llseek = default_llseek,/* read accesses f_pos */ -}; - -static ssize_t read_file_dump_nfcal(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_hw *ah = sc->sc_ah; - struct ath9k_nfcal_hist *h = sc->caldata.nfCalHist; - struct ath_common *common = ath9k_hw_common(ah); - struct ieee80211_conf *conf = &common->hw->conf; - u32 len = 0, size = 1500; - u32 i, j; - ssize_t retval = 0; - char *buf; - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; - u8 nread; - - buf = kzalloc(size, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - len += snprintf(buf + len, size - len, - "Channel Noise Floor : %d\n", ah->noise); - len += snprintf(buf + len, size - len, - "Chain | privNF | # Readings | NF Readings\n"); - for (i = 0; i < NUM_NF_READINGS; i++) { - if (!(chainmask & (1 << i)) || - ((i >= AR5416_MAX_CHAINS) && !conf_is_ht40(conf))) - continue; - - nread = AR_PHY_CCA_FILTERWINDOW_LENGTH - h[i].invalidNFcount; - len += snprintf(buf + len, size - len, " %d\t %d\t %d\t\t", - i, h[i].privNF, nread); - for (j = 0; j < nread; j++) - len += snprintf(buf + len, size - len, - " %d", h[i].nfCalBuffer[j]); - len += snprintf(buf + len, size - len, "\n"); - } - - if (len > size) - len = size; - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return retval; -} - -static const struct file_operations fops_dump_nfcal = { - .read = read_file_dump_nfcal, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_hw *ah = sc->sc_ah; - u32 len = 0, size = 1500; - ssize_t retval = 0; - char *buf; - - buf = kzalloc(size, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - len = ah->eep_ops->dump_eeprom(ah, true, buf, len, size); - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return retval; -} - -static const struct file_operations fops_base_eeprom = { - .read = read_file_base_eeprom, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath_hw *ah = sc->sc_ah; - u32 len = 0, size = 6000; - char *buf; - size_t retval; - - buf = kzalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - len = ah->eep_ops->dump_eeprom(ah, false, buf, len, size); - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return retval; -} - -static const struct file_operations fops_modal_eeprom = { - .read = read_file_modal_eeprom, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -#ifdef CONFIG_ATH9K_MAC_DEBUG - -void ath9k_debug_samp_bb_mac(struct ath_softc *sc) -{ -#define ATH_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].c) - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - unsigned long flags; - int i; - - ath9k_ps_wakeup(sc); - - spin_lock_bh(&sc->debug.samp_lock); - - spin_lock_irqsave(&common->cc_lock, flags); - ath_hw_cycle_counters_update(common); - - ATH_SAMP_DBG(cc.cycles) = common->cc_ani.cycles; - ATH_SAMP_DBG(cc.rx_busy) = common->cc_ani.rx_busy; - ATH_SAMP_DBG(cc.rx_frame) = common->cc_ani.rx_frame; - ATH_SAMP_DBG(cc.tx_frame) = common->cc_ani.tx_frame; - spin_unlock_irqrestore(&common->cc_lock, flags); - - ATH_SAMP_DBG(noise) = ah->noise; - - REG_WRITE_D(ah, AR_MACMISC, - ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) | - (AR_MACMISC_MISC_OBS_BUS_1 << - AR_MACMISC_MISC_OBS_BUS_MSB_S))); - - for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++) - ATH_SAMP_DBG(dma_dbg_reg_vals[i]) = REG_READ_D(ah, - AR_DMADBG_0 + (i * sizeof(u32))); - - ATH_SAMP_DBG(pcu_obs) = REG_READ_D(ah, AR_OBS_BUS_1); - ATH_SAMP_DBG(pcu_cr) = REG_READ_D(ah, AR_CR); - - memcpy(ATH_SAMP_DBG(nfCalHist), sc->caldata.nfCalHist, - sizeof(ATH_SAMP_DBG(nfCalHist))); - - sc->debug.sampidx = (sc->debug.sampidx + 1) % ATH_DBG_MAX_SAMPLES; - spin_unlock_bh(&sc->debug.samp_lock); - ath9k_ps_restore(sc); - -#undef ATH_SAMP_DBG -} - -static int open_file_bb_mac_samps(struct inode *inode, struct file *file) -{ -#define ATH_SAMP_DBG(c) bb_mac_samp[sampidx].c - struct ath_softc *sc = inode->i_private; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ieee80211_conf *conf = &common->hw->conf; - struct ath_dbg_bb_mac_samp *bb_mac_samp; - struct ath9k_nfcal_hist *h; - int i, j, qcuOffset = 0, dcuOffset = 0; - u32 *qcuBase, *dcuBase, size = 30000, len = 0; - u32 sampidx = 0; - u8 *buf; - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; - u8 nread; - - if (test_bit(SC_OP_INVALID, &sc->sc_flags)) - return -EAGAIN; - - buf = vmalloc(size); - if (!buf) - return -ENOMEM; - bb_mac_samp = vmalloc(sizeof(*bb_mac_samp) * ATH_DBG_MAX_SAMPLES); - if (!bb_mac_samp) { - vfree(buf); - return -ENOMEM; - } - /* Account the current state too */ - ath9k_debug_samp_bb_mac(sc); - - spin_lock_bh(&sc->debug.samp_lock); - memcpy(bb_mac_samp, sc->debug.bb_mac_samp, - sizeof(*bb_mac_samp) * ATH_DBG_MAX_SAMPLES); - len += snprintf(buf + len, size - len, - "Current Sample Index: %d\n", sc->debug.sampidx); - spin_unlock_bh(&sc->debug.samp_lock); - - len += snprintf(buf + len, size - len, - "Raw DMA Debug Dump:\n"); - len += snprintf(buf + len, size - len, "Sample |\t"); - for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++) - len += snprintf(buf + len, size - len, " DMA Reg%d |\t", i); - len += snprintf(buf + len, size - len, "\n"); - - for (sampidx = 0; sampidx < ATH_DBG_MAX_SAMPLES; sampidx++) { - len += snprintf(buf + len, size - len, "%d\t", sampidx); - - for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++) - len += snprintf(buf + len, size - len, " %08x\t", - ATH_SAMP_DBG(dma_dbg_reg_vals[i])); - len += snprintf(buf + len, size - len, "\n"); - } - len += snprintf(buf + len, size - len, "\n"); - - len += snprintf(buf + len, size - len, - "Sample Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n"); - for (sampidx = 0; sampidx < ATH_DBG_MAX_SAMPLES; sampidx++) { - qcuBase = &ATH_SAMP_DBG(dma_dbg_reg_vals[0]); - dcuBase = &ATH_SAMP_DBG(dma_dbg_reg_vals[4]); - - for (i = 0; i < ATH9K_NUM_QUEUES; i++, - qcuOffset += 4, dcuOffset += 5) { - if (i == 8) { - qcuOffset = 0; - qcuBase++; - } - - if (i == 6) { - dcuOffset = 0; - dcuBase++; - } - if (!sc->debug.stats.txstats[i].queued) - continue; - - len += snprintf(buf + len, size - len, - "%4d %7d %2x %1x %2x %2x\n", - sampidx, i, - (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset, - (*qcuBase & (0x8 << qcuOffset)) >> - (qcuOffset + 3), - ATH_SAMP_DBG(dma_dbg_reg_vals[2]) & - (0x7 << (i * 3)) >> (i * 3), - (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset); - } - len += snprintf(buf + len, size - len, "\n"); - } - len += snprintf(buf + len, size - len, - "samp qcu_sh qcu_fh qcu_comp dcu_comp dcu_arb dcu_fp " - "ch_idle_dur ch_idle_dur_val txfifo_val0 txfifo_val1 " - "txfifo_dcu0 txfifo_dcu1 pcu_obs AR_CR\n"); - - for (sampidx = 0; sampidx < ATH_DBG_MAX_SAMPLES; sampidx++) { - qcuBase = &ATH_SAMP_DBG(dma_dbg_reg_vals[0]); - dcuBase = &ATH_SAMP_DBG(dma_dbg_reg_vals[4]); - - len += snprintf(buf + len, size - len, "%4d %5x %5x ", sampidx, - (ATH_SAMP_DBG(dma_dbg_reg_vals[3]) & 0x003c0000) >> 18, - (ATH_SAMP_DBG(dma_dbg_reg_vals[3]) & 0x03c00000) >> 22); - len += snprintf(buf + len, size - len, "%7x %8x ", - (ATH_SAMP_DBG(dma_dbg_reg_vals[3]) & 0x1c000000) >> 26, - (ATH_SAMP_DBG(dma_dbg_reg_vals[6]) & 0x3)); - len += snprintf(buf + len, size - len, "%7x %7x ", - (ATH_SAMP_DBG(dma_dbg_reg_vals[5]) & 0x06000000) >> 25, - (ATH_SAMP_DBG(dma_dbg_reg_vals[5]) & 0x38000000) >> 27); - len += snprintf(buf + len, size - len, "%7d %12d ", - (ATH_SAMP_DBG(dma_dbg_reg_vals[6]) & 0x000003fc) >> 2, - (ATH_SAMP_DBG(dma_dbg_reg_vals[6]) & 0x00000400) >> 10); - len += snprintf(buf + len, size - len, "%12d %12d ", - (ATH_SAMP_DBG(dma_dbg_reg_vals[6]) & 0x00000800) >> 11, - (ATH_SAMP_DBG(dma_dbg_reg_vals[6]) & 0x00001000) >> 12); - len += snprintf(buf + len, size - len, "%12d %12d ", - (ATH_SAMP_DBG(dma_dbg_reg_vals[6]) & 0x0001e000) >> 13, - (ATH_SAMP_DBG(dma_dbg_reg_vals[6]) & 0x001e0000) >> 17); - len += snprintf(buf + len, size - len, "0x%07x 0x%07x\n", - ATH_SAMP_DBG(pcu_obs), ATH_SAMP_DBG(pcu_cr)); - } - - len += snprintf(buf + len, size - len, - "Sample ChNoise Chain privNF #Reading Readings\n"); - for (sampidx = 0; sampidx < ATH_DBG_MAX_SAMPLES; sampidx++) { - h = ATH_SAMP_DBG(nfCalHist); - if (!ATH_SAMP_DBG(noise)) - continue; - - for (i = 0; i < NUM_NF_READINGS; i++) { - if (!(chainmask & (1 << i)) || - ((i >= AR5416_MAX_CHAINS) && !conf_is_ht40(conf))) - continue; - - nread = AR_PHY_CCA_FILTERWINDOW_LENGTH - - h[i].invalidNFcount; - len += snprintf(buf + len, size - len, - "%4d %5d %4d\t %d\t %d\t", - sampidx, ATH_SAMP_DBG(noise), - i, h[i].privNF, nread); - for (j = 0; j < nread; j++) - len += snprintf(buf + len, size - len, - " %d", h[i].nfCalBuffer[j]); - len += snprintf(buf + len, size - len, "\n"); - } - } - len += snprintf(buf + len, size - len, "\nCycle counters:\n" - "Sample Total Rxbusy Rxframes Txframes\n"); - for (sampidx = 0; sampidx < ATH_DBG_MAX_SAMPLES; sampidx++) { - if (!ATH_SAMP_DBG(cc.cycles)) - continue; - len += snprintf(buf + len, size - len, - "%4d %08x %08x %08x %08x\n", - sampidx, ATH_SAMP_DBG(cc.cycles), - ATH_SAMP_DBG(cc.rx_busy), - ATH_SAMP_DBG(cc.rx_frame), - ATH_SAMP_DBG(cc.tx_frame)); - } - - len += snprintf(buf + len, size - len, "Tx status Dump :\n"); - len += snprintf(buf + len, size - len, - "Sample rssi:- ctl0 ctl1 ctl2 ext0 ext1 ext2 comb " - "isok rts_fail data_fail rate tid qid " - "ba_low ba_high tx_before(ms)\n"); - for (sampidx = 0; sampidx < ATH_DBG_MAX_SAMPLES; sampidx++) { - for (i = 0; i < ATH_DBG_MAX_SAMPLES; i++) { - if (!ATH_SAMP_DBG(ts[i].jiffies)) - continue; - len += snprintf(buf + len, size - len, "%-14d" - "%-4d %-4d %-4d %-4d %-4d %-4d %-4d %-4d %-8d " - "%-9d %-4d %-3d %-3d %08x %08x %-11d\n", - sampidx, - ATH_SAMP_DBG(ts[i].rssi_ctl0), - ATH_SAMP_DBG(ts[i].rssi_ctl1), - ATH_SAMP_DBG(ts[i].rssi_ctl2), - ATH_SAMP_DBG(ts[i].rssi_ext0), - ATH_SAMP_DBG(ts[i].rssi_ext1), - ATH_SAMP_DBG(ts[i].rssi_ext2), - ATH_SAMP_DBG(ts[i].rssi), - ATH_SAMP_DBG(ts[i].isok), - ATH_SAMP_DBG(ts[i].rts_fail_cnt), - ATH_SAMP_DBG(ts[i].data_fail_cnt), - ATH_SAMP_DBG(ts[i].rateindex), - ATH_SAMP_DBG(ts[i].tid), - ATH_SAMP_DBG(ts[i].qid), - ATH_SAMP_DBG(ts[i].ba_low), - ATH_SAMP_DBG(ts[i].ba_high), - jiffies_to_msecs(jiffies - - ATH_SAMP_DBG(ts[i].jiffies))); - } - } - - len += snprintf(buf + len, size - len, "Rx status Dump :\n"); - len += snprintf(buf + len, size - len, "Sample rssi:- ctl0 ctl1 ctl2 " - "ext0 ext1 ext2 comb beacon ant rate rx_before(ms)\n"); - for (sampidx = 0; sampidx < ATH_DBG_MAX_SAMPLES; sampidx++) { - for (i = 0; i < ATH_DBG_MAX_SAMPLES; i++) { - if (!ATH_SAMP_DBG(rs[i].jiffies)) - continue; - len += snprintf(buf + len, size - len, "%-14d" - "%-4d %-4d %-4d %-4d %-4d %-4d %-4d %-9s %-2d %02x %-13d\n", - sampidx, - ATH_SAMP_DBG(rs[i].rssi_ctl0), - ATH_SAMP_DBG(rs[i].rssi_ctl1), - ATH_SAMP_DBG(rs[i].rssi_ctl2), - ATH_SAMP_DBG(rs[i].rssi_ext0), - ATH_SAMP_DBG(rs[i].rssi_ext1), - ATH_SAMP_DBG(rs[i].rssi_ext2), - ATH_SAMP_DBG(rs[i].rssi), - ATH_SAMP_DBG(rs[i].is_mybeacon) ? - "True" : "False", - ATH_SAMP_DBG(rs[i].antenna), - ATH_SAMP_DBG(rs[i].rate), - jiffies_to_msecs(jiffies - - ATH_SAMP_DBG(rs[i].jiffies))); - } - } - - vfree(bb_mac_samp); - file->private_data = buf; - - return 0; -#undef ATH_SAMP_DBG -} - -static const struct file_operations fops_samps = { - .open = open_file_bb_mac_samps, - .read = ath9k_debugfs_read_buf, - .release = ath9k_debugfs_release_buf, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -#endif - -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT -static ssize_t read_file_btcoex(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - u32 len = 0, size = 1500; - char *buf; - size_t retval; - - buf = kzalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - if (!sc->sc_ah->common.btcoex_enabled) { - len = snprintf(buf, size, "%s\n", - "BTCOEX is disabled"); - goto exit; - } - - len = ath9k_dump_btcoex(sc, buf, size); -exit: - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return retval; -} - -static const struct file_operations fops_btcoex = { - .read = read_file_btcoex, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; -#endif - -static ssize_t read_file_node_stat(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_node *an = file->private_data; - struct ath_softc *sc = an->sc; - struct ath_atx_tid *tid; - struct ath_atx_ac *ac; - struct ath_txq *txq; - u32 len = 0, size = 4096; - char *buf; - size_t retval; - int tidno, acno; - - buf = kzalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - if (!an->sta->ht_cap.ht_supported) { - len = snprintf(buf, size, "%s\n", - "HT not supported"); - goto exit; - } - - len = snprintf(buf, size, "Max-AMPDU: %d\n", - an->maxampdu); - len += snprintf(buf + len, size - len, "MPDU Density: %d\n\n", - an->mpdudensity); - - len += snprintf(buf + len, size - len, - "%2s%7s\n", "AC", "SCHED"); - - for (acno = 0, ac = &an->ac[acno]; - acno < IEEE80211_NUM_ACS; acno++, ac++) { - txq = ac->txq; - ath_txq_lock(sc, txq); - len += snprintf(buf + len, size - len, - "%2d%7d\n", - acno, ac->sched); - ath_txq_unlock(sc, txq); - } - - len += snprintf(buf + len, size - len, - "\n%3s%11s%10s%10s%10s%10s%9s%6s%8s\n", - "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE", - "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED"); - - for (tidno = 0, tid = &an->tid[tidno]; - tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { - txq = tid->ac->txq; - ath_txq_lock(sc, txq); - len += snprintf(buf + len, size - len, - "%3d%11d%10d%10d%10d%10d%9d%6d%8d\n", - tid->tidno, tid->seq_start, tid->seq_next, - tid->baw_size, tid->baw_head, tid->baw_tail, - tid->bar_index, tid->sched, tid->paused); - ath_txq_unlock(sc, txq); - } -exit: - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return retval; -} - -static const struct file_operations fops_node_stat = { - .read = read_file_node_stat, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -void ath9k_sta_add_debugfs(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct dentry *dir) -{ - struct ath_node *an = (struct ath_node *)sta->drv_priv; - an->node_stat = debugfs_create_file("node_stat", S_IRUGO, - dir, an, &fops_node_stat); -} - -void ath9k_sta_remove_debugfs(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct dentry *dir) -{ - struct ath_node *an = (struct ath_node *)sta->drv_priv; - debugfs_remove(an->node_stat); -} - -/* Ethtool support for get-stats */ - -#define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" -static const char ath9k_gstrings_stats[][ETH_GSTRING_LEN] = { - "tx_pkts_nic", - "tx_bytes_nic", - "rx_pkts_nic", - "rx_bytes_nic", - AMKSTR(d_tx_pkts), - AMKSTR(d_tx_bytes), - AMKSTR(d_tx_mpdus_queued), - AMKSTR(d_tx_mpdus_completed), - AMKSTR(d_tx_mpdu_xretries), - AMKSTR(d_tx_aggregates), - AMKSTR(d_tx_ampdus_queued_hw), - AMKSTR(d_tx_ampdus_queued_sw), - AMKSTR(d_tx_ampdus_completed), - AMKSTR(d_tx_ampdu_retries), - AMKSTR(d_tx_ampdu_xretries), - AMKSTR(d_tx_fifo_underrun), - AMKSTR(d_tx_op_exceeded), - AMKSTR(d_tx_timer_expiry), - AMKSTR(d_tx_desc_cfg_err), - AMKSTR(d_tx_data_underrun), - AMKSTR(d_tx_delim_underrun), - "d_rx_crc_err", - "d_rx_decrypt_crc_err", - "d_rx_phy_err", - "d_rx_mic_err", - "d_rx_pre_delim_crc_err", - "d_rx_post_delim_crc_err", - "d_rx_decrypt_busy_err", - - "d_rx_phyerr_radar", - "d_rx_phyerr_ofdm_timing", - "d_rx_phyerr_cck_timing", - -}; -#define ATH9K_SSTATS_LEN ARRAY_SIZE(ath9k_gstrings_stats) - -void ath9k_get_et_strings(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - u32 sset, u8 *data) -{ - if (sset == ETH_SS_STATS) - memcpy(data, *ath9k_gstrings_stats, - sizeof(ath9k_gstrings_stats)); -} - -int ath9k_get_et_sset_count(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, int sset) -{ - if (sset == ETH_SS_STATS) - return ATH9K_SSTATS_LEN; - return 0; -} - -#define AWDATA(elem) \ - do { \ - data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].elem; \ - data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].elem; \ - data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].elem; \ - data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].elem; \ - } while (0) - -#define AWDATA_RX(elem) \ - do { \ - data[i++] = sc->debug.stats.rxstats.elem; \ - } while (0) - -void ath9k_get_et_stats(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ethtool_stats *stats, u64 *data) -{ - struct ath_softc *sc = hw->priv; - int i = 0; - - data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_pkts_all + - sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_pkts_all + - sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_pkts_all + - sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_pkts_all); - data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_bytes_all + - sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_bytes_all + - sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_bytes_all + - sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_bytes_all); - AWDATA_RX(rx_pkts_all); - AWDATA_RX(rx_bytes_all); - - AWDATA(tx_pkts_all); - AWDATA(tx_bytes_all); - AWDATA(queued); - AWDATA(completed); - AWDATA(xretries); - AWDATA(a_aggr); - AWDATA(a_queued_hw); - AWDATA(a_queued_sw); - AWDATA(a_completed); - AWDATA(a_retries); - AWDATA(a_xretries); - AWDATA(fifo_underrun); - AWDATA(xtxop); - AWDATA(timer_exp); - AWDATA(desc_cfg_err); - AWDATA(data_underrun); - AWDATA(delim_underrun); - - AWDATA_RX(crc_err); - AWDATA_RX(decrypt_crc_err); - AWDATA_RX(phy_err); - AWDATA_RX(mic_err); - AWDATA_RX(pre_delim_crc_err); - AWDATA_RX(post_delim_crc_err); - AWDATA_RX(decrypt_busy_err); - - AWDATA_RX(phy_err_stats[ATH9K_PHYERR_RADAR]); - AWDATA_RX(phy_err_stats[ATH9K_PHYERR_OFDM_TIMING]); - AWDATA_RX(phy_err_stats[ATH9K_PHYERR_CCK_TIMING]); - - WARN_ON(i != ATH9K_SSTATS_LEN); -} - -void ath9k_deinit_debug(struct ath_softc *sc) -{ - if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->rfs_chan_spec_scan) { - relay_close(sc->rfs_chan_spec_scan); - sc->rfs_chan_spec_scan = NULL; - } -} - -int ath9k_init_debug(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath_softc *sc = (struct ath_softc *) common->priv; - - sc->debug.debugfs_phy = debugfs_create_dir("ath9k", - sc->hw->wiphy->debugfsdir); - if (!sc->debug.debugfs_phy) - return -ENOMEM; - -#ifdef CONFIG_ATH_DEBUG - debugfs_create_file("debug", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, - sc, &fops_debug); -#endif - - ath9k_dfs_init_debug(sc); - - debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_dma); - debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_interrupt); - debugfs_create_file("xmit", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_xmit); - debugfs_create_file("queues", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_queues); - debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, - &sc->tx.txq_max_pending[IEEE80211_AC_BK]); - debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, - &sc->tx.txq_max_pending[IEEE80211_AC_BE]); - debugfs_create_u32("qlen_vi", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, - &sc->tx.txq_max_pending[IEEE80211_AC_VI]); - debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, - &sc->tx.txq_max_pending[IEEE80211_AC_VO]); - debugfs_create_file("misc", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_misc); - debugfs_create_file("reset", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_reset); - debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_recv); - debugfs_create_file("rx_chainmask", S_IRUSR | S_IWUSR, - sc->debug.debugfs_phy, sc, &fops_rx_chainmask); - debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR, - sc->debug.debugfs_phy, sc, &fops_tx_chainmask); - debugfs_create_file("disable_ani", S_IRUSR | S_IWUSR, - sc->debug.debugfs_phy, sc, &fops_disable_ani); - debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, - &sc->sc_ah->config.enable_paprd); - debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, - sc, &fops_regidx); - debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, - sc, &fops_regval); - debugfs_create_bool("ignore_extcca", S_IRUSR | S_IWUSR, - sc->debug.debugfs_phy, - &ah->config.cwm_ignore_extcca); - debugfs_create_file("regdump", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_regdump); - debugfs_create_file("dump_nfcal", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_dump_nfcal); - debugfs_create_file("base_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_base_eeprom); - debugfs_create_file("modal_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_modal_eeprom); - sc->rfs_chan_spec_scan = relay_open("spectral_scan", - sc->debug.debugfs_phy, - 1024, 256, &rfs_spec_scan_cb, - NULL); - debugfs_create_file("spectral_scan_ctl", S_IRUSR | S_IWUSR, - sc->debug.debugfs_phy, sc, - &fops_spec_scan_ctl); - debugfs_create_file("spectral_short_repeat", S_IRUSR | S_IWUSR, - sc->debug.debugfs_phy, sc, - &fops_spectral_short_repeat); - debugfs_create_file("spectral_count", S_IRUSR | S_IWUSR, - sc->debug.debugfs_phy, sc, &fops_spectral_count); - debugfs_create_file("spectral_period", S_IRUSR | S_IWUSR, - sc->debug.debugfs_phy, sc, &fops_spectral_period); - debugfs_create_file("spectral_fft_period", S_IRUSR | S_IWUSR, - sc->debug.debugfs_phy, sc, - &fops_spectral_fft_period); - -#ifdef CONFIG_ATH9K_MAC_DEBUG - debugfs_create_file("samples", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_samps); -#endif - debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, - sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); - debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, - sc->debug.debugfs_phy, &sc->sc_ah->gpio_val); - debugfs_create_file("diversity", S_IRUSR | S_IWUSR, - sc->debug.debugfs_phy, sc, &fops_ant_diversity); -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT - debugfs_create_file("btcoex", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_btcoex); -#endif - return 0; -} diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h deleted file mode 100644 index 9d49aab8b989..000000000000 --- a/drivers/net/wireless/ath/ath9k/debug.h +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef DEBUG_H -#define DEBUG_H - -#include "hw.h" -#include "rc.h" -#include "dfs_debug.h" - -struct ath_txq; -struct ath_buf; -struct fft_sample_tlv; - -#ifdef CONFIG_ATH9K_DEBUGFS -#define TX_STAT_INC(q, c) sc->debug.stats.txstats[q].c++ -#define RESET_STAT_INC(sc, type) sc->debug.stats.reset[type]++ -#else -#define TX_STAT_INC(q, c) do { } while (0) -#define RESET_STAT_INC(sc, type) do { } while (0) -#endif - -enum ath_reset_type { - RESET_TYPE_BB_HANG, - RESET_TYPE_BB_WATCHDOG, - RESET_TYPE_FATAL_INT, - RESET_TYPE_TX_ERROR, - RESET_TYPE_TX_HANG, - RESET_TYPE_PLL_HANG, - RESET_TYPE_MAC_HANG, - RESET_TYPE_BEACON_STUCK, - RESET_TYPE_MCI, - __RESET_TYPE_MAX -}; - -#ifdef CONFIG_ATH9K_DEBUGFS - -/** - * struct ath_interrupt_stats - Contains statistics about interrupts - * @total: Total no. of interrupts generated so far - * @rxok: RX with no errors - * @rxlp: RX with low priority RX - * @rxhp: RX with high priority, uapsd only - * @rxeol: RX with no more RXDESC available - * @rxorn: RX FIFO overrun - * @txok: TX completed at the requested rate - * @txurn: TX FIFO underrun - * @mib: MIB regs reaching its threshold - * @rxphyerr: RX with phy errors - * @rx_keycache_miss: RX with key cache misses - * @swba: Software Beacon Alert - * @bmiss: Beacon Miss - * @bnr: Beacon Not Ready - * @cst: Carrier Sense TImeout - * @gtt: Global TX Timeout - * @tim: RX beacon TIM occurrence - * @cabend: RX End of CAB traffic - * @dtimsync: DTIM sync lossage - * @dtim: RX Beacon with DTIM - * @bb_watchdog: Baseband watchdog - * @tsfoor: TSF out of range, indicates that the corrected TSF received - * from a beacon differs from the PCU's internal TSF by more than a - * (programmable) threshold - * @local_timeout: Internal bus timeout. - * @mci: MCI interrupt, specific to MCI based BTCOEX chipsets - * @gen_timer: Generic hardware timer interrupt - */ -struct ath_interrupt_stats { - u32 total; - u32 rxok; - u32 rxlp; - u32 rxhp; - u32 rxeol; - u32 rxorn; - u32 txok; - u32 txeol; - u32 txurn; - u32 mib; - u32 rxphyerr; - u32 rx_keycache_miss; - u32 swba; - u32 bmiss; - u32 bnr; - u32 cst; - u32 gtt; - u32 tim; - u32 cabend; - u32 dtimsync; - u32 dtim; - u32 bb_watchdog; - u32 tsfoor; - u32 mci; - u32 gen_timer; - - /* Sync-cause stats */ - u32 sync_cause_all; - u32 sync_rtc_irq; - u32 sync_mac_irq; - u32 eeprom_illegal_access; - u32 apb_timeout; - u32 pci_mode_conflict; - u32 host1_fatal; - u32 host1_perr; - u32 trcv_fifo_perr; - u32 radm_cpl_ep; - u32 radm_cpl_dllp_abort; - u32 radm_cpl_tlp_abort; - u32 radm_cpl_ecrc_err; - u32 radm_cpl_timeout; - u32 local_timeout; - u32 pm_access; - u32 mac_awake; - u32 mac_asleep; - u32 mac_sleep_access; -}; - - -/** - * struct ath_tx_stats - Statistics about TX - * @tx_pkts_all: No. of total frames transmitted, including ones that - may have had errors. - * @tx_bytes_all: No. of total bytes transmitted, including ones that - may have had errors. - * @queued: Total MPDUs (non-aggr) queued - * @completed: Total MPDUs (non-aggr) completed - * @a_aggr: Total no. of aggregates queued - * @a_queued_hw: Total AMPDUs queued to hardware - * @a_queued_sw: Total AMPDUs queued to software queues - * @a_completed: Total AMPDUs completed - * @a_retries: No. of AMPDUs retried (SW) - * @a_xretries: No. of AMPDUs dropped due to xretries - * @txerr_filtered: No. of frames with TXERR_FILT flag set. - * @fifo_underrun: FIFO underrun occurrences - Valid only for: - - non-aggregate condition. - - first packet of aggregate. - * @xtxop: No. of frames filtered because of TXOP limit - * @timer_exp: Transmit timer expiry - * @desc_cfg_err: Descriptor configuration errors - * @data_urn: TX data underrun errors - * @delim_urn: TX delimiter underrun errors - * @puttxbuf: Number of times hardware was given txbuf to write. - * @txstart: Number of times hardware was told to start tx. - * @txprocdesc: Number of times tx descriptor was processed - * @txfailed: Out-of-memory or other errors in xmit path. - */ -struct ath_tx_stats { - u32 tx_pkts_all; - u32 tx_bytes_all; - u32 queued; - u32 completed; - u32 xretries; - u32 a_aggr; - u32 a_queued_hw; - u32 a_queued_sw; - u32 a_completed; - u32 a_retries; - u32 a_xretries; - u32 txerr_filtered; - u32 fifo_underrun; - u32 xtxop; - u32 timer_exp; - u32 desc_cfg_err; - u32 data_underrun; - u32 delim_underrun; - u32 puttxbuf; - u32 txstart; - u32 txprocdesc; - u32 txfailed; -}; - -/* - * Various utility macros to print TX/Queue counters. - */ -#define PR_QNUM(_n) sc->tx.txq_map[_n]->axq_qnum -#define TXSTATS sc->debug.stats.txstats -#define PR(str, elem) \ - do { \ - len += snprintf(buf + len, size - len, \ - "%s%13u%11u%10u%10u\n", str, \ - TXSTATS[PR_QNUM(IEEE80211_AC_BE)].elem, \ - TXSTATS[PR_QNUM(IEEE80211_AC_BK)].elem, \ - TXSTATS[PR_QNUM(IEEE80211_AC_VI)].elem, \ - TXSTATS[PR_QNUM(IEEE80211_AC_VO)].elem); \ - } while(0) - -#define RX_STAT_INC(c) (sc->debug.stats.rxstats.c++) - -/** - * struct ath_rx_stats - RX Statistics - * @rx_pkts_all: No. of total frames received, including ones that - may have had errors. - * @rx_bytes_all: No. of total bytes received, including ones that - may have had errors. - * @crc_err: No. of frames with incorrect CRC value - * @decrypt_crc_err: No. of frames whose CRC check failed after - decryption process completed - * @phy_err: No. of frames whose reception failed because the PHY - encountered an error - * @mic_err: No. of frames with incorrect TKIP MIC verification failure - * @pre_delim_crc_err: Pre-Frame delimiter CRC error detections - * @post_delim_crc_err: Post-Frame delimiter CRC error detections - * @decrypt_busy_err: Decryption interruptions counter - * @phy_err_stats: Individual PHY error statistics - * @rx_len_err: No. of frames discarded due to bad length. - * @rx_oom_err: No. of frames dropped due to OOM issues. - * @rx_rate_err: No. of frames dropped due to rate errors. - * @rx_too_many_frags_err: Frames dropped due to too-many-frags received. - * @rx_beacons: No. of beacons received. - * @rx_frags: No. of rx-fragements received. - * @rx_spectral: No of spectral packets received. - */ -struct ath_rx_stats { - u32 rx_pkts_all; - u32 rx_bytes_all; - u32 crc_err; - u32 decrypt_crc_err; - u32 phy_err; - u32 mic_err; - u32 pre_delim_crc_err; - u32 post_delim_crc_err; - u32 decrypt_busy_err; - u32 phy_err_stats[ATH9K_PHYERR_MAX]; - u32 rx_len_err; - u32 rx_oom_err; - u32 rx_rate_err; - u32 rx_too_many_frags_err; - u32 rx_beacons; - u32 rx_frags; - u32 rx_spectral; -}; - -struct ath_stats { - struct ath_interrupt_stats istats; - struct ath_tx_stats txstats[ATH9K_NUM_TX_QUEUES]; - struct ath_rx_stats rxstats; - struct ath_dfs_stats dfs_stats; - u32 reset[__RESET_TYPE_MAX]; -}; - -#define ATH_DBG_MAX_SAMPLES 10 -struct ath_dbg_bb_mac_samp { - u32 dma_dbg_reg_vals[ATH9K_NUM_DMA_DEBUG_REGS]; - u32 pcu_obs, pcu_cr, noise; - struct { - u64 jiffies; - int8_t rssi_ctl0; - int8_t rssi_ctl1; - int8_t rssi_ctl2; - int8_t rssi_ext0; - int8_t rssi_ext1; - int8_t rssi_ext2; - int8_t rssi; - bool isok; - u8 rts_fail_cnt; - u8 data_fail_cnt; - u8 rateindex; - u8 qid; - u8 tid; - u32 ba_low; - u32 ba_high; - } ts[ATH_DBG_MAX_SAMPLES]; - struct { - u64 jiffies; - int8_t rssi_ctl0; - int8_t rssi_ctl1; - int8_t rssi_ctl2; - int8_t rssi_ext0; - int8_t rssi_ext1; - int8_t rssi_ext2; - int8_t rssi; - bool is_mybeacon; - u8 antenna; - u8 rate; - } rs[ATH_DBG_MAX_SAMPLES]; - struct ath_cycle_counters cc; - struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; -}; - -struct ath9k_debug { - struct dentry *debugfs_phy; - u32 regidx; - struct ath_stats stats; -#ifdef CONFIG_ATH9K_MAC_DEBUG - spinlock_t samp_lock; - struct ath_dbg_bb_mac_samp bb_mac_samp[ATH_DBG_MAX_SAMPLES]; - u8 sampidx; - u8 tsidx; - u8 rsidx; -#endif -}; - -int ath9k_init_debug(struct ath_hw *ah); -void ath9k_deinit_debug(struct ath_softc *sc); - -void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); -void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, - struct ath_tx_status *ts, struct ath_txq *txq, - unsigned int flags); -void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs); -int ath9k_get_et_sset_count(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, int sset); -void ath9k_get_et_stats(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ethtool_stats *stats, u64 *data); -void ath9k_get_et_strings(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - u32 sset, u8 *data); -void ath9k_sta_add_debugfs(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct dentry *dir); -void ath9k_sta_remove_debugfs(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct dentry *dir); - -void ath_debug_send_fft_sample(struct ath_softc *sc, - struct fft_sample_tlv *fft_sample); - -#else - -#define RX_STAT_INC(c) /* NOP */ - -static inline int ath9k_init_debug(struct ath_hw *ah) -{ - return 0; -} - -static inline void ath9k_deinit_debug(struct ath_softc *sc) -{ -} - -static inline void ath_debug_stat_interrupt(struct ath_softc *sc, - enum ath9k_int status) -{ -} - -static inline void ath_debug_stat_tx(struct ath_softc *sc, - struct ath_buf *bf, - struct ath_tx_status *ts, - struct ath_txq *txq, - unsigned int flags) -{ -} - -static inline void ath_debug_stat_rx(struct ath_softc *sc, - struct ath_rx_status *rs) -{ -} - -#endif /* CONFIG_ATH9K_DEBUGFS */ - -#ifdef CONFIG_ATH9K_MAC_DEBUG - -void ath9k_debug_samp_bb_mac(struct ath_softc *sc); - -#else - -static inline void ath9k_debug_samp_bb_mac(struct ath_softc *sc) -{ -} - -#endif - - -#endif /* DEBUG_H */ diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c deleted file mode 100644 index 7187d3671512..000000000000 --- a/drivers/net/wireless/ath/ath9k/dfs.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * Copyright (c) 2011 Neratec Solutions AG - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "hw.h" -#include "hw-ops.h" -#include "ath9k.h" -#include "dfs.h" -#include "dfs_debug.h" - -/* internal struct to pass radar data */ -struct ath_radar_data { - u8 pulse_bw_info; - u8 rssi; - u8 ext_rssi; - u8 pulse_length_ext; - u8 pulse_length_pri; -}; - -/* convert pulse duration to usecs, considering clock mode */ -static u32 dur_to_usecs(struct ath_hw *ah, u32 dur) -{ - const u32 AR93X_NSECS_PER_DUR = 800; - const u32 AR93X_NSECS_PER_DUR_FAST = (8000 / 11); - u32 nsecs; - - if (IS_CHAN_A_FAST_CLOCK(ah, ah->curchan)) - nsecs = dur * AR93X_NSECS_PER_DUR_FAST; - else - nsecs = dur * AR93X_NSECS_PER_DUR; - - return (nsecs + 500) / 1000; -} - -#define PRI_CH_RADAR_FOUND 0x01 -#define EXT_CH_RADAR_FOUND 0x02 -static bool -ath9k_postprocess_radar_event(struct ath_softc *sc, - struct ath_radar_data *ard, - struct pulse_event *pe) -{ - u8 rssi; - u16 dur; - - /* - * Only the last 2 bits of the BW info are relevant, they indicate - * which channel the radar was detected in. - */ - ard->pulse_bw_info &= 0x03; - - switch (ard->pulse_bw_info) { - case PRI_CH_RADAR_FOUND: - /* radar in ctrl channel */ - dur = ard->pulse_length_pri; - DFS_STAT_INC(sc, pri_phy_errors); - /* - * cannot use ctrl channel RSSI - * if extension channel is stronger - */ - rssi = (ard->ext_rssi >= (ard->rssi + 3)) ? 0 : ard->rssi; - break; - case EXT_CH_RADAR_FOUND: - /* radar in extension channel */ - dur = ard->pulse_length_ext; - DFS_STAT_INC(sc, ext_phy_errors); - /* - * cannot use extension channel RSSI - * if control channel is stronger - */ - rssi = (ard->rssi >= (ard->ext_rssi + 12)) ? 0 : ard->ext_rssi; - break; - case (PRI_CH_RADAR_FOUND | EXT_CH_RADAR_FOUND): - /* - * Conducted testing, when pulse is on DC, both pri and ext - * durations are reported to be same - * - * Radiated testing, when pulse is on DC, different pri and - * ext durations are reported, so take the larger of the two - */ - if (ard->pulse_length_ext >= ard->pulse_length_pri) - dur = ard->pulse_length_ext; - else - dur = ard->pulse_length_pri; - DFS_STAT_INC(sc, dc_phy_errors); - - /* when both are present use stronger one */ - rssi = (ard->rssi < ard->ext_rssi) ? ard->ext_rssi : ard->rssi; - break; - default: - /* - * Bogus bandwidth info was received in descriptor, - * so ignore this PHY error - */ - DFS_STAT_INC(sc, bwinfo_discards); - return false; - } - - if (rssi == 0) { - DFS_STAT_INC(sc, rssi_discards); - return false; - } - - /* - * TODO: check chirping pulses - * checks for chirping are dependent on the DFS regulatory domain - * used, which is yet TBD - */ - - /* convert duration to usecs */ - pe->width = dur_to_usecs(sc->sc_ah, dur); - pe->rssi = rssi; - - DFS_STAT_INC(sc, pulses_detected); - return true; -} -#undef PRI_CH_RADAR_FOUND -#undef EXT_CH_RADAR_FOUND - -/* - * DFS: check PHY-error for radar pulse and feed the detector - */ -void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data, - struct ath_rx_status *rs, u64 mactime) -{ - struct ath_radar_data ard; - u16 datalen; - char *vdata_end; - struct pulse_event pe; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - - DFS_STAT_INC(sc, pulses_total); - if ((rs->rs_phyerr != ATH9K_PHYERR_RADAR) && - (rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT)) { - ath_dbg(common, DFS, - "Error: rs_phyer=0x%x not a radar error\n", - rs->rs_phyerr); - DFS_STAT_INC(sc, pulses_no_dfs); - return; - } - - datalen = rs->rs_datalen; - if (datalen == 0) { - DFS_STAT_INC(sc, datalen_discards); - return; - } - - ard.rssi = rs->rs_rssi_ctl0; - ard.ext_rssi = rs->rs_rssi_ext0; - - /* - * hardware stores this as 8 bit signed value. - * we will cap it at 0 if it is a negative number - */ - if (ard.rssi & 0x80) - ard.rssi = 0; - if (ard.ext_rssi & 0x80) - ard.ext_rssi = 0; - - vdata_end = (char *)data + datalen; - ard.pulse_bw_info = vdata_end[-1]; - ard.pulse_length_ext = vdata_end[-2]; - ard.pulse_length_pri = vdata_end[-3]; - pe.freq = ah->curchan->channel; - pe.ts = mactime; - if (ath9k_postprocess_radar_event(sc, &ard, &pe)) { - struct dfs_pattern_detector *pd = sc->dfs_detector; - static u64 last_ts; - ath_dbg(common, DFS, - "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, " - "width=%d, rssi=%d, delta_ts=%llu\n", - pe.freq, pe.ts, pe.width, pe.rssi, pe.ts-last_ts); - last_ts = pe.ts; - DFS_STAT_INC(sc, pulses_processed); - if (pd != NULL && pd->add_pulse(pd, &pe)) { - DFS_STAT_INC(sc, radar_detected); - ieee80211_radar_detected(sc->hw); - } - } -} diff --git a/drivers/net/wireless/ath/ath9k/dfs.h b/drivers/net/wireless/ath/ath9k/dfs.h deleted file mode 100644 index 3c839f06a06a..000000000000 --- a/drivers/net/wireless/ath/ath9k/dfs.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * Copyright (c) 2011 Neratec Solutions AG - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef ATH9K_DFS_H -#define ATH9K_DFS_H -#include "dfs_pattern_detector.h" - -#if defined(CONFIG_ATH9K_DFS_CERTIFIED) -/** - * ath9k_dfs_process_phyerr - process radar PHY error - * @sc: ath_softc - * @data: RX payload data - * @rs: RX status after processing descriptor - * @mactime: receive time - * - * This function is called whenever the HW DFS module detects a radar - * pulse and reports it as a PHY error. - * - * The radar information provided as raw payload data is validated and - * filtered for false pulses. Events passing all tests are forwarded to - * the DFS detector for pattern detection. - */ -void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data, - struct ath_rx_status *rs, u64 mactime); -#else -static inline void -ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data, - struct ath_rx_status *rs, u64 mactime) { } -#endif - -#endif /* ATH9K_DFS_H */ diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.c b/drivers/net/wireless/ath/ath9k/dfs_debug.c deleted file mode 100644 index b7611b7bbe43..000000000000 --- a/drivers/net/wireless/ath/ath9k/dfs_debug.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * Copyright (c) 2011 Neratec Solutions AG - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -#include "ath9k.h" -#include "dfs_debug.h" - - -struct ath_dfs_pool_stats global_dfs_pool_stats = { 0 }; - -#define ATH9K_DFS_STAT(s, p) \ - len += snprintf(buf + len, size - len, "%28s : %10u\n", s, \ - sc->debug.stats.dfs_stats.p); -#define ATH9K_DFS_POOL_STAT(s, p) \ - len += snprintf(buf + len, size - len, "%28s : %10u\n", s, \ - global_dfs_pool_stats.p); - -static ssize_t read_file_dfs(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - struct ath9k_hw_version *hw_ver = &sc->sc_ah->hw_version; - char *buf; - unsigned int len = 0, size = 8000; - ssize_t retval = 0; - - buf = kzalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - len += snprintf(buf + len, size - len, "DFS support for " - "macVersion = 0x%x, macRev = 0x%x: %s\n", - hw_ver->macVersion, hw_ver->macRev, - (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_DFS) ? - "enabled" : "disabled"); - len += snprintf(buf + len, size - len, "Pulse detector statistics:\n"); - ATH9K_DFS_STAT("pulse events reported ", pulses_total); - ATH9K_DFS_STAT("invalid pulse events ", pulses_no_dfs); - ATH9K_DFS_STAT("DFS pulses detected ", pulses_detected); - ATH9K_DFS_STAT("Datalen discards ", datalen_discards); - ATH9K_DFS_STAT("RSSI discards ", rssi_discards); - ATH9K_DFS_STAT("BW info discards ", bwinfo_discards); - ATH9K_DFS_STAT("Primary channel pulses ", pri_phy_errors); - ATH9K_DFS_STAT("Secondary channel pulses", ext_phy_errors); - ATH9K_DFS_STAT("Dual channel pulses ", dc_phy_errors); - len += snprintf(buf + len, size - len, "Radar detector statistics " - "(current DFS region: %d)\n", sc->dfs_detector->region); - ATH9K_DFS_STAT("Pulse events processed ", pulses_processed); - ATH9K_DFS_STAT("Radars detected ", radar_detected); - len += snprintf(buf + len, size - len, "Global Pool statistics:\n"); - ATH9K_DFS_POOL_STAT("Pool references ", pool_reference); - ATH9K_DFS_POOL_STAT("Pulses allocated ", pulse_allocated); - ATH9K_DFS_POOL_STAT("Pulses alloc error ", pulse_alloc_error); - ATH9K_DFS_POOL_STAT("Pulses in use ", pulse_used); - ATH9K_DFS_POOL_STAT("Seqs. allocated ", pseq_allocated); - ATH9K_DFS_POOL_STAT("Seqs. alloc error ", pseq_alloc_error); - ATH9K_DFS_POOL_STAT("Seqs. in use ", pseq_used); - - if (len > size) - len = size; - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return retval; -} - -/* magic number to prevent accidental reset of DFS statistics */ -#define DFS_STATS_RESET_MAGIC 0x80000000 -static ssize_t write_file_dfs(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - unsigned long val; - char buf[32]; - ssize_t len; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (strict_strtoul(buf, 0, &val)) - return -EINVAL; - - if (val == DFS_STATS_RESET_MAGIC) - memset(&sc->debug.stats.dfs_stats, 0, - sizeof(sc->debug.stats.dfs_stats)); - return count; -} - -static ssize_t write_file_simulate_radar(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_softc *sc = file->private_data; - - ieee80211_radar_detected(sc->hw); - - return count; -} - -static const struct file_operations fops_simulate_radar = { - .write = write_file_simulate_radar, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static const struct file_operations fops_dfs_stats = { - .read = read_file_dfs, - .write = write_file_dfs, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -void ath9k_dfs_init_debug(struct ath_softc *sc) -{ - debugfs_create_file("dfs_stats", S_IRUSR, - sc->debug.debugfs_phy, sc, &fops_dfs_stats); - debugfs_create_file("dfs_simulate_radar", S_IWUSR, - sc->debug.debugfs_phy, sc, &fops_simulate_radar); -} diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.h b/drivers/net/wireless/ath/ath9k/dfs_debug.h deleted file mode 100644 index e36810a4b585..000000000000 --- a/drivers/net/wireless/ath/ath9k/dfs_debug.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * Copyright (c) 2011 Neratec Solutions AG - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -#ifndef ATH9K_DFS_DEBUG_H -#define ATH9K_DFS_DEBUG_H - -#include "hw.h" - -/** - * struct ath_dfs_stats - DFS Statistics per wiphy - * @pulses_total: pulses reported by HW - * @pulses_no_dfs: pulses wrongly reported as DFS - * @pulses_detected: pulses detected so far - * @datalen_discards: pulses discarded due to invalid datalen - * @rssi_discards: pulses discarded due to invalid RSSI - * @bwinfo_discards: pulses discarded due to invalid BW info - * @pri_phy_errors: pulses reported for primary channel - * @ext_phy_errors: pulses reported for extension channel - * @dc_phy_errors: pulses reported for primary + extension channel - * @pulses_processed: pulses forwarded to detector - * @radar_detected: radars detected - */ -struct ath_dfs_stats { - /* pulse stats */ - u32 pulses_total; - u32 pulses_no_dfs; - u32 pulses_detected; - u32 datalen_discards; - u32 rssi_discards; - u32 bwinfo_discards; - u32 pri_phy_errors; - u32 ext_phy_errors; - u32 dc_phy_errors; - /* pattern detection stats */ - u32 pulses_processed; - u32 radar_detected; -}; - -/** - * struct ath_dfs_pool_stats - DFS Statistics for global pools - */ -struct ath_dfs_pool_stats { - u32 pool_reference; - u32 pulse_allocated; - u32 pulse_alloc_error; - u32 pulse_used; - u32 pseq_allocated; - u32 pseq_alloc_error; - u32 pseq_used; -}; -#if defined(CONFIG_ATH9K_DFS_DEBUGFS) - -#define DFS_STAT_INC(sc, c) (sc->debug.stats.dfs_stats.c++) -void ath9k_dfs_init_debug(struct ath_softc *sc); - -#define DFS_POOL_STAT_INC(c) (global_dfs_pool_stats.c++) -#define DFS_POOL_STAT_DEC(c) (global_dfs_pool_stats.c--) -extern struct ath_dfs_pool_stats global_dfs_pool_stats; - -#else - -#define DFS_STAT_INC(sc, c) do { } while (0) -static inline void ath9k_dfs_init_debug(struct ath_softc *sc) { } - -#define DFS_POOL_STAT_INC(c) do { } while (0) -#define DFS_POOL_STAT_DEC(c) do { } while (0) -#endif /* CONFIG_ATH9K_DFS_DEBUGFS */ - -#endif /* ATH9K_DFS_DEBUG_H */ diff --git a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c deleted file mode 100644 index 491305c81fce..000000000000 --- a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright (c) 2012 Neratec Solutions AG - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -#include "dfs_pattern_detector.h" -#include "dfs_pri_detector.h" -#include "ath9k.h" - -/* - * tolerated deviation of radar time stamp in usecs on both sides - * TODO: this might need to be HW-dependent - */ -#define PRI_TOLERANCE 16 - -/** - * struct radar_types - contains array of patterns defined for one DFS domain - * @domain: DFS regulatory domain - * @num_radar_types: number of radar types to follow - * @radar_types: radar types array - */ -struct radar_types { - enum nl80211_dfs_regions region; - u32 num_radar_types; - const struct radar_detector_specs *radar_types; -}; - -/* percentage on ppb threshold to trigger detection */ -#define MIN_PPB_THRESH 50 -#define PPB_THRESH(PPB) ((PPB * MIN_PPB_THRESH + 50) / 100) -#define PRF2PRI(PRF) ((1000000 + PRF / 2) / PRF) -/* percentage of pulse width tolerance */ -#define WIDTH_TOLERANCE 5 -#define WIDTH_LOWER(X) ((X*(100-WIDTH_TOLERANCE)+50)/100) -#define WIDTH_UPPER(X) ((X*(100+WIDTH_TOLERANCE)+50)/100) - -#define ETSI_PATTERN(ID, WMIN, WMAX, PMIN, PMAX, PRF, PPB) \ -{ \ - ID, WIDTH_LOWER(WMIN), WIDTH_UPPER(WMAX), \ - (PRF2PRI(PMAX) - PRI_TOLERANCE), \ - (PRF2PRI(PMIN) * PRF + PRI_TOLERANCE), PRF, PPB * PRF, \ - PPB_THRESH(PPB), PRI_TOLERANCE, \ -} - -/* radar types as defined by ETSI EN-301-893 v1.5.1 */ -static const struct radar_detector_specs etsi_radar_ref_types_v15[] = { - ETSI_PATTERN(0, 0, 1, 700, 700, 1, 18), - ETSI_PATTERN(1, 0, 5, 200, 1000, 1, 10), - ETSI_PATTERN(2, 0, 15, 200, 1600, 1, 15), - ETSI_PATTERN(3, 0, 15, 2300, 4000, 1, 25), - ETSI_PATTERN(4, 20, 30, 2000, 4000, 1, 20), - ETSI_PATTERN(5, 0, 2, 300, 400, 3, 10), - ETSI_PATTERN(6, 0, 2, 400, 1200, 3, 15), -}; - -static const struct radar_types etsi_radar_types_v15 = { - .region = NL80211_DFS_ETSI, - .num_radar_types = ARRAY_SIZE(etsi_radar_ref_types_v15), - .radar_types = etsi_radar_ref_types_v15, -}; - -/* for now, we support ETSI radar types, FCC and JP are TODO */ -static const struct radar_types *dfs_domains[] = { - &etsi_radar_types_v15, -}; - -/** - * get_dfs_domain_radar_types() - get radar types for a given DFS domain - * @param domain DFS domain - * @return radar_types ptr on success, NULL if DFS domain is not supported - */ -static const struct radar_types * -get_dfs_domain_radar_types(enum nl80211_dfs_regions region) -{ - u32 i; - for (i = 0; i < ARRAY_SIZE(dfs_domains); i++) { - if (dfs_domains[i]->region == region) - return dfs_domains[i]; - } - return NULL; -} - -/** - * struct channel_detector - detector elements for a DFS channel - * @head: list_head - * @freq: frequency for this channel detector in MHz - * @detectors: array of dynamically created detector elements for this freq - * - * Channel detectors are required to provide multi-channel DFS detection, e.g. - * to support off-channel scanning. A pattern detector has a list of channels - * radar pulses have been reported for in the past. - */ -struct channel_detector { - struct list_head head; - u16 freq; - struct pri_detector **detectors; -}; - -/* channel_detector_reset() - reset detector lines for a given channel */ -static void channel_detector_reset(struct dfs_pattern_detector *dpd, - struct channel_detector *cd) -{ - u32 i; - if (cd == NULL) - return; - for (i = 0; i < dpd->num_radar_types; i++) - cd->detectors[i]->reset(cd->detectors[i], dpd->last_pulse_ts); -} - -/* channel_detector_exit() - destructor */ -static void channel_detector_exit(struct dfs_pattern_detector *dpd, - struct channel_detector *cd) -{ - u32 i; - if (cd == NULL) - return; - list_del(&cd->head); - for (i = 0; i < dpd->num_radar_types; i++) { - struct pri_detector *de = cd->detectors[i]; - if (de != NULL) - de->exit(de); - } - kfree(cd->detectors); - kfree(cd); -} - -static struct channel_detector * -channel_detector_create(struct dfs_pattern_detector *dpd, u16 freq) -{ - u32 sz, i; - struct channel_detector *cd; - struct ath_common *common = ath9k_hw_common(dpd->ah); - - cd = kmalloc(sizeof(*cd), GFP_ATOMIC); - if (cd == NULL) - goto fail; - - INIT_LIST_HEAD(&cd->head); - cd->freq = freq; - sz = sizeof(cd->detectors) * dpd->num_radar_types; - cd->detectors = kzalloc(sz, GFP_ATOMIC); - if (cd->detectors == NULL) - goto fail; - - for (i = 0; i < dpd->num_radar_types; i++) { - const struct radar_detector_specs *rs = &dpd->radar_spec[i]; - struct pri_detector *de = pri_detector_init(rs); - if (de == NULL) - goto fail; - cd->detectors[i] = de; - } - list_add(&cd->head, &dpd->channel_detectors); - return cd; - -fail: - ath_dbg(common, DFS, - "failed to allocate channel_detector for freq=%d\n", freq); - channel_detector_exit(dpd, cd); - return NULL; -} - -/** - * channel_detector_get() - get channel detector for given frequency - * @param dpd instance pointer - * @param freq frequency in MHz - * @return pointer to channel detector on success, NULL otherwise - * - * Return existing channel detector for the given frequency or return a - * newly create one. - */ -static struct channel_detector * -channel_detector_get(struct dfs_pattern_detector *dpd, u16 freq) -{ - struct channel_detector *cd; - list_for_each_entry(cd, &dpd->channel_detectors, head) { - if (cd->freq == freq) - return cd; - } - return channel_detector_create(dpd, freq); -} - -/* - * DFS Pattern Detector - */ - -/* dpd_reset(): reset all channel detectors */ -static void dpd_reset(struct dfs_pattern_detector *dpd) -{ - struct channel_detector *cd; - if (!list_empty(&dpd->channel_detectors)) - list_for_each_entry(cd, &dpd->channel_detectors, head) - channel_detector_reset(dpd, cd); - -} -static void dpd_exit(struct dfs_pattern_detector *dpd) -{ - struct channel_detector *cd, *cd0; - if (!list_empty(&dpd->channel_detectors)) - list_for_each_entry_safe(cd, cd0, &dpd->channel_detectors, head) - channel_detector_exit(dpd, cd); - kfree(dpd); -} - -static bool -dpd_add_pulse(struct dfs_pattern_detector *dpd, struct pulse_event *event) -{ - u32 i; - struct channel_detector *cd; - - /* - * pulses received for a non-supported or un-initialized - * domain are treated as detected radars for fail-safety - */ - if (dpd->region == NL80211_DFS_UNSET) - return true; - - cd = channel_detector_get(dpd, event->freq); - if (cd == NULL) - return false; - - dpd->last_pulse_ts = event->ts; - /* reset detector on time stamp wraparound, caused by TSF reset */ - if (event->ts < dpd->last_pulse_ts) - dpd_reset(dpd); - - /* do type individual pattern matching */ - for (i = 0; i < dpd->num_radar_types; i++) { - struct pri_detector *pd = cd->detectors[i]; - struct pri_sequence *ps = pd->add_pulse(pd, event); - if (ps != NULL) { - ath_dbg(ath9k_hw_common(dpd->ah), DFS, - "DFS: radar found on freq=%d: id=%d, pri=%d, " - "count=%d, count_false=%d\n", - event->freq, pd->rs->type_id, - ps->pri, ps->count, ps->count_falses); - channel_detector_reset(dpd, cd); - return true; - } - } - return false; -} - -static bool dpd_set_domain(struct dfs_pattern_detector *dpd, - enum nl80211_dfs_regions region) -{ - const struct radar_types *rt; - struct channel_detector *cd, *cd0; - - if (dpd->region == region) - return true; - - dpd->region = NL80211_DFS_UNSET; - - rt = get_dfs_domain_radar_types(region); - if (rt == NULL) - return false; - - /* delete all channel detectors for previous DFS domain */ - if (!list_empty(&dpd->channel_detectors)) - list_for_each_entry_safe(cd, cd0, &dpd->channel_detectors, head) - channel_detector_exit(dpd, cd); - dpd->radar_spec = rt->radar_types; - dpd->num_radar_types = rt->num_radar_types; - - dpd->region = region; - return true; -} - -static struct dfs_pattern_detector default_dpd = { - .exit = dpd_exit, - .set_dfs_domain = dpd_set_domain, - .add_pulse = dpd_add_pulse, - .region = NL80211_DFS_UNSET, -}; - -struct dfs_pattern_detector * -dfs_pattern_detector_init(struct ath_hw *ah, enum nl80211_dfs_regions region) -{ - struct dfs_pattern_detector *dpd; - struct ath_common *common = ath9k_hw_common(ah); - - dpd = kmalloc(sizeof(*dpd), GFP_KERNEL); - if (dpd == NULL) - return NULL; - - *dpd = default_dpd; - INIT_LIST_HEAD(&dpd->channel_detectors); - - dpd->ah = ah; - if (dpd->set_dfs_domain(dpd, region)) - return dpd; - - ath_dbg(common, DFS,"Could not set DFS domain to %d", region); - kfree(dpd); - return NULL; -} -EXPORT_SYMBOL(dfs_pattern_detector_init); diff --git a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.h b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.h deleted file mode 100644 index 90a5abcc4265..000000000000 --- a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2012 Neratec Solutions AG - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef DFS_PATTERN_DETECTOR_H -#define DFS_PATTERN_DETECTOR_H - -#include -#include -#include - -/** - * struct pulse_event - describing pulses reported by PHY - * @ts: pulse time stamp in us - * @freq: channel frequency in MHz - * @width: pulse duration in us - * @rssi: rssi of radar event - */ -struct pulse_event { - u64 ts; - u16 freq; - u8 width; - u8 rssi; -}; - -/** - * struct radar_detector_specs - detector specs for a radar pattern type - * @type_id: pattern type, as defined by regulatory - * @width_min: minimum radar pulse width in [us] - * @width_max: maximum radar pulse width in [us] - * @pri_min: minimum pulse repetition interval in [us] (including tolerance) - * @pri_max: minimum pri in [us] (including tolerance) - * @num_pri: maximum number of different pri for this type - * @ppb: pulses per bursts for this type - * @ppb_thresh: number of pulses required to trigger detection - * @max_pri_tolerance: pulse time stamp tolerance on both sides [us] - */ -struct radar_detector_specs { - u8 type_id; - u8 width_min; - u8 width_max; - u16 pri_min; - u16 pri_max; - u8 num_pri; - u8 ppb; - u8 ppb_thresh; - u8 max_pri_tolerance; -}; - -/** - * struct dfs_pattern_detector - DFS pattern detector - * @exit(): destructor - * @set_dfs_domain(): set DFS domain, resets detector lines upon domain changes - * @add_pulse(): add radar pulse to detector, returns true on detection - * @region: active DFS region, NL80211_DFS_UNSET until set - * @num_radar_types: number of different radar types - * @last_pulse_ts: time stamp of last valid pulse in usecs - * @radar_detector_specs: array of radar detection specs - * @channel_detectors: list connecting channel_detector elements - */ -struct dfs_pattern_detector { - void (*exit)(struct dfs_pattern_detector *dpd); - bool (*set_dfs_domain)(struct dfs_pattern_detector *dpd, - enum nl80211_dfs_regions region); - bool (*add_pulse)(struct dfs_pattern_detector *dpd, - struct pulse_event *pe); - - enum nl80211_dfs_regions region; - u8 num_radar_types; - u64 last_pulse_ts; - /* needed for ath_dbg() */ - struct ath_hw *ah; - - const struct radar_detector_specs *radar_spec; - struct list_head channel_detectors; -}; - -/** - * dfs_pattern_detector_init() - constructor for pattern detector class - * @param region: DFS domain to be used, can be NL80211_DFS_UNSET at creation - * @return instance pointer on success, NULL otherwise - */ -#if defined(CONFIG_ATH9K_DFS_CERTIFIED) -extern struct dfs_pattern_detector * -dfs_pattern_detector_init(struct ath_hw *ah, enum nl80211_dfs_regions region); -#else -static inline struct dfs_pattern_detector * -dfs_pattern_detector_init(struct ath_hw *ah, enum nl80211_dfs_regions region) -{ - return NULL; -} -#endif /* CONFIG_ATH9K_DFS_CERTIFIED */ - -#endif /* DFS_PATTERN_DETECTOR_H */ diff --git a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c b/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c deleted file mode 100644 index 5ba4b6fe37c0..000000000000 --- a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c +++ /dev/null @@ -1,425 +0,0 @@ -/* - * Copyright (c) 2012 Neratec Solutions AG - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -#include "ath9k.h" -#include "dfs_pattern_detector.h" -#include "dfs_pri_detector.h" -#include "dfs_debug.h" - -/** - * struct pulse_elem - elements in pulse queue - * @ts: time stamp in usecs - */ -struct pulse_elem { - struct list_head head; - u64 ts; -}; - -/** - * pde_get_multiple() - get number of multiples considering a given tolerance - * @return factor if abs(val - factor*fraction) <= tolerance, 0 otherwise - */ -static u32 pde_get_multiple(u32 val, u32 fraction, u32 tolerance) -{ - u32 remainder; - u32 factor; - u32 delta; - - if (fraction == 0) - return 0; - - delta = (val < fraction) ? (fraction - val) : (val - fraction); - - if (delta <= tolerance) - /* val and fraction are within tolerance */ - return 1; - - factor = val / fraction; - remainder = val % fraction; - if (remainder > tolerance) { - /* no exact match */ - if ((fraction - remainder) <= tolerance) - /* remainder is within tolerance */ - factor++; - else - factor = 0; - } - return factor; -} - -/** - * DOC: Singleton Pulse and Sequence Pools - * - * Instances of pri_sequence and pulse_elem are kept in singleton pools to - * reduce the number of dynamic allocations. They are shared between all - * instances and grow up to the peak number of simultaneously used objects. - * - * Memory is freed after all references to the pools are released. - */ -static u32 singleton_pool_references; -static LIST_HEAD(pulse_pool); -static LIST_HEAD(pseq_pool); -static DEFINE_SPINLOCK(pool_lock); - -static void pool_register_ref(void) -{ - spin_lock_bh(&pool_lock); - singleton_pool_references++; - DFS_POOL_STAT_INC(pool_reference); - spin_unlock_bh(&pool_lock); -} - -static void pool_deregister_ref(void) -{ - spin_lock_bh(&pool_lock); - singleton_pool_references--; - DFS_POOL_STAT_DEC(pool_reference); - if (singleton_pool_references == 0) { - /* free singleton pools with no references left */ - struct pri_sequence *ps, *ps0; - struct pulse_elem *p, *p0; - - list_for_each_entry_safe(p, p0, &pulse_pool, head) { - list_del(&p->head); - DFS_POOL_STAT_DEC(pulse_allocated); - kfree(p); - } - list_for_each_entry_safe(ps, ps0, &pseq_pool, head) { - list_del(&ps->head); - DFS_POOL_STAT_DEC(pseq_allocated); - kfree(ps); - } - } - spin_unlock_bh(&pool_lock); -} - -static void pool_put_pulse_elem(struct pulse_elem *pe) -{ - spin_lock_bh(&pool_lock); - list_add(&pe->head, &pulse_pool); - DFS_POOL_STAT_DEC(pulse_used); - spin_unlock_bh(&pool_lock); -} - -static void pool_put_pseq_elem(struct pri_sequence *pse) -{ - spin_lock_bh(&pool_lock); - list_add(&pse->head, &pseq_pool); - DFS_POOL_STAT_DEC(pseq_used); - spin_unlock_bh(&pool_lock); -} - -static struct pri_sequence *pool_get_pseq_elem(void) -{ - struct pri_sequence *pse = NULL; - spin_lock_bh(&pool_lock); - if (!list_empty(&pseq_pool)) { - pse = list_first_entry(&pseq_pool, struct pri_sequence, head); - list_del(&pse->head); - DFS_POOL_STAT_INC(pseq_used); - } - spin_unlock_bh(&pool_lock); - return pse; -} - -static struct pulse_elem *pool_get_pulse_elem(void) -{ - struct pulse_elem *pe = NULL; - spin_lock_bh(&pool_lock); - if (!list_empty(&pulse_pool)) { - pe = list_first_entry(&pulse_pool, struct pulse_elem, head); - list_del(&pe->head); - DFS_POOL_STAT_INC(pulse_used); - } - spin_unlock_bh(&pool_lock); - return pe; -} - -static struct pulse_elem *pulse_queue_get_tail(struct pri_detector *pde) -{ - struct list_head *l = &pde->pulses; - if (list_empty(l)) - return NULL; - return list_entry(l->prev, struct pulse_elem, head); -} - -static bool pulse_queue_dequeue(struct pri_detector *pde) -{ - struct pulse_elem *p = pulse_queue_get_tail(pde); - if (p != NULL) { - list_del_init(&p->head); - pde->count--; - /* give it back to pool */ - pool_put_pulse_elem(p); - } - return (pde->count > 0); -} - -/* remove pulses older than window */ -static void pulse_queue_check_window(struct pri_detector *pde) -{ - u64 min_valid_ts; - struct pulse_elem *p; - - /* there is no delta time with less than 2 pulses */ - if (pde->count < 2) - return; - - if (pde->last_ts <= pde->window_size) - return; - - min_valid_ts = pde->last_ts - pde->window_size; - while ((p = pulse_queue_get_tail(pde)) != NULL) { - if (p->ts >= min_valid_ts) - return; - pulse_queue_dequeue(pde); - } -} - -static bool pulse_queue_enqueue(struct pri_detector *pde, u64 ts) -{ - struct pulse_elem *p = pool_get_pulse_elem(); - if (p == NULL) { - p = kmalloc(sizeof(*p), GFP_ATOMIC); - if (p == NULL) { - DFS_POOL_STAT_INC(pulse_alloc_error); - return false; - } - DFS_POOL_STAT_INC(pulse_allocated); - DFS_POOL_STAT_INC(pulse_used); - } - INIT_LIST_HEAD(&p->head); - p->ts = ts; - list_add(&p->head, &pde->pulses); - pde->count++; - pde->last_ts = ts; - pulse_queue_check_window(pde); - if (pde->count >= pde->max_count) - pulse_queue_dequeue(pde); - return true; -} - -static bool pseq_handler_create_sequences(struct pri_detector *pde, - u64 ts, u32 min_count) -{ - struct pulse_elem *p; - list_for_each_entry(p, &pde->pulses, head) { - struct pri_sequence ps, *new_ps; - struct pulse_elem *p2; - u32 tmp_false_count; - u64 min_valid_ts; - u32 delta_ts = ts - p->ts; - - if (delta_ts < pde->rs->pri_min) - /* ignore too small pri */ - continue; - - if (delta_ts > pde->rs->pri_max) - /* stop on too large pri (sorted list) */ - break; - - /* build a new sequence with new potential pri */ - ps.count = 2; - ps.count_falses = 0; - ps.first_ts = p->ts; - ps.last_ts = ts; - ps.pri = ts - p->ts; - ps.dur = ps.pri * (pde->rs->ppb - 1) - + 2 * pde->rs->max_pri_tolerance; - - p2 = p; - tmp_false_count = 0; - min_valid_ts = ts - ps.dur; - /* check which past pulses are candidates for new sequence */ - list_for_each_entry_continue(p2, &pde->pulses, head) { - u32 factor; - if (p2->ts < min_valid_ts) - /* stop on crossing window border */ - break; - /* check if pulse match (multi)PRI */ - factor = pde_get_multiple(ps.last_ts - p2->ts, ps.pri, - pde->rs->max_pri_tolerance); - if (factor > 0) { - ps.count++; - ps.first_ts = p2->ts; - /* - * on match, add the intermediate falses - * and reset counter - */ - ps.count_falses += tmp_false_count; - tmp_false_count = 0; - } else { - /* this is a potential false one */ - tmp_false_count++; - } - } - if (ps.count < min_count) - /* did not reach minimum count, drop sequence */ - continue; - - /* this is a valid one, add it */ - ps.deadline_ts = ps.first_ts + ps.dur; - new_ps = pool_get_pseq_elem(); - if (new_ps == NULL) { - new_ps = kmalloc(sizeof(*new_ps), GFP_ATOMIC); - if (new_ps == NULL) { - DFS_POOL_STAT_INC(pseq_alloc_error); - return false; - } - DFS_POOL_STAT_INC(pseq_allocated); - DFS_POOL_STAT_INC(pseq_used); - } - memcpy(new_ps, &ps, sizeof(ps)); - INIT_LIST_HEAD(&new_ps->head); - list_add(&new_ps->head, &pde->sequences); - } - return true; -} - -/* check new ts and add to all matching existing sequences */ -static u32 -pseq_handler_add_to_existing_seqs(struct pri_detector *pde, u64 ts) -{ - u32 max_count = 0; - struct pri_sequence *ps, *ps2; - list_for_each_entry_safe(ps, ps2, &pde->sequences, head) { - u32 delta_ts; - u32 factor; - - /* first ensure that sequence is within window */ - if (ts > ps->deadline_ts) { - list_del_init(&ps->head); - pool_put_pseq_elem(ps); - continue; - } - - delta_ts = ts - ps->last_ts; - factor = pde_get_multiple(delta_ts, ps->pri, - pde->rs->max_pri_tolerance); - if (factor > 0) { - ps->last_ts = ts; - ps->count++; - - if (max_count < ps->count) - max_count = ps->count; - } else { - ps->count_falses++; - } - } - return max_count; -} - -static struct pri_sequence * -pseq_handler_check_detection(struct pri_detector *pde) -{ - struct pri_sequence *ps; - - if (list_empty(&pde->sequences)) - return NULL; - - list_for_each_entry(ps, &pde->sequences, head) { - /* - * we assume to have enough matching confidence if we - * 1) have enough pulses - * 2) have more matching than false pulses - */ - if ((ps->count >= pde->rs->ppb_thresh) && - (ps->count * pde->rs->num_pri >= ps->count_falses)) - return ps; - } - return NULL; -} - - -/* free pulse queue and sequences list and give objects back to pools */ -static void pri_detector_reset(struct pri_detector *pde, u64 ts) -{ - struct pri_sequence *ps, *ps0; - struct pulse_elem *p, *p0; - list_for_each_entry_safe(ps, ps0, &pde->sequences, head) { - list_del_init(&ps->head); - pool_put_pseq_elem(ps); - } - list_for_each_entry_safe(p, p0, &pde->pulses, head) { - list_del_init(&p->head); - pool_put_pulse_elem(p); - } - pde->count = 0; - pde->last_ts = ts; -} - -static void pri_detector_exit(struct pri_detector *de) -{ - pri_detector_reset(de, 0); - pool_deregister_ref(); - kfree(de); -} - -static struct pri_sequence *pri_detector_add_pulse(struct pri_detector *de, - struct pulse_event *event) -{ - u32 max_updated_seq; - struct pri_sequence *ps; - u64 ts = event->ts; - const struct radar_detector_specs *rs = de->rs; - - /* ignore pulses not within width range */ - if ((rs->width_min > event->width) || (rs->width_max < event->width)) - return NULL; - - if ((ts - de->last_ts) < rs->max_pri_tolerance) - /* if delta to last pulse is too short, don't use this pulse */ - return NULL; - de->last_ts = ts; - - max_updated_seq = pseq_handler_add_to_existing_seqs(de, ts); - - if (!pseq_handler_create_sequences(de, ts, max_updated_seq)) { - pri_detector_reset(de, ts); - return false; - } - - ps = pseq_handler_check_detection(de); - - if (ps == NULL) - pulse_queue_enqueue(de, ts); - - return ps; -} - -struct pri_detector *pri_detector_init(const struct radar_detector_specs *rs) -{ - struct pri_detector *de; - - de = kzalloc(sizeof(*de), GFP_ATOMIC); - if (de == NULL) - return NULL; - de->exit = pri_detector_exit; - de->add_pulse = pri_detector_add_pulse; - de->reset = pri_detector_reset; - - INIT_LIST_HEAD(&de->sequences); - INIT_LIST_HEAD(&de->pulses); - de->window_size = rs->pri_max * rs->ppb * rs->num_pri; - de->max_count = rs->ppb * 2; - de->rs = rs; - - pool_register_ref(); - return de; -} diff --git a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.h b/drivers/net/wireless/ath/ath9k/dfs_pri_detector.h deleted file mode 100644 index 723962d1abc6..000000000000 --- a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2012 Neratec Solutions AG - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef DFS_PRI_DETECTOR_H -#define DFS_PRI_DETECTOR_H - -#include - -/** - * struct pri_sequence - sequence of pulses matching one PRI - * @head: list_head - * @pri: pulse repetition interval (PRI) in usecs - * @dur: duration of sequence in usecs - * @count: number of pulses in this sequence - * @count_falses: number of not matching pulses in this sequence - * @first_ts: time stamp of first pulse in usecs - * @last_ts: time stamp of last pulse in usecs - * @deadline_ts: deadline when this sequence becomes invalid (first_ts + dur) - */ -struct pri_sequence { - struct list_head head; - u32 pri; - u32 dur; - u32 count; - u32 count_falses; - u64 first_ts; - u64 last_ts; - u64 deadline_ts; -}; - -/** - * struct pri_detector - PRI detector element for a dedicated radar type - * @exit(): destructor - * @add_pulse(): add pulse event, returns pri_sequence if pattern was detected - * @reset(): clear states and reset to given time stamp - * @rs: detector specs for this detector element - * @last_ts: last pulse time stamp considered for this element in usecs - * @sequences: list_head holding potential pulse sequences - * @pulses: list connecting pulse_elem objects - * @count: number of pulses in queue - * @max_count: maximum number of pulses to be queued - * @window_size: window size back from newest pulse time stamp in usecs - */ -struct pri_detector { - void (*exit) (struct pri_detector *de); - struct pri_sequence * - (*add_pulse)(struct pri_detector *de, struct pulse_event *e); - void (*reset) (struct pri_detector *de, u64 ts); - -/* private: internal use only */ - const struct radar_detector_specs *rs; - u64 last_ts; - struct list_head sequences; - struct list_head pulses; - u32 count; - u32 max_count; - u32 window_size; -}; - -struct pri_detector *pri_detector_init(const struct radar_detector_specs *rs); - -#endif /* DFS_PRI_DETECTOR_H */ diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c deleted file mode 100644 index 971d770722cf..000000000000 --- a/drivers/net/wireless/ath/ath9k/eeprom.c +++ /dev/null @@ -1,586 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "hw.h" - -void ath9k_hw_analog_shift_regwrite(struct ath_hw *ah, u32 reg, u32 val) -{ - REG_WRITE(ah, reg, val); - - if (ah->config.analog_shiftreg) - udelay(100); -} - -void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask, - u32 shift, u32 val) -{ - u32 regVal; - - regVal = REG_READ(ah, reg) & ~mask; - regVal |= (val << shift) & mask; - - REG_WRITE(ah, reg, regVal); - - if (ah->config.analog_shiftreg) - udelay(100); -} - -int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight, - int16_t targetLeft, int16_t targetRight) -{ - int16_t rv; - - if (srcRight == srcLeft) { - rv = targetLeft; - } else { - rv = (int16_t) (((target - srcLeft) * targetRight + - (srcRight - target) * targetLeft) / - (srcRight - srcLeft)); - } - return rv; -} - -bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, - u16 *indexL, u16 *indexR) -{ - u16 i; - - if (target <= pList[0]) { - *indexL = *indexR = 0; - return true; - } - if (target >= pList[listSize - 1]) { - *indexL = *indexR = (u16) (listSize - 1); - return true; - } - - for (i = 0; i < listSize - 1; i++) { - if (pList[i] == target) { - *indexL = *indexR = i; - return true; - } - if (target < pList[i + 1]) { - *indexL = i; - *indexR = (u16) (i + 1); - return false; - } - } - return false; -} - -void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, - int eep_start_loc, int size) -{ - int i = 0, j, addr; - u32 addrdata[8]; - u32 data[8]; - - for (addr = 0; addr < size; addr++) { - addrdata[i] = AR5416_EEPROM_OFFSET + - ((addr + eep_start_loc) << AR5416_EEPROM_S); - i++; - if (i == 8) { - REG_READ_MULTI(ah, addrdata, data, i); - - for (j = 0; j < i; j++) { - *eep_data = data[j]; - eep_data++; - } - i = 0; - } - } - - if (i != 0) { - REG_READ_MULTI(ah, addrdata, data, i); - - for (j = 0; j < i; j++) { - *eep_data = data[j]; - eep_data++; - } - } -} - -static bool ath9k_hw_nvram_read_blob(struct ath_hw *ah, u32 off, - u16 *data) -{ - u16 *blob_data; - - if (off * sizeof(u16) > ah->eeprom_blob->size) - return false; - - blob_data = (u16 *)ah->eeprom_blob->data; - *data = blob_data[off]; - return true; -} - -bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data) -{ - struct ath_common *common = ath9k_hw_common(ah); - bool ret; - - if (ah->eeprom_blob) - ret = ath9k_hw_nvram_read_blob(ah, off, data); - else - ret = common->bus_ops->eeprom_read(common, off, data); - - if (!ret) - ath_dbg(common, EEPROM, - "unable to read eeprom region at offset %u\n", off); - - return ret; -} - -void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, - u8 *pVpdList, u16 numIntercepts, - u8 *pRetVpdList) -{ - u16 i, k; - u8 currPwr = pwrMin; - u16 idxL = 0, idxR = 0; - - for (i = 0; i <= (pwrMax - pwrMin) / 2; i++) { - ath9k_hw_get_lower_upper_index(currPwr, pPwrList, - numIntercepts, &(idxL), - &(idxR)); - if (idxR < 1) - idxR = 1; - if (idxL == numIntercepts - 1) - idxL = (u16) (numIntercepts - 2); - if (pPwrList[idxL] == pPwrList[idxR]) - k = pVpdList[idxL]; - else - k = (u16)(((currPwr - pPwrList[idxL]) * pVpdList[idxR] + - (pPwrList[idxR] - currPwr) * pVpdList[idxL]) / - (pPwrList[idxR] - pPwrList[idxL])); - pRetVpdList[i] = (u8) k; - currPwr += 2; - } -} - -void ath9k_hw_get_legacy_target_powers(struct ath_hw *ah, - struct ath9k_channel *chan, - struct cal_target_power_leg *powInfo, - u16 numChannels, - struct cal_target_power_leg *pNewPower, - u16 numRates, bool isExtTarget) -{ - struct chan_centers centers; - u16 clo, chi; - int i; - int matchIndex = -1, lowIndex = -1; - u16 freq; - - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - freq = (isExtTarget) ? centers.ext_center : centers.ctl_center; - - if (freq <= ath9k_hw_fbin2freq(powInfo[0].bChannel, - IS_CHAN_2GHZ(chan))) { - matchIndex = 0; - } else { - for (i = 0; (i < numChannels) && - (powInfo[i].bChannel != AR5416_BCHAN_UNUSED); i++) { - if (freq == ath9k_hw_fbin2freq(powInfo[i].bChannel, - IS_CHAN_2GHZ(chan))) { - matchIndex = i; - break; - } else if (freq < ath9k_hw_fbin2freq(powInfo[i].bChannel, - IS_CHAN_2GHZ(chan)) && i > 0 && - freq > ath9k_hw_fbin2freq(powInfo[i - 1].bChannel, - IS_CHAN_2GHZ(chan))) { - lowIndex = i - 1; - break; - } - } - if ((matchIndex == -1) && (lowIndex == -1)) - matchIndex = i - 1; - } - - if (matchIndex != -1) { - *pNewPower = powInfo[matchIndex]; - } else { - clo = ath9k_hw_fbin2freq(powInfo[lowIndex].bChannel, - IS_CHAN_2GHZ(chan)); - chi = ath9k_hw_fbin2freq(powInfo[lowIndex + 1].bChannel, - IS_CHAN_2GHZ(chan)); - - for (i = 0; i < numRates; i++) { - pNewPower->tPow2x[i] = - (u8)ath9k_hw_interpolate(freq, clo, chi, - powInfo[lowIndex].tPow2x[i], - powInfo[lowIndex + 1].tPow2x[i]); - } - } -} - -void ath9k_hw_get_target_powers(struct ath_hw *ah, - struct ath9k_channel *chan, - struct cal_target_power_ht *powInfo, - u16 numChannels, - struct cal_target_power_ht *pNewPower, - u16 numRates, bool isHt40Target) -{ - struct chan_centers centers; - u16 clo, chi; - int i; - int matchIndex = -1, lowIndex = -1; - u16 freq; - - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - freq = isHt40Target ? centers.synth_center : centers.ctl_center; - - if (freq <= ath9k_hw_fbin2freq(powInfo[0].bChannel, IS_CHAN_2GHZ(chan))) { - matchIndex = 0; - } else { - for (i = 0; (i < numChannels) && - (powInfo[i].bChannel != AR5416_BCHAN_UNUSED); i++) { - if (freq == ath9k_hw_fbin2freq(powInfo[i].bChannel, - IS_CHAN_2GHZ(chan))) { - matchIndex = i; - break; - } else - if (freq < ath9k_hw_fbin2freq(powInfo[i].bChannel, - IS_CHAN_2GHZ(chan)) && i > 0 && - freq > ath9k_hw_fbin2freq(powInfo[i - 1].bChannel, - IS_CHAN_2GHZ(chan))) { - lowIndex = i - 1; - break; - } - } - if ((matchIndex == -1) && (lowIndex == -1)) - matchIndex = i - 1; - } - - if (matchIndex != -1) { - *pNewPower = powInfo[matchIndex]; - } else { - clo = ath9k_hw_fbin2freq(powInfo[lowIndex].bChannel, - IS_CHAN_2GHZ(chan)); - chi = ath9k_hw_fbin2freq(powInfo[lowIndex + 1].bChannel, - IS_CHAN_2GHZ(chan)); - - for (i = 0; i < numRates; i++) { - pNewPower->tPow2x[i] = (u8)ath9k_hw_interpolate(freq, - clo, chi, - powInfo[lowIndex].tPow2x[i], - powInfo[lowIndex + 1].tPow2x[i]); - } - } -} - -u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower, - bool is2GHz, int num_band_edges) -{ - u16 twiceMaxEdgePower = MAX_RATE_POWER; - int i; - - for (i = 0; (i < num_band_edges) && - (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) { - if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) { - twiceMaxEdgePower = CTL_EDGE_TPOWER(pRdEdgesPower[i].ctl); - break; - } else if ((i > 0) && - (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, - is2GHz))) { - if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel, - is2GHz) < freq && - CTL_EDGE_FLAGS(pRdEdgesPower[i - 1].ctl)) { - twiceMaxEdgePower = - CTL_EDGE_TPOWER(pRdEdgesPower[i - 1].ctl); - } - break; - } - } - - return twiceMaxEdgePower; -} - -u16 ath9k_hw_get_scaled_power(struct ath_hw *ah, u16 power_limit, - u8 antenna_reduction) -{ - u16 reduction = antenna_reduction; - - /* - * Reduce scaled Power by number of chains active - * to get the per chain tx power level. - */ - switch (ar5416_get_ntxchains(ah->txchainmask)) { - case 1: - break; - case 2: - reduction += POWER_CORRECTION_FOR_TWO_CHAIN; - break; - case 3: - reduction += POWER_CORRECTION_FOR_THREE_CHAIN; - break; - } - - if (power_limit > reduction) - power_limit -= reduction; - else - power_limit = 0; - - return power_limit; -} - -void ath9k_hw_update_regulatory_maxpower(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); - - switch (ar5416_get_ntxchains(ah->txchainmask)) { - case 1: - break; - case 2: - regulatory->max_power_level += POWER_CORRECTION_FOR_TWO_CHAIN; - break; - case 3: - regulatory->max_power_level += POWER_CORRECTION_FOR_THREE_CHAIN; - break; - default: - ath_dbg(common, EEPROM, "Invalid chainmask configuration\n"); - break; - } -} - -void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah, - struct ath9k_channel *chan, - void *pRawDataSet, - u8 *bChans, u16 availPiers, - u16 tPdGainOverlap, - u16 *pPdGainBoundaries, u8 *pPDADCValues, - u16 numXpdGains) -{ - int i, j, k; - int16_t ss; - u16 idxL = 0, idxR = 0, numPiers; - static u8 vpdTableL[AR5416_NUM_PD_GAINS] - [AR5416_MAX_PWR_RANGE_IN_HALF_DB]; - static u8 vpdTableR[AR5416_NUM_PD_GAINS] - [AR5416_MAX_PWR_RANGE_IN_HALF_DB]; - static u8 vpdTableI[AR5416_NUM_PD_GAINS] - [AR5416_MAX_PWR_RANGE_IN_HALF_DB]; - - u8 *pVpdL, *pVpdR, *pPwrL, *pPwrR; - u8 minPwrT4[AR5416_NUM_PD_GAINS]; - u8 maxPwrT4[AR5416_NUM_PD_GAINS]; - int16_t vpdStep; - int16_t tmpVal; - u16 sizeCurrVpdTable, maxIndex, tgtIndex; - bool match; - int16_t minDelta = 0; - struct chan_centers centers; - int pdgain_boundary_default; - struct cal_data_per_freq *data_def = pRawDataSet; - struct cal_data_per_freq_4k *data_4k = pRawDataSet; - struct cal_data_per_freq_ar9287 *data_9287 = pRawDataSet; - bool eeprom_4k = AR_SREV_9285(ah) || AR_SREV_9271(ah); - int intercepts; - - if (AR_SREV_9287(ah)) - intercepts = AR9287_PD_GAIN_ICEPTS; - else - intercepts = AR5416_PD_GAIN_ICEPTS; - - memset(&minPwrT4, 0, AR5416_NUM_PD_GAINS); - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - - for (numPiers = 0; numPiers < availPiers; numPiers++) { - if (bChans[numPiers] == AR5416_BCHAN_UNUSED) - break; - } - - match = ath9k_hw_get_lower_upper_index((u8)FREQ2FBIN(centers.synth_center, - IS_CHAN_2GHZ(chan)), - bChans, numPiers, &idxL, &idxR); - - if (match) { - if (AR_SREV_9287(ah)) { - /* FIXME: array overrun? */ - for (i = 0; i < numXpdGains; i++) { - minPwrT4[i] = data_9287[idxL].pwrPdg[i][0]; - maxPwrT4[i] = data_9287[idxL].pwrPdg[i][4]; - ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i], - data_9287[idxL].pwrPdg[i], - data_9287[idxL].vpdPdg[i], - intercepts, - vpdTableI[i]); - } - } else if (eeprom_4k) { - for (i = 0; i < numXpdGains; i++) { - minPwrT4[i] = data_4k[idxL].pwrPdg[i][0]; - maxPwrT4[i] = data_4k[idxL].pwrPdg[i][4]; - ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i], - data_4k[idxL].pwrPdg[i], - data_4k[idxL].vpdPdg[i], - intercepts, - vpdTableI[i]); - } - } else { - for (i = 0; i < numXpdGains; i++) { - minPwrT4[i] = data_def[idxL].pwrPdg[i][0]; - maxPwrT4[i] = data_def[idxL].pwrPdg[i][4]; - ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i], - data_def[idxL].pwrPdg[i], - data_def[idxL].vpdPdg[i], - intercepts, - vpdTableI[i]); - } - } - } else { - for (i = 0; i < numXpdGains; i++) { - if (AR_SREV_9287(ah)) { - pVpdL = data_9287[idxL].vpdPdg[i]; - pPwrL = data_9287[idxL].pwrPdg[i]; - pVpdR = data_9287[idxR].vpdPdg[i]; - pPwrR = data_9287[idxR].pwrPdg[i]; - } else if (eeprom_4k) { - pVpdL = data_4k[idxL].vpdPdg[i]; - pPwrL = data_4k[idxL].pwrPdg[i]; - pVpdR = data_4k[idxR].vpdPdg[i]; - pPwrR = data_4k[idxR].pwrPdg[i]; - } else { - pVpdL = data_def[idxL].vpdPdg[i]; - pPwrL = data_def[idxL].pwrPdg[i]; - pVpdR = data_def[idxR].vpdPdg[i]; - pPwrR = data_def[idxR].pwrPdg[i]; - } - - minPwrT4[i] = max(pPwrL[0], pPwrR[0]); - - maxPwrT4[i] = - min(pPwrL[intercepts - 1], - pPwrR[intercepts - 1]); - - - ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i], - pPwrL, pVpdL, - intercepts, - vpdTableL[i]); - ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i], - pPwrR, pVpdR, - intercepts, - vpdTableR[i]); - - for (j = 0; j <= (maxPwrT4[i] - minPwrT4[i]) / 2; j++) { - vpdTableI[i][j] = - (u8)(ath9k_hw_interpolate((u16) - FREQ2FBIN(centers. - synth_center, - IS_CHAN_2GHZ - (chan)), - bChans[idxL], bChans[idxR], - vpdTableL[i][j], vpdTableR[i][j])); - } - } - } - - k = 0; - - for (i = 0; i < numXpdGains; i++) { - if (i == (numXpdGains - 1)) - pPdGainBoundaries[i] = - (u16)(maxPwrT4[i] / 2); - else - pPdGainBoundaries[i] = - (u16)((maxPwrT4[i] + minPwrT4[i + 1]) / 4); - - pPdGainBoundaries[i] = - min((u16)MAX_RATE_POWER, pPdGainBoundaries[i]); - - minDelta = 0; - - if (i == 0) { - if (AR_SREV_9280_20_OR_LATER(ah)) - ss = (int16_t)(0 - (minPwrT4[i] / 2)); - else - ss = 0; - } else { - ss = (int16_t)((pPdGainBoundaries[i - 1] - - (minPwrT4[i] / 2)) - - tPdGainOverlap + 1 + minDelta); - } - vpdStep = (int16_t)(vpdTableI[i][1] - vpdTableI[i][0]); - vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep); - - while ((ss < 0) && (k < (AR5416_NUM_PDADC_VALUES - 1))) { - tmpVal = (int16_t)(vpdTableI[i][0] + ss * vpdStep); - pPDADCValues[k++] = (u8)((tmpVal < 0) ? 0 : tmpVal); - ss++; - } - - sizeCurrVpdTable = (u8) ((maxPwrT4[i] - minPwrT4[i]) / 2 + 1); - tgtIndex = (u8)(pPdGainBoundaries[i] + tPdGainOverlap - - (minPwrT4[i] / 2)); - maxIndex = (tgtIndex < sizeCurrVpdTable) ? - tgtIndex : sizeCurrVpdTable; - - while ((ss < maxIndex) && (k < (AR5416_NUM_PDADC_VALUES - 1))) { - pPDADCValues[k++] = vpdTableI[i][ss++]; - } - - vpdStep = (int16_t)(vpdTableI[i][sizeCurrVpdTable - 1] - - vpdTableI[i][sizeCurrVpdTable - 2]); - vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep); - - if (tgtIndex >= maxIndex) { - while ((ss <= tgtIndex) && - (k < (AR5416_NUM_PDADC_VALUES - 1))) { - tmpVal = (int16_t)((vpdTableI[i][sizeCurrVpdTable - 1] + - (ss - maxIndex + 1) * vpdStep)); - pPDADCValues[k++] = (u8)((tmpVal > 255) ? - 255 : tmpVal); - ss++; - } - } - } - - if (eeprom_4k) - pdgain_boundary_default = 58; - else - pdgain_boundary_default = pPdGainBoundaries[i - 1]; - - while (i < AR5416_PD_GAINS_IN_MASK) { - pPdGainBoundaries[i] = pdgain_boundary_default; - i++; - } - - while (k < AR5416_NUM_PDADC_VALUES) { - pPDADCValues[k] = pPDADCValues[k - 1]; - k++; - } -} - -int ath9k_hw_eeprom_init(struct ath_hw *ah) -{ - int status; - - if (AR_SREV_9300_20_OR_LATER(ah)) - ah->eep_ops = &eep_ar9300_ops; - else if (AR_SREV_9287(ah)) { - ah->eep_ops = &eep_ar9287_ops; - } else if (AR_SREV_9285(ah) || AR_SREV_9271(ah)) { - ah->eep_ops = &eep_4k_ops; - } else { - ah->eep_ops = &eep_def_ops; - } - - if (!ah->eep_ops->fill_eeprom(ah)) - return -EIO; - - status = ah->eep_ops->check_eeprom(ah); - - return status; -} diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h deleted file mode 100644 index 40d4f62d0f16..000000000000 --- a/drivers/net/wireless/ath/ath9k/eeprom.h +++ /dev/null @@ -1,717 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef EEPROM_H -#define EEPROM_H - -#define AR_EEPROM_MODAL_SPURS 5 - -#include "../ath.h" -#include -#include "ar9003_eeprom.h" - -#ifdef __BIG_ENDIAN -#define AR5416_EEPROM_MAGIC 0x5aa5 -#else -#define AR5416_EEPROM_MAGIC 0xa55a -#endif - -#define CTRY_DEBUG 0x1ff -#define CTRY_DEFAULT 0 - -#define AR_EEPROM_EEPCAP_COMPRESS_DIS 0x0001 -#define AR_EEPROM_EEPCAP_AES_DIS 0x0002 -#define AR_EEPROM_EEPCAP_FASTFRAME_DIS 0x0004 -#define AR_EEPROM_EEPCAP_BURST_DIS 0x0008 -#define AR_EEPROM_EEPCAP_MAXQCU 0x01F0 -#define AR_EEPROM_EEPCAP_MAXQCU_S 4 -#define AR_EEPROM_EEPCAP_HEAVY_CLIP_EN 0x0200 -#define AR_EEPROM_EEPCAP_KC_ENTRIES 0xF000 -#define AR_EEPROM_EEPCAP_KC_ENTRIES_S 12 - -#define AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND 0x0040 -#define AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN 0x0080 -#define AR_EEPROM_EEREGCAP_EN_KK_U2 0x0100 -#define AR_EEPROM_EEREGCAP_EN_KK_MIDBAND 0x0200 -#define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD 0x0400 -#define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A 0x0800 - -#define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD_PRE4_0 0x4000 -#define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A_PRE4_0 0x8000 - -#define AR5416_EEPROM_MAGIC_OFFSET 0x0 -#define AR5416_EEPROM_S 2 -#define AR5416_EEPROM_OFFSET 0x2000 -#define AR5416_EEPROM_MAX 0xae0 - -#define AR5416_EEPROM_START_ADDR \ - (AR_SREV_9100(ah)) ? 0x1fff1000 : 0x503f1200 - -#define SD_NO_CTL 0xE0 -#define NO_CTL 0xff -#define CTL_MODE_M 0xf -#define CTL_11A 0 -#define CTL_11B 1 -#define CTL_11G 2 -#define CTL_2GHT20 5 -#define CTL_5GHT20 6 -#define CTL_2GHT40 7 -#define CTL_5GHT40 8 - -#define EXT_ADDITIVE (0x8000) -#define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE) -#define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE) -#define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE) - -#define SUB_NUM_CTL_MODES_AT_5G_40 2 -#define SUB_NUM_CTL_MODES_AT_2G_40 3 - -#define POWER_CORRECTION_FOR_TWO_CHAIN 6 /* 10*log10(2)*2 */ -#define POWER_CORRECTION_FOR_THREE_CHAIN 10 /* 10*log10(3)*2 */ - -/* - * For AR9285 and later chipsets, the following bits are not being programmed - * in EEPROM and so need to be enabled always. - * - * Bit 0: en_fcc_mid - * Bit 1: en_jap_mid - * Bit 2: en_fcc_dfs_ht40 - * Bit 3: en_jap_ht40 - * Bit 4: en_jap_dfs_ht40 - */ -#define AR9285_RDEXT_DEFAULT 0x1F - -#define ATH9K_POW_SM(_r, _s) (((_r) & 0x3f) << (_s)) -#define FREQ2FBIN(x, y) ((y) ? ((x) - 2300) : (((x) - 4800) / 5)) -#define FBIN2FREQ(x, y) ((y) ? (2300 + x) : (4800 + 5 * x)) -#define ath9k_hw_use_flash(_ah) (!(_ah->ah_flags & AH_USE_EEPROM)) - -#define AR5416_VER_MASK (eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) -#define OLC_FOR_AR9280_20_LATER (AR_SREV_9280_20_OR_LATER(ah) && \ - ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) -#define OLC_FOR_AR9287_10_LATER (AR_SREV_9287_11_OR_LATER(ah) && \ - ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) - -#define EEP_RFSILENT_ENABLED 0x0001 -#define EEP_RFSILENT_ENABLED_S 0 -#define EEP_RFSILENT_POLARITY 0x0002 -#define EEP_RFSILENT_POLARITY_S 1 -#define EEP_RFSILENT_GPIO_SEL ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x00fc : 0x001c) -#define EEP_RFSILENT_GPIO_SEL_S 2 - -#define AR5416_OPFLAGS_11A 0x01 -#define AR5416_OPFLAGS_11G 0x02 -#define AR5416_OPFLAGS_N_5G_HT40 0x04 -#define AR5416_OPFLAGS_N_2G_HT40 0x08 -#define AR5416_OPFLAGS_N_5G_HT20 0x10 -#define AR5416_OPFLAGS_N_2G_HT20 0x20 - -#define AR5416_EEP_NO_BACK_VER 0x1 -#define AR5416_EEP_VER 0xE -#define AR5416_EEP_VER_MINOR_MASK 0x0FFF -#define AR5416_EEP_MINOR_VER_2 0x2 -#define AR5416_EEP_MINOR_VER_3 0x3 -#define AR5416_EEP_MINOR_VER_7 0x7 -#define AR5416_EEP_MINOR_VER_9 0x9 -#define AR5416_EEP_MINOR_VER_16 0x10 -#define AR5416_EEP_MINOR_VER_17 0x11 -#define AR5416_EEP_MINOR_VER_19 0x13 -#define AR5416_EEP_MINOR_VER_20 0x14 -#define AR5416_EEP_MINOR_VER_21 0x15 -#define AR5416_EEP_MINOR_VER_22 0x16 - -#define AR5416_NUM_5G_CAL_PIERS 8 -#define AR5416_NUM_2G_CAL_PIERS 4 -#define AR5416_NUM_5G_20_TARGET_POWERS 8 -#define AR5416_NUM_5G_40_TARGET_POWERS 8 -#define AR5416_NUM_2G_CCK_TARGET_POWERS 3 -#define AR5416_NUM_2G_20_TARGET_POWERS 4 -#define AR5416_NUM_2G_40_TARGET_POWERS 4 -#define AR5416_NUM_CTLS 24 -#define AR5416_NUM_BAND_EDGES 8 -#define AR5416_NUM_PD_GAINS 4 -#define AR5416_PD_GAINS_IN_MASK 4 -#define AR5416_PD_GAIN_ICEPTS 5 -#define AR5416_NUM_PDADC_VALUES 128 -#define AR5416_BCHAN_UNUSED 0xFF -#define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64 -#define AR5416_MAX_CHAINS 3 -#define AR9300_MAX_CHAINS 3 -#define AR5416_PWR_TABLE_OFFSET_DB -5 - -/* Rx gain type values */ -#define AR5416_EEP_RXGAIN_23DB_BACKOFF 0 -#define AR5416_EEP_RXGAIN_13DB_BACKOFF 1 -#define AR5416_EEP_RXGAIN_ORIG 2 - -/* Tx gain type values */ -#define AR5416_EEP_TXGAIN_ORIGINAL 0 -#define AR5416_EEP_TXGAIN_HIGH_POWER 1 - -#define AR5416_EEP4K_START_LOC 64 -#define AR5416_EEP4K_NUM_2G_CAL_PIERS 3 -#define AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS 3 -#define AR5416_EEP4K_NUM_2G_20_TARGET_POWERS 3 -#define AR5416_EEP4K_NUM_2G_40_TARGET_POWERS 3 -#define AR5416_EEP4K_NUM_CTLS 12 -#define AR5416_EEP4K_NUM_BAND_EDGES 4 -#define AR5416_EEP4K_NUM_PD_GAINS 2 -#define AR5416_EEP4K_MAX_CHAINS 1 - -#define AR9280_TX_GAIN_TABLE_SIZE 22 - -#define AR9287_EEP_VER 0xE -#define AR9287_EEP_VER_MINOR_MASK 0xFFF -#define AR9287_EEP_MINOR_VER_1 0x1 -#define AR9287_EEP_MINOR_VER_2 0x2 -#define AR9287_EEP_MINOR_VER_3 0x3 -#define AR9287_EEP_MINOR_VER AR9287_EEP_MINOR_VER_3 -#define AR9287_EEP_MINOR_VER_b AR9287_EEP_MINOR_VER -#define AR9287_EEP_NO_BACK_VER AR9287_EEP_MINOR_VER_1 - -#define AR9287_EEP_START_LOC 128 -#define AR9287_HTC_EEP_START_LOC 256 -#define AR9287_NUM_2G_CAL_PIERS 3 -#define AR9287_NUM_2G_CCK_TARGET_POWERS 3 -#define AR9287_NUM_2G_20_TARGET_POWERS 3 -#define AR9287_NUM_2G_40_TARGET_POWERS 3 -#define AR9287_NUM_CTLS 12 -#define AR9287_NUM_BAND_EDGES 4 -#define AR9287_PD_GAIN_ICEPTS 1 -#define AR9287_EEPMISC_BIG_ENDIAN 0x01 -#define AR9287_EEPMISC_WOW 0x02 -#define AR9287_MAX_CHAINS 2 -#define AR9287_ANT_16S 32 - -#define AR9287_DATA_SZ 32 - -#define AR9287_PWR_TABLE_OFFSET_DB -5 - -#define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) - -#define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f) -#define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03) - -#define LNA_CTL_BUF_MODE BIT(0) -#define LNA_CTL_ISEL_LO BIT(1) -#define LNA_CTL_ISEL_HI BIT(2) -#define LNA_CTL_BUF_IN BIT(3) -#define LNA_CTL_FEM_BAND BIT(4) -#define LNA_CTL_LOCAL_BIAS BIT(5) -#define LNA_CTL_FORCE_XPA BIT(6) -#define LNA_CTL_USE_ANT1 BIT(7) - -enum eeprom_param { - EEP_NFTHRESH_5, - EEP_NFTHRESH_2, - EEP_MAC_MSW, - EEP_MAC_MID, - EEP_MAC_LSW, - EEP_REG_0, - EEP_OP_CAP, - EEP_OP_MODE, - EEP_RF_SILENT, - EEP_OB_5, - EEP_DB_5, - EEP_OB_2, - EEP_DB_2, - EEP_MINOR_REV, - EEP_TX_MASK, - EEP_RX_MASK, - EEP_FSTCLK_5G, - EEP_RXGAIN_TYPE, - EEP_OL_PWRCTRL, - EEP_TXGAIN_TYPE, - EEP_RC_CHAIN_MASK, - EEP_DAC_HPWR_5G, - EEP_FRAC_N_5G, - EEP_DEV_TYPE, - EEP_TEMPSENSE_SLOPE, - EEP_TEMPSENSE_SLOPE_PAL_ON, - EEP_PWR_TABLE_OFFSET, - EEP_PAPRD, - EEP_MODAL_VER, - EEP_ANT_DIV_CTL1, - EEP_CHAIN_MASK_REDUCE, - EEP_ANTENNA_GAIN_2G, - EEP_ANTENNA_GAIN_5G, -}; - -enum ar5416_rates { - rate6mb, rate9mb, rate12mb, rate18mb, - rate24mb, rate36mb, rate48mb, rate54mb, - rate1l, rate2l, rate2s, rate5_5l, - rate5_5s, rate11l, rate11s, rateXr, - rateHt20_0, rateHt20_1, rateHt20_2, rateHt20_3, - rateHt20_4, rateHt20_5, rateHt20_6, rateHt20_7, - rateHt40_0, rateHt40_1, rateHt40_2, rateHt40_3, - rateHt40_4, rateHt40_5, rateHt40_6, rateHt40_7, - rateDupCck, rateDupOfdm, rateExtCck, rateExtOfdm, - Ar5416RateSize -}; - -enum ath9k_hal_freq_band { - ATH9K_HAL_FREQ_BAND_5GHZ = 0, - ATH9K_HAL_FREQ_BAND_2GHZ = 1 -}; - -struct base_eep_header { - u16 length; - u16 checksum; - u16 version; - u8 opCapFlags; - u8 eepMisc; - u16 regDmn[2]; - u8 macAddr[6]; - u8 rxMask; - u8 txMask; - u16 rfSilent; - u16 blueToothOptions; - u16 deviceCap; - u32 binBuildNumber; - u8 deviceType; - u8 pwdclkind; - u8 fastClk5g; - u8 divChain; - u8 rxGainType; - u8 dacHiPwrMode_5G; - u8 openLoopPwrCntl; - u8 dacLpMode; - u8 txGainType; - u8 rcChainMask; - u8 desiredScaleCCK; - u8 pwr_table_offset; - u8 frac_n_5g; - u8 futureBase_3[21]; -} __packed; - -struct base_eep_header_4k { - u16 length; - u16 checksum; - u16 version; - u8 opCapFlags; - u8 eepMisc; - u16 regDmn[2]; - u8 macAddr[6]; - u8 rxMask; - u8 txMask; - u16 rfSilent; - u16 blueToothOptions; - u16 deviceCap; - u32 binBuildNumber; - u8 deviceType; - u8 txGainType; -} __packed; - - -struct spur_chan { - u16 spurChan; - u8 spurRangeLow; - u8 spurRangeHigh; -} __packed; - -struct modal_eep_header { - u32 antCtrlChain[AR5416_MAX_CHAINS]; - u32 antCtrlCommon; - u8 antennaGainCh[AR5416_MAX_CHAINS]; - u8 switchSettling; - u8 txRxAttenCh[AR5416_MAX_CHAINS]; - u8 rxTxMarginCh[AR5416_MAX_CHAINS]; - u8 adcDesiredSize; - u8 pgaDesiredSize; - u8 xlnaGainCh[AR5416_MAX_CHAINS]; - u8 txEndToXpaOff; - u8 txEndToRxOn; - u8 txFrameToXpaOn; - u8 thresh62; - u8 noiseFloorThreshCh[AR5416_MAX_CHAINS]; - u8 xpdGain; - u8 xpd; - u8 iqCalICh[AR5416_MAX_CHAINS]; - u8 iqCalQCh[AR5416_MAX_CHAINS]; - u8 pdGainOverlap; - u8 ob; - u8 db; - u8 xpaBiasLvl; - u8 pwrDecreaseFor2Chain; - u8 pwrDecreaseFor3Chain; - u8 txFrameToDataStart; - u8 txFrameToPaOn; - u8 ht40PowerIncForPdadc; - u8 bswAtten[AR5416_MAX_CHAINS]; - u8 bswMargin[AR5416_MAX_CHAINS]; - u8 swSettleHt40; - u8 xatten2Db[AR5416_MAX_CHAINS]; - u8 xatten2Margin[AR5416_MAX_CHAINS]; - u8 ob_ch1; - u8 db_ch1; - u8 lna_ctl; - u8 miscBits; - u16 xpaBiasLvlFreq[3]; - u8 futureModal[6]; - - struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; -} __packed; - -struct calDataPerFreqOpLoop { - u8 pwrPdg[2][5]; - u8 vpdPdg[2][5]; - u8 pcdac[2][5]; - u8 empty[2][5]; -} __packed; - -struct modal_eep_4k_header { - u32 antCtrlChain[AR5416_EEP4K_MAX_CHAINS]; - u32 antCtrlCommon; - u8 antennaGainCh[AR5416_EEP4K_MAX_CHAINS]; - u8 switchSettling; - u8 txRxAttenCh[AR5416_EEP4K_MAX_CHAINS]; - u8 rxTxMarginCh[AR5416_EEP4K_MAX_CHAINS]; - u8 adcDesiredSize; - u8 pgaDesiredSize; - u8 xlnaGainCh[AR5416_EEP4K_MAX_CHAINS]; - u8 txEndToXpaOff; - u8 txEndToRxOn; - u8 txFrameToXpaOn; - u8 thresh62; - u8 noiseFloorThreshCh[AR5416_EEP4K_MAX_CHAINS]; - u8 xpdGain; - u8 xpd; - u8 iqCalICh[AR5416_EEP4K_MAX_CHAINS]; - u8 iqCalQCh[AR5416_EEP4K_MAX_CHAINS]; - u8 pdGainOverlap; -#ifdef __BIG_ENDIAN_BITFIELD - u8 ob_1:4, ob_0:4; - u8 db1_1:4, db1_0:4; -#else - u8 ob_0:4, ob_1:4; - u8 db1_0:4, db1_1:4; -#endif - u8 xpaBiasLvl; - u8 txFrameToDataStart; - u8 txFrameToPaOn; - u8 ht40PowerIncForPdadc; - u8 bswAtten[AR5416_EEP4K_MAX_CHAINS]; - u8 bswMargin[AR5416_EEP4K_MAX_CHAINS]; - u8 swSettleHt40; - u8 xatten2Db[AR5416_EEP4K_MAX_CHAINS]; - u8 xatten2Margin[AR5416_EEP4K_MAX_CHAINS]; -#ifdef __BIG_ENDIAN_BITFIELD - u8 db2_1:4, db2_0:4; -#else - u8 db2_0:4, db2_1:4; -#endif - u8 version; -#ifdef __BIG_ENDIAN_BITFIELD - u8 ob_3:4, ob_2:4; - u8 antdiv_ctl1:4, ob_4:4; - u8 db1_3:4, db1_2:4; - u8 antdiv_ctl2:4, db1_4:4; - u8 db2_2:4, db2_3:4; - u8 reserved:4, db2_4:4; -#else - u8 ob_2:4, ob_3:4; - u8 ob_4:4, antdiv_ctl1:4; - u8 db1_2:4, db1_3:4; - u8 db1_4:4, antdiv_ctl2:4; - u8 db2_2:4, db2_3:4; - u8 db2_4:4, reserved:4; -#endif - u8 tx_diversity; - u8 flc_pwr_thresh; - u8 bb_scale_smrt_antenna; -#define EEP_4K_BB_DESIRED_SCALE_MASK 0x1f - u8 futureModal[1]; - struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; -} __packed; - -struct base_eep_ar9287_header { - u16 length; - u16 checksum; - u16 version; - u8 opCapFlags; - u8 eepMisc; - u16 regDmn[2]; - u8 macAddr[6]; - u8 rxMask; - u8 txMask; - u16 rfSilent; - u16 blueToothOptions; - u16 deviceCap; - u32 binBuildNumber; - u8 deviceType; - u8 openLoopPwrCntl; - int8_t pwrTableOffset; - int8_t tempSensSlope; - int8_t tempSensSlopePalOn; - u8 futureBase[29]; -} __packed; - -struct modal_eep_ar9287_header { - u32 antCtrlChain[AR9287_MAX_CHAINS]; - u32 antCtrlCommon; - int8_t antennaGainCh[AR9287_MAX_CHAINS]; - u8 switchSettling; - u8 txRxAttenCh[AR9287_MAX_CHAINS]; - u8 rxTxMarginCh[AR9287_MAX_CHAINS]; - int8_t adcDesiredSize; - u8 txEndToXpaOff; - u8 txEndToRxOn; - u8 txFrameToXpaOn; - u8 thresh62; - int8_t noiseFloorThreshCh[AR9287_MAX_CHAINS]; - u8 xpdGain; - u8 xpd; - int8_t iqCalICh[AR9287_MAX_CHAINS]; - int8_t iqCalQCh[AR9287_MAX_CHAINS]; - u8 pdGainOverlap; - u8 xpaBiasLvl; - u8 txFrameToDataStart; - u8 txFrameToPaOn; - u8 ht40PowerIncForPdadc; - u8 bswAtten[AR9287_MAX_CHAINS]; - u8 bswMargin[AR9287_MAX_CHAINS]; - u8 swSettleHt40; - u8 version; - u8 db1; - u8 db2; - u8 ob_cck; - u8 ob_psk; - u8 ob_qam; - u8 ob_pal_off; - u8 futureModal[30]; - struct spur_chan spurChans[AR_EEPROM_MODAL_SPURS]; -} __packed; - -struct cal_data_per_freq { - u8 pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; - u8 vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; -} __packed; - -struct cal_data_per_freq_4k { - u8 pwrPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; - u8 vpdPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; -} __packed; - -struct cal_target_power_leg { - u8 bChannel; - u8 tPow2x[4]; -} __packed; - -struct cal_target_power_ht { - u8 bChannel; - u8 tPow2x[8]; -} __packed; - -struct cal_ctl_edges { - u8 bChannel; - u8 ctl; -} __packed; - -struct cal_data_op_loop_ar9287 { - u8 pwrPdg[2][5]; - u8 vpdPdg[2][5]; - u8 pcdac[2][5]; - u8 empty[2][5]; -} __packed; - -struct cal_data_per_freq_ar9287 { - u8 pwrPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; - u8 vpdPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; -} __packed; - -union cal_data_per_freq_ar9287_u { - struct cal_data_op_loop_ar9287 calDataOpen; - struct cal_data_per_freq_ar9287 calDataClose; -} __packed; - -struct cal_ctl_data_ar9287 { - struct cal_ctl_edges - ctlEdges[AR9287_MAX_CHAINS][AR9287_NUM_BAND_EDGES]; -} __packed; - -struct cal_ctl_data { - struct cal_ctl_edges - ctlEdges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES]; -} __packed; - -struct cal_ctl_data_4k { - struct cal_ctl_edges - ctlEdges[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_BAND_EDGES]; -} __packed; - -struct ar5416_eeprom_def { - struct base_eep_header baseEepHeader; - u8 custData[64]; - struct modal_eep_header modalHeader[2]; - u8 calFreqPier5G[AR5416_NUM_5G_CAL_PIERS]; - u8 calFreqPier2G[AR5416_NUM_2G_CAL_PIERS]; - struct cal_data_per_freq - calPierData5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS]; - struct cal_data_per_freq - calPierData2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS]; - struct cal_target_power_leg - calTargetPower5G[AR5416_NUM_5G_20_TARGET_POWERS]; - struct cal_target_power_ht - calTargetPower5GHT20[AR5416_NUM_5G_20_TARGET_POWERS]; - struct cal_target_power_ht - calTargetPower5GHT40[AR5416_NUM_5G_40_TARGET_POWERS]; - struct cal_target_power_leg - calTargetPowerCck[AR5416_NUM_2G_CCK_TARGET_POWERS]; - struct cal_target_power_leg - calTargetPower2G[AR5416_NUM_2G_20_TARGET_POWERS]; - struct cal_target_power_ht - calTargetPower2GHT20[AR5416_NUM_2G_20_TARGET_POWERS]; - struct cal_target_power_ht - calTargetPower2GHT40[AR5416_NUM_2G_40_TARGET_POWERS]; - u8 ctlIndex[AR5416_NUM_CTLS]; - struct cal_ctl_data ctlData[AR5416_NUM_CTLS]; - u8 padding; -} __packed; - -struct ar5416_eeprom_4k { - struct base_eep_header_4k baseEepHeader; - u8 custData[20]; - struct modal_eep_4k_header modalHeader; - u8 calFreqPier2G[AR5416_EEP4K_NUM_2G_CAL_PIERS]; - struct cal_data_per_freq_4k - calPierData2G[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_2G_CAL_PIERS]; - struct cal_target_power_leg - calTargetPowerCck[AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS]; - struct cal_target_power_leg - calTargetPower2G[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS]; - struct cal_target_power_ht - calTargetPower2GHT20[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS]; - struct cal_target_power_ht - calTargetPower2GHT40[AR5416_EEP4K_NUM_2G_40_TARGET_POWERS]; - u8 ctlIndex[AR5416_EEP4K_NUM_CTLS]; - struct cal_ctl_data_4k ctlData[AR5416_EEP4K_NUM_CTLS]; - u8 padding; -} __packed; - -struct ar9287_eeprom { - struct base_eep_ar9287_header baseEepHeader; - u8 custData[AR9287_DATA_SZ]; - struct modal_eep_ar9287_header modalHeader; - u8 calFreqPier2G[AR9287_NUM_2G_CAL_PIERS]; - union cal_data_per_freq_ar9287_u - calPierData2G[AR9287_MAX_CHAINS][AR9287_NUM_2G_CAL_PIERS]; - struct cal_target_power_leg - calTargetPowerCck[AR9287_NUM_2G_CCK_TARGET_POWERS]; - struct cal_target_power_leg - calTargetPower2G[AR9287_NUM_2G_20_TARGET_POWERS]; - struct cal_target_power_ht - calTargetPower2GHT20[AR9287_NUM_2G_20_TARGET_POWERS]; - struct cal_target_power_ht - calTargetPower2GHT40[AR9287_NUM_2G_40_TARGET_POWERS]; - u8 ctlIndex[AR9287_NUM_CTLS]; - struct cal_ctl_data_ar9287 ctlData[AR9287_NUM_CTLS]; - u8 padding; -} __packed; - -enum reg_ext_bitmap { - REG_EXT_FCC_MIDBAND = 0, - REG_EXT_JAPAN_MIDBAND = 1, - REG_EXT_FCC_DFS_HT40 = 2, - REG_EXT_JAPAN_NONDFS_HT40 = 3, - REG_EXT_JAPAN_DFS_HT40 = 4 -}; - -struct ath9k_country_entry { - u16 countryCode; - u16 regDmnEnum; - u16 regDmn5G; - u16 regDmn2G; - u8 isMultidomain; - u8 iso[3]; -}; - -struct eeprom_ops { - int (*check_eeprom)(struct ath_hw *hw); - u32 (*get_eeprom)(struct ath_hw *hw, enum eeprom_param param); - bool (*fill_eeprom)(struct ath_hw *hw); - u32 (*dump_eeprom)(struct ath_hw *hw, bool dump_base_hdr, u8 *buf, - u32 len, u32 size); - int (*get_eeprom_ver)(struct ath_hw *hw); - int (*get_eeprom_rev)(struct ath_hw *hw); - void (*set_board_values)(struct ath_hw *hw, struct ath9k_channel *chan); - void (*set_addac)(struct ath_hw *hw, struct ath9k_channel *chan); - void (*set_txpower)(struct ath_hw *hw, struct ath9k_channel *chan, - u16 cfgCtl, u8 twiceAntennaReduction, - u8 powerLimit, bool test); - u16 (*get_spur_channel)(struct ath_hw *ah, u16 i, bool is2GHz); -}; - -void ath9k_hw_analog_shift_regwrite(struct ath_hw *ah, u32 reg, u32 val); -void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask, - u32 shift, u32 val); -int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight, - int16_t targetLeft, - int16_t targetRight); -bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, - u16 *indexL, u16 *indexR); -bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data); -void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, - int eep_start_loc, int size); -void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, - u8 *pVpdList, u16 numIntercepts, - u8 *pRetVpdList); -void ath9k_hw_get_legacy_target_powers(struct ath_hw *ah, - struct ath9k_channel *chan, - struct cal_target_power_leg *powInfo, - u16 numChannels, - struct cal_target_power_leg *pNewPower, - u16 numRates, bool isExtTarget); -void ath9k_hw_get_target_powers(struct ath_hw *ah, - struct ath9k_channel *chan, - struct cal_target_power_ht *powInfo, - u16 numChannels, - struct cal_target_power_ht *pNewPower, - u16 numRates, bool isHt40Target); -u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower, - bool is2GHz, int num_band_edges); -u16 ath9k_hw_get_scaled_power(struct ath_hw *ah, u16 power_limit, - u8 antenna_reduction); -void ath9k_hw_update_regulatory_maxpower(struct ath_hw *ah); -int ath9k_hw_eeprom_init(struct ath_hw *ah); - -void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah, - struct ath9k_channel *chan, - void *pRawDataSet, - u8 *bChans, u16 availPiers, - u16 tPdGainOverlap, - u16 *pPdGainBoundaries, u8 *pPDADCValues, - u16 numXpdGains); - -static inline u16 ath9k_hw_fbin2freq(u8 fbin, bool is2GHz) -{ - if (fbin == AR5416_BCHAN_UNUSED) - return fbin; - - return (u16) ((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin)); -} - -#define ar5416_get_ntxchains(_txchainmask) \ - (((_txchainmask >> 2) & 1) + \ - ((_txchainmask >> 1) & 1) + (_txchainmask & 1)) - -extern const struct eeprom_ops eep_def_ops; -extern const struct eeprom_ops eep_4k_ops; -extern const struct eeprom_ops eep_ar9287_ops; -extern const struct eeprom_ops eep_ar9287_ops; -extern const struct eeprom_ops eep_ar9300_ops; - -#endif /* EEPROM_H */ diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c deleted file mode 100644 index c2bfd748eed8..000000000000 --- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c +++ /dev/null @@ -1,1106 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "hw.h" -#include "ar9002_phy.h" - -static int ath9k_hw_4k_get_eeprom_ver(struct ath_hw *ah) -{ - return ((ah->eeprom.map4k.baseEepHeader.version >> 12) & 0xF); -} - -static int ath9k_hw_4k_get_eeprom_rev(struct ath_hw *ah) -{ - return ((ah->eeprom.map4k.baseEepHeader.version) & 0xFFF); -} - -#define SIZE_EEPROM_4K (sizeof(struct ar5416_eeprom_4k) / sizeof(u16)) - -static bool __ath9k_hw_4k_fill_eeprom(struct ath_hw *ah) -{ - u16 *eep_data = (u16 *)&ah->eeprom.map4k; - int addr, eep_start_loc = 64; - - for (addr = 0; addr < SIZE_EEPROM_4K; addr++) { - if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) - return false; - eep_data++; - } - - return true; -} - -static bool __ath9k_hw_usb_4k_fill_eeprom(struct ath_hw *ah) -{ - u16 *eep_data = (u16 *)&ah->eeprom.map4k; - - ath9k_hw_usb_gen_fill_eeprom(ah, eep_data, 64, SIZE_EEPROM_4K); - - return true; -} - -static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - - if (!ath9k_hw_use_flash(ah)) { - ath_dbg(common, EEPROM, "Reading from EEPROM, not flash\n"); - } - - if (common->bus_ops->ath_bus_type == ATH_USB) - return __ath9k_hw_usb_4k_fill_eeprom(ah); - else - return __ath9k_hw_4k_fill_eeprom(ah); -} - -#if defined(CONFIG_ATH9K_DEBUGFS) || defined(CONFIG_ATH9K_HTC_DEBUGFS) -static u32 ath9k_dump_4k_modal_eeprom(char *buf, u32 len, u32 size, - struct modal_eep_4k_header *modal_hdr) -{ - PR_EEP("Chain0 Ant. Control", modal_hdr->antCtrlChain[0]); - PR_EEP("Ant. Common Control", modal_hdr->antCtrlCommon); - PR_EEP("Chain0 Ant. Gain", modal_hdr->antennaGainCh[0]); - PR_EEP("Switch Settle", modal_hdr->switchSettling); - PR_EEP("Chain0 TxRxAtten", modal_hdr->txRxAttenCh[0]); - PR_EEP("Chain0 RxTxMargin", modal_hdr->rxTxMarginCh[0]); - PR_EEP("ADC Desired size", modal_hdr->adcDesiredSize); - PR_EEP("PGA Desired size", modal_hdr->pgaDesiredSize); - PR_EEP("Chain0 xlna Gain", modal_hdr->xlnaGainCh[0]); - PR_EEP("txEndToXpaOff", modal_hdr->txEndToXpaOff); - PR_EEP("txEndToRxOn", modal_hdr->txEndToRxOn); - PR_EEP("txFrameToXpaOn", modal_hdr->txFrameToXpaOn); - PR_EEP("CCA Threshold)", modal_hdr->thresh62); - PR_EEP("Chain0 NF Threshold", modal_hdr->noiseFloorThreshCh[0]); - PR_EEP("xpdGain", modal_hdr->xpdGain); - PR_EEP("External PD", modal_hdr->xpd); - PR_EEP("Chain0 I Coefficient", modal_hdr->iqCalICh[0]); - PR_EEP("Chain0 Q Coefficient", modal_hdr->iqCalQCh[0]); - PR_EEP("pdGainOverlap", modal_hdr->pdGainOverlap); - PR_EEP("O/D Bias Version", modal_hdr->version); - PR_EEP("CCK OutputBias", modal_hdr->ob_0); - PR_EEP("BPSK OutputBias", modal_hdr->ob_1); - PR_EEP("QPSK OutputBias", modal_hdr->ob_2); - PR_EEP("16QAM OutputBias", modal_hdr->ob_3); - PR_EEP("64QAM OutputBias", modal_hdr->ob_4); - PR_EEP("CCK Driver1_Bias", modal_hdr->db1_0); - PR_EEP("BPSK Driver1_Bias", modal_hdr->db1_1); - PR_EEP("QPSK Driver1_Bias", modal_hdr->db1_2); - PR_EEP("16QAM Driver1_Bias", modal_hdr->db1_3); - PR_EEP("64QAM Driver1_Bias", modal_hdr->db1_4); - PR_EEP("CCK Driver2_Bias", modal_hdr->db2_0); - PR_EEP("BPSK Driver2_Bias", modal_hdr->db2_1); - PR_EEP("QPSK Driver2_Bias", modal_hdr->db2_2); - PR_EEP("16QAM Driver2_Bias", modal_hdr->db2_3); - PR_EEP("64QAM Driver2_Bias", modal_hdr->db2_4); - PR_EEP("xPA Bias Level", modal_hdr->xpaBiasLvl); - PR_EEP("txFrameToDataStart", modal_hdr->txFrameToDataStart); - PR_EEP("txFrameToPaOn", modal_hdr->txFrameToPaOn); - PR_EEP("HT40 Power Inc.", modal_hdr->ht40PowerIncForPdadc); - PR_EEP("Chain0 bswAtten", modal_hdr->bswAtten[0]); - PR_EEP("Chain0 bswMargin", modal_hdr->bswMargin[0]); - PR_EEP("HT40 Switch Settle", modal_hdr->swSettleHt40); - PR_EEP("Chain0 xatten2Db", modal_hdr->xatten2Db[0]); - PR_EEP("Chain0 xatten2Margin", modal_hdr->xatten2Margin[0]); - PR_EEP("Ant. Diversity ctl1", modal_hdr->antdiv_ctl1); - PR_EEP("Ant. Diversity ctl2", modal_hdr->antdiv_ctl2); - PR_EEP("TX Diversity", modal_hdr->tx_diversity); - - return len; -} - -static u32 ath9k_hw_4k_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr, - u8 *buf, u32 len, u32 size) -{ - struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k; - struct base_eep_header_4k *pBase = &eep->baseEepHeader; - - if (!dump_base_hdr) { - len += snprintf(buf + len, size - len, - "%20s :\n", "2GHz modal Header"); - len = ath9k_dump_4k_modal_eeprom(buf, len, size, - &eep->modalHeader); - goto out; - } - - PR_EEP("Major Version", pBase->version >> 12); - PR_EEP("Minor Version", pBase->version & 0xFFF); - PR_EEP("Checksum", pBase->checksum); - PR_EEP("Length", pBase->length); - PR_EEP("RegDomain1", pBase->regDmn[0]); - PR_EEP("RegDomain2", pBase->regDmn[1]); - PR_EEP("TX Mask", pBase->txMask); - PR_EEP("RX Mask", pBase->rxMask); - PR_EEP("Allow 5GHz", !!(pBase->opCapFlags & AR5416_OPFLAGS_11A)); - PR_EEP("Allow 2GHz", !!(pBase->opCapFlags & AR5416_OPFLAGS_11G)); - PR_EEP("Disable 2GHz HT20", !!(pBase->opCapFlags & - AR5416_OPFLAGS_N_2G_HT20)); - PR_EEP("Disable 2GHz HT40", !!(pBase->opCapFlags & - AR5416_OPFLAGS_N_2G_HT40)); - PR_EEP("Disable 5Ghz HT20", !!(pBase->opCapFlags & - AR5416_OPFLAGS_N_5G_HT20)); - PR_EEP("Disable 5Ghz HT40", !!(pBase->opCapFlags & - AR5416_OPFLAGS_N_5G_HT40)); - PR_EEP("Big Endian", !!(pBase->eepMisc & 0x01)); - PR_EEP("Cal Bin Major Ver", (pBase->binBuildNumber >> 24) & 0xFF); - PR_EEP("Cal Bin Minor Ver", (pBase->binBuildNumber >> 16) & 0xFF); - PR_EEP("Cal Bin Build", (pBase->binBuildNumber >> 8) & 0xFF); - PR_EEP("TX Gain type", pBase->txGainType); - - len += snprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress", - pBase->macAddr); - -out: - if (len > size) - len = size; - - return len; -} -#else -static u32 ath9k_hw_4k_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr, - u8 *buf, u32 len, u32 size) -{ - return 0; -} -#endif - - -#undef SIZE_EEPROM_4K - -static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah) -{ -#define EEPROM_4K_SIZE (sizeof(struct ar5416_eeprom_4k) / sizeof(u16)) - struct ath_common *common = ath9k_hw_common(ah); - struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k; - u16 *eepdata, temp, magic, magic2; - u32 sum = 0, el; - bool need_swap = false; - int i, addr; - - - if (!ath9k_hw_use_flash(ah)) { - if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, - &magic)) { - ath_err(common, "Reading Magic # failed\n"); - return false; - } - - ath_dbg(common, EEPROM, "Read Magic = 0x%04X\n", magic); - - if (magic != AR5416_EEPROM_MAGIC) { - magic2 = swab16(magic); - - if (magic2 == AR5416_EEPROM_MAGIC) { - need_swap = true; - eepdata = (u16 *) (&ah->eeprom); - - for (addr = 0; addr < EEPROM_4K_SIZE; addr++) { - temp = swab16(*eepdata); - *eepdata = temp; - eepdata++; - } - } else { - ath_err(common, - "Invalid EEPROM Magic. Endianness mismatch.\n"); - return -EINVAL; - } - } - } - - ath_dbg(common, EEPROM, "need_swap = %s\n", - need_swap ? "True" : "False"); - - if (need_swap) - el = swab16(ah->eeprom.map4k.baseEepHeader.length); - else - el = ah->eeprom.map4k.baseEepHeader.length; - - if (el > sizeof(struct ar5416_eeprom_4k)) - el = sizeof(struct ar5416_eeprom_4k) / sizeof(u16); - else - el = el / sizeof(u16); - - eepdata = (u16 *)(&ah->eeprom); - - for (i = 0; i < el; i++) - sum ^= *eepdata++; - - if (need_swap) { - u32 integer; - u16 word; - - ath_dbg(common, EEPROM, - "EEPROM Endianness is not native.. Changing\n"); - - word = swab16(eep->baseEepHeader.length); - eep->baseEepHeader.length = word; - - word = swab16(eep->baseEepHeader.checksum); - eep->baseEepHeader.checksum = word; - - word = swab16(eep->baseEepHeader.version); - eep->baseEepHeader.version = word; - - word = swab16(eep->baseEepHeader.regDmn[0]); - eep->baseEepHeader.regDmn[0] = word; - - word = swab16(eep->baseEepHeader.regDmn[1]); - eep->baseEepHeader.regDmn[1] = word; - - word = swab16(eep->baseEepHeader.rfSilent); - eep->baseEepHeader.rfSilent = word; - - word = swab16(eep->baseEepHeader.blueToothOptions); - eep->baseEepHeader.blueToothOptions = word; - - word = swab16(eep->baseEepHeader.deviceCap); - eep->baseEepHeader.deviceCap = word; - - integer = swab32(eep->modalHeader.antCtrlCommon); - eep->modalHeader.antCtrlCommon = integer; - - for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) { - integer = swab32(eep->modalHeader.antCtrlChain[i]); - eep->modalHeader.antCtrlChain[i] = integer; - } - - for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { - word = swab16(eep->modalHeader.spurChans[i].spurChan); - eep->modalHeader.spurChans[i].spurChan = word; - } - } - - if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR5416_EEP_VER || - ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) { - ath_err(common, "Bad EEPROM checksum 0x%x or revision 0x%04x\n", - sum, ah->eep_ops->get_eeprom_ver(ah)); - return -EINVAL; - } - - return 0; -#undef EEPROM_4K_SIZE -} - -static u32 ath9k_hw_4k_get_eeprom(struct ath_hw *ah, - enum eeprom_param param) -{ - struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k; - struct modal_eep_4k_header *pModal = &eep->modalHeader; - struct base_eep_header_4k *pBase = &eep->baseEepHeader; - u16 ver_minor; - - ver_minor = pBase->version & AR5416_EEP_VER_MINOR_MASK; - - switch (param) { - case EEP_NFTHRESH_2: - return pModal->noiseFloorThreshCh[0]; - case EEP_MAC_LSW: - return get_unaligned_be16(pBase->macAddr); - case EEP_MAC_MID: - return get_unaligned_be16(pBase->macAddr + 2); - case EEP_MAC_MSW: - return get_unaligned_be16(pBase->macAddr + 4); - case EEP_REG_0: - return pBase->regDmn[0]; - case EEP_OP_CAP: - return pBase->deviceCap; - case EEP_OP_MODE: - return pBase->opCapFlags; - case EEP_RF_SILENT: - return pBase->rfSilent; - case EEP_OB_2: - return pModal->ob_0; - case EEP_DB_2: - return pModal->db1_1; - case EEP_MINOR_REV: - return ver_minor; - case EEP_TX_MASK: - return pBase->txMask; - case EEP_RX_MASK: - return pBase->rxMask; - case EEP_FRAC_N_5G: - return 0; - case EEP_PWR_TABLE_OFFSET: - return AR5416_PWR_TABLE_OFFSET_DB; - case EEP_MODAL_VER: - return pModal->version; - case EEP_ANT_DIV_CTL1: - return pModal->antdiv_ctl1; - case EEP_TXGAIN_TYPE: - return pBase->txGainType; - case EEP_ANTENNA_GAIN_2G: - return pModal->antennaGainCh[0]; - default: - return 0; - } -} - -static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k; - struct cal_data_per_freq_4k *pRawDataset; - u8 *pCalBChans = NULL; - u16 pdGainOverlap_t2; - static u8 pdadcValues[AR5416_NUM_PDADC_VALUES]; - u16 gainBoundaries[AR5416_PD_GAINS_IN_MASK]; - u16 numPiers, i, j; - u16 numXpdGain, xpdMask; - u16 xpdGainValues[AR5416_EEP4K_NUM_PD_GAINS] = { 0, 0 }; - u32 reg32, regOffset, regChainOffset; - - xpdMask = pEepData->modalHeader.xpdGain; - - if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >= - AR5416_EEP_MINOR_VER_2) { - pdGainOverlap_t2 = - pEepData->modalHeader.pdGainOverlap; - } else { - pdGainOverlap_t2 = (u16)(MS(REG_READ(ah, AR_PHY_TPCRG5), - AR_PHY_TPCRG5_PD_GAIN_OVERLAP)); - } - - pCalBChans = pEepData->calFreqPier2G; - numPiers = AR5416_EEP4K_NUM_2G_CAL_PIERS; - - numXpdGain = 0; - - for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) { - if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) { - if (numXpdGain >= AR5416_EEP4K_NUM_PD_GAINS) - break; - xpdGainValues[numXpdGain] = - (u16)(AR5416_PD_GAINS_IN_MASK - i); - numXpdGain++; - } - } - - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN, - (numXpdGain - 1) & 0x3); - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1, - xpdGainValues[0]); - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2, - xpdGainValues[1]); - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3, 0); - - for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) { - regChainOffset = i * 0x1000; - - if (pEepData->baseEepHeader.txMask & (1 << i)) { - pRawDataset = pEepData->calPierData2G[i]; - - ath9k_hw_get_gain_boundaries_pdadcs(ah, chan, - pRawDataset, pCalBChans, - numPiers, pdGainOverlap_t2, - gainBoundaries, - pdadcValues, numXpdGain); - - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_PHY_TPCRG5 + regChainOffset, - SM(pdGainOverlap_t2, - AR_PHY_TPCRG5_PD_GAIN_OVERLAP) - | SM(gainBoundaries[0], - AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1) - | SM(gainBoundaries[1], - AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2) - | SM(gainBoundaries[2], - AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3) - | SM(gainBoundaries[3], - AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4)); - - regOffset = AR_PHY_BASE + (672 << 2) + regChainOffset; - for (j = 0; j < 32; j++) { - reg32 = get_unaligned_le32(&pdadcValues[4 * j]); - REG_WRITE(ah, regOffset, reg32); - - ath_dbg(common, EEPROM, - "PDADC (%d,%4x): %4.4x %8.8x\n", - i, regChainOffset, regOffset, - reg32); - ath_dbg(common, EEPROM, - "PDADC: Chain %d | " - "PDADC %3d Value %3d | " - "PDADC %3d Value %3d | " - "PDADC %3d Value %3d | " - "PDADC %3d Value %3d |\n", - i, 4 * j, pdadcValues[4 * j], - 4 * j + 1, pdadcValues[4 * j + 1], - 4 * j + 2, pdadcValues[4 * j + 2], - 4 * j + 3, pdadcValues[4 * j + 3]); - - regOffset += 4; - } - - REGWRITE_BUFFER_FLUSH(ah); - } - } -} - -static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah, - struct ath9k_channel *chan, - int16_t *ratesArray, - u16 cfgCtl, - u16 antenna_reduction, - u16 powerLimit) -{ -#define CMP_TEST_GRP \ - (((cfgCtl & ~CTL_MODE_M)| (pCtlMode[ctlMode] & CTL_MODE_M)) == \ - pEepData->ctlIndex[i]) \ - || (((cfgCtl & ~CTL_MODE_M) | (pCtlMode[ctlMode] & CTL_MODE_M)) == \ - ((pEepData->ctlIndex[i] & CTL_MODE_M) | SD_NO_CTL)) - - int i; - u16 twiceMinEdgePower; - u16 twiceMaxEdgePower; - u16 scaledPower = 0, minCtlPower; - u16 numCtlModes; - const u16 *pCtlMode; - u16 ctlMode, freq; - struct chan_centers centers; - struct cal_ctl_data_4k *rep; - struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k; - struct cal_target_power_leg targetPowerOfdm, targetPowerCck = { - 0, { 0, 0, 0, 0} - }; - struct cal_target_power_leg targetPowerOfdmExt = { - 0, { 0, 0, 0, 0} }, targetPowerCckExt = { - 0, { 0, 0, 0, 0 } - }; - struct cal_target_power_ht targetPowerHt20, targetPowerHt40 = { - 0, {0, 0, 0, 0} - }; - static const u16 ctlModesFor11g[] = { - CTL_11B, CTL_11G, CTL_2GHT20, - CTL_11B_EXT, CTL_11G_EXT, CTL_2GHT40 - }; - - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - - scaledPower = powerLimit - antenna_reduction; - numCtlModes = ARRAY_SIZE(ctlModesFor11g) - SUB_NUM_CTL_MODES_AT_2G_40; - pCtlMode = ctlModesFor11g; - - ath9k_hw_get_legacy_target_powers(ah, chan, - pEepData->calTargetPowerCck, - AR5416_NUM_2G_CCK_TARGET_POWERS, - &targetPowerCck, 4, false); - ath9k_hw_get_legacy_target_powers(ah, chan, - pEepData->calTargetPower2G, - AR5416_NUM_2G_20_TARGET_POWERS, - &targetPowerOfdm, 4, false); - ath9k_hw_get_target_powers(ah, chan, - pEepData->calTargetPower2GHT20, - AR5416_NUM_2G_20_TARGET_POWERS, - &targetPowerHt20, 8, false); - - if (IS_CHAN_HT40(chan)) { - numCtlModes = ARRAY_SIZE(ctlModesFor11g); - ath9k_hw_get_target_powers(ah, chan, - pEepData->calTargetPower2GHT40, - AR5416_NUM_2G_40_TARGET_POWERS, - &targetPowerHt40, 8, true); - ath9k_hw_get_legacy_target_powers(ah, chan, - pEepData->calTargetPowerCck, - AR5416_NUM_2G_CCK_TARGET_POWERS, - &targetPowerCckExt, 4, true); - ath9k_hw_get_legacy_target_powers(ah, chan, - pEepData->calTargetPower2G, - AR5416_NUM_2G_20_TARGET_POWERS, - &targetPowerOfdmExt, 4, true); - } - - for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) { - bool isHt40CtlMode = (pCtlMode[ctlMode] == CTL_5GHT40) || - (pCtlMode[ctlMode] == CTL_2GHT40); - - if (isHt40CtlMode) - freq = centers.synth_center; - else if (pCtlMode[ctlMode] & EXT_ADDITIVE) - freq = centers.ext_center; - else - freq = centers.ctl_center; - - twiceMaxEdgePower = MAX_RATE_POWER; - - for (i = 0; (i < AR5416_EEP4K_NUM_CTLS) && - pEepData->ctlIndex[i]; i++) { - - if (CMP_TEST_GRP) { - rep = &(pEepData->ctlData[i]); - - twiceMinEdgePower = ath9k_hw_get_max_edge_power( - freq, - rep->ctlEdges[ - ar5416_get_ntxchains(ah->txchainmask) - 1], - IS_CHAN_2GHZ(chan), - AR5416_EEP4K_NUM_BAND_EDGES); - - if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL) { - twiceMaxEdgePower = - min(twiceMaxEdgePower, - twiceMinEdgePower); - } else { - twiceMaxEdgePower = twiceMinEdgePower; - break; - } - } - } - - minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower); - - switch (pCtlMode[ctlMode]) { - case CTL_11B: - for (i = 0; i < ARRAY_SIZE(targetPowerCck.tPow2x); i++) { - targetPowerCck.tPow2x[i] = - min((u16)targetPowerCck.tPow2x[i], - minCtlPower); - } - break; - case CTL_11G: - for (i = 0; i < ARRAY_SIZE(targetPowerOfdm.tPow2x); i++) { - targetPowerOfdm.tPow2x[i] = - min((u16)targetPowerOfdm.tPow2x[i], - minCtlPower); - } - break; - case CTL_2GHT20: - for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++) { - targetPowerHt20.tPow2x[i] = - min((u16)targetPowerHt20.tPow2x[i], - minCtlPower); - } - break; - case CTL_11B_EXT: - targetPowerCckExt.tPow2x[0] = - min((u16)targetPowerCckExt.tPow2x[0], - minCtlPower); - break; - case CTL_11G_EXT: - targetPowerOfdmExt.tPow2x[0] = - min((u16)targetPowerOfdmExt.tPow2x[0], - minCtlPower); - break; - case CTL_2GHT40: - for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) { - targetPowerHt40.tPow2x[i] = - min((u16)targetPowerHt40.tPow2x[i], - minCtlPower); - } - break; - default: - break; - } - } - - ratesArray[rate6mb] = - ratesArray[rate9mb] = - ratesArray[rate12mb] = - ratesArray[rate18mb] = - ratesArray[rate24mb] = - targetPowerOfdm.tPow2x[0]; - - ratesArray[rate36mb] = targetPowerOfdm.tPow2x[1]; - ratesArray[rate48mb] = targetPowerOfdm.tPow2x[2]; - ratesArray[rate54mb] = targetPowerOfdm.tPow2x[3]; - ratesArray[rateXr] = targetPowerOfdm.tPow2x[0]; - - for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++) - ratesArray[rateHt20_0 + i] = targetPowerHt20.tPow2x[i]; - - ratesArray[rate1l] = targetPowerCck.tPow2x[0]; - ratesArray[rate2s] = ratesArray[rate2l] = targetPowerCck.tPow2x[1]; - ratesArray[rate5_5s] = ratesArray[rate5_5l] = targetPowerCck.tPow2x[2]; - ratesArray[rate11s] = ratesArray[rate11l] = targetPowerCck.tPow2x[3]; - - if (IS_CHAN_HT40(chan)) { - for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) { - ratesArray[rateHt40_0 + i] = - targetPowerHt40.tPow2x[i]; - } - ratesArray[rateDupOfdm] = targetPowerHt40.tPow2x[0]; - ratesArray[rateDupCck] = targetPowerHt40.tPow2x[0]; - ratesArray[rateExtOfdm] = targetPowerOfdmExt.tPow2x[0]; - ratesArray[rateExtCck] = targetPowerCckExt.tPow2x[0]; - } - -#undef CMP_TEST_GRP -} - -static void ath9k_hw_4k_set_txpower(struct ath_hw *ah, - struct ath9k_channel *chan, - u16 cfgCtl, - u8 twiceAntennaReduction, - u8 powerLimit, bool test) -{ - struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); - struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k; - struct modal_eep_4k_header *pModal = &pEepData->modalHeader; - int16_t ratesArray[Ar5416RateSize]; - u8 ht40PowerIncForPdadc = 2; - int i; - - memset(ratesArray, 0, sizeof(ratesArray)); - - if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >= - AR5416_EEP_MINOR_VER_2) { - ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc; - } - - ath9k_hw_set_4k_power_per_rate_table(ah, chan, - &ratesArray[0], cfgCtl, - twiceAntennaReduction, - powerLimit); - - ath9k_hw_set_4k_power_cal_table(ah, chan); - - regulatory->max_power_level = 0; - for (i = 0; i < ARRAY_SIZE(ratesArray); i++) { - if (ratesArray[i] > MAX_RATE_POWER) - ratesArray[i] = MAX_RATE_POWER; - - if (ratesArray[i] > regulatory->max_power_level) - regulatory->max_power_level = ratesArray[i]; - } - - if (test) - return; - - for (i = 0; i < Ar5416RateSize; i++) - ratesArray[i] -= AR5416_PWR_TABLE_OFFSET_DB * 2; - - ENABLE_REGWRITE_BUFFER(ah); - - /* OFDM power per rate */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE1, - ATH9K_POW_SM(ratesArray[rate18mb], 24) - | ATH9K_POW_SM(ratesArray[rate12mb], 16) - | ATH9K_POW_SM(ratesArray[rate9mb], 8) - | ATH9K_POW_SM(ratesArray[rate6mb], 0)); - REG_WRITE(ah, AR_PHY_POWER_TX_RATE2, - ATH9K_POW_SM(ratesArray[rate54mb], 24) - | ATH9K_POW_SM(ratesArray[rate48mb], 16) - | ATH9K_POW_SM(ratesArray[rate36mb], 8) - | ATH9K_POW_SM(ratesArray[rate24mb], 0)); - - /* CCK power per rate */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE3, - ATH9K_POW_SM(ratesArray[rate2s], 24) - | ATH9K_POW_SM(ratesArray[rate2l], 16) - | ATH9K_POW_SM(ratesArray[rateXr], 8) - | ATH9K_POW_SM(ratesArray[rate1l], 0)); - REG_WRITE(ah, AR_PHY_POWER_TX_RATE4, - ATH9K_POW_SM(ratesArray[rate11s], 24) - | ATH9K_POW_SM(ratesArray[rate11l], 16) - | ATH9K_POW_SM(ratesArray[rate5_5s], 8) - | ATH9K_POW_SM(ratesArray[rate5_5l], 0)); - - /* HT20 power per rate */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE5, - ATH9K_POW_SM(ratesArray[rateHt20_3], 24) - | ATH9K_POW_SM(ratesArray[rateHt20_2], 16) - | ATH9K_POW_SM(ratesArray[rateHt20_1], 8) - | ATH9K_POW_SM(ratesArray[rateHt20_0], 0)); - REG_WRITE(ah, AR_PHY_POWER_TX_RATE6, - ATH9K_POW_SM(ratesArray[rateHt20_7], 24) - | ATH9K_POW_SM(ratesArray[rateHt20_6], 16) - | ATH9K_POW_SM(ratesArray[rateHt20_5], 8) - | ATH9K_POW_SM(ratesArray[rateHt20_4], 0)); - - /* HT40 power per rate */ - if (IS_CHAN_HT40(chan)) { - REG_WRITE(ah, AR_PHY_POWER_TX_RATE7, - ATH9K_POW_SM(ratesArray[rateHt40_3] + - ht40PowerIncForPdadc, 24) - | ATH9K_POW_SM(ratesArray[rateHt40_2] + - ht40PowerIncForPdadc, 16) - | ATH9K_POW_SM(ratesArray[rateHt40_1] + - ht40PowerIncForPdadc, 8) - | ATH9K_POW_SM(ratesArray[rateHt40_0] + - ht40PowerIncForPdadc, 0)); - REG_WRITE(ah, AR_PHY_POWER_TX_RATE8, - ATH9K_POW_SM(ratesArray[rateHt40_7] + - ht40PowerIncForPdadc, 24) - | ATH9K_POW_SM(ratesArray[rateHt40_6] + - ht40PowerIncForPdadc, 16) - | ATH9K_POW_SM(ratesArray[rateHt40_5] + - ht40PowerIncForPdadc, 8) - | ATH9K_POW_SM(ratesArray[rateHt40_4] + - ht40PowerIncForPdadc, 0)); - REG_WRITE(ah, AR_PHY_POWER_TX_RATE9, - ATH9K_POW_SM(ratesArray[rateExtOfdm], 24) - | ATH9K_POW_SM(ratesArray[rateExtCck], 16) - | ATH9K_POW_SM(ratesArray[rateDupOfdm], 8) - | ATH9K_POW_SM(ratesArray[rateDupCck], 0)); - } - - REGWRITE_BUFFER_FLUSH(ah); -} - -static void ath9k_hw_4k_set_gain(struct ath_hw *ah, - struct modal_eep_4k_header *pModal, - struct ar5416_eeprom_4k *eep, - u8 txRxAttenLocal) -{ - REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0, - pModal->antCtrlChain[0]); - - REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0), - (REG_READ(ah, AR_PHY_TIMING_CTRL4(0)) & - ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF | - AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) | - SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) | - SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF)); - - if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >= - AR5416_EEP_MINOR_VER_3) { - txRxAttenLocal = pModal->txRxAttenCh[0]; - - REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, - AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN, pModal->bswMargin[0]); - REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, - AR_PHY_GAIN_2GHZ_XATTEN1_DB, pModal->bswAtten[0]); - REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, - AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN, - pModal->xatten2Margin[0]); - REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, - AR_PHY_GAIN_2GHZ_XATTEN2_DB, pModal->xatten2Db[0]); - - /* Set the block 1 value to block 0 value */ - REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + 0x1000, - AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN, - pModal->bswMargin[0]); - REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + 0x1000, - AR_PHY_GAIN_2GHZ_XATTEN1_DB, pModal->bswAtten[0]); - REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + 0x1000, - AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN, - pModal->xatten2Margin[0]); - REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + 0x1000, - AR_PHY_GAIN_2GHZ_XATTEN2_DB, - pModal->xatten2Db[0]); - } - - REG_RMW_FIELD(ah, AR_PHY_RXGAIN, - AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal); - REG_RMW_FIELD(ah, AR_PHY_RXGAIN, - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]); - - REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000, - AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal); - REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000, - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]); -} - -/* - * Read EEPROM header info and program the device for correct operation - * given the channel value. - */ -static void ath9k_hw_4k_set_board_values(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - struct modal_eep_4k_header *pModal; - struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k; - struct base_eep_header_4k *pBase = &eep->baseEepHeader; - u8 txRxAttenLocal; - u8 ob[5], db1[5], db2[5]; - u8 ant_div_control1, ant_div_control2; - u8 bb_desired_scale; - u32 regVal; - - pModal = &eep->modalHeader; - txRxAttenLocal = 23; - - REG_WRITE(ah, AR_PHY_SWITCH_COM, pModal->antCtrlCommon); - - /* Single chain for 4K EEPROM*/ - ath9k_hw_4k_set_gain(ah, pModal, eep, txRxAttenLocal); - - /* Initialize Ant Diversity settings from EEPROM */ - if (pModal->version >= 3) { - ant_div_control1 = pModal->antdiv_ctl1; - ant_div_control2 = pModal->antdiv_ctl2; - - regVal = REG_READ(ah, AR_PHY_MULTICHAIN_GAIN_CTL); - regVal &= (~(AR_PHY_9285_ANT_DIV_CTL_ALL)); - - regVal |= SM(ant_div_control1, - AR_PHY_9285_ANT_DIV_CTL); - regVal |= SM(ant_div_control2, - AR_PHY_9285_ANT_DIV_ALT_LNACONF); - regVal |= SM((ant_div_control2 >> 2), - AR_PHY_9285_ANT_DIV_MAIN_LNACONF); - regVal |= SM((ant_div_control1 >> 1), - AR_PHY_9285_ANT_DIV_ALT_GAINTB); - regVal |= SM((ant_div_control1 >> 2), - AR_PHY_9285_ANT_DIV_MAIN_GAINTB); - - - REG_WRITE(ah, AR_PHY_MULTICHAIN_GAIN_CTL, regVal); - regVal = REG_READ(ah, AR_PHY_MULTICHAIN_GAIN_CTL); - regVal = REG_READ(ah, AR_PHY_CCK_DETECT); - regVal &= (~AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV); - regVal |= SM((ant_div_control1 >> 3), - AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV); - - REG_WRITE(ah, AR_PHY_CCK_DETECT, regVal); - regVal = REG_READ(ah, AR_PHY_CCK_DETECT); - } - - if (pModal->version >= 2) { - ob[0] = pModal->ob_0; - ob[1] = pModal->ob_1; - ob[2] = pModal->ob_2; - ob[3] = pModal->ob_3; - ob[4] = pModal->ob_4; - - db1[0] = pModal->db1_0; - db1[1] = pModal->db1_1; - db1[2] = pModal->db1_2; - db1[3] = pModal->db1_3; - db1[4] = pModal->db1_4; - - db2[0] = pModal->db2_0; - db2[1] = pModal->db2_1; - db2[2] = pModal->db2_2; - db2[3] = pModal->db2_3; - db2[4] = pModal->db2_4; - } else if (pModal->version == 1) { - ob[0] = pModal->ob_0; - ob[1] = ob[2] = ob[3] = ob[4] = pModal->ob_1; - db1[0] = pModal->db1_0; - db1[1] = db1[2] = db1[3] = db1[4] = pModal->db1_1; - db2[0] = pModal->db2_0; - db2[1] = db2[2] = db2[3] = db2[4] = pModal->db2_1; - } else { - int i; - - for (i = 0; i < 5; i++) { - ob[i] = pModal->ob_0; - db1[i] = pModal->db1_0; - db2[i] = pModal->db1_0; - } - } - - if (AR_SREV_9271(ah)) { - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G3, - AR9271_AN_RF2G3_OB_cck, - AR9271_AN_RF2G3_OB_cck_S, - ob[0]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G3, - AR9271_AN_RF2G3_OB_psk, - AR9271_AN_RF2G3_OB_psk_S, - ob[1]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G3, - AR9271_AN_RF2G3_OB_qam, - AR9271_AN_RF2G3_OB_qam_S, - ob[2]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G3, - AR9271_AN_RF2G3_DB_1, - AR9271_AN_RF2G3_DB_1_S, - db1[0]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G4, - AR9271_AN_RF2G4_DB_2, - AR9271_AN_RF2G4_DB_2_S, - db2[0]); - } else { - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G3, - AR9285_AN_RF2G3_OB_0, - AR9285_AN_RF2G3_OB_0_S, - ob[0]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G3, - AR9285_AN_RF2G3_OB_1, - AR9285_AN_RF2G3_OB_1_S, - ob[1]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G3, - AR9285_AN_RF2G3_OB_2, - AR9285_AN_RF2G3_OB_2_S, - ob[2]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G3, - AR9285_AN_RF2G3_OB_3, - AR9285_AN_RF2G3_OB_3_S, - ob[3]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G3, - AR9285_AN_RF2G3_OB_4, - AR9285_AN_RF2G3_OB_4_S, - ob[4]); - - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G3, - AR9285_AN_RF2G3_DB1_0, - AR9285_AN_RF2G3_DB1_0_S, - db1[0]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G3, - AR9285_AN_RF2G3_DB1_1, - AR9285_AN_RF2G3_DB1_1_S, - db1[1]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G3, - AR9285_AN_RF2G3_DB1_2, - AR9285_AN_RF2G3_DB1_2_S, - db1[2]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G4, - AR9285_AN_RF2G4_DB1_3, - AR9285_AN_RF2G4_DB1_3_S, - db1[3]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G4, - AR9285_AN_RF2G4_DB1_4, - AR9285_AN_RF2G4_DB1_4_S, db1[4]); - - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G4, - AR9285_AN_RF2G4_DB2_0, - AR9285_AN_RF2G4_DB2_0_S, - db2[0]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G4, - AR9285_AN_RF2G4_DB2_1, - AR9285_AN_RF2G4_DB2_1_S, - db2[1]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G4, - AR9285_AN_RF2G4_DB2_2, - AR9285_AN_RF2G4_DB2_2_S, - db2[2]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G4, - AR9285_AN_RF2G4_DB2_3, - AR9285_AN_RF2G4_DB2_3_S, - db2[3]); - ath9k_hw_analog_shift_rmw(ah, - AR9285_AN_RF2G4, - AR9285_AN_RF2G4_DB2_4, - AR9285_AN_RF2G4_DB2_4_S, - db2[4]); - } - - - REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, - pModal->switchSettling); - REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_ADC, - pModal->adcDesiredSize); - - REG_WRITE(ah, AR_PHY_RF_CTL4, - SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAA_OFF) | - SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAB_OFF) | - SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAA_ON) | - SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAB_ON)); - - REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_A2_RX_ON, - pModal->txEndToRxOn); - - if (AR_SREV_9271_10(ah)) - REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_A2_RX_ON, - pModal->txEndToRxOn); - REG_RMW_FIELD(ah, AR_PHY_CCA, AR9280_PHY_CCA_THRESH62, - pModal->thresh62); - REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0, AR_PHY_EXT_CCA0_THRESH62, - pModal->thresh62); - - if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >= - AR5416_EEP_MINOR_VER_2) { - REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_END_DATA_START, - pModal->txFrameToDataStart); - REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_END_PA_ON, - pModal->txFrameToPaOn); - } - - if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >= - AR5416_EEP_MINOR_VER_3) { - if (IS_CHAN_HT40(chan)) - REG_RMW_FIELD(ah, AR_PHY_SETTLING, - AR_PHY_SETTLING_SWITCH, - pModal->swSettleHt40); - } - - bb_desired_scale = (pModal->bb_scale_smrt_antenna & - EEP_4K_BB_DESIRED_SCALE_MASK); - if ((pBase->txGainType == 0) && (bb_desired_scale != 0)) { - u32 pwrctrl, mask, clr; - - mask = BIT(0)|BIT(5)|BIT(10)|BIT(15)|BIT(20)|BIT(25); - pwrctrl = mask * bb_desired_scale; - clr = mask * 0x1f; - REG_RMW(ah, AR_PHY_TX_PWRCTRL8, pwrctrl, clr); - REG_RMW(ah, AR_PHY_TX_PWRCTRL10, pwrctrl, clr); - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL12, pwrctrl, clr); - - mask = BIT(0)|BIT(5)|BIT(15); - pwrctrl = mask * bb_desired_scale; - clr = mask * 0x1f; - REG_RMW(ah, AR_PHY_TX_PWRCTRL9, pwrctrl, clr); - - mask = BIT(0)|BIT(5); - pwrctrl = mask * bb_desired_scale; - clr = mask * 0x1f; - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL11, pwrctrl, clr); - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL13, pwrctrl, clr); - } -} - -static u16 ath9k_hw_4k_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz) -{ -#define EEP_MAP4K_SPURCHAN \ - (ah->eeprom.map4k.modalHeader.spurChans[i].spurChan) - struct ath_common *common = ath9k_hw_common(ah); - - u16 spur_val = AR_NO_SPUR; - - ath_dbg(common, ANI, "Getting spur idx:%d is2Ghz:%d val:%x\n", - i, is2GHz, ah->config.spurchans[i][is2GHz]); - - switch (ah->config.spurmode) { - case SPUR_DISABLE: - break; - case SPUR_ENABLE_IOCTL: - spur_val = ah->config.spurchans[i][is2GHz]; - ath_dbg(common, ANI, "Getting spur val from new loc. %d\n", - spur_val); - break; - case SPUR_ENABLE_EEPROM: - spur_val = EEP_MAP4K_SPURCHAN; - break; - } - - return spur_val; - -#undef EEP_MAP4K_SPURCHAN -} - -const struct eeprom_ops eep_4k_ops = { - .check_eeprom = ath9k_hw_4k_check_eeprom, - .get_eeprom = ath9k_hw_4k_get_eeprom, - .fill_eeprom = ath9k_hw_4k_fill_eeprom, - .dump_eeprom = ath9k_hw_4k_dump_eeprom, - .get_eeprom_ver = ath9k_hw_4k_get_eeprom_ver, - .get_eeprom_rev = ath9k_hw_4k_get_eeprom_rev, - .set_board_values = ath9k_hw_4k_set_board_values, - .set_txpower = ath9k_hw_4k_set_txpower, - .get_spur_channel = ath9k_hw_4k_get_spur_channel -}; diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c deleted file mode 100644 index 3ae1f3df0637..000000000000 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ /dev/null @@ -1,1044 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "hw.h" -#include "ar9002_phy.h" - -#define SIZE_EEPROM_AR9287 (sizeof(struct ar9287_eeprom) / sizeof(u16)) - -static int ath9k_hw_ar9287_get_eeprom_ver(struct ath_hw *ah) -{ - return (ah->eeprom.map9287.baseEepHeader.version >> 12) & 0xF; -} - -static int ath9k_hw_ar9287_get_eeprom_rev(struct ath_hw *ah) -{ - return (ah->eeprom.map9287.baseEepHeader.version) & 0xFFF; -} - -static bool __ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah) -{ - struct ar9287_eeprom *eep = &ah->eeprom.map9287; - u16 *eep_data; - int addr, eep_start_loc = AR9287_EEP_START_LOC; - eep_data = (u16 *)eep; - - for (addr = 0; addr < SIZE_EEPROM_AR9287; addr++) { - if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) - return false; - eep_data++; - } - - return true; -} - -static bool __ath9k_hw_usb_ar9287_fill_eeprom(struct ath_hw *ah) -{ - u16 *eep_data = (u16 *)&ah->eeprom.map9287; - - ath9k_hw_usb_gen_fill_eeprom(ah, eep_data, - AR9287_HTC_EEP_START_LOC, - SIZE_EEPROM_AR9287); - return true; -} - -static bool ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - - if (!ath9k_hw_use_flash(ah)) { - ath_dbg(common, EEPROM, "Reading from EEPROM, not flash\n"); - } - - if (common->bus_ops->ath_bus_type == ATH_USB) - return __ath9k_hw_usb_ar9287_fill_eeprom(ah); - else - return __ath9k_hw_ar9287_fill_eeprom(ah); -} - -#if defined(CONFIG_ATH9K_DEBUGFS) || defined(CONFIG_ATH9K_HTC_DEBUGFS) -static u32 ar9287_dump_modal_eeprom(char *buf, u32 len, u32 size, - struct modal_eep_ar9287_header *modal_hdr) -{ - PR_EEP("Chain0 Ant. Control", modal_hdr->antCtrlChain[0]); - PR_EEP("Chain1 Ant. Control", modal_hdr->antCtrlChain[1]); - PR_EEP("Ant. Common Control", modal_hdr->antCtrlCommon); - PR_EEP("Chain0 Ant. Gain", modal_hdr->antennaGainCh[0]); - PR_EEP("Chain1 Ant. Gain", modal_hdr->antennaGainCh[1]); - PR_EEP("Switch Settle", modal_hdr->switchSettling); - PR_EEP("Chain0 TxRxAtten", modal_hdr->txRxAttenCh[0]); - PR_EEP("Chain1 TxRxAtten", modal_hdr->txRxAttenCh[1]); - PR_EEP("Chain0 RxTxMargin", modal_hdr->rxTxMarginCh[0]); - PR_EEP("Chain1 RxTxMargin", modal_hdr->rxTxMarginCh[1]); - PR_EEP("ADC Desired size", modal_hdr->adcDesiredSize); - PR_EEP("txEndToXpaOff", modal_hdr->txEndToXpaOff); - PR_EEP("txEndToRxOn", modal_hdr->txEndToRxOn); - PR_EEP("txFrameToXpaOn", modal_hdr->txFrameToXpaOn); - PR_EEP("CCA Threshold)", modal_hdr->thresh62); - PR_EEP("Chain0 NF Threshold", modal_hdr->noiseFloorThreshCh[0]); - PR_EEP("Chain1 NF Threshold", modal_hdr->noiseFloorThreshCh[1]); - PR_EEP("xpdGain", modal_hdr->xpdGain); - PR_EEP("External PD", modal_hdr->xpd); - PR_EEP("Chain0 I Coefficient", modal_hdr->iqCalICh[0]); - PR_EEP("Chain1 I Coefficient", modal_hdr->iqCalICh[1]); - PR_EEP("Chain0 Q Coefficient", modal_hdr->iqCalQCh[0]); - PR_EEP("Chain1 Q Coefficient", modal_hdr->iqCalQCh[1]); - PR_EEP("pdGainOverlap", modal_hdr->pdGainOverlap); - PR_EEP("xPA Bias Level", modal_hdr->xpaBiasLvl); - PR_EEP("txFrameToDataStart", modal_hdr->txFrameToDataStart); - PR_EEP("txFrameToPaOn", modal_hdr->txFrameToPaOn); - PR_EEP("HT40 Power Inc.", modal_hdr->ht40PowerIncForPdadc); - PR_EEP("Chain0 bswAtten", modal_hdr->bswAtten[0]); - PR_EEP("Chain1 bswAtten", modal_hdr->bswAtten[1]); - PR_EEP("Chain0 bswMargin", modal_hdr->bswMargin[0]); - PR_EEP("Chain1 bswMargin", modal_hdr->bswMargin[1]); - PR_EEP("HT40 Switch Settle", modal_hdr->swSettleHt40); - PR_EEP("AR92x7 Version", modal_hdr->version); - PR_EEP("DriverBias1", modal_hdr->db1); - PR_EEP("DriverBias2", modal_hdr->db1); - PR_EEP("CCK OutputBias", modal_hdr->ob_cck); - PR_EEP("PSK OutputBias", modal_hdr->ob_psk); - PR_EEP("QAM OutputBias", modal_hdr->ob_qam); - PR_EEP("PAL_OFF OutputBias", modal_hdr->ob_pal_off); - - return len; -} - -static u32 ath9k_hw_ar9287_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr, - u8 *buf, u32 len, u32 size) -{ - struct ar9287_eeprom *eep = &ah->eeprom.map9287; - struct base_eep_ar9287_header *pBase = &eep->baseEepHeader; - - if (!dump_base_hdr) { - len += snprintf(buf + len, size - len, - "%20s :\n", "2GHz modal Header"); - len = ar9287_dump_modal_eeprom(buf, len, size, - &eep->modalHeader); - goto out; - } - - PR_EEP("Major Version", pBase->version >> 12); - PR_EEP("Minor Version", pBase->version & 0xFFF); - PR_EEP("Checksum", pBase->checksum); - PR_EEP("Length", pBase->length); - PR_EEP("RegDomain1", pBase->regDmn[0]); - PR_EEP("RegDomain2", pBase->regDmn[1]); - PR_EEP("TX Mask", pBase->txMask); - PR_EEP("RX Mask", pBase->rxMask); - PR_EEP("Allow 5GHz", !!(pBase->opCapFlags & AR5416_OPFLAGS_11A)); - PR_EEP("Allow 2GHz", !!(pBase->opCapFlags & AR5416_OPFLAGS_11G)); - PR_EEP("Disable 2GHz HT20", !!(pBase->opCapFlags & - AR5416_OPFLAGS_N_2G_HT20)); - PR_EEP("Disable 2GHz HT40", !!(pBase->opCapFlags & - AR5416_OPFLAGS_N_2G_HT40)); - PR_EEP("Disable 5Ghz HT20", !!(pBase->opCapFlags & - AR5416_OPFLAGS_N_5G_HT20)); - PR_EEP("Disable 5Ghz HT40", !!(pBase->opCapFlags & - AR5416_OPFLAGS_N_5G_HT40)); - PR_EEP("Big Endian", !!(pBase->eepMisc & 0x01)); - PR_EEP("Cal Bin Major Ver", (pBase->binBuildNumber >> 24) & 0xFF); - PR_EEP("Cal Bin Minor Ver", (pBase->binBuildNumber >> 16) & 0xFF); - PR_EEP("Cal Bin Build", (pBase->binBuildNumber >> 8) & 0xFF); - PR_EEP("Power Table Offset", pBase->pwrTableOffset); - PR_EEP("OpenLoop Power Ctrl", pBase->openLoopPwrCntl); - - len += snprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress", - pBase->macAddr); - -out: - if (len > size) - len = size; - - return len; -} -#else -static u32 ath9k_hw_ar9287_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr, - u8 *buf, u32 len, u32 size) -{ - return 0; -} -#endif - - -static int ath9k_hw_ar9287_check_eeprom(struct ath_hw *ah) -{ - u32 sum = 0, el, integer; - u16 temp, word, magic, magic2, *eepdata; - int i, addr; - bool need_swap = false; - struct ar9287_eeprom *eep = &ah->eeprom.map9287; - struct ath_common *common = ath9k_hw_common(ah); - - if (!ath9k_hw_use_flash(ah)) { - if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, - &magic)) { - ath_err(common, "Reading Magic # failed\n"); - return false; - } - - ath_dbg(common, EEPROM, "Read Magic = 0x%04X\n", magic); - - if (magic != AR5416_EEPROM_MAGIC) { - magic2 = swab16(magic); - - if (magic2 == AR5416_EEPROM_MAGIC) { - need_swap = true; - eepdata = (u16 *)(&ah->eeprom); - - for (addr = 0; addr < SIZE_EEPROM_AR9287; addr++) { - temp = swab16(*eepdata); - *eepdata = temp; - eepdata++; - } - } else { - ath_err(common, - "Invalid EEPROM Magic. Endianness mismatch.\n"); - return -EINVAL; - } - } - } - - ath_dbg(common, EEPROM, "need_swap = %s\n", - need_swap ? "True" : "False"); - - if (need_swap) - el = swab16(ah->eeprom.map9287.baseEepHeader.length); - else - el = ah->eeprom.map9287.baseEepHeader.length; - - if (el > sizeof(struct ar9287_eeprom)) - el = sizeof(struct ar9287_eeprom) / sizeof(u16); - else - el = el / sizeof(u16); - - eepdata = (u16 *)(&ah->eeprom); - - for (i = 0; i < el; i++) - sum ^= *eepdata++; - - if (need_swap) { - word = swab16(eep->baseEepHeader.length); - eep->baseEepHeader.length = word; - - word = swab16(eep->baseEepHeader.checksum); - eep->baseEepHeader.checksum = word; - - word = swab16(eep->baseEepHeader.version); - eep->baseEepHeader.version = word; - - word = swab16(eep->baseEepHeader.regDmn[0]); - eep->baseEepHeader.regDmn[0] = word; - - word = swab16(eep->baseEepHeader.regDmn[1]); - eep->baseEepHeader.regDmn[1] = word; - - word = swab16(eep->baseEepHeader.rfSilent); - eep->baseEepHeader.rfSilent = word; - - word = swab16(eep->baseEepHeader.blueToothOptions); - eep->baseEepHeader.blueToothOptions = word; - - word = swab16(eep->baseEepHeader.deviceCap); - eep->baseEepHeader.deviceCap = word; - - integer = swab32(eep->modalHeader.antCtrlCommon); - eep->modalHeader.antCtrlCommon = integer; - - for (i = 0; i < AR9287_MAX_CHAINS; i++) { - integer = swab32(eep->modalHeader.antCtrlChain[i]); - eep->modalHeader.antCtrlChain[i] = integer; - } - - for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { - word = swab16(eep->modalHeader.spurChans[i].spurChan); - eep->modalHeader.spurChans[i].spurChan = word; - } - } - - if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR9287_EEP_VER - || ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) { - ath_err(common, "Bad EEPROM checksum 0x%x or revision 0x%04x\n", - sum, ah->eep_ops->get_eeprom_ver(ah)); - return -EINVAL; - } - - return 0; -} - -static u32 ath9k_hw_ar9287_get_eeprom(struct ath_hw *ah, - enum eeprom_param param) -{ - struct ar9287_eeprom *eep = &ah->eeprom.map9287; - struct modal_eep_ar9287_header *pModal = &eep->modalHeader; - struct base_eep_ar9287_header *pBase = &eep->baseEepHeader; - u16 ver_minor; - - ver_minor = pBase->version & AR9287_EEP_VER_MINOR_MASK; - - switch (param) { - case EEP_NFTHRESH_2: - return pModal->noiseFloorThreshCh[0]; - case EEP_MAC_LSW: - return get_unaligned_be16(pBase->macAddr); - case EEP_MAC_MID: - return get_unaligned_be16(pBase->macAddr + 2); - case EEP_MAC_MSW: - return get_unaligned_be16(pBase->macAddr + 4); - case EEP_REG_0: - return pBase->regDmn[0]; - case EEP_OP_CAP: - return pBase->deviceCap; - case EEP_OP_MODE: - return pBase->opCapFlags; - case EEP_RF_SILENT: - return pBase->rfSilent; - case EEP_MINOR_REV: - return ver_minor; - case EEP_TX_MASK: - return pBase->txMask; - case EEP_RX_MASK: - return pBase->rxMask; - case EEP_DEV_TYPE: - return pBase->deviceType; - case EEP_OL_PWRCTRL: - return pBase->openLoopPwrCntl; - case EEP_TEMPSENSE_SLOPE: - if (ver_minor >= AR9287_EEP_MINOR_VER_2) - return pBase->tempSensSlope; - else - return 0; - case EEP_TEMPSENSE_SLOPE_PAL_ON: - if (ver_minor >= AR9287_EEP_MINOR_VER_3) - return pBase->tempSensSlopePalOn; - else - return 0; - case EEP_ANTENNA_GAIN_2G: - return max_t(u8, pModal->antennaGainCh[0], - pModal->antennaGainCh[1]); - default: - return 0; - } -} - -static void ar9287_eeprom_get_tx_gain_index(struct ath_hw *ah, - struct ath9k_channel *chan, - struct cal_data_op_loop_ar9287 *pRawDatasetOpLoop, - u8 *pCalChans, u16 availPiers, int8_t *pPwr) -{ - u16 idxL = 0, idxR = 0, numPiers; - bool match; - struct chan_centers centers; - - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - - for (numPiers = 0; numPiers < availPiers; numPiers++) { - if (pCalChans[numPiers] == AR5416_BCHAN_UNUSED) - break; - } - - match = ath9k_hw_get_lower_upper_index( - (u8)FREQ2FBIN(centers.synth_center, IS_CHAN_2GHZ(chan)), - pCalChans, numPiers, &idxL, &idxR); - - if (match) { - *pPwr = (int8_t) pRawDatasetOpLoop[idxL].pwrPdg[0][0]; - } else { - *pPwr = ((int8_t) pRawDatasetOpLoop[idxL].pwrPdg[0][0] + - (int8_t) pRawDatasetOpLoop[idxR].pwrPdg[0][0])/2; - } - -} - -static void ar9287_eeprom_olpc_set_pdadcs(struct ath_hw *ah, - int32_t txPower, u16 chain) -{ - u32 tmpVal; - u32 a; - - /* Enable OLPC for chain 0 */ - - tmpVal = REG_READ(ah, 0xa270); - tmpVal = tmpVal & 0xFCFFFFFF; - tmpVal = tmpVal | (0x3 << 24); - REG_WRITE(ah, 0xa270, tmpVal); - - /* Enable OLPC for chain 1 */ - - tmpVal = REG_READ(ah, 0xb270); - tmpVal = tmpVal & 0xFCFFFFFF; - tmpVal = tmpVal | (0x3 << 24); - REG_WRITE(ah, 0xb270, tmpVal); - - /* Write the OLPC ref power for chain 0 */ - - if (chain == 0) { - tmpVal = REG_READ(ah, 0xa398); - tmpVal = tmpVal & 0xff00ffff; - a = (txPower)&0xff; - tmpVal = tmpVal | (a << 16); - REG_WRITE(ah, 0xa398, tmpVal); - } - - /* Write the OLPC ref power for chain 1 */ - - if (chain == 1) { - tmpVal = REG_READ(ah, 0xb398); - tmpVal = tmpVal & 0xff00ffff; - a = (txPower)&0xff; - tmpVal = tmpVal | (a << 16); - REG_WRITE(ah, 0xb398, tmpVal); - } -} - -static void ath9k_hw_set_ar9287_power_cal_table(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - struct cal_data_per_freq_ar9287 *pRawDataset; - struct cal_data_op_loop_ar9287 *pRawDatasetOpenLoop; - u8 *pCalBChans = NULL; - u16 pdGainOverlap_t2; - u8 pdadcValues[AR5416_NUM_PDADC_VALUES]; - u16 gainBoundaries[AR5416_PD_GAINS_IN_MASK]; - u16 numPiers = 0, i, j; - u16 numXpdGain, xpdMask; - u16 xpdGainValues[AR5416_NUM_PD_GAINS] = {0, 0, 0, 0}; - u32 reg32, regOffset, regChainOffset, regval; - int16_t diff = 0; - struct ar9287_eeprom *pEepData = &ah->eeprom.map9287; - - xpdMask = pEepData->modalHeader.xpdGain; - - if ((pEepData->baseEepHeader.version & AR9287_EEP_VER_MINOR_MASK) >= - AR9287_EEP_MINOR_VER_2) - pdGainOverlap_t2 = pEepData->modalHeader.pdGainOverlap; - else - pdGainOverlap_t2 = (u16)(MS(REG_READ(ah, AR_PHY_TPCRG5), - AR_PHY_TPCRG5_PD_GAIN_OVERLAP)); - - if (IS_CHAN_2GHZ(chan)) { - pCalBChans = pEepData->calFreqPier2G; - numPiers = AR9287_NUM_2G_CAL_PIERS; - if (ath9k_hw_ar9287_get_eeprom(ah, EEP_OL_PWRCTRL)) { - pRawDatasetOpenLoop = - (struct cal_data_op_loop_ar9287 *)pEepData->calPierData2G[0]; - ah->initPDADC = pRawDatasetOpenLoop->vpdPdg[0][0]; - } - } - - numXpdGain = 0; - - /* Calculate the value of xpdgains from the xpdGain Mask */ - for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) { - if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) { - if (numXpdGain >= AR5416_NUM_PD_GAINS) - break; - xpdGainValues[numXpdGain] = - (u16)(AR5416_PD_GAINS_IN_MASK-i); - numXpdGain++; - } - } - - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN, - (numXpdGain - 1) & 0x3); - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1, - xpdGainValues[0]); - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2, - xpdGainValues[1]); - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3, - xpdGainValues[2]); - - for (i = 0; i < AR9287_MAX_CHAINS; i++) { - regChainOffset = i * 0x1000; - - if (pEepData->baseEepHeader.txMask & (1 << i)) { - pRawDatasetOpenLoop = - (struct cal_data_op_loop_ar9287 *)pEepData->calPierData2G[i]; - - if (ath9k_hw_ar9287_get_eeprom(ah, EEP_OL_PWRCTRL)) { - int8_t txPower; - ar9287_eeprom_get_tx_gain_index(ah, chan, - pRawDatasetOpenLoop, - pCalBChans, numPiers, - &txPower); - ar9287_eeprom_olpc_set_pdadcs(ah, txPower, i); - } else { - pRawDataset = - (struct cal_data_per_freq_ar9287 *) - pEepData->calPierData2G[i]; - - ath9k_hw_get_gain_boundaries_pdadcs(ah, chan, - pRawDataset, - pCalBChans, numPiers, - pdGainOverlap_t2, - gainBoundaries, - pdadcValues, - numXpdGain); - } - - ENABLE_REGWRITE_BUFFER(ah); - - if (i == 0) { - if (!ath9k_hw_ar9287_get_eeprom(ah, - EEP_OL_PWRCTRL)) { - - regval = SM(pdGainOverlap_t2, - AR_PHY_TPCRG5_PD_GAIN_OVERLAP) - | SM(gainBoundaries[0], - AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1) - | SM(gainBoundaries[1], - AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2) - | SM(gainBoundaries[2], - AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3) - | SM(gainBoundaries[3], - AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4); - - REG_WRITE(ah, - AR_PHY_TPCRG5 + regChainOffset, - regval); - } - } - - if ((int32_t)AR9287_PWR_TABLE_OFFSET_DB != - pEepData->baseEepHeader.pwrTableOffset) { - diff = (u16)(pEepData->baseEepHeader.pwrTableOffset - - (int32_t)AR9287_PWR_TABLE_OFFSET_DB); - diff *= 2; - - for (j = 0; j < ((u16)AR5416_NUM_PDADC_VALUES-diff); j++) - pdadcValues[j] = pdadcValues[j+diff]; - - for (j = (u16)(AR5416_NUM_PDADC_VALUES-diff); - j < AR5416_NUM_PDADC_VALUES; j++) - pdadcValues[j] = - pdadcValues[AR5416_NUM_PDADC_VALUES-diff]; - } - - if (!ath9k_hw_ar9287_get_eeprom(ah, EEP_OL_PWRCTRL)) { - regOffset = AR_PHY_BASE + - (672 << 2) + regChainOffset; - - for (j = 0; j < 32; j++) { - reg32 = get_unaligned_le32(&pdadcValues[4 * j]); - - REG_WRITE(ah, regOffset, reg32); - regOffset += 4; - } - } - REGWRITE_BUFFER_FLUSH(ah); - } - } -} - -static void ath9k_hw_set_ar9287_power_per_rate_table(struct ath_hw *ah, - struct ath9k_channel *chan, - int16_t *ratesArray, - u16 cfgCtl, - u16 antenna_reduction, - u16 powerLimit) -{ -#define CMP_CTL \ - (((cfgCtl & ~CTL_MODE_M) | (pCtlMode[ctlMode] & CTL_MODE_M)) == \ - pEepData->ctlIndex[i]) - -#define CMP_NO_CTL \ - (((cfgCtl & ~CTL_MODE_M) | (pCtlMode[ctlMode] & CTL_MODE_M)) == \ - ((pEepData->ctlIndex[i] & CTL_MODE_M) | SD_NO_CTL)) - - u16 twiceMaxEdgePower; - int i; - struct cal_ctl_data_ar9287 *rep; - struct cal_target_power_leg targetPowerOfdm = {0, {0, 0, 0, 0} }, - targetPowerCck = {0, {0, 0, 0, 0} }; - struct cal_target_power_leg targetPowerOfdmExt = {0, {0, 0, 0, 0} }, - targetPowerCckExt = {0, {0, 0, 0, 0} }; - struct cal_target_power_ht targetPowerHt20, - targetPowerHt40 = {0, {0, 0, 0, 0} }; - u16 scaledPower = 0, minCtlPower; - static const u16 ctlModesFor11g[] = { - CTL_11B, CTL_11G, CTL_2GHT20, - CTL_11B_EXT, CTL_11G_EXT, CTL_2GHT40 - }; - u16 numCtlModes = 0; - const u16 *pCtlMode = NULL; - u16 ctlMode, freq; - struct chan_centers centers; - int tx_chainmask; - u16 twiceMinEdgePower; - struct ar9287_eeprom *pEepData = &ah->eeprom.map9287; - tx_chainmask = ah->txchainmask; - - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - scaledPower = ath9k_hw_get_scaled_power(ah, powerLimit, - antenna_reduction); - - /* - * Get TX power from EEPROM. - */ - if (IS_CHAN_2GHZ(chan)) { - /* CTL_11B, CTL_11G, CTL_2GHT20 */ - numCtlModes = - ARRAY_SIZE(ctlModesFor11g) - SUB_NUM_CTL_MODES_AT_2G_40; - - pCtlMode = ctlModesFor11g; - - ath9k_hw_get_legacy_target_powers(ah, chan, - pEepData->calTargetPowerCck, - AR9287_NUM_2G_CCK_TARGET_POWERS, - &targetPowerCck, 4, false); - ath9k_hw_get_legacy_target_powers(ah, chan, - pEepData->calTargetPower2G, - AR9287_NUM_2G_20_TARGET_POWERS, - &targetPowerOfdm, 4, false); - ath9k_hw_get_target_powers(ah, chan, - pEepData->calTargetPower2GHT20, - AR9287_NUM_2G_20_TARGET_POWERS, - &targetPowerHt20, 8, false); - - if (IS_CHAN_HT40(chan)) { - /* All 2G CTLs */ - numCtlModes = ARRAY_SIZE(ctlModesFor11g); - ath9k_hw_get_target_powers(ah, chan, - pEepData->calTargetPower2GHT40, - AR9287_NUM_2G_40_TARGET_POWERS, - &targetPowerHt40, 8, true); - ath9k_hw_get_legacy_target_powers(ah, chan, - pEepData->calTargetPowerCck, - AR9287_NUM_2G_CCK_TARGET_POWERS, - &targetPowerCckExt, 4, true); - ath9k_hw_get_legacy_target_powers(ah, chan, - pEepData->calTargetPower2G, - AR9287_NUM_2G_20_TARGET_POWERS, - &targetPowerOfdmExt, 4, true); - } - } - - for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) { - bool isHt40CtlMode = - (pCtlMode[ctlMode] == CTL_2GHT40) ? true : false; - - if (isHt40CtlMode) - freq = centers.synth_center; - else if (pCtlMode[ctlMode] & EXT_ADDITIVE) - freq = centers.ext_center; - else - freq = centers.ctl_center; - - twiceMaxEdgePower = MAX_RATE_POWER; - /* Walk through the CTL indices stored in EEPROM */ - for (i = 0; (i < AR9287_NUM_CTLS) && pEepData->ctlIndex[i]; i++) { - struct cal_ctl_edges *pRdEdgesPower; - - /* - * Compare test group from regulatory channel list - * with test mode from pCtlMode list - */ - if (CMP_CTL || CMP_NO_CTL) { - rep = &(pEepData->ctlData[i]); - pRdEdgesPower = - rep->ctlEdges[ar5416_get_ntxchains(tx_chainmask) - 1]; - - twiceMinEdgePower = ath9k_hw_get_max_edge_power(freq, - pRdEdgesPower, - IS_CHAN_2GHZ(chan), - AR5416_NUM_BAND_EDGES); - - if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL) { - twiceMaxEdgePower = min(twiceMaxEdgePower, - twiceMinEdgePower); - } else { - twiceMaxEdgePower = twiceMinEdgePower; - break; - } - } - } - - minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower); - - /* Apply ctl mode to correct target power set */ - switch (pCtlMode[ctlMode]) { - case CTL_11B: - for (i = 0; i < ARRAY_SIZE(targetPowerCck.tPow2x); i++) { - targetPowerCck.tPow2x[i] = - (u8)min((u16)targetPowerCck.tPow2x[i], - minCtlPower); - } - break; - case CTL_11A: - case CTL_11G: - for (i = 0; i < ARRAY_SIZE(targetPowerOfdm.tPow2x); i++) { - targetPowerOfdm.tPow2x[i] = - (u8)min((u16)targetPowerOfdm.tPow2x[i], - minCtlPower); - } - break; - case CTL_5GHT20: - case CTL_2GHT20: - for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++) { - targetPowerHt20.tPow2x[i] = - (u8)min((u16)targetPowerHt20.tPow2x[i], - minCtlPower); - } - break; - case CTL_11B_EXT: - targetPowerCckExt.tPow2x[0] = - (u8)min((u16)targetPowerCckExt.tPow2x[0], - minCtlPower); - break; - case CTL_11A_EXT: - case CTL_11G_EXT: - targetPowerOfdmExt.tPow2x[0] = - (u8)min((u16)targetPowerOfdmExt.tPow2x[0], - minCtlPower); - break; - case CTL_5GHT40: - case CTL_2GHT40: - for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) { - targetPowerHt40.tPow2x[i] = - (u8)min((u16)targetPowerHt40.tPow2x[i], - minCtlPower); - } - break; - default: - break; - } - } - - /* Now set the rates array */ - - ratesArray[rate6mb] = - ratesArray[rate9mb] = - ratesArray[rate12mb] = - ratesArray[rate18mb] = - ratesArray[rate24mb] = targetPowerOfdm.tPow2x[0]; - - ratesArray[rate36mb] = targetPowerOfdm.tPow2x[1]; - ratesArray[rate48mb] = targetPowerOfdm.tPow2x[2]; - ratesArray[rate54mb] = targetPowerOfdm.tPow2x[3]; - ratesArray[rateXr] = targetPowerOfdm.tPow2x[0]; - - for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++) - ratesArray[rateHt20_0 + i] = targetPowerHt20.tPow2x[i]; - - if (IS_CHAN_2GHZ(chan)) { - ratesArray[rate1l] = targetPowerCck.tPow2x[0]; - ratesArray[rate2s] = - ratesArray[rate2l] = targetPowerCck.tPow2x[1]; - ratesArray[rate5_5s] = - ratesArray[rate5_5l] = targetPowerCck.tPow2x[2]; - ratesArray[rate11s] = - ratesArray[rate11l] = targetPowerCck.tPow2x[3]; - } - if (IS_CHAN_HT40(chan)) { - for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) - ratesArray[rateHt40_0 + i] = targetPowerHt40.tPow2x[i]; - - ratesArray[rateDupOfdm] = targetPowerHt40.tPow2x[0]; - ratesArray[rateDupCck] = targetPowerHt40.tPow2x[0]; - ratesArray[rateExtOfdm] = targetPowerOfdmExt.tPow2x[0]; - - if (IS_CHAN_2GHZ(chan)) - ratesArray[rateExtCck] = targetPowerCckExt.tPow2x[0]; - } - -#undef CMP_CTL -#undef CMP_NO_CTL -} - -static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah, - struct ath9k_channel *chan, u16 cfgCtl, - u8 twiceAntennaReduction, - u8 powerLimit, bool test) -{ - struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); - struct ar9287_eeprom *pEepData = &ah->eeprom.map9287; - struct modal_eep_ar9287_header *pModal = &pEepData->modalHeader; - int16_t ratesArray[Ar5416RateSize]; - u8 ht40PowerIncForPdadc = 2; - int i; - - memset(ratesArray, 0, sizeof(ratesArray)); - - if ((pEepData->baseEepHeader.version & AR9287_EEP_VER_MINOR_MASK) >= - AR9287_EEP_MINOR_VER_2) - ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc; - - ath9k_hw_set_ar9287_power_per_rate_table(ah, chan, - &ratesArray[0], cfgCtl, - twiceAntennaReduction, - powerLimit); - - ath9k_hw_set_ar9287_power_cal_table(ah, chan); - - regulatory->max_power_level = 0; - for (i = 0; i < ARRAY_SIZE(ratesArray); i++) { - if (ratesArray[i] > MAX_RATE_POWER) - ratesArray[i] = MAX_RATE_POWER; - - if (ratesArray[i] > regulatory->max_power_level) - regulatory->max_power_level = ratesArray[i]; - } - - ath9k_hw_update_regulatory_maxpower(ah); - - if (test) - return; - - for (i = 0; i < Ar5416RateSize; i++) - ratesArray[i] -= AR9287_PWR_TABLE_OFFSET_DB * 2; - - ENABLE_REGWRITE_BUFFER(ah); - - /* OFDM power per rate */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE1, - ATH9K_POW_SM(ratesArray[rate18mb], 24) - | ATH9K_POW_SM(ratesArray[rate12mb], 16) - | ATH9K_POW_SM(ratesArray[rate9mb], 8) - | ATH9K_POW_SM(ratesArray[rate6mb], 0)); - - REG_WRITE(ah, AR_PHY_POWER_TX_RATE2, - ATH9K_POW_SM(ratesArray[rate54mb], 24) - | ATH9K_POW_SM(ratesArray[rate48mb], 16) - | ATH9K_POW_SM(ratesArray[rate36mb], 8) - | ATH9K_POW_SM(ratesArray[rate24mb], 0)); - - /* CCK power per rate */ - if (IS_CHAN_2GHZ(chan)) { - REG_WRITE(ah, AR_PHY_POWER_TX_RATE3, - ATH9K_POW_SM(ratesArray[rate2s], 24) - | ATH9K_POW_SM(ratesArray[rate2l], 16) - | ATH9K_POW_SM(ratesArray[rateXr], 8) - | ATH9K_POW_SM(ratesArray[rate1l], 0)); - REG_WRITE(ah, AR_PHY_POWER_TX_RATE4, - ATH9K_POW_SM(ratesArray[rate11s], 24) - | ATH9K_POW_SM(ratesArray[rate11l], 16) - | ATH9K_POW_SM(ratesArray[rate5_5s], 8) - | ATH9K_POW_SM(ratesArray[rate5_5l], 0)); - } - - /* HT20 power per rate */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE5, - ATH9K_POW_SM(ratesArray[rateHt20_3], 24) - | ATH9K_POW_SM(ratesArray[rateHt20_2], 16) - | ATH9K_POW_SM(ratesArray[rateHt20_1], 8) - | ATH9K_POW_SM(ratesArray[rateHt20_0], 0)); - - REG_WRITE(ah, AR_PHY_POWER_TX_RATE6, - ATH9K_POW_SM(ratesArray[rateHt20_7], 24) - | ATH9K_POW_SM(ratesArray[rateHt20_6], 16) - | ATH9K_POW_SM(ratesArray[rateHt20_5], 8) - | ATH9K_POW_SM(ratesArray[rateHt20_4], 0)); - - /* HT40 power per rate */ - if (IS_CHAN_HT40(chan)) { - if (ath9k_hw_ar9287_get_eeprom(ah, EEP_OL_PWRCTRL)) { - REG_WRITE(ah, AR_PHY_POWER_TX_RATE7, - ATH9K_POW_SM(ratesArray[rateHt40_3], 24) - | ATH9K_POW_SM(ratesArray[rateHt40_2], 16) - | ATH9K_POW_SM(ratesArray[rateHt40_1], 8) - | ATH9K_POW_SM(ratesArray[rateHt40_0], 0)); - - REG_WRITE(ah, AR_PHY_POWER_TX_RATE8, - ATH9K_POW_SM(ratesArray[rateHt40_7], 24) - | ATH9K_POW_SM(ratesArray[rateHt40_6], 16) - | ATH9K_POW_SM(ratesArray[rateHt40_5], 8) - | ATH9K_POW_SM(ratesArray[rateHt40_4], 0)); - } else { - REG_WRITE(ah, AR_PHY_POWER_TX_RATE7, - ATH9K_POW_SM(ratesArray[rateHt40_3] + - ht40PowerIncForPdadc, 24) - | ATH9K_POW_SM(ratesArray[rateHt40_2] + - ht40PowerIncForPdadc, 16) - | ATH9K_POW_SM(ratesArray[rateHt40_1] + - ht40PowerIncForPdadc, 8) - | ATH9K_POW_SM(ratesArray[rateHt40_0] + - ht40PowerIncForPdadc, 0)); - - REG_WRITE(ah, AR_PHY_POWER_TX_RATE8, - ATH9K_POW_SM(ratesArray[rateHt40_7] + - ht40PowerIncForPdadc, 24) - | ATH9K_POW_SM(ratesArray[rateHt40_6] + - ht40PowerIncForPdadc, 16) - | ATH9K_POW_SM(ratesArray[rateHt40_5] + - ht40PowerIncForPdadc, 8) - | ATH9K_POW_SM(ratesArray[rateHt40_4] + - ht40PowerIncForPdadc, 0)); - } - - /* Dup/Ext power per rate */ - REG_WRITE(ah, AR_PHY_POWER_TX_RATE9, - ATH9K_POW_SM(ratesArray[rateExtOfdm], 24) - | ATH9K_POW_SM(ratesArray[rateExtCck], 16) - | ATH9K_POW_SM(ratesArray[rateDupOfdm], 8) - | ATH9K_POW_SM(ratesArray[rateDupCck], 0)); - } - REGWRITE_BUFFER_FLUSH(ah); -} - -static void ath9k_hw_ar9287_set_board_values(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - struct ar9287_eeprom *eep = &ah->eeprom.map9287; - struct modal_eep_ar9287_header *pModal = &eep->modalHeader; - u32 regChainOffset, regval; - u8 txRxAttenLocal; - int i; - - pModal = &eep->modalHeader; - - REG_WRITE(ah, AR_PHY_SWITCH_COM, pModal->antCtrlCommon); - - for (i = 0; i < AR9287_MAX_CHAINS; i++) { - regChainOffset = i * 0x1000; - - REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset, - pModal->antCtrlChain[i]); - - REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset, - (REG_READ(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset) - & ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF | - AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) | - SM(pModal->iqCalICh[i], - AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) | - SM(pModal->iqCalQCh[i], - AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF)); - - txRxAttenLocal = pModal->txRxAttenCh[i]; - - REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset, - AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN, - pModal->bswMargin[i]); - REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset, - AR_PHY_GAIN_2GHZ_XATTEN1_DB, - pModal->bswAtten[i]); - REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset, - AR9280_PHY_RXGAIN_TXRX_ATTEN, - txRxAttenLocal); - REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset, - AR9280_PHY_RXGAIN_TXRX_MARGIN, - pModal->rxTxMarginCh[i]); - } - - - if (IS_CHAN_HT40(chan)) - REG_RMW_FIELD(ah, AR_PHY_SETTLING, - AR_PHY_SETTLING_SWITCH, pModal->swSettleHt40); - else - REG_RMW_FIELD(ah, AR_PHY_SETTLING, - AR_PHY_SETTLING_SWITCH, pModal->switchSettling); - - REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, - AR_PHY_DESIRED_SZ_ADC, pModal->adcDesiredSize); - - REG_WRITE(ah, AR_PHY_RF_CTL4, - SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAA_OFF) - | SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAB_OFF) - | SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAA_ON) - | SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAB_ON)); - - REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, - AR_PHY_TX_END_TO_A2_RX_ON, pModal->txEndToRxOn); - - REG_RMW_FIELD(ah, AR_PHY_CCA, - AR9280_PHY_CCA_THRESH62, pModal->thresh62); - REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0, - AR_PHY_EXT_CCA0_THRESH62, pModal->thresh62); - - regval = REG_READ(ah, AR9287_AN_RF2G3_CH0); - regval &= ~(AR9287_AN_RF2G3_DB1 | - AR9287_AN_RF2G3_DB2 | - AR9287_AN_RF2G3_OB_CCK | - AR9287_AN_RF2G3_OB_PSK | - AR9287_AN_RF2G3_OB_QAM | - AR9287_AN_RF2G3_OB_PAL_OFF); - regval |= (SM(pModal->db1, AR9287_AN_RF2G3_DB1) | - SM(pModal->db2, AR9287_AN_RF2G3_DB2) | - SM(pModal->ob_cck, AR9287_AN_RF2G3_OB_CCK) | - SM(pModal->ob_psk, AR9287_AN_RF2G3_OB_PSK) | - SM(pModal->ob_qam, AR9287_AN_RF2G3_OB_QAM) | - SM(pModal->ob_pal_off, AR9287_AN_RF2G3_OB_PAL_OFF)); - - ath9k_hw_analog_shift_regwrite(ah, AR9287_AN_RF2G3_CH0, regval); - - regval = REG_READ(ah, AR9287_AN_RF2G3_CH1); - regval &= ~(AR9287_AN_RF2G3_DB1 | - AR9287_AN_RF2G3_DB2 | - AR9287_AN_RF2G3_OB_CCK | - AR9287_AN_RF2G3_OB_PSK | - AR9287_AN_RF2G3_OB_QAM | - AR9287_AN_RF2G3_OB_PAL_OFF); - regval |= (SM(pModal->db1, AR9287_AN_RF2G3_DB1) | - SM(pModal->db2, AR9287_AN_RF2G3_DB2) | - SM(pModal->ob_cck, AR9287_AN_RF2G3_OB_CCK) | - SM(pModal->ob_psk, AR9287_AN_RF2G3_OB_PSK) | - SM(pModal->ob_qam, AR9287_AN_RF2G3_OB_QAM) | - SM(pModal->ob_pal_off, AR9287_AN_RF2G3_OB_PAL_OFF)); - - ath9k_hw_analog_shift_regwrite(ah, AR9287_AN_RF2G3_CH1, regval); - - REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, - AR_PHY_TX_END_DATA_START, pModal->txFrameToDataStart); - REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, - AR_PHY_TX_END_PA_ON, pModal->txFrameToPaOn); - - ath9k_hw_analog_shift_rmw(ah, AR9287_AN_TOP2, - AR9287_AN_TOP2_XPABIAS_LVL, - AR9287_AN_TOP2_XPABIAS_LVL_S, - pModal->xpaBiasLvl); -} - -static u16 ath9k_hw_ar9287_get_spur_channel(struct ath_hw *ah, - u16 i, bool is2GHz) -{ -#define EEP_MAP9287_SPURCHAN \ - (ah->eeprom.map9287.modalHeader.spurChans[i].spurChan) - - struct ath_common *common = ath9k_hw_common(ah); - u16 spur_val = AR_NO_SPUR; - - ath_dbg(common, ANI, "Getting spur idx:%d is2Ghz:%d val:%x\n", - i, is2GHz, ah->config.spurchans[i][is2GHz]); - - switch (ah->config.spurmode) { - case SPUR_DISABLE: - break; - case SPUR_ENABLE_IOCTL: - spur_val = ah->config.spurchans[i][is2GHz]; - ath_dbg(common, ANI, "Getting spur val from new loc. %d\n", - spur_val); - break; - case SPUR_ENABLE_EEPROM: - spur_val = EEP_MAP9287_SPURCHAN; - break; - } - - return spur_val; - -#undef EEP_MAP9287_SPURCHAN -} - -const struct eeprom_ops eep_ar9287_ops = { - .check_eeprom = ath9k_hw_ar9287_check_eeprom, - .get_eeprom = ath9k_hw_ar9287_get_eeprom, - .fill_eeprom = ath9k_hw_ar9287_fill_eeprom, - .dump_eeprom = ath9k_hw_ar9287_dump_eeprom, - .get_eeprom_ver = ath9k_hw_ar9287_get_eeprom_ver, - .get_eeprom_rev = ath9k_hw_ar9287_get_eeprom_rev, - .set_board_values = ath9k_hw_ar9287_set_board_values, - .set_txpower = ath9k_hw_ar9287_set_txpower, - .get_spur_channel = ath9k_hw_ar9287_get_spur_channel -}; diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c deleted file mode 100644 index 1c25368b3836..000000000000 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c +++ /dev/null @@ -1,1389 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "hw.h" -#include "ar9002_phy.h" - -static void ath9k_get_txgain_index(struct ath_hw *ah, - struct ath9k_channel *chan, - struct calDataPerFreqOpLoop *rawDatasetOpLoop, - u8 *calChans, u16 availPiers, u8 *pwr, u8 *pcdacIdx) -{ - u8 pcdac, i = 0; - u16 idxL = 0, idxR = 0, numPiers; - bool match; - struct chan_centers centers; - - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - - for (numPiers = 0; numPiers < availPiers; numPiers++) - if (calChans[numPiers] == AR5416_BCHAN_UNUSED) - break; - - match = ath9k_hw_get_lower_upper_index( - (u8)FREQ2FBIN(centers.synth_center, IS_CHAN_2GHZ(chan)), - calChans, numPiers, &idxL, &idxR); - if (match) { - pcdac = rawDatasetOpLoop[idxL].pcdac[0][0]; - *pwr = rawDatasetOpLoop[idxL].pwrPdg[0][0]; - } else { - pcdac = rawDatasetOpLoop[idxR].pcdac[0][0]; - *pwr = (rawDatasetOpLoop[idxL].pwrPdg[0][0] + - rawDatasetOpLoop[idxR].pwrPdg[0][0])/2; - } - - while (pcdac > ah->originalGain[i] && - i < (AR9280_TX_GAIN_TABLE_SIZE - 1)) - i++; - - *pcdacIdx = i; -} - -static void ath9k_olc_get_pdadcs(struct ath_hw *ah, - u32 initTxGain, - int txPower, - u8 *pPDADCValues) -{ - u32 i; - u32 offset; - - REG_RMW_FIELD(ah, AR_PHY_TX_PWRCTRL6_0, - AR_PHY_TX_PWRCTRL_ERR_EST_MODE, 3); - REG_RMW_FIELD(ah, AR_PHY_TX_PWRCTRL6_1, - AR_PHY_TX_PWRCTRL_ERR_EST_MODE, 3); - - REG_RMW_FIELD(ah, AR_PHY_TX_PWRCTRL7, - AR_PHY_TX_PWRCTRL_INIT_TX_GAIN, initTxGain); - - offset = txPower; - for (i = 0; i < AR5416_NUM_PDADC_VALUES; i++) - if (i < offset) - pPDADCValues[i] = 0x0; - else - pPDADCValues[i] = 0xFF; -} - -static int ath9k_hw_def_get_eeprom_ver(struct ath_hw *ah) -{ - return ((ah->eeprom.def.baseEepHeader.version >> 12) & 0xF); -} - -static int ath9k_hw_def_get_eeprom_rev(struct ath_hw *ah) -{ - return ((ah->eeprom.def.baseEepHeader.version) & 0xFFF); -} - -#define SIZE_EEPROM_DEF (sizeof(struct ar5416_eeprom_def) / sizeof(u16)) - -static bool __ath9k_hw_def_fill_eeprom(struct ath_hw *ah) -{ - u16 *eep_data = (u16 *)&ah->eeprom.def; - int addr, ar5416_eep_start_loc = 0x100; - - for (addr = 0; addr < SIZE_EEPROM_DEF; addr++) { - if (!ath9k_hw_nvram_read(ah, addr + ar5416_eep_start_loc, - eep_data)) - return false; - eep_data++; - } - return true; -} - -static bool __ath9k_hw_usb_def_fill_eeprom(struct ath_hw *ah) -{ - u16 *eep_data = (u16 *)&ah->eeprom.def; - - ath9k_hw_usb_gen_fill_eeprom(ah, eep_data, - 0x100, SIZE_EEPROM_DEF); - return true; -} - -static bool ath9k_hw_def_fill_eeprom(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - - if (!ath9k_hw_use_flash(ah)) { - ath_dbg(common, EEPROM, "Reading from EEPROM, not flash\n"); - } - - if (common->bus_ops->ath_bus_type == ATH_USB) - return __ath9k_hw_usb_def_fill_eeprom(ah); - else - return __ath9k_hw_def_fill_eeprom(ah); -} - -#undef SIZE_EEPROM_DEF - -#if defined(CONFIG_ATH9K_DEBUGFS) || defined(CONFIG_ATH9K_HTC_DEBUGFS) -static u32 ath9k_def_dump_modal_eeprom(char *buf, u32 len, u32 size, - struct modal_eep_header *modal_hdr) -{ - PR_EEP("Chain0 Ant. Control", modal_hdr->antCtrlChain[0]); - PR_EEP("Chain1 Ant. Control", modal_hdr->antCtrlChain[1]); - PR_EEP("Chain2 Ant. Control", modal_hdr->antCtrlChain[2]); - PR_EEP("Ant. Common Control", modal_hdr->antCtrlCommon); - PR_EEP("Chain0 Ant. Gain", modal_hdr->antennaGainCh[0]); - PR_EEP("Chain1 Ant. Gain", modal_hdr->antennaGainCh[1]); - PR_EEP("Chain2 Ant. Gain", modal_hdr->antennaGainCh[2]); - PR_EEP("Switch Settle", modal_hdr->switchSettling); - PR_EEP("Chain0 TxRxAtten", modal_hdr->txRxAttenCh[0]); - PR_EEP("Chain1 TxRxAtten", modal_hdr->txRxAttenCh[1]); - PR_EEP("Chain2 TxRxAtten", modal_hdr->txRxAttenCh[2]); - PR_EEP("Chain0 RxTxMargin", modal_hdr->rxTxMarginCh[0]); - PR_EEP("Chain1 RxTxMargin", modal_hdr->rxTxMarginCh[1]); - PR_EEP("Chain2 RxTxMargin", modal_hdr->rxTxMarginCh[2]); - PR_EEP("ADC Desired size", modal_hdr->adcDesiredSize); - PR_EEP("PGA Desired size", modal_hdr->pgaDesiredSize); - PR_EEP("Chain0 xlna Gain", modal_hdr->xlnaGainCh[0]); - PR_EEP("Chain1 xlna Gain", modal_hdr->xlnaGainCh[1]); - PR_EEP("Chain2 xlna Gain", modal_hdr->xlnaGainCh[2]); - PR_EEP("txEndToXpaOff", modal_hdr->txEndToXpaOff); - PR_EEP("txEndToRxOn", modal_hdr->txEndToRxOn); - PR_EEP("txFrameToXpaOn", modal_hdr->txFrameToXpaOn); - PR_EEP("CCA Threshold)", modal_hdr->thresh62); - PR_EEP("Chain0 NF Threshold", modal_hdr->noiseFloorThreshCh[0]); - PR_EEP("Chain1 NF Threshold", modal_hdr->noiseFloorThreshCh[1]); - PR_EEP("Chain2 NF Threshold", modal_hdr->noiseFloorThreshCh[2]); - PR_EEP("xpdGain", modal_hdr->xpdGain); - PR_EEP("External PD", modal_hdr->xpd); - PR_EEP("Chain0 I Coefficient", modal_hdr->iqCalICh[0]); - PR_EEP("Chain1 I Coefficient", modal_hdr->iqCalICh[1]); - PR_EEP("Chain2 I Coefficient", modal_hdr->iqCalICh[2]); - PR_EEP("Chain0 Q Coefficient", modal_hdr->iqCalQCh[0]); - PR_EEP("Chain1 Q Coefficient", modal_hdr->iqCalQCh[1]); - PR_EEP("Chain2 Q Coefficient", modal_hdr->iqCalQCh[2]); - PR_EEP("pdGainOverlap", modal_hdr->pdGainOverlap); - PR_EEP("Chain0 OutputBias", modal_hdr->ob); - PR_EEP("Chain0 DriverBias", modal_hdr->db); - PR_EEP("xPA Bias Level", modal_hdr->xpaBiasLvl); - PR_EEP("2chain pwr decrease", modal_hdr->pwrDecreaseFor2Chain); - PR_EEP("3chain pwr decrease", modal_hdr->pwrDecreaseFor3Chain); - PR_EEP("txFrameToDataStart", modal_hdr->txFrameToDataStart); - PR_EEP("txFrameToPaOn", modal_hdr->txFrameToPaOn); - PR_EEP("HT40 Power Inc.", modal_hdr->ht40PowerIncForPdadc); - PR_EEP("Chain0 bswAtten", modal_hdr->bswAtten[0]); - PR_EEP("Chain1 bswAtten", modal_hdr->bswAtten[1]); - PR_EEP("Chain2 bswAtten", modal_hdr->bswAtten[2]); - PR_EEP("Chain0 bswMargin", modal_hdr->bswMargin[0]); - PR_EEP("Chain1 bswMargin", modal_hdr->bswMargin[1]); - PR_EEP("Chain2 bswMargin", modal_hdr->bswMargin[2]); - PR_EEP("HT40 Switch Settle", modal_hdr->swSettleHt40); - PR_EEP("Chain0 xatten2Db", modal_hdr->xatten2Db[0]); - PR_EEP("Chain1 xatten2Db", modal_hdr->xatten2Db[1]); - PR_EEP("Chain2 xatten2Db", modal_hdr->xatten2Db[2]); - PR_EEP("Chain0 xatten2Margin", modal_hdr->xatten2Margin[0]); - PR_EEP("Chain1 xatten2Margin", modal_hdr->xatten2Margin[1]); - PR_EEP("Chain2 xatten2Margin", modal_hdr->xatten2Margin[2]); - PR_EEP("Chain1 OutputBias", modal_hdr->ob_ch1); - PR_EEP("Chain1 DriverBias", modal_hdr->db_ch1); - PR_EEP("LNA Control", modal_hdr->lna_ctl); - PR_EEP("XPA Bias Freq0", modal_hdr->xpaBiasLvlFreq[0]); - PR_EEP("XPA Bias Freq1", modal_hdr->xpaBiasLvlFreq[1]); - PR_EEP("XPA Bias Freq2", modal_hdr->xpaBiasLvlFreq[2]); - - return len; -} - -static u32 ath9k_hw_def_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr, - u8 *buf, u32 len, u32 size) -{ - struct ar5416_eeprom_def *eep = &ah->eeprom.def; - struct base_eep_header *pBase = &eep->baseEepHeader; - - if (!dump_base_hdr) { - len += snprintf(buf + len, size - len, - "%20s :\n", "2GHz modal Header"); - len = ath9k_def_dump_modal_eeprom(buf, len, size, - &eep->modalHeader[0]); - len += snprintf(buf + len, size - len, - "%20s :\n", "5GHz modal Header"); - len = ath9k_def_dump_modal_eeprom(buf, len, size, - &eep->modalHeader[1]); - goto out; - } - - PR_EEP("Major Version", pBase->version >> 12); - PR_EEP("Minor Version", pBase->version & 0xFFF); - PR_EEP("Checksum", pBase->checksum); - PR_EEP("Length", pBase->length); - PR_EEP("RegDomain1", pBase->regDmn[0]); - PR_EEP("RegDomain2", pBase->regDmn[1]); - PR_EEP("TX Mask", pBase->txMask); - PR_EEP("RX Mask", pBase->rxMask); - PR_EEP("Allow 5GHz", !!(pBase->opCapFlags & AR5416_OPFLAGS_11A)); - PR_EEP("Allow 2GHz", !!(pBase->opCapFlags & AR5416_OPFLAGS_11G)); - PR_EEP("Disable 2GHz HT20", !!(pBase->opCapFlags & - AR5416_OPFLAGS_N_2G_HT20)); - PR_EEP("Disable 2GHz HT40", !!(pBase->opCapFlags & - AR5416_OPFLAGS_N_2G_HT40)); - PR_EEP("Disable 5Ghz HT20", !!(pBase->opCapFlags & - AR5416_OPFLAGS_N_5G_HT20)); - PR_EEP("Disable 5Ghz HT40", !!(pBase->opCapFlags & - AR5416_OPFLAGS_N_5G_HT40)); - PR_EEP("Big Endian", !!(pBase->eepMisc & 0x01)); - PR_EEP("Cal Bin Major Ver", (pBase->binBuildNumber >> 24) & 0xFF); - PR_EEP("Cal Bin Minor Ver", (pBase->binBuildNumber >> 16) & 0xFF); - PR_EEP("Cal Bin Build", (pBase->binBuildNumber >> 8) & 0xFF); - PR_EEP("OpenLoop Power Ctrl", pBase->openLoopPwrCntl); - - len += snprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress", - pBase->macAddr); - -out: - if (len > size) - len = size; - - return len; -} -#else -static u32 ath9k_hw_def_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr, - u8 *buf, u32 len, u32 size) -{ - return 0; -} -#endif - - -static int ath9k_hw_def_check_eeprom(struct ath_hw *ah) -{ - struct ar5416_eeprom_def *eep = &ah->eeprom.def; - struct ath_common *common = ath9k_hw_common(ah); - u16 *eepdata, temp, magic, magic2; - u32 sum = 0, el; - bool need_swap = false; - int i, addr, size; - - if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { - ath_err(common, "Reading Magic # failed\n"); - return false; - } - - if (!ath9k_hw_use_flash(ah)) { - ath_dbg(common, EEPROM, "Read Magic = 0x%04X\n", magic); - - if (magic != AR5416_EEPROM_MAGIC) { - magic2 = swab16(magic); - - if (magic2 == AR5416_EEPROM_MAGIC) { - size = sizeof(struct ar5416_eeprom_def); - need_swap = true; - eepdata = (u16 *) (&ah->eeprom); - - for (addr = 0; addr < size / sizeof(u16); addr++) { - temp = swab16(*eepdata); - *eepdata = temp; - eepdata++; - } - } else { - ath_err(common, - "Invalid EEPROM Magic. Endianness mismatch.\n"); - return -EINVAL; - } - } - } - - ath_dbg(common, EEPROM, "need_swap = %s\n", - need_swap ? "True" : "False"); - - if (need_swap) - el = swab16(ah->eeprom.def.baseEepHeader.length); - else - el = ah->eeprom.def.baseEepHeader.length; - - if (el > sizeof(struct ar5416_eeprom_def)) - el = sizeof(struct ar5416_eeprom_def) / sizeof(u16); - else - el = el / sizeof(u16); - - eepdata = (u16 *)(&ah->eeprom); - - for (i = 0; i < el; i++) - sum ^= *eepdata++; - - if (need_swap) { - u32 integer, j; - u16 word; - - ath_dbg(common, EEPROM, - "EEPROM Endianness is not native.. Changing.\n"); - - word = swab16(eep->baseEepHeader.length); - eep->baseEepHeader.length = word; - - word = swab16(eep->baseEepHeader.checksum); - eep->baseEepHeader.checksum = word; - - word = swab16(eep->baseEepHeader.version); - eep->baseEepHeader.version = word; - - word = swab16(eep->baseEepHeader.regDmn[0]); - eep->baseEepHeader.regDmn[0] = word; - - word = swab16(eep->baseEepHeader.regDmn[1]); - eep->baseEepHeader.regDmn[1] = word; - - word = swab16(eep->baseEepHeader.rfSilent); - eep->baseEepHeader.rfSilent = word; - - word = swab16(eep->baseEepHeader.blueToothOptions); - eep->baseEepHeader.blueToothOptions = word; - - word = swab16(eep->baseEepHeader.deviceCap); - eep->baseEepHeader.deviceCap = word; - - for (j = 0; j < ARRAY_SIZE(eep->modalHeader); j++) { - struct modal_eep_header *pModal = - &eep->modalHeader[j]; - integer = swab32(pModal->antCtrlCommon); - pModal->antCtrlCommon = integer; - - for (i = 0; i < AR5416_MAX_CHAINS; i++) { - integer = swab32(pModal->antCtrlChain[i]); - pModal->antCtrlChain[i] = integer; - } - for (i = 0; i < 3; i++) { - word = swab16(pModal->xpaBiasLvlFreq[i]); - pModal->xpaBiasLvlFreq[i] = word; - } - - for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { - word = swab16(pModal->spurChans[i].spurChan); - pModal->spurChans[i].spurChan = word; - } - } - } - - if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR5416_EEP_VER || - ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) { - ath_err(common, "Bad EEPROM checksum 0x%x or revision 0x%04x\n", - sum, ah->eep_ops->get_eeprom_ver(ah)); - return -EINVAL; - } - - /* Enable fixup for AR_AN_TOP2 if necessary */ - if ((ah->hw_version.devid == AR9280_DEVID_PCI) && - ((eep->baseEepHeader.version & 0xff) > 0x0a) && - (eep->baseEepHeader.pwdclkind == 0)) - ah->need_an_top2_fixup = true; - - if ((common->bus_ops->ath_bus_type == ATH_USB) && - (AR_SREV_9280(ah))) - eep->modalHeader[0].xpaBiasLvl = 0; - - return 0; -} - -static u32 ath9k_hw_def_get_eeprom(struct ath_hw *ah, - enum eeprom_param param) -{ - struct ar5416_eeprom_def *eep = &ah->eeprom.def; - struct modal_eep_header *pModal = eep->modalHeader; - struct base_eep_header *pBase = &eep->baseEepHeader; - int band = 0; - - switch (param) { - case EEP_NFTHRESH_5: - return pModal[0].noiseFloorThreshCh[0]; - case EEP_NFTHRESH_2: - return pModal[1].noiseFloorThreshCh[0]; - case EEP_MAC_LSW: - return get_unaligned_be16(pBase->macAddr); - case EEP_MAC_MID: - return get_unaligned_be16(pBase->macAddr + 2); - case EEP_MAC_MSW: - return get_unaligned_be16(pBase->macAddr + 4); - case EEP_REG_0: - return pBase->regDmn[0]; - case EEP_OP_CAP: - return pBase->deviceCap; - case EEP_OP_MODE: - return pBase->opCapFlags; - case EEP_RF_SILENT: - return pBase->rfSilent; - case EEP_OB_5: - return pModal[0].ob; - case EEP_DB_5: - return pModal[0].db; - case EEP_OB_2: - return pModal[1].ob; - case EEP_DB_2: - return pModal[1].db; - case EEP_MINOR_REV: - return AR5416_VER_MASK; - case EEP_TX_MASK: - return pBase->txMask; - case EEP_RX_MASK: - return pBase->rxMask; - case EEP_FSTCLK_5G: - return pBase->fastClk5g; - case EEP_RXGAIN_TYPE: - return pBase->rxGainType; - case EEP_TXGAIN_TYPE: - return pBase->txGainType; - case EEP_OL_PWRCTRL: - if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_19) - return pBase->openLoopPwrCntl ? true : false; - else - return false; - case EEP_RC_CHAIN_MASK: - if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_19) - return pBase->rcChainMask; - else - return 0; - case EEP_DAC_HPWR_5G: - if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_20) - return pBase->dacHiPwrMode_5G; - else - return 0; - case EEP_FRAC_N_5G: - if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_22) - return pBase->frac_n_5g; - else - return 0; - case EEP_PWR_TABLE_OFFSET: - if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_21) - return pBase->pwr_table_offset; - else - return AR5416_PWR_TABLE_OFFSET_DB; - case EEP_ANTENNA_GAIN_2G: - band = 1; - /* fall through */ - case EEP_ANTENNA_GAIN_5G: - return max_t(u8, max_t(u8, - pModal[band].antennaGainCh[0], - pModal[band].antennaGainCh[1]), - pModal[band].antennaGainCh[2]); - default: - return 0; - } -} - -static void ath9k_hw_def_set_gain(struct ath_hw *ah, - struct modal_eep_header *pModal, - struct ar5416_eeprom_def *eep, - u8 txRxAttenLocal, int regChainOffset, int i) -{ - if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) { - txRxAttenLocal = pModal->txRxAttenCh[i]; - - if (AR_SREV_9280_20_OR_LATER(ah)) { - REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset, - AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN, - pModal->bswMargin[i]); - REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset, - AR_PHY_GAIN_2GHZ_XATTEN1_DB, - pModal->bswAtten[i]); - REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset, - AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN, - pModal->xatten2Margin[i]); - REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset, - AR_PHY_GAIN_2GHZ_XATTEN2_DB, - pModal->xatten2Db[i]); - } else { - REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset, - (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) & - ~AR_PHY_GAIN_2GHZ_BSW_MARGIN) - | SM(pModal-> bswMargin[i], - AR_PHY_GAIN_2GHZ_BSW_MARGIN)); - REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset, - (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) & - ~AR_PHY_GAIN_2GHZ_BSW_ATTEN) - | SM(pModal->bswAtten[i], - AR_PHY_GAIN_2GHZ_BSW_ATTEN)); - } - } - - if (AR_SREV_9280_20_OR_LATER(ah)) { - REG_RMW_FIELD(ah, - AR_PHY_RXGAIN + regChainOffset, - AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal); - REG_RMW_FIELD(ah, - AR_PHY_RXGAIN + regChainOffset, - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[i]); - } else { - REG_WRITE(ah, - AR_PHY_RXGAIN + regChainOffset, - (REG_READ(ah, AR_PHY_RXGAIN + regChainOffset) & - ~AR_PHY_RXGAIN_TXRX_ATTEN) - | SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN)); - REG_WRITE(ah, - AR_PHY_GAIN_2GHZ + regChainOffset, - (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) & - ~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) | - SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN)); - } -} - -static void ath9k_hw_def_set_board_values(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - struct modal_eep_header *pModal; - struct ar5416_eeprom_def *eep = &ah->eeprom.def; - int i, regChainOffset; - u8 txRxAttenLocal; - - pModal = &(eep->modalHeader[IS_CHAN_2GHZ(chan)]); - txRxAttenLocal = IS_CHAN_2GHZ(chan) ? 23 : 44; - - REG_WRITE(ah, AR_PHY_SWITCH_COM, pModal->antCtrlCommon & 0xffff); - - for (i = 0; i < AR5416_MAX_CHAINS; i++) { - if (AR_SREV_9280(ah)) { - if (i >= 2) - break; - } - - if ((ah->rxchainmask == 5 || ah->txchainmask == 5) && (i != 0)) - regChainOffset = (i == 1) ? 0x2000 : 0x1000; - else - regChainOffset = i * 0x1000; - - REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset, - pModal->antCtrlChain[i]); - - REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset, - (REG_READ(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset) & - ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF | - AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) | - SM(pModal->iqCalICh[i], - AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) | - SM(pModal->iqCalQCh[i], - AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF)); - - ath9k_hw_def_set_gain(ah, pModal, eep, txRxAttenLocal, - regChainOffset, i); - } - - if (AR_SREV_9280_20_OR_LATER(ah)) { - if (IS_CHAN_2GHZ(chan)) { - ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH0, - AR_AN_RF2G1_CH0_OB, - AR_AN_RF2G1_CH0_OB_S, - pModal->ob); - ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH0, - AR_AN_RF2G1_CH0_DB, - AR_AN_RF2G1_CH0_DB_S, - pModal->db); - ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH1, - AR_AN_RF2G1_CH1_OB, - AR_AN_RF2G1_CH1_OB_S, - pModal->ob_ch1); - ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH1, - AR_AN_RF2G1_CH1_DB, - AR_AN_RF2G1_CH1_DB_S, - pModal->db_ch1); - } else { - ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH0, - AR_AN_RF5G1_CH0_OB5, - AR_AN_RF5G1_CH0_OB5_S, - pModal->ob); - ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH0, - AR_AN_RF5G1_CH0_DB5, - AR_AN_RF5G1_CH0_DB5_S, - pModal->db); - ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH1, - AR_AN_RF5G1_CH1_OB5, - AR_AN_RF5G1_CH1_OB5_S, - pModal->ob_ch1); - ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH1, - AR_AN_RF5G1_CH1_DB5, - AR_AN_RF5G1_CH1_DB5_S, - pModal->db_ch1); - } - ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2, - AR_AN_TOP2_XPABIAS_LVL, - AR_AN_TOP2_XPABIAS_LVL_S, - pModal->xpaBiasLvl); - ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2, - AR_AN_TOP2_LOCALBIAS, - AR_AN_TOP2_LOCALBIAS_S, - !!(pModal->lna_ctl & - LNA_CTL_LOCAL_BIAS)); - REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG, - !!(pModal->lna_ctl & LNA_CTL_FORCE_XPA)); - } - - REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, - pModal->switchSettling); - REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_ADC, - pModal->adcDesiredSize); - - if (!AR_SREV_9280_20_OR_LATER(ah)) - REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, - AR_PHY_DESIRED_SZ_PGA, - pModal->pgaDesiredSize); - - REG_WRITE(ah, AR_PHY_RF_CTL4, - SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAA_OFF) - | SM(pModal->txEndToXpaOff, - AR_PHY_RF_CTL4_TX_END_XPAB_OFF) - | SM(pModal->txFrameToXpaOn, - AR_PHY_RF_CTL4_FRAME_XPAA_ON) - | SM(pModal->txFrameToXpaOn, - AR_PHY_RF_CTL4_FRAME_XPAB_ON)); - - REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_A2_RX_ON, - pModal->txEndToRxOn); - - if (AR_SREV_9280_20_OR_LATER(ah)) { - REG_RMW_FIELD(ah, AR_PHY_CCA, AR9280_PHY_CCA_THRESH62, - pModal->thresh62); - REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0, - AR_PHY_EXT_CCA0_THRESH62, - pModal->thresh62); - } else { - REG_RMW_FIELD(ah, AR_PHY_CCA, AR_PHY_CCA_THRESH62, - pModal->thresh62); - REG_RMW_FIELD(ah, AR_PHY_EXT_CCA, - AR_PHY_EXT_CCA_THRESH62, - pModal->thresh62); - } - - if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_2) { - REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, - AR_PHY_TX_END_DATA_START, - pModal->txFrameToDataStart); - REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_END_PA_ON, - pModal->txFrameToPaOn); - } - - if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) { - if (IS_CHAN_HT40(chan)) - REG_RMW_FIELD(ah, AR_PHY_SETTLING, - AR_PHY_SETTLING_SWITCH, - pModal->swSettleHt40); - } - - if (AR_SREV_9280_20_OR_LATER(ah) && - AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_19) - REG_RMW_FIELD(ah, AR_PHY_CCK_TX_CTRL, - AR_PHY_CCK_TX_CTRL_TX_DAC_SCALE_CCK, - pModal->miscBits); - - - if (AR_SREV_9280_20(ah) && AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_20) { - if (IS_CHAN_2GHZ(chan)) - REG_RMW_FIELD(ah, AR_AN_TOP1, AR_AN_TOP1_DACIPMODE, - eep->baseEepHeader.dacLpMode); - else if (eep->baseEepHeader.dacHiPwrMode_5G) - REG_RMW_FIELD(ah, AR_AN_TOP1, AR_AN_TOP1_DACIPMODE, 0); - else - REG_RMW_FIELD(ah, AR_AN_TOP1, AR_AN_TOP1_DACIPMODE, - eep->baseEepHeader.dacLpMode); - - udelay(100); - - REG_RMW_FIELD(ah, AR_PHY_FRAME_CTL, AR_PHY_FRAME_CTL_TX_CLIP, - pModal->miscBits >> 2); - - REG_RMW_FIELD(ah, AR_PHY_TX_PWRCTRL9, - AR_PHY_TX_DESIRED_SCALE_CCK, - eep->baseEepHeader.desiredScaleCCK); - } -} - -static void ath9k_hw_def_set_addac(struct ath_hw *ah, - struct ath9k_channel *chan) -{ -#define XPA_LVL_FREQ(cnt) (pModal->xpaBiasLvlFreq[cnt]) - struct modal_eep_header *pModal; - struct ar5416_eeprom_def *eep = &ah->eeprom.def; - u8 biaslevel; - - if (ah->hw_version.macVersion != AR_SREV_VERSION_9160) - return; - - if (ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_MINOR_VER_7) - return; - - pModal = &(eep->modalHeader[IS_CHAN_2GHZ(chan)]); - - if (pModal->xpaBiasLvl != 0xff) { - biaslevel = pModal->xpaBiasLvl; - } else { - u16 resetFreqBin, freqBin, freqCount = 0; - struct chan_centers centers; - - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - - resetFreqBin = FREQ2FBIN(centers.synth_center, - IS_CHAN_2GHZ(chan)); - freqBin = XPA_LVL_FREQ(0) & 0xff; - biaslevel = (u8) (XPA_LVL_FREQ(0) >> 14); - - freqCount++; - - while (freqCount < 3) { - if (XPA_LVL_FREQ(freqCount) == 0x0) - break; - - freqBin = XPA_LVL_FREQ(freqCount) & 0xff; - if (resetFreqBin >= freqBin) - biaslevel = (u8)(XPA_LVL_FREQ(freqCount) >> 14); - else - break; - freqCount++; - } - } - - if (IS_CHAN_2GHZ(chan)) { - INI_RA(&ah->iniAddac, 7, 1) = (INI_RA(&ah->iniAddac, - 7, 1) & (~0x18)) | biaslevel << 3; - } else { - INI_RA(&ah->iniAddac, 6, 1) = (INI_RA(&ah->iniAddac, - 6, 1) & (~0xc0)) | biaslevel << 6; - } -#undef XPA_LVL_FREQ -} - -static int16_t ath9k_change_gain_boundary_setting(struct ath_hw *ah, - u16 *gb, - u16 numXpdGain, - u16 pdGainOverlap_t2, - int8_t pwr_table_offset, - int16_t *diff) - -{ - u16 k; - - /* Prior to writing the boundaries or the pdadc vs. power table - * into the chip registers the default starting point on the pdadc - * vs. power table needs to be checked and the curve boundaries - * adjusted accordingly - */ - if (AR_SREV_9280_20_OR_LATER(ah)) { - u16 gb_limit; - - if (AR5416_PWR_TABLE_OFFSET_DB != pwr_table_offset) { - /* get the difference in dB */ - *diff = (u16)(pwr_table_offset - AR5416_PWR_TABLE_OFFSET_DB); - /* get the number of half dB steps */ - *diff *= 2; - /* change the original gain boundary settings - * by the number of half dB steps - */ - for (k = 0; k < numXpdGain; k++) - gb[k] = (u16)(gb[k] - *diff); - } - /* Because of a hardware limitation, ensure the gain boundary - * is not larger than (63 - overlap) - */ - gb_limit = (u16)(MAX_RATE_POWER - pdGainOverlap_t2); - - for (k = 0; k < numXpdGain; k++) - gb[k] = (u16)min(gb_limit, gb[k]); - } - - return *diff; -} - -static void ath9k_adjust_pdadc_values(struct ath_hw *ah, - int8_t pwr_table_offset, - int16_t diff, - u8 *pdadcValues) -{ -#define NUM_PDADC(diff) (AR5416_NUM_PDADC_VALUES - diff) - u16 k; - - /* If this is a board that has a pwrTableOffset that differs from - * the default AR5416_PWR_TABLE_OFFSET_DB then the start of the - * pdadc vs pwr table needs to be adjusted prior to writing to the - * chip. - */ - if (AR_SREV_9280_20_OR_LATER(ah)) { - if (AR5416_PWR_TABLE_OFFSET_DB != pwr_table_offset) { - /* shift the table to start at the new offset */ - for (k = 0; k < (u16)NUM_PDADC(diff); k++ ) { - pdadcValues[k] = pdadcValues[k + diff]; - } - - /* fill the back of the table */ - for (k = (u16)NUM_PDADC(diff); k < NUM_PDADC(0); k++) { - pdadcValues[k] = pdadcValues[NUM_PDADC(diff)]; - } - } - } -#undef NUM_PDADC -} - -static void ath9k_hw_set_def_power_cal_table(struct ath_hw *ah, - struct ath9k_channel *chan) -{ -#define SM_PD_GAIN(x) SM(0x38, AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_##x) -#define SM_PDGAIN_B(x, y) \ - SM((gainBoundaries[x]), AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_##y) - struct ath_common *common = ath9k_hw_common(ah); - struct ar5416_eeprom_def *pEepData = &ah->eeprom.def; - struct cal_data_per_freq *pRawDataset; - u8 *pCalBChans = NULL; - u16 pdGainOverlap_t2; - static u8 pdadcValues[AR5416_NUM_PDADC_VALUES]; - u16 gainBoundaries[AR5416_PD_GAINS_IN_MASK]; - u16 numPiers, i, j; - int16_t diff = 0; - u16 numXpdGain, xpdMask; - u16 xpdGainValues[AR5416_NUM_PD_GAINS] = { 0, 0, 0, 0 }; - u32 reg32, regOffset, regChainOffset; - int16_t modalIdx; - int8_t pwr_table_offset; - - modalIdx = IS_CHAN_2GHZ(chan) ? 1 : 0; - xpdMask = pEepData->modalHeader[modalIdx].xpdGain; - - pwr_table_offset = ah->eep_ops->get_eeprom(ah, EEP_PWR_TABLE_OFFSET); - - if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >= - AR5416_EEP_MINOR_VER_2) { - pdGainOverlap_t2 = - pEepData->modalHeader[modalIdx].pdGainOverlap; - } else { - pdGainOverlap_t2 = (u16)(MS(REG_READ(ah, AR_PHY_TPCRG5), - AR_PHY_TPCRG5_PD_GAIN_OVERLAP)); - } - - if (IS_CHAN_2GHZ(chan)) { - pCalBChans = pEepData->calFreqPier2G; - numPiers = AR5416_NUM_2G_CAL_PIERS; - } else { - pCalBChans = pEepData->calFreqPier5G; - numPiers = AR5416_NUM_5G_CAL_PIERS; - } - - if (OLC_FOR_AR9280_20_LATER && IS_CHAN_2GHZ(chan)) { - pRawDataset = pEepData->calPierData2G[0]; - ah->initPDADC = ((struct calDataPerFreqOpLoop *) - pRawDataset)->vpdPdg[0][0]; - } - - numXpdGain = 0; - - for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) { - if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) { - if (numXpdGain >= AR5416_NUM_PD_GAINS) - break; - xpdGainValues[numXpdGain] = - (u16)(AR5416_PD_GAINS_IN_MASK - i); - numXpdGain++; - } - } - - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN, - (numXpdGain - 1) & 0x3); - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1, - xpdGainValues[0]); - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2, - xpdGainValues[1]); - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3, - xpdGainValues[2]); - - for (i = 0; i < AR5416_MAX_CHAINS; i++) { - if ((ah->rxchainmask == 5 || ah->txchainmask == 5) && - (i != 0)) { - regChainOffset = (i == 1) ? 0x2000 : 0x1000; - } else - regChainOffset = i * 0x1000; - - if (pEepData->baseEepHeader.txMask & (1 << i)) { - if (IS_CHAN_2GHZ(chan)) - pRawDataset = pEepData->calPierData2G[i]; - else - pRawDataset = pEepData->calPierData5G[i]; - - - if (OLC_FOR_AR9280_20_LATER) { - u8 pcdacIdx; - u8 txPower; - - ath9k_get_txgain_index(ah, chan, - (struct calDataPerFreqOpLoop *)pRawDataset, - pCalBChans, numPiers, &txPower, &pcdacIdx); - ath9k_olc_get_pdadcs(ah, pcdacIdx, - txPower/2, pdadcValues); - } else { - ath9k_hw_get_gain_boundaries_pdadcs(ah, - chan, pRawDataset, - pCalBChans, numPiers, - pdGainOverlap_t2, - gainBoundaries, - pdadcValues, - numXpdGain); - } - - diff = ath9k_change_gain_boundary_setting(ah, - gainBoundaries, - numXpdGain, - pdGainOverlap_t2, - pwr_table_offset, - &diff); - - ENABLE_REGWRITE_BUFFER(ah); - - if (OLC_FOR_AR9280_20_LATER) { - REG_WRITE(ah, - AR_PHY_TPCRG5 + regChainOffset, - SM(0x6, - AR_PHY_TPCRG5_PD_GAIN_OVERLAP) | - SM_PD_GAIN(1) | SM_PD_GAIN(2) | - SM_PD_GAIN(3) | SM_PD_GAIN(4)); - } else { - REG_WRITE(ah, - AR_PHY_TPCRG5 + regChainOffset, - SM(pdGainOverlap_t2, - AR_PHY_TPCRG5_PD_GAIN_OVERLAP)| - SM_PDGAIN_B(0, 1) | - SM_PDGAIN_B(1, 2) | - SM_PDGAIN_B(2, 3) | - SM_PDGAIN_B(3, 4)); - } - - ath9k_adjust_pdadc_values(ah, pwr_table_offset, - diff, pdadcValues); - - regOffset = AR_PHY_BASE + (672 << 2) + regChainOffset; - for (j = 0; j < 32; j++) { - reg32 = get_unaligned_le32(&pdadcValues[4 * j]); - REG_WRITE(ah, regOffset, reg32); - - ath_dbg(common, EEPROM, - "PDADC (%d,%4x): %4.4x %8.8x\n", - i, regChainOffset, regOffset, - reg32); - ath_dbg(common, EEPROM, - "PDADC: Chain %d | PDADC %3d Value %3d | PDADC %3d Value %3d | PDADC %3d Value %3d | PDADC %3d Value %3d |\n", - i, 4 * j, pdadcValues[4 * j], - 4 * j + 1, pdadcValues[4 * j + 1], - 4 * j + 2, pdadcValues[4 * j + 2], - 4 * j + 3, pdadcValues[4 * j + 3]); - - regOffset += 4; - } - REGWRITE_BUFFER_FLUSH(ah); - } - } - -#undef SM_PD_GAIN -#undef SM_PDGAIN_B -} - -static void ath9k_hw_set_def_power_per_rate_table(struct ath_hw *ah, - struct ath9k_channel *chan, - int16_t *ratesArray, - u16 cfgCtl, - u16 antenna_reduction, - u16 powerLimit) -{ - struct ar5416_eeprom_def *pEepData = &ah->eeprom.def; - u16 twiceMaxEdgePower; - int i; - struct cal_ctl_data *rep; - struct cal_target_power_leg targetPowerOfdm, targetPowerCck = { - 0, { 0, 0, 0, 0} - }; - struct cal_target_power_leg targetPowerOfdmExt = { - 0, { 0, 0, 0, 0} }, targetPowerCckExt = { - 0, { 0, 0, 0, 0 } - }; - struct cal_target_power_ht targetPowerHt20, targetPowerHt40 = { - 0, {0, 0, 0, 0} - }; - u16 scaledPower = 0, minCtlPower; - static const u16 ctlModesFor11a[] = { - CTL_11A, CTL_5GHT20, CTL_11A_EXT, CTL_5GHT40 - }; - static const u16 ctlModesFor11g[] = { - CTL_11B, CTL_11G, CTL_2GHT20, - CTL_11B_EXT, CTL_11G_EXT, CTL_2GHT40 - }; - u16 numCtlModes; - const u16 *pCtlMode; - u16 ctlMode, freq; - struct chan_centers centers; - int tx_chainmask; - u16 twiceMinEdgePower; - - tx_chainmask = ah->txchainmask; - - ath9k_hw_get_channel_centers(ah, chan, ¢ers); - - scaledPower = ath9k_hw_get_scaled_power(ah, powerLimit, - antenna_reduction); - - if (IS_CHAN_2GHZ(chan)) { - numCtlModes = ARRAY_SIZE(ctlModesFor11g) - - SUB_NUM_CTL_MODES_AT_2G_40; - pCtlMode = ctlModesFor11g; - - ath9k_hw_get_legacy_target_powers(ah, chan, - pEepData->calTargetPowerCck, - AR5416_NUM_2G_CCK_TARGET_POWERS, - &targetPowerCck, 4, false); - ath9k_hw_get_legacy_target_powers(ah, chan, - pEepData->calTargetPower2G, - AR5416_NUM_2G_20_TARGET_POWERS, - &targetPowerOfdm, 4, false); - ath9k_hw_get_target_powers(ah, chan, - pEepData->calTargetPower2GHT20, - AR5416_NUM_2G_20_TARGET_POWERS, - &targetPowerHt20, 8, false); - - if (IS_CHAN_HT40(chan)) { - numCtlModes = ARRAY_SIZE(ctlModesFor11g); - ath9k_hw_get_target_powers(ah, chan, - pEepData->calTargetPower2GHT40, - AR5416_NUM_2G_40_TARGET_POWERS, - &targetPowerHt40, 8, true); - ath9k_hw_get_legacy_target_powers(ah, chan, - pEepData->calTargetPowerCck, - AR5416_NUM_2G_CCK_TARGET_POWERS, - &targetPowerCckExt, 4, true); - ath9k_hw_get_legacy_target_powers(ah, chan, - pEepData->calTargetPower2G, - AR5416_NUM_2G_20_TARGET_POWERS, - &targetPowerOfdmExt, 4, true); - } - } else { - numCtlModes = ARRAY_SIZE(ctlModesFor11a) - - SUB_NUM_CTL_MODES_AT_5G_40; - pCtlMode = ctlModesFor11a; - - ath9k_hw_get_legacy_target_powers(ah, chan, - pEepData->calTargetPower5G, - AR5416_NUM_5G_20_TARGET_POWERS, - &targetPowerOfdm, 4, false); - ath9k_hw_get_target_powers(ah, chan, - pEepData->calTargetPower5GHT20, - AR5416_NUM_5G_20_TARGET_POWERS, - &targetPowerHt20, 8, false); - - if (IS_CHAN_HT40(chan)) { - numCtlModes = ARRAY_SIZE(ctlModesFor11a); - ath9k_hw_get_target_powers(ah, chan, - pEepData->calTargetPower5GHT40, - AR5416_NUM_5G_40_TARGET_POWERS, - &targetPowerHt40, 8, true); - ath9k_hw_get_legacy_target_powers(ah, chan, - pEepData->calTargetPower5G, - AR5416_NUM_5G_20_TARGET_POWERS, - &targetPowerOfdmExt, 4, true); - } - } - - for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) { - bool isHt40CtlMode = (pCtlMode[ctlMode] == CTL_5GHT40) || - (pCtlMode[ctlMode] == CTL_2GHT40); - if (isHt40CtlMode) - freq = centers.synth_center; - else if (pCtlMode[ctlMode] & EXT_ADDITIVE) - freq = centers.ext_center; - else - freq = centers.ctl_center; - - twiceMaxEdgePower = MAX_RATE_POWER; - - for (i = 0; (i < AR5416_NUM_CTLS) && pEepData->ctlIndex[i]; i++) { - if ((((cfgCtl & ~CTL_MODE_M) | - (pCtlMode[ctlMode] & CTL_MODE_M)) == - pEepData->ctlIndex[i]) || - (((cfgCtl & ~CTL_MODE_M) | - (pCtlMode[ctlMode] & CTL_MODE_M)) == - ((pEepData->ctlIndex[i] & CTL_MODE_M) | SD_NO_CTL))) { - rep = &(pEepData->ctlData[i]); - - twiceMinEdgePower = ath9k_hw_get_max_edge_power(freq, - rep->ctlEdges[ar5416_get_ntxchains(tx_chainmask) - 1], - IS_CHAN_2GHZ(chan), AR5416_NUM_BAND_EDGES); - - if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL) { - twiceMaxEdgePower = min(twiceMaxEdgePower, - twiceMinEdgePower); - } else { - twiceMaxEdgePower = twiceMinEdgePower; - break; - } - } - } - - minCtlPower = min(twiceMaxEdgePower, scaledPower); - - switch (pCtlMode[ctlMode]) { - case CTL_11B: - for (i = 0; i < ARRAY_SIZE(targetPowerCck.tPow2x); i++) { - targetPowerCck.tPow2x[i] = - min((u16)targetPowerCck.tPow2x[i], - minCtlPower); - } - break; - case CTL_11A: - case CTL_11G: - for (i = 0; i < ARRAY_SIZE(targetPowerOfdm.tPow2x); i++) { - targetPowerOfdm.tPow2x[i] = - min((u16)targetPowerOfdm.tPow2x[i], - minCtlPower); - } - break; - case CTL_5GHT20: - case CTL_2GHT20: - for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++) { - targetPowerHt20.tPow2x[i] = - min((u16)targetPowerHt20.tPow2x[i], - minCtlPower); - } - break; - case CTL_11B_EXT: - targetPowerCckExt.tPow2x[0] = min((u16) - targetPowerCckExt.tPow2x[0], - minCtlPower); - break; - case CTL_11A_EXT: - case CTL_11G_EXT: - targetPowerOfdmExt.tPow2x[0] = min((u16) - targetPowerOfdmExt.tPow2x[0], - minCtlPower); - break; - case CTL_5GHT40: - case CTL_2GHT40: - for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) { - targetPowerHt40.tPow2x[i] = - min((u16)targetPowerHt40.tPow2x[i], - minCtlPower); - } - break; - default: - break; - } - } - - ratesArray[rate6mb] = ratesArray[rate9mb] = ratesArray[rate12mb] = - ratesArray[rate18mb] = ratesArray[rate24mb] = - targetPowerOfdm.tPow2x[0]; - ratesArray[rate36mb] = targetPowerOfdm.tPow2x[1]; - ratesArray[rate48mb] = targetPowerOfdm.tPow2x[2]; - ratesArray[rate54mb] = targetPowerOfdm.tPow2x[3]; - ratesArray[rateXr] = targetPowerOfdm.tPow2x[0]; - - for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++) - ratesArray[rateHt20_0 + i] = targetPowerHt20.tPow2x[i]; - - if (IS_CHAN_2GHZ(chan)) { - ratesArray[rate1l] = targetPowerCck.tPow2x[0]; - ratesArray[rate2s] = ratesArray[rate2l] = - targetPowerCck.tPow2x[1]; - ratesArray[rate5_5s] = ratesArray[rate5_5l] = - targetPowerCck.tPow2x[2]; - ratesArray[rate11s] = ratesArray[rate11l] = - targetPowerCck.tPow2x[3]; - } - if (IS_CHAN_HT40(chan)) { - for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) { - ratesArray[rateHt40_0 + i] = - targetPowerHt40.tPow2x[i]; - } - ratesArray[rateDupOfdm] = targetPowerHt40.tPow2x[0]; - ratesArray[rateDupCck] = targetPowerHt40.tPow2x[0]; - ratesArray[rateExtOfdm] = targetPowerOfdmExt.tPow2x[0]; - if (IS_CHAN_2GHZ(chan)) { - ratesArray[rateExtCck] = - targetPowerCckExt.tPow2x[0]; - } - } -} - -static void ath9k_hw_def_set_txpower(struct ath_hw *ah, - struct ath9k_channel *chan, - u16 cfgCtl, - u8 twiceAntennaReduction, - u8 powerLimit, bool test) -{ -#define RT_AR_DELTA(x) (ratesArray[x] - cck_ofdm_delta) - struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); - struct ar5416_eeprom_def *pEepData = &ah->eeprom.def; - struct modal_eep_header *pModal = - &(pEepData->modalHeader[IS_CHAN_2GHZ(chan)]); - int16_t ratesArray[Ar5416RateSize]; - u8 ht40PowerIncForPdadc = 2; - int i, cck_ofdm_delta = 0; - - memset(ratesArray, 0, sizeof(ratesArray)); - - if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >= - AR5416_EEP_MINOR_VER_2) { - ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc; - } - - ath9k_hw_set_def_power_per_rate_table(ah, chan, - &ratesArray[0], cfgCtl, - twiceAntennaReduction, - powerLimit); - - ath9k_hw_set_def_power_cal_table(ah, chan); - - regulatory->max_power_level = 0; - for (i = 0; i < ARRAY_SIZE(ratesArray); i++) { - if (ratesArray[i] > MAX_RATE_POWER) - ratesArray[i] = MAX_RATE_POWER; - if (ratesArray[i] > regulatory->max_power_level) - regulatory->max_power_level = ratesArray[i]; - } - - ath9k_hw_update_regulatory_maxpower(ah); - - if (test) - return; - - if (AR_SREV_9280_20_OR_LATER(ah)) { - for (i = 0; i < Ar5416RateSize; i++) { - int8_t pwr_table_offset; - - pwr_table_offset = ah->eep_ops->get_eeprom(ah, - EEP_PWR_TABLE_OFFSET); - ratesArray[i] -= pwr_table_offset * 2; - } - } - - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_PHY_POWER_TX_RATE1, - ATH9K_POW_SM(ratesArray[rate18mb], 24) - | ATH9K_POW_SM(ratesArray[rate12mb], 16) - | ATH9K_POW_SM(ratesArray[rate9mb], 8) - | ATH9K_POW_SM(ratesArray[rate6mb], 0)); - REG_WRITE(ah, AR_PHY_POWER_TX_RATE2, - ATH9K_POW_SM(ratesArray[rate54mb], 24) - | ATH9K_POW_SM(ratesArray[rate48mb], 16) - | ATH9K_POW_SM(ratesArray[rate36mb], 8) - | ATH9K_POW_SM(ratesArray[rate24mb], 0)); - - if (IS_CHAN_2GHZ(chan)) { - if (OLC_FOR_AR9280_20_LATER) { - cck_ofdm_delta = 2; - REG_WRITE(ah, AR_PHY_POWER_TX_RATE3, - ATH9K_POW_SM(RT_AR_DELTA(rate2s), 24) - | ATH9K_POW_SM(RT_AR_DELTA(rate2l), 16) - | ATH9K_POW_SM(ratesArray[rateXr], 8) - | ATH9K_POW_SM(RT_AR_DELTA(rate1l), 0)); - REG_WRITE(ah, AR_PHY_POWER_TX_RATE4, - ATH9K_POW_SM(RT_AR_DELTA(rate11s), 24) - | ATH9K_POW_SM(RT_AR_DELTA(rate11l), 16) - | ATH9K_POW_SM(RT_AR_DELTA(rate5_5s), 8) - | ATH9K_POW_SM(RT_AR_DELTA(rate5_5l), 0)); - } else { - REG_WRITE(ah, AR_PHY_POWER_TX_RATE3, - ATH9K_POW_SM(ratesArray[rate2s], 24) - | ATH9K_POW_SM(ratesArray[rate2l], 16) - | ATH9K_POW_SM(ratesArray[rateXr], 8) - | ATH9K_POW_SM(ratesArray[rate1l], 0)); - REG_WRITE(ah, AR_PHY_POWER_TX_RATE4, - ATH9K_POW_SM(ratesArray[rate11s], 24) - | ATH9K_POW_SM(ratesArray[rate11l], 16) - | ATH9K_POW_SM(ratesArray[rate5_5s], 8) - | ATH9K_POW_SM(ratesArray[rate5_5l], 0)); - } - } - - REG_WRITE(ah, AR_PHY_POWER_TX_RATE5, - ATH9K_POW_SM(ratesArray[rateHt20_3], 24) - | ATH9K_POW_SM(ratesArray[rateHt20_2], 16) - | ATH9K_POW_SM(ratesArray[rateHt20_1], 8) - | ATH9K_POW_SM(ratesArray[rateHt20_0], 0)); - REG_WRITE(ah, AR_PHY_POWER_TX_RATE6, - ATH9K_POW_SM(ratesArray[rateHt20_7], 24) - | ATH9K_POW_SM(ratesArray[rateHt20_6], 16) - | ATH9K_POW_SM(ratesArray[rateHt20_5], 8) - | ATH9K_POW_SM(ratesArray[rateHt20_4], 0)); - - if (IS_CHAN_HT40(chan)) { - REG_WRITE(ah, AR_PHY_POWER_TX_RATE7, - ATH9K_POW_SM(ratesArray[rateHt40_3] + - ht40PowerIncForPdadc, 24) - | ATH9K_POW_SM(ratesArray[rateHt40_2] + - ht40PowerIncForPdadc, 16) - | ATH9K_POW_SM(ratesArray[rateHt40_1] + - ht40PowerIncForPdadc, 8) - | ATH9K_POW_SM(ratesArray[rateHt40_0] + - ht40PowerIncForPdadc, 0)); - REG_WRITE(ah, AR_PHY_POWER_TX_RATE8, - ATH9K_POW_SM(ratesArray[rateHt40_7] + - ht40PowerIncForPdadc, 24) - | ATH9K_POW_SM(ratesArray[rateHt40_6] + - ht40PowerIncForPdadc, 16) - | ATH9K_POW_SM(ratesArray[rateHt40_5] + - ht40PowerIncForPdadc, 8) - | ATH9K_POW_SM(ratesArray[rateHt40_4] + - ht40PowerIncForPdadc, 0)); - if (OLC_FOR_AR9280_20_LATER) { - REG_WRITE(ah, AR_PHY_POWER_TX_RATE9, - ATH9K_POW_SM(ratesArray[rateExtOfdm], 24) - | ATH9K_POW_SM(RT_AR_DELTA(rateExtCck), 16) - | ATH9K_POW_SM(ratesArray[rateDupOfdm], 8) - | ATH9K_POW_SM(RT_AR_DELTA(rateDupCck), 0)); - } else { - REG_WRITE(ah, AR_PHY_POWER_TX_RATE9, - ATH9K_POW_SM(ratesArray[rateExtOfdm], 24) - | ATH9K_POW_SM(ratesArray[rateExtCck], 16) - | ATH9K_POW_SM(ratesArray[rateDupOfdm], 8) - | ATH9K_POW_SM(ratesArray[rateDupCck], 0)); - } - } - - REG_WRITE(ah, AR_PHY_POWER_TX_SUB, - ATH9K_POW_SM(pModal->pwrDecreaseFor3Chain, 6) - | ATH9K_POW_SM(pModal->pwrDecreaseFor2Chain, 0)); - - REGWRITE_BUFFER_FLUSH(ah); -} - -static u16 ath9k_hw_def_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz) -{ -#define EEP_DEF_SPURCHAN \ - (ah->eeprom.def.modalHeader[is2GHz].spurChans[i].spurChan) - struct ath_common *common = ath9k_hw_common(ah); - - u16 spur_val = AR_NO_SPUR; - - ath_dbg(common, ANI, "Getting spur idx:%d is2Ghz:%d val:%x\n", - i, is2GHz, ah->config.spurchans[i][is2GHz]); - - switch (ah->config.spurmode) { - case SPUR_DISABLE: - break; - case SPUR_ENABLE_IOCTL: - spur_val = ah->config.spurchans[i][is2GHz]; - ath_dbg(common, ANI, "Getting spur val from new loc. %d\n", - spur_val); - break; - case SPUR_ENABLE_EEPROM: - spur_val = EEP_DEF_SPURCHAN; - break; - } - - return spur_val; - -#undef EEP_DEF_SPURCHAN -} - -const struct eeprom_ops eep_def_ops = { - .check_eeprom = ath9k_hw_def_check_eeprom, - .get_eeprom = ath9k_hw_def_get_eeprom, - .fill_eeprom = ath9k_hw_def_fill_eeprom, - .dump_eeprom = ath9k_hw_def_dump_eeprom, - .get_eeprom_ver = ath9k_hw_def_get_eeprom_ver, - .get_eeprom_rev = ath9k_hw_def_get_eeprom_rev, - .set_board_values = ath9k_hw_def_set_board_values, - .set_addac = ath9k_hw_def_set_addac, - .set_txpower = ath9k_hw_def_set_txpower, - .get_spur_channel = ath9k_hw_def_get_spur_channel -}; diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c deleted file mode 100644 index 4b412aaf4f36..000000000000 --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ /dev/null @@ -1,567 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "ath9k.h" - -/********************************/ -/* LED functions */ -/********************************/ - -#ifdef CONFIG_MAC80211_LEDS -static void ath_led_brightness(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev); - ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, (brightness == LED_OFF)); -} - -void ath_deinit_leds(struct ath_softc *sc) -{ - if (!sc->led_registered) - return; - - ath_led_brightness(&sc->led_cdev, LED_OFF); - led_classdev_unregister(&sc->led_cdev); -} - -void ath_init_leds(struct ath_softc *sc) -{ - int ret; - - if (AR_SREV_9100(sc->sc_ah)) - return; - - if (!led_blink) - sc->led_cdev.default_trigger = - ieee80211_get_radio_led_name(sc->hw); - - snprintf(sc->led_name, sizeof(sc->led_name), - "ath9k-%s", wiphy_name(sc->hw->wiphy)); - sc->led_cdev.name = sc->led_name; - sc->led_cdev.brightness_set = ath_led_brightness; - - ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &sc->led_cdev); - if (ret < 0) - return; - - sc->led_registered = true; -} - -void ath_fill_led_pin(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - - if (AR_SREV_9100(ah) || (ah->led_pin >= 0)) - return; - - if (AR_SREV_9287(ah)) - ah->led_pin = ATH_LED_PIN_9287; - else if (AR_SREV_9485(sc->sc_ah)) - ah->led_pin = ATH_LED_PIN_9485; - else if (AR_SREV_9300(sc->sc_ah)) - ah->led_pin = ATH_LED_PIN_9300; - else if (AR_SREV_9462(sc->sc_ah) || AR_SREV_9565(sc->sc_ah)) - ah->led_pin = ATH_LED_PIN_9462; - else - ah->led_pin = ATH_LED_PIN_DEF; - - /* Configure gpio 1 for output */ - ath9k_hw_cfg_output(ah, ah->led_pin, AR_GPIO_OUTPUT_MUX_AS_OUTPUT); - - /* LED off, active low */ - ath9k_hw_set_gpio(ah, ah->led_pin, 1); -} -#endif - -/*******************/ -/* Rfkill */ -/*******************/ - -static bool ath_is_rfkill_set(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - bool is_blocked; - - ath9k_ps_wakeup(sc); - is_blocked = ath9k_hw_gpio_get(ah, ah->rfkill_gpio) == - ah->rfkill_polarity; - ath9k_ps_restore(sc); - - return is_blocked; -} - -void ath9k_rfkill_poll_state(struct ieee80211_hw *hw) -{ - struct ath_softc *sc = hw->priv; - bool blocked = !!ath_is_rfkill_set(sc); - - wiphy_rfkill_set_hw_state(hw->wiphy, blocked); -} - -void ath_start_rfkill_poll(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - - if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT) - wiphy_rfkill_start_polling(sc->hw->wiphy); -} - -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT - -/******************/ -/* BTCOEX */ -/******************/ - -/* - * Detects if there is any priority bt traffic - */ -static void ath_detect_bt_priority(struct ath_softc *sc) -{ - struct ath_btcoex *btcoex = &sc->btcoex; - struct ath_hw *ah = sc->sc_ah; - - if (ath9k_hw_gpio_get(sc->sc_ah, ah->btcoex_hw.btpriority_gpio)) - btcoex->bt_priority_cnt++; - - if (time_after(jiffies, btcoex->bt_priority_time + - msecs_to_jiffies(ATH_BT_PRIORITY_TIME_THRESHOLD))) { - clear_bit(BT_OP_PRIORITY_DETECTED, &btcoex->op_flags); - clear_bit(BT_OP_SCAN, &btcoex->op_flags); - /* Detect if colocated bt started scanning */ - if (btcoex->bt_priority_cnt >= ATH_BT_CNT_SCAN_THRESHOLD) { - ath_dbg(ath9k_hw_common(sc->sc_ah), BTCOEX, - "BT scan detected\n"); - set_bit(BT_OP_PRIORITY_DETECTED, &btcoex->op_flags); - set_bit(BT_OP_SCAN, &btcoex->op_flags); - } else if (btcoex->bt_priority_cnt >= ATH_BT_CNT_THRESHOLD) { - ath_dbg(ath9k_hw_common(sc->sc_ah), BTCOEX, - "BT priority traffic detected\n"); - set_bit(BT_OP_PRIORITY_DETECTED, &btcoex->op_flags); - } - - btcoex->bt_priority_cnt = 0; - btcoex->bt_priority_time = jiffies; - } -} - -static void ath9k_gen_timer_start(struct ath_hw *ah, - struct ath_gen_timer *timer, - u32 trig_timeout, - u32 timer_period) -{ - ath9k_hw_gen_timer_start(ah, timer, trig_timeout, timer_period); - - if ((ah->imask & ATH9K_INT_GENTIMER) == 0) { - ath9k_hw_disable_interrupts(ah); - ah->imask |= ATH9K_INT_GENTIMER; - ath9k_hw_set_interrupts(ah); - ath9k_hw_enable_interrupts(ah); - } -} - -static void ath9k_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer) -{ - struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; - - ath9k_hw_gen_timer_stop(ah, timer); - - /* if no timer is enabled, turn off interrupt mask */ - if (timer_table->timer_mask.val == 0) { - ath9k_hw_disable_interrupts(ah); - ah->imask &= ~ATH9K_INT_GENTIMER; - ath9k_hw_set_interrupts(ah); - ath9k_hw_enable_interrupts(ah); - } -} - -static void ath_mci_ftp_adjust(struct ath_softc *sc) -{ - struct ath_btcoex *btcoex = &sc->btcoex; - struct ath_mci_profile *mci = &btcoex->mci; - struct ath_hw *ah = sc->sc_ah; - - if (btcoex->bt_wait_time > ATH_BTCOEX_RX_WAIT_TIME) { - if (ar9003_mci_state(ah, MCI_STATE_NEED_FTP_STOMP) && - (mci->num_pan || mci->num_other_acl)) - ah->btcoex_hw.mci.stomp_ftp = - (sc->rx.num_pkts < ATH_BTCOEX_STOMP_FTP_THRESH); - else - ah->btcoex_hw.mci.stomp_ftp = false; - btcoex->bt_wait_time = 0; - sc->rx.num_pkts = 0; - } -} - -/* - * This is the master bt coex timer which runs for every - * 45ms, bt traffic will be given priority during 55% of this - * period while wlan gets remaining 45% - */ -static void ath_btcoex_period_timer(unsigned long data) -{ - struct ath_softc *sc = (struct ath_softc *) data; - struct ath_hw *ah = sc->sc_ah; - struct ath_btcoex *btcoex = &sc->btcoex; - enum ath_stomp_type stomp_type; - u32 timer_period; - unsigned long flags; - - spin_lock_irqsave(&sc->sc_pm_lock, flags); - if (sc->sc_ah->power_mode == ATH9K_PM_NETWORK_SLEEP) { - btcoex->bt_wait_time += btcoex->btcoex_period; - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - goto skip_hw_wakeup; - } - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - - ath9k_mci_update_rssi(sc); - - ath9k_ps_wakeup(sc); - - if (!(ah->caps.hw_caps & ATH9K_HW_CAP_MCI)) - ath_detect_bt_priority(sc); - - if (ah->caps.hw_caps & ATH9K_HW_CAP_MCI) - ath_mci_ftp_adjust(sc); - - spin_lock_bh(&btcoex->btcoex_lock); - - stomp_type = btcoex->bt_stomp_type; - timer_period = btcoex->btcoex_no_stomp; - - if (!(ah->caps.hw_caps & ATH9K_HW_CAP_MCI)) { - if (test_bit(BT_OP_SCAN, &btcoex->op_flags)) { - stomp_type = ATH_BTCOEX_STOMP_ALL; - timer_period = btcoex->btscan_no_stomp; - } - } else if (btcoex->stomp_audio >= 5) { - stomp_type = ATH_BTCOEX_STOMP_AUDIO; - btcoex->stomp_audio = 0; - } - - ath9k_hw_btcoex_bt_stomp(ah, stomp_type); - ath9k_hw_btcoex_enable(ah); - - spin_unlock_bh(&btcoex->btcoex_lock); - - /* - * btcoex_period is in msec while (btocex/btscan_)no_stomp are in usec, - * ensure that we properly convert btcoex_period to usec - * for any comparision with (btcoex/btscan_)no_stomp. - */ - if (btcoex->btcoex_period * 1000 != btcoex->btcoex_no_stomp) { - if (btcoex->hw_timer_enabled) - ath9k_gen_timer_stop(ah, btcoex->no_stomp_timer); - - ath9k_gen_timer_start(ah, btcoex->no_stomp_timer, timer_period, - timer_period * 10); - btcoex->hw_timer_enabled = true; - } - - ath9k_ps_restore(sc); - -skip_hw_wakeup: - mod_timer(&btcoex->period_timer, - jiffies + msecs_to_jiffies(btcoex->btcoex_period)); -} - -/* - * Generic tsf based hw timer which configures weight - * registers to time slice between wlan and bt traffic - */ -static void ath_btcoex_no_stomp_timer(void *arg) -{ - struct ath_softc *sc = (struct ath_softc *)arg; - struct ath_hw *ah = sc->sc_ah; - struct ath_btcoex *btcoex = &sc->btcoex; - struct ath_common *common = ath9k_hw_common(ah); - - ath_dbg(common, BTCOEX, "no stomp timer running\n"); - - ath9k_ps_wakeup(sc); - spin_lock_bh(&btcoex->btcoex_lock); - - if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || - (!(ah->caps.hw_caps & ATH9K_HW_CAP_MCI) && - test_bit(BT_OP_SCAN, &btcoex->op_flags))) - ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); - else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) - ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_LOW); - - ath9k_hw_btcoex_enable(ah); - spin_unlock_bh(&btcoex->btcoex_lock); - ath9k_ps_restore(sc); -} - -static int ath_init_btcoex_timer(struct ath_softc *sc) -{ - struct ath_btcoex *btcoex = &sc->btcoex; - - btcoex->btcoex_period = ATH_BTCOEX_DEF_BT_PERIOD; - btcoex->btcoex_no_stomp = (100 - ATH_BTCOEX_DEF_DUTY_CYCLE) * 1000 * - btcoex->btcoex_period / 100; - btcoex->btscan_no_stomp = (100 - ATH_BTCOEX_BTSCAN_DUTY_CYCLE) * 1000 * - btcoex->btcoex_period / 100; - - setup_timer(&btcoex->period_timer, ath_btcoex_period_timer, - (unsigned long) sc); - - spin_lock_init(&btcoex->btcoex_lock); - - btcoex->no_stomp_timer = ath_gen_timer_alloc(sc->sc_ah, - ath_btcoex_no_stomp_timer, - ath_btcoex_no_stomp_timer, - (void *) sc, AR_FIRST_NDP_TIMER); - - if (!btcoex->no_stomp_timer) - return -ENOMEM; - - return 0; -} - -/* - * (Re)start btcoex timers - */ -void ath9k_btcoex_timer_resume(struct ath_softc *sc) -{ - struct ath_btcoex *btcoex = &sc->btcoex; - struct ath_hw *ah = sc->sc_ah; - - ath_dbg(ath9k_hw_common(ah), BTCOEX, "Starting btcoex timers\n"); - - /* make sure duty cycle timer is also stopped when resuming */ - if (btcoex->hw_timer_enabled) { - ath9k_gen_timer_stop(sc->sc_ah, btcoex->no_stomp_timer); - btcoex->hw_timer_enabled = false; - } - - btcoex->bt_priority_cnt = 0; - btcoex->bt_priority_time = jiffies; - clear_bit(BT_OP_PRIORITY_DETECTED, &btcoex->op_flags); - clear_bit(BT_OP_SCAN, &btcoex->op_flags); - - mod_timer(&btcoex->period_timer, jiffies); -} - - -/* - * Pause btcoex timer and bt duty cycle timer - */ -void ath9k_btcoex_timer_pause(struct ath_softc *sc) -{ - struct ath_btcoex *btcoex = &sc->btcoex; - struct ath_hw *ah = sc->sc_ah; - - del_timer_sync(&btcoex->period_timer); - - if (btcoex->hw_timer_enabled) { - ath9k_gen_timer_stop(ah, btcoex->no_stomp_timer); - btcoex->hw_timer_enabled = false; - } -} - -void ath9k_btcoex_stop_gen_timer(struct ath_softc *sc) -{ - struct ath_btcoex *btcoex = &sc->btcoex; - - if (btcoex->hw_timer_enabled) { - ath9k_gen_timer_stop(sc->sc_ah, btcoex->no_stomp_timer); - btcoex->hw_timer_enabled = false; - } -} - -u16 ath9k_btcoex_aggr_limit(struct ath_softc *sc, u32 max_4ms_framelen) -{ - struct ath_btcoex *btcoex = &sc->btcoex; - struct ath_mci_profile *mci = &sc->btcoex.mci; - u16 aggr_limit = 0; - - if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_MCI) && mci->aggr_limit) - aggr_limit = (max_4ms_framelen * mci->aggr_limit) >> 4; - else if (test_bit(BT_OP_PRIORITY_DETECTED, &btcoex->op_flags)) - aggr_limit = min((max_4ms_framelen * 3) / 8, - (u32)ATH_AMPDU_LIMIT_MAX); - - return aggr_limit; -} - -void ath9k_btcoex_handle_interrupt(struct ath_softc *sc, u32 status) -{ - struct ath_hw *ah = sc->sc_ah; - - if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE) - if (status & ATH9K_INT_GENTIMER) - ath_gen_timer_isr(sc->sc_ah); - - if (status & ATH9K_INT_MCI) - ath_mci_intr(sc); -} - -void ath9k_start_btcoex(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - - if ((ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) && - !ah->btcoex_hw.enabled) { - if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_MCI)) - ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, - AR_STOMP_LOW_WLAN_WGHT, 0); - else - ath9k_hw_btcoex_set_weight(ah, 0, 0, - ATH_BTCOEX_STOMP_NONE); - ath9k_hw_btcoex_enable(ah); - - if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE) - ath9k_btcoex_timer_resume(sc); - } -} - -void ath9k_stop_btcoex(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - - if (ah->btcoex_hw.enabled && - ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) { - if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE) - ath9k_btcoex_timer_pause(sc); - ath9k_hw_btcoex_disable(ah); - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) - ath_mci_flush_profile(&sc->btcoex.mci); - } -} - -void ath9k_deinit_btcoex(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - - if ((sc->btcoex.no_stomp_timer) && - ath9k_hw_get_btcoex_scheme(sc->sc_ah) == ATH_BTCOEX_CFG_3WIRE) - ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer); - - if (ath9k_hw_mci_is_enabled(ah)) - ath_mci_cleanup(sc); -} - -int ath9k_init_btcoex(struct ath_softc *sc) -{ - struct ath_txq *txq; - struct ath_hw *ah = sc->sc_ah; - int r; - - ath9k_hw_btcoex_init_scheme(ah); - - switch (ath9k_hw_get_btcoex_scheme(sc->sc_ah)) { - case ATH_BTCOEX_CFG_NONE: - break; - case ATH_BTCOEX_CFG_2WIRE: - ath9k_hw_btcoex_init_2wire(sc->sc_ah); - break; - case ATH_BTCOEX_CFG_3WIRE: - ath9k_hw_btcoex_init_3wire(sc->sc_ah); - r = ath_init_btcoex_timer(sc); - if (r) - return -1; - txq = sc->tx.txq_map[IEEE80211_AC_BE]; - ath9k_hw_init_btcoex_hw(sc->sc_ah, txq->axq_qnum); - sc->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW; - if (ath9k_hw_mci_is_enabled(ah)) { - sc->btcoex.duty_cycle = ATH_BTCOEX_DEF_DUTY_CYCLE; - INIT_LIST_HEAD(&sc->btcoex.mci.info); - - r = ath_mci_setup(sc); - if (r) - return r; - - ath9k_hw_btcoex_init_mci(ah); - } - - break; - default: - WARN_ON(1); - break; - } - - return 0; -} - -static int ath9k_dump_mci_btcoex(struct ath_softc *sc, u8 *buf, u32 size) -{ - struct ath_btcoex *btcoex = &sc->btcoex; - struct ath_mci_profile *mci = &btcoex->mci; - struct ath_hw *ah = sc->sc_ah; - struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; - u32 len = 0; - int i; - - ATH_DUMP_BTCOEX("Total BT profiles", NUM_PROF(mci)); - ATH_DUMP_BTCOEX("MGMT", mci->num_mgmt); - ATH_DUMP_BTCOEX("SCO", mci->num_sco); - ATH_DUMP_BTCOEX("A2DP", mci->num_a2dp); - ATH_DUMP_BTCOEX("HID", mci->num_hid); - ATH_DUMP_BTCOEX("PAN", mci->num_pan); - ATH_DUMP_BTCOEX("ACL", mci->num_other_acl); - ATH_DUMP_BTCOEX("BDR", mci->num_bdr); - ATH_DUMP_BTCOEX("Aggr. Limit", mci->aggr_limit); - ATH_DUMP_BTCOEX("Stomp Type", btcoex->bt_stomp_type); - ATH_DUMP_BTCOEX("BTCoex Period (msec)", btcoex->btcoex_period); - ATH_DUMP_BTCOEX("Duty Cycle", btcoex->duty_cycle); - ATH_DUMP_BTCOEX("BT Wait time", btcoex->bt_wait_time); - ATH_DUMP_BTCOEX("Concurrent Tx", btcoex_hw->mci.concur_tx); - ATH_DUMP_BTCOEX("Concurrent RSSI cnt", btcoex->rssi_count); - - len += snprintf(buf + len, size - len, "BT Weights: "); - for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) - len += snprintf(buf + len, size - len, "%08x ", - btcoex_hw->bt_weight[i]); - len += snprintf(buf + len, size - len, "\n"); - len += snprintf(buf + len, size - len, "WLAN Weights: "); - for (i = 0; i < AR9300_NUM_BT_WEIGHTS; i++) - len += snprintf(buf + len, size - len, "%08x ", - btcoex_hw->wlan_weight[i]); - len += snprintf(buf + len, size - len, "\n"); - len += snprintf(buf + len, size - len, "Tx Priorities: "); - for (i = 0; i < ATH_BTCOEX_STOMP_MAX; i++) - len += snprintf(buf + len, size - len, "%08x ", - btcoex_hw->tx_prio[i]); - - len += snprintf(buf + len, size - len, "\n"); - - return len; -} - -static int ath9k_dump_legacy_btcoex(struct ath_softc *sc, u8 *buf, u32 size) -{ - - struct ath_btcoex *btcoex = &sc->btcoex; - u32 len = 0; - - ATH_DUMP_BTCOEX("Stomp Type", btcoex->bt_stomp_type); - ATH_DUMP_BTCOEX("BTCoex Period (msec)", btcoex->btcoex_period); - ATH_DUMP_BTCOEX("Duty Cycle", btcoex->duty_cycle); - ATH_DUMP_BTCOEX("BT Wait time", btcoex->bt_wait_time); - - return len; -} - -int ath9k_dump_btcoex(struct ath_softc *sc, u8 *buf, u32 size) -{ - if (ath9k_hw_mci_is_enabled(sc->sc_ah)) - return ath9k_dump_mci_btcoex(sc, buf, size); - else - return ath9k_dump_legacy_btcoex(sc, buf, size); -} - -#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c deleted file mode 100644 index 75a6376ed289..000000000000 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ /dev/null @@ -1,1387 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "htc.h" - -/* identify firmware images */ -#define FIRMWARE_AR7010_1_1 "htc_7010.fw" -#define FIRMWARE_AR9271 "htc_9271.fw" - -MODULE_FIRMWARE(FIRMWARE_AR7010_1_1); -MODULE_FIRMWARE(FIRMWARE_AR9271); - -static struct usb_device_id ath9k_hif_usb_ids[] = { - { USB_DEVICE(0x0cf3, 0x9271) }, /* Atheros */ - { USB_DEVICE(0x0cf3, 0x1006) }, /* Atheros */ - { USB_DEVICE(0x0846, 0x9030) }, /* Netgear N150 */ - { USB_DEVICE(0x07D1, 0x3A10) }, /* Dlink Wireless 150 */ - { USB_DEVICE(0x13D3, 0x3327) }, /* Azurewave */ - { USB_DEVICE(0x13D3, 0x3328) }, /* Azurewave */ - { USB_DEVICE(0x13D3, 0x3346) }, /* IMC Networks */ - { USB_DEVICE(0x13D3, 0x3348) }, /* Azurewave */ - { USB_DEVICE(0x13D3, 0x3349) }, /* Azurewave */ - { USB_DEVICE(0x13D3, 0x3350) }, /* Azurewave */ - { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ - { USB_DEVICE(0x040D, 0x3801) }, /* VIA */ - { USB_DEVICE(0x0cf3, 0xb003) }, /* Ubiquiti WifiStation Ext */ - { USB_DEVICE(0x0cf3, 0xb002) }, /* Ubiquiti WifiStation */ - { USB_DEVICE(0x057c, 0x8403) }, /* AVM FRITZ!WLAN 11N v2 USB */ - - { USB_DEVICE(0x0cf3, 0x7015), - .driver_info = AR9287_USB }, /* Atheros */ - { USB_DEVICE(0x1668, 0x1200), - .driver_info = AR9287_USB }, /* Verizon */ - - { USB_DEVICE(0x0cf3, 0x7010), - .driver_info = AR9280_USB }, /* Atheros */ - { USB_DEVICE(0x0846, 0x9018), - .driver_info = AR9280_USB }, /* Netgear WNDA3200 */ - { USB_DEVICE(0x083A, 0xA704), - .driver_info = AR9280_USB }, /* SMC Networks */ - { USB_DEVICE(0x0411, 0x017f), - .driver_info = AR9280_USB }, /* Sony UWA-BR100 */ - { USB_DEVICE(0x04da, 0x3904), - .driver_info = AR9280_USB }, - - { USB_DEVICE(0x0cf3, 0x20ff), - .driver_info = STORAGE_DEVICE }, - - { }, -}; - -MODULE_DEVICE_TABLE(usb, ath9k_hif_usb_ids); - -static int __hif_usb_tx(struct hif_device_usb *hif_dev); - -static void hif_usb_regout_cb(struct urb *urb) -{ - struct cmd_buf *cmd = (struct cmd_buf *)urb->context; - - switch (urb->status) { - case 0: - break; - case -ENOENT: - case -ECONNRESET: - case -ENODEV: - case -ESHUTDOWN: - goto free; - default: - break; - } - - if (cmd) { - ath9k_htc_txcompletion_cb(cmd->hif_dev->htc_handle, - cmd->skb, true); - kfree(cmd); - } - - return; -free: - kfree_skb(cmd->skb); - kfree(cmd); -} - -static int hif_usb_send_regout(struct hif_device_usb *hif_dev, - struct sk_buff *skb) -{ - struct urb *urb; - struct cmd_buf *cmd; - int ret = 0; - - urb = usb_alloc_urb(0, GFP_KERNEL); - if (urb == NULL) - return -ENOMEM; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) { - usb_free_urb(urb); - return -ENOMEM; - } - - cmd->skb = skb; - cmd->hif_dev = hif_dev; - - usb_fill_bulk_urb(urb, hif_dev->udev, - usb_sndbulkpipe(hif_dev->udev, USB_REG_OUT_PIPE), - skb->data, skb->len, - hif_usb_regout_cb, cmd); - - usb_anchor_urb(urb, &hif_dev->regout_submitted); - ret = usb_submit_urb(urb, GFP_KERNEL); - if (ret) { - usb_unanchor_urb(urb); - kfree(cmd); - } - usb_free_urb(urb); - - return ret; -} - -static void hif_usb_mgmt_cb(struct urb *urb) -{ - struct cmd_buf *cmd = (struct cmd_buf *)urb->context; - struct hif_device_usb *hif_dev; - bool txok = true; - - if (!cmd || !cmd->skb || !cmd->hif_dev) - return; - - hif_dev = cmd->hif_dev; - - switch (urb->status) { - case 0: - break; - case -ENOENT: - case -ECONNRESET: - case -ENODEV: - case -ESHUTDOWN: - txok = false; - - /* - * If the URBs are being flushed, no need to complete - * this packet. - */ - spin_lock(&hif_dev->tx.tx_lock); - if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) { - spin_unlock(&hif_dev->tx.tx_lock); - dev_kfree_skb_any(cmd->skb); - kfree(cmd); - return; - } - spin_unlock(&hif_dev->tx.tx_lock); - - break; - default: - txok = false; - break; - } - - skb_pull(cmd->skb, 4); - ath9k_htc_txcompletion_cb(cmd->hif_dev->htc_handle, - cmd->skb, txok); - kfree(cmd); -} - -static int hif_usb_send_mgmt(struct hif_device_usb *hif_dev, - struct sk_buff *skb) -{ - struct urb *urb; - struct cmd_buf *cmd; - int ret = 0; - __le16 *hdr; - - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (urb == NULL) - return -ENOMEM; - - cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC); - if (cmd == NULL) { - usb_free_urb(urb); - return -ENOMEM; - } - - cmd->skb = skb; - cmd->hif_dev = hif_dev; - - hdr = (__le16 *) skb_push(skb, 4); - *hdr++ = cpu_to_le16(skb->len - 4); - *hdr++ = cpu_to_le16(ATH_USB_TX_STREAM_MODE_TAG); - - usb_fill_bulk_urb(urb, hif_dev->udev, - usb_sndbulkpipe(hif_dev->udev, USB_WLAN_TX_PIPE), - skb->data, skb->len, - hif_usb_mgmt_cb, cmd); - - usb_anchor_urb(urb, &hif_dev->mgmt_submitted); - ret = usb_submit_urb(urb, GFP_ATOMIC); - if (ret) { - usb_unanchor_urb(urb); - kfree(cmd); - } - usb_free_urb(urb); - - return ret; -} - -static inline void ath9k_skb_queue_purge(struct hif_device_usb *hif_dev, - struct sk_buff_head *list) -{ - struct sk_buff *skb; - - while ((skb = __skb_dequeue(list)) != NULL) { - dev_kfree_skb_any(skb); - } -} - -static inline void ath9k_skb_queue_complete(struct hif_device_usb *hif_dev, - struct sk_buff_head *queue, - bool txok) -{ - struct sk_buff *skb; - - while ((skb = __skb_dequeue(queue)) != NULL) { - ath9k_htc_txcompletion_cb(hif_dev->htc_handle, - skb, txok); - if (txok) - TX_STAT_INC(skb_success); - else - TX_STAT_INC(skb_failed); - } -} - -static void hif_usb_tx_cb(struct urb *urb) -{ - struct tx_buf *tx_buf = (struct tx_buf *) urb->context; - struct hif_device_usb *hif_dev; - bool txok = true; - - if (!tx_buf || !tx_buf->hif_dev) - return; - - hif_dev = tx_buf->hif_dev; - - switch (urb->status) { - case 0: - break; - case -ENOENT: - case -ECONNRESET: - case -ENODEV: - case -ESHUTDOWN: - txok = false; - - /* - * If the URBs are being flushed, no need to add this - * URB to the free list. - */ - spin_lock(&hif_dev->tx.tx_lock); - if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) { - spin_unlock(&hif_dev->tx.tx_lock); - ath9k_skb_queue_purge(hif_dev, &tx_buf->skb_queue); - return; - } - spin_unlock(&hif_dev->tx.tx_lock); - - break; - default: - txok = false; - break; - } - - ath9k_skb_queue_complete(hif_dev, &tx_buf->skb_queue, txok); - - /* Re-initialize the SKB queue */ - tx_buf->len = tx_buf->offset = 0; - __skb_queue_head_init(&tx_buf->skb_queue); - - /* Add this TX buffer to the free list */ - spin_lock(&hif_dev->tx.tx_lock); - list_move_tail(&tx_buf->list, &hif_dev->tx.tx_buf); - hif_dev->tx.tx_buf_cnt++; - if (!(hif_dev->tx.flags & HIF_USB_TX_STOP)) - __hif_usb_tx(hif_dev); /* Check for pending SKBs */ - TX_STAT_INC(buf_completed); - spin_unlock(&hif_dev->tx.tx_lock); -} - -/* TX lock has to be taken */ -static int __hif_usb_tx(struct hif_device_usb *hif_dev) -{ - struct tx_buf *tx_buf = NULL; - struct sk_buff *nskb = NULL; - int ret = 0, i; - u16 tx_skb_cnt = 0; - u8 *buf; - __le16 *hdr; - - if (hif_dev->tx.tx_skb_cnt == 0) - return 0; - - /* Check if a free TX buffer is available */ - if (list_empty(&hif_dev->tx.tx_buf)) - return 0; - - tx_buf = list_first_entry(&hif_dev->tx.tx_buf, struct tx_buf, list); - list_move_tail(&tx_buf->list, &hif_dev->tx.tx_pending); - hif_dev->tx.tx_buf_cnt--; - - tx_skb_cnt = min_t(u16, hif_dev->tx.tx_skb_cnt, MAX_TX_AGGR_NUM); - - for (i = 0; i < tx_skb_cnt; i++) { - nskb = __skb_dequeue(&hif_dev->tx.tx_skb_queue); - - /* Should never be NULL */ - BUG_ON(!nskb); - - hif_dev->tx.tx_skb_cnt--; - - buf = tx_buf->buf; - buf += tx_buf->offset; - hdr = (__le16 *)buf; - *hdr++ = cpu_to_le16(nskb->len); - *hdr++ = cpu_to_le16(ATH_USB_TX_STREAM_MODE_TAG); - buf += 4; - memcpy(buf, nskb->data, nskb->len); - tx_buf->len = nskb->len + 4; - - if (i < (tx_skb_cnt - 1)) - tx_buf->offset += (((tx_buf->len - 1) / 4) + 1) * 4; - - if (i == (tx_skb_cnt - 1)) - tx_buf->len += tx_buf->offset; - - __skb_queue_tail(&tx_buf->skb_queue, nskb); - TX_STAT_INC(skb_queued); - } - - usb_fill_bulk_urb(tx_buf->urb, hif_dev->udev, - usb_sndbulkpipe(hif_dev->udev, USB_WLAN_TX_PIPE), - tx_buf->buf, tx_buf->len, - hif_usb_tx_cb, tx_buf); - - ret = usb_submit_urb(tx_buf->urb, GFP_ATOMIC); - if (ret) { - tx_buf->len = tx_buf->offset = 0; - ath9k_skb_queue_complete(hif_dev, &tx_buf->skb_queue, false); - __skb_queue_head_init(&tx_buf->skb_queue); - list_move_tail(&tx_buf->list, &hif_dev->tx.tx_buf); - hif_dev->tx.tx_buf_cnt++; - } - - if (!ret) - TX_STAT_INC(buf_queued); - - return ret; -} - -static int hif_usb_send_tx(struct hif_device_usb *hif_dev, struct sk_buff *skb) -{ - struct ath9k_htc_tx_ctl *tx_ctl; - unsigned long flags; - int ret = 0; - - spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); - - if (hif_dev->tx.flags & HIF_USB_TX_STOP) { - spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); - return -ENODEV; - } - - /* Check if the max queue count has been reached */ - if (hif_dev->tx.tx_skb_cnt > MAX_TX_BUF_NUM) { - spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); - return -ENOMEM; - } - - spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); - - tx_ctl = HTC_SKB_CB(skb); - - /* Mgmt/Beacon frames don't use the TX buffer pool */ - if ((tx_ctl->type == ATH9K_HTC_MGMT) || - (tx_ctl->type == ATH9K_HTC_BEACON)) { - ret = hif_usb_send_mgmt(hif_dev, skb); - } - - spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); - - if ((tx_ctl->type == ATH9K_HTC_NORMAL) || - (tx_ctl->type == ATH9K_HTC_AMPDU)) { - __skb_queue_tail(&hif_dev->tx.tx_skb_queue, skb); - hif_dev->tx.tx_skb_cnt++; - } - - /* Check if AMPDUs have to be sent immediately */ - if ((hif_dev->tx.tx_buf_cnt == MAX_TX_URB_NUM) && - (hif_dev->tx.tx_skb_cnt < 2)) { - __hif_usb_tx(hif_dev); - } - - spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); - - return ret; -} - -static void hif_usb_start(void *hif_handle) -{ - struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle; - unsigned long flags; - - hif_dev->flags |= HIF_USB_START; - - spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); - hif_dev->tx.flags &= ~HIF_USB_TX_STOP; - spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); -} - -static void hif_usb_stop(void *hif_handle) -{ - struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle; - struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL; - unsigned long flags; - - spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); - ath9k_skb_queue_complete(hif_dev, &hif_dev->tx.tx_skb_queue, false); - hif_dev->tx.tx_skb_cnt = 0; - hif_dev->tx.flags |= HIF_USB_TX_STOP; - spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); - - /* The pending URBs have to be canceled. */ - list_for_each_entry_safe(tx_buf, tx_buf_tmp, - &hif_dev->tx.tx_pending, list) { - usb_kill_urb(tx_buf->urb); - } - - usb_kill_anchored_urbs(&hif_dev->mgmt_submitted); -} - -static int hif_usb_send(void *hif_handle, u8 pipe_id, struct sk_buff *skb) -{ - struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle; - int ret = 0; - - switch (pipe_id) { - case USB_WLAN_TX_PIPE: - ret = hif_usb_send_tx(hif_dev, skb); - break; - case USB_REG_OUT_PIPE: - ret = hif_usb_send_regout(hif_dev, skb); - break; - default: - dev_err(&hif_dev->udev->dev, - "ath9k_htc: Invalid TX pipe: %d\n", pipe_id); - ret = -EINVAL; - break; - } - - return ret; -} - -static inline bool check_index(struct sk_buff *skb, u8 idx) -{ - struct ath9k_htc_tx_ctl *tx_ctl; - - tx_ctl = HTC_SKB_CB(skb); - - if ((tx_ctl->type == ATH9K_HTC_AMPDU) && - (tx_ctl->sta_idx == idx)) - return true; - - return false; -} - -static void hif_usb_sta_drain(void *hif_handle, u8 idx) -{ - struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle; - struct sk_buff *skb, *tmp; - unsigned long flags; - - spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); - - skb_queue_walk_safe(&hif_dev->tx.tx_skb_queue, skb, tmp) { - if (check_index(skb, idx)) { - __skb_unlink(skb, &hif_dev->tx.tx_skb_queue); - ath9k_htc_txcompletion_cb(hif_dev->htc_handle, - skb, false); - hif_dev->tx.tx_skb_cnt--; - TX_STAT_INC(skb_failed); - } - } - - spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); -} - -static struct ath9k_htc_hif hif_usb = { - .transport = ATH9K_HIF_USB, - .name = "ath9k_hif_usb", - - .control_ul_pipe = USB_REG_OUT_PIPE, - .control_dl_pipe = USB_REG_IN_PIPE, - - .start = hif_usb_start, - .stop = hif_usb_stop, - .sta_drain = hif_usb_sta_drain, - .send = hif_usb_send, -}; - -static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev, - struct sk_buff *skb) -{ - struct sk_buff *nskb, *skb_pool[MAX_PKT_NUM_IN_TRANSFER]; - int index = 0, i = 0, len = skb->len; - int rx_remain_len, rx_pkt_len; - u16 pool_index = 0; - u8 *ptr; - - spin_lock(&hif_dev->rx_lock); - - rx_remain_len = hif_dev->rx_remain_len; - rx_pkt_len = hif_dev->rx_transfer_len; - - if (rx_remain_len != 0) { - struct sk_buff *remain_skb = hif_dev->remain_skb; - - if (remain_skb) { - ptr = (u8 *) remain_skb->data; - - index = rx_remain_len; - rx_remain_len -= hif_dev->rx_pad_len; - ptr += rx_pkt_len; - - memcpy(ptr, skb->data, rx_remain_len); - - rx_pkt_len += rx_remain_len; - hif_dev->rx_remain_len = 0; - skb_put(remain_skb, rx_pkt_len); - - skb_pool[pool_index++] = remain_skb; - - } else { - index = rx_remain_len; - } - } - - spin_unlock(&hif_dev->rx_lock); - - while (index < len) { - u16 pkt_len; - u16 pkt_tag; - u16 pad_len; - int chk_idx; - - ptr = (u8 *) skb->data; - - pkt_len = get_unaligned_le16(ptr + index); - pkt_tag = get_unaligned_le16(ptr + index + 2); - - if (pkt_tag != ATH_USB_RX_STREAM_MODE_TAG) { - RX_STAT_INC(skb_dropped); - return; - } - - pad_len = 4 - (pkt_len & 0x3); - if (pad_len == 4) - pad_len = 0; - - chk_idx = index; - index = index + 4 + pkt_len + pad_len; - - if (index > MAX_RX_BUF_SIZE) { - spin_lock(&hif_dev->rx_lock); - hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE; - hif_dev->rx_transfer_len = - MAX_RX_BUF_SIZE - chk_idx - 4; - hif_dev->rx_pad_len = pad_len; - - nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); - if (!nskb) { - dev_err(&hif_dev->udev->dev, - "ath9k_htc: RX memory allocation error\n"); - spin_unlock(&hif_dev->rx_lock); - goto err; - } - skb_reserve(nskb, 32); - RX_STAT_INC(skb_allocated); - - memcpy(nskb->data, &(skb->data[chk_idx+4]), - hif_dev->rx_transfer_len); - - /* Record the buffer pointer */ - hif_dev->remain_skb = nskb; - spin_unlock(&hif_dev->rx_lock); - } else { - nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC); - if (!nskb) { - dev_err(&hif_dev->udev->dev, - "ath9k_htc: RX memory allocation error\n"); - goto err; - } - skb_reserve(nskb, 32); - RX_STAT_INC(skb_allocated); - - memcpy(nskb->data, &(skb->data[chk_idx+4]), pkt_len); - skb_put(nskb, pkt_len); - skb_pool[pool_index++] = nskb; - } - } - -err: - for (i = 0; i < pool_index; i++) { - ath9k_htc_rx_msg(hif_dev->htc_handle, skb_pool[i], - skb_pool[i]->len, USB_WLAN_RX_PIPE); - RX_STAT_INC(skb_completed); - } -} - -static void ath9k_hif_usb_rx_cb(struct urb *urb) -{ - struct sk_buff *skb = (struct sk_buff *) urb->context; - struct hif_device_usb *hif_dev = - usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); - int ret; - - if (!skb) - return; - - if (!hif_dev) - goto free; - - switch (urb->status) { - case 0: - break; - case -ENOENT: - case -ECONNRESET: - case -ENODEV: - case -ESHUTDOWN: - goto free; - default: - goto resubmit; - } - - if (likely(urb->actual_length != 0)) { - skb_put(skb, urb->actual_length); - ath9k_hif_usb_rx_stream(hif_dev, skb); - } - -resubmit: - skb_reset_tail_pointer(skb); - skb_trim(skb, 0); - - usb_anchor_urb(urb, &hif_dev->rx_submitted); - ret = usb_submit_urb(urb, GFP_ATOMIC); - if (ret) { - usb_unanchor_urb(urb); - goto free; - } - - return; -free: - kfree_skb(skb); -} - -static void ath9k_hif_usb_reg_in_cb(struct urb *urb) -{ - struct sk_buff *skb = (struct sk_buff *) urb->context; - struct sk_buff *nskb; - struct hif_device_usb *hif_dev = - usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); - int ret; - - if (!skb) - return; - - if (!hif_dev) - goto free; - - switch (urb->status) { - case 0: - break; - case -ENOENT: - case -ECONNRESET: - case -ENODEV: - case -ESHUTDOWN: - goto free; - default: - skb_reset_tail_pointer(skb); - skb_trim(skb, 0); - - goto resubmit; - } - - if (likely(urb->actual_length != 0)) { - skb_put(skb, urb->actual_length); - - /* Process the command first */ - ath9k_htc_rx_msg(hif_dev->htc_handle, skb, - skb->len, USB_REG_IN_PIPE); - - - nskb = alloc_skb(MAX_REG_IN_BUF_SIZE, GFP_ATOMIC); - if (!nskb) { - dev_err(&hif_dev->udev->dev, - "ath9k_htc: REG_IN memory allocation failure\n"); - urb->context = NULL; - return; - } - - usb_fill_bulk_urb(urb, hif_dev->udev, - usb_rcvbulkpipe(hif_dev->udev, - USB_REG_IN_PIPE), - nskb->data, MAX_REG_IN_BUF_SIZE, - ath9k_hif_usb_reg_in_cb, nskb); - } - -resubmit: - usb_anchor_urb(urb, &hif_dev->reg_in_submitted); - ret = usb_submit_urb(urb, GFP_ATOMIC); - if (ret) { - usb_unanchor_urb(urb); - goto free; - } - - return; -free: - kfree_skb(skb); - urb->context = NULL; -} - -static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev) -{ - struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL; - unsigned long flags; - - list_for_each_entry_safe(tx_buf, tx_buf_tmp, - &hif_dev->tx.tx_buf, list) { - usb_kill_urb(tx_buf->urb); - list_del(&tx_buf->list); - usb_free_urb(tx_buf->urb); - kfree(tx_buf->buf); - kfree(tx_buf); - } - - spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); - hif_dev->tx.flags |= HIF_USB_TX_FLUSH; - spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); - - list_for_each_entry_safe(tx_buf, tx_buf_tmp, - &hif_dev->tx.tx_pending, list) { - usb_kill_urb(tx_buf->urb); - list_del(&tx_buf->list); - usb_free_urb(tx_buf->urb); - kfree(tx_buf->buf); - kfree(tx_buf); - } - - usb_kill_anchored_urbs(&hif_dev->mgmt_submitted); -} - -static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev) -{ - struct tx_buf *tx_buf; - int i; - - INIT_LIST_HEAD(&hif_dev->tx.tx_buf); - INIT_LIST_HEAD(&hif_dev->tx.tx_pending); - spin_lock_init(&hif_dev->tx.tx_lock); - __skb_queue_head_init(&hif_dev->tx.tx_skb_queue); - init_usb_anchor(&hif_dev->mgmt_submitted); - - for (i = 0; i < MAX_TX_URB_NUM; i++) { - tx_buf = kzalloc(sizeof(struct tx_buf), GFP_KERNEL); - if (!tx_buf) - goto err; - - tx_buf->buf = kzalloc(MAX_TX_BUF_SIZE, GFP_KERNEL); - if (!tx_buf->buf) - goto err; - - tx_buf->urb = usb_alloc_urb(0, GFP_KERNEL); - if (!tx_buf->urb) - goto err; - - tx_buf->hif_dev = hif_dev; - __skb_queue_head_init(&tx_buf->skb_queue); - - list_add_tail(&tx_buf->list, &hif_dev->tx.tx_buf); - } - - hif_dev->tx.tx_buf_cnt = MAX_TX_URB_NUM; - - return 0; -err: - if (tx_buf) { - kfree(tx_buf->buf); - kfree(tx_buf); - } - ath9k_hif_usb_dealloc_tx_urbs(hif_dev); - return -ENOMEM; -} - -static void ath9k_hif_usb_dealloc_rx_urbs(struct hif_device_usb *hif_dev) -{ - usb_kill_anchored_urbs(&hif_dev->rx_submitted); -} - -static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) -{ - struct urb *urb = NULL; - struct sk_buff *skb = NULL; - int i, ret; - - init_usb_anchor(&hif_dev->rx_submitted); - spin_lock_init(&hif_dev->rx_lock); - - for (i = 0; i < MAX_RX_URB_NUM; i++) { - - /* Allocate URB */ - urb = usb_alloc_urb(0, GFP_KERNEL); - if (urb == NULL) { - ret = -ENOMEM; - goto err_urb; - } - - /* Allocate buffer */ - skb = alloc_skb(MAX_RX_BUF_SIZE, GFP_KERNEL); - if (!skb) { - ret = -ENOMEM; - goto err_skb; - } - - usb_fill_bulk_urb(urb, hif_dev->udev, - usb_rcvbulkpipe(hif_dev->udev, - USB_WLAN_RX_PIPE), - skb->data, MAX_RX_BUF_SIZE, - ath9k_hif_usb_rx_cb, skb); - - /* Anchor URB */ - usb_anchor_urb(urb, &hif_dev->rx_submitted); - - /* Submit URB */ - ret = usb_submit_urb(urb, GFP_KERNEL); - if (ret) { - usb_unanchor_urb(urb); - goto err_submit; - } - - /* - * Drop reference count. - * This ensures that the URB is freed when killing them. - */ - usb_free_urb(urb); - } - - return 0; - -err_submit: - kfree_skb(skb); -err_skb: - usb_free_urb(urb); -err_urb: - ath9k_hif_usb_dealloc_rx_urbs(hif_dev); - return ret; -} - -static void ath9k_hif_usb_dealloc_reg_in_urbs(struct hif_device_usb *hif_dev) -{ - usb_kill_anchored_urbs(&hif_dev->reg_in_submitted); -} - -static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) -{ - struct urb *urb = NULL; - struct sk_buff *skb = NULL; - int i, ret; - - init_usb_anchor(&hif_dev->reg_in_submitted); - - for (i = 0; i < MAX_REG_IN_URB_NUM; i++) { - - /* Allocate URB */ - urb = usb_alloc_urb(0, GFP_KERNEL); - if (urb == NULL) { - ret = -ENOMEM; - goto err_urb; - } - - /* Allocate buffer */ - skb = alloc_skb(MAX_REG_IN_BUF_SIZE, GFP_KERNEL); - if (!skb) { - ret = -ENOMEM; - goto err_skb; - } - - usb_fill_bulk_urb(urb, hif_dev->udev, - usb_rcvbulkpipe(hif_dev->udev, - USB_REG_IN_PIPE), - skb->data, MAX_REG_IN_BUF_SIZE, - ath9k_hif_usb_reg_in_cb, skb); - - /* Anchor URB */ - usb_anchor_urb(urb, &hif_dev->reg_in_submitted); - - /* Submit URB */ - ret = usb_submit_urb(urb, GFP_KERNEL); - if (ret) { - usb_unanchor_urb(urb); - goto err_submit; - } - - /* - * Drop reference count. - * This ensures that the URB is freed when killing them. - */ - usb_free_urb(urb); - } - - return 0; - -err_submit: - kfree_skb(skb); -err_skb: - usb_free_urb(urb); -err_urb: - ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev); - return ret; -} - -static int ath9k_hif_usb_alloc_urbs(struct hif_device_usb *hif_dev) -{ - /* Register Write */ - init_usb_anchor(&hif_dev->regout_submitted); - - /* TX */ - if (ath9k_hif_usb_alloc_tx_urbs(hif_dev) < 0) - goto err; - - /* RX */ - if (ath9k_hif_usb_alloc_rx_urbs(hif_dev) < 0) - goto err_rx; - - /* Register Read */ - if (ath9k_hif_usb_alloc_reg_in_urbs(hif_dev) < 0) - goto err_reg; - - return 0; -err_reg: - ath9k_hif_usb_dealloc_rx_urbs(hif_dev); -err_rx: - ath9k_hif_usb_dealloc_tx_urbs(hif_dev); -err: - return -ENOMEM; -} - -static void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev) -{ - usb_kill_anchored_urbs(&hif_dev->regout_submitted); - ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev); - ath9k_hif_usb_dealloc_tx_urbs(hif_dev); - ath9k_hif_usb_dealloc_rx_urbs(hif_dev); -} - -static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev) -{ - int transfer, err; - const void *data = hif_dev->fw_data; - size_t len = hif_dev->fw_size; - u32 addr = AR9271_FIRMWARE; - u8 *buf = kzalloc(4096, GFP_KERNEL); - u32 firm_offset; - - if (!buf) - return -ENOMEM; - - while (len) { - transfer = min_t(size_t, len, 4096); - memcpy(buf, data, transfer); - - err = usb_control_msg(hif_dev->udev, - usb_sndctrlpipe(hif_dev->udev, 0), - FIRMWARE_DOWNLOAD, 0x40 | USB_DIR_OUT, - addr >> 8, 0, buf, transfer, HZ); - if (err < 0) { - kfree(buf); - return err; - } - - len -= transfer; - data += transfer; - addr += transfer; - } - kfree(buf); - - if (IS_AR7010_DEVICE(hif_dev->usb_device_id->driver_info)) - firm_offset = AR7010_FIRMWARE_TEXT; - else - firm_offset = AR9271_FIRMWARE_TEXT; - - /* - * Issue FW download complete command to firmware. - */ - err = usb_control_msg(hif_dev->udev, usb_sndctrlpipe(hif_dev->udev, 0), - FIRMWARE_DOWNLOAD_COMP, - 0x40 | USB_DIR_OUT, - firm_offset >> 8, 0, NULL, 0, HZ); - if (err) - return -EIO; - - dev_info(&hif_dev->udev->dev, "ath9k_htc: Transferred FW: %s, size: %ld\n", - hif_dev->fw_name, (unsigned long) hif_dev->fw_size); - - return 0; -} - -static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev) -{ - struct usb_host_interface *alt = &hif_dev->interface->altsetting[0]; - struct usb_endpoint_descriptor *endp; - int ret, idx; - - ret = ath9k_hif_usb_download_fw(hif_dev); - if (ret) { - dev_err(&hif_dev->udev->dev, - "ath9k_htc: Firmware - %s download failed\n", - hif_dev->fw_name); - return ret; - } - - /* On downloading the firmware to the target, the USB descriptor of EP4 - * is 'patched' to change the type of the endpoint to Bulk. This will - * bring down CPU usage during the scan period. - */ - for (idx = 0; idx < alt->desc.bNumEndpoints; idx++) { - endp = &alt->endpoint[idx].desc; - if ((endp->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) - == USB_ENDPOINT_XFER_INT) { - endp->bmAttributes &= ~USB_ENDPOINT_XFERTYPE_MASK; - endp->bmAttributes |= USB_ENDPOINT_XFER_BULK; - endp->bInterval = 0; - } - } - - /* Alloc URBs */ - ret = ath9k_hif_usb_alloc_urbs(hif_dev); - if (ret) { - dev_err(&hif_dev->udev->dev, - "ath9k_htc: Unable to allocate URBs\n"); - return ret; - } - - return 0; -} - -static void ath9k_hif_usb_dev_deinit(struct hif_device_usb *hif_dev) -{ - ath9k_hif_usb_dealloc_urbs(hif_dev); -} - -/* - * If initialization fails or the FW cannot be retrieved, - * detach the device. - */ -static void ath9k_hif_usb_firmware_fail(struct hif_device_usb *hif_dev) -{ - struct device *dev = &hif_dev->udev->dev; - struct device *parent = dev->parent; - - complete(&hif_dev->fw_done); - - if (parent) - device_lock(parent); - - device_release_driver(dev); - - if (parent) - device_unlock(parent); -} - -static void ath9k_hif_usb_firmware_cb(const struct firmware *fw, void *context) -{ - struct hif_device_usb *hif_dev = context; - int ret; - - if (!fw) { - dev_err(&hif_dev->udev->dev, - "ath9k_htc: Failed to get firmware %s\n", - hif_dev->fw_name); - goto err_fw; - } - - hif_dev->htc_handle = ath9k_htc_hw_alloc(hif_dev, &hif_usb, - &hif_dev->udev->dev); - if (hif_dev->htc_handle == NULL) - goto err_dev_alloc; - - hif_dev->fw_data = fw->data; - hif_dev->fw_size = fw->size; - - /* Proceed with initialization */ - - ret = ath9k_hif_usb_dev_init(hif_dev); - if (ret) - goto err_dev_init; - - ret = ath9k_htc_hw_init(hif_dev->htc_handle, - &hif_dev->interface->dev, - hif_dev->usb_device_id->idProduct, - hif_dev->udev->product, - hif_dev->usb_device_id->driver_info); - if (ret) { - ret = -EINVAL; - goto err_htc_hw_init; - } - - release_firmware(fw); - hif_dev->flags |= HIF_USB_READY; - complete(&hif_dev->fw_done); - - return; - -err_htc_hw_init: - ath9k_hif_usb_dev_deinit(hif_dev); -err_dev_init: - ath9k_htc_hw_free(hif_dev->htc_handle); -err_dev_alloc: - release_firmware(fw); -err_fw: - ath9k_hif_usb_firmware_fail(hif_dev); -} - -/* - * An exact copy of the function from zd1211rw. - */ -static int send_eject_command(struct usb_interface *interface) -{ - struct usb_device *udev = interface_to_usbdev(interface); - struct usb_host_interface *iface_desc = &interface->altsetting[0]; - struct usb_endpoint_descriptor *endpoint; - unsigned char *cmd; - u8 bulk_out_ep; - int r; - - /* Find bulk out endpoint */ - for (r = 1; r >= 0; r--) { - endpoint = &iface_desc->endpoint[r].desc; - if (usb_endpoint_dir_out(endpoint) && - usb_endpoint_xfer_bulk(endpoint)) { - bulk_out_ep = endpoint->bEndpointAddress; - break; - } - } - if (r == -1) { - dev_err(&udev->dev, - "ath9k_htc: Could not find bulk out endpoint\n"); - return -ENODEV; - } - - cmd = kzalloc(31, GFP_KERNEL); - if (cmd == NULL) - return -ENODEV; - - /* USB bulk command block */ - cmd[0] = 0x55; /* bulk command signature */ - cmd[1] = 0x53; /* bulk command signature */ - cmd[2] = 0x42; /* bulk command signature */ - cmd[3] = 0x43; /* bulk command signature */ - cmd[14] = 6; /* command length */ - - cmd[15] = 0x1b; /* SCSI command: START STOP UNIT */ - cmd[19] = 0x2; /* eject disc */ - - dev_info(&udev->dev, "Ejecting storage device...\n"); - r = usb_bulk_msg(udev, usb_sndbulkpipe(udev, bulk_out_ep), - cmd, 31, NULL, 2000); - kfree(cmd); - if (r) - return r; - - /* At this point, the device disconnects and reconnects with the real - * ID numbers. */ - - usb_set_intfdata(interface, NULL); - return 0; -} - -static int ath9k_hif_usb_probe(struct usb_interface *interface, - const struct usb_device_id *id) -{ - struct usb_device *udev = interface_to_usbdev(interface); - struct hif_device_usb *hif_dev; - int ret = 0; - - if (id->driver_info == STORAGE_DEVICE) - return send_eject_command(interface); - - hif_dev = kzalloc(sizeof(struct hif_device_usb), GFP_KERNEL); - if (!hif_dev) { - ret = -ENOMEM; - goto err_alloc; - } - - usb_get_dev(udev); - - hif_dev->udev = udev; - hif_dev->interface = interface; - hif_dev->usb_device_id = id; -#ifdef CONFIG_PM - udev->reset_resume = 1; -#endif - usb_set_intfdata(interface, hif_dev); - - init_completion(&hif_dev->fw_done); - - /* Find out which firmware to load */ - - if (IS_AR7010_DEVICE(id->driver_info)) - hif_dev->fw_name = FIRMWARE_AR7010_1_1; - else - hif_dev->fw_name = FIRMWARE_AR9271; - - ret = request_firmware_nowait(THIS_MODULE, true, hif_dev->fw_name, - &hif_dev->udev->dev, GFP_KERNEL, - hif_dev, ath9k_hif_usb_firmware_cb); - if (ret) { - dev_err(&hif_dev->udev->dev, - "ath9k_htc: Async request for firmware %s failed\n", - hif_dev->fw_name); - goto err_fw_req; - } - - dev_info(&hif_dev->udev->dev, "ath9k_htc: Firmware %s requested\n", - hif_dev->fw_name); - - return 0; - -err_fw_req: - usb_set_intfdata(interface, NULL); - kfree(hif_dev); - usb_put_dev(udev); -err_alloc: - return ret; -} - -static void ath9k_hif_usb_reboot(struct usb_device *udev) -{ - u32 reboot_cmd = 0xffffffff; - void *buf; - int ret; - - buf = kmemdup(&reboot_cmd, 4, GFP_KERNEL); - if (!buf) - return; - - ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, USB_REG_OUT_PIPE), - buf, 4, NULL, HZ); - if (ret) - dev_err(&udev->dev, "ath9k_htc: USB reboot failed\n"); - - kfree(buf); -} - -static void ath9k_hif_usb_disconnect(struct usb_interface *interface) -{ - struct usb_device *udev = interface_to_usbdev(interface); - struct hif_device_usb *hif_dev = usb_get_intfdata(interface); - bool unplugged = (udev->state == USB_STATE_NOTATTACHED) ? true : false; - - if (!hif_dev) - return; - - wait_for_completion(&hif_dev->fw_done); - - if (hif_dev->flags & HIF_USB_READY) { - ath9k_htc_hw_deinit(hif_dev->htc_handle, unplugged); - ath9k_htc_hw_free(hif_dev->htc_handle); - ath9k_hif_usb_dev_deinit(hif_dev); - } - - usb_set_intfdata(interface, NULL); - - /* If firmware was loaded we should drop it - * go back to first stage bootloader. */ - if (!unplugged && (hif_dev->flags & HIF_USB_READY)) - ath9k_hif_usb_reboot(udev); - - kfree(hif_dev); - dev_info(&udev->dev, "ath9k_htc: USB layer deinitialized\n"); - usb_put_dev(udev); -} - -#ifdef CONFIG_PM -static int ath9k_hif_usb_suspend(struct usb_interface *interface, - pm_message_t message) -{ - struct hif_device_usb *hif_dev = usb_get_intfdata(interface); - - /* - * The device has to be set to FULLSLEEP mode in case no - * interface is up. - */ - if (!(hif_dev->flags & HIF_USB_START)) - ath9k_htc_suspend(hif_dev->htc_handle); - - ath9k_hif_usb_dealloc_urbs(hif_dev); - - return 0; -} - -static int ath9k_hif_usb_resume(struct usb_interface *interface) -{ - struct hif_device_usb *hif_dev = usb_get_intfdata(interface); - struct htc_target *htc_handle = hif_dev->htc_handle; - int ret; - const struct firmware *fw; - - ret = ath9k_hif_usb_alloc_urbs(hif_dev); - if (ret) - return ret; - - if (hif_dev->flags & HIF_USB_READY) { - /* request cached firmware during suspend/resume cycle */ - ret = request_firmware(&fw, hif_dev->fw_name, - &hif_dev->udev->dev); - if (ret) - goto fail_resume; - - hif_dev->fw_data = fw->data; - hif_dev->fw_size = fw->size; - ret = ath9k_hif_usb_download_fw(hif_dev); - release_firmware(fw); - if (ret) - goto fail_resume; - } else { - ath9k_hif_usb_dealloc_urbs(hif_dev); - return -EIO; - } - - mdelay(100); - - ret = ath9k_htc_resume(htc_handle); - - if (ret) - goto fail_resume; - - return 0; - -fail_resume: - ath9k_hif_usb_dealloc_urbs(hif_dev); - - return ret; -} -#endif - -static struct usb_driver ath9k_hif_usb_driver = { - .name = KBUILD_MODNAME, - .probe = ath9k_hif_usb_probe, - .disconnect = ath9k_hif_usb_disconnect, -#ifdef CONFIG_PM - .suspend = ath9k_hif_usb_suspend, - .resume = ath9k_hif_usb_resume, - .reset_resume = ath9k_hif_usb_resume, -#endif - .id_table = ath9k_hif_usb_ids, - .soft_unbind = 1, - .disable_hub_initiated_lpm = 1, -}; - -int ath9k_hif_usb_init(void) -{ - return usb_register(&ath9k_hif_usb_driver); -} - -void ath9k_hif_usb_exit(void) -{ - usb_deregister(&ath9k_hif_usb_driver); -} diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.h b/drivers/net/wireless/ath/ath9k/hif_usb.h deleted file mode 100644 index 51496e74b83e..000000000000 --- a/drivers/net/wireless/ath/ath9k/hif_usb.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef HTC_USB_H -#define HTC_USB_H - -#define MAJOR_VERSION_REQ 1 -#define MINOR_VERSION_REQ 3 - -#define IS_AR7010_DEVICE(_v) (((_v) == AR9280_USB) || ((_v) == AR9287_USB)) - -#define AR9271_FIRMWARE 0x501000 -#define AR9271_FIRMWARE_TEXT 0x903000 -#define AR7010_FIRMWARE_TEXT 0x906000 - -#define FIRMWARE_DOWNLOAD 0x30 -#define FIRMWARE_DOWNLOAD_COMP 0x31 - -#define ATH_USB_RX_STREAM_MODE_TAG 0x4e00 -#define ATH_USB_TX_STREAM_MODE_TAG 0x697e - -/* FIXME: Verify these numbers (with Windows) */ -#define MAX_TX_URB_NUM 8 -#define MAX_TX_BUF_NUM 256 -#define MAX_TX_BUF_SIZE 32768 -#define MAX_TX_AGGR_NUM 20 - -#define MAX_RX_URB_NUM 8 -#define MAX_RX_BUF_SIZE 16384 -#define MAX_PKT_NUM_IN_TRANSFER 10 - -#define MAX_REG_OUT_URB_NUM 1 -#define MAX_REG_IN_URB_NUM 64 - -#define MAX_REG_IN_BUF_SIZE 64 - -/* USB Endpoint definition */ -#define USB_WLAN_TX_PIPE 1 -#define USB_WLAN_RX_PIPE 2 -#define USB_REG_IN_PIPE 3 -#define USB_REG_OUT_PIPE 4 - -#define HIF_USB_MAX_RXPIPES 2 -#define HIF_USB_MAX_TXPIPES 4 - -struct tx_buf { - u8 *buf; - u16 len; - u16 offset; - struct urb *urb; - struct sk_buff_head skb_queue; - struct hif_device_usb *hif_dev; - struct list_head list; -}; - -#define HIF_USB_TX_STOP BIT(0) -#define HIF_USB_TX_FLUSH BIT(1) - -struct hif_usb_tx { - u8 flags; - u8 tx_buf_cnt; - u16 tx_skb_cnt; - struct sk_buff_head tx_skb_queue; - struct list_head tx_buf; - struct list_head tx_pending; - spinlock_t tx_lock; -}; - -struct cmd_buf { - struct sk_buff *skb; - struct hif_device_usb *hif_dev; -}; - -#define HIF_USB_START BIT(0) -#define HIF_USB_READY BIT(1) - -struct hif_device_usb { - struct usb_device *udev; - struct usb_interface *interface; - const struct usb_device_id *usb_device_id; - const void *fw_data; - size_t fw_size; - struct completion fw_done; - struct htc_target *htc_handle; - struct hif_usb_tx tx; - struct usb_anchor regout_submitted; - struct usb_anchor rx_submitted; - struct usb_anchor reg_in_submitted; - struct usb_anchor mgmt_submitted; - struct sk_buff *remain_skb; - const char *fw_name; - int rx_remain_len; - int rx_pkt_len; - int rx_transfer_len; - int rx_pad_len; - spinlock_t rx_lock; - u8 flags; /* HIF_USB_* */ -}; - -int ath9k_hif_usb_init(void); -void ath9k_hif_usb_exit(void); - -#endif /* HTC_USB_H */ diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h deleted file mode 100644 index d3b099d7898b..000000000000 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ /dev/null @@ -1,609 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef HTC_H -#define HTC_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "common.h" -#include "htc_hst.h" -#include "hif_usb.h" -#include "wmi.h" - -#define ATH_STA_SHORT_CALINTERVAL 1000 /* 1 second */ -#define ATH_AP_SHORT_CALINTERVAL 100 /* 100 ms */ -#define ATH_ANI_POLLINTERVAL 100 /* 100 ms */ -#define ATH_LONG_CALINTERVAL 30000 /* 30 seconds */ -#define ATH_RESTART_CALINTERVAL 1200000 /* 20 minutes */ - -#define ATH_DEFAULT_BMISS_LIMIT 10 -#define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024) -#define TSF_TO_TU(_h, _l) \ - ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10)) - -extern struct ieee80211_ops ath9k_htc_ops; -extern int htc_modparam_nohwcrypt; - -enum htc_phymode { - HTC_MODE_11NA = 0, - HTC_MODE_11NG = 1 -}; - -enum htc_opmode { - HTC_M_STA = 1, - HTC_M_IBSS = 0, - HTC_M_AHDEMO = 3, - HTC_M_HOSTAP = 6, - HTC_M_MONITOR = 8, - HTC_M_WDS = 2 -}; - -#define ATH9K_HTC_AMPDU 1 -#define ATH9K_HTC_NORMAL 2 -#define ATH9K_HTC_BEACON 3 -#define ATH9K_HTC_MGMT 4 - -#define ATH9K_HTC_TX_CTSONLY 0x1 -#define ATH9K_HTC_TX_RTSCTS 0x2 - -struct tx_frame_hdr { - u8 data_type; - u8 node_idx; - u8 vif_idx; - u8 tidno; - __be32 flags; /* ATH9K_HTC_TX_* */ - u8 key_type; - u8 keyix; - u8 cookie; - u8 pad; -} __packed; - -struct tx_mgmt_hdr { - u8 node_idx; - u8 vif_idx; - u8 tidno; - u8 flags; - u8 key_type; - u8 keyix; - u8 cookie; - u8 pad; -} __packed; - -struct tx_beacon_header { - u8 vif_index; - u8 len_changed; - u16 rev; -} __packed; - -#define MAX_TX_AMPDU_SUBFRAMES_9271 17 -#define MAX_TX_AMPDU_SUBFRAMES_7010 22 - -struct ath9k_htc_cap_target { - __be32 ampdu_limit; - u8 ampdu_subframes; - u8 enable_coex; - u8 tx_chainmask; - u8 pad; -} __packed; - -struct ath9k_htc_target_vif { - u8 index; - u8 opmode; - u8 myaddr[ETH_ALEN]; - u8 ath_cap; - __be16 rtsthreshold; - u8 pad; -} __packed; - -struct ath9k_htc_target_sta { - u8 macaddr[ETH_ALEN]; - u8 bssid[ETH_ALEN]; - u8 sta_index; - u8 vif_index; - u8 is_vif_sta; - __be16 flags; - __be16 htcap; - __be16 maxampdu; - u8 pad; -} __packed; - -struct ath9k_htc_target_aggr { - u8 sta_index; - u8 tidno; - u8 aggr_enable; - u8 padding; -} __packed; - -#define ATH_HTC_RATE_MAX 30 - -#define WLAN_RC_DS_FLAG 0x01 -#define WLAN_RC_40_FLAG 0x02 -#define WLAN_RC_SGI_FLAG 0x04 -#define WLAN_RC_HT_FLAG 0x08 - -struct ath9k_htc_rateset { - u8 rs_nrates; - u8 rs_rates[ATH_HTC_RATE_MAX]; -}; - -struct ath9k_htc_rate { - struct ath9k_htc_rateset legacy_rates; - struct ath9k_htc_rateset ht_rates; -} __packed; - -struct ath9k_htc_target_rate { - u8 sta_index; - u8 isnew; - __be32 capflags; - struct ath9k_htc_rate rates; -}; - -struct ath9k_htc_target_rate_mask { - u8 vif_index; - u8 band; - __be32 mask; - u16 pad; -} __packed; - -struct ath9k_htc_target_int_stats { - __be32 rx; - __be32 rxorn; - __be32 rxeol; - __be32 txurn; - __be32 txto; - __be32 cst; -} __packed; - -struct ath9k_htc_target_tx_stats { - __be32 xretries; - __be32 fifoerr; - __be32 filtered; - __be32 timer_exp; - __be32 shortretries; - __be32 longretries; - __be32 qnull; - __be32 encap_fail; - __be32 nobuf; -} __packed; - -struct ath9k_htc_target_rx_stats { - __be32 nobuf; - __be32 host_send; - __be32 host_done; -} __packed; - -#define ATH9K_HTC_MAX_VIF 2 -#define ATH9K_HTC_MAX_BCN_VIF 2 - -#define INC_VIF(_priv, _type) do { \ - switch (_type) { \ - case NL80211_IFTYPE_STATION: \ - _priv->num_sta_vif++; \ - break; \ - case NL80211_IFTYPE_ADHOC: \ - _priv->num_ibss_vif++; \ - break; \ - case NL80211_IFTYPE_AP: \ - _priv->num_ap_vif++; \ - break; \ - default: \ - break; \ - } \ - } while (0) - -#define DEC_VIF(_priv, _type) do { \ - switch (_type) { \ - case NL80211_IFTYPE_STATION: \ - _priv->num_sta_vif--; \ - break; \ - case NL80211_IFTYPE_ADHOC: \ - _priv->num_ibss_vif--; \ - break; \ - case NL80211_IFTYPE_AP: \ - _priv->num_ap_vif--; \ - break; \ - default: \ - break; \ - } \ - } while (0) - -struct ath9k_htc_vif { - u8 index; - u16 seq_no; - bool beacon_configured; - int bslot; - __le64 tsfadjust; -}; - -struct ath9k_vif_iter_data { - const u8 *hw_macaddr; - u8 mask[ETH_ALEN]; -}; - -#define ATH9K_HTC_MAX_STA 8 -#define ATH9K_HTC_MAX_TID 8 - -enum tid_aggr_state { - AGGR_STOP = 0, - AGGR_PROGRESS, - AGGR_START, - AGGR_OPERATIONAL -}; - -struct ath9k_htc_sta { - u8 index; - enum tid_aggr_state tid_state[ATH9K_HTC_MAX_TID]; -}; - -#define ATH9K_HTC_RXBUF 256 -#define HTC_RX_FRAME_HEADER_SIZE 40 - -struct ath9k_htc_rxbuf { - bool in_process; - struct sk_buff *skb; - struct ath_htc_rx_status rxstatus; - struct list_head list; -}; - -struct ath9k_htc_rx { - int last_rssi; /* FIXME: per-STA */ - struct list_head rxbuf; - spinlock_t rxbuflock; -}; - -#define ATH9K_HTC_TX_CLEANUP_INTERVAL 50 /* ms */ -#define ATH9K_HTC_TX_TIMEOUT_INTERVAL 3000 /* ms */ -#define ATH9K_HTC_TX_RESERVE 10 -#define ATH9K_HTC_TX_TIMEOUT_COUNT 40 -#define ATH9K_HTC_TX_THRESHOLD (MAX_TX_BUF_NUM - ATH9K_HTC_TX_RESERVE) - -#define ATH9K_HTC_OP_TX_QUEUES_STOP BIT(0) -#define ATH9K_HTC_OP_TX_DRAIN BIT(1) - -struct ath9k_htc_tx { - u8 flags; - int queued_cnt; - struct sk_buff_head mgmt_ep_queue; - struct sk_buff_head cab_ep_queue; - struct sk_buff_head data_be_queue; - struct sk_buff_head data_bk_queue; - struct sk_buff_head data_vi_queue; - struct sk_buff_head data_vo_queue; - struct sk_buff_head tx_failed; - DECLARE_BITMAP(tx_slot, MAX_TX_BUF_NUM); - struct timer_list cleanup_timer; - spinlock_t tx_lock; -}; - -struct ath9k_htc_tx_ctl { - u8 type; /* ATH9K_HTC_* */ - u8 epid; - u8 txok; - u8 sta_idx; - unsigned long timestamp; -}; - -static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - - BUILD_BUG_ON(sizeof(struct ath9k_htc_tx_ctl) > - IEEE80211_TX_INFO_DRIVER_DATA_SIZE); - return (struct ath9k_htc_tx_ctl *) &tx_info->driver_data; -} - -#ifdef CONFIG_ATH9K_HTC_DEBUGFS - -#define TX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) -#define RX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.rx_stats.c++) -#define CAB_STAT_INC priv->debug.tx_stats.cab_queued++ - -#define TX_QSTAT_INC(q) (priv->debug.tx_stats.queue_stats[q]++) - -void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, - struct ath_htc_rx_status *rxs); - -struct ath_tx_stats { - u32 buf_queued; - u32 buf_completed; - u32 skb_queued; - u32 skb_success; - u32 skb_failed; - u32 cab_queued; - u32 queue_stats[IEEE80211_NUM_ACS]; -}; - -struct ath_rx_stats { - u32 skb_allocated; - u32 skb_completed; - u32 skb_dropped; - u32 err_crc; - u32 err_decrypt_crc; - u32 err_mic; - u32 err_pre_delim; - u32 err_post_delim; - u32 err_decrypt_busy; - u32 err_phy; - u32 err_phy_stats[ATH9K_PHYERR_MAX]; -}; - -struct ath9k_debug { - struct dentry *debugfs_phy; - struct ath_tx_stats tx_stats; - struct ath_rx_stats rx_stats; -}; - -#else - -#define TX_STAT_INC(c) do { } while (0) -#define RX_STAT_INC(c) do { } while (0) -#define CAB_STAT_INC do { } while (0) - -#define TX_QSTAT_INC(c) do { } while (0) - -static inline void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, - struct ath_htc_rx_status *rxs) -{ -} - -#endif /* CONFIG_ATH9K_HTC_DEBUGFS */ - -#define ATH_LED_PIN_DEF 1 -#define ATH_LED_PIN_9287 10 -#define ATH_LED_PIN_9271 15 -#define ATH_LED_PIN_7010 12 - -#define BSTUCK_THRESHOLD 10 - -/* - * Adjust these when the max. no of beaconing interfaces is - * increased. - */ -#define DEFAULT_SWBA_RESPONSE 40 /* in TUs */ -#define MIN_SWBA_RESPONSE 10 /* in TUs */ - -struct htc_beacon_config { - struct ieee80211_vif *bslot[ATH9K_HTC_MAX_BCN_VIF]; - u16 beacon_interval; - u16 dtim_period; - u16 bmiss_timeout; - u32 bmiss_cnt; -}; - -struct ath_btcoex { - u32 bt_priority_cnt; - unsigned long bt_priority_time; - int bt_stomp_type; /* Types of BT stomping */ - u32 btcoex_no_stomp; - u32 btcoex_period; - u32 btscan_no_stomp; -}; - -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT -void ath9k_htc_init_btcoex(struct ath9k_htc_priv *priv, char *product); -void ath9k_htc_start_btcoex(struct ath9k_htc_priv *priv); -void ath9k_htc_stop_btcoex(struct ath9k_htc_priv *priv); -#else -static inline void ath9k_htc_init_btcoex(struct ath9k_htc_priv *priv, char *product) -{ -} -static inline void ath9k_htc_start_btcoex(struct ath9k_htc_priv *priv) -{ -} -static inline void ath9k_htc_stop_btcoex(struct ath9k_htc_priv *priv) -{ -} -#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ - -#define OP_INVALID BIT(0) -#define OP_SCANNING BIT(1) -#define OP_ENABLE_BEACON BIT(2) -#define OP_BT_PRIORITY_DETECTED BIT(3) -#define OP_BT_SCAN BIT(4) -#define OP_ANI_RUNNING BIT(5) -#define OP_TSF_RESET BIT(6) - -struct ath9k_htc_priv { - struct device *dev; - struct ieee80211_hw *hw; - struct ath_hw *ah; - struct htc_target *htc; - struct wmi *wmi; - - u16 fw_version_major; - u16 fw_version_minor; - - enum htc_endpoint_id wmi_cmd_ep; - enum htc_endpoint_id beacon_ep; - enum htc_endpoint_id cab_ep; - enum htc_endpoint_id uapsd_ep; - enum htc_endpoint_id mgmt_ep; - enum htc_endpoint_id data_be_ep; - enum htc_endpoint_id data_bk_ep; - enum htc_endpoint_id data_vi_ep; - enum htc_endpoint_id data_vo_ep; - - u8 vif_slot; - u8 mon_vif_idx; - u8 sta_slot; - u8 vif_sta_pos[ATH9K_HTC_MAX_VIF]; - u8 num_ibss_vif; - u8 num_sta_vif; - u8 num_sta_assoc_vif; - u8 num_ap_vif; - - u16 curtxpow; - u16 txpowlimit; - u16 nvifs; - u16 nstations; - bool rearm_ani; - bool reconfig_beacon; - unsigned int rxfilter; - unsigned long op_flags; - - struct ath9k_hw_cal_data caldata; - struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; - - spinlock_t beacon_lock; - struct htc_beacon_config cur_beacon_conf; - - struct ath9k_htc_rx rx; - struct ath9k_htc_tx tx; - - struct tasklet_struct swba_tasklet; - struct tasklet_struct rx_tasklet; - struct delayed_work ani_work; - struct tasklet_struct tx_failed_tasklet; - struct work_struct ps_work; - struct work_struct fatal_work; - - struct mutex htc_pm_lock; - unsigned long ps_usecount; - bool ps_enabled; - bool ps_idle; - -#ifdef CONFIG_MAC80211_LEDS - enum led_brightness brightness; - bool led_registered; - char led_name[32]; - struct led_classdev led_cdev; - struct work_struct led_work; -#endif - - int beaconq; - int cabq; - int hwq_map[IEEE80211_NUM_ACS]; - -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT - struct ath_btcoex btcoex; -#endif - - struct delayed_work coex_period_work; - struct delayed_work duty_cycle_work; -#ifdef CONFIG_ATH9K_HTC_DEBUGFS - struct ath9k_debug debug; -#endif - struct mutex mutex; -}; - -static inline void ath_read_cachesize(struct ath_common *common, int *csz) -{ - common->bus_ops->read_cachesize(common, csz); -} - -void ath9k_htc_reset(struct ath9k_htc_priv *priv); - -void ath9k_htc_assign_bslot(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif); -void ath9k_htc_remove_bslot(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif); -void ath9k_htc_set_tsfadjust(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif); -void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv); -void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif); -void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv *priv); -void ath9k_htc_swba(struct ath9k_htc_priv *priv, - struct wmi_event_swba *swba); - -void ath9k_htc_rxep(void *priv, struct sk_buff *skb, - enum htc_endpoint_id ep_id); -void ath9k_htc_txep(void *priv, struct sk_buff *skb, enum htc_endpoint_id ep_id, - bool txok); -void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb, - enum htc_endpoint_id ep_id, bool txok); - -int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv, - u8 enable_coex); -void ath9k_htc_ani_work(struct work_struct *work); -void ath9k_htc_start_ani(struct ath9k_htc_priv *priv); -void ath9k_htc_stop_ani(struct ath9k_htc_priv *priv); - -int ath9k_tx_init(struct ath9k_htc_priv *priv); -int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, - struct ieee80211_sta *sta, - struct sk_buff *skb, u8 slot, bool is_cab); -void ath9k_tx_cleanup(struct ath9k_htc_priv *priv); -bool ath9k_htc_txq_setup(struct ath9k_htc_priv *priv, int subtype); -int ath9k_htc_cabq_setup(struct ath9k_htc_priv *priv); -int get_hw_qnum(u16 queue, int *hwq_map); -int ath_htc_txq_update(struct ath9k_htc_priv *priv, int qnum, - struct ath9k_tx_queue_info *qinfo); -void ath9k_htc_check_stop_queues(struct ath9k_htc_priv *priv); -void ath9k_htc_check_wake_queues(struct ath9k_htc_priv *priv); -int ath9k_htc_tx_get_slot(struct ath9k_htc_priv *priv); -void ath9k_htc_tx_clear_slot(struct ath9k_htc_priv *priv, int slot); -void ath9k_htc_tx_drain(struct ath9k_htc_priv *priv); -void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event); -void ath9k_tx_failed_tasklet(unsigned long data); -void ath9k_htc_tx_cleanup_timer(unsigned long data); - -int ath9k_rx_init(struct ath9k_htc_priv *priv); -void ath9k_rx_cleanup(struct ath9k_htc_priv *priv); -void ath9k_host_rx_init(struct ath9k_htc_priv *priv); -void ath9k_rx_tasklet(unsigned long data); -u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv); - -void ath9k_htc_ps_wakeup(struct ath9k_htc_priv *priv); -void ath9k_htc_ps_restore(struct ath9k_htc_priv *priv); -void ath9k_ps_work(struct work_struct *work); -bool ath9k_htc_setpower(struct ath9k_htc_priv *priv, - enum ath9k_power_mode mode); - -void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv); -void ath9k_htc_rfkill_poll_state(struct ieee80211_hw *hw); - -#ifdef CONFIG_MAC80211_LEDS -void ath9k_init_leds(struct ath9k_htc_priv *priv); -void ath9k_deinit_leds(struct ath9k_htc_priv *priv); -void ath9k_led_work(struct work_struct *work); -#else -static inline void ath9k_init_leds(struct ath9k_htc_priv *priv) -{ -} - -static inline void ath9k_deinit_leds(struct ath9k_htc_priv *priv) -{ -} - -static inline void ath9k_led_work(struct work_struct *work) -{ -} -#endif - -int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, - u16 devid, char *product, u32 drv_info); -void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug); -#ifdef CONFIG_PM -void ath9k_htc_suspend(struct htc_target *htc_handle); -int ath9k_htc_resume(struct htc_target *htc_handle); -#endif -#ifdef CONFIG_ATH9K_HTC_DEBUGFS -int ath9k_htc_init_debug(struct ath_hw *ah); -#else -static inline int ath9k_htc_init_debug(struct ath_hw *ah) { return 0; }; -#endif /* CONFIG_ATH9K_HTC_DEBUGFS */ - -#endif /* HTC_H */ diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c deleted file mode 100644 index f13f458dd656..000000000000 --- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c +++ /dev/null @@ -1,659 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "htc.h" - -#define FUDGE 2 - -void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv) -{ - struct ath_hw *ah = priv->ah; - struct ath9k_tx_queue_info qi, qi_be; - - memset(&qi, 0, sizeof(struct ath9k_tx_queue_info)); - memset(&qi_be, 0, sizeof(struct ath9k_tx_queue_info)); - - ath9k_hw_get_txq_props(ah, priv->beaconq, &qi); - - if (priv->ah->opmode == NL80211_IFTYPE_AP) { - qi.tqi_aifs = 1; - qi.tqi_cwmin = 0; - qi.tqi_cwmax = 0; - } else if (priv->ah->opmode == NL80211_IFTYPE_ADHOC) { - int qnum = priv->hwq_map[IEEE80211_AC_BE]; - - ath9k_hw_get_txq_props(ah, qnum, &qi_be); - - qi.tqi_aifs = qi_be.tqi_aifs; - - /* - * For WIFI Beacon Distribution - * Long slot time : 2x cwmin - * Short slot time : 4x cwmin - */ - if (ah->slottime == ATH9K_SLOT_TIME_20) - qi.tqi_cwmin = 2*qi_be.tqi_cwmin; - else - qi.tqi_cwmin = 4*qi_be.tqi_cwmin; - - qi.tqi_cwmax = qi_be.tqi_cwmax; - - } - - if (!ath9k_hw_set_txq_props(ah, priv->beaconq, &qi)) { - ath_err(ath9k_hw_common(ah), - "Unable to update beacon queue %u!\n", priv->beaconq); - } else { - ath9k_hw_resettxqueue(ah, priv->beaconq); - } -} - - -static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv *priv, - struct htc_beacon_config *bss_conf) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_beacon_state bs; - enum ath9k_int imask = 0; - int dtimperiod, dtimcount, sleepduration; - int cfpperiod, cfpcount, bmiss_timeout; - u32 nexttbtt = 0, intval, tsftu; - __be32 htc_imask = 0; - u64 tsf; - int num_beacons, offset, dtim_dec_count, cfp_dec_count; - int ret __attribute__ ((unused)); - u8 cmd_rsp; - - memset(&bs, 0, sizeof(bs)); - - intval = bss_conf->beacon_interval; - bmiss_timeout = (ATH_DEFAULT_BMISS_LIMIT * bss_conf->beacon_interval); - - /* - * Setup dtim and cfp parameters according to - * last beacon we received (which may be none). - */ - dtimperiod = bss_conf->dtim_period; - if (dtimperiod <= 0) /* NB: 0 if not known */ - dtimperiod = 1; - dtimcount = 1; - if (dtimcount >= dtimperiod) /* NB: sanity check */ - dtimcount = 0; - cfpperiod = 1; /* NB: no PCF support yet */ - cfpcount = 0; - - sleepduration = intval; - if (sleepduration <= 0) - sleepduration = intval; - - /* - * Pull nexttbtt forward to reflect the current - * TSF and calculate dtim+cfp state for the result. - */ - tsf = ath9k_hw_gettsf64(priv->ah); - tsftu = TSF_TO_TU(tsf>>32, tsf) + FUDGE; - - num_beacons = tsftu / intval + 1; - offset = tsftu % intval; - nexttbtt = tsftu - offset; - if (offset) - nexttbtt += intval; - - /* DTIM Beacon every dtimperiod Beacon */ - dtim_dec_count = num_beacons % dtimperiod; - /* CFP every cfpperiod DTIM Beacon */ - cfp_dec_count = (num_beacons / dtimperiod) % cfpperiod; - if (dtim_dec_count) - cfp_dec_count++; - - dtimcount -= dtim_dec_count; - if (dtimcount < 0) - dtimcount += dtimperiod; - - cfpcount -= cfp_dec_count; - if (cfpcount < 0) - cfpcount += cfpperiod; - - bs.bs_intval = intval; - bs.bs_nexttbtt = nexttbtt; - bs.bs_dtimperiod = dtimperiod*intval; - bs.bs_nextdtim = bs.bs_nexttbtt + dtimcount*intval; - bs.bs_cfpperiod = cfpperiod*bs.bs_dtimperiod; - bs.bs_cfpnext = bs.bs_nextdtim + cfpcount*bs.bs_dtimperiod; - bs.bs_cfpmaxduration = 0; - - /* - * Calculate the number of consecutive beacons to miss* before taking - * a BMISS interrupt. The configuration is specified in TU so we only - * need calculate based on the beacon interval. Note that we clamp the - * result to at most 15 beacons. - */ - if (sleepduration > intval) { - bs.bs_bmissthreshold = ATH_DEFAULT_BMISS_LIMIT / 2; - } else { - bs.bs_bmissthreshold = DIV_ROUND_UP(bmiss_timeout, intval); - if (bs.bs_bmissthreshold > 15) - bs.bs_bmissthreshold = 15; - else if (bs.bs_bmissthreshold <= 0) - bs.bs_bmissthreshold = 1; - } - - /* - * Calculate sleep duration. The configuration is given in ms. - * We ensure a multiple of the beacon period is used. Also, if the sleep - * duration is greater than the DTIM period then it makes senses - * to make it a multiple of that. - * - * XXX fixed at 100ms - */ - - bs.bs_sleepduration = roundup(IEEE80211_MS_TO_TU(100), sleepduration); - if (bs.bs_sleepduration > bs.bs_dtimperiod) - bs.bs_sleepduration = bs.bs_dtimperiod; - - /* TSF out of range threshold fixed at 1 second */ - bs.bs_tsfoor_threshold = ATH9K_TSFOOR_THRESHOLD; - - ath_dbg(common, CONFIG, "intval: %u tsf: %llu tsftu: %u\n", - intval, tsf, tsftu); - ath_dbg(common, CONFIG, - "bmiss: %u sleep: %u cfp-period: %u maxdur: %u next: %u\n", - bs.bs_bmissthreshold, bs.bs_sleepduration, - bs.bs_cfpperiod, bs.bs_cfpmaxduration, bs.bs_cfpnext); - - /* Set the computed STA beacon timers */ - - WMI_CMD(WMI_DISABLE_INTR_CMDID); - ath9k_hw_set_sta_beacon_timers(priv->ah, &bs); - imask |= ATH9K_INT_BMISS; - htc_imask = cpu_to_be32(imask); - WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask); -} - -static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv *priv, - struct htc_beacon_config *bss_conf) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - enum ath9k_int imask = 0; - u32 nexttbtt, intval, tsftu; - __be32 htc_imask = 0; - int ret __attribute__ ((unused)); - u8 cmd_rsp; - u64 tsf; - - intval = bss_conf->beacon_interval; - intval /= ATH9K_HTC_MAX_BCN_VIF; - nexttbtt = intval; - - /* - * To reduce beacon misses under heavy TX load, - * set the beacon response time to a larger value. - */ - if (intval > DEFAULT_SWBA_RESPONSE) - priv->ah->config.sw_beacon_response_time = DEFAULT_SWBA_RESPONSE; - else - priv->ah->config.sw_beacon_response_time = MIN_SWBA_RESPONSE; - - if (test_bit(OP_TSF_RESET, &priv->op_flags)) { - ath9k_hw_reset_tsf(priv->ah); - clear_bit(OP_TSF_RESET, &priv->op_flags); - } else { - /* - * Pull nexttbtt forward to reflect the current TSF. - */ - tsf = ath9k_hw_gettsf64(priv->ah); - tsftu = TSF_TO_TU(tsf >> 32, tsf) + FUDGE; - do { - nexttbtt += intval; - } while (nexttbtt < tsftu); - } - - if (test_bit(OP_ENABLE_BEACON, &priv->op_flags)) - imask |= ATH9K_INT_SWBA; - - ath_dbg(common, CONFIG, - "AP Beacon config, intval: %d, nexttbtt: %u, resp_time: %d imask: 0x%x\n", - bss_conf->beacon_interval, nexttbtt, - priv->ah->config.sw_beacon_response_time, imask); - - ath9k_htc_beaconq_config(priv); - - WMI_CMD(WMI_DISABLE_INTR_CMDID); - ath9k_hw_beaconinit(priv->ah, TU_TO_USEC(nexttbtt), TU_TO_USEC(intval)); - priv->cur_beacon_conf.bmiss_cnt = 0; - htc_imask = cpu_to_be32(imask); - WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask); -} - -static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv, - struct htc_beacon_config *bss_conf) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - enum ath9k_int imask = 0; - u32 nexttbtt, intval, tsftu; - __be32 htc_imask = 0; - int ret __attribute__ ((unused)); - u8 cmd_rsp; - u64 tsf; - - intval = bss_conf->beacon_interval; - nexttbtt = intval; - - /* - * Pull nexttbtt forward to reflect the current TSF. - */ - tsf = ath9k_hw_gettsf64(priv->ah); - tsftu = TSF_TO_TU(tsf >> 32, tsf) + FUDGE; - do { - nexttbtt += intval; - } while (nexttbtt < tsftu); - - /* - * Only one IBSS interfce is allowed. - */ - if (intval > DEFAULT_SWBA_RESPONSE) - priv->ah->config.sw_beacon_response_time = DEFAULT_SWBA_RESPONSE; - else - priv->ah->config.sw_beacon_response_time = MIN_SWBA_RESPONSE; - - if (test_bit(OP_ENABLE_BEACON, &priv->op_flags)) - imask |= ATH9K_INT_SWBA; - - ath_dbg(common, CONFIG, - "IBSS Beacon config, intval: %d, nexttbtt: %u, resp_time: %d, imask: 0x%x\n", - bss_conf->beacon_interval, nexttbtt, - priv->ah->config.sw_beacon_response_time, imask); - - WMI_CMD(WMI_DISABLE_INTR_CMDID); - ath9k_hw_beaconinit(priv->ah, TU_TO_USEC(nexttbtt), TU_TO_USEC(intval)); - priv->cur_beacon_conf.bmiss_cnt = 0; - htc_imask = cpu_to_be32(imask); - WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask); -} - -void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb, - enum htc_endpoint_id ep_id, bool txok) -{ - dev_kfree_skb_any(skb); -} - -static void ath9k_htc_send_buffered(struct ath9k_htc_priv *priv, - int slot) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ieee80211_vif *vif; - struct sk_buff *skb; - struct ieee80211_hdr *hdr; - int padpos, padsize, ret, tx_slot; - - spin_lock_bh(&priv->beacon_lock); - - vif = priv->cur_beacon_conf.bslot[slot]; - - skb = ieee80211_get_buffered_bc(priv->hw, vif); - - while(skb) { - hdr = (struct ieee80211_hdr *) skb->data; - - padpos = ieee80211_hdrlen(hdr->frame_control); - padsize = padpos & 3; - if (padsize && skb->len > padpos) { - if (skb_headroom(skb) < padsize) { - dev_kfree_skb_any(skb); - goto next; - } - skb_push(skb, padsize); - memmove(skb->data, skb->data + padsize, padpos); - } - - tx_slot = ath9k_htc_tx_get_slot(priv); - if (tx_slot < 0) { - ath_dbg(common, XMIT, "No free CAB slot\n"); - dev_kfree_skb_any(skb); - goto next; - } - - ret = ath9k_htc_tx_start(priv, NULL, skb, tx_slot, true); - if (ret != 0) { - ath9k_htc_tx_clear_slot(priv, tx_slot); - dev_kfree_skb_any(skb); - - ath_dbg(common, XMIT, "Failed to send CAB frame\n"); - } else { - spin_lock_bh(&priv->tx.tx_lock); - priv->tx.queued_cnt++; - spin_unlock_bh(&priv->tx.tx_lock); - } - next: - skb = ieee80211_get_buffered_bc(priv->hw, vif); - } - - spin_unlock_bh(&priv->beacon_lock); -} - -static void ath9k_htc_send_beacon(struct ath9k_htc_priv *priv, - int slot) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ieee80211_vif *vif; - struct ath9k_htc_vif *avp; - struct tx_beacon_header beacon_hdr; - struct ath9k_htc_tx_ctl *tx_ctl; - struct ieee80211_tx_info *info; - struct ieee80211_mgmt *mgmt; - struct sk_buff *beacon; - u8 *tx_fhdr; - int ret; - - memset(&beacon_hdr, 0, sizeof(struct tx_beacon_header)); - - spin_lock_bh(&priv->beacon_lock); - - vif = priv->cur_beacon_conf.bslot[slot]; - avp = (struct ath9k_htc_vif *)vif->drv_priv; - - if (unlikely(test_bit(OP_SCANNING, &priv->op_flags))) { - spin_unlock_bh(&priv->beacon_lock); - return; - } - - /* Get a new beacon */ - beacon = ieee80211_beacon_get(priv->hw, vif); - if (!beacon) { - spin_unlock_bh(&priv->beacon_lock); - return; - } - - /* - * Update the TSF adjust value here, the HW will - * add this value for every beacon. - */ - mgmt = (struct ieee80211_mgmt *)beacon->data; - mgmt->u.beacon.timestamp = avp->tsfadjust; - - info = IEEE80211_SKB_CB(beacon); - if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { - struct ieee80211_hdr *hdr = - (struct ieee80211_hdr *) beacon->data; - avp->seq_no += 0x10; - hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); - hdr->seq_ctrl |= cpu_to_le16(avp->seq_no); - } - - tx_ctl = HTC_SKB_CB(beacon); - memset(tx_ctl, 0, sizeof(*tx_ctl)); - - tx_ctl->type = ATH9K_HTC_BEACON; - tx_ctl->epid = priv->beacon_ep; - - beacon_hdr.vif_index = avp->index; - tx_fhdr = skb_push(beacon, sizeof(beacon_hdr)); - memcpy(tx_fhdr, (u8 *) &beacon_hdr, sizeof(beacon_hdr)); - - ret = htc_send(priv->htc, beacon); - if (ret != 0) { - if (ret == -ENOMEM) { - ath_dbg(common, BSTUCK, - "Failed to send beacon, no free TX buffer\n"); - } - dev_kfree_skb_any(beacon); - } - - spin_unlock_bh(&priv->beacon_lock); -} - -static int ath9k_htc_choose_bslot(struct ath9k_htc_priv *priv, - struct wmi_event_swba *swba) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - u64 tsf; - u32 tsftu; - u16 intval; - int slot; - - intval = priv->cur_beacon_conf.beacon_interval; - - tsf = be64_to_cpu(swba->tsf); - tsftu = TSF_TO_TU(tsf >> 32, tsf); - slot = ((tsftu % intval) * ATH9K_HTC_MAX_BCN_VIF) / intval; - slot = ATH9K_HTC_MAX_BCN_VIF - slot - 1; - - ath_dbg(common, BEACON, - "Choose slot: %d, tsf: %llu, tsftu: %u, intval: %u\n", - slot, tsf, tsftu, intval); - - return slot; -} - -void ath9k_htc_swba(struct ath9k_htc_priv *priv, - struct wmi_event_swba *swba) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - int slot; - - if (swba->beacon_pending != 0) { - priv->cur_beacon_conf.bmiss_cnt++; - if (priv->cur_beacon_conf.bmiss_cnt > BSTUCK_THRESHOLD) { - ath_dbg(common, BSTUCK, "Beacon stuck, HW reset\n"); - ieee80211_queue_work(priv->hw, - &priv->fatal_work); - } - return; - } - - if (priv->cur_beacon_conf.bmiss_cnt) { - ath_dbg(common, BSTUCK, - "Resuming beacon xmit after %u misses\n", - priv->cur_beacon_conf.bmiss_cnt); - priv->cur_beacon_conf.bmiss_cnt = 0; - } - - slot = ath9k_htc_choose_bslot(priv, swba); - spin_lock_bh(&priv->beacon_lock); - if (priv->cur_beacon_conf.bslot[slot] == NULL) { - spin_unlock_bh(&priv->beacon_lock); - return; - } - spin_unlock_bh(&priv->beacon_lock); - - ath9k_htc_send_buffered(priv, slot); - ath9k_htc_send_beacon(priv, slot); -} - -void ath9k_htc_assign_bslot(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *)vif->drv_priv; - int i = 0; - - spin_lock_bh(&priv->beacon_lock); - for (i = 0; i < ATH9K_HTC_MAX_BCN_VIF; i++) { - if (priv->cur_beacon_conf.bslot[i] == NULL) { - avp->bslot = i; - break; - } - } - - priv->cur_beacon_conf.bslot[avp->bslot] = vif; - spin_unlock_bh(&priv->beacon_lock); - - ath_dbg(common, CONFIG, "Added interface at beacon slot: %d\n", - avp->bslot); -} - -void ath9k_htc_remove_bslot(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *)vif->drv_priv; - - spin_lock_bh(&priv->beacon_lock); - priv->cur_beacon_conf.bslot[avp->bslot] = NULL; - spin_unlock_bh(&priv->beacon_lock); - - ath_dbg(common, CONFIG, "Removed interface at beacon slot: %d\n", - avp->bslot); -} - -/* - * Calculate the TSF adjustment value for all slots - * other than zero. - */ -void ath9k_htc_set_tsfadjust(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *)vif->drv_priv; - struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf; - u64 tsfadjust; - - if (avp->bslot == 0) - return; - - /* - * The beacon interval cannot be different for multi-AP mode, - * and we reach here only for VIF slots greater than zero, - * so beacon_interval is guaranteed to be set in cur_conf. - */ - tsfadjust = cur_conf->beacon_interval * avp->bslot / ATH9K_HTC_MAX_BCN_VIF; - avp->tsfadjust = cpu_to_le64(TU_TO_USEC(tsfadjust)); - - ath_dbg(common, CONFIG, "tsfadjust is: %llu for bslot: %d\n", - (unsigned long long)tsfadjust, avp->bslot); -} - -static void ath9k_htc_beacon_iter(void *data, u8 *mac, struct ieee80211_vif *vif) -{ - bool *beacon_configured = (bool *)data; - struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *) vif->drv_priv; - - if (vif->type == NL80211_IFTYPE_STATION && - avp->beacon_configured) - *beacon_configured = true; -} - -static bool ath9k_htc_check_beacon_config(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf; - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; - bool beacon_configured; - - /* - * Changing the beacon interval when multiple AP interfaces - * are configured will affect beacon transmission of all - * of them. - */ - if ((priv->ah->opmode == NL80211_IFTYPE_AP) && - (priv->num_ap_vif > 1) && - (vif->type == NL80211_IFTYPE_AP) && - (cur_conf->beacon_interval != bss_conf->beacon_int)) { - ath_dbg(common, CONFIG, - "Changing beacon interval of multiple AP interfaces !\n"); - return false; - } - - /* - * If the HW is operating in AP mode, any new station interfaces that - * are added cannot change the beacon parameters. - */ - if (priv->num_ap_vif && - (vif->type != NL80211_IFTYPE_AP)) { - ath_dbg(common, CONFIG, - "HW in AP mode, cannot set STA beacon parameters\n"); - return false; - } - - /* - * The beacon parameters are configured only for the first - * station interface. - */ - if ((priv->ah->opmode == NL80211_IFTYPE_STATION) && - (priv->num_sta_vif > 1) && - (vif->type == NL80211_IFTYPE_STATION)) { - beacon_configured = false; - ieee80211_iterate_active_interfaces_atomic( - priv->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - ath9k_htc_beacon_iter, &beacon_configured); - - if (beacon_configured) { - ath_dbg(common, CONFIG, - "Beacon already configured for a station interface\n"); - return false; - } - } - - return true; -} - -void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf; - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; - struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *) vif->drv_priv; - - if (!ath9k_htc_check_beacon_config(priv, vif)) - return; - - cur_conf->beacon_interval = bss_conf->beacon_int; - if (cur_conf->beacon_interval == 0) - cur_conf->beacon_interval = 100; - - cur_conf->dtim_period = bss_conf->dtim_period; - cur_conf->bmiss_timeout = - ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval; - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - ath9k_htc_beacon_config_sta(priv, cur_conf); - avp->beacon_configured = true; - break; - case NL80211_IFTYPE_ADHOC: - ath9k_htc_beacon_config_adhoc(priv, cur_conf); - break; - case NL80211_IFTYPE_AP: - ath9k_htc_beacon_config_ap(priv, cur_conf); - break; - default: - ath_dbg(common, CONFIG, "Unsupported beaconing mode\n"); - return; - } -} - -void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv *priv) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf; - - switch (priv->ah->opmode) { - case NL80211_IFTYPE_STATION: - ath9k_htc_beacon_config_sta(priv, cur_conf); - break; - case NL80211_IFTYPE_ADHOC: - ath9k_htc_beacon_config_adhoc(priv, cur_conf); - break; - case NL80211_IFTYPE_AP: - ath9k_htc_beacon_config_ap(priv, cur_conf); - break; - default: - ath_dbg(common, CONFIG, "Unsupported beaconing mode\n"); - return; - } -} diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c deleted file mode 100644 index 87110de577ef..000000000000 --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ /dev/null @@ -1,951 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "htc.h" - -static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath9k_htc_priv *priv = file->private_data; - struct ath9k_htc_target_int_stats cmd_rsp; - char buf[512]; - unsigned int len = 0; - int ret = 0; - - memset(&cmd_rsp, 0, sizeof(cmd_rsp)); - - ath9k_htc_ps_wakeup(priv); - - WMI_CMD(WMI_INT_STATS_CMDID); - if (ret) { - ath9k_htc_ps_restore(priv); - return -EINVAL; - } - - ath9k_htc_ps_restore(priv); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "RX", - be32_to_cpu(cmd_rsp.rx)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "RXORN", - be32_to_cpu(cmd_rsp.rxorn)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "RXEOL", - be32_to_cpu(cmd_rsp.rxeol)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "TXURN", - be32_to_cpu(cmd_rsp.txurn)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "TXTO", - be32_to_cpu(cmd_rsp.txto)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "CST", - be32_to_cpu(cmd_rsp.cst)); - - if (len > sizeof(buf)) - len = sizeof(buf); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static const struct file_operations fops_tgt_int_stats = { - .read = read_file_tgt_int_stats, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_tgt_tx_stats(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath9k_htc_priv *priv = file->private_data; - struct ath9k_htc_target_tx_stats cmd_rsp; - char buf[512]; - unsigned int len = 0; - int ret = 0; - - memset(&cmd_rsp, 0, sizeof(cmd_rsp)); - - ath9k_htc_ps_wakeup(priv); - - WMI_CMD(WMI_TX_STATS_CMDID); - if (ret) { - ath9k_htc_ps_restore(priv); - return -EINVAL; - } - - ath9k_htc_ps_restore(priv); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "Xretries", - be32_to_cpu(cmd_rsp.xretries)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "FifoErr", - be32_to_cpu(cmd_rsp.fifoerr)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "Filtered", - be32_to_cpu(cmd_rsp.filtered)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "TimerExp", - be32_to_cpu(cmd_rsp.timer_exp)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "ShortRetries", - be32_to_cpu(cmd_rsp.shortretries)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "LongRetries", - be32_to_cpu(cmd_rsp.longretries)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "QueueNull", - be32_to_cpu(cmd_rsp.qnull)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "EncapFail", - be32_to_cpu(cmd_rsp.encap_fail)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "NoBuf", - be32_to_cpu(cmd_rsp.nobuf)); - - if (len > sizeof(buf)) - len = sizeof(buf); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static const struct file_operations fops_tgt_tx_stats = { - .read = read_file_tgt_tx_stats, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_tgt_rx_stats(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath9k_htc_priv *priv = file->private_data; - struct ath9k_htc_target_rx_stats cmd_rsp; - char buf[512]; - unsigned int len = 0; - int ret = 0; - - memset(&cmd_rsp, 0, sizeof(cmd_rsp)); - - ath9k_htc_ps_wakeup(priv); - - WMI_CMD(WMI_RX_STATS_CMDID); - if (ret) { - ath9k_htc_ps_restore(priv); - return -EINVAL; - } - - ath9k_htc_ps_restore(priv); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "NoBuf", - be32_to_cpu(cmd_rsp.nobuf)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "HostSend", - be32_to_cpu(cmd_rsp.host_send)); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "HostDone", - be32_to_cpu(cmd_rsp.host_done)); - - if (len > sizeof(buf)) - len = sizeof(buf); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static const struct file_operations fops_tgt_rx_stats = { - .read = read_file_tgt_rx_stats, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_xmit(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath9k_htc_priv *priv = file->private_data; - char buf[512]; - unsigned int len = 0; - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "Buffers queued", - priv->debug.tx_stats.buf_queued); - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "Buffers completed", - priv->debug.tx_stats.buf_completed); - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "SKBs queued", - priv->debug.tx_stats.skb_queued); - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "SKBs success", - priv->debug.tx_stats.skb_success); - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "SKBs failed", - priv->debug.tx_stats.skb_failed); - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "CAB queued", - priv->debug.tx_stats.cab_queued); - - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "BE queued", - priv->debug.tx_stats.queue_stats[IEEE80211_AC_BE]); - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "BK queued", - priv->debug.tx_stats.queue_stats[IEEE80211_AC_BK]); - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "VI queued", - priv->debug.tx_stats.queue_stats[IEEE80211_AC_VI]); - len += snprintf(buf + len, sizeof(buf) - len, - "%20s : %10u\n", "VO queued", - priv->debug.tx_stats.queue_stats[IEEE80211_AC_VO]); - - if (len > sizeof(buf)) - len = sizeof(buf); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static const struct file_operations fops_xmit = { - .read = read_file_xmit, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv, - struct ath_htc_rx_status *rxs) -{ -#define RX_PHY_ERR_INC(c) priv->debug.rx_stats.err_phy_stats[c]++ - - if (rxs->rs_status & ATH9K_RXERR_CRC) - priv->debug.rx_stats.err_crc++; - if (rxs->rs_status & ATH9K_RXERR_DECRYPT) - priv->debug.rx_stats.err_decrypt_crc++; - if (rxs->rs_status & ATH9K_RXERR_MIC) - priv->debug.rx_stats.err_mic++; - if (rxs->rs_status & ATH9K_RX_DELIM_CRC_PRE) - priv->debug.rx_stats.err_pre_delim++; - if (rxs->rs_status & ATH9K_RX_DELIM_CRC_POST) - priv->debug.rx_stats.err_post_delim++; - if (rxs->rs_status & ATH9K_RX_DECRYPT_BUSY) - priv->debug.rx_stats.err_decrypt_busy++; - - if (rxs->rs_status & ATH9K_RXERR_PHY) { - priv->debug.rx_stats.err_phy++; - if (rxs->rs_phyerr < ATH9K_PHYERR_MAX) - RX_PHY_ERR_INC(rxs->rs_phyerr); - } - -#undef RX_PHY_ERR_INC -} - -static ssize_t read_file_recv(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ -#define PHY_ERR(s, p) \ - len += snprintf(buf + len, size - len, "%20s : %10u\n", s, \ - priv->debug.rx_stats.err_phy_stats[p]); - - struct ath9k_htc_priv *priv = file->private_data; - char *buf; - unsigned int len = 0, size = 1500; - ssize_t retval = 0; - - buf = kzalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - len += snprintf(buf + len, size - len, - "%20s : %10u\n", "SKBs allocated", - priv->debug.rx_stats.skb_allocated); - len += snprintf(buf + len, size - len, - "%20s : %10u\n", "SKBs completed", - priv->debug.rx_stats.skb_completed); - len += snprintf(buf + len, size - len, - "%20s : %10u\n", "SKBs Dropped", - priv->debug.rx_stats.skb_dropped); - - len += snprintf(buf + len, size - len, - "%20s : %10u\n", "CRC ERR", - priv->debug.rx_stats.err_crc); - len += snprintf(buf + len, size - len, - "%20s : %10u\n", "DECRYPT CRC ERR", - priv->debug.rx_stats.err_decrypt_crc); - len += snprintf(buf + len, size - len, - "%20s : %10u\n", "MIC ERR", - priv->debug.rx_stats.err_mic); - len += snprintf(buf + len, size - len, - "%20s : %10u\n", "PRE-DELIM CRC ERR", - priv->debug.rx_stats.err_pre_delim); - len += snprintf(buf + len, size - len, - "%20s : %10u\n", "POST-DELIM CRC ERR", - priv->debug.rx_stats.err_post_delim); - len += snprintf(buf + len, size - len, - "%20s : %10u\n", "DECRYPT BUSY ERR", - priv->debug.rx_stats.err_decrypt_busy); - len += snprintf(buf + len, size - len, - "%20s : %10u\n", "TOTAL PHY ERR", - priv->debug.rx_stats.err_phy); - - - PHY_ERR("UNDERRUN", ATH9K_PHYERR_UNDERRUN); - PHY_ERR("TIMING", ATH9K_PHYERR_TIMING); - PHY_ERR("PARITY", ATH9K_PHYERR_PARITY); - PHY_ERR("RATE", ATH9K_PHYERR_RATE); - PHY_ERR("LENGTH", ATH9K_PHYERR_LENGTH); - PHY_ERR("RADAR", ATH9K_PHYERR_RADAR); - PHY_ERR("SERVICE", ATH9K_PHYERR_SERVICE); - PHY_ERR("TOR", ATH9K_PHYERR_TOR); - PHY_ERR("OFDM-TIMING", ATH9K_PHYERR_OFDM_TIMING); - PHY_ERR("OFDM-SIGNAL-PARITY", ATH9K_PHYERR_OFDM_SIGNAL_PARITY); - PHY_ERR("OFDM-RATE", ATH9K_PHYERR_OFDM_RATE_ILLEGAL); - PHY_ERR("OFDM-LENGTH", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL); - PHY_ERR("OFDM-POWER-DROP", ATH9K_PHYERR_OFDM_POWER_DROP); - PHY_ERR("OFDM-SERVICE", ATH9K_PHYERR_OFDM_SERVICE); - PHY_ERR("OFDM-RESTART", ATH9K_PHYERR_OFDM_RESTART); - PHY_ERR("FALSE-RADAR-EXT", ATH9K_PHYERR_FALSE_RADAR_EXT); - PHY_ERR("CCK-TIMING", ATH9K_PHYERR_CCK_TIMING); - PHY_ERR("CCK-HEADER-CRC", ATH9K_PHYERR_CCK_HEADER_CRC); - PHY_ERR("CCK-RATE", ATH9K_PHYERR_CCK_RATE_ILLEGAL); - PHY_ERR("CCK-SERVICE", ATH9K_PHYERR_CCK_SERVICE); - PHY_ERR("CCK-RESTART", ATH9K_PHYERR_CCK_RESTART); - PHY_ERR("CCK-LENGTH", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL); - PHY_ERR("CCK-POWER-DROP", ATH9K_PHYERR_CCK_POWER_DROP); - PHY_ERR("HT-CRC", ATH9K_PHYERR_HT_CRC_ERROR); - PHY_ERR("HT-LENGTH", ATH9K_PHYERR_HT_LENGTH_ILLEGAL); - PHY_ERR("HT-RATE", ATH9K_PHYERR_HT_RATE_ILLEGAL); - - if (len > size) - len = size; - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return retval; - -#undef PHY_ERR -} - -static const struct file_operations fops_recv = { - .read = read_file_recv, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_slot(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath9k_htc_priv *priv = file->private_data; - char buf[512]; - unsigned int len = 0; - - spin_lock_bh(&priv->tx.tx_lock); - - len += snprintf(buf + len, sizeof(buf) - len, "TX slot bitmap : "); - - len += bitmap_scnprintf(buf + len, sizeof(buf) - len, - priv->tx.tx_slot, MAX_TX_BUF_NUM); - - len += snprintf(buf + len, sizeof(buf) - len, "\n"); - - len += snprintf(buf + len, sizeof(buf) - len, - "Used slots : %d\n", - bitmap_weight(priv->tx.tx_slot, MAX_TX_BUF_NUM)); - - spin_unlock_bh(&priv->tx.tx_lock); - - if (len > sizeof(buf)) - len = sizeof(buf); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static const struct file_operations fops_slot = { - .read = read_file_slot, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_queue(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath9k_htc_priv *priv = file->private_data; - char buf[512]; - unsigned int len = 0; - - len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n", - "Mgmt endpoint", skb_queue_len(&priv->tx.mgmt_ep_queue)); - - len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n", - "Cab endpoint", skb_queue_len(&priv->tx.cab_ep_queue)); - - len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n", - "Data BE endpoint", skb_queue_len(&priv->tx.data_be_queue)); - - len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n", - "Data BK endpoint", skb_queue_len(&priv->tx.data_bk_queue)); - - len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n", - "Data VI endpoint", skb_queue_len(&priv->tx.data_vi_queue)); - - len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n", - "Data VO endpoint", skb_queue_len(&priv->tx.data_vo_queue)); - - len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n", - "Failed queue", skb_queue_len(&priv->tx.tx_failed)); - - spin_lock_bh(&priv->tx.tx_lock); - len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n", - "Queued count", priv->tx.queued_cnt); - spin_unlock_bh(&priv->tx.tx_lock); - - if (len > sizeof(buf)) - len = sizeof(buf); - - return simple_read_from_buffer(user_buf, count, ppos, buf, len); - -} - -static const struct file_operations fops_queue = { - .read = read_file_queue, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_debug(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath9k_htc_priv *priv = file->private_data; - struct ath_common *common = ath9k_hw_common(priv->ah); - char buf[32]; - unsigned int len; - - len = sprintf(buf, "0x%08x\n", common->debug_mask); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t write_file_debug(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath9k_htc_priv *priv = file->private_data; - struct ath_common *common = ath9k_hw_common(priv->ah); - unsigned long mask; - char buf[32]; - ssize_t len; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - - buf[len] = '\0'; - if (strict_strtoul(buf, 0, &mask)) - return -EINVAL; - - common->debug_mask = mask; - return count; -} - -static const struct file_operations fops_debug = { - .read = read_file_debug, - .write = write_file_debug, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath9k_htc_priv *priv = file->private_data; - struct ath_common *common = ath9k_hw_common(priv->ah); - struct base_eep_header *pBase = NULL; - unsigned int len = 0, size = 1500; - ssize_t retval = 0; - char *buf; - - /* - * This can be done since all the 3 EEPROM families have the - * same base header upto a certain point, and we are interested in - * the data only upto that point. - */ - - if (AR_SREV_9271(priv->ah)) - pBase = (struct base_eep_header *) - &priv->ah->eeprom.map4k.baseEepHeader; - else if (priv->ah->hw_version.usbdev == AR9280_USB) - pBase = (struct base_eep_header *) - &priv->ah->eeprom.def.baseEepHeader; - else if (priv->ah->hw_version.usbdev == AR9287_USB) - pBase = (struct base_eep_header *) - &priv->ah->eeprom.map9287.baseEepHeader; - - if (pBase == NULL) { - ath_err(common, "Unknown EEPROM type\n"); - return 0; - } - - buf = kzalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - len += snprintf(buf + len, size - len, - "%20s : %10d\n", "Major Version", - pBase->version >> 12); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", "Minor Version", - pBase->version & 0xFFF); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", "Checksum", - pBase->checksum); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", "Length", - pBase->length); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", "RegDomain1", - pBase->regDmn[0]); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", "RegDomain2", - pBase->regDmn[1]); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", - "TX Mask", pBase->txMask); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", - "RX Mask", pBase->rxMask); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", - "Allow 5GHz", - !!(pBase->opCapFlags & AR5416_OPFLAGS_11A)); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", - "Allow 2GHz", - !!(pBase->opCapFlags & AR5416_OPFLAGS_11G)); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", - "Disable 2GHz HT20", - !!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT20)); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", - "Disable 2GHz HT40", - !!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT40)); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", - "Disable 5Ghz HT20", - !!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT20)); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", - "Disable 5Ghz HT40", - !!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT40)); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", - "Big Endian", - !!(pBase->eepMisc & 0x01)); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", - "Cal Bin Major Ver", - (pBase->binBuildNumber >> 24) & 0xFF); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", - "Cal Bin Minor Ver", - (pBase->binBuildNumber >> 16) & 0xFF); - len += snprintf(buf + len, size - len, - "%20s : %10d\n", - "Cal Bin Build", - (pBase->binBuildNumber >> 8) & 0xFF); - - /* - * UB91 specific data. - */ - if (AR_SREV_9271(priv->ah)) { - struct base_eep_header_4k *pBase4k = - &priv->ah->eeprom.map4k.baseEepHeader; - - len += snprintf(buf + len, size - len, - "%20s : %10d\n", - "TX Gain type", - pBase4k->txGainType); - } - - /* - * UB95 specific data. - */ - if (priv->ah->hw_version.usbdev == AR9287_USB) { - struct base_eep_ar9287_header *pBase9287 = - &priv->ah->eeprom.map9287.baseEepHeader; - - len += snprintf(buf + len, size - len, - "%20s : %10ddB\n", - "Power Table Offset", - pBase9287->pwrTableOffset); - - len += snprintf(buf + len, size - len, - "%20s : %10d\n", - "OpenLoop Power Ctrl", - pBase9287->openLoopPwrCntl); - } - - len += snprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress", - pBase->macAddr); - if (len > size) - len = size; - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return retval; -} - -static const struct file_operations fops_base_eeprom = { - .read = read_file_base_eeprom, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -static ssize_t read_4k_modal_eeprom(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ -#define PR_EEP(_s, _val) \ - do { \ - len += snprintf(buf + len, size - len, "%20s : %10d\n", \ - _s, (_val)); \ - } while (0) - - struct ath9k_htc_priv *priv = file->private_data; - struct modal_eep_4k_header *pModal = &priv->ah->eeprom.map4k.modalHeader; - unsigned int len = 0, size = 2048; - ssize_t retval = 0; - char *buf; - - buf = kzalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); - PR_EEP("Ant. Common Control", pModal->antCtrlCommon); - PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); - PR_EEP("Switch Settle", pModal->switchSettling); - PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); - PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); - PR_EEP("ADC Desired size", pModal->adcDesiredSize); - PR_EEP("PGA Desired size", pModal->pgaDesiredSize); - PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]); - PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); - PR_EEP("txEndToRxOn", pModal->txEndToRxOn); - PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); - PR_EEP("CCA Threshold)", pModal->thresh62); - PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); - PR_EEP("xpdGain", pModal->xpdGain); - PR_EEP("External PD", pModal->xpd); - PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); - PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); - PR_EEP("pdGainOverlap", pModal->pdGainOverlap); - PR_EEP("O/D Bias Version", pModal->version); - PR_EEP("CCK OutputBias", pModal->ob_0); - PR_EEP("BPSK OutputBias", pModal->ob_1); - PR_EEP("QPSK OutputBias", pModal->ob_2); - PR_EEP("16QAM OutputBias", pModal->ob_3); - PR_EEP("64QAM OutputBias", pModal->ob_4); - PR_EEP("CCK Driver1_Bias", pModal->db1_0); - PR_EEP("BPSK Driver1_Bias", pModal->db1_1); - PR_EEP("QPSK Driver1_Bias", pModal->db1_2); - PR_EEP("16QAM Driver1_Bias", pModal->db1_3); - PR_EEP("64QAM Driver1_Bias", pModal->db1_4); - PR_EEP("CCK Driver2_Bias", pModal->db2_0); - PR_EEP("BPSK Driver2_Bias", pModal->db2_1); - PR_EEP("QPSK Driver2_Bias", pModal->db2_2); - PR_EEP("16QAM Driver2_Bias", pModal->db2_3); - PR_EEP("64QAM Driver2_Bias", pModal->db2_4); - PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); - PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); - PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); - PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); - PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); - PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); - PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); - PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]); - PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]); - PR_EEP("Ant. Diversity ctl1", pModal->antdiv_ctl1); - PR_EEP("Ant. Diversity ctl2", pModal->antdiv_ctl2); - PR_EEP("TX Diversity", pModal->tx_diversity); - - if (len > size) - len = size; - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return retval; - -#undef PR_EEP -} - -static ssize_t read_def_modal_eeprom(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ -#define PR_EEP(_s, _val) \ - do { \ - if (pBase->opCapFlags & AR5416_OPFLAGS_11G) { \ - pModal = &priv->ah->eeprom.def.modalHeader[1]; \ - len += snprintf(buf + len, size - len, "%20s : %8d%7s", \ - _s, (_val), "|"); \ - } \ - if (pBase->opCapFlags & AR5416_OPFLAGS_11A) { \ - pModal = &priv->ah->eeprom.def.modalHeader[0]; \ - len += snprintf(buf + len, size - len, "%9d\n", \ - (_val)); \ - } \ - } while (0) - - struct ath9k_htc_priv *priv = file->private_data; - struct base_eep_header *pBase = &priv->ah->eeprom.def.baseEepHeader; - struct modal_eep_header *pModal = NULL; - unsigned int len = 0, size = 3500; - ssize_t retval = 0; - char *buf; - - buf = kzalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - len += snprintf(buf + len, size - len, - "%31s %15s\n", "2G", "5G"); - len += snprintf(buf + len, size - len, - "%32s %16s\n", "====", "====\n"); - - PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); - PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]); - PR_EEP("Chain2 Ant. Control", pModal->antCtrlChain[2]); - PR_EEP("Ant. Common Control", pModal->antCtrlCommon); - PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); - PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]); - PR_EEP("Chain2 Ant. Gain", pModal->antennaGainCh[2]); - PR_EEP("Switch Settle", pModal->switchSettling); - PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); - PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]); - PR_EEP("Chain2 TxRxAtten", pModal->txRxAttenCh[2]); - PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); - PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]); - PR_EEP("Chain2 RxTxMargin", pModal->rxTxMarginCh[2]); - PR_EEP("ADC Desired size", pModal->adcDesiredSize); - PR_EEP("PGA Desired size", pModal->pgaDesiredSize); - PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]); - PR_EEP("Chain1 xlna Gain", pModal->xlnaGainCh[1]); - PR_EEP("Chain2 xlna Gain", pModal->xlnaGainCh[2]); - PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); - PR_EEP("txEndToRxOn", pModal->txEndToRxOn); - PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); - PR_EEP("CCA Threshold)", pModal->thresh62); - PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); - PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]); - PR_EEP("Chain2 NF Threshold", pModal->noiseFloorThreshCh[2]); - PR_EEP("xpdGain", pModal->xpdGain); - PR_EEP("External PD", pModal->xpd); - PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); - PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]); - PR_EEP("Chain2 I Coefficient", pModal->iqCalICh[2]); - PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); - PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]); - PR_EEP("Chain2 Q Coefficient", pModal->iqCalQCh[2]); - PR_EEP("pdGainOverlap", pModal->pdGainOverlap); - PR_EEP("Chain0 OutputBias", pModal->ob); - PR_EEP("Chain0 DriverBias", pModal->db); - PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); - PR_EEP("2chain pwr decrease", pModal->pwrDecreaseFor2Chain); - PR_EEP("3chain pwr decrease", pModal->pwrDecreaseFor3Chain); - PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); - PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); - PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); - PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); - PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]); - PR_EEP("Chain2 bswAtten", pModal->bswAtten[2]); - PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); - PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]); - PR_EEP("Chain2 bswMargin", pModal->bswMargin[2]); - PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); - PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]); - PR_EEP("Chain1 xatten2Db", pModal->xatten2Db[1]); - PR_EEP("Chain2 xatten2Db", pModal->xatten2Db[2]); - PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]); - PR_EEP("Chain1 xatten2Margin", pModal->xatten2Margin[1]); - PR_EEP("Chain2 xatten2Margin", pModal->xatten2Margin[2]); - PR_EEP("Chain1 OutputBias", pModal->ob_ch1); - PR_EEP("Chain1 DriverBias", pModal->db_ch1); - PR_EEP("LNA Control", pModal->lna_ctl); - PR_EEP("XPA Bias Freq0", pModal->xpaBiasLvlFreq[0]); - PR_EEP("XPA Bias Freq1", pModal->xpaBiasLvlFreq[1]); - PR_EEP("XPA Bias Freq2", pModal->xpaBiasLvlFreq[2]); - - if (len > size) - len = size; - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return retval; - -#undef PR_EEP -} - -static ssize_t read_9287_modal_eeprom(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ -#define PR_EEP(_s, _val) \ - do { \ - len += snprintf(buf + len, size - len, "%20s : %10d\n", \ - _s, (_val)); \ - } while (0) - - struct ath9k_htc_priv *priv = file->private_data; - struct modal_eep_ar9287_header *pModal = &priv->ah->eeprom.map9287.modalHeader; - unsigned int len = 0, size = 3000; - ssize_t retval = 0; - char *buf; - - buf = kzalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]); - PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]); - PR_EEP("Ant. Common Control", pModal->antCtrlCommon); - PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]); - PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]); - PR_EEP("Switch Settle", pModal->switchSettling); - PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]); - PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]); - PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]); - PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]); - PR_EEP("ADC Desired size", pModal->adcDesiredSize); - PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff); - PR_EEP("txEndToRxOn", pModal->txEndToRxOn); - PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn); - PR_EEP("CCA Threshold)", pModal->thresh62); - PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]); - PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]); - PR_EEP("xpdGain", pModal->xpdGain); - PR_EEP("External PD", pModal->xpd); - PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]); - PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]); - PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]); - PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]); - PR_EEP("pdGainOverlap", pModal->pdGainOverlap); - PR_EEP("xPA Bias Level", pModal->xpaBiasLvl); - PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart); - PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn); - PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc); - PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]); - PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]); - PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]); - PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]); - PR_EEP("HT40 Switch Settle", pModal->swSettleHt40); - PR_EEP("AR92x7 Version", pModal->version); - PR_EEP("DriverBias1", pModal->db1); - PR_EEP("DriverBias2", pModal->db1); - PR_EEP("CCK OutputBias", pModal->ob_cck); - PR_EEP("PSK OutputBias", pModal->ob_psk); - PR_EEP("QAM OutputBias", pModal->ob_qam); - PR_EEP("PAL_OFF OutputBias", pModal->ob_pal_off); - - if (len > size) - len = size; - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - - return retval; - -#undef PR_EEP -} - -static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath9k_htc_priv *priv = file->private_data; - - if (AR_SREV_9271(priv->ah)) - return read_4k_modal_eeprom(file, user_buf, count, ppos); - else if (priv->ah->hw_version.usbdev == AR9280_USB) - return read_def_modal_eeprom(file, user_buf, count, ppos); - else if (priv->ah->hw_version.usbdev == AR9287_USB) - return read_9287_modal_eeprom(file, user_buf, count, ppos); - - return 0; -} - -static const struct file_operations fops_modal_eeprom = { - .read = read_file_modal_eeprom, - .open = simple_open, - .owner = THIS_MODULE, - .llseek = default_llseek, -}; - -int ath9k_htc_init_debug(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; - - priv->debug.debugfs_phy = debugfs_create_dir(KBUILD_MODNAME, - priv->hw->wiphy->debugfsdir); - if (!priv->debug.debugfs_phy) - return -ENOMEM; - - debugfs_create_file("tgt_int_stats", S_IRUSR, priv->debug.debugfs_phy, - priv, &fops_tgt_int_stats); - debugfs_create_file("tgt_tx_stats", S_IRUSR, priv->debug.debugfs_phy, - priv, &fops_tgt_tx_stats); - debugfs_create_file("tgt_rx_stats", S_IRUSR, priv->debug.debugfs_phy, - priv, &fops_tgt_rx_stats); - debugfs_create_file("xmit", S_IRUSR, priv->debug.debugfs_phy, - priv, &fops_xmit); - debugfs_create_file("recv", S_IRUSR, priv->debug.debugfs_phy, - priv, &fops_recv); - debugfs_create_file("slot", S_IRUSR, priv->debug.debugfs_phy, - priv, &fops_slot); - debugfs_create_file("queue", S_IRUSR, priv->debug.debugfs_phy, - priv, &fops_queue); - debugfs_create_file("debug", S_IRUSR | S_IWUSR, priv->debug.debugfs_phy, - priv, &fops_debug); - debugfs_create_file("base_eeprom", S_IRUSR, priv->debug.debugfs_phy, - priv, &fops_base_eeprom); - debugfs_create_file("modal_eeprom", S_IRUSR, priv->debug.debugfs_phy, - priv, &fops_modal_eeprom); - - return 0; -} diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c deleted file mode 100644 index 105582d6b714..000000000000 --- a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "htc.h" - -/******************/ -/* BTCOEX */ -/******************/ - -#define ATH_HTC_BTCOEX_PRODUCT_ID "wb193" - -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT - -/* - * Detects if there is any priority bt traffic - */ -static void ath_detect_bt_priority(struct ath9k_htc_priv *priv) -{ - struct ath_btcoex *btcoex = &priv->btcoex; - struct ath_hw *ah = priv->ah; - - if (ath9k_hw_gpio_get(ah, ah->btcoex_hw.btpriority_gpio)) - btcoex->bt_priority_cnt++; - - if (time_after(jiffies, btcoex->bt_priority_time + - msecs_to_jiffies(ATH_BT_PRIORITY_TIME_THRESHOLD))) { - clear_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags); - clear_bit(OP_BT_SCAN, &priv->op_flags); - /* Detect if colocated bt started scanning */ - if (btcoex->bt_priority_cnt >= ATH_BT_CNT_SCAN_THRESHOLD) { - ath_dbg(ath9k_hw_common(ah), BTCOEX, - "BT scan detected\n"); - set_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags); - set_bit(OP_BT_SCAN, &priv->op_flags); - } else if (btcoex->bt_priority_cnt >= ATH_BT_CNT_THRESHOLD) { - ath_dbg(ath9k_hw_common(ah), BTCOEX, - "BT priority traffic detected\n"); - set_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags); - } - - btcoex->bt_priority_cnt = 0; - btcoex->bt_priority_time = jiffies; - } -} - -/* - * This is the master bt coex work which runs for every - * 45ms, bt traffic will be given priority during 55% of this - * period while wlan gets remaining 45% - */ -static void ath_btcoex_period_work(struct work_struct *work) -{ - struct ath9k_htc_priv *priv = container_of(work, struct ath9k_htc_priv, - coex_period_work.work); - struct ath_btcoex *btcoex = &priv->btcoex; - struct ath_common *common = ath9k_hw_common(priv->ah); - u32 timer_period; - int ret; - - ath_detect_bt_priority(priv); - - ret = ath9k_htc_update_cap_target(priv, - test_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags)); - if (ret) { - ath_err(common, "Unable to set BTCOEX parameters\n"); - return; - } - - ath9k_hw_btcoex_bt_stomp(priv->ah, test_bit(OP_BT_SCAN, &priv->op_flags) ? - ATH_BTCOEX_STOMP_ALL : btcoex->bt_stomp_type); - - ath9k_hw_btcoex_enable(priv->ah); - timer_period = test_bit(OP_BT_SCAN, &priv->op_flags) ? - btcoex->btscan_no_stomp : btcoex->btcoex_no_stomp; - ieee80211_queue_delayed_work(priv->hw, &priv->duty_cycle_work, - msecs_to_jiffies(timer_period)); - ieee80211_queue_delayed_work(priv->hw, &priv->coex_period_work, - msecs_to_jiffies(btcoex->btcoex_period)); -} - -/* - * Work to time slice between wlan and bt traffic and - * configure weight registers - */ -static void ath_btcoex_duty_cycle_work(struct work_struct *work) -{ - struct ath9k_htc_priv *priv = container_of(work, struct ath9k_htc_priv, - duty_cycle_work.work); - struct ath_hw *ah = priv->ah; - struct ath_btcoex *btcoex = &priv->btcoex; - struct ath_common *common = ath9k_hw_common(ah); - - ath_dbg(common, BTCOEX, "time slice work for bt and wlan\n"); - - if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || - test_bit(OP_BT_SCAN, &priv->op_flags)) - ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_NONE); - else if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_ALL) - ath9k_hw_btcoex_bt_stomp(ah, ATH_BTCOEX_STOMP_LOW); - - ath9k_hw_btcoex_enable(priv->ah); -} - -static void ath_htc_init_btcoex_work(struct ath9k_htc_priv *priv) -{ - struct ath_btcoex *btcoex = &priv->btcoex; - - btcoex->btcoex_period = ATH_BTCOEX_DEF_BT_PERIOD; - btcoex->btcoex_no_stomp = (100 - ATH_BTCOEX_DEF_DUTY_CYCLE) * - btcoex->btcoex_period / 100; - btcoex->btscan_no_stomp = (100 - ATH_BTCOEX_BTSCAN_DUTY_CYCLE) * - btcoex->btcoex_period / 100; - INIT_DELAYED_WORK(&priv->coex_period_work, ath_btcoex_period_work); - INIT_DELAYED_WORK(&priv->duty_cycle_work, ath_btcoex_duty_cycle_work); -} - -/* - * (Re)start btcoex work - */ - -static void ath_htc_resume_btcoex_work(struct ath9k_htc_priv *priv) -{ - struct ath_btcoex *btcoex = &priv->btcoex; - struct ath_hw *ah = priv->ah; - - ath_dbg(ath9k_hw_common(ah), BTCOEX, "Starting btcoex work\n"); - - btcoex->bt_priority_cnt = 0; - btcoex->bt_priority_time = jiffies; - clear_bit(OP_BT_PRIORITY_DETECTED, &priv->op_flags); - clear_bit(OP_BT_SCAN, &priv->op_flags); - ieee80211_queue_delayed_work(priv->hw, &priv->coex_period_work, 0); -} - - -/* - * Cancel btcoex and bt duty cycle work. - */ -static void ath_htc_cancel_btcoex_work(struct ath9k_htc_priv *priv) -{ - cancel_delayed_work_sync(&priv->coex_period_work); - cancel_delayed_work_sync(&priv->duty_cycle_work); -} - -void ath9k_htc_start_btcoex(struct ath9k_htc_priv *priv) -{ - struct ath_hw *ah = priv->ah; - - if (ath9k_hw_get_btcoex_scheme(ah) == ATH_BTCOEX_CFG_3WIRE) { - ath9k_hw_btcoex_set_weight(ah, AR_BT_COEX_WGHT, - AR_STOMP_LOW_WLAN_WGHT, 0); - ath9k_hw_btcoex_enable(ah); - ath_htc_resume_btcoex_work(priv); - } -} - -void ath9k_htc_stop_btcoex(struct ath9k_htc_priv *priv) -{ - struct ath_hw *ah = priv->ah; - - if (ah->btcoex_hw.enabled && - ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) { - if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) - ath_htc_cancel_btcoex_work(priv); - ath9k_hw_btcoex_disable(ah); - } -} - -void ath9k_htc_init_btcoex(struct ath9k_htc_priv *priv, char *product) -{ - struct ath_hw *ah = priv->ah; - struct ath_common *common = ath9k_hw_common(ah); - int qnum; - - /* - * Check if BTCOEX is globally disabled. - */ - if (!common->btcoex_enabled) { - ah->btcoex_hw.scheme = ATH_BTCOEX_CFG_NONE; - return; - } - - if (product && strncmp(product, ATH_HTC_BTCOEX_PRODUCT_ID, 5) == 0) { - ah->btcoex_hw.scheme = ATH_BTCOEX_CFG_3WIRE; - } - - switch (ath9k_hw_get_btcoex_scheme(priv->ah)) { - case ATH_BTCOEX_CFG_NONE: - break; - case ATH_BTCOEX_CFG_3WIRE: - priv->ah->btcoex_hw.btactive_gpio = 7; - priv->ah->btcoex_hw.btpriority_gpio = 6; - priv->ah->btcoex_hw.wlanactive_gpio = 8; - priv->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW; - ath9k_hw_btcoex_init_3wire(priv->ah); - ath_htc_init_btcoex_work(priv); - qnum = priv->hwq_map[IEEE80211_AC_BE]; - ath9k_hw_init_btcoex_hw(priv->ah, qnum); - break; - default: - WARN_ON(1); - break; - } -} - -#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ - -/*******/ -/* LED */ -/*******/ - -#ifdef CONFIG_MAC80211_LEDS -void ath9k_led_work(struct work_struct *work) -{ - struct ath9k_htc_priv *priv = container_of(work, - struct ath9k_htc_priv, - led_work); - - ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, - (priv->brightness == LED_OFF)); -} - -static void ath9k_led_brightness(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct ath9k_htc_priv *priv = container_of(led_cdev, - struct ath9k_htc_priv, - led_cdev); - - /* Not locked, but it's just a tiny green light..*/ - priv->brightness = brightness; - ieee80211_queue_work(priv->hw, &priv->led_work); -} - -void ath9k_deinit_leds(struct ath9k_htc_priv *priv) -{ - if (!priv->led_registered) - return; - - ath9k_led_brightness(&priv->led_cdev, LED_OFF); - led_classdev_unregister(&priv->led_cdev); - cancel_work_sync(&priv->led_work); -} - -void ath9k_init_leds(struct ath9k_htc_priv *priv) -{ - int ret; - - if (AR_SREV_9287(priv->ah)) - priv->ah->led_pin = ATH_LED_PIN_9287; - else if (AR_SREV_9271(priv->ah)) - priv->ah->led_pin = ATH_LED_PIN_9271; - else if (AR_DEVID_7010(priv->ah)) - priv->ah->led_pin = ATH_LED_PIN_7010; - else - priv->ah->led_pin = ATH_LED_PIN_DEF; - - /* Configure gpio 1 for output */ - ath9k_hw_cfg_output(priv->ah, priv->ah->led_pin, - AR_GPIO_OUTPUT_MUX_AS_OUTPUT); - /* LED off, active low */ - ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, 1); - - snprintf(priv->led_name, sizeof(priv->led_name), - "ath9k_htc-%s", wiphy_name(priv->hw->wiphy)); - priv->led_cdev.name = priv->led_name; - priv->led_cdev.brightness_set = ath9k_led_brightness; - - ret = led_classdev_register(wiphy_dev(priv->hw->wiphy), &priv->led_cdev); - if (ret < 0) - return; - - INIT_WORK(&priv->led_work, ath9k_led_work); - priv->led_registered = true; - - return; -} -#endif - -/*******************/ -/* Rfkill */ -/*******************/ - -static bool ath_is_rfkill_set(struct ath9k_htc_priv *priv) -{ - bool is_blocked; - - ath9k_htc_ps_wakeup(priv); - is_blocked = ath9k_hw_gpio_get(priv->ah, priv->ah->rfkill_gpio) == - priv->ah->rfkill_polarity; - ath9k_htc_ps_restore(priv); - - return is_blocked; -} - -void ath9k_htc_rfkill_poll_state(struct ieee80211_hw *hw) -{ - struct ath9k_htc_priv *priv = hw->priv; - bool blocked = !!ath_is_rfkill_set(priv); - - wiphy_rfkill_set_hw_state(hw->wiphy, blocked); -} - -void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv) -{ - if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT) - wiphy_rfkill_start_polling(priv->hw->wiphy); -} diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c deleted file mode 100644 index 3b202ffb3257..000000000000 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ /dev/null @@ -1,1008 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include "htc.h" - -MODULE_AUTHOR("Atheros Communications"); -MODULE_LICENSE("Dual BSD/GPL"); -MODULE_DESCRIPTION("Atheros driver 802.11n HTC based wireless devices"); - -static unsigned int ath9k_debug = ATH_DBG_DEFAULT; -module_param_named(debug, ath9k_debug, uint, 0); -MODULE_PARM_DESC(debug, "Debugging mask"); - -int htc_modparam_nohwcrypt; -module_param_named(nohwcrypt, htc_modparam_nohwcrypt, int, 0444); -MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption"); - -static int ath9k_htc_btcoex_enable; -module_param_named(btcoex_enable, ath9k_htc_btcoex_enable, int, 0444); -MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence"); - -#define CHAN2G(_freq, _idx) { \ - .center_freq = (_freq), \ - .hw_value = (_idx), \ - .max_power = 20, \ -} - -#define CHAN5G(_freq, _idx) { \ - .band = IEEE80211_BAND_5GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_idx), \ - .max_power = 20, \ -} - -static struct ieee80211_channel ath9k_2ghz_channels[] = { - CHAN2G(2412, 0), /* Channel 1 */ - CHAN2G(2417, 1), /* Channel 2 */ - CHAN2G(2422, 2), /* Channel 3 */ - CHAN2G(2427, 3), /* Channel 4 */ - CHAN2G(2432, 4), /* Channel 5 */ - CHAN2G(2437, 5), /* Channel 6 */ - CHAN2G(2442, 6), /* Channel 7 */ - CHAN2G(2447, 7), /* Channel 8 */ - CHAN2G(2452, 8), /* Channel 9 */ - CHAN2G(2457, 9), /* Channel 10 */ - CHAN2G(2462, 10), /* Channel 11 */ - CHAN2G(2467, 11), /* Channel 12 */ - CHAN2G(2472, 12), /* Channel 13 */ - CHAN2G(2484, 13), /* Channel 14 */ -}; - -static struct ieee80211_channel ath9k_5ghz_channels[] = { - /* _We_ call this UNII 1 */ - CHAN5G(5180, 14), /* Channel 36 */ - CHAN5G(5200, 15), /* Channel 40 */ - CHAN5G(5220, 16), /* Channel 44 */ - CHAN5G(5240, 17), /* Channel 48 */ - /* _We_ call this UNII 2 */ - CHAN5G(5260, 18), /* Channel 52 */ - CHAN5G(5280, 19), /* Channel 56 */ - CHAN5G(5300, 20), /* Channel 60 */ - CHAN5G(5320, 21), /* Channel 64 */ - /* _We_ call this "Middle band" */ - CHAN5G(5500, 22), /* Channel 100 */ - CHAN5G(5520, 23), /* Channel 104 */ - CHAN5G(5540, 24), /* Channel 108 */ - CHAN5G(5560, 25), /* Channel 112 */ - CHAN5G(5580, 26), /* Channel 116 */ - CHAN5G(5600, 27), /* Channel 120 */ - CHAN5G(5620, 28), /* Channel 124 */ - CHAN5G(5640, 29), /* Channel 128 */ - CHAN5G(5660, 30), /* Channel 132 */ - CHAN5G(5680, 31), /* Channel 136 */ - CHAN5G(5700, 32), /* Channel 140 */ - /* _We_ call this UNII 3 */ - CHAN5G(5745, 33), /* Channel 149 */ - CHAN5G(5765, 34), /* Channel 153 */ - CHAN5G(5785, 35), /* Channel 157 */ - CHAN5G(5805, 36), /* Channel 161 */ - CHAN5G(5825, 37), /* Channel 165 */ -}; - -/* Atheros hardware rate code addition for short premble */ -#define SHPCHECK(__hw_rate, __flags) \ - ((__flags & IEEE80211_RATE_SHORT_PREAMBLE) ? (__hw_rate | 0x04) : 0) - -#define RATE(_bitrate, _hw_rate, _flags) { \ - .bitrate = (_bitrate), \ - .flags = (_flags), \ - .hw_value = (_hw_rate), \ - .hw_value_short = (SHPCHECK(_hw_rate, _flags)) \ -} - -static struct ieee80211_rate ath9k_legacy_rates[] = { - RATE(10, 0x1b, 0), - RATE(20, 0x1a, IEEE80211_RATE_SHORT_PREAMBLE), /* shortp : 0x1e */ - RATE(55, 0x19, IEEE80211_RATE_SHORT_PREAMBLE), /* shortp: 0x1d */ - RATE(110, 0x18, IEEE80211_RATE_SHORT_PREAMBLE), /* short: 0x1c */ - RATE(60, 0x0b, 0), - RATE(90, 0x0f, 0), - RATE(120, 0x0a, 0), - RATE(180, 0x0e, 0), - RATE(240, 0x09, 0), - RATE(360, 0x0d, 0), - RATE(480, 0x08, 0), - RATE(540, 0x0c, 0), -}; - -#ifdef CONFIG_MAC80211_LEDS -static const struct ieee80211_tpt_blink ath9k_htc_tpt_blink[] = { - { .throughput = 0 * 1024, .blink_time = 334 }, - { .throughput = 1 * 1024, .blink_time = 260 }, - { .throughput = 5 * 1024, .blink_time = 220 }, - { .throughput = 10 * 1024, .blink_time = 190 }, - { .throughput = 20 * 1024, .blink_time = 170 }, - { .throughput = 50 * 1024, .blink_time = 150 }, - { .throughput = 70 * 1024, .blink_time = 130 }, - { .throughput = 100 * 1024, .blink_time = 110 }, - { .throughput = 200 * 1024, .blink_time = 80 }, - { .throughput = 300 * 1024, .blink_time = 50 }, -}; -#endif - -static int ath9k_htc_wait_for_target(struct ath9k_htc_priv *priv) -{ - int time_left; - - if (atomic_read(&priv->htc->tgt_ready) > 0) { - atomic_dec(&priv->htc->tgt_ready); - return 0; - } - - /* Firmware can take up to 50ms to get ready, to be safe use 1 second */ - time_left = wait_for_completion_timeout(&priv->htc->target_wait, HZ); - if (!time_left) { - dev_err(priv->dev, "ath9k_htc: Target is unresponsive\n"); - return -ETIMEDOUT; - } - - atomic_dec(&priv->htc->tgt_ready); - - return 0; -} - -static void ath9k_deinit_priv(struct ath9k_htc_priv *priv) -{ - ath9k_hw_deinit(priv->ah); - kfree(priv->ah); - priv->ah = NULL; -} - -static void ath9k_deinit_device(struct ath9k_htc_priv *priv) -{ - struct ieee80211_hw *hw = priv->hw; - - wiphy_rfkill_stop_polling(hw->wiphy); - ath9k_deinit_leds(priv); - ieee80211_unregister_hw(hw); - ath9k_rx_cleanup(priv); - ath9k_tx_cleanup(priv); - ath9k_deinit_priv(priv); -} - -static inline int ath9k_htc_connect_svc(struct ath9k_htc_priv *priv, - u16 service_id, - void (*tx) (void *, - struct sk_buff *, - enum htc_endpoint_id, - bool txok), - enum htc_endpoint_id *ep_id) -{ - struct htc_service_connreq req; - - memset(&req, 0, sizeof(struct htc_service_connreq)); - - req.service_id = service_id; - req.ep_callbacks.priv = priv; - req.ep_callbacks.rx = ath9k_htc_rxep; - req.ep_callbacks.tx = tx; - - return htc_connect_service(priv->htc, &req, ep_id); -} - -static int ath9k_init_htc_services(struct ath9k_htc_priv *priv, u16 devid, - u32 drv_info) -{ - int ret; - - /* WMI CMD*/ - ret = ath9k_wmi_connect(priv->htc, priv->wmi, &priv->wmi_cmd_ep); - if (ret) - goto err; - - /* Beacon */ - ret = ath9k_htc_connect_svc(priv, WMI_BEACON_SVC, ath9k_htc_beaconep, - &priv->beacon_ep); - if (ret) - goto err; - - /* CAB */ - ret = ath9k_htc_connect_svc(priv, WMI_CAB_SVC, ath9k_htc_txep, - &priv->cab_ep); - if (ret) - goto err; - - - /* UAPSD */ - ret = ath9k_htc_connect_svc(priv, WMI_UAPSD_SVC, ath9k_htc_txep, - &priv->uapsd_ep); - if (ret) - goto err; - - /* MGMT */ - ret = ath9k_htc_connect_svc(priv, WMI_MGMT_SVC, ath9k_htc_txep, - &priv->mgmt_ep); - if (ret) - goto err; - - /* DATA BE */ - ret = ath9k_htc_connect_svc(priv, WMI_DATA_BE_SVC, ath9k_htc_txep, - &priv->data_be_ep); - if (ret) - goto err; - - /* DATA BK */ - ret = ath9k_htc_connect_svc(priv, WMI_DATA_BK_SVC, ath9k_htc_txep, - &priv->data_bk_ep); - if (ret) - goto err; - - /* DATA VI */ - ret = ath9k_htc_connect_svc(priv, WMI_DATA_VI_SVC, ath9k_htc_txep, - &priv->data_vi_ep); - if (ret) - goto err; - - /* DATA VO */ - ret = ath9k_htc_connect_svc(priv, WMI_DATA_VO_SVC, ath9k_htc_txep, - &priv->data_vo_ep); - if (ret) - goto err; - - /* - * Setup required credits before initializing HTC. - * This is a bit hacky, but, since queuing is done in - * the HIF layer, shouldn't matter much. - */ - - if (IS_AR7010_DEVICE(drv_info)) - priv->htc->credits = 45; - else - priv->htc->credits = 33; - - ret = htc_init(priv->htc); - if (ret) - goto err; - - dev_info(priv->dev, "ath9k_htc: HTC initialized with %d credits\n", - priv->htc->credits); - - return 0; - -err: - dev_err(priv->dev, "ath9k_htc: Unable to initialize HTC services\n"); - return ret; -} - -static void ath9k_reg_notifier(struct wiphy *wiphy, - struct regulatory_request *request) -{ - struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); - struct ath9k_htc_priv *priv = hw->priv; - - ath_reg_notifier_apply(wiphy, request, - ath9k_hw_regulatory(priv->ah)); -} - -static unsigned int ath9k_regread(void *hw_priv, u32 reg_offset) -{ - struct ath_hw *ah = (struct ath_hw *) hw_priv; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; - __be32 val, reg = cpu_to_be32(reg_offset); - int r; - - r = ath9k_wmi_cmd(priv->wmi, WMI_REG_READ_CMDID, - (u8 *) ®, sizeof(reg), - (u8 *) &val, sizeof(val), - 100); - if (unlikely(r)) { - ath_dbg(common, WMI, "REGISTER READ FAILED: (0x%04x, %d)\n", - reg_offset, r); - return -EIO; - } - - return be32_to_cpu(val); -} - -static void ath9k_multi_regread(void *hw_priv, u32 *addr, - u32 *val, u16 count) -{ - struct ath_hw *ah = (struct ath_hw *) hw_priv; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; - __be32 tmpaddr[8]; - __be32 tmpval[8]; - int i, ret; - - for (i = 0; i < count; i++) { - tmpaddr[i] = cpu_to_be32(addr[i]); - } - - ret = ath9k_wmi_cmd(priv->wmi, WMI_REG_READ_CMDID, - (u8 *)tmpaddr , sizeof(u32) * count, - (u8 *)tmpval, sizeof(u32) * count, - 100); - if (unlikely(ret)) { - ath_dbg(common, WMI, - "Multiple REGISTER READ FAILED (count: %d)\n", count); - } - - for (i = 0; i < count; i++) { - val[i] = be32_to_cpu(tmpval[i]); - } -} - -static void ath9k_regwrite_single(void *hw_priv, u32 val, u32 reg_offset) -{ - struct ath_hw *ah = (struct ath_hw *) hw_priv; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; - const __be32 buf[2] = { - cpu_to_be32(reg_offset), - cpu_to_be32(val), - }; - int r; - - r = ath9k_wmi_cmd(priv->wmi, WMI_REG_WRITE_CMDID, - (u8 *) &buf, sizeof(buf), - (u8 *) &val, sizeof(val), - 100); - if (unlikely(r)) { - ath_dbg(common, WMI, "REGISTER WRITE FAILED:(0x%04x, %d)\n", - reg_offset, r); - } -} - -static void ath9k_regwrite_buffer(void *hw_priv, u32 val, u32 reg_offset) -{ - struct ath_hw *ah = (struct ath_hw *) hw_priv; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; - u32 rsp_status; - int r; - - mutex_lock(&priv->wmi->multi_write_mutex); - - /* Store the register/value */ - priv->wmi->multi_write[priv->wmi->multi_write_idx].reg = - cpu_to_be32(reg_offset); - priv->wmi->multi_write[priv->wmi->multi_write_idx].val = - cpu_to_be32(val); - - priv->wmi->multi_write_idx++; - - /* If the buffer is full, send it out. */ - if (priv->wmi->multi_write_idx == MAX_CMD_NUMBER) { - r = ath9k_wmi_cmd(priv->wmi, WMI_REG_WRITE_CMDID, - (u8 *) &priv->wmi->multi_write, - sizeof(struct register_write) * priv->wmi->multi_write_idx, - (u8 *) &rsp_status, sizeof(rsp_status), - 100); - if (unlikely(r)) { - ath_dbg(common, WMI, - "REGISTER WRITE FAILED, multi len: %d\n", - priv->wmi->multi_write_idx); - } - priv->wmi->multi_write_idx = 0; - } - - mutex_unlock(&priv->wmi->multi_write_mutex); -} - -static void ath9k_regwrite(void *hw_priv, u32 val, u32 reg_offset) -{ - struct ath_hw *ah = (struct ath_hw *) hw_priv; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; - - if (atomic_read(&priv->wmi->mwrite_cnt)) - ath9k_regwrite_buffer(hw_priv, val, reg_offset); - else - ath9k_regwrite_single(hw_priv, val, reg_offset); -} - -static void ath9k_enable_regwrite_buffer(void *hw_priv) -{ - struct ath_hw *ah = (struct ath_hw *) hw_priv; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; - - atomic_inc(&priv->wmi->mwrite_cnt); -} - -static void ath9k_regwrite_flush(void *hw_priv) -{ - struct ath_hw *ah = (struct ath_hw *) hw_priv; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; - u32 rsp_status; - int r; - - atomic_dec(&priv->wmi->mwrite_cnt); - - mutex_lock(&priv->wmi->multi_write_mutex); - - if (priv->wmi->multi_write_idx) { - r = ath9k_wmi_cmd(priv->wmi, WMI_REG_WRITE_CMDID, - (u8 *) &priv->wmi->multi_write, - sizeof(struct register_write) * priv->wmi->multi_write_idx, - (u8 *) &rsp_status, sizeof(rsp_status), - 100); - if (unlikely(r)) { - ath_dbg(common, WMI, - "REGISTER WRITE FAILED, multi len: %d\n", - priv->wmi->multi_write_idx); - } - priv->wmi->multi_write_idx = 0; - } - - mutex_unlock(&priv->wmi->multi_write_mutex); -} - -static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr) -{ - u32 val; - - val = ath9k_regread(hw_priv, reg_offset); - val &= ~clr; - val |= set; - ath9k_regwrite(hw_priv, val, reg_offset); - return val; -} - -static void ath_usb_read_cachesize(struct ath_common *common, int *csz) -{ - *csz = L1_CACHE_BYTES >> 2; -} - -static bool ath_usb_eeprom_read(struct ath_common *common, u32 off, u16 *data) -{ - struct ath_hw *ah = (struct ath_hw *) common->ah; - - (void)REG_READ(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S)); - - if (!ath9k_hw_wait(ah, - AR_EEPROM_STATUS_DATA, - AR_EEPROM_STATUS_DATA_BUSY | - AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0, - AH_WAIT_TIMEOUT)) - return false; - - *data = MS(REG_READ(ah, AR_EEPROM_STATUS_DATA), - AR_EEPROM_STATUS_DATA_VAL); - - return true; -} - -static const struct ath_bus_ops ath9k_usb_bus_ops = { - .ath_bus_type = ATH_USB, - .read_cachesize = ath_usb_read_cachesize, - .eeprom_read = ath_usb_eeprom_read, -}; - -static void setup_ht_cap(struct ath9k_htc_priv *priv, - struct ieee80211_sta_ht_cap *ht_info) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - u8 tx_streams, rx_streams; - int i; - - ht_info->ht_supported = true; - ht_info->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | - IEEE80211_HT_CAP_SM_PS | - IEEE80211_HT_CAP_SGI_40 | - IEEE80211_HT_CAP_DSSSCCK40; - - if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_SGI_20) - ht_info->cap |= IEEE80211_HT_CAP_SGI_20; - - ht_info->cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT); - - ht_info->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; - ht_info->ampdu_density = IEEE80211_HT_MPDU_DENSITY_8; - - memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); - - /* ath9k_htc supports only 1 or 2 stream devices */ - tx_streams = ath9k_cmn_count_streams(priv->ah->txchainmask, 2); - rx_streams = ath9k_cmn_count_streams(priv->ah->rxchainmask, 2); - - ath_dbg(common, CONFIG, "TX streams %d, RX streams: %d\n", - tx_streams, rx_streams); - - if (tx_streams != rx_streams) { - ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF; - ht_info->mcs.tx_params |= ((tx_streams - 1) << - IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT); - } - - for (i = 0; i < rx_streams; i++) - ht_info->mcs.rx_mask[i] = 0xff; - - ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED; -} - -static int ath9k_init_queues(struct ath9k_htc_priv *priv) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - int i; - - for (i = 0; i < ARRAY_SIZE(priv->hwq_map); i++) - priv->hwq_map[i] = -1; - - priv->beaconq = ath9k_hw_beaconq_setup(priv->ah); - if (priv->beaconq == -1) { - ath_err(common, "Unable to setup BEACON xmit queue\n"); - goto err; - } - - priv->cabq = ath9k_htc_cabq_setup(priv); - if (priv->cabq == -1) { - ath_err(common, "Unable to setup CAB xmit queue\n"); - goto err; - } - - if (!ath9k_htc_txq_setup(priv, IEEE80211_AC_BE)) { - ath_err(common, "Unable to setup xmit queue for BE traffic\n"); - goto err; - } - - if (!ath9k_htc_txq_setup(priv, IEEE80211_AC_BK)) { - ath_err(common, "Unable to setup xmit queue for BK traffic\n"); - goto err; - } - if (!ath9k_htc_txq_setup(priv, IEEE80211_AC_VI)) { - ath_err(common, "Unable to setup xmit queue for VI traffic\n"); - goto err; - } - if (!ath9k_htc_txq_setup(priv, IEEE80211_AC_VO)) { - ath_err(common, "Unable to setup xmit queue for VO traffic\n"); - goto err; - } - - return 0; - -err: - return -EINVAL; -} - -static void ath9k_init_channels_rates(struct ath9k_htc_priv *priv) -{ - if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) { - priv->sbands[IEEE80211_BAND_2GHZ].channels = - ath9k_2ghz_channels; - priv->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; - priv->sbands[IEEE80211_BAND_2GHZ].n_channels = - ARRAY_SIZE(ath9k_2ghz_channels); - priv->sbands[IEEE80211_BAND_2GHZ].bitrates = ath9k_legacy_rates; - priv->sbands[IEEE80211_BAND_2GHZ].n_bitrates = - ARRAY_SIZE(ath9k_legacy_rates); - } - - if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) { - priv->sbands[IEEE80211_BAND_5GHZ].channels = ath9k_5ghz_channels; - priv->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ; - priv->sbands[IEEE80211_BAND_5GHZ].n_channels = - ARRAY_SIZE(ath9k_5ghz_channels); - priv->sbands[IEEE80211_BAND_5GHZ].bitrates = - ath9k_legacy_rates + 4; - priv->sbands[IEEE80211_BAND_5GHZ].n_bitrates = - ARRAY_SIZE(ath9k_legacy_rates) - 4; - } -} - -static void ath9k_init_misc(struct ath9k_htc_priv *priv) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - - memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN); - - priv->ah->opmode = NL80211_IFTYPE_STATION; -} - -static int ath9k_init_priv(struct ath9k_htc_priv *priv, - u16 devid, char *product, - u32 drv_info) -{ - struct ath_hw *ah = NULL; - struct ath_common *common; - int i, ret = 0, csz = 0; - - set_bit(OP_INVALID, &priv->op_flags); - - ah = kzalloc(sizeof(struct ath_hw), GFP_KERNEL); - if (!ah) - return -ENOMEM; - - ah->hw_version.devid = devid; - ah->hw_version.usbdev = drv_info; - ah->ah_flags |= AH_USE_EEPROM; - ah->reg_ops.read = ath9k_regread; - ah->reg_ops.multi_read = ath9k_multi_regread; - ah->reg_ops.write = ath9k_regwrite; - ah->reg_ops.enable_write_buffer = ath9k_enable_regwrite_buffer; - ah->reg_ops.write_flush = ath9k_regwrite_flush; - ah->reg_ops.rmw = ath9k_reg_rmw; - priv->ah = ah; - - common = ath9k_hw_common(ah); - common->ops = &ah->reg_ops; - common->bus_ops = &ath9k_usb_bus_ops; - common->ah = ah; - common->hw = priv->hw; - common->priv = priv; - common->debug_mask = ath9k_debug; - common->btcoex_enabled = ath9k_htc_btcoex_enable == 1; - - spin_lock_init(&priv->beacon_lock); - spin_lock_init(&priv->tx.tx_lock); - mutex_init(&priv->mutex); - mutex_init(&priv->htc_pm_lock); - tasklet_init(&priv->rx_tasklet, ath9k_rx_tasklet, - (unsigned long)priv); - tasklet_init(&priv->tx_failed_tasklet, ath9k_tx_failed_tasklet, - (unsigned long)priv); - INIT_DELAYED_WORK(&priv->ani_work, ath9k_htc_ani_work); - INIT_WORK(&priv->ps_work, ath9k_ps_work); - INIT_WORK(&priv->fatal_work, ath9k_fatal_work); - setup_timer(&priv->tx.cleanup_timer, ath9k_htc_tx_cleanup_timer, - (unsigned long)priv); - - /* - * Cache line size is used to size and align various - * structures used to communicate with the hardware. - */ - ath_read_cachesize(common, &csz); - common->cachelsz = csz << 2; /* convert to bytes */ - - ret = ath9k_hw_init(ah); - if (ret) { - ath_err(common, - "Unable to initialize hardware; initialization status: %d\n", - ret); - goto err_hw; - } - - ret = ath9k_init_queues(priv); - if (ret) - goto err_queues; - - for (i = 0; i < ATH9K_HTC_MAX_BCN_VIF; i++) - priv->cur_beacon_conf.bslot[i] = NULL; - - ath9k_cmn_init_crypto(ah); - ath9k_init_channels_rates(priv); - ath9k_init_misc(priv); - ath9k_htc_init_btcoex(priv, product); - - return 0; - -err_queues: - ath9k_hw_deinit(ah); -err_hw: - - kfree(ah); - priv->ah = NULL; - - return ret; -} - -static const struct ieee80211_iface_limit if_limits[] = { - { .max = 2, .types = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_P2P_CLIENT) }, - { .max = 2, .types = BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_P2P_GO) }, -}; - -static const struct ieee80211_iface_combination if_comb = { - .limits = if_limits, - .n_limits = ARRAY_SIZE(if_limits), - .max_interfaces = 2, - .num_different_channels = 1, -}; - -static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv, - struct ieee80211_hw *hw) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - - hw->flags = IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_AMPDU_AGGREGATION | - IEEE80211_HW_SPECTRUM_MGMT | - IEEE80211_HW_HAS_RATE_CONTROL | - IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_PS_NULLFUNC_STACK | - IEEE80211_HW_REPORTS_TX_ACK_STATUS | - IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING; - - hw->wiphy->interface_modes = - BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_P2P_GO) | - BIT(NL80211_IFTYPE_P2P_CLIENT); - - hw->wiphy->iface_combinations = &if_comb; - hw->wiphy->n_iface_combinations = 1; - - hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; - - hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN | - WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; - - hw->queues = 4; - hw->channel_change_time = 5000; - hw->max_listen_interval = 1; - - hw->vif_data_size = sizeof(struct ath9k_htc_vif); - hw->sta_data_size = sizeof(struct ath9k_htc_sta); - - /* tx_frame_hdr is larger than tx_mgmt_hdr anyway */ - hw->extra_tx_headroom = sizeof(struct tx_frame_hdr) + - sizeof(struct htc_frame_hdr) + 4; - - if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = - &priv->sbands[IEEE80211_BAND_2GHZ]; - if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) - hw->wiphy->bands[IEEE80211_BAND_5GHZ] = - &priv->sbands[IEEE80211_BAND_5GHZ]; - - if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_HT) { - if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) - setup_ht_cap(priv, - &priv->sbands[IEEE80211_BAND_2GHZ].ht_cap); - if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) - setup_ht_cap(priv, - &priv->sbands[IEEE80211_BAND_5GHZ].ht_cap); - } - - SET_IEEE80211_PERM_ADDR(hw, common->macaddr); -} - -static int ath9k_init_firmware_version(struct ath9k_htc_priv *priv) -{ - struct ieee80211_hw *hw = priv->hw; - struct wmi_fw_version cmd_rsp; - int ret; - - memset(&cmd_rsp, 0, sizeof(cmd_rsp)); - - WMI_CMD(WMI_GET_FW_VERSION); - if (ret) - return -EINVAL; - - priv->fw_version_major = be16_to_cpu(cmd_rsp.major); - priv->fw_version_minor = be16_to_cpu(cmd_rsp.minor); - - snprintf(hw->wiphy->fw_version, sizeof(hw->wiphy->fw_version), "%d.%d", - priv->fw_version_major, - priv->fw_version_minor); - - dev_info(priv->dev, "ath9k_htc: FW Version: %d.%d\n", - priv->fw_version_major, - priv->fw_version_minor); - - /* - * Check if the available FW matches the driver's - * required version. - */ - if (priv->fw_version_major != MAJOR_VERSION_REQ || - priv->fw_version_minor < MINOR_VERSION_REQ) { - dev_err(priv->dev, "ath9k_htc: Please upgrade to FW version %d.%d\n", - MAJOR_VERSION_REQ, MINOR_VERSION_REQ); - return -EINVAL; - } - - return 0; -} - -static int ath9k_init_device(struct ath9k_htc_priv *priv, - u16 devid, char *product, u32 drv_info) -{ - struct ieee80211_hw *hw = priv->hw; - struct ath_common *common; - struct ath_hw *ah; - int error = 0; - struct ath_regulatory *reg; - char hw_name[64]; - - /* Bring up device */ - error = ath9k_init_priv(priv, devid, product, drv_info); - if (error != 0) - goto err_init; - - ah = priv->ah; - common = ath9k_hw_common(ah); - ath9k_set_hw_capab(priv, hw); - - error = ath9k_init_firmware_version(priv); - if (error != 0) - goto err_fw; - - /* Initialize regulatory */ - error = ath_regd_init(&common->regulatory, priv->hw->wiphy, - ath9k_reg_notifier); - if (error) - goto err_regd; - - reg = &common->regulatory; - - /* Setup TX */ - error = ath9k_tx_init(priv); - if (error != 0) - goto err_tx; - - /* Setup RX */ - error = ath9k_rx_init(priv); - if (error != 0) - goto err_rx; - - ath9k_hw_disable(priv->ah); -#ifdef CONFIG_MAC80211_LEDS - /* must be initialized before ieee80211_register_hw */ - priv->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(priv->hw, - IEEE80211_TPT_LEDTRIG_FL_RADIO, ath9k_htc_tpt_blink, - ARRAY_SIZE(ath9k_htc_tpt_blink)); -#endif - - /* Register with mac80211 */ - error = ieee80211_register_hw(hw); - if (error) - goto err_register; - - /* Handle world regulatory */ - if (!ath_is_world_regd(reg)) { - error = regulatory_hint(hw->wiphy, reg->alpha2); - if (error) - goto err_world; - } - - error = ath9k_htc_init_debug(priv->ah); - if (error) { - ath_err(common, "Unable to create debugfs files\n"); - goto err_world; - } - - ath_dbg(common, CONFIG, - "WMI:%d, BCN:%d, CAB:%d, UAPSD:%d, MGMT:%d, BE:%d, BK:%d, VI:%d, VO:%d\n", - priv->wmi_cmd_ep, - priv->beacon_ep, - priv->cab_ep, - priv->uapsd_ep, - priv->mgmt_ep, - priv->data_be_ep, - priv->data_bk_ep, - priv->data_vi_ep, - priv->data_vo_ep); - - ath9k_hw_name(priv->ah, hw_name, sizeof(hw_name)); - wiphy_info(hw->wiphy, "%s\n", hw_name); - - ath9k_init_leds(priv); - ath9k_start_rfkill_poll(priv); - - return 0; - -err_world: - ieee80211_unregister_hw(hw); -err_register: - ath9k_rx_cleanup(priv); -err_rx: - ath9k_tx_cleanup(priv); -err_tx: - /* Nothing */ -err_regd: - /* Nothing */ -err_fw: - ath9k_deinit_priv(priv); -err_init: - return error; -} - -int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, - u16 devid, char *product, u32 drv_info) -{ - struct ieee80211_hw *hw; - struct ath9k_htc_priv *priv; - int ret; - - hw = ieee80211_alloc_hw(sizeof(struct ath9k_htc_priv), &ath9k_htc_ops); - if (!hw) - return -ENOMEM; - - priv = hw->priv; - priv->hw = hw; - priv->htc = htc_handle; - priv->dev = dev; - htc_handle->drv_priv = priv; - SET_IEEE80211_DEV(hw, priv->dev); - - ret = ath9k_htc_wait_for_target(priv); - if (ret) - goto err_free; - - priv->wmi = ath9k_init_wmi(priv); - if (!priv->wmi) { - ret = -EINVAL; - goto err_free; - } - - ret = ath9k_init_htc_services(priv, devid, drv_info); - if (ret) - goto err_init; - - ret = ath9k_init_device(priv, devid, product, drv_info); - if (ret) - goto err_init; - - return 0; - -err_init: - ath9k_deinit_wmi(priv); -err_free: - ieee80211_free_hw(hw); - return ret; -} - -void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug) -{ - if (htc_handle->drv_priv) { - - /* Check if the device has been yanked out. */ - if (hotunplug) - htc_handle->drv_priv->ah->ah_flags |= AH_UNPLUGGED; - - ath9k_deinit_device(htc_handle->drv_priv); - ath9k_deinit_wmi(htc_handle->drv_priv); - ieee80211_free_hw(htc_handle->drv_priv->hw); - } -} - -#ifdef CONFIG_PM - -void ath9k_htc_suspend(struct htc_target *htc_handle) -{ - ath9k_htc_setpower(htc_handle->drv_priv, ATH9K_PM_FULL_SLEEP); -} - -int ath9k_htc_resume(struct htc_target *htc_handle) -{ - struct ath9k_htc_priv *priv = htc_handle->drv_priv; - int ret; - - ret = ath9k_htc_wait_for_target(priv); - if (ret) - return ret; - - ret = ath9k_init_htc_services(priv, priv->ah->hw_version.devid, - priv->ah->hw_version.usbdev); - return ret; -} -#endif - -static int __init ath9k_htc_init(void) -{ - if (ath9k_hif_usb_init() < 0) { - pr_err("No USB devices found, driver not installed\n"); - return -ENODEV; - } - - return 0; -} -module_init(ath9k_htc_init); - -static void __exit ath9k_htc_exit(void) -{ - ath9k_hif_usb_exit(); - pr_info("Driver unloaded\n"); -} -module_exit(ath9k_htc_exit); diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c deleted file mode 100644 index 21e7edc7207c..000000000000 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ /dev/null @@ -1,1798 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "htc.h" - -/*************/ -/* Utilities */ -/*************/ - -/* HACK Alert: Use 11NG for 2.4, use 11NA for 5 */ -static enum htc_phymode ath9k_htc_get_curmode(struct ath9k_htc_priv *priv, - struct ath9k_channel *ichan) -{ - enum htc_phymode mode; - - mode = -EINVAL; - - switch (ichan->chanmode) { - case CHANNEL_G: - case CHANNEL_G_HT20: - case CHANNEL_G_HT40PLUS: - case CHANNEL_G_HT40MINUS: - mode = HTC_MODE_11NG; - break; - case CHANNEL_A: - case CHANNEL_A_HT20: - case CHANNEL_A_HT40PLUS: - case CHANNEL_A_HT40MINUS: - mode = HTC_MODE_11NA; - break; - default: - break; - } - - WARN_ON(mode < 0); - - return mode; -} - -bool ath9k_htc_setpower(struct ath9k_htc_priv *priv, - enum ath9k_power_mode mode) -{ - bool ret; - - mutex_lock(&priv->htc_pm_lock); - ret = ath9k_hw_setpower(priv->ah, mode); - mutex_unlock(&priv->htc_pm_lock); - - return ret; -} - -void ath9k_htc_ps_wakeup(struct ath9k_htc_priv *priv) -{ - mutex_lock(&priv->htc_pm_lock); - if (++priv->ps_usecount != 1) - goto unlock; - ath9k_hw_setpower(priv->ah, ATH9K_PM_AWAKE); - -unlock: - mutex_unlock(&priv->htc_pm_lock); -} - -void ath9k_htc_ps_restore(struct ath9k_htc_priv *priv) -{ - bool reset; - - mutex_lock(&priv->htc_pm_lock); - if (--priv->ps_usecount != 0) - goto unlock; - - if (priv->ps_idle) { - ath9k_hw_setrxabort(priv->ah, true); - ath9k_hw_stopdmarecv(priv->ah, &reset); - ath9k_hw_setpower(priv->ah, ATH9K_PM_FULL_SLEEP); - } else if (priv->ps_enabled) { - ath9k_hw_setpower(priv->ah, ATH9K_PM_NETWORK_SLEEP); - } - -unlock: - mutex_unlock(&priv->htc_pm_lock); -} - -void ath9k_ps_work(struct work_struct *work) -{ - struct ath9k_htc_priv *priv = - container_of(work, struct ath9k_htc_priv, - ps_work); - ath9k_htc_setpower(priv, ATH9K_PM_AWAKE); - - /* The chip wakes up after receiving the first beacon - while network sleep is enabled. For the driver to - be in sync with the hw, set the chip to awake and - only then set it to sleep. - */ - ath9k_htc_setpower(priv, ATH9K_PM_NETWORK_SLEEP); -} - -static void ath9k_htc_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) -{ - struct ath9k_htc_priv *priv = data; - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; - - if ((vif->type == NL80211_IFTYPE_AP) && bss_conf->enable_beacon) - priv->reconfig_beacon = true; - - if (bss_conf->assoc) { - priv->rearm_ani = true; - priv->reconfig_beacon = true; - } -} - -static void ath9k_htc_vif_reconfig(struct ath9k_htc_priv *priv) -{ - priv->rearm_ani = false; - priv->reconfig_beacon = false; - - ieee80211_iterate_active_interfaces_atomic( - priv->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - ath9k_htc_vif_iter, priv); - if (priv->rearm_ani) - ath9k_htc_start_ani(priv); - - if (priv->reconfig_beacon) { - ath9k_htc_ps_wakeup(priv); - ath9k_htc_beacon_reconfig(priv); - ath9k_htc_ps_restore(priv); - } -} - -static void ath9k_htc_bssid_iter(void *data, u8 *mac, struct ieee80211_vif *vif) -{ - struct ath9k_vif_iter_data *iter_data = data; - int i; - - if (iter_data->hw_macaddr != NULL) { - for (i = 0; i < ETH_ALEN; i++) - iter_data->mask[i] &= ~(iter_data->hw_macaddr[i] ^ mac[i]); - } else { - iter_data->hw_macaddr = mac; - } -} - -static void ath9k_htc_set_mac_bssid_mask(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_vif_iter_data iter_data; - - /* - * Pick the MAC address of the first interface as the new hardware - * MAC address. The hardware will use it together with the BSSID mask - * when matching addresses. - */ - iter_data.hw_macaddr = NULL; - memset(&iter_data.mask, 0xff, ETH_ALEN); - - if (vif) - ath9k_htc_bssid_iter(&iter_data, vif->addr, vif); - - /* Get list of all active MAC addresses */ - ieee80211_iterate_active_interfaces_atomic( - priv->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - ath9k_htc_bssid_iter, &iter_data); - - memcpy(common->bssidmask, iter_data.mask, ETH_ALEN); - - if (iter_data.hw_macaddr) - memcpy(common->macaddr, iter_data.hw_macaddr, ETH_ALEN); - - ath_hw_setbssidmask(common); -} - -static void ath9k_htc_set_opmode(struct ath9k_htc_priv *priv) -{ - if (priv->num_ibss_vif) - priv->ah->opmode = NL80211_IFTYPE_ADHOC; - else if (priv->num_ap_vif) - priv->ah->opmode = NL80211_IFTYPE_AP; - else - priv->ah->opmode = NL80211_IFTYPE_STATION; - - ath9k_hw_setopmode(priv->ah); -} - -void ath9k_htc_reset(struct ath9k_htc_priv *priv) -{ - struct ath_hw *ah = priv->ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ieee80211_channel *channel = priv->hw->conf.chandef.chan; - struct ath9k_hw_cal_data *caldata = NULL; - enum htc_phymode mode; - __be16 htc_mode; - u8 cmd_rsp; - int ret; - - mutex_lock(&priv->mutex); - ath9k_htc_ps_wakeup(priv); - - ath9k_htc_stop_ani(priv); - ieee80211_stop_queues(priv->hw); - - del_timer_sync(&priv->tx.cleanup_timer); - ath9k_htc_tx_drain(priv); - - WMI_CMD(WMI_DISABLE_INTR_CMDID); - WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID); - WMI_CMD(WMI_STOP_RECV_CMDID); - - ath9k_wmi_event_drain(priv); - - caldata = &priv->caldata; - ret = ath9k_hw_reset(ah, ah->curchan, caldata, false); - if (ret) { - ath_err(common, - "Unable to reset device (%u Mhz) reset status %d\n", - channel->center_freq, ret); - } - - ath9k_cmn_update_txpow(ah, priv->curtxpow, priv->txpowlimit, - &priv->curtxpow); - - WMI_CMD(WMI_START_RECV_CMDID); - ath9k_host_rx_init(priv); - - mode = ath9k_htc_get_curmode(priv, ah->curchan); - htc_mode = cpu_to_be16(mode); - WMI_CMD_BUF(WMI_SET_MODE_CMDID, &htc_mode); - - WMI_CMD(WMI_ENABLE_INTR_CMDID); - htc_start(priv->htc); - ath9k_htc_vif_reconfig(priv); - ieee80211_wake_queues(priv->hw); - - mod_timer(&priv->tx.cleanup_timer, - jiffies + msecs_to_jiffies(ATH9K_HTC_TX_CLEANUP_INTERVAL)); - - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); -} - -static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv, - struct ieee80211_hw *hw, - struct ath9k_channel *hchan) -{ - struct ath_hw *ah = priv->ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ieee80211_conf *conf = &common->hw->conf; - bool fastcc; - struct ieee80211_channel *channel = hw->conf.chandef.chan; - struct ath9k_hw_cal_data *caldata = NULL; - enum htc_phymode mode; - __be16 htc_mode; - u8 cmd_rsp; - int ret; - - if (test_bit(OP_INVALID, &priv->op_flags)) - return -EIO; - - fastcc = !!(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL); - - ath9k_htc_ps_wakeup(priv); - - del_timer_sync(&priv->tx.cleanup_timer); - ath9k_htc_tx_drain(priv); - - WMI_CMD(WMI_DISABLE_INTR_CMDID); - WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID); - WMI_CMD(WMI_STOP_RECV_CMDID); - - ath9k_wmi_event_drain(priv); - - ath_dbg(common, CONFIG, - "(%u MHz) -> (%u MHz), HT: %d, HT40: %d fastcc: %d\n", - priv->ah->curchan->channel, - channel->center_freq, conf_is_ht(conf), conf_is_ht40(conf), - fastcc); - - if (!fastcc) - caldata = &priv->caldata; - - ret = ath9k_hw_reset(ah, hchan, caldata, fastcc); - if (ret) { - ath_err(common, - "Unable to reset channel (%u Mhz) reset status %d\n", - channel->center_freq, ret); - goto err; - } - - ath9k_cmn_update_txpow(ah, priv->curtxpow, priv->txpowlimit, - &priv->curtxpow); - - WMI_CMD(WMI_START_RECV_CMDID); - if (ret) - goto err; - - ath9k_host_rx_init(priv); - - mode = ath9k_htc_get_curmode(priv, hchan); - htc_mode = cpu_to_be16(mode); - WMI_CMD_BUF(WMI_SET_MODE_CMDID, &htc_mode); - if (ret) - goto err; - - WMI_CMD(WMI_ENABLE_INTR_CMDID); - if (ret) - goto err; - - htc_start(priv->htc); - - if (!test_bit(OP_SCANNING, &priv->op_flags) && - !(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) - ath9k_htc_vif_reconfig(priv); - - mod_timer(&priv->tx.cleanup_timer, - jiffies + msecs_to_jiffies(ATH9K_HTC_TX_CLEANUP_INTERVAL)); - -err: - ath9k_htc_ps_restore(priv); - return ret; -} - -/* - * Monitor mode handling is a tad complicated because the firmware requires - * an interface to be created exclusively, while mac80211 doesn't associate - * an interface with the mode. - * - * So, for now, only one monitor interface can be configured. - */ -static void __ath9k_htc_remove_monitor_interface(struct ath9k_htc_priv *priv) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_target_vif hvif; - int ret = 0; - u8 cmd_rsp; - - memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif)); - memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN); - hvif.index = priv->mon_vif_idx; - WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif); - if (ret) { - ath_err(common, "Unable to remove monitor interface at idx: %d\n", - priv->mon_vif_idx); - } - - priv->nvifs--; - priv->vif_slot &= ~(1 << priv->mon_vif_idx); -} - -static int ath9k_htc_add_monitor_interface(struct ath9k_htc_priv *priv) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_target_vif hvif; - struct ath9k_htc_target_sta tsta; - int ret = 0, sta_idx; - u8 cmd_rsp; - - if ((priv->nvifs >= ATH9K_HTC_MAX_VIF) || - (priv->nstations >= ATH9K_HTC_MAX_STA)) { - ret = -ENOBUFS; - goto err_vif; - } - - sta_idx = ffz(priv->sta_slot); - if ((sta_idx < 0) || (sta_idx > ATH9K_HTC_MAX_STA)) { - ret = -ENOBUFS; - goto err_vif; - } - - /* - * Add an interface. - */ - memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif)); - memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN); - - hvif.opmode = HTC_M_MONITOR; - hvif.index = ffz(priv->vif_slot); - - WMI_CMD_BUF(WMI_VAP_CREATE_CMDID, &hvif); - if (ret) - goto err_vif; - - /* - * Assign the monitor interface index as a special case here. - * This is needed when the interface is brought down. - */ - priv->mon_vif_idx = hvif.index; - priv->vif_slot |= (1 << hvif.index); - - /* - * Set the hardware mode to monitor only if there are no - * other interfaces. - */ - if (!priv->nvifs) - priv->ah->opmode = NL80211_IFTYPE_MONITOR; - - priv->nvifs++; - - /* - * Associate a station with the interface for packet injection. - */ - memset(&tsta, 0, sizeof(struct ath9k_htc_target_sta)); - - memcpy(&tsta.macaddr, common->macaddr, ETH_ALEN); - - tsta.is_vif_sta = 1; - tsta.sta_index = sta_idx; - tsta.vif_index = hvif.index; - tsta.maxampdu = cpu_to_be16(0xffff); - - WMI_CMD_BUF(WMI_NODE_CREATE_CMDID, &tsta); - if (ret) { - ath_err(common, "Unable to add station entry for monitor mode\n"); - goto err_sta; - } - - priv->sta_slot |= (1 << sta_idx); - priv->nstations++; - priv->vif_sta_pos[priv->mon_vif_idx] = sta_idx; - priv->ah->is_monitoring = true; - - ath_dbg(common, CONFIG, - "Attached a monitor interface at idx: %d, sta idx: %d\n", - priv->mon_vif_idx, sta_idx); - - return 0; - -err_sta: - /* - * Remove the interface from the target. - */ - __ath9k_htc_remove_monitor_interface(priv); -err_vif: - ath_dbg(common, FATAL, "Unable to attach a monitor interface\n"); - - return ret; -} - -static int ath9k_htc_remove_monitor_interface(struct ath9k_htc_priv *priv) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - int ret = 0; - u8 cmd_rsp, sta_idx; - - __ath9k_htc_remove_monitor_interface(priv); - - sta_idx = priv->vif_sta_pos[priv->mon_vif_idx]; - - WMI_CMD_BUF(WMI_NODE_REMOVE_CMDID, &sta_idx); - if (ret) { - ath_err(common, "Unable to remove station entry for monitor mode\n"); - return ret; - } - - priv->sta_slot &= ~(1 << sta_idx); - priv->nstations--; - priv->ah->is_monitoring = false; - - ath_dbg(common, CONFIG, - "Removed a monitor interface at idx: %d, sta idx: %d\n", - priv->mon_vif_idx, sta_idx); - - return 0; -} - -static int ath9k_htc_add_station(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_target_sta tsta; - struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *) vif->drv_priv; - struct ath9k_htc_sta *ista; - int ret, sta_idx; - u8 cmd_rsp; - u16 maxampdu; - - if (priv->nstations >= ATH9K_HTC_MAX_STA) - return -ENOBUFS; - - sta_idx = ffz(priv->sta_slot); - if ((sta_idx < 0) || (sta_idx > ATH9K_HTC_MAX_STA)) - return -ENOBUFS; - - memset(&tsta, 0, sizeof(struct ath9k_htc_target_sta)); - - if (sta) { - ista = (struct ath9k_htc_sta *) sta->drv_priv; - memcpy(&tsta.macaddr, sta->addr, ETH_ALEN); - memcpy(&tsta.bssid, common->curbssid, ETH_ALEN); - ista->index = sta_idx; - tsta.is_vif_sta = 0; - maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + - sta->ht_cap.ampdu_factor); - tsta.maxampdu = cpu_to_be16(maxampdu); - } else { - memcpy(&tsta.macaddr, vif->addr, ETH_ALEN); - tsta.is_vif_sta = 1; - tsta.maxampdu = cpu_to_be16(0xffff); - } - - tsta.sta_index = sta_idx; - tsta.vif_index = avp->index; - - WMI_CMD_BUF(WMI_NODE_CREATE_CMDID, &tsta); - if (ret) { - if (sta) - ath_err(common, - "Unable to add station entry for: %pM\n", - sta->addr); - return ret; - } - - if (sta) { - ath_dbg(common, CONFIG, - "Added a station entry for: %pM (idx: %d)\n", - sta->addr, tsta.sta_index); - } else { - ath_dbg(common, CONFIG, - "Added a station entry for VIF %d (idx: %d)\n", - avp->index, tsta.sta_index); - } - - priv->sta_slot |= (1 << sta_idx); - priv->nstations++; - if (!sta) - priv->vif_sta_pos[avp->index] = sta_idx; - - return 0; -} - -static int ath9k_htc_remove_station(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *) vif->drv_priv; - struct ath9k_htc_sta *ista; - int ret; - u8 cmd_rsp, sta_idx; - - if (sta) { - ista = (struct ath9k_htc_sta *) sta->drv_priv; - sta_idx = ista->index; - } else { - sta_idx = priv->vif_sta_pos[avp->index]; - } - - WMI_CMD_BUF(WMI_NODE_REMOVE_CMDID, &sta_idx); - if (ret) { - if (sta) - ath_err(common, - "Unable to remove station entry for: %pM\n", - sta->addr); - return ret; - } - - if (sta) { - ath_dbg(common, CONFIG, - "Removed a station entry for: %pM (idx: %d)\n", - sta->addr, sta_idx); - } else { - ath_dbg(common, CONFIG, - "Removed a station entry for VIF %d (idx: %d)\n", - avp->index, sta_idx); - } - - priv->sta_slot &= ~(1 << sta_idx); - priv->nstations--; - - return 0; -} - -int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv, - u8 enable_coex) -{ - struct ath9k_htc_cap_target tcap; - int ret; - u8 cmd_rsp; - - memset(&tcap, 0, sizeof(struct ath9k_htc_cap_target)); - - tcap.ampdu_limit = cpu_to_be32(0xffff); - tcap.ampdu_subframes = 0xff; - tcap.enable_coex = enable_coex; - tcap.tx_chainmask = priv->ah->caps.tx_chainmask; - - WMI_CMD_BUF(WMI_TARGET_IC_UPDATE_CMDID, &tcap); - - return ret; -} - -static void ath9k_htc_setup_rate(struct ath9k_htc_priv *priv, - struct ieee80211_sta *sta, - struct ath9k_htc_target_rate *trate) -{ - struct ath9k_htc_sta *ista = (struct ath9k_htc_sta *) sta->drv_priv; - struct ieee80211_supported_band *sband; - u32 caps = 0; - int i, j; - - sband = priv->hw->wiphy->bands[priv->hw->conf.chandef.chan->band]; - - for (i = 0, j = 0; i < sband->n_bitrates; i++) { - if (sta->supp_rates[sband->band] & BIT(i)) { - trate->rates.legacy_rates.rs_rates[j] - = (sband->bitrates[i].bitrate * 2) / 10; - j++; - } - } - trate->rates.legacy_rates.rs_nrates = j; - - if (sta->ht_cap.ht_supported) { - for (i = 0, j = 0; i < 77; i++) { - if (sta->ht_cap.mcs.rx_mask[i/8] & (1<<(i%8))) - trate->rates.ht_rates.rs_rates[j++] = i; - if (j == ATH_HTC_RATE_MAX) - break; - } - trate->rates.ht_rates.rs_nrates = j; - - caps = WLAN_RC_HT_FLAG; - if (sta->ht_cap.mcs.rx_mask[1]) - caps |= WLAN_RC_DS_FLAG; - if ((sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) && - (conf_is_ht40(&priv->hw->conf))) - caps |= WLAN_RC_40_FLAG; - if (conf_is_ht40(&priv->hw->conf) && - (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)) - caps |= WLAN_RC_SGI_FLAG; - else if (conf_is_ht20(&priv->hw->conf) && - (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20)) - caps |= WLAN_RC_SGI_FLAG; - } - - trate->sta_index = ista->index; - trate->isnew = 1; - trate->capflags = cpu_to_be32(caps); -} - -static int ath9k_htc_send_rate_cmd(struct ath9k_htc_priv *priv, - struct ath9k_htc_target_rate *trate) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - int ret; - u8 cmd_rsp; - - WMI_CMD_BUF(WMI_RC_RATE_UPDATE_CMDID, trate); - if (ret) { - ath_err(common, - "Unable to initialize Rate information on target\n"); - } - - return ret; -} - -static void ath9k_htc_init_rate(struct ath9k_htc_priv *priv, - struct ieee80211_sta *sta) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_target_rate trate; - int ret; - - memset(&trate, 0, sizeof(struct ath9k_htc_target_rate)); - ath9k_htc_setup_rate(priv, sta, &trate); - ret = ath9k_htc_send_rate_cmd(priv, &trate); - if (!ret) - ath_dbg(common, CONFIG, - "Updated target sta: %pM, rate caps: 0x%X\n", - sta->addr, be32_to_cpu(trate.capflags)); -} - -static void ath9k_htc_update_rate(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_target_rate trate; - struct ieee80211_sta *sta; - int ret; - - memset(&trate, 0, sizeof(struct ath9k_htc_target_rate)); - - rcu_read_lock(); - sta = ieee80211_find_sta(vif, bss_conf->bssid); - if (!sta) { - rcu_read_unlock(); - return; - } - ath9k_htc_setup_rate(priv, sta, &trate); - rcu_read_unlock(); - - ret = ath9k_htc_send_rate_cmd(priv, &trate); - if (!ret) - ath_dbg(common, CONFIG, - "Updated target sta: %pM, rate caps: 0x%X\n", - bss_conf->bssid, be32_to_cpu(trate.capflags)); -} - -static int ath9k_htc_tx_aggr_oper(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - enum ieee80211_ampdu_mlme_action action, - u16 tid) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_target_aggr aggr; - struct ath9k_htc_sta *ista; - int ret = 0; - u8 cmd_rsp; - - if (tid >= ATH9K_HTC_MAX_TID) - return -EINVAL; - - memset(&aggr, 0, sizeof(struct ath9k_htc_target_aggr)); - ista = (struct ath9k_htc_sta *) sta->drv_priv; - - aggr.sta_index = ista->index; - aggr.tidno = tid & 0xf; - aggr.aggr_enable = (action == IEEE80211_AMPDU_TX_START) ? true : false; - - WMI_CMD_BUF(WMI_TX_AGGR_ENABLE_CMDID, &aggr); - if (ret) - ath_dbg(common, CONFIG, - "Unable to %s TX aggregation for (%pM, %d)\n", - (aggr.aggr_enable) ? "start" : "stop", sta->addr, tid); - else - ath_dbg(common, CONFIG, - "%s TX aggregation for (%pM, %d)\n", - (aggr.aggr_enable) ? "Starting" : "Stopping", - sta->addr, tid); - - spin_lock_bh(&priv->tx.tx_lock); - ista->tid_state[tid] = (aggr.aggr_enable && !ret) ? AGGR_START : AGGR_STOP; - spin_unlock_bh(&priv->tx.tx_lock); - - return ret; -} - -/*******/ -/* ANI */ -/*******/ - -void ath9k_htc_start_ani(struct ath9k_htc_priv *priv) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - unsigned long timestamp = jiffies_to_msecs(jiffies); - - common->ani.longcal_timer = timestamp; - common->ani.shortcal_timer = timestamp; - common->ani.checkani_timer = timestamp; - - set_bit(OP_ANI_RUNNING, &priv->op_flags); - - ieee80211_queue_delayed_work(common->hw, &priv->ani_work, - msecs_to_jiffies(ATH_ANI_POLLINTERVAL)); -} - -void ath9k_htc_stop_ani(struct ath9k_htc_priv *priv) -{ - cancel_delayed_work_sync(&priv->ani_work); - clear_bit(OP_ANI_RUNNING, &priv->op_flags); -} - -void ath9k_htc_ani_work(struct work_struct *work) -{ - struct ath9k_htc_priv *priv = - container_of(work, struct ath9k_htc_priv, ani_work.work); - struct ath_hw *ah = priv->ah; - struct ath_common *common = ath9k_hw_common(ah); - bool longcal = false; - bool shortcal = false; - bool aniflag = false; - unsigned int timestamp = jiffies_to_msecs(jiffies); - u32 cal_interval, short_cal_interval; - - short_cal_interval = (ah->opmode == NL80211_IFTYPE_AP) ? - ATH_AP_SHORT_CALINTERVAL : ATH_STA_SHORT_CALINTERVAL; - - /* Only calibrate if awake */ - if (ah->power_mode != ATH9K_PM_AWAKE) - goto set_timer; - - /* Long calibration runs independently of short calibration. */ - if ((timestamp - common->ani.longcal_timer) >= ATH_LONG_CALINTERVAL) { - longcal = true; - ath_dbg(common, ANI, "longcal @%lu\n", jiffies); - common->ani.longcal_timer = timestamp; - } - - /* Short calibration applies only while caldone is false */ - if (!common->ani.caldone) { - if ((timestamp - common->ani.shortcal_timer) >= - short_cal_interval) { - shortcal = true; - ath_dbg(common, ANI, "shortcal @%lu\n", jiffies); - common->ani.shortcal_timer = timestamp; - common->ani.resetcal_timer = timestamp; - } - } else { - if ((timestamp - common->ani.resetcal_timer) >= - ATH_RESTART_CALINTERVAL) { - common->ani.caldone = ath9k_hw_reset_calvalid(ah); - if (common->ani.caldone) - common->ani.resetcal_timer = timestamp; - } - } - - /* Verify whether we must check ANI */ - if (ah->config.enable_ani && - (timestamp - common->ani.checkani_timer) >= ATH_ANI_POLLINTERVAL) { - aniflag = true; - common->ani.checkani_timer = timestamp; - } - - /* Skip all processing if there's nothing to do. */ - if (longcal || shortcal || aniflag) { - - ath9k_htc_ps_wakeup(priv); - - /* Call ANI routine if necessary */ - if (aniflag) - ath9k_hw_ani_monitor(ah, ah->curchan); - - /* Perform calibration if necessary */ - if (longcal || shortcal) - common->ani.caldone = - ath9k_hw_calibrate(ah, ah->curchan, - ah->rxchainmask, longcal); - - ath9k_htc_ps_restore(priv); - } - -set_timer: - /* - * Set timer interval based on previous results. - * The interval must be the shortest necessary to satisfy ANI, - * short calibration and long calibration. - */ - cal_interval = ATH_LONG_CALINTERVAL; - if (ah->config.enable_ani) - cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL); - if (!common->ani.caldone) - cal_interval = min(cal_interval, (u32)short_cal_interval); - - ieee80211_queue_delayed_work(common->hw, &priv->ani_work, - msecs_to_jiffies(cal_interval)); -} - -/**********************/ -/* mac80211 Callbacks */ -/**********************/ - -static void ath9k_htc_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr; - struct ath9k_htc_priv *priv = hw->priv; - struct ath_common *common = ath9k_hw_common(priv->ah); - int padpos, padsize, ret, slot; - - hdr = (struct ieee80211_hdr *) skb->data; - - /* Add the padding after the header if this is not already done */ - padpos = ieee80211_hdrlen(hdr->frame_control); - padsize = padpos & 3; - if (padsize && skb->len > padpos) { - if (skb_headroom(skb) < padsize) { - ath_dbg(common, XMIT, "No room for padding\n"); - goto fail_tx; - } - skb_push(skb, padsize); - memmove(skb->data, skb->data + padsize, padpos); - } - - slot = ath9k_htc_tx_get_slot(priv); - if (slot < 0) { - ath_dbg(common, XMIT, "No free TX slot\n"); - goto fail_tx; - } - - ret = ath9k_htc_tx_start(priv, control->sta, skb, slot, false); - if (ret != 0) { - ath_dbg(common, XMIT, "Tx failed\n"); - goto clear_slot; - } - - ath9k_htc_check_stop_queues(priv); - - return; - -clear_slot: - ath9k_htc_tx_clear_slot(priv, slot); -fail_tx: - dev_kfree_skb_any(skb); -} - -static int ath9k_htc_start(struct ieee80211_hw *hw) -{ - struct ath9k_htc_priv *priv = hw->priv; - struct ath_hw *ah = priv->ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ieee80211_channel *curchan = hw->conf.chandef.chan; - struct ath9k_channel *init_channel; - int ret = 0; - enum htc_phymode mode; - __be16 htc_mode; - u8 cmd_rsp; - - mutex_lock(&priv->mutex); - - ath_dbg(common, CONFIG, - "Starting driver with initial channel: %d MHz\n", - curchan->center_freq); - - /* Ensure that HW is awake before flushing RX */ - ath9k_htc_setpower(priv, ATH9K_PM_AWAKE); - WMI_CMD(WMI_FLUSH_RECV_CMDID); - - /* setup initial channel */ - init_channel = ath9k_cmn_get_curchannel(hw, ah); - - ret = ath9k_hw_reset(ah, init_channel, ah->caldata, false); - if (ret) { - ath_err(common, - "Unable to reset hardware; reset status %d (freq %u MHz)\n", - ret, curchan->center_freq); - mutex_unlock(&priv->mutex); - return ret; - } - - ath9k_cmn_update_txpow(ah, priv->curtxpow, priv->txpowlimit, - &priv->curtxpow); - - mode = ath9k_htc_get_curmode(priv, init_channel); - htc_mode = cpu_to_be16(mode); - WMI_CMD_BUF(WMI_SET_MODE_CMDID, &htc_mode); - WMI_CMD(WMI_ATH_INIT_CMDID); - WMI_CMD(WMI_START_RECV_CMDID); - - ath9k_host_rx_init(priv); - - ret = ath9k_htc_update_cap_target(priv, 0); - if (ret) - ath_dbg(common, CONFIG, - "Failed to update capability in target\n"); - - clear_bit(OP_INVALID, &priv->op_flags); - htc_start(priv->htc); - - spin_lock_bh(&priv->tx.tx_lock); - priv->tx.flags &= ~ATH9K_HTC_OP_TX_QUEUES_STOP; - spin_unlock_bh(&priv->tx.tx_lock); - - ieee80211_wake_queues(hw); - - mod_timer(&priv->tx.cleanup_timer, - jiffies + msecs_to_jiffies(ATH9K_HTC_TX_CLEANUP_INTERVAL)); - - ath9k_htc_start_btcoex(priv); - - mutex_unlock(&priv->mutex); - - return ret; -} - -static void ath9k_htc_stop(struct ieee80211_hw *hw) -{ - struct ath9k_htc_priv *priv = hw->priv; - struct ath_hw *ah = priv->ah; - struct ath_common *common = ath9k_hw_common(ah); - int ret __attribute__ ((unused)); - u8 cmd_rsp; - - mutex_lock(&priv->mutex); - - if (test_bit(OP_INVALID, &priv->op_flags)) { - ath_dbg(common, ANY, "Device not present\n"); - mutex_unlock(&priv->mutex); - return; - } - - ath9k_htc_ps_wakeup(priv); - - WMI_CMD(WMI_DISABLE_INTR_CMDID); - WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID); - WMI_CMD(WMI_STOP_RECV_CMDID); - - tasklet_kill(&priv->rx_tasklet); - - del_timer_sync(&priv->tx.cleanup_timer); - ath9k_htc_tx_drain(priv); - ath9k_wmi_event_drain(priv); - - mutex_unlock(&priv->mutex); - - /* Cancel all the running timers/work .. */ - cancel_work_sync(&priv->fatal_work); - cancel_work_sync(&priv->ps_work); - -#ifdef CONFIG_MAC80211_LEDS - cancel_work_sync(&priv->led_work); -#endif - ath9k_htc_stop_ani(priv); - - mutex_lock(&priv->mutex); - - ath9k_htc_stop_btcoex(priv); - - /* Remove a monitor interface if it's present. */ - if (priv->ah->is_monitoring) - ath9k_htc_remove_monitor_interface(priv); - - ath9k_hw_phy_disable(ah); - ath9k_hw_disable(ah); - ath9k_htc_ps_restore(priv); - ath9k_htc_setpower(priv, ATH9K_PM_FULL_SLEEP); - - set_bit(OP_INVALID, &priv->op_flags); - - ath_dbg(common, CONFIG, "Driver halt\n"); - mutex_unlock(&priv->mutex); -} - -static int ath9k_htc_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ath9k_htc_priv *priv = hw->priv; - struct ath9k_htc_vif *avp = (void *)vif->drv_priv; - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_target_vif hvif; - int ret = 0; - u8 cmd_rsp; - - mutex_lock(&priv->mutex); - - ath9k_htc_ps_wakeup(priv); - memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif)); - memcpy(&hvif.myaddr, vif->addr, ETH_ALEN); - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - hvif.opmode = HTC_M_STA; - break; - case NL80211_IFTYPE_ADHOC: - hvif.opmode = HTC_M_IBSS; - break; - case NL80211_IFTYPE_AP: - hvif.opmode = HTC_M_HOSTAP; - break; - default: - ath_err(common, - "Interface type %d not yet supported\n", vif->type); - ret = -EOPNOTSUPP; - goto out; - } - - /* Index starts from zero on the target */ - avp->index = hvif.index = ffz(priv->vif_slot); - hvif.rtsthreshold = cpu_to_be16(2304); - WMI_CMD_BUF(WMI_VAP_CREATE_CMDID, &hvif); - if (ret) - goto out; - - /* - * We need a node in target to tx mgmt frames - * before association. - */ - ret = ath9k_htc_add_station(priv, vif, NULL); - if (ret) { - WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif); - goto out; - } - - ath9k_htc_set_mac_bssid_mask(priv, vif); - - priv->vif_slot |= (1 << avp->index); - priv->nvifs++; - - INC_VIF(priv, vif->type); - - if ((vif->type == NL80211_IFTYPE_AP) || - (vif->type == NL80211_IFTYPE_ADHOC)) - ath9k_htc_assign_bslot(priv, vif); - - ath9k_htc_set_opmode(priv); - - if ((priv->ah->opmode == NL80211_IFTYPE_AP) && - !test_bit(OP_ANI_RUNNING, &priv->op_flags)) { - ath9k_hw_set_tsfadjust(priv->ah, true); - ath9k_htc_start_ani(priv); - } - - ath_dbg(common, CONFIG, "Attach a VIF of type: %d at idx: %d\n", - vif->type, avp->index); - -out: - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); - - return ret; -} - -static void ath9k_htc_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ath9k_htc_priv *priv = hw->priv; - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_vif *avp = (void *)vif->drv_priv; - struct ath9k_htc_target_vif hvif; - int ret = 0; - u8 cmd_rsp; - - mutex_lock(&priv->mutex); - ath9k_htc_ps_wakeup(priv); - - memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif)); - memcpy(&hvif.myaddr, vif->addr, ETH_ALEN); - hvif.index = avp->index; - WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif); - if (ret) { - ath_err(common, "Unable to remove interface at idx: %d\n", - avp->index); - } - priv->nvifs--; - priv->vif_slot &= ~(1 << avp->index); - - ath9k_htc_remove_station(priv, vif, NULL); - - DEC_VIF(priv, vif->type); - - if ((vif->type == NL80211_IFTYPE_AP) || - (vif->type == NL80211_IFTYPE_ADHOC)) - ath9k_htc_remove_bslot(priv, vif); - - ath9k_htc_set_opmode(priv); - - ath9k_htc_set_mac_bssid_mask(priv, vif); - - /* - * Stop ANI only if there are no associated station interfaces. - */ - if ((vif->type == NL80211_IFTYPE_AP) && (priv->num_ap_vif == 0)) { - priv->rearm_ani = false; - ieee80211_iterate_active_interfaces_atomic( - priv->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - ath9k_htc_vif_iter, priv); - if (!priv->rearm_ani) - ath9k_htc_stop_ani(priv); - } - - ath_dbg(common, CONFIG, "Detach Interface at idx: %d\n", avp->index); - - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); -} - -static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed) -{ - struct ath9k_htc_priv *priv = hw->priv; - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ieee80211_conf *conf = &hw->conf; - bool chip_reset = false; - int ret = 0; - - mutex_lock(&priv->mutex); - ath9k_htc_ps_wakeup(priv); - - if (changed & IEEE80211_CONF_CHANGE_IDLE) { - mutex_lock(&priv->htc_pm_lock); - - priv->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE); - if (!priv->ps_idle) - chip_reset = true; - - mutex_unlock(&priv->htc_pm_lock); - } - - /* - * Monitor interface should be added before - * IEEE80211_CONF_CHANGE_CHANNEL is handled. - */ - if (changed & IEEE80211_CONF_CHANGE_MONITOR) { - if ((conf->flags & IEEE80211_CONF_MONITOR) && - !priv->ah->is_monitoring) - ath9k_htc_add_monitor_interface(priv); - else if (priv->ah->is_monitoring) - ath9k_htc_remove_monitor_interface(priv); - } - - if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || chip_reset) { - struct ieee80211_channel *curchan = hw->conf.chandef.chan; - enum nl80211_channel_type channel_type = - cfg80211_get_chandef_type(&hw->conf.chandef); - int pos = curchan->hw_value; - - ath_dbg(common, CONFIG, "Set channel: %d MHz\n", - curchan->center_freq); - - ath9k_cmn_update_ichannel(&priv->ah->channels[pos], - hw->conf.chandef.chan, - channel_type); - - if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) { - ath_err(common, "Unable to set channel\n"); - ret = -EINVAL; - goto out; - } - - } - - if (changed & IEEE80211_CONF_CHANGE_PS) { - if (conf->flags & IEEE80211_CONF_PS) { - ath9k_htc_setpower(priv, ATH9K_PM_NETWORK_SLEEP); - priv->ps_enabled = true; - } else { - priv->ps_enabled = false; - cancel_work_sync(&priv->ps_work); - ath9k_htc_setpower(priv, ATH9K_PM_AWAKE); - } - } - - if (changed & IEEE80211_CONF_CHANGE_POWER) { - priv->txpowlimit = 2 * conf->power_level; - ath9k_cmn_update_txpow(priv->ah, priv->curtxpow, - priv->txpowlimit, &priv->curtxpow); - } - -out: - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); - return ret; -} - -#define SUPPORTED_FILTERS \ - (FIF_PROMISC_IN_BSS | \ - FIF_ALLMULTI | \ - FIF_CONTROL | \ - FIF_PSPOLL | \ - FIF_OTHER_BSS | \ - FIF_BCN_PRBRESP_PROMISC | \ - FIF_PROBE_REQ | \ - FIF_FCSFAIL) - -static void ath9k_htc_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast) -{ - struct ath9k_htc_priv *priv = hw->priv; - u32 rfilt; - - mutex_lock(&priv->mutex); - changed_flags &= SUPPORTED_FILTERS; - *total_flags &= SUPPORTED_FILTERS; - - if (test_bit(OP_INVALID, &priv->op_flags)) { - ath_dbg(ath9k_hw_common(priv->ah), ANY, - "Unable to configure filter on invalid state\n"); - mutex_unlock(&priv->mutex); - return; - } - ath9k_htc_ps_wakeup(priv); - - priv->rxfilter = *total_flags; - rfilt = ath9k_htc_calcrxfilter(priv); - ath9k_hw_setrxfilter(priv->ah, rfilt); - - ath_dbg(ath9k_hw_common(priv->ah), CONFIG, "Set HW RX filter: 0x%x\n", - rfilt); - - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); -} - -static int ath9k_htc_sta_add(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct ath9k_htc_priv *priv = hw->priv; - int ret; - - mutex_lock(&priv->mutex); - ath9k_htc_ps_wakeup(priv); - ret = ath9k_htc_add_station(priv, vif, sta); - if (!ret) - ath9k_htc_init_rate(priv, sta); - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); - - return ret; -} - -static int ath9k_htc_sta_remove(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct ath9k_htc_priv *priv = hw->priv; - struct ath9k_htc_sta *ista; - int ret; - - mutex_lock(&priv->mutex); - ath9k_htc_ps_wakeup(priv); - ista = (struct ath9k_htc_sta *) sta->drv_priv; - htc_sta_drain(priv->htc, ista->index); - ret = ath9k_htc_remove_station(priv, vif, sta); - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); - - return ret; -} - -static void ath9k_htc_sta_rc_update(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u32 changed) -{ - struct ath9k_htc_priv *priv = hw->priv; - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_target_rate trate; - - mutex_lock(&priv->mutex); - ath9k_htc_ps_wakeup(priv); - - if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) { - memset(&trate, 0, sizeof(struct ath9k_htc_target_rate)); - ath9k_htc_setup_rate(priv, sta, &trate); - if (!ath9k_htc_send_rate_cmd(priv, &trate)) - ath_dbg(common, CONFIG, - "Supported rates for sta: %pM updated, rate caps: 0x%X\n", - sta->addr, be32_to_cpu(trate.capflags)); - else - ath_dbg(common, CONFIG, - "Unable to update supported rates for sta: %pM\n", - sta->addr); - } - - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); -} - -static int ath9k_htc_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - struct ath9k_htc_priv *priv = hw->priv; - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_tx_queue_info qi; - int ret = 0, qnum; - - if (queue >= IEEE80211_NUM_ACS) - return 0; - - mutex_lock(&priv->mutex); - ath9k_htc_ps_wakeup(priv); - - memset(&qi, 0, sizeof(struct ath9k_tx_queue_info)); - - qi.tqi_aifs = params->aifs; - qi.tqi_cwmin = params->cw_min; - qi.tqi_cwmax = params->cw_max; - qi.tqi_burstTime = params->txop * 32; - - qnum = get_hw_qnum(queue, priv->hwq_map); - - ath_dbg(common, CONFIG, - "Configure tx [queue/hwq] [%d/%d], aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n", - queue, qnum, params->aifs, params->cw_min, - params->cw_max, params->txop); - - ret = ath_htc_txq_update(priv, qnum, &qi); - if (ret) { - ath_err(common, "TXQ Update failed\n"); - goto out; - } - - if ((priv->ah->opmode == NL80211_IFTYPE_ADHOC) && - (qnum == priv->hwq_map[IEEE80211_AC_BE])) - ath9k_htc_beaconq_config(priv); -out: - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); - - return ret; -} - -static int ath9k_htc_set_key(struct ieee80211_hw *hw, - enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct ath9k_htc_priv *priv = hw->priv; - struct ath_common *common = ath9k_hw_common(priv->ah); - int ret = 0; - - if (htc_modparam_nohwcrypt) - return -ENOSPC; - - if ((vif->type == NL80211_IFTYPE_ADHOC || - vif->type == NL80211_IFTYPE_MESH_POINT) && - (key->cipher == WLAN_CIPHER_SUITE_TKIP || - key->cipher == WLAN_CIPHER_SUITE_CCMP) && - !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { - /* - * For now, disable hw crypto for the RSN IBSS group keys. This - * could be optimized in the future to use a modified key cache - * design to support per-STA RX GTK, but until that gets - * implemented, use of software crypto for group addressed - * frames is a acceptable to allow RSN IBSS to be used. - */ - return -EOPNOTSUPP; - } - - mutex_lock(&priv->mutex); - ath_dbg(common, CONFIG, "Set HW Key\n"); - ath9k_htc_ps_wakeup(priv); - - switch (cmd) { - case SET_KEY: - ret = ath_key_config(common, vif, sta, key); - if (ret >= 0) { - key->hw_key_idx = ret; - /* push IV and Michael MIC generation to stack */ - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - if (key->cipher == WLAN_CIPHER_SUITE_TKIP) - key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; - if (priv->ah->sw_mgmt_crypto && - key->cipher == WLAN_CIPHER_SUITE_CCMP) - key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; - ret = 0; - } - break; - case DISABLE_KEY: - ath_key_delete(common, key); - break; - default: - ret = -EINVAL; - } - - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); - - return ret; -} - -static void ath9k_htc_set_bssid(struct ath9k_htc_priv *priv) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - - ath9k_hw_write_associd(priv->ah); - ath_dbg(common, CONFIG, "BSSID: %pM aid: 0x%x\n", - common->curbssid, common->curaid); -} - -static void ath9k_htc_bss_iter(void *data, u8 *mac, struct ieee80211_vif *vif) -{ - struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data; - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; - - if ((vif->type == NL80211_IFTYPE_STATION) && bss_conf->assoc) { - common->curaid = bss_conf->aid; - memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); - } -} - -static void ath9k_htc_choose_set_bssid(struct ath9k_htc_priv *priv) -{ - if (priv->num_sta_assoc_vif == 1) { - ieee80211_iterate_active_interfaces_atomic( - priv->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - ath9k_htc_bss_iter, priv); - ath9k_htc_set_bssid(priv); - } -} - -static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changed) -{ - struct ath9k_htc_priv *priv = hw->priv; - struct ath_hw *ah = priv->ah; - struct ath_common *common = ath9k_hw_common(ah); - - mutex_lock(&priv->mutex); - ath9k_htc_ps_wakeup(priv); - - if (changed & BSS_CHANGED_ASSOC) { - ath_dbg(common, CONFIG, "BSS Changed ASSOC %d\n", - bss_conf->assoc); - - bss_conf->assoc ? - priv->num_sta_assoc_vif++ : priv->num_sta_assoc_vif--; - - if (priv->ah->opmode == NL80211_IFTYPE_STATION) { - ath9k_htc_choose_set_bssid(priv); - if (bss_conf->assoc && (priv->num_sta_assoc_vif == 1)) - ath9k_htc_start_ani(priv); - else if (priv->num_sta_assoc_vif == 0) - ath9k_htc_stop_ani(priv); - } - } - - if (changed & BSS_CHANGED_IBSS) { - if (priv->ah->opmode == NL80211_IFTYPE_ADHOC) { - common->curaid = bss_conf->aid; - memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); - ath9k_htc_set_bssid(priv); - } - } - - if ((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon) { - ath_dbg(common, CONFIG, "Beacon enabled for BSS: %pM\n", - bss_conf->bssid); - ath9k_htc_set_tsfadjust(priv, vif); - set_bit(OP_ENABLE_BEACON, &priv->op_flags); - ath9k_htc_beacon_config(priv, vif); - } - - if ((changed & BSS_CHANGED_BEACON_ENABLED) && !bss_conf->enable_beacon) { - /* - * Disable SWBA interrupt only if there are no - * AP/IBSS interfaces. - */ - if ((priv->num_ap_vif <= 1) || priv->num_ibss_vif) { - ath_dbg(common, CONFIG, - "Beacon disabled for BSS: %pM\n", - bss_conf->bssid); - clear_bit(OP_ENABLE_BEACON, &priv->op_flags); - ath9k_htc_beacon_config(priv, vif); - } - } - - if (changed & BSS_CHANGED_BEACON_INT) { - /* - * Reset the HW TSF for the first AP interface. - */ - if ((priv->ah->opmode == NL80211_IFTYPE_AP) && - (priv->nvifs == 1) && - (priv->num_ap_vif == 1) && - (vif->type == NL80211_IFTYPE_AP)) { - set_bit(OP_TSF_RESET, &priv->op_flags); - } - ath_dbg(common, CONFIG, - "Beacon interval changed for BSS: %pM\n", - bss_conf->bssid); - ath9k_htc_beacon_config(priv, vif); - } - - if (changed & BSS_CHANGED_ERP_SLOT) { - if (bss_conf->use_short_slot) - ah->slottime = 9; - else - ah->slottime = 20; - - ath9k_hw_init_global_settings(ah); - } - - if (changed & BSS_CHANGED_HT) - ath9k_htc_update_rate(priv, vif, bss_conf); - - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); -} - -static u64 ath9k_htc_get_tsf(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ath9k_htc_priv *priv = hw->priv; - u64 tsf; - - mutex_lock(&priv->mutex); - ath9k_htc_ps_wakeup(priv); - tsf = ath9k_hw_gettsf64(priv->ah); - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); - - return tsf; -} - -static void ath9k_htc_set_tsf(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u64 tsf) -{ - struct ath9k_htc_priv *priv = hw->priv; - - mutex_lock(&priv->mutex); - ath9k_htc_ps_wakeup(priv); - ath9k_hw_settsf64(priv->ah, tsf); - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); -} - -static void ath9k_htc_reset_tsf(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ath9k_htc_priv *priv = hw->priv; - - mutex_lock(&priv->mutex); - ath9k_htc_ps_wakeup(priv); - ath9k_hw_reset_tsf(priv->ah); - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); -} - -static int ath9k_htc_ampdu_action(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, - u16 tid, u16 *ssn, u8 buf_size) -{ - struct ath9k_htc_priv *priv = hw->priv; - struct ath9k_htc_sta *ista; - int ret = 0; - - mutex_lock(&priv->mutex); - ath9k_htc_ps_wakeup(priv); - - switch (action) { - case IEEE80211_AMPDU_RX_START: - break; - case IEEE80211_AMPDU_RX_STOP: - break; - case IEEE80211_AMPDU_TX_START: - ret = ath9k_htc_tx_aggr_oper(priv, vif, sta, action, tid); - if (!ret) - ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); - break; - case IEEE80211_AMPDU_TX_STOP_CONT: - case IEEE80211_AMPDU_TX_STOP_FLUSH: - case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: - ath9k_htc_tx_aggr_oper(priv, vif, sta, action, tid); - ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); - break; - case IEEE80211_AMPDU_TX_OPERATIONAL: - ista = (struct ath9k_htc_sta *) sta->drv_priv; - spin_lock_bh(&priv->tx.tx_lock); - ista->tid_state[tid] = AGGR_OPERATIONAL; - spin_unlock_bh(&priv->tx.tx_lock); - break; - default: - ath_err(ath9k_hw_common(priv->ah), "Unknown AMPDU action\n"); - } - - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); - - return ret; -} - -static void ath9k_htc_sw_scan_start(struct ieee80211_hw *hw) -{ - struct ath9k_htc_priv *priv = hw->priv; - - mutex_lock(&priv->mutex); - spin_lock_bh(&priv->beacon_lock); - set_bit(OP_SCANNING, &priv->op_flags); - spin_unlock_bh(&priv->beacon_lock); - cancel_work_sync(&priv->ps_work); - ath9k_htc_stop_ani(priv); - mutex_unlock(&priv->mutex); -} - -static void ath9k_htc_sw_scan_complete(struct ieee80211_hw *hw) -{ - struct ath9k_htc_priv *priv = hw->priv; - - mutex_lock(&priv->mutex); - spin_lock_bh(&priv->beacon_lock); - clear_bit(OP_SCANNING, &priv->op_flags); - spin_unlock_bh(&priv->beacon_lock); - ath9k_htc_ps_wakeup(priv); - ath9k_htc_vif_reconfig(priv); - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); -} - -static int ath9k_htc_set_rts_threshold(struct ieee80211_hw *hw, u32 value) -{ - return 0; -} - -static void ath9k_htc_set_coverage_class(struct ieee80211_hw *hw, - u8 coverage_class) -{ - struct ath9k_htc_priv *priv = hw->priv; - - mutex_lock(&priv->mutex); - ath9k_htc_ps_wakeup(priv); - priv->ah->coverage_class = coverage_class; - ath9k_hw_init_global_settings(priv->ah); - ath9k_htc_ps_restore(priv); - mutex_unlock(&priv->mutex); -} - -/* - * Currently, this is used only for selecting the minimum rate - * for management frames, rate selection for data frames remain - * unaffected. - */ -static int ath9k_htc_set_bitrate_mask(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - const struct cfg80211_bitrate_mask *mask) -{ - struct ath9k_htc_priv *priv = hw->priv; - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_target_rate_mask tmask; - struct ath9k_htc_vif *avp = (void *)vif->drv_priv; - int ret = 0; - u8 cmd_rsp; - - memset(&tmask, 0, sizeof(struct ath9k_htc_target_rate_mask)); - - tmask.vif_index = avp->index; - tmask.band = IEEE80211_BAND_2GHZ; - tmask.mask = cpu_to_be32(mask->control[IEEE80211_BAND_2GHZ].legacy); - - WMI_CMD_BUF(WMI_BITRATE_MASK_CMDID, &tmask); - if (ret) { - ath_err(common, - "Unable to set 2G rate mask for " - "interface at idx: %d\n", avp->index); - goto out; - } - - tmask.band = IEEE80211_BAND_5GHZ; - tmask.mask = cpu_to_be32(mask->control[IEEE80211_BAND_5GHZ].legacy); - - WMI_CMD_BUF(WMI_BITRATE_MASK_CMDID, &tmask); - if (ret) { - ath_err(common, - "Unable to set 5G rate mask for " - "interface at idx: %d\n", avp->index); - goto out; - } - - ath_dbg(common, CONFIG, "Set bitrate masks: 0x%x, 0x%x\n", - mask->control[IEEE80211_BAND_2GHZ].legacy, - mask->control[IEEE80211_BAND_5GHZ].legacy); -out: - return ret; -} - - -static int ath9k_htc_get_stats(struct ieee80211_hw *hw, - struct ieee80211_low_level_stats *stats) -{ - struct ath9k_htc_priv *priv = hw->priv; - struct ath_hw *ah = priv->ah; - struct ath9k_mib_stats *mib_stats = &ah->ah_mibStats; - - stats->dot11ACKFailureCount = mib_stats->ackrcv_bad; - stats->dot11RTSFailureCount = mib_stats->rts_bad; - stats->dot11FCSErrorCount = mib_stats->fcs_bad; - stats->dot11RTSSuccessCount = mib_stats->rts_good; - - return 0; -} - -struct ieee80211_ops ath9k_htc_ops = { - .tx = ath9k_htc_tx, - .start = ath9k_htc_start, - .stop = ath9k_htc_stop, - .add_interface = ath9k_htc_add_interface, - .remove_interface = ath9k_htc_remove_interface, - .config = ath9k_htc_config, - .configure_filter = ath9k_htc_configure_filter, - .sta_add = ath9k_htc_sta_add, - .sta_remove = ath9k_htc_sta_remove, - .conf_tx = ath9k_htc_conf_tx, - .sta_rc_update = ath9k_htc_sta_rc_update, - .bss_info_changed = ath9k_htc_bss_info_changed, - .set_key = ath9k_htc_set_key, - .get_tsf = ath9k_htc_get_tsf, - .set_tsf = ath9k_htc_set_tsf, - .reset_tsf = ath9k_htc_reset_tsf, - .ampdu_action = ath9k_htc_ampdu_action, - .sw_scan_start = ath9k_htc_sw_scan_start, - .sw_scan_complete = ath9k_htc_sw_scan_complete, - .set_rts_threshold = ath9k_htc_set_rts_threshold, - .rfkill_poll = ath9k_htc_rfkill_poll_state, - .set_coverage_class = ath9k_htc_set_coverage_class, - .set_bitrate_mask = ath9k_htc_set_bitrate_mask, - .get_stats = ath9k_htc_get_stats, -}; diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c deleted file mode 100644 index 417a089cd7e1..000000000000 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ /dev/null @@ -1,1230 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "htc.h" - -/******/ -/* TX */ -/******/ - -static const int subtype_txq_to_hwq[] = { - [IEEE80211_AC_BE] = ATH_TXQ_AC_BE, - [IEEE80211_AC_BK] = ATH_TXQ_AC_BK, - [IEEE80211_AC_VI] = ATH_TXQ_AC_VI, - [IEEE80211_AC_VO] = ATH_TXQ_AC_VO, -}; - -#define ATH9K_HTC_INIT_TXQ(subtype) do { \ - qi.tqi_subtype = subtype_txq_to_hwq[subtype]; \ - qi.tqi_aifs = ATH9K_TXQ_USEDEFAULT; \ - qi.tqi_cwmin = ATH9K_TXQ_USEDEFAULT; \ - qi.tqi_cwmax = ATH9K_TXQ_USEDEFAULT; \ - qi.tqi_physCompBuf = 0; \ - qi.tqi_qflags = TXQ_FLAG_TXEOLINT_ENABLE | \ - TXQ_FLAG_TXDESCINT_ENABLE; \ - } while (0) - -int get_hw_qnum(u16 queue, int *hwq_map) -{ - switch (queue) { - case 0: - return hwq_map[IEEE80211_AC_VO]; - case 1: - return hwq_map[IEEE80211_AC_VI]; - case 2: - return hwq_map[IEEE80211_AC_BE]; - case 3: - return hwq_map[IEEE80211_AC_BK]; - default: - return hwq_map[IEEE80211_AC_BE]; - } -} - -void ath9k_htc_check_stop_queues(struct ath9k_htc_priv *priv) -{ - spin_lock_bh(&priv->tx.tx_lock); - priv->tx.queued_cnt++; - if ((priv->tx.queued_cnt >= ATH9K_HTC_TX_THRESHOLD) && - !(priv->tx.flags & ATH9K_HTC_OP_TX_QUEUES_STOP)) { - priv->tx.flags |= ATH9K_HTC_OP_TX_QUEUES_STOP; - ieee80211_stop_queues(priv->hw); - } - spin_unlock_bh(&priv->tx.tx_lock); -} - -void ath9k_htc_check_wake_queues(struct ath9k_htc_priv *priv) -{ - spin_lock_bh(&priv->tx.tx_lock); - if ((priv->tx.queued_cnt < ATH9K_HTC_TX_THRESHOLD) && - (priv->tx.flags & ATH9K_HTC_OP_TX_QUEUES_STOP)) { - priv->tx.flags &= ~ATH9K_HTC_OP_TX_QUEUES_STOP; - ieee80211_wake_queues(priv->hw); - } - spin_unlock_bh(&priv->tx.tx_lock); -} - -int ath9k_htc_tx_get_slot(struct ath9k_htc_priv *priv) -{ - int slot; - - spin_lock_bh(&priv->tx.tx_lock); - slot = find_first_zero_bit(priv->tx.tx_slot, MAX_TX_BUF_NUM); - if (slot >= MAX_TX_BUF_NUM) { - spin_unlock_bh(&priv->tx.tx_lock); - return -ENOBUFS; - } - __set_bit(slot, priv->tx.tx_slot); - spin_unlock_bh(&priv->tx.tx_lock); - - return slot; -} - -void ath9k_htc_tx_clear_slot(struct ath9k_htc_priv *priv, int slot) -{ - spin_lock_bh(&priv->tx.tx_lock); - __clear_bit(slot, priv->tx.tx_slot); - spin_unlock_bh(&priv->tx.tx_lock); -} - -static inline enum htc_endpoint_id get_htc_epid(struct ath9k_htc_priv *priv, - u16 qnum) -{ - enum htc_endpoint_id epid; - - switch (qnum) { - case 0: - TX_QSTAT_INC(IEEE80211_AC_VO); - epid = priv->data_vo_ep; - break; - case 1: - TX_QSTAT_INC(IEEE80211_AC_VI); - epid = priv->data_vi_ep; - break; - case 2: - TX_QSTAT_INC(IEEE80211_AC_BE); - epid = priv->data_be_ep; - break; - case 3: - default: - TX_QSTAT_INC(IEEE80211_AC_BK); - epid = priv->data_bk_ep; - break; - } - - return epid; -} - -static inline struct sk_buff_head* -get_htc_epid_queue(struct ath9k_htc_priv *priv, u8 epid) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct sk_buff_head *epid_queue = NULL; - - if (epid == priv->mgmt_ep) - epid_queue = &priv->tx.mgmt_ep_queue; - else if (epid == priv->cab_ep) - epid_queue = &priv->tx.cab_ep_queue; - else if (epid == priv->data_be_ep) - epid_queue = &priv->tx.data_be_queue; - else if (epid == priv->data_bk_ep) - epid_queue = &priv->tx.data_bk_queue; - else if (epid == priv->data_vi_ep) - epid_queue = &priv->tx.data_vi_queue; - else if (epid == priv->data_vo_ep) - epid_queue = &priv->tx.data_vo_queue; - else - ath_err(common, "Invalid EPID: %d\n", epid); - - return epid_queue; -} - -/* - * Removes the driver header and returns the TX slot number - */ -static inline int strip_drv_header(struct ath9k_htc_priv *priv, - struct sk_buff *skb) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_tx_ctl *tx_ctl; - int slot; - - tx_ctl = HTC_SKB_CB(skb); - - if (tx_ctl->epid == priv->mgmt_ep) { - struct tx_mgmt_hdr *tx_mhdr = - (struct tx_mgmt_hdr *)skb->data; - slot = tx_mhdr->cookie; - skb_pull(skb, sizeof(struct tx_mgmt_hdr)); - } else if ((tx_ctl->epid == priv->data_bk_ep) || - (tx_ctl->epid == priv->data_be_ep) || - (tx_ctl->epid == priv->data_vi_ep) || - (tx_ctl->epid == priv->data_vo_ep) || - (tx_ctl->epid == priv->cab_ep)) { - struct tx_frame_hdr *tx_fhdr = - (struct tx_frame_hdr *)skb->data; - slot = tx_fhdr->cookie; - skb_pull(skb, sizeof(struct tx_frame_hdr)); - } else { - ath_err(common, "Unsupported EPID: %d\n", tx_ctl->epid); - slot = -EINVAL; - } - - return slot; -} - -int ath_htc_txq_update(struct ath9k_htc_priv *priv, int qnum, - struct ath9k_tx_queue_info *qinfo) -{ - struct ath_hw *ah = priv->ah; - int error = 0; - struct ath9k_tx_queue_info qi; - - ath9k_hw_get_txq_props(ah, qnum, &qi); - - qi.tqi_aifs = qinfo->tqi_aifs; - qi.tqi_cwmin = qinfo->tqi_cwmin / 2; /* XXX */ - qi.tqi_cwmax = qinfo->tqi_cwmax; - qi.tqi_burstTime = qinfo->tqi_burstTime; - qi.tqi_readyTime = qinfo->tqi_readyTime; - - if (!ath9k_hw_set_txq_props(ah, qnum, &qi)) { - ath_err(ath9k_hw_common(ah), - "Unable to update hardware queue %u!\n", qnum); - error = -EIO; - } else { - ath9k_hw_resettxqueue(ah, qnum); - } - - return error; -} - -static void ath9k_htc_tx_mgmt(struct ath9k_htc_priv *priv, - struct ath9k_htc_vif *avp, - struct sk_buff *skb, - u8 sta_idx, u8 vif_idx, u8 slot) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_mgmt *mgmt; - struct ieee80211_hdr *hdr; - struct tx_mgmt_hdr mgmt_hdr; - struct ath9k_htc_tx_ctl *tx_ctl; - u8 *tx_fhdr; - - tx_ctl = HTC_SKB_CB(skb); - hdr = (struct ieee80211_hdr *) skb->data; - - memset(tx_ctl, 0, sizeof(*tx_ctl)); - memset(&mgmt_hdr, 0, sizeof(struct tx_mgmt_hdr)); - - /* - * Set the TSF adjust value for probe response - * frame also. - */ - if (avp && unlikely(ieee80211_is_probe_resp(hdr->frame_control))) { - mgmt = (struct ieee80211_mgmt *)skb->data; - mgmt->u.probe_resp.timestamp = avp->tsfadjust; - } - - tx_ctl->type = ATH9K_HTC_MGMT; - - mgmt_hdr.node_idx = sta_idx; - mgmt_hdr.vif_idx = vif_idx; - mgmt_hdr.tidno = 0; - mgmt_hdr.flags = 0; - mgmt_hdr.cookie = slot; - - mgmt_hdr.key_type = ath9k_cmn_get_hw_crypto_keytype(skb); - if (mgmt_hdr.key_type == ATH9K_KEY_TYPE_CLEAR) - mgmt_hdr.keyix = (u8) ATH9K_TXKEYIX_INVALID; - else - mgmt_hdr.keyix = tx_info->control.hw_key->hw_key_idx; - - tx_fhdr = skb_push(skb, sizeof(mgmt_hdr)); - memcpy(tx_fhdr, (u8 *) &mgmt_hdr, sizeof(mgmt_hdr)); - tx_ctl->epid = priv->mgmt_ep; -} - -static void ath9k_htc_tx_data(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif, - struct sk_buff *skb, - u8 sta_idx, u8 vif_idx, u8 slot, - bool is_cab) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr; - struct ath9k_htc_tx_ctl *tx_ctl; - struct tx_frame_hdr tx_hdr; - u32 flags = 0; - u8 *qc, *tx_fhdr; - u16 qnum; - - tx_ctl = HTC_SKB_CB(skb); - hdr = (struct ieee80211_hdr *) skb->data; - - memset(tx_ctl, 0, sizeof(*tx_ctl)); - memset(&tx_hdr, 0, sizeof(struct tx_frame_hdr)); - - tx_hdr.node_idx = sta_idx; - tx_hdr.vif_idx = vif_idx; - tx_hdr.cookie = slot; - - /* - * This is a bit redundant but it helps to get - * the per-packet index quickly when draining the - * TX queue in the HIF layer. Otherwise we would - * have to parse the packet contents ... - */ - tx_ctl->sta_idx = sta_idx; - - if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { - tx_ctl->type = ATH9K_HTC_AMPDU; - tx_hdr.data_type = ATH9K_HTC_AMPDU; - } else { - tx_ctl->type = ATH9K_HTC_NORMAL; - tx_hdr.data_type = ATH9K_HTC_NORMAL; - } - - if (ieee80211_is_data_qos(hdr->frame_control)) { - qc = ieee80211_get_qos_ctl(hdr); - tx_hdr.tidno = qc[0] & IEEE80211_QOS_CTL_TID_MASK; - } - - /* Check for RTS protection */ - if (priv->hw->wiphy->rts_threshold != (u32) -1) - if (skb->len > priv->hw->wiphy->rts_threshold) - flags |= ATH9K_HTC_TX_RTSCTS; - - /* CTS-to-self */ - if (!(flags & ATH9K_HTC_TX_RTSCTS) && - (vif && vif->bss_conf.use_cts_prot)) - flags |= ATH9K_HTC_TX_CTSONLY; - - tx_hdr.flags = cpu_to_be32(flags); - tx_hdr.key_type = ath9k_cmn_get_hw_crypto_keytype(skb); - if (tx_hdr.key_type == ATH9K_KEY_TYPE_CLEAR) - tx_hdr.keyix = (u8) ATH9K_TXKEYIX_INVALID; - else - tx_hdr.keyix = tx_info->control.hw_key->hw_key_idx; - - tx_fhdr = skb_push(skb, sizeof(tx_hdr)); - memcpy(tx_fhdr, (u8 *) &tx_hdr, sizeof(tx_hdr)); - - if (is_cab) { - CAB_STAT_INC; - tx_ctl->epid = priv->cab_ep; - return; - } - - qnum = skb_get_queue_mapping(skb); - tx_ctl->epid = get_htc_epid(priv, qnum); -} - -int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, - struct ieee80211_sta *sta, - struct sk_buff *skb, - u8 slot, bool is_cab) -{ - struct ieee80211_hdr *hdr; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_vif *vif = tx_info->control.vif; - struct ath9k_htc_sta *ista; - struct ath9k_htc_vif *avp = NULL; - u8 sta_idx, vif_idx; - - hdr = (struct ieee80211_hdr *) skb->data; - - /* - * Find out on which interface this packet has to be - * sent out. - */ - if (vif) { - avp = (struct ath9k_htc_vif *) vif->drv_priv; - vif_idx = avp->index; - } else { - if (!priv->ah->is_monitoring) { - ath_dbg(ath9k_hw_common(priv->ah), XMIT, - "VIF is null, but no monitor interface !\n"); - return -EINVAL; - } - - vif_idx = priv->mon_vif_idx; - } - - /* - * Find out which station this packet is destined for. - */ - if (sta) { - ista = (struct ath9k_htc_sta *) sta->drv_priv; - sta_idx = ista->index; - } else { - sta_idx = priv->vif_sta_pos[vif_idx]; - } - - if (ieee80211_is_data(hdr->frame_control)) - ath9k_htc_tx_data(priv, vif, skb, - sta_idx, vif_idx, slot, is_cab); - else - ath9k_htc_tx_mgmt(priv, avp, skb, - sta_idx, vif_idx, slot); - - - return htc_send(priv->htc, skb); -} - -static inline bool __ath9k_htc_check_tx_aggr(struct ath9k_htc_priv *priv, - struct ath9k_htc_sta *ista, u8 tid) -{ - bool ret = false; - - spin_lock_bh(&priv->tx.tx_lock); - if ((tid < ATH9K_HTC_MAX_TID) && (ista->tid_state[tid] == AGGR_STOP)) - ret = true; - spin_unlock_bh(&priv->tx.tx_lock); - - return ret; -} - -static void ath9k_htc_check_tx_aggr(struct ath9k_htc_priv *priv, - struct ieee80211_vif *vif, - struct sk_buff *skb) -{ - struct ieee80211_sta *sta; - struct ieee80211_hdr *hdr; - __le16 fc; - - hdr = (struct ieee80211_hdr *) skb->data; - fc = hdr->frame_control; - - rcu_read_lock(); - - sta = ieee80211_find_sta(vif, hdr->addr1); - if (!sta) { - rcu_read_unlock(); - return; - } - - if (sta && conf_is_ht(&priv->hw->conf) && - !(skb->protocol == cpu_to_be16(ETH_P_PAE))) { - if (ieee80211_is_data_qos(fc)) { - u8 *qc, tid; - struct ath9k_htc_sta *ista; - - qc = ieee80211_get_qos_ctl(hdr); - tid = qc[0] & 0xf; - ista = (struct ath9k_htc_sta *)sta->drv_priv; - if (__ath9k_htc_check_tx_aggr(priv, ista, tid)) { - ieee80211_start_tx_ba_session(sta, tid, 0); - spin_lock_bh(&priv->tx.tx_lock); - ista->tid_state[tid] = AGGR_PROGRESS; - spin_unlock_bh(&priv->tx.tx_lock); - } - } - } - - rcu_read_unlock(); -} - -static void ath9k_htc_tx_process(struct ath9k_htc_priv *priv, - struct sk_buff *skb, - struct __wmi_event_txstatus *txs) -{ - struct ieee80211_vif *vif; - struct ath9k_htc_tx_ctl *tx_ctl; - struct ieee80211_tx_info *tx_info; - struct ieee80211_tx_rate *rate; - struct ieee80211_conf *cur_conf = &priv->hw->conf; - bool txok; - int slot; - int hdrlen, padsize; - - slot = strip_drv_header(priv, skb); - if (slot < 0) { - dev_kfree_skb_any(skb); - return; - } - - tx_ctl = HTC_SKB_CB(skb); - txok = tx_ctl->txok; - tx_info = IEEE80211_SKB_CB(skb); - vif = tx_info->control.vif; - rate = &tx_info->status.rates[0]; - - memset(&tx_info->status, 0, sizeof(tx_info->status)); - - /* - * URB submission failed for this frame, it never reached - * the target. - */ - if (!txok || !vif || !txs) - goto send_mac80211; - - if (txs->ts_flags & ATH9K_HTC_TXSTAT_ACK) - tx_info->flags |= IEEE80211_TX_STAT_ACK; - - if (txs->ts_flags & ATH9K_HTC_TXSTAT_FILT) - tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; - - if (txs->ts_flags & ATH9K_HTC_TXSTAT_RTC_CTS) - rate->flags |= IEEE80211_TX_RC_USE_RTS_CTS; - - rate->count = 1; - rate->idx = MS(txs->ts_rate, ATH9K_HTC_TXSTAT_RATE); - - if (txs->ts_flags & ATH9K_HTC_TXSTAT_MCS) { - rate->flags |= IEEE80211_TX_RC_MCS; - - if (txs->ts_flags & ATH9K_HTC_TXSTAT_CW40) - rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; - if (txs->ts_flags & ATH9K_HTC_TXSTAT_SGI) - rate->flags |= IEEE80211_TX_RC_SHORT_GI; - } else { - if (cur_conf->chandef.chan->band == IEEE80211_BAND_5GHZ) - rate->idx += 4; /* No CCK rates */ - } - - ath9k_htc_check_tx_aggr(priv, vif, skb); - -send_mac80211: - spin_lock_bh(&priv->tx.tx_lock); - if (WARN_ON(--priv->tx.queued_cnt < 0)) - priv->tx.queued_cnt = 0; - spin_unlock_bh(&priv->tx.tx_lock); - - ath9k_htc_tx_clear_slot(priv, slot); - - /* Remove padding before handing frame back to mac80211 */ - hdrlen = ieee80211_get_hdrlen_from_skb(skb); - - padsize = hdrlen & 3; - if (padsize && skb->len > hdrlen + padsize) { - memmove(skb->data + padsize, skb->data, hdrlen); - skb_pull(skb, padsize); - } - - /* Send status to mac80211 */ - ieee80211_tx_status(priv->hw, skb); -} - -static inline void ath9k_htc_tx_drainq(struct ath9k_htc_priv *priv, - struct sk_buff_head *queue) -{ - struct sk_buff *skb; - - while ((skb = skb_dequeue(queue)) != NULL) { - ath9k_htc_tx_process(priv, skb, NULL); - } -} - -void ath9k_htc_tx_drain(struct ath9k_htc_priv *priv) -{ - struct ath9k_htc_tx_event *event, *tmp; - - spin_lock_bh(&priv->tx.tx_lock); - priv->tx.flags |= ATH9K_HTC_OP_TX_DRAIN; - spin_unlock_bh(&priv->tx.tx_lock); - - /* - * Ensure that all pending TX frames are flushed, - * and that the TX completion/failed tasklets is killed. - */ - htc_stop(priv->htc); - tasklet_kill(&priv->wmi->wmi_event_tasklet); - tasklet_kill(&priv->tx_failed_tasklet); - - ath9k_htc_tx_drainq(priv, &priv->tx.mgmt_ep_queue); - ath9k_htc_tx_drainq(priv, &priv->tx.cab_ep_queue); - ath9k_htc_tx_drainq(priv, &priv->tx.data_be_queue); - ath9k_htc_tx_drainq(priv, &priv->tx.data_bk_queue); - ath9k_htc_tx_drainq(priv, &priv->tx.data_vi_queue); - ath9k_htc_tx_drainq(priv, &priv->tx.data_vo_queue); - ath9k_htc_tx_drainq(priv, &priv->tx.tx_failed); - - /* - * The TX cleanup timer has already been killed. - */ - spin_lock_bh(&priv->wmi->event_lock); - list_for_each_entry_safe(event, tmp, &priv->wmi->pending_tx_events, list) { - list_del(&event->list); - kfree(event); - } - spin_unlock_bh(&priv->wmi->event_lock); - - spin_lock_bh(&priv->tx.tx_lock); - priv->tx.flags &= ~ATH9K_HTC_OP_TX_DRAIN; - spin_unlock_bh(&priv->tx.tx_lock); -} - -void ath9k_tx_failed_tasklet(unsigned long data) -{ - struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data; - - spin_lock_bh(&priv->tx.tx_lock); - if (priv->tx.flags & ATH9K_HTC_OP_TX_DRAIN) { - spin_unlock_bh(&priv->tx.tx_lock); - return; - } - spin_unlock_bh(&priv->tx.tx_lock); - - ath9k_htc_tx_drainq(priv, &priv->tx.tx_failed); -} - -static inline bool check_cookie(struct ath9k_htc_priv *priv, - struct sk_buff *skb, - u8 cookie, u8 epid) -{ - u8 fcookie = 0; - - if (epid == priv->mgmt_ep) { - struct tx_mgmt_hdr *hdr; - hdr = (struct tx_mgmt_hdr *) skb->data; - fcookie = hdr->cookie; - } else if ((epid == priv->data_bk_ep) || - (epid == priv->data_be_ep) || - (epid == priv->data_vi_ep) || - (epid == priv->data_vo_ep) || - (epid == priv->cab_ep)) { - struct tx_frame_hdr *hdr; - hdr = (struct tx_frame_hdr *) skb->data; - fcookie = hdr->cookie; - } - - if (fcookie == cookie) - return true; - - return false; -} - -static struct sk_buff* ath9k_htc_tx_get_packet(struct ath9k_htc_priv *priv, - struct __wmi_event_txstatus *txs) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct sk_buff_head *epid_queue; - struct sk_buff *skb, *tmp; - unsigned long flags; - u8 epid = MS(txs->ts_rate, ATH9K_HTC_TXSTAT_EPID); - - epid_queue = get_htc_epid_queue(priv, epid); - if (!epid_queue) - return NULL; - - spin_lock_irqsave(&epid_queue->lock, flags); - skb_queue_walk_safe(epid_queue, skb, tmp) { - if (check_cookie(priv, skb, txs->cookie, epid)) { - __skb_unlink(skb, epid_queue); - spin_unlock_irqrestore(&epid_queue->lock, flags); - return skb; - } - } - spin_unlock_irqrestore(&epid_queue->lock, flags); - - ath_dbg(common, XMIT, "No matching packet for cookie: %d, epid: %d\n", - txs->cookie, epid); - - return NULL; -} - -void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event) -{ - struct wmi_event_txstatus *txs = (struct wmi_event_txstatus *)wmi_event; - struct __wmi_event_txstatus *__txs; - struct sk_buff *skb; - struct ath9k_htc_tx_event *tx_pend; - int i; - - for (i = 0; i < txs->cnt; i++) { - WARN_ON(txs->cnt > HTC_MAX_TX_STATUS); - - __txs = &txs->txstatus[i]; - - skb = ath9k_htc_tx_get_packet(priv, __txs); - if (!skb) { - /* - * Store this event, so that the TX cleanup - * routine can check later for the needed packet. - */ - tx_pend = kzalloc(sizeof(struct ath9k_htc_tx_event), - GFP_ATOMIC); - if (!tx_pend) - continue; - - memcpy(&tx_pend->txs, __txs, - sizeof(struct __wmi_event_txstatus)); - - spin_lock(&priv->wmi->event_lock); - list_add_tail(&tx_pend->list, - &priv->wmi->pending_tx_events); - spin_unlock(&priv->wmi->event_lock); - - continue; - } - - ath9k_htc_tx_process(priv, skb, __txs); - } - - /* Wake TX queues if needed */ - ath9k_htc_check_wake_queues(priv); -} - -void ath9k_htc_txep(void *drv_priv, struct sk_buff *skb, - enum htc_endpoint_id ep_id, bool txok) -{ - struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) drv_priv; - struct ath9k_htc_tx_ctl *tx_ctl; - struct sk_buff_head *epid_queue; - - tx_ctl = HTC_SKB_CB(skb); - tx_ctl->txok = txok; - tx_ctl->timestamp = jiffies; - - if (!txok) { - skb_queue_tail(&priv->tx.tx_failed, skb); - tasklet_schedule(&priv->tx_failed_tasklet); - return; - } - - epid_queue = get_htc_epid_queue(priv, ep_id); - if (!epid_queue) { - dev_kfree_skb_any(skb); - return; - } - - skb_queue_tail(epid_queue, skb); -} - -static inline bool check_packet(struct ath9k_htc_priv *priv, struct sk_buff *skb) -{ - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_tx_ctl *tx_ctl; - - tx_ctl = HTC_SKB_CB(skb); - - if (time_after(jiffies, - tx_ctl->timestamp + - msecs_to_jiffies(ATH9K_HTC_TX_TIMEOUT_INTERVAL))) { - ath_dbg(common, XMIT, "Dropping a packet due to TX timeout\n"); - return true; - } - - return false; -} - -static void ath9k_htc_tx_cleanup_queue(struct ath9k_htc_priv *priv, - struct sk_buff_head *epid_queue) -{ - bool process = false; - unsigned long flags; - struct sk_buff *skb, *tmp; - struct sk_buff_head queue; - - skb_queue_head_init(&queue); - - spin_lock_irqsave(&epid_queue->lock, flags); - skb_queue_walk_safe(epid_queue, skb, tmp) { - if (check_packet(priv, skb)) { - __skb_unlink(skb, epid_queue); - __skb_queue_tail(&queue, skb); - process = true; - } - } - spin_unlock_irqrestore(&epid_queue->lock, flags); - - if (process) { - skb_queue_walk_safe(&queue, skb, tmp) { - __skb_unlink(skb, &queue); - ath9k_htc_tx_process(priv, skb, NULL); - } - } -} - -void ath9k_htc_tx_cleanup_timer(unsigned long data) -{ - struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) data; - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath9k_htc_tx_event *event, *tmp; - struct sk_buff *skb; - - spin_lock(&priv->wmi->event_lock); - list_for_each_entry_safe(event, tmp, &priv->wmi->pending_tx_events, list) { - - skb = ath9k_htc_tx_get_packet(priv, &event->txs); - if (skb) { - ath_dbg(common, XMIT, - "Found packet for cookie: %d, epid: %d\n", - event->txs.cookie, - MS(event->txs.ts_rate, ATH9K_HTC_TXSTAT_EPID)); - - ath9k_htc_tx_process(priv, skb, &event->txs); - list_del(&event->list); - kfree(event); - continue; - } - - if (++event->count >= ATH9K_HTC_TX_TIMEOUT_COUNT) { - list_del(&event->list); - kfree(event); - } - } - spin_unlock(&priv->wmi->event_lock); - - /* - * Check if status-pending packets have to be cleaned up. - */ - ath9k_htc_tx_cleanup_queue(priv, &priv->tx.mgmt_ep_queue); - ath9k_htc_tx_cleanup_queue(priv, &priv->tx.cab_ep_queue); - ath9k_htc_tx_cleanup_queue(priv, &priv->tx.data_be_queue); - ath9k_htc_tx_cleanup_queue(priv, &priv->tx.data_bk_queue); - ath9k_htc_tx_cleanup_queue(priv, &priv->tx.data_vi_queue); - ath9k_htc_tx_cleanup_queue(priv, &priv->tx.data_vo_queue); - - /* Wake TX queues if needed */ - ath9k_htc_check_wake_queues(priv); - - mod_timer(&priv->tx.cleanup_timer, - jiffies + msecs_to_jiffies(ATH9K_HTC_TX_CLEANUP_INTERVAL)); -} - -int ath9k_tx_init(struct ath9k_htc_priv *priv) -{ - skb_queue_head_init(&priv->tx.mgmt_ep_queue); - skb_queue_head_init(&priv->tx.cab_ep_queue); - skb_queue_head_init(&priv->tx.data_be_queue); - skb_queue_head_init(&priv->tx.data_bk_queue); - skb_queue_head_init(&priv->tx.data_vi_queue); - skb_queue_head_init(&priv->tx.data_vo_queue); - skb_queue_head_init(&priv->tx.tx_failed); - return 0; -} - -void ath9k_tx_cleanup(struct ath9k_htc_priv *priv) -{ - -} - -bool ath9k_htc_txq_setup(struct ath9k_htc_priv *priv, int subtype) -{ - struct ath_hw *ah = priv->ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_tx_queue_info qi; - int qnum; - - memset(&qi, 0, sizeof(qi)); - ATH9K_HTC_INIT_TXQ(subtype); - - qnum = ath9k_hw_setuptxqueue(priv->ah, ATH9K_TX_QUEUE_DATA, &qi); - if (qnum == -1) - return false; - - if (qnum >= ARRAY_SIZE(priv->hwq_map)) { - ath_err(common, "qnum %u out of range, max %zu!\n", - qnum, ARRAY_SIZE(priv->hwq_map)); - ath9k_hw_releasetxqueue(ah, qnum); - return false; - } - - priv->hwq_map[subtype] = qnum; - return true; -} - -int ath9k_htc_cabq_setup(struct ath9k_htc_priv *priv) -{ - struct ath9k_tx_queue_info qi; - - memset(&qi, 0, sizeof(qi)); - ATH9K_HTC_INIT_TXQ(0); - - return ath9k_hw_setuptxqueue(priv->ah, ATH9K_TX_QUEUE_CAB, &qi); -} - -/******/ -/* RX */ -/******/ - -/* - * Calculate the RX filter to be set in the HW. - */ -u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv) -{ -#define RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR) - - struct ath_hw *ah = priv->ah; - u32 rfilt; - - rfilt = (ath9k_hw_getrxfilter(ah) & RX_FILTER_PRESERVE) - | ATH9K_RX_FILTER_UCAST | ATH9K_RX_FILTER_BCAST - | ATH9K_RX_FILTER_MCAST; - - if (priv->rxfilter & FIF_PROBE_REQ) - rfilt |= ATH9K_RX_FILTER_PROBEREQ; - - /* - * Set promiscuous mode when FIF_PROMISC_IN_BSS is enabled for station - * mode interface or when in monitor mode. AP mode does not need this - * since it receives all in-BSS frames anyway. - */ - if (((ah->opmode != NL80211_IFTYPE_AP) && - (priv->rxfilter & FIF_PROMISC_IN_BSS)) || - ah->is_monitoring) - rfilt |= ATH9K_RX_FILTER_PROM; - - if (priv->rxfilter & FIF_CONTROL) - rfilt |= ATH9K_RX_FILTER_CONTROL; - - if ((ah->opmode == NL80211_IFTYPE_STATION) && - (priv->nvifs <= 1) && - !(priv->rxfilter & FIF_BCN_PRBRESP_PROMISC)) - rfilt |= ATH9K_RX_FILTER_MYBEACON; - else - rfilt |= ATH9K_RX_FILTER_BEACON; - - if (conf_is_ht(&priv->hw->conf)) { - rfilt |= ATH9K_RX_FILTER_COMP_BAR; - rfilt |= ATH9K_RX_FILTER_UNCOMP_BA_BAR; - } - - if (priv->rxfilter & FIF_PSPOLL) - rfilt |= ATH9K_RX_FILTER_PSPOLL; - - if (priv->nvifs > 1) - rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL; - - return rfilt; - -#undef RX_FILTER_PRESERVE -} - -/* - * Recv initialization for opmode change. - */ -static void ath9k_htc_opmode_init(struct ath9k_htc_priv *priv) -{ - struct ath_hw *ah = priv->ah; - u32 rfilt, mfilt[2]; - - /* configure rx filter */ - rfilt = ath9k_htc_calcrxfilter(priv); - ath9k_hw_setrxfilter(ah, rfilt); - - /* calculate and install multicast filter */ - mfilt[0] = mfilt[1] = ~0; - ath9k_hw_setmcastfilter(ah, mfilt[0], mfilt[1]); -} - -void ath9k_host_rx_init(struct ath9k_htc_priv *priv) -{ - ath9k_hw_rxena(priv->ah); - ath9k_htc_opmode_init(priv); - ath9k_hw_startpcureceive(priv->ah, test_bit(OP_SCANNING, &priv->op_flags)); - priv->rx.last_rssi = ATH_RSSI_DUMMY_MARKER; -} - -static void ath9k_process_rate(struct ieee80211_hw *hw, - struct ieee80211_rx_status *rxs, - u8 rx_rate, u8 rs_flags) -{ - struct ieee80211_supported_band *sband; - enum ieee80211_band band; - unsigned int i = 0; - - if (rx_rate & 0x80) { - /* HT rate */ - rxs->flag |= RX_FLAG_HT; - if (rs_flags & ATH9K_RX_2040) - rxs->flag |= RX_FLAG_40MHZ; - if (rs_flags & ATH9K_RX_GI) - rxs->flag |= RX_FLAG_SHORT_GI; - rxs->rate_idx = rx_rate & 0x7f; - return; - } - - band = hw->conf.chandef.chan->band; - sband = hw->wiphy->bands[band]; - - for (i = 0; i < sband->n_bitrates; i++) { - if (sband->bitrates[i].hw_value == rx_rate) { - rxs->rate_idx = i; - return; - } - if (sband->bitrates[i].hw_value_short == rx_rate) { - rxs->rate_idx = i; - rxs->flag |= RX_FLAG_SHORTPRE; - return; - } - } - -} - -static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, - struct ath9k_htc_rxbuf *rxbuf, - struct ieee80211_rx_status *rx_status) - -{ - struct ieee80211_hdr *hdr; - struct ieee80211_hw *hw = priv->hw; - struct sk_buff *skb = rxbuf->skb; - struct ath_common *common = ath9k_hw_common(priv->ah); - struct ath_htc_rx_status *rxstatus; - int hdrlen, padsize; - int last_rssi = ATH_RSSI_DUMMY_MARKER; - __le16 fc; - - if (skb->len < HTC_RX_FRAME_HEADER_SIZE) { - ath_err(common, "Corrupted RX frame, dropping (len: %d)\n", - skb->len); - goto rx_next; - } - - rxstatus = (struct ath_htc_rx_status *)skb->data; - - if (be16_to_cpu(rxstatus->rs_datalen) - - (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0) { - ath_err(common, - "Corrupted RX data len, dropping (dlen: %d, skblen: %d)\n", - rxstatus->rs_datalen, skb->len); - goto rx_next; - } - - ath9k_htc_err_stat_rx(priv, rxstatus); - - /* Get the RX status information */ - memcpy(&rxbuf->rxstatus, rxstatus, HTC_RX_FRAME_HEADER_SIZE); - skb_pull(skb, HTC_RX_FRAME_HEADER_SIZE); - - hdr = (struct ieee80211_hdr *)skb->data; - fc = hdr->frame_control; - hdrlen = ieee80211_get_hdrlen_from_skb(skb); - - padsize = hdrlen & 3; - if (padsize && skb->len >= hdrlen+padsize+FCS_LEN) { - memmove(skb->data + padsize, skb->data, hdrlen); - skb_pull(skb, padsize); - } - - memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); - - if (rxbuf->rxstatus.rs_status != 0) { - if (rxbuf->rxstatus.rs_status & ATH9K_RXERR_CRC) - rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; - if (rxbuf->rxstatus.rs_status & ATH9K_RXERR_PHY) - goto rx_next; - - if (rxbuf->rxstatus.rs_status & ATH9K_RXERR_DECRYPT) { - /* FIXME */ - } else if (rxbuf->rxstatus.rs_status & ATH9K_RXERR_MIC) { - if (ieee80211_is_ctl(fc)) - /* - * Sometimes, we get invalid - * MIC failures on valid control frames. - * Remove these mic errors. - */ - rxbuf->rxstatus.rs_status &= ~ATH9K_RXERR_MIC; - else - rx_status->flag |= RX_FLAG_MMIC_ERROR; - } - - /* - * Reject error frames with the exception of - * decryption and MIC failures. For monitor mode, - * we also ignore the CRC error. - */ - if (priv->ah->opmode == NL80211_IFTYPE_MONITOR) { - if (rxbuf->rxstatus.rs_status & - ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC | - ATH9K_RXERR_CRC)) - goto rx_next; - } else { - if (rxbuf->rxstatus.rs_status & - ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC)) { - goto rx_next; - } - } - } - - if (!(rxbuf->rxstatus.rs_status & ATH9K_RXERR_DECRYPT)) { - u8 keyix; - keyix = rxbuf->rxstatus.rs_keyix; - if (keyix != ATH9K_RXKEYIX_INVALID) { - rx_status->flag |= RX_FLAG_DECRYPTED; - } else if (ieee80211_has_protected(fc) && - skb->len >= hdrlen + 4) { - keyix = skb->data[hdrlen + 3] >> 6; - if (test_bit(keyix, common->keymap)) - rx_status->flag |= RX_FLAG_DECRYPTED; - } - } - - ath9k_process_rate(hw, rx_status, rxbuf->rxstatus.rs_rate, - rxbuf->rxstatus.rs_flags); - - if (rxbuf->rxstatus.rs_rssi != ATH9K_RSSI_BAD && - !rxbuf->rxstatus.rs_moreaggr) - ATH_RSSI_LPF(priv->rx.last_rssi, - rxbuf->rxstatus.rs_rssi); - - last_rssi = priv->rx.last_rssi; - - if (ieee80211_is_beacon(hdr->frame_control) && - !is_zero_ether_addr(common->curbssid) && - ether_addr_equal(hdr->addr3, common->curbssid)) { - s8 rssi = rxbuf->rxstatus.rs_rssi; - - if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) - rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER); - - if (rssi < 0) - rssi = 0; - - priv->ah->stats.avgbrssi = rssi; - } - - rx_status->mactime = be64_to_cpu(rxbuf->rxstatus.rs_tstamp); - rx_status->band = hw->conf.chandef.chan->band; - rx_status->freq = hw->conf.chandef.chan->center_freq; - rx_status->signal = rxbuf->rxstatus.rs_rssi + ATH_DEFAULT_NOISE_FLOOR; - rx_status->antenna = rxbuf->rxstatus.rs_antenna; - rx_status->flag |= RX_FLAG_MACTIME_END; - - return true; - -rx_next: - return false; -} - -/* - * FIXME: Handle FLUSH later on. - */ -void ath9k_rx_tasklet(unsigned long data) -{ - struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data; - struct ath9k_htc_rxbuf *rxbuf = NULL, *tmp_buf = NULL; - struct ieee80211_rx_status rx_status; - struct sk_buff *skb; - unsigned long flags; - struct ieee80211_hdr *hdr; - - do { - spin_lock_irqsave(&priv->rx.rxbuflock, flags); - list_for_each_entry(tmp_buf, &priv->rx.rxbuf, list) { - if (tmp_buf->in_process) { - rxbuf = tmp_buf; - break; - } - } - - if (rxbuf == NULL) { - spin_unlock_irqrestore(&priv->rx.rxbuflock, flags); - break; - } - - if (!rxbuf->skb) - goto requeue; - - if (!ath9k_rx_prepare(priv, rxbuf, &rx_status)) { - dev_kfree_skb_any(rxbuf->skb); - goto requeue; - } - - memcpy(IEEE80211_SKB_RXCB(rxbuf->skb), &rx_status, - sizeof(struct ieee80211_rx_status)); - skb = rxbuf->skb; - hdr = (struct ieee80211_hdr *) skb->data; - - if (ieee80211_is_beacon(hdr->frame_control) && priv->ps_enabled) - ieee80211_queue_work(priv->hw, &priv->ps_work); - - spin_unlock_irqrestore(&priv->rx.rxbuflock, flags); - - ieee80211_rx(priv->hw, skb); - - spin_lock_irqsave(&priv->rx.rxbuflock, flags); -requeue: - rxbuf->in_process = false; - rxbuf->skb = NULL; - list_move_tail(&rxbuf->list, &priv->rx.rxbuf); - rxbuf = NULL; - spin_unlock_irqrestore(&priv->rx.rxbuflock, flags); - } while (1); - -} - -void ath9k_htc_rxep(void *drv_priv, struct sk_buff *skb, - enum htc_endpoint_id ep_id) -{ - struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)drv_priv; - struct ath_hw *ah = priv->ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_htc_rxbuf *rxbuf = NULL, *tmp_buf = NULL; - - spin_lock(&priv->rx.rxbuflock); - list_for_each_entry(tmp_buf, &priv->rx.rxbuf, list) { - if (!tmp_buf->in_process) { - rxbuf = tmp_buf; - break; - } - } - spin_unlock(&priv->rx.rxbuflock); - - if (rxbuf == NULL) { - ath_dbg(common, ANY, "No free RX buffer\n"); - goto err; - } - - spin_lock(&priv->rx.rxbuflock); - rxbuf->skb = skb; - rxbuf->in_process = true; - spin_unlock(&priv->rx.rxbuflock); - - tasklet_schedule(&priv->rx_tasklet); - return; -err: - dev_kfree_skb_any(skb); -} - -/* FIXME: Locking for cleanup/init */ - -void ath9k_rx_cleanup(struct ath9k_htc_priv *priv) -{ - struct ath9k_htc_rxbuf *rxbuf, *tbuf; - - list_for_each_entry_safe(rxbuf, tbuf, &priv->rx.rxbuf, list) { - list_del(&rxbuf->list); - if (rxbuf->skb) - dev_kfree_skb_any(rxbuf->skb); - kfree(rxbuf); - } -} - -int ath9k_rx_init(struct ath9k_htc_priv *priv) -{ - int i = 0; - - INIT_LIST_HEAD(&priv->rx.rxbuf); - spin_lock_init(&priv->rx.rxbuflock); - - for (i = 0; i < ATH9K_HTC_RXBUF; i++) { - struct ath9k_htc_rxbuf *rxbuf = - kzalloc(sizeof(struct ath9k_htc_rxbuf), GFP_KERNEL); - if (rxbuf == NULL) - goto err; - - list_add_tail(&rxbuf->list, &priv->rx.rxbuf); - } - - return 0; - -err: - ath9k_rx_cleanup(priv); - return -ENOMEM; -} diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c deleted file mode 100644 index aac4a406a513..000000000000 --- a/drivers/net/wireless/ath/ath9k/htc_hst.c +++ /dev/null @@ -1,479 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include "htc.h" - -static int htc_issue_send(struct htc_target *target, struct sk_buff* skb, - u16 len, u8 flags, u8 epid) - -{ - struct htc_frame_hdr *hdr; - struct htc_endpoint *endpoint = &target->endpoint[epid]; - int status; - - hdr = (struct htc_frame_hdr *) - skb_push(skb, sizeof(struct htc_frame_hdr)); - hdr->endpoint_id = epid; - hdr->flags = flags; - hdr->payload_len = cpu_to_be16(len); - - status = target->hif->send(target->hif_dev, endpoint->ul_pipeid, skb); - - return status; -} - -static struct htc_endpoint *get_next_avail_ep(struct htc_endpoint *endpoint) -{ - enum htc_endpoint_id avail_epid; - - for (avail_epid = (ENDPOINT_MAX - 1); avail_epid > ENDPOINT0; avail_epid--) - if (endpoint[avail_epid].service_id == 0) - return &endpoint[avail_epid]; - return NULL; -} - -static u8 service_to_ulpipe(u16 service_id) -{ - switch (service_id) { - case WMI_CONTROL_SVC: - return 4; - case WMI_BEACON_SVC: - case WMI_CAB_SVC: - case WMI_UAPSD_SVC: - case WMI_MGMT_SVC: - case WMI_DATA_VO_SVC: - case WMI_DATA_VI_SVC: - case WMI_DATA_BE_SVC: - case WMI_DATA_BK_SVC: - return 1; - default: - return 0; - } -} - -static u8 service_to_dlpipe(u16 service_id) -{ - switch (service_id) { - case WMI_CONTROL_SVC: - return 3; - case WMI_BEACON_SVC: - case WMI_CAB_SVC: - case WMI_UAPSD_SVC: - case WMI_MGMT_SVC: - case WMI_DATA_VO_SVC: - case WMI_DATA_VI_SVC: - case WMI_DATA_BE_SVC: - case WMI_DATA_BK_SVC: - return 2; - default: - return 0; - } -} - -static void htc_process_target_rdy(struct htc_target *target, - void *buf) -{ - struct htc_endpoint *endpoint; - struct htc_ready_msg *htc_ready_msg = (struct htc_ready_msg *) buf; - - target->credit_size = be16_to_cpu(htc_ready_msg->credit_size); - - endpoint = &target->endpoint[ENDPOINT0]; - endpoint->service_id = HTC_CTRL_RSVD_SVC; - endpoint->max_msglen = HTC_MAX_CONTROL_MESSAGE_LENGTH; - atomic_inc(&target->tgt_ready); - complete(&target->target_wait); -} - -static void htc_process_conn_rsp(struct htc_target *target, - struct htc_frame_hdr *htc_hdr) -{ - struct htc_conn_svc_rspmsg *svc_rspmsg; - struct htc_endpoint *endpoint, *tmp_endpoint = NULL; - u16 service_id; - u16 max_msglen; - enum htc_endpoint_id epid, tepid; - - svc_rspmsg = (struct htc_conn_svc_rspmsg *) - ((void *) htc_hdr + sizeof(struct htc_frame_hdr)); - - if (svc_rspmsg->status == HTC_SERVICE_SUCCESS) { - epid = svc_rspmsg->endpoint_id; - service_id = be16_to_cpu(svc_rspmsg->service_id); - max_msglen = be16_to_cpu(svc_rspmsg->max_msg_len); - endpoint = &target->endpoint[epid]; - - for (tepid = (ENDPOINT_MAX - 1); tepid > ENDPOINT0; tepid--) { - tmp_endpoint = &target->endpoint[tepid]; - if (tmp_endpoint->service_id == service_id) { - tmp_endpoint->service_id = 0; - break; - } - } - - if (tepid == ENDPOINT0) - return; - - endpoint->service_id = service_id; - endpoint->max_txqdepth = tmp_endpoint->max_txqdepth; - endpoint->ep_callbacks = tmp_endpoint->ep_callbacks; - endpoint->ul_pipeid = tmp_endpoint->ul_pipeid; - endpoint->dl_pipeid = tmp_endpoint->dl_pipeid; - endpoint->max_msglen = max_msglen; - target->conn_rsp_epid = epid; - complete(&target->cmd_wait); - } else { - target->conn_rsp_epid = ENDPOINT_UNUSED; - } -} - -static int htc_config_pipe_credits(struct htc_target *target) -{ - struct sk_buff *skb; - struct htc_config_pipe_msg *cp_msg; - int ret, time_left; - - skb = alloc_skb(50 + sizeof(struct htc_frame_hdr), GFP_ATOMIC); - if (!skb) { - dev_err(target->dev, "failed to allocate send buffer\n"); - return -ENOMEM; - } - skb_reserve(skb, sizeof(struct htc_frame_hdr)); - - cp_msg = (struct htc_config_pipe_msg *) - skb_put(skb, sizeof(struct htc_config_pipe_msg)); - - cp_msg->message_id = cpu_to_be16(HTC_MSG_CONFIG_PIPE_ID); - cp_msg->pipe_id = USB_WLAN_TX_PIPE; - cp_msg->credits = target->credits; - - target->htc_flags |= HTC_OP_CONFIG_PIPE_CREDITS; - - ret = htc_issue_send(target, skb, skb->len, 0, ENDPOINT0); - if (ret) - goto err; - - time_left = wait_for_completion_timeout(&target->cmd_wait, HZ); - if (!time_left) { - dev_err(target->dev, "HTC credit config timeout\n"); - return -ETIMEDOUT; - } - - return 0; -err: - kfree_skb(skb); - return -EINVAL; -} - -static int htc_setup_complete(struct htc_target *target) -{ - struct sk_buff *skb; - struct htc_comp_msg *comp_msg; - int ret = 0, time_left; - - skb = alloc_skb(50 + sizeof(struct htc_frame_hdr), GFP_ATOMIC); - if (!skb) { - dev_err(target->dev, "failed to allocate send buffer\n"); - return -ENOMEM; - } - skb_reserve(skb, sizeof(struct htc_frame_hdr)); - - comp_msg = (struct htc_comp_msg *) - skb_put(skb, sizeof(struct htc_comp_msg)); - comp_msg->msg_id = cpu_to_be16(HTC_MSG_SETUP_COMPLETE_ID); - - target->htc_flags |= HTC_OP_START_WAIT; - - ret = htc_issue_send(target, skb, skb->len, 0, ENDPOINT0); - if (ret) - goto err; - - time_left = wait_for_completion_timeout(&target->cmd_wait, HZ); - if (!time_left) { - dev_err(target->dev, "HTC start timeout\n"); - return -ETIMEDOUT; - } - - return 0; - -err: - kfree_skb(skb); - return -EINVAL; -} - -/* HTC APIs */ - -int htc_init(struct htc_target *target) -{ - int ret; - - ret = htc_config_pipe_credits(target); - if (ret) - return ret; - - return htc_setup_complete(target); -} - -int htc_connect_service(struct htc_target *target, - struct htc_service_connreq *service_connreq, - enum htc_endpoint_id *conn_rsp_epid) -{ - struct sk_buff *skb; - struct htc_endpoint *endpoint; - struct htc_conn_svc_msg *conn_msg; - int ret, time_left; - - /* Find an available endpoint */ - endpoint = get_next_avail_ep(target->endpoint); - if (!endpoint) { - dev_err(target->dev, "Endpoint is not available for" - "service %d\n", service_connreq->service_id); - return -EINVAL; - } - - endpoint->service_id = service_connreq->service_id; - endpoint->max_txqdepth = service_connreq->max_send_qdepth; - endpoint->ul_pipeid = service_to_ulpipe(service_connreq->service_id); - endpoint->dl_pipeid = service_to_dlpipe(service_connreq->service_id); - endpoint->ep_callbacks = service_connreq->ep_callbacks; - - skb = alloc_skb(sizeof(struct htc_conn_svc_msg) + - sizeof(struct htc_frame_hdr), GFP_ATOMIC); - if (!skb) { - dev_err(target->dev, "Failed to allocate buf to send" - "service connect req\n"); - return -ENOMEM; - } - - skb_reserve(skb, sizeof(struct htc_frame_hdr)); - - conn_msg = (struct htc_conn_svc_msg *) - skb_put(skb, sizeof(struct htc_conn_svc_msg)); - conn_msg->service_id = cpu_to_be16(service_connreq->service_id); - conn_msg->msg_id = cpu_to_be16(HTC_MSG_CONNECT_SERVICE_ID); - conn_msg->con_flags = cpu_to_be16(service_connreq->con_flags); - conn_msg->dl_pipeid = endpoint->dl_pipeid; - conn_msg->ul_pipeid = endpoint->ul_pipeid; - - ret = htc_issue_send(target, skb, skb->len, 0, ENDPOINT0); - if (ret) - goto err; - - time_left = wait_for_completion_timeout(&target->cmd_wait, HZ); - if (!time_left) { - dev_err(target->dev, "Service connection timeout for: %d\n", - service_connreq->service_id); - return -ETIMEDOUT; - } - - *conn_rsp_epid = target->conn_rsp_epid; - return 0; -err: - kfree_skb(skb); - return ret; -} - -int htc_send(struct htc_target *target, struct sk_buff *skb) -{ - struct ath9k_htc_tx_ctl *tx_ctl; - - tx_ctl = HTC_SKB_CB(skb); - return htc_issue_send(target, skb, skb->len, 0, tx_ctl->epid); -} - -int htc_send_epid(struct htc_target *target, struct sk_buff *skb, - enum htc_endpoint_id epid) -{ - return htc_issue_send(target, skb, skb->len, 0, epid); -} - -void htc_stop(struct htc_target *target) -{ - target->hif->stop(target->hif_dev); -} - -void htc_start(struct htc_target *target) -{ - target->hif->start(target->hif_dev); -} - -void htc_sta_drain(struct htc_target *target, u8 idx) -{ - target->hif->sta_drain(target->hif_dev, idx); -} - -void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, - struct sk_buff *skb, bool txok) -{ - struct htc_endpoint *endpoint; - struct htc_frame_hdr *htc_hdr = NULL; - - if (htc_handle->htc_flags & HTC_OP_CONFIG_PIPE_CREDITS) { - complete(&htc_handle->cmd_wait); - htc_handle->htc_flags &= ~HTC_OP_CONFIG_PIPE_CREDITS; - goto ret; - } - - if (htc_handle->htc_flags & HTC_OP_START_WAIT) { - complete(&htc_handle->cmd_wait); - htc_handle->htc_flags &= ~HTC_OP_START_WAIT; - goto ret; - } - - if (skb) { - htc_hdr = (struct htc_frame_hdr *) skb->data; - endpoint = &htc_handle->endpoint[htc_hdr->endpoint_id]; - skb_pull(skb, sizeof(struct htc_frame_hdr)); - - if (endpoint->ep_callbacks.tx) { - endpoint->ep_callbacks.tx(endpoint->ep_callbacks.priv, - skb, htc_hdr->endpoint_id, - txok); - } else { - kfree_skb(skb); - } - } - - return; -ret: - /* HTC-generated packets are freed here. */ - if (htc_hdr && htc_hdr->endpoint_id != ENDPOINT0) - dev_kfree_skb_any(skb); - else - kfree_skb(skb); -} - -/* - * HTC Messages are handled directly here and the obtained SKB - * is freed. - * - * Service messages (Data, WMI) passed to the corresponding - * endpoint RX handlers, which have to free the SKB. - */ -void ath9k_htc_rx_msg(struct htc_target *htc_handle, - struct sk_buff *skb, u32 len, u8 pipe_id) -{ - struct htc_frame_hdr *htc_hdr; - enum htc_endpoint_id epid; - struct htc_endpoint *endpoint; - __be16 *msg_id; - - if (!htc_handle || !skb) - return; - - htc_hdr = (struct htc_frame_hdr *) skb->data; - epid = htc_hdr->endpoint_id; - - if (epid >= ENDPOINT_MAX) { - if (pipe_id != USB_REG_IN_PIPE) - dev_kfree_skb_any(skb); - else - kfree_skb(skb); - return; - } - - if (epid == ENDPOINT0) { - - /* Handle trailer */ - if (htc_hdr->flags & HTC_FLAGS_RECV_TRAILER) { - if (be32_to_cpu(*(__be32 *) skb->data) == 0x00C60000) - /* Move past the Watchdog pattern */ - htc_hdr = (struct htc_frame_hdr *)(skb->data + 4); - } - - /* Get the message ID */ - msg_id = (__be16 *) ((void *) htc_hdr + - sizeof(struct htc_frame_hdr)); - - /* Now process HTC messages */ - switch (be16_to_cpu(*msg_id)) { - case HTC_MSG_READY_ID: - htc_process_target_rdy(htc_handle, htc_hdr); - break; - case HTC_MSG_CONNECT_SERVICE_RESPONSE_ID: - htc_process_conn_rsp(htc_handle, htc_hdr); - break; - default: - break; - } - - kfree_skb(skb); - - } else { - if (htc_hdr->flags & HTC_FLAGS_RECV_TRAILER) - skb_trim(skb, len - htc_hdr->control[0]); - - skb_pull(skb, sizeof(struct htc_frame_hdr)); - - endpoint = &htc_handle->endpoint[epid]; - if (endpoint->ep_callbacks.rx) - endpoint->ep_callbacks.rx(endpoint->ep_callbacks.priv, - skb, epid); - } -} - -struct htc_target *ath9k_htc_hw_alloc(void *hif_handle, - struct ath9k_htc_hif *hif, - struct device *dev) -{ - struct htc_endpoint *endpoint; - struct htc_target *target; - - target = kzalloc(sizeof(struct htc_target), GFP_KERNEL); - if (!target) - return NULL; - - init_completion(&target->target_wait); - init_completion(&target->cmd_wait); - - target->hif = hif; - target->hif_dev = hif_handle; - target->dev = dev; - - /* Assign control endpoint pipe IDs */ - endpoint = &target->endpoint[ENDPOINT0]; - endpoint->ul_pipeid = hif->control_ul_pipe; - endpoint->dl_pipeid = hif->control_dl_pipe; - - atomic_set(&target->tgt_ready, 0); - - return target; -} - -void ath9k_htc_hw_free(struct htc_target *htc) -{ - kfree(htc); -} - -int ath9k_htc_hw_init(struct htc_target *target, - struct device *dev, u16 devid, - char *product, u32 drv_info) -{ - if (ath9k_htc_probe_device(target, dev, devid, product, drv_info)) { - pr_err("Failed to initialize the device\n"); - return -ENODEV; - } - - return 0; -} - -void ath9k_htc_hw_deinit(struct htc_target *target, bool hot_unplug) -{ - if (target) - ath9k_htc_disconnect_device(target, hot_unplug); -} diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.h b/drivers/net/wireless/ath/ath9k/htc_hst.h deleted file mode 100644 index e1ffbb6bd636..000000000000 --- a/drivers/net/wireless/ath/ath9k/htc_hst.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef HTC_HST_H -#define HTC_HST_H - -struct ath9k_htc_priv; -struct htc_target; -struct ath9k_htc_tx_ctl; - -enum ath9k_hif_transports { - ATH9K_HIF_USB, -}; - -struct ath9k_htc_hif { - struct list_head list; - const enum ath9k_hif_transports transport; - const char *name; - - u8 control_dl_pipe; - u8 control_ul_pipe; - - void (*start) (void *hif_handle); - void (*stop) (void *hif_handle); - void (*sta_drain) (void *hif_handle, u8 idx); - int (*send) (void *hif_handle, u8 pipe, struct sk_buff *buf); -}; - -enum htc_endpoint_id { - ENDPOINT_UNUSED = -1, - ENDPOINT0 = 0, - ENDPOINT1 = 1, - ENDPOINT2 = 2, - ENDPOINT3 = 3, - ENDPOINT4 = 4, - ENDPOINT5 = 5, - ENDPOINT6 = 6, - ENDPOINT7 = 7, - ENDPOINT8 = 8, - ENDPOINT_MAX = 22 -}; - -/* Htc frame hdr flags */ -#define HTC_FLAGS_RECV_TRAILER (1 << 1) - -struct htc_frame_hdr { - u8 endpoint_id; - u8 flags; - __be16 payload_len; - u8 control[4]; -} __packed; - -struct htc_ready_msg { - __be16 message_id; - __be16 credits; - __be16 credit_size; - u8 max_endpoints; - u8 pad; -} __packed; - -struct htc_config_pipe_msg { - __be16 message_id; - u8 pipe_id; - u8 credits; -} __packed; - -struct htc_ep_callbacks { - void *priv; - void (*tx) (void *, struct sk_buff *, enum htc_endpoint_id, bool txok); - void (*rx) (void *, struct sk_buff *, enum htc_endpoint_id); -}; - -struct htc_endpoint { - u16 service_id; - - struct htc_ep_callbacks ep_callbacks; - u32 max_txqdepth; - int max_msglen; - - u8 ul_pipeid; - u8 dl_pipeid; -}; - -#define HTC_MAX_CONTROL_MESSAGE_LENGTH 255 -#define HTC_CONTROL_BUFFER_SIZE \ - (HTC_MAX_CONTROL_MESSAGE_LENGTH + sizeof(struct htc_frame_hdr)) - -#define HTC_OP_START_WAIT BIT(0) -#define HTC_OP_CONFIG_PIPE_CREDITS BIT(1) - -struct htc_target { - void *hif_dev; - struct ath9k_htc_priv *drv_priv; - struct device *dev; - struct ath9k_htc_hif *hif; - struct htc_endpoint endpoint[ENDPOINT_MAX]; - struct completion target_wait; - struct completion cmd_wait; - struct list_head list; - enum htc_endpoint_id conn_rsp_epid; - u16 credits; - u16 credit_size; - u8 htc_flags; - atomic_t tgt_ready; -}; - -enum htc_msg_id { - HTC_MSG_READY_ID = 1, - HTC_MSG_CONNECT_SERVICE_ID, - HTC_MSG_CONNECT_SERVICE_RESPONSE_ID, - HTC_MSG_SETUP_COMPLETE_ID, - HTC_MSG_CONFIG_PIPE_ID, - HTC_MSG_CONFIG_PIPE_RESPONSE_ID, -}; - -struct htc_service_connreq { - u16 service_id; - u16 con_flags; - u32 max_send_qdepth; - struct htc_ep_callbacks ep_callbacks; -}; - -/* Current service IDs */ - -enum htc_service_group_ids{ - RSVD_SERVICE_GROUP = 0, - WMI_SERVICE_GROUP = 1, - - HTC_SERVICE_GROUP_LAST = 255 -}; - -#define MAKE_SERVICE_ID(group, index) \ - (int)(((int)group << 8) | (int)(index)) - -/* NOTE: service ID of 0x0000 is reserved and should never be used */ -#define HTC_CTRL_RSVD_SVC MAKE_SERVICE_ID(RSVD_SERVICE_GROUP, 1) -#define HTC_LOOPBACK_RSVD_SVC MAKE_SERVICE_ID(RSVD_SERVICE_GROUP, 2) - -#define WMI_CONTROL_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 0) -#define WMI_BEACON_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 1) -#define WMI_CAB_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 2) -#define WMI_UAPSD_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 3) -#define WMI_MGMT_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 4) -#define WMI_DATA_VO_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 5) -#define WMI_DATA_VI_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 6) -#define WMI_DATA_BE_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 7) -#define WMI_DATA_BK_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 8) - -struct htc_conn_svc_msg { - __be16 msg_id; - __be16 service_id; - __be16 con_flags; - u8 dl_pipeid; - u8 ul_pipeid; - u8 svc_meta_len; - u8 pad; -} __packed; - -/* connect response status codes */ -#define HTC_SERVICE_SUCCESS 0 -#define HTC_SERVICE_NOT_FOUND 1 -#define HTC_SERVICE_FAILED 2 -#define HTC_SERVICE_NO_RESOURCES 3 -#define HTC_SERVICE_NO_MORE_EP 4 - -struct htc_conn_svc_rspmsg { - __be16 msg_id; - __be16 service_id; - u8 status; - u8 endpoint_id; - __be16 max_msg_len; - u8 svc_meta_len; - u8 pad; -} __packed; - -struct htc_comp_msg { - __be16 msg_id; -} __packed; - -int htc_init(struct htc_target *target); -int htc_connect_service(struct htc_target *target, - struct htc_service_connreq *service_connreq, - enum htc_endpoint_id *conn_rsp_eid); -int htc_send(struct htc_target *target, struct sk_buff *skb); -int htc_send_epid(struct htc_target *target, struct sk_buff *skb, - enum htc_endpoint_id epid); -void htc_stop(struct htc_target *target); -void htc_start(struct htc_target *target); -void htc_sta_drain(struct htc_target *target, u8 idx); - -void ath9k_htc_rx_msg(struct htc_target *htc_handle, - struct sk_buff *skb, u32 len, u8 pipe_id); -void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, - struct sk_buff *skb, bool txok); - -struct htc_target *ath9k_htc_hw_alloc(void *hif_handle, - struct ath9k_htc_hif *hif, - struct device *dev); -void ath9k_htc_hw_free(struct htc_target *htc); -int ath9k_htc_hw_init(struct htc_target *target, - struct device *dev, u16 devid, char *product, - u32 drv_info); -void ath9k_htc_hw_deinit(struct htc_target *target, bool hot_unplug); - -#endif /* HTC_HST_H */ diff --git a/drivers/net/wireless/ath/ath9k/hw-ops.h b/drivers/net/wireless/ath/ath9k/hw-ops.h deleted file mode 100644 index 14b701140b49..000000000000 --- a/drivers/net/wireless/ath/ath9k/hw-ops.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef ATH9K_HW_OPS_H -#define ATH9K_HW_OPS_H - -#include "hw.h" - -/* Hardware core and driver accessible callbacks */ - -static inline void ath9k_hw_configpcipowersave(struct ath_hw *ah, - bool power_off) -{ - if (!ah->aspm_enabled) - return; - - ath9k_hw_ops(ah)->config_pci_powersave(ah, power_off); -} - -static inline void ath9k_hw_rxena(struct ath_hw *ah) -{ - ath9k_hw_ops(ah)->rx_enable(ah); -} - -static inline void ath9k_hw_set_desc_link(struct ath_hw *ah, void *ds, - u32 link) -{ - ath9k_hw_ops(ah)->set_desc_link(ds, link); -} - -static inline bool ath9k_hw_calibrate(struct ath_hw *ah, - struct ath9k_channel *chan, - u8 rxchainmask, - bool longcal) -{ - return ath9k_hw_ops(ah)->calibrate(ah, chan, rxchainmask, longcal); -} - -static inline bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked) -{ - return ath9k_hw_ops(ah)->get_isr(ah, masked); -} - -static inline void ath9k_hw_set_txdesc(struct ath_hw *ah, void *ds, - struct ath_tx_info *i) -{ - return ath9k_hw_ops(ah)->set_txdesc(ah, ds, i); -} - -static inline int ath9k_hw_txprocdesc(struct ath_hw *ah, void *ds, - struct ath_tx_status *ts) -{ - return ath9k_hw_ops(ah)->proc_txdesc(ah, ds, ts); -} - -static inline void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah, - struct ath_hw_antcomb_conf *antconf) -{ - ath9k_hw_ops(ah)->antdiv_comb_conf_get(ah, antconf); -} - -static inline void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah, - struct ath_hw_antcomb_conf *antconf) -{ - ath9k_hw_ops(ah)->antdiv_comb_conf_set(ah, antconf); -} - -static inline void ath9k_hw_antctrl_shared_chain_lnadiv(struct ath_hw *ah, - bool enable) -{ - if (ath9k_hw_ops(ah)->antctrl_shared_chain_lnadiv) - ath9k_hw_ops(ah)->antctrl_shared_chain_lnadiv(ah, enable); -} - -/* Private hardware call ops */ - -/* PHY ops */ - -static inline int ath9k_hw_rf_set_freq(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - return ath9k_hw_private_ops(ah)->rf_set_freq(ah, chan); -} - -static inline void ath9k_hw_spur_mitigate_freq(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - ath9k_hw_private_ops(ah)->spur_mitigate_freq(ah, chan); -} - -static inline bool ath9k_hw_set_rf_regs(struct ath_hw *ah, - struct ath9k_channel *chan, - u16 modesIndex) -{ - if (!ath9k_hw_private_ops(ah)->set_rf_regs) - return true; - - return ath9k_hw_private_ops(ah)->set_rf_regs(ah, chan, modesIndex); -} - -static inline void ath9k_hw_init_bb(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - return ath9k_hw_private_ops(ah)->init_bb(ah, chan); -} - -static inline void ath9k_hw_set_channel_regs(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - return ath9k_hw_private_ops(ah)->set_channel_regs(ah, chan); -} - -static inline int ath9k_hw_process_ini(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - return ath9k_hw_private_ops(ah)->process_ini(ah, chan); -} - -static inline void ath9k_olc_init(struct ath_hw *ah) -{ - if (!ath9k_hw_private_ops(ah)->olc_init) - return; - - return ath9k_hw_private_ops(ah)->olc_init(ah); -} - -static inline void ath9k_hw_set_rfmode(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - return ath9k_hw_private_ops(ah)->set_rfmode(ah, chan); -} - -static inline void ath9k_hw_mark_phy_inactive(struct ath_hw *ah) -{ - return ath9k_hw_private_ops(ah)->mark_phy_inactive(ah); -} - -static inline void ath9k_hw_set_delta_slope(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - return ath9k_hw_private_ops(ah)->set_delta_slope(ah, chan); -} - -static inline bool ath9k_hw_rfbus_req(struct ath_hw *ah) -{ - return ath9k_hw_private_ops(ah)->rfbus_req(ah); -} - -static inline void ath9k_hw_rfbus_done(struct ath_hw *ah) -{ - return ath9k_hw_private_ops(ah)->rfbus_done(ah); -} - -static inline void ath9k_hw_restore_chainmask(struct ath_hw *ah) -{ - if (!ath9k_hw_private_ops(ah)->restore_chainmask) - return; - - return ath9k_hw_private_ops(ah)->restore_chainmask(ah); -} - -static inline bool ath9k_hw_ani_control(struct ath_hw *ah, - enum ath9k_ani_cmd cmd, int param) -{ - return ath9k_hw_private_ops(ah)->ani_control(ah, cmd, param); -} - -static inline void ath9k_hw_do_getnf(struct ath_hw *ah, - int16_t nfarray[NUM_NF_READINGS]) -{ - ath9k_hw_private_ops(ah)->do_getnf(ah, nfarray); -} - -static inline bool ath9k_hw_init_cal(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - return ath9k_hw_private_ops(ah)->init_cal(ah, chan); -} - -static inline void ath9k_hw_setup_calibration(struct ath_hw *ah, - struct ath9k_cal_list *currCal) -{ - ath9k_hw_private_ops(ah)->setup_calibration(ah, currCal); -} - -static inline int ath9k_hw_fast_chan_change(struct ath_hw *ah, - struct ath9k_channel *chan, - u8 *ini_reloaded) -{ - return ath9k_hw_private_ops(ah)->fast_chan_change(ah, chan, - ini_reloaded); -} - -static inline void ath9k_hw_set_radar_params(struct ath_hw *ah) -{ - if (!ath9k_hw_private_ops(ah)->set_radar_params) - return; - - ath9k_hw_private_ops(ah)->set_radar_params(ah, &ah->radar_conf); -} - -#endif /* ATH9K_HW_OPS_H */ diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c deleted file mode 100644 index b1d5037bff7f..000000000000 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ /dev/null @@ -1,3262 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - -#include "hw.h" -#include "hw-ops.h" -#include "rc.h" -#include "ar9003_mac.h" -#include "ar9003_mci.h" -#include "ar9003_phy.h" -#include "debug.h" -#include "ath9k.h" - -static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type); - -MODULE_AUTHOR("Atheros Communications"); -MODULE_DESCRIPTION("Support for Atheros 802.11n wireless LAN cards."); -MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards"); -MODULE_LICENSE("Dual BSD/GPL"); - -static int __init ath9k_init(void) -{ - return 0; -} -module_init(ath9k_init); - -static void __exit ath9k_exit(void) -{ - return; -} -module_exit(ath9k_exit); - -/* Private hardware callbacks */ - -static void ath9k_hw_init_cal_settings(struct ath_hw *ah) -{ - ath9k_hw_private_ops(ah)->init_cal_settings(ah); -} - -static u32 ath9k_hw_compute_pll_control(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - return ath9k_hw_private_ops(ah)->compute_pll_control(ah, chan); -} - -static void ath9k_hw_init_mode_gain_regs(struct ath_hw *ah) -{ - if (!ath9k_hw_private_ops(ah)->init_mode_gain_regs) - return; - - ath9k_hw_private_ops(ah)->init_mode_gain_regs(ah); -} - -static void ath9k_hw_ani_cache_ini_regs(struct ath_hw *ah) -{ - /* You will not have this callback if using the old ANI */ - if (!ath9k_hw_private_ops(ah)->ani_cache_ini_regs) - return; - - ath9k_hw_private_ops(ah)->ani_cache_ini_regs(ah); -} - -/********************/ -/* Helper Functions */ -/********************/ - -#ifdef CONFIG_ATH9K_DEBUGFS - -void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause) -{ - struct ath_softc *sc = common->priv; - if (sync_cause) - sc->debug.stats.istats.sync_cause_all++; - if (sync_cause & AR_INTR_SYNC_RTC_IRQ) - sc->debug.stats.istats.sync_rtc_irq++; - if (sync_cause & AR_INTR_SYNC_MAC_IRQ) - sc->debug.stats.istats.sync_mac_irq++; - if (sync_cause & AR_INTR_SYNC_EEPROM_ILLEGAL_ACCESS) - sc->debug.stats.istats.eeprom_illegal_access++; - if (sync_cause & AR_INTR_SYNC_APB_TIMEOUT) - sc->debug.stats.istats.apb_timeout++; - if (sync_cause & AR_INTR_SYNC_PCI_MODE_CONFLICT) - sc->debug.stats.istats.pci_mode_conflict++; - if (sync_cause & AR_INTR_SYNC_HOST1_FATAL) - sc->debug.stats.istats.host1_fatal++; - if (sync_cause & AR_INTR_SYNC_HOST1_PERR) - sc->debug.stats.istats.host1_perr++; - if (sync_cause & AR_INTR_SYNC_TRCV_FIFO_PERR) - sc->debug.stats.istats.trcv_fifo_perr++; - if (sync_cause & AR_INTR_SYNC_RADM_CPL_EP) - sc->debug.stats.istats.radm_cpl_ep++; - if (sync_cause & AR_INTR_SYNC_RADM_CPL_DLLP_ABORT) - sc->debug.stats.istats.radm_cpl_dllp_abort++; - if (sync_cause & AR_INTR_SYNC_RADM_CPL_TLP_ABORT) - sc->debug.stats.istats.radm_cpl_tlp_abort++; - if (sync_cause & AR_INTR_SYNC_RADM_CPL_ECRC_ERR) - sc->debug.stats.istats.radm_cpl_ecrc_err++; - if (sync_cause & AR_INTR_SYNC_RADM_CPL_TIMEOUT) - sc->debug.stats.istats.radm_cpl_timeout++; - if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT) - sc->debug.stats.istats.local_timeout++; - if (sync_cause & AR_INTR_SYNC_PM_ACCESS) - sc->debug.stats.istats.pm_access++; - if (sync_cause & AR_INTR_SYNC_MAC_AWAKE) - sc->debug.stats.istats.mac_awake++; - if (sync_cause & AR_INTR_SYNC_MAC_ASLEEP) - sc->debug.stats.istats.mac_asleep++; - if (sync_cause & AR_INTR_SYNC_MAC_SLEEP_ACCESS) - sc->debug.stats.istats.mac_sleep_access++; -} -#endif - - -static void ath9k_hw_set_clockrate(struct ath_hw *ah) -{ - struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf; - struct ath_common *common = ath9k_hw_common(ah); - unsigned int clockrate; - - /* AR9287 v1.3+ uses async FIFO and runs the MAC at 117 MHz */ - if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) - clockrate = 117; - else if (!ah->curchan) /* should really check for CCK instead */ - clockrate = ATH9K_CLOCK_RATE_CCK; - else if (conf->chandef.chan->band == IEEE80211_BAND_2GHZ) - clockrate = ATH9K_CLOCK_RATE_2GHZ_OFDM; - else if (ah->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK) - clockrate = ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM; - else - clockrate = ATH9K_CLOCK_RATE_5GHZ_OFDM; - - if (conf_is_ht40(conf)) - clockrate *= 2; - - if (ah->curchan) { - if (IS_CHAN_HALF_RATE(ah->curchan)) - clockrate /= 2; - if (IS_CHAN_QUARTER_RATE(ah->curchan)) - clockrate /= 4; - } - - common->clockrate = clockrate; -} - -static u32 ath9k_hw_mac_to_clks(struct ath_hw *ah, u32 usecs) -{ - struct ath_common *common = ath9k_hw_common(ah); - - return usecs * common->clockrate; -} - -bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout) -{ - int i; - - BUG_ON(timeout < AH_TIME_QUANTUM); - - for (i = 0; i < (timeout / AH_TIME_QUANTUM); i++) { - if ((REG_READ(ah, reg) & mask) == val) - return true; - - udelay(AH_TIME_QUANTUM); - } - - ath_dbg(ath9k_hw_common(ah), ANY, - "timeout (%d us) on reg 0x%x: 0x%08x & 0x%08x != 0x%08x\n", - timeout, reg, REG_READ(ah, reg), mask, val); - - return false; -} -EXPORT_SYMBOL(ath9k_hw_wait); - -void ath9k_hw_synth_delay(struct ath_hw *ah, struct ath9k_channel *chan, - int hw_delay) -{ - if (IS_CHAN_B(chan)) - hw_delay = (4 * hw_delay) / 22; - else - hw_delay /= 10; - - if (IS_CHAN_HALF_RATE(chan)) - hw_delay *= 2; - else if (IS_CHAN_QUARTER_RATE(chan)) - hw_delay *= 4; - - udelay(hw_delay + BASE_ACTIVATE_DELAY); -} - -void ath9k_hw_write_array(struct ath_hw *ah, const struct ar5416IniArray *array, - int column, unsigned int *writecnt) -{ - int r; - - ENABLE_REGWRITE_BUFFER(ah); - for (r = 0; r < array->ia_rows; r++) { - REG_WRITE(ah, INI_RA(array, r, 0), - INI_RA(array, r, column)); - DO_DELAY(*writecnt); - } - REGWRITE_BUFFER_FLUSH(ah); -} - -u32 ath9k_hw_reverse_bits(u32 val, u32 n) -{ - u32 retval; - int i; - - for (i = 0, retval = 0; i < n; i++) { - retval = (retval << 1) | (val & 1); - val >>= 1; - } - return retval; -} - -u16 ath9k_hw_computetxtime(struct ath_hw *ah, - u8 phy, int kbps, - u32 frameLen, u16 rateix, - bool shortPreamble) -{ - u32 bitsPerSymbol, numBits, numSymbols, phyTime, txTime; - - if (kbps == 0) - return 0; - - switch (phy) { - case WLAN_RC_PHY_CCK: - phyTime = CCK_PREAMBLE_BITS + CCK_PLCP_BITS; - if (shortPreamble) - phyTime >>= 1; - numBits = frameLen << 3; - txTime = CCK_SIFS_TIME + phyTime + ((numBits * 1000) / kbps); - break; - case WLAN_RC_PHY_OFDM: - if (ah->curchan && IS_CHAN_QUARTER_RATE(ah->curchan)) { - bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_QUARTER) / 1000; - numBits = OFDM_PLCP_BITS + (frameLen << 3); - numSymbols = DIV_ROUND_UP(numBits, bitsPerSymbol); - txTime = OFDM_SIFS_TIME_QUARTER - + OFDM_PREAMBLE_TIME_QUARTER - + (numSymbols * OFDM_SYMBOL_TIME_QUARTER); - } else if (ah->curchan && - IS_CHAN_HALF_RATE(ah->curchan)) { - bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_HALF) / 1000; - numBits = OFDM_PLCP_BITS + (frameLen << 3); - numSymbols = DIV_ROUND_UP(numBits, bitsPerSymbol); - txTime = OFDM_SIFS_TIME_HALF + - OFDM_PREAMBLE_TIME_HALF - + (numSymbols * OFDM_SYMBOL_TIME_HALF); - } else { - bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME) / 1000; - numBits = OFDM_PLCP_BITS + (frameLen << 3); - numSymbols = DIV_ROUND_UP(numBits, bitsPerSymbol); - txTime = OFDM_SIFS_TIME + OFDM_PREAMBLE_TIME - + (numSymbols * OFDM_SYMBOL_TIME); - } - break; - default: - ath_err(ath9k_hw_common(ah), - "Unknown phy %u (rate ix %u)\n", phy, rateix); - txTime = 0; - break; - } - - return txTime; -} -EXPORT_SYMBOL(ath9k_hw_computetxtime); - -void ath9k_hw_get_channel_centers(struct ath_hw *ah, - struct ath9k_channel *chan, - struct chan_centers *centers) -{ - int8_t extoff; - - if (!IS_CHAN_HT40(chan)) { - centers->ctl_center = centers->ext_center = - centers->synth_center = chan->channel; - return; - } - - if ((chan->chanmode == CHANNEL_A_HT40PLUS) || - (chan->chanmode == CHANNEL_G_HT40PLUS)) { - centers->synth_center = - chan->channel + HT40_CHANNEL_CENTER_SHIFT; - extoff = 1; - } else { - centers->synth_center = - chan->channel - HT40_CHANNEL_CENTER_SHIFT; - extoff = -1; - } - - centers->ctl_center = - centers->synth_center - (extoff * HT40_CHANNEL_CENTER_SHIFT); - /* 25 MHz spacing is supported by hw but not on upper layers */ - centers->ext_center = - centers->synth_center + (extoff * HT40_CHANNEL_CENTER_SHIFT); -} - -/******************/ -/* Chip Revisions */ -/******************/ - -static void ath9k_hw_read_revisions(struct ath_hw *ah) -{ - u32 val; - - switch (ah->hw_version.devid) { - case AR5416_AR9100_DEVID: - ah->hw_version.macVersion = AR_SREV_VERSION_9100; - break; - case AR9300_DEVID_AR9330: - ah->hw_version.macVersion = AR_SREV_VERSION_9330; - if (ah->get_mac_revision) { - ah->hw_version.macRev = ah->get_mac_revision(); - } else { - val = REG_READ(ah, AR_SREV); - ah->hw_version.macRev = MS(val, AR_SREV_REVISION2); - } - return; - case AR9300_DEVID_AR9340: - ah->hw_version.macVersion = AR_SREV_VERSION_9340; - val = REG_READ(ah, AR_SREV); - ah->hw_version.macRev = MS(val, AR_SREV_REVISION2); - return; - case AR9300_DEVID_QCA955X: - ah->hw_version.macVersion = AR_SREV_VERSION_9550; - return; - } - - val = REG_READ(ah, AR_SREV) & AR_SREV_ID; - - if (val == 0xFF) { - val = REG_READ(ah, AR_SREV); - ah->hw_version.macVersion = - (val & AR_SREV_VERSION2) >> AR_SREV_TYPE2_S; - ah->hw_version.macRev = MS(val, AR_SREV_REVISION2); - - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) - ah->is_pciexpress = true; - else - ah->is_pciexpress = (val & - AR_SREV_TYPE2_HOST_MODE) ? 0 : 1; - } else { - if (!AR_SREV_9100(ah)) - ah->hw_version.macVersion = MS(val, AR_SREV_VERSION); - - ah->hw_version.macRev = val & AR_SREV_REVISION; - - if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCIE) - ah->is_pciexpress = true; - } -} - -/************************************/ -/* HW Attach, Detach, Init Routines */ -/************************************/ - -static void ath9k_hw_disablepcie(struct ath_hw *ah) -{ - if (!AR_SREV_5416(ah)) - return; - - REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fc00); - REG_WRITE(ah, AR_PCIE_SERDES, 0x24924924); - REG_WRITE(ah, AR_PCIE_SERDES, 0x28000029); - REG_WRITE(ah, AR_PCIE_SERDES, 0x57160824); - REG_WRITE(ah, AR_PCIE_SERDES, 0x25980579); - REG_WRITE(ah, AR_PCIE_SERDES, 0x00000000); - REG_WRITE(ah, AR_PCIE_SERDES, 0x1aaabe40); - REG_WRITE(ah, AR_PCIE_SERDES, 0xbe105554); - REG_WRITE(ah, AR_PCIE_SERDES, 0x000e1007); - - REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000); -} - -/* This should work for all families including legacy */ -static bool ath9k_hw_chip_test(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - u32 regAddr[2] = { AR_STA_ID0 }; - u32 regHold[2]; - static const u32 patternData[4] = { - 0x55555555, 0xaaaaaaaa, 0x66666666, 0x99999999 - }; - int i, j, loop_max; - - if (!AR_SREV_9300_20_OR_LATER(ah)) { - loop_max = 2; - regAddr[1] = AR_PHY_BASE + (8 << 2); - } else - loop_max = 1; - - for (i = 0; i < loop_max; i++) { - u32 addr = regAddr[i]; - u32 wrData, rdData; - - regHold[i] = REG_READ(ah, addr); - for (j = 0; j < 0x100; j++) { - wrData = (j << 16) | j; - REG_WRITE(ah, addr, wrData); - rdData = REG_READ(ah, addr); - if (rdData != wrData) { - ath_err(common, - "address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n", - addr, wrData, rdData); - return false; - } - } - for (j = 0; j < 4; j++) { - wrData = patternData[j]; - REG_WRITE(ah, addr, wrData); - rdData = REG_READ(ah, addr); - if (wrData != rdData) { - ath_err(common, - "address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n", - addr, wrData, rdData); - return false; - } - } - REG_WRITE(ah, regAddr[i], regHold[i]); - } - udelay(100); - - return true; -} - -static void ath9k_hw_init_config(struct ath_hw *ah) -{ - int i; - - ah->config.dma_beacon_response_time = 1; - ah->config.sw_beacon_response_time = 6; - ah->config.additional_swba_backoff = 0; - ah->config.ack_6mb = 0x0; - ah->config.cwm_ignore_extcca = 0; - ah->config.pcie_clock_req = 0; - ah->config.pcie_waen = 0; - ah->config.analog_shiftreg = 1; - ah->config.enable_ani = true; - - for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { - ah->config.spurchans[i][0] = AR_NO_SPUR; - ah->config.spurchans[i][1] = AR_NO_SPUR; - } - - ah->config.rx_intr_mitigation = true; - ah->config.pcieSerDesWrite = true; - - /* - * We need this for PCI devices only (Cardbus, PCI, miniPCI) - * _and_ if on non-uniprocessor systems (Multiprocessor/HT). - * This means we use it for all AR5416 devices, and the few - * minor PCI AR9280 devices out there. - * - * Serialization is required because these devices do not handle - * well the case of two concurrent reads/writes due to the latency - * involved. During one read/write another read/write can be issued - * on another CPU while the previous read/write may still be working - * on our hardware, if we hit this case the hardware poops in a loop. - * We prevent this by serializing reads and writes. - * - * This issue is not present on PCI-Express devices or pre-AR5416 - * devices (legacy, 802.11abg). - */ - if (num_possible_cpus() > 1) - ah->config.serialize_regmode = SER_REG_MODE_AUTO; -} - -static void ath9k_hw_init_defaults(struct ath_hw *ah) -{ - struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); - - regulatory->country_code = CTRY_DEFAULT; - regulatory->power_limit = MAX_RATE_POWER; - - ah->hw_version.magic = AR5416_MAGIC; - ah->hw_version.subvendorid = 0; - - ah->atim_window = 0; - ah->sta_id1_defaults = - AR_STA_ID1_CRPT_MIC_ENABLE | - AR_STA_ID1_MCAST_KSRCH; - if (AR_SREV_9100(ah)) - ah->sta_id1_defaults |= AR_STA_ID1_AR9100_BA_FIX; - ah->slottime = ATH9K_SLOT_TIME_9; - ah->globaltxtimeout = (u32) -1; - ah->power_mode = ATH9K_PM_UNDEFINED; - ah->htc_reset_init = true; -} - -static int ath9k_hw_init_macaddr(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - u32 sum; - int i; - u16 eeval; - static const u32 EEP_MAC[] = { EEP_MAC_LSW, EEP_MAC_MID, EEP_MAC_MSW }; - - sum = 0; - for (i = 0; i < 3; i++) { - eeval = ah->eep_ops->get_eeprom(ah, EEP_MAC[i]); - sum += eeval; - common->macaddr[2 * i] = eeval >> 8; - common->macaddr[2 * i + 1] = eeval & 0xff; - } - if (sum == 0 || sum == 0xffff * 3) - return -EADDRNOTAVAIL; - - return 0; -} - -static int ath9k_hw_post_init(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - int ecode; - - if (common->bus_ops->ath_bus_type != ATH_USB) { - if (!ath9k_hw_chip_test(ah)) - return -ENODEV; - } - - if (!AR_SREV_9300_20_OR_LATER(ah)) { - ecode = ar9002_hw_rf_claim(ah); - if (ecode != 0) - return ecode; - } - - ecode = ath9k_hw_eeprom_init(ah); - if (ecode != 0) - return ecode; - - ath_dbg(ath9k_hw_common(ah), CONFIG, "Eeprom VER: %d, REV: %d\n", - ah->eep_ops->get_eeprom_ver(ah), - ah->eep_ops->get_eeprom_rev(ah)); - - if (ah->config.enable_ani) - ath9k_hw_ani_init(ah); - - return 0; -} - -static int ath9k_hw_attach_ops(struct ath_hw *ah) -{ - if (!AR_SREV_9300_20_OR_LATER(ah)) - return ar9002_hw_attach_ops(ah); - - ar9003_hw_attach_ops(ah); - return 0; -} - -/* Called for all hardware families */ -static int __ath9k_hw_init(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - int r = 0; - - ath9k_hw_read_revisions(ah); - - /* - * Read back AR_WA into a permanent copy and set bits 14 and 17. - * We need to do this to avoid RMW of this register. We cannot - * read the reg when chip is asleep. - */ - ah->WARegVal = REG_READ(ah, AR_WA); - ah->WARegVal |= (AR_WA_D3_L1_DISABLE | - AR_WA_ASPM_TIMER_BASED_DISABLE); - - if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) { - ath_err(common, "Couldn't reset chip\n"); - return -EIO; - } - - if (AR_SREV_9462(ah)) - ah->WARegVal &= ~AR_WA_D3_L1_DISABLE; - - if (AR_SREV_9565(ah)) { - ah->WARegVal |= AR_WA_BIT22; - REG_WRITE(ah, AR_WA, ah->WARegVal); - } - - ath9k_hw_init_defaults(ah); - ath9k_hw_init_config(ah); - - r = ath9k_hw_attach_ops(ah); - if (r) - return r; - - if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) { - ath_err(common, "Couldn't wakeup chip\n"); - return -EIO; - } - - if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_AUTO) { - if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI || - ((AR_SREV_9160(ah) || AR_SREV_9280(ah) || AR_SREV_9287(ah)) && - !ah->is_pciexpress)) { - ah->config.serialize_regmode = - SER_REG_MODE_ON; - } else { - ah->config.serialize_regmode = - SER_REG_MODE_OFF; - } - } - - ath_dbg(common, RESET, "serialize_regmode is %d\n", - ah->config.serialize_regmode); - - if (AR_SREV_9285(ah) || AR_SREV_9271(ah)) - ah->config.max_txtrig_level = MAX_TX_FIFO_THRESHOLD >> 1; - else - ah->config.max_txtrig_level = MAX_TX_FIFO_THRESHOLD; - - switch (ah->hw_version.macVersion) { - case AR_SREV_VERSION_5416_PCI: - case AR_SREV_VERSION_5416_PCIE: - case AR_SREV_VERSION_9160: - case AR_SREV_VERSION_9100: - case AR_SREV_VERSION_9280: - case AR_SREV_VERSION_9285: - case AR_SREV_VERSION_9287: - case AR_SREV_VERSION_9271: - case AR_SREV_VERSION_9300: - case AR_SREV_VERSION_9330: - case AR_SREV_VERSION_9485: - case AR_SREV_VERSION_9340: - case AR_SREV_VERSION_9462: - case AR_SREV_VERSION_9550: - case AR_SREV_VERSION_9565: - break; - default: - ath_err(common, - "Mac Chip Rev 0x%02x.%x is not supported by this driver\n", - ah->hw_version.macVersion, ah->hw_version.macRev); - return -EOPNOTSUPP; - } - - if (AR_SREV_9271(ah) || AR_SREV_9100(ah) || AR_SREV_9340(ah) || - AR_SREV_9330(ah) || AR_SREV_9550(ah)) - ah->is_pciexpress = false; - - ah->hw_version.phyRev = REG_READ(ah, AR_PHY_CHIP_ID); - ath9k_hw_init_cal_settings(ah); - - ah->ani_function = ATH9K_ANI_ALL; - if (AR_SREV_9280_20_OR_LATER(ah) && !AR_SREV_9300_20_OR_LATER(ah)) - ah->ani_function &= ~ATH9K_ANI_NOISE_IMMUNITY_LEVEL; - if (!AR_SREV_9300_20_OR_LATER(ah)) - ah->ani_function &= ~ATH9K_ANI_MRC_CCK; - - if (!ah->is_pciexpress) - ath9k_hw_disablepcie(ah); - - r = ath9k_hw_post_init(ah); - if (r) - return r; - - ath9k_hw_init_mode_gain_regs(ah); - r = ath9k_hw_fill_cap_info(ah); - if (r) - return r; - - r = ath9k_hw_init_macaddr(ah); - if (r) { - ath_err(common, "Failed to initialize MAC address\n"); - return r; - } - - if (AR_SREV_9285(ah) || AR_SREV_9271(ah)) - ah->tx_trig_level = (AR_FTRIG_256B >> AR_FTRIG_S); - else - ah->tx_trig_level = (AR_FTRIG_512B >> AR_FTRIG_S); - - if (AR_SREV_9330(ah)) - ah->bb_watchdog_timeout_ms = 85; - else - ah->bb_watchdog_timeout_ms = 25; - - common->state = ATH_HW_INITIALIZED; - - return 0; -} - -int ath9k_hw_init(struct ath_hw *ah) -{ - int ret; - struct ath_common *common = ath9k_hw_common(ah); - - /* These are all the AR5008/AR9001/AR9002/AR9003 hardware family of chipsets */ - switch (ah->hw_version.devid) { - case AR5416_DEVID_PCI: - case AR5416_DEVID_PCIE: - case AR5416_AR9100_DEVID: - case AR9160_DEVID_PCI: - case AR9280_DEVID_PCI: - case AR9280_DEVID_PCIE: - case AR9285_DEVID_PCIE: - case AR9287_DEVID_PCI: - case AR9287_DEVID_PCIE: - case AR2427_DEVID_PCIE: - case AR9300_DEVID_PCIE: - case AR9300_DEVID_AR9485_PCIE: - case AR9300_DEVID_AR9330: - case AR9300_DEVID_AR9340: - case AR9300_DEVID_QCA955X: - case AR9300_DEVID_AR9580: - case AR9300_DEVID_AR9462: - case AR9485_DEVID_AR1111: - case AR9300_DEVID_AR9565: - break; - default: - if (common->bus_ops->ath_bus_type == ATH_USB) - break; - ath_err(common, "Hardware device ID 0x%04x not supported\n", - ah->hw_version.devid); - return -EOPNOTSUPP; - } - - ret = __ath9k_hw_init(ah); - if (ret) { - ath_err(common, - "Unable to initialize hardware; initialization status: %d\n", - ret); - return ret; - } - - return 0; -} -EXPORT_SYMBOL(ath9k_hw_init); - -static void ath9k_hw_init_qos(struct ath_hw *ah) -{ - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_MIC_QOS_CONTROL, 0x100aa); - REG_WRITE(ah, AR_MIC_QOS_SELECT, 0x3210); - - REG_WRITE(ah, AR_QOS_NO_ACK, - SM(2, AR_QOS_NO_ACK_TWO_BIT) | - SM(5, AR_QOS_NO_ACK_BIT_OFF) | - SM(0, AR_QOS_NO_ACK_BYTE_OFF)); - - REG_WRITE(ah, AR_TXOP_X, AR_TXOP_X_VAL); - REG_WRITE(ah, AR_TXOP_0_3, 0xFFFFFFFF); - REG_WRITE(ah, AR_TXOP_4_7, 0xFFFFFFFF); - REG_WRITE(ah, AR_TXOP_8_11, 0xFFFFFFFF); - REG_WRITE(ah, AR_TXOP_12_15, 0xFFFFFFFF); - - REGWRITE_BUFFER_FLUSH(ah); -} - -u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - int i = 0; - - REG_CLR_BIT(ah, PLL3, PLL3_DO_MEAS_MASK); - udelay(100); - REG_SET_BIT(ah, PLL3, PLL3_DO_MEAS_MASK); - - while ((REG_READ(ah, PLL4) & PLL4_MEAS_DONE) == 0) { - - udelay(100); - - if (WARN_ON_ONCE(i >= 100)) { - ath_err(common, "PLL4 meaurement not done\n"); - break; - } - - i++; - } - - return (REG_READ(ah, PLL3) & SQSUM_DVC_MASK) >> 3; -} -EXPORT_SYMBOL(ar9003_get_pll_sqsum_dvc); - -static void ath9k_hw_init_pll(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - u32 pll; - - if (AR_SREV_9485(ah) || AR_SREV_9565(ah)) { - /* program BB PLL ki and kd value, ki=0x4, kd=0x40 */ - REG_RMW_FIELD(ah, AR_CH0_BB_DPLL2, - AR_CH0_BB_DPLL2_PLL_PWD, 0x1); - REG_RMW_FIELD(ah, AR_CH0_BB_DPLL2, - AR_CH0_DPLL2_KD, 0x40); - REG_RMW_FIELD(ah, AR_CH0_BB_DPLL2, - AR_CH0_DPLL2_KI, 0x4); - - REG_RMW_FIELD(ah, AR_CH0_BB_DPLL1, - AR_CH0_BB_DPLL1_REFDIV, 0x5); - REG_RMW_FIELD(ah, AR_CH0_BB_DPLL1, - AR_CH0_BB_DPLL1_NINI, 0x58); - REG_RMW_FIELD(ah, AR_CH0_BB_DPLL1, - AR_CH0_BB_DPLL1_NFRAC, 0x0); - - REG_RMW_FIELD(ah, AR_CH0_BB_DPLL2, - AR_CH0_BB_DPLL2_OUTDIV, 0x1); - REG_RMW_FIELD(ah, AR_CH0_BB_DPLL2, - AR_CH0_BB_DPLL2_LOCAL_PLL, 0x1); - REG_RMW_FIELD(ah, AR_CH0_BB_DPLL2, - AR_CH0_BB_DPLL2_EN_NEGTRIG, 0x1); - - /* program BB PLL phase_shift to 0x6 */ - REG_RMW_FIELD(ah, AR_CH0_BB_DPLL3, - AR_CH0_BB_DPLL3_PHASE_SHIFT, 0x6); - - REG_RMW_FIELD(ah, AR_CH0_BB_DPLL2, - AR_CH0_BB_DPLL2_PLL_PWD, 0x0); - udelay(1000); - } else if (AR_SREV_9330(ah)) { - u32 ddr_dpll2, pll_control2, kd; - - if (ah->is_clk_25mhz) { - ddr_dpll2 = 0x18e82f01; - pll_control2 = 0xe04a3d; - kd = 0x1d; - } else { - ddr_dpll2 = 0x19e82f01; - pll_control2 = 0x886666; - kd = 0x3d; - } - - /* program DDR PLL ki and kd value */ - REG_WRITE(ah, AR_CH0_DDR_DPLL2, ddr_dpll2); - - /* program DDR PLL phase_shift */ - REG_RMW_FIELD(ah, AR_CH0_DDR_DPLL3, - AR_CH0_DPLL3_PHASE_SHIFT, 0x1); - - REG_WRITE(ah, AR_RTC_PLL_CONTROL, 0x1142c); - udelay(1000); - - /* program refdiv, nint, frac to RTC register */ - REG_WRITE(ah, AR_RTC_PLL_CONTROL2, pll_control2); - - /* program BB PLL kd and ki value */ - REG_RMW_FIELD(ah, AR_CH0_BB_DPLL2, AR_CH0_DPLL2_KD, kd); - REG_RMW_FIELD(ah, AR_CH0_BB_DPLL2, AR_CH0_DPLL2_KI, 0x06); - - /* program BB PLL phase_shift */ - REG_RMW_FIELD(ah, AR_CH0_BB_DPLL3, - AR_CH0_BB_DPLL3_PHASE_SHIFT, 0x1); - } else if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) { - u32 regval, pll2_divint, pll2_divfrac, refdiv; - - REG_WRITE(ah, AR_RTC_PLL_CONTROL, 0x1142c); - udelay(1000); - - REG_SET_BIT(ah, AR_PHY_PLL_MODE, 0x1 << 16); - udelay(100); - - if (ah->is_clk_25mhz) { - pll2_divint = 0x54; - pll2_divfrac = 0x1eb85; - refdiv = 3; - } else { - if (AR_SREV_9340(ah)) { - pll2_divint = 88; - pll2_divfrac = 0; - refdiv = 5; - } else { - pll2_divint = 0x11; - pll2_divfrac = 0x26666; - refdiv = 1; - } - } - - regval = REG_READ(ah, AR_PHY_PLL_MODE); - regval |= (0x1 << 16); - REG_WRITE(ah, AR_PHY_PLL_MODE, regval); - udelay(100); - - REG_WRITE(ah, AR_PHY_PLL_CONTROL, (refdiv << 27) | - (pll2_divint << 18) | pll2_divfrac); - udelay(100); - - regval = REG_READ(ah, AR_PHY_PLL_MODE); - if (AR_SREV_9340(ah)) - regval = (regval & 0x80071fff) | (0x1 << 30) | - (0x1 << 13) | (0x4 << 26) | (0x18 << 19); - else - regval = (regval & 0x80071fff) | (0x3 << 30) | - (0x1 << 13) | (0x4 << 26) | (0x60 << 19); - REG_WRITE(ah, AR_PHY_PLL_MODE, regval); - REG_WRITE(ah, AR_PHY_PLL_MODE, - REG_READ(ah, AR_PHY_PLL_MODE) & 0xfffeffff); - udelay(1000); - } - - pll = ath9k_hw_compute_pll_control(ah, chan); - if (AR_SREV_9565(ah)) - pll |= 0x40000; - REG_WRITE(ah, AR_RTC_PLL_CONTROL, pll); - - if (AR_SREV_9485(ah) || AR_SREV_9340(ah) || AR_SREV_9330(ah) || - AR_SREV_9550(ah)) - udelay(1000); - - /* Switch the core clock for ar9271 to 117Mhz */ - if (AR_SREV_9271(ah)) { - udelay(500); - REG_WRITE(ah, 0x50040, 0x304); - } - - udelay(RTC_PLL_SETTLE_DELAY); - - REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK); - - if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) { - if (ah->is_clk_25mhz) { - REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); - REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); - REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae); - } else { - REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1); - REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400); - REG_WRITE(ah, AR_SLP32_INC, 0x0001e800); - } - udelay(100); - } -} - -static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah, - enum nl80211_iftype opmode) -{ - u32 sync_default = AR_INTR_SYNC_DEFAULT; - u32 imr_reg = AR_IMR_TXERR | - AR_IMR_TXURN | - AR_IMR_RXERR | - AR_IMR_RXORN | - AR_IMR_BCNMISC; - - if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) - sync_default &= ~AR_INTR_SYNC_HOST1_FATAL; - - if (AR_SREV_9300_20_OR_LATER(ah)) { - imr_reg |= AR_IMR_RXOK_HP; - if (ah->config.rx_intr_mitigation) - imr_reg |= AR_IMR_RXINTM | AR_IMR_RXMINTR; - else - imr_reg |= AR_IMR_RXOK_LP; - - } else { - if (ah->config.rx_intr_mitigation) - imr_reg |= AR_IMR_RXINTM | AR_IMR_RXMINTR; - else - imr_reg |= AR_IMR_RXOK; - } - - if (ah->config.tx_intr_mitigation) - imr_reg |= AR_IMR_TXINTM | AR_IMR_TXMINTR; - else - imr_reg |= AR_IMR_TXOK; - - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_IMR, imr_reg); - ah->imrs2_reg |= AR_IMR_S2_GTT; - REG_WRITE(ah, AR_IMR_S2, ah->imrs2_reg); - - if (!AR_SREV_9100(ah)) { - REG_WRITE(ah, AR_INTR_SYNC_CAUSE, 0xFFFFFFFF); - REG_WRITE(ah, AR_INTR_SYNC_ENABLE, sync_default); - REG_WRITE(ah, AR_INTR_SYNC_MASK, 0); - } - - REGWRITE_BUFFER_FLUSH(ah); - - if (AR_SREV_9300_20_OR_LATER(ah)) { - REG_WRITE(ah, AR_INTR_PRIO_ASYNC_ENABLE, 0); - REG_WRITE(ah, AR_INTR_PRIO_ASYNC_MASK, 0); - REG_WRITE(ah, AR_INTR_PRIO_SYNC_ENABLE, 0); - REG_WRITE(ah, AR_INTR_PRIO_SYNC_MASK, 0); - } -} - -static void ath9k_hw_set_sifs_time(struct ath_hw *ah, u32 us) -{ - u32 val = ath9k_hw_mac_to_clks(ah, us - 2); - val = min(val, (u32) 0xFFFF); - REG_WRITE(ah, AR_D_GBL_IFS_SIFS, val); -} - -static void ath9k_hw_setslottime(struct ath_hw *ah, u32 us) -{ - u32 val = ath9k_hw_mac_to_clks(ah, us); - val = min(val, (u32) 0xFFFF); - REG_WRITE(ah, AR_D_GBL_IFS_SLOT, val); -} - -static void ath9k_hw_set_ack_timeout(struct ath_hw *ah, u32 us) -{ - u32 val = ath9k_hw_mac_to_clks(ah, us); - val = min(val, (u32) MS(0xFFFFFFFF, AR_TIME_OUT_ACK)); - REG_RMW_FIELD(ah, AR_TIME_OUT, AR_TIME_OUT_ACK, val); -} - -static void ath9k_hw_set_cts_timeout(struct ath_hw *ah, u32 us) -{ - u32 val = ath9k_hw_mac_to_clks(ah, us); - val = min(val, (u32) MS(0xFFFFFFFF, AR_TIME_OUT_CTS)); - REG_RMW_FIELD(ah, AR_TIME_OUT, AR_TIME_OUT_CTS, val); -} - -static bool ath9k_hw_set_global_txtimeout(struct ath_hw *ah, u32 tu) -{ - if (tu > 0xFFFF) { - ath_dbg(ath9k_hw_common(ah), XMIT, "bad global tx timeout %u\n", - tu); - ah->globaltxtimeout = (u32) -1; - return false; - } else { - REG_RMW_FIELD(ah, AR_GTXTO, AR_GTXTO_TIMEOUT_LIMIT, tu); - ah->globaltxtimeout = tu; - return true; - } -} - -void ath9k_hw_init_global_settings(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ieee80211_conf *conf = &common->hw->conf; - const struct ath9k_channel *chan = ah->curchan; - int acktimeout, ctstimeout, ack_offset = 0; - int slottime; - int sifstime; - int rx_lat = 0, tx_lat = 0, eifs = 0; - u32 reg; - - ath_dbg(ath9k_hw_common(ah), RESET, "ah->misc_mode 0x%x\n", - ah->misc_mode); - - if (!chan) - return; - - if (ah->misc_mode != 0) - REG_SET_BIT(ah, AR_PCU_MISC, ah->misc_mode); - - if (IS_CHAN_A_FAST_CLOCK(ah, chan)) - rx_lat = 41; - else - rx_lat = 37; - tx_lat = 54; - - if (IS_CHAN_5GHZ(chan)) - sifstime = 16; - else - sifstime = 10; - - if (IS_CHAN_HALF_RATE(chan)) { - eifs = 175; - rx_lat *= 2; - tx_lat *= 2; - if (IS_CHAN_A_FAST_CLOCK(ah, chan)) - tx_lat += 11; - - sifstime *= 2; - ack_offset = 16; - slottime = 13; - } else if (IS_CHAN_QUARTER_RATE(chan)) { - eifs = 340; - rx_lat = (rx_lat * 4) - 1; - tx_lat *= 4; - if (IS_CHAN_A_FAST_CLOCK(ah, chan)) - tx_lat += 22; - - sifstime *= 4; - ack_offset = 32; - slottime = 21; - } else { - if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) { - eifs = AR_D_GBL_IFS_EIFS_ASYNC_FIFO; - reg = AR_USEC_ASYNC_FIFO; - } else { - eifs = REG_READ(ah, AR_D_GBL_IFS_EIFS)/ - common->clockrate; - reg = REG_READ(ah, AR_USEC); - } - rx_lat = MS(reg, AR_USEC_RX_LAT); - tx_lat = MS(reg, AR_USEC_TX_LAT); - - slottime = ah->slottime; - } - - /* As defined by IEEE 802.11-2007 17.3.8.6 */ - slottime += 3 * ah->coverage_class; - acktimeout = slottime + sifstime + ack_offset; - ctstimeout = acktimeout; - - /* - * Workaround for early ACK timeouts, add an offset to match the - * initval's 64us ack timeout value. Use 48us for the CTS timeout. - * This was initially only meant to work around an issue with delayed - * BA frames in some implementations, but it has been found to fix ACK - * timeout issues in other cases as well. - */ - if (conf->chandef.chan && - conf->chandef.chan->band == IEEE80211_BAND_2GHZ && - !IS_CHAN_HALF_RATE(chan) && !IS_CHAN_QUARTER_RATE(chan)) { - acktimeout += 64 - sifstime - ah->slottime; - ctstimeout += 48 - sifstime - ah->slottime; - } - - - ath9k_hw_set_sifs_time(ah, sifstime); - ath9k_hw_setslottime(ah, slottime); - ath9k_hw_set_ack_timeout(ah, acktimeout); - ath9k_hw_set_cts_timeout(ah, ctstimeout); - if (ah->globaltxtimeout != (u32) -1) - ath9k_hw_set_global_txtimeout(ah, ah->globaltxtimeout); - - REG_WRITE(ah, AR_D_GBL_IFS_EIFS, ath9k_hw_mac_to_clks(ah, eifs)); - REG_RMW(ah, AR_USEC, - (common->clockrate - 1) | - SM(rx_lat, AR_USEC_RX_LAT) | - SM(tx_lat, AR_USEC_TX_LAT), - AR_USEC_TX_LAT | AR_USEC_RX_LAT | AR_USEC_USEC); - -} -EXPORT_SYMBOL(ath9k_hw_init_global_settings); - -void ath9k_hw_deinit(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - - if (common->state < ATH_HW_INITIALIZED) - return; - - ath9k_hw_setpower(ah, ATH9K_PM_FULL_SLEEP); -} -EXPORT_SYMBOL(ath9k_hw_deinit); - -/*******/ -/* INI */ -/*******/ - -u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan) -{ - u32 ctl = ath_regd_get_band_ctl(reg, chan->chan->band); - - if (IS_CHAN_B(chan)) - ctl |= CTL_11B; - else if (IS_CHAN_G(chan)) - ctl |= CTL_11G; - else - ctl |= CTL_11A; - - return ctl; -} - -/****************************************/ -/* Reset and Channel Switching Routines */ -/****************************************/ - -static inline void ath9k_hw_set_dma(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - int txbuf_size; - - ENABLE_REGWRITE_BUFFER(ah); - - /* - * set AHB_MODE not to do cacheline prefetches - */ - if (!AR_SREV_9300_20_OR_LATER(ah)) - REG_SET_BIT(ah, AR_AHB_MODE, AR_AHB_PREFETCH_RD_EN); - - /* - * let mac dma reads be in 128 byte chunks - */ - REG_RMW(ah, AR_TXCFG, AR_TXCFG_DMASZ_128B, AR_TXCFG_DMASZ_MASK); - - REGWRITE_BUFFER_FLUSH(ah); - - /* - * Restore TX Trigger Level to its pre-reset value. - * The initial value depends on whether aggregation is enabled, and is - * adjusted whenever underruns are detected. - */ - if (!AR_SREV_9300_20_OR_LATER(ah)) - REG_RMW_FIELD(ah, AR_TXCFG, AR_FTRIG, ah->tx_trig_level); - - ENABLE_REGWRITE_BUFFER(ah); - - /* - * let mac dma writes be in 128 byte chunks - */ - REG_RMW(ah, AR_RXCFG, AR_RXCFG_DMASZ_128B, AR_RXCFG_DMASZ_MASK); - - /* - * Setup receive FIFO threshold to hold off TX activities - */ - REG_WRITE(ah, AR_RXFIFO_CFG, 0x200); - - if (AR_SREV_9300_20_OR_LATER(ah)) { - REG_RMW_FIELD(ah, AR_RXBP_THRESH, AR_RXBP_THRESH_HP, 0x1); - REG_RMW_FIELD(ah, AR_RXBP_THRESH, AR_RXBP_THRESH_LP, 0x1); - - ath9k_hw_set_rx_bufsize(ah, common->rx_bufsize - - ah->caps.rx_status_len); - } - - /* - * reduce the number of usable entries in PCU TXBUF to avoid - * wrap around issues. - */ - if (AR_SREV_9285(ah)) { - /* For AR9285 the number of Fifos are reduced to half. - * So set the usable tx buf size also to half to - * avoid data/delimiter underruns - */ - txbuf_size = AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE; - } else if (AR_SREV_9340_13_OR_LATER(ah)) { - /* Uses fewer entries for AR934x v1.3+ to prevent rx overruns */ - txbuf_size = AR_9340_PCU_TXBUF_CTRL_USABLE_SIZE; - } else { - txbuf_size = AR_PCU_TXBUF_CTRL_USABLE_SIZE; - } - - if (!AR_SREV_9271(ah)) - REG_WRITE(ah, AR_PCU_TXBUF_CTRL, txbuf_size); - - REGWRITE_BUFFER_FLUSH(ah); - - if (AR_SREV_9300_20_OR_LATER(ah)) - ath9k_hw_reset_txstatus_ring(ah); -} - -static void ath9k_hw_set_operating_mode(struct ath_hw *ah, int opmode) -{ - u32 mask = AR_STA_ID1_STA_AP | AR_STA_ID1_ADHOC; - u32 set = AR_STA_ID1_KSRCH_MODE; - - switch (opmode) { - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_MESH_POINT: - set |= AR_STA_ID1_ADHOC; - REG_SET_BIT(ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION); - break; - case NL80211_IFTYPE_AP: - set |= AR_STA_ID1_STA_AP; - /* fall through */ - case NL80211_IFTYPE_STATION: - REG_CLR_BIT(ah, AR_CFG, AR_CFG_AP_ADHOC_INDICATION); - break; - default: - if (!ah->is_monitoring) - set = 0; - break; - } - REG_RMW(ah, AR_STA_ID1, set, mask); -} - -void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, - u32 *coef_mantissa, u32 *coef_exponent) -{ - u32 coef_exp, coef_man; - - for (coef_exp = 31; coef_exp > 0; coef_exp--) - if ((coef_scaled >> coef_exp) & 0x1) - break; - - coef_exp = 14 - (coef_exp - COEF_SCALE_S); - - coef_man = coef_scaled + (1 << (COEF_SCALE_S - coef_exp - 1)); - - *coef_mantissa = coef_man >> (COEF_SCALE_S - coef_exp); - *coef_exponent = coef_exp - 16; -} - -static bool ath9k_hw_set_reset(struct ath_hw *ah, int type) -{ - u32 rst_flags; - u32 tmpReg; - - if (AR_SREV_9100(ah)) { - REG_RMW_FIELD(ah, AR_RTC_DERIVED_CLK, - AR_RTC_DERIVED_CLK_PERIOD, 1); - (void)REG_READ(ah, AR_RTC_DERIVED_CLK); - } - - ENABLE_REGWRITE_BUFFER(ah); - - if (AR_SREV_9300_20_OR_LATER(ah)) { - REG_WRITE(ah, AR_WA, ah->WARegVal); - udelay(10); - } - - REG_WRITE(ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN | - AR_RTC_FORCE_WAKE_ON_INT); - - if (AR_SREV_9100(ah)) { - rst_flags = AR_RTC_RC_MAC_WARM | AR_RTC_RC_MAC_COLD | - AR_RTC_RC_COLD_RESET | AR_RTC_RC_WARM_RESET; - } else { - tmpReg = REG_READ(ah, AR_INTR_SYNC_CAUSE); - if (AR_SREV_9340(ah)) - tmpReg &= AR9340_INTR_SYNC_LOCAL_TIMEOUT; - else - tmpReg &= AR_INTR_SYNC_LOCAL_TIMEOUT | - AR_INTR_SYNC_RADM_CPL_TIMEOUT; - - if (tmpReg) { - u32 val; - REG_WRITE(ah, AR_INTR_SYNC_ENABLE, 0); - - val = AR_RC_HOSTIF; - if (!AR_SREV_9300_20_OR_LATER(ah)) - val |= AR_RC_AHB; - REG_WRITE(ah, AR_RC, val); - - } else if (!AR_SREV_9300_20_OR_LATER(ah)) - REG_WRITE(ah, AR_RC, AR_RC_AHB); - - rst_flags = AR_RTC_RC_MAC_WARM; - if (type == ATH9K_RESET_COLD) - rst_flags |= AR_RTC_RC_MAC_COLD; - } - - if (AR_SREV_9330(ah)) { - int npend = 0; - int i; - - /* AR9330 WAR: - * call external reset function to reset WMAC if: - * - doing a cold reset - * - we have pending frames in the TX queues - */ - - for (i = 0; i < AR_NUM_QCU; i++) { - npend = ath9k_hw_numtxpending(ah, i); - if (npend) - break; - } - - if (ah->external_reset && - (npend || type == ATH9K_RESET_COLD)) { - int reset_err = 0; - - ath_dbg(ath9k_hw_common(ah), RESET, - "reset MAC via external reset\n"); - - reset_err = ah->external_reset(); - if (reset_err) { - ath_err(ath9k_hw_common(ah), - "External reset failed, err=%d\n", - reset_err); - return false; - } - - REG_WRITE(ah, AR_RTC_RESET, 1); - } - } - - if (ath9k_hw_mci_is_enabled(ah)) - ar9003_mci_check_gpm_offset(ah); - - REG_WRITE(ah, AR_RTC_RC, rst_flags); - - REGWRITE_BUFFER_FLUSH(ah); - - udelay(50); - - REG_WRITE(ah, AR_RTC_RC, 0); - if (!ath9k_hw_wait(ah, AR_RTC_RC, AR_RTC_RC_M, 0, AH_WAIT_TIMEOUT)) { - ath_dbg(ath9k_hw_common(ah), RESET, "RTC stuck in MAC reset\n"); - return false; - } - - if (!AR_SREV_9100(ah)) - REG_WRITE(ah, AR_RC, 0); - - if (AR_SREV_9100(ah)) - udelay(50); - - return true; -} - -static bool ath9k_hw_set_reset_power_on(struct ath_hw *ah) -{ - ENABLE_REGWRITE_BUFFER(ah); - - if (AR_SREV_9300_20_OR_LATER(ah)) { - REG_WRITE(ah, AR_WA, ah->WARegVal); - udelay(10); - } - - REG_WRITE(ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN | - AR_RTC_FORCE_WAKE_ON_INT); - - if (!AR_SREV_9100(ah) && !AR_SREV_9300_20_OR_LATER(ah)) - REG_WRITE(ah, AR_RC, AR_RC_AHB); - - REG_WRITE(ah, AR_RTC_RESET, 0); - - REGWRITE_BUFFER_FLUSH(ah); - - if (!AR_SREV_9300_20_OR_LATER(ah)) - udelay(2); - - if (!AR_SREV_9100(ah) && !AR_SREV_9300_20_OR_LATER(ah)) - REG_WRITE(ah, AR_RC, 0); - - REG_WRITE(ah, AR_RTC_RESET, 1); - - if (!ath9k_hw_wait(ah, - AR_RTC_STATUS, - AR_RTC_STATUS_M, - AR_RTC_STATUS_ON, - AH_WAIT_TIMEOUT)) { - ath_dbg(ath9k_hw_common(ah), RESET, "RTC not waking up\n"); - return false; - } - - return ath9k_hw_set_reset(ah, ATH9K_RESET_WARM); -} - -static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type) -{ - bool ret = false; - - if (AR_SREV_9300_20_OR_LATER(ah)) { - REG_WRITE(ah, AR_WA, ah->WARegVal); - udelay(10); - } - - REG_WRITE(ah, AR_RTC_FORCE_WAKE, - AR_RTC_FORCE_WAKE_EN | AR_RTC_FORCE_WAKE_ON_INT); - - if (!ah->reset_power_on) - type = ATH9K_RESET_POWER_ON; - - switch (type) { - case ATH9K_RESET_POWER_ON: - ret = ath9k_hw_set_reset_power_on(ah); - if (ret) - ah->reset_power_on = true; - break; - case ATH9K_RESET_WARM: - case ATH9K_RESET_COLD: - ret = ath9k_hw_set_reset(ah, type); - break; - default: - break; - } - - return ret; -} - -static bool ath9k_hw_chip_reset(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - int reset_type = ATH9K_RESET_WARM; - - if (AR_SREV_9280(ah)) { - if (ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) - reset_type = ATH9K_RESET_POWER_ON; - else - reset_type = ATH9K_RESET_COLD; - } else if (ah->chip_fullsleep || REG_READ(ah, AR_Q_TXE) || - (REG_READ(ah, AR_CR) & AR_CR_RXE)) - reset_type = ATH9K_RESET_COLD; - - if (!ath9k_hw_set_reset_reg(ah, reset_type)) - return false; - - if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) - return false; - - ah->chip_fullsleep = false; - - if (AR_SREV_9330(ah)) - ar9003_hw_internal_regulator_apply(ah); - ath9k_hw_init_pll(ah, chan); - ath9k_hw_set_rfmode(ah, chan); - - return true; -} - -static bool ath9k_hw_channel_change(struct ath_hw *ah, - struct ath9k_channel *chan) -{ - struct ath_common *common = ath9k_hw_common(ah); - u32 qnum; - int r; - bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA); - bool band_switch, mode_diff; - u8 ini_reloaded; - - band_switch = (chan->channelFlags & (CHANNEL_2GHZ | CHANNEL_5GHZ)) != - (ah->curchan->channelFlags & (CHANNEL_2GHZ | - CHANNEL_5GHZ)); - mode_diff = (chan->chanmode != ah->curchan->chanmode); - - for (qnum = 0; qnum < AR_NUM_QCU; qnum++) { - if (ath9k_hw_numtxpending(ah, qnum)) { - ath_dbg(common, QUEUE, - "Transmit frames pending on queue %d\n", qnum); - return false; - } - } - - if (!ath9k_hw_rfbus_req(ah)) { - ath_err(common, "Could not kill baseband RX\n"); - return false; - } - - if (edma && (band_switch || mode_diff)) { - ath9k_hw_mark_phy_inactive(ah); - udelay(5); - - ath9k_hw_init_pll(ah, NULL); - - if (ath9k_hw_fast_chan_change(ah, chan, &ini_reloaded)) { - ath_err(common, "Failed to do fast channel change\n"); - return false; - } - } - - ath9k_hw_set_channel_regs(ah, chan); - - r = ath9k_hw_rf_set_freq(ah, chan); - if (r) { - ath_err(common, "Failed to set channel\n"); - return false; - } - ath9k_hw_set_clockrate(ah); - ath9k_hw_apply_txpower(ah, chan, false); - ath9k_hw_rfbus_done(ah); - - if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) - ath9k_hw_set_delta_slope(ah, chan); - - ath9k_hw_spur_mitigate_freq(ah, chan); - - if (edma && (band_switch || mode_diff)) { - ah->ah_flags |= AH_FASTCC; - if (band_switch || ini_reloaded) - ah->eep_ops->set_board_values(ah, chan); - - ath9k_hw_init_bb(ah, chan); - - if (band_switch || ini_reloaded) - ath9k_hw_init_cal(ah, chan); - ah->ah_flags &= ~AH_FASTCC; - } - - return true; -} - -static void ath9k_hw_apply_gpio_override(struct ath_hw *ah) -{ - u32 gpio_mask = ah->gpio_mask; - int i; - - for (i = 0; gpio_mask; i++, gpio_mask >>= 1) { - if (!(gpio_mask & 1)) - continue; - - ath9k_hw_cfg_output(ah, i, AR_GPIO_OUTPUT_MUX_AS_OUTPUT); - ath9k_hw_set_gpio(ah, i, !!(ah->gpio_val & BIT(i))); - } -} - -static bool ath9k_hw_check_dcs(u32 dma_dbg, u32 num_dcu_states, - int *hang_state, int *hang_pos) -{ - static u32 dcu_chain_state[] = {5, 6, 9}; /* DCU chain stuck states */ - u32 chain_state, dcs_pos, i; - - for (dcs_pos = 0; dcs_pos < num_dcu_states; dcs_pos++) { - chain_state = (dma_dbg >> (5 * dcs_pos)) & 0x1f; - for (i = 0; i < 3; i++) { - if (chain_state == dcu_chain_state[i]) { - *hang_state = chain_state; - *hang_pos = dcs_pos; - return true; - } - } - } - return false; -} - -#define DCU_COMPLETE_STATE 1 -#define DCU_COMPLETE_STATE_MASK 0x3 -#define NUM_STATUS_READS 50 -static bool ath9k_hw_detect_mac_hang(struct ath_hw *ah) -{ - u32 chain_state, comp_state, dcs_reg = AR_DMADBG_4; - u32 i, hang_pos, hang_state, num_state = 6; - - comp_state = REG_READ(ah, AR_DMADBG_6); - - if ((comp_state & DCU_COMPLETE_STATE_MASK) != DCU_COMPLETE_STATE) { - ath_dbg(ath9k_hw_common(ah), RESET, - "MAC Hang signature not found at DCU complete\n"); - return false; - } - - chain_state = REG_READ(ah, dcs_reg); - if (ath9k_hw_check_dcs(chain_state, num_state, &hang_state, &hang_pos)) - goto hang_check_iter; - - dcs_reg = AR_DMADBG_5; - num_state = 4; - chain_state = REG_READ(ah, dcs_reg); - if (ath9k_hw_check_dcs(chain_state, num_state, &hang_state, &hang_pos)) - goto hang_check_iter; - - ath_dbg(ath9k_hw_common(ah), RESET, - "MAC Hang signature 1 not found\n"); - return false; - -hang_check_iter: - ath_dbg(ath9k_hw_common(ah), RESET, - "DCU registers: chain %08x complete %08x Hang: state %d pos %d\n", - chain_state, comp_state, hang_state, hang_pos); - - for (i = 0; i < NUM_STATUS_READS; i++) { - chain_state = REG_READ(ah, dcs_reg); - chain_state = (chain_state >> (5 * hang_pos)) & 0x1f; - comp_state = REG_READ(ah, AR_DMADBG_6); - - if (((comp_state & DCU_COMPLETE_STATE_MASK) != - DCU_COMPLETE_STATE) || - (chain_state != hang_state)) - return false; - } - - ath_dbg(ath9k_hw_common(ah), RESET, "MAC Hang signature 1 found\n"); - - return true; -} - -bool ath9k_hw_check_alive(struct ath_hw *ah) -{ - int count = 50; - u32 reg; - - if (AR_SREV_9300(ah)) - return !ath9k_hw_detect_mac_hang(ah); - - if (AR_SREV_9285_12_OR_LATER(ah)) - return true; - - do { - reg = REG_READ(ah, AR_OBS_BUS_1); - - if ((reg & 0x7E7FFFEF) == 0x00702400) - continue; - - switch (reg & 0x7E000B00) { - case 0x1E000000: - case 0x52000B00: - case 0x18000B00: - continue; - default: - return true; - } - } while (count-- > 0); - - return false; -} -EXPORT_SYMBOL(ath9k_hw_check_alive); - -static void ath9k_hw_init_mfp(struct ath_hw *ah) -{ - /* Setup MFP options for CCMP */ - if (AR_SREV_9280_20_OR_LATER(ah)) { - /* Mask Retry(b11), PwrMgt(b12), MoreData(b13) to 0 in mgmt - * frames when constructing CCMP AAD. */ - REG_RMW_FIELD(ah, AR_AES_MUTE_MASK1, AR_AES_MUTE_MASK1_FC_MGMT, - 0xc7ff); - ah->sw_mgmt_crypto = false; - } else if (AR_SREV_9160_10_OR_LATER(ah)) { - /* Disable hardware crypto for management frames */ - REG_CLR_BIT(ah, AR_PCU_MISC_MODE2, - AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE); - REG_SET_BIT(ah, AR_PCU_MISC_MODE2, - AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT); - ah->sw_mgmt_crypto = true; - } else { - ah->sw_mgmt_crypto = true; - } -} - -static void ath9k_hw_reset_opmode(struct ath_hw *ah, - u32 macStaId1, u32 saveDefAntenna) -{ - struct ath_common *common = ath9k_hw_common(ah); - - ENABLE_REGWRITE_BUFFER(ah); - - REG_RMW(ah, AR_STA_ID1, macStaId1 - | AR_STA_ID1_RTS_USE_DEF - | (ah->config.ack_6mb ? AR_STA_ID1_ACKCTS_6MB : 0) - | ah->sta_id1_defaults, - ~AR_STA_ID1_SADH_MASK); - ath_hw_setbssidmask(common); - REG_WRITE(ah, AR_DEF_ANTENNA, saveDefAntenna); - ath9k_hw_write_associd(ah); - REG_WRITE(ah, AR_ISR, ~0); - REG_WRITE(ah, AR_RSSI_THR, INIT_RSSI_THR); - - REGWRITE_BUFFER_FLUSH(ah); - - ath9k_hw_set_operating_mode(ah, ah->opmode); -} - -static void ath9k_hw_init_queues(struct ath_hw *ah) -{ - int i; - - ENABLE_REGWRITE_BUFFER(ah); - - for (i = 0; i < AR_NUM_DCU; i++) - REG_WRITE(ah, AR_DQCUMASK(i), 1 << i); - - REGWRITE_BUFFER_FLUSH(ah); - - ah->intr_txqs = 0; - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) - ath9k_hw_resettxqueue(ah, i); -} - -/* - * For big endian systems turn on swapping for descriptors - */ -static void ath9k_hw_init_desc(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - - if (AR_SREV_9100(ah)) { - u32 mask; - mask = REG_READ(ah, AR_CFG); - if (mask & (AR_CFG_SWRB | AR_CFG_SWTB | AR_CFG_SWRG)) { - ath_dbg(common, RESET, "CFG Byte Swap Set 0x%x\n", - mask); - } else { - mask = INIT_CONFIG_STATUS | AR_CFG_SWRB | AR_CFG_SWTB; - REG_WRITE(ah, AR_CFG, mask); - ath_dbg(common, RESET, "Setting CFG 0x%x\n", - REG_READ(ah, AR_CFG)); - } - } else { - if (common->bus_ops->ath_bus_type == ATH_USB) { - /* Configure AR9271 target WLAN */ - if (AR_SREV_9271(ah)) - REG_WRITE(ah, AR_CFG, AR_CFG_SWRB | AR_CFG_SWTB); - else - REG_WRITE(ah, AR_CFG, AR_CFG_SWTD | AR_CFG_SWRD); - } -#ifdef __BIG_ENDIAN - else if (AR_SREV_9330(ah) || AR_SREV_9340(ah) || - AR_SREV_9550(ah)) - REG_RMW(ah, AR_CFG, AR_CFG_SWRB | AR_CFG_SWTB, 0); - else - REG_WRITE(ah, AR_CFG, AR_CFG_SWTD | AR_CFG_SWRD); -#endif - } -} - -/* - * Fast channel change: - * (Change synthesizer based on channel freq without resetting chip) - * - * Don't do FCC when - * - Flag is not set - * - Chip is just coming out of full sleep - * - Channel to be set is same as current channel - * - Channel flags are different, (eg.,moving from 2GHz to 5GHz channel) - */ -static int ath9k_hw_do_fastcc(struct ath_hw *ah, struct ath9k_channel *chan) -{ - struct ath_common *common = ath9k_hw_common(ah); - int ret; - - if (AR_SREV_9280(ah) && common->bus_ops->ath_bus_type == ATH_PCI) - goto fail; - - if (ah->chip_fullsleep) - goto fail; - - if (!ah->curchan) - goto fail; - - if (chan->channel == ah->curchan->channel) - goto fail; - - if ((ah->curchan->channelFlags | chan->channelFlags) & - (CHANNEL_HALF | CHANNEL_QUARTER)) - goto fail; - - if ((chan->channelFlags & CHANNEL_ALL) != - (ah->curchan->channelFlags & CHANNEL_ALL)) - goto fail; - - if (!ath9k_hw_check_alive(ah)) - goto fail; - - /* - * For AR9462, make sure that calibration data for - * re-using are present. - */ - if (AR_SREV_9462(ah) && (ah->caldata && - (!ah->caldata->done_txiqcal_once || - !ah->caldata->done_txclcal_once || - !ah->caldata->rtt_done))) - goto fail; - - ath_dbg(common, RESET, "FastChannelChange for %d -> %d\n", - ah->curchan->channel, chan->channel); - - ret = ath9k_hw_channel_change(ah, chan); - if (!ret) - goto fail; - - if (ath9k_hw_mci_is_enabled(ah)) - ar9003_mci_2g5g_switch(ah, false); - - ath9k_hw_loadnf(ah, ah->curchan); - ath9k_hw_start_nfcal(ah, true); - - if (AR_SREV_9271(ah)) - ar9002_hw_load_ani_reg(ah, chan); - - return 0; -fail: - return -EINVAL; -} - -int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, - struct ath9k_hw_cal_data *caldata, bool fastcc) -{ - struct ath_common *common = ath9k_hw_common(ah); - u32 saveLedState; - u32 saveDefAntenna; - u32 macStaId1; - u64 tsf = 0; - int r; - bool start_mci_reset = false; - bool save_fullsleep = ah->chip_fullsleep; - - if (ath9k_hw_mci_is_enabled(ah)) { - start_mci_reset = ar9003_mci_start_reset(ah, chan); - if (start_mci_reset) - return 0; - } - - if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) - return -EIO; - - if (ah->curchan && !ah->chip_fullsleep) - ath9k_hw_getnf(ah, ah->curchan); - - ah->caldata = caldata; - if (caldata && (chan->channel != caldata->channel || - chan->channelFlags != caldata->channelFlags || - chan->chanmode != caldata->chanmode)) { - /* Operating channel changed, reset channel calibration data */ - memset(caldata, 0, sizeof(*caldata)); - ath9k_init_nfcal_hist_buffer(ah, chan); - } else if (caldata) { - caldata->paprd_packet_sent = false; - } - ah->noise = ath9k_hw_getchan_noise(ah, chan); - - if (fastcc) { - r = ath9k_hw_do_fastcc(ah, chan); - if (!r) - return r; - } - - if (ath9k_hw_mci_is_enabled(ah)) - ar9003_mci_stop_bt(ah, save_fullsleep); - - saveDefAntenna = REG_READ(ah, AR_DEF_ANTENNA); - if (saveDefAntenna == 0) - saveDefAntenna = 1; - - macStaId1 = REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_BASE_RATE_11B; - - /* For chips on which RTC reset is done, save TSF before it gets cleared */ - if (AR_SREV_9100(ah) || - (AR_SREV_9280(ah) && ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL))) - tsf = ath9k_hw_gettsf64(ah); - - saveLedState = REG_READ(ah, AR_CFG_LED) & - (AR_CFG_LED_ASSOC_CTL | AR_CFG_LED_MODE_SEL | - AR_CFG_LED_BLINK_THRESH_SEL | AR_CFG_LED_BLINK_SLOW); - - ath9k_hw_mark_phy_inactive(ah); - - ah->paprd_table_write_done = false; - - /* Only required on the first reset */ - if (AR_SREV_9271(ah) && ah->htc_reset_init) { - REG_WRITE(ah, - AR9271_RESET_POWER_DOWN_CONTROL, - AR9271_RADIO_RF_RST); - udelay(50); - } - - if (!ath9k_hw_chip_reset(ah, chan)) { - ath_err(common, "Chip reset failed\n"); - return -EINVAL; - } - - /* Only required on the first reset */ - if (AR_SREV_9271(ah) && ah->htc_reset_init) { - ah->htc_reset_init = false; - REG_WRITE(ah, - AR9271_RESET_POWER_DOWN_CONTROL, - AR9271_GATE_MAC_CTL); - udelay(50); - } - - /* Restore TSF */ - if (tsf) - ath9k_hw_settsf64(ah, tsf); - - if (AR_SREV_9280_20_OR_LATER(ah)) - REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE); - - if (!AR_SREV_9300_20_OR_LATER(ah)) - ar9002_hw_enable_async_fifo(ah); - - r = ath9k_hw_process_ini(ah, chan); - if (r) - return r; - - if (ath9k_hw_mci_is_enabled(ah)) - ar9003_mci_reset(ah, false, IS_CHAN_2GHZ(chan), save_fullsleep); - - /* - * Some AR91xx SoC devices frequently fail to accept TSF writes - * right after the chip reset. When that happens, write a new - * value after the initvals have been applied, with an offset - * based on measured time difference - */ - if (AR_SREV_9100(ah) && (ath9k_hw_gettsf64(ah) < tsf)) { - tsf += 1500; - ath9k_hw_settsf64(ah, tsf); - } - - ath9k_hw_init_mfp(ah); - - if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) - ath9k_hw_set_delta_slope(ah, chan); - - ath9k_hw_spur_mitigate_freq(ah, chan); - ah->eep_ops->set_board_values(ah, chan); - - ath9k_hw_reset_opmode(ah, macStaId1, saveDefAntenna); - - r = ath9k_hw_rf_set_freq(ah, chan); - if (r) - return r; - - ath9k_hw_set_clockrate(ah); - - ath9k_hw_init_queues(ah); - ath9k_hw_init_interrupt_masks(ah, ah->opmode); - ath9k_hw_ani_cache_ini_regs(ah); - ath9k_hw_init_qos(ah); - - if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT) - ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio); - - ath9k_hw_init_global_settings(ah); - - if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) { - REG_SET_BIT(ah, AR_MAC_PCU_LOGIC_ANALYZER, - AR_MAC_PCU_LOGIC_ANALYZER_DISBUG20768); - REG_RMW_FIELD(ah, AR_AHB_MODE, AR_AHB_CUSTOM_BURST_EN, - AR_AHB_CUSTOM_BURST_ASYNC_FIFO_VAL); - REG_SET_BIT(ah, AR_PCU_MISC_MODE2, - AR_PCU_MISC_MODE2_ENABLE_AGGWEP); - } - - REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PRESERVE_SEQNUM); - - ath9k_hw_set_dma(ah); - - if (!ath9k_hw_mci_is_enabled(ah)) - REG_WRITE(ah, AR_OBS, 8); - - if (ah->config.rx_intr_mitigation) { - REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, 500); - REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, 2000); - } - - if (ah->config.tx_intr_mitigation) { - REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_LAST, 300); - REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_FIRST, 750); - } - - ath9k_hw_init_bb(ah, chan); - - if (caldata) { - caldata->done_txiqcal_once = false; - caldata->done_txclcal_once = false; - } - if (!ath9k_hw_init_cal(ah, chan)) - return -EIO; - - if (ath9k_hw_mci_is_enabled(ah) && ar9003_mci_end_reset(ah, chan, caldata)) - return -EIO; - - ENABLE_REGWRITE_BUFFER(ah); - - ath9k_hw_restore_chainmask(ah); - REG_WRITE(ah, AR_CFG_LED, saveLedState | AR_CFG_SCLK_32KHZ); - - REGWRITE_BUFFER_FLUSH(ah); - - ath9k_hw_init_desc(ah); - - if (ath9k_hw_btcoex_is_enabled(ah)) - ath9k_hw_btcoex_enable(ah); - - if (ath9k_hw_mci_is_enabled(ah)) - ar9003_mci_check_bt(ah); - - ath9k_hw_loadnf(ah, chan); - ath9k_hw_start_nfcal(ah, true); - - if (AR_SREV_9300_20_OR_LATER(ah)) { - ar9003_hw_bb_watchdog_config(ah); - ar9003_hw_disable_phy_restart(ah); - } - - ath9k_hw_apply_gpio_override(ah); - - if (AR_SREV_9565(ah) && ah->shared_chain_lnadiv) - REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON); - - return 0; -} -EXPORT_SYMBOL(ath9k_hw_reset); - -/******************************/ -/* Power Management (Chipset) */ -/******************************/ - -/* - * Notify Power Mgt is disabled in self-generated frames. - * If requested, force chip to sleep. - */ -static void ath9k_set_power_sleep(struct ath_hw *ah) -{ - REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV); - - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) { - REG_CLR_BIT(ah, AR_TIMER_MODE, 0xff); - REG_CLR_BIT(ah, AR_NDP2_TIMER_MODE, 0xff); - REG_CLR_BIT(ah, AR_SLP32_INC, 0xfffff); - /* xxx Required for WLAN only case ? */ - REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_EN, 0); - udelay(100); - } - - /* - * Clear the RTC force wake bit to allow the - * mac to go to sleep. - */ - REG_CLR_BIT(ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN); - - if (ath9k_hw_mci_is_enabled(ah)) - udelay(100); - - if (!AR_SREV_9100(ah) && !AR_SREV_9300_20_OR_LATER(ah)) - REG_WRITE(ah, AR_RC, AR_RC_AHB | AR_RC_HOSTIF); - - /* Shutdown chip. Active low */ - if (!AR_SREV_5416(ah) && !AR_SREV_9271(ah)) { - REG_CLR_BIT(ah, AR_RTC_RESET, AR_RTC_RESET_EN); - udelay(2); - } - - /* Clear Bit 14 of AR_WA after putting chip into Full Sleep mode. */ - if (AR_SREV_9300_20_OR_LATER(ah)) - REG_WRITE(ah, AR_WA, ah->WARegVal & ~AR_WA_D3_L1_DISABLE); -} - -/* - * Notify Power Management is enabled in self-generating - * frames. If request, set power mode of chip to - * auto/normal. Duration in units of 128us (1/8 TU). - */ -static void ath9k_set_power_network_sleep(struct ath_hw *ah) -{ - struct ath9k_hw_capabilities *pCap = &ah->caps; - - REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV); - - if (!(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { - /* Set WakeOnInterrupt bit; clear ForceWake bit */ - REG_WRITE(ah, AR_RTC_FORCE_WAKE, - AR_RTC_FORCE_WAKE_ON_INT); - } else { - - /* When chip goes into network sleep, it could be waken - * up by MCI_INT interrupt caused by BT's HW messages - * (LNA_xxx, CONT_xxx) which chould be in a very fast - * rate (~100us). This will cause chip to leave and - * re-enter network sleep mode frequently, which in - * consequence will have WLAN MCI HW to generate lots of - * SYS_WAKING and SYS_SLEEPING messages which will make - * BT CPU to busy to process. - */ - if (ath9k_hw_mci_is_enabled(ah)) - REG_CLR_BIT(ah, AR_MCI_INTERRUPT_RX_MSG_EN, - AR_MCI_INTERRUPT_RX_HW_MSG_MASK); - /* - * Clear the RTC force wake bit to allow the - * mac to go to sleep. - */ - REG_CLR_BIT(ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN); - - if (ath9k_hw_mci_is_enabled(ah)) - udelay(30); - } - - /* Clear Bit 14 of AR_WA after putting chip into Net Sleep mode. */ - if (AR_SREV_9300_20_OR_LATER(ah)) - REG_WRITE(ah, AR_WA, ah->WARegVal & ~AR_WA_D3_L1_DISABLE); -} - -static bool ath9k_hw_set_power_awake(struct ath_hw *ah) -{ - u32 val; - int i; - - /* Set Bits 14 and 17 of AR_WA before powering on the chip. */ - if (AR_SREV_9300_20_OR_LATER(ah)) { - REG_WRITE(ah, AR_WA, ah->WARegVal); - udelay(10); - } - - if ((REG_READ(ah, AR_RTC_STATUS) & - AR_RTC_STATUS_M) == AR_RTC_STATUS_SHUTDOWN) { - if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) { - return false; - } - if (!AR_SREV_9300_20_OR_LATER(ah)) - ath9k_hw_init_pll(ah, NULL); - } - if (AR_SREV_9100(ah)) - REG_SET_BIT(ah, AR_RTC_RESET, - AR_RTC_RESET_EN); - - REG_SET_BIT(ah, AR_RTC_FORCE_WAKE, - AR_RTC_FORCE_WAKE_EN); - udelay(50); - - for (i = POWER_UP_TIME / 50; i > 0; i--) { - val = REG_READ(ah, AR_RTC_STATUS) & AR_RTC_STATUS_M; - if (val == AR_RTC_STATUS_ON) - break; - udelay(50); - REG_SET_BIT(ah, AR_RTC_FORCE_WAKE, - AR_RTC_FORCE_WAKE_EN); - } - if (i == 0) { - ath_err(ath9k_hw_common(ah), - "Failed to wakeup in %uus\n", - POWER_UP_TIME / 20); - return false; - } - - if (ath9k_hw_mci_is_enabled(ah)) - ar9003_mci_set_power_awake(ah); - - REG_CLR_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV); - - return true; -} - -bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode) -{ - struct ath_common *common = ath9k_hw_common(ah); - int status = true; - static const char *modes[] = { - "AWAKE", - "FULL-SLEEP", - "NETWORK SLEEP", - "UNDEFINED" - }; - - if (ah->power_mode == mode) - return status; - - ath_dbg(common, RESET, "%s -> %s\n", - modes[ah->power_mode], modes[mode]); - - switch (mode) { - case ATH9K_PM_AWAKE: - status = ath9k_hw_set_power_awake(ah); - break; - case ATH9K_PM_FULL_SLEEP: - if (ath9k_hw_mci_is_enabled(ah)) - ar9003_mci_set_full_sleep(ah); - - ath9k_set_power_sleep(ah); - ah->chip_fullsleep = true; - break; - case ATH9K_PM_NETWORK_SLEEP: - ath9k_set_power_network_sleep(ah); - break; - default: - ath_err(common, "Unknown power mode %u\n", mode); - return false; - } - ah->power_mode = mode; - - /* - * XXX: If this warning never comes up after a while then - * simply keep the ATH_DBG_WARN_ON_ONCE() but make - * ath9k_hw_setpower() return type void. - */ - - if (!(ah->ah_flags & AH_UNPLUGGED)) - ATH_DBG_WARN_ON_ONCE(!status); - - return status; -} -EXPORT_SYMBOL(ath9k_hw_setpower); - -/*******************/ -/* Beacon Handling */ -/*******************/ - -void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period) -{ - int flags = 0; - - ENABLE_REGWRITE_BUFFER(ah); - - switch (ah->opmode) { - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_MESH_POINT: - REG_SET_BIT(ah, AR_TXCFG, - AR_TXCFG_ADHOC_BEACON_ATIM_TX_POLICY); - REG_WRITE(ah, AR_NEXT_NDP_TIMER, next_beacon + - TU_TO_USEC(ah->atim_window ? ah->atim_window : 1)); - flags |= AR_NDP_TIMER_EN; - case NL80211_IFTYPE_AP: - REG_WRITE(ah, AR_NEXT_TBTT_TIMER, next_beacon); - REG_WRITE(ah, AR_NEXT_DMA_BEACON_ALERT, next_beacon - - TU_TO_USEC(ah->config.dma_beacon_response_time)); - REG_WRITE(ah, AR_NEXT_SWBA, next_beacon - - TU_TO_USEC(ah->config.sw_beacon_response_time)); - flags |= - AR_TBTT_TIMER_EN | AR_DBA_TIMER_EN | AR_SWBA_TIMER_EN; - break; - default: - ath_dbg(ath9k_hw_common(ah), BEACON, - "%s: unsupported opmode: %d\n", __func__, ah->opmode); - return; - break; - } - - REG_WRITE(ah, AR_BEACON_PERIOD, beacon_period); - REG_WRITE(ah, AR_DMA_BEACON_PERIOD, beacon_period); - REG_WRITE(ah, AR_SWBA_PERIOD, beacon_period); - REG_WRITE(ah, AR_NDP_PERIOD, beacon_period); - - REGWRITE_BUFFER_FLUSH(ah); - - REG_SET_BIT(ah, AR_TIMER_MODE, flags); -} -EXPORT_SYMBOL(ath9k_hw_beaconinit); - -void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, - const struct ath9k_beacon_state *bs) -{ - u32 nextTbtt, beaconintval, dtimperiod, beacontimeout; - struct ath9k_hw_capabilities *pCap = &ah->caps; - struct ath_common *common = ath9k_hw_common(ah); - - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(bs->bs_nexttbtt)); - - REG_WRITE(ah, AR_BEACON_PERIOD, - TU_TO_USEC(bs->bs_intval)); - REG_WRITE(ah, AR_DMA_BEACON_PERIOD, - TU_TO_USEC(bs->bs_intval)); - - REGWRITE_BUFFER_FLUSH(ah); - - REG_RMW_FIELD(ah, AR_RSSI_THR, - AR_RSSI_THR_BM_THR, bs->bs_bmissthreshold); - - beaconintval = bs->bs_intval; - - if (bs->bs_sleepduration > beaconintval) - beaconintval = bs->bs_sleepduration; - - dtimperiod = bs->bs_dtimperiod; - if (bs->bs_sleepduration > dtimperiod) - dtimperiod = bs->bs_sleepduration; - - if (beaconintval == dtimperiod) - nextTbtt = bs->bs_nextdtim; - else - nextTbtt = bs->bs_nexttbtt; - - ath_dbg(common, BEACON, "next DTIM %d\n", bs->bs_nextdtim); - ath_dbg(common, BEACON, "next beacon %d\n", nextTbtt); - ath_dbg(common, BEACON, "beacon period %d\n", beaconintval); - ath_dbg(common, BEACON, "DTIM period %d\n", dtimperiod); - - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_NEXT_DTIM, - TU_TO_USEC(bs->bs_nextdtim - SLEEP_SLOP)); - REG_WRITE(ah, AR_NEXT_TIM, TU_TO_USEC(nextTbtt - SLEEP_SLOP)); - - REG_WRITE(ah, AR_SLEEP1, - SM((CAB_TIMEOUT_VAL << 3), AR_SLEEP1_CAB_TIMEOUT) - | AR_SLEEP1_ASSUME_DTIM); - - if (pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP) - beacontimeout = (BEACON_TIMEOUT_VAL << 3); - else - beacontimeout = MIN_BEACON_TIMEOUT_VAL; - - REG_WRITE(ah, AR_SLEEP2, - SM(beacontimeout, AR_SLEEP2_BEACON_TIMEOUT)); - - REG_WRITE(ah, AR_TIM_PERIOD, TU_TO_USEC(beaconintval)); - REG_WRITE(ah, AR_DTIM_PERIOD, TU_TO_USEC(dtimperiod)); - - REGWRITE_BUFFER_FLUSH(ah); - - REG_SET_BIT(ah, AR_TIMER_MODE, - AR_TBTT_TIMER_EN | AR_TIM_TIMER_EN | - AR_DTIM_TIMER_EN); - - /* TSF Out of Range Threshold */ - REG_WRITE(ah, AR_TSFOOR_THRESHOLD, bs->bs_tsfoor_threshold); -} -EXPORT_SYMBOL(ath9k_hw_set_sta_beacon_timers); - -/*******************/ -/* HW Capabilities */ -/*******************/ - -static u8 fixup_chainmask(u8 chip_chainmask, u8 eeprom_chainmask) -{ - eeprom_chainmask &= chip_chainmask; - if (eeprom_chainmask) - return eeprom_chainmask; - else - return chip_chainmask; -} - -/** - * ath9k_hw_dfs_tested - checks if DFS has been tested with used chipset - * @ah: the atheros hardware data structure - * - * We enable DFS support upstream on chipsets which have passed a series - * of tests. The testing requirements are going to be documented. Desired - * test requirements are documented at: - * - * http://wireless.kernel.org/en/users/Drivers/ath9k/dfs - * - * Once a new chipset gets properly tested an individual commit can be used - * to document the testing for DFS for that chipset. - */ -static bool ath9k_hw_dfs_tested(struct ath_hw *ah) -{ - - switch (ah->hw_version.macVersion) { - /* for temporary testing DFS with 9280 */ - case AR_SREV_VERSION_9280: - /* AR9580 will likely be our first target to get testing on */ - case AR_SREV_VERSION_9580: - return true; - default: - return false; - } -} - -int ath9k_hw_fill_cap_info(struct ath_hw *ah) -{ - struct ath9k_hw_capabilities *pCap = &ah->caps; - struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); - struct ath_common *common = ath9k_hw_common(ah); - unsigned int chip_chainmask; - - u16 eeval; - u8 ant_div_ctl1, tx_chainmask, rx_chainmask; - - eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_0); - regulatory->current_rd = eeval; - - if (ah->opmode != NL80211_IFTYPE_AP && - ah->hw_version.subvendorid == AR_SUBVENDOR_ID_NEW_A) { - if (regulatory->current_rd == 0x64 || - regulatory->current_rd == 0x65) - regulatory->current_rd += 5; - else if (regulatory->current_rd == 0x41) - regulatory->current_rd = 0x43; - ath_dbg(common, REGULATORY, "regdomain mapped to 0x%x\n", - regulatory->current_rd); - } - - eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE); - if ((eeval & (AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A)) == 0) { - ath_err(common, - "no band has been marked as supported in EEPROM\n"); - return -EINVAL; - } - - if (eeval & AR5416_OPFLAGS_11A) - pCap->hw_caps |= ATH9K_HW_CAP_5GHZ; - - if (eeval & AR5416_OPFLAGS_11G) - pCap->hw_caps |= ATH9K_HW_CAP_2GHZ; - - if (AR_SREV_9485(ah) || - AR_SREV_9285(ah) || - AR_SREV_9330(ah) || - AR_SREV_9565(ah)) - chip_chainmask = 1; - else if (AR_SREV_9462(ah)) - chip_chainmask = 3; - else if (!AR_SREV_9280_20_OR_LATER(ah)) - chip_chainmask = 7; - else if (!AR_SREV_9300_20_OR_LATER(ah) || AR_SREV_9340(ah)) - chip_chainmask = 3; - else - chip_chainmask = 7; - - pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK); - /* - * For AR9271 we will temporarilly uses the rx chainmax as read from - * the EEPROM. - */ - if ((ah->hw_version.devid == AR5416_DEVID_PCI) && - !(eeval & AR5416_OPFLAGS_11A) && - !(AR_SREV_9271(ah))) - /* CB71: GPIO 0 is pulled down to indicate 3 rx chains */ - pCap->rx_chainmask = ath9k_hw_gpio_get(ah, 0) ? 0x5 : 0x7; - else if (AR_SREV_9100(ah)) - pCap->rx_chainmask = 0x7; - else - /* Use rx_chainmask from EEPROM. */ - pCap->rx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_RX_MASK); - - pCap->tx_chainmask = fixup_chainmask(chip_chainmask, pCap->tx_chainmask); - pCap->rx_chainmask = fixup_chainmask(chip_chainmask, pCap->rx_chainmask); - ah->txchainmask = pCap->tx_chainmask; - ah->rxchainmask = pCap->rx_chainmask; - - ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA; - - /* enable key search for every frame in an aggregate */ - if (AR_SREV_9300_20_OR_LATER(ah)) - ah->misc_mode |= AR_PCU_ALWAYS_PERFORM_KEYSEARCH; - - common->crypt_caps |= ATH_CRYPT_CAP_CIPHER_AESCCM; - - if (ah->hw_version.devid != AR2427_DEVID_PCIE) - pCap->hw_caps |= ATH9K_HW_CAP_HT; - else - pCap->hw_caps &= ~ATH9K_HW_CAP_HT; - - if (AR_SREV_9271(ah)) - pCap->num_gpio_pins = AR9271_NUM_GPIO; - else if (AR_DEVID_7010(ah)) - pCap->num_gpio_pins = AR7010_NUM_GPIO; - else if (AR_SREV_9300_20_OR_LATER(ah)) - pCap->num_gpio_pins = AR9300_NUM_GPIO; - else if (AR_SREV_9287_11_OR_LATER(ah)) - pCap->num_gpio_pins = AR9287_NUM_GPIO; - else if (AR_SREV_9285_12_OR_LATER(ah)) - pCap->num_gpio_pins = AR9285_NUM_GPIO; - else if (AR_SREV_9280_20_OR_LATER(ah)) - pCap->num_gpio_pins = AR928X_NUM_GPIO; - else - pCap->num_gpio_pins = AR_NUM_GPIO; - - if (AR_SREV_9160_10_OR_LATER(ah) || AR_SREV_9100(ah)) - pCap->rts_aggr_limit = ATH_AMPDU_LIMIT_MAX; - else - pCap->rts_aggr_limit = (8 * 1024); - -#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) - ah->rfsilent = ah->eep_ops->get_eeprom(ah, EEP_RF_SILENT); - if (ah->rfsilent & EEP_RFSILENT_ENABLED) { - ah->rfkill_gpio = - MS(ah->rfsilent, EEP_RFSILENT_GPIO_SEL); - ah->rfkill_polarity = - MS(ah->rfsilent, EEP_RFSILENT_POLARITY); - - pCap->hw_caps |= ATH9K_HW_CAP_RFSILENT; - } -#endif - if (AR_SREV_9271(ah) || AR_SREV_9300_20_OR_LATER(ah)) - pCap->hw_caps |= ATH9K_HW_CAP_AUTOSLEEP; - else - pCap->hw_caps &= ~ATH9K_HW_CAP_AUTOSLEEP; - - if (AR_SREV_9280(ah) || AR_SREV_9285(ah)) - pCap->hw_caps &= ~ATH9K_HW_CAP_4KB_SPLITTRANS; - else - pCap->hw_caps |= ATH9K_HW_CAP_4KB_SPLITTRANS; - - if (AR_SREV_9300_20_OR_LATER(ah)) { - pCap->hw_caps |= ATH9K_HW_CAP_EDMA | ATH9K_HW_CAP_FASTCLOCK; - if (!AR_SREV_9330(ah) && !AR_SREV_9485(ah) && !AR_SREV_9565(ah)) - pCap->hw_caps |= ATH9K_HW_CAP_LDPC; - - pCap->rx_hp_qdepth = ATH9K_HW_RX_HP_QDEPTH; - pCap->rx_lp_qdepth = ATH9K_HW_RX_LP_QDEPTH; - pCap->rx_status_len = sizeof(struct ar9003_rxs); - pCap->tx_desc_len = sizeof(struct ar9003_txc); - pCap->txs_len = sizeof(struct ar9003_txs); - } else { - pCap->tx_desc_len = sizeof(struct ath_desc); - if (AR_SREV_9280_20(ah)) - pCap->hw_caps |= ATH9K_HW_CAP_FASTCLOCK; - } - - if (AR_SREV_9300_20_OR_LATER(ah)) - pCap->hw_caps |= ATH9K_HW_CAP_RAC_SUPPORTED; - - if (AR_SREV_9300_20_OR_LATER(ah)) - ah->ent_mode = REG_READ(ah, AR_ENT_OTP); - - if (AR_SREV_9287_11_OR_LATER(ah) || AR_SREV_9271(ah)) - pCap->hw_caps |= ATH9K_HW_CAP_SGI_20; - - if (AR_SREV_9285(ah)) - if (ah->eep_ops->get_eeprom(ah, EEP_MODAL_VER) >= 3) { - ant_div_ctl1 = - ah->eep_ops->get_eeprom(ah, EEP_ANT_DIV_CTL1); - if ((ant_div_ctl1 & 0x1) && ((ant_div_ctl1 >> 3) & 0x1)) - pCap->hw_caps |= ATH9K_HW_CAP_ANT_DIV_COMB; - } - if (AR_SREV_9300_20_OR_LATER(ah)) { - if (ah->eep_ops->get_eeprom(ah, EEP_CHAIN_MASK_REDUCE)) - pCap->hw_caps |= ATH9K_HW_CAP_APM; - } - - - if (AR_SREV_9330(ah) || AR_SREV_9485(ah) || AR_SREV_9565(ah)) { - ant_div_ctl1 = ah->eep_ops->get_eeprom(ah, EEP_ANT_DIV_CTL1); - /* - * enable the diversity-combining algorithm only when - * both enable_lna_div and enable_fast_div are set - * Table for Diversity - * ant_div_alt_lnaconf bit 0-1 - * ant_div_main_lnaconf bit 2-3 - * ant_div_alt_gaintb bit 4 - * ant_div_main_gaintb bit 5 - * enable_ant_div_lnadiv bit 6 - * enable_ant_fast_div bit 7 - */ - if ((ant_div_ctl1 >> 0x6) == 0x3) - pCap->hw_caps |= ATH9K_HW_CAP_ANT_DIV_COMB; - } - - if (ath9k_hw_dfs_tested(ah)) - pCap->hw_caps |= ATH9K_HW_CAP_DFS; - - tx_chainmask = pCap->tx_chainmask; - rx_chainmask = pCap->rx_chainmask; - while (tx_chainmask || rx_chainmask) { - if (tx_chainmask & BIT(0)) - pCap->max_txchains++; - if (rx_chainmask & BIT(0)) - pCap->max_rxchains++; - - tx_chainmask >>= 1; - rx_chainmask >>= 1; - } - - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) { - if (!(ah->ent_mode & AR_ENT_OTP_49GHZ_DISABLE)) - pCap->hw_caps |= ATH9K_HW_CAP_MCI; - - if (AR_SREV_9462_20(ah)) - pCap->hw_caps |= ATH9K_HW_CAP_RTT; - } - - if (AR_SREV_9280_20_OR_LATER(ah)) { - pCap->hw_caps |= ATH9K_HW_WOW_DEVICE_CAPABLE | - ATH9K_HW_WOW_PATTERN_MATCH_EXACT; - - if (AR_SREV_9280(ah)) - pCap->hw_caps |= ATH9K_HW_WOW_PATTERN_MATCH_DWORD; - } - - if (AR_SREV_9300_20_OR_LATER(ah) && - ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) - pCap->hw_caps |= ATH9K_HW_CAP_PAPRD; - - return 0; -} - -/****************************/ -/* GPIO / RFKILL / Antennae */ -/****************************/ - -static void ath9k_hw_gpio_cfg_output_mux(struct ath_hw *ah, - u32 gpio, u32 type) -{ - int addr; - u32 gpio_shift, tmp; - - if (gpio > 11) - addr = AR_GPIO_OUTPUT_MUX3; - else if (gpio > 5) - addr = AR_GPIO_OUTPUT_MUX2; - else - addr = AR_GPIO_OUTPUT_MUX1; - - gpio_shift = (gpio % 6) * 5; - - if (AR_SREV_9280_20_OR_LATER(ah) - || (addr != AR_GPIO_OUTPUT_MUX1)) { - REG_RMW(ah, addr, (type << gpio_shift), - (0x1f << gpio_shift)); - } else { - tmp = REG_READ(ah, addr); - tmp = ((tmp & 0x1F0) << 1) | (tmp & ~0x1F0); - tmp &= ~(0x1f << gpio_shift); - tmp |= (type << gpio_shift); - REG_WRITE(ah, addr, tmp); - } -} - -void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio) -{ - u32 gpio_shift; - - BUG_ON(gpio >= ah->caps.num_gpio_pins); - - if (AR_DEVID_7010(ah)) { - gpio_shift = gpio; - REG_RMW(ah, AR7010_GPIO_OE, - (AR7010_GPIO_OE_AS_INPUT << gpio_shift), - (AR7010_GPIO_OE_MASK << gpio_shift)); - return; - } - - gpio_shift = gpio << 1; - REG_RMW(ah, - AR_GPIO_OE_OUT, - (AR_GPIO_OE_OUT_DRV_NO << gpio_shift), - (AR_GPIO_OE_OUT_DRV << gpio_shift)); -} -EXPORT_SYMBOL(ath9k_hw_cfg_gpio_input); - -u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio) -{ -#define MS_REG_READ(x, y) \ - (MS(REG_READ(ah, AR_GPIO_IN_OUT), x##_GPIO_IN_VAL) & (AR_GPIO_BIT(y))) - - if (gpio >= ah->caps.num_gpio_pins) - return 0xffffffff; - - if (AR_DEVID_7010(ah)) { - u32 val; - val = REG_READ(ah, AR7010_GPIO_IN); - return (MS(val, AR7010_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) == 0; - } else if (AR_SREV_9300_20_OR_LATER(ah)) - return (MS(REG_READ(ah, AR_GPIO_IN), AR9300_GPIO_IN_VAL) & - AR_GPIO_BIT(gpio)) != 0; - else if (AR_SREV_9271(ah)) - return MS_REG_READ(AR9271, gpio) != 0; - else if (AR_SREV_9287_11_OR_LATER(ah)) - return MS_REG_READ(AR9287, gpio) != 0; - else if (AR_SREV_9285_12_OR_LATER(ah)) - return MS_REG_READ(AR9285, gpio) != 0; - else if (AR_SREV_9280_20_OR_LATER(ah)) - return MS_REG_READ(AR928X, gpio) != 0; - else - return MS_REG_READ(AR, gpio) != 0; -} -EXPORT_SYMBOL(ath9k_hw_gpio_get); - -void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, - u32 ah_signal_type) -{ - u32 gpio_shift; - - if (AR_DEVID_7010(ah)) { - gpio_shift = gpio; - REG_RMW(ah, AR7010_GPIO_OE, - (AR7010_GPIO_OE_AS_OUTPUT << gpio_shift), - (AR7010_GPIO_OE_MASK << gpio_shift)); - return; - } - - ath9k_hw_gpio_cfg_output_mux(ah, gpio, ah_signal_type); - gpio_shift = 2 * gpio; - REG_RMW(ah, - AR_GPIO_OE_OUT, - (AR_GPIO_OE_OUT_DRV_ALL << gpio_shift), - (AR_GPIO_OE_OUT_DRV << gpio_shift)); -} -EXPORT_SYMBOL(ath9k_hw_cfg_output); - -void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val) -{ - if (AR_DEVID_7010(ah)) { - val = val ? 0 : 1; - REG_RMW(ah, AR7010_GPIO_OUT, ((val&1) << gpio), - AR_GPIO_BIT(gpio)); - return; - } - - if (AR_SREV_9271(ah)) - val = ~val; - - REG_RMW(ah, AR_GPIO_IN_OUT, ((val & 1) << gpio), - AR_GPIO_BIT(gpio)); -} -EXPORT_SYMBOL(ath9k_hw_set_gpio); - -void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna) -{ - REG_WRITE(ah, AR_DEF_ANTENNA, (antenna & 0x7)); -} -EXPORT_SYMBOL(ath9k_hw_setantenna); - -/*********************/ -/* General Operation */ -/*********************/ - -u32 ath9k_hw_getrxfilter(struct ath_hw *ah) -{ - u32 bits = REG_READ(ah, AR_RX_FILTER); - u32 phybits = REG_READ(ah, AR_PHY_ERR); - - if (phybits & AR_PHY_ERR_RADAR) - bits |= ATH9K_RX_FILTER_PHYRADAR; - if (phybits & (AR_PHY_ERR_OFDM_TIMING | AR_PHY_ERR_CCK_TIMING)) - bits |= ATH9K_RX_FILTER_PHYERR; - - return bits; -} -EXPORT_SYMBOL(ath9k_hw_getrxfilter); - -void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits) -{ - u32 phybits; - - ENABLE_REGWRITE_BUFFER(ah); - - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) - bits |= ATH9K_RX_FILTER_CONTROL_WRAPPER; - - REG_WRITE(ah, AR_RX_FILTER, bits); - - phybits = 0; - if (bits & ATH9K_RX_FILTER_PHYRADAR) - phybits |= AR_PHY_ERR_RADAR; - if (bits & ATH9K_RX_FILTER_PHYERR) - phybits |= AR_PHY_ERR_OFDM_TIMING | AR_PHY_ERR_CCK_TIMING; - REG_WRITE(ah, AR_PHY_ERR, phybits); - - if (phybits) - REG_SET_BIT(ah, AR_RXCFG, AR_RXCFG_ZLFDMA); - else - REG_CLR_BIT(ah, AR_RXCFG, AR_RXCFG_ZLFDMA); - - REGWRITE_BUFFER_FLUSH(ah); -} -EXPORT_SYMBOL(ath9k_hw_setrxfilter); - -bool ath9k_hw_phy_disable(struct ath_hw *ah) -{ - if (ath9k_hw_mci_is_enabled(ah)) - ar9003_mci_bt_gain_ctrl(ah); - - if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_WARM)) - return false; - - ath9k_hw_init_pll(ah, NULL); - ah->htc_reset_init = true; - return true; -} -EXPORT_SYMBOL(ath9k_hw_phy_disable); - -bool ath9k_hw_disable(struct ath_hw *ah) -{ - if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) - return false; - - if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_COLD)) - return false; - - ath9k_hw_init_pll(ah, NULL); - return true; -} -EXPORT_SYMBOL(ath9k_hw_disable); - -static int get_antenna_gain(struct ath_hw *ah, struct ath9k_channel *chan) -{ - enum eeprom_param gain_param; - - if (IS_CHAN_2GHZ(chan)) - gain_param = EEP_ANTENNA_GAIN_2G; - else - gain_param = EEP_ANTENNA_GAIN_5G; - - return ah->eep_ops->get_eeprom(ah, gain_param); -} - -void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, - bool test) -{ - struct ath_regulatory *reg = ath9k_hw_regulatory(ah); - struct ieee80211_channel *channel; - int chan_pwr, new_pwr, max_gain; - int ant_gain, ant_reduction = 0; - - if (!chan) - return; - - channel = chan->chan; - chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER); - new_pwr = min_t(int, chan_pwr, reg->power_limit); - max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2; - - ant_gain = get_antenna_gain(ah, chan); - if (ant_gain > max_gain) - ant_reduction = ant_gain - max_gain; - - ah->eep_ops->set_txpower(ah, chan, - ath9k_regd_get_ctl(reg, chan), - ant_reduction, new_pwr, test); -} - -void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) -{ - struct ath_regulatory *reg = ath9k_hw_regulatory(ah); - struct ath9k_channel *chan = ah->curchan; - struct ieee80211_channel *channel = chan->chan; - - reg->power_limit = min_t(u32, limit, MAX_RATE_POWER); - if (test) - channel->max_power = MAX_RATE_POWER / 2; - - ath9k_hw_apply_txpower(ah, chan, test); - - if (test) - channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2); -} -EXPORT_SYMBOL(ath9k_hw_set_txpowerlimit); - -void ath9k_hw_setopmode(struct ath_hw *ah) -{ - ath9k_hw_set_operating_mode(ah, ah->opmode); -} -EXPORT_SYMBOL(ath9k_hw_setopmode); - -void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1) -{ - REG_WRITE(ah, AR_MCAST_FIL0, filter0); - REG_WRITE(ah, AR_MCAST_FIL1, filter1); -} -EXPORT_SYMBOL(ath9k_hw_setmcastfilter); - -void ath9k_hw_write_associd(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - - REG_WRITE(ah, AR_BSS_ID0, get_unaligned_le32(common->curbssid)); - REG_WRITE(ah, AR_BSS_ID1, get_unaligned_le16(common->curbssid + 4) | - ((common->curaid & 0x3fff) << AR_BSS_ID1_AID_S)); -} -EXPORT_SYMBOL(ath9k_hw_write_associd); - -#define ATH9K_MAX_TSF_READ 10 - -u64 ath9k_hw_gettsf64(struct ath_hw *ah) -{ - u32 tsf_lower, tsf_upper1, tsf_upper2; - int i; - - tsf_upper1 = REG_READ(ah, AR_TSF_U32); - for (i = 0; i < ATH9K_MAX_TSF_READ; i++) { - tsf_lower = REG_READ(ah, AR_TSF_L32); - tsf_upper2 = REG_READ(ah, AR_TSF_U32); - if (tsf_upper2 == tsf_upper1) - break; - tsf_upper1 = tsf_upper2; - } - - WARN_ON( i == ATH9K_MAX_TSF_READ ); - - return (((u64)tsf_upper1 << 32) | tsf_lower); -} -EXPORT_SYMBOL(ath9k_hw_gettsf64); - -void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64) -{ - REG_WRITE(ah, AR_TSF_L32, tsf64 & 0xffffffff); - REG_WRITE(ah, AR_TSF_U32, (tsf64 >> 32) & 0xffffffff); -} -EXPORT_SYMBOL(ath9k_hw_settsf64); - -void ath9k_hw_reset_tsf(struct ath_hw *ah) -{ - if (!ath9k_hw_wait(ah, AR_SLP32_MODE, AR_SLP32_TSF_WRITE_STATUS, 0, - AH_TSF_WRITE_TIMEOUT)) - ath_dbg(ath9k_hw_common(ah), RESET, - "AR_SLP32_TSF_WRITE_STATUS limit exceeded\n"); - - REG_WRITE(ah, AR_RESET_TSF, AR_RESET_TSF_ONCE); -} -EXPORT_SYMBOL(ath9k_hw_reset_tsf); - -void ath9k_hw_set_tsfadjust(struct ath_hw *ah, bool set) -{ - if (set) - ah->misc_mode |= AR_PCU_TX_ADD_TSF; - else - ah->misc_mode &= ~AR_PCU_TX_ADD_TSF; -} -EXPORT_SYMBOL(ath9k_hw_set_tsfadjust); - -void ath9k_hw_set11nmac2040(struct ath_hw *ah) -{ - struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf; - u32 macmode; - - if (conf_is_ht40(conf) && !ah->config.cwm_ignore_extcca) - macmode = AR_2040_JOINED_RX_CLEAR; - else - macmode = 0; - - REG_WRITE(ah, AR_2040_MODE, macmode); -} - -/* HW Generic timers configuration */ - -static const struct ath_gen_timer_configuration gen_tmr_configuration[] = -{ - {AR_NEXT_NDP_TIMER, AR_NDP_PERIOD, AR_TIMER_MODE, 0x0080}, - {AR_NEXT_NDP_TIMER, AR_NDP_PERIOD, AR_TIMER_MODE, 0x0080}, - {AR_NEXT_NDP_TIMER, AR_NDP_PERIOD, AR_TIMER_MODE, 0x0080}, - {AR_NEXT_NDP_TIMER, AR_NDP_PERIOD, AR_TIMER_MODE, 0x0080}, - {AR_NEXT_NDP_TIMER, AR_NDP_PERIOD, AR_TIMER_MODE, 0x0080}, - {AR_NEXT_NDP_TIMER, AR_NDP_PERIOD, AR_TIMER_MODE, 0x0080}, - {AR_NEXT_NDP_TIMER, AR_NDP_PERIOD, AR_TIMER_MODE, 0x0080}, - {AR_NEXT_NDP_TIMER, AR_NDP_PERIOD, AR_TIMER_MODE, 0x0080}, - {AR_NEXT_NDP2_TIMER, AR_NDP2_PERIOD, AR_NDP2_TIMER_MODE, 0x0001}, - {AR_NEXT_NDP2_TIMER + 1*4, AR_NDP2_PERIOD + 1*4, - AR_NDP2_TIMER_MODE, 0x0002}, - {AR_NEXT_NDP2_TIMER + 2*4, AR_NDP2_PERIOD + 2*4, - AR_NDP2_TIMER_MODE, 0x0004}, - {AR_NEXT_NDP2_TIMER + 3*4, AR_NDP2_PERIOD + 3*4, - AR_NDP2_TIMER_MODE, 0x0008}, - {AR_NEXT_NDP2_TIMER + 4*4, AR_NDP2_PERIOD + 4*4, - AR_NDP2_TIMER_MODE, 0x0010}, - {AR_NEXT_NDP2_TIMER + 5*4, AR_NDP2_PERIOD + 5*4, - AR_NDP2_TIMER_MODE, 0x0020}, - {AR_NEXT_NDP2_TIMER + 6*4, AR_NDP2_PERIOD + 6*4, - AR_NDP2_TIMER_MODE, 0x0040}, - {AR_NEXT_NDP2_TIMER + 7*4, AR_NDP2_PERIOD + 7*4, - AR_NDP2_TIMER_MODE, 0x0080} -}; - -/* HW generic timer primitives */ - -/* compute and clear index of rightmost 1 */ -static u32 rightmost_index(struct ath_gen_timer_table *timer_table, u32 *mask) -{ - u32 b; - - b = *mask; - b &= (0-b); - *mask &= ~b; - b *= debruijn32; - b >>= 27; - - return timer_table->gen_timer_index[b]; -} - -u32 ath9k_hw_gettsf32(struct ath_hw *ah) -{ - return REG_READ(ah, AR_TSF_L32); -} -EXPORT_SYMBOL(ath9k_hw_gettsf32); - -struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, - void (*trigger)(void *), - void (*overflow)(void *), - void *arg, - u8 timer_index) -{ - struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; - struct ath_gen_timer *timer; - - timer = kzalloc(sizeof(struct ath_gen_timer), GFP_KERNEL); - if (timer == NULL) - return NULL; - - /* allocate a hardware generic timer slot */ - timer_table->timers[timer_index] = timer; - timer->index = timer_index; - timer->trigger = trigger; - timer->overflow = overflow; - timer->arg = arg; - - return timer; -} -EXPORT_SYMBOL(ath_gen_timer_alloc); - -void ath9k_hw_gen_timer_start(struct ath_hw *ah, - struct ath_gen_timer *timer, - u32 trig_timeout, - u32 timer_period) -{ - struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; - u32 tsf, timer_next; - - BUG_ON(!timer_period); - - set_bit(timer->index, &timer_table->timer_mask.timer_bits); - - tsf = ath9k_hw_gettsf32(ah); - - timer_next = tsf + trig_timeout; - - ath_dbg(ath9k_hw_common(ah), HWTIMER, - "current tsf %x period %x timer_next %x\n", - tsf, timer_period, timer_next); - - /* - * Program generic timer registers - */ - REG_WRITE(ah, gen_tmr_configuration[timer->index].next_addr, - timer_next); - REG_WRITE(ah, gen_tmr_configuration[timer->index].period_addr, - timer_period); - REG_SET_BIT(ah, gen_tmr_configuration[timer->index].mode_addr, - gen_tmr_configuration[timer->index].mode_mask); - - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) { - /* - * Starting from AR9462, each generic timer can select which tsf - * to use. But we still follow the old rule, 0 - 7 use tsf and - * 8 - 15 use tsf2. - */ - if ((timer->index < AR_GEN_TIMER_BANK_1_LEN)) - REG_CLR_BIT(ah, AR_MAC_PCU_GEN_TIMER_TSF_SEL, - (1 << timer->index)); - else - REG_SET_BIT(ah, AR_MAC_PCU_GEN_TIMER_TSF_SEL, - (1 << timer->index)); - } - - /* Enable both trigger and thresh interrupt masks */ - REG_SET_BIT(ah, AR_IMR_S5, - (SM(AR_GENTMR_BIT(timer->index), AR_IMR_S5_GENTIMER_THRESH) | - SM(AR_GENTMR_BIT(timer->index), AR_IMR_S5_GENTIMER_TRIG))); -} -EXPORT_SYMBOL(ath9k_hw_gen_timer_start); - -void ath9k_hw_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer) -{ - struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; - - if ((timer->index < AR_FIRST_NDP_TIMER) || - (timer->index >= ATH_MAX_GEN_TIMER)) { - return; - } - - /* Clear generic timer enable bits. */ - REG_CLR_BIT(ah, gen_tmr_configuration[timer->index].mode_addr, - gen_tmr_configuration[timer->index].mode_mask); - - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) { - /* - * Need to switch back to TSF if it was using TSF2. - */ - if ((timer->index >= AR_GEN_TIMER_BANK_1_LEN)) { - REG_CLR_BIT(ah, AR_MAC_PCU_GEN_TIMER_TSF_SEL, - (1 << timer->index)); - } - } - - /* Disable both trigger and thresh interrupt masks */ - REG_CLR_BIT(ah, AR_IMR_S5, - (SM(AR_GENTMR_BIT(timer->index), AR_IMR_S5_GENTIMER_THRESH) | - SM(AR_GENTMR_BIT(timer->index), AR_IMR_S5_GENTIMER_TRIG))); - - clear_bit(timer->index, &timer_table->timer_mask.timer_bits); -} -EXPORT_SYMBOL(ath9k_hw_gen_timer_stop); - -void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer) -{ - struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; - - /* free the hardware generic timer slot */ - timer_table->timers[timer->index] = NULL; - kfree(timer); -} -EXPORT_SYMBOL(ath_gen_timer_free); - -/* - * Generic Timer Interrupts handling - */ -void ath_gen_timer_isr(struct ath_hw *ah) -{ - struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; - struct ath_gen_timer *timer; - struct ath_common *common = ath9k_hw_common(ah); - u32 trigger_mask, thresh_mask, index; - - /* get hardware generic timer interrupt status */ - trigger_mask = ah->intr_gen_timer_trigger; - thresh_mask = ah->intr_gen_timer_thresh; - trigger_mask &= timer_table->timer_mask.val; - thresh_mask &= timer_table->timer_mask.val; - - trigger_mask &= ~thresh_mask; - - while (thresh_mask) { - index = rightmost_index(timer_table, &thresh_mask); - timer = timer_table->timers[index]; - BUG_ON(!timer); - ath_dbg(common, HWTIMER, "TSF overflow for Gen timer %d\n", - index); - timer->overflow(timer->arg); - } - - while (trigger_mask) { - index = rightmost_index(timer_table, &trigger_mask); - timer = timer_table->timers[index]; - BUG_ON(!timer); - ath_dbg(common, HWTIMER, - "Gen timer[%d] trigger\n", index); - timer->trigger(timer->arg); - } -} -EXPORT_SYMBOL(ath_gen_timer_isr); - -/********/ -/* HTC */ -/********/ - -static struct { - u32 version; - const char * name; -} ath_mac_bb_names[] = { - /* Devices with external radios */ - { AR_SREV_VERSION_5416_PCI, "5416" }, - { AR_SREV_VERSION_5416_PCIE, "5418" }, - { AR_SREV_VERSION_9100, "9100" }, - { AR_SREV_VERSION_9160, "9160" }, - /* Single-chip solutions */ - { AR_SREV_VERSION_9280, "9280" }, - { AR_SREV_VERSION_9285, "9285" }, - { AR_SREV_VERSION_9287, "9287" }, - { AR_SREV_VERSION_9271, "9271" }, - { AR_SREV_VERSION_9300, "9300" }, - { AR_SREV_VERSION_9330, "9330" }, - { AR_SREV_VERSION_9340, "9340" }, - { AR_SREV_VERSION_9485, "9485" }, - { AR_SREV_VERSION_9462, "9462" }, - { AR_SREV_VERSION_9550, "9550" }, - { AR_SREV_VERSION_9565, "9565" }, -}; - -/* For devices with external radios */ -static struct { - u16 version; - const char * name; -} ath_rf_names[] = { - { 0, "5133" }, - { AR_RAD5133_SREV_MAJOR, "5133" }, - { AR_RAD5122_SREV_MAJOR, "5122" }, - { AR_RAD2133_SREV_MAJOR, "2133" }, - { AR_RAD2122_SREV_MAJOR, "2122" } -}; - -/* - * Return the MAC/BB name. "????" is returned if the MAC/BB is unknown. - */ -static const char *ath9k_hw_mac_bb_name(u32 mac_bb_version) -{ - int i; - - for (i=0; i= AR9280 are single-chip */ - if (AR_SREV_9280_20_OR_LATER(ah)) { - used = snprintf(hw_name, len, - "Atheros AR%s Rev:%x", - ath9k_hw_mac_bb_name(ah->hw_version.macVersion), - ah->hw_version.macRev); - } - else { - used = snprintf(hw_name, len, - "Atheros AR%s MAC/BB Rev:%x AR%s RF Rev:%x", - ath9k_hw_mac_bb_name(ah->hw_version.macVersion), - ah->hw_version.macRev, - ath9k_hw_rf_name((ah->hw_version.analog5GhzRev & - AR_RADIO_SREV_MAJOR)), - ah->hw_version.phyRev); - } - - hw_name[used] = '\0'; -} -EXPORT_SYMBOL(ath9k_hw_name); diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h deleted file mode 100644 index ae3034374bc4..000000000000 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ /dev/null @@ -1,1175 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef HW_H -#define HW_H - -#include -#include -#include -#include - -#include "mac.h" -#include "ani.h" -#include "eeprom.h" -#include "calib.h" -#include "reg.h" -#include "phy.h" -#include "btcoex.h" - -#include "../regd.h" - -#define ATHEROS_VENDOR_ID 0x168c - -#define AR5416_DEVID_PCI 0x0023 -#define AR5416_DEVID_PCIE 0x0024 -#define AR9160_DEVID_PCI 0x0027 -#define AR9280_DEVID_PCI 0x0029 -#define AR9280_DEVID_PCIE 0x002a -#define AR9285_DEVID_PCIE 0x002b -#define AR2427_DEVID_PCIE 0x002c -#define AR9287_DEVID_PCI 0x002d -#define AR9287_DEVID_PCIE 0x002e -#define AR9300_DEVID_PCIE 0x0030 -#define AR9300_DEVID_AR9340 0x0031 -#define AR9300_DEVID_AR9485_PCIE 0x0032 -#define AR9300_DEVID_AR9580 0x0033 -#define AR9300_DEVID_AR9462 0x0034 -#define AR9300_DEVID_AR9330 0x0035 -#define AR9300_DEVID_QCA955X 0x0038 -#define AR9485_DEVID_AR1111 0x0037 -#define AR9300_DEVID_AR9565 0x0036 - -#define AR5416_AR9100_DEVID 0x000b - -#define AR_SUBVENDOR_ID_NOG 0x0e11 -#define AR_SUBVENDOR_ID_NEW_A 0x7065 -#define AR5416_MAGIC 0x19641014 - -#define AR9280_COEX2WIRE_SUBSYSID 0x309b -#define AT9285_COEX3WIRE_SA_SUBSYSID 0x30aa -#define AT9285_COEX3WIRE_DA_SUBSYSID 0x30ab - -#define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1) - -#define ATH_DEFAULT_NOISE_FLOOR -95 - -#define ATH9K_RSSI_BAD -128 - -#define ATH9K_NUM_CHANNELS 38 - -/* Register read/write primitives */ -#define REG_WRITE(_ah, _reg, _val) \ - (_ah)->reg_ops.write((_ah), (_val), (_reg)) - -#define REG_READ(_ah, _reg) \ - (_ah)->reg_ops.read((_ah), (_reg)) - -#define REG_READ_MULTI(_ah, _addr, _val, _cnt) \ - (_ah)->reg_ops.multi_read((_ah), (_addr), (_val), (_cnt)) - -#define REG_RMW(_ah, _reg, _set, _clr) \ - (_ah)->reg_ops.rmw((_ah), (_reg), (_set), (_clr)) - -#define ENABLE_REGWRITE_BUFFER(_ah) \ - do { \ - if ((_ah)->reg_ops.enable_write_buffer) \ - (_ah)->reg_ops.enable_write_buffer((_ah)); \ - } while (0) - -#define REGWRITE_BUFFER_FLUSH(_ah) \ - do { \ - if ((_ah)->reg_ops.write_flush) \ - (_ah)->reg_ops.write_flush((_ah)); \ - } while (0) - -#define PR_EEP(_s, _val) \ - do { \ - len += snprintf(buf + len, size - len, "%20s : %10d\n", \ - _s, (_val)); \ - } while (0) - -#define SM(_v, _f) (((_v) << _f##_S) & _f) -#define MS(_v, _f) (((_v) & _f) >> _f##_S) -#define REG_RMW_FIELD(_a, _r, _f, _v) \ - REG_RMW(_a, _r, (((_v) << _f##_S) & _f), (_f)) -#define REG_READ_FIELD(_a, _r, _f) \ - (((REG_READ(_a, _r) & _f) >> _f##_S)) -#define REG_SET_BIT(_a, _r, _f) \ - REG_RMW(_a, _r, (_f), 0) -#define REG_CLR_BIT(_a, _r, _f) \ - REG_RMW(_a, _r, 0, (_f)) - -#define DO_DELAY(x) do { \ - if (((++(x) % 64) == 0) && \ - (ath9k_hw_common(ah)->bus_ops->ath_bus_type \ - != ATH_USB)) \ - udelay(1); \ - } while (0) - -#define REG_WRITE_ARRAY(iniarray, column, regWr) \ - ath9k_hw_write_array(ah, iniarray, column, &(regWr)) - -#define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0 -#define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1 -#define AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED 2 -#define AR_GPIO_OUTPUT_MUX_AS_TX_FRAME 3 -#define AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL 4 -#define AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED 5 -#define AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED 6 -#define AR_GPIO_OUTPUT_MUX_AS_MCI_WLAN_DATA 0x16 -#define AR_GPIO_OUTPUT_MUX_AS_MCI_WLAN_CLK 0x17 -#define AR_GPIO_OUTPUT_MUX_AS_MCI_BT_DATA 0x18 -#define AR_GPIO_OUTPUT_MUX_AS_MCI_BT_CLK 0x19 -#define AR_GPIO_OUTPUT_MUX_AS_WL_IN_TX 0x14 -#define AR_GPIO_OUTPUT_MUX_AS_WL_IN_RX 0x13 -#define AR_GPIO_OUTPUT_MUX_AS_BT_IN_TX 9 -#define AR_GPIO_OUTPUT_MUX_AS_BT_IN_RX 8 -#define AR_GPIO_OUTPUT_MUX_AS_RUCKUS_STROBE 0x1d -#define AR_GPIO_OUTPUT_MUX_AS_RUCKUS_DATA 0x1e - -#define AR_GPIOD_MASK 0x00001FFF -#define AR_GPIO_BIT(_gpio) (1 << (_gpio)) - -#define BASE_ACTIVATE_DELAY 100 -#define RTC_PLL_SETTLE_DELAY (AR_SREV_9340(ah) ? 1000 : 100) -#define COEF_SCALE_S 24 -#define HT40_CHANNEL_CENTER_SHIFT 10 - -#define ATH9K_ANTENNA0_CHAINMASK 0x1 -#define ATH9K_ANTENNA1_CHAINMASK 0x2 - -#define ATH9K_NUM_DMA_DEBUG_REGS 8 -#define ATH9K_NUM_QUEUES 10 - -#define MAX_RATE_POWER 63 -#define AH_WAIT_TIMEOUT 100000 /* (us) */ -#define AH_TSF_WRITE_TIMEOUT 100 /* (us) */ -#define AH_TIME_QUANTUM 10 -#define AR_KEYTABLE_SIZE 128 -#define POWER_UP_TIME 10000 -#define SPUR_RSSI_THRESH 40 -#define UPPER_5G_SUB_BAND_START 5700 -#define MID_5G_SUB_BAND_START 5400 - -#define CAB_TIMEOUT_VAL 10 -#define BEACON_TIMEOUT_VAL 10 -#define MIN_BEACON_TIMEOUT_VAL 1 -#define SLEEP_SLOP 3 - -#define INIT_CONFIG_STATUS 0x00000000 -#define INIT_RSSI_THR 0x00000700 -#define INIT_BCON_CNTRL_REG 0x00000000 - -#define TU_TO_USEC(_tu) ((_tu) << 10) - -#define ATH9K_HW_RX_HP_QDEPTH 16 -#define ATH9K_HW_RX_LP_QDEPTH 128 - -#define PAPRD_GAIN_TABLE_ENTRIES 32 -#define PAPRD_TABLE_SZ 24 -#define PAPRD_IDEAL_AGC2_PWR_RANGE 0xe0 - -/* - * Wake on Wireless - */ - -/* Keep Alive Frame */ -#define KAL_FRAME_LEN 28 -#define KAL_FRAME_TYPE 0x2 /* data frame */ -#define KAL_FRAME_SUB_TYPE 0x4 /* null data frame */ -#define KAL_DURATION_ID 0x3d -#define KAL_NUM_DATA_WORDS 6 -#define KAL_NUM_DESC_WORDS 12 -#define KAL_ANTENNA_MODE 1 -#define KAL_TO_DS 1 -#define KAL_DELAY 4 /*delay of 4ms between 2 KAL frames */ -#define KAL_TIMEOUT 900 - -#define MAX_PATTERN_SIZE 256 -#define MAX_PATTERN_MASK_SIZE 32 -#define MAX_NUM_PATTERN 8 -#define MAX_NUM_USER_PATTERN 6 /* deducting the disassociate and - deauthenticate packets */ - -/* - * WoW trigger mapping to hardware code - */ - -#define AH_WOW_USER_PATTERN_EN BIT(0) -#define AH_WOW_MAGIC_PATTERN_EN BIT(1) -#define AH_WOW_LINK_CHANGE BIT(2) -#define AH_WOW_BEACON_MISS BIT(3) - -enum ath_hw_txq_subtype { - ATH_TXQ_AC_BE = 0, - ATH_TXQ_AC_BK = 1, - ATH_TXQ_AC_VI = 2, - ATH_TXQ_AC_VO = 3, -}; - -enum ath_ini_subsys { - ATH_INI_PRE = 0, - ATH_INI_CORE, - ATH_INI_POST, - ATH_INI_NUM_SPLIT, -}; - -enum ath9k_hw_caps { - ATH9K_HW_CAP_HT = BIT(0), - ATH9K_HW_CAP_RFSILENT = BIT(1), - ATH9K_HW_CAP_AUTOSLEEP = BIT(2), - ATH9K_HW_CAP_4KB_SPLITTRANS = BIT(3), - ATH9K_HW_CAP_EDMA = BIT(4), - ATH9K_HW_CAP_RAC_SUPPORTED = BIT(5), - ATH9K_HW_CAP_LDPC = BIT(6), - ATH9K_HW_CAP_FASTCLOCK = BIT(7), - ATH9K_HW_CAP_SGI_20 = BIT(8), - ATH9K_HW_CAP_ANT_DIV_COMB = BIT(10), - ATH9K_HW_CAP_2GHZ = BIT(11), - ATH9K_HW_CAP_5GHZ = BIT(12), - ATH9K_HW_CAP_APM = BIT(13), - ATH9K_HW_CAP_RTT = BIT(14), - ATH9K_HW_CAP_MCI = BIT(15), - ATH9K_HW_CAP_DFS = BIT(16), - ATH9K_HW_WOW_DEVICE_CAPABLE = BIT(17), - ATH9K_HW_WOW_PATTERN_MATCH_EXACT = BIT(18), - ATH9K_HW_WOW_PATTERN_MATCH_DWORD = BIT(19), - ATH9K_HW_CAP_PAPRD = BIT(20), -}; - -/* - * WoW device capabilities - * @ATH9K_HW_WOW_DEVICE_CAPABLE: device revision is capable of WoW. - * @ATH9K_HW_WOW_PATTERN_MATCH_EXACT: device is capable of matching - * an exact user defined pattern or de-authentication/disassoc pattern. - * @ATH9K_HW_WOW_PATTERN_MATCH_DWORD: device requires the first four - * bytes of the pattern for user defined pattern, de-authentication and - * disassociation patterns for all types of possible frames recieved - * of those types. - */ - -struct ath9k_hw_capabilities { - u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */ - u16 rts_aggr_limit; - u8 tx_chainmask; - u8 rx_chainmask; - u8 max_txchains; - u8 max_rxchains; - u8 num_gpio_pins; - u8 rx_hp_qdepth; - u8 rx_lp_qdepth; - u8 rx_status_len; - u8 tx_desc_len; - u8 txs_len; -}; - -struct ath9k_ops_config { - int dma_beacon_response_time; - int sw_beacon_response_time; - int additional_swba_backoff; - int ack_6mb; - u32 cwm_ignore_extcca; - bool pcieSerDesWrite; - u8 pcie_clock_req; - u32 pcie_waen; - u8 analog_shiftreg; - u32 ofdm_trig_low; - u32 ofdm_trig_high; - u32 cck_trig_high; - u32 cck_trig_low; - u32 enable_ani; - u32 enable_paprd; - int serialize_regmode; - bool rx_intr_mitigation; - bool tx_intr_mitigation; -#define SPUR_DISABLE 0 -#define SPUR_ENABLE_IOCTL 1 -#define SPUR_ENABLE_EEPROM 2 -#define AR_SPUR_5413_1 1640 -#define AR_SPUR_5413_2 1200 -#define AR_NO_SPUR 0x8000 -#define AR_BASE_FREQ_2GHZ 2300 -#define AR_BASE_FREQ_5GHZ 4900 -#define AR_SPUR_FEEQ_BOUND_HT40 19 -#define AR_SPUR_FEEQ_BOUND_HT20 10 - int spurmode; - u16 spurchans[AR_EEPROM_MODAL_SPURS][2]; - u8 max_txtrig_level; - u16 ani_poll_interval; /* ANI poll interval in ms */ -}; - -enum ath9k_int { - ATH9K_INT_RX = 0x00000001, - ATH9K_INT_RXDESC = 0x00000002, - ATH9K_INT_RXHP = 0x00000001, - ATH9K_INT_RXLP = 0x00000002, - ATH9K_INT_RXNOFRM = 0x00000008, - ATH9K_INT_RXEOL = 0x00000010, - ATH9K_INT_RXORN = 0x00000020, - ATH9K_INT_TX = 0x00000040, - ATH9K_INT_TXDESC = 0x00000080, - ATH9K_INT_TIM_TIMER = 0x00000100, - ATH9K_INT_MCI = 0x00000200, - ATH9K_INT_BB_WATCHDOG = 0x00000400, - ATH9K_INT_TXURN = 0x00000800, - ATH9K_INT_MIB = 0x00001000, - ATH9K_INT_RXPHY = 0x00004000, - ATH9K_INT_RXKCM = 0x00008000, - ATH9K_INT_SWBA = 0x00010000, - ATH9K_INT_BMISS = 0x00040000, - ATH9K_INT_BNR = 0x00100000, - ATH9K_INT_TIM = 0x00200000, - ATH9K_INT_DTIM = 0x00400000, - ATH9K_INT_DTIMSYNC = 0x00800000, - ATH9K_INT_GPIO = 0x01000000, - ATH9K_INT_CABEND = 0x02000000, - ATH9K_INT_TSFOOR = 0x04000000, - ATH9K_INT_GENTIMER = 0x08000000, - ATH9K_INT_CST = 0x10000000, - ATH9K_INT_GTT = 0x20000000, - ATH9K_INT_FATAL = 0x40000000, - ATH9K_INT_GLOBAL = 0x80000000, - ATH9K_INT_BMISC = ATH9K_INT_TIM | - ATH9K_INT_DTIM | - ATH9K_INT_DTIMSYNC | - ATH9K_INT_TSFOOR | - ATH9K_INT_CABEND, - ATH9K_INT_COMMON = ATH9K_INT_RXNOFRM | - ATH9K_INT_RXDESC | - ATH9K_INT_RXEOL | - ATH9K_INT_RXORN | - ATH9K_INT_TXURN | - ATH9K_INT_TXDESC | - ATH9K_INT_MIB | - ATH9K_INT_RXPHY | - ATH9K_INT_RXKCM | - ATH9K_INT_SWBA | - ATH9K_INT_BMISS | - ATH9K_INT_GPIO, - ATH9K_INT_NOCARD = 0xffffffff -}; - -#define CHANNEL_CCK 0x00020 -#define CHANNEL_OFDM 0x00040 -#define CHANNEL_2GHZ 0x00080 -#define CHANNEL_5GHZ 0x00100 -#define CHANNEL_PASSIVE 0x00200 -#define CHANNEL_DYN 0x00400 -#define CHANNEL_HALF 0x04000 -#define CHANNEL_QUARTER 0x08000 -#define CHANNEL_HT20 0x10000 -#define CHANNEL_HT40PLUS 0x20000 -#define CHANNEL_HT40MINUS 0x40000 - -#define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM) -#define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK) -#define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM) -#define CHANNEL_G_HT20 (CHANNEL_2GHZ|CHANNEL_HT20) -#define CHANNEL_A_HT20 (CHANNEL_5GHZ|CHANNEL_HT20) -#define CHANNEL_G_HT40PLUS (CHANNEL_2GHZ|CHANNEL_HT40PLUS) -#define CHANNEL_G_HT40MINUS (CHANNEL_2GHZ|CHANNEL_HT40MINUS) -#define CHANNEL_A_HT40PLUS (CHANNEL_5GHZ|CHANNEL_HT40PLUS) -#define CHANNEL_A_HT40MINUS (CHANNEL_5GHZ|CHANNEL_HT40MINUS) -#define CHANNEL_ALL \ - (CHANNEL_OFDM| \ - CHANNEL_CCK| \ - CHANNEL_2GHZ | \ - CHANNEL_5GHZ | \ - CHANNEL_HT20 | \ - CHANNEL_HT40PLUS | \ - CHANNEL_HT40MINUS) - -#define MAX_RTT_TABLE_ENTRY 6 -#define MAX_IQCAL_MEASUREMENT 8 -#define MAX_CL_TAB_ENTRY 16 -#define CL_TAB_ENTRY(reg_base) (reg_base + (4 * j)) - -struct ath9k_hw_cal_data { - u16 channel; - u32 channelFlags; - u32 chanmode; - int32_t CalValid; - int8_t iCoff; - int8_t qCoff; - bool rtt_done; - bool paprd_packet_sent; - bool paprd_done; - bool nfcal_pending; - bool nfcal_interference; - bool done_txiqcal_once; - bool done_txclcal_once; - u16 small_signal_gain[AR9300_MAX_CHAINS]; - u32 pa_table[AR9300_MAX_CHAINS][PAPRD_TABLE_SZ]; - u32 num_measures[AR9300_MAX_CHAINS]; - int tx_corr_coeff[MAX_IQCAL_MEASUREMENT][AR9300_MAX_CHAINS]; - u32 tx_clcal[AR9300_MAX_CHAINS][MAX_CL_TAB_ENTRY]; - u32 rtt_table[AR9300_MAX_CHAINS][MAX_RTT_TABLE_ENTRY]; - struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS]; -}; - -struct ath9k_channel { - struct ieee80211_channel *chan; - struct ar5416AniState ani; - u16 channel; - u32 channelFlags; - u32 chanmode; - s16 noisefloor; -}; - -#define IS_CHAN_G(_c) ((((_c)->channelFlags & (CHANNEL_G)) == CHANNEL_G) || \ - (((_c)->channelFlags & CHANNEL_G_HT20) == CHANNEL_G_HT20) || \ - (((_c)->channelFlags & CHANNEL_G_HT40PLUS) == CHANNEL_G_HT40PLUS) || \ - (((_c)->channelFlags & CHANNEL_G_HT40MINUS) == CHANNEL_G_HT40MINUS)) -#define IS_CHAN_OFDM(_c) (((_c)->channelFlags & CHANNEL_OFDM) != 0) -#define IS_CHAN_5GHZ(_c) (((_c)->channelFlags & CHANNEL_5GHZ) != 0) -#define IS_CHAN_2GHZ(_c) (((_c)->channelFlags & CHANNEL_2GHZ) != 0) -#define IS_CHAN_HALF_RATE(_c) (((_c)->channelFlags & CHANNEL_HALF) != 0) -#define IS_CHAN_QUARTER_RATE(_c) (((_c)->channelFlags & CHANNEL_QUARTER) != 0) -#define IS_CHAN_A_FAST_CLOCK(_ah, _c) \ - ((((_c)->channelFlags & CHANNEL_5GHZ) != 0) && \ - ((_ah)->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK)) - -/* These macros check chanmode and not channelFlags */ -#define IS_CHAN_B(_c) ((_c)->chanmode == CHANNEL_B) -#define IS_CHAN_HT20(_c) (((_c)->chanmode == CHANNEL_A_HT20) || \ - ((_c)->chanmode == CHANNEL_G_HT20)) -#define IS_CHAN_HT40(_c) (((_c)->chanmode == CHANNEL_A_HT40PLUS) || \ - ((_c)->chanmode == CHANNEL_A_HT40MINUS) || \ - ((_c)->chanmode == CHANNEL_G_HT40PLUS) || \ - ((_c)->chanmode == CHANNEL_G_HT40MINUS)) -#define IS_CHAN_HT(_c) (IS_CHAN_HT20((_c)) || IS_CHAN_HT40((_c))) - -enum ath9k_power_mode { - ATH9K_PM_AWAKE = 0, - ATH9K_PM_FULL_SLEEP, - ATH9K_PM_NETWORK_SLEEP, - ATH9K_PM_UNDEFINED -}; - -enum ser_reg_mode { - SER_REG_MODE_OFF = 0, - SER_REG_MODE_ON = 1, - SER_REG_MODE_AUTO = 2, -}; - -enum ath9k_rx_qtype { - ATH9K_RX_QUEUE_HP, - ATH9K_RX_QUEUE_LP, - ATH9K_RX_QUEUE_MAX, -}; - -struct ath9k_beacon_state { - u32 bs_nexttbtt; - u32 bs_nextdtim; - u32 bs_intval; -#define ATH9K_TSFOOR_THRESHOLD 0x00004240 /* 16k us */ - u32 bs_dtimperiod; - u16 bs_cfpperiod; - u16 bs_cfpmaxduration; - u32 bs_cfpnext; - u16 bs_timoffset; - u16 bs_bmissthreshold; - u32 bs_sleepduration; - u32 bs_tsfoor_threshold; -}; - -struct chan_centers { - u16 synth_center; - u16 ctl_center; - u16 ext_center; -}; - -enum { - ATH9K_RESET_POWER_ON, - ATH9K_RESET_WARM, - ATH9K_RESET_COLD, -}; - -struct ath9k_hw_version { - u32 magic; - u16 devid; - u16 subvendorid; - u32 macVersion; - u16 macRev; - u16 phyRev; - u16 analog5GhzRev; - u16 analog2GhzRev; - enum ath_usb_dev usbdev; -}; - -/* Generic TSF timer definitions */ - -#define ATH_MAX_GEN_TIMER 16 - -#define AR_GENTMR_BIT(_index) (1 << (_index)) - -/* - * Using de Bruijin sequence to look up 1's index in a 32 bit number - * debruijn32 = 0000 0111 0111 1100 1011 0101 0011 0001 - */ -#define debruijn32 0x077CB531U - -struct ath_gen_timer_configuration { - u32 next_addr; - u32 period_addr; - u32 mode_addr; - u32 mode_mask; -}; - -struct ath_gen_timer { - void (*trigger)(void *arg); - void (*overflow)(void *arg); - void *arg; - u8 index; -}; - -struct ath_gen_timer_table { - u32 gen_timer_index[32]; - struct ath_gen_timer *timers[ATH_MAX_GEN_TIMER]; - union { - unsigned long timer_bits; - u16 val; - } timer_mask; -}; - -struct ath_hw_antcomb_conf { - u8 main_lna_conf; - u8 alt_lna_conf; - u8 fast_div_bias; - u8 main_gaintb; - u8 alt_gaintb; - int lna1_lna2_delta; - u8 div_group; -}; - -/** - * struct ath_hw_radar_conf - radar detection initialization parameters - * - * @pulse_inband: threshold for checking the ratio of in-band power - * to total power for short radar pulses (half dB steps) - * @pulse_inband_step: threshold for checking an in-band power to total - * power ratio increase for short radar pulses (half dB steps) - * @pulse_height: threshold for detecting the beginning of a short - * radar pulse (dB step) - * @pulse_rssi: threshold for detecting if a short radar pulse is - * gone (dB step) - * @pulse_maxlen: maximum pulse length (0.8 us steps) - * - * @radar_rssi: RSSI threshold for starting long radar detection (dB steps) - * @radar_inband: threshold for checking the ratio of in-band power - * to total power for long radar pulses (half dB steps) - * @fir_power: threshold for detecting the end of a long radar pulse (dB) - * - * @ext_channel: enable extension channel radar detection - */ -struct ath_hw_radar_conf { - unsigned int pulse_inband; - unsigned int pulse_inband_step; - unsigned int pulse_height; - unsigned int pulse_rssi; - unsigned int pulse_maxlen; - - unsigned int radar_rssi; - unsigned int radar_inband; - int fir_power; - - bool ext_channel; -}; - -/** - * struct ath_hw_private_ops - callbacks used internally by hardware code - * - * This structure contains private callbacks designed to only be used internally - * by the hardware core. - * - * @init_cal_settings: setup types of calibrations supported - * @init_cal: starts actual calibration - * - * @init_mode_gain_regs: Initialize TX/RX gain registers - * - * @rf_set_freq: change frequency - * @spur_mitigate_freq: spur mitigation - * @set_rf_regs: - * @compute_pll_control: compute the PLL control value to use for - * AR_RTC_PLL_CONTROL for a given channel - * @setup_calibration: set up calibration - * @iscal_supported: used to query if a type of calibration is supported - * - * @ani_cache_ini_regs: cache the values for ANI from the initial - * register settings through the register initialization. - */ -struct ath_hw_private_ops { - /* Calibration ops */ - void (*init_cal_settings)(struct ath_hw *ah); - bool (*init_cal)(struct ath_hw *ah, struct ath9k_channel *chan); - - void (*init_mode_gain_regs)(struct ath_hw *ah); - void (*setup_calibration)(struct ath_hw *ah, - struct ath9k_cal_list *currCal); - - /* PHY ops */ - int (*rf_set_freq)(struct ath_hw *ah, - struct ath9k_channel *chan); - void (*spur_mitigate_freq)(struct ath_hw *ah, - struct ath9k_channel *chan); - bool (*set_rf_regs)(struct ath_hw *ah, - struct ath9k_channel *chan, - u16 modesIndex); - void (*set_channel_regs)(struct ath_hw *ah, struct ath9k_channel *chan); - void (*init_bb)(struct ath_hw *ah, - struct ath9k_channel *chan); - int (*process_ini)(struct ath_hw *ah, struct ath9k_channel *chan); - void (*olc_init)(struct ath_hw *ah); - void (*set_rfmode)(struct ath_hw *ah, struct ath9k_channel *chan); - void (*mark_phy_inactive)(struct ath_hw *ah); - void (*set_delta_slope)(struct ath_hw *ah, struct ath9k_channel *chan); - bool (*rfbus_req)(struct ath_hw *ah); - void (*rfbus_done)(struct ath_hw *ah); - void (*restore_chainmask)(struct ath_hw *ah); - u32 (*compute_pll_control)(struct ath_hw *ah, - struct ath9k_channel *chan); - bool (*ani_control)(struct ath_hw *ah, enum ath9k_ani_cmd cmd, - int param); - void (*do_getnf)(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS]); - void (*set_radar_params)(struct ath_hw *ah, - struct ath_hw_radar_conf *conf); - int (*fast_chan_change)(struct ath_hw *ah, struct ath9k_channel *chan, - u8 *ini_reloaded); - - /* ANI */ - void (*ani_cache_ini_regs)(struct ath_hw *ah); -}; - -/** - * struct ath_spec_scan - parameters for Atheros spectral scan - * - * @enabled: enable/disable spectral scan - * @short_repeat: controls whether the chip is in spectral scan mode - * for 4 usec (enabled) or 204 usec (disabled) - * @count: number of scan results requested. There are special meanings - * in some chip revisions: - * AR92xx: highest bit set (>=128) for endless mode - * (spectral scan won't stopped until explicitly disabled) - * AR9300 and newer: 0 for endless mode - * @endless: true if endless mode is intended. Otherwise, count value is - * corrected to the next possible value. - * @period: time duration between successive spectral scan entry points - * (period*256*Tclk). Tclk = ath_common->clockrate - * @fft_period: PHY passes FFT frames to MAC every (fft_period+1)*4uS - * - * Note: Tclk = 40MHz or 44MHz depending upon operating mode. - * Typically it's 44MHz in 2/5GHz on later chips, but there's - * a "fast clock" check for this in 5GHz. - * - */ -struct ath_spec_scan { - bool enabled; - bool short_repeat; - bool endless; - u8 count; - u8 period; - u8 fft_period; -}; - -/** - * struct ath_hw_ops - callbacks used by hardware code and driver code - * - * This structure contains callbacks designed to to be used internally by - * hardware code and also by the lower level driver. - * - * @config_pci_powersave: - * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC - * - * @spectral_scan_config: set parameters for spectral scan and enable/disable it - * @spectral_scan_trigger: trigger a spectral scan run - * @spectral_scan_wait: wait for a spectral scan run to finish - */ -struct ath_hw_ops { - void (*config_pci_powersave)(struct ath_hw *ah, - bool power_off); - void (*rx_enable)(struct ath_hw *ah); - void (*set_desc_link)(void *ds, u32 link); - bool (*calibrate)(struct ath_hw *ah, - struct ath9k_channel *chan, - u8 rxchainmask, - bool longcal); - bool (*get_isr)(struct ath_hw *ah, enum ath9k_int *masked); - void (*set_txdesc)(struct ath_hw *ah, void *ds, - struct ath_tx_info *i); - int (*proc_txdesc)(struct ath_hw *ah, void *ds, - struct ath_tx_status *ts); - void (*antdiv_comb_conf_get)(struct ath_hw *ah, - struct ath_hw_antcomb_conf *antconf); - void (*antdiv_comb_conf_set)(struct ath_hw *ah, - struct ath_hw_antcomb_conf *antconf); - void (*antctrl_shared_chain_lnadiv)(struct ath_hw *hw, bool enable); - void (*spectral_scan_config)(struct ath_hw *ah, - struct ath_spec_scan *param); - void (*spectral_scan_trigger)(struct ath_hw *ah); - void (*spectral_scan_wait)(struct ath_hw *ah); -}; - -struct ath_nf_limits { - s16 max; - s16 min; - s16 nominal; -}; - -enum ath_cal_list { - TX_IQ_CAL = BIT(0), - TX_IQ_ON_AGC_CAL = BIT(1), - TX_CL_CAL = BIT(2), -}; - -/* ah_flags */ -#define AH_USE_EEPROM 0x1 -#define AH_UNPLUGGED 0x2 /* The card has been physically removed. */ -#define AH_FASTCC 0x4 - -struct ath_hw { - struct ath_ops reg_ops; - - struct device *dev; - struct ieee80211_hw *hw; - struct ath_common common; - struct ath9k_hw_version hw_version; - struct ath9k_ops_config config; - struct ath9k_hw_capabilities caps; - struct ath9k_channel channels[ATH9K_NUM_CHANNELS]; - struct ath9k_channel *curchan; - - union { - struct ar5416_eeprom_def def; - struct ar5416_eeprom_4k map4k; - struct ar9287_eeprom map9287; - struct ar9300_eeprom ar9300_eep; - } eeprom; - const struct eeprom_ops *eep_ops; - - bool sw_mgmt_crypto; - bool is_pciexpress; - bool aspm_enabled; - bool is_monitoring; - bool need_an_top2_fixup; - bool shared_chain_lnadiv; - u16 tx_trig_level; - - u32 nf_regs[6]; - struct ath_nf_limits nf_2g; - struct ath_nf_limits nf_5g; - u16 rfsilent; - u32 rfkill_gpio; - u32 rfkill_polarity; - u32 ah_flags; - - bool reset_power_on; - bool htc_reset_init; - - enum nl80211_iftype opmode; - enum ath9k_power_mode power_mode; - - s8 noise; - struct ath9k_hw_cal_data *caldata; - struct ath9k_pacal_info pacal_info; - struct ar5416Stats stats; - struct ath9k_tx_queue_info txq[ATH9K_NUM_TX_QUEUES]; - - enum ath9k_int imask; - u32 imrs2_reg; - u32 txok_interrupt_mask; - u32 txerr_interrupt_mask; - u32 txdesc_interrupt_mask; - u32 txeol_interrupt_mask; - u32 txurn_interrupt_mask; - atomic_t intr_ref_cnt; - bool chip_fullsleep; - u32 atim_window; - u32 modes_index; - - /* Calibration */ - u32 supp_cals; - struct ath9k_cal_list iq_caldata; - struct ath9k_cal_list adcgain_caldata; - struct ath9k_cal_list adcdc_caldata; - struct ath9k_cal_list *cal_list; - struct ath9k_cal_list *cal_list_last; - struct ath9k_cal_list *cal_list_curr; -#define totalPowerMeasI meas0.unsign -#define totalPowerMeasQ meas1.unsign -#define totalIqCorrMeas meas2.sign -#define totalAdcIOddPhase meas0.unsign -#define totalAdcIEvenPhase meas1.unsign -#define totalAdcQOddPhase meas2.unsign -#define totalAdcQEvenPhase meas3.unsign -#define totalAdcDcOffsetIOddPhase meas0.sign -#define totalAdcDcOffsetIEvenPhase meas1.sign -#define totalAdcDcOffsetQOddPhase meas2.sign -#define totalAdcDcOffsetQEvenPhase meas3.sign - union { - u32 unsign[AR5416_MAX_CHAINS]; - int32_t sign[AR5416_MAX_CHAINS]; - } meas0; - union { - u32 unsign[AR5416_MAX_CHAINS]; - int32_t sign[AR5416_MAX_CHAINS]; - } meas1; - union { - u32 unsign[AR5416_MAX_CHAINS]; - int32_t sign[AR5416_MAX_CHAINS]; - } meas2; - union { - u32 unsign[AR5416_MAX_CHAINS]; - int32_t sign[AR5416_MAX_CHAINS]; - } meas3; - u16 cal_samples; - u8 enabled_cals; - - u32 sta_id1_defaults; - u32 misc_mode; - - /* Private to hardware code */ - struct ath_hw_private_ops private_ops; - /* Accessed by the lower level driver */ - struct ath_hw_ops ops; - - /* Used to program the radio on non single-chip devices */ - u32 *analogBank6Data; - - int coverage_class; - u32 slottime; - u32 globaltxtimeout; - - /* ANI */ - u32 proc_phyerr; - u32 aniperiod; - enum ath9k_ani_cmd ani_function; - u32 ani_skip_count; - -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT - struct ath_btcoex_hw btcoex_hw; -#endif - - u32 intr_txqs; - u8 txchainmask; - u8 rxchainmask; - - struct ath_hw_radar_conf radar_conf; - - u32 originalGain[22]; - int initPDADC; - int PDADCdelta; - int led_pin; - u32 gpio_mask; - u32 gpio_val; - - struct ar5416IniArray iniModes; - struct ar5416IniArray iniCommon; - struct ar5416IniArray iniBB_RfGain; - struct ar5416IniArray iniBank6; - struct ar5416IniArray iniAddac; - struct ar5416IniArray iniPcieSerdes; -#ifdef CONFIG_PM_SLEEP - struct ar5416IniArray iniPcieSerdesWow; -#endif - struct ar5416IniArray iniPcieSerdesLowPower; - struct ar5416IniArray iniModesFastClock; - struct ar5416IniArray iniAdditional; - struct ar5416IniArray iniModesRxGain; - struct ar5416IniArray ini_modes_rx_gain_bounds; - struct ar5416IniArray iniModesTxGain; - struct ar5416IniArray iniCckfirNormal; - struct ar5416IniArray iniCckfirJapan2484; - struct ar5416IniArray iniModes_9271_ANI_reg; - struct ar5416IniArray ini_radio_post_sys2ant; - - struct ar5416IniArray iniMac[ATH_INI_NUM_SPLIT]; - struct ar5416IniArray iniBB[ATH_INI_NUM_SPLIT]; - struct ar5416IniArray iniRadio[ATH_INI_NUM_SPLIT]; - struct ar5416IniArray iniSOC[ATH_INI_NUM_SPLIT]; - - u32 intr_gen_timer_trigger; - u32 intr_gen_timer_thresh; - struct ath_gen_timer_table hw_gen_timers; - - struct ar9003_txs *ts_ring; - u32 ts_paddr_start; - u32 ts_paddr_end; - u16 ts_tail; - u16 ts_size; - - u32 bb_watchdog_last_status; - u32 bb_watchdog_timeout_ms; /* in ms, 0 to disable */ - u8 bb_hang_rx_ofdm; /* true if bb hang due to rx_ofdm */ - - unsigned int paprd_target_power; - unsigned int paprd_training_power; - unsigned int paprd_ratemask; - unsigned int paprd_ratemask_ht40; - bool paprd_table_write_done; - u32 paprd_gain_table_entries[PAPRD_GAIN_TABLE_ENTRIES]; - u8 paprd_gain_table_index[PAPRD_GAIN_TABLE_ENTRIES]; - /* - * Store the permanent value of Reg 0x4004in WARegVal - * so we dont have to R/M/W. We should not be reading - * this register when in sleep states. - */ - u32 WARegVal; - - /* Enterprise mode cap */ - u32 ent_mode; - -#ifdef CONFIG_PM_SLEEP - u32 wow_event_mask; -#endif - bool is_clk_25mhz; - int (*get_mac_revision)(void); - int (*external_reset)(void); - - const struct firmware *eeprom_blob; -}; - -struct ath_bus_ops { - enum ath_bus_type ath_bus_type; - void (*read_cachesize)(struct ath_common *common, int *csz); - bool (*eeprom_read)(struct ath_common *common, u32 off, u16 *data); - void (*bt_coex_prep)(struct ath_common *common); - void (*aspm_init)(struct ath_common *common); -}; - -static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah) -{ - return &ah->common; -} - -static inline struct ath_regulatory *ath9k_hw_regulatory(struct ath_hw *ah) -{ - return &(ath9k_hw_common(ah)->regulatory); -} - -static inline struct ath_hw_private_ops *ath9k_hw_private_ops(struct ath_hw *ah) -{ - return &ah->private_ops; -} - -static inline struct ath_hw_ops *ath9k_hw_ops(struct ath_hw *ah) -{ - return &ah->ops; -} - -static inline u8 get_streams(int mask) -{ - return !!(mask & BIT(0)) + !!(mask & BIT(1)) + !!(mask & BIT(2)); -} - -/* Initialization, Detach, Reset */ -void ath9k_hw_deinit(struct ath_hw *ah); -int ath9k_hw_init(struct ath_hw *ah); -int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, - struct ath9k_hw_cal_data *caldata, bool fastcc); -int ath9k_hw_fill_cap_info(struct ath_hw *ah); -u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan); - -/* GPIO / RFKILL / Antennae */ -void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio); -u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio); -void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, - u32 ah_signal_type); -void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val); -void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); - -/* General Operation */ -void ath9k_hw_synth_delay(struct ath_hw *ah, struct ath9k_channel *chan, - int hw_delay); -bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout); -void ath9k_hw_write_array(struct ath_hw *ah, const struct ar5416IniArray *array, - int column, unsigned int *writecnt); -u32 ath9k_hw_reverse_bits(u32 val, u32 n); -u16 ath9k_hw_computetxtime(struct ath_hw *ah, - u8 phy, int kbps, - u32 frameLen, u16 rateix, bool shortPreamble); -void ath9k_hw_get_channel_centers(struct ath_hw *ah, - struct ath9k_channel *chan, - struct chan_centers *centers); -u32 ath9k_hw_getrxfilter(struct ath_hw *ah); -void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits); -bool ath9k_hw_phy_disable(struct ath_hw *ah); -bool ath9k_hw_disable(struct ath_hw *ah); -void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test); -void ath9k_hw_setopmode(struct ath_hw *ah); -void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1); -void ath9k_hw_write_associd(struct ath_hw *ah); -u32 ath9k_hw_gettsf32(struct ath_hw *ah); -u64 ath9k_hw_gettsf64(struct ath_hw *ah); -void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64); -void ath9k_hw_reset_tsf(struct ath_hw *ah); -void ath9k_hw_set_tsfadjust(struct ath_hw *ah, bool set); -void ath9k_hw_init_global_settings(struct ath_hw *ah); -u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah); -void ath9k_hw_set11nmac2040(struct ath_hw *ah); -void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); -void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, - const struct ath9k_beacon_state *bs); -bool ath9k_hw_check_alive(struct ath_hw *ah); - -bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); - -#ifdef CONFIG_ATH9K_DEBUGFS -void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause); -#else -static inline void ath9k_debug_sync_cause(struct ath_common *common, - u32 sync_cause) {} -#endif - -/* Generic hw timer primitives */ -struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, - void (*trigger)(void *), - void (*overflow)(void *), - void *arg, - u8 timer_index); -void ath9k_hw_gen_timer_start(struct ath_hw *ah, - struct ath_gen_timer *timer, - u32 timer_next, - u32 timer_period); -void ath9k_hw_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer); - -void ath_gen_timer_free(struct ath_hw *ah, struct ath_gen_timer *timer); -void ath_gen_timer_isr(struct ath_hw *hw); - -void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len); - -/* PHY */ -void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, - u32 *coef_mantissa, u32 *coef_exponent); -void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, - bool test); - -/* - * Code Specific to AR5008, AR9001 or AR9002, - * we stuff these here to avoid callbacks for AR9003. - */ -int ar9002_hw_rf_claim(struct ath_hw *ah); -void ar9002_hw_enable_async_fifo(struct ath_hw *ah); - -/* - * Code specific to AR9003, we stuff these here to avoid callbacks - * for older families - */ -void ar9003_hw_bb_watchdog_config(struct ath_hw *ah); -void ar9003_hw_bb_watchdog_read(struct ath_hw *ah); -void ar9003_hw_bb_watchdog_dbg_info(struct ath_hw *ah); -void ar9003_hw_disable_phy_restart(struct ath_hw *ah); -void ar9003_paprd_enable(struct ath_hw *ah, bool val); -void ar9003_paprd_populate_single_table(struct ath_hw *ah, - struct ath9k_hw_cal_data *caldata, - int chain); -int ar9003_paprd_create_curve(struct ath_hw *ah, - struct ath9k_hw_cal_data *caldata, int chain); -void ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain); -int ar9003_paprd_init_table(struct ath_hw *ah); -bool ar9003_paprd_is_done(struct ath_hw *ah); -bool ar9003_is_paprd_enabled(struct ath_hw *ah); -void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx); - -/* Hardware family op attach helpers */ -int ar5008_hw_attach_phy_ops(struct ath_hw *ah); -void ar9002_hw_attach_phy_ops(struct ath_hw *ah); -void ar9003_hw_attach_phy_ops(struct ath_hw *ah); - -void ar9002_hw_attach_calib_ops(struct ath_hw *ah); -void ar9003_hw_attach_calib_ops(struct ath_hw *ah); - -int ar9002_hw_attach_ops(struct ath_hw *ah); -void ar9003_hw_attach_ops(struct ath_hw *ah); - -void ar9002_hw_load_ani_reg(struct ath_hw *ah, struct ath9k_channel *chan); - -void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning); -void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan); - -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT -static inline bool ath9k_hw_btcoex_is_enabled(struct ath_hw *ah) -{ - return ah->btcoex_hw.enabled; -} -static inline bool ath9k_hw_mci_is_enabled(struct ath_hw *ah) -{ - return ah->common.btcoex_enabled && - (ah->caps.hw_caps & ATH9K_HW_CAP_MCI); - -} -void ath9k_hw_btcoex_enable(struct ath_hw *ah); -static inline enum ath_btcoex_scheme -ath9k_hw_get_btcoex_scheme(struct ath_hw *ah) -{ - return ah->btcoex_hw.scheme; -} -#else -static inline bool ath9k_hw_btcoex_is_enabled(struct ath_hw *ah) -{ - return false; -} -static inline bool ath9k_hw_mci_is_enabled(struct ath_hw *ah) -{ - return false; -} -static inline void ath9k_hw_btcoex_enable(struct ath_hw *ah) -{ -} -static inline enum ath_btcoex_scheme -ath9k_hw_get_btcoex_scheme(struct ath_hw *ah) -{ - return ATH_BTCOEX_CFG_NONE; -} -#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ - - -#ifdef CONFIG_PM_SLEEP -const char *ath9k_hw_wow_event_to_string(u32 wow_event); -void ath9k_hw_wow_apply_pattern(struct ath_hw *ah, u8 *user_pattern, - u8 *user_mask, int pattern_count, - int pattern_len); -u32 ath9k_hw_wow_wakeup(struct ath_hw *ah); -void ath9k_hw_wow_enable(struct ath_hw *ah, u32 pattern_enable); -#else -static inline const char *ath9k_hw_wow_event_to_string(u32 wow_event) -{ - return NULL; -} -static inline void ath9k_hw_wow_apply_pattern(struct ath_hw *ah, - u8 *user_pattern, - u8 *user_mask, - int pattern_count, - int pattern_len) -{ -} -static inline u32 ath9k_hw_wow_wakeup(struct ath_hw *ah) -{ - return 0; -} -static inline void ath9k_hw_wow_enable(struct ath_hw *ah, u32 pattern_enable) -{ -} -#endif - - - -#define ATH9K_CLOCK_RATE_CCK 22 -#define ATH9K_CLOCK_RATE_5GHZ_OFDM 40 -#define ATH9K_CLOCK_RATE_2GHZ_OFDM 44 -#define ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM 44 - -#endif diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c deleted file mode 100644 index bd126c25a727..000000000000 --- a/drivers/net/wireless/ath/ath9k/init.c +++ /dev/null @@ -1,1011 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include - -#include "ath9k.h" - -struct ath9k_eeprom_ctx { - struct completion complete; - struct ath_hw *ah; -}; - -static char *dev_info = "ath9k"; - -MODULE_AUTHOR("Atheros Communications"); -MODULE_DESCRIPTION("Support for Atheros 802.11n wireless LAN cards."); -MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards"); -MODULE_LICENSE("Dual BSD/GPL"); - -static unsigned int ath9k_debug = ATH_DBG_DEFAULT; -module_param_named(debug, ath9k_debug, uint, 0); -MODULE_PARM_DESC(debug, "Debugging mask"); - -int ath9k_modparam_nohwcrypt; -module_param_named(nohwcrypt, ath9k_modparam_nohwcrypt, int, 0444); -MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption"); - -int led_blink; -module_param_named(blink, led_blink, int, 0444); -MODULE_PARM_DESC(blink, "Enable LED blink on activity"); - -static int ath9k_btcoex_enable; -module_param_named(btcoex_enable, ath9k_btcoex_enable, int, 0444); -MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence"); - -static int ath9k_enable_diversity; -module_param_named(enable_diversity, ath9k_enable_diversity, int, 0444); -MODULE_PARM_DESC(enable_diversity, "Enable Antenna diversity for AR9565"); - -bool is_ath9k_unloaded; -/* We use the hw_value as an index into our private channel structure */ - -#define CHAN2G(_freq, _idx) { \ - .band = IEEE80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_idx), \ - .max_power = 20, \ -} - -#define CHAN5G(_freq, _idx) { \ - .band = IEEE80211_BAND_5GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_idx), \ - .max_power = 20, \ -} - -/* Some 2 GHz radios are actually tunable on 2312-2732 - * on 5 MHz steps, we support the channels which we know - * we have calibration data for all cards though to make - * this static */ -static const struct ieee80211_channel ath9k_2ghz_chantable[] = { - CHAN2G(2412, 0), /* Channel 1 */ - CHAN2G(2417, 1), /* Channel 2 */ - CHAN2G(2422, 2), /* Channel 3 */ - CHAN2G(2427, 3), /* Channel 4 */ - CHAN2G(2432, 4), /* Channel 5 */ - CHAN2G(2437, 5), /* Channel 6 */ - CHAN2G(2442, 6), /* Channel 7 */ - CHAN2G(2447, 7), /* Channel 8 */ - CHAN2G(2452, 8), /* Channel 9 */ - CHAN2G(2457, 9), /* Channel 10 */ - CHAN2G(2462, 10), /* Channel 11 */ - CHAN2G(2467, 11), /* Channel 12 */ - CHAN2G(2472, 12), /* Channel 13 */ - CHAN2G(2484, 13), /* Channel 14 */ -}; - -/* Some 5 GHz radios are actually tunable on XXXX-YYYY - * on 5 MHz steps, we support the channels which we know - * we have calibration data for all cards though to make - * this static */ -static const struct ieee80211_channel ath9k_5ghz_chantable[] = { - /* _We_ call this UNII 1 */ - CHAN5G(5180, 14), /* Channel 36 */ - CHAN5G(5200, 15), /* Channel 40 */ - CHAN5G(5220, 16), /* Channel 44 */ - CHAN5G(5240, 17), /* Channel 48 */ - /* _We_ call this UNII 2 */ - CHAN5G(5260, 18), /* Channel 52 */ - CHAN5G(5280, 19), /* Channel 56 */ - CHAN5G(5300, 20), /* Channel 60 */ - CHAN5G(5320, 21), /* Channel 64 */ - /* _We_ call this "Middle band" */ - CHAN5G(5500, 22), /* Channel 100 */ - CHAN5G(5520, 23), /* Channel 104 */ - CHAN5G(5540, 24), /* Channel 108 */ - CHAN5G(5560, 25), /* Channel 112 */ - CHAN5G(5580, 26), /* Channel 116 */ - CHAN5G(5600, 27), /* Channel 120 */ - CHAN5G(5620, 28), /* Channel 124 */ - CHAN5G(5640, 29), /* Channel 128 */ - CHAN5G(5660, 30), /* Channel 132 */ - CHAN5G(5680, 31), /* Channel 136 */ - CHAN5G(5700, 32), /* Channel 140 */ - /* _We_ call this UNII 3 */ - CHAN5G(5745, 33), /* Channel 149 */ - CHAN5G(5765, 34), /* Channel 153 */ - CHAN5G(5785, 35), /* Channel 157 */ - CHAN5G(5805, 36), /* Channel 161 */ - CHAN5G(5825, 37), /* Channel 165 */ -}; - -/* Atheros hardware rate code addition for short premble */ -#define SHPCHECK(__hw_rate, __flags) \ - ((__flags & IEEE80211_RATE_SHORT_PREAMBLE) ? (__hw_rate | 0x04 ) : 0) - -#define RATE(_bitrate, _hw_rate, _flags) { \ - .bitrate = (_bitrate), \ - .flags = (_flags), \ - .hw_value = (_hw_rate), \ - .hw_value_short = (SHPCHECK(_hw_rate, _flags)) \ -} - -static struct ieee80211_rate ath9k_legacy_rates[] = { - RATE(10, 0x1b, 0), - RATE(20, 0x1a, IEEE80211_RATE_SHORT_PREAMBLE), - RATE(55, 0x19, IEEE80211_RATE_SHORT_PREAMBLE), - RATE(110, 0x18, IEEE80211_RATE_SHORT_PREAMBLE), - RATE(60, 0x0b, 0), - RATE(90, 0x0f, 0), - RATE(120, 0x0a, 0), - RATE(180, 0x0e, 0), - RATE(240, 0x09, 0), - RATE(360, 0x0d, 0), - RATE(480, 0x08, 0), - RATE(540, 0x0c, 0), -}; - -#ifdef CONFIG_MAC80211_LEDS -static const struct ieee80211_tpt_blink ath9k_tpt_blink[] = { - { .throughput = 0 * 1024, .blink_time = 334 }, - { .throughput = 1 * 1024, .blink_time = 260 }, - { .throughput = 5 * 1024, .blink_time = 220 }, - { .throughput = 10 * 1024, .blink_time = 190 }, - { .throughput = 20 * 1024, .blink_time = 170 }, - { .throughput = 50 * 1024, .blink_time = 150 }, - { .throughput = 70 * 1024, .blink_time = 130 }, - { .throughput = 100 * 1024, .blink_time = 110 }, - { .throughput = 200 * 1024, .blink_time = 80 }, - { .throughput = 300 * 1024, .blink_time = 50 }, -}; -#endif - -static void ath9k_deinit_softc(struct ath_softc *sc); - -/* - * Read and write, they both share the same lock. We do this to serialize - * reads and writes on Atheros 802.11n PCI devices only. This is required - * as the FIFO on these devices can only accept sanely 2 requests. - */ - -static void ath9k_iowrite32(void *hw_priv, u32 val, u32 reg_offset) -{ - struct ath_hw *ah = (struct ath_hw *) hw_priv; - struct ath_common *common = ath9k_hw_common(ah); - struct ath_softc *sc = (struct ath_softc *) common->priv; - - if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_ON) { - unsigned long flags; - spin_lock_irqsave(&sc->sc_serial_rw, flags); - iowrite32(val, sc->mem + reg_offset); - spin_unlock_irqrestore(&sc->sc_serial_rw, flags); - } else - iowrite32(val, sc->mem + reg_offset); -} - -static unsigned int ath9k_ioread32(void *hw_priv, u32 reg_offset) -{ - struct ath_hw *ah = (struct ath_hw *) hw_priv; - struct ath_common *common = ath9k_hw_common(ah); - struct ath_softc *sc = (struct ath_softc *) common->priv; - u32 val; - - if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_ON) { - unsigned long flags; - spin_lock_irqsave(&sc->sc_serial_rw, flags); - val = ioread32(sc->mem + reg_offset); - spin_unlock_irqrestore(&sc->sc_serial_rw, flags); - } else - val = ioread32(sc->mem + reg_offset); - return val; -} - -static unsigned int __ath9k_reg_rmw(struct ath_softc *sc, u32 reg_offset, - u32 set, u32 clr) -{ - u32 val; - - val = ioread32(sc->mem + reg_offset); - val &= ~clr; - val |= set; - iowrite32(val, sc->mem + reg_offset); - - return val; -} - -static unsigned int ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr) -{ - struct ath_hw *ah = (struct ath_hw *) hw_priv; - struct ath_common *common = ath9k_hw_common(ah); - struct ath_softc *sc = (struct ath_softc *) common->priv; - unsigned long uninitialized_var(flags); - u32 val; - - if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_ON) { - spin_lock_irqsave(&sc->sc_serial_rw, flags); - val = __ath9k_reg_rmw(sc, reg_offset, set, clr); - spin_unlock_irqrestore(&sc->sc_serial_rw, flags); - } else - val = __ath9k_reg_rmw(sc, reg_offset, set, clr); - - return val; -} - -/**************************/ -/* Initialization */ -/**************************/ - -static void setup_ht_cap(struct ath_softc *sc, - struct ieee80211_sta_ht_cap *ht_info) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - u8 tx_streams, rx_streams; - int i, max_streams; - - ht_info->ht_supported = true; - ht_info->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | - IEEE80211_HT_CAP_SM_PS | - IEEE80211_HT_CAP_SGI_40 | - IEEE80211_HT_CAP_DSSSCCK40; - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_LDPC) - ht_info->cap |= IEEE80211_HT_CAP_LDPC_CODING; - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_SGI_20) - ht_info->cap |= IEEE80211_HT_CAP_SGI_20; - - ht_info->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; - ht_info->ampdu_density = IEEE80211_HT_MPDU_DENSITY_8; - - if (AR_SREV_9330(ah) || AR_SREV_9485(ah) || AR_SREV_9565(ah)) - max_streams = 1; - else if (AR_SREV_9462(ah)) - max_streams = 2; - else if (AR_SREV_9300_20_OR_LATER(ah)) - max_streams = 3; - else - max_streams = 2; - - if (AR_SREV_9280_20_OR_LATER(ah)) { - if (max_streams >= 2) - ht_info->cap |= IEEE80211_HT_CAP_TX_STBC; - ht_info->cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT); - } - - /* set up supported mcs set */ - memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); - tx_streams = ath9k_cmn_count_streams(ah->txchainmask, max_streams); - rx_streams = ath9k_cmn_count_streams(ah->rxchainmask, max_streams); - - ath_dbg(common, CONFIG, "TX streams %d, RX streams: %d\n", - tx_streams, rx_streams); - - if (tx_streams != rx_streams) { - ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF; - ht_info->mcs.tx_params |= ((tx_streams - 1) << - IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT); - } - - for (i = 0; i < rx_streams; i++) - ht_info->mcs.rx_mask[i] = 0xff; - - ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED; -} - -static void ath9k_reg_notifier(struct wiphy *wiphy, - struct regulatory_request *request) -{ - struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_regulatory *reg = ath9k_hw_regulatory(ah); - - ath_reg_notifier_apply(wiphy, request, reg); - - /* Set tx power */ - if (ah->curchan) { - sc->config.txpowlimit = 2 * ah->curchan->chan->max_power; - ath9k_ps_wakeup(sc); - ath9k_hw_set_txpowerlimit(ah, sc->config.txpowlimit, false); - sc->curtxpow = ath9k_hw_regulatory(ah)->power_limit; - /* synchronize DFS detector if regulatory domain changed */ - if (sc->dfs_detector != NULL) - sc->dfs_detector->set_dfs_domain(sc->dfs_detector, - request->dfs_region); - ath9k_ps_restore(sc); - } -} - -/* - * This function will allocate both the DMA descriptor structure, and the - * buffers it contains. These are used to contain the descriptors used - * by the system. -*/ -int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, - struct list_head *head, const char *name, - int nbuf, int ndesc, bool is_tx) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - u8 *ds; - struct ath_buf *bf; - int i, bsize, desc_len; - - ath_dbg(common, CONFIG, "%s DMA: %u buffers %u desc/buf\n", - name, nbuf, ndesc); - - INIT_LIST_HEAD(head); - - if (is_tx) - desc_len = sc->sc_ah->caps.tx_desc_len; - else - desc_len = sizeof(struct ath_desc); - - /* ath_desc must be a multiple of DWORDs */ - if ((desc_len % 4) != 0) { - ath_err(common, "ath_desc not DWORD aligned\n"); - BUG_ON((desc_len % 4) != 0); - return -ENOMEM; - } - - dd->dd_desc_len = desc_len * nbuf * ndesc; - - /* - * Need additional DMA memory because we can't use - * descriptors that cross the 4K page boundary. Assume - * one skipped descriptor per 4K page. - */ - if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_4KB_SPLITTRANS)) { - u32 ndesc_skipped = - ATH_DESC_4KB_BOUND_NUM_SKIPPED(dd->dd_desc_len); - u32 dma_len; - - while (ndesc_skipped) { - dma_len = ndesc_skipped * desc_len; - dd->dd_desc_len += dma_len; - - ndesc_skipped = ATH_DESC_4KB_BOUND_NUM_SKIPPED(dma_len); - } - } - - /* allocate descriptors */ - dd->dd_desc = dmam_alloc_coherent(sc->dev, dd->dd_desc_len, - &dd->dd_desc_paddr, GFP_KERNEL); - if (!dd->dd_desc) - return -ENOMEM; - - ds = (u8 *) dd->dd_desc; - ath_dbg(common, CONFIG, "%s DMA map: %p (%u) -> %llx (%u)\n", - name, ds, (u32) dd->dd_desc_len, - ito64(dd->dd_desc_paddr), /*XXX*/(u32) dd->dd_desc_len); - - /* allocate buffers */ - bsize = sizeof(struct ath_buf) * nbuf; - bf = devm_kzalloc(sc->dev, bsize, GFP_KERNEL); - if (!bf) - return -ENOMEM; - - for (i = 0; i < nbuf; i++, bf++, ds += (desc_len * ndesc)) { - bf->bf_desc = ds; - bf->bf_daddr = DS2PHYS(dd, ds); - - if (!(sc->sc_ah->caps.hw_caps & - ATH9K_HW_CAP_4KB_SPLITTRANS)) { - /* - * Skip descriptor addresses which can cause 4KB - * boundary crossing (addr + length) with a 32 dword - * descriptor fetch. - */ - while (ATH_DESC_4KB_BOUND_CHECK(bf->bf_daddr)) { - BUG_ON((caddr_t) bf->bf_desc >= - ((caddr_t) dd->dd_desc + - dd->dd_desc_len)); - - ds += (desc_len * ndesc); - bf->bf_desc = ds; - bf->bf_daddr = DS2PHYS(dd, ds); - } - } - list_add_tail(&bf->list, head); - } - return 0; -} - -static int ath9k_init_queues(struct ath_softc *sc) -{ - int i = 0; - - sc->beacon.beaconq = ath9k_hw_beaconq_setup(sc->sc_ah); - sc->beacon.cabq = ath_txq_setup(sc, ATH9K_TX_QUEUE_CAB, 0); - - sc->config.cabqReadytime = ATH_CABQ_READY_TIME; - ath_cabq_update(sc); - - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - sc->tx.txq_map[i] = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, i); - sc->tx.txq_map[i]->mac80211_qnum = i; - sc->tx.txq_max_pending[i] = ATH_MAX_QDEPTH; - } - return 0; -} - -static int ath9k_init_channels_rates(struct ath_softc *sc) -{ - void *channels; - - BUILD_BUG_ON(ARRAY_SIZE(ath9k_2ghz_chantable) + - ARRAY_SIZE(ath9k_5ghz_chantable) != - ATH9K_NUM_CHANNELS); - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) { - channels = devm_kzalloc(sc->dev, - sizeof(ath9k_2ghz_chantable), GFP_KERNEL); - if (!channels) - return -ENOMEM; - - memcpy(channels, ath9k_2ghz_chantable, - sizeof(ath9k_2ghz_chantable)); - sc->sbands[IEEE80211_BAND_2GHZ].channels = channels; - sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; - sc->sbands[IEEE80211_BAND_2GHZ].n_channels = - ARRAY_SIZE(ath9k_2ghz_chantable); - sc->sbands[IEEE80211_BAND_2GHZ].bitrates = ath9k_legacy_rates; - sc->sbands[IEEE80211_BAND_2GHZ].n_bitrates = - ARRAY_SIZE(ath9k_legacy_rates); - } - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) { - channels = devm_kzalloc(sc->dev, - sizeof(ath9k_5ghz_chantable), GFP_KERNEL); - if (!channels) - return -ENOMEM; - - memcpy(channels, ath9k_5ghz_chantable, - sizeof(ath9k_5ghz_chantable)); - sc->sbands[IEEE80211_BAND_5GHZ].channels = channels; - sc->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ; - sc->sbands[IEEE80211_BAND_5GHZ].n_channels = - ARRAY_SIZE(ath9k_5ghz_chantable); - sc->sbands[IEEE80211_BAND_5GHZ].bitrates = - ath9k_legacy_rates + 4; - sc->sbands[IEEE80211_BAND_5GHZ].n_bitrates = - ARRAY_SIZE(ath9k_legacy_rates) - 4; - } - return 0; -} - -static void ath9k_init_misc(struct ath_softc *sc) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - int i = 0; - - setup_timer(&common->ani.timer, ath_ani_calibrate, (unsigned long)sc); - - sc->last_rssi = ATH_RSSI_DUMMY_MARKER; - sc->config.txpowlimit = ATH_TXPOWER_MAX; - memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN); - sc->beacon.slottime = ATH9K_SLOT_TIME_9; - - for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) - sc->beacon.bslot[i] = NULL; - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) - sc->ant_comb.count = ATH_ANT_DIV_COMB_INIT_COUNT; - - sc->spec_config.enabled = 0; - sc->spec_config.short_repeat = true; - sc->spec_config.count = 8; - sc->spec_config.endless = false; - sc->spec_config.period = 0xFF; - sc->spec_config.fft_period = 0xF; -} - -static void ath9k_eeprom_request_cb(const struct firmware *eeprom_blob, - void *ctx) -{ - struct ath9k_eeprom_ctx *ec = ctx; - - if (eeprom_blob) - ec->ah->eeprom_blob = eeprom_blob; - - complete(&ec->complete); -} - -static int ath9k_eeprom_request(struct ath_softc *sc, const char *name) -{ - struct ath9k_eeprom_ctx ec; - struct ath_hw *ah = ah = sc->sc_ah; - int err; - - /* try to load the EEPROM content asynchronously */ - init_completion(&ec.complete); - ec.ah = sc->sc_ah; - - err = request_firmware_nowait(THIS_MODULE, 1, name, sc->dev, GFP_KERNEL, - &ec, ath9k_eeprom_request_cb); - if (err < 0) { - ath_err(ath9k_hw_common(ah), - "EEPROM request failed\n"); - return err; - } - - wait_for_completion(&ec.complete); - - if (!ah->eeprom_blob) { - ath_err(ath9k_hw_common(ah), - "Unable to load EEPROM file %s\n", name); - return -EINVAL; - } - - return 0; -} - -static void ath9k_eeprom_release(struct ath_softc *sc) -{ - release_firmware(sc->sc_ah->eeprom_blob); -} - -static int ath9k_init_softc(u16 devid, struct ath_softc *sc, - const struct ath_bus_ops *bus_ops) -{ - struct ath9k_platform_data *pdata = sc->dev->platform_data; - struct ath_hw *ah = NULL; - struct ath_common *common; - int ret = 0, i; - int csz = 0; - - ah = devm_kzalloc(sc->dev, sizeof(struct ath_hw), GFP_KERNEL); - if (!ah) - return -ENOMEM; - - ah->dev = sc->dev; - ah->hw = sc->hw; - ah->hw_version.devid = devid; - ah->reg_ops.read = ath9k_ioread32; - ah->reg_ops.write = ath9k_iowrite32; - ah->reg_ops.rmw = ath9k_reg_rmw; - atomic_set(&ah->intr_ref_cnt, -1); - sc->sc_ah = ah; - - sc->dfs_detector = dfs_pattern_detector_init(ah, NL80211_DFS_UNSET); - - if (!pdata) { - ah->ah_flags |= AH_USE_EEPROM; - sc->sc_ah->led_pin = -1; - } else { - sc->sc_ah->gpio_mask = pdata->gpio_mask; - sc->sc_ah->gpio_val = pdata->gpio_val; - sc->sc_ah->led_pin = pdata->led_pin; - ah->is_clk_25mhz = pdata->is_clk_25mhz; - ah->get_mac_revision = pdata->get_mac_revision; - ah->external_reset = pdata->external_reset; - } - - common = ath9k_hw_common(ah); - common->ops = &ah->reg_ops; - common->bus_ops = bus_ops; - common->ah = ah; - common->hw = sc->hw; - common->priv = sc; - common->debug_mask = ath9k_debug; - common->btcoex_enabled = ath9k_btcoex_enable == 1; - common->disable_ani = false; - - /* - * Enable Antenna diversity only when BTCOEX is disabled - * and the user manually requests the feature. - */ - if (!common->btcoex_enabled && ath9k_enable_diversity) - common->antenna_diversity = 1; - - spin_lock_init(&common->cc_lock); - - spin_lock_init(&sc->sc_serial_rw); - spin_lock_init(&sc->sc_pm_lock); - mutex_init(&sc->mutex); -#ifdef CONFIG_ATH9K_MAC_DEBUG - spin_lock_init(&sc->debug.samp_lock); -#endif - tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc); - tasklet_init(&sc->bcon_tasklet, ath9k_beacon_tasklet, - (unsigned long)sc); - - INIT_WORK(&sc->hw_reset_work, ath_reset_work); - INIT_WORK(&sc->hw_check_work, ath_hw_check); - INIT_WORK(&sc->paprd_work, ath_paprd_calibrate); - INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work); - setup_timer(&sc->rx_poll_timer, ath_rx_poll, (unsigned long)sc); - - /* - * Cache line size is used to size and align various - * structures used to communicate with the hardware. - */ - ath_read_cachesize(common, &csz); - common->cachelsz = csz << 2; /* convert to bytes */ - - if (pdata && pdata->eeprom_name) { - ret = ath9k_eeprom_request(sc, pdata->eeprom_name); - if (ret) - return ret; - } - - /* Initializes the hardware for all supported chipsets */ - ret = ath9k_hw_init(ah); - if (ret) - goto err_hw; - - if (pdata && pdata->macaddr) - memcpy(common->macaddr, pdata->macaddr, ETH_ALEN); - - ret = ath9k_init_queues(sc); - if (ret) - goto err_queues; - - ret = ath9k_init_btcoex(sc); - if (ret) - goto err_btcoex; - - ret = ath9k_init_channels_rates(sc); - if (ret) - goto err_btcoex; - - ath9k_cmn_init_crypto(sc->sc_ah); - ath9k_init_misc(sc); - ath_fill_led_pin(sc); - - if (common->bus_ops->aspm_init) - common->bus_ops->aspm_init(common); - - return 0; - -err_btcoex: - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) - if (ATH_TXQ_SETUP(sc, i)) - ath_tx_cleanupq(sc, &sc->tx.txq[i]); -err_queues: - ath9k_hw_deinit(ah); -err_hw: - ath9k_eeprom_release(sc); - return ret; -} - -static void ath9k_init_band_txpower(struct ath_softc *sc, int band) -{ - struct ieee80211_supported_band *sband; - struct ieee80211_channel *chan; - struct ath_hw *ah = sc->sc_ah; - int i; - - sband = &sc->sbands[band]; - for (i = 0; i < sband->n_channels; i++) { - chan = &sband->channels[i]; - ah->curchan = &ah->channels[chan->hw_value]; - ath9k_cmn_update_ichannel(ah->curchan, chan, NL80211_CHAN_HT20); - ath9k_hw_set_txpowerlimit(ah, MAX_RATE_POWER, true); - } -} - -static void ath9k_init_txpower_limits(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath9k_channel *curchan = ah->curchan; - - if (ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) - ath9k_init_band_txpower(sc, IEEE80211_BAND_2GHZ); - if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) - ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ); - - ah->curchan = curchan; -} - -void ath9k_reload_chainmask_settings(struct ath_softc *sc) -{ - if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)) - return; - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) - setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap); - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) - setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap); -} - -static const struct ieee80211_iface_limit if_limits[] = { - { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_WDS) }, - { .max = 8, .types = -#ifdef CONFIG_MAC80211_MESH - BIT(NL80211_IFTYPE_MESH_POINT) | -#endif - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_P2P_GO) }, -}; - - -static const struct ieee80211_iface_limit if_dfs_limits[] = { - { .max = 1, .types = BIT(NL80211_IFTYPE_AP) }, -}; - -static const struct ieee80211_iface_combination if_comb[] = { - { - .limits = if_limits, - .n_limits = ARRAY_SIZE(if_limits), - .max_interfaces = 2048, - .num_different_channels = 1, - .beacon_int_infra_match = true, - }, - { - .limits = if_dfs_limits, - .n_limits = ARRAY_SIZE(if_dfs_limits), - .max_interfaces = 1, - .num_different_channels = 1, - .beacon_int_infra_match = true, - .radar_detect_widths = BIT(NL80211_CHAN_NO_HT) | - BIT(NL80211_CHAN_HT20), - } -}; - -void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - - hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_PS_NULLFUNC_STACK | - IEEE80211_HW_SPECTRUM_MGMT | - IEEE80211_HW_REPORTS_TX_ACK_STATUS | - IEEE80211_HW_SUPPORTS_RC_TABLE | - IEEE80211_HW_SUPPORTS_HT_CCK_RATES; - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) - hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION; - - if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || ath9k_modparam_nohwcrypt) - hw->flags |= IEEE80211_HW_MFP_CAPABLE; - - hw->wiphy->interface_modes = - BIT(NL80211_IFTYPE_P2P_GO) | - BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_WDS) | - BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_MESH_POINT); - - hw->wiphy->iface_combinations = if_comb; - hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); - - hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; - - hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; - hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; - hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; - -#ifdef CONFIG_PM_SLEEP - - if ((ah->caps.hw_caps & ATH9K_HW_WOW_DEVICE_CAPABLE) && - device_can_wakeup(sc->dev)) { - - hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | - WIPHY_WOWLAN_DISCONNECT; - hw->wiphy->wowlan.n_patterns = MAX_NUM_USER_PATTERN; - hw->wiphy->wowlan.pattern_min_len = 1; - hw->wiphy->wowlan.pattern_max_len = MAX_PATTERN_SIZE; - - } - - atomic_set(&sc->wow_sleep_proc_intr, -1); - atomic_set(&sc->wow_got_bmiss_intr, -1); - -#endif - - hw->queues = 4; - hw->max_rates = 4; - hw->channel_change_time = 5000; - hw->max_listen_interval = 1; - hw->max_rate_tries = 10; - hw->sta_data_size = sizeof(struct ath_node); - hw->vif_data_size = sizeof(struct ath_vif); - - hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1; - hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1; - - /* single chain devices with rx diversity */ - if (ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) - hw->wiphy->available_antennas_rx = BIT(0) | BIT(1); - - sc->ant_rx = hw->wiphy->available_antennas_rx; - sc->ant_tx = hw->wiphy->available_antennas_tx; - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = - &sc->sbands[IEEE80211_BAND_2GHZ]; - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) - hw->wiphy->bands[IEEE80211_BAND_5GHZ] = - &sc->sbands[IEEE80211_BAND_5GHZ]; - - ath9k_reload_chainmask_settings(sc); - - SET_IEEE80211_PERM_ADDR(hw, common->macaddr); -} - -int ath9k_init_device(u16 devid, struct ath_softc *sc, - const struct ath_bus_ops *bus_ops) -{ - struct ieee80211_hw *hw = sc->hw; - struct ath_common *common; - struct ath_hw *ah; - int error = 0; - struct ath_regulatory *reg; - - /* Bring up device */ - error = ath9k_init_softc(devid, sc, bus_ops); - if (error) - return error; - - ah = sc->sc_ah; - common = ath9k_hw_common(ah); - ath9k_set_hw_capab(sc, hw); - - /* Initialize regulatory */ - error = ath_regd_init(&common->regulatory, sc->hw->wiphy, - ath9k_reg_notifier); - if (error) - goto deinit; - - reg = &common->regulatory; - - /* Setup TX DMA */ - error = ath_tx_init(sc, ATH_TXBUF); - if (error != 0) - goto deinit; - - /* Setup RX DMA */ - error = ath_rx_init(sc, ATH_RXBUF); - if (error != 0) - goto deinit; - - ath9k_init_txpower_limits(sc); - -#ifdef CONFIG_MAC80211_LEDS - /* must be initialized before ieee80211_register_hw */ - sc->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(sc->hw, - IEEE80211_TPT_LEDTRIG_FL_RADIO, ath9k_tpt_blink, - ARRAY_SIZE(ath9k_tpt_blink)); -#endif - - /* Register with mac80211 */ - error = ieee80211_register_hw(hw); - if (error) - goto rx_cleanup; - - error = ath9k_init_debug(ah); - if (error) { - ath_err(common, "Unable to create debugfs files\n"); - goto unregister; - } - - /* Handle world regulatory */ - if (!ath_is_world_regd(reg)) { - error = regulatory_hint(hw->wiphy, reg->alpha2); - if (error) - goto debug_cleanup; - } - - ath_init_leds(sc); - ath_start_rfkill_poll(sc); - - return 0; - -debug_cleanup: - ath9k_deinit_debug(sc); -unregister: - ieee80211_unregister_hw(hw); -rx_cleanup: - ath_rx_cleanup(sc); -deinit: - ath9k_deinit_softc(sc); - return error; -} - -/*****************************/ -/* De-Initialization */ -/*****************************/ - -static void ath9k_deinit_softc(struct ath_softc *sc) -{ - int i = 0; - - ath9k_deinit_btcoex(sc); - - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) - if (ATH_TXQ_SETUP(sc, i)) - ath_tx_cleanupq(sc, &sc->tx.txq[i]); - - ath9k_hw_deinit(sc->sc_ah); - if (sc->dfs_detector != NULL) - sc->dfs_detector->exit(sc->dfs_detector); - - ath9k_eeprom_release(sc); -} - -void ath9k_deinit_device(struct ath_softc *sc) -{ - struct ieee80211_hw *hw = sc->hw; - - ath9k_ps_wakeup(sc); - - wiphy_rfkill_stop_polling(sc->hw->wiphy); - ath_deinit_leds(sc); - - ath9k_ps_restore(sc); - - ath9k_deinit_debug(sc); - ieee80211_unregister_hw(hw); - ath_rx_cleanup(sc); - ath9k_deinit_softc(sc); -} - -/************************/ -/* Module Hooks */ -/************************/ - -static int __init ath9k_init(void) -{ - int error; - - /* Register rate control algorithm */ - error = ath_rate_control_register(); - if (error != 0) { - pr_err("Unable to register rate control algorithm: %d\n", - error); - goto err_out; - } - - error = ath_pci_init(); - if (error < 0) { - pr_err("No PCI devices found, driver not installed\n"); - error = -ENODEV; - goto err_rate_unregister; - } - - error = ath_ahb_init(); - if (error < 0) { - error = -ENODEV; - goto err_pci_exit; - } - - return 0; - - err_pci_exit: - ath_pci_exit(); - - err_rate_unregister: - ath_rate_control_unregister(); - err_out: - return error; -} -module_init(ath9k_init); - -static void __exit ath9k_exit(void) -{ - is_ath9k_unloaded = true; - ath_ahb_exit(); - ath_pci_exit(); - ath_rate_control_unregister(); - pr_info("%s: Driver unloaded\n", dev_info); -} -module_exit(ath9k_exit); diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c deleted file mode 100644 index 849259b07370..000000000000 --- a/drivers/net/wireless/ath/ath9k/link.c +++ /dev/null @@ -1,571 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "ath9k.h" - -/* - * TX polling - checks if the TX engine is stuck somewhere - * and issues a chip reset if so. - */ -void ath_tx_complete_poll_work(struct work_struct *work) -{ - struct ath_softc *sc = container_of(work, struct ath_softc, - tx_complete_work.work); - struct ath_txq *txq; - int i; - bool needreset = false; - - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - txq = sc->tx.txq_map[i]; - - ath_txq_lock(sc, txq); - if (txq->axq_depth) { - if (txq->axq_tx_inprogress) { - needreset = true; - ath_txq_unlock(sc, txq); - break; - } else { - txq->axq_tx_inprogress = true; - } - } - ath_txq_unlock_complete(sc, txq); - } - - if (needreset) { - ath_dbg(ath9k_hw_common(sc->sc_ah), RESET, - "tx hung, resetting the chip\n"); - ath9k_queue_reset(sc, RESET_TYPE_TX_HANG); - return; - } - - ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, - msecs_to_jiffies(ATH_TX_COMPLETE_POLL_INT)); -} - -/* - * Checks if the BB/MAC is hung. - */ -void ath_hw_check(struct work_struct *work) -{ - struct ath_softc *sc = container_of(work, struct ath_softc, hw_check_work); - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - unsigned long flags; - int busy; - u8 is_alive, nbeacon = 1; - enum ath_reset_type type; - - ath9k_ps_wakeup(sc); - is_alive = ath9k_hw_check_alive(sc->sc_ah); - - if (is_alive && !AR_SREV_9300(sc->sc_ah)) - goto out; - else if (!is_alive && AR_SREV_9300(sc->sc_ah)) { - ath_dbg(common, RESET, - "DCU stuck is detected. Schedule chip reset\n"); - type = RESET_TYPE_MAC_HANG; - goto sched_reset; - } - - spin_lock_irqsave(&common->cc_lock, flags); - busy = ath_update_survey_stats(sc); - spin_unlock_irqrestore(&common->cc_lock, flags); - - ath_dbg(common, RESET, "Possible baseband hang, busy=%d (try %d)\n", - busy, sc->hw_busy_count + 1); - if (busy >= 99) { - if (++sc->hw_busy_count >= 3) { - type = RESET_TYPE_BB_HANG; - goto sched_reset; - } - } else if (busy >= 0) { - sc->hw_busy_count = 0; - nbeacon = 3; - } - - ath_start_rx_poll(sc, nbeacon); - goto out; - -sched_reset: - ath9k_queue_reset(sc, type); -out: - ath9k_ps_restore(sc); -} - -/* - * PLL-WAR for AR9485/AR9340 - */ -static bool ath_hw_pll_rx_hang_check(struct ath_softc *sc, u32 pll_sqsum) -{ - static int count; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - - if (pll_sqsum >= 0x40000) { - count++; - if (count == 3) { - ath_dbg(common, RESET, "PLL WAR, resetting the chip\n"); - ath9k_queue_reset(sc, RESET_TYPE_PLL_HANG); - count = 0; - return true; - } - } else { - count = 0; - } - - return false; -} - -void ath_hw_pll_work(struct work_struct *work) -{ - u32 pll_sqsum; - struct ath_softc *sc = container_of(work, struct ath_softc, - hw_pll_work.work); - /* - * ensure that the PLL WAR is executed only - * after the STA is associated (or) if the - * beaconing had started in interfaces that - * uses beacons. - */ - if (!test_bit(SC_OP_BEACONS, &sc->sc_flags)) - return; - - ath9k_ps_wakeup(sc); - pll_sqsum = ar9003_get_pll_sqsum_dvc(sc->sc_ah); - ath9k_ps_restore(sc); - if (ath_hw_pll_rx_hang_check(sc, pll_sqsum)) - return; - - ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work, - msecs_to_jiffies(ATH_PLL_WORK_INTERVAL)); -} - -/* - * RX Polling - monitors baseband hangs. - */ -void ath_start_rx_poll(struct ath_softc *sc, u8 nbeacon) -{ - if (!AR_SREV_9300(sc->sc_ah)) - return; - - if (!test_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags)) - return; - - mod_timer(&sc->rx_poll_timer, jiffies + msecs_to_jiffies - (nbeacon * sc->cur_beacon_conf.beacon_interval)); -} - -void ath_rx_poll(unsigned long data) -{ - struct ath_softc *sc = (struct ath_softc *)data; - - if (!test_bit(SC_OP_INVALID, &sc->sc_flags)) - ieee80211_queue_work(sc->hw, &sc->hw_check_work); -} - -/* - * PA Pre-distortion. - */ -static void ath_paprd_activate(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_cal_data *caldata = ah->caldata; - int chain; - - if (!caldata || !caldata->paprd_done) { - ath_dbg(common, CALIBRATE, "Failed to activate PAPRD\n"); - return; - } - - ar9003_paprd_enable(ah, false); - for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { - if (!(ah->txchainmask & BIT(chain))) - continue; - - ar9003_paprd_populate_single_table(ah, caldata, chain); - } - - ath_dbg(common, CALIBRATE, "Activating PAPRD\n"); - ar9003_paprd_enable(ah, true); -} - -static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int chain) -{ - struct ieee80211_hw *hw = sc->hw; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath_tx_control txctl; - int time_left; - - memset(&txctl, 0, sizeof(txctl)); - txctl.txq = sc->tx.txq_map[IEEE80211_AC_BE]; - - memset(tx_info, 0, sizeof(*tx_info)); - tx_info->band = hw->conf.chandef.chan->band; - tx_info->flags |= IEEE80211_TX_CTL_NO_ACK; - tx_info->control.rates[0].idx = 0; - tx_info->control.rates[0].count = 1; - tx_info->control.rates[0].flags = IEEE80211_TX_RC_MCS; - tx_info->control.rates[1].idx = -1; - - init_completion(&sc->paprd_complete); - txctl.paprd = BIT(chain); - - if (ath_tx_start(hw, skb, &txctl) != 0) { - ath_dbg(common, CALIBRATE, "PAPRD TX failed\n"); - dev_kfree_skb_any(skb); - return false; - } - - time_left = wait_for_completion_timeout(&sc->paprd_complete, - msecs_to_jiffies(ATH_PAPRD_TIMEOUT)); - - if (!time_left) - ath_dbg(common, CALIBRATE, - "Timeout waiting for paprd training on TX chain %d\n", - chain); - - return !!time_left; -} - -void ath_paprd_calibrate(struct work_struct *work) -{ - struct ath_softc *sc = container_of(work, struct ath_softc, paprd_work); - struct ieee80211_hw *hw = sc->hw; - struct ath_hw *ah = sc->sc_ah; - struct ieee80211_hdr *hdr; - struct sk_buff *skb = NULL; - struct ath9k_hw_cal_data *caldata = ah->caldata; - struct ath_common *common = ath9k_hw_common(ah); - int ftype; - int chain_ok = 0; - int chain; - int len = 1800; - int ret; - - if (!caldata || !caldata->paprd_packet_sent || caldata->paprd_done) { - ath_dbg(common, CALIBRATE, "Skipping PAPRD calibration\n"); - return; - } - - ath9k_ps_wakeup(sc); - - if (ar9003_paprd_init_table(ah) < 0) - goto fail_paprd; - - skb = alloc_skb(len, GFP_KERNEL); - if (!skb) - goto fail_paprd; - - skb_put(skb, len); - memset(skb->data, 0, len); - hdr = (struct ieee80211_hdr *)skb->data; - ftype = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC; - hdr->frame_control = cpu_to_le16(ftype); - hdr->duration_id = cpu_to_le16(10); - memcpy(hdr->addr1, hw->wiphy->perm_addr, ETH_ALEN); - memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN); - memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN); - - for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { - if (!(ah->txchainmask & BIT(chain))) - continue; - - chain_ok = 0; - ar9003_paprd_setup_gain_table(ah, chain); - - ath_dbg(common, CALIBRATE, - "Sending PAPRD training frame on chain %d\n", chain); - if (!ath_paprd_send_frame(sc, skb, chain)) - goto fail_paprd; - - if (!ar9003_paprd_is_done(ah)) { - ath_dbg(common, CALIBRATE, - "PAPRD not yet done on chain %d\n", chain); - break; - } - - ret = ar9003_paprd_create_curve(ah, caldata, chain); - if (ret == -EINPROGRESS) { - ath_dbg(common, CALIBRATE, - "PAPRD curve on chain %d needs to be re-trained\n", - chain); - break; - } else if (ret) { - ath_dbg(common, CALIBRATE, - "PAPRD create curve failed on chain %d\n", - chain); - break; - } - - chain_ok = 1; - } - kfree_skb(skb); - - if (chain_ok) { - caldata->paprd_done = true; - ath_paprd_activate(sc); - } - -fail_paprd: - ath9k_ps_restore(sc); -} - -/* - * ANI performs periodic noise floor calibration - * that is used to adjust and optimize the chip performance. This - * takes environmental changes (location, temperature) into account. - * When the task is complete, it reschedules itself depending on the - * appropriate interval that was calculated. - */ -void ath_ani_calibrate(unsigned long data) -{ - struct ath_softc *sc = (struct ath_softc *)data; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - bool longcal = false; - bool shortcal = false; - bool aniflag = false; - unsigned int timestamp = jiffies_to_msecs(jiffies); - u32 cal_interval, short_cal_interval, long_cal_interval; - unsigned long flags; - - if (ah->caldata && ah->caldata->nfcal_interference) - long_cal_interval = ATH_LONG_CALINTERVAL_INT; - else - long_cal_interval = ATH_LONG_CALINTERVAL; - - short_cal_interval = (ah->opmode == NL80211_IFTYPE_AP) ? - ATH_AP_SHORT_CALINTERVAL : ATH_STA_SHORT_CALINTERVAL; - - /* Only calibrate if awake */ - if (sc->sc_ah->power_mode != ATH9K_PM_AWAKE) { - if (++ah->ani_skip_count >= ATH_ANI_MAX_SKIP_COUNT) { - spin_lock_irqsave(&sc->sc_pm_lock, flags); - sc->ps_flags |= PS_WAIT_FOR_ANI; - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - } - goto set_timer; - } - ah->ani_skip_count = 0; - spin_lock_irqsave(&sc->sc_pm_lock, flags); - sc->ps_flags &= ~PS_WAIT_FOR_ANI; - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - - ath9k_ps_wakeup(sc); - - /* Long calibration runs independently of short calibration. */ - if ((timestamp - common->ani.longcal_timer) >= long_cal_interval) { - longcal = true; - common->ani.longcal_timer = timestamp; - } - - /* Short calibration applies only while caldone is false */ - if (!common->ani.caldone) { - if ((timestamp - common->ani.shortcal_timer) >= short_cal_interval) { - shortcal = true; - common->ani.shortcal_timer = timestamp; - common->ani.resetcal_timer = timestamp; - } - } else { - if ((timestamp - common->ani.resetcal_timer) >= - ATH_RESTART_CALINTERVAL) { - common->ani.caldone = ath9k_hw_reset_calvalid(ah); - if (common->ani.caldone) - common->ani.resetcal_timer = timestamp; - } - } - - /* Verify whether we must check ANI */ - if (sc->sc_ah->config.enable_ani - && (timestamp - common->ani.checkani_timer) >= - ah->config.ani_poll_interval) { - aniflag = true; - common->ani.checkani_timer = timestamp; - } - - /* Call ANI routine if necessary */ - if (aniflag) { - spin_lock_irqsave(&common->cc_lock, flags); - ath9k_hw_ani_monitor(ah, ah->curchan); - ath_update_survey_stats(sc); - spin_unlock_irqrestore(&common->cc_lock, flags); - } - - /* Perform calibration if necessary */ - if (longcal || shortcal) { - common->ani.caldone = - ath9k_hw_calibrate(ah, ah->curchan, - ah->rxchainmask, longcal); - } - - ath_dbg(common, ANI, - "Calibration @%lu finished: %s %s %s, caldone: %s\n", - jiffies, - longcal ? "long" : "", shortcal ? "short" : "", - aniflag ? "ani" : "", common->ani.caldone ? "true" : "false"); - - ath9k_debug_samp_bb_mac(sc); - ath9k_ps_restore(sc); - -set_timer: - /* - * Set timer interval based on previous results. - * The interval must be the shortest necessary to satisfy ANI, - * short calibration and long calibration. - */ - cal_interval = ATH_LONG_CALINTERVAL; - if (sc->sc_ah->config.enable_ani) - cal_interval = min(cal_interval, - (u32)ah->config.ani_poll_interval); - if (!common->ani.caldone) - cal_interval = min(cal_interval, (u32)short_cal_interval); - - mod_timer(&common->ani.timer, jiffies + msecs_to_jiffies(cal_interval)); - - if (ar9003_is_paprd_enabled(ah) && ah->caldata) { - if (!ah->caldata->paprd_done) { - ieee80211_queue_work(sc->hw, &sc->paprd_work); - } else if (!ah->paprd_table_write_done) { - ath9k_ps_wakeup(sc); - ath_paprd_activate(sc); - ath9k_ps_restore(sc); - } - } -} - -void ath_start_ani(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - unsigned long timestamp = jiffies_to_msecs(jiffies); - - if (common->disable_ani || - !test_bit(SC_OP_ANI_RUN, &sc->sc_flags) || - (sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) - return; - - common->ani.longcal_timer = timestamp; - common->ani.shortcal_timer = timestamp; - common->ani.checkani_timer = timestamp; - - ath_dbg(common, ANI, "Starting ANI\n"); - mod_timer(&common->ani.timer, - jiffies + msecs_to_jiffies((u32)ah->config.ani_poll_interval)); -} - -void ath_stop_ani(struct ath_softc *sc) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - - ath_dbg(common, ANI, "Stopping ANI\n"); - del_timer_sync(&common->ani.timer); -} - -void ath_check_ani(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_beacon_config *cur_conf = &sc->cur_beacon_conf; - - /* - * Check for the various conditions in which ANI has to - * be stopped. - */ - if (ah->opmode == NL80211_IFTYPE_ADHOC) { - if (!cur_conf->enable_beacon) - goto stop_ani; - } else if (ah->opmode == NL80211_IFTYPE_AP) { - if (!cur_conf->enable_beacon) { - /* - * Disable ANI only when there are no - * associated stations. - */ - if (!test_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags)) - goto stop_ani; - } - } else if (ah->opmode == NL80211_IFTYPE_STATION) { - if (!test_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags)) - goto stop_ani; - } - - if (!test_bit(SC_OP_ANI_RUN, &sc->sc_flags)) { - set_bit(SC_OP_ANI_RUN, &sc->sc_flags); - ath_start_ani(sc); - } - - return; - -stop_ani: - clear_bit(SC_OP_ANI_RUN, &sc->sc_flags); - ath_stop_ani(sc); -} - -void ath_update_survey_nf(struct ath_softc *sc, int channel) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath9k_channel *chan = &ah->channels[channel]; - struct survey_info *survey = &sc->survey[channel]; - - if (chan->noisefloor) { - survey->filled |= SURVEY_INFO_NOISE_DBM; - survey->noise = ath9k_hw_getchan_noise(ah, chan); - } -} - -/* - * Updates the survey statistics and returns the busy time since last - * update in %, if the measurement duration was long enough for the - * result to be useful, -1 otherwise. - */ -int ath_update_survey_stats(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - int pos = ah->curchan - &ah->channels[0]; - struct survey_info *survey = &sc->survey[pos]; - struct ath_cycle_counters *cc = &common->cc_survey; - unsigned int div = common->clockrate * 1000; - int ret = 0; - - if (!ah->curchan) - return -1; - - if (ah->power_mode == ATH9K_PM_AWAKE) - ath_hw_cycle_counters_update(common); - - if (cc->cycles > 0) { - survey->filled |= SURVEY_INFO_CHANNEL_TIME | - SURVEY_INFO_CHANNEL_TIME_BUSY | - SURVEY_INFO_CHANNEL_TIME_RX | - SURVEY_INFO_CHANNEL_TIME_TX; - survey->channel_time += cc->cycles / div; - survey->channel_time_busy += cc->rx_busy / div; - survey->channel_time_rx += cc->rx_frame / div; - survey->channel_time_tx += cc->tx_frame / div; - } - - if (cc->cycles < div) - return -1; - - if (cc->cycles > 0) - ret = cc->rx_busy * 100 / cc->cycles; - - memset(cc, 0, sizeof(*cc)); - - ath_update_survey_nf(sc, pos); - - return ret; -} diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c deleted file mode 100644 index 566109a40fb3..000000000000 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ /dev/null @@ -1,939 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "hw.h" -#include "hw-ops.h" -#include - -static void ath9k_hw_set_txq_interrupts(struct ath_hw *ah, - struct ath9k_tx_queue_info *qi) -{ - ath_dbg(ath9k_hw_common(ah), INTERRUPT, - "tx ok 0x%x err 0x%x desc 0x%x eol 0x%x urn 0x%x\n", - ah->txok_interrupt_mask, ah->txerr_interrupt_mask, - ah->txdesc_interrupt_mask, ah->txeol_interrupt_mask, - ah->txurn_interrupt_mask); - - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_IMR_S0, - SM(ah->txok_interrupt_mask, AR_IMR_S0_QCU_TXOK) - | SM(ah->txdesc_interrupt_mask, AR_IMR_S0_QCU_TXDESC)); - REG_WRITE(ah, AR_IMR_S1, - SM(ah->txerr_interrupt_mask, AR_IMR_S1_QCU_TXERR) - | SM(ah->txeol_interrupt_mask, AR_IMR_S1_QCU_TXEOL)); - - ah->imrs2_reg &= ~AR_IMR_S2_QCU_TXURN; - ah->imrs2_reg |= (ah->txurn_interrupt_mask & AR_IMR_S2_QCU_TXURN); - REG_WRITE(ah, AR_IMR_S2, ah->imrs2_reg); - - REGWRITE_BUFFER_FLUSH(ah); -} - -u32 ath9k_hw_gettxbuf(struct ath_hw *ah, u32 q) -{ - return REG_READ(ah, AR_QTXDP(q)); -} -EXPORT_SYMBOL(ath9k_hw_gettxbuf); - -void ath9k_hw_puttxbuf(struct ath_hw *ah, u32 q, u32 txdp) -{ - REG_WRITE(ah, AR_QTXDP(q), txdp); -} -EXPORT_SYMBOL(ath9k_hw_puttxbuf); - -void ath9k_hw_txstart(struct ath_hw *ah, u32 q) -{ - ath_dbg(ath9k_hw_common(ah), QUEUE, "Enable TXE on queue: %u\n", q); - REG_WRITE(ah, AR_Q_TXE, 1 << q); -} -EXPORT_SYMBOL(ath9k_hw_txstart); - -u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q) -{ - u32 npend; - - npend = REG_READ(ah, AR_QSTS(q)) & AR_Q_STS_PEND_FR_CNT; - if (npend == 0) { - - if (REG_READ(ah, AR_Q_TXE) & (1 << q)) - npend = 1; - } - - return npend; -} -EXPORT_SYMBOL(ath9k_hw_numtxpending); - -/** - * ath9k_hw_updatetxtriglevel - adjusts the frame trigger level - * - * @ah: atheros hardware struct - * @bIncTrigLevel: whether or not the frame trigger level should be updated - * - * The frame trigger level specifies the minimum number of bytes, - * in units of 64 bytes, that must be DMA'ed into the PCU TX FIFO - * before the PCU will initiate sending the frame on the air. This can - * mean we initiate transmit before a full frame is on the PCU TX FIFO. - * Resets to 0x1 (meaning 64 bytes or a full frame, whichever occurs - * first) - * - * Caution must be taken to ensure to set the frame trigger level based - * on the DMA request size. For example if the DMA request size is set to - * 128 bytes the trigger level cannot exceed 6 * 64 = 384. This is because - * there need to be enough space in the tx FIFO for the requested transfer - * size. Hence the tx FIFO will stop with 512 - 128 = 384 bytes. If we set - * the threshold to a value beyond 6, then the transmit will hang. - * - * Current dual stream devices have a PCU TX FIFO size of 8 KB. - * Current single stream devices have a PCU TX FIFO size of 4 KB, however, - * there is a hardware issue which forces us to use 2 KB instead so the - * frame trigger level must not exceed 2 KB for these chipsets. - */ -bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel) -{ - u32 txcfg, curLevel, newLevel; - - if (ah->tx_trig_level >= ah->config.max_txtrig_level) - return false; - - ath9k_hw_disable_interrupts(ah); - - txcfg = REG_READ(ah, AR_TXCFG); - curLevel = MS(txcfg, AR_FTRIG); - newLevel = curLevel; - if (bIncTrigLevel) { - if (curLevel < ah->config.max_txtrig_level) - newLevel++; - } else if (curLevel > MIN_TX_FIFO_THRESHOLD) - newLevel--; - if (newLevel != curLevel) - REG_WRITE(ah, AR_TXCFG, - (txcfg & ~AR_FTRIG) | SM(newLevel, AR_FTRIG)); - - ath9k_hw_enable_interrupts(ah); - - ah->tx_trig_level = newLevel; - - return newLevel != curLevel; -} -EXPORT_SYMBOL(ath9k_hw_updatetxtriglevel); - -void ath9k_hw_abort_tx_dma(struct ath_hw *ah) -{ - int maxdelay = 1000; - int i, q; - - if (ah->curchan) { - if (IS_CHAN_HALF_RATE(ah->curchan)) - maxdelay *= 2; - else if (IS_CHAN_QUARTER_RATE(ah->curchan)) - maxdelay *= 4; - } - - REG_WRITE(ah, AR_Q_TXD, AR_Q_TXD_M); - - REG_SET_BIT(ah, AR_PCU_MISC, AR_PCU_FORCE_QUIET_COLL | AR_PCU_CLEAR_VMF); - REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_CH_IDLE_HIGH); - REG_SET_BIT(ah, AR_D_GBL_IFS_MISC, AR_D_GBL_IFS_MISC_IGNORE_BACKOFF); - - for (q = 0; q < AR_NUM_QCU; q++) { - for (i = 0; i < maxdelay; i++) { - if (i) - udelay(5); - - if (!ath9k_hw_numtxpending(ah, q)) - break; - } - } - - REG_CLR_BIT(ah, AR_PCU_MISC, AR_PCU_FORCE_QUIET_COLL | AR_PCU_CLEAR_VMF); - REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_CH_IDLE_HIGH); - REG_CLR_BIT(ah, AR_D_GBL_IFS_MISC, AR_D_GBL_IFS_MISC_IGNORE_BACKOFF); - - REG_WRITE(ah, AR_Q_TXD, 0); -} -EXPORT_SYMBOL(ath9k_hw_abort_tx_dma); - -bool ath9k_hw_stop_dma_queue(struct ath_hw *ah, u32 q) -{ -#define ATH9K_TX_STOP_DMA_TIMEOUT 1000 /* usec */ -#define ATH9K_TIME_QUANTUM 100 /* usec */ - int wait_time = ATH9K_TX_STOP_DMA_TIMEOUT / ATH9K_TIME_QUANTUM; - int wait; - - REG_WRITE(ah, AR_Q_TXD, 1 << q); - - for (wait = wait_time; wait != 0; wait--) { - if (wait != wait_time) - udelay(ATH9K_TIME_QUANTUM); - - if (ath9k_hw_numtxpending(ah, q) == 0) - break; - } - - REG_WRITE(ah, AR_Q_TXD, 0); - - return wait != 0; - -#undef ATH9K_TX_STOP_DMA_TIMEOUT -#undef ATH9K_TIME_QUANTUM -} -EXPORT_SYMBOL(ath9k_hw_stop_dma_queue); - -bool ath9k_hw_set_txq_props(struct ath_hw *ah, int q, - const struct ath9k_tx_queue_info *qinfo) -{ - u32 cw; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_tx_queue_info *qi; - - qi = &ah->txq[q]; - if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { - ath_dbg(common, QUEUE, - "Set TXQ properties, inactive queue: %u\n", q); - return false; - } - - ath_dbg(common, QUEUE, "Set queue properties for: %u\n", q); - - qi->tqi_ver = qinfo->tqi_ver; - qi->tqi_subtype = qinfo->tqi_subtype; - qi->tqi_qflags = qinfo->tqi_qflags; - qi->tqi_priority = qinfo->tqi_priority; - if (qinfo->tqi_aifs != ATH9K_TXQ_USEDEFAULT) - qi->tqi_aifs = min(qinfo->tqi_aifs, 255U); - else - qi->tqi_aifs = INIT_AIFS; - if (qinfo->tqi_cwmin != ATH9K_TXQ_USEDEFAULT) { - cw = min(qinfo->tqi_cwmin, 1024U); - qi->tqi_cwmin = 1; - while (qi->tqi_cwmin < cw) - qi->tqi_cwmin = (qi->tqi_cwmin << 1) | 1; - } else - qi->tqi_cwmin = qinfo->tqi_cwmin; - if (qinfo->tqi_cwmax != ATH9K_TXQ_USEDEFAULT) { - cw = min(qinfo->tqi_cwmax, 1024U); - qi->tqi_cwmax = 1; - while (qi->tqi_cwmax < cw) - qi->tqi_cwmax = (qi->tqi_cwmax << 1) | 1; - } else - qi->tqi_cwmax = INIT_CWMAX; - - if (qinfo->tqi_shretry != 0) - qi->tqi_shretry = min((u32) qinfo->tqi_shretry, 15U); - else - qi->tqi_shretry = INIT_SH_RETRY; - if (qinfo->tqi_lgretry != 0) - qi->tqi_lgretry = min((u32) qinfo->tqi_lgretry, 15U); - else - qi->tqi_lgretry = INIT_LG_RETRY; - qi->tqi_cbrPeriod = qinfo->tqi_cbrPeriod; - qi->tqi_cbrOverflowLimit = qinfo->tqi_cbrOverflowLimit; - qi->tqi_burstTime = qinfo->tqi_burstTime; - qi->tqi_readyTime = qinfo->tqi_readyTime; - - switch (qinfo->tqi_subtype) { - case ATH9K_WME_UPSD: - if (qi->tqi_type == ATH9K_TX_QUEUE_DATA) - qi->tqi_intFlags = ATH9K_TXQ_USE_LOCKOUT_BKOFF_DIS; - break; - default: - break; - } - - return true; -} -EXPORT_SYMBOL(ath9k_hw_set_txq_props); - -bool ath9k_hw_get_txq_props(struct ath_hw *ah, int q, - struct ath9k_tx_queue_info *qinfo) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_tx_queue_info *qi; - - qi = &ah->txq[q]; - if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { - ath_dbg(common, QUEUE, - "Get TXQ properties, inactive queue: %u\n", q); - return false; - } - - qinfo->tqi_qflags = qi->tqi_qflags; - qinfo->tqi_ver = qi->tqi_ver; - qinfo->tqi_subtype = qi->tqi_subtype; - qinfo->tqi_qflags = qi->tqi_qflags; - qinfo->tqi_priority = qi->tqi_priority; - qinfo->tqi_aifs = qi->tqi_aifs; - qinfo->tqi_cwmin = qi->tqi_cwmin; - qinfo->tqi_cwmax = qi->tqi_cwmax; - qinfo->tqi_shretry = qi->tqi_shretry; - qinfo->tqi_lgretry = qi->tqi_lgretry; - qinfo->tqi_cbrPeriod = qi->tqi_cbrPeriod; - qinfo->tqi_cbrOverflowLimit = qi->tqi_cbrOverflowLimit; - qinfo->tqi_burstTime = qi->tqi_burstTime; - qinfo->tqi_readyTime = qi->tqi_readyTime; - - return true; -} -EXPORT_SYMBOL(ath9k_hw_get_txq_props); - -int ath9k_hw_setuptxqueue(struct ath_hw *ah, enum ath9k_tx_queue type, - const struct ath9k_tx_queue_info *qinfo) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_tx_queue_info *qi; - int q; - - switch (type) { - case ATH9K_TX_QUEUE_BEACON: - q = ATH9K_NUM_TX_QUEUES - 1; - break; - case ATH9K_TX_QUEUE_CAB: - q = ATH9K_NUM_TX_QUEUES - 2; - break; - case ATH9K_TX_QUEUE_PSPOLL: - q = 1; - break; - case ATH9K_TX_QUEUE_UAPSD: - q = ATH9K_NUM_TX_QUEUES - 3; - break; - case ATH9K_TX_QUEUE_DATA: - for (q = 0; q < ATH9K_NUM_TX_QUEUES; q++) - if (ah->txq[q].tqi_type == - ATH9K_TX_QUEUE_INACTIVE) - break; - if (q == ATH9K_NUM_TX_QUEUES) { - ath_err(common, "No available TX queue\n"); - return -1; - } - break; - default: - ath_err(common, "Invalid TX queue type: %u\n", type); - return -1; - } - - ath_dbg(common, QUEUE, "Setup TX queue: %u\n", q); - - qi = &ah->txq[q]; - if (qi->tqi_type != ATH9K_TX_QUEUE_INACTIVE) { - ath_err(common, "TX queue: %u already active\n", q); - return -1; - } - memset(qi, 0, sizeof(struct ath9k_tx_queue_info)); - qi->tqi_type = type; - qi->tqi_physCompBuf = qinfo->tqi_physCompBuf; - (void) ath9k_hw_set_txq_props(ah, q, qinfo); - - return q; -} -EXPORT_SYMBOL(ath9k_hw_setuptxqueue); - -static void ath9k_hw_clear_queue_interrupts(struct ath_hw *ah, u32 q) -{ - ah->txok_interrupt_mask &= ~(1 << q); - ah->txerr_interrupt_mask &= ~(1 << q); - ah->txdesc_interrupt_mask &= ~(1 << q); - ah->txeol_interrupt_mask &= ~(1 << q); - ah->txurn_interrupt_mask &= ~(1 << q); -} - -bool ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_tx_queue_info *qi; - - qi = &ah->txq[q]; - if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { - ath_dbg(common, QUEUE, "Release TXQ, inactive queue: %u\n", q); - return false; - } - - ath_dbg(common, QUEUE, "Release TX queue: %u\n", q); - - qi->tqi_type = ATH9K_TX_QUEUE_INACTIVE; - ath9k_hw_clear_queue_interrupts(ah, q); - ath9k_hw_set_txq_interrupts(ah, qi); - - return true; -} -EXPORT_SYMBOL(ath9k_hw_releasetxqueue); - -bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q) -{ - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_channel *chan = ah->curchan; - struct ath9k_tx_queue_info *qi; - u32 cwMin, chanCwMin, value; - - qi = &ah->txq[q]; - if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { - ath_dbg(common, QUEUE, "Reset TXQ, inactive queue: %u\n", q); - return true; - } - - ath_dbg(common, QUEUE, "Reset TX queue: %u\n", q); - - if (qi->tqi_cwmin == ATH9K_TXQ_USEDEFAULT) { - if (chan && IS_CHAN_B(chan)) - chanCwMin = INIT_CWMIN_11B; - else - chanCwMin = INIT_CWMIN; - - for (cwMin = 1; cwMin < chanCwMin; cwMin = (cwMin << 1) | 1); - } else - cwMin = qi->tqi_cwmin; - - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_DLCL_IFS(q), - SM(cwMin, AR_D_LCL_IFS_CWMIN) | - SM(qi->tqi_cwmax, AR_D_LCL_IFS_CWMAX) | - SM(qi->tqi_aifs, AR_D_LCL_IFS_AIFS)); - - REG_WRITE(ah, AR_DRETRY_LIMIT(q), - SM(INIT_SSH_RETRY, AR_D_RETRY_LIMIT_STA_SH) | - SM(INIT_SLG_RETRY, AR_D_RETRY_LIMIT_STA_LG) | - SM(qi->tqi_shretry, AR_D_RETRY_LIMIT_FR_SH)); - - REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ); - - if (AR_SREV_9340(ah) && !AR_SREV_9340_13_OR_LATER(ah)) - REG_WRITE(ah, AR_DMISC(q), - AR_D_MISC_CW_BKOFF_EN | AR_D_MISC_FRAG_WAIT_EN | 0x1); - else - REG_WRITE(ah, AR_DMISC(q), - AR_D_MISC_CW_BKOFF_EN | AR_D_MISC_FRAG_WAIT_EN | 0x2); - - if (qi->tqi_cbrPeriod) { - REG_WRITE(ah, AR_QCBRCFG(q), - SM(qi->tqi_cbrPeriod, AR_Q_CBRCFG_INTERVAL) | - SM(qi->tqi_cbrOverflowLimit, AR_Q_CBRCFG_OVF_THRESH)); - REG_SET_BIT(ah, AR_QMISC(q), AR_Q_MISC_FSP_CBR | - (qi->tqi_cbrOverflowLimit ? - AR_Q_MISC_CBR_EXP_CNTR_LIMIT_EN : 0)); - } - if (qi->tqi_readyTime && (qi->tqi_type != ATH9K_TX_QUEUE_CAB)) { - REG_WRITE(ah, AR_QRDYTIMECFG(q), - SM(qi->tqi_readyTime, AR_Q_RDYTIMECFG_DURATION) | - AR_Q_RDYTIMECFG_EN); - } - - REG_WRITE(ah, AR_DCHNTIME(q), - SM(qi->tqi_burstTime, AR_D_CHNTIME_DUR) | - (qi->tqi_burstTime ? AR_D_CHNTIME_EN : 0)); - - if (qi->tqi_burstTime - && (qi->tqi_qflags & TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE)) - REG_SET_BIT(ah, AR_QMISC(q), AR_Q_MISC_RDYTIME_EXP_POLICY); - - if (qi->tqi_qflags & TXQ_FLAG_BACKOFF_DISABLE) - REG_SET_BIT(ah, AR_DMISC(q), AR_D_MISC_POST_FR_BKOFF_DIS); - - REGWRITE_BUFFER_FLUSH(ah); - - if (qi->tqi_qflags & TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE) - REG_SET_BIT(ah, AR_DMISC(q), AR_D_MISC_FRAG_BKOFF_EN); - - switch (qi->tqi_type) { - case ATH9K_TX_QUEUE_BEACON: - ENABLE_REGWRITE_BUFFER(ah); - - REG_SET_BIT(ah, AR_QMISC(q), - AR_Q_MISC_FSP_DBA_GATED - | AR_Q_MISC_BEACON_USE - | AR_Q_MISC_CBR_INCR_DIS1); - - REG_SET_BIT(ah, AR_DMISC(q), - (AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL << - AR_D_MISC_ARB_LOCKOUT_CNTRL_S) - | AR_D_MISC_BEACON_USE - | AR_D_MISC_POST_FR_BKOFF_DIS); - - REGWRITE_BUFFER_FLUSH(ah); - - /* - * cwmin and cwmax should be 0 for beacon queue - * but not for IBSS as we would create an imbalance - * on beaconing fairness for participating nodes. - */ - if (AR_SREV_9300_20_OR_LATER(ah) && - ah->opmode != NL80211_IFTYPE_ADHOC) { - REG_WRITE(ah, AR_DLCL_IFS(q), SM(0, AR_D_LCL_IFS_CWMIN) - | SM(0, AR_D_LCL_IFS_CWMAX) - | SM(qi->tqi_aifs, AR_D_LCL_IFS_AIFS)); - } - break; - case ATH9K_TX_QUEUE_CAB: - ENABLE_REGWRITE_BUFFER(ah); - - REG_SET_BIT(ah, AR_QMISC(q), - AR_Q_MISC_FSP_DBA_GATED - | AR_Q_MISC_CBR_INCR_DIS1 - | AR_Q_MISC_CBR_INCR_DIS0); - value = (qi->tqi_readyTime - - (ah->config.sw_beacon_response_time - - ah->config.dma_beacon_response_time) - - ah->config.additional_swba_backoff) * 1024; - REG_WRITE(ah, AR_QRDYTIMECFG(q), - value | AR_Q_RDYTIMECFG_EN); - REG_SET_BIT(ah, AR_DMISC(q), - (AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL << - AR_D_MISC_ARB_LOCKOUT_CNTRL_S)); - - REGWRITE_BUFFER_FLUSH(ah); - - break; - case ATH9K_TX_QUEUE_PSPOLL: - REG_SET_BIT(ah, AR_QMISC(q), AR_Q_MISC_CBR_INCR_DIS1); - break; - case ATH9K_TX_QUEUE_UAPSD: - REG_SET_BIT(ah, AR_DMISC(q), AR_D_MISC_POST_FR_BKOFF_DIS); - break; - default: - break; - } - - if (qi->tqi_intFlags & ATH9K_TXQ_USE_LOCKOUT_BKOFF_DIS) { - REG_SET_BIT(ah, AR_DMISC(q), - SM(AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL, - AR_D_MISC_ARB_LOCKOUT_CNTRL) | - AR_D_MISC_POST_FR_BKOFF_DIS); - } - - if (AR_SREV_9300_20_OR_LATER(ah)) - REG_WRITE(ah, AR_Q_DESC_CRCCHK, AR_Q_DESC_CRCCHK_EN); - - ath9k_hw_clear_queue_interrupts(ah, q); - if (qi->tqi_qflags & TXQ_FLAG_TXINT_ENABLE) { - ah->txok_interrupt_mask |= 1 << q; - ah->txerr_interrupt_mask |= 1 << q; - } - if (qi->tqi_qflags & TXQ_FLAG_TXDESCINT_ENABLE) - ah->txdesc_interrupt_mask |= 1 << q; - if (qi->tqi_qflags & TXQ_FLAG_TXEOLINT_ENABLE) - ah->txeol_interrupt_mask |= 1 << q; - if (qi->tqi_qflags & TXQ_FLAG_TXURNINT_ENABLE) - ah->txurn_interrupt_mask |= 1 << q; - ath9k_hw_set_txq_interrupts(ah, qi); - - return true; -} -EXPORT_SYMBOL(ath9k_hw_resettxqueue); - -int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, - struct ath_rx_status *rs) -{ - struct ar5416_desc ads; - struct ar5416_desc *adsp = AR5416DESC(ds); - u32 phyerr; - - if ((adsp->ds_rxstatus8 & AR_RxDone) == 0) - return -EINPROGRESS; - - ads.u.rx = adsp->u.rx; - - rs->rs_status = 0; - rs->rs_flags = 0; - - rs->rs_datalen = ads.ds_rxstatus1 & AR_DataLen; - rs->rs_tstamp = ads.AR_RcvTimestamp; - - if (ads.ds_rxstatus8 & AR_PostDelimCRCErr) { - rs->rs_rssi = ATH9K_RSSI_BAD; - rs->rs_rssi_ctl0 = ATH9K_RSSI_BAD; - rs->rs_rssi_ctl1 = ATH9K_RSSI_BAD; - rs->rs_rssi_ctl2 = ATH9K_RSSI_BAD; - rs->rs_rssi_ext0 = ATH9K_RSSI_BAD; - rs->rs_rssi_ext1 = ATH9K_RSSI_BAD; - rs->rs_rssi_ext2 = ATH9K_RSSI_BAD; - } else { - rs->rs_rssi = MS(ads.ds_rxstatus4, AR_RxRSSICombined); - rs->rs_rssi_ctl0 = MS(ads.ds_rxstatus0, - AR_RxRSSIAnt00); - rs->rs_rssi_ctl1 = MS(ads.ds_rxstatus0, - AR_RxRSSIAnt01); - rs->rs_rssi_ctl2 = MS(ads.ds_rxstatus0, - AR_RxRSSIAnt02); - rs->rs_rssi_ext0 = MS(ads.ds_rxstatus4, - AR_RxRSSIAnt10); - rs->rs_rssi_ext1 = MS(ads.ds_rxstatus4, - AR_RxRSSIAnt11); - rs->rs_rssi_ext2 = MS(ads.ds_rxstatus4, - AR_RxRSSIAnt12); - } - if (ads.ds_rxstatus8 & AR_RxKeyIdxValid) - rs->rs_keyix = MS(ads.ds_rxstatus8, AR_KeyIdx); - else - rs->rs_keyix = ATH9K_RXKEYIX_INVALID; - - rs->rs_rate = MS(ads.ds_rxstatus0, AR_RxRate); - rs->rs_more = (ads.ds_rxstatus1 & AR_RxMore) ? 1 : 0; - - rs->rs_isaggr = (ads.ds_rxstatus8 & AR_RxAggr) ? 1 : 0; - rs->rs_moreaggr = - (ads.ds_rxstatus8 & AR_RxMoreAggr) ? 1 : 0; - rs->rs_antenna = MS(ads.ds_rxstatus3, AR_RxAntenna); - rs->rs_flags = - (ads.ds_rxstatus3 & AR_GI) ? ATH9K_RX_GI : 0; - rs->rs_flags |= - (ads.ds_rxstatus3 & AR_2040) ? ATH9K_RX_2040 : 0; - - if (ads.ds_rxstatus8 & AR_PreDelimCRCErr) - rs->rs_flags |= ATH9K_RX_DELIM_CRC_PRE; - if (ads.ds_rxstatus8 & AR_PostDelimCRCErr) - rs->rs_flags |= ATH9K_RX_DELIM_CRC_POST; - if (ads.ds_rxstatus8 & AR_DecryptBusyErr) - rs->rs_flags |= ATH9K_RX_DECRYPT_BUSY; - - if ((ads.ds_rxstatus8 & AR_RxFrameOK) == 0) { - /* - * Treat these errors as mutually exclusive to avoid spurious - * extra error reports from the hardware. If a CRC error is - * reported, then decryption and MIC errors are irrelevant, - * the frame is going to be dropped either way - */ - if (ads.ds_rxstatus8 & AR_PHYErr) { - rs->rs_status |= ATH9K_RXERR_PHY; - phyerr = MS(ads.ds_rxstatus8, AR_PHYErrCode); - rs->rs_phyerr = phyerr; - } else if (ads.ds_rxstatus8 & AR_CRCErr) - rs->rs_status |= ATH9K_RXERR_CRC; - else if (ads.ds_rxstatus8 & AR_DecryptCRCErr) - rs->rs_status |= ATH9K_RXERR_DECRYPT; - else if (ads.ds_rxstatus8 & AR_MichaelErr) - rs->rs_status |= ATH9K_RXERR_MIC; - } else { - if (ads.ds_rxstatus8 & - (AR_CRCErr | AR_PHYErr | AR_DecryptCRCErr | AR_MichaelErr)) - rs->rs_status |= ATH9K_RXERR_CORRUPT_DESC; - - /* Only up to MCS16 supported, everything above is invalid */ - if (rs->rs_rate >= 0x90) - rs->rs_status |= ATH9K_RXERR_CORRUPT_DESC; - } - - if (ads.ds_rxstatus8 & AR_KeyMiss) - rs->rs_status |= ATH9K_RXERR_KEYMISS; - - return 0; -} -EXPORT_SYMBOL(ath9k_hw_rxprocdesc); - -/* - * This can stop or re-enables RX. - * - * If bool is set this will kill any frame which is currently being - * transferred between the MAC and baseband and also prevent any new - * frames from getting started. - */ -bool ath9k_hw_setrxabort(struct ath_hw *ah, bool set) -{ - u32 reg; - - if (set) { - REG_SET_BIT(ah, AR_DIAG_SW, - (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); - - if (!ath9k_hw_wait(ah, AR_OBS_BUS_1, AR_OBS_BUS_1_RX_STATE, - 0, AH_WAIT_TIMEOUT)) { - REG_CLR_BIT(ah, AR_DIAG_SW, - (AR_DIAG_RX_DIS | - AR_DIAG_RX_ABORT)); - - reg = REG_READ(ah, AR_OBS_BUS_1); - ath_err(ath9k_hw_common(ah), - "RX failed to go idle in 10 ms RXSM=0x%x\n", - reg); - - return false; - } - } else { - REG_CLR_BIT(ah, AR_DIAG_SW, - (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); - } - - return true; -} -EXPORT_SYMBOL(ath9k_hw_setrxabort); - -void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp) -{ - REG_WRITE(ah, AR_RXDP, rxdp); -} -EXPORT_SYMBOL(ath9k_hw_putrxbuf); - -void ath9k_hw_startpcureceive(struct ath_hw *ah, bool is_scanning) -{ - ath9k_enable_mib_counters(ah); - - ath9k_ani_reset(ah, is_scanning); - - REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); -} -EXPORT_SYMBOL(ath9k_hw_startpcureceive); - -void ath9k_hw_abortpcurecv(struct ath_hw *ah) -{ - REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS); - - ath9k_hw_disable_mib_counters(ah); -} -EXPORT_SYMBOL(ath9k_hw_abortpcurecv); - -bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset) -{ -#define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */ - struct ath_common *common = ath9k_hw_common(ah); - u32 mac_status, last_mac_status = 0; - int i; - - /* Enable access to the DMA observation bus */ - REG_WRITE(ah, AR_MACMISC, - ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) | - (AR_MACMISC_MISC_OBS_BUS_1 << - AR_MACMISC_MISC_OBS_BUS_MSB_S))); - - REG_WRITE(ah, AR_CR, AR_CR_RXD); - - /* Wait for rx enable bit to go low */ - for (i = AH_RX_STOP_DMA_TIMEOUT / AH_TIME_QUANTUM; i != 0; i--) { - if ((REG_READ(ah, AR_CR) & AR_CR_RXE) == 0) - break; - - if (!AR_SREV_9300_20_OR_LATER(ah)) { - mac_status = REG_READ(ah, AR_DMADBG_7) & 0x7f0; - if (mac_status == 0x1c0 && mac_status == last_mac_status) { - *reset = true; - break; - } - - last_mac_status = mac_status; - } - - udelay(AH_TIME_QUANTUM); - } - - if (i == 0) { - ath_err(common, - "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x DMADBG_7=0x%08x\n", - AH_RX_STOP_DMA_TIMEOUT / 1000, - REG_READ(ah, AR_CR), - REG_READ(ah, AR_DIAG_SW), - REG_READ(ah, AR_DMADBG_7)); - return false; - } else { - return true; - } - -#undef AH_RX_STOP_DMA_TIMEOUT -} -EXPORT_SYMBOL(ath9k_hw_stopdmarecv); - -int ath9k_hw_beaconq_setup(struct ath_hw *ah) -{ - struct ath9k_tx_queue_info qi; - - memset(&qi, 0, sizeof(qi)); - qi.tqi_aifs = 1; - qi.tqi_cwmin = 0; - qi.tqi_cwmax = 0; - - if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) - qi.tqi_qflags = TXQ_FLAG_TXINT_ENABLE; - - return ath9k_hw_setuptxqueue(ah, ATH9K_TX_QUEUE_BEACON, &qi); -} -EXPORT_SYMBOL(ath9k_hw_beaconq_setup); - -bool ath9k_hw_intrpend(struct ath_hw *ah) -{ - u32 host_isr; - - if (AR_SREV_9100(ah)) - return true; - - host_isr = REG_READ(ah, AR_INTR_ASYNC_CAUSE); - - if (((host_isr & AR_INTR_MAC_IRQ) || - (host_isr & AR_INTR_ASYNC_MASK_MCI)) && - (host_isr != AR_INTR_SPURIOUS)) - return true; - - host_isr = REG_READ(ah, AR_INTR_SYNC_CAUSE); - if ((host_isr & AR_INTR_SYNC_DEFAULT) - && (host_isr != AR_INTR_SPURIOUS)) - return true; - - return false; -} -EXPORT_SYMBOL(ath9k_hw_intrpend); - -void ath9k_hw_kill_interrupts(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - - ath_dbg(common, INTERRUPT, "disable IER\n"); - REG_WRITE(ah, AR_IER, AR_IER_DISABLE); - (void) REG_READ(ah, AR_IER); - if (!AR_SREV_9100(ah)) { - REG_WRITE(ah, AR_INTR_ASYNC_ENABLE, 0); - (void) REG_READ(ah, AR_INTR_ASYNC_ENABLE); - - REG_WRITE(ah, AR_INTR_SYNC_ENABLE, 0); - (void) REG_READ(ah, AR_INTR_SYNC_ENABLE); - } -} -EXPORT_SYMBOL(ath9k_hw_kill_interrupts); - -void ath9k_hw_disable_interrupts(struct ath_hw *ah) -{ - if (!(ah->imask & ATH9K_INT_GLOBAL)) - atomic_set(&ah->intr_ref_cnt, -1); - else - atomic_dec(&ah->intr_ref_cnt); - - ath9k_hw_kill_interrupts(ah); -} -EXPORT_SYMBOL(ath9k_hw_disable_interrupts); - -void ath9k_hw_enable_interrupts(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - u32 sync_default = AR_INTR_SYNC_DEFAULT; - u32 async_mask; - - if (!(ah->imask & ATH9K_INT_GLOBAL)) - return; - - if (!atomic_inc_and_test(&ah->intr_ref_cnt)) { - ath_dbg(common, INTERRUPT, "Do not enable IER ref count %d\n", - atomic_read(&ah->intr_ref_cnt)); - return; - } - - if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) - sync_default &= ~AR_INTR_SYNC_HOST1_FATAL; - - async_mask = AR_INTR_MAC_IRQ; - - if (ah->imask & ATH9K_INT_MCI) - async_mask |= AR_INTR_ASYNC_MASK_MCI; - - ath_dbg(common, INTERRUPT, "enable IER\n"); - REG_WRITE(ah, AR_IER, AR_IER_ENABLE); - if (!AR_SREV_9100(ah)) { - REG_WRITE(ah, AR_INTR_ASYNC_ENABLE, async_mask); - REG_WRITE(ah, AR_INTR_ASYNC_MASK, async_mask); - - REG_WRITE(ah, AR_INTR_SYNC_ENABLE, sync_default); - REG_WRITE(ah, AR_INTR_SYNC_MASK, sync_default); - } - ath_dbg(common, INTERRUPT, "AR_IMR 0x%x IER 0x%x\n", - REG_READ(ah, AR_IMR), REG_READ(ah, AR_IER)); -} -EXPORT_SYMBOL(ath9k_hw_enable_interrupts); - -void ath9k_hw_set_interrupts(struct ath_hw *ah) -{ - enum ath9k_int ints = ah->imask; - u32 mask, mask2; - struct ath9k_hw_capabilities *pCap = &ah->caps; - struct ath_common *common = ath9k_hw_common(ah); - - if (!(ints & ATH9K_INT_GLOBAL)) - ath9k_hw_disable_interrupts(ah); - - ath_dbg(common, INTERRUPT, "New interrupt mask 0x%x\n", ints); - - mask = ints & ATH9K_INT_COMMON; - mask2 = 0; - - if (ints & ATH9K_INT_TX) { - if (ah->config.tx_intr_mitigation) - mask |= AR_IMR_TXMINTR | AR_IMR_TXINTM; - else { - if (ah->txok_interrupt_mask) - mask |= AR_IMR_TXOK; - if (ah->txdesc_interrupt_mask) - mask |= AR_IMR_TXDESC; - } - if (ah->txerr_interrupt_mask) - mask |= AR_IMR_TXERR; - if (ah->txeol_interrupt_mask) - mask |= AR_IMR_TXEOL; - } - if (ints & ATH9K_INT_RX) { - if (AR_SREV_9300_20_OR_LATER(ah)) { - mask |= AR_IMR_RXERR | AR_IMR_RXOK_HP; - if (ah->config.rx_intr_mitigation) { - mask &= ~AR_IMR_RXOK_LP; - mask |= AR_IMR_RXMINTR | AR_IMR_RXINTM; - } else { - mask |= AR_IMR_RXOK_LP; - } - } else { - if (ah->config.rx_intr_mitigation) - mask |= AR_IMR_RXMINTR | AR_IMR_RXINTM; - else - mask |= AR_IMR_RXOK | AR_IMR_RXDESC; - } - if (!(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) - mask |= AR_IMR_GENTMR; - } - - if (ints & ATH9K_INT_GENTIMER) - mask |= AR_IMR_GENTMR; - - if (ints & (ATH9K_INT_BMISC)) { - mask |= AR_IMR_BCNMISC; - if (ints & ATH9K_INT_TIM) - mask2 |= AR_IMR_S2_TIM; - if (ints & ATH9K_INT_DTIM) - mask2 |= AR_IMR_S2_DTIM; - if (ints & ATH9K_INT_DTIMSYNC) - mask2 |= AR_IMR_S2_DTIMSYNC; - if (ints & ATH9K_INT_CABEND) - mask2 |= AR_IMR_S2_CABEND; - if (ints & ATH9K_INT_TSFOOR) - mask2 |= AR_IMR_S2_TSFOOR; - } - - if (ints & (ATH9K_INT_GTT | ATH9K_INT_CST)) { - mask |= AR_IMR_BCNMISC; - if (ints & ATH9K_INT_GTT) - mask2 |= AR_IMR_S2_GTT; - if (ints & ATH9K_INT_CST) - mask2 |= AR_IMR_S2_CST; - } - - ath_dbg(common, INTERRUPT, "new IMR 0x%x\n", mask); - REG_WRITE(ah, AR_IMR, mask); - ah->imrs2_reg &= ~(AR_IMR_S2_TIM | AR_IMR_S2_DTIM | AR_IMR_S2_DTIMSYNC | - AR_IMR_S2_CABEND | AR_IMR_S2_CABTO | - AR_IMR_S2_TSFOOR | AR_IMR_S2_GTT | AR_IMR_S2_CST); - ah->imrs2_reg |= mask2; - REG_WRITE(ah, AR_IMR_S2, ah->imrs2_reg); - - if (!(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { - if (ints & ATH9K_INT_TIM_TIMER) - REG_SET_BIT(ah, AR_IMR_S5, AR_IMR_S5_TIM_TIMER); - else - REG_CLR_BIT(ah, AR_IMR_S5, AR_IMR_S5_TIM_TIMER); - } - - return; -} -EXPORT_SYMBOL(ath9k_hw_set_interrupts); diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h deleted file mode 100644 index 5865f92998e1..000000000000 --- a/drivers/net/wireless/ath/ath9k/mac.h +++ /dev/null @@ -1,747 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef MAC_H -#define MAC_H - -#define set11nTries(_series, _index) \ - (SM((_series)[_index].Tries, AR_XmitDataTries##_index)) - -#define set11nRate(_series, _index) \ - (SM((_series)[_index].Rate, AR_XmitRate##_index)) - -#define set11nPktDurRTSCTS(_series, _index) \ - (SM((_series)[_index].PktDuration, AR_PacketDur##_index) | \ - ((_series)[_index].RateFlags & ATH9K_RATESERIES_RTS_CTS ? \ - AR_RTSCTSQual##_index : 0)) - -#define set11nRateFlags(_series, _index) \ - (((_series)[_index].RateFlags & ATH9K_RATESERIES_2040 ? \ - AR_2040_##_index : 0) \ - |((_series)[_index].RateFlags & ATH9K_RATESERIES_HALFGI ? \ - AR_GI##_index : 0) \ - |((_series)[_index].RateFlags & ATH9K_RATESERIES_STBC ? \ - AR_STBC##_index : 0) \ - |SM((_series)[_index].ChSel, AR_ChainSel##_index)) - -#define CCK_SIFS_TIME 10 -#define CCK_PREAMBLE_BITS 144 -#define CCK_PLCP_BITS 48 - -#define OFDM_SIFS_TIME 16 -#define OFDM_PREAMBLE_TIME 20 -#define OFDM_PLCP_BITS 22 -#define OFDM_SYMBOL_TIME 4 - -#define OFDM_SIFS_TIME_HALF 32 -#define OFDM_PREAMBLE_TIME_HALF 40 -#define OFDM_PLCP_BITS_HALF 22 -#define OFDM_SYMBOL_TIME_HALF 8 - -#define OFDM_SIFS_TIME_QUARTER 64 -#define OFDM_PREAMBLE_TIME_QUARTER 80 -#define OFDM_PLCP_BITS_QUARTER 22 -#define OFDM_SYMBOL_TIME_QUARTER 16 - -#define INIT_AIFS 2 -#define INIT_CWMIN 15 -#define INIT_CWMIN_11B 31 -#define INIT_CWMAX 1023 -#define INIT_SH_RETRY 10 -#define INIT_LG_RETRY 10 -#define INIT_SSH_RETRY 32 -#define INIT_SLG_RETRY 32 - -#define ATH9K_SLOT_TIME_6 6 -#define ATH9K_SLOT_TIME_9 9 -#define ATH9K_SLOT_TIME_20 20 - -#define ATH9K_TXERR_XRETRY 0x01 -#define ATH9K_TXERR_FILT 0x02 -#define ATH9K_TXERR_FIFO 0x04 -#define ATH9K_TXERR_XTXOP 0x08 -#define ATH9K_TXERR_TIMER_EXPIRED 0x10 -#define ATH9K_TX_ACKED 0x20 -#define ATH9K_TX_FLUSH 0x40 -#define ATH9K_TXERR_MASK \ - (ATH9K_TXERR_XRETRY | ATH9K_TXERR_FILT | ATH9K_TXERR_FIFO | \ - ATH9K_TXERR_XTXOP | ATH9K_TXERR_TIMER_EXPIRED | ATH9K_TX_FLUSH) - -#define ATH9K_TX_BA 0x01 -#define ATH9K_TX_PWRMGMT 0x02 -#define ATH9K_TX_DESC_CFG_ERR 0x04 -#define ATH9K_TX_DATA_UNDERRUN 0x08 -#define ATH9K_TX_DELIM_UNDERRUN 0x10 -#define ATH9K_TX_SW_FILTERED 0x80 - -/* 64 bytes */ -#define MIN_TX_FIFO_THRESHOLD 0x1 - -/* - * Single stream device AR9285 and AR9271 require 2 KB - * to work around a hardware issue, all other devices - * have can use the max 4 KB limit. - */ -#define MAX_TX_FIFO_THRESHOLD ((4096 / 64) - 1) - -struct ath_tx_status { - u32 ts_tstamp; - u16 ts_seqnum; - u8 ts_status; - u8 ts_rateindex; - int8_t ts_rssi; - u8 ts_shortretry; - u8 ts_longretry; - u8 ts_virtcol; - u8 ts_flags; - int8_t ts_rssi_ctl0; - int8_t ts_rssi_ctl1; - int8_t ts_rssi_ctl2; - int8_t ts_rssi_ext0; - int8_t ts_rssi_ext1; - int8_t ts_rssi_ext2; - u8 qid; - u16 desc_id; - u8 tid; - u32 ba_low; - u32 ba_high; - u32 evm0; - u32 evm1; - u32 evm2; -}; - -struct ath_rx_status { - u32 rs_tstamp; - u16 rs_datalen; - u8 rs_status; - u8 rs_phyerr; - int8_t rs_rssi; - u8 rs_keyix; - u8 rs_rate; - u8 rs_antenna; - u8 rs_more; - int8_t rs_rssi_ctl0; - int8_t rs_rssi_ctl1; - int8_t rs_rssi_ctl2; - int8_t rs_rssi_ext0; - int8_t rs_rssi_ext1; - int8_t rs_rssi_ext2; - u8 rs_isaggr; - u8 rs_moreaggr; - u8 rs_num_delims; - u8 rs_flags; - bool is_mybeacon; - u32 evm0; - u32 evm1; - u32 evm2; - u32 evm3; - u32 evm4; -}; - -struct ath_htc_rx_status { - __be64 rs_tstamp; - __be16 rs_datalen; - u8 rs_status; - u8 rs_phyerr; - int8_t rs_rssi; - int8_t rs_rssi_ctl0; - int8_t rs_rssi_ctl1; - int8_t rs_rssi_ctl2; - int8_t rs_rssi_ext0; - int8_t rs_rssi_ext1; - int8_t rs_rssi_ext2; - u8 rs_keyix; - u8 rs_rate; - u8 rs_antenna; - u8 rs_more; - u8 rs_isaggr; - u8 rs_moreaggr; - u8 rs_num_delims; - u8 rs_flags; - u8 rs_dummy; - __be32 evm0; - __be32 evm1; - __be32 evm2; -}; - -#define ATH9K_RXERR_CRC 0x01 -#define ATH9K_RXERR_PHY 0x02 -#define ATH9K_RXERR_FIFO 0x04 -#define ATH9K_RXERR_DECRYPT 0x08 -#define ATH9K_RXERR_MIC 0x10 -#define ATH9K_RXERR_KEYMISS 0x20 -#define ATH9K_RXERR_CORRUPT_DESC 0x40 - -#define ATH9K_RX_MORE 0x01 -#define ATH9K_RX_MORE_AGGR 0x02 -#define ATH9K_RX_GI 0x04 -#define ATH9K_RX_2040 0x08 -#define ATH9K_RX_DELIM_CRC_PRE 0x10 -#define ATH9K_RX_DELIM_CRC_POST 0x20 -#define ATH9K_RX_DECRYPT_BUSY 0x40 - -#define ATH9K_RXKEYIX_INVALID ((u8)-1) -#define ATH9K_TXKEYIX_INVALID ((u8)-1) - -enum ath9k_phyerr { - ATH9K_PHYERR_UNDERRUN = 0, /* Transmit underrun */ - ATH9K_PHYERR_TIMING = 1, /* Timing error */ - ATH9K_PHYERR_PARITY = 2, /* Illegal parity */ - ATH9K_PHYERR_RATE = 3, /* Illegal rate */ - ATH9K_PHYERR_LENGTH = 4, /* Illegal length */ - ATH9K_PHYERR_RADAR = 5, /* Radar detect */ - ATH9K_PHYERR_SERVICE = 6, /* Illegal service */ - ATH9K_PHYERR_TOR = 7, /* Transmit override receive */ - - ATH9K_PHYERR_OFDM_TIMING = 17, - ATH9K_PHYERR_OFDM_SIGNAL_PARITY = 18, - ATH9K_PHYERR_OFDM_RATE_ILLEGAL = 19, - ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL = 20, - ATH9K_PHYERR_OFDM_POWER_DROP = 21, - ATH9K_PHYERR_OFDM_SERVICE = 22, - ATH9K_PHYERR_OFDM_RESTART = 23, - ATH9K_PHYERR_FALSE_RADAR_EXT = 24, - - ATH9K_PHYERR_CCK_TIMING = 25, - ATH9K_PHYERR_CCK_HEADER_CRC = 26, - ATH9K_PHYERR_CCK_RATE_ILLEGAL = 27, - ATH9K_PHYERR_CCK_SERVICE = 30, - ATH9K_PHYERR_CCK_RESTART = 31, - ATH9K_PHYERR_CCK_LENGTH_ILLEGAL = 32, - ATH9K_PHYERR_CCK_POWER_DROP = 33, - - ATH9K_PHYERR_HT_CRC_ERROR = 34, - ATH9K_PHYERR_HT_LENGTH_ILLEGAL = 35, - ATH9K_PHYERR_HT_RATE_ILLEGAL = 36, - - ATH9K_PHYERR_SPECTRAL = 38, - ATH9K_PHYERR_MAX = 39, -}; - -struct ath_desc { - u32 ds_link; - u32 ds_data; - u32 ds_ctl0; - u32 ds_ctl1; - u32 ds_hw[20]; - void *ds_vdata; -} __packed __aligned(4); - -#define ATH9K_TXDESC_NOACK 0x0002 -#define ATH9K_TXDESC_RTSENA 0x0004 -#define ATH9K_TXDESC_CTSENA 0x0008 -/* ATH9K_TXDESC_INTREQ forces a tx interrupt to be generated for - * the descriptor its marked on. We take a tx interrupt to reap - * descriptors when the h/w hits an EOL condition or - * when the descriptor is specifically marked to generate - * an interrupt with this flag. Descriptors should be - * marked periodically to insure timely replenishing of the - * supply needed for sending frames. Defering interrupts - * reduces system load and potentially allows more concurrent - * work to be done but if done to aggressively can cause - * senders to backup. When the hardware queue is left too - * large rate control information may also be too out of - * date. An Alternative for this is TX interrupt mitigation - * but this needs more testing. */ -#define ATH9K_TXDESC_INTREQ 0x0010 -#define ATH9K_TXDESC_VEOL 0x0020 -#define ATH9K_TXDESC_EXT_ONLY 0x0040 -#define ATH9K_TXDESC_EXT_AND_CTL 0x0080 -#define ATH9K_TXDESC_VMF 0x0100 -#define ATH9K_TXDESC_FRAG_IS_ON 0x0200 -#define ATH9K_TXDESC_LOWRXCHAIN 0x0400 -#define ATH9K_TXDESC_LDPC 0x0800 -#define ATH9K_TXDESC_CLRDMASK 0x1000 - -#define ATH9K_TXDESC_PAPRD 0x70000 -#define ATH9K_TXDESC_PAPRD_S 16 - -#define ATH9K_RXDESC_INTREQ 0x0020 - -struct ar5416_desc { - u32 ds_link; - u32 ds_data; - u32 ds_ctl0; - u32 ds_ctl1; - union { - struct { - u32 ctl2; - u32 ctl3; - u32 ctl4; - u32 ctl5; - u32 ctl6; - u32 ctl7; - u32 ctl8; - u32 ctl9; - u32 ctl10; - u32 ctl11; - u32 status0; - u32 status1; - u32 status2; - u32 status3; - u32 status4; - u32 status5; - u32 status6; - u32 status7; - u32 status8; - u32 status9; - } tx; - struct { - u32 status0; - u32 status1; - u32 status2; - u32 status3; - u32 status4; - u32 status5; - u32 status6; - u32 status7; - u32 status8; - } rx; - } u; -} __packed __aligned(4); - -#define AR5416DESC(_ds) ((struct ar5416_desc *)(_ds)) -#define AR5416DESC_CONST(_ds) ((const struct ar5416_desc *)(_ds)) - -#define ds_ctl2 u.tx.ctl2 -#define ds_ctl3 u.tx.ctl3 -#define ds_ctl4 u.tx.ctl4 -#define ds_ctl5 u.tx.ctl5 -#define ds_ctl6 u.tx.ctl6 -#define ds_ctl7 u.tx.ctl7 -#define ds_ctl8 u.tx.ctl8 -#define ds_ctl9 u.tx.ctl9 -#define ds_ctl10 u.tx.ctl10 -#define ds_ctl11 u.tx.ctl11 - -#define ds_txstatus0 u.tx.status0 -#define ds_txstatus1 u.tx.status1 -#define ds_txstatus2 u.tx.status2 -#define ds_txstatus3 u.tx.status3 -#define ds_txstatus4 u.tx.status4 -#define ds_txstatus5 u.tx.status5 -#define ds_txstatus6 u.tx.status6 -#define ds_txstatus7 u.tx.status7 -#define ds_txstatus8 u.tx.status8 -#define ds_txstatus9 u.tx.status9 - -#define ds_rxstatus0 u.rx.status0 -#define ds_rxstatus1 u.rx.status1 -#define ds_rxstatus2 u.rx.status2 -#define ds_rxstatus3 u.rx.status3 -#define ds_rxstatus4 u.rx.status4 -#define ds_rxstatus5 u.rx.status5 -#define ds_rxstatus6 u.rx.status6 -#define ds_rxstatus7 u.rx.status7 -#define ds_rxstatus8 u.rx.status8 - -#define AR_FrameLen 0x00000fff -#define AR_VirtMoreFrag 0x00001000 -#define AR_TxCtlRsvd00 0x0000e000 -#define AR_XmitPower 0x003f0000 -#define AR_XmitPower_S 16 -#define AR_RTSEnable 0x00400000 -#define AR_VEOL 0x00800000 -#define AR_ClrDestMask 0x01000000 -#define AR_TxCtlRsvd01 0x1e000000 -#define AR_TxIntrReq 0x20000000 -#define AR_DestIdxValid 0x40000000 -#define AR_CTSEnable 0x80000000 - -#define AR_TxMore 0x00001000 -#define AR_DestIdx 0x000fe000 -#define AR_DestIdx_S 13 -#define AR_FrameType 0x00f00000 -#define AR_FrameType_S 20 -#define AR_NoAck 0x01000000 -#define AR_InsertTS 0x02000000 -#define AR_CorruptFCS 0x04000000 -#define AR_ExtOnly 0x08000000 -#define AR_ExtAndCtl 0x10000000 -#define AR_MoreAggr 0x20000000 -#define AR_IsAggr 0x40000000 - -#define AR_BurstDur 0x00007fff -#define AR_BurstDur_S 0 -#define AR_DurUpdateEna 0x00008000 -#define AR_XmitDataTries0 0x000f0000 -#define AR_XmitDataTries0_S 16 -#define AR_XmitDataTries1 0x00f00000 -#define AR_XmitDataTries1_S 20 -#define AR_XmitDataTries2 0x0f000000 -#define AR_XmitDataTries2_S 24 -#define AR_XmitDataTries3 0xf0000000 -#define AR_XmitDataTries3_S 28 - -#define AR_XmitRate0 0x000000ff -#define AR_XmitRate0_S 0 -#define AR_XmitRate1 0x0000ff00 -#define AR_XmitRate1_S 8 -#define AR_XmitRate2 0x00ff0000 -#define AR_XmitRate2_S 16 -#define AR_XmitRate3 0xff000000 -#define AR_XmitRate3_S 24 - -#define AR_PacketDur0 0x00007fff -#define AR_PacketDur0_S 0 -#define AR_RTSCTSQual0 0x00008000 -#define AR_PacketDur1 0x7fff0000 -#define AR_PacketDur1_S 16 -#define AR_RTSCTSQual1 0x80000000 - -#define AR_PacketDur2 0x00007fff -#define AR_PacketDur2_S 0 -#define AR_RTSCTSQual2 0x00008000 -#define AR_PacketDur3 0x7fff0000 -#define AR_PacketDur3_S 16 -#define AR_RTSCTSQual3 0x80000000 - -#define AR_AggrLen 0x0000ffff -#define AR_AggrLen_S 0 -#define AR_TxCtlRsvd60 0x00030000 -#define AR_PadDelim 0x03fc0000 -#define AR_PadDelim_S 18 -#define AR_EncrType 0x0c000000 -#define AR_EncrType_S 26 -#define AR_TxCtlRsvd61 0xf0000000 -#define AR_LDPC 0x80000000 - -#define AR_2040_0 0x00000001 -#define AR_GI0 0x00000002 -#define AR_ChainSel0 0x0000001c -#define AR_ChainSel0_S 2 -#define AR_2040_1 0x00000020 -#define AR_GI1 0x00000040 -#define AR_ChainSel1 0x00000380 -#define AR_ChainSel1_S 7 -#define AR_2040_2 0x00000400 -#define AR_GI2 0x00000800 -#define AR_ChainSel2 0x00007000 -#define AR_ChainSel2_S 12 -#define AR_2040_3 0x00008000 -#define AR_GI3 0x00010000 -#define AR_ChainSel3 0x000e0000 -#define AR_ChainSel3_S 17 -#define AR_RTSCTSRate 0x0ff00000 -#define AR_RTSCTSRate_S 20 -#define AR_STBC0 0x10000000 -#define AR_STBC1 0x20000000 -#define AR_STBC2 0x40000000 -#define AR_STBC3 0x80000000 - -#define AR_TxRSSIAnt00 0x000000ff -#define AR_TxRSSIAnt00_S 0 -#define AR_TxRSSIAnt01 0x0000ff00 -#define AR_TxRSSIAnt01_S 8 -#define AR_TxRSSIAnt02 0x00ff0000 -#define AR_TxRSSIAnt02_S 16 -#define AR_TxStatusRsvd00 0x3f000000 -#define AR_TxBaStatus 0x40000000 -#define AR_TxStatusRsvd01 0x80000000 - -/* - * AR_FrmXmitOK - Frame transmission success flag. If set, the frame was - * transmitted successfully. If clear, no ACK or BA was received to indicate - * successful transmission when we were expecting an ACK or BA. - */ -#define AR_FrmXmitOK 0x00000001 -#define AR_ExcessiveRetries 0x00000002 -#define AR_FIFOUnderrun 0x00000004 -#define AR_Filtered 0x00000008 -#define AR_RTSFailCnt 0x000000f0 -#define AR_RTSFailCnt_S 4 -#define AR_DataFailCnt 0x00000f00 -#define AR_DataFailCnt_S 8 -#define AR_VirtRetryCnt 0x0000f000 -#define AR_VirtRetryCnt_S 12 -#define AR_TxDelimUnderrun 0x00010000 -#define AR_TxDataUnderrun 0x00020000 -#define AR_DescCfgErr 0x00040000 -#define AR_TxTimerExpired 0x00080000 -#define AR_TxStatusRsvd10 0xfff00000 - -#define AR_SendTimestamp ds_txstatus2 -#define AR_BaBitmapLow ds_txstatus3 -#define AR_BaBitmapHigh ds_txstatus4 - -#define AR_TxRSSIAnt10 0x000000ff -#define AR_TxRSSIAnt10_S 0 -#define AR_TxRSSIAnt11 0x0000ff00 -#define AR_TxRSSIAnt11_S 8 -#define AR_TxRSSIAnt12 0x00ff0000 -#define AR_TxRSSIAnt12_S 16 -#define AR_TxRSSICombined 0xff000000 -#define AR_TxRSSICombined_S 24 - -#define AR_TxTid 0xf0000000 -#define AR_TxTid_S 28 - -#define AR_TxEVM0 ds_txstatus5 -#define AR_TxEVM1 ds_txstatus6 -#define AR_TxEVM2 ds_txstatus7 - -#define AR_TxDone 0x00000001 -#define AR_SeqNum 0x00001ffe -#define AR_SeqNum_S 1 -#define AR_TxStatusRsvd80 0x0001e000 -#define AR_TxOpExceeded 0x00020000 -#define AR_TxStatusRsvd81 0x001c0000 -#define AR_FinalTxIdx 0x00600000 -#define AR_FinalTxIdx_S 21 -#define AR_TxStatusRsvd82 0x01800000 -#define AR_PowerMgmt 0x02000000 -#define AR_TxStatusRsvd83 0xfc000000 - -#define AR_RxCTLRsvd00 0xffffffff - -#define AR_RxCtlRsvd00 0x00001000 -#define AR_RxIntrReq 0x00002000 -#define AR_RxCtlRsvd01 0xffffc000 - -#define AR_RxRSSIAnt00 0x000000ff -#define AR_RxRSSIAnt00_S 0 -#define AR_RxRSSIAnt01 0x0000ff00 -#define AR_RxRSSIAnt01_S 8 -#define AR_RxRSSIAnt02 0x00ff0000 -#define AR_RxRSSIAnt02_S 16 -#define AR_RxRate 0xff000000 -#define AR_RxRate_S 24 -#define AR_RxStatusRsvd00 0xff000000 - -#define AR_DataLen 0x00000fff -#define AR_RxMore 0x00001000 -#define AR_NumDelim 0x003fc000 -#define AR_NumDelim_S 14 -#define AR_RxStatusRsvd10 0xff800000 - -#define AR_RcvTimestamp ds_rxstatus2 - -#define AR_GI 0x00000001 -#define AR_2040 0x00000002 -#define AR_Parallel40 0x00000004 -#define AR_Parallel40_S 2 -#define AR_RxStatusRsvd30 0x000000f8 -#define AR_RxAntenna 0xffffff00 -#define AR_RxAntenna_S 8 - -#define AR_RxRSSIAnt10 0x000000ff -#define AR_RxRSSIAnt10_S 0 -#define AR_RxRSSIAnt11 0x0000ff00 -#define AR_RxRSSIAnt11_S 8 -#define AR_RxRSSIAnt12 0x00ff0000 -#define AR_RxRSSIAnt12_S 16 -#define AR_RxRSSICombined 0xff000000 -#define AR_RxRSSICombined_S 24 - -#define AR_RxEVM0 ds_rxstatus4 -#define AR_RxEVM1 ds_rxstatus5 -#define AR_RxEVM2 ds_rxstatus6 - -#define AR_RxDone 0x00000001 -#define AR_RxFrameOK 0x00000002 -#define AR_CRCErr 0x00000004 -#define AR_DecryptCRCErr 0x00000008 -#define AR_PHYErr 0x00000010 -#define AR_MichaelErr 0x00000020 -#define AR_PreDelimCRCErr 0x00000040 -#define AR_RxStatusRsvd70 0x00000080 -#define AR_RxKeyIdxValid 0x00000100 -#define AR_KeyIdx 0x0000fe00 -#define AR_KeyIdx_S 9 -#define AR_PHYErrCode 0x0000ff00 -#define AR_PHYErrCode_S 8 -#define AR_RxMoreAggr 0x00010000 -#define AR_RxAggr 0x00020000 -#define AR_PostDelimCRCErr 0x00040000 -#define AR_RxStatusRsvd71 0x3ff80000 -#define AR_DecryptBusyErr 0x40000000 -#define AR_KeyMiss 0x80000000 - -enum ath9k_tx_queue { - ATH9K_TX_QUEUE_INACTIVE = 0, - ATH9K_TX_QUEUE_DATA, - ATH9K_TX_QUEUE_BEACON, - ATH9K_TX_QUEUE_CAB, - ATH9K_TX_QUEUE_UAPSD, - ATH9K_TX_QUEUE_PSPOLL -}; - -#define ATH9K_NUM_TX_QUEUES 10 - -/* Used as a queue subtype instead of a WMM AC */ -#define ATH9K_WME_UPSD 4 - -enum ath9k_tx_queue_flags { - TXQ_FLAG_TXINT_ENABLE = 0x0001, - TXQ_FLAG_TXDESCINT_ENABLE = 0x0002, - TXQ_FLAG_TXEOLINT_ENABLE = 0x0004, - TXQ_FLAG_TXURNINT_ENABLE = 0x0008, - TXQ_FLAG_BACKOFF_DISABLE = 0x0010, - TXQ_FLAG_COMPRESSION_ENABLE = 0x0020, - TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE = 0x0040, - TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE = 0x0080, -}; - -#define ATH9K_TXQ_USEDEFAULT ((u32) -1) -#define ATH9K_TXQ_USE_LOCKOUT_BKOFF_DIS 0x00000001 - -#define ATH9K_DECOMP_MASK_SIZE 128 -#define ATH9K_READY_TIME_LO_BOUND 50 -#define ATH9K_READY_TIME_HI_BOUND 96 - -enum ath9k_pkt_type { - ATH9K_PKT_TYPE_NORMAL = 0, - ATH9K_PKT_TYPE_ATIM, - ATH9K_PKT_TYPE_PSPOLL, - ATH9K_PKT_TYPE_BEACON, - ATH9K_PKT_TYPE_PROBE_RESP, - ATH9K_PKT_TYPE_CHIRP, - ATH9K_PKT_TYPE_GRP_POLL, -}; - -struct ath9k_tx_queue_info { - u32 tqi_ver; - enum ath9k_tx_queue tqi_type; - int tqi_subtype; - enum ath9k_tx_queue_flags tqi_qflags; - u32 tqi_priority; - u32 tqi_aifs; - u32 tqi_cwmin; - u32 tqi_cwmax; - u16 tqi_shretry; - u16 tqi_lgretry; - u32 tqi_cbrPeriod; - u32 tqi_cbrOverflowLimit; - u32 tqi_burstTime; - u32 tqi_readyTime; - u32 tqi_physCompBuf; - u32 tqi_intFlags; -}; - -enum ath9k_rx_filter { - ATH9K_RX_FILTER_UCAST = 0x00000001, - ATH9K_RX_FILTER_MCAST = 0x00000002, - ATH9K_RX_FILTER_BCAST = 0x00000004, - ATH9K_RX_FILTER_CONTROL = 0x00000008, - ATH9K_RX_FILTER_BEACON = 0x00000010, - ATH9K_RX_FILTER_PROM = 0x00000020, - ATH9K_RX_FILTER_PROBEREQ = 0x00000080, - ATH9K_RX_FILTER_PHYERR = 0x00000100, - ATH9K_RX_FILTER_MYBEACON = 0x00000200, - ATH9K_RX_FILTER_COMP_BAR = 0x00000400, - ATH9K_RX_FILTER_COMP_BA = 0x00000800, - ATH9K_RX_FILTER_UNCOMP_BA_BAR = 0x00001000, - ATH9K_RX_FILTER_PSPOLL = 0x00004000, - ATH9K_RX_FILTER_PHYRADAR = 0x00002000, - ATH9K_RX_FILTER_MCAST_BCAST_ALL = 0x00008000, - ATH9K_RX_FILTER_CONTROL_WRAPPER = 0x00080000, - ATH9K_RX_FILTER_4ADDRESS = 0x00100000, -}; - -#define ATH9K_RATESERIES_RTS_CTS 0x0001 -#define ATH9K_RATESERIES_2040 0x0002 -#define ATH9K_RATESERIES_HALFGI 0x0004 -#define ATH9K_RATESERIES_STBC 0x0008 - -struct ath9k_11n_rate_series { - u32 Tries; - u32 Rate; - u32 PktDuration; - u32 ChSel; - u32 RateFlags; -}; - -enum aggr_type { - AGGR_BUF_NONE, - AGGR_BUF_FIRST, - AGGR_BUF_MIDDLE, - AGGR_BUF_LAST, -}; - -enum ath9k_key_type { - ATH9K_KEY_TYPE_CLEAR, - ATH9K_KEY_TYPE_WEP, - ATH9K_KEY_TYPE_AES, - ATH9K_KEY_TYPE_TKIP, -}; - -struct ath_tx_info { - u8 qcu; - - bool is_first; - bool is_last; - - enum aggr_type aggr; - u8 ndelim; - u16 aggr_len; - - dma_addr_t link; - int pkt_len; - u32 flags; - - dma_addr_t buf_addr[4]; - int buf_len[4]; - - struct ath9k_11n_rate_series rates[4]; - u8 rtscts_rate; - bool dur_update; - - enum ath9k_pkt_type type; - enum ath9k_key_type keytype; - u8 keyix; - u8 txpower; -}; - -struct ath_hw; -struct ath9k_channel; -enum ath9k_int; - -u32 ath9k_hw_gettxbuf(struct ath_hw *ah, u32 q); -void ath9k_hw_puttxbuf(struct ath_hw *ah, u32 q, u32 txdp); -void ath9k_hw_txstart(struct ath_hw *ah, u32 q); -u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q); -bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel); -bool ath9k_hw_stop_dma_queue(struct ath_hw *ah, u32 q); -void ath9k_hw_abort_tx_dma(struct ath_hw *ah); -bool ath9k_hw_set_txq_props(struct ath_hw *ah, int q, - const struct ath9k_tx_queue_info *qinfo); -bool ath9k_hw_get_txq_props(struct ath_hw *ah, int q, - struct ath9k_tx_queue_info *qinfo); -int ath9k_hw_setuptxqueue(struct ath_hw *ah, enum ath9k_tx_queue type, - const struct ath9k_tx_queue_info *qinfo); -bool ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q); -bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q); -int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, - struct ath_rx_status *rs); -void ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath_desc *ds, - u32 size, u32 flags); -bool ath9k_hw_setrxabort(struct ath_hw *ah, bool set); -void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp); -void ath9k_hw_startpcureceive(struct ath_hw *ah, bool is_scanning); -void ath9k_hw_abortpcurecv(struct ath_hw *ah); -bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset); -int ath9k_hw_beaconq_setup(struct ath_hw *ah); - -/* Interrupt Handling */ -bool ath9k_hw_intrpend(struct ath_hw *ah); -void ath9k_hw_set_interrupts(struct ath_hw *ah); -void ath9k_hw_enable_interrupts(struct ath_hw *ah); -void ath9k_hw_disable_interrupts(struct ath_hw *ah); -void ath9k_hw_kill_interrupts(struct ath_hw *ah); - -void ar9002_hw_attach_mac_ops(struct ath_hw *ah); - -#endif /* MAC_H */ diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c deleted file mode 100644 index 82a1b5b16b62..000000000000 --- a/drivers/net/wireless/ath/ath9k/main.c +++ /dev/null @@ -1,2395 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include "ath9k.h" -#include "btcoex.h" - -static void ath9k_set_assoc_state(struct ath_softc *sc, - struct ieee80211_vif *vif); - -u8 ath9k_parse_mpdudensity(u8 mpdudensity) -{ - /* - * 802.11n D2.0 defined values for "Minimum MPDU Start Spacing": - * 0 for no restriction - * 1 for 1/4 us - * 2 for 1/2 us - * 3 for 1 us - * 4 for 2 us - * 5 for 4 us - * 6 for 8 us - * 7 for 16 us - */ - switch (mpdudensity) { - case 0: - return 0; - case 1: - case 2: - case 3: - /* Our lower layer calculations limit our precision to - 1 microsecond */ - return 1; - case 4: - return 2; - case 5: - return 4; - case 6: - return 8; - case 7: - return 16; - default: - return 0; - } -} - -static bool ath9k_has_pending_frames(struct ath_softc *sc, struct ath_txq *txq) -{ - bool pending = false; - - spin_lock_bh(&txq->axq_lock); - - if (txq->axq_depth || !list_empty(&txq->axq_acq)) - pending = true; - - spin_unlock_bh(&txq->axq_lock); - return pending; -} - -static bool ath9k_setpower(struct ath_softc *sc, enum ath9k_power_mode mode) -{ - unsigned long flags; - bool ret; - - spin_lock_irqsave(&sc->sc_pm_lock, flags); - ret = ath9k_hw_setpower(sc->sc_ah, mode); - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - - return ret; -} - -void ath9k_ps_wakeup(struct ath_softc *sc) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - unsigned long flags; - enum ath9k_power_mode power_mode; - - spin_lock_irqsave(&sc->sc_pm_lock, flags); - if (++sc->ps_usecount != 1) - goto unlock; - - power_mode = sc->sc_ah->power_mode; - ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); - - /* - * While the hardware is asleep, the cycle counters contain no - * useful data. Better clear them now so that they don't mess up - * survey data results. - */ - if (power_mode != ATH9K_PM_AWAKE) { - spin_lock(&common->cc_lock); - ath_hw_cycle_counters_update(common); - memset(&common->cc_survey, 0, sizeof(common->cc_survey)); - memset(&common->cc_ani, 0, sizeof(common->cc_ani)); - spin_unlock(&common->cc_lock); - } - - unlock: - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); -} - -void ath9k_ps_restore(struct ath_softc *sc) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - enum ath9k_power_mode mode; - unsigned long flags; - bool reset; - - spin_lock_irqsave(&sc->sc_pm_lock, flags); - if (--sc->ps_usecount != 0) - goto unlock; - - if (sc->ps_idle) { - ath9k_hw_setrxabort(sc->sc_ah, 1); - ath9k_hw_stopdmarecv(sc->sc_ah, &reset); - mode = ATH9K_PM_FULL_SLEEP; - } else if (sc->ps_enabled && - !(sc->ps_flags & (PS_WAIT_FOR_BEACON | - PS_WAIT_FOR_CAB | - PS_WAIT_FOR_PSPOLL_DATA | - PS_WAIT_FOR_TX_ACK | - PS_WAIT_FOR_ANI))) { - mode = ATH9K_PM_NETWORK_SLEEP; - if (ath9k_hw_btcoex_is_enabled(sc->sc_ah)) - ath9k_btcoex_stop_gen_timer(sc); - } else { - goto unlock; - } - - spin_lock(&common->cc_lock); - ath_hw_cycle_counters_update(common); - spin_unlock(&common->cc_lock); - - ath9k_hw_setpower(sc->sc_ah, mode); - - unlock: - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); -} - -static void __ath_cancel_work(struct ath_softc *sc) -{ - cancel_work_sync(&sc->paprd_work); - cancel_work_sync(&sc->hw_check_work); - cancel_delayed_work_sync(&sc->tx_complete_work); - cancel_delayed_work_sync(&sc->hw_pll_work); - -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT - if (ath9k_hw_mci_is_enabled(sc->sc_ah)) - cancel_work_sync(&sc->mci_work); -#endif -} - -static void ath_cancel_work(struct ath_softc *sc) -{ - __ath_cancel_work(sc); - cancel_work_sync(&sc->hw_reset_work); -} - -static void ath_restart_work(struct ath_softc *sc) -{ - ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); - - if (AR_SREV_9340(sc->sc_ah) || AR_SREV_9330(sc->sc_ah)) - ieee80211_queue_delayed_work(sc->hw, &sc->hw_pll_work, - msecs_to_jiffies(ATH_PLL_WORK_INTERVAL)); - - ath_start_rx_poll(sc, 3); - ath_start_ani(sc); -} - -static bool ath_prepare_reset(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - bool ret = true; - - ieee80211_stop_queues(sc->hw); - - sc->hw_busy_count = 0; - ath_stop_ani(sc); - del_timer_sync(&sc->rx_poll_timer); - - ath9k_debug_samp_bb_mac(sc); - ath9k_hw_disable_interrupts(ah); - - if (!ath_drain_all_txq(sc)) - ret = false; - - if (!ath_stoprecv(sc)) - ret = false; - - return ret; -} - -static bool ath_complete_reset(struct ath_softc *sc, bool start) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - unsigned long flags; - int i; - - if (ath_startrecv(sc) != 0) { - ath_err(common, "Unable to restart recv logic\n"); - return false; - } - - ath9k_cmn_update_txpow(ah, sc->curtxpow, - sc->config.txpowlimit, &sc->curtxpow); - - clear_bit(SC_OP_HW_RESET, &sc->sc_flags); - ath9k_hw_set_interrupts(ah); - ath9k_hw_enable_interrupts(ah); - - if (!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL) && start) { - if (!test_bit(SC_OP_BEACONS, &sc->sc_flags)) - goto work; - - if (ah->opmode == NL80211_IFTYPE_STATION && - test_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags)) { - spin_lock_irqsave(&sc->sc_pm_lock, flags); - sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON; - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - } else { - ath9k_set_beacon(sc); - } - work: - ath_restart_work(sc); - - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { - if (!ATH_TXQ_SETUP(sc, i)) - continue; - - spin_lock_bh(&sc->tx.txq[i].axq_lock); - ath_txq_schedule(sc, &sc->tx.txq[i]); - spin_unlock_bh(&sc->tx.txq[i].axq_lock); - } - } - - if ((ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) && sc->ant_rx != 3) - ath_ant_comb_update(sc); - - ieee80211_wake_queues(sc->hw); - - return true; -} - -static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_cal_data *caldata = NULL; - bool fastcc = true; - int r; - - __ath_cancel_work(sc); - - tasklet_disable(&sc->intr_tq); - spin_lock_bh(&sc->sc_pcu_lock); - - if (!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) { - fastcc = false; - caldata = &sc->caldata; - } - - if (!hchan) { - fastcc = false; - hchan = ah->curchan; - } - - if (!ath_prepare_reset(sc)) - fastcc = false; - - ath_dbg(common, CONFIG, "Reset to %u MHz, HT40: %d fastcc: %d\n", - hchan->channel, IS_CHAN_HT40(hchan), fastcc); - - r = ath9k_hw_reset(ah, hchan, caldata, fastcc); - if (r) { - ath_err(common, - "Unable to reset channel, reset status %d\n", r); - - ath9k_hw_enable_interrupts(ah); - ath9k_queue_reset(sc, RESET_TYPE_BB_HANG); - - goto out; - } - - if (ath9k_hw_mci_is_enabled(sc->sc_ah) && - (sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) - ath9k_mci_set_txpower(sc, true, false); - - if (!ath_complete_reset(sc, true)) - r = -EIO; - -out: - spin_unlock_bh(&sc->sc_pcu_lock); - tasklet_enable(&sc->intr_tq); - - return r; -} - - -/* - * Set/change channels. If the channel is really being changed, it's done - * by reseting the chip. To accomplish this we must first cleanup any pending - * DMA, then restart stuff. -*/ -static int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, - struct ath9k_channel *hchan) -{ - int r; - - if (test_bit(SC_OP_INVALID, &sc->sc_flags)) - return -EIO; - - r = ath_reset_internal(sc, hchan); - - return r; -} - -static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta, - struct ieee80211_vif *vif) -{ - struct ath_node *an; - an = (struct ath_node *)sta->drv_priv; - - an->sc = sc; - an->sta = sta; - an->vif = vif; - - ath_tx_node_init(sc, an); - - if (sta->ht_cap.ht_supported) { - an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + - sta->ht_cap.ampdu_factor); - an->mpdudensity = ath9k_parse_mpdudensity(sta->ht_cap.ampdu_density); - } -} - -static void ath_node_detach(struct ath_softc *sc, struct ieee80211_sta *sta) -{ - struct ath_node *an = (struct ath_node *)sta->drv_priv; - ath_tx_node_cleanup(sc, an); -} - -void ath9k_tasklet(unsigned long data) -{ - struct ath_softc *sc = (struct ath_softc *)data; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - enum ath_reset_type type; - unsigned long flags; - u32 status = sc->intrstatus; - u32 rxmask; - - ath9k_ps_wakeup(sc); - spin_lock(&sc->sc_pcu_lock); - - if ((status & ATH9K_INT_FATAL) || - (status & ATH9K_INT_BB_WATCHDOG)) { - - if (status & ATH9K_INT_FATAL) - type = RESET_TYPE_FATAL_INT; - else - type = RESET_TYPE_BB_WATCHDOG; - - ath9k_queue_reset(sc, type); - goto out; - } - - spin_lock_irqsave(&sc->sc_pm_lock, flags); - if ((status & ATH9K_INT_TSFOOR) && sc->ps_enabled) { - /* - * TSF sync does not look correct; remain awake to sync with - * the next Beacon. - */ - ath_dbg(common, PS, "TSFOOR - Sync with next Beacon\n"); - sc->ps_flags |= PS_WAIT_FOR_BEACON | PS_BEACON_SYNC; - } - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - - if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) - rxmask = (ATH9K_INT_RXHP | ATH9K_INT_RXLP | ATH9K_INT_RXEOL | - ATH9K_INT_RXORN); - else - rxmask = (ATH9K_INT_RX | ATH9K_INT_RXEOL | ATH9K_INT_RXORN); - - if (status & rxmask) { - /* Check for high priority Rx first */ - if ((ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) && - (status & ATH9K_INT_RXHP)) - ath_rx_tasklet(sc, 0, true); - - ath_rx_tasklet(sc, 0, false); - } - - if (status & ATH9K_INT_TX) { - if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) - ath_tx_edma_tasklet(sc); - else - ath_tx_tasklet(sc); - } - - ath9k_btcoex_handle_interrupt(sc, status); - -out: - /* re-enable hardware interrupt */ - ath9k_hw_enable_interrupts(ah); - - spin_unlock(&sc->sc_pcu_lock); - ath9k_ps_restore(sc); -} - -irqreturn_t ath_isr(int irq, void *dev) -{ -#define SCHED_INTR ( \ - ATH9K_INT_FATAL | \ - ATH9K_INT_BB_WATCHDOG | \ - ATH9K_INT_RXORN | \ - ATH9K_INT_RXEOL | \ - ATH9K_INT_RX | \ - ATH9K_INT_RXLP | \ - ATH9K_INT_RXHP | \ - ATH9K_INT_TX | \ - ATH9K_INT_BMISS | \ - ATH9K_INT_CST | \ - ATH9K_INT_TSFOOR | \ - ATH9K_INT_GENTIMER | \ - ATH9K_INT_MCI) - - struct ath_softc *sc = dev; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - enum ath9k_int status; - bool sched = false; - - /* - * The hardware is not ready/present, don't - * touch anything. Note this can happen early - * on if the IRQ is shared. - */ - if (test_bit(SC_OP_INVALID, &sc->sc_flags)) - return IRQ_NONE; - - /* shared irq, not for us */ - - if (!ath9k_hw_intrpend(ah)) - return IRQ_NONE; - - if (test_bit(SC_OP_HW_RESET, &sc->sc_flags)) { - ath9k_hw_kill_interrupts(ah); - return IRQ_HANDLED; - } - - /* - * Figure out the reason(s) for the interrupt. Note - * that the hal returns a pseudo-ISR that may include - * bits we haven't explicitly enabled so we mask the - * value to insure we only process bits we requested. - */ - ath9k_hw_getisr(ah, &status); /* NB: clears ISR too */ - status &= ah->imask; /* discard unasked-for bits */ - - /* - * If there are no status bits set, then this interrupt was not - * for me (should have been caught above). - */ - if (!status) - return IRQ_NONE; - - /* Cache the status */ - sc->intrstatus = status; - - if (status & SCHED_INTR) - sched = true; - - /* - * If a FATAL or RXORN interrupt is received, we have to reset the - * chip immediately. - */ - if ((status & ATH9K_INT_FATAL) || ((status & ATH9K_INT_RXORN) && - !(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA))) - goto chip_reset; - - if ((ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) && - (status & ATH9K_INT_BB_WATCHDOG)) { - - spin_lock(&common->cc_lock); - ath_hw_cycle_counters_update(common); - ar9003_hw_bb_watchdog_dbg_info(ah); - spin_unlock(&common->cc_lock); - - goto chip_reset; - } -#ifdef CONFIG_PM_SLEEP - if (status & ATH9K_INT_BMISS) { - if (atomic_read(&sc->wow_sleep_proc_intr) == 0) { - ath_dbg(common, ANY, "during WoW we got a BMISS\n"); - atomic_inc(&sc->wow_got_bmiss_intr); - atomic_dec(&sc->wow_sleep_proc_intr); - } - } -#endif - if (status & ATH9K_INT_SWBA) - tasklet_schedule(&sc->bcon_tasklet); - - if (status & ATH9K_INT_TXURN) - ath9k_hw_updatetxtriglevel(ah, true); - - if (status & ATH9K_INT_RXEOL) { - ah->imask &= ~(ATH9K_INT_RXEOL | ATH9K_INT_RXORN); - ath9k_hw_set_interrupts(ah); - } - - if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) - if (status & ATH9K_INT_TIM_TIMER) { - if (ATH_DBG_WARN_ON_ONCE(sc->ps_idle)) - goto chip_reset; - /* Clear RxAbort bit so that we can - * receive frames */ - ath9k_setpower(sc, ATH9K_PM_AWAKE); - spin_lock(&sc->sc_pm_lock); - ath9k_hw_setrxabort(sc->sc_ah, 0); - sc->ps_flags |= PS_WAIT_FOR_BEACON; - spin_unlock(&sc->sc_pm_lock); - } - -chip_reset: - - ath_debug_stat_interrupt(sc, status); - - if (sched) { - /* turn off every interrupt */ - ath9k_hw_disable_interrupts(ah); - tasklet_schedule(&sc->intr_tq); - } - - return IRQ_HANDLED; - -#undef SCHED_INTR -} - -static int ath_reset(struct ath_softc *sc) -{ - int r; - - ath9k_ps_wakeup(sc); - r = ath_reset_internal(sc, NULL); - ath9k_ps_restore(sc); - - return r; -} - -void ath9k_queue_reset(struct ath_softc *sc, enum ath_reset_type type) -{ -#ifdef CONFIG_ATH9K_DEBUGFS - RESET_STAT_INC(sc, type); -#endif - set_bit(SC_OP_HW_RESET, &sc->sc_flags); - ieee80211_queue_work(sc->hw, &sc->hw_reset_work); -} - -void ath_reset_work(struct work_struct *work) -{ - struct ath_softc *sc = container_of(work, struct ath_softc, hw_reset_work); - - ath_reset(sc); -} - -/**********************/ -/* mac80211 callbacks */ -/**********************/ - -static int ath9k_start(struct ieee80211_hw *hw) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ieee80211_channel *curchan = hw->conf.chandef.chan; - struct ath9k_channel *init_channel; - int r; - - ath_dbg(common, CONFIG, - "Starting driver with initial channel: %d MHz\n", - curchan->center_freq); - - ath9k_ps_wakeup(sc); - mutex_lock(&sc->mutex); - - init_channel = ath9k_cmn_get_curchannel(hw, ah); - - /* Reset SERDES registers */ - ath9k_hw_configpcipowersave(ah, false); - - /* - * The basic interface to setting the hardware in a good - * state is ``reset''. On return the hardware is known to - * be powered up and with interrupts disabled. This must - * be followed by initialization of the appropriate bits - * and then setup of the interrupt mask. - */ - spin_lock_bh(&sc->sc_pcu_lock); - - atomic_set(&ah->intr_ref_cnt, -1); - - r = ath9k_hw_reset(ah, init_channel, ah->caldata, false); - if (r) { - ath_err(common, - "Unable to reset hardware; reset status %d (freq %u MHz)\n", - r, curchan->center_freq); - ah->reset_power_on = false; - } - - /* Setup our intr mask. */ - ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL | - ATH9K_INT_RXORN | ATH9K_INT_FATAL | - ATH9K_INT_GLOBAL; - - if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) - ah->imask |= ATH9K_INT_RXHP | - ATH9K_INT_RXLP | - ATH9K_INT_BB_WATCHDOG; - else - ah->imask |= ATH9K_INT_RX; - - ah->imask |= ATH9K_INT_GTT; - - if (ah->caps.hw_caps & ATH9K_HW_CAP_HT) - ah->imask |= ATH9K_INT_CST; - - ath_mci_enable(sc); - - clear_bit(SC_OP_INVALID, &sc->sc_flags); - sc->sc_ah->is_monitoring = false; - - if (!ath_complete_reset(sc, false)) - ah->reset_power_on = false; - - if (ah->led_pin >= 0) { - ath9k_hw_cfg_output(ah, ah->led_pin, - AR_GPIO_OUTPUT_MUX_AS_OUTPUT); - ath9k_hw_set_gpio(ah, ah->led_pin, 0); - } - - /* - * Reset key cache to sane defaults (all entries cleared) instead of - * semi-random values after suspend/resume. - */ - ath9k_cmn_init_crypto(sc->sc_ah); - - spin_unlock_bh(&sc->sc_pcu_lock); - - mutex_unlock(&sc->mutex); - - ath9k_ps_restore(sc); - - return 0; -} - -static void ath9k_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct ath_softc *sc = hw->priv; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_tx_control txctl; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - unsigned long flags; - - if (sc->ps_enabled) { - /* - * mac80211 does not set PM field for normal data frames, so we - * need to update that based on the current PS mode. - */ - if (ieee80211_is_data(hdr->frame_control) && - !ieee80211_is_nullfunc(hdr->frame_control) && - !ieee80211_has_pm(hdr->frame_control)) { - ath_dbg(common, PS, - "Add PM=1 for a TX frame while in PS mode\n"); - hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); - } - } - - if (unlikely(sc->sc_ah->power_mode == ATH9K_PM_NETWORK_SLEEP)) { - /* - * We are using PS-Poll and mac80211 can request TX while in - * power save mode. Need to wake up hardware for the TX to be - * completed and if needed, also for RX of buffered frames. - */ - ath9k_ps_wakeup(sc); - spin_lock_irqsave(&sc->sc_pm_lock, flags); - if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) - ath9k_hw_setrxabort(sc->sc_ah, 0); - if (ieee80211_is_pspoll(hdr->frame_control)) { - ath_dbg(common, PS, - "Sending PS-Poll to pick a buffered frame\n"); - sc->ps_flags |= PS_WAIT_FOR_PSPOLL_DATA; - } else { - ath_dbg(common, PS, "Wake up to complete TX\n"); - sc->ps_flags |= PS_WAIT_FOR_TX_ACK; - } - /* - * The actual restore operation will happen only after - * the ps_flags bit is cleared. We are just dropping - * the ps_usecount here. - */ - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - ath9k_ps_restore(sc); - } - - /* - * Cannot tx while the hardware is in full sleep, it first needs a full - * chip reset to recover from that - */ - if (unlikely(sc->sc_ah->power_mode == ATH9K_PM_FULL_SLEEP)) { - ath_err(common, "TX while HW is in FULL_SLEEP mode\n"); - goto exit; - } - - memset(&txctl, 0, sizeof(struct ath_tx_control)); - txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)]; - txctl.sta = control->sta; - - ath_dbg(common, XMIT, "transmitting packet, skb: %p\n", skb); - - if (ath_tx_start(hw, skb, &txctl) != 0) { - ath_dbg(common, XMIT, "TX failed\n"); - TX_STAT_INC(txctl.txq->axq_qnum, txfailed); - goto exit; - } - - return; -exit: - ieee80211_free_txskb(hw, skb); -} - -static void ath9k_stop(struct ieee80211_hw *hw) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - bool prev_idle; - - mutex_lock(&sc->mutex); - - ath_cancel_work(sc); - del_timer_sync(&sc->rx_poll_timer); - - if (test_bit(SC_OP_INVALID, &sc->sc_flags)) { - ath_dbg(common, ANY, "Device not present\n"); - mutex_unlock(&sc->mutex); - return; - } - - /* Ensure HW is awake when we try to shut it down. */ - ath9k_ps_wakeup(sc); - - spin_lock_bh(&sc->sc_pcu_lock); - - /* prevent tasklets to enable interrupts once we disable them */ - ah->imask &= ~ATH9K_INT_GLOBAL; - - /* make sure h/w will not generate any interrupt - * before setting the invalid flag. */ - ath9k_hw_disable_interrupts(ah); - - spin_unlock_bh(&sc->sc_pcu_lock); - - /* we can now sync irq and kill any running tasklets, since we already - * disabled interrupts and not holding a spin lock */ - synchronize_irq(sc->irq); - tasklet_kill(&sc->intr_tq); - tasklet_kill(&sc->bcon_tasklet); - - prev_idle = sc->ps_idle; - sc->ps_idle = true; - - spin_lock_bh(&sc->sc_pcu_lock); - - if (ah->led_pin >= 0) { - ath9k_hw_set_gpio(ah, ah->led_pin, 1); - ath9k_hw_cfg_gpio_input(ah, ah->led_pin); - } - - ath_prepare_reset(sc); - - if (sc->rx.frag) { - dev_kfree_skb_any(sc->rx.frag); - sc->rx.frag = NULL; - } - - if (!ah->curchan) - ah->curchan = ath9k_cmn_get_curchannel(hw, ah); - - ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); - ath9k_hw_phy_disable(ah); - - ath9k_hw_configpcipowersave(ah, true); - - spin_unlock_bh(&sc->sc_pcu_lock); - - ath9k_ps_restore(sc); - - set_bit(SC_OP_INVALID, &sc->sc_flags); - sc->ps_idle = prev_idle; - - mutex_unlock(&sc->mutex); - - ath_dbg(common, CONFIG, "Driver halt\n"); -} - -bool ath9k_uses_beacons(int type) -{ - switch (type) { - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_MESH_POINT: - return true; - default: - return false; - } -} - -static void ath9k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) -{ - struct ath9k_vif_iter_data *iter_data = data; - int i; - - if (iter_data->has_hw_macaddr) { - for (i = 0; i < ETH_ALEN; i++) - iter_data->mask[i] &= - ~(iter_data->hw_macaddr[i] ^ mac[i]); - } else { - memcpy(iter_data->hw_macaddr, mac, ETH_ALEN); - iter_data->has_hw_macaddr = true; - } - - switch (vif->type) { - case NL80211_IFTYPE_AP: - iter_data->naps++; - break; - case NL80211_IFTYPE_STATION: - iter_data->nstations++; - break; - case NL80211_IFTYPE_ADHOC: - iter_data->nadhocs++; - break; - case NL80211_IFTYPE_MESH_POINT: - iter_data->nmeshes++; - break; - case NL80211_IFTYPE_WDS: - iter_data->nwds++; - break; - default: - break; - } -} - -static void ath9k_sta_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) -{ - struct ath_softc *sc = data; - struct ath_vif *avp = (void *)vif->drv_priv; - - if (vif->type != NL80211_IFTYPE_STATION) - return; - - if (avp->primary_sta_vif) - ath9k_set_assoc_state(sc, vif); -} - -/* Called with sc->mutex held. */ -void ath9k_calculate_iter_data(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ath9k_vif_iter_data *iter_data) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - - /* - * Pick the MAC address of the first interface as the new hardware - * MAC address. The hardware will use it together with the BSSID mask - * when matching addresses. - */ - memset(iter_data, 0, sizeof(*iter_data)); - memset(&iter_data->mask, 0xff, ETH_ALEN); - - if (vif) - ath9k_vif_iter(iter_data, vif->addr, vif); - - /* Get list of all active MAC addresses */ - ieee80211_iterate_active_interfaces_atomic( - sc->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - ath9k_vif_iter, iter_data); - - memcpy(common->macaddr, iter_data->hw_macaddr, ETH_ALEN); -} - -/* Called with sc->mutex held. */ -static void ath9k_calculate_summary_state(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_vif_iter_data iter_data; - enum nl80211_iftype old_opmode = ah->opmode; - - ath9k_calculate_iter_data(hw, vif, &iter_data); - - memcpy(common->bssidmask, iter_data.mask, ETH_ALEN); - ath_hw_setbssidmask(common); - - if (iter_data.naps > 0) { - ath9k_hw_set_tsfadjust(ah, true); - ah->opmode = NL80211_IFTYPE_AP; - } else { - ath9k_hw_set_tsfadjust(ah, false); - - if (iter_data.nmeshes) - ah->opmode = NL80211_IFTYPE_MESH_POINT; - else if (iter_data.nwds) - ah->opmode = NL80211_IFTYPE_AP; - else if (iter_data.nadhocs) - ah->opmode = NL80211_IFTYPE_ADHOC; - else - ah->opmode = NL80211_IFTYPE_STATION; - } - - ath9k_hw_setopmode(ah); - - if ((iter_data.nstations + iter_data.nadhocs + iter_data.nmeshes) > 0) - ah->imask |= ATH9K_INT_TSFOOR; - else - ah->imask &= ~ATH9K_INT_TSFOOR; - - ath9k_hw_set_interrupts(ah); - - /* - * If we are changing the opmode to STATION, - * a beacon sync needs to be done. - */ - if (ah->opmode == NL80211_IFTYPE_STATION && - old_opmode == NL80211_IFTYPE_AP && - test_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags)) { - ieee80211_iterate_active_interfaces_atomic( - sc->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - ath9k_sta_vif_iter, sc); - } -} - -static int ath9k_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - - mutex_lock(&sc->mutex); - - ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type); - sc->nvifs++; - - ath9k_ps_wakeup(sc); - ath9k_calculate_summary_state(hw, vif); - ath9k_ps_restore(sc); - - if (ath9k_uses_beacons(vif->type)) - ath9k_beacon_assign_slot(sc, vif); - - mutex_unlock(&sc->mutex); - return 0; -} - -static int ath9k_change_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum nl80211_iftype new_type, - bool p2p) -{ - struct ath_softc *sc = hw->priv; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - - ath_dbg(common, CONFIG, "Change Interface\n"); - mutex_lock(&sc->mutex); - - if (ath9k_uses_beacons(vif->type)) - ath9k_beacon_remove_slot(sc, vif); - - vif->type = new_type; - vif->p2p = p2p; - - ath9k_ps_wakeup(sc); - ath9k_calculate_summary_state(hw, vif); - ath9k_ps_restore(sc); - - if (ath9k_uses_beacons(vif->type)) - ath9k_beacon_assign_slot(sc, vif); - - mutex_unlock(&sc->mutex); - return 0; -} - -static void ath9k_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ath_softc *sc = hw->priv; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - - ath_dbg(common, CONFIG, "Detach Interface\n"); - - mutex_lock(&sc->mutex); - - sc->nvifs--; - - if (ath9k_uses_beacons(vif->type)) - ath9k_beacon_remove_slot(sc, vif); - - ath9k_ps_wakeup(sc); - ath9k_calculate_summary_state(hw, NULL); - ath9k_ps_restore(sc); - - mutex_unlock(&sc->mutex); -} - -static void ath9k_enable_ps(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - - sc->ps_enabled = true; - if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { - if ((ah->imask & ATH9K_INT_TIM_TIMER) == 0) { - ah->imask |= ATH9K_INT_TIM_TIMER; - ath9k_hw_set_interrupts(ah); - } - ath9k_hw_setrxabort(ah, 1); - } - ath_dbg(common, PS, "PowerSave enabled\n"); -} - -static void ath9k_disable_ps(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - - sc->ps_enabled = false; - ath9k_hw_setpower(ah, ATH9K_PM_AWAKE); - if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { - ath9k_hw_setrxabort(ah, 0); - sc->ps_flags &= ~(PS_WAIT_FOR_BEACON | - PS_WAIT_FOR_CAB | - PS_WAIT_FOR_PSPOLL_DATA | - PS_WAIT_FOR_TX_ACK); - if (ah->imask & ATH9K_INT_TIM_TIMER) { - ah->imask &= ~ATH9K_INT_TIM_TIMER; - ath9k_hw_set_interrupts(ah); - } - } - ath_dbg(common, PS, "PowerSave disabled\n"); -} - -void ath9k_spectral_scan_trigger(struct ieee80211_hw *hw) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - u32 rxfilter; - - if (!ath9k_hw_ops(ah)->spectral_scan_trigger) { - ath_err(common, "spectrum analyzer not implemented on this hardware\n"); - return; - } - - ath9k_ps_wakeup(sc); - rxfilter = ath9k_hw_getrxfilter(ah); - ath9k_hw_setrxfilter(ah, rxfilter | - ATH9K_RX_FILTER_PHYRADAR | - ATH9K_RX_FILTER_PHYERR); - - /* TODO: usually this should not be neccesary, but for some reason - * (or in some mode?) the trigger must be called after the - * configuration, otherwise the register will have its values reset - * (on my ar9220 to value 0x01002310) - */ - ath9k_spectral_scan_config(hw, sc->spectral_mode); - ath9k_hw_ops(ah)->spectral_scan_trigger(ah); - ath9k_ps_restore(sc); -} - -int ath9k_spectral_scan_config(struct ieee80211_hw *hw, - enum spectral_mode spectral_mode) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - - if (!ath9k_hw_ops(ah)->spectral_scan_trigger) { - ath_err(common, "spectrum analyzer not implemented on this hardware\n"); - return -1; - } - - switch (spectral_mode) { - case SPECTRAL_DISABLED: - sc->spec_config.enabled = 0; - break; - case SPECTRAL_BACKGROUND: - /* send endless samples. - * TODO: is this really useful for "background"? - */ - sc->spec_config.endless = 1; - sc->spec_config.enabled = 1; - break; - case SPECTRAL_CHANSCAN: - case SPECTRAL_MANUAL: - sc->spec_config.endless = 0; - sc->spec_config.enabled = 1; - break; - default: - return -1; - } - - ath9k_ps_wakeup(sc); - ath9k_hw_ops(ah)->spectral_scan_config(ah, &sc->spec_config); - ath9k_ps_restore(sc); - - sc->spectral_mode = spectral_mode; - - return 0; -} - -static int ath9k_config(struct ieee80211_hw *hw, u32 changed) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ieee80211_conf *conf = &hw->conf; - bool reset_channel = false; - - ath9k_ps_wakeup(sc); - mutex_lock(&sc->mutex); - - if (changed & IEEE80211_CONF_CHANGE_IDLE) { - sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE); - if (sc->ps_idle) { - ath_cancel_work(sc); - ath9k_stop_btcoex(sc); - } else { - ath9k_start_btcoex(sc); - /* - * The chip needs a reset to properly wake up from - * full sleep - */ - reset_channel = ah->chip_fullsleep; - } - } - - /* - * We just prepare to enable PS. We have to wait until our AP has - * ACK'd our null data frame to disable RX otherwise we'll ignore - * those ACKs and end up retransmitting the same null data frames. - * IEEE80211_CONF_CHANGE_PS is only passed by mac80211 for STA mode. - */ - if (changed & IEEE80211_CONF_CHANGE_PS) { - unsigned long flags; - spin_lock_irqsave(&sc->sc_pm_lock, flags); - if (conf->flags & IEEE80211_CONF_PS) - ath9k_enable_ps(sc); - else - ath9k_disable_ps(sc); - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - } - - if (changed & IEEE80211_CONF_CHANGE_MONITOR) { - if (conf->flags & IEEE80211_CONF_MONITOR) { - ath_dbg(common, CONFIG, "Monitor mode is enabled\n"); - sc->sc_ah->is_monitoring = true; - } else { - ath_dbg(common, CONFIG, "Monitor mode is disabled\n"); - sc->sc_ah->is_monitoring = false; - } - } - - if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) { - struct ieee80211_channel *curchan = hw->conf.chandef.chan; - enum nl80211_channel_type channel_type = - cfg80211_get_chandef_type(&conf->chandef); - int pos = curchan->hw_value; - int old_pos = -1; - unsigned long flags; - - if (ah->curchan) - old_pos = ah->curchan - &ah->channels[0]; - - ath_dbg(common, CONFIG, "Set channel: %d MHz type: %d\n", - curchan->center_freq, channel_type); - - /* update survey stats for the old channel before switching */ - spin_lock_irqsave(&common->cc_lock, flags); - ath_update_survey_stats(sc); - spin_unlock_irqrestore(&common->cc_lock, flags); - - ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos], - curchan, channel_type); - - /* - * If the operating channel changes, change the survey in-use flags - * along with it. - * Reset the survey data for the new channel, unless we're switching - * back to the operating channel from an off-channel operation. - */ - if (!(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL) && - sc->cur_survey != &sc->survey[pos]) { - - if (sc->cur_survey) - sc->cur_survey->filled &= ~SURVEY_INFO_IN_USE; - - sc->cur_survey = &sc->survey[pos]; - - memset(sc->cur_survey, 0, sizeof(struct survey_info)); - sc->cur_survey->filled |= SURVEY_INFO_IN_USE; - } else if (!(sc->survey[pos].filled & SURVEY_INFO_IN_USE)) { - memset(&sc->survey[pos], 0, sizeof(struct survey_info)); - } - - if (ath_set_channel(sc, hw, &sc->sc_ah->channels[pos]) < 0) { - ath_err(common, "Unable to set channel\n"); - mutex_unlock(&sc->mutex); - ath9k_ps_restore(sc); - return -EINVAL; - } - - /* - * The most recent snapshot of channel->noisefloor for the old - * channel is only available after the hardware reset. Copy it to - * the survey stats now. - */ - if (old_pos >= 0) - ath_update_survey_nf(sc, old_pos); - - /* - * Enable radar pulse detection if on a DFS channel. Spectral - * scanning and radar detection can not be used concurrently. - */ - if (hw->conf.radar_enabled) { - u32 rxfilter; - - /* set HW specific DFS configuration */ - ath9k_hw_set_radar_params(ah); - rxfilter = ath9k_hw_getrxfilter(ah); - rxfilter |= ATH9K_RX_FILTER_PHYRADAR | - ATH9K_RX_FILTER_PHYERR; - ath9k_hw_setrxfilter(ah, rxfilter); - ath_dbg(common, DFS, "DFS enabled at freq %d\n", - curchan->center_freq); - } else { - /* perform spectral scan if requested. */ - if (sc->scanning && - sc->spectral_mode == SPECTRAL_CHANSCAN) - ath9k_spectral_scan_trigger(hw); - } - } - - if (changed & IEEE80211_CONF_CHANGE_POWER) { - ath_dbg(common, CONFIG, "Set power: %d\n", conf->power_level); - sc->config.txpowlimit = 2 * conf->power_level; - ath9k_cmn_update_txpow(ah, sc->curtxpow, - sc->config.txpowlimit, &sc->curtxpow); - } - - mutex_unlock(&sc->mutex); - ath9k_ps_restore(sc); - - return 0; -} - -#define SUPPORTED_FILTERS \ - (FIF_PROMISC_IN_BSS | \ - FIF_ALLMULTI | \ - FIF_CONTROL | \ - FIF_PSPOLL | \ - FIF_OTHER_BSS | \ - FIF_BCN_PRBRESP_PROMISC | \ - FIF_PROBE_REQ | \ - FIF_FCSFAIL) - -/* FIXME: sc->sc_full_reset ? */ -static void ath9k_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast) -{ - struct ath_softc *sc = hw->priv; - u32 rfilt; - - changed_flags &= SUPPORTED_FILTERS; - *total_flags &= SUPPORTED_FILTERS; - - sc->rx.rxfilter = *total_flags; - ath9k_ps_wakeup(sc); - rfilt = ath_calcrxfilter(sc); - ath9k_hw_setrxfilter(sc->sc_ah, rfilt); - ath9k_ps_restore(sc); - - ath_dbg(ath9k_hw_common(sc->sc_ah), CONFIG, "Set HW RX filter: 0x%x\n", - rfilt); -} - -static int ath9k_sta_add(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct ath_softc *sc = hw->priv; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_node *an = (struct ath_node *) sta->drv_priv; - struct ieee80211_key_conf ps_key = { }; - int key; - - ath_node_attach(sc, sta, vif); - - if (vif->type != NL80211_IFTYPE_AP && - vif->type != NL80211_IFTYPE_AP_VLAN) - return 0; - - key = ath_key_config(common, vif, sta, &ps_key); - if (key > 0) - an->ps_key = key; - - return 0; -} - -static void ath9k_del_ps_key(struct ath_softc *sc, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_node *an = (struct ath_node *) sta->drv_priv; - struct ieee80211_key_conf ps_key = { .hw_key_idx = an->ps_key }; - - if (!an->ps_key) - return; - - ath_key_delete(common, &ps_key); - an->ps_key = 0; -} - -static int ath9k_sta_remove(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct ath_softc *sc = hw->priv; - - ath9k_del_ps_key(sc, vif, sta); - ath_node_detach(sc, sta); - - return 0; -} - -static void ath9k_sta_notify(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum sta_notify_cmd cmd, - struct ieee80211_sta *sta) -{ - struct ath_softc *sc = hw->priv; - struct ath_node *an = (struct ath_node *) sta->drv_priv; - - if (!sta->ht_cap.ht_supported) - return; - - switch (cmd) { - case STA_NOTIFY_SLEEP: - an->sleeping = true; - ath_tx_aggr_sleep(sta, sc, an); - break; - case STA_NOTIFY_AWAKE: - an->sleeping = false; - ath_tx_aggr_wakeup(sc, an); - break; - } -} - -static int ath9k_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - struct ath_softc *sc = hw->priv; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_txq *txq; - struct ath9k_tx_queue_info qi; - int ret = 0; - - if (queue >= IEEE80211_NUM_ACS) - return 0; - - txq = sc->tx.txq_map[queue]; - - ath9k_ps_wakeup(sc); - mutex_lock(&sc->mutex); - - memset(&qi, 0, sizeof(struct ath9k_tx_queue_info)); - - qi.tqi_aifs = params->aifs; - qi.tqi_cwmin = params->cw_min; - qi.tqi_cwmax = params->cw_max; - qi.tqi_burstTime = params->txop * 32; - - ath_dbg(common, CONFIG, - "Configure tx [queue/halq] [%d/%d], aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n", - queue, txq->axq_qnum, params->aifs, params->cw_min, - params->cw_max, params->txop); - - ath_update_max_aggr_framelen(sc, queue, qi.tqi_burstTime); - ret = ath_txq_update(sc, txq->axq_qnum, &qi); - if (ret) - ath_err(common, "TXQ Update failed\n"); - - mutex_unlock(&sc->mutex); - ath9k_ps_restore(sc); - - return ret; -} - -static int ath9k_set_key(struct ieee80211_hw *hw, - enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct ath_softc *sc = hw->priv; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - int ret = 0; - - if (ath9k_modparam_nohwcrypt) - return -ENOSPC; - - if ((vif->type == NL80211_IFTYPE_ADHOC || - vif->type == NL80211_IFTYPE_MESH_POINT) && - (key->cipher == WLAN_CIPHER_SUITE_TKIP || - key->cipher == WLAN_CIPHER_SUITE_CCMP) && - !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { - /* - * For now, disable hw crypto for the RSN IBSS group keys. This - * could be optimized in the future to use a modified key cache - * design to support per-STA RX GTK, but until that gets - * implemented, use of software crypto for group addressed - * frames is a acceptable to allow RSN IBSS to be used. - */ - return -EOPNOTSUPP; - } - - mutex_lock(&sc->mutex); - ath9k_ps_wakeup(sc); - ath_dbg(common, CONFIG, "Set HW Key\n"); - - switch (cmd) { - case SET_KEY: - if (sta) - ath9k_del_ps_key(sc, vif, sta); - - ret = ath_key_config(common, vif, sta, key); - if (ret >= 0) { - key->hw_key_idx = ret; - /* push IV and Michael MIC generation to stack */ - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - if (key->cipher == WLAN_CIPHER_SUITE_TKIP) - key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; - if (sc->sc_ah->sw_mgmt_crypto && - key->cipher == WLAN_CIPHER_SUITE_CCMP) - key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; - ret = 0; - } - break; - case DISABLE_KEY: - ath_key_delete(common, key); - break; - default: - ret = -EINVAL; - } - - ath9k_ps_restore(sc); - mutex_unlock(&sc->mutex); - - return ret; -} - -static void ath9k_set_assoc_state(struct ath_softc *sc, - struct ieee80211_vif *vif) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_vif *avp = (void *)vif->drv_priv; - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; - unsigned long flags; - - set_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags); - avp->primary_sta_vif = true; - - /* - * Set the AID, BSSID and do beacon-sync only when - * the HW opmode is STATION. - * - * But the primary bit is set above in any case. - */ - if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION) - return; - - memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); - common->curaid = bss_conf->aid; - ath9k_hw_write_associd(sc->sc_ah); - - sc->last_rssi = ATH_RSSI_DUMMY_MARKER; - sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER; - - spin_lock_irqsave(&sc->sc_pm_lock, flags); - sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON; - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - - if (ath9k_hw_mci_is_enabled(sc->sc_ah)) - ath9k_mci_update_wlan_channels(sc, false); - - ath_dbg(common, CONFIG, - "Primary Station interface: %pM, BSSID: %pM\n", - vif->addr, common->curbssid); -} - -static void ath9k_bss_assoc_iter(void *data, u8 *mac, struct ieee80211_vif *vif) -{ - struct ath_softc *sc = data; - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; - - if (test_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags)) - return; - - if (bss_conf->assoc) - ath9k_set_assoc_state(sc, vif); -} - -static void ath9k_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changed) -{ -#define CHECK_ANI \ - (BSS_CHANGED_ASSOC | \ - BSS_CHANGED_IBSS | \ - BSS_CHANGED_BEACON_ENABLED) - - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath_vif *avp = (void *)vif->drv_priv; - int slottime; - - ath9k_ps_wakeup(sc); - mutex_lock(&sc->mutex); - - if (changed & BSS_CHANGED_ASSOC) { - ath_dbg(common, CONFIG, "BSSID %pM Changed ASSOC %d\n", - bss_conf->bssid, bss_conf->assoc); - - if (avp->primary_sta_vif && !bss_conf->assoc) { - clear_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags); - avp->primary_sta_vif = false; - - if (ah->opmode == NL80211_IFTYPE_STATION) - clear_bit(SC_OP_BEACONS, &sc->sc_flags); - } - - ieee80211_iterate_active_interfaces_atomic( - sc->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - ath9k_bss_assoc_iter, sc); - - if (!test_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags) && - ah->opmode == NL80211_IFTYPE_STATION) { - memset(common->curbssid, 0, ETH_ALEN); - common->curaid = 0; - ath9k_hw_write_associd(sc->sc_ah); - if (ath9k_hw_mci_is_enabled(sc->sc_ah)) - ath9k_mci_update_wlan_channels(sc, true); - } - } - - if (changed & BSS_CHANGED_IBSS) { - memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); - common->curaid = bss_conf->aid; - ath9k_hw_write_associd(sc->sc_ah); - } - - if ((changed & BSS_CHANGED_BEACON_ENABLED) || - (changed & BSS_CHANGED_BEACON_INT)) { - if (ah->opmode == NL80211_IFTYPE_AP && - bss_conf->enable_beacon) - ath9k_set_tsfadjust(sc, vif); - if (ath9k_allow_beacon_config(sc, vif)) - ath9k_beacon_config(sc, vif, changed); - } - - if (changed & BSS_CHANGED_ERP_SLOT) { - if (bss_conf->use_short_slot) - slottime = 9; - else - slottime = 20; - if (vif->type == NL80211_IFTYPE_AP) { - /* - * Defer update, so that connected stations can adjust - * their settings at the same time. - * See beacon.c for more details - */ - sc->beacon.slottime = slottime; - sc->beacon.updateslot = UPDATE; - } else { - ah->slottime = slottime; - ath9k_hw_init_global_settings(ah); - } - } - - if (changed & CHECK_ANI) - ath_check_ani(sc); - - mutex_unlock(&sc->mutex); - ath9k_ps_restore(sc); - -#undef CHECK_ANI -} - -static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct ath_softc *sc = hw->priv; - u64 tsf; - - mutex_lock(&sc->mutex); - ath9k_ps_wakeup(sc); - tsf = ath9k_hw_gettsf64(sc->sc_ah); - ath9k_ps_restore(sc); - mutex_unlock(&sc->mutex); - - return tsf; -} - -static void ath9k_set_tsf(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - u64 tsf) -{ - struct ath_softc *sc = hw->priv; - - mutex_lock(&sc->mutex); - ath9k_ps_wakeup(sc); - ath9k_hw_settsf64(sc->sc_ah, tsf); - ath9k_ps_restore(sc); - mutex_unlock(&sc->mutex); -} - -static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct ath_softc *sc = hw->priv; - - mutex_lock(&sc->mutex); - - ath9k_ps_wakeup(sc); - ath9k_hw_reset_tsf(sc->sc_ah); - ath9k_ps_restore(sc); - - mutex_unlock(&sc->mutex); -} - -static int ath9k_ampdu_action(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, - u16 tid, u16 *ssn, u8 buf_size) -{ - struct ath_softc *sc = hw->priv; - bool flush = false; - int ret = 0; - - local_bh_disable(); - - switch (action) { - case IEEE80211_AMPDU_RX_START: - break; - case IEEE80211_AMPDU_RX_STOP: - break; - case IEEE80211_AMPDU_TX_START: - ath9k_ps_wakeup(sc); - ret = ath_tx_aggr_start(sc, sta, tid, ssn); - if (!ret) - ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); - ath9k_ps_restore(sc); - break; - case IEEE80211_AMPDU_TX_STOP_FLUSH: - case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: - flush = true; - case IEEE80211_AMPDU_TX_STOP_CONT: - ath9k_ps_wakeup(sc); - ath_tx_aggr_stop(sc, sta, tid); - if (!flush) - ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); - ath9k_ps_restore(sc); - break; - case IEEE80211_AMPDU_TX_OPERATIONAL: - ath9k_ps_wakeup(sc); - ath_tx_aggr_resume(sc, sta, tid); - ath9k_ps_restore(sc); - break; - default: - ath_err(ath9k_hw_common(sc->sc_ah), "Unknown AMPDU action\n"); - } - - local_bh_enable(); - - return ret; -} - -static int ath9k_get_survey(struct ieee80211_hw *hw, int idx, - struct survey_info *survey) -{ - struct ath_softc *sc = hw->priv; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ieee80211_supported_band *sband; - struct ieee80211_channel *chan; - unsigned long flags; - int pos; - - spin_lock_irqsave(&common->cc_lock, flags); - if (idx == 0) - ath_update_survey_stats(sc); - - sband = hw->wiphy->bands[IEEE80211_BAND_2GHZ]; - if (sband && idx >= sband->n_channels) { - idx -= sband->n_channels; - sband = NULL; - } - - if (!sband) - sband = hw->wiphy->bands[IEEE80211_BAND_5GHZ]; - - if (!sband || idx >= sband->n_channels) { - spin_unlock_irqrestore(&common->cc_lock, flags); - return -ENOENT; - } - - chan = &sband->channels[idx]; - pos = chan->hw_value; - memcpy(survey, &sc->survey[pos], sizeof(*survey)); - survey->channel = chan; - spin_unlock_irqrestore(&common->cc_lock, flags); - - return 0; -} - -static void ath9k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - - mutex_lock(&sc->mutex); - ah->coverage_class = coverage_class; - - ath9k_ps_wakeup(sc); - ath9k_hw_init_global_settings(ah); - ath9k_ps_restore(sc); - - mutex_unlock(&sc->mutex); -} - -static void ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - int timeout = 200; /* ms */ - int i, j; - bool drain_txq; - - mutex_lock(&sc->mutex); - cancel_delayed_work_sync(&sc->tx_complete_work); - - if (ah->ah_flags & AH_UNPLUGGED) { - ath_dbg(common, ANY, "Device has been unplugged!\n"); - mutex_unlock(&sc->mutex); - return; - } - - if (test_bit(SC_OP_INVALID, &sc->sc_flags)) { - ath_dbg(common, ANY, "Device not present\n"); - mutex_unlock(&sc->mutex); - return; - } - - for (j = 0; j < timeout; j++) { - bool npend = false; - - if (j) - usleep_range(1000, 2000); - - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { - if (!ATH_TXQ_SETUP(sc, i)) - continue; - - npend = ath9k_has_pending_frames(sc, &sc->tx.txq[i]); - - if (npend) - break; - } - - if (!npend) - break; - } - - if (drop) { - ath9k_ps_wakeup(sc); - spin_lock_bh(&sc->sc_pcu_lock); - drain_txq = ath_drain_all_txq(sc); - spin_unlock_bh(&sc->sc_pcu_lock); - - if (!drain_txq) - ath_reset(sc); - - ath9k_ps_restore(sc); - ieee80211_wake_queues(hw); - } - - ieee80211_queue_delayed_work(hw, &sc->tx_complete_work, 0); - mutex_unlock(&sc->mutex); -} - -static bool ath9k_tx_frames_pending(struct ieee80211_hw *hw) -{ - struct ath_softc *sc = hw->priv; - int i; - - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { - if (!ATH_TXQ_SETUP(sc, i)) - continue; - - if (ath9k_has_pending_frames(sc, &sc->tx.txq[i])) - return true; - } - return false; -} - -static int ath9k_tx_last_beacon(struct ieee80211_hw *hw) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ieee80211_vif *vif; - struct ath_vif *avp; - struct ath_buf *bf; - struct ath_tx_status ts; - bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA); - int status; - - vif = sc->beacon.bslot[0]; - if (!vif) - return 0; - - if (!vif->bss_conf.enable_beacon) - return 0; - - avp = (void *)vif->drv_priv; - - if (!sc->beacon.tx_processed && !edma) { - tasklet_disable(&sc->bcon_tasklet); - - bf = avp->av_bcbuf; - if (!bf || !bf->bf_mpdu) - goto skip; - - status = ath9k_hw_txprocdesc(ah, bf->bf_desc, &ts); - if (status == -EINPROGRESS) - goto skip; - - sc->beacon.tx_processed = true; - sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK); - -skip: - tasklet_enable(&sc->bcon_tasklet); - } - - return sc->beacon.tx_last; -} - -static int ath9k_get_stats(struct ieee80211_hw *hw, - struct ieee80211_low_level_stats *stats) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath9k_mib_stats *mib_stats = &ah->ah_mibStats; - - stats->dot11ACKFailureCount = mib_stats->ackrcv_bad; - stats->dot11RTSFailureCount = mib_stats->rts_bad; - stats->dot11FCSErrorCount = mib_stats->fcs_bad; - stats->dot11RTSSuccessCount = mib_stats->rts_good; - return 0; -} - -static u32 fill_chainmask(u32 cap, u32 new) -{ - u32 filled = 0; - int i; - - for (i = 0; cap && new; i++, cap >>= 1) { - if (!(cap & BIT(0))) - continue; - - if (new & BIT(0)) - filled |= BIT(i); - - new >>= 1; - } - - return filled; -} - -static bool validate_antenna_mask(struct ath_hw *ah, u32 val) -{ - if (AR_SREV_9300_20_OR_LATER(ah)) - return true; - - switch (val & 0x7) { - case 0x1: - case 0x3: - case 0x7: - return true; - case 0x2: - return (ah->caps.rx_chainmask == 1); - default: - return false; - } -} - -static int ath9k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - - if (ah->caps.rx_chainmask != 1) - rx_ant |= tx_ant; - - if (!validate_antenna_mask(ah, rx_ant) || !tx_ant) - return -EINVAL; - - sc->ant_rx = rx_ant; - sc->ant_tx = tx_ant; - - if (ah->caps.rx_chainmask == 1) - return 0; - - /* AR9100 runs into calibration issues if not all rx chains are enabled */ - if (AR_SREV_9100(ah)) - ah->rxchainmask = 0x7; - else - ah->rxchainmask = fill_chainmask(ah->caps.rx_chainmask, rx_ant); - - ah->txchainmask = fill_chainmask(ah->caps.tx_chainmask, tx_ant); - ath9k_reload_chainmask_settings(sc); - - return 0; -} - -static int ath9k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) -{ - struct ath_softc *sc = hw->priv; - - *tx_ant = sc->ant_tx; - *rx_ant = sc->ant_rx; - return 0; -} - -#ifdef CONFIG_PM_SLEEP - -static void ath9k_wow_map_triggers(struct ath_softc *sc, - struct cfg80211_wowlan *wowlan, - u32 *wow_triggers) -{ - if (wowlan->disconnect) - *wow_triggers |= AH_WOW_LINK_CHANGE | - AH_WOW_BEACON_MISS; - if (wowlan->magic_pkt) - *wow_triggers |= AH_WOW_MAGIC_PATTERN_EN; - - if (wowlan->n_patterns) - *wow_triggers |= AH_WOW_USER_PATTERN_EN; - - sc->wow_enabled = *wow_triggers; - -} - -static void ath9k_wow_add_disassoc_deauth_pattern(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_capabilities *pcaps = &ah->caps; - int pattern_count = 0; - int i, byte_cnt; - u8 dis_deauth_pattern[MAX_PATTERN_SIZE]; - u8 dis_deauth_mask[MAX_PATTERN_SIZE]; - - memset(dis_deauth_pattern, 0, MAX_PATTERN_SIZE); - memset(dis_deauth_mask, 0, MAX_PATTERN_SIZE); - - /* - * Create Dissassociate / Deauthenticate packet filter - * - * 2 bytes 2 byte 6 bytes 6 bytes 6 bytes - * +--------------+----------+---------+--------+--------+---- - * + Frame Control+ Duration + DA + SA + BSSID + - * +--------------+----------+---------+--------+--------+---- - * - * The above is the management frame format for disassociate/ - * deauthenticate pattern, from this we need to match the first byte - * of 'Frame Control' and DA, SA, and BSSID fields - * (skipping 2nd byte of FC and Duration feild. - * - * Disassociate pattern - * -------------------- - * Frame control = 00 00 1010 - * DA, SA, BSSID = x:x:x:x:x:x - * Pattern will be A0000000 | x:x:x:x:x:x | x:x:x:x:x:x - * | x:x:x:x:x:x -- 22 bytes - * - * Deauthenticate pattern - * ---------------------- - * Frame control = 00 00 1100 - * DA, SA, BSSID = x:x:x:x:x:x - * Pattern will be C0000000 | x:x:x:x:x:x | x:x:x:x:x:x - * | x:x:x:x:x:x -- 22 bytes - */ - - /* Create Disassociate Pattern first */ - - byte_cnt = 0; - - /* Fill out the mask with all FF's */ - - for (i = 0; i < MAX_PATTERN_MASK_SIZE; i++) - dis_deauth_mask[i] = 0xff; - - /* copy the first byte of frame control field */ - dis_deauth_pattern[byte_cnt] = 0xa0; - byte_cnt++; - - /* skip 2nd byte of frame control and Duration field */ - byte_cnt += 3; - - /* - * need not match the destination mac address, it can be a broadcast - * mac address or an unicast to this station - */ - byte_cnt += 6; - - /* copy the source mac address */ - memcpy((dis_deauth_pattern + byte_cnt), common->curbssid, ETH_ALEN); - - byte_cnt += 6; - - /* copy the bssid, its same as the source mac address */ - - memcpy((dis_deauth_pattern + byte_cnt), common->curbssid, ETH_ALEN); - - /* Create Disassociate pattern mask */ - - if (pcaps->hw_caps & ATH9K_HW_WOW_PATTERN_MATCH_EXACT) { - - if (pcaps->hw_caps & ATH9K_HW_WOW_PATTERN_MATCH_DWORD) { - /* - * for AR9280, because of hardware limitation, the - * first 4 bytes have to be matched for all patterns. - * the mask for disassociation and de-auth pattern - * matching need to enable the first 4 bytes. - * also the duration field needs to be filled. - */ - dis_deauth_mask[0] = 0xf0; - - /* - * fill in duration field - FIXME: what is the exact value ? - */ - dis_deauth_pattern[2] = 0xff; - dis_deauth_pattern[3] = 0xff; - } else { - dis_deauth_mask[0] = 0xfe; - } - - dis_deauth_mask[1] = 0x03; - dis_deauth_mask[2] = 0xc0; - } else { - dis_deauth_mask[0] = 0xef; - dis_deauth_mask[1] = 0x3f; - dis_deauth_mask[2] = 0x00; - dis_deauth_mask[3] = 0xfc; - } - - ath_dbg(common, WOW, "Adding disassoc/deauth patterns for WoW\n"); - - ath9k_hw_wow_apply_pattern(ah, dis_deauth_pattern, dis_deauth_mask, - pattern_count, byte_cnt); - - pattern_count++; - /* - * for de-authenticate pattern, only the first byte of the frame - * control field gets changed from 0xA0 to 0xC0 - */ - dis_deauth_pattern[0] = 0xC0; - - ath9k_hw_wow_apply_pattern(ah, dis_deauth_pattern, dis_deauth_mask, - pattern_count, byte_cnt); - -} - -static void ath9k_wow_add_pattern(struct ath_softc *sc, - struct cfg80211_wowlan *wowlan) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath9k_wow_pattern *wow_pattern = NULL; - struct cfg80211_wowlan_trig_pkt_pattern *patterns = wowlan->patterns; - int mask_len; - s8 i = 0; - - if (!wowlan->n_patterns) - return; - - /* - * Add the new user configured patterns - */ - for (i = 0; i < wowlan->n_patterns; i++) { - - wow_pattern = kzalloc(sizeof(*wow_pattern), GFP_KERNEL); - - if (!wow_pattern) - return; - - /* - * TODO: convert the generic user space pattern to - * appropriate chip specific/802.11 pattern. - */ - - mask_len = DIV_ROUND_UP(wowlan->patterns[i].pattern_len, 8); - memset(wow_pattern->pattern_bytes, 0, MAX_PATTERN_SIZE); - memset(wow_pattern->mask_bytes, 0, MAX_PATTERN_SIZE); - memcpy(wow_pattern->pattern_bytes, patterns[i].pattern, - patterns[i].pattern_len); - memcpy(wow_pattern->mask_bytes, patterns[i].mask, mask_len); - wow_pattern->pattern_len = patterns[i].pattern_len; - - /* - * just need to take care of deauth and disssoc pattern, - * make sure we don't overwrite them. - */ - - ath9k_hw_wow_apply_pattern(ah, wow_pattern->pattern_bytes, - wow_pattern->mask_bytes, - i + 2, - wow_pattern->pattern_len); - kfree(wow_pattern); - - } - -} - -static int ath9k_suspend(struct ieee80211_hw *hw, - struct cfg80211_wowlan *wowlan) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - u32 wow_triggers_enabled = 0; - int ret = 0; - - mutex_lock(&sc->mutex); - - ath_cancel_work(sc); - ath_stop_ani(sc); - del_timer_sync(&sc->rx_poll_timer); - - if (test_bit(SC_OP_INVALID, &sc->sc_flags)) { - ath_dbg(common, ANY, "Device not present\n"); - ret = -EINVAL; - goto fail_wow; - } - - if (WARN_ON(!wowlan)) { - ath_dbg(common, WOW, "None of the WoW triggers enabled\n"); - ret = -EINVAL; - goto fail_wow; - } - - if (!device_can_wakeup(sc->dev)) { - ath_dbg(common, WOW, "device_can_wakeup failed, WoW is not enabled\n"); - ret = 1; - goto fail_wow; - } - - /* - * none of the sta vifs are associated - * and we are not currently handling multivif - * cases, for instance we have to seperately - * configure 'keep alive frame' for each - * STA. - */ - - if (!test_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags)) { - ath_dbg(common, WOW, "None of the STA vifs are associated\n"); - ret = 1; - goto fail_wow; - } - - if (sc->nvifs > 1) { - ath_dbg(common, WOW, "WoW for multivif is not yet supported\n"); - ret = 1; - goto fail_wow; - } - - ath9k_wow_map_triggers(sc, wowlan, &wow_triggers_enabled); - - ath_dbg(common, WOW, "WoW triggers enabled 0x%x\n", - wow_triggers_enabled); - - ath9k_ps_wakeup(sc); - - ath9k_stop_btcoex(sc); - - /* - * Enable wake up on recieving disassoc/deauth - * frame by default. - */ - ath9k_wow_add_disassoc_deauth_pattern(sc); - - if (wow_triggers_enabled & AH_WOW_USER_PATTERN_EN) - ath9k_wow_add_pattern(sc, wowlan); - - spin_lock_bh(&sc->sc_pcu_lock); - /* - * To avoid false wake, we enable beacon miss interrupt only - * when we go to sleep. We save the current interrupt mask - * so we can restore it after the system wakes up - */ - sc->wow_intr_before_sleep = ah->imask; - ah->imask &= ~ATH9K_INT_GLOBAL; - ath9k_hw_disable_interrupts(ah); - ah->imask = ATH9K_INT_BMISS | ATH9K_INT_GLOBAL; - ath9k_hw_set_interrupts(ah); - ath9k_hw_enable_interrupts(ah); - - spin_unlock_bh(&sc->sc_pcu_lock); - - /* - * we can now sync irq and kill any running tasklets, since we already - * disabled interrupts and not holding a spin lock - */ - synchronize_irq(sc->irq); - tasklet_kill(&sc->intr_tq); - - ath9k_hw_wow_enable(ah, wow_triggers_enabled); - - ath9k_ps_restore(sc); - ath_dbg(common, ANY, "WoW enabled in ath9k\n"); - atomic_inc(&sc->wow_sleep_proc_intr); - -fail_wow: - mutex_unlock(&sc->mutex); - return ret; -} - -static int ath9k_resume(struct ieee80211_hw *hw) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - u32 wow_status; - - mutex_lock(&sc->mutex); - - ath9k_ps_wakeup(sc); - - spin_lock_bh(&sc->sc_pcu_lock); - - ath9k_hw_disable_interrupts(ah); - ah->imask = sc->wow_intr_before_sleep; - ath9k_hw_set_interrupts(ah); - ath9k_hw_enable_interrupts(ah); - - spin_unlock_bh(&sc->sc_pcu_lock); - - wow_status = ath9k_hw_wow_wakeup(ah); - - if (atomic_read(&sc->wow_got_bmiss_intr) == 0) { - /* - * some devices may not pick beacon miss - * as the reason they woke up so we add - * that here for that shortcoming. - */ - wow_status |= AH_WOW_BEACON_MISS; - atomic_dec(&sc->wow_got_bmiss_intr); - ath_dbg(common, ANY, "Beacon miss interrupt picked up during WoW sleep\n"); - } - - atomic_dec(&sc->wow_sleep_proc_intr); - - if (wow_status) { - ath_dbg(common, ANY, "Waking up due to WoW triggers %s with WoW status = %x\n", - ath9k_hw_wow_event_to_string(wow_status), wow_status); - } - - ath_restart_work(sc); - ath9k_start_btcoex(sc); - - ath9k_ps_restore(sc); - mutex_unlock(&sc->mutex); - - return 0; -} - -static void ath9k_set_wakeup(struct ieee80211_hw *hw, bool enabled) -{ - struct ath_softc *sc = hw->priv; - - mutex_lock(&sc->mutex); - device_init_wakeup(sc->dev, 1); - device_set_wakeup_enable(sc->dev, enabled); - mutex_unlock(&sc->mutex); -} - -#endif -static void ath9k_sw_scan_start(struct ieee80211_hw *hw) -{ - struct ath_softc *sc = hw->priv; - - sc->scanning = 1; -} - -static void ath9k_sw_scan_complete(struct ieee80211_hw *hw) -{ - struct ath_softc *sc = hw->priv; - - sc->scanning = 0; -} - -struct ieee80211_ops ath9k_ops = { - .tx = ath9k_tx, - .start = ath9k_start, - .stop = ath9k_stop, - .add_interface = ath9k_add_interface, - .change_interface = ath9k_change_interface, - .remove_interface = ath9k_remove_interface, - .config = ath9k_config, - .configure_filter = ath9k_configure_filter, - .sta_add = ath9k_sta_add, - .sta_remove = ath9k_sta_remove, - .sta_notify = ath9k_sta_notify, - .conf_tx = ath9k_conf_tx, - .bss_info_changed = ath9k_bss_info_changed, - .set_key = ath9k_set_key, - .get_tsf = ath9k_get_tsf, - .set_tsf = ath9k_set_tsf, - .reset_tsf = ath9k_reset_tsf, - .ampdu_action = ath9k_ampdu_action, - .get_survey = ath9k_get_survey, - .rfkill_poll = ath9k_rfkill_poll_state, - .set_coverage_class = ath9k_set_coverage_class, - .flush = ath9k_flush, - .tx_frames_pending = ath9k_tx_frames_pending, - .tx_last_beacon = ath9k_tx_last_beacon, - .get_stats = ath9k_get_stats, - .set_antenna = ath9k_set_antenna, - .get_antenna = ath9k_get_antenna, - -#ifdef CONFIG_PM_SLEEP - .suspend = ath9k_suspend, - .resume = ath9k_resume, - .set_wakeup = ath9k_set_wakeup, -#endif - -#ifdef CONFIG_ATH9K_DEBUGFS - .get_et_sset_count = ath9k_get_et_sset_count, - .get_et_stats = ath9k_get_et_stats, - .get_et_strings = ath9k_get_et_strings, -#endif - -#if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS) - .sta_add_debugfs = ath9k_sta_add_debugfs, - .sta_remove_debugfs = ath9k_sta_remove_debugfs, -#endif - .sw_scan_start = ath9k_sw_scan_start, - .sw_scan_complete = ath9k_sw_scan_complete, -}; diff --git a/drivers/net/wireless/ath/ath9k/mci.c b/drivers/net/wireless/ath/ath9k/mci.c deleted file mode 100644 index 815bee21c19a..000000000000 --- a/drivers/net/wireless/ath/ath9k/mci.c +++ /dev/null @@ -1,768 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -#include "ath9k.h" -#include "mci.h" - -static const u8 ath_mci_duty_cycle[] = { 55, 50, 60, 70, 80, 85, 90, 95, 98 }; - -static struct ath_mci_profile_info* -ath_mci_find_profile(struct ath_mci_profile *mci, - struct ath_mci_profile_info *info) -{ - struct ath_mci_profile_info *entry; - - if (list_empty(&mci->info)) - return NULL; - - list_for_each_entry(entry, &mci->info, list) { - if (entry->conn_handle == info->conn_handle) - return entry; - } - return NULL; -} - -static bool ath_mci_add_profile(struct ath_common *common, - struct ath_mci_profile *mci, - struct ath_mci_profile_info *info) -{ - struct ath_mci_profile_info *entry; - u8 voice_priority[] = { 110, 110, 110, 112, 110, 110, 114, 116, 118 }; - - if ((mci->num_sco == ATH_MCI_MAX_SCO_PROFILE) && - (info->type == MCI_GPM_COEX_PROFILE_VOICE)) - return false; - - if (((NUM_PROF(mci) - mci->num_sco) == ATH_MCI_MAX_ACL_PROFILE) && - (info->type != MCI_GPM_COEX_PROFILE_VOICE)) - return false; - - entry = kzalloc(sizeof(*entry), GFP_ATOMIC); - if (!entry) - return false; - - memcpy(entry, info, 10); - INC_PROF(mci, info); - list_add_tail(&entry->list, &mci->info); - if (info->type == MCI_GPM_COEX_PROFILE_VOICE) { - if (info->voice_type < sizeof(voice_priority)) - mci->voice_priority = voice_priority[info->voice_type]; - else - mci->voice_priority = 110; - } - - return true; -} - -static void ath_mci_del_profile(struct ath_common *common, - struct ath_mci_profile *mci, - struct ath_mci_profile_info *entry) -{ - if (!entry) - return; - - DEC_PROF(mci, entry); - list_del(&entry->list); - kfree(entry); -} - -void ath_mci_flush_profile(struct ath_mci_profile *mci) -{ - struct ath_mci_profile_info *info, *tinfo; - - mci->aggr_limit = 0; - mci->num_mgmt = 0; - - if (list_empty(&mci->info)) - return; - - list_for_each_entry_safe(info, tinfo, &mci->info, list) { - list_del(&info->list); - DEC_PROF(mci, info); - kfree(info); - } -} - -static void ath_mci_adjust_aggr_limit(struct ath_btcoex *btcoex) -{ - struct ath_mci_profile *mci = &btcoex->mci; - u32 wlan_airtime = btcoex->btcoex_period * - (100 - btcoex->duty_cycle) / 100; - - /* - * Scale: wlan_airtime is in ms, aggr_limit is in 0.25 ms. - * When wlan_airtime is less than 4ms, aggregation limit has to be - * adjusted half of wlan_airtime to ensure that the aggregation can fit - * without collision with BT traffic. - */ - if ((wlan_airtime <= 4) && - (!mci->aggr_limit || (mci->aggr_limit > (2 * wlan_airtime)))) - mci->aggr_limit = 2 * wlan_airtime; -} - -static void ath_mci_update_scheme(struct ath_softc *sc) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_btcoex *btcoex = &sc->btcoex; - struct ath_mci_profile *mci = &btcoex->mci; - struct ath9k_hw_mci *mci_hw = &sc->sc_ah->btcoex_hw.mci; - struct ath_mci_profile_info *info; - u32 num_profile = NUM_PROF(mci); - - if (mci_hw->config & ATH_MCI_CONFIG_DISABLE_TUNING) - goto skip_tuning; - - mci->aggr_limit = 0; - btcoex->duty_cycle = ath_mci_duty_cycle[num_profile]; - btcoex->btcoex_period = ATH_MCI_DEF_BT_PERIOD; - if (NUM_PROF(mci)) - btcoex->bt_stomp_type = ATH_BTCOEX_STOMP_LOW; - else - btcoex->bt_stomp_type = mci->num_mgmt ? ATH_BTCOEX_STOMP_ALL : - ATH_BTCOEX_STOMP_LOW; - - if (num_profile == 1) { - info = list_first_entry(&mci->info, - struct ath_mci_profile_info, - list); - if (mci->num_sco) { - if (info->T == 12) - mci->aggr_limit = 8; - else if (info->T == 6) { - mci->aggr_limit = 6; - btcoex->duty_cycle = 30; - } else - mci->aggr_limit = 6; - ath_dbg(common, MCI, - "Single SCO, aggregation limit %d 1/4 ms\n", - mci->aggr_limit); - } else if (mci->num_pan || mci->num_other_acl) { - /* - * For single PAN/FTP profile, allocate 35% for BT - * to improve WLAN throughput. - */ - btcoex->duty_cycle = AR_SREV_9565(sc->sc_ah) ? 40 : 35; - btcoex->btcoex_period = 53; - ath_dbg(common, MCI, - "Single PAN/FTP bt period %d ms dutycycle %d\n", - btcoex->duty_cycle, btcoex->btcoex_period); - } else if (mci->num_hid) { - btcoex->duty_cycle = 30; - mci->aggr_limit = 6; - ath_dbg(common, MCI, - "Multiple attempt/timeout single HID " - "aggregation limit 1.5 ms dutycycle 30%%\n"); - } - } else if (num_profile == 2) { - if (mci->num_hid == 2) - btcoex->duty_cycle = 30; - mci->aggr_limit = 6; - ath_dbg(common, MCI, - "Two BT profiles aggr limit 1.5 ms dutycycle %d%%\n", - btcoex->duty_cycle); - } else if (num_profile >= 3) { - mci->aggr_limit = 4; - ath_dbg(common, MCI, - "Three or more profiles aggregation limit 1 ms\n"); - } - -skip_tuning: - if (IS_CHAN_2GHZ(sc->sc_ah->curchan)) { - if (IS_CHAN_HT(sc->sc_ah->curchan)) - ath_mci_adjust_aggr_limit(btcoex); - else - btcoex->btcoex_period >>= 1; - } - - ath9k_btcoex_timer_pause(sc); - ath9k_hw_btcoex_disable(sc->sc_ah); - - if (IS_CHAN_5GHZ(sc->sc_ah->curchan)) - return; - - btcoex->duty_cycle += (mci->num_bdr ? ATH_MCI_BDR_DUTY_CYCLE : 0); - if (btcoex->duty_cycle > ATH_MCI_MAX_DUTY_CYCLE) - btcoex->duty_cycle = ATH_MCI_MAX_DUTY_CYCLE; - - btcoex->btcoex_no_stomp = btcoex->btcoex_period * 1000 * - (100 - btcoex->duty_cycle) / 100; - - ath9k_hw_btcoex_enable(sc->sc_ah); - ath9k_btcoex_timer_resume(sc); -} - -static void ath_mci_cal_msg(struct ath_softc *sc, u8 opcode, u8 *rx_payload) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; - u32 payload[4] = {0, 0, 0, 0}; - - switch (opcode) { - case MCI_GPM_BT_CAL_REQ: - if (mci_hw->bt_state == MCI_BT_AWAKE) { - mci_hw->bt_state = MCI_BT_CAL_START; - ath9k_queue_reset(sc, RESET_TYPE_MCI); - } - ath_dbg(common, MCI, "MCI State : %d\n", mci_hw->bt_state); - break; - case MCI_GPM_BT_CAL_GRANT: - MCI_GPM_SET_CAL_TYPE(payload, MCI_GPM_WLAN_CAL_DONE); - ar9003_mci_send_message(sc->sc_ah, MCI_GPM, 0, payload, - 16, false, true); - break; - default: - ath_dbg(common, MCI, "Unknown GPM CAL message\n"); - break; - } -} - -static void ath9k_mci_work(struct work_struct *work) -{ - struct ath_softc *sc = container_of(work, struct ath_softc, mci_work); - - ath_mci_update_scheme(sc); -} - -static void ath_mci_update_stomp_txprio(u8 cur_txprio, u8 *stomp_prio) -{ - if (cur_txprio < stomp_prio[ATH_BTCOEX_STOMP_NONE]) - stomp_prio[ATH_BTCOEX_STOMP_NONE] = cur_txprio; - - if (cur_txprio > stomp_prio[ATH_BTCOEX_STOMP_ALL]) - stomp_prio[ATH_BTCOEX_STOMP_ALL] = cur_txprio; - - if ((cur_txprio > ATH_MCI_HI_PRIO) && - (cur_txprio < stomp_prio[ATH_BTCOEX_STOMP_LOW])) - stomp_prio[ATH_BTCOEX_STOMP_LOW] = cur_txprio; -} - -static void ath_mci_set_concur_txprio(struct ath_softc *sc) -{ - struct ath_btcoex *btcoex = &sc->btcoex; - struct ath_mci_profile *mci = &btcoex->mci; - u8 stomp_txprio[ATH_BTCOEX_STOMP_MAX]; - - memset(stomp_txprio, 0, sizeof(stomp_txprio)); - if (mci->num_mgmt) { - stomp_txprio[ATH_BTCOEX_STOMP_ALL] = ATH_MCI_INQUIRY_PRIO; - if (!mci->num_pan && !mci->num_other_acl) - stomp_txprio[ATH_BTCOEX_STOMP_NONE] = - ATH_MCI_INQUIRY_PRIO; - } else { - u8 prof_prio[] = { 50, 90, 94, 52 };/* RFCOMM, A2DP, HID, PAN */ - - stomp_txprio[ATH_BTCOEX_STOMP_LOW] = - stomp_txprio[ATH_BTCOEX_STOMP_NONE] = 0xff; - - if (mci->num_sco) - ath_mci_update_stomp_txprio(mci->voice_priority, - stomp_txprio); - if (mci->num_other_acl) - ath_mci_update_stomp_txprio(prof_prio[0], stomp_txprio); - if (mci->num_a2dp) - ath_mci_update_stomp_txprio(prof_prio[1], stomp_txprio); - if (mci->num_hid) - ath_mci_update_stomp_txprio(prof_prio[2], stomp_txprio); - if (mci->num_pan) - ath_mci_update_stomp_txprio(prof_prio[3], stomp_txprio); - - if (stomp_txprio[ATH_BTCOEX_STOMP_NONE] == 0xff) - stomp_txprio[ATH_BTCOEX_STOMP_NONE] = 0; - - if (stomp_txprio[ATH_BTCOEX_STOMP_LOW] == 0xff) - stomp_txprio[ATH_BTCOEX_STOMP_LOW] = 0; - } - ath9k_hw_btcoex_set_concur_txprio(sc->sc_ah, stomp_txprio); -} - -static u8 ath_mci_process_profile(struct ath_softc *sc, - struct ath_mci_profile_info *info) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_btcoex *btcoex = &sc->btcoex; - struct ath_mci_profile *mci = &btcoex->mci; - struct ath_mci_profile_info *entry = NULL; - - entry = ath_mci_find_profile(mci, info); - if (entry) { - /* - * Two MCI interrupts are generated while connecting to - * headset and A2DP profile, but only one MCI interrupt - * is generated with last added profile type while disconnecting - * both profiles. - * So while adding second profile type decrement - * the first one. - */ - if (entry->type != info->type) { - DEC_PROF(mci, entry); - INC_PROF(mci, info); - } - memcpy(entry, info, 10); - } - - if (info->start) { - if (!entry && !ath_mci_add_profile(common, mci, info)) - return 0; - } else - ath_mci_del_profile(common, mci, entry); - - ath_mci_set_concur_txprio(sc); - return 1; -} - -static u8 ath_mci_process_status(struct ath_softc *sc, - struct ath_mci_profile_status *status) -{ - struct ath_btcoex *btcoex = &sc->btcoex; - struct ath_mci_profile *mci = &btcoex->mci; - struct ath_mci_profile_info info; - int i = 0, old_num_mgmt = mci->num_mgmt; - - /* Link status type are not handled */ - if (status->is_link) - return 0; - - info.conn_handle = status->conn_handle; - if (ath_mci_find_profile(mci, &info)) - return 0; - - if (status->conn_handle >= ATH_MCI_MAX_PROFILE) - return 0; - - if (status->is_critical) - __set_bit(status->conn_handle, mci->status); - else - __clear_bit(status->conn_handle, mci->status); - - mci->num_mgmt = 0; - do { - if (test_bit(i, mci->status)) - mci->num_mgmt++; - } while (++i < ATH_MCI_MAX_PROFILE); - - ath_mci_set_concur_txprio(sc); - if (old_num_mgmt != mci->num_mgmt) - return 1; - - return 0; -} - -static void ath_mci_msg(struct ath_softc *sc, u8 opcode, u8 *rx_payload) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_mci_profile_info profile_info; - struct ath_mci_profile_status profile_status; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - u8 major, minor, update_scheme = 0; - u32 seq_num; - - if (ar9003_mci_state(ah, MCI_STATE_NEED_FLUSH_BT_INFO) && - ar9003_mci_state(ah, MCI_STATE_ENABLE)) { - ath_dbg(common, MCI, "(MCI) Need to flush BT profiles\n"); - ath_mci_flush_profile(&sc->btcoex.mci); - ar9003_mci_state(ah, MCI_STATE_SEND_STATUS_QUERY); - } - - switch (opcode) { - case MCI_GPM_COEX_VERSION_QUERY: - ar9003_mci_state(ah, MCI_STATE_SEND_WLAN_COEX_VERSION); - break; - case MCI_GPM_COEX_VERSION_RESPONSE: - major = *(rx_payload + MCI_GPM_COEX_B_MAJOR_VERSION); - minor = *(rx_payload + MCI_GPM_COEX_B_MINOR_VERSION); - ar9003_mci_set_bt_version(ah, major, minor); - break; - case MCI_GPM_COEX_STATUS_QUERY: - ar9003_mci_send_wlan_channels(ah); - break; - case MCI_GPM_COEX_BT_PROFILE_INFO: - memcpy(&profile_info, - (rx_payload + MCI_GPM_COEX_B_PROFILE_TYPE), 10); - - if ((profile_info.type == MCI_GPM_COEX_PROFILE_UNKNOWN) || - (profile_info.type >= MCI_GPM_COEX_PROFILE_MAX)) { - ath_dbg(common, MCI, - "Illegal profile type = %d, state = %d\n", - profile_info.type, - profile_info.start); - break; - } - - update_scheme += ath_mci_process_profile(sc, &profile_info); - break; - case MCI_GPM_COEX_BT_STATUS_UPDATE: - profile_status.is_link = *(rx_payload + - MCI_GPM_COEX_B_STATUS_TYPE); - profile_status.conn_handle = *(rx_payload + - MCI_GPM_COEX_B_STATUS_LINKID); - profile_status.is_critical = *(rx_payload + - MCI_GPM_COEX_B_STATUS_STATE); - - seq_num = *((u32 *)(rx_payload + 12)); - ath_dbg(common, MCI, - "BT_Status_Update: is_link=%d, linkId=%d, state=%d, SEQ=%u\n", - profile_status.is_link, profile_status.conn_handle, - profile_status.is_critical, seq_num); - - update_scheme += ath_mci_process_status(sc, &profile_status); - break; - default: - ath_dbg(common, MCI, "Unknown GPM COEX message = 0x%02x\n", opcode); - break; - } - if (update_scheme) - ieee80211_queue_work(sc->hw, &sc->mci_work); -} - -int ath_mci_setup(struct ath_softc *sc) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_mci_coex *mci = &sc->mci_coex; - struct ath_mci_buf *buf = &mci->sched_buf; - int ret; - - buf->bf_addr = dmam_alloc_coherent(sc->dev, - ATH_MCI_SCHED_BUF_SIZE + ATH_MCI_GPM_BUF_SIZE, - &buf->bf_paddr, GFP_KERNEL); - - if (buf->bf_addr == NULL) { - ath_dbg(common, FATAL, "MCI buffer alloc failed\n"); - return -ENOMEM; - } - - memset(buf->bf_addr, MCI_GPM_RSVD_PATTERN, - ATH_MCI_SCHED_BUF_SIZE + ATH_MCI_GPM_BUF_SIZE); - - mci->sched_buf.bf_len = ATH_MCI_SCHED_BUF_SIZE; - - mci->gpm_buf.bf_len = ATH_MCI_GPM_BUF_SIZE; - mci->gpm_buf.bf_addr = (u8 *)mci->sched_buf.bf_addr + mci->sched_buf.bf_len; - mci->gpm_buf.bf_paddr = mci->sched_buf.bf_paddr + mci->sched_buf.bf_len; - - ret = ar9003_mci_setup(sc->sc_ah, mci->gpm_buf.bf_paddr, - mci->gpm_buf.bf_addr, (mci->gpm_buf.bf_len >> 4), - mci->sched_buf.bf_paddr); - if (ret) { - ath_err(common, "Failed to initialize MCI\n"); - return ret; - } - - INIT_WORK(&sc->mci_work, ath9k_mci_work); - ath_dbg(common, MCI, "MCI Initialized\n"); - - return 0; -} - -void ath_mci_cleanup(struct ath_softc *sc) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_hw *ah = sc->sc_ah; - - ar9003_mci_cleanup(ah); - - ath_dbg(common, MCI, "MCI De-Initialized\n"); -} - -void ath_mci_intr(struct ath_softc *sc) -{ - struct ath_mci_coex *mci = &sc->mci_coex; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; - u32 mci_int, mci_int_rxmsg; - u32 offset, subtype, opcode; - u32 *pgpm; - u32 more_data = MCI_GPM_MORE; - bool skip_gpm = false; - - ar9003_mci_get_interrupt(sc->sc_ah, &mci_int, &mci_int_rxmsg); - - if (ar9003_mci_state(ah, MCI_STATE_ENABLE) == 0) { - ar9003_mci_get_next_gpm_offset(ah, true, NULL); - return; - } - - if (mci_int_rxmsg & AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE) { - u32 payload[4] = { 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffff00}; - - /* - * The following REMOTE_RESET and SYS_WAKING used to sent - * only when BT wake up. Now they are always sent, as a - * recovery method to reset BT MCI's RX alignment. - */ - ar9003_mci_send_message(ah, MCI_REMOTE_RESET, 0, - payload, 16, true, false); - ar9003_mci_send_message(ah, MCI_SYS_WAKING, 0, - NULL, 0, true, false); - - mci_int_rxmsg &= ~AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE; - ar9003_mci_state(ah, MCI_STATE_RESET_REQ_WAKE); - - /* - * always do this for recovery and 2G/5G toggling and LNA_TRANS - */ - ar9003_mci_state(ah, MCI_STATE_SET_BT_AWAKE); - } - - if (mci_int_rxmsg & AR_MCI_INTERRUPT_RX_MSG_SYS_WAKING) { - mci_int_rxmsg &= ~AR_MCI_INTERRUPT_RX_MSG_SYS_WAKING; - - if ((mci_hw->bt_state == MCI_BT_SLEEP) && - (ar9003_mci_state(ah, MCI_STATE_REMOTE_SLEEP) != - MCI_BT_SLEEP)) - ar9003_mci_state(ah, MCI_STATE_SET_BT_AWAKE); - } - - if (mci_int_rxmsg & AR_MCI_INTERRUPT_RX_MSG_SYS_SLEEPING) { - mci_int_rxmsg &= ~AR_MCI_INTERRUPT_RX_MSG_SYS_SLEEPING; - - if ((mci_hw->bt_state == MCI_BT_AWAKE) && - (ar9003_mci_state(ah, MCI_STATE_REMOTE_SLEEP) != - MCI_BT_AWAKE)) - mci_hw->bt_state = MCI_BT_SLEEP; - } - - if ((mci_int & AR_MCI_INTERRUPT_RX_INVALID_HDR) || - (mci_int & AR_MCI_INTERRUPT_CONT_INFO_TIMEOUT)) { - ar9003_mci_state(ah, MCI_STATE_RECOVER_RX); - skip_gpm = true; - } - - if (mci_int_rxmsg & AR_MCI_INTERRUPT_RX_MSG_SCHD_INFO) { - mci_int_rxmsg &= ~AR_MCI_INTERRUPT_RX_MSG_SCHD_INFO; - offset = ar9003_mci_state(ah, MCI_STATE_LAST_SCHD_MSG_OFFSET); - } - - if (mci_int_rxmsg & AR_MCI_INTERRUPT_RX_MSG_GPM) { - mci_int_rxmsg &= ~AR_MCI_INTERRUPT_RX_MSG_GPM; - - while (more_data == MCI_GPM_MORE) { - if (test_bit(SC_OP_HW_RESET, &sc->sc_flags)) - return; - - pgpm = mci->gpm_buf.bf_addr; - offset = ar9003_mci_get_next_gpm_offset(ah, false, - &more_data); - - if (offset == MCI_GPM_INVALID) - break; - - pgpm += (offset >> 2); - - /* - * The first dword is timer. - * The real data starts from 2nd dword. - */ - subtype = MCI_GPM_TYPE(pgpm); - opcode = MCI_GPM_OPCODE(pgpm); - - if (skip_gpm) - goto recycle; - - if (MCI_GPM_IS_CAL_TYPE(subtype)) { - ath_mci_cal_msg(sc, subtype, (u8 *)pgpm); - } else { - switch (subtype) { - case MCI_GPM_COEX_AGENT: - ath_mci_msg(sc, opcode, (u8 *)pgpm); - break; - default: - break; - } - } - recycle: - MCI_GPM_RECYCLE(pgpm); - } - } - - if (mci_int_rxmsg & AR_MCI_INTERRUPT_RX_HW_MSG_MASK) { - if (mci_int_rxmsg & AR_MCI_INTERRUPT_RX_MSG_LNA_CONTROL) - mci_int_rxmsg &= ~AR_MCI_INTERRUPT_RX_MSG_LNA_CONTROL; - - if (mci_int_rxmsg & AR_MCI_INTERRUPT_RX_MSG_LNA_INFO) - mci_int_rxmsg &= ~AR_MCI_INTERRUPT_RX_MSG_LNA_INFO; - - if (mci_int_rxmsg & AR_MCI_INTERRUPT_RX_MSG_CONT_INFO) { - int value_dbm = MS(mci_hw->cont_status, - AR_MCI_CONT_RSSI_POWER); - - mci_int_rxmsg &= ~AR_MCI_INTERRUPT_RX_MSG_CONT_INFO; - - ath_dbg(common, MCI, - "MCI CONT_INFO: (%s) pri = %d pwr = %d dBm\n", - MS(mci_hw->cont_status, AR_MCI_CONT_TXRX) ? - "tx" : "rx", - MS(mci_hw->cont_status, AR_MCI_CONT_PRIORITY), - value_dbm); - } - - if (mci_int_rxmsg & AR_MCI_INTERRUPT_RX_MSG_CONT_NACK) - mci_int_rxmsg &= ~AR_MCI_INTERRUPT_RX_MSG_CONT_NACK; - - if (mci_int_rxmsg & AR_MCI_INTERRUPT_RX_MSG_CONT_RST) - mci_int_rxmsg &= ~AR_MCI_INTERRUPT_RX_MSG_CONT_RST; - } - - if ((mci_int & AR_MCI_INTERRUPT_RX_INVALID_HDR) || - (mci_int & AR_MCI_INTERRUPT_CONT_INFO_TIMEOUT)) { - mci_int &= ~(AR_MCI_INTERRUPT_RX_INVALID_HDR | - AR_MCI_INTERRUPT_CONT_INFO_TIMEOUT); - ath_mci_msg(sc, MCI_GPM_COEX_NOOP, NULL); - } -} - -void ath_mci_enable(struct ath_softc *sc) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - - if (!common->btcoex_enabled) - return; - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_MCI) - sc->sc_ah->imask |= ATH9K_INT_MCI; -} - -void ath9k_mci_update_wlan_channels(struct ath_softc *sc, bool allow_all) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; - struct ath9k_channel *chan = ah->curchan; - u32 channelmap[] = {0x00000000, 0xffff0000, 0xffffffff, 0x7fffffff}; - int i; - s16 chan_start, chan_end; - u16 wlan_chan; - - if (!chan || !IS_CHAN_2GHZ(chan)) - return; - - if (allow_all) - goto send_wlan_chan; - - wlan_chan = chan->channel - 2402; - - chan_start = wlan_chan - 10; - chan_end = wlan_chan + 10; - - if (chan->chanmode == CHANNEL_G_HT40PLUS) - chan_end += 20; - else if (chan->chanmode == CHANNEL_G_HT40MINUS) - chan_start -= 20; - - /* adjust side band */ - chan_start -= 7; - chan_end += 7; - - if (chan_start <= 0) - chan_start = 0; - if (chan_end >= ATH_MCI_NUM_BT_CHANNELS) - chan_end = ATH_MCI_NUM_BT_CHANNELS - 1; - - ath_dbg(ath9k_hw_common(ah), MCI, - "WLAN current channel %d mask BT channel %d - %d\n", - wlan_chan, chan_start, chan_end); - - for (i = chan_start; i < chan_end; i++) - MCI_GPM_CLR_CHANNEL_BIT(&channelmap, i); - -send_wlan_chan: - /* update and send wlan channels info to BT */ - for (i = 0; i < 4; i++) - mci->wlan_channels[i] = channelmap[i]; - ar9003_mci_send_wlan_channels(ah); - ar9003_mci_state(ah, MCI_STATE_SEND_VERSION_QUERY); -} - -void ath9k_mci_set_txpower(struct ath_softc *sc, bool setchannel, - bool concur_tx) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath9k_hw_mci *mci_hw = &sc->sc_ah->btcoex_hw.mci; - bool old_concur_tx = mci_hw->concur_tx; - - if (!(mci_hw->config & ATH_MCI_CONFIG_CONCUR_TX)) { - mci_hw->concur_tx = false; - return; - } - - if (!IS_CHAN_2GHZ(ah->curchan)) - return; - - if (setchannel) { - struct ath9k_hw_cal_data *caldata = &sc->caldata; - if ((caldata->chanmode == CHANNEL_G_HT40PLUS) && - (ah->curchan->channel > caldata->channel) && - (ah->curchan->channel <= caldata->channel + 20)) - return; - if ((caldata->chanmode == CHANNEL_G_HT40MINUS) && - (ah->curchan->channel < caldata->channel) && - (ah->curchan->channel >= caldata->channel - 20)) - return; - mci_hw->concur_tx = false; - } else - mci_hw->concur_tx = concur_tx; - - if (old_concur_tx != mci_hw->concur_tx) - ath9k_hw_set_txpowerlimit(ah, sc->config.txpowlimit, false); -} - -static void ath9k_mci_stomp_audio(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_btcoex *btcoex = &sc->btcoex; - struct ath_mci_profile *mci = &btcoex->mci; - - if (!mci->num_sco && !mci->num_a2dp) - return; - - if (ah->stats.avgbrssi > 25) { - btcoex->stomp_audio = 0; - return; - } - - btcoex->stomp_audio++; -} -void ath9k_mci_update_rssi(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_btcoex *btcoex = &sc->btcoex; - struct ath9k_hw_mci *mci_hw = &sc->sc_ah->btcoex_hw.mci; - - ath9k_mci_stomp_audio(sc); - - if (!(mci_hw->config & ATH_MCI_CONFIG_CONCUR_TX)) - return; - - if (ah->stats.avgbrssi >= 40) { - if (btcoex->rssi_count < 0) - btcoex->rssi_count = 0; - if (++btcoex->rssi_count >= ATH_MCI_CONCUR_TX_SWITCH) { - btcoex->rssi_count = 0; - ath9k_mci_set_txpower(sc, false, true); - } - } else { - if (btcoex->rssi_count > 0) - btcoex->rssi_count = 0; - if (--btcoex->rssi_count <= -ATH_MCI_CONCUR_TX_SWITCH) { - btcoex->rssi_count = 0; - ath9k_mci_set_txpower(sc, false, false); - } - } -} diff --git a/drivers/net/wireless/ath/ath9k/mci.h b/drivers/net/wireless/ath/ath9k/mci.h deleted file mode 100644 index 06958837620c..000000000000 --- a/drivers/net/wireless/ath/ath9k/mci.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef MCI_H -#define MCI_H - -#include "ar9003_mci.h" - -#define ATH_MCI_SCHED_BUF_SIZE (16 * 16) /* 16 entries, 4 dword each */ -#define ATH_MCI_GPM_MAX_ENTRY 16 -#define ATH_MCI_GPM_BUF_SIZE (ATH_MCI_GPM_MAX_ENTRY * 16) -#define ATH_MCI_DEF_BT_PERIOD 40 -#define ATH_MCI_BDR_DUTY_CYCLE 20 -#define ATH_MCI_MAX_DUTY_CYCLE 90 - -#define ATH_MCI_DEF_AGGR_LIMIT 6 /* in 0.24 ms */ -#define ATH_MCI_MAX_ACL_PROFILE 7 -#define ATH_MCI_MAX_SCO_PROFILE 1 -#define ATH_MCI_MAX_PROFILE (ATH_MCI_MAX_ACL_PROFILE +\ - ATH_MCI_MAX_SCO_PROFILE) - -#define ATH_MCI_INQUIRY_PRIO 62 -#define ATH_MCI_HI_PRIO 60 -#define ATH_MCI_NUM_BT_CHANNELS 79 -#define ATH_MCI_CONCUR_TX_SWITCH 5 - -#define MCI_GPM_SET_CHANNEL_BIT(_p_gpm, _bt_chan) \ - do { \ - if (_bt_chan < ATH_MCI_NUM_BT_CHANNELS) { \ - *(((u8 *)(_p_gpm)) + MCI_GPM_COEX_B_CHANNEL_MAP + \ - (_bt_chan / 8)) |= (1 << (_bt_chan & 7)); \ - } \ - } while (0) - -#define MCI_GPM_CLR_CHANNEL_BIT(_p_gpm, _bt_chan) \ - do { \ - if (_bt_chan < ATH_MCI_NUM_BT_CHANNELS) { \ - *(((u8 *)(_p_gpm)) + MCI_GPM_COEX_B_CHANNEL_MAP + \ - (_bt_chan / 8)) &= ~(1 << (_bt_chan & 7));\ - } \ - } while (0) - -#define INC_PROF(_mci, _info) do { \ - switch (_info->type) { \ - case MCI_GPM_COEX_PROFILE_RFCOMM:\ - _mci->num_other_acl++; \ - break; \ - case MCI_GPM_COEX_PROFILE_A2DP: \ - _mci->num_a2dp++; \ - if (!_info->edr) \ - _mci->num_bdr++; \ - break; \ - case MCI_GPM_COEX_PROFILE_HID: \ - _mci->num_hid++; \ - break; \ - case MCI_GPM_COEX_PROFILE_BNEP: \ - _mci->num_pan++; \ - break; \ - case MCI_GPM_COEX_PROFILE_VOICE: \ - case MCI_GPM_COEX_PROFILE_A2DPVO:\ - _mci->num_sco++; \ - break; \ - default: \ - break; \ - } \ - } while (0) - -#define DEC_PROF(_mci, _info) do { \ - switch (_info->type) { \ - case MCI_GPM_COEX_PROFILE_RFCOMM:\ - _mci->num_other_acl--; \ - break; \ - case MCI_GPM_COEX_PROFILE_A2DP: \ - _mci->num_a2dp--; \ - if (!_info->edr) \ - _mci->num_bdr--; \ - break; \ - case MCI_GPM_COEX_PROFILE_HID: \ - _mci->num_hid--; \ - break; \ - case MCI_GPM_COEX_PROFILE_BNEP: \ - _mci->num_pan--; \ - break; \ - case MCI_GPM_COEX_PROFILE_VOICE: \ - case MCI_GPM_COEX_PROFILE_A2DPVO:\ - _mci->num_sco--; \ - break; \ - default: \ - break; \ - } \ - } while (0) - -#define NUM_PROF(_mci) (_mci->num_other_acl + _mci->num_a2dp + \ - _mci->num_hid + _mci->num_pan + _mci->num_sco) - -struct ath_mci_profile_info { - u8 type; - u8 conn_handle; - bool start; - bool master; - bool edr; - u8 voice_type; - u16 T; /* Voice: Tvoice, HID: Tsniff, in slots */ - u8 W; /* Voice: Wvoice, HID: Sniff timeout, in slots */ - u8 A; /* HID: Sniff attempt, in slots */ - struct list_head list; -}; - -struct ath_mci_profile_status { - bool is_critical; - bool is_link; - u8 conn_handle; -}; - -struct ath_mci_profile { - struct list_head info; - DECLARE_BITMAP(status, ATH_MCI_MAX_PROFILE); - u16 aggr_limit; - u8 num_mgmt; - u8 num_sco; - u8 num_a2dp; - u8 num_hid; - u8 num_pan; - u8 num_other_acl; - u8 num_bdr; - u8 voice_priority; -}; - -struct ath_mci_buf { - void *bf_addr; /* virtual addr of desc */ - dma_addr_t bf_paddr; /* physical addr of buffer */ - u32 bf_len; /* len of data */ -}; - -struct ath_mci_coex { - struct ath_mci_buf sched_buf; - struct ath_mci_buf gpm_buf; -}; - -void ath_mci_flush_profile(struct ath_mci_profile *mci); -int ath_mci_setup(struct ath_softc *sc); -void ath_mci_cleanup(struct ath_softc *sc); -void ath_mci_intr(struct ath_softc *sc); -void ath9k_mci_update_rssi(struct ath_softc *sc); - -#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT -void ath_mci_enable(struct ath_softc *sc); -void ath9k_mci_update_wlan_channels(struct ath_softc *sc, bool allow_all); -void ath9k_mci_set_txpower(struct ath_softc *sc, bool setchannel, - bool concur_tx); -#else -static inline void ath_mci_enable(struct ath_softc *sc) -{ -} -static inline void ath9k_mci_update_wlan_channels(struct ath_softc *sc, - bool allow_all) -{ -} -static inline void ath9k_mci_set_txpower(struct ath_softc *sc, bool setchannel, - bool concur_tx) -{ -} -#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ - -#endif /* MCI_H*/ diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c deleted file mode 100644 index 0e0d39583837..000000000000 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include "ath9k.h" - -static DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = { - { PCI_VDEVICE(ATHEROS, 0x0023) }, /* PCI */ - { PCI_VDEVICE(ATHEROS, 0x0024) }, /* PCI-E */ - { PCI_VDEVICE(ATHEROS, 0x0027) }, /* PCI */ - { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI */ - { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */ - { PCI_VDEVICE(ATHEROS, 0x002B) }, /* PCI-E */ - { PCI_VDEVICE(ATHEROS, 0x002C) }, /* PCI-E 802.11n bonded out */ - { PCI_VDEVICE(ATHEROS, 0x002D) }, /* PCI */ - { PCI_VDEVICE(ATHEROS, 0x002E) }, /* PCI-E */ - { PCI_VDEVICE(ATHEROS, 0x0030) }, /* PCI-E AR9300 */ - { PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E AR9485 */ - { PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E AR9580 */ - { PCI_VDEVICE(ATHEROS, 0x0034) }, /* PCI-E AR9462 */ - { PCI_VDEVICE(ATHEROS, 0x0037) }, /* PCI-E AR1111/AR9485 */ - { PCI_VDEVICE(ATHEROS, 0x0036) }, /* PCI-E AR9565 */ - { 0 } -}; - - -/* return bus cachesize in 4B word units */ -static void ath_pci_read_cachesize(struct ath_common *common, int *csz) -{ - struct ath_softc *sc = (struct ath_softc *) common->priv; - u8 u8tmp; - - pci_read_config_byte(to_pci_dev(sc->dev), PCI_CACHE_LINE_SIZE, &u8tmp); - *csz = (int)u8tmp; - - /* - * This check was put in to avoid "unpleasant" consequences if - * the bootrom has not fully initialized all PCI devices. - * Sometimes the cache line size register is not set - */ - - if (*csz == 0) - *csz = DEFAULT_CACHELINE >> 2; /* Use the default size */ -} - -static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data) -{ - struct ath_softc *sc = (struct ath_softc *) common->priv; - struct ath9k_platform_data *pdata = sc->dev->platform_data; - - if (pdata) { - if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { - ath_err(common, - "%s: eeprom read failed, offset %08x is out of range\n", - __func__, off); - } - - *data = pdata->eeprom_data[off]; - } else { - struct ath_hw *ah = (struct ath_hw *) common->ah; - - common->ops->read(ah, AR5416_EEPROM_OFFSET + - (off << AR5416_EEPROM_S)); - - if (!ath9k_hw_wait(ah, - AR_EEPROM_STATUS_DATA, - AR_EEPROM_STATUS_DATA_BUSY | - AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0, - AH_WAIT_TIMEOUT)) { - return false; - } - - *data = MS(common->ops->read(ah, AR_EEPROM_STATUS_DATA), - AR_EEPROM_STATUS_DATA_VAL); - } - - return true; -} - -/* Need to be called after we discover btcoex capabilities */ -static void ath_pci_aspm_init(struct ath_common *common) -{ - struct ath_softc *sc = (struct ath_softc *) common->priv; - struct ath_hw *ah = sc->sc_ah; - struct pci_dev *pdev = to_pci_dev(sc->dev); - struct pci_dev *parent; - u16 aspm; - - if (!ah->is_pciexpress) - return; - - parent = pdev->bus->self; - if (!parent) - return; - - if ((ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) && - (AR_SREV_9285(ah))) { - /* Bluetooth coexistence requires disabling ASPM. */ - pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, - PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1); - - /* - * Both upstream and downstream PCIe components should - * have the same ASPM settings. - */ - pcie_capability_clear_word(parent, PCI_EXP_LNKCTL, - PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1); - - ath_info(common, "Disabling ASPM since BTCOEX is enabled\n"); - return; - } - - pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm); - if (aspm & (PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1)) { - ah->aspm_enabled = true; - /* Initialize PCIe PM and SERDES registers. */ - ath9k_hw_configpcipowersave(ah, false); - ath_info(common, "ASPM enabled: 0x%x\n", aspm); - } -} - -static const struct ath_bus_ops ath_pci_bus_ops = { - .ath_bus_type = ATH_PCI, - .read_cachesize = ath_pci_read_cachesize, - .eeprom_read = ath_pci_eeprom_read, - .aspm_init = ath_pci_aspm_init, -}; - -static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) -{ - struct ath_softc *sc; - struct ieee80211_hw *hw; - u8 csz; - u32 val; - int ret = 0; - char hw_name[64]; - - if (pcim_enable_device(pdev)) - return -EIO; - - ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); - if (ret) { - pr_err("32-bit DMA not available\n"); - return ret; - } - - ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); - if (ret) { - pr_err("32-bit DMA consistent DMA enable failed\n"); - return ret; - } - - /* - * Cache line size is used to size and align various - * structures used to communicate with the hardware. - */ - pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &csz); - if (csz == 0) { - /* - * Linux 2.4.18 (at least) writes the cache line size - * register as a 16-bit wide register which is wrong. - * We must have this setup properly for rx buffer - * DMA to work so force a reasonable value here if it - * comes up zero. - */ - csz = L1_CACHE_BYTES / sizeof(u32); - pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, csz); - } - /* - * The default setting of latency timer yields poor results, - * set it to the value used by other systems. It may be worth - * tweaking this setting more. - */ - pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xa8); - - pci_set_master(pdev); - - /* - * Disable the RETRY_TIMEOUT register (0x41) to keep - * PCI Tx retries from interfering with C3 CPU state. - */ - pci_read_config_dword(pdev, 0x40, &val); - if ((val & 0x0000ff00) != 0) - pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); - - ret = pcim_iomap_regions(pdev, BIT(0), "ath9k"); - if (ret) { - dev_err(&pdev->dev, "PCI memory region reserve error\n"); - return -ENODEV; - } - - hw = ieee80211_alloc_hw(sizeof(struct ath_softc), &ath9k_ops); - if (!hw) { - dev_err(&pdev->dev, "No memory for ieee80211_hw\n"); - return -ENOMEM; - } - - SET_IEEE80211_DEV(hw, &pdev->dev); - pci_set_drvdata(pdev, hw); - - sc = hw->priv; - sc->hw = hw; - sc->dev = &pdev->dev; - sc->mem = pcim_iomap_table(pdev)[0]; - - /* Will be cleared in ath9k_start() */ - set_bit(SC_OP_INVALID, &sc->sc_flags); - - ret = request_irq(pdev->irq, ath_isr, IRQF_SHARED, "ath9k", sc); - if (ret) { - dev_err(&pdev->dev, "request_irq failed\n"); - goto err_irq; - } - - sc->irq = pdev->irq; - - ret = ath9k_init_device(id->device, sc, &ath_pci_bus_ops); - if (ret) { - dev_err(&pdev->dev, "Failed to initialize device\n"); - goto err_init; - } - - ath9k_hw_name(sc->sc_ah, hw_name, sizeof(hw_name)); - wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n", - hw_name, (unsigned long)sc->mem, pdev->irq); - - return 0; - -err_init: - free_irq(sc->irq, sc); -err_irq: - ieee80211_free_hw(hw); - return ret; -} - -static void ath_pci_remove(struct pci_dev *pdev) -{ - struct ieee80211_hw *hw = pci_get_drvdata(pdev); - struct ath_softc *sc = hw->priv; - - if (!is_ath9k_unloaded) - sc->sc_ah->ah_flags |= AH_UNPLUGGED; - ath9k_deinit_device(sc); - free_irq(sc->irq, sc); - ieee80211_free_hw(sc->hw); -} - -#ifdef CONFIG_PM_SLEEP - -static int ath_pci_suspend(struct device *device) -{ - struct pci_dev *pdev = to_pci_dev(device); - struct ieee80211_hw *hw = pci_get_drvdata(pdev); - struct ath_softc *sc = hw->priv; - - if (sc->wow_enabled) - return 0; - - /* The device has to be moved to FULLSLEEP forcibly. - * Otherwise the chip never moved to full sleep, - * when no interface is up. - */ - ath9k_stop_btcoex(sc); - ath9k_hw_disable(sc->sc_ah); - ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP); - - return 0; -} - -static int ath_pci_resume(struct device *device) -{ - struct pci_dev *pdev = to_pci_dev(device); - struct ieee80211_hw *hw = pci_get_drvdata(pdev); - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - u32 val; - - /* - * Suspend/Resume resets the PCI configuration space, so we have to - * re-disable the RETRY_TIMEOUT register (0x41) to keep - * PCI Tx retries from interfering with C3 CPU state - */ - pci_read_config_dword(pdev, 0x40, &val); - if ((val & 0x0000ff00) != 0) - pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); - - ath_pci_aspm_init(common); - ah->reset_power_on = false; - - return 0; -} - -static SIMPLE_DEV_PM_OPS(ath9k_pm_ops, ath_pci_suspend, ath_pci_resume); - -#define ATH9K_PM_OPS (&ath9k_pm_ops) - -#else /* !CONFIG_PM_SLEEP */ - -#define ATH9K_PM_OPS NULL - -#endif /* !CONFIG_PM_SLEEP */ - - -MODULE_DEVICE_TABLE(pci, ath_pci_id_table); - -static struct pci_driver ath_pci_driver = { - .name = "ath9k", - .id_table = ath_pci_id_table, - .probe = ath_pci_probe, - .remove = ath_pci_remove, - .driver.pm = ATH9K_PM_OPS, -}; - -int ath_pci_init(void) -{ - return pci_register_driver(&ath_pci_driver); -} - -void ath_pci_exit(void) -{ - pci_unregister_driver(&ath_pci_driver); -} diff --git a/drivers/net/wireless/ath/ath9k/phy.h b/drivers/net/wireless/ath/ath9k/phy.h deleted file mode 100644 index 8b380305b0fc..000000000000 --- a/drivers/net/wireless/ath/ath9k/phy.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef PHY_H -#define PHY_H - -#define CHANSEL_DIV 15 -#define CHANSEL_2G(_freq) (((_freq) * 0x10000) / CHANSEL_DIV) -#define CHANSEL_5G(_freq) (((_freq) * 0x8000) / CHANSEL_DIV) - -#define AR_PHY_BASE 0x9800 -#define AR_PHY(_n) (AR_PHY_BASE + ((_n)<<2)) - -#define AR_PHY_TX_PWRCTRL_TX_GAIN_TAB_MAX 0x0007E000 -#define AR_PHY_TX_PWRCTRL_TX_GAIN_TAB_MAX_S 13 -#define AR_PHY_TX_GAIN_CLC 0x0000001E -#define AR_PHY_TX_GAIN_CLC_S 1 -#define AR_PHY_TX_GAIN 0x0007F000 -#define AR_PHY_TX_GAIN_S 12 - -#define AR_PHY_CLC_TBL1 0xa35c -#define AR_PHY_CLC_I0 0x07ff0000 -#define AR_PHY_CLC_I0_S 16 -#define AR_PHY_CLC_Q0 0x0000ffd0 -#define AR_PHY_CLC_Q0_S 5 - -#define ANTSWAP_AB 0x0001 -#define REDUCE_CHAIN_0 0x00000050 -#define REDUCE_CHAIN_1 0x00000051 -#define AR_PHY_CHIP_ID 0x9818 - -#define AR_PHY_TIMING11_SPUR_FREQ_SD 0x3FF00000 -#define AR_PHY_TIMING11_SPUR_FREQ_SD_S 20 - -#define AR_PHY_PLL_CONTROL 0x16180 -#define AR_PHY_PLL_MODE 0x16184 - -#endif diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c deleted file mode 100644 index 7eb1f4b458e4..000000000000 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ /dev/null @@ -1,1488 +0,0 @@ -/* - * Copyright (c) 2004 Video54 Technologies, Inc. - * Copyright (c) 2004-2011 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -#include "ath9k.h" - -static const struct ath_rate_table ar5416_11na_ratetable = { - 68, - 8, /* MCS start */ - { - [0] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 6000, - 5400, 0, 12 }, /* 6 Mb */ - [1] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 9000, - 7800, 1, 18 }, /* 9 Mb */ - [2] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 12000, - 10000, 2, 24 }, /* 12 Mb */ - [3] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 18000, - 13900, 3, 36 }, /* 18 Mb */ - [4] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 24000, - 17300, 4, 48 }, /* 24 Mb */ - [5] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 36000, - 23000, 5, 72 }, /* 36 Mb */ - [6] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 48000, - 27400, 6, 96 }, /* 48 Mb */ - [7] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 54000, - 29300, 7, 108 }, /* 54 Mb */ - [8] = { RC_HT_SDT_2040, WLAN_RC_PHY_HT_20_SS, 6500, - 6400, 0, 0 }, /* 6.5 Mb */ - [9] = { RC_HT_SDT_20, WLAN_RC_PHY_HT_20_SS, 13000, - 12700, 1, 1 }, /* 13 Mb */ - [10] = { RC_HT_SDT_20, WLAN_RC_PHY_HT_20_SS, 19500, - 18800, 2, 2 }, /* 19.5 Mb */ - [11] = { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 26000, - 25000, 3, 3 }, /* 26 Mb */ - [12] = { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 39000, - 36700, 4, 4 }, /* 39 Mb */ - [13] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 52000, - 48100, 5, 5 }, /* 52 Mb */ - [14] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 58500, - 53500, 6, 6 }, /* 58.5 Mb */ - [15] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 65000, - 59000, 7, 7 }, /* 65 Mb */ - [16] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS_HGI, 72200, - 65400, 7, 7 }, /* 75 Mb */ - [17] = { RC_INVALID, WLAN_RC_PHY_HT_20_DS, 13000, - 12700, 8, 8 }, /* 13 Mb */ - [18] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_DS, 26000, - 24800, 9, 9 }, /* 26 Mb */ - [19] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_DS, 39000, - 36600, 10, 10 }, /* 39 Mb */ - [20] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 52000, - 48100, 11, 11 }, /* 52 Mb */ - [21] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 78000, - 69500, 12, 12 }, /* 78 Mb */ - [22] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 104000, - 89500, 13, 13 }, /* 104 Mb */ - [23] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 117000, - 98900, 14, 14 }, /* 117 Mb */ - [24] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 130000, - 108300, 15, 15 }, /* 130 Mb */ - [25] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS_HGI, 144400, - 120000, 15, 15 }, /* 144.4 Mb */ - [26] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 19500, - 17400, 16, 16 }, /* 19.5 Mb */ - [27] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 39000, - 35100, 17, 17 }, /* 39 Mb */ - [28] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 58500, - 52600, 18, 18 }, /* 58.5 Mb */ - [29] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 78000, - 70400, 19, 19 }, /* 78 Mb */ - [30] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 117000, - 104900, 20, 20 }, /* 117 Mb */ - [31] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS_HGI, 130000, - 115800, 20, 20 }, /* 130 Mb*/ - [32] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS, 156000, - 137200, 21, 21 }, /* 156 Mb */ - [33] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS_HGI, 173300, - 151100, 21, 21 }, /* 173.3 Mb */ - [34] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS, 175500, - 152800, 22, 22 }, /* 175.5 Mb */ - [35] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS_HGI, 195000, - 168400, 22, 22 }, /* 195 Mb*/ - [36] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS, 195000, - 168400, 23, 23 }, /* 195 Mb */ - [37] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS_HGI, 216700, - 185000, 23, 23 }, /* 216.7 Mb */ - [38] = { RC_HT_SDT_40, WLAN_RC_PHY_HT_40_SS, 13500, - 13200, 0, 0 }, /* 13.5 Mb*/ - [39] = { RC_HT_SDT_40, WLAN_RC_PHY_HT_40_SS, 27500, - 25900, 1, 1 }, /* 27.0 Mb*/ - [40] = { RC_HT_SDT_40, WLAN_RC_PHY_HT_40_SS, 40500, - 38600, 2, 2 }, /* 40.5 Mb*/ - [41] = { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 54000, - 49800, 3, 3 }, /* 54 Mb */ - [42] = { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 81500, - 72200, 4, 4 }, /* 81 Mb */ - [43] = { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 108000, - 92900, 5, 5 }, /* 108 Mb */ - [44] = { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 121500, - 102700, 6, 6 }, /* 121.5 Mb*/ - [45] = { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 135000, - 112000, 7, 7 }, /* 135 Mb */ - [46] = { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, - 122000, 7, 7 }, /* 150 Mb */ - [47] = { RC_INVALID, WLAN_RC_PHY_HT_40_DS, 27000, - 25800, 8, 8 }, /* 27 Mb */ - [48] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_DS, 54000, - 49800, 9, 9 }, /* 54 Mb */ - [49] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_DS, 81000, - 71900, 10, 10 }, /* 81 Mb */ - [50] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 108000, - 92500, 11, 11 }, /* 108 Mb */ - [51] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 162000, - 130300, 12, 12 }, /* 162 Mb */ - [52] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 216000, - 162800, 13, 13 }, /* 216 Mb */ - [53] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 243000, - 178200, 14, 14 }, /* 243 Mb */ - [54] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 270000, - 192100, 15, 15 }, /* 270 Mb */ - [55] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS_HGI, 300000, - 207000, 15, 15 }, /* 300 Mb */ - [56] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 40500, - 36100, 16, 16 }, /* 40.5 Mb */ - [57] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 81000, - 72900, 17, 17 }, /* 81 Mb */ - [58] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 121500, - 108300, 18, 18 }, /* 121.5 Mb */ - [59] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 162000, - 142000, 19, 19 }, /* 162 Mb */ - [60] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 243000, - 205100, 20, 20 }, /* 243 Mb */ - [61] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS_HGI, 270000, - 224700, 20, 20 }, /* 270 Mb */ - [62] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS, 324000, - 263100, 21, 21 }, /* 324 Mb */ - [63] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS_HGI, 360000, - 288000, 21, 21 }, /* 360 Mb */ - [64] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS, 364500, - 290700, 22, 22 }, /* 364.5 Mb */ - [65] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS_HGI, 405000, - 317200, 22, 22 }, /* 405 Mb */ - [66] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS, 405000, - 317200, 23, 23 }, /* 405 Mb */ - [67] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS_HGI, 450000, - 346400, 23, 23 }, /* 450 Mb */ - }, - 50, /* probe interval */ - WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ -}; - -/* 4ms frame limit not used for NG mode. The values filled - * for HT are the 64K max aggregate limit */ - -static const struct ath_rate_table ar5416_11ng_ratetable = { - 72, - 12, /* MCS start */ - { - [0] = { RC_ALL, WLAN_RC_PHY_CCK, 1000, - 900, 0, 2 }, /* 1 Mb */ - [1] = { RC_ALL, WLAN_RC_PHY_CCK, 2000, - 1900, 1, 4 }, /* 2 Mb */ - [2] = { RC_ALL, WLAN_RC_PHY_CCK, 5500, - 4900, 2, 11 }, /* 5.5 Mb */ - [3] = { RC_ALL, WLAN_RC_PHY_CCK, 11000, - 8100, 3, 22 }, /* 11 Mb */ - [4] = { RC_INVALID, WLAN_RC_PHY_OFDM, 6000, - 5400, 4, 12 }, /* 6 Mb */ - [5] = { RC_INVALID, WLAN_RC_PHY_OFDM, 9000, - 7800, 5, 18 }, /* 9 Mb */ - [6] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 12000, - 10100, 6, 24 }, /* 12 Mb */ - [7] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 18000, - 14100, 7, 36 }, /* 18 Mb */ - [8] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 24000, - 17700, 8, 48 }, /* 24 Mb */ - [9] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 36000, - 23700, 9, 72 }, /* 36 Mb */ - [10] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 48000, - 27400, 10, 96 }, /* 48 Mb */ - [11] = { RC_L_SDT, WLAN_RC_PHY_OFDM, 54000, - 30900, 11, 108 }, /* 54 Mb */ - [12] = { RC_INVALID, WLAN_RC_PHY_HT_20_SS, 6500, - 6400, 0, 0 }, /* 6.5 Mb */ - [13] = { RC_HT_SDT_20, WLAN_RC_PHY_HT_20_SS, 13000, - 12700, 1, 1 }, /* 13 Mb */ - [14] = { RC_HT_SDT_20, WLAN_RC_PHY_HT_20_SS, 19500, - 18800, 2, 2 }, /* 19.5 Mb*/ - [15] = { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 26000, - 25000, 3, 3 }, /* 26 Mb */ - [16] = { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 39000, - 36700, 4, 4 }, /* 39 Mb */ - [17] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 52000, - 48100, 5, 5 }, /* 52 Mb */ - [18] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 58500, - 53500, 6, 6 }, /* 58.5 Mb */ - [19] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 65000, - 59000, 7, 7 }, /* 65 Mb */ - [20] = { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS_HGI, 72200, - 65400, 7, 7 }, /* 65 Mb*/ - [21] = { RC_INVALID, WLAN_RC_PHY_HT_20_DS, 13000, - 12700, 8, 8 }, /* 13 Mb */ - [22] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_DS, 26000, - 24800, 9, 9 }, /* 26 Mb */ - [23] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_DS, 39000, - 36600, 10, 10 }, /* 39 Mb */ - [24] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 52000, - 48100, 11, 11 }, /* 52 Mb */ - [25] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 78000, - 69500, 12, 12 }, /* 78 Mb */ - [26] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 104000, - 89500, 13, 13 }, /* 104 Mb */ - [27] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 117000, - 98900, 14, 14 }, /* 117 Mb */ - [28] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS, 130000, - 108300, 15, 15 }, /* 130 Mb */ - [29] = { RC_HT_DT_20, WLAN_RC_PHY_HT_20_DS_HGI, 144400, - 120000, 15, 15 }, /* 144.4 Mb */ - [30] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 19500, - 17400, 16, 16 }, /* 19.5 Mb */ - [31] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 39000, - 35100, 17, 17 }, /* 39 Mb */ - [32] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 58500, - 52600, 18, 18 }, /* 58.5 Mb */ - [33] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 78000, - 70400, 19, 19 }, /* 78 Mb */ - [34] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS, 117000, - 104900, 20, 20 }, /* 117 Mb */ - [35] = { RC_INVALID, WLAN_RC_PHY_HT_20_TS_HGI, 130000, - 115800, 20, 20 }, /* 130 Mb */ - [36] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS, 156000, - 137200, 21, 21 }, /* 156 Mb */ - [37] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS_HGI, 173300, - 151100, 21, 21 }, /* 173.3 Mb */ - [38] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS, 175500, - 152800, 22, 22 }, /* 175.5 Mb */ - [39] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS_HGI, 195000, - 168400, 22, 22 }, /* 195 Mb */ - [40] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS, 195000, - 168400, 23, 23 }, /* 195 Mb */ - [41] = { RC_HT_T_20, WLAN_RC_PHY_HT_20_TS_HGI, 216700, - 185000, 23, 23 }, /* 216.7 Mb */ - [42] = { RC_HT_SDT_40, WLAN_RC_PHY_HT_40_SS, 13500, - 13200, 0, 0 }, /* 13.5 Mb */ - [43] = { RC_HT_SDT_40, WLAN_RC_PHY_HT_40_SS, 27500, - 25900, 1, 1 }, /* 27.0 Mb */ - [44] = { RC_HT_SDT_40, WLAN_RC_PHY_HT_40_SS, 40500, - 38600, 2, 2 }, /* 40.5 Mb */ - [45] = { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 54000, - 49800, 3, 3 }, /* 54 Mb */ - [46] = { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 81500, - 72200, 4, 4 }, /* 81 Mb */ - [47] = { RC_HT_S_40 , WLAN_RC_PHY_HT_40_SS, 108000, - 92900, 5, 5 }, /* 108 Mb */ - [48] = { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 121500, - 102700, 6, 6 }, /* 121.5 Mb */ - [49] = { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 135000, - 112000, 7, 7 }, /* 135 Mb */ - [50] = { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, - 122000, 7, 7 }, /* 150 Mb */ - [51] = { RC_INVALID, WLAN_RC_PHY_HT_40_DS, 27000, - 25800, 8, 8 }, /* 27 Mb */ - [52] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_DS, 54000, - 49800, 9, 9 }, /* 54 Mb */ - [53] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_DS, 81000, - 71900, 10, 10 }, /* 81 Mb */ - [54] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 108000, - 92500, 11, 11 }, /* 108 Mb */ - [55] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 162000, - 130300, 12, 12 }, /* 162 Mb */ - [56] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 216000, - 162800, 13, 13 }, /* 216 Mb */ - [57] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 243000, - 178200, 14, 14 }, /* 243 Mb */ - [58] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS, 270000, - 192100, 15, 15 }, /* 270 Mb */ - [59] = { RC_HT_DT_40, WLAN_RC_PHY_HT_40_DS_HGI, 300000, - 207000, 15, 15 }, /* 300 Mb */ - [60] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 40500, - 36100, 16, 16 }, /* 40.5 Mb */ - [61] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 81000, - 72900, 17, 17 }, /* 81 Mb */ - [62] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 121500, - 108300, 18, 18 }, /* 121.5 Mb */ - [63] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 162000, - 142000, 19, 19 }, /* 162 Mb */ - [64] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS, 243000, - 205100, 20, 20 }, /* 243 Mb */ - [65] = { RC_INVALID, WLAN_RC_PHY_HT_40_TS_HGI, 270000, - 224700, 20, 20 }, /* 270 Mb */ - [66] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS, 324000, - 263100, 21, 21 }, /* 324 Mb */ - [67] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS_HGI, 360000, - 288000, 21, 21 }, /* 360 Mb */ - [68] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS, 364500, - 290700, 22, 22 }, /* 364.5 Mb */ - [69] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS_HGI, 405000, - 317200, 22, 22 }, /* 405 Mb */ - [70] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS, 405000, - 317200, 23, 23 }, /* 405 Mb */ - [71] = { RC_HT_T_40, WLAN_RC_PHY_HT_40_TS_HGI, 450000, - 346400, 23, 23 }, /* 450 Mb */ - }, - 50, /* probe interval */ - WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ -}; - -static const struct ath_rate_table ar5416_11a_ratetable = { - 8, - 0, - { - { RC_L_SDT, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ - 5400, 0, 12}, - { RC_L_SDT, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ - 7800, 1, 18}, - { RC_L_SDT, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ - 10000, 2, 24}, - { RC_L_SDT, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ - 13900, 3, 36}, - { RC_L_SDT, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ - 17300, 4, 48}, - { RC_L_SDT, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ - 23000, 5, 72}, - { RC_L_SDT, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ - 27400, 6, 96}, - { RC_L_SDT, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ - 29300, 7, 108}, - }, - 50, /* probe interval */ - 0, /* Phy rates allowed initially */ -}; - -static const struct ath_rate_table ar5416_11g_ratetable = { - 12, - 0, - { - { RC_L_SDT, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ - 900, 0, 2}, - { RC_L_SDT, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ - 1900, 1, 4}, - { RC_L_SDT, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ - 4900, 2, 11}, - { RC_L_SDT, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ - 8100, 3, 22}, - { RC_INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ - 5400, 4, 12}, - { RC_INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ - 7800, 5, 18}, - { RC_L_SDT, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ - 10000, 6, 24}, - { RC_L_SDT, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ - 13900, 7, 36}, - { RC_L_SDT, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ - 17300, 8, 48}, - { RC_L_SDT, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ - 23000, 9, 72}, - { RC_L_SDT, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ - 27400, 10, 96}, - { RC_L_SDT, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ - 29300, 11, 108}, - }, - 50, /* probe interval */ - 0, /* Phy rates allowed initially */ -}; - -static int ath_rc_get_rateindex(struct ath_rate_priv *ath_rc_priv, - struct ieee80211_tx_rate *rate) -{ - const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; - int rix, i, idx = 0; - - if (!(rate->flags & IEEE80211_TX_RC_MCS)) - return rate->idx; - - for (i = 0; i < ath_rc_priv->max_valid_rate; i++) { - idx = ath_rc_priv->valid_rate_index[i]; - - if (WLAN_RC_PHY_HT(rate_table->info[idx].phy) && - rate_table->info[idx].ratecode == rate->idx) - break; - } - - rix = idx; - - if (rate->flags & IEEE80211_TX_RC_SHORT_GI) - rix++; - - return rix; -} - -static void ath_rc_sort_validrates(struct ath_rate_priv *ath_rc_priv) -{ - const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; - u8 i, j, idx, idx_next; - - for (i = ath_rc_priv->max_valid_rate - 1; i > 0; i--) { - for (j = 0; j <= i-1; j++) { - idx = ath_rc_priv->valid_rate_index[j]; - idx_next = ath_rc_priv->valid_rate_index[j+1]; - - if (rate_table->info[idx].ratekbps > - rate_table->info[idx_next].ratekbps) { - ath_rc_priv->valid_rate_index[j] = idx_next; - ath_rc_priv->valid_rate_index[j+1] = idx; - } - } - } -} - -static inline -int ath_rc_get_nextvalid_txrate(const struct ath_rate_table *rate_table, - struct ath_rate_priv *ath_rc_priv, - u8 cur_valid_txrate, - u8 *next_idx) -{ - u8 i; - - for (i = 0; i < ath_rc_priv->max_valid_rate - 1; i++) { - if (ath_rc_priv->valid_rate_index[i] == cur_valid_txrate) { - *next_idx = ath_rc_priv->valid_rate_index[i+1]; - return 1; - } - } - - /* No more valid rates */ - *next_idx = 0; - - return 0; -} - -/* Return true only for single stream */ - -static int ath_rc_valid_phyrate(u32 phy, u32 capflag, int ignore_cw) -{ - if (WLAN_RC_PHY_HT(phy) && !(capflag & WLAN_RC_HT_FLAG)) - return 0; - if (WLAN_RC_PHY_DS(phy) && !(capflag & WLAN_RC_DS_FLAG)) - return 0; - if (WLAN_RC_PHY_TS(phy) && !(capflag & WLAN_RC_TS_FLAG)) - return 0; - if (WLAN_RC_PHY_SGI(phy) && !(capflag & WLAN_RC_SGI_FLAG)) - return 0; - if (!ignore_cw && WLAN_RC_PHY_HT(phy)) - if (WLAN_RC_PHY_40(phy) && !(capflag & WLAN_RC_40_FLAG)) - return 0; - return 1; -} - -static inline int -ath_rc_get_lower_rix(struct ath_rate_priv *ath_rc_priv, - u8 cur_valid_txrate, u8 *next_idx) -{ - int8_t i; - - for (i = 1; i < ath_rc_priv->max_valid_rate ; i++) { - if (ath_rc_priv->valid_rate_index[i] == cur_valid_txrate) { - *next_idx = ath_rc_priv->valid_rate_index[i-1]; - return 1; - } - } - - return 0; -} - -static u8 ath_rc_init_validrates(struct ath_rate_priv *ath_rc_priv) -{ - const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; - u8 i, hi = 0; - - for (i = 0; i < rate_table->rate_cnt; i++) { - if (rate_table->info[i].rate_flags & RC_LEGACY) { - u32 phy = rate_table->info[i].phy; - u8 valid_rate_count = 0; - - if (!ath_rc_valid_phyrate(phy, ath_rc_priv->ht_cap, 0)) - continue; - - valid_rate_count = ath_rc_priv->valid_phy_ratecnt[phy]; - - ath_rc_priv->valid_phy_rateidx[phy][valid_rate_count] = i; - ath_rc_priv->valid_phy_ratecnt[phy] += 1; - ath_rc_priv->valid_rate_index[i] = true; - hi = i; - } - } - - return hi; -} - -static inline bool ath_rc_check_legacy(u8 rate, u8 dot11rate, u16 rate_flags, - u32 phy, u32 capflag) -{ - if (rate != dot11rate || WLAN_RC_PHY_HT(phy)) - return false; - - if ((rate_flags & WLAN_RC_CAP_MODE(capflag)) != WLAN_RC_CAP_MODE(capflag)) - return false; - - if (!(rate_flags & WLAN_RC_CAP_STREAM(capflag))) - return false; - - return true; -} - -static inline bool ath_rc_check_ht(u8 rate, u8 dot11rate, u16 rate_flags, - u32 phy, u32 capflag) -{ - if (rate != dot11rate || !WLAN_RC_PHY_HT(phy)) - return false; - - if (!WLAN_RC_PHY_HT_VALID(rate_flags, capflag)) - return false; - - if (!(rate_flags & WLAN_RC_CAP_STREAM(capflag))) - return false; - - return true; -} - -static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv, bool legacy) -{ - const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; - struct ath_rateset *rateset; - u32 phy, capflag = ath_rc_priv->ht_cap; - u16 rate_flags; - u8 i, j, hi = 0, rate, dot11rate, valid_rate_count; - - if (legacy) - rateset = &ath_rc_priv->neg_rates; - else - rateset = &ath_rc_priv->neg_ht_rates; - - for (i = 0; i < rateset->rs_nrates; i++) { - for (j = 0; j < rate_table->rate_cnt; j++) { - phy = rate_table->info[j].phy; - rate_flags = rate_table->info[j].rate_flags; - rate = rateset->rs_rates[i]; - dot11rate = rate_table->info[j].dot11rate; - - if (legacy && - !ath_rc_check_legacy(rate, dot11rate, - rate_flags, phy, capflag)) - continue; - - if (!legacy && - !ath_rc_check_ht(rate, dot11rate, - rate_flags, phy, capflag)) - continue; - - if (!ath_rc_valid_phyrate(phy, capflag, 0)) - continue; - - valid_rate_count = ath_rc_priv->valid_phy_ratecnt[phy]; - ath_rc_priv->valid_phy_rateidx[phy][valid_rate_count] = j; - ath_rc_priv->valid_phy_ratecnt[phy] += 1; - ath_rc_priv->valid_rate_index[j] = true; - hi = max(hi, j); - } - } - - return hi; -} - -static u8 ath_rc_get_highest_rix(struct ath_rate_priv *ath_rc_priv, - int *is_probing) -{ - const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; - u32 best_thruput, this_thruput, now_msec; - u8 rate, next_rate, best_rate, maxindex, minindex; - int8_t index = 0; - - now_msec = jiffies_to_msecs(jiffies); - *is_probing = 0; - best_thruput = 0; - maxindex = ath_rc_priv->max_valid_rate-1; - minindex = 0; - best_rate = minindex; - - /* - * Try the higher rate first. It will reduce memory moving time - * if we have very good channel characteristics. - */ - for (index = maxindex; index >= minindex ; index--) { - u8 per_thres; - - rate = ath_rc_priv->valid_rate_index[index]; - if (rate > ath_rc_priv->rate_max_phy) - continue; - - /* - * For TCP the average collision rate is around 11%, - * so we ignore PERs less than this. This is to - * prevent the rate we are currently using (whose - * PER might be in the 10-15 range because of TCP - * collisions) looking worse than the next lower - * rate whose PER has decayed close to 0. If we - * used to next lower rate, its PER would grow to - * 10-15 and we would be worse off then staying - * at the current rate. - */ - per_thres = ath_rc_priv->per[rate]; - if (per_thres < 12) - per_thres = 12; - - this_thruput = rate_table->info[rate].user_ratekbps * - (100 - per_thres); - - if (best_thruput <= this_thruput) { - best_thruput = this_thruput; - best_rate = rate; - } - } - - rate = best_rate; - - /* - * Must check the actual rate (ratekbps) to account for - * non-monoticity of 11g's rate table - */ - - if (rate >= ath_rc_priv->rate_max_phy) { - rate = ath_rc_priv->rate_max_phy; - - /* Probe the next allowed phy state */ - if (ath_rc_get_nextvalid_txrate(rate_table, - ath_rc_priv, rate, &next_rate) && - (now_msec - ath_rc_priv->probe_time > - rate_table->probe_interval) && - (ath_rc_priv->hw_maxretry_pktcnt >= 1)) { - rate = next_rate; - ath_rc_priv->probe_rate = rate; - ath_rc_priv->probe_time = now_msec; - ath_rc_priv->hw_maxretry_pktcnt = 0; - *is_probing = 1; - } - } - - if (rate > (ath_rc_priv->rate_table_size - 1)) - rate = ath_rc_priv->rate_table_size - 1; - - if (RC_TS_ONLY(rate_table->info[rate].rate_flags) && - (ath_rc_priv->ht_cap & WLAN_RC_TS_FLAG)) - return rate; - - if (RC_DS_OR_LATER(rate_table->info[rate].rate_flags) && - (ath_rc_priv->ht_cap & (WLAN_RC_DS_FLAG | WLAN_RC_TS_FLAG))) - return rate; - - if (RC_SS_OR_LEGACY(rate_table->info[rate].rate_flags)) - return rate; - - /* This should not happen */ - WARN_ON_ONCE(1); - - rate = ath_rc_priv->valid_rate_index[0]; - - return rate; -} - -static void ath_rc_rate_set_series(const struct ath_rate_table *rate_table, - struct ieee80211_tx_rate *rate, - struct ieee80211_tx_rate_control *txrc, - u8 tries, u8 rix, int rtsctsenable) -{ - rate->count = tries; - rate->idx = rate_table->info[rix].ratecode; - - if (txrc->rts || rtsctsenable) - rate->flags |= IEEE80211_TX_RC_USE_RTS_CTS; - - if (WLAN_RC_PHY_HT(rate_table->info[rix].phy)) { - rate->flags |= IEEE80211_TX_RC_MCS; - if (WLAN_RC_PHY_40(rate_table->info[rix].phy) && - conf_is_ht40(&txrc->hw->conf)) - rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; - if (WLAN_RC_PHY_SGI(rate_table->info[rix].phy)) - rate->flags |= IEEE80211_TX_RC_SHORT_GI; - } -} - -static void ath_rc_rate_set_rtscts(struct ath_softc *sc, - const struct ath_rate_table *rate_table, - struct ieee80211_tx_info *tx_info) -{ - struct ieee80211_bss_conf *bss_conf; - - if (!tx_info->control.vif) - return; - /* - * For legacy frames, mac80211 takes care of CTS protection. - */ - if (!(tx_info->control.rates[0].flags & IEEE80211_TX_RC_MCS)) - return; - - bss_conf = &tx_info->control.vif->bss_conf; - - if (!bss_conf->basic_rates) - return; - - /* - * For now, use the lowest allowed basic rate for HT frames. - */ - tx_info->control.rts_cts_rate_idx = __ffs(bss_conf->basic_rates); -} - -static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, - struct ieee80211_tx_rate_control *txrc) -{ - struct ath_softc *sc = priv; - struct ath_rate_priv *ath_rc_priv = priv_sta; - const struct ath_rate_table *rate_table; - struct sk_buff *skb = txrc->skb; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_tx_rate *rates = tx_info->control.rates; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - __le16 fc = hdr->frame_control; - u8 try_per_rate, i = 0, rix; - int is_probe = 0; - - if (rate_control_send_low(sta, priv_sta, txrc)) - return; - - /* - * For Multi Rate Retry we use a different number of - * retry attempt counts. This ends up looking like this: - * - * MRR[0] = 4 - * MRR[1] = 4 - * MRR[2] = 4 - * MRR[3] = 8 - * - */ - try_per_rate = 4; - - rate_table = ath_rc_priv->rate_table; - rix = ath_rc_get_highest_rix(ath_rc_priv, &is_probe); - - if (conf_is_ht(&sc->hw->conf) && - (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING)) - tx_info->flags |= IEEE80211_TX_CTL_LDPC; - - if (conf_is_ht(&sc->hw->conf) && - (sta->ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)) - tx_info->flags |= (1 << IEEE80211_TX_CTL_STBC_SHIFT); - - if (is_probe) { - /* - * Set one try for probe rates. For the - * probes don't enable RTS. - */ - ath_rc_rate_set_series(rate_table, &rates[i++], txrc, - 1, rix, 0); - /* - * Get the next tried/allowed rate. - * No RTS for the next series after the probe rate. - */ - ath_rc_get_lower_rix(ath_rc_priv, rix, &rix); - ath_rc_rate_set_series(rate_table, &rates[i++], txrc, - try_per_rate, rix, 0); - - tx_info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; - } else { - /* - * Set the chosen rate. No RTS for first series entry. - */ - ath_rc_rate_set_series(rate_table, &rates[i++], txrc, - try_per_rate, rix, 0); - } - - for ( ; i < 4; i++) { - /* - * Use twice the number of tries for the last MRR segment. - */ - if (i + 1 == 4) - try_per_rate = 8; - - ath_rc_get_lower_rix(ath_rc_priv, rix, &rix); - - /* - * All other rates in the series have RTS enabled. - */ - ath_rc_rate_set_series(rate_table, &rates[i], txrc, - try_per_rate, rix, 1); - } - - /* - * NB:Change rate series to enable aggregation when operating - * at lower MCS rates. When first rate in series is MCS2 - * in HT40 @ 2.4GHz, series should look like: - * - * {MCS2, MCS1, MCS0, MCS0}. - * - * When first rate in series is MCS3 in HT20 @ 2.4GHz, series should - * look like: - * - * {MCS3, MCS2, MCS1, MCS1} - * - * So, set fourth rate in series to be same as third one for - * above conditions. - */ - if ((sc->hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) && - (conf_is_ht(&sc->hw->conf))) { - u8 dot11rate = rate_table->info[rix].dot11rate; - u8 phy = rate_table->info[rix].phy; - if (i == 4 && - ((dot11rate == 2 && phy == WLAN_RC_PHY_HT_40_SS) || - (dot11rate == 3 && phy == WLAN_RC_PHY_HT_20_SS))) { - rates[3].idx = rates[2].idx; - rates[3].flags = rates[2].flags; - } - } - - /* - * Force hardware to use computed duration for next - * fragment by disabling multi-rate retry, which - * updates duration based on the multi-rate duration table. - * - * FIXME: Fix duration - */ - if (ieee80211_has_morefrags(fc) || - (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG)) { - rates[1].count = rates[2].count = rates[3].count = 0; - rates[1].idx = rates[2].idx = rates[3].idx = 0; - rates[0].count = ATH_TXMAXTRY; - } - - ath_rc_rate_set_rtscts(sc, rate_table, tx_info); -} - -static void ath_rc_update_per(struct ath_softc *sc, - const struct ath_rate_table *rate_table, - struct ath_rate_priv *ath_rc_priv, - struct ieee80211_tx_info *tx_info, - int tx_rate, int xretries, int retries, - u32 now_msec) -{ - int count, n_bad_frames; - u8 last_per; - static const u32 nretry_to_per_lookup[10] = { - 100 * 0 / 1, - 100 * 1 / 4, - 100 * 1 / 2, - 100 * 3 / 4, - 100 * 4 / 5, - 100 * 5 / 6, - 100 * 6 / 7, - 100 * 7 / 8, - 100 * 8 / 9, - 100 * 9 / 10 - }; - - last_per = ath_rc_priv->per[tx_rate]; - n_bad_frames = tx_info->status.ampdu_len - tx_info->status.ampdu_ack_len; - - if (xretries) { - if (xretries == 1) { - ath_rc_priv->per[tx_rate] += 30; - if (ath_rc_priv->per[tx_rate] > 100) - ath_rc_priv->per[tx_rate] = 100; - } else { - /* xretries == 2 */ - count = ARRAY_SIZE(nretry_to_per_lookup); - if (retries >= count) - retries = count - 1; - - /* new_PER = 7/8*old_PER + 1/8*(currentPER) */ - ath_rc_priv->per[tx_rate] = - (u8)(last_per - (last_per >> 3) + (100 >> 3)); - } - - /* xretries == 1 or 2 */ - - if (ath_rc_priv->probe_rate == tx_rate) - ath_rc_priv->probe_rate = 0; - - } else { /* xretries == 0 */ - count = ARRAY_SIZE(nretry_to_per_lookup); - if (retries >= count) - retries = count - 1; - - if (n_bad_frames) { - /* new_PER = 7/8*old_PER + 1/8*(currentPER) - * Assuming that n_frames is not 0. The current PER - * from the retries is 100 * retries / (retries+1), - * since the first retries attempts failed, and the - * next one worked. For the one that worked, - * n_bad_frames subframes out of n_frames wored, - * so the PER for that part is - * 100 * n_bad_frames / n_frames, and it contributes - * 100 * n_bad_frames / (n_frames * (retries+1)) to - * the above PER. The expression below is a - * simplified version of the sum of these two terms. - */ - if (tx_info->status.ampdu_len > 0) { - int n_frames, n_bad_tries; - u8 cur_per, new_per; - - n_bad_tries = retries * tx_info->status.ampdu_len + - n_bad_frames; - n_frames = tx_info->status.ampdu_len * (retries + 1); - cur_per = (100 * n_bad_tries / n_frames) >> 3; - new_per = (u8)(last_per - (last_per >> 3) + cur_per); - ath_rc_priv->per[tx_rate] = new_per; - } - } else { - ath_rc_priv->per[tx_rate] = - (u8)(last_per - (last_per >> 3) + - (nretry_to_per_lookup[retries] >> 3)); - } - - - /* - * If we got at most one retry then increase the max rate if - * this was a probe. Otherwise, ignore the probe. - */ - if (ath_rc_priv->probe_rate && ath_rc_priv->probe_rate == tx_rate) { - if (retries > 0 || 2 * n_bad_frames > tx_info->status.ampdu_len) { - /* - * Since we probed with just a single attempt, - * any retries means the probe failed. Also, - * if the attempt worked, but more than half - * the subframes were bad then also consider - * the probe a failure. - */ - ath_rc_priv->probe_rate = 0; - } else { - u8 probe_rate = 0; - - ath_rc_priv->rate_max_phy = - ath_rc_priv->probe_rate; - probe_rate = ath_rc_priv->probe_rate; - - if (ath_rc_priv->per[probe_rate] > 30) - ath_rc_priv->per[probe_rate] = 20; - - ath_rc_priv->probe_rate = 0; - - /* - * Since this probe succeeded, we allow the next - * probe twice as soon. This allows the maxRate - * to move up faster if the probes are - * successful. - */ - ath_rc_priv->probe_time = - now_msec - rate_table->probe_interval / 2; - } - } - - if (retries > 0) { - /* - * Don't update anything. We don't know if - * this was because of collisions or poor signal. - */ - ath_rc_priv->hw_maxretry_pktcnt = 0; - } else { - /* - * It worked with no retries. First ignore bogus (small) - * rssi_ack values. - */ - if (tx_rate == ath_rc_priv->rate_max_phy && - ath_rc_priv->hw_maxretry_pktcnt < 255) { - ath_rc_priv->hw_maxretry_pktcnt++; - } - - } - } -} - -static void ath_rc_update_ht(struct ath_softc *sc, - struct ath_rate_priv *ath_rc_priv, - struct ieee80211_tx_info *tx_info, - int tx_rate, int xretries, int retries) -{ - u32 now_msec = jiffies_to_msecs(jiffies); - int rate; - u8 last_per; - const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; - int size = ath_rc_priv->rate_table_size; - - if ((tx_rate < 0) || (tx_rate > rate_table->rate_cnt)) - return; - - last_per = ath_rc_priv->per[tx_rate]; - - /* Update PER first */ - ath_rc_update_per(sc, rate_table, ath_rc_priv, - tx_info, tx_rate, xretries, - retries, now_msec); - - /* - * If this rate looks bad (high PER) then stop using it for - * a while (except if we are probing). - */ - if (ath_rc_priv->per[tx_rate] >= 55 && tx_rate > 0 && - rate_table->info[tx_rate].ratekbps <= - rate_table->info[ath_rc_priv->rate_max_phy].ratekbps) { - ath_rc_get_lower_rix(ath_rc_priv, (u8)tx_rate, - &ath_rc_priv->rate_max_phy); - - /* Don't probe for a little while. */ - ath_rc_priv->probe_time = now_msec; - } - - /* Make sure the rates below this have lower PER */ - /* Monotonicity is kept only for rates below the current rate. */ - if (ath_rc_priv->per[tx_rate] < last_per) { - for (rate = tx_rate - 1; rate >= 0; rate--) { - - if (ath_rc_priv->per[rate] > - ath_rc_priv->per[rate+1]) { - ath_rc_priv->per[rate] = - ath_rc_priv->per[rate+1]; - } - } - } - - /* Maintain monotonicity for rates above the current rate */ - for (rate = tx_rate; rate < size - 1; rate++) { - if (ath_rc_priv->per[rate+1] < - ath_rc_priv->per[rate]) - ath_rc_priv->per[rate+1] = - ath_rc_priv->per[rate]; - } - - /* Every so often, we reduce the thresholds - * and PER (different for CCK and OFDM). */ - if (now_msec - ath_rc_priv->per_down_time >= - rate_table->probe_interval) { - for (rate = 0; rate < size; rate++) { - ath_rc_priv->per[rate] = - 7 * ath_rc_priv->per[rate] / 8; - } - - ath_rc_priv->per_down_time = now_msec; - } - - ath_debug_stat_retries(ath_rc_priv, tx_rate, xretries, retries, - ath_rc_priv->per[tx_rate]); - -} - -static void ath_rc_tx_status(struct ath_softc *sc, - struct ath_rate_priv *ath_rc_priv, - struct sk_buff *skb) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_tx_rate *rates = tx_info->status.rates; - struct ieee80211_tx_rate *rate; - int final_ts_idx = 0, xretries = 0, long_retry = 0; - u8 flags; - u32 i = 0, rix; - - for (i = 0; i < sc->hw->max_rates; i++) { - rate = &tx_info->status.rates[i]; - if (rate->idx < 0 || !rate->count) - break; - - final_ts_idx = i; - long_retry = rate->count - 1; - } - - if (!(tx_info->flags & IEEE80211_TX_STAT_ACK)) - xretries = 1; - - /* - * If the first rate is not the final index, there - * are intermediate rate failures to be processed. - */ - if (final_ts_idx != 0) { - for (i = 0; i < final_ts_idx ; i++) { - if (rates[i].count != 0 && (rates[i].idx >= 0)) { - flags = rates[i].flags; - - /* If HT40 and we have switched mode from - * 40 to 20 => don't update */ - - if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && - !(ath_rc_priv->ht_cap & WLAN_RC_40_FLAG)) - return; - - rix = ath_rc_get_rateindex(ath_rc_priv, &rates[i]); - ath_rc_update_ht(sc, ath_rc_priv, tx_info, - rix, xretries ? 1 : 2, - rates[i].count); - } - } - } - - flags = rates[final_ts_idx].flags; - - /* If HT40 and we have switched mode from 40 to 20 => don't update */ - if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && - !(ath_rc_priv->ht_cap & WLAN_RC_40_FLAG)) - return; - - rix = ath_rc_get_rateindex(ath_rc_priv, &rates[final_ts_idx]); - ath_rc_update_ht(sc, ath_rc_priv, tx_info, rix, xretries, long_retry); - ath_debug_stat_rc(ath_rc_priv, rix); -} - -static const -struct ath_rate_table *ath_choose_rate_table(struct ath_softc *sc, - enum ieee80211_band band, - bool is_ht) -{ - switch(band) { - case IEEE80211_BAND_2GHZ: - if (is_ht) - return &ar5416_11ng_ratetable; - return &ar5416_11g_ratetable; - case IEEE80211_BAND_5GHZ: - if (is_ht) - return &ar5416_11na_ratetable; - return &ar5416_11a_ratetable; - default: - return NULL; - } -} - -static void ath_rc_init(struct ath_softc *sc, - struct ath_rate_priv *ath_rc_priv) -{ - const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; - struct ath_rateset *rateset = &ath_rc_priv->neg_rates; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - u8 i, j, k, hi = 0, hthi = 0; - - ath_rc_priv->rate_table_size = RATE_TABLE_SIZE; - - for (i = 0 ; i < ath_rc_priv->rate_table_size; i++) { - ath_rc_priv->per[i] = 0; - ath_rc_priv->valid_rate_index[i] = 0; - } - - for (i = 0; i < WLAN_RC_PHY_MAX; i++) { - for (j = 0; j < RATE_TABLE_SIZE; j++) - ath_rc_priv->valid_phy_rateidx[i][j] = 0; - ath_rc_priv->valid_phy_ratecnt[i] = 0; - } - - if (!rateset->rs_nrates) { - hi = ath_rc_init_validrates(ath_rc_priv); - } else { - hi = ath_rc_setvalid_rates(ath_rc_priv, true); - - if (ath_rc_priv->ht_cap & WLAN_RC_HT_FLAG) - hthi = ath_rc_setvalid_rates(ath_rc_priv, false); - - hi = max(hi, hthi); - } - - ath_rc_priv->rate_table_size = hi + 1; - ath_rc_priv->rate_max_phy = 0; - WARN_ON(ath_rc_priv->rate_table_size > RATE_TABLE_SIZE); - - for (i = 0, k = 0; i < WLAN_RC_PHY_MAX; i++) { - for (j = 0; j < ath_rc_priv->valid_phy_ratecnt[i]; j++) { - ath_rc_priv->valid_rate_index[k++] = - ath_rc_priv->valid_phy_rateidx[i][j]; - } - - if (!ath_rc_valid_phyrate(i, rate_table->initial_ratemax, 1) || - !ath_rc_priv->valid_phy_ratecnt[i]) - continue; - - ath_rc_priv->rate_max_phy = ath_rc_priv->valid_phy_rateidx[i][j-1]; - } - WARN_ON(ath_rc_priv->rate_table_size > RATE_TABLE_SIZE); - WARN_ON(k > RATE_TABLE_SIZE); - - ath_rc_priv->max_valid_rate = k; - ath_rc_sort_validrates(ath_rc_priv); - ath_rc_priv->rate_max_phy = (k > 4) ? - ath_rc_priv->valid_rate_index[k-4] : - ath_rc_priv->valid_rate_index[k-1]; - - ath_dbg(common, CONFIG, "RC Initialized with capabilities: 0x%x\n", - ath_rc_priv->ht_cap); -} - -static u8 ath_rc_build_ht_caps(struct ath_softc *sc, struct ieee80211_sta *sta) -{ - u8 caps = 0; - - if (sta->ht_cap.ht_supported) { - caps = WLAN_RC_HT_FLAG; - if (sta->ht_cap.mcs.rx_mask[1] && sta->ht_cap.mcs.rx_mask[2]) - caps |= WLAN_RC_TS_FLAG | WLAN_RC_DS_FLAG; - else if (sta->ht_cap.mcs.rx_mask[1]) - caps |= WLAN_RC_DS_FLAG; - if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) { - caps |= WLAN_RC_40_FLAG; - if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) - caps |= WLAN_RC_SGI_FLAG; - } else { - if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) - caps |= WLAN_RC_SGI_FLAG; - } - } - - return caps; -} - -static bool ath_tx_aggr_check(struct ath_softc *sc, struct ieee80211_sta *sta, - u8 tidno) -{ - struct ath_node *an = (struct ath_node *)sta->drv_priv; - struct ath_atx_tid *txtid; - - if (!sta->ht_cap.ht_supported) - return false; - - txtid = ATH_AN_2_TID(an, tidno); - return !txtid->active; -} - - -/***********************************/ -/* mac80211 Rate Control callbacks */ -/***********************************/ - -static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta, - struct sk_buff *skb) -{ - struct ath_softc *sc = priv; - struct ath_rate_priv *ath_rc_priv = priv_sta; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - __le16 fc = hdr->frame_control; - - if (!priv_sta || !ieee80211_is_data(fc)) - return; - - /* This packet was aggregated but doesn't carry status info */ - if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && - !(tx_info->flags & IEEE80211_TX_STAT_AMPDU)) - return; - - if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) - return; - - ath_rc_tx_status(sc, ath_rc_priv, skb); - - /* Check if aggregation has to be enabled for this tid */ - if (conf_is_ht(&sc->hw->conf) && - !(skb->protocol == cpu_to_be16(ETH_P_PAE))) { - if (ieee80211_is_data_qos(fc) && - skb_get_queue_mapping(skb) != IEEE80211_AC_VO) { - u8 *qc, tid; - - qc = ieee80211_get_qos_ctl(hdr); - tid = qc[0] & 0xf; - - if(ath_tx_aggr_check(sc, sta, tid)) - ieee80211_start_tx_ba_session(sta, tid, 0); - } - } -} - -static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta) -{ - struct ath_softc *sc = priv; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_rate_priv *ath_rc_priv = priv_sta; - int i, j = 0; - - for (i = 0; i < sband->n_bitrates; i++) { - if (sta->supp_rates[sband->band] & BIT(i)) { - ath_rc_priv->neg_rates.rs_rates[j] - = (sband->bitrates[i].bitrate * 2) / 10; - j++; - } - } - ath_rc_priv->neg_rates.rs_nrates = j; - - if (sta->ht_cap.ht_supported) { - for (i = 0, j = 0; i < 77; i++) { - if (sta->ht_cap.mcs.rx_mask[i/8] & (1<<(i%8))) - ath_rc_priv->neg_ht_rates.rs_rates[j++] = i; - if (j == ATH_RATE_MAX) - break; - } - ath_rc_priv->neg_ht_rates.rs_nrates = j; - } - - ath_rc_priv->rate_table = ath_choose_rate_table(sc, sband->band, - sta->ht_cap.ht_supported); - if (!ath_rc_priv->rate_table) { - ath_err(common, "No rate table chosen\n"); - return; - } - - ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta); - ath_rc_init(sc, priv_sta); -} - -static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta, - u32 changed) -{ - struct ath_softc *sc = priv; - struct ath_rate_priv *ath_rc_priv = priv_sta; - - if (changed & IEEE80211_RC_BW_CHANGED) { - ath_rc_priv->ht_cap = ath_rc_build_ht_caps(sc, sta); - ath_rc_init(sc, priv_sta); - - ath_dbg(ath9k_hw_common(sc->sc_ah), CONFIG, - "Operating HT Bandwidth changed to: %d\n", - cfg80211_get_chandef_type(&sc->hw->conf.chandef)); - } -} - -#if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS) - -void ath_debug_stat_rc(struct ath_rate_priv *rc, int final_rate) -{ - struct ath_rc_stats *stats; - - stats = &rc->rcstats[final_rate]; - stats->success++; -} - -void ath_debug_stat_retries(struct ath_rate_priv *rc, int rix, - int xretries, int retries, u8 per) -{ - struct ath_rc_stats *stats = &rc->rcstats[rix]; - - stats->xretries += xretries; - stats->retries += retries; - stats->per = per; -} - -static ssize_t read_file_rcstat(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ath_rate_priv *rc = file->private_data; - char *buf; - unsigned int len = 0, max; - int rix; - ssize_t retval; - - if (rc->rate_table == NULL) - return 0; - - max = 80 + rc->rate_table_size * 1024 + 1; - buf = kmalloc(max, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - len += sprintf(buf, "%6s %6s %6s " - "%10s %10s %10s %10s\n", - "HT", "MCS", "Rate", - "Success", "Retries", "XRetries", "PER"); - - for (rix = 0; rix < rc->max_valid_rate; rix++) { - u8 i = rc->valid_rate_index[rix]; - u32 ratekbps = rc->rate_table->info[i].ratekbps; - struct ath_rc_stats *stats = &rc->rcstats[i]; - char mcs[5]; - char htmode[5]; - int used_mcs = 0, used_htmode = 0; - - if (WLAN_RC_PHY_HT(rc->rate_table->info[i].phy)) { - used_mcs = snprintf(mcs, 5, "%d", - rc->rate_table->info[i].ratecode); - - if (WLAN_RC_PHY_40(rc->rate_table->info[i].phy)) - used_htmode = snprintf(htmode, 5, "HT40"); - else if (WLAN_RC_PHY_20(rc->rate_table->info[i].phy)) - used_htmode = snprintf(htmode, 5, "HT20"); - else - used_htmode = snprintf(htmode, 5, "????"); - } - - mcs[used_mcs] = '\0'; - htmode[used_htmode] = '\0'; - - len += snprintf(buf + len, max - len, - "%6s %6s %3u.%d: " - "%10u %10u %10u %10u\n", - htmode, - mcs, - ratekbps / 1000, - (ratekbps % 1000) / 100, - stats->success, - stats->retries, - stats->xretries, - stats->per); - } - - if (len > max) - len = max; - - retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); - kfree(buf); - return retval; -} - -static const struct file_operations fops_rcstat = { - .read = read_file_rcstat, - .open = simple_open, - .owner = THIS_MODULE -}; - -static void ath_rate_add_sta_debugfs(void *priv, void *priv_sta, - struct dentry *dir) -{ - struct ath_rate_priv *rc = priv_sta; - rc->debugfs_rcstats = debugfs_create_file("rc_stats", S_IRUGO, - dir, rc, &fops_rcstat); -} - -static void ath_rate_remove_sta_debugfs(void *priv, void *priv_sta) -{ - struct ath_rate_priv *rc = priv_sta; - debugfs_remove(rc->debugfs_rcstats); -} - -#endif /* CONFIG_MAC80211_DEBUGFS && CONFIG_ATH9K_DEBUGFS */ - -static void *ath_rate_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) -{ - return hw->priv; -} - -static void ath_rate_free(void *priv) -{ - return; -} - -static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) -{ - return kzalloc(sizeof(struct ath_rate_priv), gfp); -} - -static void ath_rate_free_sta(void *priv, struct ieee80211_sta *sta, - void *priv_sta) -{ - struct ath_rate_priv *rate_priv = priv_sta; - kfree(rate_priv); -} - -static struct rate_control_ops ath_rate_ops = { - .module = NULL, - .name = "ath9k_rate_control", - .tx_status = ath_tx_status, - .get_rate = ath_get_rate, - .rate_init = ath_rate_init, - .rate_update = ath_rate_update, - .alloc = ath_rate_alloc, - .free = ath_rate_free, - .alloc_sta = ath_rate_alloc_sta, - .free_sta = ath_rate_free_sta, - -#if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS) - .add_sta_debugfs = ath_rate_add_sta_debugfs, - .remove_sta_debugfs = ath_rate_remove_sta_debugfs, -#endif -}; - -int ath_rate_control_register(void) -{ - return ieee80211_rate_control_register(&ath_rate_ops); -} - -void ath_rate_control_unregister(void) -{ - ieee80211_rate_control_unregister(&ath_rate_ops); -} diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h deleted file mode 100644 index b9a87383cb43..000000000000 --- a/drivers/net/wireless/ath/ath9k/rc.h +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (c) 2004 Sam Leffler, Errno Consulting - * Copyright (c) 2004 Video54 Technologies, Inc. - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef RC_H -#define RC_H - -#include "hw.h" - -struct ath_softc; - -#define ATH_RATE_MAX 30 -#define RATE_TABLE_SIZE 72 - -#define RC_INVALID 0x0000 -#define RC_LEGACY 0x0001 -#define RC_SS 0x0002 -#define RC_DS 0x0004 -#define RC_TS 0x0008 -#define RC_HT_20 0x0010 -#define RC_HT_40 0x0020 - -#define RC_STREAM_MASK 0xe -#define RC_DS_OR_LATER(f) ((((f) & RC_STREAM_MASK) == RC_DS) || \ - (((f) & RC_STREAM_MASK) == (RC_DS | RC_TS))) -#define RC_TS_ONLY(f) (((f) & RC_STREAM_MASK) == RC_TS) -#define RC_SS_OR_LEGACY(f) ((f) & (RC_SS | RC_LEGACY)) - -#define RC_HT_2040 (RC_HT_20 | RC_HT_40) -#define RC_ALL_STREAM (RC_SS | RC_DS | RC_TS) -#define RC_L_SD (RC_LEGACY | RC_SS | RC_DS) -#define RC_L_SDT (RC_LEGACY | RC_SS | RC_DS | RC_TS) -#define RC_HT_S_20 (RC_HT_20 | RC_SS) -#define RC_HT_D_20 (RC_HT_20 | RC_DS) -#define RC_HT_T_20 (RC_HT_20 | RC_TS) -#define RC_HT_S_40 (RC_HT_40 | RC_SS) -#define RC_HT_D_40 (RC_HT_40 | RC_DS) -#define RC_HT_T_40 (RC_HT_40 | RC_TS) - -#define RC_HT_SD_20 (RC_HT_20 | RC_SS | RC_DS) -#define RC_HT_DT_20 (RC_HT_20 | RC_DS | RC_TS) -#define RC_HT_SD_40 (RC_HT_40 | RC_SS | RC_DS) -#define RC_HT_DT_40 (RC_HT_40 | RC_DS | RC_TS) - -#define RC_HT_SD_2040 (RC_HT_2040 | RC_SS | RC_DS) -#define RC_HT_SDT_2040 (RC_HT_2040 | RC_SS | RC_DS | RC_TS) - -#define RC_HT_SDT_20 (RC_HT_20 | RC_SS | RC_DS | RC_TS) -#define RC_HT_SDT_40 (RC_HT_40 | RC_SS | RC_DS | RC_TS) - -#define RC_ALL (RC_LEGACY | RC_HT_2040 | RC_ALL_STREAM) - -enum { - WLAN_RC_PHY_OFDM, - WLAN_RC_PHY_CCK, - WLAN_RC_PHY_HT_20_SS, - WLAN_RC_PHY_HT_20_DS, - WLAN_RC_PHY_HT_20_TS, - WLAN_RC_PHY_HT_40_SS, - WLAN_RC_PHY_HT_40_DS, - WLAN_RC_PHY_HT_40_TS, - WLAN_RC_PHY_HT_20_SS_HGI, - WLAN_RC_PHY_HT_20_DS_HGI, - WLAN_RC_PHY_HT_20_TS_HGI, - WLAN_RC_PHY_HT_40_SS_HGI, - WLAN_RC_PHY_HT_40_DS_HGI, - WLAN_RC_PHY_HT_40_TS_HGI, - WLAN_RC_PHY_MAX -}; - -#define WLAN_RC_PHY_DS(_phy) ((_phy == WLAN_RC_PHY_HT_20_DS) \ - || (_phy == WLAN_RC_PHY_HT_40_DS) \ - || (_phy == WLAN_RC_PHY_HT_20_DS_HGI) \ - || (_phy == WLAN_RC_PHY_HT_40_DS_HGI)) -#define WLAN_RC_PHY_TS(_phy) ((_phy == WLAN_RC_PHY_HT_20_TS) \ - || (_phy == WLAN_RC_PHY_HT_40_TS) \ - || (_phy == WLAN_RC_PHY_HT_20_TS_HGI) \ - || (_phy == WLAN_RC_PHY_HT_40_TS_HGI)) -#define WLAN_RC_PHY_20(_phy) ((_phy == WLAN_RC_PHY_HT_20_SS) \ - || (_phy == WLAN_RC_PHY_HT_20_DS) \ - || (_phy == WLAN_RC_PHY_HT_20_TS) \ - || (_phy == WLAN_RC_PHY_HT_20_SS_HGI) \ - || (_phy == WLAN_RC_PHY_HT_20_DS_HGI) \ - || (_phy == WLAN_RC_PHY_HT_20_TS_HGI)) -#define WLAN_RC_PHY_40(_phy) ((_phy == WLAN_RC_PHY_HT_40_SS) \ - || (_phy == WLAN_RC_PHY_HT_40_DS) \ - || (_phy == WLAN_RC_PHY_HT_40_TS) \ - || (_phy == WLAN_RC_PHY_HT_40_SS_HGI) \ - || (_phy == WLAN_RC_PHY_HT_40_DS_HGI) \ - || (_phy == WLAN_RC_PHY_HT_40_TS_HGI)) -#define WLAN_RC_PHY_SGI(_phy) ((_phy == WLAN_RC_PHY_HT_20_SS_HGI) \ - || (_phy == WLAN_RC_PHY_HT_20_DS_HGI) \ - || (_phy == WLAN_RC_PHY_HT_20_TS_HGI) \ - || (_phy == WLAN_RC_PHY_HT_40_SS_HGI) \ - || (_phy == WLAN_RC_PHY_HT_40_DS_HGI) \ - || (_phy == WLAN_RC_PHY_HT_40_TS_HGI)) - -#define WLAN_RC_PHY_HT(_phy) (_phy >= WLAN_RC_PHY_HT_20_SS) - -#define WLAN_RC_CAP_MODE(capflag) (((capflag & WLAN_RC_HT_FLAG) ? \ - ((capflag & WLAN_RC_40_FLAG) ? RC_HT_40 : RC_HT_20) : RC_LEGACY)) - -#define WLAN_RC_CAP_STREAM(capflag) (((capflag & WLAN_RC_TS_FLAG) ? \ - (RC_TS) : ((capflag & WLAN_RC_DS_FLAG) ? RC_DS : RC_SS))) - -/* Return TRUE if flag supports HT20 && client supports HT20 or - * return TRUE if flag supports HT40 && client supports HT40. - * This is used becos some rates overlap between HT20/HT40. - */ -#define WLAN_RC_PHY_HT_VALID(flag, capflag) \ - (((flag & RC_HT_20) && !(capflag & WLAN_RC_40_FLAG)) || \ - ((flag & RC_HT_40) && (capflag & WLAN_RC_40_FLAG))) - -#define WLAN_RC_DS_FLAG (0x01) -#define WLAN_RC_TS_FLAG (0x02) -#define WLAN_RC_40_FLAG (0x04) -#define WLAN_RC_SGI_FLAG (0x08) -#define WLAN_RC_HT_FLAG (0x10) - -/** - * struct ath_rate_table - Rate Control table - * @rate_cnt: total number of rates for the given wireless mode - * @mcs_start: MCS rate index offset - * @rate_flags: Rate Control flags - * @phy: CCK/OFDM/HT20/HT40 - * @ratekbps: rate in Kbits per second - * @user_ratekbps: user rate in Kbits per second - * @ratecode: rate that goes into HW descriptors - * @dot11rate: value that goes into supported - * rates info element of MLME - * @ctrl_rate: Index of next lower basic rate, used for duration computation - * @cw40index: Index of rates having 40MHz channel width - * @sgi_index: Index of rates having Short Guard Interval - * @ht_index: high throughput rates having 40MHz channel width and - * Short Guard Interval - * @probe_interval: interval for rate control to probe for other rates - * @initial_ratemax: initial ratemax value - */ -struct ath_rate_table { - int rate_cnt; - int mcs_start; - struct { - u16 rate_flags; - u8 phy; - u32 ratekbps; - u32 user_ratekbps; - u8 ratecode; - u8 dot11rate; - } info[RATE_TABLE_SIZE]; - u32 probe_interval; - u8 initial_ratemax; -}; - -struct ath_rateset { - u8 rs_nrates; - u8 rs_rates[ATH_RATE_MAX]; -}; - -struct ath_rc_stats { - u32 success; - u32 retries; - u32 xretries; - u8 per; -}; - -/** - * struct ath_rate_priv - Rate Control priv data - * @state: RC state - * @probe_rate: rate we are probing at - * @probe_time: msec timestamp for last probe - * @hw_maxretry_pktcnt: num of packets since we got HW max retry error - * @max_valid_rate: maximum number of valid rate - * @per_down_time: msec timestamp for last PER down step - * @valid_phy_ratecnt: valid rate count - * @rate_max_phy: phy index for the max rate - * @per: PER for every valid rate in % - * @probe_interval: interval for ratectrl to probe for other rates - * @ht_cap: HT capabilities - * @neg_rates: Negotatied rates - * @neg_ht_rates: Negotiated HT rates - */ -struct ath_rate_priv { - u8 rate_table_size; - u8 probe_rate; - u8 hw_maxretry_pktcnt; - u8 max_valid_rate; - u8 valid_rate_index[RATE_TABLE_SIZE]; - u8 ht_cap; - u8 valid_phy_ratecnt[WLAN_RC_PHY_MAX]; - u8 valid_phy_rateidx[WLAN_RC_PHY_MAX][RATE_TABLE_SIZE]; - u8 rate_max_phy; - u8 per[RATE_TABLE_SIZE]; - u32 probe_time; - u32 per_down_time; - u32 probe_interval; - struct ath_rateset neg_rates; - struct ath_rateset neg_ht_rates; - const struct ath_rate_table *rate_table; - -#if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS) - struct dentry *debugfs_rcstats; - struct ath_rc_stats rcstats[RATE_TABLE_SIZE]; -#endif -}; - -#if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_ATH9K_DEBUGFS) -void ath_debug_stat_rc(struct ath_rate_priv *rc, int final_rate); -void ath_debug_stat_retries(struct ath_rate_priv *rc, int rix, - int xretries, int retries, u8 per); -#else -static inline void ath_debug_stat_rc(struct ath_rate_priv *rc, int final_rate) -{ -} -static inline void ath_debug_stat_retries(struct ath_rate_priv *rc, int rix, - int xretries, int retries, u8 per) -{ -} -#endif - -#ifdef CONFIG_ATH9K_LEGACY_RATE_CONTROL -int ath_rate_control_register(void); -void ath_rate_control_unregister(void); -#else -static inline int ath_rate_control_register(void) -{ - return 0; -} - -static inline void ath_rate_control_unregister(void) -{ -} -#endif - -#endif /* RC_H */ diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c deleted file mode 100644 index f53dbd1133ce..000000000000 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ /dev/null @@ -1,1401 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include "ath9k.h" -#include "ar9003_mac.h" - -#define SKB_CB_ATHBUF(__skb) (*((struct ath_buf **)__skb->cb)) - -static inline bool ath9k_check_auto_sleep(struct ath_softc *sc) -{ - return sc->ps_enabled && - (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP); -} - -/* - * Setup and link descriptors. - * - * 11N: we can no longer afford to self link the last descriptor. - * MAC acknowledges BA status as long as it copies frames to host - * buffer (or rx fifo). This can incorrectly acknowledge packets - * to a sender if last desc is self-linked. - */ -static void ath_rx_buf_link(struct ath_softc *sc, struct ath_buf *bf) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath_desc *ds; - struct sk_buff *skb; - - ds = bf->bf_desc; - ds->ds_link = 0; /* link to null */ - ds->ds_data = bf->bf_buf_addr; - - /* virtual addr of the beginning of the buffer. */ - skb = bf->bf_mpdu; - BUG_ON(skb == NULL); - ds->ds_vdata = skb->data; - - /* - * setup rx descriptors. The rx_bufsize here tells the hardware - * how much data it can DMA to us and that we are prepared - * to process - */ - ath9k_hw_setuprxdesc(ah, ds, - common->rx_bufsize, - 0); - - if (sc->rx.rxlink == NULL) - ath9k_hw_putrxbuf(ah, bf->bf_daddr); - else - *sc->rx.rxlink = bf->bf_daddr; - - sc->rx.rxlink = &ds->ds_link; -} - -static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_buf *bf) -{ - if (sc->rx.buf_hold) - ath_rx_buf_link(sc, sc->rx.buf_hold); - - sc->rx.buf_hold = bf; -} - -static void ath_setdefantenna(struct ath_softc *sc, u32 antenna) -{ - /* XXX block beacon interrupts */ - ath9k_hw_setantenna(sc->sc_ah, antenna); - sc->rx.defant = antenna; - sc->rx.rxotherant = 0; -} - -static void ath_opmode_init(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - - u32 rfilt, mfilt[2]; - - /* configure rx filter */ - rfilt = ath_calcrxfilter(sc); - ath9k_hw_setrxfilter(ah, rfilt); - - /* configure bssid mask */ - ath_hw_setbssidmask(common); - - /* configure operational mode */ - ath9k_hw_setopmode(ah); - - /* calculate and install multicast filter */ - mfilt[0] = mfilt[1] = ~0; - ath9k_hw_setmcastfilter(ah, mfilt[0], mfilt[1]); -} - -static bool ath_rx_edma_buf_link(struct ath_softc *sc, - enum ath9k_rx_qtype qtype) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_rx_edma *rx_edma; - struct sk_buff *skb; - struct ath_buf *bf; - - rx_edma = &sc->rx.rx_edma[qtype]; - if (skb_queue_len(&rx_edma->rx_fifo) >= rx_edma->rx_fifo_hwsize) - return false; - - bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list); - list_del_init(&bf->list); - - skb = bf->bf_mpdu; - - memset(skb->data, 0, ah->caps.rx_status_len); - dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, - ah->caps.rx_status_len, DMA_TO_DEVICE); - - SKB_CB_ATHBUF(skb) = bf; - ath9k_hw_addrxbuf_edma(ah, bf->bf_buf_addr, qtype); - __skb_queue_tail(&rx_edma->rx_fifo, skb); - - return true; -} - -static void ath_rx_addbuffer_edma(struct ath_softc *sc, - enum ath9k_rx_qtype qtype) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_buf *bf, *tbf; - - if (list_empty(&sc->rx.rxbuf)) { - ath_dbg(common, QUEUE, "No free rx buf available\n"); - return; - } - - list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) - if (!ath_rx_edma_buf_link(sc, qtype)) - break; - -} - -static void ath_rx_remove_buffer(struct ath_softc *sc, - enum ath9k_rx_qtype qtype) -{ - struct ath_buf *bf; - struct ath_rx_edma *rx_edma; - struct sk_buff *skb; - - rx_edma = &sc->rx.rx_edma[qtype]; - - while ((skb = __skb_dequeue(&rx_edma->rx_fifo)) != NULL) { - bf = SKB_CB_ATHBUF(skb); - BUG_ON(!bf); - list_add_tail(&bf->list, &sc->rx.rxbuf); - } -} - -static void ath_rx_edma_cleanup(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath_buf *bf; - - ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_LP); - ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_HP); - - list_for_each_entry(bf, &sc->rx.rxbuf, list) { - if (bf->bf_mpdu) { - dma_unmap_single(sc->dev, bf->bf_buf_addr, - common->rx_bufsize, - DMA_BIDIRECTIONAL); - dev_kfree_skb_any(bf->bf_mpdu); - bf->bf_buf_addr = 0; - bf->bf_mpdu = NULL; - } - } -} - -static void ath_rx_edma_init_queue(struct ath_rx_edma *rx_edma, int size) -{ - skb_queue_head_init(&rx_edma->rx_fifo); - rx_edma->rx_fifo_hwsize = size; -} - -static int ath_rx_edma_init(struct ath_softc *sc, int nbufs) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_hw *ah = sc->sc_ah; - struct sk_buff *skb; - struct ath_buf *bf; - int error = 0, i; - u32 size; - - ath9k_hw_set_rx_bufsize(ah, common->rx_bufsize - - ah->caps.rx_status_len); - - ath_rx_edma_init_queue(&sc->rx.rx_edma[ATH9K_RX_QUEUE_LP], - ah->caps.rx_lp_qdepth); - ath_rx_edma_init_queue(&sc->rx.rx_edma[ATH9K_RX_QUEUE_HP], - ah->caps.rx_hp_qdepth); - - size = sizeof(struct ath_buf) * nbufs; - bf = devm_kzalloc(sc->dev, size, GFP_KERNEL); - if (!bf) - return -ENOMEM; - - INIT_LIST_HEAD(&sc->rx.rxbuf); - - for (i = 0; i < nbufs; i++, bf++) { - skb = ath_rxbuf_alloc(common, common->rx_bufsize, GFP_KERNEL); - if (!skb) { - error = -ENOMEM; - goto rx_init_fail; - } - - memset(skb->data, 0, common->rx_bufsize); - bf->bf_mpdu = skb; - - bf->bf_buf_addr = dma_map_single(sc->dev, skb->data, - common->rx_bufsize, - DMA_BIDIRECTIONAL); - if (unlikely(dma_mapping_error(sc->dev, - bf->bf_buf_addr))) { - dev_kfree_skb_any(skb); - bf->bf_mpdu = NULL; - bf->bf_buf_addr = 0; - ath_err(common, - "dma_mapping_error() on RX init\n"); - error = -ENOMEM; - goto rx_init_fail; - } - - list_add_tail(&bf->list, &sc->rx.rxbuf); - } - - return 0; - -rx_init_fail: - ath_rx_edma_cleanup(sc); - return error; -} - -static void ath_edma_start_recv(struct ath_softc *sc) -{ - ath9k_hw_rxena(sc->sc_ah); - ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_HP); - ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_LP); - ath_opmode_init(sc); - ath9k_hw_startpcureceive(sc->sc_ah, !!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)); -} - -static void ath_edma_stop_recv(struct ath_softc *sc) -{ - ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_HP); - ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_LP); -} - -int ath_rx_init(struct ath_softc *sc, int nbufs) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct sk_buff *skb; - struct ath_buf *bf; - int error = 0; - - spin_lock_init(&sc->sc_pcu_lock); - - common->rx_bufsize = IEEE80211_MAX_MPDU_LEN / 2 + - sc->sc_ah->caps.rx_status_len; - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) - return ath_rx_edma_init(sc, nbufs); - - ath_dbg(common, CONFIG, "cachelsz %u rxbufsize %u\n", - common->cachelsz, common->rx_bufsize); - - /* Initialize rx descriptors */ - - error = ath_descdma_setup(sc, &sc->rx.rxdma, &sc->rx.rxbuf, - "rx", nbufs, 1, 0); - if (error != 0) { - ath_err(common, - "failed to allocate rx descriptors: %d\n", - error); - goto err; - } - - list_for_each_entry(bf, &sc->rx.rxbuf, list) { - skb = ath_rxbuf_alloc(common, common->rx_bufsize, - GFP_KERNEL); - if (skb == NULL) { - error = -ENOMEM; - goto err; - } - - bf->bf_mpdu = skb; - bf->bf_buf_addr = dma_map_single(sc->dev, skb->data, - common->rx_bufsize, - DMA_FROM_DEVICE); - if (unlikely(dma_mapping_error(sc->dev, - bf->bf_buf_addr))) { - dev_kfree_skb_any(skb); - bf->bf_mpdu = NULL; - bf->bf_buf_addr = 0; - ath_err(common, - "dma_mapping_error() on RX init\n"); - error = -ENOMEM; - goto err; - } - } - sc->rx.rxlink = NULL; -err: - if (error) - ath_rx_cleanup(sc); - - return error; -} - -void ath_rx_cleanup(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct sk_buff *skb; - struct ath_buf *bf; - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { - ath_rx_edma_cleanup(sc); - return; - } - - list_for_each_entry(bf, &sc->rx.rxbuf, list) { - skb = bf->bf_mpdu; - if (skb) { - dma_unmap_single(sc->dev, bf->bf_buf_addr, - common->rx_bufsize, - DMA_FROM_DEVICE); - dev_kfree_skb(skb); - bf->bf_buf_addr = 0; - bf->bf_mpdu = NULL; - } - } -} - -/* - * Calculate the receive filter according to the - * operating mode and state: - * - * o always accept unicast, broadcast, and multicast traffic - * o maintain current state of phy error reception (the hal - * may enable phy error frames for noise immunity work) - * o probe request frames are accepted only when operating in - * hostap, adhoc, or monitor modes - * o enable promiscuous mode according to the interface state - * o accept beacons: - * - when operating in adhoc mode so the 802.11 layer creates - * node table entries for peers, - * - when operating in station mode for collecting rssi data when - * the station is otherwise quiet, or - * - when operating as a repeater so we see repeater-sta beacons - * - when scanning - */ - -u32 ath_calcrxfilter(struct ath_softc *sc) -{ - u32 rfilt; - - rfilt = ATH9K_RX_FILTER_UCAST | ATH9K_RX_FILTER_BCAST - | ATH9K_RX_FILTER_MCAST; - - /* if operating on a DFS channel, enable radar pulse detection */ - if (sc->hw->conf.radar_enabled) - rfilt |= ATH9K_RX_FILTER_PHYRADAR | ATH9K_RX_FILTER_PHYERR; - - if (sc->rx.rxfilter & FIF_PROBE_REQ) - rfilt |= ATH9K_RX_FILTER_PROBEREQ; - - /* - * Set promiscuous mode when FIF_PROMISC_IN_BSS is enabled for station - * mode interface or when in monitor mode. AP mode does not need this - * since it receives all in-BSS frames anyway. - */ - if (sc->sc_ah->is_monitoring) - rfilt |= ATH9K_RX_FILTER_PROM; - - if (sc->rx.rxfilter & FIF_CONTROL) - rfilt |= ATH9K_RX_FILTER_CONTROL; - - if ((sc->sc_ah->opmode == NL80211_IFTYPE_STATION) && - (sc->nvifs <= 1) && - !(sc->rx.rxfilter & FIF_BCN_PRBRESP_PROMISC)) - rfilt |= ATH9K_RX_FILTER_MYBEACON; - else - rfilt |= ATH9K_RX_FILTER_BEACON; - - if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || - (sc->rx.rxfilter & FIF_PSPOLL)) - rfilt |= ATH9K_RX_FILTER_PSPOLL; - - if (conf_is_ht(&sc->hw->conf)) - rfilt |= ATH9K_RX_FILTER_COMP_BAR; - - if (sc->nvifs > 1 || (sc->rx.rxfilter & FIF_OTHER_BSS)) { - /* This is needed for older chips */ - if (sc->sc_ah->hw_version.macVersion <= AR_SREV_VERSION_9160) - rfilt |= ATH9K_RX_FILTER_PROM; - rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL; - } - - if (AR_SREV_9550(sc->sc_ah)) - rfilt |= ATH9K_RX_FILTER_4ADDRESS; - - return rfilt; - -} - -int ath_startrecv(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_buf *bf, *tbf; - - if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { - ath_edma_start_recv(sc); - return 0; - } - - if (list_empty(&sc->rx.rxbuf)) - goto start_recv; - - sc->rx.buf_hold = NULL; - sc->rx.rxlink = NULL; - list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) { - ath_rx_buf_link(sc, bf); - } - - /* We could have deleted elements so the list may be empty now */ - if (list_empty(&sc->rx.rxbuf)) - goto start_recv; - - bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list); - ath9k_hw_putrxbuf(ah, bf->bf_daddr); - ath9k_hw_rxena(ah); - -start_recv: - ath_opmode_init(sc); - ath9k_hw_startpcureceive(ah, !!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)); - - return 0; -} - -static void ath_flushrecv(struct ath_softc *sc) -{ - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) - ath_rx_tasklet(sc, 1, true); - ath_rx_tasklet(sc, 1, false); -} - -bool ath_stoprecv(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - bool stopped, reset = false; - - ath9k_hw_abortpcurecv(ah); - ath9k_hw_setrxfilter(ah, 0); - stopped = ath9k_hw_stopdmarecv(ah, &reset); - - ath_flushrecv(sc); - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) - ath_edma_stop_recv(sc); - else - sc->rx.rxlink = NULL; - - if (!(ah->ah_flags & AH_UNPLUGGED) && - unlikely(!stopped)) { - ath_err(ath9k_hw_common(sc->sc_ah), - "Could not stop RX, we could be " - "confusing the DMA engine when we start RX up\n"); - ATH_DBG_WARN_ON_ONCE(!stopped); - } - return stopped && !reset; -} - -static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb) -{ - /* Check whether the Beacon frame has DTIM indicating buffered bc/mc */ - struct ieee80211_mgmt *mgmt; - u8 *pos, *end, id, elen; - struct ieee80211_tim_ie *tim; - - mgmt = (struct ieee80211_mgmt *)skb->data; - pos = mgmt->u.beacon.variable; - end = skb->data + skb->len; - - while (pos + 2 < end) { - id = *pos++; - elen = *pos++; - if (pos + elen > end) - break; - - if (id == WLAN_EID_TIM) { - if (elen < sizeof(*tim)) - break; - tim = (struct ieee80211_tim_ie *) pos; - if (tim->dtim_count != 0) - break; - return tim->bitmap_ctrl & 0x01; - } - - pos += elen; - } - - return false; -} - -static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - - if (skb->len < 24 + 8 + 2 + 2) - return; - - sc->ps_flags &= ~PS_WAIT_FOR_BEACON; - - if (sc->ps_flags & PS_BEACON_SYNC) { - sc->ps_flags &= ~PS_BEACON_SYNC; - ath_dbg(common, PS, - "Reconfigure beacon timers based on synchronized timestamp\n"); - ath9k_set_beacon(sc); - } - - if (ath_beacon_dtim_pending_cab(skb)) { - /* - * Remain awake waiting for buffered broadcast/multicast - * frames. If the last broadcast/multicast frame is not - * received properly, the next beacon frame will work as - * a backup trigger for returning into NETWORK SLEEP state, - * so we are waiting for it as well. - */ - ath_dbg(common, PS, - "Received DTIM beacon indicating buffered broadcast/multicast frame(s)\n"); - sc->ps_flags |= PS_WAIT_FOR_CAB | PS_WAIT_FOR_BEACON; - return; - } - - if (sc->ps_flags & PS_WAIT_FOR_CAB) { - /* - * This can happen if a broadcast frame is dropped or the AP - * fails to send a frame indicating that all CAB frames have - * been delivered. - */ - sc->ps_flags &= ~PS_WAIT_FOR_CAB; - ath_dbg(common, PS, "PS wait for CAB frames timed out\n"); - } -} - -static void ath_rx_ps(struct ath_softc *sc, struct sk_buff *skb, bool mybeacon) -{ - struct ieee80211_hdr *hdr; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - - hdr = (struct ieee80211_hdr *)skb->data; - - /* Process Beacon and CAB receive in PS state */ - if (((sc->ps_flags & PS_WAIT_FOR_BEACON) || ath9k_check_auto_sleep(sc)) - && mybeacon) { - ath_rx_ps_beacon(sc, skb); - } else if ((sc->ps_flags & PS_WAIT_FOR_CAB) && - (ieee80211_is_data(hdr->frame_control) || - ieee80211_is_action(hdr->frame_control)) && - is_multicast_ether_addr(hdr->addr1) && - !ieee80211_has_moredata(hdr->frame_control)) { - /* - * No more broadcast/multicast frames to be received at this - * point. - */ - sc->ps_flags &= ~(PS_WAIT_FOR_CAB | PS_WAIT_FOR_BEACON); - ath_dbg(common, PS, - "All PS CAB frames received, back to sleep\n"); - } else if ((sc->ps_flags & PS_WAIT_FOR_PSPOLL_DATA) && - !is_multicast_ether_addr(hdr->addr1) && - !ieee80211_has_morefrags(hdr->frame_control)) { - sc->ps_flags &= ~PS_WAIT_FOR_PSPOLL_DATA; - ath_dbg(common, PS, - "Going back to sleep after having received PS-Poll data (0x%lx)\n", - sc->ps_flags & (PS_WAIT_FOR_BEACON | - PS_WAIT_FOR_CAB | - PS_WAIT_FOR_PSPOLL_DATA | - PS_WAIT_FOR_TX_ACK)); - } -} - -static bool ath_edma_get_buffers(struct ath_softc *sc, - enum ath9k_rx_qtype qtype, - struct ath_rx_status *rs, - struct ath_buf **dest) -{ - struct ath_rx_edma *rx_edma = &sc->rx.rx_edma[qtype]; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct sk_buff *skb; - struct ath_buf *bf; - int ret; - - skb = skb_peek(&rx_edma->rx_fifo); - if (!skb) - return false; - - bf = SKB_CB_ATHBUF(skb); - BUG_ON(!bf); - - dma_sync_single_for_cpu(sc->dev, bf->bf_buf_addr, - common->rx_bufsize, DMA_FROM_DEVICE); - - ret = ath9k_hw_process_rxdesc_edma(ah, rs, skb->data); - if (ret == -EINPROGRESS) { - /*let device gain the buffer again*/ - dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, - common->rx_bufsize, DMA_FROM_DEVICE); - return false; - } - - __skb_unlink(skb, &rx_edma->rx_fifo); - if (ret == -EINVAL) { - /* corrupt descriptor, skip this one and the following one */ - list_add_tail(&bf->list, &sc->rx.rxbuf); - ath_rx_edma_buf_link(sc, qtype); - - skb = skb_peek(&rx_edma->rx_fifo); - if (skb) { - bf = SKB_CB_ATHBUF(skb); - BUG_ON(!bf); - - __skb_unlink(skb, &rx_edma->rx_fifo); - list_add_tail(&bf->list, &sc->rx.rxbuf); - ath_rx_edma_buf_link(sc, qtype); - } - - bf = NULL; - } - - *dest = bf; - return true; -} - -static struct ath_buf *ath_edma_get_next_rx_buf(struct ath_softc *sc, - struct ath_rx_status *rs, - enum ath9k_rx_qtype qtype) -{ - struct ath_buf *bf = NULL; - - while (ath_edma_get_buffers(sc, qtype, rs, &bf)) { - if (!bf) - continue; - - return bf; - } - return NULL; -} - -static struct ath_buf *ath_get_next_rx_buf(struct ath_softc *sc, - struct ath_rx_status *rs) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath_desc *ds; - struct ath_buf *bf; - int ret; - - if (list_empty(&sc->rx.rxbuf)) { - sc->rx.rxlink = NULL; - return NULL; - } - - bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list); - if (bf == sc->rx.buf_hold) - return NULL; - - ds = bf->bf_desc; - - /* - * Must provide the virtual address of the current - * descriptor, the physical address, and the virtual - * address of the next descriptor in the h/w chain. - * This allows the HAL to look ahead to see if the - * hardware is done with a descriptor by checking the - * done bit in the following descriptor and the address - * of the current descriptor the DMA engine is working - * on. All this is necessary because of our use of - * a self-linked list to avoid rx overruns. - */ - ret = ath9k_hw_rxprocdesc(ah, ds, rs); - if (ret == -EINPROGRESS) { - struct ath_rx_status trs; - struct ath_buf *tbf; - struct ath_desc *tds; - - memset(&trs, 0, sizeof(trs)); - if (list_is_last(&bf->list, &sc->rx.rxbuf)) { - sc->rx.rxlink = NULL; - return NULL; - } - - tbf = list_entry(bf->list.next, struct ath_buf, list); - - /* - * On some hardware the descriptor status words could - * get corrupted, including the done bit. Because of - * this, check if the next descriptor's done bit is - * set or not. - * - * If the next descriptor's done bit is set, the current - * descriptor has been corrupted. Force s/w to discard - * this descriptor and continue... - */ - - tds = tbf->bf_desc; - ret = ath9k_hw_rxprocdesc(ah, tds, &trs); - if (ret == -EINPROGRESS) - return NULL; - - /* - * mark descriptor as zero-length and set the 'more' - * flag to ensure that both buffers get discarded - */ - rs->rs_datalen = 0; - rs->rs_more = true; - } - - list_del(&bf->list); - if (!bf->bf_mpdu) - return bf; - - /* - * Synchronize the DMA transfer with CPU before - * 1. accessing the frame - * 2. requeueing the same buffer to h/w - */ - dma_sync_single_for_cpu(sc->dev, bf->bf_buf_addr, - common->rx_bufsize, - DMA_FROM_DEVICE); - - return bf; -} - -/* Assumes you've already done the endian to CPU conversion */ -static bool ath9k_rx_accept(struct ath_common *common, - struct ieee80211_hdr *hdr, - struct ieee80211_rx_status *rxs, - struct ath_rx_status *rx_stats, - bool *decrypt_error) -{ - struct ath_softc *sc = (struct ath_softc *) common->priv; - bool is_mc, is_valid_tkip, strip_mic, mic_error; - struct ath_hw *ah = common->ah; - __le16 fc; - u8 rx_status_len = ah->caps.rx_status_len; - - fc = hdr->frame_control; - - is_mc = !!is_multicast_ether_addr(hdr->addr1); - is_valid_tkip = rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID && - test_bit(rx_stats->rs_keyix, common->tkip_keymap); - strip_mic = is_valid_tkip && ieee80211_is_data(fc) && - ieee80211_has_protected(fc) && - !(rx_stats->rs_status & - (ATH9K_RXERR_DECRYPT | ATH9K_RXERR_CRC | ATH9K_RXERR_MIC | - ATH9K_RXERR_KEYMISS)); - - /* - * Key miss events are only relevant for pairwise keys where the - * descriptor does contain a valid key index. This has been observed - * mostly with CCMP encryption. - */ - if (rx_stats->rs_keyix == ATH9K_RXKEYIX_INVALID || - !test_bit(rx_stats->rs_keyix, common->ccmp_keymap)) - rx_stats->rs_status &= ~ATH9K_RXERR_KEYMISS; - - if (!rx_stats->rs_datalen) { - RX_STAT_INC(rx_len_err); - return false; - } - - /* - * rs_status follows rs_datalen so if rs_datalen is too large - * we can take a hint that hardware corrupted it, so ignore - * those frames. - */ - if (rx_stats->rs_datalen > (common->rx_bufsize - rx_status_len)) { - RX_STAT_INC(rx_len_err); - return false; - } - - /* Only use error bits from the last fragment */ - if (rx_stats->rs_more) - return true; - - mic_error = is_valid_tkip && !ieee80211_is_ctl(fc) && - !ieee80211_has_morefrags(fc) && - !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) && - (rx_stats->rs_status & ATH9K_RXERR_MIC); - - /* - * The rx_stats->rs_status will not be set until the end of the - * chained descriptors so it can be ignored if rs_more is set. The - * rs_more will be false at the last element of the chained - * descriptors. - */ - if (rx_stats->rs_status != 0) { - u8 status_mask; - - if (rx_stats->rs_status & ATH9K_RXERR_CRC) { - rxs->flag |= RX_FLAG_FAILED_FCS_CRC; - mic_error = false; - } - if (rx_stats->rs_status & ATH9K_RXERR_PHY) - return false; - - if ((rx_stats->rs_status & ATH9K_RXERR_DECRYPT) || - (!is_mc && (rx_stats->rs_status & ATH9K_RXERR_KEYMISS))) { - *decrypt_error = true; - mic_error = false; - } - - /* - * Reject error frames with the exception of - * decryption and MIC failures. For monitor mode, - * we also ignore the CRC error. - */ - status_mask = ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC | - ATH9K_RXERR_KEYMISS; - - if (ah->is_monitoring && (sc->rx.rxfilter & FIF_FCSFAIL)) - status_mask |= ATH9K_RXERR_CRC; - - if (rx_stats->rs_status & ~status_mask) - return false; - } - - /* - * For unicast frames the MIC error bit can have false positives, - * so all MIC error reports need to be validated in software. - * False negatives are not common, so skip software verification - * if the hardware considers the MIC valid. - */ - if (strip_mic) - rxs->flag |= RX_FLAG_MMIC_STRIPPED; - else if (is_mc && mic_error) - rxs->flag |= RX_FLAG_MMIC_ERROR; - - return true; -} - -static int ath9k_process_rate(struct ath_common *common, - struct ieee80211_hw *hw, - struct ath_rx_status *rx_stats, - struct ieee80211_rx_status *rxs) -{ - struct ieee80211_supported_band *sband; - enum ieee80211_band band; - unsigned int i = 0; - struct ath_softc __maybe_unused *sc = common->priv; - - band = hw->conf.chandef.chan->band; - sband = hw->wiphy->bands[band]; - - if (rx_stats->rs_rate & 0x80) { - /* HT rate */ - rxs->flag |= RX_FLAG_HT; - if (rx_stats->rs_flags & ATH9K_RX_2040) - rxs->flag |= RX_FLAG_40MHZ; - if (rx_stats->rs_flags & ATH9K_RX_GI) - rxs->flag |= RX_FLAG_SHORT_GI; - rxs->rate_idx = rx_stats->rs_rate & 0x7f; - return 0; - } - - for (i = 0; i < sband->n_bitrates; i++) { - if (sband->bitrates[i].hw_value == rx_stats->rs_rate) { - rxs->rate_idx = i; - return 0; - } - if (sband->bitrates[i].hw_value_short == rx_stats->rs_rate) { - rxs->flag |= RX_FLAG_SHORTPRE; - rxs->rate_idx = i; - return 0; - } - } - - /* - * No valid hardware bitrate found -- we should not get here - * because hardware has already validated this frame as OK. - */ - ath_dbg(common, ANY, - "unsupported hw bitrate detected 0x%02x using 1 Mbit\n", - rx_stats->rs_rate); - RX_STAT_INC(rx_rate_err); - return -EINVAL; -} - -static void ath9k_process_rssi(struct ath_common *common, - struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, - struct ath_rx_status *rx_stats) -{ - struct ath_softc *sc = hw->priv; - struct ath_hw *ah = common->ah; - int last_rssi; - int rssi = rx_stats->rs_rssi; - - if (!rx_stats->is_mybeacon || - ((ah->opmode != NL80211_IFTYPE_STATION) && - (ah->opmode != NL80211_IFTYPE_ADHOC))) - return; - - if (rx_stats->rs_rssi != ATH9K_RSSI_BAD && !rx_stats->rs_moreaggr) - ATH_RSSI_LPF(sc->last_rssi, rx_stats->rs_rssi); - - last_rssi = sc->last_rssi; - if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) - rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER); - if (rssi < 0) - rssi = 0; - - /* Update Beacon RSSI, this is used by ANI. */ - ah->stats.avgbrssi = rssi; -} - -/* - * For Decrypt or Demic errors, we only mark packet status here and always push - * up the frame up to let mac80211 handle the actual error case, be it no - * decryption key or real decryption error. This let us keep statistics there. - */ -static int ath9k_rx_skb_preprocess(struct ath_softc *sc, - struct ieee80211_hdr *hdr, - struct ath_rx_status *rx_stats, - struct ieee80211_rx_status *rx_status, - bool *decrypt_error) -{ - struct ieee80211_hw *hw = sc->hw; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - bool discard_current = sc->rx.discard_next; - - sc->rx.discard_next = rx_stats->rs_more; - if (discard_current) - return -EINVAL; - - /* - * everything but the rate is checked here, the rate check is done - * separately to avoid doing two lookups for a rate for each frame. - */ - if (!ath9k_rx_accept(common, hdr, rx_status, rx_stats, decrypt_error)) - return -EINVAL; - - /* Only use status info from the last fragment */ - if (rx_stats->rs_more) - return 0; - - ath9k_process_rssi(common, hw, hdr, rx_stats); - - if (ath9k_process_rate(common, hw, rx_stats, rx_status)) - return -EINVAL; - - rx_status->band = hw->conf.chandef.chan->band; - rx_status->freq = hw->conf.chandef.chan->center_freq; - rx_status->signal = ah->noise + rx_stats->rs_rssi; - rx_status->antenna = rx_stats->rs_antenna; - rx_status->flag |= RX_FLAG_MACTIME_END; - if (rx_stats->rs_moreaggr) - rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL; - - sc->rx.discard_next = false; - return 0; -} - -static void ath9k_rx_skb_postprocess(struct ath_common *common, - struct sk_buff *skb, - struct ath_rx_status *rx_stats, - struct ieee80211_rx_status *rxs, - bool decrypt_error) -{ - struct ath_hw *ah = common->ah; - struct ieee80211_hdr *hdr; - int hdrlen, padpos, padsize; - u8 keyix; - __le16 fc; - - /* see if any padding is done by the hw and remove it */ - hdr = (struct ieee80211_hdr *) skb->data; - hdrlen = ieee80211_get_hdrlen_from_skb(skb); - fc = hdr->frame_control; - padpos = ieee80211_hdrlen(fc); - - /* The MAC header is padded to have 32-bit boundary if the - * packet payload is non-zero. The general calculation for - * padsize would take into account odd header lengths: - * padsize = (4 - padpos % 4) % 4; However, since only - * even-length headers are used, padding can only be 0 or 2 - * bytes and we can optimize this a bit. In addition, we must - * not try to remove padding from short control frames that do - * not have payload. */ - padsize = padpos & 3; - if (padsize && skb->len>=padpos+padsize+FCS_LEN) { - memmove(skb->data + padsize, skb->data, padpos); - skb_pull(skb, padsize); - } - - keyix = rx_stats->rs_keyix; - - if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error && - ieee80211_has_protected(fc)) { - rxs->flag |= RX_FLAG_DECRYPTED; - } else if (ieee80211_has_protected(fc) - && !decrypt_error && skb->len >= hdrlen + 4) { - keyix = skb->data[hdrlen + 3] >> 6; - - if (test_bit(keyix, common->keymap)) - rxs->flag |= RX_FLAG_DECRYPTED; - } - if (ah->sw_mgmt_crypto && - (rxs->flag & RX_FLAG_DECRYPTED) && - ieee80211_is_mgmt(fc)) - /* Use software decrypt for management frames. */ - rxs->flag &= ~RX_FLAG_DECRYPTED; -} - -#ifdef CONFIG_ATH9K_DEBUGFS -static s8 fix_rssi_inv_only(u8 rssi_val) -{ - if (rssi_val == 128) - rssi_val = 0; - return (s8) rssi_val; -} -#endif - -/* returns 1 if this was a spectral frame, even if not handled. */ -static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr, - struct ath_rx_status *rs, u64 tsf) -{ -#ifdef CONFIG_ATH9K_DEBUGFS - struct ath_hw *ah = sc->sc_ah; - u8 bins[SPECTRAL_HT20_NUM_BINS]; - u8 *vdata = (u8 *)hdr; - struct fft_sample_ht20 fft_sample; - struct ath_radar_info *radar_info; - struct ath_ht20_mag_info *mag_info; - int len = rs->rs_datalen; - int dc_pos; - u16 length, max_magnitude; - - /* AR9280 and before report via ATH9K_PHYERR_RADAR, AR93xx and newer - * via ATH9K_PHYERR_SPECTRAL. Haven't seen ATH9K_PHYERR_FALSE_RADAR_EXT - * yet, but this is supposed to be possible as well. - */ - if (rs->rs_phyerr != ATH9K_PHYERR_RADAR && - rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT && - rs->rs_phyerr != ATH9K_PHYERR_SPECTRAL) - return 0; - - /* check if spectral scan bit is set. This does not have to be checked - * if received through a SPECTRAL phy error, but shouldn't hurt. - */ - radar_info = ((struct ath_radar_info *)&vdata[len]) - 1; - if (!(radar_info->pulse_bw_info & SPECTRAL_SCAN_BITMASK)) - return 0; - - /* Variation in the data length is possible and will be fixed later. - * Note that we only support HT20 for now. - * - * TODO: add HT20_40 support as well. - */ - if ((len > SPECTRAL_HT20_TOTAL_DATA_LEN + 2) || - (len < SPECTRAL_HT20_TOTAL_DATA_LEN - 1)) - return 1; - - fft_sample.tlv.type = ATH_FFT_SAMPLE_HT20; - length = sizeof(fft_sample) - sizeof(fft_sample.tlv); - fft_sample.tlv.length = __cpu_to_be16(length); - - fft_sample.freq = __cpu_to_be16(ah->curchan->chan->center_freq); - fft_sample.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0); - fft_sample.noise = ah->noise; - - switch (len - SPECTRAL_HT20_TOTAL_DATA_LEN) { - case 0: - /* length correct, nothing to do. */ - memcpy(bins, vdata, SPECTRAL_HT20_NUM_BINS); - break; - case -1: - /* first byte missing, duplicate it. */ - memcpy(&bins[1], vdata, SPECTRAL_HT20_NUM_BINS - 1); - bins[0] = vdata[0]; - break; - case 2: - /* MAC added 2 extra bytes at bin 30 and 32, remove them. */ - memcpy(bins, vdata, 30); - bins[30] = vdata[31]; - memcpy(&bins[31], &vdata[33], SPECTRAL_HT20_NUM_BINS - 31); - break; - case 1: - /* MAC added 2 extra bytes AND first byte is missing. */ - bins[0] = vdata[0]; - memcpy(&bins[0], vdata, 30); - bins[31] = vdata[31]; - memcpy(&bins[32], &vdata[33], SPECTRAL_HT20_NUM_BINS - 32); - break; - default: - return 1; - } - - /* DC value (value in the middle) is the blind spot of the spectral - * sample and invalid, interpolate it. - */ - dc_pos = SPECTRAL_HT20_NUM_BINS / 2; - bins[dc_pos] = (bins[dc_pos + 1] + bins[dc_pos - 1]) / 2; - - /* mag data is at the end of the frame, in front of radar_info */ - mag_info = ((struct ath_ht20_mag_info *)radar_info) - 1; - - /* copy raw bins without scaling them */ - memcpy(fft_sample.data, bins, SPECTRAL_HT20_NUM_BINS); - fft_sample.max_exp = mag_info->max_exp & 0xf; - - max_magnitude = spectral_max_magnitude(mag_info->all_bins); - fft_sample.max_magnitude = __cpu_to_be16(max_magnitude); - fft_sample.max_index = spectral_max_index(mag_info->all_bins); - fft_sample.bitmap_weight = spectral_bitmap_weight(mag_info->all_bins); - fft_sample.tsf = __cpu_to_be64(tsf); - - ath_debug_send_fft_sample(sc, &fft_sample.tlv); - return 1; -#else - return 0; -#endif -} - -static void ath9k_apply_ampdu_details(struct ath_softc *sc, - struct ath_rx_status *rs, struct ieee80211_rx_status *rxs) -{ - if (rs->rs_isaggr) { - rxs->flag |= RX_FLAG_AMPDU_DETAILS | RX_FLAG_AMPDU_LAST_KNOWN; - - rxs->ampdu_reference = sc->rx.ampdu_ref; - - if (!rs->rs_moreaggr) { - rxs->flag |= RX_FLAG_AMPDU_IS_LAST; - sc->rx.ampdu_ref++; - } - - if (rs->rs_flags & ATH9K_RX_DELIM_CRC_PRE) - rxs->flag |= RX_FLAG_AMPDU_DELIM_CRC_ERROR; - } -} - -int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) -{ - struct ath_buf *bf; - struct sk_buff *skb = NULL, *requeue_skb, *hdr_skb; - struct ieee80211_rx_status *rxs; - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ieee80211_hw *hw = sc->hw; - struct ieee80211_hdr *hdr; - int retval; - struct ath_rx_status rs; - enum ath9k_rx_qtype qtype; - bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA); - int dma_type; - u8 rx_status_len = ah->caps.rx_status_len; - u64 tsf = 0; - u32 tsf_lower = 0; - unsigned long flags; - dma_addr_t new_buf_addr; - - if (edma) - dma_type = DMA_BIDIRECTIONAL; - else - dma_type = DMA_FROM_DEVICE; - - qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP; - - tsf = ath9k_hw_gettsf64(ah); - tsf_lower = tsf & 0xffffffff; - - do { - bool decrypt_error = false; - - memset(&rs, 0, sizeof(rs)); - if (edma) - bf = ath_edma_get_next_rx_buf(sc, &rs, qtype); - else - bf = ath_get_next_rx_buf(sc, &rs); - - if (!bf) - break; - - skb = bf->bf_mpdu; - if (!skb) - continue; - - /* - * Take frame header from the first fragment and RX status from - * the last one. - */ - if (sc->rx.frag) - hdr_skb = sc->rx.frag; - else - hdr_skb = skb; - - hdr = (struct ieee80211_hdr *) (hdr_skb->data + rx_status_len); - rxs = IEEE80211_SKB_RXCB(hdr_skb); - if (ieee80211_is_beacon(hdr->frame_control)) { - RX_STAT_INC(rx_beacons); - if (!is_zero_ether_addr(common->curbssid) && - ether_addr_equal(hdr->addr3, common->curbssid)) - rs.is_mybeacon = true; - else - rs.is_mybeacon = false; - } - else - rs.is_mybeacon = false; - - if (ieee80211_is_data_present(hdr->frame_control) && - !ieee80211_is_qos_nullfunc(hdr->frame_control)) - sc->rx.num_pkts++; - - ath_debug_stat_rx(sc, &rs); - - memset(rxs, 0, sizeof(struct ieee80211_rx_status)); - - rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp; - if (rs.rs_tstamp > tsf_lower && - unlikely(rs.rs_tstamp - tsf_lower > 0x10000000)) - rxs->mactime -= 0x100000000ULL; - - if (rs.rs_tstamp < tsf_lower && - unlikely(tsf_lower - rs.rs_tstamp > 0x10000000)) - rxs->mactime += 0x100000000ULL; - - if (rs.rs_phyerr == ATH9K_PHYERR_RADAR) - ath9k_dfs_process_phyerr(sc, hdr, &rs, rxs->mactime); - - if (rs.rs_status & ATH9K_RXERR_PHY) { - if (ath_process_fft(sc, hdr, &rs, rxs->mactime)) { - RX_STAT_INC(rx_spectral); - goto requeue_drop_frag; - } - } - - retval = ath9k_rx_skb_preprocess(sc, hdr, &rs, rxs, - &decrypt_error); - if (retval) - goto requeue_drop_frag; - - if (rs.is_mybeacon) { - sc->hw_busy_count = 0; - ath_start_rx_poll(sc, 3); - } - /* Ensure we always have an skb to requeue once we are done - * processing the current buffer's skb */ - requeue_skb = ath_rxbuf_alloc(common, common->rx_bufsize, GFP_ATOMIC); - - /* If there is no memory we ignore the current RX'd frame, - * tell hardware it can give us a new frame using the old - * skb and put it at the tail of the sc->rx.rxbuf list for - * processing. */ - if (!requeue_skb) { - RX_STAT_INC(rx_oom_err); - goto requeue_drop_frag; - } - - /* We will now give hardware our shiny new allocated skb */ - new_buf_addr = dma_map_single(sc->dev, requeue_skb->data, - common->rx_bufsize, dma_type); - if (unlikely(dma_mapping_error(sc->dev, new_buf_addr))) { - dev_kfree_skb_any(requeue_skb); - goto requeue_drop_frag; - } - - /* Unmap the frame */ - dma_unmap_single(sc->dev, bf->bf_buf_addr, - common->rx_bufsize, dma_type); - - bf->bf_mpdu = requeue_skb; - bf->bf_buf_addr = new_buf_addr; - - skb_put(skb, rs.rs_datalen + ah->caps.rx_status_len); - if (ah->caps.rx_status_len) - skb_pull(skb, ah->caps.rx_status_len); - - if (!rs.rs_more) - ath9k_rx_skb_postprocess(common, hdr_skb, &rs, - rxs, decrypt_error); - - if (rs.rs_more) { - RX_STAT_INC(rx_frags); - /* - * rs_more indicates chained descriptors which can be - * used to link buffers together for a sort of - * scatter-gather operation. - */ - if (sc->rx.frag) { - /* too many fragments - cannot handle frame */ - dev_kfree_skb_any(sc->rx.frag); - dev_kfree_skb_any(skb); - RX_STAT_INC(rx_too_many_frags_err); - skb = NULL; - } - sc->rx.frag = skb; - goto requeue; - } - if (rs.rs_status & ATH9K_RXERR_CORRUPT_DESC) - goto requeue_drop_frag; - - if (sc->rx.frag) { - int space = skb->len - skb_tailroom(hdr_skb); - - if (pskb_expand_head(hdr_skb, 0, space, GFP_ATOMIC) < 0) { - dev_kfree_skb(skb); - RX_STAT_INC(rx_oom_err); - goto requeue_drop_frag; - } - - sc->rx.frag = NULL; - - skb_copy_from_linear_data(skb, skb_put(hdr_skb, skb->len), - skb->len); - dev_kfree_skb_any(skb); - skb = hdr_skb; - } - - - if (ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) { - - /* - * change the default rx antenna if rx diversity - * chooses the other antenna 3 times in a row. - */ - if (sc->rx.defant != rs.rs_antenna) { - if (++sc->rx.rxotherant >= 3) - ath_setdefantenna(sc, rs.rs_antenna); - } else { - sc->rx.rxotherant = 0; - } - - } - - if (rxs->flag & RX_FLAG_MMIC_STRIPPED) - skb_trim(skb, skb->len - 8); - - spin_lock_irqsave(&sc->sc_pm_lock, flags); - if ((sc->ps_flags & (PS_WAIT_FOR_BEACON | - PS_WAIT_FOR_CAB | - PS_WAIT_FOR_PSPOLL_DATA)) || - ath9k_check_auto_sleep(sc)) - ath_rx_ps(sc, skb, rs.is_mybeacon); - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - - if ((ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) && sc->ant_rx == 3) - ath_ant_comb_scan(sc, &rs); - - ath9k_apply_ampdu_details(sc, &rs, rxs); - - ieee80211_rx(hw, skb); - -requeue_drop_frag: - if (sc->rx.frag) { - dev_kfree_skb_any(sc->rx.frag); - sc->rx.frag = NULL; - } -requeue: - list_add_tail(&bf->list, &sc->rx.rxbuf); - if (flush) - continue; - - if (edma) { - ath_rx_edma_buf_link(sc, qtype); - } else { - ath_rx_buf_relink(sc, bf); - ath9k_hw_rxena(ah); - } - } while (1); - - if (!(ah->imask & ATH9K_INT_RXEOL)) { - ah->imask |= (ATH9K_INT_RXEOL | ATH9K_INT_RXORN); - ath9k_hw_set_interrupts(ah); - } - - return 0; -} diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h deleted file mode 100644 index f7c90cc58d56..000000000000 --- a/drivers/net/wireless/ath/ath9k/reg.h +++ /dev/null @@ -1,2377 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef REG_H -#define REG_H - -#include "../reg.h" - -#define AR_CR 0x0008 -#define AR_CR_RXE (AR_SREV_9300_20_OR_LATER(ah) ? 0x0000000c : 0x00000004) -#define AR_CR_RXD 0x00000020 -#define AR_CR_SWI 0x00000040 - -#define AR_RXDP 0x000C - -#define AR_CFG 0x0014 -#define AR_CFG_SWTD 0x00000001 -#define AR_CFG_SWTB 0x00000002 -#define AR_CFG_SWRD 0x00000004 -#define AR_CFG_SWRB 0x00000008 -#define AR_CFG_SWRG 0x00000010 -#define AR_CFG_AP_ADHOC_INDICATION 0x00000020 -#define AR_CFG_PHOK 0x00000100 -#define AR_CFG_CLK_GATE_DIS 0x00000400 -#define AR_CFG_EEBS 0x00000200 -#define AR_CFG_PCI_MASTER_REQ_Q_THRESH 0x00060000 -#define AR_CFG_PCI_MASTER_REQ_Q_THRESH_S 17 - -#define AR_RXBP_THRESH 0x0018 -#define AR_RXBP_THRESH_HP 0x0000000f -#define AR_RXBP_THRESH_HP_S 0 -#define AR_RXBP_THRESH_LP 0x00003f00 -#define AR_RXBP_THRESH_LP_S 8 - -#define AR_MIRT 0x0020 -#define AR_MIRT_VAL 0x0000ffff -#define AR_MIRT_VAL_S 16 - -#define AR_IER 0x0024 -#define AR_IER_ENABLE 0x00000001 -#define AR_IER_DISABLE 0x00000000 - -#define AR_TIMT 0x0028 -#define AR_TIMT_LAST 0x0000ffff -#define AR_TIMT_LAST_S 0 -#define AR_TIMT_FIRST 0xffff0000 -#define AR_TIMT_FIRST_S 16 - -#define AR_RIMT 0x002C -#define AR_RIMT_LAST 0x0000ffff -#define AR_RIMT_LAST_S 0 -#define AR_RIMT_FIRST 0xffff0000 -#define AR_RIMT_FIRST_S 16 - -#define AR_DMASIZE_4B 0x00000000 -#define AR_DMASIZE_8B 0x00000001 -#define AR_DMASIZE_16B 0x00000002 -#define AR_DMASIZE_32B 0x00000003 -#define AR_DMASIZE_64B 0x00000004 -#define AR_DMASIZE_128B 0x00000005 -#define AR_DMASIZE_256B 0x00000006 -#define AR_DMASIZE_512B 0x00000007 - -#define AR_TXCFG 0x0030 -#define AR_TXCFG_DMASZ_MASK 0x00000007 -#define AR_TXCFG_DMASZ_4B 0 -#define AR_TXCFG_DMASZ_8B 1 -#define AR_TXCFG_DMASZ_16B 2 -#define AR_TXCFG_DMASZ_32B 3 -#define AR_TXCFG_DMASZ_64B 4 -#define AR_TXCFG_DMASZ_128B 5 -#define AR_TXCFG_DMASZ_256B 6 -#define AR_TXCFG_DMASZ_512B 7 -#define AR_FTRIG 0x000003F0 -#define AR_FTRIG_S 4 -#define AR_FTRIG_IMMED 0x00000000 -#define AR_FTRIG_64B 0x00000010 -#define AR_FTRIG_128B 0x00000020 -#define AR_FTRIG_192B 0x00000030 -#define AR_FTRIG_256B 0x00000040 -#define AR_FTRIG_512B 0x00000080 -#define AR_TXCFG_ADHOC_BEACON_ATIM_TX_POLICY 0x00000800 - -#define AR_RXCFG 0x0034 -#define AR_RXCFG_CHIRP 0x00000008 -#define AR_RXCFG_ZLFDMA 0x00000010 -#define AR_RXCFG_DMASZ_MASK 0x00000007 -#define AR_RXCFG_DMASZ_4B 0 -#define AR_RXCFG_DMASZ_8B 1 -#define AR_RXCFG_DMASZ_16B 2 -#define AR_RXCFG_DMASZ_32B 3 -#define AR_RXCFG_DMASZ_64B 4 -#define AR_RXCFG_DMASZ_128B 5 -#define AR_RXCFG_DMASZ_256B 6 -#define AR_RXCFG_DMASZ_512B 7 - -#define AR_TOPS 0x0044 -#define AR_TOPS_MASK 0x0000FFFF - -#define AR_RXNPTO 0x0048 -#define AR_RXNPTO_MASK 0x000003FF - -#define AR_TXNPTO 0x004C -#define AR_TXNPTO_MASK 0x000003FF -#define AR_TXNPTO_QCU_MASK 0x000FFC00 - -#define AR_RPGTO 0x0050 -#define AR_RPGTO_MASK 0x000003FF - -#define AR_RPCNT 0x0054 -#define AR_RPCNT_MASK 0x0000001F - -#define AR_MACMISC 0x0058 -#define AR_MACMISC_PCI_EXT_FORCE 0x00000010 -#define AR_MACMISC_DMA_OBS 0x000001E0 -#define AR_MACMISC_DMA_OBS_S 5 -#define AR_MACMISC_DMA_OBS_LINE_0 0 -#define AR_MACMISC_DMA_OBS_LINE_1 1 -#define AR_MACMISC_DMA_OBS_LINE_2 2 -#define AR_MACMISC_DMA_OBS_LINE_3 3 -#define AR_MACMISC_DMA_OBS_LINE_4 4 -#define AR_MACMISC_DMA_OBS_LINE_5 5 -#define AR_MACMISC_DMA_OBS_LINE_6 6 -#define AR_MACMISC_DMA_OBS_LINE_7 7 -#define AR_MACMISC_DMA_OBS_LINE_8 8 -#define AR_MACMISC_MISC_OBS 0x00000E00 -#define AR_MACMISC_MISC_OBS_S 9 -#define AR_MACMISC_MISC_OBS_BUS_LSB 0x00007000 -#define AR_MACMISC_MISC_OBS_BUS_LSB_S 12 -#define AR_MACMISC_MISC_OBS_BUS_MSB 0x00038000 -#define AR_MACMISC_MISC_OBS_BUS_MSB_S 15 -#define AR_MACMISC_MISC_OBS_BUS_1 1 - -#define AR_DATABUF_SIZE 0x0060 -#define AR_DATABUF_SIZE_MASK 0x00000FFF - -#define AR_GTXTO 0x0064 -#define AR_GTXTO_TIMEOUT_COUNTER 0x0000FFFF -#define AR_GTXTO_TIMEOUT_LIMIT 0xFFFF0000 -#define AR_GTXTO_TIMEOUT_LIMIT_S 16 - -#define AR_GTTM 0x0068 -#define AR_GTTM_USEC 0x00000001 -#define AR_GTTM_IGNORE_IDLE 0x00000002 -#define AR_GTTM_RESET_IDLE 0x00000004 -#define AR_GTTM_CST_USEC 0x00000008 - -#define AR_CST 0x006C -#define AR_CST_TIMEOUT_COUNTER 0x0000FFFF -#define AR_CST_TIMEOUT_LIMIT 0xFFFF0000 -#define AR_CST_TIMEOUT_LIMIT_S 16 - -#define AR_HP_RXDP 0x0074 -#define AR_LP_RXDP 0x0078 - -#define AR_ISR 0x0080 -#define AR_ISR_RXOK 0x00000001 -#define AR_ISR_RXDESC 0x00000002 -#define AR_ISR_HP_RXOK 0x00000001 -#define AR_ISR_LP_RXOK 0x00000002 -#define AR_ISR_RXERR 0x00000004 -#define AR_ISR_RXNOPKT 0x00000008 -#define AR_ISR_RXEOL 0x00000010 -#define AR_ISR_RXORN 0x00000020 -#define AR_ISR_TXOK 0x00000040 -#define AR_ISR_TXDESC 0x00000080 -#define AR_ISR_TXERR 0x00000100 -#define AR_ISR_TXNOPKT 0x00000200 -#define AR_ISR_TXEOL 0x00000400 -#define AR_ISR_TXURN 0x00000800 -#define AR_ISR_MIB 0x00001000 -#define AR_ISR_SWI 0x00002000 -#define AR_ISR_RXPHY 0x00004000 -#define AR_ISR_RXKCM 0x00008000 -#define AR_ISR_SWBA 0x00010000 -#define AR_ISR_BRSSI 0x00020000 -#define AR_ISR_BMISS 0x00040000 -#define AR_ISR_BNR 0x00100000 -#define AR_ISR_RXCHIRP 0x00200000 -#define AR_ISR_BCNMISC 0x00800000 -#define AR_ISR_TIM 0x00800000 -#define AR_ISR_QCBROVF 0x02000000 -#define AR_ISR_QCBRURN 0x04000000 -#define AR_ISR_QTRIG 0x08000000 -#define AR_ISR_GENTMR 0x10000000 - -#define AR_ISR_TXMINTR 0x00080000 -#define AR_ISR_RXMINTR 0x01000000 -#define AR_ISR_TXINTM 0x40000000 -#define AR_ISR_RXINTM 0x80000000 - -#define AR_ISR_S0 0x0084 -#define AR_ISR_S0_QCU_TXOK 0x000003FF -#define AR_ISR_S0_QCU_TXOK_S 0 -#define AR_ISR_S0_QCU_TXDESC 0x03FF0000 -#define AR_ISR_S0_QCU_TXDESC_S 16 - -#define AR_ISR_S1 0x0088 -#define AR_ISR_S1_QCU_TXERR 0x000003FF -#define AR_ISR_S1_QCU_TXERR_S 0 -#define AR_ISR_S1_QCU_TXEOL 0x03FF0000 -#define AR_ISR_S1_QCU_TXEOL_S 16 - -#define AR_ISR_S2 0x008c -#define AR_ISR_S2_QCU_TXURN 0x000003FF -#define AR_ISR_S2_BB_WATCHDOG 0x00010000 -#define AR_ISR_S2_CST 0x00400000 -#define AR_ISR_S2_GTT 0x00800000 -#define AR_ISR_S2_TIM 0x01000000 -#define AR_ISR_S2_CABEND 0x02000000 -#define AR_ISR_S2_DTIMSYNC 0x04000000 -#define AR_ISR_S2_BCNTO 0x08000000 -#define AR_ISR_S2_CABTO 0x10000000 -#define AR_ISR_S2_DTIM 0x20000000 -#define AR_ISR_S2_TSFOOR 0x40000000 -#define AR_ISR_S2_TBTT_TIME 0x80000000 - -#define AR_ISR_S3 0x0090 -#define AR_ISR_S3_QCU_QCBROVF 0x000003FF -#define AR_ISR_S3_QCU_QCBRURN 0x03FF0000 - -#define AR_ISR_S4 0x0094 -#define AR_ISR_S4_QCU_QTRIG 0x000003FF -#define AR_ISR_S4_RESV0 0xFFFFFC00 - -#define AR_ISR_S5 0x0098 -#define AR_ISR_S5_TIMER_TRIG 0x000000FF -#define AR_ISR_S5_TIMER_THRESH 0x0007FE00 -#define AR_ISR_S5_TIM_TIMER 0x00000010 -#define AR_ISR_S5_DTIM_TIMER 0x00000020 -#define AR_IMR_S5 0x00b8 -#define AR_IMR_S5_TIM_TIMER 0x00000010 -#define AR_IMR_S5_DTIM_TIMER 0x00000020 -#define AR_ISR_S5_GENTIMER_TRIG 0x0000FF80 -#define AR_ISR_S5_GENTIMER_TRIG_S 0 -#define AR_ISR_S5_GENTIMER_THRESH 0xFF800000 -#define AR_ISR_S5_GENTIMER_THRESH_S 16 -#define AR_IMR_S5_GENTIMER_TRIG 0x0000FF80 -#define AR_IMR_S5_GENTIMER_TRIG_S 0 -#define AR_IMR_S5_GENTIMER_THRESH 0xFF800000 -#define AR_IMR_S5_GENTIMER_THRESH_S 16 - -#define AR_IMR 0x00a0 -#define AR_IMR_RXOK 0x00000001 -#define AR_IMR_RXDESC 0x00000002 -#define AR_IMR_RXOK_HP 0x00000001 -#define AR_IMR_RXOK_LP 0x00000002 -#define AR_IMR_RXERR 0x00000004 -#define AR_IMR_RXNOPKT 0x00000008 -#define AR_IMR_RXEOL 0x00000010 -#define AR_IMR_RXORN 0x00000020 -#define AR_IMR_TXOK 0x00000040 -#define AR_IMR_TXDESC 0x00000080 -#define AR_IMR_TXERR 0x00000100 -#define AR_IMR_TXNOPKT 0x00000200 -#define AR_IMR_TXEOL 0x00000400 -#define AR_IMR_TXURN 0x00000800 -#define AR_IMR_MIB 0x00001000 -#define AR_IMR_SWI 0x00002000 -#define AR_IMR_RXPHY 0x00004000 -#define AR_IMR_RXKCM 0x00008000 -#define AR_IMR_SWBA 0x00010000 -#define AR_IMR_BRSSI 0x00020000 -#define AR_IMR_BMISS 0x00040000 -#define AR_IMR_BNR 0x00100000 -#define AR_IMR_RXCHIRP 0x00200000 -#define AR_IMR_BCNMISC 0x00800000 -#define AR_IMR_TIM 0x00800000 -#define AR_IMR_QCBROVF 0x02000000 -#define AR_IMR_QCBRURN 0x04000000 -#define AR_IMR_QTRIG 0x08000000 -#define AR_IMR_GENTMR 0x10000000 - -#define AR_IMR_TXMINTR 0x00080000 -#define AR_IMR_RXMINTR 0x01000000 -#define AR_IMR_TXINTM 0x40000000 -#define AR_IMR_RXINTM 0x80000000 - -#define AR_IMR_S0 0x00a4 -#define AR_IMR_S0_QCU_TXOK 0x000003FF -#define AR_IMR_S0_QCU_TXOK_S 0 -#define AR_IMR_S0_QCU_TXDESC 0x03FF0000 -#define AR_IMR_S0_QCU_TXDESC_S 16 - -#define AR_IMR_S1 0x00a8 -#define AR_IMR_S1_QCU_TXERR 0x000003FF -#define AR_IMR_S1_QCU_TXERR_S 0 -#define AR_IMR_S1_QCU_TXEOL 0x03FF0000 -#define AR_IMR_S1_QCU_TXEOL_S 16 - -#define AR_IMR_S2 0x00ac -#define AR_IMR_S2_QCU_TXURN 0x000003FF -#define AR_IMR_S2_QCU_TXURN_S 0 -#define AR_IMR_S2_CST 0x00400000 -#define AR_IMR_S2_GTT 0x00800000 -#define AR_IMR_S2_TIM 0x01000000 -#define AR_IMR_S2_CABEND 0x02000000 -#define AR_IMR_S2_DTIMSYNC 0x04000000 -#define AR_IMR_S2_BCNTO 0x08000000 -#define AR_IMR_S2_CABTO 0x10000000 -#define AR_IMR_S2_DTIM 0x20000000 -#define AR_IMR_S2_TSFOOR 0x40000000 - -#define AR_IMR_S3 0x00b0 -#define AR_IMR_S3_QCU_QCBROVF 0x000003FF -#define AR_IMR_S3_QCU_QCBRURN 0x03FF0000 -#define AR_IMR_S3_QCU_QCBRURN_S 16 - -#define AR_IMR_S4 0x00b4 -#define AR_IMR_S4_QCU_QTRIG 0x000003FF -#define AR_IMR_S4_RESV0 0xFFFFFC00 - -#define AR_IMR_S5 0x00b8 -#define AR_IMR_S5_TIMER_TRIG 0x000000FF -#define AR_IMR_S5_TIMER_THRESH 0x0000FF00 - - -#define AR_ISR_RAC 0x00c0 -#define AR_ISR_S0_S 0x00c4 -#define AR_ISR_S0_QCU_TXOK 0x000003FF -#define AR_ISR_S0_QCU_TXOK_S 0 -#define AR_ISR_S0_QCU_TXDESC 0x03FF0000 -#define AR_ISR_S0_QCU_TXDESC_S 16 - -#define AR_ISR_S1_S 0x00c8 -#define AR_ISR_S1_QCU_TXERR 0x000003FF -#define AR_ISR_S1_QCU_TXERR_S 0 -#define AR_ISR_S1_QCU_TXEOL 0x03FF0000 -#define AR_ISR_S1_QCU_TXEOL_S 16 - -#define AR_ISR_S2_S (AR_SREV_9300_20_OR_LATER(ah) ? 0x00d0 : 0x00cc) -#define AR_ISR_S3_S (AR_SREV_9300_20_OR_LATER(ah) ? 0x00d4 : 0x00d0) -#define AR_ISR_S4_S (AR_SREV_9300_20_OR_LATER(ah) ? 0x00d8 : 0x00d4) -#define AR_ISR_S5_S (AR_SREV_9300_20_OR_LATER(ah) ? 0x00dc : 0x00d8) -#define AR_DMADBG_0 0x00e0 -#define AR_DMADBG_1 0x00e4 -#define AR_DMADBG_2 0x00e8 -#define AR_DMADBG_3 0x00ec -#define AR_DMADBG_4 0x00f0 -#define AR_DMADBG_5 0x00f4 -#define AR_DMADBG_6 0x00f8 -#define AR_DMADBG_7 0x00fc - -#define AR_NUM_QCU 10 -#define AR_QCU_0 0x0001 -#define AR_QCU_1 0x0002 -#define AR_QCU_2 0x0004 -#define AR_QCU_3 0x0008 -#define AR_QCU_4 0x0010 -#define AR_QCU_5 0x0020 -#define AR_QCU_6 0x0040 -#define AR_QCU_7 0x0080 -#define AR_QCU_8 0x0100 -#define AR_QCU_9 0x0200 - -#define AR_Q0_TXDP 0x0800 -#define AR_Q1_TXDP 0x0804 -#define AR_Q2_TXDP 0x0808 -#define AR_Q3_TXDP 0x080c -#define AR_Q4_TXDP 0x0810 -#define AR_Q5_TXDP 0x0814 -#define AR_Q6_TXDP 0x0818 -#define AR_Q7_TXDP 0x081c -#define AR_Q8_TXDP 0x0820 -#define AR_Q9_TXDP 0x0824 -#define AR_QTXDP(_i) (AR_Q0_TXDP + ((_i)<<2)) - -#define AR_Q_STATUS_RING_START 0x830 -#define AR_Q_STATUS_RING_END 0x834 - -#define AR_Q_TXE 0x0840 -#define AR_Q_TXE_M 0x000003FF - -#define AR_Q_TXD 0x0880 -#define AR_Q_TXD_M 0x000003FF - -#define AR_Q0_CBRCFG 0x08c0 -#define AR_Q1_CBRCFG 0x08c4 -#define AR_Q2_CBRCFG 0x08c8 -#define AR_Q3_CBRCFG 0x08cc -#define AR_Q4_CBRCFG 0x08d0 -#define AR_Q5_CBRCFG 0x08d4 -#define AR_Q6_CBRCFG 0x08d8 -#define AR_Q7_CBRCFG 0x08dc -#define AR_Q8_CBRCFG 0x08e0 -#define AR_Q9_CBRCFG 0x08e4 -#define AR_QCBRCFG(_i) (AR_Q0_CBRCFG + ((_i)<<2)) -#define AR_Q_CBRCFG_INTERVAL 0x00FFFFFF -#define AR_Q_CBRCFG_INTERVAL_S 0 -#define AR_Q_CBRCFG_OVF_THRESH 0xFF000000 -#define AR_Q_CBRCFG_OVF_THRESH_S 24 - -#define AR_Q0_RDYTIMECFG 0x0900 -#define AR_Q1_RDYTIMECFG 0x0904 -#define AR_Q2_RDYTIMECFG 0x0908 -#define AR_Q3_RDYTIMECFG 0x090c -#define AR_Q4_RDYTIMECFG 0x0910 -#define AR_Q5_RDYTIMECFG 0x0914 -#define AR_Q6_RDYTIMECFG 0x0918 -#define AR_Q7_RDYTIMECFG 0x091c -#define AR_Q8_RDYTIMECFG 0x0920 -#define AR_Q9_RDYTIMECFG 0x0924 -#define AR_QRDYTIMECFG(_i) (AR_Q0_RDYTIMECFG + ((_i)<<2)) -#define AR_Q_RDYTIMECFG_DURATION 0x00FFFFFF -#define AR_Q_RDYTIMECFG_DURATION_S 0 -#define AR_Q_RDYTIMECFG_EN 0x01000000 - -#define AR_Q_ONESHOTARM_SC 0x0940 -#define AR_Q_ONESHOTARM_SC_M 0x000003FF -#define AR_Q_ONESHOTARM_SC_RESV0 0xFFFFFC00 - -#define AR_Q_ONESHOTARM_CC 0x0980 -#define AR_Q_ONESHOTARM_CC_M 0x000003FF -#define AR_Q_ONESHOTARM_CC_RESV0 0xFFFFFC00 - -#define AR_Q0_MISC 0x09c0 -#define AR_Q1_MISC 0x09c4 -#define AR_Q2_MISC 0x09c8 -#define AR_Q3_MISC 0x09cc -#define AR_Q4_MISC 0x09d0 -#define AR_Q5_MISC 0x09d4 -#define AR_Q6_MISC 0x09d8 -#define AR_Q7_MISC 0x09dc -#define AR_Q8_MISC 0x09e0 -#define AR_Q9_MISC 0x09e4 -#define AR_QMISC(_i) (AR_Q0_MISC + ((_i)<<2)) -#define AR_Q_MISC_FSP 0x0000000F -#define AR_Q_MISC_FSP_ASAP 0 -#define AR_Q_MISC_FSP_CBR 1 -#define AR_Q_MISC_FSP_DBA_GATED 2 -#define AR_Q_MISC_FSP_TIM_GATED 3 -#define AR_Q_MISC_FSP_BEACON_SENT_GATED 4 -#define AR_Q_MISC_FSP_BEACON_RCVD_GATED 5 -#define AR_Q_MISC_ONE_SHOT_EN 0x00000010 -#define AR_Q_MISC_CBR_INCR_DIS1 0x00000020 -#define AR_Q_MISC_CBR_INCR_DIS0 0x00000040 -#define AR_Q_MISC_BEACON_USE 0x00000080 -#define AR_Q_MISC_CBR_EXP_CNTR_LIMIT_EN 0x00000100 -#define AR_Q_MISC_RDYTIME_EXP_POLICY 0x00000200 -#define AR_Q_MISC_RESET_CBR_EXP_CTR 0x00000400 -#define AR_Q_MISC_DCU_EARLY_TERM_REQ 0x00000800 -#define AR_Q_MISC_RESV0 0xFFFFF000 - -#define AR_Q0_STS 0x0a00 -#define AR_Q1_STS 0x0a04 -#define AR_Q2_STS 0x0a08 -#define AR_Q3_STS 0x0a0c -#define AR_Q4_STS 0x0a10 -#define AR_Q5_STS 0x0a14 -#define AR_Q6_STS 0x0a18 -#define AR_Q7_STS 0x0a1c -#define AR_Q8_STS 0x0a20 -#define AR_Q9_STS 0x0a24 -#define AR_QSTS(_i) (AR_Q0_STS + ((_i)<<2)) -#define AR_Q_STS_PEND_FR_CNT 0x00000003 -#define AR_Q_STS_RESV0 0x000000FC -#define AR_Q_STS_CBR_EXP_CNT 0x0000FF00 -#define AR_Q_STS_RESV1 0xFFFF0000 - -#define AR_Q_RDYTIMESHDN 0x0a40 -#define AR_Q_RDYTIMESHDN_M 0x000003FF - -/* MAC Descriptor CRC check */ -#define AR_Q_DESC_CRCCHK 0xa44 -/* Enable CRC check on the descriptor fetched from host */ -#define AR_Q_DESC_CRCCHK_EN 1 - -#define AR_NUM_DCU 10 -#define AR_DCU_0 0x0001 -#define AR_DCU_1 0x0002 -#define AR_DCU_2 0x0004 -#define AR_DCU_3 0x0008 -#define AR_DCU_4 0x0010 -#define AR_DCU_5 0x0020 -#define AR_DCU_6 0x0040 -#define AR_DCU_7 0x0080 -#define AR_DCU_8 0x0100 -#define AR_DCU_9 0x0200 - -#define AR_D0_QCUMASK 0x1000 -#define AR_D1_QCUMASK 0x1004 -#define AR_D2_QCUMASK 0x1008 -#define AR_D3_QCUMASK 0x100c -#define AR_D4_QCUMASK 0x1010 -#define AR_D5_QCUMASK 0x1014 -#define AR_D6_QCUMASK 0x1018 -#define AR_D7_QCUMASK 0x101c -#define AR_D8_QCUMASK 0x1020 -#define AR_D9_QCUMASK 0x1024 -#define AR_DQCUMASK(_i) (AR_D0_QCUMASK + ((_i)<<2)) -#define AR_D_QCUMASK 0x000003FF -#define AR_D_QCUMASK_RESV0 0xFFFFFC00 - -#define AR_D_TXBLK_CMD 0x1038 -#define AR_D_TXBLK_DATA(i) (AR_D_TXBLK_CMD+(i)) - -#define AR_D0_LCL_IFS 0x1040 -#define AR_D1_LCL_IFS 0x1044 -#define AR_D2_LCL_IFS 0x1048 -#define AR_D3_LCL_IFS 0x104c -#define AR_D4_LCL_IFS 0x1050 -#define AR_D5_LCL_IFS 0x1054 -#define AR_D6_LCL_IFS 0x1058 -#define AR_D7_LCL_IFS 0x105c -#define AR_D8_LCL_IFS 0x1060 -#define AR_D9_LCL_IFS 0x1064 -#define AR_DLCL_IFS(_i) (AR_D0_LCL_IFS + ((_i)<<2)) -#define AR_D_LCL_IFS_CWMIN 0x000003FF -#define AR_D_LCL_IFS_CWMIN_S 0 -#define AR_D_LCL_IFS_CWMAX 0x000FFC00 -#define AR_D_LCL_IFS_CWMAX_S 10 -#define AR_D_LCL_IFS_AIFS 0x0FF00000 -#define AR_D_LCL_IFS_AIFS_S 20 - -#define AR_D_LCL_IFS_RESV0 0xF0000000 - -#define AR_D0_RETRY_LIMIT 0x1080 -#define AR_D1_RETRY_LIMIT 0x1084 -#define AR_D2_RETRY_LIMIT 0x1088 -#define AR_D3_RETRY_LIMIT 0x108c -#define AR_D4_RETRY_LIMIT 0x1090 -#define AR_D5_RETRY_LIMIT 0x1094 -#define AR_D6_RETRY_LIMIT 0x1098 -#define AR_D7_RETRY_LIMIT 0x109c -#define AR_D8_RETRY_LIMIT 0x10a0 -#define AR_D9_RETRY_LIMIT 0x10a4 -#define AR_DRETRY_LIMIT(_i) (AR_D0_RETRY_LIMIT + ((_i)<<2)) -#define AR_D_RETRY_LIMIT_FR_SH 0x0000000F -#define AR_D_RETRY_LIMIT_FR_SH_S 0 -#define AR_D_RETRY_LIMIT_STA_SH 0x00003F00 -#define AR_D_RETRY_LIMIT_STA_SH_S 8 -#define AR_D_RETRY_LIMIT_STA_LG 0x000FC000 -#define AR_D_RETRY_LIMIT_STA_LG_S 14 -#define AR_D_RETRY_LIMIT_RESV0 0xFFF00000 - -#define AR_D0_CHNTIME 0x10c0 -#define AR_D1_CHNTIME 0x10c4 -#define AR_D2_CHNTIME 0x10c8 -#define AR_D3_CHNTIME 0x10cc -#define AR_D4_CHNTIME 0x10d0 -#define AR_D5_CHNTIME 0x10d4 -#define AR_D6_CHNTIME 0x10d8 -#define AR_D7_CHNTIME 0x10dc -#define AR_D8_CHNTIME 0x10e0 -#define AR_D9_CHNTIME 0x10e4 -#define AR_DCHNTIME(_i) (AR_D0_CHNTIME + ((_i)<<2)) -#define AR_D_CHNTIME_DUR 0x000FFFFF -#define AR_D_CHNTIME_DUR_S 0 -#define AR_D_CHNTIME_EN 0x00100000 -#define AR_D_CHNTIME_RESV0 0xFFE00000 - -#define AR_D0_MISC 0x1100 -#define AR_D1_MISC 0x1104 -#define AR_D2_MISC 0x1108 -#define AR_D3_MISC 0x110c -#define AR_D4_MISC 0x1110 -#define AR_D5_MISC 0x1114 -#define AR_D6_MISC 0x1118 -#define AR_D7_MISC 0x111c -#define AR_D8_MISC 0x1120 -#define AR_D9_MISC 0x1124 -#define AR_DMISC(_i) (AR_D0_MISC + ((_i)<<2)) -#define AR_D_MISC_BKOFF_THRESH 0x0000003F -#define AR_D_MISC_RETRY_CNT_RESET_EN 0x00000040 -#define AR_D_MISC_CW_RESET_EN 0x00000080 -#define AR_D_MISC_FRAG_WAIT_EN 0x00000100 -#define AR_D_MISC_FRAG_BKOFF_EN 0x00000200 -#define AR_D_MISC_CW_BKOFF_EN 0x00001000 -#define AR_D_MISC_VIR_COL_HANDLING 0x0000C000 -#define AR_D_MISC_VIR_COL_HANDLING_S 14 -#define AR_D_MISC_VIR_COL_HANDLING_DEFAULT 0 -#define AR_D_MISC_VIR_COL_HANDLING_IGNORE 1 -#define AR_D_MISC_BEACON_USE 0x00010000 -#define AR_D_MISC_ARB_LOCKOUT_CNTRL 0x00060000 -#define AR_D_MISC_ARB_LOCKOUT_CNTRL_S 17 -#define AR_D_MISC_ARB_LOCKOUT_CNTRL_NONE 0 -#define AR_D_MISC_ARB_LOCKOUT_CNTRL_INTRA_FR 1 -#define AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL 2 -#define AR_D_MISC_ARB_LOCKOUT_IGNORE 0x00080000 -#define AR_D_MISC_SEQ_NUM_INCR_DIS 0x00100000 -#define AR_D_MISC_POST_FR_BKOFF_DIS 0x00200000 -#define AR_D_MISC_VIT_COL_CW_BKOFF_EN 0x00400000 -#define AR_D_MISC_BLOWN_IFS_RETRY_EN 0x00800000 -#define AR_D_MISC_RESV0 0xFF000000 - -#define AR_D_SEQNUM 0x1140 - -#define AR_D_GBL_IFS_SIFS 0x1030 -#define AR_D_GBL_IFS_SIFS_M 0x0000FFFF -#define AR_D_GBL_IFS_SIFS_RESV0 0xFFFFFFFF - -#define AR_D_TXBLK_BASE 0x1038 -#define AR_D_TXBLK_WRITE_BITMASK 0x0000FFFF -#define AR_D_TXBLK_WRITE_BITMASK_S 0 -#define AR_D_TXBLK_WRITE_SLICE 0x000F0000 -#define AR_D_TXBLK_WRITE_SLICE_S 16 -#define AR_D_TXBLK_WRITE_DCU 0x00F00000 -#define AR_D_TXBLK_WRITE_DCU_S 20 -#define AR_D_TXBLK_WRITE_COMMAND 0x0F000000 -#define AR_D_TXBLK_WRITE_COMMAND_S 24 - -#define AR_D_GBL_IFS_SLOT 0x1070 -#define AR_D_GBL_IFS_SLOT_M 0x0000FFFF -#define AR_D_GBL_IFS_SLOT_RESV0 0xFFFF0000 - -#define AR_D_GBL_IFS_EIFS 0x10b0 -#define AR_D_GBL_IFS_EIFS_M 0x0000FFFF -#define AR_D_GBL_IFS_EIFS_RESV0 0xFFFF0000 -#define AR_D_GBL_IFS_EIFS_ASYNC_FIFO 363 - -#define AR_D_GBL_IFS_MISC 0x10f0 -#define AR_D_GBL_IFS_MISC_LFSR_SLICE_SEL 0x00000007 -#define AR_D_GBL_IFS_MISC_TURBO_MODE 0x00000008 -#define AR_D_GBL_IFS_MISC_USEC_DURATION 0x000FFC00 -#define AR_D_GBL_IFS_MISC_DCU_ARBITER_DLY 0x00300000 -#define AR_D_GBL_IFS_MISC_RANDOM_LFSR_SLICE_DIS 0x01000000 -#define AR_D_GBL_IFS_MISC_SLOT_XMIT_WIND_LEN 0x06000000 -#define AR_D_GBL_IFS_MISC_FORCE_XMIT_SLOT_BOUND 0x08000000 -#define AR_D_GBL_IFS_MISC_IGNORE_BACKOFF 0x10000000 - -#define AR_D_FPCTL 0x1230 -#define AR_D_FPCTL_DCU 0x0000000F -#define AR_D_FPCTL_DCU_S 0 -#define AR_D_FPCTL_PREFETCH_EN 0x00000010 -#define AR_D_FPCTL_BURST_PREFETCH 0x00007FE0 -#define AR_D_FPCTL_BURST_PREFETCH_S 5 - -#define AR_D_TXPSE 0x1270 -#define AR_D_TXPSE_CTRL 0x000003FF -#define AR_D_TXPSE_RESV0 0x0000FC00 -#define AR_D_TXPSE_STATUS 0x00010000 -#define AR_D_TXPSE_RESV1 0xFFFE0000 - -#define AR_D_TXSLOTMASK 0x12f0 -#define AR_D_TXSLOTMASK_NUM 0x0000000F - -#define AR_CFG_LED 0x1f04 -#define AR_CFG_SCLK_RATE_IND 0x00000003 -#define AR_CFG_SCLK_RATE_IND_S 0 -#define AR_CFG_SCLK_32MHZ 0x00000000 -#define AR_CFG_SCLK_4MHZ 0x00000001 -#define AR_CFG_SCLK_1MHZ 0x00000002 -#define AR_CFG_SCLK_32KHZ 0x00000003 -#define AR_CFG_LED_BLINK_SLOW 0x00000008 -#define AR_CFG_LED_BLINK_THRESH_SEL 0x00000070 -#define AR_CFG_LED_MODE_SEL 0x00000380 -#define AR_CFG_LED_MODE_SEL_S 7 -#define AR_CFG_LED_POWER 0x00000280 -#define AR_CFG_LED_POWER_S 7 -#define AR_CFG_LED_NETWORK 0x00000300 -#define AR_CFG_LED_NETWORK_S 7 -#define AR_CFG_LED_MODE_PROP 0x0 -#define AR_CFG_LED_MODE_RPROP 0x1 -#define AR_CFG_LED_MODE_SPLIT 0x2 -#define AR_CFG_LED_MODE_RAND 0x3 -#define AR_CFG_LED_MODE_POWER_OFF 0x4 -#define AR_CFG_LED_MODE_POWER_ON 0x5 -#define AR_CFG_LED_MODE_NETWORK_OFF 0x4 -#define AR_CFG_LED_MODE_NETWORK_ON 0x6 -#define AR_CFG_LED_ASSOC_CTL 0x00000c00 -#define AR_CFG_LED_ASSOC_CTL_S 10 -#define AR_CFG_LED_ASSOC_NONE 0x0 -#define AR_CFG_LED_ASSOC_ACTIVE 0x1 -#define AR_CFG_LED_ASSOC_PENDING 0x2 - -#define AR_CFG_LED_BLINK_SLOW 0x00000008 -#define AR_CFG_LED_BLINK_SLOW_S 3 - -#define AR_CFG_LED_BLINK_THRESH_SEL 0x00000070 -#define AR_CFG_LED_BLINK_THRESH_SEL_S 4 - -#define AR_MAC_SLEEP 0x1f00 -#define AR_MAC_SLEEP_MAC_AWAKE 0x00000000 -#define AR_MAC_SLEEP_MAC_ASLEEP 0x00000001 - -#define AR_RC 0x4000 -#define AR_RC_AHB 0x00000001 -#define AR_RC_APB 0x00000002 -#define AR_RC_HOSTIF 0x00000100 - -#define AR_WA (AR_SREV_9340(ah) ? 0x40c4 : 0x4004) -#define AR_WA_BIT6 (1 << 6) -#define AR_WA_BIT7 (1 << 7) -#define AR_WA_BIT23 (1 << 23) -#define AR_WA_D3_L1_DISABLE (1 << 14) -#define AR_WA_UNTIE_RESET_EN (1 << 15) /* Enable PCI Reset - to POR (power-on-reset) */ -#define AR_WA_D3_TO_L1_DISABLE_REAL (1 << 16) -#define AR_WA_ASPM_TIMER_BASED_DISABLE (1 << 17) -#define AR_WA_RESET_EN (1 << 18) /* Enable PCI-Reset to - POR (bit 15) */ -#define AR_WA_ANALOG_SHIFT (1 << 20) -#define AR_WA_POR_SHORT (1 << 21) /* PCI-E Phy reset control */ -#define AR_WA_BIT22 (1 << 22) -#define AR9285_WA_DEFAULT 0x004a050b -#define AR9280_WA_DEFAULT 0x0040073b -#define AR_WA_DEFAULT 0x0000073f - - -#define AR_PM_STATE 0x4008 -#define AR_PM_STATE_PME_D3COLD_VAUX 0x00100000 - -#define AR_HOST_TIMEOUT (AR_SREV_9340(ah) ? 0x4008 : 0x4018) -#define AR_HOST_TIMEOUT_APB_CNTR 0x0000FFFF -#define AR_HOST_TIMEOUT_APB_CNTR_S 0 -#define AR_HOST_TIMEOUT_LCL_CNTR 0xFFFF0000 -#define AR_HOST_TIMEOUT_LCL_CNTR_S 16 - -#define AR_EEPROM 0x401c -#define AR_EEPROM_ABSENT 0x00000100 -#define AR_EEPROM_CORRUPT 0x00000200 -#define AR_EEPROM_PROT_MASK 0x03FFFC00 -#define AR_EEPROM_PROT_MASK_S 10 - -#define EEPROM_PROTECT_RP_0_31 0x0001 -#define EEPROM_PROTECT_WP_0_31 0x0002 -#define EEPROM_PROTECT_RP_32_63 0x0004 -#define EEPROM_PROTECT_WP_32_63 0x0008 -#define EEPROM_PROTECT_RP_64_127 0x0010 -#define EEPROM_PROTECT_WP_64_127 0x0020 -#define EEPROM_PROTECT_RP_128_191 0x0040 -#define EEPROM_PROTECT_WP_128_191 0x0080 -#define EEPROM_PROTECT_RP_192_255 0x0100 -#define EEPROM_PROTECT_WP_192_255 0x0200 -#define EEPROM_PROTECT_RP_256_511 0x0400 -#define EEPROM_PROTECT_WP_256_511 0x0800 -#define EEPROM_PROTECT_RP_512_1023 0x1000 -#define EEPROM_PROTECT_WP_512_1023 0x2000 -#define EEPROM_PROTECT_RP_1024_2047 0x4000 -#define EEPROM_PROTECT_WP_1024_2047 0x8000 - -#define AR_SREV \ - ((AR_SREV_9100(ah)) ? 0x0600 : (AR_SREV_9340(ah) \ - ? 0x400c : 0x4020)) - -#define AR_SREV_ID \ - ((AR_SREV_9100(ah)) ? 0x00000FFF : 0x000000FF) -#define AR_SREV_VERSION 0x000000F0 -#define AR_SREV_VERSION_S 4 -#define AR_SREV_REVISION 0x00000007 - -#define AR_SREV_ID2 0xFFFFFFFF -#define AR_SREV_VERSION2 0xFFFC0000 -#define AR_SREV_VERSION2_S 18 -#define AR_SREV_TYPE2 0x0003F000 -#define AR_SREV_TYPE2_S 12 -#define AR_SREV_TYPE2_CHAIN 0x00001000 -#define AR_SREV_TYPE2_HOST_MODE 0x00002000 -#define AR_SREV_REVISION2 0x00000F00 -#define AR_SREV_REVISION2_S 8 - -#define AR_SREV_VERSION_5416_PCI 0xD -#define AR_SREV_VERSION_5416_PCIE 0xC -#define AR_SREV_REVISION_5416_10 0 -#define AR_SREV_REVISION_5416_20 1 -#define AR_SREV_REVISION_5416_22 2 -#define AR_SREV_VERSION_9100 0x14 -#define AR_SREV_VERSION_9160 0x40 -#define AR_SREV_REVISION_9160_10 0 -#define AR_SREV_REVISION_9160_11 1 -#define AR_SREV_VERSION_9280 0x80 -#define AR_SREV_REVISION_9280_10 0 -#define AR_SREV_REVISION_9280_20 1 -#define AR_SREV_REVISION_9280_21 2 -#define AR_SREV_VERSION_9285 0xC0 -#define AR_SREV_REVISION_9285_10 0 -#define AR_SREV_REVISION_9285_11 1 -#define AR_SREV_REVISION_9285_12 2 -#define AR_SREV_VERSION_9287 0x180 -#define AR_SREV_REVISION_9287_10 0 -#define AR_SREV_REVISION_9287_11 1 -#define AR_SREV_REVISION_9287_12 2 -#define AR_SREV_REVISION_9287_13 3 -#define AR_SREV_VERSION_9271 0x140 -#define AR_SREV_REVISION_9271_10 0 -#define AR_SREV_REVISION_9271_11 1 -#define AR_SREV_VERSION_9300 0x1c0 -#define AR_SREV_REVISION_9300_20 2 /* 2.0 and 2.1 */ -#define AR_SREV_REVISION_9300_22 3 -#define AR_SREV_VERSION_9330 0x200 -#define AR_SREV_REVISION_9330_10 0 -#define AR_SREV_REVISION_9330_11 1 -#define AR_SREV_REVISION_9330_12 2 -#define AR_SREV_VERSION_9485 0x240 -#define AR_SREV_REVISION_9485_10 0 -#define AR_SREV_REVISION_9485_11 1 -#define AR_SREV_VERSION_9340 0x300 -#define AR_SREV_REVISION_9340_10 0 -#define AR_SREV_REVISION_9340_11 1 -#define AR_SREV_REVISION_9340_12 2 -#define AR_SREV_REVISION_9340_13 3 -#define AR_SREV_VERSION_9580 0x1C0 -#define AR_SREV_REVISION_9580_10 4 /* AR9580 1.0 */ -#define AR_SREV_VERSION_9462 0x280 -#define AR_SREV_REVISION_9462_20 2 -#define AR_SREV_VERSION_9565 0x2C0 -#define AR_SREV_REVISION_9565_10 0 -#define AR_SREV_VERSION_9550 0x400 - -#define AR_SREV_5416(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_5416_PCI) || \ - ((_ah)->hw_version.macVersion == AR_SREV_VERSION_5416_PCIE)) -#define AR_SREV_5416_22_OR_LATER(_ah) \ - (((AR_SREV_5416(_ah)) && \ - ((_ah)->hw_version.macRev >= AR_SREV_REVISION_5416_22)) || \ - ((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9100)) - -#define AR_SREV_9100(ah) \ - ((ah->hw_version.macVersion) == AR_SREV_VERSION_9100) -#define AR_SREV_9100_OR_LATER(_ah) \ - (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9100)) - -#define AR_SREV_9160(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9160)) -#define AR_SREV_9160_10_OR_LATER(_ah) \ - (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9160)) -#define AR_SREV_9160_11(_ah) \ - (AR_SREV_9160(_ah) && \ - ((_ah)->hw_version.macRev == AR_SREV_REVISION_9160_11)) -#define AR_SREV_9280(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9280)) -#define AR_SREV_9280_20_OR_LATER(_ah) \ - (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9280)) -#define AR_SREV_9280_20(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9280)) - -#define AR_SREV_9285(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9285)) -#define AR_SREV_9285_12_OR_LATER(_ah) \ - (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9285)) - -#define AR_SREV_9287(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9287)) -#define AR_SREV_9287_11_OR_LATER(_ah) \ - (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9287)) -#define AR_SREV_9287_11(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9287) && \ - ((_ah)->hw_version.macRev == AR_SREV_REVISION_9287_11)) -#define AR_SREV_9287_12(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9287) && \ - ((_ah)->hw_version.macRev == AR_SREV_REVISION_9287_12)) -#define AR_SREV_9287_12_OR_LATER(_ah) \ - (((_ah)->hw_version.macVersion > AR_SREV_VERSION_9287) || \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9287) && \ - ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9287_12))) -#define AR_SREV_9287_13_OR_LATER(_ah) \ - (((_ah)->hw_version.macVersion > AR_SREV_VERSION_9287) || \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9287) && \ - ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9287_13))) - -#define AR_SREV_9271(_ah) \ - (((_ah))->hw_version.macVersion == AR_SREV_VERSION_9271) -#define AR_SREV_9271_10(_ah) \ - (AR_SREV_9271(_ah) && \ - ((_ah)->hw_version.macRev == AR_SREV_REVISION_9271_10)) -#define AR_SREV_9271_11(_ah) \ - (AR_SREV_9271(_ah) && \ - ((_ah)->hw_version.macRev == AR_SREV_REVISION_9271_11)) - -#define AR_SREV_9300(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9300)) -#define AR_SREV_9300_20_OR_LATER(_ah) \ - ((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9300) -#define AR_SREV_9300_22(_ah) \ - (AR_SREV_9300(ah) && \ - ((_ah)->hw_version.macRev == AR_SREV_REVISION_9300_22)) - -#define AR_SREV_9330(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9330)) -#define AR_SREV_9330_10(_ah) \ - (AR_SREV_9330((_ah)) && \ - ((_ah)->hw_version.macRev == AR_SREV_REVISION_9330_10)) -#define AR_SREV_9330_11(_ah) \ - (AR_SREV_9330((_ah)) && \ - ((_ah)->hw_version.macRev == AR_SREV_REVISION_9330_11)) -#define AR_SREV_9330_12(_ah) \ - (AR_SREV_9330((_ah)) && \ - ((_ah)->hw_version.macRev == AR_SREV_REVISION_9330_12)) - -#define AR_SREV_9485(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485)) -#define AR_SREV_9485_11(_ah) \ - (AR_SREV_9485(_ah) && \ - ((_ah)->hw_version.macRev == AR_SREV_REVISION_9485_11)) -#define AR_SREV_9485_OR_LATER(_ah) \ - (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9485)) - -#define AR_SREV_9340(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9340)) - -#define AR_SREV_9340_13_OR_LATER(_ah) \ - (AR_SREV_9340((_ah)) && \ - ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9340_13)) - -#define AR_SREV_9285E_20(_ah) \ - (AR_SREV_9285_12_OR_LATER(_ah) && \ - ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1)) - -#define AR_SREV_9462(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462)) - -#define AR_SREV_9462_20(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \ - ((_ah)->hw_version.macRev == AR_SREV_REVISION_9462_20)) - -#define AR_SREV_9565(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565)) - -#define AR_SREV_9565_10(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \ - ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_10)) - -#define AR_SREV_9550(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9550)) - -#define AR_SREV_9580(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9580) && \ - ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9580_10)) - -#define AR_SREV_9580_10(_ah) \ - (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9580) && \ - ((_ah)->hw_version.macRev == AR_SREV_REVISION_9580_10)) - -/* NOTE: When adding chips newer than Peacock, add chip check here */ -#define AR_SREV_9580_10_OR_LATER(_ah) \ - (AR_SREV_9580(_ah)) - -enum ath_usb_dev { - AR9280_USB = 1, /* AR7010 + AR9280, UB94 */ - AR9287_USB = 2, /* AR7010 + AR9287, UB95 */ - STORAGE_DEVICE = 3, -}; - -#define AR_DEVID_7010(_ah) \ - (((_ah)->hw_version.usbdev == AR9280_USB) || \ - ((_ah)->hw_version.usbdev == AR9287_USB)) - -#define AR_RADIO_SREV_MAJOR 0xf0 -#define AR_RAD5133_SREV_MAJOR 0xc0 -#define AR_RAD2133_SREV_MAJOR 0xd0 -#define AR_RAD5122_SREV_MAJOR 0xe0 -#define AR_RAD2122_SREV_MAJOR 0xf0 - -#define AR_AHB_MODE 0x4024 -#define AR_AHB_EXACT_WR_EN 0x00000000 -#define AR_AHB_BUF_WR_EN 0x00000001 -#define AR_AHB_EXACT_RD_EN 0x00000000 -#define AR_AHB_CACHELINE_RD_EN 0x00000002 -#define AR_AHB_PREFETCH_RD_EN 0x00000004 -#define AR_AHB_PAGE_SIZE_1K 0x00000000 -#define AR_AHB_PAGE_SIZE_2K 0x00000008 -#define AR_AHB_PAGE_SIZE_4K 0x00000010 -#define AR_AHB_CUSTOM_BURST_EN 0x000000C0 -#define AR_AHB_CUSTOM_BURST_EN_S 6 -#define AR_AHB_CUSTOM_BURST_ASYNC_FIFO_VAL 3 - -#define AR_INTR_RTC_IRQ 0x00000001 -#define AR_INTR_MAC_IRQ 0x00000002 -#define AR_INTR_EEP_PROT_ACCESS 0x00000004 -#define AR_INTR_MAC_AWAKE 0x00020000 -#define AR_INTR_MAC_ASLEEP 0x00040000 -#define AR_INTR_SPURIOUS 0xFFFFFFFF - - -#define AR_INTR_SYNC_CAUSE (AR_SREV_9340(ah) ? 0x4010 : 0x4028) -#define AR_INTR_SYNC_CAUSE_CLR (AR_SREV_9340(ah) ? 0x4010 : 0x4028) - - -#define AR_INTR_SYNC_ENABLE (AR_SREV_9340(ah) ? 0x4014 : 0x402c) -#define AR_INTR_SYNC_ENABLE_GPIO 0xFFFC0000 -#define AR_INTR_SYNC_ENABLE_GPIO_S 18 - -enum { - AR_INTR_SYNC_RTC_IRQ = 0x00000001, - AR_INTR_SYNC_MAC_IRQ = 0x00000002, - AR_INTR_SYNC_EEPROM_ILLEGAL_ACCESS = 0x00000004, - AR_INTR_SYNC_APB_TIMEOUT = 0x00000008, - AR_INTR_SYNC_PCI_MODE_CONFLICT = 0x00000010, - AR_INTR_SYNC_HOST1_FATAL = 0x00000020, - AR_INTR_SYNC_HOST1_PERR = 0x00000040, - AR_INTR_SYNC_TRCV_FIFO_PERR = 0x00000080, - AR_INTR_SYNC_RADM_CPL_EP = 0x00000100, - AR_INTR_SYNC_RADM_CPL_DLLP_ABORT = 0x00000200, - AR_INTR_SYNC_RADM_CPL_TLP_ABORT = 0x00000400, - AR_INTR_SYNC_RADM_CPL_ECRC_ERR = 0x00000800, - AR_INTR_SYNC_RADM_CPL_TIMEOUT = 0x00001000, - AR_INTR_SYNC_LOCAL_TIMEOUT = 0x00002000, - AR_INTR_SYNC_PM_ACCESS = 0x00004000, - AR_INTR_SYNC_MAC_AWAKE = 0x00008000, - AR_INTR_SYNC_MAC_ASLEEP = 0x00010000, - AR_INTR_SYNC_MAC_SLEEP_ACCESS = 0x00020000, - AR_INTR_SYNC_ALL = 0x0003FFFF, - - - AR_INTR_SYNC_DEFAULT = (AR_INTR_SYNC_HOST1_FATAL | - AR_INTR_SYNC_HOST1_PERR | - AR_INTR_SYNC_RADM_CPL_EP | - AR_INTR_SYNC_RADM_CPL_DLLP_ABORT | - AR_INTR_SYNC_RADM_CPL_TLP_ABORT | - AR_INTR_SYNC_RADM_CPL_ECRC_ERR | - AR_INTR_SYNC_RADM_CPL_TIMEOUT | - AR_INTR_SYNC_LOCAL_TIMEOUT | - AR_INTR_SYNC_MAC_SLEEP_ACCESS), - - AR9340_INTR_SYNC_LOCAL_TIMEOUT = 0x00000010, - - AR_INTR_SYNC_SPURIOUS = 0xFFFFFFFF, - -}; - -#define AR_INTR_ASYNC_MASK (AR_SREV_9340(ah) ? 0x4018 : 0x4030) -#define AR_INTR_ASYNC_MASK_GPIO 0xFFFC0000 -#define AR_INTR_ASYNC_MASK_GPIO_S 18 -#define AR_INTR_ASYNC_MASK_MCI 0x00000080 -#define AR_INTR_ASYNC_MASK_MCI_S 7 - -#define AR_INTR_SYNC_MASK (AR_SREV_9340(ah) ? 0x401c : 0x4034) -#define AR_INTR_SYNC_MASK_GPIO 0xFFFC0000 -#define AR_INTR_SYNC_MASK_GPIO_S 18 - -#define AR_INTR_ASYNC_CAUSE_CLR (AR_SREV_9340(ah) ? 0x4020 : 0x4038) -#define AR_INTR_ASYNC_CAUSE (AR_SREV_9340(ah) ? 0x4020 : 0x4038) -#define AR_INTR_ASYNC_CAUSE_MCI 0x00000080 -#define AR_INTR_ASYNC_USED (AR_INTR_MAC_IRQ | \ - AR_INTR_ASYNC_CAUSE_MCI) - -/* Asynchronous Interrupt Enable Register */ -#define AR_INTR_ASYNC_ENABLE_MCI 0x00000080 -#define AR_INTR_ASYNC_ENABLE_MCI_S 7 - - -#define AR_INTR_ASYNC_ENABLE (AR_SREV_9340(ah) ? 0x4024 : 0x403c) -#define AR_INTR_ASYNC_ENABLE_GPIO 0xFFFC0000 -#define AR_INTR_ASYNC_ENABLE_GPIO_S 18 - -#define AR_PCIE_SERDES 0x4040 -#define AR_PCIE_SERDES2 0x4044 -#define AR_PCIE_PM_CTRL (AR_SREV_9340(ah) ? 0x4004 : 0x4014) -#define AR_PCIE_PM_CTRL_ENA 0x00080000 - -#define AR_PCIE_PHY_REG3 0x18c08 - -#define AR_NUM_GPIO 14 -#define AR928X_NUM_GPIO 10 -#define AR9285_NUM_GPIO 12 -#define AR9287_NUM_GPIO 11 -#define AR9271_NUM_GPIO 16 -#define AR9300_NUM_GPIO 17 -#define AR7010_NUM_GPIO 16 - -#define AR_GPIO_IN_OUT (AR_SREV_9340(ah) ? 0x4028 : 0x4048) -#define AR_GPIO_IN_VAL 0x0FFFC000 -#define AR_GPIO_IN_VAL_S 14 -#define AR928X_GPIO_IN_VAL 0x000FFC00 -#define AR928X_GPIO_IN_VAL_S 10 -#define AR9285_GPIO_IN_VAL 0x00FFF000 -#define AR9285_GPIO_IN_VAL_S 12 -#define AR9287_GPIO_IN_VAL 0x003FF800 -#define AR9287_GPIO_IN_VAL_S 11 -#define AR9271_GPIO_IN_VAL 0xFFFF0000 -#define AR9271_GPIO_IN_VAL_S 16 -#define AR7010_GPIO_IN_VAL 0x0000FFFF -#define AR7010_GPIO_IN_VAL_S 0 - -#define AR_GPIO_IN (AR_SREV_9340(ah) ? 0x402c : 0x404c) -#define AR9300_GPIO_IN_VAL 0x0001FFFF -#define AR9300_GPIO_IN_VAL_S 0 - -#define AR_GPIO_OE_OUT (AR_SREV_9340(ah) ? 0x4030 : \ - (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c)) -#define AR_GPIO_OE_OUT_DRV 0x3 -#define AR_GPIO_OE_OUT_DRV_NO 0x0 -#define AR_GPIO_OE_OUT_DRV_LOW 0x1 -#define AR_GPIO_OE_OUT_DRV_HI 0x2 -#define AR_GPIO_OE_OUT_DRV_ALL 0x3 - -#define AR7010_GPIO_OE 0x52000 -#define AR7010_GPIO_OE_MASK 0x1 -#define AR7010_GPIO_OE_AS_OUTPUT 0x0 -#define AR7010_GPIO_OE_AS_INPUT 0x1 -#define AR7010_GPIO_IN 0x52004 -#define AR7010_GPIO_OUT 0x52008 -#define AR7010_GPIO_SET 0x5200C -#define AR7010_GPIO_CLEAR 0x52010 -#define AR7010_GPIO_INT 0x52014 -#define AR7010_GPIO_INT_TYPE 0x52018 -#define AR7010_GPIO_INT_POLARITY 0x5201C -#define AR7010_GPIO_PENDING 0x52020 -#define AR7010_GPIO_INT_MASK 0x52024 -#define AR7010_GPIO_FUNCTION 0x52028 - -#define AR_GPIO_INTR_POL (AR_SREV_9340(ah) ? 0x4038 : \ - (AR_SREV_9300_20_OR_LATER(ah) ? 0x4058 : 0x4050)) -#define AR_GPIO_INTR_POL_VAL 0x0001FFFF -#define AR_GPIO_INTR_POL_VAL_S 0 - -#define AR_GPIO_INPUT_EN_VAL (AR_SREV_9340(ah) ? 0x403c : \ - (AR_SREV_9300_20_OR_LATER(ah) ? 0x405c : 0x4054)) -#define AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF 0x00000004 -#define AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_S 2 -#define AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_DEF 0x00000008 -#define AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_S 3 -#define AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_DEF 0x00000010 -#define AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_S 4 -#define AR_GPIO_INPUT_EN_VAL_RFSILENT_DEF 0x00000080 -#define AR_GPIO_INPUT_EN_VAL_RFSILENT_DEF_S 7 -#define AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB 0x00000400 -#define AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB_S 10 -#define AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB 0x00001000 -#define AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB_S 12 -#define AR_GPIO_INPUT_EN_VAL_RFSILENT_BB 0x00008000 -#define AR_GPIO_INPUT_EN_VAL_RFSILENT_BB_S 15 -#define AR_GPIO_RTC_RESET_OVERRIDE_ENABLE 0x00010000 -#define AR_GPIO_JTAG_DISABLE 0x00020000 - -#define AR_GPIO_INPUT_MUX1 (AR_SREV_9340(ah) ? 0x4040 : \ - (AR_SREV_9300_20_OR_LATER(ah) ? 0x4060 : 0x4058)) -#define AR_GPIO_INPUT_MUX1_BT_ACTIVE 0x000f0000 -#define AR_GPIO_INPUT_MUX1_BT_ACTIVE_S 16 -#define AR_GPIO_INPUT_MUX1_BT_PRIORITY 0x00000f00 -#define AR_GPIO_INPUT_MUX1_BT_PRIORITY_S 8 - -#define AR_GPIO_INPUT_MUX2 (AR_SREV_9340(ah) ? 0x4044 : \ - (AR_SREV_9300_20_OR_LATER(ah) ? 0x4064 : 0x405c)) -#define AR_GPIO_INPUT_MUX2_CLK25 0x0000000f -#define AR_GPIO_INPUT_MUX2_CLK25_S 0 -#define AR_GPIO_INPUT_MUX2_RFSILENT 0x000000f0 -#define AR_GPIO_INPUT_MUX2_RFSILENT_S 4 -#define AR_GPIO_INPUT_MUX2_RTC_RESET 0x00000f00 -#define AR_GPIO_INPUT_MUX2_RTC_RESET_S 8 - -#define AR_GPIO_OUTPUT_MUX1 (AR_SREV_9340(ah) ? 0x4048 : \ - (AR_SREV_9300_20_OR_LATER(ah) ? 0x4068 : 0x4060)) -#define AR_GPIO_OUTPUT_MUX2 (AR_SREV_9340(ah) ? 0x404c : \ - (AR_SREV_9300_20_OR_LATER(ah) ? 0x406c : 0x4064)) -#define AR_GPIO_OUTPUT_MUX3 (AR_SREV_9340(ah) ? 0x4050 : \ - (AR_SREV_9300_20_OR_LATER(ah) ? 0x4070 : 0x4068)) - -#define AR_INPUT_STATE (AR_SREV_9340(ah) ? 0x4054 : \ - (AR_SREV_9300_20_OR_LATER(ah) ? 0x4074 : 0x406c)) - -#define AR_EEPROM_STATUS_DATA (AR_SREV_9340(ah) ? 0x40c8 : \ - (AR_SREV_9300_20_OR_LATER(ah) ? 0x4084 : 0x407c)) -#define AR_EEPROM_STATUS_DATA_VAL 0x0000ffff -#define AR_EEPROM_STATUS_DATA_VAL_S 0 -#define AR_EEPROM_STATUS_DATA_BUSY 0x00010000 -#define AR_EEPROM_STATUS_DATA_BUSY_ACCESS 0x00020000 -#define AR_EEPROM_STATUS_DATA_PROT_ACCESS 0x00040000 -#define AR_EEPROM_STATUS_DATA_ABSENT_ACCESS 0x00080000 - -#define AR_OBS (AR_SREV_9340(ah) ? 0x405c : \ - (AR_SREV_9300_20_OR_LATER(ah) ? 0x4088 : 0x4080)) - -#define AR_GPIO_PDPU (AR_SREV_9300_20_OR_LATER(ah) ? 0x4090 : 0x4088) - -#define AR_PCIE_MSI (AR_SREV_9340(ah) ? 0x40d8 : \ - (AR_SREV_9300_20_OR_LATER(ah) ? 0x40a4 : 0x4094)) -#define AR_PCIE_MSI_ENABLE 0x00000001 - -#define AR_INTR_PRIO_SYNC_ENABLE (AR_SREV_9340(ah) ? 0x4088 : 0x40c4) -#define AR_INTR_PRIO_ASYNC_MASK (AR_SREV_9340(ah) ? 0x408c : 0x40c8) -#define AR_INTR_PRIO_SYNC_MASK (AR_SREV_9340(ah) ? 0x4090 : 0x40cc) -#define AR_INTR_PRIO_ASYNC_ENABLE (AR_SREV_9340(ah) ? 0x4094 : 0x40d4) -#define AR_ENT_OTP 0x40d8 -#define AR_ENT_OTP_CHAIN2_DISABLE 0x00020000 -#define AR_ENT_OTP_49GHZ_DISABLE 0x00100000 -#define AR_ENT_OTP_MIN_PKT_SIZE_DISABLE 0x00800000 - -#define AR_CH0_BB_DPLL1 0x16180 -#define AR_CH0_BB_DPLL1_REFDIV 0xF8000000 -#define AR_CH0_BB_DPLL1_REFDIV_S 27 -#define AR_CH0_BB_DPLL1_NINI 0x07FC0000 -#define AR_CH0_BB_DPLL1_NINI_S 18 -#define AR_CH0_BB_DPLL1_NFRAC 0x0003FFFF -#define AR_CH0_BB_DPLL1_NFRAC_S 0 - -#define AR_CH0_BB_DPLL2 0x16184 -#define AR_CH0_BB_DPLL2_LOCAL_PLL 0x40000000 -#define AR_CH0_BB_DPLL2_LOCAL_PLL_S 30 -#define AR_CH0_DPLL2_KI 0x3C000000 -#define AR_CH0_DPLL2_KI_S 26 -#define AR_CH0_DPLL2_KD 0x03F80000 -#define AR_CH0_DPLL2_KD_S 19 -#define AR_CH0_BB_DPLL2_EN_NEGTRIG 0x00040000 -#define AR_CH0_BB_DPLL2_EN_NEGTRIG_S 18 -#define AR_CH0_BB_DPLL2_PLL_PWD 0x00010000 -#define AR_CH0_BB_DPLL2_PLL_PWD_S 16 -#define AR_CH0_BB_DPLL2_OUTDIV 0x0000E000 -#define AR_CH0_BB_DPLL2_OUTDIV_S 13 - -#define AR_CH0_BB_DPLL3 0x16188 -#define AR_CH0_BB_DPLL3_PHASE_SHIFT 0x3F800000 -#define AR_CH0_BB_DPLL3_PHASE_SHIFT_S 23 - -#define AR_CH0_DDR_DPLL2 0x16244 -#define AR_CH0_DDR_DPLL3 0x16248 -#define AR_CH0_DPLL3_PHASE_SHIFT 0x3F800000 -#define AR_CH0_DPLL3_PHASE_SHIFT_S 23 -#define AR_PHY_CCA_NOM_VAL_2GHZ -118 - -#define AR_RTC_9300_PLL_DIV 0x000003ff -#define AR_RTC_9300_PLL_DIV_S 0 -#define AR_RTC_9300_PLL_REFDIV 0x00003C00 -#define AR_RTC_9300_PLL_REFDIV_S 10 -#define AR_RTC_9300_PLL_CLKSEL 0x0000C000 -#define AR_RTC_9300_PLL_CLKSEL_S 14 - -#define AR_RTC_9160_PLL_DIV 0x000003ff -#define AR_RTC_9160_PLL_DIV_S 0 -#define AR_RTC_9160_PLL_REFDIV 0x00003C00 -#define AR_RTC_9160_PLL_REFDIV_S 10 -#define AR_RTC_9160_PLL_CLKSEL 0x0000C000 -#define AR_RTC_9160_PLL_CLKSEL_S 14 - -#define AR_RTC_BASE 0x00020000 -#define AR_RTC_RC \ - ((AR_SREV_9100(ah)) ? (AR_RTC_BASE + 0x0000) : 0x7000) -#define AR_RTC_RC_M 0x00000003 -#define AR_RTC_RC_MAC_WARM 0x00000001 -#define AR_RTC_RC_MAC_COLD 0x00000002 -#define AR_RTC_RC_COLD_RESET 0x00000004 -#define AR_RTC_RC_WARM_RESET 0x00000008 - -/* Crystal Control */ -#define AR_RTC_XTAL_CONTROL 0x7004 - -/* Reg Control 0 */ -#define AR_RTC_REG_CONTROL0 0x7008 - -/* Reg Control 1 */ -#define AR_RTC_REG_CONTROL1 0x700c -#define AR_RTC_REG_CONTROL1_SWREG_PROGRAM 0x00000001 - -#define AR_RTC_PLL_CONTROL \ - ((AR_SREV_9100(ah)) ? (AR_RTC_BASE + 0x0014) : 0x7014) - -#define AR_RTC_PLL_CONTROL2 0x703c - -#define AR_RTC_PLL_DIV 0x0000001f -#define AR_RTC_PLL_DIV_S 0 -#define AR_RTC_PLL_DIV2 0x00000020 -#define AR_RTC_PLL_REFDIV_5 0x000000c0 -#define AR_RTC_PLL_CLKSEL 0x00000300 -#define AR_RTC_PLL_CLKSEL_S 8 -#define AR_RTC_PLL_BYPASS 0x00010000 -#define AR_RTC_PLL_NOPWD 0x00040000 -#define AR_RTC_PLL_NOPWD_S 18 - -#define PLL3 0x16188 -#define PLL3_DO_MEAS_MASK 0x40000000 -#define PLL4 0x1618c -#define PLL4_MEAS_DONE 0x8 -#define SQSUM_DVC_MASK 0x007ffff8 - -#define AR_RTC_RESET \ - ((AR_SREV_9100(ah)) ? (AR_RTC_BASE + 0x0040) : 0x7040) -#define AR_RTC_RESET_EN (0x00000001) - -#define AR_RTC_STATUS \ - ((AR_SREV_9100(ah)) ? (AR_RTC_BASE + 0x0044) : 0x7044) - -#define AR_RTC_STATUS_M \ - ((AR_SREV_9100(ah)) ? 0x0000003f : 0x0000000f) - -#define AR_RTC_PM_STATUS_M 0x0000000f - -#define AR_RTC_STATUS_SHUTDOWN 0x00000001 -#define AR_RTC_STATUS_ON 0x00000002 -#define AR_RTC_STATUS_SLEEP 0x00000004 -#define AR_RTC_STATUS_WAKEUP 0x00000008 - -#define AR_RTC_SLEEP_CLK \ - ((AR_SREV_9100(ah)) ? (AR_RTC_BASE + 0x0048) : 0x7048) -#define AR_RTC_FORCE_DERIVED_CLK 0x2 -#define AR_RTC_FORCE_SWREG_PRD 0x00000004 - -#define AR_RTC_FORCE_WAKE \ - ((AR_SREV_9100(ah)) ? (AR_RTC_BASE + 0x004c) : 0x704c) -#define AR_RTC_FORCE_WAKE_EN 0x00000001 -#define AR_RTC_FORCE_WAKE_ON_INT 0x00000002 - - -#define AR_RTC_INTR_CAUSE \ - ((AR_SREV_9100(ah)) ? (AR_RTC_BASE + 0x0050) : 0x7050) - -#define AR_RTC_INTR_ENABLE \ - ((AR_SREV_9100(ah)) ? (AR_RTC_BASE + 0x0054) : 0x7054) - -#define AR_RTC_INTR_MASK \ - ((AR_SREV_9100(ah)) ? (AR_RTC_BASE + 0x0058) : 0x7058) - -#define AR_RTC_KEEP_AWAKE 0x7034 - -/* RTC_DERIVED_* - only for AR9100 */ - -#define AR_RTC_DERIVED_CLK \ - (AR_SREV_9100(ah) ? (AR_RTC_BASE + 0x0038) : 0x7038) -#define AR_RTC_DERIVED_CLK_PERIOD 0x0000fffe -#define AR_RTC_DERIVED_CLK_PERIOD_S 1 - -#define AR_SEQ_MASK 0x8060 - -#define AR_AN_RF2G1_CH0 0x7810 -#define AR_AN_RF2G1_CH0_OB 0x03800000 -#define AR_AN_RF2G1_CH0_OB_S 23 -#define AR_AN_RF2G1_CH0_DB 0x1C000000 -#define AR_AN_RF2G1_CH0_DB_S 26 - -#define AR_AN_RF5G1_CH0 0x7818 -#define AR_AN_RF5G1_CH0_OB5 0x00070000 -#define AR_AN_RF5G1_CH0_OB5_S 16 -#define AR_AN_RF5G1_CH0_DB5 0x00380000 -#define AR_AN_RF5G1_CH0_DB5_S 19 - -#define AR_AN_RF2G1_CH1 0x7834 -#define AR_AN_RF2G1_CH1_OB 0x03800000 -#define AR_AN_RF2G1_CH1_OB_S 23 -#define AR_AN_RF2G1_CH1_DB 0x1C000000 -#define AR_AN_RF2G1_CH1_DB_S 26 - -#define AR_AN_RF5G1_CH1 0x783C -#define AR_AN_RF5G1_CH1_OB5 0x00070000 -#define AR_AN_RF5G1_CH1_OB5_S 16 -#define AR_AN_RF5G1_CH1_DB5 0x00380000 -#define AR_AN_RF5G1_CH1_DB5_S 19 - -#define AR_AN_TOP1 0x7890 -#define AR_AN_TOP1_DACIPMODE 0x00040000 -#define AR_AN_TOP1_DACIPMODE_S 18 - -#define AR_AN_TOP2 0x7894 -#define AR_AN_TOP2_XPABIAS_LVL 0xC0000000 -#define AR_AN_TOP2_XPABIAS_LVL_S 30 -#define AR_AN_TOP2_LOCALBIAS 0x00200000 -#define AR_AN_TOP2_LOCALBIAS_S 21 -#define AR_AN_TOP2_PWDCLKIND 0x00400000 -#define AR_AN_TOP2_PWDCLKIND_S 22 - -#define AR_AN_SYNTH9 0x7868 -#define AR_AN_SYNTH9_REFDIVA 0xf8000000 -#define AR_AN_SYNTH9_REFDIVA_S 27 - -#define AR9285_AN_RF2G1 0x7820 -#define AR9285_AN_RF2G1_ENPACAL 0x00000800 -#define AR9285_AN_RF2G1_ENPACAL_S 11 -#define AR9285_AN_RF2G1_PDPADRV1 0x02000000 -#define AR9285_AN_RF2G1_PDPADRV1_S 25 -#define AR9285_AN_RF2G1_PDPADRV2 0x01000000 -#define AR9285_AN_RF2G1_PDPADRV2_S 24 -#define AR9285_AN_RF2G1_PDPAOUT 0x00800000 -#define AR9285_AN_RF2G1_PDPAOUT_S 23 - - -#define AR9285_AN_RF2G2 0x7824 -#define AR9285_AN_RF2G2_OFFCAL 0x00001000 -#define AR9285_AN_RF2G2_OFFCAL_S 12 - -#define AR9285_AN_RF2G3 0x7828 -#define AR9285_AN_RF2G3_PDVCCOMP 0x02000000 -#define AR9285_AN_RF2G3_PDVCCOMP_S 25 -#define AR9285_AN_RF2G3_OB_0 0x00E00000 -#define AR9285_AN_RF2G3_OB_0_S 21 -#define AR9285_AN_RF2G3_OB_1 0x001C0000 -#define AR9285_AN_RF2G3_OB_1_S 18 -#define AR9285_AN_RF2G3_OB_2 0x00038000 -#define AR9285_AN_RF2G3_OB_2_S 15 -#define AR9285_AN_RF2G3_OB_3 0x00007000 -#define AR9285_AN_RF2G3_OB_3_S 12 -#define AR9285_AN_RF2G3_OB_4 0x00000E00 -#define AR9285_AN_RF2G3_OB_4_S 9 - -#define AR9285_AN_RF2G3_DB1_0 0x000001C0 -#define AR9285_AN_RF2G3_DB1_0_S 6 -#define AR9285_AN_RF2G3_DB1_1 0x00000038 -#define AR9285_AN_RF2G3_DB1_1_S 3 -#define AR9285_AN_RF2G3_DB1_2 0x00000007 -#define AR9285_AN_RF2G3_DB1_2_S 0 -#define AR9285_AN_RF2G4 0x782C -#define AR9285_AN_RF2G4_DB1_3 0xE0000000 -#define AR9285_AN_RF2G4_DB1_3_S 29 -#define AR9285_AN_RF2G4_DB1_4 0x1C000000 -#define AR9285_AN_RF2G4_DB1_4_S 26 - -#define AR9285_AN_RF2G4_DB2_0 0x03800000 -#define AR9285_AN_RF2G4_DB2_0_S 23 -#define AR9285_AN_RF2G4_DB2_1 0x00700000 -#define AR9285_AN_RF2G4_DB2_1_S 20 -#define AR9285_AN_RF2G4_DB2_2 0x000E0000 -#define AR9285_AN_RF2G4_DB2_2_S 17 -#define AR9285_AN_RF2G4_DB2_3 0x0001C000 -#define AR9285_AN_RF2G4_DB2_3_S 14 -#define AR9285_AN_RF2G4_DB2_4 0x00003800 -#define AR9285_AN_RF2G4_DB2_4_S 11 - -#define AR9285_RF2G5 0x7830 -#define AR9285_RF2G5_IC50TX 0xfffff8ff -#define AR9285_RF2G5_IC50TX_SET 0x00000400 -#define AR9285_RF2G5_IC50TX_XE_SET 0x00000500 -#define AR9285_RF2G5_IC50TX_CLEAR 0x00000700 -#define AR9285_RF2G5_IC50TX_CLEAR_S 8 - -/* AR9271 : 0x7828, 0x782c different setting from AR9285 */ -#define AR9271_AN_RF2G3_OB_cck 0x001C0000 -#define AR9271_AN_RF2G3_OB_cck_S 18 -#define AR9271_AN_RF2G3_OB_psk 0x00038000 -#define AR9271_AN_RF2G3_OB_psk_S 15 -#define AR9271_AN_RF2G3_OB_qam 0x00007000 -#define AR9271_AN_RF2G3_OB_qam_S 12 - -#define AR9271_AN_RF2G3_DB_1 0x00E00000 -#define AR9271_AN_RF2G3_DB_1_S 21 - -#define AR9271_AN_RF2G3_CCOMP 0xFFF -#define AR9271_AN_RF2G3_CCOMP_S 0 - -#define AR9271_AN_RF2G4_DB_2 0xE0000000 -#define AR9271_AN_RF2G4_DB_2_S 29 - -#define AR9285_AN_RF2G6 0x7834 -#define AR9285_AN_RF2G6_CCOMP 0x00007800 -#define AR9285_AN_RF2G6_CCOMP_S 11 -#define AR9285_AN_RF2G6_OFFS 0x03f00000 -#define AR9285_AN_RF2G6_OFFS_S 20 - -#define AR9271_AN_RF2G6_OFFS 0x07f00000 -#define AR9271_AN_RF2G6_OFFS_S 20 - -#define AR9285_AN_RF2G7 0x7838 -#define AR9285_AN_RF2G7_PWDDB 0x00000002 -#define AR9285_AN_RF2G7_PWDDB_S 1 -#define AR9285_AN_RF2G7_PADRVGN2TAB0 0xE0000000 -#define AR9285_AN_RF2G7_PADRVGN2TAB0_S 29 - -#define AR9285_AN_RF2G8 0x783C -#define AR9285_AN_RF2G8_PADRVGN2TAB0 0x0001C000 -#define AR9285_AN_RF2G8_PADRVGN2TAB0_S 14 - - -#define AR9285_AN_RF2G9 0x7840 -#define AR9285_AN_RXTXBB1 0x7854 -#define AR9285_AN_RXTXBB1_PDRXTXBB1 0x00000020 -#define AR9285_AN_RXTXBB1_PDRXTXBB1_S 5 -#define AR9285_AN_RXTXBB1_PDV2I 0x00000080 -#define AR9285_AN_RXTXBB1_PDV2I_S 7 -#define AR9285_AN_RXTXBB1_PDDACIF 0x00000100 -#define AR9285_AN_RXTXBB1_PDDACIF_S 8 -#define AR9285_AN_RXTXBB1_SPARE9 0x00000001 -#define AR9285_AN_RXTXBB1_SPARE9_S 0 - -#define AR9285_AN_TOP2 0x7868 - -#define AR9285_AN_TOP3 0x786c -#define AR9285_AN_TOP3_XPABIAS_LVL 0x0000000C -#define AR9285_AN_TOP3_XPABIAS_LVL_S 2 -#define AR9285_AN_TOP3_PWDDAC 0x00800000 -#define AR9285_AN_TOP3_PWDDAC_S 23 - -#define AR9285_AN_TOP4 0x7870 -#define AR9285_AN_TOP4_DEFAULT 0x10142c00 - -#define AR9287_AN_RF2G3_CH0 0x7808 -#define AR9287_AN_RF2G3_CH1 0x785c -#define AR9287_AN_RF2G3_DB1 0xE0000000 -#define AR9287_AN_RF2G3_DB1_S 29 -#define AR9287_AN_RF2G3_DB2 0x1C000000 -#define AR9287_AN_RF2G3_DB2_S 26 -#define AR9287_AN_RF2G3_OB_CCK 0x03800000 -#define AR9287_AN_RF2G3_OB_CCK_S 23 -#define AR9287_AN_RF2G3_OB_PSK 0x00700000 -#define AR9287_AN_RF2G3_OB_PSK_S 20 -#define AR9287_AN_RF2G3_OB_QAM 0x000E0000 -#define AR9287_AN_RF2G3_OB_QAM_S 17 -#define AR9287_AN_RF2G3_OB_PAL_OFF 0x0001C000 -#define AR9287_AN_RF2G3_OB_PAL_OFF_S 14 - -#define AR9287_AN_TXPC0 0x7898 -#define AR9287_AN_TXPC0_TXPCMODE 0x0000C000 -#define AR9287_AN_TXPC0_TXPCMODE_S 14 -#define AR9287_AN_TXPC0_TXPCMODE_NORMAL 0 -#define AR9287_AN_TXPC0_TXPCMODE_TEST 1 -#define AR9287_AN_TXPC0_TXPCMODE_TEMPSENSE 2 -#define AR9287_AN_TXPC0_TXPCMODE_ATBTEST 3 - -#define AR9287_AN_TOP2 0x78b4 -#define AR9287_AN_TOP2_XPABIAS_LVL 0xC0000000 -#define AR9287_AN_TOP2_XPABIAS_LVL_S 30 - -/* AR9271 specific stuff */ -#define AR9271_RESET_POWER_DOWN_CONTROL 0x50044 -#define AR9271_RADIO_RF_RST 0x20 -#define AR9271_GATE_MAC_CTL 0x4000 - -#define AR_STA_ID1_STA_AP 0x00010000 -#define AR_STA_ID1_ADHOC 0x00020000 -#define AR_STA_ID1_PWR_SAV 0x00040000 -#define AR_STA_ID1_KSRCHDIS 0x00080000 -#define AR_STA_ID1_PCF 0x00100000 -#define AR_STA_ID1_USE_DEFANT 0x00200000 -#define AR_STA_ID1_DEFANT_UPDATE 0x00400000 -#define AR_STA_ID1_AR9100_BA_FIX 0x00400000 -#define AR_STA_ID1_RTS_USE_DEF 0x00800000 -#define AR_STA_ID1_ACKCTS_6MB 0x01000000 -#define AR_STA_ID1_BASE_RATE_11B 0x02000000 -#define AR_STA_ID1_SECTOR_SELF_GEN 0x04000000 -#define AR_STA_ID1_CRPT_MIC_ENABLE 0x08000000 -#define AR_STA_ID1_KSRCH_MODE 0x10000000 -#define AR_STA_ID1_PRESERVE_SEQNUM 0x20000000 -#define AR_STA_ID1_CBCIV_ENDIAN 0x40000000 -#define AR_STA_ID1_MCAST_KSRCH 0x80000000 - -#define AR_BSS_ID0 0x8008 -#define AR_BSS_ID1 0x800C -#define AR_BSS_ID1_U16 0x0000FFFF -#define AR_BSS_ID1_AID 0x07FF0000 -#define AR_BSS_ID1_AID_S 16 - -#define AR_BCN_RSSI_AVE 0x8010 -#define AR_BCN_RSSI_AVE_MASK 0x00000FFF - -#define AR_TIME_OUT 0x8014 -#define AR_TIME_OUT_ACK 0x00003FFF -#define AR_TIME_OUT_ACK_S 0 -#define AR_TIME_OUT_CTS 0x3FFF0000 -#define AR_TIME_OUT_CTS_S 16 - -#define AR_RSSI_THR 0x8018 -#define AR_RSSI_THR_MASK 0x000000FF -#define AR_RSSI_THR_BM_THR 0x0000FF00 -#define AR_RSSI_THR_BM_THR_S 8 -#define AR_RSSI_BCN_WEIGHT 0x1F000000 -#define AR_RSSI_BCN_WEIGHT_S 24 -#define AR_RSSI_BCN_RSSI_RST 0x20000000 - -#define AR_USEC 0x801c -#define AR_USEC_USEC 0x0000007F -#define AR_USEC_TX_LAT 0x007FC000 -#define AR_USEC_TX_LAT_S 14 -#define AR_USEC_RX_LAT 0x1F800000 -#define AR_USEC_RX_LAT_S 23 -#define AR_USEC_ASYNC_FIFO 0x12E00074 - -#define AR_RESET_TSF 0x8020 -#define AR_RESET_TSF_ONCE 0x01000000 - -#define AR_MAX_CFP_DUR 0x8038 -#define AR_CFP_VAL 0x0000FFFF - -#define AR_RX_FILTER 0x803C - -#define AR_MCAST_FIL0 0x8040 -#define AR_MCAST_FIL1 0x8044 - -/* - * AR_DIAG_SW - Register which can be used for diagnostics and testing purposes. - * - * The force RX abort (AR_DIAG_RX_ABORT, bit 25) can be used in conjunction with - * RX block (AR_DIAG_RX_DIS, bit 5) to help fast channel change to shut down - * receive. The force RX abort bit will kill any frame which is currently being - * transferred between the MAC and baseband. The RX block bit (AR_DIAG_RX_DIS) - * will prevent any new frames from getting started. - */ -#define AR_DIAG_SW 0x8048 -#define AR_DIAG_CACHE_ACK 0x00000001 -#define AR_DIAG_ACK_DIS 0x00000002 -#define AR_DIAG_CTS_DIS 0x00000004 -#define AR_DIAG_ENCRYPT_DIS 0x00000008 -#define AR_DIAG_DECRYPT_DIS 0x00000010 -#define AR_DIAG_RX_DIS 0x00000020 /* RX block */ -#define AR_DIAG_LOOP_BACK 0x00000040 -#define AR_DIAG_CORR_FCS 0x00000080 -#define AR_DIAG_CHAN_INFO 0x00000100 -#define AR_DIAG_SCRAM_SEED 0x0001FE00 -#define AR_DIAG_SCRAM_SEED_S 8 -#define AR_DIAG_FRAME_NV0 0x00020000 -#define AR_DIAG_OBS_PT_SEL1 0x000C0000 -#define AR_DIAG_OBS_PT_SEL1_S 18 -#define AR_DIAG_OBS_PT_SEL2 0x08000000 -#define AR_DIAG_OBS_PT_SEL2_S 27 -#define AR_DIAG_FORCE_RX_CLEAR 0x00100000 /* force rx_clear high */ -#define AR_DIAG_IGNORE_VIRT_CS 0x00200000 -#define AR_DIAG_FORCE_CH_IDLE_HIGH 0x00400000 -#define AR_DIAG_EIFS_CTRL_ENA 0x00800000 -#define AR_DIAG_DUAL_CHAIN_INFO 0x01000000 -#define AR_DIAG_RX_ABORT 0x02000000 /* Force RX abort */ -#define AR_DIAG_SATURATE_CYCLE_CNT 0x04000000 -#define AR_DIAG_OBS_PT_SEL2 0x08000000 -#define AR_DIAG_RX_CLEAR_CTL_LOW 0x10000000 -#define AR_DIAG_RX_CLEAR_EXT_LOW 0x20000000 - -#define AR_TSF_L32 0x804c -#define AR_TSF_U32 0x8050 - -#define AR_TST_ADDAC 0x8054 -#define AR_DEF_ANTENNA 0x8058 - -#define AR_AES_MUTE_MASK0 0x805c -#define AR_AES_MUTE_MASK0_FC 0x0000FFFF -#define AR_AES_MUTE_MASK0_QOS 0xFFFF0000 -#define AR_AES_MUTE_MASK0_QOS_S 16 - -#define AR_AES_MUTE_MASK1 0x8060 -#define AR_AES_MUTE_MASK1_SEQ 0x0000FFFF -#define AR_AES_MUTE_MASK1_FC_MGMT 0xFFFF0000 -#define AR_AES_MUTE_MASK1_FC_MGMT_S 16 - -#define AR_GATED_CLKS 0x8064 -#define AR_GATED_CLKS_TX 0x00000002 -#define AR_GATED_CLKS_RX 0x00000004 -#define AR_GATED_CLKS_REG 0x00000008 - -#define AR_OBS_BUS_CTRL 0x8068 -#define AR_OBS_BUS_SEL_1 0x00040000 -#define AR_OBS_BUS_SEL_2 0x00080000 -#define AR_OBS_BUS_SEL_3 0x000C0000 -#define AR_OBS_BUS_SEL_4 0x08040000 -#define AR_OBS_BUS_SEL_5 0x08080000 - -#define AR_OBS_BUS_1 0x806c -#define AR_OBS_BUS_1_PCU 0x00000001 -#define AR_OBS_BUS_1_RX_END 0x00000002 -#define AR_OBS_BUS_1_RX_WEP 0x00000004 -#define AR_OBS_BUS_1_RX_BEACON 0x00000008 -#define AR_OBS_BUS_1_RX_FILTER 0x00000010 -#define AR_OBS_BUS_1_TX_HCF 0x00000020 -#define AR_OBS_BUS_1_QUIET_TIME 0x00000040 -#define AR_OBS_BUS_1_CHAN_IDLE 0x00000080 -#define AR_OBS_BUS_1_TX_HOLD 0x00000100 -#define AR_OBS_BUS_1_TX_FRAME 0x00000200 -#define AR_OBS_BUS_1_RX_FRAME 0x00000400 -#define AR_OBS_BUS_1_RX_CLEAR 0x00000800 -#define AR_OBS_BUS_1_WEP_STATE 0x0003F000 -#define AR_OBS_BUS_1_WEP_STATE_S 12 -#define AR_OBS_BUS_1_RX_STATE 0x01F00000 -#define AR_OBS_BUS_1_RX_STATE_S 20 -#define AR_OBS_BUS_1_TX_STATE 0x7E000000 -#define AR_OBS_BUS_1_TX_STATE_S 25 - -#define AR_LAST_TSTP 0x8080 -#define AR_NAV 0x8084 -#define AR_RTS_OK 0x8088 -#define AR_RTS_FAIL 0x808c -#define AR_ACK_FAIL 0x8090 -#define AR_FCS_FAIL 0x8094 -#define AR_BEACON_CNT 0x8098 - -#define AR_SLEEP1 0x80d4 -#define AR_SLEEP1_ASSUME_DTIM 0x00080000 -#define AR_SLEEP1_CAB_TIMEOUT 0xFFE00000 -#define AR_SLEEP1_CAB_TIMEOUT_S 21 - -#define AR_SLEEP2 0x80d8 -#define AR_SLEEP2_BEACON_TIMEOUT 0xFFE00000 -#define AR_SLEEP2_BEACON_TIMEOUT_S 21 - -#define AR_TPC 0x80e8 -#define AR_TPC_ACK 0x0000003f -#define AR_TPC_ACK_S 0 -#define AR_TPC_CTS 0x00003f00 -#define AR_TPC_CTS_S 8 -#define AR_TPC_CHIRP 0x003f0000 -#define AR_TPC_CHIRP_S 16 - -#define AR_QUIET1 0x80fc -#define AR_QUIET1_NEXT_QUIET_S 0 -#define AR_QUIET1_NEXT_QUIET_M 0x0000ffff -#define AR_QUIET1_QUIET_ENABLE 0x00010000 -#define AR_QUIET1_QUIET_ACK_CTS_ENABLE 0x00020000 -#define AR_QUIET1_QUIET_ACK_CTS_ENABLE_S 17 -#define AR_QUIET2 0x8100 -#define AR_QUIET2_QUIET_PERIOD_S 0 -#define AR_QUIET2_QUIET_PERIOD_M 0x0000ffff -#define AR_QUIET2_QUIET_DUR_S 16 -#define AR_QUIET2_QUIET_DUR 0xffff0000 - -#define AR_TSF_PARM 0x8104 -#define AR_TSF_INCREMENT_M 0x000000ff -#define AR_TSF_INCREMENT_S 0x00 - -#define AR_QOS_NO_ACK 0x8108 -#define AR_QOS_NO_ACK_TWO_BIT 0x0000000f -#define AR_QOS_NO_ACK_TWO_BIT_S 0 -#define AR_QOS_NO_ACK_BIT_OFF 0x00000070 -#define AR_QOS_NO_ACK_BIT_OFF_S 4 -#define AR_QOS_NO_ACK_BYTE_OFF 0x00000180 -#define AR_QOS_NO_ACK_BYTE_OFF_S 7 - -#define AR_PHY_ERR 0x810c - -#define AR_PHY_ERR_DCHIRP 0x00000008 -#define AR_PHY_ERR_RADAR 0x00000020 -#define AR_PHY_ERR_OFDM_TIMING 0x00020000 -#define AR_PHY_ERR_CCK_TIMING 0x02000000 - -#define AR_RXFIFO_CFG 0x8114 - - -#define AR_MIC_QOS_CONTROL 0x8118 -#define AR_MIC_QOS_SELECT 0x811c - -#define AR_PCU_MISC 0x8120 -#define AR_PCU_FORCE_BSSID_MATCH 0x00000001 -#define AR_PCU_MIC_NEW_LOC_ENA 0x00000004 -#define AR_PCU_TX_ADD_TSF 0x00000008 -#define AR_PCU_CCK_SIFS_MODE 0x00000010 -#define AR_PCU_RX_ANT_UPDT 0x00000800 -#define AR_PCU_TXOP_TBTT_LIMIT_ENA 0x00001000 -#define AR_PCU_MISS_BCN_IN_SLEEP 0x00004000 -#define AR_PCU_BUG_12306_FIX_ENA 0x00020000 -#define AR_PCU_FORCE_QUIET_COLL 0x00040000 -#define AR_PCU_TBTT_PROTECT 0x00200000 -#define AR_PCU_CLEAR_VMF 0x01000000 -#define AR_PCU_CLEAR_BA_VALID 0x04000000 -#define AR_PCU_ALWAYS_PERFORM_KEYSEARCH 0x10000000 - -#define AR_PCU_BT_ANT_PREVENT_RX 0x00100000 -#define AR_PCU_BT_ANT_PREVENT_RX_S 20 - -#define AR_FILT_OFDM 0x8124 -#define AR_FILT_OFDM_COUNT 0x00FFFFFF - -#define AR_FILT_CCK 0x8128 -#define AR_FILT_CCK_COUNT 0x00FFFFFF - -#define AR_PHY_ERR_1 0x812c -#define AR_PHY_ERR_1_COUNT 0x00FFFFFF -#define AR_PHY_ERR_MASK_1 0x8130 - -#define AR_PHY_ERR_2 0x8134 -#define AR_PHY_ERR_2_COUNT 0x00FFFFFF -#define AR_PHY_ERR_MASK_2 0x8138 - -#define AR_PHY_COUNTMAX (3 << 22) -#define AR_MIBCNT_INTRMASK (3 << 22) - -#define AR_TSFOOR_THRESHOLD 0x813c -#define AR_TSFOOR_THRESHOLD_VAL 0x0000FFFF - -#define AR_PHY_ERR_EIFS_MASK 0x8144 - -#define AR_PHY_ERR_3 0x8168 -#define AR_PHY_ERR_3_COUNT 0x00FFFFFF -#define AR_PHY_ERR_MASK_3 0x816c - -#define AR_BT_COEX_MODE 0x8170 -#define AR_BT_TIME_EXTEND 0x000000ff -#define AR_BT_TIME_EXTEND_S 0 -#define AR_BT_TXSTATE_EXTEND 0x00000100 -#define AR_BT_TXSTATE_EXTEND_S 8 -#define AR_BT_TX_FRAME_EXTEND 0x00000200 -#define AR_BT_TX_FRAME_EXTEND_S 9 -#define AR_BT_MODE 0x00000c00 -#define AR_BT_MODE_S 10 -#define AR_BT_QUIET 0x00001000 -#define AR_BT_QUIET_S 12 -#define AR_BT_QCU_THRESH 0x0001e000 -#define AR_BT_QCU_THRESH_S 13 -#define AR_BT_RX_CLEAR_POLARITY 0x00020000 -#define AR_BT_RX_CLEAR_POLARITY_S 17 -#define AR_BT_PRIORITY_TIME 0x00fc0000 -#define AR_BT_PRIORITY_TIME_S 18 -#define AR_BT_FIRST_SLOT_TIME 0xff000000 -#define AR_BT_FIRST_SLOT_TIME_S 24 - -#define AR_BT_COEX_WEIGHT 0x8174 -#define AR_BT_COEX_WGHT 0xff55 -#define AR_STOMP_ALL_WLAN_WGHT 0xfcfc -#define AR_STOMP_LOW_WLAN_WGHT 0xa8a8 -#define AR_STOMP_NONE_WLAN_WGHT 0x0000 -#define AR_BTCOEX_BT_WGHT 0x0000ffff -#define AR_BTCOEX_BT_WGHT_S 0 -#define AR_BTCOEX_WL_WGHT 0xffff0000 -#define AR_BTCOEX_WL_WGHT_S 16 - -#define AR_BT_COEX_WL_WEIGHTS0 0x8174 -#define AR_BT_COEX_WL_WEIGHTS1 0x81c4 -#define AR_MCI_COEX_WL_WEIGHTS(_i) (0x18b0 + (_i << 2)) -#define AR_BT_COEX_BT_WEIGHTS(_i) (0x83ac + (_i << 2)) - -#define AR9300_BT_WGHT 0xcccc4444 - -#define AR_BT_COEX_MODE2 0x817c -#define AR_BT_BCN_MISS_THRESH 0x000000ff -#define AR_BT_BCN_MISS_THRESH_S 0 -#define AR_BT_BCN_MISS_CNT 0x0000ff00 -#define AR_BT_BCN_MISS_CNT_S 8 -#define AR_BT_HOLD_RX_CLEAR 0x00010000 -#define AR_BT_HOLD_RX_CLEAR_S 16 -#define AR_BT_DISABLE_BT_ANT 0x00100000 -#define AR_BT_DISABLE_BT_ANT_S 20 - -#define AR_TXSIFS 0x81d0 -#define AR_TXSIFS_TIME 0x000000FF -#define AR_TXSIFS_TX_LATENCY 0x00000F00 -#define AR_TXSIFS_TX_LATENCY_S 8 -#define AR_TXSIFS_ACK_SHIFT 0x00007000 -#define AR_TXSIFS_ACK_SHIFT_S 12 - -#define AR_TXOP_X 0x81ec -#define AR_TXOP_X_VAL 0x000000FF - - -#define AR_TXOP_0_3 0x81f0 -#define AR_TXOP_4_7 0x81f4 -#define AR_TXOP_8_11 0x81f8 -#define AR_TXOP_12_15 0x81fc - -#define AR_NEXT_NDP2_TIMER 0x8180 -#define AR_GEN_TIMER_BANK_1_LEN 8 -#define AR_FIRST_NDP_TIMER 7 -#define AR_NDP2_PERIOD 0x81a0 -#define AR_NDP2_TIMER_MODE 0x81c0 - -#define AR_GEN_TIMERS(_i) (0x8200 + ((_i) << 2)) -#define AR_NEXT_TBTT_TIMER AR_GEN_TIMERS(0) -#define AR_NEXT_DMA_BEACON_ALERT AR_GEN_TIMERS(1) -#define AR_NEXT_SWBA AR_GEN_TIMERS(2) -#define AR_NEXT_CFP AR_GEN_TIMERS(2) -#define AR_NEXT_HCF AR_GEN_TIMERS(3) -#define AR_NEXT_TIM AR_GEN_TIMERS(4) -#define AR_NEXT_DTIM AR_GEN_TIMERS(5) -#define AR_NEXT_QUIET_TIMER AR_GEN_TIMERS(6) -#define AR_NEXT_NDP_TIMER AR_GEN_TIMERS(7) - -#define AR_BEACON_PERIOD AR_GEN_TIMERS(8) -#define AR_DMA_BEACON_PERIOD AR_GEN_TIMERS(9) -#define AR_SWBA_PERIOD AR_GEN_TIMERS(10) -#define AR_HCF_PERIOD AR_GEN_TIMERS(11) -#define AR_TIM_PERIOD AR_GEN_TIMERS(12) -#define AR_DTIM_PERIOD AR_GEN_TIMERS(13) -#define AR_QUIET_PERIOD AR_GEN_TIMERS(14) -#define AR_NDP_PERIOD AR_GEN_TIMERS(15) - -#define AR_TIMER_MODE 0x8240 -#define AR_TBTT_TIMER_EN 0x00000001 -#define AR_DBA_TIMER_EN 0x00000002 -#define AR_SWBA_TIMER_EN 0x00000004 -#define AR_HCF_TIMER_EN 0x00000008 -#define AR_TIM_TIMER_EN 0x00000010 -#define AR_DTIM_TIMER_EN 0x00000020 -#define AR_QUIET_TIMER_EN 0x00000040 -#define AR_NDP_TIMER_EN 0x00000080 -#define AR_TIMER_OVERFLOW_INDEX 0x00000700 -#define AR_TIMER_OVERFLOW_INDEX_S 8 -#define AR_TIMER_THRESH 0xFFFFF000 -#define AR_TIMER_THRESH_S 12 - -#define AR_SLP32_MODE 0x8244 -#define AR_SLP32_HALF_CLK_LATENCY 0x000FFFFF -#define AR_SLP32_ENA 0x00100000 -#define AR_SLP32_TSF_WRITE_STATUS 0x00200000 - -#define AR_SLP32_WAKE 0x8248 -#define AR_SLP32_WAKE_XTL_TIME 0x0000FFFF - -#define AR_SLP32_INC 0x824c -#define AR_SLP32_TST_INC 0x000FFFFF - -#define AR_SLP_CNT 0x8250 -#define AR_SLP_CYCLE_CNT 0x8254 - -#define AR_SLP_MIB_CTRL 0x8258 -#define AR_SLP_MIB_CLEAR 0x00000001 -#define AR_SLP_MIB_PENDING 0x00000002 - -#define AR_MAC_PCU_LOGIC_ANALYZER 0x8264 -#define AR_MAC_PCU_LOGIC_ANALYZER_DISBUG20768 0x20000000 - - -#define AR_2040_MODE 0x8318 -#define AR_2040_JOINED_RX_CLEAR 0x00000001 - - -#define AR_EXTRCCNT 0x8328 - -#define AR_SELFGEN_MASK 0x832c - -#define AR_PCU_TXBUF_CTRL 0x8340 -#define AR_PCU_TXBUF_CTRL_SIZE_MASK 0x7FF -#define AR_PCU_TXBUF_CTRL_USABLE_SIZE 0x700 -#define AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE 0x380 -#define AR_9340_PCU_TXBUF_CTRL_USABLE_SIZE 0x500 - -#define AR_PCU_MISC_MODE2 0x8344 -#define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE 0x00000002 -#define AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT 0x00000004 - -#define AR_PCU_MISC_MODE2_RESERVED 0x00000038 -#define AR_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE 0x00000040 -#define AR_PCU_MISC_MODE2_CFP_IGNORE 0x00000080 -#define AR_PCU_MISC_MODE2_MGMT_QOS 0x0000FF00 -#define AR_PCU_MISC_MODE2_MGMT_QOS_S 8 -#define AR_PCU_MISC_MODE2_ENABLE_LOAD_NAV_BEACON_DURATION 0x00010000 -#define AR_PCU_MISC_MODE2_ENABLE_AGGWEP 0x00020000 -#define AR_PCU_MISC_MODE2_HWWAR1 0x00100000 -#define AR_PCU_MISC_MODE2_HWWAR2 0x02000000 -#define AR_PCU_MISC_MODE2_RESERVED2 0xFFFE0000 - -#define AR_PCU_MISC_MODE3 0x83d0 - -#define AR_MAC_PCU_ASYNC_FIFO_REG3 0x8358 -#define AR_MAC_PCU_ASYNC_FIFO_REG3_DATAPATH_SEL 0x00000400 -#define AR_MAC_PCU_ASYNC_FIFO_REG3_SOFT_RESET 0x80000000 -#define AR_MAC_PCU_GEN_TIMER_TSF_SEL 0x83d8 - - -#define AR_AES_MUTE_MASK0 0x805c -#define AR_AES_MUTE_MASK0_FC 0x0000FFFF -#define AR_AES_MUTE_MASK0_QOS 0xFFFF0000 -#define AR_AES_MUTE_MASK0_QOS_S 16 - -#define AR_AES_MUTE_MASK1 0x8060 -#define AR_AES_MUTE_MASK1_SEQ 0x0000FFFF -#define AR_AES_MUTE_MASK1_SEQ_S 0 -#define AR_AES_MUTE_MASK1_FC_MGMT 0xFFFF0000 -#define AR_AES_MUTE_MASK1_FC_MGMT_S 16 - -#define AR_RATE_DURATION_0 0x8700 -#define AR_RATE_DURATION_31 0x87CC -#define AR_RATE_DURATION_32 0x8780 -#define AR_RATE_DURATION(_n) (AR_RATE_DURATION_0 + ((_n)<<2)) - -/* WoW - Wake On Wireless */ - -#define AR_PMCTRL_AUX_PWR_DET 0x10000000 /* Puts Chip in L2 state */ -#define AR_PMCTRL_D3COLD_VAUX 0x00800000 -#define AR_PMCTRL_HOST_PME_EN 0x00400000 /* Send OOB WAKE_L on WoW - event */ -#define AR_PMCTRL_WOW_PME_CLR 0x00200000 /* Clear WoW event */ -#define AR_PMCTRL_PWR_STATE_MASK 0x0f000000 /* Power State Mask */ -#define AR_PMCTRL_PWR_STATE_D1D3 0x0f000000 /* Activate D1 and D3 */ -#define AR_PMCTRL_PWR_STATE_D1D3_REAL 0x0f000000 /* Activate D1 and D3 */ -#define AR_PMCTRL_PWR_STATE_D0 0x08000000 /* Activate D0 */ -#define AR_PMCTRL_PWR_PM_CTRL_ENA 0x00008000 /* Enable power mgmt */ - -#define AR_WOW_BEACON_TIMO_MAX 0xffffffff - -/* - * MAC WoW Registers - */ - -#define AR_WOW_PATTERN 0x825C -#define AR_WOW_COUNT 0x8260 -#define AR_WOW_BCN_EN 0x8270 -#define AR_WOW_BCN_TIMO 0x8274 -#define AR_WOW_KEEP_ALIVE_TIMO 0x8278 -#define AR_WOW_KEEP_ALIVE 0x827c -#define AR_WOW_US_SCALAR 0x8284 -#define AR_WOW_KEEP_ALIVE_DELAY 0x8288 -#define AR_WOW_PATTERN_MATCH 0x828c -#define AR_WOW_PATTERN_OFF1 0x8290 /* pattern bytes 0 -> 3 */ -#define AR_WOW_PATTERN_OFF2 0x8294 /* pattern bytes 4 -> 7 */ - -/* for AR9285 or later version of chips */ -#define AR_WOW_EXACT 0x829c -#define AR_WOW_LENGTH1 0x8360 -#define AR_WOW_LENGTH2 0X8364 -/* register to enable match for less than 256 bytes packets */ -#define AR_WOW_PATTERN_MATCH_LT_256B 0x8368 - -#define AR_SW_WOW_CONTROL 0x20018 -#define AR_SW_WOW_ENABLE 0x1 -#define AR_SWITCH_TO_REFCLK 0x2 -#define AR_RESET_CONTROL 0x4 -#define AR_RESET_VALUE_MASK 0x8 -#define AR_HW_WOW_DISABLE 0x10 -#define AR_CLR_MAC_INTERRUPT 0x20 -#define AR_CLR_KA_INTERRUPT 0x40 - -/* AR_WOW_PATTERN register values */ -#define AR_WOW_BACK_OFF_SHIFT(x) ((x & 0xf) << 28) /* in usecs */ -#define AR_WOW_MAC_INTR_EN 0x00040000 -#define AR_WOW_MAGIC_EN 0x00010000 -#define AR_WOW_PATTERN_EN(x) (x & 0xff) -#define AR_WOW_PAT_FOUND_SHIFT 8 -#define AR_WOW_PATTERN_FOUND(x) (x & (0xff << AR_WOW_PAT_FOUND_SHIFT)) -#define AR_WOW_PATTERN_FOUND_MASK ((0xff) << AR_WOW_PAT_FOUND_SHIFT) -#define AR_WOW_MAGIC_PAT_FOUND 0x00020000 -#define AR_WOW_MAC_INTR 0x00080000 -#define AR_WOW_KEEP_ALIVE_FAIL 0x00100000 -#define AR_WOW_BEACON_FAIL 0x00200000 - -#define AR_WOW_STATUS(x) (x & (AR_WOW_PATTERN_FOUND_MASK | \ - AR_WOW_MAGIC_PAT_FOUND | \ - AR_WOW_KEEP_ALIVE_FAIL | \ - AR_WOW_BEACON_FAIL)) -#define AR_WOW_CLEAR_EVENTS(x) (x & ~(AR_WOW_PATTERN_EN(0xff) | \ - AR_WOW_MAGIC_EN | \ - AR_WOW_MAC_INTR_EN | \ - AR_WOW_BEACON_FAIL | \ - AR_WOW_KEEP_ALIVE_FAIL)) - -/* AR_WOW_COUNT register values */ -#define AR_WOW_AIFS_CNT(x) (x & 0xff) -#define AR_WOW_SLOT_CNT(x) ((x & 0xff) << 8) -#define AR_WOW_KEEP_ALIVE_CNT(x) ((x & 0xff) << 16) - -/* AR_WOW_BCN_EN register */ -#define AR_WOW_BEACON_FAIL_EN 0x00000001 - -/* AR_WOW_BCN_TIMO rgister */ -#define AR_WOW_BEACON_TIMO 0x40000000 /* valid if BCN_EN is set */ - -/* AR_WOW_KEEP_ALIVE_TIMO register */ -#define AR_WOW_KEEP_ALIVE_TIMO_VALUE -#define AR_WOW_KEEP_ALIVE_NEVER 0xffffffff - -/* AR_WOW_KEEP_ALIVE register */ -#define AR_WOW_KEEP_ALIVE_AUTO_DIS 0x00000001 -#define AR_WOW_KEEP_ALIVE_FAIL_DIS 0x00000002 - -/* AR_WOW_KEEP_ALIVE_DELAY register */ -#define AR_WOW_KEEP_ALIVE_DELAY_VALUE 0x000003e8 /* 1 msec */ - - -/* - * keep it long for beacon workaround - ensure no false alarm - */ -#define AR_WOW_BMISSTHRESHOLD 0x20 - -/* AR_WOW_PATTERN_MATCH register */ -#define AR_WOW_PAT_END_OF_PKT(x) (x & 0xf) -#define AR_WOW_PAT_OFF_MATCH(x) ((x & 0xf) << 8) - -/* - * default values for Wow Configuration for backoff, aifs, slot, keep-alive - * to be programmed into various registers. - */ -#define AR_WOW_PAT_BACKOFF 0x00000004 /* AR_WOW_PATTERN_REG */ -#define AR_WOW_CNT_AIFS_CNT 0x00000022 /* AR_WOW_COUNT_REG */ -#define AR_WOW_CNT_SLOT_CNT 0x00000009 /* AR_WOW_COUNT_REG */ -/* - * Keepalive count applicable for AR9280 2.0 and above. - */ -#define AR_WOW_CNT_KA_CNT 0x00000008 /* AR_WOW_COUNT register */ - -/* WoW - Transmit buffer for keep alive frames */ -#define AR_WOW_TRANSMIT_BUFFER 0xe000 /* E000 - EFFC */ - -#define AR_WOW_TXBUF(i) (AR_WOW_TRANSMIT_BUFFER + ((i) << 2)) - -#define AR_WOW_KA_DESC_WORD2 0xe000 - -#define AR_WOW_KA_DATA_WORD0 0xe030 - -/* WoW Transmit Buffer for patterns */ -#define AR_WOW_TB_PATTERN(i) (0xe100 + (i << 8)) -#define AR_WOW_TB_MASK(i) (0xec00 + (i << 5)) - -/* Currently Pattern 0-7 are supported - so bit 0-7 are set */ -#define AR_WOW_PATTERN_SUPPORTED 0xff -#define AR_WOW_LENGTH_MAX 0xff -#define AR_WOW_LEN1_SHIFT(_i) ((0x3 - ((_i) & 0x3)) << 0x3) -#define AR_WOW_LENGTH1_MASK(_i) (AR_WOW_LENGTH_MAX << AR_WOW_LEN1_SHIFT(_i)) -#define AR_WOW_LEN2_SHIFT(_i) ((0x7 - ((_i) & 0x7)) << 0x3) -#define AR_WOW_LENGTH2_MASK(_i) (AR_WOW_LENGTH_MAX << AR_WOW_LEN2_SHIFT(_i)) - -#define AR9271_CORE_CLOCK 117 /* clock to 117Mhz */ -#define AR9271_TARGET_BAUD_RATE 19200 /* 115200 */ - -#define AR_AGG_WEP_ENABLE_FIX 0x00000008 /* This allows the use of AR_AGG_WEP_ENABLE */ -#define AR_ADHOC_MCAST_KEYID_ENABLE 0x00000040 /* This bit enables the Multicast search - * based on both MAC Address and Key ID. - * If bit is 0, then Multicast search is - * based on MAC address only. - * For Merlin and above only. - */ -#define AR_AGG_WEP_ENABLE 0x00020000 /* This field enables AGG_WEP feature, - * when it is enable, AGG_WEP would takes - * charge of the encryption interface of - * pcu_txsm. - */ - -#define AR9300_SM_BASE 0xa200 -#define AR9002_PHY_AGC_CONTROL 0x9860 -#define AR9003_PHY_AGC_CONTROL AR9300_SM_BASE + 0xc4 -#define AR_PHY_AGC_CONTROL (AR_SREV_9300_20_OR_LATER(ah) ? AR9003_PHY_AGC_CONTROL : AR9002_PHY_AGC_CONTROL) -#define AR_PHY_AGC_CONTROL_CAL 0x00000001 /* do internal calibration */ -#define AR_PHY_AGC_CONTROL_NF 0x00000002 /* do noise-floor calibration */ -#define AR_PHY_AGC_CONTROL_OFFSET_CAL 0x00000800 /* allow offset calibration */ -#define AR_PHY_AGC_CONTROL_ENABLE_NF 0x00008000 /* enable noise floor calibration to happen */ -#define AR_PHY_AGC_CONTROL_FLTR_CAL 0x00010000 /* allow tx filter calibration */ -#define AR_PHY_AGC_CONTROL_NO_UPDATE_NF 0x00020000 /* don't update noise floor automatically */ -#define AR_PHY_AGC_CONTROL_EXT_NF_PWR_MEAS 0x00040000 /* extend noise floor power measurement */ -#define AR_PHY_AGC_CONTROL_CLC_SUCCESS 0x00080000 /* carrier leak calibration done */ -#define AR_PHY_AGC_CONTROL_PKDET_CAL 0x00100000 -#define AR_PHY_AGC_CONTROL_YCOK_MAX 0x000003c0 -#define AR_PHY_AGC_CONTROL_YCOK_MAX_S 6 - -/* MCI Registers */ - -#define AR_MCI_COMMAND0 0x1800 -#define AR_MCI_COMMAND0_HEADER 0xFF -#define AR_MCI_COMMAND0_HEADER_S 0 -#define AR_MCI_COMMAND0_LEN 0x1f00 -#define AR_MCI_COMMAND0_LEN_S 8 -#define AR_MCI_COMMAND0_DISABLE_TIMESTAMP 0x2000 -#define AR_MCI_COMMAND0_DISABLE_TIMESTAMP_S 13 - -#define AR_MCI_COMMAND1 0x1804 - -#define AR_MCI_COMMAND2 0x1808 -#define AR_MCI_COMMAND2_RESET_TX 0x01 -#define AR_MCI_COMMAND2_RESET_TX_S 0 -#define AR_MCI_COMMAND2_RESET_RX 0x02 -#define AR_MCI_COMMAND2_RESET_RX_S 1 -#define AR_MCI_COMMAND2_RESET_RX_NUM_CYCLES 0x3FC -#define AR_MCI_COMMAND2_RESET_RX_NUM_CYCLES_S 2 -#define AR_MCI_COMMAND2_RESET_REQ_WAKEUP 0x400 -#define AR_MCI_COMMAND2_RESET_REQ_WAKEUP_S 10 - -#define AR_MCI_RX_CTRL 0x180c - -#define AR_MCI_TX_CTRL 0x1810 -/* 0 = no division, 1 = divide by 2, 2 = divide by 4, 3 = divide by 8 */ -#define AR_MCI_TX_CTRL_CLK_DIV 0x03 -#define AR_MCI_TX_CTRL_CLK_DIV_S 0 -#define AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE 0x04 -#define AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE_S 2 -#define AR_MCI_TX_CTRL_GAIN_UPDATE_FREQ 0xFFFFF8 -#define AR_MCI_TX_CTRL_GAIN_UPDATE_FREQ_S 3 -#define AR_MCI_TX_CTRL_GAIN_UPDATE_NUM 0xF000000 -#define AR_MCI_TX_CTRL_GAIN_UPDATE_NUM_S 24 - -#define AR_MCI_MSG_ATTRIBUTES_TABLE 0x1814 -#define AR_MCI_MSG_ATTRIBUTES_TABLE_CHECKSUM 0xFFFF -#define AR_MCI_MSG_ATTRIBUTES_TABLE_CHECKSUM_S 0 -#define AR_MCI_MSG_ATTRIBUTES_TABLE_INVALID_HDR 0xFFFF0000 -#define AR_MCI_MSG_ATTRIBUTES_TABLE_INVALID_HDR_S 16 - -#define AR_MCI_SCHD_TABLE_0 0x1818 -#define AR_MCI_SCHD_TABLE_1 0x181c -#define AR_MCI_GPM_0 0x1820 -#define AR_MCI_GPM_1 0x1824 -#define AR_MCI_GPM_WRITE_PTR 0xFFFF0000 -#define AR_MCI_GPM_WRITE_PTR_S 16 -#define AR_MCI_GPM_BUF_LEN 0x0000FFFF -#define AR_MCI_GPM_BUF_LEN_S 0 - -#define AR_MCI_INTERRUPT_RAW 0x1828 -#define AR_MCI_INTERRUPT_EN 0x182c -#define AR_MCI_INTERRUPT_SW_MSG_DONE 0x00000001 -#define AR_MCI_INTERRUPT_SW_MSG_DONE_S 0 -#define AR_MCI_INTERRUPT_CPU_INT_MSG 0x00000002 -#define AR_MCI_INTERRUPT_CPU_INT_MSG_S 1 -#define AR_MCI_INTERRUPT_RX_CKSUM_FAIL 0x00000004 -#define AR_MCI_INTERRUPT_RX_CKSUM_FAIL_S 2 -#define AR_MCI_INTERRUPT_RX_INVALID_HDR 0x00000008 -#define AR_MCI_INTERRUPT_RX_INVALID_HDR_S 3 -#define AR_MCI_INTERRUPT_RX_HW_MSG_FAIL 0x00000010 -#define AR_MCI_INTERRUPT_RX_HW_MSG_FAIL_S 4 -#define AR_MCI_INTERRUPT_RX_SW_MSG_FAIL 0x00000020 -#define AR_MCI_INTERRUPT_RX_SW_MSG_FAIL_S 5 -#define AR_MCI_INTERRUPT_TX_HW_MSG_FAIL 0x00000080 -#define AR_MCI_INTERRUPT_TX_HW_MSG_FAIL_S 7 -#define AR_MCI_INTERRUPT_TX_SW_MSG_FAIL 0x00000100 -#define AR_MCI_INTERRUPT_TX_SW_MSG_FAIL_S 8 -#define AR_MCI_INTERRUPT_RX_MSG 0x00000200 -#define AR_MCI_INTERRUPT_RX_MSG_S 9 -#define AR_MCI_INTERRUPT_REMOTE_SLEEP_UPDATE 0x00000400 -#define AR_MCI_INTERRUPT_REMOTE_SLEEP_UPDATE_S 10 -#define AR_MCI_INTERRUPT_BT_PRI 0x07fff800 -#define AR_MCI_INTERRUPT_BT_PRI_S 11 -#define AR_MCI_INTERRUPT_BT_PRI_THRESH 0x08000000 -#define AR_MCI_INTERRUPT_BT_PRI_THRESH_S 27 -#define AR_MCI_INTERRUPT_BT_FREQ 0x10000000 -#define AR_MCI_INTERRUPT_BT_FREQ_S 28 -#define AR_MCI_INTERRUPT_BT_STOMP 0x20000000 -#define AR_MCI_INTERRUPT_BT_STOMP_S 29 -#define AR_MCI_INTERRUPT_BB_AIC_IRQ 0x40000000 -#define AR_MCI_INTERRUPT_BB_AIC_IRQ_S 30 -#define AR_MCI_INTERRUPT_CONT_INFO_TIMEOUT 0x80000000 -#define AR_MCI_INTERRUPT_CONT_INFO_TIMEOUT_S 31 - -#define AR_MCI_INTERRUPT_DEFAULT (AR_MCI_INTERRUPT_SW_MSG_DONE | \ - AR_MCI_INTERRUPT_RX_INVALID_HDR | \ - AR_MCI_INTERRUPT_RX_HW_MSG_FAIL | \ - AR_MCI_INTERRUPT_RX_SW_MSG_FAIL | \ - AR_MCI_INTERRUPT_TX_HW_MSG_FAIL | \ - AR_MCI_INTERRUPT_TX_SW_MSG_FAIL | \ - AR_MCI_INTERRUPT_RX_MSG | \ - AR_MCI_INTERRUPT_REMOTE_SLEEP_UPDATE | \ - AR_MCI_INTERRUPT_CONT_INFO_TIMEOUT) - -#define AR_MCI_INTERRUPT_MSG_FAIL_MASK (AR_MCI_INTERRUPT_RX_HW_MSG_FAIL | \ - AR_MCI_INTERRUPT_RX_SW_MSG_FAIL | \ - AR_MCI_INTERRUPT_TX_HW_MSG_FAIL | \ - AR_MCI_INTERRUPT_TX_SW_MSG_FAIL) - -#define AR_MCI_REMOTE_CPU_INT 0x1830 -#define AR_MCI_REMOTE_CPU_INT_EN 0x1834 -#define AR_MCI_INTERRUPT_RX_MSG_RAW 0x1838 -#define AR_MCI_INTERRUPT_RX_MSG_EN 0x183c -#define AR_MCI_INTERRUPT_RX_MSG_REMOTE_RESET 0x00000001 -#define AR_MCI_INTERRUPT_RX_MSG_REMOTE_RESET_S 0 -#define AR_MCI_INTERRUPT_RX_MSG_LNA_CONTROL 0x00000002 -#define AR_MCI_INTERRUPT_RX_MSG_LNA_CONTROL_S 1 -#define AR_MCI_INTERRUPT_RX_MSG_CONT_NACK 0x00000004 -#define AR_MCI_INTERRUPT_RX_MSG_CONT_NACK_S 2 -#define AR_MCI_INTERRUPT_RX_MSG_CONT_INFO 0x00000008 -#define AR_MCI_INTERRUPT_RX_MSG_CONT_INFO_S 3 -#define AR_MCI_INTERRUPT_RX_MSG_CONT_RST 0x00000010 -#define AR_MCI_INTERRUPT_RX_MSG_CONT_RST_S 4 -#define AR_MCI_INTERRUPT_RX_MSG_SCHD_INFO 0x00000020 -#define AR_MCI_INTERRUPT_RX_MSG_SCHD_INFO_S 5 -#define AR_MCI_INTERRUPT_RX_MSG_CPU_INT 0x00000040 -#define AR_MCI_INTERRUPT_RX_MSG_CPU_INT_S 6 -#define AR_MCI_INTERRUPT_RX_MSG_GPM 0x00000100 -#define AR_MCI_INTERRUPT_RX_MSG_GPM_S 8 -#define AR_MCI_INTERRUPT_RX_MSG_LNA_INFO 0x00000200 -#define AR_MCI_INTERRUPT_RX_MSG_LNA_INFO_S 9 -#define AR_MCI_INTERRUPT_RX_MSG_SYS_SLEEPING 0x00000400 -#define AR_MCI_INTERRUPT_RX_MSG_SYS_SLEEPING_S 10 -#define AR_MCI_INTERRUPT_RX_MSG_SYS_WAKING 0x00000800 -#define AR_MCI_INTERRUPT_RX_MSG_SYS_WAKING_S 11 -#define AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE 0x00001000 -#define AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE_S 12 -#define AR_MCI_INTERRUPT_RX_HW_MSG_MASK (AR_MCI_INTERRUPT_RX_MSG_SCHD_INFO | \ - AR_MCI_INTERRUPT_RX_MSG_LNA_CONTROL| \ - AR_MCI_INTERRUPT_RX_MSG_LNA_INFO | \ - AR_MCI_INTERRUPT_RX_MSG_CONT_NACK | \ - AR_MCI_INTERRUPT_RX_MSG_CONT_INFO | \ - AR_MCI_INTERRUPT_RX_MSG_CONT_RST) - -#define AR_MCI_INTERRUPT_RX_MSG_DEFAULT (AR_MCI_INTERRUPT_RX_MSG_GPM | \ - AR_MCI_INTERRUPT_RX_MSG_REMOTE_RESET| \ - AR_MCI_INTERRUPT_RX_MSG_SYS_WAKING | \ - AR_MCI_INTERRUPT_RX_MSG_SYS_SLEEPING| \ - AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE) - -#define AR_MCI_CPU_INT 0x1840 - -#define AR_MCI_RX_STATUS 0x1844 -#define AR_MCI_RX_LAST_SCHD_MSG_INDEX 0x00000F00 -#define AR_MCI_RX_LAST_SCHD_MSG_INDEX_S 8 -#define AR_MCI_RX_REMOTE_SLEEP 0x00001000 -#define AR_MCI_RX_REMOTE_SLEEP_S 12 -#define AR_MCI_RX_MCI_CLK_REQ 0x00002000 -#define AR_MCI_RX_MCI_CLK_REQ_S 13 - -#define AR_MCI_CONT_STATUS 0x1848 -#define AR_MCI_CONT_RSSI_POWER 0x000000FF -#define AR_MCI_CONT_RSSI_POWER_S 0 -#define AR_MCI_CONT_PRIORITY 0x0000FF00 -#define AR_MCI_CONT_PRIORITY_S 8 -#define AR_MCI_CONT_TXRX 0x00010000 -#define AR_MCI_CONT_TXRX_S 16 - -#define AR_MCI_BT_PRI0 0x184c -#define AR_MCI_BT_PRI1 0x1850 -#define AR_MCI_BT_PRI2 0x1854 -#define AR_MCI_BT_PRI3 0x1858 -#define AR_MCI_BT_PRI 0x185c -#define AR_MCI_WL_FREQ0 0x1860 -#define AR_MCI_WL_FREQ1 0x1864 -#define AR_MCI_WL_FREQ2 0x1868 -#define AR_MCI_GAIN 0x186c -#define AR_MCI_WBTIMER1 0x1870 -#define AR_MCI_WBTIMER2 0x1874 -#define AR_MCI_WBTIMER3 0x1878 -#define AR_MCI_WBTIMER4 0x187c -#define AR_MCI_MAXGAIN 0x1880 -#define AR_MCI_HW_SCHD_TBL_CTL 0x1884 -#define AR_MCI_HW_SCHD_TBL_D0 0x1888 -#define AR_MCI_HW_SCHD_TBL_D1 0x188c -#define AR_MCI_HW_SCHD_TBL_D2 0x1890 -#define AR_MCI_HW_SCHD_TBL_D3 0x1894 -#define AR_MCI_TX_PAYLOAD0 0x1898 -#define AR_MCI_TX_PAYLOAD1 0x189c -#define AR_MCI_TX_PAYLOAD2 0x18a0 -#define AR_MCI_TX_PAYLOAD3 0x18a4 -#define AR_BTCOEX_WBTIMER 0x18a8 - -#define AR_BTCOEX_CTRL 0x18ac -#define AR_BTCOEX_CTRL_AR9462_MODE 0x00000001 -#define AR_BTCOEX_CTRL_AR9462_MODE_S 0 -#define AR_BTCOEX_CTRL_WBTIMER_EN 0x00000002 -#define AR_BTCOEX_CTRL_WBTIMER_EN_S 1 -#define AR_BTCOEX_CTRL_MCI_MODE_EN 0x00000004 -#define AR_BTCOEX_CTRL_MCI_MODE_EN_S 2 -#define AR_BTCOEX_CTRL_LNA_SHARED 0x00000008 -#define AR_BTCOEX_CTRL_LNA_SHARED_S 3 -#define AR_BTCOEX_CTRL_PA_SHARED 0x00000010 -#define AR_BTCOEX_CTRL_PA_SHARED_S 4 -#define AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN 0x00000020 -#define AR_BTCOEX_CTRL_ONE_STEP_LOOK_AHEAD_EN_S 5 -#define AR_BTCOEX_CTRL_TIME_TO_NEXT_BT_THRESH_EN 0x00000040 -#define AR_BTCOEX_CTRL_TIME_TO_NEXT_BT_THRESH_EN_S 6 -#define AR_BTCOEX_CTRL_NUM_ANTENNAS 0x00000180 -#define AR_BTCOEX_CTRL_NUM_ANTENNAS_S 7 -#define AR_BTCOEX_CTRL_RX_CHAIN_MASK 0x00000E00 -#define AR_BTCOEX_CTRL_RX_CHAIN_MASK_S 9 -#define AR_BTCOEX_CTRL_AGGR_THRESH 0x00007000 -#define AR_BTCOEX_CTRL_AGGR_THRESH_S 12 -#define AR_BTCOEX_CTRL_1_CHAIN_BCN 0x00080000 -#define AR_BTCOEX_CTRL_1_CHAIN_BCN_S 19 -#define AR_BTCOEX_CTRL_1_CHAIN_ACK 0x00100000 -#define AR_BTCOEX_CTRL_1_CHAIN_ACK_S 20 -#define AR_BTCOEX_CTRL_WAIT_BA_MARGIN 0x1FE00000 -#define AR_BTCOEX_CTRL_WAIT_BA_MARGIN_S 28 -#define AR_BTCOEX_CTRL_REDUCE_TXPWR 0x20000000 -#define AR_BTCOEX_CTRL_REDUCE_TXPWR_S 29 -#define AR_BTCOEX_CTRL_SPDT_ENABLE_10 0x40000000 -#define AR_BTCOEX_CTRL_SPDT_ENABLE_10_S 30 -#define AR_BTCOEX_CTRL_SPDT_POLARITY 0x80000000 -#define AR_BTCOEX_CTRL_SPDT_POLARITY_S 31 - -#define AR_BTCOEX_MAX_TXPWR(_x) (0x18c0 + ((_x) << 2)) -#define AR_BTCOEX_WL_LNA 0x1940 -#define AR_BTCOEX_RFGAIN_CTRL 0x1944 -#define AR_BTCOEX_WL_LNA_TIMEOUT 0x003FFFFF -#define AR_BTCOEX_WL_LNA_TIMEOUT_S 0 - -#define AR_BTCOEX_CTRL2 0x1948 -#define AR_BTCOEX_CTRL2_TXPWR_THRESH 0x0007F800 -#define AR_BTCOEX_CTRL2_TXPWR_THRESH_S 11 -#define AR_BTCOEX_CTRL2_TX_CHAIN_MASK 0x00380000 -#define AR_BTCOEX_CTRL2_TX_CHAIN_MASK_S 19 -#define AR_BTCOEX_CTRL2_RX_DEWEIGHT 0x00400000 -#define AR_BTCOEX_CTRL2_RX_DEWEIGHT_S 22 -#define AR_BTCOEX_CTRL2_GPIO_OBS_SEL 0x00800000 -#define AR_BTCOEX_CTRL2_GPIO_OBS_SEL_S 23 -#define AR_BTCOEX_CTRL2_MAC_BB_OBS_SEL 0x01000000 -#define AR_BTCOEX_CTRL2_MAC_BB_OBS_SEL_S 24 -#define AR_BTCOEX_CTRL2_DESC_BASED_TXPWR_ENABLE 0x02000000 -#define AR_BTCOEX_CTRL2_DESC_BASED_TXPWR_ENABLE_S 25 - -#define AR_BTCOEX_CTRL_SPDT_ENABLE 0x00000001 -#define AR_BTCOEX_CTRL_SPDT_ENABLE_S 0 -#define AR_BTCOEX_CTRL_BT_OWN_SPDT_CTRL 0x00000002 -#define AR_BTCOEX_CTRL_BT_OWN_SPDT_CTRL_S 1 -#define AR_BTCOEX_CTRL_USE_LATCHED_BT_ANT 0x00000004 -#define AR_BTCOEX_CTRL_USE_LATCHED_BT_ANT_S 2 -#define AR_GLB_WLAN_UART_INTF_EN 0x00020000 -#define AR_GLB_WLAN_UART_INTF_EN_S 17 -#define AR_GLB_DS_JTAG_DISABLE 0x00040000 -#define AR_GLB_DS_JTAG_DISABLE_S 18 - -#define AR_BTCOEX_RC 0x194c -#define AR_BTCOEX_MAX_RFGAIN(_x) (0x1950 + ((_x) << 2)) -#define AR_BTCOEX_DBG 0x1a50 -#define AR_MCI_LAST_HW_MSG_HDR 0x1a54 -#define AR_MCI_LAST_HW_MSG_BDY 0x1a58 - -#define AR_MCI_SCHD_TABLE_2 0x1a5c -#define AR_MCI_SCHD_TABLE_2_MEM_BASED 0x00000001 -#define AR_MCI_SCHD_TABLE_2_MEM_BASED_S 0 -#define AR_MCI_SCHD_TABLE_2_HW_BASED 0x00000002 -#define AR_MCI_SCHD_TABLE_2_HW_BASED_S 1 - -#define AR_BTCOEX_CTRL3 0x1a60 -#define AR_BTCOEX_CTRL3_CONT_INFO_TIMEOUT 0x00000fff -#define AR_BTCOEX_CTRL3_CONT_INFO_TIMEOUT_S 0 - -#define AR_GLB_SWREG_DISCONT_MODE 0x2002c -#define AR_GLB_SWREG_DISCONT_EN_BT_WLAN 0x3 - -#define AR_MCI_MISC 0x1a74 -#define AR_MCI_MISC_HW_FIX_EN 0x00000001 -#define AR_MCI_MISC_HW_FIX_EN_S 0 -#define AR_MCI_DBG_CNT_CTRL 0x1a78 -#define AR_MCI_DBG_CNT_CTRL_ENABLE 0x00000001 -#define AR_MCI_DBG_CNT_CTRL_ENABLE_S 0 - -#endif diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c deleted file mode 100644 index 65c8894c5f81..000000000000 --- a/drivers/net/wireless/ath/ath9k/wmi.c +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "htc.h" - -static const char *wmi_cmd_to_name(enum wmi_cmd_id wmi_cmd) -{ - switch (wmi_cmd) { - case WMI_ECHO_CMDID: - return "WMI_ECHO_CMDID"; - case WMI_ACCESS_MEMORY_CMDID: - return "WMI_ACCESS_MEMORY_CMDID"; - case WMI_GET_FW_VERSION: - return "WMI_GET_FW_VERSION"; - case WMI_DISABLE_INTR_CMDID: - return "WMI_DISABLE_INTR_CMDID"; - case WMI_ENABLE_INTR_CMDID: - return "WMI_ENABLE_INTR_CMDID"; - case WMI_ATH_INIT_CMDID: - return "WMI_ATH_INIT_CMDID"; - case WMI_ABORT_TXQ_CMDID: - return "WMI_ABORT_TXQ_CMDID"; - case WMI_STOP_TX_DMA_CMDID: - return "WMI_STOP_TX_DMA_CMDID"; - case WMI_ABORT_TX_DMA_CMDID: - return "WMI_ABORT_TX_DMA_CMDID"; - case WMI_DRAIN_TXQ_CMDID: - return "WMI_DRAIN_TXQ_CMDID"; - case WMI_DRAIN_TXQ_ALL_CMDID: - return "WMI_DRAIN_TXQ_ALL_CMDID"; - case WMI_START_RECV_CMDID: - return "WMI_START_RECV_CMDID"; - case WMI_STOP_RECV_CMDID: - return "WMI_STOP_RECV_CMDID"; - case WMI_FLUSH_RECV_CMDID: - return "WMI_FLUSH_RECV_CMDID"; - case WMI_SET_MODE_CMDID: - return "WMI_SET_MODE_CMDID"; - case WMI_NODE_CREATE_CMDID: - return "WMI_NODE_CREATE_CMDID"; - case WMI_NODE_REMOVE_CMDID: - return "WMI_NODE_REMOVE_CMDID"; - case WMI_VAP_REMOVE_CMDID: - return "WMI_VAP_REMOVE_CMDID"; - case WMI_VAP_CREATE_CMDID: - return "WMI_VAP_CREATE_CMDID"; - case WMI_REG_READ_CMDID: - return "WMI_REG_READ_CMDID"; - case WMI_REG_WRITE_CMDID: - return "WMI_REG_WRITE_CMDID"; - case WMI_RC_STATE_CHANGE_CMDID: - return "WMI_RC_STATE_CHANGE_CMDID"; - case WMI_RC_RATE_UPDATE_CMDID: - return "WMI_RC_RATE_UPDATE_CMDID"; - case WMI_TARGET_IC_UPDATE_CMDID: - return "WMI_TARGET_IC_UPDATE_CMDID"; - case WMI_TX_AGGR_ENABLE_CMDID: - return "WMI_TX_AGGR_ENABLE_CMDID"; - case WMI_TGT_DETACH_CMDID: - return "WMI_TGT_DETACH_CMDID"; - case WMI_NODE_UPDATE_CMDID: - return "WMI_NODE_UPDATE_CMDID"; - case WMI_INT_STATS_CMDID: - return "WMI_INT_STATS_CMDID"; - case WMI_TX_STATS_CMDID: - return "WMI_TX_STATS_CMDID"; - case WMI_RX_STATS_CMDID: - return "WMI_RX_STATS_CMDID"; - case WMI_BITRATE_MASK_CMDID: - return "WMI_BITRATE_MASK_CMDID"; - } - - return "Bogus"; -} - -struct wmi *ath9k_init_wmi(struct ath9k_htc_priv *priv) -{ - struct wmi *wmi; - - wmi = kzalloc(sizeof(struct wmi), GFP_KERNEL); - if (!wmi) - return NULL; - - wmi->drv_priv = priv; - wmi->stopped = false; - skb_queue_head_init(&wmi->wmi_event_queue); - spin_lock_init(&wmi->wmi_lock); - spin_lock_init(&wmi->event_lock); - mutex_init(&wmi->op_mutex); - mutex_init(&wmi->multi_write_mutex); - init_completion(&wmi->cmd_wait); - INIT_LIST_HEAD(&wmi->pending_tx_events); - tasklet_init(&wmi->wmi_event_tasklet, ath9k_wmi_event_tasklet, - (unsigned long)wmi); - - return wmi; -} - -void ath9k_deinit_wmi(struct ath9k_htc_priv *priv) -{ - struct wmi *wmi = priv->wmi; - - mutex_lock(&wmi->op_mutex); - wmi->stopped = true; - mutex_unlock(&wmi->op_mutex); - - kfree(priv->wmi); -} - -void ath9k_wmi_event_drain(struct ath9k_htc_priv *priv) -{ - unsigned long flags; - - tasklet_kill(&priv->wmi->wmi_event_tasklet); - spin_lock_irqsave(&priv->wmi->wmi_lock, flags); - __skb_queue_purge(&priv->wmi->wmi_event_queue); - spin_unlock_irqrestore(&priv->wmi->wmi_lock, flags); -} - -void ath9k_wmi_event_tasklet(unsigned long data) -{ - struct wmi *wmi = (struct wmi *)data; - struct ath9k_htc_priv *priv = wmi->drv_priv; - struct wmi_cmd_hdr *hdr; - void *wmi_event; - struct wmi_event_swba *swba; - struct sk_buff *skb = NULL; - unsigned long flags; - u16 cmd_id; - - do { - spin_lock_irqsave(&wmi->wmi_lock, flags); - skb = __skb_dequeue(&wmi->wmi_event_queue); - if (!skb) { - spin_unlock_irqrestore(&wmi->wmi_lock, flags); - return; - } - spin_unlock_irqrestore(&wmi->wmi_lock, flags); - - hdr = (struct wmi_cmd_hdr *) skb->data; - cmd_id = be16_to_cpu(hdr->command_id); - wmi_event = skb_pull(skb, sizeof(struct wmi_cmd_hdr)); - - switch (cmd_id) { - case WMI_SWBA_EVENTID: - swba = (struct wmi_event_swba *) wmi_event; - ath9k_htc_swba(priv, swba); - break; - case WMI_FATAL_EVENTID: - ieee80211_queue_work(wmi->drv_priv->hw, - &wmi->drv_priv->fatal_work); - break; - case WMI_TXSTATUS_EVENTID: - spin_lock_bh(&priv->tx.tx_lock); - if (priv->tx.flags & ATH9K_HTC_OP_TX_DRAIN) { - spin_unlock_bh(&priv->tx.tx_lock); - break; - } - spin_unlock_bh(&priv->tx.tx_lock); - - ath9k_htc_txstatus(priv, wmi_event); - break; - default: - break; - } - - kfree_skb(skb); - } while (1); -} - -void ath9k_fatal_work(struct work_struct *work) -{ - struct ath9k_htc_priv *priv = container_of(work, struct ath9k_htc_priv, - fatal_work); - struct ath_common *common = ath9k_hw_common(priv->ah); - - ath_dbg(common, FATAL, "FATAL Event received, resetting device\n"); - ath9k_htc_reset(priv); -} - -static void ath9k_wmi_rsp_callback(struct wmi *wmi, struct sk_buff *skb) -{ - skb_pull(skb, sizeof(struct wmi_cmd_hdr)); - - if (wmi->cmd_rsp_buf != NULL && wmi->cmd_rsp_len != 0) - memcpy(wmi->cmd_rsp_buf, skb->data, wmi->cmd_rsp_len); - - complete(&wmi->cmd_wait); -} - -static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb, - enum htc_endpoint_id epid) -{ - struct wmi *wmi = (struct wmi *) priv; - struct wmi_cmd_hdr *hdr; - u16 cmd_id; - - if (unlikely(wmi->stopped)) - goto free_skb; - - hdr = (struct wmi_cmd_hdr *) skb->data; - cmd_id = be16_to_cpu(hdr->command_id); - - if (cmd_id & 0x1000) { - spin_lock(&wmi->wmi_lock); - __skb_queue_tail(&wmi->wmi_event_queue, skb); - spin_unlock(&wmi->wmi_lock); - tasklet_schedule(&wmi->wmi_event_tasklet); - return; - } - - /* Check if there has been a timeout. */ - spin_lock(&wmi->wmi_lock); - if (cmd_id != wmi->last_cmd_id) { - spin_unlock(&wmi->wmi_lock); - goto free_skb; - } - spin_unlock(&wmi->wmi_lock); - - /* WMI command response */ - ath9k_wmi_rsp_callback(wmi, skb); - -free_skb: - kfree_skb(skb); -} - -static void ath9k_wmi_ctrl_tx(void *priv, struct sk_buff *skb, - enum htc_endpoint_id epid, bool txok) -{ - kfree_skb(skb); -} - -int ath9k_wmi_connect(struct htc_target *htc, struct wmi *wmi, - enum htc_endpoint_id *wmi_ctrl_epid) -{ - struct htc_service_connreq connect; - int ret; - - wmi->htc = htc; - - memset(&connect, 0, sizeof(connect)); - - connect.ep_callbacks.priv = wmi; - connect.ep_callbacks.tx = ath9k_wmi_ctrl_tx; - connect.ep_callbacks.rx = ath9k_wmi_ctrl_rx; - connect.service_id = WMI_CONTROL_SVC; - - ret = htc_connect_service(htc, &connect, &wmi->ctrl_epid); - if (ret) - return ret; - - *wmi_ctrl_epid = wmi->ctrl_epid; - - return 0; -} - -static int ath9k_wmi_cmd_issue(struct wmi *wmi, - struct sk_buff *skb, - enum wmi_cmd_id cmd, u16 len) -{ - struct wmi_cmd_hdr *hdr; - - hdr = (struct wmi_cmd_hdr *) skb_push(skb, sizeof(struct wmi_cmd_hdr)); - hdr->command_id = cpu_to_be16(cmd); - hdr->seq_no = cpu_to_be16(++wmi->tx_seq_id); - - return htc_send_epid(wmi->htc, skb, wmi->ctrl_epid); -} - -int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, - u8 *cmd_buf, u32 cmd_len, - u8 *rsp_buf, u32 rsp_len, - u32 timeout) -{ - struct ath_hw *ah = wmi->drv_priv->ah; - struct ath_common *common = ath9k_hw_common(ah); - u16 headroom = sizeof(struct htc_frame_hdr) + - sizeof(struct wmi_cmd_hdr); - struct sk_buff *skb; - u8 *data; - int time_left, ret = 0; - unsigned long flags; - - if (ah->ah_flags & AH_UNPLUGGED) - return 0; - - skb = alloc_skb(headroom + cmd_len, GFP_ATOMIC); - if (!skb) - return -ENOMEM; - - skb_reserve(skb, headroom); - - if (cmd_len != 0 && cmd_buf != NULL) { - data = (u8 *) skb_put(skb, cmd_len); - memcpy(data, cmd_buf, cmd_len); - } - - mutex_lock(&wmi->op_mutex); - - /* check if wmi stopped flag is set */ - if (unlikely(wmi->stopped)) { - ret = -EPROTO; - goto out; - } - - /* record the rsp buffer and length */ - wmi->cmd_rsp_buf = rsp_buf; - wmi->cmd_rsp_len = rsp_len; - - spin_lock_irqsave(&wmi->wmi_lock, flags); - wmi->last_cmd_id = cmd_id; - spin_unlock_irqrestore(&wmi->wmi_lock, flags); - - ret = ath9k_wmi_cmd_issue(wmi, skb, cmd_id, cmd_len); - if (ret) - goto out; - - time_left = wait_for_completion_timeout(&wmi->cmd_wait, timeout); - if (!time_left) { - ath_dbg(common, WMI, "Timeout waiting for WMI command: %s\n", - wmi_cmd_to_name(cmd_id)); - mutex_unlock(&wmi->op_mutex); - return -ETIMEDOUT; - } - - mutex_unlock(&wmi->op_mutex); - - return 0; - -out: - ath_dbg(common, WMI, "WMI failure for: %s\n", wmi_cmd_to_name(cmd_id)); - mutex_unlock(&wmi->op_mutex); - kfree_skb(skb); - - return ret; -} diff --git a/drivers/net/wireless/ath/ath9k/wmi.h b/drivers/net/wireless/ath/ath9k/wmi.h deleted file mode 100644 index fde6da619f30..000000000000 --- a/drivers/net/wireless/ath/ath9k/wmi.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2010-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef WMI_H -#define WMI_H - -struct wmi_event_txrate { - __be32 txrate; - struct { - u8 rssi_thresh; - u8 per; - } rc_stats; -} __packed; - -struct wmi_cmd_hdr { - __be16 command_id; - __be16 seq_no; -} __packed; - -struct wmi_fw_version { - __be16 major; - __be16 minor; - -} __packed; - -struct wmi_event_swba { - __be64 tsf; - u8 beacon_pending; -}; - -/* - * 64 - HTC header - WMI header - 1 / txstatus - * And some other hdr. space is also accounted for. - * 12 seems to be the magic number. - */ -#define HTC_MAX_TX_STATUS 12 - -#define ATH9K_HTC_TXSTAT_ACK BIT(0) -#define ATH9K_HTC_TXSTAT_FILT BIT(1) -#define ATH9K_HTC_TXSTAT_RTC_CTS BIT(2) -#define ATH9K_HTC_TXSTAT_MCS BIT(3) -#define ATH9K_HTC_TXSTAT_CW40 BIT(4) -#define ATH9K_HTC_TXSTAT_SGI BIT(5) - -/* - * Legacy rates are indicated as indices. - * HT rates are indicated as dot11 numbers. - * This allows us to resrict the rate field - * to 4 bits. - */ -#define ATH9K_HTC_TXSTAT_RATE 0x0f -#define ATH9K_HTC_TXSTAT_RATE_S 0 - -#define ATH9K_HTC_TXSTAT_EPID 0xf0 -#define ATH9K_HTC_TXSTAT_EPID_S 4 - -struct __wmi_event_txstatus { - u8 cookie; - u8 ts_rate; /* Also holds EP ID */ - u8 ts_flags; -}; - -struct wmi_event_txstatus { - u8 cnt; - struct __wmi_event_txstatus txstatus[HTC_MAX_TX_STATUS]; -} __packed; - -enum wmi_cmd_id { - WMI_ECHO_CMDID = 0x0001, - WMI_ACCESS_MEMORY_CMDID, - - /* Commands to Target */ - WMI_GET_FW_VERSION, - WMI_DISABLE_INTR_CMDID, - WMI_ENABLE_INTR_CMDID, - WMI_ATH_INIT_CMDID, - WMI_ABORT_TXQ_CMDID, - WMI_STOP_TX_DMA_CMDID, - WMI_ABORT_TX_DMA_CMDID, - WMI_DRAIN_TXQ_CMDID, - WMI_DRAIN_TXQ_ALL_CMDID, - WMI_START_RECV_CMDID, - WMI_STOP_RECV_CMDID, - WMI_FLUSH_RECV_CMDID, - WMI_SET_MODE_CMDID, - WMI_NODE_CREATE_CMDID, - WMI_NODE_REMOVE_CMDID, - WMI_VAP_REMOVE_CMDID, - WMI_VAP_CREATE_CMDID, - WMI_REG_READ_CMDID, - WMI_REG_WRITE_CMDID, - WMI_RC_STATE_CHANGE_CMDID, - WMI_RC_RATE_UPDATE_CMDID, - WMI_TARGET_IC_UPDATE_CMDID, - WMI_TX_AGGR_ENABLE_CMDID, - WMI_TGT_DETACH_CMDID, - WMI_NODE_UPDATE_CMDID, - WMI_INT_STATS_CMDID, - WMI_TX_STATS_CMDID, - WMI_RX_STATS_CMDID, - WMI_BITRATE_MASK_CMDID, -}; - -enum wmi_event_id { - WMI_TGT_RDY_EVENTID = 0x1001, - WMI_SWBA_EVENTID, - WMI_FATAL_EVENTID, - WMI_TXTO_EVENTID, - WMI_BMISS_EVENTID, - WMI_DELBA_EVENTID, - WMI_TXSTATUS_EVENTID, -}; - -#define MAX_CMD_NUMBER 62 - -struct register_write { - __be32 reg; - __be32 val; -}; - -struct ath9k_htc_tx_event { - int count; - struct __wmi_event_txstatus txs; - struct list_head list; -}; - -struct wmi { - struct ath9k_htc_priv *drv_priv; - struct htc_target *htc; - enum htc_endpoint_id ctrl_epid; - struct mutex op_mutex; - struct completion cmd_wait; - enum wmi_cmd_id last_cmd_id; - struct sk_buff_head wmi_event_queue; - struct tasklet_struct wmi_event_tasklet; - u16 tx_seq_id; - u8 *cmd_rsp_buf; - u32 cmd_rsp_len; - bool stopped; - - struct list_head pending_tx_events; - spinlock_t event_lock; - - spinlock_t wmi_lock; - - atomic_t mwrite_cnt; - struct register_write multi_write[MAX_CMD_NUMBER]; - u32 multi_write_idx; - struct mutex multi_write_mutex; -}; - -struct wmi *ath9k_init_wmi(struct ath9k_htc_priv *priv); -void ath9k_deinit_wmi(struct ath9k_htc_priv *priv); -int ath9k_wmi_connect(struct htc_target *htc, struct wmi *wmi, - enum htc_endpoint_id *wmi_ctrl_epid); -int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, - u8 *cmd_buf, u32 cmd_len, - u8 *rsp_buf, u32 rsp_len, - u32 timeout); -void ath9k_wmi_event_tasklet(unsigned long data); -void ath9k_fatal_work(struct work_struct *work); -void ath9k_wmi_event_drain(struct ath9k_htc_priv *priv); - -#define WMI_CMD(_wmi_cmd) \ - do { \ - ret = ath9k_wmi_cmd(priv->wmi, _wmi_cmd, NULL, 0, \ - (u8 *) &cmd_rsp, \ - sizeof(cmd_rsp), HZ*2); \ - } while (0) - -#define WMI_CMD_BUF(_wmi_cmd, _buf) \ - do { \ - ret = ath9k_wmi_cmd(priv->wmi, _wmi_cmd, \ - (u8 *) _buf, sizeof(*_buf), \ - &cmd_rsp, sizeof(cmd_rsp), HZ*2); \ - } while (0) - -#endif /* WMI_H */ diff --git a/drivers/net/wireless/ath/ath9k/wow.c b/drivers/net/wireless/ath/ath9k/wow.c deleted file mode 100644 index 9f8563091bea..000000000000 --- a/drivers/net/wireless/ath/ath9k/wow.c +++ /dev/null @@ -1,532 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "ath9k.h" -#include "reg.h" -#include "hw-ops.h" - -const char *ath9k_hw_wow_event_to_string(u32 wow_event) -{ - if (wow_event & AH_WOW_MAGIC_PATTERN_EN) - return "Magic pattern"; - if (wow_event & AH_WOW_USER_PATTERN_EN) - return "User pattern"; - if (wow_event & AH_WOW_LINK_CHANGE) - return "Link change"; - if (wow_event & AH_WOW_BEACON_MISS) - return "Beacon miss"; - - return "unknown reason"; -} -EXPORT_SYMBOL(ath9k_hw_wow_event_to_string); - -static void ath9k_hw_config_serdes_wow_sleep(struct ath_hw *ah) -{ - int i; - - for (i = 0; i < ah->iniPcieSerdesWow.ia_rows; i++) - REG_WRITE(ah, INI_RA(&ah->iniPcieSerdesWow, i, 0), - INI_RA(&ah->iniPcieSerdesWow, i, 1)); - - usleep_range(1000, 1500); -} - -static void ath9k_hw_set_powermode_wow_sleep(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - - REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV); - - /* set rx disable bit */ - REG_WRITE(ah, AR_CR, AR_CR_RXD); - - if (!ath9k_hw_wait(ah, AR_CR, AR_CR_RXE, 0, AH_WAIT_TIMEOUT)) { - ath_err(common, "Failed to stop Rx DMA in 10ms AR_CR=0x%08x AR_DIAG_SW=0x%08x\n", - REG_READ(ah, AR_CR), REG_READ(ah, AR_DIAG_SW)); - return; - } else { - if (!AR_SREV_9300_20_OR_LATER(ah)) - REG_WRITE(ah, AR_RXDP, 0x0); - } - - /* AR9280 WoW has sleep issue, do not set it to sleep */ - if (AR_SREV_9280_20(ah)) - return; - - REG_WRITE(ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_ON_INT); -} - -static void ath9k_wow_create_keep_alive_pattern(struct ath_hw *ah) -{ - struct ath_common *common = ath9k_hw_common(ah); - u8 sta_mac_addr[ETH_ALEN], ap_mac_addr[ETH_ALEN]; - u32 ctl[13] = {0}; - u32 data_word[KAL_NUM_DATA_WORDS]; - u8 i; - u32 wow_ka_data_word0; - - memcpy(sta_mac_addr, common->macaddr, ETH_ALEN); - memcpy(ap_mac_addr, common->curbssid, ETH_ALEN); - - /* set the transmit buffer */ - ctl[0] = (KAL_FRAME_LEN | (MAX_RATE_POWER << 16)); - - if (!(AR_SREV_9300_20_OR_LATER(ah))) - ctl[0] += (KAL_ANTENNA_MODE << 25); - - ctl[1] = 0; - ctl[3] = 0xb; /* OFDM_6M hardware value for this rate */ - ctl[4] = 0; - ctl[7] = (ah->txchainmask) << 2; - - if (AR_SREV_9300_20_OR_LATER(ah)) - ctl[2] = 0xf << 16; /* tx_tries 0 */ - else - ctl[2] = 0x7 << 16; /* tx_tries 0 */ - - - for (i = 0; i < KAL_NUM_DESC_WORDS; i++) - REG_WRITE(ah, (AR_WOW_KA_DESC_WORD2 + i * 4), ctl[i]); - - /* for AR9300 family 13 descriptor words */ - if (AR_SREV_9300_20_OR_LATER(ah)) - REG_WRITE(ah, (AR_WOW_KA_DESC_WORD2 + i * 4), ctl[i]); - - data_word[0] = (KAL_FRAME_TYPE << 2) | (KAL_FRAME_SUB_TYPE << 4) | - (KAL_TO_DS << 8) | (KAL_DURATION_ID << 16); - data_word[1] = (ap_mac_addr[3] << 24) | (ap_mac_addr[2] << 16) | - (ap_mac_addr[1] << 8) | (ap_mac_addr[0]); - data_word[2] = (sta_mac_addr[1] << 24) | (sta_mac_addr[0] << 16) | - (ap_mac_addr[5] << 8) | (ap_mac_addr[4]); - data_word[3] = (sta_mac_addr[5] << 24) | (sta_mac_addr[4] << 16) | - (sta_mac_addr[3] << 8) | (sta_mac_addr[2]); - data_word[4] = (ap_mac_addr[3] << 24) | (ap_mac_addr[2] << 16) | - (ap_mac_addr[1] << 8) | (ap_mac_addr[0]); - data_word[5] = (ap_mac_addr[5] << 8) | (ap_mac_addr[4]); - - if (AR_SREV_9462_20(ah)) { - /* AR9462 2.0 has an extra descriptor word (time based - * discard) compared to other chips */ - REG_WRITE(ah, (AR_WOW_KA_DESC_WORD2 + (12 * 4)), 0); - wow_ka_data_word0 = AR_WOW_TXBUF(13); - } else { - wow_ka_data_word0 = AR_WOW_TXBUF(12); - } - - for (i = 0; i < KAL_NUM_DATA_WORDS; i++) - REG_WRITE(ah, (wow_ka_data_word0 + i*4), data_word[i]); - -} - -void ath9k_hw_wow_apply_pattern(struct ath_hw *ah, u8 *user_pattern, - u8 *user_mask, int pattern_count, - int pattern_len) -{ - int i; - u32 pattern_val, mask_val; - u32 set, clr; - - /* FIXME: should check count by querying the hardware capability */ - if (pattern_count >= MAX_NUM_PATTERN) - return; - - REG_SET_BIT(ah, AR_WOW_PATTERN, BIT(pattern_count)); - - /* set the registers for pattern */ - for (i = 0; i < MAX_PATTERN_SIZE; i += 4) { - memcpy(&pattern_val, user_pattern, 4); - REG_WRITE(ah, (AR_WOW_TB_PATTERN(pattern_count) + i), - pattern_val); - user_pattern += 4; - } - - /* set the registers for mask */ - for (i = 0; i < MAX_PATTERN_MASK_SIZE; i += 4) { - memcpy(&mask_val, user_mask, 4); - REG_WRITE(ah, (AR_WOW_TB_MASK(pattern_count) + i), mask_val); - user_mask += 4; - } - - /* set the pattern length to be matched - * - * AR_WOW_LENGTH1_REG1 - * bit 31:24 pattern 0 length - * bit 23:16 pattern 1 length - * bit 15:8 pattern 2 length - * bit 7:0 pattern 3 length - * - * AR_WOW_LENGTH1_REG2 - * bit 31:24 pattern 4 length - * bit 23:16 pattern 5 length - * bit 15:8 pattern 6 length - * bit 7:0 pattern 7 length - * - * the below logic writes out the new - * pattern length for the corresponding - * pattern_count, while masking out the - * other fields - */ - - ah->wow_event_mask |= BIT(pattern_count + AR_WOW_PAT_FOUND_SHIFT); - - if (!AR_SREV_9285_12_OR_LATER(ah)) - return; - - if (pattern_count < 4) { - /* Pattern 0-3 uses AR_WOW_LENGTH1 register */ - set = (pattern_len & AR_WOW_LENGTH_MAX) << - AR_WOW_LEN1_SHIFT(pattern_count); - clr = AR_WOW_LENGTH1_MASK(pattern_count); - REG_RMW(ah, AR_WOW_LENGTH1, set, clr); - } else { - /* Pattern 4-7 uses AR_WOW_LENGTH2 register */ - set = (pattern_len & AR_WOW_LENGTH_MAX) << - AR_WOW_LEN2_SHIFT(pattern_count); - clr = AR_WOW_LENGTH2_MASK(pattern_count); - REG_RMW(ah, AR_WOW_LENGTH2, set, clr); - } - -} -EXPORT_SYMBOL(ath9k_hw_wow_apply_pattern); - -u32 ath9k_hw_wow_wakeup(struct ath_hw *ah) -{ - u32 wow_status = 0; - u32 val = 0, rval; - /* - * read the WoW status register to know - * the wakeup reason - */ - rval = REG_READ(ah, AR_WOW_PATTERN); - val = AR_WOW_STATUS(rval); - - /* - * mask only the WoW events that we have enabled. Sometimes - * we have spurious WoW events from the AR_WOW_PATTERN - * register. This mask will clean it up. - */ - - val &= ah->wow_event_mask; - - if (val) { - - if (val & AR_WOW_MAGIC_PAT_FOUND) - wow_status |= AH_WOW_MAGIC_PATTERN_EN; - - if (AR_WOW_PATTERN_FOUND(val)) - wow_status |= AH_WOW_USER_PATTERN_EN; - - if (val & AR_WOW_KEEP_ALIVE_FAIL) - wow_status |= AH_WOW_LINK_CHANGE; - - if (val & AR_WOW_BEACON_FAIL) - wow_status |= AH_WOW_BEACON_MISS; - - } - - /* - * set and clear WOW_PME_CLEAR registers for the chip to - * generate next wow signal. - * disable D3 before accessing other registers ? - */ - - /* do we need to check the bit value 0x01000000 (7-10) ?? */ - REG_RMW(ah, AR_PCIE_PM_CTRL, AR_PMCTRL_WOW_PME_CLR, - AR_PMCTRL_PWR_STATE_D1D3); - - /* - * clear all events - */ - REG_WRITE(ah, AR_WOW_PATTERN, - AR_WOW_CLEAR_EVENTS(REG_READ(ah, AR_WOW_PATTERN))); - - /* - * tie reset register for AR9002 family of chipsets - * NB: not tieing it back might have some repurcussions. - */ - - if (!AR_SREV_9300_20_OR_LATER(ah)) { - REG_SET_BIT(ah, AR_WA, AR_WA_UNTIE_RESET_EN | - AR_WA_POR_SHORT | AR_WA_RESET_EN); - } - - - /* - * restore the beacon threshold to init value - */ - REG_WRITE(ah, AR_RSSI_THR, INIT_RSSI_THR); - - /* - * Restore the way the PCI-E reset, Power-On-Reset, external - * PCIE_POR_SHORT pins are tied to its original value. - * Previously just before WoW sleep, we untie the PCI-E - * reset to our Chip's Power On Reset so that any PCI-E - * reset from the bus will not reset our chip - */ - - if (AR_SREV_9280_20_OR_LATER(ah) && ah->is_pciexpress) - ath9k_hw_configpcipowersave(ah, false); - - ah->wow_event_mask = 0; - - return wow_status; -} -EXPORT_SYMBOL(ath9k_hw_wow_wakeup); - -void ath9k_hw_wow_enable(struct ath_hw *ah, u32 pattern_enable) -{ - u32 wow_event_mask; - u32 set, clr; - - /* - * wow_event_mask is a mask to the AR_WOW_PATTERN register to - * indicate which WoW events we have enabled. The WoW events - * are from the 'pattern_enable' in this function and - * 'pattern_count' of ath9k_hw_wow_apply_pattern() - */ - - wow_event_mask = ah->wow_event_mask; - - /* - * Untie Power-on-Reset from the PCI-E-Reset. When we are in - * WOW sleep, we do want the Reset from the PCI-E to disturb - * our hw state - */ - - if (ah->is_pciexpress) { - - /* - * we need to untie the internal POR (power-on-reset) - * to the external PCI-E reset. We also need to tie - * the PCI-E Phy reset to the PCI-E reset. - */ - - if (AR_SREV_9300_20_OR_LATER(ah)) { - set = AR_WA_RESET_EN | AR_WA_POR_SHORT; - clr = AR_WA_UNTIE_RESET_EN | AR_WA_D3_L1_DISABLE; - REG_RMW(ah, AR_WA, set, clr); - } else { - if (AR_SREV_9285(ah) || AR_SREV_9287(ah)) - set = AR9285_WA_DEFAULT; - else - set = AR9280_WA_DEFAULT; - - /* - * In AR9280 and AR9285, bit 14 in WA register - * (disable L1) should only be set when device - * enters D3 state and be cleared when device - * comes back to D0 - */ - - if (ah->config.pcie_waen & AR_WA_D3_L1_DISABLE) - set |= AR_WA_D3_L1_DISABLE; - - clr = AR_WA_UNTIE_RESET_EN; - set |= AR_WA_RESET_EN | AR_WA_POR_SHORT; - REG_RMW(ah, AR_WA, set, clr); - - /* - * for WoW sleep, we reprogram the SerDes so that the - * PLL and CLK REQ are both enabled. This uses more - * power but otherwise WoW sleep is unstable and the - * chip may disappear. - */ - - if (AR_SREV_9285_12_OR_LATER(ah)) - ath9k_hw_config_serdes_wow_sleep(ah); - - } - } - - /* - * set the power states appropriately and enable PME - */ - set = AR_PMCTRL_HOST_PME_EN | AR_PMCTRL_PWR_PM_CTRL_ENA | - AR_PMCTRL_AUX_PWR_DET | AR_PMCTRL_WOW_PME_CLR; - - /* - * set and clear WOW_PME_CLEAR registers for the chip - * to generate next wow signal. - */ - REG_SET_BIT(ah, AR_PCIE_PM_CTRL, set); - clr = AR_PMCTRL_WOW_PME_CLR; - REG_CLR_BIT(ah, AR_PCIE_PM_CTRL, clr); - - /* - * Setup for: - * - beacon misses - * - magic pattern - * - keep alive timeout - * - pattern matching - */ - - /* - * Program default values for pattern backoff, aifs/slot/KAL count, - * beacon miss timeout, KAL timeout, etc. - */ - - set = AR_WOW_BACK_OFF_SHIFT(AR_WOW_PAT_BACKOFF); - REG_SET_BIT(ah, AR_WOW_PATTERN, set); - - set = AR_WOW_AIFS_CNT(AR_WOW_CNT_AIFS_CNT) | - AR_WOW_SLOT_CNT(AR_WOW_CNT_SLOT_CNT) | - AR_WOW_KEEP_ALIVE_CNT(AR_WOW_CNT_KA_CNT); - REG_SET_BIT(ah, AR_WOW_COUNT, set); - - if (pattern_enable & AH_WOW_BEACON_MISS) - set = AR_WOW_BEACON_TIMO; - /* We are not using beacon miss, program a large value */ - else - set = AR_WOW_BEACON_TIMO_MAX; - - REG_WRITE(ah, AR_WOW_BCN_TIMO, set); - - /* - * Keep alive timo in ms except AR9280 - */ - if (!pattern_enable || AR_SREV_9280(ah)) - set = AR_WOW_KEEP_ALIVE_NEVER; - else - set = KAL_TIMEOUT * 32; - - REG_WRITE(ah, AR_WOW_KEEP_ALIVE_TIMO, set); - - /* - * Keep alive delay in us. based on 'power on clock', - * therefore in usec - */ - set = KAL_DELAY * 1000; - REG_WRITE(ah, AR_WOW_KEEP_ALIVE_DELAY, set); - - /* - * Create keep alive pattern to respond to beacons - */ - ath9k_wow_create_keep_alive_pattern(ah); - - /* - * Configure MAC WoW Registers - */ - - set = 0; - /* Send keep alive timeouts anyway */ - clr = AR_WOW_KEEP_ALIVE_AUTO_DIS; - - if (pattern_enable & AH_WOW_LINK_CHANGE) - wow_event_mask |= AR_WOW_KEEP_ALIVE_FAIL; - else - set = AR_WOW_KEEP_ALIVE_FAIL_DIS; - - /* - * FIXME: For now disable keep alive frame - * failure. This seems to sometimes trigger - * unnecessary wake up with AR9485 chipsets. - */ - set = AR_WOW_KEEP_ALIVE_FAIL_DIS; - - REG_RMW(ah, AR_WOW_KEEP_ALIVE, set, clr); - - - /* - * we are relying on a bmiss failure. ensure we have - * enough threshold to prevent false positives - */ - REG_RMW_FIELD(ah, AR_RSSI_THR, AR_RSSI_THR_BM_THR, - AR_WOW_BMISSTHRESHOLD); - - set = 0; - clr = 0; - - if (pattern_enable & AH_WOW_BEACON_MISS) { - set = AR_WOW_BEACON_FAIL_EN; - wow_event_mask |= AR_WOW_BEACON_FAIL; - } else { - clr = AR_WOW_BEACON_FAIL_EN; - } - - REG_RMW(ah, AR_WOW_BCN_EN, set, clr); - - set = 0; - clr = 0; - /* - * Enable the magic packet registers - */ - if (pattern_enable & AH_WOW_MAGIC_PATTERN_EN) { - set = AR_WOW_MAGIC_EN; - wow_event_mask |= AR_WOW_MAGIC_PAT_FOUND; - } else { - clr = AR_WOW_MAGIC_EN; - } - set |= AR_WOW_MAC_INTR_EN; - REG_RMW(ah, AR_WOW_PATTERN, set, clr); - - /* - * For AR9285 and later version of chipsets - * enable WoW pattern match for packets less - * than 256 bytes for all patterns - */ - if (AR_SREV_9285_12_OR_LATER(ah)) - REG_WRITE(ah, AR_WOW_PATTERN_MATCH_LT_256B, - AR_WOW_PATTERN_SUPPORTED); - - /* - * Set the power states appropriately and enable PME - */ - clr = 0; - set = AR_PMCTRL_PWR_STATE_D1D3 | AR_PMCTRL_HOST_PME_EN | - AR_PMCTRL_PWR_PM_CTRL_ENA; - /* - * This is needed for AR9300 chipsets to wake-up - * the host. - */ - if (AR_SREV_9300_20_OR_LATER(ah)) - clr = AR_PCIE_PM_CTRL_ENA; - - REG_RMW(ah, AR_PCIE_PM_CTRL, set, clr); - - if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) { - /* - * this is needed to prevent the chip waking up - * the host within 3-4 seconds with certain - * platform/BIOS. The fix is to enable - * D1 & D3 to match original definition and - * also match the OTP value. Anyway this - * is more related to SW WOW. - */ - clr = AR_PMCTRL_PWR_STATE_D1D3; - REG_CLR_BIT(ah, AR_PCIE_PM_CTRL, clr); - - set = AR_PMCTRL_PWR_STATE_D1D3_REAL; - REG_SET_BIT(ah, AR_PCIE_PM_CTRL, set); - } - - - - REG_CLR_BIT(ah, AR_STA_ID1, AR_STA_ID1_PRESERVE_SEQNUM); - - if (AR_SREV_9300_20_OR_LATER(ah)) { - /* to bring down WOW power low margin */ - set = BIT(13); - REG_SET_BIT(ah, AR_PCIE_PHY_REG3, set); - /* HW WoW */ - clr = BIT(5); - REG_CLR_BIT(ah, AR_PCU_MISC_MODE3, clr); - } - - ath9k_hw_set_powermode_wow_sleep(ah); - ah->wow_event_mask = wow_event_mask; -} -EXPORT_SYMBOL(ath9k_hw_wow_enable); diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c deleted file mode 100644 index e752f5d4995d..000000000000 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ /dev/null @@ -1,2426 +0,0 @@ -/* - * Copyright (c) 2008-2011 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "ath9k.h" -#include "ar9003_mac.h" - -#define BITS_PER_BYTE 8 -#define OFDM_PLCP_BITS 22 -#define HT_RC_2_STREAMS(_rc) ((((_rc) & 0x78) >> 3) + 1) -#define L_STF 8 -#define L_LTF 8 -#define L_SIG 4 -#define HT_SIG 8 -#define HT_STF 4 -#define HT_LTF(_ns) (4 * (_ns)) -#define SYMBOL_TIME(_ns) ((_ns) << 2) /* ns * 4 us */ -#define SYMBOL_TIME_HALFGI(_ns) (((_ns) * 18 + 4) / 5) /* ns * 3.6 us */ -#define TIME_SYMBOLS(t) ((t) >> 2) -#define TIME_SYMBOLS_HALFGI(t) (((t) * 5 - 4) / 18) -#define NUM_SYMBOLS_PER_USEC(_usec) (_usec >> 2) -#define NUM_SYMBOLS_PER_USEC_HALFGI(_usec) (((_usec*5)-4)/18) - - -static u16 bits_per_symbol[][2] = { - /* 20MHz 40MHz */ - { 26, 54 }, /* 0: BPSK */ - { 52, 108 }, /* 1: QPSK 1/2 */ - { 78, 162 }, /* 2: QPSK 3/4 */ - { 104, 216 }, /* 3: 16-QAM 1/2 */ - { 156, 324 }, /* 4: 16-QAM 3/4 */ - { 208, 432 }, /* 5: 64-QAM 2/3 */ - { 234, 486 }, /* 6: 64-QAM 3/4 */ - { 260, 540 }, /* 7: 64-QAM 5/6 */ -}; - -#define IS_HT_RATE(_rate) ((_rate) & 0x80) - -static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, - struct ath_atx_tid *tid, struct sk_buff *skb); -static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, - int tx_flags, struct ath_txq *txq); -static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, - struct ath_txq *txq, struct list_head *bf_q, - struct ath_tx_status *ts, int txok); -static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, - struct list_head *head, bool internal); -static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, - struct ath_tx_status *ts, int nframes, int nbad, - int txok); -static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, - int seqno); -static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, - struct ath_txq *txq, - struct ath_atx_tid *tid, - struct sk_buff *skb); - -enum { - MCS_HT20, - MCS_HT20_SGI, - MCS_HT40, - MCS_HT40_SGI, -}; - -/*********************/ -/* Aggregation logic */ -/*********************/ - -void ath_txq_lock(struct ath_softc *sc, struct ath_txq *txq) - __acquires(&txq->axq_lock) -{ - spin_lock_bh(&txq->axq_lock); -} - -void ath_txq_unlock(struct ath_softc *sc, struct ath_txq *txq) - __releases(&txq->axq_lock) -{ - spin_unlock_bh(&txq->axq_lock); -} - -void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq) - __releases(&txq->axq_lock) -{ - struct sk_buff_head q; - struct sk_buff *skb; - - __skb_queue_head_init(&q); - skb_queue_splice_init(&txq->complete_q, &q); - spin_unlock_bh(&txq->axq_lock); - - while ((skb = __skb_dequeue(&q))) - ieee80211_tx_status(sc->hw, skb); -} - -static void ath_tx_queue_tid(struct ath_txq *txq, struct ath_atx_tid *tid) -{ - struct ath_atx_ac *ac = tid->ac; - - if (tid->paused) - return; - - if (tid->sched) - return; - - tid->sched = true; - list_add_tail(&tid->list, &ac->tid_q); - - if (ac->sched) - return; - - ac->sched = true; - list_add_tail(&ac->list, &txq->axq_acq); -} - -static struct ath_frame_info *get_frame_info(struct sk_buff *skb) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - BUILD_BUG_ON(sizeof(struct ath_frame_info) > - sizeof(tx_info->rate_driver_data)); - return (struct ath_frame_info *) &tx_info->rate_driver_data[0]; -} - -static void ath_send_bar(struct ath_atx_tid *tid, u16 seqno) -{ - ieee80211_send_bar(tid->an->vif, tid->an->sta->addr, tid->tidno, - seqno << IEEE80211_SEQ_SEQ_SHIFT); -} - -static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ath_buf *bf) -{ - ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates, - ARRAY_SIZE(bf->rates)); -} - -static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) -{ - struct ath_txq *txq = tid->ac->txq; - struct sk_buff *skb; - struct ath_buf *bf; - struct list_head bf_head; - struct ath_tx_status ts; - struct ath_frame_info *fi; - bool sendbar = false; - - INIT_LIST_HEAD(&bf_head); - - memset(&ts, 0, sizeof(ts)); - - while ((skb = __skb_dequeue(&tid->buf_q))) { - fi = get_frame_info(skb); - bf = fi->bf; - - if (!bf) { - bf = ath_tx_setup_buffer(sc, txq, tid, skb); - if (!bf) { - ieee80211_free_txskb(sc->hw, skb); - continue; - } - } - - if (fi->retries) { - list_add_tail(&bf->list, &bf_head); - ath_tx_update_baw(sc, tid, bf->bf_state.seqno); - ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); - sendbar = true; - } else { - ath_set_rates(tid->an->vif, tid->an->sta, bf); - ath_tx_send_normal(sc, txq, NULL, skb); - } - } - - if (sendbar) { - ath_txq_unlock(sc, txq); - ath_send_bar(tid, tid->seq_start); - ath_txq_lock(sc, txq); - } -} - -static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, - int seqno) -{ - int index, cindex; - - index = ATH_BA_INDEX(tid->seq_start, seqno); - cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); - - __clear_bit(cindex, tid->tx_buf); - - while (tid->baw_head != tid->baw_tail && !test_bit(tid->baw_head, tid->tx_buf)) { - INCR(tid->seq_start, IEEE80211_SEQ_MAX); - INCR(tid->baw_head, ATH_TID_MAX_BUFS); - if (tid->bar_index >= 0) - tid->bar_index--; - } -} - -static void ath_tx_addto_baw(struct ath_softc *sc, struct ath_atx_tid *tid, - u16 seqno) -{ - int index, cindex; - - index = ATH_BA_INDEX(tid->seq_start, seqno); - cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); - __set_bit(cindex, tid->tx_buf); - - if (index >= ((tid->baw_tail - tid->baw_head) & - (ATH_TID_MAX_BUFS - 1))) { - tid->baw_tail = cindex; - INCR(tid->baw_tail, ATH_TID_MAX_BUFS); - } -} - -/* - * TODO: For frame(s) that are in the retry state, we will reuse the - * sequence number(s) without setting the retry bit. The - * alternative is to give up on these and BAR the receiver's window - * forward. - */ -static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq, - struct ath_atx_tid *tid) - -{ - struct sk_buff *skb; - struct ath_buf *bf; - struct list_head bf_head; - struct ath_tx_status ts; - struct ath_frame_info *fi; - - memset(&ts, 0, sizeof(ts)); - INIT_LIST_HEAD(&bf_head); - - while ((skb = __skb_dequeue(&tid->buf_q))) { - fi = get_frame_info(skb); - bf = fi->bf; - - if (!bf) { - ath_tx_complete(sc, skb, ATH_TX_ERROR, txq); - continue; - } - - list_add_tail(&bf->list, &bf_head); - - ath_tx_update_baw(sc, tid, bf->bf_state.seqno); - ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); - } - - tid->seq_next = tid->seq_start; - tid->baw_tail = tid->baw_head; - tid->bar_index = -1; -} - -static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq, - struct sk_buff *skb, int count) -{ - struct ath_frame_info *fi = get_frame_info(skb); - struct ath_buf *bf = fi->bf; - struct ieee80211_hdr *hdr; - int prev = fi->retries; - - TX_STAT_INC(txq->axq_qnum, a_retries); - fi->retries += count; - - if (prev > 0) - return; - - hdr = (struct ieee80211_hdr *)skb->data; - hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_RETRY); - dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, - sizeof(*hdr), DMA_TO_DEVICE); -} - -static struct ath_buf *ath_tx_get_buffer(struct ath_softc *sc) -{ - struct ath_buf *bf = NULL; - - spin_lock_bh(&sc->tx.txbuflock); - - if (unlikely(list_empty(&sc->tx.txbuf))) { - spin_unlock_bh(&sc->tx.txbuflock); - return NULL; - } - - bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list); - list_del(&bf->list); - - spin_unlock_bh(&sc->tx.txbuflock); - - return bf; -} - -static void ath_tx_return_buffer(struct ath_softc *sc, struct ath_buf *bf) -{ - spin_lock_bh(&sc->tx.txbuflock); - list_add_tail(&bf->list, &sc->tx.txbuf); - spin_unlock_bh(&sc->tx.txbuflock); -} - -static struct ath_buf* ath_clone_txbuf(struct ath_softc *sc, struct ath_buf *bf) -{ - struct ath_buf *tbf; - - tbf = ath_tx_get_buffer(sc); - if (WARN_ON(!tbf)) - return NULL; - - ATH_TXBUF_RESET(tbf); - - tbf->bf_mpdu = bf->bf_mpdu; - tbf->bf_buf_addr = bf->bf_buf_addr; - memcpy(tbf->bf_desc, bf->bf_desc, sc->sc_ah->caps.tx_desc_len); - tbf->bf_state = bf->bf_state; - - return tbf; -} - -static void ath_tx_count_frames(struct ath_softc *sc, struct ath_buf *bf, - struct ath_tx_status *ts, int txok, - int *nframes, int *nbad) -{ - struct ath_frame_info *fi; - u16 seq_st = 0; - u32 ba[WME_BA_BMP_SIZE >> 5]; - int ba_index; - int isaggr = 0; - - *nbad = 0; - *nframes = 0; - - isaggr = bf_isaggr(bf); - if (isaggr) { - seq_st = ts->ts_seqnum; - memcpy(ba, &ts->ba_low, WME_BA_BMP_SIZE >> 3); - } - - while (bf) { - fi = get_frame_info(bf->bf_mpdu); - ba_index = ATH_BA_INDEX(seq_st, bf->bf_state.seqno); - - (*nframes)++; - if (!txok || (isaggr && !ATH_BA_ISSET(ba, ba_index))) - (*nbad)++; - - bf = bf->bf_next; - } -} - - -static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, - struct ath_buf *bf, struct list_head *bf_q, - struct ath_tx_status *ts, int txok) -{ - struct ath_node *an = NULL; - struct sk_buff *skb; - struct ieee80211_sta *sta; - struct ieee80211_hw *hw = sc->hw; - struct ieee80211_hdr *hdr; - struct ieee80211_tx_info *tx_info; - struct ath_atx_tid *tid = NULL; - struct ath_buf *bf_next, *bf_last = bf->bf_lastbf; - struct list_head bf_head; - struct sk_buff_head bf_pending; - u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0, seq_first; - u32 ba[WME_BA_BMP_SIZE >> 5]; - int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0; - bool rc_update = true, isba; - struct ieee80211_tx_rate rates[4]; - struct ath_frame_info *fi; - int nframes; - u8 tidno; - bool flush = !!(ts->ts_status & ATH9K_TX_FLUSH); - int i, retries; - int bar_index = -1; - - skb = bf->bf_mpdu; - hdr = (struct ieee80211_hdr *)skb->data; - - tx_info = IEEE80211_SKB_CB(skb); - - memcpy(rates, bf->rates, sizeof(rates)); - - retries = ts->ts_longretry + 1; - for (i = 0; i < ts->ts_rateindex; i++) - retries += rates[i].count; - - rcu_read_lock(); - - sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2); - if (!sta) { - rcu_read_unlock(); - - INIT_LIST_HEAD(&bf_head); - while (bf) { - bf_next = bf->bf_next; - - if (!bf->bf_stale || bf_next != NULL) - list_move_tail(&bf->list, &bf_head); - - ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, 0); - - bf = bf_next; - } - return; - } - - an = (struct ath_node *)sta->drv_priv; - tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK; - tid = ATH_AN_2_TID(an, tidno); - seq_first = tid->seq_start; - isba = ts->ts_flags & ATH9K_TX_BA; - - /* - * The hardware occasionally sends a tx status for the wrong TID. - * In this case, the BA status cannot be considered valid and all - * subframes need to be retransmitted - * - * Only BlockAcks have a TID and therefore normal Acks cannot be - * checked - */ - if (isba && tidno != ts->tid) - txok = false; - - isaggr = bf_isaggr(bf); - memset(ba, 0, WME_BA_BMP_SIZE >> 3); - - if (isaggr && txok) { - if (ts->ts_flags & ATH9K_TX_BA) { - seq_st = ts->ts_seqnum; - memcpy(ba, &ts->ba_low, WME_BA_BMP_SIZE >> 3); - } else { - /* - * AR5416 can become deaf/mute when BA - * issue happens. Chip needs to be reset. - * But AP code may have sychronization issues - * when perform internal reset in this routine. - * Only enable reset in STA mode for now. - */ - if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) - needreset = 1; - } - } - - __skb_queue_head_init(&bf_pending); - - ath_tx_count_frames(sc, bf, ts, txok, &nframes, &nbad); - while (bf) { - u16 seqno = bf->bf_state.seqno; - - txfail = txpending = sendbar = 0; - bf_next = bf->bf_next; - - skb = bf->bf_mpdu; - tx_info = IEEE80211_SKB_CB(skb); - fi = get_frame_info(skb); - - if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) { - /* - * Outside of the current BlockAck window, - * maybe part of a previous session - */ - txfail = 1; - } else if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, seqno))) { - /* transmit completion, subframe is - * acked by block ack */ - acked_cnt++; - } else if (!isaggr && txok) { - /* transmit completion */ - acked_cnt++; - } else if (flush) { - txpending = 1; - } else if (fi->retries < ATH_MAX_SW_RETRIES) { - if (txok || !an->sleeping) - ath_tx_set_retry(sc, txq, bf->bf_mpdu, - retries); - - txpending = 1; - } else { - txfail = 1; - txfail_cnt++; - bar_index = max_t(int, bar_index, - ATH_BA_INDEX(seq_first, seqno)); - } - - /* - * Make sure the last desc is reclaimed if it - * not a holding desc. - */ - INIT_LIST_HEAD(&bf_head); - if (bf_next != NULL || !bf_last->bf_stale) - list_move_tail(&bf->list, &bf_head); - - if (!txpending) { - /* - * complete the acked-ones/xretried ones; update - * block-ack window - */ - ath_tx_update_baw(sc, tid, seqno); - - if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) { - memcpy(tx_info->control.rates, rates, sizeof(rates)); - ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok); - rc_update = false; - } - - ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, - !txfail); - } else { - /* retry the un-acked ones */ - if (bf->bf_next == NULL && bf_last->bf_stale) { - struct ath_buf *tbf; - - tbf = ath_clone_txbuf(sc, bf_last); - /* - * Update tx baw and complete the - * frame with failed status if we - * run out of tx buf. - */ - if (!tbf) { - ath_tx_update_baw(sc, tid, seqno); - - ath_tx_complete_buf(sc, bf, txq, - &bf_head, ts, 0); - bar_index = max_t(int, bar_index, - ATH_BA_INDEX(seq_first, seqno)); - break; - } - - fi->bf = tbf; - } - - /* - * Put this buffer to the temporary pending - * queue to retain ordering - */ - __skb_queue_tail(&bf_pending, skb); - } - - bf = bf_next; - } - - /* prepend un-acked frames to the beginning of the pending frame queue */ - if (!skb_queue_empty(&bf_pending)) { - if (an->sleeping) - ieee80211_sta_set_buffered(sta, tid->tidno, true); - - skb_queue_splice(&bf_pending, &tid->buf_q); - if (!an->sleeping) { - ath_tx_queue_tid(txq, tid); - - if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY)) - tid->ac->clear_ps_filter = true; - } - } - - if (bar_index >= 0) { - u16 bar_seq = ATH_BA_INDEX2SEQ(seq_first, bar_index); - - if (BAW_WITHIN(tid->seq_start, tid->baw_size, bar_seq)) - tid->bar_index = ATH_BA_INDEX(tid->seq_start, bar_seq); - - ath_txq_unlock(sc, txq); - ath_send_bar(tid, ATH_BA_INDEX2SEQ(seq_first, bar_index + 1)); - ath_txq_lock(sc, txq); - } - - rcu_read_unlock(); - - if (needreset) - ath9k_queue_reset(sc, RESET_TYPE_TX_ERROR); -} - -static bool bf_is_ampdu_not_probing(struct ath_buf *bf) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu); - return bf_isampdu(bf) && !(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE); -} - -static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq, - struct ath_tx_status *ts, struct ath_buf *bf, - struct list_head *bf_head) -{ - struct ieee80211_tx_info *info; - bool txok, flush; - - txok = !(ts->ts_status & ATH9K_TXERR_MASK); - flush = !!(ts->ts_status & ATH9K_TX_FLUSH); - txq->axq_tx_inprogress = false; - - txq->axq_depth--; - if (bf_is_ampdu_not_probing(bf)) - txq->axq_ampdu_depth--; - - if (!bf_isampdu(bf)) { - if (!flush) { - info = IEEE80211_SKB_CB(bf->bf_mpdu); - memcpy(info->control.rates, bf->rates, - sizeof(info->control.rates)); - ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok); - } - ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok); - } else - ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok); - - if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) && !flush) - ath_txq_schedule(sc, txq); -} - -static bool ath_lookup_legacy(struct ath_buf *bf) -{ - struct sk_buff *skb; - struct ieee80211_tx_info *tx_info; - struct ieee80211_tx_rate *rates; - int i; - - skb = bf->bf_mpdu; - tx_info = IEEE80211_SKB_CB(skb); - rates = tx_info->control.rates; - - for (i = 0; i < 4; i++) { - if (!rates[i].count || rates[i].idx < 0) - break; - - if (!(rates[i].flags & IEEE80211_TX_RC_MCS)) - return true; - } - - return false; -} - -static u32 ath_lookup_rate(struct ath_softc *sc, struct ath_buf *bf, - struct ath_atx_tid *tid) -{ - struct sk_buff *skb; - struct ieee80211_tx_info *tx_info; - struct ieee80211_tx_rate *rates; - u32 max_4ms_framelen, frmlen; - u16 aggr_limit, bt_aggr_limit, legacy = 0; - int q = tid->ac->txq->mac80211_qnum; - int i; - - skb = bf->bf_mpdu; - tx_info = IEEE80211_SKB_CB(skb); - rates = bf->rates; - - /* - * Find the lowest frame length among the rate series that will have a - * 4ms (or TXOP limited) transmit duration. - */ - max_4ms_framelen = ATH_AMPDU_LIMIT_MAX; - - for (i = 0; i < 4; i++) { - int modeidx; - - if (!rates[i].count) - continue; - - if (!(rates[i].flags & IEEE80211_TX_RC_MCS)) { - legacy = 1; - break; - } - - if (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) - modeidx = MCS_HT40; - else - modeidx = MCS_HT20; - - if (rates[i].flags & IEEE80211_TX_RC_SHORT_GI) - modeidx++; - - frmlen = sc->tx.max_aggr_framelen[q][modeidx][rates[i].idx]; - max_4ms_framelen = min(max_4ms_framelen, frmlen); - } - - /* - * limit aggregate size by the minimum rate if rate selected is - * not a probe rate, if rate selected is a probe rate then - * avoid aggregation of this packet. - */ - if (tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE || legacy) - return 0; - - aggr_limit = min(max_4ms_framelen, (u32)ATH_AMPDU_LIMIT_MAX); - - /* - * Override the default aggregation limit for BTCOEX. - */ - bt_aggr_limit = ath9k_btcoex_aggr_limit(sc, max_4ms_framelen); - if (bt_aggr_limit) - aggr_limit = bt_aggr_limit; - - /* - * h/w can accept aggregates up to 16 bit lengths (65535). - * The IE, however can hold up to 65536, which shows up here - * as zero. Ignore 65536 since we are constrained by hw. - */ - if (tid->an->maxampdu) - aggr_limit = min(aggr_limit, tid->an->maxampdu); - - return aggr_limit; -} - -/* - * Returns the number of delimiters to be added to - * meet the minimum required mpdudensity. - */ -static int ath_compute_num_delims(struct ath_softc *sc, struct ath_atx_tid *tid, - struct ath_buf *bf, u16 frmlen, - bool first_subfrm) -{ -#define FIRST_DESC_NDELIMS 60 - u32 nsymbits, nsymbols; - u16 minlen; - u8 flags, rix; - int width, streams, half_gi, ndelim, mindelim; - struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu); - - /* Select standard number of delimiters based on frame length alone */ - ndelim = ATH_AGGR_GET_NDELIM(frmlen); - - /* - * If encryption enabled, hardware requires some more padding between - * subframes. - * TODO - this could be improved to be dependent on the rate. - * The hardware can keep up at lower rates, but not higher rates - */ - if ((fi->keyix != ATH9K_TXKEYIX_INVALID) && - !(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)) - ndelim += ATH_AGGR_ENCRYPTDELIM; - - /* - * Add delimiter when using RTS/CTS with aggregation - * and non enterprise AR9003 card - */ - if (first_subfrm && !AR_SREV_9580_10_OR_LATER(sc->sc_ah) && - (sc->sc_ah->ent_mode & AR_ENT_OTP_MIN_PKT_SIZE_DISABLE)) - ndelim = max(ndelim, FIRST_DESC_NDELIMS); - - /* - * Convert desired mpdu density from microeconds to bytes based - * on highest rate in rate series (i.e. first rate) to determine - * required minimum length for subframe. Take into account - * whether high rate is 20 or 40Mhz and half or full GI. - * - * If there is no mpdu density restriction, no further calculation - * is needed. - */ - - if (tid->an->mpdudensity == 0) - return ndelim; - - rix = bf->rates[0].idx; - flags = bf->rates[0].flags; - width = (flags & IEEE80211_TX_RC_40_MHZ_WIDTH) ? 1 : 0; - half_gi = (flags & IEEE80211_TX_RC_SHORT_GI) ? 1 : 0; - - if (half_gi) - nsymbols = NUM_SYMBOLS_PER_USEC_HALFGI(tid->an->mpdudensity); - else - nsymbols = NUM_SYMBOLS_PER_USEC(tid->an->mpdudensity); - - if (nsymbols == 0) - nsymbols = 1; - - streams = HT_RC_2_STREAMS(rix); - nsymbits = bits_per_symbol[rix % 8][width] * streams; - minlen = (nsymbols * nsymbits) / BITS_PER_BYTE; - - if (frmlen < minlen) { - mindelim = (minlen - frmlen) / ATH_AGGR_DELIM_SZ; - ndelim = max(mindelim, ndelim); - } - - return ndelim; -} - -static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, - struct ath_txq *txq, - struct ath_atx_tid *tid, - struct list_head *bf_q, - int *aggr_len) -{ -#define PADBYTES(_len) ((4 - ((_len) % 4)) % 4) - struct ath_buf *bf, *bf_first = NULL, *bf_prev = NULL; - int rl = 0, nframes = 0, ndelim, prev_al = 0; - u16 aggr_limit = 0, al = 0, bpad = 0, - al_delta, h_baw = tid->baw_size / 2; - enum ATH_AGGR_STATUS status = ATH_AGGR_DONE; - struct ieee80211_tx_info *tx_info; - struct ath_frame_info *fi; - struct sk_buff *skb; - u16 seqno; - - do { - skb = skb_peek(&tid->buf_q); - fi = get_frame_info(skb); - bf = fi->bf; - if (!fi->bf) - bf = ath_tx_setup_buffer(sc, txq, tid, skb); - - if (!bf) { - __skb_unlink(skb, &tid->buf_q); - ieee80211_free_txskb(sc->hw, skb); - continue; - } - - bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR; - seqno = bf->bf_state.seqno; - - /* do not step over block-ack window */ - if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) { - status = ATH_AGGR_BAW_CLOSED; - break; - } - - if (tid->bar_index > ATH_BA_INDEX(tid->seq_start, seqno)) { - struct ath_tx_status ts = {}; - struct list_head bf_head; - - INIT_LIST_HEAD(&bf_head); - list_add(&bf->list, &bf_head); - __skb_unlink(skb, &tid->buf_q); - ath_tx_update_baw(sc, tid, seqno); - ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); - continue; - } - - if (!bf_first) - bf_first = bf; - - if (!rl) { - ath_set_rates(tid->an->vif, tid->an->sta, bf); - aggr_limit = ath_lookup_rate(sc, bf, tid); - rl = 1; - } - - /* do not exceed aggregation limit */ - al_delta = ATH_AGGR_DELIM_SZ + fi->framelen; - - if (nframes && - ((aggr_limit < (al + bpad + al_delta + prev_al)) || - ath_lookup_legacy(bf))) { - status = ATH_AGGR_LIMITED; - break; - } - - tx_info = IEEE80211_SKB_CB(bf->bf_mpdu); - if (nframes && (tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)) - break; - - /* do not exceed subframe limit */ - if (nframes >= min((int)h_baw, ATH_AMPDU_SUBFRAME_DEFAULT)) { - status = ATH_AGGR_LIMITED; - break; - } - - /* add padding for previous frame to aggregation length */ - al += bpad + al_delta; - - /* - * Get the delimiters needed to meet the MPDU - * density for this node. - */ - ndelim = ath_compute_num_delims(sc, tid, bf_first, fi->framelen, - !nframes); - bpad = PADBYTES(al_delta) + (ndelim << 2); - - nframes++; - bf->bf_next = NULL; - - /* link buffers of this frame to the aggregate */ - if (!fi->retries) - ath_tx_addto_baw(sc, tid, seqno); - bf->bf_state.ndelim = ndelim; - - __skb_unlink(skb, &tid->buf_q); - list_add_tail(&bf->list, bf_q); - if (bf_prev) - bf_prev->bf_next = bf; - - bf_prev = bf; - - } while (!skb_queue_empty(&tid->buf_q)); - - *aggr_len = al; - - return status; -#undef PADBYTES -} - -/* - * rix - rate index - * pktlen - total bytes (delims + data + fcs + pads + pad delims) - * width - 0 for 20 MHz, 1 for 40 MHz - * half_gi - to use 4us v/s 3.6 us for symbol time - */ -static u32 ath_pkt_duration(struct ath_softc *sc, u8 rix, int pktlen, - int width, int half_gi, bool shortPreamble) -{ - u32 nbits, nsymbits, duration, nsymbols; - int streams; - - /* find number of symbols: PLCP + data */ - streams = HT_RC_2_STREAMS(rix); - nbits = (pktlen << 3) + OFDM_PLCP_BITS; - nsymbits = bits_per_symbol[rix % 8][width] * streams; - nsymbols = (nbits + nsymbits - 1) / nsymbits; - - if (!half_gi) - duration = SYMBOL_TIME(nsymbols); - else - duration = SYMBOL_TIME_HALFGI(nsymbols); - - /* addup duration for legacy/ht training and signal fields */ - duration += L_STF + L_LTF + L_SIG + HT_SIG + HT_STF + HT_LTF(streams); - - return duration; -} - -static int ath_max_framelen(int usec, int mcs, bool ht40, bool sgi) -{ - int streams = HT_RC_2_STREAMS(mcs); - int symbols, bits; - int bytes = 0; - - symbols = sgi ? TIME_SYMBOLS_HALFGI(usec) : TIME_SYMBOLS(usec); - bits = symbols * bits_per_symbol[mcs % 8][ht40] * streams; - bits -= OFDM_PLCP_BITS; - bytes = bits / 8; - bytes -= L_STF + L_LTF + L_SIG + HT_SIG + HT_STF + HT_LTF(streams); - if (bytes > 65532) - bytes = 65532; - - return bytes; -} - -void ath_update_max_aggr_framelen(struct ath_softc *sc, int queue, int txop) -{ - u16 *cur_ht20, *cur_ht20_sgi, *cur_ht40, *cur_ht40_sgi; - int mcs; - - /* 4ms is the default (and maximum) duration */ - if (!txop || txop > 4096) - txop = 4096; - - cur_ht20 = sc->tx.max_aggr_framelen[queue][MCS_HT20]; - cur_ht20_sgi = sc->tx.max_aggr_framelen[queue][MCS_HT20_SGI]; - cur_ht40 = sc->tx.max_aggr_framelen[queue][MCS_HT40]; - cur_ht40_sgi = sc->tx.max_aggr_framelen[queue][MCS_HT40_SGI]; - for (mcs = 0; mcs < 32; mcs++) { - cur_ht20[mcs] = ath_max_framelen(txop, mcs, false, false); - cur_ht20_sgi[mcs] = ath_max_framelen(txop, mcs, false, true); - cur_ht40[mcs] = ath_max_framelen(txop, mcs, true, false); - cur_ht40_sgi[mcs] = ath_max_framelen(txop, mcs, true, true); - } -} - -static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, - struct ath_tx_info *info, int len) -{ - struct ath_hw *ah = sc->sc_ah; - struct sk_buff *skb; - struct ieee80211_tx_info *tx_info; - struct ieee80211_tx_rate *rates; - const struct ieee80211_rate *rate; - struct ieee80211_hdr *hdr; - struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu); - int i; - u8 rix = 0; - - skb = bf->bf_mpdu; - tx_info = IEEE80211_SKB_CB(skb); - rates = bf->rates; - hdr = (struct ieee80211_hdr *)skb->data; - - /* set dur_update_en for l-sig computation except for PS-Poll frames */ - info->dur_update = !ieee80211_is_pspoll(hdr->frame_control); - info->rtscts_rate = fi->rtscts_rate; - - for (i = 0; i < ARRAY_SIZE(bf->rates); i++) { - bool is_40, is_sgi, is_sp; - int phy; - - if (!rates[i].count || (rates[i].idx < 0)) - continue; - - rix = rates[i].idx; - info->rates[i].Tries = rates[i].count; - - if (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS) { - info->rates[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS; - info->flags |= ATH9K_TXDESC_RTSENA; - } else if (rates[i].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { - info->rates[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS; - info->flags |= ATH9K_TXDESC_CTSENA; - } - - if (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) - info->rates[i].RateFlags |= ATH9K_RATESERIES_2040; - if (rates[i].flags & IEEE80211_TX_RC_SHORT_GI) - info->rates[i].RateFlags |= ATH9K_RATESERIES_HALFGI; - - is_sgi = !!(rates[i].flags & IEEE80211_TX_RC_SHORT_GI); - is_40 = !!(rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH); - is_sp = !!(rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE); - - if (rates[i].flags & IEEE80211_TX_RC_MCS) { - /* MCS rates */ - info->rates[i].Rate = rix | 0x80; - info->rates[i].ChSel = ath_txchainmask_reduction(sc, - ah->txchainmask, info->rates[i].Rate); - info->rates[i].PktDuration = ath_pkt_duration(sc, rix, len, - is_40, is_sgi, is_sp); - if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC)) - info->rates[i].RateFlags |= ATH9K_RATESERIES_STBC; - continue; - } - - /* legacy rates */ - rate = &sc->sbands[tx_info->band].bitrates[rates[i].idx]; - if ((tx_info->band == IEEE80211_BAND_2GHZ) && - !(rate->flags & IEEE80211_RATE_ERP_G)) - phy = WLAN_RC_PHY_CCK; - else - phy = WLAN_RC_PHY_OFDM; - - info->rates[i].Rate = rate->hw_value; - if (rate->hw_value_short) { - if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) - info->rates[i].Rate |= rate->hw_value_short; - } else { - is_sp = false; - } - - if (bf->bf_state.bfs_paprd) - info->rates[i].ChSel = ah->txchainmask; - else - info->rates[i].ChSel = ath_txchainmask_reduction(sc, - ah->txchainmask, info->rates[i].Rate); - - info->rates[i].PktDuration = ath9k_hw_computetxtime(sc->sc_ah, - phy, rate->bitrate * 100, len, rix, is_sp); - } - - /* For AR5416 - RTS cannot be followed by a frame larger than 8K */ - if (bf_isaggr(bf) && (len > sc->sc_ah->caps.rts_aggr_limit)) - info->flags &= ~ATH9K_TXDESC_RTSENA; - - /* ATH9K_TXDESC_RTSENA and ATH9K_TXDESC_CTSENA are mutually exclusive. */ - if (info->flags & ATH9K_TXDESC_RTSENA) - info->flags &= ~ATH9K_TXDESC_CTSENA; -} - -static enum ath9k_pkt_type get_hw_packet_type(struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr; - enum ath9k_pkt_type htype; - __le16 fc; - - hdr = (struct ieee80211_hdr *)skb->data; - fc = hdr->frame_control; - - if (ieee80211_is_beacon(fc)) - htype = ATH9K_PKT_TYPE_BEACON; - else if (ieee80211_is_probe_resp(fc)) - htype = ATH9K_PKT_TYPE_PROBE_RESP; - else if (ieee80211_is_atim(fc)) - htype = ATH9K_PKT_TYPE_ATIM; - else if (ieee80211_is_pspoll(fc)) - htype = ATH9K_PKT_TYPE_PSPOLL; - else - htype = ATH9K_PKT_TYPE_NORMAL; - - return htype; -} - -static void ath_tx_fill_desc(struct ath_softc *sc, struct ath_buf *bf, - struct ath_txq *txq, int len) -{ - struct ath_hw *ah = sc->sc_ah; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(bf->bf_mpdu); - struct ath_buf *bf_first = bf; - struct ath_tx_info info; - bool aggr = !!(bf->bf_state.bf_type & BUF_AGGR); - - memset(&info, 0, sizeof(info)); - info.is_first = true; - info.is_last = true; - info.txpower = MAX_RATE_POWER; - info.qcu = txq->axq_qnum; - - info.flags = ATH9K_TXDESC_INTREQ; - if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) - info.flags |= ATH9K_TXDESC_NOACK; - if (tx_info->flags & IEEE80211_TX_CTL_LDPC) - info.flags |= ATH9K_TXDESC_LDPC; - - ath_buf_set_rate(sc, bf, &info, len); - - if (tx_info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT) - info.flags |= ATH9K_TXDESC_CLRDMASK; - - if (bf->bf_state.bfs_paprd) - info.flags |= (u32) bf->bf_state.bfs_paprd << ATH9K_TXDESC_PAPRD_S; - - - while (bf) { - struct sk_buff *skb = bf->bf_mpdu; - struct ath_frame_info *fi = get_frame_info(skb); - - info.type = get_hw_packet_type(skb); - if (bf->bf_next) - info.link = bf->bf_next->bf_daddr; - else - info.link = 0; - - info.buf_addr[0] = bf->bf_buf_addr; - info.buf_len[0] = skb->len; - info.pkt_len = fi->framelen; - info.keyix = fi->keyix; - info.keytype = fi->keytype; - - if (aggr) { - if (bf == bf_first) - info.aggr = AGGR_BUF_FIRST; - else if (!bf->bf_next) - info.aggr = AGGR_BUF_LAST; - else - info.aggr = AGGR_BUF_MIDDLE; - - info.ndelim = bf->bf_state.ndelim; - info.aggr_len = len; - } - - ath9k_hw_set_txdesc(ah, bf->bf_desc, &info); - bf = bf->bf_next; - } -} - -static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq, - struct ath_atx_tid *tid) -{ - struct ath_buf *bf; - enum ATH_AGGR_STATUS status; - struct ieee80211_tx_info *tx_info; - struct list_head bf_q; - int aggr_len; - - do { - if (skb_queue_empty(&tid->buf_q)) - return; - - INIT_LIST_HEAD(&bf_q); - - status = ath_tx_form_aggr(sc, txq, tid, &bf_q, &aggr_len); - - /* - * no frames picked up to be aggregated; - * block-ack window is not open. - */ - if (list_empty(&bf_q)) - break; - - bf = list_first_entry(&bf_q, struct ath_buf, list); - bf->bf_lastbf = list_entry(bf_q.prev, struct ath_buf, list); - tx_info = IEEE80211_SKB_CB(bf->bf_mpdu); - - if (tid->ac->clear_ps_filter) { - tid->ac->clear_ps_filter = false; - tx_info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; - } else { - tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT; - } - - /* if only one frame, send as non-aggregate */ - if (bf == bf->bf_lastbf) { - aggr_len = get_frame_info(bf->bf_mpdu)->framelen; - bf->bf_state.bf_type = BUF_AMPDU; - } else { - TX_STAT_INC(txq->axq_qnum, a_aggr); - } - - ath_tx_fill_desc(sc, bf, txq, aggr_len); - ath_tx_txqaddbuf(sc, txq, &bf_q, false); - } while (txq->axq_ampdu_depth < ATH_AGGR_MIN_QDEPTH && - status != ATH_AGGR_BAW_CLOSED); -} - -int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, - u16 tid, u16 *ssn) -{ - struct ath_atx_tid *txtid; - struct ath_node *an; - u8 density; - - an = (struct ath_node *)sta->drv_priv; - txtid = ATH_AN_2_TID(an, tid); - - /* update ampdu factor/density, they may have changed. This may happen - * in HT IBSS when a beacon with HT-info is received after the station - * has already been added. - */ - if (sta->ht_cap.ht_supported) { - an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + - sta->ht_cap.ampdu_factor); - density = ath9k_parse_mpdudensity(sta->ht_cap.ampdu_density); - an->mpdudensity = density; - } - - txtid->active = true; - txtid->paused = true; - *ssn = txtid->seq_start = txtid->seq_next; - txtid->bar_index = -1; - - memset(txtid->tx_buf, 0, sizeof(txtid->tx_buf)); - txtid->baw_head = txtid->baw_tail = 0; - - return 0; -} - -void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) -{ - struct ath_node *an = (struct ath_node *)sta->drv_priv; - struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid); - struct ath_txq *txq = txtid->ac->txq; - - ath_txq_lock(sc, txq); - txtid->active = false; - txtid->paused = true; - ath_tx_flush_tid(sc, txtid); - ath_txq_unlock_complete(sc, txq); -} - -void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc, - struct ath_node *an) -{ - struct ath_atx_tid *tid; - struct ath_atx_ac *ac; - struct ath_txq *txq; - bool buffered; - int tidno; - - for (tidno = 0, tid = &an->tid[tidno]; - tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { - - if (!tid->sched) - continue; - - ac = tid->ac; - txq = ac->txq; - - ath_txq_lock(sc, txq); - - buffered = !skb_queue_empty(&tid->buf_q); - - tid->sched = false; - list_del(&tid->list); - - if (ac->sched) { - ac->sched = false; - list_del(&ac->list); - } - - ath_txq_unlock(sc, txq); - - ieee80211_sta_set_buffered(sta, tidno, buffered); - } -} - -void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an) -{ - struct ath_atx_tid *tid; - struct ath_atx_ac *ac; - struct ath_txq *txq; - int tidno; - - for (tidno = 0, tid = &an->tid[tidno]; - tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { - - ac = tid->ac; - txq = ac->txq; - - ath_txq_lock(sc, txq); - ac->clear_ps_filter = true; - - if (!skb_queue_empty(&tid->buf_q) && !tid->paused) { - ath_tx_queue_tid(txq, tid); - ath_txq_schedule(sc, txq); - } - - ath_txq_unlock_complete(sc, txq); - } -} - -void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, - u16 tidno) -{ - struct ath_atx_tid *tid; - struct ath_node *an; - struct ath_txq *txq; - - an = (struct ath_node *)sta->drv_priv; - tid = ATH_AN_2_TID(an, tidno); - txq = tid->ac->txq; - - ath_txq_lock(sc, txq); - - tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor; - tid->paused = false; - - if (!skb_queue_empty(&tid->buf_q)) { - ath_tx_queue_tid(txq, tid); - ath_txq_schedule(sc, txq); - } - - ath_txq_unlock_complete(sc, txq); -} - -/********************/ -/* Queue Management */ -/********************/ - -struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath9k_tx_queue_info qi; - static const int subtype_txq_to_hwq[] = { - [IEEE80211_AC_BE] = ATH_TXQ_AC_BE, - [IEEE80211_AC_BK] = ATH_TXQ_AC_BK, - [IEEE80211_AC_VI] = ATH_TXQ_AC_VI, - [IEEE80211_AC_VO] = ATH_TXQ_AC_VO, - }; - int axq_qnum, i; - - memset(&qi, 0, sizeof(qi)); - qi.tqi_subtype = subtype_txq_to_hwq[subtype]; - qi.tqi_aifs = ATH9K_TXQ_USEDEFAULT; - qi.tqi_cwmin = ATH9K_TXQ_USEDEFAULT; - qi.tqi_cwmax = ATH9K_TXQ_USEDEFAULT; - qi.tqi_physCompBuf = 0; - - /* - * Enable interrupts only for EOL and DESC conditions. - * We mark tx descriptors to receive a DESC interrupt - * when a tx queue gets deep; otherwise waiting for the - * EOL to reap descriptors. Note that this is done to - * reduce interrupt load and this only defers reaping - * descriptors, never transmitting frames. Aside from - * reducing interrupts this also permits more concurrency. - * The only potential downside is if the tx queue backs - * up in which case the top half of the kernel may backup - * due to a lack of tx descriptors. - * - * The UAPSD queue is an exception, since we take a desc- - * based intr on the EOSP frames. - */ - if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { - qi.tqi_qflags = TXQ_FLAG_TXINT_ENABLE; - } else { - if (qtype == ATH9K_TX_QUEUE_UAPSD) - qi.tqi_qflags = TXQ_FLAG_TXDESCINT_ENABLE; - else - qi.tqi_qflags = TXQ_FLAG_TXEOLINT_ENABLE | - TXQ_FLAG_TXDESCINT_ENABLE; - } - axq_qnum = ath9k_hw_setuptxqueue(ah, qtype, &qi); - if (axq_qnum == -1) { - /* - * NB: don't print a message, this happens - * normally on parts with too few tx queues - */ - return NULL; - } - if (!ATH_TXQ_SETUP(sc, axq_qnum)) { - struct ath_txq *txq = &sc->tx.txq[axq_qnum]; - - txq->axq_qnum = axq_qnum; - txq->mac80211_qnum = -1; - txq->axq_link = NULL; - __skb_queue_head_init(&txq->complete_q); - INIT_LIST_HEAD(&txq->axq_q); - INIT_LIST_HEAD(&txq->axq_acq); - spin_lock_init(&txq->axq_lock); - txq->axq_depth = 0; - txq->axq_ampdu_depth = 0; - txq->axq_tx_inprogress = false; - sc->tx.txqsetup |= 1<txq_headidx = txq->txq_tailidx = 0; - for (i = 0; i < ATH_TXFIFO_DEPTH; i++) - INIT_LIST_HEAD(&txq->txq_fifo[i]); - } - return &sc->tx.txq[axq_qnum]; -} - -int ath_txq_update(struct ath_softc *sc, int qnum, - struct ath9k_tx_queue_info *qinfo) -{ - struct ath_hw *ah = sc->sc_ah; - int error = 0; - struct ath9k_tx_queue_info qi; - - BUG_ON(sc->tx.txq[qnum].axq_qnum != qnum); - - ath9k_hw_get_txq_props(ah, qnum, &qi); - qi.tqi_aifs = qinfo->tqi_aifs; - qi.tqi_cwmin = qinfo->tqi_cwmin; - qi.tqi_cwmax = qinfo->tqi_cwmax; - qi.tqi_burstTime = qinfo->tqi_burstTime; - qi.tqi_readyTime = qinfo->tqi_readyTime; - - if (!ath9k_hw_set_txq_props(ah, qnum, &qi)) { - ath_err(ath9k_hw_common(sc->sc_ah), - "Unable to update hardware queue %u!\n", qnum); - error = -EIO; - } else { - ath9k_hw_resettxqueue(ah, qnum); - } - - return error; -} - -int ath_cabq_update(struct ath_softc *sc) -{ - struct ath9k_tx_queue_info qi; - struct ath_beacon_config *cur_conf = &sc->cur_beacon_conf; - int qnum = sc->beacon.cabq->axq_qnum; - - ath9k_hw_get_txq_props(sc->sc_ah, qnum, &qi); - /* - * Ensure the readytime % is within the bounds. - */ - if (sc->config.cabqReadytime < ATH9K_READY_TIME_LO_BOUND) - sc->config.cabqReadytime = ATH9K_READY_TIME_LO_BOUND; - else if (sc->config.cabqReadytime > ATH9K_READY_TIME_HI_BOUND) - sc->config.cabqReadytime = ATH9K_READY_TIME_HI_BOUND; - - qi.tqi_readyTime = (cur_conf->beacon_interval * - sc->config.cabqReadytime) / 100; - ath_txq_update(sc, qnum, &qi); - - return 0; -} - -static void ath_drain_txq_list(struct ath_softc *sc, struct ath_txq *txq, - struct list_head *list) -{ - struct ath_buf *bf, *lastbf; - struct list_head bf_head; - struct ath_tx_status ts; - - memset(&ts, 0, sizeof(ts)); - ts.ts_status = ATH9K_TX_FLUSH; - INIT_LIST_HEAD(&bf_head); - - while (!list_empty(list)) { - bf = list_first_entry(list, struct ath_buf, list); - - if (bf->bf_stale) { - list_del(&bf->list); - - ath_tx_return_buffer(sc, bf); - continue; - } - - lastbf = bf->bf_lastbf; - list_cut_position(&bf_head, list, &lastbf->list); - ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head); - } -} - -/* - * Drain a given TX queue (could be Beacon or Data) - * - * This assumes output has been stopped and - * we do not need to block ath_tx_tasklet. - */ -void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq) -{ - ath_txq_lock(sc, txq); - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { - int idx = txq->txq_tailidx; - - while (!list_empty(&txq->txq_fifo[idx])) { - ath_drain_txq_list(sc, txq, &txq->txq_fifo[idx]); - - INCR(idx, ATH_TXFIFO_DEPTH); - } - txq->txq_tailidx = idx; - } - - txq->axq_link = NULL; - txq->axq_tx_inprogress = false; - ath_drain_txq_list(sc, txq, &txq->axq_q); - - ath_txq_unlock_complete(sc, txq); -} - -bool ath_drain_all_txq(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_txq *txq; - int i; - u32 npend = 0; - - if (test_bit(SC_OP_INVALID, &sc->sc_flags)) - return true; - - ath9k_hw_abort_tx_dma(ah); - - /* Check if any queue remains active */ - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { - if (!ATH_TXQ_SETUP(sc, i)) - continue; - - if (ath9k_hw_numtxpending(ah, sc->tx.txq[i].axq_qnum)) - npend |= BIT(i); - } - - if (npend) - ath_err(common, "Failed to stop TX DMA, queues=0x%03x!\n", npend); - - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { - if (!ATH_TXQ_SETUP(sc, i)) - continue; - - /* - * The caller will resume queues with ieee80211_wake_queues. - * Mark the queue as not stopped to prevent ath_tx_complete - * from waking the queue too early. - */ - txq = &sc->tx.txq[i]; - txq->stopped = false; - ath_draintxq(sc, txq); - } - - return !npend; -} - -void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq) -{ - ath9k_hw_releasetxqueue(sc->sc_ah, txq->axq_qnum); - sc->tx.txqsetup &= ~(1<axq_qnum); -} - -/* For each axq_acq entry, for each tid, try to schedule packets - * for transmit until ampdu_depth has reached min Q depth. - */ -void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq) -{ - struct ath_atx_ac *ac, *ac_tmp, *last_ac; - struct ath_atx_tid *tid, *last_tid; - - if (test_bit(SC_OP_HW_RESET, &sc->sc_flags) || - list_empty(&txq->axq_acq) || - txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) - return; - - rcu_read_lock(); - - ac = list_first_entry(&txq->axq_acq, struct ath_atx_ac, list); - last_ac = list_entry(txq->axq_acq.prev, struct ath_atx_ac, list); - - list_for_each_entry_safe(ac, ac_tmp, &txq->axq_acq, list) { - last_tid = list_entry(ac->tid_q.prev, struct ath_atx_tid, list); - list_del(&ac->list); - ac->sched = false; - - while (!list_empty(&ac->tid_q)) { - tid = list_first_entry(&ac->tid_q, struct ath_atx_tid, - list); - list_del(&tid->list); - tid->sched = false; - - if (tid->paused) - continue; - - ath_tx_sched_aggr(sc, txq, tid); - - /* - * add tid to round-robin queue if more frames - * are pending for the tid - */ - if (!skb_queue_empty(&tid->buf_q)) - ath_tx_queue_tid(txq, tid); - - if (tid == last_tid || - txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) - break; - } - - if (!list_empty(&ac->tid_q) && !ac->sched) { - ac->sched = true; - list_add_tail(&ac->list, &txq->axq_acq); - } - - if (ac == last_ac || - txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) - break; - } - - rcu_read_unlock(); -} - -/***********/ -/* TX, DMA */ -/***********/ - -/* - * Insert a chain of ath_buf (descriptors) on a txq and - * assume the descriptors are already chained together by caller. - */ -static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, - struct list_head *head, bool internal) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath_buf *bf, *bf_last; - bool puttxbuf = false; - bool edma; - - /* - * Insert the frame on the outbound list and - * pass it on to the hardware. - */ - - if (list_empty(head)) - return; - - edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA); - bf = list_first_entry(head, struct ath_buf, list); - bf_last = list_entry(head->prev, struct ath_buf, list); - - ath_dbg(common, QUEUE, "qnum: %d, txq depth: %d\n", - txq->axq_qnum, txq->axq_depth); - - if (edma && list_empty(&txq->txq_fifo[txq->txq_headidx])) { - list_splice_tail_init(head, &txq->txq_fifo[txq->txq_headidx]); - INCR(txq->txq_headidx, ATH_TXFIFO_DEPTH); - puttxbuf = true; - } else { - list_splice_tail_init(head, &txq->axq_q); - - if (txq->axq_link) { - ath9k_hw_set_desc_link(ah, txq->axq_link, bf->bf_daddr); - ath_dbg(common, XMIT, "link[%u] (%p)=%llx (%p)\n", - txq->axq_qnum, txq->axq_link, - ito64(bf->bf_daddr), bf->bf_desc); - } else if (!edma) - puttxbuf = true; - - txq->axq_link = bf_last->bf_desc; - } - - if (puttxbuf) { - TX_STAT_INC(txq->axq_qnum, puttxbuf); - ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); - ath_dbg(common, XMIT, "TXDP[%u] = %llx (%p)\n", - txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc); - } - - if (!edma) { - TX_STAT_INC(txq->axq_qnum, txstart); - ath9k_hw_txstart(ah, txq->axq_qnum); - } - - if (!internal) { - txq->axq_depth++; - if (bf_is_ampdu_not_probing(bf)) - txq->axq_ampdu_depth++; - } -} - -static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid, - struct sk_buff *skb, struct ath_tx_control *txctl) -{ - struct ath_frame_info *fi = get_frame_info(skb); - struct list_head bf_head; - struct ath_buf *bf; - - /* - * Do not queue to h/w when any of the following conditions is true: - * - there are pending frames in software queue - * - the TID is currently paused for ADDBA/BAR request - * - seqno is not within block-ack window - * - h/w queue depth exceeds low water mark - */ - if (!skb_queue_empty(&tid->buf_q) || tid->paused || - !BAW_WITHIN(tid->seq_start, tid->baw_size, tid->seq_next) || - txctl->txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) { - /* - * Add this frame to software queue for scheduling later - * for aggregation. - */ - TX_STAT_INC(txctl->txq->axq_qnum, a_queued_sw); - __skb_queue_tail(&tid->buf_q, skb); - if (!txctl->an || !txctl->an->sleeping) - ath_tx_queue_tid(txctl->txq, tid); - return; - } - - bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb); - if (!bf) { - ieee80211_free_txskb(sc->hw, skb); - return; - } - - ath_set_rates(tid->an->vif, tid->an->sta, bf); - bf->bf_state.bf_type = BUF_AMPDU; - INIT_LIST_HEAD(&bf_head); - list_add(&bf->list, &bf_head); - - /* Add sub-frame to BAW */ - ath_tx_addto_baw(sc, tid, bf->bf_state.seqno); - - /* Queue to h/w without aggregation */ - TX_STAT_INC(txctl->txq->axq_qnum, a_queued_hw); - bf->bf_lastbf = bf; - ath_tx_fill_desc(sc, bf, txctl->txq, fi->framelen); - ath_tx_txqaddbuf(sc, txctl->txq, &bf_head, false); -} - -static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, - struct ath_atx_tid *tid, struct sk_buff *skb) -{ - struct ath_frame_info *fi = get_frame_info(skb); - struct list_head bf_head; - struct ath_buf *bf; - - bf = fi->bf; - - INIT_LIST_HEAD(&bf_head); - list_add_tail(&bf->list, &bf_head); - bf->bf_state.bf_type = 0; - - bf->bf_next = NULL; - bf->bf_lastbf = bf; - ath_tx_fill_desc(sc, bf, txq, fi->framelen); - ath_tx_txqaddbuf(sc, txq, &bf_head, false); - TX_STAT_INC(txq->axq_qnum, queued); -} - -static void setup_frame_info(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - struct sk_buff *skb, - int framelen) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - const struct ieee80211_rate *rate; - struct ath_frame_info *fi = get_frame_info(skb); - struct ath_node *an = NULL; - enum ath9k_key_type keytype; - bool short_preamble = false; - - /* - * We check if Short Preamble is needed for the CTS rate by - * checking the BSS's global flag. - * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used. - */ - if (tx_info->control.vif && - tx_info->control.vif->bss_conf.use_short_preamble) - short_preamble = true; - - rate = ieee80211_get_rts_cts_rate(hw, tx_info); - keytype = ath9k_cmn_get_hw_crypto_keytype(skb); - - if (sta) - an = (struct ath_node *) sta->drv_priv; - - memset(fi, 0, sizeof(*fi)); - if (hw_key) - fi->keyix = hw_key->hw_key_idx; - else if (an && ieee80211_is_data(hdr->frame_control) && an->ps_key > 0) - fi->keyix = an->ps_key; - else - fi->keyix = ATH9K_TXKEYIX_INVALID; - fi->keytype = keytype; - fi->framelen = framelen; - fi->rtscts_rate = rate->hw_value; - if (short_preamble) - fi->rtscts_rate |= rate->hw_value_short; -} - -u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath9k_channel *curchan = ah->curchan; - - if ((ah->caps.hw_caps & ATH9K_HW_CAP_APM) && - (curchan->channelFlags & CHANNEL_5GHZ) && - (chainmask == 0x7) && (rate < 0x90)) - return 0x3; - else if (AR_SREV_9462(ah) && ath9k_hw_btcoex_is_enabled(ah) && - IS_CCK_RATE(rate)) - return 0x2; - else - return chainmask; -} - -/* - * Assign a descriptor (and sequence number if necessary, - * and map buffer for DMA. Frees skb on error - */ -static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, - struct ath_txq *txq, - struct ath_atx_tid *tid, - struct sk_buff *skb) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_frame_info *fi = get_frame_info(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ath_buf *bf; - int fragno; - u16 seqno; - - bf = ath_tx_get_buffer(sc); - if (!bf) { - ath_dbg(common, XMIT, "TX buffers are full\n"); - return NULL; - } - - ATH_TXBUF_RESET(bf); - - if (tid) { - fragno = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG; - seqno = tid->seq_next; - hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT); - - if (fragno) - hdr->seq_ctrl |= cpu_to_le16(fragno); - - if (!ieee80211_has_morefrags(hdr->frame_control)) - INCR(tid->seq_next, IEEE80211_SEQ_MAX); - - bf->bf_state.seqno = seqno; - } - - bf->bf_mpdu = skb; - - bf->bf_buf_addr = dma_map_single(sc->dev, skb->data, - skb->len, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) { - bf->bf_mpdu = NULL; - bf->bf_buf_addr = 0; - ath_err(ath9k_hw_common(sc->sc_ah), - "dma_mapping_error() on TX\n"); - ath_tx_return_buffer(sc, bf); - return NULL; - } - - fi->bf = bf; - - return bf; -} - -/* Upon failure caller should free skb */ -int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, - struct ath_tx_control *txctl) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_sta *sta = txctl->sta; - struct ieee80211_vif *vif = info->control.vif; - struct ath_softc *sc = hw->priv; - struct ath_txq *txq = txctl->txq; - struct ath_atx_tid *tid = NULL; - struct ath_buf *bf; - int padpos, padsize; - int frmlen = skb->len + FCS_LEN; - u8 tidno; - int q; - - /* NOTE: sta can be NULL according to net/mac80211.h */ - if (sta) - txctl->an = (struct ath_node *)sta->drv_priv; - - if (info->control.hw_key) - frmlen += info->control.hw_key->icv_len; - - /* - * As a temporary workaround, assign seq# here; this will likely need - * to be cleaned up to work better with Beacon transmission and virtual - * BSSes. - */ - if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { - if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) - sc->tx.seq_no += 0x10; - hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); - hdr->seq_ctrl |= cpu_to_le16(sc->tx.seq_no); - } - - /* Add the padding after the header if this is not already done */ - padpos = ieee80211_hdrlen(hdr->frame_control); - padsize = padpos & 3; - if (padsize && skb->len > padpos) { - if (skb_headroom(skb) < padsize) - return -ENOMEM; - - skb_push(skb, padsize); - memmove(skb->data, skb->data + padsize, padpos); - hdr = (struct ieee80211_hdr *) skb->data; - } - - if ((vif && vif->type != NL80211_IFTYPE_AP && - vif->type != NL80211_IFTYPE_AP_VLAN) || - !ieee80211_is_data(hdr->frame_control)) - info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; - - setup_frame_info(hw, sta, skb, frmlen); - - /* - * At this point, the vif, hw_key and sta pointers in the tx control - * info are no longer valid (overwritten by the ath_frame_info data. - */ - - q = skb_get_queue_mapping(skb); - - ath_txq_lock(sc, txq); - if (txq == sc->tx.txq_map[q] && - ++txq->pending_frames > sc->tx.txq_max_pending[q] && - !txq->stopped) { - ieee80211_stop_queue(sc->hw, q); - txq->stopped = true; - } - - if (txctl->an && ieee80211_is_data_qos(hdr->frame_control)) { - tidno = ieee80211_get_qos_ctl(hdr)[0] & - IEEE80211_QOS_CTL_TID_MASK; - tid = ATH_AN_2_TID(txctl->an, tidno); - - WARN_ON(tid->ac->txq != txctl->txq); - } - - if ((info->flags & IEEE80211_TX_CTL_AMPDU) && tid) { - /* - * Try aggregation if it's a unicast data frame - * and the destination is HT capable. - */ - ath_tx_send_ampdu(sc, tid, skb, txctl); - goto out; - } - - bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb); - if (!bf) { - if (txctl->paprd) - dev_kfree_skb_any(skb); - else - ieee80211_free_txskb(sc->hw, skb); - goto out; - } - - bf->bf_state.bfs_paprd = txctl->paprd; - - if (txctl->paprd) - bf->bf_state.bfs_paprd_timestamp = jiffies; - - ath_set_rates(vif, sta, bf); - ath_tx_send_normal(sc, txctl->txq, tid, skb); - -out: - ath_txq_unlock(sc, txq); - - return 0; -} - -/*****************/ -/* TX Completion */ -/*****************/ - -static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, - int tx_flags, struct ath_txq *txq) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ieee80211_hdr * hdr = (struct ieee80211_hdr *)skb->data; - int q, padpos, padsize; - unsigned long flags; - - ath_dbg(common, XMIT, "TX complete: skb: %p\n", skb); - - if (sc->sc_ah->caldata) - sc->sc_ah->caldata->paprd_packet_sent = true; - - if (!(tx_flags & ATH_TX_ERROR)) - /* Frame was ACKed */ - tx_info->flags |= IEEE80211_TX_STAT_ACK; - - padpos = ieee80211_hdrlen(hdr->frame_control); - padsize = padpos & 3; - if (padsize && skb->len>padpos+padsize) { - /* - * Remove MAC header padding before giving the frame back to - * mac80211. - */ - memmove(skb->data + padsize, skb->data, padpos); - skb_pull(skb, padsize); - } - - spin_lock_irqsave(&sc->sc_pm_lock, flags); - if ((sc->ps_flags & PS_WAIT_FOR_TX_ACK) && !txq->axq_depth) { - sc->ps_flags &= ~PS_WAIT_FOR_TX_ACK; - ath_dbg(common, PS, - "Going back to sleep after having received TX status (0x%lx)\n", - sc->ps_flags & (PS_WAIT_FOR_BEACON | - PS_WAIT_FOR_CAB | - PS_WAIT_FOR_PSPOLL_DATA | - PS_WAIT_FOR_TX_ACK)); - } - spin_unlock_irqrestore(&sc->sc_pm_lock, flags); - - q = skb_get_queue_mapping(skb); - if (txq == sc->tx.txq_map[q]) { - if (WARN_ON(--txq->pending_frames < 0)) - txq->pending_frames = 0; - - if (txq->stopped && - txq->pending_frames < sc->tx.txq_max_pending[q]) { - ieee80211_wake_queue(sc->hw, q); - txq->stopped = false; - } - } - - __skb_queue_tail(&txq->complete_q, skb); -} - -static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, - struct ath_txq *txq, struct list_head *bf_q, - struct ath_tx_status *ts, int txok) -{ - struct sk_buff *skb = bf->bf_mpdu; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - unsigned long flags; - int tx_flags = 0; - - if (!txok) - tx_flags |= ATH_TX_ERROR; - - if (ts->ts_status & ATH9K_TXERR_FILT) - tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; - - dma_unmap_single(sc->dev, bf->bf_buf_addr, skb->len, DMA_TO_DEVICE); - bf->bf_buf_addr = 0; - - if (bf->bf_state.bfs_paprd) { - if (time_after(jiffies, - bf->bf_state.bfs_paprd_timestamp + - msecs_to_jiffies(ATH_PAPRD_TIMEOUT))) - dev_kfree_skb_any(skb); - else - complete(&sc->paprd_complete); - } else { - ath_debug_stat_tx(sc, bf, ts, txq, tx_flags); - ath_tx_complete(sc, skb, tx_flags, txq); - } - /* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't - * accidentally reference it later. - */ - bf->bf_mpdu = NULL; - - /* - * Return the list of ath_buf of this mpdu to free queue - */ - spin_lock_irqsave(&sc->tx.txbuflock, flags); - list_splice_tail_init(bf_q, &sc->tx.txbuf); - spin_unlock_irqrestore(&sc->tx.txbuflock, flags); -} - -static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, - struct ath_tx_status *ts, int nframes, int nbad, - int txok) -{ - struct sk_buff *skb = bf->bf_mpdu; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_hw *hw = sc->hw; - struct ath_hw *ah = sc->sc_ah; - u8 i, tx_rateindex; - - if (txok) - tx_info->status.ack_signal = ts->ts_rssi; - - tx_rateindex = ts->ts_rateindex; - WARN_ON(tx_rateindex >= hw->max_rates); - - if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { - tx_info->flags |= IEEE80211_TX_STAT_AMPDU; - - BUG_ON(nbad > nframes); - } - tx_info->status.ampdu_len = nframes; - tx_info->status.ampdu_ack_len = nframes - nbad; - - if ((ts->ts_status & ATH9K_TXERR_FILT) == 0 && - (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) == 0) { - /* - * If an underrun error is seen assume it as an excessive - * retry only if max frame trigger level has been reached - * (2 KB for single stream, and 4 KB for dual stream). - * Adjust the long retry as if the frame was tried - * hw->max_rate_tries times to affect how rate control updates - * PER for the failed rate. - * In case of congestion on the bus penalizing this type of - * underruns should help hardware actually transmit new frames - * successfully by eventually preferring slower rates. - * This itself should also alleviate congestion on the bus. - */ - if (unlikely(ts->ts_flags & (ATH9K_TX_DATA_UNDERRUN | - ATH9K_TX_DELIM_UNDERRUN)) && - ieee80211_is_data(hdr->frame_control) && - ah->tx_trig_level >= sc->sc_ah->config.max_txtrig_level) - tx_info->status.rates[tx_rateindex].count = - hw->max_rate_tries; - } - - for (i = tx_rateindex + 1; i < hw->max_rates; i++) { - tx_info->status.rates[i].count = 0; - tx_info->status.rates[i].idx = -1; - } - - tx_info->status.rates[tx_rateindex].count = ts->ts_longretry + 1; -} - -static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) -{ - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(ah); - struct ath_buf *bf, *lastbf, *bf_held = NULL; - struct list_head bf_head; - struct ath_desc *ds; - struct ath_tx_status ts; - int status; - - ath_dbg(common, QUEUE, "tx queue %d (%x), link %p\n", - txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum), - txq->axq_link); - - ath_txq_lock(sc, txq); - for (;;) { - if (test_bit(SC_OP_HW_RESET, &sc->sc_flags)) - break; - - if (list_empty(&txq->axq_q)) { - txq->axq_link = NULL; - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) - ath_txq_schedule(sc, txq); - break; - } - bf = list_first_entry(&txq->axq_q, struct ath_buf, list); - - /* - * There is a race condition that a BH gets scheduled - * after sw writes TxE and before hw re-load the last - * descriptor to get the newly chained one. - * Software must keep the last DONE descriptor as a - * holding descriptor - software does so by marking - * it with the STALE flag. - */ - bf_held = NULL; - if (bf->bf_stale) { - bf_held = bf; - if (list_is_last(&bf_held->list, &txq->axq_q)) - break; - - bf = list_entry(bf_held->list.next, struct ath_buf, - list); - } - - lastbf = bf->bf_lastbf; - ds = lastbf->bf_desc; - - memset(&ts, 0, sizeof(ts)); - status = ath9k_hw_txprocdesc(ah, ds, &ts); - if (status == -EINPROGRESS) - break; - - TX_STAT_INC(txq->axq_qnum, txprocdesc); - - /* - * Remove ath_buf's of the same transmit unit from txq, - * however leave the last descriptor back as the holding - * descriptor for hw. - */ - lastbf->bf_stale = true; - INIT_LIST_HEAD(&bf_head); - if (!list_is_singular(&lastbf->list)) - list_cut_position(&bf_head, - &txq->axq_q, lastbf->list.prev); - - if (bf_held) { - list_del(&bf_held->list); - ath_tx_return_buffer(sc, bf_held); - } - - ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head); - } - ath_txq_unlock_complete(sc, txq); -} - -void ath_tx_tasklet(struct ath_softc *sc) -{ - struct ath_hw *ah = sc->sc_ah; - u32 qcumask = ((1 << ATH9K_NUM_TX_QUEUES) - 1) & ah->intr_txqs; - int i; - - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { - if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i))) - ath_tx_processq(sc, &sc->tx.txq[i]); - } -} - -void ath_tx_edma_tasklet(struct ath_softc *sc) -{ - struct ath_tx_status ts; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_hw *ah = sc->sc_ah; - struct ath_txq *txq; - struct ath_buf *bf, *lastbf; - struct list_head bf_head; - struct list_head *fifo_list; - int status; - - for (;;) { - if (test_bit(SC_OP_HW_RESET, &sc->sc_flags)) - break; - - status = ath9k_hw_txprocdesc(ah, NULL, (void *)&ts); - if (status == -EINPROGRESS) - break; - if (status == -EIO) { - ath_dbg(common, XMIT, "Error processing tx status\n"); - break; - } - - /* Process beacon completions separately */ - if (ts.qid == sc->beacon.beaconq) { - sc->beacon.tx_processed = true; - sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK); - continue; - } - - txq = &sc->tx.txq[ts.qid]; - - ath_txq_lock(sc, txq); - - TX_STAT_INC(txq->axq_qnum, txprocdesc); - - fifo_list = &txq->txq_fifo[txq->txq_tailidx]; - if (list_empty(fifo_list)) { - ath_txq_unlock(sc, txq); - return; - } - - bf = list_first_entry(fifo_list, struct ath_buf, list); - if (bf->bf_stale) { - list_del(&bf->list); - ath_tx_return_buffer(sc, bf); - bf = list_first_entry(fifo_list, struct ath_buf, list); - } - - lastbf = bf->bf_lastbf; - - INIT_LIST_HEAD(&bf_head); - if (list_is_last(&lastbf->list, fifo_list)) { - list_splice_tail_init(fifo_list, &bf_head); - INCR(txq->txq_tailidx, ATH_TXFIFO_DEPTH); - - if (!list_empty(&txq->axq_q)) { - struct list_head bf_q; - - INIT_LIST_HEAD(&bf_q); - txq->axq_link = NULL; - list_splice_tail_init(&txq->axq_q, &bf_q); - ath_tx_txqaddbuf(sc, txq, &bf_q, true); - } - } else { - lastbf->bf_stale = true; - if (bf != lastbf) - list_cut_position(&bf_head, fifo_list, - lastbf->list.prev); - } - - ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head); - ath_txq_unlock_complete(sc, txq); - } -} - -/*****************/ -/* Init, Cleanup */ -/*****************/ - -static int ath_txstatus_setup(struct ath_softc *sc, int size) -{ - struct ath_descdma *dd = &sc->txsdma; - u8 txs_len = sc->sc_ah->caps.txs_len; - - dd->dd_desc_len = size * txs_len; - dd->dd_desc = dmam_alloc_coherent(sc->dev, dd->dd_desc_len, - &dd->dd_desc_paddr, GFP_KERNEL); - if (!dd->dd_desc) - return -ENOMEM; - - return 0; -} - -static int ath_tx_edma_init(struct ath_softc *sc) -{ - int err; - - err = ath_txstatus_setup(sc, ATH_TXSTATUS_RING_SIZE); - if (!err) - ath9k_hw_setup_statusring(sc->sc_ah, sc->txsdma.dd_desc, - sc->txsdma.dd_desc_paddr, - ATH_TXSTATUS_RING_SIZE); - - return err; -} - -int ath_tx_init(struct ath_softc *sc, int nbufs) -{ - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - int error = 0; - - spin_lock_init(&sc->tx.txbuflock); - - error = ath_descdma_setup(sc, &sc->tx.txdma, &sc->tx.txbuf, - "tx", nbufs, 1, 1); - if (error != 0) { - ath_err(common, - "Failed to allocate tx descriptors: %d\n", error); - return error; - } - - error = ath_descdma_setup(sc, &sc->beacon.bdma, &sc->beacon.bbuf, - "beacon", ATH_BCBUF, 1, 1); - if (error != 0) { - ath_err(common, - "Failed to allocate beacon descriptors: %d\n", error); - return error; - } - - INIT_DELAYED_WORK(&sc->tx_complete_work, ath_tx_complete_poll_work); - - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) - error = ath_tx_edma_init(sc); - - return error; -} - -void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an) -{ - struct ath_atx_tid *tid; - struct ath_atx_ac *ac; - int tidno, acno; - - for (tidno = 0, tid = &an->tid[tidno]; - tidno < IEEE80211_NUM_TIDS; - tidno++, tid++) { - tid->an = an; - tid->tidno = tidno; - tid->seq_start = tid->seq_next = 0; - tid->baw_size = WME_MAX_BA; - tid->baw_head = tid->baw_tail = 0; - tid->sched = false; - tid->paused = false; - tid->active = false; - __skb_queue_head_init(&tid->buf_q); - acno = TID_TO_WME_AC(tidno); - tid->ac = &an->ac[acno]; - } - - for (acno = 0, ac = &an->ac[acno]; - acno < IEEE80211_NUM_ACS; acno++, ac++) { - ac->sched = false; - ac->clear_ps_filter = true; - ac->txq = sc->tx.txq_map[acno]; - INIT_LIST_HEAD(&ac->tid_q); - } -} - -void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an) -{ - struct ath_atx_ac *ac; - struct ath_atx_tid *tid; - struct ath_txq *txq; - int tidno; - - for (tidno = 0, tid = &an->tid[tidno]; - tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { - - ac = tid->ac; - txq = ac->txq; - - ath_txq_lock(sc, txq); - - if (tid->sched) { - list_del(&tid->list); - tid->sched = false; - } - - if (ac->sched) { - list_del(&ac->list); - tid->ac->sched = false; - } - - ath_tid_drain(sc, txq, tid); - tid->active = false; - - ath_txq_unlock(sc, txq); - } -} diff --git a/drivers/net/wireless/ath/carl9170/Kconfig b/drivers/net/wireless/ath/carl9170/Kconfig deleted file mode 100644 index 1a796e5f69ec..000000000000 --- a/drivers/net/wireless/ath/carl9170/Kconfig +++ /dev/null @@ -1,56 +0,0 @@ -config CARL9170 - tristate "Linux Community AR9170 802.11n USB support" - depends on USB && MAC80211 - select ATH_COMMON - select FW_LOADER - select CRC32 - help - This is another driver for the Atheros "otus" 802.11n USB devices. - - This driver provides more features than the original, - but it needs a special firmware (carl9170-1.fw) to do that. - - The firmware can be downloaded from our wiki here: - - - If you choose to build a module, it'll be called carl9170. - -config CARL9170_LEDS - bool "SoftLED Support" - depends on CARL9170 - select MAC80211_LEDS - select LEDS_CLASS - select NEW_LEDS - default y - help - This option is necessary, if you want your device' LEDs to blink - - Say Y, unless you need the LEDs for firmware debugging. - -config CARL9170_DEBUGFS - bool "DebugFS Support" - depends on CARL9170 && DEBUG_FS && MAC80211_DEBUGFS - default n - help - Export several driver and device internals to user space. - - Say N. - -config CARL9170_WPC - bool - depends on CARL9170 && (INPUT = y || INPUT = CARL9170) - default y - -config CARL9170_HWRNG - bool "Random number generator" - depends on CARL9170 && (HW_RANDOM = y || HW_RANDOM = CARL9170) - default n - help - Provides a hardware random number generator to the kernel. - - SECURITY WARNING: It's relatively easy to eavesdrop all - generated random numbers from the transport stream with - usbmon [software] or special usb sniffer hardware. - - Say N, unless your setup[i.e.: embedded system] has no - other rng source and you can afford to take the risk. diff --git a/drivers/net/wireless/ath/carl9170/Makefile b/drivers/net/wireless/ath/carl9170/Makefile deleted file mode 100644 index f64ed76af8ad..000000000000 --- a/drivers/net/wireless/ath/carl9170/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -carl9170-objs := main.o usb.o cmd.o mac.o phy.o led.o fw.o tx.o rx.o -carl9170-$(CONFIG_CARL9170_DEBUGFS) += debug.o - -obj-$(CONFIG_CARL9170) += carl9170.o diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h deleted file mode 100644 index 9dce106cd6d4..000000000000 --- a/drivers/net/wireless/ath/carl9170/carl9170.h +++ /dev/null @@ -1,666 +0,0 @@ -/* - * Atheros CARL9170 driver - * - * Driver specific definitions - * - * Copyright 2008, Johannes Berg - * Copyright 2009, 2010, Christian Lamparter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef __CARL9170_H -#define __CARL9170_H - -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_CARL9170_LEDS -#include -#endif /* CONFIG_CARL9170_LEDS */ -#ifdef CONFIG_CARL9170_WPC -#include -#endif /* CONFIG_CARL9170_WPC */ -#include "eeprom.h" -#include "wlan.h" -#include "hw.h" -#include "fwdesc.h" -#include "fwcmd.h" -#include "../regd.h" - -#ifdef CONFIG_CARL9170_DEBUGFS -#include "debug.h" -#endif /* CONFIG_CARL9170_DEBUGFS */ - -#define CARL9170FW_NAME "carl9170-1.fw" - -#define PAYLOAD_MAX (CARL9170_MAX_CMD_LEN / 4 - 1) - -static const u8 ar9170_qmap[__AR9170_NUM_TXQ] = { 3, 2, 1, 0 }; - -#define CARL9170_MAX_RX_BUFFER_SIZE 8192 - -enum carl9170_device_state { - CARL9170_UNKNOWN_STATE, - CARL9170_STOPPED, - CARL9170_IDLE, - CARL9170_STARTED, -}; - -#define WME_BA_BMP_SIZE 64 -#define CARL9170_TX_USER_RATE_TRIES 3 - -#define TID_TO_WME_AC(_tid) \ - ((((_tid) == 0) || ((_tid) == 3)) ? IEEE80211_AC_BE : \ - (((_tid) == 1) || ((_tid) == 2)) ? IEEE80211_AC_BK : \ - (((_tid) == 4) || ((_tid) == 5)) ? IEEE80211_AC_VI : \ - IEEE80211_AC_VO) - -#define SEQ_DIFF(_start, _seq) \ - (((_start) - (_seq)) & 0x0fff) -#define SEQ_PREV(_seq) \ - (((_seq) - 1) & 0x0fff) -#define SEQ_NEXT(_seq) \ - (((_seq) + 1) & 0x0fff) -#define BAW_WITHIN(_start, _bawsz, _seqno) \ - ((((_seqno) - (_start)) & 0xfff) < (_bawsz)) - -enum carl9170_tid_state { - CARL9170_TID_STATE_INVALID, - CARL9170_TID_STATE_KILLED, - CARL9170_TID_STATE_SHUTDOWN, - CARL9170_TID_STATE_SUSPEND, - CARL9170_TID_STATE_PROGRESS, - CARL9170_TID_STATE_IDLE, - CARL9170_TID_STATE_XMIT, -}; - -#define CARL9170_BAW_BITS (2 * WME_BA_BMP_SIZE) -#define CARL9170_BAW_SIZE (BITS_TO_LONGS(CARL9170_BAW_BITS)) -#define CARL9170_BAW_LEN (DIV_ROUND_UP(CARL9170_BAW_BITS, BITS_PER_BYTE)) - -struct carl9170_sta_tid { - /* must be the first entry! */ - struct list_head list; - - /* temporary list for RCU unlink procedure */ - struct list_head tmp_list; - - /* lock for the following data structures */ - spinlock_t lock; - - unsigned int counter; - enum carl9170_tid_state state; - u8 tid; /* TID number ( 0 - 15 ) */ - u16 max; /* max. AMPDU size */ - - u16 snx; /* awaiting _next_ frame */ - u16 hsn; /* highest _queued_ sequence */ - u16 bsn; /* base of the tx/agg bitmap */ - unsigned long bitmap[CARL9170_BAW_SIZE]; - - /* Preaggregation reorder queue */ - struct sk_buff_head queue; -}; - -#define CARL9170_QUEUE_TIMEOUT 256 -#define CARL9170_BUMP_QUEUE 1000 -#define CARL9170_TX_TIMEOUT 2500 -#define CARL9170_JANITOR_DELAY 128 -#define CARL9170_QUEUE_STUCK_TIMEOUT 5500 -#define CARL9170_STAT_WORK 30000 - -#define CARL9170_NUM_TX_AGG_MAX 30 - -/* - * Tradeoff between stability/latency and speed. - * - * AR9170_TXQ_DEPTH is devised by dividing the amount of available - * tx buffers with the size of a full ethernet frame + overhead. - * - * Naturally: The higher the limit, the faster the device CAN send. - * However, even a slight over-commitment at the wrong time and the - * hardware is doomed to send all already-queued frames at suboptimal - * rates. This in turn leads to an enormous amount of unsuccessful - * retries => Latency goes up, whereas the throughput goes down. CRASH! - */ -#define CARL9170_NUM_TX_LIMIT_HARD ((AR9170_TXQ_DEPTH * 3) / 2) -#define CARL9170_NUM_TX_LIMIT_SOFT (AR9170_TXQ_DEPTH) - -struct carl9170_tx_queue_stats { - unsigned int count; - unsigned int limit; - unsigned int len; -}; - -struct carl9170_vif { - unsigned int id; - struct ieee80211_vif __rcu *vif; -}; - -struct carl9170_vif_info { - struct list_head list; - bool active; - unsigned int id; - struct sk_buff *beacon; - bool enable_beacon; -}; - -#define AR9170_NUM_RX_URBS 16 -#define AR9170_NUM_RX_URBS_MUL 2 -#define AR9170_NUM_TX_URBS 8 -#define AR9170_NUM_RX_URBS_POOL (AR9170_NUM_RX_URBS_MUL * AR9170_NUM_RX_URBS) - -enum carl9170_device_features { - CARL9170_WPS_BUTTON = BIT(0), - CARL9170_ONE_LED = BIT(1), -}; - -#ifdef CONFIG_CARL9170_LEDS -struct ar9170; - -struct carl9170_led { - struct ar9170 *ar; - struct led_classdev l; - char name[32]; - unsigned int toggled; - bool last_state; - bool registered; -}; -#endif /* CONFIG_CARL9170_LEDS */ - -enum carl9170_restart_reasons { - CARL9170_RR_NO_REASON = 0, - CARL9170_RR_FATAL_FIRMWARE_ERROR, - CARL9170_RR_TOO_MANY_FIRMWARE_ERRORS, - CARL9170_RR_WATCHDOG, - CARL9170_RR_STUCK_TX, - CARL9170_RR_UNRESPONSIVE_DEVICE, - CARL9170_RR_COMMAND_TIMEOUT, - CARL9170_RR_TOO_MANY_PHY_ERRORS, - CARL9170_RR_LOST_RSP, - CARL9170_RR_INVALID_RSP, - CARL9170_RR_USER_REQUEST, - - __CARL9170_RR_LAST, -}; - -enum carl9170_erp_modes { - CARL9170_ERP_INVALID, - CARL9170_ERP_AUTO, - CARL9170_ERP_MAC80211, - CARL9170_ERP_OFF, - CARL9170_ERP_CTS, - CARL9170_ERP_RTS, - __CARL9170_ERP_NUM, -}; - -struct ar9170 { - struct ath_common common; - struct ieee80211_hw *hw; - struct mutex mutex; - enum carl9170_device_state state; - spinlock_t state_lock; - enum carl9170_restart_reasons last_reason; - bool registered; - - /* USB */ - struct usb_device *udev; - struct usb_interface *intf; - struct usb_anchor rx_anch; - struct usb_anchor rx_work; - struct usb_anchor rx_pool; - struct usb_anchor tx_wait; - struct usb_anchor tx_anch; - struct usb_anchor tx_cmd; - struct usb_anchor tx_err; - struct tasklet_struct usb_tasklet; - atomic_t tx_cmd_urbs; - atomic_t tx_anch_urbs; - atomic_t rx_anch_urbs; - atomic_t rx_work_urbs; - atomic_t rx_pool_urbs; - kernel_ulong_t features; - - /* firmware settings */ - struct completion fw_load_wait; - struct completion fw_boot_wait; - struct { - const struct carl9170fw_desc_head *desc; - const struct firmware *fw; - unsigned int offset; - unsigned int address; - unsigned int cmd_bufs; - unsigned int api_version; - unsigned int vif_num; - unsigned int err_counter; - unsigned int bug_counter; - u32 beacon_addr; - unsigned int beacon_max_len; - bool rx_stream; - bool tx_stream; - bool rx_filter; - bool hw_counters; - unsigned int mem_blocks; - unsigned int mem_block_size; - unsigned int rx_size; - unsigned int tx_seq_table; - bool ba_filter; - bool disable_offload_fw; - } fw; - - /* interface configuration combinations */ - struct ieee80211_iface_limit if_comb_limits[1]; - struct ieee80211_iface_combination if_combs[1]; - - /* reset / stuck frames/queue detection */ - struct work_struct restart_work; - struct work_struct ping_work; - unsigned int restart_counter; - unsigned long queue_stop_timeout[__AR9170_NUM_TXQ]; - unsigned long max_queue_stop_timeout[__AR9170_NUM_TXQ]; - bool needs_full_reset; - bool force_usb_reset; - atomic_t pending_restarts; - - /* interface mode settings */ - struct list_head vif_list; - unsigned long vif_bitmap; - unsigned int vifs; - struct carl9170_vif vif_priv[AR9170_MAX_VIRTUAL_MAC]; - - /* beaconing */ - spinlock_t beacon_lock; - unsigned int global_pretbtt; - unsigned int global_beacon_int; - struct carl9170_vif_info __rcu *beacon_iter; - unsigned int beacon_enabled; - - /* cryptographic engine */ - u64 usedkeys; - bool rx_software_decryption; - bool disable_offload; - - /* filter settings */ - u64 cur_mc_hash; - u32 cur_filter; - unsigned int filter_state; - unsigned int rx_filter_caps; - bool sniffer_enabled; - - /* MAC */ - enum carl9170_erp_modes erp_mode; - - /* PHY */ - struct ieee80211_channel *channel; - unsigned int num_channels; - int noise[4]; - unsigned int chan_fail; - unsigned int total_chan_fail; - u8 heavy_clip; - u8 ht_settings; - struct { - u64 active; /* usec */ - u64 cca; /* usec */ - u64 tx_time; /* usec */ - u64 rx_total; - u64 rx_overrun; - } tally; - struct delayed_work stat_work; - struct survey_info *survey; - - /* power calibration data */ - u8 power_5G_leg[4]; - u8 power_2G_cck[4]; - u8 power_2G_ofdm[4]; - u8 power_5G_ht20[8]; - u8 power_5G_ht40[8]; - u8 power_2G_ht20[8]; - u8 power_2G_ht40[8]; - -#ifdef CONFIG_CARL9170_LEDS - /* LED */ - struct delayed_work led_work; - struct carl9170_led leds[AR9170_NUM_LEDS]; -#endif /* CONFIG_CARL9170_LEDS */ - - /* qos queue settings */ - spinlock_t tx_stats_lock; - struct carl9170_tx_queue_stats tx_stats[__AR9170_NUM_TXQ]; - struct ieee80211_tx_queue_params edcf[5]; - struct completion tx_flush; - - /* CMD */ - int cmd_seq; - int readlen; - u8 *readbuf; - spinlock_t cmd_lock; - struct completion cmd_wait; - union { - __le32 cmd_buf[PAYLOAD_MAX + 1]; - struct carl9170_cmd cmd; - struct carl9170_rsp rsp; - }; - - /* statistics */ - unsigned int tx_dropped; - unsigned int tx_ack_failures; - unsigned int tx_fcs_errors; - unsigned int rx_dropped; - - /* EEPROM */ - struct ar9170_eeprom eeprom; - - /* tx queuing */ - struct sk_buff_head tx_pending[__AR9170_NUM_TXQ]; - struct sk_buff_head tx_status[__AR9170_NUM_TXQ]; - struct delayed_work tx_janitor; - unsigned long tx_janitor_last_run; - bool tx_schedule; - - /* tx ampdu */ - struct work_struct ampdu_work; - spinlock_t tx_ampdu_list_lock; - struct carl9170_sta_tid __rcu *tx_ampdu_iter; - struct list_head tx_ampdu_list; - atomic_t tx_ampdu_upload; - atomic_t tx_ampdu_scheduler; - atomic_t tx_total_pending; - atomic_t tx_total_queued; - unsigned int tx_ampdu_list_len; - int current_density; - int current_factor; - bool tx_ampdu_schedule; - - /* internal memory management */ - spinlock_t mem_lock; - unsigned long *mem_bitmap; - atomic_t mem_free_blocks; - atomic_t mem_allocs; - - /* rxstream mpdu merge */ - struct ar9170_rx_head rx_plcp; - bool rx_has_plcp; - struct sk_buff *rx_failover; - int rx_failover_missing; - u32 ampdu_ref; - - /* FIFO for collecting outstanding BlockAckRequest */ - struct list_head bar_list[__AR9170_NUM_TXQ]; - spinlock_t bar_list_lock[__AR9170_NUM_TXQ]; - -#ifdef CONFIG_CARL9170_WPC - struct { - bool pbc_state; - struct input_dev *pbc; - char name[32]; - char phys[32]; - } wps; -#endif /* CONFIG_CARL9170_WPC */ - -#ifdef CONFIG_CARL9170_DEBUGFS - struct carl9170_debug debug; - struct dentry *debug_dir; -#endif /* CONFIG_CARL9170_DEBUGFS */ - - /* PSM */ - struct work_struct ps_work; - struct { - unsigned int dtim_counter; - unsigned long last_beacon; - unsigned long last_action; - unsigned long last_slept; - unsigned int sleep_ms; - unsigned int off_override; - bool state; - } ps; - -#ifdef CONFIG_CARL9170_HWRNG -# define CARL9170_HWRNG_CACHE_SIZE CARL9170_MAX_CMD_PAYLOAD_LEN - struct { - struct hwrng rng; - bool initialized; - char name[30 + 1]; - u16 cache[CARL9170_HWRNG_CACHE_SIZE / sizeof(u16)]; - unsigned int cache_idx; - } rng; -#endif /* CONFIG_CARL9170_HWRNG */ -}; - -enum carl9170_ps_off_override_reasons { - PS_OFF_VIF = BIT(0), - PS_OFF_BCN = BIT(1), -}; - -struct carl9170_bar_list_entry { - struct list_head list; - struct rcu_head head; - struct sk_buff *skb; -}; - -struct carl9170_ba_stats { - u8 ampdu_len; - u8 ampdu_ack_len; - bool clear; - bool req; -}; - -struct carl9170_sta_info { - bool ht_sta; - bool sleeping; - atomic_t pending_frames; - unsigned int ampdu_max_len; - struct carl9170_sta_tid __rcu *agg[IEEE80211_NUM_TIDS]; - struct carl9170_ba_stats stats[IEEE80211_NUM_TIDS]; -}; - -struct carl9170_tx_info { - unsigned long timeout; - struct ar9170 *ar; - struct kref ref; -}; - -#define CHK_DEV_STATE(a, s) (((struct ar9170 *)a)->state >= (s)) -#define IS_INITIALIZED(a) (CHK_DEV_STATE(a, CARL9170_STOPPED)) -#define IS_ACCEPTING_CMD(a) (CHK_DEV_STATE(a, CARL9170_IDLE)) -#define IS_STARTED(a) (CHK_DEV_STATE(a, CARL9170_STARTED)) - -static inline void __carl9170_set_state(struct ar9170 *ar, - enum carl9170_device_state newstate) -{ - ar->state = newstate; -} - -static inline void carl9170_set_state(struct ar9170 *ar, - enum carl9170_device_state newstate) -{ - unsigned long flags; - - spin_lock_irqsave(&ar->state_lock, flags); - __carl9170_set_state(ar, newstate); - spin_unlock_irqrestore(&ar->state_lock, flags); -} - -static inline void carl9170_set_state_when(struct ar9170 *ar, - enum carl9170_device_state min, enum carl9170_device_state newstate) -{ - unsigned long flags; - - spin_lock_irqsave(&ar->state_lock, flags); - if (CHK_DEV_STATE(ar, min)) - __carl9170_set_state(ar, newstate); - spin_unlock_irqrestore(&ar->state_lock, flags); -} - -/* exported interface */ -void *carl9170_alloc(size_t priv_size); -int carl9170_register(struct ar9170 *ar); -void carl9170_unregister(struct ar9170 *ar); -void carl9170_free(struct ar9170 *ar); -void carl9170_restart(struct ar9170 *ar, const enum carl9170_restart_reasons r); -void carl9170_ps_check(struct ar9170 *ar); - -/* USB back-end */ -int carl9170_usb_open(struct ar9170 *ar); -void carl9170_usb_stop(struct ar9170 *ar); -void carl9170_usb_tx(struct ar9170 *ar, struct sk_buff *skb); -void carl9170_usb_handle_tx_err(struct ar9170 *ar); -int carl9170_exec_cmd(struct ar9170 *ar, const enum carl9170_cmd_oids, - u32 plen, void *payload, u32 rlen, void *resp); -int __carl9170_exec_cmd(struct ar9170 *ar, struct carl9170_cmd *cmd, - const bool free_buf); -int carl9170_usb_restart(struct ar9170 *ar); -void carl9170_usb_reset(struct ar9170 *ar); - -/* MAC */ -int carl9170_init_mac(struct ar9170 *ar); -int carl9170_set_qos(struct ar9170 *ar); -int carl9170_update_multicast(struct ar9170 *ar, const u64 mc_hast); -int carl9170_mod_virtual_mac(struct ar9170 *ar, const unsigned int id, - const u8 *mac); -int carl9170_set_operating_mode(struct ar9170 *ar); -int carl9170_set_beacon_timers(struct ar9170 *ar); -int carl9170_set_dyn_sifs_ack(struct ar9170 *ar); -int carl9170_set_rts_cts_rate(struct ar9170 *ar); -int carl9170_set_ampdu_settings(struct ar9170 *ar); -int carl9170_set_slot_time(struct ar9170 *ar); -int carl9170_set_mac_rates(struct ar9170 *ar); -int carl9170_set_hwretry_limit(struct ar9170 *ar, const u32 max_retry); -int carl9170_upload_key(struct ar9170 *ar, const u8 id, const u8 *mac, - const u8 ktype, const u8 keyidx, const u8 *keydata, const int keylen); -int carl9170_disable_key(struct ar9170 *ar, const u8 id); -int carl9170_set_mac_tpc(struct ar9170 *ar, struct ieee80211_channel *channel); - -/* RX */ -void carl9170_rx(struct ar9170 *ar, void *buf, unsigned int len); -void carl9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len); - -/* TX */ -void carl9170_op_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb); -void carl9170_tx_janitor(struct work_struct *work); -void carl9170_tx_process_status(struct ar9170 *ar, - const struct carl9170_rsp *cmd); -void carl9170_tx_status(struct ar9170 *ar, struct sk_buff *skb, - const bool success); -void carl9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb); -void carl9170_tx_drop(struct ar9170 *ar, struct sk_buff *skb); -void carl9170_tx_scheduler(struct ar9170 *ar); -void carl9170_tx_get_skb(struct sk_buff *skb); -int carl9170_tx_put_skb(struct sk_buff *skb); -int carl9170_update_beacon(struct ar9170 *ar, const bool submit); - -/* LEDs */ -#ifdef CONFIG_CARL9170_LEDS -int carl9170_led_register(struct ar9170 *ar); -void carl9170_led_unregister(struct ar9170 *ar); -#endif /* CONFIG_CARL9170_LEDS */ -int carl9170_led_init(struct ar9170 *ar); -int carl9170_led_set_state(struct ar9170 *ar, const u32 led_state); - -/* PHY / RF */ -int carl9170_set_channel(struct ar9170 *ar, struct ieee80211_channel *channel, - enum nl80211_channel_type bw); -int carl9170_get_noisefloor(struct ar9170 *ar); - -/* FW */ -int carl9170_parse_firmware(struct ar9170 *ar); - -extern struct ieee80211_rate __carl9170_ratetable[]; -extern int modparam_noht; - -static inline struct ar9170 *carl9170_get_priv(struct carl9170_vif *carl_vif) -{ - return container_of(carl_vif, struct ar9170, - vif_priv[carl_vif->id]); -} - -static inline struct ieee80211_hdr *carl9170_get_hdr(struct sk_buff *skb) -{ - return (void *)((struct _carl9170_tx_superframe *) - skb->data)->frame_data; -} - -static inline u16 get_seq_h(struct ieee80211_hdr *hdr) -{ - return le16_to_cpu(hdr->seq_ctrl) >> 4; -} - -static inline u16 carl9170_get_seq(struct sk_buff *skb) -{ - return get_seq_h(carl9170_get_hdr(skb)); -} - -static inline u16 get_tid_h(struct ieee80211_hdr *hdr) -{ - return (ieee80211_get_qos_ctl(hdr))[0] & IEEE80211_QOS_CTL_TID_MASK; -} - -static inline u16 carl9170_get_tid(struct sk_buff *skb) -{ - return get_tid_h(carl9170_get_hdr(skb)); -} - -static inline struct ieee80211_vif * -carl9170_get_vif(struct carl9170_vif_info *priv) -{ - return container_of((void *)priv, struct ieee80211_vif, drv_priv); -} - -/* Protected by ar->mutex or RCU */ -static inline struct ieee80211_vif *carl9170_get_main_vif(struct ar9170 *ar) -{ - struct carl9170_vif_info *cvif; - - list_for_each_entry_rcu(cvif, &ar->vif_list, list) { - if (cvif->active) - return carl9170_get_vif(cvif); - } - - return NULL; -} - -static inline bool is_main_vif(struct ar9170 *ar, struct ieee80211_vif *vif) -{ - bool ret; - - rcu_read_lock(); - ret = (carl9170_get_main_vif(ar) == vif); - rcu_read_unlock(); - return ret; -} - -#endif /* __CARL9170_H */ diff --git a/drivers/net/wireless/ath/carl9170/cmd.c b/drivers/net/wireless/ath/carl9170/cmd.c deleted file mode 100644 index 39a63874b275..000000000000 --- a/drivers/net/wireless/ath/carl9170/cmd.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Atheros CARL9170 driver - * - * Basic HW register/memory/command access functions - * - * Copyright 2008, Johannes Berg - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "carl9170.h" -#include "cmd.h" - -int carl9170_write_reg(struct ar9170 *ar, const u32 reg, const u32 val) -{ - const __le32 buf[2] = { - cpu_to_le32(reg), - cpu_to_le32(val), - }; - int err; - - err = carl9170_exec_cmd(ar, CARL9170_CMD_WREG, sizeof(buf), - (u8 *) buf, 0, NULL); - if (err) { - if (net_ratelimit()) { - wiphy_err(ar->hw->wiphy, "writing reg %#x " - "(val %#x) failed (%d)\n", reg, val, err); - } - } - return err; -} - -int carl9170_read_mreg(struct ar9170 *ar, const int nregs, - const u32 *regs, u32 *out) -{ - int i, err; - __le32 *offs, *res; - - /* abuse "out" for the register offsets, must be same length */ - offs = (__le32 *)out; - for (i = 0; i < nregs; i++) - offs[i] = cpu_to_le32(regs[i]); - - /* also use the same buffer for the input */ - res = (__le32 *)out; - - err = carl9170_exec_cmd(ar, CARL9170_CMD_RREG, - 4 * nregs, (u8 *)offs, - 4 * nregs, (u8 *)res); - if (err) { - if (net_ratelimit()) { - wiphy_err(ar->hw->wiphy, "reading regs failed (%d)\n", - err); - } - return err; - } - - /* convert result to cpu endian */ - for (i = 0; i < nregs; i++) - out[i] = le32_to_cpu(res[i]); - - return 0; -} - -int carl9170_read_reg(struct ar9170 *ar, u32 reg, u32 *val) -{ - return carl9170_read_mreg(ar, 1, ®, val); -} - -int carl9170_echo_test(struct ar9170 *ar, const u32 v) -{ - u32 echores; - int err; - - err = carl9170_exec_cmd(ar, CARL9170_CMD_ECHO, - 4, (u8 *)&v, - 4, (u8 *)&echores); - if (err) - return err; - - if (v != echores) { - wiphy_info(ar->hw->wiphy, "wrong echo %x != %x", v, echores); - return -EINVAL; - } - - return 0; -} - -struct carl9170_cmd *carl9170_cmd_buf(struct ar9170 *ar, - const enum carl9170_cmd_oids cmd, const unsigned int len) -{ - struct carl9170_cmd *tmp; - - tmp = kzalloc(sizeof(struct carl9170_cmd_head) + len, GFP_ATOMIC); - if (tmp) { - tmp->hdr.cmd = cmd; - tmp->hdr.len = len; - } - - return tmp; -} - -int carl9170_reboot(struct ar9170 *ar) -{ - struct carl9170_cmd *cmd; - int err; - - cmd = carl9170_cmd_buf(ar, CARL9170_CMD_REBOOT_ASYNC, 0); - if (!cmd) - return -ENOMEM; - - err = __carl9170_exec_cmd(ar, cmd, true); - return err; -} - -int carl9170_mac_reset(struct ar9170 *ar) -{ - return carl9170_exec_cmd(ar, CARL9170_CMD_SWRST, - 0, NULL, 0, NULL); -} - -int carl9170_bcn_ctrl(struct ar9170 *ar, const unsigned int vif_id, - const u32 mode, const u32 addr, const u32 len) -{ - struct carl9170_cmd *cmd; - - cmd = carl9170_cmd_buf(ar, CARL9170_CMD_BCN_CTRL_ASYNC, - sizeof(struct carl9170_bcn_ctrl_cmd)); - if (!cmd) - return -ENOMEM; - - cmd->bcn_ctrl.vif_id = cpu_to_le32(vif_id); - cmd->bcn_ctrl.mode = cpu_to_le32(mode); - cmd->bcn_ctrl.bcn_addr = cpu_to_le32(addr); - cmd->bcn_ctrl.bcn_len = cpu_to_le32(len); - - return __carl9170_exec_cmd(ar, cmd, true); -} - -int carl9170_collect_tally(struct ar9170 *ar) -{ - struct carl9170_tally_rsp tally; - struct survey_info *info; - unsigned int tick; - int err; - - err = carl9170_exec_cmd(ar, CARL9170_CMD_TALLY, 0, NULL, - sizeof(tally), (u8 *)&tally); - if (err) - return err; - - tick = le32_to_cpu(tally.tick); - if (tick) { - ar->tally.active += le32_to_cpu(tally.active) / tick; - ar->tally.cca += le32_to_cpu(tally.cca) / tick; - ar->tally.tx_time += le32_to_cpu(tally.tx_time) / tick; - ar->tally.rx_total += le32_to_cpu(tally.rx_total); - ar->tally.rx_overrun += le32_to_cpu(tally.rx_overrun); - - if (ar->channel) { - info = &ar->survey[ar->channel->hw_value]; - info->channel_time = ar->tally.active; - info->channel_time_busy = ar->tally.cca; - info->channel_time_tx = ar->tally.tx_time; - do_div(info->channel_time, 1000); - do_div(info->channel_time_busy, 1000); - do_div(info->channel_time_tx, 1000); - } - } - return 0; -} - -int carl9170_powersave(struct ar9170 *ar, const bool ps) -{ - struct carl9170_cmd *cmd; - u32 state; - - cmd = carl9170_cmd_buf(ar, CARL9170_CMD_PSM_ASYNC, - sizeof(struct carl9170_psm)); - if (!cmd) - return -ENOMEM; - - if (ps) { - /* Sleep until next TBTT */ - state = CARL9170_PSM_SLEEP | 1; - } else { - /* wake up immediately */ - state = 1; - } - - cmd->psm.state = cpu_to_le32(state); - return __carl9170_exec_cmd(ar, cmd, true); -} diff --git a/drivers/net/wireless/ath/carl9170/cmd.h b/drivers/net/wireless/ath/carl9170/cmd.h deleted file mode 100644 index 65919c902f55..000000000000 --- a/drivers/net/wireless/ath/carl9170/cmd.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Atheros CARL9170 driver - * - * Basic HW register/memory/command access functions - * - * Copyright 2008, Johannes Berg - * Copyright 2010, Christian Lamparter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef __CMD_H -#define __CMD_H - -#include "carl9170.h" - -/* basic HW access */ -int carl9170_write_reg(struct ar9170 *ar, const u32 reg, const u32 val); -int carl9170_read_reg(struct ar9170 *ar, const u32 reg, u32 *val); -int carl9170_read_mreg(struct ar9170 *ar, const int nregs, - const u32 *regs, u32 *out); -int carl9170_echo_test(struct ar9170 *ar, u32 v); -int carl9170_reboot(struct ar9170 *ar); -int carl9170_mac_reset(struct ar9170 *ar); -int carl9170_powersave(struct ar9170 *ar, const bool power_on); -int carl9170_collect_tally(struct ar9170 *ar); -int carl9170_bcn_ctrl(struct ar9170 *ar, const unsigned int vif_id, - const u32 mode, const u32 addr, const u32 len); - -static inline int carl9170_flush_cab(struct ar9170 *ar, - const unsigned int vif_id) -{ - return carl9170_bcn_ctrl(ar, vif_id, CARL9170_BCN_CTRL_DRAIN, 0, 0); -} - -static inline int carl9170_rx_filter(struct ar9170 *ar, - const unsigned int _rx_filter) -{ - __le32 rx_filter = cpu_to_le32(_rx_filter); - - return carl9170_exec_cmd(ar, CARL9170_CMD_RX_FILTER, - sizeof(rx_filter), (u8 *)&rx_filter, - 0, NULL); -} - -struct carl9170_cmd *carl9170_cmd_buf(struct ar9170 *ar, - const enum carl9170_cmd_oids cmd, const unsigned int len); - -/* - * Macros to facilitate writing multiple registers in a single - * write-combining USB command. Note that when the first group - * fails the whole thing will fail without any others attempted, - * but you won't know which write in the group failed. - */ -#define carl9170_regwrite_begin(ar) \ -do { \ - int __nreg = 0, __err = 0; \ - struct ar9170 *__ar = ar; - -#define carl9170_regwrite(r, v) do { \ - __ar->cmd_buf[2 * __nreg + 1] = cpu_to_le32(r); \ - __ar->cmd_buf[2 * __nreg + 2] = cpu_to_le32(v); \ - __nreg++; \ - if ((__nreg >= PAYLOAD_MAX / 2)) { \ - if (IS_ACCEPTING_CMD(__ar)) \ - __err = carl9170_exec_cmd(__ar, \ - CARL9170_CMD_WREG, 8 * __nreg, \ - (u8 *) &__ar->cmd_buf[1], 0, NULL); \ - else \ - goto __regwrite_out; \ - \ - __nreg = 0; \ - if (__err) \ - goto __regwrite_out; \ - } \ -} while (0) - -#define carl9170_regwrite_finish() \ -__regwrite_out : \ - if (__err == 0 && __nreg) { \ - if (IS_ACCEPTING_CMD(__ar)) \ - __err = carl9170_exec_cmd(__ar, \ - CARL9170_CMD_WREG, 8 * __nreg, \ - (u8 *) &__ar->cmd_buf[1], 0, NULL); \ - __nreg = 0; \ - } - -#define carl9170_regwrite_result() \ - __err; \ -} while (0) - - -#define carl9170_async_regwrite_get_buf() \ -do { \ - __nreg = 0; \ - __cmd = carl9170_cmd_buf(__carl, CARL9170_CMD_WREG_ASYNC, \ - CARL9170_MAX_CMD_PAYLOAD_LEN); \ - if (__cmd == NULL) { \ - __err = -ENOMEM; \ - goto __async_regwrite_out; \ - } \ -} while (0) - -#define carl9170_async_regwrite_begin(carl) \ -do { \ - struct ar9170 *__carl = carl; \ - struct carl9170_cmd *__cmd; \ - unsigned int __nreg; \ - int __err = 0; \ - carl9170_async_regwrite_get_buf(); \ - -#define carl9170_async_regwrite_flush() \ -do { \ - if (__cmd == NULL || __nreg == 0) \ - break; \ - \ - if (IS_ACCEPTING_CMD(__carl) && __nreg) { \ - __cmd->hdr.len = 8 * __nreg; \ - __err = __carl9170_exec_cmd(__carl, __cmd, true); \ - __cmd = NULL; \ - break; \ - } \ - goto __async_regwrite_out; \ -} while (0) - -#define carl9170_async_regwrite(r, v) do { \ - if (__cmd == NULL) \ - carl9170_async_regwrite_get_buf(); \ - __cmd->wreg.regs[__nreg].addr = cpu_to_le32(r); \ - __cmd->wreg.regs[__nreg].val = cpu_to_le32(v); \ - __nreg++; \ - if ((__nreg >= PAYLOAD_MAX / 2)) \ - carl9170_async_regwrite_flush(); \ -} while (0) - -#define carl9170_async_regwrite_finish() do { \ -__async_regwrite_out: \ - if (__cmd != NULL && __err == 0) \ - carl9170_async_regwrite_flush(); \ - kfree(__cmd); \ -} while (0) \ - -#define carl9170_async_regwrite_result() \ - __err; \ -} while (0) - -#endif /* __CMD_H */ diff --git a/drivers/net/wireless/ath/carl9170/debug.c b/drivers/net/wireless/ath/carl9170/debug.c deleted file mode 100644 index 3d70cd277fd7..000000000000 --- a/drivers/net/wireless/ath/carl9170/debug.c +++ /dev/null @@ -1,897 +0,0 @@ -/* - * Atheros CARL9170 driver - * - * debug(fs) probing - * - * Copyright 2008, Johannes Berg - * Copyright 2009, 2010, Christian Lamparter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2008-2009 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include "carl9170.h" -#include "cmd.h" - -#define ADD(buf, off, max, fmt, args...) \ - off += snprintf(&buf[off], max - off, fmt, ##args); - - -struct carl9170_debugfs_fops { - unsigned int read_bufsize; - umode_t attr; - char *(*read)(struct ar9170 *ar, char *buf, size_t bufsize, - ssize_t *len); - ssize_t (*write)(struct ar9170 *aru, const char *buf, size_t size); - const struct file_operations fops; - - enum carl9170_device_state req_dev_state; -}; - -static ssize_t carl9170_debugfs_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct carl9170_debugfs_fops *dfops; - struct ar9170 *ar; - char *buf = NULL, *res_buf = NULL; - ssize_t ret = 0; - int err = 0; - - if (!count) - return 0; - - ar = file->private_data; - - if (!ar) - return -ENODEV; - dfops = container_of(file->f_op, struct carl9170_debugfs_fops, fops); - - if (!dfops->read) - return -ENOSYS; - - if (dfops->read_bufsize) { - buf = vmalloc(dfops->read_bufsize); - if (!buf) - return -ENOMEM; - } - - mutex_lock(&ar->mutex); - if (!CHK_DEV_STATE(ar, dfops->req_dev_state)) { - err = -ENODEV; - res_buf = buf; - goto out_free; - } - - res_buf = dfops->read(ar, buf, dfops->read_bufsize, &ret); - - if (ret > 0) - err = simple_read_from_buffer(userbuf, count, ppos, - res_buf, ret); - else - err = ret; - - WARN_ON_ONCE(dfops->read_bufsize && (res_buf != buf)); - -out_free: - vfree(res_buf); - mutex_unlock(&ar->mutex); - return err; -} - -static ssize_t carl9170_debugfs_write(struct file *file, - const char __user *userbuf, size_t count, loff_t *ppos) -{ - struct carl9170_debugfs_fops *dfops; - struct ar9170 *ar; - char *buf = NULL; - int err = 0; - - if (!count) - return 0; - - if (count > PAGE_SIZE) - return -E2BIG; - - ar = file->private_data; - - if (!ar) - return -ENODEV; - dfops = container_of(file->f_op, struct carl9170_debugfs_fops, fops); - - if (!dfops->write) - return -ENOSYS; - - buf = vmalloc(count); - if (!buf) - return -ENOMEM; - - if (copy_from_user(buf, userbuf, count)) { - err = -EFAULT; - goto out_free; - } - - if (mutex_trylock(&ar->mutex) == 0) { - err = -EAGAIN; - goto out_free; - } - - if (!CHK_DEV_STATE(ar, dfops->req_dev_state)) { - err = -ENODEV; - goto out_unlock; - } - - err = dfops->write(ar, buf, count); - if (err) - goto out_unlock; - -out_unlock: - mutex_unlock(&ar->mutex); - -out_free: - vfree(buf); - return err; -} - -#define __DEBUGFS_DECLARE_FILE(name, _read, _write, _read_bufsize, \ - _attr, _dstate) \ -static const struct carl9170_debugfs_fops carl_debugfs_##name ##_ops = {\ - .read_bufsize = _read_bufsize, \ - .read = _read, \ - .write = _write, \ - .attr = _attr, \ - .req_dev_state = _dstate, \ - .fops = { \ - .open = simple_open, \ - .read = carl9170_debugfs_read, \ - .write = carl9170_debugfs_write, \ - .owner = THIS_MODULE \ - }, \ -} - -#define DEBUGFS_DECLARE_FILE(name, _read, _write, _read_bufsize, _attr) \ - __DEBUGFS_DECLARE_FILE(name, _read, _write, _read_bufsize, \ - _attr, CARL9170_STARTED) \ - -#define DEBUGFS_DECLARE_RO_FILE(name, _read_bufsize) \ - DEBUGFS_DECLARE_FILE(name, carl9170_debugfs_##name ##_read, \ - NULL, _read_bufsize, S_IRUSR) - -#define DEBUGFS_DECLARE_WO_FILE(name) \ - DEBUGFS_DECLARE_FILE(name, NULL, carl9170_debugfs_##name ##_write,\ - 0, S_IWUSR) - -#define DEBUGFS_DECLARE_RW_FILE(name, _read_bufsize) \ - DEBUGFS_DECLARE_FILE(name, carl9170_debugfs_##name ##_read, \ - carl9170_debugfs_##name ##_write, \ - _read_bufsize, S_IRUSR | S_IWUSR) - -#define __DEBUGFS_DECLARE_RW_FILE(name, _read_bufsize, _dstate) \ - __DEBUGFS_DECLARE_FILE(name, carl9170_debugfs_##name ##_read, \ - carl9170_debugfs_##name ##_write, \ - _read_bufsize, S_IRUSR | S_IWUSR, _dstate) - -#define DEBUGFS_READONLY_FILE(name, _read_bufsize, fmt, value...) \ -static char *carl9170_debugfs_ ##name ## _read(struct ar9170 *ar, \ - char *buf, size_t buf_size,\ - ssize_t *len) \ -{ \ - ADD(buf, *len, buf_size, fmt "\n", ##value); \ - return buf; \ -} \ -DEBUGFS_DECLARE_RO_FILE(name, _read_bufsize) - -static char *carl9170_debugfs_mem_usage_read(struct ar9170 *ar, char *buf, - size_t bufsize, ssize_t *len) -{ - ADD(buf, *len, bufsize, "jar: ["); - - spin_lock_bh(&ar->mem_lock); - - *len += bitmap_scnprintf(&buf[*len], bufsize - *len, - ar->mem_bitmap, ar->fw.mem_blocks); - - ADD(buf, *len, bufsize, "]\n"); - - ADD(buf, *len, bufsize, "cookies: used:%3d / total:%3d, allocs:%d\n", - bitmap_weight(ar->mem_bitmap, ar->fw.mem_blocks), - ar->fw.mem_blocks, atomic_read(&ar->mem_allocs)); - - ADD(buf, *len, bufsize, "memory: free:%3d (%3d KiB) / total:%3d KiB)\n", - atomic_read(&ar->mem_free_blocks), - (atomic_read(&ar->mem_free_blocks) * ar->fw.mem_block_size) / 1024, - (ar->fw.mem_blocks * ar->fw.mem_block_size) / 1024); - - spin_unlock_bh(&ar->mem_lock); - - return buf; -} -DEBUGFS_DECLARE_RO_FILE(mem_usage, 512); - -static char *carl9170_debugfs_qos_stat_read(struct ar9170 *ar, char *buf, - size_t bufsize, ssize_t *len) -{ - ADD(buf, *len, bufsize, "%s QoS AC\n", modparam_noht ? "Hardware" : - "Software"); - - ADD(buf, *len, bufsize, "[ VO VI " - " BE BK ]\n"); - - spin_lock_bh(&ar->tx_stats_lock); - ADD(buf, *len, bufsize, "[length/limit length/limit " - "length/limit length/limit ]\n" - "[ %3d/%3d %3d/%3d " - " %3d/%3d %3d/%3d ]\n\n", - ar->tx_stats[0].len, ar->tx_stats[0].limit, - ar->tx_stats[1].len, ar->tx_stats[1].limit, - ar->tx_stats[2].len, ar->tx_stats[2].limit, - ar->tx_stats[3].len, ar->tx_stats[3].limit); - - ADD(buf, *len, bufsize, "[ total total " - " total total ]\n" - "[%10d %10d %10d %10d ]\n\n", - ar->tx_stats[0].count, ar->tx_stats[1].count, - ar->tx_stats[2].count, ar->tx_stats[3].count); - - spin_unlock_bh(&ar->tx_stats_lock); - - ADD(buf, *len, bufsize, "[ pend/waittx pend/waittx " - " pend/waittx pend/waittx]\n" - "[ %3d/%3d %3d/%3d " - " %3d/%3d %3d/%3d ]\n\n", - skb_queue_len(&ar->tx_pending[0]), - skb_queue_len(&ar->tx_status[0]), - skb_queue_len(&ar->tx_pending[1]), - skb_queue_len(&ar->tx_status[1]), - skb_queue_len(&ar->tx_pending[2]), - skb_queue_len(&ar->tx_status[2]), - skb_queue_len(&ar->tx_pending[3]), - skb_queue_len(&ar->tx_status[3])); - - return buf; -} -DEBUGFS_DECLARE_RO_FILE(qos_stat, 512); - -static void carl9170_debugfs_format_frame(struct ar9170 *ar, - struct sk_buff *skb, const char *prefix, char *buf, - ssize_t *off, ssize_t bufsize) -{ - struct _carl9170_tx_superframe *txc = (void *) skb->data; - struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb); - struct carl9170_tx_info *arinfo = (void *) txinfo->rate_driver_data; - struct ieee80211_hdr *hdr = (void *) txc->frame_data; - - ADD(buf, *off, bufsize, "%s %p, c:%2x, DA:%pM, sq:%4d, mc:%.4x, " - "pc:%.8x, to:%d ms\n", prefix, skb, txc->s.cookie, - ieee80211_get_DA(hdr), get_seq_h(hdr), - le16_to_cpu(txc->f.mac_control), le32_to_cpu(txc->f.phy_control), - jiffies_to_msecs(jiffies - arinfo->timeout)); -} - - -static char *carl9170_debugfs_ampdu_state_read(struct ar9170 *ar, char *buf, - size_t bufsize, ssize_t *len) -{ - struct carl9170_sta_tid *iter; - struct sk_buff *skb; - int cnt = 0, fc; - int offset; - - rcu_read_lock(); - list_for_each_entry_rcu(iter, &ar->tx_ampdu_list, list) { - - spin_lock_bh(&iter->lock); - ADD(buf, *len, bufsize, "Entry: #%2d TID:%1d, BSN:%4d, " - "SNX:%4d, HSN:%4d, BAW:%2d, state:%1d, toggles:%d\n", - cnt, iter->tid, iter->bsn, iter->snx, iter->hsn, - iter->max, iter->state, iter->counter); - - ADD(buf, *len, bufsize, "\tWindow: ["); - - *len += bitmap_scnprintf(&buf[*len], bufsize - *len, - iter->bitmap, CARL9170_BAW_BITS); - -#define BM_STR_OFF(offset) \ - ((CARL9170_BAW_BITS - (offset) - 1) / 4 + \ - (CARL9170_BAW_BITS - (offset) - 1) / 32 + 1) - - ADD(buf, *len, bufsize, ",W]\n"); - - offset = BM_STR_OFF(0); - ADD(buf, *len, bufsize, "\tBase Seq: %*s\n", offset, "T"); - - offset = BM_STR_OFF(SEQ_DIFF(iter->snx, iter->bsn)); - ADD(buf, *len, bufsize, "\tNext Seq: %*s\n", offset, "W"); - - offset = BM_STR_OFF(((int)iter->hsn - (int)iter->bsn) % - CARL9170_BAW_BITS); - ADD(buf, *len, bufsize, "\tLast Seq: %*s\n", offset, "N"); - - ADD(buf, *len, bufsize, "\tPre-Aggregation reorder buffer: " - " currently queued:%d\n", skb_queue_len(&iter->queue)); - - fc = 0; - skb_queue_walk(&iter->queue, skb) { - char prefix[32]; - - snprintf(prefix, sizeof(prefix), "\t\t%3d :", fc); - carl9170_debugfs_format_frame(ar, skb, prefix, buf, - len, bufsize); - - fc++; - } - spin_unlock_bh(&iter->lock); - cnt++; - } - rcu_read_unlock(); - - return buf; -} -DEBUGFS_DECLARE_RO_FILE(ampdu_state, 8000); - -static void carl9170_debugfs_queue_dump(struct ar9170 *ar, char *buf, - ssize_t *len, size_t bufsize, struct sk_buff_head *queue) -{ - struct sk_buff *skb; - char prefix[16]; - int fc = 0; - - spin_lock_bh(&queue->lock); - skb_queue_walk(queue, skb) { - snprintf(prefix, sizeof(prefix), "%3d :", fc); - carl9170_debugfs_format_frame(ar, skb, prefix, buf, - len, bufsize); - fc++; - } - spin_unlock_bh(&queue->lock); -} - -#define DEBUGFS_QUEUE_DUMP(q, qi) \ -static char *carl9170_debugfs_##q ##_##qi ##_read(struct ar9170 *ar, \ - char *buf, size_t bufsize, ssize_t *len) \ -{ \ - carl9170_debugfs_queue_dump(ar, buf, len, bufsize, &ar->q[qi]); \ - return buf; \ -} \ -DEBUGFS_DECLARE_RO_FILE(q##_##qi, 8000); - -static char *carl9170_debugfs_sta_psm_read(struct ar9170 *ar, char *buf, - size_t bufsize, ssize_t *len) -{ - ADD(buf, *len, bufsize, "psm state: %s\n", (ar->ps.off_override ? - "FORCE CAM" : (ar->ps.state ? "PSM" : "CAM"))); - - ADD(buf, *len, bufsize, "sleep duration: %d ms.\n", ar->ps.sleep_ms); - ADD(buf, *len, bufsize, "last power-state transition: %d ms ago.\n", - jiffies_to_msecs(jiffies - ar->ps.last_action)); - ADD(buf, *len, bufsize, "last CAM->PSM transition: %d ms ago.\n", - jiffies_to_msecs(jiffies - ar->ps.last_slept)); - - return buf; -} -DEBUGFS_DECLARE_RO_FILE(sta_psm, 160); - -static char *carl9170_debugfs_tx_stuck_read(struct ar9170 *ar, char *buf, - size_t bufsize, ssize_t *len) -{ - int i; - - for (i = 0; i < ar->hw->queues; i++) { - ADD(buf, *len, bufsize, "TX queue [%d]: %10d max:%10d ms.\n", - i, ieee80211_queue_stopped(ar->hw, i) ? - jiffies_to_msecs(jiffies - ar->queue_stop_timeout[i]) : 0, - jiffies_to_msecs(ar->max_queue_stop_timeout[i])); - - ar->max_queue_stop_timeout[i] = 0; - } - - return buf; -} -DEBUGFS_DECLARE_RO_FILE(tx_stuck, 180); - -static char *carl9170_debugfs_phy_noise_read(struct ar9170 *ar, char *buf, - size_t bufsize, ssize_t *len) -{ - int err; - - err = carl9170_get_noisefloor(ar); - if (err) { - *len = err; - return buf; - } - - ADD(buf, *len, bufsize, "Chain 0: %10d dBm, ext. chan.:%10d dBm\n", - ar->noise[0], ar->noise[2]); - ADD(buf, *len, bufsize, "Chain 2: %10d dBm, ext. chan.:%10d dBm\n", - ar->noise[1], ar->noise[3]); - - return buf; -} -DEBUGFS_DECLARE_RO_FILE(phy_noise, 180); - -static char *carl9170_debugfs_vif_dump_read(struct ar9170 *ar, char *buf, - size_t bufsize, ssize_t *len) -{ - struct carl9170_vif_info *iter; - int i = 0; - - ADD(buf, *len, bufsize, "registered VIFs:%d \\ %d\n", - ar->vifs, ar->fw.vif_num); - - ADD(buf, *len, bufsize, "VIF bitmap: ["); - - *len += bitmap_scnprintf(&buf[*len], bufsize - *len, - &ar->vif_bitmap, ar->fw.vif_num); - - ADD(buf, *len, bufsize, "]\n"); - - rcu_read_lock(); - list_for_each_entry_rcu(iter, &ar->vif_list, list) { - struct ieee80211_vif *vif = carl9170_get_vif(iter); - ADD(buf, *len, bufsize, "\t%d = [%s VIF, id:%d, type:%x " - " mac:%pM %s]\n", i, (carl9170_get_main_vif(ar) == vif ? - "Master" : " Slave"), iter->id, vif->type, vif->addr, - iter->enable_beacon ? "beaconing " : ""); - i++; - } - rcu_read_unlock(); - - return buf; -} -DEBUGFS_DECLARE_RO_FILE(vif_dump, 8000); - -#define UPDATE_COUNTER(ar, name) ({ \ - u32 __tmp[ARRAY_SIZE(name##_regs)]; \ - unsigned int __i, __err = -ENODEV; \ - \ - for (__i = 0; __i < ARRAY_SIZE(name##_regs); __i++) { \ - __tmp[__i] = name##_regs[__i].reg; \ - ar->debug.stats.name##_counter[__i] = 0; \ - } \ - \ - if (IS_STARTED(ar)) \ - __err = carl9170_read_mreg(ar, ARRAY_SIZE(name##_regs), \ - __tmp, ar->debug.stats.name##_counter); \ - (__err); }) - -#define TALLY_SUM_UP(ar, name) do { \ - unsigned int __i; \ - \ - for (__i = 0; __i < ARRAY_SIZE(name##_regs); __i++) { \ - ar->debug.stats.name##_sum[__i] += \ - ar->debug.stats.name##_counter[__i]; \ - } \ -} while (0) - -#define DEBUGFS_HW_TALLY_FILE(name, f) \ -static char *carl9170_debugfs_##name ## _read(struct ar9170 *ar, \ - char *dum, size_t bufsize, ssize_t *ret) \ -{ \ - char *buf; \ - int i, max_len, err; \ - \ - max_len = ARRAY_SIZE(name##_regs) * 80; \ - buf = vmalloc(max_len); \ - if (!buf) \ - return NULL; \ - \ - err = UPDATE_COUNTER(ar, name); \ - if (err) { \ - *ret = err; \ - return buf; \ - } \ - \ - TALLY_SUM_UP(ar, name); \ - \ - for (i = 0; i < ARRAY_SIZE(name##_regs); i++) { \ - ADD(buf, *ret, max_len, "%22s = %" f "[+%" f "]\n", \ - name##_regs[i].nreg, ar->debug.stats.name ##_sum[i],\ - ar->debug.stats.name ##_counter[i]); \ - } \ - \ - return buf; \ -} \ -DEBUGFS_DECLARE_RO_FILE(name, 0); - -#define DEBUGFS_HW_REG_FILE(name, f) \ -static char *carl9170_debugfs_##name ## _read(struct ar9170 *ar, \ - char *dum, size_t bufsize, ssize_t *ret) \ -{ \ - char *buf; \ - int i, max_len, err; \ - \ - max_len = ARRAY_SIZE(name##_regs) * 80; \ - buf = vmalloc(max_len); \ - if (!buf) \ - return NULL; \ - \ - err = UPDATE_COUNTER(ar, name); \ - if (err) { \ - *ret = err; \ - return buf; \ - } \ - \ - for (i = 0; i < ARRAY_SIZE(name##_regs); i++) { \ - ADD(buf, *ret, max_len, "%22s = %" f "\n", \ - name##_regs[i].nreg, \ - ar->debug.stats.name##_counter[i]); \ - } \ - \ - return buf; \ -} \ -DEBUGFS_DECLARE_RO_FILE(name, 0); - -static ssize_t carl9170_debugfs_hw_ioread32_write(struct ar9170 *ar, - const char *buf, size_t count) -{ - int err = 0, i, n = 0, max_len = 32, res; - unsigned int reg, tmp; - - if (!count) - return 0; - - if (count > max_len) - return -E2BIG; - - res = sscanf(buf, "0x%X %d", ®, &n); - if (res < 1) { - err = -EINVAL; - goto out; - } - - if (res == 1) - n = 1; - - if (n > 15) { - err = -EMSGSIZE; - goto out; - } - - if ((reg >= 0x280000) || ((reg + (n << 2)) >= 0x280000)) { - err = -EADDRNOTAVAIL; - goto out; - } - - if (reg & 3) { - err = -EINVAL; - goto out; - } - - for (i = 0; i < n; i++) { - err = carl9170_read_reg(ar, reg + (i << 2), &tmp); - if (err) - goto out; - - ar->debug.ring[ar->debug.ring_tail].reg = reg + (i << 2); - ar->debug.ring[ar->debug.ring_tail].value = tmp; - ar->debug.ring_tail++; - ar->debug.ring_tail %= CARL9170_DEBUG_RING_SIZE; - } - -out: - return err ? err : count; -} - -static char *carl9170_debugfs_hw_ioread32_read(struct ar9170 *ar, char *buf, - size_t bufsize, ssize_t *ret) -{ - int i = 0; - - while (ar->debug.ring_head != ar->debug.ring_tail) { - ADD(buf, *ret, bufsize, "%.8x = %.8x\n", - ar->debug.ring[ar->debug.ring_head].reg, - ar->debug.ring[ar->debug.ring_head].value); - - ar->debug.ring_head++; - ar->debug.ring_head %= CARL9170_DEBUG_RING_SIZE; - - if (i++ == 64) - break; - } - ar->debug.ring_head = ar->debug.ring_tail; - return buf; -} -DEBUGFS_DECLARE_RW_FILE(hw_ioread32, CARL9170_DEBUG_RING_SIZE * 40); - -static ssize_t carl9170_debugfs_bug_write(struct ar9170 *ar, const char *buf, - size_t count) -{ - int err; - - if (count < 1) - return -EINVAL; - - switch (buf[0]) { - case 'F': - ar->needs_full_reset = true; - break; - - case 'R': - if (!IS_STARTED(ar)) { - err = -EAGAIN; - goto out; - } - - ar->needs_full_reset = false; - break; - - case 'M': - err = carl9170_mac_reset(ar); - if (err < 0) - count = err; - - goto out; - - case 'P': - err = carl9170_set_channel(ar, ar->hw->conf.chandef.chan, - cfg80211_get_chandef_type(&ar->hw->conf.chandef)); - if (err < 0) - count = err; - - goto out; - - default: - return -EINVAL; - } - - carl9170_restart(ar, CARL9170_RR_USER_REQUEST); - -out: - return count; -} - -static char *carl9170_debugfs_bug_read(struct ar9170 *ar, char *buf, - size_t bufsize, ssize_t *ret) -{ - ADD(buf, *ret, bufsize, "[P]hy reinit, [R]estart, [F]ull usb reset, " - "[M]ac reset\n"); - ADD(buf, *ret, bufsize, "firmware restarts:%d, last reason:%d\n", - ar->restart_counter, ar->last_reason); - ADD(buf, *ret, bufsize, "phy reinit errors:%d (%d)\n", - ar->total_chan_fail, ar->chan_fail); - ADD(buf, *ret, bufsize, "reported firmware errors:%d\n", - ar->fw.err_counter); - ADD(buf, *ret, bufsize, "reported firmware BUGs:%d\n", - ar->fw.bug_counter); - ADD(buf, *ret, bufsize, "pending restart requests:%d\n", - atomic_read(&ar->pending_restarts)); - return buf; -} -__DEBUGFS_DECLARE_RW_FILE(bug, 400, CARL9170_STOPPED); - -static const char *const erp_modes[] = { - [CARL9170_ERP_INVALID] = "INVALID", - [CARL9170_ERP_AUTO] = "Automatic", - [CARL9170_ERP_MAC80211] = "Set by MAC80211", - [CARL9170_ERP_OFF] = "Force Off", - [CARL9170_ERP_RTS] = "Force RTS", - [CARL9170_ERP_CTS] = "Force CTS" -}; - -static char *carl9170_debugfs_erp_read(struct ar9170 *ar, char *buf, - size_t bufsize, ssize_t *ret) -{ - ADD(buf, *ret, bufsize, "ERP Setting: (%d) -> %s\n", ar->erp_mode, - erp_modes[ar->erp_mode]); - return buf; -} - -static ssize_t carl9170_debugfs_erp_write(struct ar9170 *ar, const char *buf, - size_t count) -{ - int res, val; - - if (count < 1) - return -EINVAL; - - res = sscanf(buf, "%d", &val); - if (res != 1) - return -EINVAL; - - if (!((val > CARL9170_ERP_INVALID) && - (val < __CARL9170_ERP_NUM))) - return -EINVAL; - - ar->erp_mode = val; - return count; -} - -DEBUGFS_DECLARE_RW_FILE(erp, 80); - -static ssize_t carl9170_debugfs_hw_iowrite32_write(struct ar9170 *ar, - const char *buf, size_t count) -{ - int err = 0, max_len = 22, res; - u32 reg, val; - - if (!count) - return 0; - - if (count > max_len) - return -E2BIG; - - res = sscanf(buf, "0x%X 0x%X", ®, &val); - if (res != 2) { - err = -EINVAL; - goto out; - } - - if (reg <= 0x100000 || reg >= 0x280000) { - err = -EADDRNOTAVAIL; - goto out; - } - - if (reg & 3) { - err = -EINVAL; - goto out; - } - - err = carl9170_write_reg(ar, reg, val); - if (err) - goto out; - -out: - return err ? err : count; -} -DEBUGFS_DECLARE_WO_FILE(hw_iowrite32); - -DEBUGFS_HW_TALLY_FILE(hw_tx_tally, "u"); -DEBUGFS_HW_TALLY_FILE(hw_rx_tally, "u"); -DEBUGFS_HW_TALLY_FILE(hw_phy_errors, "u"); -DEBUGFS_HW_REG_FILE(hw_wlan_queue, ".8x"); -DEBUGFS_HW_REG_FILE(hw_pta_queue, ".8x"); -DEBUGFS_HW_REG_FILE(hw_ampdu_info, ".8x"); -DEBUGFS_QUEUE_DUMP(tx_status, 0); -DEBUGFS_QUEUE_DUMP(tx_status, 1); -DEBUGFS_QUEUE_DUMP(tx_status, 2); -DEBUGFS_QUEUE_DUMP(tx_status, 3); -DEBUGFS_QUEUE_DUMP(tx_pending, 0); -DEBUGFS_QUEUE_DUMP(tx_pending, 1); -DEBUGFS_QUEUE_DUMP(tx_pending, 2); -DEBUGFS_QUEUE_DUMP(tx_pending, 3); -DEBUGFS_READONLY_FILE(usb_tx_anch_urbs, 20, "%d", - atomic_read(&ar->tx_anch_urbs)); -DEBUGFS_READONLY_FILE(usb_rx_anch_urbs, 20, "%d", - atomic_read(&ar->rx_anch_urbs)); -DEBUGFS_READONLY_FILE(usb_rx_work_urbs, 20, "%d", - atomic_read(&ar->rx_work_urbs)); -DEBUGFS_READONLY_FILE(usb_rx_pool_urbs, 20, "%d", - atomic_read(&ar->rx_pool_urbs)); - -DEBUGFS_READONLY_FILE(tx_total_queued, 20, "%d", - atomic_read(&ar->tx_total_queued)); -DEBUGFS_READONLY_FILE(tx_ampdu_scheduler, 20, "%d", - atomic_read(&ar->tx_ampdu_scheduler)); - -DEBUGFS_READONLY_FILE(tx_total_pending, 20, "%d", - atomic_read(&ar->tx_total_pending)); - -DEBUGFS_READONLY_FILE(tx_ampdu_list_len, 20, "%d", - ar->tx_ampdu_list_len); - -DEBUGFS_READONLY_FILE(tx_ampdu_upload, 20, "%d", - atomic_read(&ar->tx_ampdu_upload)); - -DEBUGFS_READONLY_FILE(tx_janitor_last_run, 64, "last run:%d ms ago", - jiffies_to_msecs(jiffies - ar->tx_janitor_last_run)); - -DEBUGFS_READONLY_FILE(tx_dropped, 20, "%d", ar->tx_dropped); - -DEBUGFS_READONLY_FILE(rx_dropped, 20, "%d", ar->rx_dropped); - -DEBUGFS_READONLY_FILE(sniffer_enabled, 20, "%d", ar->sniffer_enabled); -DEBUGFS_READONLY_FILE(rx_software_decryption, 20, "%d", - ar->rx_software_decryption); -DEBUGFS_READONLY_FILE(ampdu_factor, 20, "%d", - ar->current_factor); -DEBUGFS_READONLY_FILE(ampdu_density, 20, "%d", - ar->current_density); - -DEBUGFS_READONLY_FILE(beacon_int, 20, "%d TU", ar->global_beacon_int); -DEBUGFS_READONLY_FILE(pretbtt, 20, "%d TU", ar->global_pretbtt); - -void carl9170_debugfs_register(struct ar9170 *ar) -{ - ar->debug_dir = debugfs_create_dir(KBUILD_MODNAME, - ar->hw->wiphy->debugfsdir); - -#define DEBUGFS_ADD(name) \ - debugfs_create_file(#name, carl_debugfs_##name ##_ops.attr, \ - ar->debug_dir, ar, \ - &carl_debugfs_##name ## _ops.fops); - - DEBUGFS_ADD(usb_tx_anch_urbs); - DEBUGFS_ADD(usb_rx_pool_urbs); - DEBUGFS_ADD(usb_rx_anch_urbs); - DEBUGFS_ADD(usb_rx_work_urbs); - - DEBUGFS_ADD(tx_total_queued); - DEBUGFS_ADD(tx_total_pending); - DEBUGFS_ADD(tx_dropped); - DEBUGFS_ADD(tx_stuck); - DEBUGFS_ADD(tx_ampdu_upload); - DEBUGFS_ADD(tx_ampdu_scheduler); - DEBUGFS_ADD(tx_ampdu_list_len); - - DEBUGFS_ADD(rx_dropped); - DEBUGFS_ADD(sniffer_enabled); - DEBUGFS_ADD(rx_software_decryption); - - DEBUGFS_ADD(mem_usage); - DEBUGFS_ADD(qos_stat); - DEBUGFS_ADD(sta_psm); - DEBUGFS_ADD(ampdu_state); - - DEBUGFS_ADD(hw_tx_tally); - DEBUGFS_ADD(hw_rx_tally); - DEBUGFS_ADD(hw_phy_errors); - DEBUGFS_ADD(phy_noise); - - DEBUGFS_ADD(hw_wlan_queue); - DEBUGFS_ADD(hw_pta_queue); - DEBUGFS_ADD(hw_ampdu_info); - - DEBUGFS_ADD(ampdu_density); - DEBUGFS_ADD(ampdu_factor); - - DEBUGFS_ADD(tx_janitor_last_run); - - DEBUGFS_ADD(tx_status_0); - DEBUGFS_ADD(tx_status_1); - DEBUGFS_ADD(tx_status_2); - DEBUGFS_ADD(tx_status_3); - - DEBUGFS_ADD(tx_pending_0); - DEBUGFS_ADD(tx_pending_1); - DEBUGFS_ADD(tx_pending_2); - DEBUGFS_ADD(tx_pending_3); - - DEBUGFS_ADD(hw_ioread32); - DEBUGFS_ADD(hw_iowrite32); - DEBUGFS_ADD(bug); - - DEBUGFS_ADD(erp); - - DEBUGFS_ADD(vif_dump); - - DEBUGFS_ADD(beacon_int); - DEBUGFS_ADD(pretbtt); - -#undef DEBUGFS_ADD -} - -void carl9170_debugfs_unregister(struct ar9170 *ar) -{ - debugfs_remove_recursive(ar->debug_dir); -} diff --git a/drivers/net/wireless/ath/carl9170/debug.h b/drivers/net/wireless/ath/carl9170/debug.h deleted file mode 100644 index ea4b97524122..000000000000 --- a/drivers/net/wireless/ath/carl9170/debug.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Atheros CARL9170 driver - * - * debug header - * - * Copyright 2010, Christian Lamparter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef __DEBUG_H -#define __DEBUG_H - -#include "eeprom.h" -#include "wlan.h" -#include "hw.h" -#include "fwdesc.h" -#include "fwcmd.h" -#include "../regd.h" - -struct hw_stat_reg_entry { - u32 reg; - char nreg[32]; -}; - -#define STAT_MAC_REG(reg) \ - { (AR9170_MAC_REG_##reg), #reg } - -#define STAT_PTA_REG(reg) \ - { (AR9170_PTA_REG_##reg), #reg } - -#define STAT_USB_REG(reg) \ - { (AR9170_USB_REG_##reg), #reg } - -static const struct hw_stat_reg_entry hw_rx_tally_regs[] = { - STAT_MAC_REG(RX_CRC32), STAT_MAC_REG(RX_CRC16), - STAT_MAC_REG(RX_TIMEOUT_COUNT), STAT_MAC_REG(RX_ERR_DECRYPTION_UNI), - STAT_MAC_REG(RX_ERR_DECRYPTION_MUL), STAT_MAC_REG(RX_MPDU), - STAT_MAC_REG(RX_DROPPED_MPDU), STAT_MAC_REG(RX_DEL_MPDU), -}; - -static const struct hw_stat_reg_entry hw_phy_errors_regs[] = { - STAT_MAC_REG(RX_PHY_MISC_ERROR), STAT_MAC_REG(RX_PHY_XR_ERROR), - STAT_MAC_REG(RX_PHY_OFDM_ERROR), STAT_MAC_REG(RX_PHY_CCK_ERROR), - STAT_MAC_REG(RX_PHY_HT_ERROR), STAT_MAC_REG(RX_PHY_TOTAL), -}; - -static const struct hw_stat_reg_entry hw_tx_tally_regs[] = { - STAT_MAC_REG(TX_TOTAL), STAT_MAC_REG(TX_UNDERRUN), - STAT_MAC_REG(TX_RETRY), -}; - -static const struct hw_stat_reg_entry hw_wlan_queue_regs[] = { - STAT_MAC_REG(DMA_STATUS), STAT_MAC_REG(DMA_TRIGGER), - STAT_MAC_REG(DMA_TXQ0_ADDR), STAT_MAC_REG(DMA_TXQ0_CURR_ADDR), - STAT_MAC_REG(DMA_TXQ1_ADDR), STAT_MAC_REG(DMA_TXQ1_CURR_ADDR), - STAT_MAC_REG(DMA_TXQ2_ADDR), STAT_MAC_REG(DMA_TXQ2_CURR_ADDR), - STAT_MAC_REG(DMA_TXQ3_ADDR), STAT_MAC_REG(DMA_TXQ3_CURR_ADDR), - STAT_MAC_REG(DMA_RXQ_ADDR), STAT_MAC_REG(DMA_RXQ_CURR_ADDR), -}; - -static const struct hw_stat_reg_entry hw_ampdu_info_regs[] = { - STAT_MAC_REG(AMPDU_DENSITY), STAT_MAC_REG(AMPDU_FACTOR), -}; - -static const struct hw_stat_reg_entry hw_pta_queue_regs[] = { - STAT_PTA_REG(DN_CURR_ADDRH), STAT_PTA_REG(DN_CURR_ADDRL), - STAT_PTA_REG(UP_CURR_ADDRH), STAT_PTA_REG(UP_CURR_ADDRL), - STAT_PTA_REG(DMA_STATUS), STAT_PTA_REG(DMA_MODE_CTRL), -}; - -#define DEFINE_TALLY(name) \ - u32 name##_sum[ARRAY_SIZE(name##_regs)], \ - name##_counter[ARRAY_SIZE(name##_regs)] \ - -#define DEFINE_STAT(name) \ - u32 name##_counter[ARRAY_SIZE(name##_regs)] \ - -struct ath_stats { - DEFINE_TALLY(hw_tx_tally); - DEFINE_TALLY(hw_rx_tally); - DEFINE_TALLY(hw_phy_errors); - DEFINE_STAT(hw_wlan_queue); - DEFINE_STAT(hw_pta_queue); - DEFINE_STAT(hw_ampdu_info); -}; - -struct carl9170_debug_mem_rbe { - u32 reg; - u32 value; -}; - -#define CARL9170_DEBUG_RING_SIZE 64 - -struct carl9170_debug { - struct ath_stats stats; - struct carl9170_debug_mem_rbe ring[CARL9170_DEBUG_RING_SIZE]; - struct mutex ring_lock; - unsigned int ring_head, ring_tail; - struct delayed_work update_tally; -}; - -struct ar9170; - -void carl9170_debugfs_register(struct ar9170 *ar); -void carl9170_debugfs_unregister(struct ar9170 *ar); -#endif /* __DEBUG_H */ diff --git a/drivers/net/wireless/ath/carl9170/eeprom.h b/drivers/net/wireless/ath/carl9170/eeprom.h deleted file mode 100644 index 7cff40ac7759..000000000000 --- a/drivers/net/wireless/ath/carl9170/eeprom.h +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Shared Atheros AR9170 Header - * - * EEPROM layout - * - * Copyright 2008, Johannes Berg - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef __CARL9170_SHARED_EEPROM_H -#define __CARL9170_SHARED_EEPROM_H - -#define AR9170_EEPROM_START 0x1600 - -#define AR5416_MAX_CHAINS 2 -#define AR5416_MODAL_SPURS 5 - -struct ar9170_eeprom_modal { - __le32 antCtrlChain[AR5416_MAX_CHAINS]; - __le32 antCtrlCommon; - s8 antennaGainCh[AR5416_MAX_CHAINS]; - u8 switchSettling; - u8 txRxAttenCh[AR5416_MAX_CHAINS]; - u8 rxTxMarginCh[AR5416_MAX_CHAINS]; - s8 adcDesiredSize; - s8 pgaDesiredSize; - u8 xlnaGainCh[AR5416_MAX_CHAINS]; - u8 txEndToXpaOff; - u8 txEndToRxOn; - u8 txFrameToXpaOn; - u8 thresh62; - s8 noiseFloorThreshCh[AR5416_MAX_CHAINS]; - u8 xpdGain; - u8 xpd; - s8 iqCalICh[AR5416_MAX_CHAINS]; - s8 iqCalQCh[AR5416_MAX_CHAINS]; - u8 pdGainOverlap; - u8 ob; - u8 db; - u8 xpaBiasLvl; - u8 pwrDecreaseFor2Chain; - u8 pwrDecreaseFor3Chain; - u8 txFrameToDataStart; - u8 txFrameToPaOn; - u8 ht40PowerIncForPdadc; - u8 bswAtten[AR5416_MAX_CHAINS]; - u8 bswMargin[AR5416_MAX_CHAINS]; - u8 swSettleHt40; - u8 reserved[22]; - struct spur_channel { - __le16 spurChan; - u8 spurRangeLow; - u8 spurRangeHigh; - } __packed spur_channels[AR5416_MODAL_SPURS]; -} __packed; - -#define AR5416_NUM_PD_GAINS 4 -#define AR5416_PD_GAIN_ICEPTS 5 - -struct ar9170_calibration_data_per_freq { - u8 pwr_pdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; - u8 vpd_pdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; -} __packed; - -#define AR5416_NUM_5G_CAL_PIERS 8 -#define AR5416_NUM_2G_CAL_PIERS 4 - -#define AR5416_NUM_5G_TARGET_PWRS 8 -#define AR5416_NUM_2G_CCK_TARGET_PWRS 3 -#define AR5416_NUM_2G_OFDM_TARGET_PWRS 4 -#define AR5416_MAX_NUM_TGT_PWRS 8 - -struct ar9170_calibration_target_power_legacy { - u8 freq; - u8 power[4]; -} __packed; - -struct ar9170_calibration_target_power_ht { - u8 freq; - u8 power[8]; -} __packed; - -#define AR5416_NUM_CTLS 24 - -struct ar9170_calctl_edges { - u8 channel; -#define AR9170_CALCTL_EDGE_FLAGS 0xC0 - u8 power_flags; -} __packed; - -#define AR5416_NUM_BAND_EDGES 8 - -struct ar9170_calctl_data { - struct ar9170_calctl_edges - control_edges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES]; -} __packed; - -struct ar9170_eeprom { - __le16 length; - __le16 checksum; - __le16 version; - u8 operating_flags; -#define AR9170_OPFLAG_5GHZ 1 -#define AR9170_OPFLAG_2GHZ 2 - u8 misc; - __le16 reg_domain[2]; - u8 mac_address[6]; - u8 rx_mask; - u8 tx_mask; - __le16 rf_silent; - __le16 bluetooth_options; - __le16 device_capabilities; - __le32 build_number; - u8 deviceType; - u8 reserved[33]; - - u8 customer_data[64]; - - struct ar9170_eeprom_modal - modal_header[2]; - - u8 cal_freq_pier_5G[AR5416_NUM_5G_CAL_PIERS]; - u8 cal_freq_pier_2G[AR5416_NUM_2G_CAL_PIERS]; - - struct ar9170_calibration_data_per_freq - cal_pier_data_5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS], - cal_pier_data_2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS]; - - /* power calibration data */ - struct ar9170_calibration_target_power_legacy - cal_tgt_pwr_5G[AR5416_NUM_5G_TARGET_PWRS]; - struct ar9170_calibration_target_power_ht - cal_tgt_pwr_5G_ht20[AR5416_NUM_5G_TARGET_PWRS], - cal_tgt_pwr_5G_ht40[AR5416_NUM_5G_TARGET_PWRS]; - - struct ar9170_calibration_target_power_legacy - cal_tgt_pwr_2G_cck[AR5416_NUM_2G_CCK_TARGET_PWRS], - cal_tgt_pwr_2G_ofdm[AR5416_NUM_2G_OFDM_TARGET_PWRS]; - struct ar9170_calibration_target_power_ht - cal_tgt_pwr_2G_ht20[AR5416_NUM_2G_OFDM_TARGET_PWRS], - cal_tgt_pwr_2G_ht40[AR5416_NUM_2G_OFDM_TARGET_PWRS]; - - /* conformance testing limits */ - u8 ctl_index[AR5416_NUM_CTLS]; - struct ar9170_calctl_data - ctl_data[AR5416_NUM_CTLS]; - - u8 pad; - __le16 subsystem_id; -} __packed; - -#define AR9170_LED_MODE_POWER_ON 0x0001 -#define AR9170_LED_MODE_RESERVED 0x0002 -#define AR9170_LED_MODE_DISABLE_STATE 0x0004 -#define AR9170_LED_MODE_OFF_IN_PSM 0x0008 - -/* AR9170_LED_MODE BIT is set */ -#define AR9170_LED_MODE_FREQUENCY_S 4 -#define AR9170_LED_MODE_FREQUENCY 0x0030 -#define AR9170_LED_MODE_FREQUENCY_1HZ 0x0000 -#define AR9170_LED_MODE_FREQUENCY_0_5HZ 0x0010 -#define AR9170_LED_MODE_FREQUENCY_0_25HZ 0x0020 -#define AR9170_LED_MODE_FREQUENCY_0_125HZ 0x0030 - -/* AR9170_LED_MODE BIT is not set */ -#define AR9170_LED_MODE_CONN_STATE_S 4 -#define AR9170_LED_MODE_CONN_STATE 0x0030 -#define AR9170_LED_MODE_CONN_STATE_FORCE_OFF 0x0000 -#define AR9170_LED_MODE_CONN_STATE_FORCE_ON 0x0010 -/* Idle off / Active on */ -#define AR9170_LED_MODE_CONN_STATE_IOFF_AON 0x0020 -/* Idle on / Active off */ -#define AR9170_LED_MODE_CONN_STATE_ION_AOFF 0x0010 - -#define AR9170_LED_MODE_MODE 0x0040 -#define AR9170_LED_MODE_RESERVED2 0x0080 - -#define AR9170_LED_MODE_TON_SCAN_S 8 -#define AR9170_LED_MODE_TON_SCAN 0x0f00 - -#define AR9170_LED_MODE_TOFF_SCAN_S 12 -#define AR9170_LED_MODE_TOFF_SCAN 0xf000 - -struct ar9170_led_mode { - __le16 led; -}; - -#endif /* __CARL9170_SHARED_EEPROM_H */ diff --git a/drivers/net/wireless/ath/carl9170/fw.c b/drivers/net/wireless/ath/carl9170/fw.c deleted file mode 100644 index 47d5c2e910ad..000000000000 --- a/drivers/net/wireless/ath/carl9170/fw.c +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Atheros CARL9170 driver - * - * firmware parser - * - * Copyright 2009, 2010, Christian Lamparter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - */ - -#include -#include -#include -#include -#include "carl9170.h" -#include "fwcmd.h" -#include "version.h" - -static const u8 otus_magic[4] = { OTUS_MAGIC }; - -static const void *carl9170_fw_find_desc(struct ar9170 *ar, const u8 descid[4], - const unsigned int len, const u8 compatible_revision) -{ - const struct carl9170fw_desc_head *iter; - - carl9170fw_for_each_hdr(iter, ar->fw.desc) { - if (carl9170fw_desc_cmp(iter, descid, len, - compatible_revision)) - return (void *)iter; - } - - /* needed to find the LAST desc */ - if (carl9170fw_desc_cmp(iter, descid, len, - compatible_revision)) - return (void *)iter; - - return NULL; -} - -static int carl9170_fw_verify_descs(struct ar9170 *ar, - const struct carl9170fw_desc_head *head, unsigned int max_len) -{ - const struct carl9170fw_desc_head *pos; - unsigned long pos_addr, end_addr; - unsigned int pos_length; - - if (max_len < sizeof(*pos)) - return -ENODATA; - - max_len = min_t(unsigned int, CARL9170FW_DESC_MAX_LENGTH, max_len); - - pos = head; - pos_addr = (unsigned long) pos; - end_addr = pos_addr + max_len; - - while (pos_addr < end_addr) { - if (pos_addr + sizeof(*head) > end_addr) - return -E2BIG; - - pos_length = le16_to_cpu(pos->length); - - if (pos_length < sizeof(*head)) - return -EBADMSG; - - if (pos_length > max_len) - return -EOVERFLOW; - - if (pos_addr + pos_length > end_addr) - return -EMSGSIZE; - - if (carl9170fw_desc_cmp(pos, LAST_MAGIC, - CARL9170FW_LAST_DESC_SIZE, - CARL9170FW_LAST_DESC_CUR_VER)) - return 0; - - pos_addr += pos_length; - pos = (void *)pos_addr; - max_len -= pos_length; - } - return -EINVAL; -} - -static void carl9170_fw_info(struct ar9170 *ar) -{ - const struct carl9170fw_motd_desc *motd_desc; - unsigned int str_ver_len; - u32 fw_date; - - dev_info(&ar->udev->dev, "driver API: %s 2%03d-%02d-%02d [%d-%d]\n", - CARL9170FW_VERSION_GIT, CARL9170FW_VERSION_YEAR, - CARL9170FW_VERSION_MONTH, CARL9170FW_VERSION_DAY, - CARL9170FW_API_MIN_VER, CARL9170FW_API_MAX_VER); - - motd_desc = carl9170_fw_find_desc(ar, MOTD_MAGIC, - sizeof(*motd_desc), CARL9170FW_MOTD_DESC_CUR_VER); - - if (motd_desc) { - str_ver_len = strnlen(motd_desc->release, - CARL9170FW_MOTD_RELEASE_LEN); - - fw_date = le32_to_cpu(motd_desc->fw_year_month_day); - - dev_info(&ar->udev->dev, "firmware API: %.*s 2%03d-%02d-%02d\n", - str_ver_len, motd_desc->release, - CARL9170FW_GET_YEAR(fw_date), - CARL9170FW_GET_MONTH(fw_date), - CARL9170FW_GET_DAY(fw_date)); - - strlcpy(ar->hw->wiphy->fw_version, motd_desc->release, - sizeof(ar->hw->wiphy->fw_version)); - } -} - -static bool valid_dma_addr(const u32 address) -{ - if (address >= AR9170_SRAM_OFFSET && - address < (AR9170_SRAM_OFFSET + AR9170_SRAM_SIZE)) - return true; - - return false; -} - -static bool valid_cpu_addr(const u32 address) -{ - if (valid_dma_addr(address) || (address >= AR9170_PRAM_OFFSET && - address < (AR9170_PRAM_OFFSET + AR9170_PRAM_SIZE))) - return true; - - return false; -} - -static int carl9170_fw_checksum(struct ar9170 *ar, const __u8 *data, - size_t len) -{ - const struct carl9170fw_otus_desc *otus_desc; - const struct carl9170fw_last_desc *last_desc; - const struct carl9170fw_chk_desc *chk_desc; - unsigned long fin, diff; - unsigned int dsc_len; - u32 crc32; - - last_desc = carl9170_fw_find_desc(ar, LAST_MAGIC, - sizeof(*last_desc), CARL9170FW_LAST_DESC_CUR_VER); - if (!last_desc) - return -EINVAL; - - otus_desc = carl9170_fw_find_desc(ar, OTUS_MAGIC, - sizeof(*otus_desc), CARL9170FW_OTUS_DESC_CUR_VER); - if (!otus_desc) { - dev_err(&ar->udev->dev, "failed to find compatible firmware " - "descriptor.\n"); - return -ENODATA; - } - - chk_desc = carl9170_fw_find_desc(ar, CHK_MAGIC, - sizeof(*chk_desc), CARL9170FW_CHK_DESC_CUR_VER); - - if (!chk_desc) { - dev_warn(&ar->udev->dev, "Unprotected firmware image.\n"); - return 0; - } - - dsc_len = min_t(unsigned int, len, - (unsigned long)chk_desc - (unsigned long)otus_desc); - - fin = (unsigned long) last_desc + sizeof(*last_desc); - diff = fin - (unsigned long) otus_desc; - - if (diff < len) - len -= diff; - - if (len < 256) - return -EIO; - - crc32 = crc32_le(~0, data, len); - if (cpu_to_le32(crc32) != chk_desc->fw_crc32) { - dev_err(&ar->udev->dev, "fw checksum test failed.\n"); - return -ENOEXEC; - } - - crc32 = crc32_le(crc32, (void *)otus_desc, dsc_len); - if (cpu_to_le32(crc32) != chk_desc->hdr_crc32) { - dev_err(&ar->udev->dev, "descriptor check failed.\n"); - return -EINVAL; - } - return 0; -} - -static int carl9170_fw_tx_sequence(struct ar9170 *ar) -{ - const struct carl9170fw_txsq_desc *txsq_desc; - - txsq_desc = carl9170_fw_find_desc(ar, TXSQ_MAGIC, sizeof(*txsq_desc), - CARL9170FW_TXSQ_DESC_CUR_VER); - if (txsq_desc) { - ar->fw.tx_seq_table = le32_to_cpu(txsq_desc->seq_table_addr); - if (!valid_cpu_addr(ar->fw.tx_seq_table)) - return -EINVAL; - } else { - ar->fw.tx_seq_table = 0; - } - - return 0; -} - -static void carl9170_fw_set_if_combinations(struct ar9170 *ar, - u16 if_comb_types) -{ - if (ar->fw.vif_num < 2) - return; - - ar->if_comb_limits[0].max = ar->fw.vif_num; - ar->if_comb_limits[0].types = if_comb_types; - - ar->if_combs[0].num_different_channels = 1; - ar->if_combs[0].max_interfaces = ar->fw.vif_num; - ar->if_combs[0].limits = ar->if_comb_limits; - ar->if_combs[0].n_limits = ARRAY_SIZE(ar->if_comb_limits); - - ar->hw->wiphy->iface_combinations = ar->if_combs; - ar->hw->wiphy->n_iface_combinations = ARRAY_SIZE(ar->if_combs); -} - -static int carl9170_fw(struct ar9170 *ar, const __u8 *data, size_t len) -{ - const struct carl9170fw_otus_desc *otus_desc; - int err; - u16 if_comb_types; - - err = carl9170_fw_checksum(ar, data, len); - if (err) - return err; - - otus_desc = carl9170_fw_find_desc(ar, OTUS_MAGIC, - sizeof(*otus_desc), CARL9170FW_OTUS_DESC_CUR_VER); - if (!otus_desc) { - return -ENODATA; - } - -#define SUPP(feat) \ - (carl9170fw_supports(otus_desc->feature_set, feat)) - - if (!SUPP(CARL9170FW_DUMMY_FEATURE)) { - dev_err(&ar->udev->dev, "invalid firmware descriptor " - "format detected.\n"); - return -EINVAL; - } - - ar->fw.api_version = otus_desc->api_ver; - - if (ar->fw.api_version < CARL9170FW_API_MIN_VER || - ar->fw.api_version > CARL9170FW_API_MAX_VER) { - dev_err(&ar->udev->dev, "unsupported firmware api version.\n"); - return -EINVAL; - } - - if (!SUPP(CARL9170FW_COMMAND_PHY) || SUPP(CARL9170FW_UNUSABLE) || - !SUPP(CARL9170FW_HANDLE_BACK_REQ)) { - dev_err(&ar->udev->dev, "firmware does support " - "mandatory features.\n"); - return -ECANCELED; - } - - if (ilog2(le32_to_cpu(otus_desc->feature_set)) >= - __CARL9170FW_FEATURE_NUM) { - dev_warn(&ar->udev->dev, "driver does not support all " - "firmware features.\n"); - } - - if (!SUPP(CARL9170FW_COMMAND_CAM)) { - dev_info(&ar->udev->dev, "crypto offloading is disabled " - "by firmware.\n"); - ar->fw.disable_offload_fw = true; - } - - if (SUPP(CARL9170FW_PSM) && SUPP(CARL9170FW_FIXED_5GHZ_PSM)) - ar->hw->flags |= IEEE80211_HW_SUPPORTS_PS; - - if (!SUPP(CARL9170FW_USB_INIT_FIRMWARE)) { - dev_err(&ar->udev->dev, "firmware does not provide " - "mandatory interfaces.\n"); - return -EINVAL; - } - - if (SUPP(CARL9170FW_MINIBOOT)) - ar->fw.offset = le16_to_cpu(otus_desc->miniboot_size); - else - ar->fw.offset = 0; - - if (SUPP(CARL9170FW_USB_DOWN_STREAM)) { - ar->hw->extra_tx_headroom += sizeof(struct ar9170_stream); - ar->fw.tx_stream = true; - } - - if (SUPP(CARL9170FW_USB_UP_STREAM)) - ar->fw.rx_stream = true; - - if (SUPP(CARL9170FW_RX_FILTER)) { - ar->fw.rx_filter = true; - ar->rx_filter_caps = FIF_FCSFAIL | FIF_PLCPFAIL | - FIF_CONTROL | FIF_PSPOLL | FIF_OTHER_BSS | - FIF_PROMISC_IN_BSS; - } - - if (SUPP(CARL9170FW_HW_COUNTERS)) - ar->fw.hw_counters = true; - - if (SUPP(CARL9170FW_WOL)) - device_set_wakeup_enable(&ar->udev->dev, true); - - if (SUPP(CARL9170FW_RX_BA_FILTER)) - ar->fw.ba_filter = true; - - if_comb_types = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_P2P_CLIENT); - - ar->fw.vif_num = otus_desc->vif_num; - ar->fw.cmd_bufs = otus_desc->cmd_bufs; - ar->fw.address = le32_to_cpu(otus_desc->fw_address); - ar->fw.rx_size = le16_to_cpu(otus_desc->rx_max_frame_len); - ar->fw.mem_blocks = min_t(unsigned int, otus_desc->tx_descs, 0xfe); - atomic_set(&ar->mem_free_blocks, ar->fw.mem_blocks); - ar->fw.mem_block_size = le16_to_cpu(otus_desc->tx_frag_len); - - if (ar->fw.vif_num >= AR9170_MAX_VIRTUAL_MAC || !ar->fw.vif_num || - ar->fw.mem_blocks < 16 || !ar->fw.cmd_bufs || - ar->fw.mem_block_size < 64 || ar->fw.mem_block_size > 512 || - ar->fw.rx_size > 32768 || ar->fw.rx_size < 4096 || - !valid_cpu_addr(ar->fw.address)) { - dev_err(&ar->udev->dev, "firmware shows obvious signs of " - "malicious tampering.\n"); - return -EINVAL; - } - - ar->fw.beacon_addr = le32_to_cpu(otus_desc->bcn_addr); - ar->fw.beacon_max_len = le16_to_cpu(otus_desc->bcn_len); - - if (valid_dma_addr(ar->fw.beacon_addr) && ar->fw.beacon_max_len >= - AR9170_MAC_BCN_LENGTH_MAX) { - ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); - - if (SUPP(CARL9170FW_WLANTX_CAB)) { - if_comb_types |= - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_P2P_GO); - -#ifdef CONFIG_MAC80211_MESH - if_comb_types |= - BIT(NL80211_IFTYPE_MESH_POINT); -#endif /* CONFIG_MAC80211_MESH */ - } - } - - carl9170_fw_set_if_combinations(ar, if_comb_types); - - ar->hw->wiphy->interface_modes |= if_comb_types; - - ar->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; - - /* As IBSS Encryption is software-based, IBSS RSN is supported. */ - ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL | - WIPHY_FLAG_IBSS_RSN | WIPHY_FLAG_SUPPORTS_TDLS; - -#undef SUPPORTED - return carl9170_fw_tx_sequence(ar); -} - -static struct carl9170fw_desc_head * -carl9170_find_fw_desc(struct ar9170 *ar, const __u8 *fw_data, const size_t len) - -{ - int scan = 0, found = 0; - - if (!carl9170fw_size_check(len)) { - dev_err(&ar->udev->dev, "firmware size is out of bound.\n"); - return NULL; - } - - while (scan < len - sizeof(struct carl9170fw_desc_head)) { - if (fw_data[scan++] == otus_magic[found]) - found++; - else - found = 0; - - if (scan >= len) - break; - - if (found == sizeof(otus_magic)) - break; - } - - if (found != sizeof(otus_magic)) - return NULL; - - return (void *)&fw_data[scan - found]; -} - -int carl9170_parse_firmware(struct ar9170 *ar) -{ - const struct carl9170fw_desc_head *fw_desc = NULL; - const struct firmware *fw = ar->fw.fw; - unsigned long header_offset = 0; - int err; - - if (WARN_ON(!fw)) - return -EINVAL; - - fw_desc = carl9170_find_fw_desc(ar, fw->data, fw->size); - - if (!fw_desc) { - dev_err(&ar->udev->dev, "unsupported firmware.\n"); - return -ENODATA; - } - - header_offset = (unsigned long)fw_desc - (unsigned long)fw->data; - - err = carl9170_fw_verify_descs(ar, fw_desc, fw->size - header_offset); - if (err) { - dev_err(&ar->udev->dev, "damaged firmware (%d).\n", err); - return err; - } - - ar->fw.desc = fw_desc; - - carl9170_fw_info(ar); - - err = carl9170_fw(ar, fw->data, fw->size); - if (err) { - dev_err(&ar->udev->dev, "failed to parse firmware (%d).\n", - err); - return err; - } - - return 0; -} diff --git a/drivers/net/wireless/ath/carl9170/fwcmd.h b/drivers/net/wireless/ath/carl9170/fwcmd.h deleted file mode 100644 index 9111d4ffc1b3..000000000000 --- a/drivers/net/wireless/ath/carl9170/fwcmd.h +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Shared Atheros AR9170 Header - * - * Firmware command interface definitions - * - * Copyright 2008, Johannes Berg - * Copyright 2009-2011 Christian Lamparter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License. - * - * 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; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef __CARL9170_SHARED_FWCMD_H -#define __CARL9170_SHARED_FWCMD_H - -#define CARL9170_MAX_CMD_LEN 64 -#define CARL9170_MAX_CMD_PAYLOAD_LEN 60 - -#define CARL9170FW_API_MIN_VER 1 -#define CARL9170FW_API_MAX_VER 1 - -enum carl9170_cmd_oids { - CARL9170_CMD_RREG = 0x00, - CARL9170_CMD_WREG = 0x01, - CARL9170_CMD_ECHO = 0x02, - CARL9170_CMD_SWRST = 0x03, - CARL9170_CMD_REBOOT = 0x04, - CARL9170_CMD_BCN_CTRL = 0x05, - CARL9170_CMD_READ_TSF = 0x06, - CARL9170_CMD_RX_FILTER = 0x07, - CARL9170_CMD_WOL = 0x08, - CARL9170_CMD_TALLY = 0x09, - - /* CAM */ - CARL9170_CMD_EKEY = 0x10, - CARL9170_CMD_DKEY = 0x11, - - /* RF / PHY */ - CARL9170_CMD_FREQUENCY = 0x20, - CARL9170_CMD_RF_INIT = 0x21, - CARL9170_CMD_SYNTH = 0x22, - CARL9170_CMD_FREQ_START = 0x23, - CARL9170_CMD_PSM = 0x24, - - /* Asychronous command flag */ - CARL9170_CMD_ASYNC_FLAG = 0x40, - CARL9170_CMD_WREG_ASYNC = (CARL9170_CMD_WREG | - CARL9170_CMD_ASYNC_FLAG), - CARL9170_CMD_REBOOT_ASYNC = (CARL9170_CMD_REBOOT | - CARL9170_CMD_ASYNC_FLAG), - CARL9170_CMD_BCN_CTRL_ASYNC = (CARL9170_CMD_BCN_CTRL | - CARL9170_CMD_ASYNC_FLAG), - CARL9170_CMD_PSM_ASYNC = (CARL9170_CMD_PSM | - CARL9170_CMD_ASYNC_FLAG), - - /* responses and traps */ - CARL9170_RSP_FLAG = 0xc0, - CARL9170_RSP_PRETBTT = 0xc0, - CARL9170_RSP_TXCOMP = 0xc1, - CARL9170_RSP_BEACON_CONFIG = 0xc2, - CARL9170_RSP_ATIM = 0xc3, - CARL9170_RSP_WATCHDOG = 0xc6, - CARL9170_RSP_TEXT = 0xca, - CARL9170_RSP_HEXDUMP = 0xcc, - CARL9170_RSP_RADAR = 0xcd, - CARL9170_RSP_GPIO = 0xce, - CARL9170_RSP_BOOT = 0xcf, -}; - -struct carl9170_set_key_cmd { - __le16 user; - __le16 keyId; - __le16 type; - u8 macAddr[6]; - u32 key[4]; -} __packed __aligned(4); -#define CARL9170_SET_KEY_CMD_SIZE 28 - -struct carl9170_disable_key_cmd { - __le16 user; - __le16 padding; -} __packed __aligned(4); -#define CARL9170_DISABLE_KEY_CMD_SIZE 4 - -struct carl9170_u32_list { - u32 vals[0]; -} __packed; - -struct carl9170_reg_list { - __le32 regs[0]; -} __packed; - -struct carl9170_write_reg { - struct { - __le32 addr; - __le32 val; - } regs[0] __packed; -} __packed; - -#define CARL9170FW_PHY_HT_ENABLE 0x4 -#define CARL9170FW_PHY_HT_DYN2040 0x8 -#define CARL9170FW_PHY_HT_EXT_CHAN_OFF 0x3 -#define CARL9170FW_PHY_HT_EXT_CHAN_OFF_S 2 - -struct carl9170_rf_init { - __le32 freq; - u8 ht_settings; - u8 padding2[3]; - __le32 delta_slope_coeff_exp; - __le32 delta_slope_coeff_man; - __le32 delta_slope_coeff_exp_shgi; - __le32 delta_slope_coeff_man_shgi; - __le32 finiteLoopCount; -} __packed; -#define CARL9170_RF_INIT_SIZE 28 - -struct carl9170_rf_init_result { - __le32 ret; /* AR9170_PHY_REG_AGC_CONTROL */ -} __packed; -#define CARL9170_RF_INIT_RESULT_SIZE 4 - -#define CARL9170_PSM_SLEEP 0x1000 -#define CARL9170_PSM_SOFTWARE 0 -#define CARL9170_PSM_WAKE 0 /* internally used. */ -#define CARL9170_PSM_COUNTER 0xfff -#define CARL9170_PSM_COUNTER_S 0 - -struct carl9170_psm { - __le32 state; -} __packed; -#define CARL9170_PSM_SIZE 4 - -/* - * Note: If a bit in rx_filter is set, then it - * means that the particular frames which matches - * the condition are FILTERED/REMOVED/DISCARDED! - * (This is can be a bit confusing, especially - * because someone people think it's the exact - * opposite way, so watch out!) - */ -struct carl9170_rx_filter_cmd { - __le32 rx_filter; -} __packed; -#define CARL9170_RX_FILTER_CMD_SIZE 4 - -#define CARL9170_RX_FILTER_BAD 0x01 -#define CARL9170_RX_FILTER_OTHER_RA 0x02 -#define CARL9170_RX_FILTER_DECRY_FAIL 0x04 -#define CARL9170_RX_FILTER_CTL_OTHER 0x08 -#define CARL9170_RX_FILTER_CTL_PSPOLL 0x10 -#define CARL9170_RX_FILTER_CTL_BACKR 0x20 -#define CARL9170_RX_FILTER_MGMT 0x40 -#define CARL9170_RX_FILTER_DATA 0x80 -#define CARL9170_RX_FILTER_EVERYTHING (~0) - -struct carl9170_bcn_ctrl_cmd { - __le32 vif_id; - __le32 mode; - __le32 bcn_addr; - __le32 bcn_len; -} __packed; -#define CARL9170_BCN_CTRL_CMD_SIZE 16 - -#define CARL9170_BCN_CTRL_DRAIN 0 -#define CARL9170_BCN_CTRL_CAB_TRIGGER 1 - -struct carl9170_wol_cmd { - __le32 flags; - u8 mac[6]; - u8 bssid[6]; - __le32 null_interval; - __le32 free_for_use2; - __le32 mask; - u8 pattern[32]; -} __packed; - -#define CARL9170_WOL_CMD_SIZE 60 - -#define CARL9170_WOL_DISCONNECT 1 -#define CARL9170_WOL_MAGIC_PKT 2 - -struct carl9170_cmd_head { - union { - struct { - u8 len; - u8 cmd; - u8 seq; - u8 ext; - } __packed; - - u32 hdr_data; - } __packed; -} __packed; - -struct carl9170_cmd { - struct carl9170_cmd_head hdr; - union { - struct carl9170_set_key_cmd setkey; - struct carl9170_disable_key_cmd disablekey; - struct carl9170_u32_list echo; - struct carl9170_reg_list rreg; - struct carl9170_write_reg wreg; - struct carl9170_rf_init rf_init; - struct carl9170_psm psm; - struct carl9170_wol_cmd wol; - struct carl9170_bcn_ctrl_cmd bcn_ctrl; - struct carl9170_rx_filter_cmd rx_filter; - u8 data[CARL9170_MAX_CMD_PAYLOAD_LEN]; - } __packed; -} __packed __aligned(4); - -#define CARL9170_TX_STATUS_QUEUE 3 -#define CARL9170_TX_STATUS_QUEUE_S 0 -#define CARL9170_TX_STATUS_RIX_S 2 -#define CARL9170_TX_STATUS_RIX (3 << CARL9170_TX_STATUS_RIX_S) -#define CARL9170_TX_STATUS_TRIES_S 4 -#define CARL9170_TX_STATUS_TRIES (7 << CARL9170_TX_STATUS_TRIES_S) -#define CARL9170_TX_STATUS_SUCCESS 0x80 - -#ifdef __CARL9170FW__ -/* - * NOTE: - * Both structs [carl9170_tx_status and _carl9170_tx_status] - * need to be "bit for bit" in sync. - */ -struct carl9170_tx_status { - /* - * Beware of compiler bugs in all gcc pre 4.4! - */ - - u8 cookie; - u8 queue:2; - u8 rix:2; - u8 tries:3; - u8 success:1; -} __packed; -#endif /* __CARL9170FW__ */ - -struct _carl9170_tx_status { - /* - * This version should be immune to all alignment bugs. - */ - - u8 cookie; - u8 info; -} __packed; -#define CARL9170_TX_STATUS_SIZE 2 - -#define CARL9170_RSP_TX_STATUS_NUM (CARL9170_MAX_CMD_PAYLOAD_LEN / \ - sizeof(struct _carl9170_tx_status)) - -#define CARL9170_TX_MAX_RATE_TRIES 7 - -#define CARL9170_TX_MAX_RATES 4 -#define CARL9170_TX_MAX_RETRY_RATES (CARL9170_TX_MAX_RATES - 1) -#define CARL9170_ERR_MAGIC "ERR:" -#define CARL9170_BUG_MAGIC "BUG:" - -struct carl9170_gpio { - __le32 gpio; -} __packed; -#define CARL9170_GPIO_SIZE 4 - -struct carl9170_tsf_rsp { - union { - __le32 tsf[2]; - __le64 tsf_64; - } __packed; -} __packed; -#define CARL9170_TSF_RSP_SIZE 8 - -struct carl9170_tally_rsp { - __le32 active; - __le32 cca; - __le32 tx_time; - __le32 rx_total; - __le32 rx_overrun; - __le32 tick; -} __packed; - -struct carl9170_rsp { - struct carl9170_cmd_head hdr; - - union { - struct carl9170_rf_init_result rf_init_res; - struct carl9170_u32_list rreg_res; - struct carl9170_u32_list echo; -#ifdef __CARL9170FW__ - struct carl9170_tx_status tx_status[0]; -#endif /* __CARL9170FW__ */ - struct _carl9170_tx_status _tx_status[0]; - struct carl9170_gpio gpio; - struct carl9170_tsf_rsp tsf; - struct carl9170_psm psm; - struct carl9170_tally_rsp tally; - u8 data[CARL9170_MAX_CMD_PAYLOAD_LEN]; - } __packed; -} __packed __aligned(4); - -#endif /* __CARL9170_SHARED_FWCMD_H */ diff --git a/drivers/net/wireless/ath/carl9170/fwdesc.h b/drivers/net/wireless/ath/carl9170/fwdesc.h deleted file mode 100644 index 66848d47c88e..000000000000 --- a/drivers/net/wireless/ath/carl9170/fwdesc.h +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Shared CARL9170 Header - * - * Firmware descriptor format - * - * Copyright 2009-2011 Christian Lamparter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License. - * - * 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; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - */ - -#ifndef __CARL9170_SHARED_FWDESC_H -#define __CARL9170_SHARED_FWDESC_H - -/* NOTE: Don't mess with the order of the flags! */ -enum carl9170fw_feature_list { - /* Always set */ - CARL9170FW_DUMMY_FEATURE, - - /* - * Indicates that this image has special boot block which prevents - * legacy drivers to drive the firmware. - */ - CARL9170FW_MINIBOOT, - - /* usb registers are initialized by the firmware */ - CARL9170FW_USB_INIT_FIRMWARE, - - /* command traps & notifications are send through EP2 */ - CARL9170FW_USB_RESP_EP2, - - /* usb download (app -> fw) stream */ - CARL9170FW_USB_DOWN_STREAM, - - /* usb upload (fw -> app) stream */ - CARL9170FW_USB_UP_STREAM, - - /* unusable - reserved to flag non-functional debug firmwares */ - CARL9170FW_UNUSABLE, - - /* AR9170_CMD_RF_INIT, AR9170_CMD_FREQ_START, AR9170_CMD_FREQUENCY */ - CARL9170FW_COMMAND_PHY, - - /* AR9170_CMD_EKEY, AR9170_CMD_DKEY */ - CARL9170FW_COMMAND_CAM, - - /* Firmware has a software Content After Beacon Queueing mechanism */ - CARL9170FW_WLANTX_CAB, - - /* The firmware is capable of responding to incoming BAR frames */ - CARL9170FW_HANDLE_BACK_REQ, - - /* GPIO Interrupt | CARL9170_RSP_GPIO */ - CARL9170FW_GPIO_INTERRUPT, - - /* Firmware PSM support | CARL9170_CMD_PSM */ - CARL9170FW_PSM, - - /* Firmware RX filter | CARL9170_CMD_RX_FILTER */ - CARL9170FW_RX_FILTER, - - /* Wake up on WLAN */ - CARL9170FW_WOL, - - /* Firmware supports PSM in the 5GHZ Band */ - CARL9170FW_FIXED_5GHZ_PSM, - - /* HW (ANI, CCA, MIB) tally counters */ - CARL9170FW_HW_COUNTERS, - - /* Firmware will pass BA when BARs are queued */ - CARL9170FW_RX_BA_FILTER, - - /* KEEP LAST */ - __CARL9170FW_FEATURE_NUM -}; - -#define OTUS_MAGIC "OTAR" -#define MOTD_MAGIC "MOTD" -#define FIX_MAGIC "FIX\0" -#define DBG_MAGIC "DBG\0" -#define CHK_MAGIC "CHK\0" -#define TXSQ_MAGIC "TXSQ" -#define WOL_MAGIC "WOL\0" -#define LAST_MAGIC "LAST" - -#define CARL9170FW_SET_DAY(d) (((d) - 1) % 31) -#define CARL9170FW_SET_MONTH(m) ((((m) - 1) % 12) * 31) -#define CARL9170FW_SET_YEAR(y) (((y) - 10) * 372) - -#define CARL9170FW_GET_DAY(d) (((d) % 31) + 1) -#define CARL9170FW_GET_MONTH(m) ((((m) / 31) % 12) + 1) -#define CARL9170FW_GET_YEAR(y) ((y) / 372 + 10) - -#define CARL9170FW_MAGIC_SIZE 4 - -struct carl9170fw_desc_head { - u8 magic[CARL9170FW_MAGIC_SIZE]; - __le16 length; - u8 min_ver; - u8 cur_ver; -} __packed; -#define CARL9170FW_DESC_HEAD_SIZE \ - (sizeof(struct carl9170fw_desc_head)) - -#define CARL9170FW_OTUS_DESC_MIN_VER 6 -#define CARL9170FW_OTUS_DESC_CUR_VER 7 -struct carl9170fw_otus_desc { - struct carl9170fw_desc_head head; - __le32 feature_set; - __le32 fw_address; - __le32 bcn_addr; - __le16 bcn_len; - __le16 miniboot_size; - __le16 tx_frag_len; - __le16 rx_max_frame_len; - u8 tx_descs; - u8 cmd_bufs; - u8 api_ver; - u8 vif_num; -} __packed; -#define CARL9170FW_OTUS_DESC_SIZE \ - (sizeof(struct carl9170fw_otus_desc)) - -#define CARL9170FW_MOTD_STRING_LEN 24 -#define CARL9170FW_MOTD_RELEASE_LEN 20 -#define CARL9170FW_MOTD_DESC_MIN_VER 1 -#define CARL9170FW_MOTD_DESC_CUR_VER 2 -struct carl9170fw_motd_desc { - struct carl9170fw_desc_head head; - __le32 fw_year_month_day; - char desc[CARL9170FW_MOTD_STRING_LEN]; - char release[CARL9170FW_MOTD_RELEASE_LEN]; -} __packed; -#define CARL9170FW_MOTD_DESC_SIZE \ - (sizeof(struct carl9170fw_motd_desc)) - -#define CARL9170FW_FIX_DESC_MIN_VER 1 -#define CARL9170FW_FIX_DESC_CUR_VER 2 -struct carl9170fw_fix_entry { - __le32 address; - __le32 mask; - __le32 value; -} __packed; - -struct carl9170fw_fix_desc { - struct carl9170fw_desc_head head; - struct carl9170fw_fix_entry data[0]; -} __packed; -#define CARL9170FW_FIX_DESC_SIZE \ - (sizeof(struct carl9170fw_fix_desc)) - -#define CARL9170FW_DBG_DESC_MIN_VER 1 -#define CARL9170FW_DBG_DESC_CUR_VER 3 -struct carl9170fw_dbg_desc { - struct carl9170fw_desc_head head; - - __le32 bogoclock_addr; - __le32 counter_addr; - __le32 rx_total_addr; - __le32 rx_overrun_addr; - __le32 rx_filter; - - /* Put your debugging definitions here */ -} __packed; -#define CARL9170FW_DBG_DESC_SIZE \ - (sizeof(struct carl9170fw_dbg_desc)) - -#define CARL9170FW_CHK_DESC_MIN_VER 1 -#define CARL9170FW_CHK_DESC_CUR_VER 2 -struct carl9170fw_chk_desc { - struct carl9170fw_desc_head head; - __le32 fw_crc32; - __le32 hdr_crc32; -} __packed; -#define CARL9170FW_CHK_DESC_SIZE \ - (sizeof(struct carl9170fw_chk_desc)) - -#define CARL9170FW_TXSQ_DESC_MIN_VER 1 -#define CARL9170FW_TXSQ_DESC_CUR_VER 1 -struct carl9170fw_txsq_desc { - struct carl9170fw_desc_head head; - - __le32 seq_table_addr; -} __packed; -#define CARL9170FW_TXSQ_DESC_SIZE \ - (sizeof(struct carl9170fw_txsq_desc)) - -#define CARL9170FW_WOL_DESC_MIN_VER 1 -#define CARL9170FW_WOL_DESC_CUR_VER 1 -struct carl9170fw_wol_desc { - struct carl9170fw_desc_head head; - - __le32 supported_triggers; /* CARL9170_WOL_ */ -} __packed; -#define CARL9170FW_WOL_DESC_SIZE \ - (sizeof(struct carl9170fw_wol_desc)) - -#define CARL9170FW_LAST_DESC_MIN_VER 1 -#define CARL9170FW_LAST_DESC_CUR_VER 2 -struct carl9170fw_last_desc { - struct carl9170fw_desc_head head; -} __packed; -#define CARL9170FW_LAST_DESC_SIZE \ - (sizeof(struct carl9170fw_fix_desc)) - -#define CARL9170FW_DESC_MAX_LENGTH 8192 - -#define CARL9170FW_FILL_DESC(_magic, _length, _min_ver, _cur_ver) \ - .head = { \ - .magic = _magic, \ - .length = cpu_to_le16(_length), \ - .min_ver = _min_ver, \ - .cur_ver = _cur_ver, \ - } - -static inline void carl9170fw_fill_desc(struct carl9170fw_desc_head *head, - u8 magic[CARL9170FW_MAGIC_SIZE], - __le16 length, u8 min_ver, u8 cur_ver) -{ - head->magic[0] = magic[0]; - head->magic[1] = magic[1]; - head->magic[2] = magic[2]; - head->magic[3] = magic[3]; - - head->length = length; - head->min_ver = min_ver; - head->cur_ver = cur_ver; -} - -#define carl9170fw_for_each_hdr(desc, fw_desc) \ - for (desc = fw_desc; \ - memcmp(desc->magic, LAST_MAGIC, CARL9170FW_MAGIC_SIZE) && \ - le16_to_cpu(desc->length) >= CARL9170FW_DESC_HEAD_SIZE && \ - le16_to_cpu(desc->length) < CARL9170FW_DESC_MAX_LENGTH; \ - desc = (void *)((unsigned long)desc + le16_to_cpu(desc->length))) - -#define CHECK_HDR_VERSION(head, _min_ver) \ - (((head)->cur_ver < _min_ver) || ((head)->min_ver > _min_ver)) \ - -static inline bool carl9170fw_supports(__le32 list, u8 feature) -{ - return le32_to_cpu(list) & BIT(feature); -} - -static inline bool carl9170fw_desc_cmp(const struct carl9170fw_desc_head *head, - const u8 descid[CARL9170FW_MAGIC_SIZE], - u16 min_len, u8 compatible_revision) -{ - if (descid[0] == head->magic[0] && descid[1] == head->magic[1] && - descid[2] == head->magic[2] && descid[3] == head->magic[3] && - !CHECK_HDR_VERSION(head, compatible_revision) && - (le16_to_cpu(head->length) >= min_len)) - return true; - - return false; -} - -#define CARL9170FW_MIN_SIZE 32 -#define CARL9170FW_MAX_SIZE 16384 - -static inline bool carl9170fw_size_check(unsigned int len) -{ - return (len <= CARL9170FW_MAX_SIZE && len >= CARL9170FW_MIN_SIZE); -} - -#endif /* __CARL9170_SHARED_FWDESC_H */ diff --git a/drivers/net/wireless/ath/carl9170/hw.h b/drivers/net/wireless/ath/carl9170/hw.h deleted file mode 100644 index 0db874abde50..000000000000 --- a/drivers/net/wireless/ath/carl9170/hw.h +++ /dev/null @@ -1,817 +0,0 @@ -/* - * Shared Atheros AR9170 Header - * - * Register map, hardware-specific definitions - * - * Copyright 2008, Johannes Berg - * Copyright 2009-2011 Christian Lamparter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License. - * - * 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; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef __CARL9170_SHARED_HW_H -#define __CARL9170_SHARED_HW_H - -/* High Speed UART */ -#define AR9170_UART_REG_BASE 0x1c0000 - -/* Definitions of interrupt registers */ -#define AR9170_UART_REG_RX_BUFFER (AR9170_UART_REG_BASE + 0x000) -#define AR9170_UART_REG_TX_HOLDING (AR9170_UART_REG_BASE + 0x004) -#define AR9170_UART_REG_FIFO_CONTROL (AR9170_UART_REG_BASE + 0x010) -#define AR9170_UART_FIFO_CTRL_RESET_RX_FIFO 0x02 -#define AR9170_UART_FIFO_CTRL_RESET_TX_FIFO 0x04 - -#define AR9170_UART_REG_LINE_CONTROL (AR9170_UART_REG_BASE + 0x014) -#define AR9170_UART_REG_MODEM_CONTROL (AR9170_UART_REG_BASE + 0x018) -#define AR9170_UART_MODEM_CTRL_DTR_BIT 0x01 -#define AR9170_UART_MODEM_CTRL_RTS_BIT 0x02 -#define AR9170_UART_MODEM_CTRL_INTERNAL_LOOP_BACK 0x10 -#define AR9170_UART_MODEM_CTRL_AUTO_RTS 0x20 -#define AR9170_UART_MODEM_CTRL_AUTO_CTR 0x40 - -#define AR9170_UART_REG_LINE_STATUS (AR9170_UART_REG_BASE + 0x01c) -#define AR9170_UART_LINE_STS_RX_DATA_READY 0x01 -#define AR9170_UART_LINE_STS_RX_BUFFER_OVERRUN 0x02 -#define AR9170_UART_LINE_STS_RX_BREAK_IND 0x10 -#define AR9170_UART_LINE_STS_TX_FIFO_NEAR_EMPTY 0x20 -#define AR9170_UART_LINE_STS_TRANSMITTER_EMPTY 0x40 - -#define AR9170_UART_REG_MODEM_STATUS (AR9170_UART_REG_BASE + 0x020) -#define AR9170_UART_MODEM_STS_CTS_CHANGE 0x01 -#define AR9170_UART_MODEM_STS_DSR_CHANGE 0x02 -#define AR9170_UART_MODEM_STS_DCD_CHANGE 0x08 -#define AR9170_UART_MODEM_STS_CTS_COMPL 0x10 -#define AR9170_UART_MODEM_STS_DSR_COMPL 0x20 -#define AR9170_UART_MODEM_STS_DCD_COMPL 0x80 - -#define AR9170_UART_REG_SCRATCH (AR9170_UART_REG_BASE + 0x024) -#define AR9170_UART_REG_DIVISOR_LSB (AR9170_UART_REG_BASE + 0x028) -#define AR9170_UART_REG_DIVISOR_MSB (AR9170_UART_REG_BASE + 0x02c) -#define AR9170_UART_REG_WORD_RX_BUFFER (AR9170_UART_REG_BASE + 0x034) -#define AR9170_UART_REG_WORD_TX_HOLDING (AR9170_UART_REG_BASE + 0x038) -#define AR9170_UART_REG_FIFO_COUNT (AR9170_UART_REG_BASE + 0x03c) -#define AR9170_UART_REG_REMAINDER (AR9170_UART_REG_BASE + 0x04c) - -/* Timer */ -#define AR9170_TIMER_REG_BASE 0x1c1000 - -#define AR9170_TIMER_REG_WATCH_DOG (AR9170_TIMER_REG_BASE + 0x000) -#define AR9170_TIMER_REG_TIMER0 (AR9170_TIMER_REG_BASE + 0x010) -#define AR9170_TIMER_REG_TIMER1 (AR9170_TIMER_REG_BASE + 0x014) -#define AR9170_TIMER_REG_TIMER2 (AR9170_TIMER_REG_BASE + 0x018) -#define AR9170_TIMER_REG_TIMER3 (AR9170_TIMER_REG_BASE + 0x01c) -#define AR9170_TIMER_REG_TIMER4 (AR9170_TIMER_REG_BASE + 0x020) -#define AR9170_TIMER_REG_CONTROL (AR9170_TIMER_REG_BASE + 0x024) -#define AR9170_TIMER_CTRL_DISABLE_CLOCK 0x100 - -#define AR9170_TIMER_REG_INTERRUPT (AR9170_TIMER_REG_BASE + 0x028) -#define AR9170_TIMER_INT_TIMER0 0x001 -#define AR9170_TIMER_INT_TIMER1 0x002 -#define AR9170_TIMER_INT_TIMER2 0x004 -#define AR9170_TIMER_INT_TIMER3 0x008 -#define AR9170_TIMER_INT_TIMER4 0x010 -#define AR9170_TIMER_INT_TICK_TIMER 0x100 - -#define AR9170_TIMER_REG_TICK_TIMER (AR9170_TIMER_REG_BASE + 0x030) -#define AR9170_TIMER_REG_CLOCK_LOW (AR9170_TIMER_REG_BASE + 0x040) -#define AR9170_TIMER_REG_CLOCK_HIGH (AR9170_TIMER_REG_BASE + 0x044) - -#define AR9170_MAC_REG_BASE 0x1c3000 - -#define AR9170_MAC_REG_POWER_STATE_CTRL (AR9170_MAC_REG_BASE + 0x500) -#define AR9170_MAC_POWER_STATE_CTRL_RESET 0x20 - -#define AR9170_MAC_REG_MAC_POWER_STATE_CTRL (AR9170_MAC_REG_BASE + 0x50c) - -#define AR9170_MAC_REG_INT_CTRL (AR9170_MAC_REG_BASE + 0x510) -#define AR9170_MAC_INT_TXC BIT(0) -#define AR9170_MAC_INT_RXC BIT(1) -#define AR9170_MAC_INT_RETRY_FAIL BIT(2) -#define AR9170_MAC_INT_WAKEUP BIT(3) -#define AR9170_MAC_INT_ATIM BIT(4) -#define AR9170_MAC_INT_DTIM BIT(5) -#define AR9170_MAC_INT_CFG_BCN BIT(6) -#define AR9170_MAC_INT_ABORT BIT(7) -#define AR9170_MAC_INT_QOS BIT(8) -#define AR9170_MAC_INT_MIMO_PS BIT(9) -#define AR9170_MAC_INT_KEY_GEN BIT(10) -#define AR9170_MAC_INT_DECRY_NOUSER BIT(11) -#define AR9170_MAC_INT_RADAR BIT(12) -#define AR9170_MAC_INT_QUIET_FRAME BIT(13) -#define AR9170_MAC_INT_PRETBTT BIT(14) - -#define AR9170_MAC_REG_TSF_L (AR9170_MAC_REG_BASE + 0x514) -#define AR9170_MAC_REG_TSF_H (AR9170_MAC_REG_BASE + 0x518) - -#define AR9170_MAC_REG_ATIM_WINDOW (AR9170_MAC_REG_BASE + 0x51c) -#define AR9170_MAC_ATIM_PERIOD_S 0 -#define AR9170_MAC_ATIM_PERIOD 0x0000ffff - -#define AR9170_MAC_REG_BCN_PERIOD (AR9170_MAC_REG_BASE + 0x520) -#define AR9170_MAC_BCN_PERIOD_S 0 -#define AR9170_MAC_BCN_PERIOD 0x0000ffff -#define AR9170_MAC_BCN_DTIM_S 16 -#define AR9170_MAC_BCN_DTIM 0x00ff0000 -#define AR9170_MAC_BCN_AP_MODE BIT(24) -#define AR9170_MAC_BCN_IBSS_MODE BIT(25) -#define AR9170_MAC_BCN_PWR_MGT BIT(26) -#define AR9170_MAC_BCN_STA_PS BIT(27) - -#define AR9170_MAC_REG_PRETBTT (AR9170_MAC_REG_BASE + 0x524) -#define AR9170_MAC_PRETBTT_S 0 -#define AR9170_MAC_PRETBTT 0x0000ffff -#define AR9170_MAC_PRETBTT2_S 16 -#define AR9170_MAC_PRETBTT2 0xffff0000 - -#define AR9170_MAC_REG_MAC_ADDR_L (AR9170_MAC_REG_BASE + 0x610) -#define AR9170_MAC_REG_MAC_ADDR_H (AR9170_MAC_REG_BASE + 0x614) -#define AR9170_MAC_REG_BSSID_L (AR9170_MAC_REG_BASE + 0x618) -#define AR9170_MAC_REG_BSSID_H (AR9170_MAC_REG_BASE + 0x61c) - -#define AR9170_MAC_REG_GROUP_HASH_TBL_L (AR9170_MAC_REG_BASE + 0x624) -#define AR9170_MAC_REG_GROUP_HASH_TBL_H (AR9170_MAC_REG_BASE + 0x628) - -#define AR9170_MAC_REG_RX_TIMEOUT (AR9170_MAC_REG_BASE + 0x62c) - -#define AR9170_MAC_REG_BASIC_RATE (AR9170_MAC_REG_BASE + 0x630) -#define AR9170_MAC_REG_MANDATORY_RATE (AR9170_MAC_REG_BASE + 0x634) -#define AR9170_MAC_REG_RTS_CTS_RATE (AR9170_MAC_REG_BASE + 0x638) -#define AR9170_MAC_REG_BACKOFF_PROTECT (AR9170_MAC_REG_BASE + 0x63c) -#define AR9170_MAC_REG_RX_THRESHOLD (AR9170_MAC_REG_BASE + 0x640) -#define AR9170_MAC_REG_AFTER_PNP (AR9170_MAC_REG_BASE + 0x648) -#define AR9170_MAC_REG_RX_PE_DELAY (AR9170_MAC_REG_BASE + 0x64c) - -#define AR9170_MAC_REG_DYNAMIC_SIFS_ACK (AR9170_MAC_REG_BASE + 0x658) -#define AR9170_MAC_REG_SNIFFER (AR9170_MAC_REG_BASE + 0x674) -#define AR9170_MAC_SNIFFER_ENABLE_PROMISC BIT(0) -#define AR9170_MAC_SNIFFER_DEFAULTS 0x02000000 -#define AR9170_MAC_REG_ENCRYPTION (AR9170_MAC_REG_BASE + 0x678) -#define AR9170_MAC_ENCRYPTION_MGMT_RX_SOFTWARE BIT(2) -#define AR9170_MAC_ENCRYPTION_RX_SOFTWARE BIT(3) -#define AR9170_MAC_ENCRYPTION_DEFAULTS 0x70 - -#define AR9170_MAC_REG_MISC_680 (AR9170_MAC_REG_BASE + 0x680) -#define AR9170_MAC_REG_MISC_684 (AR9170_MAC_REG_BASE + 0x684) -#define AR9170_MAC_REG_TX_UNDERRUN (AR9170_MAC_REG_BASE + 0x688) - -#define AR9170_MAC_REG_FRAMETYPE_FILTER (AR9170_MAC_REG_BASE + 0x68c) -#define AR9170_MAC_FTF_ASSOC_REQ BIT(0) -#define AR9170_MAC_FTF_ASSOC_RESP BIT(1) -#define AR9170_MAC_FTF_REASSOC_REQ BIT(2) -#define AR9170_MAC_FTF_REASSOC_RESP BIT(3) -#define AR9170_MAC_FTF_PRB_REQ BIT(4) -#define AR9170_MAC_FTF_PRB_RESP BIT(5) -#define AR9170_MAC_FTF_BIT6 BIT(6) -#define AR9170_MAC_FTF_BIT7 BIT(7) -#define AR9170_MAC_FTF_BEACON BIT(8) -#define AR9170_MAC_FTF_ATIM BIT(9) -#define AR9170_MAC_FTF_DEASSOC BIT(10) -#define AR9170_MAC_FTF_AUTH BIT(11) -#define AR9170_MAC_FTF_DEAUTH BIT(12) -#define AR9170_MAC_FTF_BIT13 BIT(13) -#define AR9170_MAC_FTF_BIT14 BIT(14) -#define AR9170_MAC_FTF_BIT15 BIT(15) -#define AR9170_MAC_FTF_BAR BIT(24) -#define AR9170_MAC_FTF_BA BIT(25) -#define AR9170_MAC_FTF_PSPOLL BIT(26) -#define AR9170_MAC_FTF_RTS BIT(27) -#define AR9170_MAC_FTF_CTS BIT(28) -#define AR9170_MAC_FTF_ACK BIT(29) -#define AR9170_MAC_FTF_CFE BIT(30) -#define AR9170_MAC_FTF_CFE_ACK BIT(31) -#define AR9170_MAC_FTF_DEFAULTS 0x0500ffff -#define AR9170_MAC_FTF_MONITOR 0xff00ffff - -#define AR9170_MAC_REG_ACK_EXTENSION (AR9170_MAC_REG_BASE + 0x690) -#define AR9170_MAC_REG_ACK_TPC (AR9170_MAC_REG_BASE + 0x694) -#define AR9170_MAC_REG_EIFS_AND_SIFS (AR9170_MAC_REG_BASE + 0x698) -#define AR9170_MAC_REG_RX_TIMEOUT_COUNT (AR9170_MAC_REG_BASE + 0x69c) -#define AR9170_MAC_REG_RX_TOTAL (AR9170_MAC_REG_BASE + 0x6a0) -#define AR9170_MAC_REG_RX_CRC32 (AR9170_MAC_REG_BASE + 0x6a4) -#define AR9170_MAC_REG_RX_CRC16 (AR9170_MAC_REG_BASE + 0x6a8) -#define AR9170_MAC_REG_RX_ERR_DECRYPTION_UNI (AR9170_MAC_REG_BASE + 0x6ac) -#define AR9170_MAC_REG_RX_OVERRUN (AR9170_MAC_REG_BASE + 0x6b0) -#define AR9170_MAC_REG_RX_ERR_DECRYPTION_MUL (AR9170_MAC_REG_BASE + 0x6bc) -#define AR9170_MAC_REG_TX_BLOCKACKS (AR9170_MAC_REG_BASE + 0x6c0) -#define AR9170_MAC_REG_NAV_COUNT (AR9170_MAC_REG_BASE + 0x6c4) -#define AR9170_MAC_REG_BACKOFF_STATUS (AR9170_MAC_REG_BASE + 0x6c8) -#define AR9170_MAC_BACKOFF_CCA BIT(24) -#define AR9170_MAC_BACKOFF_TX_PEX BIT(25) -#define AR9170_MAC_BACKOFF_RX_PE BIT(26) -#define AR9170_MAC_BACKOFF_MD_READY BIT(27) -#define AR9170_MAC_BACKOFF_TX_PE BIT(28) - -#define AR9170_MAC_REG_TX_RETRY (AR9170_MAC_REG_BASE + 0x6cc) - -#define AR9170_MAC_REG_TX_COMPLETE (AR9170_MAC_REG_BASE + 0x6d4) - -#define AR9170_MAC_REG_CHANNEL_BUSY (AR9170_MAC_REG_BASE + 0x6e8) -#define AR9170_MAC_REG_EXT_BUSY (AR9170_MAC_REG_BASE + 0x6ec) - -#define AR9170_MAC_REG_SLOT_TIME (AR9170_MAC_REG_BASE + 0x6f0) -#define AR9170_MAC_REG_TX_TOTAL (AR9170_MAC_REG_BASE + 0x6f4) -#define AR9170_MAC_REG_ACK_FC (AR9170_MAC_REG_BASE + 0x6f8) - -#define AR9170_MAC_REG_CAM_MODE (AR9170_MAC_REG_BASE + 0x700) -#define AR9170_MAC_CAM_IBSS 0xe0 -#define AR9170_MAC_CAM_AP 0xa1 -#define AR9170_MAC_CAM_STA 0x2 -#define AR9170_MAC_CAM_AP_WDS 0x3 -#define AR9170_MAC_CAM_DEFAULTS (0xf << 24) -#define AR9170_MAC_CAM_HOST_PENDING 0x80000000 - -#define AR9170_MAC_REG_CAM_ROLL_CALL_TBL_L (AR9170_MAC_REG_BASE + 0x704) -#define AR9170_MAC_REG_CAM_ROLL_CALL_TBL_H (AR9170_MAC_REG_BASE + 0x708) - -#define AR9170_MAC_REG_CAM_ADDR (AR9170_MAC_REG_BASE + 0x70c) -#define AR9170_MAC_CAM_ADDR_WRITE 0x80000000 -#define AR9170_MAC_REG_CAM_DATA0 (AR9170_MAC_REG_BASE + 0x720) -#define AR9170_MAC_REG_CAM_DATA1 (AR9170_MAC_REG_BASE + 0x724) -#define AR9170_MAC_REG_CAM_DATA2 (AR9170_MAC_REG_BASE + 0x728) -#define AR9170_MAC_REG_CAM_DATA3 (AR9170_MAC_REG_BASE + 0x72c) - -#define AR9170_MAC_REG_CAM_DBG0 (AR9170_MAC_REG_BASE + 0x730) -#define AR9170_MAC_REG_CAM_DBG1 (AR9170_MAC_REG_BASE + 0x734) -#define AR9170_MAC_REG_CAM_DBG2 (AR9170_MAC_REG_BASE + 0x738) -#define AR9170_MAC_REG_CAM_STATE (AR9170_MAC_REG_BASE + 0x73c) -#define AR9170_MAC_CAM_STATE_READ_PENDING 0x40000000 -#define AR9170_MAC_CAM_STATE_WRITE_PENDING 0x80000000 - -#define AR9170_MAC_REG_CAM_TXKEY (AR9170_MAC_REG_BASE + 0x740) -#define AR9170_MAC_REG_CAM_RXKEY (AR9170_MAC_REG_BASE + 0x750) - -#define AR9170_MAC_REG_CAM_TX_ENC_TYPE (AR9170_MAC_REG_BASE + 0x760) -#define AR9170_MAC_REG_CAM_RX_ENC_TYPE (AR9170_MAC_REG_BASE + 0x770) -#define AR9170_MAC_REG_CAM_TX_SERACH_HIT (AR9170_MAC_REG_BASE + 0x780) -#define AR9170_MAC_REG_CAM_RX_SERACH_HIT (AR9170_MAC_REG_BASE + 0x790) - -#define AR9170_MAC_REG_AC0_CW (AR9170_MAC_REG_BASE + 0xb00) -#define AR9170_MAC_REG_AC1_CW (AR9170_MAC_REG_BASE + 0xb04) -#define AR9170_MAC_REG_AC2_CW (AR9170_MAC_REG_BASE + 0xb08) -#define AR9170_MAC_REG_AC3_CW (AR9170_MAC_REG_BASE + 0xb0c) -#define AR9170_MAC_REG_AC4_CW (AR9170_MAC_REG_BASE + 0xb10) -#define AR9170_MAC_REG_AC2_AC1_AC0_AIFS (AR9170_MAC_REG_BASE + 0xb14) -#define AR9170_MAC_REG_AC4_AC3_AC2_AIFS (AR9170_MAC_REG_BASE + 0xb18) -#define AR9170_MAC_REG_TXOP_ACK_EXTENSION (AR9170_MAC_REG_BASE + 0xb1c) -#define AR9170_MAC_REG_TXOP_ACK_INTERVAL (AR9170_MAC_REG_BASE + 0xb20) -#define AR9170_MAC_REG_CONTENTION_POINT (AR9170_MAC_REG_BASE + 0xb24) -#define AR9170_MAC_REG_RETRY_MAX (AR9170_MAC_REG_BASE + 0xb28) -#define AR9170_MAC_REG_TID_CFACK_CFEND_RATE (AR9170_MAC_REG_BASE + 0xb2c) -#define AR9170_MAC_REG_TXOP_NOT_ENOUGH_IND (AR9170_MAC_REG_BASE + 0xb30) -#define AR9170_MAC_REG_TKIP_TSC (AR9170_MAC_REG_BASE + 0xb34) -#define AR9170_MAC_REG_TXOP_DURATION (AR9170_MAC_REG_BASE + 0xb38) -#define AR9170_MAC_REG_TX_QOS_THRESHOLD (AR9170_MAC_REG_BASE + 0xb3c) -#define AR9170_MAC_REG_QOS_PRIORITY_VIRTUAL_CCA (AR9170_MAC_REG_BASE + 0xb40) -#define AR9170_MAC_VIRTUAL_CCA_Q0 BIT(15) -#define AR9170_MAC_VIRTUAL_CCA_Q1 BIT(16) -#define AR9170_MAC_VIRTUAL_CCA_Q2 BIT(17) -#define AR9170_MAC_VIRTUAL_CCA_Q3 BIT(18) -#define AR9170_MAC_VIRTUAL_CCA_Q4 BIT(19) -#define AR9170_MAC_VIRTUAL_CCA_ALL (0xf8000) - -#define AR9170_MAC_REG_AC1_AC0_TXOP (AR9170_MAC_REG_BASE + 0xb44) -#define AR9170_MAC_REG_AC3_AC2_TXOP (AR9170_MAC_REG_BASE + 0xb48) - -#define AR9170_MAC_REG_AMPDU_COUNT (AR9170_MAC_REG_BASE + 0xb88) -#define AR9170_MAC_REG_MPDU_COUNT (AR9170_MAC_REG_BASE + 0xb8c) - -#define AR9170_MAC_REG_AMPDU_FACTOR (AR9170_MAC_REG_BASE + 0xb9c) -#define AR9170_MAC_AMPDU_FACTOR 0x7f0000 -#define AR9170_MAC_AMPDU_FACTOR_S 16 -#define AR9170_MAC_REG_AMPDU_DENSITY (AR9170_MAC_REG_BASE + 0xba0) -#define AR9170_MAC_AMPDU_DENSITY 0x7 -#define AR9170_MAC_AMPDU_DENSITY_S 0 - -#define AR9170_MAC_REG_FCS_SELECT (AR9170_MAC_REG_BASE + 0xbb0) -#define AR9170_MAC_FCS_SWFCS 0x1 -#define AR9170_MAC_FCS_FIFO_PROT 0x4 - -#define AR9170_MAC_REG_RTS_CTS_TPC (AR9170_MAC_REG_BASE + 0xbb4) -#define AR9170_MAC_REG_CFEND_QOSNULL_TPC (AR9170_MAC_REG_BASE + 0xbb8) - -#define AR9170_MAC_REG_ACK_TABLE (AR9170_MAC_REG_BASE + 0xc00) -#define AR9170_MAC_REG_RX_CONTROL (AR9170_MAC_REG_BASE + 0xc40) -#define AR9170_MAC_RX_CTRL_DEAGG 0x1 -#define AR9170_MAC_RX_CTRL_SHORT_FILTER 0x2 -#define AR9170_MAC_RX_CTRL_SA_DA_SEARCH 0x20 -#define AR9170_MAC_RX_CTRL_PASS_TO_HOST BIT(28) -#define AR9170_MAC_RX_CTRL_ACK_IN_SNIFFER BIT(30) - -#define AR9170_MAC_REG_RX_CONTROL_1 (AR9170_MAC_REG_BASE + 0xc44) - -#define AR9170_MAC_REG_AMPDU_RX_THRESH (AR9170_MAC_REG_BASE + 0xc50) - -#define AR9170_MAC_REG_RX_MPDU (AR9170_MAC_REG_BASE + 0xca0) -#define AR9170_MAC_REG_RX_DROPPED_MPDU (AR9170_MAC_REG_BASE + 0xca4) -#define AR9170_MAC_REG_RX_DEL_MPDU (AR9170_MAC_REG_BASE + 0xca8) -#define AR9170_MAC_REG_RX_PHY_MISC_ERROR (AR9170_MAC_REG_BASE + 0xcac) -#define AR9170_MAC_REG_RX_PHY_XR_ERROR (AR9170_MAC_REG_BASE + 0xcb0) -#define AR9170_MAC_REG_RX_PHY_OFDM_ERROR (AR9170_MAC_REG_BASE + 0xcb4) -#define AR9170_MAC_REG_RX_PHY_CCK_ERROR (AR9170_MAC_REG_BASE + 0xcb8) -#define AR9170_MAC_REG_RX_PHY_HT_ERROR (AR9170_MAC_REG_BASE + 0xcbc) -#define AR9170_MAC_REG_RX_PHY_TOTAL (AR9170_MAC_REG_BASE + 0xcc0) - -#define AR9170_MAC_REG_DMA_TXQ_ADDR (AR9170_MAC_REG_BASE + 0xd00) -#define AR9170_MAC_REG_DMA_TXQ_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd04) -#define AR9170_MAC_REG_DMA_TXQ0_ADDR (AR9170_MAC_REG_BASE + 0xd00) -#define AR9170_MAC_REG_DMA_TXQ0_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd04) -#define AR9170_MAC_REG_DMA_TXQ1_ADDR (AR9170_MAC_REG_BASE + 0xd08) -#define AR9170_MAC_REG_DMA_TXQ1_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd0c) -#define AR9170_MAC_REG_DMA_TXQ2_ADDR (AR9170_MAC_REG_BASE + 0xd10) -#define AR9170_MAC_REG_DMA_TXQ2_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd14) -#define AR9170_MAC_REG_DMA_TXQ3_ADDR (AR9170_MAC_REG_BASE + 0xd18) -#define AR9170_MAC_REG_DMA_TXQ3_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd1c) -#define AR9170_MAC_REG_DMA_TXQ4_ADDR (AR9170_MAC_REG_BASE + 0xd20) -#define AR9170_MAC_REG_DMA_TXQ4_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd24) -#define AR9170_MAC_REG_DMA_RXQ_ADDR (AR9170_MAC_REG_BASE + 0xd28) -#define AR9170_MAC_REG_DMA_RXQ_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd2c) - -#define AR9170_MAC_REG_DMA_TRIGGER (AR9170_MAC_REG_BASE + 0xd30) -#define AR9170_DMA_TRIGGER_TXQ0 BIT(0) -#define AR9170_DMA_TRIGGER_TXQ1 BIT(1) -#define AR9170_DMA_TRIGGER_TXQ2 BIT(2) -#define AR9170_DMA_TRIGGER_TXQ3 BIT(3) -#define AR9170_DMA_TRIGGER_TXQ4 BIT(4) -#define AR9170_DMA_TRIGGER_RXQ BIT(8) - -#define AR9170_MAC_REG_DMA_WLAN_STATUS (AR9170_MAC_REG_BASE + 0xd38) -#define AR9170_MAC_REG_DMA_STATUS (AR9170_MAC_REG_BASE + 0xd3c) -#define AR9170_MAC_REG_DMA_TXQ_LAST_ADDR (AR9170_MAC_REG_BASE + 0xd40) -#define AR9170_MAC_REG_DMA_TXQ0_LAST_ADDR (AR9170_MAC_REG_BASE + 0xd40) -#define AR9170_MAC_REG_DMA_TXQ1_LAST_ADDR (AR9170_MAC_REG_BASE + 0xd44) -#define AR9170_MAC_REG_DMA_TXQ2_LAST_ADDR (AR9170_MAC_REG_BASE + 0xd48) -#define AR9170_MAC_REG_DMA_TXQ3_LAST_ADDR (AR9170_MAC_REG_BASE + 0xd4c) -#define AR9170_MAC_REG_DMA_TXQ4_LAST_ADDR (AR9170_MAC_REG_BASE + 0xd50) -#define AR9170_MAC_REG_DMA_TXQ0Q1_LEN (AR9170_MAC_REG_BASE + 0xd54) -#define AR9170_MAC_REG_DMA_TXQ2Q3_LEN (AR9170_MAC_REG_BASE + 0xd58) -#define AR9170_MAC_REG_DMA_TXQ4_LEN (AR9170_MAC_REG_BASE + 0xd5c) - -#define AR9170_MAC_REG_DMA_TXQX_LAST_ADDR (AR9170_MAC_REG_BASE + 0xd74) -#define AR9170_MAC_REG_DMA_TXQX_FAIL_ADDR (AR9170_MAC_REG_BASE + 0xd78) -#define AR9170_MAC_REG_TXRX_MPI (AR9170_MAC_REG_BASE + 0xd7c) -#define AR9170_MAC_TXRX_MPI_TX_MPI_MASK 0x0000000f -#define AR9170_MAC_TXRX_MPI_TX_TO_MASK 0x0000fff0 -#define AR9170_MAC_TXRX_MPI_RX_MPI_MASK 0x000f0000 -#define AR9170_MAC_TXRX_MPI_RX_TO_MASK 0xfff00000 - -#define AR9170_MAC_REG_BCN_ADDR (AR9170_MAC_REG_BASE + 0xd84) -#define AR9170_MAC_REG_BCN_LENGTH (AR9170_MAC_REG_BASE + 0xd88) -#define AR9170_MAC_BCN_LENGTH_MAX (512 - 32) - -#define AR9170_MAC_REG_BCN_STATUS (AR9170_MAC_REG_BASE + 0xd8c) - -#define AR9170_MAC_REG_BCN_PLCP (AR9170_MAC_REG_BASE + 0xd90) -#define AR9170_MAC_REG_BCN_CTRL (AR9170_MAC_REG_BASE + 0xd94) -#define AR9170_BCN_CTRL_READY 0x01 -#define AR9170_BCN_CTRL_LOCK 0x02 - -#define AR9170_MAC_REG_BCN_CURR_ADDR (AR9170_MAC_REG_BASE + 0xd98) -#define AR9170_MAC_REG_BCN_COUNT (AR9170_MAC_REG_BASE + 0xd9c) -#define AR9170_MAC_REG_BCN_HT1 (AR9170_MAC_REG_BASE + 0xda0) -#define AR9170_MAC_BCN_HT1_HT_EN BIT(0) -#define AR9170_MAC_BCN_HT1_GF_PMB BIT(1) -#define AR9170_MAC_BCN_HT1_SP_EXP BIT(2) -#define AR9170_MAC_BCN_HT1_TX_BF BIT(3) -#define AR9170_MAC_BCN_HT1_PWR_CTRL_S 4 -#define AR9170_MAC_BCN_HT1_PWR_CTRL 0x70 -#define AR9170_MAC_BCN_HT1_TX_ANT1 BIT(7) -#define AR9170_MAC_BCN_HT1_TX_ANT0 BIT(8) -#define AR9170_MAC_BCN_HT1_NUM_LFT_S 9 -#define AR9170_MAC_BCN_HT1_NUM_LFT 0x600 -#define AR9170_MAC_BCN_HT1_BWC_20M_EXT BIT(16) -#define AR9170_MAC_BCN_HT1_BWC_40M_SHARED BIT(17) -#define AR9170_MAC_BCN_HT1_BWC_40M_DUP (BIT(16) | BIT(17)) -#define AR9170_MAC_BCN_HT1_BF_MCS_S 18 -#define AR9170_MAC_BCN_HT1_BF_MCS 0x1c0000 -#define AR9170_MAC_BCN_HT1_TPC_S 21 -#define AR9170_MAC_BCN_HT1_TPC 0x7e00000 -#define AR9170_MAC_BCN_HT1_CHAIN_MASK_S 27 -#define AR9170_MAC_BCN_HT1_CHAIN_MASK 0x38000000 - -#define AR9170_MAC_REG_BCN_HT2 (AR9170_MAC_REG_BASE + 0xda4) -#define AR9170_MAC_BCN_HT2_MCS_S 0 -#define AR9170_MAC_BCN_HT2_MCS 0x7f -#define AR9170_MAC_BCN_HT2_BW40 BIT(8) -#define AR9170_MAC_BCN_HT2_SMOOTHING BIT(9) -#define AR9170_MAC_BCN_HT2_SS BIT(10) -#define AR9170_MAC_BCN_HT2_NSS BIT(11) -#define AR9170_MAC_BCN_HT2_STBC_S 12 -#define AR9170_MAC_BCN_HT2_STBC 0x3000 -#define AR9170_MAC_BCN_HT2_ADV_COD BIT(14) -#define AR9170_MAC_BCN_HT2_SGI BIT(15) -#define AR9170_MAC_BCN_HT2_LEN_S 16 -#define AR9170_MAC_BCN_HT2_LEN 0xffff0000 - -#define AR9170_MAC_REG_DMA_TXQX_ADDR_CURR (AR9170_MAC_REG_BASE + 0xdc0) - -/* Random number generator */ -#define AR9170_RAND_REG_BASE 0x1d0000 - -#define AR9170_RAND_REG_NUM (AR9170_RAND_REG_BASE + 0x000) -#define AR9170_RAND_REG_MODE (AR9170_RAND_REG_BASE + 0x004) -#define AR9170_RAND_MODE_MANUAL 0x000 -#define AR9170_RAND_MODE_FREE 0x001 - -/* GPIO */ -#define AR9170_GPIO_REG_BASE 0x1d0100 -#define AR9170_GPIO_REG_PORT_TYPE (AR9170_GPIO_REG_BASE + 0x000) -#define AR9170_GPIO_REG_PORT_DATA (AR9170_GPIO_REG_BASE + 0x004) -#define AR9170_GPIO_PORT_LED_0 1 -#define AR9170_GPIO_PORT_LED_1 2 -/* WPS Button GPIO for TP-Link TL-WN821N */ -#define AR9170_GPIO_PORT_WPS_BUTTON_PRESSED 4 - -/* Memory Controller */ -#define AR9170_MC_REG_BASE 0x1d1000 - -#define AR9170_MC_REG_FLASH_WAIT_STATE (AR9170_MC_REG_BASE + 0x000) -#define AR9170_MC_REG_SEEPROM_WP0 (AR9170_MC_REG_BASE + 0x400) -#define AR9170_MC_REG_SEEPROM_WP1 (AR9170_MC_REG_BASE + 0x404) -#define AR9170_MC_REG_SEEPROM_WP2 (AR9170_MC_REG_BASE + 0x408) - -/* Interrupt Controller */ -#define AR9170_MAX_INT_SRC 9 -#define AR9170_INT_REG_BASE 0x1d2000 - -#define AR9170_INT_REG_FLAG (AR9170_INT_REG_BASE + 0x000) -#define AR9170_INT_REG_FIQ_MASK (AR9170_INT_REG_BASE + 0x004) -#define AR9170_INT_REG_IRQ_MASK (AR9170_INT_REG_BASE + 0x008) -/* INT_REG_FLAG, INT_REG_FIQ_MASK and INT_REG_IRQ_MASK */ -#define AR9170_INT_FLAG_WLAN 0x001 -#define AR9170_INT_FLAG_PTAB_BIT 0x002 -#define AR9170_INT_FLAG_SE_BIT 0x004 -#define AR9170_INT_FLAG_UART_BIT 0x008 -#define AR9170_INT_FLAG_TIMER_BIT 0x010 -#define AR9170_INT_FLAG_EXT_BIT 0x020 -#define AR9170_INT_FLAG_SW_BIT 0x040 -#define AR9170_INT_FLAG_USB_BIT 0x080 -#define AR9170_INT_FLAG_ETHERNET_BIT 0x100 - -#define AR9170_INT_REG_PRIORITY1 (AR9170_INT_REG_BASE + 0x00c) -#define AR9170_INT_REG_PRIORITY2 (AR9170_INT_REG_BASE + 0x010) -#define AR9170_INT_REG_PRIORITY3 (AR9170_INT_REG_BASE + 0x014) -#define AR9170_INT_REG_EXT_INT_CONTROL (AR9170_INT_REG_BASE + 0x018) -#define AR9170_INT_REG_SW_INT_CONTROL (AR9170_INT_REG_BASE + 0x01c) -#define AR9170_INT_SW_INT_ENABLE 0x1 - -#define AR9170_INT_REG_FIQ_ENCODE (AR9170_INT_REG_BASE + 0x020) -#define AR9170_INT_INT_IRQ_ENCODE (AR9170_INT_REG_BASE + 0x024) - -/* Power Management */ -#define AR9170_PWR_REG_BASE 0x1d4000 - -#define AR9170_PWR_REG_POWER_STATE (AR9170_PWR_REG_BASE + 0x000) - -#define AR9170_PWR_REG_RESET (AR9170_PWR_REG_BASE + 0x004) -#define AR9170_PWR_RESET_COMMIT_RESET_MASK BIT(0) -#define AR9170_PWR_RESET_WLAN_MASK BIT(1) -#define AR9170_PWR_RESET_DMA_MASK BIT(2) -#define AR9170_PWR_RESET_BRIDGE_MASK BIT(3) -#define AR9170_PWR_RESET_AHB_MASK BIT(9) -#define AR9170_PWR_RESET_BB_WARM_RESET BIT(10) -#define AR9170_PWR_RESET_BB_COLD_RESET BIT(11) -#define AR9170_PWR_RESET_ADDA_CLK_COLD_RESET BIT(12) -#define AR9170_PWR_RESET_PLL BIT(13) -#define AR9170_PWR_RESET_USB_PLL BIT(14) - -#define AR9170_PWR_REG_CLOCK_SEL (AR9170_PWR_REG_BASE + 0x008) -#define AR9170_PWR_CLK_AHB_40MHZ 0 -#define AR9170_PWR_CLK_AHB_20_22MHZ 1 -#define AR9170_PWR_CLK_AHB_40_44MHZ 2 -#define AR9170_PWR_CLK_AHB_80_88MHZ 3 -#define AR9170_PWR_CLK_DAC_160_INV_DLY 0x70 - -#define AR9170_PWR_REG_CHIP_REVISION (AR9170_PWR_REG_BASE + 0x010) -#define AR9170_PWR_REG_PLL_ADDAC (AR9170_PWR_REG_BASE + 0x014) -#define AR9170_PWR_PLL_ADDAC_DIV_S 2 -#define AR9170_PWR_PLL_ADDAC_DIV 0xffc -#define AR9170_PWR_REG_WATCH_DOG_MAGIC (AR9170_PWR_REG_BASE + 0x020) - -/* Faraday USB Controller */ -#define AR9170_USB_REG_BASE 0x1e1000 - -#define AR9170_USB_REG_MAIN_CTRL (AR9170_USB_REG_BASE + 0x000) -#define AR9170_USB_MAIN_CTRL_REMOTE_WAKEUP BIT(0) -#define AR9170_USB_MAIN_CTRL_ENABLE_GLOBAL_INT BIT(2) -#define AR9170_USB_MAIN_CTRL_GO_TO_SUSPEND BIT(3) -#define AR9170_USB_MAIN_CTRL_RESET BIT(4) -#define AR9170_USB_MAIN_CTRL_CHIP_ENABLE BIT(5) -#define AR9170_USB_MAIN_CTRL_HIGHSPEED BIT(6) - -#define AR9170_USB_REG_DEVICE_ADDRESS (AR9170_USB_REG_BASE + 0x001) -#define AR9170_USB_DEVICE_ADDRESS_CONFIGURE BIT(7) - -#define AR9170_USB_REG_TEST (AR9170_USB_REG_BASE + 0x002) -#define AR9170_USB_REG_PHY_TEST_SELECT (AR9170_USB_REG_BASE + 0x008) -#define AR9170_USB_REG_CX_CONFIG_STATUS (AR9170_USB_REG_BASE + 0x00b) -#define AR9170_USB_REG_EP0_DATA (AR9170_USB_REG_BASE + 0x00c) -#define AR9170_USB_REG_EP0_DATA1 (AR9170_USB_REG_BASE + 0x00c) -#define AR9170_USB_REG_EP0_DATA2 (AR9170_USB_REG_BASE + 0x00d) - -#define AR9170_USB_REG_INTR_MASK_BYTE_0 (AR9170_USB_REG_BASE + 0x011) -#define AR9170_USB_REG_INTR_MASK_BYTE_1 (AR9170_USB_REG_BASE + 0x012) -#define AR9170_USB_REG_INTR_MASK_BYTE_2 (AR9170_USB_REG_BASE + 0x013) -#define AR9170_USB_REG_INTR_MASK_BYTE_3 (AR9170_USB_REG_BASE + 0x014) -#define AR9170_USB_REG_INTR_MASK_BYTE_4 (AR9170_USB_REG_BASE + 0x015) -#define AR9170_USB_INTR_DISABLE_OUT_INT (BIT(7) | BIT(6)) - -#define AR9170_USB_REG_INTR_MASK_BYTE_5 (AR9170_USB_REG_BASE + 0x016) -#define AR9170_USB_REG_INTR_MASK_BYTE_6 (AR9170_USB_REG_BASE + 0x017) -#define AR9170_USB_INTR_DISABLE_IN_INT BIT(6) - -#define AR9170_USB_REG_INTR_MASK_BYTE_7 (AR9170_USB_REG_BASE + 0x018) - -#define AR9170_USB_REG_INTR_GROUP (AR9170_USB_REG_BASE + 0x020) - -#define AR9170_USB_REG_INTR_SOURCE_0 (AR9170_USB_REG_BASE + 0x021) -#define AR9170_USB_INTR_SRC0_SETUP BIT(0) -#define AR9170_USB_INTR_SRC0_IN BIT(1) -#define AR9170_USB_INTR_SRC0_OUT BIT(2) -#define AR9170_USB_INTR_SRC0_FAIL BIT(3) /* ??? */ -#define AR9170_USB_INTR_SRC0_END BIT(4) /* ??? */ -#define AR9170_USB_INTR_SRC0_ABORT BIT(7) - -#define AR9170_USB_REG_INTR_SOURCE_1 (AR9170_USB_REG_BASE + 0x022) -#define AR9170_USB_REG_INTR_SOURCE_2 (AR9170_USB_REG_BASE + 0x023) -#define AR9170_USB_REG_INTR_SOURCE_3 (AR9170_USB_REG_BASE + 0x024) -#define AR9170_USB_REG_INTR_SOURCE_4 (AR9170_USB_REG_BASE + 0x025) -#define AR9170_USB_REG_INTR_SOURCE_5 (AR9170_USB_REG_BASE + 0x026) -#define AR9170_USB_REG_INTR_SOURCE_6 (AR9170_USB_REG_BASE + 0x027) -#define AR9170_USB_REG_INTR_SOURCE_7 (AR9170_USB_REG_BASE + 0x028) -#define AR9170_USB_INTR_SRC7_USB_RESET BIT(1) -#define AR9170_USB_INTR_SRC7_USB_SUSPEND BIT(2) -#define AR9170_USB_INTR_SRC7_USB_RESUME BIT(3) -#define AR9170_USB_INTR_SRC7_ISO_SEQ_ERR BIT(4) -#define AR9170_USB_INTR_SRC7_ISO_SEQ_ABORT BIT(5) -#define AR9170_USB_INTR_SRC7_TX0BYTE BIT(6) -#define AR9170_USB_INTR_SRC7_RX0BYTE BIT(7) - -#define AR9170_USB_REG_IDLE_COUNT (AR9170_USB_REG_BASE + 0x02f) - -#define AR9170_USB_REG_EP_MAP (AR9170_USB_REG_BASE + 0x030) -#define AR9170_USB_REG_EP1_MAP (AR9170_USB_REG_BASE + 0x030) -#define AR9170_USB_REG_EP2_MAP (AR9170_USB_REG_BASE + 0x031) -#define AR9170_USB_REG_EP3_MAP (AR9170_USB_REG_BASE + 0x032) -#define AR9170_USB_REG_EP4_MAP (AR9170_USB_REG_BASE + 0x033) -#define AR9170_USB_REG_EP5_MAP (AR9170_USB_REG_BASE + 0x034) -#define AR9170_USB_REG_EP6_MAP (AR9170_USB_REG_BASE + 0x035) -#define AR9170_USB_REG_EP7_MAP (AR9170_USB_REG_BASE + 0x036) -#define AR9170_USB_REG_EP8_MAP (AR9170_USB_REG_BASE + 0x037) -#define AR9170_USB_REG_EP9_MAP (AR9170_USB_REG_BASE + 0x038) -#define AR9170_USB_REG_EP10_MAP (AR9170_USB_REG_BASE + 0x039) - -#define AR9170_USB_REG_EP_IN_MAX_SIZE_HIGH (AR9170_USB_REG_BASE + 0x03f) -#define AR9170_USB_EP_IN_TOGGLE 0x10 - -#define AR9170_USB_REG_EP_IN_MAX_SIZE_LOW (AR9170_USB_REG_BASE + 0x03e) - -#define AR9170_USB_REG_EP_OUT_MAX_SIZE_HIGH (AR9170_USB_REG_BASE + 0x05f) -#define AR9170_USB_EP_OUT_TOGGLE 0x10 - -#define AR9170_USB_REG_EP_OUT_MAX_SIZE_LOW (AR9170_USB_REG_BASE + 0x05e) - -#define AR9170_USB_REG_EP3_BYTE_COUNT_HIGH (AR9170_USB_REG_BASE + 0x0ae) -#define AR9170_USB_REG_EP3_BYTE_COUNT_LOW (AR9170_USB_REG_BASE + 0x0be) -#define AR9170_USB_REG_EP4_BYTE_COUNT_HIGH (AR9170_USB_REG_BASE + 0x0af) -#define AR9170_USB_REG_EP4_BYTE_COUNT_LOW (AR9170_USB_REG_BASE + 0x0bf) - -#define AR9170_USB_REG_FIFO_MAP (AR9170_USB_REG_BASE + 0x080) -#define AR9170_USB_REG_FIFO0_MAP (AR9170_USB_REG_BASE + 0x080) -#define AR9170_USB_REG_FIFO1_MAP (AR9170_USB_REG_BASE + 0x081) -#define AR9170_USB_REG_FIFO2_MAP (AR9170_USB_REG_BASE + 0x082) -#define AR9170_USB_REG_FIFO3_MAP (AR9170_USB_REG_BASE + 0x083) -#define AR9170_USB_REG_FIFO4_MAP (AR9170_USB_REG_BASE + 0x084) -#define AR9170_USB_REG_FIFO5_MAP (AR9170_USB_REG_BASE + 0x085) -#define AR9170_USB_REG_FIFO6_MAP (AR9170_USB_REG_BASE + 0x086) -#define AR9170_USB_REG_FIFO7_MAP (AR9170_USB_REG_BASE + 0x087) -#define AR9170_USB_REG_FIFO8_MAP (AR9170_USB_REG_BASE + 0x088) -#define AR9170_USB_REG_FIFO9_MAP (AR9170_USB_REG_BASE + 0x089) - -#define AR9170_USB_REG_FIFO_CONFIG (AR9170_USB_REG_BASE + 0x090) -#define AR9170_USB_REG_FIFO0_CONFIG (AR9170_USB_REG_BASE + 0x090) -#define AR9170_USB_REG_FIFO1_CONFIG (AR9170_USB_REG_BASE + 0x091) -#define AR9170_USB_REG_FIFO2_CONFIG (AR9170_USB_REG_BASE + 0x092) -#define AR9170_USB_REG_FIFO3_CONFIG (AR9170_USB_REG_BASE + 0x093) -#define AR9170_USB_REG_FIFO4_CONFIG (AR9170_USB_REG_BASE + 0x094) -#define AR9170_USB_REG_FIFO5_CONFIG (AR9170_USB_REG_BASE + 0x095) -#define AR9170_USB_REG_FIFO6_CONFIG (AR9170_USB_REG_BASE + 0x096) -#define AR9170_USB_REG_FIFO7_CONFIG (AR9170_USB_REG_BASE + 0x097) -#define AR9170_USB_REG_FIFO8_CONFIG (AR9170_USB_REG_BASE + 0x098) -#define AR9170_USB_REG_FIFO9_CONFIG (AR9170_USB_REG_BASE + 0x099) - -#define AR9170_USB_REG_EP3_DATA (AR9170_USB_REG_BASE + 0x0f8) -#define AR9170_USB_REG_EP4_DATA (AR9170_USB_REG_BASE + 0x0fc) - -#define AR9170_USB_REG_FIFO_SIZE (AR9170_USB_REG_BASE + 0x100) -#define AR9170_USB_REG_DMA_CTL (AR9170_USB_REG_BASE + 0x108) -#define AR9170_USB_DMA_CTL_ENABLE_TO_DEVICE BIT(0) -#define AR9170_USB_DMA_CTL_ENABLE_FROM_DEVICE BIT(1) -#define AR9170_USB_DMA_CTL_HIGH_SPEED BIT(2) -#define AR9170_USB_DMA_CTL_UP_PACKET_MODE BIT(3) -#define AR9170_USB_DMA_CTL_UP_STREAM_S 4 -#define AR9170_USB_DMA_CTL_UP_STREAM (BIT(4) | BIT(5)) -#define AR9170_USB_DMA_CTL_UP_STREAM_4K (0) -#define AR9170_USB_DMA_CTL_UP_STREAM_8K BIT(4) -#define AR9170_USB_DMA_CTL_UP_STREAM_16K BIT(5) -#define AR9170_USB_DMA_CTL_UP_STREAM_32K (BIT(4) | BIT(5)) -#define AR9170_USB_DMA_CTL_DOWN_STREAM BIT(6) - -#define AR9170_USB_REG_DMA_STATUS (AR9170_USB_REG_BASE + 0x10c) -#define AR9170_USB_DMA_STATUS_UP_IDLE BIT(8) -#define AR9170_USB_DMA_STATUS_DN_IDLE BIT(16) - -#define AR9170_USB_REG_MAX_AGG_UPLOAD (AR9170_USB_REG_BASE + 0x110) -#define AR9170_USB_REG_UPLOAD_TIME_CTL (AR9170_USB_REG_BASE + 0x114) - -#define AR9170_USB_REG_WAKE_UP (AR9170_USB_REG_BASE + 0x120) -#define AR9170_USB_WAKE_UP_WAKE BIT(0) - -#define AR9170_USB_REG_CBUS_CTRL (AR9170_USB_REG_BASE + 0x1f0) -#define AR9170_USB_CBUS_CTRL_BUFFER_END (BIT(1)) - -/* PCI/USB to AHB Bridge */ -#define AR9170_PTA_REG_BASE 0x1e2000 - -#define AR9170_PTA_REG_CMD (AR9170_PTA_REG_BASE + 0x000) -#define AR9170_PTA_REG_PARAM1 (AR9170_PTA_REG_BASE + 0x004) -#define AR9170_PTA_REG_PARAM2 (AR9170_PTA_REG_BASE + 0x008) -#define AR9170_PTA_REG_PARAM3 (AR9170_PTA_REG_BASE + 0x00c) -#define AR9170_PTA_REG_RSP (AR9170_PTA_REG_BASE + 0x010) -#define AR9170_PTA_REG_STATUS1 (AR9170_PTA_REG_BASE + 0x014) -#define AR9170_PTA_REG_STATUS2 (AR9170_PTA_REG_BASE + 0x018) -#define AR9170_PTA_REG_STATUS3 (AR9170_PTA_REG_BASE + 0x01c) -#define AR9170_PTA_REG_AHB_INT_FLAG (AR9170_PTA_REG_BASE + 0x020) -#define AR9170_PTA_REG_AHB_INT_MASK (AR9170_PTA_REG_BASE + 0x024) -#define AR9170_PTA_REG_AHB_INT_ACK (AR9170_PTA_REG_BASE + 0x028) -#define AR9170_PTA_REG_AHB_SCRATCH1 (AR9170_PTA_REG_BASE + 0x030) -#define AR9170_PTA_REG_AHB_SCRATCH2 (AR9170_PTA_REG_BASE + 0x034) -#define AR9170_PTA_REG_AHB_SCRATCH3 (AR9170_PTA_REG_BASE + 0x038) -#define AR9170_PTA_REG_AHB_SCRATCH4 (AR9170_PTA_REG_BASE + 0x03c) - -#define AR9170_PTA_REG_SHARE_MEM_CTRL (AR9170_PTA_REG_BASE + 0x124) - -/* - * PCI to AHB Bridge - */ - -#define AR9170_PTA_REG_INT_FLAG (AR9170_PTA_REG_BASE + 0x100) -#define AR9170_PTA_INT_FLAG_DN 0x01 -#define AR9170_PTA_INT_FLAG_UP 0x02 -#define AR9170_PTA_INT_FLAG_CMD 0x04 - -#define AR9170_PTA_REG_INT_MASK (AR9170_PTA_REG_BASE + 0x104) -#define AR9170_PTA_REG_DN_DMA_ADDRL (AR9170_PTA_REG_BASE + 0x108) -#define AR9170_PTA_REG_DN_DMA_ADDRH (AR9170_PTA_REG_BASE + 0x10c) -#define AR9170_PTA_REG_UP_DMA_ADDRL (AR9170_PTA_REG_BASE + 0x110) -#define AR9170_PTA_REG_UP_DMA_ADDRH (AR9170_PTA_REG_BASE + 0x114) -#define AR9170_PTA_REG_DN_PEND_TIME (AR9170_PTA_REG_BASE + 0x118) -#define AR9170_PTA_REG_UP_PEND_TIME (AR9170_PTA_REG_BASE + 0x11c) -#define AR9170_PTA_REG_CONTROL (AR9170_PTA_REG_BASE + 0x120) -#define AR9170_PTA_CTRL_4_BEAT_BURST 0x00 -#define AR9170_PTA_CTRL_8_BEAT_BURST 0x01 -#define AR9170_PTA_CTRL_16_BEAT_BURST 0x02 -#define AR9170_PTA_CTRL_LOOPBACK_MODE 0x10 - -#define AR9170_PTA_REG_MEM_CTRL (AR9170_PTA_REG_BASE + 0x124) -#define AR9170_PTA_REG_MEM_ADDR (AR9170_PTA_REG_BASE + 0x128) -#define AR9170_PTA_REG_DN_DMA_TRIGGER (AR9170_PTA_REG_BASE + 0x12c) -#define AR9170_PTA_REG_UP_DMA_TRIGGER (AR9170_PTA_REG_BASE + 0x130) -#define AR9170_PTA_REG_DMA_STATUS (AR9170_PTA_REG_BASE + 0x134) -#define AR9170_PTA_REG_DN_CURR_ADDRL (AR9170_PTA_REG_BASE + 0x138) -#define AR9170_PTA_REG_DN_CURR_ADDRH (AR9170_PTA_REG_BASE + 0x13c) -#define AR9170_PTA_REG_UP_CURR_ADDRL (AR9170_PTA_REG_BASE + 0x140) -#define AR9170_PTA_REG_UP_CURR_ADDRH (AR9170_PTA_REG_BASE + 0x144) -#define AR9170_PTA_REG_DMA_MODE_CTRL (AR9170_PTA_REG_BASE + 0x148) -#define AR9170_PTA_DMA_MODE_CTRL_RESET BIT(0) -#define AR9170_PTA_DMA_MODE_CTRL_DISABLE_USB BIT(1) - -/* Protocol Controller Module */ -#define AR9170_MAC_REG_PC_REG_BASE (AR9170_MAC_REG_BASE + 0xe00) - - -#define AR9170_NUM_LEDS 2 - -/* CAM */ -#define AR9170_CAM_MAX_USER 64 -#define AR9170_CAM_MAX_KEY_LENGTH 16 - -#define AR9170_SRAM_OFFSET 0x100000 -#define AR9170_SRAM_SIZE 0x18000 - -#define AR9170_PRAM_OFFSET 0x200000 -#define AR9170_PRAM_SIZE 0x8000 - -enum cpu_clock { - AHB_STATIC_40MHZ = 0, - AHB_GMODE_22MHZ = 1, - AHB_AMODE_20MHZ = 1, - AHB_GMODE_44MHZ = 2, - AHB_AMODE_40MHZ = 2, - AHB_GMODE_88MHZ = 3, - AHB_AMODE_80MHZ = 3 -}; - -/* USB endpoints */ -enum ar9170_usb_ep { - /* - * Control EP is always EP 0 (USB SPEC) - * - * The weird thing is: the original firmware has a few - * comments that suggest that the actual EP numbers - * are in the 1 to 10 range?! - */ - AR9170_USB_EP_CTRL = 0, - - AR9170_USB_EP_TX, - AR9170_USB_EP_RX, - AR9170_USB_EP_IRQ, - AR9170_USB_EP_CMD, - AR9170_USB_NUM_EXTRA_EP = 4, - - __AR9170_USB_NUM_EP, - - __AR9170_USB_NUM_MAX_EP = 10 -}; - -enum ar9170_usb_fifo { - __AR9170_USB_NUM_MAX_FIFO = 10 -}; - -enum ar9170_tx_queues { - AR9170_TXQ0 = 0, - AR9170_TXQ1, - AR9170_TXQ2, - AR9170_TXQ3, - AR9170_TXQ_SPECIAL, - - /* keep last */ - __AR9170_NUM_TX_QUEUES = 5 -}; - -#define AR9170_TX_STREAM_TAG 0x697e -#define AR9170_RX_STREAM_TAG 0x4e00 -#define AR9170_RX_STREAM_MAX_SIZE 0xffff - -struct ar9170_stream { - __le16 length; - __le16 tag; - - u8 payload[0]; -} __packed __aligned(4); -#define AR9170_STREAM_LEN 4 - -#define AR9170_MAX_ACKTABLE_ENTRIES 8 -#define AR9170_MAX_VIRTUAL_MAC 7 - -#define AR9170_USB_EP_CTRL_MAX 64 -#define AR9170_USB_EP_TX_MAX 512 -#define AR9170_USB_EP_RX_MAX 512 -#define AR9170_USB_EP_IRQ_MAX 64 -#define AR9170_USB_EP_CMD_MAX 64 - -/* Trigger PRETBTT interrupt 6 Kus earlier */ -#define CARL9170_PRETBTT_KUS 6 - -#define AR5416_MAX_RATE_POWER 63 - -#define SET_VAL(reg, value, newvalue) \ - (value = ((value) & ~reg) | (((newvalue) << reg##_S) & reg)) - -#define SET_CONSTVAL(reg, newvalue) \ - (((newvalue) << reg##_S) & reg) - -#define MOD_VAL(reg, value, newvalue) \ - (((value) & ~reg) | (((newvalue) << reg##_S) & reg)) - -#define GET_VAL(reg, value) \ - (((value) & reg) >> reg##_S) - -#endif /* __CARL9170_SHARED_HW_H */ diff --git a/drivers/net/wireless/ath/carl9170/led.c b/drivers/net/wireless/ath/carl9170/led.c deleted file mode 100644 index 78dadc797558..000000000000 --- a/drivers/net/wireless/ath/carl9170/led.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Atheros CARL9170 driver - * - * LED handling - * - * Copyright 2008, Johannes Berg - * Copyright 2009, 2010, Christian Lamparer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "carl9170.h" -#include "cmd.h" - -int carl9170_led_set_state(struct ar9170 *ar, const u32 led_state) -{ - return carl9170_write_reg(ar, AR9170_GPIO_REG_PORT_DATA, led_state); -} - -int carl9170_led_init(struct ar9170 *ar) -{ - int err; - - /* disable LEDs */ - /* GPIO [0/1 mode: output, 2/3: input] */ - err = carl9170_write_reg(ar, AR9170_GPIO_REG_PORT_TYPE, 3); - if (err) - goto out; - - /* GPIO 0/1 value: off */ - err = carl9170_led_set_state(ar, 0); - -out: - return err; -} - -#ifdef CONFIG_CARL9170_LEDS -static void carl9170_led_update(struct work_struct *work) -{ - struct ar9170 *ar = container_of(work, struct ar9170, led_work.work); - int i, tmp = 300, blink_delay = 1000; - u32 led_val = 0; - bool rerun = false; - - if (!IS_ACCEPTING_CMD(ar)) - return; - - mutex_lock(&ar->mutex); - for (i = 0; i < AR9170_NUM_LEDS; i++) { - if (ar->leds[i].registered) { - if (ar->leds[i].last_state || - ar->leds[i].toggled) { - - if (ar->leds[i].toggled) - tmp = 70 + 200 / (ar->leds[i].toggled); - - if (tmp < blink_delay) - blink_delay = tmp; - - led_val |= 1 << i; - ar->leds[i].toggled = 0; - rerun = true; - } - } - } - - carl9170_led_set_state(ar, led_val); - mutex_unlock(&ar->mutex); - - if (!rerun) - return; - - ieee80211_queue_delayed_work(ar->hw, - &ar->led_work, - msecs_to_jiffies(blink_delay)); -} - -static void carl9170_led_set_brightness(struct led_classdev *led, - enum led_brightness brightness) -{ - struct carl9170_led *arl = container_of(led, struct carl9170_led, l); - struct ar9170 *ar = arl->ar; - - if (!arl->registered) - return; - - if (arl->last_state != !!brightness) { - arl->toggled++; - arl->last_state = !!brightness; - } - - if (likely(IS_ACCEPTING_CMD(ar) && arl->toggled)) - ieee80211_queue_delayed_work(ar->hw, &ar->led_work, HZ / 10); -} - -static int carl9170_led_register_led(struct ar9170 *ar, int i, char *name, - char *trigger) -{ - int err; - - snprintf(ar->leds[i].name, sizeof(ar->leds[i].name), - "carl9170-%s::%s", wiphy_name(ar->hw->wiphy), name); - - ar->leds[i].ar = ar; - ar->leds[i].l.name = ar->leds[i].name; - ar->leds[i].l.brightness_set = carl9170_led_set_brightness; - ar->leds[i].l.brightness = 0; - ar->leds[i].l.default_trigger = trigger; - - err = led_classdev_register(wiphy_dev(ar->hw->wiphy), - &ar->leds[i].l); - if (err) { - wiphy_err(ar->hw->wiphy, "failed to register %s LED (%d).\n", - ar->leds[i].name, err); - } else { - ar->leds[i].registered = true; - } - - return err; -} - -void carl9170_led_unregister(struct ar9170 *ar) -{ - int i; - - for (i = 0; i < AR9170_NUM_LEDS; i++) - if (ar->leds[i].registered) { - led_classdev_unregister(&ar->leds[i].l); - ar->leds[i].registered = false; - ar->leds[i].toggled = 0; - } - - cancel_delayed_work_sync(&ar->led_work); -} - -int carl9170_led_register(struct ar9170 *ar) -{ - int err; - - INIT_DELAYED_WORK(&ar->led_work, carl9170_led_update); - - err = carl9170_led_register_led(ar, 0, "tx", - ieee80211_get_tx_led_name(ar->hw)); - if (err) - goto fail; - - if (ar->features & CARL9170_ONE_LED) - return 0; - - err = carl9170_led_register_led(ar, 1, "assoc", - ieee80211_get_assoc_led_name(ar->hw)); - if (err) - goto fail; - - return 0; - -fail: - carl9170_led_unregister(ar); - return err; -} - -#endif /* CONFIG_CARL9170_LEDS */ diff --git a/drivers/net/wireless/ath/carl9170/mac.c b/drivers/net/wireless/ath/carl9170/mac.c deleted file mode 100644 index a2f005703c04..000000000000 --- a/drivers/net/wireless/ath/carl9170/mac.c +++ /dev/null @@ -1,538 +0,0 @@ -/* - * Atheros CARL9170 driver - * - * MAC programming - * - * Copyright 2008, Johannes Berg - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#include "carl9170.h" -#include "cmd.h" - -int carl9170_set_dyn_sifs_ack(struct ar9170 *ar) -{ - u32 val; - - if (conf_is_ht40(&ar->hw->conf)) - val = 0x010a; - else { - if (ar->hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) - val = 0x105; - else - val = 0x104; - } - - return carl9170_write_reg(ar, AR9170_MAC_REG_DYNAMIC_SIFS_ACK, val); -} - -int carl9170_set_rts_cts_rate(struct ar9170 *ar) -{ - u32 rts_rate, cts_rate; - - if (conf_is_ht(&ar->hw->conf)) { - /* 12 mbit OFDM */ - rts_rate = 0x1da; - cts_rate = 0x10a; - } else { - if (ar->hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) { - /* 11 mbit CCK */ - rts_rate = 033; - cts_rate = 003; - } else { - /* 6 mbit OFDM */ - rts_rate = 0x1bb; - cts_rate = 0x10b; - } - } - - return carl9170_write_reg(ar, AR9170_MAC_REG_RTS_CTS_RATE, - rts_rate | (cts_rate) << 16); -} - -int carl9170_set_slot_time(struct ar9170 *ar) -{ - struct ieee80211_vif *vif; - u32 slottime = 20; - - rcu_read_lock(); - vif = carl9170_get_main_vif(ar); - if (!vif) { - rcu_read_unlock(); - return 0; - } - - if ((ar->hw->conf.chandef.chan->band == IEEE80211_BAND_5GHZ) || - vif->bss_conf.use_short_slot) - slottime = 9; - - rcu_read_unlock(); - - return carl9170_write_reg(ar, AR9170_MAC_REG_SLOT_TIME, - slottime << 10); -} - -int carl9170_set_mac_rates(struct ar9170 *ar) -{ - struct ieee80211_vif *vif; - u32 basic, mandatory; - - rcu_read_lock(); - vif = carl9170_get_main_vif(ar); - - if (!vif) { - rcu_read_unlock(); - return 0; - } - - basic = (vif->bss_conf.basic_rates & 0xf); - basic |= (vif->bss_conf.basic_rates & 0xff0) << 4; - rcu_read_unlock(); - - if (ar->hw->conf.chandef.chan->band == IEEE80211_BAND_5GHZ) - mandatory = 0xff00; /* OFDM 6/9/12/18/24/36/48/54 */ - else - mandatory = 0xff0f; /* OFDM (6/9../54) + CCK (1/2/5.5/11) */ - - carl9170_regwrite_begin(ar); - carl9170_regwrite(AR9170_MAC_REG_BASIC_RATE, basic); - carl9170_regwrite(AR9170_MAC_REG_MANDATORY_RATE, mandatory); - carl9170_regwrite_finish(); - - return carl9170_regwrite_result(); -} - -int carl9170_set_qos(struct ar9170 *ar) -{ - carl9170_regwrite_begin(ar); - - carl9170_regwrite(AR9170_MAC_REG_AC0_CW, ar->edcf[0].cw_min | - (ar->edcf[0].cw_max << 16)); - carl9170_regwrite(AR9170_MAC_REG_AC1_CW, ar->edcf[1].cw_min | - (ar->edcf[1].cw_max << 16)); - carl9170_regwrite(AR9170_MAC_REG_AC2_CW, ar->edcf[2].cw_min | - (ar->edcf[2].cw_max << 16)); - carl9170_regwrite(AR9170_MAC_REG_AC3_CW, ar->edcf[3].cw_min | - (ar->edcf[3].cw_max << 16)); - carl9170_regwrite(AR9170_MAC_REG_AC4_CW, ar->edcf[4].cw_min | - (ar->edcf[4].cw_max << 16)); - - carl9170_regwrite(AR9170_MAC_REG_AC2_AC1_AC0_AIFS, - ((ar->edcf[0].aifs * 9 + 10)) | - ((ar->edcf[1].aifs * 9 + 10) << 12) | - ((ar->edcf[2].aifs * 9 + 10) << 24)); - carl9170_regwrite(AR9170_MAC_REG_AC4_AC3_AC2_AIFS, - ((ar->edcf[2].aifs * 9 + 10) >> 8) | - ((ar->edcf[3].aifs * 9 + 10) << 4) | - ((ar->edcf[4].aifs * 9 + 10) << 16)); - - carl9170_regwrite(AR9170_MAC_REG_AC1_AC0_TXOP, - ar->edcf[0].txop | ar->edcf[1].txop << 16); - carl9170_regwrite(AR9170_MAC_REG_AC3_AC2_TXOP, - ar->edcf[2].txop | ar->edcf[3].txop << 16 | - ar->edcf[4].txop << 24); - - carl9170_regwrite_finish(); - - return carl9170_regwrite_result(); -} - -int carl9170_init_mac(struct ar9170 *ar) -{ - carl9170_regwrite_begin(ar); - - /* switch MAC to OTUS interface */ - carl9170_regwrite(0x1c3600, 0x3); - - carl9170_regwrite(AR9170_MAC_REG_ACK_EXTENSION, 0x40); - - carl9170_regwrite(AR9170_MAC_REG_RETRY_MAX, 0x0); - - carl9170_regwrite(AR9170_MAC_REG_FRAMETYPE_FILTER, - AR9170_MAC_FTF_MONITOR); - - /* enable MMIC */ - carl9170_regwrite(AR9170_MAC_REG_SNIFFER, - AR9170_MAC_SNIFFER_DEFAULTS); - - carl9170_regwrite(AR9170_MAC_REG_RX_THRESHOLD, 0xc1f80); - - carl9170_regwrite(AR9170_MAC_REG_RX_PE_DELAY, 0x70); - carl9170_regwrite(AR9170_MAC_REG_EIFS_AND_SIFS, 0xa144000); - carl9170_regwrite(AR9170_MAC_REG_SLOT_TIME, 9 << 10); - - /* CF-END & CF-ACK rate => 24M OFDM */ - carl9170_regwrite(AR9170_MAC_REG_TID_CFACK_CFEND_RATE, 0x59900000); - - /* NAV protects ACK only (in TXOP) */ - carl9170_regwrite(AR9170_MAC_REG_TXOP_DURATION, 0x201); - - /* Set Beacon PHY CTRL's TPC to 0x7, TA1=1 */ - /* OTUS set AM to 0x1 */ - carl9170_regwrite(AR9170_MAC_REG_BCN_HT1, 0x8000170); - - carl9170_regwrite(AR9170_MAC_REG_BACKOFF_PROTECT, 0x105); - - /* Aggregation MAX number and timeout */ - carl9170_regwrite(AR9170_MAC_REG_AMPDU_FACTOR, 0x8000a); - carl9170_regwrite(AR9170_MAC_REG_AMPDU_DENSITY, 0x140a07); - - carl9170_regwrite(AR9170_MAC_REG_FRAMETYPE_FILTER, - AR9170_MAC_FTF_DEFAULTS); - - carl9170_regwrite(AR9170_MAC_REG_RX_CONTROL, - AR9170_MAC_RX_CTRL_DEAGG | - AR9170_MAC_RX_CTRL_SHORT_FILTER); - - /* rate sets */ - carl9170_regwrite(AR9170_MAC_REG_BASIC_RATE, 0x150f); - carl9170_regwrite(AR9170_MAC_REG_MANDATORY_RATE, 0x150f); - carl9170_regwrite(AR9170_MAC_REG_RTS_CTS_RATE, 0x0030033); - - /* MIMO response control */ - carl9170_regwrite(AR9170_MAC_REG_ACK_TPC, 0x4003c1e); - - carl9170_regwrite(AR9170_MAC_REG_AMPDU_RX_THRESH, 0xffff); - - /* set PHY register read timeout (??) */ - carl9170_regwrite(AR9170_MAC_REG_MISC_680, 0xf00008); - - /* Disable Rx TimeOut, workaround for BB. */ - carl9170_regwrite(AR9170_MAC_REG_RX_TIMEOUT, 0x0); - - /* Set WLAN DMA interrupt mode: generate int per packet */ - carl9170_regwrite(AR9170_MAC_REG_TXRX_MPI, 0x110011); - - carl9170_regwrite(AR9170_MAC_REG_FCS_SELECT, - AR9170_MAC_FCS_FIFO_PROT); - - /* Disables the CF_END frame, undocumented register */ - carl9170_regwrite(AR9170_MAC_REG_TXOP_NOT_ENOUGH_IND, - 0x141e0f48); - - /* reset group hash table */ - carl9170_regwrite(AR9170_MAC_REG_GROUP_HASH_TBL_L, 0xffffffff); - carl9170_regwrite(AR9170_MAC_REG_GROUP_HASH_TBL_H, 0xffffffff); - - /* disable PRETBTT interrupt */ - carl9170_regwrite(AR9170_MAC_REG_PRETBTT, 0x0); - carl9170_regwrite(AR9170_MAC_REG_BCN_PERIOD, 0x0); - - carl9170_regwrite_finish(); - - return carl9170_regwrite_result(); -} - -static int carl9170_set_mac_reg(struct ar9170 *ar, - const u32 reg, const u8 *mac) -{ - static const u8 zero[ETH_ALEN] = { 0 }; - - if (!mac) - mac = zero; - - carl9170_regwrite_begin(ar); - - carl9170_regwrite(reg, get_unaligned_le32(mac)); - carl9170_regwrite(reg + 4, get_unaligned_le16(mac + 4)); - - carl9170_regwrite_finish(); - - return carl9170_regwrite_result(); -} - -int carl9170_mod_virtual_mac(struct ar9170 *ar, const unsigned int id, - const u8 *mac) -{ - if (WARN_ON(id >= ar->fw.vif_num)) - return -EINVAL; - - return carl9170_set_mac_reg(ar, - AR9170_MAC_REG_ACK_TABLE + (id - 1) * 8, mac); -} - -int carl9170_update_multicast(struct ar9170 *ar, const u64 mc_hash) -{ - int err; - - carl9170_regwrite_begin(ar); - carl9170_regwrite(AR9170_MAC_REG_GROUP_HASH_TBL_H, mc_hash >> 32); - carl9170_regwrite(AR9170_MAC_REG_GROUP_HASH_TBL_L, mc_hash); - carl9170_regwrite_finish(); - err = carl9170_regwrite_result(); - if (err) - return err; - - ar->cur_mc_hash = mc_hash; - return 0; -} - -int carl9170_set_operating_mode(struct ar9170 *ar) -{ - struct ieee80211_vif *vif; - struct ath_common *common = &ar->common; - u8 *mac_addr, *bssid; - u32 cam_mode = AR9170_MAC_CAM_DEFAULTS; - u32 enc_mode = AR9170_MAC_ENCRYPTION_DEFAULTS | - AR9170_MAC_ENCRYPTION_MGMT_RX_SOFTWARE; - u32 rx_ctrl = AR9170_MAC_RX_CTRL_DEAGG | - AR9170_MAC_RX_CTRL_SHORT_FILTER; - u32 sniffer = AR9170_MAC_SNIFFER_DEFAULTS; - int err = 0; - - rcu_read_lock(); - vif = carl9170_get_main_vif(ar); - - if (vif) { - mac_addr = common->macaddr; - bssid = common->curbssid; - - switch (vif->type) { - case NL80211_IFTYPE_ADHOC: - cam_mode |= AR9170_MAC_CAM_IBSS; - break; - case NL80211_IFTYPE_MESH_POINT: - case NL80211_IFTYPE_AP: - cam_mode |= AR9170_MAC_CAM_AP; - - /* iwlagn 802.11n STA Workaround */ - rx_ctrl |= AR9170_MAC_RX_CTRL_PASS_TO_HOST; - break; - case NL80211_IFTYPE_WDS: - cam_mode |= AR9170_MAC_CAM_AP_WDS; - rx_ctrl |= AR9170_MAC_RX_CTRL_PASS_TO_HOST; - break; - case NL80211_IFTYPE_STATION: - cam_mode |= AR9170_MAC_CAM_STA; - rx_ctrl |= AR9170_MAC_RX_CTRL_PASS_TO_HOST; - break; - default: - WARN(1, "Unsupported operation mode %x\n", vif->type); - err = -EOPNOTSUPP; - break; - } - } else { - /* - * Enable monitor mode - * - * rx_ctrl |= AR9170_MAC_RX_CTRL_ACK_IN_SNIFFER; - * sniffer |= AR9170_MAC_SNIFFER_ENABLE_PROMISC; - * - * When the hardware is in SNIFFER_PROMISC mode, - * it generates spurious ACKs for every incoming - * frame. This confuses every peer in the - * vicinity and the network throughput will suffer - * badly. - * - * Hence, the hardware will be put into station - * mode and just the rx filters are disabled. - */ - cam_mode |= AR9170_MAC_CAM_STA; - rx_ctrl |= AR9170_MAC_RX_CTRL_PASS_TO_HOST; - mac_addr = common->macaddr; - bssid = NULL; - } - rcu_read_unlock(); - - if (err) - return err; - - if (ar->rx_software_decryption) - enc_mode |= AR9170_MAC_ENCRYPTION_RX_SOFTWARE; - - if (ar->sniffer_enabled) { - enc_mode |= AR9170_MAC_ENCRYPTION_RX_SOFTWARE; - } - - err = carl9170_set_mac_reg(ar, AR9170_MAC_REG_MAC_ADDR_L, mac_addr); - if (err) - return err; - - err = carl9170_set_mac_reg(ar, AR9170_MAC_REG_BSSID_L, bssid); - if (err) - return err; - - carl9170_regwrite_begin(ar); - carl9170_regwrite(AR9170_MAC_REG_SNIFFER, sniffer); - carl9170_regwrite(AR9170_MAC_REG_CAM_MODE, cam_mode); - carl9170_regwrite(AR9170_MAC_REG_ENCRYPTION, enc_mode); - carl9170_regwrite(AR9170_MAC_REG_RX_CONTROL, rx_ctrl); - carl9170_regwrite_finish(); - - return carl9170_regwrite_result(); -} - -int carl9170_set_hwretry_limit(struct ar9170 *ar, const unsigned int max_retry) -{ - u32 tmp = min_t(u32, 0x33333, max_retry * 0x11111); - - return carl9170_write_reg(ar, AR9170_MAC_REG_RETRY_MAX, tmp); -} - -int carl9170_set_beacon_timers(struct ar9170 *ar) -{ - struct ieee80211_vif *vif; - u32 v = 0; - u32 pretbtt = 0; - - rcu_read_lock(); - vif = carl9170_get_main_vif(ar); - - if (vif) { - struct carl9170_vif_info *mvif; - mvif = (void *) vif->drv_priv; - - if (mvif->enable_beacon && !WARN_ON(!ar->beacon_enabled)) { - ar->global_beacon_int = vif->bss_conf.beacon_int / - ar->beacon_enabled; - - SET_VAL(AR9170_MAC_BCN_DTIM, v, - vif->bss_conf.dtim_period); - - switch (vif->type) { - case NL80211_IFTYPE_MESH_POINT: - case NL80211_IFTYPE_ADHOC: - v |= AR9170_MAC_BCN_IBSS_MODE; - break; - case NL80211_IFTYPE_AP: - v |= AR9170_MAC_BCN_AP_MODE; - break; - default: - WARN_ON_ONCE(1); - break; - } - } else if (vif->type == NL80211_IFTYPE_STATION) { - ar->global_beacon_int = vif->bss_conf.beacon_int; - - SET_VAL(AR9170_MAC_BCN_DTIM, v, - ar->hw->conf.ps_dtim_period); - - v |= AR9170_MAC_BCN_STA_PS | - AR9170_MAC_BCN_PWR_MGT; - } - - if (ar->global_beacon_int) { - if (ar->global_beacon_int < 15) { - rcu_read_unlock(); - return -ERANGE; - } - - ar->global_pretbtt = ar->global_beacon_int - - CARL9170_PRETBTT_KUS; - } else { - ar->global_pretbtt = 0; - } - } else { - ar->global_beacon_int = 0; - ar->global_pretbtt = 0; - } - - rcu_read_unlock(); - - SET_VAL(AR9170_MAC_BCN_PERIOD, v, ar->global_beacon_int); - SET_VAL(AR9170_MAC_PRETBTT, pretbtt, ar->global_pretbtt); - SET_VAL(AR9170_MAC_PRETBTT2, pretbtt, ar->global_pretbtt); - - carl9170_regwrite_begin(ar); - carl9170_regwrite(AR9170_MAC_REG_PRETBTT, pretbtt); - carl9170_regwrite(AR9170_MAC_REG_BCN_PERIOD, v); - carl9170_regwrite_finish(); - return carl9170_regwrite_result(); -} - -int carl9170_upload_key(struct ar9170 *ar, const u8 id, const u8 *mac, - const u8 ktype, const u8 keyidx, const u8 *keydata, - const int keylen) -{ - struct carl9170_set_key_cmd key = { }; - static const u8 bcast[ETH_ALEN] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - - mac = mac ? : bcast; - - key.user = cpu_to_le16(id); - key.keyId = cpu_to_le16(keyidx); - key.type = cpu_to_le16(ktype); - memcpy(&key.macAddr, mac, ETH_ALEN); - if (keydata) - memcpy(&key.key, keydata, keylen); - - return carl9170_exec_cmd(ar, CARL9170_CMD_EKEY, - sizeof(key), (u8 *)&key, 0, NULL); -} - -int carl9170_disable_key(struct ar9170 *ar, const u8 id) -{ - struct carl9170_disable_key_cmd key = { }; - - key.user = cpu_to_le16(id); - - return carl9170_exec_cmd(ar, CARL9170_CMD_DKEY, - sizeof(key), (u8 *)&key, 0, NULL); -} - -int carl9170_set_mac_tpc(struct ar9170 *ar, struct ieee80211_channel *channel) -{ - unsigned int power, chains; - - if (ar->eeprom.tx_mask != 1) - chains = AR9170_TX_PHY_TXCHAIN_2; - else - chains = AR9170_TX_PHY_TXCHAIN_1; - - switch (channel->band) { - case IEEE80211_BAND_2GHZ: - power = ar->power_2G_ofdm[0] & 0x3f; - break; - case IEEE80211_BAND_5GHZ: - power = ar->power_5G_leg[0] & 0x3f; - break; - default: - BUG_ON(1); - } - - power = min_t(unsigned int, power, ar->hw->conf.power_level * 2); - - carl9170_regwrite_begin(ar); - carl9170_regwrite(AR9170_MAC_REG_ACK_TPC, - 0x3c1e | power << 20 | chains << 26); - carl9170_regwrite(AR9170_MAC_REG_RTS_CTS_TPC, - power << 5 | chains << 11 | - power << 21 | chains << 27); - carl9170_regwrite(AR9170_MAC_REG_CFEND_QOSNULL_TPC, - power << 5 | chains << 11 | - power << 21 | chains << 27); - carl9170_regwrite_finish(); - return carl9170_regwrite_result(); -} diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c deleted file mode 100644 index 0686375a97b9..000000000000 --- a/drivers/net/wireless/ath/carl9170/main.c +++ /dev/null @@ -1,2130 +0,0 @@ -/* - * Atheros CARL9170 driver - * - * mac80211 interaction code - * - * Copyright 2008, Johannes Berg - * Copyright 2009, 2010, Christian Lamparter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "hw.h" -#include "carl9170.h" -#include "cmd.h" - -static bool modparam_nohwcrypt; -module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); -MODULE_PARM_DESC(nohwcrypt, "Disable hardware crypto offload."); - -int modparam_noht; -module_param_named(noht, modparam_noht, int, S_IRUGO); -MODULE_PARM_DESC(noht, "Disable MPDU aggregation."); - -#define RATE(_bitrate, _hw_rate, _txpidx, _flags) { \ - .bitrate = (_bitrate), \ - .flags = (_flags), \ - .hw_value = (_hw_rate) | (_txpidx) << 4, \ -} - -struct ieee80211_rate __carl9170_ratetable[] = { - RATE(10, 0, 0, 0), - RATE(20, 1, 1, IEEE80211_RATE_SHORT_PREAMBLE), - RATE(55, 2, 2, IEEE80211_RATE_SHORT_PREAMBLE), - RATE(110, 3, 3, IEEE80211_RATE_SHORT_PREAMBLE), - RATE(60, 0xb, 0, 0), - RATE(90, 0xf, 0, 0), - RATE(120, 0xa, 0, 0), - RATE(180, 0xe, 0, 0), - RATE(240, 0x9, 0, 0), - RATE(360, 0xd, 1, 0), - RATE(480, 0x8, 2, 0), - RATE(540, 0xc, 3, 0), -}; -#undef RATE - -#define carl9170_g_ratetable (__carl9170_ratetable + 0) -#define carl9170_g_ratetable_size 12 -#define carl9170_a_ratetable (__carl9170_ratetable + 4) -#define carl9170_a_ratetable_size 8 - -/* - * NB: The hw_value is used as an index into the carl9170_phy_freq_params - * array in phy.c so that we don't have to do frequency lookups! - */ -#define CHAN(_freq, _idx) { \ - .center_freq = (_freq), \ - .hw_value = (_idx), \ - .max_power = 18, /* XXX */ \ -} - -static struct ieee80211_channel carl9170_2ghz_chantable[] = { - CHAN(2412, 0), - CHAN(2417, 1), - CHAN(2422, 2), - CHAN(2427, 3), - CHAN(2432, 4), - CHAN(2437, 5), - CHAN(2442, 6), - CHAN(2447, 7), - CHAN(2452, 8), - CHAN(2457, 9), - CHAN(2462, 10), - CHAN(2467, 11), - CHAN(2472, 12), - CHAN(2484, 13), -}; - -static struct ieee80211_channel carl9170_5ghz_chantable[] = { - CHAN(4920, 14), - CHAN(4940, 15), - CHAN(4960, 16), - CHAN(4980, 17), - CHAN(5040, 18), - CHAN(5060, 19), - CHAN(5080, 20), - CHAN(5180, 21), - CHAN(5200, 22), - CHAN(5220, 23), - CHAN(5240, 24), - CHAN(5260, 25), - CHAN(5280, 26), - CHAN(5300, 27), - CHAN(5320, 28), - CHAN(5500, 29), - CHAN(5520, 30), - CHAN(5540, 31), - CHAN(5560, 32), - CHAN(5580, 33), - CHAN(5600, 34), - CHAN(5620, 35), - CHAN(5640, 36), - CHAN(5660, 37), - CHAN(5680, 38), - CHAN(5700, 39), - CHAN(5745, 40), - CHAN(5765, 41), - CHAN(5785, 42), - CHAN(5805, 43), - CHAN(5825, 44), - CHAN(5170, 45), - CHAN(5190, 46), - CHAN(5210, 47), - CHAN(5230, 48), -}; -#undef CHAN - -#define CARL9170_HT_CAP \ -{ \ - .ht_supported = true, \ - .cap = IEEE80211_HT_CAP_MAX_AMSDU | \ - IEEE80211_HT_CAP_SUP_WIDTH_20_40 | \ - IEEE80211_HT_CAP_SGI_40 | \ - IEEE80211_HT_CAP_DSSSCCK40 | \ - IEEE80211_HT_CAP_SM_PS, \ - .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, \ - .ampdu_density = IEEE80211_HT_MPDU_DENSITY_8, \ - .mcs = { \ - .rx_mask = { 0xff, 0xff, 0, 0, 0x1, 0, 0, 0, 0, 0, }, \ - .rx_highest = cpu_to_le16(300), \ - .tx_params = IEEE80211_HT_MCS_TX_DEFINED, \ - }, \ -} - -static struct ieee80211_supported_band carl9170_band_2GHz = { - .channels = carl9170_2ghz_chantable, - .n_channels = ARRAY_SIZE(carl9170_2ghz_chantable), - .bitrates = carl9170_g_ratetable, - .n_bitrates = carl9170_g_ratetable_size, - .ht_cap = CARL9170_HT_CAP, -}; - -static struct ieee80211_supported_band carl9170_band_5GHz = { - .channels = carl9170_5ghz_chantable, - .n_channels = ARRAY_SIZE(carl9170_5ghz_chantable), - .bitrates = carl9170_a_ratetable, - .n_bitrates = carl9170_a_ratetable_size, - .ht_cap = CARL9170_HT_CAP, -}; - -static void carl9170_ampdu_gc(struct ar9170 *ar) -{ - struct carl9170_sta_tid *tid_info; - LIST_HEAD(tid_gc); - - rcu_read_lock(); - list_for_each_entry_rcu(tid_info, &ar->tx_ampdu_list, list) { - spin_lock_bh(&ar->tx_ampdu_list_lock); - if (tid_info->state == CARL9170_TID_STATE_SHUTDOWN) { - tid_info->state = CARL9170_TID_STATE_KILLED; - list_del_rcu(&tid_info->list); - ar->tx_ampdu_list_len--; - list_add_tail(&tid_info->tmp_list, &tid_gc); - } - spin_unlock_bh(&ar->tx_ampdu_list_lock); - - } - rcu_assign_pointer(ar->tx_ampdu_iter, tid_info); - rcu_read_unlock(); - - synchronize_rcu(); - - while (!list_empty(&tid_gc)) { - struct sk_buff *skb; - tid_info = list_first_entry(&tid_gc, struct carl9170_sta_tid, - tmp_list); - - while ((skb = __skb_dequeue(&tid_info->queue))) - carl9170_tx_status(ar, skb, false); - - list_del_init(&tid_info->tmp_list); - kfree(tid_info); - } -} - -static void carl9170_flush(struct ar9170 *ar, bool drop_queued) -{ - if (drop_queued) { - int i; - - /* - * We can only drop frames which have not been uploaded - * to the device yet. - */ - - for (i = 0; i < ar->hw->queues; i++) { - struct sk_buff *skb; - - while ((skb = skb_dequeue(&ar->tx_pending[i]))) { - struct ieee80211_tx_info *info; - - info = IEEE80211_SKB_CB(skb); - if (info->flags & IEEE80211_TX_CTL_AMPDU) - atomic_dec(&ar->tx_ampdu_upload); - - carl9170_tx_status(ar, skb, false); - } - } - } - - /* Wait for all other outstanding frames to timeout. */ - if (atomic_read(&ar->tx_total_queued)) - WARN_ON(wait_for_completion_timeout(&ar->tx_flush, HZ) == 0); -} - -static void carl9170_flush_ba(struct ar9170 *ar) -{ - struct sk_buff_head free; - struct carl9170_sta_tid *tid_info; - struct sk_buff *skb; - - __skb_queue_head_init(&free); - - rcu_read_lock(); - spin_lock_bh(&ar->tx_ampdu_list_lock); - list_for_each_entry_rcu(tid_info, &ar->tx_ampdu_list, list) { - if (tid_info->state > CARL9170_TID_STATE_SUSPEND) { - tid_info->state = CARL9170_TID_STATE_SUSPEND; - - spin_lock(&tid_info->lock); - while ((skb = __skb_dequeue(&tid_info->queue))) - __skb_queue_tail(&free, skb); - spin_unlock(&tid_info->lock); - } - } - spin_unlock_bh(&ar->tx_ampdu_list_lock); - rcu_read_unlock(); - - while ((skb = __skb_dequeue(&free))) - carl9170_tx_status(ar, skb, false); -} - -static void carl9170_zap_queues(struct ar9170 *ar) -{ - struct carl9170_vif_info *cvif; - unsigned int i; - - carl9170_ampdu_gc(ar); - - carl9170_flush_ba(ar); - carl9170_flush(ar, true); - - for (i = 0; i < ar->hw->queues; i++) { - spin_lock_bh(&ar->tx_status[i].lock); - while (!skb_queue_empty(&ar->tx_status[i])) { - struct sk_buff *skb; - - skb = skb_peek(&ar->tx_status[i]); - carl9170_tx_get_skb(skb); - spin_unlock_bh(&ar->tx_status[i].lock); - carl9170_tx_drop(ar, skb); - spin_lock_bh(&ar->tx_status[i].lock); - carl9170_tx_put_skb(skb); - } - spin_unlock_bh(&ar->tx_status[i].lock); - } - - BUILD_BUG_ON(CARL9170_NUM_TX_LIMIT_SOFT < 1); - BUILD_BUG_ON(CARL9170_NUM_TX_LIMIT_HARD < CARL9170_NUM_TX_LIMIT_SOFT); - BUILD_BUG_ON(CARL9170_NUM_TX_LIMIT_HARD >= CARL9170_BAW_BITS); - - /* reinitialize queues statistics */ - memset(&ar->tx_stats, 0, sizeof(ar->tx_stats)); - for (i = 0; i < ar->hw->queues; i++) - ar->tx_stats[i].limit = CARL9170_NUM_TX_LIMIT_HARD; - - for (i = 0; i < DIV_ROUND_UP(ar->fw.mem_blocks, BITS_PER_LONG); i++) - ar->mem_bitmap[i] = 0; - - rcu_read_lock(); - list_for_each_entry_rcu(cvif, &ar->vif_list, list) { - spin_lock_bh(&ar->beacon_lock); - dev_kfree_skb_any(cvif->beacon); - cvif->beacon = NULL; - spin_unlock_bh(&ar->beacon_lock); - } - rcu_read_unlock(); - - atomic_set(&ar->tx_ampdu_upload, 0); - atomic_set(&ar->tx_ampdu_scheduler, 0); - atomic_set(&ar->tx_total_pending, 0); - atomic_set(&ar->tx_total_queued, 0); - atomic_set(&ar->mem_free_blocks, ar->fw.mem_blocks); -} - -#define CARL9170_FILL_QUEUE(queue, ai_fs, cwmin, cwmax, _txop) \ -do { \ - queue.aifs = ai_fs; \ - queue.cw_min = cwmin; \ - queue.cw_max = cwmax; \ - queue.txop = _txop; \ -} while (0) - -static int carl9170_op_start(struct ieee80211_hw *hw) -{ - struct ar9170 *ar = hw->priv; - int err, i; - - mutex_lock(&ar->mutex); - - carl9170_zap_queues(ar); - - /* reset QoS defaults */ - CARL9170_FILL_QUEUE(ar->edcf[AR9170_TXQ_VO], 2, 3, 7, 47); - CARL9170_FILL_QUEUE(ar->edcf[AR9170_TXQ_VI], 2, 7, 15, 94); - CARL9170_FILL_QUEUE(ar->edcf[AR9170_TXQ_BE], 3, 15, 1023, 0); - CARL9170_FILL_QUEUE(ar->edcf[AR9170_TXQ_BK], 7, 15, 1023, 0); - CARL9170_FILL_QUEUE(ar->edcf[AR9170_TXQ_SPECIAL], 2, 3, 7, 0); - - ar->current_factor = ar->current_density = -1; - /* "The first key is unique." */ - ar->usedkeys = 1; - ar->filter_state = 0; - ar->ps.last_action = jiffies; - ar->ps.last_slept = jiffies; - ar->erp_mode = CARL9170_ERP_AUTO; - - /* Set "disable hw crypto offload" whenever the module parameter - * nohwcrypt is true or if the firmware does not support it. - */ - ar->disable_offload = modparam_nohwcrypt | - ar->fw.disable_offload_fw; - ar->rx_software_decryption = ar->disable_offload; - - for (i = 0; i < ar->hw->queues; i++) { - ar->queue_stop_timeout[i] = jiffies; - ar->max_queue_stop_timeout[i] = 0; - } - - atomic_set(&ar->mem_allocs, 0); - - err = carl9170_usb_open(ar); - if (err) - goto out; - - err = carl9170_init_mac(ar); - if (err) - goto out; - - err = carl9170_set_qos(ar); - if (err) - goto out; - - if (ar->fw.rx_filter) { - err = carl9170_rx_filter(ar, CARL9170_RX_FILTER_OTHER_RA | - CARL9170_RX_FILTER_CTL_OTHER | CARL9170_RX_FILTER_BAD); - if (err) - goto out; - } - - err = carl9170_write_reg(ar, AR9170_MAC_REG_DMA_TRIGGER, - AR9170_DMA_TRIGGER_RXQ); - if (err) - goto out; - - /* Clear key-cache */ - for (i = 0; i < AR9170_CAM_MAX_USER + 4; i++) { - err = carl9170_upload_key(ar, i, NULL, AR9170_ENC_ALG_NONE, - 0, NULL, 0); - if (err) - goto out; - - err = carl9170_upload_key(ar, i, NULL, AR9170_ENC_ALG_NONE, - 1, NULL, 0); - if (err) - goto out; - - if (i < AR9170_CAM_MAX_USER) { - err = carl9170_disable_key(ar, i); - if (err) - goto out; - } - } - - carl9170_set_state_when(ar, CARL9170_IDLE, CARL9170_STARTED); - - ieee80211_queue_delayed_work(ar->hw, &ar->stat_work, - round_jiffies(msecs_to_jiffies(CARL9170_STAT_WORK))); - - ieee80211_wake_queues(ar->hw); - err = 0; - -out: - mutex_unlock(&ar->mutex); - return err; -} - -static void carl9170_cancel_worker(struct ar9170 *ar) -{ - cancel_delayed_work_sync(&ar->stat_work); - cancel_delayed_work_sync(&ar->tx_janitor); -#ifdef CONFIG_CARL9170_LEDS - cancel_delayed_work_sync(&ar->led_work); -#endif /* CONFIG_CARL9170_LEDS */ - cancel_work_sync(&ar->ps_work); - cancel_work_sync(&ar->ping_work); - cancel_work_sync(&ar->ampdu_work); -} - -static void carl9170_op_stop(struct ieee80211_hw *hw) -{ - struct ar9170 *ar = hw->priv; - - carl9170_set_state_when(ar, CARL9170_STARTED, CARL9170_IDLE); - - ieee80211_stop_queues(ar->hw); - - mutex_lock(&ar->mutex); - if (IS_ACCEPTING_CMD(ar)) { - RCU_INIT_POINTER(ar->beacon_iter, NULL); - - carl9170_led_set_state(ar, 0); - - /* stop DMA */ - carl9170_write_reg(ar, AR9170_MAC_REG_DMA_TRIGGER, 0); - carl9170_usb_stop(ar); - } - - carl9170_zap_queues(ar); - mutex_unlock(&ar->mutex); - - carl9170_cancel_worker(ar); -} - -static void carl9170_restart_work(struct work_struct *work) -{ - struct ar9170 *ar = container_of(work, struct ar9170, - restart_work); - int err = -EIO; - - ar->usedkeys = 0; - ar->filter_state = 0; - carl9170_cancel_worker(ar); - - mutex_lock(&ar->mutex); - if (!ar->force_usb_reset) { - err = carl9170_usb_restart(ar); - if (net_ratelimit()) { - if (err) - dev_err(&ar->udev->dev, "Failed to restart device (%d).\n", err); - else - dev_info(&ar->udev->dev, "device restarted successfully.\n"); - } - } - carl9170_zap_queues(ar); - mutex_unlock(&ar->mutex); - - if (!err && !ar->force_usb_reset) { - ar->restart_counter++; - atomic_set(&ar->pending_restarts, 0); - - ieee80211_restart_hw(ar->hw); - } else { - /* - * The reset was unsuccessful and the device seems to - * be dead. But there's still one option: a low-level - * usb subsystem reset... - */ - - carl9170_usb_reset(ar); - } -} - -void carl9170_restart(struct ar9170 *ar, const enum carl9170_restart_reasons r) -{ - carl9170_set_state_when(ar, CARL9170_STARTED, CARL9170_IDLE); - - /* - * Sometimes, an error can trigger several different reset events. - * By ignoring these *surplus* reset events, the device won't be - * killed again, right after it has recovered. - */ - if (atomic_inc_return(&ar->pending_restarts) > 1) { - dev_dbg(&ar->udev->dev, "ignoring restart (%d)\n", r); - return; - } - - ieee80211_stop_queues(ar->hw); - - dev_err(&ar->udev->dev, "restart device (%d)\n", r); - - if (!WARN_ON(r == CARL9170_RR_NO_REASON) || - !WARN_ON(r >= __CARL9170_RR_LAST)) - ar->last_reason = r; - - if (!ar->registered) - return; - - if (!IS_ACCEPTING_CMD(ar) || ar->needs_full_reset) - ar->force_usb_reset = true; - - ieee80211_queue_work(ar->hw, &ar->restart_work); - - /* - * At this point, the device instance might have vanished/disabled. - * So, don't put any code which access the ar9170 struct - * without proper protection. - */ -} - -static void carl9170_ping_work(struct work_struct *work) -{ - struct ar9170 *ar = container_of(work, struct ar9170, ping_work); - int err; - - if (!IS_STARTED(ar)) - return; - - mutex_lock(&ar->mutex); - err = carl9170_echo_test(ar, 0xdeadbeef); - if (err) - carl9170_restart(ar, CARL9170_RR_UNRESPONSIVE_DEVICE); - mutex_unlock(&ar->mutex); -} - -static int carl9170_init_interface(struct ar9170 *ar, - struct ieee80211_vif *vif) -{ - struct ath_common *common = &ar->common; - int err; - - if (!vif) { - WARN_ON_ONCE(IS_STARTED(ar)); - return 0; - } - - memcpy(common->macaddr, vif->addr, ETH_ALEN); - - /* We have to fall back to software crypto, whenever - * the user choose to participates in an IBSS. HW - * offload for IBSS RSN is not supported by this driver. - * - * NOTE: If the previous main interface has already - * disabled hw crypto offload, we have to keep this - * previous disable_offload setting as it was. - * Altough ideally, we should notify mac80211 and tell - * it to forget about any HW crypto offload for now. - */ - ar->disable_offload |= ((vif->type != NL80211_IFTYPE_STATION) && - (vif->type != NL80211_IFTYPE_AP)); - - /* While the driver supports HW offload in a single - * P2P client configuration, it doesn't support HW - * offload in the favourit, concurrent P2P GO+CLIENT - * configuration. Hence, HW offload will always be - * disabled for P2P. - */ - ar->disable_offload |= vif->p2p; - - ar->rx_software_decryption = ar->disable_offload; - - err = carl9170_set_operating_mode(ar); - return err; -} - -static int carl9170_op_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct carl9170_vif_info *vif_priv = (void *) vif->drv_priv; - struct ieee80211_vif *main_vif, *old_main = NULL; - struct ar9170 *ar = hw->priv; - int vif_id = -1, err = 0; - - mutex_lock(&ar->mutex); - rcu_read_lock(); - if (vif_priv->active) { - /* - * Skip the interface structure initialization, - * if the vif survived the _restart call. - */ - vif_id = vif_priv->id; - vif_priv->enable_beacon = false; - - spin_lock_bh(&ar->beacon_lock); - dev_kfree_skb_any(vif_priv->beacon); - vif_priv->beacon = NULL; - spin_unlock_bh(&ar->beacon_lock); - - goto init; - } - - /* Because the AR9170 HW's MAC doesn't provide full support for - * multiple, independent interfaces [of different operation modes]. - * We have to select ONE main interface [main mode of HW], but we - * can have multiple slaves [AKA: entry in the ACK-table]. - * - * The first (from HEAD/TOP) interface in the ar->vif_list is - * always the main intf. All following intfs in this list - * are considered to be slave intfs. - */ - main_vif = carl9170_get_main_vif(ar); - - if (main_vif) { - switch (main_vif->type) { - case NL80211_IFTYPE_STATION: - if (vif->type == NL80211_IFTYPE_STATION) - break; - - /* P2P GO [master] use-case - * Because the P2P GO station is selected dynamically - * by all participating peers of a WIFI Direct network, - * the driver has be able to change the main interface - * operating mode on the fly. - */ - if (main_vif->p2p && vif->p2p && - vif->type == NL80211_IFTYPE_AP) { - old_main = main_vif; - break; - } - - err = -EBUSY; - rcu_read_unlock(); - - goto unlock; - - case NL80211_IFTYPE_MESH_POINT: - case NL80211_IFTYPE_AP: - if ((vif->type == NL80211_IFTYPE_STATION) || - (vif->type == NL80211_IFTYPE_WDS) || - (vif->type == NL80211_IFTYPE_AP) || - (vif->type == NL80211_IFTYPE_MESH_POINT)) - break; - - err = -EBUSY; - rcu_read_unlock(); - goto unlock; - - default: - rcu_read_unlock(); - goto unlock; - } - } - - vif_id = bitmap_find_free_region(&ar->vif_bitmap, ar->fw.vif_num, 0); - - if (vif_id < 0) { - rcu_read_unlock(); - - err = -ENOSPC; - goto unlock; - } - - BUG_ON(ar->vif_priv[vif_id].id != vif_id); - - vif_priv->active = true; - vif_priv->id = vif_id; - vif_priv->enable_beacon = false; - ar->vifs++; - if (old_main) { - /* We end up in here, if the main interface is being replaced. - * Put the new main interface at the HEAD of the list and the - * previous inteface will automatically become second in line. - */ - list_add_rcu(&vif_priv->list, &ar->vif_list); - } else { - /* Add new inteface. If the list is empty, it will become the - * main inteface, otherwise it will be slave. - */ - list_add_tail_rcu(&vif_priv->list, &ar->vif_list); - } - rcu_assign_pointer(ar->vif_priv[vif_id].vif, vif); - -init: - main_vif = carl9170_get_main_vif(ar); - - if (main_vif == vif) { - rcu_assign_pointer(ar->beacon_iter, vif_priv); - rcu_read_unlock(); - - if (old_main) { - struct carl9170_vif_info *old_main_priv = - (void *) old_main->drv_priv; - /* downgrade old main intf to slave intf. - * NOTE: We are no longer under rcu_read_lock. - * But we are still holding ar->mutex, so the - * vif data [id, addr] is safe. - */ - err = carl9170_mod_virtual_mac(ar, old_main_priv->id, - old_main->addr); - if (err) - goto unlock; - } - - err = carl9170_init_interface(ar, vif); - if (err) - goto unlock; - } else { - rcu_read_unlock(); - err = carl9170_mod_virtual_mac(ar, vif_id, vif->addr); - - if (err) - goto unlock; - } - - if (ar->fw.tx_seq_table) { - err = carl9170_write_reg(ar, ar->fw.tx_seq_table + vif_id * 4, - 0); - if (err) - goto unlock; - } - -unlock: - if (err && (vif_id >= 0)) { - vif_priv->active = false; - bitmap_release_region(&ar->vif_bitmap, vif_id, 0); - ar->vifs--; - RCU_INIT_POINTER(ar->vif_priv[vif_id].vif, NULL); - list_del_rcu(&vif_priv->list); - mutex_unlock(&ar->mutex); - synchronize_rcu(); - } else { - if (ar->vifs > 1) - ar->ps.off_override |= PS_OFF_VIF; - - mutex_unlock(&ar->mutex); - } - - return err; -} - -static void carl9170_op_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct carl9170_vif_info *vif_priv = (void *) vif->drv_priv; - struct ieee80211_vif *main_vif; - struct ar9170 *ar = hw->priv; - unsigned int id; - - mutex_lock(&ar->mutex); - - if (WARN_ON_ONCE(!vif_priv->active)) - goto unlock; - - ar->vifs--; - - rcu_read_lock(); - main_vif = carl9170_get_main_vif(ar); - - id = vif_priv->id; - - vif_priv->active = false; - WARN_ON(vif_priv->enable_beacon); - vif_priv->enable_beacon = false; - list_del_rcu(&vif_priv->list); - RCU_INIT_POINTER(ar->vif_priv[id].vif, NULL); - - if (vif == main_vif) { - rcu_read_unlock(); - - if (ar->vifs) { - WARN_ON(carl9170_init_interface(ar, - carl9170_get_main_vif(ar))); - } else { - carl9170_set_operating_mode(ar); - } - } else { - rcu_read_unlock(); - - WARN_ON(carl9170_mod_virtual_mac(ar, id, NULL)); - } - - carl9170_update_beacon(ar, false); - carl9170_flush_cab(ar, id); - - spin_lock_bh(&ar->beacon_lock); - dev_kfree_skb_any(vif_priv->beacon); - vif_priv->beacon = NULL; - spin_unlock_bh(&ar->beacon_lock); - - bitmap_release_region(&ar->vif_bitmap, id, 0); - - carl9170_set_beacon_timers(ar); - - if (ar->vifs == 1) - ar->ps.off_override &= ~PS_OFF_VIF; - -unlock: - mutex_unlock(&ar->mutex); - - synchronize_rcu(); -} - -void carl9170_ps_check(struct ar9170 *ar) -{ - ieee80211_queue_work(ar->hw, &ar->ps_work); -} - -/* caller must hold ar->mutex */ -static int carl9170_ps_update(struct ar9170 *ar) -{ - bool ps = false; - int err = 0; - - if (!ar->ps.off_override) - ps = (ar->hw->conf.flags & IEEE80211_CONF_PS); - - if (ps != ar->ps.state) { - err = carl9170_powersave(ar, ps); - if (err) - return err; - - if (ar->ps.state && !ps) { - ar->ps.sleep_ms = jiffies_to_msecs(jiffies - - ar->ps.last_action); - } - - if (ps) - ar->ps.last_slept = jiffies; - - ar->ps.last_action = jiffies; - ar->ps.state = ps; - } - - return 0; -} - -static void carl9170_ps_work(struct work_struct *work) -{ - struct ar9170 *ar = container_of(work, struct ar9170, - ps_work); - mutex_lock(&ar->mutex); - if (IS_STARTED(ar)) - WARN_ON_ONCE(carl9170_ps_update(ar) != 0); - mutex_unlock(&ar->mutex); -} - -static int carl9170_update_survey(struct ar9170 *ar, bool flush, bool noise) -{ - int err; - - if (noise) { - err = carl9170_get_noisefloor(ar); - if (err) - return err; - } - - if (ar->fw.hw_counters) { - err = carl9170_collect_tally(ar); - if (err) - return err; - } - - if (flush) - memset(&ar->tally, 0, sizeof(ar->tally)); - - return 0; -} - -static void carl9170_stat_work(struct work_struct *work) -{ - struct ar9170 *ar = container_of(work, struct ar9170, stat_work.work); - int err; - - mutex_lock(&ar->mutex); - err = carl9170_update_survey(ar, false, true); - mutex_unlock(&ar->mutex); - - if (err) - return; - - ieee80211_queue_delayed_work(ar->hw, &ar->stat_work, - round_jiffies(msecs_to_jiffies(CARL9170_STAT_WORK))); -} - -static int carl9170_op_config(struct ieee80211_hw *hw, u32 changed) -{ - struct ar9170 *ar = hw->priv; - int err = 0; - - mutex_lock(&ar->mutex); - if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { - /* TODO */ - err = 0; - } - - if (changed & IEEE80211_CONF_CHANGE_PS) { - err = carl9170_ps_update(ar); - if (err) - goto out; - } - - if (changed & IEEE80211_CONF_CHANGE_SMPS) { - /* TODO */ - err = 0; - } - - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { - enum nl80211_channel_type channel_type = - cfg80211_get_chandef_type(&hw->conf.chandef); - - /* adjust slot time for 5 GHz */ - err = carl9170_set_slot_time(ar); - if (err) - goto out; - - err = carl9170_update_survey(ar, true, false); - if (err) - goto out; - - err = carl9170_set_channel(ar, hw->conf.chandef.chan, - channel_type); - if (err) - goto out; - - err = carl9170_update_survey(ar, false, true); - if (err) - goto out; - - err = carl9170_set_dyn_sifs_ack(ar); - if (err) - goto out; - - err = carl9170_set_rts_cts_rate(ar); - if (err) - goto out; - } - - if (changed & IEEE80211_CONF_CHANGE_POWER) { - err = carl9170_set_mac_tpc(ar, ar->hw->conf.chandef.chan); - if (err) - goto out; - } - -out: - mutex_unlock(&ar->mutex); - return err; -} - -static u64 carl9170_op_prepare_multicast(struct ieee80211_hw *hw, - struct netdev_hw_addr_list *mc_list) -{ - struct netdev_hw_addr *ha; - u64 mchash; - - /* always get broadcast frames */ - mchash = 1ULL << (0xff >> 2); - - netdev_hw_addr_list_for_each(ha, mc_list) - mchash |= 1ULL << (ha->addr[5] >> 2); - - return mchash; -} - -static void carl9170_op_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *new_flags, - u64 multicast) -{ - struct ar9170 *ar = hw->priv; - - /* mask supported flags */ - *new_flags &= FIF_ALLMULTI | ar->rx_filter_caps; - - if (!IS_ACCEPTING_CMD(ar)) - return; - - mutex_lock(&ar->mutex); - - ar->filter_state = *new_flags; - /* - * We can support more by setting the sniffer bit and - * then checking the error flags, later. - */ - - if (*new_flags & FIF_ALLMULTI) - multicast = ~0ULL; - - if (multicast != ar->cur_mc_hash) - WARN_ON(carl9170_update_multicast(ar, multicast)); - - if (changed_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) { - ar->sniffer_enabled = !!(*new_flags & - (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)); - - WARN_ON(carl9170_set_operating_mode(ar)); - } - - if (ar->fw.rx_filter && changed_flags & ar->rx_filter_caps) { - u32 rx_filter = 0; - - if (!ar->fw.ba_filter) - rx_filter |= CARL9170_RX_FILTER_CTL_OTHER; - - if (!(*new_flags & (FIF_FCSFAIL | FIF_PLCPFAIL))) - rx_filter |= CARL9170_RX_FILTER_BAD; - - if (!(*new_flags & FIF_CONTROL)) - rx_filter |= CARL9170_RX_FILTER_CTL_OTHER; - - if (!(*new_flags & FIF_PSPOLL)) - rx_filter |= CARL9170_RX_FILTER_CTL_PSPOLL; - - if (!(*new_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS))) { - rx_filter |= CARL9170_RX_FILTER_OTHER_RA; - rx_filter |= CARL9170_RX_FILTER_DECRY_FAIL; - } - - WARN_ON(carl9170_rx_filter(ar, rx_filter)); - } - - mutex_unlock(&ar->mutex); -} - - -static void carl9170_op_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changed) -{ - struct ar9170 *ar = hw->priv; - struct ath_common *common = &ar->common; - int err = 0; - struct carl9170_vif_info *vif_priv; - struct ieee80211_vif *main_vif; - - mutex_lock(&ar->mutex); - vif_priv = (void *) vif->drv_priv; - main_vif = carl9170_get_main_vif(ar); - if (WARN_ON(!main_vif)) - goto out; - - if (changed & BSS_CHANGED_BEACON_ENABLED) { - struct carl9170_vif_info *iter; - int i = 0; - - vif_priv->enable_beacon = bss_conf->enable_beacon; - rcu_read_lock(); - list_for_each_entry_rcu(iter, &ar->vif_list, list) { - if (iter->active && iter->enable_beacon) - i++; - - } - rcu_read_unlock(); - - ar->beacon_enabled = i; - } - - if (changed & BSS_CHANGED_BEACON) { - err = carl9170_update_beacon(ar, false); - if (err) - goto out; - } - - if (changed & (BSS_CHANGED_BEACON_ENABLED | BSS_CHANGED_BEACON | - BSS_CHANGED_BEACON_INT)) { - - if (main_vif != vif) { - bss_conf->beacon_int = main_vif->bss_conf.beacon_int; - bss_conf->dtim_period = main_vif->bss_conf.dtim_period; - } - - /* - * Therefore a hard limit for the broadcast traffic should - * prevent false alarms. - */ - if (vif->type != NL80211_IFTYPE_STATION && - (bss_conf->beacon_int * bss_conf->dtim_period >= - (CARL9170_QUEUE_STUCK_TIMEOUT / 2))) { - err = -EINVAL; - goto out; - } - - err = carl9170_set_beacon_timers(ar); - if (err) - goto out; - } - - if (changed & BSS_CHANGED_HT) { - /* TODO */ - err = 0; - if (err) - goto out; - } - - if (main_vif != vif) - goto out; - - /* - * The following settings can only be changed by the - * master interface. - */ - - if (changed & BSS_CHANGED_BSSID) { - memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); - err = carl9170_set_operating_mode(ar); - if (err) - goto out; - } - - if (changed & BSS_CHANGED_ASSOC) { - ar->common.curaid = bss_conf->aid; - err = carl9170_set_beacon_timers(ar); - if (err) - goto out; - } - - if (changed & BSS_CHANGED_ERP_SLOT) { - err = carl9170_set_slot_time(ar); - if (err) - goto out; - } - - if (changed & BSS_CHANGED_BASIC_RATES) { - err = carl9170_set_mac_rates(ar); - if (err) - goto out; - } - -out: - WARN_ON_ONCE(err && IS_STARTED(ar)); - mutex_unlock(&ar->mutex); -} - -static u64 carl9170_op_get_tsf(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ar9170 *ar = hw->priv; - struct carl9170_tsf_rsp tsf; - int err; - - mutex_lock(&ar->mutex); - err = carl9170_exec_cmd(ar, CARL9170_CMD_READ_TSF, - 0, NULL, sizeof(tsf), &tsf); - mutex_unlock(&ar->mutex); - if (WARN_ON(err)) - return 0; - - return le64_to_cpu(tsf.tsf_64); -} - -static int carl9170_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct ar9170 *ar = hw->priv; - int err = 0, i; - u8 ktype; - - if (ar->disable_offload || !vif) - return -EOPNOTSUPP; - - /* Fall back to software encryption whenever the driver is connected - * to more than one network. - * - * This is very unfortunate, because some machines cannot handle - * the high througput speed in 802.11n networks. - */ - - if (!is_main_vif(ar, vif)) { - mutex_lock(&ar->mutex); - goto err_softw; - } - - /* - * While the hardware supports *catch-all* key, for offloading - * group-key en-/de-cryption. The way of how the hardware - * decides which keyId maps to which key, remains a mystery... - */ - if ((vif->type != NL80211_IFTYPE_STATION && - vif->type != NL80211_IFTYPE_ADHOC) && - !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) - return -EOPNOTSUPP; - - switch (key->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - ktype = AR9170_ENC_ALG_WEP64; - break; - case WLAN_CIPHER_SUITE_WEP104: - ktype = AR9170_ENC_ALG_WEP128; - break; - case WLAN_CIPHER_SUITE_TKIP: - ktype = AR9170_ENC_ALG_TKIP; - break; - case WLAN_CIPHER_SUITE_CCMP: - ktype = AR9170_ENC_ALG_AESCCMP; - key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; - break; - default: - return -EOPNOTSUPP; - } - - mutex_lock(&ar->mutex); - if (cmd == SET_KEY) { - if (!IS_STARTED(ar)) { - err = -EOPNOTSUPP; - goto out; - } - - if (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { - sta = NULL; - - i = 64 + key->keyidx; - } else { - for (i = 0; i < 64; i++) - if (!(ar->usedkeys & BIT(i))) - break; - if (i == 64) - goto err_softw; - } - - key->hw_key_idx = i; - - err = carl9170_upload_key(ar, i, sta ? sta->addr : NULL, - ktype, 0, key->key, - min_t(u8, 16, key->keylen)); - if (err) - goto out; - - if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { - err = carl9170_upload_key(ar, i, sta ? sta->addr : - NULL, ktype, 1, - key->key + 16, 16); - if (err) - goto out; - - /* - * hardware is not capable generating MMIC - * of fragmented frames! - */ - key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; - } - - if (i < 64) - ar->usedkeys |= BIT(i); - - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - } else { - if (!IS_STARTED(ar)) { - /* The device is gone... together with the key ;-) */ - err = 0; - goto out; - } - - if (key->hw_key_idx < 64) { - ar->usedkeys &= ~BIT(key->hw_key_idx); - } else { - err = carl9170_upload_key(ar, key->hw_key_idx, NULL, - AR9170_ENC_ALG_NONE, 0, - NULL, 0); - if (err) - goto out; - - if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { - err = carl9170_upload_key(ar, key->hw_key_idx, - NULL, - AR9170_ENC_ALG_NONE, - 1, NULL, 0); - if (err) - goto out; - } - - } - - err = carl9170_disable_key(ar, key->hw_key_idx); - if (err) - goto out; - } - -out: - mutex_unlock(&ar->mutex); - return err; - -err_softw: - if (!ar->rx_software_decryption) { - ar->rx_software_decryption = true; - carl9170_set_operating_mode(ar); - } - mutex_unlock(&ar->mutex); - return -ENOSPC; -} - -static int carl9170_op_sta_add(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct carl9170_sta_info *sta_info = (void *) sta->drv_priv; - unsigned int i; - - atomic_set(&sta_info->pending_frames, 0); - - if (sta->ht_cap.ht_supported) { - if (sta->ht_cap.ampdu_density > 6) { - /* - * HW does support 16us AMPDU density. - * No HT-Xmit for station. - */ - - return 0; - } - - for (i = 0; i < ARRAY_SIZE(sta_info->agg); i++) - RCU_INIT_POINTER(sta_info->agg[i], NULL); - - sta_info->ampdu_max_len = 1 << (3 + sta->ht_cap.ampdu_factor); - sta_info->ht_sta = true; - } - - return 0; -} - -static int carl9170_op_sta_remove(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct ar9170 *ar = hw->priv; - struct carl9170_sta_info *sta_info = (void *) sta->drv_priv; - unsigned int i; - bool cleanup = false; - - if (sta->ht_cap.ht_supported) { - - sta_info->ht_sta = false; - - rcu_read_lock(); - for (i = 0; i < ARRAY_SIZE(sta_info->agg); i++) { - struct carl9170_sta_tid *tid_info; - - tid_info = rcu_dereference(sta_info->agg[i]); - RCU_INIT_POINTER(sta_info->agg[i], NULL); - - if (!tid_info) - continue; - - spin_lock_bh(&ar->tx_ampdu_list_lock); - if (tid_info->state > CARL9170_TID_STATE_SHUTDOWN) - tid_info->state = CARL9170_TID_STATE_SHUTDOWN; - spin_unlock_bh(&ar->tx_ampdu_list_lock); - cleanup = true; - } - rcu_read_unlock(); - - if (cleanup) - carl9170_ampdu_gc(ar); - } - - return 0; -} - -static int carl9170_op_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *param) -{ - struct ar9170 *ar = hw->priv; - int ret; - - mutex_lock(&ar->mutex); - if (queue < ar->hw->queues) { - memcpy(&ar->edcf[ar9170_qmap[queue]], param, sizeof(*param)); - ret = carl9170_set_qos(ar); - } else { - ret = -EINVAL; - } - - mutex_unlock(&ar->mutex); - return ret; -} - -static void carl9170_ampdu_work(struct work_struct *work) -{ - struct ar9170 *ar = container_of(work, struct ar9170, - ampdu_work); - - if (!IS_STARTED(ar)) - return; - - mutex_lock(&ar->mutex); - carl9170_ampdu_gc(ar); - mutex_unlock(&ar->mutex); -} - -static int carl9170_op_ampdu_action(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, - u16 tid, u16 *ssn, u8 buf_size) -{ - struct ar9170 *ar = hw->priv; - struct carl9170_sta_info *sta_info = (void *) sta->drv_priv; - struct carl9170_sta_tid *tid_info; - - if (modparam_noht) - return -EOPNOTSUPP; - - switch (action) { - case IEEE80211_AMPDU_TX_START: - if (!sta_info->ht_sta) - return -EOPNOTSUPP; - - rcu_read_lock(); - if (rcu_dereference(sta_info->agg[tid])) { - rcu_read_unlock(); - return -EBUSY; - } - - tid_info = kzalloc(sizeof(struct carl9170_sta_tid), - GFP_ATOMIC); - if (!tid_info) { - rcu_read_unlock(); - return -ENOMEM; - } - - tid_info->hsn = tid_info->bsn = tid_info->snx = (*ssn); - tid_info->state = CARL9170_TID_STATE_PROGRESS; - tid_info->tid = tid; - tid_info->max = sta_info->ampdu_max_len; - - INIT_LIST_HEAD(&tid_info->list); - INIT_LIST_HEAD(&tid_info->tmp_list); - skb_queue_head_init(&tid_info->queue); - spin_lock_init(&tid_info->lock); - - spin_lock_bh(&ar->tx_ampdu_list_lock); - ar->tx_ampdu_list_len++; - list_add_tail_rcu(&tid_info->list, &ar->tx_ampdu_list); - rcu_assign_pointer(sta_info->agg[tid], tid_info); - spin_unlock_bh(&ar->tx_ampdu_list_lock); - rcu_read_unlock(); - - ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); - break; - - case IEEE80211_AMPDU_TX_STOP_CONT: - case IEEE80211_AMPDU_TX_STOP_FLUSH: - case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: - rcu_read_lock(); - tid_info = rcu_dereference(sta_info->agg[tid]); - if (tid_info) { - spin_lock_bh(&ar->tx_ampdu_list_lock); - if (tid_info->state > CARL9170_TID_STATE_SHUTDOWN) - tid_info->state = CARL9170_TID_STATE_SHUTDOWN; - spin_unlock_bh(&ar->tx_ampdu_list_lock); - } - - RCU_INIT_POINTER(sta_info->agg[tid], NULL); - rcu_read_unlock(); - - ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); - ieee80211_queue_work(ar->hw, &ar->ampdu_work); - break; - - case IEEE80211_AMPDU_TX_OPERATIONAL: - rcu_read_lock(); - tid_info = rcu_dereference(sta_info->agg[tid]); - - sta_info->stats[tid].clear = true; - sta_info->stats[tid].req = false; - - if (tid_info) { - bitmap_zero(tid_info->bitmap, CARL9170_BAW_SIZE); - tid_info->state = CARL9170_TID_STATE_IDLE; - } - rcu_read_unlock(); - - if (WARN_ON_ONCE(!tid_info)) - return -EFAULT; - - break; - - case IEEE80211_AMPDU_RX_START: - case IEEE80211_AMPDU_RX_STOP: - /* Handled by hardware */ - break; - - default: - return -EOPNOTSUPP; - } - - return 0; -} - -#ifdef CONFIG_CARL9170_WPC -static int carl9170_register_wps_button(struct ar9170 *ar) -{ - struct input_dev *input; - int err; - - if (!(ar->features & CARL9170_WPS_BUTTON)) - return 0; - - input = input_allocate_device(); - if (!input) - return -ENOMEM; - - snprintf(ar->wps.name, sizeof(ar->wps.name), "%s WPS Button", - wiphy_name(ar->hw->wiphy)); - - snprintf(ar->wps.phys, sizeof(ar->wps.phys), - "ieee80211/%s/input0", wiphy_name(ar->hw->wiphy)); - - input->name = ar->wps.name; - input->phys = ar->wps.phys; - input->id.bustype = BUS_USB; - input->dev.parent = &ar->hw->wiphy->dev; - - input_set_capability(input, EV_KEY, KEY_WPS_BUTTON); - - err = input_register_device(input); - if (err) { - input_free_device(input); - return err; - } - - ar->wps.pbc = input; - return 0; -} -#endif /* CONFIG_CARL9170_WPC */ - -#ifdef CONFIG_CARL9170_HWRNG -static int carl9170_rng_get(struct ar9170 *ar) -{ - -#define RW (CARL9170_MAX_CMD_PAYLOAD_LEN / sizeof(u32)) -#define RB (CARL9170_MAX_CMD_PAYLOAD_LEN) - - static const __le32 rng_load[RW] = { - [0 ... (RW - 1)] = cpu_to_le32(AR9170_RAND_REG_NUM)}; - - u32 buf[RW]; - - unsigned int i, off = 0, transfer, count; - int err; - - BUILD_BUG_ON(RB > CARL9170_MAX_CMD_PAYLOAD_LEN); - - if (!IS_ACCEPTING_CMD(ar) || !ar->rng.initialized) - return -EAGAIN; - - count = ARRAY_SIZE(ar->rng.cache); - while (count) { - err = carl9170_exec_cmd(ar, CARL9170_CMD_RREG, - RB, (u8 *) rng_load, - RB, (u8 *) buf); - if (err) - return err; - - transfer = min_t(unsigned int, count, RW); - for (i = 0; i < transfer; i++) - ar->rng.cache[off + i] = buf[i]; - - off += transfer; - count -= transfer; - } - - ar->rng.cache_idx = 0; - -#undef RW -#undef RB - return 0; -} - -static int carl9170_rng_read(struct hwrng *rng, u32 *data) -{ - struct ar9170 *ar = (struct ar9170 *)rng->priv; - int ret = -EIO; - - mutex_lock(&ar->mutex); - if (ar->rng.cache_idx >= ARRAY_SIZE(ar->rng.cache)) { - ret = carl9170_rng_get(ar); - if (ret) { - mutex_unlock(&ar->mutex); - return ret; - } - } - - *data = ar->rng.cache[ar->rng.cache_idx++]; - mutex_unlock(&ar->mutex); - - return sizeof(u16); -} - -static void carl9170_unregister_hwrng(struct ar9170 *ar) -{ - if (ar->rng.initialized) { - hwrng_unregister(&ar->rng.rng); - ar->rng.initialized = false; - } -} - -static int carl9170_register_hwrng(struct ar9170 *ar) -{ - int err; - - snprintf(ar->rng.name, ARRAY_SIZE(ar->rng.name), - "%s_%s", KBUILD_MODNAME, wiphy_name(ar->hw->wiphy)); - ar->rng.rng.name = ar->rng.name; - ar->rng.rng.data_read = carl9170_rng_read; - ar->rng.rng.priv = (unsigned long)ar; - - if (WARN_ON(ar->rng.initialized)) - return -EALREADY; - - err = hwrng_register(&ar->rng.rng); - if (err) { - dev_err(&ar->udev->dev, "Failed to register the random " - "number generator (%d)\n", err); - return err; - } - - ar->rng.initialized = true; - - err = carl9170_rng_get(ar); - if (err) { - carl9170_unregister_hwrng(ar); - return err; - } - - return 0; -} -#endif /* CONFIG_CARL9170_HWRNG */ - -static int carl9170_op_get_survey(struct ieee80211_hw *hw, int idx, - struct survey_info *survey) -{ - struct ar9170 *ar = hw->priv; - struct ieee80211_channel *chan; - struct ieee80211_supported_band *band; - int err, b, i; - - chan = ar->channel; - if (!chan) - return -ENODEV; - - if (idx == chan->hw_value) { - mutex_lock(&ar->mutex); - err = carl9170_update_survey(ar, false, true); - mutex_unlock(&ar->mutex); - if (err) - return err; - } - - for (b = 0; b < IEEE80211_NUM_BANDS; b++) { - band = ar->hw->wiphy->bands[b]; - - if (!band) - continue; - - for (i = 0; i < band->n_channels; i++) { - if (band->channels[i].hw_value == idx) { - chan = &band->channels[i]; - goto found; - } - } - } - return -ENOENT; - -found: - memcpy(survey, &ar->survey[idx], sizeof(*survey)); - - survey->channel = chan; - survey->filled = SURVEY_INFO_NOISE_DBM; - - if (ar->channel == chan) - survey->filled |= SURVEY_INFO_IN_USE; - - if (ar->fw.hw_counters) { - survey->filled |= SURVEY_INFO_CHANNEL_TIME | - SURVEY_INFO_CHANNEL_TIME_BUSY | - SURVEY_INFO_CHANNEL_TIME_TX; - } - - return 0; -} - -static void carl9170_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) -{ - struct ar9170 *ar = hw->priv; - unsigned int vid; - - mutex_lock(&ar->mutex); - for_each_set_bit(vid, &ar->vif_bitmap, ar->fw.vif_num) - carl9170_flush_cab(ar, vid); - - carl9170_flush(ar, drop); - mutex_unlock(&ar->mutex); -} - -static int carl9170_op_get_stats(struct ieee80211_hw *hw, - struct ieee80211_low_level_stats *stats) -{ - struct ar9170 *ar = hw->priv; - - memset(stats, 0, sizeof(*stats)); - stats->dot11ACKFailureCount = ar->tx_ack_failures; - stats->dot11FCSErrorCount = ar->tx_fcs_errors; - return 0; -} - -static void carl9170_op_sta_notify(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum sta_notify_cmd cmd, - struct ieee80211_sta *sta) -{ - struct carl9170_sta_info *sta_info = (void *) sta->drv_priv; - - switch (cmd) { - case STA_NOTIFY_SLEEP: - sta_info->sleeping = true; - if (atomic_read(&sta_info->pending_frames)) - ieee80211_sta_block_awake(hw, sta, true); - break; - - case STA_NOTIFY_AWAKE: - sta_info->sleeping = false; - break; - } -} - -static bool carl9170_tx_frames_pending(struct ieee80211_hw *hw) -{ - struct ar9170 *ar = hw->priv; - - return !!atomic_read(&ar->tx_total_queued); -} - -static const struct ieee80211_ops carl9170_ops = { - .start = carl9170_op_start, - .stop = carl9170_op_stop, - .tx = carl9170_op_tx, - .flush = carl9170_op_flush, - .add_interface = carl9170_op_add_interface, - .remove_interface = carl9170_op_remove_interface, - .config = carl9170_op_config, - .prepare_multicast = carl9170_op_prepare_multicast, - .configure_filter = carl9170_op_configure_filter, - .conf_tx = carl9170_op_conf_tx, - .bss_info_changed = carl9170_op_bss_info_changed, - .get_tsf = carl9170_op_get_tsf, - .set_key = carl9170_op_set_key, - .sta_add = carl9170_op_sta_add, - .sta_remove = carl9170_op_sta_remove, - .sta_notify = carl9170_op_sta_notify, - .get_survey = carl9170_op_get_survey, - .get_stats = carl9170_op_get_stats, - .ampdu_action = carl9170_op_ampdu_action, - .tx_frames_pending = carl9170_tx_frames_pending, -}; - -void *carl9170_alloc(size_t priv_size) -{ - struct ieee80211_hw *hw; - struct ar9170 *ar; - struct sk_buff *skb; - int i; - - /* - * this buffer is used for rx stream reconstruction. - * Under heavy load this device (or the transport layer?) - * tends to split the streams into separate rx descriptors. - */ - - skb = __dev_alloc_skb(AR9170_RX_STREAM_MAX_SIZE, GFP_KERNEL); - if (!skb) - goto err_nomem; - - hw = ieee80211_alloc_hw(priv_size, &carl9170_ops); - if (!hw) - goto err_nomem; - - ar = hw->priv; - ar->hw = hw; - ar->rx_failover = skb; - - memset(&ar->rx_plcp, 0, sizeof(struct ar9170_rx_head)); - ar->rx_has_plcp = false; - - /* - * Here's a hidden pitfall! - * - * All 4 AC queues work perfectly well under _legacy_ operation. - * However as soon as aggregation is enabled, the traffic flow - * gets very bumpy. Therefore we have to _switch_ to a - * software AC with a single HW queue. - */ - hw->queues = __AR9170_NUM_TXQ; - - mutex_init(&ar->mutex); - spin_lock_init(&ar->beacon_lock); - spin_lock_init(&ar->cmd_lock); - spin_lock_init(&ar->tx_stats_lock); - spin_lock_init(&ar->tx_ampdu_list_lock); - spin_lock_init(&ar->mem_lock); - spin_lock_init(&ar->state_lock); - atomic_set(&ar->pending_restarts, 0); - ar->vifs = 0; - for (i = 0; i < ar->hw->queues; i++) { - skb_queue_head_init(&ar->tx_status[i]); - skb_queue_head_init(&ar->tx_pending[i]); - - INIT_LIST_HEAD(&ar->bar_list[i]); - spin_lock_init(&ar->bar_list_lock[i]); - } - INIT_WORK(&ar->ps_work, carl9170_ps_work); - INIT_WORK(&ar->ping_work, carl9170_ping_work); - INIT_WORK(&ar->restart_work, carl9170_restart_work); - INIT_WORK(&ar->ampdu_work, carl9170_ampdu_work); - INIT_DELAYED_WORK(&ar->stat_work, carl9170_stat_work); - INIT_DELAYED_WORK(&ar->tx_janitor, carl9170_tx_janitor); - INIT_LIST_HEAD(&ar->tx_ampdu_list); - rcu_assign_pointer(ar->tx_ampdu_iter, - (struct carl9170_sta_tid *) &ar->tx_ampdu_list); - - bitmap_zero(&ar->vif_bitmap, ar->fw.vif_num); - INIT_LIST_HEAD(&ar->vif_list); - init_completion(&ar->tx_flush); - - /* firmware decides which modes we support */ - hw->wiphy->interface_modes = 0; - - hw->flags |= IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_MFP_CAPABLE | - IEEE80211_HW_REPORTS_TX_ACK_STATUS | - IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_PS_NULLFUNC_STACK | - IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC | - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_SUPPORTS_HT_CCK_RATES; - - if (!modparam_noht) { - /* - * see the comment above, why we allow the user - * to disable HT by a module parameter. - */ - hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION; - } - - hw->extra_tx_headroom = sizeof(struct _carl9170_tx_superframe); - hw->sta_data_size = sizeof(struct carl9170_sta_info); - hw->vif_data_size = sizeof(struct carl9170_vif_info); - - hw->max_rates = CARL9170_TX_MAX_RATES; - hw->max_rate_tries = CARL9170_TX_USER_RATE_TRIES; - - for (i = 0; i < ARRAY_SIZE(ar->noise); i++) - ar->noise[i] = -95; /* ATH_DEFAULT_NOISE_FLOOR */ - - return ar; - -err_nomem: - kfree_skb(skb); - return ERR_PTR(-ENOMEM); -} - -static int carl9170_read_eeprom(struct ar9170 *ar) -{ -#define RW 8 /* number of words to read at once */ -#define RB (sizeof(u32) * RW) - u8 *eeprom = (void *)&ar->eeprom; - __le32 offsets[RW]; - int i, j, err; - - BUILD_BUG_ON(sizeof(ar->eeprom) & 3); - - BUILD_BUG_ON(RB > CARL9170_MAX_CMD_LEN - 4); -#ifndef __CHECKER__ - /* don't want to handle trailing remains */ - BUILD_BUG_ON(sizeof(ar->eeprom) % RB); -#endif - - for (i = 0; i < sizeof(ar->eeprom) / RB; i++) { - for (j = 0; j < RW; j++) - offsets[j] = cpu_to_le32(AR9170_EEPROM_START + - RB * i + 4 * j); - - err = carl9170_exec_cmd(ar, CARL9170_CMD_RREG, - RB, (u8 *) &offsets, - RB, eeprom + RB * i); - if (err) - return err; - } - -#undef RW -#undef RB - return 0; -} - -static int carl9170_parse_eeprom(struct ar9170 *ar) -{ - struct ath_regulatory *regulatory = &ar->common.regulatory; - unsigned int rx_streams, tx_streams, tx_params = 0; - int bands = 0; - int chans = 0; - - if (ar->eeprom.length == cpu_to_le16(0xffff)) - return -ENODATA; - - rx_streams = hweight8(ar->eeprom.rx_mask); - tx_streams = hweight8(ar->eeprom.tx_mask); - - if (rx_streams != tx_streams) { - tx_params = IEEE80211_HT_MCS_TX_RX_DIFF; - - WARN_ON(!(tx_streams >= 1 && tx_streams <= - IEEE80211_HT_MCS_TX_MAX_STREAMS)); - - tx_params = (tx_streams - 1) << - IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT; - - carl9170_band_2GHz.ht_cap.mcs.tx_params |= tx_params; - carl9170_band_5GHz.ht_cap.mcs.tx_params |= tx_params; - } - - if (ar->eeprom.operating_flags & AR9170_OPFLAG_2GHZ) { - ar->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = - &carl9170_band_2GHz; - chans += carl9170_band_2GHz.n_channels; - bands++; - } - if (ar->eeprom.operating_flags & AR9170_OPFLAG_5GHZ) { - ar->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = - &carl9170_band_5GHz; - chans += carl9170_band_5GHz.n_channels; - bands++; - } - - if (!bands) - return -EINVAL; - - ar->survey = kzalloc(sizeof(struct survey_info) * chans, GFP_KERNEL); - if (!ar->survey) - return -ENOMEM; - ar->num_channels = chans; - - /* - * I measured this, a bandswitch takes roughly - * 135 ms and a frequency switch about 80. - * - * FIXME: measure these values again once EEPROM settings - * are used, that will influence them! - */ - if (bands == 2) - ar->hw->channel_change_time = 135 * 1000; - else - ar->hw->channel_change_time = 80 * 1000; - - regulatory->current_rd = le16_to_cpu(ar->eeprom.reg_domain[0]); - - /* second part of wiphy init */ - SET_IEEE80211_PERM_ADDR(ar->hw, ar->eeprom.mac_address); - - return 0; -} - -static void carl9170_reg_notifier(struct wiphy *wiphy, - struct regulatory_request *request) -{ - struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); - struct ar9170 *ar = hw->priv; - - ath_reg_notifier_apply(wiphy, request, &ar->common.regulatory); -} - -int carl9170_register(struct ar9170 *ar) -{ - struct ath_regulatory *regulatory = &ar->common.regulatory; - int err = 0, i; - - if (WARN_ON(ar->mem_bitmap)) - return -EINVAL; - - ar->mem_bitmap = kzalloc(roundup(ar->fw.mem_blocks, BITS_PER_LONG) * - sizeof(unsigned long), GFP_KERNEL); - - if (!ar->mem_bitmap) - return -ENOMEM; - - /* try to read EEPROM, init MAC addr */ - err = carl9170_read_eeprom(ar); - if (err) - return err; - - err = carl9170_parse_eeprom(ar); - if (err) - return err; - - err = ath_regd_init(regulatory, ar->hw->wiphy, - carl9170_reg_notifier); - if (err) - return err; - - if (modparam_noht) { - carl9170_band_2GHz.ht_cap.ht_supported = false; - carl9170_band_5GHz.ht_cap.ht_supported = false; - } - - for (i = 0; i < ar->fw.vif_num; i++) { - ar->vif_priv[i].id = i; - ar->vif_priv[i].vif = NULL; - } - - err = ieee80211_register_hw(ar->hw); - if (err) - return err; - - /* mac80211 interface is now registered */ - ar->registered = true; - - if (!ath_is_world_regd(regulatory)) - regulatory_hint(ar->hw->wiphy, regulatory->alpha2); - -#ifdef CONFIG_CARL9170_DEBUGFS - carl9170_debugfs_register(ar); -#endif /* CONFIG_CARL9170_DEBUGFS */ - - err = carl9170_led_init(ar); - if (err) - goto err_unreg; - -#ifdef CONFIG_CARL9170_LEDS - err = carl9170_led_register(ar); - if (err) - goto err_unreg; -#endif /* CONFIG_CARL9170_LEDS */ - -#ifdef CONFIG_CARL9170_WPC - err = carl9170_register_wps_button(ar); - if (err) - goto err_unreg; -#endif /* CONFIG_CARL9170_WPC */ - -#ifdef CONFIG_CARL9170_HWRNG - err = carl9170_register_hwrng(ar); - if (err) - goto err_unreg; -#endif /* CONFIG_CARL9170_HWRNG */ - - dev_info(&ar->udev->dev, "Atheros AR9170 is registered as '%s'\n", - wiphy_name(ar->hw->wiphy)); - - return 0; - -err_unreg: - carl9170_unregister(ar); - return err; -} - -void carl9170_unregister(struct ar9170 *ar) -{ - if (!ar->registered) - return; - - ar->registered = false; - -#ifdef CONFIG_CARL9170_LEDS - carl9170_led_unregister(ar); -#endif /* CONFIG_CARL9170_LEDS */ - -#ifdef CONFIG_CARL9170_DEBUGFS - carl9170_debugfs_unregister(ar); -#endif /* CONFIG_CARL9170_DEBUGFS */ - -#ifdef CONFIG_CARL9170_WPC - if (ar->wps.pbc) { - input_unregister_device(ar->wps.pbc); - ar->wps.pbc = NULL; - } -#endif /* CONFIG_CARL9170_WPC */ - -#ifdef CONFIG_CARL9170_HWRNG - carl9170_unregister_hwrng(ar); -#endif /* CONFIG_CARL9170_HWRNG */ - - carl9170_cancel_worker(ar); - cancel_work_sync(&ar->restart_work); - - ieee80211_unregister_hw(ar->hw); -} - -void carl9170_free(struct ar9170 *ar) -{ - WARN_ON(ar->registered); - WARN_ON(IS_INITIALIZED(ar)); - - kfree_skb(ar->rx_failover); - ar->rx_failover = NULL; - - kfree(ar->mem_bitmap); - ar->mem_bitmap = NULL; - - kfree(ar->survey); - ar->survey = NULL; - - mutex_destroy(&ar->mutex); - - ieee80211_free_hw(ar->hw); -} diff --git a/drivers/net/wireless/ath/carl9170/phy.c b/drivers/net/wireless/ath/carl9170/phy.c deleted file mode 100644 index ab4ee7d39ad3..000000000000 --- a/drivers/net/wireless/ath/carl9170/phy.c +++ /dev/null @@ -1,1730 +0,0 @@ -/* - * Atheros CARL9170 driver - * - * PHY and RF code - * - * Copyright 2008, Johannes Berg - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "carl9170.h" -#include "cmd.h" -#include "phy.h" - -static int carl9170_init_power_cal(struct ar9170 *ar) -{ - carl9170_regwrite_begin(ar); - - carl9170_regwrite(AR9170_PHY_REG_POWER_TX_RATE_MAX, 0x7f); - carl9170_regwrite(AR9170_PHY_REG_POWER_TX_RATE1, 0x3f3f3f3f); - carl9170_regwrite(AR9170_PHY_REG_POWER_TX_RATE2, 0x3f3f3f3f); - carl9170_regwrite(AR9170_PHY_REG_POWER_TX_RATE3, 0x3f3f3f3f); - carl9170_regwrite(AR9170_PHY_REG_POWER_TX_RATE4, 0x3f3f3f3f); - carl9170_regwrite(AR9170_PHY_REG_POWER_TX_RATE5, 0x3f3f3f3f); - carl9170_regwrite(AR9170_PHY_REG_POWER_TX_RATE6, 0x3f3f3f3f); - carl9170_regwrite(AR9170_PHY_REG_POWER_TX_RATE7, 0x3f3f3f3f); - carl9170_regwrite(AR9170_PHY_REG_POWER_TX_RATE8, 0x3f3f3f3f); - carl9170_regwrite(AR9170_PHY_REG_POWER_TX_RATE9, 0x3f3f3f3f); - - carl9170_regwrite_finish(); - return carl9170_regwrite_result(); -} - -struct carl9170_phy_init { - u32 reg, _5ghz_20, _5ghz_40, _2ghz_40, _2ghz_20; -}; - -static struct carl9170_phy_init ar5416_phy_init[] = { - { 0x1c5800, 0x00000007, 0x00000007, 0x00000007, 0x00000007, }, - { 0x1c5804, 0x00000300, 0x000003c4, 0x000003c4, 0x00000300, }, - { 0x1c5808, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c580c, 0xad848e19, 0xad848e19, 0xad848e19, 0xad848e19, }, - { 0x1c5810, 0x7d14e000, 0x7d14e000, 0x7d14e000, 0x7d14e000, }, - { 0x1c5814, 0x9c0a9f6b, 0x9c0a9f6b, 0x9c0a9f6b, 0x9c0a9f6b, }, - { 0x1c5818, 0x00000090, 0x00000090, 0x00000090, 0x00000090, }, - { 0x1c581c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5820, 0x02020200, 0x02020200, 0x02020200, 0x02020200, }, - { 0x1c5824, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, }, - { 0x1c5828, 0x0a020001, 0x0a020001, 0x0a020001, 0x0a020001, }, - { 0x1c582c, 0x0000a000, 0x0000a000, 0x0000a000, 0x0000a000, }, - { 0x1c5830, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5834, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, }, - { 0x1c5838, 0x00000007, 0x00000007, 0x00000007, 0x00000007, }, - { 0x1c583c, 0x00200400, 0x00200400, 0x00200400, 0x00200400, }, - { 0x1c5840, 0x206a002e, 0x206a002e, 0x206a002e, 0x206a002e, }, - { 0x1c5844, 0x1372161e, 0x13721c1e, 0x13721c24, 0x137216a4, }, - { 0x1c5848, 0x001a6a65, 0x001a6a65, 0x00197a68, 0x00197a68, }, - { 0x1c584c, 0x1284233c, 0x1284233c, 0x1284233c, 0x1284233c, }, - { 0x1c5850, 0x6c48b4e4, 0x6d48b4e4, 0x6d48b0e4, 0x6c48b0e4, }, - { 0x1c5854, 0x00000859, 0x00000859, 0x00000859, 0x00000859, }, - { 0x1c5858, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, }, - { 0x1c585c, 0x31395c5e, 0x3139605e, 0x3139605e, 0x31395c5e, }, - { 0x1c5860, 0x0004dd10, 0x0004dd10, 0x0004dd20, 0x0004dd20, }, - { 0x1c5864, 0x0001c600, 0x0001c600, 0x0001c600, 0x0001c600, }, - { 0x1c5868, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190, }, - { 0x1c586c, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, }, - { 0x1c5900, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5904, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5908, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c590c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5914, 0x000007d0, 0x000007d0, 0x00000898, 0x00000898, }, - { 0x1c5918, 0x00000118, 0x00000230, 0x00000268, 0x00000134, }, - { 0x1c591c, 0x10000fff, 0x10000fff, 0x10000fff, 0x10000fff, }, - { 0x1c5920, 0x0510081c, 0x0510081c, 0x0510001c, 0x0510001c, }, - { 0x1c5924, 0xd0058a15, 0xd0058a15, 0xd0058a15, 0xd0058a15, }, - { 0x1c5928, 0x00000001, 0x00000001, 0x00000001, 0x00000001, }, - { 0x1c592c, 0x00000004, 0x00000004, 0x00000004, 0x00000004, }, - { 0x1c5934, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, }, - { 0x1c5938, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, }, - { 0x1c593c, 0x0000007f, 0x0000007f, 0x0000007f, 0x0000007f, }, - { 0x1c5944, 0xdfb81020, 0xdfb81020, 0xdfb81020, 0xdfb81020, }, - { 0x1c5948, 0x9280b212, 0x9280b212, 0x9280b212, 0x9280b212, }, - { 0x1c594c, 0x00020028, 0x00020028, 0x00020028, 0x00020028, }, - { 0x1c5954, 0x5d50e188, 0x5d50e188, 0x5d50e188, 0x5d50e188, }, - { 0x1c5958, 0x00081fff, 0x00081fff, 0x00081fff, 0x00081fff, }, - { 0x1c5960, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40, }, - { 0x1c5964, 0x00001120, 0x00001120, 0x00001120, 0x00001120, }, - { 0x1c5970, 0x190fb515, 0x190fb515, 0x190fb515, 0x190fb515, }, - { 0x1c5974, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5978, 0x00000001, 0x00000001, 0x00000001, 0x00000001, }, - { 0x1c597c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5980, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5984, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5988, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c598c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5990, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5994, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5998, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c599c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c59a0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c59a4, 0x00000007, 0x00000007, 0x00000007, 0x00000007, }, - { 0x1c59a8, 0x001fff00, 0x001fff00, 0x001fff00, 0x001fff00, }, - { 0x1c59ac, 0x006f00c4, 0x006f00c4, 0x006f00c4, 0x006f00c4, }, - { 0x1c59b0, 0x03051000, 0x03051000, 0x03051000, 0x03051000, }, - { 0x1c59b4, 0x00000820, 0x00000820, 0x00000820, 0x00000820, }, - { 0x1c59bc, 0x00181400, 0x00181400, 0x00181400, 0x00181400, }, - { 0x1c59c0, 0x038919be, 0x038919be, 0x038919be, 0x038919be, }, - { 0x1c59c4, 0x06336f77, 0x06336f77, 0x06336f77, 0x06336f77, }, - { 0x1c59c8, 0x6af6532c, 0x6af6532c, 0x6af6532c, 0x6af6532c, }, - { 0x1c59cc, 0x08f186c8, 0x08f186c8, 0x08f186c8, 0x08f186c8, }, - { 0x1c59d0, 0x00046384, 0x00046384, 0x00046384, 0x00046384, }, - { 0x1c59d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c59d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c59dc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c59e0, 0x00000200, 0x00000200, 0x00000200, 0x00000200, }, - { 0x1c59e4, 0x64646464, 0x64646464, 0x64646464, 0x64646464, }, - { 0x1c59e8, 0x3c787878, 0x3c787878, 0x3c787878, 0x3c787878, }, - { 0x1c59ec, 0x000000aa, 0x000000aa, 0x000000aa, 0x000000aa, }, - { 0x1c59f0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c59fc, 0x00001042, 0x00001042, 0x00001042, 0x00001042, }, - { 0x1c5a00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5a04, 0x00000040, 0x00000040, 0x00000040, 0x00000040, }, - { 0x1c5a08, 0x00000080, 0x00000080, 0x00000080, 0x00000080, }, - { 0x1c5a0c, 0x000001a1, 0x000001a1, 0x00000141, 0x00000141, }, - { 0x1c5a10, 0x000001e1, 0x000001e1, 0x00000181, 0x00000181, }, - { 0x1c5a14, 0x00000021, 0x00000021, 0x000001c1, 0x000001c1, }, - { 0x1c5a18, 0x00000061, 0x00000061, 0x00000001, 0x00000001, }, - { 0x1c5a1c, 0x00000168, 0x00000168, 0x00000041, 0x00000041, }, - { 0x1c5a20, 0x000001a8, 0x000001a8, 0x000001a8, 0x000001a8, }, - { 0x1c5a24, 0x000001e8, 0x000001e8, 0x000001e8, 0x000001e8, }, - { 0x1c5a28, 0x00000028, 0x00000028, 0x00000028, 0x00000028, }, - { 0x1c5a2c, 0x00000068, 0x00000068, 0x00000068, 0x00000068, }, - { 0x1c5a30, 0x00000189, 0x00000189, 0x000000a8, 0x000000a8, }, - { 0x1c5a34, 0x000001c9, 0x000001c9, 0x00000169, 0x00000169, }, - { 0x1c5a38, 0x00000009, 0x00000009, 0x000001a9, 0x000001a9, }, - { 0x1c5a3c, 0x00000049, 0x00000049, 0x000001e9, 0x000001e9, }, - { 0x1c5a40, 0x00000089, 0x00000089, 0x00000029, 0x00000029, }, - { 0x1c5a44, 0x00000170, 0x00000170, 0x00000069, 0x00000069, }, - { 0x1c5a48, 0x000001b0, 0x000001b0, 0x00000190, 0x00000190, }, - { 0x1c5a4c, 0x000001f0, 0x000001f0, 0x000001d0, 0x000001d0, }, - { 0x1c5a50, 0x00000030, 0x00000030, 0x00000010, 0x00000010, }, - { 0x1c5a54, 0x00000070, 0x00000070, 0x00000050, 0x00000050, }, - { 0x1c5a58, 0x00000191, 0x00000191, 0x00000090, 0x00000090, }, - { 0x1c5a5c, 0x000001d1, 0x000001d1, 0x00000151, 0x00000151, }, - { 0x1c5a60, 0x00000011, 0x00000011, 0x00000191, 0x00000191, }, - { 0x1c5a64, 0x00000051, 0x00000051, 0x000001d1, 0x000001d1, }, - { 0x1c5a68, 0x00000091, 0x00000091, 0x00000011, 0x00000011, }, - { 0x1c5a6c, 0x000001b8, 0x000001b8, 0x00000051, 0x00000051, }, - { 0x1c5a70, 0x000001f8, 0x000001f8, 0x00000198, 0x00000198, }, - { 0x1c5a74, 0x00000038, 0x00000038, 0x000001d8, 0x000001d8, }, - { 0x1c5a78, 0x00000078, 0x00000078, 0x00000018, 0x00000018, }, - { 0x1c5a7c, 0x00000199, 0x00000199, 0x00000058, 0x00000058, }, - { 0x1c5a80, 0x000001d9, 0x000001d9, 0x00000098, 0x00000098, }, - { 0x1c5a84, 0x00000019, 0x00000019, 0x00000159, 0x00000159, }, - { 0x1c5a88, 0x00000059, 0x00000059, 0x00000199, 0x00000199, }, - { 0x1c5a8c, 0x00000099, 0x00000099, 0x000001d9, 0x000001d9, }, - { 0x1c5a90, 0x000000d9, 0x000000d9, 0x00000019, 0x00000019, }, - { 0x1c5a94, 0x000000f9, 0x000000f9, 0x00000059, 0x00000059, }, - { 0x1c5a98, 0x000000f9, 0x000000f9, 0x00000099, 0x00000099, }, - { 0x1c5a9c, 0x000000f9, 0x000000f9, 0x000000d9, 0x000000d9, }, - { 0x1c5aa0, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5aa4, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5aa8, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5aac, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5ab0, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5ab4, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5ab8, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5abc, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5ac0, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5ac4, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5ac8, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5acc, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5ad0, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5ad4, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5ad8, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5adc, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5ae0, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5ae4, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5ae8, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5aec, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5af0, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5af4, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5af8, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5afc, 0x000000f9, 0x000000f9, 0x000000f9, 0x000000f9, }, - { 0x1c5b00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5b04, 0x00000001, 0x00000001, 0x00000001, 0x00000001, }, - { 0x1c5b08, 0x00000002, 0x00000002, 0x00000002, 0x00000002, }, - { 0x1c5b0c, 0x00000003, 0x00000003, 0x00000003, 0x00000003, }, - { 0x1c5b10, 0x00000004, 0x00000004, 0x00000004, 0x00000004, }, - { 0x1c5b14, 0x00000005, 0x00000005, 0x00000005, 0x00000005, }, - { 0x1c5b18, 0x00000008, 0x00000008, 0x00000008, 0x00000008, }, - { 0x1c5b1c, 0x00000009, 0x00000009, 0x00000009, 0x00000009, }, - { 0x1c5b20, 0x0000000a, 0x0000000a, 0x0000000a, 0x0000000a, }, - { 0x1c5b24, 0x0000000b, 0x0000000b, 0x0000000b, 0x0000000b, }, - { 0x1c5b28, 0x0000000c, 0x0000000c, 0x0000000c, 0x0000000c, }, - { 0x1c5b2c, 0x0000000d, 0x0000000d, 0x0000000d, 0x0000000d, }, - { 0x1c5b30, 0x00000010, 0x00000010, 0x00000010, 0x00000010, }, - { 0x1c5b34, 0x00000011, 0x00000011, 0x00000011, 0x00000011, }, - { 0x1c5b38, 0x00000012, 0x00000012, 0x00000012, 0x00000012, }, - { 0x1c5b3c, 0x00000013, 0x00000013, 0x00000013, 0x00000013, }, - { 0x1c5b40, 0x00000014, 0x00000014, 0x00000014, 0x00000014, }, - { 0x1c5b44, 0x00000015, 0x00000015, 0x00000015, 0x00000015, }, - { 0x1c5b48, 0x00000018, 0x00000018, 0x00000018, 0x00000018, }, - { 0x1c5b4c, 0x00000019, 0x00000019, 0x00000019, 0x00000019, }, - { 0x1c5b50, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a, }, - { 0x1c5b54, 0x0000001b, 0x0000001b, 0x0000001b, 0x0000001b, }, - { 0x1c5b58, 0x0000001c, 0x0000001c, 0x0000001c, 0x0000001c, }, - { 0x1c5b5c, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, }, - { 0x1c5b60, 0x00000020, 0x00000020, 0x00000020, 0x00000020, }, - { 0x1c5b64, 0x00000021, 0x00000021, 0x00000021, 0x00000021, }, - { 0x1c5b68, 0x00000022, 0x00000022, 0x00000022, 0x00000022, }, - { 0x1c5b6c, 0x00000023, 0x00000023, 0x00000023, 0x00000023, }, - { 0x1c5b70, 0x00000024, 0x00000024, 0x00000024, 0x00000024, }, - { 0x1c5b74, 0x00000025, 0x00000025, 0x00000025, 0x00000025, }, - { 0x1c5b78, 0x00000028, 0x00000028, 0x00000028, 0x00000028, }, - { 0x1c5b7c, 0x00000029, 0x00000029, 0x00000029, 0x00000029, }, - { 0x1c5b80, 0x0000002a, 0x0000002a, 0x0000002a, 0x0000002a, }, - { 0x1c5b84, 0x0000002b, 0x0000002b, 0x0000002b, 0x0000002b, }, - { 0x1c5b88, 0x0000002c, 0x0000002c, 0x0000002c, 0x0000002c, }, - { 0x1c5b8c, 0x0000002d, 0x0000002d, 0x0000002d, 0x0000002d, }, - { 0x1c5b90, 0x00000030, 0x00000030, 0x00000030, 0x00000030, }, - { 0x1c5b94, 0x00000031, 0x00000031, 0x00000031, 0x00000031, }, - { 0x1c5b98, 0x00000032, 0x00000032, 0x00000032, 0x00000032, }, - { 0x1c5b9c, 0x00000033, 0x00000033, 0x00000033, 0x00000033, }, - { 0x1c5ba0, 0x00000034, 0x00000034, 0x00000034, 0x00000034, }, - { 0x1c5ba4, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5ba8, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bac, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bb0, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bb4, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bb8, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bbc, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bc0, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bc4, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bc8, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bcc, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bd0, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bd4, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bd8, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bdc, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5be0, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5be4, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5be8, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bec, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bf0, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bf4, 0x00000035, 0x00000035, 0x00000035, 0x00000035, }, - { 0x1c5bf8, 0x00000010, 0x00000010, 0x00000010, 0x00000010, }, - { 0x1c5bfc, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a, }, - { 0x1c5c00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5c0c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5c10, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5c14, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5c18, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5c1c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5c20, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5c24, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5c28, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5c2c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5c30, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5c34, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5c38, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5c3c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5cf0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5cf4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5cf8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c5cfc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c6200, 0x00000008, 0x00000008, 0x0000000e, 0x0000000e, }, - { 0x1c6204, 0x00000440, 0x00000440, 0x00000440, 0x00000440, }, - { 0x1c6208, 0xd6be4788, 0xd6be4788, 0xd03e4788, 0xd03e4788, }, - { 0x1c620c, 0x012e8160, 0x012e8160, 0x012a8160, 0x012a8160, }, - { 0x1c6210, 0x40806333, 0x40806333, 0x40806333, 0x40806333, }, - { 0x1c6214, 0x00106c10, 0x00106c10, 0x00106c10, 0x00106c10, }, - { 0x1c6218, 0x009c4060, 0x009c4060, 0x009c4060, 0x009c4060, }, - { 0x1c621c, 0x1883800a, 0x1883800a, 0x1883800a, 0x1883800a, }, - { 0x1c6220, 0x018830c6, 0x018830c6, 0x018830c6, 0x018830c6, }, - { 0x1c6224, 0x00000400, 0x00000400, 0x00000400, 0x00000400, }, - { 0x1c6228, 0x000009b5, 0x000009b5, 0x000009b5, 0x000009b5, }, - { 0x1c622c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c6230, 0x00000108, 0x00000210, 0x00000210, 0x00000108, }, - { 0x1c6234, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, }, - { 0x1c6238, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, }, - { 0x1c623c, 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af, }, - { 0x1c6240, 0x38490a20, 0x38490a20, 0x38490a20, 0x38490a20, }, - { 0x1c6244, 0x00007bb6, 0x00007bb6, 0x00007bb6, 0x00007bb6, }, - { 0x1c6248, 0x0fff3ffc, 0x0fff3ffc, 0x0fff3ffc, 0x0fff3ffc, }, - { 0x1c624c, 0x00000001, 0x00000001, 0x00000001, 0x00000001, }, - { 0x1c6250, 0x0000a000, 0x0000a000, 0x0000a000, 0x0000a000, }, - { 0x1c6254, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c6258, 0x0cc75380, 0x0cc75380, 0x0cc75380, 0x0cc75380, }, - { 0x1c625c, 0x0f0f0f01, 0x0f0f0f01, 0x0f0f0f01, 0x0f0f0f01, }, - { 0x1c6260, 0xdfa91f01, 0xdfa91f01, 0xdfa91f01, 0xdfa91f01, }, - { 0x1c6264, 0x00418a11, 0x00418a11, 0x00418a11, 0x00418a11, }, - { 0x1c6268, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c626c, 0x09249126, 0x09249126, 0x09249126, 0x09249126, }, - { 0x1c6274, 0x0a1a9caa, 0x0a1a9caa, 0x0a1a7caa, 0x0a1a7caa, }, - { 0x1c6278, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, }, - { 0x1c627c, 0x051701ce, 0x051701ce, 0x051701ce, 0x051701ce, }, - { 0x1c6300, 0x18010000, 0x18010000, 0x18010000, 0x18010000, }, - { 0x1c6304, 0x30032602, 0x30032602, 0x2e032402, 0x2e032402, }, - { 0x1c6308, 0x48073e06, 0x48073e06, 0x4a0a3c06, 0x4a0a3c06, }, - { 0x1c630c, 0x560b4c0a, 0x560b4c0a, 0x621a540b, 0x621a540b, }, - { 0x1c6310, 0x641a600f, 0x641a600f, 0x764f6c1b, 0x764f6c1b, }, - { 0x1c6314, 0x7a4f6e1b, 0x7a4f6e1b, 0x845b7a5a, 0x845b7a5a, }, - { 0x1c6318, 0x8c5b7e5a, 0x8c5b7e5a, 0x950f8ccf, 0x950f8ccf, }, - { 0x1c631c, 0x9d0f96cf, 0x9d0f96cf, 0xa5cf9b4f, 0xa5cf9b4f, }, - { 0x1c6320, 0xb51fa69f, 0xb51fa69f, 0xbddfaf1f, 0xbddfaf1f, }, - { 0x1c6324, 0xcb3fbd07, 0xcb3fbcbf, 0xd1ffc93f, 0xd1ffc93f, }, - { 0x1c6328, 0x0000d7bf, 0x0000d7bf, 0x00000000, 0x00000000, }, - { 0x1c632c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c6330, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c6334, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c6338, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c633c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c6340, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c6344, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c6348, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, }, - { 0x1c634c, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, }, - { 0x1c6350, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, }, - { 0x1c6354, 0x0003ffff, 0x0003ffff, 0x0003ffff, 0x0003ffff, }, - { 0x1c6358, 0x79a8aa1f, 0x79a8aa1f, 0x79a8aa1f, 0x79a8aa1f, }, - { 0x1c6388, 0x08000000, 0x08000000, 0x08000000, 0x08000000, }, - { 0x1c638c, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, }, - { 0x1c6390, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, }, - { 0x1c6394, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, }, - { 0x1c6398, 0x000001ce, 0x000001ce, 0x000001ce, 0x000001ce, }, - { 0x1c639c, 0x00000007, 0x00000007, 0x00000007, 0x00000007, }, - { 0x1c63a0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c63a4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c63a8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c63ac, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c63b0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c63b4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c63b8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c63bc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c63c0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c63c4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c63c8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c63cc, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, }, - { 0x1c63d0, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, }, - { 0x1c63d4, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, 0x3f3f3f3f, }, - { 0x1c63d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, - { 0x1c63dc, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, }, - { 0x1c63e0, 0x000000c0, 0x000000c0, 0x000000c0, 0x000000c0, }, - { 0x1c6848, 0x00180a65, 0x00180a65, 0x00180a68, 0x00180a68, }, - { 0x1c6920, 0x0510001c, 0x0510001c, 0x0510001c, 0x0510001c, }, - { 0x1c6960, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40, }, - { 0x1c720c, 0x012e8160, 0x012e8160, 0x012a8160, 0x012a8160, }, - { 0x1c726c, 0x09249126, 0x09249126, 0x09249126, 0x09249126, }, - { 0x1c7848, 0x00180a65, 0x00180a65, 0x00180a68, 0x00180a68, }, - { 0x1c7920, 0x0510001c, 0x0510001c, 0x0510001c, 0x0510001c, }, - { 0x1c7960, 0x00009b40, 0x00009b40, 0x00009b40, 0x00009b40, }, - { 0x1c820c, 0x012e8160, 0x012e8160, 0x012a8160, 0x012a8160, }, - { 0x1c826c, 0x09249126, 0x09249126, 0x09249126, 0x09249126, }, -/* { 0x1c8864, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, }, */ - { 0x1c8864, 0x0001c600, 0x0001c600, 0x0001c600, 0x0001c600, }, - { 0x1c895c, 0x004b6a8e, 0x004b6a8e, 0x004b6a8e, 0x004b6a8e, }, - { 0x1c8968, 0x000003ce, 0x000003ce, 0x000003ce, 0x000003ce, }, - { 0x1c89bc, 0x00181400, 0x00181400, 0x00181400, 0x00181400, }, - { 0x1c9270, 0x00820820, 0x00820820, 0x00820820, 0x00820820, }, - { 0x1c935c, 0x066c420f, 0x066c420f, 0x066c420f, 0x066c420f, }, - { 0x1c9360, 0x0f282207, 0x0f282207, 0x0f282207, 0x0f282207, }, - { 0x1c9364, 0x17601685, 0x17601685, 0x17601685, 0x17601685, }, - { 0x1c9368, 0x1f801104, 0x1f801104, 0x1f801104, 0x1f801104, }, - { 0x1c936c, 0x37a00c03, 0x37a00c03, 0x37a00c03, 0x37a00c03, }, - { 0x1c9370, 0x3fc40883, 0x3fc40883, 0x3fc40883, 0x3fc40883, }, - { 0x1c9374, 0x57c00803, 0x57c00803, 0x57c00803, 0x57c00803, }, - { 0x1c9378, 0x5fd80682, 0x5fd80682, 0x5fd80682, 0x5fd80682, }, - { 0x1c937c, 0x7fe00482, 0x7fe00482, 0x7fe00482, 0x7fe00482, }, - { 0x1c9380, 0x7f3c7bba, 0x7f3c7bba, 0x7f3c7bba, 0x7f3c7bba, }, - { 0x1c9384, 0xf3307ff0, 0xf3307ff0, 0xf3307ff0, 0xf3307ff0, } -}; - -/* - * look up a certain register in ar5416_phy_init[] and return the init. value - * for the band and bandwidth given. Return 0 if register address not found. - */ -static u32 carl9170_def_val(u32 reg, bool is_2ghz, bool is_40mhz) -{ - unsigned int i; - for (i = 0; i < ARRAY_SIZE(ar5416_phy_init); i++) { - if (ar5416_phy_init[i].reg != reg) - continue; - - if (is_2ghz) { - if (is_40mhz) - return ar5416_phy_init[i]._2ghz_40; - else - return ar5416_phy_init[i]._2ghz_20; - } else { - if (is_40mhz) - return ar5416_phy_init[i]._5ghz_40; - else - return ar5416_phy_init[i]._5ghz_20; - } - } - return 0; -} - -/* - * initialize some phy regs from eeprom values in modal_header[] - * acc. to band and bandwidth - */ -static int carl9170_init_phy_from_eeprom(struct ar9170 *ar, - bool is_2ghz, bool is_40mhz) -{ - static const u8 xpd2pd[16] = { - 0x2, 0x2, 0x2, 0x1, 0x2, 0x2, 0x6, 0x2, - 0x2, 0x3, 0x7, 0x2, 0xb, 0x2, 0x2, 0x2 - }; - /* pointer to the modal_header acc. to band */ - struct ar9170_eeprom_modal *m = &ar->eeprom.modal_header[is_2ghz]; - u32 val; - - carl9170_regwrite_begin(ar); - - /* ant common control (index 0) */ - carl9170_regwrite(AR9170_PHY_REG_SWITCH_COM, - le32_to_cpu(m->antCtrlCommon)); - - /* ant control chain 0 (index 1) */ - carl9170_regwrite(AR9170_PHY_REG_SWITCH_CHAIN_0, - le32_to_cpu(m->antCtrlChain[0])); - - /* ant control chain 2 (index 2) */ - carl9170_regwrite(AR9170_PHY_REG_SWITCH_CHAIN_2, - le32_to_cpu(m->antCtrlChain[1])); - - /* SwSettle (index 3) */ - if (!is_40mhz) { - val = carl9170_def_val(AR9170_PHY_REG_SETTLING, - is_2ghz, is_40mhz); - SET_VAL(AR9170_PHY_SETTLING_SWITCH, val, m->switchSettling); - carl9170_regwrite(AR9170_PHY_REG_SETTLING, val); - } - - /* adcDesired, pdaDesired (index 4) */ - val = carl9170_def_val(AR9170_PHY_REG_DESIRED_SZ, is_2ghz, is_40mhz); - SET_VAL(AR9170_PHY_DESIRED_SZ_PGA, val, m->pgaDesiredSize); - SET_VAL(AR9170_PHY_DESIRED_SZ_ADC, val, m->adcDesiredSize); - carl9170_regwrite(AR9170_PHY_REG_DESIRED_SZ, val); - - /* TxEndToXpaOff, TxFrameToXpaOn (index 5) */ - val = carl9170_def_val(AR9170_PHY_REG_RF_CTL4, is_2ghz, is_40mhz); - SET_VAL(AR9170_PHY_RF_CTL4_TX_END_XPAB_OFF, val, m->txEndToXpaOff); - SET_VAL(AR9170_PHY_RF_CTL4_TX_END_XPAA_OFF, val, m->txEndToXpaOff); - SET_VAL(AR9170_PHY_RF_CTL4_FRAME_XPAB_ON, val, m->txFrameToXpaOn); - SET_VAL(AR9170_PHY_RF_CTL4_FRAME_XPAA_ON, val, m->txFrameToXpaOn); - carl9170_regwrite(AR9170_PHY_REG_RF_CTL4, val); - - /* TxEndToRxOn (index 6) */ - val = carl9170_def_val(AR9170_PHY_REG_RF_CTL3, is_2ghz, is_40mhz); - SET_VAL(AR9170_PHY_RF_CTL3_TX_END_TO_A2_RX_ON, val, m->txEndToRxOn); - carl9170_regwrite(AR9170_PHY_REG_RF_CTL3, val); - - /* thresh62 (index 7) */ - val = carl9170_def_val(0x1c8864, is_2ghz, is_40mhz); - val = (val & ~0x7f000) | (m->thresh62 << 12); - carl9170_regwrite(0x1c8864, val); - - /* tx/rx attenuation chain 0 (index 8) */ - val = carl9170_def_val(AR9170_PHY_REG_RXGAIN, is_2ghz, is_40mhz); - SET_VAL(AR9170_PHY_RXGAIN_TXRX_ATTEN, val, m->txRxAttenCh[0]); - carl9170_regwrite(AR9170_PHY_REG_RXGAIN, val); - - /* tx/rx attenuation chain 2 (index 9) */ - val = carl9170_def_val(AR9170_PHY_REG_RXGAIN_CHAIN_2, - is_2ghz, is_40mhz); - SET_VAL(AR9170_PHY_RXGAIN_TXRX_ATTEN, val, m->txRxAttenCh[1]); - carl9170_regwrite(AR9170_PHY_REG_RXGAIN_CHAIN_2, val); - - /* tx/rx margin chain 0 (index 10) */ - val = carl9170_def_val(AR9170_PHY_REG_GAIN_2GHZ, is_2ghz, is_40mhz); - SET_VAL(AR9170_PHY_GAIN_2GHZ_RXTX_MARGIN, val, m->rxTxMarginCh[0]); - /* bsw margin chain 0 for 5GHz only */ - if (!is_2ghz) - SET_VAL(AR9170_PHY_GAIN_2GHZ_BSW_MARGIN, val, m->bswMargin[0]); - carl9170_regwrite(AR9170_PHY_REG_GAIN_2GHZ, val); - - /* tx/rx margin chain 2 (index 11) */ - val = carl9170_def_val(AR9170_PHY_REG_GAIN_2GHZ_CHAIN_2, - is_2ghz, is_40mhz); - SET_VAL(AR9170_PHY_GAIN_2GHZ_RXTX_MARGIN, val, m->rxTxMarginCh[1]); - carl9170_regwrite(AR9170_PHY_REG_GAIN_2GHZ_CHAIN_2, val); - - /* iqCall, iqCallq chain 0 (index 12) */ - val = carl9170_def_val(AR9170_PHY_REG_TIMING_CTRL4(0), - is_2ghz, is_40mhz); - SET_VAL(AR9170_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF, val, m->iqCalICh[0]); - SET_VAL(AR9170_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF, val, m->iqCalQCh[0]); - carl9170_regwrite(AR9170_PHY_REG_TIMING_CTRL4(0), val); - - /* iqCall, iqCallq chain 2 (index 13) */ - val = carl9170_def_val(AR9170_PHY_REG_TIMING_CTRL4(2), - is_2ghz, is_40mhz); - SET_VAL(AR9170_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF, val, m->iqCalICh[1]); - SET_VAL(AR9170_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF, val, m->iqCalQCh[1]); - carl9170_regwrite(AR9170_PHY_REG_TIMING_CTRL4(2), val); - - /* xpd gain mask (index 14) */ - val = carl9170_def_val(AR9170_PHY_REG_TPCRG1, is_2ghz, is_40mhz); - SET_VAL(AR9170_PHY_TPCRG1_PD_GAIN_1, val, - xpd2pd[m->xpdGain & 0xf] & 3); - SET_VAL(AR9170_PHY_TPCRG1_PD_GAIN_2, val, - xpd2pd[m->xpdGain & 0xf] >> 2); - carl9170_regwrite(AR9170_PHY_REG_TPCRG1, val); - - carl9170_regwrite(AR9170_PHY_REG_RX_CHAINMASK, ar->eeprom.rx_mask); - carl9170_regwrite(AR9170_PHY_REG_CAL_CHAINMASK, ar->eeprom.rx_mask); - - carl9170_regwrite_finish(); - return carl9170_regwrite_result(); -} - -static int carl9170_init_phy(struct ar9170 *ar, enum ieee80211_band band) -{ - int i, err; - u32 val; - bool is_2ghz = band == IEEE80211_BAND_2GHZ; - bool is_40mhz = conf_is_ht40(&ar->hw->conf); - - carl9170_regwrite_begin(ar); - - for (i = 0; i < ARRAY_SIZE(ar5416_phy_init); i++) { - if (is_40mhz) { - if (is_2ghz) - val = ar5416_phy_init[i]._2ghz_40; - else - val = ar5416_phy_init[i]._5ghz_40; - } else { - if (is_2ghz) - val = ar5416_phy_init[i]._2ghz_20; - else - val = ar5416_phy_init[i]._5ghz_20; - } - - carl9170_regwrite(ar5416_phy_init[i].reg, val); - } - - carl9170_regwrite_finish(); - err = carl9170_regwrite_result(); - if (err) - return err; - - err = carl9170_init_phy_from_eeprom(ar, is_2ghz, is_40mhz); - if (err) - return err; - - err = carl9170_init_power_cal(ar); - if (err) - return err; - - if (!ar->fw.hw_counters) { - err = carl9170_write_reg(ar, AR9170_PWR_REG_PLL_ADDAC, - is_2ghz ? 0x5163 : 0x5143); - } - - return err; -} - -struct carl9170_rf_initvals { - u32 reg, _5ghz, _2ghz; -}; - -static struct carl9170_rf_initvals carl9170_rf_initval[] = { - /* bank 0 */ - { 0x1c58b0, 0x1e5795e5, 0x1e5795e5}, - { 0x1c58e0, 0x02008020, 0x02008020}, - /* bank 1 */ - { 0x1c58b0, 0x02108421, 0x02108421}, - { 0x1c58ec, 0x00000008, 0x00000008}, - /* bank 2 */ - { 0x1c58b0, 0x0e73ff17, 0x0e73ff17}, - { 0x1c58e0, 0x00000420, 0x00000420}, - /* bank 3 */ - { 0x1c58f0, 0x01400018, 0x01c00018}, - /* bank 4 */ - { 0x1c58b0, 0x000001a1, 0x000001a1}, - { 0x1c58e8, 0x00000001, 0x00000001}, - /* bank 5 */ - { 0x1c58b0, 0x00000013, 0x00000013}, - { 0x1c58e4, 0x00000002, 0x00000002}, - /* bank 6 */ - { 0x1c58b0, 0x00000000, 0x00000000}, - { 0x1c58b0, 0x00000000, 0x00000000}, - { 0x1c58b0, 0x00000000, 0x00000000}, - { 0x1c58b0, 0x00000000, 0x00000000}, - { 0x1c58b0, 0x00000000, 0x00000000}, - { 0x1c58b0, 0x00004000, 0x00004000}, - { 0x1c58b0, 0x00006c00, 0x00006c00}, - { 0x1c58b0, 0x00002c00, 0x00002c00}, - { 0x1c58b0, 0x00004800, 0x00004800}, - { 0x1c58b0, 0x00004000, 0x00004000}, - { 0x1c58b0, 0x00006000, 0x00006000}, - { 0x1c58b0, 0x00001000, 0x00001000}, - { 0x1c58b0, 0x00004000, 0x00004000}, - { 0x1c58b0, 0x00007c00, 0x00007c00}, - { 0x1c58b0, 0x00007c00, 0x00007c00}, - { 0x1c58b0, 0x00007c00, 0x00007c00}, - { 0x1c58b0, 0x00007c00, 0x00007c00}, - { 0x1c58b0, 0x00007c00, 0x00007c00}, - { 0x1c58b0, 0x00087c00, 0x00087c00}, - { 0x1c58b0, 0x00007c00, 0x00007c00}, - { 0x1c58b0, 0x00005400, 0x00005400}, - { 0x1c58b0, 0x00000c00, 0x00000c00}, - { 0x1c58b0, 0x00001800, 0x00001800}, - { 0x1c58b0, 0x00007c00, 0x00007c00}, - { 0x1c58b0, 0x00006c00, 0x00006c00}, - { 0x1c58b0, 0x00006c00, 0x00006c00}, - { 0x1c58b0, 0x00007c00, 0x00007c00}, - { 0x1c58b0, 0x00002c00, 0x00002c00}, - { 0x1c58b0, 0x00003c00, 0x00003c00}, - { 0x1c58b0, 0x00003800, 0x00003800}, - { 0x1c58b0, 0x00001c00, 0x00001c00}, - { 0x1c58b0, 0x00000800, 0x00000800}, - { 0x1c58b0, 0x00000408, 0x00000408}, - { 0x1c58b0, 0x00004c15, 0x00004c15}, - { 0x1c58b0, 0x00004188, 0x00004188}, - { 0x1c58b0, 0x0000201e, 0x0000201e}, - { 0x1c58b0, 0x00010408, 0x00010408}, - { 0x1c58b0, 0x00000801, 0x00000801}, - { 0x1c58b0, 0x00000c08, 0x00000c08}, - { 0x1c58b0, 0x0000181e, 0x0000181e}, - { 0x1c58b0, 0x00001016, 0x00001016}, - { 0x1c58b0, 0x00002800, 0x00002800}, - { 0x1c58b0, 0x00004010, 0x00004010}, - { 0x1c58b0, 0x0000081c, 0x0000081c}, - { 0x1c58b0, 0x00000115, 0x00000115}, - { 0x1c58b0, 0x00000015, 0x00000015}, - { 0x1c58b0, 0x00000066, 0x00000066}, - { 0x1c58b0, 0x0000001c, 0x0000001c}, - { 0x1c58b0, 0x00000000, 0x00000000}, - { 0x1c58b0, 0x00000004, 0x00000004}, - { 0x1c58b0, 0x00000015, 0x00000015}, - { 0x1c58b0, 0x0000001f, 0x0000001f}, - { 0x1c58e0, 0x00000000, 0x00000400}, - /* bank 7 */ - { 0x1c58b0, 0x000000a0, 0x000000a0}, - { 0x1c58b0, 0x00000000, 0x00000000}, - { 0x1c58b0, 0x00000040, 0x00000040}, - { 0x1c58f0, 0x0000001c, 0x0000001c}, -}; - -static int carl9170_init_rf_banks_0_7(struct ar9170 *ar, bool band5ghz) -{ - int err, i; - - carl9170_regwrite_begin(ar); - - for (i = 0; i < ARRAY_SIZE(carl9170_rf_initval); i++) - carl9170_regwrite(carl9170_rf_initval[i].reg, - band5ghz ? carl9170_rf_initval[i]._5ghz - : carl9170_rf_initval[i]._2ghz); - - carl9170_regwrite_finish(); - err = carl9170_regwrite_result(); - if (err) - wiphy_err(ar->hw->wiphy, "rf init failed\n"); - - return err; -} - -struct carl9170_phy_freq_params { - u8 coeff_exp; - u16 coeff_man; - u8 coeff_exp_shgi; - u16 coeff_man_shgi; -}; - -enum carl9170_bw { - CARL9170_BW_20, - CARL9170_BW_40_BELOW, - CARL9170_BW_40_ABOVE, - - __CARL9170_NUM_BW, -}; - -struct carl9170_phy_freq_entry { - u16 freq; - struct carl9170_phy_freq_params params[__CARL9170_NUM_BW]; -}; - -/* NB: must be in sync with channel tables in main! */ -static const struct carl9170_phy_freq_entry carl9170_phy_freq_params[] = { -/* - * freq, - * 20MHz, - * 40MHz (below), - * 40Mhz (above), - */ - { 2412, { - { 3, 21737, 3, 19563, }, - { 3, 21827, 3, 19644, }, - { 3, 21647, 3, 19482, }, - } }, - { 2417, { - { 3, 21692, 3, 19523, }, - { 3, 21782, 3, 19604, }, - { 3, 21602, 3, 19442, }, - } }, - { 2422, { - { 3, 21647, 3, 19482, }, - { 3, 21737, 3, 19563, }, - { 3, 21558, 3, 19402, }, - } }, - { 2427, { - { 3, 21602, 3, 19442, }, - { 3, 21692, 3, 19523, }, - { 3, 21514, 3, 19362, }, - } }, - { 2432, { - { 3, 21558, 3, 19402, }, - { 3, 21647, 3, 19482, }, - { 3, 21470, 3, 19323, }, - } }, - { 2437, { - { 3, 21514, 3, 19362, }, - { 3, 21602, 3, 19442, }, - { 3, 21426, 3, 19283, }, - } }, - { 2442, { - { 3, 21470, 3, 19323, }, - { 3, 21558, 3, 19402, }, - { 3, 21382, 3, 19244, }, - } }, - { 2447, { - { 3, 21426, 3, 19283, }, - { 3, 21514, 3, 19362, }, - { 3, 21339, 3, 19205, }, - } }, - { 2452, { - { 3, 21382, 3, 19244, }, - { 3, 21470, 3, 19323, }, - { 3, 21295, 3, 19166, }, - } }, - { 2457, { - { 3, 21339, 3, 19205, }, - { 3, 21426, 3, 19283, }, - { 3, 21252, 3, 19127, }, - } }, - { 2462, { - { 3, 21295, 3, 19166, }, - { 3, 21382, 3, 19244, }, - { 3, 21209, 3, 19088, }, - } }, - { 2467, { - { 3, 21252, 3, 19127, }, - { 3, 21339, 3, 19205, }, - { 3, 21166, 3, 19050, }, - } }, - { 2472, { - { 3, 21209, 3, 19088, }, - { 3, 21295, 3, 19166, }, - { 3, 21124, 3, 19011, }, - } }, - { 2484, { - { 3, 21107, 3, 18996, }, - { 3, 21192, 3, 19073, }, - { 3, 21022, 3, 18920, }, - } }, - { 4920, { - { 4, 21313, 4, 19181, }, - { 4, 21356, 4, 19220, }, - { 4, 21269, 4, 19142, }, - } }, - { 4940, { - { 4, 21226, 4, 19104, }, - { 4, 21269, 4, 19142, }, - { 4, 21183, 4, 19065, }, - } }, - { 4960, { - { 4, 21141, 4, 19027, }, - { 4, 21183, 4, 19065, }, - { 4, 21098, 4, 18988, }, - } }, - { 4980, { - { 4, 21056, 4, 18950, }, - { 4, 21098, 4, 18988, }, - { 4, 21014, 4, 18912, }, - } }, - { 5040, { - { 4, 20805, 4, 18725, }, - { 4, 20846, 4, 18762, }, - { 4, 20764, 4, 18687, }, - } }, - { 5060, { - { 4, 20723, 4, 18651, }, - { 4, 20764, 4, 18687, }, - { 4, 20682, 4, 18614, }, - } }, - { 5080, { - { 4, 20641, 4, 18577, }, - { 4, 20682, 4, 18614, }, - { 4, 20601, 4, 18541, }, - } }, - { 5180, { - { 4, 20243, 4, 18219, }, - { 4, 20282, 4, 18254, }, - { 4, 20204, 4, 18183, }, - } }, - { 5200, { - { 4, 20165, 4, 18148, }, - { 4, 20204, 4, 18183, }, - { 4, 20126, 4, 18114, }, - } }, - { 5220, { - { 4, 20088, 4, 18079, }, - { 4, 20126, 4, 18114, }, - { 4, 20049, 4, 18044, }, - } }, - { 5240, { - { 4, 20011, 4, 18010, }, - { 4, 20049, 4, 18044, }, - { 4, 19973, 4, 17976, }, - } }, - { 5260, { - { 4, 19935, 4, 17941, }, - { 4, 19973, 4, 17976, }, - { 4, 19897, 4, 17907, }, - } }, - { 5280, { - { 4, 19859, 4, 17873, }, - { 4, 19897, 4, 17907, }, - { 4, 19822, 4, 17840, }, - } }, - { 5300, { - { 4, 19784, 4, 17806, }, - { 4, 19822, 4, 17840, }, - { 4, 19747, 4, 17772, }, - } }, - { 5320, { - { 4, 19710, 4, 17739, }, - { 4, 19747, 4, 17772, }, - { 4, 19673, 4, 17706, }, - } }, - { 5500, { - { 4, 19065, 4, 17159, }, - { 4, 19100, 4, 17190, }, - { 4, 19030, 4, 17127, }, - } }, - { 5520, { - { 4, 18996, 4, 17096, }, - { 4, 19030, 4, 17127, }, - { 4, 18962, 4, 17065, }, - } }, - { 5540, { - { 4, 18927, 4, 17035, }, - { 4, 18962, 4, 17065, }, - { 4, 18893, 4, 17004, }, - } }, - { 5560, { - { 4, 18859, 4, 16973, }, - { 4, 18893, 4, 17004, }, - { 4, 18825, 4, 16943, }, - } }, - { 5580, { - { 4, 18792, 4, 16913, }, - { 4, 18825, 4, 16943, }, - { 4, 18758, 4, 16882, }, - } }, - { 5600, { - { 4, 18725, 4, 16852, }, - { 4, 18758, 4, 16882, }, - { 4, 18691, 4, 16822, }, - } }, - { 5620, { - { 4, 18658, 4, 16792, }, - { 4, 18691, 4, 16822, }, - { 4, 18625, 4, 16762, }, - } }, - { 5640, { - { 4, 18592, 4, 16733, }, - { 4, 18625, 4, 16762, }, - { 4, 18559, 4, 16703, }, - } }, - { 5660, { - { 4, 18526, 4, 16673, }, - { 4, 18559, 4, 16703, }, - { 4, 18493, 4, 16644, }, - } }, - { 5680, { - { 4, 18461, 4, 16615, }, - { 4, 18493, 4, 16644, }, - { 4, 18428, 4, 16586, }, - } }, - { 5700, { - { 4, 18396, 4, 16556, }, - { 4, 18428, 4, 16586, }, - { 4, 18364, 4, 16527, }, - } }, - { 5745, { - { 4, 18252, 4, 16427, }, - { 4, 18284, 4, 16455, }, - { 4, 18220, 4, 16398, }, - } }, - { 5765, { - { 4, 18189, 5, 32740, }, - { 4, 18220, 4, 16398, }, - { 4, 18157, 5, 32683, }, - } }, - { 5785, { - { 4, 18126, 5, 32626, }, - { 4, 18157, 5, 32683, }, - { 4, 18094, 5, 32570, }, - } }, - { 5805, { - { 4, 18063, 5, 32514, }, - { 4, 18094, 5, 32570, }, - { 4, 18032, 5, 32458, }, - } }, - { 5825, { - { 4, 18001, 5, 32402, }, - { 4, 18032, 5, 32458, }, - { 4, 17970, 5, 32347, }, - } }, - { 5170, { - { 4, 20282, 4, 18254, }, - { 4, 20321, 4, 18289, }, - { 4, 20243, 4, 18219, }, - } }, - { 5190, { - { 4, 20204, 4, 18183, }, - { 4, 20243, 4, 18219, }, - { 4, 20165, 4, 18148, }, - } }, - { 5210, { - { 4, 20126, 4, 18114, }, - { 4, 20165, 4, 18148, }, - { 4, 20088, 4, 18079, }, - } }, - { 5230, { - { 4, 20049, 4, 18044, }, - { 4, 20088, 4, 18079, }, - { 4, 20011, 4, 18010, }, - } }, -}; - -static int carl9170_init_rf_bank4_pwr(struct ar9170 *ar, bool band5ghz, - u32 freq, enum carl9170_bw bw) -{ - int err; - u32 d0, d1, td0, td1, fd0, fd1; - u8 chansel; - u8 refsel0 = 1, refsel1 = 0; - u8 lf_synth = 0; - - switch (bw) { - case CARL9170_BW_40_ABOVE: - freq += 10; - break; - case CARL9170_BW_40_BELOW: - freq -= 10; - break; - case CARL9170_BW_20: - break; - default: - BUG(); - return -ENOSYS; - } - - if (band5ghz) { - if (freq % 10) { - chansel = (freq - 4800) / 5; - } else { - chansel = ((freq - 4800) / 10) * 2; - refsel0 = 0; - refsel1 = 1; - } - chansel = byte_rev_table[chansel]; - } else { - if (freq == 2484) { - chansel = 10 + (freq - 2274) / 5; - lf_synth = 1; - } else - chansel = 16 + (freq - 2272) / 5; - chansel *= 4; - chansel = byte_rev_table[chansel]; - } - - d1 = chansel; - d0 = 0x21 | - refsel0 << 3 | - refsel1 << 2 | - lf_synth << 1; - td0 = d0 & 0x1f; - td1 = d1 & 0x1f; - fd0 = td1 << 5 | td0; - - td0 = (d0 >> 5) & 0x7; - td1 = (d1 >> 5) & 0x7; - fd1 = td1 << 5 | td0; - - carl9170_regwrite_begin(ar); - - carl9170_regwrite(0x1c58b0, fd0); - carl9170_regwrite(0x1c58e8, fd1); - - carl9170_regwrite_finish(); - err = carl9170_regwrite_result(); - if (err) - return err; - - return 0; -} - -static const struct carl9170_phy_freq_params * -carl9170_get_hw_dyn_params(struct ieee80211_channel *channel, - enum carl9170_bw bw) -{ - unsigned int chanidx = 0; - u16 freq = 2412; - - if (channel) { - chanidx = channel->hw_value; - freq = channel->center_freq; - } - - BUG_ON(chanidx >= ARRAY_SIZE(carl9170_phy_freq_params)); - - BUILD_BUG_ON(__CARL9170_NUM_BW != 3); - - WARN_ON(carl9170_phy_freq_params[chanidx].freq != freq); - - return &carl9170_phy_freq_params[chanidx].params[bw]; -} - -static int carl9170_find_freq_idx(int nfreqs, u8 *freqs, u8 f) -{ - int idx = nfreqs - 2; - - while (idx >= 0) { - if (f >= freqs[idx]) - return idx; - idx--; - } - - return 0; -} - -static s32 carl9170_interpolate_s32(s32 x, s32 x1, s32 y1, s32 x2, s32 y2) -{ - /* nothing to interpolate, it's horizontal */ - if (y2 == y1) - return y1; - - /* check if we hit one of the edges */ - if (x == x1) - return y1; - if (x == x2) - return y2; - - /* x1 == x2 is bad, hopefully == x */ - if (x2 == x1) - return y1; - - return y1 + (((y2 - y1) * (x - x1)) / (x2 - x1)); -} - -static u8 carl9170_interpolate_u8(u8 x, u8 x1, u8 y1, u8 x2, u8 y2) -{ -#define SHIFT 8 - s32 y; - - y = carl9170_interpolate_s32(x << SHIFT, x1 << SHIFT, - y1 << SHIFT, x2 << SHIFT, y2 << SHIFT); - - /* - * XXX: unwrap this expression - * Isn't it just DIV_ROUND_UP(y, 1<> SHIFT) + ((y & (1 << (SHIFT - 1))) >> (SHIFT - 1)); -#undef SHIFT -} - -static u8 carl9170_interpolate_val(u8 x, u8 *x_array, u8 *y_array) -{ - int i; - - for (i = 0; i < 3; i++) { - if (x <= x_array[i + 1]) - break; - } - - return carl9170_interpolate_u8(x, x_array[i], y_array[i], - x_array[i + 1], y_array[i + 1]); -} - -static int carl9170_set_freq_cal_data(struct ar9170 *ar, - struct ieee80211_channel *channel) -{ - u8 *cal_freq_pier; - u8 vpds[2][AR5416_PD_GAIN_ICEPTS]; - u8 pwrs[2][AR5416_PD_GAIN_ICEPTS]; - int chain, idx, i; - u32 phy_data = 0; - u8 f, tmp; - - switch (channel->band) { - case IEEE80211_BAND_2GHZ: - f = channel->center_freq - 2300; - cal_freq_pier = ar->eeprom.cal_freq_pier_2G; - i = AR5416_NUM_2G_CAL_PIERS - 1; - break; - - case IEEE80211_BAND_5GHZ: - f = (channel->center_freq - 4800) / 5; - cal_freq_pier = ar->eeprom.cal_freq_pier_5G; - i = AR5416_NUM_5G_CAL_PIERS - 1; - break; - - default: - return -EINVAL; - break; - } - - for (; i >= 0; i--) { - if (cal_freq_pier[i] != 0xff) - break; - } - if (i < 0) - return -EINVAL; - - idx = carl9170_find_freq_idx(i, cal_freq_pier, f); - - carl9170_regwrite_begin(ar); - - for (chain = 0; chain < AR5416_MAX_CHAINS; chain++) { - for (i = 0; i < AR5416_PD_GAIN_ICEPTS; i++) { - struct ar9170_calibration_data_per_freq *cal_pier_data; - int j; - - switch (channel->band) { - case IEEE80211_BAND_2GHZ: - cal_pier_data = &ar->eeprom. - cal_pier_data_2G[chain][idx]; - break; - - case IEEE80211_BAND_5GHZ: - cal_pier_data = &ar->eeprom. - cal_pier_data_5G[chain][idx]; - break; - - default: - return -EINVAL; - } - - for (j = 0; j < 2; j++) { - vpds[j][i] = carl9170_interpolate_u8(f, - cal_freq_pier[idx], - cal_pier_data->vpd_pdg[j][i], - cal_freq_pier[idx + 1], - cal_pier_data[1].vpd_pdg[j][i]); - - pwrs[j][i] = carl9170_interpolate_u8(f, - cal_freq_pier[idx], - cal_pier_data->pwr_pdg[j][i], - cal_freq_pier[idx + 1], - cal_pier_data[1].pwr_pdg[j][i]) / 2; - } - } - - for (i = 0; i < 76; i++) { - if (i < 25) { - tmp = carl9170_interpolate_val(i, &pwrs[0][0], - &vpds[0][0]); - } else { - tmp = carl9170_interpolate_val(i - 12, - &pwrs[1][0], - &vpds[1][0]); - } - - phy_data |= tmp << ((i & 3) << 3); - if ((i & 3) == 3) { - carl9170_regwrite(0x1c6280 + chain * 0x1000 + - (i & ~3), phy_data); - phy_data = 0; - } - } - - for (i = 19; i < 32; i++) - carl9170_regwrite(0x1c6280 + chain * 0x1000 + (i << 2), - 0x0); - } - - carl9170_regwrite_finish(); - return carl9170_regwrite_result(); -} - -static u8 carl9170_get_max_edge_power(struct ar9170 *ar, - u32 freq, struct ar9170_calctl_edges edges[]) -{ - int i; - u8 rc = AR5416_MAX_RATE_POWER; - u8 f; - if (freq < 3000) - f = freq - 2300; - else - f = (freq - 4800) / 5; - - for (i = 0; i < AR5416_NUM_BAND_EDGES; i++) { - if (edges[i].channel == 0xff) - break; - if (f == edges[i].channel) { - /* exact freq match */ - rc = edges[i].power_flags & ~AR9170_CALCTL_EDGE_FLAGS; - break; - } - if (i > 0 && f < edges[i].channel) { - if (f > edges[i - 1].channel && - edges[i - 1].power_flags & - AR9170_CALCTL_EDGE_FLAGS) { - /* lower channel has the inband flag set */ - rc = edges[i - 1].power_flags & - ~AR9170_CALCTL_EDGE_FLAGS; - } - break; - } - } - - if (i == AR5416_NUM_BAND_EDGES) { - if (f > edges[i - 1].channel && - edges[i - 1].power_flags & AR9170_CALCTL_EDGE_FLAGS) { - /* lower channel has the inband flag set */ - rc = edges[i - 1].power_flags & - ~AR9170_CALCTL_EDGE_FLAGS; - } - } - return rc; -} - -static u8 carl9170_get_heavy_clip(struct ar9170 *ar, u32 freq, - enum carl9170_bw bw, struct ar9170_calctl_edges edges[]) -{ - u8 f; - int i; - u8 rc = 0; - - if (freq < 3000) - f = freq - 2300; - else - f = (freq - 4800) / 5; - - if (bw == CARL9170_BW_40_BELOW || bw == CARL9170_BW_40_ABOVE) - rc |= 0xf0; - - for (i = 0; i < AR5416_NUM_BAND_EDGES; i++) { - if (edges[i].channel == 0xff) - break; - if (f == edges[i].channel) { - if (!(edges[i].power_flags & AR9170_CALCTL_EDGE_FLAGS)) - rc |= 0x0f; - break; - } - } - - return rc; -} - -/* - * calculate the conformance test limits and the heavy clip parameter - * and apply them to ar->power* (derived from otus hal/hpmain.c, line 3706) - */ -static void carl9170_calc_ctl(struct ar9170 *ar, u32 freq, enum carl9170_bw bw) -{ - u8 ctl_grp; /* CTL group */ - u8 ctl_idx; /* CTL index */ - int i, j; - struct ctl_modes { - u8 ctl_mode; - u8 max_power; - u8 *pwr_cal_data; - int pwr_cal_len; - } *modes; - - /* - * order is relevant in the mode_list_*: we fall back to the - * lower indices if any mode is missed in the EEPROM. - */ - struct ctl_modes mode_list_2ghz[] = { - { CTL_11B, 0, ar->power_2G_cck, 4 }, - { CTL_11G, 0, ar->power_2G_ofdm, 4 }, - { CTL_2GHT20, 0, ar->power_2G_ht20, 8 }, - { CTL_2GHT40, 0, ar->power_2G_ht40, 8 }, - }; - struct ctl_modes mode_list_5ghz[] = { - { CTL_11A, 0, ar->power_5G_leg, 4 }, - { CTL_5GHT20, 0, ar->power_5G_ht20, 8 }, - { CTL_5GHT40, 0, ar->power_5G_ht40, 8 }, - }; - int nr_modes; - -#define EDGES(c, n) (ar->eeprom.ctl_data[c].control_edges[n]) - - ar->heavy_clip = 0; - - /* - * TODO: investigate the differences between OTUS' - * hpreg.c::zfHpGetRegulatoryDomain() and - * ath/regd.c::ath_regd_get_band_ctl() - - * e.g. for FCC3_WORLD the OTUS procedure - * always returns CTL_FCC, while the one in ath/ delivers - * CTL_ETSI for 2GHz and CTL_FCC for 5GHz. - */ - ctl_grp = ath_regd_get_band_ctl(&ar->common.regulatory, - ar->hw->conf.chandef.chan->band); - - /* ctl group not found - either invalid band (NO_CTL) or ww roaming */ - if (ctl_grp == NO_CTL || ctl_grp == SD_NO_CTL) - ctl_grp = CTL_FCC; - - if (ctl_grp != CTL_FCC) - /* skip CTL and heavy clip for CTL_MKK and CTL_ETSI */ - return; - - if (ar->hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) { - modes = mode_list_2ghz; - nr_modes = ARRAY_SIZE(mode_list_2ghz); - } else { - modes = mode_list_5ghz; - nr_modes = ARRAY_SIZE(mode_list_5ghz); - } - - for (i = 0; i < nr_modes; i++) { - u8 c = ctl_grp | modes[i].ctl_mode; - for (ctl_idx = 0; ctl_idx < AR5416_NUM_CTLS; ctl_idx++) - if (c == ar->eeprom.ctl_index[ctl_idx]) - break; - if (ctl_idx < AR5416_NUM_CTLS) { - int f_off = 0; - - /* - * determine heavy clip parameter - * from the 11G edges array - */ - if (modes[i].ctl_mode == CTL_11G) { - ar->heavy_clip = - carl9170_get_heavy_clip(ar, - freq, bw, EDGES(ctl_idx, 1)); - } - - /* adjust freq for 40MHz */ - if (modes[i].ctl_mode == CTL_2GHT40 || - modes[i].ctl_mode == CTL_5GHT40) { - if (bw == CARL9170_BW_40_BELOW) - f_off = -10; - else - f_off = 10; - } - - modes[i].max_power = - carl9170_get_max_edge_power(ar, - freq + f_off, EDGES(ctl_idx, 1)); - - /* - * TODO: check if the regulatory max. power is - * controlled by cfg80211 for DFS. - * (hpmain applies it to max_power itself for DFS freq) - */ - - } else { - /* - * Workaround in otus driver, hpmain.c, line 3906: - * if no data for 5GHT20 are found, take the - * legacy 5G value. We extend this here to fallback - * from any other HT* or 11G, too. - */ - int k = i; - - modes[i].max_power = AR5416_MAX_RATE_POWER; - while (k-- > 0) { - if (modes[k].max_power != - AR5416_MAX_RATE_POWER) { - modes[i].max_power = modes[k].max_power; - break; - } - } - } - - /* apply max power to pwr_cal_data (ar->power_*) */ - for (j = 0; j < modes[i].pwr_cal_len; j++) { - modes[i].pwr_cal_data[j] = min(modes[i].pwr_cal_data[j], - modes[i].max_power); - } - } - - if (ar->heavy_clip & 0xf0) { - ar->power_2G_ht40[0]--; - ar->power_2G_ht40[1]--; - ar->power_2G_ht40[2]--; - } - if (ar->heavy_clip & 0xf) { - ar->power_2G_ht20[0]++; - ar->power_2G_ht20[1]++; - ar->power_2G_ht20[2]++; - } - -#undef EDGES -} - -static void carl9170_set_power_cal(struct ar9170 *ar, u32 freq, - enum carl9170_bw bw) -{ - struct ar9170_calibration_target_power_legacy *ctpl; - struct ar9170_calibration_target_power_ht *ctph; - u8 *ctpres; - int ntargets; - int idx, i, n; - u8 f; - u8 pwr_freqs[AR5416_MAX_NUM_TGT_PWRS]; - - if (freq < 3000) - f = freq - 2300; - else - f = (freq - 4800) / 5; - - /* - * cycle through the various modes - * - * legacy modes first: 5G, 2G CCK, 2G OFDM - */ - for (i = 0; i < 3; i++) { - switch (i) { - case 0: /* 5 GHz legacy */ - ctpl = &ar->eeprom.cal_tgt_pwr_5G[0]; - ntargets = AR5416_NUM_5G_TARGET_PWRS; - ctpres = ar->power_5G_leg; - break; - case 1: /* 2.4 GHz CCK */ - ctpl = &ar->eeprom.cal_tgt_pwr_2G_cck[0]; - ntargets = AR5416_NUM_2G_CCK_TARGET_PWRS; - ctpres = ar->power_2G_cck; - break; - case 2: /* 2.4 GHz OFDM */ - ctpl = &ar->eeprom.cal_tgt_pwr_2G_ofdm[0]; - ntargets = AR5416_NUM_2G_OFDM_TARGET_PWRS; - ctpres = ar->power_2G_ofdm; - break; - default: - BUG(); - } - - for (n = 0; n < ntargets; n++) { - if (ctpl[n].freq == 0xff) - break; - pwr_freqs[n] = ctpl[n].freq; - } - ntargets = n; - idx = carl9170_find_freq_idx(ntargets, pwr_freqs, f); - for (n = 0; n < 4; n++) - ctpres[n] = carl9170_interpolate_u8(f, - ctpl[idx + 0].freq, ctpl[idx + 0].power[n], - ctpl[idx + 1].freq, ctpl[idx + 1].power[n]); - } - - /* HT modes now: 5G HT20, 5G HT40, 2G CCK, 2G OFDM, 2G HT20, 2G HT40 */ - for (i = 0; i < 4; i++) { - switch (i) { - case 0: /* 5 GHz HT 20 */ - ctph = &ar->eeprom.cal_tgt_pwr_5G_ht20[0]; - ntargets = AR5416_NUM_5G_TARGET_PWRS; - ctpres = ar->power_5G_ht20; - break; - case 1: /* 5 GHz HT 40 */ - ctph = &ar->eeprom.cal_tgt_pwr_5G_ht40[0]; - ntargets = AR5416_NUM_5G_TARGET_PWRS; - ctpres = ar->power_5G_ht40; - break; - case 2: /* 2.4 GHz HT 20 */ - ctph = &ar->eeprom.cal_tgt_pwr_2G_ht20[0]; - ntargets = AR5416_NUM_2G_OFDM_TARGET_PWRS; - ctpres = ar->power_2G_ht20; - break; - case 3: /* 2.4 GHz HT 40 */ - ctph = &ar->eeprom.cal_tgt_pwr_2G_ht40[0]; - ntargets = AR5416_NUM_2G_OFDM_TARGET_PWRS; - ctpres = ar->power_2G_ht40; - break; - default: - BUG(); - } - - for (n = 0; n < ntargets; n++) { - if (ctph[n].freq == 0xff) - break; - pwr_freqs[n] = ctph[n].freq; - } - ntargets = n; - idx = carl9170_find_freq_idx(ntargets, pwr_freqs, f); - for (n = 0; n < 8; n++) - ctpres[n] = carl9170_interpolate_u8(f, - ctph[idx + 0].freq, ctph[idx + 0].power[n], - ctph[idx + 1].freq, ctph[idx + 1].power[n]); - } - - /* calc. conformance test limits and apply to ar->power*[] */ - carl9170_calc_ctl(ar, freq, bw); -} - -int carl9170_get_noisefloor(struct ar9170 *ar) -{ - static const u32 phy_regs[] = { - AR9170_PHY_REG_CCA, AR9170_PHY_REG_CH2_CCA, - AR9170_PHY_REG_EXT_CCA, AR9170_PHY_REG_CH2_EXT_CCA }; - u32 phy_res[ARRAY_SIZE(phy_regs)]; - int err, i; - - BUILD_BUG_ON(ARRAY_SIZE(phy_regs) != ARRAY_SIZE(ar->noise)); - - err = carl9170_read_mreg(ar, ARRAY_SIZE(phy_regs), phy_regs, phy_res); - if (err) - return err; - - for (i = 0; i < 2; i++) { - ar->noise[i] = sign_extend32(GET_VAL( - AR9170_PHY_CCA_MIN_PWR, phy_res[i]), 8); - - ar->noise[i + 2] = sign_extend32(GET_VAL( - AR9170_PHY_EXT_CCA_MIN_PWR, phy_res[i + 2]), 8); - } - - if (ar->channel) - ar->survey[ar->channel->hw_value].noise = ar->noise[0]; - - return 0; -} - -static enum carl9170_bw nl80211_to_carl(enum nl80211_channel_type type) -{ - switch (type) { - case NL80211_CHAN_NO_HT: - case NL80211_CHAN_HT20: - return CARL9170_BW_20; - case NL80211_CHAN_HT40MINUS: - return CARL9170_BW_40_BELOW; - case NL80211_CHAN_HT40PLUS: - return CARL9170_BW_40_ABOVE; - default: - BUG(); - } -} - -int carl9170_set_channel(struct ar9170 *ar, struct ieee80211_channel *channel, - enum nl80211_channel_type _bw) -{ - const struct carl9170_phy_freq_params *freqpar; - struct carl9170_rf_init_result rf_res; - struct carl9170_rf_init rf; - u32 tmp, offs = 0, new_ht = 0; - int err; - enum carl9170_bw bw; - struct ieee80211_channel *old_channel = NULL; - - bw = nl80211_to_carl(_bw); - - if (conf_is_ht(&ar->hw->conf)) - new_ht |= CARL9170FW_PHY_HT_ENABLE; - - if (conf_is_ht40(&ar->hw->conf)) - new_ht |= CARL9170FW_PHY_HT_DYN2040; - - /* may be NULL at first setup */ - if (ar->channel) { - old_channel = ar->channel; - ar->channel = NULL; - } - - /* cold reset BB/ADDA */ - err = carl9170_write_reg(ar, AR9170_PWR_REG_RESET, - AR9170_PWR_RESET_BB_COLD_RESET); - if (err) - return err; - - err = carl9170_write_reg(ar, AR9170_PWR_REG_RESET, 0x0); - if (err) - return err; - - err = carl9170_init_phy(ar, channel->band); - if (err) - return err; - - err = carl9170_init_rf_banks_0_7(ar, - channel->band == IEEE80211_BAND_5GHZ); - if (err) - return err; - - err = carl9170_exec_cmd(ar, CARL9170_CMD_FREQ_START, 0, NULL, 0, NULL); - if (err) - return err; - - err = carl9170_write_reg(ar, AR9170_PHY_REG_HEAVY_CLIP_ENABLE, - 0x200); - if (err) - return err; - - err = carl9170_init_rf_bank4_pwr(ar, - channel->band == IEEE80211_BAND_5GHZ, - channel->center_freq, bw); - if (err) - return err; - - tmp = AR9170_PHY_TURBO_FC_SINGLE_HT_LTF1 | - AR9170_PHY_TURBO_FC_HT_EN; - - switch (bw) { - case CARL9170_BW_20: - break; - case CARL9170_BW_40_BELOW: - tmp |= AR9170_PHY_TURBO_FC_DYN2040_EN | - AR9170_PHY_TURBO_FC_SHORT_GI_40; - offs = 3; - break; - case CARL9170_BW_40_ABOVE: - tmp |= AR9170_PHY_TURBO_FC_DYN2040_EN | - AR9170_PHY_TURBO_FC_SHORT_GI_40 | - AR9170_PHY_TURBO_FC_DYN2040_PRI_CH; - offs = 1; - break; - default: - BUG(); - return -ENOSYS; - } - - if (ar->eeprom.tx_mask != 1) - tmp |= AR9170_PHY_TURBO_FC_WALSH; - - err = carl9170_write_reg(ar, AR9170_PHY_REG_TURBO, tmp); - if (err) - return err; - - err = carl9170_set_freq_cal_data(ar, channel); - if (err) - return err; - - carl9170_set_power_cal(ar, channel->center_freq, bw); - - err = carl9170_set_mac_tpc(ar, channel); - if (err) - return err; - - freqpar = carl9170_get_hw_dyn_params(channel, bw); - - rf.ht_settings = new_ht; - if (conf_is_ht40(&ar->hw->conf)) - SET_VAL(CARL9170FW_PHY_HT_EXT_CHAN_OFF, rf.ht_settings, offs); - - rf.freq = cpu_to_le32(channel->center_freq * 1000); - rf.delta_slope_coeff_exp = cpu_to_le32(freqpar->coeff_exp); - rf.delta_slope_coeff_man = cpu_to_le32(freqpar->coeff_man); - rf.delta_slope_coeff_exp_shgi = cpu_to_le32(freqpar->coeff_exp_shgi); - rf.delta_slope_coeff_man_shgi = cpu_to_le32(freqpar->coeff_man_shgi); - rf.finiteLoopCount = cpu_to_le32(2000); - err = carl9170_exec_cmd(ar, CARL9170_CMD_RF_INIT, sizeof(rf), &rf, - sizeof(rf_res), &rf_res); - if (err) - return err; - - err = le32_to_cpu(rf_res.ret); - if (err != 0) { - ar->chan_fail++; - ar->total_chan_fail++; - - wiphy_err(ar->hw->wiphy, "channel change: %d -> %d " - "failed (%d).\n", old_channel ? - old_channel->center_freq : -1, channel->center_freq, - err); - - if (ar->chan_fail > 3) { - /* We have tried very hard to change to _another_ - * channel and we've failed to do so! - * Chances are that the PHY/RF is no longer - * operable (due to corruptions/fatal events/bugs?) - * and we need to reset at a higher level. - */ - carl9170_restart(ar, CARL9170_RR_TOO_MANY_PHY_ERRORS); - return 0; - } - - err = carl9170_set_channel(ar, channel, _bw); - if (err) - return err; - } else { - ar->chan_fail = 0; - } - - if (ar->heavy_clip) { - err = carl9170_write_reg(ar, AR9170_PHY_REG_HEAVY_CLIP_ENABLE, - 0x200 | ar->heavy_clip); - if (err) { - if (net_ratelimit()) { - wiphy_err(ar->hw->wiphy, "failed to set " - "heavy clip\n"); - } - - return err; - } - } - - ar->channel = channel; - ar->ht_settings = new_ht; - return 0; -} diff --git a/drivers/net/wireless/ath/carl9170/phy.h b/drivers/net/wireless/ath/carl9170/phy.h deleted file mode 100644 index 024fb42bc787..000000000000 --- a/drivers/net/wireless/ath/carl9170/phy.h +++ /dev/null @@ -1,564 +0,0 @@ -/* - * Shared Atheros AR9170 Header - * - * PHY register map - * - * Copyright (c) 2008-2009 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef __CARL9170_SHARED_PHY_H -#define __CARL9170_SHARED_PHY_H - -#define AR9170_PHY_REG_BASE (0x1bc000 + 0x9800) -#define AR9170_PHY_REG(_n) (AR9170_PHY_REG_BASE + \ - ((_n) << 2)) - -#define AR9170_PHY_REG_TEST (AR9170_PHY_REG_BASE + 0x0000) -#define AR9170_PHY_TEST_AGC_CLR 0x10000000 -#define AR9170_PHY_TEST_RFSILENT_BB 0x00002000 - -#define AR9170_PHY_REG_TURBO (AR9170_PHY_REG_BASE + 0x0004) -#define AR9170_PHY_TURBO_FC_TURBO_MODE 0x00000001 -#define AR9170_PHY_TURBO_FC_TURBO_SHORT 0x00000002 -#define AR9170_PHY_TURBO_FC_DYN2040_EN 0x00000004 -#define AR9170_PHY_TURBO_FC_DYN2040_PRI_ONLY 0x00000008 -#define AR9170_PHY_TURBO_FC_DYN2040_PRI_CH 0x00000010 -/* For 25 MHz channel spacing -- not used but supported by hw */ -#define AR9170_PHY_TURBO_FC_DYN2040_EXT_CH 0x00000020 -#define AR9170_PHY_TURBO_FC_HT_EN 0x00000040 -#define AR9170_PHY_TURBO_FC_SHORT_GI_40 0x00000080 -#define AR9170_PHY_TURBO_FC_WALSH 0x00000100 -#define AR9170_PHY_TURBO_FC_SINGLE_HT_LTF1 0x00000200 -#define AR9170_PHY_TURBO_FC_ENABLE_DAC_FIFO 0x00000800 - -#define AR9170_PHY_REG_TEST2 (AR9170_PHY_REG_BASE + 0x0008) - -#define AR9170_PHY_REG_TIMING2 (AR9170_PHY_REG_BASE + 0x0010) -#define AR9170_PHY_TIMING2_USE_FORCE 0x00001000 -#define AR9170_PHY_TIMING2_FORCE 0x00000fff -#define AR9170_PHY_TIMING2_FORCE_S 0 - -#define AR9170_PHY_REG_TIMING3 (AR9170_PHY_REG_BASE + 0x0014) -#define AR9170_PHY_TIMING3_DSC_EXP 0x0001e000 -#define AR9170_PHY_TIMING3_DSC_EXP_S 13 -#define AR9170_PHY_TIMING3_DSC_MAN 0xfffe0000 -#define AR9170_PHY_TIMING3_DSC_MAN_S 17 - -#define AR9170_PHY_REG_CHIP_ID (AR9170_PHY_REG_BASE + 0x0018) -#define AR9170_PHY_CHIP_ID_REV_0 0x80 -#define AR9170_PHY_CHIP_ID_REV_1 0x81 -#define AR9170_PHY_CHIP_ID_9160_REV_0 0xb0 - -#define AR9170_PHY_REG_ACTIVE (AR9170_PHY_REG_BASE + 0x001c) -#define AR9170_PHY_ACTIVE_EN 0x00000001 -#define AR9170_PHY_ACTIVE_DIS 0x00000000 - -#define AR9170_PHY_REG_RF_CTL2 (AR9170_PHY_REG_BASE + 0x0024) -#define AR9170_PHY_RF_CTL2_TX_END_DATA_START 0x000000ff -#define AR9170_PHY_RF_CTL2_TX_END_DATA_START_S 0 -#define AR9170_PHY_RF_CTL2_TX_END_PA_ON 0x0000ff00 -#define AR9170_PHY_RF_CTL2_TX_END_PA_ON_S 8 - -#define AR9170_PHY_REG_RF_CTL3 (AR9170_PHY_REG_BASE + 0x0028) -#define AR9170_PHY_RF_CTL3_TX_END_TO_A2_RX_ON 0x00ff0000 -#define AR9170_PHY_RF_CTL3_TX_END_TO_A2_RX_ON_S 16 - -#define AR9170_PHY_REG_ADC_CTL (AR9170_PHY_REG_BASE + 0x002c) -#define AR9170_PHY_ADC_CTL_OFF_INBUFGAIN 0x00000003 -#define AR9170_PHY_ADC_CTL_OFF_INBUFGAIN_S 0 -#define AR9170_PHY_ADC_CTL_OFF_PWDDAC 0x00002000 -#define AR9170_PHY_ADC_CTL_OFF_PWDBANDGAP 0x00004000 -#define AR9170_PHY_ADC_CTL_OFF_PWDADC 0x00008000 -#define AR9170_PHY_ADC_CTL_ON_INBUFGAIN 0x00030000 -#define AR9170_PHY_ADC_CTL_ON_INBUFGAIN_S 16 - -#define AR9170_PHY_REG_ADC_SERIAL_CTL (AR9170_PHY_REG_BASE + 0x0030) -#define AR9170_PHY_ADC_SCTL_SEL_INTERNAL_ADDAC 0x00000000 -#define AR9170_PHY_ADC_SCTL_SEL_EXTERNAL_RADIO 0x00000001 - -#define AR9170_PHY_REG_RF_CTL4 (AR9170_PHY_REG_BASE + 0x0034) -#define AR9170_PHY_RF_CTL4_TX_END_XPAB_OFF 0xff000000 -#define AR9170_PHY_RF_CTL4_TX_END_XPAB_OFF_S 24 -#define AR9170_PHY_RF_CTL4_TX_END_XPAA_OFF 0x00ff0000 -#define AR9170_PHY_RF_CTL4_TX_END_XPAA_OFF_S 16 -#define AR9170_PHY_RF_CTL4_FRAME_XPAB_ON 0x0000ff00 -#define AR9170_PHY_RF_CTL4_FRAME_XPAB_ON_S 8 -#define AR9170_PHY_RF_CTL4_FRAME_XPAA_ON 0x000000ff -#define AR9170_PHY_RF_CTL4_FRAME_XPAA_ON_S 0 - -#define AR9170_PHY_REG_TSTDAC_CONST (AR9170_PHY_REG_BASE + 0x003c) - -#define AR9170_PHY_REG_SETTLING (AR9170_PHY_REG_BASE + 0x0044) -#define AR9170_PHY_SETTLING_SWITCH 0x00003f80 -#define AR9170_PHY_SETTLING_SWITCH_S 7 - -#define AR9170_PHY_REG_RXGAIN (AR9170_PHY_REG_BASE + 0x0048) -#define AR9170_PHY_REG_RXGAIN_CHAIN_2 (AR9170_PHY_REG_BASE + 0x2048) -#define AR9170_PHY_RXGAIN_TXRX_ATTEN 0x0003f000 -#define AR9170_PHY_RXGAIN_TXRX_ATTEN_S 12 -#define AR9170_PHY_RXGAIN_TXRX_RF_MAX 0x007c0000 -#define AR9170_PHY_RXGAIN_TXRX_RF_MAX_S 18 - -#define AR9170_PHY_REG_DESIRED_SZ (AR9170_PHY_REG_BASE + 0x0050) -#define AR9170_PHY_DESIRED_SZ_ADC 0x000000ff -#define AR9170_PHY_DESIRED_SZ_ADC_S 0 -#define AR9170_PHY_DESIRED_SZ_PGA 0x0000ff00 -#define AR9170_PHY_DESIRED_SZ_PGA_S 8 -#define AR9170_PHY_DESIRED_SZ_TOT_DES 0x0ff00000 -#define AR9170_PHY_DESIRED_SZ_TOT_DES_S 20 - -#define AR9170_PHY_REG_FIND_SIG (AR9170_PHY_REG_BASE + 0x0058) -#define AR9170_PHY_FIND_SIG_FIRSTEP 0x0003f000 -#define AR9170_PHY_FIND_SIG_FIRSTEP_S 12 -#define AR9170_PHY_FIND_SIG_FIRPWR 0x03fc0000 -#define AR9170_PHY_FIND_SIG_FIRPWR_S 18 - -#define AR9170_PHY_REG_AGC_CTL1 (AR9170_PHY_REG_BASE + 0x005c) -#define AR9170_PHY_AGC_CTL1_COARSE_LOW 0x00007f80 -#define AR9170_PHY_AGC_CTL1_COARSE_LOW_S 7 -#define AR9170_PHY_AGC_CTL1_COARSE_HIGH 0x003f8000 -#define AR9170_PHY_AGC_CTL1_COARSE_HIGH_S 15 - -#define AR9170_PHY_REG_AGC_CONTROL (AR9170_PHY_REG_BASE + 0x0060) -#define AR9170_PHY_AGC_CONTROL_CAL 0x00000001 -#define AR9170_PHY_AGC_CONTROL_NF 0x00000002 -#define AR9170_PHY_AGC_CONTROL_ENABLE_NF 0x00008000 -#define AR9170_PHY_AGC_CONTROL_FLTR_CAL 0x00010000 -#define AR9170_PHY_AGC_CONTROL_NO_UPDATE_NF 0x00020000 - -#define AR9170_PHY_REG_CCA (AR9170_PHY_REG_BASE + 0x0064) -#define AR9170_PHY_CCA_MIN_PWR 0x0ff80000 -#define AR9170_PHY_CCA_MIN_PWR_S 19 -#define AR9170_PHY_CCA_THRESH62 0x0007f000 -#define AR9170_PHY_CCA_THRESH62_S 12 - -#define AR9170_PHY_REG_SFCORR (AR9170_PHY_REG_BASE + 0x0068) -#define AR9170_PHY_SFCORR_M2COUNT_THR 0x0000001f -#define AR9170_PHY_SFCORR_M2COUNT_THR_S 0 -#define AR9170_PHY_SFCORR_M1_THRESH 0x00fe0000 -#define AR9170_PHY_SFCORR_M1_THRESH_S 17 -#define AR9170_PHY_SFCORR_M2_THRESH 0x7f000000 -#define AR9170_PHY_SFCORR_M2_THRESH_S 24 - -#define AR9170_PHY_REG_SFCORR_LOW (AR9170_PHY_REG_BASE + 0x006c) -#define AR9170_PHY_SFCORR_LOW_USE_SELF_CORR_LOW 0x00000001 -#define AR9170_PHY_SFCORR_LOW_M2COUNT_THR_LOW 0x00003f00 -#define AR9170_PHY_SFCORR_LOW_M2COUNT_THR_LOW_S 8 -#define AR9170_PHY_SFCORR_LOW_M1_THRESH_LOW 0x001fc000 -#define AR9170_PHY_SFCORR_LOW_M1_THRESH_LOW_S 14 -#define AR9170_PHY_SFCORR_LOW_M2_THRESH_LOW 0x0fe00000 -#define AR9170_PHY_SFCORR_LOW_M2_THRESH_LOW_S 21 - -#define AR9170_PHY_REG_SLEEP_CTR_CONTROL (AR9170_PHY_REG_BASE + 0x0070) -#define AR9170_PHY_REG_SLEEP_CTR_LIMIT (AR9170_PHY_REG_BASE + 0x0074) -#define AR9170_PHY_REG_SLEEP_SCAL (AR9170_PHY_REG_BASE + 0x0078) - -#define AR9170_PHY_REG_PLL_CTL (AR9170_PHY_REG_BASE + 0x007c) -#define AR9170_PHY_PLL_CTL_40 0xaa -#define AR9170_PHY_PLL_CTL_40_5413 0x04 -#define AR9170_PHY_PLL_CTL_44 0xab -#define AR9170_PHY_PLL_CTL_44_2133 0xeb -#define AR9170_PHY_PLL_CTL_40_2133 0xea - -#define AR9170_PHY_REG_BIN_MASK_1 (AR9170_PHY_REG_BASE + 0x0100) -#define AR9170_PHY_REG_BIN_MASK_2 (AR9170_PHY_REG_BASE + 0x0104) -#define AR9170_PHY_REG_BIN_MASK_3 (AR9170_PHY_REG_BASE + 0x0108) -#define AR9170_PHY_REG_MASK_CTL (AR9170_PHY_REG_BASE + 0x010c) - -/* analogue power on time (100ns) */ -#define AR9170_PHY_REG_RX_DELAY (AR9170_PHY_REG_BASE + 0x0114) -#define AR9170_PHY_REG_SEARCH_START_DELAY (AR9170_PHY_REG_BASE + 0x0118) -#define AR9170_PHY_RX_DELAY_DELAY 0x00003fff - -#define AR9170_PHY_REG_TIMING_CTRL4(_i) (AR9170_PHY_REG_BASE + \ - (0x0120 + ((_i) << 12))) -#define AR9170_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF 0x01f -#define AR9170_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF_S 0 -#define AR9170_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF 0x7e0 -#define AR9170_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF_S 5 -#define AR9170_PHY_TIMING_CTRL4_IQCORR_ENABLE 0x800 -#define AR9170_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX 0xf000 -#define AR9170_PHY_TIMING_CTRL4_IQCAL_LOG_COUNT_MAX_S 12 -#define AR9170_PHY_TIMING_CTRL4_DO_IQCAL 0x10000 -#define AR9170_PHY_TIMING_CTRL4_ENABLE_SPUR_RSSI 0x80000000 -#define AR9170_PHY_TIMING_CTRL4_ENABLE_SPUR_FILTER 0x40000000 -#define AR9170_PHY_TIMING_CTRL4_ENABLE_CHAN_MASK 0x20000000 -#define AR9170_PHY_TIMING_CTRL4_ENABLE_PILOT_MASK 0x10000000 - -#define AR9170_PHY_REG_TIMING5 (AR9170_PHY_REG_BASE + 0x0124) -#define AR9170_PHY_TIMING5_CYCPWR_THR1 0x000000fe -#define AR9170_PHY_TIMING5_CYCPWR_THR1_S 1 - -#define AR9170_PHY_REG_POWER_TX_RATE1 (AR9170_PHY_REG_BASE + 0x0134) -#define AR9170_PHY_REG_POWER_TX_RATE2 (AR9170_PHY_REG_BASE + 0x0138) -#define AR9170_PHY_REG_POWER_TX_RATE_MAX (AR9170_PHY_REG_BASE + 0x013c) -#define AR9170_PHY_POWER_TX_RATE_MAX_TPC_ENABLE 0x00000040 - -#define AR9170_PHY_REG_FRAME_CTL (AR9170_PHY_REG_BASE + 0x0144) -#define AR9170_PHY_FRAME_CTL_TX_CLIP 0x00000038 -#define AR9170_PHY_FRAME_CTL_TX_CLIP_S 3 - -#define AR9170_PHY_REG_SPUR_REG (AR9170_PHY_REG_BASE + 0x014c) -#define AR9170_PHY_SPUR_REG_MASK_RATE_CNTL (0xff << 18) -#define AR9170_PHY_SPUR_REG_MASK_RATE_CNTL_S 18 -#define AR9170_PHY_SPUR_REG_ENABLE_MASK_PPM 0x20000 -#define AR9170_PHY_SPUR_REG_MASK_RATE_SELECT (0xff << 9) -#define AR9170_PHY_SPUR_REG_MASK_RATE_SELECT_S 9 -#define AR9170_PHY_SPUR_REG_ENABLE_VIT_SPUR_RSSI 0x100 -#define AR9170_PHY_SPUR_REG_SPUR_RSSI_THRESH 0x7f -#define AR9170_PHY_SPUR_REG_SPUR_RSSI_THRESH_S 0 - -#define AR9170_PHY_REG_RADAR_EXT (AR9170_PHY_REG_BASE + 0x0140) -#define AR9170_PHY_RADAR_EXT_ENA 0x00004000 - -#define AR9170_PHY_REG_RADAR_0 (AR9170_PHY_REG_BASE + 0x0154) -#define AR9170_PHY_RADAR_0_ENA 0x00000001 -#define AR9170_PHY_RADAR_0_FFT_ENA 0x80000000 -/* inband pulse threshold */ -#define AR9170_PHY_RADAR_0_INBAND 0x0000003e -#define AR9170_PHY_RADAR_0_INBAND_S 1 -/* pulse RSSI threshold */ -#define AR9170_PHY_RADAR_0_PRSSI 0x00000fc0 -#define AR9170_PHY_RADAR_0_PRSSI_S 6 -/* pulse height threshold */ -#define AR9170_PHY_RADAR_0_HEIGHT 0x0003f000 -#define AR9170_PHY_RADAR_0_HEIGHT_S 12 -/* radar RSSI threshold */ -#define AR9170_PHY_RADAR_0_RRSSI 0x00fc0000 -#define AR9170_PHY_RADAR_0_RRSSI_S 18 -/* radar firepower threshold */ -#define AR9170_PHY_RADAR_0_FIRPWR 0x7f000000 -#define AR9170_PHY_RADAR_0_FIRPWR_S 24 - -#define AR9170_PHY_REG_RADAR_1 (AR9170_PHY_REG_BASE + 0x0158) -#define AR9170_PHY_RADAR_1_RELPWR_ENA 0x00800000 -#define AR9170_PHY_RADAR_1_USE_FIR128 0x00400000 -#define AR9170_PHY_RADAR_1_RELPWR_THRESH 0x003f0000 -#define AR9170_PHY_RADAR_1_RELPWR_THRESH_S 16 -#define AR9170_PHY_RADAR_1_BLOCK_CHECK 0x00008000 -#define AR9170_PHY_RADAR_1_MAX_RRSSI 0x00004000 -#define AR9170_PHY_RADAR_1_RELSTEP_CHECK 0x00002000 -#define AR9170_PHY_RADAR_1_RELSTEP_THRESH 0x00001f00 -#define AR9170_PHY_RADAR_1_RELSTEP_THRESH_S 8 -#define AR9170_PHY_RADAR_1_MAXLEN 0x000000ff -#define AR9170_PHY_RADAR_1_MAXLEN_S 0 - -#define AR9170_PHY_REG_SWITCH_CHAIN_0 (AR9170_PHY_REG_BASE + 0x0160) -#define AR9170_PHY_REG_SWITCH_CHAIN_2 (AR9170_PHY_REG_BASE + 0x2160) - -#define AR9170_PHY_REG_SWITCH_COM (AR9170_PHY_REG_BASE + 0x0164) - -#define AR9170_PHY_REG_CCA_THRESHOLD (AR9170_PHY_REG_BASE + 0x0168) - -#define AR9170_PHY_REG_SIGMA_DELTA (AR9170_PHY_REG_BASE + 0x016c) -#define AR9170_PHY_SIGMA_DELTA_ADC_SEL 0x00000003 -#define AR9170_PHY_SIGMA_DELTA_ADC_SEL_S 0 -#define AR9170_PHY_SIGMA_DELTA_FILT2 0x000000f8 -#define AR9170_PHY_SIGMA_DELTA_FILT2_S 3 -#define AR9170_PHY_SIGMA_DELTA_FILT1 0x00001f00 -#define AR9170_PHY_SIGMA_DELTA_FILT1_S 8 -#define AR9170_PHY_SIGMA_DELTA_ADC_CLIP 0x01ffe000 -#define AR9170_PHY_SIGMA_DELTA_ADC_CLIP_S 13 - -#define AR9170_PHY_REG_RESTART (AR9170_PHY_REG_BASE + 0x0170) -#define AR9170_PHY_RESTART_DIV_GC 0x001c0000 -#define AR9170_PHY_RESTART_DIV_GC_S 18 - -#define AR9170_PHY_REG_RFBUS_REQ (AR9170_PHY_REG_BASE + 0x017c) -#define AR9170_PHY_RFBUS_REQ_EN 0x00000001 - -#define AR9170_PHY_REG_TIMING7 (AR9170_PHY_REG_BASE + 0x0180) -#define AR9170_PHY_REG_TIMING8 (AR9170_PHY_REG_BASE + 0x0184) -#define AR9170_PHY_TIMING8_PILOT_MASK_2 0x000fffff -#define AR9170_PHY_TIMING8_PILOT_MASK_2_S 0 - -#define AR9170_PHY_REG_BIN_MASK2_1 (AR9170_PHY_REG_BASE + 0x0188) -#define AR9170_PHY_REG_BIN_MASK2_2 (AR9170_PHY_REG_BASE + 0x018c) -#define AR9170_PHY_REG_BIN_MASK2_3 (AR9170_PHY_REG_BASE + 0x0190) -#define AR9170_PHY_REG_BIN_MASK2_4 (AR9170_PHY_REG_BASE + 0x0194) -#define AR9170_PHY_BIN_MASK2_4_MASK_4 0x00003fff -#define AR9170_PHY_BIN_MASK2_4_MASK_4_S 0 - -#define AR9170_PHY_REG_TIMING9 (AR9170_PHY_REG_BASE + 0x0198) -#define AR9170_PHY_REG_TIMING10 (AR9170_PHY_REG_BASE + 0x019c) -#define AR9170_PHY_TIMING10_PILOT_MASK_2 0x000fffff -#define AR9170_PHY_TIMING10_PILOT_MASK_2_S 0 - -#define AR9170_PHY_REG_TIMING11 (AR9170_PHY_REG_BASE + 0x01a0) -#define AR9170_PHY_TIMING11_SPUR_DELTA_PHASE 0x000fffff -#define AR9170_PHY_TIMING11_SPUR_DELTA_PHASE_S 0 -#define AR9170_PHY_TIMING11_SPUR_FREQ_SD 0x3ff00000 -#define AR9170_PHY_TIMING11_SPUR_FREQ_SD_S 20 -#define AR9170_PHY_TIMING11_USE_SPUR_IN_AGC 0x40000000 -#define AR9170_PHY_TIMING11_USE_SPUR_IN_SELFCOR 0x80000000 - -#define AR9170_PHY_REG_RX_CHAINMASK (AR9170_PHY_REG_BASE + 0x01a4) -#define AR9170_PHY_REG_NEW_ADC_DC_GAIN_CORR(_i) (AR9170_PHY_REG_BASE + \ - 0x01b4 + ((_i) << 12)) -#define AR9170_PHY_NEW_ADC_GAIN_CORR_ENABLE 0x40000000 -#define AR9170_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE 0x80000000 - -#define AR9170_PHY_REG_MULTICHAIN_GAIN_CTL (AR9170_PHY_REG_BASE + 0x01ac) -#define AR9170_PHY_9285_ANT_DIV_CTL_ALL 0x7f000000 -#define AR9170_PHY_9285_ANT_DIV_CTL 0x01000000 -#define AR9170_PHY_9285_ANT_DIV_CTL_S 24 -#define AR9170_PHY_9285_ANT_DIV_ALT_LNACONF 0x06000000 -#define AR9170_PHY_9285_ANT_DIV_ALT_LNACONF_S 25 -#define AR9170_PHY_9285_ANT_DIV_MAIN_LNACONF 0x18000000 -#define AR9170_PHY_9285_ANT_DIV_MAIN_LNACONF_S 27 -#define AR9170_PHY_9285_ANT_DIV_ALT_GAINTB 0x20000000 -#define AR9170_PHY_9285_ANT_DIV_ALT_GAINTB_S 29 -#define AR9170_PHY_9285_ANT_DIV_MAIN_GAINTB 0x40000000 -#define AR9170_PHY_9285_ANT_DIV_MAIN_GAINTB_S 30 -#define AR9170_PHY_9285_ANT_DIV_LNA1 2 -#define AR9170_PHY_9285_ANT_DIV_LNA2 1 -#define AR9170_PHY_9285_ANT_DIV_LNA1_PLUS_LNA2 3 -#define AR9170_PHY_9285_ANT_DIV_LNA1_MINUS_LNA2 0 -#define AR9170_PHY_9285_ANT_DIV_GAINTB_0 0 -#define AR9170_PHY_9285_ANT_DIV_GAINTB_1 1 - -#define AR9170_PHY_REG_EXT_CCA0 (AR9170_PHY_REG_BASE + 0x01b8) -#define AR9170_PHY_REG_EXT_CCA0_THRESH62 0x000000ff -#define AR9170_PHY_REG_EXT_CCA0_THRESH62_S 0 - -#define AR9170_PHY_REG_EXT_CCA (AR9170_PHY_REG_BASE + 0x01bc) -#define AR9170_PHY_EXT_CCA_CYCPWR_THR1 0x0000fe00 -#define AR9170_PHY_EXT_CCA_CYCPWR_THR1_S 9 -#define AR9170_PHY_EXT_CCA_THRESH62 0x007f0000 -#define AR9170_PHY_EXT_CCA_THRESH62_S 16 -#define AR9170_PHY_EXT_CCA_MIN_PWR 0xff800000 -#define AR9170_PHY_EXT_CCA_MIN_PWR_S 23 - -#define AR9170_PHY_REG_SFCORR_EXT (AR9170_PHY_REG_BASE + 0x01c0) -#define AR9170_PHY_SFCORR_EXT_M1_THRESH 0x0000007f -#define AR9170_PHY_SFCORR_EXT_M1_THRESH_S 0 -#define AR9170_PHY_SFCORR_EXT_M2_THRESH 0x00003f80 -#define AR9170_PHY_SFCORR_EXT_M2_THRESH_S 7 -#define AR9170_PHY_SFCORR_EXT_M1_THRESH_LOW 0x001fc000 -#define AR9170_PHY_SFCORR_EXT_M1_THRESH_LOW_S 14 -#define AR9170_PHY_SFCORR_EXT_M2_THRESH_LOW 0x0fe00000 -#define AR9170_PHY_SFCORR_EXT_M2_THRESH_LOW_S 21 -#define AR9170_PHY_SFCORR_SPUR_SUBCHNL_SD_S 28 - -#define AR9170_PHY_REG_HALFGI (AR9170_PHY_REG_BASE + 0x01d0) -#define AR9170_PHY_HALFGI_DSC_MAN 0x0007fff0 -#define AR9170_PHY_HALFGI_DSC_MAN_S 4 -#define AR9170_PHY_HALFGI_DSC_EXP 0x0000000f -#define AR9170_PHY_HALFGI_DSC_EXP_S 0 - -#define AR9170_PHY_REG_CHANNEL_MASK_01_30 (AR9170_PHY_REG_BASE + 0x01d4) -#define AR9170_PHY_REG_CHANNEL_MASK_31_60 (AR9170_PHY_REG_BASE + 0x01d8) - -#define AR9170_PHY_REG_CHAN_INFO_MEMORY (AR9170_PHY_REG_BASE + 0x01dc) -#define AR9170_PHY_CHAN_INFO_MEMORY_CAPTURE_MASK 0x0001 - -#define AR9170_PHY_REG_HEAVY_CLIP_ENABLE (AR9170_PHY_REG_BASE + 0x01e0) -#define AR9170_PHY_REG_HEAVY_CLIP_FACTOR_RIFS (AR9170_PHY_REG_BASE + 0x01ec) -#define AR9170_PHY_RIFS_INIT_DELAY 0x03ff0000 - -#define AR9170_PHY_REG_CALMODE (AR9170_PHY_REG_BASE + 0x01f0) -#define AR9170_PHY_CALMODE_IQ 0x00000000 -#define AR9170_PHY_CALMODE_ADC_GAIN 0x00000001 -#define AR9170_PHY_CALMODE_ADC_DC_PER 0x00000002 -#define AR9170_PHY_CALMODE_ADC_DC_INIT 0x00000003 - -#define AR9170_PHY_REG_REFCLKDLY (AR9170_PHY_REG_BASE + 0x01f4) -#define AR9170_PHY_REG_REFCLKPD (AR9170_PHY_REG_BASE + 0x01f8) - - -#define AR9170_PHY_REG_CAL_MEAS_0(_i) (AR9170_PHY_REG_BASE + \ - 0x0410 + ((_i) << 12)) -#define AR9170_PHY_REG_CAL_MEAS_1(_i) (AR9170_PHY_REG_BASE + \ - 0x0414 \ + ((_i) << 12)) -#define AR9170_PHY_REG_CAL_MEAS_2(_i) (AR9170_PHY_REG_BASE + \ - 0x0418 + ((_i) << 12)) -#define AR9170_PHY_REG_CAL_MEAS_3(_i) (AR9170_PHY_REG_BASE + \ - 0x041c + ((_i) << 12)) - -#define AR9170_PHY_REG_CURRENT_RSSI (AR9170_PHY_REG_BASE + 0x041c) - -#define AR9170_PHY_REG_RFBUS_GRANT (AR9170_PHY_REG_BASE + 0x0420) -#define AR9170_PHY_RFBUS_GRANT_EN 0x00000001 - -#define AR9170_PHY_REG_CHAN_INFO_GAIN_DIFF (AR9170_PHY_REG_BASE + 0x04f4) -#define AR9170_PHY_CHAN_INFO_GAIN_DIFF_UPPER_LIMIT 320 - -#define AR9170_PHY_REG_CHAN_INFO_GAIN (AR9170_PHY_REG_BASE + 0x04fc) - -#define AR9170_PHY_REG_MODE (AR9170_PHY_REG_BASE + 0x0a00) -#define AR9170_PHY_MODE_ASYNCFIFO 0x80 -#define AR9170_PHY_MODE_AR2133 0x08 -#define AR9170_PHY_MODE_AR5111 0x00 -#define AR9170_PHY_MODE_AR5112 0x08 -#define AR9170_PHY_MODE_DYNAMIC 0x04 -#define AR9170_PHY_MODE_RF2GHZ 0x02 -#define AR9170_PHY_MODE_RF5GHZ 0x00 -#define AR9170_PHY_MODE_CCK 0x01 -#define AR9170_PHY_MODE_OFDM 0x00 -#define AR9170_PHY_MODE_DYN_CCK_DISABLE 0x100 - -#define AR9170_PHY_REG_CCK_TX_CTRL (AR9170_PHY_REG_BASE + 0x0a04) -#define AR9170_PHY_CCK_TX_CTRL_JAPAN 0x00000010 -#define AR9170_PHY_CCK_TX_CTRL_TX_DAC_SCALE_CCK 0x0000000c -#define AR9170_PHY_CCK_TX_CTRL_TX_DAC_SCALE_CCK_S 2 - -#define AR9170_PHY_REG_CCK_DETECT (AR9170_PHY_REG_BASE + 0x0a08) -#define AR9170_PHY_CCK_DETECT_WEAK_SIG_THR_CCK 0x0000003f -#define AR9170_PHY_CCK_DETECT_WEAK_SIG_THR_CCK_S 0 -/* [12:6] settling time for antenna switch */ -#define AR9170_PHY_CCK_DETECT_ANT_SWITCH_TIME 0x00001fc0 -#define AR9170_PHY_CCK_DETECT_ANT_SWITCH_TIME_S 6 -#define AR9170_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV 0x2000 -#define AR9170_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV_S 13 - -#define AR9170_PHY_REG_GAIN_2GHZ (AR9170_PHY_REG_BASE + 0x0a0c) -#define AR9170_PHY_REG_GAIN_2GHZ_CHAIN_2 (AR9170_PHY_REG_BASE + 0x2a0c) -#define AR9170_PHY_GAIN_2GHZ_RXTX_MARGIN 0x00fc0000 -#define AR9170_PHY_GAIN_2GHZ_RXTX_MARGIN_S 18 -#define AR9170_PHY_GAIN_2GHZ_BSW_MARGIN 0x00003c00 -#define AR9170_PHY_GAIN_2GHZ_BSW_MARGIN_S 10 -#define AR9170_PHY_GAIN_2GHZ_BSW_ATTEN 0x0000001f -#define AR9170_PHY_GAIN_2GHZ_BSW_ATTEN_S 0 -#define AR9170_PHY_GAIN_2GHZ_XATTEN2_MARGIN 0x003e0000 -#define AR9170_PHY_GAIN_2GHZ_XATTEN2_MARGIN_S 17 -#define AR9170_PHY_GAIN_2GHZ_XATTEN1_MARGIN 0x0001f000 -#define AR9170_PHY_GAIN_2GHZ_XATTEN1_MARGIN_S 12 -#define AR9170_PHY_GAIN_2GHZ_XATTEN2_DB 0x00000fc0 -#define AR9170_PHY_GAIN_2GHZ_XATTEN2_DB_S 6 -#define AR9170_PHY_GAIN_2GHZ_XATTEN1_DB 0x0000003f -#define AR9170_PHY_GAIN_2GHZ_XATTEN1_DB_S 0 - -#define AR9170_PHY_REG_CCK_RXCTRL4 (AR9170_PHY_REG_BASE + 0x0a1c) -#define AR9170_PHY_CCK_RXCTRL4_FREQ_EST_SHORT 0x01f80000 -#define AR9170_PHY_CCK_RXCTRL4_FREQ_EST_SHORT_S 19 - -#define AR9170_PHY_REG_DAG_CTRLCCK (AR9170_PHY_REG_BASE + 0x0a28) -#define AR9170_REG_DAG_CTRLCCK_EN_RSSI_THR 0x00000200 -#define AR9170_REG_DAG_CTRLCCK_RSSI_THR 0x0001fc00 -#define AR9170_REG_DAG_CTRLCCK_RSSI_THR_S 10 - -#define AR9170_PHY_REG_FORCE_CLKEN_CCK (AR9170_PHY_REG_BASE + 0x0a2c) -#define AR9170_FORCE_CLKEN_CCK_MRC_MUX 0x00000040 - -#define AR9170_PHY_REG_POWER_TX_RATE3 (AR9170_PHY_REG_BASE + 0x0a34) -#define AR9170_PHY_REG_POWER_TX_RATE4 (AR9170_PHY_REG_BASE + 0x0a38) - -#define AR9170_PHY_REG_SCRM_SEQ_XR (AR9170_PHY_REG_BASE + 0x0a3c) -#define AR9170_PHY_REG_HEADER_DETECT_XR (AR9170_PHY_REG_BASE + 0x0a40) -#define AR9170_PHY_REG_CHIRP_DETECTED_XR (AR9170_PHY_REG_BASE + 0x0a44) -#define AR9170_PHY_REG_BLUETOOTH (AR9170_PHY_REG_BASE + 0x0a54) - -#define AR9170_PHY_REG_TPCRG1 (AR9170_PHY_REG_BASE + 0x0a58) -#define AR9170_PHY_TPCRG1_NUM_PD_GAIN 0x0000c000 -#define AR9170_PHY_TPCRG1_NUM_PD_GAIN_S 14 -#define AR9170_PHY_TPCRG1_PD_GAIN_1 0x00030000 -#define AR9170_PHY_TPCRG1_PD_GAIN_1_S 16 -#define AR9170_PHY_TPCRG1_PD_GAIN_2 0x000c0000 -#define AR9170_PHY_TPCRG1_PD_GAIN_2_S 18 -#define AR9170_PHY_TPCRG1_PD_GAIN_3 0x00300000 -#define AR9170_PHY_TPCRG1_PD_GAIN_3_S 20 -#define AR9170_PHY_TPCRG1_PD_CAL_ENABLE 0x00400000 -#define AR9170_PHY_TPCRG1_PD_CAL_ENABLE_S 22 - -#define AR9170_PHY_REG_TX_PWRCTRL4 (AR9170_PHY_REG_BASE + 0x0a64) -#define AR9170_PHY_TX_PWRCTRL_PD_AVG_VALID 0x00000001 -#define AR9170_PHY_TX_PWRCTRL_PD_AVG_VALID_S 0 -#define AR9170_PHY_TX_PWRCTRL_PD_AVG_OUT 0x000001fe -#define AR9170_PHY_TX_PWRCTRL_PD_AVG_OUT_S 1 - -#define AR9170_PHY_REG_ANALOG_SWAP (AR9170_PHY_REG_BASE + 0x0a68) -#define AR9170_PHY_ANALOG_SWAP_AB 0x0001 -#define AR9170_PHY_ANALOG_SWAP_ALT_CHAIN 0x00000040 - -#define AR9170_PHY_REG_TPCRG5 (AR9170_PHY_REG_BASE + 0x0a6c) -#define AR9170_PHY_TPCRG5_PD_GAIN_OVERLAP 0x0000000f -#define AR9170_PHY_TPCRG5_PD_GAIN_OVERLAP_S 0 -#define AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_1 0x000003f0 -#define AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_1_S 4 -#define AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_2 0x0000fc00 -#define AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_2_S 10 -#define AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_3 0x003f0000 -#define AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_3_S 16 -#define AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_4 0x0fc00000 -#define AR9170_PHY_TPCRG5_PD_GAIN_BOUNDARY_4_S 22 - -#define AR9170_PHY_REG_TX_PWRCTRL6_0 (AR9170_PHY_REG_BASE + 0x0a70) -#define AR9170_PHY_REG_TX_PWRCTRL6_1 (AR9170_PHY_REG_BASE + 0x1a70) -#define AR9170_PHY_TX_PWRCTRL_ERR_EST_MODE 0x03000000 -#define AR9170_PHY_TX_PWRCTRL_ERR_EST_MODE_S 24 - -#define AR9170_PHY_REG_TX_PWRCTRL7 (AR9170_PHY_REG_BASE + 0x0a74) -#define AR9170_PHY_TX_PWRCTRL_INIT_TX_GAIN 0x01f80000 -#define AR9170_PHY_TX_PWRCTRL_INIT_TX_GAIN_S 19 - -#define AR9170_PHY_REG_TX_PWRCTRL9 (AR9170_PHY_REG_BASE + 0x0a7c) -#define AR9170_PHY_TX_DESIRED_SCALE_CCK 0x00007c00 -#define AR9170_PHY_TX_DESIRED_SCALE_CCK_S 10 -#define AR9170_PHY_TX_PWRCTRL9_RES_DC_REMOVAL 0x80000000 -#define AR9170_PHY_TX_PWRCTRL9_RES_DC_REMOVAL_S 31 - -#define AR9170_PHY_REG_TX_GAIN_TBL1 (AR9170_PHY_REG_BASE + 0x0b00) -#define AR9170_PHY_TX_GAIN 0x0007f000 -#define AR9170_PHY_TX_GAIN_S 12 - -/* Carrier leak calibration control, do it after AGC calibration */ -#define AR9170_PHY_REG_CL_CAL_CTL (AR9170_PHY_REG_BASE + 0x0b58) -#define AR9170_PHY_CL_CAL_ENABLE 0x00000002 -#define AR9170_PHY_CL_CAL_PARALLEL_CAL_ENABLE 0x00000001 - -#define AR9170_PHY_REG_POWER_TX_RATE5 (AR9170_PHY_REG_BASE + 0x0b8c) -#define AR9170_PHY_REG_POWER_TX_RATE6 (AR9170_PHY_REG_BASE + 0x0b90) - -#define AR9170_PHY_REG_CH0_TX_PWRCTRL11 (AR9170_PHY_REG_BASE + 0x0b98) -#define AR9170_PHY_REG_CH1_TX_PWRCTRL11 (AR9170_PHY_REG_BASE + 0x1b98) -#define AR9170_PHY_TX_CHX_PWRCTRL_OLPC_TEMP_COMP 0x0000fc00 -#define AR9170_PHY_TX_CHX_PWRCTRL_OLPC_TEMP_COMP_S 10 - -#define AR9170_PHY_REG_CAL_CHAINMASK (AR9170_PHY_REG_BASE + 0x0b9c) -#define AR9170_PHY_REG_VIT_MASK2_M_46_61 (AR9170_PHY_REG_BASE + 0x0ba0) -#define AR9170_PHY_REG_MASK2_M_31_45 (AR9170_PHY_REG_BASE + 0x0ba4) -#define AR9170_PHY_REG_MASK2_M_16_30 (AR9170_PHY_REG_BASE + 0x0ba8) -#define AR9170_PHY_REG_MASK2_M_00_15 (AR9170_PHY_REG_BASE + 0x0bac) -#define AR9170_PHY_REG_PILOT_MASK_01_30 (AR9170_PHY_REG_BASE + 0x0bb0) -#define AR9170_PHY_REG_PILOT_MASK_31_60 (AR9170_PHY_REG_BASE + 0x0bb4) -#define AR9170_PHY_REG_MASK2_P_15_01 (AR9170_PHY_REG_BASE + 0x0bb8) -#define AR9170_PHY_REG_MASK2_P_30_16 (AR9170_PHY_REG_BASE + 0x0bbc) -#define AR9170_PHY_REG_MASK2_P_45_31 (AR9170_PHY_REG_BASE + 0x0bc0) -#define AR9170_PHY_REG_MASK2_P_61_45 (AR9170_PHY_REG_BASE + 0x0bc4) -#define AR9170_PHY_REG_POWER_TX_SUB (AR9170_PHY_REG_BASE + 0x0bc8) -#define AR9170_PHY_REG_POWER_TX_RATE7 (AR9170_PHY_REG_BASE + 0x0bcc) -#define AR9170_PHY_REG_POWER_TX_RATE8 (AR9170_PHY_REG_BASE + 0x0bd0) -#define AR9170_PHY_REG_POWER_TX_RATE9 (AR9170_PHY_REG_BASE + 0x0bd4) -#define AR9170_PHY_REG_XPA_CFG (AR9170_PHY_REG_BASE + 0x0bd8) -#define AR9170_PHY_FORCE_XPA_CFG 0x000000001 -#define AR9170_PHY_FORCE_XPA_CFG_S 0 - -#define AR9170_PHY_REG_CH1_CCA (AR9170_PHY_REG_BASE + 0x1064) -#define AR9170_PHY_CH1_CCA_MIN_PWR 0x0ff80000 -#define AR9170_PHY_CH1_CCA_MIN_PWR_S 19 - -#define AR9170_PHY_REG_CH2_CCA (AR9170_PHY_REG_BASE + 0x2064) -#define AR9170_PHY_CH2_CCA_MIN_PWR 0x0ff80000 -#define AR9170_PHY_CH2_CCA_MIN_PWR_S 19 - -#define AR9170_PHY_REG_CH1_EXT_CCA (AR9170_PHY_REG_BASE + 0x11bc) -#define AR9170_PHY_CH1_EXT_CCA_MIN_PWR 0xff800000 -#define AR9170_PHY_CH1_EXT_CCA_MIN_PWR_S 23 - -#define AR9170_PHY_REG_CH2_EXT_CCA (AR9170_PHY_REG_BASE + 0x21bc) -#define AR9170_PHY_CH2_EXT_CCA_MIN_PWR 0xff800000 -#define AR9170_PHY_CH2_EXT_CCA_MIN_PWR_S 23 - -#endif /* __CARL9170_SHARED_PHY_H */ diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c deleted file mode 100644 index 4684dd989496..000000000000 --- a/drivers/net/wireless/ath/carl9170/rx.c +++ /dev/null @@ -1,1016 +0,0 @@ -/* - * Atheros CARL9170 driver - * - * 802.11 & command trap routines - * - * Copyright 2008, Johannes Berg - * Copyright 2009, 2010, Christian Lamparter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include "carl9170.h" -#include "hw.h" -#include "cmd.h" - -static void carl9170_dbg_message(struct ar9170 *ar, const char *buf, u32 len) -{ - bool restart = false; - enum carl9170_restart_reasons reason = CARL9170_RR_NO_REASON; - - if (len > 3) { - if (memcmp(buf, CARL9170_ERR_MAGIC, 3) == 0) { - ar->fw.err_counter++; - if (ar->fw.err_counter > 3) { - restart = true; - reason = CARL9170_RR_TOO_MANY_FIRMWARE_ERRORS; - } - } - - if (memcmp(buf, CARL9170_BUG_MAGIC, 3) == 0) { - ar->fw.bug_counter++; - restart = true; - reason = CARL9170_RR_FATAL_FIRMWARE_ERROR; - } - } - - wiphy_info(ar->hw->wiphy, "FW: %.*s\n", len, buf); - - if (restart) - carl9170_restart(ar, reason); -} - -static void carl9170_handle_ps(struct ar9170 *ar, struct carl9170_rsp *rsp) -{ - u32 ps; - bool new_ps; - - ps = le32_to_cpu(rsp->psm.state); - - new_ps = (ps & CARL9170_PSM_COUNTER) != CARL9170_PSM_WAKE; - if (ar->ps.state != new_ps) { - if (!new_ps) { - ar->ps.sleep_ms = jiffies_to_msecs(jiffies - - ar->ps.last_action); - } - - ar->ps.last_action = jiffies; - - ar->ps.state = new_ps; - } -} - -static int carl9170_check_sequence(struct ar9170 *ar, unsigned int seq) -{ - if (ar->cmd_seq < -1) - return 0; - - /* - * Initialize Counter - */ - if (ar->cmd_seq < 0) - ar->cmd_seq = seq; - - /* - * The sequence is strictly monotonic increasing and it never skips! - * - * Therefore we can safely assume that whenever we received an - * unexpected sequence we have lost some valuable data. - */ - if (seq != ar->cmd_seq) { - int count; - - count = (seq - ar->cmd_seq) % ar->fw.cmd_bufs; - - wiphy_err(ar->hw->wiphy, "lost %d command responses/traps! " - "w:%d g:%d\n", count, ar->cmd_seq, seq); - - carl9170_restart(ar, CARL9170_RR_LOST_RSP); - return -EIO; - } - - ar->cmd_seq = (ar->cmd_seq + 1) % ar->fw.cmd_bufs; - return 0; -} - -static void carl9170_cmd_callback(struct ar9170 *ar, u32 len, void *buffer) -{ - /* - * Some commands may have a variable response length - * and we cannot predict the correct length in advance. - * So we only check if we provided enough space for the data. - */ - if (unlikely(ar->readlen != (len - 4))) { - dev_warn(&ar->udev->dev, "received invalid command response:" - "got %d, instead of %d\n", len - 4, ar->readlen); - print_hex_dump_bytes("carl9170 cmd:", DUMP_PREFIX_OFFSET, - ar->cmd_buf, (ar->cmd.hdr.len + 4) & 0x3f); - print_hex_dump_bytes("carl9170 rsp:", DUMP_PREFIX_OFFSET, - buffer, len); - /* - * Do not complete. The command times out, - * and we get a stack trace from there. - */ - carl9170_restart(ar, CARL9170_RR_INVALID_RSP); - } - - spin_lock(&ar->cmd_lock); - if (ar->readbuf) { - if (len >= 4) - memcpy(ar->readbuf, buffer + 4, len - 4); - - ar->readbuf = NULL; - } - complete(&ar->cmd_wait); - spin_unlock(&ar->cmd_lock); -} - -void carl9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len) -{ - struct carl9170_rsp *cmd = buf; - struct ieee80211_vif *vif; - - if ((cmd->hdr.cmd & CARL9170_RSP_FLAG) != CARL9170_RSP_FLAG) { - if (!(cmd->hdr.cmd & CARL9170_CMD_ASYNC_FLAG)) - carl9170_cmd_callback(ar, len, buf); - - return; - } - - if (unlikely(cmd->hdr.len != (len - 4))) { - if (net_ratelimit()) { - wiphy_err(ar->hw->wiphy, "FW: received over-/under" - "sized event %x (%d, but should be %d).\n", - cmd->hdr.cmd, cmd->hdr.len, len - 4); - - print_hex_dump_bytes("dump:", DUMP_PREFIX_NONE, - buf, len); - } - - return; - } - - /* hardware event handlers */ - switch (cmd->hdr.cmd) { - case CARL9170_RSP_PRETBTT: - /* pre-TBTT event */ - rcu_read_lock(); - vif = carl9170_get_main_vif(ar); - - if (!vif) { - rcu_read_unlock(); - break; - } - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - carl9170_handle_ps(ar, cmd); - break; - - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_MESH_POINT: - carl9170_update_beacon(ar, true); - break; - - default: - break; - } - rcu_read_unlock(); - - break; - - - case CARL9170_RSP_TXCOMP: - /* TX status notification */ - carl9170_tx_process_status(ar, cmd); - break; - - case CARL9170_RSP_BEACON_CONFIG: - /* - * (IBSS) beacon send notification - * bytes: 04 c2 XX YY B4 B3 B2 B1 - * - * XX always 80 - * YY always 00 - * B1-B4 "should" be the number of send out beacons. - */ - break; - - case CARL9170_RSP_ATIM: - /* End of Atim Window */ - break; - - case CARL9170_RSP_WATCHDOG: - /* Watchdog Interrupt */ - carl9170_restart(ar, CARL9170_RR_WATCHDOG); - break; - - case CARL9170_RSP_TEXT: - /* firmware debug */ - carl9170_dbg_message(ar, (char *)buf + 4, len - 4); - break; - - case CARL9170_RSP_HEXDUMP: - wiphy_dbg(ar->hw->wiphy, "FW: HD %d\n", len - 4); - print_hex_dump_bytes("FW:", DUMP_PREFIX_NONE, - (char *)buf + 4, len - 4); - break; - - case CARL9170_RSP_RADAR: - if (!net_ratelimit()) - break; - - wiphy_info(ar->hw->wiphy, "FW: RADAR! Please report this " - "incident to linux-wireless@vger.kernel.org !\n"); - break; - - case CARL9170_RSP_GPIO: -#ifdef CONFIG_CARL9170_WPC - if (ar->wps.pbc) { - bool state = !!(cmd->gpio.gpio & cpu_to_le32( - AR9170_GPIO_PORT_WPS_BUTTON_PRESSED)); - - if (state != ar->wps.pbc_state) { - ar->wps.pbc_state = state; - input_report_key(ar->wps.pbc, KEY_WPS_BUTTON, - state); - input_sync(ar->wps.pbc); - } - } -#endif /* CONFIG_CARL9170_WPC */ - break; - - case CARL9170_RSP_BOOT: - complete(&ar->fw_boot_wait); - break; - - default: - wiphy_err(ar->hw->wiphy, "FW: received unhandled event %x\n", - cmd->hdr.cmd); - print_hex_dump_bytes("dump:", DUMP_PREFIX_NONE, buf, len); - break; - } -} - -static int carl9170_rx_mac_status(struct ar9170 *ar, - struct ar9170_rx_head *head, struct ar9170_rx_macstatus *mac, - struct ieee80211_rx_status *status) -{ - struct ieee80211_channel *chan; - u8 error, decrypt; - - BUILD_BUG_ON(sizeof(struct ar9170_rx_head) != 12); - BUILD_BUG_ON(sizeof(struct ar9170_rx_macstatus) != 4); - - error = mac->error; - - if (error & AR9170_RX_ERROR_WRONG_RA) { - if (!ar->sniffer_enabled) - return -EINVAL; - } - - if (error & AR9170_RX_ERROR_PLCP) { - if (!(ar->filter_state & FIF_PLCPFAIL)) - return -EINVAL; - - status->flag |= RX_FLAG_FAILED_PLCP_CRC; - } - - if (error & AR9170_RX_ERROR_FCS) { - ar->tx_fcs_errors++; - - if (!(ar->filter_state & FIF_FCSFAIL)) - return -EINVAL; - - status->flag |= RX_FLAG_FAILED_FCS_CRC; - } - - decrypt = ar9170_get_decrypt_type(mac); - if (!(decrypt & AR9170_RX_ENC_SOFTWARE) && - decrypt != AR9170_ENC_ALG_NONE) { - if ((decrypt == AR9170_ENC_ALG_TKIP) && - (error & AR9170_RX_ERROR_MMIC)) - status->flag |= RX_FLAG_MMIC_ERROR; - - status->flag |= RX_FLAG_DECRYPTED; - } - - if (error & AR9170_RX_ERROR_DECRYPT && !ar->sniffer_enabled) - return -ENODATA; - - error &= ~(AR9170_RX_ERROR_MMIC | - AR9170_RX_ERROR_FCS | - AR9170_RX_ERROR_WRONG_RA | - AR9170_RX_ERROR_DECRYPT | - AR9170_RX_ERROR_PLCP); - - /* drop any other error frames */ - if (unlikely(error)) { - /* TODO: update netdevice's RX dropped/errors statistics */ - - if (net_ratelimit()) - wiphy_dbg(ar->hw->wiphy, "received frame with " - "suspicious error code (%#x).\n", error); - - return -EINVAL; - } - - chan = ar->channel; - if (chan) { - status->band = chan->band; - status->freq = chan->center_freq; - } - - switch (mac->status & AR9170_RX_STATUS_MODULATION) { - case AR9170_RX_STATUS_MODULATION_CCK: - if (mac->status & AR9170_RX_STATUS_SHORT_PREAMBLE) - status->flag |= RX_FLAG_SHORTPRE; - switch (head->plcp[0]) { - case AR9170_RX_PHY_RATE_CCK_1M: - status->rate_idx = 0; - break; - case AR9170_RX_PHY_RATE_CCK_2M: - status->rate_idx = 1; - break; - case AR9170_RX_PHY_RATE_CCK_5M: - status->rate_idx = 2; - break; - case AR9170_RX_PHY_RATE_CCK_11M: - status->rate_idx = 3; - break; - default: - if (net_ratelimit()) { - wiphy_err(ar->hw->wiphy, "invalid plcp cck " - "rate (%x).\n", head->plcp[0]); - } - - return -EINVAL; - } - break; - - case AR9170_RX_STATUS_MODULATION_DUPOFDM: - case AR9170_RX_STATUS_MODULATION_OFDM: - switch (head->plcp[0] & 0xf) { - case AR9170_TXRX_PHY_RATE_OFDM_6M: - status->rate_idx = 0; - break; - case AR9170_TXRX_PHY_RATE_OFDM_9M: - status->rate_idx = 1; - break; - case AR9170_TXRX_PHY_RATE_OFDM_12M: - status->rate_idx = 2; - break; - case AR9170_TXRX_PHY_RATE_OFDM_18M: - status->rate_idx = 3; - break; - case AR9170_TXRX_PHY_RATE_OFDM_24M: - status->rate_idx = 4; - break; - case AR9170_TXRX_PHY_RATE_OFDM_36M: - status->rate_idx = 5; - break; - case AR9170_TXRX_PHY_RATE_OFDM_48M: - status->rate_idx = 6; - break; - case AR9170_TXRX_PHY_RATE_OFDM_54M: - status->rate_idx = 7; - break; - default: - if (net_ratelimit()) { - wiphy_err(ar->hw->wiphy, "invalid plcp ofdm " - "rate (%x).\n", head->plcp[0]); - } - - return -EINVAL; - } - if (status->band == IEEE80211_BAND_2GHZ) - status->rate_idx += 4; - break; - - case AR9170_RX_STATUS_MODULATION_HT: - if (head->plcp[3] & 0x80) - status->flag |= RX_FLAG_40MHZ; - if (head->plcp[6] & 0x80) - status->flag |= RX_FLAG_SHORT_GI; - - status->rate_idx = clamp(0, 75, head->plcp[3] & 0x7f); - status->flag |= RX_FLAG_HT; - break; - - default: - BUG(); - return -ENOSYS; - } - - return 0; -} - -static void carl9170_rx_phy_status(struct ar9170 *ar, - struct ar9170_rx_phystatus *phy, struct ieee80211_rx_status *status) -{ - int i; - - BUILD_BUG_ON(sizeof(struct ar9170_rx_phystatus) != 20); - - for (i = 0; i < 3; i++) - if (phy->rssi[i] != 0x80) - status->antenna |= BIT(i); - - /* post-process RSSI */ - for (i = 0; i < 7; i++) - if (phy->rssi[i] & 0x80) - phy->rssi[i] = ((phy->rssi[i] & 0x7f) + 1) & 0x7f; - - /* TODO: we could do something with phy_errors */ - status->signal = ar->noise[0] + phy->rssi_combined; -} - -static struct sk_buff *carl9170_rx_copy_data(u8 *buf, int len) -{ - struct sk_buff *skb; - int reserved = 0; - struct ieee80211_hdr *hdr = (void *) buf; - - if (ieee80211_is_data_qos(hdr->frame_control)) { - u8 *qc = ieee80211_get_qos_ctl(hdr); - reserved += NET_IP_ALIGN; - - if (*qc & IEEE80211_QOS_CTL_A_MSDU_PRESENT) - reserved += NET_IP_ALIGN; - } - - if (ieee80211_has_a4(hdr->frame_control)) - reserved += NET_IP_ALIGN; - - reserved = 32 + (reserved & NET_IP_ALIGN); - - skb = dev_alloc_skb(len + reserved); - if (likely(skb)) { - skb_reserve(skb, reserved); - memcpy(skb_put(skb, len), buf, len); - } - - return skb; -} - -static u8 *carl9170_find_ie(u8 *data, unsigned int len, u8 ie) -{ - struct ieee80211_mgmt *mgmt = (void *)data; - u8 *pos, *end; - - pos = (u8 *)mgmt->u.beacon.variable; - end = data + len; - while (pos < end) { - if (pos + 2 + pos[1] > end) - return NULL; - - if (pos[0] == ie) - return pos; - - pos += 2 + pos[1]; - } - return NULL; -} - -/* - * NOTE: - * - * The firmware is in charge of waking up the device just before - * the AP is expected to transmit the next beacon. - * - * This leaves the driver with the important task of deciding when - * to set the PHY back to bed again. - */ -static void carl9170_ps_beacon(struct ar9170 *ar, void *data, unsigned int len) -{ - struct ieee80211_hdr *hdr = data; - struct ieee80211_tim_ie *tim_ie; - u8 *tim; - u8 tim_len; - bool cam; - - if (likely(!(ar->hw->conf.flags & IEEE80211_CONF_PS))) - return; - - /* check if this really is a beacon */ - if (!ieee80211_is_beacon(hdr->frame_control)) - return; - - /* min. beacon length + FCS_LEN */ - if (len <= 40 + FCS_LEN) - return; - - /* and only beacons from the associated BSSID, please */ - if (!ether_addr_equal(hdr->addr3, ar->common.curbssid) || - !ar->common.curaid) - return; - - ar->ps.last_beacon = jiffies; - - tim = carl9170_find_ie(data, len - FCS_LEN, WLAN_EID_TIM); - if (!tim) - return; - - if (tim[1] < sizeof(*tim_ie)) - return; - - tim_len = tim[1]; - tim_ie = (struct ieee80211_tim_ie *) &tim[2]; - - if (!WARN_ON_ONCE(!ar->hw->conf.ps_dtim_period)) - ar->ps.dtim_counter = (tim_ie->dtim_count - 1) % - ar->hw->conf.ps_dtim_period; - - /* Check whenever the PHY can be turned off again. */ - - /* 1. What about buffered unicast traffic for our AID? */ - cam = ieee80211_check_tim(tim_ie, tim_len, ar->common.curaid); - - /* 2. Maybe the AP wants to send multicast/broadcast data? */ - cam |= !!(tim_ie->bitmap_ctrl & 0x01); - - if (!cam) { - /* back to low-power land. */ - ar->ps.off_override &= ~PS_OFF_BCN; - carl9170_ps_check(ar); - } else { - /* force CAM */ - ar->ps.off_override |= PS_OFF_BCN; - } -} - -static void carl9170_ba_check(struct ar9170 *ar, void *data, unsigned int len) -{ - struct ieee80211_bar *bar = (void *) data; - struct carl9170_bar_list_entry *entry; - unsigned int queue; - - if (likely(!ieee80211_is_back(bar->frame_control))) - return; - - if (len <= sizeof(*bar) + FCS_LEN) - return; - - queue = TID_TO_WME_AC(((le16_to_cpu(bar->control) & - IEEE80211_BAR_CTRL_TID_INFO_MASK) >> - IEEE80211_BAR_CTRL_TID_INFO_SHIFT) & 7); - - rcu_read_lock(); - list_for_each_entry_rcu(entry, &ar->bar_list[queue], list) { - struct sk_buff *entry_skb = entry->skb; - struct _carl9170_tx_superframe *super = (void *)entry_skb->data; - struct ieee80211_bar *entry_bar = (void *)super->frame_data; - -#define TID_CHECK(a, b) ( \ - ((a) & cpu_to_le16(IEEE80211_BAR_CTRL_TID_INFO_MASK)) == \ - ((b) & cpu_to_le16(IEEE80211_BAR_CTRL_TID_INFO_MASK))) \ - - if (bar->start_seq_num == entry_bar->start_seq_num && - TID_CHECK(bar->control, entry_bar->control) && - compare_ether_addr(bar->ra, entry_bar->ta) == 0 && - compare_ether_addr(bar->ta, entry_bar->ra) == 0) { - struct ieee80211_tx_info *tx_info; - - tx_info = IEEE80211_SKB_CB(entry_skb); - tx_info->flags |= IEEE80211_TX_STAT_ACK; - - spin_lock_bh(&ar->bar_list_lock[queue]); - list_del_rcu(&entry->list); - spin_unlock_bh(&ar->bar_list_lock[queue]); - kfree_rcu(entry, head); - break; - } - } - rcu_read_unlock(); - -#undef TID_CHECK -} - -static bool carl9170_ampdu_check(struct ar9170 *ar, u8 *buf, u8 ms, - struct ieee80211_rx_status *rx_status) -{ - __le16 fc; - - if ((ms & AR9170_RX_STATUS_MPDU) == AR9170_RX_STATUS_MPDU_SINGLE) { - /* - * This frame is not part of an aMPDU. - * Therefore it is not subjected to any - * of the following content restrictions. - */ - return true; - } - - rx_status->flag |= RX_FLAG_AMPDU_DETAILS | RX_FLAG_AMPDU_LAST_KNOWN; - rx_status->ampdu_reference = ar->ampdu_ref; - - /* - * "802.11n - 7.4a.3 A-MPDU contents" describes in which contexts - * certain frame types can be part of an aMPDU. - * - * In order to keep the processing cost down, I opted for a - * stateless filter solely based on the frame control field. - */ - - fc = ((struct ieee80211_hdr *)buf)->frame_control; - if (ieee80211_is_data_qos(fc) && ieee80211_is_data_present(fc)) - return true; - - if (ieee80211_is_ack(fc) || ieee80211_is_back(fc) || - ieee80211_is_back_req(fc)) - return true; - - if (ieee80211_is_action(fc)) - return true; - - return false; -} - -static int carl9170_handle_mpdu(struct ar9170 *ar, u8 *buf, int len, - struct ieee80211_rx_status *status) -{ - struct sk_buff *skb; - - /* (driver) frame trap handler - * - * Because power-saving mode handing has to be implemented by - * the driver/firmware. We have to check each incoming beacon - * from the associated AP, if there's new data for us (either - * broadcast/multicast or unicast) we have to react quickly. - * - * So, if you have you want to add additional frame trap - * handlers, this would be the perfect place! - */ - - carl9170_ps_beacon(ar, buf, len); - - carl9170_ba_check(ar, buf, len); - - skb = carl9170_rx_copy_data(buf, len); - if (!skb) - return -ENOMEM; - - memcpy(IEEE80211_SKB_RXCB(skb), status, sizeof(*status)); - ieee80211_rx(ar->hw, skb); - return 0; -} - -/* - * If the frame alignment is right (or the kernel has - * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS), and there - * is only a single MPDU in the USB frame, then we could - * submit to mac80211 the SKB directly. However, since - * there may be multiple packets in one SKB in stream - * mode, and we need to observe the proper ordering, - * this is non-trivial. - */ -static void carl9170_rx_untie_data(struct ar9170 *ar, u8 *buf, int len) -{ - struct ar9170_rx_head *head; - struct ar9170_rx_macstatus *mac; - struct ar9170_rx_phystatus *phy = NULL; - struct ieee80211_rx_status status; - int mpdu_len; - u8 mac_status; - - if (!IS_STARTED(ar)) - return; - - if (unlikely(len < sizeof(*mac))) - goto drop; - - memset(&status, 0, sizeof(status)); - - mpdu_len = len - sizeof(*mac); - - mac = (void *)(buf + mpdu_len); - mac_status = mac->status; - switch (mac_status & AR9170_RX_STATUS_MPDU) { - case AR9170_RX_STATUS_MPDU_FIRST: - ar->ampdu_ref++; - /* Aggregated MPDUs start with an PLCP header */ - if (likely(mpdu_len >= sizeof(struct ar9170_rx_head))) { - head = (void *) buf; - - /* - * The PLCP header needs to be cached for the - * following MIDDLE + LAST A-MPDU packets. - * - * So, if you are wondering why all frames seem - * to share a common RX status information, - * then you have the answer right here... - */ - memcpy(&ar->rx_plcp, (void *) buf, - sizeof(struct ar9170_rx_head)); - - mpdu_len -= sizeof(struct ar9170_rx_head); - buf += sizeof(struct ar9170_rx_head); - - ar->rx_has_plcp = true; - } else { - if (net_ratelimit()) { - wiphy_err(ar->hw->wiphy, "plcp info " - "is clipped.\n"); - } - - goto drop; - } - break; - - case AR9170_RX_STATUS_MPDU_LAST: - status.flag |= RX_FLAG_AMPDU_IS_LAST; - - /* - * The last frame of an A-MPDU has an extra tail - * which does contain the phy status of the whole - * aggregate. - */ - if (likely(mpdu_len >= sizeof(struct ar9170_rx_phystatus))) { - mpdu_len -= sizeof(struct ar9170_rx_phystatus); - phy = (void *)(buf + mpdu_len); - } else { - if (net_ratelimit()) { - wiphy_err(ar->hw->wiphy, "frame tail " - "is clipped.\n"); - } - - goto drop; - } - - case AR9170_RX_STATUS_MPDU_MIDDLE: - /* These are just data + mac status */ - if (unlikely(!ar->rx_has_plcp)) { - if (!net_ratelimit()) - return; - - wiphy_err(ar->hw->wiphy, "rx stream does not start " - "with a first_mpdu frame tag.\n"); - - goto drop; - } - - head = &ar->rx_plcp; - break; - - case AR9170_RX_STATUS_MPDU_SINGLE: - /* single mpdu has both: plcp (head) and phy status (tail) */ - head = (void *) buf; - - mpdu_len -= sizeof(struct ar9170_rx_head); - mpdu_len -= sizeof(struct ar9170_rx_phystatus); - - buf += sizeof(struct ar9170_rx_head); - phy = (void *)(buf + mpdu_len); - break; - - default: - BUG_ON(1); - break; - } - - /* FC + DU + RA + FCS */ - if (unlikely(mpdu_len < (2 + 2 + ETH_ALEN + FCS_LEN))) - goto drop; - - if (unlikely(carl9170_rx_mac_status(ar, head, mac, &status))) - goto drop; - - if (!carl9170_ampdu_check(ar, buf, mac_status, &status)) - goto drop; - - if (phy) - carl9170_rx_phy_status(ar, phy, &status); - else - status.flag |= RX_FLAG_NO_SIGNAL_VAL; - - if (carl9170_handle_mpdu(ar, buf, mpdu_len, &status)) - goto drop; - - return; -drop: - ar->rx_dropped++; -} - -static void carl9170_rx_untie_cmds(struct ar9170 *ar, const u8 *respbuf, - const unsigned int resplen) -{ - struct carl9170_rsp *cmd; - int i = 0; - - while (i < resplen) { - cmd = (void *) &respbuf[i]; - - i += cmd->hdr.len + 4; - if (unlikely(i > resplen)) - break; - - if (carl9170_check_sequence(ar, cmd->hdr.seq)) - break; - - carl9170_handle_command_response(ar, cmd, cmd->hdr.len + 4); - } - - if (unlikely(i != resplen)) { - if (!net_ratelimit()) - return; - - wiphy_err(ar->hw->wiphy, "malformed firmware trap:\n"); - print_hex_dump_bytes("rxcmd:", DUMP_PREFIX_OFFSET, - respbuf, resplen); - } -} - -static void __carl9170_rx(struct ar9170 *ar, u8 *buf, unsigned int len) -{ - unsigned int i = 0; - - /* weird thing, but this is the same in the original driver */ - while (len > 2 && i < 12 && buf[0] == 0xff && buf[1] == 0xff) { - i += 2; - len -= 2; - buf += 2; - } - - if (unlikely(len < 4)) - return; - - /* found the 6 * 0xffff marker? */ - if (i == 12) - carl9170_rx_untie_cmds(ar, buf, len); - else - carl9170_rx_untie_data(ar, buf, len); -} - -static void carl9170_rx_stream(struct ar9170 *ar, void *buf, unsigned int len) -{ - unsigned int tlen, wlen = 0, clen = 0; - struct ar9170_stream *rx_stream; - u8 *tbuf; - - tbuf = buf; - tlen = len; - - while (tlen >= 4) { - rx_stream = (void *) tbuf; - clen = le16_to_cpu(rx_stream->length); - wlen = ALIGN(clen, 4); - - /* check if this is stream has a valid tag.*/ - if (rx_stream->tag != cpu_to_le16(AR9170_RX_STREAM_TAG)) { - /* - * TODO: handle the highly unlikely event that the - * corrupted stream has the TAG at the right position. - */ - - /* check if the frame can be repaired. */ - if (!ar->rx_failover_missing) { - - /* this is not "short read". */ - if (net_ratelimit()) { - wiphy_err(ar->hw->wiphy, - "missing tag!\n"); - } - - __carl9170_rx(ar, tbuf, tlen); - return; - } - - if (ar->rx_failover_missing > tlen) { - if (net_ratelimit()) { - wiphy_err(ar->hw->wiphy, - "possible multi " - "stream corruption!\n"); - goto err_telluser; - } else { - goto err_silent; - } - } - - memcpy(skb_put(ar->rx_failover, tlen), tbuf, tlen); - ar->rx_failover_missing -= tlen; - - if (ar->rx_failover_missing <= 0) { - /* - * nested carl9170_rx_stream call! - * - * termination is guaranteed, even when the - * combined frame also have an element with - * a bad tag. - */ - - ar->rx_failover_missing = 0; - carl9170_rx_stream(ar, ar->rx_failover->data, - ar->rx_failover->len); - - skb_reset_tail_pointer(ar->rx_failover); - skb_trim(ar->rx_failover, 0); - } - - return; - } - - /* check if stream is clipped */ - if (wlen > tlen - 4) { - if (ar->rx_failover_missing) { - /* TODO: handle double stream corruption. */ - if (net_ratelimit()) { - wiphy_err(ar->hw->wiphy, "double rx " - "stream corruption!\n"); - goto err_telluser; - } else { - goto err_silent; - } - } - - /* - * save incomplete data set. - * the firmware will resend the missing bits when - * the rx - descriptor comes round again. - */ - - memcpy(skb_put(ar->rx_failover, tlen), tbuf, tlen); - ar->rx_failover_missing = clen - tlen; - return; - } - __carl9170_rx(ar, rx_stream->payload, clen); - - tbuf += wlen + 4; - tlen -= wlen + 4; - } - - if (tlen) { - if (net_ratelimit()) { - wiphy_err(ar->hw->wiphy, "%d bytes of unprocessed " - "data left in rx stream!\n", tlen); - } - - goto err_telluser; - } - - return; - -err_telluser: - wiphy_err(ar->hw->wiphy, "damaged RX stream data [want:%d, " - "data:%d, rx:%d, pending:%d ]\n", clen, wlen, tlen, - ar->rx_failover_missing); - - if (ar->rx_failover_missing) - print_hex_dump_bytes("rxbuf:", DUMP_PREFIX_OFFSET, - ar->rx_failover->data, - ar->rx_failover->len); - - print_hex_dump_bytes("stream:", DUMP_PREFIX_OFFSET, - buf, len); - - wiphy_err(ar->hw->wiphy, "please check your hardware and cables, if " - "you see this message frequently.\n"); - -err_silent: - if (ar->rx_failover_missing) { - skb_reset_tail_pointer(ar->rx_failover); - skb_trim(ar->rx_failover, 0); - ar->rx_failover_missing = 0; - } -} - -void carl9170_rx(struct ar9170 *ar, void *buf, unsigned int len) -{ - if (ar->fw.rx_stream) - carl9170_rx_stream(ar, buf, len); - else - __carl9170_rx(ar, buf, len); -} diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c deleted file mode 100644 index c61cafa2665b..000000000000 --- a/drivers/net/wireless/ath/carl9170/tx.c +++ /dev/null @@ -1,1686 +0,0 @@ -/* - * Atheros CARL9170 driver - * - * 802.11 xmit & status routines - * - * Copyright 2008, Johannes Berg - * Copyright 2009, 2010, Christian Lamparter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include "carl9170.h" -#include "hw.h" -#include "cmd.h" - -static inline unsigned int __carl9170_get_queue(struct ar9170 *ar, - unsigned int queue) -{ - if (unlikely(modparam_noht)) { - return queue; - } else { - /* - * This is just another workaround, until - * someone figures out how to get QoS and - * AMPDU to play nicely together. - */ - - return 2; /* AC_BE */ - } -} - -static inline unsigned int carl9170_get_queue(struct ar9170 *ar, - struct sk_buff *skb) -{ - return __carl9170_get_queue(ar, skb_get_queue_mapping(skb)); -} - -static bool is_mem_full(struct ar9170 *ar) -{ - return (DIV_ROUND_UP(IEEE80211_MAX_FRAME_LEN, ar->fw.mem_block_size) > - atomic_read(&ar->mem_free_blocks)); -} - -static void carl9170_tx_accounting(struct ar9170 *ar, struct sk_buff *skb) -{ - int queue, i; - bool mem_full; - - atomic_inc(&ar->tx_total_queued); - - queue = skb_get_queue_mapping(skb); - spin_lock_bh(&ar->tx_stats_lock); - - /* - * The driver has to accept the frame, regardless if the queue is - * full to the brim, or not. We have to do the queuing internally, - * since mac80211 assumes that a driver which can operate with - * aggregated frames does not reject frames for this reason. - */ - ar->tx_stats[queue].len++; - ar->tx_stats[queue].count++; - - mem_full = is_mem_full(ar); - for (i = 0; i < ar->hw->queues; i++) { - if (mem_full || ar->tx_stats[i].len >= ar->tx_stats[i].limit) { - ieee80211_stop_queue(ar->hw, i); - ar->queue_stop_timeout[i] = jiffies; - } - } - - spin_unlock_bh(&ar->tx_stats_lock); -} - -/* needs rcu_read_lock */ -static struct ieee80211_sta *__carl9170_get_tx_sta(struct ar9170 *ar, - struct sk_buff *skb) -{ - struct _carl9170_tx_superframe *super = (void *) skb->data; - struct ieee80211_hdr *hdr = (void *) super->frame_data; - struct ieee80211_vif *vif; - unsigned int vif_id; - - vif_id = (super->s.misc & CARL9170_TX_SUPER_MISC_VIF_ID) >> - CARL9170_TX_SUPER_MISC_VIF_ID_S; - - if (WARN_ON_ONCE(vif_id >= AR9170_MAX_VIRTUAL_MAC)) - return NULL; - - vif = rcu_dereference(ar->vif_priv[vif_id].vif); - if (unlikely(!vif)) - return NULL; - - /* - * Normally we should use wrappers like ieee80211_get_DA to get - * the correct peer ieee80211_sta. - * - * But there is a problem with indirect traffic (broadcasts, or - * data which is designated for other stations) in station mode. - * The frame will be directed to the AP for distribution and not - * to the actual destination. - */ - - return ieee80211_find_sta(vif, hdr->addr1); -} - -static void carl9170_tx_ps_unblock(struct ar9170 *ar, struct sk_buff *skb) -{ - struct ieee80211_sta *sta; - struct carl9170_sta_info *sta_info; - - rcu_read_lock(); - sta = __carl9170_get_tx_sta(ar, skb); - if (unlikely(!sta)) - goto out_rcu; - - sta_info = (struct carl9170_sta_info *) sta->drv_priv; - if (atomic_dec_return(&sta_info->pending_frames) == 0) - ieee80211_sta_block_awake(ar->hw, sta, false); - -out_rcu: - rcu_read_unlock(); -} - -static void carl9170_tx_accounting_free(struct ar9170 *ar, struct sk_buff *skb) -{ - int queue; - - queue = skb_get_queue_mapping(skb); - - spin_lock_bh(&ar->tx_stats_lock); - - ar->tx_stats[queue].len--; - - if (!is_mem_full(ar)) { - unsigned int i; - for (i = 0; i < ar->hw->queues; i++) { - if (ar->tx_stats[i].len >= CARL9170_NUM_TX_LIMIT_SOFT) - continue; - - if (ieee80211_queue_stopped(ar->hw, i)) { - unsigned long tmp; - - tmp = jiffies - ar->queue_stop_timeout[i]; - if (tmp > ar->max_queue_stop_timeout[i]) - ar->max_queue_stop_timeout[i] = tmp; - } - - ieee80211_wake_queue(ar->hw, i); - } - } - - spin_unlock_bh(&ar->tx_stats_lock); - - if (atomic_dec_and_test(&ar->tx_total_queued)) - complete(&ar->tx_flush); -} - -static int carl9170_alloc_dev_space(struct ar9170 *ar, struct sk_buff *skb) -{ - struct _carl9170_tx_superframe *super = (void *) skb->data; - unsigned int chunks; - int cookie = -1; - - atomic_inc(&ar->mem_allocs); - - chunks = DIV_ROUND_UP(skb->len, ar->fw.mem_block_size); - if (unlikely(atomic_sub_return(chunks, &ar->mem_free_blocks) < 0)) { - atomic_add(chunks, &ar->mem_free_blocks); - return -ENOSPC; - } - - spin_lock_bh(&ar->mem_lock); - cookie = bitmap_find_free_region(ar->mem_bitmap, ar->fw.mem_blocks, 0); - spin_unlock_bh(&ar->mem_lock); - - if (unlikely(cookie < 0)) { - atomic_add(chunks, &ar->mem_free_blocks); - return -ENOSPC; - } - - super = (void *) skb->data; - - /* - * Cookie #0 serves two special purposes: - * 1. The firmware might use it generate BlockACK frames - * in responds of an incoming BlockAckReqs. - * - * 2. Prevent double-free bugs. - */ - super->s.cookie = (u8) cookie + 1; - return 0; -} - -static void carl9170_release_dev_space(struct ar9170 *ar, struct sk_buff *skb) -{ - struct _carl9170_tx_superframe *super = (void *) skb->data; - int cookie; - - /* make a local copy of the cookie */ - cookie = super->s.cookie; - /* invalidate cookie */ - super->s.cookie = 0; - - /* - * Do a out-of-bounds check on the cookie: - * - * * cookie "0" is reserved and won't be assigned to any - * out-going frame. Internally however, it is used to - * mark no longer/un-accounted frames and serves as a - * cheap way of preventing frames from being freed - * twice by _accident_. NB: There is a tiny race... - * - * * obviously, cookie number is limited by the amount - * of available memory blocks, so the number can - * never execeed the mem_blocks count. - */ - if (unlikely(WARN_ON_ONCE(cookie == 0) || - WARN_ON_ONCE(cookie > ar->fw.mem_blocks))) - return; - - atomic_add(DIV_ROUND_UP(skb->len, ar->fw.mem_block_size), - &ar->mem_free_blocks); - - spin_lock_bh(&ar->mem_lock); - bitmap_release_region(ar->mem_bitmap, cookie - 1, 0); - spin_unlock_bh(&ar->mem_lock); -} - -/* Called from any context */ -static void carl9170_tx_release(struct kref *ref) -{ - struct ar9170 *ar; - struct carl9170_tx_info *arinfo; - struct ieee80211_tx_info *txinfo; - struct sk_buff *skb; - - arinfo = container_of(ref, struct carl9170_tx_info, ref); - txinfo = container_of((void *) arinfo, struct ieee80211_tx_info, - rate_driver_data); - skb = container_of((void *) txinfo, struct sk_buff, cb); - - ar = arinfo->ar; - if (WARN_ON_ONCE(!ar)) - return; - - BUILD_BUG_ON( - offsetof(struct ieee80211_tx_info, status.ack_signal) != 20); - - memset(&txinfo->status.ack_signal, 0, - sizeof(struct ieee80211_tx_info) - - offsetof(struct ieee80211_tx_info, status.ack_signal)); - - if (atomic_read(&ar->tx_total_queued)) - ar->tx_schedule = true; - - if (txinfo->flags & IEEE80211_TX_CTL_AMPDU) { - if (!atomic_read(&ar->tx_ampdu_upload)) - ar->tx_ampdu_schedule = true; - - if (txinfo->flags & IEEE80211_TX_STAT_AMPDU) { - struct _carl9170_tx_superframe *super; - - super = (void *)skb->data; - txinfo->status.ampdu_len = super->s.rix; - txinfo->status.ampdu_ack_len = super->s.cnt; - } else if ((txinfo->flags & IEEE80211_TX_STAT_ACK) && - !(txinfo->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) { - /* - * drop redundant tx_status reports: - * - * 1. ampdu_ack_len of the final tx_status does - * include the feedback of this particular frame. - * - * 2. tx_status_irqsafe only queues up to 128 - * tx feedback reports and discards the rest. - * - * 3. minstrel_ht is picky, it only accepts - * reports of frames with the TX_STATUS_AMPDU flag. - * - * 4. mac80211 is not particularly interested in - * feedback either [CTL_REQ_TX_STATUS not set] - */ - - ieee80211_free_txskb(ar->hw, skb); - return; - } else { - /* - * Either the frame transmission has failed or - * mac80211 requested tx status. - */ - } - } - - skb_pull(skb, sizeof(struct _carl9170_tx_superframe)); - ieee80211_tx_status_irqsafe(ar->hw, skb); -} - -void carl9170_tx_get_skb(struct sk_buff *skb) -{ - struct carl9170_tx_info *arinfo = (void *) - (IEEE80211_SKB_CB(skb))->rate_driver_data; - kref_get(&arinfo->ref); -} - -int carl9170_tx_put_skb(struct sk_buff *skb) -{ - struct carl9170_tx_info *arinfo = (void *) - (IEEE80211_SKB_CB(skb))->rate_driver_data; - - return kref_put(&arinfo->ref, carl9170_tx_release); -} - -/* Caller must hold the tid_info->lock & rcu_read_lock */ -static void carl9170_tx_shift_bm(struct ar9170 *ar, - struct carl9170_sta_tid *tid_info, u16 seq) -{ - u16 off; - - off = SEQ_DIFF(seq, tid_info->bsn); - - if (WARN_ON_ONCE(off >= CARL9170_BAW_BITS)) - return; - - /* - * Sanity check. For each MPDU we set the bit in bitmap and - * clear it once we received the tx_status. - * But if the bit is already cleared then we've been bitten - * by a bug. - */ - WARN_ON_ONCE(!test_and_clear_bit(off, tid_info->bitmap)); - - off = SEQ_DIFF(tid_info->snx, tid_info->bsn); - if (WARN_ON_ONCE(off >= CARL9170_BAW_BITS)) - return; - - if (!bitmap_empty(tid_info->bitmap, off)) - off = find_first_bit(tid_info->bitmap, off); - - tid_info->bsn += off; - tid_info->bsn &= 0x0fff; - - bitmap_shift_right(tid_info->bitmap, tid_info->bitmap, - off, CARL9170_BAW_BITS); -} - -static void carl9170_tx_status_process_ampdu(struct ar9170 *ar, - struct sk_buff *skb, struct ieee80211_tx_info *txinfo) -{ - struct _carl9170_tx_superframe *super = (void *) skb->data; - struct ieee80211_hdr *hdr = (void *) super->frame_data; - struct ieee80211_sta *sta; - struct carl9170_sta_info *sta_info; - struct carl9170_sta_tid *tid_info; - u8 tid; - - if (!(txinfo->flags & IEEE80211_TX_CTL_AMPDU) || - txinfo->flags & IEEE80211_TX_CTL_INJECTED) - return; - - rcu_read_lock(); - sta = __carl9170_get_tx_sta(ar, skb); - if (unlikely(!sta)) - goto out_rcu; - - tid = get_tid_h(hdr); - - sta_info = (void *) sta->drv_priv; - tid_info = rcu_dereference(sta_info->agg[tid]); - if (!tid_info) - goto out_rcu; - - spin_lock_bh(&tid_info->lock); - if (likely(tid_info->state >= CARL9170_TID_STATE_IDLE)) - carl9170_tx_shift_bm(ar, tid_info, get_seq_h(hdr)); - - if (sta_info->stats[tid].clear) { - sta_info->stats[tid].clear = false; - sta_info->stats[tid].req = false; - sta_info->stats[tid].ampdu_len = 0; - sta_info->stats[tid].ampdu_ack_len = 0; - } - - sta_info->stats[tid].ampdu_len++; - if (txinfo->status.rates[0].count == 1) - sta_info->stats[tid].ampdu_ack_len++; - - if (!(txinfo->flags & IEEE80211_TX_STAT_ACK)) - sta_info->stats[tid].req = true; - - if (super->f.mac_control & cpu_to_le16(AR9170_TX_MAC_IMM_BA)) { - super->s.rix = sta_info->stats[tid].ampdu_len; - super->s.cnt = sta_info->stats[tid].ampdu_ack_len; - txinfo->flags |= IEEE80211_TX_STAT_AMPDU; - if (sta_info->stats[tid].req) - txinfo->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; - - sta_info->stats[tid].clear = true; - } - spin_unlock_bh(&tid_info->lock); - -out_rcu: - rcu_read_unlock(); -} - -static void carl9170_tx_bar_status(struct ar9170 *ar, struct sk_buff *skb, - struct ieee80211_tx_info *tx_info) -{ - struct _carl9170_tx_superframe *super = (void *) skb->data; - struct ieee80211_bar *bar = (void *) super->frame_data; - - /* - * Unlike all other frames, the status report for BARs does - * not directly come from the hardware as it is incapable of - * matching a BA to a previously send BAR. - * Instead the RX-path will scan for incoming BAs and set the - * IEEE80211_TX_STAT_ACK if it sees one that was likely - * caused by a BAR from us. - */ - - if (unlikely(ieee80211_is_back_req(bar->frame_control)) && - !(tx_info->flags & IEEE80211_TX_STAT_ACK)) { - struct carl9170_bar_list_entry *entry; - int queue = skb_get_queue_mapping(skb); - - rcu_read_lock(); - list_for_each_entry_rcu(entry, &ar->bar_list[queue], list) { - if (entry->skb == skb) { - spin_lock_bh(&ar->bar_list_lock[queue]); - list_del_rcu(&entry->list); - spin_unlock_bh(&ar->bar_list_lock[queue]); - kfree_rcu(entry, head); - goto out; - } - } - - WARN(1, "bar not found in %d - ra:%pM ta:%pM c:%x ssn:%x\n", - queue, bar->ra, bar->ta, bar->control, - bar->start_seq_num); -out: - rcu_read_unlock(); - } -} - -void carl9170_tx_status(struct ar9170 *ar, struct sk_buff *skb, - const bool success) -{ - struct ieee80211_tx_info *txinfo; - - carl9170_tx_accounting_free(ar, skb); - - txinfo = IEEE80211_SKB_CB(skb); - - carl9170_tx_bar_status(ar, skb, txinfo); - - if (success) - txinfo->flags |= IEEE80211_TX_STAT_ACK; - else - ar->tx_ack_failures++; - - if (txinfo->flags & IEEE80211_TX_CTL_AMPDU) - carl9170_tx_status_process_ampdu(ar, skb, txinfo); - - carl9170_tx_ps_unblock(ar, skb); - carl9170_tx_put_skb(skb); -} - -/* This function may be called form any context */ -void carl9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb) -{ - struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb); - - atomic_dec(&ar->tx_total_pending); - - if (txinfo->flags & IEEE80211_TX_CTL_AMPDU) - atomic_dec(&ar->tx_ampdu_upload); - - if (carl9170_tx_put_skb(skb)) - tasklet_hi_schedule(&ar->usb_tasklet); -} - -static struct sk_buff *carl9170_get_queued_skb(struct ar9170 *ar, u8 cookie, - struct sk_buff_head *queue) -{ - struct sk_buff *skb; - - spin_lock_bh(&queue->lock); - skb_queue_walk(queue, skb) { - struct _carl9170_tx_superframe *txc = (void *) skb->data; - - if (txc->s.cookie != cookie) - continue; - - __skb_unlink(skb, queue); - spin_unlock_bh(&queue->lock); - - carl9170_release_dev_space(ar, skb); - return skb; - } - spin_unlock_bh(&queue->lock); - - return NULL; -} - -static void carl9170_tx_fill_rateinfo(struct ar9170 *ar, unsigned int rix, - unsigned int tries, struct ieee80211_tx_info *txinfo) -{ - unsigned int i; - - for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { - if (txinfo->status.rates[i].idx < 0) - break; - - if (i == rix) { - txinfo->status.rates[i].count = tries; - i++; - break; - } - } - - for (; i < IEEE80211_TX_MAX_RATES; i++) { - txinfo->status.rates[i].idx = -1; - txinfo->status.rates[i].count = 0; - } -} - -static void carl9170_check_queue_stop_timeout(struct ar9170 *ar) -{ - int i; - struct sk_buff *skb; - struct ieee80211_tx_info *txinfo; - struct carl9170_tx_info *arinfo; - bool restart = false; - - for (i = 0; i < ar->hw->queues; i++) { - spin_lock_bh(&ar->tx_status[i].lock); - - skb = skb_peek(&ar->tx_status[i]); - - if (!skb) - goto next; - - txinfo = IEEE80211_SKB_CB(skb); - arinfo = (void *) txinfo->rate_driver_data; - - if (time_is_before_jiffies(arinfo->timeout + - msecs_to_jiffies(CARL9170_QUEUE_STUCK_TIMEOUT)) == true) - restart = true; - -next: - spin_unlock_bh(&ar->tx_status[i].lock); - } - - if (restart) { - /* - * At least one queue has been stuck for long enough. - * Give the device a kick and hope it gets back to - * work. - * - * possible reasons may include: - * - frames got lost/corrupted (bad connection to the device) - * - stalled rx processing/usb controller hiccups - * - firmware errors/bugs - * - every bug you can think of. - * - all bugs you can't... - * - ... - */ - carl9170_restart(ar, CARL9170_RR_STUCK_TX); - } -} - -static void carl9170_tx_ampdu_timeout(struct ar9170 *ar) -{ - struct carl9170_sta_tid *iter; - struct sk_buff *skb; - struct ieee80211_tx_info *txinfo; - struct carl9170_tx_info *arinfo; - struct ieee80211_sta *sta; - - rcu_read_lock(); - list_for_each_entry_rcu(iter, &ar->tx_ampdu_list, list) { - if (iter->state < CARL9170_TID_STATE_IDLE) - continue; - - spin_lock_bh(&iter->lock); - skb = skb_peek(&iter->queue); - if (!skb) - goto unlock; - - txinfo = IEEE80211_SKB_CB(skb); - arinfo = (void *)txinfo->rate_driver_data; - if (time_is_after_jiffies(arinfo->timeout + - msecs_to_jiffies(CARL9170_QUEUE_TIMEOUT))) - goto unlock; - - sta = __carl9170_get_tx_sta(ar, skb); - if (WARN_ON(!sta)) - goto unlock; - - ieee80211_stop_tx_ba_session(sta, iter->tid); -unlock: - spin_unlock_bh(&iter->lock); - - } - rcu_read_unlock(); -} - -void carl9170_tx_janitor(struct work_struct *work) -{ - struct ar9170 *ar = container_of(work, struct ar9170, - tx_janitor.work); - if (!IS_STARTED(ar)) - return; - - ar->tx_janitor_last_run = jiffies; - - carl9170_check_queue_stop_timeout(ar); - carl9170_tx_ampdu_timeout(ar); - - if (!atomic_read(&ar->tx_total_queued)) - return; - - ieee80211_queue_delayed_work(ar->hw, &ar->tx_janitor, - msecs_to_jiffies(CARL9170_TX_TIMEOUT)); -} - -static void __carl9170_tx_process_status(struct ar9170 *ar, - const uint8_t cookie, const uint8_t info) -{ - struct sk_buff *skb; - struct ieee80211_tx_info *txinfo; - unsigned int r, t, q; - bool success = true; - - q = ar9170_qmap[info & CARL9170_TX_STATUS_QUEUE]; - - skb = carl9170_get_queued_skb(ar, cookie, &ar->tx_status[q]); - if (!skb) { - /* - * We have lost the race to another thread. - */ - - return ; - } - - txinfo = IEEE80211_SKB_CB(skb); - - if (!(info & CARL9170_TX_STATUS_SUCCESS)) - success = false; - - r = (info & CARL9170_TX_STATUS_RIX) >> CARL9170_TX_STATUS_RIX_S; - t = (info & CARL9170_TX_STATUS_TRIES) >> CARL9170_TX_STATUS_TRIES_S; - - carl9170_tx_fill_rateinfo(ar, r, t, txinfo); - carl9170_tx_status(ar, skb, success); -} - -void carl9170_tx_process_status(struct ar9170 *ar, - const struct carl9170_rsp *cmd) -{ - unsigned int i; - - for (i = 0; i < cmd->hdr.ext; i++) { - if (WARN_ON(i > ((cmd->hdr.len / 2) + 1))) { - print_hex_dump_bytes("UU:", DUMP_PREFIX_NONE, - (void *) cmd, cmd->hdr.len + 4); - break; - } - - __carl9170_tx_process_status(ar, cmd->_tx_status[i].cookie, - cmd->_tx_status[i].info); - } -} - -static void carl9170_tx_rate_tpc_chains(struct ar9170 *ar, - struct ieee80211_tx_info *info, struct ieee80211_tx_rate *txrate, - unsigned int *phyrate, unsigned int *tpc, unsigned int *chains) -{ - struct ieee80211_rate *rate = NULL; - u8 *txpower; - unsigned int idx; - - idx = txrate->idx; - *tpc = 0; - *phyrate = 0; - - if (txrate->flags & IEEE80211_TX_RC_MCS) { - if (txrate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) { - /* +1 dBm for HT40 */ - *tpc += 2; - - if (info->band == IEEE80211_BAND_2GHZ) - txpower = ar->power_2G_ht40; - else - txpower = ar->power_5G_ht40; - } else { - if (info->band == IEEE80211_BAND_2GHZ) - txpower = ar->power_2G_ht20; - else - txpower = ar->power_5G_ht20; - } - - *phyrate = txrate->idx; - *tpc += txpower[idx & 7]; - } else { - if (info->band == IEEE80211_BAND_2GHZ) { - if (idx < 4) - txpower = ar->power_2G_cck; - else - txpower = ar->power_2G_ofdm; - } else { - txpower = ar->power_5G_leg; - idx += 4; - } - - rate = &__carl9170_ratetable[idx]; - *tpc += txpower[(rate->hw_value & 0x30) >> 4]; - *phyrate = rate->hw_value & 0xf; - } - - if (ar->eeprom.tx_mask == 1) { - *chains = AR9170_TX_PHY_TXCHAIN_1; - } else { - if (!(txrate->flags & IEEE80211_TX_RC_MCS) && - rate && rate->bitrate >= 360) - *chains = AR9170_TX_PHY_TXCHAIN_1; - else - *chains = AR9170_TX_PHY_TXCHAIN_2; - } - - *tpc = min_t(unsigned int, *tpc, ar->hw->conf.power_level * 2); -} - -static __le32 carl9170_tx_physet(struct ar9170 *ar, - struct ieee80211_tx_info *info, struct ieee80211_tx_rate *txrate) -{ - unsigned int power = 0, chains = 0, phyrate = 0; - __le32 tmp; - - tmp = cpu_to_le32(0); - - if (txrate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) - tmp |= cpu_to_le32(AR9170_TX_PHY_BW_40MHZ << - AR9170_TX_PHY_BW_S); - /* this works because 40 MHz is 2 and dup is 3 */ - if (txrate->flags & IEEE80211_TX_RC_DUP_DATA) - tmp |= cpu_to_le32(AR9170_TX_PHY_BW_40MHZ_DUP << - AR9170_TX_PHY_BW_S); - - if (txrate->flags & IEEE80211_TX_RC_SHORT_GI) - tmp |= cpu_to_le32(AR9170_TX_PHY_SHORT_GI); - - if (txrate->flags & IEEE80211_TX_RC_MCS) { - SET_VAL(AR9170_TX_PHY_MCS, phyrate, txrate->idx); - - /* heavy clip control */ - tmp |= cpu_to_le32((txrate->idx & 0x7) << - AR9170_TX_PHY_TX_HEAVY_CLIP_S); - - tmp |= cpu_to_le32(AR9170_TX_PHY_MOD_HT); - - /* - * green field preamble does not work. - * - * if (txrate->flags & IEEE80211_TX_RC_GREEN_FIELD) - * tmp |= cpu_to_le32(AR9170_TX_PHY_GREENFIELD); - */ - } else { - if (info->band == IEEE80211_BAND_2GHZ) { - if (txrate->idx <= AR9170_TX_PHY_RATE_CCK_11M) - tmp |= cpu_to_le32(AR9170_TX_PHY_MOD_CCK); - else - tmp |= cpu_to_le32(AR9170_TX_PHY_MOD_OFDM); - } else { - tmp |= cpu_to_le32(AR9170_TX_PHY_MOD_OFDM); - } - - /* - * short preamble seems to be broken too. - * - * if (txrate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) - * tmp |= cpu_to_le32(AR9170_TX_PHY_SHORT_PREAMBLE); - */ - } - carl9170_tx_rate_tpc_chains(ar, info, txrate, - &phyrate, &power, &chains); - - tmp |= cpu_to_le32(SET_CONSTVAL(AR9170_TX_PHY_MCS, phyrate)); - tmp |= cpu_to_le32(SET_CONSTVAL(AR9170_TX_PHY_TX_PWR, power)); - tmp |= cpu_to_le32(SET_CONSTVAL(AR9170_TX_PHY_TXCHAIN, chains)); - return tmp; -} - -static bool carl9170_tx_rts_check(struct ar9170 *ar, - struct ieee80211_tx_rate *rate, - bool ampdu, bool multi) -{ - switch (ar->erp_mode) { - case CARL9170_ERP_AUTO: - if (ampdu) - break; - - case CARL9170_ERP_MAC80211: - if (!(rate->flags & IEEE80211_TX_RC_USE_RTS_CTS)) - break; - - case CARL9170_ERP_RTS: - if (likely(!multi)) - return true; - - default: - break; - } - - return false; -} - -static bool carl9170_tx_cts_check(struct ar9170 *ar, - struct ieee80211_tx_rate *rate) -{ - switch (ar->erp_mode) { - case CARL9170_ERP_AUTO: - case CARL9170_ERP_MAC80211: - if (!(rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) - break; - - case CARL9170_ERP_CTS: - return true; - - default: - break; - } - - return false; -} - -static int carl9170_tx_prepare(struct ar9170 *ar, - struct ieee80211_sta *sta, - struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr; - struct _carl9170_tx_superframe *txc; - struct carl9170_vif_info *cvif; - struct ieee80211_tx_info *info; - struct ieee80211_tx_rate *txrate; - struct carl9170_tx_info *arinfo; - unsigned int hw_queue; - int i; - __le16 mac_tmp; - u16 len; - bool ampdu, no_ack; - - BUILD_BUG_ON(sizeof(*arinfo) > sizeof(info->rate_driver_data)); - BUILD_BUG_ON(sizeof(struct _carl9170_tx_superdesc) != - CARL9170_TX_SUPERDESC_LEN); - - BUILD_BUG_ON(sizeof(struct _ar9170_tx_hwdesc) != - AR9170_TX_HWDESC_LEN); - - BUILD_BUG_ON(IEEE80211_TX_MAX_RATES < CARL9170_TX_MAX_RATES); - - BUILD_BUG_ON(AR9170_MAX_VIRTUAL_MAC > - ((CARL9170_TX_SUPER_MISC_VIF_ID >> - CARL9170_TX_SUPER_MISC_VIF_ID_S) + 1)); - - hw_queue = ar9170_qmap[carl9170_get_queue(ar, skb)]; - - hdr = (void *)skb->data; - info = IEEE80211_SKB_CB(skb); - len = skb->len; - - /* - * Note: If the frame was sent through a monitor interface, - * the ieee80211_vif pointer can be NULL. - */ - if (likely(info->control.vif)) - cvif = (void *) info->control.vif->drv_priv; - else - cvif = NULL; - - txc = (void *)skb_push(skb, sizeof(*txc)); - memset(txc, 0, sizeof(*txc)); - - SET_VAL(CARL9170_TX_SUPER_MISC_QUEUE, txc->s.misc, hw_queue); - - if (likely(cvif)) - SET_VAL(CARL9170_TX_SUPER_MISC_VIF_ID, txc->s.misc, cvif->id); - - if (unlikely(info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM)) - txc->s.misc |= CARL9170_TX_SUPER_MISC_CAB; - - if (unlikely(info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)) - txc->s.misc |= CARL9170_TX_SUPER_MISC_ASSIGN_SEQ; - - if (unlikely(ieee80211_is_probe_resp(hdr->frame_control))) - txc->s.misc |= CARL9170_TX_SUPER_MISC_FILL_IN_TSF; - - mac_tmp = cpu_to_le16(AR9170_TX_MAC_HW_DURATION | - AR9170_TX_MAC_BACKOFF); - mac_tmp |= cpu_to_le16((hw_queue << AR9170_TX_MAC_QOS_S) & - AR9170_TX_MAC_QOS); - - no_ack = !!(info->flags & IEEE80211_TX_CTL_NO_ACK); - if (unlikely(no_ack)) - mac_tmp |= cpu_to_le16(AR9170_TX_MAC_NO_ACK); - - if (info->control.hw_key) { - len += info->control.hw_key->icv_len; - - switch (info->control.hw_key->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - case WLAN_CIPHER_SUITE_TKIP: - mac_tmp |= cpu_to_le16(AR9170_TX_MAC_ENCR_RC4); - break; - case WLAN_CIPHER_SUITE_CCMP: - mac_tmp |= cpu_to_le16(AR9170_TX_MAC_ENCR_AES); - break; - default: - WARN_ON(1); - goto err_out; - } - } - - ampdu = !!(info->flags & IEEE80211_TX_CTL_AMPDU); - if (ampdu) { - unsigned int density, factor; - - if (unlikely(!sta || !cvif)) - goto err_out; - - factor = min_t(unsigned int, 1u, sta->ht_cap.ampdu_factor); - density = sta->ht_cap.ampdu_density; - - if (density) { - /* - * Watch out! - * - * Otus uses slightly different density values than - * those from the 802.11n spec. - */ - - density = max_t(unsigned int, density + 1, 7u); - } - - SET_VAL(CARL9170_TX_SUPER_AMPDU_DENSITY, - txc->s.ampdu_settings, density); - - SET_VAL(CARL9170_TX_SUPER_AMPDU_FACTOR, - txc->s.ampdu_settings, factor); - } - - /* - * NOTE: For the first rate, the ERP & AMPDU flags are directly - * taken from mac_control. For all fallback rate, the firmware - * updates the mac_control flags from the rate info field. - */ - for (i = 0; i < CARL9170_TX_MAX_RATES; i++) { - __le32 phy_set; - txrate = &info->control.rates[i]; - if (txrate->idx < 0) - break; - - phy_set = carl9170_tx_physet(ar, info, txrate); - if (i == 0) { - /* first rate - part of the hw's frame header */ - txc->f.phy_control = phy_set; - - if (ampdu && txrate->flags & IEEE80211_TX_RC_MCS) - mac_tmp |= cpu_to_le16(AR9170_TX_MAC_AGGR); - if (carl9170_tx_rts_check(ar, txrate, ampdu, no_ack)) - mac_tmp |= cpu_to_le16(AR9170_TX_MAC_PROT_RTS); - else if (carl9170_tx_cts_check(ar, txrate)) - mac_tmp |= cpu_to_le16(AR9170_TX_MAC_PROT_CTS); - - } else { - /* fallback rates are stored in the firmware's - * retry rate set array. - */ - txc->s.rr[i - 1] = phy_set; - } - - SET_VAL(CARL9170_TX_SUPER_RI_TRIES, txc->s.ri[i], - txrate->count); - - if (carl9170_tx_rts_check(ar, txrate, ampdu, no_ack)) - txc->s.ri[i] |= (AR9170_TX_MAC_PROT_RTS << - CARL9170_TX_SUPER_RI_ERP_PROT_S); - else if (carl9170_tx_cts_check(ar, txrate)) - txc->s.ri[i] |= (AR9170_TX_MAC_PROT_CTS << - CARL9170_TX_SUPER_RI_ERP_PROT_S); - - if (ampdu && (txrate->flags & IEEE80211_TX_RC_MCS)) - txc->s.ri[i] |= CARL9170_TX_SUPER_RI_AMPDU; - } - - txc->s.len = cpu_to_le16(skb->len); - txc->f.length = cpu_to_le16(len + FCS_LEN); - txc->f.mac_control = mac_tmp; - - arinfo = (void *)info->rate_driver_data; - arinfo->timeout = jiffies; - arinfo->ar = ar; - kref_init(&arinfo->ref); - return 0; - -err_out: - skb_pull(skb, sizeof(*txc)); - return -EINVAL; -} - -static void carl9170_set_immba(struct ar9170 *ar, struct sk_buff *skb) -{ - struct _carl9170_tx_superframe *super; - - super = (void *) skb->data; - super->f.mac_control |= cpu_to_le16(AR9170_TX_MAC_IMM_BA); -} - -static void carl9170_set_ampdu_params(struct ar9170 *ar, struct sk_buff *skb) -{ - struct _carl9170_tx_superframe *super; - int tmp; - - super = (void *) skb->data; - - tmp = (super->s.ampdu_settings & CARL9170_TX_SUPER_AMPDU_DENSITY) << - CARL9170_TX_SUPER_AMPDU_DENSITY_S; - - /* - * If you haven't noticed carl9170_tx_prepare has already filled - * in all ampdu spacing & factor parameters. - * Now it's the time to check whenever the settings have to be - * updated by the firmware, or if everything is still the same. - * - * There's no sane way to handle different density values with - * this hardware, so we may as well just do the compare in the - * driver. - */ - - if (tmp != ar->current_density) { - ar->current_density = tmp; - super->s.ampdu_settings |= - CARL9170_TX_SUPER_AMPDU_COMMIT_DENSITY; - } - - tmp = (super->s.ampdu_settings & CARL9170_TX_SUPER_AMPDU_FACTOR) << - CARL9170_TX_SUPER_AMPDU_FACTOR_S; - - if (tmp != ar->current_factor) { - ar->current_factor = tmp; - super->s.ampdu_settings |= - CARL9170_TX_SUPER_AMPDU_COMMIT_FACTOR; - } -} - -static bool carl9170_tx_rate_check(struct ar9170 *ar, struct sk_buff *_dest, - struct sk_buff *_src) -{ - struct _carl9170_tx_superframe *dest, *src; - - dest = (void *) _dest->data; - src = (void *) _src->data; - - /* - * The mac80211 rate control algorithm expects that all MPDUs in - * an AMPDU share the same tx vectors. - * This is not really obvious right now, because the hardware - * does the AMPDU setup according to its own rulebook. - * Our nicely assembled, strictly monotonic increasing mpdu - * chains will be broken up, mashed back together... - */ - - return (dest->f.phy_control == src->f.phy_control); -} - -static void carl9170_tx_ampdu(struct ar9170 *ar) -{ - struct sk_buff_head agg; - struct carl9170_sta_tid *tid_info; - struct sk_buff *skb, *first; - unsigned int i = 0, done_ampdus = 0; - u16 seq, queue, tmpssn; - - atomic_inc(&ar->tx_ampdu_scheduler); - ar->tx_ampdu_schedule = false; - - if (atomic_read(&ar->tx_ampdu_upload)) - return; - - if (!ar->tx_ampdu_list_len) - return; - - __skb_queue_head_init(&agg); - - rcu_read_lock(); - tid_info = rcu_dereference(ar->tx_ampdu_iter); - if (WARN_ON_ONCE(!tid_info)) { - rcu_read_unlock(); - return; - } - -retry: - list_for_each_entry_continue_rcu(tid_info, &ar->tx_ampdu_list, list) { - i++; - - if (tid_info->state < CARL9170_TID_STATE_PROGRESS) - continue; - - queue = TID_TO_WME_AC(tid_info->tid); - - spin_lock_bh(&tid_info->lock); - if (tid_info->state != CARL9170_TID_STATE_XMIT) - goto processed; - - tid_info->counter++; - first = skb_peek(&tid_info->queue); - tmpssn = carl9170_get_seq(first); - seq = tid_info->snx; - - if (unlikely(tmpssn != seq)) { - tid_info->state = CARL9170_TID_STATE_IDLE; - - goto processed; - } - - while ((skb = skb_peek(&tid_info->queue))) { - /* strict 0, 1, ..., n - 1, n frame sequence order */ - if (unlikely(carl9170_get_seq(skb) != seq)) - break; - - /* don't upload more than AMPDU FACTOR allows. */ - if (unlikely(SEQ_DIFF(tid_info->snx, tid_info->bsn) >= - (tid_info->max - 1))) - break; - - if (!carl9170_tx_rate_check(ar, skb, first)) - break; - - atomic_inc(&ar->tx_ampdu_upload); - tid_info->snx = seq = SEQ_NEXT(seq); - __skb_unlink(skb, &tid_info->queue); - - __skb_queue_tail(&agg, skb); - - if (skb_queue_len(&agg) >= CARL9170_NUM_TX_AGG_MAX) - break; - } - - if (skb_queue_empty(&tid_info->queue) || - carl9170_get_seq(skb_peek(&tid_info->queue)) != - tid_info->snx) { - /* - * stop TID, if A-MPDU frames are still missing, - * or whenever the queue is empty. - */ - - tid_info->state = CARL9170_TID_STATE_IDLE; - } - done_ampdus++; - -processed: - spin_unlock_bh(&tid_info->lock); - - if (skb_queue_empty(&agg)) - continue; - - /* apply ampdu spacing & factor settings */ - carl9170_set_ampdu_params(ar, skb_peek(&agg)); - - /* set aggregation push bit */ - carl9170_set_immba(ar, skb_peek_tail(&agg)); - - spin_lock_bh(&ar->tx_pending[queue].lock); - skb_queue_splice_tail_init(&agg, &ar->tx_pending[queue]); - spin_unlock_bh(&ar->tx_pending[queue].lock); - ar->tx_schedule = true; - } - if ((done_ampdus++ == 0) && (i++ == 0)) - goto retry; - - rcu_assign_pointer(ar->tx_ampdu_iter, tid_info); - rcu_read_unlock(); -} - -static struct sk_buff *carl9170_tx_pick_skb(struct ar9170 *ar, - struct sk_buff_head *queue) -{ - struct sk_buff *skb; - struct ieee80211_tx_info *info; - struct carl9170_tx_info *arinfo; - - BUILD_BUG_ON(sizeof(*arinfo) > sizeof(info->rate_driver_data)); - - spin_lock_bh(&queue->lock); - skb = skb_peek(queue); - if (unlikely(!skb)) - goto err_unlock; - - if (carl9170_alloc_dev_space(ar, skb)) - goto err_unlock; - - __skb_unlink(skb, queue); - spin_unlock_bh(&queue->lock); - - info = IEEE80211_SKB_CB(skb); - arinfo = (void *) info->rate_driver_data; - - arinfo->timeout = jiffies; - return skb; - -err_unlock: - spin_unlock_bh(&queue->lock); - return NULL; -} - -void carl9170_tx_drop(struct ar9170 *ar, struct sk_buff *skb) -{ - struct _carl9170_tx_superframe *super; - uint8_t q = 0; - - ar->tx_dropped++; - - super = (void *)skb->data; - SET_VAL(CARL9170_TX_SUPER_MISC_QUEUE, q, - ar9170_qmap[carl9170_get_queue(ar, skb)]); - __carl9170_tx_process_status(ar, super->s.cookie, q); -} - -static bool carl9170_tx_ps_drop(struct ar9170 *ar, struct sk_buff *skb) -{ - struct ieee80211_sta *sta; - struct carl9170_sta_info *sta_info; - struct ieee80211_tx_info *tx_info; - - rcu_read_lock(); - sta = __carl9170_get_tx_sta(ar, skb); - if (!sta) - goto out_rcu; - - sta_info = (void *) sta->drv_priv; - tx_info = IEEE80211_SKB_CB(skb); - - if (unlikely(sta_info->sleeping) && - !(tx_info->flags & (IEEE80211_TX_CTL_NO_PS_BUFFER | - IEEE80211_TX_CTL_CLEAR_PS_FILT))) { - rcu_read_unlock(); - - if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) - atomic_dec(&ar->tx_ampdu_upload); - - tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; - carl9170_release_dev_space(ar, skb); - carl9170_tx_status(ar, skb, false); - return true; - } - -out_rcu: - rcu_read_unlock(); - return false; -} - -static void carl9170_bar_check(struct ar9170 *ar, struct sk_buff *skb) -{ - struct _carl9170_tx_superframe *super = (void *) skb->data; - struct ieee80211_bar *bar = (void *) super->frame_data; - - if (unlikely(ieee80211_is_back_req(bar->frame_control)) && - skb->len >= sizeof(struct ieee80211_bar)) { - struct carl9170_bar_list_entry *entry; - unsigned int queue = skb_get_queue_mapping(skb); - - entry = kmalloc(sizeof(*entry), GFP_ATOMIC); - if (!WARN_ON_ONCE(!entry)) { - entry->skb = skb; - spin_lock_bh(&ar->bar_list_lock[queue]); - list_add_tail_rcu(&entry->list, &ar->bar_list[queue]); - spin_unlock_bh(&ar->bar_list_lock[queue]); - } - } -} - -static void carl9170_tx(struct ar9170 *ar) -{ - struct sk_buff *skb; - unsigned int i, q; - bool schedule_garbagecollector = false; - - ar->tx_schedule = false; - - if (unlikely(!IS_STARTED(ar))) - return; - - carl9170_usb_handle_tx_err(ar); - - for (i = 0; i < ar->hw->queues; i++) { - while (!skb_queue_empty(&ar->tx_pending[i])) { - skb = carl9170_tx_pick_skb(ar, &ar->tx_pending[i]); - if (unlikely(!skb)) - break; - - if (unlikely(carl9170_tx_ps_drop(ar, skb))) - continue; - - carl9170_bar_check(ar, skb); - - atomic_inc(&ar->tx_total_pending); - - q = __carl9170_get_queue(ar, i); - /* - * NB: tx_status[i] vs. tx_status[q], - * TODO: Move into pick_skb or alloc_dev_space. - */ - skb_queue_tail(&ar->tx_status[q], skb); - - /* - * increase ref count to "2". - * Ref counting is the easiest way to solve the - * race between the urb's completion routine: - * carl9170_tx_callback - * and wlan tx status functions: - * carl9170_tx_status/janitor. - */ - carl9170_tx_get_skb(skb); - - carl9170_usb_tx(ar, skb); - schedule_garbagecollector = true; - } - } - - if (!schedule_garbagecollector) - return; - - ieee80211_queue_delayed_work(ar->hw, &ar->tx_janitor, - msecs_to_jiffies(CARL9170_TX_TIMEOUT)); -} - -static bool carl9170_tx_ampdu_queue(struct ar9170 *ar, - struct ieee80211_sta *sta, struct sk_buff *skb, - struct ieee80211_tx_info *txinfo) -{ - struct carl9170_sta_info *sta_info; - struct carl9170_sta_tid *agg; - struct sk_buff *iter; - u16 tid, seq, qseq, off; - bool run = false; - - tid = carl9170_get_tid(skb); - seq = carl9170_get_seq(skb); - sta_info = (void *) sta->drv_priv; - - rcu_read_lock(); - agg = rcu_dereference(sta_info->agg[tid]); - - if (!agg) - goto err_unlock_rcu; - - spin_lock_bh(&agg->lock); - if (unlikely(agg->state < CARL9170_TID_STATE_IDLE)) - goto err_unlock; - - /* check if sequence is within the BA window */ - if (unlikely(!BAW_WITHIN(agg->bsn, CARL9170_BAW_BITS, seq))) - goto err_unlock; - - if (WARN_ON_ONCE(!BAW_WITHIN(agg->snx, CARL9170_BAW_BITS, seq))) - goto err_unlock; - - off = SEQ_DIFF(seq, agg->bsn); - if (WARN_ON_ONCE(test_and_set_bit(off, agg->bitmap))) - goto err_unlock; - - if (likely(BAW_WITHIN(agg->hsn, CARL9170_BAW_BITS, seq))) { - __skb_queue_tail(&agg->queue, skb); - agg->hsn = seq; - goto queued; - } - - skb_queue_reverse_walk(&agg->queue, iter) { - qseq = carl9170_get_seq(iter); - - if (BAW_WITHIN(qseq, CARL9170_BAW_BITS, seq)) { - __skb_queue_after(&agg->queue, iter, skb); - goto queued; - } - } - - __skb_queue_head(&agg->queue, skb); -queued: - - if (unlikely(agg->state != CARL9170_TID_STATE_XMIT)) { - if (agg->snx == carl9170_get_seq(skb_peek(&agg->queue))) { - agg->state = CARL9170_TID_STATE_XMIT; - run = true; - } - } - - spin_unlock_bh(&agg->lock); - rcu_read_unlock(); - - return run; - -err_unlock: - spin_unlock_bh(&agg->lock); - -err_unlock_rcu: - rcu_read_unlock(); - txinfo->flags &= ~IEEE80211_TX_CTL_AMPDU; - carl9170_tx_status(ar, skb, false); - ar->tx_dropped++; - return false; -} - -void carl9170_op_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct ar9170 *ar = hw->priv; - struct ieee80211_tx_info *info; - struct ieee80211_sta *sta = control->sta; - bool run; - - if (unlikely(!IS_STARTED(ar))) - goto err_free; - - info = IEEE80211_SKB_CB(skb); - - if (unlikely(carl9170_tx_prepare(ar, sta, skb))) - goto err_free; - - carl9170_tx_accounting(ar, skb); - /* - * from now on, one has to use carl9170_tx_status to free - * all ressouces which are associated with the frame. - */ - - if (sta) { - struct carl9170_sta_info *stai = (void *) sta->drv_priv; - atomic_inc(&stai->pending_frames); - } - - if (info->flags & IEEE80211_TX_CTL_AMPDU) { - /* to static code analyzers and reviewers: - * mac80211 guarantees that a valid "sta" - * reference is present, if a frame is to - * be part of an ampdu. Hence any extra - * sta == NULL checks are redundant in this - * special case. - */ - run = carl9170_tx_ampdu_queue(ar, sta, skb, info); - if (run) - carl9170_tx_ampdu(ar); - - } else { - unsigned int queue = skb_get_queue_mapping(skb); - - skb_queue_tail(&ar->tx_pending[queue], skb); - } - - carl9170_tx(ar); - return; - -err_free: - ar->tx_dropped++; - ieee80211_free_txskb(ar->hw, skb); -} - -void carl9170_tx_scheduler(struct ar9170 *ar) -{ - - if (ar->tx_ampdu_schedule) - carl9170_tx_ampdu(ar); - - if (ar->tx_schedule) - carl9170_tx(ar); -} - -/* caller has to take rcu_read_lock */ -static struct carl9170_vif_info *carl9170_pick_beaconing_vif(struct ar9170 *ar) -{ - struct carl9170_vif_info *cvif; - int i = 1; - - /* The AR9170 hardware has no fancy beacon queue or some - * other scheduling mechanism. So, the driver has to make - * due by setting the two beacon timers (pretbtt and tbtt) - * once and then swapping the beacon address in the HW's - * register file each time the pretbtt fires. - */ - - cvif = rcu_dereference(ar->beacon_iter); - if (ar->vifs > 0 && cvif) { - do { - list_for_each_entry_continue_rcu(cvif, &ar->vif_list, - list) { - if (cvif->active && cvif->enable_beacon) - goto out; - } - } while (ar->beacon_enabled && i--); - } - -out: - rcu_assign_pointer(ar->beacon_iter, cvif); - return cvif; -} - -static bool carl9170_tx_beacon_physet(struct ar9170 *ar, struct sk_buff *skb, - u32 *ht1, u32 *plcp) -{ - struct ieee80211_tx_info *txinfo; - struct ieee80211_tx_rate *rate; - unsigned int power, chains; - bool ht_rate; - - txinfo = IEEE80211_SKB_CB(skb); - rate = &txinfo->control.rates[0]; - ht_rate = !!(txinfo->control.rates[0].flags & IEEE80211_TX_RC_MCS); - carl9170_tx_rate_tpc_chains(ar, txinfo, rate, plcp, &power, &chains); - - *ht1 = AR9170_MAC_BCN_HT1_TX_ANT0; - if (chains == AR9170_TX_PHY_TXCHAIN_2) - *ht1 |= AR9170_MAC_BCN_HT1_TX_ANT1; - SET_VAL(AR9170_MAC_BCN_HT1_PWR_CTRL, *ht1, 7); - SET_VAL(AR9170_MAC_BCN_HT1_TPC, *ht1, power); - SET_VAL(AR9170_MAC_BCN_HT1_CHAIN_MASK, *ht1, chains); - - if (ht_rate) { - *ht1 |= AR9170_MAC_BCN_HT1_HT_EN; - if (rate->flags & IEEE80211_TX_RC_SHORT_GI) - *plcp |= AR9170_MAC_BCN_HT2_SGI; - - if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) { - *ht1 |= AR9170_MAC_BCN_HT1_BWC_40M_SHARED; - *plcp |= AR9170_MAC_BCN_HT2_BW40; - } else if (rate->flags & IEEE80211_TX_RC_DUP_DATA) { - *ht1 |= AR9170_MAC_BCN_HT1_BWC_40M_DUP; - *plcp |= AR9170_MAC_BCN_HT2_BW40; - } - - SET_VAL(AR9170_MAC_BCN_HT2_LEN, *plcp, skb->len + FCS_LEN); - } else { - if (*plcp <= AR9170_TX_PHY_RATE_CCK_11M) - *plcp |= ((skb->len + FCS_LEN) << (3 + 16)) + 0x0400; - else - *plcp |= ((skb->len + FCS_LEN) << 16) + 0x0010; - } - - return ht_rate; -} - -int carl9170_update_beacon(struct ar9170 *ar, const bool submit) -{ - struct sk_buff *skb = NULL; - struct carl9170_vif_info *cvif; - __le32 *data, *old = NULL; - u32 word, ht1, plcp, off, addr, len; - int i = 0, err = 0; - bool ht_rate; - - rcu_read_lock(); - cvif = carl9170_pick_beaconing_vif(ar); - if (!cvif) - goto out_unlock; - - skb = ieee80211_beacon_get_tim(ar->hw, carl9170_get_vif(cvif), - NULL, NULL); - - if (!skb) { - err = -ENOMEM; - goto err_free; - } - - spin_lock_bh(&ar->beacon_lock); - data = (__le32 *)skb->data; - if (cvif->beacon) - old = (__le32 *)cvif->beacon->data; - - off = cvif->id * AR9170_MAC_BCN_LENGTH_MAX; - addr = ar->fw.beacon_addr + off; - len = roundup(skb->len + FCS_LEN, 4); - - if ((off + len) > ar->fw.beacon_max_len) { - if (net_ratelimit()) { - wiphy_err(ar->hw->wiphy, "beacon does not " - "fit into device memory!\n"); - } - err = -EINVAL; - goto err_unlock; - } - - if (len > AR9170_MAC_BCN_LENGTH_MAX) { - if (net_ratelimit()) { - wiphy_err(ar->hw->wiphy, "no support for beacons " - "bigger than %d (yours:%d).\n", - AR9170_MAC_BCN_LENGTH_MAX, len); - } - - err = -EMSGSIZE; - goto err_unlock; - } - - ht_rate = carl9170_tx_beacon_physet(ar, skb, &ht1, &plcp); - - carl9170_async_regwrite_begin(ar); - carl9170_async_regwrite(AR9170_MAC_REG_BCN_HT1, ht1); - if (ht_rate) - carl9170_async_regwrite(AR9170_MAC_REG_BCN_HT2, plcp); - else - carl9170_async_regwrite(AR9170_MAC_REG_BCN_PLCP, plcp); - - for (i = 0; i < DIV_ROUND_UP(skb->len, 4); i++) { - /* - * XXX: This accesses beyond skb data for up - * to the last 3 bytes!! - */ - - if (old && (data[i] == old[i])) - continue; - - word = le32_to_cpu(data[i]); - carl9170_async_regwrite(addr + 4 * i, word); - } - carl9170_async_regwrite_finish(); - - dev_kfree_skb_any(cvif->beacon); - cvif->beacon = NULL; - - err = carl9170_async_regwrite_result(); - if (!err) - cvif->beacon = skb; - spin_unlock_bh(&ar->beacon_lock); - if (err) - goto err_free; - - if (submit) { - err = carl9170_bcn_ctrl(ar, cvif->id, - CARL9170_BCN_CTRL_CAB_TRIGGER, - addr, skb->len + FCS_LEN); - - if (err) - goto err_free; - } -out_unlock: - rcu_read_unlock(); - return 0; - -err_unlock: - spin_unlock_bh(&ar->beacon_lock); - -err_free: - rcu_read_unlock(); - dev_kfree_skb_any(skb); - return err; -} diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c deleted file mode 100644 index 307bc0ddff99..000000000000 --- a/drivers/net/wireless/ath/carl9170/usb.c +++ /dev/null @@ -1,1172 +0,0 @@ -/* - * Atheros CARL9170 driver - * - * USB - frontend - * - * Copyright 2008, Johannes Berg - * Copyright 2009, 2010, Christian Lamparter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "carl9170.h" -#include "cmd.h" -#include "hw.h" -#include "fwcmd.h" - -MODULE_AUTHOR("Johannes Berg "); -MODULE_AUTHOR("Christian Lamparter "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Atheros AR9170 802.11n USB wireless"); -MODULE_FIRMWARE(CARL9170FW_NAME); -MODULE_ALIAS("ar9170usb"); -MODULE_ALIAS("arusb_lnx"); - -/* - * Note: - * - * Always update our wiki's device list (located at: - * http://wireless.kernel.org/en/users/Drivers/ar9170/devices ), - * whenever you add a new device. - */ -static struct usb_device_id carl9170_usb_ids[] = { - /* Atheros 9170 */ - { USB_DEVICE(0x0cf3, 0x9170) }, - /* Atheros TG121N */ - { USB_DEVICE(0x0cf3, 0x1001) }, - /* TP-Link TL-WN821N v2 */ - { USB_DEVICE(0x0cf3, 0x1002), .driver_info = CARL9170_WPS_BUTTON | - CARL9170_ONE_LED }, - /* 3Com Dual Band 802.11n USB Adapter */ - { USB_DEVICE(0x0cf3, 0x1010) }, - /* H3C Dual Band 802.11n USB Adapter */ - { USB_DEVICE(0x0cf3, 0x1011) }, - /* Cace Airpcap NX */ - { USB_DEVICE(0xcace, 0x0300) }, - /* D-Link DWA 160 A1 */ - { USB_DEVICE(0x07d1, 0x3c10) }, - /* D-Link DWA 160 A2 */ - { USB_DEVICE(0x07d1, 0x3a09) }, - /* D-Link DWA 130 D */ - { USB_DEVICE(0x07d1, 0x3a0f) }, - /* Netgear WNA1000 */ - { USB_DEVICE(0x0846, 0x9040) }, - /* Netgear WNDA3100 (v1) */ - { USB_DEVICE(0x0846, 0x9010) }, - /* Netgear WN111 v2 */ - { USB_DEVICE(0x0846, 0x9001), .driver_info = CARL9170_ONE_LED }, - /* Zydas ZD1221 */ - { USB_DEVICE(0x0ace, 0x1221) }, - /* Proxim ORiNOCO 802.11n USB */ - { USB_DEVICE(0x1435, 0x0804) }, - /* WNC Generic 11n USB Dongle */ - { USB_DEVICE(0x1435, 0x0326) }, - /* ZyXEL NWD271N */ - { USB_DEVICE(0x0586, 0x3417) }, - /* Z-Com UB81 BG */ - { USB_DEVICE(0x0cde, 0x0023) }, - /* Z-Com UB82 ABG */ - { USB_DEVICE(0x0cde, 0x0026) }, - /* Sphairon Homelink 1202 */ - { USB_DEVICE(0x0cde, 0x0027) }, - /* Arcadyan WN7512 */ - { USB_DEVICE(0x083a, 0xf522) }, - /* Planex GWUS300 */ - { USB_DEVICE(0x2019, 0x5304) }, - /* IO-Data WNGDNUS2 */ - { USB_DEVICE(0x04bb, 0x093f) }, - /* NEC WL300NU-G */ - { USB_DEVICE(0x0409, 0x0249) }, - /* NEC WL300NU-AG */ - { USB_DEVICE(0x0409, 0x02b4) }, - /* AVM FRITZ!WLAN USB Stick N */ - { USB_DEVICE(0x057c, 0x8401) }, - /* AVM FRITZ!WLAN USB Stick N 2.4 */ - { USB_DEVICE(0x057c, 0x8402) }, - /* Qwest/Actiontec 802AIN Wireless N USB Network Adapter */ - { USB_DEVICE(0x1668, 0x1200) }, - /* Airlive X.USB a/b/g/n */ - { USB_DEVICE(0x1b75, 0x9170) }, - - /* terminate */ - {} -}; -MODULE_DEVICE_TABLE(usb, carl9170_usb_ids); - -static void carl9170_usb_submit_data_urb(struct ar9170 *ar) -{ - struct urb *urb; - int err; - - if (atomic_inc_return(&ar->tx_anch_urbs) > AR9170_NUM_TX_URBS) - goto err_acc; - - urb = usb_get_from_anchor(&ar->tx_wait); - if (!urb) - goto err_acc; - - usb_anchor_urb(urb, &ar->tx_anch); - - err = usb_submit_urb(urb, GFP_ATOMIC); - if (unlikely(err)) { - if (net_ratelimit()) { - dev_err(&ar->udev->dev, "tx submit failed (%d)\n", - urb->status); - } - - usb_unanchor_urb(urb); - usb_anchor_urb(urb, &ar->tx_err); - } - - usb_free_urb(urb); - - if (likely(err == 0)) - return; - -err_acc: - atomic_dec(&ar->tx_anch_urbs); -} - -static void carl9170_usb_tx_data_complete(struct urb *urb) -{ - struct ar9170 *ar = usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); - - if (WARN_ON_ONCE(!ar)) { - dev_kfree_skb_irq(urb->context); - return; - } - - atomic_dec(&ar->tx_anch_urbs); - - switch (urb->status) { - /* everything is fine */ - case 0: - carl9170_tx_callback(ar, (void *)urb->context); - break; - - /* disconnect */ - case -ENOENT: - case -ECONNRESET: - case -ENODEV: - case -ESHUTDOWN: - /* - * Defer the frame clean-up to the tasklet worker. - * This is necessary, because carl9170_tx_drop - * does not work in an irqsave context. - */ - usb_anchor_urb(urb, &ar->tx_err); - return; - - /* a random transmission error has occurred? */ - default: - if (net_ratelimit()) { - dev_err(&ar->udev->dev, "tx failed (%d)\n", - urb->status); - } - - usb_anchor_urb(urb, &ar->tx_err); - break; - } - - if (likely(IS_STARTED(ar))) - carl9170_usb_submit_data_urb(ar); -} - -static int carl9170_usb_submit_cmd_urb(struct ar9170 *ar) -{ - struct urb *urb; - int err; - - if (atomic_inc_return(&ar->tx_cmd_urbs) != 1) { - atomic_dec(&ar->tx_cmd_urbs); - return 0; - } - - urb = usb_get_from_anchor(&ar->tx_cmd); - if (!urb) { - atomic_dec(&ar->tx_cmd_urbs); - return 0; - } - - usb_anchor_urb(urb, &ar->tx_anch); - err = usb_submit_urb(urb, GFP_ATOMIC); - if (unlikely(err)) { - usb_unanchor_urb(urb); - atomic_dec(&ar->tx_cmd_urbs); - } - usb_free_urb(urb); - - return err; -} - -static void carl9170_usb_cmd_complete(struct urb *urb) -{ - struct ar9170 *ar = urb->context; - int err = 0; - - if (WARN_ON_ONCE(!ar)) - return; - - atomic_dec(&ar->tx_cmd_urbs); - - switch (urb->status) { - /* everything is fine */ - case 0: - break; - - /* disconnect */ - case -ENOENT: - case -ECONNRESET: - case -ENODEV: - case -ESHUTDOWN: - return; - - default: - err = urb->status; - break; - } - - if (!IS_INITIALIZED(ar)) - return; - - if (err) - dev_err(&ar->udev->dev, "submit cmd cb failed (%d).\n", err); - - err = carl9170_usb_submit_cmd_urb(ar); - if (err) - dev_err(&ar->udev->dev, "submit cmd failed (%d).\n", err); -} - -static void carl9170_usb_rx_irq_complete(struct urb *urb) -{ - struct ar9170 *ar = urb->context; - - if (WARN_ON_ONCE(!ar)) - return; - - switch (urb->status) { - /* everything is fine */ - case 0: - break; - - /* disconnect */ - case -ENOENT: - case -ECONNRESET: - case -ENODEV: - case -ESHUTDOWN: - return; - - default: - goto resubmit; - } - - /* - * While the carl9170 firmware does not use this EP, the - * firmware loader in the EEPROM unfortunately does. - * Therefore we need to be ready to handle out-of-band - * responses and traps in case the firmware crashed and - * the loader took over again. - */ - carl9170_handle_command_response(ar, urb->transfer_buffer, - urb->actual_length); - -resubmit: - usb_anchor_urb(urb, &ar->rx_anch); - if (unlikely(usb_submit_urb(urb, GFP_ATOMIC))) - usb_unanchor_urb(urb); -} - -static int carl9170_usb_submit_rx_urb(struct ar9170 *ar, gfp_t gfp) -{ - struct urb *urb; - int err = 0, runs = 0; - - while ((atomic_read(&ar->rx_anch_urbs) < AR9170_NUM_RX_URBS) && - (runs++ < AR9170_NUM_RX_URBS)) { - err = -ENOSPC; - urb = usb_get_from_anchor(&ar->rx_pool); - if (urb) { - usb_anchor_urb(urb, &ar->rx_anch); - err = usb_submit_urb(urb, gfp); - if (unlikely(err)) { - usb_unanchor_urb(urb); - usb_anchor_urb(urb, &ar->rx_pool); - } else { - atomic_dec(&ar->rx_pool_urbs); - atomic_inc(&ar->rx_anch_urbs); - } - usb_free_urb(urb); - } - } - - return err; -} - -static void carl9170_usb_rx_work(struct ar9170 *ar) -{ - struct urb *urb; - int i; - - for (i = 0; i < AR9170_NUM_RX_URBS_POOL; i++) { - urb = usb_get_from_anchor(&ar->rx_work); - if (!urb) - break; - - atomic_dec(&ar->rx_work_urbs); - if (IS_INITIALIZED(ar)) { - carl9170_rx(ar, urb->transfer_buffer, - urb->actual_length); - } - - usb_anchor_urb(urb, &ar->rx_pool); - atomic_inc(&ar->rx_pool_urbs); - - usb_free_urb(urb); - - carl9170_usb_submit_rx_urb(ar, GFP_ATOMIC); - } -} - -void carl9170_usb_handle_tx_err(struct ar9170 *ar) -{ - struct urb *urb; - - while ((urb = usb_get_from_anchor(&ar->tx_err))) { - struct sk_buff *skb = (void *)urb->context; - - carl9170_tx_drop(ar, skb); - carl9170_tx_callback(ar, skb); - usb_free_urb(urb); - } -} - -static void carl9170_usb_tasklet(unsigned long data) -{ - struct ar9170 *ar = (struct ar9170 *) data; - - if (!IS_INITIALIZED(ar)) - return; - - carl9170_usb_rx_work(ar); - - /* - * Strictly speaking: The tx scheduler is not part of the USB system. - * But the rx worker returns frames back to the mac80211-stack and - * this is the _perfect_ place to generate the next transmissions. - */ - if (IS_STARTED(ar)) - carl9170_tx_scheduler(ar); -} - -static void carl9170_usb_rx_complete(struct urb *urb) -{ - struct ar9170 *ar = (struct ar9170 *)urb->context; - int err; - - if (WARN_ON_ONCE(!ar)) - return; - - atomic_dec(&ar->rx_anch_urbs); - - switch (urb->status) { - case 0: - /* rx path */ - usb_anchor_urb(urb, &ar->rx_work); - atomic_inc(&ar->rx_work_urbs); - break; - - case -ENOENT: - case -ECONNRESET: - case -ENODEV: - case -ESHUTDOWN: - /* handle disconnect events*/ - return; - - default: - /* handle all other errors */ - usb_anchor_urb(urb, &ar->rx_pool); - atomic_inc(&ar->rx_pool_urbs); - break; - } - - err = carl9170_usb_submit_rx_urb(ar, GFP_ATOMIC); - if (unlikely(err)) { - /* - * usb_submit_rx_urb reported a problem. - * In case this is due to a rx buffer shortage, - * elevate the tasklet worker priority to - * the highest available level. - */ - tasklet_hi_schedule(&ar->usb_tasklet); - - if (atomic_read(&ar->rx_anch_urbs) == 0) { - /* - * The system is too slow to cope with - * the enormous workload. We have simply - * run out of active rx urbs and this - * unfortunately leads to an unpredictable - * device. - */ - - ieee80211_queue_work(ar->hw, &ar->ping_work); - } - } else { - /* - * Using anything less than _high_ priority absolutely - * kills the rx performance my UP-System... - */ - tasklet_hi_schedule(&ar->usb_tasklet); - } -} - -static struct urb *carl9170_usb_alloc_rx_urb(struct ar9170 *ar, gfp_t gfp) -{ - struct urb *urb; - void *buf; - - buf = kmalloc(ar->fw.rx_size, gfp); - if (!buf) - return NULL; - - urb = usb_alloc_urb(0, gfp); - if (!urb) { - kfree(buf); - return NULL; - } - - usb_fill_bulk_urb(urb, ar->udev, usb_rcvbulkpipe(ar->udev, - AR9170_USB_EP_RX), buf, ar->fw.rx_size, - carl9170_usb_rx_complete, ar); - - urb->transfer_flags |= URB_FREE_BUFFER; - - return urb; -} - -static int carl9170_usb_send_rx_irq_urb(struct ar9170 *ar) -{ - struct urb *urb = NULL; - void *ibuf; - int err = -ENOMEM; - - urb = usb_alloc_urb(0, GFP_KERNEL); - if (!urb) - goto out; - - ibuf = kmalloc(AR9170_USB_EP_CTRL_MAX, GFP_KERNEL); - if (!ibuf) - goto out; - - usb_fill_int_urb(urb, ar->udev, usb_rcvintpipe(ar->udev, - AR9170_USB_EP_IRQ), ibuf, AR9170_USB_EP_CTRL_MAX, - carl9170_usb_rx_irq_complete, ar, 1); - - urb->transfer_flags |= URB_FREE_BUFFER; - - usb_anchor_urb(urb, &ar->rx_anch); - err = usb_submit_urb(urb, GFP_KERNEL); - if (err) - usb_unanchor_urb(urb); - -out: - usb_free_urb(urb); - return err; -} - -static int carl9170_usb_init_rx_bulk_urbs(struct ar9170 *ar) -{ - struct urb *urb; - int i, err = -EINVAL; - - /* - * The driver actively maintains a second shadow - * pool for inactive, but fully-prepared rx urbs. - * - * The pool should help the driver to master huge - * workload spikes without running the risk of - * undersupplying the hardware or wasting time by - * processing rx data (streams) inside the urb - * completion (hardirq context). - */ - for (i = 0; i < AR9170_NUM_RX_URBS_POOL; i++) { - urb = carl9170_usb_alloc_rx_urb(ar, GFP_KERNEL); - if (!urb) { - err = -ENOMEM; - goto err_out; - } - - usb_anchor_urb(urb, &ar->rx_pool); - atomic_inc(&ar->rx_pool_urbs); - usb_free_urb(urb); - } - - err = carl9170_usb_submit_rx_urb(ar, GFP_KERNEL); - if (err) - goto err_out; - - /* the device now waiting for the firmware. */ - carl9170_set_state_when(ar, CARL9170_STOPPED, CARL9170_IDLE); - return 0; - -err_out: - - usb_scuttle_anchored_urbs(&ar->rx_pool); - usb_scuttle_anchored_urbs(&ar->rx_work); - usb_kill_anchored_urbs(&ar->rx_anch); - return err; -} - -static int carl9170_usb_flush(struct ar9170 *ar) -{ - struct urb *urb; - int ret, err = 0; - - while ((urb = usb_get_from_anchor(&ar->tx_wait))) { - struct sk_buff *skb = (void *)urb->context; - carl9170_tx_drop(ar, skb); - carl9170_tx_callback(ar, skb); - usb_free_urb(urb); - } - - ret = usb_wait_anchor_empty_timeout(&ar->tx_cmd, 1000); - if (ret == 0) - err = -ETIMEDOUT; - - /* lets wait a while until the tx - queues are dried out */ - ret = usb_wait_anchor_empty_timeout(&ar->tx_anch, 1000); - if (ret == 0) - err = -ETIMEDOUT; - - usb_kill_anchored_urbs(&ar->tx_anch); - carl9170_usb_handle_tx_err(ar); - - return err; -} - -static void carl9170_usb_cancel_urbs(struct ar9170 *ar) -{ - int err; - - carl9170_set_state(ar, CARL9170_UNKNOWN_STATE); - - err = carl9170_usb_flush(ar); - if (err) - dev_err(&ar->udev->dev, "stuck tx urbs!\n"); - - usb_poison_anchored_urbs(&ar->tx_anch); - carl9170_usb_handle_tx_err(ar); - usb_poison_anchored_urbs(&ar->rx_anch); - - tasklet_kill(&ar->usb_tasklet); - - usb_scuttle_anchored_urbs(&ar->rx_work); - usb_scuttle_anchored_urbs(&ar->rx_pool); - usb_scuttle_anchored_urbs(&ar->tx_cmd); -} - -int __carl9170_exec_cmd(struct ar9170 *ar, struct carl9170_cmd *cmd, - const bool free_buf) -{ - struct urb *urb; - int err = 0; - - if (!IS_INITIALIZED(ar)) { - err = -EPERM; - goto err_free; - } - - if (WARN_ON(cmd->hdr.len > CARL9170_MAX_CMD_LEN - 4)) { - err = -EINVAL; - goto err_free; - } - - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!urb) { - err = -ENOMEM; - goto err_free; - } - - usb_fill_int_urb(urb, ar->udev, usb_sndintpipe(ar->udev, - AR9170_USB_EP_CMD), cmd, cmd->hdr.len + 4, - carl9170_usb_cmd_complete, ar, 1); - - if (free_buf) - urb->transfer_flags |= URB_FREE_BUFFER; - - usb_anchor_urb(urb, &ar->tx_cmd); - usb_free_urb(urb); - - return carl9170_usb_submit_cmd_urb(ar); - -err_free: - if (free_buf) - kfree(cmd); - - return err; -} - -int carl9170_exec_cmd(struct ar9170 *ar, const enum carl9170_cmd_oids cmd, - unsigned int plen, void *payload, unsigned int outlen, void *out) -{ - int err = -ENOMEM; - - if (!IS_ACCEPTING_CMD(ar)) - return -EIO; - - if (!(cmd & CARL9170_CMD_ASYNC_FLAG)) - might_sleep(); - - ar->cmd.hdr.len = plen; - ar->cmd.hdr.cmd = cmd; - /* writing multiple regs fills this buffer already */ - if (plen && payload != (u8 *)(ar->cmd.data)) - memcpy(ar->cmd.data, payload, plen); - - spin_lock_bh(&ar->cmd_lock); - ar->readbuf = (u8 *)out; - ar->readlen = outlen; - spin_unlock_bh(&ar->cmd_lock); - - err = __carl9170_exec_cmd(ar, &ar->cmd, false); - - if (!(cmd & CARL9170_CMD_ASYNC_FLAG)) { - err = wait_for_completion_timeout(&ar->cmd_wait, HZ); - if (err == 0) { - err = -ETIMEDOUT; - goto err_unbuf; - } - - if (ar->readlen != outlen) { - err = -EMSGSIZE; - goto err_unbuf; - } - } - - return 0; - -err_unbuf: - /* Maybe the device was removed in the moment we were waiting? */ - if (IS_STARTED(ar)) { - dev_err(&ar->udev->dev, "no command feedback " - "received (%d).\n", err); - - /* provide some maybe useful debug information */ - print_hex_dump_bytes("carl9170 cmd: ", DUMP_PREFIX_NONE, - &ar->cmd, plen + 4); - - carl9170_restart(ar, CARL9170_RR_COMMAND_TIMEOUT); - } - - /* invalidate to avoid completing the next command prematurely */ - spin_lock_bh(&ar->cmd_lock); - ar->readbuf = NULL; - ar->readlen = 0; - spin_unlock_bh(&ar->cmd_lock); - - return err; -} - -void carl9170_usb_tx(struct ar9170 *ar, struct sk_buff *skb) -{ - struct urb *urb; - struct ar9170_stream *tx_stream; - void *data; - unsigned int len; - - if (!IS_STARTED(ar)) - goto err_drop; - - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!urb) - goto err_drop; - - if (ar->fw.tx_stream) { - tx_stream = (void *) (skb->data - sizeof(*tx_stream)); - - len = skb->len + sizeof(*tx_stream); - tx_stream->length = cpu_to_le16(len); - tx_stream->tag = cpu_to_le16(AR9170_TX_STREAM_TAG); - data = tx_stream; - } else { - data = skb->data; - len = skb->len; - } - - usb_fill_bulk_urb(urb, ar->udev, usb_sndbulkpipe(ar->udev, - AR9170_USB_EP_TX), data, len, - carl9170_usb_tx_data_complete, skb); - - urb->transfer_flags |= URB_ZERO_PACKET; - - usb_anchor_urb(urb, &ar->tx_wait); - - usb_free_urb(urb); - - carl9170_usb_submit_data_urb(ar); - return; - -err_drop: - carl9170_tx_drop(ar, skb); - carl9170_tx_callback(ar, skb); -} - -static void carl9170_release_firmware(struct ar9170 *ar) -{ - if (ar->fw.fw) { - release_firmware(ar->fw.fw); - memset(&ar->fw, 0, sizeof(ar->fw)); - } -} - -void carl9170_usb_stop(struct ar9170 *ar) -{ - int ret; - - carl9170_set_state_when(ar, CARL9170_IDLE, CARL9170_STOPPED); - - ret = carl9170_usb_flush(ar); - if (ret) - dev_err(&ar->udev->dev, "kill pending tx urbs.\n"); - - usb_poison_anchored_urbs(&ar->tx_anch); - carl9170_usb_handle_tx_err(ar); - - /* kill any pending command */ - spin_lock_bh(&ar->cmd_lock); - ar->readlen = 0; - spin_unlock_bh(&ar->cmd_lock); - complete_all(&ar->cmd_wait); - - /* This is required to prevent an early completion on _start */ - INIT_COMPLETION(ar->cmd_wait); - - /* - * Note: - * So far we freed all tx urbs, but we won't dare to touch any rx urbs. - * Else we would end up with a unresponsive device... - */ -} - -int carl9170_usb_open(struct ar9170 *ar) -{ - usb_unpoison_anchored_urbs(&ar->tx_anch); - - carl9170_set_state_when(ar, CARL9170_STOPPED, CARL9170_IDLE); - return 0; -} - -static int carl9170_usb_load_firmware(struct ar9170 *ar) -{ - const u8 *data; - u8 *buf; - unsigned int transfer; - size_t len; - u32 addr; - int err = 0; - - buf = kmalloc(4096, GFP_KERNEL); - if (!buf) { - err = -ENOMEM; - goto err_out; - } - - data = ar->fw.fw->data; - len = ar->fw.fw->size; - addr = ar->fw.address; - - /* this removes the miniboot image */ - data += ar->fw.offset; - len -= ar->fw.offset; - - while (len) { - transfer = min_t(unsigned int, len, 4096u); - memcpy(buf, data, transfer); - - err = usb_control_msg(ar->udev, usb_sndctrlpipe(ar->udev, 0), - 0x30 /* FW DL */, 0x40 | USB_DIR_OUT, - addr >> 8, 0, buf, transfer, 100); - - if (err < 0) { - kfree(buf); - goto err_out; - } - - len -= transfer; - data += transfer; - addr += transfer; - } - kfree(buf); - - err = usb_control_msg(ar->udev, usb_sndctrlpipe(ar->udev, 0), - 0x31 /* FW DL COMPLETE */, - 0x40 | USB_DIR_OUT, 0, 0, NULL, 0, 200); - - if (wait_for_completion_timeout(&ar->fw_boot_wait, HZ) == 0) { - err = -ETIMEDOUT; - goto err_out; - } - - err = carl9170_echo_test(ar, 0x4a110123); - if (err) - goto err_out; - - /* now, start the command response counter */ - ar->cmd_seq = -1; - - return 0; - -err_out: - dev_err(&ar->udev->dev, "firmware upload failed (%d).\n", err); - return err; -} - -int carl9170_usb_restart(struct ar9170 *ar) -{ - int err = 0; - - if (ar->intf->condition != USB_INTERFACE_BOUND) - return 0; - - /* - * Disable the command response sequence counter check. - * We already know that the device/firmware is in a bad state. - * So, no extra points are awarded to anyone who reminds the - * driver about that. - */ - ar->cmd_seq = -2; - - err = carl9170_reboot(ar); - - carl9170_usb_stop(ar); - - if (err) - goto err_out; - - tasklet_schedule(&ar->usb_tasklet); - - /* The reboot procedure can take quite a while to complete. */ - msleep(1100); - - err = carl9170_usb_open(ar); - if (err) - goto err_out; - - err = carl9170_usb_load_firmware(ar); - if (err) - goto err_out; - - return 0; - -err_out: - carl9170_usb_cancel_urbs(ar); - return err; -} - -void carl9170_usb_reset(struct ar9170 *ar) -{ - /* - * This is the last resort to get the device going again - * without any *user replugging action*. - * - * But there is a catch: usb_reset really is like a physical - * *reconnect*. The mac80211 state will be lost in the process. - * Therefore a userspace application, which is monitoring - * the link must step in. - */ - carl9170_usb_cancel_urbs(ar); - - carl9170_usb_stop(ar); - - usb_queue_reset_device(ar->intf); -} - -static int carl9170_usb_init_device(struct ar9170 *ar) -{ - int err; - - /* - * The carl9170 firmware let's the driver know when it's - * ready for action. But we have to be prepared to gracefully - * handle all spurious [flushed] messages after each (re-)boot. - * Thus the command response counter remains disabled until it - * can be safely synchronized. - */ - ar->cmd_seq = -2; - - err = carl9170_usb_send_rx_irq_urb(ar); - if (err) - goto err_out; - - err = carl9170_usb_init_rx_bulk_urbs(ar); - if (err) - goto err_unrx; - - err = carl9170_usb_open(ar); - if (err) - goto err_unrx; - - mutex_lock(&ar->mutex); - err = carl9170_usb_load_firmware(ar); - mutex_unlock(&ar->mutex); - if (err) - goto err_stop; - - return 0; - -err_stop: - carl9170_usb_stop(ar); - -err_unrx: - carl9170_usb_cancel_urbs(ar); - -err_out: - return err; -} - -static void carl9170_usb_firmware_failed(struct ar9170 *ar) -{ - struct device *parent = ar->udev->dev.parent; - struct usb_device *udev; - - /* - * Store a copy of the usb_device pointer locally. - * This is because device_release_driver initiates - * carl9170_usb_disconnect, which in turn frees our - * driver context (ar). - */ - udev = ar->udev; - - complete(&ar->fw_load_wait); - - /* unbind anything failed */ - if (parent) - device_lock(parent); - - device_release_driver(&udev->dev); - if (parent) - device_unlock(parent); - - usb_put_dev(udev); -} - -static void carl9170_usb_firmware_finish(struct ar9170 *ar) -{ - int err; - - err = carl9170_parse_firmware(ar); - if (err) - goto err_freefw; - - err = carl9170_usb_init_device(ar); - if (err) - goto err_freefw; - - err = carl9170_register(ar); - - carl9170_usb_stop(ar); - if (err) - goto err_unrx; - - complete(&ar->fw_load_wait); - usb_put_dev(ar->udev); - return; - -err_unrx: - carl9170_usb_cancel_urbs(ar); - -err_freefw: - carl9170_release_firmware(ar); - carl9170_usb_firmware_failed(ar); -} - -static void carl9170_usb_firmware_step2(const struct firmware *fw, - void *context) -{ - struct ar9170 *ar = context; - - if (fw) { - ar->fw.fw = fw; - carl9170_usb_firmware_finish(ar); - return; - } - - dev_err(&ar->udev->dev, "firmware not found.\n"); - carl9170_usb_firmware_failed(ar); -} - -static int carl9170_usb_probe(struct usb_interface *intf, - const struct usb_device_id *id) -{ - struct ar9170 *ar; - struct usb_device *udev; - int err; - - err = usb_reset_device(interface_to_usbdev(intf)); - if (err) - return err; - - ar = carl9170_alloc(sizeof(*ar)); - if (IS_ERR(ar)) - return PTR_ERR(ar); - - udev = interface_to_usbdev(intf); - usb_get_dev(udev); - ar->udev = udev; - ar->intf = intf; - ar->features = id->driver_info; - - usb_set_intfdata(intf, ar); - SET_IEEE80211_DEV(ar->hw, &intf->dev); - - init_usb_anchor(&ar->rx_anch); - init_usb_anchor(&ar->rx_pool); - init_usb_anchor(&ar->rx_work); - init_usb_anchor(&ar->tx_wait); - init_usb_anchor(&ar->tx_anch); - init_usb_anchor(&ar->tx_cmd); - init_usb_anchor(&ar->tx_err); - init_completion(&ar->cmd_wait); - init_completion(&ar->fw_boot_wait); - init_completion(&ar->fw_load_wait); - tasklet_init(&ar->usb_tasklet, carl9170_usb_tasklet, - (unsigned long)ar); - - atomic_set(&ar->tx_cmd_urbs, 0); - atomic_set(&ar->tx_anch_urbs, 0); - atomic_set(&ar->rx_work_urbs, 0); - atomic_set(&ar->rx_anch_urbs, 0); - atomic_set(&ar->rx_pool_urbs, 0); - - usb_get_dev(ar->udev); - - carl9170_set_state(ar, CARL9170_STOPPED); - - return request_firmware_nowait(THIS_MODULE, 1, CARL9170FW_NAME, - &ar->udev->dev, GFP_KERNEL, ar, carl9170_usb_firmware_step2); -} - -static void carl9170_usb_disconnect(struct usb_interface *intf) -{ - struct ar9170 *ar = usb_get_intfdata(intf); - struct usb_device *udev; - - if (WARN_ON(!ar)) - return; - - udev = ar->udev; - wait_for_completion(&ar->fw_load_wait); - - if (IS_INITIALIZED(ar)) { - carl9170_reboot(ar); - carl9170_usb_stop(ar); - } - - carl9170_usb_cancel_urbs(ar); - carl9170_unregister(ar); - - usb_set_intfdata(intf, NULL); - - carl9170_release_firmware(ar); - carl9170_free(ar); - usb_put_dev(udev); -} - -#ifdef CONFIG_PM -static int carl9170_usb_suspend(struct usb_interface *intf, - pm_message_t message) -{ - struct ar9170 *ar = usb_get_intfdata(intf); - - if (!ar) - return -ENODEV; - - carl9170_usb_cancel_urbs(ar); - - return 0; -} - -static int carl9170_usb_resume(struct usb_interface *intf) -{ - struct ar9170 *ar = usb_get_intfdata(intf); - int err; - - if (!ar) - return -ENODEV; - - usb_unpoison_anchored_urbs(&ar->rx_anch); - carl9170_set_state(ar, CARL9170_STOPPED); - - /* - * The USB documentation demands that [for suspend] all traffic - * to and from the device has to stop. This would be fine, but - * there's a catch: the device[usb phy] does not come back. - * - * Upon resume the firmware will "kill" itself and the - * boot-code sorts out the magic voodoo. - * Not very nice, but there's not much what could go wrong. - */ - msleep(1100); - - err = carl9170_usb_init_device(ar); - if (err) - goto err_unrx; - - return 0; - -err_unrx: - carl9170_usb_cancel_urbs(ar); - - return err; -} -#endif /* CONFIG_PM */ - -static struct usb_driver carl9170_driver = { - .name = KBUILD_MODNAME, - .probe = carl9170_usb_probe, - .disconnect = carl9170_usb_disconnect, - .id_table = carl9170_usb_ids, - .soft_unbind = 1, -#ifdef CONFIG_PM - .suspend = carl9170_usb_suspend, - .resume = carl9170_usb_resume, - .reset_resume = carl9170_usb_resume, -#endif /* CONFIG_PM */ - .disable_hub_initiated_lpm = 1, -}; - -module_usb_driver(carl9170_driver); diff --git a/drivers/net/wireless/ath/carl9170/version.h b/drivers/net/wireless/ath/carl9170/version.h deleted file mode 100644 index 2282847d4bb8..000000000000 --- a/drivers/net/wireless/ath/carl9170/version.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __CARL9170_SHARED_VERSION_H -#define __CARL9170_SHARED_VERSION_H -#define CARL9170FW_VERSION_YEAR 12 -#define CARL9170FW_VERSION_MONTH 12 -#define CARL9170FW_VERSION_DAY 15 -#define CARL9170FW_VERSION_GIT "1.9.7" -#endif /* __CARL9170_SHARED_VERSION_H */ diff --git a/drivers/net/wireless/ath/carl9170/wlan.h b/drivers/net/wireless/ath/carl9170/wlan.h deleted file mode 100644 index ea17995b32f4..000000000000 --- a/drivers/net/wireless/ath/carl9170/wlan.h +++ /dev/null @@ -1,435 +0,0 @@ -/* - * Shared Atheros AR9170 Header - * - * RX/TX meta descriptor format - * - * Copyright 2008, Johannes Berg - * Copyright 2009-2011 Christian Lamparter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License. - * - * 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; see the file COPYING. If not, see - * http://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * Copyright (c) 2007-2008 Atheros Communications, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef __CARL9170_SHARED_WLAN_H -#define __CARL9170_SHARED_WLAN_H - -#include "fwcmd.h" - -#define AR9170_RX_PHY_RATE_CCK_1M 0x0a -#define AR9170_RX_PHY_RATE_CCK_2M 0x14 -#define AR9170_RX_PHY_RATE_CCK_5M 0x37 -#define AR9170_RX_PHY_RATE_CCK_11M 0x6e - -#define AR9170_ENC_ALG_NONE 0x0 -#define AR9170_ENC_ALG_WEP64 0x1 -#define AR9170_ENC_ALG_TKIP 0x2 -#define AR9170_ENC_ALG_AESCCMP 0x4 -#define AR9170_ENC_ALG_WEP128 0x5 -#define AR9170_ENC_ALG_WEP256 0x6 -#define AR9170_ENC_ALG_CENC 0x7 - -#define AR9170_RX_ENC_SOFTWARE 0x8 - -#define AR9170_RX_STATUS_MODULATION 0x03 -#define AR9170_RX_STATUS_MODULATION_S 0 -#define AR9170_RX_STATUS_MODULATION_CCK 0x00 -#define AR9170_RX_STATUS_MODULATION_OFDM 0x01 -#define AR9170_RX_STATUS_MODULATION_HT 0x02 -#define AR9170_RX_STATUS_MODULATION_DUPOFDM 0x03 - -/* depends on modulation */ -#define AR9170_RX_STATUS_SHORT_PREAMBLE 0x08 -#define AR9170_RX_STATUS_GREENFIELD 0x08 - -#define AR9170_RX_STATUS_MPDU 0x30 -#define AR9170_RX_STATUS_MPDU_S 4 -#define AR9170_RX_STATUS_MPDU_SINGLE 0x00 -#define AR9170_RX_STATUS_MPDU_FIRST 0x20 -#define AR9170_RX_STATUS_MPDU_MIDDLE 0x30 -#define AR9170_RX_STATUS_MPDU_LAST 0x10 - -#define AR9170_RX_STATUS_CONT_AGGR 0x40 -#define AR9170_RX_STATUS_TOTAL_ERROR 0x80 - -#define AR9170_RX_ERROR_RXTO 0x01 -#define AR9170_RX_ERROR_OVERRUN 0x02 -#define AR9170_RX_ERROR_DECRYPT 0x04 -#define AR9170_RX_ERROR_FCS 0x08 -#define AR9170_RX_ERROR_WRONG_RA 0x10 -#define AR9170_RX_ERROR_PLCP 0x20 -#define AR9170_RX_ERROR_MMIC 0x40 - -/* these are either-or */ -#define AR9170_TX_MAC_PROT_RTS 0x0001 -#define AR9170_TX_MAC_PROT_CTS 0x0002 -#define AR9170_TX_MAC_PROT 0x0003 - -#define AR9170_TX_MAC_NO_ACK 0x0004 -/* if unset, MAC will only do SIFS space before frame */ -#define AR9170_TX_MAC_BACKOFF 0x0008 -#define AR9170_TX_MAC_BURST 0x0010 -#define AR9170_TX_MAC_AGGR 0x0020 - -/* encryption is a two-bit field */ -#define AR9170_TX_MAC_ENCR_NONE 0x0000 -#define AR9170_TX_MAC_ENCR_RC4 0x0040 -#define AR9170_TX_MAC_ENCR_CENC 0x0080 -#define AR9170_TX_MAC_ENCR_AES 0x00c0 - -#define AR9170_TX_MAC_MMIC 0x0100 -#define AR9170_TX_MAC_HW_DURATION 0x0200 -#define AR9170_TX_MAC_QOS_S 10 -#define AR9170_TX_MAC_QOS 0x0c00 -#define AR9170_TX_MAC_DISABLE_TXOP 0x1000 -#define AR9170_TX_MAC_TXOP_RIFS 0x2000 -#define AR9170_TX_MAC_IMM_BA 0x4000 - -/* either-or */ -#define AR9170_TX_PHY_MOD_CCK 0x00000000 -#define AR9170_TX_PHY_MOD_OFDM 0x00000001 -#define AR9170_TX_PHY_MOD_HT 0x00000002 - -/* depends on modulation */ -#define AR9170_TX_PHY_SHORT_PREAMBLE 0x00000004 -#define AR9170_TX_PHY_GREENFIELD 0x00000004 - -#define AR9170_TX_PHY_BW_S 3 -#define AR9170_TX_PHY_BW (3 << AR9170_TX_PHY_BW_SHIFT) -#define AR9170_TX_PHY_BW_20MHZ 0 -#define AR9170_TX_PHY_BW_40MHZ 2 -#define AR9170_TX_PHY_BW_40MHZ_DUP 3 - -#define AR9170_TX_PHY_TX_HEAVY_CLIP_S 6 -#define AR9170_TX_PHY_TX_HEAVY_CLIP (7 << \ - AR9170_TX_PHY_TX_HEAVY_CLIP_S) - -#define AR9170_TX_PHY_TX_PWR_S 9 -#define AR9170_TX_PHY_TX_PWR (0x3f << \ - AR9170_TX_PHY_TX_PWR_S) - -#define AR9170_TX_PHY_TXCHAIN_S 15 -#define AR9170_TX_PHY_TXCHAIN (7 << \ - AR9170_TX_PHY_TXCHAIN_S) -#define AR9170_TX_PHY_TXCHAIN_1 1 -/* use for cck, ofdm 6/9/12/18/24 and HT if capable */ -#define AR9170_TX_PHY_TXCHAIN_2 5 - -#define AR9170_TX_PHY_MCS_S 18 -#define AR9170_TX_PHY_MCS (0x7f << \ - AR9170_TX_PHY_MCS_S) - -#define AR9170_TX_PHY_RATE_CCK_1M 0x0 -#define AR9170_TX_PHY_RATE_CCK_2M 0x1 -#define AR9170_TX_PHY_RATE_CCK_5M 0x2 -#define AR9170_TX_PHY_RATE_CCK_11M 0x3 - -/* same as AR9170_RX_PHY_RATE */ -#define AR9170_TXRX_PHY_RATE_OFDM_6M 0xb -#define AR9170_TXRX_PHY_RATE_OFDM_9M 0xf -#define AR9170_TXRX_PHY_RATE_OFDM_12M 0xa -#define AR9170_TXRX_PHY_RATE_OFDM_18M 0xe -#define AR9170_TXRX_PHY_RATE_OFDM_24M 0x9 -#define AR9170_TXRX_PHY_RATE_OFDM_36M 0xd -#define AR9170_TXRX_PHY_RATE_OFDM_48M 0x8 -#define AR9170_TXRX_PHY_RATE_OFDM_54M 0xc - -#define AR9170_TXRX_PHY_RATE_HT_MCS0 0x0 -#define AR9170_TXRX_PHY_RATE_HT_MCS1 0x1 -#define AR9170_TXRX_PHY_RATE_HT_MCS2 0x2 -#define AR9170_TXRX_PHY_RATE_HT_MCS3 0x3 -#define AR9170_TXRX_PHY_RATE_HT_MCS4 0x4 -#define AR9170_TXRX_PHY_RATE_HT_MCS5 0x5 -#define AR9170_TXRX_PHY_RATE_HT_MCS6 0x6 -#define AR9170_TXRX_PHY_RATE_HT_MCS7 0x7 -#define AR9170_TXRX_PHY_RATE_HT_MCS8 0x8 -#define AR9170_TXRX_PHY_RATE_HT_MCS9 0x9 -#define AR9170_TXRX_PHY_RATE_HT_MCS10 0xa -#define AR9170_TXRX_PHY_RATE_HT_MCS11 0xb -#define AR9170_TXRX_PHY_RATE_HT_MCS12 0xc -#define AR9170_TXRX_PHY_RATE_HT_MCS13 0xd -#define AR9170_TXRX_PHY_RATE_HT_MCS14 0xe -#define AR9170_TXRX_PHY_RATE_HT_MCS15 0xf - -#define AR9170_TX_PHY_SHORT_GI 0x80000000 - -#ifdef __CARL9170FW__ -struct ar9170_tx_hw_mac_control { - union { - struct { - /* - * Beware of compiler bugs in all gcc pre 4.4! - */ - - u8 erp_prot:2; - u8 no_ack:1; - u8 backoff:1; - u8 burst:1; - u8 ampdu:1; - - u8 enc_mode:2; - - u8 hw_mmic:1; - u8 hw_duration:1; - - u8 qos_queue:2; - - u8 disable_txop:1; - u8 txop_rifs:1; - - u8 ba_end:1; - u8 probe:1; - } __packed; - - __le16 set; - } __packed; -} __packed; - -struct ar9170_tx_hw_phy_control { - union { - struct { - /* - * Beware of compiler bugs in all gcc pre 4.4! - */ - - u8 modulation:2; - u8 preamble:1; - u8 bandwidth:2; - u8:1; - u8 heavy_clip:3; - u8 tx_power:6; - u8 chains:3; - u8 mcs:7; - u8:6; - u8 short_gi:1; - } __packed; - - __le32 set; - } __packed; -} __packed; - -struct ar9170_tx_rate_info { - u8 tries:3; - u8 erp_prot:2; - u8 ampdu:1; - u8 free:2; /* free for use (e.g.:RIFS/TXOP/AMPDU) */ -} __packed; - -struct carl9170_tx_superdesc { - __le16 len; - u8 rix; - u8 cnt; - u8 cookie; - u8 ampdu_density:3; - u8 ampdu_factor:2; - u8 ampdu_commit_density:1; - u8 ampdu_commit_factor:1; - u8 ampdu_unused_bit:1; - u8 queue:2; - u8 assign_seq:1; - u8 vif_id:3; - u8 fill_in_tsf:1; - u8 cab:1; - u8 padding2; - struct ar9170_tx_rate_info ri[CARL9170_TX_MAX_RATES]; - struct ar9170_tx_hw_phy_control rr[CARL9170_TX_MAX_RETRY_RATES]; -} __packed; - -struct ar9170_tx_hwdesc { - __le16 length; - struct ar9170_tx_hw_mac_control mac; - struct ar9170_tx_hw_phy_control phy; -} __packed; - -struct ar9170_tx_frame { - struct ar9170_tx_hwdesc hdr; - - union { - struct ieee80211_hdr i3e; - u8 payload[0]; - } data; -} __packed; - -struct carl9170_tx_superframe { - struct carl9170_tx_superdesc s; - struct ar9170_tx_frame f; -} __packed __aligned(4); - -#endif /* __CARL9170FW__ */ - -struct _ar9170_tx_hwdesc { - __le16 length; - __le16 mac_control; - __le32 phy_control; -} __packed; - -#define CARL9170_TX_SUPER_AMPDU_DENSITY_S 0 -#define CARL9170_TX_SUPER_AMPDU_DENSITY 0x7 -#define CARL9170_TX_SUPER_AMPDU_FACTOR 0x18 -#define CARL9170_TX_SUPER_AMPDU_FACTOR_S 3 -#define CARL9170_TX_SUPER_AMPDU_COMMIT_DENSITY 0x20 -#define CARL9170_TX_SUPER_AMPDU_COMMIT_DENSITY_S 5 -#define CARL9170_TX_SUPER_AMPDU_COMMIT_FACTOR 0x40 -#define CARL9170_TX_SUPER_AMPDU_COMMIT_FACTOR_S 6 - -#define CARL9170_TX_SUPER_MISC_QUEUE 0x3 -#define CARL9170_TX_SUPER_MISC_QUEUE_S 0 -#define CARL9170_TX_SUPER_MISC_ASSIGN_SEQ 0x4 -#define CARL9170_TX_SUPER_MISC_VIF_ID 0x38 -#define CARL9170_TX_SUPER_MISC_VIF_ID_S 3 -#define CARL9170_TX_SUPER_MISC_FILL_IN_TSF 0x40 -#define CARL9170_TX_SUPER_MISC_CAB 0x80 - -#define CARL9170_TX_SUPER_RI_TRIES 0x7 -#define CARL9170_TX_SUPER_RI_TRIES_S 0 -#define CARL9170_TX_SUPER_RI_ERP_PROT 0x18 -#define CARL9170_TX_SUPER_RI_ERP_PROT_S 3 -#define CARL9170_TX_SUPER_RI_AMPDU 0x20 -#define CARL9170_TX_SUPER_RI_AMPDU_S 5 - -struct _carl9170_tx_superdesc { - __le16 len; - u8 rix; - u8 cnt; - u8 cookie; - u8 ampdu_settings; - u8 misc; - u8 padding; - u8 ri[CARL9170_TX_MAX_RATES]; - __le32 rr[CARL9170_TX_MAX_RETRY_RATES]; -} __packed; - -struct _carl9170_tx_superframe { - struct _carl9170_tx_superdesc s; - struct _ar9170_tx_hwdesc f; - u8 frame_data[0]; -} __packed __aligned(4); - -#define CARL9170_TX_SUPERDESC_LEN 24 -#define AR9170_TX_HWDESC_LEN 8 -#define CARL9170_TX_SUPERFRAME_LEN (CARL9170_TX_SUPERDESC_LEN + \ - AR9170_TX_HWDESC_LEN) - -struct ar9170_rx_head { - u8 plcp[12]; -} __packed; - -#define AR9170_RX_HEAD_LEN 12 - -struct ar9170_rx_phystatus { - union { - struct { - u8 rssi_ant0, rssi_ant1, rssi_ant2, - rssi_ant0x, rssi_ant1x, rssi_ant2x, - rssi_combined; - } __packed; - u8 rssi[7]; - } __packed; - - u8 evm_stream0[6], evm_stream1[6]; - u8 phy_err; -} __packed; - -#define AR9170_RX_PHYSTATUS_LEN 20 - -struct ar9170_rx_macstatus { - u8 SAidx, DAidx; - u8 error; - u8 status; -} __packed; - -#define AR9170_RX_MACSTATUS_LEN 4 - -struct ar9170_rx_frame_single { - struct ar9170_rx_head phy_head; - struct ieee80211_hdr i3e; - struct ar9170_rx_phystatus phy_tail; - struct ar9170_rx_macstatus macstatus; -} __packed; - -struct ar9170_rx_frame_head { - struct ar9170_rx_head phy_head; - struct ieee80211_hdr i3e; - struct ar9170_rx_macstatus macstatus; -} __packed; - -struct ar9170_rx_frame_middle { - struct ieee80211_hdr i3e; - struct ar9170_rx_macstatus macstatus; -} __packed; - -struct ar9170_rx_frame_tail { - struct ieee80211_hdr i3e; - struct ar9170_rx_phystatus phy_tail; - struct ar9170_rx_macstatus macstatus; -} __packed; - -struct ar9170_rx_frame { - union { - struct ar9170_rx_frame_single single; - struct ar9170_rx_frame_head head; - struct ar9170_rx_frame_middle middle; - struct ar9170_rx_frame_tail tail; - } __packed; -} __packed; - -static inline u8 ar9170_get_decrypt_type(struct ar9170_rx_macstatus *t) -{ - return (t->SAidx & 0xc0) >> 4 | - (t->DAidx & 0xc0) >> 6; -} - -/* - * This is an workaround for several undocumented bugs. - * Don't mess with the QoS/AC <-> HW Queue map, if you don't - * know what you are doing. - * - * Known problems [hardware]: - * * The MAC does not aggregate frames on anything other - * than the first HW queue. - * * when an AMPDU is placed [in the first hw queue] and - * additional frames are already queued on a different - * hw queue, the MAC will ALWAYS freeze. - * - * In a nutshell: The hardware can either do QoS or - * Aggregation but not both at the same time. As a - * result, this makes the device pretty much useless - * for any serious 802.11n setup. - */ -enum ar9170_txq { - AR9170_TXQ_BK = 0, /* TXQ0 */ - AR9170_TXQ_BE, /* TXQ1 */ - AR9170_TXQ_VI, /* TXQ2 */ - AR9170_TXQ_VO, /* TXQ3 */ - - __AR9170_NUM_TXQ, -}; - -#define AR9170_TXQ_DEPTH 32 - -#endif /* __CARL9170_SHARED_WLAN_H */ diff --git a/drivers/net/wireless/ath/debug.c b/drivers/net/wireless/ath/debug.c deleted file mode 100644 index 508eccf5d982..000000000000 --- a/drivers/net/wireless/ath/debug.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2009 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "ath.h" - -const char *ath_opmode_to_string(enum nl80211_iftype opmode) -{ - switch (opmode) { - case NL80211_IFTYPE_UNSPECIFIED: - return "UNSPEC"; - case NL80211_IFTYPE_ADHOC: - return "ADHOC"; - case NL80211_IFTYPE_STATION: - return "STATION"; - case NL80211_IFTYPE_AP: - return "AP"; - case NL80211_IFTYPE_AP_VLAN: - return "AP-VLAN"; - case NL80211_IFTYPE_WDS: - return "WDS"; - case NL80211_IFTYPE_MONITOR: - return "MONITOR"; - case NL80211_IFTYPE_MESH_POINT: - return "MESH"; - case NL80211_IFTYPE_P2P_CLIENT: - return "P2P-CLIENT"; - case NL80211_IFTYPE_P2P_GO: - return "P2P-GO"; - default: - return "UNKNOWN"; - } -} -EXPORT_SYMBOL(ath_opmode_to_string); diff --git a/drivers/net/wireless/ath/hw.c b/drivers/net/wireless/ath/hw.c deleted file mode 100644 index eae9abf540a7..000000000000 --- a/drivers/net/wireless/ath/hw.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2009 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -#include "ath.h" -#include "reg.h" - -#define REG_READ (common->ops->read) -#define REG_WRITE(_ah, _reg, _val) (common->ops->write)(_ah, _val, _reg) - -/** - * ath_hw_set_bssid_mask - filter out bssids we listen - * - * @common: the ath_common struct for the device. - * - * BSSID masking is a method used by AR5212 and newer hardware to inform PCU - * which bits of the interface's MAC address should be looked at when trying - * to decide which packets to ACK. In station mode and AP mode with a single - * BSS every bit matters since we lock to only one BSS. In AP mode with - * multiple BSSes (virtual interfaces) not every bit matters because hw must - * accept frames for all BSSes and so we tweak some bits of our mac address - * in order to have multiple BSSes. - * - * NOTE: This is a simple filter and does *not* filter out all - * relevant frames. Some frames that are not for us might get ACKed from us - * by PCU because they just match the mask. - * - * When handling multiple BSSes you can get the BSSID mask by computing the - * set of ~ ( MAC XOR BSSID ) for all bssids we handle. - * - * When you do this you are essentially computing the common bits of all your - * BSSes. Later it is assumed the hardware will "and" (&) the BSSID mask with - * the MAC address to obtain the relevant bits and compare the result with - * (frame's BSSID & mask) to see if they match. - * - * Simple example: on your card you have have two BSSes you have created with - * BSSID-01 and BSSID-02. Lets assume BSSID-01 will not use the MAC address. - * There is another BSSID-03 but you are not part of it. For simplicity's sake, - * assuming only 4 bits for a mac address and for BSSIDs you can then have: - * - * \ - * MAC: 0001 | - * BSSID-01: 0100 | --> Belongs to us - * BSSID-02: 1001 | - * / - * ------------------- - * BSSID-03: 0110 | --> External - * ------------------- - * - * Our bssid_mask would then be: - * - * On loop iteration for BSSID-01: - * ~(0001 ^ 0100) -> ~(0101) - * -> 1010 - * bssid_mask = 1010 - * - * On loop iteration for BSSID-02: - * bssid_mask &= ~(0001 ^ 1001) - * bssid_mask = (1010) & ~(0001 ^ 1001) - * bssid_mask = (1010) & ~(1000) - * bssid_mask = (1010) & (0111) - * bssid_mask = 0010 - * - * A bssid_mask of 0010 means "only pay attention to the second least - * significant bit". This is because its the only bit common - * amongst the MAC and all BSSIDs we support. To findout what the real - * common bit is we can simply "&" the bssid_mask now with any BSSID we have - * or our MAC address (we assume the hardware uses the MAC address). - * - * Now, suppose there's an incoming frame for BSSID-03: - * - * IFRAME-01: 0110 - * - * An easy eye-inspeciton of this already should tell you that this frame - * will not pass our check. This is because the bssid_mask tells the - * hardware to only look at the second least significant bit and the - * common bit amongst the MAC and BSSIDs is 0, this frame has the 2nd LSB - * as 1, which does not match 0. - * - * So with IFRAME-01 we *assume* the hardware will do: - * - * allow = (IFRAME-01 & bssid_mask) == (bssid_mask & MAC) ? 1 : 0; - * --> allow = (0110 & 0010) == (0010 & 0001) ? 1 : 0; - * --> allow = (0010) == 0000 ? 1 : 0; - * --> allow = 0 - * - * Lets now test a frame that should work: - * - * IFRAME-02: 0001 (we should allow) - * - * allow = (IFRAME-02 & bssid_mask) == (bssid_mask & MAC) ? 1 : 0; - * --> allow = (0001 & 0010) == (0010 & 0001) ? 1 :0; - * --> allow = (0000) == (0000) - * --> allow = 1 - * - * Other examples: - * - * IFRAME-03: 0100 --> allowed - * IFRAME-04: 1001 --> allowed - * IFRAME-05: 1101 --> allowed but its not for us!!! - * - */ -void ath_hw_setbssidmask(struct ath_common *common) -{ - void *ah = common->ah; - u32 id1; - - REG_WRITE(ah, AR_STA_ID0, get_unaligned_le32(common->macaddr)); - id1 = REG_READ(ah, AR_STA_ID1) & ~AR_STA_ID1_SADH_MASK; - id1 |= get_unaligned_le16(common->macaddr + 4); - REG_WRITE(ah, AR_STA_ID1, id1); - - REG_WRITE(ah, AR_BSSMSKL, get_unaligned_le32(common->bssidmask)); - REG_WRITE(ah, AR_BSSMSKU, get_unaligned_le16(common->bssidmask + 4)); -} -EXPORT_SYMBOL(ath_hw_setbssidmask); - - -/** - * ath_hw_cycle_counters_update - common function to update cycle counters - * - * @common: the ath_common struct for the device. - * - * This function is used to update all cycle counters in one place. - * It has to be called while holding common->cc_lock! - */ -void ath_hw_cycle_counters_update(struct ath_common *common) -{ - u32 cycles, busy, rx, tx; - void *ah = common->ah; - - /* freeze */ - REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC); - - /* read */ - cycles = REG_READ(ah, AR_CCCNT); - busy = REG_READ(ah, AR_RCCNT); - rx = REG_READ(ah, AR_RFCNT); - tx = REG_READ(ah, AR_TFCNT); - - /* clear */ - REG_WRITE(ah, AR_CCCNT, 0); - REG_WRITE(ah, AR_RFCNT, 0); - REG_WRITE(ah, AR_RCCNT, 0); - REG_WRITE(ah, AR_TFCNT, 0); - - /* unfreeze */ - REG_WRITE(ah, AR_MIBC, 0); - - /* update all cycle counters here */ - common->cc_ani.cycles += cycles; - common->cc_ani.rx_busy += busy; - common->cc_ani.rx_frame += rx; - common->cc_ani.tx_frame += tx; - - common->cc_survey.cycles += cycles; - common->cc_survey.rx_busy += busy; - common->cc_survey.rx_frame += rx; - common->cc_survey.tx_frame += tx; -} -EXPORT_SYMBOL(ath_hw_cycle_counters_update); - -int32_t ath_hw_get_listen_time(struct ath_common *common) -{ - struct ath_cycle_counters *cc = &common->cc_ani; - int32_t listen_time; - - listen_time = (cc->cycles - cc->rx_frame - cc->tx_frame) / - (common->clockrate * 1000); - - memset(cc, 0, sizeof(*cc)); - - return listen_time; -} -EXPORT_SYMBOL(ath_hw_get_listen_time); diff --git a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c deleted file mode 100644 index 1816b4e7dc26..000000000000 --- a/drivers/net/wireless/ath/key.c +++ /dev/null @@ -1,609 +0,0 @@ -/* - * Copyright (c) 2009 Atheros Communications Inc. - * Copyright (c) 2010 Bruno Randolf - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include - -#include "ath.h" -#include "reg.h" - -#define REG_READ (common->ops->read) -#define REG_WRITE(_ah, _reg, _val) (common->ops->write)(_ah, _val, _reg) -#define ENABLE_REGWRITE_BUFFER(_ah) \ - if (common->ops->enable_write_buffer) \ - common->ops->enable_write_buffer((_ah)); - -#define REGWRITE_BUFFER_FLUSH(_ah) \ - if (common->ops->write_flush) \ - common->ops->write_flush((_ah)); - - -#define IEEE80211_WEP_NKID 4 /* number of key ids */ - -/************************/ -/* Key Cache Management */ -/************************/ - -bool ath_hw_keyreset(struct ath_common *common, u16 entry) -{ - u32 keyType; - void *ah = common->ah; - - if (entry >= common->keymax) { - ath_err(common, "keyreset: keycache entry %u out of range\n", - entry); - return false; - } - - keyType = REG_READ(ah, AR_KEYTABLE_TYPE(entry)); - - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_KEYTABLE_KEY0(entry), 0); - REG_WRITE(ah, AR_KEYTABLE_KEY1(entry), 0); - REG_WRITE(ah, AR_KEYTABLE_KEY2(entry), 0); - REG_WRITE(ah, AR_KEYTABLE_KEY3(entry), 0); - REG_WRITE(ah, AR_KEYTABLE_KEY4(entry), 0); - REG_WRITE(ah, AR_KEYTABLE_TYPE(entry), AR_KEYTABLE_TYPE_CLR); - REG_WRITE(ah, AR_KEYTABLE_MAC0(entry), 0); - REG_WRITE(ah, AR_KEYTABLE_MAC1(entry), 0); - - if (keyType == AR_KEYTABLE_TYPE_TKIP) { - u16 micentry = entry + 64; - - REG_WRITE(ah, AR_KEYTABLE_KEY0(micentry), 0); - REG_WRITE(ah, AR_KEYTABLE_KEY1(micentry), 0); - REG_WRITE(ah, AR_KEYTABLE_KEY2(micentry), 0); - REG_WRITE(ah, AR_KEYTABLE_KEY3(micentry), 0); - if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) { - REG_WRITE(ah, AR_KEYTABLE_KEY4(micentry), 0); - REG_WRITE(ah, AR_KEYTABLE_TYPE(micentry), - AR_KEYTABLE_TYPE_CLR); - } - - } - - REGWRITE_BUFFER_FLUSH(ah); - - return true; -} -EXPORT_SYMBOL(ath_hw_keyreset); - -static bool ath_hw_keysetmac(struct ath_common *common, - u16 entry, const u8 *mac) -{ - u32 macHi, macLo; - u32 unicast_flag = AR_KEYTABLE_VALID; - void *ah = common->ah; - - if (entry >= common->keymax) { - ath_err(common, "keysetmac: keycache entry %u out of range\n", - entry); - return false; - } - - if (mac != NULL) { - /* - * AR_KEYTABLE_VALID indicates that the address is a unicast - * address, which must match the transmitter address for - * decrypting frames. - * Not setting this bit allows the hardware to use the key - * for multicast frame decryption. - */ - if (mac[0] & 0x01) - unicast_flag = 0; - - macLo = get_unaligned_le32(mac); - macHi = get_unaligned_le16(mac + 4); - macLo >>= 1; - macLo |= (macHi & 1) << 31; - macHi >>= 1; - } else { - macLo = macHi = 0; - } - ENABLE_REGWRITE_BUFFER(ah); - - REG_WRITE(ah, AR_KEYTABLE_MAC0(entry), macLo); - REG_WRITE(ah, AR_KEYTABLE_MAC1(entry), macHi | unicast_flag); - - REGWRITE_BUFFER_FLUSH(ah); - - return true; -} - -static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry, - const struct ath_keyval *k, - const u8 *mac) -{ - void *ah = common->ah; - u32 key0, key1, key2, key3, key4; - u32 keyType; - - if (entry >= common->keymax) { - ath_err(common, "set-entry: keycache entry %u out of range\n", - entry); - return false; - } - - switch (k->kv_type) { - case ATH_CIPHER_AES_OCB: - keyType = AR_KEYTABLE_TYPE_AES; - break; - case ATH_CIPHER_AES_CCM: - if (!(common->crypt_caps & ATH_CRYPT_CAP_CIPHER_AESCCM)) { - ath_dbg(common, ANY, - "AES-CCM not supported by this mac rev\n"); - return false; - } - keyType = AR_KEYTABLE_TYPE_CCM; - break; - case ATH_CIPHER_TKIP: - keyType = AR_KEYTABLE_TYPE_TKIP; - if (entry + 64 >= common->keymax) { - ath_dbg(common, ANY, - "entry %u inappropriate for TKIP\n", entry); - return false; - } - break; - case ATH_CIPHER_WEP: - if (k->kv_len < WLAN_KEY_LEN_WEP40) { - ath_dbg(common, ANY, "WEP key length %u too small\n", - k->kv_len); - return false; - } - if (k->kv_len <= WLAN_KEY_LEN_WEP40) - keyType = AR_KEYTABLE_TYPE_40; - else if (k->kv_len <= WLAN_KEY_LEN_WEP104) - keyType = AR_KEYTABLE_TYPE_104; - else - keyType = AR_KEYTABLE_TYPE_128; - break; - case ATH_CIPHER_CLR: - keyType = AR_KEYTABLE_TYPE_CLR; - break; - default: - ath_err(common, "cipher %u not supported\n", k->kv_type); - return false; - } - - key0 = get_unaligned_le32(k->kv_val + 0); - key1 = get_unaligned_le16(k->kv_val + 4); - key2 = get_unaligned_le32(k->kv_val + 6); - key3 = get_unaligned_le16(k->kv_val + 10); - key4 = get_unaligned_le32(k->kv_val + 12); - if (k->kv_len <= WLAN_KEY_LEN_WEP104) - key4 &= 0xff; - - /* - * Note: Key cache registers access special memory area that requires - * two 32-bit writes to actually update the values in the internal - * memory. Consequently, the exact order and pairs used here must be - * maintained. - */ - - if (keyType == AR_KEYTABLE_TYPE_TKIP) { - u16 micentry = entry + 64; - - /* - * Write inverted key[47:0] first to avoid Michael MIC errors - * on frames that could be sent or received at the same time. - * The correct key will be written in the end once everything - * else is ready. - */ - REG_WRITE(ah, AR_KEYTABLE_KEY0(entry), ~key0); - REG_WRITE(ah, AR_KEYTABLE_KEY1(entry), ~key1); - - /* Write key[95:48] */ - REG_WRITE(ah, AR_KEYTABLE_KEY2(entry), key2); - REG_WRITE(ah, AR_KEYTABLE_KEY3(entry), key3); - - /* Write key[127:96] and key type */ - REG_WRITE(ah, AR_KEYTABLE_KEY4(entry), key4); - REG_WRITE(ah, AR_KEYTABLE_TYPE(entry), keyType); - - /* Write MAC address for the entry */ - (void) ath_hw_keysetmac(common, entry, mac); - - if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) { - /* - * TKIP uses two key cache entries: - * Michael MIC TX/RX keys in the same key cache entry - * (idx = main index + 64): - * key0 [31:0] = RX key [31:0] - * key1 [15:0] = TX key [31:16] - * key1 [31:16] = reserved - * key2 [31:0] = RX key [63:32] - * key3 [15:0] = TX key [15:0] - * key3 [31:16] = reserved - * key4 [31:0] = TX key [63:32] - */ - u32 mic0, mic1, mic2, mic3, mic4; - - mic0 = get_unaligned_le32(k->kv_mic + 0); - mic2 = get_unaligned_le32(k->kv_mic + 4); - mic1 = get_unaligned_le16(k->kv_txmic + 2) & 0xffff; - mic3 = get_unaligned_le16(k->kv_txmic + 0) & 0xffff; - mic4 = get_unaligned_le32(k->kv_txmic + 4); - - ENABLE_REGWRITE_BUFFER(ah); - - /* Write RX[31:0] and TX[31:16] */ - REG_WRITE(ah, AR_KEYTABLE_KEY0(micentry), mic0); - REG_WRITE(ah, AR_KEYTABLE_KEY1(micentry), mic1); - - /* Write RX[63:32] and TX[15:0] */ - REG_WRITE(ah, AR_KEYTABLE_KEY2(micentry), mic2); - REG_WRITE(ah, AR_KEYTABLE_KEY3(micentry), mic3); - - /* Write TX[63:32] and keyType(reserved) */ - REG_WRITE(ah, AR_KEYTABLE_KEY4(micentry), mic4); - REG_WRITE(ah, AR_KEYTABLE_TYPE(micentry), - AR_KEYTABLE_TYPE_CLR); - - REGWRITE_BUFFER_FLUSH(ah); - - } else { - /* - * TKIP uses four key cache entries (two for group - * keys): - * Michael MIC TX/RX keys are in different key cache - * entries (idx = main index + 64 for TX and - * main index + 32 + 96 for RX): - * key0 [31:0] = TX/RX MIC key [31:0] - * key1 [31:0] = reserved - * key2 [31:0] = TX/RX MIC key [63:32] - * key3 [31:0] = reserved - * key4 [31:0] = reserved - * - * Upper layer code will call this function separately - * for TX and RX keys when these registers offsets are - * used. - */ - u32 mic0, mic2; - - mic0 = get_unaligned_le32(k->kv_mic + 0); - mic2 = get_unaligned_le32(k->kv_mic + 4); - - ENABLE_REGWRITE_BUFFER(ah); - - /* Write MIC key[31:0] */ - REG_WRITE(ah, AR_KEYTABLE_KEY0(micentry), mic0); - REG_WRITE(ah, AR_KEYTABLE_KEY1(micentry), 0); - - /* Write MIC key[63:32] */ - REG_WRITE(ah, AR_KEYTABLE_KEY2(micentry), mic2); - REG_WRITE(ah, AR_KEYTABLE_KEY3(micentry), 0); - - /* Write TX[63:32] and keyType(reserved) */ - REG_WRITE(ah, AR_KEYTABLE_KEY4(micentry), 0); - REG_WRITE(ah, AR_KEYTABLE_TYPE(micentry), - AR_KEYTABLE_TYPE_CLR); - - REGWRITE_BUFFER_FLUSH(ah); - } - - ENABLE_REGWRITE_BUFFER(ah); - - /* MAC address registers are reserved for the MIC entry */ - REG_WRITE(ah, AR_KEYTABLE_MAC0(micentry), 0); - REG_WRITE(ah, AR_KEYTABLE_MAC1(micentry), 0); - - /* - * Write the correct (un-inverted) key[47:0] last to enable - * TKIP now that all other registers are set with correct - * values. - */ - REG_WRITE(ah, AR_KEYTABLE_KEY0(entry), key0); - REG_WRITE(ah, AR_KEYTABLE_KEY1(entry), key1); - - REGWRITE_BUFFER_FLUSH(ah); - } else { - ENABLE_REGWRITE_BUFFER(ah); - - /* Write key[47:0] */ - REG_WRITE(ah, AR_KEYTABLE_KEY0(entry), key0); - REG_WRITE(ah, AR_KEYTABLE_KEY1(entry), key1); - - /* Write key[95:48] */ - REG_WRITE(ah, AR_KEYTABLE_KEY2(entry), key2); - REG_WRITE(ah, AR_KEYTABLE_KEY3(entry), key3); - - /* Write key[127:96] and key type */ - REG_WRITE(ah, AR_KEYTABLE_KEY4(entry), key4); - REG_WRITE(ah, AR_KEYTABLE_TYPE(entry), keyType); - - REGWRITE_BUFFER_FLUSH(ah); - - /* Write MAC address for the entry */ - (void) ath_hw_keysetmac(common, entry, mac); - } - - return true; -} - -static int ath_setkey_tkip(struct ath_common *common, u16 keyix, const u8 *key, - struct ath_keyval *hk, const u8 *addr, - bool authenticator) -{ - const u8 *key_rxmic; - const u8 *key_txmic; - - key_txmic = key + NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY; - key_rxmic = key + NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY; - - if (addr == NULL) { - /* - * Group key installation - only two key cache entries are used - * regardless of splitmic capability since group key is only - * used either for TX or RX. - */ - if (authenticator) { - memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic)); - memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_mic)); - } else { - memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); - memcpy(hk->kv_txmic, key_rxmic, sizeof(hk->kv_mic)); - } - return ath_hw_set_keycache_entry(common, keyix, hk, addr); - } - if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) { - /* TX and RX keys share the same key cache entry. */ - memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); - memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_txmic)); - return ath_hw_set_keycache_entry(common, keyix, hk, addr); - } - - /* Separate key cache entries for TX and RX */ - - /* TX key goes at first index, RX key at +32. */ - memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic)); - if (!ath_hw_set_keycache_entry(common, keyix, hk, NULL)) { - /* TX MIC entry failed. No need to proceed further */ - ath_err(common, "Setting TX MIC Key Failed\n"); - return 0; - } - - memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); - /* XXX delete tx key on failure? */ - return ath_hw_set_keycache_entry(common, keyix + 32, hk, addr); -} - -static int ath_reserve_key_cache_slot_tkip(struct ath_common *common) -{ - int i; - - for (i = IEEE80211_WEP_NKID; i < common->keymax / 2; i++) { - if (test_bit(i, common->keymap) || - test_bit(i + 64, common->keymap)) - continue; /* At least one part of TKIP key allocated */ - if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) && - (test_bit(i + 32, common->keymap) || - test_bit(i + 64 + 32, common->keymap))) - continue; /* At least one part of TKIP key allocated */ - - /* Found a free slot for a TKIP key */ - return i; - } - return -1; -} - -static int ath_reserve_key_cache_slot(struct ath_common *common, - u32 cipher) -{ - int i; - - if (cipher == WLAN_CIPHER_SUITE_TKIP) - return ath_reserve_key_cache_slot_tkip(common); - - /* First, try to find slots that would not be available for TKIP. */ - if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { - for (i = IEEE80211_WEP_NKID; i < common->keymax / 4; i++) { - if (!test_bit(i, common->keymap) && - (test_bit(i + 32, common->keymap) || - test_bit(i + 64, common->keymap) || - test_bit(i + 64 + 32, common->keymap))) - return i; - if (!test_bit(i + 32, common->keymap) && - (test_bit(i, common->keymap) || - test_bit(i + 64, common->keymap) || - test_bit(i + 64 + 32, common->keymap))) - return i + 32; - if (!test_bit(i + 64, common->keymap) && - (test_bit(i , common->keymap) || - test_bit(i + 32, common->keymap) || - test_bit(i + 64 + 32, common->keymap))) - return i + 64; - if (!test_bit(i + 64 + 32, common->keymap) && - (test_bit(i, common->keymap) || - test_bit(i + 32, common->keymap) || - test_bit(i + 64, common->keymap))) - return i + 64 + 32; - } - } else { - for (i = IEEE80211_WEP_NKID; i < common->keymax / 2; i++) { - if (!test_bit(i, common->keymap) && - test_bit(i + 64, common->keymap)) - return i; - if (test_bit(i, common->keymap) && - !test_bit(i + 64, common->keymap)) - return i + 64; - } - } - - /* No partially used TKIP slots, pick any available slot */ - for (i = IEEE80211_WEP_NKID; i < common->keymax; i++) { - /* Do not allow slots that could be needed for TKIP group keys - * to be used. This limitation could be removed if we know that - * TKIP will not be used. */ - if (i >= 64 && i < 64 + IEEE80211_WEP_NKID) - continue; - if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { - if (i >= 32 && i < 32 + IEEE80211_WEP_NKID) - continue; - if (i >= 64 + 32 && i < 64 + 32 + IEEE80211_WEP_NKID) - continue; - } - - if (!test_bit(i, common->keymap)) - return i; /* Found a free slot for a key */ - } - - /* No free slot found */ - return -1; -} - -/* - * Configure encryption in the HW. - */ -int ath_key_config(struct ath_common *common, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct ath_keyval hk; - const u8 *mac = NULL; - u8 gmac[ETH_ALEN]; - int ret = 0; - int idx; - - memset(&hk, 0, sizeof(hk)); - - switch (key->cipher) { - case 0: - hk.kv_type = ATH_CIPHER_CLR; - break; - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - hk.kv_type = ATH_CIPHER_WEP; - break; - case WLAN_CIPHER_SUITE_TKIP: - hk.kv_type = ATH_CIPHER_TKIP; - break; - case WLAN_CIPHER_SUITE_CCMP: - hk.kv_type = ATH_CIPHER_AES_CCM; - break; - default: - return -EOPNOTSUPP; - } - - hk.kv_len = key->keylen; - if (key->keylen) - memcpy(hk.kv_val, key->key, key->keylen); - - if (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { - switch (vif->type) { - case NL80211_IFTYPE_AP: - memcpy(gmac, vif->addr, ETH_ALEN); - gmac[0] |= 0x01; - mac = gmac; - idx = ath_reserve_key_cache_slot(common, key->cipher); - break; - case NL80211_IFTYPE_ADHOC: - if (!sta) { - idx = key->keyidx; - break; - } - memcpy(gmac, sta->addr, ETH_ALEN); - gmac[0] |= 0x01; - mac = gmac; - idx = ath_reserve_key_cache_slot(common, key->cipher); - break; - default: - idx = key->keyidx; - break; - } - } else if (key->keyidx) { - if (WARN_ON(!sta)) - return -EOPNOTSUPP; - mac = sta->addr; - - if (vif->type != NL80211_IFTYPE_AP) { - /* Only keyidx 0 should be used with unicast key, but - * allow this for client mode for now. */ - idx = key->keyidx; - } else - return -EIO; - } else { - if (WARN_ON(!sta)) - return -EOPNOTSUPP; - mac = sta->addr; - - idx = ath_reserve_key_cache_slot(common, key->cipher); - } - - if (idx < 0) - return -ENOSPC; /* no free key cache entries */ - - if (key->cipher == WLAN_CIPHER_SUITE_TKIP) - ret = ath_setkey_tkip(common, idx, key->key, &hk, mac, - vif->type == NL80211_IFTYPE_AP); - else - ret = ath_hw_set_keycache_entry(common, idx, &hk, mac); - - if (!ret) - return -EIO; - - set_bit(idx, common->keymap); - if (key->cipher == WLAN_CIPHER_SUITE_CCMP) - set_bit(idx, common->ccmp_keymap); - - if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { - set_bit(idx + 64, common->keymap); - set_bit(idx, common->tkip_keymap); - set_bit(idx + 64, common->tkip_keymap); - if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { - set_bit(idx + 32, common->keymap); - set_bit(idx + 64 + 32, common->keymap); - set_bit(idx + 32, common->tkip_keymap); - set_bit(idx + 64 + 32, common->tkip_keymap); - } - } - - return idx; -} -EXPORT_SYMBOL(ath_key_config); - -/* - * Delete Key. - */ -void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf *key) -{ - ath_hw_keyreset(common, key->hw_key_idx); - if (key->hw_key_idx < IEEE80211_WEP_NKID) - return; - - clear_bit(key->hw_key_idx, common->keymap); - clear_bit(key->hw_key_idx, common->ccmp_keymap); - if (key->cipher != WLAN_CIPHER_SUITE_TKIP) - return; - - clear_bit(key->hw_key_idx + 64, common->keymap); - - clear_bit(key->hw_key_idx, common->tkip_keymap); - clear_bit(key->hw_key_idx + 64, common->tkip_keymap); - - if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { - ath_hw_keyreset(common, key->hw_key_idx + 32); - clear_bit(key->hw_key_idx + 32, common->keymap); - clear_bit(key->hw_key_idx + 64 + 32, common->keymap); - - clear_bit(key->hw_key_idx + 32, common->tkip_keymap); - clear_bit(key->hw_key_idx + 64 + 32, common->tkip_keymap); - } -} -EXPORT_SYMBOL(ath_key_delete); diff --git a/drivers/net/wireless/ath/main.c b/drivers/net/wireless/ath/main.c deleted file mode 100644 index 8e99540cd90e..000000000000 --- a/drivers/net/wireless/ath/main.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2009 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include - -#include "ath.h" - -MODULE_AUTHOR("Atheros Communications"); -MODULE_DESCRIPTION("Shared library for Atheros wireless LAN cards."); -MODULE_LICENSE("Dual BSD/GPL"); - -struct sk_buff *ath_rxbuf_alloc(struct ath_common *common, - u32 len, - gfp_t gfp_mask) -{ - struct sk_buff *skb; - u32 off; - - /* - * Cache-line-align. This is important (for the - * 5210 at least) as not doing so causes bogus data - * in rx'd frames. - */ - - /* Note: the kernel can allocate a value greater than - * what we ask it to give us. We really only need 4 KB as that - * is this hardware supports and in fact we need at least 3849 - * as that is the MAX AMSDU size this hardware supports. - * Unfortunately this means we may get 8 KB here from the - * kernel... and that is actually what is observed on some - * systems :( */ - skb = __dev_alloc_skb(len + common->cachelsz - 1, gfp_mask); - if (skb != NULL) { - off = ((unsigned long) skb->data) % common->cachelsz; - if (off != 0) - skb_reserve(skb, common->cachelsz - off); - } else { - pr_err("skbuff alloc of size %u failed\n", len); - return NULL; - } - - return skb; -} -EXPORT_SYMBOL(ath_rxbuf_alloc); - -void ath_printk(const char *level, const struct ath_common* common, - const char *fmt, ...) -{ - struct va_format vaf; - va_list args; - - va_start(args, fmt); - - vaf.fmt = fmt; - vaf.va = &args; - - if (common && common->hw && common->hw->wiphy) - printk("%sath: %s: %pV", - level, wiphy_name(common->hw->wiphy), &vaf); - else - printk("%sath: %pV", level, &vaf); - - va_end(args); -} -EXPORT_SYMBOL(ath_printk); diff --git a/drivers/net/wireless/ath/reg.h b/drivers/net/wireless/ath/reg.h deleted file mode 100644 index 3ad4c774bd22..000000000000 --- a/drivers/net/wireless/ath/reg.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2008-2009 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef ATH_REGISTERS_H -#define ATH_REGISTERS_H - -#define AR_MIBC 0x0040 -#define AR_MIBC_COW 0x00000001 -#define AR_MIBC_FMC 0x00000002 -#define AR_MIBC_CMC 0x00000004 -#define AR_MIBC_MCS 0x00000008 - -#define AR_STA_ID0 0x8000 -#define AR_STA_ID1 0x8004 -#define AR_STA_ID1_SADH_MASK 0x0000ffff - -/* - * BSSID mask registers. See ath_hw_set_bssid_mask() - * for detailed documentation about these registers. - */ -#define AR_BSSMSKL 0x80e0 -#define AR_BSSMSKU 0x80e4 - -#define AR_TFCNT 0x80ec -#define AR_RFCNT 0x80f0 -#define AR_RCCNT 0x80f4 -#define AR_CCCNT 0x80f8 - -#define AR_KEYTABLE_0 0x8800 -#define AR_KEYTABLE(_n) (AR_KEYTABLE_0 + ((_n)*32)) -#define AR_KEY_CACHE_SIZE 128 -#define AR_RSVD_KEYTABLE_ENTRIES 4 -#define AR_KEY_TYPE 0x00000007 -#define AR_KEYTABLE_TYPE_40 0x00000000 -#define AR_KEYTABLE_TYPE_104 0x00000001 -#define AR_KEYTABLE_TYPE_128 0x00000003 -#define AR_KEYTABLE_TYPE_TKIP 0x00000004 -#define AR_KEYTABLE_TYPE_AES 0x00000005 -#define AR_KEYTABLE_TYPE_CCM 0x00000006 -#define AR_KEYTABLE_TYPE_CLR 0x00000007 -#define AR_KEYTABLE_ANT 0x00000008 -#define AR_KEYTABLE_VALID 0x00008000 -#define AR_KEYTABLE_KEY0(_n) (AR_KEYTABLE(_n) + 0) -#define AR_KEYTABLE_KEY1(_n) (AR_KEYTABLE(_n) + 4) -#define AR_KEYTABLE_KEY2(_n) (AR_KEYTABLE(_n) + 8) -#define AR_KEYTABLE_KEY3(_n) (AR_KEYTABLE(_n) + 12) -#define AR_KEYTABLE_KEY4(_n) (AR_KEYTABLE(_n) + 16) -#define AR_KEYTABLE_TYPE(_n) (AR_KEYTABLE(_n) + 20) -#define AR_KEYTABLE_MAC0(_n) (AR_KEYTABLE(_n) + 24) -#define AR_KEYTABLE_MAC1(_n) (AR_KEYTABLE(_n) + 28) - -#endif /* ATH_REGISTERS_H */ diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c deleted file mode 100644 index ccc4c718f124..000000000000 --- a/drivers/net/wireless/ath/regd.c +++ /dev/null @@ -1,661 +0,0 @@ -/* - * Copyright (c) 2008-2009 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include "regd.h" -#include "regd_common.h" - -static int __ath_regd_init(struct ath_regulatory *reg); - -/* - * This is a set of common rules used by our world regulatory domains. - * We have 12 world regulatory domains. To save space we consolidate - * the regulatory domains in 5 structures by frequency and change - * the flags on our reg_notifier() on a case by case basis. - */ - -/* Only these channels all allow active scan on all world regulatory domains */ -#define ATH9K_2GHZ_CH01_11 REG_RULE(2412-10, 2462+10, 40, 0, 20, 0) - -/* We enable active scan on these a case by case basis by regulatory domain */ -#define ATH9K_2GHZ_CH12_13 REG_RULE(2467-10, 2472+10, 40, 0, 20,\ - NL80211_RRF_PASSIVE_SCAN) -#define ATH9K_2GHZ_CH14 REG_RULE(2484-10, 2484+10, 40, 0, 20,\ - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_OFDM) - -/* We allow IBSS on these on a case by case basis by regulatory domain */ -#define ATH9K_5GHZ_5150_5350 REG_RULE(5150-10, 5350+10, 40, 0, 30,\ - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) -#define ATH9K_5GHZ_5470_5850 REG_RULE(5470-10, 5850+10, 40, 0, 30,\ - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) -#define ATH9K_5GHZ_5725_5850 REG_RULE(5725-10, 5850+10, 40, 0, 30,\ - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) - -#define ATH9K_2GHZ_ALL ATH9K_2GHZ_CH01_11, \ - ATH9K_2GHZ_CH12_13, \ - ATH9K_2GHZ_CH14 - -#define ATH9K_5GHZ_ALL ATH9K_5GHZ_5150_5350, \ - ATH9K_5GHZ_5470_5850 - -/* This one skips what we call "mid band" */ -#define ATH9K_5GHZ_NO_MIDBAND ATH9K_5GHZ_5150_5350, \ - ATH9K_5GHZ_5725_5850 - -/* Can be used for: - * 0x60, 0x61, 0x62 */ -static const struct ieee80211_regdomain ath_world_regdom_60_61_62 = { - .n_reg_rules = 5, - .alpha2 = "99", - .reg_rules = { - ATH9K_2GHZ_ALL, - ATH9K_5GHZ_ALL, - } -}; - -/* Can be used by 0x63 and 0x65 */ -static const struct ieee80211_regdomain ath_world_regdom_63_65 = { - .n_reg_rules = 4, - .alpha2 = "99", - .reg_rules = { - ATH9K_2GHZ_CH01_11, - ATH9K_2GHZ_CH12_13, - ATH9K_5GHZ_NO_MIDBAND, - } -}; - -/* Can be used by 0x64 only */ -static const struct ieee80211_regdomain ath_world_regdom_64 = { - .n_reg_rules = 3, - .alpha2 = "99", - .reg_rules = { - ATH9K_2GHZ_CH01_11, - ATH9K_5GHZ_NO_MIDBAND, - } -}; - -/* Can be used by 0x66 and 0x69 */ -static const struct ieee80211_regdomain ath_world_regdom_66_69 = { - .n_reg_rules = 3, - .alpha2 = "99", - .reg_rules = { - ATH9K_2GHZ_CH01_11, - ATH9K_5GHZ_ALL, - } -}; - -/* Can be used by 0x67, 0x68, 0x6A and 0x6C */ -static const struct ieee80211_regdomain ath_world_regdom_67_68_6A_6C = { - .n_reg_rules = 4, - .alpha2 = "99", - .reg_rules = { - ATH9K_2GHZ_CH01_11, - ATH9K_2GHZ_CH12_13, - ATH9K_5GHZ_ALL, - } -}; - -static inline bool is_wwr_sku(u16 regd) -{ - return ((regd & COUNTRY_ERD_FLAG) != COUNTRY_ERD_FLAG) && - (((regd & WORLD_SKU_MASK) == WORLD_SKU_PREFIX) || - (regd == WORLD)); -} - -static u16 ath_regd_get_eepromRD(struct ath_regulatory *reg) -{ - return reg->current_rd & ~WORLDWIDE_ROAMING_FLAG; -} - -bool ath_is_world_regd(struct ath_regulatory *reg) -{ - return is_wwr_sku(ath_regd_get_eepromRD(reg)); -} -EXPORT_SYMBOL(ath_is_world_regd); - -static const struct ieee80211_regdomain *ath_default_world_regdomain(void) -{ - /* this is the most restrictive */ - return &ath_world_regdom_64; -} - -static const struct -ieee80211_regdomain *ath_world_regdomain(struct ath_regulatory *reg) -{ - switch (reg->regpair->regDmnEnum) { - case 0x60: - case 0x61: - case 0x62: - return &ath_world_regdom_60_61_62; - case 0x63: - case 0x65: - return &ath_world_regdom_63_65; - case 0x64: - return &ath_world_regdom_64; - case 0x66: - case 0x69: - return &ath_world_regdom_66_69; - case 0x67: - case 0x68: - case 0x6A: - case 0x6C: - return &ath_world_regdom_67_68_6A_6C; - default: - WARN_ON(1); - return ath_default_world_regdomain(); - } -} - -bool ath_is_49ghz_allowed(u16 regdomain) -{ - /* possibly more */ - return regdomain == MKK9_MKKC; -} -EXPORT_SYMBOL(ath_is_49ghz_allowed); - -/* Frequency is one where radar detection is required */ -static bool ath_is_radar_freq(u16 center_freq) -{ - return (center_freq >= 5260 && center_freq <= 5700); -} - -/* - * N.B: These exception rules do not apply radar freqs. - * - * - We enable adhoc (or beaconing) if allowed by 11d - * - We enable active scan if the channel is allowed by 11d - * - If no country IE has been processed and a we determine we have - * received a beacon on a channel we can enable active scan and - * adhoc (or beaconing). - */ -static void -ath_reg_apply_beaconing_flags(struct wiphy *wiphy, - enum nl80211_reg_initiator initiator) -{ - enum ieee80211_band band; - struct ieee80211_supported_band *sband; - const struct ieee80211_reg_rule *reg_rule; - struct ieee80211_channel *ch; - unsigned int i; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - - if (!wiphy->bands[band]) - continue; - - sband = wiphy->bands[band]; - - for (i = 0; i < sband->n_channels; i++) { - - ch = &sband->channels[i]; - - if (ath_is_radar_freq(ch->center_freq) || - (ch->flags & IEEE80211_CHAN_RADAR)) - continue; - - if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) { - reg_rule = freq_reg_info(wiphy, ch->center_freq); - if (IS_ERR(reg_rule)) - continue; - /* - * If 11d had a rule for this channel ensure - * we enable adhoc/beaconing if it allows us to - * use it. Note that we would have disabled it - * by applying our static world regdomain by - * default during init, prior to calling our - * regulatory_hint(). - */ - if (!(reg_rule->flags & - NL80211_RRF_NO_IBSS)) - ch->flags &= - ~IEEE80211_CHAN_NO_IBSS; - if (!(reg_rule->flags & - NL80211_RRF_PASSIVE_SCAN)) - ch->flags &= - ~IEEE80211_CHAN_PASSIVE_SCAN; - } else { - if (ch->beacon_found) - ch->flags &= ~(IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN); - } - } - } - -} - -/* Allows active scan scan on Ch 12 and 13 */ -static void -ath_reg_apply_active_scan_flags(struct wiphy *wiphy, - enum nl80211_reg_initiator initiator) -{ - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch; - const struct ieee80211_reg_rule *reg_rule; - - sband = wiphy->bands[IEEE80211_BAND_2GHZ]; - if (!sband) - return; - - /* - * If no country IE has been received always enable active scan - * on these channels. This is only done for specific regulatory SKUs - */ - if (initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE) { - ch = &sband->channels[11]; /* CH 12 */ - if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; - ch = &sband->channels[12]; /* CH 13 */ - if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; - return; - } - - /* - * If a country IE has been received check its rule for this - * channel first before enabling active scan. The passive scan - * would have been enforced by the initial processing of our - * custom regulatory domain. - */ - - ch = &sband->channels[11]; /* CH 12 */ - reg_rule = freq_reg_info(wiphy, ch->center_freq); - if (!IS_ERR(reg_rule)) { - if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN)) - if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; - } - - ch = &sband->channels[12]; /* CH 13 */ - reg_rule = freq_reg_info(wiphy, ch->center_freq); - if (!IS_ERR(reg_rule)) { - if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN)) - if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; - } -} - -/* Always apply Radar/DFS rules on freq range 5260 MHz - 5700 MHz */ -static void ath_reg_apply_radar_flags(struct wiphy *wiphy) -{ - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch; - unsigned int i; - - if (!wiphy->bands[IEEE80211_BAND_5GHZ]) - return; - - sband = wiphy->bands[IEEE80211_BAND_5GHZ]; - - for (i = 0; i < sband->n_channels; i++) { - ch = &sband->channels[i]; - if (!ath_is_radar_freq(ch->center_freq)) - continue; - /* We always enable radar detection/DFS on this - * frequency range. Additionally we also apply on - * this frequency range: - * - If STA mode does not yet have DFS supports disable - * active scanning - * - If adhoc mode does not support DFS yet then - * disable adhoc in the frequency. - * - If AP mode does not yet support radar detection/DFS - * do not allow AP mode - */ - if (!(ch->flags & IEEE80211_CHAN_DISABLED)) - ch->flags |= IEEE80211_CHAN_RADAR | - IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN; - } -} - -static void ath_reg_apply_world_flags(struct wiphy *wiphy, - enum nl80211_reg_initiator initiator, - struct ath_regulatory *reg) -{ - switch (reg->regpair->regDmnEnum) { - case 0x60: - case 0x63: - case 0x66: - case 0x67: - case 0x6C: - ath_reg_apply_beaconing_flags(wiphy, initiator); - break; - case 0x68: - ath_reg_apply_beaconing_flags(wiphy, initiator); - ath_reg_apply_active_scan_flags(wiphy, initiator); - break; - } -} - -static u16 ath_regd_find_country_by_name(char *alpha2) -{ - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(allCountries); i++) { - if (!memcmp(allCountries[i].isoName, alpha2, 2)) - return allCountries[i].countryCode; - } - - return -1; -} - -void ath_reg_notifier_apply(struct wiphy *wiphy, - struct regulatory_request *request, - struct ath_regulatory *reg) -{ - struct ath_common *common = container_of(reg, struct ath_common, - regulatory); - u16 country_code; - - /* We always apply this */ - ath_reg_apply_radar_flags(wiphy); - - /* - * This would happen when we have sent a custom regulatory request - * a world regulatory domain and the scheduler hasn't yet processed - * any pending requests in the queue. - */ - if (!request) - return; - - switch (request->initiator) { - case NL80211_REGDOM_SET_BY_CORE: - /* - * If common->reg_world_copy is world roaming it means we *were* - * world roaming... so we now have to restore that data. - */ - if (!ath_is_world_regd(&common->reg_world_copy)) - break; - - memcpy(reg, &common->reg_world_copy, - sizeof(struct ath_regulatory)); - break; - case NL80211_REGDOM_SET_BY_DRIVER: - case NL80211_REGDOM_SET_BY_USER: - break; - case NL80211_REGDOM_SET_BY_COUNTRY_IE: - if (!ath_is_world_regd(reg)) - break; - - country_code = ath_regd_find_country_by_name(request->alpha2); - if (country_code == (u16) -1) - break; - - reg->current_rd = COUNTRY_ERD_FLAG; - reg->current_rd |= country_code; - - printk(KERN_DEBUG "ath: regdomain 0x%0x updated by CountryIE\n", - reg->current_rd); - __ath_regd_init(reg); - - ath_reg_apply_world_flags(wiphy, request->initiator, reg); - - break; - } -} -EXPORT_SYMBOL(ath_reg_notifier_apply); - -static bool ath_regd_is_eeprom_valid(struct ath_regulatory *reg) -{ - u16 rd = ath_regd_get_eepromRD(reg); - int i; - - if (rd & COUNTRY_ERD_FLAG) { - /* EEPROM value is a country code */ - u16 cc = rd & ~COUNTRY_ERD_FLAG; - printk(KERN_DEBUG - "ath: EEPROM indicates we should expect " - "a country code\n"); - for (i = 0; i < ARRAY_SIZE(allCountries); i++) - if (allCountries[i].countryCode == cc) - return true; - } else { - /* EEPROM value is a regpair value */ - if (rd != CTRY_DEFAULT) - printk(KERN_DEBUG "ath: EEPROM indicates we " - "should expect a direct regpair map\n"); - for (i = 0; i < ARRAY_SIZE(regDomainPairs); i++) - if (regDomainPairs[i].regDmnEnum == rd) - return true; - } - printk(KERN_DEBUG - "ath: invalid regulatory domain/country code 0x%x\n", rd); - return false; -} - -/* EEPROM country code to regpair mapping */ -static struct country_code_to_enum_rd* -ath_regd_find_country(u16 countryCode) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(allCountries); i++) { - if (allCountries[i].countryCode == countryCode) - return &allCountries[i]; - } - return NULL; -} - -/* EEPROM rd code to regpair mapping */ -static struct country_code_to_enum_rd* -ath_regd_find_country_by_rd(int regdmn) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(allCountries); i++) { - if (allCountries[i].regDmnEnum == regdmn) - return &allCountries[i]; - } - return NULL; -} - -/* Returns the map of the EEPROM set RD to a country code */ -static u16 ath_regd_get_default_country(u16 rd) -{ - if (rd & COUNTRY_ERD_FLAG) { - struct country_code_to_enum_rd *country = NULL; - u16 cc = rd & ~COUNTRY_ERD_FLAG; - - country = ath_regd_find_country(cc); - if (country != NULL) - return cc; - } - - return CTRY_DEFAULT; -} - -static struct reg_dmn_pair_mapping* -ath_get_regpair(int regdmn) -{ - int i; - - if (regdmn == NO_ENUMRD) - return NULL; - for (i = 0; i < ARRAY_SIZE(regDomainPairs); i++) { - if (regDomainPairs[i].regDmnEnum == regdmn) - return ®DomainPairs[i]; - } - return NULL; -} - -static int -ath_regd_init_wiphy(struct ath_regulatory *reg, - struct wiphy *wiphy, - void (*reg_notifier)(struct wiphy *wiphy, - struct regulatory_request *request)) -{ - const struct ieee80211_regdomain *regd; - - wiphy->reg_notifier = reg_notifier; - wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; - - if (ath_is_world_regd(reg)) { - /* - * Anything applied here (prior to wiphy registration) gets - * saved on the wiphy orig_* parameters - */ - regd = ath_world_regdomain(reg); - wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; - } else { - /* - * This gets applied in the case of the absence of CRDA, - * it's our own custom world regulatory domain, similar to - * cfg80211's but we enable passive scanning. - */ - regd = ath_default_world_regdomain(); - } - wiphy_apply_custom_regulatory(wiphy, regd); - ath_reg_apply_radar_flags(wiphy); - ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg); - return 0; -} - -/* - * Some users have reported their EEPROM programmed with - * 0x8000 set, this is not a supported regulatory domain - * but since we have more than one user with it we need - * a solution for them. We default to 0x64, which is the - * default Atheros world regulatory domain. - */ -static void ath_regd_sanitize(struct ath_regulatory *reg) -{ - if (reg->current_rd != COUNTRY_ERD_FLAG) - return; - printk(KERN_DEBUG "ath: EEPROM regdomain sanitized\n"); - reg->current_rd = 0x64; -} - -static int __ath_regd_init(struct ath_regulatory *reg) -{ - struct country_code_to_enum_rd *country = NULL; - u16 regdmn; - - if (!reg) - return -EINVAL; - - ath_regd_sanitize(reg); - - printk(KERN_DEBUG "ath: EEPROM regdomain: 0x%0x\n", reg->current_rd); - - if (!ath_regd_is_eeprom_valid(reg)) { - pr_err("Invalid EEPROM contents\n"); - return -EINVAL; - } - - regdmn = ath_regd_get_eepromRD(reg); - reg->country_code = ath_regd_get_default_country(regdmn); - - if (reg->country_code == CTRY_DEFAULT && - regdmn == CTRY_DEFAULT) { - printk(KERN_DEBUG "ath: EEPROM indicates default " - "country code should be used\n"); - reg->country_code = CTRY_UNITED_STATES; - } - - if (reg->country_code == CTRY_DEFAULT) { - country = NULL; - } else { - printk(KERN_DEBUG "ath: doing EEPROM country->regdmn " - "map search\n"); - country = ath_regd_find_country(reg->country_code); - if (country == NULL) { - printk(KERN_DEBUG - "ath: no valid country maps found for " - "country code: 0x%0x\n", - reg->country_code); - return -EINVAL; - } else { - regdmn = country->regDmnEnum; - printk(KERN_DEBUG "ath: country maps to " - "regdmn code: 0x%0x\n", - regdmn); - } - } - - reg->regpair = ath_get_regpair(regdmn); - - if (!reg->regpair) { - printk(KERN_DEBUG "ath: " - "No regulatory domain pair found, cannot continue\n"); - return -EINVAL; - } - - if (!country) - country = ath_regd_find_country_by_rd(regdmn); - - if (country) { - reg->alpha2[0] = country->isoName[0]; - reg->alpha2[1] = country->isoName[1]; - } else { - reg->alpha2[0] = '0'; - reg->alpha2[1] = '0'; - } - - printk(KERN_DEBUG "ath: Country alpha2 being used: %c%c\n", - reg->alpha2[0], reg->alpha2[1]); - printk(KERN_DEBUG "ath: Regpair used: 0x%0x\n", - reg->regpair->regDmnEnum); - - return 0; -} - -int -ath_regd_init(struct ath_regulatory *reg, - struct wiphy *wiphy, - void (*reg_notifier)(struct wiphy *wiphy, - struct regulatory_request *request)) -{ - struct ath_common *common = container_of(reg, struct ath_common, - regulatory); - int r; - - r = __ath_regd_init(reg); - if (r) - return r; - - if (ath_is_world_regd(reg)) - memcpy(&common->reg_world_copy, reg, - sizeof(struct ath_regulatory)); - - ath_regd_init_wiphy(reg, wiphy, reg_notifier); - - return 0; -} -EXPORT_SYMBOL(ath_regd_init); - -u32 ath_regd_get_band_ctl(struct ath_regulatory *reg, - enum ieee80211_band band) -{ - if (!reg->regpair || - (reg->country_code == CTRY_DEFAULT && - is_wwr_sku(ath_regd_get_eepromRD(reg)))) { - return SD_NO_CTL; - } - - switch (band) { - case IEEE80211_BAND_2GHZ: - return reg->regpair->reg_2ghz_ctl; - case IEEE80211_BAND_5GHZ: - return reg->regpair->reg_5ghz_ctl; - default: - return NO_CTL; - } -} -EXPORT_SYMBOL(ath_regd_get_band_ctl); diff --git a/drivers/net/wireless/ath/regd.h b/drivers/net/wireless/ath/regd.h deleted file mode 100644 index 37f53bd8fcb1..000000000000 --- a/drivers/net/wireless/ath/regd.h +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2008-2009 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef REGD_H -#define REGD_H - -#include -#include - -#include "ath.h" - -enum ctl_group { - CTL_FCC = 0x10, - CTL_MKK = 0x40, - CTL_ETSI = 0x30, -}; - -#define NO_CTL 0xff -#define SD_NO_CTL 0xE0 -#define NO_CTL 0xff -#define CTL_11A 0 -#define CTL_11B 1 -#define CTL_11G 2 -#define CTL_2GHT20 5 -#define CTL_5GHT20 6 -#define CTL_2GHT40 7 -#define CTL_5GHT40 8 - -#define CTRY_DEBUG 0x1ff -#define CTRY_DEFAULT 0 - -#define COUNTRY_ERD_FLAG 0x8000 -#define WORLDWIDE_ROAMING_FLAG 0x4000 - -#define MULTI_DOMAIN_MASK 0xFF00 - -#define WORLD_SKU_MASK 0x00F0 -#define WORLD_SKU_PREFIX 0x0060 - -#define CHANNEL_HALF_BW 10 -#define CHANNEL_QUARTER_BW 5 - -struct country_code_to_enum_rd { - u16 countryCode; - u16 regDmnEnum; - const char *isoName; -}; - -enum CountryCode { - CTRY_ALBANIA = 8, - CTRY_ALGERIA = 12, - CTRY_ARGENTINA = 32, - CTRY_ARMENIA = 51, - CTRY_ARUBA = 533, - CTRY_AUSTRALIA = 36, - CTRY_AUSTRIA = 40, - CTRY_AZERBAIJAN = 31, - CTRY_BAHRAIN = 48, - CTRY_BANGLADESH = 50, - CTRY_BARBADOS = 52, - CTRY_BELARUS = 112, - CTRY_BELGIUM = 56, - CTRY_BELIZE = 84, - CTRY_BOLIVIA = 68, - CTRY_BOSNIA_HERZ = 70, - CTRY_BRAZIL = 76, - CTRY_BRUNEI_DARUSSALAM = 96, - CTRY_BULGARIA = 100, - CTRY_CAMBODIA = 116, - CTRY_CANADA = 124, - CTRY_CHILE = 152, - CTRY_CHINA = 156, - CTRY_COLOMBIA = 170, - CTRY_COSTA_RICA = 188, - CTRY_CROATIA = 191, - CTRY_CYPRUS = 196, - CTRY_CZECH = 203, - CTRY_DENMARK = 208, - CTRY_DOMINICAN_REPUBLIC = 214, - CTRY_ECUADOR = 218, - CTRY_EGYPT = 818, - CTRY_EL_SALVADOR = 222, - CTRY_ESTONIA = 233, - CTRY_FAEROE_ISLANDS = 234, - CTRY_FINLAND = 246, - CTRY_FRANCE = 250, - CTRY_GEORGIA = 268, - CTRY_GERMANY = 276, - CTRY_GREECE = 300, - CTRY_GREENLAND = 304, - CTRY_GRENADA = 308, - CTRY_GUAM = 316, - CTRY_GUATEMALA = 320, - CTRY_HAITI = 332, - CTRY_HONDURAS = 340, - CTRY_HONG_KONG = 344, - CTRY_HUNGARY = 348, - CTRY_ICELAND = 352, - CTRY_INDIA = 356, - CTRY_INDONESIA = 360, - CTRY_IRAN = 364, - CTRY_IRAQ = 368, - CTRY_IRELAND = 372, - CTRY_ISRAEL = 376, - CTRY_ITALY = 380, - CTRY_JAMAICA = 388, - CTRY_JAPAN = 392, - CTRY_JORDAN = 400, - CTRY_KAZAKHSTAN = 398, - CTRY_KENYA = 404, - CTRY_KOREA_NORTH = 408, - CTRY_KOREA_ROC = 410, - CTRY_KOREA_ROC2 = 411, - CTRY_KOREA_ROC3 = 412, - CTRY_KUWAIT = 414, - CTRY_LATVIA = 428, - CTRY_LEBANON = 422, - CTRY_LIBYA = 434, - CTRY_LIECHTENSTEIN = 438, - CTRY_LITHUANIA = 440, - CTRY_LUXEMBOURG = 442, - CTRY_MACAU = 446, - CTRY_MACEDONIA = 807, - CTRY_MALAYSIA = 458, - CTRY_MALTA = 470, - CTRY_MEXICO = 484, - CTRY_MONACO = 492, - CTRY_MOROCCO = 504, - CTRY_NEPAL = 524, - CTRY_NETHERLANDS = 528, - CTRY_NETHERLANDS_ANTILLES = 530, - CTRY_NEW_ZEALAND = 554, - CTRY_NICARAGUA = 558, - CTRY_NORWAY = 578, - CTRY_OMAN = 512, - CTRY_PAKISTAN = 586, - CTRY_PANAMA = 591, - CTRY_PAPUA_NEW_GUINEA = 598, - CTRY_PARAGUAY = 600, - CTRY_PERU = 604, - CTRY_PHILIPPINES = 608, - CTRY_POLAND = 616, - CTRY_PORTUGAL = 620, - CTRY_PUERTO_RICO = 630, - CTRY_QATAR = 634, - CTRY_ROMANIA = 642, - CTRY_RUSSIA = 643, - CTRY_SAUDI_ARABIA = 682, - CTRY_SERBIA_MONTENEGRO = 891, - CTRY_SINGAPORE = 702, - CTRY_SLOVAKIA = 703, - CTRY_SLOVENIA = 705, - CTRY_SOUTH_AFRICA = 710, - CTRY_SPAIN = 724, - CTRY_SRI_LANKA = 144, - CTRY_SWEDEN = 752, - CTRY_SWITZERLAND = 756, - CTRY_SYRIA = 760, - CTRY_TAIWAN = 158, - CTRY_THAILAND = 764, - CTRY_TRINIDAD_Y_TOBAGO = 780, - CTRY_TUNISIA = 788, - CTRY_TURKEY = 792, - CTRY_UAE = 784, - CTRY_UKRAINE = 804, - CTRY_UNITED_KINGDOM = 826, - CTRY_UNITED_STATES = 840, - CTRY_UNITED_STATES_FCC49 = 842, - CTRY_URUGUAY = 858, - CTRY_UZBEKISTAN = 860, - CTRY_VENEZUELA = 862, - CTRY_VIET_NAM = 704, - CTRY_YEMEN = 887, - CTRY_ZIMBABWE = 716, - CTRY_JAPAN1 = 393, - CTRY_JAPAN2 = 394, - CTRY_JAPAN3 = 395, - CTRY_JAPAN4 = 396, - CTRY_JAPAN5 = 397, - CTRY_JAPAN6 = 4006, - CTRY_JAPAN7 = 4007, - CTRY_JAPAN8 = 4008, - CTRY_JAPAN9 = 4009, - CTRY_JAPAN10 = 4010, - CTRY_JAPAN11 = 4011, - CTRY_JAPAN12 = 4012, - CTRY_JAPAN13 = 4013, - CTRY_JAPAN14 = 4014, - CTRY_JAPAN15 = 4015, - CTRY_JAPAN16 = 4016, - CTRY_JAPAN17 = 4017, - CTRY_JAPAN18 = 4018, - CTRY_JAPAN19 = 4019, - CTRY_JAPAN20 = 4020, - CTRY_JAPAN21 = 4021, - CTRY_JAPAN22 = 4022, - CTRY_JAPAN23 = 4023, - CTRY_JAPAN24 = 4024, - CTRY_JAPAN25 = 4025, - CTRY_JAPAN26 = 4026, - CTRY_JAPAN27 = 4027, - CTRY_JAPAN28 = 4028, - CTRY_JAPAN29 = 4029, - CTRY_JAPAN30 = 4030, - CTRY_JAPAN31 = 4031, - CTRY_JAPAN32 = 4032, - CTRY_JAPAN33 = 4033, - CTRY_JAPAN34 = 4034, - CTRY_JAPAN35 = 4035, - CTRY_JAPAN36 = 4036, - CTRY_JAPAN37 = 4037, - CTRY_JAPAN38 = 4038, - CTRY_JAPAN39 = 4039, - CTRY_JAPAN40 = 4040, - CTRY_JAPAN41 = 4041, - CTRY_JAPAN42 = 4042, - CTRY_JAPAN43 = 4043, - CTRY_JAPAN44 = 4044, - CTRY_JAPAN45 = 4045, - CTRY_JAPAN46 = 4046, - CTRY_JAPAN47 = 4047, - CTRY_JAPAN48 = 4048, - CTRY_JAPAN49 = 4049, - CTRY_JAPAN50 = 4050, - CTRY_JAPAN51 = 4051, - CTRY_JAPAN52 = 4052, - CTRY_JAPAN53 = 4053, - CTRY_JAPAN54 = 4054, - CTRY_JAPAN55 = 4055, - CTRY_JAPAN56 = 4056, - CTRY_JAPAN57 = 4057, - CTRY_JAPAN58 = 4058, - CTRY_JAPAN59 = 4059, - CTRY_AUSTRALIA2 = 5000, - CTRY_CANADA2 = 5001, - CTRY_BELGIUM2 = 5002 -}; - -bool ath_is_world_regd(struct ath_regulatory *reg); -bool ath_is_49ghz_allowed(u16 redomain); -int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy, - void (*reg_notifier)(struct wiphy *wiphy, - struct regulatory_request *request)); -u32 ath_regd_get_band_ctl(struct ath_regulatory *reg, - enum ieee80211_band band); -void ath_reg_notifier_apply(struct wiphy *wiphy, - struct regulatory_request *request, - struct ath_regulatory *reg); - -#endif diff --git a/drivers/net/wireless/ath/regd_common.h b/drivers/net/wireless/ath/regd_common.h deleted file mode 100644 index bdd2b4d61f2f..000000000000 --- a/drivers/net/wireless/ath/regd_common.h +++ /dev/null @@ -1,478 +0,0 @@ -/* - * Copyright (c) 2008-2009 Atheros Communications Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef REGD_COMMON_H -#define REGD_COMMON_H - -enum EnumRd { - NO_ENUMRD = 0x00, - NULL1_WORLD = 0x03, - NULL1_ETSIB = 0x07, - NULL1_ETSIC = 0x08, - FCC1_FCCA = 0x10, - FCC1_WORLD = 0x11, - FCC4_FCCA = 0x12, - FCC5_FCCA = 0x13, - FCC6_FCCA = 0x14, - - FCC2_FCCA = 0x20, - FCC2_WORLD = 0x21, - FCC2_ETSIC = 0x22, - FCC6_WORLD = 0x23, - FRANCE_RES = 0x31, - FCC3_FCCA = 0x3A, - FCC3_WORLD = 0x3B, - - ETSI1_WORLD = 0x37, - ETSI3_ETSIA = 0x32, - ETSI2_WORLD = 0x35, - ETSI3_WORLD = 0x36, - ETSI4_WORLD = 0x30, - ETSI4_ETSIC = 0x38, - ETSI5_WORLD = 0x39, - ETSI6_WORLD = 0x34, - ETSI_RESERVED = 0x33, - - MKK1_MKKA = 0x40, - MKK1_MKKB = 0x41, - APL4_WORLD = 0x42, - MKK2_MKKA = 0x43, - APL_RESERVED = 0x44, - APL2_WORLD = 0x45, - APL2_APLC = 0x46, - APL3_WORLD = 0x47, - MKK1_FCCA = 0x48, - APL2_APLD = 0x49, - MKK1_MKKA1 = 0x4A, - MKK1_MKKA2 = 0x4B, - MKK1_MKKC = 0x4C, - - APL3_FCCA = 0x50, - APL1_WORLD = 0x52, - APL1_FCCA = 0x53, - APL1_APLA = 0x54, - APL1_ETSIC = 0x55, - APL2_ETSIC = 0x56, - APL5_WORLD = 0x58, - APL6_WORLD = 0x5B, - APL7_FCCA = 0x5C, - APL8_WORLD = 0x5D, - APL9_WORLD = 0x5E, - - WOR0_WORLD = 0x60, - WOR1_WORLD = 0x61, - WOR2_WORLD = 0x62, - WOR3_WORLD = 0x63, - WOR4_WORLD = 0x64, - WOR5_ETSIC = 0x65, - - WOR01_WORLD = 0x66, - WOR02_WORLD = 0x67, - EU1_WORLD = 0x68, - - WOR9_WORLD = 0x69, - WORA_WORLD = 0x6A, - WORB_WORLD = 0x6B, - WORC_WORLD = 0x6C, - - MKK3_MKKB = 0x80, - MKK3_MKKA2 = 0x81, - MKK3_MKKC = 0x82, - - MKK4_MKKB = 0x83, - MKK4_MKKA2 = 0x84, - MKK4_MKKC = 0x85, - - MKK5_MKKB = 0x86, - MKK5_MKKA2 = 0x87, - MKK5_MKKC = 0x88, - - MKK6_MKKB = 0x89, - MKK6_MKKA2 = 0x8A, - MKK6_MKKC = 0x8B, - - MKK7_MKKB = 0x8C, - MKK7_MKKA2 = 0x8D, - MKK7_MKKC = 0x8E, - - MKK8_MKKB = 0x8F, - MKK8_MKKA2 = 0x90, - MKK8_MKKC = 0x91, - - MKK14_MKKA1 = 0x92, - MKK15_MKKA1 = 0x93, - - MKK10_FCCA = 0xD0, - MKK10_MKKA1 = 0xD1, - MKK10_MKKC = 0xD2, - MKK10_MKKA2 = 0xD3, - - MKK11_MKKA = 0xD4, - MKK11_FCCA = 0xD5, - MKK11_MKKA1 = 0xD6, - MKK11_MKKC = 0xD7, - MKK11_MKKA2 = 0xD8, - - MKK12_MKKA = 0xD9, - MKK12_FCCA = 0xDA, - MKK12_MKKA1 = 0xDB, - MKK12_MKKC = 0xDC, - MKK12_MKKA2 = 0xDD, - - MKK13_MKKB = 0xDE, - - MKK3_MKKA = 0xF0, - MKK3_MKKA1 = 0xF1, - MKK3_FCCA = 0xF2, - MKK4_MKKA = 0xF3, - MKK4_MKKA1 = 0xF4, - MKK4_FCCA = 0xF5, - MKK9_MKKA = 0xF6, - MKK10_MKKA = 0xF7, - MKK6_MKKA1 = 0xF8, - MKK6_FCCA = 0xF9, - MKK7_MKKA1 = 0xFA, - MKK7_FCCA = 0xFB, - MKK9_FCCA = 0xFC, - MKK9_MKKA1 = 0xFD, - MKK9_MKKC = 0xFE, - MKK9_MKKA2 = 0xFF, - - WORLD = 0x0199, - DEBUG_REG_DMN = 0x01ff, -}; - -/* Regpair to CTL band mapping */ -static struct reg_dmn_pair_mapping regDomainPairs[] = { - /* regpair, 5 GHz CTL, 2 GHz CTL */ - {NO_ENUMRD, DEBUG_REG_DMN, DEBUG_REG_DMN}, - {NULL1_WORLD, NO_CTL, CTL_ETSI}, - {NULL1_ETSIB, NO_CTL, CTL_ETSI}, - {NULL1_ETSIC, NO_CTL, CTL_ETSI}, - - {FCC2_FCCA, CTL_FCC, CTL_FCC}, - {FCC2_WORLD, CTL_FCC, CTL_ETSI}, - {FCC2_ETSIC, CTL_FCC, CTL_ETSI}, - {FCC3_FCCA, CTL_FCC, CTL_FCC}, - {FCC3_WORLD, CTL_FCC, CTL_ETSI}, - {FCC4_FCCA, CTL_FCC, CTL_FCC}, - {FCC5_FCCA, CTL_FCC, CTL_FCC}, - {FCC6_FCCA, CTL_FCC, CTL_FCC}, - {FCC6_WORLD, CTL_FCC, CTL_ETSI}, - - {ETSI1_WORLD, CTL_ETSI, CTL_ETSI}, - {ETSI2_WORLD, CTL_ETSI, CTL_ETSI}, - {ETSI3_WORLD, CTL_ETSI, CTL_ETSI}, - {ETSI4_WORLD, CTL_ETSI, CTL_ETSI}, - {ETSI5_WORLD, CTL_ETSI, CTL_ETSI}, - {ETSI6_WORLD, CTL_ETSI, CTL_ETSI}, - - /* XXX: For ETSI3_ETSIA, Was NO_CTL meant for the 2 GHz band ? */ - {ETSI3_ETSIA, CTL_ETSI, CTL_ETSI}, - {FRANCE_RES, CTL_ETSI, CTL_ETSI}, - - {FCC1_WORLD, CTL_FCC, CTL_ETSI}, - {FCC1_FCCA, CTL_FCC, CTL_FCC}, - {APL1_WORLD, CTL_FCC, CTL_ETSI}, - {APL2_WORLD, CTL_FCC, CTL_ETSI}, - {APL3_WORLD, CTL_FCC, CTL_ETSI}, - {APL4_WORLD, CTL_FCC, CTL_ETSI}, - {APL5_WORLD, CTL_FCC, CTL_ETSI}, - {APL6_WORLD, CTL_ETSI, CTL_ETSI}, - {APL8_WORLD, CTL_ETSI, CTL_ETSI}, - {APL9_WORLD, CTL_ETSI, CTL_ETSI}, - - {APL3_FCCA, CTL_FCC, CTL_FCC}, - {APL7_FCCA, CTL_FCC, CTL_FCC}, - {APL1_ETSIC, CTL_FCC, CTL_ETSI}, - {APL2_ETSIC, CTL_FCC, CTL_ETSI}, - {APL2_APLD, CTL_FCC, NO_CTL}, - - {MKK1_MKKA, CTL_MKK, CTL_MKK}, - {MKK1_MKKB, CTL_MKK, CTL_MKK}, - {MKK1_FCCA, CTL_MKK, CTL_FCC}, - {MKK1_MKKA1, CTL_MKK, CTL_MKK}, - {MKK1_MKKA2, CTL_MKK, CTL_MKK}, - {MKK1_MKKC, CTL_MKK, CTL_MKK}, - - {MKK2_MKKA, CTL_MKK, CTL_MKK}, - {MKK3_MKKA, CTL_MKK, CTL_MKK}, - {MKK3_MKKB, CTL_MKK, CTL_MKK}, - {MKK3_MKKA1, CTL_MKK, CTL_MKK}, - {MKK3_MKKA2, CTL_MKK, CTL_MKK}, - {MKK3_MKKC, CTL_MKK, CTL_MKK}, - {MKK3_FCCA, CTL_MKK, CTL_FCC}, - - {MKK4_MKKA, CTL_MKK, CTL_MKK}, - {MKK4_MKKB, CTL_MKK, CTL_MKK}, - {MKK4_MKKA1, CTL_MKK, CTL_MKK}, - {MKK4_MKKA2, CTL_MKK, CTL_MKK}, - {MKK4_MKKC, CTL_MKK, CTL_MKK}, - {MKK4_FCCA, CTL_MKK, CTL_FCC}, - - {MKK5_MKKB, CTL_MKK, CTL_MKK}, - {MKK5_MKKA2, CTL_MKK, CTL_MKK}, - {MKK5_MKKC, CTL_MKK, CTL_MKK}, - - {MKK6_MKKB, CTL_MKK, CTL_MKK}, - {MKK6_MKKA1, CTL_MKK, CTL_MKK}, - {MKK6_MKKA2, CTL_MKK, CTL_MKK}, - {MKK6_MKKC, CTL_MKK, CTL_MKK}, - {MKK6_FCCA, CTL_MKK, CTL_FCC}, - - {MKK7_MKKB, CTL_MKK, CTL_MKK}, - {MKK7_MKKA1, CTL_MKK, CTL_MKK}, - {MKK7_MKKA2, CTL_MKK, CTL_MKK}, - {MKK7_MKKC, CTL_MKK, CTL_MKK}, - {MKK7_FCCA, CTL_MKK, CTL_FCC}, - - {MKK8_MKKB, CTL_MKK, CTL_MKK}, - {MKK8_MKKA2, CTL_MKK, CTL_MKK}, - {MKK8_MKKC, CTL_MKK, CTL_MKK}, - - {MKK9_MKKA, CTL_MKK, CTL_MKK}, - {MKK9_FCCA, CTL_MKK, CTL_FCC}, - {MKK9_MKKA1, CTL_MKK, CTL_MKK}, - {MKK9_MKKA2, CTL_MKK, CTL_MKK}, - {MKK9_MKKC, CTL_MKK, CTL_MKK}, - - {MKK10_MKKA, CTL_MKK, CTL_MKK}, - {MKK10_FCCA, CTL_MKK, CTL_FCC}, - {MKK10_MKKA1, CTL_MKK, CTL_MKK}, - {MKK10_MKKA2, CTL_MKK, CTL_MKK}, - {MKK10_MKKC, CTL_MKK, CTL_MKK}, - - {MKK11_MKKA, CTL_MKK, CTL_MKK}, - {MKK11_FCCA, CTL_MKK, CTL_FCC}, - {MKK11_MKKA1, CTL_MKK, CTL_MKK}, - {MKK11_MKKA2, CTL_MKK, CTL_MKK}, - {MKK11_MKKC, CTL_MKK, CTL_MKK}, - - {MKK12_MKKA, CTL_MKK, CTL_MKK}, - {MKK12_FCCA, CTL_MKK, CTL_FCC}, - {MKK12_MKKA1, CTL_MKK, CTL_MKK}, - {MKK12_MKKA2, CTL_MKK, CTL_MKK}, - {MKK12_MKKC, CTL_MKK, CTL_MKK}, - - {MKK13_MKKB, CTL_MKK, CTL_MKK}, - {MKK14_MKKA1, CTL_MKK, CTL_MKK}, - {MKK15_MKKA1, CTL_MKK, CTL_MKK}, - - {WOR0_WORLD, NO_CTL, NO_CTL}, - {WOR1_WORLD, NO_CTL, NO_CTL}, - {WOR2_WORLD, NO_CTL, NO_CTL}, - {WOR3_WORLD, NO_CTL, NO_CTL}, - {WOR4_WORLD, NO_CTL, NO_CTL}, - {WOR5_ETSIC, NO_CTL, NO_CTL}, - {WOR01_WORLD, NO_CTL, NO_CTL}, - {WOR02_WORLD, NO_CTL, NO_CTL}, - {EU1_WORLD, NO_CTL, NO_CTL}, - {WOR9_WORLD, NO_CTL, NO_CTL}, - {WORA_WORLD, NO_CTL, NO_CTL}, - {WORB_WORLD, NO_CTL, NO_CTL}, - {WORC_WORLD, NO_CTL, NO_CTL}, -}; - -static struct country_code_to_enum_rd allCountries[] = { - {CTRY_DEBUG, NO_ENUMRD, "DB"}, - {CTRY_DEFAULT, FCC1_FCCA, "CO"}, - {CTRY_ALBANIA, NULL1_WORLD, "AL"}, - {CTRY_ALGERIA, NULL1_WORLD, "DZ"}, - {CTRY_ARGENTINA, FCC3_WORLD, "AR"}, - {CTRY_ARMENIA, ETSI4_WORLD, "AM"}, - {CTRY_ARUBA, ETSI1_WORLD, "AW"}, - {CTRY_AUSTRALIA, FCC2_WORLD, "AU"}, - {CTRY_AUSTRALIA2, FCC6_WORLD, "AU"}, - {CTRY_AUSTRIA, ETSI1_WORLD, "AT"}, - {CTRY_AZERBAIJAN, ETSI4_WORLD, "AZ"}, - {CTRY_BAHRAIN, APL6_WORLD, "BH"}, - {CTRY_BANGLADESH, NULL1_WORLD, "BD"}, - {CTRY_BARBADOS, FCC2_WORLD, "BB"}, - {CTRY_BELARUS, ETSI1_WORLD, "BY"}, - {CTRY_BELGIUM, ETSI1_WORLD, "BE"}, - {CTRY_BELGIUM2, ETSI4_WORLD, "BL"}, - {CTRY_BELIZE, APL1_ETSIC, "BZ"}, - {CTRY_BOLIVIA, APL1_ETSIC, "BO"}, - {CTRY_BOSNIA_HERZ, ETSI1_WORLD, "BA"}, - {CTRY_BRAZIL, FCC3_WORLD, "BR"}, - {CTRY_BRUNEI_DARUSSALAM, APL1_WORLD, "BN"}, - {CTRY_BULGARIA, ETSI6_WORLD, "BG"}, - {CTRY_CAMBODIA, ETSI1_WORLD, "KH"}, - {CTRY_CANADA, FCC3_FCCA, "CA"}, - {CTRY_CANADA2, FCC6_FCCA, "CA"}, - {CTRY_CHILE, APL6_WORLD, "CL"}, - {CTRY_CHINA, APL1_WORLD, "CN"}, - {CTRY_COLOMBIA, FCC1_FCCA, "CO"}, - {CTRY_COSTA_RICA, FCC1_WORLD, "CR"}, - {CTRY_CROATIA, ETSI1_WORLD, "HR"}, - {CTRY_CYPRUS, ETSI1_WORLD, "CY"}, - {CTRY_CZECH, ETSI3_WORLD, "CZ"}, - {CTRY_DENMARK, ETSI1_WORLD, "DK"}, - {CTRY_DOMINICAN_REPUBLIC, FCC1_FCCA, "DO"}, - {CTRY_ECUADOR, FCC1_WORLD, "EC"}, - {CTRY_EGYPT, ETSI3_WORLD, "EG"}, - {CTRY_EL_SALVADOR, FCC1_WORLD, "SV"}, - {CTRY_ESTONIA, ETSI1_WORLD, "EE"}, - {CTRY_FINLAND, ETSI1_WORLD, "FI"}, - {CTRY_FRANCE, ETSI1_WORLD, "FR"}, - {CTRY_GEORGIA, ETSI4_WORLD, "GE"}, - {CTRY_GERMANY, ETSI1_WORLD, "DE"}, - {CTRY_GREECE, ETSI1_WORLD, "GR"}, - {CTRY_GREENLAND, ETSI1_WORLD, "GL"}, - {CTRY_GRENADA, FCC3_FCCA, "GD"}, - {CTRY_GUAM, FCC1_FCCA, "GU"}, - {CTRY_GUATEMALA, FCC1_FCCA, "GT"}, - {CTRY_HAITI, ETSI1_WORLD, "HT"}, - {CTRY_HONDURAS, NULL1_WORLD, "HN"}, - {CTRY_HONG_KONG, FCC3_WORLD, "HK"}, - {CTRY_HUNGARY, ETSI1_WORLD, "HU"}, - {CTRY_ICELAND, ETSI1_WORLD, "IS"}, - {CTRY_INDIA, APL6_WORLD, "IN"}, - {CTRY_INDONESIA, NULL1_WORLD, "ID"}, - {CTRY_IRAN, APL1_WORLD, "IR"}, - {CTRY_IRELAND, ETSI1_WORLD, "IE"}, - {CTRY_ISRAEL, NULL1_WORLD, "IL"}, - {CTRY_ITALY, ETSI1_WORLD, "IT"}, - {CTRY_JAMAICA, FCC3_WORLD, "JM"}, - - {CTRY_JAPAN, MKK1_MKKA, "JP"}, - {CTRY_JAPAN1, MKK1_MKKB, "JP"}, - {CTRY_JAPAN2, MKK1_FCCA, "JP"}, - {CTRY_JAPAN3, MKK2_MKKA, "JP"}, - {CTRY_JAPAN4, MKK1_MKKA1, "JP"}, - {CTRY_JAPAN5, MKK1_MKKA2, "JP"}, - {CTRY_JAPAN6, MKK1_MKKC, "JP"}, - {CTRY_JAPAN7, MKK3_MKKB, "JP"}, - {CTRY_JAPAN8, MKK3_MKKA2, "JP"}, - {CTRY_JAPAN9, MKK3_MKKC, "JP"}, - {CTRY_JAPAN10, MKK4_MKKB, "JP"}, - {CTRY_JAPAN11, MKK4_MKKA2, "JP"}, - {CTRY_JAPAN12, MKK4_MKKC, "JP"}, - {CTRY_JAPAN13, MKK5_MKKB, "JP"}, - {CTRY_JAPAN14, MKK5_MKKA2, "JP"}, - {CTRY_JAPAN15, MKK5_MKKC, "JP"}, - {CTRY_JAPAN16, MKK6_MKKB, "JP"}, - {CTRY_JAPAN17, MKK6_MKKA2, "JP"}, - {CTRY_JAPAN18, MKK6_MKKC, "JP"}, - {CTRY_JAPAN19, MKK7_MKKB, "JP"}, - {CTRY_JAPAN20, MKK7_MKKA2, "JP"}, - {CTRY_JAPAN21, MKK7_MKKC, "JP"}, - {CTRY_JAPAN22, MKK8_MKKB, "JP"}, - {CTRY_JAPAN23, MKK8_MKKA2, "JP"}, - {CTRY_JAPAN24, MKK8_MKKC, "JP"}, - {CTRY_JAPAN25, MKK3_MKKA, "JP"}, - {CTRY_JAPAN26, MKK3_MKKA1, "JP"}, - {CTRY_JAPAN27, MKK3_FCCA, "JP"}, - {CTRY_JAPAN28, MKK4_MKKA1, "JP"}, - {CTRY_JAPAN29, MKK4_FCCA, "JP"}, - {CTRY_JAPAN30, MKK6_MKKA1, "JP"}, - {CTRY_JAPAN31, MKK6_FCCA, "JP"}, - {CTRY_JAPAN32, MKK7_MKKA1, "JP"}, - {CTRY_JAPAN33, MKK7_FCCA, "JP"}, - {CTRY_JAPAN34, MKK9_MKKA, "JP"}, - {CTRY_JAPAN35, MKK10_MKKA, "JP"}, - {CTRY_JAPAN36, MKK4_MKKA, "JP"}, - {CTRY_JAPAN37, MKK9_FCCA, "JP"}, - {CTRY_JAPAN38, MKK9_MKKA1, "JP"}, - {CTRY_JAPAN39, MKK9_MKKC, "JP"}, - {CTRY_JAPAN40, MKK9_MKKA2, "JP"}, - {CTRY_JAPAN41, MKK10_FCCA, "JP"}, - {CTRY_JAPAN42, MKK10_MKKA1, "JP"}, - {CTRY_JAPAN43, MKK10_MKKC, "JP"}, - {CTRY_JAPAN44, MKK10_MKKA2, "JP"}, - {CTRY_JAPAN45, MKK11_MKKA, "JP"}, - {CTRY_JAPAN46, MKK11_FCCA, "JP"}, - {CTRY_JAPAN47, MKK11_MKKA1, "JP"}, - {CTRY_JAPAN48, MKK11_MKKC, "JP"}, - {CTRY_JAPAN49, MKK11_MKKA2, "JP"}, - {CTRY_JAPAN50, MKK12_MKKA, "JP"}, - {CTRY_JAPAN51, MKK12_FCCA, "JP"}, - {CTRY_JAPAN52, MKK12_MKKA1, "JP"}, - {CTRY_JAPAN53, MKK12_MKKC, "JP"}, - {CTRY_JAPAN54, MKK12_MKKA2, "JP"}, - {CTRY_JAPAN57, MKK13_MKKB, "JP"}, - {CTRY_JAPAN58, MKK14_MKKA1, "JP"}, - {CTRY_JAPAN59, MKK15_MKKA1, "JP"}, - - {CTRY_JORDAN, ETSI2_WORLD, "JO"}, - {CTRY_KAZAKHSTAN, NULL1_WORLD, "KZ"}, - {CTRY_KOREA_NORTH, APL9_WORLD, "KP"}, - {CTRY_KOREA_ROC, APL9_WORLD, "KR"}, - {CTRY_KOREA_ROC2, APL2_WORLD, "K2"}, - {CTRY_KOREA_ROC3, APL9_WORLD, "K3"}, - {CTRY_KUWAIT, ETSI3_WORLD, "KW"}, - {CTRY_LATVIA, ETSI1_WORLD, "LV"}, - {CTRY_LEBANON, NULL1_WORLD, "LB"}, - {CTRY_LIECHTENSTEIN, ETSI1_WORLD, "LI"}, - {CTRY_LITHUANIA, ETSI1_WORLD, "LT"}, - {CTRY_LUXEMBOURG, ETSI1_WORLD, "LU"}, - {CTRY_MACAU, FCC2_WORLD, "MO"}, - {CTRY_MACEDONIA, NULL1_WORLD, "MK"}, - {CTRY_MALAYSIA, APL8_WORLD, "MY"}, - {CTRY_MALTA, ETSI1_WORLD, "MT"}, - {CTRY_MEXICO, FCC1_FCCA, "MX"}, - {CTRY_MONACO, ETSI4_WORLD, "MC"}, - {CTRY_MOROCCO, APL4_WORLD, "MA"}, - {CTRY_NEPAL, APL1_WORLD, "NP"}, - {CTRY_NETHERLANDS, ETSI1_WORLD, "NL"}, - {CTRY_NETHERLANDS_ANTILLES, ETSI1_WORLD, "AN"}, - {CTRY_NEW_ZEALAND, FCC2_ETSIC, "NZ"}, - {CTRY_NORWAY, ETSI1_WORLD, "NO"}, - {CTRY_OMAN, FCC3_WORLD, "OM"}, - {CTRY_PAKISTAN, NULL1_WORLD, "PK"}, - {CTRY_PANAMA, FCC1_FCCA, "PA"}, - {CTRY_PAPUA_NEW_GUINEA, FCC1_WORLD, "PG"}, - {CTRY_PERU, APL1_WORLD, "PE"}, - {CTRY_PHILIPPINES, APL1_WORLD, "PH"}, - {CTRY_POLAND, ETSI1_WORLD, "PL"}, - {CTRY_PORTUGAL, ETSI1_WORLD, "PT"}, - {CTRY_PUERTO_RICO, FCC1_FCCA, "PR"}, - {CTRY_QATAR, APL1_WORLD, "QA"}, - {CTRY_ROMANIA, NULL1_WORLD, "RO"}, - {CTRY_RUSSIA, NULL1_WORLD, "RU"}, - {CTRY_SAUDI_ARABIA, NULL1_WORLD, "SA"}, - {CTRY_SERBIA_MONTENEGRO, ETSI1_WORLD, "CS"}, - {CTRY_SINGAPORE, APL6_WORLD, "SG"}, - {CTRY_SLOVAKIA, ETSI1_WORLD, "SK"}, - {CTRY_SLOVENIA, ETSI1_WORLD, "SI"}, - {CTRY_SOUTH_AFRICA, FCC3_WORLD, "ZA"}, - {CTRY_SPAIN, ETSI1_WORLD, "ES"}, - {CTRY_SRI_LANKA, FCC3_WORLD, "LK"}, - {CTRY_SWEDEN, ETSI1_WORLD, "SE"}, - {CTRY_SWITZERLAND, ETSI1_WORLD, "CH"}, - {CTRY_SYRIA, NULL1_WORLD, "SY"}, - {CTRY_TAIWAN, APL3_FCCA, "TW"}, - {CTRY_THAILAND, FCC3_WORLD, "TH"}, - {CTRY_TRINIDAD_Y_TOBAGO, FCC3_WORLD, "TT"}, - {CTRY_TUNISIA, ETSI3_WORLD, "TN"}, - {CTRY_TURKEY, ETSI3_WORLD, "TR"}, - {CTRY_UKRAINE, NULL1_WORLD, "UA"}, - {CTRY_UAE, NULL1_WORLD, "AE"}, - {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"}, - {CTRY_UNITED_STATES, FCC3_FCCA, "US"}, - /* This "PS" is for US public safety actually... to support this we - * would need to assign new special alpha2 to CRDA db as with the world - * regdomain and use another alpha2 */ - {CTRY_UNITED_STATES_FCC49, FCC4_FCCA, "PS"}, - {CTRY_URUGUAY, FCC3_WORLD, "UY"}, - {CTRY_UZBEKISTAN, FCC3_FCCA, "UZ"}, - {CTRY_VENEZUELA, APL2_ETSIC, "VE"}, - {CTRY_VIET_NAM, NULL1_WORLD, "VN"}, - {CTRY_YEMEN, NULL1_WORLD, "YE"}, - {CTRY_ZIMBABWE, NULL1_WORLD, "ZW"}, -}; - -#endif diff --git a/drivers/net/wireless/ath/wil6210/Kconfig b/drivers/net/wireless/ath/wil6210/Kconfig deleted file mode 100644 index bac3d98a0cfb..000000000000 --- a/drivers/net/wireless/ath/wil6210/Kconfig +++ /dev/null @@ -1,29 +0,0 @@ -config WIL6210 - tristate "Wilocity 60g WiFi card wil6210 support" - depends on CFG80211 - depends on PCI - default n - ---help--- - This module adds support for wireless adapter based on - wil6210 chip by Wilocity. It supports operation on the - 60 GHz band, covered by the IEEE802.11ad standard. - - http://wireless.kernel.org/en/users/Drivers/wil6210 - - If you choose to build it as a module, it will be called - wil6210 - -config WIL6210_ISR_COR - bool "Use Clear-On-Read mode for ISR registers for wil6210" - depends on WIL6210 - default y - ---help--- - ISR registers on wil6210 chip may operate in either - COR (Clear-On-Read) or W1C (Write-1-to-Clear) mode. - For production code, use COR (say y); is default since - it saves extra target transaction; - For ISR debug, use W1C (say n); is allows to monitor ISR - registers with debugfs. If COR were used, ISR would - self-clear when accessed for debug purposes, it makes - such monitoring impossible. - Say y unless you debug interrupts diff --git a/drivers/net/wireless/ath/wil6210/Makefile b/drivers/net/wireless/ath/wil6210/Makefile deleted file mode 100644 index d288eea0a26a..000000000000 --- a/drivers/net/wireless/ath/wil6210/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -obj-$(CONFIG_WIL6210) += wil6210.o - -wil6210-objs := main.o -wil6210-objs += netdev.o -wil6210-objs += cfg80211.o -wil6210-objs += pcie_bus.o -wil6210-objs += debugfs.o -wil6210-objs += wmi.o -wil6210-objs += interrupt.o -wil6210-objs += txrx.o - -ifeq (, $(findstring -W,$(EXTRA_CFLAGS))) - subdir-ccflags-y += -Werror -endif -subdir-ccflags-y += -D__CHECK_ENDIAN__ diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c deleted file mode 100644 index c5d4a87abaaf..000000000000 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ /dev/null @@ -1,561 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "wil6210.h" -#include "wmi.h" - -#define CHAN60G(_channel, _flags) { \ - .band = IEEE80211_BAND_60GHZ, \ - .center_freq = 56160 + (2160 * (_channel)), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 40, \ -} - -static struct ieee80211_channel wil_60ghz_channels[] = { - CHAN60G(1, 0), - CHAN60G(2, 0), - CHAN60G(3, 0), -/* channel 4 not supported yet */ -}; - -static struct ieee80211_supported_band wil_band_60ghz = { - .channels = wil_60ghz_channels, - .n_channels = ARRAY_SIZE(wil_60ghz_channels), - .ht_cap = { - .ht_supported = true, - .cap = 0, /* TODO */ - .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, /* TODO */ - .ampdu_density = IEEE80211_HT_MPDU_DENSITY_8, /* TODO */ - .mcs = { - /* MCS 1..12 - SC PHY */ - .rx_mask = {0xfe, 0x1f}, /* 1..12 */ - .tx_params = IEEE80211_HT_MCS_TX_DEFINED, /* TODO */ - }, - }, -}; - -static const struct ieee80211_txrx_stypes -wil_mgmt_stypes[NUM_NL80211_IFTYPES] = { - [NL80211_IFTYPE_STATION] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_AP] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_P2P_CLIENT] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_P2P_GO] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, -}; - -static const u32 wil_cipher_suites[] = { - WLAN_CIPHER_SUITE_GCMP, -}; - -int wil_iftype_nl2wmi(enum nl80211_iftype type) -{ - static const struct { - enum nl80211_iftype nl; - enum wmi_network_type wmi; - } __nl2wmi[] = { - {NL80211_IFTYPE_ADHOC, WMI_NETTYPE_ADHOC}, - {NL80211_IFTYPE_STATION, WMI_NETTYPE_INFRA}, - {NL80211_IFTYPE_AP, WMI_NETTYPE_AP}, - {NL80211_IFTYPE_P2P_CLIENT, WMI_NETTYPE_P2P}, - {NL80211_IFTYPE_P2P_GO, WMI_NETTYPE_P2P}, - {NL80211_IFTYPE_MONITOR, WMI_NETTYPE_ADHOC}, /* FIXME */ - }; - uint i; - - for (i = 0; i < ARRAY_SIZE(__nl2wmi); i++) { - if (__nl2wmi[i].nl == type) - return __nl2wmi[i].wmi; - } - - return -EOPNOTSUPP; -} - -static int wil_cfg80211_get_station(struct wiphy *wiphy, - struct net_device *ndev, - u8 *mac, struct station_info *sinfo) -{ - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - int rc; - struct wmi_notify_req_cmd cmd = { - .cid = 0, - .interval_usec = 0, - }; - - if (memcmp(mac, wil->dst_addr[0], ETH_ALEN)) - return -ENOENT; - - /* WMI_NOTIFY_REQ_DONE_EVENTID handler fills wil->stats.bf_mcs */ - rc = wmi_call(wil, WMI_NOTIFY_REQ_CMDID, &cmd, sizeof(cmd), - WMI_NOTIFY_REQ_DONE_EVENTID, NULL, 0, 20); - if (rc) - return rc; - - sinfo->generation = wil->sinfo_gen; - - sinfo->filled |= STATION_INFO_TX_BITRATE; - sinfo->txrate.flags = RATE_INFO_FLAGS_MCS | RATE_INFO_FLAGS_60G; - sinfo->txrate.mcs = wil->stats.bf_mcs; - sinfo->filled |= STATION_INFO_RX_BITRATE; - sinfo->rxrate.flags = RATE_INFO_FLAGS_MCS | RATE_INFO_FLAGS_60G; - sinfo->rxrate.mcs = wil->stats.last_mcs_rx; - - if (test_bit(wil_status_fwconnected, &wil->status)) { - sinfo->filled |= STATION_INFO_SIGNAL; - sinfo->signal = 12; /* TODO: provide real value */ - } - - return 0; -} - -static int wil_cfg80211_change_iface(struct wiphy *wiphy, - struct net_device *ndev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -{ - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - struct wireless_dev *wdev = wil->wdev; - - switch (type) { - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_P2P_GO: - break; - case NL80211_IFTYPE_MONITOR: - if (flags) - wil->monitor_flags = *flags; - else - wil->monitor_flags = 0; - - break; - default: - return -EOPNOTSUPP; - } - - wdev->iftype = type; - - return 0; -} - -static int wil_cfg80211_scan(struct wiphy *wiphy, - struct cfg80211_scan_request *request) -{ - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - struct wireless_dev *wdev = wil->wdev; - struct { - struct wmi_start_scan_cmd cmd; - u16 chnl[4]; - } __packed cmd; - uint i, n; - - if (wil->scan_request) { - wil_err(wil, "Already scanning\n"); - return -EAGAIN; - } - - /* check we are client side */ - switch (wdev->iftype) { - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_P2P_CLIENT: - break; - default: - return -EOPNOTSUPP; - } - - /* FW don't support scan after connection attempt */ - if (test_bit(wil_status_dontscan, &wil->status)) { - wil_err(wil, "Scan after connect attempt not supported\n"); - return -EBUSY; - } - - wil->scan_request = request; - - memset(&cmd, 0, sizeof(cmd)); - cmd.cmd.num_channels = 0; - n = min(request->n_channels, 4U); - for (i = 0; i < n; i++) { - int ch = request->channels[i]->hw_value; - if (ch == 0) { - wil_err(wil, - "Scan requested for unknown frequency %dMhz\n", - request->channels[i]->center_freq); - continue; - } - /* 0-based channel indexes */ - cmd.cmd.channel_list[cmd.cmd.num_channels++].channel = ch - 1; - wil_dbg_misc(wil, "Scan for ch %d : %d MHz\n", ch, - request->channels[i]->center_freq); - } - - return wmi_send(wil, WMI_START_SCAN_CMDID, &cmd, sizeof(cmd.cmd) + - cmd.cmd.num_channels * sizeof(cmd.cmd.channel_list[0])); -} - -static int wil_cfg80211_connect(struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_connect_params *sme) -{ - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - struct cfg80211_bss *bss; - struct wmi_connect_cmd conn; - const u8 *ssid_eid; - const u8 *rsn_eid; - int ch; - int rc = 0; - - bss = cfg80211_get_bss(wiphy, sme->channel, sme->bssid, - sme->ssid, sme->ssid_len, - WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); - if (!bss) { - wil_err(wil, "Unable to find BSS\n"); - return -ENOENT; - } - - ssid_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SSID); - if (!ssid_eid) { - wil_err(wil, "No SSID\n"); - rc = -ENOENT; - goto out; - } - - rsn_eid = sme->ie ? - cfg80211_find_ie(WLAN_EID_RSN, sme->ie, sme->ie_len) : - NULL; - if (rsn_eid) { - if (sme->ie_len > WMI_MAX_IE_LEN) { - rc = -ERANGE; - wil_err(wil, "IE too large (%td bytes)\n", - sme->ie_len); - goto out; - } - /* - * For secure assoc, send: - * (1) WMI_DELETE_CIPHER_KEY_CMD - * (2) WMI_SET_APPIE_CMD - */ - rc = wmi_del_cipher_key(wil, 0, bss->bssid); - if (rc) { - wil_err(wil, "WMI_DELETE_CIPHER_KEY_CMD failed\n"); - goto out; - } - /* WMI_SET_APPIE_CMD */ - rc = wmi_set_ie(wil, WMI_FRAME_ASSOC_REQ, sme->ie_len, sme->ie); - if (rc) { - wil_err(wil, "WMI_SET_APPIE_CMD failed\n"); - goto out; - } - } - - /* WMI_CONNECT_CMD */ - memset(&conn, 0, sizeof(conn)); - switch (bss->capability & WLAN_CAPABILITY_DMG_TYPE_MASK) { - case WLAN_CAPABILITY_DMG_TYPE_AP: - conn.network_type = WMI_NETTYPE_INFRA; - break; - case WLAN_CAPABILITY_DMG_TYPE_PBSS: - conn.network_type = WMI_NETTYPE_P2P; - break; - default: - wil_err(wil, "Unsupported BSS type, capability= 0x%04x\n", - bss->capability); - goto out; - } - if (rsn_eid) { - conn.dot11_auth_mode = WMI_AUTH11_SHARED; - conn.auth_mode = WMI_AUTH_WPA2_PSK; - conn.pairwise_crypto_type = WMI_CRYPT_AES_GCMP; - conn.pairwise_crypto_len = 16; - } else { - conn.dot11_auth_mode = WMI_AUTH11_OPEN; - conn.auth_mode = WMI_AUTH_NONE; - } - - conn.ssid_len = min_t(u8, ssid_eid[1], 32); - memcpy(conn.ssid, ssid_eid+2, conn.ssid_len); - - ch = bss->channel->hw_value; - if (ch == 0) { - wil_err(wil, "BSS at unknown frequency %dMhz\n", - bss->channel->center_freq); - rc = -EOPNOTSUPP; - goto out; - } - conn.channel = ch - 1; - - memcpy(conn.bssid, bss->bssid, 6); - memcpy(conn.dst_mac, bss->bssid, 6); - /* - * FW don't support scan after connection attempt - */ - set_bit(wil_status_dontscan, &wil->status); - - rc = wmi_send(wil, WMI_CONNECT_CMDID, &conn, sizeof(conn)); - if (rc == 0) { - /* Connect can take lots of time */ - mod_timer(&wil->connect_timer, - jiffies + msecs_to_jiffies(2000)); - } - - out: - cfg80211_put_bss(wiphy, bss); - - return rc; -} - -static int wil_cfg80211_disconnect(struct wiphy *wiphy, - struct net_device *ndev, - u16 reason_code) -{ - int rc; - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - - rc = wmi_send(wil, WMI_DISCONNECT_CMDID, NULL, 0); - - return rc; -} - -static int wil_cfg80211_set_channel(struct wiphy *wiphy, - struct cfg80211_chan_def *chandef) -{ - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - struct wireless_dev *wdev = wil->wdev; - - wdev->preset_chandef = *chandef; - - return 0; -} - -static int wil_cfg80211_add_key(struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, bool pairwise, - const u8 *mac_addr, - struct key_params *params) -{ - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - - /* group key is not used */ - if (!pairwise) - return 0; - - return wmi_add_cipher_key(wil, key_index, mac_addr, - params->key_len, params->key); -} - -static int wil_cfg80211_del_key(struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, bool pairwise, - const u8 *mac_addr) -{ - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - - /* group key is not used */ - if (!pairwise) - return 0; - - return wmi_del_cipher_key(wil, key_index, mac_addr); -} - -/* Need to be present or wiphy_new() will WARN */ -static int wil_cfg80211_set_default_key(struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, bool unicast, - bool multicast) -{ - return 0; -} - -static int wil_cfg80211_start_ap(struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_ap_settings *info) -{ - int rc = 0; - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - struct wireless_dev *wdev = ndev->ieee80211_ptr; - struct ieee80211_channel *channel = info->chandef.chan; - struct cfg80211_beacon_data *bcon = &info->beacon; - u8 wmi_nettype = wil_iftype_nl2wmi(wdev->iftype); - - if (!channel) { - wil_err(wil, "AP: No channel???\n"); - return -EINVAL; - } - - wil_dbg_misc(wil, "AP on Channel %d %d MHz, %s\n", channel->hw_value, - channel->center_freq, info->privacy ? "secure" : "open"); - print_hex_dump_bytes("SSID ", DUMP_PREFIX_OFFSET, - info->ssid, info->ssid_len); - - rc = wil_reset(wil); - if (rc) - return rc; - - rc = wmi_set_ssid(wil, info->ssid_len, info->ssid); - if (rc) - return rc; - - /* MAC address - pre-requisite for other commands */ - wmi_set_mac_address(wil, ndev->dev_addr); - - /* IE's */ - /* bcon 'head IE's are not relevant for 60g band */ - /* - * FW do not form regular beacon, so bcon IE's are not set - * For the DMG bcon, when it will be supported, bcon IE's will - * be reused; add something like: - * wmi_set_ie(wil, WMI_FRAME_BEACON, bcon->beacon_ies_len, - * bcon->beacon_ies); - */ - wmi_set_ie(wil, WMI_FRAME_PROBE_RESP, bcon->proberesp_ies_len, - bcon->proberesp_ies); - wmi_set_ie(wil, WMI_FRAME_ASSOC_RESP, bcon->assocresp_ies_len, - bcon->assocresp_ies); - - wil->secure_pcp = info->privacy; - - rc = wmi_pcp_start(wil, info->beacon_interval, wmi_nettype, - channel->hw_value); - if (rc) - return rc; - - /* Rx VRING. After MAC and beacon */ - rc = wil_rx_init(wil); - - netif_carrier_on(ndev); - - return rc; -} - -static int wil_cfg80211_stop_ap(struct wiphy *wiphy, - struct net_device *ndev) -{ - int rc = 0; - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - - rc = wmi_pcp_stop(wil); - - return rc; -} - -static struct cfg80211_ops wil_cfg80211_ops = { - .scan = wil_cfg80211_scan, - .connect = wil_cfg80211_connect, - .disconnect = wil_cfg80211_disconnect, - .change_virtual_intf = wil_cfg80211_change_iface, - .get_station = wil_cfg80211_get_station, - .set_monitor_channel = wil_cfg80211_set_channel, - .add_key = wil_cfg80211_add_key, - .del_key = wil_cfg80211_del_key, - .set_default_key = wil_cfg80211_set_default_key, - /* AP mode */ - .start_ap = wil_cfg80211_start_ap, - .stop_ap = wil_cfg80211_stop_ap, -}; - -static void wil_wiphy_init(struct wiphy *wiphy) -{ - /* TODO: set real value */ - wiphy->max_scan_ssids = 10; - wiphy->max_num_pmkids = 0 /* TODO: */; - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_MONITOR); - /* TODO: enable P2P when integrated with supplicant: - * BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO) - */ - wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME | - WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD; - dev_warn(wiphy_dev(wiphy), "%s : flags = 0x%08x\n", - __func__, wiphy->flags); - wiphy->probe_resp_offload = - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS | - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 | - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P; - - wiphy->bands[IEEE80211_BAND_60GHZ] = &wil_band_60ghz; - - /* TODO: figure this out */ - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - - wiphy->cipher_suites = wil_cipher_suites; - wiphy->n_cipher_suites = ARRAY_SIZE(wil_cipher_suites); - wiphy->mgmt_stypes = wil_mgmt_stypes; -} - -struct wireless_dev *wil_cfg80211_init(struct device *dev) -{ - int rc = 0; - struct wireless_dev *wdev; - - wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); - if (!wdev) - return ERR_PTR(-ENOMEM); - - wdev->wiphy = wiphy_new(&wil_cfg80211_ops, - sizeof(struct wil6210_priv)); - if (!wdev->wiphy) { - rc = -ENOMEM; - goto out; - } - - set_wiphy_dev(wdev->wiphy, dev); - wil_wiphy_init(wdev->wiphy); - - rc = wiphy_register(wdev->wiphy); - if (rc < 0) - goto out_failed_reg; - - return wdev; - -out_failed_reg: - wiphy_free(wdev->wiphy); -out: - kfree(wdev); - - return ERR_PTR(rc); -} - -void wil_wdev_free(struct wil6210_priv *wil) -{ - struct wireless_dev *wdev = wil_to_wdev(wil); - - if (!wdev) - return; - - wiphy_unregister(wdev->wiphy); - wiphy_free(wdev->wiphy); - kfree(wdev); -} diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c deleted file mode 100644 index d57e5be32ee0..000000000000 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ /dev/null @@ -1,639 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include - -#include "wil6210.h" -#include "txrx.h" - -/* Nasty hack. Better have per device instances */ -static u32 mem_addr; -static u32 dbg_txdesc_index; - -static void wil_print_vring(struct seq_file *s, struct wil6210_priv *wil, - const char *name, struct vring *vring) -{ - void __iomem *x = wmi_addr(wil, vring->hwtail); - - seq_printf(s, "VRING %s = {\n", name); - seq_printf(s, " pa = 0x%016llx\n", (unsigned long long)vring->pa); - seq_printf(s, " va = 0x%p\n", vring->va); - seq_printf(s, " size = %d\n", vring->size); - seq_printf(s, " swtail = %d\n", vring->swtail); - seq_printf(s, " swhead = %d\n", vring->swhead); - seq_printf(s, " hwtail = [0x%08x] -> ", vring->hwtail); - if (x) - seq_printf(s, "0x%08x\n", ioread32(x)); - else - seq_printf(s, "???\n"); - - if (vring->va && (vring->size < 1025)) { - uint i; - for (i = 0; i < vring->size; i++) { - volatile struct vring_tx_desc *d = &vring->va[i].tx; - if ((i % 64) == 0 && (i != 0)) - seq_printf(s, "\n"); - seq_printf(s, "%s", (d->dma.status & BIT(0)) ? - "S" : (vring->ctx[i] ? "H" : "h")); - } - seq_printf(s, "\n"); - } - seq_printf(s, "}\n"); -} - -static int wil_vring_debugfs_show(struct seq_file *s, void *data) -{ - uint i; - struct wil6210_priv *wil = s->private; - - wil_print_vring(s, wil, "rx", &wil->vring_rx); - - for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) { - struct vring *vring = &(wil->vring_tx[i]); - if (vring->va) { - char name[10]; - snprintf(name, sizeof(name), "tx_%2d", i); - wil_print_vring(s, wil, name, vring); - } - } - - return 0; -} - -static int wil_vring_seq_open(struct inode *inode, struct file *file) -{ - return single_open(file, wil_vring_debugfs_show, inode->i_private); -} - -static const struct file_operations fops_vring = { - .open = wil_vring_seq_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek, -}; - -static void wil_print_ring(struct seq_file *s, const char *prefix, - void __iomem *off) -{ - struct wil6210_priv *wil = s->private; - struct wil6210_mbox_ring r; - int rsize; - uint i; - - wil_memcpy_fromio_32(&r, off, sizeof(r)); - wil_mbox_ring_le2cpus(&r); - /* - * we just read memory block from NIC. This memory may be - * garbage. Check validity before using it. - */ - rsize = r.size / sizeof(struct wil6210_mbox_ring_desc); - - seq_printf(s, "ring %s = {\n", prefix); - seq_printf(s, " base = 0x%08x\n", r.base); - seq_printf(s, " size = 0x%04x bytes -> %d entries\n", r.size, rsize); - seq_printf(s, " tail = 0x%08x\n", r.tail); - seq_printf(s, " head = 0x%08x\n", r.head); - seq_printf(s, " entry size = %d\n", r.entry_size); - - if (r.size % sizeof(struct wil6210_mbox_ring_desc)) { - seq_printf(s, " ??? size is not multiple of %zd, garbage?\n", - sizeof(struct wil6210_mbox_ring_desc)); - goto out; - } - - if (!wmi_addr(wil, r.base) || - !wmi_addr(wil, r.tail) || - !wmi_addr(wil, r.head)) { - seq_printf(s, " ??? pointers are garbage?\n"); - goto out; - } - - for (i = 0; i < rsize; i++) { - struct wil6210_mbox_ring_desc d; - struct wil6210_mbox_hdr hdr; - size_t delta = i * sizeof(d); - void __iomem *x = wil->csr + HOSTADDR(r.base) + delta; - - wil_memcpy_fromio_32(&d, x, sizeof(d)); - - seq_printf(s, " [%2x] %s %s%s 0x%08x", i, - d.sync ? "F" : "E", - (r.tail - r.base == delta) ? "t" : " ", - (r.head - r.base == delta) ? "h" : " ", - le32_to_cpu(d.addr)); - if (0 == wmi_read_hdr(wil, d.addr, &hdr)) { - u16 len = le16_to_cpu(hdr.len); - seq_printf(s, " -> %04x %04x %04x %02x\n", - le16_to_cpu(hdr.seq), len, - le16_to_cpu(hdr.type), hdr.flags); - if (len <= MAX_MBOXITEM_SIZE) { - int n = 0; - char printbuf[16 * 3 + 2]; - unsigned char databuf[MAX_MBOXITEM_SIZE]; - void __iomem *src = wmi_buffer(wil, d.addr) + - sizeof(struct wil6210_mbox_hdr); - /* - * No need to check @src for validity - - * we already validated @d.addr while - * reading header - */ - wil_memcpy_fromio_32(databuf, src, len); - while (n < len) { - int l = min(len - n, 16); - hex_dump_to_buffer(databuf + n, l, - 16, 1, printbuf, - sizeof(printbuf), - false); - seq_printf(s, " : %s\n", printbuf); - n += l; - } - } - } else { - seq_printf(s, "\n"); - } - } - out: - seq_printf(s, "}\n"); -} - -static int wil_mbox_debugfs_show(struct seq_file *s, void *data) -{ - struct wil6210_priv *wil = s->private; - - wil_print_ring(s, "tx", wil->csr + HOST_MBOX + - offsetof(struct wil6210_mbox_ctl, tx)); - wil_print_ring(s, "rx", wil->csr + HOST_MBOX + - offsetof(struct wil6210_mbox_ctl, rx)); - - return 0; -} - -static int wil_mbox_seq_open(struct inode *inode, struct file *file) -{ - return single_open(file, wil_mbox_debugfs_show, inode->i_private); -} - -static const struct file_operations fops_mbox = { - .open = wil_mbox_seq_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek, -}; - -static int wil_debugfs_iomem_x32_set(void *data, u64 val) -{ - iowrite32(val, (void __iomem *)data); - wmb(); /* make sure write propagated to HW */ - - return 0; -} - -static int wil_debugfs_iomem_x32_get(void *data, u64 *val) -{ - *val = ioread32((void __iomem *)data); - - return 0; -} - -DEFINE_SIMPLE_ATTRIBUTE(fops_iomem_x32, wil_debugfs_iomem_x32_get, - wil_debugfs_iomem_x32_set, "0x%08llx\n"); - -static struct dentry *wil_debugfs_create_iomem_x32(const char *name, - umode_t mode, - struct dentry *parent, - void __iomem *value) -{ - return debugfs_create_file(name, mode, parent, (void * __force)value, - &fops_iomem_x32); -} - -static int wil6210_debugfs_create_ISR(struct wil6210_priv *wil, - const char *name, - struct dentry *parent, u32 off) -{ - struct dentry *d = debugfs_create_dir(name, parent); - - if (IS_ERR_OR_NULL(d)) - return -ENODEV; - - wil_debugfs_create_iomem_x32("ICC", S_IRUGO | S_IWUSR, d, - wil->csr + off); - wil_debugfs_create_iomem_x32("ICR", S_IRUGO | S_IWUSR, d, - wil->csr + off + 4); - wil_debugfs_create_iomem_x32("ICM", S_IRUGO | S_IWUSR, d, - wil->csr + off + 8); - wil_debugfs_create_iomem_x32("ICS", S_IWUSR, d, - wil->csr + off + 12); - wil_debugfs_create_iomem_x32("IMV", S_IRUGO | S_IWUSR, d, - wil->csr + off + 16); - wil_debugfs_create_iomem_x32("IMS", S_IWUSR, d, - wil->csr + off + 20); - wil_debugfs_create_iomem_x32("IMC", S_IWUSR, d, - wil->csr + off + 24); - - return 0; -} - -static int wil6210_debugfs_create_pseudo_ISR(struct wil6210_priv *wil, - struct dentry *parent) -{ - struct dentry *d = debugfs_create_dir("PSEUDO_ISR", parent); - - if (IS_ERR_OR_NULL(d)) - return -ENODEV; - - wil_debugfs_create_iomem_x32("CAUSE", S_IRUGO, d, wil->csr + - HOSTADDR(RGF_DMA_PSEUDO_CAUSE)); - wil_debugfs_create_iomem_x32("MASK_SW", S_IRUGO, d, wil->csr + - HOSTADDR(RGF_DMA_PSEUDO_CAUSE_MASK_SW)); - wil_debugfs_create_iomem_x32("MASK_FW", S_IRUGO, d, wil->csr + - HOSTADDR(RGF_DMA_PSEUDO_CAUSE_MASK_FW)); - - return 0; -} - -static int wil6210_debugfs_create_ITR_CNT(struct wil6210_priv *wil, - struct dentry *parent) -{ - struct dentry *d = debugfs_create_dir("ITR_CNT", parent); - - if (IS_ERR_OR_NULL(d)) - return -ENODEV; - - wil_debugfs_create_iomem_x32("TRSH", S_IRUGO, d, wil->csr + - HOSTADDR(RGF_DMA_ITR_CNT_TRSH)); - wil_debugfs_create_iomem_x32("DATA", S_IRUGO, d, wil->csr + - HOSTADDR(RGF_DMA_ITR_CNT_DATA)); - wil_debugfs_create_iomem_x32("CTL", S_IRUGO, d, wil->csr + - HOSTADDR(RGF_DMA_ITR_CNT_CRL)); - - return 0; -} - -static int wil_memread_debugfs_show(struct seq_file *s, void *data) -{ - struct wil6210_priv *wil = s->private; - void __iomem *a = wmi_buffer(wil, cpu_to_le32(mem_addr)); - - if (a) - seq_printf(s, "[0x%08x] = 0x%08x\n", mem_addr, ioread32(a)); - else - seq_printf(s, "[0x%08x] = INVALID\n", mem_addr); - - return 0; -} - -static int wil_memread_seq_open(struct inode *inode, struct file *file) -{ - return single_open(file, wil_memread_debugfs_show, inode->i_private); -} - -static const struct file_operations fops_memread = { - .open = wil_memread_seq_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek, -}; - -static ssize_t wil_read_file_ioblob(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - enum { max_count = 4096 }; - struct debugfs_blob_wrapper *blob = file->private_data; - loff_t pos = *ppos; - size_t available = blob->size; - void *buf; - size_t ret; - - if (pos < 0) - return -EINVAL; - - if (pos >= available || !count) - return 0; - - if (count > available - pos) - count = available - pos; - if (count > max_count) - count = max_count; - - buf = kmalloc(count, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - wil_memcpy_fromio_32(buf, (const volatile void __iomem *)blob->data + - pos, count); - - ret = copy_to_user(user_buf, buf, count); - kfree(buf); - if (ret == count) - return -EFAULT; - - count -= ret; - *ppos = pos + count; - - return count; -} - -static const struct file_operations fops_ioblob = { - .read = wil_read_file_ioblob, - .open = simple_open, - .llseek = default_llseek, -}; - -static -struct dentry *wil_debugfs_create_ioblob(const char *name, - umode_t mode, - struct dentry *parent, - struct debugfs_blob_wrapper *blob) -{ - return debugfs_create_file(name, mode, parent, blob, &fops_ioblob); -} -/*---reset---*/ -static ssize_t wil_write_file_reset(struct file *file, const char __user *buf, - size_t len, loff_t *ppos) -{ - struct wil6210_priv *wil = file->private_data; - struct net_device *ndev = wil_to_ndev(wil); - - /** - * BUG: - * this code does NOT sync device state with the rest of system - * use with care, debug only!!! - */ - rtnl_lock(); - dev_close(ndev); - ndev->flags &= ~IFF_UP; - rtnl_unlock(); - wil_reset(wil); - - return len; -} - -static const struct file_operations fops_reset = { - .write = wil_write_file_reset, - .open = simple_open, -}; -/*---------Tx descriptor------------*/ - -static int wil_txdesc_debugfs_show(struct seq_file *s, void *data) -{ - struct wil6210_priv *wil = s->private; - struct vring *vring = &(wil->vring_tx[0]); - - if (!vring->va) { - seq_printf(s, "No Tx VRING\n"); - return 0; - } - - if (dbg_txdesc_index < vring->size) { - volatile struct vring_tx_desc *d = - &(vring->va[dbg_txdesc_index].tx); - volatile u32 *u = (volatile u32 *)d; - struct sk_buff *skb = vring->ctx[dbg_txdesc_index]; - - seq_printf(s, "Tx[%3d] = {\n", dbg_txdesc_index); - seq_printf(s, " MAC = 0x%08x 0x%08x 0x%08x 0x%08x\n", - u[0], u[1], u[2], u[3]); - seq_printf(s, " DMA = 0x%08x 0x%08x 0x%08x 0x%08x\n", - u[4], u[5], u[6], u[7]); - seq_printf(s, " SKB = %p\n", skb); - - if (skb) { - char printbuf[16 * 3 + 2]; - int i = 0; - int len = skb_headlen(skb); - void *p = skb->data; - - seq_printf(s, " len = %d\n", len); - - while (i < len) { - int l = min(len - i, 16); - hex_dump_to_buffer(p + i, l, 16, 1, printbuf, - sizeof(printbuf), false); - seq_printf(s, " : %s\n", printbuf); - i += l; - } - } - seq_printf(s, "}\n"); - } else { - seq_printf(s, "TxDesc index (%d) >= size (%d)\n", - dbg_txdesc_index, vring->size); - } - - return 0; -} - -static int wil_txdesc_seq_open(struct inode *inode, struct file *file) -{ - return single_open(file, wil_txdesc_debugfs_show, inode->i_private); -} - -static const struct file_operations fops_txdesc = { - .open = wil_txdesc_seq_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek, -}; - -/*---------beamforming------------*/ -static int wil_bf_debugfs_show(struct seq_file *s, void *data) -{ - struct wil6210_priv *wil = s->private; - seq_printf(s, - "TSF : 0x%016llx\n" - "TxMCS : %d\n" - "Sectors(rx:tx) my %2d:%2d peer %2d:%2d\n", - wil->stats.tsf, wil->stats.bf_mcs, - wil->stats.my_rx_sector, wil->stats.my_tx_sector, - wil->stats.peer_rx_sector, wil->stats.peer_tx_sector); - return 0; -} - -static int wil_bf_seq_open(struct inode *inode, struct file *file) -{ - return single_open(file, wil_bf_debugfs_show, inode->i_private); -} - -static const struct file_operations fops_bf = { - .open = wil_bf_seq_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek, -}; -/*---------SSID------------*/ -static ssize_t wil_read_file_ssid(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wil6210_priv *wil = file->private_data; - struct wireless_dev *wdev = wil_to_wdev(wil); - - return simple_read_from_buffer(user_buf, count, ppos, - wdev->ssid, wdev->ssid_len); -} - -static ssize_t wil_write_file_ssid(struct file *file, const char __user *buf, - size_t count, loff_t *ppos) -{ - struct wil6210_priv *wil = file->private_data; - struct wireless_dev *wdev = wil_to_wdev(wil); - struct net_device *ndev = wil_to_ndev(wil); - - if (*ppos != 0) { - wil_err(wil, "Unable to set SSID substring from [%d]\n", - (int)*ppos); - return -EINVAL; - } - - if (count > sizeof(wdev->ssid)) { - wil_err(wil, "SSID too long, len = %d\n", (int)count); - return -EINVAL; - } - if (netif_running(ndev)) { - wil_err(wil, "Unable to change SSID on running interface\n"); - return -EINVAL; - } - - wdev->ssid_len = count; - return simple_write_to_buffer(wdev->ssid, wdev->ssid_len, ppos, - buf, count); -} - -static const struct file_operations fops_ssid = { - .read = wil_read_file_ssid, - .write = wil_write_file_ssid, - .open = simple_open, -}; - -/*---------temp------------*/ -static void print_temp(struct seq_file *s, const char *prefix, u32 t) -{ - switch (t) { - case 0: - case ~(u32)0: - seq_printf(s, "%s N/A\n", prefix); - break; - default: - seq_printf(s, "%s %d.%03d\n", prefix, t / 1000, t % 1000); - break; - } -} - -static int wil_temp_debugfs_show(struct seq_file *s, void *data) -{ - struct wil6210_priv *wil = s->private; - u32 t_m, t_r; - - int rc = wmi_get_temperature(wil, &t_m, &t_r); - if (rc) { - seq_printf(s, "Failed\n"); - return 0; - } - - print_temp(s, "MAC temperature :", t_m); - print_temp(s, "Radio temperature :", t_r); - - return 0; -} - -static int wil_temp_seq_open(struct inode *inode, struct file *file) -{ - return single_open(file, wil_temp_debugfs_show, inode->i_private); -} - -static const struct file_operations fops_temp = { - .open = wil_temp_seq_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek, -}; - -/*----------------*/ -int wil6210_debugfs_init(struct wil6210_priv *wil) -{ - struct dentry *dbg = wil->debug = debugfs_create_dir(WIL_NAME, - wil_to_wiphy(wil)->debugfsdir); - - if (IS_ERR_OR_NULL(dbg)) - return -ENODEV; - - debugfs_create_file("mbox", S_IRUGO, dbg, wil, &fops_mbox); - debugfs_create_file("vrings", S_IRUGO, dbg, wil, &fops_vring); - debugfs_create_file("txdesc", S_IRUGO, dbg, wil, &fops_txdesc); - debugfs_create_u32("txdesc_index", S_IRUGO | S_IWUSR, dbg, - &dbg_txdesc_index); - debugfs_create_file("bf", S_IRUGO, dbg, wil, &fops_bf); - debugfs_create_file("ssid", S_IRUGO | S_IWUSR, dbg, wil, &fops_ssid); - debugfs_create_u32("secure_pcp", S_IRUGO | S_IWUSR, dbg, - &wil->secure_pcp); - - wil6210_debugfs_create_ISR(wil, "USER_ICR", dbg, - HOSTADDR(RGF_USER_USER_ICR)); - wil6210_debugfs_create_ISR(wil, "DMA_EP_TX_ICR", dbg, - HOSTADDR(RGF_DMA_EP_TX_ICR)); - wil6210_debugfs_create_ISR(wil, "DMA_EP_RX_ICR", dbg, - HOSTADDR(RGF_DMA_EP_RX_ICR)); - wil6210_debugfs_create_ISR(wil, "DMA_EP_MISC_ICR", dbg, - HOSTADDR(RGF_DMA_EP_MISC_ICR)); - wil6210_debugfs_create_pseudo_ISR(wil, dbg); - wil6210_debugfs_create_ITR_CNT(wil, dbg); - - debugfs_create_u32("mem_addr", S_IRUGO | S_IWUSR, dbg, &mem_addr); - debugfs_create_file("mem_val", S_IRUGO, dbg, wil, &fops_memread); - - debugfs_create_file("reset", S_IWUSR, dbg, wil, &fops_reset); - debugfs_create_file("temp", S_IRUGO, dbg, wil, &fops_temp); - - wil->rgf_blob.data = (void * __force)wil->csr + 0; - wil->rgf_blob.size = 0xa000; - wil_debugfs_create_ioblob("blob_rgf", S_IRUGO, dbg, &wil->rgf_blob); - - wil->fw_code_blob.data = (void * __force)wil->csr + 0x40000; - wil->fw_code_blob.size = 0x40000; - wil_debugfs_create_ioblob("blob_fw_code", S_IRUGO, dbg, - &wil->fw_code_blob); - - wil->fw_data_blob.data = (void * __force)wil->csr + 0x80000; - wil->fw_data_blob.size = 0x8000; - wil_debugfs_create_ioblob("blob_fw_data", S_IRUGO, dbg, - &wil->fw_data_blob); - - wil->fw_peri_blob.data = (void * __force)wil->csr + 0x88000; - wil->fw_peri_blob.size = 0x18000; - wil_debugfs_create_ioblob("blob_fw_peri", S_IRUGO, dbg, - &wil->fw_peri_blob); - - wil->uc_code_blob.data = (void * __force)wil->csr + 0xa0000; - wil->uc_code_blob.size = 0x10000; - wil_debugfs_create_ioblob("blob_uc_code", S_IRUGO, dbg, - &wil->uc_code_blob); - - wil->uc_data_blob.data = (void * __force)wil->csr + 0xb0000; - wil->uc_data_blob.size = 0x4000; - wil_debugfs_create_ioblob("blob_uc_data", S_IRUGO, dbg, - &wil->uc_data_blob); - - return 0; -} - -void wil6210_debugfs_remove(struct wil6210_priv *wil) -{ - debugfs_remove_recursive(wil->debug); - wil->debug = NULL; -} diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c b/drivers/net/wireless/ath/wil6210/interrupt.c deleted file mode 100644 index e3c1e7684f9c..000000000000 --- a/drivers/net/wireless/ath/wil6210/interrupt.c +++ /dev/null @@ -1,509 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#include "wil6210.h" - -/** - * Theory of operation: - * - * There is ISR pseudo-cause register, - * dma_rgf->DMA_RGF.PSEUDO_CAUSE.PSEUDO_CAUSE - * Its bits represents OR'ed bits from 3 real ISR registers: - * TX, RX, and MISC. - * - * Registers may be configured to either "write 1 to clear" or - * "clear on read" mode - * - * When handling interrupt, one have to mask/unmask interrupts for the - * real ISR registers, or hardware may malfunction. - * - */ - -#define WIL6210_IRQ_DISABLE (0xFFFFFFFFUL) -#define WIL6210_IMC_RX BIT_DMA_EP_RX_ICR_RX_DONE -#define WIL6210_IMC_TX (BIT_DMA_EP_TX_ICR_TX_DONE | \ - BIT_DMA_EP_TX_ICR_TX_DONE_N(0)) -#define WIL6210_IMC_MISC (ISR_MISC_FW_READY | \ - ISR_MISC_MBOX_EVT | \ - ISR_MISC_FW_ERROR) - -#define WIL6210_IRQ_PSEUDO_MASK (u32)(~(BIT_DMA_PSEUDO_CAUSE_RX | \ - BIT_DMA_PSEUDO_CAUSE_TX | \ - BIT_DMA_PSEUDO_CAUSE_MISC)) - -#if defined(CONFIG_WIL6210_ISR_COR) -/* configure to Clear-On-Read mode */ -#define WIL_ICR_ICC_VALUE (0xFFFFFFFFUL) - -static inline void wil_icr_clear(u32 x, void __iomem *addr) -{ -} -#else /* defined(CONFIG_WIL6210_ISR_COR) */ -/* configure to Write-1-to-Clear mode */ -#define WIL_ICR_ICC_VALUE (0UL) - -static inline void wil_icr_clear(u32 x, void __iomem *addr) -{ - iowrite32(x, addr); -} -#endif /* defined(CONFIG_WIL6210_ISR_COR) */ - -static inline u32 wil_ioread32_and_clear(void __iomem *addr) -{ - u32 x = ioread32(addr); - - wil_icr_clear(x, addr); - - return x; -} - -static void wil6210_mask_irq_tx(struct wil6210_priv *wil) -{ - iowrite32(WIL6210_IRQ_DISABLE, wil->csr + - HOSTADDR(RGF_DMA_EP_TX_ICR) + - offsetof(struct RGF_ICR, IMS)); -} - -static void wil6210_mask_irq_rx(struct wil6210_priv *wil) -{ - iowrite32(WIL6210_IRQ_DISABLE, wil->csr + - HOSTADDR(RGF_DMA_EP_RX_ICR) + - offsetof(struct RGF_ICR, IMS)); -} - -static void wil6210_mask_irq_misc(struct wil6210_priv *wil) -{ - iowrite32(WIL6210_IRQ_DISABLE, wil->csr + - HOSTADDR(RGF_DMA_EP_MISC_ICR) + - offsetof(struct RGF_ICR, IMS)); -} - -static void wil6210_mask_irq_pseudo(struct wil6210_priv *wil) -{ - wil_dbg_irq(wil, "%s()\n", __func__); - - iowrite32(WIL6210_IRQ_DISABLE, wil->csr + - HOSTADDR(RGF_DMA_PSEUDO_CAUSE_MASK_SW)); - - clear_bit(wil_status_irqen, &wil->status); -} - -static void wil6210_unmask_irq_tx(struct wil6210_priv *wil) -{ - iowrite32(WIL6210_IMC_TX, wil->csr + - HOSTADDR(RGF_DMA_EP_TX_ICR) + - offsetof(struct RGF_ICR, IMC)); -} - -static void wil6210_unmask_irq_rx(struct wil6210_priv *wil) -{ - iowrite32(WIL6210_IMC_RX, wil->csr + - HOSTADDR(RGF_DMA_EP_RX_ICR) + - offsetof(struct RGF_ICR, IMC)); -} - -static void wil6210_unmask_irq_misc(struct wil6210_priv *wil) -{ - iowrite32(WIL6210_IMC_MISC, wil->csr + - HOSTADDR(RGF_DMA_EP_MISC_ICR) + - offsetof(struct RGF_ICR, IMC)); -} - -static void wil6210_unmask_irq_pseudo(struct wil6210_priv *wil) -{ - wil_dbg_irq(wil, "%s()\n", __func__); - - set_bit(wil_status_irqen, &wil->status); - - iowrite32(WIL6210_IRQ_PSEUDO_MASK, wil->csr + - HOSTADDR(RGF_DMA_PSEUDO_CAUSE_MASK_SW)); -} - -void wil6210_disable_irq(struct wil6210_priv *wil) -{ - wil_dbg_irq(wil, "%s()\n", __func__); - - wil6210_mask_irq_tx(wil); - wil6210_mask_irq_rx(wil); - wil6210_mask_irq_misc(wil); - wil6210_mask_irq_pseudo(wil); -} - -void wil6210_enable_irq(struct wil6210_priv *wil) -{ - wil_dbg_irq(wil, "%s()\n", __func__); - - iowrite32(WIL_ICR_ICC_VALUE, wil->csr + HOSTADDR(RGF_DMA_EP_RX_ICR) + - offsetof(struct RGF_ICR, ICC)); - iowrite32(WIL_ICR_ICC_VALUE, wil->csr + HOSTADDR(RGF_DMA_EP_TX_ICR) + - offsetof(struct RGF_ICR, ICC)); - iowrite32(WIL_ICR_ICC_VALUE, wil->csr + HOSTADDR(RGF_DMA_EP_MISC_ICR) + - offsetof(struct RGF_ICR, ICC)); - - wil6210_unmask_irq_pseudo(wil); - wil6210_unmask_irq_tx(wil); - wil6210_unmask_irq_rx(wil); - wil6210_unmask_irq_misc(wil); -} - -static irqreturn_t wil6210_irq_rx(int irq, void *cookie) -{ - struct wil6210_priv *wil = cookie; - u32 isr = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_RX_ICR) + - offsetof(struct RGF_ICR, ICR)); - - wil_dbg_irq(wil, "ISR RX 0x%08x\n", isr); - - if (!isr) { - wil_err(wil, "spurious IRQ: RX\n"); - return IRQ_NONE; - } - - wil6210_mask_irq_rx(wil); - - if (isr & BIT_DMA_EP_RX_ICR_RX_DONE) { - wil_dbg_irq(wil, "RX done\n"); - isr &= ~BIT_DMA_EP_RX_ICR_RX_DONE; - wil_rx_handle(wil); - } - - if (isr) - wil_err(wil, "un-handled RX ISR bits 0x%08x\n", isr); - - wil6210_unmask_irq_rx(wil); - - return IRQ_HANDLED; -} - -static irqreturn_t wil6210_irq_tx(int irq, void *cookie) -{ - struct wil6210_priv *wil = cookie; - u32 isr = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_TX_ICR) + - offsetof(struct RGF_ICR, ICR)); - - wil_dbg_irq(wil, "ISR TX 0x%08x\n", isr); - - if (!isr) { - wil_err(wil, "spurious IRQ: TX\n"); - return IRQ_NONE; - } - - wil6210_mask_irq_tx(wil); - - if (isr & BIT_DMA_EP_TX_ICR_TX_DONE) { - uint i; - wil_dbg_irq(wil, "TX done\n"); - isr &= ~BIT_DMA_EP_TX_ICR_TX_DONE; - for (i = 0; i < 24; i++) { - u32 mask = BIT_DMA_EP_TX_ICR_TX_DONE_N(i); - if (isr & mask) { - isr &= ~mask; - wil_dbg_irq(wil, "TX done(%i)\n", i); - wil_tx_complete(wil, i); - } - } - } - - if (isr) - wil_err(wil, "un-handled TX ISR bits 0x%08x\n", isr); - - wil6210_unmask_irq_tx(wil); - - return IRQ_HANDLED; -} - -static void wil_notify_fw_error(struct wil6210_priv *wil) -{ - struct device *dev = &wil_to_ndev(wil)->dev; - char *envp[3] = { - [0] = "SOURCE=wil6210", - [1] = "EVENT=FW_ERROR", - [2] = NULL, - }; - kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); -} - -static void wil_cache_mbox_regs(struct wil6210_priv *wil) -{ - /* make shadow copy of registers that should not change on run time */ - wil_memcpy_fromio_32(&wil->mbox_ctl, wil->csr + HOST_MBOX, - sizeof(struct wil6210_mbox_ctl)); - wil_mbox_ring_le2cpus(&wil->mbox_ctl.rx); - wil_mbox_ring_le2cpus(&wil->mbox_ctl.tx); -} - -static irqreturn_t wil6210_irq_misc(int irq, void *cookie) -{ - struct wil6210_priv *wil = cookie; - u32 isr = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_MISC_ICR) + - offsetof(struct RGF_ICR, ICR)); - - wil_dbg_irq(wil, "ISR MISC 0x%08x\n", isr); - - if (!isr) { - wil_err(wil, "spurious IRQ: MISC\n"); - return IRQ_NONE; - } - - wil6210_mask_irq_misc(wil); - - if (isr & ISR_MISC_FW_ERROR) { - wil_err(wil, "Firmware error detected\n"); - clear_bit(wil_status_fwready, &wil->status); - /* - * do not clear @isr here - we do 2-nd part in thread - * there, user space get notified, and it should be done - * in non-atomic context - */ - } - - if (isr & ISR_MISC_FW_READY) { - wil_dbg_irq(wil, "IRQ: FW ready\n"); - wil_cache_mbox_regs(wil); - set_bit(wil_status_reset_done, &wil->status); - /** - * Actual FW ready indicated by the - * WMI_FW_READY_EVENTID - */ - isr &= ~ISR_MISC_FW_READY; - } - - wil->isr_misc = isr; - - if (isr) { - return IRQ_WAKE_THREAD; - } else { - wil6210_unmask_irq_misc(wil); - return IRQ_HANDLED; - } -} - -static irqreturn_t wil6210_irq_misc_thread(int irq, void *cookie) -{ - struct wil6210_priv *wil = cookie; - u32 isr = wil->isr_misc; - - wil_dbg_irq(wil, "Thread ISR MISC 0x%08x\n", isr); - - if (isr & ISR_MISC_FW_ERROR) { - wil_notify_fw_error(wil); - isr &= ~ISR_MISC_FW_ERROR; - } - - if (isr & ISR_MISC_MBOX_EVT) { - wil_dbg_irq(wil, "MBOX event\n"); - wmi_recv_cmd(wil); - isr &= ~ISR_MISC_MBOX_EVT; - } - - if (isr) - wil_err(wil, "un-handled MISC ISR bits 0x%08x\n", isr); - - wil->isr_misc = 0; - - wil6210_unmask_irq_misc(wil); - - return IRQ_HANDLED; -} - -/** - * thread IRQ handler - */ -static irqreturn_t wil6210_thread_irq(int irq, void *cookie) -{ - struct wil6210_priv *wil = cookie; - - wil_dbg_irq(wil, "Thread IRQ\n"); - /* Discover real IRQ cause */ - if (wil->isr_misc) - wil6210_irq_misc_thread(irq, cookie); - - wil6210_unmask_irq_pseudo(wil); - - return IRQ_HANDLED; -} - -/* DEBUG - * There is subtle bug in hardware that causes IRQ to raise when it should be - * masked. It is quite rare and hard to debug. - * - * Catch irq issue if it happens and print all I can. - */ -static int wil6210_debug_irq_mask(struct wil6210_priv *wil, u32 pseudo_cause) -{ - if (!test_bit(wil_status_irqen, &wil->status)) { - u32 icm_rx = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_RX_ICR) + - offsetof(struct RGF_ICR, ICM)); - u32 icr_rx = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_RX_ICR) + - offsetof(struct RGF_ICR, ICR)); - u32 imv_rx = ioread32(wil->csr + - HOSTADDR(RGF_DMA_EP_RX_ICR) + - offsetof(struct RGF_ICR, IMV)); - u32 icm_tx = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_TX_ICR) + - offsetof(struct RGF_ICR, ICM)); - u32 icr_tx = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_TX_ICR) + - offsetof(struct RGF_ICR, ICR)); - u32 imv_tx = ioread32(wil->csr + - HOSTADDR(RGF_DMA_EP_TX_ICR) + - offsetof(struct RGF_ICR, IMV)); - u32 icm_misc = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_MISC_ICR) + - offsetof(struct RGF_ICR, ICM)); - u32 icr_misc = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_MISC_ICR) + - offsetof(struct RGF_ICR, ICR)); - u32 imv_misc = ioread32(wil->csr + - HOSTADDR(RGF_DMA_EP_MISC_ICR) + - offsetof(struct RGF_ICR, IMV)); - wil_err(wil, "IRQ when it should be masked: pseudo 0x%08x\n" - "Rx icm:icr:imv 0x%08x 0x%08x 0x%08x\n" - "Tx icm:icr:imv 0x%08x 0x%08x 0x%08x\n" - "Misc icm:icr:imv 0x%08x 0x%08x 0x%08x\n", - pseudo_cause, - icm_rx, icr_rx, imv_rx, - icm_tx, icr_tx, imv_tx, - icm_misc, icr_misc, imv_misc); - - return -EINVAL; - } - - return 0; -} - -static irqreturn_t wil6210_hardirq(int irq, void *cookie) -{ - irqreturn_t rc = IRQ_HANDLED; - struct wil6210_priv *wil = cookie; - u32 pseudo_cause = ioread32(wil->csr + HOSTADDR(RGF_DMA_PSEUDO_CAUSE)); - - /** - * pseudo_cause is Clear-On-Read, no need to ACK - */ - if ((pseudo_cause == 0) || ((pseudo_cause & 0xff) == 0xff)) - return IRQ_NONE; - - /* FIXME: IRQ mask debug */ - if (wil6210_debug_irq_mask(wil, pseudo_cause)) - return IRQ_NONE; - - wil_dbg_irq(wil, "Pseudo IRQ 0x%08x\n", pseudo_cause); - - wil6210_mask_irq_pseudo(wil); - - /* Discover real IRQ cause - * There are 2 possible phases for every IRQ: - * - hard IRQ handler called right here - * - threaded handler called later - * - * Hard IRQ handler reads and clears ISR. - * - * If threaded handler requested, hard IRQ handler - * returns IRQ_WAKE_THREAD and saves ISR register value - * for the threaded handler use. - * - * voting for wake thread - need at least 1 vote - */ - if ((pseudo_cause & BIT_DMA_PSEUDO_CAUSE_RX) && - (wil6210_irq_rx(irq, cookie) == IRQ_WAKE_THREAD)) - rc = IRQ_WAKE_THREAD; - - if ((pseudo_cause & BIT_DMA_PSEUDO_CAUSE_TX) && - (wil6210_irq_tx(irq, cookie) == IRQ_WAKE_THREAD)) - rc = IRQ_WAKE_THREAD; - - if ((pseudo_cause & BIT_DMA_PSEUDO_CAUSE_MISC) && - (wil6210_irq_misc(irq, cookie) == IRQ_WAKE_THREAD)) - rc = IRQ_WAKE_THREAD; - - /* if thread is requested, it will unmask IRQ */ - if (rc != IRQ_WAKE_THREAD) - wil6210_unmask_irq_pseudo(wil); - - return rc; -} - -static int wil6210_request_3msi(struct wil6210_priv *wil, int irq) -{ - int rc; - /* - * IRQ's are in the following order: - * - Tx - * - Rx - * - Misc - */ - - rc = request_irq(irq, wil6210_irq_tx, IRQF_SHARED, - WIL_NAME"_tx", wil); - if (rc) - return rc; - - rc = request_irq(irq + 1, wil6210_irq_rx, IRQF_SHARED, - WIL_NAME"_rx", wil); - if (rc) - goto free0; - - rc = request_threaded_irq(irq + 2, wil6210_irq_misc, - wil6210_irq_misc_thread, - IRQF_SHARED, WIL_NAME"_misc", wil); - if (rc) - goto free1; - - return 0; - /* error branch */ -free1: - free_irq(irq + 1, wil); -free0: - free_irq(irq, wil); - - return rc; -} - -int wil6210_init_irq(struct wil6210_priv *wil, int irq) -{ - int rc; - if (wil->n_msi == 3) - rc = wil6210_request_3msi(wil, irq); - else - rc = request_threaded_irq(irq, wil6210_hardirq, - wil6210_thread_irq, - wil->n_msi ? 0 : IRQF_SHARED, - WIL_NAME, wil); - if (rc) - return rc; - - wil6210_enable_irq(wil); - - return 0; -} - -void wil6210_fini_irq(struct wil6210_priv *wil, int irq) -{ - wil6210_disable_irq(wil); - free_irq(irq, wil); - if (wil->n_msi == 3) { - free_irq(irq + 1, wil); - free_irq(irq + 2, wil); - } -} diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c deleted file mode 100644 index a0478e2f6868..000000000000 --- a/drivers/net/wireless/ath/wil6210/main.c +++ /dev/null @@ -1,404 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -#include "wil6210.h" - -/* - * Due to a hardware issue, - * one has to read/write to/from NIC in 32-bit chunks; - * regular memcpy_fromio and siblings will - * not work on 64-bit platform - it uses 64-bit transactions - * - * Force 32-bit transactions to enable NIC on 64-bit platforms - * - * To avoid byte swap on big endian host, __raw_{read|write}l - * should be used - {read|write}l would swap bytes to provide - * little endian on PCI value in host endianness. - */ -void wil_memcpy_fromio_32(void *dst, const volatile void __iomem *src, - size_t count) -{ - u32 *d = dst; - const volatile u32 __iomem *s = src; - - /* size_t is unsigned, if (count%4 != 0) it will wrap */ - for (count += 4; count > 4; count -= 4) - *d++ = __raw_readl(s++); -} - -void wil_memcpy_toio_32(volatile void __iomem *dst, const void *src, - size_t count) -{ - volatile u32 __iomem *d = dst; - const u32 *s = src; - - for (count += 4; count > 4; count -= 4) - __raw_writel(*s++, d++); -} - -static void _wil6210_disconnect(struct wil6210_priv *wil, void *bssid) -{ - uint i; - struct net_device *ndev = wil_to_ndev(wil); - struct wireless_dev *wdev = wil->wdev; - - wil_dbg_misc(wil, "%s()\n", __func__); - - wil_link_off(wil); - clear_bit(wil_status_fwconnected, &wil->status); - - switch (wdev->sme_state) { - case CFG80211_SME_CONNECTED: - cfg80211_disconnected(ndev, WLAN_STATUS_UNSPECIFIED_FAILURE, - NULL, 0, GFP_KERNEL); - break; - case CFG80211_SME_CONNECTING: - cfg80211_connect_result(ndev, bssid, NULL, 0, NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, - GFP_KERNEL); - break; - default: - break; - } - - for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) - wil_vring_fini_tx(wil, i); - - clear_bit(wil_status_dontscan, &wil->status); -} - -static void wil_disconnect_worker(struct work_struct *work) -{ - struct wil6210_priv *wil = container_of(work, - struct wil6210_priv, disconnect_worker); - - _wil6210_disconnect(wil, NULL); -} - -static void wil_connect_timer_fn(ulong x) -{ - struct wil6210_priv *wil = (void *)x; - - wil_dbg_misc(wil, "Connect timeout\n"); - - /* reschedule to thread context - disconnect won't - * run from atomic context - */ - schedule_work(&wil->disconnect_worker); -} - -static void wil_connect_worker(struct work_struct *work) -{ - int rc; - struct wil6210_priv *wil = container_of(work, struct wil6210_priv, - connect_worker); - int cid = wil->pending_connect_cid; - - if (cid < 0) { - wil_err(wil, "No connection pending\n"); - return; - } - - wil_dbg_wmi(wil, "Configure for connection CID %d\n", cid); - - rc = wil_vring_init_tx(wil, 0, WIL6210_TX_RING_SIZE, cid, 0); - wil->pending_connect_cid = -1; - if (rc == 0) - wil_link_on(wil); -} - -int wil_priv_init(struct wil6210_priv *wil) -{ - wil_dbg_misc(wil, "%s()\n", __func__); - - mutex_init(&wil->mutex); - mutex_init(&wil->wmi_mutex); - - init_completion(&wil->wmi_ready); - - wil->pending_connect_cid = -1; - setup_timer(&wil->connect_timer, wil_connect_timer_fn, (ulong)wil); - - INIT_WORK(&wil->connect_worker, wil_connect_worker); - INIT_WORK(&wil->disconnect_worker, wil_disconnect_worker); - INIT_WORK(&wil->wmi_event_worker, wmi_event_worker); - - INIT_LIST_HEAD(&wil->pending_wmi_ev); - spin_lock_init(&wil->wmi_ev_lock); - - wil->wmi_wq = create_singlethread_workqueue(WIL_NAME"_wmi"); - if (!wil->wmi_wq) - return -EAGAIN; - - wil->wmi_wq_conn = create_singlethread_workqueue(WIL_NAME"_connect"); - if (!wil->wmi_wq_conn) { - destroy_workqueue(wil->wmi_wq); - return -EAGAIN; - } - - return 0; -} - -void wil6210_disconnect(struct wil6210_priv *wil, void *bssid) -{ - del_timer_sync(&wil->connect_timer); - _wil6210_disconnect(wil, bssid); -} - -void wil_priv_deinit(struct wil6210_priv *wil) -{ - cancel_work_sync(&wil->disconnect_worker); - wil6210_disconnect(wil, NULL); - wmi_event_flush(wil); - destroy_workqueue(wil->wmi_wq_conn); - destroy_workqueue(wil->wmi_wq); -} - -static void wil_target_reset(struct wil6210_priv *wil) -{ - wil_dbg_misc(wil, "Resetting...\n"); - - /* register write */ -#define W(a, v) iowrite32(v, wil->csr + HOSTADDR(a)) - /* register set = read, OR, write */ -#define S(a, v) iowrite32(ioread32(wil->csr + HOSTADDR(a)) | v, \ - wil->csr + HOSTADDR(a)) - - /* hpal_perst_from_pad_src_n_mask */ - S(RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT(6)); - /* car_perst_rst_src_n_mask */ - S(RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT(7)); - - W(RGF_USER_MAC_CPU_0, BIT(1)); /* mac_cpu_man_rst */ - W(RGF_USER_USER_CPU_0, BIT(1)); /* user_cpu_man_rst */ - - W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0xFE000000); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0x0000003F); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000170); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0xFFE7FC00); - - W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0); - - W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000001); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00000080); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0); - - wil_dbg_misc(wil, "Reset completed\n"); - -#undef W -#undef S -} - -void wil_mbox_ring_le2cpus(struct wil6210_mbox_ring *r) -{ - le32_to_cpus(&r->base); - le16_to_cpus(&r->entry_size); - le16_to_cpus(&r->size); - le32_to_cpus(&r->tail); - le32_to_cpus(&r->head); -} - -static int wil_wait_for_fw_ready(struct wil6210_priv *wil) -{ - ulong to = msecs_to_jiffies(1000); - ulong left = wait_for_completion_timeout(&wil->wmi_ready, to); - if (0 == left) { - wil_err(wil, "Firmware not ready\n"); - return -ETIME; - } else { - wil_dbg_misc(wil, "FW ready after %d ms\n", - jiffies_to_msecs(to-left)); - } - return 0; -} - -/* - * We reset all the structures, and we reset the UMAC. - * After calling this routine, you're expected to reload - * the firmware. - */ -int wil_reset(struct wil6210_priv *wil) -{ - int rc; - - cancel_work_sync(&wil->disconnect_worker); - wil6210_disconnect(wil, NULL); - - wil6210_disable_irq(wil); - wil->status = 0; - - wmi_event_flush(wil); - - flush_workqueue(wil->wmi_wq_conn); - flush_workqueue(wil->wmi_wq); - - /* TODO: put MAC in reset */ - wil_target_reset(wil); - - /* init after reset */ - wil->pending_connect_cid = -1; - INIT_COMPLETION(wil->wmi_ready); - - /* TODO: release MAC reset */ - wil6210_enable_irq(wil); - - /* we just started MAC, wait for FW ready */ - rc = wil_wait_for_fw_ready(wil); - - return rc; -} - - -void wil_link_on(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - - wil_dbg_misc(wil, "%s()\n", __func__); - - netif_carrier_on(ndev); - netif_tx_wake_all_queues(ndev); -} - -void wil_link_off(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - - wil_dbg_misc(wil, "%s()\n", __func__); - - netif_tx_stop_all_queues(ndev); - netif_carrier_off(ndev); -} - -static int __wil_up(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct wireless_dev *wdev = wil->wdev; - struct ieee80211_channel *channel = wdev->preset_chandef.chan; - int rc; - int bi; - u16 wmi_nettype = wil_iftype_nl2wmi(wdev->iftype); - - rc = wil_reset(wil); - if (rc) - return rc; - - /* FIXME Firmware works now in PBSS mode(ToDS=0, FromDS=0) */ - wmi_nettype = wil_iftype_nl2wmi(NL80211_IFTYPE_ADHOC); - switch (wdev->iftype) { - case NL80211_IFTYPE_STATION: - wil_dbg_misc(wil, "type: STATION\n"); - bi = 0; - ndev->type = ARPHRD_ETHER; - break; - case NL80211_IFTYPE_AP: - wil_dbg_misc(wil, "type: AP\n"); - bi = 100; - ndev->type = ARPHRD_ETHER; - break; - case NL80211_IFTYPE_P2P_CLIENT: - wil_dbg_misc(wil, "type: P2P_CLIENT\n"); - bi = 0; - ndev->type = ARPHRD_ETHER; - break; - case NL80211_IFTYPE_P2P_GO: - wil_dbg_misc(wil, "type: P2P_GO\n"); - bi = 100; - ndev->type = ARPHRD_ETHER; - break; - case NL80211_IFTYPE_MONITOR: - wil_dbg_misc(wil, "type: Monitor\n"); - bi = 0; - ndev->type = ARPHRD_IEEE80211_RADIOTAP; - /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_RADIOTAP ? */ - break; - default: - return -EOPNOTSUPP; - } - - /* Apply profile in the following order: */ - /* SSID and channel for the AP */ - switch (wdev->iftype) { - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_P2P_GO: - if (wdev->ssid_len == 0) { - wil_err(wil, "SSID not set\n"); - return -EINVAL; - } - rc = wmi_set_ssid(wil, wdev->ssid_len, wdev->ssid); - if (rc) - return rc; - break; - default: - break; - } - - /* MAC address - pre-requisite for other commands */ - wmi_set_mac_address(wil, ndev->dev_addr); - - /* Set up beaconing if required. */ - if (bi > 0) { - rc = wmi_pcp_start(wil, bi, wmi_nettype, - (channel ? channel->hw_value : 0)); - if (rc) - return rc; - } - - /* Rx VRING. After MAC and beacon */ - wil_rx_init(wil); - - return 0; -} - -int wil_up(struct wil6210_priv *wil) -{ - int rc; - - mutex_lock(&wil->mutex); - rc = __wil_up(wil); - mutex_unlock(&wil->mutex); - - return rc; -} - -static int __wil_down(struct wil6210_priv *wil) -{ - if (wil->scan_request) { - cfg80211_scan_done(wil->scan_request, true); - wil->scan_request = NULL; - } - - wil6210_disconnect(wil, NULL); - wil_rx_fini(wil); - - return 0; -} - -int wil_down(struct wil6210_priv *wil) -{ - int rc; - - mutex_lock(&wil->mutex); - rc = __wil_down(wil); - mutex_unlock(&wil->mutex); - - return rc; -} diff --git a/drivers/net/wireless/ath/wil6210/netdev.c b/drivers/net/wireless/ath/wil6210/netdev.c deleted file mode 100644 index 098a8ec6b841..000000000000 --- a/drivers/net/wireless/ath/wil6210/netdev.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#include "wil6210.h" - -static int wil_open(struct net_device *ndev) -{ - struct wil6210_priv *wil = ndev_to_wil(ndev); - - return wil_up(wil); -} - -static int wil_stop(struct net_device *ndev) -{ - struct wil6210_priv *wil = ndev_to_wil(ndev); - - return wil_down(wil); -} - -static const struct net_device_ops wil_netdev_ops = { - .ndo_open = wil_open, - .ndo_stop = wil_stop, - .ndo_start_xmit = wil_start_xmit, - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, -}; - -void *wil_if_alloc(struct device *dev, void __iomem *csr) -{ - struct net_device *ndev; - struct wireless_dev *wdev; - struct wil6210_priv *wil; - struct ieee80211_channel *ch; - int rc = 0; - - wdev = wil_cfg80211_init(dev); - if (IS_ERR(wdev)) { - dev_err(dev, "wil_cfg80211_init failed\n"); - return wdev; - } - - wil = wdev_to_wil(wdev); - wil->csr = csr; - wil->wdev = wdev; - - rc = wil_priv_init(wil); - if (rc) { - dev_err(dev, "wil_priv_init failed\n"); - goto out_wdev; - } - - wdev->iftype = NL80211_IFTYPE_STATION; /* TODO */ - /* default monitor channel */ - ch = wdev->wiphy->bands[IEEE80211_BAND_60GHZ]->channels; - cfg80211_chandef_create(&wdev->preset_chandef, ch, NL80211_CHAN_NO_HT); - - ndev = alloc_netdev(0, "wlan%d", ether_setup); - if (!ndev) { - dev_err(dev, "alloc_netdev_mqs failed\n"); - rc = -ENOMEM; - goto out_priv; - } - - ndev->netdev_ops = &wil_netdev_ops; - ndev->ieee80211_ptr = wdev; - SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); - wdev->netdev = ndev; - - wil_link_off(wil); - - return wil; - - out_priv: - wil_priv_deinit(wil); - - out_wdev: - wil_wdev_free(wil); - - return ERR_PTR(rc); -} - -void wil_if_free(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - if (!ndev) - return; - - free_netdev(ndev); - wil_priv_deinit(wil); - wil_wdev_free(wil); -} - -int wil_if_add(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - int rc; - - rc = register_netdev(ndev); - if (rc < 0) { - dev_err(&ndev->dev, "Failed to register netdev: %d\n", rc); - return rc; - } - - wil_link_off(wil); - - return 0; -} - -void wil_if_remove(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - - unregister_netdev(ndev); -} diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c deleted file mode 100644 index eb1dc7ad80fb..000000000000 --- a/drivers/net/wireless/ath/wil6210/pcie_bus.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - -#include "wil6210.h" - -static int use_msi = 1; -module_param(use_msi, int, S_IRUGO); -MODULE_PARM_DESC(use_msi, - " Use MSI interrupt: " - "0 - don't, 1 - (default) - single, or 3"); - -/* Bus ops */ -static int wil_if_pcie_enable(struct wil6210_priv *wil) -{ - struct pci_dev *pdev = wil->pdev; - int rc; - - pci_set_master(pdev); - - /* - * how many MSI interrupts to request? - */ - switch (use_msi) { - case 3: - case 1: - case 0: - break; - default: - wil_err(wil, "Invalid use_msi=%d, default to 1\n", - use_msi); - use_msi = 1; - } - wil->n_msi = use_msi; - if (wil->n_msi) { - wil_dbg_misc(wil, "Setup %d MSI interrupts\n", use_msi); - rc = pci_enable_msi_block(pdev, wil->n_msi); - if (rc && (wil->n_msi == 3)) { - wil_err(wil, "3 MSI mode failed, try 1 MSI\n"); - wil->n_msi = 1; - rc = pci_enable_msi_block(pdev, wil->n_msi); - } - if (rc) { - wil_err(wil, "pci_enable_msi failed, use INTx\n"); - wil->n_msi = 0; - } - } else { - wil_dbg_misc(wil, "MSI interrupts disabled, use INTx\n"); - } - - rc = wil6210_init_irq(wil, pdev->irq); - if (rc) - goto stop_master; - - /* need reset here to obtain MAC */ - rc = wil_reset(wil); - if (rc) - goto release_irq; - - return 0; - - release_irq: - wil6210_fini_irq(wil, pdev->irq); - /* safe to call if no MSI */ - pci_disable_msi(pdev); - stop_master: - pci_clear_master(pdev); - return rc; -} - -static int wil_if_pcie_disable(struct wil6210_priv *wil) -{ - struct pci_dev *pdev = wil->pdev; - - pci_clear_master(pdev); - /* disable and release IRQ */ - wil6210_fini_irq(wil, pdev->irq); - /* safe to call if no MSI */ - pci_disable_msi(pdev); - /* TODO: disable HW */ - - return 0; -} - -static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) -{ - struct wil6210_priv *wil; - struct device *dev = &pdev->dev; - void __iomem *csr; - int rc; - - /* check HW */ - dev_info(&pdev->dev, WIL_NAME " device found [%04x:%04x] (rev %x)\n", - (int)pdev->vendor, (int)pdev->device, (int)pdev->revision); - - if (pci_resource_len(pdev, 0) != WIL6210_MEM_SIZE) { - dev_err(&pdev->dev, "Not " WIL_NAME "? " - "BAR0 size is %lu while expecting %lu\n", - (ulong)pci_resource_len(pdev, 0), WIL6210_MEM_SIZE); - return -ENODEV; - } - - rc = pci_enable_device(pdev); - if (rc) { - dev_err(&pdev->dev, "pci_enable_device failed\n"); - return -ENODEV; - } - /* rollback to err_disable_pdev */ - - rc = pci_request_region(pdev, 0, WIL_NAME); - if (rc) { - dev_err(&pdev->dev, "pci_request_region failed\n"); - goto err_disable_pdev; - } - /* rollback to err_release_reg */ - - csr = pci_ioremap_bar(pdev, 0); - if (!csr) { - dev_err(&pdev->dev, "pci_ioremap_bar failed\n"); - rc = -ENODEV; - goto err_release_reg; - } - /* rollback to err_iounmap */ - dev_info(&pdev->dev, "CSR at %pR -> %p\n", &pdev->resource[0], csr); - - wil = wil_if_alloc(dev, csr); - if (IS_ERR(wil)) { - rc = (int)PTR_ERR(wil); - dev_err(dev, "wil_if_alloc failed: %d\n", rc); - goto err_iounmap; - } - /* rollback to if_free */ - - pci_set_drvdata(pdev, wil); - wil->pdev = pdev; - - /* FW should raise IRQ when ready */ - rc = wil_if_pcie_enable(wil); - if (rc) { - wil_err(wil, "Enable device failed\n"); - goto if_free; - } - /* rollback to bus_disable */ - - rc = wil_if_add(wil); - if (rc) { - wil_err(wil, "wil_if_add failed: %d\n", rc); - goto bus_disable; - } - - wil6210_debugfs_init(wil); - - /* check FW is alive */ - wmi_echo(wil); - - return 0; - - bus_disable: - wil_if_pcie_disable(wil); - if_free: - wil_if_free(wil); - err_iounmap: - pci_iounmap(pdev, csr); - err_release_reg: - pci_release_region(pdev, 0); - err_disable_pdev: - pci_disable_device(pdev); - - return rc; -} - -static void wil_pcie_remove(struct pci_dev *pdev) -{ - struct wil6210_priv *wil = pci_get_drvdata(pdev); - - wil6210_debugfs_remove(wil); - wil_if_pcie_disable(wil); - wil_if_remove(wil); - wil_if_free(wil); - pci_iounmap(pdev, wil->csr); - pci_release_region(pdev, 0); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); -} - -static DEFINE_PCI_DEVICE_TABLE(wil6210_pcie_ids) = { - { PCI_DEVICE(0x1ae9, 0x0301) }, - { /* end: all zeroes */ }, -}; -MODULE_DEVICE_TABLE(pci, wil6210_pcie_ids); - -static struct pci_driver wil6210_driver = { - .probe = wil_pcie_probe, - .remove = wil_pcie_remove, - .id_table = wil6210_pcie_ids, - .name = WIL_NAME, -}; - -module_pci_driver(wil6210_driver); - -MODULE_LICENSE("Dual BSD/GPL"); -MODULE_AUTHOR("Qualcomm Atheros "); -MODULE_DESCRIPTION("Driver for 60g WiFi WIL6210 card"); diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c deleted file mode 100644 index 797024507c71..000000000000 --- a/drivers/net/wireless/ath/wil6210/txrx.c +++ /dev/null @@ -1,832 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - -#include "wil6210.h" -#include "wmi.h" -#include "txrx.h" - -static bool rtap_include_phy_info; -module_param(rtap_include_phy_info, bool, S_IRUGO); -MODULE_PARM_DESC(rtap_include_phy_info, - " Include PHY info in the radiotap header, default - no"); - -static inline int wil_vring_is_empty(struct vring *vring) -{ - return vring->swhead == vring->swtail; -} - -static inline u32 wil_vring_next_tail(struct vring *vring) -{ - return (vring->swtail + 1) % vring->size; -} - -static inline void wil_vring_advance_head(struct vring *vring, int n) -{ - vring->swhead = (vring->swhead + n) % vring->size; -} - -static inline int wil_vring_is_full(struct vring *vring) -{ - return wil_vring_next_tail(vring) == vring->swhead; -} -/* - * Available space in Tx Vring - */ -static inline int wil_vring_avail_tx(struct vring *vring) -{ - u32 swhead = vring->swhead; - u32 swtail = vring->swtail; - int used = (vring->size + swhead - swtail) % vring->size; - - return vring->size - used - 1; -} - -static int wil_vring_alloc(struct wil6210_priv *wil, struct vring *vring) -{ - struct device *dev = wil_to_dev(wil); - size_t sz = vring->size * sizeof(vring->va[0]); - uint i; - - BUILD_BUG_ON(sizeof(vring->va[0]) != 32); - - vring->swhead = 0; - vring->swtail = 0; - vring->ctx = kzalloc(vring->size * sizeof(vring->ctx[0]), GFP_KERNEL); - if (!vring->ctx) { - vring->va = NULL; - return -ENOMEM; - } - /* - * vring->va should be aligned on its size rounded up to power of 2 - * This is granted by the dma_alloc_coherent - */ - vring->va = dma_alloc_coherent(dev, sz, &vring->pa, GFP_KERNEL); - if (!vring->va) { - kfree(vring->ctx); - vring->ctx = NULL; - return -ENOMEM; - } - /* initially, all descriptors are SW owned - * For Tx and Rx, ownership bit is at the same location, thus - * we can use any - */ - for (i = 0; i < vring->size; i++) { - volatile struct vring_tx_desc *d = &(vring->va[i].tx); - d->dma.status = TX_DMA_STATUS_DU; - } - - wil_dbg_misc(wil, "vring[%d] 0x%p:0x%016llx 0x%p\n", vring->size, - vring->va, (unsigned long long)vring->pa, vring->ctx); - - return 0; -} - -static void wil_vring_free(struct wil6210_priv *wil, struct vring *vring, - int tx) -{ - struct device *dev = wil_to_dev(wil); - size_t sz = vring->size * sizeof(vring->va[0]); - - while (!wil_vring_is_empty(vring)) { - if (tx) { - volatile struct vring_tx_desc *d = - &vring->va[vring->swtail].tx; - dma_addr_t pa = d->dma.addr_low | - ((u64)d->dma.addr_high << 32); - struct sk_buff *skb = vring->ctx[vring->swtail]; - if (skb) { - dma_unmap_single(dev, pa, d->dma.length, - DMA_TO_DEVICE); - dev_kfree_skb_any(skb); - vring->ctx[vring->swtail] = NULL; - } else { - dma_unmap_page(dev, pa, d->dma.length, - DMA_TO_DEVICE); - } - vring->swtail = wil_vring_next_tail(vring); - } else { /* rx */ - volatile struct vring_rx_desc *d = - &vring->va[vring->swtail].rx; - dma_addr_t pa = d->dma.addr_low | - ((u64)d->dma.addr_high << 32); - struct sk_buff *skb = vring->ctx[vring->swhead]; - dma_unmap_single(dev, pa, d->dma.length, - DMA_FROM_DEVICE); - kfree_skb(skb); - wil_vring_advance_head(vring, 1); - } - } - dma_free_coherent(dev, sz, (void *)vring->va, vring->pa); - kfree(vring->ctx); - vring->pa = 0; - vring->va = NULL; - vring->ctx = NULL; -} - -/** - * Allocate one skb for Rx VRING - * - * Safe to call from IRQ - */ -static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct vring *vring, - u32 i, int headroom) -{ - struct device *dev = wil_to_dev(wil); - unsigned int sz = RX_BUF_LEN; - volatile struct vring_rx_desc *d = &(vring->va[i].rx); - dma_addr_t pa; - - /* TODO align */ - struct sk_buff *skb = dev_alloc_skb(sz + headroom); - if (unlikely(!skb)) - return -ENOMEM; - - skb_reserve(skb, headroom); - skb_put(skb, sz); - - pa = dma_map_single(dev, skb->data, skb->len, DMA_FROM_DEVICE); - if (unlikely(dma_mapping_error(dev, pa))) { - kfree_skb(skb); - return -ENOMEM; - } - - d->dma.d0 = BIT(9) | RX_DMA_D0_CMD_DMA_IT; - d->dma.addr_low = lower_32_bits(pa); - d->dma.addr_high = (u16)upper_32_bits(pa); - /* ip_length don't care */ - /* b11 don't care */ - /* error don't care */ - d->dma.status = 0; /* BIT(0) should be 0 for HW_OWNED */ - d->dma.length = sz; - vring->ctx[i] = skb; - - return 0; -} - -/** - * Adds radiotap header - * - * Any error indicated as "Bad FCS" - * - * Vendor data for 04:ce:14-1 (Wilocity-1) consists of: - * - Rx descriptor: 32 bytes - * - Phy info - */ -static void wil_rx_add_radiotap_header(struct wil6210_priv *wil, - struct sk_buff *skb) -{ - struct wireless_dev *wdev = wil->wdev; - struct wil6210_rtap { - struct ieee80211_radiotap_header rthdr; - /* fields should be in the order of bits in rthdr.it_present */ - /* flags */ - u8 flags; - /* channel */ - __le16 chnl_freq __aligned(2); - __le16 chnl_flags; - /* MCS */ - u8 mcs_present; - u8 mcs_flags; - u8 mcs_index; - } __packed; - struct wil6210_rtap_vendor { - struct wil6210_rtap rtap; - /* vendor */ - u8 vendor_oui[3] __aligned(2); - u8 vendor_ns; - __le16 vendor_skip; - u8 vendor_data[0]; - } __packed; - struct vring_rx_desc *d = wil_skb_rxdesc(skb); - struct wil6210_rtap_vendor *rtap_vendor; - int rtap_len = sizeof(struct wil6210_rtap); - int phy_length = 0; /* phy info header size, bytes */ - static char phy_data[128]; - struct ieee80211_channel *ch = wdev->preset_chandef.chan; - - if (rtap_include_phy_info) { - rtap_len = sizeof(*rtap_vendor) + sizeof(*d); - /* calculate additional length */ - if (d->dma.status & RX_DMA_STATUS_PHY_INFO) { - /** - * PHY info starts from 8-byte boundary - * there are 8-byte lines, last line may be partially - * written (HW bug), thus FW configures for last line - * to be excessive. Driver skips this last line. - */ - int len = min_t(int, 8 + sizeof(phy_data), - wil_rxdesc_phy_length(d)); - if (len > 8) { - void *p = skb_tail_pointer(skb); - void *pa = PTR_ALIGN(p, 8); - if (skb_tailroom(skb) >= len + (pa - p)) { - phy_length = len - 8; - memcpy(phy_data, pa, phy_length); - } - } - } - rtap_len += phy_length; - } - - if (skb_headroom(skb) < rtap_len && - pskb_expand_head(skb, rtap_len, 0, GFP_ATOMIC)) { - wil_err(wil, "Unable to expand headrom to %d\n", rtap_len); - return; - } - - rtap_vendor = (void *)skb_push(skb, rtap_len); - memset(rtap_vendor, 0, rtap_len); - - rtap_vendor->rtap.rthdr.it_version = PKTHDR_RADIOTAP_VERSION; - rtap_vendor->rtap.rthdr.it_len = cpu_to_le16(rtap_len); - rtap_vendor->rtap.rthdr.it_present = cpu_to_le32( - (1 << IEEE80211_RADIOTAP_FLAGS) | - (1 << IEEE80211_RADIOTAP_CHANNEL) | - (1 << IEEE80211_RADIOTAP_MCS)); - if (d->dma.status & RX_DMA_STATUS_ERROR) - rtap_vendor->rtap.flags |= IEEE80211_RADIOTAP_F_BADFCS; - - rtap_vendor->rtap.chnl_freq = cpu_to_le16(ch ? ch->center_freq : 58320); - rtap_vendor->rtap.chnl_flags = cpu_to_le16(0); - - rtap_vendor->rtap.mcs_present = IEEE80211_RADIOTAP_MCS_HAVE_MCS; - rtap_vendor->rtap.mcs_flags = 0; - rtap_vendor->rtap.mcs_index = wil_rxdesc_mcs(d); - - if (rtap_include_phy_info) { - rtap_vendor->rtap.rthdr.it_present |= cpu_to_le32(1 << - IEEE80211_RADIOTAP_VENDOR_NAMESPACE); - /* OUI for Wilocity 04:ce:14 */ - rtap_vendor->vendor_oui[0] = 0x04; - rtap_vendor->vendor_oui[1] = 0xce; - rtap_vendor->vendor_oui[2] = 0x14; - rtap_vendor->vendor_ns = 1; - /* Rx descriptor + PHY data */ - rtap_vendor->vendor_skip = cpu_to_le16(sizeof(*d) + - phy_length); - memcpy(rtap_vendor->vendor_data, (void *)d, sizeof(*d)); - memcpy(rtap_vendor->vendor_data + sizeof(*d), phy_data, - phy_length); - } -} - -/* - * Fast swap in place between 2 registers - */ -static void wil_swap_u16(u16 *a, u16 *b) -{ - *a ^= *b; - *b ^= *a; - *a ^= *b; -} - -static void wil_swap_ethaddr(void *data) -{ - struct ethhdr *eth = data; - u16 *s = (u16 *)eth->h_source; - u16 *d = (u16 *)eth->h_dest; - - wil_swap_u16(s++, d++); - wil_swap_u16(s++, d++); - wil_swap_u16(s, d); -} - -/** - * reap 1 frame from @swhead - * - * Rx descriptor copied to skb->cb - * - * Safe to call from IRQ - */ -static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil, - struct vring *vring) -{ - struct device *dev = wil_to_dev(wil); - struct net_device *ndev = wil_to_ndev(wil); - volatile struct vring_rx_desc *d; - struct vring_rx_desc *d1; - struct sk_buff *skb; - dma_addr_t pa; - unsigned int sz = RX_BUF_LEN; - u8 ftype; - u8 ds_bits; - - BUILD_BUG_ON(sizeof(struct vring_rx_desc) > sizeof(skb->cb)); - - if (wil_vring_is_empty(vring)) - return NULL; - - d = &(vring->va[vring->swhead].rx); - if (!(d->dma.status & RX_DMA_STATUS_DU)) { - /* it is not error, we just reached end of Rx done area */ - return NULL; - } - - pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32); - skb = vring->ctx[vring->swhead]; - dma_unmap_single(dev, pa, sz, DMA_FROM_DEVICE); - skb_trim(skb, d->dma.length); - - d1 = wil_skb_rxdesc(skb); - *d1 = *d; - - wil->stats.last_mcs_rx = wil_rxdesc_mcs(d1); - - /* use radiotap header only if required */ - if (ndev->type == ARPHRD_IEEE80211_RADIOTAP) - wil_rx_add_radiotap_header(wil, skb); - - wil_dbg_txrx(wil, "Rx[%3d] : %d bytes\n", vring->swhead, d->dma.length); - wil_hex_dump_txrx("Rx ", DUMP_PREFIX_NONE, 32, 4, - (const void *)d, sizeof(*d), false); - - wil_vring_advance_head(vring, 1); - - /* no extra checks if in sniffer mode */ - if (ndev->type != ARPHRD_ETHER) - return skb; - /* - * Non-data frames may be delivered through Rx DMA channel (ex: BAR) - * Driver should recognize it by frame type, that is found - * in Rx descriptor. If type is not data, it is 802.11 frame as is - */ - ftype = wil_rxdesc_ftype(d1) << 2; - if (ftype != IEEE80211_FTYPE_DATA) { - wil_dbg_txrx(wil, "Non-data frame ftype 0x%08x\n", ftype); - /* TODO: process it */ - kfree_skb(skb); - return NULL; - } - - if (skb->len < ETH_HLEN) { - wil_err(wil, "Short frame, len = %d\n", skb->len); - /* TODO: process it (i.e. BAR) */ - kfree_skb(skb); - return NULL; - } - - ds_bits = wil_rxdesc_ds_bits(d1); - if (ds_bits == 1) { - /* - * HW bug - in ToDS mode, i.e. Rx on AP side, - * addresses get swapped - */ - wil_swap_ethaddr(skb->data); - } - - return skb; -} - -/** - * allocate and fill up to @count buffers in rx ring - * buffers posted at @swtail - */ -static int wil_rx_refill(struct wil6210_priv *wil, int count) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct vring *v = &wil->vring_rx; - u32 next_tail; - int rc = 0; - int headroom = ndev->type == ARPHRD_IEEE80211_RADIOTAP ? - WIL6210_RTAP_SIZE : 0; - - for (; next_tail = wil_vring_next_tail(v), - (next_tail != v->swhead) && (count-- > 0); - v->swtail = next_tail) { - rc = wil_vring_alloc_skb(wil, v, v->swtail, headroom); - if (rc) { - wil_err(wil, "Error %d in wil_rx_refill[%d]\n", - rc, v->swtail); - break; - } - } - iowrite32(v->swtail, wil->csr + HOSTADDR(v->hwtail)); - - return rc; -} - -/* - * Pass Rx packet to the netif. Update statistics. - */ -static void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev) -{ - int rc; - unsigned int len = skb->len; - - skb_orphan(skb); - - if (in_interrupt()) - rc = netif_rx(skb); - else - rc = netif_rx_ni(skb); - - if (likely(rc == NET_RX_SUCCESS)) { - ndev->stats.rx_packets++; - ndev->stats.rx_bytes += len; - - } else { - ndev->stats.rx_dropped++; - } -} - -/** - * Proceed all completed skb's from Rx VRING - * - * Safe to call from IRQ - */ -void wil_rx_handle(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct vring *v = &wil->vring_rx; - struct sk_buff *skb; - - if (!v->va) { - wil_err(wil, "Rx IRQ while Rx not yet initialized\n"); - return; - } - wil_dbg_txrx(wil, "%s()\n", __func__); - while (NULL != (skb = wil_vring_reap_rx(wil, v))) { - wil_hex_dump_txrx("Rx ", DUMP_PREFIX_OFFSET, 16, 1, - skb->data, skb_headlen(skb), false); - - if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) { - skb->dev = ndev; - skb_reset_mac_header(skb); - skb->ip_summed = CHECKSUM_UNNECESSARY; - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = htons(ETH_P_802_2); - - } else { - skb->protocol = eth_type_trans(skb, ndev); - } - - wil_netif_rx_any(skb, ndev); - } - wil_rx_refill(wil, v->size); -} - -int wil_rx_init(struct wil6210_priv *wil) -{ - struct vring *vring = &wil->vring_rx; - int rc; - - vring->size = WIL6210_RX_RING_SIZE; - rc = wil_vring_alloc(wil, vring); - if (rc) - return rc; - - rc = wmi_rx_chain_add(wil, vring); - if (rc) - goto err_free; - - rc = wil_rx_refill(wil, vring->size); - if (rc) - goto err_free; - - return 0; - err_free: - wil_vring_free(wil, vring, 0); - - return rc; -} - -void wil_rx_fini(struct wil6210_priv *wil) -{ - struct vring *vring = &wil->vring_rx; - - if (vring->va) - wil_vring_free(wil, vring, 0); -} - -int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size, - int cid, int tid) -{ - int rc; - struct wmi_vring_cfg_cmd cmd = { - .action = cpu_to_le32(WMI_VRING_CMD_ADD), - .vring_cfg = { - .tx_sw_ring = { - .max_mpdu_size = cpu_to_le16(TX_BUF_LEN), - .ring_size = cpu_to_le16(size), - }, - .ringid = id, - .cidxtid = (cid & 0xf) | ((tid & 0xf) << 4), - .encap_trans_type = WMI_VRING_ENC_TYPE_802_3, - .mac_ctrl = 0, - .to_resolution = 0, - .agg_max_wsize = 16, - .schd_params = { - .priority = cpu_to_le16(0), - .timeslot_us = cpu_to_le16(0xfff), - }, - }, - }; - struct { - struct wil6210_mbox_hdr_wmi wmi; - struct wmi_vring_cfg_done_event cmd; - } __packed reply; - struct vring *vring = &wil->vring_tx[id]; - - if (vring->va) { - wil_err(wil, "Tx ring [%d] already allocated\n", id); - rc = -EINVAL; - goto out; - } - - vring->size = size; - rc = wil_vring_alloc(wil, vring); - if (rc) - goto out; - - cmd.vring_cfg.tx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa); - - rc = wmi_call(wil, WMI_VRING_CFG_CMDID, &cmd, sizeof(cmd), - WMI_VRING_CFG_DONE_EVENTID, &reply, sizeof(reply), 100); - if (rc) - goto out_free; - - if (reply.cmd.status != WMI_FW_STATUS_SUCCESS) { - wil_err(wil, "Tx config failed, status 0x%02x\n", - reply.cmd.status); - rc = -EINVAL; - goto out_free; - } - vring->hwtail = le32_to_cpu(reply.cmd.tx_vring_tail_ptr); - - return 0; - out_free: - wil_vring_free(wil, vring, 1); - out: - - return rc; -} - -void wil_vring_fini_tx(struct wil6210_priv *wil, int id) -{ - struct vring *vring = &wil->vring_tx[id]; - - if (!vring->va) - return; - - wil_vring_free(wil, vring, 1); -} - -static struct vring *wil_find_tx_vring(struct wil6210_priv *wil, - struct sk_buff *skb) -{ - struct vring *v = &wil->vring_tx[0]; - - if (v->va) - return v; - - return NULL; -} - -static int wil_tx_desc_map(volatile struct vring_tx_desc *d, - dma_addr_t pa, u32 len) -{ - d->dma.addr_low = lower_32_bits(pa); - d->dma.addr_high = (u16)upper_32_bits(pa); - d->dma.ip_length = 0; - /* 0..6: mac_length; 7:ip_version 0-IP6 1-IP4*/ - d->dma.b11 = 0/*14 | BIT(7)*/; - d->dma.error = 0; - d->dma.status = 0; /* BIT(0) should be 0 for HW_OWNED */ - d->dma.length = len; - d->dma.d0 = 0; - d->mac.d[0] = 0; - d->mac.d[1] = 0; - d->mac.d[2] = 0; - d->mac.ucode_cmd = 0; - /* use dst index 0 */ - d->mac.d[1] |= BIT(MAC_CFG_DESC_TX_1_DST_INDEX_EN_POS) | - (0 << MAC_CFG_DESC_TX_1_DST_INDEX_POS); - /* translation type: 0 - bypass; 1 - 802.3; 2 - native wifi */ - d->mac.d[2] = BIT(MAC_CFG_DESC_TX_2_SNAP_HDR_INSERTION_EN_POS) | - (1 << MAC_CFG_DESC_TX_2_L2_TRANSLATION_TYPE_POS); - - return 0; -} - -static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring, - struct sk_buff *skb) -{ - struct device *dev = wil_to_dev(wil); - volatile struct vring_tx_desc *d; - u32 swhead = vring->swhead; - int avail = wil_vring_avail_tx(vring); - int nr_frags = skb_shinfo(skb)->nr_frags; - uint f; - int vring_index = vring - wil->vring_tx; - uint i = swhead; - dma_addr_t pa; - - wil_dbg_txrx(wil, "%s()\n", __func__); - - if (avail < vring->size/8) - netif_tx_stop_all_queues(wil_to_ndev(wil)); - if (avail < 1 + nr_frags) { - wil_err(wil, "Tx ring full. No space for %d fragments\n", - 1 + nr_frags); - return -ENOMEM; - } - d = &(vring->va[i].tx); - - /* FIXME FW can accept only unicast frames for the peer */ - memcpy(skb->data, wil->dst_addr[vring_index], ETH_ALEN); - - pa = dma_map_single(dev, skb->data, - skb_headlen(skb), DMA_TO_DEVICE); - - wil_dbg_txrx(wil, "Tx skb %d bytes %p -> %#08llx\n", skb_headlen(skb), - skb->data, (unsigned long long)pa); - wil_hex_dump_txrx("Tx ", DUMP_PREFIX_OFFSET, 16, 1, - skb->data, skb_headlen(skb), false); - - if (unlikely(dma_mapping_error(dev, pa))) - return -EINVAL; - /* 1-st segment */ - wil_tx_desc_map(d, pa, skb_headlen(skb)); - d->mac.d[2] |= ((nr_frags + 1) << - MAC_CFG_DESC_TX_2_NUM_OF_DESCRIPTORS_POS); - /* middle segments */ - for (f = 0; f < nr_frags; f++) { - const struct skb_frag_struct *frag = - &skb_shinfo(skb)->frags[f]; - int len = skb_frag_size(frag); - i = (swhead + f + 1) % vring->size; - d = &(vring->va[i].tx); - pa = skb_frag_dma_map(dev, frag, 0, skb_frag_size(frag), - DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(dev, pa))) - goto dma_error; - wil_tx_desc_map(d, pa, len); - vring->ctx[i] = NULL; - } - /* for the last seg only */ - d->dma.d0 |= BIT(DMA_CFG_DESC_TX_0_CMD_EOP_POS); - d->dma.d0 |= BIT(9); /* BUG: undocumented bit */ - d->dma.d0 |= BIT(DMA_CFG_DESC_TX_0_CMD_DMA_IT_POS); - d->dma.d0 |= (vring_index << DMA_CFG_DESC_TX_0_QID_POS); - - wil_hex_dump_txrx("Tx ", DUMP_PREFIX_NONE, 32, 4, - (const void *)d, sizeof(*d), false); - - /* advance swhead */ - wil_vring_advance_head(vring, nr_frags + 1); - wil_dbg_txrx(wil, "Tx swhead %d -> %d\n", swhead, vring->swhead); - iowrite32(vring->swhead, wil->csr + HOSTADDR(vring->hwtail)); - /* hold reference to skb - * to prevent skb release before accounting - * in case of immediate "tx done" - */ - vring->ctx[i] = skb_get(skb); - - return 0; - dma_error: - /* unmap what we have mapped */ - /* Note: increment @f to operate with positive index */ - for (f++; f > 0; f--) { - i = (swhead + f) % vring->size; - d = &(vring->va[i].tx); - d->dma.status = TX_DMA_STATUS_DU; - pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32); - if (vring->ctx[i]) - dma_unmap_single(dev, pa, d->dma.length, DMA_TO_DEVICE); - else - dma_unmap_page(dev, pa, d->dma.length, DMA_TO_DEVICE); - } - - return -EINVAL; -} - - -netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev) -{ - struct wil6210_priv *wil = ndev_to_wil(ndev); - struct vring *vring; - int rc; - - wil_dbg_txrx(wil, "%s()\n", __func__); - if (!test_bit(wil_status_fwready, &wil->status)) { - wil_err(wil, "FW not ready\n"); - goto drop; - } - if (!test_bit(wil_status_fwconnected, &wil->status)) { - wil_err(wil, "FW not connected\n"); - goto drop; - } - if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) { - wil_err(wil, "Xmit in monitor mode not supported\n"); - goto drop; - } - if (skb->protocol == cpu_to_be16(ETH_P_PAE)) { - rc = wmi_tx_eapol(wil, skb); - } else { - /* find vring */ - vring = wil_find_tx_vring(wil, skb); - if (!vring) { - wil_err(wil, "No Tx VRING available\n"); - goto drop; - } - /* set up vring entry */ - rc = wil_tx_vring(wil, vring, skb); - } - switch (rc) { - case 0: - /* statistics will be updated on the tx_complete */ - dev_kfree_skb_any(skb); - return NETDEV_TX_OK; - case -ENOMEM: - return NETDEV_TX_BUSY; - default: - break; /* goto drop; */ - } - drop: - netif_tx_stop_all_queues(ndev); - ndev->stats.tx_dropped++; - dev_kfree_skb_any(skb); - - return NET_XMIT_DROP; -} - -/** - * Clean up transmitted skb's from the Tx VRING - * - * Safe to call from IRQ - */ -void wil_tx_complete(struct wil6210_priv *wil, int ringid) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct device *dev = wil_to_dev(wil); - struct vring *vring = &wil->vring_tx[ringid]; - - if (!vring->va) { - wil_err(wil, "Tx irq[%d]: vring not initialized\n", ringid); - return; - } - - wil_dbg_txrx(wil, "%s(%d)\n", __func__, ringid); - - while (!wil_vring_is_empty(vring)) { - volatile struct vring_tx_desc *d1 = - &vring->va[vring->swtail].tx; - struct vring_tx_desc dd, *d = ⅆ - dma_addr_t pa; - struct sk_buff *skb; - - dd = *d1; - - if (!(d->dma.status & TX_DMA_STATUS_DU)) - break; - - wil_dbg_txrx(wil, - "Tx[%3d] : %d bytes, status 0x%02x err 0x%02x\n", - vring->swtail, d->dma.length, d->dma.status, - d->dma.error); - wil_hex_dump_txrx("TxC ", DUMP_PREFIX_NONE, 32, 4, - (const void *)d, sizeof(*d), false); - - pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32); - skb = vring->ctx[vring->swtail]; - if (skb) { - if (d->dma.error == 0) { - ndev->stats.tx_packets++; - ndev->stats.tx_bytes += skb->len; - } else { - ndev->stats.tx_errors++; - } - - dma_unmap_single(dev, pa, d->dma.length, DMA_TO_DEVICE); - dev_kfree_skb_any(skb); - vring->ctx[vring->swtail] = NULL; - } else { - dma_unmap_page(dev, pa, d->dma.length, DMA_TO_DEVICE); - } - d->dma.addr_low = 0; - d->dma.addr_high = 0; - d->dma.length = 0; - d->dma.status = TX_DMA_STATUS_DU; - vring->swtail = wil_vring_next_tail(vring); - } - if (wil_vring_avail_tx(vring) > vring->size/4) - netif_tx_wake_all_queues(wil_to_ndev(wil)); -} diff --git a/drivers/net/wireless/ath/wil6210/txrx.h b/drivers/net/wireless/ath/wil6210/txrx.h deleted file mode 100644 index adef12fb2aee..000000000000 --- a/drivers/net/wireless/ath/wil6210/txrx.h +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef WIL6210_TXRX_H -#define WIL6210_TXRX_H - -#define BUF_SW_OWNED (1) -#define BUF_HW_OWNED (0) - -/* size of max. Rx packet */ -#define RX_BUF_LEN (2048) -#define TX_BUF_LEN (2048) -/* how many bytes to reserve for rtap header? */ -#define WIL6210_RTAP_SIZE (128) - -/* Tx/Rx path */ -/* - * Tx descriptor - MAC part - * [dword 0] - * bit 0.. 9 : lifetime_expiry_value:10 - * bit 10 : interrup_en:1 - * bit 11 : status_en:1 - * bit 12..13 : txss_override:2 - * bit 14 : timestamp_insertion:1 - * bit 15 : duration_preserve:1 - * bit 16..21 : reserved0:6 - * bit 22..26 : mcs_index:5 - * bit 27 : mcs_en:1 - * bit 28..29 : reserved1:2 - * bit 30 : reserved2:1 - * bit 31 : sn_preserved:1 - * [dword 1] - * bit 0.. 3 : pkt_mode:4 - * bit 4 : pkt_mode_en:1 - * bit 5.. 7 : reserved0:3 - * bit 8..13 : reserved1:6 - * bit 14 : reserved2:1 - * bit 15 : ack_policy_en:1 - * bit 16..19 : dst_index:4 - * bit 20 : dst_index_en:1 - * bit 21..22 : ack_policy:2 - * bit 23 : lifetime_en:1 - * bit 24..30 : max_retry:7 - * bit 31 : max_retry_en:1 - * [dword 2] - * bit 0.. 7 : num_of_descriptors:8 - * bit 8..17 : reserved:10 - * bit 18..19 : l2_translation_type:2 - * bit 20 : snap_hdr_insertion_en:1 - * bit 21 : vlan_removal_en:1 - * bit 22..31 : reserved0:10 - * [dword 3] - * bit 0.. 31: ucode_cmd:32 - */ -struct vring_tx_mac { - u32 d[3]; - u32 ucode_cmd; -} __packed; - -/* TX MAC Dword 0 */ -#define MAC_CFG_DESC_TX_0_LIFETIME_EXPIRY_VALUE_POS 0 -#define MAC_CFG_DESC_TX_0_LIFETIME_EXPIRY_VALUE_LEN 10 -#define MAC_CFG_DESC_TX_0_LIFETIME_EXPIRY_VALUE_MSK 0x3FF - -#define MAC_CFG_DESC_TX_0_INTERRUP_EN_POS 10 -#define MAC_CFG_DESC_TX_0_INTERRUP_EN_LEN 1 -#define MAC_CFG_DESC_TX_0_INTERRUP_EN_MSK 0x400 - -#define MAC_CFG_DESC_TX_0_STATUS_EN_POS 11 -#define MAC_CFG_DESC_TX_0_STATUS_EN_LEN 1 -#define MAC_CFG_DESC_TX_0_STATUS_EN_MSK 0x800 - -#define MAC_CFG_DESC_TX_0_TXSS_OVERRIDE_POS 12 -#define MAC_CFG_DESC_TX_0_TXSS_OVERRIDE_LEN 2 -#define MAC_CFG_DESC_TX_0_TXSS_OVERRIDE_MSK 0x3000 - -#define MAC_CFG_DESC_TX_0_TIMESTAMP_INSERTION_POS 14 -#define MAC_CFG_DESC_TX_0_TIMESTAMP_INSERTION_LEN 1 -#define MAC_CFG_DESC_TX_0_TIMESTAMP_INSERTION_MSK 0x4000 - -#define MAC_CFG_DESC_TX_0_DURATION_PRESERVE_POS 15 -#define MAC_CFG_DESC_TX_0_DURATION_PRESERVE_LEN 1 -#define MAC_CFG_DESC_TX_0_DURATION_PRESERVE_MSK 0x8000 - -#define MAC_CFG_DESC_TX_0_MCS_INDEX_POS 22 -#define MAC_CFG_DESC_TX_0_MCS_INDEX_LEN 5 -#define MAC_CFG_DESC_TX_0_MCS_INDEX_MSK 0x7C00000 - -#define MAC_CFG_DESC_TX_0_MCS_EN_POS 27 -#define MAC_CFG_DESC_TX_0_MCS_EN_LEN 1 -#define MAC_CFG_DESC_TX_0_MCS_EN_MSK 0x8000000 - -#define MAC_CFG_DESC_TX_0_SN_PRESERVED_POS 31 -#define MAC_CFG_DESC_TX_0_SN_PRESERVED_LEN 1 -#define MAC_CFG_DESC_TX_0_SN_PRESERVED_MSK 0x80000000 - -/* TX MAC Dword 1 */ -#define MAC_CFG_DESC_TX_1_PKT_MODE_POS 0 -#define MAC_CFG_DESC_TX_1_PKT_MODE_LEN 4 -#define MAC_CFG_DESC_TX_1_PKT_MODE_MSK 0xF - -#define MAC_CFG_DESC_TX_1_PKT_MODE_EN_POS 4 -#define MAC_CFG_DESC_TX_1_PKT_MODE_EN_LEN 1 -#define MAC_CFG_DESC_TX_1_PKT_MODE_EN_MSK 0x10 - -#define MAC_CFG_DESC_TX_1_ACK_POLICY_EN_POS 15 -#define MAC_CFG_DESC_TX_1_ACK_POLICY_EN_LEN 1 -#define MAC_CFG_DESC_TX_1_ACK_POLICY_EN_MSK 0x8000 - -#define MAC_CFG_DESC_TX_1_DST_INDEX_POS 16 -#define MAC_CFG_DESC_TX_1_DST_INDEX_LEN 4 -#define MAC_CFG_DESC_TX_1_DST_INDEX_MSK 0xF0000 - -#define MAC_CFG_DESC_TX_1_DST_INDEX_EN_POS 20 -#define MAC_CFG_DESC_TX_1_DST_INDEX_EN_LEN 1 -#define MAC_CFG_DESC_TX_1_DST_INDEX_EN_MSK 0x100000 - -#define MAC_CFG_DESC_TX_1_ACK_POLICY_POS 21 -#define MAC_CFG_DESC_TX_1_ACK_POLICY_LEN 2 -#define MAC_CFG_DESC_TX_1_ACK_POLICY_MSK 0x600000 - -#define MAC_CFG_DESC_TX_1_LIFETIME_EN_POS 23 -#define MAC_CFG_DESC_TX_1_LIFETIME_EN_LEN 1 -#define MAC_CFG_DESC_TX_1_LIFETIME_EN_MSK 0x800000 - -#define MAC_CFG_DESC_TX_1_MAX_RETRY_POS 24 -#define MAC_CFG_DESC_TX_1_MAX_RETRY_LEN 7 -#define MAC_CFG_DESC_TX_1_MAX_RETRY_MSK 0x7F000000 - -#define MAC_CFG_DESC_TX_1_MAX_RETRY_EN_POS 31 -#define MAC_CFG_DESC_TX_1_MAX_RETRY_EN_LEN 1 -#define MAC_CFG_DESC_TX_1_MAX_RETRY_EN_MSK 0x80000000 - -/* TX MAC Dword 2 */ -#define MAC_CFG_DESC_TX_2_NUM_OF_DESCRIPTORS_POS 0 -#define MAC_CFG_DESC_TX_2_NUM_OF_DESCRIPTORS_LEN 8 -#define MAC_CFG_DESC_TX_2_NUM_OF_DESCRIPTORS_MSK 0xFF - -#define MAC_CFG_DESC_TX_2_RESERVED_POS 8 -#define MAC_CFG_DESC_TX_2_RESERVED_LEN 10 -#define MAC_CFG_DESC_TX_2_RESERVED_MSK 0x3FF00 - -#define MAC_CFG_DESC_TX_2_L2_TRANSLATION_TYPE_POS 18 -#define MAC_CFG_DESC_TX_2_L2_TRANSLATION_TYPE_LEN 2 -#define MAC_CFG_DESC_TX_2_L2_TRANSLATION_TYPE_MSK 0xC0000 - -#define MAC_CFG_DESC_TX_2_SNAP_HDR_INSERTION_EN_POS 20 -#define MAC_CFG_DESC_TX_2_SNAP_HDR_INSERTION_EN_LEN 1 -#define MAC_CFG_DESC_TX_2_SNAP_HDR_INSERTION_EN_MSK 0x100000 - -#define MAC_CFG_DESC_TX_2_VLAN_REMOVAL_EN_POS 21 -#define MAC_CFG_DESC_TX_2_VLAN_REMOVAL_EN_LEN 1 -#define MAC_CFG_DESC_TX_2_VLAN_REMOVAL_EN_MSK 0x200000 - -/* TX MAC Dword 3 */ -#define MAC_CFG_DESC_TX_3_UCODE_CMD_POS 0 -#define MAC_CFG_DESC_TX_3_UCODE_CMD_LEN 32 -#define MAC_CFG_DESC_TX_3_UCODE_CMD_MSK 0xFFFFFFFF - -/* TX DMA Dword 0 */ -#define DMA_CFG_DESC_TX_0_L4_LENGTH_POS 0 -#define DMA_CFG_DESC_TX_0_L4_LENGTH_LEN 8 -#define DMA_CFG_DESC_TX_0_L4_LENGTH_MSK 0xFF - -#define DMA_CFG_DESC_TX_0_CMD_EOP_POS 8 -#define DMA_CFG_DESC_TX_0_CMD_EOP_LEN 1 -#define DMA_CFG_DESC_TX_0_CMD_EOP_MSK 0x100 - -#define DMA_CFG_DESC_TX_0_CMD_DMA_IT_POS 10 -#define DMA_CFG_DESC_TX_0_CMD_DMA_IT_LEN 1 -#define DMA_CFG_DESC_TX_0_CMD_DMA_IT_MSK 0x400 - -#define DMA_CFG_DESC_TX_0_SEGMENT_BUF_DETAILS_POS 11 -#define DMA_CFG_DESC_TX_0_SEGMENT_BUF_DETAILS_LEN 2 -#define DMA_CFG_DESC_TX_0_SEGMENT_BUF_DETAILS_MSK 0x1800 - -#define DMA_CFG_DESC_TX_0_TCP_SEG_EN_POS 13 -#define DMA_CFG_DESC_TX_0_TCP_SEG_EN_LEN 1 -#define DMA_CFG_DESC_TX_0_TCP_SEG_EN_MSK 0x2000 - -#define DMA_CFG_DESC_TX_0_IPV4_CHECKSUM_EN_POS 14 -#define DMA_CFG_DESC_TX_0_IPV4_CHECKSUM_EN_LEN 1 -#define DMA_CFG_DESC_TX_0_IPV4_CHECKSUM_EN_MSK 0x4000 - -#define DMA_CFG_DESC_TX_0_TCP_UDP_CHECKSUM_EN_POS 15 -#define DMA_CFG_DESC_TX_0_TCP_UDP_CHECKSUM_EN_LEN 1 -#define DMA_CFG_DESC_TX_0_TCP_UDP_CHECKSUM_EN_MSK 0x8000 - -#define DMA_CFG_DESC_TX_0_QID_POS 16 -#define DMA_CFG_DESC_TX_0_QID_LEN 5 -#define DMA_CFG_DESC_TX_0_QID_MSK 0x1F0000 - -#define DMA_CFG_DESC_TX_0_PSEUDO_HEADER_CALC_EN_POS 21 -#define DMA_CFG_DESC_TX_0_PSEUDO_HEADER_CALC_EN_LEN 1 -#define DMA_CFG_DESC_TX_0_PSEUDO_HEADER_CALC_EN_MSK 0x200000 - -#define DMA_CFG_DESC_TX_0_L4_TYPE_POS 30 -#define DMA_CFG_DESC_TX_0_L4_TYPE_LEN 2 -#define DMA_CFG_DESC_TX_0_L4_TYPE_MSK 0xC0000000 - - -#define TX_DMA_STATUS_DU BIT(0) - -struct vring_tx_dma { - u32 d0; - u32 addr_low; - u16 addr_high; - u8 ip_length; - u8 b11; /* 0..6: mac_length; 7:ip_version */ - u8 error; /* 0..2: err; 3..7: reserved; */ - u8 status; /* 0: used; 1..7; reserved */ - u16 length; -} __packed; - -/* - * Rx descriptor - MAC part - * [dword 0] - * bit 0.. 3 : tid:4 The QoS (b3-0) TID Field - * bit 4.. 6 : connection_id:3 :The Source index that was found during - * Parsing the TA. This field is used to define the source of the packet - * bit 7 : reserved:1 - * bit 8.. 9 : mac_id:2 : The MAC virtual Ring number (always zero) - * bit 10..11 : frame_type:2 : The FC Control (b3-2) - MPDU Type - * (management, data, control and extension) - * bit 12..15 : frame_subtype:4 : The FC Control (b7-4) - Frame Subtype - * bit 16..27 : seq_number:12 The received Sequence number field - * bit 28..31 : extended:4 extended subtype - * [dword 1] - * bit 0.. 3 : reserved - * bit 4.. 5 : key_id:2 - * bit 6 : decrypt_bypass:1 - * bit 7 : security:1 - * bit 8.. 9 : ds_bits:2 - * bit 10 : a_msdu_present:1 from qos header - * bit 11 : a_msdu_type:1 from qos header - * bit 12 : a_mpdu:1 part of AMPDU aggregation - * bit 13 : broadcast:1 - * bit 14 : mutlicast:1 - * bit 15 : reserved:1 - * bit 16..20 : rx_mac_qid:5 The Queue Identifier that the packet - * is received from - * bit 21..24 : mcs:4 - * bit 25..28 : mic_icr:4 - * bit 29..31 : reserved:3 - * [dword 2] - * bit 0.. 2 : time_slot:3 The timeslot that the MPDU is received - * bit 3 : fc_protocol_ver:1 The FC Control (b0) - Protocol Version - * bit 4 : fc_order:1 The FC Control (b15) -Order - * bit 5.. 7 : qos_ack_policy:3 The QoS (b6-5) ack policy Field - * bit 8 : esop:1 The QoS (b4) ESOP field - * bit 9 : qos_rdg_more_ppdu:1 The QoS (b9) RDG field - * bit 10..14 : qos_reserved:5 The QoS (b14-10) Reserved field - * bit 15 : qos_ac_constraint:1 - * bit 16..31 : pn_15_0:16 low 2 bytes of PN - * [dword 3] - * bit 0..31 : pn_47_16:32 high 4 bytes of PN - */ -struct vring_rx_mac { - u32 d0; - u32 d1; - u16 w4; - u16 pn_15_0; - u32 pn_47_16; -} __packed; - -/* - * Rx descriptor - DMA part - * [dword 0] - * bit 0.. 7 : l4_length:8 layer 4 length - * bit 8.. 9 : reserved:2 - * bit 10 : cmd_dma_it:1 - * bit 11..15 : reserved:5 - * bit 16..29 : phy_info_length:14 - * bit 30..31 : l4_type:2 valid if the L4I bit is set in the status field - * [dword 1] - * bit 0..31 : addr_low:32 The payload buffer low address - * [dword 2] - * bit 0..15 : addr_high:16 The payload buffer high address - * bit 16..23 : ip_length:8 - * bit 24..30 : mac_length:7 - * bit 31 : ip_version:1 - * [dword 3] - * [byte 12] error - * [byte 13] status - * bit 0 : du:1 - * bit 1 : eop:1 - * bit 2 : error:1 - * bit 3 : mi:1 - * bit 4 : l3_identified:1 - * bit 5 : l4_identified:1 - * bit 6 : phy_info_included:1 - * bit 7 : reserved:1 - * [word 7] length - * - */ - -#define RX_DMA_D0_CMD_DMA_IT BIT(10) - -#define RX_DMA_STATUS_DU BIT(0) -#define RX_DMA_STATUS_ERROR BIT(2) -#define RX_DMA_STATUS_PHY_INFO BIT(6) - -struct vring_rx_dma { - u32 d0; - u32 addr_low; - u16 addr_high; - u8 ip_length; - u8 b11; - u8 error; - u8 status; - u16 length; -} __packed; - -struct vring_tx_desc { - struct vring_tx_mac mac; - struct vring_tx_dma dma; -} __packed; - -struct vring_rx_desc { - struct vring_rx_mac mac; - struct vring_rx_dma dma; -} __packed; - -union vring_desc { - struct vring_tx_desc tx; - struct vring_rx_desc rx; -} __packed; - -static inline int wil_rxdesc_tid(struct vring_rx_desc *d) -{ - return WIL_GET_BITS(d->mac.d0, 0, 3); -} - -static inline int wil_rxdesc_cid(struct vring_rx_desc *d) -{ - return WIL_GET_BITS(d->mac.d0, 4, 6); -} - -static inline int wil_rxdesc_mid(struct vring_rx_desc *d) -{ - return WIL_GET_BITS(d->mac.d0, 8, 9); -} - -static inline int wil_rxdesc_ftype(struct vring_rx_desc *d) -{ - return WIL_GET_BITS(d->mac.d0, 10, 11); -} - -static inline int wil_rxdesc_subtype(struct vring_rx_desc *d) -{ - return WIL_GET_BITS(d->mac.d0, 12, 15); -} - -static inline int wil_rxdesc_seq(struct vring_rx_desc *d) -{ - return WIL_GET_BITS(d->mac.d0, 16, 27); -} - -static inline int wil_rxdesc_ext_subtype(struct vring_rx_desc *d) -{ - return WIL_GET_BITS(d->mac.d0, 28, 31); -} - -static inline int wil_rxdesc_ds_bits(struct vring_rx_desc *d) -{ - return WIL_GET_BITS(d->mac.d1, 8, 9); -} - -static inline int wil_rxdesc_mcs(struct vring_rx_desc *d) -{ - return WIL_GET_BITS(d->mac.d1, 21, 24); -} - -static inline int wil_rxdesc_phy_length(struct vring_rx_desc *d) -{ - return WIL_GET_BITS(d->dma.d0, 16, 29); -} - -static inline struct vring_rx_desc *wil_skb_rxdesc(struct sk_buff *skb) -{ - return (void *)skb->cb; -} - -#endif /* WIL6210_TXRX_H */ diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h deleted file mode 100644 index 8f76ecd8a7e5..000000000000 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef __WIL6210_H__ -#define __WIL6210_H__ - -#include -#include -#include - -#define WIL_NAME "wil6210" - -/** - * extract bits [@b0:@b1] (inclusive) from the value @x - * it should be @b0 <= @b1, or result is incorrect - */ -static inline u32 WIL_GET_BITS(u32 x, int b0, int b1) -{ - return (x >> b0) & ((1 << (b1 - b0 + 1)) - 1); -} - -#define WIL6210_MEM_SIZE (2*1024*1024UL) - -#define WIL6210_RX_RING_SIZE (128) -#define WIL6210_TX_RING_SIZE (128) -#define WIL6210_MAX_TX_RINGS (24) - -/* Hardware definitions begin */ - -/* - * Mapping - * RGF File | Host addr | FW addr - * | | - * user_rgf | 0x000000 | 0x880000 - * dma_rgf | 0x001000 | 0x881000 - * pcie_rgf | 0x002000 | 0x882000 - * | | - */ - -/* Where various structures placed in host address space */ -#define WIL6210_FW_HOST_OFF (0x880000UL) - -#define HOSTADDR(fwaddr) (fwaddr - WIL6210_FW_HOST_OFF) - -/* - * Interrupt control registers block - * - * each interrupt controlled by the same bit in all registers - */ -struct RGF_ICR { - u32 ICC; /* Cause Control, RW: 0 - W1C, 1 - COR */ - u32 ICR; /* Cause, W1C/COR depending on ICC */ - u32 ICM; /* Cause masked (ICR & ~IMV), W1C/COR depending on ICC */ - u32 ICS; /* Cause Set, WO */ - u32 IMV; /* Mask, RW+S/C */ - u32 IMS; /* Mask Set, write 1 to set */ - u32 IMC; /* Mask Clear, write 1 to clear */ -} __packed; - -/* registers - FW addresses */ -#define RGF_USER_USER_SCRATCH_PAD (0x8802bc) -#define RGF_USER_USER_ICR (0x880b4c) /* struct RGF_ICR */ - #define BIT_USER_USER_ICR_SW_INT_2 BIT(18) -#define RGF_USER_CLKS_CTL_SW_RST_MASK_0 (0x880b14) -#define RGF_USER_MAC_CPU_0 (0x8801fc) -#define RGF_USER_USER_CPU_0 (0x8801e0) -#define RGF_USER_CLKS_CTL_SW_RST_VEC_0 (0x880b04) -#define RGF_USER_CLKS_CTL_SW_RST_VEC_1 (0x880b08) -#define RGF_USER_CLKS_CTL_SW_RST_VEC_2 (0x880b0c) -#define RGF_USER_CLKS_CTL_SW_RST_VEC_3 (0x880b10) - -#define RGF_DMA_PSEUDO_CAUSE (0x881c68) -#define RGF_DMA_PSEUDO_CAUSE_MASK_SW (0x881c6c) -#define RGF_DMA_PSEUDO_CAUSE_MASK_FW (0x881c70) - #define BIT_DMA_PSEUDO_CAUSE_RX BIT(0) - #define BIT_DMA_PSEUDO_CAUSE_TX BIT(1) - #define BIT_DMA_PSEUDO_CAUSE_MISC BIT(2) - -#define RGF_DMA_EP_TX_ICR (0x881bb4) /* struct RGF_ICR */ - #define BIT_DMA_EP_TX_ICR_TX_DONE BIT(0) - #define BIT_DMA_EP_TX_ICR_TX_DONE_N(n) BIT(n+1) /* n = [0..23] */ -#define RGF_DMA_EP_RX_ICR (0x881bd0) /* struct RGF_ICR */ - #define BIT_DMA_EP_RX_ICR_RX_DONE BIT(0) -#define RGF_DMA_EP_MISC_ICR (0x881bec) /* struct RGF_ICR */ - #define BIT_DMA_EP_MISC_ICR_RX_HTRSH BIT(0) - #define BIT_DMA_EP_MISC_ICR_TX_NO_ACT BIT(1) - #define BIT_DMA_EP_MISC_ICR_FW_INT(n) BIT(28+n) /* n = [0..3] */ - -/* Interrupt moderation control */ -#define RGF_DMA_ITR_CNT_TRSH (0x881c5c) -#define RGF_DMA_ITR_CNT_DATA (0x881c60) -#define RGF_DMA_ITR_CNT_CRL (0x881C64) - #define BIT_DMA_ITR_CNT_CRL_EN BIT(0) - #define BIT_DMA_ITR_CNT_CRL_EXT_TICK BIT(1) - #define BIT_DMA_ITR_CNT_CRL_FOREVER BIT(2) - #define BIT_DMA_ITR_CNT_CRL_CLR BIT(3) - #define BIT_DMA_ITR_CNT_CRL_REACH_TRSH BIT(4) - -/* popular locations */ -#define HOST_MBOX HOSTADDR(RGF_USER_USER_SCRATCH_PAD) -#define HOST_SW_INT (HOSTADDR(RGF_USER_USER_ICR) + \ - offsetof(struct RGF_ICR, ICS)) -#define SW_INT_MBOX BIT_USER_USER_ICR_SW_INT_2 - -/* ISR register bits */ -#define ISR_MISC_FW_READY BIT_DMA_EP_MISC_ICR_FW_INT(0) -#define ISR_MISC_MBOX_EVT BIT_DMA_EP_MISC_ICR_FW_INT(1) -#define ISR_MISC_FW_ERROR BIT_DMA_EP_MISC_ICR_FW_INT(3) - -/* Hardware definitions end */ - -struct wil6210_mbox_ring { - u32 base; - u16 entry_size; /* max. size of mbox entry, incl. all headers */ - u16 size; - u32 tail; - u32 head; -} __packed; - -struct wil6210_mbox_ring_desc { - __le32 sync; - __le32 addr; -} __packed; - -/* at HOST_OFF_WIL6210_MBOX_CTL */ -struct wil6210_mbox_ctl { - struct wil6210_mbox_ring tx; - struct wil6210_mbox_ring rx; -} __packed; - -struct wil6210_mbox_hdr { - __le16 seq; - __le16 len; /* payload, bytes after this header */ - __le16 type; - u8 flags; - u8 reserved; -} __packed; - -#define WIL_MBOX_HDR_TYPE_WMI (0) - -/* max. value for wil6210_mbox_hdr.len */ -#define MAX_MBOXITEM_SIZE (240) - -struct wil6210_mbox_hdr_wmi { - u8 reserved0[2]; - __le16 id; - __le16 info1; /* bits [0..3] - device_id, rest - unused */ - u8 reserved1[2]; -} __packed; - -struct pending_wmi_event { - struct list_head list; - struct { - struct wil6210_mbox_hdr hdr; - struct wil6210_mbox_hdr_wmi wmi; - u8 data[0]; - } __packed event; -}; - -union vring_desc; - -struct vring { - dma_addr_t pa; - volatile union vring_desc *va; /* vring_desc[size], WriteBack by DMA */ - u16 size; /* number of vring_desc elements */ - u32 swtail; - u32 swhead; - u32 hwtail; /* write here to inform hw */ - void **ctx; /* void *ctx[size] - software context */ -}; - -enum { /* for wil6210_priv.status */ - wil_status_fwready = 0, - wil_status_fwconnected, - wil_status_dontscan, - wil_status_reset_done, - wil_status_irqen, /* FIXME: interrupts enabled - for debug */ -}; - -struct pci_dev; - -struct wil6210_stats { - u64 tsf; - u32 snr; - u16 last_mcs_rx; - u16 bf_mcs; /* last BF, used for Tx */ - u16 my_rx_sector; - u16 my_tx_sector; - u16 peer_rx_sector; - u16 peer_tx_sector; -}; - -struct wil6210_priv { - struct pci_dev *pdev; - int n_msi; - struct wireless_dev *wdev; - void __iomem *csr; - ulong status; - u32 fw_version; - u8 n_mids; /* number of additional MIDs as reported by FW */ - /* profile */ - u32 monitor_flags; - u32 secure_pcp; /* create secure PCP? */ - int sinfo_gen; - /* cached ISR registers */ - u32 isr_misc; - /* mailbox related */ - struct mutex wmi_mutex; - struct wil6210_mbox_ctl mbox_ctl; - struct completion wmi_ready; - u16 wmi_seq; - u16 reply_id; /**< wait for this WMI event */ - void *reply_buf; - u16 reply_size; - struct workqueue_struct *wmi_wq; /* for deferred calls */ - struct work_struct wmi_event_worker; - struct workqueue_struct *wmi_wq_conn; /* for connect worker */ - struct work_struct connect_worker; - struct work_struct disconnect_worker; - struct timer_list connect_timer; - int pending_connect_cid; - struct list_head pending_wmi_ev; - /* - * protect pending_wmi_ev - * - fill in IRQ from wil6210_irq_misc, - * - consumed in thread by wmi_event_worker - */ - spinlock_t wmi_ev_lock; - /* DMA related */ - struct vring vring_rx; - struct vring vring_tx[WIL6210_MAX_TX_RINGS]; - u8 dst_addr[WIL6210_MAX_TX_RINGS][ETH_ALEN]; - /* scan */ - struct cfg80211_scan_request *scan_request; - - struct mutex mutex; /* for wil6210_priv access in wil_{up|down} */ - /* statistics */ - struct wil6210_stats stats; - /* debugfs */ - struct dentry *debug; - struct debugfs_blob_wrapper fw_code_blob; - struct debugfs_blob_wrapper fw_data_blob; - struct debugfs_blob_wrapper fw_peri_blob; - struct debugfs_blob_wrapper uc_code_blob; - struct debugfs_blob_wrapper uc_data_blob; - struct debugfs_blob_wrapper rgf_blob; -}; - -#define wil_to_wiphy(i) (i->wdev->wiphy) -#define wil_to_dev(i) (wiphy_dev(wil_to_wiphy(i))) -#define wiphy_to_wil(w) (struct wil6210_priv *)(wiphy_priv(w)) -#define wil_to_wdev(i) (i->wdev) -#define wdev_to_wil(w) (struct wil6210_priv *)(wdev_priv(w)) -#define wil_to_ndev(i) (wil_to_wdev(i)->netdev) -#define ndev_to_wil(n) (wdev_to_wil(n->ieee80211_ptr)) - -#define wil_dbg(wil, fmt, arg...) netdev_dbg(wil_to_ndev(wil), fmt, ##arg) -#define wil_info(wil, fmt, arg...) netdev_info(wil_to_ndev(wil), fmt, ##arg) -#define wil_err(wil, fmt, arg...) netdev_err(wil_to_ndev(wil), fmt, ##arg) - -#define wil_dbg_irq(wil, fmt, arg...) wil_dbg(wil, "DBG[ IRQ]" fmt, ##arg) -#define wil_dbg_txrx(wil, fmt, arg...) wil_dbg(wil, "DBG[TXRX]" fmt, ##arg) -#define wil_dbg_wmi(wil, fmt, arg...) wil_dbg(wil, "DBG[ WMI]" fmt, ##arg) -#define wil_dbg_misc(wil, fmt, arg...) wil_dbg(wil, "DBG[MISC]" fmt, ##arg) - -#define wil_hex_dump_txrx(prefix_str, prefix_type, rowsize, \ - groupsize, buf, len, ascii) \ - print_hex_dump_debug("DBG[TXRX]" prefix_str,\ - prefix_type, rowsize, \ - groupsize, buf, len, ascii) - -#define wil_hex_dump_wmi(prefix_str, prefix_type, rowsize, \ - groupsize, buf, len, ascii) \ - print_hex_dump_debug("DBG[ WMI]" prefix_str,\ - prefix_type, rowsize, \ - groupsize, buf, len, ascii) - -void wil_memcpy_fromio_32(void *dst, const volatile void __iomem *src, - size_t count); -void wil_memcpy_toio_32(volatile void __iomem *dst, const void *src, - size_t count); - -void *wil_if_alloc(struct device *dev, void __iomem *csr); -void wil_if_free(struct wil6210_priv *wil); -int wil_if_add(struct wil6210_priv *wil); -void wil_if_remove(struct wil6210_priv *wil); -int wil_priv_init(struct wil6210_priv *wil); -void wil_priv_deinit(struct wil6210_priv *wil); -int wil_reset(struct wil6210_priv *wil); -void wil_link_on(struct wil6210_priv *wil); -void wil_link_off(struct wil6210_priv *wil); -int wil_up(struct wil6210_priv *wil); -int wil_down(struct wil6210_priv *wil); -void wil_mbox_ring_le2cpus(struct wil6210_mbox_ring *r); - -void __iomem *wmi_buffer(struct wil6210_priv *wil, __le32 ptr); -void __iomem *wmi_addr(struct wil6210_priv *wil, u32 ptr); -int wmi_read_hdr(struct wil6210_priv *wil, __le32 ptr, - struct wil6210_mbox_hdr *hdr); -int wmi_send(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len); -void wmi_recv_cmd(struct wil6210_priv *wil); -int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len, - u16 reply_id, void *reply, u8 reply_size, int to_msec); -void wmi_event_worker(struct work_struct *work); -void wmi_event_flush(struct wil6210_priv *wil); -int wmi_set_ssid(struct wil6210_priv *wil, u8 ssid_len, const void *ssid); -int wmi_get_ssid(struct wil6210_priv *wil, u8 *ssid_len, void *ssid); -int wmi_set_channel(struct wil6210_priv *wil, int channel); -int wmi_get_channel(struct wil6210_priv *wil, int *channel); -int wmi_tx_eapol(struct wil6210_priv *wil, struct sk_buff *skb); -int wmi_del_cipher_key(struct wil6210_priv *wil, u8 key_index, - const void *mac_addr); -int wmi_add_cipher_key(struct wil6210_priv *wil, u8 key_index, - const void *mac_addr, int key_len, const void *key); -int wmi_echo(struct wil6210_priv *wil); -int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie); -int wmi_rx_chain_add(struct wil6210_priv *wil, struct vring *vring); -int wmi_p2p_cfg(struct wil6210_priv *wil, int channel); -int wmi_get_temperature(struct wil6210_priv *wil, u32 *t_m, u32 *t_r); - -int wil6210_init_irq(struct wil6210_priv *wil, int irq); -void wil6210_fini_irq(struct wil6210_priv *wil, int irq); -void wil6210_disable_irq(struct wil6210_priv *wil); -void wil6210_enable_irq(struct wil6210_priv *wil); - -int wil6210_debugfs_init(struct wil6210_priv *wil); -void wil6210_debugfs_remove(struct wil6210_priv *wil); - -struct wireless_dev *wil_cfg80211_init(struct device *dev); -void wil_wdev_free(struct wil6210_priv *wil); - -int wmi_set_mac_address(struct wil6210_priv *wil, void *addr); -int wmi_pcp_start(struct wil6210_priv *wil, int bi, u8 wmi_nettype, u8 chan); -int wmi_pcp_stop(struct wil6210_priv *wil); -void wil6210_disconnect(struct wil6210_priv *wil, void *bssid); - -int wil_rx_init(struct wil6210_priv *wil); -void wil_rx_fini(struct wil6210_priv *wil); - -/* TX API */ -int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size, - int cid, int tid); -void wil_vring_fini_tx(struct wil6210_priv *wil, int id); - -netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev); -void wil_tx_complete(struct wil6210_priv *wil, int ringid); - -/* RX API */ -void wil_rx_handle(struct wil6210_priv *wil); - -int wil_iftype_nl2wmi(enum nl80211_iftype type); - -#endif /* __WIL6210_H__ */ diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c deleted file mode 100644 index 45b04e383f9a..000000000000 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ /dev/null @@ -1,1088 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -#include "wil6210.h" -#include "txrx.h" -#include "wmi.h" - -/** - * WMI event receiving - theory of operations - * - * When firmware about to report WMI event, it fills memory area - * in the mailbox and raises misc. IRQ. Thread interrupt handler invoked for - * the misc IRQ, function @wmi_recv_cmd called by thread IRQ handler. - * - * @wmi_recv_cmd reads event, allocates memory chunk and attaches it to the - * event list @wil->pending_wmi_ev. Then, work queue @wil->wmi_wq wakes up - * and handles events within the @wmi_event_worker. Every event get detached - * from list, processed and deleted. - * - * Purpose for this mechanism is to release IRQ thread; otherwise, - * if WMI event handling involves another WMI command flow, this 2-nd flow - * won't be completed because of blocked IRQ thread. - */ - -/** - * Addressing - theory of operations - * - * There are several buses present on the WIL6210 card. - * Same memory areas are visible at different address on - * the different busses. There are 3 main bus masters: - * - MAC CPU (ucode) - * - User CPU (firmware) - * - AHB (host) - * - * On the PCI bus, there is one BAR (BAR0) of 2Mb size, exposing - * AHB addresses starting from 0x880000 - * - * Internally, firmware uses addresses that allows faster access but - * are invisible from the host. To read from these addresses, alternative - * AHB address must be used. - * - * Memory mapping - * Linker address PCI/Host address - * 0x880000 .. 0xa80000 2Mb BAR0 - * 0x800000 .. 0x807000 0x900000 .. 0x907000 28k DCCM - * 0x840000 .. 0x857000 0x908000 .. 0x91f000 92k PERIPH - */ - -/** - * @fw_mapping provides memory remapping table - */ -static const struct { - u32 from; /* linker address - from, inclusive */ - u32 to; /* linker address - to, exclusive */ - u32 host; /* PCI/Host address - BAR0 + 0x880000 */ -} fw_mapping[] = { - {0x000000, 0x040000, 0x8c0000}, /* FW code RAM 256k */ - {0x800000, 0x808000, 0x900000}, /* FW data RAM 32k */ - {0x840000, 0x860000, 0x908000}, /* peripheral data RAM 128k/96k used */ - {0x880000, 0x88a000, 0x880000}, /* various RGF */ - {0x8c0000, 0x932000, 0x8c0000}, /* trivial mapping for upper area */ - /* - * 920000..930000 ucode code RAM - * 930000..932000 ucode data RAM - */ -}; - -/** - * return AHB address for given firmware/ucode internal (linker) address - * @x - internal address - * If address have no valid AHB mapping, return 0 - */ -static u32 wmi_addr_remap(u32 x) -{ - uint i; - - for (i = 0; i < ARRAY_SIZE(fw_mapping); i++) { - if ((x >= fw_mapping[i].from) && (x < fw_mapping[i].to)) - return x + fw_mapping[i].host - fw_mapping[i].from; - } - - return 0; -} - -/** - * Check address validity for WMI buffer; remap if needed - * @ptr - internal (linker) fw/ucode address - * - * Valid buffer should be DWORD aligned - * - * return address for accessing buffer from the host; - * if buffer is not valid, return NULL. - */ -void __iomem *wmi_buffer(struct wil6210_priv *wil, __le32 ptr_) -{ - u32 off; - u32 ptr = le32_to_cpu(ptr_); - - if (ptr % 4) - return NULL; - - ptr = wmi_addr_remap(ptr); - if (ptr < WIL6210_FW_HOST_OFF) - return NULL; - - off = HOSTADDR(ptr); - if (off > WIL6210_MEM_SIZE - 4) - return NULL; - - return wil->csr + off; -} - -/** - * Check address validity - */ -void __iomem *wmi_addr(struct wil6210_priv *wil, u32 ptr) -{ - u32 off; - - if (ptr % 4) - return NULL; - - if (ptr < WIL6210_FW_HOST_OFF) - return NULL; - - off = HOSTADDR(ptr); - if (off > WIL6210_MEM_SIZE - 4) - return NULL; - - return wil->csr + off; -} - -int wmi_read_hdr(struct wil6210_priv *wil, __le32 ptr, - struct wil6210_mbox_hdr *hdr) -{ - void __iomem *src = wmi_buffer(wil, ptr); - if (!src) - return -EINVAL; - - wil_memcpy_fromio_32(hdr, src, sizeof(*hdr)); - - return 0; -} - -static int __wmi_send(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len) -{ - struct { - struct wil6210_mbox_hdr hdr; - struct wil6210_mbox_hdr_wmi wmi; - } __packed cmd = { - .hdr = { - .type = WIL_MBOX_HDR_TYPE_WMI, - .flags = 0, - .len = cpu_to_le16(sizeof(cmd.wmi) + len), - }, - .wmi = { - .id = cpu_to_le16(cmdid), - .info1 = 0, - }, - }; - struct wil6210_mbox_ring *r = &wil->mbox_ctl.tx; - struct wil6210_mbox_ring_desc d_head; - u32 next_head; - void __iomem *dst; - void __iomem *head = wmi_addr(wil, r->head); - uint retry; - - if (sizeof(cmd) + len > r->entry_size) { - wil_err(wil, "WMI size too large: %d bytes, max is %d\n", - (int)(sizeof(cmd) + len), r->entry_size); - return -ERANGE; - } - - might_sleep(); - - if (!test_bit(wil_status_fwready, &wil->status)) { - wil_err(wil, "FW not ready\n"); - return -EAGAIN; - } - - if (!head) { - wil_err(wil, "WMI head is garbage: 0x%08x\n", r->head); - return -EINVAL; - } - /* read Tx head till it is not busy */ - for (retry = 5; retry > 0; retry--) { - wil_memcpy_fromio_32(&d_head, head, sizeof(d_head)); - if (d_head.sync == 0) - break; - msleep(20); - } - if (d_head.sync != 0) { - wil_err(wil, "WMI head busy\n"); - return -EBUSY; - } - /* next head */ - next_head = r->base + ((r->head - r->base + sizeof(d_head)) % r->size); - wil_dbg_wmi(wil, "Head 0x%08x -> 0x%08x\n", r->head, next_head); - /* wait till FW finish with previous command */ - for (retry = 5; retry > 0; retry--) { - r->tail = ioread32(wil->csr + HOST_MBOX + - offsetof(struct wil6210_mbox_ctl, tx.tail)); - if (next_head != r->tail) - break; - msleep(20); - } - if (next_head == r->tail) { - wil_err(wil, "WMI ring full\n"); - return -EBUSY; - } - dst = wmi_buffer(wil, d_head.addr); - if (!dst) { - wil_err(wil, "invalid WMI buffer: 0x%08x\n", - le32_to_cpu(d_head.addr)); - return -EINVAL; - } - cmd.hdr.seq = cpu_to_le16(++wil->wmi_seq); - /* set command */ - wil_dbg_wmi(wil, "WMI command 0x%04x [%d]\n", cmdid, len); - wil_hex_dump_wmi("Cmd ", DUMP_PREFIX_OFFSET, 16, 1, &cmd, - sizeof(cmd), true); - wil_hex_dump_wmi("cmd ", DUMP_PREFIX_OFFSET, 16, 1, buf, - len, true); - wil_memcpy_toio_32(dst, &cmd, sizeof(cmd)); - wil_memcpy_toio_32(dst + sizeof(cmd), buf, len); - /* mark entry as full */ - iowrite32(1, wil->csr + HOSTADDR(r->head) + - offsetof(struct wil6210_mbox_ring_desc, sync)); - /* advance next ptr */ - iowrite32(r->head = next_head, wil->csr + HOST_MBOX + - offsetof(struct wil6210_mbox_ctl, tx.head)); - - /* interrupt to FW */ - iowrite32(SW_INT_MBOX, wil->csr + HOST_SW_INT); - - return 0; -} - -int wmi_send(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len) -{ - int rc; - - mutex_lock(&wil->wmi_mutex); - rc = __wmi_send(wil, cmdid, buf, len); - mutex_unlock(&wil->wmi_mutex); - - return rc; -} - -/*=== Event handlers ===*/ -static void wmi_evt_ready(struct wil6210_priv *wil, int id, void *d, int len) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct wireless_dev *wdev = wil->wdev; - struct wmi_ready_event *evt = d; - wil->fw_version = le32_to_cpu(evt->sw_version); - wil->n_mids = evt->numof_additional_mids; - - wil_dbg_wmi(wil, "FW ver. %d; MAC %pM; %d MID's\n", wil->fw_version, - evt->mac, wil->n_mids); - - if (!is_valid_ether_addr(ndev->dev_addr)) { - memcpy(ndev->dev_addr, evt->mac, ETH_ALEN); - memcpy(ndev->perm_addr, evt->mac, ETH_ALEN); - } - snprintf(wdev->wiphy->fw_version, sizeof(wdev->wiphy->fw_version), - "%d", wil->fw_version); -} - -static void wmi_evt_fw_ready(struct wil6210_priv *wil, int id, void *d, - int len) -{ - wil_dbg_wmi(wil, "WMI: FW ready\n"); - - set_bit(wil_status_fwready, &wil->status); - /* reuse wmi_ready for the firmware ready indication */ - complete(&wil->wmi_ready); -} - -static void wmi_evt_rx_mgmt(struct wil6210_priv *wil, int id, void *d, int len) -{ - struct wmi_rx_mgmt_packet_event *data = d; - struct wiphy *wiphy = wil_to_wiphy(wil); - struct ieee80211_mgmt *rx_mgmt_frame = - (struct ieee80211_mgmt *)data->payload; - int ch_no = data->info.channel+1; - u32 freq = ieee80211_channel_to_frequency(ch_no, - IEEE80211_BAND_60GHZ); - struct ieee80211_channel *channel = ieee80211_get_channel(wiphy, freq); - /* TODO convert LE to CPU */ - s32 signal = 0; /* TODO */ - __le16 fc = rx_mgmt_frame->frame_control; - u32 d_len = le32_to_cpu(data->info.len); - u16 d_status = le16_to_cpu(data->info.status); - - wil_dbg_wmi(wil, "MGMT: channel %d MCS %d SNR %d\n", - data->info.channel, data->info.mcs, data->info.snr); - wil_dbg_wmi(wil, "status 0x%04x len %d stype %04x\n", d_status, d_len, - le16_to_cpu(data->info.stype)); - wil_dbg_wmi(wil, "qid %d mid %d cid %d\n", - data->info.qid, data->info.mid, data->info.cid); - - if (!channel) { - wil_err(wil, "Frame on unsupported channel\n"); - return; - } - - if (ieee80211_is_beacon(fc) || ieee80211_is_probe_resp(fc)) { - struct cfg80211_bss *bss; - - bss = cfg80211_inform_bss_frame(wiphy, channel, rx_mgmt_frame, - d_len, signal, GFP_KERNEL); - if (bss) { - wil_dbg_wmi(wil, "Added BSS %pM\n", - rx_mgmt_frame->bssid); - cfg80211_put_bss(wiphy, bss); - } else { - wil_err(wil, "cfg80211_inform_bss() failed\n"); - } - } else { - cfg80211_rx_mgmt(wil->wdev, freq, signal, - (void *)rx_mgmt_frame, d_len, GFP_KERNEL); - } -} - -static void wmi_evt_scan_complete(struct wil6210_priv *wil, int id, - void *d, int len) -{ - if (wil->scan_request) { - struct wmi_scan_complete_event *data = d; - bool aborted = (data->status != 0); - - wil_dbg_wmi(wil, "SCAN_COMPLETE(0x%08x)\n", data->status); - cfg80211_scan_done(wil->scan_request, aborted); - wil->scan_request = NULL; - } else { - wil_err(wil, "SCAN_COMPLETE while not scanning\n"); - } -} - -static void wmi_evt_connect(struct wil6210_priv *wil, int id, void *d, int len) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct wireless_dev *wdev = wil->wdev; - struct wmi_connect_event *evt = d; - int ch; /* channel number */ - struct station_info sinfo; - u8 *assoc_req_ie, *assoc_resp_ie; - size_t assoc_req_ielen, assoc_resp_ielen; - /* capinfo(u16) + listen_interval(u16) + IEs */ - const size_t assoc_req_ie_offset = sizeof(u16) * 2; - /* capinfo(u16) + status_code(u16) + associd(u16) + IEs */ - const size_t assoc_resp_ie_offset = sizeof(u16) * 3; - - if (len < sizeof(*evt)) { - wil_err(wil, "Connect event too short : %d bytes\n", len); - return; - } - if (len != sizeof(*evt) + evt->beacon_ie_len + evt->assoc_req_len + - evt->assoc_resp_len) { - wil_err(wil, - "Connect event corrupted : %d != %d + %d + %d + %d\n", - len, (int)sizeof(*evt), evt->beacon_ie_len, - evt->assoc_req_len, evt->assoc_resp_len); - return; - } - ch = evt->channel + 1; - wil_dbg_wmi(wil, "Connect %pM channel [%d] cid %d\n", - evt->bssid, ch, evt->cid); - wil_hex_dump_wmi("connect AI : ", DUMP_PREFIX_OFFSET, 16, 1, - evt->assoc_info, len - sizeof(*evt), true); - - /* figure out IE's */ - assoc_req_ie = &evt->assoc_info[evt->beacon_ie_len + - assoc_req_ie_offset]; - assoc_req_ielen = evt->assoc_req_len - assoc_req_ie_offset; - if (evt->assoc_req_len <= assoc_req_ie_offset) { - assoc_req_ie = NULL; - assoc_req_ielen = 0; - } - - assoc_resp_ie = &evt->assoc_info[evt->beacon_ie_len + - evt->assoc_req_len + - assoc_resp_ie_offset]; - assoc_resp_ielen = evt->assoc_resp_len - assoc_resp_ie_offset; - if (evt->assoc_resp_len <= assoc_resp_ie_offset) { - assoc_resp_ie = NULL; - assoc_resp_ielen = 0; - } - - if ((wdev->iftype == NL80211_IFTYPE_STATION) || - (wdev->iftype == NL80211_IFTYPE_P2P_CLIENT)) { - if (wdev->sme_state != CFG80211_SME_CONNECTING) { - wil_err(wil, "Not in connecting state\n"); - return; - } - del_timer_sync(&wil->connect_timer); - cfg80211_connect_result(ndev, evt->bssid, - assoc_req_ie, assoc_req_ielen, - assoc_resp_ie, assoc_resp_ielen, - WLAN_STATUS_SUCCESS, GFP_KERNEL); - - } else if ((wdev->iftype == NL80211_IFTYPE_AP) || - (wdev->iftype == NL80211_IFTYPE_P2P_GO)) { - memset(&sinfo, 0, sizeof(sinfo)); - - sinfo.generation = wil->sinfo_gen++; - - if (assoc_req_ie) { - sinfo.assoc_req_ies = assoc_req_ie; - sinfo.assoc_req_ies_len = assoc_req_ielen; - sinfo.filled |= STATION_INFO_ASSOC_REQ_IES; - } - - cfg80211_new_sta(ndev, evt->bssid, &sinfo, GFP_KERNEL); - } - set_bit(wil_status_fwconnected, &wil->status); - - /* FIXME FW can transmit only ucast frames to peer */ - /* FIXME real ring_id instead of hard coded 0 */ - memcpy(wil->dst_addr[0], evt->bssid, ETH_ALEN); - - wil->pending_connect_cid = evt->cid; - queue_work(wil->wmi_wq_conn, &wil->connect_worker); -} - -static void wmi_evt_disconnect(struct wil6210_priv *wil, int id, - void *d, int len) -{ - struct wmi_disconnect_event *evt = d; - - wil_dbg_wmi(wil, "Disconnect %pM reason %d proto %d wmi\n", - evt->bssid, - evt->protocol_reason_status, evt->disconnect_reason); - - wil->sinfo_gen++; - - wil6210_disconnect(wil, evt->bssid); -} - -static void wmi_evt_notify(struct wil6210_priv *wil, int id, void *d, int len) -{ - struct wmi_notify_req_done_event *evt = d; - - if (len < sizeof(*evt)) { - wil_err(wil, "Short NOTIFY event\n"); - return; - } - - wil->stats.tsf = le64_to_cpu(evt->tsf); - wil->stats.snr = le32_to_cpu(evt->snr_val); - wil->stats.bf_mcs = le16_to_cpu(evt->bf_mcs); - wil->stats.my_rx_sector = le16_to_cpu(evt->my_rx_sector); - wil->stats.my_tx_sector = le16_to_cpu(evt->my_tx_sector); - wil->stats.peer_rx_sector = le16_to_cpu(evt->other_rx_sector); - wil->stats.peer_tx_sector = le16_to_cpu(evt->other_tx_sector); - wil_dbg_wmi(wil, "Link status, MCS %d TSF 0x%016llx\n" - "BF status 0x%08x SNR 0x%08x\n" - "Tx Tpt %d goodput %d Rx goodput %d\n" - "Sectors(rx:tx) my %d:%d peer %d:%d\n", - wil->stats.bf_mcs, wil->stats.tsf, evt->status, - wil->stats.snr, le32_to_cpu(evt->tx_tpt), - le32_to_cpu(evt->tx_goodput), le32_to_cpu(evt->rx_goodput), - wil->stats.my_rx_sector, wil->stats.my_tx_sector, - wil->stats.peer_rx_sector, wil->stats.peer_tx_sector); -} - -/* - * Firmware reports EAPOL frame using WME event. - * Reconstruct Ethernet frame and deliver it via normal Rx - */ -static void wmi_evt_eapol_rx(struct wil6210_priv *wil, int id, - void *d, int len) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct wmi_eapol_rx_event *evt = d; - u16 eapol_len = le16_to_cpu(evt->eapol_len); - int sz = eapol_len + ETH_HLEN; - struct sk_buff *skb; - struct ethhdr *eth; - - wil_dbg_wmi(wil, "EAPOL len %d from %pM\n", eapol_len, - evt->src_mac); - - if (eapol_len > 196) { /* TODO: revisit size limit */ - wil_err(wil, "EAPOL too large\n"); - return; - } - - skb = alloc_skb(sz, GFP_KERNEL); - if (!skb) { - wil_err(wil, "Failed to allocate skb\n"); - return; - } - eth = (struct ethhdr *)skb_put(skb, ETH_HLEN); - memcpy(eth->h_dest, ndev->dev_addr, ETH_ALEN); - memcpy(eth->h_source, evt->src_mac, ETH_ALEN); - eth->h_proto = cpu_to_be16(ETH_P_PAE); - memcpy(skb_put(skb, eapol_len), evt->eapol, eapol_len); - skb->protocol = eth_type_trans(skb, ndev); - if (likely(netif_rx_ni(skb) == NET_RX_SUCCESS)) { - ndev->stats.rx_packets++; - ndev->stats.rx_bytes += skb->len; - } else { - ndev->stats.rx_dropped++; - } -} - -static void wmi_evt_linkup(struct wil6210_priv *wil, int id, void *d, int len) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct wmi_data_port_open_event *evt = d; - - wil_dbg_wmi(wil, "Link UP for CID %d\n", evt->cid); - - netif_carrier_on(ndev); -} - -static void wmi_evt_linkdown(struct wil6210_priv *wil, int id, void *d, int len) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct wmi_wbe_link_down_event *evt = d; - - wil_dbg_wmi(wil, "Link DOWN for CID %d, reason %d\n", - evt->cid, le32_to_cpu(evt->reason)); - - netif_carrier_off(ndev); -} - -static void wmi_evt_ba_status(struct wil6210_priv *wil, int id, void *d, - int len) -{ - struct wmi_vring_ba_status_event *evt = d; - - wil_dbg_wmi(wil, "BACK[%d] %s {%d} timeout %d\n", - evt->ringid, evt->status ? "N/A" : "OK", evt->agg_wsize, - __le16_to_cpu(evt->ba_timeout)); -} - -static const struct { - int eventid; - void (*handler)(struct wil6210_priv *wil, int eventid, - void *data, int data_len); -} wmi_evt_handlers[] = { - {WMI_READY_EVENTID, wmi_evt_ready}, - {WMI_FW_READY_EVENTID, wmi_evt_fw_ready}, - {WMI_RX_MGMT_PACKET_EVENTID, wmi_evt_rx_mgmt}, - {WMI_SCAN_COMPLETE_EVENTID, wmi_evt_scan_complete}, - {WMI_CONNECT_EVENTID, wmi_evt_connect}, - {WMI_DISCONNECT_EVENTID, wmi_evt_disconnect}, - {WMI_NOTIFY_REQ_DONE_EVENTID, wmi_evt_notify}, - {WMI_EAPOL_RX_EVENTID, wmi_evt_eapol_rx}, - {WMI_DATA_PORT_OPEN_EVENTID, wmi_evt_linkup}, - {WMI_WBE_LINKDOWN_EVENTID, wmi_evt_linkdown}, - {WMI_BA_STATUS_EVENTID, wmi_evt_ba_status}, -}; - -/* - * Run in IRQ context - * Extract WMI command from mailbox. Queue it to the @wil->pending_wmi_ev - * that will be eventually handled by the @wmi_event_worker in the thread - * context of thread "wil6210_wmi" - */ -void wmi_recv_cmd(struct wil6210_priv *wil) -{ - struct wil6210_mbox_ring_desc d_tail; - struct wil6210_mbox_hdr hdr; - struct wil6210_mbox_ring *r = &wil->mbox_ctl.rx; - struct pending_wmi_event *evt; - u8 *cmd; - void __iomem *src; - ulong flags; - - if (!test_bit(wil_status_reset_done, &wil->status)) { - wil_err(wil, "Reset not completed\n"); - return; - } - - for (;;) { - u16 len; - - r->head = ioread32(wil->csr + HOST_MBOX + - offsetof(struct wil6210_mbox_ctl, rx.head)); - if (r->tail == r->head) - return; - - /* read cmd from tail */ - wil_memcpy_fromio_32(&d_tail, wil->csr + HOSTADDR(r->tail), - sizeof(struct wil6210_mbox_ring_desc)); - if (d_tail.sync == 0) { - wil_err(wil, "Mbox evt not owned by FW?\n"); - return; - } - - if (0 != wmi_read_hdr(wil, d_tail.addr, &hdr)) { - wil_err(wil, "Mbox evt at 0x%08x?\n", - le32_to_cpu(d_tail.addr)); - return; - } - - len = le16_to_cpu(hdr.len); - src = wmi_buffer(wil, d_tail.addr) + - sizeof(struct wil6210_mbox_hdr); - evt = kmalloc(ALIGN(offsetof(struct pending_wmi_event, - event.wmi) + len, 4), - GFP_KERNEL); - if (!evt) - return; - - evt->event.hdr = hdr; - cmd = (void *)&evt->event.wmi; - wil_memcpy_fromio_32(cmd, src, len); - /* mark entry as empty */ - iowrite32(0, wil->csr + HOSTADDR(r->tail) + - offsetof(struct wil6210_mbox_ring_desc, sync)); - /* indicate */ - wil_dbg_wmi(wil, "Mbox evt %04x %04x %04x %02x\n", - le16_to_cpu(hdr.seq), len, le16_to_cpu(hdr.type), - hdr.flags); - if ((hdr.type == WIL_MBOX_HDR_TYPE_WMI) && - (len >= sizeof(struct wil6210_mbox_hdr_wmi))) { - wil_dbg_wmi(wil, "WMI event 0x%04x\n", - evt->event.wmi.id); - } - wil_hex_dump_wmi("evt ", DUMP_PREFIX_OFFSET, 16, 1, - &evt->event.hdr, sizeof(hdr) + len, true); - - /* advance tail */ - r->tail = r->base + ((r->tail - r->base + - sizeof(struct wil6210_mbox_ring_desc)) % r->size); - iowrite32(r->tail, wil->csr + HOST_MBOX + - offsetof(struct wil6210_mbox_ctl, rx.tail)); - - /* add to the pending list */ - spin_lock_irqsave(&wil->wmi_ev_lock, flags); - list_add_tail(&evt->list, &wil->pending_wmi_ev); - spin_unlock_irqrestore(&wil->wmi_ev_lock, flags); - { - int q = queue_work(wil->wmi_wq, - &wil->wmi_event_worker); - wil_dbg_wmi(wil, "queue_work -> %d\n", q); - } - } -} - -int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len, - u16 reply_id, void *reply, u8 reply_size, int to_msec) -{ - int rc; - int remain; - - mutex_lock(&wil->wmi_mutex); - - rc = __wmi_send(wil, cmdid, buf, len); - if (rc) - goto out; - - wil->reply_id = reply_id; - wil->reply_buf = reply; - wil->reply_size = reply_size; - remain = wait_for_completion_timeout(&wil->wmi_ready, - msecs_to_jiffies(to_msec)); - if (0 == remain) { - wil_err(wil, "wmi_call(0x%04x->0x%04x) timeout %d msec\n", - cmdid, reply_id, to_msec); - rc = -ETIME; - } else { - wil_dbg_wmi(wil, - "wmi_call(0x%04x->0x%04x) completed in %d msec\n", - cmdid, reply_id, - to_msec - jiffies_to_msecs(remain)); - } - wil->reply_id = 0; - wil->reply_buf = NULL; - wil->reply_size = 0; - out: - mutex_unlock(&wil->wmi_mutex); - - return rc; -} - -int wmi_echo(struct wil6210_priv *wil) -{ - struct wmi_echo_cmd cmd = { - .value = cpu_to_le32(0x12345678), - }; - - return wmi_call(wil, WMI_ECHO_CMDID, &cmd, sizeof(cmd), - WMI_ECHO_RSP_EVENTID, NULL, 0, 20); -} - -int wmi_set_mac_address(struct wil6210_priv *wil, void *addr) -{ - struct wmi_set_mac_address_cmd cmd; - - memcpy(cmd.mac, addr, ETH_ALEN); - - wil_dbg_wmi(wil, "Set MAC %pM\n", addr); - - return wmi_send(wil, WMI_SET_MAC_ADDRESS_CMDID, &cmd, sizeof(cmd)); -} - -int wmi_pcp_start(struct wil6210_priv *wil, int bi, u8 wmi_nettype, u8 chan) -{ - int rc; - - struct wmi_pcp_start_cmd cmd = { - .bcon_interval = cpu_to_le16(bi), - .network_type = wmi_nettype, - .disable_sec_offload = 1, - .channel = chan, - }; - struct { - struct wil6210_mbox_hdr_wmi wmi; - struct wmi_pcp_started_event evt; - } __packed reply; - - if (!wil->secure_pcp) - cmd.disable_sec = 1; - - rc = wmi_call(wil, WMI_PCP_START_CMDID, &cmd, sizeof(cmd), - WMI_PCP_STARTED_EVENTID, &reply, sizeof(reply), 100); - if (rc) - return rc; - - if (reply.evt.status != WMI_FW_STATUS_SUCCESS) - rc = -EINVAL; - - return rc; -} - -int wmi_pcp_stop(struct wil6210_priv *wil) -{ - return wmi_call(wil, WMI_PCP_STOP_CMDID, NULL, 0, - WMI_PCP_STOPPED_EVENTID, NULL, 0, 20); -} - -int wmi_set_ssid(struct wil6210_priv *wil, u8 ssid_len, const void *ssid) -{ - struct wmi_set_ssid_cmd cmd = { - .ssid_len = cpu_to_le32(ssid_len), - }; - - if (ssid_len > sizeof(cmd.ssid)) - return -EINVAL; - - memcpy(cmd.ssid, ssid, ssid_len); - - return wmi_send(wil, WMI_SET_SSID_CMDID, &cmd, sizeof(cmd)); -} - -int wmi_get_ssid(struct wil6210_priv *wil, u8 *ssid_len, void *ssid) -{ - int rc; - struct { - struct wil6210_mbox_hdr_wmi wmi; - struct wmi_set_ssid_cmd cmd; - } __packed reply; - int len; /* reply.cmd.ssid_len in CPU order */ - - rc = wmi_call(wil, WMI_GET_SSID_CMDID, NULL, 0, WMI_GET_SSID_EVENTID, - &reply, sizeof(reply), 20); - if (rc) - return rc; - - len = le32_to_cpu(reply.cmd.ssid_len); - if (len > sizeof(reply.cmd.ssid)) - return -EINVAL; - - *ssid_len = len; - memcpy(ssid, reply.cmd.ssid, len); - - return 0; -} - -int wmi_set_channel(struct wil6210_priv *wil, int channel) -{ - struct wmi_set_pcp_channel_cmd cmd = { - .channel = channel - 1, - }; - - return wmi_send(wil, WMI_SET_PCP_CHANNEL_CMDID, &cmd, sizeof(cmd)); -} - -int wmi_get_channel(struct wil6210_priv *wil, int *channel) -{ - int rc; - struct { - struct wil6210_mbox_hdr_wmi wmi; - struct wmi_set_pcp_channel_cmd cmd; - } __packed reply; - - rc = wmi_call(wil, WMI_GET_PCP_CHANNEL_CMDID, NULL, 0, - WMI_GET_PCP_CHANNEL_EVENTID, &reply, sizeof(reply), 20); - if (rc) - return rc; - - if (reply.cmd.channel > 3) - return -EINVAL; - - *channel = reply.cmd.channel + 1; - - return 0; -} - -int wmi_p2p_cfg(struct wil6210_priv *wil, int channel) -{ - struct wmi_p2p_cfg_cmd cmd = { - .discovery_mode = WMI_DISCOVERY_MODE_NON_OFFLOAD, - .channel = channel - 1, - }; - - return wmi_send(wil, WMI_P2P_CFG_CMDID, &cmd, sizeof(cmd)); -} - -int wmi_tx_eapol(struct wil6210_priv *wil, struct sk_buff *skb) -{ - struct wmi_eapol_tx_cmd *cmd; - struct ethhdr *eth; - u16 eapol_len = skb->len - ETH_HLEN; - void *eapol = skb->data + ETH_HLEN; - uint i; - int rc; - - skb_set_mac_header(skb, 0); - eth = eth_hdr(skb); - wil_dbg_wmi(wil, "EAPOL %d bytes to %pM\n", eapol_len, eth->h_dest); - for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) { - if (memcmp(wil->dst_addr[i], eth->h_dest, ETH_ALEN) == 0) - goto found_dest; - } - - return -EINVAL; - - found_dest: - /* find out eapol data & len */ - cmd = kzalloc(sizeof(*cmd) + eapol_len, GFP_KERNEL); - if (!cmd) - return -EINVAL; - - memcpy(cmd->dst_mac, eth->h_dest, ETH_ALEN); - cmd->eapol_len = cpu_to_le16(eapol_len); - memcpy(cmd->eapol, eapol, eapol_len); - rc = wmi_send(wil, WMI_EAPOL_TX_CMDID, cmd, sizeof(*cmd) + eapol_len); - kfree(cmd); - - return rc; -} - -int wmi_del_cipher_key(struct wil6210_priv *wil, u8 key_index, - const void *mac_addr) -{ - struct wmi_delete_cipher_key_cmd cmd = { - .key_index = key_index, - }; - - if (mac_addr) - memcpy(cmd.mac, mac_addr, WMI_MAC_LEN); - - return wmi_send(wil, WMI_DELETE_CIPHER_KEY_CMDID, &cmd, sizeof(cmd)); -} - -int wmi_add_cipher_key(struct wil6210_priv *wil, u8 key_index, - const void *mac_addr, int key_len, const void *key) -{ - struct wmi_add_cipher_key_cmd cmd = { - .key_index = key_index, - .key_usage = WMI_KEY_USE_PAIRWISE, - .key_len = key_len, - }; - - if (!key || (key_len > sizeof(cmd.key))) - return -EINVAL; - - memcpy(cmd.key, key, key_len); - if (mac_addr) - memcpy(cmd.mac, mac_addr, WMI_MAC_LEN); - - return wmi_send(wil, WMI_ADD_CIPHER_KEY_CMDID, &cmd, sizeof(cmd)); -} - -int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie) -{ - int rc; - u16 len = sizeof(struct wmi_set_appie_cmd) + ie_len; - struct wmi_set_appie_cmd *cmd = kzalloc(len, GFP_KERNEL); - if (!cmd) - return -ENOMEM; - - cmd->mgmt_frm_type = type; - /* BUG: FW API define ieLen as u8. Will fix FW */ - cmd->ie_len = cpu_to_le16(ie_len); - memcpy(cmd->ie_info, ie, ie_len); - rc = wmi_send(wil, WMI_SET_APPIE_CMDID, cmd, len); - kfree(cmd); - - return rc; -} - -int wmi_rx_chain_add(struct wil6210_priv *wil, struct vring *vring) -{ - struct wireless_dev *wdev = wil->wdev; - struct net_device *ndev = wil_to_ndev(wil); - struct wmi_cfg_rx_chain_cmd cmd = { - .action = WMI_RX_CHAIN_ADD, - .rx_sw_ring = { - .max_mpdu_size = cpu_to_le16(RX_BUF_LEN), - .ring_mem_base = cpu_to_le64(vring->pa), - .ring_size = cpu_to_le16(vring->size), - }, - .mid = 0, /* TODO - what is it? */ - .decap_trans_type = WMI_DECAP_TYPE_802_3, - }; - struct { - struct wil6210_mbox_hdr_wmi wmi; - struct wmi_cfg_rx_chain_done_event evt; - } __packed evt; - int rc; - - if (wdev->iftype == NL80211_IFTYPE_MONITOR) { - struct ieee80211_channel *ch = wdev->preset_chandef.chan; - - cmd.sniffer_cfg.mode = cpu_to_le32(WMI_SNIFFER_ON); - if (ch) - cmd.sniffer_cfg.channel = ch->hw_value - 1; - cmd.sniffer_cfg.phy_info_mode = - cpu_to_le32(ndev->type == ARPHRD_IEEE80211_RADIOTAP); - cmd.sniffer_cfg.phy_support = - cpu_to_le32((wil->monitor_flags & MONITOR_FLAG_CONTROL) - ? WMI_SNIFFER_CP : WMI_SNIFFER_DP); - } - /* typical time for secure PCP is 840ms */ - rc = wmi_call(wil, WMI_CFG_RX_CHAIN_CMDID, &cmd, sizeof(cmd), - WMI_CFG_RX_CHAIN_DONE_EVENTID, &evt, sizeof(evt), 2000); - if (rc) - return rc; - - vring->hwtail = le32_to_cpu(evt.evt.rx_ring_tail_ptr); - - wil_dbg_misc(wil, "Rx init: status %d tail 0x%08x\n", - le32_to_cpu(evt.evt.status), vring->hwtail); - - if (le32_to_cpu(evt.evt.status) != WMI_CFG_RX_CHAIN_SUCCESS) - rc = -EINVAL; - - return rc; -} - -int wmi_get_temperature(struct wil6210_priv *wil, u32 *t_m, u32 *t_r) -{ - int rc; - struct wmi_temp_sense_cmd cmd = { - .measure_marlon_m_en = cpu_to_le32(!!t_m), - .measure_marlon_r_en = cpu_to_le32(!!t_r), - }; - struct { - struct wil6210_mbox_hdr_wmi wmi; - struct wmi_temp_sense_done_event evt; - } __packed reply; - - rc = wmi_call(wil, WMI_TEMP_SENSE_CMDID, &cmd, sizeof(cmd), - WMI_TEMP_SENSE_DONE_EVENTID, &reply, sizeof(reply), 100); - if (rc) - return rc; - - if (t_m) - *t_m = le32_to_cpu(reply.evt.marlon_m_t1000); - if (t_r) - *t_r = le32_to_cpu(reply.evt.marlon_r_t1000); - - return 0; -} - -void wmi_event_flush(struct wil6210_priv *wil) -{ - struct pending_wmi_event *evt, *t; - - wil_dbg_wmi(wil, "%s()\n", __func__); - - list_for_each_entry_safe(evt, t, &wil->pending_wmi_ev, list) { - list_del(&evt->list); - kfree(evt); - } -} - -static bool wmi_evt_call_handler(struct wil6210_priv *wil, int id, - void *d, int len) -{ - uint i; - - for (i = 0; i < ARRAY_SIZE(wmi_evt_handlers); i++) { - if (wmi_evt_handlers[i].eventid == id) { - wmi_evt_handlers[i].handler(wil, id, d, len); - return true; - } - } - - return false; -} - -static void wmi_event_handle(struct wil6210_priv *wil, - struct wil6210_mbox_hdr *hdr) -{ - u16 len = le16_to_cpu(hdr->len); - - if ((hdr->type == WIL_MBOX_HDR_TYPE_WMI) && - (len >= sizeof(struct wil6210_mbox_hdr_wmi))) { - struct wil6210_mbox_hdr_wmi *wmi = (void *)(&hdr[1]); - void *evt_data = (void *)(&wmi[1]); - u16 id = le16_to_cpu(wmi->id); - /* check if someone waits for this event */ - if (wil->reply_id && wil->reply_id == id) { - if (wil->reply_buf) { - memcpy(wil->reply_buf, wmi, - min(len, wil->reply_size)); - } else { - wmi_evt_call_handler(wil, id, evt_data, - len - sizeof(*wmi)); - } - wil_dbg_wmi(wil, "Complete WMI 0x%04x\n", id); - complete(&wil->wmi_ready); - return; - } - /* unsolicited event */ - /* search for handler */ - if (!wmi_evt_call_handler(wil, id, evt_data, - len - sizeof(*wmi))) { - wil_err(wil, "Unhandled event 0x%04x\n", id); - } - } else { - wil_err(wil, "Unknown event type\n"); - print_hex_dump(KERN_ERR, "evt?? ", DUMP_PREFIX_OFFSET, 16, 1, - hdr, sizeof(*hdr) + len, true); - } -} - -/* - * Retrieve next WMI event from the pending list - */ -static struct list_head *next_wmi_ev(struct wil6210_priv *wil) -{ - ulong flags; - struct list_head *ret = NULL; - - spin_lock_irqsave(&wil->wmi_ev_lock, flags); - - if (!list_empty(&wil->pending_wmi_ev)) { - ret = wil->pending_wmi_ev.next; - list_del(ret); - } - - spin_unlock_irqrestore(&wil->wmi_ev_lock, flags); - - return ret; -} - -/* - * Handler for the WMI events - */ -void wmi_event_worker(struct work_struct *work) -{ - struct wil6210_priv *wil = container_of(work, struct wil6210_priv, - wmi_event_worker); - struct pending_wmi_event *evt; - struct list_head *lh; - - while ((lh = next_wmi_ev(wil)) != NULL) { - evt = list_entry(lh, struct pending_wmi_event, list); - wmi_event_handle(wil, &evt->event.hdr); - kfree(evt); - } -} diff --git a/drivers/net/wireless/ath/wil6210/wmi.h b/drivers/net/wireless/ath/wil6210/wmi.h deleted file mode 100644 index 50b8528394f4..000000000000 --- a/drivers/net/wireless/ath/wil6210/wmi.h +++ /dev/null @@ -1,1281 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * Copyright (c) 2006-2012 Wilocity . - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * This file contains the definitions of the WMI protocol specified in the - * Wireless Module Interface (WMI) for the Wilocity - * MARLON 60 Gigabit wireless solution. - * It includes definitions of all the commands and events. - * Commands are messages from the host to the WM. - * Events are messages from the WM to the host. - */ - -#ifndef __WILOCITY_WMI_H__ -#define __WILOCITY_WMI_H__ - -/* General */ - -#define WMI_MAC_LEN (6) -#define WMI_PROX_RANGE_NUM (3) - -/* List of Commands */ -enum wmi_command_id { - WMI_CONNECT_CMDID = 0x0001, - WMI_DISCONNECT_CMDID = 0x0003, - WMI_DISCONNECT_STA_CMDID = 0x0004, - WMI_START_SCAN_CMDID = 0x0007, - WMI_SET_BSS_FILTER_CMDID = 0x0009, - WMI_SET_PROBED_SSID_CMDID = 0x000a, - WMI_SET_LISTEN_INT_CMDID = 0x000b, - WMI_BCON_CTRL_CMDID = 0x000f, - WMI_ADD_CIPHER_KEY_CMDID = 0x0016, - WMI_DELETE_CIPHER_KEY_CMDID = 0x0017, - WMI_SET_APPIE_CMDID = 0x003f, - WMI_SET_WSC_STATUS_CMDID = 0x0041, - WMI_PXMT_RANGE_CFG_CMDID = 0x0042, - WMI_PXMT_SNR2_RANGE_CFG_CMDID = 0x0043, - WMI_FAST_MEM_ACC_MODE_CMDID = 0x0300, - WMI_MEM_READ_CMDID = 0x0800, - WMI_MEM_WR_CMDID = 0x0801, - WMI_ECHO_CMDID = 0x0803, - WMI_DEEP_ECHO_CMDID = 0x0804, - WMI_CONFIG_MAC_CMDID = 0x0805, - WMI_CONFIG_PHY_DEBUG_CMDID = 0x0806, - WMI_ADD_DEBUG_TX_PCKT_CMDID = 0x0808, - WMI_PHY_GET_STATISTICS_CMDID = 0x0809, - WMI_FS_TUNE_CMDID = 0x080a, - WMI_CORR_MEASURE_CMDID = 0x080b, - WMI_READ_RSSI_CMDID = 0x080c, - WMI_TEMP_SENSE_CMDID = 0x080e, - WMI_DC_CALIB_CMDID = 0x080f, - WMI_SEND_TONE_CMDID = 0x0810, - WMI_IQ_TX_CALIB_CMDID = 0x0811, - WMI_IQ_RX_CALIB_CMDID = 0x0812, - WMI_SET_UCODE_IDLE_CMDID = 0x0813, - WMI_SET_WORK_MODE_CMDID = 0x0815, - WMI_LO_LEAKAGE_CALIB_CMDID = 0x0816, - WMI_MARLON_R_ACTIVATE_CMDID = 0x0817, - WMI_MARLON_R_READ_CMDID = 0x0818, - WMI_MARLON_R_WRITE_CMDID = 0x0819, - WMI_MARLON_R_TXRX_SEL_CMDID = 0x081a, - MAC_IO_STATIC_PARAMS_CMDID = 0x081b, - MAC_IO_DYNAMIC_PARAMS_CMDID = 0x081c, - WMI_SILENT_RSSI_CALIB_CMDID = 0x081d, - WMI_RF_RX_TEST_CMDID = 0x081e, - WMI_CFG_RX_CHAIN_CMDID = 0x0820, - WMI_VRING_CFG_CMDID = 0x0821, - WMI_VRING_BA_EN_CMDID = 0x0823, - WMI_VRING_BA_DIS_CMDID = 0x0824, - WMI_RCP_ADDBA_RESP_CMDID = 0x0825, - WMI_RCP_DELBA_CMDID = 0x0826, - WMI_SET_SSID_CMDID = 0x0827, - WMI_GET_SSID_CMDID = 0x0828, - WMI_SET_PCP_CHANNEL_CMDID = 0x0829, - WMI_GET_PCP_CHANNEL_CMDID = 0x082a, - WMI_SW_TX_REQ_CMDID = 0x082b, - WMI_READ_MAC_RXQ_CMDID = 0x0830, - WMI_READ_MAC_TXQ_CMDID = 0x0831, - WMI_WRITE_MAC_RXQ_CMDID = 0x0832, - WMI_WRITE_MAC_TXQ_CMDID = 0x0833, - WMI_WRITE_MAC_XQ_FIELD_CMDID = 0x0834, - WMI_MLME_PUSH_CMDID = 0x0835, - WMI_BEAMFORMING_MGMT_CMDID = 0x0836, - WMI_BF_TXSS_MGMT_CMDID = 0x0837, - WMI_BF_SM_MGMT_CMDID = 0x0838, - WMI_BF_RXSS_MGMT_CMDID = 0x0839, - WMI_SET_SECTORS_CMDID = 0x0849, - WMI_MAINTAIN_PAUSE_CMDID = 0x0850, - WMI_MAINTAIN_RESUME_CMDID = 0x0851, - WMI_RS_MGMT_CMDID = 0x0852, - WMI_RF_MGMT_CMDID = 0x0853, - /* Performance monitoring commands */ - WMI_BF_CTRL_CMDID = 0x0862, - WMI_NOTIFY_REQ_CMDID = 0x0863, - WMI_GET_STATUS_CMDID = 0x0864, - WMI_UNIT_TEST_CMDID = 0x0900, - WMI_HICCUP_CMDID = 0x0901, - WMI_FLASH_READ_CMDID = 0x0902, - WMI_FLASH_WRITE_CMDID = 0x0903, - WMI_SECURITY_UNIT_TEST_CMDID = 0x0904, - /*P2P*/ - WMI_P2P_CFG_CMDID = 0x0910, - WMI_PORT_ALLOCATE_CMDID = 0x0911, - WMI_PORT_DELETE_CMDID = 0x0912, - WMI_POWER_MGMT_CFG_CMDID = 0x0913, - WMI_START_LISTEN_CMDID = 0x0914, - WMI_START_SEARCH_CMDID = 0x0915, - WMI_DISCOVERY_START_CMDID = 0x0916, - WMI_DISCOVERY_STOP_CMDID = 0x0917, - WMI_PCP_START_CMDID = 0x0918, - WMI_PCP_STOP_CMDID = 0x0919, - WMI_GET_PCP_FACTOR_CMDID = 0x091b, - - WMI_SET_MAC_ADDRESS_CMDID = 0xf003, - WMI_ABORT_SCAN_CMDID = 0xf007, - WMI_SET_PMK_CMDID = 0xf028, - - WMI_SET_PROMISCUOUS_MODE_CMDID = 0xf041, - WMI_GET_PMK_CMDID = 0xf048, - WMI_SET_PASSPHRASE_CMDID = 0xf049, - WMI_SEND_ASSOC_RES_CMDID = 0xf04a, - WMI_SET_ASSOC_REQ_RELAY_CMDID = 0xf04b, - WMI_EAPOL_TX_CMDID = 0xf04c, - WMI_MAC_ADDR_REQ_CMDID = 0xf04d, - WMI_FW_VER_CMDID = 0xf04e, -}; - -/* - * Commands data structures - */ - -/* - * WMI_CONNECT_CMDID - */ -enum wmi_network_type { - WMI_NETTYPE_INFRA = 0x01, - WMI_NETTYPE_ADHOC = 0x02, - WMI_NETTYPE_ADHOC_CREATOR = 0x04, - WMI_NETTYPE_AP = 0x10, - WMI_NETTYPE_P2P = 0x20, - WMI_NETTYPE_WBE = 0x40, /* PCIE over 60g */ -}; - -enum wmi_dot11_auth_mode { - WMI_AUTH11_OPEN = 0x01, - WMI_AUTH11_SHARED = 0x02, - WMI_AUTH11_LEAP = 0x04, - WMI_AUTH11_WSC = 0x08, -}; - -enum wmi_auth_mode { - WMI_AUTH_NONE = 0x01, - WMI_AUTH_WPA = 0x02, - WMI_AUTH_WPA2 = 0x04, - WMI_AUTH_WPA_PSK = 0x08, - WMI_AUTH_WPA2_PSK = 0x10, - WMI_AUTH_WPA_CCKM = 0x20, - WMI_AUTH_WPA2_CCKM = 0x40, -}; - -enum wmi_crypto_type { - WMI_CRYPT_NONE = 0x01, - WMI_CRYPT_WEP = 0x02, - WMI_CRYPT_TKIP = 0x04, - WMI_CRYPT_AES = 0x08, - WMI_CRYPT_AES_GCMP = 0x20, -}; - - -enum wmi_connect_ctrl_flag_bits { - WMI_CONNECT_ASSOC_POLICY_USER = 0x0001, - WMI_CONNECT_SEND_REASSOC = 0x0002, - WMI_CONNECT_IGNORE_WPA_GROUP_CIPHER = 0x0004, - WMI_CONNECT_PROFILE_MATCH_DONE = 0x0008, - WMI_CONNECT_IGNORE_AAC_BEACON = 0x0010, - WMI_CONNECT_CSA_FOLLOW_BSS = 0x0020, - WMI_CONNECT_DO_WPA_OFFLOAD = 0x0040, - WMI_CONNECT_DO_NOT_DEAUTH = 0x0080, -}; - -#define WMI_MAX_SSID_LEN (32) - -struct wmi_connect_cmd { - u8 network_type; - u8 dot11_auth_mode; - u8 auth_mode; - u8 pairwise_crypto_type; - u8 pairwise_crypto_len; - u8 group_crypto_type; - u8 group_crypto_len; - u8 ssid_len; - u8 ssid[WMI_MAX_SSID_LEN]; - u8 channel; - u8 reserved0; - u8 bssid[WMI_MAC_LEN]; - __le32 ctrl_flags; - u8 dst_mac[WMI_MAC_LEN]; - u8 reserved1[2]; -} __packed; - -/* - * WMI_DISCONNECT_STA_CMDID - */ -struct wmi_disconnect_sta_cmd { - u8 dst_mac[WMI_MAC_LEN]; - __le16 disconnect_reason; -} __packed; - -/* - * WMI_RECONNECT_CMDID - */ -struct wmi_reconnect_cmd { - u8 channel; /* hint */ - u8 reserved; - u8 bssid[WMI_MAC_LEN]; /* mandatory if set */ -} __packed; - - -/* - * WMI_SET_PMK_CMDID - */ - -#define WMI_MIN_KEY_INDEX (0) -#define WMI_MAX_KEY_INDEX (3) -#define WMI_MAX_KEY_LEN (32) -#define WMI_PASSPHRASE_LEN (64) -#define WMI_PMK_LEN (32) - -struct wmi_set_pmk_cmd { - u8 pmk[WMI_PMK_LEN]; -} __packed; - - -/* - * WMI_SET_PASSPHRASE_CMDID - */ -struct wmi_set_passphrase_cmd { - u8 ssid[WMI_MAX_SSID_LEN]; - u8 passphrase[WMI_PASSPHRASE_LEN]; - u8 ssid_len; - u8 passphrase_len; -} __packed; - -/* - * WMI_ADD_CIPHER_KEY_CMDID - */ -enum wmi_key_usage { - WMI_KEY_USE_PAIRWISE = 0, - WMI_KEY_USE_GROUP = 1, - WMI_KEY_USE_TX = 2, /* default Tx Key - Static WEP only */ -}; - -struct wmi_add_cipher_key_cmd { - u8 key_index; - u8 key_type; - u8 key_usage; /* enum wmi_key_usage */ - u8 key_len; - u8 key_rsc[8]; /* key replay sequence counter */ - u8 key[WMI_MAX_KEY_LEN]; - u8 key_op_ctrl; /* Additional Key Control information */ - u8 mac[WMI_MAC_LEN]; -} __packed; - -/* - * WMI_DELETE_CIPHER_KEY_CMDID - */ -struct wmi_delete_cipher_key_cmd { - u8 key_index; - u8 mac[WMI_MAC_LEN]; -} __packed; - - -/* - * WMI_START_SCAN_CMDID - * - * Start L1 scan operation - * - * Returned events: - * - WMI_RX_MGMT_PACKET_EVENTID - for every probe resp. - * - WMI_SCAN_COMPLETE_EVENTID - */ -enum wmi_scan_type { - WMI_LONG_SCAN = 0, - WMI_SHORT_SCAN = 1, - WMI_PBC_SCAN = 2, -}; - -struct wmi_start_scan_cmd { - u8 reserved[8]; - - __le32 home_dwell_time; /* Max duration in the home channel(ms) */ - __le32 force_scan_interval; /* Time interval between scans (ms)*/ - u8 scan_type; /* wmi_scan_type */ - u8 num_channels; /* how many channels follow */ - struct { - u8 channel; - u8 reserved; - } channel_list[0]; /* channels ID's */ - /* 0 - 58320 MHz */ - /* 1 - 60480 MHz */ - /* 2 - 62640 MHz */ -} __packed; - -/* - * WMI_SET_PROBED_SSID_CMDID - */ -#define MAX_PROBED_SSID_INDEX (3) - -enum wmi_ssid_flag { - WMI_SSID_FLAG_DISABLE = 0, /* disables entry */ - WMI_SSID_FLAG_SPECIFIC = 1, /* probes specified ssid */ - WMI_SSID_FLAG_ANY = 2, /* probes for any ssid */ -}; - -struct wmi_probed_ssid_cmd { - u8 entry_index; /* 0 to MAX_PROBED_SSID_INDEX */ - u8 flag; /* enum wmi_ssid_flag */ - u8 ssid_len; - u8 ssid[WMI_MAX_SSID_LEN]; -} __packed; - -/* - * WMI_SET_APPIE_CMDID - * Add Application specified IE to a management frame - */ -#define WMI_MAX_IE_LEN (1024) - -/* - * Frame Types - */ -enum wmi_mgmt_frame_type { - WMI_FRAME_BEACON = 0, - WMI_FRAME_PROBE_REQ = 1, - WMI_FRAME_PROBE_RESP = 2, - WMI_FRAME_ASSOC_REQ = 3, - WMI_FRAME_ASSOC_RESP = 4, - WMI_NUM_MGMT_FRAME, -}; - -struct wmi_set_appie_cmd { - u8 mgmt_frm_type; /* enum wmi_mgmt_frame_type */ - u8 reserved; - __le16 ie_len; /* Length of the IE to be added to MGMT frame */ - u8 ie_info[0]; -} __packed; - - -/* - * WMI_PXMT_RANGE_CFG_CMDID - */ -struct wmi_pxmt_range_cfg_cmd { - u8 dst_mac[WMI_MAC_LEN]; - __le16 range; -} __packed; - -/* - * WMI_PXMT_SNR2_RANGE_CFG_CMDID - */ -struct wmi_pxmt_snr2_range_cfg_cmd { - s8 snr2range_arr[WMI_PROX_RANGE_NUM-1]; -} __packed; - -/* - * WMI_RF_MGMT_CMDID - */ -enum wmi_rf_mgmt_type { - WMI_RF_MGMT_W_DISABLE = 0, - WMI_RF_MGMT_W_ENABLE = 1, - WMI_RF_MGMT_GET_STATUS = 2, -}; - -struct wmi_rf_mgmt_cmd { - __le32 rf_mgmt_type; -} __packed; - - -/* - * WMI_RF_RX_TEST_CMDID - */ -struct wmi_rf_rx_test_cmd { - __le32 sector; -} __packed; - -/* - * WMI_CORR_MEASURE_CMDID - */ -struct wmi_corr_measure_cmd { - s32 freq_mhz; - __le32 length_samples; - __le32 iterations; -} __packed; - -/* - * WMI_SET_SSID_CMDID - */ -struct wmi_set_ssid_cmd { - __le32 ssid_len; - u8 ssid[WMI_MAX_SSID_LEN]; -} __packed; - -/* - * WMI_SET_PCP_CHANNEL_CMDID - */ -struct wmi_set_pcp_channel_cmd { - u8 channel; - u8 reserved[3]; -} __packed; - -/* - * WMI_BCON_CTRL_CMDID - */ -struct wmi_bcon_ctrl_cmd { - __le16 bcon_interval; - __le16 frag_num; - __le64 ss_mask; - u8 network_type; - u8 reserved; - u8 disable_sec_offload; - u8 disable_sec; -} __packed; - - -/******* P2P ***********/ - -/* - * WMI_PORT_ALLOCATE_CMDID - */ -enum wmi_port_role { - WMI_PORT_STA = 0, - WMI_PORT_PCP = 1, - WMI_PORT_AP = 2, - WMI_PORT_P2P_DEV = 3, - WMI_PORT_P2P_CLIENT = 4, - WMI_PORT_P2P_GO = 5, -}; - -struct wmi_port_allocate_cmd { - u8 mac[WMI_MAC_LEN]; - u8 port_role; - u8 midid; -} __packed; - -/* - * WMI_PORT_DELETE_CMDID - */ -struct wmi_delete_port_cmd { - u8 mid; - u8 reserved[3]; -} __packed; - -/* - * WMI_P2P_CFG_CMDID - */ -enum wmi_discovery_mode { - WMI_DISCOVERY_MODE_NON_OFFLOAD = 0, - WMI_DISCOVERY_MODE_OFFLOAD = 1, -}; - -struct wmi_p2p_cfg_cmd { - u8 discovery_mode; /* wmi_discovery_mode */ - u8 channel; - __le16 bcon_interval; /* base to listen/search duration calculation */ -} __packed; - -/* - * WMI_POWER_MGMT_CFG_CMDID - */ -enum wmi_power_source_type { - WMI_POWER_SOURCE_BATTERY = 0, - WMI_POWER_SOURCE_OTHER = 1, -}; - -struct wmi_power_mgmt_cfg_cmd { - u8 power_source; /* wmi_power_source_type */ - u8 reserved[3]; -} __packed; - -/* - * WMI_PCP_START_CMDID - */ -struct wmi_pcp_start_cmd { - __le16 bcon_interval; - u8 reserved0[10]; - u8 network_type; - u8 channel; - u8 disable_sec_offload; - u8 disable_sec; -} __packed; - -/* - * WMI_SW_TX_REQ_CMDID - */ -struct wmi_sw_tx_req_cmd { - u8 dst_mac[WMI_MAC_LEN]; - __le16 len; - u8 payload[0]; -} __packed; - -/* - * WMI_VRING_CFG_CMDID - */ - -struct wmi_sw_ring_cfg { - __le64 ring_mem_base; - __le16 ring_size; - __le16 max_mpdu_size; -} __packed; - -struct wmi_vring_cfg_schd { - __le16 priority; - __le16 timeslot_us; -} __packed; - -enum wmi_vring_cfg_encap_trans_type { - WMI_VRING_ENC_TYPE_802_3 = 0, - WMI_VRING_ENC_TYPE_NATIVE_WIFI = 1, -}; - -enum wmi_vring_cfg_ds_cfg { - WMI_VRING_DS_PBSS = 0, - WMI_VRING_DS_STATION = 1, - WMI_VRING_DS_AP = 2, - WMI_VRING_DS_ADDR4 = 3, -}; - -enum wmi_vring_cfg_nwifi_ds_trans_type { - WMI_NWIFI_TX_TRANS_MODE_NO = 0, - WMI_NWIFI_TX_TRANS_MODE_AP2PBSS = 1, - WMI_NWIFI_TX_TRANS_MODE_STA2PBSS = 2, -}; - -enum wmi_vring_cfg_schd_params_priority { - WMI_SCH_PRIO_REGULAR = 0, - WMI_SCH_PRIO_HIGH = 1, -}; - -#define CIDXTID_CID_POS (0) -#define CIDXTID_CID_LEN (4) -#define CIDXTID_CID_MSK (0xF) -#define CIDXTID_TID_POS (4) -#define CIDXTID_TID_LEN (4) -#define CIDXTID_TID_MSK (0xF0) - -struct wmi_vring_cfg { - struct wmi_sw_ring_cfg tx_sw_ring; - u8 ringid; /* 0-23 vrings */ - - u8 cidxtid; - - u8 encap_trans_type; - u8 ds_cfg; /* 802.3 DS cfg */ - u8 nwifi_ds_trans_type; - - #define VRING_CFG_MAC_CTRL_LIFETIME_EN_POS (0) - #define VRING_CFG_MAC_CTRL_LIFETIME_EN_LEN (1) - #define VRING_CFG_MAC_CTRL_LIFETIME_EN_MSK (0x1) - #define VRING_CFG_MAC_CTRL_AGGR_EN_POS (1) - #define VRING_CFG_MAC_CTRL_AGGR_EN_LEN (1) - #define VRING_CFG_MAC_CTRL_AGGR_EN_MSK (0x2) - u8 mac_ctrl; - - #define VRING_CFG_TO_RESOLUTION_VALUE_POS (0) - #define VRING_CFG_TO_RESOLUTION_VALUE_LEN (6) - #define VRING_CFG_TO_RESOLUTION_VALUE_MSK (0x3F) - u8 to_resolution; - u8 agg_max_wsize; - struct wmi_vring_cfg_schd schd_params; -} __packed; - -enum wmi_vring_cfg_cmd_action { - WMI_VRING_CMD_ADD = 0, - WMI_VRING_CMD_MODIFY = 1, - WMI_VRING_CMD_DELETE = 2, -}; - -struct wmi_vring_cfg_cmd { - __le32 action; - struct wmi_vring_cfg vring_cfg; -} __packed; - -/* - * WMI_VRING_BA_EN_CMDID - */ -struct wmi_vring_ba_en_cmd { - u8 ringid; - u8 agg_max_wsize; - __le16 ba_timeout; -} __packed; - -/* - * WMI_VRING_BA_DIS_CMDID - */ -struct wmi_vring_ba_dis_cmd { - u8 ringid; - u8 reserved; - __le16 reason; -} __packed; - -/* - * WMI_NOTIFY_REQ_CMDID - */ -struct wmi_notify_req_cmd { - u8 cid; - u8 year; - u8 month; - u8 day; - __le32 interval_usec; - u8 hour; - u8 minute; - u8 second; - u8 miliseconds; -} __packed; - -/* - * WMI_CFG_RX_CHAIN_CMDID - */ -enum wmi_sniffer_cfg_mode { - WMI_SNIFFER_OFF = 0, - WMI_SNIFFER_ON = 1, -}; - -enum wmi_sniffer_cfg_phy_info_mode { - WMI_SNIFFER_PHY_INFO_DISABLED = 0, - WMI_SNIFFER_PHY_INFO_ENABLED = 1, -}; - -enum wmi_sniffer_cfg_phy_support { - WMI_SNIFFER_CP = 0, - WMI_SNIFFER_DP = 1, - WMI_SNIFFER_BOTH_PHYS = 2, -}; - -struct wmi_sniffer_cfg { - __le32 mode; /* enum wmi_sniffer_cfg_mode */ - __le32 phy_info_mode; /* enum wmi_sniffer_cfg_phy_info_mode */ - __le32 phy_support; /* enum wmi_sniffer_cfg_phy_support */ - u8 channel; - u8 reserved[3]; -} __packed; - -enum wmi_cfg_rx_chain_cmd_action { - WMI_RX_CHAIN_ADD = 0, - WMI_RX_CHAIN_DEL = 1, -}; - -enum wmi_cfg_rx_chain_cmd_decap_trans_type { - WMI_DECAP_TYPE_802_3 = 0, - WMI_DECAP_TYPE_NATIVE_WIFI = 1, -}; - -enum wmi_cfg_rx_chain_cmd_nwifi_ds_trans_type { - WMI_NWIFI_RX_TRANS_MODE_NO = 0, - WMI_NWIFI_RX_TRANS_MODE_PBSS2AP = 1, - WMI_NWIFI_RX_TRANS_MODE_PBSS2STA = 2, -}; - -enum wmi_cfg_rx_chain_cmd_reorder_type { - WMI_RX_HW_REORDER = 0, - WMI_RX_SW_REORDER = 1, -}; - -struct wmi_cfg_rx_chain_cmd { - __le32 action; - struct wmi_sw_ring_cfg rx_sw_ring; - u8 mid; - u8 decap_trans_type; - - #define L2_802_3_OFFLOAD_CTRL_VLAN_TAG_INSERTION_POS (0) - #define L2_802_3_OFFLOAD_CTRL_VLAN_TAG_INSERTION_LEN (1) - #define L2_802_3_OFFLOAD_CTRL_VLAN_TAG_INSERTION_MSK (0x1) - u8 l2_802_3_offload_ctrl; - - #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_QOS_POS (0) - #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_QOS_LEN (1) - #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_QOS_MSK (0x1) - #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_PN_POS (1) - #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_PN_LEN (1) - #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_PN_MSK (0x2) - u8 l2_nwifi_offload_ctrl; - - u8 vlan_id; - u8 nwifi_ds_trans_type; - - #define L3_L4_CTRL_IPV4_CHECKSUM_EN_POS (0) - #define L3_L4_CTRL_IPV4_CHECKSUM_EN_LEN (1) - #define L3_L4_CTRL_IPV4_CHECKSUM_EN_MSK (0x1) - #define L3_L4_CTRL_TCPIP_CHECKSUM_EN_POS (1) - #define L3_L4_CTRL_TCPIP_CHECKSUM_EN_LEN (1) - #define L3_L4_CTRL_TCPIP_CHECKSUM_EN_MSK (0x2) - u8 l3_l4_ctrl; - - #define RING_CTRL_OVERRIDE_PREFETCH_THRSH_POS (0) - #define RING_CTRL_OVERRIDE_PREFETCH_THRSH_LEN (1) - #define RING_CTRL_OVERRIDE_PREFETCH_THRSH_MSK (0x1) - #define RING_CTRL_OVERRIDE_WB_THRSH_POS (1) - #define RING_CTRL_OVERRIDE_WB_THRSH_LEN (1) - #define RING_CTRL_OVERRIDE_WB_THRSH_MSK (0x2) - #define RING_CTRL_OVERRIDE_ITR_THRSH_POS (2) - #define RING_CTRL_OVERRIDE_ITR_THRSH_LEN (1) - #define RING_CTRL_OVERRIDE_ITR_THRSH_MSK (0x4) - #define RING_CTRL_OVERRIDE_HOST_THRSH_POS (3) - #define RING_CTRL_OVERRIDE_HOST_THRSH_LEN (1) - #define RING_CTRL_OVERRIDE_HOST_THRSH_MSK (0x8) - u8 ring_ctrl; - - __le16 prefetch_thrsh; - __le16 wb_thrsh; - __le32 itr_value; - __le16 host_thrsh; - u8 reorder_type; - u8 reserved; - struct wmi_sniffer_cfg sniffer_cfg; -} __packed; - -/* - * WMI_RCP_ADDBA_RESP_CMDID - */ -struct wmi_rcp_addba_resp_cmd { - u8 cidxtid; - u8 dialog_token; - __le16 status_code; - __le16 ba_param_set; /* ieee80211_ba_parameterset field to send */ - __le16 ba_timeout; -} __packed; - -/* - * WMI_RCP_DELBA_CMDID - */ -struct wmi_rcp_delba_cmd { - u8 cidxtid; - u8 reserved; - __le16 reason; -} __packed; - -/* - * WMI_RCP_ADDBA_REQ_CMDID - */ -struct wmi_rcp_addba_req_cmd { - u8 cidxtid; - u8 dialog_token; - /* ieee80211_ba_parameterset field as it received */ - __le16 ba_param_set; - __le16 ba_timeout; - /* ieee80211_ba_seqstrl field as it received */ - __le16 ba_seq_ctrl; -} __packed; - -/* - * WMI_SET_MAC_ADDRESS_CMDID - */ -struct wmi_set_mac_address_cmd { - u8 mac[WMI_MAC_LEN]; - u8 reserved[2]; -} __packed; - -/* -* WMI_EAPOL_TX_CMDID -*/ -struct wmi_eapol_tx_cmd { - u8 dst_mac[WMI_MAC_LEN]; - __le16 eapol_len; - u8 eapol[0]; -} __packed; - -/* - * WMI_ECHO_CMDID - * - * Check FW is alive - * - * WMI_DEEP_ECHO_CMDID - * - * Check FW and ucode are alive - * - * Returned event: WMI_ECHO_RSP_EVENTID - * same event for both commands - */ -struct wmi_echo_cmd { - __le32 value; -} __packed; - -/* - * WMI_TEMP_SENSE_CMDID - * - * Measure MAC and radio temperatures - */ -struct wmi_temp_sense_cmd { - __le32 measure_marlon_m_en; - __le32 measure_marlon_r_en; -} __packed; - - -/* - * WMI Events - */ - -/* - * List of Events (target to host) - */ -enum wmi_event_id { - WMI_READY_EVENTID = 0x1001, - WMI_CONNECT_EVENTID = 0x1002, - WMI_DISCONNECT_EVENTID = 0x1003, - WMI_SCAN_COMPLETE_EVENTID = 0x100a, - WMI_REPORT_STATISTICS_EVENTID = 0x100b, - WMI_RD_MEM_RSP_EVENTID = 0x1800, - WMI_FW_READY_EVENTID = 0x1801, - WMI_EXIT_FAST_MEM_ACC_MODE_EVENTID = 0x0200, - WMI_ECHO_RSP_EVENTID = 0x1803, - WMI_FS_TUNE_DONE_EVENTID = 0x180a, - WMI_CORR_MEASURE_EVENTID = 0x180b, - WMI_READ_RSSI_EVENTID = 0x180c, - WMI_TEMP_SENSE_DONE_EVENTID = 0x180e, - WMI_DC_CALIB_DONE_EVENTID = 0x180f, - WMI_IQ_TX_CALIB_DONE_EVENTID = 0x1811, - WMI_IQ_RX_CALIB_DONE_EVENTID = 0x1812, - WMI_SET_WORK_MODE_DONE_EVENTID = 0x1815, - WMI_LO_LEAKAGE_CALIB_DONE_EVENTID = 0x1816, - WMI_MARLON_R_ACTIVATE_DONE_EVENTID = 0x1817, - WMI_MARLON_R_READ_DONE_EVENTID = 0x1818, - WMI_MARLON_R_WRITE_DONE_EVENTID = 0x1819, - WMI_MARLON_R_TXRX_SEL_DONE_EVENTID = 0x181a, - WMI_SILENT_RSSI_CALIB_DONE_EVENTID = 0x181d, - WMI_RF_RX_TEST_DONE_EVENTID = 0x181e, - WMI_CFG_RX_CHAIN_DONE_EVENTID = 0x1820, - WMI_VRING_CFG_DONE_EVENTID = 0x1821, - WMI_BA_STATUS_EVENTID = 0x1823, - WMI_RCP_ADDBA_REQ_EVENTID = 0x1824, - WMI_ADDBA_RESP_SENT_EVENTID = 0x1825, - WMI_DELBA_EVENTID = 0x1826, - WMI_GET_SSID_EVENTID = 0x1828, - WMI_GET_PCP_CHANNEL_EVENTID = 0x182a, - WMI_SW_TX_COMPLETE_EVENTID = 0x182b, - - WMI_READ_MAC_RXQ_EVENTID = 0x1830, - WMI_READ_MAC_TXQ_EVENTID = 0x1831, - WMI_WRITE_MAC_RXQ_EVENTID = 0x1832, - WMI_WRITE_MAC_TXQ_EVENTID = 0x1833, - WMI_WRITE_MAC_XQ_FIELD_EVENTID = 0x1834, - - WMI_BEAFORMING_MGMT_DONE_EVENTID = 0x1836, - WMI_BF_TXSS_MGMT_DONE_EVENTID = 0x1837, - WMI_BF_RXSS_MGMT_DONE_EVENTID = 0x1839, - WMI_RS_MGMT_DONE_EVENTID = 0x1852, - WMI_RF_MGMT_STATUS_EVENTID = 0x1853, - WMI_BF_SM_MGMT_DONE_EVENTID = 0x1838, - WMI_RX_MGMT_PACKET_EVENTID = 0x1840, - - /* Performance monitoring events */ - WMI_DATA_PORT_OPEN_EVENTID = 0x1860, - WMI_WBE_LINKDOWN_EVENTID = 0x1861, - - WMI_BF_CTRL_DONE_EVENTID = 0x1862, - WMI_NOTIFY_REQ_DONE_EVENTID = 0x1863, - WMI_GET_STATUS_DONE_EVENTID = 0x1864, - - WMI_UNIT_TEST_EVENTID = 0x1900, - WMI_FLASH_READ_DONE_EVENTID = 0x1902, - WMI_FLASH_WRITE_DONE_EVENTID = 0x1903, - /*P2P*/ - WMI_PORT_ALLOCATED_EVENTID = 0x1911, - WMI_PORT_DELETED_EVENTID = 0x1912, - WMI_LISTEN_STARTED_EVENTID = 0x1914, - WMI_SEARCH_STARTED_EVENTID = 0x1915, - WMI_DISCOVERY_STARTED_EVENTID = 0x1916, - WMI_DISCOVERY_STOPPED_EVENTID = 0x1917, - WMI_PCP_STARTED_EVENTID = 0x1918, - WMI_PCP_STOPPED_EVENTID = 0x1919, - WMI_PCP_FACTOR_EVENTID = 0x191a, - WMI_SET_CHANNEL_EVENTID = 0x9000, - WMI_ASSOC_REQ_EVENTID = 0x9001, - WMI_EAPOL_RX_EVENTID = 0x9002, - WMI_MAC_ADDR_RESP_EVENTID = 0x9003, - WMI_FW_VER_EVENTID = 0x9004, -}; - -/* - * Events data structures - */ - - -enum wmi_fw_status { - WMI_FW_STATUS_SUCCESS, - WMI_FW_STATUS_FAILURE, -}; - -/* - * WMI_RF_MGMT_STATUS_EVENTID - */ -enum wmi_rf_status { - WMI_RF_ENABLED = 0, - WMI_RF_DISABLED_HW = 1, - WMI_RF_DISABLED_SW = 2, - WMI_RF_DISABLED_HW_SW = 3, -}; - -struct wmi_rf_mgmt_status_event { - __le32 rf_status; -} __packed; - -/* - * WMI_GET_STATUS_DONE_EVENTID - */ -struct wmi_get_status_done_event { - __le32 is_associated; - u8 cid; - u8 reserved0[3]; - u8 bssid[WMI_MAC_LEN]; - u8 channel; - u8 reserved1; - u8 network_type; - u8 reserved2[3]; - __le32 ssid_len; - u8 ssid[WMI_MAX_SSID_LEN]; - __le32 rf_status; - __le32 is_secured; -} __packed; - -/* - * WMI_FW_VER_EVENTID - */ -struct wmi_fw_ver_event { - u8 major; - u8 minor; - __le16 subminor; - __le16 build; -} __packed; - -/* -* WMI_MAC_ADDR_RESP_EVENTID -*/ -struct wmi_mac_addr_resp_event { - u8 mac[WMI_MAC_LEN]; - u8 auth_mode; - u8 crypt_mode; - __le32 offload_mode; -} __packed; - -/* -* WMI_EAPOL_RX_EVENTID -*/ -struct wmi_eapol_rx_event { - u8 src_mac[WMI_MAC_LEN]; - __le16 eapol_len; - u8 eapol[0]; -} __packed; - -/* -* WMI_READY_EVENTID -*/ -enum wmi_phy_capability { - WMI_11A_CAPABILITY = 1, - WMI_11G_CAPABILITY = 2, - WMI_11AG_CAPABILITY = 3, - WMI_11NA_CAPABILITY = 4, - WMI_11NG_CAPABILITY = 5, - WMI_11NAG_CAPABILITY = 6, - WMI_11AD_CAPABILITY = 7, - WMI_11N_CAPABILITY_OFFSET = WMI_11NA_CAPABILITY - WMI_11A_CAPABILITY, -}; - -struct wmi_ready_event { - __le32 sw_version; - __le32 abi_version; - u8 mac[WMI_MAC_LEN]; - u8 phy_capability; /* enum wmi_phy_capability */ - u8 numof_additional_mids; -} __packed; - -/* - * WMI_NOTIFY_REQ_DONE_EVENTID - */ -struct wmi_notify_req_done_event { - __le32 status; - __le64 tsf; - __le32 snr_val; - __le32 tx_tpt; - __le32 tx_goodput; - __le32 rx_goodput; - __le16 bf_mcs; - __le16 my_rx_sector; - __le16 my_tx_sector; - __le16 other_rx_sector; - __le16 other_tx_sector; - __le16 range; - u8 sqi; - u8 reserved[3]; -} __packed; - -/* - * WMI_CONNECT_EVENTID - */ -struct wmi_connect_event { - u8 channel; - u8 reserved0; - u8 bssid[WMI_MAC_LEN]; - __le16 listen_interval; - __le16 beacon_interval; - u8 network_type; - u8 reserved1[3]; - u8 beacon_ie_len; - u8 assoc_req_len; - u8 assoc_resp_len; - u8 cid; - u8 reserved2[3]; - u8 assoc_info[0]; -} __packed; - -/* - * WMI_DISCONNECT_EVENTID - */ -enum wmi_disconnect_reason { - WMI_DIS_REASON_NO_NETWORK_AVAIL = 1, - WMI_DIS_REASON_LOST_LINK = 2, /* bmiss */ - WMI_DIS_REASON_DISCONNECT_CMD = 3, - WMI_DIS_REASON_BSS_DISCONNECTED = 4, - WMI_DIS_REASON_AUTH_FAILED = 5, - WMI_DIS_REASON_ASSOC_FAILED = 6, - WMI_DIS_REASON_NO_RESOURCES_AVAIL = 7, - WMI_DIS_REASON_CSERV_DISCONNECT = 8, - WMI_DIS_REASON_INVALID_PROFILE = 10, - WMI_DIS_REASON_DOT11H_CHANNEL_SWITCH = 11, - WMI_DIS_REASON_PROFILE_MISMATCH = 12, - WMI_DIS_REASON_CONNECTION_EVICTED = 13, - WMI_DIS_REASON_IBSS_MERGE = 14, -}; - -struct wmi_disconnect_event { - __le16 protocol_reason_status; /* reason code, see 802.11 spec. */ - u8 bssid[WMI_MAC_LEN]; /* set if known */ - u8 disconnect_reason; /* see wmi_disconnect_reason_e */ - u8 assoc_resp_len; - u8 assoc_info[0]; -} __packed; - -/* - * WMI_SCAN_COMPLETE_EVENTID - */ -struct wmi_scan_complete_event { - __le32 status; -} __packed; - -/* - * WMI_BA_STATUS_EVENTID - */ -enum wmi_vring_ba_status { - WMI_BA_AGREED = 0, - WMI_BA_NON_AGREED = 1, -}; - -struct wmi_vring_ba_status_event { - __le16 status; - u8 reserved[2]; - u8 ringid; - u8 agg_wsize; - __le16 ba_timeout; -} __packed; - -/* - * WMI_DELBA_EVENTID - */ -struct wmi_delba_event { - u8 cidxtid; - u8 from_initiator; - __le16 reason; -} __packed; - - -/* - * WMI_VRING_CFG_DONE_EVENTID - */ -struct wmi_vring_cfg_done_event { - u8 ringid; - u8 status; - u8 reserved[2]; - __le32 tx_vring_tail_ptr; -} __packed; - -/* - * WMI_ADDBA_RESP_SENT_EVENTID - */ -struct wmi_rcp_addba_resp_sent_event { - u8 cidxtid; - u8 reserved; - __le16 status; -} __packed; - -/* - * WMI_RCP_ADDBA_REQ_EVENTID - */ -struct wmi_rcp_addba_req_event { - u8 cidxtid; - u8 dialog_token; - __le16 ba_param_set; /* ieee80211_ba_parameterset as it received */ - __le16 ba_timeout; - __le16 ba_seq_ctrl; /* ieee80211_ba_seqstrl field as it received */ -} __packed; - -/* - * WMI_CFG_RX_CHAIN_DONE_EVENTID - */ -enum wmi_cfg_rx_chain_done_event_status { - WMI_CFG_RX_CHAIN_SUCCESS = 1, -}; - -struct wmi_cfg_rx_chain_done_event { - __le32 rx_ring_tail_ptr; /* Rx V-Ring Tail pointer */ - __le32 status; -} __packed; - -/* - * WMI_WBE_LINKDOWN_EVENTID - */ -enum wmi_wbe_link_down_event_reason { - WMI_WBE_REASON_USER_REQUEST = 0, - WMI_WBE_REASON_RX_DISASSOC = 1, - WMI_WBE_REASON_BAD_PHY_LINK = 2, -}; - -struct wmi_wbe_link_down_event { - u8 cid; - u8 reserved[3]; - __le32 reason; -} __packed; - -/* - * WMI_DATA_PORT_OPEN_EVENTID - */ -struct wmi_data_port_open_event { - u8 cid; - u8 reserved[3]; -} __packed; - - -/* - * WMI_GET_PCP_CHANNEL_EVENTID - */ -struct wmi_get_pcp_channel_event { - u8 channel; - u8 reserved[3]; -} __packed; - - -/* -* WMI_PORT_ALLOCATED_EVENTID -*/ -struct wmi_port_allocated_event { - u8 status; /* wmi_fw_status */ - u8 reserved[3]; -} __packed; - -/* -* WMI_PORT_DELETED_EVENTID -*/ -struct wmi_port_deleted_event { - u8 status; /* wmi_fw_status */ - u8 reserved[3]; -} __packed; - -/* - * WMI_LISTEN_STARTED_EVENTID - */ -struct wmi_listen_started_event { - u8 status; /* wmi_fw_status */ - u8 reserved[3]; -} __packed; - -/* - * WMI_SEARCH_STARTED_EVENTID - */ -struct wmi_search_started_event { - u8 status; /* wmi_fw_status */ - u8 reserved[3]; -} __packed; - -/* - * WMI_PCP_STARTED_EVENTID - */ -struct wmi_pcp_started_event { - u8 status; /* wmi_fw_status */ - u8 reserved[3]; -} __packed; - -/* - * WMI_PCP_FACTOR_EVENTID - */ -struct wmi_pcp_factor_event { - __le32 pcp_factor; -} __packed; - -/* - * WMI_SW_TX_COMPLETE_EVENTID - */ -enum wmi_sw_tx_status { - WMI_TX_SW_STATUS_SUCCESS = 0, - WMI_TX_SW_STATUS_FAILED_NO_RESOURCES = 1, - WMI_TX_SW_STATUS_FAILED_TX = 2, -}; - -struct wmi_sw_tx_complete_event { - u8 status; /* enum wmi_sw_tx_status */ - u8 reserved[3]; -} __packed; - -/* - * WMI_CORR_MEASURE_EVENTID - */ -struct wmi_corr_measure_event { - s32 i; - s32 q; - s32 image_i; - s32 image_q; -} __packed; - -/* - * WMI_READ_RSSI_EVENTID - */ -struct wmi_read_rssi_event { - __le32 ina_rssi_adc_dbm; -} __packed; - -/* - * WMI_GET_SSID_EVENTID - */ -struct wmi_get_ssid_event { - __le32 ssid_len; - u8 ssid[WMI_MAX_SSID_LEN]; -} __packed; - -/* - * WMI_RX_MGMT_PACKET_EVENTID - */ -struct wmi_rx_mgmt_info { - u8 mcs; - s8 snr; - u8 range; - u8 sqi; - __le16 stype; - __le16 status; - __le32 len; - u8 qid; - u8 mid; - u8 cid; - u8 channel; /* From Radio MNGR */ -} __packed; - -struct wmi_rx_mgmt_packet_event { - struct wmi_rx_mgmt_info info; - u8 payload[0]; -} __packed; - -/* - * WMI_ECHO_RSP_EVENTID - */ -struct wmi_echo_event { - __le32 echoed_value; -} __packed; - -/* - * WMI_TEMP_SENSE_DONE_EVENTID - * - * Measure MAC and radio temperatures - */ -struct wmi_temp_sense_done_event { - __le32 marlon_m_t1000; - __le32 marlon_r_t1000; -} __packed; - -#endif /* __WILOCITY_WMI_H__ */ diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c deleted file mode 100644 index b827d51c30a3..000000000000 --- a/drivers/net/wireless/atmel.c +++ /dev/null @@ -1,4561 +0,0 @@ -/*** -*- linux-c -*- ********************************************************** - - Driver for Atmel at76c502 at76c504 and at76c506 wireless cards. - - Copyright 2000-2001 ATMEL Corporation. - Copyright 2003-2004 Simon Kelley. - - This code was developed from version 2.1.1 of the Atmel drivers, - released by Atmel corp. under the GPL in December 2002. It also - includes code from the Linux aironet drivers (C) Benjamin Reed, - and the Linux PCMCIA package, (C) David Hinds and the Linux wireless - extensions, (C) Jean Tourrilhes. - - The firmware module for reading the MAC address of the card comes from - net.russotto.AtmelMACFW, written by Matthew T. Russotto and copyright - by him. net.russotto.AtmelMACFW is used under the GPL license version 2. - This file contains the module in binary form and, under the terms - of the GPL, in source form. The source is located at the end of the file. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This software 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 Atmel wireless lan drivers; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - For all queries about this code, please contact the current author, - Simon Kelley and not Atmel Corporation. - - Credit is due to HP UK and Cambridge Online Systems Ltd for supplying - hardware used during development of this driver. - -******************************************************************************/ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "atmel.h" - -#define DRIVER_MAJOR 0 -#define DRIVER_MINOR 98 - -MODULE_AUTHOR("Simon Kelley"); -MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); -MODULE_LICENSE("GPL"); -MODULE_SUPPORTED_DEVICE("Atmel at76c50x wireless cards"); - -/* The name of the firmware file to be loaded - over-rides any automatic selection */ -static char *firmware = NULL; -module_param(firmware, charp, 0); - -/* table of firmware file names */ -static struct { - AtmelFWType fw_type; - const char *fw_file; - const char *fw_file_ext; -} fw_table[] = { - { ATMEL_FW_TYPE_502, "atmel_at76c502", "bin" }, - { ATMEL_FW_TYPE_502D, "atmel_at76c502d", "bin" }, - { ATMEL_FW_TYPE_502E, "atmel_at76c502e", "bin" }, - { ATMEL_FW_TYPE_502_3COM, "atmel_at76c502_3com", "bin" }, - { ATMEL_FW_TYPE_504, "atmel_at76c504", "bin" }, - { ATMEL_FW_TYPE_504_2958, "atmel_at76c504_2958", "bin" }, - { ATMEL_FW_TYPE_504A_2958, "atmel_at76c504a_2958", "bin" }, - { ATMEL_FW_TYPE_506, "atmel_at76c506", "bin" }, - { ATMEL_FW_TYPE_NONE, NULL, NULL } -}; -MODULE_FIRMWARE("atmel_at76c502-wpa.bin"); -MODULE_FIRMWARE("atmel_at76c502.bin"); -MODULE_FIRMWARE("atmel_at76c502d-wpa.bin"); -MODULE_FIRMWARE("atmel_at76c502d.bin"); -MODULE_FIRMWARE("atmel_at76c502e-wpa.bin"); -MODULE_FIRMWARE("atmel_at76c502e.bin"); -MODULE_FIRMWARE("atmel_at76c502_3com-wpa.bin"); -MODULE_FIRMWARE("atmel_at76c502_3com.bin"); -MODULE_FIRMWARE("atmel_at76c504-wpa.bin"); -MODULE_FIRMWARE("atmel_at76c504.bin"); -MODULE_FIRMWARE("atmel_at76c504_2958-wpa.bin"); -MODULE_FIRMWARE("atmel_at76c504_2958.bin"); -MODULE_FIRMWARE("atmel_at76c504a_2958-wpa.bin"); -MODULE_FIRMWARE("atmel_at76c504a_2958.bin"); -MODULE_FIRMWARE("atmel_at76c506-wpa.bin"); -MODULE_FIRMWARE("atmel_at76c506.bin"); - -#define MAX_SSID_LENGTH 32 -#define MGMT_JIFFIES (256 * HZ / 100) - -#define MAX_BSS_ENTRIES 64 - -/* registers */ -#define GCR 0x00 /* (SIR0) General Configuration Register */ -#define BSR 0x02 /* (SIR1) Bank Switching Select Register */ -#define AR 0x04 -#define DR 0x08 -#define MR1 0x12 /* Mirror Register 1 */ -#define MR2 0x14 /* Mirror Register 2 */ -#define MR3 0x16 /* Mirror Register 3 */ -#define MR4 0x18 /* Mirror Register 4 */ - -#define GPR1 0x0c -#define GPR2 0x0e -#define GPR3 0x10 -/* - * Constants for the GCR register. - */ -#define GCR_REMAP 0x0400 /* Remap internal SRAM to 0 */ -#define GCR_SWRES 0x0080 /* BIU reset (ARM and PAI are NOT reset) */ -#define GCR_CORES 0x0060 /* Core Reset (ARM and PAI are reset) */ -#define GCR_ENINT 0x0002 /* Enable Interrupts */ -#define GCR_ACKINT 0x0008 /* Acknowledge Interrupts */ - -#define BSS_SRAM 0x0200 /* AMBA module selection --> SRAM */ -#define BSS_IRAM 0x0100 /* AMBA module selection --> IRAM */ -/* - *Constants for the MR registers. - */ -#define MAC_INIT_COMPLETE 0x0001 /* MAC init has been completed */ -#define MAC_BOOT_COMPLETE 0x0010 /* MAC boot has been completed */ -#define MAC_INIT_OK 0x0002 /* MAC boot has been completed */ - -#define MIB_MAX_DATA_BYTES 212 -#define MIB_HEADER_SIZE 4 /* first four fields */ - -struct get_set_mib { - u8 type; - u8 size; - u8 index; - u8 reserved; - u8 data[MIB_MAX_DATA_BYTES]; -}; - -struct rx_desc { - u32 Next; - u16 MsduPos; - u16 MsduSize; - - u8 State; - u8 Status; - u8 Rate; - u8 Rssi; - u8 LinkQuality; - u8 PreambleType; - u16 Duration; - u32 RxTime; -}; - -#define RX_DESC_FLAG_VALID 0x80 -#define RX_DESC_FLAG_CONSUMED 0x40 -#define RX_DESC_FLAG_IDLE 0x00 - -#define RX_STATUS_SUCCESS 0x00 - -#define RX_DESC_MSDU_POS_OFFSET 4 -#define RX_DESC_MSDU_SIZE_OFFSET 6 -#define RX_DESC_FLAGS_OFFSET 8 -#define RX_DESC_STATUS_OFFSET 9 -#define RX_DESC_RSSI_OFFSET 11 -#define RX_DESC_LINK_QUALITY_OFFSET 12 -#define RX_DESC_PREAMBLE_TYPE_OFFSET 13 -#define RX_DESC_DURATION_OFFSET 14 -#define RX_DESC_RX_TIME_OFFSET 16 - -struct tx_desc { - u32 NextDescriptor; - u16 TxStartOfFrame; - u16 TxLength; - - u8 TxState; - u8 TxStatus; - u8 RetryCount; - - u8 TxRate; - - u8 KeyIndex; - u8 ChiperType; - u8 ChipreLength; - u8 Reserved1; - - u8 Reserved; - u8 PacketType; - u16 HostTxLength; -}; - -#define TX_DESC_NEXT_OFFSET 0 -#define TX_DESC_POS_OFFSET 4 -#define TX_DESC_SIZE_OFFSET 6 -#define TX_DESC_FLAGS_OFFSET 8 -#define TX_DESC_STATUS_OFFSET 9 -#define TX_DESC_RETRY_OFFSET 10 -#define TX_DESC_RATE_OFFSET 11 -#define TX_DESC_KEY_INDEX_OFFSET 12 -#define TX_DESC_CIPHER_TYPE_OFFSET 13 -#define TX_DESC_CIPHER_LENGTH_OFFSET 14 -#define TX_DESC_PACKET_TYPE_OFFSET 17 -#define TX_DESC_HOST_LENGTH_OFFSET 18 - -/* - * Host-MAC interface - */ - -#define TX_STATUS_SUCCESS 0x00 - -#define TX_FIRM_OWN 0x80 -#define TX_DONE 0x40 - -#define TX_ERROR 0x01 - -#define TX_PACKET_TYPE_DATA 0x01 -#define TX_PACKET_TYPE_MGMT 0x02 - -#define ISR_EMPTY 0x00 /* no bits set in ISR */ -#define ISR_TxCOMPLETE 0x01 /* packet transmitted */ -#define ISR_RxCOMPLETE 0x02 /* packet received */ -#define ISR_RxFRAMELOST 0x04 /* Rx Frame lost */ -#define ISR_FATAL_ERROR 0x08 /* Fatal error */ -#define ISR_COMMAND_COMPLETE 0x10 /* command completed */ -#define ISR_OUT_OF_RANGE 0x20 /* command completed */ -#define ISR_IBSS_MERGE 0x40 /* (4.1.2.30): IBSS merge */ -#define ISR_GENERIC_IRQ 0x80 - -#define Local_Mib_Type 0x01 -#define Mac_Address_Mib_Type 0x02 -#define Mac_Mib_Type 0x03 -#define Statistics_Mib_Type 0x04 -#define Mac_Mgmt_Mib_Type 0x05 -#define Mac_Wep_Mib_Type 0x06 -#define Phy_Mib_Type 0x07 -#define Multi_Domain_MIB 0x08 - -#define MAC_MGMT_MIB_CUR_BSSID_POS 14 -#define MAC_MIB_FRAG_THRESHOLD_POS 8 -#define MAC_MIB_RTS_THRESHOLD_POS 10 -#define MAC_MIB_SHORT_RETRY_POS 16 -#define MAC_MIB_LONG_RETRY_POS 17 -#define MAC_MIB_SHORT_RETRY_LIMIT_POS 16 -#define MAC_MGMT_MIB_BEACON_PER_POS 0 -#define MAC_MGMT_MIB_STATION_ID_POS 6 -#define MAC_MGMT_MIB_CUR_PRIVACY_POS 11 -#define MAC_MGMT_MIB_CUR_BSSID_POS 14 -#define MAC_MGMT_MIB_PS_MODE_POS 53 -#define MAC_MGMT_MIB_LISTEN_INTERVAL_POS 54 -#define MAC_MGMT_MIB_MULTI_DOMAIN_IMPLEMENTED 56 -#define MAC_MGMT_MIB_MULTI_DOMAIN_ENABLED 57 -#define PHY_MIB_CHANNEL_POS 14 -#define PHY_MIB_RATE_SET_POS 20 -#define PHY_MIB_REG_DOMAIN_POS 26 -#define LOCAL_MIB_AUTO_TX_RATE_POS 3 -#define LOCAL_MIB_SSID_SIZE 5 -#define LOCAL_MIB_TX_PROMISCUOUS_POS 6 -#define LOCAL_MIB_TX_MGMT_RATE_POS 7 -#define LOCAL_MIB_TX_CONTROL_RATE_POS 8 -#define LOCAL_MIB_PREAMBLE_TYPE 9 -#define MAC_ADDR_MIB_MAC_ADDR_POS 0 - -#define CMD_Set_MIB_Vars 0x01 -#define CMD_Get_MIB_Vars 0x02 -#define CMD_Scan 0x03 -#define CMD_Join 0x04 -#define CMD_Start 0x05 -#define CMD_EnableRadio 0x06 -#define CMD_DisableRadio 0x07 -#define CMD_SiteSurvey 0x0B - -#define CMD_STATUS_IDLE 0x00 -#define CMD_STATUS_COMPLETE 0x01 -#define CMD_STATUS_UNKNOWN 0x02 -#define CMD_STATUS_INVALID_PARAMETER 0x03 -#define CMD_STATUS_FUNCTION_NOT_SUPPORTED 0x04 -#define CMD_STATUS_TIME_OUT 0x07 -#define CMD_STATUS_IN_PROGRESS 0x08 -#define CMD_STATUS_REJECTED_RADIO_OFF 0x09 -#define CMD_STATUS_HOST_ERROR 0xFF -#define CMD_STATUS_BUSY 0xFE - -#define CMD_BLOCK_COMMAND_OFFSET 0 -#define CMD_BLOCK_STATUS_OFFSET 1 -#define CMD_BLOCK_PARAMETERS_OFFSET 4 - -#define SCAN_OPTIONS_SITE_SURVEY 0x80 - -#define MGMT_FRAME_BODY_OFFSET 24 -#define MAX_AUTHENTICATION_RETRIES 3 -#define MAX_ASSOCIATION_RETRIES 3 - -#define AUTHENTICATION_RESPONSE_TIME_OUT 1000 - -#define MAX_WIRELESS_BODY 2316 /* mtu is 2312, CRC is 4 */ -#define LOOP_RETRY_LIMIT 500000 - -#define ACTIVE_MODE 1 -#define PS_MODE 2 - -#define MAX_ENCRYPTION_KEYS 4 -#define MAX_ENCRYPTION_KEY_SIZE 40 - -/* - * 802.11 related definitions - */ - -/* - * Regulatory Domains - */ - -#define REG_DOMAIN_FCC 0x10 /* Channels 1-11 USA */ -#define REG_DOMAIN_DOC 0x20 /* Channel 1-11 Canada */ -#define REG_DOMAIN_ETSI 0x30 /* Channel 1-13 Europe (ex Spain/France) */ -#define REG_DOMAIN_SPAIN 0x31 /* Channel 10-11 Spain */ -#define REG_DOMAIN_FRANCE 0x32 /* Channel 10-13 France */ -#define REG_DOMAIN_MKK 0x40 /* Channel 14 Japan */ -#define REG_DOMAIN_MKK1 0x41 /* Channel 1-14 Japan(MKK1) */ -#define REG_DOMAIN_ISRAEL 0x50 /* Channel 3-9 ISRAEL */ - -#define BSS_TYPE_AD_HOC 1 -#define BSS_TYPE_INFRASTRUCTURE 2 - -#define SCAN_TYPE_ACTIVE 0 -#define SCAN_TYPE_PASSIVE 1 - -#define LONG_PREAMBLE 0 -#define SHORT_PREAMBLE 1 -#define AUTO_PREAMBLE 2 - -#define DATA_FRAME_WS_HEADER_SIZE 30 - -/* promiscuous mode control */ -#define PROM_MODE_OFF 0x0 -#define PROM_MODE_UNKNOWN 0x1 -#define PROM_MODE_CRC_FAILED 0x2 -#define PROM_MODE_DUPLICATED 0x4 -#define PROM_MODE_MGMT 0x8 -#define PROM_MODE_CTRL 0x10 -#define PROM_MODE_BAD_PROTOCOL 0x20 - -#define IFACE_INT_STATUS_OFFSET 0 -#define IFACE_INT_MASK_OFFSET 1 -#define IFACE_LOCKOUT_HOST_OFFSET 2 -#define IFACE_LOCKOUT_MAC_OFFSET 3 -#define IFACE_FUNC_CTRL_OFFSET 28 -#define IFACE_MAC_STAT_OFFSET 30 -#define IFACE_GENERIC_INT_TYPE_OFFSET 32 - -#define CIPHER_SUITE_NONE 0 -#define CIPHER_SUITE_WEP_64 1 -#define CIPHER_SUITE_TKIP 2 -#define CIPHER_SUITE_AES 3 -#define CIPHER_SUITE_CCX 4 -#define CIPHER_SUITE_WEP_128 5 - -/* - * IFACE MACROS & definitions - */ - -/* - * FuncCtrl field: - */ -#define FUNC_CTRL_TxENABLE 0x10 -#define FUNC_CTRL_RxENABLE 0x20 -#define FUNC_CTRL_INIT_COMPLETE 0x01 - -/* A stub firmware image which reads the MAC address from NVRAM on the card. - For copyright information and source see the end of this file. */ -static u8 mac_reader[] = { - 0x06, 0x00, 0x00, 0xea, 0x04, 0x00, 0x00, 0xea, 0x03, 0x00, 0x00, 0xea, 0x02, 0x00, 0x00, 0xea, - 0x01, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00, 0xea, 0xff, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, - 0xd3, 0x00, 0xa0, 0xe3, 0x00, 0xf0, 0x21, 0xe1, 0x0e, 0x04, 0xa0, 0xe3, 0x00, 0x10, 0xa0, 0xe3, - 0x81, 0x11, 0xa0, 0xe1, 0x00, 0x10, 0x81, 0xe3, 0x00, 0x10, 0x80, 0xe5, 0x1c, 0x10, 0x90, 0xe5, - 0x10, 0x10, 0xc1, 0xe3, 0x1c, 0x10, 0x80, 0xe5, 0x01, 0x10, 0xa0, 0xe3, 0x08, 0x10, 0x80, 0xe5, - 0x02, 0x03, 0xa0, 0xe3, 0x00, 0x10, 0xa0, 0xe3, 0xb0, 0x10, 0xc0, 0xe1, 0xb4, 0x10, 0xc0, 0xe1, - 0xb8, 0x10, 0xc0, 0xe1, 0xbc, 0x10, 0xc0, 0xe1, 0x56, 0xdc, 0xa0, 0xe3, 0x21, 0x00, 0x00, 0xeb, - 0x0a, 0x00, 0xa0, 0xe3, 0x1a, 0x00, 0x00, 0xeb, 0x10, 0x00, 0x00, 0xeb, 0x07, 0x00, 0x00, 0xeb, - 0x02, 0x03, 0xa0, 0xe3, 0x02, 0x14, 0xa0, 0xe3, 0xb4, 0x10, 0xc0, 0xe1, 0x4c, 0x10, 0x9f, 0xe5, - 0xbc, 0x10, 0xc0, 0xe1, 0x10, 0x10, 0xa0, 0xe3, 0xb8, 0x10, 0xc0, 0xe1, 0xfe, 0xff, 0xff, 0xea, - 0x00, 0x40, 0x2d, 0xe9, 0x00, 0x20, 0xa0, 0xe3, 0x02, 0x3c, 0xa0, 0xe3, 0x00, 0x10, 0xa0, 0xe3, - 0x28, 0x00, 0x9f, 0xe5, 0x37, 0x00, 0x00, 0xeb, 0x00, 0x40, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, - 0x00, 0x40, 0x2d, 0xe9, 0x12, 0x2e, 0xa0, 0xe3, 0x06, 0x30, 0xa0, 0xe3, 0x00, 0x10, 0xa0, 0xe3, - 0x02, 0x04, 0xa0, 0xe3, 0x2f, 0x00, 0x00, 0xeb, 0x00, 0x40, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, - 0x00, 0x02, 0x00, 0x02, 0x80, 0x01, 0x90, 0xe0, 0x01, 0x00, 0x00, 0x0a, 0x01, 0x00, 0x50, 0xe2, - 0xfc, 0xff, 0xff, 0xea, 0x1e, 0xff, 0x2f, 0xe1, 0x80, 0x10, 0xa0, 0xe3, 0xf3, 0x06, 0xa0, 0xe3, - 0x00, 0x10, 0x80, 0xe5, 0x00, 0x10, 0xa0, 0xe3, 0x00, 0x10, 0x80, 0xe5, 0x01, 0x10, 0xa0, 0xe3, - 0x04, 0x10, 0x80, 0xe5, 0x00, 0x10, 0x80, 0xe5, 0x0e, 0x34, 0xa0, 0xe3, 0x1c, 0x10, 0x93, 0xe5, - 0x02, 0x1a, 0x81, 0xe3, 0x1c, 0x10, 0x83, 0xe5, 0x58, 0x11, 0x9f, 0xe5, 0x30, 0x10, 0x80, 0xe5, - 0x54, 0x11, 0x9f, 0xe5, 0x34, 0x10, 0x80, 0xe5, 0x38, 0x10, 0x80, 0xe5, 0x3c, 0x10, 0x80, 0xe5, - 0x10, 0x10, 0x90, 0xe5, 0x08, 0x00, 0x90, 0xe5, 0x1e, 0xff, 0x2f, 0xe1, 0xf3, 0x16, 0xa0, 0xe3, - 0x08, 0x00, 0x91, 0xe5, 0x05, 0x00, 0xa0, 0xe3, 0x0c, 0x00, 0x81, 0xe5, 0x10, 0x00, 0x91, 0xe5, - 0x02, 0x00, 0x10, 0xe3, 0xfc, 0xff, 0xff, 0x0a, 0xff, 0x00, 0xa0, 0xe3, 0x0c, 0x00, 0x81, 0xe5, - 0x10, 0x00, 0x91, 0xe5, 0x02, 0x00, 0x10, 0xe3, 0xfc, 0xff, 0xff, 0x0a, 0x08, 0x00, 0x91, 0xe5, - 0x10, 0x00, 0x91, 0xe5, 0x01, 0x00, 0x10, 0xe3, 0xfc, 0xff, 0xff, 0x0a, 0x08, 0x00, 0x91, 0xe5, - 0xff, 0x00, 0x00, 0xe2, 0x1e, 0xff, 0x2f, 0xe1, 0x30, 0x40, 0x2d, 0xe9, 0x00, 0x50, 0xa0, 0xe1, - 0x03, 0x40, 0xa0, 0xe1, 0xa2, 0x02, 0xa0, 0xe1, 0x08, 0x00, 0x00, 0xe2, 0x03, 0x00, 0x80, 0xe2, - 0xd8, 0x10, 0x9f, 0xe5, 0x00, 0x00, 0xc1, 0xe5, 0x01, 0x20, 0xc1, 0xe5, 0xe2, 0xff, 0xff, 0xeb, - 0x01, 0x00, 0x10, 0xe3, 0xfc, 0xff, 0xff, 0x1a, 0x14, 0x00, 0xa0, 0xe3, 0xc4, 0xff, 0xff, 0xeb, - 0x04, 0x20, 0xa0, 0xe1, 0x05, 0x10, 0xa0, 0xe1, 0x02, 0x00, 0xa0, 0xe3, 0x01, 0x00, 0x00, 0xeb, - 0x30, 0x40, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, 0x70, 0x40, 0x2d, 0xe9, 0xf3, 0x46, 0xa0, 0xe3, - 0x00, 0x30, 0xa0, 0xe3, 0x00, 0x00, 0x50, 0xe3, 0x08, 0x00, 0x00, 0x9a, 0x8c, 0x50, 0x9f, 0xe5, - 0x03, 0x60, 0xd5, 0xe7, 0x0c, 0x60, 0x84, 0xe5, 0x10, 0x60, 0x94, 0xe5, 0x02, 0x00, 0x16, 0xe3, - 0xfc, 0xff, 0xff, 0x0a, 0x01, 0x30, 0x83, 0xe2, 0x00, 0x00, 0x53, 0xe1, 0xf7, 0xff, 0xff, 0x3a, - 0xff, 0x30, 0xa0, 0xe3, 0x0c, 0x30, 0x84, 0xe5, 0x08, 0x00, 0x94, 0xe5, 0x10, 0x00, 0x94, 0xe5, - 0x01, 0x00, 0x10, 0xe3, 0xfc, 0xff, 0xff, 0x0a, 0x08, 0x00, 0x94, 0xe5, 0x00, 0x00, 0xa0, 0xe3, - 0x00, 0x00, 0x52, 0xe3, 0x0b, 0x00, 0x00, 0x9a, 0x10, 0x50, 0x94, 0xe5, 0x02, 0x00, 0x15, 0xe3, - 0xfc, 0xff, 0xff, 0x0a, 0x0c, 0x30, 0x84, 0xe5, 0x10, 0x50, 0x94, 0xe5, 0x01, 0x00, 0x15, 0xe3, - 0xfc, 0xff, 0xff, 0x0a, 0x08, 0x50, 0x94, 0xe5, 0x01, 0x50, 0xc1, 0xe4, 0x01, 0x00, 0x80, 0xe2, - 0x02, 0x00, 0x50, 0xe1, 0xf3, 0xff, 0xff, 0x3a, 0xc8, 0x00, 0xa0, 0xe3, 0x98, 0xff, 0xff, 0xeb, - 0x70, 0x40, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, 0x01, 0x0c, 0x00, 0x02, 0x01, 0x02, 0x00, 0x02, - 0x00, 0x01, 0x00, 0x02 -}; - -struct atmel_private { - void *card; /* Bus dependent structure varies for PCcard */ - int (*present_callback)(void *); /* And callback which uses it */ - char firmware_id[32]; - AtmelFWType firmware_type; - u8 *firmware; - int firmware_length; - struct timer_list management_timer; - struct net_device *dev; - struct device *sys_dev; - struct iw_statistics wstats; - spinlock_t irqlock, timerlock; /* spinlocks */ - enum { BUS_TYPE_PCCARD, BUS_TYPE_PCI } bus_type; - enum { - CARD_TYPE_PARALLEL_FLASH, - CARD_TYPE_SPI_FLASH, - CARD_TYPE_EEPROM - } card_type; - int do_rx_crc; /* If we need to CRC incoming packets */ - int probe_crc; /* set if we don't yet know */ - int crc_ok_cnt, crc_ko_cnt; /* counters for probing */ - u16 rx_desc_head; - u16 tx_desc_free, tx_desc_head, tx_desc_tail, tx_desc_previous; - u16 tx_free_mem, tx_buff_head, tx_buff_tail; - - u16 frag_seq, frag_len, frag_no; - u8 frag_source[6]; - - u8 wep_is_on, default_key, exclude_unencrypted, encryption_level; - u8 group_cipher_suite, pairwise_cipher_suite; - u8 wep_keys[MAX_ENCRYPTION_KEYS][MAX_ENCRYPTION_KEY_SIZE]; - int wep_key_len[MAX_ENCRYPTION_KEYS]; - int use_wpa, radio_on_broken; /* firmware dependent stuff. */ - - u16 host_info_base; - struct host_info_struct { - /* NB this is matched to the hardware, don't change. */ - u8 volatile int_status; - u8 volatile int_mask; - u8 volatile lockout_host; - u8 volatile lockout_mac; - - u16 tx_buff_pos; - u16 tx_buff_size; - u16 tx_desc_pos; - u16 tx_desc_count; - - u16 rx_buff_pos; - u16 rx_buff_size; - u16 rx_desc_pos; - u16 rx_desc_count; - - u16 build_version; - u16 command_pos; - - u16 major_version; - u16 minor_version; - - u16 func_ctrl; - u16 mac_status; - u16 generic_IRQ_type; - u8 reserved[2]; - } host_info; - - enum { - STATION_STATE_SCANNING, - STATION_STATE_JOINNING, - STATION_STATE_AUTHENTICATING, - STATION_STATE_ASSOCIATING, - STATION_STATE_READY, - STATION_STATE_REASSOCIATING, - STATION_STATE_DOWN, - STATION_STATE_MGMT_ERROR - } station_state; - - int operating_mode, power_mode; - time_t last_qual; - int beacons_this_sec; - int channel; - int reg_domain, config_reg_domain; - int tx_rate; - int auto_tx_rate; - int rts_threshold; - int frag_threshold; - int long_retry, short_retry; - int preamble; - int default_beacon_period, beacon_period, listen_interval; - int CurrentAuthentTransactionSeqNum, ExpectedAuthentTransactionSeqNum; - int AuthenticationRequestRetryCnt, AssociationRequestRetryCnt, ReAssociationRequestRetryCnt; - enum { - SITE_SURVEY_IDLE, - SITE_SURVEY_IN_PROGRESS, - SITE_SURVEY_COMPLETED - } site_survey_state; - unsigned long last_survey; - - int station_was_associated, station_is_associated; - int fast_scan; - - struct bss_info { - int channel; - int SSIDsize; - int RSSI; - int UsingWEP; - int preamble; - int beacon_period; - int BSStype; - u8 BSSID[6]; - u8 SSID[MAX_SSID_LENGTH]; - } BSSinfo[MAX_BSS_ENTRIES]; - int BSS_list_entries, current_BSS; - int connect_to_any_BSS; - int SSID_size, new_SSID_size; - u8 CurrentBSSID[6], BSSID[6]; - u8 SSID[MAX_SSID_LENGTH], new_SSID[MAX_SSID_LENGTH]; - u64 last_beacon_timestamp; - u8 rx_buf[MAX_WIRELESS_BODY]; -}; - -static u8 atmel_basic_rates[4] = {0x82, 0x84, 0x0b, 0x16}; - -static const struct { - int reg_domain; - int min, max; - char *name; -} channel_table[] = { { REG_DOMAIN_FCC, 1, 11, "USA" }, - { REG_DOMAIN_DOC, 1, 11, "Canada" }, - { REG_DOMAIN_ETSI, 1, 13, "Europe" }, - { REG_DOMAIN_SPAIN, 10, 11, "Spain" }, - { REG_DOMAIN_FRANCE, 10, 13, "France" }, - { REG_DOMAIN_MKK, 14, 14, "MKK" }, - { REG_DOMAIN_MKK1, 1, 14, "MKK1" }, - { REG_DOMAIN_ISRAEL, 3, 9, "Israel"} }; - -static void build_wpa_mib(struct atmel_private *priv); -static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -static void atmel_copy_to_card(struct net_device *dev, u16 dest, - const unsigned char *src, u16 len); -static void atmel_copy_to_host(struct net_device *dev, unsigned char *dest, - u16 src, u16 len); -static void atmel_set_gcr(struct net_device *dev, u16 mask); -static void atmel_clear_gcr(struct net_device *dev, u16 mask); -static int atmel_lock_mac(struct atmel_private *priv); -static void atmel_wmem32(struct atmel_private *priv, u16 pos, u32 data); -static void atmel_command_irq(struct atmel_private *priv); -static int atmel_validate_channel(struct atmel_private *priv, int channel); -static void atmel_management_frame(struct atmel_private *priv, - struct ieee80211_hdr *header, - u16 frame_len, u8 rssi); -static void atmel_management_timer(u_long a); -static void atmel_send_command(struct atmel_private *priv, int command, - void *cmd, int cmd_size); -static int atmel_send_command_wait(struct atmel_private *priv, int command, - void *cmd, int cmd_size); -static void atmel_transmit_management_frame(struct atmel_private *priv, - struct ieee80211_hdr *header, - u8 *body, int body_len); - -static u8 atmel_get_mib8(struct atmel_private *priv, u8 type, u8 index); -static void atmel_set_mib8(struct atmel_private *priv, u8 type, u8 index, - u8 data); -static void atmel_set_mib16(struct atmel_private *priv, u8 type, u8 index, - u16 data); -static void atmel_set_mib(struct atmel_private *priv, u8 type, u8 index, - u8 *data, int data_len); -static void atmel_get_mib(struct atmel_private *priv, u8 type, u8 index, - u8 *data, int data_len); -static void atmel_scan(struct atmel_private *priv, int specific_ssid); -static void atmel_join_bss(struct atmel_private *priv, int bss_index); -static void atmel_smooth_qual(struct atmel_private *priv); -static void atmel_writeAR(struct net_device *dev, u16 data); -static int probe_atmel_card(struct net_device *dev); -static int reset_atmel_card(struct net_device *dev); -static void atmel_enter_state(struct atmel_private *priv, int new_state); -int atmel_open (struct net_device *dev); - -static inline u16 atmel_hi(struct atmel_private *priv, u16 offset) -{ - return priv->host_info_base + offset; -} - -static inline u16 atmel_co(struct atmel_private *priv, u16 offset) -{ - return priv->host_info.command_pos + offset; -} - -static inline u16 atmel_rx(struct atmel_private *priv, u16 offset, u16 desc) -{ - return priv->host_info.rx_desc_pos + (sizeof(struct rx_desc) * desc) + offset; -} - -static inline u16 atmel_tx(struct atmel_private *priv, u16 offset, u16 desc) -{ - return priv->host_info.tx_desc_pos + (sizeof(struct tx_desc) * desc) + offset; -} - -static inline u8 atmel_read8(struct net_device *dev, u16 offset) -{ - return inb(dev->base_addr + offset); -} - -static inline void atmel_write8(struct net_device *dev, u16 offset, u8 data) -{ - outb(data, dev->base_addr + offset); -} - -static inline u16 atmel_read16(struct net_device *dev, u16 offset) -{ - return inw(dev->base_addr + offset); -} - -static inline void atmel_write16(struct net_device *dev, u16 offset, u16 data) -{ - outw(data, dev->base_addr + offset); -} - -static inline u8 atmel_rmem8(struct atmel_private *priv, u16 pos) -{ - atmel_writeAR(priv->dev, pos); - return atmel_read8(priv->dev, DR); -} - -static inline void atmel_wmem8(struct atmel_private *priv, u16 pos, u16 data) -{ - atmel_writeAR(priv->dev, pos); - atmel_write8(priv->dev, DR, data); -} - -static inline u16 atmel_rmem16(struct atmel_private *priv, u16 pos) -{ - atmel_writeAR(priv->dev, pos); - return atmel_read16(priv->dev, DR); -} - -static inline void atmel_wmem16(struct atmel_private *priv, u16 pos, u16 data) -{ - atmel_writeAR(priv->dev, pos); - atmel_write16(priv->dev, DR, data); -} - -static const struct iw_handler_def atmel_handler_def; - -static void tx_done_irq(struct atmel_private *priv) -{ - int i; - - for (i = 0; - atmel_rmem8(priv, atmel_tx(priv, TX_DESC_FLAGS_OFFSET, priv->tx_desc_head)) == TX_DONE && - i < priv->host_info.tx_desc_count; - i++) { - u8 status = atmel_rmem8(priv, atmel_tx(priv, TX_DESC_STATUS_OFFSET, priv->tx_desc_head)); - u16 msdu_size = atmel_rmem16(priv, atmel_tx(priv, TX_DESC_SIZE_OFFSET, priv->tx_desc_head)); - u8 type = atmel_rmem8(priv, atmel_tx(priv, TX_DESC_PACKET_TYPE_OFFSET, priv->tx_desc_head)); - - atmel_wmem8(priv, atmel_tx(priv, TX_DESC_FLAGS_OFFSET, priv->tx_desc_head), 0); - - priv->tx_free_mem += msdu_size; - priv->tx_desc_free++; - - if (priv->tx_buff_head + msdu_size > (priv->host_info.tx_buff_pos + priv->host_info.tx_buff_size)) - priv->tx_buff_head = 0; - else - priv->tx_buff_head += msdu_size; - - if (priv->tx_desc_head < (priv->host_info.tx_desc_count - 1)) - priv->tx_desc_head++ ; - else - priv->tx_desc_head = 0; - - if (type == TX_PACKET_TYPE_DATA) { - if (status == TX_STATUS_SUCCESS) - priv->dev->stats.tx_packets++; - else - priv->dev->stats.tx_errors++; - netif_wake_queue(priv->dev); - } - } -} - -static u16 find_tx_buff(struct atmel_private *priv, u16 len) -{ - u16 bottom_free = priv->host_info.tx_buff_size - priv->tx_buff_tail; - - if (priv->tx_desc_free == 3 || priv->tx_free_mem < len) - return 0; - - if (bottom_free >= len) - return priv->host_info.tx_buff_pos + priv->tx_buff_tail; - - if (priv->tx_free_mem - bottom_free >= len) { - priv->tx_buff_tail = 0; - return priv->host_info.tx_buff_pos; - } - - return 0; -} - -static void tx_update_descriptor(struct atmel_private *priv, int is_bcast, - u16 len, u16 buff, u8 type) -{ - atmel_wmem16(priv, atmel_tx(priv, TX_DESC_POS_OFFSET, priv->tx_desc_tail), buff); - atmel_wmem16(priv, atmel_tx(priv, TX_DESC_SIZE_OFFSET, priv->tx_desc_tail), len); - if (!priv->use_wpa) - atmel_wmem16(priv, atmel_tx(priv, TX_DESC_HOST_LENGTH_OFFSET, priv->tx_desc_tail), len); - atmel_wmem8(priv, atmel_tx(priv, TX_DESC_PACKET_TYPE_OFFSET, priv->tx_desc_tail), type); - atmel_wmem8(priv, atmel_tx(priv, TX_DESC_RATE_OFFSET, priv->tx_desc_tail), priv->tx_rate); - atmel_wmem8(priv, atmel_tx(priv, TX_DESC_RETRY_OFFSET, priv->tx_desc_tail), 0); - if (priv->use_wpa) { - int cipher_type, cipher_length; - if (is_bcast) { - cipher_type = priv->group_cipher_suite; - if (cipher_type == CIPHER_SUITE_WEP_64 || - cipher_type == CIPHER_SUITE_WEP_128) - cipher_length = 8; - else if (cipher_type == CIPHER_SUITE_TKIP) - cipher_length = 12; - else if (priv->pairwise_cipher_suite == CIPHER_SUITE_WEP_64 || - priv->pairwise_cipher_suite == CIPHER_SUITE_WEP_128) { - cipher_type = priv->pairwise_cipher_suite; - cipher_length = 8; - } else { - cipher_type = CIPHER_SUITE_NONE; - cipher_length = 0; - } - } else { - cipher_type = priv->pairwise_cipher_suite; - if (cipher_type == CIPHER_SUITE_WEP_64 || - cipher_type == CIPHER_SUITE_WEP_128) - cipher_length = 8; - else if (cipher_type == CIPHER_SUITE_TKIP) - cipher_length = 12; - else if (priv->group_cipher_suite == CIPHER_SUITE_WEP_64 || - priv->group_cipher_suite == CIPHER_SUITE_WEP_128) { - cipher_type = priv->group_cipher_suite; - cipher_length = 8; - } else { - cipher_type = CIPHER_SUITE_NONE; - cipher_length = 0; - } - } - - atmel_wmem8(priv, atmel_tx(priv, TX_DESC_CIPHER_TYPE_OFFSET, priv->tx_desc_tail), - cipher_type); - atmel_wmem8(priv, atmel_tx(priv, TX_DESC_CIPHER_LENGTH_OFFSET, priv->tx_desc_tail), - cipher_length); - } - atmel_wmem32(priv, atmel_tx(priv, TX_DESC_NEXT_OFFSET, priv->tx_desc_tail), 0x80000000L); - atmel_wmem8(priv, atmel_tx(priv, TX_DESC_FLAGS_OFFSET, priv->tx_desc_tail), TX_FIRM_OWN); - if (priv->tx_desc_previous != priv->tx_desc_tail) - atmel_wmem32(priv, atmel_tx(priv, TX_DESC_NEXT_OFFSET, priv->tx_desc_previous), 0); - priv->tx_desc_previous = priv->tx_desc_tail; - if (priv->tx_desc_tail < (priv->host_info.tx_desc_count - 1)) - priv->tx_desc_tail++; - else - priv->tx_desc_tail = 0; - priv->tx_desc_free--; - priv->tx_free_mem -= len; -} - -static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev) -{ - static const u8 SNAP_RFC1024[6] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; - struct atmel_private *priv = netdev_priv(dev); - struct ieee80211_hdr header; - unsigned long flags; - u16 buff, frame_ctl, len = (ETH_ZLEN < skb->len) ? skb->len : ETH_ZLEN; - - if (priv->card && priv->present_callback && - !(*priv->present_callback)(priv->card)) { - dev->stats.tx_errors++; - dev_kfree_skb(skb); - return NETDEV_TX_OK; - } - - if (priv->station_state != STATION_STATE_READY) { - dev->stats.tx_errors++; - dev_kfree_skb(skb); - return NETDEV_TX_OK; - } - - /* first ensure the timer func cannot run */ - spin_lock_bh(&priv->timerlock); - /* then stop the hardware ISR */ - spin_lock_irqsave(&priv->irqlock, flags); - /* nb doing the above in the opposite order will deadlock */ - - /* The Wireless Header is 30 bytes. In the Ethernet packet we "cut" the - 12 first bytes (containing DA/SA) and put them in the appropriate - fields of the Wireless Header. Thus the packet length is then the - initial + 18 (+30-12) */ - - if (!(buff = find_tx_buff(priv, len + 18))) { - dev->stats.tx_dropped++; - spin_unlock_irqrestore(&priv->irqlock, flags); - spin_unlock_bh(&priv->timerlock); - netif_stop_queue(dev); - return NETDEV_TX_BUSY; - } - - frame_ctl = IEEE80211_FTYPE_DATA; - header.duration_id = 0; - header.seq_ctrl = 0; - if (priv->wep_is_on) - frame_ctl |= IEEE80211_FCTL_PROTECTED; - if (priv->operating_mode == IW_MODE_ADHOC) { - skb_copy_from_linear_data(skb, &header.addr1, 6); - memcpy(&header.addr2, dev->dev_addr, 6); - memcpy(&header.addr3, priv->BSSID, 6); - } else { - frame_ctl |= IEEE80211_FCTL_TODS; - memcpy(&header.addr1, priv->CurrentBSSID, 6); - memcpy(&header.addr2, dev->dev_addr, 6); - skb_copy_from_linear_data(skb, &header.addr3, 6); - } - - if (priv->use_wpa) - memcpy(&header.addr4, SNAP_RFC1024, 6); - - header.frame_control = cpu_to_le16(frame_ctl); - /* Copy the wireless header into the card */ - atmel_copy_to_card(dev, buff, (unsigned char *)&header, DATA_FRAME_WS_HEADER_SIZE); - /* Copy the packet sans its 802.3 header addresses which have been replaced */ - atmel_copy_to_card(dev, buff + DATA_FRAME_WS_HEADER_SIZE, skb->data + 12, len - 12); - priv->tx_buff_tail += len - 12 + DATA_FRAME_WS_HEADER_SIZE; - - /* low bit of first byte of destination tells us if broadcast */ - tx_update_descriptor(priv, *(skb->data) & 0x01, len + 18, buff, TX_PACKET_TYPE_DATA); - dev->stats.tx_bytes += len; - - spin_unlock_irqrestore(&priv->irqlock, flags); - spin_unlock_bh(&priv->timerlock); - dev_kfree_skb(skb); - - return NETDEV_TX_OK; -} - -static void atmel_transmit_management_frame(struct atmel_private *priv, - struct ieee80211_hdr *header, - u8 *body, int body_len) -{ - u16 buff; - int len = MGMT_FRAME_BODY_OFFSET + body_len; - - if (!(buff = find_tx_buff(priv, len))) - return; - - atmel_copy_to_card(priv->dev, buff, (u8 *)header, MGMT_FRAME_BODY_OFFSET); - atmel_copy_to_card(priv->dev, buff + MGMT_FRAME_BODY_OFFSET, body, body_len); - priv->tx_buff_tail += len; - tx_update_descriptor(priv, header->addr1[0] & 0x01, len, buff, TX_PACKET_TYPE_MGMT); -} - -static void fast_rx_path(struct atmel_private *priv, - struct ieee80211_hdr *header, - u16 msdu_size, u16 rx_packet_loc, u32 crc) -{ - /* fast path: unfragmented packet copy directly into skbuf */ - u8 mac4[6]; - struct sk_buff *skb; - unsigned char *skbp; - - /* get the final, mac 4 header field, this tells us encapsulation */ - atmel_copy_to_host(priv->dev, mac4, rx_packet_loc + 24, 6); - msdu_size -= 6; - - if (priv->do_rx_crc) { - crc = crc32_le(crc, mac4, 6); - msdu_size -= 4; - } - - if (!(skb = dev_alloc_skb(msdu_size + 14))) { - priv->dev->stats.rx_dropped++; - return; - } - - skb_reserve(skb, 2); - skbp = skb_put(skb, msdu_size + 12); - atmel_copy_to_host(priv->dev, skbp + 12, rx_packet_loc + 30, msdu_size); - - if (priv->do_rx_crc) { - u32 netcrc; - crc = crc32_le(crc, skbp + 12, msdu_size); - atmel_copy_to_host(priv->dev, (void *)&netcrc, rx_packet_loc + 30 + msdu_size, 4); - if ((crc ^ 0xffffffff) != netcrc) { - priv->dev->stats.rx_crc_errors++; - dev_kfree_skb(skb); - return; - } - } - - memcpy(skbp, header->addr1, 6); /* destination address */ - if (le16_to_cpu(header->frame_control) & IEEE80211_FCTL_FROMDS) - memcpy(&skbp[6], header->addr3, 6); - else - memcpy(&skbp[6], header->addr2, 6); /* source address */ - - skb->protocol = eth_type_trans(skb, priv->dev); - skb->ip_summed = CHECKSUM_NONE; - netif_rx(skb); - priv->dev->stats.rx_bytes += 12 + msdu_size; - priv->dev->stats.rx_packets++; -} - -/* Test to see if the packet in card memory at packet_loc has a valid CRC - It doesn't matter that this is slow: it is only used to proble the first few - packets. */ -static int probe_crc(struct atmel_private *priv, u16 packet_loc, u16 msdu_size) -{ - int i = msdu_size - 4; - u32 netcrc, crc = 0xffffffff; - - if (msdu_size < 4) - return 0; - - atmel_copy_to_host(priv->dev, (void *)&netcrc, packet_loc + i, 4); - - atmel_writeAR(priv->dev, packet_loc); - while (i--) { - u8 octet = atmel_read8(priv->dev, DR); - crc = crc32_le(crc, &octet, 1); - } - - return (crc ^ 0xffffffff) == netcrc; -} - -static void frag_rx_path(struct atmel_private *priv, - struct ieee80211_hdr *header, - u16 msdu_size, u16 rx_packet_loc, u32 crc, u16 seq_no, - u8 frag_no, int more_frags) -{ - u8 mac4[6]; - u8 source[6]; - struct sk_buff *skb; - - if (le16_to_cpu(header->frame_control) & IEEE80211_FCTL_FROMDS) - memcpy(source, header->addr3, 6); - else - memcpy(source, header->addr2, 6); - - rx_packet_loc += 24; /* skip header */ - - if (priv->do_rx_crc) - msdu_size -= 4; - - if (frag_no == 0) { /* first fragment */ - atmel_copy_to_host(priv->dev, mac4, rx_packet_loc, 6); - msdu_size -= 6; - rx_packet_loc += 6; - - if (priv->do_rx_crc) - crc = crc32_le(crc, mac4, 6); - - priv->frag_seq = seq_no; - priv->frag_no = 1; - priv->frag_len = msdu_size; - memcpy(priv->frag_source, source, 6); - memcpy(&priv->rx_buf[6], source, 6); - memcpy(priv->rx_buf, header->addr1, 6); - - atmel_copy_to_host(priv->dev, &priv->rx_buf[12], rx_packet_loc, msdu_size); - - if (priv->do_rx_crc) { - u32 netcrc; - crc = crc32_le(crc, &priv->rx_buf[12], msdu_size); - atmel_copy_to_host(priv->dev, (void *)&netcrc, rx_packet_loc + msdu_size, 4); - if ((crc ^ 0xffffffff) != netcrc) { - priv->dev->stats.rx_crc_errors++; - memset(priv->frag_source, 0xff, 6); - } - } - - } else if (priv->frag_no == frag_no && - priv->frag_seq == seq_no && - memcmp(priv->frag_source, source, 6) == 0) { - - atmel_copy_to_host(priv->dev, &priv->rx_buf[12 + priv->frag_len], - rx_packet_loc, msdu_size); - if (priv->do_rx_crc) { - u32 netcrc; - crc = crc32_le(crc, - &priv->rx_buf[12 + priv->frag_len], - msdu_size); - atmel_copy_to_host(priv->dev, (void *)&netcrc, rx_packet_loc + msdu_size, 4); - if ((crc ^ 0xffffffff) != netcrc) { - priv->dev->stats.rx_crc_errors++; - memset(priv->frag_source, 0xff, 6); - more_frags = 1; /* don't send broken assembly */ - } - } - - priv->frag_len += msdu_size; - priv->frag_no++; - - if (!more_frags) { /* last one */ - memset(priv->frag_source, 0xff, 6); - if (!(skb = dev_alloc_skb(priv->frag_len + 14))) { - priv->dev->stats.rx_dropped++; - } else { - skb_reserve(skb, 2); - memcpy(skb_put(skb, priv->frag_len + 12), - priv->rx_buf, - priv->frag_len + 12); - skb->protocol = eth_type_trans(skb, priv->dev); - skb->ip_summed = CHECKSUM_NONE; - netif_rx(skb); - priv->dev->stats.rx_bytes += priv->frag_len + 12; - priv->dev->stats.rx_packets++; - } - } - } else - priv->wstats.discard.fragment++; -} - -static void rx_done_irq(struct atmel_private *priv) -{ - int i; - struct ieee80211_hdr header; - - for (i = 0; - atmel_rmem8(priv, atmel_rx(priv, RX_DESC_FLAGS_OFFSET, priv->rx_desc_head)) == RX_DESC_FLAG_VALID && - i < priv->host_info.rx_desc_count; - i++) { - - u16 msdu_size, rx_packet_loc, frame_ctl, seq_control; - u8 status = atmel_rmem8(priv, atmel_rx(priv, RX_DESC_STATUS_OFFSET, priv->rx_desc_head)); - u32 crc = 0xffffffff; - - if (status != RX_STATUS_SUCCESS) { - if (status == 0xc1) /* determined by experiment */ - priv->wstats.discard.nwid++; - else - priv->dev->stats.rx_errors++; - goto next; - } - - msdu_size = atmel_rmem16(priv, atmel_rx(priv, RX_DESC_MSDU_SIZE_OFFSET, priv->rx_desc_head)); - rx_packet_loc = atmel_rmem16(priv, atmel_rx(priv, RX_DESC_MSDU_POS_OFFSET, priv->rx_desc_head)); - - if (msdu_size < 30) { - priv->dev->stats.rx_errors++; - goto next; - } - - /* Get header as far as end of seq_ctrl */ - atmel_copy_to_host(priv->dev, (char *)&header, rx_packet_loc, 24); - frame_ctl = le16_to_cpu(header.frame_control); - seq_control = le16_to_cpu(header.seq_ctrl); - - /* probe for CRC use here if needed once five packets have - arrived with the same crc status, we assume we know what's - happening and stop probing */ - if (priv->probe_crc) { - if (!priv->wep_is_on || !(frame_ctl & IEEE80211_FCTL_PROTECTED)) { - priv->do_rx_crc = probe_crc(priv, rx_packet_loc, msdu_size); - } else { - priv->do_rx_crc = probe_crc(priv, rx_packet_loc + 24, msdu_size - 24); - } - if (priv->do_rx_crc) { - if (priv->crc_ok_cnt++ > 5) - priv->probe_crc = 0; - } else { - if (priv->crc_ko_cnt++ > 5) - priv->probe_crc = 0; - } - } - - /* don't CRC header when WEP in use */ - if (priv->do_rx_crc && (!priv->wep_is_on || !(frame_ctl & IEEE80211_FCTL_PROTECTED))) { - crc = crc32_le(0xffffffff, (unsigned char *)&header, 24); - } - msdu_size -= 24; /* header */ - - if ((frame_ctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) { - int more_fragments = frame_ctl & IEEE80211_FCTL_MOREFRAGS; - u8 packet_fragment_no = seq_control & IEEE80211_SCTL_FRAG; - u16 packet_sequence_no = (seq_control & IEEE80211_SCTL_SEQ) >> 4; - - if (!more_fragments && packet_fragment_no == 0) { - fast_rx_path(priv, &header, msdu_size, rx_packet_loc, crc); - } else { - frag_rx_path(priv, &header, msdu_size, rx_packet_loc, crc, - packet_sequence_no, packet_fragment_no, more_fragments); - } - } - - if ((frame_ctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) { - /* copy rest of packet into buffer */ - atmel_copy_to_host(priv->dev, (unsigned char *)&priv->rx_buf, rx_packet_loc + 24, msdu_size); - - /* we use the same buffer for frag reassembly and control packets */ - memset(priv->frag_source, 0xff, 6); - - if (priv->do_rx_crc) { - /* last 4 octets is crc */ - msdu_size -= 4; - crc = crc32_le(crc, (unsigned char *)&priv->rx_buf, msdu_size); - if ((crc ^ 0xffffffff) != (*((u32 *)&priv->rx_buf[msdu_size]))) { - priv->dev->stats.rx_crc_errors++; - goto next; - } - } - - atmel_management_frame(priv, &header, msdu_size, - atmel_rmem8(priv, atmel_rx(priv, RX_DESC_RSSI_OFFSET, priv->rx_desc_head))); - } - -next: - /* release descriptor */ - atmel_wmem8(priv, atmel_rx(priv, RX_DESC_FLAGS_OFFSET, priv->rx_desc_head), RX_DESC_FLAG_CONSUMED); - - if (priv->rx_desc_head < (priv->host_info.rx_desc_count - 1)) - priv->rx_desc_head++; - else - priv->rx_desc_head = 0; - } -} - -static irqreturn_t service_interrupt(int irq, void *dev_id) -{ - struct net_device *dev = (struct net_device *) dev_id; - struct atmel_private *priv = netdev_priv(dev); - u8 isr; - int i = -1; - static const u8 irq_order[] = { - ISR_OUT_OF_RANGE, - ISR_RxCOMPLETE, - ISR_TxCOMPLETE, - ISR_RxFRAMELOST, - ISR_FATAL_ERROR, - ISR_COMMAND_COMPLETE, - ISR_IBSS_MERGE, - ISR_GENERIC_IRQ - }; - - if (priv->card && priv->present_callback && - !(*priv->present_callback)(priv->card)) - return IRQ_HANDLED; - - /* In this state upper-level code assumes it can mess with - the card unhampered by interrupts which may change register state. - Note that even though the card shouldn't generate interrupts - the inturrupt line may be shared. This allows card setup - to go on without disabling interrupts for a long time. */ - if (priv->station_state == STATION_STATE_DOWN) - return IRQ_NONE; - - atmel_clear_gcr(dev, GCR_ENINT); /* disable interrupts */ - - while (1) { - if (!atmel_lock_mac(priv)) { - /* failed to contact card */ - printk(KERN_ALERT "%s: failed to contact MAC.\n", dev->name); - return IRQ_HANDLED; - } - - isr = atmel_rmem8(priv, atmel_hi(priv, IFACE_INT_STATUS_OFFSET)); - atmel_wmem8(priv, atmel_hi(priv, IFACE_LOCKOUT_MAC_OFFSET), 0); - - if (!isr) { - atmel_set_gcr(dev, GCR_ENINT); /* enable interrupts */ - return i == -1 ? IRQ_NONE : IRQ_HANDLED; - } - - atmel_set_gcr(dev, GCR_ACKINT); /* acknowledge interrupt */ - - for (i = 0; i < ARRAY_SIZE(irq_order); i++) - if (isr & irq_order[i]) - break; - - if (!atmel_lock_mac(priv)) { - /* failed to contact card */ - printk(KERN_ALERT "%s: failed to contact MAC.\n", dev->name); - return IRQ_HANDLED; - } - - isr = atmel_rmem8(priv, atmel_hi(priv, IFACE_INT_STATUS_OFFSET)); - isr ^= irq_order[i]; - atmel_wmem8(priv, atmel_hi(priv, IFACE_INT_STATUS_OFFSET), isr); - atmel_wmem8(priv, atmel_hi(priv, IFACE_LOCKOUT_MAC_OFFSET), 0); - - switch (irq_order[i]) { - - case ISR_OUT_OF_RANGE: - if (priv->operating_mode == IW_MODE_INFRA && - priv->station_state == STATION_STATE_READY) { - priv->station_is_associated = 0; - atmel_scan(priv, 1); - } - break; - - case ISR_RxFRAMELOST: - priv->wstats.discard.misc++; - /* fall through */ - case ISR_RxCOMPLETE: - rx_done_irq(priv); - break; - - case ISR_TxCOMPLETE: - tx_done_irq(priv); - break; - - case ISR_FATAL_ERROR: - printk(KERN_ALERT "%s: *** FATAL error interrupt ***\n", dev->name); - atmel_enter_state(priv, STATION_STATE_MGMT_ERROR); - break; - - case ISR_COMMAND_COMPLETE: - atmel_command_irq(priv); - break; - - case ISR_IBSS_MERGE: - atmel_get_mib(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_CUR_BSSID_POS, - priv->CurrentBSSID, 6); - /* The WPA stuff cares about the current AP address */ - if (priv->use_wpa) - build_wpa_mib(priv); - break; - case ISR_GENERIC_IRQ: - printk(KERN_INFO "%s: Generic_irq received.\n", dev->name); - break; - } - } -} - -static struct iw_statistics *atmel_get_wireless_stats(struct net_device *dev) -{ - struct atmel_private *priv = netdev_priv(dev); - - /* update the link quality here in case we are seeing no beacons - at all to drive the process */ - atmel_smooth_qual(priv); - - priv->wstats.status = priv->station_state; - - if (priv->operating_mode == IW_MODE_INFRA) { - if (priv->station_state != STATION_STATE_READY) { - priv->wstats.qual.qual = 0; - priv->wstats.qual.level = 0; - priv->wstats.qual.updated = (IW_QUAL_QUAL_INVALID - | IW_QUAL_LEVEL_INVALID); - } - priv->wstats.qual.noise = 0; - priv->wstats.qual.updated |= IW_QUAL_NOISE_INVALID; - } else { - /* Quality levels cannot be determined in ad-hoc mode, - because we can 'hear' more that one remote station. */ - priv->wstats.qual.qual = 0; - priv->wstats.qual.level = 0; - priv->wstats.qual.noise = 0; - priv->wstats.qual.updated = IW_QUAL_QUAL_INVALID - | IW_QUAL_LEVEL_INVALID - | IW_QUAL_NOISE_INVALID; - priv->wstats.miss.beacon = 0; - } - - return &priv->wstats; -} - -static int atmel_change_mtu(struct net_device *dev, int new_mtu) -{ - if ((new_mtu < 68) || (new_mtu > 2312)) - return -EINVAL; - dev->mtu = new_mtu; - return 0; -} - -static int atmel_set_mac_address(struct net_device *dev, void *p) -{ - struct sockaddr *addr = p; - - memcpy (dev->dev_addr, addr->sa_data, dev->addr_len); - return atmel_open(dev); -} - -EXPORT_SYMBOL(atmel_open); - -int atmel_open(struct net_device *dev) -{ - struct atmel_private *priv = netdev_priv(dev); - int i, channel, err; - - /* any scheduled timer is no longer needed and might screw things up.. */ - del_timer_sync(&priv->management_timer); - - /* Interrupts will not touch the card once in this state... */ - priv->station_state = STATION_STATE_DOWN; - - if (priv->new_SSID_size) { - memcpy(priv->SSID, priv->new_SSID, priv->new_SSID_size); - priv->SSID_size = priv->new_SSID_size; - priv->new_SSID_size = 0; - } - priv->BSS_list_entries = 0; - - priv->AuthenticationRequestRetryCnt = 0; - priv->AssociationRequestRetryCnt = 0; - priv->ReAssociationRequestRetryCnt = 0; - priv->CurrentAuthentTransactionSeqNum = 0x0001; - priv->ExpectedAuthentTransactionSeqNum = 0x0002; - - priv->site_survey_state = SITE_SURVEY_IDLE; - priv->station_is_associated = 0; - - err = reset_atmel_card(dev); - if (err) - return err; - - if (priv->config_reg_domain) { - priv->reg_domain = priv->config_reg_domain; - atmel_set_mib8(priv, Phy_Mib_Type, PHY_MIB_REG_DOMAIN_POS, priv->reg_domain); - } else { - priv->reg_domain = atmel_get_mib8(priv, Phy_Mib_Type, PHY_MIB_REG_DOMAIN_POS); - for (i = 0; i < ARRAY_SIZE(channel_table); i++) - if (priv->reg_domain == channel_table[i].reg_domain) - break; - if (i == ARRAY_SIZE(channel_table)) { - priv->reg_domain = REG_DOMAIN_MKK1; - printk(KERN_ALERT "%s: failed to get regulatory domain: assuming MKK1.\n", dev->name); - } - } - - if ((channel = atmel_validate_channel(priv, priv->channel))) - priv->channel = channel; - - /* this moves station_state on.... */ - atmel_scan(priv, 1); - - atmel_set_gcr(priv->dev, GCR_ENINT); /* enable interrupts */ - return 0; -} - -static int atmel_close(struct net_device *dev) -{ - struct atmel_private *priv = netdev_priv(dev); - - /* Send event to userspace that we are disassociating */ - if (priv->station_state == STATION_STATE_READY) { - union iwreq_data wrqu; - - wrqu.data.length = 0; - wrqu.data.flags = 0; - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); - wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); - } - - atmel_enter_state(priv, STATION_STATE_DOWN); - - if (priv->bus_type == BUS_TYPE_PCCARD) - atmel_write16(dev, GCR, 0x0060); - atmel_write16(dev, GCR, 0x0040); - return 0; -} - -static int atmel_validate_channel(struct atmel_private *priv, int channel) -{ - /* check that channel is OK, if so return zero, - else return suitable default channel */ - int i; - - for (i = 0; i < ARRAY_SIZE(channel_table); i++) - if (priv->reg_domain == channel_table[i].reg_domain) { - if (channel >= channel_table[i].min && - channel <= channel_table[i].max) - return 0; - else - return channel_table[i].min; - } - return 0; -} - -static int atmel_proc_show(struct seq_file *m, void *v) -{ - struct atmel_private *priv = m->private; - int i; - char *s, *r, *c; - - seq_printf(m, "Driver version:\t\t%d.%d\n", DRIVER_MAJOR, DRIVER_MINOR); - - if (priv->station_state != STATION_STATE_DOWN) { - seq_printf(m, - "Firmware version:\t%d.%d build %d\n" - "Firmware location:\t", - priv->host_info.major_version, - priv->host_info.minor_version, - priv->host_info.build_version); - - if (priv->card_type != CARD_TYPE_EEPROM) - seq_puts(m, "on card\n"); - else if (priv->firmware) - seq_printf(m, "%s loaded by host\n", priv->firmware_id); - else - seq_printf(m, "%s loaded by hotplug\n", priv->firmware_id); - - switch (priv->card_type) { - case CARD_TYPE_PARALLEL_FLASH: - c = "Parallel flash"; - break; - case CARD_TYPE_SPI_FLASH: - c = "SPI flash\n"; - break; - case CARD_TYPE_EEPROM: - c = "EEPROM"; - break; - default: - c = ""; - } - - r = ""; - for (i = 0; i < ARRAY_SIZE(channel_table); i++) - if (priv->reg_domain == channel_table[i].reg_domain) - r = channel_table[i].name; - - seq_printf(m, "MAC memory type:\t%s\n", c); - seq_printf(m, "Regulatory domain:\t%s\n", r); - seq_printf(m, "Host CRC checking:\t%s\n", - priv->do_rx_crc ? "On" : "Off"); - seq_printf(m, "WPA-capable firmware:\t%s\n", - priv->use_wpa ? "Yes" : "No"); - } - - switch (priv->station_state) { - case STATION_STATE_SCANNING: - s = "Scanning"; - break; - case STATION_STATE_JOINNING: - s = "Joining"; - break; - case STATION_STATE_AUTHENTICATING: - s = "Authenticating"; - break; - case STATION_STATE_ASSOCIATING: - s = "Associating"; - break; - case STATION_STATE_READY: - s = "Ready"; - break; - case STATION_STATE_REASSOCIATING: - s = "Reassociating"; - break; - case STATION_STATE_MGMT_ERROR: - s = "Management error"; - break; - case STATION_STATE_DOWN: - s = "Down"; - break; - default: - s = ""; - } - - seq_printf(m, "Current state:\t\t%s\n", s); - return 0; -} - -static int atmel_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, atmel_proc_show, PDE_DATA(inode)); -} - -static const struct file_operations atmel_proc_fops = { - .open = atmel_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static const struct net_device_ops atmel_netdev_ops = { - .ndo_open = atmel_open, - .ndo_stop = atmel_close, - .ndo_change_mtu = atmel_change_mtu, - .ndo_set_mac_address = atmel_set_mac_address, - .ndo_start_xmit = start_tx, - .ndo_do_ioctl = atmel_ioctl, - .ndo_validate_addr = eth_validate_addr, -}; - -struct net_device *init_atmel_card(unsigned short irq, unsigned long port, - const AtmelFWType fw_type, - struct device *sys_dev, - int (*card_present)(void *), void *card) -{ - struct net_device *dev; - struct atmel_private *priv; - int rc; - - /* Create the network device object. */ - dev = alloc_etherdev(sizeof(*priv)); - if (!dev) - return NULL; - - if (dev_alloc_name(dev, dev->name) < 0) { - printk(KERN_ERR "atmel: Couldn't get name!\n"); - goto err_out_free; - } - - priv = netdev_priv(dev); - priv->dev = dev; - priv->sys_dev = sys_dev; - priv->present_callback = card_present; - priv->card = card; - priv->firmware = NULL; - priv->firmware_id[0] = '\0'; - priv->firmware_type = fw_type; - if (firmware) /* module parameter */ - strcpy(priv->firmware_id, firmware); - priv->bus_type = card_present ? BUS_TYPE_PCCARD : BUS_TYPE_PCI; - priv->station_state = STATION_STATE_DOWN; - priv->do_rx_crc = 0; - /* For PCMCIA cards, some chips need CRC, some don't - so we have to probe. */ - if (priv->bus_type == BUS_TYPE_PCCARD) { - priv->probe_crc = 1; - priv->crc_ok_cnt = priv->crc_ko_cnt = 0; - } else - priv->probe_crc = 0; - priv->last_qual = jiffies; - priv->last_beacon_timestamp = 0; - memset(priv->frag_source, 0xff, sizeof(priv->frag_source)); - memset(priv->BSSID, 0, 6); - priv->CurrentBSSID[0] = 0xFF; /* Initialize to something invalid.... */ - priv->station_was_associated = 0; - - priv->last_survey = jiffies; - priv->preamble = LONG_PREAMBLE; - priv->operating_mode = IW_MODE_INFRA; - priv->connect_to_any_BSS = 0; - priv->config_reg_domain = 0; - priv->reg_domain = 0; - priv->tx_rate = 3; - priv->auto_tx_rate = 1; - priv->channel = 4; - priv->power_mode = 0; - priv->SSID[0] = '\0'; - priv->SSID_size = 0; - priv->new_SSID_size = 0; - priv->frag_threshold = 2346; - priv->rts_threshold = 2347; - priv->short_retry = 7; - priv->long_retry = 4; - - priv->wep_is_on = 0; - priv->default_key = 0; - priv->encryption_level = 0; - priv->exclude_unencrypted = 0; - priv->group_cipher_suite = priv->pairwise_cipher_suite = CIPHER_SUITE_NONE; - priv->use_wpa = 0; - memset(priv->wep_keys, 0, sizeof(priv->wep_keys)); - memset(priv->wep_key_len, 0, sizeof(priv->wep_key_len)); - - priv->default_beacon_period = priv->beacon_period = 100; - priv->listen_interval = 1; - - init_timer(&priv->management_timer); - spin_lock_init(&priv->irqlock); - spin_lock_init(&priv->timerlock); - priv->management_timer.function = atmel_management_timer; - priv->management_timer.data = (unsigned long) dev; - - dev->netdev_ops = &atmel_netdev_ops; - dev->wireless_handlers = &atmel_handler_def; - dev->irq = irq; - dev->base_addr = port; - - SET_NETDEV_DEV(dev, sys_dev); - - if ((rc = request_irq(dev->irq, service_interrupt, IRQF_SHARED, dev->name, dev))) { - printk(KERN_ERR "%s: register interrupt %d failed, rc %d\n", dev->name, irq, rc); - goto err_out_free; - } - - if (!request_region(dev->base_addr, 32, - priv->bus_type == BUS_TYPE_PCCARD ? "atmel_cs" : "atmel_pci")) { - goto err_out_irq; - } - - if (register_netdev(dev)) - goto err_out_res; - - if (!probe_atmel_card(dev)) { - unregister_netdev(dev); - goto err_out_res; - } - - netif_carrier_off(dev); - - if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv)) - printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); - - printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", - dev->name, DRIVER_MAJOR, DRIVER_MINOR, dev->dev_addr); - - return dev; - -err_out_res: - release_region(dev->base_addr, 32); -err_out_irq: - free_irq(dev->irq, dev); -err_out_free: - free_netdev(dev); - return NULL; -} - -EXPORT_SYMBOL(init_atmel_card); - -void stop_atmel_card(struct net_device *dev) -{ - struct atmel_private *priv = netdev_priv(dev); - - /* put a brick on it... */ - if (priv->bus_type == BUS_TYPE_PCCARD) - atmel_write16(dev, GCR, 0x0060); - atmel_write16(dev, GCR, 0x0040); - - del_timer_sync(&priv->management_timer); - unregister_netdev(dev); - remove_proc_entry("driver/atmel", NULL); - free_irq(dev->irq, dev); - kfree(priv->firmware); - release_region(dev->base_addr, 32); - free_netdev(dev); -} - -EXPORT_SYMBOL(stop_atmel_card); - -static int atmel_set_essid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - - /* Check if we asked for `any' */ - if (dwrq->flags == 0) { - priv->connect_to_any_BSS = 1; - } else { - int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - - priv->connect_to_any_BSS = 0; - - /* Check the size of the string */ - if (dwrq->length > MAX_SSID_LENGTH) - return -E2BIG; - if (index != 0) - return -EINVAL; - - memcpy(priv->new_SSID, extra, dwrq->length); - priv->new_SSID_size = dwrq->length; - } - - return -EINPROGRESS; -} - -static int atmel_get_essid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - - /* Get the current SSID */ - if (priv->new_SSID_size != 0) { - memcpy(extra, priv->new_SSID, priv->new_SSID_size); - dwrq->length = priv->new_SSID_size; - } else { - memcpy(extra, priv->SSID, priv->SSID_size); - dwrq->length = priv->SSID_size; - } - - dwrq->flags = !priv->connect_to_any_BSS; /* active */ - - return 0; -} - -static int atmel_get_wap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *awrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - memcpy(awrq->sa_data, priv->CurrentBSSID, 6); - awrq->sa_family = ARPHRD_ETHER; - - return 0; -} - -static int atmel_set_encode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - - /* Basic checking: do we have a key to set ? - * Note : with the new API, it's impossible to get a NULL pointer. - * Therefore, we need to check a key size == 0 instead. - * New version of iwconfig properly set the IW_ENCODE_NOKEY flag - * when no key is present (only change flags), but older versions - * don't do it. - Jean II */ - if (dwrq->length > 0) { - int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - int current_index = priv->default_key; - /* Check the size of the key */ - if (dwrq->length > 13) { - return -EINVAL; - } - /* Check the index (none -> use current) */ - if (index < 0 || index >= 4) - index = current_index; - else - priv->default_key = index; - /* Set the length */ - if (dwrq->length > 5) - priv->wep_key_len[index] = 13; - else - if (dwrq->length > 0) - priv->wep_key_len[index] = 5; - else - /* Disable the key */ - priv->wep_key_len[index] = 0; - /* Check if the key is not marked as invalid */ - if (!(dwrq->flags & IW_ENCODE_NOKEY)) { - /* Cleanup */ - memset(priv->wep_keys[index], 0, 13); - /* Copy the key in the driver */ - memcpy(priv->wep_keys[index], extra, dwrq->length); - } - /* WE specify that if a valid key is set, encryption - * should be enabled (user may turn it off later) - * This is also how "iwconfig ethX key on" works */ - if (index == current_index && - priv->wep_key_len[index] > 0) { - priv->wep_is_on = 1; - priv->exclude_unencrypted = 1; - if (priv->wep_key_len[index] > 5) { - priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128; - priv->encryption_level = 2; - } else { - priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64; - priv->encryption_level = 1; - } - } - } else { - /* Do we want to just set the transmit key index ? */ - int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - if (index >= 0 && index < 4) { - priv->default_key = index; - } else - /* Don't complain if only change the mode */ - if (!(dwrq->flags & IW_ENCODE_MODE)) - return -EINVAL; - } - /* Read the flags */ - if (dwrq->flags & IW_ENCODE_DISABLED) { - priv->wep_is_on = 0; - priv->encryption_level = 0; - priv->pairwise_cipher_suite = CIPHER_SUITE_NONE; - } else { - priv->wep_is_on = 1; - if (priv->wep_key_len[priv->default_key] > 5) { - priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128; - priv->encryption_level = 2; - } else { - priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64; - priv->encryption_level = 1; - } - } - if (dwrq->flags & IW_ENCODE_RESTRICTED) - priv->exclude_unencrypted = 1; - if (dwrq->flags & IW_ENCODE_OPEN) - priv->exclude_unencrypted = 0; - - return -EINPROGRESS; /* Call commit handler */ -} - -static int atmel_get_encode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - - if (!priv->wep_is_on) - dwrq->flags = IW_ENCODE_DISABLED; - else { - if (priv->exclude_unencrypted) - dwrq->flags = IW_ENCODE_RESTRICTED; - else - dwrq->flags = IW_ENCODE_OPEN; - } - /* Which key do we want ? -1 -> tx index */ - if (index < 0 || index >= 4) - index = priv->default_key; - dwrq->flags |= index + 1; - /* Copy the key to the user buffer */ - dwrq->length = priv->wep_key_len[index]; - if (dwrq->length > 16) { - dwrq->length = 0; - } else { - memset(extra, 0, 16); - memcpy(extra, priv->wep_keys[index], dwrq->length); - } - - return 0; -} - -static int atmel_set_encodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - struct iw_point *encoding = &wrqu->encoding; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int idx, key_len, alg = ext->alg, set_key = 1; - - /* Determine and validate the key index */ - idx = encoding->flags & IW_ENCODE_INDEX; - if (idx) { - if (idx < 1 || idx > 4) - return -EINVAL; - idx--; - } else - idx = priv->default_key; - - if (encoding->flags & IW_ENCODE_DISABLED) - alg = IW_ENCODE_ALG_NONE; - - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - priv->default_key = idx; - set_key = ext->key_len > 0 ? 1 : 0; - } - - if (set_key) { - /* Set the requested key first */ - switch (alg) { - case IW_ENCODE_ALG_NONE: - priv->wep_is_on = 0; - priv->encryption_level = 0; - priv->pairwise_cipher_suite = CIPHER_SUITE_NONE; - break; - case IW_ENCODE_ALG_WEP: - if (ext->key_len > 5) { - priv->wep_key_len[idx] = 13; - priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_128; - priv->encryption_level = 2; - } else if (ext->key_len > 0) { - priv->wep_key_len[idx] = 5; - priv->pairwise_cipher_suite = CIPHER_SUITE_WEP_64; - priv->encryption_level = 1; - } else { - return -EINVAL; - } - priv->wep_is_on = 1; - memset(priv->wep_keys[idx], 0, 13); - key_len = min ((int)ext->key_len, priv->wep_key_len[idx]); - memcpy(priv->wep_keys[idx], ext->key, key_len); - break; - default: - return -EINVAL; - } - } - - return -EINPROGRESS; -} - -static int atmel_get_encodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - struct iw_point *encoding = &wrqu->encoding; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int idx, max_key_len; - - max_key_len = encoding->length - sizeof(*ext); - if (max_key_len < 0) - return -EINVAL; - - idx = encoding->flags & IW_ENCODE_INDEX; - if (idx) { - if (idx < 1 || idx > 4) - return -EINVAL; - idx--; - } else - idx = priv->default_key; - - encoding->flags = idx + 1; - memset(ext, 0, sizeof(*ext)); - - if (!priv->wep_is_on) { - ext->alg = IW_ENCODE_ALG_NONE; - ext->key_len = 0; - encoding->flags |= IW_ENCODE_DISABLED; - } else { - if (priv->encryption_level > 0) - ext->alg = IW_ENCODE_ALG_WEP; - else - return -EINVAL; - - ext->key_len = priv->wep_key_len[idx]; - memcpy(ext->key, priv->wep_keys[idx], ext->key_len); - encoding->flags |= IW_ENCODE_ENABLED; - } - - return 0; -} - -static int atmel_set_auth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - struct iw_param *param = &wrqu->param; - - switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_KEY_MGMT: - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - case IW_AUTH_PRIVACY_INVOKED: - /* - * atmel does not use these parameters - */ - break; - - case IW_AUTH_DROP_UNENCRYPTED: - priv->exclude_unencrypted = param->value ? 1 : 0; - break; - - case IW_AUTH_80211_AUTH_ALG: { - if (param->value & IW_AUTH_ALG_SHARED_KEY) { - priv->exclude_unencrypted = 1; - } else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) { - priv->exclude_unencrypted = 0; - } else - return -EINVAL; - break; - } - - case IW_AUTH_WPA_ENABLED: - /* Silently accept disable of WPA */ - if (param->value > 0) - return -EOPNOTSUPP; - break; - - default: - return -EOPNOTSUPP; - } - return -EINPROGRESS; -} - -static int atmel_get_auth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - struct iw_param *param = &wrqu->param; - - switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_DROP_UNENCRYPTED: - param->value = priv->exclude_unencrypted; - break; - - case IW_AUTH_80211_AUTH_ALG: - if (priv->exclude_unencrypted == 1) - param->value = IW_AUTH_ALG_SHARED_KEY; - else - param->value = IW_AUTH_ALG_OPEN_SYSTEM; - break; - - case IW_AUTH_WPA_ENABLED: - param->value = 0; - break; - - default: - return -EOPNOTSUPP; - } - return 0; -} - - -static int atmel_get_name(struct net_device *dev, - struct iw_request_info *info, - char *cwrq, - char *extra) -{ - strcpy(cwrq, "IEEE 802.11-DS"); - return 0; -} - -static int atmel_set_rate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - - if (vwrq->fixed == 0) { - priv->tx_rate = 3; - priv->auto_tx_rate = 1; - } else { - priv->auto_tx_rate = 0; - - /* Which type of value ? */ - if ((vwrq->value < 4) && (vwrq->value >= 0)) { - /* Setting by rate index */ - priv->tx_rate = vwrq->value; - } else { - /* Setting by frequency value */ - switch (vwrq->value) { - case 1000000: - priv->tx_rate = 0; - break; - case 2000000: - priv->tx_rate = 1; - break; - case 5500000: - priv->tx_rate = 2; - break; - case 11000000: - priv->tx_rate = 3; - break; - default: - return -EINVAL; - } - } - } - - return -EINPROGRESS; -} - -static int atmel_set_mode(struct net_device *dev, - struct iw_request_info *info, - __u32 *uwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - - if (*uwrq != IW_MODE_ADHOC && *uwrq != IW_MODE_INFRA) - return -EINVAL; - - priv->operating_mode = *uwrq; - return -EINPROGRESS; -} - -static int atmel_get_mode(struct net_device *dev, - struct iw_request_info *info, - __u32 *uwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - - *uwrq = priv->operating_mode; - return 0; -} - -static int atmel_get_rate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - - if (priv->auto_tx_rate) { - vwrq->fixed = 0; - vwrq->value = 11000000; - } else { - vwrq->fixed = 1; - switch (priv->tx_rate) { - case 0: - vwrq->value = 1000000; - break; - case 1: - vwrq->value = 2000000; - break; - case 2: - vwrq->value = 5500000; - break; - case 3: - vwrq->value = 11000000; - break; - } - } - return 0; -} - -static int atmel_set_power(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - priv->power_mode = vwrq->disabled ? 0 : 1; - return -EINPROGRESS; -} - -static int atmel_get_power(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - vwrq->disabled = priv->power_mode ? 0 : 1; - vwrq->flags = IW_POWER_ON; - return 0; -} - -static int atmel_set_retry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - - if (!vwrq->disabled && (vwrq->flags & IW_RETRY_LIMIT)) { - if (vwrq->flags & IW_RETRY_LONG) - priv->long_retry = vwrq->value; - else if (vwrq->flags & IW_RETRY_SHORT) - priv->short_retry = vwrq->value; - else { - /* No modifier : set both */ - priv->long_retry = vwrq->value; - priv->short_retry = vwrq->value; - } - return -EINPROGRESS; - } - - return -EINVAL; -} - -static int atmel_get_retry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - - vwrq->disabled = 0; /* Can't be disabled */ - - /* Note : by default, display the short retry number */ - if (vwrq->flags & IW_RETRY_LONG) { - vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; - vwrq->value = priv->long_retry; - } else { - vwrq->flags = IW_RETRY_LIMIT; - vwrq->value = priv->short_retry; - if (priv->long_retry != priv->short_retry) - vwrq->flags |= IW_RETRY_SHORT; - } - - return 0; -} - -static int atmel_set_rts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - int rthr = vwrq->value; - - if (vwrq->disabled) - rthr = 2347; - if ((rthr < 0) || (rthr > 2347)) { - return -EINVAL; - } - priv->rts_threshold = rthr; - - return -EINPROGRESS; /* Call commit handler */ -} - -static int atmel_get_rts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - - vwrq->value = priv->rts_threshold; - vwrq->disabled = (vwrq->value >= 2347); - vwrq->fixed = 1; - - return 0; -} - -static int atmel_set_frag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - int fthr = vwrq->value; - - if (vwrq->disabled) - fthr = 2346; - if ((fthr < 256) || (fthr > 2346)) { - return -EINVAL; - } - fthr &= ~0x1; /* Get an even value - is it really needed ??? */ - priv->frag_threshold = fthr; - - return -EINPROGRESS; /* Call commit handler */ -} - -static int atmel_get_frag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - - vwrq->value = priv->frag_threshold; - vwrq->disabled = (vwrq->value >= 2346); - vwrq->fixed = 1; - - return 0; -} - -static int atmel_set_freq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *fwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - int rc = -EINPROGRESS; /* Call commit handler */ - - /* If setting by frequency, convert to a channel */ - if (fwrq->e == 1) { - int f = fwrq->m / 100000; - - /* Hack to fall through... */ - fwrq->e = 0; - fwrq->m = ieee80211_freq_to_dsss_chan(f); - } - /* Setting by channel number */ - if ((fwrq->m > 1000) || (fwrq->e > 0)) - rc = -EOPNOTSUPP; - else { - int channel = fwrq->m; - if (atmel_validate_channel(priv, channel) == 0) { - priv->channel = channel; - } else { - rc = -EINVAL; - } - } - return rc; -} - -static int atmel_get_freq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *fwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - - fwrq->m = priv->channel; - fwrq->e = 0; - return 0; -} - -static int atmel_set_scan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - unsigned long flags; - - /* Note : you may have realised that, as this is a SET operation, - * this is privileged and therefore a normal user can't - * perform scanning. - * This is not an error, while the device perform scanning, - * traffic doesn't flow, so it's a perfect DoS... - * Jean II */ - - if (priv->station_state == STATION_STATE_DOWN) - return -EAGAIN; - - /* Timeout old surveys. */ - if (time_after(jiffies, priv->last_survey + 20 * HZ)) - priv->site_survey_state = SITE_SURVEY_IDLE; - priv->last_survey = jiffies; - - /* Initiate a scan command */ - if (priv->site_survey_state == SITE_SURVEY_IN_PROGRESS) - return -EBUSY; - - del_timer_sync(&priv->management_timer); - spin_lock_irqsave(&priv->irqlock, flags); - - priv->site_survey_state = SITE_SURVEY_IN_PROGRESS; - priv->fast_scan = 0; - atmel_scan(priv, 0); - spin_unlock_irqrestore(&priv->irqlock, flags); - - return 0; -} - -static int atmel_get_scan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - int i; - char *current_ev = extra; - struct iw_event iwe; - - if (priv->site_survey_state != SITE_SURVEY_COMPLETED) - return -EAGAIN; - - for (i = 0; i < priv->BSS_list_entries; i++) { - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, priv->BSSinfo[i].BSSID, 6); - current_ev = iwe_stream_add_event(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, IW_EV_ADDR_LEN); - - iwe.u.data.length = priv->BSSinfo[i].SSIDsize; - if (iwe.u.data.length > 32) - iwe.u.data.length = 32; - iwe.cmd = SIOCGIWESSID; - iwe.u.data.flags = 1; - current_ev = iwe_stream_add_point(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, priv->BSSinfo[i].SSID); - - iwe.cmd = SIOCGIWMODE; - iwe.u.mode = priv->BSSinfo[i].BSStype; - current_ev = iwe_stream_add_event(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, IW_EV_UINT_LEN); - - iwe.cmd = SIOCGIWFREQ; - iwe.u.freq.m = priv->BSSinfo[i].channel; - iwe.u.freq.e = 0; - current_ev = iwe_stream_add_event(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, IW_EV_FREQ_LEN); - - /* Add quality statistics */ - iwe.cmd = IWEVQUAL; - iwe.u.qual.level = priv->BSSinfo[i].RSSI; - iwe.u.qual.qual = iwe.u.qual.level; - /* iwe.u.qual.noise = SOMETHING */ - current_ev = iwe_stream_add_event(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, IW_EV_QUAL_LEN); - - - iwe.cmd = SIOCGIWENCODE; - if (priv->BSSinfo[i].UsingWEP) - iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - else - iwe.u.data.flags = IW_ENCODE_DISABLED; - iwe.u.data.length = 0; - current_ev = iwe_stream_add_point(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, NULL); - } - - /* Length of data */ - dwrq->length = (current_ev - extra); - dwrq->flags = 0; - - return 0; -} - -static int atmel_get_range(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - struct iw_range *range = (struct iw_range *) extra; - int k, i, j; - - dwrq->length = sizeof(struct iw_range); - memset(range, 0, sizeof(struct iw_range)); - range->min_nwid = 0x0000; - range->max_nwid = 0x0000; - range->num_channels = 0; - for (j = 0; j < ARRAY_SIZE(channel_table); j++) - if (priv->reg_domain == channel_table[j].reg_domain) { - range->num_channels = channel_table[j].max - channel_table[j].min + 1; - break; - } - if (range->num_channels != 0) { - for (k = 0, i = channel_table[j].min; i <= channel_table[j].max; i++) { - range->freq[k].i = i; /* List index */ - - /* Values in MHz -> * 10^5 * 10 */ - range->freq[k].m = (ieee80211_dsss_chan_to_freq(i) * - 100000); - range->freq[k++].e = 1; - } - range->num_frequency = k; - } - - range->max_qual.qual = 100; - range->max_qual.level = 100; - range->max_qual.noise = 0; - range->max_qual.updated = IW_QUAL_NOISE_INVALID; - - range->avg_qual.qual = 50; - range->avg_qual.level = 50; - range->avg_qual.noise = 0; - range->avg_qual.updated = IW_QUAL_NOISE_INVALID; - - range->sensitivity = 0; - - range->bitrate[0] = 1000000; - range->bitrate[1] = 2000000; - range->bitrate[2] = 5500000; - range->bitrate[3] = 11000000; - range->num_bitrates = 4; - - range->min_rts = 0; - range->max_rts = 2347; - range->min_frag = 256; - range->max_frag = 2346; - - range->encoding_size[0] = 5; - range->encoding_size[1] = 13; - range->num_encoding_sizes = 2; - range->max_encoding_tokens = 4; - - range->pmp_flags = IW_POWER_ON; - range->pmt_flags = IW_POWER_ON; - range->pm_capa = 0; - - range->we_version_source = WIRELESS_EXT; - range->we_version_compiled = WIRELESS_EXT; - range->retry_capa = IW_RETRY_LIMIT ; - range->retry_flags = IW_RETRY_LIMIT; - range->r_time_flags = 0; - range->min_retry = 1; - range->max_retry = 65535; - - return 0; -} - -static int atmel_set_wap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *awrq, - char *extra) -{ - struct atmel_private *priv = netdev_priv(dev); - int i; - static const u8 any[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - static const u8 off[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - unsigned long flags; - - if (awrq->sa_family != ARPHRD_ETHER) - return -EINVAL; - - if (!memcmp(any, awrq->sa_data, 6) || - !memcmp(off, awrq->sa_data, 6)) { - del_timer_sync(&priv->management_timer); - spin_lock_irqsave(&priv->irqlock, flags); - atmel_scan(priv, 1); - spin_unlock_irqrestore(&priv->irqlock, flags); - return 0; - } - - for (i = 0; i < priv->BSS_list_entries; i++) { - if (memcmp(priv->BSSinfo[i].BSSID, awrq->sa_data, 6) == 0) { - if (!priv->wep_is_on && priv->BSSinfo[i].UsingWEP) { - return -EINVAL; - } else if (priv->wep_is_on && !priv->BSSinfo[i].UsingWEP) { - return -EINVAL; - } else { - del_timer_sync(&priv->management_timer); - spin_lock_irqsave(&priv->irqlock, flags); - atmel_join_bss(priv, i); - spin_unlock_irqrestore(&priv->irqlock, flags); - return 0; - } - } - } - - return -EINVAL; -} - -static int atmel_config_commit(struct net_device *dev, - struct iw_request_info *info, /* NULL */ - void *zwrq, /* NULL */ - char *extra) /* NULL */ -{ - return atmel_open(dev); -} - -static const iw_handler atmel_handler[] = -{ - (iw_handler) atmel_config_commit, /* SIOCSIWCOMMIT */ - (iw_handler) atmel_get_name, /* SIOCGIWNAME */ - (iw_handler) NULL, /* SIOCSIWNWID */ - (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) atmel_set_freq, /* SIOCSIWFREQ */ - (iw_handler) atmel_get_freq, /* SIOCGIWFREQ */ - (iw_handler) atmel_set_mode, /* SIOCSIWMODE */ - (iw_handler) atmel_get_mode, /* SIOCGIWMODE */ - (iw_handler) NULL, /* SIOCSIWSENS */ - (iw_handler) NULL, /* SIOCGIWSENS */ - (iw_handler) NULL, /* SIOCSIWRANGE */ - (iw_handler) atmel_get_range, /* SIOCGIWRANGE */ - (iw_handler) NULL, /* SIOCSIWPRIV */ - (iw_handler) NULL, /* SIOCGIWPRIV */ - (iw_handler) NULL, /* SIOCSIWSTATS */ - (iw_handler) NULL, /* SIOCGIWSTATS */ - (iw_handler) NULL, /* SIOCSIWSPY */ - (iw_handler) NULL, /* SIOCGIWSPY */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) atmel_set_wap, /* SIOCSIWAP */ - (iw_handler) atmel_get_wap, /* SIOCGIWAP */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* SIOCGIWAPLIST */ - (iw_handler) atmel_set_scan, /* SIOCSIWSCAN */ - (iw_handler) atmel_get_scan, /* SIOCGIWSCAN */ - (iw_handler) atmel_set_essid, /* SIOCSIWESSID */ - (iw_handler) atmel_get_essid, /* SIOCGIWESSID */ - (iw_handler) NULL, /* SIOCSIWNICKN */ - (iw_handler) NULL, /* SIOCGIWNICKN */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) atmel_set_rate, /* SIOCSIWRATE */ - (iw_handler) atmel_get_rate, /* SIOCGIWRATE */ - (iw_handler) atmel_set_rts, /* SIOCSIWRTS */ - (iw_handler) atmel_get_rts, /* SIOCGIWRTS */ - (iw_handler) atmel_set_frag, /* SIOCSIWFRAG */ - (iw_handler) atmel_get_frag, /* SIOCGIWFRAG */ - (iw_handler) NULL, /* SIOCSIWTXPOW */ - (iw_handler) NULL, /* SIOCGIWTXPOW */ - (iw_handler) atmel_set_retry, /* SIOCSIWRETRY */ - (iw_handler) atmel_get_retry, /* SIOCGIWRETRY */ - (iw_handler) atmel_set_encode, /* SIOCSIWENCODE */ - (iw_handler) atmel_get_encode, /* SIOCGIWENCODE */ - (iw_handler) atmel_set_power, /* SIOCSIWPOWER */ - (iw_handler) atmel_get_power, /* SIOCGIWPOWER */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* SIOCSIWGENIE */ - (iw_handler) NULL, /* SIOCGIWGENIE */ - (iw_handler) atmel_set_auth, /* SIOCSIWAUTH */ - (iw_handler) atmel_get_auth, /* SIOCGIWAUTH */ - (iw_handler) atmel_set_encodeext, /* SIOCSIWENCODEEXT */ - (iw_handler) atmel_get_encodeext, /* SIOCGIWENCODEEXT */ - (iw_handler) NULL, /* SIOCSIWPMKSA */ -}; - -static const iw_handler atmel_private_handler[] = -{ - NULL, /* SIOCIWFIRSTPRIV */ -}; - -typedef struct atmel_priv_ioctl { - char id[32]; - unsigned char __user *data; - unsigned short len; -} atmel_priv_ioctl; - -#define ATMELFWL SIOCIWFIRSTPRIV -#define ATMELIDIFC ATMELFWL + 1 -#define ATMELRD ATMELFWL + 2 -#define ATMELMAGIC 0x51807 -#define REGDOMAINSZ 20 - -static const struct iw_priv_args atmel_private_args[] = { - { - .cmd = ATMELFWL, - .set_args = IW_PRIV_TYPE_BYTE - | IW_PRIV_SIZE_FIXED - | sizeof (atmel_priv_ioctl), - .get_args = IW_PRIV_TYPE_NONE, - .name = "atmelfwl" - }, { - .cmd = ATMELIDIFC, - .set_args = IW_PRIV_TYPE_NONE, - .get_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - .name = "atmelidifc" - }, { - .cmd = ATMELRD, - .set_args = IW_PRIV_TYPE_CHAR | REGDOMAINSZ, - .get_args = IW_PRIV_TYPE_NONE, - .name = "regdomain" - }, -}; - -static const struct iw_handler_def atmel_handler_def = { - .num_standard = ARRAY_SIZE(atmel_handler), - .num_private = ARRAY_SIZE(atmel_private_handler), - .num_private_args = ARRAY_SIZE(atmel_private_args), - .standard = (iw_handler *) atmel_handler, - .private = (iw_handler *) atmel_private_handler, - .private_args = (struct iw_priv_args *) atmel_private_args, - .get_wireless_stats = atmel_get_wireless_stats -}; - -static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - int i, rc = 0; - struct atmel_private *priv = netdev_priv(dev); - atmel_priv_ioctl com; - struct iwreq *wrq = (struct iwreq *) rq; - unsigned char *new_firmware; - char domain[REGDOMAINSZ + 1]; - - switch (cmd) { - case ATMELIDIFC: - wrq->u.param.value = ATMELMAGIC; - break; - - case ATMELFWL: - if (copy_from_user(&com, rq->ifr_data, sizeof(com))) { - rc = -EFAULT; - break; - } - - if (!capable(CAP_NET_ADMIN)) { - rc = -EPERM; - break; - } - - if (!(new_firmware = kmalloc(com.len, GFP_KERNEL))) { - rc = -ENOMEM; - break; - } - - if (copy_from_user(new_firmware, com.data, com.len)) { - kfree(new_firmware); - rc = -EFAULT; - break; - } - - kfree(priv->firmware); - - priv->firmware = new_firmware; - priv->firmware_length = com.len; - strncpy(priv->firmware_id, com.id, 31); - priv->firmware_id[31] = '\0'; - break; - - case ATMELRD: - if (copy_from_user(domain, rq->ifr_data, REGDOMAINSZ)) { - rc = -EFAULT; - break; - } - - if (!capable(CAP_NET_ADMIN)) { - rc = -EPERM; - break; - } - - domain[REGDOMAINSZ] = 0; - rc = -EINVAL; - for (i = 0; i < ARRAY_SIZE(channel_table); i++) { - /* strcasecmp doesn't exist in the library */ - char *a = channel_table[i].name; - char *b = domain; - while (*a) { - char c1 = *a++; - char c2 = *b++; - if (tolower(c1) != tolower(c2)) - break; - } - if (!*a && !*b) { - priv->config_reg_domain = channel_table[i].reg_domain; - rc = 0; - } - } - - if (rc == 0 && priv->station_state != STATION_STATE_DOWN) - rc = atmel_open(dev); - break; - - default: - rc = -EOPNOTSUPP; - } - - return rc; -} - -struct auth_body { - __le16 alg; - __le16 trans_seq; - __le16 status; - u8 el_id; - u8 chall_text_len; - u8 chall_text[253]; -}; - -static void atmel_enter_state(struct atmel_private *priv, int new_state) -{ - int old_state = priv->station_state; - - if (new_state == old_state) - return; - - priv->station_state = new_state; - - if (new_state == STATION_STATE_READY) { - netif_start_queue(priv->dev); - netif_carrier_on(priv->dev); - } - - if (old_state == STATION_STATE_READY) { - netif_carrier_off(priv->dev); - if (netif_running(priv->dev)) - netif_stop_queue(priv->dev); - priv->last_beacon_timestamp = 0; - } -} - -static void atmel_scan(struct atmel_private *priv, int specific_ssid) -{ - struct { - u8 BSSID[6]; - u8 SSID[MAX_SSID_LENGTH]; - u8 scan_type; - u8 channel; - __le16 BSS_type; - __le16 min_channel_time; - __le16 max_channel_time; - u8 options; - u8 SSID_size; - } cmd; - - memset(cmd.BSSID, 0xff, 6); - - if (priv->fast_scan) { - cmd.SSID_size = priv->SSID_size; - memcpy(cmd.SSID, priv->SSID, priv->SSID_size); - cmd.min_channel_time = cpu_to_le16(10); - cmd.max_channel_time = cpu_to_le16(50); - } else { - priv->BSS_list_entries = 0; - cmd.SSID_size = 0; - cmd.min_channel_time = cpu_to_le16(10); - cmd.max_channel_time = cpu_to_le16(120); - } - - cmd.options = 0; - - if (!specific_ssid) - cmd.options |= SCAN_OPTIONS_SITE_SURVEY; - - cmd.channel = (priv->channel & 0x7f); - cmd.scan_type = SCAN_TYPE_ACTIVE; - cmd.BSS_type = cpu_to_le16(priv->operating_mode == IW_MODE_ADHOC ? - BSS_TYPE_AD_HOC : BSS_TYPE_INFRASTRUCTURE); - - atmel_send_command(priv, CMD_Scan, &cmd, sizeof(cmd)); - - /* This must come after all hardware access to avoid being messed up - by stuff happening in interrupt context after we leave STATE_DOWN */ - atmel_enter_state(priv, STATION_STATE_SCANNING); -} - -static void join(struct atmel_private *priv, int type) -{ - struct { - u8 BSSID[6]; - u8 SSID[MAX_SSID_LENGTH]; - u8 BSS_type; /* this is a short in a scan command - weird */ - u8 channel; - __le16 timeout; - u8 SSID_size; - u8 reserved; - } cmd; - - cmd.SSID_size = priv->SSID_size; - memcpy(cmd.SSID, priv->SSID, priv->SSID_size); - memcpy(cmd.BSSID, priv->CurrentBSSID, 6); - cmd.channel = (priv->channel & 0x7f); - cmd.BSS_type = type; - cmd.timeout = cpu_to_le16(2000); - - atmel_send_command(priv, CMD_Join, &cmd, sizeof(cmd)); -} - -static void start(struct atmel_private *priv, int type) -{ - struct { - u8 BSSID[6]; - u8 SSID[MAX_SSID_LENGTH]; - u8 BSS_type; - u8 channel; - u8 SSID_size; - u8 reserved[3]; - } cmd; - - cmd.SSID_size = priv->SSID_size; - memcpy(cmd.SSID, priv->SSID, priv->SSID_size); - memcpy(cmd.BSSID, priv->BSSID, 6); - cmd.BSS_type = type; - cmd.channel = (priv->channel & 0x7f); - - atmel_send_command(priv, CMD_Start, &cmd, sizeof(cmd)); -} - -static void handle_beacon_probe(struct atmel_private *priv, u16 capability, - u8 channel) -{ - int rejoin = 0; - int new = capability & WLAN_CAPABILITY_SHORT_PREAMBLE ? - SHORT_PREAMBLE : LONG_PREAMBLE; - - if (priv->preamble != new) { - priv->preamble = new; - rejoin = 1; - atmel_set_mib8(priv, Local_Mib_Type, LOCAL_MIB_PREAMBLE_TYPE, new); - } - - if (priv->channel != channel) { - priv->channel = channel; - rejoin = 1; - atmel_set_mib8(priv, Phy_Mib_Type, PHY_MIB_CHANNEL_POS, channel); - } - - if (rejoin) { - priv->station_is_associated = 0; - atmel_enter_state(priv, STATION_STATE_JOINNING); - - if (priv->operating_mode == IW_MODE_INFRA) - join(priv, BSS_TYPE_INFRASTRUCTURE); - else - join(priv, BSS_TYPE_AD_HOC); - } -} - -static void send_authentication_request(struct atmel_private *priv, u16 system, - u8 *challenge, int challenge_len) -{ - struct ieee80211_hdr header; - struct auth_body auth; - - header.frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH); - header.duration_id = cpu_to_le16(0x8000); - header.seq_ctrl = 0; - memcpy(header.addr1, priv->CurrentBSSID, 6); - memcpy(header.addr2, priv->dev->dev_addr, 6); - memcpy(header.addr3, priv->CurrentBSSID, 6); - - if (priv->wep_is_on && priv->CurrentAuthentTransactionSeqNum != 1) - /* no WEP for authentication frames with TrSeqNo 1 */ - header.frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); - - auth.alg = cpu_to_le16(system); - - auth.status = 0; - auth.trans_seq = cpu_to_le16(priv->CurrentAuthentTransactionSeqNum); - priv->ExpectedAuthentTransactionSeqNum = priv->CurrentAuthentTransactionSeqNum+1; - priv->CurrentAuthentTransactionSeqNum += 2; - - if (challenge_len != 0) { - auth.el_id = 16; /* challenge_text */ - auth.chall_text_len = challenge_len; - memcpy(auth.chall_text, challenge, challenge_len); - atmel_transmit_management_frame(priv, &header, (u8 *)&auth, 8 + challenge_len); - } else { - atmel_transmit_management_frame(priv, &header, (u8 *)&auth, 6); - } -} - -static void send_association_request(struct atmel_private *priv, int is_reassoc) -{ - u8 *ssid_el_p; - int bodysize; - struct ieee80211_hdr header; - struct ass_req_format { - __le16 capability; - __le16 listen_interval; - u8 ap[6]; /* nothing after here directly accessible */ - u8 ssid_el_id; - u8 ssid_len; - u8 ssid[MAX_SSID_LENGTH]; - u8 sup_rates_el_id; - u8 sup_rates_len; - u8 rates[4]; - } body; - - header.frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - (is_reassoc ? IEEE80211_STYPE_REASSOC_REQ : IEEE80211_STYPE_ASSOC_REQ)); - header.duration_id = cpu_to_le16(0x8000); - header.seq_ctrl = 0; - - memcpy(header.addr1, priv->CurrentBSSID, 6); - memcpy(header.addr2, priv->dev->dev_addr, 6); - memcpy(header.addr3, priv->CurrentBSSID, 6); - - body.capability = cpu_to_le16(WLAN_CAPABILITY_ESS); - if (priv->wep_is_on) - body.capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); - if (priv->preamble == SHORT_PREAMBLE) - body.capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE); - - body.listen_interval = cpu_to_le16(priv->listen_interval * priv->beacon_period); - - /* current AP address - only in reassoc frame */ - if (is_reassoc) { - memcpy(body.ap, priv->CurrentBSSID, 6); - ssid_el_p = &body.ssid_el_id; - bodysize = 18 + priv->SSID_size; - } else { - ssid_el_p = &body.ap[0]; - bodysize = 12 + priv->SSID_size; - } - - ssid_el_p[0] = WLAN_EID_SSID; - ssid_el_p[1] = priv->SSID_size; - memcpy(ssid_el_p + 2, priv->SSID, priv->SSID_size); - ssid_el_p[2 + priv->SSID_size] = WLAN_EID_SUPP_RATES; - ssid_el_p[3 + priv->SSID_size] = 4; /* len of supported rates */ - memcpy(ssid_el_p + 4 + priv->SSID_size, atmel_basic_rates, 4); - - atmel_transmit_management_frame(priv, &header, (void *)&body, bodysize); -} - -static int is_frame_from_current_bss(struct atmel_private *priv, - struct ieee80211_hdr *header) -{ - if (le16_to_cpu(header->frame_control) & IEEE80211_FCTL_FROMDS) - return memcmp(header->addr3, priv->CurrentBSSID, 6) == 0; - else - return memcmp(header->addr2, priv->CurrentBSSID, 6) == 0; -} - -static int retrieve_bss(struct atmel_private *priv) -{ - int i; - int max_rssi = -128; - int max_index = -1; - - if (priv->BSS_list_entries == 0) - return -1; - - if (priv->connect_to_any_BSS) { - /* Select a BSS with the max-RSSI but of the same type and of - the same WEP mode and that it is not marked as 'bad' (i.e. - we had previously failed to connect to this BSS with the - settings that we currently use) */ - priv->current_BSS = 0; - for (i = 0; i < priv->BSS_list_entries; i++) { - if (priv->operating_mode == priv->BSSinfo[i].BSStype && - ((!priv->wep_is_on && !priv->BSSinfo[i].UsingWEP) || - (priv->wep_is_on && priv->BSSinfo[i].UsingWEP)) && - !(priv->BSSinfo[i].channel & 0x80)) { - max_rssi = priv->BSSinfo[i].RSSI; - priv->current_BSS = max_index = i; - } - } - return max_index; - } - - for (i = 0; i < priv->BSS_list_entries; i++) { - if (priv->SSID_size == priv->BSSinfo[i].SSIDsize && - memcmp(priv->SSID, priv->BSSinfo[i].SSID, priv->SSID_size) == 0 && - priv->operating_mode == priv->BSSinfo[i].BSStype && - atmel_validate_channel(priv, priv->BSSinfo[i].channel) == 0) { - if (priv->BSSinfo[i].RSSI >= max_rssi) { - max_rssi = priv->BSSinfo[i].RSSI; - max_index = i; - } - } - } - return max_index; -} - -static void store_bss_info(struct atmel_private *priv, - struct ieee80211_hdr *header, u16 capability, - u16 beacon_period, u8 channel, u8 rssi, u8 ssid_len, - u8 *ssid, int is_beacon) -{ - u8 *bss = capability & WLAN_CAPABILITY_ESS ? header->addr2 : header->addr3; - int i, index; - - for (index = -1, i = 0; i < priv->BSS_list_entries; i++) - if (memcmp(bss, priv->BSSinfo[i].BSSID, 6) == 0) - index = i; - - /* If we process a probe and an entry from this BSS exists - we will update the BSS entry with the info from this BSS. - If we process a beacon we will only update RSSI */ - - if (index == -1) { - if (priv->BSS_list_entries == MAX_BSS_ENTRIES) - return; - index = priv->BSS_list_entries++; - memcpy(priv->BSSinfo[index].BSSID, bss, 6); - priv->BSSinfo[index].RSSI = rssi; - } else { - if (rssi > priv->BSSinfo[index].RSSI) - priv->BSSinfo[index].RSSI = rssi; - if (is_beacon) - return; - } - - priv->BSSinfo[index].channel = channel; - priv->BSSinfo[index].beacon_period = beacon_period; - priv->BSSinfo[index].UsingWEP = capability & WLAN_CAPABILITY_PRIVACY; - memcpy(priv->BSSinfo[index].SSID, ssid, ssid_len); - priv->BSSinfo[index].SSIDsize = ssid_len; - - if (capability & WLAN_CAPABILITY_IBSS) - priv->BSSinfo[index].BSStype = IW_MODE_ADHOC; - else if (capability & WLAN_CAPABILITY_ESS) - priv->BSSinfo[index].BSStype = IW_MODE_INFRA; - - priv->BSSinfo[index].preamble = capability & WLAN_CAPABILITY_SHORT_PREAMBLE ? - SHORT_PREAMBLE : LONG_PREAMBLE; -} - -static void authenticate(struct atmel_private *priv, u16 frame_len) -{ - struct auth_body *auth = (struct auth_body *)priv->rx_buf; - u16 status = le16_to_cpu(auth->status); - u16 trans_seq_no = le16_to_cpu(auth->trans_seq); - u16 system = le16_to_cpu(auth->alg); - - if (status == WLAN_STATUS_SUCCESS && !priv->wep_is_on) { - /* no WEP */ - if (priv->station_was_associated) { - atmel_enter_state(priv, STATION_STATE_REASSOCIATING); - send_association_request(priv, 1); - return; - } else { - atmel_enter_state(priv, STATION_STATE_ASSOCIATING); - send_association_request(priv, 0); - return; - } - } - - if (status == WLAN_STATUS_SUCCESS && priv->wep_is_on) { - int should_associate = 0; - /* WEP */ - if (trans_seq_no != priv->ExpectedAuthentTransactionSeqNum) - return; - - if (system == WLAN_AUTH_OPEN) { - if (trans_seq_no == 0x0002) { - should_associate = 1; - } - } else if (system == WLAN_AUTH_SHARED_KEY) { - if (trans_seq_no == 0x0002 && - auth->el_id == WLAN_EID_CHALLENGE) { - send_authentication_request(priv, system, auth->chall_text, auth->chall_text_len); - return; - } else if (trans_seq_no == 0x0004) { - should_associate = 1; - } - } - - if (should_associate) { - if (priv->station_was_associated) { - atmel_enter_state(priv, STATION_STATE_REASSOCIATING); - send_association_request(priv, 1); - return; - } else { - atmel_enter_state(priv, STATION_STATE_ASSOCIATING); - send_association_request(priv, 0); - return; - } - } - } - - if (status == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG) { - /* Flip back and forth between WEP auth modes until the max - * authentication tries has been exceeded. - */ - if (system == WLAN_AUTH_OPEN) { - priv->CurrentAuthentTransactionSeqNum = 0x001; - priv->exclude_unencrypted = 1; - send_authentication_request(priv, WLAN_AUTH_SHARED_KEY, NULL, 0); - return; - } else if (system == WLAN_AUTH_SHARED_KEY - && priv->wep_is_on) { - priv->CurrentAuthentTransactionSeqNum = 0x001; - priv->exclude_unencrypted = 0; - send_authentication_request(priv, WLAN_AUTH_OPEN, NULL, 0); - return; - } else if (priv->connect_to_any_BSS) { - int bss_index; - - priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; - - if ((bss_index = retrieve_bss(priv)) != -1) { - atmel_join_bss(priv, bss_index); - return; - } - } - } - - priv->AuthenticationRequestRetryCnt = 0; - atmel_enter_state(priv, STATION_STATE_MGMT_ERROR); - priv->station_is_associated = 0; -} - -static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype) -{ - struct ass_resp_format { - __le16 capability; - __le16 status; - __le16 ass_id; - u8 el_id; - u8 length; - u8 rates[4]; - } *ass_resp = (struct ass_resp_format *)priv->rx_buf; - - u16 status = le16_to_cpu(ass_resp->status); - u16 ass_id = le16_to_cpu(ass_resp->ass_id); - u16 rates_len = ass_resp->length > 4 ? 4 : ass_resp->length; - - union iwreq_data wrqu; - - if (frame_len < 8 + rates_len) - return; - - if (status == WLAN_STATUS_SUCCESS) { - if (subtype == IEEE80211_STYPE_ASSOC_RESP) - priv->AssociationRequestRetryCnt = 0; - else - priv->ReAssociationRequestRetryCnt = 0; - - atmel_set_mib16(priv, Mac_Mgmt_Mib_Type, - MAC_MGMT_MIB_STATION_ID_POS, ass_id & 0x3fff); - atmel_set_mib(priv, Phy_Mib_Type, - PHY_MIB_RATE_SET_POS, ass_resp->rates, rates_len); - if (priv->power_mode == 0) { - priv->listen_interval = 1; - atmel_set_mib8(priv, Mac_Mgmt_Mib_Type, - MAC_MGMT_MIB_PS_MODE_POS, ACTIVE_MODE); - atmel_set_mib16(priv, Mac_Mgmt_Mib_Type, - MAC_MGMT_MIB_LISTEN_INTERVAL_POS, 1); - } else { - priv->listen_interval = 2; - atmel_set_mib8(priv, Mac_Mgmt_Mib_Type, - MAC_MGMT_MIB_PS_MODE_POS, PS_MODE); - atmel_set_mib16(priv, Mac_Mgmt_Mib_Type, - MAC_MGMT_MIB_LISTEN_INTERVAL_POS, 2); - } - - priv->station_is_associated = 1; - priv->station_was_associated = 1; - atmel_enter_state(priv, STATION_STATE_READY); - - /* Send association event to userspace */ - wrqu.data.length = 0; - wrqu.data.flags = 0; - memcpy(wrqu.ap_addr.sa_data, priv->CurrentBSSID, ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); - - return; - } - - if (subtype == IEEE80211_STYPE_ASSOC_RESP && - status != WLAN_STATUS_ASSOC_DENIED_RATES && - status != WLAN_STATUS_CAPS_UNSUPPORTED && - priv->AssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) { - mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); - priv->AssociationRequestRetryCnt++; - send_association_request(priv, 0); - return; - } - - if (subtype == IEEE80211_STYPE_REASSOC_RESP && - status != WLAN_STATUS_ASSOC_DENIED_RATES && - status != WLAN_STATUS_CAPS_UNSUPPORTED && - priv->AssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) { - mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); - priv->ReAssociationRequestRetryCnt++; - send_association_request(priv, 1); - return; - } - - atmel_enter_state(priv, STATION_STATE_MGMT_ERROR); - priv->station_is_associated = 0; - - if (priv->connect_to_any_BSS) { - int bss_index; - priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; - - if ((bss_index = retrieve_bss(priv)) != -1) - atmel_join_bss(priv, bss_index); - } -} - -static void atmel_join_bss(struct atmel_private *priv, int bss_index) -{ - struct bss_info *bss = &priv->BSSinfo[bss_index]; - - memcpy(priv->CurrentBSSID, bss->BSSID, 6); - memcpy(priv->SSID, bss->SSID, priv->SSID_size = bss->SSIDsize); - - /* The WPA stuff cares about the current AP address */ - if (priv->use_wpa) - build_wpa_mib(priv); - - /* When switching to AdHoc turn OFF Power Save if needed */ - - if (bss->BSStype == IW_MODE_ADHOC && - priv->operating_mode != IW_MODE_ADHOC && - priv->power_mode) { - priv->power_mode = 0; - priv->listen_interval = 1; - atmel_set_mib8(priv, Mac_Mgmt_Mib_Type, - MAC_MGMT_MIB_PS_MODE_POS, ACTIVE_MODE); - atmel_set_mib16(priv, Mac_Mgmt_Mib_Type, - MAC_MGMT_MIB_LISTEN_INTERVAL_POS, 1); - } - - priv->operating_mode = bss->BSStype; - priv->channel = bss->channel & 0x7f; - priv->beacon_period = bss->beacon_period; - - if (priv->preamble != bss->preamble) { - priv->preamble = bss->preamble; - atmel_set_mib8(priv, Local_Mib_Type, - LOCAL_MIB_PREAMBLE_TYPE, bss->preamble); - } - - if (!priv->wep_is_on && bss->UsingWEP) { - atmel_enter_state(priv, STATION_STATE_MGMT_ERROR); - priv->station_is_associated = 0; - return; - } - - if (priv->wep_is_on && !bss->UsingWEP) { - atmel_enter_state(priv, STATION_STATE_MGMT_ERROR); - priv->station_is_associated = 0; - return; - } - - atmel_enter_state(priv, STATION_STATE_JOINNING); - - if (priv->operating_mode == IW_MODE_INFRA) - join(priv, BSS_TYPE_INFRASTRUCTURE); - else - join(priv, BSS_TYPE_AD_HOC); -} - -static void restart_search(struct atmel_private *priv) -{ - int bss_index; - - if (!priv->connect_to_any_BSS) { - atmel_scan(priv, 1); - } else { - priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80; - - if ((bss_index = retrieve_bss(priv)) != -1) - atmel_join_bss(priv, bss_index); - else - atmel_scan(priv, 0); - } -} - -static void smooth_rssi(struct atmel_private *priv, u8 rssi) -{ - u8 old = priv->wstats.qual.level; - u8 max_rssi = 42; /* 502-rmfd-revd max by experiment, default for now */ - - switch (priv->firmware_type) { - case ATMEL_FW_TYPE_502E: - max_rssi = 63; /* 502-rmfd-reve max by experiment */ - break; - default: - break; - } - - rssi = rssi * 100 / max_rssi; - if ((rssi + old) % 2) - priv->wstats.qual.level = (rssi + old) / 2 + 1; - else - priv->wstats.qual.level = (rssi + old) / 2; - priv->wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED; - priv->wstats.qual.updated &= ~IW_QUAL_LEVEL_INVALID; -} - -static void atmel_smooth_qual(struct atmel_private *priv) -{ - unsigned long time_diff = (jiffies - priv->last_qual) / HZ; - while (time_diff--) { - priv->last_qual += HZ; - priv->wstats.qual.qual = priv->wstats.qual.qual / 2; - priv->wstats.qual.qual += - priv->beacons_this_sec * priv->beacon_period * (priv->wstats.qual.level + 100) / 4000; - priv->beacons_this_sec = 0; - } - priv->wstats.qual.updated |= IW_QUAL_QUAL_UPDATED; - priv->wstats.qual.updated &= ~IW_QUAL_QUAL_INVALID; -} - -/* deals with incoming management frames. */ -static void atmel_management_frame(struct atmel_private *priv, - struct ieee80211_hdr *header, - u16 frame_len, u8 rssi) -{ - u16 subtype; - - subtype = le16_to_cpu(header->frame_control) & IEEE80211_FCTL_STYPE; - switch (subtype) { - case IEEE80211_STYPE_BEACON: - case IEEE80211_STYPE_PROBE_RESP: - - /* beacon frame has multiple variable-length fields - - never let an engineer loose with a data structure design. */ - { - struct beacon_format { - __le64 timestamp; - __le16 interval; - __le16 capability; - u8 ssid_el_id; - u8 ssid_length; - /* ssid here */ - u8 rates_el_id; - u8 rates_length; - /* rates here */ - u8 ds_el_id; - u8 ds_length; - /* ds here */ - } *beacon = (struct beacon_format *)priv->rx_buf; - - u8 channel, rates_length, ssid_length; - u64 timestamp = le64_to_cpu(beacon->timestamp); - u16 beacon_interval = le16_to_cpu(beacon->interval); - u16 capability = le16_to_cpu(beacon->capability); - u8 *beaconp = priv->rx_buf; - ssid_length = beacon->ssid_length; - /* this blows chunks. */ - if (frame_len < 14 || frame_len < ssid_length + 15) - return; - rates_length = beaconp[beacon->ssid_length + 15]; - if (frame_len < ssid_length + rates_length + 18) - return; - if (ssid_length > MAX_SSID_LENGTH) - return; - channel = beaconp[ssid_length + rates_length + 18]; - - if (priv->station_state == STATION_STATE_READY) { - smooth_rssi(priv, rssi); - if (is_frame_from_current_bss(priv, header)) { - priv->beacons_this_sec++; - atmel_smooth_qual(priv); - if (priv->last_beacon_timestamp) { - /* Note truncate this to 32 bits - kernel can't divide a long long */ - u32 beacon_delay = timestamp - priv->last_beacon_timestamp; - int beacons = beacon_delay / (beacon_interval * 1000); - if (beacons > 1) - priv->wstats.miss.beacon += beacons - 1; - } - priv->last_beacon_timestamp = timestamp; - handle_beacon_probe(priv, capability, channel); - } - } - - if (priv->station_state == STATION_STATE_SCANNING) - store_bss_info(priv, header, capability, - beacon_interval, channel, rssi, - ssid_length, - &beacon->rates_el_id, - subtype == IEEE80211_STYPE_BEACON); - } - break; - - case IEEE80211_STYPE_AUTH: - - if (priv->station_state == STATION_STATE_AUTHENTICATING) - authenticate(priv, frame_len); - - break; - - case IEEE80211_STYPE_ASSOC_RESP: - case IEEE80211_STYPE_REASSOC_RESP: - - if (priv->station_state == STATION_STATE_ASSOCIATING || - priv->station_state == STATION_STATE_REASSOCIATING) - associate(priv, frame_len, subtype); - - break; - - case IEEE80211_STYPE_DISASSOC: - if (priv->station_is_associated && - priv->operating_mode == IW_MODE_INFRA && - is_frame_from_current_bss(priv, header)) { - priv->station_was_associated = 0; - priv->station_is_associated = 0; - - atmel_enter_state(priv, STATION_STATE_JOINNING); - join(priv, BSS_TYPE_INFRASTRUCTURE); - } - - break; - - case IEEE80211_STYPE_DEAUTH: - if (priv->operating_mode == IW_MODE_INFRA && - is_frame_from_current_bss(priv, header)) { - priv->station_was_associated = 0; - - atmel_enter_state(priv, STATION_STATE_JOINNING); - join(priv, BSS_TYPE_INFRASTRUCTURE); - } - - break; - } -} - -/* run when timer expires */ -static void atmel_management_timer(u_long a) -{ - struct net_device *dev = (struct net_device *) a; - struct atmel_private *priv = netdev_priv(dev); - unsigned long flags; - - /* Check if the card has been yanked. */ - if (priv->card && priv->present_callback && - !(*priv->present_callback)(priv->card)) - return; - - spin_lock_irqsave(&priv->irqlock, flags); - - switch (priv->station_state) { - - case STATION_STATE_AUTHENTICATING: - if (priv->AuthenticationRequestRetryCnt >= MAX_AUTHENTICATION_RETRIES) { - atmel_enter_state(priv, STATION_STATE_MGMT_ERROR); - priv->station_is_associated = 0; - priv->AuthenticationRequestRetryCnt = 0; - restart_search(priv); - } else { - int auth = WLAN_AUTH_OPEN; - priv->AuthenticationRequestRetryCnt++; - priv->CurrentAuthentTransactionSeqNum = 0x0001; - mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); - if (priv->wep_is_on && priv->exclude_unencrypted) - auth = WLAN_AUTH_SHARED_KEY; - send_authentication_request(priv, auth, NULL, 0); - } - break; - - case STATION_STATE_ASSOCIATING: - if (priv->AssociationRequestRetryCnt == MAX_ASSOCIATION_RETRIES) { - atmel_enter_state(priv, STATION_STATE_MGMT_ERROR); - priv->station_is_associated = 0; - priv->AssociationRequestRetryCnt = 0; - restart_search(priv); - } else { - priv->AssociationRequestRetryCnt++; - mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); - send_association_request(priv, 0); - } - break; - - case STATION_STATE_REASSOCIATING: - if (priv->ReAssociationRequestRetryCnt == MAX_ASSOCIATION_RETRIES) { - atmel_enter_state(priv, STATION_STATE_MGMT_ERROR); - priv->station_is_associated = 0; - priv->ReAssociationRequestRetryCnt = 0; - restart_search(priv); - } else { - priv->ReAssociationRequestRetryCnt++; - mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); - send_association_request(priv, 1); - } - break; - - default: - break; - } - - spin_unlock_irqrestore(&priv->irqlock, flags); -} - -static void atmel_command_irq(struct atmel_private *priv) -{ - u8 status = atmel_rmem8(priv, atmel_co(priv, CMD_BLOCK_STATUS_OFFSET)); - u8 command = atmel_rmem8(priv, atmel_co(priv, CMD_BLOCK_COMMAND_OFFSET)); - int fast_scan; - union iwreq_data wrqu; - - if (status == CMD_STATUS_IDLE || - status == CMD_STATUS_IN_PROGRESS) - return; - - switch (command) { - case CMD_Start: - if (status == CMD_STATUS_COMPLETE) { - priv->station_was_associated = priv->station_is_associated; - atmel_get_mib(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_CUR_BSSID_POS, - (u8 *)priv->CurrentBSSID, 6); - atmel_enter_state(priv, STATION_STATE_READY); - } - break; - - case CMD_Scan: - fast_scan = priv->fast_scan; - priv->fast_scan = 0; - - if (status != CMD_STATUS_COMPLETE) { - atmel_scan(priv, 1); - } else { - int bss_index = retrieve_bss(priv); - int notify_scan_complete = 1; - if (bss_index != -1) { - atmel_join_bss(priv, bss_index); - } else if (priv->operating_mode == IW_MODE_ADHOC && - priv->SSID_size != 0) { - start(priv, BSS_TYPE_AD_HOC); - } else { - priv->fast_scan = !fast_scan; - atmel_scan(priv, 1); - notify_scan_complete = 0; - } - priv->site_survey_state = SITE_SURVEY_COMPLETED; - if (notify_scan_complete) { - wrqu.data.length = 0; - wrqu.data.flags = 0; - wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); - } - } - break; - - case CMD_SiteSurvey: - priv->fast_scan = 0; - - if (status != CMD_STATUS_COMPLETE) - return; - - priv->site_survey_state = SITE_SURVEY_COMPLETED; - if (priv->station_is_associated) { - atmel_enter_state(priv, STATION_STATE_READY); - wrqu.data.length = 0; - wrqu.data.flags = 0; - wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); - } else { - atmel_scan(priv, 1); - } - break; - - case CMD_Join: - if (status == CMD_STATUS_COMPLETE) { - if (priv->operating_mode == IW_MODE_ADHOC) { - priv->station_was_associated = priv->station_is_associated; - atmel_enter_state(priv, STATION_STATE_READY); - } else { - int auth = WLAN_AUTH_OPEN; - priv->AuthenticationRequestRetryCnt = 0; - atmel_enter_state(priv, STATION_STATE_AUTHENTICATING); - - mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES); - priv->CurrentAuthentTransactionSeqNum = 0x0001; - if (priv->wep_is_on && priv->exclude_unencrypted) - auth = WLAN_AUTH_SHARED_KEY; - send_authentication_request(priv, auth, NULL, 0); - } - return; - } - - atmel_scan(priv, 1); - } -} - -static int atmel_wakeup_firmware(struct atmel_private *priv) -{ - struct host_info_struct *iface = &priv->host_info; - u16 mr1, mr3; - int i; - - if (priv->card_type == CARD_TYPE_SPI_FLASH) - atmel_set_gcr(priv->dev, GCR_REMAP); - - /* wake up on-board processor */ - atmel_clear_gcr(priv->dev, 0x0040); - atmel_write16(priv->dev, BSR, BSS_SRAM); - - if (priv->card_type == CARD_TYPE_SPI_FLASH) - mdelay(100); - - /* and wait for it */ - for (i = LOOP_RETRY_LIMIT; i; i--) { - mr1 = atmel_read16(priv->dev, MR1); - mr3 = atmel_read16(priv->dev, MR3); - - if (mr3 & MAC_BOOT_COMPLETE) - break; - if (mr1 & MAC_BOOT_COMPLETE && - priv->bus_type == BUS_TYPE_PCCARD) - break; - } - - if (i == 0) { - printk(KERN_ALERT "%s: MAC failed to boot.\n", priv->dev->name); - return -EIO; - } - - if ((priv->host_info_base = atmel_read16(priv->dev, MR2)) == 0xffff) { - printk(KERN_ALERT "%s: card missing.\n", priv->dev->name); - return -ENODEV; - } - - /* now check for completion of MAC initialization through - the FunCtrl field of the IFACE, poll MR1 to detect completion of - MAC initialization, check completion status, set interrupt mask, - enables interrupts and calls Tx and Rx initialization functions */ - - atmel_wmem8(priv, atmel_hi(priv, IFACE_FUNC_CTRL_OFFSET), FUNC_CTRL_INIT_COMPLETE); - - for (i = LOOP_RETRY_LIMIT; i; i--) { - mr1 = atmel_read16(priv->dev, MR1); - mr3 = atmel_read16(priv->dev, MR3); - - if (mr3 & MAC_INIT_COMPLETE) - break; - if (mr1 & MAC_INIT_COMPLETE && - priv->bus_type == BUS_TYPE_PCCARD) - break; - } - - if (i == 0) { - printk(KERN_ALERT "%s: MAC failed to initialise.\n", - priv->dev->name); - return -EIO; - } - - /* Check for MAC_INIT_OK only on the register that the MAC_INIT_OK was set */ - if ((mr3 & MAC_INIT_COMPLETE) && - !(atmel_read16(priv->dev, MR3) & MAC_INIT_OK)) { - printk(KERN_ALERT "%s: MAC failed MR3 self-test.\n", priv->dev->name); - return -EIO; - } - if ((mr1 & MAC_INIT_COMPLETE) && - !(atmel_read16(priv->dev, MR1) & MAC_INIT_OK)) { - printk(KERN_ALERT "%s: MAC failed MR1 self-test.\n", priv->dev->name); - return -EIO; - } - - atmel_copy_to_host(priv->dev, (unsigned char *)iface, - priv->host_info_base, sizeof(*iface)); - - iface->tx_buff_pos = le16_to_cpu(iface->tx_buff_pos); - iface->tx_buff_size = le16_to_cpu(iface->tx_buff_size); - iface->tx_desc_pos = le16_to_cpu(iface->tx_desc_pos); - iface->tx_desc_count = le16_to_cpu(iface->tx_desc_count); - iface->rx_buff_pos = le16_to_cpu(iface->rx_buff_pos); - iface->rx_buff_size = le16_to_cpu(iface->rx_buff_size); - iface->rx_desc_pos = le16_to_cpu(iface->rx_desc_pos); - iface->rx_desc_count = le16_to_cpu(iface->rx_desc_count); - iface->build_version = le16_to_cpu(iface->build_version); - iface->command_pos = le16_to_cpu(iface->command_pos); - iface->major_version = le16_to_cpu(iface->major_version); - iface->minor_version = le16_to_cpu(iface->minor_version); - iface->func_ctrl = le16_to_cpu(iface->func_ctrl); - iface->mac_status = le16_to_cpu(iface->mac_status); - - return 0; -} - -/* determine type of memory and MAC address */ -static int probe_atmel_card(struct net_device *dev) -{ - int rc = 0; - struct atmel_private *priv = netdev_priv(dev); - - /* reset pccard */ - if (priv->bus_type == BUS_TYPE_PCCARD) - atmel_write16(dev, GCR, 0x0060); - - atmel_write16(dev, GCR, 0x0040); - mdelay(500); - - if (atmel_read16(dev, MR2) == 0) { - /* No stored firmware so load a small stub which just - tells us the MAC address */ - int i; - priv->card_type = CARD_TYPE_EEPROM; - atmel_write16(dev, BSR, BSS_IRAM); - atmel_copy_to_card(dev, 0, mac_reader, sizeof(mac_reader)); - atmel_set_gcr(dev, GCR_REMAP); - atmel_clear_gcr(priv->dev, 0x0040); - atmel_write16(dev, BSR, BSS_SRAM); - for (i = LOOP_RETRY_LIMIT; i; i--) - if (atmel_read16(dev, MR3) & MAC_BOOT_COMPLETE) - break; - if (i == 0) { - printk(KERN_ALERT "%s: MAC failed to boot MAC address reader.\n", dev->name); - } else { - atmel_copy_to_host(dev, dev->dev_addr, atmel_read16(dev, MR2), 6); - /* got address, now squash it again until the network - interface is opened */ - if (priv->bus_type == BUS_TYPE_PCCARD) - atmel_write16(dev, GCR, 0x0060); - atmel_write16(dev, GCR, 0x0040); - rc = 1; - } - } else if (atmel_read16(dev, MR4) == 0) { - /* Mac address easy in this case. */ - priv->card_type = CARD_TYPE_PARALLEL_FLASH; - atmel_write16(dev, BSR, 1); - atmel_copy_to_host(dev, dev->dev_addr, 0xc000, 6); - atmel_write16(dev, BSR, 0x200); - rc = 1; - } else { - /* Standard firmware in flash, boot it up and ask - for the Mac Address */ - priv->card_type = CARD_TYPE_SPI_FLASH; - if (atmel_wakeup_firmware(priv) == 0) { - atmel_get_mib(priv, Mac_Address_Mib_Type, 0, dev->dev_addr, 6); - - /* got address, now squash it again until the network - interface is opened */ - if (priv->bus_type == BUS_TYPE_PCCARD) - atmel_write16(dev, GCR, 0x0060); - atmel_write16(dev, GCR, 0x0040); - rc = 1; - } - } - - if (rc) { - if (dev->dev_addr[0] == 0xFF) { - static const u8 default_mac[] = { - 0x00, 0x04, 0x25, 0x00, 0x00, 0x00 - }; - printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name); - memcpy(dev->dev_addr, default_mac, 6); - } - } - - return rc; -} - -/* Move the encyption information on the MIB structure. - This routine is for the pre-WPA firmware: later firmware has - a different format MIB and a different routine. */ -static void build_wep_mib(struct atmel_private *priv) -{ - struct { /* NB this is matched to the hardware, don't change. */ - u8 wep_is_on; - u8 default_key; /* 0..3 */ - u8 reserved; - u8 exclude_unencrypted; - - u32 WEPICV_error_count; - u32 WEP_excluded_count; - - u8 wep_keys[MAX_ENCRYPTION_KEYS][13]; - u8 encryption_level; /* 0, 1, 2 */ - u8 reserved2[3]; - } mib; - int i; - - mib.wep_is_on = priv->wep_is_on; - if (priv->wep_is_on) { - if (priv->wep_key_len[priv->default_key] > 5) - mib.encryption_level = 2; - else - mib.encryption_level = 1; - } else { - mib.encryption_level = 0; - } - - mib.default_key = priv->default_key; - mib.exclude_unencrypted = priv->exclude_unencrypted; - - for (i = 0; i < MAX_ENCRYPTION_KEYS; i++) - memcpy(mib.wep_keys[i], priv->wep_keys[i], 13); - - atmel_set_mib(priv, Mac_Wep_Mib_Type, 0, (u8 *)&mib, sizeof(mib)); -} - -static void build_wpa_mib(struct atmel_private *priv) -{ - /* This is for the later (WPA enabled) firmware. */ - - struct { /* NB this is matched to the hardware, don't change. */ - u8 cipher_default_key_value[MAX_ENCRYPTION_KEYS][MAX_ENCRYPTION_KEY_SIZE]; - u8 receiver_address[6]; - u8 wep_is_on; - u8 default_key; /* 0..3 */ - u8 group_key; - u8 exclude_unencrypted; - u8 encryption_type; - u8 reserved; - - u32 WEPICV_error_count; - u32 WEP_excluded_count; - - u8 key_RSC[4][8]; - } mib; - - int i; - - mib.wep_is_on = priv->wep_is_on; - mib.exclude_unencrypted = priv->exclude_unencrypted; - memcpy(mib.receiver_address, priv->CurrentBSSID, 6); - - /* zero all the keys before adding in valid ones. */ - memset(mib.cipher_default_key_value, 0, sizeof(mib.cipher_default_key_value)); - - if (priv->wep_is_on) { - /* There's a comment in the Atmel code to the effect that this - is only valid when still using WEP, it may need to be set to - something to use WPA */ - memset(mib.key_RSC, 0, sizeof(mib.key_RSC)); - - mib.default_key = mib.group_key = 255; - for (i = 0; i < MAX_ENCRYPTION_KEYS; i++) { - if (priv->wep_key_len[i] > 0) { - memcpy(mib.cipher_default_key_value[i], priv->wep_keys[i], MAX_ENCRYPTION_KEY_SIZE); - if (i == priv->default_key) { - mib.default_key = i; - mib.cipher_default_key_value[i][MAX_ENCRYPTION_KEY_SIZE-1] = 7; - mib.cipher_default_key_value[i][MAX_ENCRYPTION_KEY_SIZE-2] = priv->pairwise_cipher_suite; - } else { - mib.group_key = i; - priv->group_cipher_suite = priv->pairwise_cipher_suite; - mib.cipher_default_key_value[i][MAX_ENCRYPTION_KEY_SIZE-1] = 1; - mib.cipher_default_key_value[i][MAX_ENCRYPTION_KEY_SIZE-2] = priv->group_cipher_suite; - } - } - } - if (mib.default_key == 255) - mib.default_key = mib.group_key != 255 ? mib.group_key : 0; - if (mib.group_key == 255) - mib.group_key = mib.default_key; - - } - - atmel_set_mib(priv, Mac_Wep_Mib_Type, 0, (u8 *)&mib, sizeof(mib)); -} - -static int reset_atmel_card(struct net_device *dev) -{ - /* do everything necessary to wake up the hardware, including - waiting for the lightning strike and throwing the knife switch.... - - set all the Mib values which matter in the card to match - their settings in the atmel_private structure. Some of these - can be altered on the fly, but many (WEP, infrastucture or ad-hoc) - can only be changed by tearing down the world and coming back through - here. - - This routine is also responsible for initialising some - hardware-specific fields in the atmel_private structure, - including a copy of the firmware's hostinfo structure - which is the route into the rest of the firmware datastructures. */ - - struct atmel_private *priv = netdev_priv(dev); - u8 configuration; - int old_state = priv->station_state; - int err = 0; - - /* data to add to the firmware names, in priority order - this implemenents firmware versioning */ - - static char *firmware_modifier[] = { - "-wpa", - "", - NULL - }; - - /* reset pccard */ - if (priv->bus_type == BUS_TYPE_PCCARD) - atmel_write16(priv->dev, GCR, 0x0060); - - /* stop card , disable interrupts */ - atmel_write16(priv->dev, GCR, 0x0040); - - if (priv->card_type == CARD_TYPE_EEPROM) { - /* copy in firmware if needed */ - const struct firmware *fw_entry = NULL; - const unsigned char *fw; - int len = priv->firmware_length; - if (!(fw = priv->firmware)) { - if (priv->firmware_type == ATMEL_FW_TYPE_NONE) { - if (strlen(priv->firmware_id) == 0) { - printk(KERN_INFO - "%s: card type is unknown: assuming at76c502 firmware is OK.\n", - dev->name); - printk(KERN_INFO - "%s: if not, use the firmware= module parameter.\n", - dev->name); - strcpy(priv->firmware_id, "atmel_at76c502.bin"); - } - err = request_firmware(&fw_entry, priv->firmware_id, priv->sys_dev); - if (err != 0) { - printk(KERN_ALERT - "%s: firmware %s is missing, cannot continue.\n", - dev->name, priv->firmware_id); - return err; - } - } else { - int fw_index = 0; - int success = 0; - - /* get firmware filename entry based on firmware type ID */ - while (fw_table[fw_index].fw_type != priv->firmware_type - && fw_table[fw_index].fw_type != ATMEL_FW_TYPE_NONE) - fw_index++; - - /* construct the actual firmware file name */ - if (fw_table[fw_index].fw_type != ATMEL_FW_TYPE_NONE) { - int i; - for (i = 0; firmware_modifier[i]; i++) { - snprintf(priv->firmware_id, 32, "%s%s.%s", fw_table[fw_index].fw_file, - firmware_modifier[i], fw_table[fw_index].fw_file_ext); - priv->firmware_id[31] = '\0'; - if (request_firmware(&fw_entry, priv->firmware_id, priv->sys_dev) == 0) { - success = 1; - break; - } - } - } - if (!success) { - printk(KERN_ALERT - "%s: firmware %s is missing, cannot start.\n", - dev->name, priv->firmware_id); - priv->firmware_id[0] = '\0'; - return -ENOENT; - } - } - - fw = fw_entry->data; - len = fw_entry->size; - } - - if (len <= 0x6000) { - atmel_write16(priv->dev, BSR, BSS_IRAM); - atmel_copy_to_card(priv->dev, 0, fw, len); - atmel_set_gcr(priv->dev, GCR_REMAP); - } else { - /* Remap */ - atmel_set_gcr(priv->dev, GCR_REMAP); - atmel_write16(priv->dev, BSR, BSS_IRAM); - atmel_copy_to_card(priv->dev, 0, fw, 0x6000); - atmel_write16(priv->dev, BSR, 0x2ff); - atmel_copy_to_card(priv->dev, 0x8000, &fw[0x6000], len - 0x6000); - } - - release_firmware(fw_entry); - } - - err = atmel_wakeup_firmware(priv); - if (err != 0) - return err; - - /* Check the version and set the correct flag for wpa stuff, - old and new firmware is incompatible. - The pre-wpa 3com firmware reports major version 5, - the wpa 3com firmware is major version 4 and doesn't need - the 3com broken-ness filter. */ - priv->use_wpa = (priv->host_info.major_version == 4); - priv->radio_on_broken = (priv->host_info.major_version == 5); - - /* unmask all irq sources */ - atmel_wmem8(priv, atmel_hi(priv, IFACE_INT_MASK_OFFSET), 0xff); - - /* int Tx system and enable Tx */ - atmel_wmem8(priv, atmel_tx(priv, TX_DESC_FLAGS_OFFSET, 0), 0); - atmel_wmem32(priv, atmel_tx(priv, TX_DESC_NEXT_OFFSET, 0), 0x80000000L); - atmel_wmem16(priv, atmel_tx(priv, TX_DESC_POS_OFFSET, 0), 0); - atmel_wmem16(priv, atmel_tx(priv, TX_DESC_SIZE_OFFSET, 0), 0); - - priv->tx_desc_free = priv->host_info.tx_desc_count; - priv->tx_desc_head = 0; - priv->tx_desc_tail = 0; - priv->tx_desc_previous = 0; - priv->tx_free_mem = priv->host_info.tx_buff_size; - priv->tx_buff_head = 0; - priv->tx_buff_tail = 0; - - configuration = atmel_rmem8(priv, atmel_hi(priv, IFACE_FUNC_CTRL_OFFSET)); - atmel_wmem8(priv, atmel_hi(priv, IFACE_FUNC_CTRL_OFFSET), - configuration | FUNC_CTRL_TxENABLE); - - /* init Rx system and enable */ - priv->rx_desc_head = 0; - - configuration = atmel_rmem8(priv, atmel_hi(priv, IFACE_FUNC_CTRL_OFFSET)); - atmel_wmem8(priv, atmel_hi(priv, IFACE_FUNC_CTRL_OFFSET), - configuration | FUNC_CTRL_RxENABLE); - - if (!priv->radio_on_broken) { - if (atmel_send_command_wait(priv, CMD_EnableRadio, NULL, 0) == - CMD_STATUS_REJECTED_RADIO_OFF) { - printk(KERN_INFO "%s: cannot turn the radio on.\n", - dev->name); - return -EIO; - } - } - - /* set up enough MIB values to run. */ - atmel_set_mib8(priv, Local_Mib_Type, LOCAL_MIB_AUTO_TX_RATE_POS, priv->auto_tx_rate); - atmel_set_mib8(priv, Local_Mib_Type, LOCAL_MIB_TX_PROMISCUOUS_POS, PROM_MODE_OFF); - atmel_set_mib16(priv, Mac_Mib_Type, MAC_MIB_RTS_THRESHOLD_POS, priv->rts_threshold); - atmel_set_mib16(priv, Mac_Mib_Type, MAC_MIB_FRAG_THRESHOLD_POS, priv->frag_threshold); - atmel_set_mib8(priv, Mac_Mib_Type, MAC_MIB_SHORT_RETRY_POS, priv->short_retry); - atmel_set_mib8(priv, Mac_Mib_Type, MAC_MIB_LONG_RETRY_POS, priv->long_retry); - atmel_set_mib8(priv, Local_Mib_Type, LOCAL_MIB_PREAMBLE_TYPE, priv->preamble); - atmel_set_mib(priv, Mac_Address_Mib_Type, MAC_ADDR_MIB_MAC_ADDR_POS, - priv->dev->dev_addr, 6); - atmel_set_mib8(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_PS_MODE_POS, ACTIVE_MODE); - atmel_set_mib16(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_LISTEN_INTERVAL_POS, 1); - atmel_set_mib16(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_BEACON_PER_POS, priv->default_beacon_period); - atmel_set_mib(priv, Phy_Mib_Type, PHY_MIB_RATE_SET_POS, atmel_basic_rates, 4); - atmel_set_mib8(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_CUR_PRIVACY_POS, priv->wep_is_on); - if (priv->use_wpa) - build_wpa_mib(priv); - else - build_wep_mib(priv); - - if (old_state == STATION_STATE_READY) { - union iwreq_data wrqu; - - wrqu.data.length = 0; - wrqu.data.flags = 0; - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); - wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); - } - - return 0; -} - -static void atmel_send_command(struct atmel_private *priv, int command, - void *cmd, int cmd_size) -{ - if (cmd) - atmel_copy_to_card(priv->dev, atmel_co(priv, CMD_BLOCK_PARAMETERS_OFFSET), - cmd, cmd_size); - - atmel_wmem8(priv, atmel_co(priv, CMD_BLOCK_COMMAND_OFFSET), command); - atmel_wmem8(priv, atmel_co(priv, CMD_BLOCK_STATUS_OFFSET), 0); -} - -static int atmel_send_command_wait(struct atmel_private *priv, int command, - void *cmd, int cmd_size) -{ - int i, status; - - atmel_send_command(priv, command, cmd, cmd_size); - - for (i = 5000; i; i--) { - status = atmel_rmem8(priv, atmel_co(priv, CMD_BLOCK_STATUS_OFFSET)); - if (status != CMD_STATUS_IDLE && - status != CMD_STATUS_IN_PROGRESS) - break; - udelay(20); - } - - if (i == 0) { - printk(KERN_ALERT "%s: failed to contact MAC.\n", priv->dev->name); - status = CMD_STATUS_HOST_ERROR; - } else { - if (command != CMD_EnableRadio) - status = CMD_STATUS_COMPLETE; - } - - return status; -} - -static u8 atmel_get_mib8(struct atmel_private *priv, u8 type, u8 index) -{ - struct get_set_mib m; - m.type = type; - m.size = 1; - m.index = index; - - atmel_send_command_wait(priv, CMD_Get_MIB_Vars, &m, MIB_HEADER_SIZE + 1); - return atmel_rmem8(priv, atmel_co(priv, CMD_BLOCK_PARAMETERS_OFFSET + MIB_HEADER_SIZE)); -} - -static void atmel_set_mib8(struct atmel_private *priv, u8 type, u8 index, u8 data) -{ - struct get_set_mib m; - m.type = type; - m.size = 1; - m.index = index; - m.data[0] = data; - - atmel_send_command_wait(priv, CMD_Set_MIB_Vars, &m, MIB_HEADER_SIZE + 1); -} - -static void atmel_set_mib16(struct atmel_private *priv, u8 type, u8 index, - u16 data) -{ - struct get_set_mib m; - m.type = type; - m.size = 2; - m.index = index; - m.data[0] = data; - m.data[1] = data >> 8; - - atmel_send_command_wait(priv, CMD_Set_MIB_Vars, &m, MIB_HEADER_SIZE + 2); -} - -static void atmel_set_mib(struct atmel_private *priv, u8 type, u8 index, - u8 *data, int data_len) -{ - struct get_set_mib m; - m.type = type; - m.size = data_len; - m.index = index; - - if (data_len > MIB_MAX_DATA_BYTES) - printk(KERN_ALERT "%s: MIB buffer too small.\n", priv->dev->name); - - memcpy(m.data, data, data_len); - atmel_send_command_wait(priv, CMD_Set_MIB_Vars, &m, MIB_HEADER_SIZE + data_len); -} - -static void atmel_get_mib(struct atmel_private *priv, u8 type, u8 index, - u8 *data, int data_len) -{ - struct get_set_mib m; - m.type = type; - m.size = data_len; - m.index = index; - - if (data_len > MIB_MAX_DATA_BYTES) - printk(KERN_ALERT "%s: MIB buffer too small.\n", priv->dev->name); - - atmel_send_command_wait(priv, CMD_Get_MIB_Vars, &m, MIB_HEADER_SIZE + data_len); - atmel_copy_to_host(priv->dev, data, - atmel_co(priv, CMD_BLOCK_PARAMETERS_OFFSET + MIB_HEADER_SIZE), data_len); -} - -static void atmel_writeAR(struct net_device *dev, u16 data) -{ - int i; - outw(data, dev->base_addr + AR); - /* Address register appears to need some convincing..... */ - for (i = 0; data != inw(dev->base_addr + AR) && i < 10; i++) - outw(data, dev->base_addr + AR); -} - -static void atmel_copy_to_card(struct net_device *dev, u16 dest, - const unsigned char *src, u16 len) -{ - int i; - atmel_writeAR(dev, dest); - if (dest % 2) { - atmel_write8(dev, DR, *src); - src++; len--; - } - for (i = len; i > 1 ; i -= 2) { - u8 lb = *src++; - u8 hb = *src++; - atmel_write16(dev, DR, lb | (hb << 8)); - } - if (i) - atmel_write8(dev, DR, *src); -} - -static void atmel_copy_to_host(struct net_device *dev, unsigned char *dest, - u16 src, u16 len) -{ - int i; - atmel_writeAR(dev, src); - if (src % 2) { - *dest = atmel_read8(dev, DR); - dest++; len--; - } - for (i = len; i > 1 ; i -= 2) { - u16 hw = atmel_read16(dev, DR); - *dest++ = hw; - *dest++ = hw >> 8; - } - if (i) - *dest = atmel_read8(dev, DR); -} - -static void atmel_set_gcr(struct net_device *dev, u16 mask) -{ - outw(inw(dev->base_addr + GCR) | mask, dev->base_addr + GCR); -} - -static void atmel_clear_gcr(struct net_device *dev, u16 mask) -{ - outw(inw(dev->base_addr + GCR) & ~mask, dev->base_addr + GCR); -} - -static int atmel_lock_mac(struct atmel_private *priv) -{ - int i, j = 20; - retry: - for (i = 5000; i; i--) { - if (!atmel_rmem8(priv, atmel_hi(priv, IFACE_LOCKOUT_HOST_OFFSET))) - break; - udelay(20); - } - - if (!i) - return 0; /* timed out */ - - atmel_wmem8(priv, atmel_hi(priv, IFACE_LOCKOUT_MAC_OFFSET), 1); - if (atmel_rmem8(priv, atmel_hi(priv, IFACE_LOCKOUT_HOST_OFFSET))) { - atmel_wmem8(priv, atmel_hi(priv, IFACE_LOCKOUT_MAC_OFFSET), 0); - if (!j--) - return 0; /* timed out */ - goto retry; - } - - return 1; -} - -static void atmel_wmem32(struct atmel_private *priv, u16 pos, u32 data) -{ - atmel_writeAR(priv->dev, pos); - atmel_write16(priv->dev, DR, data); /* card is little-endian */ - atmel_write16(priv->dev, DR, data >> 16); -} - -/***************************************************************************/ -/* There follows the source form of the MAC address reading firmware */ -/***************************************************************************/ -#if 0 - -/* Copyright 2003 Matthew T. Russotto */ -/* But derived from the Atmel 76C502 firmware written by Atmel and */ -/* included in "atmel wireless lan drivers" package */ -/** - This file is part of net.russotto.AtmelMACFW, hereto referred to - as AtmelMACFW - - AtmelMACFW is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 - as published by the Free Software Foundation. - - AtmelMACFW 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 AtmelMACFW; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -****************************************************************************/ -/* This firmware should work on the 76C502 RFMD, RFMD_D, and RFMD_E */ -/* It will probably work on the 76C504 and 76C502 RFMD_3COM */ -/* It only works on SPI EEPROM versions of the card. */ - -/* This firmware initializes the SPI controller and clock, reads the MAC */ -/* address from the EEPROM into SRAM, and puts the SRAM offset of the MAC */ -/* address in MR2, and sets MR3 to 0x10 to indicate it is done */ -/* It also puts a complete copy of the EEPROM in SRAM with the offset in */ -/* MR4, for investigational purposes (maybe we can determine chip type */ -/* from that?) */ - - .org 0 - .set MRBASE, 0x8000000 - .set CPSR_INITIAL, 0xD3 /* IRQ/FIQ disabled, ARM mode, Supervisor state */ - .set CPSR_USER, 0xD1 /* IRQ/FIQ disabled, ARM mode, USER state */ - .set SRAM_BASE, 0x02000000 - .set SP_BASE, 0x0F300000 - .set UNK_BASE, 0x0F000000 /* Some internal device, but which one? */ - .set SPI_CGEN_BASE, 0x0E000000 /* Some internal device, but which one? */ - .set UNK3_BASE, 0x02014000 /* Some internal device, but which one? */ - .set STACK_BASE, 0x5600 - .set SP_SR, 0x10 - .set SP_TDRE, 2 /* status register bit -- TDR empty */ - .set SP_RDRF, 1 /* status register bit -- RDR full */ - .set SP_SWRST, 0x80 - .set SP_SPIEN, 0x1 - .set SP_CR, 0 /* control register */ - .set SP_MR, 4 /* mode register */ - .set SP_RDR, 0x08 /* Read Data Register */ - .set SP_TDR, 0x0C /* Transmit Data Register */ - .set SP_CSR0, 0x30 /* chip select registers */ - .set SP_CSR1, 0x34 - .set SP_CSR2, 0x38 - .set SP_CSR3, 0x3C - .set NVRAM_CMD_RDSR, 5 /* read status register */ - .set NVRAM_CMD_READ, 3 /* read data */ - .set NVRAM_SR_RDY, 1 /* RDY bit. This bit is inverted */ - .set SPI_8CLOCKS, 0xFF /* Writing this to the TDR doesn't do anything to the - serial output, since SO is normally high. But it - does cause 8 clock cycles and thus 8 bits to be - clocked in to the chip. See Atmel's SPI - controller (e.g. AT91M55800) timing and 4K - SPI EEPROM manuals */ - - .set NVRAM_SCRATCH, 0x02000100 /* arbitrary area for scratchpad memory */ - .set NVRAM_IMAGE, 0x02000200 - .set NVRAM_LENGTH, 0x0200 - .set MAC_ADDRESS_MIB, SRAM_BASE - .set MAC_ADDRESS_LENGTH, 6 - .set MAC_BOOT_FLAG, 0x10 - .set MR1, 0 - .set MR2, 4 - .set MR3, 8 - .set MR4, 0xC -RESET_VECTOR: - b RESET_HANDLER -UNDEF_VECTOR: - b HALT1 -SWI_VECTOR: - b HALT1 -IABORT_VECTOR: - b HALT1 -DABORT_VECTOR: -RESERVED_VECTOR: - b HALT1 -IRQ_VECTOR: - b HALT1 -FIQ_VECTOR: - b HALT1 -HALT1: b HALT1 -RESET_HANDLER: - mov r0, #CPSR_INITIAL - msr CPSR_c, r0 /* This is probably unnecessary */ - -/* I'm guessing this is initializing clock generator electronics for SPI */ - ldr r0, =SPI_CGEN_BASE - mov r1, #0 - mov r1, r1, lsl #3 - orr r1, r1, #0 - str r1, [r0] - ldr r1, [r0, #28] - bic r1, r1, #16 - str r1, [r0, #28] - mov r1, #1 - str r1, [r0, #8] - - ldr r0, =MRBASE - mov r1, #0 - strh r1, [r0, #MR1] - strh r1, [r0, #MR2] - strh r1, [r0, #MR3] - strh r1, [r0, #MR4] - - mov sp, #STACK_BASE - bl SP_INIT - mov r0, #10 - bl DELAY9 - bl GET_MAC_ADDR - bl GET_WHOLE_NVRAM - ldr r0, =MRBASE - ldr r1, =MAC_ADDRESS_MIB - strh r1, [r0, #MR2] - ldr r1, =NVRAM_IMAGE - strh r1, [r0, #MR4] - mov r1, #MAC_BOOT_FLAG - strh r1, [r0, #MR3] -HALT2: b HALT2 -.func Get_Whole_NVRAM, GET_WHOLE_NVRAM -GET_WHOLE_NVRAM: - stmdb sp!, {lr} - mov r2, #0 /* 0th bytes of NVRAM */ - mov r3, #NVRAM_LENGTH - mov r1, #0 /* not used in routine */ - ldr r0, =NVRAM_IMAGE - bl NVRAM_XFER - ldmia sp!, {lr} - bx lr -.endfunc - -.func Get_MAC_Addr, GET_MAC_ADDR -GET_MAC_ADDR: - stmdb sp!, {lr} - mov r2, #0x120 /* address of MAC Address within NVRAM */ - mov r3, #MAC_ADDRESS_LENGTH - mov r1, #0 /* not used in routine */ - ldr r0, =MAC_ADDRESS_MIB - bl NVRAM_XFER - ldmia sp!, {lr} - bx lr -.endfunc -.ltorg -.func Delay9, DELAY9 -DELAY9: - adds r0, r0, r0, LSL #3 /* r0 = r0 * 9 */ -DELAYLOOP: - beq DELAY9_done - subs r0, r0, #1 - b DELAYLOOP -DELAY9_done: - bx lr -.endfunc - -.func SP_Init, SP_INIT -SP_INIT: - mov r1, #SP_SWRST - ldr r0, =SP_BASE - str r1, [r0, #SP_CR] /* reset the SPI */ - mov r1, #0 - str r1, [r0, #SP_CR] /* release SPI from reset state */ - mov r1, #SP_SPIEN - str r1, [r0, #SP_MR] /* set the SPI to MASTER mode*/ - str r1, [r0, #SP_CR] /* enable the SPI */ - -/* My guess would be this turns on the SPI clock */ - ldr r3, =SPI_CGEN_BASE - ldr r1, [r3, #28] - orr r1, r1, #0x2000 - str r1, [r3, #28] - - ldr r1, =0x2000c01 - str r1, [r0, #SP_CSR0] - ldr r1, =0x2000201 - str r1, [r0, #SP_CSR1] - str r1, [r0, #SP_CSR2] - str r1, [r0, #SP_CSR3] - ldr r1, [r0, #SP_SR] - ldr r0, [r0, #SP_RDR] - bx lr -.endfunc -.func NVRAM_Init, NVRAM_INIT -NVRAM_INIT: - ldr r1, =SP_BASE - ldr r0, [r1, #SP_RDR] - mov r0, #NVRAM_CMD_RDSR - str r0, [r1, #SP_TDR] -SP_loop1: - ldr r0, [r1, #SP_SR] - tst r0, #SP_TDRE - beq SP_loop1 - - mov r0, #SPI_8CLOCKS - str r0, [r1, #SP_TDR] -SP_loop2: - ldr r0, [r1, #SP_SR] - tst r0, #SP_TDRE - beq SP_loop2 - - ldr r0, [r1, #SP_RDR] -SP_loop3: - ldr r0, [r1, #SP_SR] - tst r0, #SP_RDRF - beq SP_loop3 - - ldr r0, [r1, #SP_RDR] - and r0, r0, #255 - bx lr -.endfunc - -.func NVRAM_Xfer, NVRAM_XFER - /* r0 = dest address */ - /* r1 = not used */ - /* r2 = src address within NVRAM */ - /* r3 = length */ -NVRAM_XFER: - stmdb sp!, {r4, r5, lr} - mov r5, r0 /* save r0 (dest address) */ - mov r4, r3 /* save r3 (length) */ - mov r0, r2, LSR #5 /* SPI memories put A8 in the command field */ - and r0, r0, #8 - add r0, r0, #NVRAM_CMD_READ - ldr r1, =NVRAM_SCRATCH - strb r0, [r1, #0] /* save command in NVRAM_SCRATCH[0] */ - strb r2, [r1, #1] /* save low byte of source address in NVRAM_SCRATCH[1] */ -_local1: - bl NVRAM_INIT - tst r0, #NVRAM_SR_RDY - bne _local1 - mov r0, #20 - bl DELAY9 - mov r2, r4 /* length */ - mov r1, r5 /* dest address */ - mov r0, #2 /* bytes to transfer in command */ - bl NVRAM_XFER2 - ldmia sp!, {r4, r5, lr} - bx lr -.endfunc - -.func NVRAM_Xfer2, NVRAM_XFER2 -NVRAM_XFER2: - stmdb sp!, {r4, r5, r6, lr} - ldr r4, =SP_BASE - mov r3, #0 - cmp r0, #0 - bls _local2 - ldr r5, =NVRAM_SCRATCH -_local4: - ldrb r6, [r5, r3] - str r6, [r4, #SP_TDR] -_local3: - ldr r6, [r4, #SP_SR] - tst r6, #SP_TDRE - beq _local3 - add r3, r3, #1 - cmp r3, r0 /* r0 is # of bytes to send out (command+addr) */ - blo _local4 -_local2: - mov r3, #SPI_8CLOCKS - str r3, [r4, #SP_TDR] - ldr r0, [r4, #SP_RDR] -_local5: - ldr r0, [r4, #SP_SR] - tst r0, #SP_RDRF - beq _local5 - ldr r0, [r4, #SP_RDR] /* what's this byte? It's the byte read while writing the TDR -- nonsense, because the NVRAM doesn't read and write at the same time */ - mov r0, #0 - cmp r2, #0 /* r2 is # of bytes to copy in */ - bls _local6 -_local7: - ldr r5, [r4, #SP_SR] - tst r5, #SP_TDRE - beq _local7 - str r3, [r4, #SP_TDR] /* r3 has SPI_8CLOCKS */ -_local8: - ldr r5, [r4, #SP_SR] - tst r5, #SP_RDRF - beq _local8 - ldr r5, [r4, #SP_RDR] /* but didn't we read this byte above? */ - strb r5, [r1], #1 /* postindexed */ - add r0, r0, #1 - cmp r0, r2 - blo _local7 /* since we don't send another address, the NVRAM must be capable of sequential reads */ -_local6: - mov r0, #200 - bl DELAY9 - ldmia sp!, {r4, r5, r6, lr} - bx lr -#endif diff --git a/drivers/net/wireless/atmel.h b/drivers/net/wireless/atmel.h deleted file mode 100644 index b9b3e5b76544..000000000000 --- a/drivers/net/wireless/atmel.h +++ /dev/null @@ -1,43 +0,0 @@ -/*** -*- linux-c -*- ********************************************************** - - Driver for Atmel at76c502 at76c504 and at76c506 wireless cards. - - Copyright 2005 Dan Williams and Red Hat, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This software 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 Atmel wireless lan drivers; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -******************************************************************************/ - -#ifndef _ATMEL_H -#define _ATMEL_H - -typedef enum { - ATMEL_FW_TYPE_NONE = 0, - ATMEL_FW_TYPE_502, - ATMEL_FW_TYPE_502D, - ATMEL_FW_TYPE_502E, - ATMEL_FW_TYPE_502_3COM, - ATMEL_FW_TYPE_504, - ATMEL_FW_TYPE_504_2958, - ATMEL_FW_TYPE_504A_2958, - ATMEL_FW_TYPE_506 -} AtmelFWType; - -struct net_device *init_atmel_card(unsigned short, unsigned long, const AtmelFWType, struct device *, - int (*present_func)(void *), void * ); -void stop_atmel_card( struct net_device *); -int atmel_open( struct net_device * ); - -#endif diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c deleted file mode 100644 index 522572219217..000000000000 --- a/drivers/net/wireless/atmel_cs.c +++ /dev/null @@ -1,287 +0,0 @@ -/*** -*- linux-c -*- ********************************************************** - - Driver for Atmel at76c502 at76c504 and at76c506 wireless cards. - - Copyright 2000-2001 ATMEL Corporation. - Copyright 2003 Simon Kelley. - - This code was developed from version 2.1.1 of the Atmel drivers, - released by Atmel corp. under the GPL in December 2002. It also - includes code from the Linux aironet drivers (C) Benjamin Reed, - and the Linux PCMCIA package, (C) David Hinds. - - For all queries about this code, please contact the current author, - Simon Kelley and not Atmel Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This software 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 Atmel wireless lan drivers; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -******************************************************************************/ - -#ifdef __IN_PCMCIA_PACKAGE__ -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include "atmel.h" - - -/*====================================================================*/ - -MODULE_AUTHOR("Simon Kelley"); -MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); -MODULE_LICENSE("GPL"); -MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards"); - -/*====================================================================*/ - -static int atmel_config(struct pcmcia_device *link); -static void atmel_release(struct pcmcia_device *link); - -static void atmel_detach(struct pcmcia_device *p_dev); - -typedef struct local_info_t { - struct net_device *eth_dev; -} local_info_t; - -static int atmel_probe(struct pcmcia_device *p_dev) -{ - local_info_t *local; - - dev_dbg(&p_dev->dev, "atmel_attach()\n"); - - /* Allocate space for private device-specific data */ - local = kzalloc(sizeof(local_info_t), GFP_KERNEL); - if (!local) - return -ENOMEM; - - p_dev->priv = local; - - return atmel_config(p_dev); -} /* atmel_attach */ - -static void atmel_detach(struct pcmcia_device *link) -{ - dev_dbg(&link->dev, "atmel_detach\n"); - - atmel_release(link); - - kfree(link->priv); -} - -/* Call-back function to interrogate PCMCIA-specific information - about the current existence of the card */ -static int card_present(void *arg) -{ - struct pcmcia_device *link = (struct pcmcia_device *)arg; - - if (pcmcia_dev_present(link)) - return 1; - - return 0; -} - -static int atmel_config_check(struct pcmcia_device *p_dev, void *priv_data) -{ - if (p_dev->config_index == 0) - return -EINVAL; - - return pcmcia_request_io(p_dev); -} - -static int atmel_config(struct pcmcia_device *link) -{ - local_info_t *dev; - int ret; - const struct pcmcia_device_id *did; - - dev = link->priv; - did = dev_get_drvdata(&link->dev); - - dev_dbg(&link->dev, "atmel_config\n"); - - link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | - CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; - - if (pcmcia_loop_config(link, atmel_config_check, NULL)) - goto failed; - - if (!link->irq) { - dev_err(&link->dev, "atmel: cannot assign IRQ: check that CONFIG_ISA is set in kernel config."); - goto failed; - } - - ret = pcmcia_enable_device(link); - if (ret) - goto failed; - - ((local_info_t*)link->priv)->eth_dev = - init_atmel_card(link->irq, - link->resource[0]->start, - did ? did->driver_info : ATMEL_FW_TYPE_NONE, - &link->dev, - card_present, - link); - if (!((local_info_t*)link->priv)->eth_dev) - goto failed; - - - return 0; - - failed: - atmel_release(link); - return -ENODEV; -} - -static void atmel_release(struct pcmcia_device *link) -{ - struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; - - dev_dbg(&link->dev, "atmel_release\n"); - - if (dev) - stop_atmel_card(dev); - ((local_info_t*)link->priv)->eth_dev = NULL; - - pcmcia_disable_device(link); -} - -static int atmel_suspend(struct pcmcia_device *link) -{ - local_info_t *local = link->priv; - - netif_device_detach(local->eth_dev); - - return 0; -} - -static int atmel_resume(struct pcmcia_device *link) -{ - local_info_t *local = link->priv; - - atmel_open(local->eth_dev); - netif_device_attach(local->eth_dev); - - return 0; -} - -/*====================================================================*/ -/* We use the driver_info field to store the correct firmware type for a card. */ - -#define PCMCIA_DEVICE_MANF_CARD_INFO(manf, card, info) { \ - .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ - PCMCIA_DEV_ID_MATCH_CARD_ID, \ - .manf_id = (manf), \ - .card_id = (card), \ - .driver_info = (kernel_ulong_t)(info), } - -#define PCMCIA_DEVICE_PROD_ID12_INFO(v1, v2, vh1, vh2, info) { \ - .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ - PCMCIA_DEV_ID_MATCH_PROD_ID2, \ - .prod_id = { (v1), (v2), NULL, NULL }, \ - .prod_id_hash = { (vh1), (vh2), 0, 0 }, \ - .driver_info = (kernel_ulong_t)(info), } - -static const struct pcmcia_device_id atmel_ids[] = { - PCMCIA_DEVICE_MANF_CARD_INFO(0x0101, 0x0620, ATMEL_FW_TYPE_502_3COM), - PCMCIA_DEVICE_MANF_CARD_INFO(0x0101, 0x0696, ATMEL_FW_TYPE_502_3COM), - PCMCIA_DEVICE_MANF_CARD_INFO(0x01bf, 0x3302, ATMEL_FW_TYPE_502E), - PCMCIA_DEVICE_MANF_CARD_INFO(0xd601, 0x0007, ATMEL_FW_TYPE_502), - PCMCIA_DEVICE_PROD_ID12_INFO("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9, ATMEL_FW_TYPE_502E), - PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f, ATMEL_FW_TYPE_502), - PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR_D", 0xabda4164, 0x3675d704, ATMEL_FW_TYPE_502D), - PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR_E", 0xabda4164, 0x4172e792, ATMEL_FW_TYPE_502E), - PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504_R", 0xabda4164, 0x917f3d72, ATMEL_FW_TYPE_504_2958), - PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504", 0xabda4164, 0x5040670a, ATMEL_FW_TYPE_504), - PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f, ATMEL_FW_TYPE_504A_2958), - PCMCIA_DEVICE_PROD_ID12_INFO("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5, ATMEL_FW_TYPE_502), - PCMCIA_DEVICE_PROD_ID12_INFO("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b, ATMEL_FW_TYPE_502E), - PCMCIA_DEVICE_PROD_ID12_INFO("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6, ATMEL_FW_TYPE_502), - PCMCIA_DEVICE_PROD_ID12_INFO("IEEE 802.11b", "Wireless LAN Card S", 0x5b878724, 0x5fba533a, ATMEL_FW_TYPE_504_2958), - PCMCIA_DEVICE_PROD_ID12_INFO("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68, ATMEL_FW_TYPE_502), - PCMCIA_DEVICE_PROD_ID12_INFO("SMC", "2632W", 0xc4f8b18b, 0x30f38774, ATMEL_FW_TYPE_502D), - PCMCIA_DEVICE_PROD_ID12_INFO("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377, ATMEL_FW_TYPE_502), - PCMCIA_DEVICE_PROD_ID12_INFO("Wireless", "PC_CARD", 0xa407ecdd, 0x119f6314, ATMEL_FW_TYPE_502D), - PCMCIA_DEVICE_PROD_ID12_INFO("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4, ATMEL_FW_TYPE_502D), - PCMCIA_DEVICE_PROD_ID12_INFO("LG", "LW2100N", 0xb474d43a, 0x6b1fec94, ATMEL_FW_TYPE_502E), - PCMCIA_DEVICE_NULL -}; - -MODULE_DEVICE_TABLE(pcmcia, atmel_ids); - -static struct pcmcia_driver atmel_driver = { - .owner = THIS_MODULE, - .name = "atmel_cs", - .probe = atmel_probe, - .remove = atmel_detach, - .id_table = atmel_ids, - .suspend = atmel_suspend, - .resume = atmel_resume, -}; -module_pcmcia_driver(atmel_driver); - -/* - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - In addition: - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ diff --git a/drivers/net/wireless/atmel_pci.c b/drivers/net/wireless/atmel_pci.c deleted file mode 100644 index c1b159ebcffe..000000000000 --- a/drivers/net/wireless/atmel_pci.c +++ /dev/null @@ -1,77 +0,0 @@ -/*** -*- linux-c -*- ********************************************************** - - Driver for Atmel at76c502 at76c504 and at76c506 wireless cards. - - Copyright 2004 Simon Kelley. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This software 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 Atmel wireless lan drivers; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -******************************************************************************/ -#include -#include -#include -#include -#include -#include "atmel.h" - -MODULE_AUTHOR("Simon Kelley"); -MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards."); -MODULE_LICENSE("GPL"); -MODULE_SUPPORTED_DEVICE("Atmel at76c506 PCI wireless cards"); - -static DEFINE_PCI_DEVICE_TABLE(card_ids) = { - { 0x1114, 0x0506, PCI_ANY_ID, PCI_ANY_ID }, - { 0, } -}; - -MODULE_DEVICE_TABLE(pci, card_ids); - -static int atmel_pci_probe(struct pci_dev *, const struct pci_device_id *); -static void atmel_pci_remove(struct pci_dev *); - -static struct pci_driver atmel_driver = { - .name = "atmel", - .id_table = card_ids, - .probe = atmel_pci_probe, - .remove = atmel_pci_remove, -}; - - -static int atmel_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *pent) -{ - struct net_device *dev; - - if (pci_enable_device(pdev)) - return -ENODEV; - - pci_set_master(pdev); - - dev = init_atmel_card(pdev->irq, pdev->resource[1].start, - ATMEL_FW_TYPE_506, - &pdev->dev, NULL, NULL); - if (!dev) - return -ENODEV; - - pci_set_drvdata(pdev, dev); - return 0; -} - -static void atmel_pci_remove(struct pci_dev *pdev) -{ - stop_atmel_card(pci_get_drvdata(pdev)); -} - -module_pci_driver(atmel_driver); diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig deleted file mode 100644 index 13f91ac9499e..000000000000 --- a/drivers/net/wireless/b43/Kconfig +++ /dev/null @@ -1,177 +0,0 @@ -config B43 - tristate "Broadcom 43xx wireless support (mac80211 stack)" - depends on SSB_POSSIBLE && MAC80211 && HAS_DMA - select SSB - select FW_LOADER - ---help--- - b43 is a driver for the Broadcom 43xx series wireless devices. - - Check "lspci" for something like - "Broadcom Corporation BCM43XX 802.11 Wireless LAN Controller" - to determine whether you own such a device. - - This driver supports the new BCM43xx IEEE 802.11G devices, but not - the old IEEE 802.11B devices. Old devices are supported by - the b43legacy driver. - Note that this has nothing to do with the standard that your AccessPoint - supports (A, B, G or a combination). - IEEE 802.11G devices can talk to IEEE 802.11B AccessPoints. - - It is safe to include both b43 and b43legacy as the underlying glue - layer will automatically load the correct version for your device. - - This driver uses V4 firmware, which must be installed separately using - b43-fwcutter. - - This driver can be built as a module (recommended) that will be called "b43". - If unsure, say M. - -config B43_BCMA - bool "Support for BCMA bus" - depends on B43 && (BCMA = y || BCMA = B43) - default y - -config B43_BCMA_EXTRA - bool "Hardware support that overlaps with the brcmsmac driver" - depends on B43_BCMA - default n if BRCMSMAC - default y - -config B43_SSB - bool - depends on B43 && (SSB = y || SSB = B43) - default y - -# Auto-select SSB PCI-HOST support, if possible -config B43_PCI_AUTOSELECT - bool - depends on B43 && SSB_PCIHOST_POSSIBLE - select SSB_PCIHOST - select SSB_B43_PCI_BRIDGE - default y - -# Auto-select SSB PCICORE driver, if possible -config B43_PCICORE_AUTOSELECT - bool - depends on B43 && SSB_DRIVER_PCICORE_POSSIBLE - select SSB_DRIVER_PCICORE - default y - -config B43_PCMCIA - bool "Broadcom 43xx PCMCIA device support" - depends on B43 && SSB_PCMCIAHOST_POSSIBLE - select SSB_PCMCIAHOST - ---help--- - Broadcom 43xx PCMCIA device support. - - Support for 16bit PCMCIA devices. - Please note that most PC-CARD devices are _NOT_ 16bit PCMCIA - devices, but 32bit CardBUS devices. CardBUS devices are supported - out of the box by b43. - - With this config option you can drive b43 cards in - CompactFlash formfactor in a PCMCIA adaptor. - CF b43 cards can sometimes be found in handheld PCs. - - It's safe to select Y here, even if you don't have a B43 PCMCIA device. - - If unsure, say N. - -config B43_SDIO - bool "Broadcom 43xx SDIO device support" - depends on B43 && SSB_SDIOHOST_POSSIBLE - select SSB_SDIOHOST - ---help--- - Broadcom 43xx device support for Soft-MAC SDIO devices. - - With this config option you can drive Soft-MAC b43 cards with a - Secure Digital I/O interface. - This includes the WLAN daughter card found on the Nintendo Wii - video game console. - Note that this does not support Broadcom 43xx Full-MAC devices. - - It's safe to select Y here, even if you don't have a B43 SDIO device. - - If unsure, say N. - -#Data transfers to the device via PIO. We want it as a fallback even -# if we can do DMA. -config B43_BCMA_PIO - bool - depends on B43_BCMA - select BCMA_BLOCKIO - default y - -config B43_PIO - bool - depends on B43 - select SSB_BLOCKIO - default y - -config B43_PHY_N - bool "Support for 802.11n (N-PHY) devices" - depends on B43 - ---help--- - Support for the N-PHY. - - This enables support for devices with N-PHY. - - Say N if you expect high stability and performance. Saying Y will not - affect other devices support and may provide support for basic needs. - -config B43_PHY_LP - bool "Support for low-power (LP-PHY) devices" - depends on B43 - default y - ---help--- - Support for the LP-PHY. - The LP-PHY is a low-power PHY built into some notebooks - and embedded devices. It supports 802.11a/b/g - (802.11a support is optional, and currently disabled). - -config B43_PHY_HT - bool "Support for HT-PHY (high throughput) devices" - depends on B43 && B43_BCMA - ---help--- - Support for the HT-PHY. - - Enables support for BCM4331 and possibly other chipsets with that PHY. - -config B43_PHY_LCN - bool "Support for LCN-PHY devices (BROKEN)" - depends on B43 && BROKEN - ---help--- - Support for the LCN-PHY. - - Say N, this is BROKEN and crashes driver. - -# This config option automatically enables b43 LEDS support, -# if it's possible. -config B43_LEDS - bool - depends on B43 && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = B43) - default y - -# This config option automatically enables b43 HW-RNG support, -# if the HW-RNG core is enabled. -config B43_HWRNG - bool - depends on B43 && (HW_RANDOM = y || HW_RANDOM = B43) - default y - -config B43_DEBUG - bool "Broadcom 43xx debugging" - depends on B43 - ---help--- - Broadcom 43xx debugging. - - This adds additional runtime sanity checks and statistics to the driver. - These checks and statistics might be expensive and hurt the runtime - performance of your system. - This also adds the b43 debugfs interface. - - Do not enable this, unless you are debugging the driver. - - Say N, if you are a distributor or user building a release kernel - for production use. - Only say Y, if you are debugging a problem in the b43 driver sourcecode. diff --git a/drivers/net/wireless/b43/Makefile b/drivers/net/wireless/b43/Makefile deleted file mode 100644 index 098fe9ee7096..000000000000 --- a/drivers/net/wireless/b43/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -b43-y += main.o -b43-y += bus.o -b43-y += tables.o -b43-$(CONFIG_B43_PHY_N) += tables_nphy.o -b43-$(CONFIG_B43_PHY_N) += radio_2055.o -b43-$(CONFIG_B43_PHY_N) += radio_2056.o -b43-$(CONFIG_B43_PHY_N) += radio_2057.o -b43-y += phy_common.o -b43-y += phy_g.o -b43-y += phy_a.o -b43-$(CONFIG_B43_PHY_N) += phy_n.o -b43-$(CONFIG_B43_PHY_LP) += phy_lp.o -b43-$(CONFIG_B43_PHY_LP) += tables_lpphy.o -b43-$(CONFIG_B43_PHY_HT) += phy_ht.o -b43-$(CONFIG_B43_PHY_HT) += tables_phy_ht.o -b43-$(CONFIG_B43_PHY_HT) += radio_2059.o -b43-$(CONFIG_B43_PHY_LCN) += phy_lcn.o tables_phy_lcn.o -b43-y += sysfs.o -b43-y += xmit.o -b43-y += lo.o -b43-y += wa.o -b43-y += dma.o -b43-y += pio.o -b43-y += rfkill.o -b43-$(CONFIG_B43_LEDS) += leds.o -b43-$(CONFIG_B43_PCMCIA) += pcmcia.o -b43-$(CONFIG_B43_SDIO) += sdio.o -b43-$(CONFIG_B43_DEBUG) += debugfs.o - -obj-$(CONFIG_B43) += b43.o diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h deleted file mode 100644 index 7f3d461f7e8d..000000000000 --- a/drivers/net/wireless/b43/b43.h +++ /dev/null @@ -1,1082 +0,0 @@ -#ifndef B43_H_ -#define B43_H_ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "debugfs.h" -#include "leds.h" -#include "rfkill.h" -#include "bus.h" -#include "lo.h" -#include "phy_common.h" - - -#ifdef CONFIG_B43_DEBUG -# define B43_DEBUG 1 -#else -# define B43_DEBUG 0 -#endif - -/* MMIO offsets */ -#define B43_MMIO_DMA0_REASON 0x20 -#define B43_MMIO_DMA0_IRQ_MASK 0x24 -#define B43_MMIO_DMA1_REASON 0x28 -#define B43_MMIO_DMA1_IRQ_MASK 0x2C -#define B43_MMIO_DMA2_REASON 0x30 -#define B43_MMIO_DMA2_IRQ_MASK 0x34 -#define B43_MMIO_DMA3_REASON 0x38 -#define B43_MMIO_DMA3_IRQ_MASK 0x3C -#define B43_MMIO_DMA4_REASON 0x40 -#define B43_MMIO_DMA4_IRQ_MASK 0x44 -#define B43_MMIO_DMA5_REASON 0x48 -#define B43_MMIO_DMA5_IRQ_MASK 0x4C -#define B43_MMIO_MACCTL 0x120 /* MAC control */ -#define B43_MMIO_MACCMD 0x124 /* MAC command */ -#define B43_MMIO_GEN_IRQ_REASON 0x128 -#define B43_MMIO_GEN_IRQ_MASK 0x12C -#define B43_MMIO_RAM_CONTROL 0x130 -#define B43_MMIO_RAM_DATA 0x134 -#define B43_MMIO_PS_STATUS 0x140 -#define B43_MMIO_RADIO_HWENABLED_HI 0x158 -#define B43_MMIO_SHM_CONTROL 0x160 -#define B43_MMIO_SHM_DATA 0x164 -#define B43_MMIO_SHM_DATA_UNALIGNED 0x166 -#define B43_MMIO_XMITSTAT_0 0x170 -#define B43_MMIO_XMITSTAT_1 0x174 -#define B43_MMIO_REV3PLUS_TSF_LOW 0x180 /* core rev >= 3 only */ -#define B43_MMIO_REV3PLUS_TSF_HIGH 0x184 /* core rev >= 3 only */ -#define B43_MMIO_TSF_CFP_REP 0x188 -#define B43_MMIO_TSF_CFP_START 0x18C -#define B43_MMIO_TSF_CFP_MAXDUR 0x190 - -/* 32-bit DMA */ -#define B43_MMIO_DMA32_BASE0 0x200 -#define B43_MMIO_DMA32_BASE1 0x220 -#define B43_MMIO_DMA32_BASE2 0x240 -#define B43_MMIO_DMA32_BASE3 0x260 -#define B43_MMIO_DMA32_BASE4 0x280 -#define B43_MMIO_DMA32_BASE5 0x2A0 -/* 64-bit DMA */ -#define B43_MMIO_DMA64_BASE0 0x200 -#define B43_MMIO_DMA64_BASE1 0x240 -#define B43_MMIO_DMA64_BASE2 0x280 -#define B43_MMIO_DMA64_BASE3 0x2C0 -#define B43_MMIO_DMA64_BASE4 0x300 -#define B43_MMIO_DMA64_BASE5 0x340 - -/* PIO on core rev < 11 */ -#define B43_MMIO_PIO_BASE0 0x300 -#define B43_MMIO_PIO_BASE1 0x310 -#define B43_MMIO_PIO_BASE2 0x320 -#define B43_MMIO_PIO_BASE3 0x330 -#define B43_MMIO_PIO_BASE4 0x340 -#define B43_MMIO_PIO_BASE5 0x350 -#define B43_MMIO_PIO_BASE6 0x360 -#define B43_MMIO_PIO_BASE7 0x370 -/* PIO on core rev >= 11 */ -#define B43_MMIO_PIO11_BASE0 0x200 -#define B43_MMIO_PIO11_BASE1 0x240 -#define B43_MMIO_PIO11_BASE2 0x280 -#define B43_MMIO_PIO11_BASE3 0x2C0 -#define B43_MMIO_PIO11_BASE4 0x300 -#define B43_MMIO_PIO11_BASE5 0x340 - -#define B43_MMIO_RADIO24_CONTROL 0x3D8 /* core rev >= 24 only */ -#define B43_MMIO_RADIO24_DATA 0x3DA /* core rev >= 24 only */ -#define B43_MMIO_PHY_VER 0x3E0 -#define B43_MMIO_PHY_RADIO 0x3E2 -#define B43_MMIO_PHY0 0x3E6 -#define B43_MMIO_ANTENNA 0x3E8 -#define B43_MMIO_CHANNEL 0x3F0 -#define B43_MMIO_CHANNEL_EXT 0x3F4 -#define B43_MMIO_RADIO_CONTROL 0x3F6 -#define B43_MMIO_RADIO_DATA_HIGH 0x3F8 -#define B43_MMIO_RADIO_DATA_LOW 0x3FA -#define B43_MMIO_PHY_CONTROL 0x3FC -#define B43_MMIO_PHY_DATA 0x3FE -#define B43_MMIO_MACFILTER_CONTROL 0x420 -#define B43_MMIO_MACFILTER_DATA 0x422 -#define B43_MMIO_RCMTA_COUNT 0x43C -#define B43_MMIO_PSM_PHY_HDR 0x492 -#define B43_MMIO_RADIO_HWENABLED_LO 0x49A -#define B43_MMIO_GPIO_CONTROL 0x49C -#define B43_MMIO_GPIO_MASK 0x49E -#define B43_MMIO_TXE0_CTL 0x500 -#define B43_MMIO_TXE0_AUX 0x502 -#define B43_MMIO_TXE0_TS_LOC 0x504 -#define B43_MMIO_TXE0_TIME_OUT 0x506 -#define B43_MMIO_TXE0_WM_0 0x508 -#define B43_MMIO_TXE0_WM_1 0x50A -#define B43_MMIO_TXE0_PHYCTL 0x50C -#define B43_MMIO_TXE0_STATUS 0x50E -#define B43_MMIO_TXE0_MMPLCP0 0x510 -#define B43_MMIO_TXE0_MMPLCP1 0x512 -#define B43_MMIO_TXE0_PHYCTL1 0x514 -#define B43_MMIO_XMTFIFODEF 0x520 -#define B43_MMIO_XMTFIFO_FRAME_CNT 0x522 /* core rev>= 16 only */ -#define B43_MMIO_XMTFIFO_BYTE_CNT 0x524 /* core rev>= 16 only */ -#define B43_MMIO_XMTFIFO_HEAD 0x526 /* core rev>= 16 only */ -#define B43_MMIO_XMTFIFO_RD_PTR 0x528 /* core rev>= 16 only */ -#define B43_MMIO_XMTFIFO_WR_PTR 0x52A /* core rev>= 16 only */ -#define B43_MMIO_XMTFIFODEF1 0x52C /* core rev>= 16 only */ -#define B43_MMIO_XMTFIFOCMD 0x540 -#define B43_MMIO_XMTFIFOFLUSH 0x542 -#define B43_MMIO_XMTFIFOTHRESH 0x544 -#define B43_MMIO_XMTFIFORDY 0x546 -#define B43_MMIO_XMTFIFOPRIRDY 0x548 -#define B43_MMIO_XMTFIFORQPRI 0x54A -#define B43_MMIO_XMTTPLATETXPTR 0x54C -#define B43_MMIO_XMTTPLATEPTR 0x550 -#define B43_MMIO_SMPL_CLCT_STRPTR 0x552 /* core rev>= 22 only */ -#define B43_MMIO_SMPL_CLCT_STPPTR 0x554 /* core rev>= 22 only */ -#define B43_MMIO_SMPL_CLCT_CURPTR 0x556 /* core rev>= 22 only */ -#define B43_MMIO_XMTTPLATEDATALO 0x560 -#define B43_MMIO_XMTTPLATEDATAHI 0x562 -#define B43_MMIO_XMTSEL 0x568 -#define B43_MMIO_XMTTXCNT 0x56A -#define B43_MMIO_XMTTXSHMADDR 0x56C -#define B43_MMIO_TSF_CFP_START_LOW 0x604 -#define B43_MMIO_TSF_CFP_START_HIGH 0x606 -#define B43_MMIO_TSF_CFP_PRETBTT 0x612 -#define B43_MMIO_TSF_CLK_FRAC_LOW 0x62E -#define B43_MMIO_TSF_CLK_FRAC_HIGH 0x630 -#define B43_MMIO_TSF_0 0x632 /* core rev < 3 only */ -#define B43_MMIO_TSF_1 0x634 /* core rev < 3 only */ -#define B43_MMIO_TSF_2 0x636 /* core rev < 3 only */ -#define B43_MMIO_TSF_3 0x638 /* core rev < 3 only */ -#define B43_MMIO_RNG 0x65A -#define B43_MMIO_IFSSLOT 0x684 /* Interframe slot time */ -#define B43_MMIO_IFSCTL 0x688 /* Interframe space control */ -#define B43_MMIO_IFSSTAT 0x690 -#define B43_MMIO_IFSMEDBUSYCTL 0x692 -#define B43_MMIO_IFTXDUR 0x694 -#define B43_MMIO_IFSCTL_USE_EDCF 0x0004 -#define B43_MMIO_POWERUP_DELAY 0x6A8 -#define B43_MMIO_BTCOEX_CTL 0x6B4 /* Bluetooth Coexistence Control */ -#define B43_MMIO_BTCOEX_STAT 0x6B6 /* Bluetooth Coexistence Status */ -#define B43_MMIO_BTCOEX_TXCTL 0x6B8 /* Bluetooth Coexistence Transmit Control */ -#define B43_MMIO_WEPCTL 0x7C0 - -/* SPROM boardflags_lo values */ -#define B43_BFL_BTCOEXIST 0x0001 /* implements Bluetooth coexistance */ -#define B43_BFL_PACTRL 0x0002 /* GPIO 9 controlling the PA */ -#define B43_BFL_AIRLINEMODE 0x0004 /* implements GPIO 13 radio disable indication */ -#define B43_BFL_RSSI 0x0008 /* software calculates nrssi slope. */ -#define B43_BFL_ENETSPI 0x0010 /* has ephy roboswitch spi */ -#define B43_BFL_XTAL_NOSLOW 0x0020 /* no slow clock available */ -#define B43_BFL_CCKHIPWR 0x0040 /* can do high power CCK transmission */ -#define B43_BFL_ENETADM 0x0080 /* has ADMtek switch */ -#define B43_BFL_ENETVLAN 0x0100 /* can do vlan */ -#define B43_BFL_AFTERBURNER 0x0200 /* supports Afterburner mode */ -#define B43_BFL_NOPCI 0x0400 /* leaves PCI floating */ -#define B43_BFL_FEM 0x0800 /* supports the Front End Module */ -#define B43_BFL_EXTLNA 0x1000 /* has an external LNA */ -#define B43_BFL_HGPA 0x2000 /* had high gain PA */ -#define B43_BFL_BTCMOD 0x4000 /* BFL_BTCOEXIST is given in alternate GPIOs */ -#define B43_BFL_ALTIQ 0x8000 /* alternate I/Q settings */ - -/* SPROM boardflags_hi values */ -#define B43_BFH_NOPA 0x0001 /* has no PA */ -#define B43_BFH_RSSIINV 0x0002 /* RSSI uses positive slope (not TSSI) */ -#define B43_BFH_PAREF 0x0004 /* uses the PARef LDO */ -#define B43_BFH_3TSWITCH 0x0008 /* uses a triple throw switch shared - * with bluetooth */ -#define B43_BFH_PHASESHIFT 0x0010 /* can support phase shifter */ -#define B43_BFH_BUCKBOOST 0x0020 /* has buck/booster */ -#define B43_BFH_FEM_BT 0x0040 /* has FEM and switch to share antenna - * with bluetooth */ -#define B43_BFH_NOCBUCK 0x0080 -#define B43_BFH_PALDO 0x0200 -#define B43_BFH_EXTLNA_5GHZ 0x1000 /* has an external LNA (5GHz mode) */ - -/* SPROM boardflags2_lo values */ -#define B43_BFL2_RXBB_INT_REG_DIS 0x0001 /* external RX BB regulator present */ -#define B43_BFL2_APLL_WAR 0x0002 /* alternative A-band PLL settings implemented */ -#define B43_BFL2_TXPWRCTRL_EN 0x0004 /* permits enabling TX Power Control */ -#define B43_BFL2_2X4_DIV 0x0008 /* 2x4 diversity switch */ -#define B43_BFL2_5G_PWRGAIN 0x0010 /* supports 5G band power gain */ -#define B43_BFL2_PCIEWAR_OVR 0x0020 /* overrides ASPM and Clkreq settings */ -#define B43_BFL2_CAESERS_BRD 0x0040 /* is Caesers board (unused) */ -#define B43_BFL2_BTC3WIRE 0x0080 /* used 3-wire bluetooth coexist */ -#define B43_BFL2_SKWRKFEM_BRD 0x0100 /* 4321mcm93 uses Skyworks FEM */ -#define B43_BFL2_SPUR_WAR 0x0200 /* has a workaround for clock-harmonic spurs */ -#define B43_BFL2_GPLL_WAR 0x0400 /* altenative G-band PLL settings implemented */ -#define B43_BFL2_SINGLEANT_CCK 0x1000 -#define B43_BFL2_2G_SPUR_WAR 0x2000 - -/* SPROM boardflags2_hi values */ -#define B43_BFH2_GPLL_WAR2 0x0001 -#define B43_BFH2_IPALVLSHIFT_3P3 0x0002 -#define B43_BFH2_INTERNDET_TXIQCAL 0x0004 -#define B43_BFH2_XTALBUFOUTEN 0x0008 - -/* GPIO register offset, in both ChipCommon and PCI core. */ -#define B43_GPIO_CONTROL 0x6c - -/* SHM Routing */ -enum { - B43_SHM_UCODE, /* Microcode memory */ - B43_SHM_SHARED, /* Shared memory */ - B43_SHM_SCRATCH, /* Scratch memory */ - B43_SHM_HW, /* Internal hardware register */ - B43_SHM_RCMTA, /* Receive match transmitter address (rev >= 5 only) */ -}; -/* SHM Routing modifiers */ -#define B43_SHM_AUTOINC_R 0x0200 /* Auto-increment address on read */ -#define B43_SHM_AUTOINC_W 0x0100 /* Auto-increment address on write */ -#define B43_SHM_AUTOINC_RW (B43_SHM_AUTOINC_R | \ - B43_SHM_AUTOINC_W) - -/* Misc SHM_SHARED offsets */ -#define B43_SHM_SH_WLCOREREV 0x0016 /* 802.11 core revision */ -#define B43_SHM_SH_PCTLWDPOS 0x0008 -#define B43_SHM_SH_RXPADOFF 0x0034 /* RX Padding data offset (PIO only) */ -#define B43_SHM_SH_FWCAPA 0x0042 /* Firmware capabilities (Opensource firmware only) */ -#define B43_SHM_SH_PHYVER 0x0050 /* PHY version */ -#define B43_SHM_SH_PHYTYPE 0x0052 /* PHY type */ -#define B43_SHM_SH_ANTSWAP 0x005C /* Antenna swap threshold */ -#define B43_SHM_SH_HOSTF1 0x005E /* Hostflags 1 for ucode options */ -#define B43_SHM_SH_HOSTF2 0x0060 /* Hostflags 2 for ucode options */ -#define B43_SHM_SH_HOSTF3 0x0062 /* Hostflags 3 for ucode options */ -#define B43_SHM_SH_RFATT 0x0064 /* Current radio attenuation value */ -#define B43_SHM_SH_RADAR 0x0066 /* Radar register */ -#define B43_SHM_SH_PHYTXNOI 0x006E /* PHY noise directly after TX (lower 8bit only) */ -#define B43_SHM_SH_RFRXSP1 0x0072 /* RF RX SP Register 1 */ -#define B43_SHM_SH_HOSTF4 0x0078 /* Hostflags 4 for ucode options */ -#define B43_SHM_SH_CHAN 0x00A0 /* Current channel (low 8bit only) */ -#define B43_SHM_SH_CHAN_5GHZ 0x0100 /* Bit set, if 5 Ghz channel */ -#define B43_SHM_SH_CHAN_40MHZ 0x0200 /* Bit set, if 40 Mhz channel width */ -#define B43_SHM_SH_HOSTF5 0x00D4 /* Hostflags 5 for ucode options */ -#define B43_SHM_SH_BCMCFIFOID 0x0108 /* Last posted cookie to the bcast/mcast FIFO */ -/* TSSI information */ -#define B43_SHM_SH_TSSI_CCK 0x0058 /* TSSI for last 4 CCK frames (32bit) */ -#define B43_SHM_SH_TSSI_OFDM_A 0x0068 /* TSSI for last 4 OFDM frames (32bit) */ -#define B43_SHM_SH_TSSI_OFDM_G 0x0070 /* TSSI for last 4 OFDM frames (32bit) */ -#define B43_TSSI_MAX 0x7F /* Max value for one TSSI value */ -/* SHM_SHARED TX FIFO variables */ -#define B43_SHM_SH_SIZE01 0x0098 /* TX FIFO size for FIFO 0 (low) and 1 (high) */ -#define B43_SHM_SH_SIZE23 0x009A /* TX FIFO size for FIFO 2 and 3 */ -#define B43_SHM_SH_SIZE45 0x009C /* TX FIFO size for FIFO 4 and 5 */ -#define B43_SHM_SH_SIZE67 0x009E /* TX FIFO size for FIFO 6 and 7 */ -/* SHM_SHARED background noise */ -#define B43_SHM_SH_JSSI0 0x0088 /* Measure JSSI 0 */ -#define B43_SHM_SH_JSSI1 0x008A /* Measure JSSI 1 */ -#define B43_SHM_SH_JSSIAUX 0x008C /* Measure JSSI AUX */ -/* SHM_SHARED crypto engine */ -#define B43_SHM_SH_DEFAULTIV 0x003C /* Default IV location */ -#define B43_SHM_SH_NRRXTRANS 0x003E /* # of soft RX transmitter addresses (max 8) */ -#define B43_SHM_SH_KTP 0x0056 /* Key table pointer */ -#define B43_SHM_SH_TKIPTSCTTAK 0x0318 -#define B43_SHM_SH_KEYIDXBLOCK 0x05D4 /* Key index/algorithm block (v4 firmware) */ -#define B43_SHM_SH_PSM 0x05F4 /* PSM transmitter address match block (rev < 5) */ -/* SHM_SHARED WME variables */ -#define B43_SHM_SH_EDCFSTAT 0x000E /* EDCF status */ -#define B43_SHM_SH_TXFCUR 0x0030 /* TXF current index */ -#define B43_SHM_SH_EDCFQ 0x0240 /* EDCF Q info */ -/* SHM_SHARED powersave mode related */ -#define B43_SHM_SH_SLOTT 0x0010 /* Slot time */ -#define B43_SHM_SH_DTIMPER 0x0012 /* DTIM period */ -#define B43_SHM_SH_NOSLPZNATDTIM 0x004C /* NOSLPZNAT DTIM */ -/* SHM_SHARED beacon/AP variables */ -#define B43_SHM_SH_BT_BASE0 0x0068 /* Beacon template base 0 */ -#define B43_SHM_SH_BTL0 0x0018 /* Beacon template length 0 */ -#define B43_SHM_SH_BT_BASE1 0x0468 /* Beacon template base 1 */ -#define B43_SHM_SH_BTL1 0x001A /* Beacon template length 1 */ -#define B43_SHM_SH_BTSFOFF 0x001C /* Beacon TSF offset */ -#define B43_SHM_SH_TIMBPOS 0x001E /* TIM B position in beacon */ -#define B43_SHM_SH_DTIMP 0x0012 /* DTIP period */ -#define B43_SHM_SH_MCASTCOOKIE 0x00A8 /* Last bcast/mcast frame ID */ -#define B43_SHM_SH_SFFBLIM 0x0044 /* Short frame fallback retry limit */ -#define B43_SHM_SH_LFFBLIM 0x0046 /* Long frame fallback retry limit */ -#define B43_SHM_SH_BEACPHYCTL 0x0054 /* Beacon PHY TX control word (see PHY TX control) */ -#define B43_SHM_SH_EXTNPHYCTL 0x00B0 /* Extended bytes for beacon PHY control (N) */ -/* SHM_SHARED ACK/CTS control */ -#define B43_SHM_SH_ACKCTSPHYCTL 0x0022 /* ACK/CTS PHY control word (see PHY TX control) */ -/* SHM_SHARED probe response variables */ -#define B43_SHM_SH_PRSSID 0x0160 /* Probe Response SSID */ -#define B43_SHM_SH_PRSSIDLEN 0x0048 /* Probe Response SSID length */ -#define B43_SHM_SH_PRTLEN 0x004A /* Probe Response template length */ -#define B43_SHM_SH_PRMAXTIME 0x0074 /* Probe Response max time */ -#define B43_SHM_SH_PRPHYCTL 0x0188 /* Probe Response PHY TX control word */ -/* SHM_SHARED rate tables */ -#define B43_SHM_SH_OFDMDIRECT 0x01C0 /* Pointer to OFDM direct map */ -#define B43_SHM_SH_OFDMBASIC 0x01E0 /* Pointer to OFDM basic rate map */ -#define B43_SHM_SH_CCKDIRECT 0x0200 /* Pointer to CCK direct map */ -#define B43_SHM_SH_CCKBASIC 0x0220 /* Pointer to CCK basic rate map */ -/* SHM_SHARED microcode soft registers */ -#define B43_SHM_SH_UCODEREV 0x0000 /* Microcode revision */ -#define B43_SHM_SH_UCODEPATCH 0x0002 /* Microcode patchlevel */ -#define B43_SHM_SH_UCODEDATE 0x0004 /* Microcode date */ -#define B43_SHM_SH_UCODETIME 0x0006 /* Microcode time */ -#define B43_SHM_SH_UCODESTAT 0x0040 /* Microcode debug status code */ -#define B43_SHM_SH_UCODESTAT_INVALID 0 -#define B43_SHM_SH_UCODESTAT_INIT 1 -#define B43_SHM_SH_UCODESTAT_ACTIVE 2 -#define B43_SHM_SH_UCODESTAT_SUSP 3 /* suspended */ -#define B43_SHM_SH_UCODESTAT_SLEEP 4 /* asleep (PS) */ -#define B43_SHM_SH_MAXBFRAMES 0x0080 /* Maximum number of frames in a burst */ -#define B43_SHM_SH_SPUWKUP 0x0094 /* pre-wakeup for synth PU in us */ -#define B43_SHM_SH_PRETBTT 0x0096 /* pre-TBTT in us */ -/* SHM_SHARED tx iq workarounds */ -#define B43_SHM_SH_NPHY_TXIQW0 0x0700 -#define B43_SHM_SH_NPHY_TXIQW1 0x0702 -#define B43_SHM_SH_NPHY_TXIQW2 0x0704 -#define B43_SHM_SH_NPHY_TXIQW3 0x0706 -/* SHM_SHARED tx pwr ctrl */ -#define B43_SHM_SH_NPHY_TXPWR_INDX0 0x0708 -#define B43_SHM_SH_NPHY_TXPWR_INDX1 0x070E - -/* SHM_SCRATCH offsets */ -#define B43_SHM_SC_MINCONT 0x0003 /* Minimum contention window */ -#define B43_SHM_SC_MAXCONT 0x0004 /* Maximum contention window */ -#define B43_SHM_SC_CURCONT 0x0005 /* Current contention window */ -#define B43_SHM_SC_SRLIMIT 0x0006 /* Short retry count limit */ -#define B43_SHM_SC_LRLIMIT 0x0007 /* Long retry count limit */ -#define B43_SHM_SC_DTIMC 0x0008 /* Current DTIM count */ -#define B43_SHM_SC_BTL0LEN 0x0015 /* Beacon 0 template length */ -#define B43_SHM_SC_BTL1LEN 0x0016 /* Beacon 1 template length */ -#define B43_SHM_SC_SCFB 0x0017 /* Short frame transmit count threshold for rate fallback */ -#define B43_SHM_SC_LCFB 0x0018 /* Long frame transmit count threshold for rate fallback */ - -/* Hardware Radio Enable masks */ -#define B43_MMIO_RADIO_HWENABLED_HI_MASK (1 << 16) -#define B43_MMIO_RADIO_HWENABLED_LO_MASK (1 << 4) - -/* HostFlags. See b43_hf_read/write() */ -#define B43_HF_ANTDIVHELP 0x000000000001ULL /* ucode antenna div helper */ -#define B43_HF_SYMW 0x000000000002ULL /* G-PHY SYM workaround */ -#define B43_HF_RXPULLW 0x000000000004ULL /* RX pullup workaround */ -#define B43_HF_CCKBOOST 0x000000000008ULL /* 4dB CCK power boost (exclusive with OFDM boost) */ -#define B43_HF_BTCOEX 0x000000000010ULL /* Bluetooth coexistance */ -#define B43_HF_GDCW 0x000000000020ULL /* G-PHY DC canceller filter bw workaround */ -#define B43_HF_OFDMPABOOST 0x000000000040ULL /* Enable PA gain boost for OFDM */ -#define B43_HF_ACPR 0x000000000080ULL /* Disable for Japan, channel 14 */ -#define B43_HF_EDCF 0x000000000100ULL /* on if WME and MAC suspended */ -#define B43_HF_TSSIRPSMW 0x000000000200ULL /* TSSI reset PSM ucode workaround */ -#define B43_HF_20IN40IQW 0x000000000200ULL /* 20 in 40 MHz I/Q workaround (rev >= 13 only) */ -#define B43_HF_DSCRQ 0x000000000400ULL /* Disable slow clock request in ucode */ -#define B43_HF_ACIW 0x000000000800ULL /* ACI workaround: shift bits by 2 on PHY CRS */ -#define B43_HF_2060W 0x000000001000ULL /* 2060 radio workaround */ -#define B43_HF_RADARW 0x000000002000ULL /* Radar workaround */ -#define B43_HF_USEDEFKEYS 0x000000004000ULL /* Enable use of default keys */ -#define B43_HF_AFTERBURNER 0x000000008000ULL /* Afterburner enabled */ -#define B43_HF_BT4PRIOCOEX 0x000000010000ULL /* Bluetooth 4-priority coexistance */ -#define B43_HF_FWKUP 0x000000020000ULL /* Fast wake-up ucode */ -#define B43_HF_VCORECALC 0x000000040000ULL /* Force VCO recalculation when powering up synthpu */ -#define B43_HF_PCISCW 0x000000080000ULL /* PCI slow clock workaround */ -#define B43_HF_4318TSSI 0x000000200000ULL /* 4318 TSSI */ -#define B43_HF_FBCMCFIFO 0x000000400000ULL /* Flush bcast/mcast FIFO immediately */ -#define B43_HF_HWPCTL 0x000000800000ULL /* Enable hardwarre power control */ -#define B43_HF_BTCOEXALT 0x000001000000ULL /* Bluetooth coexistance in alternate pins */ -#define B43_HF_TXBTCHECK 0x000002000000ULL /* Bluetooth check during transmission */ -#define B43_HF_SKCFPUP 0x000004000000ULL /* Skip CFP update */ -#define B43_HF_N40W 0x000008000000ULL /* N PHY 40 MHz workaround (rev >= 13 only) */ -#define B43_HF_ANTSEL 0x000020000000ULL /* Antenna selection (for testing antenna div.) */ -#define B43_HF_BT3COEXT 0x000020000000ULL /* Bluetooth 3-wire coexistence (rev >= 13 only) */ -#define B43_HF_BTCANT 0x000040000000ULL /* Bluetooth coexistence (antenna mode) (rev >= 13 only) */ -#define B43_HF_ANTSELEN 0x000100000000ULL /* Antenna selection enabled (rev >= 13 only) */ -#define B43_HF_ANTSELMODE 0x000200000000ULL /* Antenna selection mode (rev >= 13 only) */ -#define B43_HF_MLADVW 0x001000000000ULL /* N PHY ML ADV workaround (rev >= 13 only) */ -#define B43_HF_PR45960W 0x080000000000ULL /* PR 45960 workaround (rev >= 13 only) */ - -/* Firmware capabilities field in SHM (Opensource firmware only) */ -#define B43_FWCAPA_HWCRYPTO 0x0001 -#define B43_FWCAPA_QOS 0x0002 - -/* MacFilter offsets. */ -#define B43_MACFILTER_SELF 0x0000 -#define B43_MACFILTER_BSSID 0x0003 - -/* PowerControl */ -#define B43_PCTL_IN 0xB0 -#define B43_PCTL_OUT 0xB4 -#define B43_PCTL_OUTENABLE 0xB8 -#define B43_PCTL_XTAL_POWERUP 0x40 -#define B43_PCTL_PLL_POWERDOWN 0x80 - -/* PowerControl Clock Modes */ -#define B43_PCTL_CLK_FAST 0x00 -#define B43_PCTL_CLK_SLOW 0x01 -#define B43_PCTL_CLK_DYNAMIC 0x02 - -#define B43_PCTL_FORCE_SLOW 0x0800 -#define B43_PCTL_FORCE_PLL 0x1000 -#define B43_PCTL_DYN_XTAL 0x2000 - -/* PHYVersioning */ -#define B43_PHYTYPE_A 0x00 -#define B43_PHYTYPE_B 0x01 -#define B43_PHYTYPE_G 0x02 -#define B43_PHYTYPE_N 0x04 -#define B43_PHYTYPE_LP 0x05 -#define B43_PHYTYPE_SSLPN 0x06 -#define B43_PHYTYPE_HT 0x07 -#define B43_PHYTYPE_LCN 0x08 -#define B43_PHYTYPE_LCNXN 0x09 -#define B43_PHYTYPE_LCN40 0x0a -#define B43_PHYTYPE_AC 0x0b - -/* PHYRegisters */ -#define B43_PHY_ILT_A_CTRL 0x0072 -#define B43_PHY_ILT_A_DATA1 0x0073 -#define B43_PHY_ILT_A_DATA2 0x0074 -#define B43_PHY_G_LO_CONTROL 0x0810 -#define B43_PHY_ILT_G_CTRL 0x0472 -#define B43_PHY_ILT_G_DATA1 0x0473 -#define B43_PHY_ILT_G_DATA2 0x0474 -#define B43_PHY_A_PCTL 0x007B -#define B43_PHY_G_PCTL 0x0029 -#define B43_PHY_A_CRS 0x0029 -#define B43_PHY_RADIO_BITFIELD 0x0401 -#define B43_PHY_G_CRS 0x0429 -#define B43_PHY_NRSSILT_CTRL 0x0803 -#define B43_PHY_NRSSILT_DATA 0x0804 - -/* RadioRegisters */ -#define B43_RADIOCTL_ID 0x01 - -/* MAC Control bitfield */ -#define B43_MACCTL_ENABLED 0x00000001 /* MAC Enabled */ -#define B43_MACCTL_PSM_RUN 0x00000002 /* Run Microcode */ -#define B43_MACCTL_PSM_JMP0 0x00000004 /* Microcode jump to 0 */ -#define B43_MACCTL_SHM_ENABLED 0x00000100 /* SHM Enabled */ -#define B43_MACCTL_SHM_UPPER 0x00000200 /* SHM Upper */ -#define B43_MACCTL_IHR_ENABLED 0x00000400 /* IHR Region Enabled */ -#define B43_MACCTL_PSM_DBG 0x00002000 /* Microcode debugging enabled */ -#define B43_MACCTL_GPOUTSMSK 0x0000C000 /* GPOUT Select Mask */ -#define B43_MACCTL_BE 0x00010000 /* Big Endian mode */ -#define B43_MACCTL_INFRA 0x00020000 /* Infrastructure mode */ -#define B43_MACCTL_AP 0x00040000 /* AccessPoint mode */ -#define B43_MACCTL_RADIOLOCK 0x00080000 /* Radio lock */ -#define B43_MACCTL_BEACPROMISC 0x00100000 /* Beacon Promiscuous */ -#define B43_MACCTL_KEEP_BADPLCP 0x00200000 /* Keep frames with bad PLCP */ -#define B43_MACCTL_KEEP_CTL 0x00400000 /* Keep control frames */ -#define B43_MACCTL_KEEP_BAD 0x00800000 /* Keep bad frames (FCS) */ -#define B43_MACCTL_PROMISC 0x01000000 /* Promiscuous mode */ -#define B43_MACCTL_HWPS 0x02000000 /* Hardware Power Saving */ -#define B43_MACCTL_AWAKE 0x04000000 /* Device is awake */ -#define B43_MACCTL_CLOSEDNET 0x08000000 /* Closed net (no SSID bcast) */ -#define B43_MACCTL_TBTTHOLD 0x10000000 /* TBTT Hold */ -#define B43_MACCTL_DISCTXSTAT 0x20000000 /* Discard TX status */ -#define B43_MACCTL_DISCPMQ 0x40000000 /* Discard Power Management Queue */ -#define B43_MACCTL_GMODE 0x80000000 /* G Mode */ - -/* MAC Command bitfield */ -#define B43_MACCMD_BEACON0_VALID 0x00000001 /* Beacon 0 in template RAM is busy/valid */ -#define B43_MACCMD_BEACON1_VALID 0x00000002 /* Beacon 1 in template RAM is busy/valid */ -#define B43_MACCMD_DFQ_VALID 0x00000004 /* Directed frame queue valid (IBSS PS mode, ATIM) */ -#define B43_MACCMD_CCA 0x00000008 /* Clear channel assessment */ -#define B43_MACCMD_BGNOISE 0x00000010 /* Background noise */ - -/* See BCMA_CLKCTLST_EXTRESREQ and BCMA_CLKCTLST_EXTRESST */ -#define B43_BCMA_CLKCTLST_80211_PLL_REQ 0x00000100 -#define B43_BCMA_CLKCTLST_PHY_PLL_REQ 0x00000200 -#define B43_BCMA_CLKCTLST_80211_PLL_ST 0x01000000 -#define B43_BCMA_CLKCTLST_PHY_PLL_ST 0x02000000 - -/* BCMA 802.11 core specific IO Control (BCMA_IOCTL) flags */ -#define B43_BCMA_IOCTL_PHY_CLKEN 0x00000004 /* PHY Clock Enable */ -#define B43_BCMA_IOCTL_PHY_RESET 0x00000008 /* PHY Reset */ -#define B43_BCMA_IOCTL_MACPHYCLKEN 0x00000010 /* MAC PHY Clock Control Enable */ -#define B43_BCMA_IOCTL_PLLREFSEL 0x00000020 /* PLL Frequency Reference Select */ -#define B43_BCMA_IOCTL_PHY_BW 0x000000C0 /* PHY band width and clock speed mask (N-PHY+ only?) */ -#define B43_BCMA_IOCTL_PHY_BW_10MHZ 0x00000000 /* 10 MHz bandwidth, 40 MHz PHY */ -#define B43_BCMA_IOCTL_PHY_BW_20MHZ 0x00000040 /* 20 MHz bandwidth, 80 MHz PHY */ -#define B43_BCMA_IOCTL_PHY_BW_40MHZ 0x00000080 /* 40 MHz bandwidth, 160 MHz PHY */ -#define B43_BCMA_IOCTL_GMODE 0x00002000 /* G Mode Enable */ - -/* BCMA 802.11 core specific IO status (BCMA_IOST) flags */ -#define B43_BCMA_IOST_2G_PHY 0x00000001 /* 2.4G capable phy */ -#define B43_BCMA_IOST_5G_PHY 0x00000002 /* 5G capable phy */ -#define B43_BCMA_IOST_FASTCLKA 0x00000004 /* Fast Clock Available */ -#define B43_BCMA_IOST_DUALB_PHY 0x00000008 /* Dualband phy */ - -/* 802.11 core specific TM State Low (SSB_TMSLOW) flags */ -#define B43_TMSLOW_GMODE 0x20000000 /* G Mode Enable */ -#define B43_TMSLOW_PHY_BANDWIDTH 0x00C00000 /* PHY band width and clock speed mask (N-PHY only) */ -#define B43_TMSLOW_PHY_BANDWIDTH_10MHZ 0x00000000 /* 10 MHz bandwidth, 40 MHz PHY */ -#define B43_TMSLOW_PHY_BANDWIDTH_20MHZ 0x00400000 /* 20 MHz bandwidth, 80 MHz PHY */ -#define B43_TMSLOW_PHY_BANDWIDTH_40MHZ 0x00800000 /* 40 MHz bandwidth, 160 MHz PHY */ -#define B43_TMSLOW_PLLREFSEL 0x00200000 /* PLL Frequency Reference Select (rev >= 5) */ -#define B43_TMSLOW_MACPHYCLKEN 0x00100000 /* MAC PHY Clock Control Enable (rev >= 5) */ -#define B43_TMSLOW_PHYRESET 0x00080000 /* PHY Reset */ -#define B43_TMSLOW_PHYCLKEN 0x00040000 /* PHY Clock Enable */ - -/* 802.11 core specific TM State High (SSB_TMSHIGH) flags */ -#define B43_TMSHIGH_DUALBAND_PHY 0x00080000 /* Dualband PHY available */ -#define B43_TMSHIGH_FCLOCK 0x00040000 /* Fast Clock Available (rev >= 5) */ -#define B43_TMSHIGH_HAVE_5GHZ_PHY 0x00020000 /* 5 GHz PHY available (rev >= 5) */ -#define B43_TMSHIGH_HAVE_2GHZ_PHY 0x00010000 /* 2.4 GHz PHY available (rev >= 5) */ - -/* Generic-Interrupt reasons. */ -#define B43_IRQ_MAC_SUSPENDED 0x00000001 -#define B43_IRQ_BEACON 0x00000002 -#define B43_IRQ_TBTT_INDI 0x00000004 -#define B43_IRQ_BEACON_TX_OK 0x00000008 -#define B43_IRQ_BEACON_CANCEL 0x00000010 -#define B43_IRQ_ATIM_END 0x00000020 -#define B43_IRQ_PMQ 0x00000040 -#define B43_IRQ_PIO_WORKAROUND 0x00000100 -#define B43_IRQ_MAC_TXERR 0x00000200 -#define B43_IRQ_PHY_TXERR 0x00000800 -#define B43_IRQ_PMEVENT 0x00001000 -#define B43_IRQ_TIMER0 0x00002000 -#define B43_IRQ_TIMER1 0x00004000 -#define B43_IRQ_DMA 0x00008000 -#define B43_IRQ_TXFIFO_FLUSH_OK 0x00010000 -#define B43_IRQ_CCA_MEASURE_OK 0x00020000 -#define B43_IRQ_NOISESAMPLE_OK 0x00040000 -#define B43_IRQ_UCODE_DEBUG 0x08000000 -#define B43_IRQ_RFKILL 0x10000000 -#define B43_IRQ_TX_OK 0x20000000 -#define B43_IRQ_PHY_G_CHANGED 0x40000000 -#define B43_IRQ_TIMEOUT 0x80000000 - -#define B43_IRQ_ALL 0xFFFFFFFF -#define B43_IRQ_MASKTEMPLATE (B43_IRQ_TBTT_INDI | \ - B43_IRQ_ATIM_END | \ - B43_IRQ_PMQ | \ - B43_IRQ_MAC_TXERR | \ - B43_IRQ_PHY_TXERR | \ - B43_IRQ_DMA | \ - B43_IRQ_TXFIFO_FLUSH_OK | \ - B43_IRQ_NOISESAMPLE_OK | \ - B43_IRQ_UCODE_DEBUG | \ - B43_IRQ_RFKILL | \ - B43_IRQ_TX_OK) - -/* The firmware register to fetch the debug-IRQ reason from. */ -#define B43_DEBUGIRQ_REASON_REG 63 -/* Debug-IRQ reasons. */ -#define B43_DEBUGIRQ_PANIC 0 /* The firmware panic'ed */ -#define B43_DEBUGIRQ_DUMP_SHM 1 /* Dump shared SHM */ -#define B43_DEBUGIRQ_DUMP_REGS 2 /* Dump the microcode registers */ -#define B43_DEBUGIRQ_MARKER 3 /* A "marker" was thrown by the firmware. */ -#define B43_DEBUGIRQ_ACK 0xFFFF /* The host writes that to ACK the IRQ */ - -/* The firmware register that contains the "marker" line. */ -#define B43_MARKER_ID_REG 2 -#define B43_MARKER_LINE_REG 3 - -/* The firmware register to fetch the panic reason from. */ -#define B43_FWPANIC_REASON_REG 3 -/* Firmware panic reason codes */ -#define B43_FWPANIC_DIE 0 /* Firmware died. Don't auto-restart it. */ -#define B43_FWPANIC_RESTART 1 /* Firmware died. Schedule a controller reset. */ - -/* The firmware register that contains the watchdog counter. */ -#define B43_WATCHDOG_REG 1 - -/* Device specific rate values. - * The actual values defined here are (rate_in_mbps * 2). - * Some code depends on this. Don't change it. */ -#define B43_CCK_RATE_1MB 0x02 -#define B43_CCK_RATE_2MB 0x04 -#define B43_CCK_RATE_5MB 0x0B -#define B43_CCK_RATE_11MB 0x16 -#define B43_OFDM_RATE_6MB 0x0C -#define B43_OFDM_RATE_9MB 0x12 -#define B43_OFDM_RATE_12MB 0x18 -#define B43_OFDM_RATE_18MB 0x24 -#define B43_OFDM_RATE_24MB 0x30 -#define B43_OFDM_RATE_36MB 0x48 -#define B43_OFDM_RATE_48MB 0x60 -#define B43_OFDM_RATE_54MB 0x6C -/* Convert a b43 rate value to a rate in 100kbps */ -#define B43_RATE_TO_BASE100KBPS(rate) (((rate) * 10) / 2) - -#define B43_DEFAULT_SHORT_RETRY_LIMIT 7 -#define B43_DEFAULT_LONG_RETRY_LIMIT 4 - -#define B43_PHY_TX_BADNESS_LIMIT 1000 - -/* Max size of a security key */ -#define B43_SEC_KEYSIZE 16 -/* Max number of group keys */ -#define B43_NR_GROUP_KEYS 4 -/* Max number of pairwise keys */ -#define B43_NR_PAIRWISE_KEYS 50 -/* Security algorithms. */ -enum { - B43_SEC_ALGO_NONE = 0, /* unencrypted, as of TX header. */ - B43_SEC_ALGO_WEP40, - B43_SEC_ALGO_TKIP, - B43_SEC_ALGO_AES, - B43_SEC_ALGO_WEP104, - B43_SEC_ALGO_AES_LEGACY, -}; - -struct b43_dmaring; - -/* The firmware file header */ -#define B43_FW_TYPE_UCODE 'u' -#define B43_FW_TYPE_PCM 'p' -#define B43_FW_TYPE_IV 'i' -struct b43_fw_header { - /* File type */ - u8 type; - /* File format version */ - u8 ver; - u8 __padding[2]; - /* Size of the data. For ucode and PCM this is in bytes. - * For IV this is number-of-ivs. */ - __be32 size; -} __packed; - -/* Initial Value file format */ -#define B43_IV_OFFSET_MASK 0x7FFF -#define B43_IV_32BIT 0x8000 -struct b43_iv { - __be16 offset_size; - union { - __be16 d16; - __be32 d32; - } data __packed; -} __packed; - - -/* Data structures for DMA transmission, per 80211 core. */ -struct b43_dma { - struct b43_dmaring *tx_ring_AC_BK; /* Background */ - struct b43_dmaring *tx_ring_AC_BE; /* Best Effort */ - struct b43_dmaring *tx_ring_AC_VI; /* Video */ - struct b43_dmaring *tx_ring_AC_VO; /* Voice */ - struct b43_dmaring *tx_ring_mcast; /* Multicast */ - - struct b43_dmaring *rx_ring; - - u32 translation; /* Routing bits */ - bool translation_in_low; /* Should translation bit go into low addr? */ - bool parity; /* Check for parity */ -}; - -struct b43_pio_txqueue; -struct b43_pio_rxqueue; - -/* Data structures for PIO transmission, per 80211 core. */ -struct b43_pio { - struct b43_pio_txqueue *tx_queue_AC_BK; /* Background */ - struct b43_pio_txqueue *tx_queue_AC_BE; /* Best Effort */ - struct b43_pio_txqueue *tx_queue_AC_VI; /* Video */ - struct b43_pio_txqueue *tx_queue_AC_VO; /* Voice */ - struct b43_pio_txqueue *tx_queue_mcast; /* Multicast */ - - struct b43_pio_rxqueue *rx_queue; -}; - -/* Context information for a noise calculation (Link Quality). */ -struct b43_noise_calculation { - bool calculation_running; - u8 nr_samples; - s8 samples[8][4]; -}; - -struct b43_stats { - u8 link_noise; -}; - -struct b43_key { - /* If keyconf is NULL, this key is disabled. - * keyconf is a cookie. Don't derefenrence it outside of the set_key - * path, because b43 doesn't own it. */ - struct ieee80211_key_conf *keyconf; - u8 algorithm; -}; - -/* SHM offsets to the QOS data structures for the 4 different queues. */ -#define B43_QOS_QUEUE_NUM 4 -#define B43_QOS_PARAMS(queue) (B43_SHM_SH_EDCFQ + \ - (B43_NR_QOSPARAMS * sizeof(u16) * (queue))) -#define B43_QOS_BACKGROUND B43_QOS_PARAMS(0) -#define B43_QOS_BESTEFFORT B43_QOS_PARAMS(1) -#define B43_QOS_VIDEO B43_QOS_PARAMS(2) -#define B43_QOS_VOICE B43_QOS_PARAMS(3) - -/* QOS parameter hardware data structure offsets. */ -#define B43_NR_QOSPARAMS 16 -enum { - B43_QOSPARAM_TXOP = 0, - B43_QOSPARAM_CWMIN, - B43_QOSPARAM_CWMAX, - B43_QOSPARAM_CWCUR, - B43_QOSPARAM_AIFS, - B43_QOSPARAM_BSLOTS, - B43_QOSPARAM_REGGAP, - B43_QOSPARAM_STATUS, -}; - -/* QOS parameters for a queue. */ -struct b43_qos_params { - /* The QOS parameters */ - struct ieee80211_tx_queue_params p; -}; - -struct b43_wl; - -/* The type of the firmware file. */ -enum b43_firmware_file_type { - B43_FWTYPE_PROPRIETARY, - B43_FWTYPE_OPENSOURCE, - B43_NR_FWTYPES, -}; - -/* Context data for fetching firmware. */ -struct b43_request_fw_context { - /* The device we are requesting the fw for. */ - struct b43_wldev *dev; - /* a completion event structure needed if this call is asynchronous */ - struct completion fw_load_complete; - /* a pointer to the firmware object */ - const struct firmware *blob; - /* The type of firmware to request. */ - enum b43_firmware_file_type req_type; - /* Error messages for each firmware type. */ - char errors[B43_NR_FWTYPES][128]; - /* Temporary buffer for storing the firmware name. */ - char fwname[64]; - /* A fatal error occurred while requesting. Firmware request - * can not continue, as any other request will also fail. */ - int fatal_failure; -}; - -/* In-memory representation of a cached microcode file. */ -struct b43_firmware_file { - const char *filename; - const struct firmware *data; - /* Type of the firmware file name. Note that this does only indicate - * the type by the firmware name. NOT the file contents. - * If you want to check for proprietary vs opensource, use (struct b43_firmware)->opensource - * instead! The (struct b43_firmware)->opensource flag is derived from the actual firmware - * binary code, not just the filename. - */ - enum b43_firmware_file_type type; -}; - -enum b43_firmware_hdr_format { - B43_FW_HDR_598, - B43_FW_HDR_410, - B43_FW_HDR_351, -}; - -/* Pointers to the firmware data and meta information about it. */ -struct b43_firmware { - /* Microcode */ - struct b43_firmware_file ucode; - /* PCM code */ - struct b43_firmware_file pcm; - /* Initial MMIO values for the firmware */ - struct b43_firmware_file initvals; - /* Initial MMIO values for the firmware, band-specific */ - struct b43_firmware_file initvals_band; - - /* Firmware revision */ - u16 rev; - /* Firmware patchlevel */ - u16 patch; - - /* Format of header used by firmware */ - enum b43_firmware_hdr_format hdr_format; - - /* Set to true, if we are using an opensource firmware. - * Use this to check for proprietary vs opensource. */ - bool opensource; - /* Set to true, if the core needs a PCM firmware, but - * we failed to load one. This is always false for - * core rev > 10, as these don't need PCM firmware. */ - bool pcm_request_failed; -}; - -/* Device (802.11 core) initialization status. */ -enum { - B43_STAT_UNINIT = 0, /* Uninitialized. */ - B43_STAT_INITIALIZED = 1, /* Initialized, but not started, yet. */ - B43_STAT_STARTED = 2, /* Up and running. */ -}; -#define b43_status(wldev) atomic_read(&(wldev)->__init_status) -#define b43_set_status(wldev, stat) do { \ - atomic_set(&(wldev)->__init_status, (stat)); \ - smp_wmb(); \ - } while (0) - -/* Data structure for one wireless device (802.11 core) */ -struct b43_wldev { - struct b43_bus_dev *dev; - struct b43_wl *wl; - - /* The device initialization status. - * Use b43_status() to query. */ - atomic_t __init_status; - - bool bad_frames_preempt; /* Use "Bad Frames Preemption" (default off) */ - bool dfq_valid; /* Directed frame queue valid (IBSS PS mode, ATIM) */ - bool radio_hw_enable; /* saved state of radio hardware enabled state */ - bool qos_enabled; /* TRUE, if QoS is used. */ - bool hwcrypto_enabled; /* TRUE, if HW crypto acceleration is enabled. */ - bool use_pio; /* TRUE if next init should use PIO */ - - /* PHY/Radio device. */ - struct b43_phy phy; - - union { - /* DMA engines. */ - struct b43_dma dma; - /* PIO engines. */ - struct b43_pio pio; - }; - /* Use b43_using_pio_transfers() to check whether we are using - * DMA or PIO data transfers. */ - bool __using_pio_transfers; - - /* Various statistics about the physical device. */ - struct b43_stats stats; - - /* Reason code of the last interrupt. */ - u32 irq_reason; - u32 dma_reason[6]; - /* The currently active generic-interrupt mask. */ - u32 irq_mask; - - /* Link Quality calculation context. */ - struct b43_noise_calculation noisecalc; - /* if > 0 MAC is suspended. if == 0 MAC is enabled. */ - int mac_suspended; - - /* Periodic tasks */ - struct delayed_work periodic_work; - unsigned int periodic_state; - - struct work_struct restart_work; - - /* encryption/decryption */ - u16 ktp; /* Key table pointer */ - struct b43_key key[B43_NR_GROUP_KEYS * 2 + B43_NR_PAIRWISE_KEYS]; - - /* Firmware data */ - struct b43_firmware fw; - - /* Devicelist in struct b43_wl (all 802.11 cores) */ - struct list_head list; - - /* Debugging stuff follows. */ -#ifdef CONFIG_B43_DEBUG - struct b43_dfsentry *dfsentry; - unsigned int irq_count; - unsigned int irq_bit_count[32]; - unsigned int tx_count; - unsigned int rx_count; -#endif -}; - -/* Data structure for the WLAN parts (802.11 cores) of the b43 chip. */ -struct b43_wl { - /* Pointer to the active wireless device on this chip */ - struct b43_wldev *current_dev; - /* Pointer to the ieee80211 hardware data structure */ - struct ieee80211_hw *hw; - - /* Global driver mutex. Every operation must run with this mutex locked. */ - struct mutex mutex; - /* Hard-IRQ spinlock. This lock protects things used in the hard-IRQ - * handler, only. This basically is just the IRQ mask register. */ - spinlock_t hardirq_lock; - - /* Set this if we call ieee80211_register_hw() and check if we call - * ieee80211_unregister_hw(). */ - bool hw_registred; - - /* We can only have one operating interface (802.11 core) - * at a time. General information about this interface follows. - */ - - struct ieee80211_vif *vif; - /* The MAC address of the operating interface. */ - u8 mac_addr[ETH_ALEN]; - /* Current BSSID */ - u8 bssid[ETH_ALEN]; - /* Interface type. (NL80211_IFTYPE_XXX) */ - int if_type; - /* Is the card operating in AP, STA or IBSS mode? */ - bool operating; - /* filter flags */ - unsigned int filter_flags; - /* Stats about the wireless interface */ - struct ieee80211_low_level_stats ieee_stats; - -#ifdef CONFIG_B43_HWRNG - struct hwrng rng; - bool rng_initialized; - char rng_name[30 + 1]; -#endif /* CONFIG_B43_HWRNG */ - - /* List of all wireless devices on this chip */ - struct list_head devlist; - u8 nr_devs; - - bool radiotap_enabled; - bool radio_enabled; - - /* The beacon we are currently using (AP or IBSS mode). */ - struct sk_buff *current_beacon; - bool beacon0_uploaded; - bool beacon1_uploaded; - bool beacon_templates_virgin; /* Never wrote the templates? */ - struct work_struct beacon_update_trigger; - - /* The current QOS parameters for the 4 queues. */ - struct b43_qos_params qos_params[B43_QOS_QUEUE_NUM]; - - /* Work for adjustment of the transmission power. - * This is scheduled when we determine that the actual TX output - * power doesn't match what we want. */ - struct work_struct txpower_adjust_work; - - /* Packet transmit work */ - struct work_struct tx_work; - - /* Queue of packets to be transmitted. */ - struct sk_buff_head tx_queue[B43_QOS_QUEUE_NUM]; - - /* Flag that implement the queues stopping. */ - bool tx_queue_stopped[B43_QOS_QUEUE_NUM]; - - /* firmware loading work */ - struct work_struct firmware_load; - - /* The device LEDs. */ - struct b43_leds leds; - - /* Kmalloc'ed scratch space for PIO TX/RX. Protected by wl->mutex. */ - u8 pio_scratchspace[118] __attribute__((__aligned__(8))); - u8 pio_tailspace[4] __attribute__((__aligned__(8))); -}; - -static inline struct b43_wl *hw_to_b43_wl(struct ieee80211_hw *hw) -{ - return hw->priv; -} - -static inline struct b43_wldev *dev_to_b43_wldev(struct device *dev) -{ - struct ssb_device *ssb_dev = dev_to_ssb_dev(dev); - return ssb_get_drvdata(ssb_dev); -} - -/* Is the device operating in a specified mode (NL80211_IFTYPE_XXX). */ -static inline int b43_is_mode(struct b43_wl *wl, int type) -{ - return (wl->operating && wl->if_type == type); -} - -/** - * b43_current_band - Returns the currently used band. - * Returns one of IEEE80211_BAND_2GHZ and IEEE80211_BAND_5GHZ. - */ -static inline enum ieee80211_band b43_current_band(struct b43_wl *wl) -{ - return wl->hw->conf.chandef.chan->band; -} - -static inline int b43_bus_may_powerdown(struct b43_wldev *wldev) -{ - return wldev->dev->bus_may_powerdown(wldev->dev); -} -static inline int b43_bus_powerup(struct b43_wldev *wldev, bool dynamic_pctl) -{ - return wldev->dev->bus_powerup(wldev->dev, dynamic_pctl); -} -static inline int b43_device_is_enabled(struct b43_wldev *wldev) -{ - return wldev->dev->device_is_enabled(wldev->dev); -} -static inline void b43_device_enable(struct b43_wldev *wldev, - u32 core_specific_flags) -{ - wldev->dev->device_enable(wldev->dev, core_specific_flags); -} -static inline void b43_device_disable(struct b43_wldev *wldev, - u32 core_specific_flags) -{ - wldev->dev->device_disable(wldev->dev, core_specific_flags); -} - -static inline u16 b43_read16(struct b43_wldev *dev, u16 offset) -{ - return dev->dev->read16(dev->dev, offset); -} - -static inline void b43_write16(struct b43_wldev *dev, u16 offset, u16 value) -{ - dev->dev->write16(dev->dev, offset, value); -} - -static inline void b43_maskset16(struct b43_wldev *dev, u16 offset, u16 mask, - u16 set) -{ - b43_write16(dev, offset, (b43_read16(dev, offset) & mask) | set); -} - -static inline u32 b43_read32(struct b43_wldev *dev, u16 offset) -{ - return dev->dev->read32(dev->dev, offset); -} - -static inline void b43_write32(struct b43_wldev *dev, u16 offset, u32 value) -{ - dev->dev->write32(dev->dev, offset, value); -} - -static inline void b43_maskset32(struct b43_wldev *dev, u16 offset, u32 mask, - u32 set) -{ - b43_write32(dev, offset, (b43_read32(dev, offset) & mask) | set); -} - -static inline void b43_block_read(struct b43_wldev *dev, void *buffer, - size_t count, u16 offset, u8 reg_width) -{ - dev->dev->block_read(dev->dev, buffer, count, offset, reg_width); -} - -static inline void b43_block_write(struct b43_wldev *dev, const void *buffer, - size_t count, u16 offset, u8 reg_width) -{ - dev->dev->block_write(dev->dev, buffer, count, offset, reg_width); -} - -static inline bool b43_using_pio_transfers(struct b43_wldev *dev) -{ - return dev->__using_pio_transfers; -} - -/* Message printing */ -__printf(2, 3) void b43info(struct b43_wl *wl, const char *fmt, ...); -__printf(2, 3) void b43err(struct b43_wl *wl, const char *fmt, ...); -__printf(2, 3) void b43warn(struct b43_wl *wl, const char *fmt, ...); -__printf(2, 3) void b43dbg(struct b43_wl *wl, const char *fmt, ...); - - -/* A WARN_ON variant that vanishes when b43 debugging is disabled. - * This _also_ evaluates the arg with debugging disabled. */ -#if B43_DEBUG -# define B43_WARN_ON(x) WARN_ON(x) -#else -static inline bool __b43_warn_on_dummy(bool x) { return x; } -# define B43_WARN_ON(x) __b43_warn_on_dummy(unlikely(!!(x))) -#endif - -/* Convert an integer to a Q5.2 value */ -#define INT_TO_Q52(i) ((i) << 2) -/* Convert a Q5.2 value to an integer (precision loss!) */ -#define Q52_TO_INT(q52) ((q52) >> 2) -/* Macros for printing a value in Q5.2 format */ -#define Q52_FMT "%u.%u" -#define Q52_ARG(q52) Q52_TO_INT(q52), ((((q52) & 0x3) * 100) / 4) - -#endif /* B43_H_ */ diff --git a/drivers/net/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c deleted file mode 100644 index 565fdbdd6915..000000000000 --- a/drivers/net/wireless/b43/bus.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - - Broadcom B43 wireless driver - Bus abstraction layer - - Copyright (c) 2011 Rafał Miłecki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "bus.h" - -/* BCMA */ -#ifdef CONFIG_B43_BCMA -static int b43_bus_bcma_bus_may_powerdown(struct b43_bus_dev *dev) -{ - return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */ -} -static int b43_bus_bcma_bus_powerup(struct b43_bus_dev *dev, - bool dynamic_pctl) -{ - return 0; /* bcma_bus_powerup(dev->sdev->bus, dynamic_pctl); */ -} -static int b43_bus_bcma_device_is_enabled(struct b43_bus_dev *dev) -{ - return bcma_core_is_enabled(dev->bdev); -} -static void b43_bus_bcma_device_enable(struct b43_bus_dev *dev, - u32 core_specific_flags) -{ - bcma_core_enable(dev->bdev, core_specific_flags); -} -static void b43_bus_bcma_device_disable(struct b43_bus_dev *dev, - u32 core_specific_flags) -{ - bcma_core_disable(dev->bdev, core_specific_flags); -} -static u16 b43_bus_bcma_read16(struct b43_bus_dev *dev, u16 offset) -{ - return bcma_read16(dev->bdev, offset); -} -static u32 b43_bus_bcma_read32(struct b43_bus_dev *dev, u16 offset) -{ - return bcma_read32(dev->bdev, offset); -} -static -void b43_bus_bcma_write16(struct b43_bus_dev *dev, u16 offset, u16 value) -{ - bcma_write16(dev->bdev, offset, value); -} -static -void b43_bus_bcma_write32(struct b43_bus_dev *dev, u16 offset, u32 value) -{ - bcma_write32(dev->bdev, offset, value); -} -static -void b43_bus_bcma_block_read(struct b43_bus_dev *dev, void *buffer, - size_t count, u16 offset, u8 reg_width) -{ - bcma_block_read(dev->bdev, buffer, count, offset, reg_width); -} -static -void b43_bus_bcma_block_write(struct b43_bus_dev *dev, const void *buffer, - size_t count, u16 offset, u8 reg_width) -{ - bcma_block_write(dev->bdev, buffer, count, offset, reg_width); -} - -struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core) -{ - struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) - return NULL; - - dev->bus_type = B43_BUS_BCMA; - dev->bdev = core; - - dev->bus_may_powerdown = b43_bus_bcma_bus_may_powerdown; - dev->bus_powerup = b43_bus_bcma_bus_powerup; - dev->device_is_enabled = b43_bus_bcma_device_is_enabled; - dev->device_enable = b43_bus_bcma_device_enable; - dev->device_disable = b43_bus_bcma_device_disable; - - dev->read16 = b43_bus_bcma_read16; - dev->read32 = b43_bus_bcma_read32; - dev->write16 = b43_bus_bcma_write16; - dev->write32 = b43_bus_bcma_write32; - dev->block_read = b43_bus_bcma_block_read; - dev->block_write = b43_bus_bcma_block_write; - - dev->dev = &core->dev; - dev->dma_dev = core->dma_dev; - dev->irq = core->irq; - - dev->board_vendor = core->bus->boardinfo.vendor; - dev->board_type = core->bus->boardinfo.type; - dev->board_rev = core->bus->sprom.board_rev; - - dev->chip_id = core->bus->chipinfo.id; - dev->chip_rev = core->bus->chipinfo.rev; - dev->chip_pkg = core->bus->chipinfo.pkg; - - dev->bus_sprom = &core->bus->sprom; - - dev->core_id = core->id.id; - dev->core_rev = core->id.rev; - - return dev; -} -#endif /* CONFIG_B43_BCMA */ - -/* SSB */ -#ifdef CONFIG_B43_SSB -static int b43_bus_ssb_bus_may_powerdown(struct b43_bus_dev *dev) -{ - return ssb_bus_may_powerdown(dev->sdev->bus); -} -static int b43_bus_ssb_bus_powerup(struct b43_bus_dev *dev, - bool dynamic_pctl) -{ - return ssb_bus_powerup(dev->sdev->bus, dynamic_pctl); -} -static int b43_bus_ssb_device_is_enabled(struct b43_bus_dev *dev) -{ - return ssb_device_is_enabled(dev->sdev); -} -static void b43_bus_ssb_device_enable(struct b43_bus_dev *dev, - u32 core_specific_flags) -{ - ssb_device_enable(dev->sdev, core_specific_flags); -} -static void b43_bus_ssb_device_disable(struct b43_bus_dev *dev, - u32 core_specific_flags) -{ - ssb_device_disable(dev->sdev, core_specific_flags); -} - -static u16 b43_bus_ssb_read16(struct b43_bus_dev *dev, u16 offset) -{ - return ssb_read16(dev->sdev, offset); -} -static u32 b43_bus_ssb_read32(struct b43_bus_dev *dev, u16 offset) -{ - return ssb_read32(dev->sdev, offset); -} -static void b43_bus_ssb_write16(struct b43_bus_dev *dev, u16 offset, u16 value) -{ - ssb_write16(dev->sdev, offset, value); -} -static void b43_bus_ssb_write32(struct b43_bus_dev *dev, u16 offset, u32 value) -{ - ssb_write32(dev->sdev, offset, value); -} -static void b43_bus_ssb_block_read(struct b43_bus_dev *dev, void *buffer, - size_t count, u16 offset, u8 reg_width) -{ - ssb_block_read(dev->sdev, buffer, count, offset, reg_width); -} -static -void b43_bus_ssb_block_write(struct b43_bus_dev *dev, const void *buffer, - size_t count, u16 offset, u8 reg_width) -{ - ssb_block_write(dev->sdev, buffer, count, offset, reg_width); -} - -struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev) -{ - struct b43_bus_dev *dev; - - dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) - return NULL; - - dev->bus_type = B43_BUS_SSB; - dev->sdev = sdev; - - dev->bus_may_powerdown = b43_bus_ssb_bus_may_powerdown; - dev->bus_powerup = b43_bus_ssb_bus_powerup; - dev->device_is_enabled = b43_bus_ssb_device_is_enabled; - dev->device_enable = b43_bus_ssb_device_enable; - dev->device_disable = b43_bus_ssb_device_disable; - - dev->read16 = b43_bus_ssb_read16; - dev->read32 = b43_bus_ssb_read32; - dev->write16 = b43_bus_ssb_write16; - dev->write32 = b43_bus_ssb_write32; - dev->block_read = b43_bus_ssb_block_read; - dev->block_write = b43_bus_ssb_block_write; - - dev->dev = sdev->dev; - dev->dma_dev = sdev->dma_dev; - dev->irq = sdev->irq; - - dev->board_vendor = sdev->bus->boardinfo.vendor; - dev->board_type = sdev->bus->boardinfo.type; - dev->board_rev = sdev->bus->sprom.board_rev; - - dev->chip_id = sdev->bus->chip_id; - dev->chip_rev = sdev->bus->chip_rev; - dev->chip_pkg = sdev->bus->chip_package; - - dev->bus_sprom = &sdev->bus->sprom; - - dev->core_id = sdev->id.coreid; - dev->core_rev = sdev->id.revision; - - return dev; -} -#endif /* CONFIG_B43_SSB */ - -void *b43_bus_get_wldev(struct b43_bus_dev *dev) -{ - switch (dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - return bcma_get_drvdata(dev->bdev); -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - return ssb_get_drvdata(dev->sdev); -#endif - } - return NULL; -} - -void b43_bus_set_wldev(struct b43_bus_dev *dev, void *wldev) -{ - switch (dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - bcma_set_drvdata(dev->bdev, wldev); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - ssb_set_drvdata(dev->sdev, wldev); - break; -#endif - } -} diff --git a/drivers/net/wireless/b43/bus.h b/drivers/net/wireless/b43/bus.h deleted file mode 100644 index 184c95659279..000000000000 --- a/drivers/net/wireless/b43/bus.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef B43_BUS_H_ -#define B43_BUS_H_ - -enum b43_bus_type { -#ifdef CONFIG_B43_BCMA - B43_BUS_BCMA, -#endif - B43_BUS_SSB, -}; - -struct b43_bus_dev { - enum b43_bus_type bus_type; - union { - struct bcma_device *bdev; - struct ssb_device *sdev; - }; - - int (*bus_may_powerdown)(struct b43_bus_dev *dev); - int (*bus_powerup)(struct b43_bus_dev *dev, bool dynamic_pctl); - int (*device_is_enabled)(struct b43_bus_dev *dev); - void (*device_enable)(struct b43_bus_dev *dev, - u32 core_specific_flags); - void (*device_disable)(struct b43_bus_dev *dev, - u32 core_specific_flags); - - u16 (*read16)(struct b43_bus_dev *dev, u16 offset); - u32 (*read32)(struct b43_bus_dev *dev, u16 offset); - void (*write16)(struct b43_bus_dev *dev, u16 offset, u16 value); - void (*write32)(struct b43_bus_dev *dev, u16 offset, u32 value); - void (*block_read)(struct b43_bus_dev *dev, void *buffer, - size_t count, u16 offset, u8 reg_width); - void (*block_write)(struct b43_bus_dev *dev, const void *buffer, - size_t count, u16 offset, u8 reg_width); - - struct device *dev; - struct device *dma_dev; - unsigned int irq; - - u16 board_vendor; - u16 board_type; - u16 board_rev; - - u16 chip_id; - u8 chip_rev; - u8 chip_pkg; - - struct ssb_sprom *bus_sprom; - - u16 core_id; - u8 core_rev; -}; - -static inline bool b43_bus_host_is_pcmcia(struct b43_bus_dev *dev) -{ - return (dev->bus_type == B43_BUS_SSB && - dev->sdev->bus->bustype == SSB_BUSTYPE_PCMCIA); -} -static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev) -{ - return (dev->bus_type == B43_BUS_SSB && - dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO); -} - -struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core); -struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev); - -void *b43_bus_get_wldev(struct b43_bus_dev *dev); -void b43_bus_set_wldev(struct b43_bus_dev *dev, void *data); - -#endif /* B43_BUS_H_ */ diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c deleted file mode 100644 index e807bd930647..000000000000 --- a/drivers/net/wireless/b43/debugfs.c +++ /dev/null @@ -1,826 +0,0 @@ -/* - - Broadcom B43 wireless driver - - debugfs driver debugging code - - Copyright (c) 2005-2007 Michael Buesch - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include -#include -#include -#include -#include -#include - -#include "b43.h" -#include "main.h" -#include "debugfs.h" -#include "dma.h" -#include "xmit.h" - - -/* The root directory. */ -static struct dentry *rootdir; - -struct b43_debugfs_fops { - ssize_t (*read)(struct b43_wldev *dev, char *buf, size_t bufsize); - int (*write)(struct b43_wldev *dev, const char *buf, size_t count); - struct file_operations fops; - /* Offset of struct b43_dfs_file in struct b43_dfsentry */ - size_t file_struct_offset; -}; - -static inline -struct b43_dfs_file *fops_to_dfs_file(struct b43_wldev *dev, - const struct b43_debugfs_fops *dfops) -{ - void *p; - - p = dev->dfsentry; - p += dfops->file_struct_offset; - - return p; -} - - -#define fappend(fmt, x...) \ - do { \ - if (bufsize - count) \ - count += snprintf(buf + count, \ - bufsize - count, \ - fmt , ##x); \ - else \ - printk(KERN_ERR "b43: fappend overflow\n"); \ - } while (0) - - -/* The biggest address values for SHM access from the debugfs files. */ -#define B43_MAX_SHM_ROUTING 4 -#define B43_MAX_SHM_ADDR 0xFFFF - -static ssize_t shm16read__read_file(struct b43_wldev *dev, - char *buf, size_t bufsize) -{ - ssize_t count = 0; - unsigned int routing, addr; - u16 val; - - routing = dev->dfsentry->shm16read_routing_next; - addr = dev->dfsentry->shm16read_addr_next; - if ((routing > B43_MAX_SHM_ROUTING) || - (addr > B43_MAX_SHM_ADDR)) - return -EDESTADDRREQ; - - val = b43_shm_read16(dev, routing, addr); - fappend("0x%04X\n", val); - - return count; -} - -static int shm16read__write_file(struct b43_wldev *dev, - const char *buf, size_t count) -{ - unsigned int routing, addr; - int res; - - res = sscanf(buf, "0x%X 0x%X", &routing, &addr); - if (res != 2) - return -EINVAL; - if (routing > B43_MAX_SHM_ROUTING) - return -EADDRNOTAVAIL; - if (addr > B43_MAX_SHM_ADDR) - return -EADDRNOTAVAIL; - if (routing == B43_SHM_SHARED) { - if ((addr % 2) != 0) - return -EADDRNOTAVAIL; - } - - dev->dfsentry->shm16read_routing_next = routing; - dev->dfsentry->shm16read_addr_next = addr; - - return 0; -} - -static int shm16write__write_file(struct b43_wldev *dev, - const char *buf, size_t count) -{ - unsigned int routing, addr, mask, set; - u16 val; - int res; - - res = sscanf(buf, "0x%X 0x%X 0x%X 0x%X", - &routing, &addr, &mask, &set); - if (res != 4) - return -EINVAL; - if (routing > B43_MAX_SHM_ROUTING) - return -EADDRNOTAVAIL; - if (addr > B43_MAX_SHM_ADDR) - return -EADDRNOTAVAIL; - if (routing == B43_SHM_SHARED) { - if ((addr % 2) != 0) - return -EADDRNOTAVAIL; - } - if ((mask > 0xFFFF) || (set > 0xFFFF)) - return -E2BIG; - - if (mask == 0) - val = 0; - else - val = b43_shm_read16(dev, routing, addr); - val &= mask; - val |= set; - b43_shm_write16(dev, routing, addr, val); - - return 0; -} - -static ssize_t shm32read__read_file(struct b43_wldev *dev, - char *buf, size_t bufsize) -{ - ssize_t count = 0; - unsigned int routing, addr; - u32 val; - - routing = dev->dfsentry->shm32read_routing_next; - addr = dev->dfsentry->shm32read_addr_next; - if ((routing > B43_MAX_SHM_ROUTING) || - (addr > B43_MAX_SHM_ADDR)) - return -EDESTADDRREQ; - - val = b43_shm_read32(dev, routing, addr); - fappend("0x%08X\n", val); - - return count; -} - -static int shm32read__write_file(struct b43_wldev *dev, - const char *buf, size_t count) -{ - unsigned int routing, addr; - int res; - - res = sscanf(buf, "0x%X 0x%X", &routing, &addr); - if (res != 2) - return -EINVAL; - if (routing > B43_MAX_SHM_ROUTING) - return -EADDRNOTAVAIL; - if (addr > B43_MAX_SHM_ADDR) - return -EADDRNOTAVAIL; - if (routing == B43_SHM_SHARED) { - if ((addr % 2) != 0) - return -EADDRNOTAVAIL; - } - - dev->dfsentry->shm32read_routing_next = routing; - dev->dfsentry->shm32read_addr_next = addr; - - return 0; -} - -static int shm32write__write_file(struct b43_wldev *dev, - const char *buf, size_t count) -{ - unsigned int routing, addr, mask, set; - u32 val; - int res; - - res = sscanf(buf, "0x%X 0x%X 0x%X 0x%X", - &routing, &addr, &mask, &set); - if (res != 4) - return -EINVAL; - if (routing > B43_MAX_SHM_ROUTING) - return -EADDRNOTAVAIL; - if (addr > B43_MAX_SHM_ADDR) - return -EADDRNOTAVAIL; - if (routing == B43_SHM_SHARED) { - if ((addr % 2) != 0) - return -EADDRNOTAVAIL; - } - if ((mask > 0xFFFFFFFF) || (set > 0xFFFFFFFF)) - return -E2BIG; - - if (mask == 0) - val = 0; - else - val = b43_shm_read32(dev, routing, addr); - val &= mask; - val |= set; - b43_shm_write32(dev, routing, addr, val); - - return 0; -} - -/* The biggest MMIO address that we allow access to from the debugfs files. */ -#define B43_MAX_MMIO_ACCESS (0xF00 - 1) - -static ssize_t mmio16read__read_file(struct b43_wldev *dev, - char *buf, size_t bufsize) -{ - ssize_t count = 0; - unsigned int addr; - u16 val; - - addr = dev->dfsentry->mmio16read_next; - if (addr > B43_MAX_MMIO_ACCESS) - return -EDESTADDRREQ; - - val = b43_read16(dev, addr); - fappend("0x%04X\n", val); - - return count; -} - -static int mmio16read__write_file(struct b43_wldev *dev, - const char *buf, size_t count) -{ - unsigned int addr; - int res; - - res = sscanf(buf, "0x%X", &addr); - if (res != 1) - return -EINVAL; - if (addr > B43_MAX_MMIO_ACCESS) - return -EADDRNOTAVAIL; - if ((addr % 2) != 0) - return -EINVAL; - - dev->dfsentry->mmio16read_next = addr; - - return 0; -} - -static int mmio16write__write_file(struct b43_wldev *dev, - const char *buf, size_t count) -{ - unsigned int addr, mask, set; - int res; - u16 val; - - res = sscanf(buf, "0x%X 0x%X 0x%X", &addr, &mask, &set); - if (res != 3) - return -EINVAL; - if (addr > B43_MAX_MMIO_ACCESS) - return -EADDRNOTAVAIL; - if ((mask > 0xFFFF) || (set > 0xFFFF)) - return -E2BIG; - if ((addr % 2) != 0) - return -EINVAL; - - if (mask == 0) - val = 0; - else - val = b43_read16(dev, addr); - val &= mask; - val |= set; - b43_write16(dev, addr, val); - - return 0; -} - -static ssize_t mmio32read__read_file(struct b43_wldev *dev, - char *buf, size_t bufsize) -{ - ssize_t count = 0; - unsigned int addr; - u32 val; - - addr = dev->dfsentry->mmio32read_next; - if (addr > B43_MAX_MMIO_ACCESS) - return -EDESTADDRREQ; - - val = b43_read32(dev, addr); - fappend("0x%08X\n", val); - - return count; -} - -static int mmio32read__write_file(struct b43_wldev *dev, - const char *buf, size_t count) -{ - unsigned int addr; - int res; - - res = sscanf(buf, "0x%X", &addr); - if (res != 1) - return -EINVAL; - if (addr > B43_MAX_MMIO_ACCESS) - return -EADDRNOTAVAIL; - if ((addr % 4) != 0) - return -EINVAL; - - dev->dfsentry->mmio32read_next = addr; - - return 0; -} - -static int mmio32write__write_file(struct b43_wldev *dev, - const char *buf, size_t count) -{ - unsigned int addr, mask, set; - int res; - u32 val; - - res = sscanf(buf, "0x%X 0x%X 0x%X", &addr, &mask, &set); - if (res != 3) - return -EINVAL; - if (addr > B43_MAX_MMIO_ACCESS) - return -EADDRNOTAVAIL; - if ((mask > 0xFFFFFFFF) || (set > 0xFFFFFFFF)) - return -E2BIG; - if ((addr % 4) != 0) - return -EINVAL; - - if (mask == 0) - val = 0; - else - val = b43_read32(dev, addr); - val &= mask; - val |= set; - b43_write32(dev, addr, val); - - return 0; -} - -static ssize_t txstat_read_file(struct b43_wldev *dev, - char *buf, size_t bufsize) -{ - struct b43_txstatus_log *log = &dev->dfsentry->txstatlog; - ssize_t count = 0; - int i, idx; - struct b43_txstatus *stat; - - if (log->end < 0) { - fappend("Nothing transmitted, yet\n"); - goto out; - } - fappend("b43 TX status reports:\n\n" - "index | cookie | seq | phy_stat | frame_count | " - "rts_count | supp_reason | pm_indicated | " - "intermediate | for_ampdu | acked\n" "---\n"); - i = log->end + 1; - idx = 0; - while (1) { - if (i == B43_NR_LOGGED_TXSTATUS) - i = 0; - stat = &(log->log[i]); - if (stat->cookie) { - fappend("%03d | " - "0x%04X | 0x%04X | 0x%02X | " - "0x%X | 0x%X | " - "%u | %u | " - "%u | %u | %u\n", - idx, - stat->cookie, stat->seq, stat->phy_stat, - stat->frame_count, stat->rts_count, - stat->supp_reason, stat->pm_indicated, - stat->intermediate, stat->for_ampdu, - stat->acked); - idx++; - } - if (i == log->end) - break; - i++; - } -out: - - return count; -} - -static int restart_write_file(struct b43_wldev *dev, - const char *buf, size_t count) -{ - int err = 0; - - if (count > 0 && buf[0] == '1') { - b43_controller_restart(dev, "manually restarted"); - } else - err = -EINVAL; - - return err; -} - -static unsigned long calc_expire_secs(unsigned long now, - unsigned long time, - unsigned long expire) -{ - expire = time + expire; - - if (time_after(now, expire)) - return 0; /* expired */ - if (expire < now) { - /* jiffies wrapped */ - expire -= MAX_JIFFY_OFFSET; - now -= MAX_JIFFY_OFFSET; - } - B43_WARN_ON(expire < now); - - return (expire - now) / HZ; -} - -static ssize_t loctls_read_file(struct b43_wldev *dev, - char *buf, size_t bufsize) -{ - ssize_t count = 0; - struct b43_txpower_lo_control *lo; - int i, err = 0; - struct b43_lo_calib *cal; - unsigned long now = jiffies; - struct b43_phy *phy = &dev->phy; - - if (phy->type != B43_PHYTYPE_G) { - fappend("Device is not a G-PHY\n"); - err = -ENODEV; - goto out; - } - lo = phy->g->lo_control; - fappend("-- Local Oscillator calibration data --\n\n"); - fappend("HW-power-control enabled: %d\n", - dev->phy.hardware_power_control); - fappend("TX Bias: 0x%02X, TX Magn: 0x%02X (expire in %lu sec)\n", - lo->tx_bias, lo->tx_magn, - calc_expire_secs(now, lo->txctl_measured_time, - B43_LO_TXCTL_EXPIRE)); - fappend("Power Vector: 0x%08X%08X (expires in %lu sec)\n", - (unsigned int)((lo->power_vector & 0xFFFFFFFF00000000ULL) >> 32), - (unsigned int)(lo->power_vector & 0x00000000FFFFFFFFULL), - calc_expire_secs(now, lo->pwr_vec_read_time, - B43_LO_PWRVEC_EXPIRE)); - - fappend("\nCalibrated settings:\n"); - list_for_each_entry(cal, &lo->calib_list, list) { - bool active; - - active = (b43_compare_bbatt(&cal->bbatt, &phy->g->bbatt) && - b43_compare_rfatt(&cal->rfatt, &phy->g->rfatt)); - fappend("BB(%d), RF(%d,%d) -> I=%d, Q=%d " - "(expires in %lu sec)%s\n", - cal->bbatt.att, - cal->rfatt.att, cal->rfatt.with_padmix, - cal->ctl.i, cal->ctl.q, - calc_expire_secs(now, cal->calib_time, - B43_LO_CALIB_EXPIRE), - active ? " ACTIVE" : ""); - } - - fappend("\nUsed RF attenuation values: Value(WithPadmix flag)\n"); - for (i = 0; i < lo->rfatt_list.len; i++) { - fappend("%u(%d), ", - lo->rfatt_list.list[i].att, - lo->rfatt_list.list[i].with_padmix); - } - fappend("\n"); - fappend("\nUsed Baseband attenuation values:\n"); - for (i = 0; i < lo->bbatt_list.len; i++) { - fappend("%u, ", - lo->bbatt_list.list[i].att); - } - fappend("\n"); - -out: - return err ? err : count; -} - -#undef fappend - -static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct b43_wldev *dev; - struct b43_debugfs_fops *dfops; - struct b43_dfs_file *dfile; - ssize_t uninitialized_var(ret); - char *buf; - const size_t bufsize = 1024 * 16; /* 16 kiB buffer */ - const size_t buforder = get_order(bufsize); - int err = 0; - - if (!count) - return 0; - dev = file->private_data; - if (!dev) - return -ENODEV; - - mutex_lock(&dev->wl->mutex); - if (b43_status(dev) < B43_STAT_INITIALIZED) { - err = -ENODEV; - goto out_unlock; - } - - dfops = container_of(file->f_op, struct b43_debugfs_fops, fops); - if (!dfops->read) { - err = -ENOSYS; - goto out_unlock; - } - dfile = fops_to_dfs_file(dev, dfops); - - if (!dfile->buffer) { - buf = (char *)__get_free_pages(GFP_KERNEL, buforder); - if (!buf) { - err = -ENOMEM; - goto out_unlock; - } - memset(buf, 0, bufsize); - ret = dfops->read(dev, buf, bufsize); - if (ret <= 0) { - free_pages((unsigned long)buf, buforder); - err = ret; - goto out_unlock; - } - dfile->data_len = ret; - dfile->buffer = buf; - } - - ret = simple_read_from_buffer(userbuf, count, ppos, - dfile->buffer, - dfile->data_len); - if (*ppos >= dfile->data_len) { - free_pages((unsigned long)dfile->buffer, buforder); - dfile->buffer = NULL; - dfile->data_len = 0; - } -out_unlock: - mutex_unlock(&dev->wl->mutex); - - return err ? err : ret; -} - -static ssize_t b43_debugfs_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct b43_wldev *dev; - struct b43_debugfs_fops *dfops; - char *buf; - int err = 0; - - if (!count) - return 0; - if (count > PAGE_SIZE) - return -E2BIG; - dev = file->private_data; - if (!dev) - return -ENODEV; - - mutex_lock(&dev->wl->mutex); - if (b43_status(dev) < B43_STAT_INITIALIZED) { - err = -ENODEV; - goto out_unlock; - } - - dfops = container_of(file->f_op, struct b43_debugfs_fops, fops); - if (!dfops->write) { - err = -ENOSYS; - goto out_unlock; - } - - buf = (char *)get_zeroed_page(GFP_KERNEL); - if (!buf) { - err = -ENOMEM; - goto out_unlock; - } - if (copy_from_user(buf, userbuf, count)) { - err = -EFAULT; - goto out_freepage; - } - err = dfops->write(dev, buf, count); - if (err) - goto out_freepage; - -out_freepage: - free_page((unsigned long)buf); -out_unlock: - mutex_unlock(&dev->wl->mutex); - - return err ? err : count; -} - - -#define B43_DEBUGFS_FOPS(name, _read, _write) \ - static struct b43_debugfs_fops fops_##name = { \ - .read = _read, \ - .write = _write, \ - .fops = { \ - .open = simple_open, \ - .read = b43_debugfs_read, \ - .write = b43_debugfs_write, \ - .llseek = generic_file_llseek, \ - }, \ - .file_struct_offset = offsetof(struct b43_dfsentry, \ - file_##name), \ - } - -B43_DEBUGFS_FOPS(shm16read, shm16read__read_file, shm16read__write_file); -B43_DEBUGFS_FOPS(shm16write, NULL, shm16write__write_file); -B43_DEBUGFS_FOPS(shm32read, shm32read__read_file, shm32read__write_file); -B43_DEBUGFS_FOPS(shm32write, NULL, shm32write__write_file); -B43_DEBUGFS_FOPS(mmio16read, mmio16read__read_file, mmio16read__write_file); -B43_DEBUGFS_FOPS(mmio16write, NULL, mmio16write__write_file); -B43_DEBUGFS_FOPS(mmio32read, mmio32read__read_file, mmio32read__write_file); -B43_DEBUGFS_FOPS(mmio32write, NULL, mmio32write__write_file); -B43_DEBUGFS_FOPS(txstat, txstat_read_file, NULL); -B43_DEBUGFS_FOPS(restart, NULL, restart_write_file); -B43_DEBUGFS_FOPS(loctls, loctls_read_file, NULL); - - -bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature) -{ - bool enabled; - - enabled = (dev->dfsentry && dev->dfsentry->dyn_debug[feature]); - if (unlikely(enabled)) { - /* Force full debugging messages, if the user enabled - * some dynamic debugging feature. */ - b43_modparam_verbose = B43_VERBOSITY_MAX; - } - - return enabled; -} - -static void b43_remove_dynamic_debug(struct b43_wldev *dev) -{ - struct b43_dfsentry *e = dev->dfsentry; - int i; - - for (i = 0; i < __B43_NR_DYNDBG; i++) - debugfs_remove(e->dyn_debug_dentries[i]); -} - -static void b43_add_dynamic_debug(struct b43_wldev *dev) -{ - struct b43_dfsentry *e = dev->dfsentry; - struct dentry *d; - -#define add_dyn_dbg(name, id, initstate) do { \ - e->dyn_debug[id] = (initstate); \ - d = debugfs_create_bool(name, 0600, e->subdir, \ - &(e->dyn_debug[id])); \ - if (!IS_ERR(d)) \ - e->dyn_debug_dentries[id] = d; \ - } while (0) - - add_dyn_dbg("debug_xmitpower", B43_DBG_XMITPOWER, 0); - add_dyn_dbg("debug_dmaoverflow", B43_DBG_DMAOVERFLOW, 0); - add_dyn_dbg("debug_dmaverbose", B43_DBG_DMAVERBOSE, 0); - add_dyn_dbg("debug_pwork_fast", B43_DBG_PWORK_FAST, 0); - add_dyn_dbg("debug_pwork_stop", B43_DBG_PWORK_STOP, 0); - add_dyn_dbg("debug_lo", B43_DBG_LO, 0); - add_dyn_dbg("debug_firmware", B43_DBG_FIRMWARE, 0); - add_dyn_dbg("debug_keys", B43_DBG_KEYS, 0); - add_dyn_dbg("debug_verbose_stats", B43_DBG_VERBOSESTATS, 0); - -#undef add_dyn_dbg -} - -void b43_debugfs_add_device(struct b43_wldev *dev) -{ - struct b43_dfsentry *e; - struct b43_txstatus_log *log; - char devdir[16]; - - B43_WARN_ON(!dev); - e = kzalloc(sizeof(*e), GFP_KERNEL); - if (!e) { - b43err(dev->wl, "debugfs: add device OOM\n"); - return; - } - e->dev = dev; - log = &e->txstatlog; - log->log = kcalloc(B43_NR_LOGGED_TXSTATUS, - sizeof(struct b43_txstatus), GFP_KERNEL); - if (!log->log) { - b43err(dev->wl, "debugfs: add device txstatus OOM\n"); - kfree(e); - return; - } - log->end = -1; - - dev->dfsentry = e; - - snprintf(devdir, sizeof(devdir), "%s", wiphy_name(dev->wl->hw->wiphy)); - e->subdir = debugfs_create_dir(devdir, rootdir); - if (!e->subdir || IS_ERR(e->subdir)) { - if (e->subdir == ERR_PTR(-ENODEV)) { - b43dbg(dev->wl, "DebugFS (CONFIG_DEBUG_FS) not " - "enabled in kernel config\n"); - } else { - b43err(dev->wl, "debugfs: cannot create %s directory\n", - devdir); - } - dev->dfsentry = NULL; - kfree(log->log); - kfree(e); - return; - } - - e->mmio16read_next = 0xFFFF; /* invalid address */ - e->mmio32read_next = 0xFFFF; /* invalid address */ - e->shm16read_routing_next = 0xFFFFFFFF; /* invalid routing */ - e->shm16read_addr_next = 0xFFFFFFFF; /* invalid address */ - e->shm32read_routing_next = 0xFFFFFFFF; /* invalid routing */ - e->shm32read_addr_next = 0xFFFFFFFF; /* invalid address */ - -#define ADD_FILE(name, mode) \ - do { \ - struct dentry *d; \ - d = debugfs_create_file(__stringify(name), \ - mode, e->subdir, dev, \ - &fops_##name.fops); \ - e->file_##name.dentry = NULL; \ - if (!IS_ERR(d)) \ - e->file_##name.dentry = d; \ - } while (0) - - - ADD_FILE(shm16read, 0600); - ADD_FILE(shm16write, 0200); - ADD_FILE(shm32read, 0600); - ADD_FILE(shm32write, 0200); - ADD_FILE(mmio16read, 0600); - ADD_FILE(mmio16write, 0200); - ADD_FILE(mmio32read, 0600); - ADD_FILE(mmio32write, 0200); - ADD_FILE(txstat, 0400); - ADD_FILE(restart, 0200); - ADD_FILE(loctls, 0400); - -#undef ADD_FILE - - b43_add_dynamic_debug(dev); -} - -void b43_debugfs_remove_device(struct b43_wldev *dev) -{ - struct b43_dfsentry *e; - - if (!dev) - return; - e = dev->dfsentry; - if (!e) - return; - b43_remove_dynamic_debug(dev); - - debugfs_remove(e->file_shm16read.dentry); - debugfs_remove(e->file_shm16write.dentry); - debugfs_remove(e->file_shm32read.dentry); - debugfs_remove(e->file_shm32write.dentry); - debugfs_remove(e->file_mmio16read.dentry); - debugfs_remove(e->file_mmio16write.dentry); - debugfs_remove(e->file_mmio32read.dentry); - debugfs_remove(e->file_mmio32write.dentry); - debugfs_remove(e->file_txstat.dentry); - debugfs_remove(e->file_restart.dentry); - debugfs_remove(e->file_loctls.dentry); - - debugfs_remove(e->subdir); - kfree(e->txstatlog.log); - kfree(e); -} - -void b43_debugfs_log_txstat(struct b43_wldev *dev, - const struct b43_txstatus *status) -{ - struct b43_dfsentry *e = dev->dfsentry; - struct b43_txstatus_log *log; - struct b43_txstatus *cur; - int i; - - if (!e) - return; - log = &e->txstatlog; - i = log->end + 1; - if (i == B43_NR_LOGGED_TXSTATUS) - i = 0; - log->end = i; - cur = &(log->log[i]); - memcpy(cur, status, sizeof(*cur)); -} - -void b43_debugfs_init(void) -{ - rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL); - if (IS_ERR(rootdir)) - rootdir = NULL; -} - -void b43_debugfs_exit(void) -{ - debugfs_remove(rootdir); -} diff --git a/drivers/net/wireless/b43/debugfs.h b/drivers/net/wireless/b43/debugfs.h deleted file mode 100644 index 822aad8842f4..000000000000 --- a/drivers/net/wireless/b43/debugfs.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef B43_DEBUGFS_H_ -#define B43_DEBUGFS_H_ - -struct b43_wldev; -struct b43_txstatus; - -enum b43_dyndbg { /* Dynamic debugging features */ - B43_DBG_XMITPOWER, - B43_DBG_DMAOVERFLOW, - B43_DBG_DMAVERBOSE, - B43_DBG_PWORK_FAST, - B43_DBG_PWORK_STOP, - B43_DBG_LO, - B43_DBG_FIRMWARE, - B43_DBG_KEYS, - B43_DBG_VERBOSESTATS, - __B43_NR_DYNDBG, -}; - -#ifdef CONFIG_B43_DEBUG - -struct dentry; - -#define B43_NR_LOGGED_TXSTATUS 100 - -struct b43_txstatus_log { - /* This structure is protected by wl->mutex */ - - struct b43_txstatus *log; - int end; -}; - -struct b43_dfs_file { - struct dentry *dentry; - char *buffer; - size_t data_len; -}; - -struct b43_dfsentry { - struct b43_wldev *dev; - struct dentry *subdir; - - struct b43_dfs_file file_shm16read; - struct b43_dfs_file file_shm16write; - struct b43_dfs_file file_shm32read; - struct b43_dfs_file file_shm32write; - struct b43_dfs_file file_mmio16read; - struct b43_dfs_file file_mmio16write; - struct b43_dfs_file file_mmio32read; - struct b43_dfs_file file_mmio32write; - struct b43_dfs_file file_txstat; - struct b43_dfs_file file_txpower_g; - struct b43_dfs_file file_restart; - struct b43_dfs_file file_loctls; - - struct b43_txstatus_log txstatlog; - - /* The cached address for the next mmio16read file read */ - u16 mmio16read_next; - /* The cached address for the next mmio32read file read */ - u16 mmio32read_next; - - /* The cached address for the next shm16read file read */ - u32 shm16read_routing_next; - u32 shm16read_addr_next; - /* The cached address for the next shm32read file read */ - u32 shm32read_routing_next; - u32 shm32read_addr_next; - - /* Enabled/Disabled list for the dynamic debugging features. */ - u32 dyn_debug[__B43_NR_DYNDBG]; - /* Dentries for the dynamic debugging entries. */ - struct dentry *dyn_debug_dentries[__B43_NR_DYNDBG]; -}; - -bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature); - -void b43_debugfs_init(void); -void b43_debugfs_exit(void); -void b43_debugfs_add_device(struct b43_wldev *dev); -void b43_debugfs_remove_device(struct b43_wldev *dev); -void b43_debugfs_log_txstat(struct b43_wldev *dev, - const struct b43_txstatus *status); - -#else /* CONFIG_B43_DEBUG */ - -static inline bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature) -{ - return 0; -} - -static inline void b43_debugfs_init(void) -{ -} -static inline void b43_debugfs_exit(void) -{ -} -static inline void b43_debugfs_add_device(struct b43_wldev *dev) -{ -} -static inline void b43_debugfs_remove_device(struct b43_wldev *dev) -{ -} -static inline void b43_debugfs_log_txstat(struct b43_wldev *dev, - const struct b43_txstatus *status) -{ -} - -#endif /* CONFIG_B43_DEBUG */ - -#endif /* B43_DEBUGFS_H_ */ diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c deleted file mode 100644 index f7c70b3a6ea9..000000000000 --- a/drivers/net/wireless/b43/dma.c +++ /dev/null @@ -1,1834 +0,0 @@ -/* - - Broadcom B43 wireless driver - - DMA ringbuffer and descriptor allocation/management - - Copyright (c) 2005, 2006 Michael Buesch - - Some code in this file is derived from the b44.c driver - Copyright (C) 2002 David S. Miller - Copyright (C) Pekka Pietikainen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "dma.h" -#include "main.h" -#include "debugfs.h" -#include "xmit.h" - -#include -#include -#include -#include -#include -#include -#include - - -/* Required number of TX DMA slots per TX frame. - * This currently is 2, because we put the header and the ieee80211 frame - * into separate slots. */ -#define TX_SLOTS_PER_FRAME 2 - -static u32 b43_dma_address(struct b43_dma *dma, dma_addr_t dmaaddr, - enum b43_addrtype addrtype) -{ - u32 uninitialized_var(addr); - - switch (addrtype) { - case B43_DMA_ADDR_LOW: - addr = lower_32_bits(dmaaddr); - if (dma->translation_in_low) { - addr &= ~SSB_DMA_TRANSLATION_MASK; - addr |= dma->translation; - } - break; - case B43_DMA_ADDR_HIGH: - addr = upper_32_bits(dmaaddr); - if (!dma->translation_in_low) { - addr &= ~SSB_DMA_TRANSLATION_MASK; - addr |= dma->translation; - } - break; - case B43_DMA_ADDR_EXT: - if (dma->translation_in_low) - addr = lower_32_bits(dmaaddr); - else - addr = upper_32_bits(dmaaddr); - addr &= SSB_DMA_TRANSLATION_MASK; - addr >>= SSB_DMA_TRANSLATION_SHIFT; - break; - } - - return addr; -} - -/* 32bit DMA ops. */ -static -struct b43_dmadesc_generic *op32_idx2desc(struct b43_dmaring *ring, - int slot, - struct b43_dmadesc_meta **meta) -{ - struct b43_dmadesc32 *desc; - - *meta = &(ring->meta[slot]); - desc = ring->descbase; - desc = &(desc[slot]); - - return (struct b43_dmadesc_generic *)desc; -} - -static void op32_fill_descriptor(struct b43_dmaring *ring, - struct b43_dmadesc_generic *desc, - dma_addr_t dmaaddr, u16 bufsize, - int start, int end, int irq) -{ - struct b43_dmadesc32 *descbase = ring->descbase; - int slot; - u32 ctl; - u32 addr; - u32 addrext; - - slot = (int)(&(desc->dma32) - descbase); - B43_WARN_ON(!(slot >= 0 && slot < ring->nr_slots)); - - addr = b43_dma_address(&ring->dev->dma, dmaaddr, B43_DMA_ADDR_LOW); - addrext = b43_dma_address(&ring->dev->dma, dmaaddr, B43_DMA_ADDR_EXT); - - ctl = bufsize & B43_DMA32_DCTL_BYTECNT; - if (slot == ring->nr_slots - 1) - ctl |= B43_DMA32_DCTL_DTABLEEND; - if (start) - ctl |= B43_DMA32_DCTL_FRAMESTART; - if (end) - ctl |= B43_DMA32_DCTL_FRAMEEND; - if (irq) - ctl |= B43_DMA32_DCTL_IRQ; - ctl |= (addrext << B43_DMA32_DCTL_ADDREXT_SHIFT) - & B43_DMA32_DCTL_ADDREXT_MASK; - - desc->dma32.control = cpu_to_le32(ctl); - desc->dma32.address = cpu_to_le32(addr); -} - -static void op32_poke_tx(struct b43_dmaring *ring, int slot) -{ - b43_dma_write(ring, B43_DMA32_TXINDEX, - (u32) (slot * sizeof(struct b43_dmadesc32))); -} - -static void op32_tx_suspend(struct b43_dmaring *ring) -{ - b43_dma_write(ring, B43_DMA32_TXCTL, b43_dma_read(ring, B43_DMA32_TXCTL) - | B43_DMA32_TXSUSPEND); -} - -static void op32_tx_resume(struct b43_dmaring *ring) -{ - b43_dma_write(ring, B43_DMA32_TXCTL, b43_dma_read(ring, B43_DMA32_TXCTL) - & ~B43_DMA32_TXSUSPEND); -} - -static int op32_get_current_rxslot(struct b43_dmaring *ring) -{ - u32 val; - - val = b43_dma_read(ring, B43_DMA32_RXSTATUS); - val &= B43_DMA32_RXDPTR; - - return (val / sizeof(struct b43_dmadesc32)); -} - -static void op32_set_current_rxslot(struct b43_dmaring *ring, int slot) -{ - b43_dma_write(ring, B43_DMA32_RXINDEX, - (u32) (slot * sizeof(struct b43_dmadesc32))); -} - -static const struct b43_dma_ops dma32_ops = { - .idx2desc = op32_idx2desc, - .fill_descriptor = op32_fill_descriptor, - .poke_tx = op32_poke_tx, - .tx_suspend = op32_tx_suspend, - .tx_resume = op32_tx_resume, - .get_current_rxslot = op32_get_current_rxslot, - .set_current_rxslot = op32_set_current_rxslot, -}; - -/* 64bit DMA ops. */ -static -struct b43_dmadesc_generic *op64_idx2desc(struct b43_dmaring *ring, - int slot, - struct b43_dmadesc_meta **meta) -{ - struct b43_dmadesc64 *desc; - - *meta = &(ring->meta[slot]); - desc = ring->descbase; - desc = &(desc[slot]); - - return (struct b43_dmadesc_generic *)desc; -} - -static void op64_fill_descriptor(struct b43_dmaring *ring, - struct b43_dmadesc_generic *desc, - dma_addr_t dmaaddr, u16 bufsize, - int start, int end, int irq) -{ - struct b43_dmadesc64 *descbase = ring->descbase; - int slot; - u32 ctl0 = 0, ctl1 = 0; - u32 addrlo, addrhi; - u32 addrext; - - slot = (int)(&(desc->dma64) - descbase); - B43_WARN_ON(!(slot >= 0 && slot < ring->nr_slots)); - - addrlo = b43_dma_address(&ring->dev->dma, dmaaddr, B43_DMA_ADDR_LOW); - addrhi = b43_dma_address(&ring->dev->dma, dmaaddr, B43_DMA_ADDR_HIGH); - addrext = b43_dma_address(&ring->dev->dma, dmaaddr, B43_DMA_ADDR_EXT); - - if (slot == ring->nr_slots - 1) - ctl0 |= B43_DMA64_DCTL0_DTABLEEND; - if (start) - ctl0 |= B43_DMA64_DCTL0_FRAMESTART; - if (end) - ctl0 |= B43_DMA64_DCTL0_FRAMEEND; - if (irq) - ctl0 |= B43_DMA64_DCTL0_IRQ; - ctl1 |= bufsize & B43_DMA64_DCTL1_BYTECNT; - ctl1 |= (addrext << B43_DMA64_DCTL1_ADDREXT_SHIFT) - & B43_DMA64_DCTL1_ADDREXT_MASK; - - desc->dma64.control0 = cpu_to_le32(ctl0); - desc->dma64.control1 = cpu_to_le32(ctl1); - desc->dma64.address_low = cpu_to_le32(addrlo); - desc->dma64.address_high = cpu_to_le32(addrhi); -} - -static void op64_poke_tx(struct b43_dmaring *ring, int slot) -{ - b43_dma_write(ring, B43_DMA64_TXINDEX, - (u32) (slot * sizeof(struct b43_dmadesc64))); -} - -static void op64_tx_suspend(struct b43_dmaring *ring) -{ - b43_dma_write(ring, B43_DMA64_TXCTL, b43_dma_read(ring, B43_DMA64_TXCTL) - | B43_DMA64_TXSUSPEND); -} - -static void op64_tx_resume(struct b43_dmaring *ring) -{ - b43_dma_write(ring, B43_DMA64_TXCTL, b43_dma_read(ring, B43_DMA64_TXCTL) - & ~B43_DMA64_TXSUSPEND); -} - -static int op64_get_current_rxslot(struct b43_dmaring *ring) -{ - u32 val; - - val = b43_dma_read(ring, B43_DMA64_RXSTATUS); - val &= B43_DMA64_RXSTATDPTR; - - return (val / sizeof(struct b43_dmadesc64)); -} - -static void op64_set_current_rxslot(struct b43_dmaring *ring, int slot) -{ - b43_dma_write(ring, B43_DMA64_RXINDEX, - (u32) (slot * sizeof(struct b43_dmadesc64))); -} - -static const struct b43_dma_ops dma64_ops = { - .idx2desc = op64_idx2desc, - .fill_descriptor = op64_fill_descriptor, - .poke_tx = op64_poke_tx, - .tx_suspend = op64_tx_suspend, - .tx_resume = op64_tx_resume, - .get_current_rxslot = op64_get_current_rxslot, - .set_current_rxslot = op64_set_current_rxslot, -}; - -static inline int free_slots(struct b43_dmaring *ring) -{ - return (ring->nr_slots - ring->used_slots); -} - -static inline int next_slot(struct b43_dmaring *ring, int slot) -{ - B43_WARN_ON(!(slot >= -1 && slot <= ring->nr_slots - 1)); - if (slot == ring->nr_slots - 1) - return 0; - return slot + 1; -} - -static inline int prev_slot(struct b43_dmaring *ring, int slot) -{ - B43_WARN_ON(!(slot >= 0 && slot <= ring->nr_slots - 1)); - if (slot == 0) - return ring->nr_slots - 1; - return slot - 1; -} - -#ifdef CONFIG_B43_DEBUG -static void update_max_used_slots(struct b43_dmaring *ring, - int current_used_slots) -{ - if (current_used_slots <= ring->max_used_slots) - return; - ring->max_used_slots = current_used_slots; - if (b43_debug(ring->dev, B43_DBG_DMAVERBOSE)) { - b43dbg(ring->dev->wl, - "max_used_slots increased to %d on %s ring %d\n", - ring->max_used_slots, - ring->tx ? "TX" : "RX", ring->index); - } -} -#else -static inline - void update_max_used_slots(struct b43_dmaring *ring, int current_used_slots) -{ -} -#endif /* DEBUG */ - -/* Request a slot for usage. */ -static inline int request_slot(struct b43_dmaring *ring) -{ - int slot; - - B43_WARN_ON(!ring->tx); - B43_WARN_ON(ring->stopped); - B43_WARN_ON(free_slots(ring) == 0); - - slot = next_slot(ring, ring->current_slot); - ring->current_slot = slot; - ring->used_slots++; - - update_max_used_slots(ring, ring->used_slots); - - return slot; -} - -static u16 b43_dmacontroller_base(enum b43_dmatype type, int controller_idx) -{ - static const u16 map64[] = { - B43_MMIO_DMA64_BASE0, - B43_MMIO_DMA64_BASE1, - B43_MMIO_DMA64_BASE2, - B43_MMIO_DMA64_BASE3, - B43_MMIO_DMA64_BASE4, - B43_MMIO_DMA64_BASE5, - }; - static const u16 map32[] = { - B43_MMIO_DMA32_BASE0, - B43_MMIO_DMA32_BASE1, - B43_MMIO_DMA32_BASE2, - B43_MMIO_DMA32_BASE3, - B43_MMIO_DMA32_BASE4, - B43_MMIO_DMA32_BASE5, - }; - - if (type == B43_DMA_64BIT) { - B43_WARN_ON(!(controller_idx >= 0 && - controller_idx < ARRAY_SIZE(map64))); - return map64[controller_idx]; - } - B43_WARN_ON(!(controller_idx >= 0 && - controller_idx < ARRAY_SIZE(map32))); - return map32[controller_idx]; -} - -static inline - dma_addr_t map_descbuffer(struct b43_dmaring *ring, - unsigned char *buf, size_t len, int tx) -{ - dma_addr_t dmaaddr; - - if (tx) { - dmaaddr = dma_map_single(ring->dev->dev->dma_dev, - buf, len, DMA_TO_DEVICE); - } else { - dmaaddr = dma_map_single(ring->dev->dev->dma_dev, - buf, len, DMA_FROM_DEVICE); - } - - return dmaaddr; -} - -static inline - void unmap_descbuffer(struct b43_dmaring *ring, - dma_addr_t addr, size_t len, int tx) -{ - if (tx) { - dma_unmap_single(ring->dev->dev->dma_dev, - addr, len, DMA_TO_DEVICE); - } else { - dma_unmap_single(ring->dev->dev->dma_dev, - addr, len, DMA_FROM_DEVICE); - } -} - -static inline - void sync_descbuffer_for_cpu(struct b43_dmaring *ring, - dma_addr_t addr, size_t len) -{ - B43_WARN_ON(ring->tx); - dma_sync_single_for_cpu(ring->dev->dev->dma_dev, - addr, len, DMA_FROM_DEVICE); -} - -static inline - void sync_descbuffer_for_device(struct b43_dmaring *ring, - dma_addr_t addr, size_t len) -{ - B43_WARN_ON(ring->tx); - dma_sync_single_for_device(ring->dev->dev->dma_dev, - addr, len, DMA_FROM_DEVICE); -} - -static inline - void free_descriptor_buffer(struct b43_dmaring *ring, - struct b43_dmadesc_meta *meta) -{ - if (meta->skb) { - if (ring->tx) - ieee80211_free_txskb(ring->dev->wl->hw, meta->skb); - else - dev_kfree_skb_any(meta->skb); - meta->skb = NULL; - } -} - -static int alloc_ringmemory(struct b43_dmaring *ring) -{ - /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K - * alignment and 8K buffers for 64-bit DMA with 8K alignment. - * In practice we could use smaller buffers for the latter, but the - * alignment is really important because of the hardware bug. If bit - * 0x00001000 is used in DMA address, some hardware (like BCM4331) - * copies that bit into B43_DMA64_RXSTATUS and we get false values from - * B43_DMA64_RXSTATDPTR. Let's just use 8K buffers even if we don't use - * more than 256 slots for ring. - */ - u16 ring_mem_size = (ring->type == B43_DMA_64BIT) ? - B43_DMA64_RINGMEMSIZE : B43_DMA32_RINGMEMSIZE; - - ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev, - ring_mem_size, &(ring->dmabase), - GFP_KERNEL | __GFP_ZERO); - if (!ring->descbase) - return -ENOMEM; - - return 0; -} - -static void free_ringmemory(struct b43_dmaring *ring) -{ - u16 ring_mem_size = (ring->type == B43_DMA_64BIT) ? - B43_DMA64_RINGMEMSIZE : B43_DMA32_RINGMEMSIZE; - dma_free_coherent(ring->dev->dev->dma_dev, ring_mem_size, - ring->descbase, ring->dmabase); -} - -/* Reset the RX DMA channel */ -static int b43_dmacontroller_rx_reset(struct b43_wldev *dev, u16 mmio_base, - enum b43_dmatype type) -{ - int i; - u32 value; - u16 offset; - - might_sleep(); - - offset = (type == B43_DMA_64BIT) ? B43_DMA64_RXCTL : B43_DMA32_RXCTL; - b43_write32(dev, mmio_base + offset, 0); - for (i = 0; i < 10; i++) { - offset = (type == B43_DMA_64BIT) ? B43_DMA64_RXSTATUS : - B43_DMA32_RXSTATUS; - value = b43_read32(dev, mmio_base + offset); - if (type == B43_DMA_64BIT) { - value &= B43_DMA64_RXSTAT; - if (value == B43_DMA64_RXSTAT_DISABLED) { - i = -1; - break; - } - } else { - value &= B43_DMA32_RXSTATE; - if (value == B43_DMA32_RXSTAT_DISABLED) { - i = -1; - break; - } - } - msleep(1); - } - if (i != -1) { - b43err(dev->wl, "DMA RX reset timed out\n"); - return -ENODEV; - } - - return 0; -} - -/* Reset the TX DMA channel */ -static int b43_dmacontroller_tx_reset(struct b43_wldev *dev, u16 mmio_base, - enum b43_dmatype type) -{ - int i; - u32 value; - u16 offset; - - might_sleep(); - - for (i = 0; i < 10; i++) { - offset = (type == B43_DMA_64BIT) ? B43_DMA64_TXSTATUS : - B43_DMA32_TXSTATUS; - value = b43_read32(dev, mmio_base + offset); - if (type == B43_DMA_64BIT) { - value &= B43_DMA64_TXSTAT; - if (value == B43_DMA64_TXSTAT_DISABLED || - value == B43_DMA64_TXSTAT_IDLEWAIT || - value == B43_DMA64_TXSTAT_STOPPED) - break; - } else { - value &= B43_DMA32_TXSTATE; - if (value == B43_DMA32_TXSTAT_DISABLED || - value == B43_DMA32_TXSTAT_IDLEWAIT || - value == B43_DMA32_TXSTAT_STOPPED) - break; - } - msleep(1); - } - offset = (type == B43_DMA_64BIT) ? B43_DMA64_TXCTL : B43_DMA32_TXCTL; - b43_write32(dev, mmio_base + offset, 0); - for (i = 0; i < 10; i++) { - offset = (type == B43_DMA_64BIT) ? B43_DMA64_TXSTATUS : - B43_DMA32_TXSTATUS; - value = b43_read32(dev, mmio_base + offset); - if (type == B43_DMA_64BIT) { - value &= B43_DMA64_TXSTAT; - if (value == B43_DMA64_TXSTAT_DISABLED) { - i = -1; - break; - } - } else { - value &= B43_DMA32_TXSTATE; - if (value == B43_DMA32_TXSTAT_DISABLED) { - i = -1; - break; - } - } - msleep(1); - } - if (i != -1) { - b43err(dev->wl, "DMA TX reset timed out\n"); - return -ENODEV; - } - /* ensure the reset is completed. */ - msleep(1); - - return 0; -} - -/* Check if a DMA mapping address is invalid. */ -static bool b43_dma_mapping_error(struct b43_dmaring *ring, - dma_addr_t addr, - size_t buffersize, bool dma_to_device) -{ - if (unlikely(dma_mapping_error(ring->dev->dev->dma_dev, addr))) - return 1; - - switch (ring->type) { - case B43_DMA_30BIT: - if ((u64)addr + buffersize > (1ULL << 30)) - goto address_error; - break; - case B43_DMA_32BIT: - if ((u64)addr + buffersize > (1ULL << 32)) - goto address_error; - break; - case B43_DMA_64BIT: - /* Currently we can't have addresses beyond - * 64bit in the kernel. */ - break; - } - - /* The address is OK. */ - return 0; - -address_error: - /* We can't support this address. Unmap it again. */ - unmap_descbuffer(ring, addr, buffersize, dma_to_device); - - return 1; -} - -static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb) -{ - unsigned char *f = skb->data + ring->frameoffset; - - return ((f[0] & f[1] & f[2] & f[3] & f[4] & f[5] & f[6] & f[7]) == 0xFF); -} - -static void b43_poison_rx_buffer(struct b43_dmaring *ring, struct sk_buff *skb) -{ - struct b43_rxhdr_fw4 *rxhdr; - unsigned char *frame; - - /* This poisons the RX buffer to detect DMA failures. */ - - rxhdr = (struct b43_rxhdr_fw4 *)(skb->data); - rxhdr->frame_len = 0; - - B43_WARN_ON(ring->rx_buffersize < ring->frameoffset + sizeof(struct b43_plcp_hdr6) + 2); - frame = skb->data + ring->frameoffset; - memset(frame, 0xFF, sizeof(struct b43_plcp_hdr6) + 2 /* padding */); -} - -static int setup_rx_descbuffer(struct b43_dmaring *ring, - struct b43_dmadesc_generic *desc, - struct b43_dmadesc_meta *meta, gfp_t gfp_flags) -{ - dma_addr_t dmaaddr; - struct sk_buff *skb; - - B43_WARN_ON(ring->tx); - - skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); - if (unlikely(!skb)) - return -ENOMEM; - b43_poison_rx_buffer(ring, skb); - dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0); - if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { - /* ugh. try to realloc in zone_dma */ - gfp_flags |= GFP_DMA; - - dev_kfree_skb_any(skb); - - skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); - if (unlikely(!skb)) - return -ENOMEM; - b43_poison_rx_buffer(ring, skb); - dmaaddr = map_descbuffer(ring, skb->data, - ring->rx_buffersize, 0); - if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { - b43err(ring->dev->wl, "RX DMA buffer allocation failed\n"); - dev_kfree_skb_any(skb); - return -EIO; - } - } - - meta->skb = skb; - meta->dmaaddr = dmaaddr; - ring->ops->fill_descriptor(ring, desc, dmaaddr, - ring->rx_buffersize, 0, 0, 0); - - return 0; -} - -/* Allocate the initial descbuffers. - * This is used for an RX ring only. - */ -static int alloc_initial_descbuffers(struct b43_dmaring *ring) -{ - int i, err = -ENOMEM; - struct b43_dmadesc_generic *desc; - struct b43_dmadesc_meta *meta; - - for (i = 0; i < ring->nr_slots; i++) { - desc = ring->ops->idx2desc(ring, i, &meta); - - err = setup_rx_descbuffer(ring, desc, meta, GFP_KERNEL); - if (err) { - b43err(ring->dev->wl, - "Failed to allocate initial descbuffers\n"); - goto err_unwind; - } - } - mb(); - ring->used_slots = ring->nr_slots; - err = 0; - out: - return err; - - err_unwind: - for (i--; i >= 0; i--) { - desc = ring->ops->idx2desc(ring, i, &meta); - - unmap_descbuffer(ring, meta->dmaaddr, ring->rx_buffersize, 0); - dev_kfree_skb(meta->skb); - } - goto out; -} - -/* Do initial setup of the DMA controller. - * Reset the controller, write the ring busaddress - * and switch the "enable" bit on. - */ -static int dmacontroller_setup(struct b43_dmaring *ring) -{ - int err = 0; - u32 value; - u32 addrext; - bool parity = ring->dev->dma.parity; - u32 addrlo; - u32 addrhi; - - if (ring->tx) { - if (ring->type == B43_DMA_64BIT) { - u64 ringbase = (u64) (ring->dmabase); - addrext = b43_dma_address(&ring->dev->dma, ringbase, B43_DMA_ADDR_EXT); - addrlo = b43_dma_address(&ring->dev->dma, ringbase, B43_DMA_ADDR_LOW); - addrhi = b43_dma_address(&ring->dev->dma, ringbase, B43_DMA_ADDR_HIGH); - - value = B43_DMA64_TXENABLE; - value |= (addrext << B43_DMA64_TXADDREXT_SHIFT) - & B43_DMA64_TXADDREXT_MASK; - if (!parity) - value |= B43_DMA64_TXPARITYDISABLE; - b43_dma_write(ring, B43_DMA64_TXCTL, value); - b43_dma_write(ring, B43_DMA64_TXRINGLO, addrlo); - b43_dma_write(ring, B43_DMA64_TXRINGHI, addrhi); - } else { - u32 ringbase = (u32) (ring->dmabase); - addrext = b43_dma_address(&ring->dev->dma, ringbase, B43_DMA_ADDR_EXT); - addrlo = b43_dma_address(&ring->dev->dma, ringbase, B43_DMA_ADDR_LOW); - - value = B43_DMA32_TXENABLE; - value |= (addrext << B43_DMA32_TXADDREXT_SHIFT) - & B43_DMA32_TXADDREXT_MASK; - if (!parity) - value |= B43_DMA32_TXPARITYDISABLE; - b43_dma_write(ring, B43_DMA32_TXCTL, value); - b43_dma_write(ring, B43_DMA32_TXRING, addrlo); - } - } else { - err = alloc_initial_descbuffers(ring); - if (err) - goto out; - if (ring->type == B43_DMA_64BIT) { - u64 ringbase = (u64) (ring->dmabase); - addrext = b43_dma_address(&ring->dev->dma, ringbase, B43_DMA_ADDR_EXT); - addrlo = b43_dma_address(&ring->dev->dma, ringbase, B43_DMA_ADDR_LOW); - addrhi = b43_dma_address(&ring->dev->dma, ringbase, B43_DMA_ADDR_HIGH); - - value = (ring->frameoffset << B43_DMA64_RXFROFF_SHIFT); - value |= B43_DMA64_RXENABLE; - value |= (addrext << B43_DMA64_RXADDREXT_SHIFT) - & B43_DMA64_RXADDREXT_MASK; - if (!parity) - value |= B43_DMA64_RXPARITYDISABLE; - b43_dma_write(ring, B43_DMA64_RXCTL, value); - b43_dma_write(ring, B43_DMA64_RXRINGLO, addrlo); - b43_dma_write(ring, B43_DMA64_RXRINGHI, addrhi); - b43_dma_write(ring, B43_DMA64_RXINDEX, ring->nr_slots * - sizeof(struct b43_dmadesc64)); - } else { - u32 ringbase = (u32) (ring->dmabase); - addrext = b43_dma_address(&ring->dev->dma, ringbase, B43_DMA_ADDR_EXT); - addrlo = b43_dma_address(&ring->dev->dma, ringbase, B43_DMA_ADDR_LOW); - - value = (ring->frameoffset << B43_DMA32_RXFROFF_SHIFT); - value |= B43_DMA32_RXENABLE; - value |= (addrext << B43_DMA32_RXADDREXT_SHIFT) - & B43_DMA32_RXADDREXT_MASK; - if (!parity) - value |= B43_DMA32_RXPARITYDISABLE; - b43_dma_write(ring, B43_DMA32_RXCTL, value); - b43_dma_write(ring, B43_DMA32_RXRING, addrlo); - b43_dma_write(ring, B43_DMA32_RXINDEX, ring->nr_slots * - sizeof(struct b43_dmadesc32)); - } - } - -out: - return err; -} - -/* Shutdown the DMA controller. */ -static void dmacontroller_cleanup(struct b43_dmaring *ring) -{ - if (ring->tx) { - b43_dmacontroller_tx_reset(ring->dev, ring->mmio_base, - ring->type); - if (ring->type == B43_DMA_64BIT) { - b43_dma_write(ring, B43_DMA64_TXRINGLO, 0); - b43_dma_write(ring, B43_DMA64_TXRINGHI, 0); - } else - b43_dma_write(ring, B43_DMA32_TXRING, 0); - } else { - b43_dmacontroller_rx_reset(ring->dev, ring->mmio_base, - ring->type); - if (ring->type == B43_DMA_64BIT) { - b43_dma_write(ring, B43_DMA64_RXRINGLO, 0); - b43_dma_write(ring, B43_DMA64_RXRINGHI, 0); - } else - b43_dma_write(ring, B43_DMA32_RXRING, 0); - } -} - -static void free_all_descbuffers(struct b43_dmaring *ring) -{ - struct b43_dmadesc_meta *meta; - int i; - - if (!ring->used_slots) - return; - for (i = 0; i < ring->nr_slots; i++) { - /* get meta - ignore returned value */ - ring->ops->idx2desc(ring, i, &meta); - - if (!meta->skb || b43_dma_ptr_is_poisoned(meta->skb)) { - B43_WARN_ON(!ring->tx); - continue; - } - if (ring->tx) { - unmap_descbuffer(ring, meta->dmaaddr, - meta->skb->len, 1); - } else { - unmap_descbuffer(ring, meta->dmaaddr, - ring->rx_buffersize, 0); - } - free_descriptor_buffer(ring, meta); - } -} - -static u64 supported_dma_mask(struct b43_wldev *dev) -{ - u32 tmp; - u16 mmio_base; - - switch (dev->dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - tmp = bcma_aread32(dev->dev->bdev, BCMA_IOST); - if (tmp & BCMA_IOST_DMA64) - return DMA_BIT_MASK(64); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - tmp = ssb_read32(dev->dev->sdev, SSB_TMSHIGH); - if (tmp & SSB_TMSHIGH_DMA64) - return DMA_BIT_MASK(64); - break; -#endif - } - - mmio_base = b43_dmacontroller_base(0, 0); - b43_write32(dev, mmio_base + B43_DMA32_TXCTL, B43_DMA32_TXADDREXT_MASK); - tmp = b43_read32(dev, mmio_base + B43_DMA32_TXCTL); - if (tmp & B43_DMA32_TXADDREXT_MASK) - return DMA_BIT_MASK(32); - - return DMA_BIT_MASK(30); -} - -static enum b43_dmatype dma_mask_to_engine_type(u64 dmamask) -{ - if (dmamask == DMA_BIT_MASK(30)) - return B43_DMA_30BIT; - if (dmamask == DMA_BIT_MASK(32)) - return B43_DMA_32BIT; - if (dmamask == DMA_BIT_MASK(64)) - return B43_DMA_64BIT; - B43_WARN_ON(1); - return B43_DMA_30BIT; -} - -/* Main initialization function. */ -static -struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, - int controller_index, - int for_tx, - enum b43_dmatype type) -{ - struct b43_dmaring *ring; - int i, err; - dma_addr_t dma_test; - - ring = kzalloc(sizeof(*ring), GFP_KERNEL); - if (!ring) - goto out; - - ring->nr_slots = B43_RXRING_SLOTS; - if (for_tx) - ring->nr_slots = B43_TXRING_SLOTS; - - ring->meta = kcalloc(ring->nr_slots, sizeof(struct b43_dmadesc_meta), - GFP_KERNEL); - if (!ring->meta) - goto err_kfree_ring; - for (i = 0; i < ring->nr_slots; i++) - ring->meta->skb = B43_DMA_PTR_POISON; - - ring->type = type; - ring->dev = dev; - ring->mmio_base = b43_dmacontroller_base(type, controller_index); - ring->index = controller_index; - if (type == B43_DMA_64BIT) - ring->ops = &dma64_ops; - else - ring->ops = &dma32_ops; - if (for_tx) { - ring->tx = true; - ring->current_slot = -1; - } else { - if (ring->index == 0) { - switch (dev->fw.hdr_format) { - case B43_FW_HDR_598: - ring->rx_buffersize = B43_DMA0_RX_FW598_BUFSIZE; - ring->frameoffset = B43_DMA0_RX_FW598_FO; - break; - case B43_FW_HDR_410: - case B43_FW_HDR_351: - ring->rx_buffersize = B43_DMA0_RX_FW351_BUFSIZE; - ring->frameoffset = B43_DMA0_RX_FW351_FO; - break; - } - } else - B43_WARN_ON(1); - } -#ifdef CONFIG_B43_DEBUG - ring->last_injected_overflow = jiffies; -#endif - - if (for_tx) { - /* Assumption: B43_TXRING_SLOTS can be divided by TX_SLOTS_PER_FRAME */ - BUILD_BUG_ON(B43_TXRING_SLOTS % TX_SLOTS_PER_FRAME != 0); - - ring->txhdr_cache = kcalloc(ring->nr_slots / TX_SLOTS_PER_FRAME, - b43_txhdr_size(dev), - GFP_KERNEL); - if (!ring->txhdr_cache) - goto err_kfree_meta; - - /* test for ability to dma to txhdr_cache */ - dma_test = dma_map_single(dev->dev->dma_dev, - ring->txhdr_cache, - b43_txhdr_size(dev), - DMA_TO_DEVICE); - - if (b43_dma_mapping_error(ring, dma_test, - b43_txhdr_size(dev), 1)) { - /* ugh realloc */ - kfree(ring->txhdr_cache); - ring->txhdr_cache = kcalloc(ring->nr_slots / TX_SLOTS_PER_FRAME, - b43_txhdr_size(dev), - GFP_KERNEL | GFP_DMA); - if (!ring->txhdr_cache) - goto err_kfree_meta; - - dma_test = dma_map_single(dev->dev->dma_dev, - ring->txhdr_cache, - b43_txhdr_size(dev), - DMA_TO_DEVICE); - - if (b43_dma_mapping_error(ring, dma_test, - b43_txhdr_size(dev), 1)) { - - b43err(dev->wl, - "TXHDR DMA allocation failed\n"); - goto err_kfree_txhdr_cache; - } - } - - dma_unmap_single(dev->dev->dma_dev, - dma_test, b43_txhdr_size(dev), - DMA_TO_DEVICE); - } - - err = alloc_ringmemory(ring); - if (err) - goto err_kfree_txhdr_cache; - err = dmacontroller_setup(ring); - if (err) - goto err_free_ringmemory; - - out: - return ring; - - err_free_ringmemory: - free_ringmemory(ring); - err_kfree_txhdr_cache: - kfree(ring->txhdr_cache); - err_kfree_meta: - kfree(ring->meta); - err_kfree_ring: - kfree(ring); - ring = NULL; - goto out; -} - -#define divide(a, b) ({ \ - typeof(a) __a = a; \ - do_div(__a, b); \ - __a; \ - }) - -#define modulo(a, b) ({ \ - typeof(a) __a = a; \ - do_div(__a, b); \ - }) - -/* Main cleanup function. */ -static void b43_destroy_dmaring(struct b43_dmaring *ring, - const char *ringname) -{ - if (!ring) - return; - -#ifdef CONFIG_B43_DEBUG - { - /* Print some statistics. */ - u64 failed_packets = ring->nr_failed_tx_packets; - u64 succeed_packets = ring->nr_succeed_tx_packets; - u64 nr_packets = failed_packets + succeed_packets; - u64 permille_failed = 0, average_tries = 0; - - if (nr_packets) - permille_failed = divide(failed_packets * 1000, nr_packets); - if (nr_packets) - average_tries = divide(ring->nr_total_packet_tries * 100, nr_packets); - - b43dbg(ring->dev->wl, "DMA-%u %s: " - "Used slots %d/%d, Failed frames %llu/%llu = %llu.%01llu%%, " - "Average tries %llu.%02llu\n", - (unsigned int)(ring->type), ringname, - ring->max_used_slots, - ring->nr_slots, - (unsigned long long)failed_packets, - (unsigned long long)nr_packets, - (unsigned long long)divide(permille_failed, 10), - (unsigned long long)modulo(permille_failed, 10), - (unsigned long long)divide(average_tries, 100), - (unsigned long long)modulo(average_tries, 100)); - } -#endif /* DEBUG */ - - /* Device IRQs are disabled prior entering this function, - * so no need to take care of concurrency with rx handler stuff. - */ - dmacontroller_cleanup(ring); - free_all_descbuffers(ring); - free_ringmemory(ring); - - kfree(ring->txhdr_cache); - kfree(ring->meta); - kfree(ring); -} - -#define destroy_ring(dma, ring) do { \ - b43_destroy_dmaring((dma)->ring, __stringify(ring)); \ - (dma)->ring = NULL; \ - } while (0) - -void b43_dma_free(struct b43_wldev *dev) -{ - struct b43_dma *dma; - - if (b43_using_pio_transfers(dev)) - return; - dma = &dev->dma; - - destroy_ring(dma, rx_ring); - destroy_ring(dma, tx_ring_AC_BK); - destroy_ring(dma, tx_ring_AC_BE); - destroy_ring(dma, tx_ring_AC_VI); - destroy_ring(dma, tx_ring_AC_VO); - destroy_ring(dma, tx_ring_mcast); -} - -static int b43_dma_set_mask(struct b43_wldev *dev, u64 mask) -{ - u64 orig_mask = mask; - bool fallback = false; - int err; - - /* Try to set the DMA mask. If it fails, try falling back to a - * lower mask, as we can always also support a lower one. */ - while (1) { - err = dma_set_mask(dev->dev->dma_dev, mask); - if (!err) { - err = dma_set_coherent_mask(dev->dev->dma_dev, mask); - if (!err) - break; - } - if (mask == DMA_BIT_MASK(64)) { - mask = DMA_BIT_MASK(32); - fallback = true; - continue; - } - if (mask == DMA_BIT_MASK(32)) { - mask = DMA_BIT_MASK(30); - fallback = true; - continue; - } - b43err(dev->wl, "The machine/kernel does not support " - "the required %u-bit DMA mask\n", - (unsigned int)dma_mask_to_engine_type(orig_mask)); - return -EOPNOTSUPP; - } - if (fallback) { - b43info(dev->wl, "DMA mask fallback from %u-bit to %u-bit\n", - (unsigned int)dma_mask_to_engine_type(orig_mask), - (unsigned int)dma_mask_to_engine_type(mask)); - } - - return 0; -} - -/* Some hardware with 64-bit DMA seems to be bugged and looks for translation - * bit in low address word instead of high one. - */ -static bool b43_dma_translation_in_low_word(struct b43_wldev *dev, - enum b43_dmatype type) -{ - if (type != B43_DMA_64BIT) - return 1; - -#ifdef CONFIG_B43_SSB - if (dev->dev->bus_type == B43_BUS_SSB && - dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI && - !(pci_is_pcie(dev->dev->sdev->bus->host_pci) && - ssb_read32(dev->dev->sdev, SSB_TMSHIGH) & SSB_TMSHIGH_DMA64)) - return 1; -#endif - return 0; -} - -int b43_dma_init(struct b43_wldev *dev) -{ - struct b43_dma *dma = &dev->dma; - int err; - u64 dmamask; - enum b43_dmatype type; - - dmamask = supported_dma_mask(dev); - type = dma_mask_to_engine_type(dmamask); - err = b43_dma_set_mask(dev, dmamask); - if (err) - return err; - - switch (dev->dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - dma->translation = bcma_core_dma_translation(dev->dev->bdev); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - dma->translation = ssb_dma_translation(dev->dev->sdev); - break; -#endif - } - dma->translation_in_low = b43_dma_translation_in_low_word(dev, type); - - dma->parity = true; -#ifdef CONFIG_B43_BCMA - /* TODO: find out which SSB devices need disabling parity */ - if (dev->dev->bus_type == B43_BUS_BCMA) - dma->parity = false; -#endif - - err = -ENOMEM; - /* setup TX DMA channels. */ - dma->tx_ring_AC_BK = b43_setup_dmaring(dev, 0, 1, type); - if (!dma->tx_ring_AC_BK) - goto out; - - dma->tx_ring_AC_BE = b43_setup_dmaring(dev, 1, 1, type); - if (!dma->tx_ring_AC_BE) - goto err_destroy_bk; - - dma->tx_ring_AC_VI = b43_setup_dmaring(dev, 2, 1, type); - if (!dma->tx_ring_AC_VI) - goto err_destroy_be; - - dma->tx_ring_AC_VO = b43_setup_dmaring(dev, 3, 1, type); - if (!dma->tx_ring_AC_VO) - goto err_destroy_vi; - - dma->tx_ring_mcast = b43_setup_dmaring(dev, 4, 1, type); - if (!dma->tx_ring_mcast) - goto err_destroy_vo; - - /* setup RX DMA channel. */ - dma->rx_ring = b43_setup_dmaring(dev, 0, 0, type); - if (!dma->rx_ring) - goto err_destroy_mcast; - - /* No support for the TX status DMA ring. */ - B43_WARN_ON(dev->dev->core_rev < 5); - - b43dbg(dev->wl, "%u-bit DMA initialized\n", - (unsigned int)type); - err = 0; -out: - return err; - -err_destroy_mcast: - destroy_ring(dma, tx_ring_mcast); -err_destroy_vo: - destroy_ring(dma, tx_ring_AC_VO); -err_destroy_vi: - destroy_ring(dma, tx_ring_AC_VI); -err_destroy_be: - destroy_ring(dma, tx_ring_AC_BE); -err_destroy_bk: - destroy_ring(dma, tx_ring_AC_BK); - return err; -} - -/* Generate a cookie for the TX header. */ -static u16 generate_cookie(struct b43_dmaring *ring, int slot) -{ - u16 cookie; - - /* Use the upper 4 bits of the cookie as - * DMA controller ID and store the slot number - * in the lower 12 bits. - * Note that the cookie must never be 0, as this - * is a special value used in RX path. - * It can also not be 0xFFFF because that is special - * for multicast frames. - */ - cookie = (((u16)ring->index + 1) << 12); - B43_WARN_ON(slot & ~0x0FFF); - cookie |= (u16)slot; - - return cookie; -} - -/* Inspect a cookie and find out to which controller/slot it belongs. */ -static -struct b43_dmaring *parse_cookie(struct b43_wldev *dev, u16 cookie, int *slot) -{ - struct b43_dma *dma = &dev->dma; - struct b43_dmaring *ring = NULL; - - switch (cookie & 0xF000) { - case 0x1000: - ring = dma->tx_ring_AC_BK; - break; - case 0x2000: - ring = dma->tx_ring_AC_BE; - break; - case 0x3000: - ring = dma->tx_ring_AC_VI; - break; - case 0x4000: - ring = dma->tx_ring_AC_VO; - break; - case 0x5000: - ring = dma->tx_ring_mcast; - break; - } - *slot = (cookie & 0x0FFF); - if (unlikely(!ring || *slot < 0 || *slot >= ring->nr_slots)) { - b43dbg(dev->wl, "TX-status contains " - "invalid cookie: 0x%04X\n", cookie); - return NULL; - } - - return ring; -} - -static int dma_tx_fragment(struct b43_dmaring *ring, - struct sk_buff *skb) -{ - const struct b43_dma_ops *ops = ring->ops; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct b43_private_tx_info *priv_info = b43_get_priv_tx_info(info); - u8 *header; - int slot, old_top_slot, old_used_slots; - int err; - struct b43_dmadesc_generic *desc; - struct b43_dmadesc_meta *meta; - struct b43_dmadesc_meta *meta_hdr; - u16 cookie; - size_t hdrsize = b43_txhdr_size(ring->dev); - - /* Important note: If the number of used DMA slots per TX frame - * is changed here, the TX_SLOTS_PER_FRAME definition at the top of - * the file has to be updated, too! - */ - - old_top_slot = ring->current_slot; - old_used_slots = ring->used_slots; - - /* Get a slot for the header. */ - slot = request_slot(ring); - desc = ops->idx2desc(ring, slot, &meta_hdr); - memset(meta_hdr, 0, sizeof(*meta_hdr)); - - header = &(ring->txhdr_cache[(slot / TX_SLOTS_PER_FRAME) * hdrsize]); - cookie = generate_cookie(ring, slot); - err = b43_generate_txhdr(ring->dev, header, - skb, info, cookie); - if (unlikely(err)) { - ring->current_slot = old_top_slot; - ring->used_slots = old_used_slots; - return err; - } - - meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header, - hdrsize, 1); - if (b43_dma_mapping_error(ring, meta_hdr->dmaaddr, hdrsize, 1)) { - ring->current_slot = old_top_slot; - ring->used_slots = old_used_slots; - return -EIO; - } - ops->fill_descriptor(ring, desc, meta_hdr->dmaaddr, - hdrsize, 1, 0, 0); - - /* Get a slot for the payload. */ - slot = request_slot(ring); - desc = ops->idx2desc(ring, slot, &meta); - memset(meta, 0, sizeof(*meta)); - - meta->skb = skb; - meta->is_last_fragment = true; - priv_info->bouncebuffer = NULL; - - meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); - /* create a bounce buffer in zone_dma on mapping failure. */ - if (b43_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { - priv_info->bouncebuffer = kmemdup(skb->data, skb->len, - GFP_ATOMIC | GFP_DMA); - if (!priv_info->bouncebuffer) { - ring->current_slot = old_top_slot; - ring->used_slots = old_used_slots; - err = -ENOMEM; - goto out_unmap_hdr; - } - - meta->dmaaddr = map_descbuffer(ring, priv_info->bouncebuffer, skb->len, 1); - if (b43_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { - kfree(priv_info->bouncebuffer); - priv_info->bouncebuffer = NULL; - ring->current_slot = old_top_slot; - ring->used_slots = old_used_slots; - err = -EIO; - goto out_unmap_hdr; - } - } - - ops->fill_descriptor(ring, desc, meta->dmaaddr, skb->len, 0, 1, 1); - - if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { - /* Tell the firmware about the cookie of the last - * mcast frame, so it can clear the more-data bit in it. */ - b43_shm_write16(ring->dev, B43_SHM_SHARED, - B43_SHM_SH_MCASTCOOKIE, cookie); - } - /* Now transfer the whole frame. */ - wmb(); - ops->poke_tx(ring, next_slot(ring, slot)); - return 0; - -out_unmap_hdr: - unmap_descbuffer(ring, meta_hdr->dmaaddr, - hdrsize, 1); - return err; -} - -static inline int should_inject_overflow(struct b43_dmaring *ring) -{ -#ifdef CONFIG_B43_DEBUG - if (unlikely(b43_debug(ring->dev, B43_DBG_DMAOVERFLOW))) { - /* Check if we should inject another ringbuffer overflow - * to test handling of this situation in the stack. */ - unsigned long next_overflow; - - next_overflow = ring->last_injected_overflow + HZ; - if (time_after(jiffies, next_overflow)) { - ring->last_injected_overflow = jiffies; - b43dbg(ring->dev->wl, - "Injecting TX ring overflow on " - "DMA controller %d\n", ring->index); - return 1; - } - } -#endif /* CONFIG_B43_DEBUG */ - return 0; -} - -/* Static mapping of mac80211's queues (priorities) to b43 DMA rings. */ -static struct b43_dmaring *select_ring_by_priority(struct b43_wldev *dev, - u8 queue_prio) -{ - struct b43_dmaring *ring; - - if (dev->qos_enabled) { - /* 0 = highest priority */ - switch (queue_prio) { - default: - B43_WARN_ON(1); - /* fallthrough */ - case 0: - ring = dev->dma.tx_ring_AC_VO; - break; - case 1: - ring = dev->dma.tx_ring_AC_VI; - break; - case 2: - ring = dev->dma.tx_ring_AC_BE; - break; - case 3: - ring = dev->dma.tx_ring_AC_BK; - break; - } - } else - ring = dev->dma.tx_ring_AC_BE; - - return ring; -} - -int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb) -{ - struct b43_dmaring *ring; - struct ieee80211_hdr *hdr; - int err = 0; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - hdr = (struct ieee80211_hdr *)skb->data; - if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { - /* The multicast ring will be sent after the DTIM */ - ring = dev->dma.tx_ring_mcast; - /* Set the more-data bit. Ucode will clear it on - * the last frame for us. */ - hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA); - } else { - /* Decide by priority where to put this frame. */ - ring = select_ring_by_priority( - dev, skb_get_queue_mapping(skb)); - } - - B43_WARN_ON(!ring->tx); - - if (unlikely(ring->stopped)) { - /* We get here only because of a bug in mac80211. - * Because of a race, one packet may be queued after - * the queue is stopped, thus we got called when we shouldn't. - * For now, just refuse the transmit. */ - if (b43_debug(dev, B43_DBG_DMAVERBOSE)) - b43err(dev->wl, "Packet after queue stopped\n"); - err = -ENOSPC; - goto out; - } - - if (unlikely(WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME))) { - /* If we get here, we have a real error with the queue - * full, but queues not stopped. */ - b43err(dev->wl, "DMA queue overflow\n"); - err = -ENOSPC; - goto out; - } - - /* Assign the queue number to the ring (if not already done before) - * so TX status handling can use it. The queue to ring mapping is - * static, so we don't need to store it per frame. */ - ring->queue_prio = skb_get_queue_mapping(skb); - - err = dma_tx_fragment(ring, skb); - if (unlikely(err == -ENOKEY)) { - /* Drop this packet, as we don't have the encryption key - * anymore and must not transmit it unencrypted. */ - ieee80211_free_txskb(dev->wl->hw, skb); - err = 0; - goto out; - } - if (unlikely(err)) { - b43err(dev->wl, "DMA tx mapping failure\n"); - goto out; - } - if ((free_slots(ring) < TX_SLOTS_PER_FRAME) || - should_inject_overflow(ring)) { - /* This TX ring is full. */ - unsigned int skb_mapping = skb_get_queue_mapping(skb); - ieee80211_stop_queue(dev->wl->hw, skb_mapping); - dev->wl->tx_queue_stopped[skb_mapping] = 1; - ring->stopped = true; - if (b43_debug(dev, B43_DBG_DMAVERBOSE)) { - b43dbg(dev->wl, "Stopped TX ring %d\n", ring->index); - } - } -out: - - return err; -} - -void b43_dma_handle_txstatus(struct b43_wldev *dev, - const struct b43_txstatus *status) -{ - const struct b43_dma_ops *ops; - struct b43_dmaring *ring; - struct b43_dmadesc_meta *meta; - static const struct b43_txstatus fake; /* filled with 0 */ - const struct b43_txstatus *txstat; - int slot, firstused; - bool frame_succeed; - int skip; - static u8 err_out1, err_out2; - - ring = parse_cookie(dev, status->cookie, &slot); - if (unlikely(!ring)) - return; - B43_WARN_ON(!ring->tx); - - /* Sanity check: TX packets are processed in-order on one ring. - * Check if the slot deduced from the cookie really is the first - * used slot. */ - firstused = ring->current_slot - ring->used_slots + 1; - if (firstused < 0) - firstused = ring->nr_slots + firstused; - - skip = 0; - if (unlikely(slot != firstused)) { - /* This possibly is a firmware bug and will result in - * malfunction, memory leaks and/or stall of DMA functionality. - */ - if (slot == next_slot(ring, next_slot(ring, firstused))) { - /* If a single header/data pair was missed, skip over - * the first two slots in an attempt to recover. - */ - slot = firstused; - skip = 2; - if (!err_out1) { - /* Report the error once. */ - b43dbg(dev->wl, - "Skip on DMA ring %d slot %d.\n", - ring->index, slot); - err_out1 = 1; - } - } else { - /* More than a single header/data pair were missed. - * Report this error once. - */ - if (!err_out2) - b43dbg(dev->wl, - "Out of order TX status report on DMA ring %d. Expected %d, but got %d\n", - ring->index, firstused, slot); - err_out2 = 1; - return; - } - } - - ops = ring->ops; - while (1) { - B43_WARN_ON(slot < 0 || slot >= ring->nr_slots); - /* get meta - ignore returned value */ - ops->idx2desc(ring, slot, &meta); - - if (b43_dma_ptr_is_poisoned(meta->skb)) { - b43dbg(dev->wl, "Poisoned TX slot %d (first=%d) " - "on ring %d\n", - slot, firstused, ring->index); - break; - } - - if (meta->skb) { - struct b43_private_tx_info *priv_info = - b43_get_priv_tx_info(IEEE80211_SKB_CB(meta->skb)); - - unmap_descbuffer(ring, meta->dmaaddr, - meta->skb->len, 1); - kfree(priv_info->bouncebuffer); - priv_info->bouncebuffer = NULL; - } else { - unmap_descbuffer(ring, meta->dmaaddr, - b43_txhdr_size(dev), 1); - } - - if (meta->is_last_fragment) { - struct ieee80211_tx_info *info; - - if (unlikely(!meta->skb)) { - /* This is a scatter-gather fragment of a frame, - * so the skb pointer must not be NULL. - */ - b43dbg(dev->wl, "TX status unexpected NULL skb " - "at slot %d (first=%d) on ring %d\n", - slot, firstused, ring->index); - break; - } - - info = IEEE80211_SKB_CB(meta->skb); - - /* - * Call back to inform the ieee80211 subsystem about - * the status of the transmission. When skipping over - * a missed TX status report, use a status structure - * filled with zeros to indicate that the frame was not - * sent (frame_count 0) and not acknowledged - */ - if (unlikely(skip)) - txstat = &fake; - else - txstat = status; - - frame_succeed = b43_fill_txstatus_report(dev, info, - txstat); -#ifdef CONFIG_B43_DEBUG - if (frame_succeed) - ring->nr_succeed_tx_packets++; - else - ring->nr_failed_tx_packets++; - ring->nr_total_packet_tries += status->frame_count; -#endif /* DEBUG */ - ieee80211_tx_status(dev->wl->hw, meta->skb); - - /* skb will be freed by ieee80211_tx_status(). - * Poison our pointer. */ - meta->skb = B43_DMA_PTR_POISON; - } else { - /* No need to call free_descriptor_buffer here, as - * this is only the txhdr, which is not allocated. - */ - if (unlikely(meta->skb)) { - b43dbg(dev->wl, "TX status unexpected non-NULL skb " - "at slot %d (first=%d) on ring %d\n", - slot, firstused, ring->index); - break; - } - } - - /* Everything unmapped and free'd. So it's not used anymore. */ - ring->used_slots--; - - if (meta->is_last_fragment && !skip) { - /* This is the last scatter-gather - * fragment of the frame. We are done. */ - break; - } - slot = next_slot(ring, slot); - if (skip > 0) - --skip; - } - if (ring->stopped) { - B43_WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME); - ring->stopped = false; - } - - if (dev->wl->tx_queue_stopped[ring->queue_prio]) { - dev->wl->tx_queue_stopped[ring->queue_prio] = 0; - } else { - /* If the driver queue is running wake the corresponding - * mac80211 queue. */ - ieee80211_wake_queue(dev->wl->hw, ring->queue_prio); - if (b43_debug(dev, B43_DBG_DMAVERBOSE)) { - b43dbg(dev->wl, "Woke up TX ring %d\n", ring->index); - } - } - /* Add work to the queue. */ - ieee80211_queue_work(dev->wl->hw, &dev->wl->tx_work); -} - -static void dma_rx(struct b43_dmaring *ring, int *slot) -{ - const struct b43_dma_ops *ops = ring->ops; - struct b43_dmadesc_generic *desc; - struct b43_dmadesc_meta *meta; - struct b43_rxhdr_fw4 *rxhdr; - struct sk_buff *skb; - u16 len; - int err; - dma_addr_t dmaaddr; - - desc = ops->idx2desc(ring, *slot, &meta); - - sync_descbuffer_for_cpu(ring, meta->dmaaddr, ring->rx_buffersize); - skb = meta->skb; - - rxhdr = (struct b43_rxhdr_fw4 *)skb->data; - len = le16_to_cpu(rxhdr->frame_len); - if (len == 0) { - int i = 0; - - do { - udelay(2); - barrier(); - len = le16_to_cpu(rxhdr->frame_len); - } while (len == 0 && i++ < 5); - if (unlikely(len == 0)) { - dmaaddr = meta->dmaaddr; - goto drop_recycle_buffer; - } - } - if (unlikely(b43_rx_buffer_is_poisoned(ring, skb))) { - /* Something went wrong with the DMA. - * The device did not touch the buffer and did not overwrite the poison. */ - b43dbg(ring->dev->wl, "DMA RX: Dropping poisoned buffer.\n"); - dmaaddr = meta->dmaaddr; - goto drop_recycle_buffer; - } - if (unlikely(len + ring->frameoffset > ring->rx_buffersize)) { - /* The data did not fit into one descriptor buffer - * and is split over multiple buffers. - * This should never happen, as we try to allocate buffers - * big enough. So simply ignore this packet. - */ - int cnt = 0; - s32 tmp = len; - - while (1) { - desc = ops->idx2desc(ring, *slot, &meta); - /* recycle the descriptor buffer. */ - b43_poison_rx_buffer(ring, meta->skb); - sync_descbuffer_for_device(ring, meta->dmaaddr, - ring->rx_buffersize); - *slot = next_slot(ring, *slot); - cnt++; - tmp -= ring->rx_buffersize; - if (tmp <= 0) - break; - } - b43err(ring->dev->wl, "DMA RX buffer too small " - "(len: %u, buffer: %u, nr-dropped: %d)\n", - len, ring->rx_buffersize, cnt); - goto drop; - } - - dmaaddr = meta->dmaaddr; - err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC); - if (unlikely(err)) { - b43dbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer() failed\n"); - goto drop_recycle_buffer; - } - - unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); - skb_put(skb, len + ring->frameoffset); - skb_pull(skb, ring->frameoffset); - - b43_rx(ring->dev, skb, rxhdr); -drop: - return; - -drop_recycle_buffer: - /* Poison and recycle the RX buffer. */ - b43_poison_rx_buffer(ring, skb); - sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize); -} - -void b43_dma_handle_rx_overflow(struct b43_dmaring *ring) -{ - int current_slot, previous_slot; - - B43_WARN_ON(ring->tx); - - /* Device has filled all buffers, drop all packets and let TCP - * decrease speed. - * Decrement RX index by one will let the device to see all slots - * as free again - */ - /* - *TODO: How to increase rx_drop in mac80211? - */ - current_slot = ring->ops->get_current_rxslot(ring); - previous_slot = prev_slot(ring, current_slot); - ring->ops->set_current_rxslot(ring, previous_slot); -} - -void b43_dma_rx(struct b43_dmaring *ring) -{ - const struct b43_dma_ops *ops = ring->ops; - int slot, current_slot; - int used_slots = 0; - - B43_WARN_ON(ring->tx); - current_slot = ops->get_current_rxslot(ring); - B43_WARN_ON(!(current_slot >= 0 && current_slot < ring->nr_slots)); - - slot = ring->current_slot; - for (; slot != current_slot; slot = next_slot(ring, slot)) { - dma_rx(ring, &slot); - update_max_used_slots(ring, ++used_slots); - } - wmb(); - ops->set_current_rxslot(ring, slot); - ring->current_slot = slot; -} - -static void b43_dma_tx_suspend_ring(struct b43_dmaring *ring) -{ - B43_WARN_ON(!ring->tx); - ring->ops->tx_suspend(ring); -} - -static void b43_dma_tx_resume_ring(struct b43_dmaring *ring) -{ - B43_WARN_ON(!ring->tx); - ring->ops->tx_resume(ring); -} - -void b43_dma_tx_suspend(struct b43_wldev *dev) -{ - b43_power_saving_ctl_bits(dev, B43_PS_AWAKE); - b43_dma_tx_suspend_ring(dev->dma.tx_ring_AC_BK); - b43_dma_tx_suspend_ring(dev->dma.tx_ring_AC_BE); - b43_dma_tx_suspend_ring(dev->dma.tx_ring_AC_VI); - b43_dma_tx_suspend_ring(dev->dma.tx_ring_AC_VO); - b43_dma_tx_suspend_ring(dev->dma.tx_ring_mcast); -} - -void b43_dma_tx_resume(struct b43_wldev *dev) -{ - b43_dma_tx_resume_ring(dev->dma.tx_ring_mcast); - b43_dma_tx_resume_ring(dev->dma.tx_ring_AC_VO); - b43_dma_tx_resume_ring(dev->dma.tx_ring_AC_VI); - b43_dma_tx_resume_ring(dev->dma.tx_ring_AC_BE); - b43_dma_tx_resume_ring(dev->dma.tx_ring_AC_BK); - b43_power_saving_ctl_bits(dev, 0); -} - -static void direct_fifo_rx(struct b43_wldev *dev, enum b43_dmatype type, - u16 mmio_base, bool enable) -{ - u32 ctl; - - if (type == B43_DMA_64BIT) { - ctl = b43_read32(dev, mmio_base + B43_DMA64_RXCTL); - ctl &= ~B43_DMA64_RXDIRECTFIFO; - if (enable) - ctl |= B43_DMA64_RXDIRECTFIFO; - b43_write32(dev, mmio_base + B43_DMA64_RXCTL, ctl); - } else { - ctl = b43_read32(dev, mmio_base + B43_DMA32_RXCTL); - ctl &= ~B43_DMA32_RXDIRECTFIFO; - if (enable) - ctl |= B43_DMA32_RXDIRECTFIFO; - b43_write32(dev, mmio_base + B43_DMA32_RXCTL, ctl); - } -} - -/* Enable/Disable Direct FIFO Receive Mode (PIO) on a RX engine. - * This is called from PIO code, so DMA structures are not available. */ -void b43_dma_direct_fifo_rx(struct b43_wldev *dev, - unsigned int engine_index, bool enable) -{ - enum b43_dmatype type; - u16 mmio_base; - - type = dma_mask_to_engine_type(supported_dma_mask(dev)); - - mmio_base = b43_dmacontroller_base(type, engine_index); - direct_fifo_rx(dev, type, mmio_base, enable); -} diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h deleted file mode 100644 index df8c8cdcbdb5..000000000000 --- a/drivers/net/wireless/b43/dma.h +++ /dev/null @@ -1,305 +0,0 @@ -#ifndef B43_DMA_H_ -#define B43_DMA_H_ - -#include - -#include "b43.h" - - -/* DMA-Interrupt reasons. */ -#define B43_DMAIRQ_FATALMASK ((1 << 10) | (1 << 11) | (1 << 12) \ - | (1 << 14) | (1 << 15)) -#define B43_DMAIRQ_RDESC_UFLOW (1 << 13) -#define B43_DMAIRQ_RX_DONE (1 << 16) - -/*** 32-bit DMA Engine. ***/ - -/* 32-bit DMA controller registers. */ -#define B43_DMA32_TXCTL 0x00 -#define B43_DMA32_TXENABLE 0x00000001 -#define B43_DMA32_TXSUSPEND 0x00000002 -#define B43_DMA32_TXLOOPBACK 0x00000004 -#define B43_DMA32_TXFLUSH 0x00000010 -#define B43_DMA32_TXPARITYDISABLE 0x00000800 -#define B43_DMA32_TXADDREXT_MASK 0x00030000 -#define B43_DMA32_TXADDREXT_SHIFT 16 -#define B43_DMA32_TXRING 0x04 -#define B43_DMA32_TXINDEX 0x08 -#define B43_DMA32_TXSTATUS 0x0C -#define B43_DMA32_TXDPTR 0x00000FFF -#define B43_DMA32_TXSTATE 0x0000F000 -#define B43_DMA32_TXSTAT_DISABLED 0x00000000 -#define B43_DMA32_TXSTAT_ACTIVE 0x00001000 -#define B43_DMA32_TXSTAT_IDLEWAIT 0x00002000 -#define B43_DMA32_TXSTAT_STOPPED 0x00003000 -#define B43_DMA32_TXSTAT_SUSP 0x00004000 -#define B43_DMA32_TXERROR 0x000F0000 -#define B43_DMA32_TXERR_NOERR 0x00000000 -#define B43_DMA32_TXERR_PROT 0x00010000 -#define B43_DMA32_TXERR_UNDERRUN 0x00020000 -#define B43_DMA32_TXERR_BUFREAD 0x00030000 -#define B43_DMA32_TXERR_DESCREAD 0x00040000 -#define B43_DMA32_TXACTIVE 0xFFF00000 -#define B43_DMA32_RXCTL 0x10 -#define B43_DMA32_RXENABLE 0x00000001 -#define B43_DMA32_RXFROFF_MASK 0x000000FE -#define B43_DMA32_RXFROFF_SHIFT 1 -#define B43_DMA32_RXDIRECTFIFO 0x00000100 -#define B43_DMA32_RXPARITYDISABLE 0x00000800 -#define B43_DMA32_RXADDREXT_MASK 0x00030000 -#define B43_DMA32_RXADDREXT_SHIFT 16 -#define B43_DMA32_RXRING 0x14 -#define B43_DMA32_RXINDEX 0x18 -#define B43_DMA32_RXSTATUS 0x1C -#define B43_DMA32_RXDPTR 0x00000FFF -#define B43_DMA32_RXSTATE 0x0000F000 -#define B43_DMA32_RXSTAT_DISABLED 0x00000000 -#define B43_DMA32_RXSTAT_ACTIVE 0x00001000 -#define B43_DMA32_RXSTAT_IDLEWAIT 0x00002000 -#define B43_DMA32_RXSTAT_STOPPED 0x00003000 -#define B43_DMA32_RXERROR 0x000F0000 -#define B43_DMA32_RXERR_NOERR 0x00000000 -#define B43_DMA32_RXERR_PROT 0x00010000 -#define B43_DMA32_RXERR_OVERFLOW 0x00020000 -#define B43_DMA32_RXERR_BUFWRITE 0x00030000 -#define B43_DMA32_RXERR_DESCREAD 0x00040000 -#define B43_DMA32_RXACTIVE 0xFFF00000 - -/* 32-bit DMA descriptor. */ -struct b43_dmadesc32 { - __le32 control; - __le32 address; -} __packed; -#define B43_DMA32_DCTL_BYTECNT 0x00001FFF -#define B43_DMA32_DCTL_ADDREXT_MASK 0x00030000 -#define B43_DMA32_DCTL_ADDREXT_SHIFT 16 -#define B43_DMA32_DCTL_DTABLEEND 0x10000000 -#define B43_DMA32_DCTL_IRQ 0x20000000 -#define B43_DMA32_DCTL_FRAMEEND 0x40000000 -#define B43_DMA32_DCTL_FRAMESTART 0x80000000 - -/*** 64-bit DMA Engine. ***/ - -/* 64-bit DMA controller registers. */ -#define B43_DMA64_TXCTL 0x00 -#define B43_DMA64_TXENABLE 0x00000001 -#define B43_DMA64_TXSUSPEND 0x00000002 -#define B43_DMA64_TXLOOPBACK 0x00000004 -#define B43_DMA64_TXFLUSH 0x00000010 -#define B43_DMA64_TXPARITYDISABLE 0x00000800 -#define B43_DMA64_TXADDREXT_MASK 0x00030000 -#define B43_DMA64_TXADDREXT_SHIFT 16 -#define B43_DMA64_TXINDEX 0x04 -#define B43_DMA64_TXRINGLO 0x08 -#define B43_DMA64_TXRINGHI 0x0C -#define B43_DMA64_TXSTATUS 0x10 -#define B43_DMA64_TXSTATDPTR 0x00001FFF -#define B43_DMA64_TXSTAT 0xF0000000 -#define B43_DMA64_TXSTAT_DISABLED 0x00000000 -#define B43_DMA64_TXSTAT_ACTIVE 0x10000000 -#define B43_DMA64_TXSTAT_IDLEWAIT 0x20000000 -#define B43_DMA64_TXSTAT_STOPPED 0x30000000 -#define B43_DMA64_TXSTAT_SUSP 0x40000000 -#define B43_DMA64_TXERROR 0x14 -#define B43_DMA64_TXERRDPTR 0x0001FFFF -#define B43_DMA64_TXERR 0xF0000000 -#define B43_DMA64_TXERR_NOERR 0x00000000 -#define B43_DMA64_TXERR_PROT 0x10000000 -#define B43_DMA64_TXERR_UNDERRUN 0x20000000 -#define B43_DMA64_TXERR_TRANSFER 0x30000000 -#define B43_DMA64_TXERR_DESCREAD 0x40000000 -#define B43_DMA64_TXERR_CORE 0x50000000 -#define B43_DMA64_RXCTL 0x20 -#define B43_DMA64_RXENABLE 0x00000001 -#define B43_DMA64_RXFROFF_MASK 0x000000FE -#define B43_DMA64_RXFROFF_SHIFT 1 -#define B43_DMA64_RXDIRECTFIFO 0x00000100 -#define B43_DMA64_RXPARITYDISABLE 0x00000800 -#define B43_DMA64_RXADDREXT_MASK 0x00030000 -#define B43_DMA64_RXADDREXT_SHIFT 16 -#define B43_DMA64_RXINDEX 0x24 -#define B43_DMA64_RXRINGLO 0x28 -#define B43_DMA64_RXRINGHI 0x2C -#define B43_DMA64_RXSTATUS 0x30 -#define B43_DMA64_RXSTATDPTR 0x00001FFF -#define B43_DMA64_RXSTAT 0xF0000000 -#define B43_DMA64_RXSTAT_DISABLED 0x00000000 -#define B43_DMA64_RXSTAT_ACTIVE 0x10000000 -#define B43_DMA64_RXSTAT_IDLEWAIT 0x20000000 -#define B43_DMA64_RXSTAT_STOPPED 0x30000000 -#define B43_DMA64_RXSTAT_SUSP 0x40000000 -#define B43_DMA64_RXERROR 0x34 -#define B43_DMA64_RXERRDPTR 0x0001FFFF -#define B43_DMA64_RXERR 0xF0000000 -#define B43_DMA64_RXERR_NOERR 0x00000000 -#define B43_DMA64_RXERR_PROT 0x10000000 -#define B43_DMA64_RXERR_UNDERRUN 0x20000000 -#define B43_DMA64_RXERR_TRANSFER 0x30000000 -#define B43_DMA64_RXERR_DESCREAD 0x40000000 -#define B43_DMA64_RXERR_CORE 0x50000000 - -/* 64-bit DMA descriptor. */ -struct b43_dmadesc64 { - __le32 control0; - __le32 control1; - __le32 address_low; - __le32 address_high; -} __packed; -#define B43_DMA64_DCTL0_DTABLEEND 0x10000000 -#define B43_DMA64_DCTL0_IRQ 0x20000000 -#define B43_DMA64_DCTL0_FRAMEEND 0x40000000 -#define B43_DMA64_DCTL0_FRAMESTART 0x80000000 -#define B43_DMA64_DCTL1_BYTECNT 0x00001FFF -#define B43_DMA64_DCTL1_ADDREXT_MASK 0x00030000 -#define B43_DMA64_DCTL1_ADDREXT_SHIFT 16 - -struct b43_dmadesc_generic { - union { - struct b43_dmadesc32 dma32; - struct b43_dmadesc64 dma64; - } __packed; -} __packed; - -/* Misc DMA constants */ -#define B43_DMA32_RINGMEMSIZE 4096 -#define B43_DMA64_RINGMEMSIZE 8192 -/* Offset of frame with actual data */ -#define B43_DMA0_RX_FW598_FO 38 -#define B43_DMA0_RX_FW351_FO 30 - -/* DMA engine tuning knobs */ -#define B43_TXRING_SLOTS 256 -#define B43_RXRING_SLOTS 256 -#define B43_DMA0_RX_FW598_BUFSIZE (B43_DMA0_RX_FW598_FO + IEEE80211_MAX_FRAME_LEN) -#define B43_DMA0_RX_FW351_BUFSIZE (B43_DMA0_RX_FW351_FO + IEEE80211_MAX_FRAME_LEN) - -/* Pointer poison */ -#define B43_DMA_PTR_POISON ((void *)ERR_PTR(-ENOMEM)) -#define b43_dma_ptr_is_poisoned(ptr) (unlikely((ptr) == B43_DMA_PTR_POISON)) - - -struct sk_buff; -struct b43_private; -struct b43_txstatus; - -struct b43_dmadesc_meta { - /* The kernel DMA-able buffer. */ - struct sk_buff *skb; - /* DMA base bus-address of the descriptor buffer. */ - dma_addr_t dmaaddr; - /* ieee80211 TX status. Only used once per 802.11 frag. */ - bool is_last_fragment; -}; - -struct b43_dmaring; - -/* Lowlevel DMA operations that differ between 32bit and 64bit DMA. */ -struct b43_dma_ops { - struct b43_dmadesc_generic *(*idx2desc) (struct b43_dmaring * ring, - int slot, - struct b43_dmadesc_meta ** - meta); - void (*fill_descriptor) (struct b43_dmaring * ring, - struct b43_dmadesc_generic * desc, - dma_addr_t dmaaddr, u16 bufsize, int start, - int end, int irq); - void (*poke_tx) (struct b43_dmaring * ring, int slot); - void (*tx_suspend) (struct b43_dmaring * ring); - void (*tx_resume) (struct b43_dmaring * ring); - int (*get_current_rxslot) (struct b43_dmaring * ring); - void (*set_current_rxslot) (struct b43_dmaring * ring, int slot); -}; - -enum b43_dmatype { - B43_DMA_30BIT = 30, - B43_DMA_32BIT = 32, - B43_DMA_64BIT = 64, -}; - -enum b43_addrtype { - B43_DMA_ADDR_LOW, - B43_DMA_ADDR_HIGH, - B43_DMA_ADDR_EXT, -}; - -struct b43_dmaring { - /* Lowlevel DMA ops. */ - const struct b43_dma_ops *ops; - /* Kernel virtual base address of the ring memory. */ - void *descbase; - /* Meta data about all descriptors. */ - struct b43_dmadesc_meta *meta; - /* Cache of TX headers for each TX frame. - * This is to avoid an allocation on each TX. - * This is NULL for an RX ring. - */ - u8 *txhdr_cache; - /* (Unadjusted) DMA base bus-address of the ring memory. */ - dma_addr_t dmabase; - /* Number of descriptor slots in the ring. */ - int nr_slots; - /* Number of used descriptor slots. */ - int used_slots; - /* Currently used slot in the ring. */ - int current_slot; - /* Frameoffset in octets. */ - u32 frameoffset; - /* Descriptor buffer size. */ - u16 rx_buffersize; - /* The MMIO base register of the DMA controller. */ - u16 mmio_base; - /* DMA controller index number (0-5). */ - int index; - /* Boolean. Is this a TX ring? */ - bool tx; - /* The type of DMA engine used. */ - enum b43_dmatype type; - /* Boolean. Is this ring stopped at ieee80211 level? */ - bool stopped; - /* The QOS priority assigned to this ring. Only used for TX rings. - * This is the mac80211 "queue" value. */ - u8 queue_prio; - struct b43_wldev *dev; -#ifdef CONFIG_B43_DEBUG - /* Maximum number of used slots. */ - int max_used_slots; - /* Last time we injected a ring overflow. */ - unsigned long last_injected_overflow; - /* Statistics: Number of successfully transmitted packets */ - u64 nr_succeed_tx_packets; - /* Statistics: Number of failed TX packets */ - u64 nr_failed_tx_packets; - /* Statistics: Total number of TX plus all retries. */ - u64 nr_total_packet_tries; -#endif /* CONFIG_B43_DEBUG */ -}; - -static inline u32 b43_dma_read(struct b43_dmaring *ring, u16 offset) -{ - return b43_read32(ring->dev, ring->mmio_base + offset); -} - -static inline void b43_dma_write(struct b43_dmaring *ring, u16 offset, u32 value) -{ - b43_write32(ring->dev, ring->mmio_base + offset, value); -} - -int b43_dma_init(struct b43_wldev *dev); -void b43_dma_free(struct b43_wldev *dev); - -void b43_dma_tx_suspend(struct b43_wldev *dev); -void b43_dma_tx_resume(struct b43_wldev *dev); - -int b43_dma_tx(struct b43_wldev *dev, - struct sk_buff *skb); -void b43_dma_handle_txstatus(struct b43_wldev *dev, - const struct b43_txstatus *status); - -void b43_dma_handle_rx_overflow(struct b43_dmaring *ring); - -void b43_dma_rx(struct b43_dmaring *ring); - -void b43_dma_direct_fifo_rx(struct b43_wldev *dev, - unsigned int engine_index, bool enable); - -#endif /* B43_DMA_H_ */ diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c deleted file mode 100644 index d79ab2a227e1..000000000000 --- a/drivers/net/wireless/b43/leds.c +++ /dev/null @@ -1,359 +0,0 @@ -/* - - Broadcom B43 wireless driver - LED control - - Copyright (c) 2005 Martin Langer , - Copyright (c) 2005 Stefano Brivio - Copyright (c) 2005-2007 Michael Buesch - Copyright (c) 2005 Danny van Dyk - Copyright (c) 2005 Andreas Jaggi - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "leds.h" -#include "rfkill.h" - - -static void b43_led_turn_on(struct b43_wldev *dev, u8 led_index, - bool activelow) -{ - u16 ctl; - - ctl = b43_read16(dev, B43_MMIO_GPIO_CONTROL); - if (activelow) - ctl &= ~(1 << led_index); - else - ctl |= (1 << led_index); - b43_write16(dev, B43_MMIO_GPIO_CONTROL, ctl); -} - -static void b43_led_turn_off(struct b43_wldev *dev, u8 led_index, - bool activelow) -{ - u16 ctl; - - ctl = b43_read16(dev, B43_MMIO_GPIO_CONTROL); - if (activelow) - ctl |= (1 << led_index); - else - ctl &= ~(1 << led_index); - b43_write16(dev, B43_MMIO_GPIO_CONTROL, ctl); -} - -static void b43_led_update(struct b43_wldev *dev, - struct b43_led *led) -{ - bool radio_enabled; - bool turn_on; - - if (!led->wl) - return; - - radio_enabled = (dev->phy.radio_on && dev->radio_hw_enable); - - /* The led->state read is racy, but we don't care. In case we raced - * with the brightness_set handler, we will be called again soon - * to fixup our state. */ - if (radio_enabled) - turn_on = atomic_read(&led->state) != LED_OFF; - else - turn_on = false; - if (turn_on == led->hw_state) - return; - led->hw_state = turn_on; - - if (turn_on) - b43_led_turn_on(dev, led->index, led->activelow); - else - b43_led_turn_off(dev, led->index, led->activelow); -} - -static void b43_leds_work(struct work_struct *work) -{ - struct b43_leds *leds = container_of(work, struct b43_leds, work); - struct b43_wl *wl = container_of(leds, struct b43_wl, leds); - struct b43_wldev *dev; - - mutex_lock(&wl->mutex); - dev = wl->current_dev; - if (unlikely(!dev || b43_status(dev) < B43_STAT_STARTED)) - goto out_unlock; - - b43_led_update(dev, &wl->leds.led_tx); - b43_led_update(dev, &wl->leds.led_rx); - b43_led_update(dev, &wl->leds.led_radio); - b43_led_update(dev, &wl->leds.led_assoc); - -out_unlock: - mutex_unlock(&wl->mutex); -} - -/* Callback from the LED subsystem. */ -static void b43_led_brightness_set(struct led_classdev *led_dev, - enum led_brightness brightness) -{ - struct b43_led *led = container_of(led_dev, struct b43_led, led_dev); - struct b43_wl *wl = led->wl; - - if (likely(!wl->leds.stop)) { - atomic_set(&led->state, brightness); - ieee80211_queue_work(wl->hw, &wl->leds.work); - } -} - -static int b43_register_led(struct b43_wldev *dev, struct b43_led *led, - const char *name, const char *default_trigger, - u8 led_index, bool activelow) -{ - int err; - - if (led->wl) - return -EEXIST; - if (!default_trigger) - return -EINVAL; - led->wl = dev->wl; - led->index = led_index; - led->activelow = activelow; - strncpy(led->name, name, sizeof(led->name)); - atomic_set(&led->state, 0); - - led->led_dev.name = led->name; - led->led_dev.default_trigger = default_trigger; - led->led_dev.brightness_set = b43_led_brightness_set; - - err = led_classdev_register(dev->dev->dev, &led->led_dev); - if (err) { - b43warn(dev->wl, "LEDs: Failed to register %s\n", name); - led->wl = NULL; - return err; - } - - return 0; -} - -static void b43_unregister_led(struct b43_led *led) -{ - if (!led->wl) - return; - led_classdev_unregister(&led->led_dev); - led->wl = NULL; -} - -static void b43_map_led(struct b43_wldev *dev, - u8 led_index, - enum b43_led_behaviour behaviour, - bool activelow) -{ - struct ieee80211_hw *hw = dev->wl->hw; - char name[B43_LED_MAX_NAME_LEN + 1]; - - /* Map the b43 specific LED behaviour value to the - * generic LED triggers. */ - switch (behaviour) { - case B43_LED_INACTIVE: - case B43_LED_OFF: - case B43_LED_ON: - break; - case B43_LED_ACTIVITY: - case B43_LED_TRANSFER: - case B43_LED_APTRANSFER: - snprintf(name, sizeof(name), - "b43-%s::tx", wiphy_name(hw->wiphy)); - b43_register_led(dev, &dev->wl->leds.led_tx, name, - ieee80211_get_tx_led_name(hw), - led_index, activelow); - snprintf(name, sizeof(name), - "b43-%s::rx", wiphy_name(hw->wiphy)); - b43_register_led(dev, &dev->wl->leds.led_rx, name, - ieee80211_get_rx_led_name(hw), - led_index, activelow); - break; - case B43_LED_RADIO_ALL: - case B43_LED_RADIO_A: - case B43_LED_RADIO_B: - case B43_LED_MODE_BG: - snprintf(name, sizeof(name), - "b43-%s::radio", wiphy_name(hw->wiphy)); - b43_register_led(dev, &dev->wl->leds.led_radio, name, - ieee80211_get_radio_led_name(hw), - led_index, activelow); - break; - case B43_LED_WEIRD: - case B43_LED_ASSOC: - snprintf(name, sizeof(name), - "b43-%s::assoc", wiphy_name(hw->wiphy)); - b43_register_led(dev, &dev->wl->leds.led_assoc, name, - ieee80211_get_assoc_led_name(hw), - led_index, activelow); - break; - default: - b43warn(dev->wl, "LEDs: Unknown behaviour 0x%02X\n", - behaviour); - break; - } -} - -static void b43_led_get_sprominfo(struct b43_wldev *dev, - unsigned int led_index, - enum b43_led_behaviour *behaviour, - bool *activelow) -{ - u8 sprom[4]; - - sprom[0] = dev->dev->bus_sprom->gpio0; - sprom[1] = dev->dev->bus_sprom->gpio1; - sprom[2] = dev->dev->bus_sprom->gpio2; - sprom[3] = dev->dev->bus_sprom->gpio3; - - if (sprom[led_index] == 0xFF) { - /* There is no LED information in the SPROM - * for this LED. Hardcode it here. */ - *activelow = false; - switch (led_index) { - case 0: - *behaviour = B43_LED_ACTIVITY; - *activelow = true; - if (dev->dev->board_vendor == PCI_VENDOR_ID_COMPAQ) - *behaviour = B43_LED_RADIO_ALL; - break; - case 1: - *behaviour = B43_LED_RADIO_B; - if (dev->dev->board_vendor == PCI_VENDOR_ID_ASUSTEK) - *behaviour = B43_LED_ASSOC; - break; - case 2: - *behaviour = B43_LED_RADIO_A; - break; - case 3: - *behaviour = B43_LED_OFF; - break; - default: - *behaviour = B43_LED_OFF; - B43_WARN_ON(1); - return; - } - } else { - *behaviour = sprom[led_index] & B43_LED_BEHAVIOUR; - *activelow = !!(sprom[led_index] & B43_LED_ACTIVELOW); - } -} - -void b43_leds_init(struct b43_wldev *dev) -{ - struct b43_led *led; - unsigned int i; - enum b43_led_behaviour behaviour; - bool activelow; - - /* Sync the RF-kill LED state (if we have one) with radio and switch states. */ - led = &dev->wl->leds.led_radio; - if (led->wl) { - if (dev->phy.radio_on && b43_is_hw_radio_enabled(dev)) { - b43_led_turn_on(dev, led->index, led->activelow); - led->hw_state = true; - atomic_set(&led->state, 1); - } else { - b43_led_turn_off(dev, led->index, led->activelow); - led->hw_state = false; - atomic_set(&led->state, 0); - } - } - - /* Initialize TX/RX/ASSOC leds */ - led = &dev->wl->leds.led_tx; - if (led->wl) { - b43_led_turn_off(dev, led->index, led->activelow); - led->hw_state = false; - atomic_set(&led->state, 0); - } - led = &dev->wl->leds.led_rx; - if (led->wl) { - b43_led_turn_off(dev, led->index, led->activelow); - led->hw_state = false; - atomic_set(&led->state, 0); - } - led = &dev->wl->leds.led_assoc; - if (led->wl) { - b43_led_turn_off(dev, led->index, led->activelow); - led->hw_state = false; - atomic_set(&led->state, 0); - } - - /* Initialize other LED states. */ - for (i = 0; i < B43_MAX_NR_LEDS; i++) { - b43_led_get_sprominfo(dev, i, &behaviour, &activelow); - switch (behaviour) { - case B43_LED_OFF: - b43_led_turn_off(dev, i, activelow); - break; - case B43_LED_ON: - b43_led_turn_on(dev, i, activelow); - break; - default: - /* Leave others as-is. */ - break; - } - } - - dev->wl->leds.stop = 0; -} - -void b43_leds_exit(struct b43_wldev *dev) -{ - struct b43_leds *leds = &dev->wl->leds; - - b43_led_turn_off(dev, leds->led_tx.index, leds->led_tx.activelow); - b43_led_turn_off(dev, leds->led_rx.index, leds->led_rx.activelow); - b43_led_turn_off(dev, leds->led_assoc.index, leds->led_assoc.activelow); - b43_led_turn_off(dev, leds->led_radio.index, leds->led_radio.activelow); -} - -void b43_leds_stop(struct b43_wldev *dev) -{ - struct b43_leds *leds = &dev->wl->leds; - - leds->stop = 1; - cancel_work_sync(&leds->work); -} - -void b43_leds_register(struct b43_wldev *dev) -{ - unsigned int i; - enum b43_led_behaviour behaviour; - bool activelow; - - INIT_WORK(&dev->wl->leds.work, b43_leds_work); - - /* Register the LEDs to the LED subsystem. */ - for (i = 0; i < B43_MAX_NR_LEDS; i++) { - b43_led_get_sprominfo(dev, i, &behaviour, &activelow); - b43_map_led(dev, i, behaviour, activelow); - } -} - -void b43_leds_unregister(struct b43_wl *wl) -{ - struct b43_leds *leds = &wl->leds; - - b43_unregister_led(&leds->led_tx); - b43_unregister_led(&leds->led_rx); - b43_unregister_led(&leds->led_assoc); - b43_unregister_led(&leds->led_radio); -} diff --git a/drivers/net/wireless/b43/leds.h b/drivers/net/wireless/b43/leds.h deleted file mode 100644 index 32b66d53cdac..000000000000 --- a/drivers/net/wireless/b43/leds.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef B43_LEDS_H_ -#define B43_LEDS_H_ - -struct b43_wl; -struct b43_wldev; - -#ifdef CONFIG_B43_LEDS - -#include -#include -#include - - -#define B43_LED_MAX_NAME_LEN 31 - -struct b43_led { - struct b43_wl *wl; - /* The LED class device */ - struct led_classdev led_dev; - /* The index number of the LED. */ - u8 index; - /* If activelow is true, the LED is ON if the - * bit is switched off. */ - bool activelow; - /* The unique name string for this LED device. */ - char name[B43_LED_MAX_NAME_LEN + 1]; - /* The current status of the LED. This is updated locklessly. */ - atomic_t state; - /* The active state in hardware. */ - bool hw_state; -}; - -struct b43_leds { - struct b43_led led_tx; - struct b43_led led_rx; - struct b43_led led_radio; - struct b43_led led_assoc; - - bool stop; - struct work_struct work; -}; - -#define B43_MAX_NR_LEDS 4 - -#define B43_LED_BEHAVIOUR 0x7F -#define B43_LED_ACTIVELOW 0x80 -/* LED behaviour values */ -enum b43_led_behaviour { - B43_LED_OFF, - B43_LED_ON, - B43_LED_ACTIVITY, - B43_LED_RADIO_ALL, - B43_LED_RADIO_A, - B43_LED_RADIO_B, - B43_LED_MODE_BG, - B43_LED_TRANSFER, - B43_LED_APTRANSFER, - B43_LED_WEIRD, //FIXME - B43_LED_ASSOC, - B43_LED_INACTIVE, -}; - -void b43_leds_register(struct b43_wldev *dev); -void b43_leds_unregister(struct b43_wl *wl); -void b43_leds_init(struct b43_wldev *dev); -void b43_leds_exit(struct b43_wldev *dev); -void b43_leds_stop(struct b43_wldev *dev); - - -#else /* CONFIG_B43_LEDS */ -/* LED support disabled */ - -struct b43_leds { - /* empty */ -}; - -static inline void b43_leds_register(struct b43_wldev *dev) -{ -} -static inline void b43_leds_unregister(struct b43_wl *wl) -{ -} -static inline void b43_leds_init(struct b43_wldev *dev) -{ -} -static inline void b43_leds_exit(struct b43_wldev *dev) -{ -} -static inline void b43_leds_stop(struct b43_wldev *dev) -{ -} -#endif /* CONFIG_B43_LEDS */ - -#endif /* B43_LEDS_H_ */ diff --git a/drivers/net/wireless/b43/lo.c b/drivers/net/wireless/b43/lo.c deleted file mode 100644 index 916123a3d74e..000000000000 --- a/drivers/net/wireless/b43/lo.c +++ /dev/null @@ -1,1016 +0,0 @@ -/* - - Broadcom B43 wireless driver - - G PHY LO (LocalOscillator) Measuring and Control routines - - Copyright (c) 2005 Martin Langer , - Copyright (c) 2005, 2006 Stefano Brivio - Copyright (c) 2005-2007 Michael Buesch - Copyright (c) 2005, 2006 Danny van Dyk - Copyright (c) 2005, 2006 Andreas Jaggi - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "lo.h" -#include "phy_g.h" -#include "main.h" - -#include -#include -#include - - -static struct b43_lo_calib *b43_find_lo_calib(struct b43_txpower_lo_control *lo, - const struct b43_bbatt *bbatt, - const struct b43_rfatt *rfatt) -{ - struct b43_lo_calib *c; - - list_for_each_entry(c, &lo->calib_list, list) { - if (!b43_compare_bbatt(&c->bbatt, bbatt)) - continue; - if (!b43_compare_rfatt(&c->rfatt, rfatt)) - continue; - return c; - } - - return NULL; -} - -/* Write the LocalOscillator Control (adjust) value-pair. */ -static void b43_lo_write(struct b43_wldev *dev, struct b43_loctl *control) -{ - struct b43_phy *phy = &dev->phy; - u16 value; - - if (B43_DEBUG) { - if (unlikely(abs(control->i) > 16 || abs(control->q) > 16)) { - b43dbg(dev->wl, "Invalid LO control pair " - "(I: %d, Q: %d)\n", control->i, control->q); - dump_stack(); - return; - } - } - B43_WARN_ON(phy->type != B43_PHYTYPE_G); - - value = (u8) (control->q); - value |= ((u8) (control->i)) << 8; - b43_phy_write(dev, B43_PHY_LO_CTL, value); -} - -static u16 lo_measure_feedthrough(struct b43_wldev *dev, - u16 lna, u16 pga, u16 trsw_rx) -{ - struct b43_phy *phy = &dev->phy; - u16 rfover; - u16 feedthrough; - - if (phy->gmode) { - lna <<= B43_PHY_RFOVERVAL_LNA_SHIFT; - pga <<= B43_PHY_RFOVERVAL_PGA_SHIFT; - - B43_WARN_ON(lna & ~B43_PHY_RFOVERVAL_LNA); - B43_WARN_ON(pga & ~B43_PHY_RFOVERVAL_PGA); -/*FIXME This assertion fails B43_WARN_ON(trsw_rx & ~(B43_PHY_RFOVERVAL_TRSWRX | - B43_PHY_RFOVERVAL_BW)); -*/ - trsw_rx &= (B43_PHY_RFOVERVAL_TRSWRX | B43_PHY_RFOVERVAL_BW); - - /* Construct the RF Override Value */ - rfover = B43_PHY_RFOVERVAL_UNK; - rfover |= pga; - rfover |= lna; - rfover |= trsw_rx; - if ((dev->dev->bus_sprom->boardflags_lo & B43_BFL_EXTLNA) - && phy->rev > 6) - rfover |= B43_PHY_RFOVERVAL_EXTLNA; - - b43_phy_write(dev, B43_PHY_PGACTL, 0xE300); - b43_phy_write(dev, B43_PHY_RFOVERVAL, rfover); - udelay(10); - rfover |= B43_PHY_RFOVERVAL_BW_LBW; - b43_phy_write(dev, B43_PHY_RFOVERVAL, rfover); - udelay(10); - rfover |= B43_PHY_RFOVERVAL_BW_LPF; - b43_phy_write(dev, B43_PHY_RFOVERVAL, rfover); - udelay(10); - b43_phy_write(dev, B43_PHY_PGACTL, 0xF300); - } else { - pga |= B43_PHY_PGACTL_UNKNOWN; - b43_phy_write(dev, B43_PHY_PGACTL, pga); - udelay(10); - pga |= B43_PHY_PGACTL_LOWBANDW; - b43_phy_write(dev, B43_PHY_PGACTL, pga); - udelay(10); - pga |= B43_PHY_PGACTL_LPF; - b43_phy_write(dev, B43_PHY_PGACTL, pga); - } - udelay(21); - feedthrough = b43_phy_read(dev, B43_PHY_LO_LEAKAGE); - - /* This is a good place to check if we need to relax a bit, - * as this is the main function called regularly - * in the LO calibration. */ - cond_resched(); - - return feedthrough; -} - -/* TXCTL Register and Value Table. - * Returns the "TXCTL Register". - * "value" is the "TXCTL Value". - * "pad_mix_gain" is the PAD Mixer Gain. - */ -static u16 lo_txctl_register_table(struct b43_wldev *dev, - u16 *value, u16 *pad_mix_gain) -{ - struct b43_phy *phy = &dev->phy; - u16 reg, v, padmix; - - if (phy->type == B43_PHYTYPE_B) { - v = 0x30; - if (phy->radio_rev <= 5) { - reg = 0x43; - padmix = 0; - } else { - reg = 0x52; - padmix = 5; - } - } else { - if (phy->rev >= 2 && phy->radio_rev == 8) { - reg = 0x43; - v = 0x10; - padmix = 2; - } else { - reg = 0x52; - v = 0x30; - padmix = 5; - } - } - if (value) - *value = v; - if (pad_mix_gain) - *pad_mix_gain = padmix; - - return reg; -} - -static void lo_measure_txctl_values(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - struct b43_txpower_lo_control *lo = gphy->lo_control; - u16 reg, mask; - u16 trsw_rx, pga; - u16 radio_pctl_reg; - - static const u8 tx_bias_values[] = { - 0x09, 0x08, 0x0A, 0x01, 0x00, - 0x02, 0x05, 0x04, 0x06, - }; - static const u8 tx_magn_values[] = { - 0x70, 0x40, - }; - - if (!has_loopback_gain(phy)) { - radio_pctl_reg = 6; - trsw_rx = 2; - pga = 0; - } else { - int lb_gain; /* Loopback gain (in dB) */ - - trsw_rx = 0; - lb_gain = gphy->max_lb_gain / 2; - if (lb_gain > 10) { - radio_pctl_reg = 0; - pga = abs(10 - lb_gain) / 6; - pga = clamp_val(pga, 0, 15); - } else { - int cmp_val; - int tmp; - - pga = 0; - cmp_val = 0x24; - if ((phy->rev >= 2) && - (phy->radio_ver == 0x2050) && (phy->radio_rev == 8)) - cmp_val = 0x3C; - tmp = lb_gain; - if ((10 - lb_gain) < cmp_val) - tmp = (10 - lb_gain); - if (tmp < 0) - tmp += 6; - else - tmp += 3; - cmp_val /= 4; - tmp /= 4; - if (tmp >= cmp_val) - radio_pctl_reg = cmp_val; - else - radio_pctl_reg = tmp; - } - } - b43_radio_maskset(dev, 0x43, 0xFFF0, radio_pctl_reg); - b43_gphy_set_baseband_attenuation(dev, 2); - - reg = lo_txctl_register_table(dev, &mask, NULL); - mask = ~mask; - b43_radio_mask(dev, reg, mask); - - if (has_tx_magnification(phy)) { - int i, j; - int feedthrough; - int min_feedth = 0xFFFF; - u8 tx_magn, tx_bias; - - for (i = 0; i < ARRAY_SIZE(tx_magn_values); i++) { - tx_magn = tx_magn_values[i]; - b43_radio_maskset(dev, 0x52, 0xFF0F, tx_magn); - for (j = 0; j < ARRAY_SIZE(tx_bias_values); j++) { - tx_bias = tx_bias_values[j]; - b43_radio_maskset(dev, 0x52, 0xFFF0, tx_bias); - feedthrough = - lo_measure_feedthrough(dev, 0, pga, - trsw_rx); - if (feedthrough < min_feedth) { - lo->tx_bias = tx_bias; - lo->tx_magn = tx_magn; - min_feedth = feedthrough; - } - if (lo->tx_bias == 0) - break; - } - b43_radio_write16(dev, 0x52, - (b43_radio_read16(dev, 0x52) - & 0xFF00) | lo->tx_bias | lo-> - tx_magn); - } - } else { - lo->tx_magn = 0; - lo->tx_bias = 0; - b43_radio_mask(dev, 0x52, 0xFFF0); /* TX bias == 0 */ - } - lo->txctl_measured_time = jiffies; -} - -static void lo_read_power_vector(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - struct b43_txpower_lo_control *lo = gphy->lo_control; - int i; - u64 tmp; - u64 power_vector = 0; - - for (i = 0; i < 8; i += 2) { - tmp = b43_shm_read16(dev, B43_SHM_SHARED, 0x310 + i); - power_vector |= (tmp << (i * 8)); - /* Clear the vector on the device. */ - b43_shm_write16(dev, B43_SHM_SHARED, 0x310 + i, 0); - } - if (power_vector) - lo->power_vector = power_vector; - lo->pwr_vec_read_time = jiffies; -} - -/* 802.11/LO/GPHY/MeasuringGains */ -static void lo_measure_gain_values(struct b43_wldev *dev, - s16 max_rx_gain, int use_trsw_rx) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - u16 tmp; - - if (max_rx_gain < 0) - max_rx_gain = 0; - - if (has_loopback_gain(phy)) { - int trsw_rx_gain; - - if (use_trsw_rx) { - trsw_rx_gain = gphy->trsw_rx_gain / 2; - if (max_rx_gain >= trsw_rx_gain) { - trsw_rx_gain = max_rx_gain - trsw_rx_gain; - } - } else - trsw_rx_gain = max_rx_gain; - if (trsw_rx_gain < 9) { - gphy->lna_lod_gain = 0; - } else { - gphy->lna_lod_gain = 1; - trsw_rx_gain -= 8; - } - trsw_rx_gain = clamp_val(trsw_rx_gain, 0, 0x2D); - gphy->pga_gain = trsw_rx_gain / 3; - if (gphy->pga_gain >= 5) { - gphy->pga_gain -= 5; - gphy->lna_gain = 2; - } else - gphy->lna_gain = 0; - } else { - gphy->lna_gain = 0; - gphy->trsw_rx_gain = 0x20; - if (max_rx_gain >= 0x14) { - gphy->lna_lod_gain = 1; - gphy->pga_gain = 2; - } else if (max_rx_gain >= 0x12) { - gphy->lna_lod_gain = 1; - gphy->pga_gain = 1; - } else if (max_rx_gain >= 0xF) { - gphy->lna_lod_gain = 1; - gphy->pga_gain = 0; - } else { - gphy->lna_lod_gain = 0; - gphy->pga_gain = 0; - } - } - - tmp = b43_radio_read16(dev, 0x7A); - if (gphy->lna_lod_gain == 0) - tmp &= ~0x0008; - else - tmp |= 0x0008; - b43_radio_write16(dev, 0x7A, tmp); -} - -struct lo_g_saved_values { - u8 old_channel; - - /* Core registers */ - u16 reg_3F4; - u16 reg_3E2; - - /* PHY registers */ - u16 phy_lo_mask; - u16 phy_extg_01; - u16 phy_dacctl_hwpctl; - u16 phy_dacctl; - u16 phy_cck_14; - u16 phy_hpwr_tssictl; - u16 phy_analogover; - u16 phy_analogoverval; - u16 phy_rfover; - u16 phy_rfoverval; - u16 phy_classctl; - u16 phy_cck_3E; - u16 phy_crs0; - u16 phy_pgactl; - u16 phy_cck_2A; - u16 phy_syncctl; - u16 phy_cck_30; - u16 phy_cck_06; - - /* Radio registers */ - u16 radio_43; - u16 radio_7A; - u16 radio_52; -}; - -static void lo_measure_setup(struct b43_wldev *dev, - struct lo_g_saved_values *sav) -{ - struct ssb_sprom *sprom = dev->dev->bus_sprom; - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - struct b43_txpower_lo_control *lo = gphy->lo_control; - u16 tmp; - - if (b43_has_hardware_pctl(dev)) { - sav->phy_lo_mask = b43_phy_read(dev, B43_PHY_LO_MASK); - sav->phy_extg_01 = b43_phy_read(dev, B43_PHY_EXTG(0x01)); - sav->phy_dacctl_hwpctl = b43_phy_read(dev, B43_PHY_DACCTL); - sav->phy_cck_14 = b43_phy_read(dev, B43_PHY_CCK(0x14)); - sav->phy_hpwr_tssictl = b43_phy_read(dev, B43_PHY_HPWR_TSSICTL); - - b43_phy_set(dev, B43_PHY_HPWR_TSSICTL, 0x100); - b43_phy_set(dev, B43_PHY_EXTG(0x01), 0x40); - b43_phy_set(dev, B43_PHY_DACCTL, 0x40); - b43_phy_set(dev, B43_PHY_CCK(0x14), 0x200); - } - if (phy->type == B43_PHYTYPE_B && - phy->radio_ver == 0x2050 && phy->radio_rev < 6) { - b43_phy_write(dev, B43_PHY_CCK(0x16), 0x410); - b43_phy_write(dev, B43_PHY_CCK(0x17), 0x820); - } - if (phy->rev >= 2) { - sav->phy_analogover = b43_phy_read(dev, B43_PHY_ANALOGOVER); - sav->phy_analogoverval = - b43_phy_read(dev, B43_PHY_ANALOGOVERVAL); - sav->phy_rfover = b43_phy_read(dev, B43_PHY_RFOVER); - sav->phy_rfoverval = b43_phy_read(dev, B43_PHY_RFOVERVAL); - sav->phy_classctl = b43_phy_read(dev, B43_PHY_CLASSCTL); - sav->phy_cck_3E = b43_phy_read(dev, B43_PHY_CCK(0x3E)); - sav->phy_crs0 = b43_phy_read(dev, B43_PHY_CRS0); - - b43_phy_mask(dev, B43_PHY_CLASSCTL, 0xFFFC); - b43_phy_mask(dev, B43_PHY_CRS0, 0x7FFF); - b43_phy_set(dev, B43_PHY_ANALOGOVER, 0x0003); - b43_phy_mask(dev, B43_PHY_ANALOGOVERVAL, 0xFFFC); - if (phy->type == B43_PHYTYPE_G) { - if ((phy->rev >= 7) && - (sprom->boardflags_lo & B43_BFL_EXTLNA)) { - b43_phy_write(dev, B43_PHY_RFOVER, 0x933); - } else { - b43_phy_write(dev, B43_PHY_RFOVER, 0x133); - } - } else { - b43_phy_write(dev, B43_PHY_RFOVER, 0); - } - b43_phy_write(dev, B43_PHY_CCK(0x3E), 0); - } - sav->reg_3F4 = b43_read16(dev, 0x3F4); - sav->reg_3E2 = b43_read16(dev, 0x3E2); - sav->radio_43 = b43_radio_read16(dev, 0x43); - sav->radio_7A = b43_radio_read16(dev, 0x7A); - sav->phy_pgactl = b43_phy_read(dev, B43_PHY_PGACTL); - sav->phy_cck_2A = b43_phy_read(dev, B43_PHY_CCK(0x2A)); - sav->phy_syncctl = b43_phy_read(dev, B43_PHY_SYNCCTL); - sav->phy_dacctl = b43_phy_read(dev, B43_PHY_DACCTL); - - if (!has_tx_magnification(phy)) { - sav->radio_52 = b43_radio_read16(dev, 0x52); - sav->radio_52 &= 0x00F0; - } - if (phy->type == B43_PHYTYPE_B) { - sav->phy_cck_30 = b43_phy_read(dev, B43_PHY_CCK(0x30)); - sav->phy_cck_06 = b43_phy_read(dev, B43_PHY_CCK(0x06)); - b43_phy_write(dev, B43_PHY_CCK(0x30), 0x00FF); - b43_phy_write(dev, B43_PHY_CCK(0x06), 0x3F3F); - } else { - b43_write16(dev, 0x3E2, b43_read16(dev, 0x3E2) - | 0x8000); - } - b43_write16(dev, 0x3F4, b43_read16(dev, 0x3F4) - & 0xF000); - - tmp = - (phy->type == B43_PHYTYPE_G) ? B43_PHY_LO_MASK : B43_PHY_CCK(0x2E); - b43_phy_write(dev, tmp, 0x007F); - - tmp = sav->phy_syncctl; - b43_phy_write(dev, B43_PHY_SYNCCTL, tmp & 0xFF7F); - tmp = sav->radio_7A; - b43_radio_write16(dev, 0x007A, tmp & 0xFFF0); - - b43_phy_write(dev, B43_PHY_CCK(0x2A), 0x8A3); - if (phy->type == B43_PHYTYPE_G || - (phy->type == B43_PHYTYPE_B && - phy->radio_ver == 0x2050 && phy->radio_rev >= 6)) { - b43_phy_write(dev, B43_PHY_CCK(0x2B), 0x1003); - } else - b43_phy_write(dev, B43_PHY_CCK(0x2B), 0x0802); - if (phy->rev >= 2) - b43_dummy_transmission(dev, false, true); - b43_gphy_channel_switch(dev, 6, 0); - b43_radio_read16(dev, 0x51); /* dummy read */ - if (phy->type == B43_PHYTYPE_G) - b43_phy_write(dev, B43_PHY_CCK(0x2F), 0); - - /* Re-measure the txctl values, if needed. */ - if (time_before(lo->txctl_measured_time, - jiffies - B43_LO_TXCTL_EXPIRE)) - lo_measure_txctl_values(dev); - - if (phy->type == B43_PHYTYPE_G && phy->rev >= 3) { - b43_phy_write(dev, B43_PHY_LO_MASK, 0xC078); - } else { - if (phy->type == B43_PHYTYPE_B) - b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x8078); - else - b43_phy_write(dev, B43_PHY_LO_MASK, 0x8078); - } -} - -static void lo_measure_restore(struct b43_wldev *dev, - struct lo_g_saved_values *sav) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - u16 tmp; - - if (phy->rev >= 2) { - b43_phy_write(dev, B43_PHY_PGACTL, 0xE300); - tmp = (gphy->pga_gain << 8); - b43_phy_write(dev, B43_PHY_RFOVERVAL, tmp | 0xA0); - udelay(5); - b43_phy_write(dev, B43_PHY_RFOVERVAL, tmp | 0xA2); - udelay(2); - b43_phy_write(dev, B43_PHY_RFOVERVAL, tmp | 0xA3); - } else { - tmp = (gphy->pga_gain | 0xEFA0); - b43_phy_write(dev, B43_PHY_PGACTL, tmp); - } - if (phy->type == B43_PHYTYPE_G) { - if (phy->rev >= 3) - b43_phy_write(dev, B43_PHY_CCK(0x2E), 0xC078); - else - b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x8078); - if (phy->rev >= 2) - b43_phy_write(dev, B43_PHY_CCK(0x2F), 0x0202); - else - b43_phy_write(dev, B43_PHY_CCK(0x2F), 0x0101); - } - b43_write16(dev, 0x3F4, sav->reg_3F4); - b43_phy_write(dev, B43_PHY_PGACTL, sav->phy_pgactl); - b43_phy_write(dev, B43_PHY_CCK(0x2A), sav->phy_cck_2A); - b43_phy_write(dev, B43_PHY_SYNCCTL, sav->phy_syncctl); - b43_phy_write(dev, B43_PHY_DACCTL, sav->phy_dacctl); - b43_radio_write16(dev, 0x43, sav->radio_43); - b43_radio_write16(dev, 0x7A, sav->radio_7A); - if (!has_tx_magnification(phy)) { - tmp = sav->radio_52; - b43_radio_maskset(dev, 0x52, 0xFF0F, tmp); - } - b43_write16(dev, 0x3E2, sav->reg_3E2); - if (phy->type == B43_PHYTYPE_B && - phy->radio_ver == 0x2050 && phy->radio_rev <= 5) { - b43_phy_write(dev, B43_PHY_CCK(0x30), sav->phy_cck_30); - b43_phy_write(dev, B43_PHY_CCK(0x06), sav->phy_cck_06); - } - if (phy->rev >= 2) { - b43_phy_write(dev, B43_PHY_ANALOGOVER, sav->phy_analogover); - b43_phy_write(dev, B43_PHY_ANALOGOVERVAL, - sav->phy_analogoverval); - b43_phy_write(dev, B43_PHY_CLASSCTL, sav->phy_classctl); - b43_phy_write(dev, B43_PHY_RFOVER, sav->phy_rfover); - b43_phy_write(dev, B43_PHY_RFOVERVAL, sav->phy_rfoverval); - b43_phy_write(dev, B43_PHY_CCK(0x3E), sav->phy_cck_3E); - b43_phy_write(dev, B43_PHY_CRS0, sav->phy_crs0); - } - if (b43_has_hardware_pctl(dev)) { - tmp = (sav->phy_lo_mask & 0xBFFF); - b43_phy_write(dev, B43_PHY_LO_MASK, tmp); - b43_phy_write(dev, B43_PHY_EXTG(0x01), sav->phy_extg_01); - b43_phy_write(dev, B43_PHY_DACCTL, sav->phy_dacctl_hwpctl); - b43_phy_write(dev, B43_PHY_CCK(0x14), sav->phy_cck_14); - b43_phy_write(dev, B43_PHY_HPWR_TSSICTL, sav->phy_hpwr_tssictl); - } - b43_gphy_channel_switch(dev, sav->old_channel, 1); -} - -struct b43_lo_g_statemachine { - int current_state; - int nr_measured; - int state_val_multiplier; - u16 lowest_feedth; - struct b43_loctl min_loctl; -}; - -/* Loop over each possible value in this state. */ -static int lo_probe_possible_loctls(struct b43_wldev *dev, - struct b43_loctl *probe_loctl, - struct b43_lo_g_statemachine *d) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - struct b43_loctl test_loctl; - struct b43_loctl orig_loctl; - struct b43_loctl prev_loctl = { - .i = -100, - .q = -100, - }; - int i; - int begin, end; - int found_lower = 0; - u16 feedth; - - static const struct b43_loctl modifiers[] = { - {.i = 1,.q = 1,}, - {.i = 1,.q = 0,}, - {.i = 1,.q = -1,}, - {.i = 0,.q = -1,}, - {.i = -1,.q = -1,}, - {.i = -1,.q = 0,}, - {.i = -1,.q = 1,}, - {.i = 0,.q = 1,}, - }; - - if (d->current_state == 0) { - begin = 1; - end = 8; - } else if (d->current_state % 2 == 0) { - begin = d->current_state - 1; - end = d->current_state + 1; - } else { - begin = d->current_state - 2; - end = d->current_state + 2; - } - if (begin < 1) - begin += 8; - if (end > 8) - end -= 8; - - memcpy(&orig_loctl, probe_loctl, sizeof(struct b43_loctl)); - i = begin; - d->current_state = i; - while (1) { - B43_WARN_ON(!(i >= 1 && i <= 8)); - memcpy(&test_loctl, &orig_loctl, sizeof(struct b43_loctl)); - test_loctl.i += modifiers[i - 1].i * d->state_val_multiplier; - test_loctl.q += modifiers[i - 1].q * d->state_val_multiplier; - if ((test_loctl.i != prev_loctl.i || - test_loctl.q != prev_loctl.q) && - (abs(test_loctl.i) <= 16 && abs(test_loctl.q) <= 16)) { - b43_lo_write(dev, &test_loctl); - feedth = lo_measure_feedthrough(dev, gphy->lna_gain, - gphy->pga_gain, - gphy->trsw_rx_gain); - if (feedth < d->lowest_feedth) { - memcpy(probe_loctl, &test_loctl, - sizeof(struct b43_loctl)); - found_lower = 1; - d->lowest_feedth = feedth; - if ((d->nr_measured < 2) && - !has_loopback_gain(phy)) - break; - } - } - memcpy(&prev_loctl, &test_loctl, sizeof(prev_loctl)); - if (i == end) - break; - if (i == 8) - i = 1; - else - i++; - d->current_state = i; - } - - return found_lower; -} - -static void lo_probe_loctls_statemachine(struct b43_wldev *dev, - struct b43_loctl *loctl, - int *max_rx_gain) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - struct b43_lo_g_statemachine d; - u16 feedth; - int found_lower; - struct b43_loctl probe_loctl; - int max_repeat = 1, repeat_cnt = 0; - - d.nr_measured = 0; - d.state_val_multiplier = 1; - if (has_loopback_gain(phy)) - d.state_val_multiplier = 3; - - memcpy(&d.min_loctl, loctl, sizeof(struct b43_loctl)); - if (has_loopback_gain(phy)) - max_repeat = 4; - do { - b43_lo_write(dev, &d.min_loctl); - feedth = lo_measure_feedthrough(dev, gphy->lna_gain, - gphy->pga_gain, - gphy->trsw_rx_gain); - if (feedth < 0x258) { - if (feedth >= 0x12C) - *max_rx_gain += 6; - else - *max_rx_gain += 3; - feedth = lo_measure_feedthrough(dev, gphy->lna_gain, - gphy->pga_gain, - gphy->trsw_rx_gain); - } - d.lowest_feedth = feedth; - - d.current_state = 0; - do { - B43_WARN_ON(! - (d.current_state >= 0 - && d.current_state <= 8)); - memcpy(&probe_loctl, &d.min_loctl, - sizeof(struct b43_loctl)); - found_lower = - lo_probe_possible_loctls(dev, &probe_loctl, &d); - if (!found_lower) - break; - if ((probe_loctl.i == d.min_loctl.i) && - (probe_loctl.q == d.min_loctl.q)) - break; - memcpy(&d.min_loctl, &probe_loctl, - sizeof(struct b43_loctl)); - d.nr_measured++; - } while (d.nr_measured < 24); - memcpy(loctl, &d.min_loctl, sizeof(struct b43_loctl)); - - if (has_loopback_gain(phy)) { - if (d.lowest_feedth > 0x1194) - *max_rx_gain -= 6; - else if (d.lowest_feedth < 0x5DC) - *max_rx_gain += 3; - if (repeat_cnt == 0) { - if (d.lowest_feedth <= 0x5DC) { - d.state_val_multiplier = 1; - repeat_cnt++; - } else - d.state_val_multiplier = 2; - } else if (repeat_cnt == 2) - d.state_val_multiplier = 1; - } - lo_measure_gain_values(dev, *max_rx_gain, - has_loopback_gain(phy)); - } while (++repeat_cnt < max_repeat); -} - -static -struct b43_lo_calib *b43_calibrate_lo_setting(struct b43_wldev *dev, - const struct b43_bbatt *bbatt, - const struct b43_rfatt *rfatt) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - struct b43_loctl loctl = { - .i = 0, - .q = 0, - }; - int max_rx_gain; - struct b43_lo_calib *cal; - struct lo_g_saved_values uninitialized_var(saved_regs); - /* Values from the "TXCTL Register and Value Table" */ - u16 txctl_reg; - u16 txctl_value; - u16 pad_mix_gain; - - saved_regs.old_channel = phy->channel; - b43_mac_suspend(dev); - lo_measure_setup(dev, &saved_regs); - - txctl_reg = lo_txctl_register_table(dev, &txctl_value, &pad_mix_gain); - - b43_radio_maskset(dev, 0x43, 0xFFF0, rfatt->att); - b43_radio_maskset(dev, txctl_reg, ~txctl_value, (rfatt->with_padmix ? txctl_value :0)); - - max_rx_gain = rfatt->att * 2; - max_rx_gain += bbatt->att / 2; - if (rfatt->with_padmix) - max_rx_gain -= pad_mix_gain; - if (has_loopback_gain(phy)) - max_rx_gain += gphy->max_lb_gain; - lo_measure_gain_values(dev, max_rx_gain, - has_loopback_gain(phy)); - - b43_gphy_set_baseband_attenuation(dev, bbatt->att); - lo_probe_loctls_statemachine(dev, &loctl, &max_rx_gain); - - lo_measure_restore(dev, &saved_regs); - b43_mac_enable(dev); - - if (b43_debug(dev, B43_DBG_LO)) { - b43dbg(dev->wl, "LO: Calibrated for BB(%u), RF(%u,%u) " - "=> I=%d Q=%d\n", - bbatt->att, rfatt->att, rfatt->with_padmix, - loctl.i, loctl.q); - } - - cal = kmalloc(sizeof(*cal), GFP_KERNEL); - if (!cal) { - b43warn(dev->wl, "LO calib: out of memory\n"); - return NULL; - } - memcpy(&cal->bbatt, bbatt, sizeof(*bbatt)); - memcpy(&cal->rfatt, rfatt, sizeof(*rfatt)); - memcpy(&cal->ctl, &loctl, sizeof(loctl)); - cal->calib_time = jiffies; - INIT_LIST_HEAD(&cal->list); - - return cal; -} - -/* Get a calibrated LO setting for the given attenuation values. - * Might return a NULL pointer under OOM! */ -static -struct b43_lo_calib *b43_get_calib_lo_settings(struct b43_wldev *dev, - const struct b43_bbatt *bbatt, - const struct b43_rfatt *rfatt) -{ - struct b43_txpower_lo_control *lo = dev->phy.g->lo_control; - struct b43_lo_calib *c; - - c = b43_find_lo_calib(lo, bbatt, rfatt); - if (c) - return c; - /* Not in the list of calibrated LO settings. - * Calibrate it now. */ - c = b43_calibrate_lo_setting(dev, bbatt, rfatt); - if (!c) - return NULL; - list_add(&c->list, &lo->calib_list); - - return c; -} - -void b43_gphy_dc_lt_init(struct b43_wldev *dev, bool update_all) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - struct b43_txpower_lo_control *lo = gphy->lo_control; - int i; - int rf_offset, bb_offset; - const struct b43_rfatt *rfatt; - const struct b43_bbatt *bbatt; - u64 power_vector; - bool table_changed = false; - - BUILD_BUG_ON(B43_DC_LT_SIZE != 32); - B43_WARN_ON(lo->rfatt_list.len * lo->bbatt_list.len > 64); - - power_vector = lo->power_vector; - if (!update_all && !power_vector) - return; /* Nothing to do. */ - - /* Suspend the MAC now to avoid continuous suspend/enable - * cycles in the loop. */ - b43_mac_suspend(dev); - - for (i = 0; i < B43_DC_LT_SIZE * 2; i++) { - struct b43_lo_calib *cal; - int idx; - u16 val; - - if (!update_all && !(power_vector & (((u64)1ULL) << i))) - continue; - /* Update the table entry for this power_vector bit. - * The table rows are RFatt entries and columns are BBatt. */ - bb_offset = i / lo->rfatt_list.len; - rf_offset = i % lo->rfatt_list.len; - bbatt = &(lo->bbatt_list.list[bb_offset]); - rfatt = &(lo->rfatt_list.list[rf_offset]); - - cal = b43_calibrate_lo_setting(dev, bbatt, rfatt); - if (!cal) { - b43warn(dev->wl, "LO: Could not " - "calibrate DC table entry\n"); - continue; - } - /*FIXME: Is Q really in the low nibble? */ - val = (u8)(cal->ctl.q); - val |= ((u8)(cal->ctl.i)) << 4; - kfree(cal); - - /* Get the index into the hardware DC LT. */ - idx = i / 2; - /* Change the table in memory. */ - if (i % 2) { - /* Change the high byte. */ - lo->dc_lt[idx] = (lo->dc_lt[idx] & 0x00FF) - | ((val & 0x00FF) << 8); - } else { - /* Change the low byte. */ - lo->dc_lt[idx] = (lo->dc_lt[idx] & 0xFF00) - | (val & 0x00FF); - } - table_changed = true; - } - if (table_changed) { - /* The table changed in memory. Update the hardware table. */ - for (i = 0; i < B43_DC_LT_SIZE; i++) - b43_phy_write(dev, 0x3A0 + i, lo->dc_lt[i]); - } - b43_mac_enable(dev); -} - -/* Fixup the RF attenuation value for the case where we are - * using the PAD mixer. */ -static inline void b43_lo_fixup_rfatt(struct b43_rfatt *rf) -{ - if (!rf->with_padmix) - return; - if ((rf->att != 1) && (rf->att != 2) && (rf->att != 3)) - rf->att = 4; -} - -void b43_lo_g_adjust(struct b43_wldev *dev) -{ - struct b43_phy_g *gphy = dev->phy.g; - struct b43_lo_calib *cal; - struct b43_rfatt rf; - - memcpy(&rf, &gphy->rfatt, sizeof(rf)); - b43_lo_fixup_rfatt(&rf); - - cal = b43_get_calib_lo_settings(dev, &gphy->bbatt, &rf); - if (!cal) - return; - b43_lo_write(dev, &cal->ctl); -} - -void b43_lo_g_adjust_to(struct b43_wldev *dev, - u16 rfatt, u16 bbatt, u16 tx_control) -{ - struct b43_rfatt rf; - struct b43_bbatt bb; - struct b43_lo_calib *cal; - - memset(&rf, 0, sizeof(rf)); - memset(&bb, 0, sizeof(bb)); - rf.att = rfatt; - bb.att = bbatt; - b43_lo_fixup_rfatt(&rf); - cal = b43_get_calib_lo_settings(dev, &bb, &rf); - if (!cal) - return; - b43_lo_write(dev, &cal->ctl); -} - -/* Periodic LO maintanance work */ -void b43_lo_g_maintanance_work(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - struct b43_txpower_lo_control *lo = gphy->lo_control; - unsigned long now; - unsigned long expire; - struct b43_lo_calib *cal, *tmp; - bool current_item_expired = false; - bool hwpctl; - - if (!lo) - return; - now = jiffies; - hwpctl = b43_has_hardware_pctl(dev); - - if (hwpctl) { - /* Read the power vector and update it, if needed. */ - expire = now - B43_LO_PWRVEC_EXPIRE; - if (time_before(lo->pwr_vec_read_time, expire)) { - lo_read_power_vector(dev); - b43_gphy_dc_lt_init(dev, 0); - } - //FIXME Recalc the whole DC table from time to time? - } - - if (hwpctl) - return; - /* Search for expired LO settings. Remove them. - * Recalibrate the current setting, if expired. */ - expire = now - B43_LO_CALIB_EXPIRE; - list_for_each_entry_safe(cal, tmp, &lo->calib_list, list) { - if (!time_before(cal->calib_time, expire)) - continue; - /* This item expired. */ - if (b43_compare_bbatt(&cal->bbatt, &gphy->bbatt) && - b43_compare_rfatt(&cal->rfatt, &gphy->rfatt)) { - B43_WARN_ON(current_item_expired); - current_item_expired = true; - } - if (b43_debug(dev, B43_DBG_LO)) { - b43dbg(dev->wl, "LO: Item BB(%u), RF(%u,%u), " - "I=%d, Q=%d expired\n", - cal->bbatt.att, cal->rfatt.att, - cal->rfatt.with_padmix, - cal->ctl.i, cal->ctl.q); - } - list_del(&cal->list); - kfree(cal); - } - if (current_item_expired || unlikely(list_empty(&lo->calib_list))) { - /* Recalibrate currently used LO setting. */ - if (b43_debug(dev, B43_DBG_LO)) - b43dbg(dev->wl, "LO: Recalibrating current LO setting\n"); - cal = b43_calibrate_lo_setting(dev, &gphy->bbatt, &gphy->rfatt); - if (cal) { - list_add(&cal->list, &lo->calib_list); - b43_lo_write(dev, &cal->ctl); - } else - b43warn(dev->wl, "Failed to recalibrate current LO setting\n"); - } -} - -void b43_lo_g_cleanup(struct b43_wldev *dev) -{ - struct b43_txpower_lo_control *lo = dev->phy.g->lo_control; - struct b43_lo_calib *cal, *tmp; - - if (!lo) - return; - list_for_each_entry_safe(cal, tmp, &lo->calib_list, list) { - list_del(&cal->list); - kfree(cal); - } -} - -/* LO Initialization */ -void b43_lo_g_init(struct b43_wldev *dev) -{ - if (b43_has_hardware_pctl(dev)) { - lo_read_power_vector(dev); - b43_gphy_dc_lt_init(dev, 1); - } -} diff --git a/drivers/net/wireless/b43/lo.h b/drivers/net/wireless/b43/lo.h deleted file mode 100644 index 3b27e20eff80..000000000000 --- a/drivers/net/wireless/b43/lo.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef B43_LO_H_ -#define B43_LO_H_ - -/* G-PHY Local Oscillator */ - -#include "phy_g.h" - -struct b43_wldev; - -/* Local Oscillator control value-pair. */ -struct b43_loctl { - /* Control values. */ - s8 i; - s8 q; -}; -/* Debugging: Poison value for i and q values. */ -#define B43_LOCTL_POISON 111 - -/* This struct holds calibrated LO settings for a set of - * Baseband and RF attenuation settings. */ -struct b43_lo_calib { - /* The set of attenuation values this set of LO - * control values is calibrated for. */ - struct b43_bbatt bbatt; - struct b43_rfatt rfatt; - /* The set of control values for the LO. */ - struct b43_loctl ctl; - /* The time when these settings were calibrated (in jiffies) */ - unsigned long calib_time; - /* List. */ - struct list_head list; -}; - -/* Size of the DC Lookup Table in 16bit words. */ -#define B43_DC_LT_SIZE 32 - -/* Local Oscillator calibration information */ -struct b43_txpower_lo_control { - /* Lists of RF and BB attenuation values for this device. - * Used for building hardware power control tables. */ - struct b43_rfatt_list rfatt_list; - struct b43_bbatt_list bbatt_list; - - /* The DC Lookup Table is cached in memory here. - * Note that this is only used for Hardware Power Control. */ - u16 dc_lt[B43_DC_LT_SIZE]; - - /* List of calibrated control values (struct b43_lo_calib). */ - struct list_head calib_list; - /* Last time the power vector was read (jiffies). */ - unsigned long pwr_vec_read_time; - /* Last time the txctl values were measured (jiffies). */ - unsigned long txctl_measured_time; - - /* Current TX Bias value */ - u8 tx_bias; - /* Current TX Magnification Value (if used by the device) */ - u8 tx_magn; - - /* Saved device PowerVector */ - u64 power_vector; -}; - -/* Calibration expire timeouts. - * Timeouts must be multiple of 15 seconds. To make sure - * the item really expired when the 15 second timer hits, we - * subtract two additional seconds from the timeout. */ -#define B43_LO_CALIB_EXPIRE (HZ * (30 - 2)) -#define B43_LO_PWRVEC_EXPIRE (HZ * (30 - 2)) -#define B43_LO_TXCTL_EXPIRE (HZ * (180 - 4)) - - -/* Adjust the Local Oscillator to the saved attenuation - * and txctl values. - */ -void b43_lo_g_adjust(struct b43_wldev *dev); -/* Adjust to specific values. */ -void b43_lo_g_adjust_to(struct b43_wldev *dev, - u16 rfatt, u16 bbatt, u16 tx_control); - -void b43_gphy_dc_lt_init(struct b43_wldev *dev, bool update_all); - -void b43_lo_g_maintanance_work(struct b43_wldev *dev); -void b43_lo_g_cleanup(struct b43_wldev *dev); -void b43_lo_g_init(struct b43_wldev *dev); - -#endif /* B43_LO_H_ */ diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c deleted file mode 100644 index a95b77ab360e..000000000000 --- a/drivers/net/wireless/b43/main.c +++ /dev/null @@ -1,5629 +0,0 @@ -/* - - Broadcom B43 wireless driver - - Copyright (c) 2005 Martin Langer - Copyright (c) 2005 Stefano Brivio - Copyright (c) 2005-2009 Michael Buesch - Copyright (c) 2005 Danny van Dyk - Copyright (c) 2005 Andreas Jaggi - Copyright (c) 2010-2011 Rafał Miłecki - - SDIO support - Copyright (c) 2009 Albert Herranz - - Some parts of the code in this file are derived from the ipw2200 - driver Copyright(c) 2003 - 2004 Intel Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "b43.h" -#include "main.h" -#include "debugfs.h" -#include "phy_common.h" -#include "phy_g.h" -#include "phy_n.h" -#include "dma.h" -#include "pio.h" -#include "sysfs.h" -#include "xmit.h" -#include "lo.h" -#include "pcmcia.h" -#include "sdio.h" -#include - -MODULE_DESCRIPTION("Broadcom B43 wireless driver"); -MODULE_AUTHOR("Martin Langer"); -MODULE_AUTHOR("Stefano Brivio"); -MODULE_AUTHOR("Michael Buesch"); -MODULE_AUTHOR("Gábor Stefanik"); -MODULE_AUTHOR("Rafał Miłecki"); -MODULE_LICENSE("GPL"); - -MODULE_FIRMWARE("b43/ucode11.fw"); -MODULE_FIRMWARE("b43/ucode13.fw"); -MODULE_FIRMWARE("b43/ucode14.fw"); -MODULE_FIRMWARE("b43/ucode15.fw"); -MODULE_FIRMWARE("b43/ucode16_mimo.fw"); -MODULE_FIRMWARE("b43/ucode5.fw"); -MODULE_FIRMWARE("b43/ucode9.fw"); - -static int modparam_bad_frames_preempt; -module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444); -MODULE_PARM_DESC(bad_frames_preempt, - "enable(1) / disable(0) Bad Frames Preemption"); - -static char modparam_fwpostfix[16]; -module_param_string(fwpostfix, modparam_fwpostfix, 16, 0444); -MODULE_PARM_DESC(fwpostfix, "Postfix for the .fw files to load."); - -static int modparam_hwpctl; -module_param_named(hwpctl, modparam_hwpctl, int, 0444); -MODULE_PARM_DESC(hwpctl, "Enable hardware-side power control (default off)"); - -static int modparam_nohwcrypt; -module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444); -MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); - -static int modparam_hwtkip; -module_param_named(hwtkip, modparam_hwtkip, int, 0444); -MODULE_PARM_DESC(hwtkip, "Enable hardware tkip."); - -static int modparam_qos = 1; -module_param_named(qos, modparam_qos, int, 0444); -MODULE_PARM_DESC(qos, "Enable QOS support (default on)"); - -static int modparam_btcoex = 1; -module_param_named(btcoex, modparam_btcoex, int, 0444); -MODULE_PARM_DESC(btcoex, "Enable Bluetooth coexistence (default on)"); - -int b43_modparam_verbose = B43_VERBOSITY_DEFAULT; -module_param_named(verbose, b43_modparam_verbose, int, 0644); -MODULE_PARM_DESC(verbose, "Log message verbosity: 0=error, 1=warn, 2=info(default), 3=debug"); - -static int b43_modparam_pio = 0; -module_param_named(pio, b43_modparam_pio, int, 0644); -MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO"); - -#ifdef CONFIG_B43_BCMA -static const struct bcma_device_id b43_bcma_tbl[] = { - BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x11, BCMA_ANY_CLASS), -#ifdef CONFIG_B43_BCMA_EXTRA - BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x17, BCMA_ANY_CLASS), - BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x18, BCMA_ANY_CLASS), -#endif - BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x1D, BCMA_ANY_CLASS), - BCMA_CORETABLE_END -}; -MODULE_DEVICE_TABLE(bcma, b43_bcma_tbl); -#endif - -#ifdef CONFIG_B43_SSB -static const struct ssb_device_id b43_ssb_tbl[] = { - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 5), - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 6), - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 7), - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 9), - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 10), - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 11), - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 12), - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 13), - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 15), - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 16), - SSB_DEVTABLE_END -}; -MODULE_DEVICE_TABLE(ssb, b43_ssb_tbl); -#endif - -/* Channel and ratetables are shared for all devices. - * They can't be const, because ieee80211 puts some precalculated - * data in there. This data is the same for all devices, so we don't - * get concurrency issues */ -#define RATETAB_ENT(_rateid, _flags) \ - { \ - .bitrate = B43_RATE_TO_BASE100KBPS(_rateid), \ - .hw_value = (_rateid), \ - .flags = (_flags), \ - } - -/* - * NOTE: When changing this, sync with xmit.c's - * b43_plcp_get_bitrate_idx_* functions! - */ -static struct ieee80211_rate __b43_ratetable[] = { - RATETAB_ENT(B43_CCK_RATE_1MB, 0), - RATETAB_ENT(B43_CCK_RATE_2MB, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(B43_CCK_RATE_5MB, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(B43_CCK_RATE_11MB, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(B43_OFDM_RATE_6MB, 0), - RATETAB_ENT(B43_OFDM_RATE_9MB, 0), - RATETAB_ENT(B43_OFDM_RATE_12MB, 0), - RATETAB_ENT(B43_OFDM_RATE_18MB, 0), - RATETAB_ENT(B43_OFDM_RATE_24MB, 0), - RATETAB_ENT(B43_OFDM_RATE_36MB, 0), - RATETAB_ENT(B43_OFDM_RATE_48MB, 0), - RATETAB_ENT(B43_OFDM_RATE_54MB, 0), -}; - -#define b43_a_ratetable (__b43_ratetable + 4) -#define b43_a_ratetable_size 8 -#define b43_b_ratetable (__b43_ratetable + 0) -#define b43_b_ratetable_size 4 -#define b43_g_ratetable (__b43_ratetable + 0) -#define b43_g_ratetable_size 12 - -#define CHAN4G(_channel, _freq, _flags) { \ - .band = IEEE80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} -static struct ieee80211_channel b43_2ghz_chantable[] = { - CHAN4G(1, 2412, 0), - CHAN4G(2, 2417, 0), - CHAN4G(3, 2422, 0), - CHAN4G(4, 2427, 0), - CHAN4G(5, 2432, 0), - CHAN4G(6, 2437, 0), - CHAN4G(7, 2442, 0), - CHAN4G(8, 2447, 0), - CHAN4G(9, 2452, 0), - CHAN4G(10, 2457, 0), - CHAN4G(11, 2462, 0), - CHAN4G(12, 2467, 0), - CHAN4G(13, 2472, 0), - CHAN4G(14, 2484, 0), -}; -#undef CHAN4G - -#define CHAN5G(_channel, _flags) { \ - .band = IEEE80211_BAND_5GHZ, \ - .center_freq = 5000 + (5 * (_channel)), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} -static struct ieee80211_channel b43_5ghz_nphy_chantable[] = { - CHAN5G(32, 0), CHAN5G(34, 0), - CHAN5G(36, 0), CHAN5G(38, 0), - CHAN5G(40, 0), CHAN5G(42, 0), - CHAN5G(44, 0), CHAN5G(46, 0), - CHAN5G(48, 0), CHAN5G(50, 0), - CHAN5G(52, 0), CHAN5G(54, 0), - CHAN5G(56, 0), CHAN5G(58, 0), - CHAN5G(60, 0), CHAN5G(62, 0), - CHAN5G(64, 0), CHAN5G(66, 0), - CHAN5G(68, 0), CHAN5G(70, 0), - CHAN5G(72, 0), CHAN5G(74, 0), - CHAN5G(76, 0), CHAN5G(78, 0), - CHAN5G(80, 0), CHAN5G(82, 0), - CHAN5G(84, 0), CHAN5G(86, 0), - CHAN5G(88, 0), CHAN5G(90, 0), - CHAN5G(92, 0), CHAN5G(94, 0), - CHAN5G(96, 0), CHAN5G(98, 0), - CHAN5G(100, 0), CHAN5G(102, 0), - CHAN5G(104, 0), CHAN5G(106, 0), - CHAN5G(108, 0), CHAN5G(110, 0), - CHAN5G(112, 0), CHAN5G(114, 0), - CHAN5G(116, 0), CHAN5G(118, 0), - CHAN5G(120, 0), CHAN5G(122, 0), - CHAN5G(124, 0), CHAN5G(126, 0), - CHAN5G(128, 0), CHAN5G(130, 0), - CHAN5G(132, 0), CHAN5G(134, 0), - CHAN5G(136, 0), CHAN5G(138, 0), - CHAN5G(140, 0), CHAN5G(142, 0), - CHAN5G(144, 0), CHAN5G(145, 0), - CHAN5G(146, 0), CHAN5G(147, 0), - CHAN5G(148, 0), CHAN5G(149, 0), - CHAN5G(150, 0), CHAN5G(151, 0), - CHAN5G(152, 0), CHAN5G(153, 0), - CHAN5G(154, 0), CHAN5G(155, 0), - CHAN5G(156, 0), CHAN5G(157, 0), - CHAN5G(158, 0), CHAN5G(159, 0), - CHAN5G(160, 0), CHAN5G(161, 0), - CHAN5G(162, 0), CHAN5G(163, 0), - CHAN5G(164, 0), CHAN5G(165, 0), - CHAN5G(166, 0), CHAN5G(168, 0), - CHAN5G(170, 0), CHAN5G(172, 0), - CHAN5G(174, 0), CHAN5G(176, 0), - CHAN5G(178, 0), CHAN5G(180, 0), - CHAN5G(182, 0), CHAN5G(184, 0), - CHAN5G(186, 0), CHAN5G(188, 0), - CHAN5G(190, 0), CHAN5G(192, 0), - CHAN5G(194, 0), CHAN5G(196, 0), - CHAN5G(198, 0), CHAN5G(200, 0), - CHAN5G(202, 0), CHAN5G(204, 0), - CHAN5G(206, 0), CHAN5G(208, 0), - CHAN5G(210, 0), CHAN5G(212, 0), - CHAN5G(214, 0), CHAN5G(216, 0), - CHAN5G(218, 0), CHAN5G(220, 0), - CHAN5G(222, 0), CHAN5G(224, 0), - CHAN5G(226, 0), CHAN5G(228, 0), -}; - -static struct ieee80211_channel b43_5ghz_aphy_chantable[] = { - CHAN5G(34, 0), CHAN5G(36, 0), - CHAN5G(38, 0), CHAN5G(40, 0), - CHAN5G(42, 0), CHAN5G(44, 0), - CHAN5G(46, 0), CHAN5G(48, 0), - CHAN5G(52, 0), CHAN5G(56, 0), - CHAN5G(60, 0), CHAN5G(64, 0), - CHAN5G(100, 0), CHAN5G(104, 0), - CHAN5G(108, 0), CHAN5G(112, 0), - CHAN5G(116, 0), CHAN5G(120, 0), - CHAN5G(124, 0), CHAN5G(128, 0), - CHAN5G(132, 0), CHAN5G(136, 0), - CHAN5G(140, 0), CHAN5G(149, 0), - CHAN5G(153, 0), CHAN5G(157, 0), - CHAN5G(161, 0), CHAN5G(165, 0), - CHAN5G(184, 0), CHAN5G(188, 0), - CHAN5G(192, 0), CHAN5G(196, 0), - CHAN5G(200, 0), CHAN5G(204, 0), - CHAN5G(208, 0), CHAN5G(212, 0), - CHAN5G(216, 0), -}; -#undef CHAN5G - -static struct ieee80211_supported_band b43_band_5GHz_nphy = { - .band = IEEE80211_BAND_5GHZ, - .channels = b43_5ghz_nphy_chantable, - .n_channels = ARRAY_SIZE(b43_5ghz_nphy_chantable), - .bitrates = b43_a_ratetable, - .n_bitrates = b43_a_ratetable_size, -}; - -static struct ieee80211_supported_band b43_band_5GHz_aphy = { - .band = IEEE80211_BAND_5GHZ, - .channels = b43_5ghz_aphy_chantable, - .n_channels = ARRAY_SIZE(b43_5ghz_aphy_chantable), - .bitrates = b43_a_ratetable, - .n_bitrates = b43_a_ratetable_size, -}; - -static struct ieee80211_supported_band b43_band_2GHz = { - .band = IEEE80211_BAND_2GHZ, - .channels = b43_2ghz_chantable, - .n_channels = ARRAY_SIZE(b43_2ghz_chantable), - .bitrates = b43_g_ratetable, - .n_bitrates = b43_g_ratetable_size, -}; - -static void b43_wireless_core_exit(struct b43_wldev *dev); -static int b43_wireless_core_init(struct b43_wldev *dev); -static struct b43_wldev * b43_wireless_core_stop(struct b43_wldev *dev); -static int b43_wireless_core_start(struct b43_wldev *dev); -static void b43_op_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *conf, - u32 changed); - -static int b43_ratelimit(struct b43_wl *wl) -{ - if (!wl || !wl->current_dev) - return 1; - if (b43_status(wl->current_dev) < B43_STAT_STARTED) - return 1; - /* We are up and running. - * Ratelimit the messages to avoid DoS over the net. */ - return net_ratelimit(); -} - -void b43info(struct b43_wl *wl, const char *fmt, ...) -{ - struct va_format vaf; - va_list args; - - if (b43_modparam_verbose < B43_VERBOSITY_INFO) - return; - if (!b43_ratelimit(wl)) - return; - - va_start(args, fmt); - - vaf.fmt = fmt; - vaf.va = &args; - - printk(KERN_INFO "b43-%s: %pV", - (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf); - - va_end(args); -} - -void b43err(struct b43_wl *wl, const char *fmt, ...) -{ - struct va_format vaf; - va_list args; - - if (b43_modparam_verbose < B43_VERBOSITY_ERROR) - return; - if (!b43_ratelimit(wl)) - return; - - va_start(args, fmt); - - vaf.fmt = fmt; - vaf.va = &args; - - printk(KERN_ERR "b43-%s ERROR: %pV", - (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf); - - va_end(args); -} - -void b43warn(struct b43_wl *wl, const char *fmt, ...) -{ - struct va_format vaf; - va_list args; - - if (b43_modparam_verbose < B43_VERBOSITY_WARN) - return; - if (!b43_ratelimit(wl)) - return; - - va_start(args, fmt); - - vaf.fmt = fmt; - vaf.va = &args; - - printk(KERN_WARNING "b43-%s warning: %pV", - (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf); - - va_end(args); -} - -void b43dbg(struct b43_wl *wl, const char *fmt, ...) -{ - struct va_format vaf; - va_list args; - - if (b43_modparam_verbose < B43_VERBOSITY_DEBUG) - return; - - va_start(args, fmt); - - vaf.fmt = fmt; - vaf.va = &args; - - printk(KERN_DEBUG "b43-%s debug: %pV", - (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf); - - va_end(args); -} - -static void b43_ram_write(struct b43_wldev *dev, u16 offset, u32 val) -{ - u32 macctl; - - B43_WARN_ON(offset % 4 != 0); - - macctl = b43_read32(dev, B43_MMIO_MACCTL); - if (macctl & B43_MACCTL_BE) - val = swab32(val); - - b43_write32(dev, B43_MMIO_RAM_CONTROL, offset); - mmiowb(); - b43_write32(dev, B43_MMIO_RAM_DATA, val); -} - -static inline void b43_shm_control_word(struct b43_wldev *dev, - u16 routing, u16 offset) -{ - u32 control; - - /* "offset" is the WORD offset. */ - control = routing; - control <<= 16; - control |= offset; - b43_write32(dev, B43_MMIO_SHM_CONTROL, control); -} - -u32 b43_shm_read32(struct b43_wldev *dev, u16 routing, u16 offset) -{ - u32 ret; - - if (routing == B43_SHM_SHARED) { - B43_WARN_ON(offset & 0x0001); - if (offset & 0x0003) { - /* Unaligned access */ - b43_shm_control_word(dev, routing, offset >> 2); - ret = b43_read16(dev, B43_MMIO_SHM_DATA_UNALIGNED); - b43_shm_control_word(dev, routing, (offset >> 2) + 1); - ret |= ((u32)b43_read16(dev, B43_MMIO_SHM_DATA)) << 16; - - goto out; - } - offset >>= 2; - } - b43_shm_control_word(dev, routing, offset); - ret = b43_read32(dev, B43_MMIO_SHM_DATA); -out: - return ret; -} - -u16 b43_shm_read16(struct b43_wldev *dev, u16 routing, u16 offset) -{ - u16 ret; - - if (routing == B43_SHM_SHARED) { - B43_WARN_ON(offset & 0x0001); - if (offset & 0x0003) { - /* Unaligned access */ - b43_shm_control_word(dev, routing, offset >> 2); - ret = b43_read16(dev, B43_MMIO_SHM_DATA_UNALIGNED); - - goto out; - } - offset >>= 2; - } - b43_shm_control_word(dev, routing, offset); - ret = b43_read16(dev, B43_MMIO_SHM_DATA); -out: - return ret; -} - -void b43_shm_write32(struct b43_wldev *dev, u16 routing, u16 offset, u32 value) -{ - if (routing == B43_SHM_SHARED) { - B43_WARN_ON(offset & 0x0001); - if (offset & 0x0003) { - /* Unaligned access */ - b43_shm_control_word(dev, routing, offset >> 2); - b43_write16(dev, B43_MMIO_SHM_DATA_UNALIGNED, - value & 0xFFFF); - b43_shm_control_word(dev, routing, (offset >> 2) + 1); - b43_write16(dev, B43_MMIO_SHM_DATA, - (value >> 16) & 0xFFFF); - return; - } - offset >>= 2; - } - b43_shm_control_word(dev, routing, offset); - b43_write32(dev, B43_MMIO_SHM_DATA, value); -} - -void b43_shm_write16(struct b43_wldev *dev, u16 routing, u16 offset, u16 value) -{ - if (routing == B43_SHM_SHARED) { - B43_WARN_ON(offset & 0x0001); - if (offset & 0x0003) { - /* Unaligned access */ - b43_shm_control_word(dev, routing, offset >> 2); - b43_write16(dev, B43_MMIO_SHM_DATA_UNALIGNED, value); - return; - } - offset >>= 2; - } - b43_shm_control_word(dev, routing, offset); - b43_write16(dev, B43_MMIO_SHM_DATA, value); -} - -/* Read HostFlags */ -u64 b43_hf_read(struct b43_wldev *dev) -{ - u64 ret; - - ret = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_HOSTF3); - ret <<= 16; - ret |= b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_HOSTF2); - ret <<= 16; - ret |= b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_HOSTF1); - - return ret; -} - -/* Write HostFlags */ -void b43_hf_write(struct b43_wldev *dev, u64 value) -{ - u16 lo, mi, hi; - - lo = (value & 0x00000000FFFFULL); - mi = (value & 0x0000FFFF0000ULL) >> 16; - hi = (value & 0xFFFF00000000ULL) >> 32; - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_HOSTF1, lo); - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_HOSTF2, mi); - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_HOSTF3, hi); -} - -/* Read the firmware capabilities bitmask (Opensource firmware only) */ -static u16 b43_fwcapa_read(struct b43_wldev *dev) -{ - B43_WARN_ON(!dev->fw.opensource); - return b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_FWCAPA); -} - -void b43_tsf_read(struct b43_wldev *dev, u64 *tsf) -{ - u32 low, high; - - B43_WARN_ON(dev->dev->core_rev < 3); - - /* The hardware guarantees us an atomic read, if we - * read the low register first. */ - low = b43_read32(dev, B43_MMIO_REV3PLUS_TSF_LOW); - high = b43_read32(dev, B43_MMIO_REV3PLUS_TSF_HIGH); - - *tsf = high; - *tsf <<= 32; - *tsf |= low; -} - -static void b43_time_lock(struct b43_wldev *dev) -{ - b43_maskset32(dev, B43_MMIO_MACCTL, ~0, B43_MACCTL_TBTTHOLD); - /* Commit the write */ - b43_read32(dev, B43_MMIO_MACCTL); -} - -static void b43_time_unlock(struct b43_wldev *dev) -{ - b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_TBTTHOLD, 0); - /* Commit the write */ - b43_read32(dev, B43_MMIO_MACCTL); -} - -static void b43_tsf_write_locked(struct b43_wldev *dev, u64 tsf) -{ - u32 low, high; - - B43_WARN_ON(dev->dev->core_rev < 3); - - low = tsf; - high = (tsf >> 32); - /* The hardware guarantees us an atomic write, if we - * write the low register first. */ - b43_write32(dev, B43_MMIO_REV3PLUS_TSF_LOW, low); - mmiowb(); - b43_write32(dev, B43_MMIO_REV3PLUS_TSF_HIGH, high); - mmiowb(); -} - -void b43_tsf_write(struct b43_wldev *dev, u64 tsf) -{ - b43_time_lock(dev); - b43_tsf_write_locked(dev, tsf); - b43_time_unlock(dev); -} - -static -void b43_macfilter_set(struct b43_wldev *dev, u16 offset, const u8 *mac) -{ - static const u8 zero_addr[ETH_ALEN] = { 0 }; - u16 data; - - if (!mac) - mac = zero_addr; - - offset |= 0x0020; - b43_write16(dev, B43_MMIO_MACFILTER_CONTROL, offset); - - data = mac[0]; - data |= mac[1] << 8; - b43_write16(dev, B43_MMIO_MACFILTER_DATA, data); - data = mac[2]; - data |= mac[3] << 8; - b43_write16(dev, B43_MMIO_MACFILTER_DATA, data); - data = mac[4]; - data |= mac[5] << 8; - b43_write16(dev, B43_MMIO_MACFILTER_DATA, data); -} - -static void b43_write_mac_bssid_templates(struct b43_wldev *dev) -{ - const u8 *mac; - const u8 *bssid; - u8 mac_bssid[ETH_ALEN * 2]; - int i; - u32 tmp; - - bssid = dev->wl->bssid; - mac = dev->wl->mac_addr; - - b43_macfilter_set(dev, B43_MACFILTER_BSSID, bssid); - - memcpy(mac_bssid, mac, ETH_ALEN); - memcpy(mac_bssid + ETH_ALEN, bssid, ETH_ALEN); - - /* Write our MAC address and BSSID to template ram */ - for (i = 0; i < ARRAY_SIZE(mac_bssid); i += sizeof(u32)) { - tmp = (u32) (mac_bssid[i + 0]); - tmp |= (u32) (mac_bssid[i + 1]) << 8; - tmp |= (u32) (mac_bssid[i + 2]) << 16; - tmp |= (u32) (mac_bssid[i + 3]) << 24; - b43_ram_write(dev, 0x20 + i, tmp); - } -} - -static void b43_upload_card_macaddress(struct b43_wldev *dev) -{ - b43_write_mac_bssid_templates(dev); - b43_macfilter_set(dev, B43_MACFILTER_SELF, dev->wl->mac_addr); -} - -static void b43_set_slot_time(struct b43_wldev *dev, u16 slot_time) -{ - /* slot_time is in usec. */ - /* This test used to exit for all but a G PHY. */ - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) - return; - b43_write16(dev, B43_MMIO_IFSSLOT, 510 + slot_time); - /* Shared memory location 0x0010 is the slot time and should be - * set to slot_time; however, this register is initially 0 and changing - * the value adversely affects the transmit rate for BCM4311 - * devices. Until this behavior is unterstood, delete this step - * - * b43_shm_write16(dev, B43_SHM_SHARED, 0x0010, slot_time); - */ -} - -static void b43_short_slot_timing_enable(struct b43_wldev *dev) -{ - b43_set_slot_time(dev, 9); -} - -static void b43_short_slot_timing_disable(struct b43_wldev *dev) -{ - b43_set_slot_time(dev, 20); -} - -/* DummyTransmission function, as documented on - * http://bcm-v4.sipsolutions.net/802.11/DummyTransmission - */ -void b43_dummy_transmission(struct b43_wldev *dev, bool ofdm, bool pa_on) -{ - struct b43_phy *phy = &dev->phy; - unsigned int i, max_loop; - u16 value; - u32 buffer[5] = { - 0x00000000, - 0x00D40000, - 0x00000000, - 0x01000000, - 0x00000000, - }; - - if (ofdm) { - max_loop = 0x1E; - buffer[0] = 0x000201CC; - } else { - max_loop = 0xFA; - buffer[0] = 0x000B846E; - } - - for (i = 0; i < 5; i++) - b43_ram_write(dev, i * 4, buffer[i]); - - b43_write16(dev, B43_MMIO_XMTSEL, 0x0000); - - if (dev->dev->core_rev < 11) - b43_write16(dev, B43_MMIO_WEPCTL, 0x0000); - else - b43_write16(dev, B43_MMIO_WEPCTL, 0x0100); - - value = (ofdm ? 0x41 : 0x40); - b43_write16(dev, B43_MMIO_TXE0_PHYCTL, value); - if (phy->type == B43_PHYTYPE_N || phy->type == B43_PHYTYPE_LP || - phy->type == B43_PHYTYPE_LCN) - b43_write16(dev, B43_MMIO_TXE0_PHYCTL1, 0x1A02); - - b43_write16(dev, B43_MMIO_TXE0_WM_0, 0x0000); - b43_write16(dev, B43_MMIO_TXE0_WM_1, 0x0000); - - b43_write16(dev, B43_MMIO_XMTTPLATETXPTR, 0x0000); - b43_write16(dev, B43_MMIO_XMTTXCNT, 0x0014); - b43_write16(dev, B43_MMIO_XMTSEL, 0x0826); - b43_write16(dev, B43_MMIO_TXE0_CTL, 0x0000); - - if (!pa_on && phy->type == B43_PHYTYPE_N) - ; /*b43_nphy_pa_override(dev, false) */ - - switch (phy->type) { - case B43_PHYTYPE_N: - case B43_PHYTYPE_LCN: - b43_write16(dev, B43_MMIO_TXE0_AUX, 0x00D0); - break; - case B43_PHYTYPE_LP: - b43_write16(dev, B43_MMIO_TXE0_AUX, 0x0050); - break; - default: - b43_write16(dev, B43_MMIO_TXE0_AUX, 0x0030); - } - b43_read16(dev, B43_MMIO_TXE0_AUX); - - if (phy->radio_ver == 0x2050 && phy->radio_rev <= 0x5) - b43_radio_write16(dev, 0x0051, 0x0017); - for (i = 0x00; i < max_loop; i++) { - value = b43_read16(dev, B43_MMIO_TXE0_STATUS); - if (value & 0x0080) - break; - udelay(10); - } - for (i = 0x00; i < 0x0A; i++) { - value = b43_read16(dev, B43_MMIO_TXE0_STATUS); - if (value & 0x0400) - break; - udelay(10); - } - for (i = 0x00; i < 0x19; i++) { - value = b43_read16(dev, B43_MMIO_IFSSTAT); - if (!(value & 0x0100)) - break; - udelay(10); - } - if (phy->radio_ver == 0x2050 && phy->radio_rev <= 0x5) - b43_radio_write16(dev, 0x0051, 0x0037); -} - -static void key_write(struct b43_wldev *dev, - u8 index, u8 algorithm, const u8 *key) -{ - unsigned int i; - u32 offset; - u16 value; - u16 kidx; - - /* Key index/algo block */ - kidx = b43_kidx_to_fw(dev, index); - value = ((kidx << 4) | algorithm); - b43_shm_write16(dev, B43_SHM_SHARED, - B43_SHM_SH_KEYIDXBLOCK + (kidx * 2), value); - - /* Write the key to the Key Table Pointer offset */ - offset = dev->ktp + (index * B43_SEC_KEYSIZE); - for (i = 0; i < B43_SEC_KEYSIZE; i += 2) { - value = key[i]; - value |= (u16) (key[i + 1]) << 8; - b43_shm_write16(dev, B43_SHM_SHARED, offset + i, value); - } -} - -static void keymac_write(struct b43_wldev *dev, u8 index, const u8 *addr) -{ - u32 addrtmp[2] = { 0, 0, }; - u8 pairwise_keys_start = B43_NR_GROUP_KEYS * 2; - - if (b43_new_kidx_api(dev)) - pairwise_keys_start = B43_NR_GROUP_KEYS; - - B43_WARN_ON(index < pairwise_keys_start); - /* We have four default TX keys and possibly four default RX keys. - * Physical mac 0 is mapped to physical key 4 or 8, depending - * on the firmware version. - * So we must adjust the index here. - */ - index -= pairwise_keys_start; - B43_WARN_ON(index >= B43_NR_PAIRWISE_KEYS); - - if (addr) { - addrtmp[0] = addr[0]; - addrtmp[0] |= ((u32) (addr[1]) << 8); - addrtmp[0] |= ((u32) (addr[2]) << 16); - addrtmp[0] |= ((u32) (addr[3]) << 24); - addrtmp[1] = addr[4]; - addrtmp[1] |= ((u32) (addr[5]) << 8); - } - - /* Receive match transmitter address (RCMTA) mechanism */ - b43_shm_write32(dev, B43_SHM_RCMTA, - (index * 2) + 0, addrtmp[0]); - b43_shm_write16(dev, B43_SHM_RCMTA, - (index * 2) + 1, addrtmp[1]); -} - -/* The ucode will use phase1 key with TEK key to decrypt rx packets. - * When a packet is received, the iv32 is checked. - * - if it doesn't the packet is returned without modification (and software - * decryption can be done). That's what happen when iv16 wrap. - * - if it does, the rc4 key is computed, and decryption is tried. - * Either it will success and B43_RX_MAC_DEC is returned, - * either it fails and B43_RX_MAC_DEC|B43_RX_MAC_DECERR is returned - * and the packet is not usable (it got modified by the ucode). - * So in order to never have B43_RX_MAC_DECERR, we should provide - * a iv32 and phase1key that match. Because we drop packets in case of - * B43_RX_MAC_DECERR, if we have a correct iv32 but a wrong phase1key, all - * packets will be lost without higher layer knowing (ie no resync possible - * until next wrap). - * - * NOTE : this should support 50 key like RCMTA because - * (B43_SHM_SH_KEYIDXBLOCK - B43_SHM_SH_TKIPTSCTTAK)/14 = 50 - */ -static void rx_tkip_phase1_write(struct b43_wldev *dev, u8 index, u32 iv32, - u16 *phase1key) -{ - unsigned int i; - u32 offset; - u8 pairwise_keys_start = B43_NR_GROUP_KEYS * 2; - - if (!modparam_hwtkip) - return; - - if (b43_new_kidx_api(dev)) - pairwise_keys_start = B43_NR_GROUP_KEYS; - - B43_WARN_ON(index < pairwise_keys_start); - /* We have four default TX keys and possibly four default RX keys. - * Physical mac 0 is mapped to physical key 4 or 8, depending - * on the firmware version. - * So we must adjust the index here. - */ - index -= pairwise_keys_start; - B43_WARN_ON(index >= B43_NR_PAIRWISE_KEYS); - - if (b43_debug(dev, B43_DBG_KEYS)) { - b43dbg(dev->wl, "rx_tkip_phase1_write : idx 0x%x, iv32 0x%x\n", - index, iv32); - } - /* Write the key to the RX tkip shared mem */ - offset = B43_SHM_SH_TKIPTSCTTAK + index * (10 + 4); - for (i = 0; i < 10; i += 2) { - b43_shm_write16(dev, B43_SHM_SHARED, offset + i, - phase1key ? phase1key[i / 2] : 0); - } - b43_shm_write16(dev, B43_SHM_SHARED, offset + i, iv32); - b43_shm_write16(dev, B43_SHM_SHARED, offset + i + 2, iv32 >> 16); -} - -static void b43_op_update_tkip_key(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_key_conf *keyconf, - struct ieee80211_sta *sta, - u32 iv32, u16 *phase1key) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev; - int index = keyconf->hw_key_idx; - - if (B43_WARN_ON(!modparam_hwtkip)) - return; - - /* This is only called from the RX path through mac80211, where - * our mutex is already locked. */ - B43_WARN_ON(!mutex_is_locked(&wl->mutex)); - dev = wl->current_dev; - B43_WARN_ON(!dev || b43_status(dev) < B43_STAT_INITIALIZED); - - keymac_write(dev, index, NULL); /* First zero out mac to avoid race */ - - rx_tkip_phase1_write(dev, index, iv32, phase1key); - /* only pairwise TKIP keys are supported right now */ - if (WARN_ON(!sta)) - return; - keymac_write(dev, index, sta->addr); -} - -static void do_key_write(struct b43_wldev *dev, - u8 index, u8 algorithm, - const u8 *key, size_t key_len, const u8 *mac_addr) -{ - u8 buf[B43_SEC_KEYSIZE] = { 0, }; - u8 pairwise_keys_start = B43_NR_GROUP_KEYS * 2; - - if (b43_new_kidx_api(dev)) - pairwise_keys_start = B43_NR_GROUP_KEYS; - - B43_WARN_ON(index >= ARRAY_SIZE(dev->key)); - B43_WARN_ON(key_len > B43_SEC_KEYSIZE); - - if (index >= pairwise_keys_start) - keymac_write(dev, index, NULL); /* First zero out mac. */ - if (algorithm == B43_SEC_ALGO_TKIP) { - /* - * We should provide an initial iv32, phase1key pair. - * We could start with iv32=0 and compute the corresponding - * phase1key, but this means calling ieee80211_get_tkip_key - * with a fake skb (or export other tkip function). - * Because we are lazy we hope iv32 won't start with - * 0xffffffff and let's b43_op_update_tkip_key provide a - * correct pair. - */ - rx_tkip_phase1_write(dev, index, 0xffffffff, (u16*)buf); - } else if (index >= pairwise_keys_start) /* clear it */ - rx_tkip_phase1_write(dev, index, 0, NULL); - if (key) - memcpy(buf, key, key_len); - key_write(dev, index, algorithm, buf); - if (index >= pairwise_keys_start) - keymac_write(dev, index, mac_addr); - - dev->key[index].algorithm = algorithm; -} - -static int b43_key_write(struct b43_wldev *dev, - int index, u8 algorithm, - const u8 *key, size_t key_len, - const u8 *mac_addr, - struct ieee80211_key_conf *keyconf) -{ - int i; - int pairwise_keys_start; - - /* For ALG_TKIP the key is encoded as a 256-bit (32 byte) data block: - * - Temporal Encryption Key (128 bits) - * - Temporal Authenticator Tx MIC Key (64 bits) - * - Temporal Authenticator Rx MIC Key (64 bits) - * - * Hardware only store TEK - */ - if (algorithm == B43_SEC_ALGO_TKIP && key_len == 32) - key_len = 16; - if (key_len > B43_SEC_KEYSIZE) - return -EINVAL; - for (i = 0; i < ARRAY_SIZE(dev->key); i++) { - /* Check that we don't already have this key. */ - B43_WARN_ON(dev->key[i].keyconf == keyconf); - } - if (index < 0) { - /* Pairwise key. Get an empty slot for the key. */ - if (b43_new_kidx_api(dev)) - pairwise_keys_start = B43_NR_GROUP_KEYS; - else - pairwise_keys_start = B43_NR_GROUP_KEYS * 2; - for (i = pairwise_keys_start; - i < pairwise_keys_start + B43_NR_PAIRWISE_KEYS; - i++) { - B43_WARN_ON(i >= ARRAY_SIZE(dev->key)); - if (!dev->key[i].keyconf) { - /* found empty */ - index = i; - break; - } - } - if (index < 0) { - b43warn(dev->wl, "Out of hardware key memory\n"); - return -ENOSPC; - } - } else - B43_WARN_ON(index > 3); - - do_key_write(dev, index, algorithm, key, key_len, mac_addr); - if ((index <= 3) && !b43_new_kidx_api(dev)) { - /* Default RX key */ - B43_WARN_ON(mac_addr); - do_key_write(dev, index + 4, algorithm, key, key_len, NULL); - } - keyconf->hw_key_idx = index; - dev->key[index].keyconf = keyconf; - - return 0; -} - -static int b43_key_clear(struct b43_wldev *dev, int index) -{ - if (B43_WARN_ON((index < 0) || (index >= ARRAY_SIZE(dev->key)))) - return -EINVAL; - do_key_write(dev, index, B43_SEC_ALGO_NONE, - NULL, B43_SEC_KEYSIZE, NULL); - if ((index <= 3) && !b43_new_kidx_api(dev)) { - do_key_write(dev, index + 4, B43_SEC_ALGO_NONE, - NULL, B43_SEC_KEYSIZE, NULL); - } - dev->key[index].keyconf = NULL; - - return 0; -} - -static void b43_clear_keys(struct b43_wldev *dev) -{ - int i, count; - - if (b43_new_kidx_api(dev)) - count = B43_NR_GROUP_KEYS + B43_NR_PAIRWISE_KEYS; - else - count = B43_NR_GROUP_KEYS * 2 + B43_NR_PAIRWISE_KEYS; - for (i = 0; i < count; i++) - b43_key_clear(dev, i); -} - -static void b43_dump_keymemory(struct b43_wldev *dev) -{ - unsigned int i, index, count, offset, pairwise_keys_start; - u8 mac[ETH_ALEN]; - u16 algo; - u32 rcmta0; - u16 rcmta1; - u64 hf; - struct b43_key *key; - - if (!b43_debug(dev, B43_DBG_KEYS)) - return; - - hf = b43_hf_read(dev); - b43dbg(dev->wl, "Hardware key memory dump: USEDEFKEYS=%u\n", - !!(hf & B43_HF_USEDEFKEYS)); - if (b43_new_kidx_api(dev)) { - pairwise_keys_start = B43_NR_GROUP_KEYS; - count = B43_NR_GROUP_KEYS + B43_NR_PAIRWISE_KEYS; - } else { - pairwise_keys_start = B43_NR_GROUP_KEYS * 2; - count = B43_NR_GROUP_KEYS * 2 + B43_NR_PAIRWISE_KEYS; - } - for (index = 0; index < count; index++) { - key = &(dev->key[index]); - printk(KERN_DEBUG "Key slot %02u: %s", - index, (key->keyconf == NULL) ? " " : "*"); - offset = dev->ktp + (index * B43_SEC_KEYSIZE); - for (i = 0; i < B43_SEC_KEYSIZE; i += 2) { - u16 tmp = b43_shm_read16(dev, B43_SHM_SHARED, offset + i); - printk("%02X%02X", (tmp & 0xFF), ((tmp >> 8) & 0xFF)); - } - - algo = b43_shm_read16(dev, B43_SHM_SHARED, - B43_SHM_SH_KEYIDXBLOCK + (index * 2)); - printk(" Algo: %04X/%02X", algo, key->algorithm); - - if (index >= pairwise_keys_start) { - if (key->algorithm == B43_SEC_ALGO_TKIP) { - printk(" TKIP: "); - offset = B43_SHM_SH_TKIPTSCTTAK + (index - 4) * (10 + 4); - for (i = 0; i < 14; i += 2) { - u16 tmp = b43_shm_read16(dev, B43_SHM_SHARED, offset + i); - printk("%02X%02X", (tmp & 0xFF), ((tmp >> 8) & 0xFF)); - } - } - rcmta0 = b43_shm_read32(dev, B43_SHM_RCMTA, - ((index - pairwise_keys_start) * 2) + 0); - rcmta1 = b43_shm_read16(dev, B43_SHM_RCMTA, - ((index - pairwise_keys_start) * 2) + 1); - *((__le32 *)(&mac[0])) = cpu_to_le32(rcmta0); - *((__le16 *)(&mac[4])) = cpu_to_le16(rcmta1); - printk(" MAC: %pM", mac); - } else - printk(" DEFAULT KEY"); - printk("\n"); - } -} - -void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags) -{ - u32 macctl; - u16 ucstat; - bool hwps; - bool awake; - int i; - - B43_WARN_ON((ps_flags & B43_PS_ENABLED) && - (ps_flags & B43_PS_DISABLED)); - B43_WARN_ON((ps_flags & B43_PS_AWAKE) && (ps_flags & B43_PS_ASLEEP)); - - if (ps_flags & B43_PS_ENABLED) { - hwps = true; - } else if (ps_flags & B43_PS_DISABLED) { - hwps = false; - } else { - //TODO: If powersave is not off and FIXME is not set and we are not in adhoc - // and thus is not an AP and we are associated, set bit 25 - } - if (ps_flags & B43_PS_AWAKE) { - awake = true; - } else if (ps_flags & B43_PS_ASLEEP) { - awake = false; - } else { - //TODO: If the device is awake or this is an AP, or we are scanning, or FIXME, - // or we are associated, or FIXME, or the latest PS-Poll packet sent was - // successful, set bit26 - } - -/* FIXME: For now we force awake-on and hwps-off */ - hwps = false; - awake = true; - - macctl = b43_read32(dev, B43_MMIO_MACCTL); - if (hwps) - macctl |= B43_MACCTL_HWPS; - else - macctl &= ~B43_MACCTL_HWPS; - if (awake) - macctl |= B43_MACCTL_AWAKE; - else - macctl &= ~B43_MACCTL_AWAKE; - b43_write32(dev, B43_MMIO_MACCTL, macctl); - /* Commit write */ - b43_read32(dev, B43_MMIO_MACCTL); - if (awake && dev->dev->core_rev >= 5) { - /* Wait for the microcode to wake up. */ - for (i = 0; i < 100; i++) { - ucstat = b43_shm_read16(dev, B43_SHM_SHARED, - B43_SHM_SH_UCODESTAT); - if (ucstat != B43_SHM_SH_UCODESTAT_SLEEP) - break; - udelay(10); - } - } -} - -#ifdef CONFIG_B43_BCMA -static void b43_bcma_phy_reset(struct b43_wldev *dev) -{ - u32 flags; - - /* Put PHY into reset */ - flags = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); - flags |= B43_BCMA_IOCTL_PHY_RESET; - flags |= B43_BCMA_IOCTL_PHY_BW_20MHZ; /* Make 20 MHz def */ - bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, flags); - udelay(2); - - /* Take PHY out of reset */ - flags = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); - flags &= ~B43_BCMA_IOCTL_PHY_RESET; - flags |= BCMA_IOCTL_FGC; - bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, flags); - udelay(1); - - /* Do not force clock anymore */ - flags = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); - flags &= ~BCMA_IOCTL_FGC; - bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, flags); - udelay(1); -} - -static void b43_bcma_wireless_core_reset(struct b43_wldev *dev, bool gmode) -{ - u32 req = B43_BCMA_CLKCTLST_80211_PLL_REQ | - B43_BCMA_CLKCTLST_PHY_PLL_REQ; - u32 status = B43_BCMA_CLKCTLST_80211_PLL_ST | - B43_BCMA_CLKCTLST_PHY_PLL_ST; - - b43_device_enable(dev, B43_BCMA_IOCTL_PHY_CLKEN); - bcma_core_set_clockmode(dev->dev->bdev, BCMA_CLKMODE_FAST); - b43_bcma_phy_reset(dev); - bcma_core_pll_ctl(dev->dev->bdev, req, status, true); -} -#endif - -static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, bool gmode) -{ - struct ssb_device *sdev = dev->dev->sdev; - u32 tmslow; - u32 flags = 0; - - if (gmode) - flags |= B43_TMSLOW_GMODE; - flags |= B43_TMSLOW_PHYCLKEN; - flags |= B43_TMSLOW_PHYRESET; - if (dev->phy.type == B43_PHYTYPE_N) - flags |= B43_TMSLOW_PHY_BANDWIDTH_20MHZ; /* Make 20 MHz def */ - b43_device_enable(dev, flags); - msleep(2); /* Wait for the PLL to turn on. */ - - /* Now take the PHY out of Reset again */ - tmslow = ssb_read32(sdev, SSB_TMSLOW); - tmslow |= SSB_TMSLOW_FGC; - tmslow &= ~B43_TMSLOW_PHYRESET; - ssb_write32(sdev, SSB_TMSLOW, tmslow); - ssb_read32(sdev, SSB_TMSLOW); /* flush */ - msleep(1); - tmslow &= ~SSB_TMSLOW_FGC; - ssb_write32(sdev, SSB_TMSLOW, tmslow); - ssb_read32(sdev, SSB_TMSLOW); /* flush */ - msleep(1); -} - -void b43_wireless_core_reset(struct b43_wldev *dev, bool gmode) -{ - u32 macctl; - - switch (dev->dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - b43_bcma_wireless_core_reset(dev, gmode); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - b43_ssb_wireless_core_reset(dev, gmode); - break; -#endif - } - - /* Turn Analog ON, but only if we already know the PHY-type. - * This protects against very early setup where we don't know the - * PHY-type, yet. wireless_core_reset will be called once again later, - * when we know the PHY-type. */ - if (dev->phy.ops) - dev->phy.ops->switch_analog(dev, 1); - - macctl = b43_read32(dev, B43_MMIO_MACCTL); - macctl &= ~B43_MACCTL_GMODE; - if (gmode) - macctl |= B43_MACCTL_GMODE; - macctl |= B43_MACCTL_IHR_ENABLED; - b43_write32(dev, B43_MMIO_MACCTL, macctl); -} - -static void handle_irq_transmit_status(struct b43_wldev *dev) -{ - u32 v0, v1; - u16 tmp; - struct b43_txstatus stat; - - while (1) { - v0 = b43_read32(dev, B43_MMIO_XMITSTAT_0); - if (!(v0 & 0x00000001)) - break; - v1 = b43_read32(dev, B43_MMIO_XMITSTAT_1); - - stat.cookie = (v0 >> 16); - stat.seq = (v1 & 0x0000FFFF); - stat.phy_stat = ((v1 & 0x00FF0000) >> 16); - tmp = (v0 & 0x0000FFFF); - stat.frame_count = ((tmp & 0xF000) >> 12); - stat.rts_count = ((tmp & 0x0F00) >> 8); - stat.supp_reason = ((tmp & 0x001C) >> 2); - stat.pm_indicated = !!(tmp & 0x0080); - stat.intermediate = !!(tmp & 0x0040); - stat.for_ampdu = !!(tmp & 0x0020); - stat.acked = !!(tmp & 0x0002); - - b43_handle_txstatus(dev, &stat); - } -} - -static void drain_txstatus_queue(struct b43_wldev *dev) -{ - u32 dummy; - - if (dev->dev->core_rev < 5) - return; - /* Read all entries from the microcode TXstatus FIFO - * and throw them away. - */ - while (1) { - dummy = b43_read32(dev, B43_MMIO_XMITSTAT_0); - if (!(dummy & 0x00000001)) - break; - dummy = b43_read32(dev, B43_MMIO_XMITSTAT_1); - } -} - -static u32 b43_jssi_read(struct b43_wldev *dev) -{ - u32 val = 0; - - val = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_JSSI1); - val <<= 16; - val |= b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_JSSI0); - - return val; -} - -static void b43_jssi_write(struct b43_wldev *dev, u32 jssi) -{ - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_JSSI0, - (jssi & 0x0000FFFF)); - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_JSSI1, - (jssi & 0xFFFF0000) >> 16); -} - -static void b43_generate_noise_sample(struct b43_wldev *dev) -{ - b43_jssi_write(dev, 0x7F7F7F7F); - b43_write32(dev, B43_MMIO_MACCMD, - b43_read32(dev, B43_MMIO_MACCMD) | B43_MACCMD_BGNOISE); -} - -static void b43_calculate_link_quality(struct b43_wldev *dev) -{ - /* Top half of Link Quality calculation. */ - - if (dev->phy.type != B43_PHYTYPE_G) - return; - if (dev->noisecalc.calculation_running) - return; - dev->noisecalc.calculation_running = true; - dev->noisecalc.nr_samples = 0; - - b43_generate_noise_sample(dev); -} - -static void handle_irq_noise(struct b43_wldev *dev) -{ - struct b43_phy_g *phy = dev->phy.g; - u16 tmp; - u8 noise[4]; - u8 i, j; - s32 average; - - /* Bottom half of Link Quality calculation. */ - - if (dev->phy.type != B43_PHYTYPE_G) - return; - - /* Possible race condition: It might be possible that the user - * changed to a different channel in the meantime since we - * started the calculation. We ignore that fact, since it's - * not really that much of a problem. The background noise is - * an estimation only anyway. Slightly wrong results will get damped - * by the averaging of the 8 sample rounds. Additionally the - * value is shortlived. So it will be replaced by the next noise - * calculation round soon. */ - - B43_WARN_ON(!dev->noisecalc.calculation_running); - *((__le32 *)noise) = cpu_to_le32(b43_jssi_read(dev)); - if (noise[0] == 0x7F || noise[1] == 0x7F || - noise[2] == 0x7F || noise[3] == 0x7F) - goto generate_new; - - /* Get the noise samples. */ - B43_WARN_ON(dev->noisecalc.nr_samples >= 8); - i = dev->noisecalc.nr_samples; - noise[0] = clamp_val(noise[0], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); - noise[1] = clamp_val(noise[1], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); - noise[2] = clamp_val(noise[2], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); - noise[3] = clamp_val(noise[3], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); - dev->noisecalc.samples[i][0] = phy->nrssi_lt[noise[0]]; - dev->noisecalc.samples[i][1] = phy->nrssi_lt[noise[1]]; - dev->noisecalc.samples[i][2] = phy->nrssi_lt[noise[2]]; - dev->noisecalc.samples[i][3] = phy->nrssi_lt[noise[3]]; - dev->noisecalc.nr_samples++; - if (dev->noisecalc.nr_samples == 8) { - /* Calculate the Link Quality by the noise samples. */ - average = 0; - for (i = 0; i < 8; i++) { - for (j = 0; j < 4; j++) - average += dev->noisecalc.samples[i][j]; - } - average /= (8 * 4); - average *= 125; - average += 64; - average /= 128; - tmp = b43_shm_read16(dev, B43_SHM_SHARED, 0x40C); - tmp = (tmp / 128) & 0x1F; - if (tmp >= 8) - average += 2; - else - average -= 25; - if (tmp == 8) - average -= 72; - else - average -= 48; - - dev->stats.link_noise = average; - dev->noisecalc.calculation_running = false; - return; - } -generate_new: - b43_generate_noise_sample(dev); -} - -static void handle_irq_tbtt_indication(struct b43_wldev *dev) -{ - if (b43_is_mode(dev->wl, NL80211_IFTYPE_AP)) { - ///TODO: PS TBTT - } else { - if (1 /*FIXME: the last PSpoll frame was sent successfully */ ) - b43_power_saving_ctl_bits(dev, 0); - } - if (b43_is_mode(dev->wl, NL80211_IFTYPE_ADHOC)) - dev->dfq_valid = true; -} - -static void handle_irq_atim_end(struct b43_wldev *dev) -{ - if (dev->dfq_valid) { - b43_write32(dev, B43_MMIO_MACCMD, - b43_read32(dev, B43_MMIO_MACCMD) - | B43_MACCMD_DFQ_VALID); - dev->dfq_valid = false; - } -} - -static void handle_irq_pmq(struct b43_wldev *dev) -{ - u32 tmp; - - //TODO: AP mode. - - while (1) { - tmp = b43_read32(dev, B43_MMIO_PS_STATUS); - if (!(tmp & 0x00000008)) - break; - } - /* 16bit write is odd, but correct. */ - b43_write16(dev, B43_MMIO_PS_STATUS, 0x0002); -} - -static void b43_write_template_common(struct b43_wldev *dev, - const u8 *data, u16 size, - u16 ram_offset, - u16 shm_size_offset, u8 rate) -{ - u32 i, tmp; - struct b43_plcp_hdr4 plcp; - - plcp.data = 0; - b43_generate_plcp_hdr(&plcp, size + FCS_LEN, rate); - b43_ram_write(dev, ram_offset, le32_to_cpu(plcp.data)); - ram_offset += sizeof(u32); - /* The PLCP is 6 bytes long, but we only wrote 4 bytes, yet. - * So leave the first two bytes of the next write blank. - */ - tmp = (u32) (data[0]) << 16; - tmp |= (u32) (data[1]) << 24; - b43_ram_write(dev, ram_offset, tmp); - ram_offset += sizeof(u32); - for (i = 2; i < size; i += sizeof(u32)) { - tmp = (u32) (data[i + 0]); - if (i + 1 < size) - tmp |= (u32) (data[i + 1]) << 8; - if (i + 2 < size) - tmp |= (u32) (data[i + 2]) << 16; - if (i + 3 < size) - tmp |= (u32) (data[i + 3]) << 24; - b43_ram_write(dev, ram_offset + i - 2, tmp); - } - b43_shm_write16(dev, B43_SHM_SHARED, shm_size_offset, - size + sizeof(struct b43_plcp_hdr6)); -} - -/* Check if the use of the antenna that ieee80211 told us to - * use is possible. This will fall back to DEFAULT. - * "antenna_nr" is the antenna identifier we got from ieee80211. */ -u8 b43_ieee80211_antenna_sanitize(struct b43_wldev *dev, - u8 antenna_nr) -{ - u8 antenna_mask; - - if (antenna_nr == 0) { - /* Zero means "use default antenna". That's always OK. */ - return 0; - } - - /* Get the mask of available antennas. */ - if (dev->phy.gmode) - antenna_mask = dev->dev->bus_sprom->ant_available_bg; - else - antenna_mask = dev->dev->bus_sprom->ant_available_a; - - if (!(antenna_mask & (1 << (antenna_nr - 1)))) { - /* This antenna is not available. Fall back to default. */ - return 0; - } - - return antenna_nr; -} - -/* Convert a b43 antenna number value to the PHY TX control value. */ -static u16 b43_antenna_to_phyctl(int antenna) -{ - switch (antenna) { - case B43_ANTENNA0: - return B43_TXH_PHY_ANT0; - case B43_ANTENNA1: - return B43_TXH_PHY_ANT1; - case B43_ANTENNA2: - return B43_TXH_PHY_ANT2; - case B43_ANTENNA3: - return B43_TXH_PHY_ANT3; - case B43_ANTENNA_AUTO0: - case B43_ANTENNA_AUTO1: - return B43_TXH_PHY_ANT01AUTO; - } - B43_WARN_ON(1); - return 0; -} - -static void b43_write_beacon_template(struct b43_wldev *dev, - u16 ram_offset, - u16 shm_size_offset) -{ - unsigned int i, len, variable_len; - const struct ieee80211_mgmt *bcn; - const u8 *ie; - bool tim_found = false; - unsigned int rate; - u16 ctl; - int antenna; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(dev->wl->current_beacon); - - bcn = (const struct ieee80211_mgmt *)(dev->wl->current_beacon->data); - len = min((size_t) dev->wl->current_beacon->len, - 0x200 - sizeof(struct b43_plcp_hdr6)); - rate = ieee80211_get_tx_rate(dev->wl->hw, info)->hw_value; - - b43_write_template_common(dev, (const u8 *)bcn, - len, ram_offset, shm_size_offset, rate); - - /* Write the PHY TX control parameters. */ - antenna = B43_ANTENNA_DEFAULT; - antenna = b43_antenna_to_phyctl(antenna); - ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL); - /* We can't send beacons with short preamble. Would get PHY errors. */ - ctl &= ~B43_TXH_PHY_SHORTPRMBL; - ctl &= ~B43_TXH_PHY_ANT; - ctl &= ~B43_TXH_PHY_ENC; - ctl |= antenna; - if (b43_is_cck_rate(rate)) - ctl |= B43_TXH_PHY_ENC_CCK; - else - ctl |= B43_TXH_PHY_ENC_OFDM; - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL, ctl); - - /* Find the position of the TIM and the DTIM_period value - * and write them to SHM. */ - ie = bcn->u.beacon.variable; - variable_len = len - offsetof(struct ieee80211_mgmt, u.beacon.variable); - for (i = 0; i < variable_len - 2; ) { - uint8_t ie_id, ie_len; - - ie_id = ie[i]; - ie_len = ie[i + 1]; - if (ie_id == 5) { - u16 tim_position; - u16 dtim_period; - /* This is the TIM Information Element */ - - /* Check whether the ie_len is in the beacon data range. */ - if (variable_len < ie_len + 2 + i) - break; - /* A valid TIM is at least 4 bytes long. */ - if (ie_len < 4) - break; - tim_found = true; - - tim_position = sizeof(struct b43_plcp_hdr6); - tim_position += offsetof(struct ieee80211_mgmt, u.beacon.variable); - tim_position += i; - - dtim_period = ie[i + 3]; - - b43_shm_write16(dev, B43_SHM_SHARED, - B43_SHM_SH_TIMBPOS, tim_position); - b43_shm_write16(dev, B43_SHM_SHARED, - B43_SHM_SH_DTIMPER, dtim_period); - break; - } - i += ie_len + 2; - } - if (!tim_found) { - /* - * If ucode wants to modify TIM do it behind the beacon, this - * will happen, for example, when doing mesh networking. - */ - b43_shm_write16(dev, B43_SHM_SHARED, - B43_SHM_SH_TIMBPOS, - len + sizeof(struct b43_plcp_hdr6)); - b43_shm_write16(dev, B43_SHM_SHARED, - B43_SHM_SH_DTIMPER, 0); - } - b43dbg(dev->wl, "Updated beacon template at 0x%x\n", ram_offset); -} - -static void b43_upload_beacon0(struct b43_wldev *dev) -{ - struct b43_wl *wl = dev->wl; - - if (wl->beacon0_uploaded) - return; - b43_write_beacon_template(dev, B43_SHM_SH_BT_BASE0, B43_SHM_SH_BTL0); - wl->beacon0_uploaded = true; -} - -static void b43_upload_beacon1(struct b43_wldev *dev) -{ - struct b43_wl *wl = dev->wl; - - if (wl->beacon1_uploaded) - return; - b43_write_beacon_template(dev, B43_SHM_SH_BT_BASE1, B43_SHM_SH_BTL1); - wl->beacon1_uploaded = true; -} - -static void handle_irq_beacon(struct b43_wldev *dev) -{ - struct b43_wl *wl = dev->wl; - u32 cmd, beacon0_valid, beacon1_valid; - - if (!b43_is_mode(wl, NL80211_IFTYPE_AP) && - !b43_is_mode(wl, NL80211_IFTYPE_MESH_POINT) && - !b43_is_mode(wl, NL80211_IFTYPE_ADHOC)) - return; - - /* This is the bottom half of the asynchronous beacon update. */ - - /* Ignore interrupt in the future. */ - dev->irq_mask &= ~B43_IRQ_BEACON; - - cmd = b43_read32(dev, B43_MMIO_MACCMD); - beacon0_valid = (cmd & B43_MACCMD_BEACON0_VALID); - beacon1_valid = (cmd & B43_MACCMD_BEACON1_VALID); - - /* Schedule interrupt manually, if busy. */ - if (beacon0_valid && beacon1_valid) { - b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, B43_IRQ_BEACON); - dev->irq_mask |= B43_IRQ_BEACON; - return; - } - - if (unlikely(wl->beacon_templates_virgin)) { - /* We never uploaded a beacon before. - * Upload both templates now, but only mark one valid. */ - wl->beacon_templates_virgin = false; - b43_upload_beacon0(dev); - b43_upload_beacon1(dev); - cmd = b43_read32(dev, B43_MMIO_MACCMD); - cmd |= B43_MACCMD_BEACON0_VALID; - b43_write32(dev, B43_MMIO_MACCMD, cmd); - } else { - if (!beacon0_valid) { - b43_upload_beacon0(dev); - cmd = b43_read32(dev, B43_MMIO_MACCMD); - cmd |= B43_MACCMD_BEACON0_VALID; - b43_write32(dev, B43_MMIO_MACCMD, cmd); - } else if (!beacon1_valid) { - b43_upload_beacon1(dev); - cmd = b43_read32(dev, B43_MMIO_MACCMD); - cmd |= B43_MACCMD_BEACON1_VALID; - b43_write32(dev, B43_MMIO_MACCMD, cmd); - } - } -} - -static void b43_do_beacon_update_trigger_work(struct b43_wldev *dev) -{ - u32 old_irq_mask = dev->irq_mask; - - /* update beacon right away or defer to irq */ - handle_irq_beacon(dev); - if (old_irq_mask != dev->irq_mask) { - /* The handler updated the IRQ mask. */ - B43_WARN_ON(!dev->irq_mask); - if (b43_read32(dev, B43_MMIO_GEN_IRQ_MASK)) { - b43_write32(dev, B43_MMIO_GEN_IRQ_MASK, dev->irq_mask); - } else { - /* Device interrupts are currently disabled. That means - * we just ran the hardirq handler and scheduled the - * IRQ thread. The thread will write the IRQ mask when - * it finished, so there's nothing to do here. Writing - * the mask _here_ would incorrectly re-enable IRQs. */ - } - } -} - -static void b43_beacon_update_trigger_work(struct work_struct *work) -{ - struct b43_wl *wl = container_of(work, struct b43_wl, - beacon_update_trigger); - struct b43_wldev *dev; - - mutex_lock(&wl->mutex); - dev = wl->current_dev; - if (likely(dev && (b43_status(dev) >= B43_STAT_INITIALIZED))) { - if (b43_bus_host_is_sdio(dev->dev)) { - /* wl->mutex is enough. */ - b43_do_beacon_update_trigger_work(dev); - mmiowb(); - } else { - spin_lock_irq(&wl->hardirq_lock); - b43_do_beacon_update_trigger_work(dev); - mmiowb(); - spin_unlock_irq(&wl->hardirq_lock); - } - } - mutex_unlock(&wl->mutex); -} - -/* Asynchronously update the packet templates in template RAM. - * Locking: Requires wl->mutex to be locked. */ -static void b43_update_templates(struct b43_wl *wl) -{ - struct sk_buff *beacon; - - /* This is the top half of the ansynchronous beacon update. - * The bottom half is the beacon IRQ. - * Beacon update must be asynchronous to avoid sending an - * invalid beacon. This can happen for example, if the firmware - * transmits a beacon while we are updating it. */ - - /* We could modify the existing beacon and set the aid bit in - * the TIM field, but that would probably require resizing and - * moving of data within the beacon template. - * Simply request a new beacon and let mac80211 do the hard work. */ - beacon = ieee80211_beacon_get(wl->hw, wl->vif); - if (unlikely(!beacon)) - return; - - if (wl->current_beacon) - dev_kfree_skb_any(wl->current_beacon); - wl->current_beacon = beacon; - wl->beacon0_uploaded = false; - wl->beacon1_uploaded = false; - ieee80211_queue_work(wl->hw, &wl->beacon_update_trigger); -} - -static void b43_set_beacon_int(struct b43_wldev *dev, u16 beacon_int) -{ - b43_time_lock(dev); - if (dev->dev->core_rev >= 3) { - b43_write32(dev, B43_MMIO_TSF_CFP_REP, (beacon_int << 16)); - b43_write32(dev, B43_MMIO_TSF_CFP_START, (beacon_int << 10)); - } else { - b43_write16(dev, 0x606, (beacon_int >> 6)); - b43_write16(dev, 0x610, beacon_int); - } - b43_time_unlock(dev); - b43dbg(dev->wl, "Set beacon interval to %u\n", beacon_int); -} - -static void b43_handle_firmware_panic(struct b43_wldev *dev) -{ - u16 reason; - - /* Read the register that contains the reason code for the panic. */ - reason = b43_shm_read16(dev, B43_SHM_SCRATCH, B43_FWPANIC_REASON_REG); - b43err(dev->wl, "Whoopsy, firmware panic! Reason: %u\n", reason); - - switch (reason) { - default: - b43dbg(dev->wl, "The panic reason is unknown.\n"); - /* fallthrough */ - case B43_FWPANIC_DIE: - /* Do not restart the controller or firmware. - * The device is nonfunctional from now on. - * Restarting would result in this panic to trigger again, - * so we avoid that recursion. */ - break; - case B43_FWPANIC_RESTART: - b43_controller_restart(dev, "Microcode panic"); - break; - } -} - -static void handle_irq_ucode_debug(struct b43_wldev *dev) -{ - unsigned int i, cnt; - u16 reason, marker_id, marker_line; - __le16 *buf; - - /* The proprietary firmware doesn't have this IRQ. */ - if (!dev->fw.opensource) - return; - - /* Read the register that contains the reason code for this IRQ. */ - reason = b43_shm_read16(dev, B43_SHM_SCRATCH, B43_DEBUGIRQ_REASON_REG); - - switch (reason) { - case B43_DEBUGIRQ_PANIC: - b43_handle_firmware_panic(dev); - break; - case B43_DEBUGIRQ_DUMP_SHM: - if (!B43_DEBUG) - break; /* Only with driver debugging enabled. */ - buf = kmalloc(4096, GFP_ATOMIC); - if (!buf) { - b43dbg(dev->wl, "SHM-dump: Failed to allocate memory\n"); - goto out; - } - for (i = 0; i < 4096; i += 2) { - u16 tmp = b43_shm_read16(dev, B43_SHM_SHARED, i); - buf[i / 2] = cpu_to_le16(tmp); - } - b43info(dev->wl, "Shared memory dump:\n"); - print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, - 16, 2, buf, 4096, 1); - kfree(buf); - break; - case B43_DEBUGIRQ_DUMP_REGS: - if (!B43_DEBUG) - break; /* Only with driver debugging enabled. */ - b43info(dev->wl, "Microcode register dump:\n"); - for (i = 0, cnt = 0; i < 64; i++) { - u16 tmp = b43_shm_read16(dev, B43_SHM_SCRATCH, i); - if (cnt == 0) - printk(KERN_INFO); - printk("r%02u: 0x%04X ", i, tmp); - cnt++; - if (cnt == 6) { - printk("\n"); - cnt = 0; - } - } - printk("\n"); - break; - case B43_DEBUGIRQ_MARKER: - if (!B43_DEBUG) - break; /* Only with driver debugging enabled. */ - marker_id = b43_shm_read16(dev, B43_SHM_SCRATCH, - B43_MARKER_ID_REG); - marker_line = b43_shm_read16(dev, B43_SHM_SCRATCH, - B43_MARKER_LINE_REG); - b43info(dev->wl, "The firmware just executed the MARKER(%u) " - "at line number %u\n", - marker_id, marker_line); - break; - default: - b43dbg(dev->wl, "Debug-IRQ triggered for unknown reason: %u\n", - reason); - } -out: - /* Acknowledge the debug-IRQ, so the firmware can continue. */ - b43_shm_write16(dev, B43_SHM_SCRATCH, - B43_DEBUGIRQ_REASON_REG, B43_DEBUGIRQ_ACK); -} - -static void b43_do_interrupt_thread(struct b43_wldev *dev) -{ - u32 reason; - u32 dma_reason[ARRAY_SIZE(dev->dma_reason)]; - u32 merged_dma_reason = 0; - int i; - - if (unlikely(b43_status(dev) != B43_STAT_STARTED)) - return; - - reason = dev->irq_reason; - for (i = 0; i < ARRAY_SIZE(dma_reason); i++) { - dma_reason[i] = dev->dma_reason[i]; - merged_dma_reason |= dma_reason[i]; - } - - if (unlikely(reason & B43_IRQ_MAC_TXERR)) - b43err(dev->wl, "MAC transmission error\n"); - - if (unlikely(reason & B43_IRQ_PHY_TXERR)) { - b43err(dev->wl, "PHY transmission error\n"); - rmb(); - if (unlikely(atomic_dec_and_test(&dev->phy.txerr_cnt))) { - atomic_set(&dev->phy.txerr_cnt, - B43_PHY_TX_BADNESS_LIMIT); - b43err(dev->wl, "Too many PHY TX errors, " - "restarting the controller\n"); - b43_controller_restart(dev, "PHY TX errors"); - } - } - - if (unlikely(merged_dma_reason & (B43_DMAIRQ_FATALMASK))) { - b43err(dev->wl, - "Fatal DMA error: 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X\n", - dma_reason[0], dma_reason[1], - dma_reason[2], dma_reason[3], - dma_reason[4], dma_reason[5]); - b43err(dev->wl, "This device does not support DMA " - "on your system. It will now be switched to PIO.\n"); - /* Fall back to PIO transfers if we get fatal DMA errors! */ - dev->use_pio = true; - b43_controller_restart(dev, "DMA error"); - return; - } - - if (unlikely(reason & B43_IRQ_UCODE_DEBUG)) - handle_irq_ucode_debug(dev); - if (reason & B43_IRQ_TBTT_INDI) - handle_irq_tbtt_indication(dev); - if (reason & B43_IRQ_ATIM_END) - handle_irq_atim_end(dev); - if (reason & B43_IRQ_BEACON) - handle_irq_beacon(dev); - if (reason & B43_IRQ_PMQ) - handle_irq_pmq(dev); - if (reason & B43_IRQ_TXFIFO_FLUSH_OK) - ;/* TODO */ - if (reason & B43_IRQ_NOISESAMPLE_OK) - handle_irq_noise(dev); - - /* Check the DMA reason registers for received data. */ - if (dma_reason[0] & B43_DMAIRQ_RDESC_UFLOW) { - if (B43_DEBUG) - b43warn(dev->wl, "RX descriptor underrun\n"); - b43_dma_handle_rx_overflow(dev->dma.rx_ring); - } - if (dma_reason[0] & B43_DMAIRQ_RX_DONE) { - if (b43_using_pio_transfers(dev)) - b43_pio_rx(dev->pio.rx_queue); - else - b43_dma_rx(dev->dma.rx_ring); - } - B43_WARN_ON(dma_reason[1] & B43_DMAIRQ_RX_DONE); - B43_WARN_ON(dma_reason[2] & B43_DMAIRQ_RX_DONE); - B43_WARN_ON(dma_reason[3] & B43_DMAIRQ_RX_DONE); - B43_WARN_ON(dma_reason[4] & B43_DMAIRQ_RX_DONE); - B43_WARN_ON(dma_reason[5] & B43_DMAIRQ_RX_DONE); - - if (reason & B43_IRQ_TX_OK) - handle_irq_transmit_status(dev); - - /* Re-enable interrupts on the device by restoring the current interrupt mask. */ - b43_write32(dev, B43_MMIO_GEN_IRQ_MASK, dev->irq_mask); - -#if B43_DEBUG - if (b43_debug(dev, B43_DBG_VERBOSESTATS)) { - dev->irq_count++; - for (i = 0; i < ARRAY_SIZE(dev->irq_bit_count); i++) { - if (reason & (1 << i)) - dev->irq_bit_count[i]++; - } - } -#endif -} - -/* Interrupt thread handler. Handles device interrupts in thread context. */ -static irqreturn_t b43_interrupt_thread_handler(int irq, void *dev_id) -{ - struct b43_wldev *dev = dev_id; - - mutex_lock(&dev->wl->mutex); - b43_do_interrupt_thread(dev); - mmiowb(); - mutex_unlock(&dev->wl->mutex); - - return IRQ_HANDLED; -} - -static irqreturn_t b43_do_interrupt(struct b43_wldev *dev) -{ - u32 reason; - - /* This code runs under wl->hardirq_lock, but _only_ on non-SDIO busses. - * On SDIO, this runs under wl->mutex. */ - - reason = b43_read32(dev, B43_MMIO_GEN_IRQ_REASON); - if (reason == 0xffffffff) /* shared IRQ */ - return IRQ_NONE; - reason &= dev->irq_mask; - if (!reason) - return IRQ_NONE; - - dev->dma_reason[0] = b43_read32(dev, B43_MMIO_DMA0_REASON) - & 0x0001FC00; - dev->dma_reason[1] = b43_read32(dev, B43_MMIO_DMA1_REASON) - & 0x0000DC00; - dev->dma_reason[2] = b43_read32(dev, B43_MMIO_DMA2_REASON) - & 0x0000DC00; - dev->dma_reason[3] = b43_read32(dev, B43_MMIO_DMA3_REASON) - & 0x0001DC00; - dev->dma_reason[4] = b43_read32(dev, B43_MMIO_DMA4_REASON) - & 0x0000DC00; -/* Unused ring - dev->dma_reason[5] = b43_read32(dev, B43_MMIO_DMA5_REASON) - & 0x0000DC00; -*/ - - /* ACK the interrupt. */ - b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, reason); - b43_write32(dev, B43_MMIO_DMA0_REASON, dev->dma_reason[0]); - b43_write32(dev, B43_MMIO_DMA1_REASON, dev->dma_reason[1]); - b43_write32(dev, B43_MMIO_DMA2_REASON, dev->dma_reason[2]); - b43_write32(dev, B43_MMIO_DMA3_REASON, dev->dma_reason[3]); - b43_write32(dev, B43_MMIO_DMA4_REASON, dev->dma_reason[4]); -/* Unused ring - b43_write32(dev, B43_MMIO_DMA5_REASON, dev->dma_reason[5]); -*/ - - /* Disable IRQs on the device. The IRQ thread handler will re-enable them. */ - b43_write32(dev, B43_MMIO_GEN_IRQ_MASK, 0); - /* Save the reason bitmasks for the IRQ thread handler. */ - dev->irq_reason = reason; - - return IRQ_WAKE_THREAD; -} - -/* Interrupt handler top-half. This runs with interrupts disabled. */ -static irqreturn_t b43_interrupt_handler(int irq, void *dev_id) -{ - struct b43_wldev *dev = dev_id; - irqreturn_t ret; - - if (unlikely(b43_status(dev) < B43_STAT_STARTED)) - return IRQ_NONE; - - spin_lock(&dev->wl->hardirq_lock); - ret = b43_do_interrupt(dev); - mmiowb(); - spin_unlock(&dev->wl->hardirq_lock); - - return ret; -} - -/* SDIO interrupt handler. This runs in process context. */ -static void b43_sdio_interrupt_handler(struct b43_wldev *dev) -{ - struct b43_wl *wl = dev->wl; - irqreturn_t ret; - - mutex_lock(&wl->mutex); - - ret = b43_do_interrupt(dev); - if (ret == IRQ_WAKE_THREAD) - b43_do_interrupt_thread(dev); - - mutex_unlock(&wl->mutex); -} - -void b43_do_release_fw(struct b43_firmware_file *fw) -{ - release_firmware(fw->data); - fw->data = NULL; - fw->filename = NULL; -} - -static void b43_release_firmware(struct b43_wldev *dev) -{ - b43_do_release_fw(&dev->fw.ucode); - b43_do_release_fw(&dev->fw.pcm); - b43_do_release_fw(&dev->fw.initvals); - b43_do_release_fw(&dev->fw.initvals_band); -} - -static void b43_print_fw_helptext(struct b43_wl *wl, bool error) -{ - const char text[] = - "You must go to " \ - "http://wireless.kernel.org/en/users/Drivers/b43#devicefirmware " \ - "and download the correct firmware for this driver version. " \ - "Please carefully read all instructions on this website.\n"; - - if (error) - b43err(wl, text); - else - b43warn(wl, text); -} - -static void b43_fw_cb(const struct firmware *firmware, void *context) -{ - struct b43_request_fw_context *ctx = context; - - ctx->blob = firmware; - complete(&ctx->fw_load_complete); -} - -int b43_do_request_fw(struct b43_request_fw_context *ctx, - const char *name, - struct b43_firmware_file *fw, bool async) -{ - struct b43_fw_header *hdr; - u32 size; - int err; - - if (!name) { - /* Don't fetch anything. Free possibly cached firmware. */ - /* FIXME: We should probably keep it anyway, to save some headache - * on suspend/resume with multiband devices. */ - b43_do_release_fw(fw); - return 0; - } - if (fw->filename) { - if ((fw->type == ctx->req_type) && - (strcmp(fw->filename, name) == 0)) - return 0; /* Already have this fw. */ - /* Free the cached firmware first. */ - /* FIXME: We should probably do this later after we successfully - * got the new fw. This could reduce headache with multiband devices. - * We could also redesign this to cache the firmware for all possible - * bands all the time. */ - b43_do_release_fw(fw); - } - - switch (ctx->req_type) { - case B43_FWTYPE_PROPRIETARY: - snprintf(ctx->fwname, sizeof(ctx->fwname), - "b43%s/%s.fw", - modparam_fwpostfix, name); - break; - case B43_FWTYPE_OPENSOURCE: - snprintf(ctx->fwname, sizeof(ctx->fwname), - "b43-open%s/%s.fw", - modparam_fwpostfix, name); - break; - default: - B43_WARN_ON(1); - return -ENOSYS; - } - if (async) { - /* do this part asynchronously */ - init_completion(&ctx->fw_load_complete); - err = request_firmware_nowait(THIS_MODULE, 1, ctx->fwname, - ctx->dev->dev->dev, GFP_KERNEL, - ctx, b43_fw_cb); - if (err < 0) { - pr_err("Unable to load firmware\n"); - return err; - } - /* stall here until fw ready */ - wait_for_completion(&ctx->fw_load_complete); - if (ctx->blob) - goto fw_ready; - /* On some ARM systems, the async request will fail, but the next sync - * request works. For this reason, we dall through here - */ - } - err = request_firmware(&ctx->blob, ctx->fwname, - ctx->dev->dev->dev); - if (err == -ENOENT) { - snprintf(ctx->errors[ctx->req_type], - sizeof(ctx->errors[ctx->req_type]), - "Firmware file \"%s\" not found\n", - ctx->fwname); - return err; - } else if (err) { - snprintf(ctx->errors[ctx->req_type], - sizeof(ctx->errors[ctx->req_type]), - "Firmware file \"%s\" request failed (err=%d)\n", - ctx->fwname, err); - return err; - } -fw_ready: - if (ctx->blob->size < sizeof(struct b43_fw_header)) - goto err_format; - hdr = (struct b43_fw_header *)(ctx->blob->data); - switch (hdr->type) { - case B43_FW_TYPE_UCODE: - case B43_FW_TYPE_PCM: - size = be32_to_cpu(hdr->size); - if (size != ctx->blob->size - sizeof(struct b43_fw_header)) - goto err_format; - /* fallthrough */ - case B43_FW_TYPE_IV: - if (hdr->ver != 1) - goto err_format; - break; - default: - goto err_format; - } - - fw->data = ctx->blob; - fw->filename = name; - fw->type = ctx->req_type; - - return 0; - -err_format: - snprintf(ctx->errors[ctx->req_type], - sizeof(ctx->errors[ctx->req_type]), - "Firmware file \"%s\" format error.\n", ctx->fwname); - release_firmware(ctx->blob); - - return -EPROTO; -} - -static int b43_try_request_fw(struct b43_request_fw_context *ctx) -{ - struct b43_wldev *dev = ctx->dev; - struct b43_firmware *fw = &ctx->dev->fw; - const u8 rev = ctx->dev->dev->core_rev; - const char *filename; - u32 tmshigh; - int err; - - /* Files for HT and LCN were found by trying one by one */ - - /* Get microcode */ - if ((rev >= 5) && (rev <= 10)) { - filename = "ucode5"; - } else if ((rev >= 11) && (rev <= 12)) { - filename = "ucode11"; - } else if (rev == 13) { - filename = "ucode13"; - } else if (rev == 14) { - filename = "ucode14"; - } else if (rev == 15) { - filename = "ucode15"; - } else { - switch (dev->phy.type) { - case B43_PHYTYPE_N: - if (rev >= 16) - filename = "ucode16_mimo"; - else - goto err_no_ucode; - break; - case B43_PHYTYPE_HT: - if (rev == 29) - filename = "ucode29_mimo"; - else - goto err_no_ucode; - break; - case B43_PHYTYPE_LCN: - if (rev == 24) - filename = "ucode24_mimo"; - else - goto err_no_ucode; - break; - default: - goto err_no_ucode; - } - } - err = b43_do_request_fw(ctx, filename, &fw->ucode, true); - if (err) - goto err_load; - - /* Get PCM code */ - if ((rev >= 5) && (rev <= 10)) - filename = "pcm5"; - else if (rev >= 11) - filename = NULL; - else - goto err_no_pcm; - fw->pcm_request_failed = false; - err = b43_do_request_fw(ctx, filename, &fw->pcm, false); - if (err == -ENOENT) { - /* We did not find a PCM file? Not fatal, but - * core rev <= 10 must do without hwcrypto then. */ - fw->pcm_request_failed = true; - } else if (err) - goto err_load; - - /* Get initvals */ - switch (dev->phy.type) { - case B43_PHYTYPE_A: - if ((rev >= 5) && (rev <= 10)) { - tmshigh = ssb_read32(dev->dev->sdev, SSB_TMSHIGH); - if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY) - filename = "a0g1initvals5"; - else - filename = "a0g0initvals5"; - } else - goto err_no_initvals; - break; - case B43_PHYTYPE_G: - if ((rev >= 5) && (rev <= 10)) - filename = "b0g0initvals5"; - else if (rev >= 13) - filename = "b0g0initvals13"; - else - goto err_no_initvals; - break; - case B43_PHYTYPE_N: - if (rev >= 16) - filename = "n0initvals16"; - else if ((rev >= 11) && (rev <= 12)) - filename = "n0initvals11"; - else - goto err_no_initvals; - break; - case B43_PHYTYPE_LP: - if (rev == 13) - filename = "lp0initvals13"; - else if (rev == 14) - filename = "lp0initvals14"; - else if (rev >= 15) - filename = "lp0initvals15"; - else - goto err_no_initvals; - break; - case B43_PHYTYPE_HT: - if (rev == 29) - filename = "ht0initvals29"; - else - goto err_no_initvals; - break; - case B43_PHYTYPE_LCN: - if (rev == 24) - filename = "lcn0initvals24"; - else - goto err_no_initvals; - break; - default: - goto err_no_initvals; - } - err = b43_do_request_fw(ctx, filename, &fw->initvals, false); - if (err) - goto err_load; - - /* Get bandswitch initvals */ - switch (dev->phy.type) { - case B43_PHYTYPE_A: - if ((rev >= 5) && (rev <= 10)) { - tmshigh = ssb_read32(dev->dev->sdev, SSB_TMSHIGH); - if (tmshigh & B43_TMSHIGH_HAVE_2GHZ_PHY) - filename = "a0g1bsinitvals5"; - else - filename = "a0g0bsinitvals5"; - } else if (rev >= 11) - filename = NULL; - else - goto err_no_initvals; - break; - case B43_PHYTYPE_G: - if ((rev >= 5) && (rev <= 10)) - filename = "b0g0bsinitvals5"; - else if (rev >= 11) - filename = NULL; - else - goto err_no_initvals; - break; - case B43_PHYTYPE_N: - if (rev >= 16) - filename = "n0bsinitvals16"; - else if ((rev >= 11) && (rev <= 12)) - filename = "n0bsinitvals11"; - else - goto err_no_initvals; - break; - case B43_PHYTYPE_LP: - if (rev == 13) - filename = "lp0bsinitvals13"; - else if (rev == 14) - filename = "lp0bsinitvals14"; - else if (rev >= 15) - filename = "lp0bsinitvals15"; - else - goto err_no_initvals; - break; - case B43_PHYTYPE_HT: - if (rev == 29) - filename = "ht0bsinitvals29"; - else - goto err_no_initvals; - break; - case B43_PHYTYPE_LCN: - if (rev == 24) - filename = "lcn0bsinitvals24"; - else - goto err_no_initvals; - break; - default: - goto err_no_initvals; - } - err = b43_do_request_fw(ctx, filename, &fw->initvals_band, false); - if (err) - goto err_load; - - fw->opensource = (ctx->req_type == B43_FWTYPE_OPENSOURCE); - - return 0; - -err_no_ucode: - err = ctx->fatal_failure = -EOPNOTSUPP; - b43err(dev->wl, "The driver does not know which firmware (ucode) " - "is required for your device (wl-core rev %u)\n", rev); - goto error; - -err_no_pcm: - err = ctx->fatal_failure = -EOPNOTSUPP; - b43err(dev->wl, "The driver does not know which firmware (PCM) " - "is required for your device (wl-core rev %u)\n", rev); - goto error; - -err_no_initvals: - err = ctx->fatal_failure = -EOPNOTSUPP; - b43err(dev->wl, "The driver does not know which firmware (initvals) " - "is required for your device (wl-core rev %u)\n", rev); - goto error; - -err_load: - /* We failed to load this firmware image. The error message - * already is in ctx->errors. Return and let our caller decide - * what to do. */ - goto error; - -error: - b43_release_firmware(dev); - return err; -} - -static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl); -static void b43_one_core_detach(struct b43_bus_dev *dev); - -static void b43_request_firmware(struct work_struct *work) -{ - struct b43_wl *wl = container_of(work, - struct b43_wl, firmware_load); - struct b43_wldev *dev = wl->current_dev; - struct b43_request_fw_context *ctx; - unsigned int i; - int err; - const char *errmsg; - - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); - if (!ctx) - return; - ctx->dev = dev; - - ctx->req_type = B43_FWTYPE_PROPRIETARY; - err = b43_try_request_fw(ctx); - if (!err) - goto start_ieee80211; /* Successfully loaded it. */ - /* Was fw version known? */ - if (ctx->fatal_failure) - goto out; - - /* proprietary fw not found, try open source */ - ctx->req_type = B43_FWTYPE_OPENSOURCE; - err = b43_try_request_fw(ctx); - if (!err) - goto start_ieee80211; /* Successfully loaded it. */ - if(ctx->fatal_failure) - goto out; - - /* Could not find a usable firmware. Print the errors. */ - for (i = 0; i < B43_NR_FWTYPES; i++) { - errmsg = ctx->errors[i]; - if (strlen(errmsg)) - b43err(dev->wl, "%s", errmsg); - } - b43_print_fw_helptext(dev->wl, 1); - goto out; - -start_ieee80211: - wl->hw->queues = B43_QOS_QUEUE_NUM; - if (!modparam_qos || dev->fw.opensource) - wl->hw->queues = 1; - - err = ieee80211_register_hw(wl->hw); - if (err) - goto err_one_core_detach; - wl->hw_registred = true; - b43_leds_register(wl->current_dev); - goto out; - -err_one_core_detach: - b43_one_core_detach(dev->dev); - -out: - kfree(ctx); -} - -static int b43_upload_microcode(struct b43_wldev *dev) -{ - struct wiphy *wiphy = dev->wl->hw->wiphy; - const size_t hdr_len = sizeof(struct b43_fw_header); - const __be32 *data; - unsigned int i, len; - u16 fwrev, fwpatch, fwdate, fwtime; - u32 tmp, macctl; - int err = 0; - - /* Jump the microcode PSM to offset 0 */ - macctl = b43_read32(dev, B43_MMIO_MACCTL); - B43_WARN_ON(macctl & B43_MACCTL_PSM_RUN); - macctl |= B43_MACCTL_PSM_JMP0; - b43_write32(dev, B43_MMIO_MACCTL, macctl); - /* Zero out all microcode PSM registers and shared memory. */ - for (i = 0; i < 64; i++) - b43_shm_write16(dev, B43_SHM_SCRATCH, i, 0); - for (i = 0; i < 4096; i += 2) - b43_shm_write16(dev, B43_SHM_SHARED, i, 0); - - /* Upload Microcode. */ - data = (__be32 *) (dev->fw.ucode.data->data + hdr_len); - len = (dev->fw.ucode.data->size - hdr_len) / sizeof(__be32); - b43_shm_control_word(dev, B43_SHM_UCODE | B43_SHM_AUTOINC_W, 0x0000); - for (i = 0; i < len; i++) { - b43_write32(dev, B43_MMIO_SHM_DATA, be32_to_cpu(data[i])); - udelay(10); - } - - if (dev->fw.pcm.data) { - /* Upload PCM data. */ - data = (__be32 *) (dev->fw.pcm.data->data + hdr_len); - len = (dev->fw.pcm.data->size - hdr_len) / sizeof(__be32); - b43_shm_control_word(dev, B43_SHM_HW, 0x01EA); - b43_write32(dev, B43_MMIO_SHM_DATA, 0x00004000); - /* No need for autoinc bit in SHM_HW */ - b43_shm_control_word(dev, B43_SHM_HW, 0x01EB); - for (i = 0; i < len; i++) { - b43_write32(dev, B43_MMIO_SHM_DATA, be32_to_cpu(data[i])); - udelay(10); - } - } - - b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, B43_IRQ_ALL); - - /* Start the microcode PSM */ - b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_PSM_JMP0, - B43_MACCTL_PSM_RUN); - - /* Wait for the microcode to load and respond */ - i = 0; - while (1) { - tmp = b43_read32(dev, B43_MMIO_GEN_IRQ_REASON); - if (tmp == B43_IRQ_MAC_SUSPENDED) - break; - i++; - if (i >= 20) { - b43err(dev->wl, "Microcode not responding\n"); - b43_print_fw_helptext(dev->wl, 1); - err = -ENODEV; - goto error; - } - msleep(50); - } - b43_read32(dev, B43_MMIO_GEN_IRQ_REASON); /* dummy read */ - - /* Get and check the revisions. */ - fwrev = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_UCODEREV); - fwpatch = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_UCODEPATCH); - fwdate = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_UCODEDATE); - fwtime = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_UCODETIME); - - if (fwrev <= 0x128) { - b43err(dev->wl, "YOUR FIRMWARE IS TOO OLD. Firmware from " - "binary drivers older than version 4.x is unsupported. " - "You must upgrade your firmware files.\n"); - b43_print_fw_helptext(dev->wl, 1); - err = -EOPNOTSUPP; - goto error; - } - dev->fw.rev = fwrev; - dev->fw.patch = fwpatch; - if (dev->fw.rev >= 598) - dev->fw.hdr_format = B43_FW_HDR_598; - else if (dev->fw.rev >= 410) - dev->fw.hdr_format = B43_FW_HDR_410; - else - dev->fw.hdr_format = B43_FW_HDR_351; - WARN_ON(dev->fw.opensource != (fwdate == 0xFFFF)); - - dev->qos_enabled = dev->wl->hw->queues > 1; - /* Default to firmware/hardware crypto acceleration. */ - dev->hwcrypto_enabled = true; - - if (dev->fw.opensource) { - u16 fwcapa; - - /* Patchlevel info is encoded in the "time" field. */ - dev->fw.patch = fwtime; - b43info(dev->wl, "Loading OpenSource firmware version %u.%u\n", - dev->fw.rev, dev->fw.patch); - - fwcapa = b43_fwcapa_read(dev); - if (!(fwcapa & B43_FWCAPA_HWCRYPTO) || dev->fw.pcm_request_failed) { - b43info(dev->wl, "Hardware crypto acceleration not supported by firmware\n"); - /* Disable hardware crypto and fall back to software crypto. */ - dev->hwcrypto_enabled = false; - } - /* adding QoS support should use an offline discovery mechanism */ - WARN(fwcapa & B43_FWCAPA_QOS, "QoS in OpenFW not supported\n"); - } else { - b43info(dev->wl, "Loading firmware version %u.%u " - "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n", - fwrev, fwpatch, - (fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF, - (fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F, fwtime & 0x1F); - if (dev->fw.pcm_request_failed) { - b43warn(dev->wl, "No \"pcm5.fw\" firmware file found. " - "Hardware accelerated cryptography is disabled.\n"); - b43_print_fw_helptext(dev->wl, 0); - } - } - - snprintf(wiphy->fw_version, sizeof(wiphy->fw_version), "%u.%u", - dev->fw.rev, dev->fw.patch); - wiphy->hw_version = dev->dev->core_id; - - if (dev->fw.hdr_format == B43_FW_HDR_351) { - /* We're over the deadline, but we keep support for old fw - * until it turns out to be in major conflict with something new. */ - b43warn(dev->wl, "You are using an old firmware image. " - "Support for old firmware will be removed soon " - "(official deadline was July 2008).\n"); - b43_print_fw_helptext(dev->wl, 0); - } - - return 0; - -error: - /* Stop the microcode PSM. */ - b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_PSM_RUN, - B43_MACCTL_PSM_JMP0); - - return err; -} - -static int b43_write_initvals(struct b43_wldev *dev, - const struct b43_iv *ivals, - size_t count, - size_t array_size) -{ - const struct b43_iv *iv; - u16 offset; - size_t i; - bool bit32; - - BUILD_BUG_ON(sizeof(struct b43_iv) != 6); - iv = ivals; - for (i = 0; i < count; i++) { - if (array_size < sizeof(iv->offset_size)) - goto err_format; - array_size -= sizeof(iv->offset_size); - offset = be16_to_cpu(iv->offset_size); - bit32 = !!(offset & B43_IV_32BIT); - offset &= B43_IV_OFFSET_MASK; - if (offset >= 0x1000) - goto err_format; - if (bit32) { - u32 value; - - if (array_size < sizeof(iv->data.d32)) - goto err_format; - array_size -= sizeof(iv->data.d32); - - value = get_unaligned_be32(&iv->data.d32); - b43_write32(dev, offset, value); - - iv = (const struct b43_iv *)((const uint8_t *)iv + - sizeof(__be16) + - sizeof(__be32)); - } else { - u16 value; - - if (array_size < sizeof(iv->data.d16)) - goto err_format; - array_size -= sizeof(iv->data.d16); - - value = be16_to_cpu(iv->data.d16); - b43_write16(dev, offset, value); - - iv = (const struct b43_iv *)((const uint8_t *)iv + - sizeof(__be16) + - sizeof(__be16)); - } - } - if (array_size) - goto err_format; - - return 0; - -err_format: - b43err(dev->wl, "Initial Values Firmware file-format error.\n"); - b43_print_fw_helptext(dev->wl, 1); - - return -EPROTO; -} - -static int b43_upload_initvals(struct b43_wldev *dev) -{ - const size_t hdr_len = sizeof(struct b43_fw_header); - const struct b43_fw_header *hdr; - struct b43_firmware *fw = &dev->fw; - const struct b43_iv *ivals; - size_t count; - int err; - - hdr = (const struct b43_fw_header *)(fw->initvals.data->data); - ivals = (const struct b43_iv *)(fw->initvals.data->data + hdr_len); - count = be32_to_cpu(hdr->size); - err = b43_write_initvals(dev, ivals, count, - fw->initvals.data->size - hdr_len); - if (err) - goto out; - if (fw->initvals_band.data) { - hdr = (const struct b43_fw_header *)(fw->initvals_band.data->data); - ivals = (const struct b43_iv *)(fw->initvals_band.data->data + hdr_len); - count = be32_to_cpu(hdr->size); - err = b43_write_initvals(dev, ivals, count, - fw->initvals_band.data->size - hdr_len); - if (err) - goto out; - } -out: - - return err; -} - -/* Initialize the GPIOs - * http://bcm-specs.sipsolutions.net/GPIO - */ -static struct ssb_device *b43_ssb_gpio_dev(struct b43_wldev *dev) -{ - struct ssb_bus *bus = dev->dev->sdev->bus; - -#ifdef CONFIG_SSB_DRIVER_PCICORE - return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev); -#else - return bus->chipco.dev; -#endif -} - -static int b43_gpio_init(struct b43_wldev *dev) -{ - struct ssb_device *gpiodev; - u32 mask, set; - - b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_GPOUTSMSK, 0); - b43_maskset16(dev, B43_MMIO_GPIO_MASK, ~0, 0xF); - - mask = 0x0000001F; - set = 0x0000000F; - if (dev->dev->chip_id == 0x4301) { - mask |= 0x0060; - set |= 0x0060; - } else if (dev->dev->chip_id == 0x5354) { - /* Don't allow overtaking buttons GPIOs */ - set &= 0x2; /* 0x2 is LED GPIO on BCM5354 */ - } - - if (0 /* FIXME: conditional unknown */ ) { - b43_write16(dev, B43_MMIO_GPIO_MASK, - b43_read16(dev, B43_MMIO_GPIO_MASK) - | 0x0100); - /* BT Coexistance Input */ - mask |= 0x0080; - set |= 0x0080; - /* BT Coexistance Out */ - mask |= 0x0100; - set |= 0x0100; - } - if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL) { - /* PA is controlled by gpio 9, let ucode handle it */ - b43_write16(dev, B43_MMIO_GPIO_MASK, - b43_read16(dev, B43_MMIO_GPIO_MASK) - | 0x0200); - mask |= 0x0200; - set |= 0x0200; - } - - switch (dev->dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - bcma_chipco_gpio_control(&dev->dev->bdev->bus->drv_cc, mask, set); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - gpiodev = b43_ssb_gpio_dev(dev); - if (gpiodev) - ssb_write32(gpiodev, B43_GPIO_CONTROL, - (ssb_read32(gpiodev, B43_GPIO_CONTROL) - & ~mask) | set); - break; -#endif - } - - return 0; -} - -/* Turn off all GPIO stuff. Call this on module unload, for example. */ -static void b43_gpio_cleanup(struct b43_wldev *dev) -{ - struct ssb_device *gpiodev; - - switch (dev->dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - bcma_chipco_gpio_control(&dev->dev->bdev->bus->drv_cc, ~0, 0); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - gpiodev = b43_ssb_gpio_dev(dev); - if (gpiodev) - ssb_write32(gpiodev, B43_GPIO_CONTROL, 0); - break; -#endif - } -} - -/* http://bcm-specs.sipsolutions.net/EnableMac */ -void b43_mac_enable(struct b43_wldev *dev) -{ - if (b43_debug(dev, B43_DBG_FIRMWARE)) { - u16 fwstate; - - fwstate = b43_shm_read16(dev, B43_SHM_SHARED, - B43_SHM_SH_UCODESTAT); - if ((fwstate != B43_SHM_SH_UCODESTAT_SUSP) && - (fwstate != B43_SHM_SH_UCODESTAT_SLEEP)) { - b43err(dev->wl, "b43_mac_enable(): The firmware " - "should be suspended, but current state is %u\n", - fwstate); - } - } - - dev->mac_suspended--; - B43_WARN_ON(dev->mac_suspended < 0); - if (dev->mac_suspended == 0) { - b43_maskset32(dev, B43_MMIO_MACCTL, ~0, B43_MACCTL_ENABLED); - b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, - B43_IRQ_MAC_SUSPENDED); - /* Commit writes */ - b43_read32(dev, B43_MMIO_MACCTL); - b43_read32(dev, B43_MMIO_GEN_IRQ_REASON); - b43_power_saving_ctl_bits(dev, 0); - } -} - -/* http://bcm-specs.sipsolutions.net/SuspendMAC */ -void b43_mac_suspend(struct b43_wldev *dev) -{ - int i; - u32 tmp; - - might_sleep(); - B43_WARN_ON(dev->mac_suspended < 0); - - if (dev->mac_suspended == 0) { - b43_power_saving_ctl_bits(dev, B43_PS_AWAKE); - b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_ENABLED, 0); - /* force pci to flush the write */ - b43_read32(dev, B43_MMIO_MACCTL); - for (i = 35; i; i--) { - tmp = b43_read32(dev, B43_MMIO_GEN_IRQ_REASON); - if (tmp & B43_IRQ_MAC_SUSPENDED) - goto out; - udelay(10); - } - /* Hm, it seems this will take some time. Use msleep(). */ - for (i = 40; i; i--) { - tmp = b43_read32(dev, B43_MMIO_GEN_IRQ_REASON); - if (tmp & B43_IRQ_MAC_SUSPENDED) - goto out; - msleep(1); - } - b43err(dev->wl, "MAC suspend failed\n"); - } -out: - dev->mac_suspended++; -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/MacPhyClkSet */ -void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on) -{ - u32 tmp; - - switch (dev->dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - tmp = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); - if (on) - tmp |= B43_BCMA_IOCTL_MACPHYCLKEN; - else - tmp &= ~B43_BCMA_IOCTL_MACPHYCLKEN; - bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, tmp); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); - if (on) - tmp |= B43_TMSLOW_MACPHYCLKEN; - else - tmp &= ~B43_TMSLOW_MACPHYCLKEN; - ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); - break; -#endif - } -} - -static void b43_adjust_opmode(struct b43_wldev *dev) -{ - struct b43_wl *wl = dev->wl; - u32 ctl; - u16 cfp_pretbtt; - - ctl = b43_read32(dev, B43_MMIO_MACCTL); - /* Reset status to STA infrastructure mode. */ - ctl &= ~B43_MACCTL_AP; - ctl &= ~B43_MACCTL_KEEP_CTL; - ctl &= ~B43_MACCTL_KEEP_BADPLCP; - ctl &= ~B43_MACCTL_KEEP_BAD; - ctl &= ~B43_MACCTL_PROMISC; - ctl &= ~B43_MACCTL_BEACPROMISC; - ctl |= B43_MACCTL_INFRA; - - if (b43_is_mode(wl, NL80211_IFTYPE_AP) || - b43_is_mode(wl, NL80211_IFTYPE_MESH_POINT)) - ctl |= B43_MACCTL_AP; - else if (b43_is_mode(wl, NL80211_IFTYPE_ADHOC)) - ctl &= ~B43_MACCTL_INFRA; - - if (wl->filter_flags & FIF_CONTROL) - ctl |= B43_MACCTL_KEEP_CTL; - if (wl->filter_flags & FIF_FCSFAIL) - ctl |= B43_MACCTL_KEEP_BAD; - if (wl->filter_flags & FIF_PLCPFAIL) - ctl |= B43_MACCTL_KEEP_BADPLCP; - if (wl->filter_flags & FIF_PROMISC_IN_BSS) - ctl |= B43_MACCTL_PROMISC; - if (wl->filter_flags & FIF_BCN_PRBRESP_PROMISC) - ctl |= B43_MACCTL_BEACPROMISC; - - /* Workaround: On old hardware the HW-MAC-address-filter - * doesn't work properly, so always run promisc in filter - * it in software. */ - if (dev->dev->core_rev <= 4) - ctl |= B43_MACCTL_PROMISC; - - b43_write32(dev, B43_MMIO_MACCTL, ctl); - - cfp_pretbtt = 2; - if ((ctl & B43_MACCTL_INFRA) && !(ctl & B43_MACCTL_AP)) { - if (dev->dev->chip_id == 0x4306 && - dev->dev->chip_rev == 3) - cfp_pretbtt = 100; - else - cfp_pretbtt = 50; - } - b43_write16(dev, 0x612, cfp_pretbtt); - - /* FIXME: We don't currently implement the PMQ mechanism, - * so always disable it. If we want to implement PMQ, - * we need to enable it here (clear DISCPMQ) in AP mode. - */ - if (0 /* ctl & B43_MACCTL_AP */) - b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_DISCPMQ, 0); - else - b43_maskset32(dev, B43_MMIO_MACCTL, ~0, B43_MACCTL_DISCPMQ); -} - -static void b43_rate_memory_write(struct b43_wldev *dev, u16 rate, int is_ofdm) -{ - u16 offset; - - if (is_ofdm) { - offset = 0x480; - offset += (b43_plcp_get_ratecode_ofdm(rate) & 0x000F) * 2; - } else { - offset = 0x4C0; - offset += (b43_plcp_get_ratecode_cck(rate) & 0x000F) * 2; - } - b43_shm_write16(dev, B43_SHM_SHARED, offset + 0x20, - b43_shm_read16(dev, B43_SHM_SHARED, offset)); -} - -static void b43_rate_memory_init(struct b43_wldev *dev) -{ - switch (dev->phy.type) { - case B43_PHYTYPE_A: - case B43_PHYTYPE_G: - case B43_PHYTYPE_N: - case B43_PHYTYPE_LP: - case B43_PHYTYPE_HT: - case B43_PHYTYPE_LCN: - b43_rate_memory_write(dev, B43_OFDM_RATE_6MB, 1); - b43_rate_memory_write(dev, B43_OFDM_RATE_12MB, 1); - b43_rate_memory_write(dev, B43_OFDM_RATE_18MB, 1); - b43_rate_memory_write(dev, B43_OFDM_RATE_24MB, 1); - b43_rate_memory_write(dev, B43_OFDM_RATE_36MB, 1); - b43_rate_memory_write(dev, B43_OFDM_RATE_48MB, 1); - b43_rate_memory_write(dev, B43_OFDM_RATE_54MB, 1); - if (dev->phy.type == B43_PHYTYPE_A) - break; - /* fallthrough */ - case B43_PHYTYPE_B: - b43_rate_memory_write(dev, B43_CCK_RATE_1MB, 0); - b43_rate_memory_write(dev, B43_CCK_RATE_2MB, 0); - b43_rate_memory_write(dev, B43_CCK_RATE_5MB, 0); - b43_rate_memory_write(dev, B43_CCK_RATE_11MB, 0); - break; - default: - B43_WARN_ON(1); - } -} - -/* Set the default values for the PHY TX Control Words. */ -static void b43_set_phytxctl_defaults(struct b43_wldev *dev) -{ - u16 ctl = 0; - - ctl |= B43_TXH_PHY_ENC_CCK; - ctl |= B43_TXH_PHY_ANT01AUTO; - ctl |= B43_TXH_PHY_TXPWR; - - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL, ctl); - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_ACKCTSPHYCTL, ctl); - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_PRPHYCTL, ctl); -} - -/* Set the TX-Antenna for management frames sent by firmware. */ -static void b43_mgmtframe_txantenna(struct b43_wldev *dev, int antenna) -{ - u16 ant; - u16 tmp; - - ant = b43_antenna_to_phyctl(antenna); - - /* For ACK/CTS */ - tmp = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_ACKCTSPHYCTL); - tmp = (tmp & ~B43_TXH_PHY_ANT) | ant; - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_ACKCTSPHYCTL, tmp); - /* For Probe Resposes */ - tmp = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_PRPHYCTL); - tmp = (tmp & ~B43_TXH_PHY_ANT) | ant; - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_PRPHYCTL, tmp); -} - -/* This is the opposite of b43_chip_init() */ -static void b43_chip_exit(struct b43_wldev *dev) -{ - b43_phy_exit(dev); - b43_gpio_cleanup(dev); - /* firmware is released later */ -} - -/* Initialize the chip - * http://bcm-specs.sipsolutions.net/ChipInit - */ -static int b43_chip_init(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - int err; - u32 macctl; - u16 value16; - - /* Initialize the MAC control */ - macctl = B43_MACCTL_IHR_ENABLED | B43_MACCTL_SHM_ENABLED; - if (dev->phy.gmode) - macctl |= B43_MACCTL_GMODE; - macctl |= B43_MACCTL_INFRA; - b43_write32(dev, B43_MMIO_MACCTL, macctl); - - err = b43_upload_microcode(dev); - if (err) - goto out; /* firmware is released later */ - - err = b43_gpio_init(dev); - if (err) - goto out; /* firmware is released later */ - - err = b43_upload_initvals(dev); - if (err) - goto err_gpio_clean; - - /* Turn the Analog on and initialize the PHY. */ - phy->ops->switch_analog(dev, 1); - err = b43_phy_init(dev); - if (err) - goto err_gpio_clean; - - /* Disable Interference Mitigation. */ - if (phy->ops->interf_mitigation) - phy->ops->interf_mitigation(dev, B43_INTERFMODE_NONE); - - /* Select the antennae */ - if (phy->ops->set_rx_antenna) - phy->ops->set_rx_antenna(dev, B43_ANTENNA_DEFAULT); - b43_mgmtframe_txantenna(dev, B43_ANTENNA_DEFAULT); - - if (phy->type == B43_PHYTYPE_B) { - value16 = b43_read16(dev, 0x005E); - value16 |= 0x0004; - b43_write16(dev, 0x005E, value16); - } - b43_write32(dev, 0x0100, 0x01000000); - if (dev->dev->core_rev < 5) - b43_write32(dev, 0x010C, 0x01000000); - - b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_INFRA, 0); - b43_maskset32(dev, B43_MMIO_MACCTL, ~0, B43_MACCTL_INFRA); - - /* Probe Response Timeout value */ - /* FIXME: Default to 0, has to be set by ioctl probably... :-/ */ - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_PRMAXTIME, 0); - - /* Initially set the wireless operation mode. */ - b43_adjust_opmode(dev); - - if (dev->dev->core_rev < 3) { - b43_write16(dev, 0x060E, 0x0000); - b43_write16(dev, 0x0610, 0x8000); - b43_write16(dev, 0x0604, 0x0000); - b43_write16(dev, 0x0606, 0x0200); - } else { - b43_write32(dev, 0x0188, 0x80000000); - b43_write32(dev, 0x018C, 0x02000000); - } - b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, 0x00004000); - b43_write32(dev, B43_MMIO_DMA0_IRQ_MASK, 0x0001FC00); - b43_write32(dev, B43_MMIO_DMA1_IRQ_MASK, 0x0000DC00); - b43_write32(dev, B43_MMIO_DMA2_IRQ_MASK, 0x0000DC00); - b43_write32(dev, B43_MMIO_DMA3_IRQ_MASK, 0x0001DC00); - b43_write32(dev, B43_MMIO_DMA4_IRQ_MASK, 0x0000DC00); - b43_write32(dev, B43_MMIO_DMA5_IRQ_MASK, 0x0000DC00); - - b43_mac_phy_clock_set(dev, true); - - switch (dev->dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - /* FIXME: 0xE74 is quite common, but should be read from CC */ - b43_write16(dev, B43_MMIO_POWERUP_DELAY, 0xE74); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - b43_write16(dev, B43_MMIO_POWERUP_DELAY, - dev->dev->sdev->bus->chipco.fast_pwrup_delay); - break; -#endif - } - - err = 0; - b43dbg(dev->wl, "Chip initialized\n"); -out: - return err; - -err_gpio_clean: - b43_gpio_cleanup(dev); - return err; -} - -static void b43_periodic_every60sec(struct b43_wldev *dev) -{ - const struct b43_phy_operations *ops = dev->phy.ops; - - if (ops->pwork_60sec) - ops->pwork_60sec(dev); - - /* Force check the TX power emission now. */ - b43_phy_txpower_check(dev, B43_TXPWR_IGNORE_TIME); -} - -static void b43_periodic_every30sec(struct b43_wldev *dev) -{ - /* Update device statistics. */ - b43_calculate_link_quality(dev); -} - -static void b43_periodic_every15sec(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - u16 wdr; - - if (dev->fw.opensource) { - /* Check if the firmware is still alive. - * It will reset the watchdog counter to 0 in its idle loop. */ - wdr = b43_shm_read16(dev, B43_SHM_SCRATCH, B43_WATCHDOG_REG); - if (unlikely(wdr)) { - b43err(dev->wl, "Firmware watchdog: The firmware died!\n"); - b43_controller_restart(dev, "Firmware watchdog"); - return; - } else { - b43_shm_write16(dev, B43_SHM_SCRATCH, - B43_WATCHDOG_REG, 1); - } - } - - if (phy->ops->pwork_15sec) - phy->ops->pwork_15sec(dev); - - atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT); - wmb(); - -#if B43_DEBUG - if (b43_debug(dev, B43_DBG_VERBOSESTATS)) { - unsigned int i; - - b43dbg(dev->wl, "Stats: %7u IRQs/sec, %7u TX/sec, %7u RX/sec\n", - dev->irq_count / 15, - dev->tx_count / 15, - dev->rx_count / 15); - dev->irq_count = 0; - dev->tx_count = 0; - dev->rx_count = 0; - for (i = 0; i < ARRAY_SIZE(dev->irq_bit_count); i++) { - if (dev->irq_bit_count[i]) { - b43dbg(dev->wl, "Stats: %7u IRQ-%02u/sec (0x%08X)\n", - dev->irq_bit_count[i] / 15, i, (1 << i)); - dev->irq_bit_count[i] = 0; - } - } - } -#endif -} - -static void do_periodic_work(struct b43_wldev *dev) -{ - unsigned int state; - - state = dev->periodic_state; - if (state % 4 == 0) - b43_periodic_every60sec(dev); - if (state % 2 == 0) - b43_periodic_every30sec(dev); - b43_periodic_every15sec(dev); -} - -/* Periodic work locking policy: - * The whole periodic work handler is protected by - * wl->mutex. If another lock is needed somewhere in the - * pwork callchain, it's acquired in-place, where it's needed. - */ -static void b43_periodic_work_handler(struct work_struct *work) -{ - struct b43_wldev *dev = container_of(work, struct b43_wldev, - periodic_work.work); - struct b43_wl *wl = dev->wl; - unsigned long delay; - - mutex_lock(&wl->mutex); - - if (unlikely(b43_status(dev) != B43_STAT_STARTED)) - goto out; - if (b43_debug(dev, B43_DBG_PWORK_STOP)) - goto out_requeue; - - do_periodic_work(dev); - - dev->periodic_state++; -out_requeue: - if (b43_debug(dev, B43_DBG_PWORK_FAST)) - delay = msecs_to_jiffies(50); - else - delay = round_jiffies_relative(HZ * 15); - ieee80211_queue_delayed_work(wl->hw, &dev->periodic_work, delay); -out: - mutex_unlock(&wl->mutex); -} - -static void b43_periodic_tasks_setup(struct b43_wldev *dev) -{ - struct delayed_work *work = &dev->periodic_work; - - dev->periodic_state = 0; - INIT_DELAYED_WORK(work, b43_periodic_work_handler); - ieee80211_queue_delayed_work(dev->wl->hw, work, 0); -} - -/* Check if communication with the device works correctly. */ -static int b43_validate_chipaccess(struct b43_wldev *dev) -{ - u32 v, backup0, backup4; - - backup0 = b43_shm_read32(dev, B43_SHM_SHARED, 0); - backup4 = b43_shm_read32(dev, B43_SHM_SHARED, 4); - - /* Check for read/write and endianness problems. */ - b43_shm_write32(dev, B43_SHM_SHARED, 0, 0x55AAAA55); - if (b43_shm_read32(dev, B43_SHM_SHARED, 0) != 0x55AAAA55) - goto error; - b43_shm_write32(dev, B43_SHM_SHARED, 0, 0xAA5555AA); - if (b43_shm_read32(dev, B43_SHM_SHARED, 0) != 0xAA5555AA) - goto error; - - /* Check if unaligned 32bit SHM_SHARED access works properly. - * However, don't bail out on failure, because it's noncritical. */ - b43_shm_write16(dev, B43_SHM_SHARED, 0, 0x1122); - b43_shm_write16(dev, B43_SHM_SHARED, 2, 0x3344); - b43_shm_write16(dev, B43_SHM_SHARED, 4, 0x5566); - b43_shm_write16(dev, B43_SHM_SHARED, 6, 0x7788); - if (b43_shm_read32(dev, B43_SHM_SHARED, 2) != 0x55663344) - b43warn(dev->wl, "Unaligned 32bit SHM read access is broken\n"); - b43_shm_write32(dev, B43_SHM_SHARED, 2, 0xAABBCCDD); - if (b43_shm_read16(dev, B43_SHM_SHARED, 0) != 0x1122 || - b43_shm_read16(dev, B43_SHM_SHARED, 2) != 0xCCDD || - b43_shm_read16(dev, B43_SHM_SHARED, 4) != 0xAABB || - b43_shm_read16(dev, B43_SHM_SHARED, 6) != 0x7788) - b43warn(dev->wl, "Unaligned 32bit SHM write access is broken\n"); - - b43_shm_write32(dev, B43_SHM_SHARED, 0, backup0); - b43_shm_write32(dev, B43_SHM_SHARED, 4, backup4); - - if ((dev->dev->core_rev >= 3) && (dev->dev->core_rev <= 10)) { - /* The 32bit register shadows the two 16bit registers - * with update sideeffects. Validate this. */ - b43_write16(dev, B43_MMIO_TSF_CFP_START, 0xAAAA); - b43_write32(dev, B43_MMIO_TSF_CFP_START, 0xCCCCBBBB); - if (b43_read16(dev, B43_MMIO_TSF_CFP_START_LOW) != 0xBBBB) - goto error; - if (b43_read16(dev, B43_MMIO_TSF_CFP_START_HIGH) != 0xCCCC) - goto error; - } - b43_write32(dev, B43_MMIO_TSF_CFP_START, 0); - - v = b43_read32(dev, B43_MMIO_MACCTL); - v |= B43_MACCTL_GMODE; - if (v != (B43_MACCTL_GMODE | B43_MACCTL_IHR_ENABLED)) - goto error; - - return 0; -error: - b43err(dev->wl, "Failed to validate the chipaccess\n"); - return -ENODEV; -} - -static void b43_security_init(struct b43_wldev *dev) -{ - dev->ktp = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_KTP); - /* KTP is a word address, but we address SHM bytewise. - * So multiply by two. - */ - dev->ktp *= 2; - /* Number of RCMTA address slots */ - b43_write16(dev, B43_MMIO_RCMTA_COUNT, B43_NR_PAIRWISE_KEYS); - /* Clear the key memory. */ - b43_clear_keys(dev); -} - -#ifdef CONFIG_B43_HWRNG -static int b43_rng_read(struct hwrng *rng, u32 *data) -{ - struct b43_wl *wl = (struct b43_wl *)rng->priv; - struct b43_wldev *dev; - int count = -ENODEV; - - mutex_lock(&wl->mutex); - dev = wl->current_dev; - if (likely(dev && b43_status(dev) >= B43_STAT_INITIALIZED)) { - *data = b43_read16(dev, B43_MMIO_RNG); - count = sizeof(u16); - } - mutex_unlock(&wl->mutex); - - return count; -} -#endif /* CONFIG_B43_HWRNG */ - -static void b43_rng_exit(struct b43_wl *wl) -{ -#ifdef CONFIG_B43_HWRNG - if (wl->rng_initialized) - hwrng_unregister(&wl->rng); -#endif /* CONFIG_B43_HWRNG */ -} - -static int b43_rng_init(struct b43_wl *wl) -{ - int err = 0; - -#ifdef CONFIG_B43_HWRNG - snprintf(wl->rng_name, ARRAY_SIZE(wl->rng_name), - "%s_%s", KBUILD_MODNAME, wiphy_name(wl->hw->wiphy)); - wl->rng.name = wl->rng_name; - wl->rng.data_read = b43_rng_read; - wl->rng.priv = (unsigned long)wl; - wl->rng_initialized = true; - err = hwrng_register(&wl->rng); - if (err) { - wl->rng_initialized = false; - b43err(wl, "Failed to register the random " - "number generator (%d)\n", err); - } -#endif /* CONFIG_B43_HWRNG */ - - return err; -} - -static void b43_tx_work(struct work_struct *work) -{ - struct b43_wl *wl = container_of(work, struct b43_wl, tx_work); - struct b43_wldev *dev; - struct sk_buff *skb; - int queue_num; - int err = 0; - - mutex_lock(&wl->mutex); - dev = wl->current_dev; - if (unlikely(!dev || b43_status(dev) < B43_STAT_STARTED)) { - mutex_unlock(&wl->mutex); - return; - } - - for (queue_num = 0; queue_num < B43_QOS_QUEUE_NUM; queue_num++) { - while (skb_queue_len(&wl->tx_queue[queue_num])) { - skb = skb_dequeue(&wl->tx_queue[queue_num]); - if (b43_using_pio_transfers(dev)) - err = b43_pio_tx(dev, skb); - else - err = b43_dma_tx(dev, skb); - if (err == -ENOSPC) { - wl->tx_queue_stopped[queue_num] = 1; - ieee80211_stop_queue(wl->hw, queue_num); - skb_queue_head(&wl->tx_queue[queue_num], skb); - break; - } - if (unlikely(err)) - ieee80211_free_txskb(wl->hw, skb); - err = 0; - } - - if (!err) - wl->tx_queue_stopped[queue_num] = 0; - } - -#if B43_DEBUG - dev->tx_count++; -#endif - mutex_unlock(&wl->mutex); -} - -static void b43_op_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - - if (unlikely(skb->len < 2 + 2 + 6)) { - /* Too short, this can't be a valid frame. */ - ieee80211_free_txskb(hw, skb); - return; - } - B43_WARN_ON(skb_shinfo(skb)->nr_frags); - - skb_queue_tail(&wl->tx_queue[skb->queue_mapping], skb); - if (!wl->tx_queue_stopped[skb->queue_mapping]) { - ieee80211_queue_work(wl->hw, &wl->tx_work); - } else { - ieee80211_stop_queue(wl->hw, skb->queue_mapping); - } -} - -static void b43_qos_params_upload(struct b43_wldev *dev, - const struct ieee80211_tx_queue_params *p, - u16 shm_offset) -{ - u16 params[B43_NR_QOSPARAMS]; - int bslots, tmp; - unsigned int i; - - if (!dev->qos_enabled) - return; - - bslots = b43_read16(dev, B43_MMIO_RNG) & p->cw_min; - - memset(¶ms, 0, sizeof(params)); - - params[B43_QOSPARAM_TXOP] = p->txop * 32; - params[B43_QOSPARAM_CWMIN] = p->cw_min; - params[B43_QOSPARAM_CWMAX] = p->cw_max; - params[B43_QOSPARAM_CWCUR] = p->cw_min; - params[B43_QOSPARAM_AIFS] = p->aifs; - params[B43_QOSPARAM_BSLOTS] = bslots; - params[B43_QOSPARAM_REGGAP] = bslots + p->aifs; - - for (i = 0; i < ARRAY_SIZE(params); i++) { - if (i == B43_QOSPARAM_STATUS) { - tmp = b43_shm_read16(dev, B43_SHM_SHARED, - shm_offset + (i * 2)); - /* Mark the parameters as updated. */ - tmp |= 0x100; - b43_shm_write16(dev, B43_SHM_SHARED, - shm_offset + (i * 2), - tmp); - } else { - b43_shm_write16(dev, B43_SHM_SHARED, - shm_offset + (i * 2), - params[i]); - } - } -} - -/* Mapping of mac80211 queue numbers to b43 QoS SHM offsets. */ -static const u16 b43_qos_shm_offsets[] = { - /* [mac80211-queue-nr] = SHM_OFFSET, */ - [0] = B43_QOS_VOICE, - [1] = B43_QOS_VIDEO, - [2] = B43_QOS_BESTEFFORT, - [3] = B43_QOS_BACKGROUND, -}; - -/* Update all QOS parameters in hardware. */ -static void b43_qos_upload_all(struct b43_wldev *dev) -{ - struct b43_wl *wl = dev->wl; - struct b43_qos_params *params; - unsigned int i; - - if (!dev->qos_enabled) - return; - - BUILD_BUG_ON(ARRAY_SIZE(b43_qos_shm_offsets) != - ARRAY_SIZE(wl->qos_params)); - - b43_mac_suspend(dev); - for (i = 0; i < ARRAY_SIZE(wl->qos_params); i++) { - params = &(wl->qos_params[i]); - b43_qos_params_upload(dev, &(params->p), - b43_qos_shm_offsets[i]); - } - b43_mac_enable(dev); -} - -static void b43_qos_clear(struct b43_wl *wl) -{ - struct b43_qos_params *params; - unsigned int i; - - /* Initialize QoS parameters to sane defaults. */ - - BUILD_BUG_ON(ARRAY_SIZE(b43_qos_shm_offsets) != - ARRAY_SIZE(wl->qos_params)); - - for (i = 0; i < ARRAY_SIZE(wl->qos_params); i++) { - params = &(wl->qos_params[i]); - - switch (b43_qos_shm_offsets[i]) { - case B43_QOS_VOICE: - params->p.txop = 0; - params->p.aifs = 2; - params->p.cw_min = 0x0001; - params->p.cw_max = 0x0001; - break; - case B43_QOS_VIDEO: - params->p.txop = 0; - params->p.aifs = 2; - params->p.cw_min = 0x0001; - params->p.cw_max = 0x0001; - break; - case B43_QOS_BESTEFFORT: - params->p.txop = 0; - params->p.aifs = 3; - params->p.cw_min = 0x0001; - params->p.cw_max = 0x03FF; - break; - case B43_QOS_BACKGROUND: - params->p.txop = 0; - params->p.aifs = 7; - params->p.cw_min = 0x0001; - params->p.cw_max = 0x03FF; - break; - default: - B43_WARN_ON(1); - } - } -} - -/* Initialize the core's QOS capabilities */ -static void b43_qos_init(struct b43_wldev *dev) -{ - if (!dev->qos_enabled) { - /* Disable QOS support. */ - b43_hf_write(dev, b43_hf_read(dev) & ~B43_HF_EDCF); - b43_write16(dev, B43_MMIO_IFSCTL, - b43_read16(dev, B43_MMIO_IFSCTL) - & ~B43_MMIO_IFSCTL_USE_EDCF); - b43dbg(dev->wl, "QoS disabled\n"); - return; - } - - /* Upload the current QOS parameters. */ - b43_qos_upload_all(dev); - - /* Enable QOS support. */ - b43_hf_write(dev, b43_hf_read(dev) | B43_HF_EDCF); - b43_write16(dev, B43_MMIO_IFSCTL, - b43_read16(dev, B43_MMIO_IFSCTL) - | B43_MMIO_IFSCTL_USE_EDCF); - b43dbg(dev->wl, "QoS enabled\n"); -} - -static int b43_op_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 _queue, - const struct ieee80211_tx_queue_params *params) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev; - unsigned int queue = (unsigned int)_queue; - int err = -ENODEV; - - if (queue >= ARRAY_SIZE(wl->qos_params)) { - /* Queue not available or don't support setting - * params on this queue. Return success to not - * confuse mac80211. */ - return 0; - } - BUILD_BUG_ON(ARRAY_SIZE(b43_qos_shm_offsets) != - ARRAY_SIZE(wl->qos_params)); - - mutex_lock(&wl->mutex); - dev = wl->current_dev; - if (unlikely(!dev || (b43_status(dev) < B43_STAT_INITIALIZED))) - goto out_unlock; - - memcpy(&(wl->qos_params[queue].p), params, sizeof(*params)); - b43_mac_suspend(dev); - b43_qos_params_upload(dev, &(wl->qos_params[queue].p), - b43_qos_shm_offsets[queue]); - b43_mac_enable(dev); - err = 0; - -out_unlock: - mutex_unlock(&wl->mutex); - - return err; -} - -static int b43_op_get_stats(struct ieee80211_hw *hw, - struct ieee80211_low_level_stats *stats) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - - mutex_lock(&wl->mutex); - memcpy(stats, &wl->ieee_stats, sizeof(*stats)); - mutex_unlock(&wl->mutex); - - return 0; -} - -static u64 b43_op_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev; - u64 tsf; - - mutex_lock(&wl->mutex); - dev = wl->current_dev; - - if (dev && (b43_status(dev) >= B43_STAT_INITIALIZED)) - b43_tsf_read(dev, &tsf); - else - tsf = 0; - - mutex_unlock(&wl->mutex); - - return tsf; -} - -static void b43_op_set_tsf(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u64 tsf) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev; - - mutex_lock(&wl->mutex); - dev = wl->current_dev; - - if (dev && (b43_status(dev) >= B43_STAT_INITIALIZED)) - b43_tsf_write(dev, tsf); - - mutex_unlock(&wl->mutex); -} - -static void b43_put_phy_into_reset(struct b43_wldev *dev) -{ - u32 tmp; - - switch (dev->dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - b43err(dev->wl, - "Putting PHY into reset not supported on BCMA\n"); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); - tmp &= ~B43_TMSLOW_GMODE; - tmp |= B43_TMSLOW_PHYRESET; - tmp |= SSB_TMSLOW_FGC; - ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); - msleep(1); - - tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); - tmp &= ~SSB_TMSLOW_FGC; - tmp |= B43_TMSLOW_PHYRESET; - ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); - msleep(1); - - break; -#endif - } -} - -static const char *band_to_string(enum ieee80211_band band) -{ - switch (band) { - case IEEE80211_BAND_5GHZ: - return "5"; - case IEEE80211_BAND_2GHZ: - return "2.4"; - default: - break; - } - B43_WARN_ON(1); - return ""; -} - -/* Expects wl->mutex locked */ -static int b43_switch_band(struct b43_wl *wl, struct ieee80211_channel *chan) -{ - struct b43_wldev *up_dev = NULL; - struct b43_wldev *down_dev; - struct b43_wldev *d; - int err; - bool uninitialized_var(gmode); - int prev_status; - - /* Find a device and PHY which supports the band. */ - list_for_each_entry(d, &wl->devlist, list) { - switch (chan->band) { - case IEEE80211_BAND_5GHZ: - if (d->phy.supports_5ghz) { - up_dev = d; - gmode = false; - } - break; - case IEEE80211_BAND_2GHZ: - if (d->phy.supports_2ghz) { - up_dev = d; - gmode = true; - } - break; - default: - B43_WARN_ON(1); - return -EINVAL; - } - if (up_dev) - break; - } - if (!up_dev) { - b43err(wl, "Could not find a device for %s-GHz band operation\n", - band_to_string(chan->band)); - return -ENODEV; - } - if ((up_dev == wl->current_dev) && - (!!wl->current_dev->phy.gmode == !!gmode)) { - /* This device is already running. */ - return 0; - } - b43dbg(wl, "Switching to %s-GHz band\n", - band_to_string(chan->band)); - down_dev = wl->current_dev; - - prev_status = b43_status(down_dev); - /* Shutdown the currently running core. */ - if (prev_status >= B43_STAT_STARTED) - down_dev = b43_wireless_core_stop(down_dev); - if (prev_status >= B43_STAT_INITIALIZED) - b43_wireless_core_exit(down_dev); - - if (down_dev != up_dev) { - /* We switch to a different core, so we put PHY into - * RESET on the old core. */ - b43_put_phy_into_reset(down_dev); - } - - /* Now start the new core. */ - up_dev->phy.gmode = gmode; - if (prev_status >= B43_STAT_INITIALIZED) { - err = b43_wireless_core_init(up_dev); - if (err) { - b43err(wl, "Fatal: Could not initialize device for " - "selected %s-GHz band\n", - band_to_string(chan->band)); - goto init_failure; - } - } - if (prev_status >= B43_STAT_STARTED) { - err = b43_wireless_core_start(up_dev); - if (err) { - b43err(wl, "Fatal: Could not start device for " - "selected %s-GHz band\n", - band_to_string(chan->band)); - b43_wireless_core_exit(up_dev); - goto init_failure; - } - } - B43_WARN_ON(b43_status(up_dev) != prev_status); - - wl->current_dev = up_dev; - - return 0; -init_failure: - /* Whoops, failed to init the new core. No core is operating now. */ - wl->current_dev = NULL; - return err; -} - -/* Write the short and long frame retry limit values. */ -static void b43_set_retry_limits(struct b43_wldev *dev, - unsigned int short_retry, - unsigned int long_retry) -{ - /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing - * the chip-internal counter. */ - short_retry = min(short_retry, (unsigned int)0xF); - long_retry = min(long_retry, (unsigned int)0xF); - - b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_SRLIMIT, - short_retry); - b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_LRLIMIT, - long_retry); -} - -static int b43_op_config(struct ieee80211_hw *hw, u32 changed) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev; - struct b43_phy *phy; - struct ieee80211_conf *conf = &hw->conf; - int antenna; - int err = 0; - bool reload_bss = false; - - mutex_lock(&wl->mutex); - - dev = wl->current_dev; - - /* Switch the band (if necessary). This might change the active core. */ - err = b43_switch_band(wl, conf->chandef.chan); - if (err) - goto out_unlock_mutex; - - /* Need to reload all settings if the core changed */ - if (dev != wl->current_dev) { - dev = wl->current_dev; - changed = ~0; - reload_bss = true; - } - - phy = &dev->phy; - - if (conf_is_ht(conf)) - phy->is_40mhz = - (conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf)); - else - phy->is_40mhz = false; - - b43_mac_suspend(dev); - - if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) - b43_set_retry_limits(dev, conf->short_frame_max_tx_count, - conf->long_frame_max_tx_count); - changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS; - if (!changed) - goto out_mac_enable; - - /* Switch to the requested channel. - * The firmware takes care of races with the TX handler. */ - if (conf->chandef.chan->hw_value != phy->channel) - b43_switch_channel(dev, conf->chandef.chan->hw_value); - - dev->wl->radiotap_enabled = !!(conf->flags & IEEE80211_CONF_MONITOR); - - /* Adjust the desired TX power level. */ - if (conf->power_level != 0) { - if (conf->power_level != phy->desired_txpower) { - phy->desired_txpower = conf->power_level; - b43_phy_txpower_check(dev, B43_TXPWR_IGNORE_TIME | - B43_TXPWR_IGNORE_TSSI); - } - } - - /* Antennas for RX and management frame TX. */ - antenna = B43_ANTENNA_DEFAULT; - b43_mgmtframe_txantenna(dev, antenna); - antenna = B43_ANTENNA_DEFAULT; - if (phy->ops->set_rx_antenna) - phy->ops->set_rx_antenna(dev, antenna); - - if (wl->radio_enabled != phy->radio_on) { - if (wl->radio_enabled) { - b43_software_rfkill(dev, false); - b43info(dev->wl, "Radio turned on by software\n"); - if (!dev->radio_hw_enable) { - b43info(dev->wl, "The hardware RF-kill button " - "still turns the radio physically off. " - "Press the button to turn it on.\n"); - } - } else { - b43_software_rfkill(dev, true); - b43info(dev->wl, "Radio turned off by software\n"); - } - } - -out_mac_enable: - b43_mac_enable(dev); -out_unlock_mutex: - mutex_unlock(&wl->mutex); - - if (wl->vif && reload_bss) - b43_op_bss_info_changed(hw, wl->vif, &wl->vif->bss_conf, ~0); - - return err; -} - -static void b43_update_basic_rates(struct b43_wldev *dev, u32 brates) -{ - struct ieee80211_supported_band *sband = - dev->wl->hw->wiphy->bands[b43_current_band(dev->wl)]; - struct ieee80211_rate *rate; - int i; - u16 basic, direct, offset, basic_offset, rateptr; - - for (i = 0; i < sband->n_bitrates; i++) { - rate = &sband->bitrates[i]; - - if (b43_is_cck_rate(rate->hw_value)) { - direct = B43_SHM_SH_CCKDIRECT; - basic = B43_SHM_SH_CCKBASIC; - offset = b43_plcp_get_ratecode_cck(rate->hw_value); - offset &= 0xF; - } else { - direct = B43_SHM_SH_OFDMDIRECT; - basic = B43_SHM_SH_OFDMBASIC; - offset = b43_plcp_get_ratecode_ofdm(rate->hw_value); - offset &= 0xF; - } - - rate = ieee80211_get_response_rate(sband, brates, rate->bitrate); - - if (b43_is_cck_rate(rate->hw_value)) { - basic_offset = b43_plcp_get_ratecode_cck(rate->hw_value); - basic_offset &= 0xF; - } else { - basic_offset = b43_plcp_get_ratecode_ofdm(rate->hw_value); - basic_offset &= 0xF; - } - - /* - * Get the pointer that we need to point to - * from the direct map - */ - rateptr = b43_shm_read16(dev, B43_SHM_SHARED, - direct + 2 * basic_offset); - /* and write it to the basic map */ - b43_shm_write16(dev, B43_SHM_SHARED, basic + 2 * offset, - rateptr); - } -} - -static void b43_op_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *conf, - u32 changed) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev; - - mutex_lock(&wl->mutex); - - dev = wl->current_dev; - if (!dev || b43_status(dev) < B43_STAT_STARTED) - goto out_unlock_mutex; - - B43_WARN_ON(wl->vif != vif); - - if (changed & BSS_CHANGED_BSSID) { - if (conf->bssid) - memcpy(wl->bssid, conf->bssid, ETH_ALEN); - else - memset(wl->bssid, 0, ETH_ALEN); - } - - if (b43_status(dev) >= B43_STAT_INITIALIZED) { - if (changed & BSS_CHANGED_BEACON && - (b43_is_mode(wl, NL80211_IFTYPE_AP) || - b43_is_mode(wl, NL80211_IFTYPE_MESH_POINT) || - b43_is_mode(wl, NL80211_IFTYPE_ADHOC))) - b43_update_templates(wl); - - if (changed & BSS_CHANGED_BSSID) - b43_write_mac_bssid_templates(dev); - } - - b43_mac_suspend(dev); - - /* Update templates for AP/mesh mode. */ - if (changed & BSS_CHANGED_BEACON_INT && - (b43_is_mode(wl, NL80211_IFTYPE_AP) || - b43_is_mode(wl, NL80211_IFTYPE_MESH_POINT) || - b43_is_mode(wl, NL80211_IFTYPE_ADHOC)) && - conf->beacon_int) - b43_set_beacon_int(dev, conf->beacon_int); - - if (changed & BSS_CHANGED_BASIC_RATES) - b43_update_basic_rates(dev, conf->basic_rates); - - if (changed & BSS_CHANGED_ERP_SLOT) { - if (conf->use_short_slot) - b43_short_slot_timing_enable(dev); - else - b43_short_slot_timing_disable(dev); - } - - b43_mac_enable(dev); -out_unlock_mutex: - mutex_unlock(&wl->mutex); -} - -static int b43_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev; - u8 algorithm; - u8 index; - int err; - static const u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - - if (modparam_nohwcrypt) - return -ENOSPC; /* User disabled HW-crypto */ - - if ((vif->type == NL80211_IFTYPE_ADHOC || - vif->type == NL80211_IFTYPE_MESH_POINT) && - (key->cipher == WLAN_CIPHER_SUITE_TKIP || - key->cipher == WLAN_CIPHER_SUITE_CCMP) && - !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { - /* - * For now, disable hw crypto for the RSN IBSS group keys. This - * could be optimized in the future, but until that gets - * implemented, use of software crypto for group addressed - * frames is a acceptable to allow RSN IBSS to be used. - */ - return -EOPNOTSUPP; - } - - mutex_lock(&wl->mutex); - - dev = wl->current_dev; - err = -ENODEV; - if (!dev || b43_status(dev) < B43_STAT_INITIALIZED) - goto out_unlock; - - if (dev->fw.pcm_request_failed || !dev->hwcrypto_enabled) { - /* We don't have firmware for the crypto engine. - * Must use software-crypto. */ - err = -EOPNOTSUPP; - goto out_unlock; - } - - err = -EINVAL; - switch (key->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - algorithm = B43_SEC_ALGO_WEP40; - break; - case WLAN_CIPHER_SUITE_WEP104: - algorithm = B43_SEC_ALGO_WEP104; - break; - case WLAN_CIPHER_SUITE_TKIP: - algorithm = B43_SEC_ALGO_TKIP; - break; - case WLAN_CIPHER_SUITE_CCMP: - algorithm = B43_SEC_ALGO_AES; - break; - default: - B43_WARN_ON(1); - goto out_unlock; - } - index = (u8) (key->keyidx); - if (index > 3) - goto out_unlock; - - switch (cmd) { - case SET_KEY: - if (algorithm == B43_SEC_ALGO_TKIP && - (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE) || - !modparam_hwtkip)) { - /* We support only pairwise key */ - err = -EOPNOTSUPP; - goto out_unlock; - } - - if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { - if (WARN_ON(!sta)) { - err = -EOPNOTSUPP; - goto out_unlock; - } - /* Pairwise key with an assigned MAC address. */ - err = b43_key_write(dev, -1, algorithm, - key->key, key->keylen, - sta->addr, key); - } else { - /* Group key */ - err = b43_key_write(dev, index, algorithm, - key->key, key->keylen, NULL, key); - } - if (err) - goto out_unlock; - - if (algorithm == B43_SEC_ALGO_WEP40 || - algorithm == B43_SEC_ALGO_WEP104) { - b43_hf_write(dev, b43_hf_read(dev) | B43_HF_USEDEFKEYS); - } else { - b43_hf_write(dev, - b43_hf_read(dev) & ~B43_HF_USEDEFKEYS); - } - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - if (algorithm == B43_SEC_ALGO_TKIP) - key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; - break; - case DISABLE_KEY: { - err = b43_key_clear(dev, key->hw_key_idx); - if (err) - goto out_unlock; - break; - } - default: - B43_WARN_ON(1); - } - -out_unlock: - if (!err) { - b43dbg(wl, "%s hardware based encryption for keyidx: %d, " - "mac: %pM\n", - cmd == SET_KEY ? "Using" : "Disabling", key->keyidx, - sta ? sta->addr : bcast_addr); - b43_dump_keymemory(dev); - } - mutex_unlock(&wl->mutex); - - return err; -} - -static void b43_op_configure_filter(struct ieee80211_hw *hw, - unsigned int changed, unsigned int *fflags, - u64 multicast) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev; - - mutex_lock(&wl->mutex); - dev = wl->current_dev; - if (!dev) { - *fflags = 0; - goto out_unlock; - } - - *fflags &= FIF_PROMISC_IN_BSS | - FIF_ALLMULTI | - FIF_FCSFAIL | - FIF_PLCPFAIL | - FIF_CONTROL | - FIF_OTHER_BSS | - FIF_BCN_PRBRESP_PROMISC; - - changed &= FIF_PROMISC_IN_BSS | - FIF_ALLMULTI | - FIF_FCSFAIL | - FIF_PLCPFAIL | - FIF_CONTROL | - FIF_OTHER_BSS | - FIF_BCN_PRBRESP_PROMISC; - - wl->filter_flags = *fflags; - - if (changed && b43_status(dev) >= B43_STAT_INITIALIZED) - b43_adjust_opmode(dev); - -out_unlock: - mutex_unlock(&wl->mutex); -} - -/* Locking: wl->mutex - * Returns the current dev. This might be different from the passed in dev, - * because the core might be gone away while we unlocked the mutex. */ -static struct b43_wldev * b43_wireless_core_stop(struct b43_wldev *dev) -{ - struct b43_wl *wl; - struct b43_wldev *orig_dev; - u32 mask; - int queue_num; - - if (!dev) - return NULL; - wl = dev->wl; -redo: - if (!dev || b43_status(dev) < B43_STAT_STARTED) - return dev; - - /* Cancel work. Unlock to avoid deadlocks. */ - mutex_unlock(&wl->mutex); - cancel_delayed_work_sync(&dev->periodic_work); - cancel_work_sync(&wl->tx_work); - mutex_lock(&wl->mutex); - dev = wl->current_dev; - if (!dev || b43_status(dev) < B43_STAT_STARTED) { - /* Whoops, aliens ate up the device while we were unlocked. */ - return dev; - } - - /* Disable interrupts on the device. */ - b43_set_status(dev, B43_STAT_INITIALIZED); - if (b43_bus_host_is_sdio(dev->dev)) { - /* wl->mutex is locked. That is enough. */ - b43_write32(dev, B43_MMIO_GEN_IRQ_MASK, 0); - b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* Flush */ - } else { - spin_lock_irq(&wl->hardirq_lock); - b43_write32(dev, B43_MMIO_GEN_IRQ_MASK, 0); - b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* Flush */ - spin_unlock_irq(&wl->hardirq_lock); - } - /* Synchronize and free the interrupt handlers. Unlock to avoid deadlocks. */ - orig_dev = dev; - mutex_unlock(&wl->mutex); - if (b43_bus_host_is_sdio(dev->dev)) { - b43_sdio_free_irq(dev); - } else { - synchronize_irq(dev->dev->irq); - free_irq(dev->dev->irq, dev); - } - mutex_lock(&wl->mutex); - dev = wl->current_dev; - if (!dev) - return dev; - if (dev != orig_dev) { - if (b43_status(dev) >= B43_STAT_STARTED) - goto redo; - return dev; - } - mask = b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); - B43_WARN_ON(mask != 0xFFFFFFFF && mask); - - /* Drain all TX queues. */ - for (queue_num = 0; queue_num < B43_QOS_QUEUE_NUM; queue_num++) { - while (skb_queue_len(&wl->tx_queue[queue_num])) { - struct sk_buff *skb; - - skb = skb_dequeue(&wl->tx_queue[queue_num]); - ieee80211_free_txskb(wl->hw, skb); - } - } - - b43_mac_suspend(dev); - b43_leds_exit(dev); - b43dbg(wl, "Wireless interface stopped\n"); - - return dev; -} - -/* Locking: wl->mutex */ -static int b43_wireless_core_start(struct b43_wldev *dev) -{ - int err; - - B43_WARN_ON(b43_status(dev) != B43_STAT_INITIALIZED); - - drain_txstatus_queue(dev); - if (b43_bus_host_is_sdio(dev->dev)) { - err = b43_sdio_request_irq(dev, b43_sdio_interrupt_handler); - if (err) { - b43err(dev->wl, "Cannot request SDIO IRQ\n"); - goto out; - } - } else { - err = request_threaded_irq(dev->dev->irq, b43_interrupt_handler, - b43_interrupt_thread_handler, - IRQF_SHARED, KBUILD_MODNAME, dev); - if (err) { - b43err(dev->wl, "Cannot request IRQ-%d\n", - dev->dev->irq); - goto out; - } - } - - /* We are ready to run. */ - ieee80211_wake_queues(dev->wl->hw); - b43_set_status(dev, B43_STAT_STARTED); - - /* Start data flow (TX/RX). */ - b43_mac_enable(dev); - b43_write32(dev, B43_MMIO_GEN_IRQ_MASK, dev->irq_mask); - - /* Start maintenance work */ - b43_periodic_tasks_setup(dev); - - b43_leds_init(dev); - - b43dbg(dev->wl, "Wireless interface started\n"); -out: - return err; -} - -static char *b43_phy_name(struct b43_wldev *dev, u8 phy_type) -{ - switch (phy_type) { - case B43_PHYTYPE_A: - return "A"; - case B43_PHYTYPE_B: - return "B"; - case B43_PHYTYPE_G: - return "G"; - case B43_PHYTYPE_N: - return "N"; - case B43_PHYTYPE_LP: - return "LP"; - case B43_PHYTYPE_SSLPN: - return "SSLPN"; - case B43_PHYTYPE_HT: - return "HT"; - case B43_PHYTYPE_LCN: - return "LCN"; - case B43_PHYTYPE_LCNXN: - return "LCNXN"; - case B43_PHYTYPE_LCN40: - return "LCN40"; - case B43_PHYTYPE_AC: - return "AC"; - } - return "UNKNOWN"; -} - -/* Get PHY and RADIO versioning numbers */ -static int b43_phy_versioning(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - u32 tmp; - u8 analog_type; - u8 phy_type; - u8 phy_rev; - u16 radio_manuf; - u16 radio_ver; - u16 radio_rev; - int unsupported = 0; - - /* Get PHY versioning */ - tmp = b43_read16(dev, B43_MMIO_PHY_VER); - analog_type = (tmp & B43_PHYVER_ANALOG) >> B43_PHYVER_ANALOG_SHIFT; - phy_type = (tmp & B43_PHYVER_TYPE) >> B43_PHYVER_TYPE_SHIFT; - phy_rev = (tmp & B43_PHYVER_VERSION); - switch (phy_type) { - case B43_PHYTYPE_A: - if (phy_rev >= 4) - unsupported = 1; - break; - case B43_PHYTYPE_B: - if (phy_rev != 2 && phy_rev != 4 && phy_rev != 6 - && phy_rev != 7) - unsupported = 1; - break; - case B43_PHYTYPE_G: - if (phy_rev > 9) - unsupported = 1; - break; -#ifdef CONFIG_B43_PHY_N - case B43_PHYTYPE_N: - if (phy_rev > 9) - unsupported = 1; - break; -#endif -#ifdef CONFIG_B43_PHY_LP - case B43_PHYTYPE_LP: - if (phy_rev > 2) - unsupported = 1; - break; -#endif -#ifdef CONFIG_B43_PHY_HT - case B43_PHYTYPE_HT: - if (phy_rev > 1) - unsupported = 1; - break; -#endif -#ifdef CONFIG_B43_PHY_LCN - case B43_PHYTYPE_LCN: - if (phy_rev > 1) - unsupported = 1; - break; -#endif - default: - unsupported = 1; - } - if (unsupported) { - b43err(dev->wl, "FOUND UNSUPPORTED PHY (Analog %u, Type %d (%s), Revision %u)\n", - analog_type, phy_type, b43_phy_name(dev, phy_type), - phy_rev); - return -EOPNOTSUPP; - } - b43info(dev->wl, "Found PHY: Analog %u, Type %d (%s), Revision %u\n", - analog_type, phy_type, b43_phy_name(dev, phy_type), phy_rev); - - /* Get RADIO versioning */ - if (dev->dev->core_rev >= 24) { - u16 radio24[3]; - - for (tmp = 0; tmp < 3; tmp++) { - b43_write16(dev, B43_MMIO_RADIO24_CONTROL, tmp); - radio24[tmp] = b43_read16(dev, B43_MMIO_RADIO24_DATA); - } - - /* Broadcom uses "id" for our "ver" and has separated "ver" */ - /* radio_ver = (radio24[0] & 0xF0) >> 4; */ - - radio_manuf = 0x17F; - radio_ver = (radio24[2] << 8) | radio24[1]; - radio_rev = (radio24[0] & 0xF); - } else { - if (dev->dev->chip_id == 0x4317) { - if (dev->dev->chip_rev == 0) - tmp = 0x3205017F; - else if (dev->dev->chip_rev == 1) - tmp = 0x4205017F; - else - tmp = 0x5205017F; - } else { - b43_write16(dev, B43_MMIO_RADIO_CONTROL, - B43_RADIOCTL_ID); - tmp = b43_read16(dev, B43_MMIO_RADIO_DATA_LOW); - b43_write16(dev, B43_MMIO_RADIO_CONTROL, - B43_RADIOCTL_ID); - tmp |= (u32)b43_read16(dev, B43_MMIO_RADIO_DATA_HIGH) - << 16; - } - radio_manuf = (tmp & 0x00000FFF); - radio_ver = (tmp & 0x0FFFF000) >> 12; - radio_rev = (tmp & 0xF0000000) >> 28; - } - - if (radio_manuf != 0x17F /* Broadcom */) - unsupported = 1; - switch (phy_type) { - case B43_PHYTYPE_A: - if (radio_ver != 0x2060) - unsupported = 1; - if (radio_rev != 1) - unsupported = 1; - if (radio_manuf != 0x17F) - unsupported = 1; - break; - case B43_PHYTYPE_B: - if ((radio_ver & 0xFFF0) != 0x2050) - unsupported = 1; - break; - case B43_PHYTYPE_G: - if (radio_ver != 0x2050) - unsupported = 1; - break; - case B43_PHYTYPE_N: - if (radio_ver != 0x2055 && radio_ver != 0x2056) - unsupported = 1; - break; - case B43_PHYTYPE_LP: - if (radio_ver != 0x2062 && radio_ver != 0x2063) - unsupported = 1; - break; - case B43_PHYTYPE_HT: - if (radio_ver != 0x2059) - unsupported = 1; - break; - case B43_PHYTYPE_LCN: - if (radio_ver != 0x2064) - unsupported = 1; - break; - default: - B43_WARN_ON(1); - } - if (unsupported) { - b43err(dev->wl, "FOUND UNSUPPORTED RADIO " - "(Manuf 0x%X, Version 0x%X, Revision %u)\n", - radio_manuf, radio_ver, radio_rev); - return -EOPNOTSUPP; - } - b43dbg(dev->wl, "Found Radio: Manuf 0x%X, Version 0x%X, Revision %u\n", - radio_manuf, radio_ver, radio_rev); - - phy->radio_manuf = radio_manuf; - phy->radio_ver = radio_ver; - phy->radio_rev = radio_rev; - - phy->analog = analog_type; - phy->type = phy_type; - phy->rev = phy_rev; - - return 0; -} - -static void setup_struct_phy_for_init(struct b43_wldev *dev, - struct b43_phy *phy) -{ - phy->hardware_power_control = !!modparam_hwpctl; - phy->next_txpwr_check_time = jiffies; - /* PHY TX errors counter. */ - atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT); - -#if B43_DEBUG - phy->phy_locked = false; - phy->radio_locked = false; -#endif -} - -static void setup_struct_wldev_for_init(struct b43_wldev *dev) -{ - dev->dfq_valid = false; - - /* Assume the radio is enabled. If it's not enabled, the state will - * immediately get fixed on the first periodic work run. */ - dev->radio_hw_enable = true; - - /* Stats */ - memset(&dev->stats, 0, sizeof(dev->stats)); - - setup_struct_phy_for_init(dev, &dev->phy); - - /* IRQ related flags */ - dev->irq_reason = 0; - memset(dev->dma_reason, 0, sizeof(dev->dma_reason)); - dev->irq_mask = B43_IRQ_MASKTEMPLATE; - if (b43_modparam_verbose < B43_VERBOSITY_DEBUG) - dev->irq_mask &= ~B43_IRQ_PHY_TXERR; - - dev->mac_suspended = 1; - - /* Noise calculation context */ - memset(&dev->noisecalc, 0, sizeof(dev->noisecalc)); -} - -static void b43_bluetooth_coext_enable(struct b43_wldev *dev) -{ - struct ssb_sprom *sprom = dev->dev->bus_sprom; - u64 hf; - - if (!modparam_btcoex) - return; - if (!(sprom->boardflags_lo & B43_BFL_BTCOEXIST)) - return; - if (dev->phy.type != B43_PHYTYPE_B && !dev->phy.gmode) - return; - - hf = b43_hf_read(dev); - if (sprom->boardflags_lo & B43_BFL_BTCMOD) - hf |= B43_HF_BTCOEXALT; - else - hf |= B43_HF_BTCOEX; - b43_hf_write(dev, hf); -} - -static void b43_bluetooth_coext_disable(struct b43_wldev *dev) -{ - if (!modparam_btcoex) - return; - //TODO -} - -static void b43_imcfglo_timeouts_workaround(struct b43_wldev *dev) -{ - struct ssb_bus *bus; - u32 tmp; - - if (dev->dev->bus_type != B43_BUS_SSB) - return; - - bus = dev->dev->sdev->bus; - - if ((bus->chip_id == 0x4311 && bus->chip_rev == 2) || - (bus->chip_id == 0x4312)) { - tmp = ssb_read32(dev->dev->sdev, SSB_IMCFGLO); - tmp &= ~SSB_IMCFGLO_REQTO; - tmp &= ~SSB_IMCFGLO_SERTO; - tmp |= 0x3; - ssb_write32(dev->dev->sdev, SSB_IMCFGLO, tmp); - ssb_commit_settings(bus); - } -} - -static void b43_set_synth_pu_delay(struct b43_wldev *dev, bool idle) -{ - u16 pu_delay; - - /* The time value is in microseconds. */ - if (dev->phy.type == B43_PHYTYPE_A) - pu_delay = 3700; - else - pu_delay = 1050; - if (b43_is_mode(dev->wl, NL80211_IFTYPE_ADHOC) || idle) - pu_delay = 500; - if ((dev->phy.radio_ver == 0x2050) && (dev->phy.radio_rev == 8)) - pu_delay = max(pu_delay, (u16)2400); - - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_SPUWKUP, pu_delay); -} - -/* Set the TSF CFP pre-TargetBeaconTransmissionTime. */ -static void b43_set_pretbtt(struct b43_wldev *dev) -{ - u16 pretbtt; - - /* The time value is in microseconds. */ - if (b43_is_mode(dev->wl, NL80211_IFTYPE_ADHOC)) { - pretbtt = 2; - } else { - if (dev->phy.type == B43_PHYTYPE_A) - pretbtt = 120; - else - pretbtt = 250; - } - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_PRETBTT, pretbtt); - b43_write16(dev, B43_MMIO_TSF_CFP_PRETBTT, pretbtt); -} - -/* Shutdown a wireless core */ -/* Locking: wl->mutex */ -static void b43_wireless_core_exit(struct b43_wldev *dev) -{ - B43_WARN_ON(dev && b43_status(dev) > B43_STAT_INITIALIZED); - if (!dev || b43_status(dev) != B43_STAT_INITIALIZED) - return; - - /* Unregister HW RNG driver */ - b43_rng_exit(dev->wl); - - b43_set_status(dev, B43_STAT_UNINIT); - - /* Stop the microcode PSM. */ - b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_PSM_RUN, - B43_MACCTL_PSM_JMP0); - - b43_dma_free(dev); - b43_pio_free(dev); - b43_chip_exit(dev); - dev->phy.ops->switch_analog(dev, 0); - if (dev->wl->current_beacon) { - dev_kfree_skb_any(dev->wl->current_beacon); - dev->wl->current_beacon = NULL; - } - - b43_device_disable(dev, 0); - b43_bus_may_powerdown(dev); -} - -/* Initialize a wireless core */ -static int b43_wireless_core_init(struct b43_wldev *dev) -{ - struct ssb_sprom *sprom = dev->dev->bus_sprom; - struct b43_phy *phy = &dev->phy; - int err; - u64 hf; - - B43_WARN_ON(b43_status(dev) != B43_STAT_UNINIT); - - err = b43_bus_powerup(dev, 0); - if (err) - goto out; - if (!b43_device_is_enabled(dev)) - b43_wireless_core_reset(dev, phy->gmode); - - /* Reset all data structures. */ - setup_struct_wldev_for_init(dev); - phy->ops->prepare_structs(dev); - - /* Enable IRQ routing to this device. */ - switch (dev->dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0], - dev->dev->bdev, true); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - ssb_pcicore_dev_irqvecs_enable(&dev->dev->sdev->bus->pcicore, - dev->dev->sdev); - break; -#endif - } - - b43_imcfglo_timeouts_workaround(dev); - b43_bluetooth_coext_disable(dev); - if (phy->ops->prepare_hardware) { - err = phy->ops->prepare_hardware(dev); - if (err) - goto err_busdown; - } - err = b43_chip_init(dev); - if (err) - goto err_busdown; - b43_shm_write16(dev, B43_SHM_SHARED, - B43_SHM_SH_WLCOREREV, dev->dev->core_rev); - hf = b43_hf_read(dev); - if (phy->type == B43_PHYTYPE_G) { - hf |= B43_HF_SYMW; - if (phy->rev == 1) - hf |= B43_HF_GDCW; - if (sprom->boardflags_lo & B43_BFL_PACTRL) - hf |= B43_HF_OFDMPABOOST; - } - if (phy->radio_ver == 0x2050) { - if (phy->radio_rev == 6) - hf |= B43_HF_4318TSSI; - if (phy->radio_rev < 6) - hf |= B43_HF_VCORECALC; - } - if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW) - hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */ -#ifdef CONFIG_SSB_DRIVER_PCICORE - if (dev->dev->bus_type == B43_BUS_SSB && - dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI && - dev->dev->sdev->bus->pcicore.dev->id.revision <= 10) - hf |= B43_HF_PCISCW; /* PCI slow clock workaround. */ -#endif - hf &= ~B43_HF_SKCFPUP; - b43_hf_write(dev, hf); - - b43_set_retry_limits(dev, B43_DEFAULT_SHORT_RETRY_LIMIT, - B43_DEFAULT_LONG_RETRY_LIMIT); - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_SFFBLIM, 3); - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_LFFBLIM, 2); - - /* Disable sending probe responses from firmware. - * Setting the MaxTime to one usec will always trigger - * a timeout, so we never send any probe resp. - * A timeout of zero is infinite. */ - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_PRMAXTIME, 1); - - b43_rate_memory_init(dev); - b43_set_phytxctl_defaults(dev); - - /* Minimum Contention Window */ - if (phy->type == B43_PHYTYPE_B) - b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_MINCONT, 0x1F); - else - b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_MINCONT, 0xF); - /* Maximum Contention Window */ - b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_MAXCONT, 0x3FF); - - if (b43_bus_host_is_pcmcia(dev->dev) || - b43_bus_host_is_sdio(dev->dev)) { - dev->__using_pio_transfers = true; - err = b43_pio_init(dev); - } else if (dev->use_pio) { - b43warn(dev->wl, "Forced PIO by use_pio module parameter. " - "This should not be needed and will result in lower " - "performance.\n"); - dev->__using_pio_transfers = true; - err = b43_pio_init(dev); - } else { - dev->__using_pio_transfers = false; - err = b43_dma_init(dev); - } - if (err) - goto err_chip_exit; - b43_qos_init(dev); - b43_set_synth_pu_delay(dev, 1); - b43_bluetooth_coext_enable(dev); - - b43_bus_powerup(dev, !(sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)); - b43_upload_card_macaddress(dev); - b43_security_init(dev); - - ieee80211_wake_queues(dev->wl->hw); - - b43_set_status(dev, B43_STAT_INITIALIZED); - - /* Register HW RNG driver */ - b43_rng_init(dev->wl); - -out: - return err; - -err_chip_exit: - b43_chip_exit(dev); -err_busdown: - b43_bus_may_powerdown(dev); - B43_WARN_ON(b43_status(dev) != B43_STAT_UNINIT); - return err; -} - -static int b43_op_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev; - int err = -EOPNOTSUPP; - - /* TODO: allow WDS/AP devices to coexist */ - - if (vif->type != NL80211_IFTYPE_AP && - vif->type != NL80211_IFTYPE_MESH_POINT && - vif->type != NL80211_IFTYPE_STATION && - vif->type != NL80211_IFTYPE_WDS && - vif->type != NL80211_IFTYPE_ADHOC) - return -EOPNOTSUPP; - - mutex_lock(&wl->mutex); - if (wl->operating) - goto out_mutex_unlock; - - b43dbg(wl, "Adding Interface type %d\n", vif->type); - - dev = wl->current_dev; - wl->operating = true; - wl->vif = vif; - wl->if_type = vif->type; - memcpy(wl->mac_addr, vif->addr, ETH_ALEN); - - b43_adjust_opmode(dev); - b43_set_pretbtt(dev); - b43_set_synth_pu_delay(dev, 0); - b43_upload_card_macaddress(dev); - - err = 0; - out_mutex_unlock: - mutex_unlock(&wl->mutex); - - if (err == 0) - b43_op_bss_info_changed(hw, vif, &vif->bss_conf, ~0); - - return err; -} - -static void b43_op_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev = wl->current_dev; - - b43dbg(wl, "Removing Interface type %d\n", vif->type); - - mutex_lock(&wl->mutex); - - B43_WARN_ON(!wl->operating); - B43_WARN_ON(wl->vif != vif); - wl->vif = NULL; - - wl->operating = false; - - b43_adjust_opmode(dev); - memset(wl->mac_addr, 0, ETH_ALEN); - b43_upload_card_macaddress(dev); - - mutex_unlock(&wl->mutex); -} - -static int b43_op_start(struct ieee80211_hw *hw) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev = wl->current_dev; - int did_init = 0; - int err = 0; - - /* Kill all old instance specific information to make sure - * the card won't use it in the short timeframe between start - * and mac80211 reconfiguring it. */ - memset(wl->bssid, 0, ETH_ALEN); - memset(wl->mac_addr, 0, ETH_ALEN); - wl->filter_flags = 0; - wl->radiotap_enabled = false; - b43_qos_clear(wl); - wl->beacon0_uploaded = false; - wl->beacon1_uploaded = false; - wl->beacon_templates_virgin = true; - wl->radio_enabled = true; - - mutex_lock(&wl->mutex); - - if (b43_status(dev) < B43_STAT_INITIALIZED) { - err = b43_wireless_core_init(dev); - if (err) - goto out_mutex_unlock; - did_init = 1; - } - - if (b43_status(dev) < B43_STAT_STARTED) { - err = b43_wireless_core_start(dev); - if (err) { - if (did_init) - b43_wireless_core_exit(dev); - goto out_mutex_unlock; - } - } - - /* XXX: only do if device doesn't support rfkill irq */ - wiphy_rfkill_start_polling(hw->wiphy); - - out_mutex_unlock: - mutex_unlock(&wl->mutex); - - /* - * Configuration may have been overwritten during initialization. - * Reload the configuration, but only if initialization was - * successful. Reloading the configuration after a failed init - * may hang the system. - */ - if (!err) - b43_op_config(hw, ~0); - - return err; -} - -static void b43_op_stop(struct ieee80211_hw *hw) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev = wl->current_dev; - - cancel_work_sync(&(wl->beacon_update_trigger)); - - if (!dev) - goto out; - - mutex_lock(&wl->mutex); - if (b43_status(dev) >= B43_STAT_STARTED) { - dev = b43_wireless_core_stop(dev); - if (!dev) - goto out_unlock; - } - b43_wireless_core_exit(dev); - wl->radio_enabled = false; - -out_unlock: - mutex_unlock(&wl->mutex); -out: - cancel_work_sync(&(wl->txpower_adjust_work)); -} - -static int b43_op_beacon_set_tim(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, bool set) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - - /* FIXME: add locking */ - b43_update_templates(wl); - - return 0; -} - -static void b43_op_sta_notify(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum sta_notify_cmd notify_cmd, - struct ieee80211_sta *sta) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - - B43_WARN_ON(!vif || wl->vif != vif); -} - -static void b43_op_sw_scan_start_notifier(struct ieee80211_hw *hw) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev; - - mutex_lock(&wl->mutex); - dev = wl->current_dev; - if (dev && (b43_status(dev) >= B43_STAT_INITIALIZED)) { - /* Disable CFP update during scan on other channels. */ - b43_hf_write(dev, b43_hf_read(dev) | B43_HF_SKCFPUP); - } - mutex_unlock(&wl->mutex); -} - -static void b43_op_sw_scan_complete_notifier(struct ieee80211_hw *hw) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev; - - mutex_lock(&wl->mutex); - dev = wl->current_dev; - if (dev && (b43_status(dev) >= B43_STAT_INITIALIZED)) { - /* Re-enable CFP update. */ - b43_hf_write(dev, b43_hf_read(dev) & ~B43_HF_SKCFPUP); - } - mutex_unlock(&wl->mutex); -} - -static int b43_op_get_survey(struct ieee80211_hw *hw, int idx, - struct survey_info *survey) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev = wl->current_dev; - struct ieee80211_conf *conf = &hw->conf; - - if (idx != 0) - return -ENOENT; - - survey->channel = conf->chandef.chan; - survey->filled = SURVEY_INFO_NOISE_DBM; - survey->noise = dev->stats.link_noise; - - return 0; -} - -static const struct ieee80211_ops b43_hw_ops = { - .tx = b43_op_tx, - .conf_tx = b43_op_conf_tx, - .add_interface = b43_op_add_interface, - .remove_interface = b43_op_remove_interface, - .config = b43_op_config, - .bss_info_changed = b43_op_bss_info_changed, - .configure_filter = b43_op_configure_filter, - .set_key = b43_op_set_key, - .update_tkip_key = b43_op_update_tkip_key, - .get_stats = b43_op_get_stats, - .get_tsf = b43_op_get_tsf, - .set_tsf = b43_op_set_tsf, - .start = b43_op_start, - .stop = b43_op_stop, - .set_tim = b43_op_beacon_set_tim, - .sta_notify = b43_op_sta_notify, - .sw_scan_start = b43_op_sw_scan_start_notifier, - .sw_scan_complete = b43_op_sw_scan_complete_notifier, - .get_survey = b43_op_get_survey, - .rfkill_poll = b43_rfkill_poll, -}; - -/* Hard-reset the chip. Do not call this directly. - * Use b43_controller_restart() - */ -static void b43_chip_reset(struct work_struct *work) -{ - struct b43_wldev *dev = - container_of(work, struct b43_wldev, restart_work); - struct b43_wl *wl = dev->wl; - int err = 0; - int prev_status; - - mutex_lock(&wl->mutex); - - prev_status = b43_status(dev); - /* Bring the device down... */ - if (prev_status >= B43_STAT_STARTED) { - dev = b43_wireless_core_stop(dev); - if (!dev) { - err = -ENODEV; - goto out; - } - } - if (prev_status >= B43_STAT_INITIALIZED) - b43_wireless_core_exit(dev); - - /* ...and up again. */ - if (prev_status >= B43_STAT_INITIALIZED) { - err = b43_wireless_core_init(dev); - if (err) - goto out; - } - if (prev_status >= B43_STAT_STARTED) { - err = b43_wireless_core_start(dev); - if (err) { - b43_wireless_core_exit(dev); - goto out; - } - } -out: - if (err) - wl->current_dev = NULL; /* Failed to init the dev. */ - mutex_unlock(&wl->mutex); - - if (err) { - b43err(wl, "Controller restart FAILED\n"); - return; - } - - /* reload configuration */ - b43_op_config(wl->hw, ~0); - if (wl->vif) - b43_op_bss_info_changed(wl->hw, wl->vif, &wl->vif->bss_conf, ~0); - - b43info(wl, "Controller restarted\n"); -} - -static int b43_setup_bands(struct b43_wldev *dev, - bool have_2ghz_phy, bool have_5ghz_phy) -{ - struct ieee80211_hw *hw = dev->wl->hw; - - if (have_2ghz_phy) - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &b43_band_2GHz; - if (dev->phy.type == B43_PHYTYPE_N) { - if (have_5ghz_phy) - hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &b43_band_5GHz_nphy; - } else { - if (have_5ghz_phy) - hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &b43_band_5GHz_aphy; - } - - dev->phy.supports_2ghz = have_2ghz_phy; - dev->phy.supports_5ghz = have_5ghz_phy; - - return 0; -} - -static void b43_wireless_core_detach(struct b43_wldev *dev) -{ - /* We release firmware that late to not be required to re-request - * is all the time when we reinit the core. */ - b43_release_firmware(dev); - b43_phy_free(dev); -} - -static int b43_wireless_core_attach(struct b43_wldev *dev) -{ - struct b43_wl *wl = dev->wl; - struct pci_dev *pdev = NULL; - int err; - u32 tmp; - bool have_2ghz_phy = false, have_5ghz_phy = false; - - /* Do NOT do any device initialization here. - * Do it in wireless_core_init() instead. - * This function is for gathering basic information about the HW, only. - * Also some structs may be set up here. But most likely you want to have - * that in core_init(), too. - */ - -#ifdef CONFIG_B43_SSB - if (dev->dev->bus_type == B43_BUS_SSB && - dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI) - pdev = dev->dev->sdev->bus->host_pci; -#endif - - err = b43_bus_powerup(dev, 0); - if (err) { - b43err(wl, "Bus powerup failed\n"); - goto out; - } - - /* Get the PHY type. */ - switch (dev->dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - tmp = bcma_aread32(dev->dev->bdev, BCMA_IOST); - have_2ghz_phy = !!(tmp & B43_BCMA_IOST_2G_PHY); - have_5ghz_phy = !!(tmp & B43_BCMA_IOST_5G_PHY); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - if (dev->dev->core_rev >= 5) { - tmp = ssb_read32(dev->dev->sdev, SSB_TMSHIGH); - have_2ghz_phy = !!(tmp & B43_TMSHIGH_HAVE_2GHZ_PHY); - have_5ghz_phy = !!(tmp & B43_TMSHIGH_HAVE_5GHZ_PHY); - } else - B43_WARN_ON(1); - break; -#endif - } - - dev->phy.gmode = have_2ghz_phy; - dev->phy.radio_on = true; - b43_wireless_core_reset(dev, dev->phy.gmode); - - err = b43_phy_versioning(dev); - if (err) - goto err_powerdown; - /* Check if this device supports multiband. */ - if (!pdev || - (pdev->device != 0x4312 && - pdev->device != 0x4319 && pdev->device != 0x4324)) { - /* No multiband support. */ - have_2ghz_phy = false; - have_5ghz_phy = false; - switch (dev->phy.type) { - case B43_PHYTYPE_A: - have_5ghz_phy = true; - break; - case B43_PHYTYPE_LP: //FIXME not always! -#if 0 //FIXME enabling 5GHz causes a NULL pointer dereference - have_5ghz_phy = 1; -#endif - case B43_PHYTYPE_G: - case B43_PHYTYPE_N: - case B43_PHYTYPE_HT: - case B43_PHYTYPE_LCN: - have_2ghz_phy = true; - break; - default: - B43_WARN_ON(1); - } - } - if (dev->phy.type == B43_PHYTYPE_A) { - /* FIXME */ - b43err(wl, "IEEE 802.11a devices are unsupported\n"); - err = -EOPNOTSUPP; - goto err_powerdown; - } - if (1 /* disable A-PHY */) { - /* FIXME: For now we disable the A-PHY on multi-PHY devices. */ - if (dev->phy.type != B43_PHYTYPE_N && - dev->phy.type != B43_PHYTYPE_LP) { - have_2ghz_phy = true; - have_5ghz_phy = false; - } - } - - err = b43_phy_allocate(dev); - if (err) - goto err_powerdown; - - dev->phy.gmode = have_2ghz_phy; - b43_wireless_core_reset(dev, dev->phy.gmode); - - err = b43_validate_chipaccess(dev); - if (err) - goto err_phy_free; - err = b43_setup_bands(dev, have_2ghz_phy, have_5ghz_phy); - if (err) - goto err_phy_free; - - /* Now set some default "current_dev" */ - if (!wl->current_dev) - wl->current_dev = dev; - INIT_WORK(&dev->restart_work, b43_chip_reset); - - dev->phy.ops->switch_analog(dev, 0); - b43_device_disable(dev, 0); - b43_bus_may_powerdown(dev); - -out: - return err; - -err_phy_free: - b43_phy_free(dev); -err_powerdown: - b43_bus_may_powerdown(dev); - return err; -} - -static void b43_one_core_detach(struct b43_bus_dev *dev) -{ - struct b43_wldev *wldev; - struct b43_wl *wl; - - /* Do not cancel ieee80211-workqueue based work here. - * See comment in b43_remove(). */ - - wldev = b43_bus_get_wldev(dev); - wl = wldev->wl; - b43_debugfs_remove_device(wldev); - b43_wireless_core_detach(wldev); - list_del(&wldev->list); - wl->nr_devs--; - b43_bus_set_wldev(dev, NULL); - kfree(wldev); -} - -static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl) -{ - struct b43_wldev *wldev; - int err = -ENOMEM; - - wldev = kzalloc(sizeof(*wldev), GFP_KERNEL); - if (!wldev) - goto out; - - wldev->use_pio = b43_modparam_pio; - wldev->dev = dev; - wldev->wl = wl; - b43_set_status(wldev, B43_STAT_UNINIT); - wldev->bad_frames_preempt = modparam_bad_frames_preempt; - INIT_LIST_HEAD(&wldev->list); - - err = b43_wireless_core_attach(wldev); - if (err) - goto err_kfree_wldev; - - list_add(&wldev->list, &wl->devlist); - wl->nr_devs++; - b43_bus_set_wldev(dev, wldev); - b43_debugfs_add_device(wldev); - - out: - return err; - - err_kfree_wldev: - kfree(wldev); - return err; -} - -#define IS_PDEV(pdev, _vendor, _device, _subvendor, _subdevice) ( \ - (pdev->vendor == PCI_VENDOR_ID_##_vendor) && \ - (pdev->device == _device) && \ - (pdev->subsystem_vendor == PCI_VENDOR_ID_##_subvendor) && \ - (pdev->subsystem_device == _subdevice) ) - -static void b43_sprom_fixup(struct ssb_bus *bus) -{ - struct pci_dev *pdev; - - /* boardflags workarounds */ - if (bus->boardinfo.vendor == SSB_BOARDVENDOR_DELL && - bus->chip_id == 0x4301 && bus->sprom.board_rev == 0x74) - bus->sprom.boardflags_lo |= B43_BFL_BTCOEXIST; - if (bus->boardinfo.vendor == PCI_VENDOR_ID_APPLE && - bus->boardinfo.type == 0x4E && bus->sprom.board_rev > 0x40) - bus->sprom.boardflags_lo |= B43_BFL_PACTRL; - if (bus->bustype == SSB_BUSTYPE_PCI) { - pdev = bus->host_pci; - if (IS_PDEV(pdev, BROADCOM, 0x4318, ASUSTEK, 0x100F) || - IS_PDEV(pdev, BROADCOM, 0x4320, DELL, 0x0003) || - IS_PDEV(pdev, BROADCOM, 0x4320, HP, 0x12f8) || - IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0015) || - IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0014) || - IS_PDEV(pdev, BROADCOM, 0x4320, LINKSYS, 0x0013) || - IS_PDEV(pdev, BROADCOM, 0x4320, MOTOROLA, 0x7010)) - bus->sprom.boardflags_lo &= ~B43_BFL_BTCOEXIST; - } -} - -static void b43_wireless_exit(struct b43_bus_dev *dev, struct b43_wl *wl) -{ - struct ieee80211_hw *hw = wl->hw; - - ssb_set_devtypedata(dev->sdev, NULL); - ieee80211_free_hw(hw); -} - -static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev) -{ - struct ssb_sprom *sprom = dev->bus_sprom; - struct ieee80211_hw *hw; - struct b43_wl *wl; - char chip_name[6]; - int queue_num; - - hw = ieee80211_alloc_hw(sizeof(*wl), &b43_hw_ops); - if (!hw) { - b43err(NULL, "Could not allocate ieee80211 device\n"); - return ERR_PTR(-ENOMEM); - } - wl = hw_to_b43_wl(hw); - - /* fill hw info */ - hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_SIGNAL_DBM; - - hw->wiphy->interface_modes = - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_MESH_POINT) | - BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_WDS) | - BIT(NL80211_IFTYPE_ADHOC); - - hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; - - wl->hw_registred = false; - hw->max_rates = 2; - SET_IEEE80211_DEV(hw, dev->dev); - if (is_valid_ether_addr(sprom->et1mac)) - SET_IEEE80211_PERM_ADDR(hw, sprom->et1mac); - else - SET_IEEE80211_PERM_ADDR(hw, sprom->il0mac); - - /* Initialize struct b43_wl */ - wl->hw = hw; - mutex_init(&wl->mutex); - spin_lock_init(&wl->hardirq_lock); - INIT_LIST_HEAD(&wl->devlist); - INIT_WORK(&wl->beacon_update_trigger, b43_beacon_update_trigger_work); - INIT_WORK(&wl->txpower_adjust_work, b43_phy_txpower_adjust_work); - INIT_WORK(&wl->tx_work, b43_tx_work); - - /* Initialize queues and flags. */ - for (queue_num = 0; queue_num < B43_QOS_QUEUE_NUM; queue_num++) { - skb_queue_head_init(&wl->tx_queue[queue_num]); - wl->tx_queue_stopped[queue_num] = 0; - } - - snprintf(chip_name, ARRAY_SIZE(chip_name), - (dev->chip_id > 0x9999) ? "%d" : "%04X", dev->chip_id); - b43info(wl, "Broadcom %s WLAN found (core revision %u)\n", chip_name, - dev->core_rev); - return wl; -} - -#ifdef CONFIG_B43_BCMA -static int b43_bcma_probe(struct bcma_device *core) -{ - struct b43_bus_dev *dev; - struct b43_wl *wl; - int err; - - dev = b43_bus_dev_bcma_init(core); - if (!dev) - return -ENODEV; - - wl = b43_wireless_init(dev); - if (IS_ERR(wl)) { - err = PTR_ERR(wl); - goto bcma_out; - } - - err = b43_one_core_attach(dev, wl); - if (err) - goto bcma_err_wireless_exit; - - /* setup and start work to load firmware */ - INIT_WORK(&wl->firmware_load, b43_request_firmware); - schedule_work(&wl->firmware_load); - -bcma_out: - return err; - -bcma_err_wireless_exit: - ieee80211_free_hw(wl->hw); - return err; -} - -static void b43_bcma_remove(struct bcma_device *core) -{ - struct b43_wldev *wldev = bcma_get_drvdata(core); - struct b43_wl *wl = wldev->wl; - - /* We must cancel any work here before unregistering from ieee80211, - * as the ieee80211 unreg will destroy the workqueue. */ - cancel_work_sync(&wldev->restart_work); - cancel_work_sync(&wl->firmware_load); - - B43_WARN_ON(!wl); - if (!wldev->fw.ucode.data) - return; /* NULL if firmware never loaded */ - if (wl->current_dev == wldev && wl->hw_registred) { - b43_leds_stop(wldev); - ieee80211_unregister_hw(wl->hw); - } - - b43_one_core_detach(wldev->dev); - - b43_leds_unregister(wl); - - ieee80211_free_hw(wl->hw); -} - -static struct bcma_driver b43_bcma_driver = { - .name = KBUILD_MODNAME, - .id_table = b43_bcma_tbl, - .probe = b43_bcma_probe, - .remove = b43_bcma_remove, -}; -#endif - -#ifdef CONFIG_B43_SSB -static -int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id) -{ - struct b43_bus_dev *dev; - struct b43_wl *wl; - int err; - int first = 0; - - dev = b43_bus_dev_ssb_init(sdev); - if (!dev) - return -ENOMEM; - - wl = ssb_get_devtypedata(sdev); - if (!wl) { - /* Probing the first core. Must setup common struct b43_wl */ - first = 1; - b43_sprom_fixup(sdev->bus); - wl = b43_wireless_init(dev); - if (IS_ERR(wl)) { - err = PTR_ERR(wl); - goto out; - } - ssb_set_devtypedata(sdev, wl); - B43_WARN_ON(ssb_get_devtypedata(sdev) != wl); - } - err = b43_one_core_attach(dev, wl); - if (err) - goto err_wireless_exit; - - /* setup and start work to load firmware */ - INIT_WORK(&wl->firmware_load, b43_request_firmware); - schedule_work(&wl->firmware_load); - - out: - return err; - - err_wireless_exit: - if (first) - b43_wireless_exit(dev, wl); - return err; -} - -static void b43_ssb_remove(struct ssb_device *sdev) -{ - struct b43_wl *wl = ssb_get_devtypedata(sdev); - struct b43_wldev *wldev = ssb_get_drvdata(sdev); - struct b43_bus_dev *dev = wldev->dev; - - /* We must cancel any work here before unregistering from ieee80211, - * as the ieee80211 unreg will destroy the workqueue. */ - cancel_work_sync(&wldev->restart_work); - cancel_work_sync(&wl->firmware_load); - - B43_WARN_ON(!wl); - if (!wldev->fw.ucode.data) - return; /* NULL if firmware never loaded */ - if (wl->current_dev == wldev && wl->hw_registred) { - b43_leds_stop(wldev); - ieee80211_unregister_hw(wl->hw); - } - - b43_one_core_detach(dev); - - if (list_empty(&wl->devlist)) { - b43_leds_unregister(wl); - /* Last core on the chip unregistered. - * We can destroy common struct b43_wl. - */ - b43_wireless_exit(dev, wl); - } -} - -static struct ssb_driver b43_ssb_driver = { - .name = KBUILD_MODNAME, - .id_table = b43_ssb_tbl, - .probe = b43_ssb_probe, - .remove = b43_ssb_remove, -}; -#endif /* CONFIG_B43_SSB */ - -/* Perform a hardware reset. This can be called from any context. */ -void b43_controller_restart(struct b43_wldev *dev, const char *reason) -{ - /* Must avoid requeueing, if we are in shutdown. */ - if (b43_status(dev) < B43_STAT_INITIALIZED) - return; - b43info(dev->wl, "Controller RESET (%s) ...\n", reason); - ieee80211_queue_work(dev->wl->hw, &dev->restart_work); -} - -static void b43_print_driverinfo(void) -{ - const char *feat_pci = "", *feat_pcmcia = "", *feat_nphy = "", - *feat_leds = "", *feat_sdio = ""; - -#ifdef CONFIG_B43_PCI_AUTOSELECT - feat_pci = "P"; -#endif -#ifdef CONFIG_B43_PCMCIA - feat_pcmcia = "M"; -#endif -#ifdef CONFIG_B43_PHY_N - feat_nphy = "N"; -#endif -#ifdef CONFIG_B43_LEDS - feat_leds = "L"; -#endif -#ifdef CONFIG_B43_SDIO - feat_sdio = "S"; -#endif - printk(KERN_INFO "Broadcom 43xx driver loaded " - "[ Features: %s%s%s%s%s ]\n", - feat_pci, feat_pcmcia, feat_nphy, - feat_leds, feat_sdio); -} - -static int __init b43_init(void) -{ - int err; - - b43_debugfs_init(); - err = b43_pcmcia_init(); - if (err) - goto err_dfs_exit; - err = b43_sdio_init(); - if (err) - goto err_pcmcia_exit; -#ifdef CONFIG_B43_BCMA - err = bcma_driver_register(&b43_bcma_driver); - if (err) - goto err_sdio_exit; -#endif -#ifdef CONFIG_B43_SSB - err = ssb_driver_register(&b43_ssb_driver); - if (err) - goto err_bcma_driver_exit; -#endif - b43_print_driverinfo(); - - return err; - -#ifdef CONFIG_B43_SSB -err_bcma_driver_exit: -#endif -#ifdef CONFIG_B43_BCMA - bcma_driver_unregister(&b43_bcma_driver); -err_sdio_exit: -#endif - b43_sdio_exit(); -err_pcmcia_exit: - b43_pcmcia_exit(); -err_dfs_exit: - b43_debugfs_exit(); - return err; -} - -static void __exit b43_exit(void) -{ -#ifdef CONFIG_B43_SSB - ssb_driver_unregister(&b43_ssb_driver); -#endif -#ifdef CONFIG_B43_BCMA - bcma_driver_unregister(&b43_bcma_driver); -#endif - b43_sdio_exit(); - b43_pcmcia_exit(); - b43_debugfs_exit(); -} - -module_init(b43_init) -module_exit(b43_exit) diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h deleted file mode 100644 index abac25ee958d..000000000000 --- a/drivers/net/wireless/b43/main.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - - Broadcom B43 wireless driver - - Copyright (c) 2005 Martin Langer , - Stefano Brivio - Michael Buesch - Danny van Dyk - Andreas Jaggi - - Some parts of the code in this file are derived from the ipw2200 - driver Copyright(c) 2003 - 2004 Intel Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#ifndef B43_MAIN_H_ -#define B43_MAIN_H_ - -#include "b43.h" - -#define P4D_BYT3S(magic, nr_bytes) u8 __p4dding##magic[nr_bytes] -#define P4D_BYTES(line, nr_bytes) P4D_BYT3S(line, nr_bytes) -/* Magic helper macro to pad structures. Ignore those above. It's magic. */ -#define PAD_BYTES(nr_bytes) P4D_BYTES( __LINE__ , (nr_bytes)) - - -extern int b43_modparam_verbose; - -/* Logmessage verbosity levels. Update the b43_modparam_verbose helptext, if - * you add or remove levels. */ -enum b43_verbosity { - B43_VERBOSITY_ERROR, - B43_VERBOSITY_WARN, - B43_VERBOSITY_INFO, - B43_VERBOSITY_DEBUG, - __B43_VERBOSITY_AFTERLAST, /* keep last */ - - B43_VERBOSITY_MAX = __B43_VERBOSITY_AFTERLAST - 1, -#if B43_DEBUG - B43_VERBOSITY_DEFAULT = B43_VERBOSITY_DEBUG, -#else - B43_VERBOSITY_DEFAULT = B43_VERBOSITY_INFO, -#endif -}; - - -/* Lightweight function to convert a frequency (in Mhz) to a channel number. */ -static inline u8 b43_freq_to_channel_5ghz(int freq) -{ - return ((freq - 5000) / 5); -} -static inline u8 b43_freq_to_channel_2ghz(int freq) -{ - u8 channel; - - if (freq == 2484) - channel = 14; - else - channel = (freq - 2407) / 5; - - return channel; -} - -/* Lightweight function to convert a channel number to a frequency (in Mhz). */ -static inline int b43_channel_to_freq_5ghz(u8 channel) -{ - return (5000 + (5 * channel)); -} -static inline int b43_channel_to_freq_2ghz(u8 channel) -{ - int freq; - - if (channel == 14) - freq = 2484; - else - freq = 2407 + (5 * channel); - - return freq; -} - -static inline int b43_is_cck_rate(int rate) -{ - return (rate == B43_CCK_RATE_1MB || - rate == B43_CCK_RATE_2MB || - rate == B43_CCK_RATE_5MB || rate == B43_CCK_RATE_11MB); -} - -static inline int b43_is_ofdm_rate(int rate) -{ - return !b43_is_cck_rate(rate); -} - -u8 b43_ieee80211_antenna_sanitize(struct b43_wldev *dev, - u8 antenna_nr); - -void b43_tsf_read(struct b43_wldev *dev, u64 * tsf); -void b43_tsf_write(struct b43_wldev *dev, u64 tsf); - -u32 b43_shm_read32(struct b43_wldev *dev, u16 routing, u16 offset); -u16 b43_shm_read16(struct b43_wldev *dev, u16 routing, u16 offset); -void b43_shm_write32(struct b43_wldev *dev, u16 routing, u16 offset, u32 value); -void b43_shm_write16(struct b43_wldev *dev, u16 routing, u16 offset, u16 value); - -u64 b43_hf_read(struct b43_wldev *dev); -void b43_hf_write(struct b43_wldev *dev, u64 value); - -void b43_dummy_transmission(struct b43_wldev *dev, bool ofdm, bool pa_on); - -void b43_wireless_core_reset(struct b43_wldev *dev, bool gmode); - -void b43_controller_restart(struct b43_wldev *dev, const char *reason); - -#define B43_PS_ENABLED (1 << 0) /* Force enable hardware power saving */ -#define B43_PS_DISABLED (1 << 1) /* Force disable hardware power saving */ -#define B43_PS_AWAKE (1 << 2) /* Force device awake */ -#define B43_PS_ASLEEP (1 << 3) /* Force device asleep */ -void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags); - -void b43_mac_suspend(struct b43_wldev *dev); -void b43_mac_enable(struct b43_wldev *dev); -void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on); - - -struct b43_request_fw_context; -int b43_do_request_fw(struct b43_request_fw_context *ctx, const char *name, - struct b43_firmware_file *fw, bool async); -void b43_do_release_fw(struct b43_firmware_file *fw); - -#endif /* B43_MAIN_H_ */ diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c deleted file mode 100644 index 55f2bd7f8f74..000000000000 --- a/drivers/net/wireless/b43/pcmcia.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - - Broadcom B43 wireless driver - - Copyright (c) 2007 Michael Buesch - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "pcmcia.h" - -#include -#include -#include - -#include -#include -#include -#include - - -static const struct pcmcia_device_id b43_pcmcia_tbl[] = { - PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448), - PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x476), - PCMCIA_DEVICE_NULL, -}; - -MODULE_DEVICE_TABLE(pcmcia, b43_pcmcia_tbl); - -#ifdef CONFIG_PM -static int b43_pcmcia_suspend(struct pcmcia_device *dev) -{ - struct ssb_bus *ssb = dev->priv; - - return ssb_bus_suspend(ssb); -} - -static int b43_pcmcia_resume(struct pcmcia_device *dev) -{ - struct ssb_bus *ssb = dev->priv; - - return ssb_bus_resume(ssb); -} -#else /* CONFIG_PM */ -# define b43_pcmcia_suspend NULL -# define b43_pcmcia_resume NULL -#endif /* CONFIG_PM */ - -static int b43_pcmcia_probe(struct pcmcia_device *dev) -{ - struct ssb_bus *ssb; - int err = -ENOMEM; - int res = 0; - - ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); - if (!ssb) - goto out_error; - - err = -ENODEV; - - dev->config_flags |= CONF_ENABLE_IRQ; - - dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 | - WIN_USE_WAIT; - dev->resource[2]->start = 0; - dev->resource[2]->end = SSB_CORE_SIZE; - res = pcmcia_request_window(dev, dev->resource[2], 250); - if (res != 0) - goto err_kfree_ssb; - - res = pcmcia_map_mem_page(dev, dev->resource[2], 0); - if (res != 0) - goto err_disable; - - if (!dev->irq) - goto err_disable; - - res = pcmcia_enable_device(dev); - if (res != 0) - goto err_disable; - - err = ssb_bus_pcmciabus_register(ssb, dev, dev->resource[2]->start); - if (err) - goto err_disable; - dev->priv = ssb; - - return 0; - -err_disable: - pcmcia_disable_device(dev); -err_kfree_ssb: - kfree(ssb); -out_error: - printk(KERN_ERR "b43-pcmcia: Initialization failed (%d, %d)\n", - res, err); - return err; -} - -static void b43_pcmcia_remove(struct pcmcia_device *dev) -{ - struct ssb_bus *ssb = dev->priv; - - ssb_bus_unregister(ssb); - pcmcia_disable_device(dev); - kfree(ssb); - dev->priv = NULL; -} - -static struct pcmcia_driver b43_pcmcia_driver = { - .owner = THIS_MODULE, - .name = "b43-pcmcia", - .id_table = b43_pcmcia_tbl, - .probe = b43_pcmcia_probe, - .remove = b43_pcmcia_remove, - .suspend = b43_pcmcia_suspend, - .resume = b43_pcmcia_resume, -}; - -/* - * These are not module init/exit functions! - * The module_pcmcia_driver() helper cannot be used here. - */ -int b43_pcmcia_init(void) -{ - return pcmcia_register_driver(&b43_pcmcia_driver); -} - -void b43_pcmcia_exit(void) -{ - pcmcia_unregister_driver(&b43_pcmcia_driver); -} diff --git a/drivers/net/wireless/b43/pcmcia.h b/drivers/net/wireless/b43/pcmcia.h deleted file mode 100644 index 85f120a67cbe..000000000000 --- a/drivers/net/wireless/b43/pcmcia.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef B43_PCMCIA_H_ -#define B43_PCMCIA_H_ - -#ifdef CONFIG_B43_PCMCIA - -int b43_pcmcia_init(void); -void b43_pcmcia_exit(void); - -#else /* CONFIG_B43_PCMCIA */ - -static inline int b43_pcmcia_init(void) -{ - return 0; -} -static inline void b43_pcmcia_exit(void) -{ -} - -#endif /* CONFIG_B43_PCMCIA */ -#endif /* B43_PCMCIA_H_ */ diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c deleted file mode 100644 index a6c38104693d..000000000000 --- a/drivers/net/wireless/b43/phy_a.c +++ /dev/null @@ -1,595 +0,0 @@ -/* - - Broadcom B43 wireless driver - IEEE 802.11a PHY driver - - Copyright (c) 2005 Martin Langer , - Copyright (c) 2005-2007 Stefano Brivio - Copyright (c) 2005-2008 Michael Buesch - Copyright (c) 2005, 2006 Danny van Dyk - Copyright (c) 2005, 2006 Andreas Jaggi - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include - -#include "b43.h" -#include "phy_a.h" -#include "phy_common.h" -#include "wa.h" -#include "tables.h" -#include "main.h" - - -/* Get the freq, as it has to be written to the device. */ -static inline u16 channel2freq_a(u8 channel) -{ - B43_WARN_ON(channel > 200); - - return (5000 + 5 * channel); -} - -static inline u16 freq_r3A_value(u16 frequency) -{ - u16 value; - - if (frequency < 5091) - value = 0x0040; - else if (frequency < 5321) - value = 0x0000; - else if (frequency < 5806) - value = 0x0080; - else - value = 0x0040; - - return value; -} - -#if 0 -/* This function converts a TSSI value to dBm in Q5.2 */ -static s8 b43_aphy_estimate_power_out(struct b43_wldev *dev, s8 tssi) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_a *aphy = phy->a; - s8 dbm = 0; - s32 tmp; - - tmp = (aphy->tgt_idle_tssi - aphy->cur_idle_tssi + tssi); - tmp += 0x80; - tmp = clamp_val(tmp, 0x00, 0xFF); - dbm = aphy->tssi2dbm[tmp]; - //TODO: There's a FIXME on the specs - - return dbm; -} -#endif - -static void b43_radio_set_tx_iq(struct b43_wldev *dev) -{ - static const u8 data_high[5] = { 0x00, 0x40, 0x80, 0x90, 0xD0 }; - static const u8 data_low[5] = { 0x00, 0x01, 0x05, 0x06, 0x0A }; - u16 tmp = b43_radio_read16(dev, 0x001E); - int i, j; - - for (i = 0; i < 5; i++) { - for (j = 0; j < 5; j++) { - if (tmp == (data_high[i] << 4 | data_low[j])) { - b43_phy_write(dev, 0x0069, - (i - j) << 8 | 0x00C0); - return; - } - } - } -} - -static void aphy_channel_switch(struct b43_wldev *dev, unsigned int channel) -{ - u16 freq, r8, tmp; - - freq = channel2freq_a(channel); - - r8 = b43_radio_read16(dev, 0x0008); - b43_write16(dev, 0x03F0, freq); - b43_radio_write16(dev, 0x0008, r8); - - //TODO: write max channel TX power? to Radio 0x2D - tmp = b43_radio_read16(dev, 0x002E); - tmp &= 0x0080; - //TODO: OR tmp with the Power out estimation for this channel? - b43_radio_write16(dev, 0x002E, tmp); - - if (freq >= 4920 && freq <= 5500) { - /* - * r8 = (((freq * 15 * 0xE1FC780F) >> 32) / 29) & 0x0F; - * = (freq * 0.025862069 - */ - r8 = 3 * freq / 116; /* is equal to r8 = freq * 0.025862 */ - } - b43_radio_write16(dev, 0x0007, (r8 << 4) | r8); - b43_radio_write16(dev, 0x0020, (r8 << 4) | r8); - b43_radio_write16(dev, 0x0021, (r8 << 4) | r8); - b43_radio_maskset(dev, 0x0022, 0x000F, (r8 << 4)); - b43_radio_write16(dev, 0x002A, (r8 << 4)); - b43_radio_write16(dev, 0x002B, (r8 << 4)); - b43_radio_maskset(dev, 0x0008, 0x00F0, (r8 << 4)); - b43_radio_maskset(dev, 0x0029, 0xFF0F, 0x00B0); - b43_radio_write16(dev, 0x0035, 0x00AA); - b43_radio_write16(dev, 0x0036, 0x0085); - b43_radio_maskset(dev, 0x003A, 0xFF20, freq_r3A_value(freq)); - b43_radio_mask(dev, 0x003D, 0x00FF); - b43_radio_maskset(dev, 0x0081, 0xFF7F, 0x0080); - b43_radio_mask(dev, 0x0035, 0xFFEF); - b43_radio_maskset(dev, 0x0035, 0xFFEF, 0x0010); - b43_radio_set_tx_iq(dev); - //TODO: TSSI2dbm workaround -//FIXME b43_phy_xmitpower(dev); -} - -static void b43_radio_init2060(struct b43_wldev *dev) -{ - b43_radio_write16(dev, 0x0004, 0x00C0); - b43_radio_write16(dev, 0x0005, 0x0008); - b43_radio_write16(dev, 0x0009, 0x0040); - b43_radio_write16(dev, 0x0005, 0x00AA); - b43_radio_write16(dev, 0x0032, 0x008F); - b43_radio_write16(dev, 0x0006, 0x008F); - b43_radio_write16(dev, 0x0034, 0x008F); - b43_radio_write16(dev, 0x002C, 0x0007); - b43_radio_write16(dev, 0x0082, 0x0080); - b43_radio_write16(dev, 0x0080, 0x0000); - b43_radio_write16(dev, 0x003F, 0x00DA); - b43_radio_mask(dev, 0x0005, ~0x0008); - b43_radio_mask(dev, 0x0081, ~0x0010); - b43_radio_mask(dev, 0x0081, ~0x0020); - b43_radio_mask(dev, 0x0081, ~0x0020); - msleep(1); /* delay 400usec */ - - b43_radio_maskset(dev, 0x0081, ~0x0020, 0x0010); - msleep(1); /* delay 400usec */ - - b43_radio_maskset(dev, 0x0005, ~0x0008, 0x0008); - b43_radio_mask(dev, 0x0085, ~0x0010); - b43_radio_mask(dev, 0x0005, ~0x0008); - b43_radio_mask(dev, 0x0081, ~0x0040); - b43_radio_maskset(dev, 0x0081, ~0x0040, 0x0040); - b43_radio_write16(dev, 0x0005, - (b43_radio_read16(dev, 0x0081) & ~0x0008) | 0x0008); - b43_phy_write(dev, 0x0063, 0xDDC6); - b43_phy_write(dev, 0x0069, 0x07BE); - b43_phy_write(dev, 0x006A, 0x0000); - - aphy_channel_switch(dev, dev->phy.ops->get_default_chan(dev)); - - msleep(1); -} - -static void b43_phy_rssiagc(struct b43_wldev *dev, u8 enable) -{ - int i; - - if (dev->phy.rev < 3) { - if (enable) - for (i = 0; i < B43_TAB_RSSIAGC1_SIZE; i++) { - b43_ofdmtab_write16(dev, - B43_OFDMTAB_LNAHPFGAIN1, i, 0xFFF8); - b43_ofdmtab_write16(dev, - B43_OFDMTAB_WRSSI, i, 0xFFF8); - } - else - for (i = 0; i < B43_TAB_RSSIAGC1_SIZE; i++) { - b43_ofdmtab_write16(dev, - B43_OFDMTAB_LNAHPFGAIN1, i, b43_tab_rssiagc1[i]); - b43_ofdmtab_write16(dev, - B43_OFDMTAB_WRSSI, i, b43_tab_rssiagc1[i]); - } - } else { - if (enable) - for (i = 0; i < B43_TAB_RSSIAGC1_SIZE; i++) - b43_ofdmtab_write16(dev, - B43_OFDMTAB_WRSSI, i, 0x0820); - else - for (i = 0; i < B43_TAB_RSSIAGC2_SIZE; i++) - b43_ofdmtab_write16(dev, - B43_OFDMTAB_WRSSI, i, b43_tab_rssiagc2[i]); - } -} - -static void b43_phy_ww(struct b43_wldev *dev) -{ - u16 b, curr_s, best_s = 0xFFFF; - int i; - - b43_phy_mask(dev, B43_PHY_CRS0, ~B43_PHY_CRS0_EN); - b43_phy_set(dev, B43_PHY_OFDM(0x1B), 0x1000); - b43_phy_maskset(dev, B43_PHY_OFDM(0x82), 0xF0FF, 0x0300); - b43_radio_set(dev, 0x0009, 0x0080); - b43_radio_maskset(dev, 0x0012, 0xFFFC, 0x0002); - b43_wa_initgains(dev); - b43_phy_write(dev, B43_PHY_OFDM(0xBA), 0x3ED5); - b = b43_phy_read(dev, B43_PHY_PWRDOWN); - b43_phy_write(dev, B43_PHY_PWRDOWN, (b & 0xFFF8) | 0x0005); - b43_radio_set(dev, 0x0004, 0x0004); - for (i = 0x10; i <= 0x20; i++) { - b43_radio_write16(dev, 0x0013, i); - curr_s = b43_phy_read(dev, B43_PHY_OTABLEQ) & 0x00FF; - if (!curr_s) { - best_s = 0x0000; - break; - } else if (curr_s >= 0x0080) - curr_s = 0x0100 - curr_s; - if (curr_s < best_s) - best_s = curr_s; - } - b43_phy_write(dev, B43_PHY_PWRDOWN, b); - b43_radio_mask(dev, 0x0004, 0xFFFB); - b43_radio_write16(dev, 0x0013, best_s); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1_R1, 0, 0xFFEC); - b43_phy_write(dev, B43_PHY_OFDM(0xB7), 0x1E80); - b43_phy_write(dev, B43_PHY_OFDM(0xB6), 0x1C00); - b43_phy_write(dev, B43_PHY_OFDM(0xB5), 0x0EC0); - b43_phy_write(dev, B43_PHY_OFDM(0xB2), 0x00C0); - b43_phy_write(dev, B43_PHY_OFDM(0xB9), 0x1FFF); - b43_phy_maskset(dev, B43_PHY_OFDM(0xBB), 0xF000, 0x0053); - b43_phy_maskset(dev, B43_PHY_OFDM61, 0xFE1F, 0x0120); - b43_phy_maskset(dev, B43_PHY_OFDM(0x13), 0x0FFF, 0x3000); - b43_phy_maskset(dev, B43_PHY_OFDM(0x14), 0x0FFF, 0x3000); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1, 6, 0x0017); - for (i = 0; i < 6; i++) - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1, i, 0x000F); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1, 0x0D, 0x000E); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1, 0x0E, 0x0011); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1, 0x0F, 0x0013); - b43_phy_write(dev, B43_PHY_OFDM(0x33), 0x5030); - b43_phy_set(dev, B43_PHY_CRS0, B43_PHY_CRS0_EN); -} - -static void hardware_pctl_init_aphy(struct b43_wldev *dev) -{ - //TODO -} - -void b43_phy_inita(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - - /* This lowlevel A-PHY init is also called from G-PHY init. - * So we must not access phy->a, if called from G-PHY code. - */ - B43_WARN_ON((phy->type != B43_PHYTYPE_A) && - (phy->type != B43_PHYTYPE_G)); - - might_sleep(); - - if (phy->rev >= 6) { - if (phy->type == B43_PHYTYPE_A) - b43_phy_mask(dev, B43_PHY_OFDM(0x1B), ~0x1000); - if (b43_phy_read(dev, B43_PHY_ENCORE) & B43_PHY_ENCORE_EN) - b43_phy_set(dev, B43_PHY_ENCORE, 0x0010); - else - b43_phy_mask(dev, B43_PHY_ENCORE, ~0x1010); - } - - b43_wa_all(dev); - - if (phy->type == B43_PHYTYPE_A) { - if (phy->gmode && (phy->rev < 3)) - b43_phy_set(dev, 0x0034, 0x0001); - b43_phy_rssiagc(dev, 0); - - b43_phy_set(dev, B43_PHY_CRS0, B43_PHY_CRS0_EN); - - b43_radio_init2060(dev); - - if ((dev->dev->board_vendor == SSB_BOARDVENDOR_BCM) && - ((dev->dev->board_type == SSB_BOARD_BU4306) || - (dev->dev->board_type == SSB_BOARD_BU4309))) { - ; //TODO: A PHY LO - } - - if (phy->rev >= 3) - b43_phy_ww(dev); - - hardware_pctl_init_aphy(dev); - - //TODO: radar detection - } - - if ((phy->type == B43_PHYTYPE_G) && - (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL)) { - b43_phy_maskset(dev, B43_PHY_OFDM(0x6E), 0xE000, 0x3CF); - } -} - -/* Initialise the TSSI->dBm lookup table */ -static int b43_aphy_init_tssi2dbm_table(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_a *aphy = phy->a; - s16 pab0, pab1, pab2; - - pab0 = (s16) (dev->dev->bus_sprom->pa1b0); - pab1 = (s16) (dev->dev->bus_sprom->pa1b1); - pab2 = (s16) (dev->dev->bus_sprom->pa1b2); - - if (pab0 != 0 && pab1 != 0 && pab2 != 0 && - pab0 != -1 && pab1 != -1 && pab2 != -1) { - /* The pabX values are set in SPROM. Use them. */ - if ((s8) dev->dev->bus_sprom->itssi_a != 0 && - (s8) dev->dev->bus_sprom->itssi_a != -1) - aphy->tgt_idle_tssi = - (s8) (dev->dev->bus_sprom->itssi_a); - else - aphy->tgt_idle_tssi = 62; - aphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0, - pab1, pab2); - if (!aphy->tssi2dbm) - return -ENOMEM; - } else { - /* pabX values not set in SPROM, - * but APHY needs a generated table. */ - aphy->tssi2dbm = NULL; - b43err(dev->wl, "Could not generate tssi2dBm " - "table (wrong SPROM info)!\n"); - return -ENODEV; - } - - return 0; -} - -static int b43_aphy_op_allocate(struct b43_wldev *dev) -{ - struct b43_phy_a *aphy; - int err; - - aphy = kzalloc(sizeof(*aphy), GFP_KERNEL); - if (!aphy) - return -ENOMEM; - dev->phy.a = aphy; - - err = b43_aphy_init_tssi2dbm_table(dev); - if (err) - goto err_free_aphy; - - return 0; - -err_free_aphy: - kfree(aphy); - dev->phy.a = NULL; - - return err; -} - -static void b43_aphy_op_prepare_structs(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_a *aphy = phy->a; - const void *tssi2dbm; - int tgt_idle_tssi; - - /* tssi2dbm table is constant, so it is initialized at alloc time. - * Save a copy of the pointer. */ - tssi2dbm = aphy->tssi2dbm; - tgt_idle_tssi = aphy->tgt_idle_tssi; - - /* Zero out the whole PHY structure. */ - memset(aphy, 0, sizeof(*aphy)); - - aphy->tssi2dbm = tssi2dbm; - aphy->tgt_idle_tssi = tgt_idle_tssi; - - //TODO init struct b43_phy_a - -} - -static void b43_aphy_op_free(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_a *aphy = phy->a; - - kfree(aphy->tssi2dbm); - aphy->tssi2dbm = NULL; - - kfree(aphy); - dev->phy.a = NULL; -} - -static int b43_aphy_op_init(struct b43_wldev *dev) -{ - b43_phy_inita(dev); - - return 0; -} - -static inline u16 adjust_phyreg(struct b43_wldev *dev, u16 offset) -{ - /* OFDM registers are base-registers for the A-PHY. */ - if ((offset & B43_PHYROUTE) == B43_PHYROUTE_OFDM_GPHY) { - offset &= ~B43_PHYROUTE; - offset |= B43_PHYROUTE_BASE; - } - -#if B43_DEBUG - if ((offset & B43_PHYROUTE) == B43_PHYROUTE_EXT_GPHY) { - /* Ext-G registers are only available on G-PHYs */ - b43err(dev->wl, "Invalid EXT-G PHY access at " - "0x%04X on A-PHY\n", offset); - dump_stack(); - } - if ((offset & B43_PHYROUTE) == B43_PHYROUTE_N_BMODE) { - /* N-BMODE registers are only available on N-PHYs */ - b43err(dev->wl, "Invalid N-BMODE PHY access at " - "0x%04X on A-PHY\n", offset); - dump_stack(); - } -#endif /* B43_DEBUG */ - - return offset; -} - -static u16 b43_aphy_op_read(struct b43_wldev *dev, u16 reg) -{ - reg = adjust_phyreg(dev, reg); - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - return b43_read16(dev, B43_MMIO_PHY_DATA); -} - -static void b43_aphy_op_write(struct b43_wldev *dev, u16 reg, u16 value) -{ - reg = adjust_phyreg(dev, reg); - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - b43_write16(dev, B43_MMIO_PHY_DATA, value); -} - -static u16 b43_aphy_op_radio_read(struct b43_wldev *dev, u16 reg) -{ - /* Register 1 is a 32-bit register. */ - B43_WARN_ON(reg == 1); - /* A-PHY needs 0x40 for read access */ - reg |= 0x40; - - b43_write16(dev, B43_MMIO_RADIO_CONTROL, reg); - return b43_read16(dev, B43_MMIO_RADIO_DATA_LOW); -} - -static void b43_aphy_op_radio_write(struct b43_wldev *dev, u16 reg, u16 value) -{ - /* Register 1 is a 32-bit register. */ - B43_WARN_ON(reg == 1); - - b43_write16(dev, B43_MMIO_RADIO_CONTROL, reg); - b43_write16(dev, B43_MMIO_RADIO_DATA_LOW, value); -} - -static bool b43_aphy_op_supports_hwpctl(struct b43_wldev *dev) -{ - return (dev->phy.rev >= 5); -} - -static void b43_aphy_op_software_rfkill(struct b43_wldev *dev, - bool blocked) -{ - struct b43_phy *phy = &dev->phy; - - if (!blocked) { - if (phy->radio_on) - return; - b43_radio_write16(dev, 0x0004, 0x00C0); - b43_radio_write16(dev, 0x0005, 0x0008); - b43_phy_mask(dev, 0x0010, 0xFFF7); - b43_phy_mask(dev, 0x0011, 0xFFF7); - b43_radio_init2060(dev); - } else { - b43_radio_write16(dev, 0x0004, 0x00FF); - b43_radio_write16(dev, 0x0005, 0x00FB); - b43_phy_set(dev, 0x0010, 0x0008); - b43_phy_set(dev, 0x0011, 0x0008); - } -} - -static int b43_aphy_op_switch_channel(struct b43_wldev *dev, - unsigned int new_channel) -{ - if (new_channel > 200) - return -EINVAL; - aphy_channel_switch(dev, new_channel); - - return 0; -} - -static unsigned int b43_aphy_op_get_default_chan(struct b43_wldev *dev) -{ - return 36; /* Default to channel 36 */ -} - -static void b43_aphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna) -{//TODO - struct b43_phy *phy = &dev->phy; - u16 tmp; - int autodiv = 0; - - if (antenna == B43_ANTENNA_AUTO0 || antenna == B43_ANTENNA_AUTO1) - autodiv = 1; - - b43_hf_write(dev, b43_hf_read(dev) & ~B43_HF_ANTDIVHELP); - - b43_phy_maskset(dev, B43_PHY_BBANDCFG, ~B43_PHY_BBANDCFG_RXANT, - (autodiv ? B43_ANTENNA_AUTO1 : antenna) << - B43_PHY_BBANDCFG_RXANT_SHIFT); - - if (autodiv) { - tmp = b43_phy_read(dev, B43_PHY_ANTDWELL); - if (antenna == B43_ANTENNA_AUTO1) - tmp &= ~B43_PHY_ANTDWELL_AUTODIV1; - else - tmp |= B43_PHY_ANTDWELL_AUTODIV1; - b43_phy_write(dev, B43_PHY_ANTDWELL, tmp); - } - if (phy->rev < 3) - b43_phy_maskset(dev, B43_PHY_ANTDWELL, 0xFF00, 0x24); - else { - b43_phy_set(dev, B43_PHY_OFDM61, 0x10); - if (phy->rev == 3) { - b43_phy_write(dev, B43_PHY_CLIPPWRDOWNT, 0x1D); - b43_phy_write(dev, B43_PHY_ADIVRELATED, 8); - } else { - b43_phy_write(dev, B43_PHY_CLIPPWRDOWNT, 0x3A); - b43_phy_maskset(dev, B43_PHY_ADIVRELATED, 0xFF00, 8); - } - } - - b43_hf_write(dev, b43_hf_read(dev) | B43_HF_ANTDIVHELP); -} - -static void b43_aphy_op_adjust_txpower(struct b43_wldev *dev) -{//TODO -} - -static enum b43_txpwr_result b43_aphy_op_recalc_txpower(struct b43_wldev *dev, - bool ignore_tssi) -{//TODO - return B43_TXPWR_RES_DONE; -} - -static void b43_aphy_op_pwork_15sec(struct b43_wldev *dev) -{//TODO -} - -static void b43_aphy_op_pwork_60sec(struct b43_wldev *dev) -{//TODO -} - -const struct b43_phy_operations b43_phyops_a = { - .allocate = b43_aphy_op_allocate, - .free = b43_aphy_op_free, - .prepare_structs = b43_aphy_op_prepare_structs, - .init = b43_aphy_op_init, - .phy_read = b43_aphy_op_read, - .phy_write = b43_aphy_op_write, - .radio_read = b43_aphy_op_radio_read, - .radio_write = b43_aphy_op_radio_write, - .supports_hwpctl = b43_aphy_op_supports_hwpctl, - .software_rfkill = b43_aphy_op_software_rfkill, - .switch_analog = b43_phyop_switch_analog_generic, - .switch_channel = b43_aphy_op_switch_channel, - .get_default_chan = b43_aphy_op_get_default_chan, - .set_rx_antenna = b43_aphy_op_set_rx_antenna, - .recalc_txpower = b43_aphy_op_recalc_txpower, - .adjust_txpower = b43_aphy_op_adjust_txpower, - .pwork_15sec = b43_aphy_op_pwork_15sec, - .pwork_60sec = b43_aphy_op_pwork_60sec, -}; diff --git a/drivers/net/wireless/b43/phy_a.h b/drivers/net/wireless/b43/phy_a.h deleted file mode 100644 index 5cfaab7b16ee..000000000000 --- a/drivers/net/wireless/b43/phy_a.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef LINUX_B43_PHY_A_H_ -#define LINUX_B43_PHY_A_H_ - -#include "phy_common.h" - - -/* OFDM (A) PHY Registers */ -#define B43_PHY_VERSION_OFDM B43_PHY_OFDM(0x00) /* Versioning register for A-PHY */ -#define B43_PHY_BBANDCFG B43_PHY_OFDM(0x01) /* Baseband config */ -#define B43_PHY_BBANDCFG_RXANT 0x180 /* RX Antenna selection */ -#define B43_PHY_BBANDCFG_RXANT_SHIFT 7 -#define B43_PHY_PWRDOWN B43_PHY_OFDM(0x03) /* Powerdown */ -#define B43_PHY_CRSTHRES1_R1 B43_PHY_OFDM(0x06) /* CRS Threshold 1 (phy.rev 1 only) */ -#define B43_PHY_LNAHPFCTL B43_PHY_OFDM(0x1C) /* LNA/HPF control */ -#define B43_PHY_LPFGAINCTL B43_PHY_OFDM(0x20) /* LPF Gain control */ -#define B43_PHY_ADIVRELATED B43_PHY_OFDM(0x27) /* FIXME rename */ -#define B43_PHY_CRS0 B43_PHY_OFDM(0x29) -#define B43_PHY_CRS0_EN 0x4000 -#define B43_PHY_PEAK_COUNT B43_PHY_OFDM(0x30) -#define B43_PHY_ANTDWELL B43_PHY_OFDM(0x2B) /* Antenna dwell */ -#define B43_PHY_ANTDWELL_AUTODIV1 0x0100 /* Automatic RX diversity start antenna */ -#define B43_PHY_ENCORE B43_PHY_OFDM(0x49) /* "Encore" (RangeMax / BroadRange) */ -#define B43_PHY_ENCORE_EN 0x0200 /* Encore enable */ -#define B43_PHY_LMS B43_PHY_OFDM(0x55) -#define B43_PHY_OFDM61 B43_PHY_OFDM(0x61) /* FIXME rename */ -#define B43_PHY_OFDM61_10 0x0010 /* FIXME rename */ -#define B43_PHY_IQBAL B43_PHY_OFDM(0x69) /* I/Q balance */ -#define B43_PHY_BBTXDC_BIAS B43_PHY_OFDM(0x6B) /* Baseband TX DC bias */ -#define B43_PHY_OTABLECTL B43_PHY_OFDM(0x72) /* OFDM table control (see below) */ -#define B43_PHY_OTABLEOFF 0x03FF /* OFDM table offset (see below) */ -#define B43_PHY_OTABLENR 0xFC00 /* OFDM table number (see below) */ -#define B43_PHY_OTABLENR_SHIFT 10 -#define B43_PHY_OTABLEI B43_PHY_OFDM(0x73) /* OFDM table data I */ -#define B43_PHY_OTABLEQ B43_PHY_OFDM(0x74) /* OFDM table data Q */ -#define B43_PHY_HPWR_TSSICTL B43_PHY_OFDM(0x78) /* Hardware power TSSI control */ -#define B43_PHY_ADCCTL B43_PHY_OFDM(0x7A) /* ADC control */ -#define B43_PHY_IDLE_TSSI B43_PHY_OFDM(0x7B) -#define B43_PHY_A_TEMP_SENSE B43_PHY_OFDM(0x7C) /* A PHY temperature sense */ -#define B43_PHY_NRSSITHRES B43_PHY_OFDM(0x8A) /* NRSSI threshold */ -#define B43_PHY_ANTWRSETT B43_PHY_OFDM(0x8C) /* Antenna WR settle */ -#define B43_PHY_ANTWRSETT_ARXDIV 0x2000 /* Automatic RX diversity enabled */ -#define B43_PHY_CLIPPWRDOWNT B43_PHY_OFDM(0x93) /* Clip powerdown threshold */ -#define B43_PHY_OFDM9B B43_PHY_OFDM(0x9B) /* FIXME rename */ -#define B43_PHY_N1P1GAIN B43_PHY_OFDM(0xA0) -#define B43_PHY_P1P2GAIN B43_PHY_OFDM(0xA1) -#define B43_PHY_N1N2GAIN B43_PHY_OFDM(0xA2) -#define B43_PHY_CLIPTHRES B43_PHY_OFDM(0xA3) -#define B43_PHY_CLIPN1P2THRES B43_PHY_OFDM(0xA4) -#define B43_PHY_CCKSHIFTBITS_WA B43_PHY_OFDM(0xA5) /* CCK shiftbits workaround, FIXME rename */ -#define B43_PHY_CCKSHIFTBITS B43_PHY_OFDM(0xA7) /* FIXME rename */ -#define B43_PHY_DIVSRCHIDX B43_PHY_OFDM(0xA8) /* Divider search gain/index */ -#define B43_PHY_CLIPP2THRES B43_PHY_OFDM(0xA9) -#define B43_PHY_CLIPP3THRES B43_PHY_OFDM(0xAA) -#define B43_PHY_DIVP1P2GAIN B43_PHY_OFDM(0xAB) -#define B43_PHY_DIVSRCHGAINBACK B43_PHY_OFDM(0xAD) /* Divider search gain back */ -#define B43_PHY_DIVSRCHGAINCHNG B43_PHY_OFDM(0xAE) /* Divider search gain change */ -#define B43_PHY_CRSTHRES1 B43_PHY_OFDM(0xC0) /* CRS Threshold 1 (phy.rev >= 2 only) */ -#define B43_PHY_CRSTHRES2 B43_PHY_OFDM(0xC1) /* CRS Threshold 2 (phy.rev >= 2 only) */ -#define B43_PHY_TSSIP_LTBASE B43_PHY_OFDM(0x380) /* TSSI power lookup table base */ -#define B43_PHY_DC_LTBASE B43_PHY_OFDM(0x3A0) /* DC lookup table base */ -#define B43_PHY_GAIN_LTBASE B43_PHY_OFDM(0x3C0) /* Gain lookup table base */ - -/*** OFDM table numbers ***/ -#define B43_OFDMTAB(number, offset) (((number) << B43_PHY_OTABLENR_SHIFT) | (offset)) -#define B43_OFDMTAB_AGC1 B43_OFDMTAB(0x00, 0) -#define B43_OFDMTAB_GAIN0 B43_OFDMTAB(0x00, 0) -#define B43_OFDMTAB_GAINX B43_OFDMTAB(0x01, 0) //TODO rename -#define B43_OFDMTAB_GAIN1 B43_OFDMTAB(0x01, 4) -#define B43_OFDMTAB_AGC3 B43_OFDMTAB(0x02, 0) -#define B43_OFDMTAB_GAIN2 B43_OFDMTAB(0x02, 3) -#define B43_OFDMTAB_LNAHPFGAIN1 B43_OFDMTAB(0x03, 0) -#define B43_OFDMTAB_WRSSI B43_OFDMTAB(0x04, 0) -#define B43_OFDMTAB_LNAHPFGAIN2 B43_OFDMTAB(0x04, 0) -#define B43_OFDMTAB_NOISESCALE B43_OFDMTAB(0x05, 0) -#define B43_OFDMTAB_AGC2 B43_OFDMTAB(0x06, 0) -#define B43_OFDMTAB_ROTOR B43_OFDMTAB(0x08, 0) -#define B43_OFDMTAB_ADVRETARD B43_OFDMTAB(0x09, 0) -#define B43_OFDMTAB_DAC B43_OFDMTAB(0x0C, 0) -#define B43_OFDMTAB_DC B43_OFDMTAB(0x0E, 7) -#define B43_OFDMTAB_PWRDYN2 B43_OFDMTAB(0x0E, 12) -#define B43_OFDMTAB_LNAGAIN B43_OFDMTAB(0x0E, 13) -#define B43_OFDMTAB_UNKNOWN_0F B43_OFDMTAB(0x0F, 0) //TODO rename -#define B43_OFDMTAB_UNKNOWN_APHY B43_OFDMTAB(0x0F, 7) //TODO rename -#define B43_OFDMTAB_LPFGAIN B43_OFDMTAB(0x0F, 12) -#define B43_OFDMTAB_RSSI B43_OFDMTAB(0x10, 0) -#define B43_OFDMTAB_UNKNOWN_11 B43_OFDMTAB(0x11, 4) //TODO rename -#define B43_OFDMTAB_AGC1_R1 B43_OFDMTAB(0x13, 0) -#define B43_OFDMTAB_GAINX_R1 B43_OFDMTAB(0x14, 0) //TODO remove! -#define B43_OFDMTAB_MINSIGSQ B43_OFDMTAB(0x14, 0) -#define B43_OFDMTAB_AGC3_R1 B43_OFDMTAB(0x15, 0) -#define B43_OFDMTAB_WRSSI_R1 B43_OFDMTAB(0x15, 4) -#define B43_OFDMTAB_TSSI B43_OFDMTAB(0x15, 0) -#define B43_OFDMTAB_DACRFPABB B43_OFDMTAB(0x16, 0) -#define B43_OFDMTAB_DACOFF B43_OFDMTAB(0x17, 0) -#define B43_OFDMTAB_DCBIAS B43_OFDMTAB(0x18, 0) - -u16 b43_ofdmtab_read16(struct b43_wldev *dev, u16 table, u16 offset); -void b43_ofdmtab_write16(struct b43_wldev *dev, u16 table, - u16 offset, u16 value); -u32 b43_ofdmtab_read32(struct b43_wldev *dev, u16 table, u16 offset); -void b43_ofdmtab_write32(struct b43_wldev *dev, u16 table, - u16 offset, u32 value); - - -struct b43_phy_a { - /* Pointer to the table used to convert a - * TSSI value to dBm-Q5.2 */ - const s8 *tssi2dbm; - /* Target idle TSSI */ - int tgt_idle_tssi; - /* Current idle TSSI */ - int cur_idle_tssi;//FIXME value currently not set - - /* A-PHY TX Power control value. */ - u16 txpwr_offset; - - //TODO lots of missing stuff -}; - -/** - * b43_phy_inita - Lowlevel A-PHY init routine. - * This is _only_ used by the G-PHY code. - */ -void b43_phy_inita(struct b43_wldev *dev); - - -struct b43_phy_operations; -extern const struct b43_phy_operations b43_phyops_a; - -#endif /* LINUX_B43_PHY_A_H_ */ diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c deleted file mode 100644 index f01676ac481b..000000000000 --- a/drivers/net/wireless/b43/phy_common.c +++ /dev/null @@ -1,543 +0,0 @@ -/* - - Broadcom B43 wireless driver - Common PHY routines - - Copyright (c) 2005 Martin Langer , - Copyright (c) 2005-2007 Stefano Brivio - Copyright (c) 2005-2008 Michael Buesch - Copyright (c) 2005, 2006 Danny van Dyk - Copyright (c) 2005, 2006 Andreas Jaggi - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "phy_common.h" -#include "phy_g.h" -#include "phy_a.h" -#include "phy_n.h" -#include "phy_lp.h" -#include "phy_ht.h" -#include "phy_lcn.h" -#include "b43.h" -#include "main.h" - - -int b43_phy_allocate(struct b43_wldev *dev) -{ - struct b43_phy *phy = &(dev->phy); - int err; - - phy->ops = NULL; - - switch (phy->type) { - case B43_PHYTYPE_A: - phy->ops = &b43_phyops_a; - break; - case B43_PHYTYPE_G: - phy->ops = &b43_phyops_g; - break; - case B43_PHYTYPE_N: -#ifdef CONFIG_B43_PHY_N - phy->ops = &b43_phyops_n; -#endif - break; - case B43_PHYTYPE_LP: -#ifdef CONFIG_B43_PHY_LP - phy->ops = &b43_phyops_lp; -#endif - break; - case B43_PHYTYPE_HT: -#ifdef CONFIG_B43_PHY_HT - phy->ops = &b43_phyops_ht; -#endif - break; - case B43_PHYTYPE_LCN: -#ifdef CONFIG_B43_PHY_LCN - phy->ops = &b43_phyops_lcn; -#endif - break; - } - if (B43_WARN_ON(!phy->ops)) - return -ENODEV; - - err = phy->ops->allocate(dev); - if (err) - phy->ops = NULL; - - return err; -} - -void b43_phy_free(struct b43_wldev *dev) -{ - dev->phy.ops->free(dev); - dev->phy.ops = NULL; -} - -int b43_phy_init(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - const struct b43_phy_operations *ops = phy->ops; - int err; - - phy->channel = ops->get_default_chan(dev); - - ops->software_rfkill(dev, false); - err = ops->init(dev); - if (err) { - b43err(dev->wl, "PHY init failed\n"); - goto err_block_rf; - } - /* Make sure to switch hardware and firmware (SHM) to - * the default channel. */ - err = b43_switch_channel(dev, ops->get_default_chan(dev)); - if (err) { - b43err(dev->wl, "PHY init: Channel switch to default failed\n"); - goto err_phy_exit; - } - - return 0; - -err_phy_exit: - if (ops->exit) - ops->exit(dev); -err_block_rf: - ops->software_rfkill(dev, true); - - return err; -} - -void b43_phy_exit(struct b43_wldev *dev) -{ - const struct b43_phy_operations *ops = dev->phy.ops; - - ops->software_rfkill(dev, true); - if (ops->exit) - ops->exit(dev); -} - -bool b43_has_hardware_pctl(struct b43_wldev *dev) -{ - if (!dev->phy.hardware_power_control) - return 0; - if (!dev->phy.ops->supports_hwpctl) - return 0; - return dev->phy.ops->supports_hwpctl(dev); -} - -void b43_radio_lock(struct b43_wldev *dev) -{ - u32 macctl; - -#if B43_DEBUG - B43_WARN_ON(dev->phy.radio_locked); - dev->phy.radio_locked = true; -#endif - - macctl = b43_read32(dev, B43_MMIO_MACCTL); - macctl |= B43_MACCTL_RADIOLOCK; - b43_write32(dev, B43_MMIO_MACCTL, macctl); - /* Commit the write and wait for the firmware - * to finish any radio register access. */ - b43_read32(dev, B43_MMIO_MACCTL); - udelay(10); -} - -void b43_radio_unlock(struct b43_wldev *dev) -{ - u32 macctl; - -#if B43_DEBUG - B43_WARN_ON(!dev->phy.radio_locked); - dev->phy.radio_locked = false; -#endif - - /* Commit any write */ - b43_read16(dev, B43_MMIO_PHY_VER); - /* unlock */ - macctl = b43_read32(dev, B43_MMIO_MACCTL); - macctl &= ~B43_MACCTL_RADIOLOCK; - b43_write32(dev, B43_MMIO_MACCTL, macctl); -} - -void b43_phy_lock(struct b43_wldev *dev) -{ -#if B43_DEBUG - B43_WARN_ON(dev->phy.phy_locked); - dev->phy.phy_locked = true; -#endif - B43_WARN_ON(dev->dev->core_rev < 3); - - if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP)) - b43_power_saving_ctl_bits(dev, B43_PS_AWAKE); -} - -void b43_phy_unlock(struct b43_wldev *dev) -{ -#if B43_DEBUG - B43_WARN_ON(!dev->phy.phy_locked); - dev->phy.phy_locked = false; -#endif - B43_WARN_ON(dev->dev->core_rev < 3); - - if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP)) - b43_power_saving_ctl_bits(dev, 0); -} - -static inline void assert_mac_suspended(struct b43_wldev *dev) -{ - if (!B43_DEBUG) - return; - if ((b43_status(dev) >= B43_STAT_INITIALIZED) && - (dev->mac_suspended <= 0)) { - b43dbg(dev->wl, "PHY/RADIO register access with " - "enabled MAC.\n"); - dump_stack(); - } -} - -u16 b43_radio_read(struct b43_wldev *dev, u16 reg) -{ - assert_mac_suspended(dev); - return dev->phy.ops->radio_read(dev, reg); -} - -void b43_radio_write(struct b43_wldev *dev, u16 reg, u16 value) -{ - assert_mac_suspended(dev); - dev->phy.ops->radio_write(dev, reg, value); -} - -void b43_radio_mask(struct b43_wldev *dev, u16 offset, u16 mask) -{ - b43_radio_write16(dev, offset, - b43_radio_read16(dev, offset) & mask); -} - -void b43_radio_set(struct b43_wldev *dev, u16 offset, u16 set) -{ - b43_radio_write16(dev, offset, - b43_radio_read16(dev, offset) | set); -} - -void b43_radio_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set) -{ - b43_radio_write16(dev, offset, - (b43_radio_read16(dev, offset) & mask) | set); -} - -bool b43_radio_wait_value(struct b43_wldev *dev, u16 offset, u16 mask, - u16 value, int delay, int timeout) -{ - u16 val; - int i; - - for (i = 0; i < timeout; i += delay) { - val = b43_radio_read(dev, offset); - if ((val & mask) == value) - return true; - udelay(delay); - } - return false; -} - -u16 b43_phy_read(struct b43_wldev *dev, u16 reg) -{ - assert_mac_suspended(dev); - dev->phy.writes_counter = 0; - return dev->phy.ops->phy_read(dev, reg); -} - -void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 value) -{ - assert_mac_suspended(dev); - dev->phy.ops->phy_write(dev, reg, value); - if (++dev->phy.writes_counter == B43_MAX_WRITES_IN_ROW) { - b43_read16(dev, B43_MMIO_PHY_VER); - dev->phy.writes_counter = 0; - } -} - -void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg) -{ - assert_mac_suspended(dev); - dev->phy.ops->phy_write(dev, destreg, - dev->phy.ops->phy_read(dev, srcreg)); -} - -void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask) -{ - if (dev->phy.ops->phy_maskset) { - assert_mac_suspended(dev); - dev->phy.ops->phy_maskset(dev, offset, mask, 0); - } else { - b43_phy_write(dev, offset, - b43_phy_read(dev, offset) & mask); - } -} - -void b43_phy_set(struct b43_wldev *dev, u16 offset, u16 set) -{ - if (dev->phy.ops->phy_maskset) { - assert_mac_suspended(dev); - dev->phy.ops->phy_maskset(dev, offset, 0xFFFF, set); - } else { - b43_phy_write(dev, offset, - b43_phy_read(dev, offset) | set); - } -} - -void b43_phy_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set) -{ - if (dev->phy.ops->phy_maskset) { - assert_mac_suspended(dev); - dev->phy.ops->phy_maskset(dev, offset, mask, set); - } else { - b43_phy_write(dev, offset, - (b43_phy_read(dev, offset) & mask) | set); - } -} - -int b43_switch_channel(struct b43_wldev *dev, unsigned int new_channel) -{ - struct b43_phy *phy = &(dev->phy); - u16 channelcookie, savedcookie; - int err; - - if (new_channel == B43_DEFAULT_CHANNEL) - new_channel = phy->ops->get_default_chan(dev); - - /* First we set the channel radio code to prevent the - * firmware from sending ghost packets. - */ - channelcookie = new_channel; - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) - channelcookie |= B43_SHM_SH_CHAN_5GHZ; - /* FIXME: set 40Mhz flag if required */ - if (0) - channelcookie |= B43_SHM_SH_CHAN_40MHZ; - savedcookie = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_CHAN); - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_CHAN, channelcookie); - - /* Now try to switch the PHY hardware channel. */ - err = phy->ops->switch_channel(dev, new_channel); - if (err) - goto err_restore_cookie; - - dev->phy.channel = new_channel; - /* Wait for the radio to tune to the channel and stabilize. */ - msleep(8); - - return 0; - -err_restore_cookie: - b43_shm_write16(dev, B43_SHM_SHARED, - B43_SHM_SH_CHAN, savedcookie); - - return err; -} - -void b43_software_rfkill(struct b43_wldev *dev, bool blocked) -{ - struct b43_phy *phy = &dev->phy; - - b43_mac_suspend(dev); - phy->ops->software_rfkill(dev, blocked); - phy->radio_on = !blocked; - b43_mac_enable(dev); -} - -/** - * b43_phy_txpower_adjust_work - TX power workqueue. - * - * Workqueue for updating the TX power parameters in hardware. - */ -void b43_phy_txpower_adjust_work(struct work_struct *work) -{ - struct b43_wl *wl = container_of(work, struct b43_wl, - txpower_adjust_work); - struct b43_wldev *dev; - - mutex_lock(&wl->mutex); - dev = wl->current_dev; - - if (likely(dev && (b43_status(dev) >= B43_STAT_STARTED))) - dev->phy.ops->adjust_txpower(dev); - - mutex_unlock(&wl->mutex); -} - -void b43_phy_txpower_check(struct b43_wldev *dev, unsigned int flags) -{ - struct b43_phy *phy = &dev->phy; - unsigned long now = jiffies; - enum b43_txpwr_result result; - - if (!(flags & B43_TXPWR_IGNORE_TIME)) { - /* Check if it's time for a TXpower check. */ - if (time_before(now, phy->next_txpwr_check_time)) - return; /* Not yet */ - } - /* The next check will be needed in two seconds, or later. */ - phy->next_txpwr_check_time = round_jiffies(now + (HZ * 2)); - - if ((dev->dev->board_vendor == SSB_BOARDVENDOR_BCM) && - (dev->dev->board_type == SSB_BOARD_BU4306)) - return; /* No software txpower adjustment needed */ - - result = phy->ops->recalc_txpower(dev, !!(flags & B43_TXPWR_IGNORE_TSSI)); - if (result == B43_TXPWR_RES_DONE) - return; /* We are done. */ - B43_WARN_ON(result != B43_TXPWR_RES_NEED_ADJUST); - B43_WARN_ON(phy->ops->adjust_txpower == NULL); - - /* We must adjust the transmission power in hardware. - * Schedule b43_phy_txpower_adjust_work(). */ - ieee80211_queue_work(dev->wl->hw, &dev->wl->txpower_adjust_work); -} - -int b43_phy_shm_tssi_read(struct b43_wldev *dev, u16 shm_offset) -{ - const bool is_ofdm = (shm_offset != B43_SHM_SH_TSSI_CCK); - unsigned int a, b, c, d; - unsigned int average; - u32 tmp; - - tmp = b43_shm_read32(dev, B43_SHM_SHARED, shm_offset); - a = tmp & 0xFF; - b = (tmp >> 8) & 0xFF; - c = (tmp >> 16) & 0xFF; - d = (tmp >> 24) & 0xFF; - if (a == 0 || a == B43_TSSI_MAX || - b == 0 || b == B43_TSSI_MAX || - c == 0 || c == B43_TSSI_MAX || - d == 0 || d == B43_TSSI_MAX) - return -ENOENT; - /* The values are OK. Clear them. */ - tmp = B43_TSSI_MAX | (B43_TSSI_MAX << 8) | - (B43_TSSI_MAX << 16) | (B43_TSSI_MAX << 24); - b43_shm_write32(dev, B43_SHM_SHARED, shm_offset, tmp); - - if (is_ofdm) { - a = (a + 32) & 0x3F; - b = (b + 32) & 0x3F; - c = (c + 32) & 0x3F; - d = (d + 32) & 0x3F; - } - - /* Get the average of the values with 0.5 added to each value. */ - average = (a + b + c + d + 2) / 4; - if (is_ofdm) { - /* Adjust for CCK-boost */ - if (b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_HOSTF1) - & B43_HF_CCKBOOST) - average = (average >= 13) ? (average - 13) : 0; - } - - return average; -} - -void b43_phyop_switch_analog_generic(struct b43_wldev *dev, bool on) -{ - b43_write16(dev, B43_MMIO_PHY0, on ? 0 : 0xF4); -} - - -bool b43_channel_type_is_40mhz(enum nl80211_channel_type channel_type) -{ - return (channel_type == NL80211_CHAN_HT40MINUS || - channel_type == NL80211_CHAN_HT40PLUS); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/BmacPhyClkFgc */ -void b43_phy_force_clock(struct b43_wldev *dev, bool force) -{ - u32 tmp; - - WARN_ON(dev->phy.type != B43_PHYTYPE_N && - dev->phy.type != B43_PHYTYPE_HT); - - switch (dev->dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - tmp = bcma_aread32(dev->dev->bdev, BCMA_IOCTL); - if (force) - tmp |= BCMA_IOCTL_FGC; - else - tmp &= ~BCMA_IOCTL_FGC; - bcma_awrite32(dev->dev->bdev, BCMA_IOCTL, tmp); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW); - if (force) - tmp |= SSB_TMSLOW_FGC; - else - tmp &= ~SSB_TMSLOW_FGC; - ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp); - break; -#endif - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/Cordic */ -struct b43_c32 b43_cordic(int theta) -{ - static const u32 arctg[] = { - 2949120, 1740967, 919879, 466945, 234379, 117304, - 58666, 29335, 14668, 7334, 3667, 1833, - 917, 458, 229, 115, 57, 29, - }; - u8 i; - s32 tmp; - s8 signx = 1; - u32 angle = 0; - struct b43_c32 ret = { .i = 39797, .q = 0, }; - - while (theta > (180 << 16)) - theta -= (360 << 16); - while (theta < -(180 << 16)) - theta += (360 << 16); - - if (theta > (90 << 16)) { - theta -= (180 << 16); - signx = -1; - } else if (theta < -(90 << 16)) { - theta += (180 << 16); - signx = -1; - } - - for (i = 0; i <= 17; i++) { - if (theta > angle) { - tmp = ret.i - (ret.q >> i); - ret.q += ret.i >> i; - ret.i = tmp; - angle += arctg[i]; - } else { - tmp = ret.i + (ret.q >> i); - ret.q -= ret.i >> i; - ret.i = tmp; - angle -= arctg[i]; - } - } - - ret.i *= signx; - ret.q *= signx; - - return ret; -} diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h deleted file mode 100644 index f1b999349876..000000000000 --- a/drivers/net/wireless/b43/phy_common.h +++ /dev/null @@ -1,457 +0,0 @@ -#ifndef LINUX_B43_PHY_COMMON_H_ -#define LINUX_B43_PHY_COMMON_H_ - -#include -#include - -struct b43_wldev; - -/* Complex number using 2 32-bit signed integers */ -struct b43_c32 { s32 i, q; }; - -#define CORDIC_CONVERT(value) (((value) >= 0) ? \ - ((((value) >> 15) + 1) >> 1) : \ - -((((-(value)) >> 15) + 1) >> 1)) - -/* PHY register routing bits */ -#define B43_PHYROUTE 0x0C00 /* PHY register routing bits mask */ -#define B43_PHYROUTE_BASE 0x0000 /* Base registers */ -#define B43_PHYROUTE_OFDM_GPHY 0x0400 /* OFDM register routing for G-PHYs */ -#define B43_PHYROUTE_EXT_GPHY 0x0800 /* Extended G-PHY registers */ -#define B43_PHYROUTE_N_BMODE 0x0C00 /* N-PHY BMODE registers */ - -/* CCK (B-PHY) registers. */ -#define B43_PHY_CCK(reg) ((reg) | B43_PHYROUTE_BASE) -/* N-PHY registers. */ -#define B43_PHY_N(reg) ((reg) | B43_PHYROUTE_BASE) -/* N-PHY BMODE registers. */ -#define B43_PHY_N_BMODE(reg) ((reg) | B43_PHYROUTE_N_BMODE) -/* OFDM (A-PHY) registers. */ -#define B43_PHY_OFDM(reg) ((reg) | B43_PHYROUTE_OFDM_GPHY) -/* Extended G-PHY registers. */ -#define B43_PHY_EXTG(reg) ((reg) | B43_PHYROUTE_EXT_GPHY) - - -/* Masks for the PHY versioning registers. */ -#define B43_PHYVER_ANALOG 0xF000 -#define B43_PHYVER_ANALOG_SHIFT 12 -#define B43_PHYVER_TYPE 0x0F00 -#define B43_PHYVER_TYPE_SHIFT 8 -#define B43_PHYVER_VERSION 0x00FF - -/* PHY writes need to be flushed if we reach limit */ -#define B43_MAX_WRITES_IN_ROW 24 - -/** - * enum b43_interference_mitigation - Interference Mitigation mode - * - * @B43_INTERFMODE_NONE: Disabled - * @B43_INTERFMODE_NONWLAN: Non-WLAN Interference Mitigation - * @B43_INTERFMODE_MANUALWLAN: WLAN Interference Mitigation - * @B43_INTERFMODE_AUTOWLAN: Automatic WLAN Interference Mitigation - */ -enum b43_interference_mitigation { - B43_INTERFMODE_NONE, - B43_INTERFMODE_NONWLAN, - B43_INTERFMODE_MANUALWLAN, - B43_INTERFMODE_AUTOWLAN, -}; - -/* Antenna identifiers */ -enum { - B43_ANTENNA0 = 0, /* Antenna 0 */ - B43_ANTENNA1 = 1, /* Antenna 1 */ - B43_ANTENNA_AUTO0 = 2, /* Automatic, starting with antenna 0 */ - B43_ANTENNA_AUTO1 = 3, /* Automatic, starting with antenna 1 */ - B43_ANTENNA2 = 4, - B43_ANTENNA3 = 8, - - B43_ANTENNA_AUTO = B43_ANTENNA_AUTO0, - B43_ANTENNA_DEFAULT = B43_ANTENNA_AUTO, -}; - -/** - * enum b43_txpwr_result - Return value for the recalc_txpower PHY op. - * - * @B43_TXPWR_RES_NEED_ADJUST: Values changed. Hardware adjustment is needed. - * @B43_TXPWR_RES_DONE: No more work to do. Everything is done. - */ -enum b43_txpwr_result { - B43_TXPWR_RES_NEED_ADJUST, - B43_TXPWR_RES_DONE, -}; - -/** - * struct b43_phy_operations - Function pointers for PHY ops. - * - * @allocate: Allocate and initialise the PHY data structures. - * Must not be NULL. - * @free: Destroy and free the PHY data structures. - * Must not be NULL. - * - * @prepare_structs: Prepare the PHY data structures. - * The data structures allocated in @allocate are - * initialized here. - * Must not be NULL. - * @prepare_hardware: Prepare the PHY. This is called before b43_chip_init to - * do some early early PHY hardware init. - * Can be NULL, if not required. - * @init: Initialize the PHY. - * Must not be NULL. - * @exit: Shutdown the PHY. - * Can be NULL, if not required. - * - * @phy_read: Read from a PHY register. - * Must not be NULL. - * @phy_write: Write to a PHY register. - * Must not be NULL. - * @phy_maskset: Maskset a PHY register, taking shortcuts. - * If it is NULL, a generic algorithm is used. - * @radio_read: Read from a Radio register. - * Must not be NULL. - * @radio_write: Write to a Radio register. - * Must not be NULL. - * - * @supports_hwpctl: Returns a boolean whether Hardware Power Control - * is supported or not. - * If NULL, hwpctl is assumed to be never supported. - * @software_rfkill: Turn the radio ON or OFF. - * Possible state values are - * RFKILL_STATE_SOFT_BLOCKED or - * RFKILL_STATE_UNBLOCKED - * Must not be NULL. - * @switch_analog: Turn the Analog on/off. - * Must not be NULL. - * @switch_channel: Switch the radio to another channel. - * Must not be NULL. - * @get_default_chan: Just returns the default channel number. - * Must not be NULL. - * @set_rx_antenna: Set the antenna used for RX. - * Can be NULL, if not supported. - * @interf_mitigation: Switch the Interference Mitigation mode. - * Can be NULL, if not supported. - * - * @recalc_txpower: Recalculate the transmission power parameters. - * This callback has to recalculate the TX power settings, - * but does not need to write them to the hardware, yet. - * Returns enum b43_txpwr_result to indicate whether the hardware - * needs to be adjusted. - * If B43_TXPWR_NEED_ADJUST is returned, @adjust_txpower - * will be called later. - * If the parameter "ignore_tssi" is true, the TSSI values should - * be ignored and a recalculation of the power settings should be - * done even if the TSSI values did not change. - * This function may sleep, but should not. - * Must not be NULL. - * @adjust_txpower: Write the previously calculated TX power settings - * (from @recalc_txpower) to the hardware. - * This function may sleep. - * Can be NULL, if (and ONLY if) @recalc_txpower _always_ - * returns B43_TXPWR_RES_DONE. - * - * @pwork_15sec: Periodic work. Called every 15 seconds. - * Can be NULL, if not required. - * @pwork_60sec: Periodic work. Called every 60 seconds. - * Can be NULL, if not required. - */ -struct b43_phy_operations { - /* Initialisation */ - int (*allocate)(struct b43_wldev *dev); - void (*free)(struct b43_wldev *dev); - void (*prepare_structs)(struct b43_wldev *dev); - int (*prepare_hardware)(struct b43_wldev *dev); - int (*init)(struct b43_wldev *dev); - void (*exit)(struct b43_wldev *dev); - - /* Register access */ - u16 (*phy_read)(struct b43_wldev *dev, u16 reg); - void (*phy_write)(struct b43_wldev *dev, u16 reg, u16 value); - void (*phy_maskset)(struct b43_wldev *dev, u16 reg, u16 mask, u16 set); - u16 (*radio_read)(struct b43_wldev *dev, u16 reg); - void (*radio_write)(struct b43_wldev *dev, u16 reg, u16 value); - - /* Radio */ - bool (*supports_hwpctl)(struct b43_wldev *dev); - void (*software_rfkill)(struct b43_wldev *dev, bool blocked); - void (*switch_analog)(struct b43_wldev *dev, bool on); - int (*switch_channel)(struct b43_wldev *dev, unsigned int new_channel); - unsigned int (*get_default_chan)(struct b43_wldev *dev); - void (*set_rx_antenna)(struct b43_wldev *dev, int antenna); - int (*interf_mitigation)(struct b43_wldev *dev, - enum b43_interference_mitigation new_mode); - - /* Transmission power adjustment */ - enum b43_txpwr_result (*recalc_txpower)(struct b43_wldev *dev, - bool ignore_tssi); - void (*adjust_txpower)(struct b43_wldev *dev); - - /* Misc */ - void (*pwork_15sec)(struct b43_wldev *dev); - void (*pwork_60sec)(struct b43_wldev *dev); -}; - -struct b43_phy_a; -struct b43_phy_g; -struct b43_phy_n; -struct b43_phy_lp; -struct b43_phy_ht; -struct b43_phy_lcn; - -struct b43_phy { - /* Hardware operation callbacks. */ - const struct b43_phy_operations *ops; - - /* Most hardware context information is stored in the standard- - * specific data structures pointed to by the pointers below. - * Only one of them is valid (the currently enabled PHY). */ -#ifdef CONFIG_B43_DEBUG - /* No union for debug build to force NULL derefs in buggy code. */ - struct { -#else - union { -#endif - /* A-PHY specific information */ - struct b43_phy_a *a; - /* G-PHY specific information */ - struct b43_phy_g *g; - /* N-PHY specific information */ - struct b43_phy_n *n; - /* LP-PHY specific information */ - struct b43_phy_lp *lp; - /* HT-PHY specific information */ - struct b43_phy_ht *ht; - /* LCN-PHY specific information */ - struct b43_phy_lcn *lcn; - }; - - /* Band support flags. */ - bool supports_2ghz; - bool supports_5ghz; - - /* HT info */ - bool is_40mhz; - - /* GMODE bit enabled? */ - bool gmode; - - /* Analog Type */ - u8 analog; - /* B43_PHYTYPE_ */ - u8 type; - /* PHY revision number. */ - u8 rev; - - /* Count writes since last read */ - u8 writes_counter; - - /* Radio versioning */ - u16 radio_manuf; /* Radio manufacturer */ - u16 radio_ver; /* Radio version */ - u8 radio_rev; /* Radio revision */ - - /* Software state of the radio */ - bool radio_on; - - /* Desired TX power level (in dBm). - * This is set by the user and adjusted in b43_phy_xmitpower(). */ - int desired_txpower; - - /* Hardware Power Control enabled? */ - bool hardware_power_control; - - /* The time (in absolute jiffies) when the next TX power output - * check is needed. */ - unsigned long next_txpwr_check_time; - - /* Current channel */ - unsigned int channel; - u16 channel_freq; - enum nl80211_channel_type channel_type; - - /* PHY TX errors counter. */ - atomic_t txerr_cnt; - -#ifdef CONFIG_B43_DEBUG - /* PHY registers locked (w.r.t. firmware) */ - bool phy_locked; - /* Radio registers locked (w.r.t. firmware) */ - bool radio_locked; -#endif /* B43_DEBUG */ -}; - - -/** - * b43_phy_allocate - Allocate PHY structs - * Allocate the PHY data structures, based on the current dev->phy.type - */ -int b43_phy_allocate(struct b43_wldev *dev); - -/** - * b43_phy_free - Free PHY structs - */ -void b43_phy_free(struct b43_wldev *dev); - -/** - * b43_phy_init - Initialise the PHY - */ -int b43_phy_init(struct b43_wldev *dev); - -/** - * b43_phy_exit - Cleanup PHY - */ -void b43_phy_exit(struct b43_wldev *dev); - -/** - * b43_has_hardware_pctl - Hardware Power Control supported? - * Returns a boolean, whether hardware power control is supported. - */ -bool b43_has_hardware_pctl(struct b43_wldev *dev); - -/** - * b43_phy_read - 16bit PHY register read access - */ -u16 b43_phy_read(struct b43_wldev *dev, u16 reg); - -/** - * b43_phy_write - 16bit PHY register write access - */ -void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 value); - -/** - * b43_phy_copy - copy contents of 16bit PHY register to another - */ -void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg); - -/** - * b43_phy_mask - Mask a PHY register with a mask - */ -void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask); - -/** - * b43_phy_set - OR a PHY register with a bitmap - */ -void b43_phy_set(struct b43_wldev *dev, u16 offset, u16 set); - -/** - * b43_phy_maskset - Mask and OR a PHY register with a mask and bitmap - */ -void b43_phy_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set); - -/** - * b43_radio_read - 16bit Radio register read access - */ -u16 b43_radio_read(struct b43_wldev *dev, u16 reg); -#define b43_radio_read16 b43_radio_read /* DEPRECATED */ - -/** - * b43_radio_write - 16bit Radio register write access - */ -void b43_radio_write(struct b43_wldev *dev, u16 reg, u16 value); -#define b43_radio_write16 b43_radio_write /* DEPRECATED */ - -/** - * b43_radio_mask - Mask a 16bit radio register with a mask - */ -void b43_radio_mask(struct b43_wldev *dev, u16 offset, u16 mask); - -/** - * b43_radio_set - OR a 16bit radio register with a bitmap - */ -void b43_radio_set(struct b43_wldev *dev, u16 offset, u16 set); - -/** - * b43_radio_maskset - Mask and OR a radio register with a mask and bitmap - */ -void b43_radio_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set); - -/** - * b43_radio_wait_value - Waits for a given value in masked register read - */ -bool b43_radio_wait_value(struct b43_wldev *dev, u16 offset, u16 mask, - u16 value, int delay, int timeout); - -/** - * b43_radio_lock - Lock firmware radio register access - */ -void b43_radio_lock(struct b43_wldev *dev); - -/** - * b43_radio_unlock - Unlock firmware radio register access - */ -void b43_radio_unlock(struct b43_wldev *dev); - -/** - * b43_phy_lock - Lock firmware PHY register access - */ -void b43_phy_lock(struct b43_wldev *dev); - -/** - * b43_phy_unlock - Unlock firmware PHY register access - */ -void b43_phy_unlock(struct b43_wldev *dev); - -/** - * b43_switch_channel - Switch to another channel - */ -int b43_switch_channel(struct b43_wldev *dev, unsigned int new_channel); -/** - * B43_DEFAULT_CHANNEL - Switch to the default channel. - */ -#define B43_DEFAULT_CHANNEL UINT_MAX - -/** - * b43_software_rfkill - Turn the radio ON or OFF in software. - */ -void b43_software_rfkill(struct b43_wldev *dev, bool blocked); - -/** - * b43_phy_txpower_check - Check TX power output. - * - * Compare the current TX power output to the desired power emission - * and schedule an adjustment in case it mismatches. - * - * @flags: OR'ed enum b43_phy_txpower_check_flags flags. - * See the docs below. - */ -void b43_phy_txpower_check(struct b43_wldev *dev, unsigned int flags); -/** - * enum b43_phy_txpower_check_flags - Flags for b43_phy_txpower_check() - * - * @B43_TXPWR_IGNORE_TIME: Ignore the schedule time and force-redo - * the check now. - * @B43_TXPWR_IGNORE_TSSI: Redo the recalculation, even if the average - * TSSI did not change. - */ -enum b43_phy_txpower_check_flags { - B43_TXPWR_IGNORE_TIME = (1 << 0), - B43_TXPWR_IGNORE_TSSI = (1 << 1), -}; - -struct work_struct; -void b43_phy_txpower_adjust_work(struct work_struct *work); - -/** - * b43_phy_shm_tssi_read - Read the average of the last 4 TSSI from SHM. - * - * @shm_offset: The SHM address to read the values from. - * - * Returns the average of the 4 TSSI values, or a negative error code. - */ -int b43_phy_shm_tssi_read(struct b43_wldev *dev, u16 shm_offset); - -/** - * b43_phy_switch_analog_generic - Generic PHY operation for switching the Analog. - * - * It does the switching based on the PHY0 core register. - * Do _not_ call this directly. Only use it as a switch_analog callback - * for struct b43_phy_operations. - */ -void b43_phyop_switch_analog_generic(struct b43_wldev *dev, bool on); - -bool b43_channel_type_is_40mhz(enum nl80211_channel_type channel_type); - -void b43_phy_force_clock(struct b43_wldev *dev, bool force); - -struct b43_c32 b43_cordic(int theta); - -#endif /* LINUX_B43_PHY_COMMON_H_ */ diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c deleted file mode 100644 index 12f467b8d564..000000000000 --- a/drivers/net/wireless/b43/phy_g.c +++ /dev/null @@ -1,3055 +0,0 @@ -/* - - Broadcom B43 wireless driver - IEEE 802.11g PHY driver - - Copyright (c) 2005 Martin Langer , - Copyright (c) 2005-2007 Stefano Brivio - Copyright (c) 2005-2008 Michael Buesch - Copyright (c) 2005, 2006 Danny van Dyk - Copyright (c) 2005, 2006 Andreas Jaggi - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "phy_g.h" -#include "phy_common.h" -#include "lo.h" -#include "main.h" - -#include -#include - - -static const s8 b43_tssi2dbm_g_table[] = { - 77, 77, 77, 76, - 76, 76, 75, 75, - 74, 74, 73, 73, - 73, 72, 72, 71, - 71, 70, 70, 69, - 68, 68, 67, 67, - 66, 65, 65, 64, - 63, 63, 62, 61, - 60, 59, 58, 57, - 56, 55, 54, 53, - 52, 50, 49, 47, - 45, 43, 40, 37, - 33, 28, 22, 14, - 5, -7, -20, -20, - -20, -20, -20, -20, - -20, -20, -20, -20, -}; - -static const u8 b43_radio_channel_codes_bg[] = { - 12, 17, 22, 27, - 32, 37, 42, 47, - 52, 57, 62, 67, - 72, 84, -}; - - -static void b43_calc_nrssi_threshold(struct b43_wldev *dev); - - -#define bitrev4(tmp) (bitrev8(tmp) >> 4) - - -/* Get the freq, as it has to be written to the device. */ -static inline u16 channel2freq_bg(u8 channel) -{ - B43_WARN_ON(!(channel >= 1 && channel <= 14)); - - return b43_radio_channel_codes_bg[channel - 1]; -} - -static void generate_rfatt_list(struct b43_wldev *dev, - struct b43_rfatt_list *list) -{ - struct b43_phy *phy = &dev->phy; - - /* APHY.rev < 5 || GPHY.rev < 6 */ - static const struct b43_rfatt rfatt_0[] = { - {.att = 3,.with_padmix = 0,}, - {.att = 1,.with_padmix = 0,}, - {.att = 5,.with_padmix = 0,}, - {.att = 7,.with_padmix = 0,}, - {.att = 9,.with_padmix = 0,}, - {.att = 2,.with_padmix = 0,}, - {.att = 0,.with_padmix = 0,}, - {.att = 4,.with_padmix = 0,}, - {.att = 6,.with_padmix = 0,}, - {.att = 8,.with_padmix = 0,}, - {.att = 1,.with_padmix = 1,}, - {.att = 2,.with_padmix = 1,}, - {.att = 3,.with_padmix = 1,}, - {.att = 4,.with_padmix = 1,}, - }; - /* Radio.rev == 8 && Radio.version == 0x2050 */ - static const struct b43_rfatt rfatt_1[] = { - {.att = 2,.with_padmix = 1,}, - {.att = 4,.with_padmix = 1,}, - {.att = 6,.with_padmix = 1,}, - {.att = 8,.with_padmix = 1,}, - {.att = 10,.with_padmix = 1,}, - {.att = 12,.with_padmix = 1,}, - {.att = 14,.with_padmix = 1,}, - }; - /* Otherwise */ - static const struct b43_rfatt rfatt_2[] = { - {.att = 0,.with_padmix = 1,}, - {.att = 2,.with_padmix = 1,}, - {.att = 4,.with_padmix = 1,}, - {.att = 6,.with_padmix = 1,}, - {.att = 8,.with_padmix = 1,}, - {.att = 9,.with_padmix = 1,}, - {.att = 9,.with_padmix = 1,}, - }; - - if (!b43_has_hardware_pctl(dev)) { - /* Software pctl */ - list->list = rfatt_0; - list->len = ARRAY_SIZE(rfatt_0); - list->min_val = 0; - list->max_val = 9; - return; - } - if (phy->radio_ver == 0x2050 && phy->radio_rev == 8) { - /* Hardware pctl */ - list->list = rfatt_1; - list->len = ARRAY_SIZE(rfatt_1); - list->min_val = 0; - list->max_val = 14; - return; - } - /* Hardware pctl */ - list->list = rfatt_2; - list->len = ARRAY_SIZE(rfatt_2); - list->min_val = 0; - list->max_val = 9; -} - -static void generate_bbatt_list(struct b43_wldev *dev, - struct b43_bbatt_list *list) -{ - static const struct b43_bbatt bbatt_0[] = { - {.att = 0,}, - {.att = 1,}, - {.att = 2,}, - {.att = 3,}, - {.att = 4,}, - {.att = 5,}, - {.att = 6,}, - {.att = 7,}, - {.att = 8,}, - }; - - list->list = bbatt_0; - list->len = ARRAY_SIZE(bbatt_0); - list->min_val = 0; - list->max_val = 8; -} - -static void b43_shm_clear_tssi(struct b43_wldev *dev) -{ - b43_shm_write16(dev, B43_SHM_SHARED, 0x0058, 0x7F7F); - b43_shm_write16(dev, B43_SHM_SHARED, 0x005a, 0x7F7F); - b43_shm_write16(dev, B43_SHM_SHARED, 0x0070, 0x7F7F); - b43_shm_write16(dev, B43_SHM_SHARED, 0x0072, 0x7F7F); -} - -/* Synthetic PU workaround */ -static void b43_synth_pu_workaround(struct b43_wldev *dev, u8 channel) -{ - struct b43_phy *phy = &dev->phy; - - might_sleep(); - - if (phy->radio_ver != 0x2050 || phy->radio_rev >= 6) { - /* We do not need the workaround. */ - return; - } - - if (channel <= 10) { - b43_write16(dev, B43_MMIO_CHANNEL, - channel2freq_bg(channel + 4)); - } else { - b43_write16(dev, B43_MMIO_CHANNEL, channel2freq_bg(1)); - } - msleep(1); - b43_write16(dev, B43_MMIO_CHANNEL, channel2freq_bg(channel)); -} - -/* Set the baseband attenuation value on chip. */ -void b43_gphy_set_baseband_attenuation(struct b43_wldev *dev, - u16 baseband_attenuation) -{ - struct b43_phy *phy = &dev->phy; - - if (phy->analog == 0) { - b43_write16(dev, B43_MMIO_PHY0, (b43_read16(dev, B43_MMIO_PHY0) - & 0xFFF0) | - baseband_attenuation); - } else if (phy->analog > 1) { - b43_phy_maskset(dev, B43_PHY_DACCTL, 0xFFC3, (baseband_attenuation << 2)); - } else { - b43_phy_maskset(dev, B43_PHY_DACCTL, 0xFF87, (baseband_attenuation << 3)); - } -} - -/* Adjust the transmission power output (G-PHY) */ -static void b43_set_txpower_g(struct b43_wldev *dev, - const struct b43_bbatt *bbatt, - const struct b43_rfatt *rfatt, u8 tx_control) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - struct b43_txpower_lo_control *lo = gphy->lo_control; - u16 bb, rf; - u16 tx_bias, tx_magn; - - bb = bbatt->att; - rf = rfatt->att; - tx_bias = lo->tx_bias; - tx_magn = lo->tx_magn; - if (unlikely(tx_bias == 0xFF)) - tx_bias = 0; - - /* Save the values for later. Use memmove, because it's valid - * to pass &gphy->rfatt as rfatt pointer argument. Same for bbatt. */ - gphy->tx_control = tx_control; - memmove(&gphy->rfatt, rfatt, sizeof(*rfatt)); - gphy->rfatt.with_padmix = !!(tx_control & B43_TXCTL_TXMIX); - memmove(&gphy->bbatt, bbatt, sizeof(*bbatt)); - - if (b43_debug(dev, B43_DBG_XMITPOWER)) { - b43dbg(dev->wl, "Tuning TX-power to bbatt(%u), " - "rfatt(%u), tx_control(0x%02X), " - "tx_bias(0x%02X), tx_magn(0x%02X)\n", - bb, rf, tx_control, tx_bias, tx_magn); - } - - b43_gphy_set_baseband_attenuation(dev, bb); - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_RFATT, rf); - if (phy->radio_ver == 0x2050 && phy->radio_rev == 8) { - b43_radio_write16(dev, 0x43, - (rf & 0x000F) | (tx_control & 0x0070)); - } else { - b43_radio_maskset(dev, 0x43, 0xFFF0, (rf & 0x000F)); - b43_radio_maskset(dev, 0x52, ~0x0070, (tx_control & 0x0070)); - } - if (has_tx_magnification(phy)) { - b43_radio_write16(dev, 0x52, tx_magn | tx_bias); - } else { - b43_radio_maskset(dev, 0x52, 0xFFF0, (tx_bias & 0x000F)); - } - b43_lo_g_adjust(dev); -} - -/* GPHY_TSSI_Power_Lookup_Table_Init */ -static void b43_gphy_tssi_power_lt_init(struct b43_wldev *dev) -{ - struct b43_phy_g *gphy = dev->phy.g; - int i; - u16 value; - - for (i = 0; i < 32; i++) - b43_ofdmtab_write16(dev, 0x3C20, i, gphy->tssi2dbm[i]); - for (i = 32; i < 64; i++) - b43_ofdmtab_write16(dev, 0x3C00, i - 32, gphy->tssi2dbm[i]); - for (i = 0; i < 64; i += 2) { - value = (u16) gphy->tssi2dbm[i]; - value |= ((u16) gphy->tssi2dbm[i + 1]) << 8; - b43_phy_write(dev, 0x380 + (i / 2), value); - } -} - -/* GPHY_Gain_Lookup_Table_Init */ -static void b43_gphy_gain_lt_init(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - struct b43_txpower_lo_control *lo = gphy->lo_control; - u16 nr_written = 0; - u16 tmp; - u8 rf, bb; - - for (rf = 0; rf < lo->rfatt_list.len; rf++) { - for (bb = 0; bb < lo->bbatt_list.len; bb++) { - if (nr_written >= 0x40) - return; - tmp = lo->bbatt_list.list[bb].att; - tmp <<= 8; - if (phy->radio_rev == 8) - tmp |= 0x50; - else - tmp |= 0x40; - tmp |= lo->rfatt_list.list[rf].att; - b43_phy_write(dev, 0x3C0 + nr_written, tmp); - nr_written++; - } - } -} - -static void b43_set_all_gains(struct b43_wldev *dev, - s16 first, s16 second, s16 third) -{ - struct b43_phy *phy = &dev->phy; - u16 i; - u16 start = 0x08, end = 0x18; - u16 tmp; - u16 table; - - if (phy->rev <= 1) { - start = 0x10; - end = 0x20; - } - - table = B43_OFDMTAB_GAINX; - if (phy->rev <= 1) - table = B43_OFDMTAB_GAINX_R1; - for (i = 0; i < 4; i++) - b43_ofdmtab_write16(dev, table, i, first); - - for (i = start; i < end; i++) - b43_ofdmtab_write16(dev, table, i, second); - - if (third != -1) { - tmp = ((u16) third << 14) | ((u16) third << 6); - b43_phy_maskset(dev, 0x04A0, 0xBFBF, tmp); - b43_phy_maskset(dev, 0x04A1, 0xBFBF, tmp); - b43_phy_maskset(dev, 0x04A2, 0xBFBF, tmp); - } - b43_dummy_transmission(dev, false, true); -} - -static void b43_set_original_gains(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - u16 i, tmp; - u16 table; - u16 start = 0x0008, end = 0x0018; - - if (phy->rev <= 1) { - start = 0x0010; - end = 0x0020; - } - - table = B43_OFDMTAB_GAINX; - if (phy->rev <= 1) - table = B43_OFDMTAB_GAINX_R1; - for (i = 0; i < 4; i++) { - tmp = (i & 0xFFFC); - tmp |= (i & 0x0001) << 1; - tmp |= (i & 0x0002) >> 1; - - b43_ofdmtab_write16(dev, table, i, tmp); - } - - for (i = start; i < end; i++) - b43_ofdmtab_write16(dev, table, i, i - start); - - b43_phy_maskset(dev, 0x04A0, 0xBFBF, 0x4040); - b43_phy_maskset(dev, 0x04A1, 0xBFBF, 0x4040); - b43_phy_maskset(dev, 0x04A2, 0xBFBF, 0x4000); - b43_dummy_transmission(dev, false, true); -} - -/* http://bcm-specs.sipsolutions.net/NRSSILookupTable */ -static void b43_nrssi_hw_write(struct b43_wldev *dev, u16 offset, s16 val) -{ - b43_phy_write(dev, B43_PHY_NRSSILT_CTRL, offset); - b43_phy_write(dev, B43_PHY_NRSSILT_DATA, (u16) val); -} - -/* http://bcm-specs.sipsolutions.net/NRSSILookupTable */ -static s16 b43_nrssi_hw_read(struct b43_wldev *dev, u16 offset) -{ - u16 val; - - b43_phy_write(dev, B43_PHY_NRSSILT_CTRL, offset); - val = b43_phy_read(dev, B43_PHY_NRSSILT_DATA); - - return (s16) val; -} - -/* http://bcm-specs.sipsolutions.net/NRSSILookupTable */ -static void b43_nrssi_hw_update(struct b43_wldev *dev, u16 val) -{ - u16 i; - s16 tmp; - - for (i = 0; i < 64; i++) { - tmp = b43_nrssi_hw_read(dev, i); - tmp -= val; - tmp = clamp_val(tmp, -32, 31); - b43_nrssi_hw_write(dev, i, tmp); - } -} - -/* http://bcm-specs.sipsolutions.net/NRSSILookupTable */ -static void b43_nrssi_mem_update(struct b43_wldev *dev) -{ - struct b43_phy_g *gphy = dev->phy.g; - s16 i, delta; - s32 tmp; - - delta = 0x1F - gphy->nrssi[0]; - for (i = 0; i < 64; i++) { - tmp = (i - delta) * gphy->nrssislope; - tmp /= 0x10000; - tmp += 0x3A; - tmp = clamp_val(tmp, 0, 0x3F); - gphy->nrssi_lt[i] = tmp; - } -} - -static void b43_calc_nrssi_offset(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - u16 backup[20] = { 0 }; - s16 v47F; - u16 i; - u16 saved = 0xFFFF; - - backup[0] = b43_phy_read(dev, 0x0001); - backup[1] = b43_phy_read(dev, 0x0811); - backup[2] = b43_phy_read(dev, 0x0812); - if (phy->rev != 1) { /* Not in specs, but needed to prevent PPC machine check */ - backup[3] = b43_phy_read(dev, 0x0814); - backup[4] = b43_phy_read(dev, 0x0815); - } - backup[5] = b43_phy_read(dev, 0x005A); - backup[6] = b43_phy_read(dev, 0x0059); - backup[7] = b43_phy_read(dev, 0x0058); - backup[8] = b43_phy_read(dev, 0x000A); - backup[9] = b43_phy_read(dev, 0x0003); - backup[10] = b43_radio_read16(dev, 0x007A); - backup[11] = b43_radio_read16(dev, 0x0043); - - b43_phy_mask(dev, 0x0429, 0x7FFF); - b43_phy_maskset(dev, 0x0001, 0x3FFF, 0x4000); - b43_phy_set(dev, 0x0811, 0x000C); - b43_phy_maskset(dev, 0x0812, 0xFFF3, 0x0004); - b43_phy_mask(dev, 0x0802, ~(0x1 | 0x2)); - if (phy->rev >= 6) { - backup[12] = b43_phy_read(dev, 0x002E); - backup[13] = b43_phy_read(dev, 0x002F); - backup[14] = b43_phy_read(dev, 0x080F); - backup[15] = b43_phy_read(dev, 0x0810); - backup[16] = b43_phy_read(dev, 0x0801); - backup[17] = b43_phy_read(dev, 0x0060); - backup[18] = b43_phy_read(dev, 0x0014); - backup[19] = b43_phy_read(dev, 0x0478); - - b43_phy_write(dev, 0x002E, 0); - b43_phy_write(dev, 0x002F, 0); - b43_phy_write(dev, 0x080F, 0); - b43_phy_write(dev, 0x0810, 0); - b43_phy_set(dev, 0x0478, 0x0100); - b43_phy_set(dev, 0x0801, 0x0040); - b43_phy_set(dev, 0x0060, 0x0040); - b43_phy_set(dev, 0x0014, 0x0200); - } - b43_radio_set(dev, 0x007A, 0x0070); - b43_radio_set(dev, 0x007A, 0x0080); - udelay(30); - - v47F = (s16) ((b43_phy_read(dev, 0x047F) >> 8) & 0x003F); - if (v47F >= 0x20) - v47F -= 0x40; - if (v47F == 31) { - for (i = 7; i >= 4; i--) { - b43_radio_write16(dev, 0x007B, i); - udelay(20); - v47F = - (s16) ((b43_phy_read(dev, 0x047F) >> 8) & 0x003F); - if (v47F >= 0x20) - v47F -= 0x40; - if (v47F < 31 && saved == 0xFFFF) - saved = i; - } - if (saved == 0xFFFF) - saved = 4; - } else { - b43_radio_mask(dev, 0x007A, 0x007F); - if (phy->rev != 1) { /* Not in specs, but needed to prevent PPC machine check */ - b43_phy_set(dev, 0x0814, 0x0001); - b43_phy_mask(dev, 0x0815, 0xFFFE); - } - b43_phy_set(dev, 0x0811, 0x000C); - b43_phy_set(dev, 0x0812, 0x000C); - b43_phy_set(dev, 0x0811, 0x0030); - b43_phy_set(dev, 0x0812, 0x0030); - b43_phy_write(dev, 0x005A, 0x0480); - b43_phy_write(dev, 0x0059, 0x0810); - b43_phy_write(dev, 0x0058, 0x000D); - if (phy->rev == 0) { - b43_phy_write(dev, 0x0003, 0x0122); - } else { - b43_phy_set(dev, 0x000A, 0x2000); - } - if (phy->rev != 1) { /* Not in specs, but needed to prevent PPC machine check */ - b43_phy_set(dev, 0x0814, 0x0004); - b43_phy_mask(dev, 0x0815, 0xFFFB); - } - b43_phy_maskset(dev, 0x0003, 0xFF9F, 0x0040); - b43_radio_set(dev, 0x007A, 0x000F); - b43_set_all_gains(dev, 3, 0, 1); - b43_radio_maskset(dev, 0x0043, 0x00F0, 0x000F); - udelay(30); - v47F = (s16) ((b43_phy_read(dev, 0x047F) >> 8) & 0x003F); - if (v47F >= 0x20) - v47F -= 0x40; - if (v47F == -32) { - for (i = 0; i < 4; i++) { - b43_radio_write16(dev, 0x007B, i); - udelay(20); - v47F = - (s16) ((b43_phy_read(dev, 0x047F) >> 8) & - 0x003F); - if (v47F >= 0x20) - v47F -= 0x40; - if (v47F > -31 && saved == 0xFFFF) - saved = i; - } - if (saved == 0xFFFF) - saved = 3; - } else - saved = 0; - } - b43_radio_write16(dev, 0x007B, saved); - - if (phy->rev >= 6) { - b43_phy_write(dev, 0x002E, backup[12]); - b43_phy_write(dev, 0x002F, backup[13]); - b43_phy_write(dev, 0x080F, backup[14]); - b43_phy_write(dev, 0x0810, backup[15]); - } - if (phy->rev != 1) { /* Not in specs, but needed to prevent PPC machine check */ - b43_phy_write(dev, 0x0814, backup[3]); - b43_phy_write(dev, 0x0815, backup[4]); - } - b43_phy_write(dev, 0x005A, backup[5]); - b43_phy_write(dev, 0x0059, backup[6]); - b43_phy_write(dev, 0x0058, backup[7]); - b43_phy_write(dev, 0x000A, backup[8]); - b43_phy_write(dev, 0x0003, backup[9]); - b43_radio_write16(dev, 0x0043, backup[11]); - b43_radio_write16(dev, 0x007A, backup[10]); - b43_phy_write(dev, 0x0802, b43_phy_read(dev, 0x0802) | 0x1 | 0x2); - b43_phy_set(dev, 0x0429, 0x8000); - b43_set_original_gains(dev); - if (phy->rev >= 6) { - b43_phy_write(dev, 0x0801, backup[16]); - b43_phy_write(dev, 0x0060, backup[17]); - b43_phy_write(dev, 0x0014, backup[18]); - b43_phy_write(dev, 0x0478, backup[19]); - } - b43_phy_write(dev, 0x0001, backup[0]); - b43_phy_write(dev, 0x0812, backup[2]); - b43_phy_write(dev, 0x0811, backup[1]); -} - -static void b43_calc_nrssi_slope(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - u16 backup[18] = { 0 }; - u16 tmp; - s16 nrssi0, nrssi1; - - B43_WARN_ON(phy->type != B43_PHYTYPE_G); - - if (phy->radio_rev >= 9) - return; - if (phy->radio_rev == 8) - b43_calc_nrssi_offset(dev); - - b43_phy_mask(dev, B43_PHY_G_CRS, 0x7FFF); - b43_phy_mask(dev, 0x0802, 0xFFFC); - backup[7] = b43_read16(dev, 0x03E2); - b43_write16(dev, 0x03E2, b43_read16(dev, 0x03E2) | 0x8000); - backup[0] = b43_radio_read16(dev, 0x007A); - backup[1] = b43_radio_read16(dev, 0x0052); - backup[2] = b43_radio_read16(dev, 0x0043); - backup[3] = b43_phy_read(dev, 0x0015); - backup[4] = b43_phy_read(dev, 0x005A); - backup[5] = b43_phy_read(dev, 0x0059); - backup[6] = b43_phy_read(dev, 0x0058); - backup[8] = b43_read16(dev, 0x03E6); - backup[9] = b43_read16(dev, B43_MMIO_CHANNEL_EXT); - if (phy->rev >= 3) { - backup[10] = b43_phy_read(dev, 0x002E); - backup[11] = b43_phy_read(dev, 0x002F); - backup[12] = b43_phy_read(dev, 0x080F); - backup[13] = b43_phy_read(dev, B43_PHY_G_LO_CONTROL); - backup[14] = b43_phy_read(dev, 0x0801); - backup[15] = b43_phy_read(dev, 0x0060); - backup[16] = b43_phy_read(dev, 0x0014); - backup[17] = b43_phy_read(dev, 0x0478); - b43_phy_write(dev, 0x002E, 0); - b43_phy_write(dev, B43_PHY_G_LO_CONTROL, 0); - switch (phy->rev) { - case 4: - case 6: - case 7: - b43_phy_set(dev, 0x0478, 0x0100); - b43_phy_set(dev, 0x0801, 0x0040); - break; - case 3: - case 5: - b43_phy_mask(dev, 0x0801, 0xFFBF); - break; - } - b43_phy_set(dev, 0x0060, 0x0040); - b43_phy_set(dev, 0x0014, 0x0200); - } - b43_radio_set(dev, 0x007A, 0x0070); - b43_set_all_gains(dev, 0, 8, 0); - b43_radio_mask(dev, 0x007A, 0x00F7); - if (phy->rev >= 2) { - b43_phy_maskset(dev, 0x0811, 0xFFCF, 0x0030); - b43_phy_maskset(dev, 0x0812, 0xFFCF, 0x0010); - } - b43_radio_set(dev, 0x007A, 0x0080); - udelay(20); - - nrssi0 = (s16) ((b43_phy_read(dev, 0x047F) >> 8) & 0x003F); - if (nrssi0 >= 0x0020) - nrssi0 -= 0x0040; - - b43_radio_mask(dev, 0x007A, 0x007F); - if (phy->rev >= 2) { - b43_phy_maskset(dev, 0x0003, 0xFF9F, 0x0040); - } - - b43_write16(dev, B43_MMIO_CHANNEL_EXT, - b43_read16(dev, B43_MMIO_CHANNEL_EXT) - | 0x2000); - b43_radio_set(dev, 0x007A, 0x000F); - b43_phy_write(dev, 0x0015, 0xF330); - if (phy->rev >= 2) { - b43_phy_maskset(dev, 0x0812, 0xFFCF, 0x0020); - b43_phy_maskset(dev, 0x0811, 0xFFCF, 0x0020); - } - - b43_set_all_gains(dev, 3, 0, 1); - if (phy->radio_rev == 8) { - b43_radio_write16(dev, 0x0043, 0x001F); - } else { - tmp = b43_radio_read16(dev, 0x0052) & 0xFF0F; - b43_radio_write16(dev, 0x0052, tmp | 0x0060); - tmp = b43_radio_read16(dev, 0x0043) & 0xFFF0; - b43_radio_write16(dev, 0x0043, tmp | 0x0009); - } - b43_phy_write(dev, 0x005A, 0x0480); - b43_phy_write(dev, 0x0059, 0x0810); - b43_phy_write(dev, 0x0058, 0x000D); - udelay(20); - nrssi1 = (s16) ((b43_phy_read(dev, 0x047F) >> 8) & 0x003F); - if (nrssi1 >= 0x0020) - nrssi1 -= 0x0040; - if (nrssi0 == nrssi1) - gphy->nrssislope = 0x00010000; - else - gphy->nrssislope = 0x00400000 / (nrssi0 - nrssi1); - if (nrssi0 >= -4) { - gphy->nrssi[0] = nrssi1; - gphy->nrssi[1] = nrssi0; - } - if (phy->rev >= 3) { - b43_phy_write(dev, 0x002E, backup[10]); - b43_phy_write(dev, 0x002F, backup[11]); - b43_phy_write(dev, 0x080F, backup[12]); - b43_phy_write(dev, B43_PHY_G_LO_CONTROL, backup[13]); - } - if (phy->rev >= 2) { - b43_phy_mask(dev, 0x0812, 0xFFCF); - b43_phy_mask(dev, 0x0811, 0xFFCF); - } - - b43_radio_write16(dev, 0x007A, backup[0]); - b43_radio_write16(dev, 0x0052, backup[1]); - b43_radio_write16(dev, 0x0043, backup[2]); - b43_write16(dev, 0x03E2, backup[7]); - b43_write16(dev, 0x03E6, backup[8]); - b43_write16(dev, B43_MMIO_CHANNEL_EXT, backup[9]); - b43_phy_write(dev, 0x0015, backup[3]); - b43_phy_write(dev, 0x005A, backup[4]); - b43_phy_write(dev, 0x0059, backup[5]); - b43_phy_write(dev, 0x0058, backup[6]); - b43_synth_pu_workaround(dev, phy->channel); - b43_phy_set(dev, 0x0802, (0x0001 | 0x0002)); - b43_set_original_gains(dev); - b43_phy_set(dev, B43_PHY_G_CRS, 0x8000); - if (phy->rev >= 3) { - b43_phy_write(dev, 0x0801, backup[14]); - b43_phy_write(dev, 0x0060, backup[15]); - b43_phy_write(dev, 0x0014, backup[16]); - b43_phy_write(dev, 0x0478, backup[17]); - } - b43_nrssi_mem_update(dev); - b43_calc_nrssi_threshold(dev); -} - -static void b43_calc_nrssi_threshold(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - s32 a, b; - s16 tmp16; - u16 tmp_u16; - - B43_WARN_ON(phy->type != B43_PHYTYPE_G); - - if (!phy->gmode || - !(dev->dev->bus_sprom->boardflags_lo & B43_BFL_RSSI)) { - tmp16 = b43_nrssi_hw_read(dev, 0x20); - if (tmp16 >= 0x20) - tmp16 -= 0x40; - if (tmp16 < 3) { - b43_phy_maskset(dev, 0x048A, 0xF000, 0x09EB); - } else { - b43_phy_maskset(dev, 0x048A, 0xF000, 0x0AED); - } - } else { - if (gphy->interfmode == B43_INTERFMODE_NONWLAN) { - a = 0xE; - b = 0xA; - } else if (!gphy->aci_wlan_automatic && gphy->aci_enable) { - a = 0x13; - b = 0x12; - } else { - a = 0xE; - b = 0x11; - } - - a = a * (gphy->nrssi[1] - gphy->nrssi[0]); - a += (gphy->nrssi[0] << 6); - if (a < 32) - a += 31; - else - a += 32; - a = a >> 6; - a = clamp_val(a, -31, 31); - - b = b * (gphy->nrssi[1] - gphy->nrssi[0]); - b += (gphy->nrssi[0] << 6); - if (b < 32) - b += 31; - else - b += 32; - b = b >> 6; - b = clamp_val(b, -31, 31); - - tmp_u16 = b43_phy_read(dev, 0x048A) & 0xF000; - tmp_u16 |= ((u32) b & 0x0000003F); - tmp_u16 |= (((u32) a & 0x0000003F) << 6); - b43_phy_write(dev, 0x048A, tmp_u16); - } -} - -/* Stack implementation to save/restore values from the - * interference mitigation code. - * It is save to restore values in random order. - */ -static void _stack_save(u32 *_stackptr, size_t *stackidx, - u8 id, u16 offset, u16 value) -{ - u32 *stackptr = &(_stackptr[*stackidx]); - - B43_WARN_ON(offset & 0xF000); - B43_WARN_ON(id & 0xF0); - *stackptr = offset; - *stackptr |= ((u32) id) << 12; - *stackptr |= ((u32) value) << 16; - (*stackidx)++; - B43_WARN_ON(*stackidx >= B43_INTERFSTACK_SIZE); -} - -static u16 _stack_restore(u32 *stackptr, u8 id, u16 offset) -{ - size_t i; - - B43_WARN_ON(offset & 0xF000); - B43_WARN_ON(id & 0xF0); - for (i = 0; i < B43_INTERFSTACK_SIZE; i++, stackptr++) { - if ((*stackptr & 0x00000FFF) != offset) - continue; - if (((*stackptr & 0x0000F000) >> 12) != id) - continue; - return ((*stackptr & 0xFFFF0000) >> 16); - } - B43_WARN_ON(1); - - return 0; -} - -#define phy_stacksave(offset) \ - do { \ - _stack_save(stack, &stackidx, 0x1, (offset), \ - b43_phy_read(dev, (offset))); \ - } while (0) -#define phy_stackrestore(offset) \ - do { \ - b43_phy_write(dev, (offset), \ - _stack_restore(stack, 0x1, \ - (offset))); \ - } while (0) -#define radio_stacksave(offset) \ - do { \ - _stack_save(stack, &stackidx, 0x2, (offset), \ - b43_radio_read16(dev, (offset))); \ - } while (0) -#define radio_stackrestore(offset) \ - do { \ - b43_radio_write16(dev, (offset), \ - _stack_restore(stack, 0x2, \ - (offset))); \ - } while (0) -#define ofdmtab_stacksave(table, offset) \ - do { \ - _stack_save(stack, &stackidx, 0x3, (offset)|(table), \ - b43_ofdmtab_read16(dev, (table), (offset))); \ - } while (0) -#define ofdmtab_stackrestore(table, offset) \ - do { \ - b43_ofdmtab_write16(dev, (table), (offset), \ - _stack_restore(stack, 0x3, \ - (offset)|(table))); \ - } while (0) - -static void -b43_radio_interference_mitigation_enable(struct b43_wldev *dev, int mode) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - u16 tmp, flipped; - size_t stackidx = 0; - u32 *stack = gphy->interfstack; - - switch (mode) { - case B43_INTERFMODE_NONWLAN: - if (phy->rev != 1) { - b43_phy_set(dev, 0x042B, 0x0800); - b43_phy_mask(dev, B43_PHY_G_CRS, ~0x4000); - break; - } - radio_stacksave(0x0078); - tmp = (b43_radio_read16(dev, 0x0078) & 0x001E); - B43_WARN_ON(tmp > 15); - flipped = bitrev4(tmp); - if (flipped < 10 && flipped >= 8) - flipped = 7; - else if (flipped >= 10) - flipped -= 3; - flipped = (bitrev4(flipped) << 1) | 0x0020; - b43_radio_write16(dev, 0x0078, flipped); - - b43_calc_nrssi_threshold(dev); - - phy_stacksave(0x0406); - b43_phy_write(dev, 0x0406, 0x7E28); - - b43_phy_set(dev, 0x042B, 0x0800); - b43_phy_set(dev, B43_PHY_RADIO_BITFIELD, 0x1000); - - phy_stacksave(0x04A0); - b43_phy_maskset(dev, 0x04A0, 0xC0C0, 0x0008); - phy_stacksave(0x04A1); - b43_phy_maskset(dev, 0x04A1, 0xC0C0, 0x0605); - phy_stacksave(0x04A2); - b43_phy_maskset(dev, 0x04A2, 0xC0C0, 0x0204); - phy_stacksave(0x04A8); - b43_phy_maskset(dev, 0x04A8, 0xC0C0, 0x0803); - phy_stacksave(0x04AB); - b43_phy_maskset(dev, 0x04AB, 0xC0C0, 0x0605); - - phy_stacksave(0x04A7); - b43_phy_write(dev, 0x04A7, 0x0002); - phy_stacksave(0x04A3); - b43_phy_write(dev, 0x04A3, 0x287A); - phy_stacksave(0x04A9); - b43_phy_write(dev, 0x04A9, 0x2027); - phy_stacksave(0x0493); - b43_phy_write(dev, 0x0493, 0x32F5); - phy_stacksave(0x04AA); - b43_phy_write(dev, 0x04AA, 0x2027); - phy_stacksave(0x04AC); - b43_phy_write(dev, 0x04AC, 0x32F5); - break; - case B43_INTERFMODE_MANUALWLAN: - if (b43_phy_read(dev, 0x0033) & 0x0800) - break; - - gphy->aci_enable = true; - - phy_stacksave(B43_PHY_RADIO_BITFIELD); - phy_stacksave(B43_PHY_G_CRS); - if (phy->rev < 2) { - phy_stacksave(0x0406); - } else { - phy_stacksave(0x04C0); - phy_stacksave(0x04C1); - } - phy_stacksave(0x0033); - phy_stacksave(0x04A7); - phy_stacksave(0x04A3); - phy_stacksave(0x04A9); - phy_stacksave(0x04AA); - phy_stacksave(0x04AC); - phy_stacksave(0x0493); - phy_stacksave(0x04A1); - phy_stacksave(0x04A0); - phy_stacksave(0x04A2); - phy_stacksave(0x048A); - phy_stacksave(0x04A8); - phy_stacksave(0x04AB); - if (phy->rev == 2) { - phy_stacksave(0x04AD); - phy_stacksave(0x04AE); - } else if (phy->rev >= 3) { - phy_stacksave(0x04AD); - phy_stacksave(0x0415); - phy_stacksave(0x0416); - phy_stacksave(0x0417); - ofdmtab_stacksave(0x1A00, 0x2); - ofdmtab_stacksave(0x1A00, 0x3); - } - phy_stacksave(0x042B); - phy_stacksave(0x048C); - - b43_phy_mask(dev, B43_PHY_RADIO_BITFIELD, ~0x1000); - b43_phy_maskset(dev, B43_PHY_G_CRS, 0xFFFC, 0x0002); - - b43_phy_write(dev, 0x0033, 0x0800); - b43_phy_write(dev, 0x04A3, 0x2027); - b43_phy_write(dev, 0x04A9, 0x1CA8); - b43_phy_write(dev, 0x0493, 0x287A); - b43_phy_write(dev, 0x04AA, 0x1CA8); - b43_phy_write(dev, 0x04AC, 0x287A); - - b43_phy_maskset(dev, 0x04A0, 0xFFC0, 0x001A); - b43_phy_write(dev, 0x04A7, 0x000D); - - if (phy->rev < 2) { - b43_phy_write(dev, 0x0406, 0xFF0D); - } else if (phy->rev == 2) { - b43_phy_write(dev, 0x04C0, 0xFFFF); - b43_phy_write(dev, 0x04C1, 0x00A9); - } else { - b43_phy_write(dev, 0x04C0, 0x00C1); - b43_phy_write(dev, 0x04C1, 0x0059); - } - - b43_phy_maskset(dev, 0x04A1, 0xC0FF, 0x1800); - b43_phy_maskset(dev, 0x04A1, 0xFFC0, 0x0015); - b43_phy_maskset(dev, 0x04A8, 0xCFFF, 0x1000); - b43_phy_maskset(dev, 0x04A8, 0xF0FF, 0x0A00); - b43_phy_maskset(dev, 0x04AB, 0xCFFF, 0x1000); - b43_phy_maskset(dev, 0x04AB, 0xF0FF, 0x0800); - b43_phy_maskset(dev, 0x04AB, 0xFFCF, 0x0010); - b43_phy_maskset(dev, 0x04AB, 0xFFF0, 0x0005); - b43_phy_maskset(dev, 0x04A8, 0xFFCF, 0x0010); - b43_phy_maskset(dev, 0x04A8, 0xFFF0, 0x0006); - b43_phy_maskset(dev, 0x04A2, 0xF0FF, 0x0800); - b43_phy_maskset(dev, 0x04A0, 0xF0FF, 0x0500); - b43_phy_maskset(dev, 0x04A2, 0xFFF0, 0x000B); - - if (phy->rev >= 3) { - b43_phy_mask(dev, 0x048A, 0x7FFF); - b43_phy_maskset(dev, 0x0415, 0x8000, 0x36D8); - b43_phy_maskset(dev, 0x0416, 0x8000, 0x36D8); - b43_phy_maskset(dev, 0x0417, 0xFE00, 0x016D); - } else { - b43_phy_set(dev, 0x048A, 0x1000); - b43_phy_maskset(dev, 0x048A, 0x9FFF, 0x2000); - b43_hf_write(dev, b43_hf_read(dev) | B43_HF_ACIW); - } - if (phy->rev >= 2) { - b43_phy_set(dev, 0x042B, 0x0800); - } - b43_phy_maskset(dev, 0x048C, 0xF0FF, 0x0200); - if (phy->rev == 2) { - b43_phy_maskset(dev, 0x04AE, 0xFF00, 0x007F); - b43_phy_maskset(dev, 0x04AD, 0x00FF, 0x1300); - } else if (phy->rev >= 6) { - b43_ofdmtab_write16(dev, 0x1A00, 0x3, 0x007F); - b43_ofdmtab_write16(dev, 0x1A00, 0x2, 0x007F); - b43_phy_mask(dev, 0x04AD, 0x00FF); - } - b43_calc_nrssi_slope(dev); - break; - default: - B43_WARN_ON(1); - } -} - -static void -b43_radio_interference_mitigation_disable(struct b43_wldev *dev, int mode) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - u32 *stack = gphy->interfstack; - - switch (mode) { - case B43_INTERFMODE_NONWLAN: - if (phy->rev != 1) { - b43_phy_mask(dev, 0x042B, ~0x0800); - b43_phy_set(dev, B43_PHY_G_CRS, 0x4000); - break; - } - radio_stackrestore(0x0078); - b43_calc_nrssi_threshold(dev); - phy_stackrestore(0x0406); - b43_phy_mask(dev, 0x042B, ~0x0800); - if (!dev->bad_frames_preempt) { - b43_phy_mask(dev, B43_PHY_RADIO_BITFIELD, ~(1 << 11)); - } - b43_phy_set(dev, B43_PHY_G_CRS, 0x4000); - phy_stackrestore(0x04A0); - phy_stackrestore(0x04A1); - phy_stackrestore(0x04A2); - phy_stackrestore(0x04A8); - phy_stackrestore(0x04AB); - phy_stackrestore(0x04A7); - phy_stackrestore(0x04A3); - phy_stackrestore(0x04A9); - phy_stackrestore(0x0493); - phy_stackrestore(0x04AA); - phy_stackrestore(0x04AC); - break; - case B43_INTERFMODE_MANUALWLAN: - if (!(b43_phy_read(dev, 0x0033) & 0x0800)) - break; - - gphy->aci_enable = false; - - phy_stackrestore(B43_PHY_RADIO_BITFIELD); - phy_stackrestore(B43_PHY_G_CRS); - phy_stackrestore(0x0033); - phy_stackrestore(0x04A3); - phy_stackrestore(0x04A9); - phy_stackrestore(0x0493); - phy_stackrestore(0x04AA); - phy_stackrestore(0x04AC); - phy_stackrestore(0x04A0); - phy_stackrestore(0x04A7); - if (phy->rev >= 2) { - phy_stackrestore(0x04C0); - phy_stackrestore(0x04C1); - } else - phy_stackrestore(0x0406); - phy_stackrestore(0x04A1); - phy_stackrestore(0x04AB); - phy_stackrestore(0x04A8); - if (phy->rev == 2) { - phy_stackrestore(0x04AD); - phy_stackrestore(0x04AE); - } else if (phy->rev >= 3) { - phy_stackrestore(0x04AD); - phy_stackrestore(0x0415); - phy_stackrestore(0x0416); - phy_stackrestore(0x0417); - ofdmtab_stackrestore(0x1A00, 0x2); - ofdmtab_stackrestore(0x1A00, 0x3); - } - phy_stackrestore(0x04A2); - phy_stackrestore(0x048A); - phy_stackrestore(0x042B); - phy_stackrestore(0x048C); - b43_hf_write(dev, b43_hf_read(dev) & ~B43_HF_ACIW); - b43_calc_nrssi_slope(dev); - break; - default: - B43_WARN_ON(1); - } -} - -#undef phy_stacksave -#undef phy_stackrestore -#undef radio_stacksave -#undef radio_stackrestore -#undef ofdmtab_stacksave -#undef ofdmtab_stackrestore - -static u16 b43_radio_core_calibration_value(struct b43_wldev *dev) -{ - u16 reg, index, ret; - - static const u8 rcc_table[] = { - 0x02, 0x03, 0x01, 0x0F, - 0x06, 0x07, 0x05, 0x0F, - 0x0A, 0x0B, 0x09, 0x0F, - 0x0E, 0x0F, 0x0D, 0x0F, - }; - - reg = b43_radio_read16(dev, 0x60); - index = (reg & 0x001E) >> 1; - ret = rcc_table[index] << 1; - ret |= (reg & 0x0001); - ret |= 0x0020; - - return ret; -} - -#define LPD(L, P, D) (((L) << 2) | ((P) << 1) | ((D) << 0)) -static u16 radio2050_rfover_val(struct b43_wldev *dev, - u16 phy_register, unsigned int lpd) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - struct ssb_sprom *sprom = dev->dev->bus_sprom; - - if (!phy->gmode) - return 0; - - if (has_loopback_gain(phy)) { - int max_lb_gain = gphy->max_lb_gain; - u16 extlna; - u16 i; - - if (phy->radio_rev == 8) - max_lb_gain += 0x3E; - else - max_lb_gain += 0x26; - if (max_lb_gain >= 0x46) { - extlna = 0x3000; - max_lb_gain -= 0x46; - } else if (max_lb_gain >= 0x3A) { - extlna = 0x1000; - max_lb_gain -= 0x3A; - } else if (max_lb_gain >= 0x2E) { - extlna = 0x2000; - max_lb_gain -= 0x2E; - } else { - extlna = 0; - max_lb_gain -= 0x10; - } - - for (i = 0; i < 16; i++) { - max_lb_gain -= (i * 6); - if (max_lb_gain < 6) - break; - } - - if ((phy->rev < 7) || - !(sprom->boardflags_lo & B43_BFL_EXTLNA)) { - if (phy_register == B43_PHY_RFOVER) { - return 0x1B3; - } else if (phy_register == B43_PHY_RFOVERVAL) { - extlna |= (i << 8); - switch (lpd) { - case LPD(0, 1, 1): - return 0x0F92; - case LPD(0, 0, 1): - case LPD(1, 0, 1): - return (0x0092 | extlna); - case LPD(1, 0, 0): - return (0x0093 | extlna); - } - B43_WARN_ON(1); - } - B43_WARN_ON(1); - } else { - if (phy_register == B43_PHY_RFOVER) { - return 0x9B3; - } else if (phy_register == B43_PHY_RFOVERVAL) { - if (extlna) - extlna |= 0x8000; - extlna |= (i << 8); - switch (lpd) { - case LPD(0, 1, 1): - return 0x8F92; - case LPD(0, 0, 1): - return (0x8092 | extlna); - case LPD(1, 0, 1): - return (0x2092 | extlna); - case LPD(1, 0, 0): - return (0x2093 | extlna); - } - B43_WARN_ON(1); - } - B43_WARN_ON(1); - } - } else { - if ((phy->rev < 7) || - !(sprom->boardflags_lo & B43_BFL_EXTLNA)) { - if (phy_register == B43_PHY_RFOVER) { - return 0x1B3; - } else if (phy_register == B43_PHY_RFOVERVAL) { - switch (lpd) { - case LPD(0, 1, 1): - return 0x0FB2; - case LPD(0, 0, 1): - return 0x00B2; - case LPD(1, 0, 1): - return 0x30B2; - case LPD(1, 0, 0): - return 0x30B3; - } - B43_WARN_ON(1); - } - B43_WARN_ON(1); - } else { - if (phy_register == B43_PHY_RFOVER) { - return 0x9B3; - } else if (phy_register == B43_PHY_RFOVERVAL) { - switch (lpd) { - case LPD(0, 1, 1): - return 0x8FB2; - case LPD(0, 0, 1): - return 0x80B2; - case LPD(1, 0, 1): - return 0x20B2; - case LPD(1, 0, 0): - return 0x20B3; - } - B43_WARN_ON(1); - } - B43_WARN_ON(1); - } - } - return 0; -} - -struct init2050_saved_values { - /* Core registers */ - u16 reg_3EC; - u16 reg_3E6; - u16 reg_3F4; - /* Radio registers */ - u16 radio_43; - u16 radio_51; - u16 radio_52; - /* PHY registers */ - u16 phy_pgactl; - u16 phy_cck_5A; - u16 phy_cck_59; - u16 phy_cck_58; - u16 phy_cck_30; - u16 phy_rfover; - u16 phy_rfoverval; - u16 phy_analogover; - u16 phy_analogoverval; - u16 phy_crs0; - u16 phy_classctl; - u16 phy_lo_mask; - u16 phy_lo_ctl; - u16 phy_syncctl; -}; - -static u16 b43_radio_init2050(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct init2050_saved_values sav; - u16 rcc; - u16 radio78; - u16 ret; - u16 i, j; - u32 tmp1 = 0, tmp2 = 0; - - memset(&sav, 0, sizeof(sav)); /* get rid of "may be used uninitialized..." */ - - sav.radio_43 = b43_radio_read16(dev, 0x43); - sav.radio_51 = b43_radio_read16(dev, 0x51); - sav.radio_52 = b43_radio_read16(dev, 0x52); - sav.phy_pgactl = b43_phy_read(dev, B43_PHY_PGACTL); - sav.phy_cck_5A = b43_phy_read(dev, B43_PHY_CCK(0x5A)); - sav.phy_cck_59 = b43_phy_read(dev, B43_PHY_CCK(0x59)); - sav.phy_cck_58 = b43_phy_read(dev, B43_PHY_CCK(0x58)); - - if (phy->type == B43_PHYTYPE_B) { - sav.phy_cck_30 = b43_phy_read(dev, B43_PHY_CCK(0x30)); - sav.reg_3EC = b43_read16(dev, 0x3EC); - - b43_phy_write(dev, B43_PHY_CCK(0x30), 0xFF); - b43_write16(dev, 0x3EC, 0x3F3F); - } else if (phy->gmode || phy->rev >= 2) { - sav.phy_rfover = b43_phy_read(dev, B43_PHY_RFOVER); - sav.phy_rfoverval = b43_phy_read(dev, B43_PHY_RFOVERVAL); - sav.phy_analogover = b43_phy_read(dev, B43_PHY_ANALOGOVER); - sav.phy_analogoverval = - b43_phy_read(dev, B43_PHY_ANALOGOVERVAL); - sav.phy_crs0 = b43_phy_read(dev, B43_PHY_CRS0); - sav.phy_classctl = b43_phy_read(dev, B43_PHY_CLASSCTL); - - b43_phy_set(dev, B43_PHY_ANALOGOVER, 0x0003); - b43_phy_mask(dev, B43_PHY_ANALOGOVERVAL, 0xFFFC); - b43_phy_mask(dev, B43_PHY_CRS0, 0x7FFF); - b43_phy_mask(dev, B43_PHY_CLASSCTL, 0xFFFC); - if (has_loopback_gain(phy)) { - sav.phy_lo_mask = b43_phy_read(dev, B43_PHY_LO_MASK); - sav.phy_lo_ctl = b43_phy_read(dev, B43_PHY_LO_CTL); - - if (phy->rev >= 3) - b43_phy_write(dev, B43_PHY_LO_MASK, 0xC020); - else - b43_phy_write(dev, B43_PHY_LO_MASK, 0x8020); - b43_phy_write(dev, B43_PHY_LO_CTL, 0); - } - - b43_phy_write(dev, B43_PHY_RFOVERVAL, - radio2050_rfover_val(dev, B43_PHY_RFOVERVAL, - LPD(0, 1, 1))); - b43_phy_write(dev, B43_PHY_RFOVER, - radio2050_rfover_val(dev, B43_PHY_RFOVER, 0)); - } - b43_write16(dev, 0x3E2, b43_read16(dev, 0x3E2) | 0x8000); - - sav.phy_syncctl = b43_phy_read(dev, B43_PHY_SYNCCTL); - b43_phy_mask(dev, B43_PHY_SYNCCTL, 0xFF7F); - sav.reg_3E6 = b43_read16(dev, 0x3E6); - sav.reg_3F4 = b43_read16(dev, 0x3F4); - - if (phy->analog == 0) { - b43_write16(dev, 0x03E6, 0x0122); - } else { - if (phy->analog >= 2) { - b43_phy_maskset(dev, B43_PHY_CCK(0x03), 0xFFBF, 0x40); - } - b43_write16(dev, B43_MMIO_CHANNEL_EXT, - (b43_read16(dev, B43_MMIO_CHANNEL_EXT) | 0x2000)); - } - - rcc = b43_radio_core_calibration_value(dev); - - if (phy->type == B43_PHYTYPE_B) - b43_radio_write16(dev, 0x78, 0x26); - if (phy->gmode || phy->rev >= 2) { - b43_phy_write(dev, B43_PHY_RFOVERVAL, - radio2050_rfover_val(dev, B43_PHY_RFOVERVAL, - LPD(0, 1, 1))); - } - b43_phy_write(dev, B43_PHY_PGACTL, 0xBFAF); - b43_phy_write(dev, B43_PHY_CCK(0x2B), 0x1403); - if (phy->gmode || phy->rev >= 2) { - b43_phy_write(dev, B43_PHY_RFOVERVAL, - radio2050_rfover_val(dev, B43_PHY_RFOVERVAL, - LPD(0, 0, 1))); - } - b43_phy_write(dev, B43_PHY_PGACTL, 0xBFA0); - b43_radio_set(dev, 0x51, 0x0004); - if (phy->radio_rev == 8) { - b43_radio_write16(dev, 0x43, 0x1F); - } else { - b43_radio_write16(dev, 0x52, 0); - b43_radio_maskset(dev, 0x43, 0xFFF0, 0x0009); - } - b43_phy_write(dev, B43_PHY_CCK(0x58), 0); - - for (i = 0; i < 16; i++) { - b43_phy_write(dev, B43_PHY_CCK(0x5A), 0x0480); - b43_phy_write(dev, B43_PHY_CCK(0x59), 0xC810); - b43_phy_write(dev, B43_PHY_CCK(0x58), 0x000D); - if (phy->gmode || phy->rev >= 2) { - b43_phy_write(dev, B43_PHY_RFOVERVAL, - radio2050_rfover_val(dev, - B43_PHY_RFOVERVAL, - LPD(1, 0, 1))); - } - b43_phy_write(dev, B43_PHY_PGACTL, 0xAFB0); - udelay(10); - if (phy->gmode || phy->rev >= 2) { - b43_phy_write(dev, B43_PHY_RFOVERVAL, - radio2050_rfover_val(dev, - B43_PHY_RFOVERVAL, - LPD(1, 0, 1))); - } - b43_phy_write(dev, B43_PHY_PGACTL, 0xEFB0); - udelay(10); - if (phy->gmode || phy->rev >= 2) { - b43_phy_write(dev, B43_PHY_RFOVERVAL, - radio2050_rfover_val(dev, - B43_PHY_RFOVERVAL, - LPD(1, 0, 0))); - } - b43_phy_write(dev, B43_PHY_PGACTL, 0xFFF0); - udelay(20); - tmp1 += b43_phy_read(dev, B43_PHY_LO_LEAKAGE); - b43_phy_write(dev, B43_PHY_CCK(0x58), 0); - if (phy->gmode || phy->rev >= 2) { - b43_phy_write(dev, B43_PHY_RFOVERVAL, - radio2050_rfover_val(dev, - B43_PHY_RFOVERVAL, - LPD(1, 0, 1))); - } - b43_phy_write(dev, B43_PHY_PGACTL, 0xAFB0); - } - udelay(10); - - b43_phy_write(dev, B43_PHY_CCK(0x58), 0); - tmp1++; - tmp1 >>= 9; - - for (i = 0; i < 16; i++) { - radio78 = (bitrev4(i) << 1) | 0x0020; - b43_radio_write16(dev, 0x78, radio78); - udelay(10); - for (j = 0; j < 16; j++) { - b43_phy_write(dev, B43_PHY_CCK(0x5A), 0x0D80); - b43_phy_write(dev, B43_PHY_CCK(0x59), 0xC810); - b43_phy_write(dev, B43_PHY_CCK(0x58), 0x000D); - if (phy->gmode || phy->rev >= 2) { - b43_phy_write(dev, B43_PHY_RFOVERVAL, - radio2050_rfover_val(dev, - B43_PHY_RFOVERVAL, - LPD(1, 0, - 1))); - } - b43_phy_write(dev, B43_PHY_PGACTL, 0xAFB0); - udelay(10); - if (phy->gmode || phy->rev >= 2) { - b43_phy_write(dev, B43_PHY_RFOVERVAL, - radio2050_rfover_val(dev, - B43_PHY_RFOVERVAL, - LPD(1, 0, - 1))); - } - b43_phy_write(dev, B43_PHY_PGACTL, 0xEFB0); - udelay(10); - if (phy->gmode || phy->rev >= 2) { - b43_phy_write(dev, B43_PHY_RFOVERVAL, - radio2050_rfover_val(dev, - B43_PHY_RFOVERVAL, - LPD(1, 0, - 0))); - } - b43_phy_write(dev, B43_PHY_PGACTL, 0xFFF0); - udelay(10); - tmp2 += b43_phy_read(dev, B43_PHY_LO_LEAKAGE); - b43_phy_write(dev, B43_PHY_CCK(0x58), 0); - if (phy->gmode || phy->rev >= 2) { - b43_phy_write(dev, B43_PHY_RFOVERVAL, - radio2050_rfover_val(dev, - B43_PHY_RFOVERVAL, - LPD(1, 0, - 1))); - } - b43_phy_write(dev, B43_PHY_PGACTL, 0xAFB0); - } - tmp2++; - tmp2 >>= 8; - if (tmp1 < tmp2) - break; - } - - /* Restore the registers */ - b43_phy_write(dev, B43_PHY_PGACTL, sav.phy_pgactl); - b43_radio_write16(dev, 0x51, sav.radio_51); - b43_radio_write16(dev, 0x52, sav.radio_52); - b43_radio_write16(dev, 0x43, sav.radio_43); - b43_phy_write(dev, B43_PHY_CCK(0x5A), sav.phy_cck_5A); - b43_phy_write(dev, B43_PHY_CCK(0x59), sav.phy_cck_59); - b43_phy_write(dev, B43_PHY_CCK(0x58), sav.phy_cck_58); - b43_write16(dev, 0x3E6, sav.reg_3E6); - if (phy->analog != 0) - b43_write16(dev, 0x3F4, sav.reg_3F4); - b43_phy_write(dev, B43_PHY_SYNCCTL, sav.phy_syncctl); - b43_synth_pu_workaround(dev, phy->channel); - if (phy->type == B43_PHYTYPE_B) { - b43_phy_write(dev, B43_PHY_CCK(0x30), sav.phy_cck_30); - b43_write16(dev, 0x3EC, sav.reg_3EC); - } else if (phy->gmode) { - b43_write16(dev, B43_MMIO_PHY_RADIO, - b43_read16(dev, B43_MMIO_PHY_RADIO) - & 0x7FFF); - b43_phy_write(dev, B43_PHY_RFOVER, sav.phy_rfover); - b43_phy_write(dev, B43_PHY_RFOVERVAL, sav.phy_rfoverval); - b43_phy_write(dev, B43_PHY_ANALOGOVER, sav.phy_analogover); - b43_phy_write(dev, B43_PHY_ANALOGOVERVAL, - sav.phy_analogoverval); - b43_phy_write(dev, B43_PHY_CRS0, sav.phy_crs0); - b43_phy_write(dev, B43_PHY_CLASSCTL, sav.phy_classctl); - if (has_loopback_gain(phy)) { - b43_phy_write(dev, B43_PHY_LO_MASK, sav.phy_lo_mask); - b43_phy_write(dev, B43_PHY_LO_CTL, sav.phy_lo_ctl); - } - } - if (i > 15) - ret = radio78; - else - ret = rcc; - - return ret; -} - -static void b43_phy_initb5(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - u16 offset, value; - u8 old_channel; - - if (phy->analog == 1) { - b43_radio_set(dev, 0x007A, 0x0050); - } - if ((dev->dev->board_vendor != SSB_BOARDVENDOR_BCM) && - (dev->dev->board_type != SSB_BOARD_BU4306)) { - value = 0x2120; - for (offset = 0x00A8; offset < 0x00C7; offset++) { - b43_phy_write(dev, offset, value); - value += 0x202; - } - } - b43_phy_maskset(dev, 0x0035, 0xF0FF, 0x0700); - if (phy->radio_ver == 0x2050) - b43_phy_write(dev, 0x0038, 0x0667); - - if (phy->gmode || phy->rev >= 2) { - if (phy->radio_ver == 0x2050) { - b43_radio_set(dev, 0x007A, 0x0020); - b43_radio_set(dev, 0x0051, 0x0004); - } - b43_write16(dev, B43_MMIO_PHY_RADIO, 0x0000); - - b43_phy_set(dev, 0x0802, 0x0100); - b43_phy_set(dev, 0x042B, 0x2000); - - b43_phy_write(dev, 0x001C, 0x186A); - - b43_phy_maskset(dev, 0x0013, 0x00FF, 0x1900); - b43_phy_maskset(dev, 0x0035, 0xFFC0, 0x0064); - b43_phy_maskset(dev, 0x005D, 0xFF80, 0x000A); - } - - if (dev->bad_frames_preempt) { - b43_phy_set(dev, B43_PHY_RADIO_BITFIELD, (1 << 11)); - } - - if (phy->analog == 1) { - b43_phy_write(dev, 0x0026, 0xCE00); - b43_phy_write(dev, 0x0021, 0x3763); - b43_phy_write(dev, 0x0022, 0x1BC3); - b43_phy_write(dev, 0x0023, 0x06F9); - b43_phy_write(dev, 0x0024, 0x037E); - } else - b43_phy_write(dev, 0x0026, 0xCC00); - b43_phy_write(dev, 0x0030, 0x00C6); - b43_write16(dev, 0x03EC, 0x3F22); - - if (phy->analog == 1) - b43_phy_write(dev, 0x0020, 0x3E1C); - else - b43_phy_write(dev, 0x0020, 0x301C); - - if (phy->analog == 0) - b43_write16(dev, 0x03E4, 0x3000); - - old_channel = phy->channel; - /* Force to channel 7, even if not supported. */ - b43_gphy_channel_switch(dev, 7, 0); - - if (phy->radio_ver != 0x2050) { - b43_radio_write16(dev, 0x0075, 0x0080); - b43_radio_write16(dev, 0x0079, 0x0081); - } - - b43_radio_write16(dev, 0x0050, 0x0020); - b43_radio_write16(dev, 0x0050, 0x0023); - - if (phy->radio_ver == 0x2050) { - b43_radio_write16(dev, 0x0050, 0x0020); - b43_radio_write16(dev, 0x005A, 0x0070); - } - - b43_radio_write16(dev, 0x005B, 0x007B); - b43_radio_write16(dev, 0x005C, 0x00B0); - - b43_radio_set(dev, 0x007A, 0x0007); - - b43_gphy_channel_switch(dev, old_channel, 0); - - b43_phy_write(dev, 0x0014, 0x0080); - b43_phy_write(dev, 0x0032, 0x00CA); - b43_phy_write(dev, 0x002A, 0x88A3); - - b43_set_txpower_g(dev, &gphy->bbatt, &gphy->rfatt, gphy->tx_control); - - if (phy->radio_ver == 0x2050) - b43_radio_write16(dev, 0x005D, 0x000D); - - b43_write16(dev, 0x03E4, (b43_read16(dev, 0x03E4) & 0xFFC0) | 0x0004); -} - -static void b43_phy_initb6(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - u16 offset, val; - u8 old_channel; - - b43_phy_write(dev, 0x003E, 0x817A); - b43_radio_write16(dev, 0x007A, - (b43_radio_read16(dev, 0x007A) | 0x0058)); - if (phy->radio_rev == 4 || phy->radio_rev == 5) { - b43_radio_write16(dev, 0x51, 0x37); - b43_radio_write16(dev, 0x52, 0x70); - b43_radio_write16(dev, 0x53, 0xB3); - b43_radio_write16(dev, 0x54, 0x9B); - b43_radio_write16(dev, 0x5A, 0x88); - b43_radio_write16(dev, 0x5B, 0x88); - b43_radio_write16(dev, 0x5D, 0x88); - b43_radio_write16(dev, 0x5E, 0x88); - b43_radio_write16(dev, 0x7D, 0x88); - b43_hf_write(dev, b43_hf_read(dev) - | B43_HF_TSSIRPSMW); - } - B43_WARN_ON(phy->radio_rev == 6 || phy->radio_rev == 7); /* We had code for these revs here... */ - if (phy->radio_rev == 8) { - b43_radio_write16(dev, 0x51, 0); - b43_radio_write16(dev, 0x52, 0x40); - b43_radio_write16(dev, 0x53, 0xB7); - b43_radio_write16(dev, 0x54, 0x98); - b43_radio_write16(dev, 0x5A, 0x88); - b43_radio_write16(dev, 0x5B, 0x6B); - b43_radio_write16(dev, 0x5C, 0x0F); - if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_ALTIQ) { - b43_radio_write16(dev, 0x5D, 0xFA); - b43_radio_write16(dev, 0x5E, 0xD8); - } else { - b43_radio_write16(dev, 0x5D, 0xF5); - b43_radio_write16(dev, 0x5E, 0xB8); - } - b43_radio_write16(dev, 0x0073, 0x0003); - b43_radio_write16(dev, 0x007D, 0x00A8); - b43_radio_write16(dev, 0x007C, 0x0001); - b43_radio_write16(dev, 0x007E, 0x0008); - } - val = 0x1E1F; - for (offset = 0x0088; offset < 0x0098; offset++) { - b43_phy_write(dev, offset, val); - val -= 0x0202; - } - val = 0x3E3F; - for (offset = 0x0098; offset < 0x00A8; offset++) { - b43_phy_write(dev, offset, val); - val -= 0x0202; - } - val = 0x2120; - for (offset = 0x00A8; offset < 0x00C8; offset++) { - b43_phy_write(dev, offset, (val & 0x3F3F)); - val += 0x0202; - } - if (phy->type == B43_PHYTYPE_G) { - b43_radio_set(dev, 0x007A, 0x0020); - b43_radio_set(dev, 0x0051, 0x0004); - b43_phy_set(dev, 0x0802, 0x0100); - b43_phy_set(dev, 0x042B, 0x2000); - b43_phy_write(dev, 0x5B, 0); - b43_phy_write(dev, 0x5C, 0); - } - - old_channel = phy->channel; - if (old_channel >= 8) - b43_gphy_channel_switch(dev, 1, 0); - else - b43_gphy_channel_switch(dev, 13, 0); - - b43_radio_write16(dev, 0x0050, 0x0020); - b43_radio_write16(dev, 0x0050, 0x0023); - udelay(40); - if (phy->radio_rev < 6 || phy->radio_rev == 8) { - b43_radio_write16(dev, 0x7C, (b43_radio_read16(dev, 0x7C) - | 0x0002)); - b43_radio_write16(dev, 0x50, 0x20); - } - if (phy->radio_rev <= 2) { - b43_radio_write16(dev, 0x7C, 0x20); - b43_radio_write16(dev, 0x5A, 0x70); - b43_radio_write16(dev, 0x5B, 0x7B); - b43_radio_write16(dev, 0x5C, 0xB0); - } - b43_radio_maskset(dev, 0x007A, 0x00F8, 0x0007); - - b43_gphy_channel_switch(dev, old_channel, 0); - - b43_phy_write(dev, 0x0014, 0x0200); - if (phy->radio_rev >= 6) - b43_phy_write(dev, 0x2A, 0x88C2); - else - b43_phy_write(dev, 0x2A, 0x8AC0); - b43_phy_write(dev, 0x0038, 0x0668); - b43_set_txpower_g(dev, &gphy->bbatt, &gphy->rfatt, gphy->tx_control); - if (phy->radio_rev <= 5) { - b43_phy_maskset(dev, 0x5D, 0xFF80, 0x0003); - } - if (phy->radio_rev <= 2) - b43_radio_write16(dev, 0x005D, 0x000D); - - if (phy->analog == 4) { - b43_write16(dev, 0x3E4, 9); - b43_phy_mask(dev, 0x61, 0x0FFF); - } else { - b43_phy_maskset(dev, 0x0002, 0xFFC0, 0x0004); - } - if (phy->type == B43_PHYTYPE_B) - B43_WARN_ON(1); - else if (phy->type == B43_PHYTYPE_G) - b43_write16(dev, 0x03E6, 0x0); -} - -static void b43_calc_loopback_gain(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - u16 backup_phy[16] = { 0 }; - u16 backup_radio[3]; - u16 backup_bband; - u16 i, j, loop_i_max; - u16 trsw_rx; - u16 loop1_outer_done, loop1_inner_done; - - backup_phy[0] = b43_phy_read(dev, B43_PHY_CRS0); - backup_phy[1] = b43_phy_read(dev, B43_PHY_CCKBBANDCFG); - backup_phy[2] = b43_phy_read(dev, B43_PHY_RFOVER); - backup_phy[3] = b43_phy_read(dev, B43_PHY_RFOVERVAL); - if (phy->rev != 1) { /* Not in specs, but needed to prevent PPC machine check */ - backup_phy[4] = b43_phy_read(dev, B43_PHY_ANALOGOVER); - backup_phy[5] = b43_phy_read(dev, B43_PHY_ANALOGOVERVAL); - } - backup_phy[6] = b43_phy_read(dev, B43_PHY_CCK(0x5A)); - backup_phy[7] = b43_phy_read(dev, B43_PHY_CCK(0x59)); - backup_phy[8] = b43_phy_read(dev, B43_PHY_CCK(0x58)); - backup_phy[9] = b43_phy_read(dev, B43_PHY_CCK(0x0A)); - backup_phy[10] = b43_phy_read(dev, B43_PHY_CCK(0x03)); - backup_phy[11] = b43_phy_read(dev, B43_PHY_LO_MASK); - backup_phy[12] = b43_phy_read(dev, B43_PHY_LO_CTL); - backup_phy[13] = b43_phy_read(dev, B43_PHY_CCK(0x2B)); - backup_phy[14] = b43_phy_read(dev, B43_PHY_PGACTL); - backup_phy[15] = b43_phy_read(dev, B43_PHY_LO_LEAKAGE); - backup_bband = gphy->bbatt.att; - backup_radio[0] = b43_radio_read16(dev, 0x52); - backup_radio[1] = b43_radio_read16(dev, 0x43); - backup_radio[2] = b43_radio_read16(dev, 0x7A); - - b43_phy_mask(dev, B43_PHY_CRS0, 0x3FFF); - b43_phy_set(dev, B43_PHY_CCKBBANDCFG, 0x8000); - b43_phy_set(dev, B43_PHY_RFOVER, 0x0002); - b43_phy_mask(dev, B43_PHY_RFOVERVAL, 0xFFFD); - b43_phy_set(dev, B43_PHY_RFOVER, 0x0001); - b43_phy_mask(dev, B43_PHY_RFOVERVAL, 0xFFFE); - if (phy->rev != 1) { /* Not in specs, but needed to prevent PPC machine check */ - b43_phy_set(dev, B43_PHY_ANALOGOVER, 0x0001); - b43_phy_mask(dev, B43_PHY_ANALOGOVERVAL, 0xFFFE); - b43_phy_set(dev, B43_PHY_ANALOGOVER, 0x0002); - b43_phy_mask(dev, B43_PHY_ANALOGOVERVAL, 0xFFFD); - } - b43_phy_set(dev, B43_PHY_RFOVER, 0x000C); - b43_phy_set(dev, B43_PHY_RFOVERVAL, 0x000C); - b43_phy_set(dev, B43_PHY_RFOVER, 0x0030); - b43_phy_maskset(dev, B43_PHY_RFOVERVAL, 0xFFCF, 0x10); - - b43_phy_write(dev, B43_PHY_CCK(0x5A), 0x0780); - b43_phy_write(dev, B43_PHY_CCK(0x59), 0xC810); - b43_phy_write(dev, B43_PHY_CCK(0x58), 0x000D); - - b43_phy_set(dev, B43_PHY_CCK(0x0A), 0x2000); - if (phy->rev != 1) { /* Not in specs, but needed to prevent PPC machine check */ - b43_phy_set(dev, B43_PHY_ANALOGOVER, 0x0004); - b43_phy_mask(dev, B43_PHY_ANALOGOVERVAL, 0xFFFB); - } - b43_phy_maskset(dev, B43_PHY_CCK(0x03), 0xFF9F, 0x40); - - if (phy->radio_rev == 8) { - b43_radio_write16(dev, 0x43, 0x000F); - } else { - b43_radio_write16(dev, 0x52, 0); - b43_radio_maskset(dev, 0x43, 0xFFF0, 0x9); - } - b43_gphy_set_baseband_attenuation(dev, 11); - - if (phy->rev >= 3) - b43_phy_write(dev, B43_PHY_LO_MASK, 0xC020); - else - b43_phy_write(dev, B43_PHY_LO_MASK, 0x8020); - b43_phy_write(dev, B43_PHY_LO_CTL, 0); - - b43_phy_maskset(dev, B43_PHY_CCK(0x2B), 0xFFC0, 0x01); - b43_phy_maskset(dev, B43_PHY_CCK(0x2B), 0xC0FF, 0x800); - - b43_phy_set(dev, B43_PHY_RFOVER, 0x0100); - b43_phy_mask(dev, B43_PHY_RFOVERVAL, 0xCFFF); - - if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_EXTLNA) { - if (phy->rev >= 7) { - b43_phy_set(dev, B43_PHY_RFOVER, 0x0800); - b43_phy_set(dev, B43_PHY_RFOVERVAL, 0x8000); - } - } - b43_radio_mask(dev, 0x7A, 0x00F7); - - j = 0; - loop_i_max = (phy->radio_rev == 8) ? 15 : 9; - for (i = 0; i < loop_i_max; i++) { - for (j = 0; j < 16; j++) { - b43_radio_write16(dev, 0x43, i); - b43_phy_maskset(dev, B43_PHY_RFOVERVAL, 0xF0FF, (j << 8)); - b43_phy_maskset(dev, B43_PHY_PGACTL, 0x0FFF, 0xA000); - b43_phy_set(dev, B43_PHY_PGACTL, 0xF000); - udelay(20); - if (b43_phy_read(dev, B43_PHY_LO_LEAKAGE) >= 0xDFC) - goto exit_loop1; - } - } - exit_loop1: - loop1_outer_done = i; - loop1_inner_done = j; - if (j >= 8) { - b43_phy_set(dev, B43_PHY_RFOVERVAL, 0x30); - trsw_rx = 0x1B; - for (j = j - 8; j < 16; j++) { - b43_phy_maskset(dev, B43_PHY_RFOVERVAL, 0xF0FF, (j << 8)); - b43_phy_maskset(dev, B43_PHY_PGACTL, 0x0FFF, 0xA000); - b43_phy_set(dev, B43_PHY_PGACTL, 0xF000); - udelay(20); - trsw_rx -= 3; - if (b43_phy_read(dev, B43_PHY_LO_LEAKAGE) >= 0xDFC) - goto exit_loop2; - } - } else - trsw_rx = 0x18; - exit_loop2: - - if (phy->rev != 1) { /* Not in specs, but needed to prevent PPC machine check */ - b43_phy_write(dev, B43_PHY_ANALOGOVER, backup_phy[4]); - b43_phy_write(dev, B43_PHY_ANALOGOVERVAL, backup_phy[5]); - } - b43_phy_write(dev, B43_PHY_CCK(0x5A), backup_phy[6]); - b43_phy_write(dev, B43_PHY_CCK(0x59), backup_phy[7]); - b43_phy_write(dev, B43_PHY_CCK(0x58), backup_phy[8]); - b43_phy_write(dev, B43_PHY_CCK(0x0A), backup_phy[9]); - b43_phy_write(dev, B43_PHY_CCK(0x03), backup_phy[10]); - b43_phy_write(dev, B43_PHY_LO_MASK, backup_phy[11]); - b43_phy_write(dev, B43_PHY_LO_CTL, backup_phy[12]); - b43_phy_write(dev, B43_PHY_CCK(0x2B), backup_phy[13]); - b43_phy_write(dev, B43_PHY_PGACTL, backup_phy[14]); - - b43_gphy_set_baseband_attenuation(dev, backup_bband); - - b43_radio_write16(dev, 0x52, backup_radio[0]); - b43_radio_write16(dev, 0x43, backup_radio[1]); - b43_radio_write16(dev, 0x7A, backup_radio[2]); - - b43_phy_write(dev, B43_PHY_RFOVER, backup_phy[2] | 0x0003); - udelay(10); - b43_phy_write(dev, B43_PHY_RFOVER, backup_phy[2]); - b43_phy_write(dev, B43_PHY_RFOVERVAL, backup_phy[3]); - b43_phy_write(dev, B43_PHY_CRS0, backup_phy[0]); - b43_phy_write(dev, B43_PHY_CCKBBANDCFG, backup_phy[1]); - - gphy->max_lb_gain = - ((loop1_inner_done * 6) - (loop1_outer_done * 4)) - 11; - gphy->trsw_rx_gain = trsw_rx * 2; -} - -static void b43_hardware_pctl_early_init(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - - if (!b43_has_hardware_pctl(dev)) { - b43_phy_write(dev, 0x047A, 0xC111); - return; - } - - b43_phy_mask(dev, 0x0036, 0xFEFF); - b43_phy_write(dev, 0x002F, 0x0202); - b43_phy_set(dev, 0x047C, 0x0002); - b43_phy_set(dev, 0x047A, 0xF000); - if (phy->radio_ver == 0x2050 && phy->radio_rev == 8) { - b43_phy_maskset(dev, 0x047A, 0xFF0F, 0x0010); - b43_phy_set(dev, 0x005D, 0x8000); - b43_phy_maskset(dev, 0x004E, 0xFFC0, 0x0010); - b43_phy_write(dev, 0x002E, 0xC07F); - b43_phy_set(dev, 0x0036, 0x0400); - } else { - b43_phy_set(dev, 0x0036, 0x0200); - b43_phy_set(dev, 0x0036, 0x0400); - b43_phy_mask(dev, 0x005D, 0x7FFF); - b43_phy_mask(dev, 0x004F, 0xFFFE); - b43_phy_maskset(dev, 0x004E, 0xFFC0, 0x0010); - b43_phy_write(dev, 0x002E, 0xC07F); - b43_phy_maskset(dev, 0x047A, 0xFF0F, 0x0010); - } -} - -/* Hardware power control for G-PHY */ -static void b43_hardware_pctl_init_gphy(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - - if (!b43_has_hardware_pctl(dev)) { - /* No hardware power control */ - b43_hf_write(dev, b43_hf_read(dev) & ~B43_HF_HWPCTL); - return; - } - - b43_phy_maskset(dev, 0x0036, 0xFFC0, (gphy->tgt_idle_tssi - gphy->cur_idle_tssi)); - b43_phy_maskset(dev, 0x0478, 0xFF00, (gphy->tgt_idle_tssi - gphy->cur_idle_tssi)); - b43_gphy_tssi_power_lt_init(dev); - b43_gphy_gain_lt_init(dev); - b43_phy_mask(dev, 0x0060, 0xFFBF); - b43_phy_write(dev, 0x0014, 0x0000); - - B43_WARN_ON(phy->rev < 6); - b43_phy_set(dev, 0x0478, 0x0800); - b43_phy_mask(dev, 0x0478, 0xFEFF); - b43_phy_mask(dev, 0x0801, 0xFFBF); - - b43_gphy_dc_lt_init(dev, 1); - - /* Enable hardware pctl in firmware. */ - b43_hf_write(dev, b43_hf_read(dev) | B43_HF_HWPCTL); -} - -/* Initialize B/G PHY power control */ -static void b43_phy_init_pctl(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - struct b43_rfatt old_rfatt; - struct b43_bbatt old_bbatt; - u8 old_tx_control = 0; - - B43_WARN_ON(phy->type != B43_PHYTYPE_G); - - if ((dev->dev->board_vendor == SSB_BOARDVENDOR_BCM) && - (dev->dev->board_type == SSB_BOARD_BU4306)) - return; - - b43_phy_write(dev, 0x0028, 0x8018); - - /* This does something with the Analog... */ - b43_write16(dev, B43_MMIO_PHY0, b43_read16(dev, B43_MMIO_PHY0) - & 0xFFDF); - - if (!phy->gmode) - return; - b43_hardware_pctl_early_init(dev); - if (gphy->cur_idle_tssi == 0) { - if (phy->radio_ver == 0x2050 && phy->analog == 0) { - b43_radio_maskset(dev, 0x0076, 0x00F7, 0x0084); - } else { - struct b43_rfatt rfatt; - struct b43_bbatt bbatt; - - memcpy(&old_rfatt, &gphy->rfatt, sizeof(old_rfatt)); - memcpy(&old_bbatt, &gphy->bbatt, sizeof(old_bbatt)); - old_tx_control = gphy->tx_control; - - bbatt.att = 11; - if (phy->radio_rev == 8) { - rfatt.att = 15; - rfatt.with_padmix = true; - } else { - rfatt.att = 9; - rfatt.with_padmix = false; - } - b43_set_txpower_g(dev, &bbatt, &rfatt, 0); - } - b43_dummy_transmission(dev, false, true); - gphy->cur_idle_tssi = b43_phy_read(dev, B43_PHY_ITSSI); - if (B43_DEBUG) { - /* Current-Idle-TSSI sanity check. */ - if (abs(gphy->cur_idle_tssi - gphy->tgt_idle_tssi) >= 20) { - b43dbg(dev->wl, - "!WARNING! Idle-TSSI phy->cur_idle_tssi " - "measuring failed. (cur=%d, tgt=%d). Disabling TX power " - "adjustment.\n", gphy->cur_idle_tssi, - gphy->tgt_idle_tssi); - gphy->cur_idle_tssi = 0; - } - } - if (phy->radio_ver == 0x2050 && phy->analog == 0) { - b43_radio_mask(dev, 0x0076, 0xFF7B); - } else { - b43_set_txpower_g(dev, &old_bbatt, - &old_rfatt, old_tx_control); - } - } - b43_hardware_pctl_init_gphy(dev); - b43_shm_clear_tssi(dev); -} - -static void b43_phy_initg(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - u16 tmp; - - if (phy->rev == 1) - b43_phy_initb5(dev); - else - b43_phy_initb6(dev); - - if (phy->rev >= 2 || phy->gmode) - b43_phy_inita(dev); - - if (phy->rev >= 2) { - b43_phy_write(dev, B43_PHY_ANALOGOVER, 0); - b43_phy_write(dev, B43_PHY_ANALOGOVERVAL, 0); - } - if (phy->rev == 2) { - b43_phy_write(dev, B43_PHY_RFOVER, 0); - b43_phy_write(dev, B43_PHY_PGACTL, 0xC0); - } - if (phy->rev > 5) { - b43_phy_write(dev, B43_PHY_RFOVER, 0x400); - b43_phy_write(dev, B43_PHY_PGACTL, 0xC0); - } - if (phy->gmode || phy->rev >= 2) { - tmp = b43_phy_read(dev, B43_PHY_VERSION_OFDM); - tmp &= B43_PHYVER_VERSION; - if (tmp == 3 || tmp == 5) { - b43_phy_write(dev, B43_PHY_OFDM(0xC2), 0x1816); - b43_phy_write(dev, B43_PHY_OFDM(0xC3), 0x8006); - } - if (tmp == 5) { - b43_phy_maskset(dev, B43_PHY_OFDM(0xCC), 0x00FF, 0x1F00); - } - } - if ((phy->rev <= 2 && phy->gmode) || phy->rev >= 2) - b43_phy_write(dev, B43_PHY_OFDM(0x7E), 0x78); - if (phy->radio_rev == 8) { - b43_phy_set(dev, B43_PHY_EXTG(0x01), 0x80); - b43_phy_set(dev, B43_PHY_OFDM(0x3E), 0x4); - } - if (has_loopback_gain(phy)) - b43_calc_loopback_gain(dev); - - if (phy->radio_rev != 8) { - if (gphy->initval == 0xFFFF) - gphy->initval = b43_radio_init2050(dev); - else - b43_radio_write16(dev, 0x0078, gphy->initval); - } - b43_lo_g_init(dev); - if (has_tx_magnification(phy)) { - b43_radio_write16(dev, 0x52, - (b43_radio_read16(dev, 0x52) & 0xFF00) - | gphy->lo_control->tx_bias | gphy-> - lo_control->tx_magn); - } else { - b43_radio_maskset(dev, 0x52, 0xFFF0, gphy->lo_control->tx_bias); - } - if (phy->rev >= 6) { - b43_phy_maskset(dev, B43_PHY_CCK(0x36), 0x0FFF, (gphy->lo_control->tx_bias << 12)); - } - if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL) - b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x8075); - else - b43_phy_write(dev, B43_PHY_CCK(0x2E), 0x807F); - if (phy->rev < 2) - b43_phy_write(dev, B43_PHY_CCK(0x2F), 0x101); - else - b43_phy_write(dev, B43_PHY_CCK(0x2F), 0x202); - if (phy->gmode || phy->rev >= 2) { - b43_lo_g_adjust(dev); - b43_phy_write(dev, B43_PHY_LO_MASK, 0x8078); - } - - if (!(dev->dev->bus_sprom->boardflags_lo & B43_BFL_RSSI)) { - /* The specs state to update the NRSSI LT with - * the value 0x7FFFFFFF here. I think that is some weird - * compiler optimization in the original driver. - * Essentially, what we do here is resetting all NRSSI LT - * entries to -32 (see the clamp_val() in nrssi_hw_update()) - */ - b43_nrssi_hw_update(dev, 0xFFFF); //FIXME? - b43_calc_nrssi_threshold(dev); - } else if (phy->gmode || phy->rev >= 2) { - if (gphy->nrssi[0] == -1000) { - B43_WARN_ON(gphy->nrssi[1] != -1000); - b43_calc_nrssi_slope(dev); - } else - b43_calc_nrssi_threshold(dev); - } - if (phy->radio_rev == 8) - b43_phy_write(dev, B43_PHY_EXTG(0x05), 0x3230); - b43_phy_init_pctl(dev); - /* FIXME: The spec says in the following if, the 0 should be replaced - 'if OFDM may not be used in the current locale' - but OFDM is legal everywhere */ - if ((dev->dev->chip_id == 0x4306 - && dev->dev->chip_pkg == 2) || 0) { - b43_phy_mask(dev, B43_PHY_CRS0, 0xBFFF); - b43_phy_mask(dev, B43_PHY_OFDM(0xC3), 0x7FFF); - } -} - -void b43_gphy_channel_switch(struct b43_wldev *dev, - unsigned int channel, - bool synthetic_pu_workaround) -{ - if (synthetic_pu_workaround) - b43_synth_pu_workaround(dev, channel); - - b43_write16(dev, B43_MMIO_CHANNEL, channel2freq_bg(channel)); - - if (channel == 14) { - if (dev->dev->bus_sprom->country_code == - SSB_SPROM1CCODE_JAPAN) - b43_hf_write(dev, - b43_hf_read(dev) & ~B43_HF_ACPR); - else - b43_hf_write(dev, - b43_hf_read(dev) | B43_HF_ACPR); - b43_write16(dev, B43_MMIO_CHANNEL_EXT, - b43_read16(dev, B43_MMIO_CHANNEL_EXT) - | (1 << 11)); - } else { - b43_write16(dev, B43_MMIO_CHANNEL_EXT, - b43_read16(dev, B43_MMIO_CHANNEL_EXT) - & 0xF7BF); - } -} - -static void default_baseband_attenuation(struct b43_wldev *dev, - struct b43_bbatt *bb) -{ - struct b43_phy *phy = &dev->phy; - - if (phy->radio_ver == 0x2050 && phy->radio_rev < 6) - bb->att = 0; - else - bb->att = 2; -} - -static void default_radio_attenuation(struct b43_wldev *dev, - struct b43_rfatt *rf) -{ - struct b43_bus_dev *bdev = dev->dev; - struct b43_phy *phy = &dev->phy; - - rf->with_padmix = false; - - if (dev->dev->board_vendor == SSB_BOARDVENDOR_BCM && - dev->dev->board_type == SSB_BOARD_BCM4309G) { - if (dev->dev->board_rev < 0x43) { - rf->att = 2; - return; - } else if (dev->dev->board_rev < 0x51) { - rf->att = 3; - return; - } - } - - if (phy->type == B43_PHYTYPE_A) { - rf->att = 0x60; - return; - } - - switch (phy->radio_ver) { - case 0x2053: - switch (phy->radio_rev) { - case 1: - rf->att = 6; - return; - } - break; - case 0x2050: - switch (phy->radio_rev) { - case 0: - rf->att = 5; - return; - case 1: - if (phy->type == B43_PHYTYPE_G) { - if (bdev->board_vendor == SSB_BOARDVENDOR_BCM - && bdev->board_type == SSB_BOARD_BCM4309G - && bdev->board_rev >= 30) - rf->att = 3; - else if (bdev->board_vendor == - SSB_BOARDVENDOR_BCM - && bdev->board_type == - SSB_BOARD_BU4306) - rf->att = 3; - else - rf->att = 1; - } else { - if (bdev->board_vendor == SSB_BOARDVENDOR_BCM - && bdev->board_type == SSB_BOARD_BCM4309G - && bdev->board_rev >= 30) - rf->att = 7; - else - rf->att = 6; - } - return; - case 2: - if (phy->type == B43_PHYTYPE_G) { - if (bdev->board_vendor == SSB_BOARDVENDOR_BCM - && bdev->board_type == SSB_BOARD_BCM4309G - && bdev->board_rev >= 30) - rf->att = 3; - else if (bdev->board_vendor == - SSB_BOARDVENDOR_BCM - && bdev->board_type == - SSB_BOARD_BU4306) - rf->att = 5; - else if (bdev->chip_id == 0x4320) - rf->att = 4; - else - rf->att = 3; - } else - rf->att = 6; - return; - case 3: - rf->att = 5; - return; - case 4: - case 5: - rf->att = 1; - return; - case 6: - case 7: - rf->att = 5; - return; - case 8: - rf->att = 0xA; - rf->with_padmix = true; - return; - case 9: - default: - rf->att = 5; - return; - } - } - rf->att = 5; -} - -static u16 default_tx_control(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - - if (phy->radio_ver != 0x2050) - return 0; - if (phy->radio_rev == 1) - return B43_TXCTL_PA2DB | B43_TXCTL_TXMIX; - if (phy->radio_rev < 6) - return B43_TXCTL_PA2DB; - if (phy->radio_rev == 8) - return B43_TXCTL_TXMIX; - return 0; -} - -static u8 b43_gphy_aci_detect(struct b43_wldev *dev, u8 channel) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - u8 ret = 0; - u16 saved, rssi, temp; - int i, j = 0; - - saved = b43_phy_read(dev, 0x0403); - b43_switch_channel(dev, channel); - b43_phy_write(dev, 0x0403, (saved & 0xFFF8) | 5); - if (gphy->aci_hw_rssi) - rssi = b43_phy_read(dev, 0x048A) & 0x3F; - else - rssi = saved & 0x3F; - /* clamp temp to signed 5bit */ - if (rssi > 32) - rssi -= 64; - for (i = 0; i < 100; i++) { - temp = (b43_phy_read(dev, 0x047F) >> 8) & 0x3F; - if (temp > 32) - temp -= 64; - if (temp < rssi) - j++; - if (j >= 20) - ret = 1; - } - b43_phy_write(dev, 0x0403, saved); - - return ret; -} - -static u8 b43_gphy_aci_scan(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - u8 ret[13]; - unsigned int channel = phy->channel; - unsigned int i, j, start, end; - - if (!((phy->type == B43_PHYTYPE_G) && (phy->rev > 0))) - return 0; - - b43_phy_lock(dev); - b43_radio_lock(dev); - b43_phy_mask(dev, 0x0802, 0xFFFC); - b43_phy_mask(dev, B43_PHY_G_CRS, 0x7FFF); - b43_set_all_gains(dev, 3, 8, 1); - - start = (channel - 5 > 0) ? channel - 5 : 1; - end = (channel + 5 < 14) ? channel + 5 : 13; - - for (i = start; i <= end; i++) { - if (abs(channel - i) > 2) - ret[i - 1] = b43_gphy_aci_detect(dev, i); - } - b43_switch_channel(dev, channel); - b43_phy_maskset(dev, 0x0802, 0xFFFC, 0x0003); - b43_phy_mask(dev, 0x0403, 0xFFF8); - b43_phy_set(dev, B43_PHY_G_CRS, 0x8000); - b43_set_original_gains(dev); - for (i = 0; i < 13; i++) { - if (!ret[i]) - continue; - end = (i + 5 < 13) ? i + 5 : 13; - for (j = i; j < end; j++) - ret[j] = 1; - } - b43_radio_unlock(dev); - b43_phy_unlock(dev); - - return ret[channel - 1]; -} - -static s32 b43_tssi2dbm_ad(s32 num, s32 den) -{ - if (num < 0) - return num / den; - else - return (num + den / 2) / den; -} - -static s8 b43_tssi2dbm_entry(s8 entry[], u8 index, - s16 pab0, s16 pab1, s16 pab2) -{ - s32 m1, m2, f = 256, q, delta; - s8 i = 0; - - m1 = b43_tssi2dbm_ad(16 * pab0 + index * pab1, 32); - m2 = max(b43_tssi2dbm_ad(32768 + index * pab2, 256), 1); - do { - if (i > 15) - return -EINVAL; - q = b43_tssi2dbm_ad(f * 4096 - - b43_tssi2dbm_ad(m2 * f, 16) * f, 2048); - delta = abs(q - f); - f = q; - i++; - } while (delta >= 2); - entry[index] = clamp_val(b43_tssi2dbm_ad(m1 * f, 8192), -127, 128); - return 0; -} - -u8 *b43_generate_dyn_tssi2dbm_tab(struct b43_wldev *dev, - s16 pab0, s16 pab1, s16 pab2) -{ - unsigned int i; - u8 *tab; - int err; - - tab = kmalloc(64, GFP_KERNEL); - if (!tab) { - b43err(dev->wl, "Could not allocate memory " - "for tssi2dbm table\n"); - return NULL; - } - for (i = 0; i < 64; i++) { - err = b43_tssi2dbm_entry(tab, i, pab0, pab1, pab2); - if (err) { - b43err(dev->wl, "Could not generate " - "tssi2dBm table\n"); - kfree(tab); - return NULL; - } - } - - return tab; -} - -/* Initialise the TSSI->dBm lookup table */ -static int b43_gphy_init_tssi2dbm_table(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - s16 pab0, pab1, pab2; - - pab0 = (s16) (dev->dev->bus_sprom->pa0b0); - pab1 = (s16) (dev->dev->bus_sprom->pa0b1); - pab2 = (s16) (dev->dev->bus_sprom->pa0b2); - - B43_WARN_ON((dev->dev->chip_id == 0x4301) && - (phy->radio_ver != 0x2050)); /* Not supported anymore */ - - gphy->dyn_tssi_tbl = false; - - if (pab0 != 0 && pab1 != 0 && pab2 != 0 && - pab0 != -1 && pab1 != -1 && pab2 != -1) { - /* The pabX values are set in SPROM. Use them. */ - if ((s8) dev->dev->bus_sprom->itssi_bg != 0 && - (s8) dev->dev->bus_sprom->itssi_bg != -1) { - gphy->tgt_idle_tssi = - (s8) (dev->dev->bus_sprom->itssi_bg); - } else - gphy->tgt_idle_tssi = 62; - gphy->tssi2dbm = b43_generate_dyn_tssi2dbm_tab(dev, pab0, - pab1, pab2); - if (!gphy->tssi2dbm) - return -ENOMEM; - gphy->dyn_tssi_tbl = true; - } else { - /* pabX values not set in SPROM. */ - gphy->tgt_idle_tssi = 52; - gphy->tssi2dbm = b43_tssi2dbm_g_table; - } - - return 0; -} - -static int b43_gphy_op_allocate(struct b43_wldev *dev) -{ - struct b43_phy_g *gphy; - struct b43_txpower_lo_control *lo; - int err; - - gphy = kzalloc(sizeof(*gphy), GFP_KERNEL); - if (!gphy) { - err = -ENOMEM; - goto error; - } - dev->phy.g = gphy; - - lo = kzalloc(sizeof(*lo), GFP_KERNEL); - if (!lo) { - err = -ENOMEM; - goto err_free_gphy; - } - gphy->lo_control = lo; - - err = b43_gphy_init_tssi2dbm_table(dev); - if (err) - goto err_free_lo; - - return 0; - -err_free_lo: - kfree(lo); -err_free_gphy: - kfree(gphy); -error: - return err; -} - -static void b43_gphy_op_prepare_structs(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - const void *tssi2dbm; - int tgt_idle_tssi; - struct b43_txpower_lo_control *lo; - unsigned int i; - - /* tssi2dbm table is constant, so it is initialized at alloc time. - * Save a copy of the pointer. */ - tssi2dbm = gphy->tssi2dbm; - tgt_idle_tssi = gphy->tgt_idle_tssi; - /* Save the LO pointer. */ - lo = gphy->lo_control; - - /* Zero out the whole PHY structure. */ - memset(gphy, 0, sizeof(*gphy)); - - /* Restore pointers. */ - gphy->tssi2dbm = tssi2dbm; - gphy->tgt_idle_tssi = tgt_idle_tssi; - gphy->lo_control = lo; - - memset(gphy->minlowsig, 0xFF, sizeof(gphy->minlowsig)); - - /* NRSSI */ - for (i = 0; i < ARRAY_SIZE(gphy->nrssi); i++) - gphy->nrssi[i] = -1000; - for (i = 0; i < ARRAY_SIZE(gphy->nrssi_lt); i++) - gphy->nrssi_lt[i] = i; - - gphy->lofcal = 0xFFFF; - gphy->initval = 0xFFFF; - - gphy->interfmode = B43_INTERFMODE_NONE; - - /* OFDM-table address caching. */ - gphy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_UNKNOWN; - - gphy->average_tssi = 0xFF; - - /* Local Osciallator structure */ - lo->tx_bias = 0xFF; - INIT_LIST_HEAD(&lo->calib_list); -} - -static void b43_gphy_op_free(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - - kfree(gphy->lo_control); - - if (gphy->dyn_tssi_tbl) - kfree(gphy->tssi2dbm); - gphy->dyn_tssi_tbl = false; - gphy->tssi2dbm = NULL; - - kfree(gphy); - dev->phy.g = NULL; -} - -static int b43_gphy_op_prepare_hardware(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - struct b43_txpower_lo_control *lo = gphy->lo_control; - - B43_WARN_ON(phy->type != B43_PHYTYPE_G); - - default_baseband_attenuation(dev, &gphy->bbatt); - default_radio_attenuation(dev, &gphy->rfatt); - gphy->tx_control = (default_tx_control(dev) << 4); - generate_rfatt_list(dev, &lo->rfatt_list); - generate_bbatt_list(dev, &lo->bbatt_list); - - /* Commit previous writes */ - b43_read32(dev, B43_MMIO_MACCTL); - - if (phy->rev == 1) { - /* Workaround: Temporarly disable gmode through the early init - * phase, as the gmode stuff is not needed for phy rev 1 */ - phy->gmode = false; - b43_wireless_core_reset(dev, 0); - b43_phy_initg(dev); - phy->gmode = true; - b43_wireless_core_reset(dev, 1); - } - - return 0; -} - -static int b43_gphy_op_init(struct b43_wldev *dev) -{ - b43_phy_initg(dev); - - return 0; -} - -static void b43_gphy_op_exit(struct b43_wldev *dev) -{ - b43_lo_g_cleanup(dev); -} - -static u16 b43_gphy_op_read(struct b43_wldev *dev, u16 reg) -{ - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - return b43_read16(dev, B43_MMIO_PHY_DATA); -} - -static void b43_gphy_op_write(struct b43_wldev *dev, u16 reg, u16 value) -{ - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - b43_write16(dev, B43_MMIO_PHY_DATA, value); -} - -static u16 b43_gphy_op_radio_read(struct b43_wldev *dev, u16 reg) -{ - /* Register 1 is a 32-bit register. */ - B43_WARN_ON(reg == 1); - /* G-PHY needs 0x80 for read access. */ - reg |= 0x80; - - b43_write16(dev, B43_MMIO_RADIO_CONTROL, reg); - return b43_read16(dev, B43_MMIO_RADIO_DATA_LOW); -} - -static void b43_gphy_op_radio_write(struct b43_wldev *dev, u16 reg, u16 value) -{ - /* Register 1 is a 32-bit register. */ - B43_WARN_ON(reg == 1); - - b43_write16(dev, B43_MMIO_RADIO_CONTROL, reg); - b43_write16(dev, B43_MMIO_RADIO_DATA_LOW, value); -} - -static bool b43_gphy_op_supports_hwpctl(struct b43_wldev *dev) -{ - return (dev->phy.rev >= 6); -} - -static void b43_gphy_op_software_rfkill(struct b43_wldev *dev, - bool blocked) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - unsigned int channel; - - might_sleep(); - - if (!blocked) { - /* Turn radio ON */ - if (phy->radio_on) - return; - - b43_phy_write(dev, 0x0015, 0x8000); - b43_phy_write(dev, 0x0015, 0xCC00); - b43_phy_write(dev, 0x0015, (phy->gmode ? 0x00C0 : 0x0000)); - if (gphy->radio_off_context.valid) { - /* Restore the RFover values. */ - b43_phy_write(dev, B43_PHY_RFOVER, - gphy->radio_off_context.rfover); - b43_phy_write(dev, B43_PHY_RFOVERVAL, - gphy->radio_off_context.rfoverval); - gphy->radio_off_context.valid = false; - } - channel = phy->channel; - b43_gphy_channel_switch(dev, 6, 1); - b43_gphy_channel_switch(dev, channel, 0); - } else { - /* Turn radio OFF */ - u16 rfover, rfoverval; - - rfover = b43_phy_read(dev, B43_PHY_RFOVER); - rfoverval = b43_phy_read(dev, B43_PHY_RFOVERVAL); - gphy->radio_off_context.rfover = rfover; - gphy->radio_off_context.rfoverval = rfoverval; - gphy->radio_off_context.valid = true; - b43_phy_write(dev, B43_PHY_RFOVER, rfover | 0x008C); - b43_phy_write(dev, B43_PHY_RFOVERVAL, rfoverval & 0xFF73); - } -} - -static int b43_gphy_op_switch_channel(struct b43_wldev *dev, - unsigned int new_channel) -{ - if ((new_channel < 1) || (new_channel > 14)) - return -EINVAL; - b43_gphy_channel_switch(dev, new_channel, 0); - - return 0; -} - -static unsigned int b43_gphy_op_get_default_chan(struct b43_wldev *dev) -{ - return 1; /* Default to channel 1 */ -} - -static void b43_gphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna) -{ - struct b43_phy *phy = &dev->phy; - u16 tmp; - int autodiv = 0; - - if (antenna == B43_ANTENNA_AUTO0 || antenna == B43_ANTENNA_AUTO1) - autodiv = 1; - - b43_hf_write(dev, b43_hf_read(dev) & ~B43_HF_ANTDIVHELP); - - b43_phy_maskset(dev, B43_PHY_BBANDCFG, ~B43_PHY_BBANDCFG_RXANT, - (autodiv ? B43_ANTENNA_AUTO1 : antenna) << - B43_PHY_BBANDCFG_RXANT_SHIFT); - - if (autodiv) { - tmp = b43_phy_read(dev, B43_PHY_ANTDWELL); - if (antenna == B43_ANTENNA_AUTO1) - tmp &= ~B43_PHY_ANTDWELL_AUTODIV1; - else - tmp |= B43_PHY_ANTDWELL_AUTODIV1; - b43_phy_write(dev, B43_PHY_ANTDWELL, tmp); - } - - tmp = b43_phy_read(dev, B43_PHY_ANTWRSETT); - if (autodiv) - tmp |= B43_PHY_ANTWRSETT_ARXDIV; - else - tmp &= ~B43_PHY_ANTWRSETT_ARXDIV; - b43_phy_write(dev, B43_PHY_ANTWRSETT, tmp); - - if (autodiv) - b43_phy_set(dev, B43_PHY_ANTWRSETT, B43_PHY_ANTWRSETT_ARXDIV); - else { - b43_phy_mask(dev, B43_PHY_ANTWRSETT, - B43_PHY_ANTWRSETT_ARXDIV); - } - - if (phy->rev >= 2) { - b43_phy_set(dev, B43_PHY_OFDM61, B43_PHY_OFDM61_10); - b43_phy_maskset(dev, B43_PHY_DIVSRCHGAINBACK, 0xFF00, 0x15); - - if (phy->rev == 2) - b43_phy_write(dev, B43_PHY_ADIVRELATED, 8); - else - b43_phy_maskset(dev, B43_PHY_ADIVRELATED, 0xFF00, 8); - } - if (phy->rev >= 6) - b43_phy_write(dev, B43_PHY_OFDM9B, 0xDC); - - b43_hf_write(dev, b43_hf_read(dev) | B43_HF_ANTDIVHELP); -} - -static int b43_gphy_op_interf_mitigation(struct b43_wldev *dev, - enum b43_interference_mitigation mode) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - int currentmode; - - B43_WARN_ON(phy->type != B43_PHYTYPE_G); - if ((phy->rev == 0) || (!phy->gmode)) - return -ENODEV; - - gphy->aci_wlan_automatic = false; - switch (mode) { - case B43_INTERFMODE_AUTOWLAN: - gphy->aci_wlan_automatic = true; - if (gphy->aci_enable) - mode = B43_INTERFMODE_MANUALWLAN; - else - mode = B43_INTERFMODE_NONE; - break; - case B43_INTERFMODE_NONE: - case B43_INTERFMODE_NONWLAN: - case B43_INTERFMODE_MANUALWLAN: - break; - default: - return -EINVAL; - } - - currentmode = gphy->interfmode; - if (currentmode == mode) - return 0; - if (currentmode != B43_INTERFMODE_NONE) - b43_radio_interference_mitigation_disable(dev, currentmode); - - if (mode == B43_INTERFMODE_NONE) { - gphy->aci_enable = false; - gphy->aci_hw_rssi = false; - } else - b43_radio_interference_mitigation_enable(dev, mode); - gphy->interfmode = mode; - - return 0; -} - -/* http://bcm-specs.sipsolutions.net/EstimatePowerOut - * This function converts a TSSI value to dBm in Q5.2 - */ -static s8 b43_gphy_estimate_power_out(struct b43_wldev *dev, s8 tssi) -{ - struct b43_phy_g *gphy = dev->phy.g; - s8 dbm; - s32 tmp; - - tmp = (gphy->tgt_idle_tssi - gphy->cur_idle_tssi + tssi); - tmp = clamp_val(tmp, 0x00, 0x3F); - dbm = gphy->tssi2dbm[tmp]; - - return dbm; -} - -static void b43_put_attenuation_into_ranges(struct b43_wldev *dev, - int *_bbatt, int *_rfatt) -{ - int rfatt = *_rfatt; - int bbatt = *_bbatt; - struct b43_txpower_lo_control *lo = dev->phy.g->lo_control; - - /* Get baseband and radio attenuation values into their permitted ranges. - * Radio attenuation affects power level 4 times as much as baseband. */ - - /* Range constants */ - const int rf_min = lo->rfatt_list.min_val; - const int rf_max = lo->rfatt_list.max_val; - const int bb_min = lo->bbatt_list.min_val; - const int bb_max = lo->bbatt_list.max_val; - - while (1) { - if (rfatt > rf_max && bbatt > bb_max - 4) - break; /* Can not get it into ranges */ - if (rfatt < rf_min && bbatt < bb_min + 4) - break; /* Can not get it into ranges */ - if (bbatt > bb_max && rfatt > rf_max - 1) - break; /* Can not get it into ranges */ - if (bbatt < bb_min && rfatt < rf_min + 1) - break; /* Can not get it into ranges */ - - if (bbatt > bb_max) { - bbatt -= 4; - rfatt += 1; - continue; - } - if (bbatt < bb_min) { - bbatt += 4; - rfatt -= 1; - continue; - } - if (rfatt > rf_max) { - rfatt -= 1; - bbatt += 4; - continue; - } - if (rfatt < rf_min) { - rfatt += 1; - bbatt -= 4; - continue; - } - break; - } - - *_rfatt = clamp_val(rfatt, rf_min, rf_max); - *_bbatt = clamp_val(bbatt, bb_min, bb_max); -} - -static void b43_gphy_op_adjust_txpower(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - int rfatt, bbatt; - u8 tx_control; - - b43_mac_suspend(dev); - - /* Calculate the new attenuation values. */ - bbatt = gphy->bbatt.att; - bbatt += gphy->bbatt_delta; - rfatt = gphy->rfatt.att; - rfatt += gphy->rfatt_delta; - - b43_put_attenuation_into_ranges(dev, &bbatt, &rfatt); - tx_control = gphy->tx_control; - if ((phy->radio_ver == 0x2050) && (phy->radio_rev == 2)) { - if (rfatt <= 1) { - if (tx_control == 0) { - tx_control = - B43_TXCTL_PA2DB | - B43_TXCTL_TXMIX; - rfatt += 2; - bbatt += 2; - } else if (dev->dev->bus_sprom-> - boardflags_lo & - B43_BFL_PACTRL) { - bbatt += 4 * (rfatt - 2); - rfatt = 2; - } - } else if (rfatt > 4 && tx_control) { - tx_control = 0; - if (bbatt < 3) { - rfatt -= 3; - bbatt += 2; - } else { - rfatt -= 2; - bbatt -= 2; - } - } - } - /* Save the control values */ - gphy->tx_control = tx_control; - b43_put_attenuation_into_ranges(dev, &bbatt, &rfatt); - gphy->rfatt.att = rfatt; - gphy->bbatt.att = bbatt; - - if (b43_debug(dev, B43_DBG_XMITPOWER)) - b43dbg(dev->wl, "Adjusting TX power\n"); - - /* Adjust the hardware */ - b43_phy_lock(dev); - b43_radio_lock(dev); - b43_set_txpower_g(dev, &gphy->bbatt, &gphy->rfatt, - gphy->tx_control); - b43_radio_unlock(dev); - b43_phy_unlock(dev); - - b43_mac_enable(dev); -} - -static enum b43_txpwr_result b43_gphy_op_recalc_txpower(struct b43_wldev *dev, - bool ignore_tssi) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - unsigned int average_tssi; - int cck_result, ofdm_result; - int estimated_pwr, desired_pwr, pwr_adjust; - int rfatt_delta, bbatt_delta; - unsigned int max_pwr; - - /* First get the average TSSI */ - cck_result = b43_phy_shm_tssi_read(dev, B43_SHM_SH_TSSI_CCK); - ofdm_result = b43_phy_shm_tssi_read(dev, B43_SHM_SH_TSSI_OFDM_G); - if ((cck_result < 0) && (ofdm_result < 0)) { - /* No TSSI information available */ - if (!ignore_tssi) - goto no_adjustment_needed; - cck_result = 0; - ofdm_result = 0; - } - if (cck_result < 0) - average_tssi = ofdm_result; - else if (ofdm_result < 0) - average_tssi = cck_result; - else - average_tssi = (cck_result + ofdm_result) / 2; - /* Merge the average with the stored value. */ - if (likely(gphy->average_tssi != 0xFF)) - average_tssi = (average_tssi + gphy->average_tssi) / 2; - gphy->average_tssi = average_tssi; - B43_WARN_ON(average_tssi >= B43_TSSI_MAX); - - /* Estimate the TX power emission based on the TSSI */ - estimated_pwr = b43_gphy_estimate_power_out(dev, average_tssi); - - B43_WARN_ON(phy->type != B43_PHYTYPE_G); - max_pwr = dev->dev->bus_sprom->maxpwr_bg; - if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_PACTRL) - max_pwr -= 3; /* minus 0.75 */ - if (unlikely(max_pwr >= INT_TO_Q52(30/*dBm*/))) { - b43warn(dev->wl, - "Invalid max-TX-power value in SPROM.\n"); - max_pwr = INT_TO_Q52(20); /* fake it */ - dev->dev->bus_sprom->maxpwr_bg = max_pwr; - } - - /* Get desired power (in Q5.2) */ - if (phy->desired_txpower < 0) - desired_pwr = INT_TO_Q52(0); - else - desired_pwr = INT_TO_Q52(phy->desired_txpower); - /* And limit it. max_pwr already is Q5.2 */ - desired_pwr = clamp_val(desired_pwr, 0, max_pwr); - if (b43_debug(dev, B43_DBG_XMITPOWER)) { - b43dbg(dev->wl, - "[TX power] current = " Q52_FMT - " dBm, desired = " Q52_FMT - " dBm, max = " Q52_FMT "\n", - Q52_ARG(estimated_pwr), - Q52_ARG(desired_pwr), - Q52_ARG(max_pwr)); - } - - /* Calculate the adjustment delta. */ - pwr_adjust = desired_pwr - estimated_pwr; - if (pwr_adjust == 0) - goto no_adjustment_needed; - - /* RF attenuation delta. */ - rfatt_delta = ((pwr_adjust + 7) / 8); - /* Lower attenuation => Bigger power output. Negate it. */ - rfatt_delta = -rfatt_delta; - - /* Baseband attenuation delta. */ - bbatt_delta = pwr_adjust / 2; - /* Lower attenuation => Bigger power output. Negate it. */ - bbatt_delta = -bbatt_delta; - /* RF att affects power level 4 times as much as - * Baseband attennuation. Subtract it. */ - bbatt_delta -= 4 * rfatt_delta; - -#if B43_DEBUG - if (b43_debug(dev, B43_DBG_XMITPOWER)) { - int dbm = pwr_adjust < 0 ? -pwr_adjust : pwr_adjust; - b43dbg(dev->wl, - "[TX power deltas] %s" Q52_FMT " dBm => " - "bbatt-delta = %d, rfatt-delta = %d\n", - (pwr_adjust < 0 ? "-" : ""), Q52_ARG(dbm), - bbatt_delta, rfatt_delta); - } -#endif /* DEBUG */ - - /* So do we finally need to adjust something in hardware? */ - if ((rfatt_delta == 0) && (bbatt_delta == 0)) - goto no_adjustment_needed; - - /* Save the deltas for later when we adjust the power. */ - gphy->bbatt_delta = bbatt_delta; - gphy->rfatt_delta = rfatt_delta; - - /* We need to adjust the TX power on the device. */ - return B43_TXPWR_RES_NEED_ADJUST; - -no_adjustment_needed: - return B43_TXPWR_RES_DONE; -} - -static void b43_gphy_op_pwork_15sec(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - - b43_mac_suspend(dev); - //TODO: update_aci_moving_average - if (gphy->aci_enable && gphy->aci_wlan_automatic) { - if (!gphy->aci_enable && 1 /*TODO: not scanning? */ ) { - if (0 /*TODO: bunch of conditions */ ) { - phy->ops->interf_mitigation(dev, - B43_INTERFMODE_MANUALWLAN); - } - } else if (0 /*TODO*/) { - if (/*(aci_average > 1000) &&*/ !b43_gphy_aci_scan(dev)) - phy->ops->interf_mitigation(dev, B43_INTERFMODE_NONE); - } - } else if (gphy->interfmode == B43_INTERFMODE_NONWLAN && - phy->rev == 1) { - //TODO: implement rev1 workaround - } - b43_lo_g_maintanance_work(dev); - b43_mac_enable(dev); -} - -static void b43_gphy_op_pwork_60sec(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - - if (!(dev->dev->bus_sprom->boardflags_lo & B43_BFL_RSSI)) - return; - - b43_mac_suspend(dev); - b43_calc_nrssi_slope(dev); - if ((phy->radio_ver == 0x2050) && (phy->radio_rev == 8)) { - u8 old_chan = phy->channel; - - /* VCO Calibration */ - if (old_chan >= 8) - b43_switch_channel(dev, 1); - else - b43_switch_channel(dev, 13); - b43_switch_channel(dev, old_chan); - } - b43_mac_enable(dev); -} - -const struct b43_phy_operations b43_phyops_g = { - .allocate = b43_gphy_op_allocate, - .free = b43_gphy_op_free, - .prepare_structs = b43_gphy_op_prepare_structs, - .prepare_hardware = b43_gphy_op_prepare_hardware, - .init = b43_gphy_op_init, - .exit = b43_gphy_op_exit, - .phy_read = b43_gphy_op_read, - .phy_write = b43_gphy_op_write, - .radio_read = b43_gphy_op_radio_read, - .radio_write = b43_gphy_op_radio_write, - .supports_hwpctl = b43_gphy_op_supports_hwpctl, - .software_rfkill = b43_gphy_op_software_rfkill, - .switch_analog = b43_phyop_switch_analog_generic, - .switch_channel = b43_gphy_op_switch_channel, - .get_default_chan = b43_gphy_op_get_default_chan, - .set_rx_antenna = b43_gphy_op_set_rx_antenna, - .interf_mitigation = b43_gphy_op_interf_mitigation, - .recalc_txpower = b43_gphy_op_recalc_txpower, - .adjust_txpower = b43_gphy_op_adjust_txpower, - .pwork_15sec = b43_gphy_op_pwork_15sec, - .pwork_60sec = b43_gphy_op_pwork_60sec, -}; diff --git a/drivers/net/wireless/b43/phy_g.h b/drivers/net/wireless/b43/phy_g.h deleted file mode 100644 index 5413c906a3e7..000000000000 --- a/drivers/net/wireless/b43/phy_g.h +++ /dev/null @@ -1,208 +0,0 @@ -#ifndef LINUX_B43_PHY_G_H_ -#define LINUX_B43_PHY_G_H_ - -/* OFDM PHY registers are defined in the A-PHY header. */ -#include "phy_a.h" - -/* CCK (B) PHY Registers */ -#define B43_PHY_VERSION_CCK B43_PHY_CCK(0x00) /* Versioning register for B-PHY */ -#define B43_PHY_CCKBBANDCFG B43_PHY_CCK(0x01) /* Contains antenna 0/1 control bit */ -#define B43_PHY_PGACTL B43_PHY_CCK(0x15) /* PGA control */ -#define B43_PHY_PGACTL_LPF 0x1000 /* Low pass filter (?) */ -#define B43_PHY_PGACTL_LOWBANDW 0x0040 /* Low bandwidth flag */ -#define B43_PHY_PGACTL_UNKNOWN 0xEFA0 -#define B43_PHY_FBCTL1 B43_PHY_CCK(0x18) /* Frequency bandwidth control 1 */ -#define B43_PHY_ITSSI B43_PHY_CCK(0x29) /* Idle TSSI */ -#define B43_PHY_LO_LEAKAGE B43_PHY_CCK(0x2D) /* Measured LO leakage */ -#define B43_PHY_ENERGY B43_PHY_CCK(0x33) /* Energy */ -#define B43_PHY_SYNCCTL B43_PHY_CCK(0x35) -#define B43_PHY_FBCTL2 B43_PHY_CCK(0x38) /* Frequency bandwidth control 2 */ -#define B43_PHY_DACCTL B43_PHY_CCK(0x60) /* DAC control */ -#define B43_PHY_RCCALOVER B43_PHY_CCK(0x78) /* RC calibration override */ - -/* Extended G-PHY Registers */ -#define B43_PHY_CLASSCTL B43_PHY_EXTG(0x02) /* Classify control */ -#define B43_PHY_GTABCTL B43_PHY_EXTG(0x03) /* G-PHY table control (see below) */ -#define B43_PHY_GTABOFF 0x03FF /* G-PHY table offset (see below) */ -#define B43_PHY_GTABNR 0xFC00 /* G-PHY table number (see below) */ -#define B43_PHY_GTABNR_SHIFT 10 -#define B43_PHY_GTABDATA B43_PHY_EXTG(0x04) /* G-PHY table data */ -#define B43_PHY_LO_MASK B43_PHY_EXTG(0x0F) /* Local Oscillator control mask */ -#define B43_PHY_LO_CTL B43_PHY_EXTG(0x10) /* Local Oscillator control */ -#define B43_PHY_RFOVER B43_PHY_EXTG(0x11) /* RF override */ -#define B43_PHY_RFOVERVAL B43_PHY_EXTG(0x12) /* RF override value */ -#define B43_PHY_RFOVERVAL_EXTLNA 0x8000 -#define B43_PHY_RFOVERVAL_LNA 0x7000 -#define B43_PHY_RFOVERVAL_LNA_SHIFT 12 -#define B43_PHY_RFOVERVAL_PGA 0x0F00 -#define B43_PHY_RFOVERVAL_PGA_SHIFT 8 -#define B43_PHY_RFOVERVAL_UNK 0x0010 /* Unknown, always set. */ -#define B43_PHY_RFOVERVAL_TRSWRX 0x00E0 -#define B43_PHY_RFOVERVAL_BW 0x0003 /* Bandwidth flags */ -#define B43_PHY_RFOVERVAL_BW_LPF 0x0001 /* Low Pass Filter */ -#define B43_PHY_RFOVERVAL_BW_LBW 0x0002 /* Low Bandwidth (when set), high when unset */ -#define B43_PHY_ANALOGOVER B43_PHY_EXTG(0x14) /* Analog override */ -#define B43_PHY_ANALOGOVERVAL B43_PHY_EXTG(0x15) /* Analog override value */ - - -/*** G-PHY table numbers */ -#define B43_GTAB(number, offset) (((number) << B43_PHY_GTABNR_SHIFT) | (offset)) -#define B43_GTAB_NRSSI B43_GTAB(0x00, 0) -#define B43_GTAB_TRFEMW B43_GTAB(0x0C, 0x120) -#define B43_GTAB_ORIGTR B43_GTAB(0x2E, 0x298) - -u16 b43_gtab_read(struct b43_wldev *dev, u16 table, u16 offset); -void b43_gtab_write(struct b43_wldev *dev, u16 table, u16 offset, u16 value); - - -/* Returns the boolean whether "TX Magnification" is enabled. */ -#define has_tx_magnification(phy) \ - (((phy)->rev >= 2) && \ - ((phy)->radio_ver == 0x2050) && \ - ((phy)->radio_rev == 8)) -/* Card uses the loopback gain stuff */ -#define has_loopback_gain(phy) \ - (((phy)->rev > 1) || ((phy)->gmode)) - -/* Radio Attenuation (RF Attenuation) */ -struct b43_rfatt { - u8 att; /* Attenuation value */ - bool with_padmix; /* Flag, PAD Mixer enabled. */ -}; -struct b43_rfatt_list { - /* Attenuation values list */ - const struct b43_rfatt *list; - u8 len; - /* Minimum/Maximum attenuation values */ - u8 min_val; - u8 max_val; -}; - -/* Returns true, if the values are the same. */ -static inline bool b43_compare_rfatt(const struct b43_rfatt *a, - const struct b43_rfatt *b) -{ - return ((a->att == b->att) && - (a->with_padmix == b->with_padmix)); -} - -/* Baseband Attenuation */ -struct b43_bbatt { - u8 att; /* Attenuation value */ -}; -struct b43_bbatt_list { - /* Attenuation values list */ - const struct b43_bbatt *list; - u8 len; - /* Minimum/Maximum attenuation values */ - u8 min_val; - u8 max_val; -}; - -/* Returns true, if the values are the same. */ -static inline bool b43_compare_bbatt(const struct b43_bbatt *a, - const struct b43_bbatt *b) -{ - return (a->att == b->att); -} - -/* tx_control bits. */ -#define B43_TXCTL_PA3DB 0x40 /* PA Gain 3dB */ -#define B43_TXCTL_PA2DB 0x20 /* PA Gain 2dB */ -#define B43_TXCTL_TXMIX 0x10 /* TX Mixer Gain */ - -struct b43_txpower_lo_control; - -struct b43_phy_g { - /* ACI (adjacent channel interference) flags. */ - bool aci_enable; - bool aci_wlan_automatic; - bool aci_hw_rssi; - - /* Radio switched on/off */ - bool radio_on; - struct { - /* Values saved when turning the radio off. - * They are needed when turning it on again. */ - bool valid; - u16 rfover; - u16 rfoverval; - } radio_off_context; - - u16 minlowsig[2]; - u16 minlowsigpos[2]; - - /* Pointer to the table used to convert a - * TSSI value to dBm-Q5.2 */ - const s8 *tssi2dbm; - /* tssi2dbm is kmalloc()ed. Only used for free()ing. */ - bool dyn_tssi_tbl; - /* Target idle TSSI */ - int tgt_idle_tssi; - /* Current idle TSSI */ - int cur_idle_tssi; - /* The current average TSSI. */ - u8 average_tssi; - /* Current TX power level attenuation control values */ - struct b43_bbatt bbatt; - struct b43_rfatt rfatt; - u8 tx_control; /* B43_TXCTL_XXX */ - /* The calculated attenuation deltas that are used later - * when adjusting the actual power output. */ - int bbatt_delta; - int rfatt_delta; - - /* LocalOscillator control values. */ - struct b43_txpower_lo_control *lo_control; - /* Values from b43_calc_loopback_gain() */ - s16 max_lb_gain; /* Maximum Loopback gain in hdB */ - s16 trsw_rx_gain; /* TRSW RX gain in hdB */ - s16 lna_lod_gain; /* LNA lod */ - s16 lna_gain; /* LNA */ - s16 pga_gain; /* PGA */ - - /* Current Interference Mitigation mode */ - int interfmode; - /* Stack of saved values from the Interference Mitigation code. - * Each value in the stack is laid out as follows: - * bit 0-11: offset - * bit 12-15: register ID - * bit 16-32: value - * register ID is: 0x1 PHY, 0x2 Radio, 0x3 ILT - */ -#define B43_INTERFSTACK_SIZE 26 - u32 interfstack[B43_INTERFSTACK_SIZE]; //FIXME: use a data structure - - /* Saved values from the NRSSI Slope calculation */ - s16 nrssi[2]; - s32 nrssislope; - /* In memory nrssi lookup table. */ - s8 nrssi_lt[64]; - - u16 lofcal; - - u16 initval; //FIXME rename? - - /* The device does address auto increment for the OFDM tables. - * We cache the previously used address here and omit the address - * write on the next table access, if possible. */ - u16 ofdmtab_addr; /* The address currently set in hardware. */ - enum { /* The last data flow direction. */ - B43_OFDMTAB_DIRECTION_UNKNOWN = 0, - B43_OFDMTAB_DIRECTION_READ, - B43_OFDMTAB_DIRECTION_WRITE, - } ofdmtab_addr_direction; -}; - -void b43_gphy_set_baseband_attenuation(struct b43_wldev *dev, - u16 baseband_attenuation); -void b43_gphy_channel_switch(struct b43_wldev *dev, - unsigned int channel, - bool synthetic_pu_workaround); -u8 * b43_generate_dyn_tssi2dbm_tab(struct b43_wldev *dev, - s16 pab0, s16 pab1, s16 pab2); - -struct b43_phy_operations; -extern const struct b43_phy_operations b43_phyops_g; - -#endif /* LINUX_B43_PHY_G_H_ */ diff --git a/drivers/net/wireless/b43/phy_ht.c b/drivers/net/wireless/b43/phy_ht.c deleted file mode 100644 index 5d6833f18498..000000000000 --- a/drivers/net/wireless/b43/phy_ht.c +++ /dev/null @@ -1,1140 +0,0 @@ -/* - - Broadcom B43 wireless driver - IEEE 802.11n HT-PHY support - - Copyright (c) 2011 Rafał Miłecki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include - -#include "b43.h" -#include "phy_ht.h" -#include "tables_phy_ht.h" -#include "radio_2059.h" -#include "main.h" - -/* Force values to keep compatibility with wl */ -enum ht_rssi_type { - HT_RSSI_W1 = 0, - HT_RSSI_W2 = 1, - HT_RSSI_NB = 2, - HT_RSSI_IQ = 3, - HT_RSSI_TSSI_2G = 4, - HT_RSSI_TSSI_5G = 5, - HT_RSSI_TBD = 6, -}; - -/************************************************** - * Radio 2059. - **************************************************/ - -static void b43_radio_2059_channel_setup(struct b43_wldev *dev, - const struct b43_phy_ht_channeltab_e_radio2059 *e) -{ - static const u16 routing[] = { R2059_C1, R2059_C2, R2059_C3, }; - u16 r; - int core; - - b43_radio_write(dev, 0x16, e->radio_syn16); - b43_radio_write(dev, 0x17, e->radio_syn17); - b43_radio_write(dev, 0x22, e->radio_syn22); - b43_radio_write(dev, 0x25, e->radio_syn25); - b43_radio_write(dev, 0x27, e->radio_syn27); - b43_radio_write(dev, 0x28, e->radio_syn28); - b43_radio_write(dev, 0x29, e->radio_syn29); - b43_radio_write(dev, 0x2c, e->radio_syn2c); - b43_radio_write(dev, 0x2d, e->radio_syn2d); - b43_radio_write(dev, 0x37, e->radio_syn37); - b43_radio_write(dev, 0x41, e->radio_syn41); - b43_radio_write(dev, 0x43, e->radio_syn43); - b43_radio_write(dev, 0x47, e->radio_syn47); - - for (core = 0; core < 3; core++) { - r = routing[core]; - b43_radio_write(dev, r | 0x4a, e->radio_rxtx4a); - b43_radio_write(dev, r | 0x58, e->radio_rxtx58); - b43_radio_write(dev, r | 0x5a, e->radio_rxtx5a); - b43_radio_write(dev, r | 0x6a, e->radio_rxtx6a); - b43_radio_write(dev, r | 0x6d, e->radio_rxtx6d); - b43_radio_write(dev, r | 0x6e, e->radio_rxtx6e); - b43_radio_write(dev, r | 0x92, e->radio_rxtx92); - b43_radio_write(dev, r | 0x98, e->radio_rxtx98); - } - - udelay(50); - - /* Calibration */ - b43_radio_mask(dev, 0x2b, ~0x1); - b43_radio_mask(dev, 0x2e, ~0x4); - b43_radio_set(dev, 0x2e, 0x4); - b43_radio_set(dev, 0x2b, 0x1); - - udelay(300); -} - -static void b43_radio_2059_init(struct b43_wldev *dev) -{ - const u16 routing[] = { R2059_C1, R2059_C2, R2059_C3 }; - const u16 radio_values[3][2] = { - { 0x61, 0xE9 }, { 0x69, 0xD5 }, { 0x73, 0x99 }, - }; - u16 i, j; - - b43_radio_write(dev, R2059_ALL | 0x51, 0x0070); - b43_radio_write(dev, R2059_ALL | 0x5a, 0x0003); - - for (i = 0; i < ARRAY_SIZE(routing); i++) - b43_radio_set(dev, routing[i] | 0x146, 0x3); - - b43_radio_set(dev, 0x2e, 0x0078); - b43_radio_set(dev, 0xc0, 0x0080); - msleep(2); - b43_radio_mask(dev, 0x2e, ~0x0078); - b43_radio_mask(dev, 0xc0, ~0x0080); - - if (1) { /* FIXME */ - b43_radio_set(dev, R2059_C3 | 0x4, 0x1); - udelay(10); - b43_radio_set(dev, R2059_C3 | 0x0BF, 0x1); - b43_radio_maskset(dev, R2059_C3 | 0x19B, 0x3, 0x2); - - b43_radio_set(dev, R2059_C3 | 0x4, 0x2); - udelay(100); - b43_radio_mask(dev, R2059_C3 | 0x4, ~0x2); - - for (i = 0; i < 10000; i++) { - if (b43_radio_read(dev, R2059_C3 | 0x145) & 1) { - i = 0; - break; - } - udelay(100); - } - if (i) - b43err(dev->wl, "radio 0x945 timeout\n"); - - b43_radio_mask(dev, R2059_C3 | 0x4, ~0x1); - b43_radio_set(dev, 0xa, 0x60); - - for (i = 0; i < 3; i++) { - b43_radio_write(dev, 0x17F, radio_values[i][0]); - b43_radio_write(dev, 0x13D, 0x6E); - b43_radio_write(dev, 0x13E, radio_values[i][1]); - b43_radio_write(dev, 0x13C, 0x55); - - for (j = 0; j < 10000; j++) { - if (b43_radio_read(dev, 0x140) & 2) { - j = 0; - break; - } - udelay(500); - } - if (j) - b43err(dev->wl, "radio 0x140 timeout\n"); - - b43_radio_write(dev, 0x13C, 0x15); - } - - b43_radio_mask(dev, 0x17F, ~0x1); - } - - b43_radio_mask(dev, 0x11, ~0x0008); -} - -/************************************************** - * RF - **************************************************/ - -static void b43_phy_ht_force_rf_sequence(struct b43_wldev *dev, u16 rf_seq) -{ - u8 i; - - u16 save_seq_mode = b43_phy_read(dev, B43_PHY_HT_RF_SEQ_MODE); - b43_phy_set(dev, B43_PHY_HT_RF_SEQ_MODE, 0x3); - - b43_phy_set(dev, B43_PHY_HT_RF_SEQ_TRIG, rf_seq); - for (i = 0; i < 200; i++) { - if (!(b43_phy_read(dev, B43_PHY_HT_RF_SEQ_STATUS) & rf_seq)) { - i = 0; - break; - } - msleep(1); - } - if (i) - b43err(dev->wl, "Forcing RF sequence timeout\n"); - - b43_phy_write(dev, B43_PHY_HT_RF_SEQ_MODE, save_seq_mode); -} - -static void b43_phy_ht_pa_override(struct b43_wldev *dev, bool enable) -{ - struct b43_phy_ht *htphy = dev->phy.ht; - static const u16 regs[3] = { B43_PHY_HT_RF_CTL_INT_C1, - B43_PHY_HT_RF_CTL_INT_C2, - B43_PHY_HT_RF_CTL_INT_C3 }; - int i; - - if (enable) { - for (i = 0; i < 3; i++) - b43_phy_write(dev, regs[i], htphy->rf_ctl_int_save[i]); - } else { - for (i = 0; i < 3; i++) - htphy->rf_ctl_int_save[i] = b43_phy_read(dev, regs[i]); - /* TODO: Does 5GHz band use different value (not 0x0400)? */ - for (i = 0; i < 3; i++) - b43_phy_write(dev, regs[i], 0x0400); - } -} - -/************************************************** - * Various PHY ops - **************************************************/ - -static u16 b43_phy_ht_classifier(struct b43_wldev *dev, u16 mask, u16 val) -{ - u16 tmp; - u16 allowed = B43_PHY_HT_CLASS_CTL_CCK_EN | - B43_PHY_HT_CLASS_CTL_OFDM_EN | - B43_PHY_HT_CLASS_CTL_WAITED_EN; - - tmp = b43_phy_read(dev, B43_PHY_HT_CLASS_CTL); - tmp &= allowed; - tmp &= ~mask; - tmp |= (val & mask); - b43_phy_maskset(dev, B43_PHY_HT_CLASS_CTL, ~allowed, tmp); - - return tmp; -} - -static void b43_phy_ht_reset_cca(struct b43_wldev *dev) -{ - u16 bbcfg; - - b43_phy_force_clock(dev, true); - bbcfg = b43_phy_read(dev, B43_PHY_HT_BBCFG); - b43_phy_write(dev, B43_PHY_HT_BBCFG, bbcfg | B43_PHY_HT_BBCFG_RSTCCA); - udelay(1); - b43_phy_write(dev, B43_PHY_HT_BBCFG, bbcfg & ~B43_PHY_HT_BBCFG_RSTCCA); - b43_phy_force_clock(dev, false); - - b43_phy_ht_force_rf_sequence(dev, B43_PHY_HT_RF_SEQ_TRIG_RST2RX); -} - -static void b43_phy_ht_zero_extg(struct b43_wldev *dev) -{ - u8 i, j; - u16 base[] = { 0x40, 0x60, 0x80 }; - - for (i = 0; i < ARRAY_SIZE(base); i++) { - for (j = 0; j < 4; j++) - b43_phy_write(dev, B43_PHY_EXTG(base[i] + j), 0); - } - - for (i = 0; i < ARRAY_SIZE(base); i++) - b43_phy_write(dev, B43_PHY_EXTG(base[i] + 0xc), 0); -} - -/* Some unknown AFE (Analog Frondned) op */ -static void b43_phy_ht_afe_unk1(struct b43_wldev *dev) -{ - u8 i; - - static const u16 ctl_regs[3][2] = { - { B43_PHY_HT_AFE_C1_OVER, B43_PHY_HT_AFE_C1 }, - { B43_PHY_HT_AFE_C2_OVER, B43_PHY_HT_AFE_C2 }, - { B43_PHY_HT_AFE_C3_OVER, B43_PHY_HT_AFE_C3}, - }; - - for (i = 0; i < 3; i++) { - /* TODO: verify masks&sets */ - b43_phy_set(dev, ctl_regs[i][1], 0x4); - b43_phy_set(dev, ctl_regs[i][0], 0x4); - b43_phy_mask(dev, ctl_regs[i][1], ~0x1); - b43_phy_set(dev, ctl_regs[i][0], 0x1); - b43_httab_write(dev, B43_HTTAB16(8, 5 + (i * 0x10)), 0); - b43_phy_mask(dev, ctl_regs[i][0], ~0x4); - } -} - -static void b43_phy_ht_read_clip_detection(struct b43_wldev *dev, u16 *clip_st) -{ - clip_st[0] = b43_phy_read(dev, B43_PHY_HT_C1_CLIP1THRES); - clip_st[1] = b43_phy_read(dev, B43_PHY_HT_C2_CLIP1THRES); - clip_st[2] = b43_phy_read(dev, B43_PHY_HT_C3_CLIP1THRES); -} - -static void b43_phy_ht_bphy_init(struct b43_wldev *dev) -{ - unsigned int i; - u16 val; - - val = 0x1E1F; - for (i = 0; i < 16; i++) { - b43_phy_write(dev, B43_PHY_N_BMODE(0x88 + i), val); - val -= 0x202; - } - val = 0x3E3F; - for (i = 0; i < 16; i++) { - b43_phy_write(dev, B43_PHY_N_BMODE(0x98 + i), val); - val -= 0x202; - } - b43_phy_write(dev, B43_PHY_N_BMODE(0x38), 0x668); -} - -/************************************************** - * Samples - **************************************************/ - -static void b43_phy_ht_stop_playback(struct b43_wldev *dev) -{ - struct b43_phy_ht *phy_ht = dev->phy.ht; - u16 tmp; - int i; - - tmp = b43_phy_read(dev, B43_PHY_HT_SAMP_STAT); - if (tmp & 0x1) - b43_phy_set(dev, B43_PHY_HT_SAMP_CMD, B43_PHY_HT_SAMP_CMD_STOP); - else if (tmp & 0x2) - b43_phy_mask(dev, B43_PHY_HT_IQLOCAL_CMDGCTL, 0x7FFF); - - b43_phy_mask(dev, B43_PHY_HT_SAMP_CMD, ~0x0004); - - for (i = 0; i < 3; i++) { - if (phy_ht->bb_mult_save[i] >= 0) { - b43_httab_write(dev, B43_HTTAB16(13, 0x63 + i * 4), - phy_ht->bb_mult_save[i]); - b43_httab_write(dev, B43_HTTAB16(13, 0x67 + i * 4), - phy_ht->bb_mult_save[i]); - } - } -} - -static u16 b43_phy_ht_load_samples(struct b43_wldev *dev) -{ - int i; - u16 len = 20 << 3; - - b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, 0x4400); - - for (i = 0; i < len; i++) { - b43_phy_write(dev, B43_PHY_HT_TABLE_DATAHI, 0); - b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, 0); - } - - return len; -} - -static void b43_phy_ht_run_samples(struct b43_wldev *dev, u16 samps, u16 loops, - u16 wait) -{ - struct b43_phy_ht *phy_ht = dev->phy.ht; - u16 save_seq_mode; - int i; - - for (i = 0; i < 3; i++) { - if (phy_ht->bb_mult_save[i] < 0) - phy_ht->bb_mult_save[i] = b43_httab_read(dev, B43_HTTAB16(13, 0x63 + i * 4)); - } - - b43_phy_write(dev, B43_PHY_HT_SAMP_DEP_CNT, samps - 1); - if (loops != 0xFFFF) - loops--; - b43_phy_write(dev, B43_PHY_HT_SAMP_LOOP_CNT, loops); - b43_phy_write(dev, B43_PHY_HT_SAMP_WAIT_CNT, wait); - - save_seq_mode = b43_phy_read(dev, B43_PHY_HT_RF_SEQ_MODE); - b43_phy_set(dev, B43_PHY_HT_RF_SEQ_MODE, - B43_PHY_HT_RF_SEQ_MODE_CA_OVER); - - /* TODO: find out mask bits! Do we need more function arguments? */ - b43_phy_mask(dev, B43_PHY_HT_SAMP_CMD, ~0); - b43_phy_mask(dev, B43_PHY_HT_SAMP_CMD, ~0); - b43_phy_mask(dev, B43_PHY_HT_IQLOCAL_CMDGCTL, ~0); - b43_phy_set(dev, B43_PHY_HT_SAMP_CMD, 0x1); - - for (i = 0; i < 100; i++) { - if (!(b43_phy_read(dev, B43_PHY_HT_RF_SEQ_STATUS) & 1)) { - i = 0; - break; - } - udelay(10); - } - if (i) - b43err(dev->wl, "run samples timeout\n"); - - b43_phy_write(dev, B43_PHY_HT_RF_SEQ_MODE, save_seq_mode); -} - -static void b43_phy_ht_tx_tone(struct b43_wldev *dev) -{ - u16 samp; - - samp = b43_phy_ht_load_samples(dev); - b43_phy_ht_run_samples(dev, samp, 0xFFFF, 0); -} - -/************************************************** - * RSSI - **************************************************/ - -static void b43_phy_ht_rssi_select(struct b43_wldev *dev, u8 core_sel, - enum ht_rssi_type rssi_type) -{ - static const u16 ctl_regs[3][2] = { - { B43_PHY_HT_AFE_C1, B43_PHY_HT_AFE_C1_OVER, }, - { B43_PHY_HT_AFE_C2, B43_PHY_HT_AFE_C2_OVER, }, - { B43_PHY_HT_AFE_C3, B43_PHY_HT_AFE_C3_OVER, }, - }; - static const u16 radio_r[] = { R2059_C1, R2059_C2, R2059_C3, }; - int core; - - if (core_sel == 0) { - b43err(dev->wl, "RSSI selection for core off not implemented yet\n"); - } else { - for (core = 0; core < 3; core++) { - /* Check if caller requested a one specific core */ - if ((core_sel == 1 && core != 0) || - (core_sel == 2 && core != 1) || - (core_sel == 3 && core != 2)) - continue; - - switch (rssi_type) { - case HT_RSSI_TSSI_2G: - b43_phy_set(dev, ctl_regs[core][0], 0x3 << 8); - b43_phy_set(dev, ctl_regs[core][0], 0x3 << 10); - b43_phy_set(dev, ctl_regs[core][1], 0x1 << 9); - b43_phy_set(dev, ctl_regs[core][1], 0x1 << 10); - - b43_radio_set(dev, R2059_C3 | 0xbf, 0x1); - b43_radio_write(dev, radio_r[core] | 0x159, - 0x11); - break; - default: - b43err(dev->wl, "RSSI selection for type %d not implemented yet\n", - rssi_type); - } - } - } -} - -static void b43_phy_ht_poll_rssi(struct b43_wldev *dev, enum ht_rssi_type type, - s32 *buf, u8 nsamp) -{ - u16 phy_regs_values[12]; - static const u16 phy_regs_to_save[] = { - B43_PHY_HT_AFE_C1, B43_PHY_HT_AFE_C1_OVER, - 0x848, 0x841, - B43_PHY_HT_AFE_C2, B43_PHY_HT_AFE_C2_OVER, - 0x868, 0x861, - B43_PHY_HT_AFE_C3, B43_PHY_HT_AFE_C3_OVER, - 0x888, 0x881, - }; - u16 tmp[3]; - int i; - - for (i = 0; i < 12; i++) - phy_regs_values[i] = b43_phy_read(dev, phy_regs_to_save[i]); - - b43_phy_ht_rssi_select(dev, 5, type); - - for (i = 0; i < 6; i++) - buf[i] = 0; - - for (i = 0; i < nsamp; i++) { - tmp[0] = b43_phy_read(dev, B43_PHY_HT_RSSI_C1); - tmp[1] = b43_phy_read(dev, B43_PHY_HT_RSSI_C2); - tmp[2] = b43_phy_read(dev, B43_PHY_HT_RSSI_C3); - - buf[0] += ((s8)((tmp[0] & 0x3F) << 2)) >> 2; - buf[1] += ((s8)(((tmp[0] >> 8) & 0x3F) << 2)) >> 2; - buf[2] += ((s8)((tmp[1] & 0x3F) << 2)) >> 2; - buf[3] += ((s8)(((tmp[1] >> 8) & 0x3F) << 2)) >> 2; - buf[4] += ((s8)((tmp[2] & 0x3F) << 2)) >> 2; - buf[5] += ((s8)(((tmp[2] >> 8) & 0x3F) << 2)) >> 2; - } - - for (i = 0; i < 12; i++) - b43_phy_write(dev, phy_regs_to_save[i], phy_regs_values[i]); -} - -/************************************************** - * Tx/Rx - **************************************************/ - -static void b43_phy_ht_tx_power_fix(struct b43_wldev *dev) -{ - int i; - - for (i = 0; i < 3; i++) { - u16 mask; - u32 tmp = b43_httab_read(dev, B43_HTTAB32(26, 0xE8)); - - if (0) /* FIXME */ - mask = 0x2 << (i * 4); - else - mask = 0; - b43_phy_mask(dev, B43_PHY_EXTG(0x108), mask); - - b43_httab_write(dev, B43_HTTAB16(7, 0x110 + i), tmp >> 16); - b43_httab_write(dev, B43_HTTAB8(13, 0x63 + (i * 4)), - tmp & 0xFF); - b43_httab_write(dev, B43_HTTAB8(13, 0x73 + (i * 4)), - tmp & 0xFF); - } -} - -static void b43_phy_ht_tx_power_ctl(struct b43_wldev *dev, bool enable) -{ - struct b43_phy_ht *phy_ht = dev->phy.ht; - u16 en_bits = B43_PHY_HT_TXPCTL_CMD_C1_COEFF | - B43_PHY_HT_TXPCTL_CMD_C1_HWPCTLEN | - B43_PHY_HT_TXPCTL_CMD_C1_PCTLEN; - static const u16 cmd_regs[3] = { B43_PHY_HT_TXPCTL_CMD_C1, - B43_PHY_HT_TXPCTL_CMD_C2, - B43_PHY_HT_TXPCTL_CMD_C3 }; - static const u16 status_regs[3] = { B43_PHY_HT_TX_PCTL_STATUS_C1, - B43_PHY_HT_TX_PCTL_STATUS_C2, - B43_PHY_HT_TX_PCTL_STATUS_C3 }; - int i; - - if (!enable) { - if (b43_phy_read(dev, B43_PHY_HT_TXPCTL_CMD_C1) & en_bits) { - /* We disable enabled TX pwr ctl, save it's state */ - for (i = 0; i < 3; i++) - phy_ht->tx_pwr_idx[i] = - b43_phy_read(dev, status_regs[i]); - } - b43_phy_mask(dev, B43_PHY_HT_TXPCTL_CMD_C1, ~en_bits); - } else { - b43_phy_set(dev, B43_PHY_HT_TXPCTL_CMD_C1, en_bits); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { - for (i = 0; i < 3; i++) - b43_phy_write(dev, cmd_regs[i], 0x32); - } - - for (i = 0; i < 3; i++) - if (phy_ht->tx_pwr_idx[i] <= - B43_PHY_HT_TXPCTL_CMD_C1_INIT) - b43_phy_write(dev, cmd_regs[i], - phy_ht->tx_pwr_idx[i]); - } - - phy_ht->tx_pwr_ctl = enable; -} - -static void b43_phy_ht_tx_power_ctl_idle_tssi(struct b43_wldev *dev) -{ - struct b43_phy_ht *phy_ht = dev->phy.ht; - static const u16 base[] = { 0x840, 0x860, 0x880 }; - u16 save_regs[3][3]; - s32 rssi_buf[6]; - int core; - - for (core = 0; core < 3; core++) { - save_regs[core][1] = b43_phy_read(dev, base[core] + 6); - save_regs[core][2] = b43_phy_read(dev, base[core] + 7); - save_regs[core][0] = b43_phy_read(dev, base[core] + 0); - - b43_phy_write(dev, base[core] + 6, 0); - b43_phy_mask(dev, base[core] + 7, ~0xF); /* 0xF? Or just 0x6? */ - b43_phy_set(dev, base[core] + 0, 0x0400); - b43_phy_set(dev, base[core] + 0, 0x1000); - } - - b43_phy_ht_tx_tone(dev); - udelay(20); - b43_phy_ht_poll_rssi(dev, HT_RSSI_TSSI_2G, rssi_buf, 1); - b43_phy_ht_stop_playback(dev); - b43_phy_ht_reset_cca(dev); - - phy_ht->idle_tssi[0] = rssi_buf[0] & 0xff; - phy_ht->idle_tssi[1] = rssi_buf[2] & 0xff; - phy_ht->idle_tssi[2] = rssi_buf[4] & 0xff; - - for (core = 0; core < 3; core++) { - b43_phy_write(dev, base[core] + 0, save_regs[core][0]); - b43_phy_write(dev, base[core] + 6, save_regs[core][1]); - b43_phy_write(dev, base[core] + 7, save_regs[core][2]); - } -} - -static void b43_phy_ht_tssi_setup(struct b43_wldev *dev) -{ - static const u16 routing[] = { R2059_C1, R2059_C2, R2059_C3, }; - int core; - - /* 0x159 is probably TX_SSI_MUX or TSSIG (by comparing to N-PHY) */ - for (core = 0; core < 3; core++) { - b43_radio_set(dev, 0x8bf, 0x1); - b43_radio_write(dev, routing[core] | 0x0159, 0x0011); - } -} - -static void b43_phy_ht_tx_power_ctl_setup(struct b43_wldev *dev) -{ - struct b43_phy_ht *phy_ht = dev->phy.ht; - struct ssb_sprom *sprom = dev->dev->bus_sprom; - - u8 *idle = phy_ht->idle_tssi; - u8 target[3]; - s16 a1[3], b0[3], b1[3]; - - u16 freq = dev->phy.channel_freq; - int i, c; - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - for (c = 0; c < 3; c++) { - target[c] = sprom->core_pwr_info[c].maxpwr_2g; - a1[c] = sprom->core_pwr_info[c].pa_2g[0]; - b0[c] = sprom->core_pwr_info[c].pa_2g[1]; - b1[c] = sprom->core_pwr_info[c].pa_2g[2]; - } - } else if (freq >= 4900 && freq < 5100) { - for (c = 0; c < 3; c++) { - target[c] = sprom->core_pwr_info[c].maxpwr_5gl; - a1[c] = sprom->core_pwr_info[c].pa_5gl[0]; - b0[c] = sprom->core_pwr_info[c].pa_5gl[1]; - b1[c] = sprom->core_pwr_info[c].pa_5gl[2]; - } - } else if (freq >= 5100 && freq < 5500) { - for (c = 0; c < 3; c++) { - target[c] = sprom->core_pwr_info[c].maxpwr_5g; - a1[c] = sprom->core_pwr_info[c].pa_5g[0]; - b0[c] = sprom->core_pwr_info[c].pa_5g[1]; - b1[c] = sprom->core_pwr_info[c].pa_5g[2]; - } - } else if (freq >= 5500) { - for (c = 0; c < 3; c++) { - target[c] = sprom->core_pwr_info[c].maxpwr_5gh; - a1[c] = sprom->core_pwr_info[c].pa_5gh[0]; - b0[c] = sprom->core_pwr_info[c].pa_5gh[1]; - b1[c] = sprom->core_pwr_info[c].pa_5gh[2]; - } - } else { - target[0] = target[1] = target[2] = 52; - a1[0] = a1[1] = a1[2] = -424; - b0[0] = b0[1] = b0[2] = 5612; - b1[0] = b1[1] = b1[2] = -1393; - } - - b43_phy_set(dev, B43_PHY_HT_TSSIMODE, B43_PHY_HT_TSSIMODE_EN); - b43_phy_mask(dev, B43_PHY_HT_TXPCTL_CMD_C1, - ~B43_PHY_HT_TXPCTL_CMD_C1_PCTLEN & 0xFFFF); - - /* TODO: Does it depend on sprom->fem.ghz2.tssipos? */ - b43_phy_set(dev, B43_PHY_HT_TXPCTL_IDLE_TSSI, 0x4000); - - b43_phy_maskset(dev, B43_PHY_HT_TXPCTL_CMD_C1, - ~B43_PHY_HT_TXPCTL_CMD_C1_INIT, 0x19); - b43_phy_maskset(dev, B43_PHY_HT_TXPCTL_CMD_C2, - ~B43_PHY_HT_TXPCTL_CMD_C2_INIT, 0x19); - b43_phy_maskset(dev, B43_PHY_HT_TXPCTL_CMD_C3, - ~B43_PHY_HT_TXPCTL_CMD_C3_INIT, 0x19); - - b43_phy_set(dev, B43_PHY_HT_TXPCTL_IDLE_TSSI, - B43_PHY_HT_TXPCTL_IDLE_TSSI_BINF); - - b43_phy_maskset(dev, B43_PHY_HT_TXPCTL_IDLE_TSSI, - ~B43_PHY_HT_TXPCTL_IDLE_TSSI_C1, - idle[0] << B43_PHY_HT_TXPCTL_IDLE_TSSI_C1_SHIFT); - b43_phy_maskset(dev, B43_PHY_HT_TXPCTL_IDLE_TSSI, - ~B43_PHY_HT_TXPCTL_IDLE_TSSI_C2, - idle[1] << B43_PHY_HT_TXPCTL_IDLE_TSSI_C2_SHIFT); - b43_phy_maskset(dev, B43_PHY_HT_TXPCTL_IDLE_TSSI2, - ~B43_PHY_HT_TXPCTL_IDLE_TSSI2_C3, - idle[2] << B43_PHY_HT_TXPCTL_IDLE_TSSI2_C3_SHIFT); - - b43_phy_maskset(dev, B43_PHY_HT_TXPCTL_N, ~B43_PHY_HT_TXPCTL_N_TSSID, - 0xf0); - b43_phy_maskset(dev, B43_PHY_HT_TXPCTL_N, ~B43_PHY_HT_TXPCTL_N_NPTIL2, - 0x3 << B43_PHY_HT_TXPCTL_N_NPTIL2_SHIFT); -#if 0 - /* TODO: what to mask/set? */ - b43_phy_maskset(dev, B43_PHY_HT_TXPCTL_CMD_C1, 0x800, 0) - b43_phy_maskset(dev, B43_PHY_HT_TXPCTL_CMD_C1, 0x400, 0) -#endif - - b43_phy_maskset(dev, B43_PHY_HT_TXPCTL_TARG_PWR, - ~B43_PHY_HT_TXPCTL_TARG_PWR_C1, - target[0] << B43_PHY_HT_TXPCTL_TARG_PWR_C1_SHIFT); - b43_phy_maskset(dev, B43_PHY_HT_TXPCTL_TARG_PWR, - ~B43_PHY_HT_TXPCTL_TARG_PWR_C2 & 0xFFFF, - target[1] << B43_PHY_HT_TXPCTL_TARG_PWR_C2_SHIFT); - b43_phy_maskset(dev, B43_PHY_HT_TXPCTL_TARG_PWR2, - ~B43_PHY_HT_TXPCTL_TARG_PWR2_C3, - target[2] << B43_PHY_HT_TXPCTL_TARG_PWR2_C3_SHIFT); - - for (c = 0; c < 3; c++) { - s32 num, den, pwr; - u32 regval[64]; - - for (i = 0; i < 64; i++) { - num = 8 * (16 * b0[c] + b1[c] * i); - den = 32768 + a1[c] * i; - pwr = max((4 * num + den / 2) / den, -8); - regval[i] = pwr; - } - b43_httab_write_bulk(dev, B43_HTTAB16(26 + c, 0), 64, regval); - } -} - -/************************************************** - * Channel switching ops. - **************************************************/ - -static void b43_phy_ht_spur_avoid(struct b43_wldev *dev, - struct ieee80211_channel *new_channel) -{ - struct bcma_device *core = dev->dev->bdev; - int spuravoid = 0; - u16 tmp; - - /* Check for 13 and 14 is just a guess, we don't have enough logs. */ - if (new_channel->hw_value == 13 || new_channel->hw_value == 14) - spuravoid = 1; - bcma_core_pll_ctl(core, B43_BCMA_CLKCTLST_PHY_PLL_REQ, 0, false); - bcma_pmu_spuravoid_pllupdate(&core->bus->drv_cc, spuravoid); - bcma_core_pll_ctl(core, - B43_BCMA_CLKCTLST_80211_PLL_REQ | - B43_BCMA_CLKCTLST_PHY_PLL_REQ, - B43_BCMA_CLKCTLST_80211_PLL_ST | - B43_BCMA_CLKCTLST_PHY_PLL_ST, false); - - /* Values has been taken from wlc_bmac_switch_macfreq comments */ - switch (spuravoid) { - case 2: /* 126MHz */ - tmp = 0x2082; - break; - case 1: /* 123MHz */ - tmp = 0x5341; - break; - default: /* 120MHz */ - tmp = 0x8889; - } - - b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_LOW, tmp); - b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_HIGH, 0x8); - - /* TODO: reset PLL */ - - if (spuravoid) - b43_phy_set(dev, B43_PHY_HT_BBCFG, B43_PHY_HT_BBCFG_RSTRX); - else - b43_phy_mask(dev, B43_PHY_HT_BBCFG, - ~B43_PHY_HT_BBCFG_RSTRX & 0xFFFF); - - b43_phy_ht_reset_cca(dev); -} - -static void b43_phy_ht_channel_setup(struct b43_wldev *dev, - const struct b43_phy_ht_channeltab_e_phy *e, - struct ieee80211_channel *new_channel) -{ - bool old_band_5ghz; - - old_band_5ghz = b43_phy_read(dev, B43_PHY_HT_BANDCTL) & 0; /* FIXME */ - if (new_channel->band == IEEE80211_BAND_5GHZ && !old_band_5ghz) { - /* TODO */ - } else if (new_channel->band == IEEE80211_BAND_2GHZ && old_band_5ghz) { - /* TODO */ - } - - b43_phy_write(dev, B43_PHY_HT_BW1, e->bw1); - b43_phy_write(dev, B43_PHY_HT_BW2, e->bw2); - b43_phy_write(dev, B43_PHY_HT_BW3, e->bw3); - b43_phy_write(dev, B43_PHY_HT_BW4, e->bw4); - b43_phy_write(dev, B43_PHY_HT_BW5, e->bw5); - b43_phy_write(dev, B43_PHY_HT_BW6, e->bw6); - - if (new_channel->hw_value == 14) { - b43_phy_ht_classifier(dev, B43_PHY_HT_CLASS_CTL_OFDM_EN, 0); - b43_phy_set(dev, B43_PHY_HT_TEST, 0x0800); - } else { - b43_phy_ht_classifier(dev, B43_PHY_HT_CLASS_CTL_OFDM_EN, - B43_PHY_HT_CLASS_CTL_OFDM_EN); - if (new_channel->band == IEEE80211_BAND_2GHZ) - b43_phy_mask(dev, B43_PHY_HT_TEST, ~0x840); - } - - if (1) /* TODO: On N it's for early devices only, what about HT? */ - b43_phy_ht_tx_power_fix(dev); - - b43_phy_ht_spur_avoid(dev, new_channel); - - b43_phy_write(dev, 0x017e, 0x3830); -} - -static int b43_phy_ht_set_channel(struct b43_wldev *dev, - struct ieee80211_channel *channel, - enum nl80211_channel_type channel_type) -{ - struct b43_phy *phy = &dev->phy; - - const struct b43_phy_ht_channeltab_e_radio2059 *chent_r2059 = NULL; - - if (phy->radio_ver == 0x2059) { - chent_r2059 = b43_phy_ht_get_channeltab_e_r2059(dev, - channel->center_freq); - if (!chent_r2059) - return -ESRCH; - } else { - return -ESRCH; - } - - /* TODO: In case of N-PHY some bandwidth switching goes here */ - - if (phy->radio_ver == 0x2059) { - b43_radio_2059_channel_setup(dev, chent_r2059); - b43_phy_ht_channel_setup(dev, &(chent_r2059->phy_regs), - channel); - } else { - return -ESRCH; - } - - return 0; -} - -/************************************************** - * Basic PHY ops. - **************************************************/ - -static int b43_phy_ht_op_allocate(struct b43_wldev *dev) -{ - struct b43_phy_ht *phy_ht; - - phy_ht = kzalloc(sizeof(*phy_ht), GFP_KERNEL); - if (!phy_ht) - return -ENOMEM; - dev->phy.ht = phy_ht; - - return 0; -} - -static void b43_phy_ht_op_prepare_structs(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_ht *phy_ht = phy->ht; - int i; - - memset(phy_ht, 0, sizeof(*phy_ht)); - - phy_ht->tx_pwr_ctl = true; - for (i = 0; i < 3; i++) - phy_ht->tx_pwr_idx[i] = B43_PHY_HT_TXPCTL_CMD_C1_INIT + 1; - - for (i = 0; i < 3; i++) - phy_ht->bb_mult_save[i] = -1; -} - -static int b43_phy_ht_op_init(struct b43_wldev *dev) -{ - struct b43_phy_ht *phy_ht = dev->phy.ht; - u16 tmp; - u16 clip_state[3]; - bool saved_tx_pwr_ctl; - - if (dev->dev->bus_type != B43_BUS_BCMA) { - b43err(dev->wl, "HT-PHY is supported only on BCMA bus!\n"); - return -EOPNOTSUPP; - } - - b43_phy_ht_tables_init(dev); - - b43_phy_mask(dev, 0x0be, ~0x2); - b43_phy_set(dev, 0x23f, 0x7ff); - b43_phy_set(dev, 0x240, 0x7ff); - b43_phy_set(dev, 0x241, 0x7ff); - - b43_phy_ht_zero_extg(dev); - - b43_phy_mask(dev, B43_PHY_EXTG(0), ~0x3); - - b43_phy_write(dev, B43_PHY_HT_AFE_C1_OVER, 0); - b43_phy_write(dev, B43_PHY_HT_AFE_C2_OVER, 0); - b43_phy_write(dev, B43_PHY_HT_AFE_C3_OVER, 0); - - b43_phy_write(dev, B43_PHY_EXTG(0x103), 0x20); - b43_phy_write(dev, B43_PHY_EXTG(0x101), 0x20); - b43_phy_write(dev, 0x20d, 0xb8); - b43_phy_write(dev, B43_PHY_EXTG(0x14f), 0xc8); - b43_phy_write(dev, 0x70, 0x50); - b43_phy_write(dev, 0x1ff, 0x30); - - if (0) /* TODO: condition */ - ; /* TODO: PHY op on reg 0x217 */ - - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) - b43_phy_ht_classifier(dev, B43_PHY_HT_CLASS_CTL_CCK_EN, 0); - else - b43_phy_ht_classifier(dev, B43_PHY_HT_CLASS_CTL_CCK_EN, - B43_PHY_HT_CLASS_CTL_CCK_EN); - - b43_phy_set(dev, 0xb1, 0x91); - b43_phy_write(dev, 0x32f, 0x0003); - b43_phy_write(dev, 0x077, 0x0010); - b43_phy_write(dev, 0x0b4, 0x0258); - b43_phy_mask(dev, 0x17e, ~0x4000); - - b43_phy_write(dev, 0x0b9, 0x0072); - - b43_httab_write_few(dev, B43_HTTAB16(7, 0x14e), 2, 0x010f, 0x010f); - b43_httab_write_few(dev, B43_HTTAB16(7, 0x15e), 2, 0x010f, 0x010f); - b43_httab_write_few(dev, B43_HTTAB16(7, 0x16e), 2, 0x010f, 0x010f); - - b43_phy_ht_afe_unk1(dev); - - b43_httab_write_few(dev, B43_HTTAB16(7, 0x130), 9, 0x777, 0x111, 0x111, - 0x777, 0x111, 0x111, 0x777, 0x111, 0x111); - - b43_httab_write(dev, B43_HTTAB16(7, 0x120), 0x0777); - b43_httab_write(dev, B43_HTTAB16(7, 0x124), 0x0777); - - b43_httab_write(dev, B43_HTTAB16(8, 0x00), 0x02); - b43_httab_write(dev, B43_HTTAB16(8, 0x10), 0x02); - b43_httab_write(dev, B43_HTTAB16(8, 0x20), 0x02); - - b43_httab_write_few(dev, B43_HTTAB16(8, 0x08), 4, - 0x8e, 0x96, 0x96, 0x96); - b43_httab_write_few(dev, B43_HTTAB16(8, 0x18), 4, - 0x8f, 0x9f, 0x9f, 0x9f); - b43_httab_write_few(dev, B43_HTTAB16(8, 0x28), 4, - 0x8f, 0x9f, 0x9f, 0x9f); - - b43_httab_write_few(dev, B43_HTTAB16(8, 0x0c), 4, 0x2, 0x2, 0x2, 0x2); - b43_httab_write_few(dev, B43_HTTAB16(8, 0x1c), 4, 0x2, 0x2, 0x2, 0x2); - b43_httab_write_few(dev, B43_HTTAB16(8, 0x2c), 4, 0x2, 0x2, 0x2, 0x2); - - b43_phy_maskset(dev, 0x0280, 0xff00, 0x3e); - b43_phy_maskset(dev, 0x0283, 0xff00, 0x3e); - b43_phy_maskset(dev, B43_PHY_OFDM(0x0141), 0xff00, 0x46); - b43_phy_maskset(dev, 0x0283, 0xff00, 0x40); - - b43_httab_write_few(dev, B43_HTTAB16(00, 0x8), 4, - 0x09, 0x0e, 0x13, 0x18); - b43_httab_write_few(dev, B43_HTTAB16(01, 0x8), 4, - 0x09, 0x0e, 0x13, 0x18); - /* TODO: Did wl mean 2 instead of 40? */ - b43_httab_write_few(dev, B43_HTTAB16(40, 0x8), 4, - 0x09, 0x0e, 0x13, 0x18); - - b43_phy_maskset(dev, B43_PHY_OFDM(0x24), 0x3f, 0xd); - b43_phy_maskset(dev, B43_PHY_OFDM(0x64), 0x3f, 0xd); - b43_phy_maskset(dev, B43_PHY_OFDM(0xa4), 0x3f, 0xd); - - b43_phy_set(dev, B43_PHY_EXTG(0x060), 0x1); - b43_phy_set(dev, B43_PHY_EXTG(0x064), 0x1); - b43_phy_set(dev, B43_PHY_EXTG(0x080), 0x1); - b43_phy_set(dev, B43_PHY_EXTG(0x084), 0x1); - - /* Copy some tables entries */ - tmp = b43_httab_read(dev, B43_HTTAB16(7, 0x144)); - b43_httab_write(dev, B43_HTTAB16(7, 0x14a), tmp); - tmp = b43_httab_read(dev, B43_HTTAB16(7, 0x154)); - b43_httab_write(dev, B43_HTTAB16(7, 0x15a), tmp); - tmp = b43_httab_read(dev, B43_HTTAB16(7, 0x164)); - b43_httab_write(dev, B43_HTTAB16(7, 0x16a), tmp); - - /* Reset CCA */ - b43_phy_force_clock(dev, true); - tmp = b43_phy_read(dev, B43_PHY_HT_BBCFG); - b43_phy_write(dev, B43_PHY_HT_BBCFG, tmp | B43_PHY_HT_BBCFG_RSTCCA); - b43_phy_write(dev, B43_PHY_HT_BBCFG, tmp & ~B43_PHY_HT_BBCFG_RSTCCA); - b43_phy_force_clock(dev, false); - - b43_mac_phy_clock_set(dev, true); - - b43_phy_ht_pa_override(dev, false); - b43_phy_ht_force_rf_sequence(dev, B43_PHY_HT_RF_SEQ_TRIG_RX2TX); - b43_phy_ht_force_rf_sequence(dev, B43_PHY_HT_RF_SEQ_TRIG_RST2RX); - b43_phy_ht_pa_override(dev, true); - - /* TODO: Should we restore it? Or store it in global PHY info? */ - b43_phy_ht_classifier(dev, 0, 0); - b43_phy_ht_read_clip_detection(dev, clip_state); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - b43_phy_ht_bphy_init(dev); - - b43_httab_write_bulk(dev, B43_HTTAB32(0x1a, 0xc0), - B43_HTTAB_1A_C0_LATE_SIZE, b43_httab_0x1a_0xc0_late); - - saved_tx_pwr_ctl = phy_ht->tx_pwr_ctl; - b43_phy_ht_tx_power_fix(dev); - b43_phy_ht_tx_power_ctl(dev, false); - b43_phy_ht_tx_power_ctl_idle_tssi(dev); - b43_phy_ht_tx_power_ctl_setup(dev); - b43_phy_ht_tssi_setup(dev); - b43_phy_ht_tx_power_ctl(dev, saved_tx_pwr_ctl); - - return 0; -} - -static void b43_phy_ht_op_free(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_ht *phy_ht = phy->ht; - - kfree(phy_ht); - phy->ht = NULL; -} - -/* http://bcm-v4.sipsolutions.net/802.11/Radio/Switch%20Radio */ -static void b43_phy_ht_op_software_rfkill(struct b43_wldev *dev, - bool blocked) -{ - if (b43_read32(dev, B43_MMIO_MACCTL) & B43_MACCTL_ENABLED) - b43err(dev->wl, "MAC not suspended\n"); - - /* In the following PHY ops we copy wl's dummy behaviour. - * TODO: Find out if reads (currently hidden in masks/masksets) are - * needed and replace following ops with just writes or w&r. - * Note: B43_PHY_HT_RF_CTL1 register is tricky, wrong operation can - * cause delayed (!) machine lock up. */ - if (blocked) { - b43_phy_mask(dev, B43_PHY_HT_RF_CTL1, 0); - } else { - b43_phy_mask(dev, B43_PHY_HT_RF_CTL1, 0); - b43_phy_maskset(dev, B43_PHY_HT_RF_CTL1, 0, 0x1); - b43_phy_mask(dev, B43_PHY_HT_RF_CTL1, 0); - b43_phy_maskset(dev, B43_PHY_HT_RF_CTL1, 0, 0x2); - - if (dev->phy.radio_ver == 0x2059) - b43_radio_2059_init(dev); - else - B43_WARN_ON(1); - - b43_switch_channel(dev, dev->phy.channel); - } -} - -static void b43_phy_ht_op_switch_analog(struct b43_wldev *dev, bool on) -{ - if (on) { - b43_phy_write(dev, B43_PHY_HT_AFE_C1, 0x00cd); - b43_phy_write(dev, B43_PHY_HT_AFE_C1_OVER, 0x0000); - b43_phy_write(dev, B43_PHY_HT_AFE_C2, 0x00cd); - b43_phy_write(dev, B43_PHY_HT_AFE_C2_OVER, 0x0000); - b43_phy_write(dev, B43_PHY_HT_AFE_C3, 0x00cd); - b43_phy_write(dev, B43_PHY_HT_AFE_C3_OVER, 0x0000); - } else { - b43_phy_write(dev, B43_PHY_HT_AFE_C1_OVER, 0x07ff); - b43_phy_write(dev, B43_PHY_HT_AFE_C1, 0x00fd); - b43_phy_write(dev, B43_PHY_HT_AFE_C2_OVER, 0x07ff); - b43_phy_write(dev, B43_PHY_HT_AFE_C2, 0x00fd); - b43_phy_write(dev, B43_PHY_HT_AFE_C3_OVER, 0x07ff); - b43_phy_write(dev, B43_PHY_HT_AFE_C3, 0x00fd); - } -} - -static int b43_phy_ht_op_switch_channel(struct b43_wldev *dev, - unsigned int new_channel) -{ - struct ieee80211_channel *channel = dev->wl->hw->conf.chandef.chan; - enum nl80211_channel_type channel_type = - cfg80211_get_chandef_type(&dev->wl->hw->conf.chandef); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - if ((new_channel < 1) || (new_channel > 14)) - return -EINVAL; - } else { - return -EINVAL; - } - - return b43_phy_ht_set_channel(dev, channel, channel_type); -} - -static unsigned int b43_phy_ht_op_get_default_chan(struct b43_wldev *dev) -{ - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - return 11; - return 36; -} - -/************************************************** - * R/W ops. - **************************************************/ - -static u16 b43_phy_ht_op_read(struct b43_wldev *dev, u16 reg) -{ - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - return b43_read16(dev, B43_MMIO_PHY_DATA); -} - -static void b43_phy_ht_op_write(struct b43_wldev *dev, u16 reg, u16 value) -{ - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - b43_write16(dev, B43_MMIO_PHY_DATA, value); -} - -static void b43_phy_ht_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask, - u16 set) -{ - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - b43_write16(dev, B43_MMIO_PHY_DATA, - (b43_read16(dev, B43_MMIO_PHY_DATA) & mask) | set); -} - -static u16 b43_phy_ht_op_radio_read(struct b43_wldev *dev, u16 reg) -{ - /* HT-PHY needs 0x200 for read access */ - reg |= 0x200; - - b43_write16(dev, B43_MMIO_RADIO24_CONTROL, reg); - return b43_read16(dev, B43_MMIO_RADIO24_DATA); -} - -static void b43_phy_ht_op_radio_write(struct b43_wldev *dev, u16 reg, - u16 value) -{ - b43_write16(dev, B43_MMIO_RADIO24_CONTROL, reg); - b43_write16(dev, B43_MMIO_RADIO24_DATA, value); -} - -static enum b43_txpwr_result -b43_phy_ht_op_recalc_txpower(struct b43_wldev *dev, bool ignore_tssi) -{ - return B43_TXPWR_RES_DONE; -} - -static void b43_phy_ht_op_adjust_txpower(struct b43_wldev *dev) -{ -} - -/************************************************** - * PHY ops struct. - **************************************************/ - -const struct b43_phy_operations b43_phyops_ht = { - .allocate = b43_phy_ht_op_allocate, - .free = b43_phy_ht_op_free, - .prepare_structs = b43_phy_ht_op_prepare_structs, - .init = b43_phy_ht_op_init, - .phy_read = b43_phy_ht_op_read, - .phy_write = b43_phy_ht_op_write, - .phy_maskset = b43_phy_ht_op_maskset, - .radio_read = b43_phy_ht_op_radio_read, - .radio_write = b43_phy_ht_op_radio_write, - .software_rfkill = b43_phy_ht_op_software_rfkill, - .switch_analog = b43_phy_ht_op_switch_analog, - .switch_channel = b43_phy_ht_op_switch_channel, - .get_default_chan = b43_phy_ht_op_get_default_chan, - .recalc_txpower = b43_phy_ht_op_recalc_txpower, - .adjust_txpower = b43_phy_ht_op_adjust_txpower, -}; diff --git a/drivers/net/wireless/b43/phy_ht.h b/drivers/net/wireless/b43/phy_ht.h deleted file mode 100644 index 6cae370d1018..000000000000 --- a/drivers/net/wireless/b43/phy_ht.h +++ /dev/null @@ -1,136 +0,0 @@ -#ifndef B43_PHY_HT_H_ -#define B43_PHY_HT_H_ - -#include "phy_common.h" - - -#define B43_PHY_HT_BBCFG 0x001 /* BB config */ -#define B43_PHY_HT_BBCFG_RSTCCA 0x4000 /* Reset CCA */ -#define B43_PHY_HT_BBCFG_RSTRX 0x8000 /* Reset RX */ -#define B43_PHY_HT_BANDCTL 0x009 /* Band control */ -#define B43_PHY_HT_BANDCTL_5GHZ 0x0001 /* Use the 5GHz band */ -#define B43_PHY_HT_TABLE_ADDR 0x072 /* Table address */ -#define B43_PHY_HT_TABLE_DATALO 0x073 /* Table data low */ -#define B43_PHY_HT_TABLE_DATAHI 0x074 /* Table data high */ -#define B43_PHY_HT_CLASS_CTL 0x0B0 /* Classifier control */ -#define B43_PHY_HT_CLASS_CTL_CCK_EN 0x0001 /* CCK enable */ -#define B43_PHY_HT_CLASS_CTL_OFDM_EN 0x0002 /* OFDM enable */ -#define B43_PHY_HT_CLASS_CTL_WAITED_EN 0x0004 /* Waited enable */ -#define B43_PHY_HT_IQLOCAL_CMDGCTL 0x0C2 /* I/Q LO cal command G control */ -#define B43_PHY_HT_SAMP_CMD 0x0C3 /* Sample command */ -#define B43_PHY_HT_SAMP_CMD_STOP 0x0002 /* Stop */ -#define B43_PHY_HT_SAMP_LOOP_CNT 0x0C4 /* Sample loop count */ -#define B43_PHY_HT_SAMP_WAIT_CNT 0x0C5 /* Sample wait count */ -#define B43_PHY_HT_SAMP_DEP_CNT 0x0C6 /* Sample depth count */ -#define B43_PHY_HT_SAMP_STAT 0x0C7 /* Sample status */ -#define B43_PHY_HT_EST_PWR_C1 0x118 -#define B43_PHY_HT_EST_PWR_C2 0x119 -#define B43_PHY_HT_EST_PWR_C3 0x11A -#define B43_PHY_HT_TSSIMODE 0x122 /* TSSI mode */ -#define B43_PHY_HT_TSSIMODE_EN 0x0001 /* TSSI enable */ -#define B43_PHY_HT_TSSIMODE_PDEN 0x0002 /* Power det enable */ -#define B43_PHY_HT_BW1 0x1CE -#define B43_PHY_HT_BW2 0x1CF -#define B43_PHY_HT_BW3 0x1D0 -#define B43_PHY_HT_BW4 0x1D1 -#define B43_PHY_HT_BW5 0x1D2 -#define B43_PHY_HT_BW6 0x1D3 -#define B43_PHY_HT_TXPCTL_CMD_C1 0x1E7 /* TX power control command */ -#define B43_PHY_HT_TXPCTL_CMD_C1_INIT 0x007F /* Init */ -#define B43_PHY_HT_TXPCTL_CMD_C1_COEFF 0x2000 /* Power control coefficients */ -#define B43_PHY_HT_TXPCTL_CMD_C1_HWPCTLEN 0x4000 /* Hardware TX power control enable */ -#define B43_PHY_HT_TXPCTL_CMD_C1_PCTLEN 0x8000 /* TX power control enable */ -#define B43_PHY_HT_TXPCTL_N 0x1E8 /* TX power control N num */ -#define B43_PHY_HT_TXPCTL_N_TSSID 0x00FF /* N TSSI delay */ -#define B43_PHY_HT_TXPCTL_N_TSSID_SHIFT 0 -#define B43_PHY_HT_TXPCTL_N_NPTIL2 0x0700 /* N PT integer log2 */ -#define B43_PHY_HT_TXPCTL_N_NPTIL2_SHIFT 8 -#define B43_PHY_HT_TXPCTL_IDLE_TSSI 0x1E9 /* TX power control idle TSSI */ -#define B43_PHY_HT_TXPCTL_IDLE_TSSI_C1 0x003F -#define B43_PHY_HT_TXPCTL_IDLE_TSSI_C1_SHIFT 0 -#define B43_PHY_HT_TXPCTL_IDLE_TSSI_C2 0x3F00 -#define B43_PHY_HT_TXPCTL_IDLE_TSSI_C2_SHIFT 8 -#define B43_PHY_HT_TXPCTL_IDLE_TSSI_BINF 0x8000 /* Raw TSSI offset bin format */ -#define B43_PHY_HT_TXPCTL_TARG_PWR 0x1EA /* TX power control target power */ -#define B43_PHY_HT_TXPCTL_TARG_PWR_C1 0x00FF /* Power 0 */ -#define B43_PHY_HT_TXPCTL_TARG_PWR_C1_SHIFT 0 -#define B43_PHY_HT_TXPCTL_TARG_PWR_C2 0xFF00 /* Power 1 */ -#define B43_PHY_HT_TXPCTL_TARG_PWR_C2_SHIFT 8 -#define B43_PHY_HT_TX_PCTL_STATUS_C1 0x1ED -#define B43_PHY_HT_TX_PCTL_STATUS_C2 0x1EE -#define B43_PHY_HT_TXPCTL_CMD_C2 0x222 -#define B43_PHY_HT_TXPCTL_CMD_C2_INIT 0x007F -#define B43_PHY_HT_RSSI_C1 0x219 -#define B43_PHY_HT_RSSI_C2 0x21A -#define B43_PHY_HT_RSSI_C3 0x21B - -#define B43_PHY_HT_C1_CLIP1THRES B43_PHY_OFDM(0x00E) -#define B43_PHY_HT_C2_CLIP1THRES B43_PHY_OFDM(0x04E) -#define B43_PHY_HT_C3_CLIP1THRES B43_PHY_OFDM(0x08E) - -#define B43_PHY_HT_RF_SEQ_MODE B43_PHY_EXTG(0x000) -#define B43_PHY_HT_RF_SEQ_MODE_CA_OVER 0x0001 /* Core active override */ -#define B43_PHY_HT_RF_SEQ_MODE_TR_OVER 0x0002 /* Trigger override */ -#define B43_PHY_HT_RF_SEQ_TRIG B43_PHY_EXTG(0x003) -#define B43_PHY_HT_RF_SEQ_TRIG_RX2TX 0x0001 /* RX2TX */ -#define B43_PHY_HT_RF_SEQ_TRIG_TX2RX 0x0002 /* TX2RX */ -#define B43_PHY_HT_RF_SEQ_TRIG_UPGH 0x0004 /* Update gain H */ -#define B43_PHY_HT_RF_SEQ_TRIG_UPGL 0x0008 /* Update gain L */ -#define B43_PHY_HT_RF_SEQ_TRIG_UPGU 0x0010 /* Update gain U */ -#define B43_PHY_HT_RF_SEQ_TRIG_RST2RX 0x0020 /* Reset to RX */ -#define B43_PHY_HT_RF_SEQ_STATUS B43_PHY_EXTG(0x004) -/* Values for the status are the same as for the trigger */ - -#define B43_PHY_HT_RF_CTL1 B43_PHY_EXTG(0x010) - -#define B43_PHY_HT_RF_CTL_INT_C1 B43_PHY_EXTG(0x04c) -#define B43_PHY_HT_RF_CTL_INT_C2 B43_PHY_EXTG(0x06c) -#define B43_PHY_HT_RF_CTL_INT_C3 B43_PHY_EXTG(0x08c) - -#define B43_PHY_HT_AFE_C1_OVER B43_PHY_EXTG(0x110) -#define B43_PHY_HT_AFE_C1 B43_PHY_EXTG(0x111) -#define B43_PHY_HT_AFE_C2_OVER B43_PHY_EXTG(0x114) -#define B43_PHY_HT_AFE_C2 B43_PHY_EXTG(0x115) -#define B43_PHY_HT_AFE_C3_OVER B43_PHY_EXTG(0x118) -#define B43_PHY_HT_AFE_C3 B43_PHY_EXTG(0x119) - -#define B43_PHY_HT_TXPCTL_CMD_C3 B43_PHY_EXTG(0x164) -#define B43_PHY_HT_TXPCTL_CMD_C3_INIT 0x007F -#define B43_PHY_HT_TXPCTL_IDLE_TSSI2 B43_PHY_EXTG(0x165) /* TX power control idle TSSI */ -#define B43_PHY_HT_TXPCTL_IDLE_TSSI2_C3 0x003F -#define B43_PHY_HT_TXPCTL_IDLE_TSSI2_C3_SHIFT 0 -#define B43_PHY_HT_TXPCTL_TARG_PWR2 B43_PHY_EXTG(0x166) /* TX power control target power */ -#define B43_PHY_HT_TXPCTL_TARG_PWR2_C3 0x00FF -#define B43_PHY_HT_TXPCTL_TARG_PWR2_C3_SHIFT 0 -#define B43_PHY_HT_TX_PCTL_STATUS_C3 B43_PHY_EXTG(0x169) - -#define B43_PHY_HT_TEST B43_PHY_N_BMODE(0x00A) - - -/* Values for PHY registers used on channel switching */ -struct b43_phy_ht_channeltab_e_phy { - u16 bw1; - u16 bw2; - u16 bw3; - u16 bw4; - u16 bw5; - u16 bw6; -}; - - -struct b43_phy_ht { - u16 rf_ctl_int_save[3]; - - bool tx_pwr_ctl; - u8 tx_pwr_idx[3]; - - s32 bb_mult_save[3]; - - u8 idle_tssi[3]; -}; - - -struct b43_phy_operations; -extern const struct b43_phy_operations b43_phyops_ht; - -#endif /* B43_PHY_HT_H_ */ diff --git a/drivers/net/wireless/b43/phy_lcn.c b/drivers/net/wireless/b43/phy_lcn.c deleted file mode 100644 index 0bafa3b17035..000000000000 --- a/drivers/net/wireless/b43/phy_lcn.c +++ /dev/null @@ -1,902 +0,0 @@ -/* - - Broadcom B43 wireless driver - IEEE 802.11n LCN-PHY support - - Copyright (c) 2011 Rafał Miłecki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - - This file incorporates work covered by the following copyright and - permission notice: - - Copyright (c) 2010 Broadcom Corporation - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. -*/ - -#include - -#include "b43.h" -#include "phy_lcn.h" -#include "tables_phy_lcn.h" -#include "main.h" - -struct lcn_tx_gains { - u16 gm_gain; - u16 pga_gain; - u16 pad_gain; - u16 dac_gain; -}; - -struct lcn_tx_iir_filter { - u8 type; - u16 values[16]; -}; - -enum lcn_sense_type { - B43_SENSE_TEMP, - B43_SENSE_VBAT, -}; - -/* In theory it's PHY common function, move if needed */ -/* brcms_b_switch_macfreq */ -static void b43_phy_switch_macfreq(struct b43_wldev *dev, u8 spurmode) -{ - if (dev->dev->chip_id == 43224 || dev->dev->chip_id == 43225) { - switch (spurmode) { - case 2: /* 126 Mhz */ - b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_LOW, 0x2082); - b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_HIGH, 0x8); - break; - case 1: /* 123 Mhz */ - b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_LOW, 0x5341); - b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_HIGH, 0x8); - break; - default: /* 120 Mhz */ - b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_LOW, 0x8889); - b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_HIGH, 0x8); - break; - } - } else if (dev->phy.type == B43_PHYTYPE_LCN) { - switch (spurmode) { - case 1: /* 82 Mhz */ - b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_LOW, 0x7CE0); - b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_HIGH, 0xC); - break; - default: /* 80 Mhz */ - b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_LOW, 0xCCCD); - b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_HIGH, 0xC); - break; - } - } -} - -/************************************************** - * Radio 2064. - **************************************************/ - -/* wlc_lcnphy_radio_2064_channel_tune_4313 */ -static void b43_radio_2064_channel_setup(struct b43_wldev *dev) -{ - u16 save[2]; - - b43_radio_set(dev, 0x09d, 0x4); - b43_radio_write(dev, 0x09e, 0xf); - - /* Channel specific values in theory, in practice always the same */ - b43_radio_write(dev, 0x02a, 0xb); - b43_radio_maskset(dev, 0x030, ~0x3, 0xa); - b43_radio_maskset(dev, 0x091, ~0x3, 0); - b43_radio_maskset(dev, 0x038, ~0xf, 0x7); - b43_radio_maskset(dev, 0x030, ~0xc, 0x8); - b43_radio_maskset(dev, 0x05e, ~0xf, 0x8); - b43_radio_maskset(dev, 0x05e, ~0xf0, 0x80); - b43_radio_write(dev, 0x06c, 0x80); - - save[0] = b43_radio_read(dev, 0x044); - save[1] = b43_radio_read(dev, 0x12b); - - b43_radio_set(dev, 0x044, 0x7); - b43_radio_set(dev, 0x12b, 0xe); - - /* TODO */ - - b43_radio_write(dev, 0x040, 0xfb); - - b43_radio_write(dev, 0x041, 0x9a); - b43_radio_write(dev, 0x042, 0xa3); - b43_radio_write(dev, 0x043, 0x0c); - - /* TODO */ - - b43_radio_set(dev, 0x044, 0x0c); - udelay(1); - - b43_radio_write(dev, 0x044, save[0]); - b43_radio_write(dev, 0x12b, save[1]); - - if (dev->phy.rev == 1) { - /* brcmsmac uses outdated 0x3 for 0x038 */ - b43_radio_write(dev, 0x038, 0x0); - b43_radio_write(dev, 0x091, 0x7); - } -} - -/* wlc_radio_2064_init */ -static void b43_radio_2064_init(struct b43_wldev *dev) -{ - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - b43_radio_write(dev, 0x09c, 0x0020); - b43_radio_write(dev, 0x105, 0x0008); - } else { - /* TODO */ - } - b43_radio_write(dev, 0x032, 0x0062); - b43_radio_write(dev, 0x033, 0x0019); - b43_radio_write(dev, 0x090, 0x0010); - b43_radio_write(dev, 0x010, 0x0000); - if (dev->phy.rev == 1) { - b43_radio_write(dev, 0x060, 0x007f); - b43_radio_write(dev, 0x061, 0x0072); - b43_radio_write(dev, 0x062, 0x007f); - } - b43_radio_write(dev, 0x01d, 0x0002); - b43_radio_write(dev, 0x01e, 0x0006); - - b43_phy_write(dev, 0x4ea, 0x4688); - b43_phy_maskset(dev, 0x4eb, ~0x7, 0x2); - b43_phy_mask(dev, 0x4eb, ~0x01c0); - b43_phy_maskset(dev, 0x46a, 0xff00, 0x19); - - b43_lcntab_write(dev, B43_LCNTAB16(0x00, 0x55), 0); - - b43_radio_mask(dev, 0x05b, (u16) ~0xff02); - b43_radio_set(dev, 0x004, 0x40); - b43_radio_set(dev, 0x120, 0x10); - b43_radio_set(dev, 0x078, 0x80); - b43_radio_set(dev, 0x129, 0x2); - b43_radio_set(dev, 0x057, 0x1); - b43_radio_set(dev, 0x05b, 0x2); - - /* TODO: wait for some bit to be set */ - b43_radio_read(dev, 0x05c); - - b43_radio_mask(dev, 0x05b, (u16) ~0xff02); - b43_radio_mask(dev, 0x057, (u16) ~0xff01); - - b43_phy_write(dev, 0x933, 0x2d6b); - b43_phy_write(dev, 0x934, 0x2d6b); - b43_phy_write(dev, 0x935, 0x2d6b); - b43_phy_write(dev, 0x936, 0x2d6b); - b43_phy_write(dev, 0x937, 0x016b); - - b43_radio_mask(dev, 0x057, (u16) ~0xff02); - b43_radio_write(dev, 0x0c2, 0x006f); -} - -/************************************************** - * Various PHY ops - **************************************************/ - -/* wlc_lcnphy_toggle_afe_pwdn */ -static void b43_phy_lcn_afe_set_unset(struct b43_wldev *dev) -{ - u16 afe_ctl2 = b43_phy_read(dev, B43_PHY_LCN_AFE_CTL2); - u16 afe_ctl1 = b43_phy_read(dev, B43_PHY_LCN_AFE_CTL1); - - b43_phy_write(dev, B43_PHY_LCN_AFE_CTL2, afe_ctl2 | 0x1); - b43_phy_write(dev, B43_PHY_LCN_AFE_CTL1, afe_ctl1 | 0x1); - - b43_phy_write(dev, B43_PHY_LCN_AFE_CTL2, afe_ctl2 & ~0x1); - b43_phy_write(dev, B43_PHY_LCN_AFE_CTL1, afe_ctl1 & ~0x1); - - b43_phy_write(dev, B43_PHY_LCN_AFE_CTL2, afe_ctl2); - b43_phy_write(dev, B43_PHY_LCN_AFE_CTL1, afe_ctl1); -} - -/* wlc_lcnphy_get_pa_gain */ -static u16 b43_phy_lcn_get_pa_gain(struct b43_wldev *dev) -{ - return (b43_phy_read(dev, 0x4fb) & 0x7f00) >> 8; -} - -/* wlc_lcnphy_set_dac_gain */ -static void b43_phy_lcn_set_dac_gain(struct b43_wldev *dev, u16 dac_gain) -{ - u16 dac_ctrl; - - dac_ctrl = b43_phy_read(dev, 0x439); - dac_ctrl = dac_ctrl & 0xc7f; - dac_ctrl = dac_ctrl | (dac_gain << 7); - b43_phy_maskset(dev, 0x439, ~0xfff, dac_ctrl); -} - -/* wlc_lcnphy_set_bbmult */ -static void b43_phy_lcn_set_bbmult(struct b43_wldev *dev, u8 m0) -{ - b43_lcntab_write(dev, B43_LCNTAB16(0x00, 0x57), m0 << 8); -} - -/* wlc_lcnphy_clear_tx_power_offsets */ -static void b43_phy_lcn_clear_tx_power_offsets(struct b43_wldev *dev) -{ - u8 i; - - if (1) { /* FIXME */ - b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, (0x7 << 10) | 0x340); - for (i = 0; i < 30; i++) { - b43_phy_write(dev, B43_PHY_LCN_TABLE_DATAHI, 0); - b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, 0); - } - } - - b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, (0x7 << 10) | 0x80); - for (i = 0; i < 64; i++) { - b43_phy_write(dev, B43_PHY_LCN_TABLE_DATAHI, 0); - b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, 0); - } -} - -/* wlc_lcnphy_rev0_baseband_init */ -static void b43_phy_lcn_rev0_baseband_init(struct b43_wldev *dev) -{ - b43_radio_write(dev, 0x11c, 0); - - b43_phy_write(dev, 0x43b, 0); - b43_phy_write(dev, 0x43c, 0); - b43_phy_write(dev, 0x44c, 0); - b43_phy_write(dev, 0x4e6, 0); - b43_phy_write(dev, 0x4f9, 0); - b43_phy_write(dev, 0x4b0, 0); - b43_phy_write(dev, 0x938, 0); - b43_phy_write(dev, 0x4b0, 0); - b43_phy_write(dev, 0x44e, 0); - - b43_phy_set(dev, 0x567, 0x03); - - b43_phy_set(dev, 0x44a, 0x44); - b43_phy_write(dev, 0x44a, 0x80); - - if (!(dev->dev->bus_sprom->boardflags_lo & B43_BFL_FEM)) - ; /* TODO */ - b43_phy_maskset(dev, 0x634, ~0xff, 0xc); - if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_FEM) { - b43_phy_maskset(dev, 0x634, ~0xff, 0xa); - b43_phy_write(dev, 0x910, 0x1); - } - - b43_phy_write(dev, 0x910, 0x1); - - b43_phy_maskset(dev, 0x448, ~0x300, 0x100); - b43_phy_maskset(dev, 0x608, ~0xff, 0x17); - b43_phy_maskset(dev, 0x604, ~0x7ff, 0x3ea); -} - -/* wlc_lcnphy_bu_tweaks */ -static void b43_phy_lcn_bu_tweaks(struct b43_wldev *dev) -{ - b43_phy_set(dev, 0x805, 0x1); - - b43_phy_maskset(dev, 0x42f, ~0x7, 0x3); - b43_phy_maskset(dev, 0x030, ~0x7, 0x3); - - b43_phy_write(dev, 0x414, 0x1e10); - b43_phy_write(dev, 0x415, 0x0640); - - b43_phy_maskset(dev, 0x4df, (u16) ~0xff00, 0xf700); - - b43_phy_set(dev, 0x44a, 0x44); - b43_phy_write(dev, 0x44a, 0x80); - - b43_phy_maskset(dev, 0x434, ~0xff, 0xfd); - b43_phy_maskset(dev, 0x420, ~0xff, 0x10); - - if (dev->dev->bus_sprom->board_rev >= 0x1204) - b43_radio_set(dev, 0x09b, 0xf0); - - b43_phy_write(dev, 0x7d6, 0x0902); - - b43_phy_maskset(dev, 0x429, ~0xf, 0x9); - b43_phy_maskset(dev, 0x429, ~(0x3f << 4), 0xe << 4); - - if (dev->phy.rev == 1) { - b43_phy_maskset(dev, 0x423, ~0xff, 0x46); - b43_phy_maskset(dev, 0x411, ~0xff, 1); - b43_phy_set(dev, 0x434, 0xff); /* FIXME: update to wl */ - - /* TODO: wl operates on PHY 0x416, brcmsmac is outdated here */ - - b43_phy_maskset(dev, 0x656, ~0xf, 2); - b43_phy_set(dev, 0x44d, 4); - - b43_radio_set(dev, 0x0f7, 0x4); - b43_radio_mask(dev, 0x0f1, ~0x3); - b43_radio_maskset(dev, 0x0f2, ~0xf8, 0x90); - b43_radio_maskset(dev, 0x0f3, ~0x3, 0x2); - b43_radio_maskset(dev, 0x0f3, ~0xf0, 0xa0); - - b43_radio_set(dev, 0x11f, 0x2); - - b43_phy_lcn_clear_tx_power_offsets(dev); - - /* TODO: something more? */ - } -} - -/* wlc_lcnphy_vbat_temp_sense_setup */ -static void b43_phy_lcn_sense_setup(struct b43_wldev *dev, - enum lcn_sense_type sense_type) -{ - u8 auxpga_vmidcourse, auxpga_vmidfine, auxpga_gain; - u16 auxpga_vmid; - u8 tx_pwr_idx; - u8 i; - - u16 save_radio_regs[6][2] = { - { 0x007, 0 }, { 0x0ff, 0 }, { 0x11f, 0 }, { 0x005, 0 }, - { 0x025, 0 }, { 0x112, 0 }, - }; - u16 save_phy_regs[14][2] = { - { 0x503, 0 }, { 0x4a4, 0 }, { 0x4d0, 0 }, { 0x4d9, 0 }, - { 0x4da, 0 }, { 0x4a6, 0 }, { 0x938, 0 }, { 0x939, 0 }, - { 0x4d8, 0 }, { 0x4d0, 0 }, { 0x4d7, 0 }, { 0x4a5, 0 }, - { 0x40d, 0 }, { 0x4a2, 0 }, - }; - u16 save_radio_4a4; - - msleep(1); - - /* Save */ - for (i = 0; i < 6; i++) - save_radio_regs[i][1] = b43_radio_read(dev, - save_radio_regs[i][0]); - for (i = 0; i < 14; i++) - save_phy_regs[i][1] = b43_phy_read(dev, save_phy_regs[i][0]); - b43_mac_suspend(dev); - save_radio_4a4 = b43_radio_read(dev, 0x4a4); - /* wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); */ - tx_pwr_idx = dev->phy.lcn->tx_pwr_curr_idx; - - /* Setup */ - /* TODO: wlc_lcnphy_set_tx_pwr_by_index(pi, 127); */ - b43_radio_set(dev, 0x007, 0x1); - b43_radio_set(dev, 0x0ff, 0x10); - b43_radio_set(dev, 0x11f, 0x4); - - b43_phy_mask(dev, 0x503, ~0x1); - b43_phy_mask(dev, 0x503, ~0x4); - b43_phy_mask(dev, 0x4a4, ~0x4000); - b43_phy_mask(dev, 0x4a4, (u16) ~0x8000); - b43_phy_mask(dev, 0x4d0, ~0x20); - b43_phy_set(dev, 0x4a5, 0xff); - b43_phy_maskset(dev, 0x4a5, ~0x7000, 0x5000); - b43_phy_mask(dev, 0x4a5, ~0x700); - b43_phy_maskset(dev, 0x40d, ~0xff, 64); - b43_phy_maskset(dev, 0x40d, ~0x700, 0x600); - b43_phy_maskset(dev, 0x4a2, ~0xff, 64); - b43_phy_maskset(dev, 0x4a2, ~0x700, 0x600); - b43_phy_maskset(dev, 0x4d9, ~0x70, 0x20); - b43_phy_maskset(dev, 0x4d9, ~0x700, 0x300); - b43_phy_maskset(dev, 0x4d9, ~0x7000, 0x1000); - b43_phy_mask(dev, 0x4da, ~0x1000); - b43_phy_set(dev, 0x4da, 0x2000); - b43_phy_set(dev, 0x4a6, 0x8000); - - b43_radio_write(dev, 0x025, 0xc); - b43_radio_set(dev, 0x005, 0x8); - b43_phy_set(dev, 0x938, 0x4); - b43_phy_set(dev, 0x939, 0x4); - b43_phy_set(dev, 0x4a4, 0x1000); - - /* FIXME: don't hardcode */ - b43_lcntab_write(dev, B43_LCNTAB16(0x8, 0x6), 0x640); - - switch (sense_type) { - case B43_SENSE_TEMP: - b43_phy_set(dev, 0x4d7, 0x8); - b43_phy_maskset(dev, 0x4d7, ~0x7000, 0x1000); - auxpga_vmidcourse = 8; - auxpga_vmidfine = 0x4; - auxpga_gain = 2; - b43_radio_set(dev, 0x082, 0x20); - break; - case B43_SENSE_VBAT: - b43_phy_set(dev, 0x4d7, 0x8); - b43_phy_maskset(dev, 0x4d7, ~0x7000, 0x3000); - auxpga_vmidcourse = 7; - auxpga_vmidfine = 0xa; - auxpga_gain = 2; - break; - } - auxpga_vmid = (0x200 | (auxpga_vmidcourse << 4) | auxpga_vmidfine); - - b43_phy_set(dev, 0x4d8, 0x1); - b43_phy_maskset(dev, 0x4d8, ~(0x3ff << 2), auxpga_vmid << 2); - b43_phy_set(dev, 0x4d8, 0x2); - b43_phy_maskset(dev, 0x4d8, ~(0x7 << 12), auxpga_gain << 12); - b43_phy_set(dev, 0x4d0, 0x20); - b43_radio_write(dev, 0x112, 0x6); - - b43_dummy_transmission(dev, true, false); - /* Wait if not done */ - if (!(b43_phy_read(dev, 0x476) & 0x8000)) - udelay(10); - - /* Restore */ - for (i = 0; i < 6; i++) - b43_radio_write(dev, save_radio_regs[i][0], - save_radio_regs[i][1]); - for (i = 0; i < 14; i++) - b43_phy_write(dev, save_phy_regs[i][0], save_phy_regs[i][1]); - /* TODO: wlc_lcnphy_set_tx_pwr_by_index(tx_pwr_idx) */ - b43_radio_write(dev, 0x4a4, save_radio_4a4); - - b43_mac_enable(dev); - - msleep(1); -} - -static bool b43_phy_lcn_load_tx_iir_cck_filter(struct b43_wldev *dev, - u8 filter_type) -{ - int i, j; - u16 phy_regs[] = { 0x910, 0x91e, 0x91f, 0x924, 0x925, 0x926, 0x920, - 0x921, 0x927, 0x928, 0x929, 0x922, 0x923, 0x930, - 0x931, 0x932 }; - /* Table is from brcmsmac, values for type 25 were outdated, probably - * others need updating too */ - struct lcn_tx_iir_filter tx_iir_filters_cck[] = { - { 0, { 1, 415, 1874, 64, 128, 64, 792, 1656, 64, 128, 64, 778, - 1582, 64, 128, 64 } }, - { 1, { 1, 402, 1847, 259, 59, 259, 671, 1794, 68, 54, 68, 608, - 1863, 93, 167, 93 } }, - { 2, { 1, 415, 1874, 64, 128, 64, 792, 1656, 192, 384, 192, - 778, 1582, 64, 128, 64 } }, - { 3, { 1, 302, 1841, 129, 258, 129, 658, 1720, 205, 410, 205, - 754, 1760, 170, 340, 170 } }, - { 20, { 1, 360, 1884, 242, 1734, 242, 752, 1720, 205, 1845, 205, - 767, 1760, 256, 185, 256 } }, - { 21, { 1, 360, 1884, 149, 1874, 149, 752, 1720, 205, 1883, 205, - 767, 1760, 256, 273, 256 } }, - { 22, { 1, 360, 1884, 98, 1948, 98, 752, 1720, 205, 1924, 205, - 767, 1760, 256, 352, 256 } }, - { 23, { 1, 350, 1884, 116, 1966, 116, 752, 1720, 205, 2008, 205, - 767, 1760, 128, 233, 128 } }, - { 24, { 1, 325, 1884, 32, 40, 32, 756, 1720, 256, 471, 256, 766, - 1760, 256, 1881, 256 } }, - { 25, { 1, 299, 1884, 51, 64, 51, 736, 1720, 256, 471, 256, 765, - 1760, 262, 1878, 262 } }, - /* brcmsmac version { 25, { 1, 299, 1884, 51, 64, 51, 736, 1720, - * 256, 471, 256, 765, 1760, 256, 1881, 256 } }, */ - { 26, { 1, 277, 1943, 39, 117, 88, 637, 1838, 64, 192, 144, 614, - 1864, 128, 384, 288 } }, - { 27, { 1, 245, 1943, 49, 147, 110, 626, 1838, 256, 768, 576, - 613, 1864, 128, 384, 288 } }, - { 30, { 1, 302, 1841, 61, 122, 61, 658, 1720, 205, 410, 205, - 754, 1760, 170, 340, 170 } }, - }; - - for (i = 0; i < ARRAY_SIZE(tx_iir_filters_cck); i++) { - if (tx_iir_filters_cck[i].type == filter_type) { - for (j = 0; j < 16; j++) - b43_phy_write(dev, phy_regs[j], - tx_iir_filters_cck[i].values[j]); - return true; - } - } - - return false; -} - -static bool b43_phy_lcn_load_tx_iir_ofdm_filter(struct b43_wldev *dev, - u8 filter_type) -{ - int i, j; - u16 phy_regs[] = { 0x90f, 0x900, 0x901, 0x906, 0x907, 0x908, 0x902, - 0x903, 0x909, 0x90a, 0x90b, 0x904, 0x905, 0x90c, - 0x90d, 0x90e }; - struct lcn_tx_iir_filter tx_iir_filters_ofdm[] = { - { 0, { 0, 0xa2, 0x0, 0x100, 0x100, 0x0, 0x0, 0x0, 0x100, 0x0, - 0x0, 0x278, 0xfea0, 0x80, 0x100, 0x80 } }, - { 1, { 0, 374, 0xFF79, 16, 32, 16, 799, 0xFE74, 50, 32, 50, 750, - 0xFE2B, 212, 0xFFCE, 212 } }, - { 2, { 0, 375, 0xFF16, 37, 76, 37, 799, 0xFE74, 32, 20, 32, 748, - 0xFEF2, 128, 0xFFE2, 128 } }, - }; - - for (i = 0; i < ARRAY_SIZE(tx_iir_filters_ofdm); i++) { - if (tx_iir_filters_ofdm[i].type == filter_type) { - for (j = 0; j < 16; j++) - b43_phy_write(dev, phy_regs[j], - tx_iir_filters_ofdm[i].values[j]); - return true; - } - } - - return false; -} - -/* wlc_lcnphy_set_tx_gain_override */ -static void b43_phy_lcn_set_tx_gain_override(struct b43_wldev *dev, bool enable) -{ - b43_phy_maskset(dev, 0x4b0, ~(0x1 << 7), enable << 7); - b43_phy_maskset(dev, 0x4b0, ~(0x1 << 14), enable << 14); - b43_phy_maskset(dev, 0x43b, ~(0x1 << 6), enable << 6); -} - -/* wlc_lcnphy_set_tx_gain */ -static void b43_phy_lcn_set_tx_gain(struct b43_wldev *dev, - struct lcn_tx_gains *target_gains) -{ - u16 pa_gain = b43_phy_lcn_get_pa_gain(dev); - - b43_phy_write(dev, 0x4b5, - (target_gains->gm_gain | (target_gains->pga_gain << 8))); - b43_phy_maskset(dev, 0x4fb, ~0x7fff, - (target_gains->pad_gain | (pa_gain << 8))); - b43_phy_write(dev, 0x4fc, - (target_gains->gm_gain | (target_gains->pga_gain << 8))); - b43_phy_maskset(dev, 0x4fd, ~0x7fff, - (target_gains->pad_gain | (pa_gain << 8))); - - b43_phy_lcn_set_dac_gain(dev, target_gains->dac_gain); - b43_phy_lcn_set_tx_gain_override(dev, true); -} - -/* wlc_lcnphy_tx_pwr_ctrl_init */ -static void b43_phy_lcn_tx_pwr_ctl_init(struct b43_wldev *dev) -{ - struct lcn_tx_gains tx_gains; - u8 bbmult; - - b43_mac_suspend(dev); - - if (!dev->phy.lcn->hw_pwr_ctl_capable) { - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - tx_gains.gm_gain = 4; - tx_gains.pga_gain = 12; - tx_gains.pad_gain = 12; - tx_gains.dac_gain = 0; - bbmult = 150; - } else { - tx_gains.gm_gain = 7; - tx_gains.pga_gain = 15; - tx_gains.pad_gain = 14; - tx_gains.dac_gain = 0; - bbmult = 150; - } - b43_phy_lcn_set_tx_gain(dev, &tx_gains); - b43_phy_lcn_set_bbmult(dev, bbmult); - b43_phy_lcn_sense_setup(dev, B43_SENSE_TEMP); - } else { - b43err(dev->wl, "TX power control not supported for this HW\n"); - } - - b43_mac_enable(dev); -} - -/* wlc_lcnphy_txrx_spur_avoidance_mode */ -static void b43_phy_lcn_txrx_spur_avoidance_mode(struct b43_wldev *dev, - bool enable) -{ - if (enable) { - b43_phy_write(dev, 0x942, 0x7); - b43_phy_write(dev, 0x93b, ((1 << 13) + 23)); - b43_phy_write(dev, 0x93c, ((1 << 13) + 1989)); - - b43_phy_write(dev, 0x44a, 0x084); - b43_phy_write(dev, 0x44a, 0x080); - b43_phy_write(dev, 0x6d3, 0x2222); - b43_phy_write(dev, 0x6d3, 0x2220); - } else { - b43_phy_write(dev, 0x942, 0x0); - b43_phy_write(dev, 0x93b, ((0 << 13) + 23)); - b43_phy_write(dev, 0x93c, ((0 << 13) + 1989)); - } - b43_phy_switch_macfreq(dev, enable); -} - -/************************************************** - * Channel switching ops. - **************************************************/ - -/* wlc_lcnphy_set_chanspec_tweaks */ -static void b43_phy_lcn_set_channel_tweaks(struct b43_wldev *dev, int channel) -{ - struct bcma_drv_cc *cc = &dev->dev->bdev->bus->drv_cc; - - b43_phy_maskset(dev, 0x448, ~0x300, (channel == 14) ? 0x200 : 0x100); - - if (channel == 1 || channel == 2 || channel == 3 || channel == 4 || - channel == 9 || channel == 10 || channel == 11 || channel == 12) { - bcma_chipco_pll_write(cc, 0x2, 0x03000c04); - bcma_chipco_pll_maskset(cc, 0x3, 0x00ffffff, 0x0); - bcma_chipco_pll_write(cc, 0x4, 0x200005c0); - - bcma_cc_set32(cc, BCMA_CC_PMU_CTL, 0x400); - - b43_phy_write(dev, 0x942, 0); - - b43_phy_lcn_txrx_spur_avoidance_mode(dev, false); - b43_phy_maskset(dev, 0x424, (u16) ~0xff00, 0x1b00); - b43_phy_write(dev, 0x425, 0x5907); - } else { - bcma_chipco_pll_write(cc, 0x2, 0x03140c04); - bcma_chipco_pll_maskset(cc, 0x3, 0x00ffffff, 0x333333); - bcma_chipco_pll_write(cc, 0x4, 0x202c2820); - - bcma_cc_set32(cc, BCMA_CC_PMU_CTL, 0x400); - - b43_phy_write(dev, 0x942, 0); - - b43_phy_lcn_txrx_spur_avoidance_mode(dev, true); - b43_phy_maskset(dev, 0x424, (u16) ~0xff00, 0x1f00); - b43_phy_write(dev, 0x425, 0x590a); - } - - b43_phy_set(dev, 0x44a, 0x44); - b43_phy_write(dev, 0x44a, 0x80); -} - -/* wlc_phy_chanspec_set_lcnphy */ -static int b43_phy_lcn_set_channel(struct b43_wldev *dev, - struct ieee80211_channel *channel, - enum nl80211_channel_type channel_type) -{ - static const u16 sfo_cfg[14][2] = { - {965, 1087}, {967, 1085}, {969, 1082}, {971, 1080}, {973, 1078}, - {975, 1076}, {977, 1073}, {979, 1071}, {981, 1069}, {983, 1067}, - {985, 1065}, {987, 1063}, {989, 1060}, {994, 1055}, - }; - - b43_phy_lcn_set_channel_tweaks(dev, channel->hw_value); - - b43_phy_set(dev, 0x44a, 0x44); - b43_phy_write(dev, 0x44a, 0x80); - - b43_radio_2064_channel_setup(dev); - mdelay(1); - - b43_phy_lcn_afe_set_unset(dev); - - b43_phy_write(dev, 0x657, sfo_cfg[channel->hw_value - 1][0]); - b43_phy_write(dev, 0x658, sfo_cfg[channel->hw_value - 1][1]); - - if (channel->hw_value == 14) { - b43_phy_maskset(dev, 0x448, ~(0x3 << 8), (2) << 8); - b43_phy_lcn_load_tx_iir_cck_filter(dev, 3); - } else { - b43_phy_maskset(dev, 0x448, ~(0x3 << 8), (1) << 8); - /* brcmsmac uses filter_type 2, we follow wl with 25 */ - b43_phy_lcn_load_tx_iir_cck_filter(dev, 25); - } - /* brcmsmac uses filter_type 2, we follow wl with 0 */ - b43_phy_lcn_load_tx_iir_ofdm_filter(dev, 0); - - b43_phy_maskset(dev, 0x4eb, ~(0x7 << 3), 0x1 << 3); - - return 0; -} - -/************************************************** - * Basic PHY ops. - **************************************************/ - -static int b43_phy_lcn_op_allocate(struct b43_wldev *dev) -{ - struct b43_phy_lcn *phy_lcn; - - phy_lcn = kzalloc(sizeof(*phy_lcn), GFP_KERNEL); - if (!phy_lcn) - return -ENOMEM; - dev->phy.lcn = phy_lcn; - - return 0; -} - -static void b43_phy_lcn_op_free(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_lcn *phy_lcn = phy->lcn; - - kfree(phy_lcn); - phy->lcn = NULL; -} - -static void b43_phy_lcn_op_prepare_structs(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_lcn *phy_lcn = phy->lcn; - - memset(phy_lcn, 0, sizeof(*phy_lcn)); -} - -/* wlc_phy_init_lcnphy */ -static int b43_phy_lcn_op_init(struct b43_wldev *dev) -{ - struct bcma_drv_cc *cc = &dev->dev->bdev->bus->drv_cc; - - b43_phy_set(dev, 0x44a, 0x80); - b43_phy_mask(dev, 0x44a, 0x7f); - b43_phy_set(dev, 0x6d1, 0x80); - b43_phy_write(dev, 0x6d0, 0x7); - - b43_phy_lcn_afe_set_unset(dev); - - b43_phy_write(dev, 0x60a, 0xa0); - b43_phy_write(dev, 0x46a, 0x19); - b43_phy_maskset(dev, 0x663, 0xFF00, 0x64); - - b43_phy_lcn_tables_init(dev); - - b43_phy_lcn_rev0_baseband_init(dev); - b43_phy_lcn_bu_tweaks(dev); - - if (dev->phy.radio_ver == 0x2064) - b43_radio_2064_init(dev); - else - B43_WARN_ON(1); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - b43_phy_lcn_tx_pwr_ctl_init(dev); - - b43_switch_channel(dev, dev->phy.channel); - - bcma_chipco_regctl_maskset(cc, 0, 0xf, 0x9); - bcma_chipco_chipctl_maskset(cc, 0, 0, 0x03cddddd); - - /* TODO */ - - b43_phy_set(dev, 0x448, 0x4000); - udelay(100); - b43_phy_mask(dev, 0x448, ~0x4000); - - /* TODO */ - - return 0; -} - -static void b43_phy_lcn_op_software_rfkill(struct b43_wldev *dev, - bool blocked) -{ - if (b43_read32(dev, B43_MMIO_MACCTL) & B43_MACCTL_ENABLED) - b43err(dev->wl, "MAC not suspended\n"); - - if (blocked) { - b43_phy_mask(dev, B43_PHY_LCN_RF_CTL2, ~0x7c00); - b43_phy_set(dev, B43_PHY_LCN_RF_CTL1, 0x1f00); - - b43_phy_mask(dev, B43_PHY_LCN_RF_CTL5, ~0x7f00); - b43_phy_mask(dev, B43_PHY_LCN_RF_CTL4, ~0x2); - b43_phy_set(dev, B43_PHY_LCN_RF_CTL3, 0x808); - - b43_phy_mask(dev, B43_PHY_LCN_RF_CTL7, ~0x8); - b43_phy_set(dev, B43_PHY_LCN_RF_CTL6, 0x8); - } else { - b43_phy_mask(dev, B43_PHY_LCN_RF_CTL1, ~0x1f00); - b43_phy_mask(dev, B43_PHY_LCN_RF_CTL3, ~0x808); - b43_phy_mask(dev, B43_PHY_LCN_RF_CTL6, ~0x8); - } -} - -static void b43_phy_lcn_op_switch_analog(struct b43_wldev *dev, bool on) -{ - if (on) { - b43_phy_mask(dev, B43_PHY_LCN_AFE_CTL1, ~0x7); - } else { - b43_phy_set(dev, B43_PHY_LCN_AFE_CTL2, 0x7); - b43_phy_set(dev, B43_PHY_LCN_AFE_CTL1, 0x7); - } -} - -static int b43_phy_lcn_op_switch_channel(struct b43_wldev *dev, - unsigned int new_channel) -{ - struct ieee80211_channel *channel = dev->wl->hw->conf.chandef.chan; - enum nl80211_channel_type channel_type = - cfg80211_get_chandef_type(&dev->wl->hw->conf.chandef); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - if ((new_channel < 1) || (new_channel > 14)) - return -EINVAL; - } else { - return -EINVAL; - } - - return b43_phy_lcn_set_channel(dev, channel, channel_type); -} - -static unsigned int b43_phy_lcn_op_get_default_chan(struct b43_wldev *dev) -{ - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - return 1; - return 36; -} - -static enum b43_txpwr_result -b43_phy_lcn_op_recalc_txpower(struct b43_wldev *dev, bool ignore_tssi) -{ - return B43_TXPWR_RES_DONE; -} - -static void b43_phy_lcn_op_adjust_txpower(struct b43_wldev *dev) -{ -} - -/************************************************** - * R/W ops. - **************************************************/ - -static u16 b43_phy_lcn_op_read(struct b43_wldev *dev, u16 reg) -{ - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - return b43_read16(dev, B43_MMIO_PHY_DATA); -} - -static void b43_phy_lcn_op_write(struct b43_wldev *dev, u16 reg, u16 value) -{ - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - b43_write16(dev, B43_MMIO_PHY_DATA, value); -} - -static void b43_phy_lcn_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask, - u16 set) -{ - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - b43_write16(dev, B43_MMIO_PHY_DATA, - (b43_read16(dev, B43_MMIO_PHY_DATA) & mask) | set); -} - -static u16 b43_phy_lcn_op_radio_read(struct b43_wldev *dev, u16 reg) -{ - /* LCN-PHY needs 0x200 for read access */ - reg |= 0x200; - - b43_write16(dev, B43_MMIO_RADIO24_CONTROL, reg); - return b43_read16(dev, B43_MMIO_RADIO24_DATA); -} - -static void b43_phy_lcn_op_radio_write(struct b43_wldev *dev, u16 reg, - u16 value) -{ - b43_write16(dev, B43_MMIO_RADIO24_CONTROL, reg); - b43_write16(dev, B43_MMIO_RADIO24_DATA, value); -} - -/************************************************** - * PHY ops struct. - **************************************************/ - -const struct b43_phy_operations b43_phyops_lcn = { - .allocate = b43_phy_lcn_op_allocate, - .free = b43_phy_lcn_op_free, - .prepare_structs = b43_phy_lcn_op_prepare_structs, - .init = b43_phy_lcn_op_init, - .phy_read = b43_phy_lcn_op_read, - .phy_write = b43_phy_lcn_op_write, - .phy_maskset = b43_phy_lcn_op_maskset, - .radio_read = b43_phy_lcn_op_radio_read, - .radio_write = b43_phy_lcn_op_radio_write, - .software_rfkill = b43_phy_lcn_op_software_rfkill, - .switch_analog = b43_phy_lcn_op_switch_analog, - .switch_channel = b43_phy_lcn_op_switch_channel, - .get_default_chan = b43_phy_lcn_op_get_default_chan, - .recalc_txpower = b43_phy_lcn_op_recalc_txpower, - .adjust_txpower = b43_phy_lcn_op_adjust_txpower, -}; diff --git a/drivers/net/wireless/b43/phy_lcn.h b/drivers/net/wireless/b43/phy_lcn.h deleted file mode 100644 index 6a7092e13fff..000000000000 --- a/drivers/net/wireless/b43/phy_lcn.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef B43_PHY_LCN_H_ -#define B43_PHY_LCN_H_ - -#include "phy_common.h" - - -#define B43_PHY_LCN_AFE_CTL1 B43_PHY_OFDM(0x03B) -#define B43_PHY_LCN_AFE_CTL2 B43_PHY_OFDM(0x03C) -#define B43_PHY_LCN_RF_CTL1 B43_PHY_OFDM(0x04C) -#define B43_PHY_LCN_RF_CTL2 B43_PHY_OFDM(0x04D) -#define B43_PHY_LCN_TABLE_ADDR B43_PHY_OFDM(0x055) /* Table address */ -#define B43_PHY_LCN_TABLE_DATALO B43_PHY_OFDM(0x056) /* Table data low */ -#define B43_PHY_LCN_TABLE_DATAHI B43_PHY_OFDM(0x057) /* Table data high */ -#define B43_PHY_LCN_RF_CTL3 B43_PHY_OFDM(0x0B0) -#define B43_PHY_LCN_RF_CTL4 B43_PHY_OFDM(0x0B1) -#define B43_PHY_LCN_RF_CTL5 B43_PHY_OFDM(0x0B7) -#define B43_PHY_LCN_RF_CTL6 B43_PHY_OFDM(0x0F9) -#define B43_PHY_LCN_RF_CTL7 B43_PHY_OFDM(0x0FA) - - -struct b43_phy_lcn { - bool hw_pwr_ctl; - bool hw_pwr_ctl_capable; - u8 tx_pwr_curr_idx; -}; - - -struct b43_phy_operations; -extern const struct b43_phy_operations b43_phyops_lcn; - -#endif /* B43_PHY_LCN_H_ */ diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c deleted file mode 100644 index 92190dacf689..000000000000 --- a/drivers/net/wireless/b43/phy_lp.c +++ /dev/null @@ -1,2730 +0,0 @@ -/* - - Broadcom B43 wireless driver - IEEE 802.11a/g LP-PHY driver - - Copyright (c) 2008-2009 Michael Buesch - Copyright (c) 2009 Gábor Stefanik - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include - -#include "b43.h" -#include "main.h" -#include "phy_lp.h" -#include "phy_common.h" -#include "tables_lpphy.h" - - -static inline u16 channel2freq_lp(u8 channel) -{ - if (channel < 14) - return (2407 + 5 * channel); - else if (channel == 14) - return 2484; - else if (channel < 184) - return (5000 + 5 * channel); - else - return (4000 + 5 * channel); -} - -static unsigned int b43_lpphy_op_get_default_chan(struct b43_wldev *dev) -{ - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - return 1; - return 36; -} - -static int b43_lpphy_op_allocate(struct b43_wldev *dev) -{ - struct b43_phy_lp *lpphy; - - lpphy = kzalloc(sizeof(*lpphy), GFP_KERNEL); - if (!lpphy) - return -ENOMEM; - dev->phy.lp = lpphy; - - return 0; -} - -static void b43_lpphy_op_prepare_structs(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_lp *lpphy = phy->lp; - - memset(lpphy, 0, sizeof(*lpphy)); - lpphy->antenna = B43_ANTENNA_DEFAULT; - - //TODO -} - -static void b43_lpphy_op_free(struct b43_wldev *dev) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - - kfree(lpphy); - dev->phy.lp = NULL; -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/LP/ReadBandSrom */ -static void lpphy_read_band_sprom(struct b43_wldev *dev) -{ - struct ssb_sprom *sprom = dev->dev->bus_sprom; - struct b43_phy_lp *lpphy = dev->phy.lp; - u16 cckpo, maxpwr; - u32 ofdmpo; - int i; - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - lpphy->tx_isolation_med_band = sprom->tri2g; - lpphy->bx_arch = sprom->bxa2g; - lpphy->rx_pwr_offset = sprom->rxpo2g; - lpphy->rssi_vf = sprom->rssismf2g; - lpphy->rssi_vc = sprom->rssismc2g; - lpphy->rssi_gs = sprom->rssisav2g; - lpphy->txpa[0] = sprom->pa0b0; - lpphy->txpa[1] = sprom->pa0b1; - lpphy->txpa[2] = sprom->pa0b2; - maxpwr = sprom->maxpwr_bg; - lpphy->max_tx_pwr_med_band = maxpwr; - cckpo = sprom->cck2gpo; - if (cckpo) { - ofdmpo = sprom->ofdm2gpo; - for (i = 0; i < 4; i++) { - lpphy->tx_max_rate[i] = - maxpwr - (ofdmpo & 0xF) * 2; - ofdmpo >>= 4; - } - ofdmpo = sprom->ofdm2gpo; - for (i = 4; i < 15; i++) { - lpphy->tx_max_rate[i] = - maxpwr - (ofdmpo & 0xF) * 2; - ofdmpo >>= 4; - } - } else { - u8 opo = sprom->opo; - for (i = 0; i < 4; i++) - lpphy->tx_max_rate[i] = maxpwr; - for (i = 4; i < 15; i++) - lpphy->tx_max_rate[i] = maxpwr - opo; - } - } else { /* 5GHz */ - lpphy->tx_isolation_low_band = sprom->tri5gl; - lpphy->tx_isolation_med_band = sprom->tri5g; - lpphy->tx_isolation_hi_band = sprom->tri5gh; - lpphy->bx_arch = sprom->bxa5g; - lpphy->rx_pwr_offset = sprom->rxpo5g; - lpphy->rssi_vf = sprom->rssismf5g; - lpphy->rssi_vc = sprom->rssismc5g; - lpphy->rssi_gs = sprom->rssisav5g; - lpphy->txpa[0] = sprom->pa1b0; - lpphy->txpa[1] = sprom->pa1b1; - lpphy->txpa[2] = sprom->pa1b2; - lpphy->txpal[0] = sprom->pa1lob0; - lpphy->txpal[1] = sprom->pa1lob1; - lpphy->txpal[2] = sprom->pa1lob2; - lpphy->txpah[0] = sprom->pa1hib0; - lpphy->txpah[1] = sprom->pa1hib1; - lpphy->txpah[2] = sprom->pa1hib2; - maxpwr = sprom->maxpwr_al; - ofdmpo = sprom->ofdm5glpo; - lpphy->max_tx_pwr_low_band = maxpwr; - for (i = 4; i < 12; i++) { - lpphy->tx_max_ratel[i] = maxpwr - (ofdmpo & 0xF) * 2; - ofdmpo >>= 4; - } - maxpwr = sprom->maxpwr_a; - ofdmpo = sprom->ofdm5gpo; - lpphy->max_tx_pwr_med_band = maxpwr; - for (i = 4; i < 12; i++) { - lpphy->tx_max_rate[i] = maxpwr - (ofdmpo & 0xF) * 2; - ofdmpo >>= 4; - } - maxpwr = sprom->maxpwr_ah; - ofdmpo = sprom->ofdm5ghpo; - lpphy->max_tx_pwr_hi_band = maxpwr; - for (i = 4; i < 12; i++) { - lpphy->tx_max_rateh[i] = maxpwr - (ofdmpo & 0xF) * 2; - ofdmpo >>= 4; - } - } -} - -static void lpphy_adjust_gain_table(struct b43_wldev *dev, u32 freq) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - u16 temp[3]; - u16 isolation; - - B43_WARN_ON(dev->phy.rev >= 2); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - isolation = lpphy->tx_isolation_med_band; - else if (freq <= 5320) - isolation = lpphy->tx_isolation_low_band; - else if (freq <= 5700) - isolation = lpphy->tx_isolation_med_band; - else - isolation = lpphy->tx_isolation_hi_band; - - temp[0] = ((isolation - 26) / 12) << 12; - temp[1] = temp[0] + 0x1000; - temp[2] = temp[0] + 0x2000; - - b43_lptab_write_bulk(dev, B43_LPTAB16(13, 0), 3, temp); - b43_lptab_write_bulk(dev, B43_LPTAB16(12, 0), 3, temp); -} - -static void lpphy_table_init(struct b43_wldev *dev) -{ - u32 freq = channel2freq_lp(b43_lpphy_op_get_default_chan(dev)); - - if (dev->phy.rev < 2) - lpphy_rev0_1_table_init(dev); - else - lpphy_rev2plus_table_init(dev); - - lpphy_init_tx_gain_table(dev); - - if (dev->phy.rev < 2) - lpphy_adjust_gain_table(dev, freq); -} - -static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev) -{ - struct ssb_bus *bus = dev->dev->sdev->bus; - struct ssb_sprom *sprom = dev->dev->bus_sprom; - struct b43_phy_lp *lpphy = dev->phy.lp; - u16 tmp, tmp2; - - b43_phy_mask(dev, B43_LPPHY_AFE_DAC_CTL, 0xF7FF); - b43_phy_write(dev, B43_LPPHY_AFE_CTL, 0); - b43_phy_write(dev, B43_LPPHY_AFE_CTL_OVR, 0); - b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_0, 0); - b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0); - b43_phy_set(dev, B43_LPPHY_AFE_DAC_CTL, 0x0004); - b43_phy_maskset(dev, B43_LPPHY_OFDMSYNCTHRESH0, 0xFF00, 0x0078); - b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0x83FF, 0x5800); - b43_phy_write(dev, B43_LPPHY_ADC_COMPENSATION_CTL, 0x0016); - b43_phy_maskset(dev, B43_LPPHY_AFE_ADC_CTL_0, 0xFFF8, 0x0004); - b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0x00FF, 0x5400); - b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0x00FF, 0x2400); - b43_phy_maskset(dev, B43_LPPHY_LOWGAINDB, 0x00FF, 0x2100); - b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0xFF00, 0x0006); - b43_phy_mask(dev, B43_LPPHY_RX_RADIO_CTL, 0xFFFE); - b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x0005); - b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFC1F, 0x0180); - b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0x83FF, 0x3C00); - b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xFFF0, 0x0005); - b43_phy_maskset(dev, B43_LPPHY_GAIN_MISMATCH_LIMIT, 0xFFC0, 0x001A); - b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0xFF00, 0x00B3); - b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0x00FF, 0xAD00); - b43_phy_maskset(dev, B43_LPPHY_INPUT_PWRDB, - 0xFF00, lpphy->rx_pwr_offset); - if ((sprom->boardflags_lo & B43_BFL_FEM) && - ((b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) || - (sprom->boardflags_hi & B43_BFH_PAREF))) { - ssb_pmu_set_ldo_voltage(&bus->chipco, LDO_PAREF, 0x28); - ssb_pmu_set_ldo_paref(&bus->chipco, true); - if (dev->phy.rev == 0) { - b43_phy_maskset(dev, B43_LPPHY_LP_RF_SIGNAL_LUT, - 0xFFCF, 0x0010); - } - b43_lptab_write(dev, B43_LPTAB16(11, 7), 60); - } else { - ssb_pmu_set_ldo_paref(&bus->chipco, false); - b43_phy_maskset(dev, B43_LPPHY_LP_RF_SIGNAL_LUT, - 0xFFCF, 0x0020); - b43_lptab_write(dev, B43_LPTAB16(11, 7), 100); - } - tmp = lpphy->rssi_vf | lpphy->rssi_vc << 4 | 0xA000; - b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_0, tmp); - if (sprom->boardflags_hi & B43_BFH_RSSIINV) - b43_phy_maskset(dev, B43_LPPHY_AFE_RSSI_CTL_1, 0xF000, 0x0AAA); - else - b43_phy_maskset(dev, B43_LPPHY_AFE_RSSI_CTL_1, 0xF000, 0x02AA); - b43_lptab_write(dev, B43_LPTAB16(11, 1), 24); - b43_phy_maskset(dev, B43_LPPHY_RX_RADIO_CTL, - 0xFFF9, (lpphy->bx_arch << 1)); - if (dev->phy.rev == 1 && - (sprom->boardflags_hi & B43_BFH_FEM_BT)) { - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x000A); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0x3F00, 0x0900); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x000A); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xC0FF, 0x0B00); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xFFC0, 0x000A); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xC0FF, 0x0400); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x000A); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0B00); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_5, 0xFFC0, 0x000A); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_5, 0xC0FF, 0x0900); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_6, 0xFFC0, 0x000A); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_6, 0xC0FF, 0x0B00); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_7, 0xFFC0, 0x000A); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_7, 0xC0FF, 0x0900); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xFFC0, 0x000A); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_8, 0xC0FF, 0x0B00); - } else if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ || - (dev->dev->board_type == SSB_BOARD_BU4312) || - (dev->phy.rev == 0 && (sprom->boardflags_lo & B43_BFL_FEM))) { - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x0001); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xC0FF, 0x0400); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x0001); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xC0FF, 0x0500); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xFFC0, 0x0002); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xC0FF, 0x0800); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x0002); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0A00); - } else if (dev->phy.rev == 1 || - (sprom->boardflags_lo & B43_BFL_FEM)) { - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x0004); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xC0FF, 0x0800); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x0004); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xC0FF, 0x0C00); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xFFC0, 0x0002); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xC0FF, 0x0100); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x0002); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0300); - } else { - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x000A); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xC0FF, 0x0900); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xFFC0, 0x000A); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_2, 0xC0FF, 0x0B00); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xFFC0, 0x0006); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_3, 0xC0FF, 0x0500); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x0006); - b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0700); - } - if (dev->phy.rev == 1 && (sprom->boardflags_hi & B43_BFH_PAREF)) { - b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_5, B43_LPPHY_TR_LOOKUP_1); - b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_6, B43_LPPHY_TR_LOOKUP_2); - b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_7, B43_LPPHY_TR_LOOKUP_3); - b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_8, B43_LPPHY_TR_LOOKUP_4); - } - if ((sprom->boardflags_hi & B43_BFH_FEM_BT) && - (dev->dev->chip_id == 0x5354) && - (dev->dev->chip_pkg == SSB_CHIPPACK_BCM4712S)) { - b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0006); - b43_phy_write(dev, B43_LPPHY_GPIO_SELECT, 0x0005); - b43_phy_write(dev, B43_LPPHY_GPIO_OUTEN, 0xFFFF); - //FIXME the Broadcom driver caches & delays this HF write! - b43_hf_write(dev, b43_hf_read(dev) | B43_HF_PR45960W); - } - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - b43_phy_set(dev, B43_LPPHY_LP_PHY_CTL, 0x8000); - b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0040); - b43_phy_maskset(dev, B43_LPPHY_MINPWR_LEVEL, 0x00FF, 0xA400); - b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xF0FF, 0x0B00); - b43_phy_maskset(dev, B43_LPPHY_SYNCPEAKCNT, 0xFFF8, 0x0007); - b43_phy_maskset(dev, B43_LPPHY_DSSS_CONFIRM_CNT, 0xFFF8, 0x0003); - b43_phy_maskset(dev, B43_LPPHY_DSSS_CONFIRM_CNT, 0xFFC7, 0x0020); - b43_phy_mask(dev, B43_LPPHY_IDLEAFTERPKTRXTO, 0x00FF); - } else { /* 5GHz */ - b43_phy_mask(dev, B43_LPPHY_LP_PHY_CTL, 0x7FFF); - b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFBF); - } - if (dev->phy.rev == 1) { - tmp = b43_phy_read(dev, B43_LPPHY_CLIPCTRTHRESH); - tmp2 = (tmp & 0x03E0) >> 5; - tmp2 |= tmp2 << 5; - b43_phy_write(dev, B43_LPPHY_4C3, tmp2); - tmp = b43_phy_read(dev, B43_LPPHY_GAINDIRECTMISMATCH); - tmp2 = (tmp & 0x1F00) >> 8; - tmp2 |= tmp2 << 5; - b43_phy_write(dev, B43_LPPHY_4C4, tmp2); - tmp = b43_phy_read(dev, B43_LPPHY_VERYLOWGAINDB); - tmp2 = tmp & 0x00FF; - tmp2 |= tmp << 8; - b43_phy_write(dev, B43_LPPHY_4C5, tmp2); - } -} - -static void lpphy_save_dig_flt_state(struct b43_wldev *dev) -{ - static const u16 addr[] = { - B43_PHY_OFDM(0xC1), - B43_PHY_OFDM(0xC2), - B43_PHY_OFDM(0xC3), - B43_PHY_OFDM(0xC4), - B43_PHY_OFDM(0xC5), - B43_PHY_OFDM(0xC6), - B43_PHY_OFDM(0xC7), - B43_PHY_OFDM(0xC8), - B43_PHY_OFDM(0xCF), - }; - - static const u16 coefs[] = { - 0xDE5E, 0xE832, 0xE331, 0x4D26, - 0x0026, 0x1420, 0x0020, 0xFE08, - 0x0008, - }; - - struct b43_phy_lp *lpphy = dev->phy.lp; - int i; - - for (i = 0; i < ARRAY_SIZE(addr); i++) { - lpphy->dig_flt_state[i] = b43_phy_read(dev, addr[i]); - b43_phy_write(dev, addr[i], coefs[i]); - } -} - -static void lpphy_restore_dig_flt_state(struct b43_wldev *dev) -{ - static const u16 addr[] = { - B43_PHY_OFDM(0xC1), - B43_PHY_OFDM(0xC2), - B43_PHY_OFDM(0xC3), - B43_PHY_OFDM(0xC4), - B43_PHY_OFDM(0xC5), - B43_PHY_OFDM(0xC6), - B43_PHY_OFDM(0xC7), - B43_PHY_OFDM(0xC8), - B43_PHY_OFDM(0xCF), - }; - - struct b43_phy_lp *lpphy = dev->phy.lp; - int i; - - for (i = 0; i < ARRAY_SIZE(addr); i++) - b43_phy_write(dev, addr[i], lpphy->dig_flt_state[i]); -} - -static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - - b43_phy_write(dev, B43_LPPHY_AFE_DAC_CTL, 0x50); - b43_phy_write(dev, B43_LPPHY_AFE_CTL, 0x8800); - b43_phy_write(dev, B43_LPPHY_AFE_CTL_OVR, 0); - b43_phy_write(dev, B43_LPPHY_AFE_CTL_OVRVAL, 0); - b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_0, 0); - b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0); - b43_phy_write(dev, B43_PHY_OFDM(0xF9), 0); - b43_phy_write(dev, B43_LPPHY_TR_LOOKUP_1, 0); - b43_phy_set(dev, B43_LPPHY_ADC_COMPENSATION_CTL, 0x10); - b43_phy_maskset(dev, B43_LPPHY_OFDMSYNCTHRESH0, 0xFF00, 0xB4); - b43_phy_maskset(dev, B43_LPPHY_DCOFFSETTRANSIENT, 0xF8FF, 0x200); - b43_phy_maskset(dev, B43_LPPHY_DCOFFSETTRANSIENT, 0xFF00, 0x7F); - b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xFF0F, 0x40); - b43_phy_maskset(dev, B43_LPPHY_PREAMBLECONFIRMTO, 0xFF00, 0x2); - b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x4000); - b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x2000); - b43_phy_set(dev, B43_PHY_OFDM(0x10A), 0x1); - if (dev->dev->board_rev >= 0x18) { - b43_lptab_write(dev, B43_LPTAB32(17, 65), 0xEC); - b43_phy_maskset(dev, B43_PHY_OFDM(0x10A), 0xFF01, 0x14); - } else { - b43_phy_maskset(dev, B43_PHY_OFDM(0x10A), 0xFF01, 0x10); - } - b43_phy_maskset(dev, B43_PHY_OFDM(0xDF), 0xFF00, 0xF4); - b43_phy_maskset(dev, B43_PHY_OFDM(0xDF), 0x00FF, 0xF100); - b43_phy_write(dev, B43_LPPHY_CLIPTHRESH, 0x48); - b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0xFF00, 0x46); - b43_phy_maskset(dev, B43_PHY_OFDM(0xE4), 0xFF00, 0x10); - b43_phy_maskset(dev, B43_LPPHY_PWR_THRESH1, 0xFFF0, 0x9); - b43_phy_mask(dev, B43_LPPHY_GAINDIRECTMISMATCH, ~0xF); - b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0x00FF, 0x5500); - b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFC1F, 0xA0); - b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xE0FF, 0x300); - b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0x00FF, 0x2A00); - if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) { - b43_phy_maskset(dev, B43_LPPHY_LOWGAINDB, 0x00FF, 0x2100); - b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0xFF00, 0xA); - } else { - b43_phy_maskset(dev, B43_LPPHY_LOWGAINDB, 0x00FF, 0x1E00); - b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0xFF00, 0xD); - } - b43_phy_maskset(dev, B43_PHY_OFDM(0xFE), 0xFFE0, 0x1F); - b43_phy_maskset(dev, B43_PHY_OFDM(0xFF), 0xFFE0, 0xC); - b43_phy_maskset(dev, B43_PHY_OFDM(0x100), 0xFF00, 0x19); - b43_phy_maskset(dev, B43_PHY_OFDM(0xFF), 0x03FF, 0x3C00); - b43_phy_maskset(dev, B43_PHY_OFDM(0xFE), 0xFC1F, 0x3E0); - b43_phy_maskset(dev, B43_PHY_OFDM(0xFF), 0xFFE0, 0xC); - b43_phy_maskset(dev, B43_PHY_OFDM(0x100), 0x00FF, 0x1900); - b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0x83FF, 0x5800); - b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x12); - b43_phy_maskset(dev, B43_LPPHY_GAINMISMATCH, 0x0FFF, 0x9000); - - if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) { - b43_lptab_write(dev, B43_LPTAB16(0x08, 0x14), 0); - b43_lptab_write(dev, B43_LPTAB16(0x08, 0x12), 0x40); - } - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x40); - b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xF0FF, 0xB00); - b43_phy_maskset(dev, B43_LPPHY_SYNCPEAKCNT, 0xFFF8, 0x6); - b43_phy_maskset(dev, B43_LPPHY_MINPWR_LEVEL, 0x00FF, 0x9D00); - b43_phy_maskset(dev, B43_LPPHY_MINPWR_LEVEL, 0xFF00, 0xA1); - b43_phy_mask(dev, B43_LPPHY_IDLEAFTERPKTRXTO, 0x00FF); - } else /* 5GHz */ - b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x40); - - b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0xFF00, 0xB3); - b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0x00FF, 0xAD00); - b43_phy_maskset(dev, B43_LPPHY_INPUT_PWRDB, 0xFF00, lpphy->rx_pwr_offset); - b43_phy_set(dev, B43_LPPHY_RESET_CTL, 0x44); - b43_phy_write(dev, B43_LPPHY_RESET_CTL, 0x80); - b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_0, 0xA954); - b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_1, - 0x2000 | ((u16)lpphy->rssi_gs << 10) | - ((u16)lpphy->rssi_vc << 4) | lpphy->rssi_vf); - - if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) { - b43_phy_set(dev, B43_LPPHY_AFE_ADC_CTL_0, 0x1C); - b43_phy_maskset(dev, B43_LPPHY_AFE_CTL, 0x00FF, 0x8800); - b43_phy_maskset(dev, B43_LPPHY_AFE_ADC_CTL_1, 0xFC3C, 0x0400); - } - - lpphy_save_dig_flt_state(dev); -} - -static void lpphy_baseband_init(struct b43_wldev *dev) -{ - lpphy_table_init(dev); - if (dev->phy.rev >= 2) - lpphy_baseband_rev2plus_init(dev); - else - lpphy_baseband_rev0_1_init(dev); -} - -struct b2062_freqdata { - u16 freq; - u8 data[6]; -}; - -/* Initialize the 2062 radio. */ -static void lpphy_2062_init(struct b43_wldev *dev) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - struct ssb_bus *bus = dev->dev->sdev->bus; - u32 crystalfreq, tmp, ref; - unsigned int i; - const struct b2062_freqdata *fd = NULL; - - static const struct b2062_freqdata freqdata_tab[] = { - { .freq = 12000, .data[0] = 6, .data[1] = 6, .data[2] = 6, - .data[3] = 6, .data[4] = 10, .data[5] = 6, }, - { .freq = 13000, .data[0] = 4, .data[1] = 4, .data[2] = 4, - .data[3] = 4, .data[4] = 11, .data[5] = 7, }, - { .freq = 14400, .data[0] = 3, .data[1] = 3, .data[2] = 3, - .data[3] = 3, .data[4] = 12, .data[5] = 7, }, - { .freq = 16200, .data[0] = 3, .data[1] = 3, .data[2] = 3, - .data[3] = 3, .data[4] = 13, .data[5] = 8, }, - { .freq = 18000, .data[0] = 2, .data[1] = 2, .data[2] = 2, - .data[3] = 2, .data[4] = 14, .data[5] = 8, }, - { .freq = 19200, .data[0] = 1, .data[1] = 1, .data[2] = 1, - .data[3] = 1, .data[4] = 14, .data[5] = 9, }, - }; - - b2062_upload_init_table(dev); - - b43_radio_write(dev, B2062_N_TX_CTL3, 0); - b43_radio_write(dev, B2062_N_TX_CTL4, 0); - b43_radio_write(dev, B2062_N_TX_CTL5, 0); - b43_radio_write(dev, B2062_N_TX_CTL6, 0); - b43_radio_write(dev, B2062_N_PDN_CTL0, 0x40); - b43_radio_write(dev, B2062_N_PDN_CTL0, 0); - b43_radio_write(dev, B2062_N_CALIB_TS, 0x10); - b43_radio_write(dev, B2062_N_CALIB_TS, 0); - if (dev->phy.rev > 0) { - b43_radio_write(dev, B2062_S_BG_CTL1, - (b43_radio_read(dev, B2062_N_COMM2) >> 1) | 0x80); - } - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - b43_radio_set(dev, B2062_N_TSSI_CTL0, 0x1); - else - b43_radio_mask(dev, B2062_N_TSSI_CTL0, ~0x1); - - /* Get the crystal freq, in Hz. */ - crystalfreq = bus->chipco.pmu.crystalfreq * 1000; - - B43_WARN_ON(!(bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU)); - B43_WARN_ON(crystalfreq == 0); - - if (crystalfreq <= 30000000) { - lpphy->pdiv = 1; - b43_radio_mask(dev, B2062_S_RFPLL_CTL1, 0xFFFB); - } else { - lpphy->pdiv = 2; - b43_radio_set(dev, B2062_S_RFPLL_CTL1, 0x4); - } - - tmp = (((800000000 * lpphy->pdiv + crystalfreq) / - (2 * crystalfreq)) - 8) & 0xFF; - b43_radio_write(dev, B2062_S_RFPLL_CTL7, tmp); - - tmp = (((100 * crystalfreq + 16000000 * lpphy->pdiv) / - (32000000 * lpphy->pdiv)) - 1) & 0xFF; - b43_radio_write(dev, B2062_S_RFPLL_CTL18, tmp); - - tmp = (((2 * crystalfreq + 1000000 * lpphy->pdiv) / - (2000000 * lpphy->pdiv)) - 1) & 0xFF; - b43_radio_write(dev, B2062_S_RFPLL_CTL19, tmp); - - ref = (1000 * lpphy->pdiv + 2 * crystalfreq) / (2000 * lpphy->pdiv); - ref &= 0xFFFF; - for (i = 0; i < ARRAY_SIZE(freqdata_tab); i++) { - if (ref < freqdata_tab[i].freq) { - fd = &freqdata_tab[i]; - break; - } - } - if (!fd) - fd = &freqdata_tab[ARRAY_SIZE(freqdata_tab) - 1]; - b43dbg(dev->wl, "b2062: Using crystal tab entry %u kHz.\n", - fd->freq); /* FIXME: Keep this printk until the code is fully debugged. */ - - b43_radio_write(dev, B2062_S_RFPLL_CTL8, - ((u16)(fd->data[1]) << 4) | fd->data[0]); - b43_radio_write(dev, B2062_S_RFPLL_CTL9, - ((u16)(fd->data[3]) << 4) | fd->data[2]); - b43_radio_write(dev, B2062_S_RFPLL_CTL10, fd->data[4]); - b43_radio_write(dev, B2062_S_RFPLL_CTL11, fd->data[5]); -} - -/* Initialize the 2063 radio. */ -static void lpphy_2063_init(struct b43_wldev *dev) -{ - b2063_upload_init_table(dev); - b43_radio_write(dev, B2063_LOGEN_SP5, 0); - b43_radio_set(dev, B2063_COMM8, 0x38); - b43_radio_write(dev, B2063_REG_SP1, 0x56); - b43_radio_mask(dev, B2063_RX_BB_CTL2, ~0x2); - b43_radio_write(dev, B2063_PA_SP7, 0); - b43_radio_write(dev, B2063_TX_RF_SP6, 0x20); - b43_radio_write(dev, B2063_TX_RF_SP9, 0x40); - if (dev->phy.rev == 2) { - b43_radio_write(dev, B2063_PA_SP3, 0xa0); - b43_radio_write(dev, B2063_PA_SP4, 0xa0); - b43_radio_write(dev, B2063_PA_SP2, 0x18); - } else { - b43_radio_write(dev, B2063_PA_SP3, 0x20); - b43_radio_write(dev, B2063_PA_SP2, 0x20); - } -} - -struct lpphy_stx_table_entry { - u16 phy_offset; - u16 phy_shift; - u16 rf_addr; - u16 rf_shift; - u16 mask; -}; - -static const struct lpphy_stx_table_entry lpphy_stx_table[] = { - { .phy_offset = 2, .phy_shift = 6, .rf_addr = 0x3d, .rf_shift = 3, .mask = 0x01, }, - { .phy_offset = 1, .phy_shift = 12, .rf_addr = 0x4c, .rf_shift = 1, .mask = 0x01, }, - { .phy_offset = 1, .phy_shift = 8, .rf_addr = 0x50, .rf_shift = 0, .mask = 0x7f, }, - { .phy_offset = 0, .phy_shift = 8, .rf_addr = 0x44, .rf_shift = 0, .mask = 0xff, }, - { .phy_offset = 1, .phy_shift = 0, .rf_addr = 0x4a, .rf_shift = 0, .mask = 0xff, }, - { .phy_offset = 0, .phy_shift = 4, .rf_addr = 0x4d, .rf_shift = 0, .mask = 0xff, }, - { .phy_offset = 1, .phy_shift = 4, .rf_addr = 0x4e, .rf_shift = 0, .mask = 0xff, }, - { .phy_offset = 0, .phy_shift = 12, .rf_addr = 0x4f, .rf_shift = 0, .mask = 0x0f, }, - { .phy_offset = 1, .phy_shift = 0, .rf_addr = 0x4f, .rf_shift = 4, .mask = 0x0f, }, - { .phy_offset = 3, .phy_shift = 0, .rf_addr = 0x49, .rf_shift = 0, .mask = 0x0f, }, - { .phy_offset = 4, .phy_shift = 3, .rf_addr = 0x46, .rf_shift = 4, .mask = 0x07, }, - { .phy_offset = 3, .phy_shift = 15, .rf_addr = 0x46, .rf_shift = 0, .mask = 0x01, }, - { .phy_offset = 4, .phy_shift = 0, .rf_addr = 0x46, .rf_shift = 1, .mask = 0x07, }, - { .phy_offset = 3, .phy_shift = 8, .rf_addr = 0x48, .rf_shift = 4, .mask = 0x07, }, - { .phy_offset = 3, .phy_shift = 11, .rf_addr = 0x48, .rf_shift = 0, .mask = 0x0f, }, - { .phy_offset = 3, .phy_shift = 4, .rf_addr = 0x49, .rf_shift = 4, .mask = 0x0f, }, - { .phy_offset = 2, .phy_shift = 15, .rf_addr = 0x45, .rf_shift = 0, .mask = 0x01, }, - { .phy_offset = 5, .phy_shift = 13, .rf_addr = 0x52, .rf_shift = 4, .mask = 0x07, }, - { .phy_offset = 6, .phy_shift = 0, .rf_addr = 0x52, .rf_shift = 7, .mask = 0x01, }, - { .phy_offset = 5, .phy_shift = 3, .rf_addr = 0x41, .rf_shift = 5, .mask = 0x07, }, - { .phy_offset = 5, .phy_shift = 6, .rf_addr = 0x41, .rf_shift = 0, .mask = 0x0f, }, - { .phy_offset = 5, .phy_shift = 10, .rf_addr = 0x42, .rf_shift = 5, .mask = 0x07, }, - { .phy_offset = 4, .phy_shift = 15, .rf_addr = 0x42, .rf_shift = 0, .mask = 0x01, }, - { .phy_offset = 5, .phy_shift = 0, .rf_addr = 0x42, .rf_shift = 1, .mask = 0x07, }, - { .phy_offset = 4, .phy_shift = 11, .rf_addr = 0x43, .rf_shift = 4, .mask = 0x0f, }, - { .phy_offset = 4, .phy_shift = 7, .rf_addr = 0x43, .rf_shift = 0, .mask = 0x0f, }, - { .phy_offset = 4, .phy_shift = 6, .rf_addr = 0x45, .rf_shift = 1, .mask = 0x01, }, - { .phy_offset = 2, .phy_shift = 7, .rf_addr = 0x40, .rf_shift = 4, .mask = 0x0f, }, - { .phy_offset = 2, .phy_shift = 11, .rf_addr = 0x40, .rf_shift = 0, .mask = 0x0f, }, -}; - -static void lpphy_sync_stx(struct b43_wldev *dev) -{ - const struct lpphy_stx_table_entry *e; - unsigned int i; - u16 tmp; - - for (i = 0; i < ARRAY_SIZE(lpphy_stx_table); i++) { - e = &lpphy_stx_table[i]; - tmp = b43_radio_read(dev, e->rf_addr); - tmp >>= e->rf_shift; - tmp <<= e->phy_shift; - b43_phy_maskset(dev, B43_PHY_OFDM(0xF2 + e->phy_offset), - ~(e->mask << e->phy_shift), tmp); - } -} - -static void lpphy_radio_init(struct b43_wldev *dev) -{ - /* The radio is attached through the 4wire bus. */ - b43_phy_set(dev, B43_LPPHY_FOURWIRE_CTL, 0x2); - udelay(1); - b43_phy_mask(dev, B43_LPPHY_FOURWIRE_CTL, 0xFFFD); - udelay(1); - - if (dev->phy.radio_ver == 0x2062) { - lpphy_2062_init(dev); - } else { - lpphy_2063_init(dev); - lpphy_sync_stx(dev); - b43_phy_write(dev, B43_PHY_OFDM(0xF0), 0x5F80); - b43_phy_write(dev, B43_PHY_OFDM(0xF1), 0); - if (dev->dev->chip_id == 0x4325) { - // TODO SSB PMU recalibration - } - } -} - -struct lpphy_iq_est { u32 iq_prod, i_pwr, q_pwr; }; - -static void lpphy_set_rc_cap(struct b43_wldev *dev) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - - u8 rc_cap = (lpphy->rc_cap & 0x1F) >> 1; - - if (dev->phy.rev == 1) //FIXME check channel 14! - rc_cap = min_t(u8, rc_cap + 5, 15); - - b43_radio_write(dev, B2062_N_RXBB_CALIB2, - max_t(u8, lpphy->rc_cap - 4, 0x80)); - b43_radio_write(dev, B2062_N_TX_CTL_A, rc_cap | 0x80); - b43_radio_write(dev, B2062_S_RXG_CNT16, - ((lpphy->rc_cap & 0x1F) >> 2) | 0x80); -} - -static u8 lpphy_get_bb_mult(struct b43_wldev *dev) -{ - return (b43_lptab_read(dev, B43_LPTAB16(0, 87)) & 0xFF00) >> 8; -} - -static void lpphy_set_bb_mult(struct b43_wldev *dev, u8 bb_mult) -{ - b43_lptab_write(dev, B43_LPTAB16(0, 87), (u16)bb_mult << 8); -} - -static void lpphy_set_deaf(struct b43_wldev *dev, bool user) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - - if (user) - lpphy->crs_usr_disable = true; - else - lpphy->crs_sys_disable = true; - b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFF1F, 0x80); -} - -static void lpphy_clear_deaf(struct b43_wldev *dev, bool user) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - - if (user) - lpphy->crs_usr_disable = false; - else - lpphy->crs_sys_disable = false; - - if (!lpphy->crs_usr_disable && !lpphy->crs_sys_disable) { - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, - 0xFF1F, 0x60); - else - b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, - 0xFF1F, 0x20); - } -} - -static void lpphy_set_trsw_over(struct b43_wldev *dev, bool tx, bool rx) -{ - u16 trsw = (tx << 1) | rx; - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFC, trsw); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x3); -} - -static void lpphy_disable_crs(struct b43_wldev *dev, bool user) -{ - lpphy_set_deaf(dev, user); - lpphy_set_trsw_over(dev, false, true); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFB); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x4); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFF7); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x8); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0x10); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x10); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFDF); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x20); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFBF); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x40); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0x7); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0x38); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xFF3F); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0x100); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xFDFF); - b43_phy_write(dev, B43_LPPHY_PS_CTL_OVERRIDE_VAL0, 0); - b43_phy_write(dev, B43_LPPHY_PS_CTL_OVERRIDE_VAL1, 1); - b43_phy_write(dev, B43_LPPHY_PS_CTL_OVERRIDE_VAL2, 0x20); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xFBFF); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xF7FF); - b43_phy_write(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL, 0); - b43_phy_write(dev, B43_LPPHY_RX_GAIN_CTL_OVERRIDE_VAL, 0x45AF); - b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0x3FF); -} - -static void lpphy_restore_crs(struct b43_wldev *dev, bool user) -{ - lpphy_clear_deaf(dev, user); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFF80); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFC00); -} - -struct lpphy_tx_gains { u16 gm, pga, pad, dac; }; - -static void lpphy_disable_rx_gain_override(struct b43_wldev *dev) -{ - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFFE); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFEF); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFBF); - if (dev->phy.rev >= 2) { - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFEFF); - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFBFF); - b43_phy_mask(dev, B43_PHY_OFDM(0xE5), 0xFFF7); - } - } else { - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFDFF); - } -} - -static void lpphy_enable_rx_gain_override(struct b43_wldev *dev) -{ - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x1); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x10); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x40); - if (dev->phy.rev >= 2) { - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x100); - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x400); - b43_phy_set(dev, B43_PHY_OFDM(0xE5), 0x8); - } - } else { - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x200); - } -} - -static void lpphy_disable_tx_gain_override(struct b43_wldev *dev) -{ - if (dev->phy.rev < 2) - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFEFF); - else { - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFF7F); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xBFFF); - } - b43_phy_mask(dev, B43_LPPHY_AFE_CTL_OVR, 0xFFBF); -} - -static void lpphy_enable_tx_gain_override(struct b43_wldev *dev) -{ - if (dev->phy.rev < 2) - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x100); - else { - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x80); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x4000); - } - b43_phy_set(dev, B43_LPPHY_AFE_CTL_OVR, 0x40); -} - -static struct lpphy_tx_gains lpphy_get_tx_gains(struct b43_wldev *dev) -{ - struct lpphy_tx_gains gains; - u16 tmp; - - gains.dac = (b43_phy_read(dev, B43_LPPHY_AFE_DAC_CTL) & 0x380) >> 7; - if (dev->phy.rev < 2) { - tmp = b43_phy_read(dev, - B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL) & 0x7FF; - gains.gm = tmp & 0x0007; - gains.pga = (tmp & 0x0078) >> 3; - gains.pad = (tmp & 0x780) >> 7; - } else { - tmp = b43_phy_read(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL); - gains.pad = b43_phy_read(dev, B43_PHY_OFDM(0xFB)) & 0xFF; - gains.gm = tmp & 0xFF; - gains.pga = (tmp >> 8) & 0xFF; - } - - return gains; -} - -static void lpphy_set_dac_gain(struct b43_wldev *dev, u16 dac) -{ - u16 ctl = b43_phy_read(dev, B43_LPPHY_AFE_DAC_CTL) & 0xC7F; - ctl |= dac << 7; - b43_phy_maskset(dev, B43_LPPHY_AFE_DAC_CTL, 0xF000, ctl); -} - -static u16 lpphy_get_pa_gain(struct b43_wldev *dev) -{ - return b43_phy_read(dev, B43_PHY_OFDM(0xFB)) & 0x7F; -} - -static void lpphy_set_pa_gain(struct b43_wldev *dev, u16 gain) -{ - b43_phy_maskset(dev, B43_PHY_OFDM(0xFB), 0xE03F, gain << 6); - b43_phy_maskset(dev, B43_PHY_OFDM(0xFD), 0x80FF, gain << 8); -} - -static void lpphy_set_tx_gains(struct b43_wldev *dev, - struct lpphy_tx_gains gains) -{ - u16 rf_gain, pa_gain; - - if (dev->phy.rev < 2) { - rf_gain = (gains.pad << 7) | (gains.pga << 3) | gains.gm; - b43_phy_maskset(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL, - 0xF800, rf_gain); - } else { - pa_gain = lpphy_get_pa_gain(dev); - b43_phy_write(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL, - (gains.pga << 8) | gains.gm); - /* - * SPEC FIXME The spec calls for (pa_gain << 8) here, but that - * conflicts with the spec for set_pa_gain! Vendor driver bug? - */ - b43_phy_maskset(dev, B43_PHY_OFDM(0xFB), - 0x8000, gains.pad | (pa_gain << 6)); - b43_phy_write(dev, B43_PHY_OFDM(0xFC), - (gains.pga << 8) | gains.gm); - b43_phy_maskset(dev, B43_PHY_OFDM(0xFD), - 0x8000, gains.pad | (pa_gain << 8)); - } - lpphy_set_dac_gain(dev, gains.dac); - lpphy_enable_tx_gain_override(dev); -} - -static void lpphy_rev0_1_set_rx_gain(struct b43_wldev *dev, u32 gain) -{ - u16 trsw = gain & 0x1; - u16 lna = (gain & 0xFFFC) | ((gain & 0xC) >> 2); - u16 ext_lna = (gain & 2) >> 1; - - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFE, trsw); - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, - 0xFBFF, ext_lna << 10); - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, - 0xF7FF, ext_lna << 11); - b43_phy_write(dev, B43_LPPHY_RX_GAIN_CTL_OVERRIDE_VAL, lna); -} - -static void lpphy_rev2plus_set_rx_gain(struct b43_wldev *dev, u32 gain) -{ - u16 low_gain = gain & 0xFFFF; - u16 high_gain = (gain >> 16) & 0xF; - u16 ext_lna = (gain >> 21) & 0x1; - u16 trsw = ~(gain >> 20) & 0x1; - u16 tmp; - - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xFFFE, trsw); - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, - 0xFDFF, ext_lna << 9); - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, - 0xFBFF, ext_lna << 10); - b43_phy_write(dev, B43_LPPHY_RX_GAIN_CTL_OVERRIDE_VAL, low_gain); - b43_phy_maskset(dev, B43_LPPHY_AFE_DDFS, 0xFFF0, high_gain); - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - tmp = (gain >> 2) & 0x3; - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, - 0xE7FF, tmp<<11); - b43_phy_maskset(dev, B43_PHY_OFDM(0xE6), 0xFFE7, tmp << 3); - } -} - -static void lpphy_set_rx_gain(struct b43_wldev *dev, u32 gain) -{ - if (dev->phy.rev < 2) - lpphy_rev0_1_set_rx_gain(dev, gain); - else - lpphy_rev2plus_set_rx_gain(dev, gain); - lpphy_enable_rx_gain_override(dev); -} - -static void lpphy_set_rx_gain_by_index(struct b43_wldev *dev, u16 idx) -{ - u32 gain = b43_lptab_read(dev, B43_LPTAB16(12, idx)); - lpphy_set_rx_gain(dev, gain); -} - -static void lpphy_stop_ddfs(struct b43_wldev *dev) -{ - b43_phy_mask(dev, B43_LPPHY_AFE_DDFS, 0xFFFD); - b43_phy_mask(dev, B43_LPPHY_LP_PHY_CTL, 0xFFDF); -} - -static void lpphy_run_ddfs(struct b43_wldev *dev, int i_on, int q_on, - int incr1, int incr2, int scale_idx) -{ - lpphy_stop_ddfs(dev); - b43_phy_mask(dev, B43_LPPHY_AFE_DDFS_POINTER_INIT, 0xFF80); - b43_phy_mask(dev, B43_LPPHY_AFE_DDFS_POINTER_INIT, 0x80FF); - b43_phy_maskset(dev, B43_LPPHY_AFE_DDFS_INCR_INIT, 0xFF80, incr1); - b43_phy_maskset(dev, B43_LPPHY_AFE_DDFS_INCR_INIT, 0x80FF, incr2 << 8); - b43_phy_maskset(dev, B43_LPPHY_AFE_DDFS, 0xFFF7, i_on << 3); - b43_phy_maskset(dev, B43_LPPHY_AFE_DDFS, 0xFFEF, q_on << 4); - b43_phy_maskset(dev, B43_LPPHY_AFE_DDFS, 0xFF9F, scale_idx << 5); - b43_phy_mask(dev, B43_LPPHY_AFE_DDFS, 0xFFFB); - b43_phy_set(dev, B43_LPPHY_AFE_DDFS, 0x2); - b43_phy_set(dev, B43_LPPHY_LP_PHY_CTL, 0x20); -} - -static bool lpphy_rx_iq_est(struct b43_wldev *dev, u16 samples, u8 time, - struct lpphy_iq_est *iq_est) -{ - int i; - - b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFF7); - b43_phy_write(dev, B43_LPPHY_IQ_NUM_SMPLS_ADDR, samples); - b43_phy_maskset(dev, B43_LPPHY_IQ_ENABLE_WAIT_TIME_ADDR, 0xFF00, time); - b43_phy_mask(dev, B43_LPPHY_IQ_ENABLE_WAIT_TIME_ADDR, 0xFEFF); - b43_phy_set(dev, B43_LPPHY_IQ_ENABLE_WAIT_TIME_ADDR, 0x200); - - for (i = 0; i < 500; i++) { - if (!(b43_phy_read(dev, - B43_LPPHY_IQ_ENABLE_WAIT_TIME_ADDR) & 0x200)) - break; - msleep(1); - } - - if ((b43_phy_read(dev, B43_LPPHY_IQ_ENABLE_WAIT_TIME_ADDR) & 0x200)) { - b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x8); - return false; - } - - iq_est->iq_prod = b43_phy_read(dev, B43_LPPHY_IQ_ACC_HI_ADDR); - iq_est->iq_prod <<= 16; - iq_est->iq_prod |= b43_phy_read(dev, B43_LPPHY_IQ_ACC_LO_ADDR); - - iq_est->i_pwr = b43_phy_read(dev, B43_LPPHY_IQ_I_PWR_ACC_HI_ADDR); - iq_est->i_pwr <<= 16; - iq_est->i_pwr |= b43_phy_read(dev, B43_LPPHY_IQ_I_PWR_ACC_LO_ADDR); - - iq_est->q_pwr = b43_phy_read(dev, B43_LPPHY_IQ_Q_PWR_ACC_HI_ADDR); - iq_est->q_pwr <<= 16; - iq_est->q_pwr |= b43_phy_read(dev, B43_LPPHY_IQ_Q_PWR_ACC_LO_ADDR); - - b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x8); - return true; -} - -static int lpphy_loopback(struct b43_wldev *dev) -{ - struct lpphy_iq_est iq_est; - int i, index = -1; - u32 tmp; - - memset(&iq_est, 0, sizeof(iq_est)); - - lpphy_set_trsw_over(dev, true, true); - b43_phy_set(dev, B43_LPPHY_AFE_CTL_OVR, 1); - b43_phy_mask(dev, B43_LPPHY_AFE_CTL_OVRVAL, 0xFFFE); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x800); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0x800); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x8); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0x8); - b43_radio_write(dev, B2062_N_TX_CTL_A, 0x80); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x80); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0x80); - for (i = 0; i < 32; i++) { - lpphy_set_rx_gain_by_index(dev, i); - lpphy_run_ddfs(dev, 1, 1, 5, 5, 0); - if (!(lpphy_rx_iq_est(dev, 1000, 32, &iq_est))) - continue; - tmp = (iq_est.i_pwr + iq_est.q_pwr) / 1000; - if ((tmp > 4000) && (tmp < 10000)) { - index = i; - break; - } - } - lpphy_stop_ddfs(dev); - return index; -} - -/* Fixed-point division algorithm using only integer math. */ -static u32 lpphy_qdiv_roundup(u32 dividend, u32 divisor, u8 precision) -{ - u32 quotient, remainder; - - if (divisor == 0) - return 0; - - quotient = dividend / divisor; - remainder = dividend % divisor; - - while (precision > 0) { - quotient <<= 1; - if (remainder << 1 >= divisor) { - quotient++; - remainder = (remainder << 1) - divisor; - } - precision--; - } - - if (remainder << 1 >= divisor) - quotient++; - - return quotient; -} - -/* Read the TX power control mode from hardware. */ -static void lpphy_read_tx_pctl_mode_from_hardware(struct b43_wldev *dev) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - u16 ctl; - - ctl = b43_phy_read(dev, B43_LPPHY_TX_PWR_CTL_CMD); - switch (ctl & B43_LPPHY_TX_PWR_CTL_CMD_MODE) { - case B43_LPPHY_TX_PWR_CTL_CMD_MODE_OFF: - lpphy->txpctl_mode = B43_LPPHY_TXPCTL_OFF; - break; - case B43_LPPHY_TX_PWR_CTL_CMD_MODE_SW: - lpphy->txpctl_mode = B43_LPPHY_TXPCTL_SW; - break; - case B43_LPPHY_TX_PWR_CTL_CMD_MODE_HW: - lpphy->txpctl_mode = B43_LPPHY_TXPCTL_HW; - break; - default: - lpphy->txpctl_mode = B43_LPPHY_TXPCTL_UNKNOWN; - B43_WARN_ON(1); - break; - } -} - -/* Set the TX power control mode in hardware. */ -static void lpphy_write_tx_pctl_mode_to_hardware(struct b43_wldev *dev) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - u16 ctl; - - switch (lpphy->txpctl_mode) { - case B43_LPPHY_TXPCTL_OFF: - ctl = B43_LPPHY_TX_PWR_CTL_CMD_MODE_OFF; - break; - case B43_LPPHY_TXPCTL_HW: - ctl = B43_LPPHY_TX_PWR_CTL_CMD_MODE_HW; - break; - case B43_LPPHY_TXPCTL_SW: - ctl = B43_LPPHY_TX_PWR_CTL_CMD_MODE_SW; - break; - default: - ctl = 0; - B43_WARN_ON(1); - } - b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_CMD, - ~B43_LPPHY_TX_PWR_CTL_CMD_MODE & 0xFFFF, ctl); -} - -static void lpphy_set_tx_power_control(struct b43_wldev *dev, - enum b43_lpphy_txpctl_mode mode) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - enum b43_lpphy_txpctl_mode oldmode; - - lpphy_read_tx_pctl_mode_from_hardware(dev); - oldmode = lpphy->txpctl_mode; - if (oldmode == mode) - return; - lpphy->txpctl_mode = mode; - - if (oldmode == B43_LPPHY_TXPCTL_HW) { - //TODO Update TX Power NPT - //TODO Clear all TX Power offsets - } else { - if (mode == B43_LPPHY_TXPCTL_HW) { - //TODO Recalculate target TX power - b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_CMD, - 0xFF80, lpphy->tssi_idx); - b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_NNUM, - 0x8FFF, ((u16)lpphy->tssi_npt << 16)); - //TODO Set "TSSI Transmit Count" variable to total transmitted frame count - lpphy_disable_tx_gain_override(dev); - lpphy->tx_pwr_idx_over = -1; - } - } - if (dev->phy.rev >= 2) { - if (mode == B43_LPPHY_TXPCTL_HW) - b43_phy_set(dev, B43_PHY_OFDM(0xD0), 0x2); - else - b43_phy_mask(dev, B43_PHY_OFDM(0xD0), 0xFFFD); - } - lpphy_write_tx_pctl_mode_to_hardware(dev); -} - -static int b43_lpphy_op_switch_channel(struct b43_wldev *dev, - unsigned int new_channel); - -static void lpphy_rev0_1_rc_calib(struct b43_wldev *dev) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - struct lpphy_iq_est iq_est; - struct lpphy_tx_gains tx_gains; - static const u32 ideal_pwr_table[21] = { - 0x10000, 0x10557, 0x10e2d, 0x113e0, 0x10f22, 0x0ff64, - 0x0eda2, 0x0e5d4, 0x0efd1, 0x0fbe8, 0x0b7b8, 0x04b35, - 0x01a5e, 0x00a0b, 0x00444, 0x001fd, 0x000ff, 0x00088, - 0x0004c, 0x0002c, 0x0001a, - }; - bool old_txg_ovr; - u8 old_bbmult; - u16 old_rf_ovr, old_rf_ovrval, old_afe_ovr, old_afe_ovrval, - old_rf2_ovr, old_rf2_ovrval, old_phy_ctl; - enum b43_lpphy_txpctl_mode old_txpctl; - u32 normal_pwr, ideal_pwr, mean_sq_pwr, tmp = 0, mean_sq_pwr_min = 0; - int loopback, i, j, inner_sum, err; - - memset(&iq_est, 0, sizeof(iq_est)); - - err = b43_lpphy_op_switch_channel(dev, 7); - if (err) { - b43dbg(dev->wl, - "RC calib: Failed to switch to channel 7, error = %d\n", - err); - } - old_txg_ovr = !!(b43_phy_read(dev, B43_LPPHY_AFE_CTL_OVR) & 0x40); - old_bbmult = lpphy_get_bb_mult(dev); - if (old_txg_ovr) - tx_gains = lpphy_get_tx_gains(dev); - old_rf_ovr = b43_phy_read(dev, B43_LPPHY_RF_OVERRIDE_0); - old_rf_ovrval = b43_phy_read(dev, B43_LPPHY_RF_OVERRIDE_VAL_0); - old_afe_ovr = b43_phy_read(dev, B43_LPPHY_AFE_CTL_OVR); - old_afe_ovrval = b43_phy_read(dev, B43_LPPHY_AFE_CTL_OVRVAL); - old_rf2_ovr = b43_phy_read(dev, B43_LPPHY_RF_OVERRIDE_2); - old_rf2_ovrval = b43_phy_read(dev, B43_LPPHY_RF_OVERRIDE_2_VAL); - old_phy_ctl = b43_phy_read(dev, B43_LPPHY_LP_PHY_CTL); - lpphy_read_tx_pctl_mode_from_hardware(dev); - old_txpctl = lpphy->txpctl_mode; - - lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF); - lpphy_disable_crs(dev, true); - loopback = lpphy_loopback(dev); - if (loopback == -1) - goto finish; - lpphy_set_rx_gain_by_index(dev, loopback); - b43_phy_maskset(dev, B43_LPPHY_LP_PHY_CTL, 0xFFBF, 0x40); - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xFFF8, 0x1); - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xFFC7, 0x8); - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xFF3F, 0xC0); - for (i = 128; i <= 159; i++) { - b43_radio_write(dev, B2062_N_RXBB_CALIB2, i); - inner_sum = 0; - for (j = 5; j <= 25; j++) { - lpphy_run_ddfs(dev, 1, 1, j, j, 0); - if (!(lpphy_rx_iq_est(dev, 1000, 32, &iq_est))) - goto finish; - mean_sq_pwr = iq_est.i_pwr + iq_est.q_pwr; - if (j == 5) - tmp = mean_sq_pwr; - ideal_pwr = ((ideal_pwr_table[j-5] >> 3) + 1) >> 1; - normal_pwr = lpphy_qdiv_roundup(mean_sq_pwr, tmp, 12); - mean_sq_pwr = ideal_pwr - normal_pwr; - mean_sq_pwr *= mean_sq_pwr; - inner_sum += mean_sq_pwr; - if ((i == 128) || (inner_sum < mean_sq_pwr_min)) { - lpphy->rc_cap = i; - mean_sq_pwr_min = inner_sum; - } - } - } - lpphy_stop_ddfs(dev); - -finish: - lpphy_restore_crs(dev, true); - b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, old_rf_ovrval); - b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_0, old_rf_ovr); - b43_phy_write(dev, B43_LPPHY_AFE_CTL_OVRVAL, old_afe_ovrval); - b43_phy_write(dev, B43_LPPHY_AFE_CTL_OVR, old_afe_ovr); - b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, old_rf2_ovrval); - b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, old_rf2_ovr); - b43_phy_write(dev, B43_LPPHY_LP_PHY_CTL, old_phy_ctl); - - lpphy_set_bb_mult(dev, old_bbmult); - if (old_txg_ovr) { - /* - * SPEC FIXME: The specs say "get_tx_gains" here, which is - * illogical. According to lwfinger, vendor driver v4.150.10.5 - * has a Set here, while v4.174.64.19 has a Get - regression in - * the vendor driver? This should be tested this once the code - * is testable. - */ - lpphy_set_tx_gains(dev, tx_gains); - } - lpphy_set_tx_power_control(dev, old_txpctl); - if (lpphy->rc_cap) - lpphy_set_rc_cap(dev); -} - -static void lpphy_rev2plus_rc_calib(struct b43_wldev *dev) -{ - struct ssb_bus *bus = dev->dev->sdev->bus; - u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; - u8 tmp = b43_radio_read(dev, B2063_RX_BB_SP8) & 0xFF; - int i; - - b43_radio_write(dev, B2063_RX_BB_SP8, 0x0); - b43_radio_write(dev, B2063_RC_CALIB_CTL1, 0x7E); - b43_radio_mask(dev, B2063_PLL_SP1, 0xF7); - b43_radio_write(dev, B2063_RC_CALIB_CTL1, 0x7C); - b43_radio_write(dev, B2063_RC_CALIB_CTL2, 0x15); - b43_radio_write(dev, B2063_RC_CALIB_CTL3, 0x70); - b43_radio_write(dev, B2063_RC_CALIB_CTL4, 0x52); - b43_radio_write(dev, B2063_RC_CALIB_CTL5, 0x1); - b43_radio_write(dev, B2063_RC_CALIB_CTL1, 0x7D); - - for (i = 0; i < 10000; i++) { - if (b43_radio_read(dev, B2063_RC_CALIB_CTL6) & 0x2) - break; - msleep(1); - } - - if (!(b43_radio_read(dev, B2063_RC_CALIB_CTL6) & 0x2)) - b43_radio_write(dev, B2063_RX_BB_SP8, tmp); - - tmp = b43_radio_read(dev, B2063_TX_BB_SP3) & 0xFF; - - b43_radio_write(dev, B2063_TX_BB_SP3, 0x0); - b43_radio_write(dev, B2063_RC_CALIB_CTL1, 0x7E); - b43_radio_write(dev, B2063_RC_CALIB_CTL1, 0x7C); - b43_radio_write(dev, B2063_RC_CALIB_CTL2, 0x55); - b43_radio_write(dev, B2063_RC_CALIB_CTL3, 0x76); - - if (crystal_freq == 24000000) { - b43_radio_write(dev, B2063_RC_CALIB_CTL4, 0xFC); - b43_radio_write(dev, B2063_RC_CALIB_CTL5, 0x0); - } else { - b43_radio_write(dev, B2063_RC_CALIB_CTL4, 0x13); - b43_radio_write(dev, B2063_RC_CALIB_CTL5, 0x1); - } - - b43_radio_write(dev, B2063_PA_SP7, 0x7D); - - for (i = 0; i < 10000; i++) { - if (b43_radio_read(dev, B2063_RC_CALIB_CTL6) & 0x2) - break; - msleep(1); - } - - if (!(b43_radio_read(dev, B2063_RC_CALIB_CTL6) & 0x2)) - b43_radio_write(dev, B2063_TX_BB_SP3, tmp); - - b43_radio_write(dev, B2063_RC_CALIB_CTL1, 0x7E); -} - -static void lpphy_calibrate_rc(struct b43_wldev *dev) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - - if (dev->phy.rev >= 2) { - lpphy_rev2plus_rc_calib(dev); - } else if (!lpphy->rc_cap) { - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - lpphy_rev0_1_rc_calib(dev); - } else { - lpphy_set_rc_cap(dev); - } -} - -static void b43_lpphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna) -{ - if (dev->phy.rev >= 2) - return; // rev2+ doesn't support antenna diversity - - if (B43_WARN_ON(antenna > B43_ANTENNA_AUTO1)) - return; - - b43_hf_write(dev, b43_hf_read(dev) & ~B43_HF_ANTDIVHELP); - - b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFD, antenna & 0x2); - b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFE, antenna & 0x1); - - b43_hf_write(dev, b43_hf_read(dev) | B43_HF_ANTDIVHELP); - - dev->phy.lp->antenna = antenna; -} - -static void lpphy_set_tx_iqcc(struct b43_wldev *dev, u16 a, u16 b) -{ - u16 tmp[2]; - - tmp[0] = a; - tmp[1] = b; - b43_lptab_write_bulk(dev, B43_LPTAB16(0, 80), 2, tmp); -} - -static void lpphy_set_tx_power_by_index(struct b43_wldev *dev, u8 index) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - struct lpphy_tx_gains gains; - u32 iq_comp, tx_gain, coeff, rf_power; - - lpphy->tx_pwr_idx_over = index; - lpphy_read_tx_pctl_mode_from_hardware(dev); - if (lpphy->txpctl_mode != B43_LPPHY_TXPCTL_OFF) - lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_SW); - if (dev->phy.rev >= 2) { - iq_comp = b43_lptab_read(dev, B43_LPTAB32(7, index + 320)); - tx_gain = b43_lptab_read(dev, B43_LPTAB32(7, index + 192)); - gains.pad = (tx_gain >> 16) & 0xFF; - gains.gm = tx_gain & 0xFF; - gains.pga = (tx_gain >> 8) & 0xFF; - gains.dac = (iq_comp >> 28) & 0xFF; - lpphy_set_tx_gains(dev, gains); - } else { - iq_comp = b43_lptab_read(dev, B43_LPTAB32(10, index + 320)); - tx_gain = b43_lptab_read(dev, B43_LPTAB32(10, index + 192)); - b43_phy_maskset(dev, B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL, - 0xF800, (tx_gain >> 4) & 0x7FFF); - lpphy_set_dac_gain(dev, tx_gain & 0x7); - lpphy_set_pa_gain(dev, (tx_gain >> 24) & 0x7F); - } - lpphy_set_bb_mult(dev, (iq_comp >> 20) & 0xFF); - lpphy_set_tx_iqcc(dev, (iq_comp >> 10) & 0x3FF, iq_comp & 0x3FF); - if (dev->phy.rev >= 2) { - coeff = b43_lptab_read(dev, B43_LPTAB32(7, index + 448)); - } else { - coeff = b43_lptab_read(dev, B43_LPTAB32(10, index + 448)); - } - b43_lptab_write(dev, B43_LPTAB16(0, 85), coeff & 0xFFFF); - if (dev->phy.rev >= 2) { - rf_power = b43_lptab_read(dev, B43_LPTAB32(7, index + 576)); - b43_phy_maskset(dev, B43_LPPHY_RF_PWR_OVERRIDE, 0xFF00, - rf_power & 0xFFFF);//SPEC FIXME mask & set != 0 - } - lpphy_enable_tx_gain_override(dev); -} - -static void lpphy_btcoex_override(struct b43_wldev *dev) -{ - b43_write16(dev, B43_MMIO_BTCOEX_CTL, 0x3); - b43_write16(dev, B43_MMIO_BTCOEX_TXCTL, 0xFF); -} - -static void b43_lpphy_op_software_rfkill(struct b43_wldev *dev, - bool blocked) -{ - //TODO check MAC control register - if (blocked) { - if (dev->phy.rev >= 2) { - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0x83FF); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x1F00); - b43_phy_mask(dev, B43_LPPHY_AFE_DDFS, 0x80FF); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xDFFF); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x0808); - } else { - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xE0FF); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x1F00); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2_VAL, 0xFCFF); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_2, 0x0018); - } - } else { - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xE0FF); - if (dev->phy.rev >= 2) - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xF7F7); - else - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_2, 0xFFE7); - } -} - -/* This was previously called lpphy_japan_filter */ -static void lpphy_set_analog_filter(struct b43_wldev *dev, int channel) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - u16 tmp = (channel == 14); //SPEC FIXME check japanwidefilter! - - if (dev->phy.rev < 2) { //SPEC FIXME Isn't this rev0/1-specific? - b43_phy_maskset(dev, B43_LPPHY_LP_PHY_CTL, 0xFCFF, tmp << 9); - if ((dev->phy.rev == 1) && (lpphy->rc_cap)) - lpphy_set_rc_cap(dev); - } else { - b43_radio_write(dev, B2063_TX_BB_SP3, 0x3F); - } -} - -static void lpphy_set_tssi_mux(struct b43_wldev *dev, enum tssi_mux_mode mode) -{ - if (mode != TSSI_MUX_EXT) { - b43_radio_set(dev, B2063_PA_SP1, 0x2); - b43_phy_set(dev, B43_PHY_OFDM(0xF3), 0x1000); - b43_radio_write(dev, B2063_PA_CTL10, 0x51); - if (mode == TSSI_MUX_POSTPA) { - b43_radio_mask(dev, B2063_PA_SP1, 0xFFFE); - b43_phy_mask(dev, B43_LPPHY_AFE_CTL_OVRVAL, 0xFFC7); - } else { - b43_radio_maskset(dev, B2063_PA_SP1, 0xFFFE, 0x1); - b43_phy_maskset(dev, B43_LPPHY_AFE_CTL_OVRVAL, - 0xFFC7, 0x20); - } - } else { - B43_WARN_ON(1); - } -} - -static void lpphy_tx_pctl_init_hw(struct b43_wldev *dev) -{ - u16 tmp; - int i; - - //SPEC TODO Call LP PHY Clear TX Power offsets - for (i = 0; i < 64; i++) { - if (dev->phy.rev >= 2) - b43_lptab_write(dev, B43_LPTAB32(7, i + 1), i); - else - b43_lptab_write(dev, B43_LPTAB32(10, i + 1), i); - } - - b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_NNUM, 0xFF00, 0xFF); - b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_NNUM, 0x8FFF, 0x5000); - b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_IDLETSSI, 0xFFC0, 0x1F); - if (dev->phy.rev < 2) { - b43_phy_mask(dev, B43_LPPHY_LP_PHY_CTL, 0xEFFF); - b43_phy_maskset(dev, B43_LPPHY_LP_PHY_CTL, 0xDFFF, 0x2000); - } else { - b43_phy_mask(dev, B43_PHY_OFDM(0x103), 0xFFFE); - b43_phy_maskset(dev, B43_PHY_OFDM(0x103), 0xFFFB, 0x4); - b43_phy_maskset(dev, B43_PHY_OFDM(0x103), 0xFFEF, 0x10); - b43_radio_maskset(dev, B2063_IQ_CALIB_CTL2, 0xF3, 0x1); - lpphy_set_tssi_mux(dev, TSSI_MUX_POSTPA); - } - b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_IDLETSSI, 0x7FFF, 0x8000); - b43_phy_mask(dev, B43_LPPHY_TX_PWR_CTL_DELTAPWR_LIMIT, 0xFF); - b43_phy_write(dev, B43_LPPHY_TX_PWR_CTL_DELTAPWR_LIMIT, 0xA); - b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_CMD, - ~B43_LPPHY_TX_PWR_CTL_CMD_MODE & 0xFFFF, - B43_LPPHY_TX_PWR_CTL_CMD_MODE_OFF); - b43_phy_mask(dev, B43_LPPHY_TX_PWR_CTL_NNUM, 0xF8FF); - b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_CMD, - ~B43_LPPHY_TX_PWR_CTL_CMD_MODE & 0xFFFF, - B43_LPPHY_TX_PWR_CTL_CMD_MODE_SW); - - if (dev->phy.rev < 2) { - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_0, 0xEFFF, 0x1000); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xEFFF); - } else { - lpphy_set_tx_power_by_index(dev, 0x7F); - } - - b43_dummy_transmission(dev, true, true); - - tmp = b43_phy_read(dev, B43_LPPHY_TX_PWR_CTL_STAT); - if (tmp & 0x8000) { - b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_IDLETSSI, - 0xFFC0, (tmp & 0xFF) - 32); - } - - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xEFFF); - - // (SPEC?) TODO Set "Target TX frequency" variable to 0 - // SPEC FIXME "Set BB Multiplier to 0xE000" impossible - bb_mult is u8! -} - -static void lpphy_tx_pctl_init_sw(struct b43_wldev *dev) -{ - struct lpphy_tx_gains gains; - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - gains.gm = 4; - gains.pad = 12; - gains.pga = 12; - gains.dac = 0; - } else { - gains.gm = 7; - gains.pad = 14; - gains.pga = 15; - gains.dac = 0; - } - lpphy_set_tx_gains(dev, gains); - lpphy_set_bb_mult(dev, 150); -} - -/* Initialize TX power control */ -static void lpphy_tx_pctl_init(struct b43_wldev *dev) -{ - if (0/*FIXME HWPCTL capable */) { - lpphy_tx_pctl_init_hw(dev); - } else { /* This device is only software TX power control capable. */ - lpphy_tx_pctl_init_sw(dev); - } -} - -static void lpphy_pr41573_workaround(struct b43_wldev *dev) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - u32 *saved_tab; - const unsigned int saved_tab_size = 256; - enum b43_lpphy_txpctl_mode txpctl_mode; - s8 tx_pwr_idx_over; - u16 tssi_npt, tssi_idx; - - saved_tab = kcalloc(saved_tab_size, sizeof(saved_tab[0]), GFP_KERNEL); - if (!saved_tab) { - b43err(dev->wl, "PR41573 failed. Out of memory!\n"); - return; - } - - lpphy_read_tx_pctl_mode_from_hardware(dev); - txpctl_mode = lpphy->txpctl_mode; - tx_pwr_idx_over = lpphy->tx_pwr_idx_over; - tssi_npt = lpphy->tssi_npt; - tssi_idx = lpphy->tssi_idx; - - if (dev->phy.rev < 2) { - b43_lptab_read_bulk(dev, B43_LPTAB32(10, 0x140), - saved_tab_size, saved_tab); - } else { - b43_lptab_read_bulk(dev, B43_LPTAB32(7, 0x140), - saved_tab_size, saved_tab); - } - //FIXME PHY reset - lpphy_table_init(dev); //FIXME is table init needed? - lpphy_baseband_init(dev); - lpphy_tx_pctl_init(dev); - b43_lpphy_op_software_rfkill(dev, false); - lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF); - if (dev->phy.rev < 2) { - b43_lptab_write_bulk(dev, B43_LPTAB32(10, 0x140), - saved_tab_size, saved_tab); - } else { - b43_lptab_write_bulk(dev, B43_LPTAB32(7, 0x140), - saved_tab_size, saved_tab); - } - b43_write16(dev, B43_MMIO_CHANNEL, lpphy->channel); - lpphy->tssi_npt = tssi_npt; - lpphy->tssi_idx = tssi_idx; - lpphy_set_analog_filter(dev, lpphy->channel); - if (tx_pwr_idx_over != -1) - lpphy_set_tx_power_by_index(dev, tx_pwr_idx_over); - if (lpphy->rc_cap) - lpphy_set_rc_cap(dev); - b43_lpphy_op_set_rx_antenna(dev, lpphy->antenna); - lpphy_set_tx_power_control(dev, txpctl_mode); - kfree(saved_tab); -} - -struct lpphy_rx_iq_comp { u8 chan; s8 c1, c0; }; - -static const struct lpphy_rx_iq_comp lpphy_5354_iq_table[] = { - { .chan = 1, .c1 = -66, .c0 = 15, }, - { .chan = 2, .c1 = -66, .c0 = 15, }, - { .chan = 3, .c1 = -66, .c0 = 15, }, - { .chan = 4, .c1 = -66, .c0 = 15, }, - { .chan = 5, .c1 = -66, .c0 = 15, }, - { .chan = 6, .c1 = -66, .c0 = 15, }, - { .chan = 7, .c1 = -66, .c0 = 14, }, - { .chan = 8, .c1 = -66, .c0 = 14, }, - { .chan = 9, .c1 = -66, .c0 = 14, }, - { .chan = 10, .c1 = -66, .c0 = 14, }, - { .chan = 11, .c1 = -66, .c0 = 14, }, - { .chan = 12, .c1 = -66, .c0 = 13, }, - { .chan = 13, .c1 = -66, .c0 = 13, }, - { .chan = 14, .c1 = -66, .c0 = 13, }, -}; - -static const struct lpphy_rx_iq_comp lpphy_rev0_1_iq_table[] = { - { .chan = 1, .c1 = -64, .c0 = 13, }, - { .chan = 2, .c1 = -64, .c0 = 13, }, - { .chan = 3, .c1 = -64, .c0 = 13, }, - { .chan = 4, .c1 = -64, .c0 = 13, }, - { .chan = 5, .c1 = -64, .c0 = 12, }, - { .chan = 6, .c1 = -64, .c0 = 12, }, - { .chan = 7, .c1 = -64, .c0 = 12, }, - { .chan = 8, .c1 = -64, .c0 = 12, }, - { .chan = 9, .c1 = -64, .c0 = 12, }, - { .chan = 10, .c1 = -64, .c0 = 11, }, - { .chan = 11, .c1 = -64, .c0 = 11, }, - { .chan = 12, .c1 = -64, .c0 = 11, }, - { .chan = 13, .c1 = -64, .c0 = 11, }, - { .chan = 14, .c1 = -64, .c0 = 10, }, - { .chan = 34, .c1 = -62, .c0 = 24, }, - { .chan = 38, .c1 = -62, .c0 = 24, }, - { .chan = 42, .c1 = -62, .c0 = 24, }, - { .chan = 46, .c1 = -62, .c0 = 23, }, - { .chan = 36, .c1 = -62, .c0 = 24, }, - { .chan = 40, .c1 = -62, .c0 = 24, }, - { .chan = 44, .c1 = -62, .c0 = 23, }, - { .chan = 48, .c1 = -62, .c0 = 23, }, - { .chan = 52, .c1 = -62, .c0 = 23, }, - { .chan = 56, .c1 = -62, .c0 = 22, }, - { .chan = 60, .c1 = -62, .c0 = 22, }, - { .chan = 64, .c1 = -62, .c0 = 22, }, - { .chan = 100, .c1 = -62, .c0 = 16, }, - { .chan = 104, .c1 = -62, .c0 = 16, }, - { .chan = 108, .c1 = -62, .c0 = 15, }, - { .chan = 112, .c1 = -62, .c0 = 14, }, - { .chan = 116, .c1 = -62, .c0 = 14, }, - { .chan = 120, .c1 = -62, .c0 = 13, }, - { .chan = 124, .c1 = -62, .c0 = 12, }, - { .chan = 128, .c1 = -62, .c0 = 12, }, - { .chan = 132, .c1 = -62, .c0 = 12, }, - { .chan = 136, .c1 = -62, .c0 = 11, }, - { .chan = 140, .c1 = -62, .c0 = 10, }, - { .chan = 149, .c1 = -61, .c0 = 9, }, - { .chan = 153, .c1 = -61, .c0 = 9, }, - { .chan = 157, .c1 = -61, .c0 = 9, }, - { .chan = 161, .c1 = -61, .c0 = 8, }, - { .chan = 165, .c1 = -61, .c0 = 8, }, - { .chan = 184, .c1 = -62, .c0 = 25, }, - { .chan = 188, .c1 = -62, .c0 = 25, }, - { .chan = 192, .c1 = -62, .c0 = 25, }, - { .chan = 196, .c1 = -62, .c0 = 25, }, - { .chan = 200, .c1 = -62, .c0 = 25, }, - { .chan = 204, .c1 = -62, .c0 = 25, }, - { .chan = 208, .c1 = -62, .c0 = 25, }, - { .chan = 212, .c1 = -62, .c0 = 25, }, - { .chan = 216, .c1 = -62, .c0 = 26, }, -}; - -static const struct lpphy_rx_iq_comp lpphy_rev2plus_iq_comp = { - .chan = 0, - .c1 = -64, - .c0 = 0, -}; - -static int lpphy_calc_rx_iq_comp(struct b43_wldev *dev, u16 samples) -{ - struct lpphy_iq_est iq_est; - u16 c0, c1; - int prod, ipwr, qpwr, prod_msb, q_msb, tmp1, tmp2, tmp3, tmp4, ret; - - c1 = b43_phy_read(dev, B43_LPPHY_RX_COMP_COEFF_S); - c0 = c1 >> 8; - c1 |= 0xFF; - - b43_phy_maskset(dev, B43_LPPHY_RX_COMP_COEFF_S, 0xFF00, 0x00C0); - b43_phy_mask(dev, B43_LPPHY_RX_COMP_COEFF_S, 0x00FF); - - ret = lpphy_rx_iq_est(dev, samples, 32, &iq_est); - if (!ret) - goto out; - - prod = iq_est.iq_prod; - ipwr = iq_est.i_pwr; - qpwr = iq_est.q_pwr; - - if (ipwr + qpwr < 2) { - ret = 0; - goto out; - } - - prod_msb = fls(abs(prod)); - q_msb = fls(abs(qpwr)); - tmp1 = prod_msb - 20; - - if (tmp1 >= 0) { - tmp3 = ((prod << (30 - prod_msb)) + (ipwr >> (1 + tmp1))) / - (ipwr >> tmp1); - } else { - tmp3 = ((prod << (30 - prod_msb)) + (ipwr << (-1 - tmp1))) / - (ipwr << -tmp1); - } - - tmp2 = q_msb - 11; - - if (tmp2 >= 0) - tmp4 = (qpwr << (31 - q_msb)) / (ipwr >> tmp2); - else - tmp4 = (qpwr << (31 - q_msb)) / (ipwr << -tmp2); - - tmp4 -= tmp3 * tmp3; - tmp4 = -int_sqrt(tmp4); - - c0 = tmp3 >> 3; - c1 = tmp4 >> 4; - -out: - b43_phy_maskset(dev, B43_LPPHY_RX_COMP_COEFF_S, 0xFF00, c1); - b43_phy_maskset(dev, B43_LPPHY_RX_COMP_COEFF_S, 0x00FF, c0 << 8); - return ret; -} - -static void lpphy_run_samples(struct b43_wldev *dev, u16 samples, u16 loops, - u16 wait) -{ - b43_phy_maskset(dev, B43_LPPHY_SMPL_PLAY_BUFFER_CTL, - 0xFFC0, samples - 1); - if (loops != 0xFFFF) - loops--; - b43_phy_maskset(dev, B43_LPPHY_SMPL_PLAY_COUNT, 0xF000, loops); - b43_phy_maskset(dev, B43_LPPHY_SMPL_PLAY_BUFFER_CTL, 0x3F, wait << 6); - b43_phy_set(dev, B43_LPPHY_A_PHY_CTL_ADDR, 0x1); -} - -//SPEC FIXME what does a negative freq mean? -static void lpphy_start_tx_tone(struct b43_wldev *dev, s32 freq, u16 max) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - u16 buf[64]; - int i, samples = 0, angle = 0; - int rotation = (((36 * freq) / 20) << 16) / 100; - struct b43_c32 sample; - - lpphy->tx_tone_freq = freq; - - if (freq) { - /* Find i for which abs(freq) integrally divides 20000 * i */ - for (i = 1; samples * abs(freq) != 20000 * i; i++) { - samples = (20000 * i) / abs(freq); - if(B43_WARN_ON(samples > 63)) - return; - } - } else { - samples = 2; - } - - for (i = 0; i < samples; i++) { - sample = b43_cordic(angle); - angle += rotation; - buf[i] = CORDIC_CONVERT((sample.i * max) & 0xFF) << 8; - buf[i] |= CORDIC_CONVERT((sample.q * max) & 0xFF); - } - - b43_lptab_write_bulk(dev, B43_LPTAB16(5, 0), samples, buf); - - lpphy_run_samples(dev, samples, 0xFFFF, 0); -} - -static void lpphy_stop_tx_tone(struct b43_wldev *dev) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - int i; - - lpphy->tx_tone_freq = 0; - - b43_phy_mask(dev, B43_LPPHY_SMPL_PLAY_COUNT, 0xF000); - for (i = 0; i < 31; i++) { - if (!(b43_phy_read(dev, B43_LPPHY_A_PHY_CTL_ADDR) & 0x1)) - break; - udelay(100); - } -} - - -static void lpphy_papd_cal(struct b43_wldev *dev, struct lpphy_tx_gains gains, - int mode, bool useindex, u8 index) -{ - //TODO -} - -static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - struct lpphy_tx_gains gains, oldgains; - int old_txpctl, old_afe_ovr, old_rf, old_bbmult; - - lpphy_read_tx_pctl_mode_from_hardware(dev); - old_txpctl = lpphy->txpctl_mode; - old_afe_ovr = b43_phy_read(dev, B43_LPPHY_AFE_CTL_OVR) & 0x40; - if (old_afe_ovr) - oldgains = lpphy_get_tx_gains(dev); - old_rf = b43_phy_read(dev, B43_LPPHY_RF_PWR_OVERRIDE) & 0xFF; - old_bbmult = lpphy_get_bb_mult(dev); - - lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF); - - if (dev->dev->chip_id == 0x4325 && dev->dev->chip_rev == 0) - lpphy_papd_cal(dev, gains, 0, 1, 30); - else - lpphy_papd_cal(dev, gains, 0, 1, 65); - - if (old_afe_ovr) - lpphy_set_tx_gains(dev, oldgains); - lpphy_set_bb_mult(dev, old_bbmult); - lpphy_set_tx_power_control(dev, old_txpctl); - b43_phy_maskset(dev, B43_LPPHY_RF_PWR_OVERRIDE, 0xFF00, old_rf); -} - -static int lpphy_rx_iq_cal(struct b43_wldev *dev, bool noise, bool tx, - bool rx, bool pa, struct lpphy_tx_gains *gains) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - const struct lpphy_rx_iq_comp *iqcomp = NULL; - struct lpphy_tx_gains nogains, oldgains; - u16 tmp; - int i, ret; - - memset(&nogains, 0, sizeof(nogains)); - memset(&oldgains, 0, sizeof(oldgains)); - - if (dev->dev->chip_id == 0x5354) { - for (i = 0; i < ARRAY_SIZE(lpphy_5354_iq_table); i++) { - if (lpphy_5354_iq_table[i].chan == lpphy->channel) { - iqcomp = &lpphy_5354_iq_table[i]; - } - } - } else if (dev->phy.rev >= 2) { - iqcomp = &lpphy_rev2plus_iq_comp; - } else { - for (i = 0; i < ARRAY_SIZE(lpphy_rev0_1_iq_table); i++) { - if (lpphy_rev0_1_iq_table[i].chan == lpphy->channel) { - iqcomp = &lpphy_rev0_1_iq_table[i]; - } - } - } - - if (B43_WARN_ON(!iqcomp)) - return 0; - - b43_phy_maskset(dev, B43_LPPHY_RX_COMP_COEFF_S, 0xFF00, iqcomp->c1); - b43_phy_maskset(dev, B43_LPPHY_RX_COMP_COEFF_S, - 0x00FF, iqcomp->c0 << 8); - - if (noise) { - tx = true; - rx = false; - pa = false; - } - - lpphy_set_trsw_over(dev, tx, rx); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x8); - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, - 0xFFF7, pa << 3); - } else { - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x20); - b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, - 0xFFDF, pa << 5); - } - - tmp = b43_phy_read(dev, B43_LPPHY_AFE_CTL_OVR) & 0x40; - - if (noise) - lpphy_set_rx_gain(dev, 0x2D5D); - else { - if (tmp) - oldgains = lpphy_get_tx_gains(dev); - if (!gains) - gains = &nogains; - lpphy_set_tx_gains(dev, *gains); - } - - b43_phy_mask(dev, B43_LPPHY_AFE_CTL_OVR, 0xFFFE); - b43_phy_mask(dev, B43_LPPHY_AFE_CTL_OVRVAL, 0xFFFE); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_0, 0x800); - b43_phy_set(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0x800); - lpphy_set_deaf(dev, false); - if (noise) - ret = lpphy_calc_rx_iq_comp(dev, 0xFFF0); - else { - lpphy_start_tx_tone(dev, 4000, 100); - ret = lpphy_calc_rx_iq_comp(dev, 0x4000); - lpphy_stop_tx_tone(dev); - } - lpphy_clear_deaf(dev, false); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFFC); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFF7); - b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xFFDF); - if (!noise) { - if (tmp) - lpphy_set_tx_gains(dev, oldgains); - else - lpphy_disable_tx_gain_override(dev); - } - lpphy_disable_rx_gain_override(dev); - b43_phy_mask(dev, B43_LPPHY_AFE_CTL_OVR, 0xFFFE); - b43_phy_mask(dev, B43_LPPHY_AFE_CTL_OVRVAL, 0xF7FF); - return ret; -} - -static void lpphy_calibration(struct b43_wldev *dev) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - enum b43_lpphy_txpctl_mode saved_pctl_mode; - bool full_cal = false; - - if (lpphy->full_calib_chan != lpphy->channel) { - full_cal = true; - lpphy->full_calib_chan = lpphy->channel; - } - - b43_mac_suspend(dev); - - lpphy_btcoex_override(dev); - if (dev->phy.rev >= 2) - lpphy_save_dig_flt_state(dev); - lpphy_read_tx_pctl_mode_from_hardware(dev); - saved_pctl_mode = lpphy->txpctl_mode; - lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF); - //TODO Perform transmit power table I/Q LO calibration - if ((dev->phy.rev == 0) && (saved_pctl_mode != B43_LPPHY_TXPCTL_OFF)) - lpphy_pr41573_workaround(dev); - if ((dev->phy.rev >= 2) && full_cal) { - lpphy_papd_cal_txpwr(dev); - } - lpphy_set_tx_power_control(dev, saved_pctl_mode); - if (dev->phy.rev >= 2) - lpphy_restore_dig_flt_state(dev); - lpphy_rx_iq_cal(dev, true, true, false, false, NULL); - - b43_mac_enable(dev); -} - -static u16 b43_lpphy_op_read(struct b43_wldev *dev, u16 reg) -{ - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - return b43_read16(dev, B43_MMIO_PHY_DATA); -} - -static void b43_lpphy_op_write(struct b43_wldev *dev, u16 reg, u16 value) -{ - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - b43_write16(dev, B43_MMIO_PHY_DATA, value); -} - -static void b43_lpphy_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask, - u16 set) -{ - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - b43_write16(dev, B43_MMIO_PHY_DATA, - (b43_read16(dev, B43_MMIO_PHY_DATA) & mask) | set); -} - -static u16 b43_lpphy_op_radio_read(struct b43_wldev *dev, u16 reg) -{ - /* Register 1 is a 32-bit register. */ - B43_WARN_ON(reg == 1); - /* LP-PHY needs a special bit set for read access */ - if (dev->phy.rev < 2) { - if (reg != 0x4001) - reg |= 0x100; - } else - reg |= 0x200; - - b43_write16(dev, B43_MMIO_RADIO_CONTROL, reg); - return b43_read16(dev, B43_MMIO_RADIO_DATA_LOW); -} - -static void b43_lpphy_op_radio_write(struct b43_wldev *dev, u16 reg, u16 value) -{ - /* Register 1 is a 32-bit register. */ - B43_WARN_ON(reg == 1); - - b43_write16(dev, B43_MMIO_RADIO_CONTROL, reg); - b43_write16(dev, B43_MMIO_RADIO_DATA_LOW, value); -} - -struct b206x_channel { - u8 channel; - u16 freq; - u8 data[12]; -}; - -static const struct b206x_channel b2062_chantbl[] = { - { .channel = 1, .freq = 2412, .data[0] = 0xFF, .data[1] = 0xFF, - .data[2] = 0xB5, .data[3] = 0x1B, .data[4] = 0x24, .data[5] = 0x32, - .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, }, - { .channel = 2, .freq = 2417, .data[0] = 0xFF, .data[1] = 0xFF, - .data[2] = 0xB5, .data[3] = 0x1B, .data[4] = 0x24, .data[5] = 0x32, - .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, }, - { .channel = 3, .freq = 2422, .data[0] = 0xFF, .data[1] = 0xFF, - .data[2] = 0xB5, .data[3] = 0x1B, .data[4] = 0x24, .data[5] = 0x32, - .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, }, - { .channel = 4, .freq = 2427, .data[0] = 0xFF, .data[1] = 0xFF, - .data[2] = 0xB5, .data[3] = 0x1B, .data[4] = 0x24, .data[5] = 0x32, - .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, }, - { .channel = 5, .freq = 2432, .data[0] = 0xFF, .data[1] = 0xFF, - .data[2] = 0xB5, .data[3] = 0x1B, .data[4] = 0x24, .data[5] = 0x32, - .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, }, - { .channel = 6, .freq = 2437, .data[0] = 0xFF, .data[1] = 0xFF, - .data[2] = 0xB5, .data[3] = 0x1B, .data[4] = 0x24, .data[5] = 0x32, - .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, }, - { .channel = 7, .freq = 2442, .data[0] = 0xFF, .data[1] = 0xFF, - .data[2] = 0xB5, .data[3] = 0x1B, .data[4] = 0x24, .data[5] = 0x32, - .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, }, - { .channel = 8, .freq = 2447, .data[0] = 0xFF, .data[1] = 0xFF, - .data[2] = 0xB5, .data[3] = 0x1B, .data[4] = 0x24, .data[5] = 0x32, - .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, }, - { .channel = 9, .freq = 2452, .data[0] = 0xFF, .data[1] = 0xFF, - .data[2] = 0xB5, .data[3] = 0x1B, .data[4] = 0x24, .data[5] = 0x32, - .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, }, - { .channel = 10, .freq = 2457, .data[0] = 0xFF, .data[1] = 0xFF, - .data[2] = 0xB5, .data[3] = 0x1B, .data[4] = 0x24, .data[5] = 0x32, - .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, }, - { .channel = 11, .freq = 2462, .data[0] = 0xFF, .data[1] = 0xFF, - .data[2] = 0xB5, .data[3] = 0x1B, .data[4] = 0x24, .data[5] = 0x32, - .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, }, - { .channel = 12, .freq = 2467, .data[0] = 0xFF, .data[1] = 0xFF, - .data[2] = 0xB5, .data[3] = 0x1B, .data[4] = 0x24, .data[5] = 0x32, - .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, }, - { .channel = 13, .freq = 2472, .data[0] = 0xFF, .data[1] = 0xFF, - .data[2] = 0xB5, .data[3] = 0x1B, .data[4] = 0x24, .data[5] = 0x32, - .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, }, - { .channel = 14, .freq = 2484, .data[0] = 0xFF, .data[1] = 0xFF, - .data[2] = 0xB5, .data[3] = 0x1B, .data[4] = 0x24, .data[5] = 0x32, - .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, }, - { .channel = 34, .freq = 5170, .data[0] = 0x00, .data[1] = 0x22, - .data[2] = 0x20, .data[3] = 0x84, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 38, .freq = 5190, .data[0] = 0x00, .data[1] = 0x11, - .data[2] = 0x10, .data[3] = 0x83, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 42, .freq = 5210, .data[0] = 0x00, .data[1] = 0x11, - .data[2] = 0x10, .data[3] = 0x83, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 46, .freq = 5230, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x83, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 36, .freq = 5180, .data[0] = 0x00, .data[1] = 0x11, - .data[2] = 0x20, .data[3] = 0x83, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 40, .freq = 5200, .data[0] = 0x00, .data[1] = 0x11, - .data[2] = 0x10, .data[3] = 0x84, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 44, .freq = 5220, .data[0] = 0x00, .data[1] = 0x11, - .data[2] = 0x00, .data[3] = 0x83, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 48, .freq = 5240, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x83, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 52, .freq = 5260, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x83, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 56, .freq = 5280, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x83, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 60, .freq = 5300, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x63, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 64, .freq = 5320, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x62, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 100, .freq = 5500, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x30, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 104, .freq = 5520, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x20, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 108, .freq = 5540, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x20, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 112, .freq = 5560, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x20, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 116, .freq = 5580, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x10, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 120, .freq = 5600, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x00, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 124, .freq = 5620, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x00, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 128, .freq = 5640, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x00, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 132, .freq = 5660, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x00, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 136, .freq = 5680, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x00, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 140, .freq = 5700, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x00, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 149, .freq = 5745, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x00, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 153, .freq = 5765, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x00, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 157, .freq = 5785, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x00, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 161, .freq = 5805, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x00, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 165, .freq = 5825, .data[0] = 0x00, .data[1] = 0x00, - .data[2] = 0x00, .data[3] = 0x00, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 184, .freq = 4920, .data[0] = 0x55, .data[1] = 0x77, - .data[2] = 0x90, .data[3] = 0xF7, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0xFF, }, - { .channel = 188, .freq = 4940, .data[0] = 0x44, .data[1] = 0x77, - .data[2] = 0x80, .data[3] = 0xE7, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0xFF, }, - { .channel = 192, .freq = 4960, .data[0] = 0x44, .data[1] = 0x66, - .data[2] = 0x80, .data[3] = 0xE7, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0xFF, }, - { .channel = 196, .freq = 4980, .data[0] = 0x33, .data[1] = 0x66, - .data[2] = 0x70, .data[3] = 0xC7, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0xFF, }, - { .channel = 200, .freq = 5000, .data[0] = 0x22, .data[1] = 0x55, - .data[2] = 0x60, .data[3] = 0xD7, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0xFF, }, - { .channel = 204, .freq = 5020, .data[0] = 0x22, .data[1] = 0x55, - .data[2] = 0x60, .data[3] = 0xC7, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0xFF, }, - { .channel = 208, .freq = 5040, .data[0] = 0x22, .data[1] = 0x44, - .data[2] = 0x50, .data[3] = 0xC7, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0xFF, }, - { .channel = 212, .freq = 5060, .data[0] = 0x11, .data[1] = 0x44, - .data[2] = 0x50, .data[3] = 0xA5, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, }, - { .channel = 216, .freq = 5080, .data[0] = 0x00, .data[1] = 0x44, - .data[2] = 0x40, .data[3] = 0xB6, .data[4] = 0x3C, .data[5] = 0x77, - .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, }, -}; - -static const struct b206x_channel b2063_chantbl[] = { - { .channel = 1, .freq = 2412, .data[0] = 0x6F, .data[1] = 0x3C, - .data[2] = 0x3C, .data[3] = 0x04, .data[4] = 0x05, .data[5] = 0x05, - .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x80, .data[11] = 0x70, }, - { .channel = 2, .freq = 2417, .data[0] = 0x6F, .data[1] = 0x3C, - .data[2] = 0x3C, .data[3] = 0x04, .data[4] = 0x05, .data[5] = 0x05, - .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x80, .data[11] = 0x70, }, - { .channel = 3, .freq = 2422, .data[0] = 0x6F, .data[1] = 0x3C, - .data[2] = 0x3C, .data[3] = 0x04, .data[4] = 0x05, .data[5] = 0x05, - .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x80, .data[11] = 0x70, }, - { .channel = 4, .freq = 2427, .data[0] = 0x6F, .data[1] = 0x2C, - .data[2] = 0x2C, .data[3] = 0x04, .data[4] = 0x05, .data[5] = 0x05, - .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x80, .data[11] = 0x70, }, - { .channel = 5, .freq = 2432, .data[0] = 0x6F, .data[1] = 0x2C, - .data[2] = 0x2C, .data[3] = 0x04, .data[4] = 0x05, .data[5] = 0x05, - .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x80, .data[11] = 0x70, }, - { .channel = 6, .freq = 2437, .data[0] = 0x6F, .data[1] = 0x2C, - .data[2] = 0x2C, .data[3] = 0x04, .data[4] = 0x05, .data[5] = 0x05, - .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x80, .data[11] = 0x70, }, - { .channel = 7, .freq = 2442, .data[0] = 0x6F, .data[1] = 0x2C, - .data[2] = 0x2C, .data[3] = 0x04, .data[4] = 0x05, .data[5] = 0x05, - .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x80, .data[11] = 0x70, }, - { .channel = 8, .freq = 2447, .data[0] = 0x6F, .data[1] = 0x2C, - .data[2] = 0x2C, .data[3] = 0x04, .data[4] = 0x05, .data[5] = 0x05, - .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x80, .data[11] = 0x70, }, - { .channel = 9, .freq = 2452, .data[0] = 0x6F, .data[1] = 0x1C, - .data[2] = 0x1C, .data[3] = 0x04, .data[4] = 0x05, .data[5] = 0x05, - .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x80, .data[11] = 0x70, }, - { .channel = 10, .freq = 2457, .data[0] = 0x6F, .data[1] = 0x1C, - .data[2] = 0x1C, .data[3] = 0x04, .data[4] = 0x05, .data[5] = 0x05, - .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x80, .data[11] = 0x70, }, - { .channel = 11, .freq = 2462, .data[0] = 0x6E, .data[1] = 0x1C, - .data[2] = 0x1C, .data[3] = 0x04, .data[4] = 0x05, .data[5] = 0x05, - .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x80, .data[11] = 0x70, }, - { .channel = 12, .freq = 2467, .data[0] = 0x6E, .data[1] = 0x1C, - .data[2] = 0x1C, .data[3] = 0x04, .data[4] = 0x05, .data[5] = 0x05, - .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x80, .data[11] = 0x70, }, - { .channel = 13, .freq = 2472, .data[0] = 0x6E, .data[1] = 0x1C, - .data[2] = 0x1C, .data[3] = 0x04, .data[4] = 0x05, .data[5] = 0x05, - .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x80, .data[11] = 0x70, }, - { .channel = 14, .freq = 2484, .data[0] = 0x6E, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x04, .data[4] = 0x05, .data[5] = 0x05, - .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x80, .data[11] = 0x70, }, - { .channel = 34, .freq = 5170, .data[0] = 0x6A, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x02, .data[5] = 0x05, - .data[6] = 0x0D, .data[7] = 0x0D, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x20, .data[11] = 0x00, }, - { .channel = 36, .freq = 5180, .data[0] = 0x6A, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x01, .data[5] = 0x05, - .data[6] = 0x0D, .data[7] = 0x0C, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x20, .data[11] = 0x00, }, - { .channel = 38, .freq = 5190, .data[0] = 0x6A, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x01, .data[5] = 0x04, - .data[6] = 0x0C, .data[7] = 0x0C, .data[8] = 0x77, .data[9] = 0x80, - .data[10] = 0x20, .data[11] = 0x00, }, - { .channel = 40, .freq = 5200, .data[0] = 0x69, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x01, .data[5] = 0x04, - .data[6] = 0x0C, .data[7] = 0x0C, .data[8] = 0x77, .data[9] = 0x70, - .data[10] = 0x20, .data[11] = 0x00, }, - { .channel = 42, .freq = 5210, .data[0] = 0x69, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x01, .data[5] = 0x04, - .data[6] = 0x0B, .data[7] = 0x0C, .data[8] = 0x77, .data[9] = 0x70, - .data[10] = 0x20, .data[11] = 0x00, }, - { .channel = 44, .freq = 5220, .data[0] = 0x69, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x04, - .data[6] = 0x0B, .data[7] = 0x0B, .data[8] = 0x77, .data[9] = 0x60, - .data[10] = 0x20, .data[11] = 0x00, }, - { .channel = 46, .freq = 5230, .data[0] = 0x69, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x03, - .data[6] = 0x0A, .data[7] = 0x0B, .data[8] = 0x77, .data[9] = 0x60, - .data[10] = 0x20, .data[11] = 0x00, }, - { .channel = 48, .freq = 5240, .data[0] = 0x69, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x03, - .data[6] = 0x0A, .data[7] = 0x0A, .data[8] = 0x77, .data[9] = 0x60, - .data[10] = 0x20, .data[11] = 0x00, }, - { .channel = 52, .freq = 5260, .data[0] = 0x68, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x02, - .data[6] = 0x09, .data[7] = 0x09, .data[8] = 0x77, .data[9] = 0x60, - .data[10] = 0x20, .data[11] = 0x00, }, - { .channel = 56, .freq = 5280, .data[0] = 0x68, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x01, - .data[6] = 0x08, .data[7] = 0x08, .data[8] = 0x77, .data[9] = 0x50, - .data[10] = 0x10, .data[11] = 0x00, }, - { .channel = 60, .freq = 5300, .data[0] = 0x68, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x01, - .data[6] = 0x08, .data[7] = 0x08, .data[8] = 0x77, .data[9] = 0x50, - .data[10] = 0x10, .data[11] = 0x00, }, - { .channel = 64, .freq = 5320, .data[0] = 0x67, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x08, .data[7] = 0x08, .data[8] = 0x77, .data[9] = 0x50, - .data[10] = 0x10, .data[11] = 0x00, }, - { .channel = 100, .freq = 5500, .data[0] = 0x64, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x02, .data[7] = 0x01, .data[8] = 0x77, .data[9] = 0x20, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 104, .freq = 5520, .data[0] = 0x64, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x01, .data[7] = 0x01, .data[8] = 0x77, .data[9] = 0x20, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 108, .freq = 5540, .data[0] = 0x63, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x01, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x10, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 112, .freq = 5560, .data[0] = 0x63, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x10, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 116, .freq = 5580, .data[0] = 0x62, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x10, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 120, .freq = 5600, .data[0] = 0x62, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 124, .freq = 5620, .data[0] = 0x62, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 128, .freq = 5640, .data[0] = 0x61, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 132, .freq = 5660, .data[0] = 0x61, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 136, .freq = 5680, .data[0] = 0x61, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 140, .freq = 5700, .data[0] = 0x60, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 149, .freq = 5745, .data[0] = 0x60, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 153, .freq = 5765, .data[0] = 0x60, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 157, .freq = 5785, .data[0] = 0x60, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 161, .freq = 5805, .data[0] = 0x60, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 165, .freq = 5825, .data[0] = 0x60, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x00, .data[5] = 0x00, - .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00, - .data[10] = 0x00, .data[11] = 0x00, }, - { .channel = 184, .freq = 4920, .data[0] = 0x6E, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x09, .data[5] = 0x0E, - .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0xC0, - .data[10] = 0x50, .data[11] = 0x00, }, - { .channel = 188, .freq = 4940, .data[0] = 0x6E, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x09, .data[5] = 0x0D, - .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0xB0, - .data[10] = 0x50, .data[11] = 0x00, }, - { .channel = 192, .freq = 4960, .data[0] = 0x6E, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x08, .data[5] = 0x0C, - .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0xB0, - .data[10] = 0x50, .data[11] = 0x00, }, - { .channel = 196, .freq = 4980, .data[0] = 0x6D, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x08, .data[5] = 0x0C, - .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0xA0, - .data[10] = 0x40, .data[11] = 0x00, }, - { .channel = 200, .freq = 5000, .data[0] = 0x6D, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x08, .data[5] = 0x0B, - .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0xA0, - .data[10] = 0x40, .data[11] = 0x00, }, - { .channel = 204, .freq = 5020, .data[0] = 0x6D, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x08, .data[5] = 0x0A, - .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0xA0, - .data[10] = 0x40, .data[11] = 0x00, }, - { .channel = 208, .freq = 5040, .data[0] = 0x6C, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x07, .data[5] = 0x09, - .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0x90, - .data[10] = 0x40, .data[11] = 0x00, }, - { .channel = 212, .freq = 5060, .data[0] = 0x6C, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x06, .data[5] = 0x08, - .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0x90, - .data[10] = 0x40, .data[11] = 0x00, }, - { .channel = 216, .freq = 5080, .data[0] = 0x6C, .data[1] = 0x0C, - .data[2] = 0x0C, .data[3] = 0x00, .data[4] = 0x05, .data[5] = 0x08, - .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0x90, - .data[10] = 0x40, .data[11] = 0x00, }, -}; - -static void lpphy_b2062_reset_pll_bias(struct b43_wldev *dev) -{ - b43_radio_write(dev, B2062_S_RFPLL_CTL2, 0xFF); - udelay(20); - if (dev->dev->chip_id == 0x5354) { - b43_radio_write(dev, B2062_N_COMM1, 4); - b43_radio_write(dev, B2062_S_RFPLL_CTL2, 4); - } else { - b43_radio_write(dev, B2062_S_RFPLL_CTL2, 0); - } - udelay(5); -} - -static void lpphy_b2062_vco_calib(struct b43_wldev *dev) -{ - b43_radio_write(dev, B2062_S_RFPLL_CTL21, 0x42); - b43_radio_write(dev, B2062_S_RFPLL_CTL21, 0x62); - udelay(200); -} - -static int lpphy_b2062_tune(struct b43_wldev *dev, - unsigned int channel) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - struct ssb_bus *bus = dev->dev->sdev->bus; - const struct b206x_channel *chandata = NULL; - u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; - u32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9; - int i, err = 0; - - for (i = 0; i < ARRAY_SIZE(b2062_chantbl); i++) { - if (b2062_chantbl[i].channel == channel) { - chandata = &b2062_chantbl[i]; - break; - } - } - - if (B43_WARN_ON(!chandata)) - return -EINVAL; - - b43_radio_set(dev, B2062_S_RFPLL_CTL14, 0x04); - b43_radio_write(dev, B2062_N_LGENA_TUNE0, chandata->data[0]); - b43_radio_write(dev, B2062_N_LGENA_TUNE2, chandata->data[1]); - b43_radio_write(dev, B2062_N_LGENA_TUNE3, chandata->data[2]); - b43_radio_write(dev, B2062_N_TX_TUNE, chandata->data[3]); - b43_radio_write(dev, B2062_S_LGENG_CTL1, chandata->data[4]); - b43_radio_write(dev, B2062_N_LGENA_CTL5, chandata->data[5]); - b43_radio_write(dev, B2062_N_LGENA_CTL6, chandata->data[6]); - b43_radio_write(dev, B2062_N_TX_PGA, chandata->data[7]); - b43_radio_write(dev, B2062_N_TX_PAD, chandata->data[8]); - - tmp1 = crystal_freq / 1000; - tmp2 = lpphy->pdiv * 1000; - b43_radio_write(dev, B2062_S_RFPLL_CTL33, 0xCC); - b43_radio_write(dev, B2062_S_RFPLL_CTL34, 0x07); - lpphy_b2062_reset_pll_bias(dev); - tmp3 = tmp2 * channel2freq_lp(channel); - if (channel2freq_lp(channel) < 4000) - tmp3 *= 2; - tmp4 = 48 * tmp1; - tmp6 = tmp3 / tmp4; - tmp7 = tmp3 % tmp4; - b43_radio_write(dev, B2062_S_RFPLL_CTL26, tmp6); - tmp5 = tmp7 * 0x100; - tmp6 = tmp5 / tmp4; - tmp7 = tmp5 % tmp4; - b43_radio_write(dev, B2062_S_RFPLL_CTL27, tmp6); - tmp5 = tmp7 * 0x100; - tmp6 = tmp5 / tmp4; - tmp7 = tmp5 % tmp4; - b43_radio_write(dev, B2062_S_RFPLL_CTL28, tmp6); - tmp5 = tmp7 * 0x100; - tmp6 = tmp5 / tmp4; - tmp7 = tmp5 % tmp4; - b43_radio_write(dev, B2062_S_RFPLL_CTL29, tmp6 + ((2 * tmp7) / tmp4)); - tmp8 = b43_radio_read(dev, B2062_S_RFPLL_CTL19); - tmp9 = ((2 * tmp3 * (tmp8 + 1)) + (3 * tmp1)) / (6 * tmp1); - b43_radio_write(dev, B2062_S_RFPLL_CTL23, (tmp9 >> 8) + 16); - b43_radio_write(dev, B2062_S_RFPLL_CTL24, tmp9 & 0xFF); - - lpphy_b2062_vco_calib(dev); - if (b43_radio_read(dev, B2062_S_RFPLL_CTL3) & 0x10) { - b43_radio_write(dev, B2062_S_RFPLL_CTL33, 0xFC); - b43_radio_write(dev, B2062_S_RFPLL_CTL34, 0); - lpphy_b2062_reset_pll_bias(dev); - lpphy_b2062_vco_calib(dev); - if (b43_radio_read(dev, B2062_S_RFPLL_CTL3) & 0x10) - err = -EIO; - } - - b43_radio_mask(dev, B2062_S_RFPLL_CTL14, ~0x04); - return err; -} - -static void lpphy_b2063_vco_calib(struct b43_wldev *dev) -{ - u16 tmp; - - b43_radio_mask(dev, B2063_PLL_SP1, ~0x40); - tmp = b43_radio_read(dev, B2063_PLL_JTAG_CALNRST) & 0xF8; - b43_radio_write(dev, B2063_PLL_JTAG_CALNRST, tmp); - udelay(1); - b43_radio_write(dev, B2063_PLL_JTAG_CALNRST, tmp | 0x4); - udelay(1); - b43_radio_write(dev, B2063_PLL_JTAG_CALNRST, tmp | 0x6); - udelay(1); - b43_radio_write(dev, B2063_PLL_JTAG_CALNRST, tmp | 0x7); - udelay(300); - b43_radio_set(dev, B2063_PLL_SP1, 0x40); -} - -static int lpphy_b2063_tune(struct b43_wldev *dev, - unsigned int channel) -{ - struct ssb_bus *bus = dev->dev->sdev->bus; - - static const struct b206x_channel *chandata = NULL; - u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; - u32 freqref, vco_freq, val1, val2, val3, timeout, timeoutref, count; - u16 old_comm15, scale; - u32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6; - int i, div = (crystal_freq <= 26000000 ? 1 : 2); - - for (i = 0; i < ARRAY_SIZE(b2063_chantbl); i++) { - if (b2063_chantbl[i].channel == channel) { - chandata = &b2063_chantbl[i]; - break; - } - } - - if (B43_WARN_ON(!chandata)) - return -EINVAL; - - b43_radio_write(dev, B2063_LOGEN_VCOBUF1, chandata->data[0]); - b43_radio_write(dev, B2063_LOGEN_MIXER2, chandata->data[1]); - b43_radio_write(dev, B2063_LOGEN_BUF2, chandata->data[2]); - b43_radio_write(dev, B2063_LOGEN_RCCR1, chandata->data[3]); - b43_radio_write(dev, B2063_A_RX_1ST3, chandata->data[4]); - b43_radio_write(dev, B2063_A_RX_2ND1, chandata->data[5]); - b43_radio_write(dev, B2063_A_RX_2ND4, chandata->data[6]); - b43_radio_write(dev, B2063_A_RX_2ND7, chandata->data[7]); - b43_radio_write(dev, B2063_A_RX_PS6, chandata->data[8]); - b43_radio_write(dev, B2063_TX_RF_CTL2, chandata->data[9]); - b43_radio_write(dev, B2063_TX_RF_CTL5, chandata->data[10]); - b43_radio_write(dev, B2063_PA_CTL11, chandata->data[11]); - - old_comm15 = b43_radio_read(dev, B2063_COMM15); - b43_radio_set(dev, B2063_COMM15, 0x1E); - - if (chandata->freq > 4000) /* spec says 2484, but 4000 is safer */ - vco_freq = chandata->freq << 1; - else - vco_freq = chandata->freq << 2; - - freqref = crystal_freq * 3; - val1 = lpphy_qdiv_roundup(crystal_freq, 1000000, 16); - val2 = lpphy_qdiv_roundup(crystal_freq, 1000000 * div, 16); - val3 = lpphy_qdiv_roundup(vco_freq, 3, 16); - timeout = ((((8 * crystal_freq) / (div * 5000000)) + 1) >> 1) - 1; - b43_radio_write(dev, B2063_PLL_JTAG_PLL_VCO_CALIB3, 0x2); - b43_radio_maskset(dev, B2063_PLL_JTAG_PLL_VCO_CALIB6, - 0xFFF8, timeout >> 2); - b43_radio_maskset(dev, B2063_PLL_JTAG_PLL_VCO_CALIB7, - 0xFF9F,timeout << 5); - - timeoutref = ((((8 * crystal_freq) / (div * (timeout + 1))) + - 999999) / 1000000) + 1; - b43_radio_write(dev, B2063_PLL_JTAG_PLL_VCO_CALIB5, timeoutref); - - count = lpphy_qdiv_roundup(val3, val2 + 16, 16); - count *= (timeout + 1) * (timeoutref + 1); - count--; - b43_radio_maskset(dev, B2063_PLL_JTAG_PLL_VCO_CALIB7, - 0xF0, count >> 8); - b43_radio_write(dev, B2063_PLL_JTAG_PLL_VCO_CALIB8, count & 0xFF); - - tmp1 = ((val3 * 62500) / freqref) << 4; - tmp2 = ((val3 * 62500) % freqref) << 4; - while (tmp2 >= freqref) { - tmp1++; - tmp2 -= freqref; - } - b43_radio_maskset(dev, B2063_PLL_JTAG_PLL_SG1, 0xFFE0, tmp1 >> 4); - b43_radio_maskset(dev, B2063_PLL_JTAG_PLL_SG2, 0xFE0F, tmp1 << 4); - b43_radio_maskset(dev, B2063_PLL_JTAG_PLL_SG2, 0xFFF0, tmp1 >> 16); - b43_radio_write(dev, B2063_PLL_JTAG_PLL_SG3, (tmp2 >> 8) & 0xFF); - b43_radio_write(dev, B2063_PLL_JTAG_PLL_SG4, tmp2 & 0xFF); - - b43_radio_write(dev, B2063_PLL_JTAG_PLL_LF1, 0xB9); - b43_radio_write(dev, B2063_PLL_JTAG_PLL_LF2, 0x88); - b43_radio_write(dev, B2063_PLL_JTAG_PLL_LF3, 0x28); - b43_radio_write(dev, B2063_PLL_JTAG_PLL_LF4, 0x63); - - tmp3 = ((41 * (val3 - 3000)) /1200) + 27; - tmp4 = lpphy_qdiv_roundup(132000 * tmp1, 8451, 16); - - if ((tmp4 + tmp3 - 1) / tmp3 > 60) { - scale = 1; - tmp5 = ((tmp4 + tmp3) / (tmp3 << 1)) - 8; - } else { - scale = 0; - tmp5 = ((tmp4 + (tmp3 >> 1)) / tmp3) - 8; - } - b43_radio_maskset(dev, B2063_PLL_JTAG_PLL_CP2, 0xFFC0, tmp5); - b43_radio_maskset(dev, B2063_PLL_JTAG_PLL_CP2, 0xFFBF, scale << 6); - - tmp6 = lpphy_qdiv_roundup(100 * val1, val3, 16); - tmp6 *= (tmp5 * 8) * (scale + 1); - if (tmp6 > 150) - tmp6 = 0; - - b43_radio_maskset(dev, B2063_PLL_JTAG_PLL_CP3, 0xFFE0, tmp6); - b43_radio_maskset(dev, B2063_PLL_JTAG_PLL_CP3, 0xFFDF, scale << 5); - - b43_radio_maskset(dev, B2063_PLL_JTAG_PLL_XTAL_12, 0xFFFB, 0x4); - if (crystal_freq > 26000000) - b43_radio_set(dev, B2063_PLL_JTAG_PLL_XTAL_12, 0x2); - else - b43_radio_mask(dev, B2063_PLL_JTAG_PLL_XTAL_12, 0xFD); - - if (val1 == 45) - b43_radio_set(dev, B2063_PLL_JTAG_PLL_VCO1, 0x2); - else - b43_radio_mask(dev, B2063_PLL_JTAG_PLL_VCO1, 0xFD); - - b43_radio_set(dev, B2063_PLL_SP2, 0x3); - udelay(1); - b43_radio_mask(dev, B2063_PLL_SP2, 0xFFFC); - lpphy_b2063_vco_calib(dev); - b43_radio_write(dev, B2063_COMM15, old_comm15); - - return 0; -} - -static int b43_lpphy_op_switch_channel(struct b43_wldev *dev, - unsigned int new_channel) -{ - struct b43_phy_lp *lpphy = dev->phy.lp; - int err; - - if (dev->phy.radio_ver == 0x2063) { - err = lpphy_b2063_tune(dev, new_channel); - if (err) - return err; - } else { - err = lpphy_b2062_tune(dev, new_channel); - if (err) - return err; - lpphy_set_analog_filter(dev, new_channel); - lpphy_adjust_gain_table(dev, channel2freq_lp(new_channel)); - } - - lpphy->channel = new_channel; - b43_write16(dev, B43_MMIO_CHANNEL, new_channel); - - return 0; -} - -static int b43_lpphy_op_init(struct b43_wldev *dev) -{ - int err; - - if (dev->dev->bus_type != B43_BUS_SSB) { - b43err(dev->wl, "LP-PHY is supported only on SSB!\n"); - return -EOPNOTSUPP; - } - - lpphy_read_band_sprom(dev); //FIXME should this be in prepare_structs? - lpphy_baseband_init(dev); - lpphy_radio_init(dev); - lpphy_calibrate_rc(dev); - err = b43_lpphy_op_switch_channel(dev, 7); - if (err) { - b43dbg(dev->wl, "Switch to channel 7 failed, error = %d.\n", - err); - } - lpphy_tx_pctl_init(dev); - lpphy_calibration(dev); - //TODO ACI init - - return 0; -} - -static void b43_lpphy_op_adjust_txpower(struct b43_wldev *dev) -{ - //TODO -} - -static enum b43_txpwr_result b43_lpphy_op_recalc_txpower(struct b43_wldev *dev, - bool ignore_tssi) -{ - //TODO - return B43_TXPWR_RES_DONE; -} - -static void b43_lpphy_op_switch_analog(struct b43_wldev *dev, bool on) -{ - if (on) { - b43_phy_mask(dev, B43_LPPHY_AFE_CTL_OVR, 0xfff8); - } else { - b43_phy_set(dev, B43_LPPHY_AFE_CTL_OVRVAL, 0x0007); - b43_phy_set(dev, B43_LPPHY_AFE_CTL_OVR, 0x0007); - } -} - -static void b43_lpphy_op_pwork_15sec(struct b43_wldev *dev) -{ - //TODO -} - -const struct b43_phy_operations b43_phyops_lp = { - .allocate = b43_lpphy_op_allocate, - .free = b43_lpphy_op_free, - .prepare_structs = b43_lpphy_op_prepare_structs, - .init = b43_lpphy_op_init, - .phy_read = b43_lpphy_op_read, - .phy_write = b43_lpphy_op_write, - .phy_maskset = b43_lpphy_op_maskset, - .radio_read = b43_lpphy_op_radio_read, - .radio_write = b43_lpphy_op_radio_write, - .software_rfkill = b43_lpphy_op_software_rfkill, - .switch_analog = b43_lpphy_op_switch_analog, - .switch_channel = b43_lpphy_op_switch_channel, - .get_default_chan = b43_lpphy_op_get_default_chan, - .set_rx_antenna = b43_lpphy_op_set_rx_antenna, - .recalc_txpower = b43_lpphy_op_recalc_txpower, - .adjust_txpower = b43_lpphy_op_adjust_txpower, - .pwork_15sec = b43_lpphy_op_pwork_15sec, - .pwork_60sec = lpphy_calibration, -}; diff --git a/drivers/net/wireless/b43/phy_lp.h b/drivers/net/wireless/b43/phy_lp.h deleted file mode 100644 index 62737f700cbc..000000000000 --- a/drivers/net/wireless/b43/phy_lp.h +++ /dev/null @@ -1,912 +0,0 @@ -#ifndef LINUX_B43_PHY_LP_H_ -#define LINUX_B43_PHY_LP_H_ - -/* Definitions for the LP-PHY */ - - -/* The CCK PHY register range. */ -#define B43_LPPHY_B_VERSION B43_PHY_CCK(0x00) /* B PHY version */ -#define B43_LPPHY_B_BBCONFIG B43_PHY_CCK(0x01) /* B PHY BBConfig */ -#define B43_LPPHY_B_RX_STAT0 B43_PHY_CCK(0x04) /* B PHY RX Status0 */ -#define B43_LPPHY_B_RX_STAT1 B43_PHY_CCK(0x05) /* B PHY RX Status1 */ -#define B43_LPPHY_B_CRS_THRESH B43_PHY_CCK(0x06) /* B PHY CRS Thresh */ -#define B43_LPPHY_B_TXERROR B43_PHY_CCK(0x07) /* B PHY TxError */ -#define B43_LPPHY_B_CHANNEL B43_PHY_CCK(0x08) /* B PHY Channel */ -#define B43_LPPHY_B_WORKAROUND B43_PHY_CCK(0x09) /* B PHY workaround */ -#define B43_LPPHY_B_TEST B43_PHY_CCK(0x0A) /* B PHY Test */ -#define B43_LPPHY_B_FOURWIRE_ADDR B43_PHY_CCK(0x0B) /* B PHY Fourwire Address */ -#define B43_LPPHY_B_FOURWIRE_DATA_HI B43_PHY_CCK(0x0C) /* B PHY Fourwire Data Hi */ -#define B43_LPPHY_B_FOURWIRE_DATA_LO B43_PHY_CCK(0x0D) /* B PHY Fourwire Data Lo */ -#define B43_LPPHY_B_BIST_STAT B43_PHY_CCK(0x0E) /* B PHY Bist Status */ -#define B43_LPPHY_PA_RAMP_TX_TO B43_PHY_CCK(0x10) /* PA Ramp TX Timeout */ -#define B43_LPPHY_RF_SYNTH_DC_TIMER B43_PHY_CCK(0x11) /* RF Synth DC Timer */ -#define B43_LPPHY_PA_RAMP_TX_TIME_IN B43_PHY_CCK(0x12) /* PA ramp TX Time in */ -#define B43_LPPHY_RX_FILTER_TIME_IN B43_PHY_CCK(0x13) /* RX Filter Time in */ -#define B43_LPPHY_PLL_COEFF_S B43_PHY_CCK(0x18) /* PLL Coefficient(s) */ -#define B43_LPPHY_PLL_OUT B43_PHY_CCK(0x19) /* PLL Out */ -#define B43_LPPHY_RSSI_THRES B43_PHY_CCK(0x20) /* RSSI Threshold */ -#define B43_LPPHY_IQ_THRES_HH B43_PHY_CCK(0x21) /* IQ Threshold HH */ -#define B43_LPPHY_IQ_THRES_H B43_PHY_CCK(0x22) /* IQ Threshold H */ -#define B43_LPPHY_IQ_THRES_L B43_PHY_CCK(0x23) /* IQ Threshold L */ -#define B43_LPPHY_IQ_THRES_LL B43_PHY_CCK(0x24) /* IQ Threshold LL */ -#define B43_LPPHY_AGC_GAIN B43_PHY_CCK(0x25) /* AGC Gain */ -#define B43_LPPHY_LNA_GAIN_RANGE B43_PHY_CCK(0x26) /* LNA Gain Range */ -#define B43_LPPHY_JSSI B43_PHY_CCK(0x27) /* JSSI */ -#define B43_LPPHY_TSSI_CTL B43_PHY_CCK(0x28) /* TSSI Control */ -#define B43_LPPHY_TSSI B43_PHY_CCK(0x29) /* TSSI */ -#define B43_LPPHY_TR_LOSS B43_PHY_CCK(0x2A) /* TR Loss */ -#define B43_LPPHY_LO_LEAKAGE B43_PHY_CCK(0x2B) /* LO Leakage */ -#define B43_LPPHY_LO_RSSIACC B43_PHY_CCK(0x2C) /* LO RSSIAcc */ -#define B43_LPPHY_LO_IQ_MAG_ACC B43_PHY_CCK(0x2D) /* LO IQ Mag Acc */ -#define B43_LPPHY_TX_DCOFFSET1 B43_PHY_CCK(0x2E) /* TX DCOffset1 */ -#define B43_LPPHY_TX_DCOFFSET2 B43_PHY_CCK(0x2F) /* TX DCOffset2 */ -#define B43_LPPHY_SYNCPEAKCNT B43_PHY_CCK(0x30) /* SyncPeakCnt */ -#define B43_LPPHY_SYNCFREQ B43_PHY_CCK(0x31) /* SyncFreq */ -#define B43_LPPHY_SYNCDIVERSITYCTL B43_PHY_CCK(0x32) /* SyncDiversityControl */ -#define B43_LPPHY_PEAKENERGYL B43_PHY_CCK(0x33) /* PeakEnergyL */ -#define B43_LPPHY_PEAKENERGYH B43_PHY_CCK(0x34) /* PeakEnergyH */ -#define B43_LPPHY_SYNCCTL B43_PHY_CCK(0x35) /* SyncControl */ -#define B43_LPPHY_DSSSSTEP B43_PHY_CCK(0x38) /* DsssStep */ -#define B43_LPPHY_DSSSWARMUP B43_PHY_CCK(0x39) /* DsssWarmup */ -#define B43_LPPHY_DSSSSIGPOW B43_PHY_CCK(0x3D) /* DsssSigPow */ -#define B43_LPPHY_SFDDETECTBLOCKTIME B43_PHY_CCK(0x40) /* SfdDetectBlockTIme */ -#define B43_LPPHY_SFDTO B43_PHY_CCK(0x41) /* SFDTimeOut */ -#define B43_LPPHY_SFDCTL B43_PHY_CCK(0x42) /* SFDControl */ -#define B43_LPPHY_RXDBG B43_PHY_CCK(0x43) /* rxDebug */ -#define B43_LPPHY_RX_DELAYCOMP B43_PHY_CCK(0x44) /* RX DelayComp */ -#define B43_LPPHY_CRSDROPOUTTO B43_PHY_CCK(0x45) /* CRSDropoutTimeout */ -#define B43_LPPHY_PSEUDOSHORTTO B43_PHY_CCK(0x46) /* PseudoShortTimeout */ -#define B43_LPPHY_PR3931 B43_PHY_CCK(0x47) /* PR3931 */ -#define B43_LPPHY_DSSSCOEFF1 B43_PHY_CCK(0x48) /* DSSSCoeff1 */ -#define B43_LPPHY_DSSSCOEFF2 B43_PHY_CCK(0x49) /* DSSSCoeff2 */ -#define B43_LPPHY_CCKCOEFF1 B43_PHY_CCK(0x4A) /* CCKCoeff1 */ -#define B43_LPPHY_CCKCOEFF2 B43_PHY_CCK(0x4B) /* CCKCoeff2 */ -#define B43_LPPHY_TRCORR B43_PHY_CCK(0x4C) /* TRCorr */ -#define B43_LPPHY_ANGLESCALE B43_PHY_CCK(0x4D) /* AngleScale */ -#define B43_LPPHY_OPTIONALMODES2 B43_PHY_CCK(0x4F) /* OptionalModes2 */ -#define B43_LPPHY_CCKLMSSTEPSIZE B43_PHY_CCK(0x50) /* CCKLMSStepSize */ -#define B43_LPPHY_DFEBYPASS B43_PHY_CCK(0x51) /* DFEBypass */ -#define B43_LPPHY_CCKSTARTDELAYLONG B43_PHY_CCK(0x52) /* CCKStartDelayLong */ -#define B43_LPPHY_CCKSTARTDELAYSHORT B43_PHY_CCK(0x53) /* CCKStartDelayShort */ -#define B43_LPPHY_PPROCCHDELAY B43_PHY_CCK(0x54) /* PprocChDelay */ -#define B43_LPPHY_PPROCONOFF B43_PHY_CCK(0x55) /* PProcOnOff */ -#define B43_LPPHY_LNAGAINTWOBIT10 B43_PHY_CCK(0x5B) /* LNAGainTwoBit10 */ -#define B43_LPPHY_LNAGAINTWOBIT32 B43_PHY_CCK(0x5C) /* LNAGainTwoBit32 */ -#define B43_LPPHY_OPTIONALMODES B43_PHY_CCK(0x5D) /* OptionalModes */ -#define B43_LPPHY_B_RX_STAT2 B43_PHY_CCK(0x5E) /* B PHY RX Status2 */ -#define B43_LPPHY_B_RX_STAT3 B43_PHY_CCK(0x5F) /* B PHY RX Status3 */ -#define B43_LPPHY_PWDNDACDELAY B43_PHY_CCK(0x63) /* pwdnDacDelay */ -#define B43_LPPHY_FINEDIGIGAIN_CTL B43_PHY_CCK(0x67) /* FineDigiGain Control */ -#define B43_LPPHY_LG2GAINTBLLNA8 B43_PHY_CCK(0x68) /* Lg2GainTblLNA8 */ -#define B43_LPPHY_LG2GAINTBLLNA28 B43_PHY_CCK(0x69) /* Lg2GainTblLNA28 */ -#define B43_LPPHY_GAINTBLLNATRSW B43_PHY_CCK(0x6A) /* GainTblLNATrSw */ -#define B43_LPPHY_PEAKENERGY B43_PHY_CCK(0x6B) /* PeakEnergy */ -#define B43_LPPHY_LG2INITGAIN B43_PHY_CCK(0x6C) /* lg2InitGain */ -#define B43_LPPHY_BLANKCOUNTLNAPGA B43_PHY_CCK(0x6D) /* BlankCountLnaPga */ -#define B43_LPPHY_LNAGAINTWOBIT54 B43_PHY_CCK(0x6E) /* LNAGainTwoBit54 */ -#define B43_LPPHY_LNAGAINTWOBIT76 B43_PHY_CCK(0x6F) /* LNAGainTwoBit76 */ -#define B43_LPPHY_JSSICTL B43_PHY_CCK(0x70) /* JSSIControl */ -#define B43_LPPHY_LG2GAINTBLLNA44 B43_PHY_CCK(0x71) /* Lg2GainTblLNA44 */ -#define B43_LPPHY_LG2GAINTBLLNA62 B43_PHY_CCK(0x72) /* Lg2GainTblLNA62 */ - -/* The OFDM PHY register range. */ -#define B43_LPPHY_VERSION B43_PHY_OFDM(0x00) /* Version */ -#define B43_LPPHY_BBCONFIG B43_PHY_OFDM(0x01) /* BBConfig */ -#define B43_LPPHY_RX_STAT0 B43_PHY_OFDM(0x04) /* RX Status0 */ -#define B43_LPPHY_RX_STAT1 B43_PHY_OFDM(0x05) /* RX Status1 */ -#define B43_LPPHY_TX_ERROR B43_PHY_OFDM(0x07) /* TX Error */ -#define B43_LPPHY_CHANNEL B43_PHY_OFDM(0x08) /* Channel */ -#define B43_LPPHY_WORKAROUND B43_PHY_OFDM(0x09) /* workaround */ -#define B43_LPPHY_FOURWIRE_ADDR B43_PHY_OFDM(0x0B) /* Fourwire Address */ -#define B43_LPPHY_FOURWIREDATAHI B43_PHY_OFDM(0x0C) /* FourwireDataHi */ -#define B43_LPPHY_FOURWIREDATALO B43_PHY_OFDM(0x0D) /* FourwireDataLo */ -#define B43_LPPHY_BISTSTAT0 B43_PHY_OFDM(0x0E) /* BistStatus0 */ -#define B43_LPPHY_BISTSTAT1 B43_PHY_OFDM(0x0F) /* BistStatus1 */ -#define B43_LPPHY_CRSGAIN_CTL B43_PHY_OFDM(0x10) /* crsgain Control */ -#define B43_LPPHY_OFDMPWR_THRESH0 B43_PHY_OFDM(0x11) /* ofdmPower Thresh0 */ -#define B43_LPPHY_OFDMPWR_THRESH1 B43_PHY_OFDM(0x12) /* ofdmPower Thresh1 */ -#define B43_LPPHY_OFDMPWR_THRESH2 B43_PHY_OFDM(0x13) /* ofdmPower Thresh2 */ -#define B43_LPPHY_DSSSPWR_THRESH0 B43_PHY_OFDM(0x14) /* dsssPower Thresh0 */ -#define B43_LPPHY_DSSSPWR_THRESH1 B43_PHY_OFDM(0x15) /* dsssPower Thresh1 */ -#define B43_LPPHY_MINPWR_LEVEL B43_PHY_OFDM(0x16) /* MinPower Level */ -#define B43_LPPHY_OFDMSYNCTHRESH0 B43_PHY_OFDM(0x17) /* ofdmSyncThresh0 */ -#define B43_LPPHY_OFDMSYNCTHRESH1 B43_PHY_OFDM(0x18) /* ofdmSyncThresh1 */ -#define B43_LPPHY_FINEFREQEST B43_PHY_OFDM(0x19) /* FineFreqEst */ -#define B43_LPPHY_IDLEAFTERPKTRXTO B43_PHY_OFDM(0x1A) /* IDLEafterPktRXTimeout */ -#define B43_LPPHY_LTRN_CTL B43_PHY_OFDM(0x1B) /* LTRN Control */ -#define B43_LPPHY_DCOFFSETTRANSIENT B43_PHY_OFDM(0x1C) /* DCOffsetTransient */ -#define B43_LPPHY_PREAMBLEINTO B43_PHY_OFDM(0x1D) /* PreambleInTimeout */ -#define B43_LPPHY_PREAMBLECONFIRMTO B43_PHY_OFDM(0x1E) /* PreambleConfirmTimeout */ -#define B43_LPPHY_CLIPTHRESH B43_PHY_OFDM(0x1F) /* ClipThresh */ -#define B43_LPPHY_CLIPCTRTHRESH B43_PHY_OFDM(0x20) /* ClipCtrThresh */ -#define B43_LPPHY_OFDMSYNCTIMER_CTL B43_PHY_OFDM(0x21) /* ofdmSyncTimer Control */ -#define B43_LPPHY_WAITFORPHYSELTO B43_PHY_OFDM(0x22) /* WaitforPHYSelTimeout */ -#define B43_LPPHY_HIGAINDB B43_PHY_OFDM(0x23) /* HiGainDB */ -#define B43_LPPHY_LOWGAINDB B43_PHY_OFDM(0x24) /* LowGainDB */ -#define B43_LPPHY_VERYLOWGAINDB B43_PHY_OFDM(0x25) /* VeryLowGainDB */ -#define B43_LPPHY_GAINMISMATCH B43_PHY_OFDM(0x26) /* gainMismatch */ -#define B43_LPPHY_GAINDIRECTMISMATCH B43_PHY_OFDM(0x27) /* gaindirectMismatch */ -#define B43_LPPHY_PWR_THRESH0 B43_PHY_OFDM(0x28) /* Power Thresh0 */ -#define B43_LPPHY_PWR_THRESH1 B43_PHY_OFDM(0x29) /* Power Thresh1 */ -#define B43_LPPHY_DETECTOR_DELAY_ADJUST B43_PHY_OFDM(0x2A) /* Detector Delay Adjust */ -#define B43_LPPHY_REDUCED_DETECTOR_DELAY B43_PHY_OFDM(0x2B) /* Reduced Detector Delay */ -#define B43_LPPHY_DATA_TO B43_PHY_OFDM(0x2C) /* data Timeout */ -#define B43_LPPHY_CORRELATOR_DIS_DELAY B43_PHY_OFDM(0x2D) /* correlator Dis Delay */ -#define B43_LPPHY_DIVERSITY_GAINBACK B43_PHY_OFDM(0x2E) /* Diversity GainBack */ -#define B43_LPPHY_DSSS_CONFIRM_CNT B43_PHY_OFDM(0x2F) /* DSSS Confirm Cnt */ -#define B43_LPPHY_DC_BLANK_INT B43_PHY_OFDM(0x30) /* DC Blank Interval */ -#define B43_LPPHY_GAIN_MISMATCH_LIMIT B43_PHY_OFDM(0x31) /* gain Mismatch Limit */ -#define B43_LPPHY_CRS_ED_THRESH B43_PHY_OFDM(0x32) /* crs ed thresh */ -#define B43_LPPHY_PHASE_SHIFT_CTL B43_PHY_OFDM(0x33) /* phase shift Control */ -#define B43_LPPHY_INPUT_PWRDB B43_PHY_OFDM(0x34) /* Input PowerDB */ -#define B43_LPPHY_OFDM_SYNC_CTL B43_PHY_OFDM(0x35) /* ofdm sync Control */ -#define B43_LPPHY_AFE_ADC_CTL_0 B43_PHY_OFDM(0x36) /* Afe ADC Control 0 */ -#define B43_LPPHY_AFE_ADC_CTL_1 B43_PHY_OFDM(0x37) /* Afe ADC Control 1 */ -#define B43_LPPHY_AFE_ADC_CTL_2 B43_PHY_OFDM(0x38) /* Afe ADC Control 2 */ -#define B43_LPPHY_AFE_DAC_CTL B43_PHY_OFDM(0x39) /* Afe DAC Control */ -#define B43_LPPHY_AFE_CTL B43_PHY_OFDM(0x3A) /* Afe Control */ -#define B43_LPPHY_AFE_CTL_OVR B43_PHY_OFDM(0x3B) /* Afe Control Ovr */ -#define B43_LPPHY_AFE_CTL_OVRVAL B43_PHY_OFDM(0x3C) /* Afe Control OvrVal */ -#define B43_LPPHY_AFE_RSSI_CTL_0 B43_PHY_OFDM(0x3D) /* Afe RSSI Control 0 */ -#define B43_LPPHY_AFE_RSSI_CTL_1 B43_PHY_OFDM(0x3E) /* Afe RSSI Control 1 */ -#define B43_LPPHY_AFE_RSSI_SEL B43_PHY_OFDM(0x3F) /* Afe RSSI Sel */ -#define B43_LPPHY_RADAR_THRESH B43_PHY_OFDM(0x40) /* Radar Thresh */ -#define B43_LPPHY_RADAR_BLANK_INT B43_PHY_OFDM(0x41) /* Radar blank Interval */ -#define B43_LPPHY_RADAR_MIN_FM_INT B43_PHY_OFDM(0x42) /* Radar min fm Interval */ -#define B43_LPPHY_RADAR_GAIN_TO B43_PHY_OFDM(0x43) /* Radar gain timeout */ -#define B43_LPPHY_RADAR_PULSE_TO B43_PHY_OFDM(0x44) /* Radar pulse timeout */ -#define B43_LPPHY_RADAR_DETECT_FM_CTL B43_PHY_OFDM(0x45) /* Radar detect FM Control */ -#define B43_LPPHY_RADAR_DETECT_EN B43_PHY_OFDM(0x46) /* Radar detect En */ -#define B43_LPPHY_RADAR_RD_DATA_REG B43_PHY_OFDM(0x47) /* Radar Rd Data Reg */ -#define B43_LPPHY_LP_PHY_CTL B43_PHY_OFDM(0x48) /* LP PHY Control */ -#define B43_LPPHY_CLASSIFIER_CTL B43_PHY_OFDM(0x49) /* classifier Control */ -#define B43_LPPHY_RESET_CTL B43_PHY_OFDM(0x4A) /* reset Control */ -#define B43_LPPHY_CLKEN_CTL B43_PHY_OFDM(0x4B) /* ClkEn Control */ -#define B43_LPPHY_RF_OVERRIDE_0 B43_PHY_OFDM(0x4C) /* RF Override 0 */ -#define B43_LPPHY_RF_OVERRIDE_VAL_0 B43_PHY_OFDM(0x4D) /* RF Override Val 0 */ -#define B43_LPPHY_TR_LOOKUP_1 B43_PHY_OFDM(0x4E) /* TR Lookup 1 */ -#define B43_LPPHY_TR_LOOKUP_2 B43_PHY_OFDM(0x4F) /* TR Lookup 2 */ -#define B43_LPPHY_RSSISELLOOKUP1 B43_PHY_OFDM(0x50) /* RssiSelLookup1 */ -#define B43_LPPHY_IQLO_CAL_CMD B43_PHY_OFDM(0x51) /* iqlo Cal Cmd */ -#define B43_LPPHY_IQLO_CAL_CMD_N_NUM B43_PHY_OFDM(0x52) /* iqlo Cal Cmd N num */ -#define B43_LPPHY_IQLO_CAL_CMD_G_CTL B43_PHY_OFDM(0x53) /* iqlo Cal Cmd G control */ -#define B43_LPPHY_MACINT_DBG_REGISTER B43_PHY_OFDM(0x54) /* macint Debug Register */ -#define B43_LPPHY_TABLE_ADDR B43_PHY_OFDM(0x55) /* Table Address */ -#define B43_LPPHY_TABLEDATALO B43_PHY_OFDM(0x56) /* TabledataLo */ -#define B43_LPPHY_TABLEDATAHI B43_PHY_OFDM(0x57) /* TabledataHi */ -#define B43_LPPHY_PHY_CRS_ENABLE_ADDR B43_PHY_OFDM(0x58) /* phy CRS Enable Address */ -#define B43_LPPHY_IDLETIME_CTL B43_PHY_OFDM(0x59) /* Idletime Control */ -#define B43_LPPHY_IDLETIME_CRS_ON_LO B43_PHY_OFDM(0x5A) /* Idletime CRS On Lo */ -#define B43_LPPHY_IDLETIME_CRS_ON_HI B43_PHY_OFDM(0x5B) /* Idletime CRS On Hi */ -#define B43_LPPHY_IDLETIME_MEAS_TIME_LO B43_PHY_OFDM(0x5C) /* Idletime Meas Time Lo */ -#define B43_LPPHY_IDLETIME_MEAS_TIME_HI B43_PHY_OFDM(0x5D) /* Idletime Meas Time Hi */ -#define B43_LPPHY_RESET_LEN_OFDM_TX_ADDR B43_PHY_OFDM(0x5E) /* Reset len Ofdm TX Address */ -#define B43_LPPHY_RESET_LEN_OFDM_RX_ADDR B43_PHY_OFDM(0x5F) /* Reset len Ofdm RX Address */ -#define B43_LPPHY_REG_CRS_ENABLE B43_PHY_OFDM(0x60) /* reg crs enable */ -#define B43_LPPHY_PLCP_TMT_STR0_CTR_MIN B43_PHY_OFDM(0x61) /* PLCP Tmt Str0 Ctr Min */ -#define B43_LPPHY_PKT_FSM_RESET_LEN_VAL B43_PHY_OFDM(0x62) /* Pkt fsm Reset Len Value */ -#define B43_LPPHY_READSYM2RESET_CTL B43_PHY_OFDM(0x63) /* readsym2reset Control */ -#define B43_LPPHY_DC_FILTER_DELAY1 B43_PHY_OFDM(0x64) /* Dc filter delay1 */ -#define B43_LPPHY_PACKET_RX_ACTIVE_TO B43_PHY_OFDM(0x65) /* packet rx Active timeout */ -#define B43_LPPHY_ED_TOVAL B43_PHY_OFDM(0x66) /* ed timeoutValue */ -#define B43_LPPHY_HOLD_CRS_ON_VAL B43_PHY_OFDM(0x67) /* hold CRS On Value */ -#define B43_LPPHY_OFDM_TX_PHY_CRS_DELAY_VAL B43_PHY_OFDM(0x69) /* ofdm tx phy CRS Delay Value */ -#define B43_LPPHY_CCK_TX_PHY_CRS_DELAY_VAL B43_PHY_OFDM(0x6A) /* cck tx phy CRS Delay Value */ -#define B43_LPPHY_ED_ON_CONFIRM_TIMER_VAL B43_PHY_OFDM(0x6B) /* Ed on confirm Timer Value */ -#define B43_LPPHY_ED_OFFSET_CONFIRM_TIMER_VAL B43_PHY_OFDM(0x6C) /* Ed offset confirm Timer Value */ -#define B43_LPPHY_PHY_CRS_OFFSET_TIMER_VAL B43_PHY_OFDM(0x6D) /* phy CRS offset Timer Value */ -#define B43_LPPHY_ADC_COMPENSATION_CTL B43_PHY_OFDM(0x70) /* ADC Compensation Control */ -#define B43_LPPHY_LOG2_RBPSK_ADDR B43_PHY_OFDM(0x71) /* log2 RBPSK Address */ -#define B43_LPPHY_LOG2_RQPSK_ADDR B43_PHY_OFDM(0x72) /* log2 RQPSK Address */ -#define B43_LPPHY_LOG2_R16QAM_ADDR B43_PHY_OFDM(0x73) /* log2 R16QAM Address */ -#define B43_LPPHY_LOG2_R64QAM_ADDR B43_PHY_OFDM(0x74) /* log2 R64QAM Address */ -#define B43_LPPHY_OFFSET_BPSK_ADDR B43_PHY_OFDM(0x75) /* offset BPSK Address */ -#define B43_LPPHY_OFFSET_QPSK_ADDR B43_PHY_OFDM(0x76) /* offset QPSK Address */ -#define B43_LPPHY_OFFSET_16QAM_ADDR B43_PHY_OFDM(0x77) /* offset 16QAM Address */ -#define B43_LPPHY_OFFSET_64QAM_ADDR B43_PHY_OFDM(0x78) /* offset 64QAM Address */ -#define B43_LPPHY_ALPHA1 B43_PHY_OFDM(0x79) /* Alpha1 */ -#define B43_LPPHY_ALPHA2 B43_PHY_OFDM(0x7A) /* Alpha2 */ -#define B43_LPPHY_BETA1 B43_PHY_OFDM(0x7B) /* Beta1 */ -#define B43_LPPHY_BETA2 B43_PHY_OFDM(0x7C) /* Beta2 */ -#define B43_LPPHY_LOOP_NUM_ADDR B43_PHY_OFDM(0x7D) /* Loop Num Address */ -#define B43_LPPHY_STR_COLLMAX_SMPL_ADDR B43_PHY_OFDM(0x7E) /* Str Collmax Sample Address */ -#define B43_LPPHY_MAX_SMPL_COARSE_FINE_ADDR B43_PHY_OFDM(0x7F) /* Max Sample Coarse/Fine Address */ -#define B43_LPPHY_MAX_SMPL_COARSE_STR0CTR_ADDR B43_PHY_OFDM(0x80) /* Max Sample Coarse/Str0Ctr Address */ -#define B43_LPPHY_IQ_ENABLE_WAIT_TIME_ADDR B43_PHY_OFDM(0x81) /* IQ Enable Wait Time Address */ -#define B43_LPPHY_IQ_NUM_SMPLS_ADDR B43_PHY_OFDM(0x82) /* IQ Num Samples Address */ -#define B43_LPPHY_IQ_ACC_HI_ADDR B43_PHY_OFDM(0x83) /* IQ Acc Hi Address */ -#define B43_LPPHY_IQ_ACC_LO_ADDR B43_PHY_OFDM(0x84) /* IQ Acc Lo Address */ -#define B43_LPPHY_IQ_I_PWR_ACC_HI_ADDR B43_PHY_OFDM(0x85) /* IQ I PWR Acc Hi Address */ -#define B43_LPPHY_IQ_I_PWR_ACC_LO_ADDR B43_PHY_OFDM(0x86) /* IQ I PWR Acc Lo Address */ -#define B43_LPPHY_IQ_Q_PWR_ACC_HI_ADDR B43_PHY_OFDM(0x87) /* IQ Q PWR Acc Hi Address */ -#define B43_LPPHY_IQ_Q_PWR_ACC_LO_ADDR B43_PHY_OFDM(0x88) /* IQ Q PWR Acc Lo Address */ -#define B43_LPPHY_MAXNUMSTEPS B43_PHY_OFDM(0x89) /* MaxNumsteps */ -#define B43_LPPHY_ROTORPHASE_ADDR B43_PHY_OFDM(0x8A) /* RotorPhase Address */ -#define B43_LPPHY_ADVANCEDRETARDROTOR_ADDR B43_PHY_OFDM(0x8B) /* AdvancedRetardRotor Address */ -#define B43_LPPHY_RSSIADCDELAY_CTL_ADDR B43_PHY_OFDM(0x8D) /* rssiAdcdelay Control Address */ -#define B43_LPPHY_TSSISTAT_ADDR B43_PHY_OFDM(0x8E) /* tssiStatus Address */ -#define B43_LPPHY_TEMPSENSESTAT_ADDR B43_PHY_OFDM(0x8F) /* tempsenseStatus Address */ -#define B43_LPPHY_TEMPSENSE_CTL_ADDR B43_PHY_OFDM(0x90) /* tempsense Control Address */ -#define B43_LPPHY_WRSSISTAT_ADDR B43_PHY_OFDM(0x91) /* wrssistatus Address */ -#define B43_LPPHY_MUFACTORADDR B43_PHY_OFDM(0x92) /* mufactoraddr */ -#define B43_LPPHY_SCRAMSTATE_ADDR B43_PHY_OFDM(0x93) /* scramstate Address */ -#define B43_LPPHY_TXHOLDOFFADDR B43_PHY_OFDM(0x94) /* txholdoffaddr */ -#define B43_LPPHY_PKTGAINVAL_ADDR B43_PHY_OFDM(0x95) /* pktgainval Address */ -#define B43_LPPHY_COARSEESTIM_ADDR B43_PHY_OFDM(0x96) /* Coarseestim Address */ -#define B43_LPPHY_STATE_TRANSITION_ADDR B43_PHY_OFDM(0x97) /* state Transition Address */ -#define B43_LPPHY_TRN_OFFSET_ADDR B43_PHY_OFDM(0x98) /* TRN offset Address */ -#define B43_LPPHY_NUM_ROTOR_ADDR B43_PHY_OFDM(0x99) /* Num Rotor Address */ -#define B43_LPPHY_VITERBI_OFFSET_ADDR B43_PHY_OFDM(0x9A) /* Viterbi Offset Address */ -#define B43_LPPHY_SMPL_COLLECT_WAIT_ADDR B43_PHY_OFDM(0x9B) /* Sample collect wait Address */ -#define B43_LPPHY_A_PHY_CTL_ADDR B43_PHY_OFDM(0x9C) /* A PHY Control Address */ -#define B43_LPPHY_NUM_PASS_THROUGH_ADDR B43_PHY_OFDM(0x9D) /* Num Pass Through Address */ -#define B43_LPPHY_RX_COMP_COEFF_S B43_PHY_OFDM(0x9E) /* RX Comp coefficient(s) */ -#define B43_LPPHY_CPAROTATEVAL B43_PHY_OFDM(0x9F) /* cpaRotateValue */ -#define B43_LPPHY_SMPL_PLAY_COUNT B43_PHY_OFDM(0xA0) /* Sample play count */ -#define B43_LPPHY_SMPL_PLAY_BUFFER_CTL B43_PHY_OFDM(0xA1) /* Sample play Buffer Control */ -#define B43_LPPHY_FOURWIRE_CTL B43_PHY_OFDM(0xA2) /* fourwire Control */ -#define B43_LPPHY_CPA_TAILCOUNT_VAL B43_PHY_OFDM(0xA3) /* CPA TailCount Value */ -#define B43_LPPHY_TX_PWR_CTL_CMD B43_PHY_OFDM(0xA4) /* TX Power Control Cmd */ -#define B43_LPPHY_TX_PWR_CTL_CMD_MODE 0xE000 /* TX power control mode mask */ -#define B43_LPPHY_TX_PWR_CTL_CMD_MODE_OFF 0x0000 /* TX power control is OFF */ -#define B43_LPPHY_TX_PWR_CTL_CMD_MODE_SW 0x8000 /* TX power control is SOFTWARE */ -#define B43_LPPHY_TX_PWR_CTL_CMD_MODE_HW 0xE000 /* TX power control is HARDWARE */ -#define B43_LPPHY_TX_PWR_CTL_NNUM B43_PHY_OFDM(0xA5) /* TX Power Control Nnum */ -#define B43_LPPHY_TX_PWR_CTL_IDLETSSI B43_PHY_OFDM(0xA6) /* TX Power Control IdleTssi */ -#define B43_LPPHY_TX_PWR_CTL_TARGETPWR B43_PHY_OFDM(0xA7) /* TX Power Control TargetPower */ -#define B43_LPPHY_TX_PWR_CTL_DELTAPWR_LIMIT B43_PHY_OFDM(0xA8) /* TX Power Control DeltaPower Limit */ -#define B43_LPPHY_TX_PWR_CTL_BASEINDEX B43_PHY_OFDM(0xA9) /* TX Power Control BaseIndex */ -#define B43_LPPHY_TX_PWR_CTL_PWR_INDEX B43_PHY_OFDM(0xAA) /* TX Power Control Power Index */ -#define B43_LPPHY_TX_PWR_CTL_STAT B43_PHY_OFDM(0xAB) /* TX Power Control Status */ -#define B43_LPPHY_LP_RF_SIGNAL_LUT B43_PHY_OFDM(0xAC) /* LP RF signal LUT */ -#define B43_LPPHY_RX_RADIO_CTL_FILTER_STATE B43_PHY_OFDM(0xAD) /* RX Radio Control Filter State */ -#define B43_LPPHY_RX_RADIO_CTL B43_PHY_OFDM(0xAE) /* RX Radio Control */ -#define B43_LPPHY_NRSSI_STAT_ADDR B43_PHY_OFDM(0xAF) /* NRSSI status Address */ -#define B43_LPPHY_RF_OVERRIDE_2 B43_PHY_OFDM(0xB0) /* RF override 2 */ -#define B43_LPPHY_RF_OVERRIDE_2_VAL B43_PHY_OFDM(0xB1) /* RF override 2 val */ -#define B43_LPPHY_PS_CTL_OVERRIDE_VAL0 B43_PHY_OFDM(0xB2) /* PS Control override val0 */ -#define B43_LPPHY_PS_CTL_OVERRIDE_VAL1 B43_PHY_OFDM(0xB3) /* PS Control override val1 */ -#define B43_LPPHY_PS_CTL_OVERRIDE_VAL2 B43_PHY_OFDM(0xB4) /* PS Control override val2 */ -#define B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL B43_PHY_OFDM(0xB5) /* TX gain Control override val */ -#define B43_LPPHY_RX_GAIN_CTL_OVERRIDE_VAL B43_PHY_OFDM(0xB6) /* RX gain Control override val */ -#define B43_LPPHY_AFE_DDFS B43_PHY_OFDM(0xB7) /* AFE DDFS */ -#define B43_LPPHY_AFE_DDFS_POINTER_INIT B43_PHY_OFDM(0xB8) /* AFE DDFS pointer init */ -#define B43_LPPHY_AFE_DDFS_INCR_INIT B43_PHY_OFDM(0xB9) /* AFE DDFS incr init */ -#define B43_LPPHY_MRCNOISEREDUCTION B43_PHY_OFDM(0xBA) /* mrcNoiseReduction */ -#define B43_LPPHY_TR_LOOKUP_3 B43_PHY_OFDM(0xBB) /* TR Lookup 3 */ -#define B43_LPPHY_TR_LOOKUP_4 B43_PHY_OFDM(0xBC) /* TR Lookup 4 */ -#define B43_LPPHY_RADAR_FIFO_STAT B43_PHY_OFDM(0xBD) /* Radar FIFO Status */ -#define B43_LPPHY_GPIO_OUTEN B43_PHY_OFDM(0xBE) /* GPIO Out enable */ -#define B43_LPPHY_GPIO_SELECT B43_PHY_OFDM(0xBF) /* GPIO Select */ -#define B43_LPPHY_GPIO_OUT B43_PHY_OFDM(0xC0) /* GPIO Out */ -#define B43_LPPHY_4C3 B43_PHY_OFDM(0xC3) /* unknown, used during BB init */ -#define B43_LPPHY_4C4 B43_PHY_OFDM(0xC4) /* unknown, used during BB init */ -#define B43_LPPHY_4C5 B43_PHY_OFDM(0xC5) /* unknown, used during BB init */ -#define B43_LPPHY_TR_LOOKUP_5 B43_PHY_OFDM(0xC7) /* TR Lookup 5 */ -#define B43_LPPHY_TR_LOOKUP_6 B43_PHY_OFDM(0xC8) /* TR Lookup 6 */ -#define B43_LPPHY_TR_LOOKUP_7 B43_PHY_OFDM(0xC9) /* TR Lookup 7 */ -#define B43_LPPHY_TR_LOOKUP_8 B43_PHY_OFDM(0xCA) /* TR Lookup 8 */ -#define B43_LPPHY_RF_PWR_OVERRIDE B43_PHY_OFDM(0xD3) /* RF power override */ - - - -/* Radio register access decorators. */ -#define B43_LP_RADIO(radio_reg) (radio_reg) -#define B43_LP_NORTH(radio_reg) B43_LP_RADIO(radio_reg) -#define B43_LP_SOUTH(radio_reg) B43_LP_RADIO((radio_reg) | 0x4000) - - -/*** Broadcom 2062 NORTH radio registers ***/ -#define B2062_N_COMM1 B43_LP_NORTH(0x000) /* Common 01 (north) */ -#define B2062_N_COMM2 B43_LP_NORTH(0x002) /* Common 02 (north) */ -#define B2062_N_COMM3 B43_LP_NORTH(0x003) /* Common 03 (north) */ -#define B2062_N_COMM4 B43_LP_NORTH(0x004) /* Common 04 (north) */ -#define B2062_N_COMM5 B43_LP_NORTH(0x005) /* Common 05 (north) */ -#define B2062_N_COMM6 B43_LP_NORTH(0x006) /* Common 06 (north) */ -#define B2062_N_COMM7 B43_LP_NORTH(0x007) /* Common 07 (north) */ -#define B2062_N_COMM8 B43_LP_NORTH(0x008) /* Common 08 (north) */ -#define B2062_N_COMM9 B43_LP_NORTH(0x009) /* Common 09 (north) */ -#define B2062_N_COMM10 B43_LP_NORTH(0x00A) /* Common 10 (north) */ -#define B2062_N_COMM11 B43_LP_NORTH(0x00B) /* Common 11 (north) */ -#define B2062_N_COMM12 B43_LP_NORTH(0x00C) /* Common 12 (north) */ -#define B2062_N_COMM13 B43_LP_NORTH(0x00D) /* Common 13 (north) */ -#define B2062_N_COMM14 B43_LP_NORTH(0x00E) /* Common 14 (north) */ -#define B2062_N_COMM15 B43_LP_NORTH(0x00F) /* Common 15 (north) */ -#define B2062_N_PDN_CTL0 B43_LP_NORTH(0x010) /* PDN Control 0 (north) */ -#define B2062_N_PDN_CTL1 B43_LP_NORTH(0x011) /* PDN Control 1 (north) */ -#define B2062_N_PDN_CTL2 B43_LP_NORTH(0x012) /* PDN Control 2 (north) */ -#define B2062_N_PDN_CTL3 B43_LP_NORTH(0x013) /* PDN Control 3 (north) */ -#define B2062_N_PDN_CTL4 B43_LP_NORTH(0x014) /* PDN Control 4 (north) */ -#define B2062_N_GEN_CTL0 B43_LP_NORTH(0x015) /* GEN Control 0 (north) */ -#define B2062_N_IQ_CALIB B43_LP_NORTH(0x016) /* IQ Calibration (north) */ -#define B2062_N_LGENC B43_LP_NORTH(0x017) /* LGENC (north) */ -#define B2062_N_LGENA_LPF B43_LP_NORTH(0x018) /* LGENA LPF (north) */ -#define B2062_N_LGENA_BIAS0 B43_LP_NORTH(0x019) /* LGENA Bias 0 (north) */ -#define B2062_N_LGNEA_BIAS1 B43_LP_NORTH(0x01A) /* LGNEA Bias 1 (north) */ -#define B2062_N_LGENA_CTL0 B43_LP_NORTH(0x01B) /* LGENA Control 0 (north) */ -#define B2062_N_LGENA_CTL1 B43_LP_NORTH(0x01C) /* LGENA Control 1 (north) */ -#define B2062_N_LGENA_CTL2 B43_LP_NORTH(0x01D) /* LGENA Control 2 (north) */ -#define B2062_N_LGENA_TUNE0 B43_LP_NORTH(0x01E) /* LGENA Tune 0 (north) */ -#define B2062_N_LGENA_TUNE1 B43_LP_NORTH(0x01F) /* LGENA Tune 1 (north) */ -#define B2062_N_LGENA_TUNE2 B43_LP_NORTH(0x020) /* LGENA Tune 2 (north) */ -#define B2062_N_LGENA_TUNE3 B43_LP_NORTH(0x021) /* LGENA Tune 3 (north) */ -#define B2062_N_LGENA_CTL3 B43_LP_NORTH(0x022) /* LGENA Control 3 (north) */ -#define B2062_N_LGENA_CTL4 B43_LP_NORTH(0x023) /* LGENA Control 4 (north) */ -#define B2062_N_LGENA_CTL5 B43_LP_NORTH(0x024) /* LGENA Control 5 (north) */ -#define B2062_N_LGENA_CTL6 B43_LP_NORTH(0x025) /* LGENA Control 6 (north) */ -#define B2062_N_LGENA_CTL7 B43_LP_NORTH(0x026) /* LGENA Control 7 (north) */ -#define B2062_N_RXA_CTL0 B43_LP_NORTH(0x027) /* RXA Control 0 (north) */ -#define B2062_N_RXA_CTL1 B43_LP_NORTH(0x028) /* RXA Control 1 (north) */ -#define B2062_N_RXA_CTL2 B43_LP_NORTH(0x029) /* RXA Control 2 (north) */ -#define B2062_N_RXA_CTL3 B43_LP_NORTH(0x02A) /* RXA Control 3 (north) */ -#define B2062_N_RXA_CTL4 B43_LP_NORTH(0x02B) /* RXA Control 4 (north) */ -#define B2062_N_RXA_CTL5 B43_LP_NORTH(0x02C) /* RXA Control 5 (north) */ -#define B2062_N_RXA_CTL6 B43_LP_NORTH(0x02D) /* RXA Control 6 (north) */ -#define B2062_N_RXA_CTL7 B43_LP_NORTH(0x02E) /* RXA Control 7 (north) */ -#define B2062_N_RXBB_CTL0 B43_LP_NORTH(0x02F) /* RXBB Control 0 (north) */ -#define B2062_N_RXBB_CTL1 B43_LP_NORTH(0x030) /* RXBB Control 1 (north) */ -#define B2062_N_RXBB_CTL2 B43_LP_NORTH(0x031) /* RXBB Control 2 (north) */ -#define B2062_N_RXBB_GAIN0 B43_LP_NORTH(0x032) /* RXBB Gain 0 (north) */ -#define B2062_N_RXBB_GAIN1 B43_LP_NORTH(0x033) /* RXBB Gain 1 (north) */ -#define B2062_N_RXBB_GAIN2 B43_LP_NORTH(0x034) /* RXBB Gain 2 (north) */ -#define B2062_N_RXBB_GAIN3 B43_LP_NORTH(0x035) /* RXBB Gain 3 (north) */ -#define B2062_N_RXBB_RSSI0 B43_LP_NORTH(0x036) /* RXBB RSSI 0 (north) */ -#define B2062_N_RXBB_RSSI1 B43_LP_NORTH(0x037) /* RXBB RSSI 1 (north) */ -#define B2062_N_RXBB_CALIB0 B43_LP_NORTH(0x038) /* RXBB Calibration0 (north) */ -#define B2062_N_RXBB_CALIB1 B43_LP_NORTH(0x039) /* RXBB Calibration1 (north) */ -#define B2062_N_RXBB_CALIB2 B43_LP_NORTH(0x03A) /* RXBB Calibration2 (north) */ -#define B2062_N_RXBB_BIAS0 B43_LP_NORTH(0x03B) /* RXBB Bias 0 (north) */ -#define B2062_N_RXBB_BIAS1 B43_LP_NORTH(0x03C) /* RXBB Bias 1 (north) */ -#define B2062_N_RXBB_BIAS2 B43_LP_NORTH(0x03D) /* RXBB Bias 2 (north) */ -#define B2062_N_RXBB_BIAS3 B43_LP_NORTH(0x03E) /* RXBB Bias 3 (north) */ -#define B2062_N_RXBB_BIAS4 B43_LP_NORTH(0x03F) /* RXBB Bias 4 (north) */ -#define B2062_N_RXBB_BIAS5 B43_LP_NORTH(0x040) /* RXBB Bias 5 (north) */ -#define B2062_N_RXBB_RSSI2 B43_LP_NORTH(0x041) /* RXBB RSSI 2 (north) */ -#define B2062_N_RXBB_RSSI3 B43_LP_NORTH(0x042) /* RXBB RSSI 3 (north) */ -#define B2062_N_RXBB_RSSI4 B43_LP_NORTH(0x043) /* RXBB RSSI 4 (north) */ -#define B2062_N_RXBB_RSSI5 B43_LP_NORTH(0x044) /* RXBB RSSI 5 (north) */ -#define B2062_N_TX_CTL0 B43_LP_NORTH(0x045) /* TX Control 0 (north) */ -#define B2062_N_TX_CTL1 B43_LP_NORTH(0x046) /* TX Control 1 (north) */ -#define B2062_N_TX_CTL2 B43_LP_NORTH(0x047) /* TX Control 2 (north) */ -#define B2062_N_TX_CTL3 B43_LP_NORTH(0x048) /* TX Control 3 (north) */ -#define B2062_N_TX_CTL4 B43_LP_NORTH(0x049) /* TX Control 4 (north) */ -#define B2062_N_TX_CTL5 B43_LP_NORTH(0x04A) /* TX Control 5 (north) */ -#define B2062_N_TX_CTL6 B43_LP_NORTH(0x04B) /* TX Control 6 (north) */ -#define B2062_N_TX_CTL7 B43_LP_NORTH(0x04C) /* TX Control 7 (north) */ -#define B2062_N_TX_CTL8 B43_LP_NORTH(0x04D) /* TX Control 8 (north) */ -#define B2062_N_TX_CTL9 B43_LP_NORTH(0x04E) /* TX Control 9 (north) */ -#define B2062_N_TX_CTL_A B43_LP_NORTH(0x04F) /* TX Control A (north) */ -#define B2062_N_TX_GC2G B43_LP_NORTH(0x050) /* TX GC2G (north) */ -#define B2062_N_TX_GC5G B43_LP_NORTH(0x051) /* TX GC5G (north) */ -#define B2062_N_TX_TUNE B43_LP_NORTH(0x052) /* TX Tune (north) */ -#define B2062_N_TX_PAD B43_LP_NORTH(0x053) /* TX PAD (north) */ -#define B2062_N_TX_PGA B43_LP_NORTH(0x054) /* TX PGA (north) */ -#define B2062_N_TX_PADAUX B43_LP_NORTH(0x055) /* TX PADAUX (north) */ -#define B2062_N_TX_PGAAUX B43_LP_NORTH(0x056) /* TX PGAAUX (north) */ -#define B2062_N_TSSI_CTL0 B43_LP_NORTH(0x057) /* TSSI Control 0 (north) */ -#define B2062_N_TSSI_CTL1 B43_LP_NORTH(0x058) /* TSSI Control 1 (north) */ -#define B2062_N_TSSI_CTL2 B43_LP_NORTH(0x059) /* TSSI Control 2 (north) */ -#define B2062_N_IQ_CALIB_CTL0 B43_LP_NORTH(0x05A) /* IQ Calibration Control 0 (north) */ -#define B2062_N_IQ_CALIB_CTL1 B43_LP_NORTH(0x05B) /* IQ Calibration Control 1 (north) */ -#define B2062_N_IQ_CALIB_CTL2 B43_LP_NORTH(0x05C) /* IQ Calibration Control 2 (north) */ -#define B2062_N_CALIB_TS B43_LP_NORTH(0x05D) /* Calibration TS (north) */ -#define B2062_N_CALIB_CTL0 B43_LP_NORTH(0x05E) /* Calibration Control 0 (north) */ -#define B2062_N_CALIB_CTL1 B43_LP_NORTH(0x05F) /* Calibration Control 1 (north) */ -#define B2062_N_CALIB_CTL2 B43_LP_NORTH(0x060) /* Calibration Control 2 (north) */ -#define B2062_N_CALIB_CTL3 B43_LP_NORTH(0x061) /* Calibration Control 3 (north) */ -#define B2062_N_CALIB_CTL4 B43_LP_NORTH(0x062) /* Calibration Control 4 (north) */ -#define B2062_N_CALIB_DBG0 B43_LP_NORTH(0x063) /* Calibration Debug 0 (north) */ -#define B2062_N_CALIB_DBG1 B43_LP_NORTH(0x064) /* Calibration Debug 1 (north) */ -#define B2062_N_CALIB_DBG2 B43_LP_NORTH(0x065) /* Calibration Debug 2 (north) */ -#define B2062_N_CALIB_DBG3 B43_LP_NORTH(0x066) /* Calibration Debug 3 (north) */ -#define B2062_N_PSENSE_CTL0 B43_LP_NORTH(0x069) /* PSENSE Control 0 (north) */ -#define B2062_N_PSENSE_CTL1 B43_LP_NORTH(0x06A) /* PSENSE Control 1 (north) */ -#define B2062_N_PSENSE_CTL2 B43_LP_NORTH(0x06B) /* PSENSE Control 2 (north) */ -#define B2062_N_TEST_BUF0 B43_LP_NORTH(0x06C) /* TEST BUF0 (north) */ - -/*** Broadcom 2062 SOUTH radio registers ***/ -#define B2062_S_COMM1 B43_LP_SOUTH(0x000) /* Common 01 (south) */ -#define B2062_S_RADIO_ID_CODE B43_LP_SOUTH(0x001) /* Radio ID code (south) */ -#define B2062_S_COMM2 B43_LP_SOUTH(0x002) /* Common 02 (south) */ -#define B2062_S_COMM3 B43_LP_SOUTH(0x003) /* Common 03 (south) */ -#define B2062_S_COMM4 B43_LP_SOUTH(0x004) /* Common 04 (south) */ -#define B2062_S_COMM5 B43_LP_SOUTH(0x005) /* Common 05 (south) */ -#define B2062_S_COMM6 B43_LP_SOUTH(0x006) /* Common 06 (south) */ -#define B2062_S_COMM7 B43_LP_SOUTH(0x007) /* Common 07 (south) */ -#define B2062_S_COMM8 B43_LP_SOUTH(0x008) /* Common 08 (south) */ -#define B2062_S_COMM9 B43_LP_SOUTH(0x009) /* Common 09 (south) */ -#define B2062_S_COMM10 B43_LP_SOUTH(0x00A) /* Common 10 (south) */ -#define B2062_S_COMM11 B43_LP_SOUTH(0x00B) /* Common 11 (south) */ -#define B2062_S_COMM12 B43_LP_SOUTH(0x00C) /* Common 12 (south) */ -#define B2062_S_COMM13 B43_LP_SOUTH(0x00D) /* Common 13 (south) */ -#define B2062_S_COMM14 B43_LP_SOUTH(0x00E) /* Common 14 (south) */ -#define B2062_S_COMM15 B43_LP_SOUTH(0x00F) /* Common 15 (south) */ -#define B2062_S_PDS_CTL0 B43_LP_SOUTH(0x010) /* PDS Control 0 (south) */ -#define B2062_S_PDS_CTL1 B43_LP_SOUTH(0x011) /* PDS Control 1 (south) */ -#define B2062_S_PDS_CTL2 B43_LP_SOUTH(0x012) /* PDS Control 2 (south) */ -#define B2062_S_PDS_CTL3 B43_LP_SOUTH(0x013) /* PDS Control 3 (south) */ -#define B2062_S_BG_CTL0 B43_LP_SOUTH(0x014) /* BG Control 0 (south) */ -#define B2062_S_BG_CTL1 B43_LP_SOUTH(0x015) /* BG Control 1 (south) */ -#define B2062_S_BG_CTL2 B43_LP_SOUTH(0x016) /* BG Control 2 (south) */ -#define B2062_S_LGENG_CTL0 B43_LP_SOUTH(0x017) /* LGENG Control 00 (south) */ -#define B2062_S_LGENG_CTL1 B43_LP_SOUTH(0x018) /* LGENG Control 01 (south) */ -#define B2062_S_LGENG_CTL2 B43_LP_SOUTH(0x019) /* LGENG Control 02 (south) */ -#define B2062_S_LGENG_CTL3 B43_LP_SOUTH(0x01A) /* LGENG Control 03 (south) */ -#define B2062_S_LGENG_CTL4 B43_LP_SOUTH(0x01B) /* LGENG Control 04 (south) */ -#define B2062_S_LGENG_CTL5 B43_LP_SOUTH(0x01C) /* LGENG Control 05 (south) */ -#define B2062_S_LGENG_CTL6 B43_LP_SOUTH(0x01D) /* LGENG Control 06 (south) */ -#define B2062_S_LGENG_CTL7 B43_LP_SOUTH(0x01E) /* LGENG Control 07 (south) */ -#define B2062_S_LGENG_CTL8 B43_LP_SOUTH(0x01F) /* LGENG Control 08 (south) */ -#define B2062_S_LGENG_CTL9 B43_LP_SOUTH(0x020) /* LGENG Control 09 (south) */ -#define B2062_S_LGENG_CTL10 B43_LP_SOUTH(0x021) /* LGENG Control 10 (south) */ -#define B2062_S_LGENG_CTL11 B43_LP_SOUTH(0x022) /* LGENG Control 11 (south) */ -#define B2062_S_REFPLL_CTL0 B43_LP_SOUTH(0x023) /* REFPLL Control 00 (south) */ -#define B2062_S_REFPLL_CTL1 B43_LP_SOUTH(0x024) /* REFPLL Control 01 (south) */ -#define B2062_S_REFPLL_CTL2 B43_LP_SOUTH(0x025) /* REFPLL Control 02 (south) */ -#define B2062_S_REFPLL_CTL3 B43_LP_SOUTH(0x026) /* REFPLL Control 03 (south) */ -#define B2062_S_REFPLL_CTL4 B43_LP_SOUTH(0x027) /* REFPLL Control 04 (south) */ -#define B2062_S_REFPLL_CTL5 B43_LP_SOUTH(0x028) /* REFPLL Control 05 (south) */ -#define B2062_S_REFPLL_CTL6 B43_LP_SOUTH(0x029) /* REFPLL Control 06 (south) */ -#define B2062_S_REFPLL_CTL7 B43_LP_SOUTH(0x02A) /* REFPLL Control 07 (south) */ -#define B2062_S_REFPLL_CTL8 B43_LP_SOUTH(0x02B) /* REFPLL Control 08 (south) */ -#define B2062_S_REFPLL_CTL9 B43_LP_SOUTH(0x02C) /* REFPLL Control 09 (south) */ -#define B2062_S_REFPLL_CTL10 B43_LP_SOUTH(0x02D) /* REFPLL Control 10 (south) */ -#define B2062_S_REFPLL_CTL11 B43_LP_SOUTH(0x02E) /* REFPLL Control 11 (south) */ -#define B2062_S_REFPLL_CTL12 B43_LP_SOUTH(0x02F) /* REFPLL Control 12 (south) */ -#define B2062_S_REFPLL_CTL13 B43_LP_SOUTH(0x030) /* REFPLL Control 13 (south) */ -#define B2062_S_REFPLL_CTL14 B43_LP_SOUTH(0x031) /* REFPLL Control 14 (south) */ -#define B2062_S_REFPLL_CTL15 B43_LP_SOUTH(0x032) /* REFPLL Control 15 (south) */ -#define B2062_S_REFPLL_CTL16 B43_LP_SOUTH(0x033) /* REFPLL Control 16 (south) */ -#define B2062_S_RFPLL_CTL0 B43_LP_SOUTH(0x034) /* RFPLL Control 00 (south) */ -#define B2062_S_RFPLL_CTL1 B43_LP_SOUTH(0x035) /* RFPLL Control 01 (south) */ -#define B2062_S_RFPLL_CTL2 B43_LP_SOUTH(0x036) /* RFPLL Control 02 (south) */ -#define B2062_S_RFPLL_CTL3 B43_LP_SOUTH(0x037) /* RFPLL Control 03 (south) */ -#define B2062_S_RFPLL_CTL4 B43_LP_SOUTH(0x038) /* RFPLL Control 04 (south) */ -#define B2062_S_RFPLL_CTL5 B43_LP_SOUTH(0x039) /* RFPLL Control 05 (south) */ -#define B2062_S_RFPLL_CTL6 B43_LP_SOUTH(0x03A) /* RFPLL Control 06 (south) */ -#define B2062_S_RFPLL_CTL7 B43_LP_SOUTH(0x03B) /* RFPLL Control 07 (south) */ -#define B2062_S_RFPLL_CTL8 B43_LP_SOUTH(0x03C) /* RFPLL Control 08 (south) */ -#define B2062_S_RFPLL_CTL9 B43_LP_SOUTH(0x03D) /* RFPLL Control 09 (south) */ -#define B2062_S_RFPLL_CTL10 B43_LP_SOUTH(0x03E) /* RFPLL Control 10 (south) */ -#define B2062_S_RFPLL_CTL11 B43_LP_SOUTH(0x03F) /* RFPLL Control 11 (south) */ -#define B2062_S_RFPLL_CTL12 B43_LP_SOUTH(0x040) /* RFPLL Control 12 (south) */ -#define B2062_S_RFPLL_CTL13 B43_LP_SOUTH(0x041) /* RFPLL Control 13 (south) */ -#define B2062_S_RFPLL_CTL14 B43_LP_SOUTH(0x042) /* RFPLL Control 14 (south) */ -#define B2062_S_RFPLL_CTL15 B43_LP_SOUTH(0x043) /* RFPLL Control 15 (south) */ -#define B2062_S_RFPLL_CTL16 B43_LP_SOUTH(0x044) /* RFPLL Control 16 (south) */ -#define B2062_S_RFPLL_CTL17 B43_LP_SOUTH(0x045) /* RFPLL Control 17 (south) */ -#define B2062_S_RFPLL_CTL18 B43_LP_SOUTH(0x046) /* RFPLL Control 18 (south) */ -#define B2062_S_RFPLL_CTL19 B43_LP_SOUTH(0x047) /* RFPLL Control 19 (south) */ -#define B2062_S_RFPLL_CTL20 B43_LP_SOUTH(0x048) /* RFPLL Control 20 (south) */ -#define B2062_S_RFPLL_CTL21 B43_LP_SOUTH(0x049) /* RFPLL Control 21 (south) */ -#define B2062_S_RFPLL_CTL22 B43_LP_SOUTH(0x04A) /* RFPLL Control 22 (south) */ -#define B2062_S_RFPLL_CTL23 B43_LP_SOUTH(0x04B) /* RFPLL Control 23 (south) */ -#define B2062_S_RFPLL_CTL24 B43_LP_SOUTH(0x04C) /* RFPLL Control 24 (south) */ -#define B2062_S_RFPLL_CTL25 B43_LP_SOUTH(0x04D) /* RFPLL Control 25 (south) */ -#define B2062_S_RFPLL_CTL26 B43_LP_SOUTH(0x04E) /* RFPLL Control 26 (south) */ -#define B2062_S_RFPLL_CTL27 B43_LP_SOUTH(0x04F) /* RFPLL Control 27 (south) */ -#define B2062_S_RFPLL_CTL28 B43_LP_SOUTH(0x050) /* RFPLL Control 28 (south) */ -#define B2062_S_RFPLL_CTL29 B43_LP_SOUTH(0x051) /* RFPLL Control 29 (south) */ -#define B2062_S_RFPLL_CTL30 B43_LP_SOUTH(0x052) /* RFPLL Control 30 (south) */ -#define B2062_S_RFPLL_CTL31 B43_LP_SOUTH(0x053) /* RFPLL Control 31 (south) */ -#define B2062_S_RFPLL_CTL32 B43_LP_SOUTH(0x054) /* RFPLL Control 32 (south) */ -#define B2062_S_RFPLL_CTL33 B43_LP_SOUTH(0x055) /* RFPLL Control 33 (south) */ -#define B2062_S_RFPLL_CTL34 B43_LP_SOUTH(0x056) /* RFPLL Control 34 (south) */ -#define B2062_S_RXG_CNT0 B43_LP_SOUTH(0x057) /* RXG Counter 00 (south) */ -#define B2062_S_RXG_CNT1 B43_LP_SOUTH(0x058) /* RXG Counter 01 (south) */ -#define B2062_S_RXG_CNT2 B43_LP_SOUTH(0x059) /* RXG Counter 02 (south) */ -#define B2062_S_RXG_CNT3 B43_LP_SOUTH(0x05A) /* RXG Counter 03 (south) */ -#define B2062_S_RXG_CNT4 B43_LP_SOUTH(0x05B) /* RXG Counter 04 (south) */ -#define B2062_S_RXG_CNT5 B43_LP_SOUTH(0x05C) /* RXG Counter 05 (south) */ -#define B2062_S_RXG_CNT6 B43_LP_SOUTH(0x05D) /* RXG Counter 06 (south) */ -#define B2062_S_RXG_CNT7 B43_LP_SOUTH(0x05E) /* RXG Counter 07 (south) */ -#define B2062_S_RXG_CNT8 B43_LP_SOUTH(0x05F) /* RXG Counter 08 (south) */ -#define B2062_S_RXG_CNT9 B43_LP_SOUTH(0x060) /* RXG Counter 09 (south) */ -#define B2062_S_RXG_CNT10 B43_LP_SOUTH(0x061) /* RXG Counter 10 (south) */ -#define B2062_S_RXG_CNT11 B43_LP_SOUTH(0x062) /* RXG Counter 11 (south) */ -#define B2062_S_RXG_CNT12 B43_LP_SOUTH(0x063) /* RXG Counter 12 (south) */ -#define B2062_S_RXG_CNT13 B43_LP_SOUTH(0x064) /* RXG Counter 13 (south) */ -#define B2062_S_RXG_CNT14 B43_LP_SOUTH(0x065) /* RXG Counter 14 (south) */ -#define B2062_S_RXG_CNT15 B43_LP_SOUTH(0x066) /* RXG Counter 15 (south) */ -#define B2062_S_RXG_CNT16 B43_LP_SOUTH(0x067) /* RXG Counter 16 (south) */ -#define B2062_S_RXG_CNT17 B43_LP_SOUTH(0x068) /* RXG Counter 17 (south) */ - - - -/*** Broadcom 2063 radio registers ***/ -#define B2063_RADIO_ID_CODE B43_LP_RADIO(0x001) /* Radio ID code */ -#define B2063_COMM1 B43_LP_RADIO(0x000) /* Common 01 */ -#define B2063_COMM2 B43_LP_RADIO(0x002) /* Common 02 */ -#define B2063_COMM3 B43_LP_RADIO(0x003) /* Common 03 */ -#define B2063_COMM4 B43_LP_RADIO(0x004) /* Common 04 */ -#define B2063_COMM5 B43_LP_RADIO(0x005) /* Common 05 */ -#define B2063_COMM6 B43_LP_RADIO(0x006) /* Common 06 */ -#define B2063_COMM7 B43_LP_RADIO(0x007) /* Common 07 */ -#define B2063_COMM8 B43_LP_RADIO(0x008) /* Common 08 */ -#define B2063_COMM9 B43_LP_RADIO(0x009) /* Common 09 */ -#define B2063_COMM10 B43_LP_RADIO(0x00A) /* Common 10 */ -#define B2063_COMM11 B43_LP_RADIO(0x00B) /* Common 11 */ -#define B2063_COMM12 B43_LP_RADIO(0x00C) /* Common 12 */ -#define B2063_COMM13 B43_LP_RADIO(0x00D) /* Common 13 */ -#define B2063_COMM14 B43_LP_RADIO(0x00E) /* Common 14 */ -#define B2063_COMM15 B43_LP_RADIO(0x00F) /* Common 15 */ -#define B2063_COMM16 B43_LP_RADIO(0x010) /* Common 16 */ -#define B2063_COMM17 B43_LP_RADIO(0x011) /* Common 17 */ -#define B2063_COMM18 B43_LP_RADIO(0x012) /* Common 18 */ -#define B2063_COMM19 B43_LP_RADIO(0x013) /* Common 19 */ -#define B2063_COMM20 B43_LP_RADIO(0x014) /* Common 20 */ -#define B2063_COMM21 B43_LP_RADIO(0x015) /* Common 21 */ -#define B2063_COMM22 B43_LP_RADIO(0x016) /* Common 22 */ -#define B2063_COMM23 B43_LP_RADIO(0x017) /* Common 23 */ -#define B2063_COMM24 B43_LP_RADIO(0x018) /* Common 24 */ -#define B2063_PWR_SWITCH_CTL B43_LP_RADIO(0x019) /* POWER SWITCH Control */ -#define B2063_PLL_SP1 B43_LP_RADIO(0x01A) /* PLL SP 1 */ -#define B2063_PLL_SP2 B43_LP_RADIO(0x01B) /* PLL SP 2 */ -#define B2063_LOGEN_SP1 B43_LP_RADIO(0x01C) /* LOGEN SP 1 */ -#define B2063_LOGEN_SP2 B43_LP_RADIO(0x01D) /* LOGEN SP 2 */ -#define B2063_LOGEN_SP3 B43_LP_RADIO(0x01E) /* LOGEN SP 3 */ -#define B2063_LOGEN_SP4 B43_LP_RADIO(0x01F) /* LOGEN SP 4 */ -#define B2063_LOGEN_SP5 B43_LP_RADIO(0x020) /* LOGEN SP 5 */ -#define B2063_G_RX_SP1 B43_LP_RADIO(0x021) /* G RX SP 1 */ -#define B2063_G_RX_SP2 B43_LP_RADIO(0x022) /* G RX SP 2 */ -#define B2063_G_RX_SP3 B43_LP_RADIO(0x023) /* G RX SP 3 */ -#define B2063_G_RX_SP4 B43_LP_RADIO(0x024) /* G RX SP 4 */ -#define B2063_G_RX_SP5 B43_LP_RADIO(0x025) /* G RX SP 5 */ -#define B2063_G_RX_SP6 B43_LP_RADIO(0x026) /* G RX SP 6 */ -#define B2063_G_RX_SP7 B43_LP_RADIO(0x027) /* G RX SP 7 */ -#define B2063_G_RX_SP8 B43_LP_RADIO(0x028) /* G RX SP 8 */ -#define B2063_G_RX_SP9 B43_LP_RADIO(0x029) /* G RX SP 9 */ -#define B2063_G_RX_SP10 B43_LP_RADIO(0x02A) /* G RX SP 10 */ -#define B2063_G_RX_SP11 B43_LP_RADIO(0x02B) /* G RX SP 11 */ -#define B2063_A_RX_SP1 B43_LP_RADIO(0x02C) /* A RX SP 1 */ -#define B2063_A_RX_SP2 B43_LP_RADIO(0x02D) /* A RX SP 2 */ -#define B2063_A_RX_SP3 B43_LP_RADIO(0x02E) /* A RX SP 3 */ -#define B2063_A_RX_SP4 B43_LP_RADIO(0x02F) /* A RX SP 4 */ -#define B2063_A_RX_SP5 B43_LP_RADIO(0x030) /* A RX SP 5 */ -#define B2063_A_RX_SP6 B43_LP_RADIO(0x031) /* A RX SP 6 */ -#define B2063_A_RX_SP7 B43_LP_RADIO(0x032) /* A RX SP 7 */ -#define B2063_RX_BB_SP1 B43_LP_RADIO(0x033) /* RX BB SP 1 */ -#define B2063_RX_BB_SP2 B43_LP_RADIO(0x034) /* RX BB SP 2 */ -#define B2063_RX_BB_SP3 B43_LP_RADIO(0x035) /* RX BB SP 3 */ -#define B2063_RX_BB_SP4 B43_LP_RADIO(0x036) /* RX BB SP 4 */ -#define B2063_RX_BB_SP5 B43_LP_RADIO(0x037) /* RX BB SP 5 */ -#define B2063_RX_BB_SP6 B43_LP_RADIO(0x038) /* RX BB SP 6 */ -#define B2063_RX_BB_SP7 B43_LP_RADIO(0x039) /* RX BB SP 7 */ -#define B2063_RX_BB_SP8 B43_LP_RADIO(0x03A) /* RX BB SP 8 */ -#define B2063_TX_RF_SP1 B43_LP_RADIO(0x03B) /* TX RF SP 1 */ -#define B2063_TX_RF_SP2 B43_LP_RADIO(0x03C) /* TX RF SP 2 */ -#define B2063_TX_RF_SP3 B43_LP_RADIO(0x03D) /* TX RF SP 3 */ -#define B2063_TX_RF_SP4 B43_LP_RADIO(0x03E) /* TX RF SP 4 */ -#define B2063_TX_RF_SP5 B43_LP_RADIO(0x03F) /* TX RF SP 5 */ -#define B2063_TX_RF_SP6 B43_LP_RADIO(0x040) /* TX RF SP 6 */ -#define B2063_TX_RF_SP7 B43_LP_RADIO(0x041) /* TX RF SP 7 */ -#define B2063_TX_RF_SP8 B43_LP_RADIO(0x042) /* TX RF SP 8 */ -#define B2063_TX_RF_SP9 B43_LP_RADIO(0x043) /* TX RF SP 9 */ -#define B2063_TX_RF_SP10 B43_LP_RADIO(0x044) /* TX RF SP 10 */ -#define B2063_TX_RF_SP11 B43_LP_RADIO(0x045) /* TX RF SP 11 */ -#define B2063_TX_RF_SP12 B43_LP_RADIO(0x046) /* TX RF SP 12 */ -#define B2063_TX_RF_SP13 B43_LP_RADIO(0x047) /* TX RF SP 13 */ -#define B2063_TX_RF_SP14 B43_LP_RADIO(0x048) /* TX RF SP 14 */ -#define B2063_TX_RF_SP15 B43_LP_RADIO(0x049) /* TX RF SP 15 */ -#define B2063_TX_RF_SP16 B43_LP_RADIO(0x04A) /* TX RF SP 16 */ -#define B2063_TX_RF_SP17 B43_LP_RADIO(0x04B) /* TX RF SP 17 */ -#define B2063_PA_SP1 B43_LP_RADIO(0x04C) /* PA SP 1 */ -#define B2063_PA_SP2 B43_LP_RADIO(0x04D) /* PA SP 2 */ -#define B2063_PA_SP3 B43_LP_RADIO(0x04E) /* PA SP 3 */ -#define B2063_PA_SP4 B43_LP_RADIO(0x04F) /* PA SP 4 */ -#define B2063_PA_SP5 B43_LP_RADIO(0x050) /* PA SP 5 */ -#define B2063_PA_SP6 B43_LP_RADIO(0x051) /* PA SP 6 */ -#define B2063_PA_SP7 B43_LP_RADIO(0x052) /* PA SP 7 */ -#define B2063_TX_BB_SP1 B43_LP_RADIO(0x053) /* TX BB SP 1 */ -#define B2063_TX_BB_SP2 B43_LP_RADIO(0x054) /* TX BB SP 2 */ -#define B2063_TX_BB_SP3 B43_LP_RADIO(0x055) /* TX BB SP 3 */ -#define B2063_REG_SP1 B43_LP_RADIO(0x056) /* REG SP 1 */ -#define B2063_BANDGAP_CTL1 B43_LP_RADIO(0x057) /* BANDGAP Control 1 */ -#define B2063_BANDGAP_CTL2 B43_LP_RADIO(0x058) /* BANDGAP Control 2 */ -#define B2063_LPO_CTL1 B43_LP_RADIO(0x059) /* LPO Control 1 */ -#define B2063_RC_CALIB_CTL1 B43_LP_RADIO(0x05A) /* RC Calibration Control 1 */ -#define B2063_RC_CALIB_CTL2 B43_LP_RADIO(0x05B) /* RC Calibration Control 2 */ -#define B2063_RC_CALIB_CTL3 B43_LP_RADIO(0x05C) /* RC Calibration Control 3 */ -#define B2063_RC_CALIB_CTL4 B43_LP_RADIO(0x05D) /* RC Calibration Control 4 */ -#define B2063_RC_CALIB_CTL5 B43_LP_RADIO(0x05E) /* RC Calibration Control 5 */ -#define B2063_RC_CALIB_CTL6 B43_LP_RADIO(0x05F) /* RC Calibration Control 6 */ -#define B2063_RC_CALIB_CTL7 B43_LP_RADIO(0x060) /* RC Calibration Control 7 */ -#define B2063_RC_CALIB_CTL8 B43_LP_RADIO(0x061) /* RC Calibration Control 8 */ -#define B2063_RC_CALIB_CTL9 B43_LP_RADIO(0x062) /* RC Calibration Control 9 */ -#define B2063_RC_CALIB_CTL10 B43_LP_RADIO(0x063) /* RC Calibration Control 10 */ -#define B2063_PLL_JTAG_CALNRST B43_LP_RADIO(0x064) /* PLL JTAG CALNRST */ -#define B2063_PLL_JTAG_IN_PLL1 B43_LP_RADIO(0x065) /* PLL JTAG IN PLL 1 */ -#define B2063_PLL_JTAG_IN_PLL2 B43_LP_RADIO(0x066) /* PLL JTAG IN PLL 2 */ -#define B2063_PLL_JTAG_PLL_CP1 B43_LP_RADIO(0x067) /* PLL JTAG PLL CP 1 */ -#define B2063_PLL_JTAG_PLL_CP2 B43_LP_RADIO(0x068) /* PLL JTAG PLL CP 2 */ -#define B2063_PLL_JTAG_PLL_CP3 B43_LP_RADIO(0x069) /* PLL JTAG PLL CP 3 */ -#define B2063_PLL_JTAG_PLL_CP4 B43_LP_RADIO(0x06A) /* PLL JTAG PLL CP 4 */ -#define B2063_PLL_JTAG_PLL_CTL1 B43_LP_RADIO(0x06B) /* PLL JTAG PLL Control 1 */ -#define B2063_PLL_JTAG_PLL_LF1 B43_LP_RADIO(0x06C) /* PLL JTAG PLL LF 1 */ -#define B2063_PLL_JTAG_PLL_LF2 B43_LP_RADIO(0x06D) /* PLL JTAG PLL LF 2 */ -#define B2063_PLL_JTAG_PLL_LF3 B43_LP_RADIO(0x06E) /* PLL JTAG PLL LF 3 */ -#define B2063_PLL_JTAG_PLL_LF4 B43_LP_RADIO(0x06F) /* PLL JTAG PLL LF 4 */ -#define B2063_PLL_JTAG_PLL_SG1 B43_LP_RADIO(0x070) /* PLL JTAG PLL SG 1 */ -#define B2063_PLL_JTAG_PLL_SG2 B43_LP_RADIO(0x071) /* PLL JTAG PLL SG 2 */ -#define B2063_PLL_JTAG_PLL_SG3 B43_LP_RADIO(0x072) /* PLL JTAG PLL SG 3 */ -#define B2063_PLL_JTAG_PLL_SG4 B43_LP_RADIO(0x073) /* PLL JTAG PLL SG 4 */ -#define B2063_PLL_JTAG_PLL_SG5 B43_LP_RADIO(0x074) /* PLL JTAG PLL SG 5 */ -#define B2063_PLL_JTAG_PLL_VCO1 B43_LP_RADIO(0x075) /* PLL JTAG PLL VCO 1 */ -#define B2063_PLL_JTAG_PLL_VCO2 B43_LP_RADIO(0x076) /* PLL JTAG PLL VCO 2 */ -#define B2063_PLL_JTAG_PLL_VCO_CALIB1 B43_LP_RADIO(0x077) /* PLL JTAG PLL VCO Calibration 1 */ -#define B2063_PLL_JTAG_PLL_VCO_CALIB2 B43_LP_RADIO(0x078) /* PLL JTAG PLL VCO Calibration 2 */ -#define B2063_PLL_JTAG_PLL_VCO_CALIB3 B43_LP_RADIO(0x079) /* PLL JTAG PLL VCO Calibration 3 */ -#define B2063_PLL_JTAG_PLL_VCO_CALIB4 B43_LP_RADIO(0x07A) /* PLL JTAG PLL VCO Calibration 4 */ -#define B2063_PLL_JTAG_PLL_VCO_CALIB5 B43_LP_RADIO(0x07B) /* PLL JTAG PLL VCO Calibration 5 */ -#define B2063_PLL_JTAG_PLL_VCO_CALIB6 B43_LP_RADIO(0x07C) /* PLL JTAG PLL VCO Calibration 6 */ -#define B2063_PLL_JTAG_PLL_VCO_CALIB7 B43_LP_RADIO(0x07D) /* PLL JTAG PLL VCO Calibration 7 */ -#define B2063_PLL_JTAG_PLL_VCO_CALIB8 B43_LP_RADIO(0x07E) /* PLL JTAG PLL VCO Calibration 8 */ -#define B2063_PLL_JTAG_PLL_VCO_CALIB9 B43_LP_RADIO(0x07F) /* PLL JTAG PLL VCO Calibration 9 */ -#define B2063_PLL_JTAG_PLL_VCO_CALIB10 B43_LP_RADIO(0x080) /* PLL JTAG PLL VCO Calibration 10 */ -#define B2063_PLL_JTAG_PLL_XTAL_12 B43_LP_RADIO(0x081) /* PLL JTAG PLL XTAL 1 2 */ -#define B2063_PLL_JTAG_PLL_XTAL3 B43_LP_RADIO(0x082) /* PLL JTAG PLL XTAL 3 */ -#define B2063_LOGEN_ACL1 B43_LP_RADIO(0x083) /* LOGEN ACL 1 */ -#define B2063_LOGEN_ACL2 B43_LP_RADIO(0x084) /* LOGEN ACL 2 */ -#define B2063_LOGEN_ACL3 B43_LP_RADIO(0x085) /* LOGEN ACL 3 */ -#define B2063_LOGEN_ACL4 B43_LP_RADIO(0x086) /* LOGEN ACL 4 */ -#define B2063_LOGEN_ACL5 B43_LP_RADIO(0x087) /* LOGEN ACL 5 */ -#define B2063_LO_CALIB_INPUTS B43_LP_RADIO(0x088) /* LO Calibration INPUTS */ -#define B2063_LO_CALIB_CTL1 B43_LP_RADIO(0x089) /* LO Calibration Control 1 */ -#define B2063_LO_CALIB_CTL2 B43_LP_RADIO(0x08A) /* LO Calibration Control 2 */ -#define B2063_LO_CALIB_CTL3 B43_LP_RADIO(0x08B) /* LO Calibration Control 3 */ -#define B2063_LO_CALIB_WAITCNT B43_LP_RADIO(0x08C) /* LO Calibration WAITCNT */ -#define B2063_LO_CALIB_OVR1 B43_LP_RADIO(0x08D) /* LO Calibration OVR 1 */ -#define B2063_LO_CALIB_OVR2 B43_LP_RADIO(0x08E) /* LO Calibration OVR 2 */ -#define B2063_LO_CALIB_OVAL1 B43_LP_RADIO(0x08F) /* LO Calibration OVAL 1 */ -#define B2063_LO_CALIB_OVAL2 B43_LP_RADIO(0x090) /* LO Calibration OVAL 2 */ -#define B2063_LO_CALIB_OVAL3 B43_LP_RADIO(0x091) /* LO Calibration OVAL 3 */ -#define B2063_LO_CALIB_OVAL4 B43_LP_RADIO(0x092) /* LO Calibration OVAL 4 */ -#define B2063_LO_CALIB_OVAL5 B43_LP_RADIO(0x093) /* LO Calibration OVAL 5 */ -#define B2063_LO_CALIB_OVAL6 B43_LP_RADIO(0x094) /* LO Calibration OVAL 6 */ -#define B2063_LO_CALIB_OVAL7 B43_LP_RADIO(0x095) /* LO Calibration OVAL 7 */ -#define B2063_LO_CALIB_CALVLD1 B43_LP_RADIO(0x096) /* LO Calibration CALVLD 1 */ -#define B2063_LO_CALIB_CALVLD2 B43_LP_RADIO(0x097) /* LO Calibration CALVLD 2 */ -#define B2063_LO_CALIB_CVAL1 B43_LP_RADIO(0x098) /* LO Calibration CVAL 1 */ -#define B2063_LO_CALIB_CVAL2 B43_LP_RADIO(0x099) /* LO Calibration CVAL 2 */ -#define B2063_LO_CALIB_CVAL3 B43_LP_RADIO(0x09A) /* LO Calibration CVAL 3 */ -#define B2063_LO_CALIB_CVAL4 B43_LP_RADIO(0x09B) /* LO Calibration CVAL 4 */ -#define B2063_LO_CALIB_CVAL5 B43_LP_RADIO(0x09C) /* LO Calibration CVAL 5 */ -#define B2063_LO_CALIB_CVAL6 B43_LP_RADIO(0x09D) /* LO Calibration CVAL 6 */ -#define B2063_LO_CALIB_CVAL7 B43_LP_RADIO(0x09E) /* LO Calibration CVAL 7 */ -#define B2063_LOGEN_CALIB_EN B43_LP_RADIO(0x09F) /* LOGEN Calibration EN */ -#define B2063_LOGEN_PEAKDET1 B43_LP_RADIO(0x0A0) /* LOGEN PEAKDET 1 */ -#define B2063_LOGEN_RCCR1 B43_LP_RADIO(0x0A1) /* LOGEN RCCR 1 */ -#define B2063_LOGEN_VCOBUF1 B43_LP_RADIO(0x0A2) /* LOGEN VCOBUF 1 */ -#define B2063_LOGEN_MIXER1 B43_LP_RADIO(0x0A3) /* LOGEN MIXER 1 */ -#define B2063_LOGEN_MIXER2 B43_LP_RADIO(0x0A4) /* LOGEN MIXER 2 */ -#define B2063_LOGEN_BUF1 B43_LP_RADIO(0x0A5) /* LOGEN BUF 1 */ -#define B2063_LOGEN_BUF2 B43_LP_RADIO(0x0A6) /* LOGEN BUF 2 */ -#define B2063_LOGEN_DIV1 B43_LP_RADIO(0x0A7) /* LOGEN DIV 1 */ -#define B2063_LOGEN_DIV2 B43_LP_RADIO(0x0A8) /* LOGEN DIV 2 */ -#define B2063_LOGEN_DIV3 B43_LP_RADIO(0x0A9) /* LOGEN DIV 3 */ -#define B2063_LOGEN_CBUFRX1 B43_LP_RADIO(0x0AA) /* LOGEN CBUFRX 1 */ -#define B2063_LOGEN_CBUFRX2 B43_LP_RADIO(0x0AB) /* LOGEN CBUFRX 2 */ -#define B2063_LOGEN_CBUFTX1 B43_LP_RADIO(0x0AC) /* LOGEN CBUFTX 1 */ -#define B2063_LOGEN_CBUFTX2 B43_LP_RADIO(0x0AD) /* LOGEN CBUFTX 2 */ -#define B2063_LOGEN_IDAC1 B43_LP_RADIO(0x0AE) /* LOGEN IDAC 1 */ -#define B2063_LOGEN_SPARE1 B43_LP_RADIO(0x0AF) /* LOGEN SPARE 1 */ -#define B2063_LOGEN_SPARE2 B43_LP_RADIO(0x0B0) /* LOGEN SPARE 2 */ -#define B2063_LOGEN_SPARE3 B43_LP_RADIO(0x0B1) /* LOGEN SPARE 3 */ -#define B2063_G_RX_1ST1 B43_LP_RADIO(0x0B2) /* G RX 1ST 1 */ -#define B2063_G_RX_1ST2 B43_LP_RADIO(0x0B3) /* G RX 1ST 2 */ -#define B2063_G_RX_1ST3 B43_LP_RADIO(0x0B4) /* G RX 1ST 3 */ -#define B2063_G_RX_2ND1 B43_LP_RADIO(0x0B5) /* G RX 2ND 1 */ -#define B2063_G_RX_2ND2 B43_LP_RADIO(0x0B6) /* G RX 2ND 2 */ -#define B2063_G_RX_2ND3 B43_LP_RADIO(0x0B7) /* G RX 2ND 3 */ -#define B2063_G_RX_2ND4 B43_LP_RADIO(0x0B8) /* G RX 2ND 4 */ -#define B2063_G_RX_2ND5 B43_LP_RADIO(0x0B9) /* G RX 2ND 5 */ -#define B2063_G_RX_2ND6 B43_LP_RADIO(0x0BA) /* G RX 2ND 6 */ -#define B2063_G_RX_2ND7 B43_LP_RADIO(0x0BB) /* G RX 2ND 7 */ -#define B2063_G_RX_2ND8 B43_LP_RADIO(0x0BC) /* G RX 2ND 8 */ -#define B2063_G_RX_PS1 B43_LP_RADIO(0x0BD) /* G RX PS 1 */ -#define B2063_G_RX_PS2 B43_LP_RADIO(0x0BE) /* G RX PS 2 */ -#define B2063_G_RX_PS3 B43_LP_RADIO(0x0BF) /* G RX PS 3 */ -#define B2063_G_RX_PS4 B43_LP_RADIO(0x0C0) /* G RX PS 4 */ -#define B2063_G_RX_PS5 B43_LP_RADIO(0x0C1) /* G RX PS 5 */ -#define B2063_G_RX_MIX1 B43_LP_RADIO(0x0C2) /* G RX MIX 1 */ -#define B2063_G_RX_MIX2 B43_LP_RADIO(0x0C3) /* G RX MIX 2 */ -#define B2063_G_RX_MIX3 B43_LP_RADIO(0x0C4) /* G RX MIX 3 */ -#define B2063_G_RX_MIX4 B43_LP_RADIO(0x0C5) /* G RX MIX 4 */ -#define B2063_G_RX_MIX5 B43_LP_RADIO(0x0C6) /* G RX MIX 5 */ -#define B2063_G_RX_MIX6 B43_LP_RADIO(0x0C7) /* G RX MIX 6 */ -#define B2063_G_RX_MIX7 B43_LP_RADIO(0x0C8) /* G RX MIX 7 */ -#define B2063_G_RX_MIX8 B43_LP_RADIO(0x0C9) /* G RX MIX 8 */ -#define B2063_G_RX_PDET1 B43_LP_RADIO(0x0CA) /* G RX PDET 1 */ -#define B2063_G_RX_SPARES1 B43_LP_RADIO(0x0CB) /* G RX SPARES 1 */ -#define B2063_G_RX_SPARES2 B43_LP_RADIO(0x0CC) /* G RX SPARES 2 */ -#define B2063_G_RX_SPARES3 B43_LP_RADIO(0x0CD) /* G RX SPARES 3 */ -#define B2063_A_RX_1ST1 B43_LP_RADIO(0x0CE) /* A RX 1ST 1 */ -#define B2063_A_RX_1ST2 B43_LP_RADIO(0x0CF) /* A RX 1ST 2 */ -#define B2063_A_RX_1ST3 B43_LP_RADIO(0x0D0) /* A RX 1ST 3 */ -#define B2063_A_RX_1ST4 B43_LP_RADIO(0x0D1) /* A RX 1ST 4 */ -#define B2063_A_RX_1ST5 B43_LP_RADIO(0x0D2) /* A RX 1ST 5 */ -#define B2063_A_RX_2ND1 B43_LP_RADIO(0x0D3) /* A RX 2ND 1 */ -#define B2063_A_RX_2ND2 B43_LP_RADIO(0x0D4) /* A RX 2ND 2 */ -#define B2063_A_RX_2ND3 B43_LP_RADIO(0x0D5) /* A RX 2ND 3 */ -#define B2063_A_RX_2ND4 B43_LP_RADIO(0x0D6) /* A RX 2ND 4 */ -#define B2063_A_RX_2ND5 B43_LP_RADIO(0x0D7) /* A RX 2ND 5 */ -#define B2063_A_RX_2ND6 B43_LP_RADIO(0x0D8) /* A RX 2ND 6 */ -#define B2063_A_RX_2ND7 B43_LP_RADIO(0x0D9) /* A RX 2ND 7 */ -#define B2063_A_RX_PS1 B43_LP_RADIO(0x0DA) /* A RX PS 1 */ -#define B2063_A_RX_PS2 B43_LP_RADIO(0x0DB) /* A RX PS 2 */ -#define B2063_A_RX_PS3 B43_LP_RADIO(0x0DC) /* A RX PS 3 */ -#define B2063_A_RX_PS4 B43_LP_RADIO(0x0DD) /* A RX PS 4 */ -#define B2063_A_RX_PS5 B43_LP_RADIO(0x0DE) /* A RX PS 5 */ -#define B2063_A_RX_PS6 B43_LP_RADIO(0x0DF) /* A RX PS 6 */ -#define B2063_A_RX_MIX1 B43_LP_RADIO(0x0E0) /* A RX MIX 1 */ -#define B2063_A_RX_MIX2 B43_LP_RADIO(0x0E1) /* A RX MIX 2 */ -#define B2063_A_RX_MIX3 B43_LP_RADIO(0x0E2) /* A RX MIX 3 */ -#define B2063_A_RX_MIX4 B43_LP_RADIO(0x0E3) /* A RX MIX 4 */ -#define B2063_A_RX_MIX5 B43_LP_RADIO(0x0E4) /* A RX MIX 5 */ -#define B2063_A_RX_MIX6 B43_LP_RADIO(0x0E5) /* A RX MIX 6 */ -#define B2063_A_RX_MIX7 B43_LP_RADIO(0x0E6) /* A RX MIX 7 */ -#define B2063_A_RX_MIX8 B43_LP_RADIO(0x0E7) /* A RX MIX 8 */ -#define B2063_A_RX_PWRDET1 B43_LP_RADIO(0x0E8) /* A RX PWRDET 1 */ -#define B2063_A_RX_SPARE1 B43_LP_RADIO(0x0E9) /* A RX SPARE 1 */ -#define B2063_A_RX_SPARE2 B43_LP_RADIO(0x0EA) /* A RX SPARE 2 */ -#define B2063_A_RX_SPARE3 B43_LP_RADIO(0x0EB) /* A RX SPARE 3 */ -#define B2063_RX_TIA_CTL1 B43_LP_RADIO(0x0EC) /* RX TIA Control 1 */ -#define B2063_RX_TIA_CTL2 B43_LP_RADIO(0x0ED) /* RX TIA Control 2 */ -#define B2063_RX_TIA_CTL3 B43_LP_RADIO(0x0EE) /* RX TIA Control 3 */ -#define B2063_RX_TIA_CTL4 B43_LP_RADIO(0x0EF) /* RX TIA Control 4 */ -#define B2063_RX_TIA_CTL5 B43_LP_RADIO(0x0F0) /* RX TIA Control 5 */ -#define B2063_RX_TIA_CTL6 B43_LP_RADIO(0x0F1) /* RX TIA Control 6 */ -#define B2063_RX_BB_CTL1 B43_LP_RADIO(0x0F2) /* RX BB Control 1 */ -#define B2063_RX_BB_CTL2 B43_LP_RADIO(0x0F3) /* RX BB Control 2 */ -#define B2063_RX_BB_CTL3 B43_LP_RADIO(0x0F4) /* RX BB Control 3 */ -#define B2063_RX_BB_CTL4 B43_LP_RADIO(0x0F5) /* RX BB Control 4 */ -#define B2063_RX_BB_CTL5 B43_LP_RADIO(0x0F6) /* RX BB Control 5 */ -#define B2063_RX_BB_CTL6 B43_LP_RADIO(0x0F7) /* RX BB Control 6 */ -#define B2063_RX_BB_CTL7 B43_LP_RADIO(0x0F8) /* RX BB Control 7 */ -#define B2063_RX_BB_CTL8 B43_LP_RADIO(0x0F9) /* RX BB Control 8 */ -#define B2063_RX_BB_CTL9 B43_LP_RADIO(0x0FA) /* RX BB Control 9 */ -#define B2063_TX_RF_CTL1 B43_LP_RADIO(0x0FB) /* TX RF Control 1 */ -#define B2063_TX_RF_IDAC_LO_RF_I B43_LP_RADIO(0x0FC) /* TX RF IDAC LO RF I */ -#define B2063_TX_RF_IDAC_LO_RF_Q B43_LP_RADIO(0x0FD) /* TX RF IDAC LO RF Q */ -#define B2063_TX_RF_IDAC_LO_BB_I B43_LP_RADIO(0x0FE) /* TX RF IDAC LO BB I */ -#define B2063_TX_RF_IDAC_LO_BB_Q B43_LP_RADIO(0x0FF) /* TX RF IDAC LO BB Q */ -#define B2063_TX_RF_CTL2 B43_LP_RADIO(0x100) /* TX RF Control 2 */ -#define B2063_TX_RF_CTL3 B43_LP_RADIO(0x101) /* TX RF Control 3 */ -#define B2063_TX_RF_CTL4 B43_LP_RADIO(0x102) /* TX RF Control 4 */ -#define B2063_TX_RF_CTL5 B43_LP_RADIO(0x103) /* TX RF Control 5 */ -#define B2063_TX_RF_CTL6 B43_LP_RADIO(0x104) /* TX RF Control 6 */ -#define B2063_TX_RF_CTL7 B43_LP_RADIO(0x105) /* TX RF Control 7 */ -#define B2063_TX_RF_CTL8 B43_LP_RADIO(0x106) /* TX RF Control 8 */ -#define B2063_TX_RF_CTL9 B43_LP_RADIO(0x107) /* TX RF Control 9 */ -#define B2063_TX_RF_CTL10 B43_LP_RADIO(0x108) /* TX RF Control 10 */ -#define B2063_TX_RF_CTL14 B43_LP_RADIO(0x109) /* TX RF Control 14 */ -#define B2063_TX_RF_CTL15 B43_LP_RADIO(0x10A) /* TX RF Control 15 */ -#define B2063_PA_CTL1 B43_LP_RADIO(0x10B) /* PA Control 1 */ -#define B2063_PA_CTL2 B43_LP_RADIO(0x10C) /* PA Control 2 */ -#define B2063_PA_CTL3 B43_LP_RADIO(0x10D) /* PA Control 3 */ -#define B2063_PA_CTL4 B43_LP_RADIO(0x10E) /* PA Control 4 */ -#define B2063_PA_CTL5 B43_LP_RADIO(0x10F) /* PA Control 5 */ -#define B2063_PA_CTL6 B43_LP_RADIO(0x110) /* PA Control 6 */ -#define B2063_PA_CTL7 B43_LP_RADIO(0x111) /* PA Control 7 */ -#define B2063_PA_CTL8 B43_LP_RADIO(0x112) /* PA Control 8 */ -#define B2063_PA_CTL9 B43_LP_RADIO(0x113) /* PA Control 9 */ -#define B2063_PA_CTL10 B43_LP_RADIO(0x114) /* PA Control 10 */ -#define B2063_PA_CTL11 B43_LP_RADIO(0x115) /* PA Control 11 */ -#define B2063_PA_CTL12 B43_LP_RADIO(0x116) /* PA Control 12 */ -#define B2063_PA_CTL13 B43_LP_RADIO(0x117) /* PA Control 13 */ -#define B2063_TX_BB_CTL1 B43_LP_RADIO(0x118) /* TX BB Control 1 */ -#define B2063_TX_BB_CTL2 B43_LP_RADIO(0x119) /* TX BB Control 2 */ -#define B2063_TX_BB_CTL3 B43_LP_RADIO(0x11A) /* TX BB Control 3 */ -#define B2063_TX_BB_CTL4 B43_LP_RADIO(0x11B) /* TX BB Control 4 */ -#define B2063_GPIO_CTL1 B43_LP_RADIO(0x11C) /* GPIO Control 1 */ -#define B2063_VREG_CTL1 B43_LP_RADIO(0x11D) /* VREG Control 1 */ -#define B2063_AMUX_CTL1 B43_LP_RADIO(0x11E) /* AMUX Control 1 */ -#define B2063_IQ_CALIB_GVAR B43_LP_RADIO(0x11F) /* IQ Calibration GVAR */ -#define B2063_IQ_CALIB_CTL1 B43_LP_RADIO(0x120) /* IQ Calibration Control 1 */ -#define B2063_IQ_CALIB_CTL2 B43_LP_RADIO(0x121) /* IQ Calibration Control 2 */ -#define B2063_TEMPSENSE_CTL1 B43_LP_RADIO(0x122) /* TEMPSENSE Control 1 */ -#define B2063_TEMPSENSE_CTL2 B43_LP_RADIO(0x123) /* TEMPSENSE Control 2 */ -#define B2063_TX_RX_LOOPBACK1 B43_LP_RADIO(0x124) /* TX/RX LOOPBACK 1 */ -#define B2063_TX_RX_LOOPBACK2 B43_LP_RADIO(0x125) /* TX/RX LOOPBACK 2 */ -#define B2063_EXT_TSSI_CTL1 B43_LP_RADIO(0x126) /* EXT TSSI Control 1 */ -#define B2063_EXT_TSSI_CTL2 B43_LP_RADIO(0x127) /* EXT TSSI Control 2 */ -#define B2063_AFE_CTL B43_LP_RADIO(0x128) /* AFE Control */ - - - -enum b43_lpphy_txpctl_mode { - B43_LPPHY_TXPCTL_UNKNOWN = 0, - B43_LPPHY_TXPCTL_OFF, /* TX power control is OFF */ - B43_LPPHY_TXPCTL_SW, /* TX power control is set to Software */ - B43_LPPHY_TXPCTL_HW, /* TX power control is set to Hardware */ -}; - -struct b43_phy_lp { - /* Current TX power control mode. */ - enum b43_lpphy_txpctl_mode txpctl_mode; - - /* Transmit isolation medium band */ - u8 tx_isolation_med_band; - /* Transmit isolation low band */ - u8 tx_isolation_low_band; - /* Transmit isolation high band */ - u8 tx_isolation_hi_band; - - /* Max transmit power medium band */ - u16 max_tx_pwr_med_band; - /* Max transmit power low band */ - u16 max_tx_pwr_low_band; - /* Max transmit power high band */ - u16 max_tx_pwr_hi_band; - - /* FIXME What are these used for? */ - /* FIXME Is 15 the correct array size? */ - u16 tx_max_rate[15]; - u16 tx_max_ratel[15]; - u16 tx_max_rateh[15]; - - /* Transmit power arrays */ - s16 txpa[3], txpal[3], txpah[3]; - - /* Receive power offset */ - u8 rx_pwr_offset; - - /* TSSI transmit count */ - u16 tssi_tx_count; - /* TSSI index */ - u16 tssi_idx; /* FIXME initial value? */ - /* TSSI npt */ - u16 tssi_npt; /* FIXME initial value? */ - - /* Target TX frequency */ - u16 tgt_tx_freq; /* FIXME initial value? */ - - /* Transmit power index override */ - s8 tx_pwr_idx_over; /* FIXME initial value? */ - - /* RSSI vf */ - u8 rssi_vf; - /* RSSI vc */ - u8 rssi_vc; - /* RSSI gs */ - u8 rssi_gs; - - /* RC cap */ - u8 rc_cap; - /* BX arch */ - u8 bx_arch; - - /* Full calibration channel */ - u8 full_calib_chan; - - /* Transmit iqlocal best coeffs */ - bool tx_iqloc_best_coeffs_valid; - u8 tx_iqloc_best_coeffs[11]; - - /* Used for "Save/Restore Dig Filt State" */ - u16 dig_flt_state[9]; - - bool crs_usr_disable, crs_sys_disable; - - unsigned int pdiv; - - /* The channel we are tuned to */ - u8 channel; - - /* The active antenna diversity mode */ - int antenna; - - /* Frequency of the active TX tone */ - int tx_tone_freq; -}; - -enum tssi_mux_mode { - TSSI_MUX_PREPA, - TSSI_MUX_POSTPA, - TSSI_MUX_EXT, -}; - -struct b43_phy_operations; -extern const struct b43_phy_operations b43_phyops_lp; - -#endif /* LINUX_B43_PHY_LP_H_ */ diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c deleted file mode 100644 index 7c970d3ae358..000000000000 --- a/drivers/net/wireless/b43/phy_n.c +++ /dev/null @@ -1,5565 +0,0 @@ -/* - - Broadcom B43 wireless driver - IEEE 802.11n PHY support - - Copyright (c) 2008 Michael Buesch - Copyright (c) 2010-2011 Rafał Miłecki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include -#include -#include - -#include "b43.h" -#include "phy_n.h" -#include "tables_nphy.h" -#include "radio_2055.h" -#include "radio_2056.h" -#include "radio_2057.h" -#include "main.h" - -struct nphy_txgains { - u16 txgm[2]; - u16 pga[2]; - u16 pad[2]; - u16 ipa[2]; -}; - -struct nphy_iqcal_params { - u16 txgm; - u16 pga; - u16 pad; - u16 ipa; - u16 cal_gain; - u16 ncorr[5]; -}; - -struct nphy_iq_est { - s32 iq0_prod; - u32 i0_pwr; - u32 q0_pwr; - s32 iq1_prod; - u32 i1_pwr; - u32 q1_pwr; -}; - -enum b43_nphy_rf_sequence { - B43_RFSEQ_RX2TX, - B43_RFSEQ_TX2RX, - B43_RFSEQ_RESET2RX, - B43_RFSEQ_UPDATE_GAINH, - B43_RFSEQ_UPDATE_GAINL, - B43_RFSEQ_UPDATE_GAINU, -}; - -enum n_intc_override { - N_INTC_OVERRIDE_OFF = 0, - N_INTC_OVERRIDE_TRSW = 1, - N_INTC_OVERRIDE_PA = 2, - N_INTC_OVERRIDE_EXT_LNA_PU = 3, - N_INTC_OVERRIDE_EXT_LNA_GAIN = 4, -}; - -enum n_rssi_type { - N_RSSI_W1 = 0, - N_RSSI_W2, - N_RSSI_NB, - N_RSSI_IQ, - N_RSSI_TSSI_2G, - N_RSSI_TSSI_5G, - N_RSSI_TBD, -}; - -enum n_rail_type { - N_RAIL_I = 0, - N_RAIL_Q = 1, -}; - -static inline bool b43_nphy_ipa(struct b43_wldev *dev) -{ - enum ieee80211_band band = b43_current_band(dev->wl); - return ((dev->phy.n->ipa2g_on && band == IEEE80211_BAND_2GHZ) || - (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ)); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCoreGetState */ -static u8 b43_nphy_get_rx_core_state(struct b43_wldev *dev) -{ - return (b43_phy_read(dev, B43_NPHY_RFSEQCA) & B43_NPHY_RFSEQCA_RXEN) >> - B43_NPHY_RFSEQCA_RXEN_SHIFT; -} - -/************************************************** - * RF (just without b43_nphy_rf_ctl_intc_override) - **************************************************/ - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ForceRFSeq */ -static void b43_nphy_force_rf_sequence(struct b43_wldev *dev, - enum b43_nphy_rf_sequence seq) -{ - static const u16 trigger[] = { - [B43_RFSEQ_RX2TX] = B43_NPHY_RFSEQTR_RX2TX, - [B43_RFSEQ_TX2RX] = B43_NPHY_RFSEQTR_TX2RX, - [B43_RFSEQ_RESET2RX] = B43_NPHY_RFSEQTR_RST2RX, - [B43_RFSEQ_UPDATE_GAINH] = B43_NPHY_RFSEQTR_UPGH, - [B43_RFSEQ_UPDATE_GAINL] = B43_NPHY_RFSEQTR_UPGL, - [B43_RFSEQ_UPDATE_GAINU] = B43_NPHY_RFSEQTR_UPGU, - }; - int i; - u16 seq_mode = b43_phy_read(dev, B43_NPHY_RFSEQMODE); - - B43_WARN_ON(seq >= ARRAY_SIZE(trigger)); - - b43_phy_set(dev, B43_NPHY_RFSEQMODE, - B43_NPHY_RFSEQMODE_CAOVER | B43_NPHY_RFSEQMODE_TROVER); - b43_phy_set(dev, B43_NPHY_RFSEQTR, trigger[seq]); - for (i = 0; i < 200; i++) { - if (!(b43_phy_read(dev, B43_NPHY_RFSEQST) & trigger[seq])) - goto ok; - msleep(1); - } - b43err(dev->wl, "RF sequence status timeout\n"); -ok: - b43_phy_write(dev, B43_NPHY_RFSEQMODE, seq_mode); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlOverrideRev7 */ -static void b43_nphy_rf_ctl_override_rev7(struct b43_wldev *dev, u16 field, - u16 value, u8 core, bool off, - u8 override) -{ - const struct nphy_rf_control_override_rev7 *e; - u16 en_addrs[3][2] = { - { 0x0E7, 0x0EC }, { 0x342, 0x343 }, { 0x346, 0x347 } - }; - u16 en_addr; - u16 en_mask = field; - u16 val_addr; - u8 i; - - /* Remember: we can get NULL! */ - e = b43_nphy_get_rf_ctl_over_rev7(dev, field, override); - - for (i = 0; i < 2; i++) { - if (override >= ARRAY_SIZE(en_addrs)) { - b43err(dev->wl, "Invalid override value %d\n", override); - return; - } - en_addr = en_addrs[override][i]; - - val_addr = (i == 0) ? e->val_addr_core0 : e->val_addr_core1; - - if (off) { - b43_phy_mask(dev, en_addr, ~en_mask); - if (e) /* Do it safer, better than wl */ - b43_phy_mask(dev, val_addr, ~e->val_mask); - } else { - if (!core || (core & (1 << i))) { - b43_phy_set(dev, en_addr, en_mask); - if (e) - b43_phy_maskset(dev, val_addr, ~e->val_mask, (value << e->val_shift)); - } - } - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlOverride */ -static void b43_nphy_rf_ctl_override(struct b43_wldev *dev, u16 field, - u16 value, u8 core, bool off) -{ - int i; - u8 index = fls(field); - u8 addr, en_addr, val_addr; - /* we expect only one bit set */ - B43_WARN_ON(field & (~(1 << (index - 1)))); - - if (dev->phy.rev >= 3) { - const struct nphy_rf_control_override_rev3 *rf_ctrl; - for (i = 0; i < 2; i++) { - if (index == 0 || index == 16) { - b43err(dev->wl, - "Unsupported RF Ctrl Override call\n"); - return; - } - - rf_ctrl = &tbl_rf_control_override_rev3[index - 1]; - en_addr = B43_PHY_N((i == 0) ? - rf_ctrl->en_addr0 : rf_ctrl->en_addr1); - val_addr = B43_PHY_N((i == 0) ? - rf_ctrl->val_addr0 : rf_ctrl->val_addr1); - - if (off) { - b43_phy_mask(dev, en_addr, ~(field)); - b43_phy_mask(dev, val_addr, - ~(rf_ctrl->val_mask)); - } else { - if (core == 0 || ((1 << i) & core)) { - b43_phy_set(dev, en_addr, field); - b43_phy_maskset(dev, val_addr, - ~(rf_ctrl->val_mask), - (value << rf_ctrl->val_shift)); - } - } - } - } else { - const struct nphy_rf_control_override_rev2 *rf_ctrl; - if (off) { - b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, ~(field)); - value = 0; - } else { - b43_phy_set(dev, B43_NPHY_RFCTL_OVER, field); - } - - for (i = 0; i < 2; i++) { - if (index <= 1 || index == 16) { - b43err(dev->wl, - "Unsupported RF Ctrl Override call\n"); - return; - } - - if (index == 2 || index == 10 || - (index >= 13 && index <= 15)) { - core = 1; - } - - rf_ctrl = &tbl_rf_control_override_rev2[index - 2]; - addr = B43_PHY_N((i == 0) ? - rf_ctrl->addr0 : rf_ctrl->addr1); - - if ((1 << i) & core) - b43_phy_maskset(dev, addr, ~(rf_ctrl->bmask), - (value << rf_ctrl->shift)); - - b43_phy_set(dev, B43_NPHY_RFCTL_OVER, 0x1); - b43_phy_set(dev, B43_NPHY_RFCTL_CMD, - B43_NPHY_RFCTL_CMD_START); - udelay(1); - b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, 0xFFFE); - } - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlIntcOverride */ -static void b43_nphy_rf_ctl_intc_override(struct b43_wldev *dev, - enum n_intc_override intc_override, - u16 value, u8 core) -{ - u8 i, j; - u16 reg, tmp, val; - - B43_WARN_ON(dev->phy.rev < 3); - - for (i = 0; i < 2; i++) { - if ((core == 1 && i == 1) || (core == 2 && !i)) - continue; - - reg = (i == 0) ? - B43_NPHY_RFCTL_INTC1 : B43_NPHY_RFCTL_INTC2; - b43_phy_set(dev, reg, 0x400); - - switch (intc_override) { - case N_INTC_OVERRIDE_OFF: - b43_phy_write(dev, reg, 0); - b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX); - break; - case N_INTC_OVERRIDE_TRSW: - if (!i) { - b43_phy_maskset(dev, B43_NPHY_RFCTL_INTC1, - 0xFC3F, (value << 6)); - b43_phy_maskset(dev, B43_NPHY_TXF_40CO_B1S1, - 0xFFFE, 1); - b43_phy_set(dev, B43_NPHY_RFCTL_CMD, - B43_NPHY_RFCTL_CMD_START); - for (j = 0; j < 100; j++) { - if (!(b43_phy_read(dev, B43_NPHY_RFCTL_CMD) & B43_NPHY_RFCTL_CMD_START)) { - j = 0; - break; - } - udelay(10); - } - if (j) - b43err(dev->wl, - "intc override timeout\n"); - b43_phy_mask(dev, B43_NPHY_TXF_40CO_B1S1, - 0xFFFE); - } else { - b43_phy_maskset(dev, B43_NPHY_RFCTL_INTC2, - 0xFC3F, (value << 6)); - b43_phy_maskset(dev, B43_NPHY_RFCTL_OVER, - 0xFFFE, 1); - b43_phy_set(dev, B43_NPHY_RFCTL_CMD, - B43_NPHY_RFCTL_CMD_RXTX); - for (j = 0; j < 100; j++) { - if (!(b43_phy_read(dev, B43_NPHY_RFCTL_CMD) & B43_NPHY_RFCTL_CMD_RXTX)) { - j = 0; - break; - } - udelay(10); - } - if (j) - b43err(dev->wl, - "intc override timeout\n"); - b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, - 0xFFFE); - } - break; - case N_INTC_OVERRIDE_PA: - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { - tmp = 0x0020; - val = value << 5; - } else { - tmp = 0x0010; - val = value << 4; - } - b43_phy_maskset(dev, reg, ~tmp, val); - break; - case N_INTC_OVERRIDE_EXT_LNA_PU: - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { - tmp = 0x0001; - val = value; - } else { - tmp = 0x0004; - val = value << 2; - } - b43_phy_maskset(dev, reg, ~tmp, val); - break; - case N_INTC_OVERRIDE_EXT_LNA_GAIN: - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { - tmp = 0x0002; - val = value << 1; - } else { - tmp = 0x0008; - val = value << 3; - } - b43_phy_maskset(dev, reg, ~tmp, val); - break; - } - } -} - -/************************************************** - * Various PHY ops - **************************************************/ - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/clip-detection */ -static void b43_nphy_write_clip_detection(struct b43_wldev *dev, - const u16 *clip_st) -{ - b43_phy_write(dev, B43_NPHY_C1_CLIP1THRES, clip_st[0]); - b43_phy_write(dev, B43_NPHY_C2_CLIP1THRES, clip_st[1]); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/clip-detection */ -static void b43_nphy_read_clip_detection(struct b43_wldev *dev, u16 *clip_st) -{ - clip_st[0] = b43_phy_read(dev, B43_NPHY_C1_CLIP1THRES); - clip_st[1] = b43_phy_read(dev, B43_NPHY_C2_CLIP1THRES); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/classifier */ -static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val) -{ - u16 tmp; - - if (dev->dev->core_rev == 16) - b43_mac_suspend(dev); - - tmp = b43_phy_read(dev, B43_NPHY_CLASSCTL); - tmp &= (B43_NPHY_CLASSCTL_CCKEN | B43_NPHY_CLASSCTL_OFDMEN | - B43_NPHY_CLASSCTL_WAITEDEN); - tmp &= ~mask; - tmp |= (val & mask); - b43_phy_maskset(dev, B43_NPHY_CLASSCTL, 0xFFF8, tmp); - - if (dev->dev->core_rev == 16) - b43_mac_enable(dev); - - return tmp; -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CCA */ -static void b43_nphy_reset_cca(struct b43_wldev *dev) -{ - u16 bbcfg; - - b43_phy_force_clock(dev, 1); - bbcfg = b43_phy_read(dev, B43_NPHY_BBCFG); - b43_phy_write(dev, B43_NPHY_BBCFG, bbcfg | B43_NPHY_BBCFG_RSTCCA); - udelay(1); - b43_phy_write(dev, B43_NPHY_BBCFG, bbcfg & ~B43_NPHY_BBCFG_RSTCCA); - b43_phy_force_clock(dev, 0); - b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/carriersearch */ -static void b43_nphy_stay_in_carrier_search(struct b43_wldev *dev, bool enable) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_n *nphy = phy->n; - - if (enable) { - static const u16 clip[] = { 0xFFFF, 0xFFFF }; - if (nphy->deaf_count++ == 0) { - nphy->classifier_state = b43_nphy_classifier(dev, 0, 0); - b43_nphy_classifier(dev, 0x7, 0); - b43_nphy_read_clip_detection(dev, nphy->clip_state); - b43_nphy_write_clip_detection(dev, clip); - } - b43_nphy_reset_cca(dev); - } else { - if (--nphy->deaf_count == 0) { - b43_nphy_classifier(dev, 0x7, nphy->classifier_state); - b43_nphy_write_clip_detection(dev, nphy->clip_state); - } - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/AdjustLnaGainTbl */ -static void b43_nphy_adjust_lna_gain_table(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - - u8 i; - s16 tmp; - u16 data[4]; - s16 gain[2]; - u16 minmax[2]; - static const u16 lna_gain[4] = { -2, 10, 19, 25 }; - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 1); - - if (nphy->gain_boost) { - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - gain[0] = 6; - gain[1] = 6; - } else { - tmp = 40370 - 315 * dev->phy.channel; - gain[0] = ((tmp >> 13) + ((tmp >> 12) & 1)); - tmp = 23242 - 224 * dev->phy.channel; - gain[1] = ((tmp >> 13) + ((tmp >> 12) & 1)); - } - } else { - gain[0] = 0; - gain[1] = 0; - } - - for (i = 0; i < 2; i++) { - if (nphy->elna_gain_config) { - data[0] = 19 + gain[i]; - data[1] = 25 + gain[i]; - data[2] = 25 + gain[i]; - data[3] = 25 + gain[i]; - } else { - data[0] = lna_gain[0] + gain[i]; - data[1] = lna_gain[1] + gain[i]; - data[2] = lna_gain[2] + gain[i]; - data[3] = lna_gain[3] + gain[i]; - } - b43_ntab_write_bulk(dev, B43_NTAB16(i, 8), 4, data); - - minmax[i] = 23 + gain[i]; - } - - b43_phy_maskset(dev, B43_NPHY_C1_MINMAX_GAIN, ~B43_NPHY_C1_MINGAIN, - minmax[0] << B43_NPHY_C1_MINGAIN_SHIFT); - b43_phy_maskset(dev, B43_NPHY_C2_MINMAX_GAIN, ~B43_NPHY_C2_MINGAIN, - minmax[1] << B43_NPHY_C2_MINGAIN_SHIFT); - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 0); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetRfSeq */ -static void b43_nphy_set_rf_sequence(struct b43_wldev *dev, u8 cmd, - u8 *events, u8 *delays, u8 length) -{ - struct b43_phy_n *nphy = dev->phy.n; - u8 i; - u8 end = (dev->phy.rev >= 3) ? 0x1F : 0x0F; - u16 offset1 = cmd << 4; - u16 offset2 = offset1 + 0x80; - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, true); - - b43_ntab_write_bulk(dev, B43_NTAB8(7, offset1), length, events); - b43_ntab_write_bulk(dev, B43_NTAB8(7, offset2), length, delays); - - for (i = length; i < 16; i++) { - b43_ntab_write(dev, B43_NTAB8(7, offset1 + i), end); - b43_ntab_write(dev, B43_NTAB8(7, offset2 + i), 1); - } - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, false); -} - -/************************************************** - * Radio 0x2057 - **************************************************/ - -/* http://bcm-v4.sipsolutions.net/PHY/radio2057_rcal */ -static u8 b43_radio_2057_rcal(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - u16 tmp; - - if (phy->radio_rev == 5) { - b43_phy_mask(dev, 0x342, ~0x2); - udelay(10); - b43_radio_set(dev, R2057_IQTEST_SEL_PU, 0x1); - b43_radio_maskset(dev, 0x1ca, ~0x2, 0x1); - } - - b43_radio_set(dev, R2057_RCAL_CONFIG, 0x1); - udelay(10); - b43_radio_set(dev, R2057_RCAL_CONFIG, 0x3); - if (!b43_radio_wait_value(dev, R2057_RCCAL_N1_1, 1, 1, 100, 1000000)) { - b43err(dev->wl, "Radio 0x2057 rcal timeout\n"); - return 0; - } - b43_radio_mask(dev, R2057_RCAL_CONFIG, ~0x2); - tmp = b43_radio_read(dev, R2057_RCAL_STATUS) & 0x3E; - b43_radio_mask(dev, R2057_RCAL_CONFIG, ~0x1); - - if (phy->radio_rev == 5) { - b43_radio_mask(dev, R2057_IPA2G_CASCONV_CORE0, ~0x1); - b43_radio_mask(dev, 0x1ca, ~0x2); - } - if (phy->radio_rev <= 4 || phy->radio_rev == 6) { - b43_radio_maskset(dev, R2057_TEMPSENSE_CONFIG, ~0x3C, tmp); - b43_radio_maskset(dev, R2057_BANDGAP_RCAL_TRIM, ~0xF0, - tmp << 2); - } - - return tmp & 0x3e; -} - -/* http://bcm-v4.sipsolutions.net/PHY/radio2057_rccal */ -static u16 b43_radio_2057_rccal(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - bool special = (phy->radio_rev == 3 || phy->radio_rev == 4 || - phy->radio_rev == 6); - u16 tmp; - - if (special) { - b43_radio_write(dev, R2057_RCCAL_MASTER, 0x61); - b43_radio_write(dev, R2057_RCCAL_TRC0, 0xC0); - } else { - b43_radio_write(dev, 0x1AE, 0x61); - b43_radio_write(dev, R2057_RCCAL_TRC0, 0xE1); - } - b43_radio_write(dev, R2057_RCCAL_X1, 0x6E); - b43_radio_write(dev, R2057_RCCAL_START_R1_Q1_P1, 0x55); - if (!b43_radio_wait_value(dev, R2057_RCCAL_DONE_OSCCAP, 1, 1, 500, - 5000000)) - b43dbg(dev->wl, "Radio 0x2057 rccal timeout\n"); - b43_radio_write(dev, R2057_RCCAL_START_R1_Q1_P1, 0x15); - if (special) { - b43_radio_write(dev, R2057_RCCAL_MASTER, 0x69); - b43_radio_write(dev, R2057_RCCAL_TRC0, 0xB0); - } else { - b43_radio_write(dev, 0x1AE, 0x69); - b43_radio_write(dev, R2057_RCCAL_TRC0, 0xD5); - } - b43_radio_write(dev, R2057_RCCAL_X1, 0x6E); - b43_radio_write(dev, R2057_RCCAL_START_R1_Q1_P1, 0x55); - if (!b43_radio_wait_value(dev, R2057_RCCAL_DONE_OSCCAP, 1, 1, 500, - 5000000)) - b43dbg(dev->wl, "Radio 0x2057 rccal timeout\n"); - b43_radio_write(dev, R2057_RCCAL_START_R1_Q1_P1, 0x15); - if (special) { - b43_radio_write(dev, R2057_RCCAL_MASTER, 0x73); - b43_radio_write(dev, R2057_RCCAL_X1, 0x28); - b43_radio_write(dev, R2057_RCCAL_TRC0, 0xB0); - } else { - b43_radio_write(dev, 0x1AE, 0x73); - b43_radio_write(dev, R2057_RCCAL_X1, 0x6E); - b43_radio_write(dev, R2057_RCCAL_TRC0, 0x99); - } - b43_radio_write(dev, R2057_RCCAL_START_R1_Q1_P1, 0x55); - if (!b43_radio_wait_value(dev, R2057_RCCAL_DONE_OSCCAP, 1, 1, 500, - 5000000)) { - b43err(dev->wl, "Radio 0x2057 rcal timeout\n"); - return 0; - } - tmp = b43_radio_read(dev, R2057_RCCAL_DONE_OSCCAP); - b43_radio_write(dev, R2057_RCCAL_START_R1_Q1_P1, 0x15); - return tmp; -} - -static void b43_radio_2057_init_pre(struct b43_wldev *dev) -{ - b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, ~B43_NPHY_RFCTL_CMD_CHIP0PU); - /* Maybe wl meant to reset and set (order?) RFCTL_CMD_OEPORFORCE? */ - b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, B43_NPHY_RFCTL_CMD_OEPORFORCE); - b43_phy_set(dev, B43_NPHY_RFCTL_CMD, ~B43_NPHY_RFCTL_CMD_OEPORFORCE); - b43_phy_set(dev, B43_NPHY_RFCTL_CMD, B43_NPHY_RFCTL_CMD_CHIP0PU); -} - -static void b43_radio_2057_init_post(struct b43_wldev *dev) -{ - b43_radio_set(dev, R2057_XTALPUOVR_PINCTRL, 0x1); - - b43_radio_set(dev, R2057_RFPLL_MISC_CAL_RESETN, 0x78); - b43_radio_set(dev, R2057_XTAL_CONFIG2, 0x80); - mdelay(2); - b43_radio_mask(dev, R2057_RFPLL_MISC_CAL_RESETN, ~0x78); - b43_radio_mask(dev, R2057_XTAL_CONFIG2, ~0x80); - - if (dev->phy.n->init_por) { - b43_radio_2057_rcal(dev); - b43_radio_2057_rccal(dev); - } - b43_radio_mask(dev, R2057_RFPLL_MASTER, ~0x8); - - dev->phy.n->init_por = false; -} - -/* http://bcm-v4.sipsolutions.net/802.11/Radio/2057/Init */ -static void b43_radio_2057_init(struct b43_wldev *dev) -{ - b43_radio_2057_init_pre(dev); - r2057_upload_inittabs(dev); - b43_radio_2057_init_post(dev); -} - -/************************************************** - * Radio 0x2056 - **************************************************/ - -static void b43_chantab_radio_2056_upload(struct b43_wldev *dev, - const struct b43_nphy_channeltab_entry_rev3 *e) -{ - b43_radio_write(dev, B2056_SYN_PLL_VCOCAL1, e->radio_syn_pll_vcocal1); - b43_radio_write(dev, B2056_SYN_PLL_VCOCAL2, e->radio_syn_pll_vcocal2); - b43_radio_write(dev, B2056_SYN_PLL_REFDIV, e->radio_syn_pll_refdiv); - b43_radio_write(dev, B2056_SYN_PLL_MMD2, e->radio_syn_pll_mmd2); - b43_radio_write(dev, B2056_SYN_PLL_MMD1, e->radio_syn_pll_mmd1); - b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, - e->radio_syn_pll_loopfilter1); - b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER2, - e->radio_syn_pll_loopfilter2); - b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER3, - e->radio_syn_pll_loopfilter3); - b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER4, - e->radio_syn_pll_loopfilter4); - b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER5, - e->radio_syn_pll_loopfilter5); - b43_radio_write(dev, B2056_SYN_RESERVED_ADDR27, - e->radio_syn_reserved_addr27); - b43_radio_write(dev, B2056_SYN_RESERVED_ADDR28, - e->radio_syn_reserved_addr28); - b43_radio_write(dev, B2056_SYN_RESERVED_ADDR29, - e->radio_syn_reserved_addr29); - b43_radio_write(dev, B2056_SYN_LOGEN_VCOBUF1, - e->radio_syn_logen_vcobuf1); - b43_radio_write(dev, B2056_SYN_LOGEN_MIXER2, e->radio_syn_logen_mixer2); - b43_radio_write(dev, B2056_SYN_LOGEN_BUF3, e->radio_syn_logen_buf3); - b43_radio_write(dev, B2056_SYN_LOGEN_BUF4, e->radio_syn_logen_buf4); - - b43_radio_write(dev, B2056_RX0 | B2056_RX_LNAA_TUNE, - e->radio_rx0_lnaa_tune); - b43_radio_write(dev, B2056_RX0 | B2056_RX_LNAG_TUNE, - e->radio_rx0_lnag_tune); - - b43_radio_write(dev, B2056_TX0 | B2056_TX_INTPAA_BOOST_TUNE, - e->radio_tx0_intpaa_boost_tune); - b43_radio_write(dev, B2056_TX0 | B2056_TX_INTPAG_BOOST_TUNE, - e->radio_tx0_intpag_boost_tune); - b43_radio_write(dev, B2056_TX0 | B2056_TX_PADA_BOOST_TUNE, - e->radio_tx0_pada_boost_tune); - b43_radio_write(dev, B2056_TX0 | B2056_TX_PADG_BOOST_TUNE, - e->radio_tx0_padg_boost_tune); - b43_radio_write(dev, B2056_TX0 | B2056_TX_PGAA_BOOST_TUNE, - e->radio_tx0_pgaa_boost_tune); - b43_radio_write(dev, B2056_TX0 | B2056_TX_PGAG_BOOST_TUNE, - e->radio_tx0_pgag_boost_tune); - b43_radio_write(dev, B2056_TX0 | B2056_TX_MIXA_BOOST_TUNE, - e->radio_tx0_mixa_boost_tune); - b43_radio_write(dev, B2056_TX0 | B2056_TX_MIXG_BOOST_TUNE, - e->radio_tx0_mixg_boost_tune); - - b43_radio_write(dev, B2056_RX1 | B2056_RX_LNAA_TUNE, - e->radio_rx1_lnaa_tune); - b43_radio_write(dev, B2056_RX1 | B2056_RX_LNAG_TUNE, - e->radio_rx1_lnag_tune); - - b43_radio_write(dev, B2056_TX1 | B2056_TX_INTPAA_BOOST_TUNE, - e->radio_tx1_intpaa_boost_tune); - b43_radio_write(dev, B2056_TX1 | B2056_TX_INTPAG_BOOST_TUNE, - e->radio_tx1_intpag_boost_tune); - b43_radio_write(dev, B2056_TX1 | B2056_TX_PADA_BOOST_TUNE, - e->radio_tx1_pada_boost_tune); - b43_radio_write(dev, B2056_TX1 | B2056_TX_PADG_BOOST_TUNE, - e->radio_tx1_padg_boost_tune); - b43_radio_write(dev, B2056_TX1 | B2056_TX_PGAA_BOOST_TUNE, - e->radio_tx1_pgaa_boost_tune); - b43_radio_write(dev, B2056_TX1 | B2056_TX_PGAG_BOOST_TUNE, - e->radio_tx1_pgag_boost_tune); - b43_radio_write(dev, B2056_TX1 | B2056_TX_MIXA_BOOST_TUNE, - e->radio_tx1_mixa_boost_tune); - b43_radio_write(dev, B2056_TX1 | B2056_TX_MIXG_BOOST_TUNE, - e->radio_tx1_mixg_boost_tune); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2056Setup */ -static void b43_radio_2056_setup(struct b43_wldev *dev, - const struct b43_nphy_channeltab_entry_rev3 *e) -{ - struct ssb_sprom *sprom = dev->dev->bus_sprom; - enum ieee80211_band band = b43_current_band(dev->wl); - u16 offset; - u8 i; - u16 bias, cbias; - u16 pag_boost, padg_boost, pgag_boost, mixg_boost; - u16 paa_boost, pada_boost, pgaa_boost, mixa_boost; - - B43_WARN_ON(dev->phy.rev < 3); - - b43_chantab_radio_2056_upload(dev, e); - b2056_upload_syn_pll_cp2(dev, band == IEEE80211_BAND_5GHZ); - - if (sprom->boardflags2_lo & B43_BFL2_GPLL_WAR && - b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1F); - b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER2, 0x1F); - if (dev->dev->chip_id == 0x4716) { - b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER4, 0x14); - b43_radio_write(dev, B2056_SYN_PLL_CP2, 0); - } else { - b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER4, 0x0B); - b43_radio_write(dev, B2056_SYN_PLL_CP2, 0x14); - } - } - if (sprom->boardflags2_lo & B43_BFL2_APLL_WAR && - b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { - b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1, 0x1F); - b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER2, 0x1F); - b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER4, 0x05); - b43_radio_write(dev, B2056_SYN_PLL_CP2, 0x0C); - } - - if (dev->phy.n->ipa2g_on && band == IEEE80211_BAND_2GHZ) { - for (i = 0; i < 2; i++) { - offset = i ? B2056_TX1 : B2056_TX0; - if (dev->phy.rev >= 5) { - b43_radio_write(dev, - offset | B2056_TX_PADG_IDAC, 0xcc); - - if (dev->dev->chip_id == 0x4716) { - bias = 0x40; - cbias = 0x45; - pag_boost = 0x5; - pgag_boost = 0x33; - mixg_boost = 0x55; - } else { - bias = 0x25; - cbias = 0x20; - pag_boost = 0x4; - pgag_boost = 0x03; - mixg_boost = 0x65; - } - padg_boost = 0x77; - - b43_radio_write(dev, - offset | B2056_TX_INTPAG_IMAIN_STAT, - bias); - b43_radio_write(dev, - offset | B2056_TX_INTPAG_IAUX_STAT, - bias); - b43_radio_write(dev, - offset | B2056_TX_INTPAG_CASCBIAS, - cbias); - b43_radio_write(dev, - offset | B2056_TX_INTPAG_BOOST_TUNE, - pag_boost); - b43_radio_write(dev, - offset | B2056_TX_PGAG_BOOST_TUNE, - pgag_boost); - b43_radio_write(dev, - offset | B2056_TX_PADG_BOOST_TUNE, - padg_boost); - b43_radio_write(dev, - offset | B2056_TX_MIXG_BOOST_TUNE, - mixg_boost); - } else { - bias = dev->phy.is_40mhz ? 0x40 : 0x20; - b43_radio_write(dev, - offset | B2056_TX_INTPAG_IMAIN_STAT, - bias); - b43_radio_write(dev, - offset | B2056_TX_INTPAG_IAUX_STAT, - bias); - b43_radio_write(dev, - offset | B2056_TX_INTPAG_CASCBIAS, - 0x30); - } - b43_radio_write(dev, offset | B2056_TX_PA_SPARE1, 0xee); - } - } else if (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ) { - u16 freq = dev->phy.channel_freq; - if (freq < 5100) { - paa_boost = 0xA; - pada_boost = 0x77; - pgaa_boost = 0xF; - mixa_boost = 0xF; - } else if (freq < 5340) { - paa_boost = 0x8; - pada_boost = 0x77; - pgaa_boost = 0xFB; - mixa_boost = 0xF; - } else if (freq < 5650) { - paa_boost = 0x0; - pada_boost = 0x77; - pgaa_boost = 0xB; - mixa_boost = 0xF; - } else { - paa_boost = 0x0; - pada_boost = 0x77; - if (freq != 5825) - pgaa_boost = -(freq - 18) / 36 + 168; - else - pgaa_boost = 6; - mixa_boost = 0xF; - } - - for (i = 0; i < 2; i++) { - offset = i ? B2056_TX1 : B2056_TX0; - - b43_radio_write(dev, - offset | B2056_TX_INTPAA_BOOST_TUNE, paa_boost); - b43_radio_write(dev, - offset | B2056_TX_PADA_BOOST_TUNE, pada_boost); - b43_radio_write(dev, - offset | B2056_TX_PGAA_BOOST_TUNE, pgaa_boost); - b43_radio_write(dev, - offset | B2056_TX_MIXA_BOOST_TUNE, mixa_boost); - b43_radio_write(dev, - offset | B2056_TX_TXSPARE1, 0x30); - b43_radio_write(dev, - offset | B2056_TX_PA_SPARE2, 0xee); - b43_radio_write(dev, - offset | B2056_TX_PADA_CASCBIAS, 0x03); - b43_radio_write(dev, - offset | B2056_TX_INTPAA_IAUX_STAT, 0x50); - b43_radio_write(dev, - offset | B2056_TX_INTPAA_IMAIN_STAT, 0x50); - b43_radio_write(dev, - offset | B2056_TX_INTPAA_CASCBIAS, 0x30); - } - } - - udelay(50); - /* VCO calibration */ - b43_radio_write(dev, B2056_SYN_PLL_VCOCAL12, 0x00); - b43_radio_write(dev, B2056_TX_INTPAA_PA_MISC, 0x38); - b43_radio_write(dev, B2056_TX_INTPAA_PA_MISC, 0x18); - b43_radio_write(dev, B2056_TX_INTPAA_PA_MISC, 0x38); - b43_radio_write(dev, B2056_TX_INTPAA_PA_MISC, 0x39); - udelay(300); -} - -static u8 b43_radio_2056_rcal(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - u16 mast2, tmp; - - if (phy->rev != 3) - return 0; - - mast2 = b43_radio_read(dev, B2056_SYN_PLL_MAST2); - b43_radio_write(dev, B2056_SYN_PLL_MAST2, mast2 | 0x7); - - udelay(10); - b43_radio_write(dev, B2056_SYN_RCAL_MASTER, 0x01); - udelay(10); - b43_radio_write(dev, B2056_SYN_RCAL_MASTER, 0x09); - - if (!b43_radio_wait_value(dev, B2056_SYN_RCAL_CODE_OUT, 0x80, 0x80, 100, - 1000000)) { - b43err(dev->wl, "Radio recalibration timeout\n"); - return 0; - } - - b43_radio_write(dev, B2056_SYN_RCAL_MASTER, 0x01); - tmp = b43_radio_read(dev, B2056_SYN_RCAL_CODE_OUT); - b43_radio_write(dev, B2056_SYN_RCAL_MASTER, 0x00); - - b43_radio_write(dev, B2056_SYN_PLL_MAST2, mast2); - - return tmp & 0x1f; -} - -static void b43_radio_init2056_pre(struct b43_wldev *dev) -{ - b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, - ~B43_NPHY_RFCTL_CMD_CHIP0PU); - /* Maybe wl meant to reset and set (order?) RFCTL_CMD_OEPORFORCE? */ - b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, - B43_NPHY_RFCTL_CMD_OEPORFORCE); - b43_phy_set(dev, B43_NPHY_RFCTL_CMD, - ~B43_NPHY_RFCTL_CMD_OEPORFORCE); - b43_phy_set(dev, B43_NPHY_RFCTL_CMD, - B43_NPHY_RFCTL_CMD_CHIP0PU); -} - -static void b43_radio_init2056_post(struct b43_wldev *dev) -{ - b43_radio_set(dev, B2056_SYN_COM_CTRL, 0xB); - b43_radio_set(dev, B2056_SYN_COM_PU, 0x2); - b43_radio_set(dev, B2056_SYN_COM_RESET, 0x2); - msleep(1); - b43_radio_mask(dev, B2056_SYN_COM_RESET, ~0x2); - b43_radio_mask(dev, B2056_SYN_PLL_MAST2, ~0xFC); - b43_radio_mask(dev, B2056_SYN_RCCAL_CTRL0, ~0x1); - if (dev->phy.n->init_por) - b43_radio_2056_rcal(dev); -} - -/* - * Initialize a Broadcom 2056 N-radio - * http://bcm-v4.sipsolutions.net/802.11/Radio/2056/Init - */ -static void b43_radio_init2056(struct b43_wldev *dev) -{ - b43_radio_init2056_pre(dev); - b2056_upload_inittabs(dev, 0, 0); - b43_radio_init2056_post(dev); - - dev->phy.n->init_por = false; -} - -/************************************************** - * Radio 0x2055 - **************************************************/ - -static void b43_chantab_radio_upload(struct b43_wldev *dev, - const struct b43_nphy_channeltab_entry_rev2 *e) -{ - b43_radio_write(dev, B2055_PLL_REF, e->radio_pll_ref); - b43_radio_write(dev, B2055_RF_PLLMOD0, e->radio_rf_pllmod0); - b43_radio_write(dev, B2055_RF_PLLMOD1, e->radio_rf_pllmod1); - b43_radio_write(dev, B2055_VCO_CAPTAIL, e->radio_vco_captail); - b43_read32(dev, B43_MMIO_MACCTL); /* flush writes */ - - b43_radio_write(dev, B2055_VCO_CAL1, e->radio_vco_cal1); - b43_radio_write(dev, B2055_VCO_CAL2, e->radio_vco_cal2); - b43_radio_write(dev, B2055_PLL_LFC1, e->radio_pll_lfc1); - b43_radio_write(dev, B2055_PLL_LFR1, e->radio_pll_lfr1); - b43_read32(dev, B43_MMIO_MACCTL); /* flush writes */ - - b43_radio_write(dev, B2055_PLL_LFC2, e->radio_pll_lfc2); - b43_radio_write(dev, B2055_LGBUF_CENBUF, e->radio_lgbuf_cenbuf); - b43_radio_write(dev, B2055_LGEN_TUNE1, e->radio_lgen_tune1); - b43_radio_write(dev, B2055_LGEN_TUNE2, e->radio_lgen_tune2); - b43_read32(dev, B43_MMIO_MACCTL); /* flush writes */ - - b43_radio_write(dev, B2055_C1_LGBUF_ATUNE, e->radio_c1_lgbuf_atune); - b43_radio_write(dev, B2055_C1_LGBUF_GTUNE, e->radio_c1_lgbuf_gtune); - b43_radio_write(dev, B2055_C1_RX_RFR1, e->radio_c1_rx_rfr1); - b43_radio_write(dev, B2055_C1_TX_PGAPADTN, e->radio_c1_tx_pgapadtn); - b43_read32(dev, B43_MMIO_MACCTL); /* flush writes */ - - b43_radio_write(dev, B2055_C1_TX_MXBGTRIM, e->radio_c1_tx_mxbgtrim); - b43_radio_write(dev, B2055_C2_LGBUF_ATUNE, e->radio_c2_lgbuf_atune); - b43_radio_write(dev, B2055_C2_LGBUF_GTUNE, e->radio_c2_lgbuf_gtune); - b43_radio_write(dev, B2055_C2_RX_RFR1, e->radio_c2_rx_rfr1); - b43_read32(dev, B43_MMIO_MACCTL); /* flush writes */ - - b43_radio_write(dev, B2055_C2_TX_PGAPADTN, e->radio_c2_tx_pgapadtn); - b43_radio_write(dev, B2055_C2_TX_MXBGTRIM, e->radio_c2_tx_mxbgtrim); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2055Setup */ -static void b43_radio_2055_setup(struct b43_wldev *dev, - const struct b43_nphy_channeltab_entry_rev2 *e) -{ - B43_WARN_ON(dev->phy.rev >= 3); - - b43_chantab_radio_upload(dev, e); - udelay(50); - b43_radio_write(dev, B2055_VCO_CAL10, 0x05); - b43_radio_write(dev, B2055_VCO_CAL10, 0x45); - b43_read32(dev, B43_MMIO_MACCTL); /* flush writes */ - b43_radio_write(dev, B2055_VCO_CAL10, 0x65); - udelay(300); -} - -static void b43_radio_init2055_pre(struct b43_wldev *dev) -{ - b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, - ~B43_NPHY_RFCTL_CMD_PORFORCE); - b43_phy_set(dev, B43_NPHY_RFCTL_CMD, - B43_NPHY_RFCTL_CMD_CHIP0PU | - B43_NPHY_RFCTL_CMD_OEPORFORCE); - b43_phy_set(dev, B43_NPHY_RFCTL_CMD, - B43_NPHY_RFCTL_CMD_PORFORCE); -} - -static void b43_radio_init2055_post(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - struct ssb_sprom *sprom = dev->dev->bus_sprom; - bool workaround = false; - - if (sprom->revision < 4) - workaround = (dev->dev->board_vendor != PCI_VENDOR_ID_BROADCOM - && dev->dev->board_type == SSB_BOARD_CB2_4321 - && dev->dev->board_rev >= 0x41); - else - workaround = - !(sprom->boardflags2_lo & B43_BFL2_RXBB_INT_REG_DIS); - - b43_radio_mask(dev, B2055_MASTER1, 0xFFF3); - if (workaround) { - b43_radio_mask(dev, B2055_C1_RX_BB_REG, 0x7F); - b43_radio_mask(dev, B2055_C2_RX_BB_REG, 0x7F); - } - b43_radio_maskset(dev, B2055_RRCCAL_NOPTSEL, 0xFFC0, 0x2C); - b43_radio_write(dev, B2055_CAL_MISC, 0x3C); - b43_radio_mask(dev, B2055_CAL_MISC, 0xFFBE); - b43_radio_set(dev, B2055_CAL_LPOCTL, 0x80); - b43_radio_set(dev, B2055_CAL_MISC, 0x1); - msleep(1); - b43_radio_set(dev, B2055_CAL_MISC, 0x40); - if (!b43_radio_wait_value(dev, B2055_CAL_COUT2, 0x80, 0x80, 10, 2000)) - b43err(dev->wl, "radio post init timeout\n"); - b43_radio_mask(dev, B2055_CAL_LPOCTL, 0xFF7F); - b43_switch_channel(dev, dev->phy.channel); - b43_radio_write(dev, B2055_C1_RX_BB_LPF, 0x9); - b43_radio_write(dev, B2055_C2_RX_BB_LPF, 0x9); - b43_radio_write(dev, B2055_C1_RX_BB_MIDACHP, 0x83); - b43_radio_write(dev, B2055_C2_RX_BB_MIDACHP, 0x83); - b43_radio_maskset(dev, B2055_C1_LNA_GAINBST, 0xFFF8, 0x6); - b43_radio_maskset(dev, B2055_C2_LNA_GAINBST, 0xFFF8, 0x6); - if (!nphy->gain_boost) { - b43_radio_set(dev, B2055_C1_RX_RFSPC1, 0x2); - b43_radio_set(dev, B2055_C2_RX_RFSPC1, 0x2); - } else { - b43_radio_mask(dev, B2055_C1_RX_RFSPC1, 0xFFFD); - b43_radio_mask(dev, B2055_C2_RX_RFSPC1, 0xFFFD); - } - udelay(2); -} - -/* - * Initialize a Broadcom 2055 N-radio - * http://bcm-v4.sipsolutions.net/802.11/Radio/2055/Init - */ -static void b43_radio_init2055(struct b43_wldev *dev) -{ - b43_radio_init2055_pre(dev); - if (b43_status(dev) < B43_STAT_INITIALIZED) { - /* Follow wl, not specs. Do not force uploading all regs */ - b2055_upload_inittab(dev, 0, 0); - } else { - bool ghz5 = b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ; - b2055_upload_inittab(dev, ghz5, 0); - } - b43_radio_init2055_post(dev); -} - -/************************************************** - * Samples - **************************************************/ - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/LoadSampleTable */ -static int b43_nphy_load_samples(struct b43_wldev *dev, - struct b43_c32 *samples, u16 len) { - struct b43_phy_n *nphy = dev->phy.n; - u16 i; - u32 *data; - - data = kzalloc(len * sizeof(u32), GFP_KERNEL); - if (!data) { - b43err(dev->wl, "allocation for samples loading failed\n"); - return -ENOMEM; - } - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 1); - - for (i = 0; i < len; i++) { - data[i] = (samples[i].i & 0x3FF << 10); - data[i] |= samples[i].q & 0x3FF; - } - b43_ntab_write_bulk(dev, B43_NTAB32(17, 0), len, data); - - kfree(data); - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 0); - return 0; -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GenLoadSamples */ -static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max, - bool test) -{ - int i; - u16 bw, len, rot, angle; - struct b43_c32 *samples; - - - bw = (dev->phy.is_40mhz) ? 40 : 20; - len = bw << 3; - - if (test) { - if (b43_phy_read(dev, B43_NPHY_BBCFG) & B43_NPHY_BBCFG_RSTRX) - bw = 82; - else - bw = 80; - - if (dev->phy.is_40mhz) - bw <<= 1; - - len = bw << 1; - } - - samples = kcalloc(len, sizeof(struct b43_c32), GFP_KERNEL); - if (!samples) { - b43err(dev->wl, "allocation for samples generation failed\n"); - return 0; - } - rot = (((freq * 36) / bw) << 16) / 100; - angle = 0; - - for (i = 0; i < len; i++) { - samples[i] = b43_cordic(angle); - angle += rot; - samples[i].q = CORDIC_CONVERT(samples[i].q * max); - samples[i].i = CORDIC_CONVERT(samples[i].i * max); - } - - i = b43_nphy_load_samples(dev, samples, len); - kfree(samples); - return (i < 0) ? 0 : len; -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RunSamples */ -static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops, - u16 wait, bool iqmode, bool dac_test) -{ - struct b43_phy_n *nphy = dev->phy.n; - int i; - u16 seq_mode; - u32 tmp; - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, true); - - if ((nphy->bb_mult_save & 0x80000000) == 0) { - tmp = b43_ntab_read(dev, B43_NTAB16(15, 87)); - nphy->bb_mult_save = (tmp & 0xFFFF) | 0x80000000; - } - - if (!dev->phy.is_40mhz) - tmp = 0x6464; - else - tmp = 0x4747; - b43_ntab_write(dev, B43_NTAB16(15, 87), tmp); - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, false); - - b43_phy_write(dev, B43_NPHY_SAMP_DEPCNT, (samps - 1)); - - if (loops != 0xFFFF) - b43_phy_write(dev, B43_NPHY_SAMP_LOOPCNT, (loops - 1)); - else - b43_phy_write(dev, B43_NPHY_SAMP_LOOPCNT, loops); - - b43_phy_write(dev, B43_NPHY_SAMP_WAITCNT, wait); - - seq_mode = b43_phy_read(dev, B43_NPHY_RFSEQMODE); - - b43_phy_set(dev, B43_NPHY_RFSEQMODE, B43_NPHY_RFSEQMODE_CAOVER); - if (iqmode) { - b43_phy_mask(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0x7FFF); - b43_phy_set(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0x8000); - } else { - if (dac_test) - b43_phy_write(dev, B43_NPHY_SAMP_CMD, 5); - else - b43_phy_write(dev, B43_NPHY_SAMP_CMD, 1); - } - for (i = 0; i < 100; i++) { - if (!(b43_phy_read(dev, B43_NPHY_RFSEQST) & 1)) { - i = 0; - break; - } - udelay(10); - } - if (i) - b43err(dev->wl, "run samples timeout\n"); - - b43_phy_write(dev, B43_NPHY_RFSEQMODE, seq_mode); -} - -/************************************************** - * RSSI - **************************************************/ - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ScaleOffsetRssi */ -static void b43_nphy_scale_offset_rssi(struct b43_wldev *dev, u16 scale, - s8 offset, u8 core, - enum n_rail_type rail, - enum n_rssi_type rssi_type) -{ - u16 tmp; - bool core1or5 = (core == 1) || (core == 5); - bool core2or5 = (core == 2) || (core == 5); - - offset = clamp_val(offset, -32, 31); - tmp = ((scale & 0x3F) << 8) | (offset & 0x3F); - - switch (rssi_type) { - case N_RSSI_NB: - if (core1or5 && rail == N_RAIL_I) - b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_Z, tmp); - if (core1or5 && rail == N_RAIL_Q) - b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_Z, tmp); - if (core2or5 && rail == N_RAIL_I) - b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_Z, tmp); - if (core2or5 && rail == N_RAIL_Q) - b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_Z, tmp); - break; - case N_RSSI_W1: - if (core1or5 && rail == N_RAIL_I) - b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_X, tmp); - if (core1or5 && rail == N_RAIL_Q) - b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_X, tmp); - if (core2or5 && rail == N_RAIL_I) - b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_X, tmp); - if (core2or5 && rail == N_RAIL_Q) - b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_X, tmp); - break; - case N_RSSI_W2: - if (core1or5 && rail == N_RAIL_I) - b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_Y, tmp); - if (core1or5 && rail == N_RAIL_Q) - b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_Y, tmp); - if (core2or5 && rail == N_RAIL_I) - b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_Y, tmp); - if (core2or5 && rail == N_RAIL_Q) - b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_Y, tmp); - break; - case N_RSSI_TBD: - if (core1or5 && rail == N_RAIL_I) - b43_phy_write(dev, B43_NPHY_RSSIMC_0I_TBD, tmp); - if (core1or5 && rail == N_RAIL_Q) - b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_TBD, tmp); - if (core2or5 && rail == N_RAIL_I) - b43_phy_write(dev, B43_NPHY_RSSIMC_1I_TBD, tmp); - if (core2or5 && rail == N_RAIL_Q) - b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_TBD, tmp); - break; - case N_RSSI_IQ: - if (core1or5 && rail == N_RAIL_I) - b43_phy_write(dev, B43_NPHY_RSSIMC_0I_PWRDET, tmp); - if (core1or5 && rail == N_RAIL_Q) - b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_PWRDET, tmp); - if (core2or5 && rail == N_RAIL_I) - b43_phy_write(dev, B43_NPHY_RSSIMC_1I_PWRDET, tmp); - if (core2or5 && rail == N_RAIL_Q) - b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_PWRDET, tmp); - break; - case N_RSSI_TSSI_2G: - if (core1or5) - b43_phy_write(dev, B43_NPHY_RSSIMC_0I_TSSI, tmp); - if (core2or5) - b43_phy_write(dev, B43_NPHY_RSSIMC_1I_TSSI, tmp); - break; - case N_RSSI_TSSI_5G: - if (core1or5) - b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_TSSI, tmp); - if (core2or5) - b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_TSSI, tmp); - break; - } -} - -static void b43_nphy_rev3_rssi_select(struct b43_wldev *dev, u8 code, - enum n_rssi_type rssi_type) -{ - u8 i; - u16 reg, val; - - if (code == 0) { - b43_phy_mask(dev, B43_NPHY_AFECTL_OVER1, 0xFDFF); - b43_phy_mask(dev, B43_NPHY_AFECTL_OVER, 0xFDFF); - b43_phy_mask(dev, B43_NPHY_AFECTL_C1, 0xFCFF); - b43_phy_mask(dev, B43_NPHY_AFECTL_C2, 0xFCFF); - b43_phy_mask(dev, B43_NPHY_TXF_40CO_B1S0, 0xFFDF); - b43_phy_mask(dev, B43_NPHY_TXF_40CO_B32S1, 0xFFDF); - b43_phy_mask(dev, B43_NPHY_RFCTL_LUT_TRSW_UP1, 0xFFC3); - b43_phy_mask(dev, B43_NPHY_RFCTL_LUT_TRSW_UP2, 0xFFC3); - } else { - for (i = 0; i < 2; i++) { - if ((code == 1 && i == 1) || (code == 2 && !i)) - continue; - - reg = (i == 0) ? - B43_NPHY_AFECTL_OVER1 : B43_NPHY_AFECTL_OVER; - b43_phy_maskset(dev, reg, 0xFDFF, 0x0200); - - if (rssi_type == N_RSSI_W1 || - rssi_type == N_RSSI_W2 || - rssi_type == N_RSSI_NB) { - reg = (i == 0) ? - B43_NPHY_AFECTL_C1 : - B43_NPHY_AFECTL_C2; - b43_phy_maskset(dev, reg, 0xFCFF, 0); - - reg = (i == 0) ? - B43_NPHY_RFCTL_LUT_TRSW_UP1 : - B43_NPHY_RFCTL_LUT_TRSW_UP2; - b43_phy_maskset(dev, reg, 0xFFC3, 0); - - if (rssi_type == N_RSSI_W1) - val = (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ? 4 : 8; - else if (rssi_type == N_RSSI_W2) - val = 16; - else - val = 32; - b43_phy_set(dev, reg, val); - - reg = (i == 0) ? - B43_NPHY_TXF_40CO_B1S0 : - B43_NPHY_TXF_40CO_B32S1; - b43_phy_set(dev, reg, 0x0020); - } else { - if (rssi_type == N_RSSI_TBD) - val = 0x0100; - else if (rssi_type == N_RSSI_IQ) - val = 0x0200; - else - val = 0x0300; - - reg = (i == 0) ? - B43_NPHY_AFECTL_C1 : - B43_NPHY_AFECTL_C2; - - b43_phy_maskset(dev, reg, 0xFCFF, val); - b43_phy_maskset(dev, reg, 0xF3FF, val << 2); - - if (rssi_type != N_RSSI_IQ && - rssi_type != N_RSSI_TBD) { - enum ieee80211_band band = - b43_current_band(dev->wl); - - if (b43_nphy_ipa(dev)) - val = (band == IEEE80211_BAND_5GHZ) ? 0xC : 0xE; - else - val = 0x11; - reg = (i == 0) ? 0x2000 : 0x3000; - reg |= B2055_PADDRV; - b43_radio_write(dev, reg, val); - - reg = (i == 0) ? - B43_NPHY_AFECTL_OVER1 : - B43_NPHY_AFECTL_OVER; - b43_phy_set(dev, reg, 0x0200); - } - } - } - } -} - -static void b43_nphy_rev2_rssi_select(struct b43_wldev *dev, u8 code, - enum n_rssi_type rssi_type) -{ - u16 val; - bool rssi_w1_w2_nb = false; - - switch (rssi_type) { - case N_RSSI_W1: - case N_RSSI_W2: - case N_RSSI_NB: - val = 0; - rssi_w1_w2_nb = true; - break; - case N_RSSI_TBD: - val = 1; - break; - case N_RSSI_IQ: - val = 2; - break; - default: - val = 3; - } - - val = (val << 12) | (val << 14); - b43_phy_maskset(dev, B43_NPHY_AFECTL_C1, 0x0FFF, val); - b43_phy_maskset(dev, B43_NPHY_AFECTL_C2, 0x0FFF, val); - - if (rssi_w1_w2_nb) { - b43_phy_maskset(dev, B43_NPHY_RFCTL_RSSIO1, 0xFFCF, - (rssi_type + 1) << 4); - b43_phy_maskset(dev, B43_NPHY_RFCTL_RSSIO2, 0xFFCF, - (rssi_type + 1) << 4); - } - - if (code == 0) { - b43_phy_mask(dev, B43_NPHY_AFECTL_OVER, ~0x3000); - if (rssi_w1_w2_nb) { - b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, - ~(B43_NPHY_RFCTL_CMD_RXEN | - B43_NPHY_RFCTL_CMD_CORESEL)); - b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, - ~(0x1 << 12 | - 0x1 << 5 | - 0x1 << 1 | - 0x1)); - b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, - ~B43_NPHY_RFCTL_CMD_START); - udelay(20); - b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, ~0x1); - } - } else { - b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x3000); - if (rssi_w1_w2_nb) { - b43_phy_maskset(dev, B43_NPHY_RFCTL_CMD, - ~(B43_NPHY_RFCTL_CMD_RXEN | - B43_NPHY_RFCTL_CMD_CORESEL), - (B43_NPHY_RFCTL_CMD_RXEN | - code << B43_NPHY_RFCTL_CMD_CORESEL_SHIFT)); - b43_phy_set(dev, B43_NPHY_RFCTL_OVER, - (0x1 << 12 | - 0x1 << 5 | - 0x1 << 1 | - 0x1)); - b43_phy_set(dev, B43_NPHY_RFCTL_CMD, - B43_NPHY_RFCTL_CMD_START); - udelay(20); - b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, ~0x1); - } - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSISel */ -static void b43_nphy_rssi_select(struct b43_wldev *dev, u8 code, - enum n_rssi_type type) -{ - if (dev->phy.rev >= 3) - b43_nphy_rev3_rssi_select(dev, code, type); - else - b43_nphy_rev2_rssi_select(dev, code, type); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetRssi2055Vcm */ -static void b43_nphy_set_rssi_2055_vcm(struct b43_wldev *dev, - enum n_rssi_type rssi_type, u8 *buf) -{ - int i; - for (i = 0; i < 2; i++) { - if (rssi_type == N_RSSI_NB) { - if (i == 0) { - b43_radio_maskset(dev, B2055_C1_B0NB_RSSIVCM, - 0xFC, buf[0]); - b43_radio_maskset(dev, B2055_C1_RX_BB_RSSICTL5, - 0xFC, buf[1]); - } else { - b43_radio_maskset(dev, B2055_C2_B0NB_RSSIVCM, - 0xFC, buf[2 * i]); - b43_radio_maskset(dev, B2055_C2_RX_BB_RSSICTL5, - 0xFC, buf[2 * i + 1]); - } - } else { - if (i == 0) - b43_radio_maskset(dev, B2055_C1_RX_BB_RSSICTL5, - 0xF3, buf[0] << 2); - else - b43_radio_maskset(dev, B2055_C2_RX_BB_RSSICTL5, - 0xF3, buf[2 * i + 1] << 2); - } - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/PollRssi */ -static int b43_nphy_poll_rssi(struct b43_wldev *dev, enum n_rssi_type rssi_type, - s32 *buf, u8 nsamp) -{ - int i; - int out; - u16 save_regs_phy[9]; - u16 s[2]; - - if (dev->phy.rev >= 3) { - save_regs_phy[0] = b43_phy_read(dev, B43_NPHY_AFECTL_C1); - save_regs_phy[1] = b43_phy_read(dev, B43_NPHY_AFECTL_C2); - save_regs_phy[2] = b43_phy_read(dev, - B43_NPHY_RFCTL_LUT_TRSW_UP1); - save_regs_phy[3] = b43_phy_read(dev, - B43_NPHY_RFCTL_LUT_TRSW_UP2); - save_regs_phy[4] = b43_phy_read(dev, B43_NPHY_AFECTL_OVER1); - save_regs_phy[5] = b43_phy_read(dev, B43_NPHY_AFECTL_OVER); - save_regs_phy[6] = b43_phy_read(dev, B43_NPHY_TXF_40CO_B1S0); - save_regs_phy[7] = b43_phy_read(dev, B43_NPHY_TXF_40CO_B32S1); - save_regs_phy[8] = 0; - } else { - save_regs_phy[0] = b43_phy_read(dev, B43_NPHY_AFECTL_C1); - save_regs_phy[1] = b43_phy_read(dev, B43_NPHY_AFECTL_C2); - save_regs_phy[2] = b43_phy_read(dev, B43_NPHY_AFECTL_OVER); - save_regs_phy[3] = b43_phy_read(dev, B43_NPHY_RFCTL_CMD); - save_regs_phy[4] = b43_phy_read(dev, B43_NPHY_RFCTL_OVER); - save_regs_phy[5] = b43_phy_read(dev, B43_NPHY_RFCTL_RSSIO1); - save_regs_phy[6] = b43_phy_read(dev, B43_NPHY_RFCTL_RSSIO2); - save_regs_phy[7] = 0; - save_regs_phy[8] = 0; - } - - b43_nphy_rssi_select(dev, 5, rssi_type); - - if (dev->phy.rev < 2) { - save_regs_phy[8] = b43_phy_read(dev, B43_NPHY_GPIO_SEL); - b43_phy_write(dev, B43_NPHY_GPIO_SEL, 5); - } - - for (i = 0; i < 4; i++) - buf[i] = 0; - - for (i = 0; i < nsamp; i++) { - if (dev->phy.rev < 2) { - s[0] = b43_phy_read(dev, B43_NPHY_GPIO_LOOUT); - s[1] = b43_phy_read(dev, B43_NPHY_GPIO_HIOUT); - } else { - s[0] = b43_phy_read(dev, B43_NPHY_RSSI1); - s[1] = b43_phy_read(dev, B43_NPHY_RSSI2); - } - - buf[0] += ((s8)((s[0] & 0x3F) << 2)) >> 2; - buf[1] += ((s8)(((s[0] >> 8) & 0x3F) << 2)) >> 2; - buf[2] += ((s8)((s[1] & 0x3F) << 2)) >> 2; - buf[3] += ((s8)(((s[1] >> 8) & 0x3F) << 2)) >> 2; - } - out = (buf[0] & 0xFF) << 24 | (buf[1] & 0xFF) << 16 | - (buf[2] & 0xFF) << 8 | (buf[3] & 0xFF); - - if (dev->phy.rev < 2) - b43_phy_write(dev, B43_NPHY_GPIO_SEL, save_regs_phy[8]); - - if (dev->phy.rev >= 3) { - b43_phy_write(dev, B43_NPHY_AFECTL_C1, save_regs_phy[0]); - b43_phy_write(dev, B43_NPHY_AFECTL_C2, save_regs_phy[1]); - b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP1, - save_regs_phy[2]); - b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP2, - save_regs_phy[3]); - b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, save_regs_phy[4]); - b43_phy_write(dev, B43_NPHY_AFECTL_OVER, save_regs_phy[5]); - b43_phy_write(dev, B43_NPHY_TXF_40CO_B1S0, save_regs_phy[6]); - b43_phy_write(dev, B43_NPHY_TXF_40CO_B32S1, save_regs_phy[7]); - } else { - b43_phy_write(dev, B43_NPHY_AFECTL_C1, save_regs_phy[0]); - b43_phy_write(dev, B43_NPHY_AFECTL_C2, save_regs_phy[1]); - b43_phy_write(dev, B43_NPHY_AFECTL_OVER, save_regs_phy[2]); - b43_phy_write(dev, B43_NPHY_RFCTL_CMD, save_regs_phy[3]); - b43_phy_write(dev, B43_NPHY_RFCTL_OVER, save_regs_phy[4]); - b43_phy_write(dev, B43_NPHY_RFCTL_RSSIO1, save_regs_phy[5]); - b43_phy_write(dev, B43_NPHY_RFCTL_RSSIO2, save_regs_phy[6]); - } - - return out; -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICalRev3 */ -static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - - u16 saved_regs_phy_rfctl[2]; - u16 saved_regs_phy[13]; - u16 regs_to_store[] = { - B43_NPHY_AFECTL_OVER1, B43_NPHY_AFECTL_OVER, - B43_NPHY_AFECTL_C1, B43_NPHY_AFECTL_C2, - B43_NPHY_TXF_40CO_B1S1, B43_NPHY_RFCTL_OVER, - B43_NPHY_TXF_40CO_B1S0, B43_NPHY_TXF_40CO_B32S1, - B43_NPHY_RFCTL_CMD, - B43_NPHY_RFCTL_LUT_TRSW_UP1, B43_NPHY_RFCTL_LUT_TRSW_UP2, - B43_NPHY_RFCTL_RSSIO1, B43_NPHY_RFCTL_RSSIO2 - }; - - u16 class; - - u16 clip_state[2]; - u16 clip_off[2] = { 0xFFFF, 0xFFFF }; - - u8 vcm_final = 0; - s32 offset[4]; - s32 results[8][4] = { }; - s32 results_min[4] = { }; - s32 poll_results[4] = { }; - - u16 *rssical_radio_regs = NULL; - u16 *rssical_phy_regs = NULL; - - u16 r; /* routing */ - u8 rx_core_state; - int core, i, j, vcm; - - class = b43_nphy_classifier(dev, 0, 0); - b43_nphy_classifier(dev, 7, 4); - b43_nphy_read_clip_detection(dev, clip_state); - b43_nphy_write_clip_detection(dev, clip_off); - - saved_regs_phy_rfctl[0] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1); - saved_regs_phy_rfctl[1] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2); - for (i = 0; i < ARRAY_SIZE(regs_to_store); i++) - saved_regs_phy[i] = b43_phy_read(dev, regs_to_store[i]); - - b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_OFF, 0, 7); - b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_TRSW, 1, 7); - b43_nphy_rf_ctl_override(dev, 0x1, 0, 0, false); - b43_nphy_rf_ctl_override(dev, 0x2, 1, 0, false); - b43_nphy_rf_ctl_override(dev, 0x80, 1, 0, false); - b43_nphy_rf_ctl_override(dev, 0x40, 1, 0, false); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { - b43_nphy_rf_ctl_override(dev, 0x20, 0, 0, false); - b43_nphy_rf_ctl_override(dev, 0x10, 1, 0, false); - } else { - b43_nphy_rf_ctl_override(dev, 0x10, 0, 0, false); - b43_nphy_rf_ctl_override(dev, 0x20, 1, 0, false); - } - - rx_core_state = b43_nphy_get_rx_core_state(dev); - for (core = 0; core < 2; core++) { - if (!(rx_core_state & (1 << core))) - continue; - r = core ? B2056_RX1 : B2056_RX0; - b43_nphy_scale_offset_rssi(dev, 0, 0, core + 1, N_RAIL_I, - N_RSSI_NB); - b43_nphy_scale_offset_rssi(dev, 0, 0, core + 1, N_RAIL_Q, - N_RSSI_NB); - - /* Grab RSSI results for every possible VCM */ - for (vcm = 0; vcm < 8; vcm++) { - b43_radio_maskset(dev, r | B2056_RX_RSSI_MISC, 0xE3, - vcm << 2); - b43_nphy_poll_rssi(dev, N_RSSI_NB, results[vcm], 8); - } - - /* Find out which VCM got the best results */ - for (i = 0; i < 4; i += 2) { - s32 currd; - s32 mind = 0x100000; - s32 minpoll = 249; - u8 minvcm = 0; - if (2 * core != i) - continue; - for (vcm = 0; vcm < 8; vcm++) { - currd = results[vcm][i] * results[vcm][i] + - results[vcm][i + 1] * results[vcm][i]; - if (currd < mind) { - mind = currd; - minvcm = vcm; - } - if (results[vcm][i] < minpoll) - minpoll = results[vcm][i]; - } - vcm_final = minvcm; - results_min[i] = minpoll; - } - - /* Select the best VCM */ - b43_radio_maskset(dev, r | B2056_RX_RSSI_MISC, 0xE3, - vcm_final << 2); - - for (i = 0; i < 4; i++) { - if (core != i / 2) - continue; - offset[i] = -results[vcm_final][i]; - if (offset[i] < 0) - offset[i] = -((abs(offset[i]) + 4) / 8); - else - offset[i] = (offset[i] + 4) / 8; - if (results_min[i] == 248) - offset[i] = -32; - b43_nphy_scale_offset_rssi(dev, 0, offset[i], - (i / 2 == 0) ? 1 : 2, - (i % 2 == 0) ? N_RAIL_I : N_RAIL_Q, - N_RSSI_NB); - } - } - - for (core = 0; core < 2; core++) { - if (!(rx_core_state & (1 << core))) - continue; - for (i = 0; i < 2; i++) { - b43_nphy_scale_offset_rssi(dev, 0, 0, core + 1, - N_RAIL_I, i); - b43_nphy_scale_offset_rssi(dev, 0, 0, core + 1, - N_RAIL_Q, i); - b43_nphy_poll_rssi(dev, i, poll_results, 8); - for (j = 0; j < 4; j++) { - if (j / 2 == core) { - offset[j] = 232 - poll_results[j]; - if (offset[j] < 0) - offset[j] = -(abs(offset[j] + 4) / 8); - else - offset[j] = (offset[j] + 4) / 8; - b43_nphy_scale_offset_rssi(dev, 0, - offset[2 * core], core + 1, j % 2, i); - } - } - } - } - - b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, saved_regs_phy_rfctl[0]); - b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, saved_regs_phy_rfctl[1]); - - b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX); - - b43_phy_set(dev, B43_NPHY_TXF_40CO_B1S1, 0x1); - b43_phy_set(dev, B43_NPHY_RFCTL_CMD, B43_NPHY_RFCTL_CMD_START); - b43_phy_mask(dev, B43_NPHY_TXF_40CO_B1S1, ~0x1); - - b43_phy_set(dev, B43_NPHY_RFCTL_OVER, 0x1); - b43_phy_set(dev, B43_NPHY_RFCTL_CMD, B43_NPHY_RFCTL_CMD_RXTX); - b43_phy_mask(dev, B43_NPHY_TXF_40CO_B1S1, ~0x1); - - for (i = 0; i < ARRAY_SIZE(regs_to_store); i++) - b43_phy_write(dev, regs_to_store[i], saved_regs_phy[i]); - - /* Store for future configuration */ - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_2G; - rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_2G; - } else { - rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_5G; - rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_5G; - } - if (dev->phy.rev >= 7) { - } else { - rssical_radio_regs[0] = b43_radio_read(dev, B2056_RX0 | - B2056_RX_RSSI_MISC); - rssical_radio_regs[1] = b43_radio_read(dev, B2056_RX1 | - B2056_RX_RSSI_MISC); - } - rssical_phy_regs[0] = b43_phy_read(dev, B43_NPHY_RSSIMC_0I_RSSI_Z); - rssical_phy_regs[1] = b43_phy_read(dev, B43_NPHY_RSSIMC_0Q_RSSI_Z); - rssical_phy_regs[2] = b43_phy_read(dev, B43_NPHY_RSSIMC_1I_RSSI_Z); - rssical_phy_regs[3] = b43_phy_read(dev, B43_NPHY_RSSIMC_1Q_RSSI_Z); - rssical_phy_regs[4] = b43_phy_read(dev, B43_NPHY_RSSIMC_0I_RSSI_X); - rssical_phy_regs[5] = b43_phy_read(dev, B43_NPHY_RSSIMC_0Q_RSSI_X); - rssical_phy_regs[6] = b43_phy_read(dev, B43_NPHY_RSSIMC_1I_RSSI_X); - rssical_phy_regs[7] = b43_phy_read(dev, B43_NPHY_RSSIMC_1Q_RSSI_X); - rssical_phy_regs[8] = b43_phy_read(dev, B43_NPHY_RSSIMC_0I_RSSI_Y); - rssical_phy_regs[9] = b43_phy_read(dev, B43_NPHY_RSSIMC_0Q_RSSI_Y); - rssical_phy_regs[10] = b43_phy_read(dev, B43_NPHY_RSSIMC_1I_RSSI_Y); - rssical_phy_regs[11] = b43_phy_read(dev, B43_NPHY_RSSIMC_1Q_RSSI_Y); - - /* Remember for which channel we store configuration */ - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - nphy->rssical_chanspec_2G.center_freq = dev->phy.channel_freq; - else - nphy->rssical_chanspec_5G.center_freq = dev->phy.channel_freq; - - /* End of calibration, restore configuration */ - b43_nphy_classifier(dev, 7, class); - b43_nphy_write_clip_detection(dev, clip_state); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICal */ -static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, enum n_rssi_type type) -{ - int i, j, vcm; - u8 state[4]; - u8 code, val; - u16 class, override; - u8 regs_save_radio[2]; - u16 regs_save_phy[2]; - - s32 offset[4]; - u8 core; - u8 rail; - - u16 clip_state[2]; - u16 clip_off[2] = { 0xFFFF, 0xFFFF }; - s32 results_min[4] = { }; - u8 vcm_final[4] = { }; - s32 results[4][4] = { }; - s32 miniq[4][2] = { }; - - if (type == N_RSSI_NB) { - code = 0; - val = 6; - } else if (type == N_RSSI_W1 || type == N_RSSI_W2) { - code = 25; - val = 4; - } else { - B43_WARN_ON(1); - return; - } - - class = b43_nphy_classifier(dev, 0, 0); - b43_nphy_classifier(dev, 7, 4); - b43_nphy_read_clip_detection(dev, clip_state); - b43_nphy_write_clip_detection(dev, clip_off); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) - override = 0x140; - else - override = 0x110; - - regs_save_phy[0] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1); - regs_save_radio[0] = b43_radio_read(dev, B2055_C1_PD_RXTX); - b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, override); - b43_radio_write(dev, B2055_C1_PD_RXTX, val); - - regs_save_phy[1] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2); - regs_save_radio[1] = b43_radio_read(dev, B2055_C2_PD_RXTX); - b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, override); - b43_radio_write(dev, B2055_C2_PD_RXTX, val); - - state[0] = b43_radio_read(dev, B2055_C1_PD_RSSIMISC) & 0x07; - state[1] = b43_radio_read(dev, B2055_C2_PD_RSSIMISC) & 0x07; - b43_radio_mask(dev, B2055_C1_PD_RSSIMISC, 0xF8); - b43_radio_mask(dev, B2055_C2_PD_RSSIMISC, 0xF8); - state[2] = b43_radio_read(dev, B2055_C1_SP_RSSI) & 0x07; - state[3] = b43_radio_read(dev, B2055_C2_SP_RSSI) & 0x07; - - b43_nphy_rssi_select(dev, 5, type); - b43_nphy_scale_offset_rssi(dev, 0, 0, 5, N_RAIL_I, type); - b43_nphy_scale_offset_rssi(dev, 0, 0, 5, N_RAIL_Q, type); - - for (vcm = 0; vcm < 4; vcm++) { - u8 tmp[4]; - for (j = 0; j < 4; j++) - tmp[j] = vcm; - if (type != N_RSSI_W2) - b43_nphy_set_rssi_2055_vcm(dev, type, tmp); - b43_nphy_poll_rssi(dev, type, results[vcm], 8); - if (type == N_RSSI_W1 || type == N_RSSI_W2) - for (j = 0; j < 2; j++) - miniq[vcm][j] = min(results[vcm][2 * j], - results[vcm][2 * j + 1]); - } - - for (i = 0; i < 4; i++) { - s32 mind = 0x100000; - u8 minvcm = 0; - s32 minpoll = 249; - s32 currd; - for (vcm = 0; vcm < 4; vcm++) { - if (type == N_RSSI_NB) - currd = abs(results[vcm][i] - code * 8); - else - currd = abs(miniq[vcm][i / 2] - code * 8); - - if (currd < mind) { - mind = currd; - minvcm = vcm; - } - - if (results[vcm][i] < minpoll) - minpoll = results[vcm][i]; - } - results_min[i] = minpoll; - vcm_final[i] = minvcm; - } - - if (type != N_RSSI_W2) - b43_nphy_set_rssi_2055_vcm(dev, type, vcm_final); - - for (i = 0; i < 4; i++) { - offset[i] = (code * 8) - results[vcm_final[i]][i]; - - if (offset[i] < 0) - offset[i] = -((abs(offset[i]) + 4) / 8); - else - offset[i] = (offset[i] + 4) / 8; - - if (results_min[i] == 248) - offset[i] = code - 32; - - core = (i / 2) ? 2 : 1; - rail = (i % 2) ? N_RAIL_Q : N_RAIL_I; - - b43_nphy_scale_offset_rssi(dev, 0, offset[i], core, rail, - type); - } - - b43_radio_maskset(dev, B2055_C1_PD_RSSIMISC, 0xF8, state[0]); - b43_radio_maskset(dev, B2055_C2_PD_RSSIMISC, 0xF8, state[1]); - - switch (state[2]) { - case 1: - b43_nphy_rssi_select(dev, 1, N_RSSI_NB); - break; - case 4: - b43_nphy_rssi_select(dev, 1, N_RSSI_W1); - break; - case 2: - b43_nphy_rssi_select(dev, 1, N_RSSI_W2); - break; - default: - b43_nphy_rssi_select(dev, 1, N_RSSI_W2); - break; - } - - switch (state[3]) { - case 1: - b43_nphy_rssi_select(dev, 2, N_RSSI_NB); - break; - case 4: - b43_nphy_rssi_select(dev, 2, N_RSSI_W1); - break; - default: - b43_nphy_rssi_select(dev, 2, N_RSSI_W2); - break; - } - - b43_nphy_rssi_select(dev, 0, type); - - b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, regs_save_phy[0]); - b43_radio_write(dev, B2055_C1_PD_RXTX, regs_save_radio[0]); - b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, regs_save_phy[1]); - b43_radio_write(dev, B2055_C2_PD_RXTX, regs_save_radio[1]); - - b43_nphy_classifier(dev, 7, class); - b43_nphy_write_clip_detection(dev, clip_state); - /* Specs don't say about reset here, but it makes wl and b43 dumps - identical, it really seems wl performs this */ - b43_nphy_reset_cca(dev); -} - -/* - * RSSI Calibration - * http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICal - */ -static void b43_nphy_rssi_cal(struct b43_wldev *dev) -{ - if (dev->phy.rev >= 3) { - b43_nphy_rev3_rssi_cal(dev); - } else { - b43_nphy_rev2_rssi_cal(dev, N_RSSI_NB); - b43_nphy_rev2_rssi_cal(dev, N_RSSI_W1); - b43_nphy_rev2_rssi_cal(dev, N_RSSI_W2); - } -} - -/************************************************** - * Workarounds - **************************************************/ - -static void b43_nphy_gain_ctl_workarounds_rev3plus(struct b43_wldev *dev) -{ - struct ssb_sprom *sprom = dev->dev->bus_sprom; - - bool ghz5; - bool ext_lna; - u16 rssi_gain; - struct nphy_gain_ctl_workaround_entry *e; - u8 lpf_gain[6] = { 0x00, 0x06, 0x0C, 0x12, 0x12, 0x12 }; - u8 lpf_bits[6] = { 0, 1, 2, 3, 3, 3 }; - - /* Prepare values */ - ghz5 = b43_phy_read(dev, B43_NPHY_BANDCTL) - & B43_NPHY_BANDCTL_5GHZ; - ext_lna = ghz5 ? sprom->boardflags_hi & B43_BFH_EXTLNA_5GHZ : - sprom->boardflags_lo & B43_BFL_EXTLNA; - e = b43_nphy_get_gain_ctl_workaround_ent(dev, ghz5, ext_lna); - if (ghz5 && dev->phy.rev >= 5) - rssi_gain = 0x90; - else - rssi_gain = 0x50; - - b43_phy_set(dev, B43_NPHY_RXCTL, 0x0040); - - /* Set Clip 2 detect */ - b43_phy_set(dev, B43_NPHY_C1_CGAINI, B43_NPHY_C1_CGAINI_CL2DETECT); - b43_phy_set(dev, B43_NPHY_C2_CGAINI, B43_NPHY_C2_CGAINI_CL2DETECT); - - b43_radio_write(dev, B2056_RX0 | B2056_RX_BIASPOLE_LNAG1_IDAC, - 0x17); - b43_radio_write(dev, B2056_RX1 | B2056_RX_BIASPOLE_LNAG1_IDAC, - 0x17); - b43_radio_write(dev, B2056_RX0 | B2056_RX_LNAG2_IDAC, 0xF0); - b43_radio_write(dev, B2056_RX1 | B2056_RX_LNAG2_IDAC, 0xF0); - b43_radio_write(dev, B2056_RX0 | B2056_RX_RSSI_POLE, 0x00); - b43_radio_write(dev, B2056_RX1 | B2056_RX_RSSI_POLE, 0x00); - b43_radio_write(dev, B2056_RX0 | B2056_RX_RSSI_GAIN, - rssi_gain); - b43_radio_write(dev, B2056_RX1 | B2056_RX_RSSI_GAIN, - rssi_gain); - b43_radio_write(dev, B2056_RX0 | B2056_RX_BIASPOLE_LNAA1_IDAC, - 0x17); - b43_radio_write(dev, B2056_RX1 | B2056_RX_BIASPOLE_LNAA1_IDAC, - 0x17); - b43_radio_write(dev, B2056_RX0 | B2056_RX_LNAA2_IDAC, 0xFF); - b43_radio_write(dev, B2056_RX1 | B2056_RX_LNAA2_IDAC, 0xFF); - - b43_ntab_write_bulk(dev, B43_NTAB8(0, 8), 4, e->lna1_gain); - b43_ntab_write_bulk(dev, B43_NTAB8(1, 8), 4, e->lna1_gain); - b43_ntab_write_bulk(dev, B43_NTAB8(0, 16), 4, e->lna2_gain); - b43_ntab_write_bulk(dev, B43_NTAB8(1, 16), 4, e->lna2_gain); - b43_ntab_write_bulk(dev, B43_NTAB8(0, 32), 10, e->gain_db); - b43_ntab_write_bulk(dev, B43_NTAB8(1, 32), 10, e->gain_db); - b43_ntab_write_bulk(dev, B43_NTAB8(2, 32), 10, e->gain_bits); - b43_ntab_write_bulk(dev, B43_NTAB8(3, 32), 10, e->gain_bits); - b43_ntab_write_bulk(dev, B43_NTAB8(0, 0x40), 6, lpf_gain); - b43_ntab_write_bulk(dev, B43_NTAB8(1, 0x40), 6, lpf_gain); - b43_ntab_write_bulk(dev, B43_NTAB8(2, 0x40), 6, lpf_bits); - b43_ntab_write_bulk(dev, B43_NTAB8(3, 0x40), 6, lpf_bits); - - b43_phy_write(dev, B43_NPHY_REV3_C1_INITGAIN_A, e->init_gain); - b43_phy_write(dev, B43_NPHY_REV3_C2_INITGAIN_A, e->init_gain); - - b43_ntab_write_bulk(dev, B43_NTAB16(7, 0x106), 2, - e->rfseq_init); - - b43_phy_write(dev, B43_NPHY_REV3_C1_CLIP_HIGAIN_A, e->cliphi_gain); - b43_phy_write(dev, B43_NPHY_REV3_C2_CLIP_HIGAIN_A, e->cliphi_gain); - b43_phy_write(dev, B43_NPHY_REV3_C1_CLIP_MEDGAIN_A, e->clipmd_gain); - b43_phy_write(dev, B43_NPHY_REV3_C2_CLIP_MEDGAIN_A, e->clipmd_gain); - b43_phy_write(dev, B43_NPHY_REV3_C1_CLIP_LOGAIN_A, e->cliplo_gain); - b43_phy_write(dev, B43_NPHY_REV3_C2_CLIP_LOGAIN_A, e->cliplo_gain); - - b43_phy_maskset(dev, B43_NPHY_CRSMINPOWER0, 0xFF00, e->crsmin); - b43_phy_maskset(dev, B43_NPHY_CRSMINPOWERL0, 0xFF00, e->crsminl); - b43_phy_maskset(dev, B43_NPHY_CRSMINPOWERU0, 0xFF00, e->crsminu); - b43_phy_write(dev, B43_NPHY_C1_NBCLIPTHRES, e->nbclip); - b43_phy_write(dev, B43_NPHY_C2_NBCLIPTHRES, e->nbclip); - b43_phy_maskset(dev, B43_NPHY_C1_CLIPWBTHRES, - ~B43_NPHY_C1_CLIPWBTHRES_CLIP2, e->wlclip); - b43_phy_maskset(dev, B43_NPHY_C2_CLIPWBTHRES, - ~B43_NPHY_C2_CLIPWBTHRES_CLIP2, e->wlclip); - b43_phy_write(dev, B43_NPHY_CCK_SHIFTB_REF, 0x809C); -} - -static void b43_nphy_gain_ctl_workarounds_rev1_2(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - - u8 i, j; - u8 code; - u16 tmp; - u8 rfseq_events[3] = { 6, 8, 7 }; - u8 rfseq_delays[3] = { 10, 30, 1 }; - - /* Set Clip 2 detect */ - b43_phy_set(dev, B43_NPHY_C1_CGAINI, B43_NPHY_C1_CGAINI_CL2DETECT); - b43_phy_set(dev, B43_NPHY_C2_CGAINI, B43_NPHY_C2_CGAINI_CL2DETECT); - - /* Set narrowband clip threshold */ - b43_phy_write(dev, B43_NPHY_C1_NBCLIPTHRES, 0x84); - b43_phy_write(dev, B43_NPHY_C2_NBCLIPTHRES, 0x84); - - if (!dev->phy.is_40mhz) { - /* Set dwell lengths */ - b43_phy_write(dev, B43_NPHY_CLIP1_NBDWELL_LEN, 0x002B); - b43_phy_write(dev, B43_NPHY_CLIP2_NBDWELL_LEN, 0x002B); - b43_phy_write(dev, B43_NPHY_W1CLIP1_DWELL_LEN, 0x0009); - b43_phy_write(dev, B43_NPHY_W1CLIP2_DWELL_LEN, 0x0009); - } - - /* Set wideband clip 2 threshold */ - b43_phy_maskset(dev, B43_NPHY_C1_CLIPWBTHRES, - ~B43_NPHY_C1_CLIPWBTHRES_CLIP2, 21); - b43_phy_maskset(dev, B43_NPHY_C2_CLIPWBTHRES, - ~B43_NPHY_C2_CLIPWBTHRES_CLIP2, 21); - - if (!dev->phy.is_40mhz) { - b43_phy_maskset(dev, B43_NPHY_C1_CGAINI, - ~B43_NPHY_C1_CGAINI_GAINBKOFF, 0x1); - b43_phy_maskset(dev, B43_NPHY_C2_CGAINI, - ~B43_NPHY_C2_CGAINI_GAINBKOFF, 0x1); - b43_phy_maskset(dev, B43_NPHY_C1_CCK_CGAINI, - ~B43_NPHY_C1_CCK_CGAINI_GAINBKOFF, 0x1); - b43_phy_maskset(dev, B43_NPHY_C2_CCK_CGAINI, - ~B43_NPHY_C2_CCK_CGAINI_GAINBKOFF, 0x1); - } - - b43_phy_write(dev, B43_NPHY_CCK_SHIFTB_REF, 0x809C); - - if (nphy->gain_boost) { - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ && - dev->phy.is_40mhz) - code = 4; - else - code = 5; - } else { - code = dev->phy.is_40mhz ? 6 : 7; - } - - /* Set HPVGA2 index */ - b43_phy_maskset(dev, B43_NPHY_C1_INITGAIN, ~B43_NPHY_C1_INITGAIN_HPVGA2, - code << B43_NPHY_C1_INITGAIN_HPVGA2_SHIFT); - b43_phy_maskset(dev, B43_NPHY_C2_INITGAIN, ~B43_NPHY_C2_INITGAIN_HPVGA2, - code << B43_NPHY_C2_INITGAIN_HPVGA2_SHIFT); - - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x1D06); - /* specs say about 2 loops, but wl does 4 */ - for (i = 0; i < 4; i++) - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, (code << 8 | 0x7C)); - - b43_nphy_adjust_lna_gain_table(dev); - - if (nphy->elna_gain_config) { - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x0808); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, 0x0); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, 0x1); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, 0x1); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, 0x1); - - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x0C08); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, 0x0); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, 0x1); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, 0x1); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, 0x1); - - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x1D06); - /* specs say about 2 loops, but wl does 4 */ - for (i = 0; i < 4; i++) - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, - (code << 8 | 0x74)); - } - - if (dev->phy.rev == 2) { - for (i = 0; i < 4; i++) { - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, - (0x0400 * i) + 0x0020); - for (j = 0; j < 21; j++) { - tmp = j * (i < 2 ? 3 : 1); - b43_phy_write(dev, - B43_NPHY_TABLE_DATALO, tmp); - } - } - } - - b43_nphy_set_rf_sequence(dev, 5, rfseq_events, rfseq_delays, 3); - b43_phy_maskset(dev, B43_NPHY_OVER_DGAIN1, - ~B43_NPHY_OVER_DGAIN_CCKDGECV & 0xFFFF, - 0x5A << B43_NPHY_OVER_DGAIN_CCKDGECV_SHIFT); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - b43_phy_maskset(dev, B43_PHY_N(0xC5D), 0xFF80, 4); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/WorkaroundsGainCtrl */ -static void b43_nphy_gain_ctl_workarounds(struct b43_wldev *dev) -{ - if (dev->phy.rev >= 7) - ; /* TODO */ - else if (dev->phy.rev >= 3) - b43_nphy_gain_ctl_workarounds_rev3plus(dev); - else - b43_nphy_gain_ctl_workarounds_rev1_2(dev); -} - -/* http://bcm-v4.sipsolutions.net/PHY/N/Read_Lpf_Bw_Ctl */ -static u16 b43_nphy_read_lpf_ctl(struct b43_wldev *dev, u16 offset) -{ - if (!offset) - offset = (dev->phy.is_40mhz) ? 0x159 : 0x154; - return b43_ntab_read(dev, B43_NTAB16(7, offset)) & 0x7; -} - -static void b43_nphy_workarounds_rev7plus(struct b43_wldev *dev) -{ - struct ssb_sprom *sprom = dev->dev->bus_sprom; - struct b43_phy *phy = &dev->phy; - - u8 rx2tx_events_ipa[9] = { 0x0, 0x1, 0x2, 0x8, 0x5, 0x6, 0xF, 0x3, - 0x1F }; - u8 rx2tx_delays_ipa[9] = { 8, 6, 6, 4, 4, 16, 43, 1, 1 }; - - u16 ntab7_15e_16e[] = { 0x10f, 0x10f }; - u8 ntab7_138_146[] = { 0x11, 0x11 }; - u8 ntab7_133[] = { 0x77, 0x11, 0x11 }; - - u16 lpf_20, lpf_40, lpf_11b; - u16 bcap_val, bcap_val_11b, bcap_val_11n_20, bcap_val_11n_40; - u16 scap_val, scap_val_11b, scap_val_11n_20, scap_val_11n_40; - bool rccal_ovrd = false; - - u16 rx2tx_lut_20_11b, rx2tx_lut_20_11n, rx2tx_lut_40_11n; - u16 bias, conv, filt; - - u32 tmp32; - u8 core; - - if (phy->rev == 7) { - b43_phy_set(dev, B43_NPHY_FINERX2_CGC, 0x10); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN0, 0xFF80, 0x0020); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN0, 0x80FF, 0x2700); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN1, 0xFF80, 0x002E); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN1, 0x80FF, 0x3300); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN2, 0xFF80, 0x0037); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN2, 0x80FF, 0x3A00); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN3, 0xFF80, 0x003C); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN3, 0x80FF, 0x3E00); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN4, 0xFF80, 0x003E); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN4, 0x80FF, 0x3F00); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN5, 0xFF80, 0x0040); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN5, 0x80FF, 0x4000); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN6, 0xFF80, 0x0040); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN6, 0x80FF, 0x4000); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN7, 0xFF80, 0x0040); - b43_phy_maskset(dev, B43_NPHY_FREQGAIN7, 0x80FF, 0x4000); - } - if (phy->rev <= 8) { - b43_phy_write(dev, B43_NPHY_FORCEFRONT0, 0x1B0); - b43_phy_write(dev, B43_NPHY_FORCEFRONT1, 0x1B0); - } - if (phy->rev >= 8) - b43_phy_maskset(dev, B43_NPHY_TXTAILCNT, ~0xFF, 0x72); - - b43_ntab_write(dev, B43_NTAB16(8, 0x00), 2); - b43_ntab_write(dev, B43_NTAB16(8, 0x10), 2); - tmp32 = b43_ntab_read(dev, B43_NTAB32(30, 0)); - tmp32 &= 0xffffff; - b43_ntab_write(dev, B43_NTAB32(30, 0), tmp32); - b43_ntab_write_bulk(dev, B43_NTAB16(7, 0x15e), 2, ntab7_15e_16e); - b43_ntab_write_bulk(dev, B43_NTAB16(7, 0x16e), 2, ntab7_15e_16e); - - if (b43_nphy_ipa(dev)) - b43_nphy_set_rf_sequence(dev, 0, rx2tx_events_ipa, - rx2tx_delays_ipa, ARRAY_SIZE(rx2tx_events_ipa)); - - b43_phy_maskset(dev, B43_NPHY_EPS_OVERRIDEI_0, 0x3FFF, 0x4000); - b43_phy_maskset(dev, B43_NPHY_EPS_OVERRIDEI_1, 0x3FFF, 0x4000); - - lpf_20 = b43_nphy_read_lpf_ctl(dev, 0x154); - lpf_40 = b43_nphy_read_lpf_ctl(dev, 0x159); - lpf_11b = b43_nphy_read_lpf_ctl(dev, 0x152); - if (b43_nphy_ipa(dev)) { - if ((phy->radio_rev == 5 && phy->is_40mhz) || - phy->radio_rev == 7 || phy->radio_rev == 8) { - bcap_val = b43_radio_read(dev, 0x16b); - scap_val = b43_radio_read(dev, 0x16a); - scap_val_11b = scap_val; - bcap_val_11b = bcap_val; - if (phy->radio_rev == 5 && phy->is_40mhz) { - scap_val_11n_20 = scap_val; - bcap_val_11n_20 = bcap_val; - scap_val_11n_40 = bcap_val_11n_40 = 0xc; - rccal_ovrd = true; - } else { /* Rev 7/8 */ - lpf_20 = 4; - lpf_11b = 1; - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - scap_val_11n_20 = 0xc; - bcap_val_11n_20 = 0xc; - scap_val_11n_40 = 0xa; - bcap_val_11n_40 = 0xa; - } else { - scap_val_11n_20 = 0x14; - bcap_val_11n_20 = 0x14; - scap_val_11n_40 = 0xf; - bcap_val_11n_40 = 0xf; - } - rccal_ovrd = true; - } - } - } else { - if (phy->radio_rev == 5) { - lpf_20 = 1; - lpf_40 = 3; - bcap_val = b43_radio_read(dev, 0x16b); - scap_val = b43_radio_read(dev, 0x16a); - scap_val_11b = scap_val; - bcap_val_11b = bcap_val; - scap_val_11n_20 = 0x11; - scap_val_11n_40 = 0x11; - bcap_val_11n_20 = 0x13; - bcap_val_11n_40 = 0x13; - rccal_ovrd = true; - } - } - if (rccal_ovrd) { - rx2tx_lut_20_11b = (bcap_val_11b << 8) | - (scap_val_11b << 3) | - lpf_11b; - rx2tx_lut_20_11n = (bcap_val_11n_20 << 8) | - (scap_val_11n_20 << 3) | - lpf_20; - rx2tx_lut_40_11n = (bcap_val_11n_40 << 8) | - (scap_val_11n_40 << 3) | - lpf_40; - for (core = 0; core < 2; core++) { - b43_ntab_write(dev, B43_NTAB16(7, 0x152 + core * 16), - rx2tx_lut_20_11b); - b43_ntab_write(dev, B43_NTAB16(7, 0x153 + core * 16), - rx2tx_lut_20_11n); - b43_ntab_write(dev, B43_NTAB16(7, 0x154 + core * 16), - rx2tx_lut_20_11n); - b43_ntab_write(dev, B43_NTAB16(7, 0x155 + core * 16), - rx2tx_lut_40_11n); - b43_ntab_write(dev, B43_NTAB16(7, 0x156 + core * 16), - rx2tx_lut_40_11n); - b43_ntab_write(dev, B43_NTAB16(7, 0x157 + core * 16), - rx2tx_lut_40_11n); - b43_ntab_write(dev, B43_NTAB16(7, 0x158 + core * 16), - rx2tx_lut_40_11n); - b43_ntab_write(dev, B43_NTAB16(7, 0x159 + core * 16), - rx2tx_lut_40_11n); - } - b43_nphy_rf_ctl_override_rev7(dev, 16, 1, 3, false, 2); - } - b43_phy_write(dev, 0x32F, 0x3); - if (phy->radio_rev == 4 || phy->radio_rev == 6) - b43_nphy_rf_ctl_override_rev7(dev, 4, 1, 3, false, 0); - - if (phy->radio_rev == 3 || phy->radio_rev == 4 || phy->radio_rev == 6) { - if (sprom->revision && - sprom->boardflags2_hi & B43_BFH2_IPALVLSHIFT_3P3) { - b43_radio_write(dev, 0x5, 0x05); - b43_radio_write(dev, 0x6, 0x30); - b43_radio_write(dev, 0x7, 0x00); - b43_radio_set(dev, 0x4f, 0x1); - b43_radio_set(dev, 0xd4, 0x1); - bias = 0x1f; - conv = 0x6f; - filt = 0xaa; - } else { - bias = 0x2b; - conv = 0x7f; - filt = 0xee; - } - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - for (core = 0; core < 2; core++) { - if (core == 0) { - b43_radio_write(dev, 0x5F, bias); - b43_radio_write(dev, 0x64, conv); - b43_radio_write(dev, 0x66, filt); - } else { - b43_radio_write(dev, 0xE8, bias); - b43_radio_write(dev, 0xE9, conv); - b43_radio_write(dev, 0xEB, filt); - } - } - } - } - - if (b43_nphy_ipa(dev)) { - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - if (phy->radio_rev == 3 || phy->radio_rev == 4 || - phy->radio_rev == 6) { - for (core = 0; core < 2; core++) { - if (core == 0) - b43_radio_write(dev, 0x51, - 0x7f); - else - b43_radio_write(dev, 0xd6, - 0x7f); - } - } - if (phy->radio_rev == 3) { - for (core = 0; core < 2; core++) { - if (core == 0) { - b43_radio_write(dev, 0x64, - 0x13); - b43_radio_write(dev, 0x5F, - 0x1F); - b43_radio_write(dev, 0x66, - 0xEE); - b43_radio_write(dev, 0x59, - 0x8A); - b43_radio_write(dev, 0x80, - 0x3E); - } else { - b43_radio_write(dev, 0x69, - 0x13); - b43_radio_write(dev, 0xE8, - 0x1F); - b43_radio_write(dev, 0xEB, - 0xEE); - b43_radio_write(dev, 0xDE, - 0x8A); - b43_radio_write(dev, 0x105, - 0x3E); - } - } - } else if (phy->radio_rev == 7 || phy->radio_rev == 8) { - if (!phy->is_40mhz) { - b43_radio_write(dev, 0x5F, 0x14); - b43_radio_write(dev, 0xE8, 0x12); - } else { - b43_radio_write(dev, 0x5F, 0x16); - b43_radio_write(dev, 0xE8, 0x16); - } - } - } else { - u16 freq = phy->channel_freq; - if ((freq >= 5180 && freq <= 5230) || - (freq >= 5745 && freq <= 5805)) { - b43_radio_write(dev, 0x7D, 0xFF); - b43_radio_write(dev, 0xFE, 0xFF); - } - } - } else { - if (phy->radio_rev != 5) { - for (core = 0; core < 2; core++) { - if (core == 0) { - b43_radio_write(dev, 0x5c, 0x61); - b43_radio_write(dev, 0x51, 0x70); - } else { - b43_radio_write(dev, 0xe1, 0x61); - b43_radio_write(dev, 0xd6, 0x70); - } - } - } - } - - if (phy->radio_rev == 4) { - b43_ntab_write(dev, B43_NTAB16(8, 0x05), 0x20); - b43_ntab_write(dev, B43_NTAB16(8, 0x15), 0x20); - for (core = 0; core < 2; core++) { - if (core == 0) { - b43_radio_write(dev, 0x1a1, 0x00); - b43_radio_write(dev, 0x1a2, 0x3f); - b43_radio_write(dev, 0x1a6, 0x3f); - } else { - b43_radio_write(dev, 0x1a7, 0x00); - b43_radio_write(dev, 0x1ab, 0x3f); - b43_radio_write(dev, 0x1ac, 0x3f); - } - } - } else { - b43_phy_set(dev, B43_NPHY_AFECTL_C1, 0x4); - b43_phy_set(dev, B43_NPHY_AFECTL_OVER1, 0x4); - b43_phy_set(dev, B43_NPHY_AFECTL_C2, 0x4); - b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x4); - - b43_phy_mask(dev, B43_NPHY_AFECTL_C1, ~0x1); - b43_phy_set(dev, B43_NPHY_AFECTL_OVER1, 0x1); - b43_phy_mask(dev, B43_NPHY_AFECTL_C2, ~0x1); - b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x1); - b43_ntab_write(dev, B43_NTAB16(8, 0x05), 0x20); - b43_ntab_write(dev, B43_NTAB16(8, 0x15), 0x20); - - b43_phy_mask(dev, B43_NPHY_AFECTL_C1, ~0x4); - b43_phy_mask(dev, B43_NPHY_AFECTL_OVER1, ~0x4); - b43_phy_mask(dev, B43_NPHY_AFECTL_C2, ~0x4); - b43_phy_mask(dev, B43_NPHY_AFECTL_OVER, ~0x4); - } - - b43_phy_write(dev, B43_NPHY_ENDROP_TLEN, 0x2); - - b43_ntab_write(dev, B43_NTAB32(16, 0x100), 20); - b43_ntab_write_bulk(dev, B43_NTAB16(7, 0x138), 2, ntab7_138_146); - b43_ntab_write(dev, B43_NTAB16(7, 0x141), 0x77); - b43_ntab_write_bulk(dev, B43_NTAB16(7, 0x133), 3, ntab7_133); - b43_ntab_write_bulk(dev, B43_NTAB16(7, 0x146), 2, ntab7_138_146); - b43_ntab_write(dev, B43_NTAB16(7, 0x123), 0x77); - b43_ntab_write(dev, B43_NTAB16(7, 0x12A), 0x77); - - if (!phy->is_40mhz) { - b43_ntab_write(dev, B43_NTAB32(16, 0x03), 0x18D); - b43_ntab_write(dev, B43_NTAB32(16, 0x7F), 0x18D); - } else { - b43_ntab_write(dev, B43_NTAB32(16, 0x03), 0x14D); - b43_ntab_write(dev, B43_NTAB32(16, 0x7F), 0x14D); - } - - b43_nphy_gain_ctl_workarounds(dev); - - /* TODO - b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x08), 4, - aux_adc_vmid_rev7_core0); - b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x18), 4, - aux_adc_vmid_rev7_core1); - b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x0C), 4, - aux_adc_gain_rev7); - b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x1C), 4, - aux_adc_gain_rev7); - */ -} - -static void b43_nphy_workarounds_rev3plus(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - struct ssb_sprom *sprom = dev->dev->bus_sprom; - - /* TX to RX */ - u8 tx2rx_events[8] = { 0x4, 0x3, 0x6, 0x5, 0x2, 0x1, 0x8, 0x1F }; - u8 tx2rx_delays[8] = { 8, 4, 2, 2, 4, 4, 6, 1 }; - /* RX to TX */ - u8 rx2tx_events_ipa[9] = { 0x0, 0x1, 0x2, 0x8, 0x5, 0x6, 0xF, 0x3, - 0x1F }; - u8 rx2tx_delays_ipa[9] = { 8, 6, 6, 4, 4, 16, 43, 1, 1 }; - u8 rx2tx_events[9] = { 0x0, 0x1, 0x2, 0x8, 0x5, 0x6, 0x3, 0x4, 0x1F }; - u8 rx2tx_delays[9] = { 8, 6, 6, 4, 4, 18, 42, 1, 1 }; - - u16 tmp16; - u32 tmp32; - - b43_phy_write(dev, B43_NPHY_FORCEFRONT0, 0x1f8); - b43_phy_write(dev, B43_NPHY_FORCEFRONT1, 0x1f8); - - tmp32 = b43_ntab_read(dev, B43_NTAB32(30, 0)); - tmp32 &= 0xffffff; - b43_ntab_write(dev, B43_NTAB32(30, 0), tmp32); - - b43_phy_write(dev, B43_NPHY_PHASETR_A0, 0x0125); - b43_phy_write(dev, B43_NPHY_PHASETR_A1, 0x01B3); - b43_phy_write(dev, B43_NPHY_PHASETR_A2, 0x0105); - b43_phy_write(dev, B43_NPHY_PHASETR_B0, 0x016E); - b43_phy_write(dev, B43_NPHY_PHASETR_B1, 0x00CD); - b43_phy_write(dev, B43_NPHY_PHASETR_B2, 0x0020); - - b43_phy_write(dev, B43_NPHY_REV3_C1_CLIP_LOGAIN_B, 0x000C); - b43_phy_write(dev, B43_NPHY_REV3_C2_CLIP_LOGAIN_B, 0x000C); - - /* TX to RX */ - b43_nphy_set_rf_sequence(dev, 1, tx2rx_events, tx2rx_delays, - ARRAY_SIZE(tx2rx_events)); - - /* RX to TX */ - if (b43_nphy_ipa(dev)) - b43_nphy_set_rf_sequence(dev, 0, rx2tx_events_ipa, - rx2tx_delays_ipa, ARRAY_SIZE(rx2tx_events_ipa)); - if (nphy->hw_phyrxchain != 3 && - nphy->hw_phyrxchain != nphy->hw_phytxchain) { - if (b43_nphy_ipa(dev)) { - rx2tx_delays[5] = 59; - rx2tx_delays[6] = 1; - rx2tx_events[7] = 0x1F; - } - b43_nphy_set_rf_sequence(dev, 0, rx2tx_events, rx2tx_delays, - ARRAY_SIZE(rx2tx_events)); - } - - tmp16 = (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) ? - 0x2 : 0x9C40; - b43_phy_write(dev, B43_NPHY_ENDROP_TLEN, tmp16); - - b43_phy_maskset(dev, B43_NPHY_SGILTRNOFFSET, 0xF0FF, 0x0700); - - if (!dev->phy.is_40mhz) { - b43_ntab_write(dev, B43_NTAB32(16, 3), 0x18D); - b43_ntab_write(dev, B43_NTAB32(16, 127), 0x18D); - } else { - b43_ntab_write(dev, B43_NTAB32(16, 3), 0x14D); - b43_ntab_write(dev, B43_NTAB32(16, 127), 0x14D); - } - - b43_nphy_gain_ctl_workarounds(dev); - - b43_ntab_write(dev, B43_NTAB16(8, 0), 2); - b43_ntab_write(dev, B43_NTAB16(8, 16), 2); - - /* TODO */ - - b43_radio_write(dev, B2056_RX0 | B2056_RX_MIXA_MAST_BIAS, 0x00); - b43_radio_write(dev, B2056_RX1 | B2056_RX_MIXA_MAST_BIAS, 0x00); - b43_radio_write(dev, B2056_RX0 | B2056_RX_MIXA_BIAS_MAIN, 0x06); - b43_radio_write(dev, B2056_RX1 | B2056_RX_MIXA_BIAS_MAIN, 0x06); - b43_radio_write(dev, B2056_RX0 | B2056_RX_MIXA_BIAS_AUX, 0x07); - b43_radio_write(dev, B2056_RX1 | B2056_RX_MIXA_BIAS_AUX, 0x07); - b43_radio_write(dev, B2056_RX0 | B2056_RX_MIXA_LOB_BIAS, 0x88); - b43_radio_write(dev, B2056_RX1 | B2056_RX_MIXA_LOB_BIAS, 0x88); - b43_radio_write(dev, B2056_RX0 | B2056_RX_MIXA_CMFB_IDAC, 0x00); - b43_radio_write(dev, B2056_RX1 | B2056_RX_MIXA_CMFB_IDAC, 0x00); - b43_radio_write(dev, B2056_RX0 | B2056_RX_MIXG_CMFB_IDAC, 0x00); - b43_radio_write(dev, B2056_RX1 | B2056_RX_MIXG_CMFB_IDAC, 0x00); - - /* N PHY WAR TX Chain Update with hw_phytxchain as argument */ - - if ((sprom->boardflags2_lo & B43_BFL2_APLL_WAR && - b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) || - (sprom->boardflags2_lo & B43_BFL2_GPLL_WAR && - b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)) - tmp32 = 0x00088888; - else - tmp32 = 0x88888888; - b43_ntab_write(dev, B43_NTAB32(30, 1), tmp32); - b43_ntab_write(dev, B43_NTAB32(30, 2), tmp32); - b43_ntab_write(dev, B43_NTAB32(30, 3), tmp32); - - if (dev->phy.rev == 4 && - b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { - b43_radio_write(dev, B2056_TX0 | B2056_TX_GMBB_IDAC, - 0x70); - b43_radio_write(dev, B2056_TX1 | B2056_TX_GMBB_IDAC, - 0x70); - } - - /* Dropped probably-always-true condition */ - b43_phy_write(dev, B43_NPHY_ED_CRS40ASSERTTHRESH0, 0x03eb); - b43_phy_write(dev, B43_NPHY_ED_CRS40ASSERTTHRESH1, 0x03eb); - b43_phy_write(dev, B43_NPHY_ED_CRS40DEASSERTTHRESH1, 0x0341); - b43_phy_write(dev, B43_NPHY_ED_CRS40DEASSERTTHRESH1, 0x0341); - b43_phy_write(dev, B43_NPHY_ED_CRS20LASSERTTHRESH0, 0x042b); - b43_phy_write(dev, B43_NPHY_ED_CRS20LASSERTTHRESH1, 0x042b); - b43_phy_write(dev, B43_NPHY_ED_CRS20LDEASSERTTHRESH0, 0x0381); - b43_phy_write(dev, B43_NPHY_ED_CRS20LDEASSERTTHRESH1, 0x0381); - b43_phy_write(dev, B43_NPHY_ED_CRS20UASSERTTHRESH0, 0x042b); - b43_phy_write(dev, B43_NPHY_ED_CRS20UASSERTTHRESH1, 0x042b); - b43_phy_write(dev, B43_NPHY_ED_CRS20UDEASSERTTHRESH0, 0x0381); - b43_phy_write(dev, B43_NPHY_ED_CRS20UDEASSERTTHRESH1, 0x0381); - - if (dev->phy.rev >= 6 && sprom->boardflags2_lo & B43_BFL2_SINGLEANT_CCK) - ; /* TODO: 0x0080000000000000 HF */ -} - -static void b43_nphy_workarounds_rev1_2(struct b43_wldev *dev) -{ - struct ssb_sprom *sprom = dev->dev->bus_sprom; - struct b43_phy *phy = &dev->phy; - struct b43_phy_n *nphy = phy->n; - - u8 events1[7] = { 0x0, 0x1, 0x2, 0x8, 0x4, 0x5, 0x3 }; - u8 delays1[7] = { 0x8, 0x6, 0x6, 0x2, 0x4, 0x3C, 0x1 }; - - u8 events2[7] = { 0x0, 0x3, 0x5, 0x4, 0x2, 0x1, 0x8 }; - u8 delays2[7] = { 0x8, 0x6, 0x2, 0x4, 0x4, 0x6, 0x1 }; - - if (sprom->boardflags2_lo & B43_BFL2_SKWRKFEM_BRD || - dev->dev->board_type == BCMA_BOARD_TYPE_BCM943224M93) { - delays1[0] = 0x1; - delays1[5] = 0x14; - } - - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ && - nphy->band5g_pwrgain) { - b43_radio_mask(dev, B2055_C1_TX_RF_SPARE, ~0x8); - b43_radio_mask(dev, B2055_C2_TX_RF_SPARE, ~0x8); - } else { - b43_radio_set(dev, B2055_C1_TX_RF_SPARE, 0x8); - b43_radio_set(dev, B2055_C2_TX_RF_SPARE, 0x8); - } - - b43_ntab_write(dev, B43_NTAB16(8, 0x00), 0x000A); - b43_ntab_write(dev, B43_NTAB16(8, 0x10), 0x000A); - if (dev->phy.rev < 3) { - b43_ntab_write(dev, B43_NTAB16(8, 0x02), 0xCDAA); - b43_ntab_write(dev, B43_NTAB16(8, 0x12), 0xCDAA); - } - - if (dev->phy.rev < 2) { - b43_ntab_write(dev, B43_NTAB16(8, 0x08), 0x0000); - b43_ntab_write(dev, B43_NTAB16(8, 0x18), 0x0000); - b43_ntab_write(dev, B43_NTAB16(8, 0x07), 0x7AAB); - b43_ntab_write(dev, B43_NTAB16(8, 0x17), 0x7AAB); - b43_ntab_write(dev, B43_NTAB16(8, 0x06), 0x0800); - b43_ntab_write(dev, B43_NTAB16(8, 0x16), 0x0800); - } - - b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_LO1, 0x2D8); - b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP1, 0x301); - b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_LO2, 0x2D8); - b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP2, 0x301); - - b43_nphy_set_rf_sequence(dev, 0, events1, delays1, 7); - b43_nphy_set_rf_sequence(dev, 1, events2, delays2, 7); - - b43_nphy_gain_ctl_workarounds(dev); - - if (dev->phy.rev < 2) { - if (b43_phy_read(dev, B43_NPHY_RXCTL) & 0x2) - b43_hf_write(dev, b43_hf_read(dev) | - B43_HF_MLADVW); - } else if (dev->phy.rev == 2) { - b43_phy_write(dev, B43_NPHY_CRSCHECK2, 0); - b43_phy_write(dev, B43_NPHY_CRSCHECK3, 0); - } - - if (dev->phy.rev < 2) - b43_phy_mask(dev, B43_NPHY_SCRAM_SIGCTL, - ~B43_NPHY_SCRAM_SIGCTL_SCM); - - /* Set phase track alpha and beta */ - b43_phy_write(dev, B43_NPHY_PHASETR_A0, 0x125); - b43_phy_write(dev, B43_NPHY_PHASETR_A1, 0x1B3); - b43_phy_write(dev, B43_NPHY_PHASETR_A2, 0x105); - b43_phy_write(dev, B43_NPHY_PHASETR_B0, 0x16E); - b43_phy_write(dev, B43_NPHY_PHASETR_B1, 0xCD); - b43_phy_write(dev, B43_NPHY_PHASETR_B2, 0x20); - - if (dev->phy.rev < 3) { - b43_phy_mask(dev, B43_NPHY_PIL_DW1, - ~B43_NPHY_PIL_DW_64QAM & 0xFFFF); - b43_phy_write(dev, B43_NPHY_TXF_20CO_S2B1, 0xB5); - b43_phy_write(dev, B43_NPHY_TXF_20CO_S2B2, 0xA4); - b43_phy_write(dev, B43_NPHY_TXF_20CO_S2B3, 0x00); - } - - if (dev->phy.rev == 2) - b43_phy_set(dev, B43_NPHY_FINERX2_CGC, - B43_NPHY_FINERX2_CGC_DECGC); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/Workarounds */ -static void b43_nphy_workarounds(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_n *nphy = phy->n; - - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) - b43_nphy_classifier(dev, 1, 0); - else - b43_nphy_classifier(dev, 1, 1); - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 1); - - b43_phy_set(dev, B43_NPHY_IQFLIP, - B43_NPHY_IQFLIP_ADC1 | B43_NPHY_IQFLIP_ADC2); - - if (dev->phy.rev >= 7) - b43_nphy_workarounds_rev7plus(dev); - else if (dev->phy.rev >= 3) - b43_nphy_workarounds_rev3plus(dev); - else - b43_nphy_workarounds_rev1_2(dev); - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 0); -} - -/************************************************** - * Tx/Rx common - **************************************************/ - -/* - * Transmits a known value for LO calibration - * http://bcm-v4.sipsolutions.net/802.11/PHY/N/TXTone - */ -static int b43_nphy_tx_tone(struct b43_wldev *dev, u32 freq, u16 max_val, - bool iqmode, bool dac_test) -{ - u16 samp = b43_nphy_gen_load_samples(dev, freq, max_val, dac_test); - if (samp == 0) - return -1; - b43_nphy_run_samples(dev, samp, 0xFFFF, 0, iqmode, dac_test); - return 0; -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/Chains */ -static void b43_nphy_update_txrx_chain(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - - bool override = false; - u16 chain = 0x33; - - if (nphy->txrx_chain == 0) { - chain = 0x11; - override = true; - } else if (nphy->txrx_chain == 1) { - chain = 0x22; - override = true; - } - - b43_phy_maskset(dev, B43_NPHY_RFSEQCA, - ~(B43_NPHY_RFSEQCA_TXEN | B43_NPHY_RFSEQCA_RXEN), - chain); - - if (override) - b43_phy_set(dev, B43_NPHY_RFSEQMODE, - B43_NPHY_RFSEQMODE_CAOVER); - else - b43_phy_mask(dev, B43_NPHY_RFSEQMODE, - ~B43_NPHY_RFSEQMODE_CAOVER); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/stop-playback */ -static void b43_nphy_stop_playback(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - u16 tmp; - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 1); - - tmp = b43_phy_read(dev, B43_NPHY_SAMP_STAT); - if (tmp & 0x1) - b43_phy_set(dev, B43_NPHY_SAMP_CMD, B43_NPHY_SAMP_CMD_STOP); - else if (tmp & 0x2) - b43_phy_mask(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0x7FFF); - - b43_phy_mask(dev, B43_NPHY_SAMP_CMD, ~0x0004); - - if (nphy->bb_mult_save & 0x80000000) { - tmp = nphy->bb_mult_save & 0xFFFF; - b43_ntab_write(dev, B43_NTAB16(15, 87), tmp); - nphy->bb_mult_save = 0; - } - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 0); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/IqCalGainParams */ -static void b43_nphy_iq_cal_gain_params(struct b43_wldev *dev, u16 core, - struct nphy_txgains target, - struct nphy_iqcal_params *params) -{ - int i, j, indx; - u16 gain; - - if (dev->phy.rev >= 3) { - params->txgm = target.txgm[core]; - params->pga = target.pga[core]; - params->pad = target.pad[core]; - params->ipa = target.ipa[core]; - params->cal_gain = (params->txgm << 12) | (params->pga << 8) | - (params->pad << 4) | (params->ipa); - for (j = 0; j < 5; j++) - params->ncorr[j] = 0x79; - } else { - gain = (target.pad[core]) | (target.pga[core] << 4) | - (target.txgm[core] << 8); - - indx = (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ? - 1 : 0; - for (i = 0; i < 9; i++) - if (tbl_iqcal_gainparams[indx][i][0] == gain) - break; - i = min(i, 8); - - params->txgm = tbl_iqcal_gainparams[indx][i][1]; - params->pga = tbl_iqcal_gainparams[indx][i][2]; - params->pad = tbl_iqcal_gainparams[indx][i][3]; - params->cal_gain = (params->txgm << 7) | (params->pga << 4) | - (params->pad << 2); - for (j = 0; j < 4; j++) - params->ncorr[j] = tbl_iqcal_gainparams[indx][i][4 + j]; - } -} - -/************************************************** - * Tx and Rx - **************************************************/ - -static void b43_nphy_op_adjust_txpower(struct b43_wldev *dev) -{//TODO -} - -static enum b43_txpwr_result b43_nphy_op_recalc_txpower(struct b43_wldev *dev, - bool ignore_tssi) -{//TODO - return B43_TXPWR_RES_DONE; -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlEnable */ -static void b43_nphy_tx_power_ctrl(struct b43_wldev *dev, bool enable) -{ - struct b43_phy_n *nphy = dev->phy.n; - u8 i; - u16 bmask, val, tmp; - enum ieee80211_band band = b43_current_band(dev->wl); - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 1); - - nphy->txpwrctrl = enable; - if (!enable) { - if (dev->phy.rev >= 3 && - (b43_phy_read(dev, B43_NPHY_TXPCTL_CMD) & - (B43_NPHY_TXPCTL_CMD_COEFF | - B43_NPHY_TXPCTL_CMD_HWPCTLEN | - B43_NPHY_TXPCTL_CMD_PCTLEN))) { - /* We disable enabled TX pwr ctl, save it's state */ - nphy->tx_pwr_idx[0] = b43_phy_read(dev, - B43_NPHY_C1_TXPCTL_STAT) & 0x7f; - nphy->tx_pwr_idx[1] = b43_phy_read(dev, - B43_NPHY_C2_TXPCTL_STAT) & 0x7f; - } - - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x6840); - for (i = 0; i < 84; i++) - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, 0); - - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x6C40); - for (i = 0; i < 84; i++) - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, 0); - - tmp = B43_NPHY_TXPCTL_CMD_COEFF | B43_NPHY_TXPCTL_CMD_HWPCTLEN; - if (dev->phy.rev >= 3) - tmp |= B43_NPHY_TXPCTL_CMD_PCTLEN; - b43_phy_mask(dev, B43_NPHY_TXPCTL_CMD, ~tmp); - - if (dev->phy.rev >= 3) { - b43_phy_set(dev, B43_NPHY_AFECTL_OVER1, 0x0100); - b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x0100); - } else { - b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x4000); - } - - if (dev->phy.rev == 2) - b43_phy_maskset(dev, B43_NPHY_BPHY_CTL3, - ~B43_NPHY_BPHY_CTL3_SCALE, 0x53); - else if (dev->phy.rev < 2) - b43_phy_maskset(dev, B43_NPHY_BPHY_CTL3, - ~B43_NPHY_BPHY_CTL3_SCALE, 0x5A); - - if (dev->phy.rev < 2 && dev->phy.is_40mhz) - b43_hf_write(dev, b43_hf_read(dev) | B43_HF_TSSIRPSMW); - } else { - b43_ntab_write_bulk(dev, B43_NTAB16(26, 64), 84, - nphy->adj_pwr_tbl); - b43_ntab_write_bulk(dev, B43_NTAB16(27, 64), 84, - nphy->adj_pwr_tbl); - - bmask = B43_NPHY_TXPCTL_CMD_COEFF | - B43_NPHY_TXPCTL_CMD_HWPCTLEN; - /* wl does useless check for "enable" param here */ - val = B43_NPHY_TXPCTL_CMD_COEFF | B43_NPHY_TXPCTL_CMD_HWPCTLEN; - if (dev->phy.rev >= 3) { - bmask |= B43_NPHY_TXPCTL_CMD_PCTLEN; - if (val) - val |= B43_NPHY_TXPCTL_CMD_PCTLEN; - } - b43_phy_maskset(dev, B43_NPHY_TXPCTL_CMD, ~(bmask), val); - - if (band == IEEE80211_BAND_5GHZ) { - b43_phy_maskset(dev, B43_NPHY_TXPCTL_CMD, - ~B43_NPHY_TXPCTL_CMD_INIT, 0x64); - if (dev->phy.rev > 1) - b43_phy_maskset(dev, B43_NPHY_TXPCTL_INIT, - ~B43_NPHY_TXPCTL_INIT_PIDXI1, - 0x64); - } - - if (dev->phy.rev >= 3) { - if (nphy->tx_pwr_idx[0] != 128 && - nphy->tx_pwr_idx[1] != 128) { - /* Recover TX pwr ctl state */ - b43_phy_maskset(dev, B43_NPHY_TXPCTL_CMD, - ~B43_NPHY_TXPCTL_CMD_INIT, - nphy->tx_pwr_idx[0]); - if (dev->phy.rev > 1) - b43_phy_maskset(dev, - B43_NPHY_TXPCTL_INIT, - ~0xff, nphy->tx_pwr_idx[1]); - } - } - - if (dev->phy.rev >= 3) { - b43_phy_mask(dev, B43_NPHY_AFECTL_OVER1, ~0x100); - b43_phy_mask(dev, B43_NPHY_AFECTL_OVER, ~0x100); - } else { - b43_phy_mask(dev, B43_NPHY_AFECTL_OVER, ~0x4000); - } - - if (dev->phy.rev == 2) - b43_phy_maskset(dev, B43_NPHY_BPHY_CTL3, ~0xFF, 0x3b); - else if (dev->phy.rev < 2) - b43_phy_maskset(dev, B43_NPHY_BPHY_CTL3, ~0xFF, 0x40); - - if (dev->phy.rev < 2 && dev->phy.is_40mhz) - b43_hf_write(dev, b43_hf_read(dev) & ~B43_HF_TSSIRPSMW); - - if (b43_nphy_ipa(dev)) { - b43_phy_mask(dev, B43_NPHY_PAPD_EN0, ~0x4); - b43_phy_mask(dev, B43_NPHY_PAPD_EN1, ~0x4); - } - } - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 0); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrFix */ -static void b43_nphy_tx_power_fix(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - struct ssb_sprom *sprom = dev->dev->bus_sprom; - - u8 txpi[2], bbmult, i; - u16 tmp, radio_gain, dac_gain; - u16 freq = dev->phy.channel_freq; - u32 txgain; - /* u32 gaintbl; rev3+ */ - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 1); - - if (dev->phy.rev >= 7) { - txpi[0] = txpi[1] = 30; - } else if (dev->phy.rev >= 3) { - txpi[0] = 40; - txpi[1] = 40; - } else if (sprom->revision < 4) { - txpi[0] = 72; - txpi[1] = 72; - } else { - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - txpi[0] = sprom->txpid2g[0]; - txpi[1] = sprom->txpid2g[1]; - } else if (freq >= 4900 && freq < 5100) { - txpi[0] = sprom->txpid5gl[0]; - txpi[1] = sprom->txpid5gl[1]; - } else if (freq >= 5100 && freq < 5500) { - txpi[0] = sprom->txpid5g[0]; - txpi[1] = sprom->txpid5g[1]; - } else if (freq >= 5500) { - txpi[0] = sprom->txpid5gh[0]; - txpi[1] = sprom->txpid5gh[1]; - } else { - txpi[0] = 91; - txpi[1] = 91; - } - } - if (dev->phy.rev < 7 && - (txpi[0] < 40 || txpi[0] > 100 || txpi[1] < 40 || txpi[1] > 100)) - txpi[0] = txpi[1] = 91; - - /* - for (i = 0; i < 2; i++) { - nphy->txpwrindex[i].index_internal = txpi[i]; - nphy->txpwrindex[i].index_internal_save = txpi[i]; - } - */ - - for (i = 0; i < 2; i++) { - txgain = *(b43_nphy_get_tx_gain_table(dev) + txpi[i]); - - if (dev->phy.rev >= 3) - radio_gain = (txgain >> 16) & 0x1FFFF; - else - radio_gain = (txgain >> 16) & 0x1FFF; - - if (dev->phy.rev >= 7) - dac_gain = (txgain >> 8) & 0x7; - else - dac_gain = (txgain >> 8) & 0x3F; - bbmult = txgain & 0xFF; - - if (dev->phy.rev >= 3) { - if (i == 0) - b43_phy_set(dev, B43_NPHY_AFECTL_OVER1, 0x0100); - else - b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x0100); - } else { - b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x4000); - } - - if (i == 0) - b43_phy_write(dev, B43_NPHY_AFECTL_DACGAIN1, dac_gain); - else - b43_phy_write(dev, B43_NPHY_AFECTL_DACGAIN2, dac_gain); - - b43_ntab_write(dev, B43_NTAB16(0x7, 0x110 + i), radio_gain); - - tmp = b43_ntab_read(dev, B43_NTAB16(0xF, 0x57)); - if (i == 0) - tmp = (tmp & 0x00FF) | (bbmult << 8); - else - tmp = (tmp & 0xFF00) | bbmult; - b43_ntab_write(dev, B43_NTAB16(0xF, 0x57), tmp); - - if (b43_nphy_ipa(dev)) { - u32 tmp32; - u16 reg = (i == 0) ? - B43_NPHY_PAPD_EN0 : B43_NPHY_PAPD_EN1; - tmp32 = b43_ntab_read(dev, B43_NTAB32(26 + i, - 576 + txpi[i])); - b43_phy_maskset(dev, reg, 0xE00F, (u32) tmp32 << 4); - b43_phy_set(dev, reg, 0x4); - } - } - - b43_phy_mask(dev, B43_NPHY_BPHY_CTL2, ~B43_NPHY_BPHY_CTL2_LUT); - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 0); -} - -static void b43_nphy_ipa_internal_tssi_setup(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - - u8 core; - u16 r; /* routing */ - - if (phy->rev >= 7) { - for (core = 0; core < 2; core++) { - r = core ? 0x190 : 0x170; - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - b43_radio_write(dev, r + 0x5, 0x5); - b43_radio_write(dev, r + 0x9, 0xE); - if (phy->rev != 5) - b43_radio_write(dev, r + 0xA, 0); - if (phy->rev != 7) - b43_radio_write(dev, r + 0xB, 1); - else - b43_radio_write(dev, r + 0xB, 0x31); - } else { - b43_radio_write(dev, r + 0x5, 0x9); - b43_radio_write(dev, r + 0x9, 0xC); - b43_radio_write(dev, r + 0xB, 0x0); - if (phy->rev != 5) - b43_radio_write(dev, r + 0xA, 1); - else - b43_radio_write(dev, r + 0xA, 0x31); - } - b43_radio_write(dev, r + 0x6, 0); - b43_radio_write(dev, r + 0x7, 0); - b43_radio_write(dev, r + 0x8, 3); - b43_radio_write(dev, r + 0xC, 0); - } - } else { - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - b43_radio_write(dev, B2056_SYN_RESERVED_ADDR31, 0x128); - else - b43_radio_write(dev, B2056_SYN_RESERVED_ADDR31, 0x80); - b43_radio_write(dev, B2056_SYN_RESERVED_ADDR30, 0); - b43_radio_write(dev, B2056_SYN_GPIO_MASTER1, 0x29); - - for (core = 0; core < 2; core++) { - r = core ? B2056_TX1 : B2056_TX0; - - b43_radio_write(dev, r | B2056_TX_IQCAL_VCM_HG, 0); - b43_radio_write(dev, r | B2056_TX_IQCAL_IDAC, 0); - b43_radio_write(dev, r | B2056_TX_TSSI_VCM, 3); - b43_radio_write(dev, r | B2056_TX_TX_AMP_DET, 0); - b43_radio_write(dev, r | B2056_TX_TSSI_MISC1, 8); - b43_radio_write(dev, r | B2056_TX_TSSI_MISC2, 0); - b43_radio_write(dev, r | B2056_TX_TSSI_MISC3, 0); - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - b43_radio_write(dev, r | B2056_TX_TX_SSI_MASTER, - 0x5); - if (phy->rev != 5) - b43_radio_write(dev, r | B2056_TX_TSSIA, - 0x00); - if (phy->rev >= 5) - b43_radio_write(dev, r | B2056_TX_TSSIG, - 0x31); - else - b43_radio_write(dev, r | B2056_TX_TSSIG, - 0x11); - b43_radio_write(dev, r | B2056_TX_TX_SSI_MUX, - 0xE); - } else { - b43_radio_write(dev, r | B2056_TX_TX_SSI_MASTER, - 0x9); - b43_radio_write(dev, r | B2056_TX_TSSIA, 0x31); - b43_radio_write(dev, r | B2056_TX_TSSIG, 0x0); - b43_radio_write(dev, r | B2056_TX_TX_SSI_MUX, - 0xC); - } - } - } -} - -/* - * Stop radio and transmit known signal. Then check received signal strength to - * get TSSI (Transmit Signal Strength Indicator). - * http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlIdleTssi - */ -static void b43_nphy_tx_power_ctl_idle_tssi(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_n *nphy = dev->phy.n; - - u32 tmp; - s32 rssi[4] = { }; - - /* TODO: check if we can transmit */ - - if (b43_nphy_ipa(dev)) - b43_nphy_ipa_internal_tssi_setup(dev); - - if (phy->rev >= 7) - b43_nphy_rf_ctl_override_rev7(dev, 0x2000, 0, 3, false, 0); - else if (phy->rev >= 3) - b43_nphy_rf_ctl_override(dev, 0x2000, 0, 3, false); - - b43_nphy_stop_playback(dev); - b43_nphy_tx_tone(dev, 0xFA0, 0, false, false); - udelay(20); - tmp = b43_nphy_poll_rssi(dev, N_RSSI_TSSI_2G, rssi, 1); - b43_nphy_stop_playback(dev); - b43_nphy_rssi_select(dev, 0, N_RSSI_W1); - - if (phy->rev >= 7) - b43_nphy_rf_ctl_override_rev7(dev, 0x2000, 0, 3, true, 0); - else if (phy->rev >= 3) - b43_nphy_rf_ctl_override(dev, 0x2000, 0, 3, true); - - if (phy->rev >= 3) { - nphy->pwr_ctl_info[0].idle_tssi_5g = (tmp >> 24) & 0xFF; - nphy->pwr_ctl_info[1].idle_tssi_5g = (tmp >> 8) & 0xFF; - } else { - nphy->pwr_ctl_info[0].idle_tssi_5g = (tmp >> 16) & 0xFF; - nphy->pwr_ctl_info[1].idle_tssi_5g = tmp & 0xFF; - } - nphy->pwr_ctl_info[0].idle_tssi_2g = (tmp >> 24) & 0xFF; - nphy->pwr_ctl_info[1].idle_tssi_2g = (tmp >> 8) & 0xFF; -} - -/* http://bcm-v4.sipsolutions.net/PHY/N/TxPwrLimitToTbl */ -static void b43_nphy_tx_prepare_adjusted_power_table(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - - u8 idx, delta; - u8 i, stf_mode; - - for (i = 0; i < 4; i++) - nphy->adj_pwr_tbl[i] = nphy->tx_power_offset[i]; - - for (stf_mode = 0; stf_mode < 4; stf_mode++) { - delta = 0; - switch (stf_mode) { - case 0: - if (dev->phy.is_40mhz && dev->phy.rev >= 5) { - idx = 68; - } else { - delta = 1; - idx = dev->phy.is_40mhz ? 52 : 4; - } - break; - case 1: - idx = dev->phy.is_40mhz ? 76 : 28; - break; - case 2: - idx = dev->phy.is_40mhz ? 84 : 36; - break; - case 3: - idx = dev->phy.is_40mhz ? 92 : 44; - break; - } - - for (i = 0; i < 20; i++) { - nphy->adj_pwr_tbl[4 + 4 * i + stf_mode] = - nphy->tx_power_offset[idx]; - if (i == 0) - idx += delta; - if (i == 14) - idx += 1 - delta; - if (i == 3 || i == 4 || i == 7 || i == 8 || i == 11 || - i == 13) - idx += 1; - } - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlSetup */ -static void b43_nphy_tx_power_ctl_setup(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - struct ssb_sprom *sprom = dev->dev->bus_sprom; - - s16 a1[2], b0[2], b1[2]; - u8 idle[2]; - s8 target[2]; - s32 num, den, pwr; - u32 regval[64]; - - u16 freq = dev->phy.channel_freq; - u16 tmp; - u16 r; /* routing */ - u8 i, c; - - if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) { - b43_maskset32(dev, B43_MMIO_MACCTL, ~0, 0x200000); - b43_read32(dev, B43_MMIO_MACCTL); - udelay(1); - } - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, true); - - b43_phy_set(dev, B43_NPHY_TSSIMODE, B43_NPHY_TSSIMODE_EN); - if (dev->phy.rev >= 3) - b43_phy_mask(dev, B43_NPHY_TXPCTL_CMD, - ~B43_NPHY_TXPCTL_CMD_PCTLEN & 0xFFFF); - else - b43_phy_set(dev, B43_NPHY_TXPCTL_CMD, - B43_NPHY_TXPCTL_CMD_PCTLEN); - - if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) - b43_maskset32(dev, B43_MMIO_MACCTL, ~0x200000, 0); - - if (sprom->revision < 4) { - idle[0] = nphy->pwr_ctl_info[0].idle_tssi_2g; - idle[1] = nphy->pwr_ctl_info[1].idle_tssi_2g; - target[0] = target[1] = 52; - a1[0] = a1[1] = -424; - b0[0] = b0[1] = 5612; - b1[0] = b1[1] = -1393; - } else { - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - for (c = 0; c < 2; c++) { - idle[c] = nphy->pwr_ctl_info[c].idle_tssi_2g; - target[c] = sprom->core_pwr_info[c].maxpwr_2g; - a1[c] = sprom->core_pwr_info[c].pa_2g[0]; - b0[c] = sprom->core_pwr_info[c].pa_2g[1]; - b1[c] = sprom->core_pwr_info[c].pa_2g[2]; - } - } else if (freq >= 4900 && freq < 5100) { - for (c = 0; c < 2; c++) { - idle[c] = nphy->pwr_ctl_info[c].idle_tssi_5g; - target[c] = sprom->core_pwr_info[c].maxpwr_5gl; - a1[c] = sprom->core_pwr_info[c].pa_5gl[0]; - b0[c] = sprom->core_pwr_info[c].pa_5gl[1]; - b1[c] = sprom->core_pwr_info[c].pa_5gl[2]; - } - } else if (freq >= 5100 && freq < 5500) { - for (c = 0; c < 2; c++) { - idle[c] = nphy->pwr_ctl_info[c].idle_tssi_5g; - target[c] = sprom->core_pwr_info[c].maxpwr_5g; - a1[c] = sprom->core_pwr_info[c].pa_5g[0]; - b0[c] = sprom->core_pwr_info[c].pa_5g[1]; - b1[c] = sprom->core_pwr_info[c].pa_5g[2]; - } - } else if (freq >= 5500) { - for (c = 0; c < 2; c++) { - idle[c] = nphy->pwr_ctl_info[c].idle_tssi_5g; - target[c] = sprom->core_pwr_info[c].maxpwr_5gh; - a1[c] = sprom->core_pwr_info[c].pa_5gh[0]; - b0[c] = sprom->core_pwr_info[c].pa_5gh[1]; - b1[c] = sprom->core_pwr_info[c].pa_5gh[2]; - } - } else { - idle[0] = nphy->pwr_ctl_info[0].idle_tssi_5g; - idle[1] = nphy->pwr_ctl_info[1].idle_tssi_5g; - target[0] = target[1] = 52; - a1[0] = a1[1] = -424; - b0[0] = b0[1] = 5612; - b1[0] = b1[1] = -1393; - } - } - /* target[0] = target[1] = nphy->tx_power_max; */ - - if (dev->phy.rev >= 3) { - if (sprom->fem.ghz2.tssipos) - b43_phy_set(dev, B43_NPHY_TXPCTL_ITSSI, 0x4000); - if (dev->phy.rev >= 7) { - for (c = 0; c < 2; c++) { - r = c ? 0x190 : 0x170; - if (b43_nphy_ipa(dev)) - b43_radio_write(dev, r + 0x9, (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) ? 0xE : 0xC); - } - } else { - if (b43_nphy_ipa(dev)) { - tmp = (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ? 0xC : 0xE; - b43_radio_write(dev, - B2056_TX0 | B2056_TX_TX_SSI_MUX, tmp); - b43_radio_write(dev, - B2056_TX1 | B2056_TX_TX_SSI_MUX, tmp); - } else { - b43_radio_write(dev, - B2056_TX0 | B2056_TX_TX_SSI_MUX, 0x11); - b43_radio_write(dev, - B2056_TX1 | B2056_TX_TX_SSI_MUX, 0x11); - } - } - } - - if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) { - b43_maskset32(dev, B43_MMIO_MACCTL, ~0, 0x200000); - b43_read32(dev, B43_MMIO_MACCTL); - udelay(1); - } - - if (dev->phy.rev >= 7) { - b43_phy_maskset(dev, B43_NPHY_TXPCTL_CMD, - ~B43_NPHY_TXPCTL_CMD_INIT, 0x19); - b43_phy_maskset(dev, B43_NPHY_TXPCTL_INIT, - ~B43_NPHY_TXPCTL_INIT_PIDXI1, 0x19); - } else { - b43_phy_maskset(dev, B43_NPHY_TXPCTL_CMD, - ~B43_NPHY_TXPCTL_CMD_INIT, 0x40); - if (dev->phy.rev > 1) - b43_phy_maskset(dev, B43_NPHY_TXPCTL_INIT, - ~B43_NPHY_TXPCTL_INIT_PIDXI1, 0x40); - } - - if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) - b43_maskset32(dev, B43_MMIO_MACCTL, ~0x200000, 0); - - b43_phy_write(dev, B43_NPHY_TXPCTL_N, - 0xF0 << B43_NPHY_TXPCTL_N_TSSID_SHIFT | - 3 << B43_NPHY_TXPCTL_N_NPTIL2_SHIFT); - b43_phy_write(dev, B43_NPHY_TXPCTL_ITSSI, - idle[0] << B43_NPHY_TXPCTL_ITSSI_0_SHIFT | - idle[1] << B43_NPHY_TXPCTL_ITSSI_1_SHIFT | - B43_NPHY_TXPCTL_ITSSI_BINF); - b43_phy_write(dev, B43_NPHY_TXPCTL_TPWR, - target[0] << B43_NPHY_TXPCTL_TPWR_0_SHIFT | - target[1] << B43_NPHY_TXPCTL_TPWR_1_SHIFT); - - for (c = 0; c < 2; c++) { - for (i = 0; i < 64; i++) { - num = 8 * (16 * b0[c] + b1[c] * i); - den = 32768 + a1[c] * i; - pwr = max((4 * num + den / 2) / den, -8); - if (dev->phy.rev < 3 && (i <= (31 - idle[c] + 1))) - pwr = max(pwr, target[c] + 1); - regval[i] = pwr; - } - b43_ntab_write_bulk(dev, B43_NTAB32(26 + c, 0), 64, regval); - } - - b43_nphy_tx_prepare_adjusted_power_table(dev); - /* - b43_ntab_write_bulk(dev, B43_NTAB16(26, 64), 84, nphy->adj_pwr_tbl); - b43_ntab_write_bulk(dev, B43_NTAB16(27, 64), 84, nphy->adj_pwr_tbl); - */ - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, false); -} - -static void b43_nphy_tx_gain_table_upload(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - - const u32 *table = NULL; - u32 rfpwr_offset; - u8 pga_gain; - int i; - - table = b43_nphy_get_tx_gain_table(dev); - b43_ntab_write_bulk(dev, B43_NTAB32(26, 192), 128, table); - b43_ntab_write_bulk(dev, B43_NTAB32(27, 192), 128, table); - - if (phy->rev >= 3) { -#if 0 - nphy->gmval = (table[0] >> 16) & 0x7000; -#endif - - for (i = 0; i < 128; i++) { - pga_gain = (table[i] >> 24) & 0xF; - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - rfpwr_offset = - b43_ntab_papd_pga_gain_delta_ipa_2g[pga_gain]; - else - rfpwr_offset = - 0; /* FIXME */ - b43_ntab_write(dev, B43_NTAB32(26, 576 + i), - rfpwr_offset); - b43_ntab_write(dev, B43_NTAB32(27, 576 + i), - rfpwr_offset); - } - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/PA%20override */ -static void b43_nphy_pa_override(struct b43_wldev *dev, bool enable) -{ - struct b43_phy_n *nphy = dev->phy.n; - enum ieee80211_band band; - u16 tmp; - - if (!enable) { - nphy->rfctrl_intc1_save = b43_phy_read(dev, - B43_NPHY_RFCTL_INTC1); - nphy->rfctrl_intc2_save = b43_phy_read(dev, - B43_NPHY_RFCTL_INTC2); - band = b43_current_band(dev->wl); - if (dev->phy.rev >= 3) { - if (band == IEEE80211_BAND_5GHZ) - tmp = 0x600; - else - tmp = 0x480; - } else { - if (band == IEEE80211_BAND_5GHZ) - tmp = 0x180; - else - tmp = 0x120; - } - b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, tmp); - b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, tmp); - } else { - b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, - nphy->rfctrl_intc1_save); - b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, - nphy->rfctrl_intc2_save); - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxLpFbw */ -static void b43_nphy_tx_lp_fbw(struct b43_wldev *dev) -{ - u16 tmp; - - if (dev->phy.rev >= 3) { - if (b43_nphy_ipa(dev)) { - tmp = 4; - b43_phy_write(dev, B43_NPHY_TXF_40CO_B32S2, - (((((tmp << 3) | tmp) << 3) | tmp) << 3) | tmp); - } - - tmp = 1; - b43_phy_write(dev, B43_NPHY_TXF_40CO_B1S2, - (((((tmp << 3) | tmp) << 3) | tmp) << 3) | tmp); - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxIqEst */ -static void b43_nphy_rx_iq_est(struct b43_wldev *dev, struct nphy_iq_est *est, - u16 samps, u8 time, bool wait) -{ - int i; - u16 tmp; - - b43_phy_write(dev, B43_NPHY_IQEST_SAMCNT, samps); - b43_phy_maskset(dev, B43_NPHY_IQEST_WT, ~B43_NPHY_IQEST_WT_VAL, time); - if (wait) - b43_phy_set(dev, B43_NPHY_IQEST_CMD, B43_NPHY_IQEST_CMD_MODE); - else - b43_phy_mask(dev, B43_NPHY_IQEST_CMD, ~B43_NPHY_IQEST_CMD_MODE); - - b43_phy_set(dev, B43_NPHY_IQEST_CMD, B43_NPHY_IQEST_CMD_START); - - for (i = 1000; i; i--) { - tmp = b43_phy_read(dev, B43_NPHY_IQEST_CMD); - if (!(tmp & B43_NPHY_IQEST_CMD_START)) { - est->i0_pwr = (b43_phy_read(dev, B43_NPHY_IQEST_IPACC_HI0) << 16) | - b43_phy_read(dev, B43_NPHY_IQEST_IPACC_LO0); - est->q0_pwr = (b43_phy_read(dev, B43_NPHY_IQEST_QPACC_HI0) << 16) | - b43_phy_read(dev, B43_NPHY_IQEST_QPACC_LO0); - est->iq0_prod = (b43_phy_read(dev, B43_NPHY_IQEST_IQACC_HI0) << 16) | - b43_phy_read(dev, B43_NPHY_IQEST_IQACC_LO0); - - est->i1_pwr = (b43_phy_read(dev, B43_NPHY_IQEST_IPACC_HI1) << 16) | - b43_phy_read(dev, B43_NPHY_IQEST_IPACC_LO1); - est->q1_pwr = (b43_phy_read(dev, B43_NPHY_IQEST_QPACC_HI1) << 16) | - b43_phy_read(dev, B43_NPHY_IQEST_QPACC_LO1); - est->iq1_prod = (b43_phy_read(dev, B43_NPHY_IQEST_IQACC_HI1) << 16) | - b43_phy_read(dev, B43_NPHY_IQEST_IQACC_LO1); - return; - } - udelay(10); - } - memset(est, 0, sizeof(*est)); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxIqCoeffs */ -static void b43_nphy_rx_iq_coeffs(struct b43_wldev *dev, bool write, - struct b43_phy_n_iq_comp *pcomp) -{ - if (write) { - b43_phy_write(dev, B43_NPHY_C1_RXIQ_COMPA0, pcomp->a0); - b43_phy_write(dev, B43_NPHY_C1_RXIQ_COMPB0, pcomp->b0); - b43_phy_write(dev, B43_NPHY_C2_RXIQ_COMPA1, pcomp->a1); - b43_phy_write(dev, B43_NPHY_C2_RXIQ_COMPB1, pcomp->b1); - } else { - pcomp->a0 = b43_phy_read(dev, B43_NPHY_C1_RXIQ_COMPA0); - pcomp->b0 = b43_phy_read(dev, B43_NPHY_C1_RXIQ_COMPB0); - pcomp->a1 = b43_phy_read(dev, B43_NPHY_C2_RXIQ_COMPA1); - pcomp->b1 = b43_phy_read(dev, B43_NPHY_C2_RXIQ_COMPB1); - } -} - -#if 0 -/* Ready but not used anywhere */ -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCalPhyCleanup */ -static void b43_nphy_rx_cal_phy_cleanup(struct b43_wldev *dev, u8 core) -{ - u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs; - - b43_phy_write(dev, B43_NPHY_RFSEQCA, regs[0]); - if (core == 0) { - b43_phy_write(dev, B43_NPHY_AFECTL_C1, regs[1]); - b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, regs[2]); - } else { - b43_phy_write(dev, B43_NPHY_AFECTL_C2, regs[1]); - b43_phy_write(dev, B43_NPHY_AFECTL_OVER, regs[2]); - } - b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, regs[3]); - b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, regs[4]); - b43_phy_write(dev, B43_NPHY_RFCTL_RSSIO1, regs[5]); - b43_phy_write(dev, B43_NPHY_RFCTL_RSSIO2, regs[6]); - b43_phy_write(dev, B43_NPHY_TXF_40CO_B1S1, regs[7]); - b43_phy_write(dev, B43_NPHY_RFCTL_OVER, regs[8]); - b43_phy_write(dev, B43_NPHY_PAPD_EN0, regs[9]); - b43_phy_write(dev, B43_NPHY_PAPD_EN1, regs[10]); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCalPhySetup */ -static void b43_nphy_rx_cal_phy_setup(struct b43_wldev *dev, u8 core) -{ - u8 rxval, txval; - u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs; - - regs[0] = b43_phy_read(dev, B43_NPHY_RFSEQCA); - if (core == 0) { - regs[1] = b43_phy_read(dev, B43_NPHY_AFECTL_C1); - regs[2] = b43_phy_read(dev, B43_NPHY_AFECTL_OVER1); - } else { - regs[1] = b43_phy_read(dev, B43_NPHY_AFECTL_C2); - regs[2] = b43_phy_read(dev, B43_NPHY_AFECTL_OVER); - } - regs[3] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1); - regs[4] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2); - regs[5] = b43_phy_read(dev, B43_NPHY_RFCTL_RSSIO1); - regs[6] = b43_phy_read(dev, B43_NPHY_RFCTL_RSSIO2); - regs[7] = b43_phy_read(dev, B43_NPHY_TXF_40CO_B1S1); - regs[8] = b43_phy_read(dev, B43_NPHY_RFCTL_OVER); - regs[9] = b43_phy_read(dev, B43_NPHY_PAPD_EN0); - regs[10] = b43_phy_read(dev, B43_NPHY_PAPD_EN1); - - b43_phy_mask(dev, B43_NPHY_PAPD_EN0, ~0x0001); - b43_phy_mask(dev, B43_NPHY_PAPD_EN1, ~0x0001); - - b43_phy_maskset(dev, B43_NPHY_RFSEQCA, - ~B43_NPHY_RFSEQCA_RXDIS & 0xFFFF, - ((1 - core) << B43_NPHY_RFSEQCA_RXDIS_SHIFT)); - b43_phy_maskset(dev, B43_NPHY_RFSEQCA, ~B43_NPHY_RFSEQCA_TXEN, - ((1 - core) << B43_NPHY_RFSEQCA_TXEN_SHIFT)); - b43_phy_maskset(dev, B43_NPHY_RFSEQCA, ~B43_NPHY_RFSEQCA_RXEN, - (core << B43_NPHY_RFSEQCA_RXEN_SHIFT)); - b43_phy_maskset(dev, B43_NPHY_RFSEQCA, ~B43_NPHY_RFSEQCA_TXDIS, - (core << B43_NPHY_RFSEQCA_TXDIS_SHIFT)); - - if (core == 0) { - b43_phy_mask(dev, B43_NPHY_AFECTL_C1, ~0x0007); - b43_phy_set(dev, B43_NPHY_AFECTL_OVER1, 0x0007); - } else { - b43_phy_mask(dev, B43_NPHY_AFECTL_C2, ~0x0007); - b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x0007); - } - - b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_PA, 0, 3); - b43_nphy_rf_ctl_override(dev, 8, 0, 3, false); - b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RX2TX); - - if (core == 0) { - rxval = 1; - txval = 8; - } else { - rxval = 4; - txval = 2; - } - b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_TRSW, rxval, - core + 1); - b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_TRSW, txval, - 2 - core); -} -#endif - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalcRxIqComp */ -static void b43_nphy_calc_rx_iq_comp(struct b43_wldev *dev, u8 mask) -{ - int i; - s32 iq; - u32 ii; - u32 qq; - int iq_nbits, qq_nbits; - int arsh, brsh; - u16 tmp, a, b; - - struct nphy_iq_est est; - struct b43_phy_n_iq_comp old; - struct b43_phy_n_iq_comp new = { }; - bool error = false; - - if (mask == 0) - return; - - b43_nphy_rx_iq_coeffs(dev, false, &old); - b43_nphy_rx_iq_coeffs(dev, true, &new); - b43_nphy_rx_iq_est(dev, &est, 0x4000, 32, false); - new = old; - - for (i = 0; i < 2; i++) { - if (i == 0 && (mask & 1)) { - iq = est.iq0_prod; - ii = est.i0_pwr; - qq = est.q0_pwr; - } else if (i == 1 && (mask & 2)) { - iq = est.iq1_prod; - ii = est.i1_pwr; - qq = est.q1_pwr; - } else { - continue; - } - - if (ii + qq < 2) { - error = true; - break; - } - - iq_nbits = fls(abs(iq)); - qq_nbits = fls(qq); - - arsh = iq_nbits - 20; - if (arsh >= 0) { - a = -((iq << (30 - iq_nbits)) + (ii >> (1 + arsh))); - tmp = ii >> arsh; - } else { - a = -((iq << (30 - iq_nbits)) + (ii << (-1 - arsh))); - tmp = ii << -arsh; - } - if (tmp == 0) { - error = true; - break; - } - a /= tmp; - - brsh = qq_nbits - 11; - if (brsh >= 0) { - b = (qq << (31 - qq_nbits)); - tmp = ii >> brsh; - } else { - b = (qq << (31 - qq_nbits)); - tmp = ii << -brsh; - } - if (tmp == 0) { - error = true; - break; - } - b = int_sqrt(b / tmp - a * a) - (1 << 10); - - if (i == 0 && (mask & 0x1)) { - if (dev->phy.rev >= 3) { - new.a0 = a & 0x3FF; - new.b0 = b & 0x3FF; - } else { - new.a0 = b & 0x3FF; - new.b0 = a & 0x3FF; - } - } else if (i == 1 && (mask & 0x2)) { - if (dev->phy.rev >= 3) { - new.a1 = a & 0x3FF; - new.b1 = b & 0x3FF; - } else { - new.a1 = b & 0x3FF; - new.b1 = a & 0x3FF; - } - } - } - - if (error) - new = old; - - b43_nphy_rx_iq_coeffs(dev, true, &new); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxIqWar */ -static void b43_nphy_tx_iq_workaround(struct b43_wldev *dev) -{ - u16 array[4]; - b43_ntab_read_bulk(dev, B43_NTAB16(0xF, 0x50), 4, array); - - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_NPHY_TXIQW0, array[0]); - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_NPHY_TXIQW1, array[1]); - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_NPHY_TXIQW2, array[2]); - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_NPHY_TXIQW3, array[3]); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SpurWar */ -static void b43_nphy_spur_workaround(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - - u8 channel = dev->phy.channel; - int tone[2] = { 57, 58 }; - u32 noise[2] = { 0x3FF, 0x3FF }; - - B43_WARN_ON(dev->phy.rev < 3); - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 1); - - if (nphy->gband_spurwar_en) { - /* TODO: N PHY Adjust Analog Pfbw (7) */ - if (channel == 11 && dev->phy.is_40mhz) - ; /* TODO: N PHY Adjust Min Noise Var(2, tone, noise)*/ - else - ; /* TODO: N PHY Adjust Min Noise Var(0, NULL, NULL)*/ - /* TODO: N PHY Adjust CRS Min Power (0x1E) */ - } - - if (nphy->aband_spurwar_en) { - if (channel == 54) { - tone[0] = 0x20; - noise[0] = 0x25F; - } else if (channel == 38 || channel == 102 || channel == 118) { - if (0 /* FIXME */) { - tone[0] = 0x20; - noise[0] = 0x21F; - } else { - tone[0] = 0; - noise[0] = 0; - } - } else if (channel == 134) { - tone[0] = 0x20; - noise[0] = 0x21F; - } else if (channel == 151) { - tone[0] = 0x10; - noise[0] = 0x23F; - } else if (channel == 153 || channel == 161) { - tone[0] = 0x30; - noise[0] = 0x23F; - } else { - tone[0] = 0; - noise[0] = 0; - } - - if (!tone[0] && !noise[0]) - ; /* TODO: N PHY Adjust Min Noise Var(1, tone, noise)*/ - else - ; /* TODO: N PHY Adjust Min Noise Var(0, NULL, NULL)*/ - } - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 0); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlCoefSetup */ -static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - int i, j; - u32 tmp; - u32 cur_real, cur_imag, real_part, imag_part; - - u16 buffer[7]; - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, true); - - b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 7, buffer); - - for (i = 0; i < 2; i++) { - tmp = ((buffer[i * 2] & 0x3FF) << 10) | - (buffer[i * 2 + 1] & 0x3FF); - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, - (((i + 26) << 10) | 320)); - for (j = 0; j < 128; j++) { - b43_phy_write(dev, B43_NPHY_TABLE_DATAHI, - ((tmp >> 16) & 0xFFFF)); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, - (tmp & 0xFFFF)); - } - } - - for (i = 0; i < 2; i++) { - tmp = buffer[5 + i]; - real_part = (tmp >> 8) & 0xFF; - imag_part = (tmp & 0xFF); - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, - (((i + 26) << 10) | 448)); - - if (dev->phy.rev >= 3) { - cur_real = real_part; - cur_imag = imag_part; - tmp = ((cur_real & 0xFF) << 8) | (cur_imag & 0xFF); - } - - for (j = 0; j < 128; j++) { - if (dev->phy.rev < 3) { - cur_real = (real_part * loscale[j] + 128) >> 8; - cur_imag = (imag_part * loscale[j] + 128) >> 8; - tmp = ((cur_real & 0xFF) << 8) | - (cur_imag & 0xFF); - } - b43_phy_write(dev, B43_NPHY_TABLE_DATAHI, - ((tmp >> 16) & 0xFFFF)); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, - (tmp & 0xFFFF)); - } - } - - if (dev->phy.rev >= 3) { - b43_shm_write16(dev, B43_SHM_SHARED, - B43_SHM_SH_NPHY_TXPWR_INDX0, 0xFFFF); - b43_shm_write16(dev, B43_SHM_SHARED, - B43_SHM_SH_NPHY_TXPWR_INDX1, 0xFFFF); - } - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, false); -} - -/* - * Restore RSSI Calibration - * http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreRssiCal - */ -static void b43_nphy_restore_rssi_cal(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - - u16 *rssical_radio_regs = NULL; - u16 *rssical_phy_regs = NULL; - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - if (!nphy->rssical_chanspec_2G.center_freq) - return; - rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_2G; - rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_2G; - } else { - if (!nphy->rssical_chanspec_5G.center_freq) - return; - rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_5G; - rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_5G; - } - - if (dev->phy.rev >= 7) { - } else { - b43_radio_maskset(dev, B2056_RX0 | B2056_RX_RSSI_MISC, 0xE3, - rssical_radio_regs[0]); - b43_radio_maskset(dev, B2056_RX1 | B2056_RX_RSSI_MISC, 0xE3, - rssical_radio_regs[1]); - } - - b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_Z, rssical_phy_regs[0]); - b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_Z, rssical_phy_regs[1]); - b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_Z, rssical_phy_regs[2]); - b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_Z, rssical_phy_regs[3]); - - b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_X, rssical_phy_regs[4]); - b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_X, rssical_phy_regs[5]); - b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_X, rssical_phy_regs[6]); - b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_X, rssical_phy_regs[7]); - - b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_Y, rssical_phy_regs[8]); - b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_Y, rssical_phy_regs[9]); - b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_Y, rssical_phy_regs[10]); - b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_Y, rssical_phy_regs[11]); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalRadioSetup */ -static void b43_nphy_tx_cal_radio_setup(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - u16 *save = nphy->tx_rx_cal_radio_saveregs; - u16 tmp; - u8 offset, i; - - if (dev->phy.rev >= 3) { - for (i = 0; i < 2; i++) { - tmp = (i == 0) ? 0x2000 : 0x3000; - offset = i * 11; - - save[offset + 0] = b43_radio_read(dev, B2055_CAL_RVARCTL); - save[offset + 1] = b43_radio_read(dev, B2055_CAL_LPOCTL); - save[offset + 2] = b43_radio_read(dev, B2055_CAL_TS); - save[offset + 3] = b43_radio_read(dev, B2055_CAL_RCCALRTS); - save[offset + 4] = b43_radio_read(dev, B2055_CAL_RCALRTS); - save[offset + 5] = b43_radio_read(dev, B2055_PADDRV); - save[offset + 6] = b43_radio_read(dev, B2055_XOCTL1); - save[offset + 7] = b43_radio_read(dev, B2055_XOCTL2); - save[offset + 8] = b43_radio_read(dev, B2055_XOREGUL); - save[offset + 9] = b43_radio_read(dev, B2055_XOMISC); - save[offset + 10] = b43_radio_read(dev, B2055_PLL_LFC1); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { - b43_radio_write(dev, tmp | B2055_CAL_RVARCTL, 0x0A); - b43_radio_write(dev, tmp | B2055_CAL_LPOCTL, 0x40); - b43_radio_write(dev, tmp | B2055_CAL_TS, 0x55); - b43_radio_write(dev, tmp | B2055_CAL_RCCALRTS, 0); - b43_radio_write(dev, tmp | B2055_CAL_RCALRTS, 0); - if (nphy->ipa5g_on) { - b43_radio_write(dev, tmp | B2055_PADDRV, 4); - b43_radio_write(dev, tmp | B2055_XOCTL1, 1); - } else { - b43_radio_write(dev, tmp | B2055_PADDRV, 0); - b43_radio_write(dev, tmp | B2055_XOCTL1, 0x2F); - } - b43_radio_write(dev, tmp | B2055_XOCTL2, 0); - } else { - b43_radio_write(dev, tmp | B2055_CAL_RVARCTL, 0x06); - b43_radio_write(dev, tmp | B2055_CAL_LPOCTL, 0x40); - b43_radio_write(dev, tmp | B2055_CAL_TS, 0x55); - b43_radio_write(dev, tmp | B2055_CAL_RCCALRTS, 0); - b43_radio_write(dev, tmp | B2055_CAL_RCALRTS, 0); - b43_radio_write(dev, tmp | B2055_XOCTL1, 0); - if (nphy->ipa2g_on) { - b43_radio_write(dev, tmp | B2055_PADDRV, 6); - b43_radio_write(dev, tmp | B2055_XOCTL2, - (dev->phy.rev < 5) ? 0x11 : 0x01); - } else { - b43_radio_write(dev, tmp | B2055_PADDRV, 0); - b43_radio_write(dev, tmp | B2055_XOCTL2, 0); - } - } - b43_radio_write(dev, tmp | B2055_XOREGUL, 0); - b43_radio_write(dev, tmp | B2055_XOMISC, 0); - b43_radio_write(dev, tmp | B2055_PLL_LFC1, 0); - } - } else { - save[0] = b43_radio_read(dev, B2055_C1_TX_RF_IQCAL1); - b43_radio_write(dev, B2055_C1_TX_RF_IQCAL1, 0x29); - - save[1] = b43_radio_read(dev, B2055_C1_TX_RF_IQCAL2); - b43_radio_write(dev, B2055_C1_TX_RF_IQCAL2, 0x54); - - save[2] = b43_radio_read(dev, B2055_C2_TX_RF_IQCAL1); - b43_radio_write(dev, B2055_C2_TX_RF_IQCAL1, 0x29); - - save[3] = b43_radio_read(dev, B2055_C2_TX_RF_IQCAL2); - b43_radio_write(dev, B2055_C2_TX_RF_IQCAL2, 0x54); - - save[3] = b43_radio_read(dev, B2055_C1_PWRDET_RXTX); - save[4] = b43_radio_read(dev, B2055_C2_PWRDET_RXTX); - - if (!(b43_phy_read(dev, B43_NPHY_BANDCTL) & - B43_NPHY_BANDCTL_5GHZ)) { - b43_radio_write(dev, B2055_C1_PWRDET_RXTX, 0x04); - b43_radio_write(dev, B2055_C2_PWRDET_RXTX, 0x04); - } else { - b43_radio_write(dev, B2055_C1_PWRDET_RXTX, 0x20); - b43_radio_write(dev, B2055_C2_PWRDET_RXTX, 0x20); - } - - if (dev->phy.rev < 2) { - b43_radio_set(dev, B2055_C1_TX_BB_MXGM, 0x20); - b43_radio_set(dev, B2055_C2_TX_BB_MXGM, 0x20); - } else { - b43_radio_mask(dev, B2055_C1_TX_BB_MXGM, ~0x20); - b43_radio_mask(dev, B2055_C2_TX_BB_MXGM, ~0x20); - } - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/UpdateTxCalLadder */ -static void b43_nphy_update_tx_cal_ladder(struct b43_wldev *dev, u16 core) -{ - struct b43_phy_n *nphy = dev->phy.n; - int i; - u16 scale, entry; - - u16 tmp = nphy->txcal_bbmult; - if (core == 0) - tmp >>= 8; - tmp &= 0xff; - - for (i = 0; i < 18; i++) { - scale = (ladder_lo[i].percent * tmp) / 100; - entry = ((scale & 0xFF) << 8) | ladder_lo[i].g_env; - b43_ntab_write(dev, B43_NTAB16(15, i), entry); - - scale = (ladder_iq[i].percent * tmp) / 100; - entry = ((scale & 0xFF) << 8) | ladder_iq[i].g_env; - b43_ntab_write(dev, B43_NTAB16(15, i + 32), entry); - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ExtPaSetTxDigiFilts */ -static void b43_nphy_ext_pa_set_tx_dig_filters(struct b43_wldev *dev) -{ - int i; - for (i = 0; i < 15; i++) - b43_phy_write(dev, B43_PHY_N(0x2C5 + i), - tbl_tx_filter_coef_rev4[2][i]); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/IpaSetTxDigiFilts */ -static void b43_nphy_int_pa_set_tx_dig_filters(struct b43_wldev *dev) -{ - int i, j; - /* B43_NPHY_TXF_20CO_S0A1, B43_NPHY_TXF_40CO_S0A1, unknown */ - static const u16 offset[] = { 0x186, 0x195, 0x2C5 }; - - for (i = 0; i < 3; i++) - for (j = 0; j < 15; j++) - b43_phy_write(dev, B43_PHY_N(offset[i] + j), - tbl_tx_filter_coef_rev4[i][j]); - - if (dev->phy.is_40mhz) { - for (j = 0; j < 15; j++) - b43_phy_write(dev, B43_PHY_N(offset[0] + j), - tbl_tx_filter_coef_rev4[3][j]); - } else if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { - for (j = 0; j < 15; j++) - b43_phy_write(dev, B43_PHY_N(offset[0] + j), - tbl_tx_filter_coef_rev4[5][j]); - } - - if (dev->phy.channel == 14) - for (j = 0; j < 15; j++) - b43_phy_write(dev, B43_PHY_N(offset[0] + j), - tbl_tx_filter_coef_rev4[6][j]); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GetTxGain */ -static struct nphy_txgains b43_nphy_get_tx_gains(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - - u16 curr_gain[2]; - struct nphy_txgains target; - const u32 *table = NULL; - - if (!nphy->txpwrctrl) { - int i; - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, true); - b43_ntab_read_bulk(dev, B43_NTAB16(7, 0x110), 2, curr_gain); - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, false); - - for (i = 0; i < 2; ++i) { - if (dev->phy.rev >= 3) { - target.ipa[i] = curr_gain[i] & 0x000F; - target.pad[i] = (curr_gain[i] & 0x00F0) >> 4; - target.pga[i] = (curr_gain[i] & 0x0F00) >> 8; - target.txgm[i] = (curr_gain[i] & 0x7000) >> 12; - } else { - target.ipa[i] = curr_gain[i] & 0x0003; - target.pad[i] = (curr_gain[i] & 0x000C) >> 2; - target.pga[i] = (curr_gain[i] & 0x0070) >> 4; - target.txgm[i] = (curr_gain[i] & 0x0380) >> 7; - } - } - } else { - int i; - u16 index[2]; - index[0] = (b43_phy_read(dev, B43_NPHY_C1_TXPCTL_STAT) & - B43_NPHY_TXPCTL_STAT_BIDX) >> - B43_NPHY_TXPCTL_STAT_BIDX_SHIFT; - index[1] = (b43_phy_read(dev, B43_NPHY_C2_TXPCTL_STAT) & - B43_NPHY_TXPCTL_STAT_BIDX) >> - B43_NPHY_TXPCTL_STAT_BIDX_SHIFT; - - for (i = 0; i < 2; ++i) { - table = b43_nphy_get_tx_gain_table(dev); - if (dev->phy.rev >= 3) { - target.ipa[i] = (table[index[i]] >> 16) & 0xF; - target.pad[i] = (table[index[i]] >> 20) & 0xF; - target.pga[i] = (table[index[i]] >> 24) & 0xF; - target.txgm[i] = (table[index[i]] >> 28) & 0xF; - } else { - target.ipa[i] = (table[index[i]] >> 16) & 0x3; - target.pad[i] = (table[index[i]] >> 18) & 0x3; - target.pga[i] = (table[index[i]] >> 20) & 0x7; - target.txgm[i] = (table[index[i]] >> 23) & 0x7; - } - } - } - - return target; -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhyCleanup */ -static void b43_nphy_tx_cal_phy_cleanup(struct b43_wldev *dev) -{ - u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs; - - if (dev->phy.rev >= 3) { - b43_phy_write(dev, B43_NPHY_AFECTL_C1, regs[0]); - b43_phy_write(dev, B43_NPHY_AFECTL_C2, regs[1]); - b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, regs[2]); - b43_phy_write(dev, B43_NPHY_AFECTL_OVER, regs[3]); - b43_phy_write(dev, B43_NPHY_BBCFG, regs[4]); - b43_ntab_write(dev, B43_NTAB16(8, 3), regs[5]); - b43_ntab_write(dev, B43_NTAB16(8, 19), regs[6]); - b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, regs[7]); - b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, regs[8]); - b43_phy_write(dev, B43_NPHY_PAPD_EN0, regs[9]); - b43_phy_write(dev, B43_NPHY_PAPD_EN1, regs[10]); - b43_nphy_reset_cca(dev); - } else { - b43_phy_maskset(dev, B43_NPHY_AFECTL_C1, 0x0FFF, regs[0]); - b43_phy_maskset(dev, B43_NPHY_AFECTL_C2, 0x0FFF, regs[1]); - b43_phy_write(dev, B43_NPHY_AFECTL_OVER, regs[2]); - b43_ntab_write(dev, B43_NTAB16(8, 2), regs[3]); - b43_ntab_write(dev, B43_NTAB16(8, 18), regs[4]); - b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, regs[5]); - b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, regs[6]); - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhySetup */ -static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev) -{ - u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs; - u16 tmp; - - regs[0] = b43_phy_read(dev, B43_NPHY_AFECTL_C1); - regs[1] = b43_phy_read(dev, B43_NPHY_AFECTL_C2); - if (dev->phy.rev >= 3) { - b43_phy_maskset(dev, B43_NPHY_AFECTL_C1, 0xF0FF, 0x0A00); - b43_phy_maskset(dev, B43_NPHY_AFECTL_C2, 0xF0FF, 0x0A00); - - tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER1); - regs[2] = tmp; - b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, tmp | 0x0600); - - tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER); - regs[3] = tmp; - b43_phy_write(dev, B43_NPHY_AFECTL_OVER, tmp | 0x0600); - - regs[4] = b43_phy_read(dev, B43_NPHY_BBCFG); - b43_phy_mask(dev, B43_NPHY_BBCFG, - ~B43_NPHY_BBCFG_RSTRX & 0xFFFF); - - tmp = b43_ntab_read(dev, B43_NTAB16(8, 3)); - regs[5] = tmp; - b43_ntab_write(dev, B43_NTAB16(8, 3), 0); - - tmp = b43_ntab_read(dev, B43_NTAB16(8, 19)); - regs[6] = tmp; - b43_ntab_write(dev, B43_NTAB16(8, 19), 0); - regs[7] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1); - regs[8] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2); - - b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_PA, 1, 3); - b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_TRSW, 2, 1); - b43_nphy_rf_ctl_intc_override(dev, N_INTC_OVERRIDE_TRSW, 8, 2); - - regs[9] = b43_phy_read(dev, B43_NPHY_PAPD_EN0); - regs[10] = b43_phy_read(dev, B43_NPHY_PAPD_EN1); - b43_phy_mask(dev, B43_NPHY_PAPD_EN0, ~0x0001); - b43_phy_mask(dev, B43_NPHY_PAPD_EN1, ~0x0001); - } else { - b43_phy_maskset(dev, B43_NPHY_AFECTL_C1, 0x0FFF, 0xA000); - b43_phy_maskset(dev, B43_NPHY_AFECTL_C2, 0x0FFF, 0xA000); - tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER); - regs[2] = tmp; - b43_phy_write(dev, B43_NPHY_AFECTL_OVER, tmp | 0x3000); - tmp = b43_ntab_read(dev, B43_NTAB16(8, 2)); - regs[3] = tmp; - tmp |= 0x2000; - b43_ntab_write(dev, B43_NTAB16(8, 2), tmp); - tmp = b43_ntab_read(dev, B43_NTAB16(8, 18)); - regs[4] = tmp; - tmp |= 0x2000; - b43_ntab_write(dev, B43_NTAB16(8, 18), tmp); - regs[5] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1); - regs[6] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2); - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) - tmp = 0x0180; - else - tmp = 0x0120; - b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, tmp); - b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, tmp); - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SaveCal */ -static void b43_nphy_save_cal(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - - struct b43_phy_n_iq_comp *rxcal_coeffs = NULL; - u16 *txcal_radio_regs = NULL; - struct b43_chanspec *iqcal_chanspec; - u16 *table = NULL; - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 1); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_2G; - txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_2G; - iqcal_chanspec = &nphy->iqcal_chanspec_2G; - table = nphy->cal_cache.txcal_coeffs_2G; - } else { - rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_5G; - txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_5G; - iqcal_chanspec = &nphy->iqcal_chanspec_5G; - table = nphy->cal_cache.txcal_coeffs_5G; - } - - b43_nphy_rx_iq_coeffs(dev, false, rxcal_coeffs); - /* TODO use some definitions */ - if (dev->phy.rev >= 3) { - txcal_radio_regs[0] = b43_radio_read(dev, 0x2021); - txcal_radio_regs[1] = b43_radio_read(dev, 0x2022); - txcal_radio_regs[2] = b43_radio_read(dev, 0x3021); - txcal_radio_regs[3] = b43_radio_read(dev, 0x3022); - txcal_radio_regs[4] = b43_radio_read(dev, 0x2023); - txcal_radio_regs[5] = b43_radio_read(dev, 0x2024); - txcal_radio_regs[6] = b43_radio_read(dev, 0x3023); - txcal_radio_regs[7] = b43_radio_read(dev, 0x3024); - } else { - txcal_radio_regs[0] = b43_radio_read(dev, 0x8B); - txcal_radio_regs[1] = b43_radio_read(dev, 0xBA); - txcal_radio_regs[2] = b43_radio_read(dev, 0x8D); - txcal_radio_regs[3] = b43_radio_read(dev, 0xBC); - } - iqcal_chanspec->center_freq = dev->phy.channel_freq; - iqcal_chanspec->channel_type = dev->phy.channel_type; - b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 8, table); - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, 0); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */ -static void b43_nphy_restore_cal(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - - u16 coef[4]; - u16 *loft = NULL; - u16 *table = NULL; - - int i; - u16 *txcal_radio_regs = NULL; - struct b43_phy_n_iq_comp *rxcal_coeffs = NULL; - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - if (!nphy->iqcal_chanspec_2G.center_freq) - return; - table = nphy->cal_cache.txcal_coeffs_2G; - loft = &nphy->cal_cache.txcal_coeffs_2G[5]; - } else { - if (!nphy->iqcal_chanspec_5G.center_freq) - return; - table = nphy->cal_cache.txcal_coeffs_5G; - loft = &nphy->cal_cache.txcal_coeffs_5G[5]; - } - - b43_ntab_write_bulk(dev, B43_NTAB16(15, 80), 4, table); - - for (i = 0; i < 4; i++) { - if (dev->phy.rev >= 3) - table[i] = coef[i]; - else - coef[i] = 0; - } - - b43_ntab_write_bulk(dev, B43_NTAB16(15, 88), 4, coef); - b43_ntab_write_bulk(dev, B43_NTAB16(15, 85), 2, loft); - b43_ntab_write_bulk(dev, B43_NTAB16(15, 93), 2, loft); - - if (dev->phy.rev < 2) - b43_nphy_tx_iq_workaround(dev); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_2G; - rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_2G; - } else { - txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_5G; - rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_5G; - } - - /* TODO use some definitions */ - if (dev->phy.rev >= 3) { - b43_radio_write(dev, 0x2021, txcal_radio_regs[0]); - b43_radio_write(dev, 0x2022, txcal_radio_regs[1]); - b43_radio_write(dev, 0x3021, txcal_radio_regs[2]); - b43_radio_write(dev, 0x3022, txcal_radio_regs[3]); - b43_radio_write(dev, 0x2023, txcal_radio_regs[4]); - b43_radio_write(dev, 0x2024, txcal_radio_regs[5]); - b43_radio_write(dev, 0x3023, txcal_radio_regs[6]); - b43_radio_write(dev, 0x3024, txcal_radio_regs[7]); - } else { - b43_radio_write(dev, 0x8B, txcal_radio_regs[0]); - b43_radio_write(dev, 0xBA, txcal_radio_regs[1]); - b43_radio_write(dev, 0x8D, txcal_radio_regs[2]); - b43_radio_write(dev, 0xBC, txcal_radio_regs[3]); - } - b43_nphy_rx_iq_coeffs(dev, true, rxcal_coeffs); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalTxIqlo */ -static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, - struct nphy_txgains target, - bool full, bool mphase) -{ - struct b43_phy_n *nphy = dev->phy.n; - int i; - int error = 0; - int freq; - bool avoid = false; - u8 length; - u16 tmp, core, type, count, max, numb, last = 0, cmd; - const u16 *table; - bool phy6or5x; - - u16 buffer[11]; - u16 diq_start = 0; - u16 save[2]; - u16 gain[2]; - struct nphy_iqcal_params params[2]; - bool updated[2] = { }; - - b43_nphy_stay_in_carrier_search(dev, true); - - if (dev->phy.rev >= 4) { - avoid = nphy->hang_avoid; - nphy->hang_avoid = false; - } - - b43_ntab_read_bulk(dev, B43_NTAB16(7, 0x110), 2, save); - - for (i = 0; i < 2; i++) { - b43_nphy_iq_cal_gain_params(dev, i, target, ¶ms[i]); - gain[i] = params[i].cal_gain; - } - - b43_ntab_write_bulk(dev, B43_NTAB16(7, 0x110), 2, gain); - - b43_nphy_tx_cal_radio_setup(dev); - b43_nphy_tx_cal_phy_setup(dev); - - phy6or5x = dev->phy.rev >= 6 || - (dev->phy.rev == 5 && nphy->ipa2g_on && - b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ); - if (phy6or5x) { - if (dev->phy.is_40mhz) { - b43_ntab_write_bulk(dev, B43_NTAB16(15, 0), 18, - tbl_tx_iqlo_cal_loft_ladder_40); - b43_ntab_write_bulk(dev, B43_NTAB16(15, 32), 18, - tbl_tx_iqlo_cal_iqimb_ladder_40); - } else { - b43_ntab_write_bulk(dev, B43_NTAB16(15, 0), 18, - tbl_tx_iqlo_cal_loft_ladder_20); - b43_ntab_write_bulk(dev, B43_NTAB16(15, 32), 18, - tbl_tx_iqlo_cal_iqimb_ladder_20); - } - } - - b43_phy_write(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0x8AA9); - - if (!dev->phy.is_40mhz) - freq = 2500; - else - freq = 5000; - - if (nphy->mphase_cal_phase_id > 2) - b43_nphy_run_samples(dev, (dev->phy.is_40mhz ? 40 : 20) * 8, - 0xFFFF, 0, true, false); - else - error = b43_nphy_tx_tone(dev, freq, 250, true, false); - - if (error == 0) { - if (nphy->mphase_cal_phase_id > 2) { - table = nphy->mphase_txcal_bestcoeffs; - length = 11; - if (dev->phy.rev < 3) - length -= 2; - } else { - if (!full && nphy->txiqlocal_coeffsvalid) { - table = nphy->txiqlocal_bestc; - length = 11; - if (dev->phy.rev < 3) - length -= 2; - } else { - full = true; - if (dev->phy.rev >= 3) { - table = tbl_tx_iqlo_cal_startcoefs_nphyrev3; - length = B43_NTAB_TX_IQLO_CAL_STARTCOEFS_REV3; - } else { - table = tbl_tx_iqlo_cal_startcoefs; - length = B43_NTAB_TX_IQLO_CAL_STARTCOEFS; - } - } - } - - b43_ntab_write_bulk(dev, B43_NTAB16(15, 64), length, table); - - if (full) { - if (dev->phy.rev >= 3) - max = B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL_REV3; - else - max = B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL; - } else { - if (dev->phy.rev >= 3) - max = B43_NTAB_TX_IQLO_CAL_CMDS_RECAL_REV3; - else - max = B43_NTAB_TX_IQLO_CAL_CMDS_RECAL; - } - - if (mphase) { - count = nphy->mphase_txcal_cmdidx; - numb = min(max, - (u16)(count + nphy->mphase_txcal_numcmds)); - } else { - count = 0; - numb = max; - } - - for (; count < numb; count++) { - if (full) { - if (dev->phy.rev >= 3) - cmd = tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[count]; - else - cmd = tbl_tx_iqlo_cal_cmds_fullcal[count]; - } else { - if (dev->phy.rev >= 3) - cmd = tbl_tx_iqlo_cal_cmds_recal_nphyrev3[count]; - else - cmd = tbl_tx_iqlo_cal_cmds_recal[count]; - } - - core = (cmd & 0x3000) >> 12; - type = (cmd & 0x0F00) >> 8; - - if (phy6or5x && updated[core] == 0) { - b43_nphy_update_tx_cal_ladder(dev, core); - updated[core] = true; - } - - tmp = (params[core].ncorr[type] << 8) | 0x66; - b43_phy_write(dev, B43_NPHY_IQLOCAL_CMDNNUM, tmp); - - if (type == 1 || type == 3 || type == 4) { - buffer[0] = b43_ntab_read(dev, - B43_NTAB16(15, 69 + core)); - diq_start = buffer[0]; - buffer[0] = 0; - b43_ntab_write(dev, B43_NTAB16(15, 69 + core), - 0); - } - - b43_phy_write(dev, B43_NPHY_IQLOCAL_CMD, cmd); - for (i = 0; i < 2000; i++) { - tmp = b43_phy_read(dev, B43_NPHY_IQLOCAL_CMD); - if (tmp & 0xC000) - break; - udelay(10); - } - - b43_ntab_read_bulk(dev, B43_NTAB16(15, 96), length, - buffer); - b43_ntab_write_bulk(dev, B43_NTAB16(15, 64), length, - buffer); - - if (type == 1 || type == 3 || type == 4) - buffer[0] = diq_start; - } - - if (mphase) - nphy->mphase_txcal_cmdidx = (numb >= max) ? 0 : numb; - - last = (dev->phy.rev < 3) ? 6 : 7; - - if (!mphase || nphy->mphase_cal_phase_id == last) { - b43_ntab_write_bulk(dev, B43_NTAB16(15, 96), 4, buffer); - b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 4, buffer); - if (dev->phy.rev < 3) { - buffer[0] = 0; - buffer[1] = 0; - buffer[2] = 0; - buffer[3] = 0; - } - b43_ntab_write_bulk(dev, B43_NTAB16(15, 88), 4, - buffer); - b43_ntab_read_bulk(dev, B43_NTAB16(15, 101), 2, - buffer); - b43_ntab_write_bulk(dev, B43_NTAB16(15, 85), 2, - buffer); - b43_ntab_write_bulk(dev, B43_NTAB16(15, 93), 2, - buffer); - length = 11; - if (dev->phy.rev < 3) - length -= 2; - b43_ntab_read_bulk(dev, B43_NTAB16(15, 96), length, - nphy->txiqlocal_bestc); - nphy->txiqlocal_coeffsvalid = true; - nphy->txiqlocal_chanspec.center_freq = - dev->phy.channel_freq; - nphy->txiqlocal_chanspec.channel_type = - dev->phy.channel_type; - } else { - length = 11; - if (dev->phy.rev < 3) - length -= 2; - b43_ntab_read_bulk(dev, B43_NTAB16(15, 96), length, - nphy->mphase_txcal_bestcoeffs); - } - - b43_nphy_stop_playback(dev); - b43_phy_write(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0); - } - - b43_nphy_tx_cal_phy_cleanup(dev); - b43_ntab_write_bulk(dev, B43_NTAB16(7, 0x110), 2, save); - - if (dev->phy.rev < 2 && (!mphase || nphy->mphase_cal_phase_id == last)) - b43_nphy_tx_iq_workaround(dev); - - if (dev->phy.rev >= 4) - nphy->hang_avoid = avoid; - - b43_nphy_stay_in_carrier_search(dev, false); - - return error; -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ReapplyTxCalCoeffs */ -static void b43_nphy_reapply_tx_cal_coeffs(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy = dev->phy.n; - u8 i; - u16 buffer[7]; - bool equal = true; - - if (!nphy->txiqlocal_coeffsvalid || - nphy->txiqlocal_chanspec.center_freq != dev->phy.channel_freq || - nphy->txiqlocal_chanspec.channel_type != dev->phy.channel_type) - return; - - b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 7, buffer); - for (i = 0; i < 4; i++) { - if (buffer[i] != nphy->txiqlocal_bestc[i]) { - equal = false; - break; - } - } - - if (!equal) { - b43_ntab_write_bulk(dev, B43_NTAB16(15, 80), 4, - nphy->txiqlocal_bestc); - for (i = 0; i < 4; i++) - buffer[i] = 0; - b43_ntab_write_bulk(dev, B43_NTAB16(15, 88), 4, - buffer); - b43_ntab_write_bulk(dev, B43_NTAB16(15, 85), 2, - &nphy->txiqlocal_bestc[5]); - b43_ntab_write_bulk(dev, B43_NTAB16(15, 93), 2, - &nphy->txiqlocal_bestc[5]); - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalRxIqRev2 */ -static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev, - struct nphy_txgains target, u8 type, bool debug) -{ - struct b43_phy_n *nphy = dev->phy.n; - int i, j, index; - u8 rfctl[2]; - u8 afectl_core; - u16 tmp[6]; - u16 uninitialized_var(cur_hpf1), uninitialized_var(cur_hpf2), cur_lna; - u32 real, imag; - enum ieee80211_band band; - - u8 use; - u16 cur_hpf; - u16 lna[3] = { 3, 3, 1 }; - u16 hpf1[3] = { 7, 2, 0 }; - u16 hpf2[3] = { 2, 0, 0 }; - u32 power[3] = { }; - u16 gain_save[2]; - u16 cal_gain[2]; - struct nphy_iqcal_params cal_params[2]; - struct nphy_iq_est est; - int ret = 0; - bool playtone = true; - int desired = 13; - - b43_nphy_stay_in_carrier_search(dev, 1); - - if (dev->phy.rev < 2) - b43_nphy_reapply_tx_cal_coeffs(dev); - b43_ntab_read_bulk(dev, B43_NTAB16(7, 0x110), 2, gain_save); - for (i = 0; i < 2; i++) { - b43_nphy_iq_cal_gain_params(dev, i, target, &cal_params[i]); - cal_gain[i] = cal_params[i].cal_gain; - } - b43_ntab_write_bulk(dev, B43_NTAB16(7, 0x110), 2, cal_gain); - - for (i = 0; i < 2; i++) { - if (i == 0) { - rfctl[0] = B43_NPHY_RFCTL_INTC1; - rfctl[1] = B43_NPHY_RFCTL_INTC2; - afectl_core = B43_NPHY_AFECTL_C1; - } else { - rfctl[0] = B43_NPHY_RFCTL_INTC2; - rfctl[1] = B43_NPHY_RFCTL_INTC1; - afectl_core = B43_NPHY_AFECTL_C2; - } - - tmp[1] = b43_phy_read(dev, B43_NPHY_RFSEQCA); - tmp[2] = b43_phy_read(dev, afectl_core); - tmp[3] = b43_phy_read(dev, B43_NPHY_AFECTL_OVER); - tmp[4] = b43_phy_read(dev, rfctl[0]); - tmp[5] = b43_phy_read(dev, rfctl[1]); - - b43_phy_maskset(dev, B43_NPHY_RFSEQCA, - ~B43_NPHY_RFSEQCA_RXDIS & 0xFFFF, - ((1 - i) << B43_NPHY_RFSEQCA_RXDIS_SHIFT)); - b43_phy_maskset(dev, B43_NPHY_RFSEQCA, ~B43_NPHY_RFSEQCA_TXEN, - (1 - i)); - b43_phy_set(dev, afectl_core, 0x0006); - b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x0006); - - band = b43_current_band(dev->wl); - - if (nphy->rxcalparams & 0xFF000000) { - if (band == IEEE80211_BAND_5GHZ) - b43_phy_write(dev, rfctl[0], 0x140); - else - b43_phy_write(dev, rfctl[0], 0x110); - } else { - if (band == IEEE80211_BAND_5GHZ) - b43_phy_write(dev, rfctl[0], 0x180); - else - b43_phy_write(dev, rfctl[0], 0x120); - } - - if (band == IEEE80211_BAND_5GHZ) - b43_phy_write(dev, rfctl[1], 0x148); - else - b43_phy_write(dev, rfctl[1], 0x114); - - if (nphy->rxcalparams & 0x10000) { - b43_radio_maskset(dev, B2055_C1_GENSPARE2, 0xFC, - (i + 1)); - b43_radio_maskset(dev, B2055_C2_GENSPARE2, 0xFC, - (2 - i)); - } - - for (j = 0; j < 4; j++) { - if (j < 3) { - cur_lna = lna[j]; - cur_hpf1 = hpf1[j]; - cur_hpf2 = hpf2[j]; - } else { - if (power[1] > 10000) { - use = 1; - cur_hpf = cur_hpf1; - index = 2; - } else { - if (power[0] > 10000) { - use = 1; - cur_hpf = cur_hpf1; - index = 1; - } else { - index = 0; - use = 2; - cur_hpf = cur_hpf2; - } - } - cur_lna = lna[index]; - cur_hpf1 = hpf1[index]; - cur_hpf2 = hpf2[index]; - cur_hpf += desired - hweight32(power[index]); - cur_hpf = clamp_val(cur_hpf, 0, 10); - if (use == 1) - cur_hpf1 = cur_hpf; - else - cur_hpf2 = cur_hpf; - } - - tmp[0] = ((cur_hpf2 << 8) | (cur_hpf1 << 4) | - (cur_lna << 2)); - b43_nphy_rf_ctl_override(dev, 0x400, tmp[0], 3, - false); - b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX); - b43_nphy_stop_playback(dev); - - if (playtone) { - ret = b43_nphy_tx_tone(dev, 4000, - (nphy->rxcalparams & 0xFFFF), - false, false); - playtone = false; - } else { - b43_nphy_run_samples(dev, 160, 0xFFFF, 0, - false, false); - } - - if (ret == 0) { - if (j < 3) { - b43_nphy_rx_iq_est(dev, &est, 1024, 32, - false); - if (i == 0) { - real = est.i0_pwr; - imag = est.q0_pwr; - } else { - real = est.i1_pwr; - imag = est.q1_pwr; - } - power[i] = ((real + imag) / 1024) + 1; - } else { - b43_nphy_calc_rx_iq_comp(dev, 1 << i); - } - b43_nphy_stop_playback(dev); - } - - if (ret != 0) - break; - } - - b43_radio_mask(dev, B2055_C1_GENSPARE2, 0xFC); - b43_radio_mask(dev, B2055_C2_GENSPARE2, 0xFC); - b43_phy_write(dev, rfctl[1], tmp[5]); - b43_phy_write(dev, rfctl[0], tmp[4]); - b43_phy_write(dev, B43_NPHY_AFECTL_OVER, tmp[3]); - b43_phy_write(dev, afectl_core, tmp[2]); - b43_phy_write(dev, B43_NPHY_RFSEQCA, tmp[1]); - - if (ret != 0) - break; - } - - b43_nphy_rf_ctl_override(dev, 0x400, 0, 3, true); - b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX); - b43_ntab_write_bulk(dev, B43_NTAB16(7, 0x110), 2, gain_save); - - b43_nphy_stay_in_carrier_search(dev, 0); - - return ret; -} - -static int b43_nphy_rev3_cal_rx_iq(struct b43_wldev *dev, - struct nphy_txgains target, u8 type, bool debug) -{ - return -1; -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalRxIq */ -static int b43_nphy_cal_rx_iq(struct b43_wldev *dev, - struct nphy_txgains target, u8 type, bool debug) -{ - if (dev->phy.rev >= 3) - return b43_nphy_rev3_cal_rx_iq(dev, target, type, debug); - else - return b43_nphy_rev2_cal_rx_iq(dev, target, type, debug); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCoreSetState */ -static void b43_nphy_set_rx_core_state(struct b43_wldev *dev, u8 mask) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_n *nphy = phy->n; - /* u16 buf[16]; it's rev3+ */ - - nphy->phyrxchain = mask; - - if (0 /* FIXME clk */) - return; - - b43_mac_suspend(dev); - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, true); - - b43_phy_maskset(dev, B43_NPHY_RFSEQCA, ~B43_NPHY_RFSEQCA_RXEN, - (mask & 0x3) << B43_NPHY_RFSEQCA_RXEN_SHIFT); - - if ((mask & 0x3) != 0x3) { - b43_phy_write(dev, B43_NPHY_HPANT_SWTHRES, 1); - if (dev->phy.rev >= 3) { - /* TODO */ - } - } else { - b43_phy_write(dev, B43_NPHY_HPANT_SWTHRES, 0x1E); - if (dev->phy.rev >= 3) { - /* TODO */ - } - } - - b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX); - - if (nphy->hang_avoid) - b43_nphy_stay_in_carrier_search(dev, false); - - b43_mac_enable(dev); -} - -/************************************************** - * N-PHY init - **************************************************/ - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/MIMOConfig */ -static void b43_nphy_update_mimo_config(struct b43_wldev *dev, s32 preamble) -{ - u16 mimocfg = b43_phy_read(dev, B43_NPHY_MIMOCFG); - - mimocfg |= B43_NPHY_MIMOCFG_AUTO; - if (preamble == 1) - mimocfg |= B43_NPHY_MIMOCFG_GFMIX; - else - mimocfg &= ~B43_NPHY_MIMOCFG_GFMIX; - - b43_phy_write(dev, B43_NPHY_MIMOCFG, mimocfg); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/BPHYInit */ -static void b43_nphy_bphy_init(struct b43_wldev *dev) -{ - unsigned int i; - u16 val; - - val = 0x1E1F; - for (i = 0; i < 16; i++) { - b43_phy_write(dev, B43_PHY_N_BMODE(0x88 + i), val); - val -= 0x202; - } - val = 0x3E3F; - for (i = 0; i < 16; i++) { - b43_phy_write(dev, B43_PHY_N_BMODE(0x98 + i), val); - val -= 0x202; - } - b43_phy_write(dev, B43_PHY_N_BMODE(0x38), 0x668); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SuperSwitchInit */ -static void b43_nphy_superswitch_init(struct b43_wldev *dev, bool init) -{ - if (dev->phy.rev >= 3) { - if (!init) - return; - if (0 /* FIXME */) { - b43_ntab_write(dev, B43_NTAB16(9, 2), 0x211); - b43_ntab_write(dev, B43_NTAB16(9, 3), 0x222); - b43_ntab_write(dev, B43_NTAB16(9, 8), 0x144); - b43_ntab_write(dev, B43_NTAB16(9, 12), 0x188); - } - } else { - b43_phy_write(dev, B43_NPHY_GPIO_LOOEN, 0); - b43_phy_write(dev, B43_NPHY_GPIO_HIOEN, 0); - - switch (dev->dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - bcma_chipco_gpio_control(&dev->dev->bdev->bus->drv_cc, - 0xFC00, 0xFC00); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - ssb_chipco_gpio_control(&dev->dev->sdev->bus->chipco, - 0xFC00, 0xFC00); - break; -#endif - } - - b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_GPOUTSMSK, 0); - b43_maskset16(dev, B43_MMIO_GPIO_MASK, ~0, 0xFC00); - b43_maskset16(dev, B43_MMIO_GPIO_CONTROL, (~0xFC00 & 0xFFFF), - 0); - - if (init) { - b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_LO1, 0x2D8); - b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP1, 0x301); - b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_LO2, 0x2D8); - b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP2, 0x301); - } - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/Init/N */ -static int b43_phy_initn(struct b43_wldev *dev) -{ - struct ssb_sprom *sprom = dev->dev->bus_sprom; - struct b43_phy *phy = &dev->phy; - struct b43_phy_n *nphy = phy->n; - u8 tx_pwr_state; - struct nphy_txgains target; - u16 tmp; - enum ieee80211_band tmp2; - bool do_rssi_cal; - - u16 clip[2]; - bool do_cal = false; - - if ((dev->phy.rev >= 3) && - (sprom->boardflags_lo & B43_BFL_EXTLNA) && - (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)) { - switch (dev->dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - bcma_cc_set32(&dev->dev->bdev->bus->drv_cc, - BCMA_CC_CHIPCTL, 0x40); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - chipco_set32(&dev->dev->sdev->bus->chipco, - SSB_CHIPCO_CHIPCTL, 0x40); - break; -#endif - } - } - nphy->deaf_count = 0; - b43_nphy_tables_init(dev); - nphy->crsminpwr_adjusted = false; - nphy->noisevars_adjusted = false; - - /* Clear all overrides */ - if (dev->phy.rev >= 3) { - b43_phy_write(dev, B43_NPHY_TXF_40CO_B1S1, 0); - b43_phy_write(dev, B43_NPHY_RFCTL_OVER, 0); - b43_phy_write(dev, B43_NPHY_TXF_40CO_B1S0, 0); - b43_phy_write(dev, B43_NPHY_TXF_40CO_B32S1, 0); - } else { - b43_phy_write(dev, B43_NPHY_RFCTL_OVER, 0); - } - b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, 0); - b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, 0); - if (dev->phy.rev < 6) { - b43_phy_write(dev, B43_NPHY_RFCTL_INTC3, 0); - b43_phy_write(dev, B43_NPHY_RFCTL_INTC4, 0); - } - b43_phy_mask(dev, B43_NPHY_RFSEQMODE, - ~(B43_NPHY_RFSEQMODE_CAOVER | - B43_NPHY_RFSEQMODE_TROVER)); - if (dev->phy.rev >= 3) - b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, 0); - b43_phy_write(dev, B43_NPHY_AFECTL_OVER, 0); - - if (dev->phy.rev <= 2) { - tmp = (dev->phy.rev == 2) ? 0x3B : 0x40; - b43_phy_maskset(dev, B43_NPHY_BPHY_CTL3, - ~B43_NPHY_BPHY_CTL3_SCALE, - tmp << B43_NPHY_BPHY_CTL3_SCALE_SHIFT); - } - b43_phy_write(dev, B43_NPHY_AFESEQ_TX2RX_PUD_20M, 0x20); - b43_phy_write(dev, B43_NPHY_AFESEQ_TX2RX_PUD_40M, 0x20); - - if (sprom->boardflags2_lo & B43_BFL2_SKWRKFEM_BRD || - (dev->dev->board_vendor == PCI_VENDOR_ID_APPLE && - dev->dev->board_type == BCMA_BOARD_TYPE_BCM943224M93)) - b43_phy_write(dev, B43_NPHY_TXREALFD, 0xA0); - else - b43_phy_write(dev, B43_NPHY_TXREALFD, 0xB8); - b43_phy_write(dev, B43_NPHY_MIMO_CRSTXEXT, 0xC8); - b43_phy_write(dev, B43_NPHY_PLOAD_CSENSE_EXTLEN, 0x50); - b43_phy_write(dev, B43_NPHY_TXRIFS_FRDEL, 0x30); - - b43_nphy_update_mimo_config(dev, nphy->preamble_override); - b43_nphy_update_txrx_chain(dev); - - if (phy->rev < 2) { - b43_phy_write(dev, B43_NPHY_DUP40_GFBL, 0xAA8); - b43_phy_write(dev, B43_NPHY_DUP40_BL, 0x9A4); - } - - tmp2 = b43_current_band(dev->wl); - if (b43_nphy_ipa(dev)) { - b43_phy_set(dev, B43_NPHY_PAPD_EN0, 0x1); - b43_phy_maskset(dev, B43_NPHY_EPS_TABLE_ADJ0, 0x007F, - nphy->papd_epsilon_offset[0] << 7); - b43_phy_set(dev, B43_NPHY_PAPD_EN1, 0x1); - b43_phy_maskset(dev, B43_NPHY_EPS_TABLE_ADJ1, 0x007F, - nphy->papd_epsilon_offset[1] << 7); - b43_nphy_int_pa_set_tx_dig_filters(dev); - } else if (phy->rev >= 5) { - b43_nphy_ext_pa_set_tx_dig_filters(dev); - } - - b43_nphy_workarounds(dev); - - /* Reset CCA, in init code it differs a little from standard way */ - b43_phy_force_clock(dev, 1); - tmp = b43_phy_read(dev, B43_NPHY_BBCFG); - b43_phy_write(dev, B43_NPHY_BBCFG, tmp | B43_NPHY_BBCFG_RSTCCA); - b43_phy_write(dev, B43_NPHY_BBCFG, tmp & ~B43_NPHY_BBCFG_RSTCCA); - b43_phy_force_clock(dev, 0); - - b43_mac_phy_clock_set(dev, true); - - b43_nphy_pa_override(dev, false); - b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RX2TX); - b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX); - b43_nphy_pa_override(dev, true); - - b43_nphy_classifier(dev, 0, 0); - b43_nphy_read_clip_detection(dev, clip); - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - b43_nphy_bphy_init(dev); - - tx_pwr_state = nphy->txpwrctrl; - b43_nphy_tx_power_ctrl(dev, false); - b43_nphy_tx_power_fix(dev); - b43_nphy_tx_power_ctl_idle_tssi(dev); - b43_nphy_tx_power_ctl_setup(dev); - b43_nphy_tx_gain_table_upload(dev); - - if (nphy->phyrxchain != 3) - b43_nphy_set_rx_core_state(dev, nphy->phyrxchain); - if (nphy->mphase_cal_phase_id > 0) - ;/* TODO PHY Periodic Calibration Multi-Phase Restart */ - - do_rssi_cal = false; - if (phy->rev >= 3) { - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - do_rssi_cal = !nphy->rssical_chanspec_2G.center_freq; - else - do_rssi_cal = !nphy->rssical_chanspec_5G.center_freq; - - if (do_rssi_cal) - b43_nphy_rssi_cal(dev); - else - b43_nphy_restore_rssi_cal(dev); - } else { - b43_nphy_rssi_cal(dev); - } - - if (!((nphy->measure_hold & 0x6) != 0)) { - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - do_cal = !nphy->iqcal_chanspec_2G.center_freq; - else - do_cal = !nphy->iqcal_chanspec_5G.center_freq; - - if (nphy->mute) - do_cal = false; - - if (do_cal) { - target = b43_nphy_get_tx_gains(dev); - - if (nphy->antsel_type == 2) - b43_nphy_superswitch_init(dev, true); - if (nphy->perical != 2) { - b43_nphy_rssi_cal(dev); - if (phy->rev >= 3) { - nphy->cal_orig_pwr_idx[0] = - nphy->txpwrindex[0].index_internal; - nphy->cal_orig_pwr_idx[1] = - nphy->txpwrindex[1].index_internal; - /* TODO N PHY Pre Calibrate TX Gain */ - target = b43_nphy_get_tx_gains(dev); - } - if (!b43_nphy_cal_tx_iq_lo(dev, target, true, false)) - if (b43_nphy_cal_rx_iq(dev, target, 2, 0) == 0) - b43_nphy_save_cal(dev); - } else if (nphy->mphase_cal_phase_id == 0) - ;/* N PHY Periodic Calibration with arg 3 */ - } else { - b43_nphy_restore_cal(dev); - } - } - - b43_nphy_tx_pwr_ctrl_coef_setup(dev); - b43_nphy_tx_power_ctrl(dev, tx_pwr_state); - b43_phy_write(dev, B43_NPHY_TXMACIF_HOLDOFF, 0x0015); - b43_phy_write(dev, B43_NPHY_TXMACDELAY, 0x0320); - if (phy->rev >= 3 && phy->rev <= 6) - b43_phy_write(dev, B43_NPHY_PLOAD_CSENSE_EXTLEN, 0x0014); - b43_nphy_tx_lp_fbw(dev); - if (phy->rev >= 3) - b43_nphy_spur_workaround(dev); - - return 0; -} - -/************************************************** - * Channel switching ops. - **************************************************/ - -static void b43_chantab_phy_upload(struct b43_wldev *dev, - const struct b43_phy_n_sfo_cfg *e) -{ - b43_phy_write(dev, B43_NPHY_BW1A, e->phy_bw1a); - b43_phy_write(dev, B43_NPHY_BW2, e->phy_bw2); - b43_phy_write(dev, B43_NPHY_BW3, e->phy_bw3); - b43_phy_write(dev, B43_NPHY_BW4, e->phy_bw4); - b43_phy_write(dev, B43_NPHY_BW5, e->phy_bw5); - b43_phy_write(dev, B43_NPHY_BW6, e->phy_bw6); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PmuSpurAvoid */ -static void b43_nphy_pmu_spur_avoid(struct b43_wldev *dev, bool avoid) -{ - switch (dev->dev->bus_type) { -#ifdef CONFIG_B43_BCMA - case B43_BUS_BCMA: - bcma_pmu_spuravoid_pllupdate(&dev->dev->bdev->bus->drv_cc, - avoid); - break; -#endif -#ifdef CONFIG_B43_SSB - case B43_BUS_SSB: - ssb_pmu_spuravoid_pllupdate(&dev->dev->sdev->bus->chipco, - avoid); - break; -#endif - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ChanspecSetup */ -static void b43_nphy_channel_setup(struct b43_wldev *dev, - const struct b43_phy_n_sfo_cfg *e, - struct ieee80211_channel *new_channel) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_n *nphy = dev->phy.n; - int ch = new_channel->hw_value; - - u16 old_band_5ghz; - u32 tmp32; - - old_band_5ghz = - b43_phy_read(dev, B43_NPHY_BANDCTL) & B43_NPHY_BANDCTL_5GHZ; - if (new_channel->band == IEEE80211_BAND_5GHZ && !old_band_5ghz) { - tmp32 = b43_read32(dev, B43_MMIO_PSM_PHY_HDR); - b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32 | 4); - b43_phy_set(dev, B43_PHY_B_BBCFG, 0xC000); - b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32); - b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ); - } else if (new_channel->band == IEEE80211_BAND_2GHZ && old_band_5ghz) { - b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ); - tmp32 = b43_read32(dev, B43_MMIO_PSM_PHY_HDR); - b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32 | 4); - b43_phy_mask(dev, B43_PHY_B_BBCFG, 0x3FFF); - b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32); - } - - b43_chantab_phy_upload(dev, e); - - if (new_channel->hw_value == 14) { - b43_nphy_classifier(dev, 2, 0); - b43_phy_set(dev, B43_PHY_B_TEST, 0x0800); - } else { - b43_nphy_classifier(dev, 2, 2); - if (new_channel->band == IEEE80211_BAND_2GHZ) - b43_phy_mask(dev, B43_PHY_B_TEST, ~0x840); - } - - if (!nphy->txpwrctrl) - b43_nphy_tx_power_fix(dev); - - if (dev->phy.rev < 3) - b43_nphy_adjust_lna_gain_table(dev); - - b43_nphy_tx_lp_fbw(dev); - - if (dev->phy.rev >= 3 && - dev->phy.n->spur_avoid != B43_SPUR_AVOID_DISABLE) { - bool avoid = false; - if (dev->phy.n->spur_avoid == B43_SPUR_AVOID_FORCE) { - avoid = true; - } else if (!b43_channel_type_is_40mhz(phy->channel_type)) { - if ((ch >= 5 && ch <= 8) || ch == 13 || ch == 14) - avoid = true; - } else { /* 40MHz */ - if (nphy->aband_spurwar_en && - (ch == 38 || ch == 102 || ch == 118)) - avoid = dev->dev->chip_id == 0x4716; - } - - b43_nphy_pmu_spur_avoid(dev, avoid); - - if (dev->dev->chip_id == 43222 || dev->dev->chip_id == 43224 || - dev->dev->chip_id == 43225) { - b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_LOW, - avoid ? 0x5341 : 0x8889); - b43_write16(dev, B43_MMIO_TSF_CLK_FRAC_HIGH, 0x8); - } - - if (dev->phy.rev == 3 || dev->phy.rev == 4) - ; /* TODO: reset PLL */ - - if (avoid) - b43_phy_set(dev, B43_NPHY_BBCFG, B43_NPHY_BBCFG_RSTRX); - else - b43_phy_mask(dev, B43_NPHY_BBCFG, - ~B43_NPHY_BBCFG_RSTRX & 0xFFFF); - - b43_nphy_reset_cca(dev); - - /* wl sets useless phy_isspuravoid here */ - } - - b43_phy_write(dev, B43_NPHY_NDATAT_DUP40, 0x3830); - - if (phy->rev >= 3) - b43_nphy_spur_workaround(dev); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetChanspec */ -static int b43_nphy_set_channel(struct b43_wldev *dev, - struct ieee80211_channel *channel, - enum nl80211_channel_type channel_type) -{ - struct b43_phy *phy = &dev->phy; - - const struct b43_nphy_channeltab_entry_rev2 *tabent_r2 = NULL; - const struct b43_nphy_channeltab_entry_rev3 *tabent_r3 = NULL; - - u8 tmp; - - if (dev->phy.rev >= 3) { - tabent_r3 = b43_nphy_get_chantabent_rev3(dev, - channel->center_freq); - if (!tabent_r3) - return -ESRCH; - } else { - tabent_r2 = b43_nphy_get_chantabent_rev2(dev, - channel->hw_value); - if (!tabent_r2) - return -ESRCH; - } - - /* Channel is set later in common code, but we need to set it on our - own to let this function's subcalls work properly. */ - phy->channel = channel->hw_value; - phy->channel_freq = channel->center_freq; - - if (b43_channel_type_is_40mhz(phy->channel_type) != - b43_channel_type_is_40mhz(channel_type)) - ; /* TODO: BMAC BW Set (channel_type) */ - - if (channel_type == NL80211_CHAN_HT40PLUS) - b43_phy_set(dev, B43_NPHY_RXCTL, - B43_NPHY_RXCTL_BSELU20); - else if (channel_type == NL80211_CHAN_HT40MINUS) - b43_phy_mask(dev, B43_NPHY_RXCTL, - ~B43_NPHY_RXCTL_BSELU20); - - if (dev->phy.rev >= 3) { - tmp = (channel->band == IEEE80211_BAND_5GHZ) ? 4 : 0; - b43_radio_maskset(dev, 0x08, 0xFFFB, tmp); - b43_radio_2056_setup(dev, tabent_r3); - b43_nphy_channel_setup(dev, &(tabent_r3->phy_regs), channel); - } else { - tmp = (channel->band == IEEE80211_BAND_5GHZ) ? 0x0020 : 0x0050; - b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, tmp); - b43_radio_2055_setup(dev, tabent_r2); - b43_nphy_channel_setup(dev, &(tabent_r2->phy_regs), channel); - } - - return 0; -} - -/************************************************** - * Basic PHY ops. - **************************************************/ - -static int b43_nphy_op_allocate(struct b43_wldev *dev) -{ - struct b43_phy_n *nphy; - - nphy = kzalloc(sizeof(*nphy), GFP_KERNEL); - if (!nphy) - return -ENOMEM; - dev->phy.n = nphy; - - return 0; -} - -static void b43_nphy_op_prepare_structs(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_n *nphy = phy->n; - struct ssb_sprom *sprom = dev->dev->bus_sprom; - - memset(nphy, 0, sizeof(*nphy)); - - nphy->hang_avoid = (phy->rev == 3 || phy->rev == 4); - nphy->spur_avoid = (phy->rev >= 3) ? - B43_SPUR_AVOID_AUTO : B43_SPUR_AVOID_DISABLE; - nphy->init_por = true; - nphy->gain_boost = true; /* this way we follow wl, assume it is true */ - nphy->txrx_chain = 2; /* sth different than 0 and 1 for now */ - nphy->phyrxchain = 3; /* to avoid b43_nphy_set_rx_core_state like wl */ - nphy->perical = 2; /* avoid additional rssi cal on init (like wl) */ - /* 128 can mean disabled-by-default state of TX pwr ctl. Max value is - * 0x7f == 127 and we check for 128 when restoring TX pwr ctl. */ - nphy->tx_pwr_idx[0] = 128; - nphy->tx_pwr_idx[1] = 128; - - /* Hardware TX power control and 5GHz power gain */ - nphy->txpwrctrl = false; - nphy->pwg_gain_5ghz = false; - if (dev->phy.rev >= 3 || - (dev->dev->board_vendor == PCI_VENDOR_ID_APPLE && - (dev->dev->core_rev == 11 || dev->dev->core_rev == 12))) { - nphy->txpwrctrl = true; - nphy->pwg_gain_5ghz = true; - } else if (sprom->revision >= 4) { - if (dev->phy.rev >= 2 && - (sprom->boardflags2_lo & B43_BFL2_TXPWRCTRL_EN)) { - nphy->txpwrctrl = true; -#ifdef CONFIG_B43_SSB - if (dev->dev->bus_type == B43_BUS_SSB && - dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI) { - struct pci_dev *pdev = - dev->dev->sdev->bus->host_pci; - if (pdev->device == 0x4328 || - pdev->device == 0x432a) - nphy->pwg_gain_5ghz = true; - } -#endif - } else if (sprom->boardflags2_lo & B43_BFL2_5G_PWRGAIN) { - nphy->pwg_gain_5ghz = true; - } - } - - if (dev->phy.rev >= 3) { - nphy->ipa2g_on = sprom->fem.ghz2.extpa_gain == 2; - nphy->ipa5g_on = sprom->fem.ghz5.extpa_gain == 2; - } - - nphy->init_por = true; -} - -static void b43_nphy_op_free(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_n *nphy = phy->n; - - kfree(nphy); - phy->n = NULL; -} - -static int b43_nphy_op_init(struct b43_wldev *dev) -{ - return b43_phy_initn(dev); -} - -static inline void check_phyreg(struct b43_wldev *dev, u16 offset) -{ -#if B43_DEBUG - if ((offset & B43_PHYROUTE) == B43_PHYROUTE_OFDM_GPHY) { - /* OFDM registers are onnly available on A/G-PHYs */ - b43err(dev->wl, "Invalid OFDM PHY access at " - "0x%04X on N-PHY\n", offset); - dump_stack(); - } - if ((offset & B43_PHYROUTE) == B43_PHYROUTE_EXT_GPHY) { - /* Ext-G registers are only available on G-PHYs */ - b43err(dev->wl, "Invalid EXT-G PHY access at " - "0x%04X on N-PHY\n", offset); - dump_stack(); - } -#endif /* B43_DEBUG */ -} - -static u16 b43_nphy_op_read(struct b43_wldev *dev, u16 reg) -{ - check_phyreg(dev, reg); - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - return b43_read16(dev, B43_MMIO_PHY_DATA); -} - -static void b43_nphy_op_write(struct b43_wldev *dev, u16 reg, u16 value) -{ - check_phyreg(dev, reg); - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - b43_write16(dev, B43_MMIO_PHY_DATA, value); -} - -static void b43_nphy_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask, - u16 set) -{ - check_phyreg(dev, reg); - b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); - b43_maskset16(dev, B43_MMIO_PHY_DATA, mask, set); -} - -static u16 b43_nphy_op_radio_read(struct b43_wldev *dev, u16 reg) -{ - /* Register 1 is a 32-bit register. */ - B43_WARN_ON(reg == 1); - /* N-PHY needs 0x100 for read access */ - reg |= 0x100; - - b43_write16(dev, B43_MMIO_RADIO_CONTROL, reg); - return b43_read16(dev, B43_MMIO_RADIO_DATA_LOW); -} - -static void b43_nphy_op_radio_write(struct b43_wldev *dev, u16 reg, u16 value) -{ - /* Register 1 is a 32-bit register. */ - B43_WARN_ON(reg == 1); - - b43_write16(dev, B43_MMIO_RADIO_CONTROL, reg); - b43_write16(dev, B43_MMIO_RADIO_DATA_LOW, value); -} - -/* http://bcm-v4.sipsolutions.net/802.11/Radio/Switch%20Radio */ -static void b43_nphy_op_software_rfkill(struct b43_wldev *dev, - bool blocked) -{ - if (b43_read32(dev, B43_MMIO_MACCTL) & B43_MACCTL_ENABLED) - b43err(dev->wl, "MAC not suspended\n"); - - if (blocked) { - b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, - ~B43_NPHY_RFCTL_CMD_CHIP0PU); - if (dev->phy.rev >= 7) { - /* TODO */ - } else if (dev->phy.rev >= 3) { - b43_radio_mask(dev, 0x09, ~0x2); - - b43_radio_write(dev, 0x204D, 0); - b43_radio_write(dev, 0x2053, 0); - b43_radio_write(dev, 0x2058, 0); - b43_radio_write(dev, 0x205E, 0); - b43_radio_mask(dev, 0x2062, ~0xF0); - b43_radio_write(dev, 0x2064, 0); - - b43_radio_write(dev, 0x304D, 0); - b43_radio_write(dev, 0x3053, 0); - b43_radio_write(dev, 0x3058, 0); - b43_radio_write(dev, 0x305E, 0); - b43_radio_mask(dev, 0x3062, ~0xF0); - b43_radio_write(dev, 0x3064, 0); - } - } else { - if (dev->phy.rev >= 7) { - b43_radio_2057_init(dev); - b43_switch_channel(dev, dev->phy.channel); - } else if (dev->phy.rev >= 3) { - b43_radio_init2056(dev); - b43_switch_channel(dev, dev->phy.channel); - } else { - b43_radio_init2055(dev); - } - } -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/Anacore */ -static void b43_nphy_op_switch_analog(struct b43_wldev *dev, bool on) -{ - u16 override = on ? 0x0 : 0x7FFF; - u16 core = on ? 0xD : 0x00FD; - - if (dev->phy.rev >= 3) { - if (on) { - b43_phy_write(dev, B43_NPHY_AFECTL_C1, core); - b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, override); - b43_phy_write(dev, B43_NPHY_AFECTL_C2, core); - b43_phy_write(dev, B43_NPHY_AFECTL_OVER, override); - } else { - b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, override); - b43_phy_write(dev, B43_NPHY_AFECTL_C1, core); - b43_phy_write(dev, B43_NPHY_AFECTL_OVER, override); - b43_phy_write(dev, B43_NPHY_AFECTL_C2, core); - } - } else { - b43_phy_write(dev, B43_NPHY_AFECTL_OVER, override); - } -} - -static int b43_nphy_op_switch_channel(struct b43_wldev *dev, - unsigned int new_channel) -{ - struct ieee80211_channel *channel = dev->wl->hw->conf.chandef.chan; - enum nl80211_channel_type channel_type = - cfg80211_get_chandef_type(&dev->wl->hw->conf.chandef); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - if ((new_channel < 1) || (new_channel > 14)) - return -EINVAL; - } else { - if (new_channel > 200) - return -EINVAL; - } - - return b43_nphy_set_channel(dev, channel, channel_type); -} - -static unsigned int b43_nphy_op_get_default_chan(struct b43_wldev *dev) -{ - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - return 1; - return 36; -} - -const struct b43_phy_operations b43_phyops_n = { - .allocate = b43_nphy_op_allocate, - .free = b43_nphy_op_free, - .prepare_structs = b43_nphy_op_prepare_structs, - .init = b43_nphy_op_init, - .phy_read = b43_nphy_op_read, - .phy_write = b43_nphy_op_write, - .phy_maskset = b43_nphy_op_maskset, - .radio_read = b43_nphy_op_radio_read, - .radio_write = b43_nphy_op_radio_write, - .software_rfkill = b43_nphy_op_software_rfkill, - .switch_analog = b43_nphy_op_switch_analog, - .switch_channel = b43_nphy_op_switch_channel, - .get_default_chan = b43_nphy_op_get_default_chan, - .recalc_txpower = b43_nphy_op_recalc_txpower, - .adjust_txpower = b43_nphy_op_adjust_txpower, -}; diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h deleted file mode 100644 index 9a5b6bc27d24..000000000000 --- a/drivers/net/wireless/b43/phy_n.h +++ /dev/null @@ -1,989 +0,0 @@ -#ifndef B43_NPHY_H_ -#define B43_NPHY_H_ - -#include "phy_common.h" - - -/* N-PHY registers. */ - -#define B43_NPHY_BBCFG B43_PHY_N(0x001) /* BB config */ -#define B43_NPHY_BBCFG_RSTCCA 0x4000 /* Reset CCA */ -#define B43_NPHY_BBCFG_RSTRX 0x8000 /* Reset RX */ -#define B43_NPHY_CHANNEL B43_PHY_N(0x005) /* Channel */ -#define B43_NPHY_TXERR B43_PHY_N(0x007) /* TX error */ -#define B43_NPHY_BANDCTL B43_PHY_N(0x009) /* Band control */ -#define B43_NPHY_BANDCTL_5GHZ 0x0001 /* Use the 5GHz band */ -#define B43_NPHY_4WI_ADDR B43_PHY_N(0x00B) /* Four-wire bus address */ -#define B43_NPHY_4WI_DATAHI B43_PHY_N(0x00C) /* Four-wire bus data high */ -#define B43_NPHY_4WI_DATALO B43_PHY_N(0x00D) /* Four-wire bus data low */ -#define B43_NPHY_BIST_STAT0 B43_PHY_N(0x00E) /* Built-in self test status 0 */ -#define B43_NPHY_BIST_STAT1 B43_PHY_N(0x00F) /* Built-in self test status 1 */ - -#define B43_NPHY_C1_DESPWR B43_PHY_N(0x018) /* Core 1 desired power */ -#define B43_NPHY_C1_CCK_DESPWR B43_PHY_N(0x019) /* Core 1 CCK desired power */ -#define B43_NPHY_C1_BCLIPBKOFF B43_PHY_N(0x01A) /* Core 1 barely clip backoff */ -#define B43_NPHY_C1_CCK_BCLIPBKOFF B43_PHY_N(0x01B) /* Core 1 CCK barely clip backoff */ -#define B43_NPHY_C1_CGAINI B43_PHY_N(0x01C) /* Core 1 compute gain info */ -#define B43_NPHY_C1_CGAINI_GAINBKOFF 0x001F /* Gain backoff */ -#define B43_NPHY_C1_CGAINI_GAINBKOFF_SHIFT 0 -#define B43_NPHY_C1_CGAINI_CLIPGBKOFF 0x03E0 /* Clip gain backoff */ -#define B43_NPHY_C1_CGAINI_CLIPGBKOFF_SHIFT 5 -#define B43_NPHY_C1_CGAINI_GAINSTEP 0x1C00 /* Gain step */ -#define B43_NPHY_C1_CGAINI_GAINSTEP_SHIFT 10 -#define B43_NPHY_C1_CGAINI_CL2DETECT 0x2000 /* Clip 2 detect mask */ -#define B43_NPHY_C1_CCK_CGAINI B43_PHY_N(0x01D) /* Core 1 CCK compute gain info */ -#define B43_NPHY_C1_CCK_CGAINI_GAINBKOFF 0x001F /* Gain backoff */ -#define B43_NPHY_C1_CCK_CGAINI_CLIPGBKOFF 0x01E0 /* CCK barely clip gain backoff */ -#define B43_NPHY_C1_MINMAX_GAIN B43_PHY_N(0x01E) /* Core 1 min/max gain */ -#define B43_NPHY_C1_MINGAIN 0x00FF /* Minimum gain */ -#define B43_NPHY_C1_MINGAIN_SHIFT 0 -#define B43_NPHY_C1_MAXGAIN 0xFF00 /* Maximum gain */ -#define B43_NPHY_C1_MAXGAIN_SHIFT 8 -#define B43_NPHY_C1_CCK_MINMAX_GAIN B43_PHY_N(0x01F) /* Core 1 CCK min/max gain */ -#define B43_NPHY_C1_CCK_MINGAIN 0x00FF /* Minimum gain */ -#define B43_NPHY_C1_CCK_MINGAIN_SHIFT 0 -#define B43_NPHY_C1_CCK_MAXGAIN 0xFF00 /* Maximum gain */ -#define B43_NPHY_C1_CCK_MAXGAIN_SHIFT 8 -#define B43_NPHY_C1_INITGAIN B43_PHY_N(0x020) /* Core 1 initial gain code */ -#define B43_NPHY_C1_INITGAIN_EXTLNA 0x0001 /* External LNA index */ -#define B43_NPHY_C1_INITGAIN_LNA 0x0006 /* LNA index */ -#define B43_NPHY_C1_INITGAIN_LNAIDX_SHIFT 1 -#define B43_NPHY_C1_INITGAIN_HPVGA1 0x0078 /* HPVGA1 index */ -#define B43_NPHY_C1_INITGAIN_HPVGA1_SHIFT 3 -#define B43_NPHY_C1_INITGAIN_HPVGA2 0x0F80 /* HPVGA2 index */ -#define B43_NPHY_C1_INITGAIN_HPVGA2_SHIFT 7 -#define B43_NPHY_C1_INITGAIN_TRRX 0x1000 /* TR RX index */ -#define B43_NPHY_C1_INITGAIN_TRTX 0x2000 /* TR TX index */ -#define B43_NPHY_REV3_C1_INITGAIN_A B43_PHY_N(0x020) -#define B43_NPHY_C1_CLIP1_HIGAIN B43_PHY_N(0x021) /* Core 1 clip1 high gain code */ -#define B43_NPHY_REV3_C1_INITGAIN_B B43_PHY_N(0x021) -#define B43_NPHY_C1_CLIP1_MEDGAIN B43_PHY_N(0x022) /* Core 1 clip1 medium gain code */ -#define B43_NPHY_REV3_C1_CLIP_HIGAIN_A B43_PHY_N(0x022) -#define B43_NPHY_C1_CLIP1_LOGAIN B43_PHY_N(0x023) /* Core 1 clip1 low gain code */ -#define B43_NPHY_REV3_C1_CLIP_HIGAIN_B B43_PHY_N(0x023) -#define B43_NPHY_C1_CLIP2_GAIN B43_PHY_N(0x024) /* Core 1 clip2 gain code */ -#define B43_NPHY_REV3_C1_CLIP_MEDGAIN_A B43_PHY_N(0x024) -#define B43_NPHY_C1_FILTERGAIN B43_PHY_N(0x025) /* Core 1 filter gain */ -#define B43_NPHY_C1_LPF_QHPF_BW B43_PHY_N(0x026) /* Core 1 LPF Q HP F bandwidth */ -#define B43_NPHY_C1_CLIPWBTHRES B43_PHY_N(0x027) /* Core 1 clip wideband threshold */ -#define B43_NPHY_C1_CLIPWBTHRES_CLIP2 0x003F /* Clip 2 */ -#define B43_NPHY_C1_CLIPWBTHRES_CLIP2_SHIFT 0 -#define B43_NPHY_C1_CLIPWBTHRES_CLIP1 0x0FC0 /* Clip 1 */ -#define B43_NPHY_C1_CLIPWBTHRES_CLIP1_SHIFT 6 -#define B43_NPHY_C1_W1THRES B43_PHY_N(0x028) /* Core 1 W1 threshold */ -#define B43_NPHY_C1_EDTHRES B43_PHY_N(0x029) /* Core 1 ED threshold */ -#define B43_NPHY_C1_SMSIGTHRES B43_PHY_N(0x02A) /* Core 1 small sig threshold */ -#define B43_NPHY_C1_NBCLIPTHRES B43_PHY_N(0x02B) /* Core 1 NB clip threshold */ -#define B43_NPHY_C1_CLIP1THRES B43_PHY_N(0x02C) /* Core 1 clip1 threshold */ -#define B43_NPHY_C1_CLIP2THRES B43_PHY_N(0x02D) /* Core 1 clip2 threshold */ - -#define B43_NPHY_C2_DESPWR B43_PHY_N(0x02E) /* Core 2 desired power */ -#define B43_NPHY_C2_CCK_DESPWR B43_PHY_N(0x02F) /* Core 2 CCK desired power */ -#define B43_NPHY_C2_BCLIPBKOFF B43_PHY_N(0x030) /* Core 2 barely clip backoff */ -#define B43_NPHY_C2_CCK_BCLIPBKOFF B43_PHY_N(0x031) /* Core 2 CCK barely clip backoff */ -#define B43_NPHY_C2_CGAINI B43_PHY_N(0x032) /* Core 2 compute gain info */ -#define B43_NPHY_C2_CGAINI_GAINBKOFF 0x001F /* Gain backoff */ -#define B43_NPHY_C2_CGAINI_GAINBKOFF_SHIFT 0 -#define B43_NPHY_C2_CGAINI_CLIPGBKOFF 0x03E0 /* Clip gain backoff */ -#define B43_NPHY_C2_CGAINI_CLIPGBKOFF_SHIFT 5 -#define B43_NPHY_C2_CGAINI_GAINSTEP 0x1C00 /* Gain step */ -#define B43_NPHY_C2_CGAINI_GAINSTEP_SHIFT 10 -#define B43_NPHY_C2_CGAINI_CL2DETECT 0x2000 /* Clip 2 detect mask */ -#define B43_NPHY_C2_CCK_CGAINI B43_PHY_N(0x033) /* Core 2 CCK compute gain info */ -#define B43_NPHY_C2_CCK_CGAINI_GAINBKOFF 0x001F /* Gain backoff */ -#define B43_NPHY_C2_CCK_CGAINI_CLIPGBKOFF 0x01E0 /* CCK barely clip gain backoff */ -#define B43_NPHY_C2_MINMAX_GAIN B43_PHY_N(0x034) /* Core 2 min/max gain */ -#define B43_NPHY_C2_MINGAIN 0x00FF /* Minimum gain */ -#define B43_NPHY_C2_MINGAIN_SHIFT 0 -#define B43_NPHY_C2_MAXGAIN 0xFF00 /* Maximum gain */ -#define B43_NPHY_C2_MAXGAIN_SHIFT 8 -#define B43_NPHY_C2_CCK_MINMAX_GAIN B43_PHY_N(0x035) /* Core 2 CCK min/max gain */ -#define B43_NPHY_C2_CCK_MINGAIN 0x00FF /* Minimum gain */ -#define B43_NPHY_C2_CCK_MINGAIN_SHIFT 0 -#define B43_NPHY_C2_CCK_MAXGAIN 0xFF00 /* Maximum gain */ -#define B43_NPHY_C2_CCK_MAXGAIN_SHIFT 8 -#define B43_NPHY_C2_INITGAIN B43_PHY_N(0x036) /* Core 2 initial gain code */ -#define B43_NPHY_C2_INITGAIN_EXTLNA 0x0001 /* External LNA index */ -#define B43_NPHY_C2_INITGAIN_LNA 0x0006 /* LNA index */ -#define B43_NPHY_C2_INITGAIN_LNAIDX_SHIFT 1 -#define B43_NPHY_C2_INITGAIN_HPVGA1 0x0078 /* HPVGA1 index */ -#define B43_NPHY_C2_INITGAIN_HPVGA1_SHIFT 3 -#define B43_NPHY_C2_INITGAIN_HPVGA2 0x0F80 /* HPVGA2 index */ -#define B43_NPHY_C2_INITGAIN_HPVGA2_SHIFT 7 -#define B43_NPHY_C2_INITGAIN_TRRX 0x1000 /* TR RX index */ -#define B43_NPHY_C2_INITGAIN_TRTX 0x2000 /* TR TX index */ -#define B43_NPHY_REV3_C1_CLIP_MEDGAIN_B B43_PHY_N(0x036) -#define B43_NPHY_C2_CLIP1_HIGAIN B43_PHY_N(0x037) /* Core 2 clip1 high gain code */ -#define B43_NPHY_REV3_C1_CLIP_LOGAIN_A B43_PHY_N(0x037) -#define B43_NPHY_C2_CLIP1_MEDGAIN B43_PHY_N(0x038) /* Core 2 clip1 medium gain code */ -#define B43_NPHY_REV3_C1_CLIP_LOGAIN_B B43_PHY_N(0x038) -#define B43_NPHY_C2_CLIP1_LOGAIN B43_PHY_N(0x039) /* Core 2 clip1 low gain code */ -#define B43_NPHY_REV3_C1_CLIP2_GAIN_A B43_PHY_N(0x039) -#define B43_NPHY_C2_CLIP2_GAIN B43_PHY_N(0x03A) /* Core 2 clip2 gain code */ -#define B43_NPHY_REV3_C1_CLIP2_GAIN_B B43_PHY_N(0x03A) -#define B43_NPHY_C2_FILTERGAIN B43_PHY_N(0x03B) /* Core 2 filter gain */ -#define B43_NPHY_C2_LPF_QHPF_BW B43_PHY_N(0x03C) /* Core 2 LPF Q HP F bandwidth */ -#define B43_NPHY_C2_CLIPWBTHRES B43_PHY_N(0x03D) /* Core 2 clip wideband threshold */ -#define B43_NPHY_C2_CLIPWBTHRES_CLIP2 0x003F /* Clip 2 */ -#define B43_NPHY_C2_CLIPWBTHRES_CLIP2_SHIFT 0 -#define B43_NPHY_C2_CLIPWBTHRES_CLIP1 0x0FC0 /* Clip 1 */ -#define B43_NPHY_C2_CLIPWBTHRES_CLIP1_SHIFT 6 -#define B43_NPHY_C2_W1THRES B43_PHY_N(0x03E) /* Core 2 W1 threshold */ -#define B43_NPHY_C2_EDTHRES B43_PHY_N(0x03F) /* Core 2 ED threshold */ -#define B43_NPHY_C2_SMSIGTHRES B43_PHY_N(0x040) /* Core 2 small sig threshold */ -#define B43_NPHY_C2_NBCLIPTHRES B43_PHY_N(0x041) /* Core 2 NB clip threshold */ -#define B43_NPHY_C2_CLIP1THRES B43_PHY_N(0x042) /* Core 2 clip1 threshold */ -#define B43_NPHY_C2_CLIP2THRES B43_PHY_N(0x043) /* Core 2 clip2 threshold */ - -#define B43_NPHY_CRS_THRES1 B43_PHY_N(0x044) /* CRS threshold 1 */ -#define B43_NPHY_CRS_THRES2 B43_PHY_N(0x045) /* CRS threshold 2 */ -#define B43_NPHY_CRS_THRES3 B43_PHY_N(0x046) /* CRS threshold 3 */ -#define B43_NPHY_CRSCTL B43_PHY_N(0x047) /* CRS control */ -#define B43_NPHY_DCFADDR B43_PHY_N(0x048) /* DC filter address */ -#define B43_NPHY_RXF20_NUM0 B43_PHY_N(0x049) /* RX filter 20 numerator 0 */ -#define B43_NPHY_RXF20_NUM1 B43_PHY_N(0x04A) /* RX filter 20 numerator 1 */ -#define B43_NPHY_RXF20_NUM2 B43_PHY_N(0x04B) /* RX filter 20 numerator 2 */ -#define B43_NPHY_RXF20_DENOM0 B43_PHY_N(0x04C) /* RX filter 20 denominator 0 */ -#define B43_NPHY_RXF20_DENOM1 B43_PHY_N(0x04D) /* RX filter 20 denominator 1 */ -#define B43_NPHY_RXF20_NUM10 B43_PHY_N(0x04E) /* RX filter 20 numerator 10 */ -#define B43_NPHY_RXF20_NUM11 B43_PHY_N(0x04F) /* RX filter 20 numerator 11 */ -#define B43_NPHY_RXF20_NUM12 B43_PHY_N(0x050) /* RX filter 20 numerator 12 */ -#define B43_NPHY_RXF20_DENOM10 B43_PHY_N(0x051) /* RX filter 20 denominator 10 */ -#define B43_NPHY_RXF20_DENOM11 B43_PHY_N(0x052) /* RX filter 20 denominator 11 */ -#define B43_NPHY_RXF40_NUM0 B43_PHY_N(0x053) /* RX filter 40 numerator 0 */ -#define B43_NPHY_RXF40_NUM1 B43_PHY_N(0x054) /* RX filter 40 numerator 1 */ -#define B43_NPHY_RXF40_NUM2 B43_PHY_N(0x055) /* RX filter 40 numerator 2 */ -#define B43_NPHY_RXF40_DENOM0 B43_PHY_N(0x056) /* RX filter 40 denominator 0 */ -#define B43_NPHY_RXF40_DENOM1 B43_PHY_N(0x057) /* RX filter 40 denominator 1 */ -#define B43_NPHY_RXF40_NUM10 B43_PHY_N(0x058) /* RX filter 40 numerator 10 */ -#define B43_NPHY_RXF40_NUM11 B43_PHY_N(0x059) /* RX filter 40 numerator 11 */ -#define B43_NPHY_RXF40_NUM12 B43_PHY_N(0x05A) /* RX filter 40 numerator 12 */ -#define B43_NPHY_RXF40_DENOM10 B43_PHY_N(0x05B) /* RX filter 40 denominator 10 */ -#define B43_NPHY_RXF40_DENOM11 B43_PHY_N(0x05C) /* RX filter 40 denominator 11 */ -#define B43_NPHY_PPROC_RSTLEN B43_PHY_N(0x060) /* Packet processing reset length */ -#define B43_NPHY_INITCARR_DLEN B43_PHY_N(0x061) /* Initial carrier detection length */ -#define B43_NPHY_CLIP1CARR_DLEN B43_PHY_N(0x062) /* Clip1 carrier detection length */ -#define B43_NPHY_CLIP2CARR_DLEN B43_PHY_N(0x063) /* Clip2 carrier detection length */ -#define B43_NPHY_INITGAIN_SLEN B43_PHY_N(0x064) /* Initial gain settle length */ -#define B43_NPHY_CLIP1GAIN_SLEN B43_PHY_N(0x065) /* Clip1 gain settle length */ -#define B43_NPHY_CLIP2GAIN_SLEN B43_PHY_N(0x066) /* Clip2 gain settle length */ -#define B43_NPHY_PACKGAIN_SLEN B43_PHY_N(0x067) /* Packet gain settle length */ -#define B43_NPHY_CARRSRC_TLEN B43_PHY_N(0x068) /* Carrier search timeout length */ -#define B43_NPHY_TISRC_TLEN B43_PHY_N(0x069) /* Timing search timeout length */ -#define B43_NPHY_ENDROP_TLEN B43_PHY_N(0x06A) /* Energy drop timeout length */ -#define B43_NPHY_CLIP1_NBDWELL_LEN B43_PHY_N(0x06B) /* Clip1 NB dwell length */ -#define B43_NPHY_CLIP2_NBDWELL_LEN B43_PHY_N(0x06C) /* Clip2 NB dwell length */ -#define B43_NPHY_W1CLIP1_DWELL_LEN B43_PHY_N(0x06D) /* W1 clip1 dwell length */ -#define B43_NPHY_W1CLIP2_DWELL_LEN B43_PHY_N(0x06E) /* W1 clip2 dwell length */ -#define B43_NPHY_W2CLIP1_DWELL_LEN B43_PHY_N(0x06F) /* W2 clip1 dwell length */ -#define B43_NPHY_PLOAD_CSENSE_EXTLEN B43_PHY_N(0x070) /* Payload carrier sense extension length */ -#define B43_NPHY_EDROP_CSENSE_EXTLEN B43_PHY_N(0x071) /* Energy drop carrier sense extension length */ -#define B43_NPHY_TABLE_ADDR B43_PHY_N(0x072) /* Table address */ -#define B43_NPHY_TABLE_DATALO B43_PHY_N(0x073) /* Table data low */ -#define B43_NPHY_TABLE_DATAHI B43_PHY_N(0x074) /* Table data high */ -#define B43_NPHY_WWISE_LENIDX B43_PHY_N(0x075) /* WWiSE length index */ -#define B43_NPHY_TGNSYNC_LENIDX B43_PHY_N(0x076) /* TGNsync length index */ -#define B43_NPHY_TXMACIF_HOLDOFF B43_PHY_N(0x077) /* TX MAC IF Hold off */ -#define B43_NPHY_RFCTL_CMD B43_PHY_N(0x078) /* RF control (command) */ -#define B43_NPHY_RFCTL_CMD_START 0x0001 /* Start sequence */ -#define B43_NPHY_RFCTL_CMD_RXTX 0x0002 /* RX/TX */ -#define B43_NPHY_RFCTL_CMD_CORESEL 0x0038 /* Core select */ -#define B43_NPHY_RFCTL_CMD_CORESEL_SHIFT 3 -#define B43_NPHY_RFCTL_CMD_PORFORCE 0x0040 /* POR force */ -#define B43_NPHY_RFCTL_CMD_OEPORFORCE 0x0080 /* OE POR force */ -#define B43_NPHY_RFCTL_CMD_RXEN 0x0100 /* RX enable */ -#define B43_NPHY_RFCTL_CMD_TXEN 0x0200 /* TX enable */ -#define B43_NPHY_RFCTL_CMD_CHIP0PU 0x0400 /* Chip0 PU */ -#define B43_NPHY_RFCTL_CMD_EN 0x0800 /* Radio enabled */ -#define B43_NPHY_RFCTL_CMD_SEQENCORE 0xF000 /* Seq en core */ -#define B43_NPHY_RFCTL_CMD_SEQENCORE_SHIFT 12 -#define B43_NPHY_RFCTL_RSSIO1 B43_PHY_N(0x07A) /* RF control (RSSI others 1) */ -#define B43_NPHY_RFCTL_RSSIO1_RXPD 0x0001 /* RX PD */ -#define B43_NPHY_RFCTL_RSSIO1_TXPD 0x0002 /* TX PD */ -#define B43_NPHY_RFCTL_RSSIO1_PAPD 0x0004 /* PA PD */ -#define B43_NPHY_RFCTL_RSSIO1_RSSICTL 0x0030 /* RSSI control */ -#define B43_NPHY_RFCTL_RSSIO1_LPFBW 0x00C0 /* LPF bandwidth */ -#define B43_NPHY_RFCTL_RSSIO1_HPFBWHI 0x0100 /* HPF bandwidth high */ -#define B43_NPHY_RFCTL_RSSIO1_HIQDISCO 0x0200 /* HIQ dis core */ -#define B43_NPHY_RFCTL_RXG1 B43_PHY_N(0x07B) /* RF control (RX gain 1) */ -#define B43_NPHY_RFCTL_TXG1 B43_PHY_N(0x07C) /* RF control (TX gain 1) */ -#define B43_NPHY_RFCTL_RSSIO2 B43_PHY_N(0x07D) /* RF control (RSSI others 2) */ -#define B43_NPHY_RFCTL_RSSIO2_RXPD 0x0001 /* RX PD */ -#define B43_NPHY_RFCTL_RSSIO2_TXPD 0x0002 /* TX PD */ -#define B43_NPHY_RFCTL_RSSIO2_PAPD 0x0004 /* PA PD */ -#define B43_NPHY_RFCTL_RSSIO2_RSSICTL 0x0030 /* RSSI control */ -#define B43_NPHY_RFCTL_RSSIO2_LPFBW 0x00C0 /* LPF bandwidth */ -#define B43_NPHY_RFCTL_RSSIO2_HPFBWHI 0x0100 /* HPF bandwidth high */ -#define B43_NPHY_RFCTL_RSSIO2_HIQDISCO 0x0200 /* HIQ dis core */ -#define B43_NPHY_RFCTL_RXG2 B43_PHY_N(0x07E) /* RF control (RX gain 2) */ -#define B43_NPHY_RFCTL_TXG2 B43_PHY_N(0x07F) /* RF control (TX gain 2) */ -#define B43_NPHY_RFCTL_RSSIO3 B43_PHY_N(0x080) /* RF control (RSSI others 3) */ -#define B43_NPHY_RFCTL_RSSIO3_RXPD 0x0001 /* RX PD */ -#define B43_NPHY_RFCTL_RSSIO3_TXPD 0x0002 /* TX PD */ -#define B43_NPHY_RFCTL_RSSIO3_PAPD 0x0004 /* PA PD */ -#define B43_NPHY_RFCTL_RSSIO3_RSSICTL 0x0030 /* RSSI control */ -#define B43_NPHY_RFCTL_RSSIO3_LPFBW 0x00C0 /* LPF bandwidth */ -#define B43_NPHY_RFCTL_RSSIO3_HPFBWHI 0x0100 /* HPF bandwidth high */ -#define B43_NPHY_RFCTL_RSSIO3_HIQDISCO 0x0200 /* HIQ dis core */ -#define B43_NPHY_RFCTL_RXG3 B43_PHY_N(0x081) /* RF control (RX gain 3) */ -#define B43_NPHY_RFCTL_TXG3 B43_PHY_N(0x082) /* RF control (TX gain 3) */ -#define B43_NPHY_RFCTL_RSSIO4 B43_PHY_N(0x083) /* RF control (RSSI others 4) */ -#define B43_NPHY_RFCTL_RSSIO4_RXPD 0x0001 /* RX PD */ -#define B43_NPHY_RFCTL_RSSIO4_TXPD 0x0002 /* TX PD */ -#define B43_NPHY_RFCTL_RSSIO4_PAPD 0x0004 /* PA PD */ -#define B43_NPHY_RFCTL_RSSIO4_RSSICTL 0x0030 /* RSSI control */ -#define B43_NPHY_RFCTL_RSSIO4_LPFBW 0x00C0 /* LPF bandwidth */ -#define B43_NPHY_RFCTL_RSSIO4_HPFBWHI 0x0100 /* HPF bandwidth high */ -#define B43_NPHY_RFCTL_RSSIO4_HIQDISCO 0x0200 /* HIQ dis core */ -#define B43_NPHY_RFCTL_RXG4 B43_PHY_N(0x084) /* RF control (RX gain 4) */ -#define B43_NPHY_RFCTL_TXG4 B43_PHY_N(0x085) /* RF control (TX gain 4) */ -#define B43_NPHY_C1_TXIQ_COMP_OFF B43_PHY_N(0x087) /* Core 1 TX I/Q comp offset */ -#define B43_NPHY_C2_TXIQ_COMP_OFF B43_PHY_N(0x088) /* Core 2 TX I/Q comp offset */ -#define B43_NPHY_C1_TXCTL B43_PHY_N(0x08B) /* Core 1 TX control */ -#define B43_NPHY_C2_TXCTL B43_PHY_N(0x08C) /* Core 2 TX control */ -#define B43_NPHY_AFECTL_OVER1 B43_PHY_N(0x08F) /* AFE control override 1 */ -#define B43_NPHY_SCRAM_SIGCTL B43_PHY_N(0x090) /* Scram signal control */ -#define B43_NPHY_SCRAM_SIGCTL_INITST 0x007F /* Initial state value */ -#define B43_NPHY_SCRAM_SIGCTL_INITST_SHIFT 0 -#define B43_NPHY_SCRAM_SIGCTL_SCM 0x0080 /* Scram control mode */ -#define B43_NPHY_SCRAM_SIGCTL_SICE 0x0100 /* Scram index control enable */ -#define B43_NPHY_SCRAM_SIGCTL_START 0xFE00 /* Scram start bit */ -#define B43_NPHY_SCRAM_SIGCTL_START_SHIFT 9 -#define B43_NPHY_RFCTL_INTC1 B43_PHY_N(0x091) /* RF control (intc 1) */ -#define B43_NPHY_RFCTL_INTC2 B43_PHY_N(0x092) /* RF control (intc 2) */ -#define B43_NPHY_RFCTL_INTC3 B43_PHY_N(0x093) /* RF control (intc 3) */ -#define B43_NPHY_RFCTL_INTC4 B43_PHY_N(0x094) /* RF control (intc 4) */ -#define B43_NPHY_NRDTO_WWISE B43_PHY_N(0x095) /* # datatones WWiSE */ -#define B43_NPHY_NRDTO_TGNSYNC B43_PHY_N(0x096) /* # datatones TGNsync */ -#define B43_NPHY_SIGFMOD_WWISE B43_PHY_N(0x097) /* Signal field mod WWiSE */ -#define B43_NPHY_LEG_SIGFMOD_11N B43_PHY_N(0x098) /* Legacy signal field mod 11n */ -#define B43_NPHY_HT_SIGFMOD_11N B43_PHY_N(0x099) /* HT signal field mod 11n */ -#define B43_NPHY_C1_RXIQ_COMPA0 B43_PHY_N(0x09A) /* Core 1 RX I/Q comp A0 */ -#define B43_NPHY_C1_RXIQ_COMPB0 B43_PHY_N(0x09B) /* Core 1 RX I/Q comp B0 */ -#define B43_NPHY_C2_RXIQ_COMPA1 B43_PHY_N(0x09C) /* Core 2 RX I/Q comp A1 */ -#define B43_NPHY_C2_RXIQ_COMPB1 B43_PHY_N(0x09D) /* Core 2 RX I/Q comp B1 */ -#define B43_NPHY_RXCTL B43_PHY_N(0x0A0) /* RX control */ -#define B43_NPHY_RXCTL_BSELU20 0x0010 /* Band select upper 20 */ -#define B43_NPHY_RXCTL_RIFSEN 0x0080 /* RIFS enable */ -#define B43_NPHY_RFSEQMODE B43_PHY_N(0x0A1) /* RF seq mode */ -#define B43_NPHY_RFSEQMODE_CAOVER 0x0001 /* Core active override */ -#define B43_NPHY_RFSEQMODE_TROVER 0x0002 /* Trigger override */ -#define B43_NPHY_RFSEQCA B43_PHY_N(0x0A2) /* RF seq core active */ -#define B43_NPHY_RFSEQCA_TXEN 0x000F /* TX enable */ -#define B43_NPHY_RFSEQCA_TXEN_SHIFT 0 -#define B43_NPHY_RFSEQCA_RXEN 0x00F0 /* RX enable */ -#define B43_NPHY_RFSEQCA_RXEN_SHIFT 4 -#define B43_NPHY_RFSEQCA_TXDIS 0x0F00 /* TX disable */ -#define B43_NPHY_RFSEQCA_TXDIS_SHIFT 8 -#define B43_NPHY_RFSEQCA_RXDIS 0xF000 /* RX disable */ -#define B43_NPHY_RFSEQCA_RXDIS_SHIFT 12 -#define B43_NPHY_RFSEQTR B43_PHY_N(0x0A3) /* RF seq trigger */ -#define B43_NPHY_RFSEQTR_RX2TX 0x0001 /* RX2TX */ -#define B43_NPHY_RFSEQTR_TX2RX 0x0002 /* TX2RX */ -#define B43_NPHY_RFSEQTR_UPGH 0x0004 /* Update gain H */ -#define B43_NPHY_RFSEQTR_UPGL 0x0008 /* Update gain L */ -#define B43_NPHY_RFSEQTR_UPGU 0x0010 /* Update gain U */ -#define B43_NPHY_RFSEQTR_RST2RX 0x0020 /* Reset to RX */ -#define B43_NPHY_RFSEQST B43_PHY_N(0x0A4) /* RF seq status. Values same as trigger. */ -#define B43_NPHY_AFECTL_OVER B43_PHY_N(0x0A5) /* AFE control override */ -#define B43_NPHY_AFECTL_C1 B43_PHY_N(0x0A6) /* AFE control core 1 */ -#define B43_NPHY_AFECTL_C2 B43_PHY_N(0x0A7) /* AFE control core 2 */ -#define B43_NPHY_AFECTL_C3 B43_PHY_N(0x0A8) /* AFE control core 3 */ -#define B43_NPHY_AFECTL_C4 B43_PHY_N(0x0A9) /* AFE control core 4 */ -#define B43_NPHY_AFECTL_DACGAIN1 B43_PHY_N(0x0AA) /* AFE control DAC gain 1 */ -#define B43_NPHY_AFECTL_DACGAIN2 B43_PHY_N(0x0AB) /* AFE control DAC gain 2 */ -#define B43_NPHY_AFECTL_DACGAIN3 B43_PHY_N(0x0AC) /* AFE control DAC gain 3 */ -#define B43_NPHY_AFECTL_DACGAIN4 B43_PHY_N(0x0AD) /* AFE control DAC gain 4 */ -#define B43_NPHY_STR_ADDR1 B43_PHY_N(0x0AE) /* STR address 1 */ -#define B43_NPHY_STR_ADDR2 B43_PHY_N(0x0AF) /* STR address 2 */ -#define B43_NPHY_CLASSCTL B43_PHY_N(0x0B0) /* Classifier control */ -#define B43_NPHY_CLASSCTL_CCKEN 0x0001 /* CCK enable */ -#define B43_NPHY_CLASSCTL_OFDMEN 0x0002 /* OFDM enable */ -#define B43_NPHY_CLASSCTL_WAITEDEN 0x0004 /* Waited enable */ -#define B43_NPHY_IQFLIP B43_PHY_N(0x0B1) /* I/Q flip */ -#define B43_NPHY_IQFLIP_ADC1 0x0001 /* ADC1 */ -#define B43_NPHY_IQFLIP_ADC2 0x0010 /* ADC2 */ -#define B43_NPHY_SISO_SNR_THRES B43_PHY_N(0x0B2) /* SISO SNR threshold */ -#define B43_NPHY_SIGMA_N_MULT B43_PHY_N(0x0B3) /* Sigma N multiplier */ -#define B43_NPHY_TXMACDELAY B43_PHY_N(0x0B4) /* TX MAC delay */ -#define B43_NPHY_TXFRAMEDELAY B43_PHY_N(0x0B5) /* TX frame delay */ -#define B43_NPHY_MLPARM B43_PHY_N(0x0B6) /* ML parameters */ -#define B43_NPHY_MLCTL B43_PHY_N(0x0B7) /* ML control */ -#define B43_NPHY_WWISE_20NCYCDAT B43_PHY_N(0x0B8) /* WWiSE 20 N cyc data */ -#define B43_NPHY_WWISE_40NCYCDAT B43_PHY_N(0x0B9) /* WWiSE 40 N cyc data */ -#define B43_NPHY_TGNSYNC_20NCYCDAT B43_PHY_N(0x0BA) /* TGNsync 20 N cyc data */ -#define B43_NPHY_TGNSYNC_40NCYCDAT B43_PHY_N(0x0BB) /* TGNsync 40 N cyc data */ -#define B43_NPHY_INITSWIZP B43_PHY_N(0x0BC) /* Initial swizzle pattern */ -#define B43_NPHY_TXTAILCNT B43_PHY_N(0x0BD) /* TX tail count value */ -#define B43_NPHY_BPHY_CTL1 B43_PHY_N(0x0BE) /* B PHY control 1 */ -#define B43_NPHY_BPHY_CTL2 B43_PHY_N(0x0BF) /* B PHY control 2 */ -#define B43_NPHY_BPHY_CTL2_LUT 0x001F /* LUT index */ -#define B43_NPHY_BPHY_CTL2_LUT_SHIFT 0 -#define B43_NPHY_BPHY_CTL2_MACDEL 0x7FE0 /* MAC delay */ -#define B43_NPHY_BPHY_CTL2_MACDEL_SHIFT 5 -#define B43_NPHY_IQLOCAL_CMD B43_PHY_N(0x0C0) /* I/Q LO cal command */ -#define B43_NPHY_IQLOCAL_CMD_EN 0x8000 -#define B43_NPHY_IQLOCAL_CMDNNUM B43_PHY_N(0x0C1) /* I/Q LO cal command N num */ -#define B43_NPHY_IQLOCAL_CMDGCTL B43_PHY_N(0x0C2) /* I/Q LO cal command G control */ -#define B43_NPHY_SAMP_CMD B43_PHY_N(0x0C3) /* Sample command */ -#define B43_NPHY_SAMP_CMD_STOP 0x0002 /* Stop */ -#define B43_NPHY_SAMP_LOOPCNT B43_PHY_N(0x0C4) /* Sample loop count */ -#define B43_NPHY_SAMP_WAITCNT B43_PHY_N(0x0C5) /* Sample wait count */ -#define B43_NPHY_SAMP_DEPCNT B43_PHY_N(0x0C6) /* Sample depth count */ -#define B43_NPHY_SAMP_STAT B43_PHY_N(0x0C7) /* Sample status */ -#define B43_NPHY_GPIO_LOOEN B43_PHY_N(0x0C8) /* GPIO low out enable */ -#define B43_NPHY_GPIO_HIOEN B43_PHY_N(0x0C9) /* GPIO high out enable */ -#define B43_NPHY_GPIO_SEL B43_PHY_N(0x0CA) /* GPIO select */ -#define B43_NPHY_GPIO_CLKCTL B43_PHY_N(0x0CB) /* GPIO clock control */ -#define B43_NPHY_TXF_20CO_AS0 B43_PHY_N(0x0CC) /* TX filter 20 coeff A stage 0 */ -#define B43_NPHY_TXF_20CO_AS1 B43_PHY_N(0x0CD) /* TX filter 20 coeff A stage 1 */ -#define B43_NPHY_TXF_20CO_AS2 B43_PHY_N(0x0CE) /* TX filter 20 coeff A stage 2 */ -#define B43_NPHY_TXF_20CO_B32S0 B43_PHY_N(0x0CF) /* TX filter 20 coeff B32 stage 0 */ -#define B43_NPHY_TXF_20CO_B1S0 B43_PHY_N(0x0D0) /* TX filter 20 coeff B1 stage 0 */ -#define B43_NPHY_TXF_20CO_B32S1 B43_PHY_N(0x0D1) /* TX filter 20 coeff B32 stage 1 */ -#define B43_NPHY_TXF_20CO_B1S1 B43_PHY_N(0x0D2) /* TX filter 20 coeff B1 stage 1 */ -#define B43_NPHY_TXF_20CO_B32S2 B43_PHY_N(0x0D3) /* TX filter 20 coeff B32 stage 2 */ -#define B43_NPHY_TXF_20CO_B1S2 B43_PHY_N(0x0D4) /* TX filter 20 coeff B1 stage 2 */ -#define B43_NPHY_SIGFLDTOL B43_PHY_N(0x0D5) /* Signal fld tolerance */ -#define B43_NPHY_TXSERFLD B43_PHY_N(0x0D6) /* TX service field */ -#define B43_NPHY_AFESEQ_RX2TX_PUD B43_PHY_N(0x0D7) /* AFE seq RX2TX power up/down delay */ -#define B43_NPHY_AFESEQ_TX2RX_PUD B43_PHY_N(0x0D8) /* AFE seq TX2RX power up/down delay */ -#define B43_NPHY_TGNSYNC_SCRAMI0 B43_PHY_N(0x0D9) /* TGNsync scram init 0 */ -#define B43_NPHY_TGNSYNC_SCRAMI1 B43_PHY_N(0x0DA) /* TGNsync scram init 1 */ -#define B43_NPHY_INITSWIZPATTLEG B43_PHY_N(0x0DB) /* Initial swizzle pattern leg */ -#define B43_NPHY_BPHY_CTL3 B43_PHY_N(0x0DC) /* B PHY control 3 */ -#define B43_NPHY_BPHY_CTL3_SCALE 0x00FF /* Scale */ -#define B43_NPHY_BPHY_CTL3_SCALE_SHIFT 0 -#define B43_NPHY_BPHY_CTL3_FSC 0xFF00 /* Frame start count value */ -#define B43_NPHY_BPHY_CTL3_FSC_SHIFT 8 -#define B43_NPHY_BPHY_CTL4 B43_PHY_N(0x0DD) /* B PHY control 4 */ -#define B43_NPHY_C1_TXBBMULT B43_PHY_N(0x0DE) /* Core 1 TX BB multiplier */ -#define B43_NPHY_C2_TXBBMULT B43_PHY_N(0x0DF) /* Core 2 TX BB multiplier */ -#define B43_NPHY_TXF_40CO_AS0 B43_PHY_N(0x0E1) /* TX filter 40 coeff A stage 0 */ -#define B43_NPHY_TXF_40CO_AS1 B43_PHY_N(0x0E2) /* TX filter 40 coeff A stage 1 */ -#define B43_NPHY_TXF_40CO_AS2 B43_PHY_N(0x0E3) /* TX filter 40 coeff A stage 2 */ -#define B43_NPHY_TXF_40CO_B32S0 B43_PHY_N(0x0E4) /* TX filter 40 coeff B32 stage 0 */ -#define B43_NPHY_TXF_40CO_B1S0 B43_PHY_N(0x0E5) /* TX filter 40 coeff B1 stage 0 */ -#define B43_NPHY_TXF_40CO_B32S1 B43_PHY_N(0x0E6) /* TX filter 40 coeff B32 stage 1 */ -#define B43_NPHY_TXF_40CO_B1S1 B43_PHY_N(0x0E7) /* TX filter 40 coeff B1 stage 1 */ -#define B43_NPHY_TXF_40CO_B32S2 B43_PHY_N(0x0E8) /* TX filter 40 coeff B32 stage 2 */ -#define B43_NPHY_TXF_40CO_B1S2 B43_PHY_N(0x0E9) /* TX filter 40 coeff B1 stage 2 */ -#define B43_NPHY_BIST_STAT2 B43_PHY_N(0x0EA) /* BIST status 2 */ -#define B43_NPHY_BIST_STAT3 B43_PHY_N(0x0EB) /* BIST status 3 */ -#define B43_NPHY_RFCTL_OVER B43_PHY_N(0x0EC) /* RF control override */ -#define B43_NPHY_MIMOCFG B43_PHY_N(0x0ED) /* MIMO config */ -#define B43_NPHY_MIMOCFG_GFMIX 0x0004 /* Greenfield or mixed mode */ -#define B43_NPHY_MIMOCFG_AUTO 0x0100 /* Greenfield/mixed mode auto */ -#define B43_NPHY_RADAR_BLNKCTL B43_PHY_N(0x0EE) /* Radar blank control */ -#define B43_NPHY_A0RADAR_FIFOCTL B43_PHY_N(0x0EF) /* Antenna 0 radar FIFO control */ -#define B43_NPHY_A1RADAR_FIFOCTL B43_PHY_N(0x0F0) /* Antenna 1 radar FIFO control */ -#define B43_NPHY_A0RADAR_FIFODAT B43_PHY_N(0x0F1) /* Antenna 0 radar FIFO data */ -#define B43_NPHY_A1RADAR_FIFODAT B43_PHY_N(0x0F2) /* Antenna 1 radar FIFO data */ -#define B43_NPHY_RADAR_THRES0 B43_PHY_N(0x0F3) /* Radar threshold 0 */ -#define B43_NPHY_RADAR_THRES1 B43_PHY_N(0x0F4) /* Radar threshold 1 */ -#define B43_NPHY_RADAR_THRES0R B43_PHY_N(0x0F5) /* Radar threshold 0R */ -#define B43_NPHY_RADAR_THRES1R B43_PHY_N(0x0F6) /* Radar threshold 1R */ -#define B43_NPHY_CSEN_20IN40_DLEN B43_PHY_N(0x0F7) /* Carrier sense 20 in 40 dwell length */ -#define B43_NPHY_RFCTL_LUT_TRSW_LO1 B43_PHY_N(0x0F8) /* RF control LUT TRSW lower 1 */ -#define B43_NPHY_RFCTL_LUT_TRSW_UP1 B43_PHY_N(0x0F9) /* RF control LUT TRSW upper 1 */ -#define B43_NPHY_RFCTL_LUT_TRSW_LO2 B43_PHY_N(0x0FA) /* RF control LUT TRSW lower 2 */ -#define B43_NPHY_RFCTL_LUT_TRSW_UP2 B43_PHY_N(0x0FB) /* RF control LUT TRSW upper 2 */ -#define B43_NPHY_RFCTL_LUT_TRSW_LO3 B43_PHY_N(0x0FC) /* RF control LUT TRSW lower 3 */ -#define B43_NPHY_RFCTL_LUT_TRSW_UP3 B43_PHY_N(0x0FD) /* RF control LUT TRSW upper 3 */ -#define B43_NPHY_RFCTL_LUT_TRSW_LO4 B43_PHY_N(0x0FE) /* RF control LUT TRSW lower 4 */ -#define B43_NPHY_RFCTL_LUT_TRSW_UP4 B43_PHY_N(0x0FF) /* RF control LUT TRSW upper 4 */ -#define B43_NPHY_RFCTL_LUT_LNAPA1 B43_PHY_N(0x100) /* RF control LUT LNA PA 1 */ -#define B43_NPHY_RFCTL_LUT_LNAPA2 B43_PHY_N(0x101) /* RF control LUT LNA PA 2 */ -#define B43_NPHY_RFCTL_LUT_LNAPA3 B43_PHY_N(0x102) /* RF control LUT LNA PA 3 */ -#define B43_NPHY_RFCTL_LUT_LNAPA4 B43_PHY_N(0x103) /* RF control LUT LNA PA 4 */ -#define B43_NPHY_TGNSYNC_CRCM0 B43_PHY_N(0x104) /* TGNsync CRC mask 0 */ -#define B43_NPHY_TGNSYNC_CRCM1 B43_PHY_N(0x105) /* TGNsync CRC mask 1 */ -#define B43_NPHY_TGNSYNC_CRCM2 B43_PHY_N(0x106) /* TGNsync CRC mask 2 */ -#define B43_NPHY_TGNSYNC_CRCM3 B43_PHY_N(0x107) /* TGNsync CRC mask 3 */ -#define B43_NPHY_TGNSYNC_CRCM4 B43_PHY_N(0x108) /* TGNsync CRC mask 4 */ -#define B43_NPHY_CRCPOLY B43_PHY_N(0x109) /* CRC polynomial */ -#define B43_NPHY_SIGCNT B43_PHY_N(0x10A) /* # sig count */ -#define B43_NPHY_SIGSTARTBIT_CTL B43_PHY_N(0x10B) /* Sig start bit control */ -#define B43_NPHY_CRCPOLY_ORDER B43_PHY_N(0x10C) /* CRC polynomial order */ -#define B43_NPHY_RFCTL_CST0 B43_PHY_N(0x10D) /* RF control core swap table 0 */ -#define B43_NPHY_RFCTL_CST1 B43_PHY_N(0x10E) /* RF control core swap table 1 */ -#define B43_NPHY_RFCTL_CST2O B43_PHY_N(0x10F) /* RF control core swap table 2 + others */ -#define B43_NPHY_BPHY_CTL5 B43_PHY_N(0x111) /* B PHY control 5 */ -#define B43_NPHY_RFSEQ_LPFBW B43_PHY_N(0x112) /* RF seq LPF bandwidth */ -#define B43_NPHY_TSSIBIAS1 B43_PHY_N(0x114) /* TSSI bias val 1 */ -#define B43_NPHY_TSSIBIAS2 B43_PHY_N(0x115) /* TSSI bias val 2 */ -#define B43_NPHY_TSSIBIAS_BIAS 0x00FF /* Bias */ -#define B43_NPHY_TSSIBIAS_BIAS_SHIFT 0 -#define B43_NPHY_TSSIBIAS_VAL 0xFF00 /* Value */ -#define B43_NPHY_TSSIBIAS_VAL_SHIFT 8 -#define B43_NPHY_ESTPWR1 B43_PHY_N(0x118) /* Estimated power 1 */ -#define B43_NPHY_ESTPWR2 B43_PHY_N(0x119) /* Estimated power 2 */ -#define B43_NPHY_ESTPWR_PWR 0x00FF /* Estimated power */ -#define B43_NPHY_ESTPWR_PWR_SHIFT 0 -#define B43_NPHY_ESTPWR_VALID 0x0100 /* Estimated power valid */ -#define B43_NPHY_TSSI_MAXTXFDT B43_PHY_N(0x11C) /* TSSI max TX frame delay time */ -#define B43_NPHY_TSSI_MAXTXFDT_VAL 0x00FF /* max TX frame delay time */ -#define B43_NPHY_TSSI_MAXTXFDT_VAL_SHIFT 0 -#define B43_NPHY_TSSI_MAXTDT B43_PHY_N(0x11D) /* TSSI max TSSI delay time */ -#define B43_NPHY_TSSI_MAXTDT_VAL 0x00FF /* max TSSI delay time */ -#define B43_NPHY_TSSI_MAXTDT_VAL_SHIFT 0 -#define B43_NPHY_ITSSI1 B43_PHY_N(0x11E) /* TSSI idle 1 */ -#define B43_NPHY_ITSSI2 B43_PHY_N(0x11F) /* TSSI idle 2 */ -#define B43_NPHY_ITSSI_VAL 0x00FF /* Idle TSSI */ -#define B43_NPHY_ITSSI_VAL_SHIFT 0 -#define B43_NPHY_TSSIMODE B43_PHY_N(0x122) /* TSSI mode */ -#define B43_NPHY_TSSIMODE_EN 0x0001 /* TSSI enable */ -#define B43_NPHY_TSSIMODE_PDEN 0x0002 /* Power det enable */ -#define B43_NPHY_RXMACIFM B43_PHY_N(0x123) /* RX Macif mode */ -#define B43_NPHY_CRSIT_COCNT_LO B43_PHY_N(0x124) /* CRS idle time CRS-on count (low) */ -#define B43_NPHY_CRSIT_COCNT_HI B43_PHY_N(0x125) /* CRS idle time CRS-on count (high) */ -#define B43_NPHY_CRSIT_MTCNT_LO B43_PHY_N(0x126) /* CRS idle time measure time count (low) */ -#define B43_NPHY_CRSIT_MTCNT_HI B43_PHY_N(0x127) /* CRS idle time measure time count (high) */ -#define B43_NPHY_SAMTWC B43_PHY_N(0x128) /* Sample tail wait count */ -#define B43_NPHY_IQEST_CMD B43_PHY_N(0x129) /* I/Q estimate command */ -#define B43_NPHY_IQEST_CMD_START 0x0001 /* Start */ -#define B43_NPHY_IQEST_CMD_MODE 0x0002 /* Mode */ -#define B43_NPHY_IQEST_WT B43_PHY_N(0x12A) /* I/Q estimate wait time */ -#define B43_NPHY_IQEST_WT_VAL 0x00FF /* Wait time */ -#define B43_NPHY_IQEST_WT_VAL_SHIFT 0 -#define B43_NPHY_IQEST_SAMCNT B43_PHY_N(0x12B) /* I/Q estimate sample count */ -#define B43_NPHY_IQEST_IQACC_LO0 B43_PHY_N(0x12C) /* I/Q estimate I/Q acc lo 0 */ -#define B43_NPHY_IQEST_IQACC_HI0 B43_PHY_N(0x12D) /* I/Q estimate I/Q acc hi 0 */ -#define B43_NPHY_IQEST_IPACC_LO0 B43_PHY_N(0x12E) /* I/Q estimate I power acc lo 0 */ -#define B43_NPHY_IQEST_IPACC_HI0 B43_PHY_N(0x12F) /* I/Q estimate I power acc hi 0 */ -#define B43_NPHY_IQEST_QPACC_LO0 B43_PHY_N(0x130) /* I/Q estimate Q power acc lo 0 */ -#define B43_NPHY_IQEST_QPACC_HI0 B43_PHY_N(0x131) /* I/Q estimate Q power acc hi 0 */ -#define B43_NPHY_IQEST_IQACC_LO1 B43_PHY_N(0x134) /* I/Q estimate I/Q acc lo 1 */ -#define B43_NPHY_IQEST_IQACC_HI1 B43_PHY_N(0x135) /* I/Q estimate I/Q acc hi 1 */ -#define B43_NPHY_IQEST_IPACC_LO1 B43_PHY_N(0x136) /* I/Q estimate I power acc lo 1 */ -#define B43_NPHY_IQEST_IPACC_HI1 B43_PHY_N(0x137) /* I/Q estimate I power acc hi 1 */ -#define B43_NPHY_IQEST_QPACC_LO1 B43_PHY_N(0x138) /* I/Q estimate Q power acc lo 1 */ -#define B43_NPHY_IQEST_QPACC_HI1 B43_PHY_N(0x139) /* I/Q estimate Q power acc hi 1 */ -#define B43_NPHY_MIMO_CRSTXEXT B43_PHY_N(0x13A) /* MIMO PHY CRS TX extension */ -#define B43_NPHY_PWRDET1 B43_PHY_N(0x13B) /* Power det 1 */ -#define B43_NPHY_PWRDET2 B43_PHY_N(0x13C) /* Power det 2 */ -#define B43_NPHY_MAXRSSI_DTIME B43_PHY_N(0x13F) /* RSSI max RSSI delay time */ -#define B43_NPHY_PIL_DW0 B43_PHY_N(0x141) /* Pilot data weight 0 */ -#define B43_NPHY_PIL_DW1 B43_PHY_N(0x142) /* Pilot data weight 1 */ -#define B43_NPHY_PIL_DW2 B43_PHY_N(0x143) /* Pilot data weight 2 */ -#define B43_NPHY_PIL_DW_BPSK 0x000F /* BPSK */ -#define B43_NPHY_PIL_DW_BPSK_SHIFT 0 -#define B43_NPHY_PIL_DW_QPSK 0x00F0 /* QPSK */ -#define B43_NPHY_PIL_DW_QPSK_SHIFT 4 -#define B43_NPHY_PIL_DW_16QAM 0x0F00 /* 16-QAM */ -#define B43_NPHY_PIL_DW_16QAM_SHIFT 8 -#define B43_NPHY_PIL_DW_64QAM 0xF000 /* 64-QAM */ -#define B43_NPHY_PIL_DW_64QAM_SHIFT 12 -#define B43_NPHY_FMDEM_CFG B43_PHY_N(0x144) /* FM demodulation config */ -#define B43_NPHY_PHASETR_A0 B43_PHY_N(0x145) /* Phase track alpha 0 */ -#define B43_NPHY_PHASETR_A1 B43_PHY_N(0x146) /* Phase track alpha 1 */ -#define B43_NPHY_PHASETR_A2 B43_PHY_N(0x147) /* Phase track alpha 2 */ -#define B43_NPHY_PHASETR_B0 B43_PHY_N(0x148) /* Phase track beta 0 */ -#define B43_NPHY_PHASETR_B1 B43_PHY_N(0x149) /* Phase track beta 1 */ -#define B43_NPHY_PHASETR_B2 B43_PHY_N(0x14A) /* Phase track beta 2 */ -#define B43_NPHY_PHASETR_CHG0 B43_PHY_N(0x14B) /* Phase track change 0 */ -#define B43_NPHY_PHASETR_CHG1 B43_PHY_N(0x14C) /* Phase track change 1 */ -#define B43_NPHY_PHASETW_OFF B43_PHY_N(0x14D) /* Phase track offset */ -#define B43_NPHY_RFCTL_DBG B43_PHY_N(0x14E) /* RF control debug */ -#define B43_NPHY_CCK_SHIFTB_REF B43_PHY_N(0x150) /* CCK shiftbits reference var */ -#define B43_NPHY_OVER_DGAIN0 B43_PHY_N(0x152) /* Override digital gain 0 */ -#define B43_NPHY_OVER_DGAIN1 B43_PHY_N(0x153) /* Override digital gain 1 */ -#define B43_NPHY_OVER_DGAIN_FDGV 0x0007 /* Force digital gain value */ -#define B43_NPHY_OVER_DGAIN_FDGV_SHIFT 0 -#define B43_NPHY_OVER_DGAIN_FDGEN 0x0008 /* Force digital gain enable */ -#define B43_NPHY_OVER_DGAIN_CCKDGECV 0xFF00 /* CCK digital gain enable count value */ -#define B43_NPHY_OVER_DGAIN_CCKDGECV_SHIFT 8 -#define B43_NPHY_BIST_STAT4 B43_PHY_N(0x156) /* BIST status 4 */ -#define B43_NPHY_RADAR_MAL B43_PHY_N(0x157) /* Radar MA length */ -#define B43_NPHY_RADAR_SRCCTL B43_PHY_N(0x158) /* Radar search control */ -#define B43_NPHY_VLD_DTSIG B43_PHY_N(0x159) /* VLD data tones sig */ -#define B43_NPHY_VLD_DTDAT B43_PHY_N(0x15A) /* VLD data tones data */ -#define B43_NPHY_C1_BPHY_RXIQCA0 B43_PHY_N(0x15B) /* Core 1 B PHY RX I/Q comp A0 */ -#define B43_NPHY_C1_BPHY_RXIQCB0 B43_PHY_N(0x15C) /* Core 1 B PHY RX I/Q comp B0 */ -#define B43_NPHY_C2_BPHY_RXIQCA1 B43_PHY_N(0x15D) /* Core 2 B PHY RX I/Q comp A1 */ -#define B43_NPHY_C2_BPHY_RXIQCB1 B43_PHY_N(0x15E) /* Core 2 B PHY RX I/Q comp B1 */ -#define B43_NPHY_FREQGAIN0 B43_PHY_N(0x160) /* Frequency gain 0 */ -#define B43_NPHY_FREQGAIN1 B43_PHY_N(0x161) /* Frequency gain 1 */ -#define B43_NPHY_FREQGAIN2 B43_PHY_N(0x162) /* Frequency gain 2 */ -#define B43_NPHY_FREQGAIN3 B43_PHY_N(0x163) /* Frequency gain 3 */ -#define B43_NPHY_FREQGAIN4 B43_PHY_N(0x164) /* Frequency gain 4 */ -#define B43_NPHY_FREQGAIN5 B43_PHY_N(0x165) /* Frequency gain 5 */ -#define B43_NPHY_FREQGAIN6 B43_PHY_N(0x166) /* Frequency gain 6 */ -#define B43_NPHY_FREQGAIN7 B43_PHY_N(0x167) /* Frequency gain 7 */ -#define B43_NPHY_FREQGAIN_BYPASS B43_PHY_N(0x168) /* Frequency gain bypass */ -#define B43_NPHY_TRLOSS B43_PHY_N(0x169) /* TR loss value */ -#define B43_NPHY_C1_ADCCLIP B43_PHY_N(0x16A) /* Core 1 ADC clip */ -#define B43_NPHY_C2_ADCCLIP B43_PHY_N(0x16B) /* Core 2 ADC clip */ -#define B43_NPHY_LTRN_OFFGAIN B43_PHY_N(0x16F) /* LTRN offset gain */ -#define B43_NPHY_LTRN_OFF B43_PHY_N(0x170) /* LTRN offset */ -#define B43_NPHY_NRDATAT_WWISE20SIG B43_PHY_N(0x171) /* # data tones WWiSE 20 sig */ -#define B43_NPHY_NRDATAT_WWISE40SIG B43_PHY_N(0x172) /* # data tones WWiSE 40 sig */ -#define B43_NPHY_NRDATAT_TGNSYNC20SIG B43_PHY_N(0x173) /* # data tones TGNsync 20 sig */ -#define B43_NPHY_NRDATAT_TGNSYNC40SIG B43_PHY_N(0x174) /* # data tones TGNsync 40 sig */ -#define B43_NPHY_WWISE_CRCM0 B43_PHY_N(0x175) /* WWiSE CRC mask 0 */ -#define B43_NPHY_WWISE_CRCM1 B43_PHY_N(0x176) /* WWiSE CRC mask 1 */ -#define B43_NPHY_WWISE_CRCM2 B43_PHY_N(0x177) /* WWiSE CRC mask 2 */ -#define B43_NPHY_WWISE_CRCM3 B43_PHY_N(0x178) /* WWiSE CRC mask 3 */ -#define B43_NPHY_WWISE_CRCM4 B43_PHY_N(0x179) /* WWiSE CRC mask 4 */ -#define B43_NPHY_CHANEST_CDDSH B43_PHY_N(0x17A) /* Channel estimate CDD shift */ -#define B43_NPHY_HTAGC_WCNT B43_PHY_N(0x17B) /* HT ADC wait counters */ -#define B43_NPHY_SQPARM B43_PHY_N(0x17C) /* SQ params */ -#define B43_NPHY_MCSDUP6M B43_PHY_N(0x17D) /* MCS dup 6M */ -#define B43_NPHY_NDATAT_DUP40 B43_PHY_N(0x17E) /* # data tones dup 40 */ -#define B43_NPHY_DUP40_TGNSYNC_CYCD B43_PHY_N(0x17F) /* Dup40 TGNsync cycle data */ -#define B43_NPHY_DUP40_GFBL B43_PHY_N(0x180) /* Dup40 GF format BL address */ -#define B43_NPHY_DUP40_BL B43_PHY_N(0x181) /* Dup40 format BL address */ -#define B43_NPHY_LEGDUP_FTA B43_PHY_N(0x182) /* Legacy dup frm table address */ -#define B43_NPHY_PACPROC_DBG B43_PHY_N(0x183) /* Packet processing debug */ -#define B43_NPHY_PIL_CYC1 B43_PHY_N(0x184) /* Pilot cycle counter 1 */ -#define B43_NPHY_PIL_CYC2 B43_PHY_N(0x185) /* Pilot cycle counter 2 */ -#define B43_NPHY_TXF_20CO_S0A1 B43_PHY_N(0x186) /* TX filter 20 coeff stage 0 A1 */ -#define B43_NPHY_TXF_20CO_S0A2 B43_PHY_N(0x187) /* TX filter 20 coeff stage 0 A2 */ -#define B43_NPHY_TXF_20CO_S1A1 B43_PHY_N(0x188) /* TX filter 20 coeff stage 1 A1 */ -#define B43_NPHY_TXF_20CO_S1A2 B43_PHY_N(0x189) /* TX filter 20 coeff stage 1 A2 */ -#define B43_NPHY_TXF_20CO_S2A1 B43_PHY_N(0x18A) /* TX filter 20 coeff stage 2 A1 */ -#define B43_NPHY_TXF_20CO_S2A2 B43_PHY_N(0x18B) /* TX filter 20 coeff stage 2 A2 */ -#define B43_NPHY_TXF_20CO_S0B1 B43_PHY_N(0x18C) /* TX filter 20 coeff stage 0 B1 */ -#define B43_NPHY_TXF_20CO_S0B2 B43_PHY_N(0x18D) /* TX filter 20 coeff stage 0 B2 */ -#define B43_NPHY_TXF_20CO_S0B3 B43_PHY_N(0x18E) /* TX filter 20 coeff stage 0 B3 */ -#define B43_NPHY_TXF_20CO_S1B1 B43_PHY_N(0x18F) /* TX filter 20 coeff stage 1 B1 */ -#define B43_NPHY_TXF_20CO_S1B2 B43_PHY_N(0x190) /* TX filter 20 coeff stage 1 B2 */ -#define B43_NPHY_TXF_20CO_S1B3 B43_PHY_N(0x191) /* TX filter 20 coeff stage 1 B3 */ -#define B43_NPHY_TXF_20CO_S2B1 B43_PHY_N(0x192) /* TX filter 20 coeff stage 2 B1 */ -#define B43_NPHY_TXF_20CO_S2B2 B43_PHY_N(0x193) /* TX filter 20 coeff stage 2 B2 */ -#define B43_NPHY_TXF_20CO_S2B3 B43_PHY_N(0x194) /* TX filter 20 coeff stage 2 B3 */ -#define B43_NPHY_TXF_40CO_S0A1 B43_PHY_N(0x195) /* TX filter 40 coeff stage 0 A1 */ -#define B43_NPHY_TXF_40CO_S0A2 B43_PHY_N(0x196) /* TX filter 40 coeff stage 0 A2 */ -#define B43_NPHY_TXF_40CO_S1A1 B43_PHY_N(0x197) /* TX filter 40 coeff stage 1 A1 */ -#define B43_NPHY_TXF_40CO_S1A2 B43_PHY_N(0x198) /* TX filter 40 coeff stage 1 A2 */ -#define B43_NPHY_TXF_40CO_S2A1 B43_PHY_N(0x199) /* TX filter 40 coeff stage 2 A1 */ -#define B43_NPHY_TXF_40CO_S2A2 B43_PHY_N(0x19A) /* TX filter 40 coeff stage 2 A2 */ -#define B43_NPHY_TXF_40CO_S0B1 B43_PHY_N(0x19B) /* TX filter 40 coeff stage 0 B1 */ -#define B43_NPHY_TXF_40CO_S0B2 B43_PHY_N(0x19C) /* TX filter 40 coeff stage 0 B2 */ -#define B43_NPHY_TXF_40CO_S0B3 B43_PHY_N(0x19D) /* TX filter 40 coeff stage 0 B3 */ -#define B43_NPHY_TXF_40CO_S1B1 B43_PHY_N(0x19E) /* TX filter 40 coeff stage 1 B1 */ -#define B43_NPHY_TXF_40CO_S1B2 B43_PHY_N(0x19F) /* TX filter 40 coeff stage 1 B2 */ -#define B43_NPHY_TXF_40CO_S1B3 B43_PHY_N(0x1A0) /* TX filter 40 coeff stage 1 B3 */ -#define B43_NPHY_TXF_40CO_S2B1 B43_PHY_N(0x1A1) /* TX filter 40 coeff stage 2 B1 */ -#define B43_NPHY_TXF_40CO_S2B2 B43_PHY_N(0x1A2) /* TX filter 40 coeff stage 2 B2 */ -#define B43_NPHY_TXF_40CO_S2B3 B43_PHY_N(0x1A3) /* TX filter 40 coeff stage 2 B3 */ -#define B43_NPHY_RSSIMC_0I_RSSI_X B43_PHY_N(0x1A4) /* RSSI multiplication coefficient 0 I RSSI X */ -#define B43_NPHY_RSSIMC_0I_RSSI_Y B43_PHY_N(0x1A5) /* RSSI multiplication coefficient 0 I RSSI Y */ -#define B43_NPHY_RSSIMC_0I_RSSI_Z B43_PHY_N(0x1A6) /* RSSI multiplication coefficient 0 I RSSI Z */ -#define B43_NPHY_RSSIMC_0I_TBD B43_PHY_N(0x1A7) /* RSSI multiplication coefficient 0 I TBD */ -#define B43_NPHY_RSSIMC_0I_PWRDET B43_PHY_N(0x1A8) /* RSSI multiplication coefficient 0 I power det */ -#define B43_NPHY_RSSIMC_0I_TSSI B43_PHY_N(0x1A9) /* RSSI multiplication coefficient 0 I TSSI */ -#define B43_NPHY_RSSIMC_0Q_RSSI_X B43_PHY_N(0x1AA) /* RSSI multiplication coefficient 0 Q RSSI X */ -#define B43_NPHY_RSSIMC_0Q_RSSI_Y B43_PHY_N(0x1AB) /* RSSI multiplication coefficient 0 Q RSSI Y */ -#define B43_NPHY_RSSIMC_0Q_RSSI_Z B43_PHY_N(0x1AC) /* RSSI multiplication coefficient 0 Q RSSI Z */ -#define B43_NPHY_RSSIMC_0Q_TBD B43_PHY_N(0x1AD) /* RSSI multiplication coefficient 0 Q TBD */ -#define B43_NPHY_RSSIMC_0Q_PWRDET B43_PHY_N(0x1AE) /* RSSI multiplication coefficient 0 Q power det */ -#define B43_NPHY_RSSIMC_0Q_TSSI B43_PHY_N(0x1AF) /* RSSI multiplication coefficient 0 Q TSSI */ -#define B43_NPHY_RSSIMC_1I_RSSI_X B43_PHY_N(0x1B0) /* RSSI multiplication coefficient 1 I RSSI X */ -#define B43_NPHY_RSSIMC_1I_RSSI_Y B43_PHY_N(0x1B1) /* RSSI multiplication coefficient 1 I RSSI Y */ -#define B43_NPHY_RSSIMC_1I_RSSI_Z B43_PHY_N(0x1B2) /* RSSI multiplication coefficient 1 I RSSI Z */ -#define B43_NPHY_RSSIMC_1I_TBD B43_PHY_N(0x1B3) /* RSSI multiplication coefficient 1 I TBD */ -#define B43_NPHY_RSSIMC_1I_PWRDET B43_PHY_N(0x1B4) /* RSSI multiplication coefficient 1 I power det */ -#define B43_NPHY_RSSIMC_1I_TSSI B43_PHY_N(0x1B5) /* RSSI multiplication coefficient 1 I TSSI */ -#define B43_NPHY_RSSIMC_1Q_RSSI_X B43_PHY_N(0x1B6) /* RSSI multiplication coefficient 1 Q RSSI X */ -#define B43_NPHY_RSSIMC_1Q_RSSI_Y B43_PHY_N(0x1B7) /* RSSI multiplication coefficient 1 Q RSSI Y */ -#define B43_NPHY_RSSIMC_1Q_RSSI_Z B43_PHY_N(0x1B8) /* RSSI multiplication coefficient 1 Q RSSI Z */ -#define B43_NPHY_RSSIMC_1Q_TBD B43_PHY_N(0x1B9) /* RSSI multiplication coefficient 1 Q TBD */ -#define B43_NPHY_RSSIMC_1Q_PWRDET B43_PHY_N(0x1BA) /* RSSI multiplication coefficient 1 Q power det */ -#define B43_NPHY_RSSIMC_1Q_TSSI B43_PHY_N(0x1BB) /* RSSI multiplication coefficient 1 Q TSSI */ -#define B43_NPHY_SAMC_WCNT B43_PHY_N(0x1BC) /* Sample collect wait counter */ -#define B43_NPHY_PTHROUGH_CNT B43_PHY_N(0x1BD) /* Pass-through counter */ -#define B43_NPHY_LTRN_OFF_G20L B43_PHY_N(0x1C4) /* LTRN offset gain 20L */ -#define B43_NPHY_LTRN_OFF_20L B43_PHY_N(0x1C5) /* LTRN offset 20L */ -#define B43_NPHY_LTRN_OFF_G20U B43_PHY_N(0x1C6) /* LTRN offset gain 20U */ -#define B43_NPHY_LTRN_OFF_20U B43_PHY_N(0x1C7) /* LTRN offset 20U */ -#define B43_NPHY_DSSSCCK_GAINSL B43_PHY_N(0x1C8) /* DSSS/CCK gain settle length */ -#define B43_NPHY_GPIO_LOOUT B43_PHY_N(0x1C9) /* GPIO low out */ -#define B43_NPHY_GPIO_HIOUT B43_PHY_N(0x1CA) /* GPIO high out */ -#define B43_NPHY_CRS_CHECK B43_PHY_N(0x1CB) /* CRS check */ -#define B43_NPHY_ML_LOGSS_RAT B43_PHY_N(0x1CC) /* ML/logss ratio */ -#define B43_NPHY_DUPSCALE B43_PHY_N(0x1CD) /* Dup scale */ -#define B43_NPHY_BW1A B43_PHY_N(0x1CE) /* BW 1A */ -#define B43_NPHY_BW2 B43_PHY_N(0x1CF) /* BW 2 */ -#define B43_NPHY_BW3 B43_PHY_N(0x1D0) /* BW 3 */ -#define B43_NPHY_BW4 B43_PHY_N(0x1D1) /* BW 4 */ -#define B43_NPHY_BW5 B43_PHY_N(0x1D2) /* BW 5 */ -#define B43_NPHY_BW6 B43_PHY_N(0x1D3) /* BW 6 */ -#define B43_NPHY_COALEN0 B43_PHY_N(0x1D4) /* Coarse length 0 */ -#define B43_NPHY_COALEN1 B43_PHY_N(0x1D5) /* Coarse length 1 */ -#define B43_NPHY_CRSTHRES_1U B43_PHY_N(0x1D6) /* CRS threshold 1 U */ -#define B43_NPHY_CRSTHRES_2U B43_PHY_N(0x1D7) /* CRS threshold 2 U */ -#define B43_NPHY_CRSTHRES_3U B43_PHY_N(0x1D8) /* CRS threshold 3 U */ -#define B43_NPHY_CRSCTL_U B43_PHY_N(0x1D9) /* CRS control U */ -#define B43_NPHY_CRSTHRES_1L B43_PHY_N(0x1DA) /* CRS threshold 1 L */ -#define B43_NPHY_CRSTHRES_2L B43_PHY_N(0x1DB) /* CRS threshold 2 L */ -#define B43_NPHY_CRSTHRES_3L B43_PHY_N(0x1DC) /* CRS threshold 3 L */ -#define B43_NPHY_CRSCTL_L B43_PHY_N(0x1DD) /* CRS control L */ -#define B43_NPHY_STRA_1U B43_PHY_N(0x1DE) /* STR address 1 U */ -#define B43_NPHY_STRA_2U B43_PHY_N(0x1DF) /* STR address 2 U */ -#define B43_NPHY_STRA_1L B43_PHY_N(0x1E0) /* STR address 1 L */ -#define B43_NPHY_STRA_2L B43_PHY_N(0x1E1) /* STR address 2 L */ -#define B43_NPHY_CRSCHECK1 B43_PHY_N(0x1E2) /* CRS check 1 */ -#define B43_NPHY_CRSCHECK2 B43_PHY_N(0x1E3) /* CRS check 2 */ -#define B43_NPHY_CRSCHECK3 B43_PHY_N(0x1E4) /* CRS check 3 */ -#define B43_NPHY_JMPSTP0 B43_PHY_N(0x1E5) /* Jump step 0 */ -#define B43_NPHY_JMPSTP1 B43_PHY_N(0x1E6) /* Jump step 1 */ -#define B43_NPHY_TXPCTL_CMD B43_PHY_N(0x1E7) /* TX power control command */ -#define B43_NPHY_TXPCTL_CMD_INIT 0x007F /* Init */ -#define B43_NPHY_TXPCTL_CMD_INIT_SHIFT 0 -#define B43_NPHY_TXPCTL_CMD_COEFF 0x2000 /* Power control coefficients */ -#define B43_NPHY_TXPCTL_CMD_HWPCTLEN 0x4000 /* Hardware TX power control enable */ -#define B43_NPHY_TXPCTL_CMD_PCTLEN 0x8000 /* TX power control enable */ -#define B43_NPHY_TXPCTL_N B43_PHY_N(0x1E8) /* TX power control N num */ -#define B43_NPHY_TXPCTL_N_TSSID 0x00FF /* N TSSI delay */ -#define B43_NPHY_TXPCTL_N_TSSID_SHIFT 0 -#define B43_NPHY_TXPCTL_N_NPTIL2 0x0700 /* N PT integer log2 */ -#define B43_NPHY_TXPCTL_N_NPTIL2_SHIFT 8 -#define B43_NPHY_TXPCTL_ITSSI B43_PHY_N(0x1E9) /* TX power control idle TSSI */ -#define B43_NPHY_TXPCTL_ITSSI_0 0x003F /* Idle TSSI 0 */ -#define B43_NPHY_TXPCTL_ITSSI_0_SHIFT 0 -#define B43_NPHY_TXPCTL_ITSSI_1 0x3F00 /* Idle TSSI 1 */ -#define B43_NPHY_TXPCTL_ITSSI_1_SHIFT 8 -#define B43_NPHY_TXPCTL_ITSSI_BINF 0x8000 /* Raw TSSI offset bin format */ -#define B43_NPHY_TXPCTL_TPWR B43_PHY_N(0x1EA) /* TX power control target power */ -#define B43_NPHY_TXPCTL_TPWR_0 0x00FF /* Power 0 */ -#define B43_NPHY_TXPCTL_TPWR_0_SHIFT 0 -#define B43_NPHY_TXPCTL_TPWR_1 0xFF00 /* Power 1 */ -#define B43_NPHY_TXPCTL_TPWR_1_SHIFT 8 -#define B43_NPHY_TXPCTL_BIDX B43_PHY_N(0x1EB) /* TX power control base index */ -#define B43_NPHY_TXPCTL_BIDX_0 0x007F /* uC base index 0 */ -#define B43_NPHY_TXPCTL_BIDX_0_SHIFT 0 -#define B43_NPHY_TXPCTL_BIDX_1 0x7F00 /* uC base index 1 */ -#define B43_NPHY_TXPCTL_BIDX_1_SHIFT 8 -#define B43_NPHY_TXPCTL_BIDX_LOAD 0x8000 /* Load base index */ -#define B43_NPHY_TXPCTL_PIDX B43_PHY_N(0x1EC) /* TX power control power index */ -#define B43_NPHY_TXPCTL_PIDX_0 0x007F /* uC power index 0 */ -#define B43_NPHY_TXPCTL_PIDX_0_SHIFT 0 -#define B43_NPHY_TXPCTL_PIDX_1 0x7F00 /* uC power index 1 */ -#define B43_NPHY_TXPCTL_PIDX_1_SHIFT 8 -#define B43_NPHY_C1_TXPCTL_STAT B43_PHY_N(0x1ED) /* Core 1 TX power control status */ -#define B43_NPHY_C2_TXPCTL_STAT B43_PHY_N(0x1EE) /* Core 2 TX power control status */ -#define B43_NPHY_TXPCTL_STAT_EST 0x00FF /* Estimated power */ -#define B43_NPHY_TXPCTL_STAT_EST_SHIFT 0 -#define B43_NPHY_TXPCTL_STAT_BIDX 0x7F00 /* Base index */ -#define B43_NPHY_TXPCTL_STAT_BIDX_SHIFT 8 -#define B43_NPHY_TXPCTL_STAT_ESTVALID 0x8000 /* Estimated power valid */ -#define B43_NPHY_SMALLSGS_LEN B43_PHY_N(0x1EF) /* Small sig gain settle length */ -#define B43_NPHY_PHYSTAT_GAIN0 B43_PHY_N(0x1F0) /* PHY stats gain info 0 */ -#define B43_NPHY_PHYSTAT_GAIN1 B43_PHY_N(0x1F1) /* PHY stats gain info 1 */ -#define B43_NPHY_PHYSTAT_FREQEST B43_PHY_N(0x1F2) /* PHY stats frequency estimate */ -#define B43_NPHY_PHYSTAT_ADVRET B43_PHY_N(0x1F3) /* PHY stats ADV retard */ -#define B43_NPHY_PHYLB_MODE B43_PHY_N(0x1F4) /* PHY loopback mode */ -#define B43_NPHY_TONE_MIDX20_1 B43_PHY_N(0x1F5) /* Tone map index 20/1 */ -#define B43_NPHY_TONE_MIDX20_2 B43_PHY_N(0x1F6) /* Tone map index 20/2 */ -#define B43_NPHY_TONE_MIDX20_3 B43_PHY_N(0x1F7) /* Tone map index 20/3 */ -#define B43_NPHY_TONE_MIDX40_1 B43_PHY_N(0x1F8) /* Tone map index 40/1 */ -#define B43_NPHY_TONE_MIDX40_2 B43_PHY_N(0x1F9) /* Tone map index 40/2 */ -#define B43_NPHY_TONE_MIDX40_3 B43_PHY_N(0x1FA) /* Tone map index 40/3 */ -#define B43_NPHY_TONE_MIDX40_4 B43_PHY_N(0x1FB) /* Tone map index 40/4 */ -#define B43_NPHY_PILTONE_MIDX1 B43_PHY_N(0x1FC) /* Pilot tone map index 1 */ -#define B43_NPHY_PILTONE_MIDX2 B43_PHY_N(0x1FD) /* Pilot tone map index 2 */ -#define B43_NPHY_PILTONE_MIDX3 B43_PHY_N(0x1FE) /* Pilot tone map index 3 */ -#define B43_NPHY_TXRIFS_FRDEL B43_PHY_N(0x1FF) /* TX RIFS frame delay */ -#define B43_NPHY_AFESEQ_RX2TX_PUD_40M B43_PHY_N(0x200) /* AFE seq rx2tx power up/down delay 40M */ -#define B43_NPHY_AFESEQ_TX2RX_PUD_40M B43_PHY_N(0x201) /* AFE seq tx2rx power up/down delay 40M */ -#define B43_NPHY_AFESEQ_RX2TX_PUD_20M B43_PHY_N(0x202) /* AFE seq rx2tx power up/down delay 20M */ -#define B43_NPHY_AFESEQ_TX2RX_PUD_20M B43_PHY_N(0x203) /* AFE seq tx2rx power up/down delay 20M */ -#define B43_NPHY_RX_SIGCTL B43_PHY_N(0x204) /* RX signal control */ -#define B43_NPHY_RXPIL_CYCNT0 B43_PHY_N(0x205) /* RX pilot cycle counter 0 */ -#define B43_NPHY_RXPIL_CYCNT1 B43_PHY_N(0x206) /* RX pilot cycle counter 1 */ -#define B43_NPHY_RXPIL_CYCNT2 B43_PHY_N(0x207) /* RX pilot cycle counter 2 */ -#define B43_NPHY_AFESEQ_RX2TX_PUD_10M B43_PHY_N(0x208) /* AFE seq rx2tx power up/down delay 10M */ -#define B43_NPHY_AFESEQ_TX2RX_PUD_10M B43_PHY_N(0x209) /* AFE seq tx2rx power up/down delay 10M */ -#define B43_NPHY_DSSSCCK_CRSEXTL B43_PHY_N(0x20A) /* DSSS/CCK CRS extension length */ -#define B43_NPHY_ML_LOGSS_RATSLOPE B43_PHY_N(0x20B) /* ML/logss ratio slope */ -#define B43_NPHY_RIFS_SRCTL B43_PHY_N(0x20C) /* RIFS search timeout length */ -#define B43_NPHY_TXREALFD B43_PHY_N(0x20D) /* TX real frame delay */ -#define B43_NPHY_HPANT_SWTHRES B43_PHY_N(0x20E) /* High power antenna switch threshold */ -#define B43_NPHY_EDCRS_ASSTHRES0 B43_PHY_N(0x210) /* ED CRS assert threshold 0 */ -#define B43_NPHY_EDCRS_ASSTHRES1 B43_PHY_N(0x211) /* ED CRS assert threshold 1 */ -#define B43_NPHY_EDCRS_DEASSTHRES0 B43_PHY_N(0x212) /* ED CRS deassert threshold 0 */ -#define B43_NPHY_EDCRS_DEASSTHRES1 B43_PHY_N(0x213) /* ED CRS deassert threshold 1 */ -#define B43_NPHY_STR_WTIME20U B43_PHY_N(0x214) /* STR wait time 20U */ -#define B43_NPHY_STR_WTIME20L B43_PHY_N(0x215) /* STR wait time 20L */ -#define B43_NPHY_TONE_MIDX657M B43_PHY_N(0x216) /* Tone map index 657M */ -#define B43_NPHY_HTSIGTONES B43_PHY_N(0x217) /* HT signal tones */ -#define B43_NPHY_RSSI1 B43_PHY_N(0x219) /* RSSI value 1 */ -#define B43_NPHY_RSSI2 B43_PHY_N(0x21A) /* RSSI value 2 */ -#define B43_NPHY_CHAN_ESTHANG B43_PHY_N(0x21D) /* Channel estimate hang */ -#define B43_NPHY_FINERX2_CGC B43_PHY_N(0x221) /* Fine RX 2 clock gate control */ -#define B43_NPHY_FINERX2_CGC_DECGC 0x0008 /* Decode gated clocks */ -#define B43_NPHY_TXPCTL_INIT B43_PHY_N(0x222) /* TX power control init */ -#define B43_NPHY_TXPCTL_INIT_PIDXI1 0x00FF /* Power index init 1 */ -#define B43_NPHY_TXPCTL_INIT_PIDXI1_SHIFT 0 -#define B43_NPHY_ED_CRSEN B43_PHY_N(0x223) -#define B43_NPHY_ED_CRS40ASSERTTHRESH0 B43_PHY_N(0x224) -#define B43_NPHY_ED_CRS40ASSERTTHRESH1 B43_PHY_N(0x225) -#define B43_NPHY_ED_CRS40DEASSERTTHRESH0 B43_PHY_N(0x226) -#define B43_NPHY_ED_CRS40DEASSERTTHRESH1 B43_PHY_N(0x227) -#define B43_NPHY_ED_CRS20LASSERTTHRESH0 B43_PHY_N(0x228) -#define B43_NPHY_ED_CRS20LASSERTTHRESH1 B43_PHY_N(0x229) -#define B43_NPHY_ED_CRS20LDEASSERTTHRESH0 B43_PHY_N(0x22A) -#define B43_NPHY_ED_CRS20LDEASSERTTHRESH1 B43_PHY_N(0x22B) -#define B43_NPHY_ED_CRS20UASSERTTHRESH0 B43_PHY_N(0x22C) -#define B43_NPHY_ED_CRS20UASSERTTHRESH1 B43_PHY_N(0x22D) -#define B43_NPHY_ED_CRS20UDEASSERTTHRESH0 B43_PHY_N(0x22E) -#define B43_NPHY_ED_CRS20UDEASSERTTHRESH1 B43_PHY_N(0x22F) -#define B43_NPHY_ED_CRS B43_PHY_N(0x230) -#define B43_NPHY_TIMEOUTEN B43_PHY_N(0x231) -#define B43_NPHY_OFDMPAYDECODETIMEOUTLEN B43_PHY_N(0x232) -#define B43_NPHY_CCKPAYDECODETIMEOUTLEN B43_PHY_N(0x233) -#define B43_NPHY_NONPAYDECODETIMEOUTLEN B43_PHY_N(0x234) -#define B43_NPHY_TIMEOUTSTATUS B43_PHY_N(0x235) -#define B43_NPHY_RFCTRLCORE0GPIO0 B43_PHY_N(0x236) -#define B43_NPHY_RFCTRLCORE0GPIO1 B43_PHY_N(0x237) -#define B43_NPHY_RFCTRLCORE0GPIO2 B43_PHY_N(0x238) -#define B43_NPHY_RFCTRLCORE0GPIO3 B43_PHY_N(0x239) -#define B43_NPHY_RFCTRLCORE1GPIO0 B43_PHY_N(0x23A) -#define B43_NPHY_RFCTRLCORE1GPIO1 B43_PHY_N(0x23B) -#define B43_NPHY_RFCTRLCORE1GPIO2 B43_PHY_N(0x23C) -#define B43_NPHY_RFCTRLCORE1GPIO3 B43_PHY_N(0x23D) -#define B43_NPHY_BPHYTESTCONTROL B43_PHY_N(0x23E) -/* REV3+ */ -#define B43_NPHY_FORCEFRONT0 B43_PHY_N(0x23F) -#define B43_NPHY_FORCEFRONT1 B43_PHY_N(0x240) -#define B43_NPHY_NORMVARHYSTTH B43_PHY_N(0x241) -#define B43_NPHY_TXCCKERROR B43_PHY_N(0x242) -#define B43_NPHY_AFESEQINITDACGAIN B43_PHY_N(0x243) -#define B43_NPHY_TXANTSWLUT B43_PHY_N(0x244) -#define B43_NPHY_CORECONFIG B43_PHY_N(0x245) -#define B43_NPHY_ANTENNADIVDWELLTIME B43_PHY_N(0x246) -#define B43_NPHY_ANTENNACCKDIVDWELLTIME B43_PHY_N(0x247) -#define B43_NPHY_ANTENNADIVBACKOFFGAIN B43_PHY_N(0x248) -#define B43_NPHY_ANTENNADIVMINGAIN B43_PHY_N(0x249) -#define B43_NPHY_BRDSEL_NORMVARHYSTTH B43_PHY_N(0x24A) -#define B43_NPHY_RXANTSWITCHCTRL B43_PHY_N(0x24B) -#define B43_NPHY_ENERGYDROPTIMEOUTLEN2 B43_PHY_N(0x24C) -#define B43_NPHY_ML_LOG_TXEVM0 B43_PHY_N(0x250) -#define B43_NPHY_ML_LOG_TXEVM1 B43_PHY_N(0x251) -#define B43_NPHY_ML_LOG_TXEVM2 B43_PHY_N(0x252) -#define B43_NPHY_ML_LOG_TXEVM3 B43_PHY_N(0x253) -#define B43_NPHY_ML_LOG_TXEVM4 B43_PHY_N(0x254) -#define B43_NPHY_ML_LOG_TXEVM5 B43_PHY_N(0x255) -#define B43_NPHY_ML_LOG_TXEVM6 B43_PHY_N(0x256) -#define B43_NPHY_ML_LOG_TXEVM7 B43_PHY_N(0x257) -#define B43_NPHY_ML_SCALE_TWEAK B43_PHY_N(0x258) -#define B43_NPHY_MLUA B43_PHY_N(0x259) -#define B43_NPHY_ZFUA B43_PHY_N(0x25A) -#define B43_NPHY_CHANUPSYM01 B43_PHY_N(0x25B) -#define B43_NPHY_CHANUPSYM2 B43_PHY_N(0x25C) -#define B43_NPHY_RXSTRNFILT20NUM00 B43_PHY_N(0x25D) -#define B43_NPHY_RXSTRNFILT20NUM01 B43_PHY_N(0x25E) -#define B43_NPHY_RXSTRNFILT20NUM02 B43_PHY_N(0x25F) -#define B43_NPHY_RXSTRNFILT20DEN00 B43_PHY_N(0x260) -#define B43_NPHY_RXSTRNFILT20DEN01 B43_PHY_N(0x261) -#define B43_NPHY_RXSTRNFILT20NUM10 B43_PHY_N(0x262) -#define B43_NPHY_RXSTRNFILT20NUM11 B43_PHY_N(0x263) -#define B43_NPHY_RXSTRNFILT20NUM12 B43_PHY_N(0x264) -#define B43_NPHY_RXSTRNFILT20DEN10 B43_PHY_N(0x265) -#define B43_NPHY_RXSTRNFILT20DEN11 B43_PHY_N(0x266) -#define B43_NPHY_RXSTRNFILT40NUM00 B43_PHY_N(0x267) -#define B43_NPHY_RXSTRNFILT40NUM01 B43_PHY_N(0x268) -#define B43_NPHY_RXSTRNFILT40NUM02 B43_PHY_N(0x269) -#define B43_NPHY_RXSTRNFILT40DEN00 B43_PHY_N(0x26A) -#define B43_NPHY_RXSTRNFILT40DEN01 B43_PHY_N(0x26B) -#define B43_NPHY_RXSTRNFILT40NUM10 B43_PHY_N(0x26C) -#define B43_NPHY_RXSTRNFILT40NUM11 B43_PHY_N(0x26D) -#define B43_NPHY_RXSTRNFILT40NUM12 B43_PHY_N(0x26E) -#define B43_NPHY_RXSTRNFILT40DEN10 B43_PHY_N(0x26F) -#define B43_NPHY_RXSTRNFILT40DEN11 B43_PHY_N(0x270) -#define B43_NPHY_CRSHIGHPOWTHRESHOLD1 B43_PHY_N(0x271) -#define B43_NPHY_CRSHIGHPOWTHRESHOLD2 B43_PHY_N(0x272) -#define B43_NPHY_CRSHIGHLOWPOWTHRESHOLD B43_PHY_N(0x273) -#define B43_NPHY_CRSHIGHPOWTHRESHOLD1L B43_PHY_N(0x274) -#define B43_NPHY_CRSHIGHPOWTHRESHOLD2L B43_PHY_N(0x275) -#define B43_NPHY_CRSHIGHLOWPOWTHRESHOLDL B43_PHY_N(0x276) -#define B43_NPHY_CRSHIGHPOWTHRESHOLD1U B43_PHY_N(0x277) -#define B43_NPHY_CRSHIGHPOWTHRESHOLD2U B43_PHY_N(0x278) -#define B43_NPHY_CRSHIGHLOWPOWTHRESHOLDU B43_PHY_N(0x279) -#define B43_NPHY_CRSACIDETECTTHRESH B43_PHY_N(0x27A) -#define B43_NPHY_CRSACIDETECTTHRESHL B43_PHY_N(0x27B) -#define B43_NPHY_CRSACIDETECTTHRESHU B43_PHY_N(0x27C) -#define B43_NPHY_CRSMINPOWER0 B43_PHY_N(0x27D) -#define B43_NPHY_CRSMINPOWER1 B43_PHY_N(0x27E) -#define B43_NPHY_CRSMINPOWER2 B43_PHY_N(0x27F) -#define B43_NPHY_CRSMINPOWERL0 B43_PHY_N(0x280) -#define B43_NPHY_CRSMINPOWERL1 B43_PHY_N(0x281) -#define B43_NPHY_CRSMINPOWERL2 B43_PHY_N(0x282) -#define B43_NPHY_CRSMINPOWERU0 B43_PHY_N(0x283) -#define B43_NPHY_CRSMINPOWERU1 B43_PHY_N(0x284) -#define B43_NPHY_CRSMINPOWERU2 B43_PHY_N(0x285) -#define B43_NPHY_STRPARAM B43_PHY_N(0x286) -#define B43_NPHY_STRPARAML B43_PHY_N(0x287) -#define B43_NPHY_STRPARAMU B43_PHY_N(0x288) -#define B43_NPHY_BPHYCRSMINPOWER0 B43_PHY_N(0x289) -#define B43_NPHY_BPHYCRSMINPOWER1 B43_PHY_N(0x28A) -#define B43_NPHY_BPHYCRSMINPOWER2 B43_PHY_N(0x28B) -#define B43_NPHY_BPHYFILTDEN0COEF B43_PHY_N(0x28C) -#define B43_NPHY_BPHYFILTDEN1COEF B43_PHY_N(0x28D) -#define B43_NPHY_BPHYFILTDEN2COEF B43_PHY_N(0x28E) -#define B43_NPHY_BPHYFILTNUM0COEF B43_PHY_N(0x28F) -#define B43_NPHY_BPHYFILTNUM1COEF B43_PHY_N(0x290) -#define B43_NPHY_BPHYFILTNUM2COEF B43_PHY_N(0x291) -#define B43_NPHY_BPHYFILTNUM01COEF2 B43_PHY_N(0x292) -#define B43_NPHY_BPHYFILTBYPASS B43_PHY_N(0x293) -#define B43_NPHY_SGILTRNOFFSET B43_PHY_N(0x294) -#define B43_NPHY_RADAR_T2_MIN B43_PHY_N(0x295) -#define B43_NPHY_TXPWRCTRLDAMPING B43_PHY_N(0x296) -#define B43_NPHY_PAPD_EN0 B43_PHY_N(0x297) /* PAPD Enable0 TBD */ -#define B43_NPHY_EPS_TABLE_ADJ0 B43_PHY_N(0x298) /* EPS Table Adj0 TBD */ -#define B43_NPHY_EPS_OVERRIDEI_0 B43_PHY_N(0x299) -#define B43_NPHY_EPS_OVERRIDEQ_0 B43_PHY_N(0x29A) -#define B43_NPHY_PAPD_EN1 B43_PHY_N(0x29B) /* PAPD Enable1 TBD */ -#define B43_NPHY_EPS_TABLE_ADJ1 B43_PHY_N(0x29C) /* EPS Table Adj1 TBD */ -#define B43_NPHY_EPS_OVERRIDEI_1 B43_PHY_N(0x29D) -#define B43_NPHY_EPS_OVERRIDEQ_1 B43_PHY_N(0x29E) -#define B43_NPHY_PAPD_CAL_ADDRESS B43_PHY_N(0x29F) -#define B43_NPHY_PAPD_CAL_YREFEPSILON B43_PHY_N(0x2A0) -#define B43_NPHY_PAPD_CAL_SETTLE B43_PHY_N(0x2A1) -#define B43_NPHY_PAPD_CAL_CORRELATE B43_PHY_N(0x2A2) -#define B43_NPHY_PAPD_CAL_SHIFTS0 B43_PHY_N(0x2A3) -#define B43_NPHY_PAPD_CAL_SHIFTS1 B43_PHY_N(0x2A4) -#define B43_NPHY_SAMPLE_START_ADDR B43_PHY_N(0x2A5) -#define B43_NPHY_RADAR_ADC_TO_DBM B43_PHY_N(0x2A6) -#define B43_NPHY_REV3_C2_INITGAIN_A B43_PHY_N(0x2A7) -#define B43_NPHY_REV3_C2_INITGAIN_B B43_PHY_N(0x2A8) -#define B43_NPHY_REV3_C2_CLIP_HIGAIN_A B43_PHY_N(0x2A9) -#define B43_NPHY_REV3_C2_CLIP_HIGAIN_B B43_PHY_N(0x2AA) -#define B43_NPHY_REV3_C2_CLIP_MEDGAIN_A B43_PHY_N(0x2AB) -#define B43_NPHY_REV3_C2_CLIP_MEDGAIN_B B43_PHY_N(0x2AC) -#define B43_NPHY_REV3_C2_CLIP_LOGAIN_A B43_PHY_N(0x2AD) -#define B43_NPHY_REV3_C2_CLIP_LOGAIN_B B43_PHY_N(0x2AE) -#define B43_NPHY_REV3_C2_CLIP2_GAIN_A B43_PHY_N(0x2AF) -#define B43_NPHY_REV3_C2_CLIP2_GAIN_B B43_PHY_N(0x2B0) - -#define B43_PHY_B_BBCFG B43_PHY_N_BMODE(0x001) /* BB config */ -#define B43_PHY_B_TEST B43_PHY_N_BMODE(0x00A) - -struct b43_wldev; - -enum b43_nphy_spur_avoid { - B43_SPUR_AVOID_DISABLE, - B43_SPUR_AVOID_AUTO, - B43_SPUR_AVOID_FORCE, -}; - -struct b43_chanspec { - u16 center_freq; - enum nl80211_channel_type channel_type; -}; - -struct b43_phy_n_iq_comp { - s16 a0; - s16 b0; - s16 a1; - s16 b1; -}; - -struct b43_phy_n_rssical_cache { - u16 rssical_radio_regs_2G[2]; - u16 rssical_phy_regs_2G[12]; - - u16 rssical_radio_regs_5G[2]; - u16 rssical_phy_regs_5G[12]; -}; - -struct b43_phy_n_cal_cache { - u16 txcal_radio_regs_2G[8]; - u16 txcal_coeffs_2G[8]; - struct b43_phy_n_iq_comp rxcal_coeffs_2G; - - u16 txcal_radio_regs_5G[8]; - u16 txcal_coeffs_5G[8]; - struct b43_phy_n_iq_comp rxcal_coeffs_5G; -}; - -struct b43_phy_n_txpwrindex { - s8 index; - s8 index_internal; - s8 index_internal_save; - u16 AfectrlOverride; - u16 AfeCtrlDacGain; - u16 rad_gain; - u8 bbmult; - u16 iqcomp_a; - u16 iqcomp_b; - u16 locomp; -}; - -struct b43_phy_n_pwr_ctl_info { - u8 idle_tssi_2g; - u8 idle_tssi_5g; -}; - -struct b43_phy_n { - u8 antsel_type; - u8 cal_orig_pwr_idx[2]; - u8 measure_hold; - u8 phyrxchain; - u8 hw_phyrxchain; - u8 hw_phytxchain; - u8 perical; - u32 deaf_count; - u32 rxcalparams; - bool hang_avoid; - bool mute; - u16 papd_epsilon_offset[2]; - s32 preamble_override; - u32 bb_mult_save; - bool init_por; - - bool gain_boost; - bool elna_gain_config; - bool band5g_pwrgain; - - u8 mphase_cal_phase_id; - u16 mphase_txcal_cmdidx; - u16 mphase_txcal_numcmds; - u16 mphase_txcal_bestcoeffs[11]; - - bool txpwrctrl; - bool pwg_gain_5ghz; - u8 tx_pwr_idx[2]; - s8 tx_power_offset[101]; - u16 adj_pwr_tbl[84]; - u16 txcal_bbmult; - u16 txiqlocal_bestc[11]; - bool txiqlocal_coeffsvalid; - struct b43_phy_n_txpwrindex txpwrindex[2]; - struct b43_phy_n_pwr_ctl_info pwr_ctl_info[2]; - struct b43_chanspec txiqlocal_chanspec; - - u8 txrx_chain; - u16 tx_rx_cal_phy_saveregs[11]; - u16 tx_rx_cal_radio_saveregs[22]; - - u16 rfctrl_intc1_save; - u16 rfctrl_intc2_save; - - u16 classifier_state; - u16 clip_state[2]; - - enum b43_nphy_spur_avoid spur_avoid; - bool aband_spurwar_en; - bool gband_spurwar_en; - - bool ipa2g_on; - struct b43_chanspec iqcal_chanspec_2G; - struct b43_chanspec rssical_chanspec_2G; - - bool ipa5g_on; - struct b43_chanspec iqcal_chanspec_5G; - struct b43_chanspec rssical_chanspec_5G; - - struct b43_phy_n_rssical_cache rssical_cache; - struct b43_phy_n_cal_cache cal_cache; - bool crsminpwr_adjusted; - bool noisevars_adjusted; -}; - - -struct b43_phy_operations; -extern const struct b43_phy_operations b43_phyops_n; - -#endif /* B43_NPHY_H_ */ diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c deleted file mode 100644 index a73ff8c9deb5..000000000000 --- a/drivers/net/wireless/b43/pio.c +++ /dev/null @@ -1,834 +0,0 @@ -/* - - Broadcom B43 wireless driver - - PIO data transfer - - Copyright (c) 2005-2008 Michael Buesch - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "pio.h" -#include "dma.h" -#include "main.h" -#include "xmit.h" - -#include -#include -#include - - -static u16 generate_cookie(struct b43_pio_txqueue *q, - struct b43_pio_txpacket *pack) -{ - u16 cookie; - - /* Use the upper 4 bits of the cookie as - * PIO controller ID and store the packet index number - * in the lower 12 bits. - * Note that the cookie must never be 0, as this - * is a special value used in RX path. - * It can also not be 0xFFFF because that is special - * for multicast frames. - */ - cookie = (((u16)q->index + 1) << 12); - cookie |= pack->index; - - return cookie; -} - -static -struct b43_pio_txqueue *parse_cookie(struct b43_wldev *dev, - u16 cookie, - struct b43_pio_txpacket **pack) -{ - struct b43_pio *pio = &dev->pio; - struct b43_pio_txqueue *q = NULL; - unsigned int pack_index; - - switch (cookie & 0xF000) { - case 0x1000: - q = pio->tx_queue_AC_BK; - break; - case 0x2000: - q = pio->tx_queue_AC_BE; - break; - case 0x3000: - q = pio->tx_queue_AC_VI; - break; - case 0x4000: - q = pio->tx_queue_AC_VO; - break; - case 0x5000: - q = pio->tx_queue_mcast; - break; - } - if (B43_WARN_ON(!q)) - return NULL; - pack_index = (cookie & 0x0FFF); - if (B43_WARN_ON(pack_index >= ARRAY_SIZE(q->packets))) - return NULL; - *pack = &q->packets[pack_index]; - - return q; -} - -static u16 index_to_pioqueue_base(struct b43_wldev *dev, - unsigned int index) -{ - static const u16 bases[] = { - B43_MMIO_PIO_BASE0, - B43_MMIO_PIO_BASE1, - B43_MMIO_PIO_BASE2, - B43_MMIO_PIO_BASE3, - B43_MMIO_PIO_BASE4, - B43_MMIO_PIO_BASE5, - B43_MMIO_PIO_BASE6, - B43_MMIO_PIO_BASE7, - }; - static const u16 bases_rev11[] = { - B43_MMIO_PIO11_BASE0, - B43_MMIO_PIO11_BASE1, - B43_MMIO_PIO11_BASE2, - B43_MMIO_PIO11_BASE3, - B43_MMIO_PIO11_BASE4, - B43_MMIO_PIO11_BASE5, - }; - - if (dev->dev->core_rev >= 11) { - B43_WARN_ON(index >= ARRAY_SIZE(bases_rev11)); - return bases_rev11[index]; - } - B43_WARN_ON(index >= ARRAY_SIZE(bases)); - return bases[index]; -} - -static u16 pio_txqueue_offset(struct b43_wldev *dev) -{ - if (dev->dev->core_rev >= 11) - return 0x18; - return 0; -} - -static u16 pio_rxqueue_offset(struct b43_wldev *dev) -{ - if (dev->dev->core_rev >= 11) - return 0x38; - return 8; -} - -static struct b43_pio_txqueue *b43_setup_pioqueue_tx(struct b43_wldev *dev, - unsigned int index) -{ - struct b43_pio_txqueue *q; - struct b43_pio_txpacket *p; - unsigned int i; - - q = kzalloc(sizeof(*q), GFP_KERNEL); - if (!q) - return NULL; - q->dev = dev; - q->rev = dev->dev->core_rev; - q->mmio_base = index_to_pioqueue_base(dev, index) + - pio_txqueue_offset(dev); - q->index = index; - - q->free_packet_slots = B43_PIO_MAX_NR_TXPACKETS; - if (q->rev >= 8) { - q->buffer_size = 1920; //FIXME this constant is wrong. - } else { - q->buffer_size = b43_piotx_read16(q, B43_PIO_TXQBUFSIZE); - q->buffer_size -= 80; - } - - INIT_LIST_HEAD(&q->packets_list); - for (i = 0; i < ARRAY_SIZE(q->packets); i++) { - p = &(q->packets[i]); - INIT_LIST_HEAD(&p->list); - p->index = i; - p->queue = q; - list_add(&p->list, &q->packets_list); - } - - return q; -} - -static struct b43_pio_rxqueue *b43_setup_pioqueue_rx(struct b43_wldev *dev, - unsigned int index) -{ - struct b43_pio_rxqueue *q; - - q = kzalloc(sizeof(*q), GFP_KERNEL); - if (!q) - return NULL; - q->dev = dev; - q->rev = dev->dev->core_rev; - q->mmio_base = index_to_pioqueue_base(dev, index) + - pio_rxqueue_offset(dev); - - /* Enable Direct FIFO RX (PIO) on the engine. */ - b43_dma_direct_fifo_rx(dev, index, 1); - - return q; -} - -static void b43_pio_cancel_tx_packets(struct b43_pio_txqueue *q) -{ - struct b43_pio_txpacket *pack; - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(q->packets); i++) { - pack = &(q->packets[i]); - if (pack->skb) { - ieee80211_free_txskb(q->dev->wl->hw, pack->skb); - pack->skb = NULL; - } - } -} - -static void b43_destroy_pioqueue_tx(struct b43_pio_txqueue *q, - const char *name) -{ - if (!q) - return; - b43_pio_cancel_tx_packets(q); - kfree(q); -} - -static void b43_destroy_pioqueue_rx(struct b43_pio_rxqueue *q, - const char *name) -{ - if (!q) - return; - kfree(q); -} - -#define destroy_queue_tx(pio, queue) do { \ - b43_destroy_pioqueue_tx((pio)->queue, __stringify(queue)); \ - (pio)->queue = NULL; \ - } while (0) - -#define destroy_queue_rx(pio, queue) do { \ - b43_destroy_pioqueue_rx((pio)->queue, __stringify(queue)); \ - (pio)->queue = NULL; \ - } while (0) - -void b43_pio_free(struct b43_wldev *dev) -{ - struct b43_pio *pio; - - if (!b43_using_pio_transfers(dev)) - return; - pio = &dev->pio; - - destroy_queue_rx(pio, rx_queue); - destroy_queue_tx(pio, tx_queue_mcast); - destroy_queue_tx(pio, tx_queue_AC_VO); - destroy_queue_tx(pio, tx_queue_AC_VI); - destroy_queue_tx(pio, tx_queue_AC_BE); - destroy_queue_tx(pio, tx_queue_AC_BK); -} - -int b43_pio_init(struct b43_wldev *dev) -{ - struct b43_pio *pio = &dev->pio; - int err = -ENOMEM; - - b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) - & ~B43_MACCTL_BE); - b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_RXPADOFF, 0); - - pio->tx_queue_AC_BK = b43_setup_pioqueue_tx(dev, 0); - if (!pio->tx_queue_AC_BK) - goto out; - - pio->tx_queue_AC_BE = b43_setup_pioqueue_tx(dev, 1); - if (!pio->tx_queue_AC_BE) - goto err_destroy_bk; - - pio->tx_queue_AC_VI = b43_setup_pioqueue_tx(dev, 2); - if (!pio->tx_queue_AC_VI) - goto err_destroy_be; - - pio->tx_queue_AC_VO = b43_setup_pioqueue_tx(dev, 3); - if (!pio->tx_queue_AC_VO) - goto err_destroy_vi; - - pio->tx_queue_mcast = b43_setup_pioqueue_tx(dev, 4); - if (!pio->tx_queue_mcast) - goto err_destroy_vo; - - pio->rx_queue = b43_setup_pioqueue_rx(dev, 0); - if (!pio->rx_queue) - goto err_destroy_mcast; - - b43dbg(dev->wl, "PIO initialized\n"); - err = 0; -out: - return err; - -err_destroy_mcast: - destroy_queue_tx(pio, tx_queue_mcast); -err_destroy_vo: - destroy_queue_tx(pio, tx_queue_AC_VO); -err_destroy_vi: - destroy_queue_tx(pio, tx_queue_AC_VI); -err_destroy_be: - destroy_queue_tx(pio, tx_queue_AC_BE); -err_destroy_bk: - destroy_queue_tx(pio, tx_queue_AC_BK); - return err; -} - -/* Static mapping of mac80211's queues (priorities) to b43 PIO queues. */ -static struct b43_pio_txqueue *select_queue_by_priority(struct b43_wldev *dev, - u8 queue_prio) -{ - struct b43_pio_txqueue *q; - - if (dev->qos_enabled) { - /* 0 = highest priority */ - switch (queue_prio) { - default: - B43_WARN_ON(1); - /* fallthrough */ - case 0: - q = dev->pio.tx_queue_AC_VO; - break; - case 1: - q = dev->pio.tx_queue_AC_VI; - break; - case 2: - q = dev->pio.tx_queue_AC_BE; - break; - case 3: - q = dev->pio.tx_queue_AC_BK; - break; - } - } else - q = dev->pio.tx_queue_AC_BE; - - return q; -} - -static u16 tx_write_2byte_queue(struct b43_pio_txqueue *q, - u16 ctl, - const void *_data, - unsigned int data_len) -{ - struct b43_wldev *dev = q->dev; - struct b43_wl *wl = dev->wl; - const u8 *data = _data; - - ctl |= B43_PIO_TXCTL_WRITELO | B43_PIO_TXCTL_WRITEHI; - b43_piotx_write16(q, B43_PIO_TXCTL, ctl); - - b43_block_write(dev, data, (data_len & ~1), - q->mmio_base + B43_PIO_TXDATA, - sizeof(u16)); - if (data_len & 1) { - u8 *tail = wl->pio_tailspace; - BUILD_BUG_ON(sizeof(wl->pio_tailspace) < 2); - - /* Write the last byte. */ - ctl &= ~B43_PIO_TXCTL_WRITEHI; - b43_piotx_write16(q, B43_PIO_TXCTL, ctl); - tail[0] = data[data_len - 1]; - tail[1] = 0; - b43_block_write(dev, tail, 2, - q->mmio_base + B43_PIO_TXDATA, - sizeof(u16)); - } - - return ctl; -} - -static void pio_tx_frame_2byte_queue(struct b43_pio_txpacket *pack, - const u8 *hdr, unsigned int hdrlen) -{ - struct b43_pio_txqueue *q = pack->queue; - const char *frame = pack->skb->data; - unsigned int frame_len = pack->skb->len; - u16 ctl; - - ctl = b43_piotx_read16(q, B43_PIO_TXCTL); - ctl |= B43_PIO_TXCTL_FREADY; - ctl &= ~B43_PIO_TXCTL_EOF; - - /* Transfer the header data. */ - ctl = tx_write_2byte_queue(q, ctl, hdr, hdrlen); - /* Transfer the frame data. */ - ctl = tx_write_2byte_queue(q, ctl, frame, frame_len); - - ctl |= B43_PIO_TXCTL_EOF; - b43_piotx_write16(q, B43_PIO_TXCTL, ctl); -} - -static u32 tx_write_4byte_queue(struct b43_pio_txqueue *q, - u32 ctl, - const void *_data, - unsigned int data_len) -{ - struct b43_wldev *dev = q->dev; - struct b43_wl *wl = dev->wl; - const u8 *data = _data; - - ctl |= B43_PIO8_TXCTL_0_7 | B43_PIO8_TXCTL_8_15 | - B43_PIO8_TXCTL_16_23 | B43_PIO8_TXCTL_24_31; - b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); - - b43_block_write(dev, data, (data_len & ~3), - q->mmio_base + B43_PIO8_TXDATA, - sizeof(u32)); - if (data_len & 3) { - u8 *tail = wl->pio_tailspace; - BUILD_BUG_ON(sizeof(wl->pio_tailspace) < 4); - - memset(tail, 0, 4); - /* Write the last few bytes. */ - ctl &= ~(B43_PIO8_TXCTL_8_15 | B43_PIO8_TXCTL_16_23 | - B43_PIO8_TXCTL_24_31); - switch (data_len & 3) { - case 3: - ctl |= B43_PIO8_TXCTL_16_23 | B43_PIO8_TXCTL_8_15; - tail[0] = data[data_len - 3]; - tail[1] = data[data_len - 2]; - tail[2] = data[data_len - 1]; - break; - case 2: - ctl |= B43_PIO8_TXCTL_8_15; - tail[0] = data[data_len - 2]; - tail[1] = data[data_len - 1]; - break; - case 1: - tail[0] = data[data_len - 1]; - break; - } - b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); - b43_block_write(dev, tail, 4, - q->mmio_base + B43_PIO8_TXDATA, - sizeof(u32)); - } - - return ctl; -} - -static void pio_tx_frame_4byte_queue(struct b43_pio_txpacket *pack, - const u8 *hdr, unsigned int hdrlen) -{ - struct b43_pio_txqueue *q = pack->queue; - const char *frame = pack->skb->data; - unsigned int frame_len = pack->skb->len; - u32 ctl; - - ctl = b43_piotx_read32(q, B43_PIO8_TXCTL); - ctl |= B43_PIO8_TXCTL_FREADY; - ctl &= ~B43_PIO8_TXCTL_EOF; - - /* Transfer the header data. */ - ctl = tx_write_4byte_queue(q, ctl, hdr, hdrlen); - /* Transfer the frame data. */ - ctl = tx_write_4byte_queue(q, ctl, frame, frame_len); - - ctl |= B43_PIO8_TXCTL_EOF; - b43_piotx_write32(q, B43_PIO_TXCTL, ctl); -} - -static int pio_tx_frame(struct b43_pio_txqueue *q, - struct sk_buff *skb) -{ - struct b43_wldev *dev = q->dev; - struct b43_wl *wl = dev->wl; - struct b43_pio_txpacket *pack; - u16 cookie; - int err; - unsigned int hdrlen; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct b43_txhdr *txhdr = (struct b43_txhdr *)wl->pio_scratchspace; - - B43_WARN_ON(list_empty(&q->packets_list)); - pack = list_entry(q->packets_list.next, - struct b43_pio_txpacket, list); - - cookie = generate_cookie(q, pack); - hdrlen = b43_txhdr_size(dev); - BUILD_BUG_ON(sizeof(wl->pio_scratchspace) < sizeof(struct b43_txhdr)); - B43_WARN_ON(sizeof(wl->pio_scratchspace) < hdrlen); - err = b43_generate_txhdr(dev, (u8 *)txhdr, skb, - info, cookie); - if (err) - return err; - - if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { - /* Tell the firmware about the cookie of the last - * mcast frame, so it can clear the more-data bit in it. */ - b43_shm_write16(dev, B43_SHM_SHARED, - B43_SHM_SH_MCASTCOOKIE, cookie); - } - - pack->skb = skb; - if (q->rev >= 8) - pio_tx_frame_4byte_queue(pack, (const u8 *)txhdr, hdrlen); - else - pio_tx_frame_2byte_queue(pack, (const u8 *)txhdr, hdrlen); - - /* Remove it from the list of available packet slots. - * It will be put back when we receive the status report. */ - list_del(&pack->list); - - /* Update the queue statistics. */ - q->buffer_used += roundup(skb->len + hdrlen, 4); - q->free_packet_slots -= 1; - - return 0; -} - -int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb) -{ - struct b43_pio_txqueue *q; - struct ieee80211_hdr *hdr; - unsigned int hdrlen, total_len; - int err = 0; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - hdr = (struct ieee80211_hdr *)skb->data; - - if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { - /* The multicast queue will be sent after the DTIM. */ - q = dev->pio.tx_queue_mcast; - /* Set the frame More-Data bit. Ucode will clear it - * for us on the last frame. */ - hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA); - } else { - /* Decide by priority where to put this frame. */ - q = select_queue_by_priority(dev, skb_get_queue_mapping(skb)); - } - - hdrlen = b43_txhdr_size(dev); - total_len = roundup(skb->len + hdrlen, 4); - - if (unlikely(total_len > q->buffer_size)) { - err = -ENOBUFS; - b43dbg(dev->wl, "PIO: TX packet longer than queue.\n"); - goto out; - } - if (unlikely(q->free_packet_slots == 0)) { - err = -ENOBUFS; - b43warn(dev->wl, "PIO: TX packet overflow.\n"); - goto out; - } - B43_WARN_ON(q->buffer_used > q->buffer_size); - - if (total_len > (q->buffer_size - q->buffer_used)) { - /* Not enough memory on the queue. */ - err = -EBUSY; - ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb)); - q->stopped = true; - goto out; - } - - /* Assign the queue number to the ring (if not already done before) - * so TX status handling can use it. The mac80211-queue to b43-queue - * mapping is static, so we don't need to store it per frame. */ - q->queue_prio = skb_get_queue_mapping(skb); - - err = pio_tx_frame(q, skb); - if (unlikely(err == -ENOKEY)) { - /* Drop this packet, as we don't have the encryption key - * anymore and must not transmit it unencrypted. */ - ieee80211_free_txskb(dev->wl->hw, skb); - err = 0; - goto out; - } - if (unlikely(err)) { - b43err(dev->wl, "PIO transmission failure\n"); - goto out; - } - - B43_WARN_ON(q->buffer_used > q->buffer_size); - if (((q->buffer_size - q->buffer_used) < roundup(2 + 2 + 6, 4)) || - (q->free_packet_slots == 0)) { - /* The queue is full. */ - ieee80211_stop_queue(dev->wl->hw, skb_get_queue_mapping(skb)); - q->stopped = true; - } - -out: - return err; -} - -void b43_pio_handle_txstatus(struct b43_wldev *dev, - const struct b43_txstatus *status) -{ - struct b43_pio_txqueue *q; - struct b43_pio_txpacket *pack = NULL; - unsigned int total_len; - struct ieee80211_tx_info *info; - - q = parse_cookie(dev, status->cookie, &pack); - if (unlikely(!q)) - return; - B43_WARN_ON(!pack); - - info = IEEE80211_SKB_CB(pack->skb); - - b43_fill_txstatus_report(dev, info, status); - - total_len = pack->skb->len + b43_txhdr_size(dev); - total_len = roundup(total_len, 4); - q->buffer_used -= total_len; - q->free_packet_slots += 1; - - ieee80211_tx_status(dev->wl->hw, pack->skb); - pack->skb = NULL; - list_add(&pack->list, &q->packets_list); - - if (q->stopped) { - ieee80211_wake_queue(dev->wl->hw, q->queue_prio); - q->stopped = false; - } -} - -/* Returns whether we should fetch another frame. */ -static bool pio_rx_frame(struct b43_pio_rxqueue *q) -{ - struct b43_wldev *dev = q->dev; - struct b43_wl *wl = dev->wl; - u16 len; - u32 macstat = 0; - unsigned int i, padding; - struct sk_buff *skb; - const char *err_msg = NULL; - struct b43_rxhdr_fw4 *rxhdr = - (struct b43_rxhdr_fw4 *)wl->pio_scratchspace; - size_t rxhdr_size = sizeof(*rxhdr); - - BUILD_BUG_ON(sizeof(wl->pio_scratchspace) < sizeof(*rxhdr)); - switch (dev->fw.hdr_format) { - case B43_FW_HDR_410: - case B43_FW_HDR_351: - rxhdr_size -= sizeof(rxhdr->format_598) - - sizeof(rxhdr->format_351); - break; - case B43_FW_HDR_598: - break; - } - memset(rxhdr, 0, rxhdr_size); - - /* Check if we have data and wait for it to get ready. */ - if (q->rev >= 8) { - u32 ctl; - - ctl = b43_piorx_read32(q, B43_PIO8_RXCTL); - if (!(ctl & B43_PIO8_RXCTL_FRAMERDY)) - return 0; - b43_piorx_write32(q, B43_PIO8_RXCTL, - B43_PIO8_RXCTL_FRAMERDY); - for (i = 0; i < 10; i++) { - ctl = b43_piorx_read32(q, B43_PIO8_RXCTL); - if (ctl & B43_PIO8_RXCTL_DATARDY) - goto data_ready; - udelay(10); - } - } else { - u16 ctl; - - ctl = b43_piorx_read16(q, B43_PIO_RXCTL); - if (!(ctl & B43_PIO_RXCTL_FRAMERDY)) - return 0; - b43_piorx_write16(q, B43_PIO_RXCTL, - B43_PIO_RXCTL_FRAMERDY); - for (i = 0; i < 10; i++) { - ctl = b43_piorx_read16(q, B43_PIO_RXCTL); - if (ctl & B43_PIO_RXCTL_DATARDY) - goto data_ready; - udelay(10); - } - } - b43dbg(q->dev->wl, "PIO RX timed out\n"); - return 1; -data_ready: - - /* Get the preamble (RX header) */ - if (q->rev >= 8) { - b43_block_read(dev, rxhdr, rxhdr_size, - q->mmio_base + B43_PIO8_RXDATA, - sizeof(u32)); - } else { - b43_block_read(dev, rxhdr, rxhdr_size, - q->mmio_base + B43_PIO_RXDATA, - sizeof(u16)); - } - /* Sanity checks. */ - len = le16_to_cpu(rxhdr->frame_len); - if (unlikely(len > 0x700)) { - err_msg = "len > 0x700"; - goto rx_error; - } - if (unlikely(len == 0)) { - err_msg = "len == 0"; - goto rx_error; - } - - switch (dev->fw.hdr_format) { - case B43_FW_HDR_598: - macstat = le32_to_cpu(rxhdr->format_598.mac_status); - break; - case B43_FW_HDR_410: - case B43_FW_HDR_351: - macstat = le32_to_cpu(rxhdr->format_351.mac_status); - break; - } - if (macstat & B43_RX_MAC_FCSERR) { - if (!(q->dev->wl->filter_flags & FIF_FCSFAIL)) { - /* Drop frames with failed FCS. */ - err_msg = "Frame FCS error"; - goto rx_error; - } - } - - /* We always pad 2 bytes, as that's what upstream code expects - * due to the RX-header being 30 bytes. In case the frame is - * unaligned, we pad another 2 bytes. */ - padding = (macstat & B43_RX_MAC_PADDING) ? 2 : 0; - skb = dev_alloc_skb(len + padding + 2); - if (unlikely(!skb)) { - err_msg = "Out of memory"; - goto rx_error; - } - skb_reserve(skb, 2); - skb_put(skb, len + padding); - if (q->rev >= 8) { - b43_block_read(dev, skb->data + padding, (len & ~3), - q->mmio_base + B43_PIO8_RXDATA, - sizeof(u32)); - if (len & 3) { - u8 *tail = wl->pio_tailspace; - BUILD_BUG_ON(sizeof(wl->pio_tailspace) < 4); - - /* Read the last few bytes. */ - b43_block_read(dev, tail, 4, - q->mmio_base + B43_PIO8_RXDATA, - sizeof(u32)); - switch (len & 3) { - case 3: - skb->data[len + padding - 3] = tail[0]; - skb->data[len + padding - 2] = tail[1]; - skb->data[len + padding - 1] = tail[2]; - break; - case 2: - skb->data[len + padding - 2] = tail[0]; - skb->data[len + padding - 1] = tail[1]; - break; - case 1: - skb->data[len + padding - 1] = tail[0]; - break; - } - } - } else { - b43_block_read(dev, skb->data + padding, (len & ~1), - q->mmio_base + B43_PIO_RXDATA, - sizeof(u16)); - if (len & 1) { - u8 *tail = wl->pio_tailspace; - BUILD_BUG_ON(sizeof(wl->pio_tailspace) < 2); - - /* Read the last byte. */ - b43_block_read(dev, tail, 2, - q->mmio_base + B43_PIO_RXDATA, - sizeof(u16)); - skb->data[len + padding - 1] = tail[0]; - } - } - - b43_rx(q->dev, skb, rxhdr); - - return 1; - -rx_error: - if (err_msg) - b43dbg(q->dev->wl, "PIO RX error: %s\n", err_msg); - if (q->rev >= 8) - b43_piorx_write32(q, B43_PIO8_RXCTL, B43_PIO8_RXCTL_DATARDY); - else - b43_piorx_write16(q, B43_PIO_RXCTL, B43_PIO_RXCTL_DATARDY); - - return 1; -} - -void b43_pio_rx(struct b43_pio_rxqueue *q) -{ - unsigned int count = 0; - bool stop; - - while (1) { - stop = (pio_rx_frame(q) == 0); - if (stop) - break; - cond_resched(); - if (WARN_ON_ONCE(++count > 10000)) - break; - } -} - -static void b43_pio_tx_suspend_queue(struct b43_pio_txqueue *q) -{ - if (q->rev >= 8) { - b43_piotx_write32(q, B43_PIO8_TXCTL, - b43_piotx_read32(q, B43_PIO8_TXCTL) - | B43_PIO8_TXCTL_SUSPREQ); - } else { - b43_piotx_write16(q, B43_PIO_TXCTL, - b43_piotx_read16(q, B43_PIO_TXCTL) - | B43_PIO_TXCTL_SUSPREQ); - } -} - -static void b43_pio_tx_resume_queue(struct b43_pio_txqueue *q) -{ - if (q->rev >= 8) { - b43_piotx_write32(q, B43_PIO8_TXCTL, - b43_piotx_read32(q, B43_PIO8_TXCTL) - & ~B43_PIO8_TXCTL_SUSPREQ); - } else { - b43_piotx_write16(q, B43_PIO_TXCTL, - b43_piotx_read16(q, B43_PIO_TXCTL) - & ~B43_PIO_TXCTL_SUSPREQ); - } -} - -void b43_pio_tx_suspend(struct b43_wldev *dev) -{ - b43_power_saving_ctl_bits(dev, B43_PS_AWAKE); - b43_pio_tx_suspend_queue(dev->pio.tx_queue_AC_BK); - b43_pio_tx_suspend_queue(dev->pio.tx_queue_AC_BE); - b43_pio_tx_suspend_queue(dev->pio.tx_queue_AC_VI); - b43_pio_tx_suspend_queue(dev->pio.tx_queue_AC_VO); - b43_pio_tx_suspend_queue(dev->pio.tx_queue_mcast); -} - -void b43_pio_tx_resume(struct b43_wldev *dev) -{ - b43_pio_tx_resume_queue(dev->pio.tx_queue_mcast); - b43_pio_tx_resume_queue(dev->pio.tx_queue_AC_VO); - b43_pio_tx_resume_queue(dev->pio.tx_queue_AC_VI); - b43_pio_tx_resume_queue(dev->pio.tx_queue_AC_BE); - b43_pio_tx_resume_queue(dev->pio.tx_queue_AC_BK); - b43_power_saving_ctl_bits(dev, 0); -} diff --git a/drivers/net/wireless/b43/pio.h b/drivers/net/wireless/b43/pio.h deleted file mode 100644 index 1e516147424f..000000000000 --- a/drivers/net/wireless/b43/pio.h +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef B43_PIO_H_ -#define B43_PIO_H_ - -#include "b43.h" - -#include -#include -#include -#include - - -/*** Registers for PIO queues up to revision 7. ***/ -/* TX queue. */ -#define B43_PIO_TXCTL 0x00 -#define B43_PIO_TXCTL_WRITELO 0x0001 -#define B43_PIO_TXCTL_WRITEHI 0x0002 -#define B43_PIO_TXCTL_EOF 0x0004 -#define B43_PIO_TXCTL_FREADY 0x0008 -#define B43_PIO_TXCTL_FLUSHREQ 0x0020 -#define B43_PIO_TXCTL_FLUSHPEND 0x0040 -#define B43_PIO_TXCTL_SUSPREQ 0x0080 -#define B43_PIO_TXCTL_QSUSP 0x0100 -#define B43_PIO_TXCTL_COMMCNT 0xFC00 -#define B43_PIO_TXCTL_COMMCNT_SHIFT 10 -#define B43_PIO_TXDATA 0x02 -#define B43_PIO_TXQBUFSIZE 0x04 -/* RX queue. */ -#define B43_PIO_RXCTL 0x00 -#define B43_PIO_RXCTL_FRAMERDY 0x0001 -#define B43_PIO_RXCTL_DATARDY 0x0002 -#define B43_PIO_RXDATA 0x02 - -/*** Registers for PIO queues revision 8 and later. ***/ -/* TX queue */ -#define B43_PIO8_TXCTL 0x00 -#define B43_PIO8_TXCTL_0_7 0x00000001 -#define B43_PIO8_TXCTL_8_15 0x00000002 -#define B43_PIO8_TXCTL_16_23 0x00000004 -#define B43_PIO8_TXCTL_24_31 0x00000008 -#define B43_PIO8_TXCTL_EOF 0x00000010 -#define B43_PIO8_TXCTL_FREADY 0x00000080 -#define B43_PIO8_TXCTL_SUSPREQ 0x00000100 -#define B43_PIO8_TXCTL_QSUSP 0x00000200 -#define B43_PIO8_TXCTL_FLUSHREQ 0x00000400 -#define B43_PIO8_TXCTL_FLUSHPEND 0x00000800 -#define B43_PIO8_TXDATA 0x04 -/* RX queue */ -#define B43_PIO8_RXCTL 0x00 -#define B43_PIO8_RXCTL_FRAMERDY 0x00000001 -#define B43_PIO8_RXCTL_DATARDY 0x00000002 -#define B43_PIO8_RXDATA 0x04 - - -/* The maximum number of TX-packets the HW can handle. */ -#define B43_PIO_MAX_NR_TXPACKETS 32 - - -struct b43_pio_txpacket { - /* Pointer to the TX queue we belong to. */ - struct b43_pio_txqueue *queue; - /* The TX data packet. */ - struct sk_buff *skb; - /* Index in the (struct b43_pio_txqueue)->packets array. */ - u8 index; - - struct list_head list; -}; - -struct b43_pio_txqueue { - struct b43_wldev *dev; - u16 mmio_base; - - /* The device queue buffer size in bytes. */ - u16 buffer_size; - /* The number of used bytes in the device queue buffer. */ - u16 buffer_used; - /* The number of packets that can still get queued. - * This is decremented on queueing a packet and incremented - * after receiving the transmit status. */ - u16 free_packet_slots; - - /* True, if the mac80211 queue was stopped due to overflow at TX. */ - bool stopped; - /* Our b43 queue index number */ - u8 index; - /* The mac80211 QoS queue priority. */ - u8 queue_prio; - - /* Buffer for TX packet meta data. */ - struct b43_pio_txpacket packets[B43_PIO_MAX_NR_TXPACKETS]; - struct list_head packets_list; - - /* Shortcut to the 802.11 core revision. This is to - * avoid horrible pointer dereferencing in the fastpaths. */ - u8 rev; -}; - -struct b43_pio_rxqueue { - struct b43_wldev *dev; - u16 mmio_base; - - /* Shortcut to the 802.11 core revision. This is to - * avoid horrible pointer dereferencing in the fastpaths. */ - u8 rev; -}; - - -static inline u16 b43_piotx_read16(struct b43_pio_txqueue *q, u16 offset) -{ - return b43_read16(q->dev, q->mmio_base + offset); -} - -static inline u32 b43_piotx_read32(struct b43_pio_txqueue *q, u16 offset) -{ - return b43_read32(q->dev, q->mmio_base + offset); -} - -static inline void b43_piotx_write16(struct b43_pio_txqueue *q, - u16 offset, u16 value) -{ - b43_write16(q->dev, q->mmio_base + offset, value); -} - -static inline void b43_piotx_write32(struct b43_pio_txqueue *q, - u16 offset, u32 value) -{ - b43_write32(q->dev, q->mmio_base + offset, value); -} - - -static inline u16 b43_piorx_read16(struct b43_pio_rxqueue *q, u16 offset) -{ - return b43_read16(q->dev, q->mmio_base + offset); -} - -static inline u32 b43_piorx_read32(struct b43_pio_rxqueue *q, u16 offset) -{ - return b43_read32(q->dev, q->mmio_base + offset); -} - -static inline void b43_piorx_write16(struct b43_pio_rxqueue *q, - u16 offset, u16 value) -{ - b43_write16(q->dev, q->mmio_base + offset, value); -} - -static inline void b43_piorx_write32(struct b43_pio_rxqueue *q, - u16 offset, u32 value) -{ - b43_write32(q->dev, q->mmio_base + offset, value); -} - - -int b43_pio_init(struct b43_wldev *dev); -void b43_pio_free(struct b43_wldev *dev); - -int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb); -void b43_pio_handle_txstatus(struct b43_wldev *dev, - const struct b43_txstatus *status); -void b43_pio_rx(struct b43_pio_rxqueue *q); - -void b43_pio_tx_suspend(struct b43_wldev *dev); -void b43_pio_tx_resume(struct b43_wldev *dev); - -#endif /* B43_PIO_H_ */ diff --git a/drivers/net/wireless/b43/radio_2055.c b/drivers/net/wireless/b43/radio_2055.c deleted file mode 100644 index 5289a18ddd8c..000000000000 --- a/drivers/net/wireless/b43/radio_2055.c +++ /dev/null @@ -1,1335 +0,0 @@ -/* - - Broadcom B43 wireless driver - IEEE 802.11n PHY and radio device data tables - - Copyright (c) 2008 Michael Buesch - Copyright (c) 2010 Rafał Miłecki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "radio_2055.h" -#include "phy_common.h" - -struct b2055_inittab_entry { - /* Value to write if we use the 5GHz band. */ - u16 ghz5; - /* Value to write if we use the 2.4GHz band. */ - u16 ghz2; - /* Flags */ - u8 flags; -#define B2055_INITTAB_ENTRY_OK 0x01 -#define B2055_INITTAB_UPLOAD 0x02 -}; -#define UPLOAD .flags = B2055_INITTAB_ENTRY_OK | B2055_INITTAB_UPLOAD -#define NOUPLOAD .flags = B2055_INITTAB_ENTRY_OK - -static const struct b2055_inittab_entry b2055_inittab [] = { - [B2055_SP_PINPD] = { .ghz5 = 0x0080, .ghz2 = 0x0080, NOUPLOAD, }, - [B2055_C1_SP_RSSI] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C1_SP_PDMISC] = { .ghz5 = 0x0027, .ghz2 = 0x0027, NOUPLOAD, }, - [B2055_C2_SP_RSSI] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C2_SP_PDMISC] = { .ghz5 = 0x0027, .ghz2 = 0x0027, NOUPLOAD, }, - [B2055_C1_SP_RXGC1] = { .ghz5 = 0x007F, .ghz2 = 0x007F, UPLOAD, }, - [B2055_C1_SP_RXGC2] = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, }, - [B2055_C2_SP_RXGC1] = { .ghz5 = 0x007F, .ghz2 = 0x007F, UPLOAD, }, - [B2055_C2_SP_RXGC2] = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, }, - [B2055_C1_SP_LPFBWSEL] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2055_C2_SP_LPFBWSEL] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2055_C1_SP_TXGC1] = { .ghz5 = 0x004F, .ghz2 = 0x004F, UPLOAD, }, - [B2055_C1_SP_TXGC2] = { .ghz5 = 0x0005, .ghz2 = 0x0005, UPLOAD, }, - [B2055_C2_SP_TXGC1] = { .ghz5 = 0x004F, .ghz2 = 0x004F, UPLOAD, }, - [B2055_C2_SP_TXGC2] = { .ghz5 = 0x0005, .ghz2 = 0x0005, UPLOAD, }, - [B2055_MASTER1] = { .ghz5 = 0x00D0, .ghz2 = 0x00D0, NOUPLOAD, }, - [B2055_MASTER2] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2055_PD_LGEN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_PD_PLLTS] = { .ghz5 = 0x0040, .ghz2 = 0x0040, NOUPLOAD, }, - [B2055_C1_PD_LGBUF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C1_PD_TX] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C1_PD_RXTX] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C1_PD_RSSIMISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C2_PD_LGBUF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C2_PD_TX] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C2_PD_RXTX] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C2_PD_RSSIMISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_PWRDET_LGEN] = { .ghz5 = 0x00C0, .ghz2 = 0x00C0, NOUPLOAD, }, - [B2055_C1_PWRDET_LGBUF] = { .ghz5 = 0x00FF, .ghz2 = 0x00FF, NOUPLOAD, }, - [B2055_C1_PWRDET_RXTX] = { .ghz5 = 0x00C0, .ghz2 = 0x00C0, NOUPLOAD, }, - [B2055_C2_PWRDET_LGBUF] = { .ghz5 = 0x00FF, .ghz2 = 0x00FF, NOUPLOAD, }, - [B2055_C2_PWRDET_RXTX] = { .ghz5 = 0x00C0, .ghz2 = 0x00C0, NOUPLOAD, }, - [B2055_RRCCAL_CS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_RRCCAL_NOPTSEL] = { .ghz5 = 0x002C, .ghz2 = 0x002C, NOUPLOAD, }, - [B2055_CAL_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_CAL_COUT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_CAL_COUT2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_CAL_CVARCTL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_CAL_RVARCTL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_CAL_LPOCTL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_CAL_TS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_CAL_RCCALRTS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_CAL_RCALRTS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_PADDRV] = { .ghz5 = 0x00A4, .ghz2 = 0x00A4, NOUPLOAD, }, - [B2055_XOCTL1] = { .ghz5 = 0x0038, .ghz2 = 0x0038, NOUPLOAD, }, - [B2055_XOCTL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_XOREGUL] = { .ghz5 = 0x0004, .ghz2 = 0x0004, UPLOAD, }, - [B2055_XOMISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_PLL_LFC1] = { .ghz5 = 0x000A, .ghz2 = 0x000A, NOUPLOAD, }, - [B2055_PLL_CALVTH] = { .ghz5 = 0x0087, .ghz2 = 0x0087, NOUPLOAD, }, - [B2055_PLL_LFC2] = { .ghz5 = 0x0009, .ghz2 = 0x0009, NOUPLOAD, }, - [B2055_PLL_REF] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2055_PLL_LFR1] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2055_PLL_PFDCP] = { .ghz5 = 0x0018, .ghz2 = 0x0018, UPLOAD, }, - [B2055_PLL_IDAC_CPOPAMP] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2055_PLL_CPREG] = { .ghz5 = 0x0004, .ghz2 = 0x0004, UPLOAD, }, - [B2055_PLL_RCAL] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2055_RF_PLLMOD0] = { .ghz5 = 0x009E, .ghz2 = 0x009E, NOUPLOAD, }, - [B2055_RF_PLLMOD1] = { .ghz5 = 0x0009, .ghz2 = 0x0009, NOUPLOAD, }, - [B2055_RF_MMDIDAC1] = { .ghz5 = 0x00C8, .ghz2 = 0x00C8, UPLOAD, }, - [B2055_RF_MMDIDAC0] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2055_RF_MMDSP] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_VCO_CAL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_VCO_CAL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_VCO_CAL3] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2055_VCO_CAL4] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2055_VCO_CAL5] = { .ghz5 = 0x0096, .ghz2 = 0x0096, NOUPLOAD, }, - [B2055_VCO_CAL6] = { .ghz5 = 0x003E, .ghz2 = 0x003E, NOUPLOAD, }, - [B2055_VCO_CAL7] = { .ghz5 = 0x003E, .ghz2 = 0x003E, NOUPLOAD, }, - [B2055_VCO_CAL8] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2055_VCO_CAL9] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2055_VCO_CAL10] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2055_VCO_CAL11] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2055_VCO_CAL12] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_VCO_CAL13] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_VCO_CAL14] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_VCO_CAL15] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_VCO_CAL16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_VCO_KVCO] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2055_VCO_CAPTAIL] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2055_VCO_IDACVCO] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2055_VCO_REG] = { .ghz5 = 0x0084, .ghz2 = 0x0084, UPLOAD, }, - [B2055_PLL_RFVTH] = { .ghz5 = 0x00C3, .ghz2 = 0x00C3, NOUPLOAD, }, - [B2055_LGBUF_CENBUF] = { .ghz5 = 0x008F, .ghz2 = 0x008F, NOUPLOAD, }, - [B2055_LGEN_TUNE1] = { .ghz5 = 0x00FF, .ghz2 = 0x00FF, NOUPLOAD, }, - [B2055_LGEN_TUNE2] = { .ghz5 = 0x00FF, .ghz2 = 0x00FF, NOUPLOAD, }, - [B2055_LGEN_IDAC1] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2055_LGEN_IDAC2] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2055_LGEN_BIASC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_LGEN_BIASIDAC] = { .ghz5 = 0x00CC, .ghz2 = 0x00CC, NOUPLOAD, }, - [B2055_LGEN_RCAL] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2055_LGEN_DIV] = { .ghz5 = 0x0080, .ghz2 = 0x0080, NOUPLOAD, }, - [B2055_LGEN_SPARE2] = { .ghz5 = 0x0080, .ghz2 = 0x0080, NOUPLOAD, }, - [B2055_C1_LGBUF_ATUNE] = { .ghz5 = 0x00F8, .ghz2 = 0x00F8, NOUPLOAD, }, - [B2055_C1_LGBUF_GTUNE] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2055_C1_LGBUF_DIV] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2055_C1_LGBUF_AIDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0008, UPLOAD, }, - [B2055_C1_LGBUF_GIDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2055_C1_LGBUF_IDACFO] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C1_LGBUF_SPARE] = { .ghz5 = 0x0001, .ghz2 = 0x0001, UPLOAD, }, - [B2055_C1_RX_RFSPC1] = { .ghz5 = 0x008A, .ghz2 = 0x008A, NOUPLOAD, }, - [B2055_C1_RX_RFR1] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2055_C1_RX_RFR2] = { .ghz5 = 0x0083, .ghz2 = 0x0083, NOUPLOAD, }, - [B2055_C1_RX_RFRCAL] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2055_C1_RX_BB_BLCMP] = { .ghz5 = 0x00A0, .ghz2 = 0x00A0, NOUPLOAD, }, - [B2055_C1_RX_BB_LPF] = { .ghz5 = 0x000A, .ghz2 = 0x000A, NOUPLOAD, }, - [B2055_C1_RX_BB_MIDACHP] = { .ghz5 = 0x0087, .ghz2 = 0x0087, UPLOAD, }, - [B2055_C1_RX_BB_VGA1IDAC] = { .ghz5 = 0x002A, .ghz2 = 0x002A, NOUPLOAD, }, - [B2055_C1_RX_BB_VGA2IDAC] = { .ghz5 = 0x002A, .ghz2 = 0x002A, NOUPLOAD, }, - [B2055_C1_RX_BB_VGA3IDAC] = { .ghz5 = 0x002A, .ghz2 = 0x002A, NOUPLOAD, }, - [B2055_C1_RX_BB_BUFOCTL] = { .ghz5 = 0x002A, .ghz2 = 0x002A, NOUPLOAD, }, - [B2055_C1_RX_BB_RCCALCTL] = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, }, - [B2055_C1_RX_BB_RSSICTL1] = { .ghz5 = 0x006A, .ghz2 = 0x006A, UPLOAD, }, - [B2055_C1_RX_BB_RSSICTL2] = { .ghz5 = 0x00AB, .ghz2 = 0x00AB, UPLOAD, }, - [B2055_C1_RX_BB_RSSICTL3] = { .ghz5 = 0x0013, .ghz2 = 0x0013, UPLOAD, }, - [B2055_C1_RX_BB_RSSICTL4] = { .ghz5 = 0x00C1, .ghz2 = 0x00C1, UPLOAD, }, - [B2055_C1_RX_BB_RSSICTL5] = { .ghz5 = 0x00AA, .ghz2 = 0x00AA, UPLOAD, }, - [B2055_C1_RX_BB_REG] = { .ghz5 = 0x0087, .ghz2 = 0x0087, UPLOAD, }, - [B2055_C1_RX_BB_SPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C1_RX_TXBBRCAL] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2055_C1_TX_RF_SPGA] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2055_C1_TX_RF_SPAD] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2055_C1_TX_RF_CNTPGA1] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2055_C1_TX_RF_CNTPAD1] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2055_C1_TX_RF_PGAIDAC] = { .ghz5 = 0x0097, .ghz2 = 0x0097, UPLOAD, }, - [B2055_C1_TX_PGAPADTN] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2055_C1_TX_PADIDAC1] = { .ghz5 = 0x0014, .ghz2 = 0x0014, UPLOAD, }, - [B2055_C1_TX_PADIDAC2] = { .ghz5 = 0x0033, .ghz2 = 0x0033, NOUPLOAD, }, - [B2055_C1_TX_MXBGTRIM] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2055_C1_TX_RF_RCAL] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2055_C1_TX_RF_PADTSSI1] = { .ghz5 = 0x0003, .ghz2 = 0x0003, UPLOAD, }, - [B2055_C1_TX_RF_PADTSSI2] = { .ghz5 = 0x000A, .ghz2 = 0x000A, NOUPLOAD, }, - [B2055_C1_TX_RF_SPARE] = { .ghz5 = 0x0003, .ghz2 = 0x0003, UPLOAD, }, - [B2055_C1_TX_RF_IQCAL1] = { .ghz5 = 0x002A, .ghz2 = 0x002A, NOUPLOAD, }, - [B2055_C1_TX_RF_IQCAL2] = { .ghz5 = 0x00A4, .ghz2 = 0x00A4, NOUPLOAD, }, - [B2055_C1_TXBB_RCCAL] = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, }, - [B2055_C1_TXBB_LPF1] = { .ghz5 = 0x0028, .ghz2 = 0x0028, NOUPLOAD, }, - [B2055_C1_TX_VOSCNCL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C1_TX_LPF_MXGMIDAC] = { .ghz5 = 0x004A, .ghz2 = 0x004A, NOUPLOAD, }, - [B2055_C1_TX_BB_MXGM] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C2_LGBUF_ATUNE] = { .ghz5 = 0x00F8, .ghz2 = 0x00F8, NOUPLOAD, }, - [B2055_C2_LGBUF_GTUNE] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2055_C2_LGBUF_DIV] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2055_C2_LGBUF_AIDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0008, UPLOAD, }, - [B2055_C2_LGBUF_GIDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2055_C2_LGBUF_IDACFO] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C2_LGBUF_SPARE] = { .ghz5 = 0x0001, .ghz2 = 0x0001, UPLOAD, }, - [B2055_C2_RX_RFSPC1] = { .ghz5 = 0x008A, .ghz2 = 0x008A, NOUPLOAD, }, - [B2055_C2_RX_RFR1] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2055_C2_RX_RFR2] = { .ghz5 = 0x0083, .ghz2 = 0x0083, NOUPLOAD, }, - [B2055_C2_RX_RFRCAL] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2055_C2_RX_BB_BLCMP] = { .ghz5 = 0x00A0, .ghz2 = 0x00A0, NOUPLOAD, }, - [B2055_C2_RX_BB_LPF] = { .ghz5 = 0x000A, .ghz2 = 0x000A, NOUPLOAD, }, - [B2055_C2_RX_BB_MIDACHP] = { .ghz5 = 0x0087, .ghz2 = 0x0087, UPLOAD, }, - [B2055_C2_RX_BB_VGA1IDAC] = { .ghz5 = 0x002A, .ghz2 = 0x002A, NOUPLOAD, }, - [B2055_C2_RX_BB_VGA2IDAC] = { .ghz5 = 0x002A, .ghz2 = 0x002A, NOUPLOAD, }, - [B2055_C2_RX_BB_VGA3IDAC] = { .ghz5 = 0x002A, .ghz2 = 0x002A, NOUPLOAD, }, - [B2055_C2_RX_BB_BUFOCTL] = { .ghz5 = 0x002A, .ghz2 = 0x002A, NOUPLOAD, }, - [B2055_C2_RX_BB_RCCALCTL] = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, }, - [B2055_C2_RX_BB_RSSICTL1] = { .ghz5 = 0x006A, .ghz2 = 0x006A, UPLOAD, }, - [B2055_C2_RX_BB_RSSICTL2] = { .ghz5 = 0x00AB, .ghz2 = 0x00AB, UPLOAD, }, - [B2055_C2_RX_BB_RSSICTL3] = { .ghz5 = 0x0013, .ghz2 = 0x0013, UPLOAD, }, - [B2055_C2_RX_BB_RSSICTL4] = { .ghz5 = 0x00C1, .ghz2 = 0x00C1, UPLOAD, }, - [B2055_C2_RX_BB_RSSICTL5] = { .ghz5 = 0x00AA, .ghz2 = 0x00AA, UPLOAD, }, - [B2055_C2_RX_BB_REG] = { .ghz5 = 0x0087, .ghz2 = 0x0087, UPLOAD, }, - [B2055_C2_RX_BB_SPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C2_RX_TXBBRCAL] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2055_C2_TX_RF_SPGA] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2055_C2_TX_RF_SPAD] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2055_C2_TX_RF_CNTPGA1] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2055_C2_TX_RF_CNTPAD1] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2055_C2_TX_RF_PGAIDAC] = { .ghz5 = 0x0097, .ghz2 = 0x0097, UPLOAD, }, - [B2055_C2_TX_PGAPADTN] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2055_C2_TX_PADIDAC1] = { .ghz5 = 0x0014, .ghz2 = 0x0014, UPLOAD, }, - [B2055_C2_TX_PADIDAC2] = { .ghz5 = 0x0033, .ghz2 = 0x0033, NOUPLOAD, }, - [B2055_C2_TX_MXBGTRIM] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2055_C2_TX_RF_RCAL] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2055_C2_TX_RF_PADTSSI1] = { .ghz5 = 0x0003, .ghz2 = 0x0003, UPLOAD, }, - [B2055_C2_TX_RF_PADTSSI2] = { .ghz5 = 0x000A, .ghz2 = 0x000A, NOUPLOAD, }, - [B2055_C2_TX_RF_SPARE] = { .ghz5 = 0x0003, .ghz2 = 0x0003, UPLOAD, }, - [B2055_C2_TX_RF_IQCAL1] = { .ghz5 = 0x002A, .ghz2 = 0x002A, NOUPLOAD, }, - [B2055_C2_TX_RF_IQCAL2] = { .ghz5 = 0x00A4, .ghz2 = 0x00A4, NOUPLOAD, }, - [B2055_C2_TXBB_RCCAL] = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, }, - [B2055_C2_TXBB_LPF1] = { .ghz5 = 0x0028, .ghz2 = 0x0028, NOUPLOAD, }, - [B2055_C2_TX_VOSCNCL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C2_TX_LPF_MXGMIDAC] = { .ghz5 = 0x004A, .ghz2 = 0x004A, NOUPLOAD, }, - [B2055_C2_TX_BB_MXGM] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_PRG_GCHP21] = { .ghz5 = 0x0071, .ghz2 = 0x0071, NOUPLOAD, }, - [B2055_PRG_GCHP22] = { .ghz5 = 0x0072, .ghz2 = 0x0072, NOUPLOAD, }, - [B2055_PRG_GCHP23] = { .ghz5 = 0x0073, .ghz2 = 0x0073, NOUPLOAD, }, - [B2055_PRG_GCHP24] = { .ghz5 = 0x0074, .ghz2 = 0x0074, NOUPLOAD, }, - [B2055_PRG_GCHP25] = { .ghz5 = 0x0075, .ghz2 = 0x0075, NOUPLOAD, }, - [B2055_PRG_GCHP26] = { .ghz5 = 0x0076, .ghz2 = 0x0076, NOUPLOAD, }, - [B2055_PRG_GCHP27] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2055_PRG_GCHP28] = { .ghz5 = 0x0078, .ghz2 = 0x0078, NOUPLOAD, }, - [B2055_PRG_GCHP29] = { .ghz5 = 0x0079, .ghz2 = 0x0079, NOUPLOAD, }, - [B2055_PRG_GCHP30] = { .ghz5 = 0x007A, .ghz2 = 0x007A, NOUPLOAD, }, - [0xC7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xC8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xC9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xCA] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xCB] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xCC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C1_LNA_GAINBST] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xCE] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [0xCF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xD0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xD1] = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, }, - [B2055_C1_B0NB_RSSIVCM] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [0xD3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xD4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xD5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C1_GENSPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xD7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xD8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C2_LNA_GAINBST] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xDA] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [0xDB] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xDC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xDD] = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, }, - [B2055_C2_B0NB_RSSIVCM] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [0xDF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xE0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [0xE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2055_C2_GENSPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -#define RADIOREGS(r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, \ - r12, r13, r14, r15, r16, r17, r18, r19, r20, r21) \ - .radio_pll_ref = r0, \ - .radio_rf_pllmod0 = r1, \ - .radio_rf_pllmod1 = r2, \ - .radio_vco_captail = r3, \ - .radio_vco_cal1 = r4, \ - .radio_vco_cal2 = r5, \ - .radio_pll_lfc1 = r6, \ - .radio_pll_lfr1 = r7, \ - .radio_pll_lfc2 = r8, \ - .radio_lgbuf_cenbuf = r9, \ - .radio_lgen_tune1 = r10, \ - .radio_lgen_tune2 = r11, \ - .radio_c1_lgbuf_atune = r12, \ - .radio_c1_lgbuf_gtune = r13, \ - .radio_c1_rx_rfr1 = r14, \ - .radio_c1_tx_pgapadtn = r15, \ - .radio_c1_tx_mxbgtrim = r16, \ - .radio_c2_lgbuf_atune = r17, \ - .radio_c2_lgbuf_gtune = r18, \ - .radio_c2_rx_rfr1 = r19, \ - .radio_c2_tx_pgapadtn = r20, \ - .radio_c2_tx_mxbgtrim = r21 - -#define PHYREGS(r0, r1, r2, r3, r4, r5) \ - .phy_regs.phy_bw1a = r0, \ - .phy_regs.phy_bw2 = r1, \ - .phy_regs.phy_bw3 = r2, \ - .phy_regs.phy_bw4 = r3, \ - .phy_regs.phy_bw5 = r4, \ - .phy_regs.phy_bw6 = r5 - -static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] = { - { .channel = 184, - .freq = 4920, /* MHz */ - .unk2 = 3280, - RADIOREGS(0x71, 0xEC, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x0F, - 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), - PHYREGS(0x07B4, 0x07B0, 0x07AC, 0x0214, 0x0215, 0x0216), - }, - { .channel = 186, - .freq = 4930, /* MHz */ - .unk2 = 3287, - RADIOREGS(0x71, 0xED, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x0F, - 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), - PHYREGS(0x07B8, 0x07B4, 0x07B0, 0x0213, 0x0214, 0x0215), - }, - { .channel = 188, - .freq = 4940, /* MHz */ - .unk2 = 3293, - RADIOREGS(0x71, 0xEE, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, - 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), - PHYREGS(0x07BC, 0x07B8, 0x07B4, 0x0212, 0x0213, 0x0214), - }, - { .channel = 190, - .freq = 4950, /* MHz */ - .unk2 = 3300, - RADIOREGS(0x71, 0xEF, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, - 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), - PHYREGS(0x07C0, 0x07BC, 0x07B8, 0x0211, 0x0212, 0x0213), - }, - { .channel = 192, - .freq = 4960, /* MHz */ - .unk2 = 3307, - RADIOREGS(0x71, 0xF0, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, - 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), - PHYREGS(0x07C4, 0x07C0, 0x07BC, 0x020F, 0x0211, 0x0212), - }, - { .channel = 194, - .freq = 4970, /* MHz */ - .unk2 = 3313, - RADIOREGS(0x71, 0xF1, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, - 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), - PHYREGS(0x07C8, 0x07C4, 0x07C0, 0x020E, 0x020F, 0x0211), - }, - { .channel = 196, - .freq = 4980, /* MHz */ - .unk2 = 3320, - RADIOREGS(0x71, 0xF2, 0x01, 0x0E, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, - 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), - PHYREGS(0x07CC, 0x07C8, 0x07C4, 0x020D, 0x020E, 0x020F), - }, - { .channel = 198, - .freq = 4990, /* MHz */ - .unk2 = 3327, - RADIOREGS(0x71, 0xF3, 0x01, 0x0E, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, - 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), - PHYREGS(0x07D0, 0x07CC, 0x07C8, 0x020C, 0x020D, 0x020E), - }, - { .channel = 200, - .freq = 5000, /* MHz */ - .unk2 = 3333, - RADIOREGS(0x71, 0xF4, 0x01, 0x0E, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, - 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), - PHYREGS(0x07D4, 0x07D0, 0x07CC, 0x020B, 0x020C, 0x020D), - }, - { .channel = 202, - .freq = 5010, /* MHz */ - .unk2 = 3340, - RADIOREGS(0x71, 0xF5, 0x01, 0x0E, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, - 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), - PHYREGS(0x07D8, 0x07D4, 0x07D0, 0x020A, 0x020B, 0x020C), - }, - { .channel = 204, - .freq = 5020, /* MHz */ - .unk2 = 3347, - RADIOREGS(0x71, 0xF6, 0x01, 0x0E, 0xF7, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, - 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), - PHYREGS(0x07DC, 0x07D8, 0x07D4, 0x0209, 0x020A, 0x020B), - }, - { .channel = 206, - .freq = 5030, /* MHz */ - .unk2 = 3353, - RADIOREGS(0x71, 0xF7, 0x01, 0x0E, 0xF7, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, - 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), - PHYREGS(0x07E0, 0x07DC, 0x07D8, 0x0208, 0x0209, 0x020A), - }, - { .channel = 208, - .freq = 5040, /* MHz */ - .unk2 = 3360, - RADIOREGS(0x71, 0xF8, 0x01, 0x0D, 0xEF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, - 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), - PHYREGS(0x07E4, 0x07E0, 0x07DC, 0x0207, 0x0208, 0x0209), - }, - { .channel = 210, - .freq = 5050, /* MHz */ - .unk2 = 3367, - RADIOREGS(0x71, 0xF9, 0x01, 0x0D, 0xEF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, - 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), - PHYREGS(0x07E8, 0x07E4, 0x07E0, 0x0206, 0x0207, 0x0208), - }, - { .channel = 212, - .freq = 5060, /* MHz */ - .unk2 = 3373, - RADIOREGS(0x71, 0xFA, 0x01, 0x0D, 0xE6, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xBB, 0xBB, 0xFF, 0x00, 0x0E, 0x0F, - 0x8E, 0xFF, 0x00, 0x0E, 0x0F, 0x8E), - PHYREGS(0x07EC, 0x07E8, 0x07E4, 0x0205, 0x0206, 0x0207), - }, - { .channel = 214, - .freq = 5070, /* MHz */ - .unk2 = 3380, - RADIOREGS(0x71, 0xFB, 0x01, 0x0D, 0xE6, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xBB, 0xBB, 0xFF, 0x00, 0x0E, 0x0F, - 0x8E, 0xFF, 0x00, 0x0E, 0x0F, 0x8E), - PHYREGS(0x07F0, 0x07EC, 0x07E8, 0x0204, 0x0205, 0x0206), - }, - { .channel = 216, - .freq = 5080, /* MHz */ - .unk2 = 3387, - RADIOREGS(0x71, 0xFC, 0x01, 0x0D, 0xDE, 0x01, 0x04, 0x0A, - 0x00, 0x8E, 0xBB, 0xBB, 0xEE, 0x00, 0x0E, 0x0F, - 0x8D, 0xEE, 0x00, 0x0E, 0x0F, 0x8D), - PHYREGS(0x07F4, 0x07F0, 0x07EC, 0x0203, 0x0204, 0x0205), - }, - { .channel = 218, - .freq = 5090, /* MHz */ - .unk2 = 3393, - RADIOREGS(0x71, 0xFD, 0x01, 0x0D, 0xDE, 0x01, 0x04, 0x0A, - 0x00, 0x8E, 0xBB, 0xBB, 0xEE, 0x00, 0x0E, 0x0F, - 0x8D, 0xEE, 0x00, 0x0E, 0x0F, 0x8D), - PHYREGS(0x07F8, 0x07F4, 0x07F0, 0x0202, 0x0203, 0x0204), - }, - { .channel = 220, - .freq = 5100, /* MHz */ - .unk2 = 3400, - RADIOREGS(0x71, 0xFE, 0x01, 0x0C, 0xD6, 0x01, 0x04, 0x0A, - 0x00, 0x8E, 0xAA, 0xAA, 0xEE, 0x00, 0x0D, 0x0F, - 0x8D, 0xEE, 0x00, 0x0D, 0x0F, 0x8D), - PHYREGS(0x07FC, 0x07F8, 0x07F4, 0x0201, 0x0202, 0x0203), - }, - { .channel = 222, - .freq = 5110, /* MHz */ - .unk2 = 3407, - RADIOREGS(0x71, 0xFF, 0x01, 0x0C, 0xD6, 0x01, 0x04, 0x0A, - 0x00, 0x8E, 0xAA, 0xAA, 0xEE, 0x00, 0x0D, 0x0F, - 0x8D, 0xEE, 0x00, 0x0D, 0x0F, 0x8D), - PHYREGS(0x0800, 0x07FC, 0x07F8, 0x0200, 0x0201, 0x0202), - }, - { .channel = 224, - .freq = 5120, /* MHz */ - .unk2 = 3413, - RADIOREGS(0x71, 0x00, 0x02, 0x0C, 0xCE, 0x01, 0x04, 0x0A, - 0x00, 0x8D, 0xAA, 0xAA, 0xDD, 0x00, 0x0D, 0x0F, - 0x8C, 0xDD, 0x00, 0x0D, 0x0F, 0x8C), - PHYREGS(0x0804, 0x0800, 0x07FC, 0x01FF, 0x0200, 0x0201), - }, - { .channel = 226, - .freq = 5130, /* MHz */ - .unk2 = 3420, - RADIOREGS(0x71, 0x01, 0x02, 0x0C, 0xCE, 0x01, 0x04, 0x0A, - 0x00, 0x8D, 0xAA, 0xAA, 0xDD, 0x00, 0x0D, 0x0F, - 0x8C, 0xDD, 0x00, 0x0D, 0x0F, 0x8C), - PHYREGS(0x0808, 0x0804, 0x0800, 0x01FE, 0x01FF, 0x0200), - }, - { .channel = 228, - .freq = 5140, /* MHz */ - .unk2 = 3427, - RADIOREGS(0x71, 0x02, 0x02, 0x0C, 0xC6, 0x01, 0x04, 0x0A, - 0x00, 0x8D, 0x99, 0x99, 0xDD, 0x00, 0x0C, 0x0E, - 0x8B, 0xDD, 0x00, 0x0C, 0x0E, 0x8B), - PHYREGS(0x080C, 0x0808, 0x0804, 0x01FD, 0x01FE, 0x01FF), - }, - { .channel = 32, - .freq = 5160, /* MHz */ - .unk2 = 3440, - RADIOREGS(0x71, 0x04, 0x02, 0x0B, 0xBE, 0x01, 0x04, 0x0A, - 0x00, 0x8C, 0x99, 0x99, 0xCC, 0x00, 0x0B, 0x0D, - 0x8A, 0xCC, 0x00, 0x0B, 0x0D, 0x8A), - PHYREGS(0x0814, 0x0810, 0x080C, 0x01FB, 0x01FC, 0x01FD), - }, - { .channel = 34, - .freq = 5170, /* MHz */ - .unk2 = 3447, - RADIOREGS(0x71, 0x05, 0x02, 0x0B, 0xBE, 0x01, 0x04, 0x0A, - 0x00, 0x8C, 0x99, 0x99, 0xCC, 0x00, 0x0B, 0x0D, - 0x8A, 0xCC, 0x00, 0x0B, 0x0D, 0x8A), - PHYREGS(0x0818, 0x0814, 0x0810, 0x01FA, 0x01FB, 0x01FC), - }, - { .channel = 36, - .freq = 5180, /* MHz */ - .unk2 = 3453, - RADIOREGS(0x71, 0x06, 0x02, 0x0B, 0xB6, 0x01, 0x04, 0x0A, - 0x00, 0x8C, 0x88, 0x88, 0xCC, 0x00, 0x0B, 0x0C, - 0x89, 0xCC, 0x00, 0x0B, 0x0C, 0x89), - PHYREGS(0x081C, 0x0818, 0x0814, 0x01F9, 0x01FA, 0x01FB), - }, - { .channel = 38, - .freq = 5190, /* MHz */ - .unk2 = 3460, - RADIOREGS(0x71, 0x07, 0x02, 0x0B, 0xB6, 0x01, 0x04, 0x0A, - 0x00, 0x8C, 0x88, 0x88, 0xCC, 0x00, 0x0B, 0x0C, - 0x89, 0xCC, 0x00, 0x0B, 0x0C, 0x89), - PHYREGS(0x0820, 0x081C, 0x0818, 0x01F8, 0x01F9, 0x01FA), - }, - { .channel = 40, - .freq = 5200, /* MHz */ - .unk2 = 3467, - RADIOREGS(0x71, 0x08, 0x02, 0x0B, 0xAF, 0x01, 0x04, 0x0A, - 0x00, 0x8B, 0x88, 0x88, 0xBB, 0x00, 0x0A, 0x0B, - 0x89, 0xBB, 0x00, 0x0A, 0x0B, 0x89), - PHYREGS(0x0824, 0x0820, 0x081C, 0x01F7, 0x01F8, 0x01F9), - }, - { .channel = 42, - .freq = 5210, /* MHz */ - .unk2 = 3473, - RADIOREGS(0x71, 0x09, 0x02, 0x0B, 0xAF, 0x01, 0x04, 0x0A, - 0x00, 0x8B, 0x88, 0x88, 0xBB, 0x00, 0x0A, 0x0B, - 0x89, 0xBB, 0x00, 0x0A, 0x0B, 0x89), - PHYREGS(0x0828, 0x0824, 0x0820, 0x01F6, 0x01F7, 0x01F8), - }, - { .channel = 44, - .freq = 5220, /* MHz */ - .unk2 = 3480, - RADIOREGS(0x71, 0x0A, 0x02, 0x0A, 0xA7, 0x01, 0x04, 0x0A, - 0x00, 0x8B, 0x77, 0x77, 0xBB, 0x00, 0x09, 0x0A, - 0x88, 0xBB, 0x00, 0x09, 0x0A, 0x88), - PHYREGS(0x082C, 0x0828, 0x0824, 0x01F5, 0x01F6, 0x01F7), - }, - { .channel = 46, - .freq = 5230, /* MHz */ - .unk2 = 3487, - RADIOREGS(0x71, 0x0B, 0x02, 0x0A, 0xA7, 0x01, 0x04, 0x0A, - 0x00, 0x8B, 0x77, 0x77, 0xBB, 0x00, 0x09, 0x0A, - 0x88, 0xBB, 0x00, 0x09, 0x0A, 0x88), - PHYREGS(0x0830, 0x082C, 0x0828, 0x01F4, 0x01F5, 0x01F6), - }, - { .channel = 48, - .freq = 5240, /* MHz */ - .unk2 = 3493, - RADIOREGS(0x71, 0x0C, 0x02, 0x0A, 0xA0, 0x01, 0x04, 0x0A, - 0x00, 0x8A, 0x77, 0x77, 0xAA, 0x00, 0x09, 0x0A, - 0x87, 0xAA, 0x00, 0x09, 0x0A, 0x87), - PHYREGS(0x0834, 0x0830, 0x082C, 0x01F3, 0x01F4, 0x01F5), - }, - { .channel = 50, - .freq = 5250, /* MHz */ - .unk2 = 3500, - RADIOREGS(0x71, 0x0D, 0x02, 0x0A, 0xA0, 0x01, 0x04, 0x0A, - 0x00, 0x8A, 0x77, 0x77, 0xAA, 0x00, 0x09, 0x0A, - 0x87, 0xAA, 0x00, 0x09, 0x0A, 0x87), - PHYREGS(0x0838, 0x0834, 0x0830, 0x01F2, 0x01F3, 0x01F4), - }, - { .channel = 52, - .freq = 5260, /* MHz */ - .unk2 = 3507, - RADIOREGS(0x71, 0x0E, 0x02, 0x0A, 0x98, 0x01, 0x04, 0x0A, - 0x00, 0x8A, 0x66, 0x66, 0xAA, 0x00, 0x08, 0x09, - 0x87, 0xAA, 0x00, 0x08, 0x09, 0x87), - PHYREGS(0x083C, 0x0838, 0x0834, 0x01F1, 0x01F2, 0x01F3), - }, - { .channel = 54, - .freq = 5270, /* MHz */ - .unk2 = 3513, - RADIOREGS(0x71, 0x0F, 0x02, 0x0A, 0x98, 0x01, 0x04, 0x0A, - 0x00, 0x8A, 0x66, 0x66, 0xAA, 0x00, 0x08, 0x09, - 0x87, 0xAA, 0x00, 0x08, 0x09, 0x87), - PHYREGS(0x0840, 0x083C, 0x0838, 0x01F0, 0x01F1, 0x01F2), - }, - { .channel = 56, - .freq = 5280, /* MHz */ - .unk2 = 3520, - RADIOREGS(0x71, 0x10, 0x02, 0x09, 0x91, 0x01, 0x04, 0x0A, - 0x00, 0x89, 0x66, 0x66, 0x99, 0x00, 0x08, 0x08, - 0x86, 0x99, 0x00, 0x08, 0x08, 0x86), - PHYREGS(0x0844, 0x0840, 0x083C, 0x01F0, 0x01F0, 0x01F1), - }, - { .channel = 58, - .freq = 5290, /* MHz */ - .unk2 = 3527, - RADIOREGS(0x71, 0x11, 0x02, 0x09, 0x91, 0x01, 0x04, 0x0A, - 0x00, 0x89, 0x66, 0x66, 0x99, 0x00, 0x08, 0x08, - 0x86, 0x99, 0x00, 0x08, 0x08, 0x86), - PHYREGS(0x0848, 0x0844, 0x0840, 0x01EF, 0x01F0, 0x01F0), - }, - { .channel = 60, - .freq = 5300, /* MHz */ - .unk2 = 3533, - RADIOREGS(0x71, 0x12, 0x02, 0x09, 0x8A, 0x01, 0x04, 0x0A, - 0x00, 0x89, 0x55, 0x55, 0x99, 0x00, 0x08, 0x07, - 0x85, 0x99, 0x00, 0x08, 0x07, 0x85), - PHYREGS(0x084C, 0x0848, 0x0844, 0x01EE, 0x01EF, 0x01F0), - }, - { .channel = 62, - .freq = 5310, /* MHz */ - .unk2 = 3540, - RADIOREGS(0x71, 0x13, 0x02, 0x09, 0x8A, 0x01, 0x04, 0x0A, - 0x00, 0x89, 0x55, 0x55, 0x99, 0x00, 0x08, 0x07, - 0x85, 0x99, 0x00, 0x08, 0x07, 0x85), - PHYREGS(0x0850, 0x084C, 0x0848, 0x01ED, 0x01EE, 0x01EF), - }, - { .channel = 64, - .freq = 5320, /* MHz */ - .unk2 = 3547, - RADIOREGS(0x71, 0x14, 0x02, 0x09, 0x83, 0x01, 0x04, 0x0A, - 0x00, 0x88, 0x55, 0x55, 0x88, 0x00, 0x07, 0x07, - 0x84, 0x88, 0x00, 0x07, 0x07, 0x84), - PHYREGS(0x0854, 0x0850, 0x084C, 0x01EC, 0x01ED, 0x01EE), - }, - { .channel = 66, - .freq = 5330, /* MHz */ - .unk2 = 3553, - RADIOREGS(0x71, 0x15, 0x02, 0x09, 0x83, 0x01, 0x04, 0x0A, - 0x00, 0x88, 0x55, 0x55, 0x88, 0x00, 0x07, 0x07, - 0x84, 0x88, 0x00, 0x07, 0x07, 0x84), - PHYREGS(0x0858, 0x0854, 0x0850, 0x01EB, 0x01EC, 0x01ED), - }, - { .channel = 68, - .freq = 5340, /* MHz */ - .unk2 = 3560, - RADIOREGS(0x71, 0x16, 0x02, 0x08, 0x7C, 0x01, 0x04, 0x0A, - 0x00, 0x88, 0x44, 0x44, 0x88, 0x00, 0x07, 0x06, - 0x84, 0x88, 0x00, 0x07, 0x06, 0x84), - PHYREGS(0x085C, 0x0858, 0x0854, 0x01EA, 0x01EB, 0x01EC), - }, - { .channel = 70, - .freq = 5350, /* MHz */ - .unk2 = 3567, - RADIOREGS(0x71, 0x17, 0x02, 0x08, 0x7C, 0x01, 0x04, 0x0A, - 0x00, 0x88, 0x44, 0x44, 0x88, 0x00, 0x07, 0x06, - 0x84, 0x88, 0x00, 0x07, 0x06, 0x84), - PHYREGS(0x0860, 0x085C, 0x0858, 0x01E9, 0x01EA, 0x01EB), - }, - { .channel = 72, - .freq = 5360, /* MHz */ - .unk2 = 3573, - RADIOREGS(0x71, 0x18, 0x02, 0x08, 0x75, 0x01, 0x04, 0x0A, - 0x00, 0x87, 0x44, 0x44, 0x77, 0x00, 0x06, 0x05, - 0x83, 0x77, 0x00, 0x06, 0x05, 0x83), - PHYREGS(0x0864, 0x0860, 0x085C, 0x01E8, 0x01E9, 0x01EA), - }, - { .channel = 74, - .freq = 5370, /* MHz */ - .unk2 = 3580, - RADIOREGS(0x71, 0x19, 0x02, 0x08, 0x75, 0x01, 0x04, 0x0A, - 0x00, 0x87, 0x44, 0x44, 0x77, 0x00, 0x06, 0x05, - 0x83, 0x77, 0x00, 0x06, 0x05, 0x83), - PHYREGS(0x0868, 0x0864, 0x0860, 0x01E7, 0x01E8, 0x01E9), - }, - { .channel = 76, - .freq = 5380, /* MHz */ - .unk2 = 3587, - RADIOREGS(0x71, 0x1A, 0x02, 0x08, 0x6E, 0x01, 0x04, 0x0A, - 0x00, 0x87, 0x33, 0x33, 0x77, 0x00, 0x06, 0x04, - 0x82, 0x77, 0x00, 0x06, 0x04, 0x82), - PHYREGS(0x086C, 0x0868, 0x0864, 0x01E6, 0x01E7, 0x01E8), - }, - { .channel = 78, - .freq = 5390, /* MHz */ - .unk2 = 3593, - RADIOREGS(0x71, 0x1B, 0x02, 0x08, 0x6E, 0x01, 0x04, 0x0A, - 0x00, 0x87, 0x33, 0x33, 0x77, 0x00, 0x06, 0x04, - 0x82, 0x77, 0x00, 0x06, 0x04, 0x82), - PHYREGS(0x0870, 0x086C, 0x0868, 0x01E5, 0x01E6, 0x01E7), - }, - { .channel = 80, - .freq = 5400, /* MHz */ - .unk2 = 3600, - RADIOREGS(0x71, 0x1C, 0x02, 0x07, 0x67, 0x01, 0x04, 0x0A, - 0x00, 0x86, 0x33, 0x33, 0x66, 0x00, 0x05, 0x04, - 0x81, 0x66, 0x00, 0x05, 0x04, 0x81), - PHYREGS(0x0874, 0x0870, 0x086C, 0x01E5, 0x01E5, 0x01E6), - }, - { .channel = 82, - .freq = 5410, /* MHz */ - .unk2 = 3607, - RADIOREGS(0x71, 0x1D, 0x02, 0x07, 0x67, 0x01, 0x04, 0x0A, - 0x00, 0x86, 0x33, 0x33, 0x66, 0x00, 0x05, 0x04, - 0x81, 0x66, 0x00, 0x05, 0x04, 0x81), - PHYREGS(0x0878, 0x0874, 0x0870, 0x01E4, 0x01E5, 0x01E5), - }, - { .channel = 84, - .freq = 5420, /* MHz */ - .unk2 = 3613, - RADIOREGS(0x71, 0x1E, 0x02, 0x07, 0x61, 0x01, 0x04, 0x0A, - 0x00, 0x86, 0x22, 0x22, 0x66, 0x00, 0x05, 0x03, - 0x80, 0x66, 0x00, 0x05, 0x03, 0x80), - PHYREGS(0x087C, 0x0878, 0x0874, 0x01E3, 0x01E4, 0x01E5), - }, - { .channel = 86, - .freq = 5430, /* MHz */ - .unk2 = 3620, - RADIOREGS(0x71, 0x1F, 0x02, 0x07, 0x61, 0x01, 0x04, 0x0A, - 0x00, 0x86, 0x22, 0x22, 0x66, 0x00, 0x05, 0x03, - 0x80, 0x66, 0x00, 0x05, 0x03, 0x80), - PHYREGS(0x0880, 0x087C, 0x0878, 0x01E2, 0x01E3, 0x01E4), - }, - { .channel = 88, - .freq = 5440, /* MHz */ - .unk2 = 3627, - RADIOREGS(0x71, 0x20, 0x02, 0x07, 0x5A, 0x01, 0x04, 0x0A, - 0x00, 0x85, 0x22, 0x22, 0x55, 0x00, 0x04, 0x02, - 0x80, 0x55, 0x00, 0x04, 0x02, 0x80), - PHYREGS(0x0884, 0x0880, 0x087C, 0x01E1, 0x01E2, 0x01E3), - }, - { .channel = 90, - .freq = 5450, /* MHz */ - .unk2 = 3633, - RADIOREGS(0x71, 0x21, 0x02, 0x07, 0x5A, 0x01, 0x04, 0x0A, - 0x00, 0x85, 0x22, 0x22, 0x55, 0x00, 0x04, 0x02, - 0x80, 0x55, 0x00, 0x04, 0x02, 0x80), - PHYREGS(0x0888, 0x0884, 0x0880, 0x01E0, 0x01E1, 0x01E2), - }, - { .channel = 92, - .freq = 5460, /* MHz */ - .unk2 = 3640, - RADIOREGS(0x71, 0x22, 0x02, 0x06, 0x53, 0x01, 0x04, 0x0A, - 0x00, 0x85, 0x11, 0x11, 0x55, 0x00, 0x04, 0x01, - 0x80, 0x55, 0x00, 0x04, 0x01, 0x80), - PHYREGS(0x088C, 0x0888, 0x0884, 0x01DF, 0x01E0, 0x01E1), - }, - { .channel = 94, - .freq = 5470, /* MHz */ - .unk2 = 3647, - RADIOREGS(0x71, 0x23, 0x02, 0x06, 0x53, 0x01, 0x04, 0x0A, - 0x00, 0x85, 0x11, 0x11, 0x55, 0x00, 0x04, 0x01, - 0x80, 0x55, 0x00, 0x04, 0x01, 0x80), - PHYREGS(0x0890, 0x088C, 0x0888, 0x01DE, 0x01DF, 0x01E0), - }, - { .channel = 96, - .freq = 5480, /* MHz */ - .unk2 = 3653, - RADIOREGS(0x71, 0x24, 0x02, 0x06, 0x4D, 0x01, 0x04, 0x0A, - 0x00, 0x84, 0x11, 0x11, 0x44, 0x00, 0x03, 0x00, - 0x80, 0x44, 0x00, 0x03, 0x00, 0x80), - PHYREGS(0x0894, 0x0890, 0x088C, 0x01DD, 0x01DE, 0x01DF), - }, - { .channel = 98, - .freq = 5490, /* MHz */ - .unk2 = 3660, - RADIOREGS(0x71, 0x25, 0x02, 0x06, 0x4D, 0x01, 0x04, 0x0A, - 0x00, 0x84, 0x11, 0x11, 0x44, 0x00, 0x03, 0x00, - 0x80, 0x44, 0x00, 0x03, 0x00, 0x80), - PHYREGS(0x0898, 0x0894, 0x0890, 0x01DD, 0x01DD, 0x01DE), - }, - { .channel = 100, - .freq = 5500, /* MHz */ - .unk2 = 3667, - RADIOREGS(0x71, 0x26, 0x02, 0x06, 0x47, 0x01, 0x04, 0x0A, - 0x00, 0x84, 0x00, 0x00, 0x44, 0x00, 0x03, 0x00, - 0x80, 0x44, 0x00, 0x03, 0x00, 0x80), - PHYREGS(0x089C, 0x0898, 0x0894, 0x01DC, 0x01DD, 0x01DD), - }, - { .channel = 102, - .freq = 5510, /* MHz */ - .unk2 = 3673, - RADIOREGS(0x71, 0x27, 0x02, 0x06, 0x47, 0x01, 0x04, 0x0A, - 0x00, 0x84, 0x00, 0x00, 0x44, 0x00, 0x03, 0x00, - 0x80, 0x44, 0x00, 0x03, 0x00, 0x80), - PHYREGS(0x08A0, 0x089C, 0x0898, 0x01DB, 0x01DC, 0x01DD), - }, - { .channel = 104, - .freq = 5520, /* MHz */ - .unk2 = 3680, - RADIOREGS(0x71, 0x28, 0x02, 0x05, 0x40, 0x01, 0x04, 0x0A, - 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, - 0x80, 0x33, 0x00, 0x02, 0x00, 0x80), - PHYREGS(0x08A4, 0x08A0, 0x089C, 0x01DA, 0x01DB, 0x01DC), - }, - { .channel = 106, - .freq = 5530, /* MHz */ - .unk2 = 3687, - RADIOREGS(0x71, 0x29, 0x02, 0x05, 0x40, 0x01, 0x04, 0x0A, - 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, - 0x80, 0x33, 0x00, 0x02, 0x00, 0x80), - PHYREGS(0x08A8, 0x08A4, 0x08A0, 0x01D9, 0x01DA, 0x01DB), - }, - { .channel = 108, - .freq = 5540, /* MHz */ - .unk2 = 3693, - RADIOREGS(0x71, 0x2A, 0x02, 0x05, 0x3A, 0x01, 0x04, 0x0A, - 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, - 0x80, 0x33, 0x00, 0x02, 0x00, 0x80), - PHYREGS(0x08AC, 0x08A8, 0x08A4, 0x01D8, 0x01D9, 0x01DA), - }, - { .channel = 110, - .freq = 5550, /* MHz */ - .unk2 = 3700, - RADIOREGS(0x71, 0x2B, 0x02, 0x05, 0x3A, 0x01, 0x04, 0x0A, - 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, - 0x80, 0x33, 0x00, 0x02, 0x00, 0x80), - PHYREGS(0x08B0, 0x08AC, 0x08A8, 0x01D7, 0x01D8, 0x01D9), - }, - { .channel = 112, - .freq = 5560, /* MHz */ - .unk2 = 3707, - RADIOREGS(0x71, 0x2C, 0x02, 0x05, 0x34, 0x01, 0x04, 0x0A, - 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, - 0x80, 0x22, 0x00, 0x01, 0x00, 0x80), - PHYREGS(0x08B4, 0x08B0, 0x08AC, 0x01D7, 0x01D7, 0x01D8), - }, - { .channel = 114, - .freq = 5570, /* MHz */ - .unk2 = 3713, - RADIOREGS(0x71, 0x2D, 0x02, 0x05, 0x34, 0x01, 0x04, 0x0A, - 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, - 0x80, 0x22, 0x00, 0x01, 0x00, 0x80), - PHYREGS(0x08B8, 0x08B4, 0x08B0, 0x01D6, 0x01D7, 0x01D7), - }, - { .channel = 116, - .freq = 5580, /* MHz */ - .unk2 = 3720, - RADIOREGS(0x71, 0x2E, 0x02, 0x04, 0x2E, 0x01, 0x04, 0x0A, - 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, - 0x80, 0x22, 0x00, 0x01, 0x00, 0x80), - PHYREGS(0x08BC, 0x08B8, 0x08B4, 0x01D5, 0x01D6, 0x01D7), - }, - { .channel = 118, - .freq = 5590, /* MHz */ - .unk2 = 3727, - RADIOREGS(0x71, 0x2F, 0x02, 0x04, 0x2E, 0x01, 0x04, 0x0A, - 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, - 0x80, 0x22, 0x00, 0x01, 0x00, 0x80), - PHYREGS(0x08C0, 0x08BC, 0x08B8, 0x01D4, 0x01D5, 0x01D6), - }, - { .channel = 120, - .freq = 5600, /* MHz */ - .unk2 = 3733, - RADIOREGS(0x71, 0x30, 0x02, 0x04, 0x28, 0x01, 0x04, 0x0A, - 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x01, 0x00, - 0x80, 0x11, 0x00, 0x01, 0x00, 0x80), - PHYREGS(0x08C4, 0x08C0, 0x08BC, 0x01D3, 0x01D4, 0x01D5), - }, - { .channel = 122, - .freq = 5610, /* MHz */ - .unk2 = 3740, - RADIOREGS(0x71, 0x31, 0x02, 0x04, 0x28, 0x01, 0x04, 0x0A, - 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x01, 0x00, - 0x80, 0x11, 0x00, 0x01, 0x00, 0x80), - PHYREGS(0x08C8, 0x08C4, 0x08C0, 0x01D2, 0x01D3, 0x01D4), - }, - { .channel = 124, - .freq = 5620, /* MHz */ - .unk2 = 3747, - RADIOREGS(0x71, 0x32, 0x02, 0x04, 0x21, 0x01, 0x04, 0x0A, - 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x80, 0x11, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08CC, 0x08C8, 0x08C4, 0x01D2, 0x01D2, 0x01D3), - }, - { .channel = 126, - .freq = 5630, /* MHz */ - .unk2 = 3753, - RADIOREGS(0x71, 0x33, 0x02, 0x04, 0x21, 0x01, 0x04, 0x0A, - 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, - 0x80, 0x11, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08D0, 0x08CC, 0x08C8, 0x01D1, 0x01D2, 0x01D2), - }, - { .channel = 128, - .freq = 5640, /* MHz */ - .unk2 = 3760, - RADIOREGS(0x71, 0x34, 0x02, 0x03, 0x1C, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08D4, 0x08D0, 0x08CC, 0x01D0, 0x01D1, 0x01D2), - }, - { .channel = 130, - .freq = 5650, /* MHz */ - .unk2 = 3767, - RADIOREGS(0x71, 0x35, 0x02, 0x03, 0x1C, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08D8, 0x08D4, 0x08D0, 0x01CF, 0x01D0, 0x01D1), - }, - { .channel = 132, - .freq = 5660, /* MHz */ - .unk2 = 3773, - RADIOREGS(0x71, 0x36, 0x02, 0x03, 0x16, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08DC, 0x08D8, 0x08D4, 0x01CE, 0x01CF, 0x01D0), - }, - { .channel = 134, - .freq = 5670, /* MHz */ - .unk2 = 3780, - RADIOREGS(0x71, 0x37, 0x02, 0x03, 0x16, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08E0, 0x08DC, 0x08D8, 0x01CE, 0x01CE, 0x01CF), - }, - { .channel = 136, - .freq = 5680, /* MHz */ - .unk2 = 3787, - RADIOREGS(0x71, 0x38, 0x02, 0x03, 0x10, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08E4, 0x08E0, 0x08DC, 0x01CD, 0x01CE, 0x01CE), - }, - { .channel = 138, - .freq = 5690, /* MHz */ - .unk2 = 3793, - RADIOREGS(0x71, 0x39, 0x02, 0x03, 0x10, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08E8, 0x08E4, 0x08E0, 0x01CC, 0x01CD, 0x01CE), - }, - { .channel = 140, - .freq = 5700, /* MHz */ - .unk2 = 3800, - RADIOREGS(0x71, 0x3A, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08EC, 0x08E8, 0x08E4, 0x01CB, 0x01CC, 0x01CD), - }, - { .channel = 142, - .freq = 5710, /* MHz */ - .unk2 = 3807, - RADIOREGS(0x71, 0x3B, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08F0, 0x08EC, 0x08E8, 0x01CA, 0x01CB, 0x01CC), - }, - { .channel = 144, - .freq = 5720, /* MHz */ - .unk2 = 3813, - RADIOREGS(0x71, 0x3C, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08F4, 0x08F0, 0x08EC, 0x01C9, 0x01CA, 0x01CB), - }, - { .channel = 145, - .freq = 5725, /* MHz */ - .unk2 = 3817, - RADIOREGS(0x72, 0x79, 0x04, 0x02, 0x03, 0x01, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08F6, 0x08F2, 0x08EE, 0x01C9, 0x01CA, 0x01CB), - }, - { .channel = 146, - .freq = 5730, /* MHz */ - .unk2 = 3820, - RADIOREGS(0x71, 0x3D, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08F8, 0x08F4, 0x08F0, 0x01C9, 0x01C9, 0x01CA), - }, - { .channel = 147, - .freq = 5735, /* MHz */ - .unk2 = 3823, - RADIOREGS(0x72, 0x7B, 0x04, 0x02, 0x03, 0x01, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08FA, 0x08F6, 0x08F2, 0x01C8, 0x01C9, 0x01CA), - }, - { .channel = 148, - .freq = 5740, /* MHz */ - .unk2 = 3827, - RADIOREGS(0x71, 0x3E, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08FC, 0x08F8, 0x08F4, 0x01C8, 0x01C9, 0x01C9), - }, - { .channel = 149, - .freq = 5745, /* MHz */ - .unk2 = 3830, - RADIOREGS(0x72, 0x7D, 0x04, 0x02, 0xFE, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x08FE, 0x08FA, 0x08F6, 0x01C8, 0x01C8, 0x01C9), - }, - { .channel = 150, - .freq = 5750, /* MHz */ - .unk2 = 3833, - RADIOREGS(0x71, 0x3F, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0900, 0x08FC, 0x08F8, 0x01C7, 0x01C8, 0x01C9), - }, - { .channel = 151, - .freq = 5755, /* MHz */ - .unk2 = 3837, - RADIOREGS(0x72, 0x7F, 0x04, 0x02, 0xFE, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0902, 0x08FE, 0x08FA, 0x01C7, 0x01C8, 0x01C8), - }, - { .channel = 152, - .freq = 5760, /* MHz */ - .unk2 = 3840, - RADIOREGS(0x71, 0x40, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0904, 0x0900, 0x08FC, 0x01C6, 0x01C7, 0x01C8), - }, - { .channel = 153, - .freq = 5765, /* MHz */ - .unk2 = 3843, - RADIOREGS(0x72, 0x81, 0x04, 0x02, 0xF8, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0906, 0x0902, 0x08FE, 0x01C6, 0x01C7, 0x01C8), - }, - { .channel = 154, - .freq = 5770, /* MHz */ - .unk2 = 3847, - RADIOREGS(0x71, 0x41, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0908, 0x0904, 0x0900, 0x01C6, 0x01C6, 0x01C7), - }, - { .channel = 155, - .freq = 5775, /* MHz */ - .unk2 = 3850, - RADIOREGS(0x72, 0x83, 0x04, 0x02, 0xF8, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x090A, 0x0906, 0x0902, 0x01C5, 0x01C6, 0x01C7), - }, - { .channel = 156, - .freq = 5780, /* MHz */ - .unk2 = 3853, - RADIOREGS(0x71, 0x42, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x090C, 0x0908, 0x0904, 0x01C5, 0x01C6, 0x01C6), - }, - { .channel = 157, - .freq = 5785, /* MHz */ - .unk2 = 3857, - RADIOREGS(0x72, 0x85, 0x04, 0x02, 0xF2, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x090E, 0x090A, 0x0906, 0x01C4, 0x01C5, 0x01C6), - }, - { .channel = 158, - .freq = 5790, /* MHz */ - .unk2 = 3860, - RADIOREGS(0x71, 0x43, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0910, 0x090C, 0x0908, 0x01C4, 0x01C5, 0x01C6), - }, - { .channel = 159, - .freq = 5795, /* MHz */ - .unk2 = 3863, - RADIOREGS(0x72, 0x87, 0x04, 0x02, 0xF2, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0912, 0x090E, 0x090A, 0x01C4, 0x01C4, 0x01C5), - }, - { .channel = 160, - .freq = 5800, /* MHz */ - .unk2 = 3867, - RADIOREGS(0x71, 0x44, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0914, 0x0910, 0x090C, 0x01C3, 0x01C4, 0x01C5), - }, - { .channel = 161, - .freq = 5805, /* MHz */ - .unk2 = 3870, - RADIOREGS(0x72, 0x89, 0x04, 0x01, 0xED, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0916, 0x0912, 0x090E, 0x01C3, 0x01C4, 0x01C4), - }, - { .channel = 162, - .freq = 5810, /* MHz */ - .unk2 = 3873, - RADIOREGS(0x71, 0x45, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0918, 0x0914, 0x0910, 0x01C2, 0x01C3, 0x01C4), - }, - { .channel = 163, - .freq = 5815, /* MHz */ - .unk2 = 3877, - RADIOREGS(0x72, 0x8B, 0x04, 0x01, 0xED, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x091A, 0x0916, 0x0912, 0x01C2, 0x01C3, 0x01C4), - }, - { .channel = 164, - .freq = 5820, /* MHz */ - .unk2 = 3880, - RADIOREGS(0x71, 0x46, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x091C, 0x0918, 0x0914, 0x01C2, 0x01C2, 0x01C3), - }, - { .channel = 165, - .freq = 5825, /* MHz */ - .unk2 = 3883, - RADIOREGS(0x72, 0x8D, 0x04, 0x01, 0xED, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x091E, 0x091A, 0x0916, 0x01C1, 0x01C2, 0x01C3), - }, - { .channel = 166, - .freq = 5830, /* MHz */ - .unk2 = 3887, - RADIOREGS(0x71, 0x47, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0920, 0x091C, 0x0918, 0x01C1, 0x01C2, 0x01C2), - }, - { .channel = 168, - .freq = 5840, /* MHz */ - .unk2 = 3893, - RADIOREGS(0x71, 0x48, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0924, 0x0920, 0x091C, 0x01C0, 0x01C1, 0x01C2), - }, - { .channel = 170, - .freq = 5850, /* MHz */ - .unk2 = 3900, - RADIOREGS(0x71, 0x49, 0x02, 0x01, 0xE0, 0x00, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0928, 0x0924, 0x0920, 0x01BF, 0x01C0, 0x01C1), - }, - { .channel = 172, - .freq = 5860, /* MHz */ - .unk2 = 3907, - RADIOREGS(0x71, 0x4A, 0x02, 0x01, 0xDE, 0x00, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x092C, 0x0928, 0x0924, 0x01BF, 0x01BF, 0x01C0), - }, - { .channel = 174, - .freq = 5870, /* MHz */ - .unk2 = 3913, - RADIOREGS(0x71, 0x4B, 0x02, 0x00, 0xDB, 0x00, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0930, 0x092C, 0x0928, 0x01BE, 0x01BF, 0x01BF), - }, - { .channel = 176, - .freq = 5880, /* MHz */ - .unk2 = 3920, - RADIOREGS(0x71, 0x4C, 0x02, 0x00, 0xD8, 0x00, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0934, 0x0930, 0x092C, 0x01BD, 0x01BE, 0x01BF), - }, - { .channel = 178, - .freq = 5890, /* MHz */ - .unk2 = 3927, - RADIOREGS(0x71, 0x4D, 0x02, 0x00, 0xD6, 0x00, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0938, 0x0934, 0x0930, 0x01BC, 0x01BD, 0x01BE), - }, - { .channel = 180, - .freq = 5900, /* MHz */ - .unk2 = 3933, - RADIOREGS(0x71, 0x4E, 0x02, 0x00, 0xD3, 0x00, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x093C, 0x0938, 0x0934, 0x01BC, 0x01BC, 0x01BD), - }, - { .channel = 182, - .freq = 5910, /* MHz */ - .unk2 = 3940, - RADIOREGS(0x71, 0x4F, 0x02, 0x00, 0xD6, 0x00, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), - PHYREGS(0x0940, 0x093C, 0x0938, 0x01BB, 0x01BC, 0x01BC), - }, - { .channel = 1, - .freq = 2412, /* MHz */ - .unk2 = 3216, - RADIOREGS(0x73, 0x6C, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0D, 0x0C, - 0x80, 0xFF, 0x88, 0x0D, 0x0C, 0x80), - PHYREGS(0x03C9, 0x03C5, 0x03C1, 0x043A, 0x043F, 0x0443), - }, - { .channel = 2, - .freq = 2417, /* MHz */ - .unk2 = 3223, - RADIOREGS(0x73, 0x71, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0B, - 0x80, 0xFF, 0x88, 0x0C, 0x0B, 0x80), - PHYREGS(0x03CB, 0x03C7, 0x03C3, 0x0438, 0x043D, 0x0441), - }, - { .channel = 3, - .freq = 2422, /* MHz */ - .unk2 = 3229, - RADIOREGS(0x73, 0x76, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0A, - 0x80, 0xFF, 0x88, 0x0C, 0x0A, 0x80), - PHYREGS(0x03CD, 0x03C9, 0x03C5, 0x0436, 0x043A, 0x043F), - }, - { .channel = 4, - .freq = 2427, /* MHz */ - .unk2 = 3236, - RADIOREGS(0x73, 0x7B, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0A, - 0x80, 0xFF, 0x88, 0x0C, 0x0A, 0x80), - PHYREGS(0x03CF, 0x03CB, 0x03C7, 0x0434, 0x0438, 0x043D), - }, - { .channel = 5, - .freq = 2432, /* MHz */ - .unk2 = 3243, - RADIOREGS(0x73, 0x80, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x09, - 0x80, 0xFF, 0x88, 0x0C, 0x09, 0x80), - PHYREGS(0x03D1, 0x03CD, 0x03C9, 0x0431, 0x0436, 0x043A), - }, - { .channel = 6, - .freq = 2437, /* MHz */ - .unk2 = 3249, - RADIOREGS(0x73, 0x85, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0B, 0x08, - 0x80, 0xFF, 0x88, 0x0B, 0x08, 0x80), - PHYREGS(0x03D3, 0x03CF, 0x03CB, 0x042F, 0x0434, 0x0438), - }, - { .channel = 7, - .freq = 2442, /* MHz */ - .unk2 = 3256, - RADIOREGS(0x73, 0x8A, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0A, 0x07, - 0x80, 0xFF, 0x88, 0x0A, 0x07, 0x80), - PHYREGS(0x03D5, 0x03D1, 0x03CD, 0x042D, 0x0431, 0x0436), - }, - { .channel = 8, - .freq = 2447, /* MHz */ - .unk2 = 3263, - RADIOREGS(0x73, 0x8F, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0A, 0x06, - 0x80, 0xFF, 0x88, 0x0A, 0x06, 0x80), - PHYREGS(0x03D7, 0x03D3, 0x03CF, 0x042B, 0x042F, 0x0434), - }, - { .channel = 9, - .freq = 2452, /* MHz */ - .unk2 = 3269, - RADIOREGS(0x73, 0x94, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x09, 0x06, - 0x80, 0xFF, 0x88, 0x09, 0x06, 0x80), - PHYREGS(0x03D9, 0x03D5, 0x03D1, 0x0429, 0x042D, 0x0431), - }, - { .channel = 10, - .freq = 2457, /* MHz */ - .unk2 = 3276, - RADIOREGS(0x73, 0x99, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x05, - 0x80, 0xFF, 0x88, 0x08, 0x05, 0x80), - PHYREGS(0x03DB, 0x03D7, 0x03D3, 0x0427, 0x042B, 0x042F), - }, - { .channel = 11, - .freq = 2462, /* MHz */ - .unk2 = 3283, - RADIOREGS(0x73, 0x9E, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x04, - 0x80, 0xFF, 0x88, 0x08, 0x04, 0x80), - PHYREGS(0x03DD, 0x03D9, 0x03D5, 0x0424, 0x0429, 0x042D), - }, - { .channel = 12, - .freq = 2467, /* MHz */ - .unk2 = 3289, - RADIOREGS(0x73, 0xA3, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x03, - 0x80, 0xFF, 0x88, 0x08, 0x03, 0x80), - PHYREGS(0x03DF, 0x03DB, 0x03D7, 0x0422, 0x0427, 0x042B), - }, - { .channel = 13, - .freq = 2472, /* MHz */ - .unk2 = 3296, - RADIOREGS(0x73, 0xA8, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x07, 0x03, - 0x80, 0xFF, 0x88, 0x07, 0x03, 0x80), - PHYREGS(0x03E1, 0x03DD, 0x03D9, 0x0420, 0x0424, 0x0429), - }, - { .channel = 14, - .freq = 2484, /* MHz */ - .unk2 = 3312, - RADIOREGS(0x73, 0xB4, 0x09, 0x0F, 0xFF, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x07, 0x01, - 0x80, 0xFF, 0x88, 0x07, 0x01, 0x80), - PHYREGS(0x03E6, 0x03E2, 0x03DE, 0x041B, 0x041F, 0x0424), - }, -}; - -void b2055_upload_inittab(struct b43_wldev *dev, - bool ghz5, bool ignore_uploadflag) -{ - const struct b2055_inittab_entry *e; - unsigned int i, writes = 0; - u16 value; - - for (i = 0; i < ARRAY_SIZE(b2055_inittab); i++) { - e = &(b2055_inittab[i]); - if (!(e->flags & B2055_INITTAB_ENTRY_OK)) - continue; - if ((e->flags & B2055_INITTAB_UPLOAD) || ignore_uploadflag) { - if (ghz5) - value = e->ghz5; - else - value = e->ghz2; - b43_radio_write16(dev, i, value); - if (++writes % 4 == 0) - b43_read32(dev, B43_MMIO_MACCTL); /* flush */ - } - } -} - -const struct b43_nphy_channeltab_entry_rev2 * -b43_nphy_get_chantabent_rev2(struct b43_wldev *dev, u8 channel) -{ - const struct b43_nphy_channeltab_entry_rev2 *e; - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(b43_nphy_channeltab_rev2); i++) { - e = &(b43_nphy_channeltab_rev2[i]); - if (e->channel == channel) - return e; - } - - return NULL; -} diff --git a/drivers/net/wireless/b43/radio_2055.h b/drivers/net/wireless/b43/radio_2055.h deleted file mode 100644 index 67f96122f8d8..000000000000 --- a/drivers/net/wireless/b43/radio_2055.h +++ /dev/null @@ -1,259 +0,0 @@ -#ifndef B43_RADIO_2055_H_ -#define B43_RADIO_2055_H_ - -#include - -#include "tables_nphy.h" - -#define B2055_GEN_SPARE 0x00 /* GEN spare */ -#define B2055_SP_PINPD 0x02 /* SP PIN PD */ -#define B2055_C1_SP_RSSI 0x03 /* SP RSSI Core 1 */ -#define B2055_C1_SP_PDMISC 0x04 /* SP PD MISC Core 1 */ -#define B2055_C2_SP_RSSI 0x05 /* SP RSSI Core 2 */ -#define B2055_C2_SP_PDMISC 0x06 /* SP PD MISC Core 2 */ -#define B2055_C1_SP_RXGC1 0x07 /* SP RX GC1 Core 1 */ -#define B2055_C1_SP_RXGC2 0x08 /* SP RX GC2 Core 1 */ -#define B2055_C2_SP_RXGC1 0x09 /* SP RX GC1 Core 2 */ -#define B2055_C2_SP_RXGC2 0x0A /* SP RX GC2 Core 2 */ -#define B2055_C1_SP_LPFBWSEL 0x0B /* SP LPF BW select Core 1 */ -#define B2055_C2_SP_LPFBWSEL 0x0C /* SP LPF BW select Core 2 */ -#define B2055_C1_SP_TXGC1 0x0D /* SP TX GC1 Core 1 */ -#define B2055_C1_SP_TXGC2 0x0E /* SP TX GC2 Core 1 */ -#define B2055_C2_SP_TXGC1 0x0F /* SP TX GC1 Core 2 */ -#define B2055_C2_SP_TXGC2 0x10 /* SP TX GC2 Core 2 */ -#define B2055_MASTER1 0x11 /* Master control 1 */ -#define B2055_MASTER2 0x12 /* Master control 2 */ -#define B2055_PD_LGEN 0x13 /* PD LGEN */ -#define B2055_PD_PLLTS 0x14 /* PD PLL TS */ -#define B2055_C1_PD_LGBUF 0x15 /* PD Core 1 LGBUF */ -#define B2055_C1_PD_TX 0x16 /* PD Core 1 TX */ -#define B2055_C1_PD_RXTX 0x17 /* PD Core 1 RXTX */ -#define B2055_C1_PD_RSSIMISC 0x18 /* PD Core 1 RSSI MISC */ -#define B2055_C2_PD_LGBUF 0x19 /* PD Core 2 LGBUF */ -#define B2055_C2_PD_TX 0x1A /* PD Core 2 TX */ -#define B2055_C2_PD_RXTX 0x1B /* PD Core 2 RXTX */ -#define B2055_C2_PD_RSSIMISC 0x1C /* PD Core 2 RSSI MISC */ -#define B2055_PWRDET_LGEN 0x1D /* PWRDET LGEN */ -#define B2055_C1_PWRDET_LGBUF 0x1E /* PWRDET LGBUF Core 1 */ -#define B2055_C1_PWRDET_RXTX 0x1F /* PWRDET RXTX Core 1 */ -#define B2055_C2_PWRDET_LGBUF 0x20 /* PWRDET LGBUF Core 2 */ -#define B2055_C2_PWRDET_RXTX 0x21 /* PWRDET RXTX Core 2 */ -#define B2055_RRCCAL_CS 0x22 /* RRCCAL Control spare */ -#define B2055_RRCCAL_NOPTSEL 0x23 /* RRCCAL N OPT SEL */ -#define B2055_CAL_MISC 0x24 /* CAL MISC */ -#define B2055_CAL_COUT 0x25 /* CAL Counter out */ -#define B2055_CAL_COUT2 0x26 /* CAL Counter out 2 */ -#define B2055_CAL_CVARCTL 0x27 /* CAL CVAR Control */ -#define B2055_CAL_RVARCTL 0x28 /* CAL RVAR Control */ -#define B2055_CAL_LPOCTL 0x29 /* CAL LPO Control */ -#define B2055_CAL_TS 0x2A /* CAL TS */ -#define B2055_CAL_RCCALRTS 0x2B /* CAL RCCAL READ TS */ -#define B2055_CAL_RCALRTS 0x2C /* CAL RCAL READ TS */ -#define B2055_PADDRV 0x2D /* PAD driver */ -#define B2055_XOCTL1 0x2E /* XO Control 1 */ -#define B2055_XOCTL2 0x2F /* XO Control 2 */ -#define B2055_XOREGUL 0x30 /* XO Regulator */ -#define B2055_XOMISC 0x31 /* XO misc */ -#define B2055_PLL_LFC1 0x32 /* PLL LF C1 */ -#define B2055_PLL_CALVTH 0x33 /* PLL CAL VTH */ -#define B2055_PLL_LFC2 0x34 /* PLL LF C2 */ -#define B2055_PLL_REF 0x35 /* PLL reference */ -#define B2055_PLL_LFR1 0x36 /* PLL LF R1 */ -#define B2055_PLL_PFDCP 0x37 /* PLL PFD CP */ -#define B2055_PLL_IDAC_CPOPAMP 0x38 /* PLL IDAC CPOPAMP */ -#define B2055_PLL_CPREG 0x39 /* PLL CP Regulator */ -#define B2055_PLL_RCAL 0x3A /* PLL RCAL */ -#define B2055_RF_PLLMOD0 0x3B /* RF PLL MOD0 */ -#define B2055_RF_PLLMOD1 0x3C /* RF PLL MOD1 */ -#define B2055_RF_MMDIDAC1 0x3D /* RF MMD IDAC 1 */ -#define B2055_RF_MMDIDAC0 0x3E /* RF MMD IDAC 0 */ -#define B2055_RF_MMDSP 0x3F /* RF MMD spare */ -#define B2055_VCO_CAL1 0x40 /* VCO cal 1 */ -#define B2055_VCO_CAL2 0x41 /* VCO cal 2 */ -#define B2055_VCO_CAL3 0x42 /* VCO cal 3 */ -#define B2055_VCO_CAL4 0x43 /* VCO cal 4 */ -#define B2055_VCO_CAL5 0x44 /* VCO cal 5 */ -#define B2055_VCO_CAL6 0x45 /* VCO cal 6 */ -#define B2055_VCO_CAL7 0x46 /* VCO cal 7 */ -#define B2055_VCO_CAL8 0x47 /* VCO cal 8 */ -#define B2055_VCO_CAL9 0x48 /* VCO cal 9 */ -#define B2055_VCO_CAL10 0x49 /* VCO cal 10 */ -#define B2055_VCO_CAL11 0x4A /* VCO cal 11 */ -#define B2055_VCO_CAL12 0x4B /* VCO cal 12 */ -#define B2055_VCO_CAL13 0x4C /* VCO cal 13 */ -#define B2055_VCO_CAL14 0x4D /* VCO cal 14 */ -#define B2055_VCO_CAL15 0x4E /* VCO cal 15 */ -#define B2055_VCO_CAL16 0x4F /* VCO cal 16 */ -#define B2055_VCO_KVCO 0x50 /* VCO KVCO */ -#define B2055_VCO_CAPTAIL 0x51 /* VCO CAP TAIL */ -#define B2055_VCO_IDACVCO 0x52 /* VCO IDAC VCO */ -#define B2055_VCO_REG 0x53 /* VCO Regulator */ -#define B2055_PLL_RFVTH 0x54 /* PLL RF VTH */ -#define B2055_LGBUF_CENBUF 0x55 /* LGBUF CEN BUF */ -#define B2055_LGEN_TUNE1 0x56 /* LGEN tune 1 */ -#define B2055_LGEN_TUNE2 0x57 /* LGEN tune 2 */ -#define B2055_LGEN_IDAC1 0x58 /* LGEN IDAC 1 */ -#define B2055_LGEN_IDAC2 0x59 /* LGEN IDAC 2 */ -#define B2055_LGEN_BIASC 0x5A /* LGEN BIAS counter */ -#define B2055_LGEN_BIASIDAC 0x5B /* LGEN BIAS IDAC */ -#define B2055_LGEN_RCAL 0x5C /* LGEN RCAL */ -#define B2055_LGEN_DIV 0x5D /* LGEN div */ -#define B2055_LGEN_SPARE2 0x5E /* LGEN spare 2 */ -#define B2055_C1_LGBUF_ATUNE 0x5F /* Core 1 LGBUF A tune */ -#define B2055_C1_LGBUF_GTUNE 0x60 /* Core 1 LGBUF G tune */ -#define B2055_C1_LGBUF_DIV 0x61 /* Core 1 LGBUF div */ -#define B2055_C1_LGBUF_AIDAC 0x62 /* Core 1 LGBUF A IDAC */ -#define B2055_C1_LGBUF_GIDAC 0x63 /* Core 1 LGBUF G IDAC */ -#define B2055_C1_LGBUF_IDACFO 0x64 /* Core 1 LGBUF IDAC filter override */ -#define B2055_C1_LGBUF_SPARE 0x65 /* Core 1 LGBUF spare */ -#define B2055_C1_RX_RFSPC1 0x66 /* Core 1 RX RF SPC1 */ -#define B2055_C1_RX_RFR1 0x67 /* Core 1 RX RF reg 1 */ -#define B2055_C1_RX_RFR2 0x68 /* Core 1 RX RF reg 2 */ -#define B2055_C1_RX_RFRCAL 0x69 /* Core 1 RX RF RCAL */ -#define B2055_C1_RX_BB_BLCMP 0x6A /* Core 1 RX Baseband BUFI LPF CMP */ -#define B2055_C1_RX_BB_LPF 0x6B /* Core 1 RX Baseband LPF */ -#define B2055_C1_RX_BB_MIDACHP 0x6C /* Core 1 RX Baseband MIDAC High-pass */ -#define B2055_C1_RX_BB_VGA1IDAC 0x6D /* Core 1 RX Baseband VGA1 IDAC */ -#define B2055_C1_RX_BB_VGA2IDAC 0x6E /* Core 1 RX Baseband VGA2 IDAC */ -#define B2055_C1_RX_BB_VGA3IDAC 0x6F /* Core 1 RX Baseband VGA3 IDAC */ -#define B2055_C1_RX_BB_BUFOCTL 0x70 /* Core 1 RX Baseband BUFO Control */ -#define B2055_C1_RX_BB_RCCALCTL 0x71 /* Core 1 RX Baseband RCCAL Control */ -#define B2055_C1_RX_BB_RSSICTL1 0x72 /* Core 1 RX Baseband RSSI Control 1 */ -#define B2055_C1_RX_BB_RSSICTL2 0x73 /* Core 1 RX Baseband RSSI Control 2 */ -#define B2055_C1_RX_BB_RSSICTL3 0x74 /* Core 1 RX Baseband RSSI Control 3 */ -#define B2055_C1_RX_BB_RSSICTL4 0x75 /* Core 1 RX Baseband RSSI Control 4 */ -#define B2055_C1_RX_BB_RSSICTL5 0x76 /* Core 1 RX Baseband RSSI Control 5 */ -#define B2055_C1_RX_BB_REG 0x77 /* Core 1 RX Baseband Regulator */ -#define B2055_C1_RX_BB_SPARE1 0x78 /* Core 1 RX Baseband spare 1 */ -#define B2055_C1_RX_TXBBRCAL 0x79 /* Core 1 RX TX BB RCAL */ -#define B2055_C1_TX_RF_SPGA 0x7A /* Core 1 TX RF SGM PGA */ -#define B2055_C1_TX_RF_SPAD 0x7B /* Core 1 TX RF SGM PAD */ -#define B2055_C1_TX_RF_CNTPGA1 0x7C /* Core 1 TX RF counter PGA 1 */ -#define B2055_C1_TX_RF_CNTPAD1 0x7D /* Core 1 TX RF counter PAD 1 */ -#define B2055_C1_TX_RF_PGAIDAC 0x7E /* Core 1 TX RF PGA IDAC */ -#define B2055_C1_TX_PGAPADTN 0x7F /* Core 1 TX PGA PAD TN */ -#define B2055_C1_TX_PADIDAC1 0x80 /* Core 1 TX PAD IDAC 1 */ -#define B2055_C1_TX_PADIDAC2 0x81 /* Core 1 TX PAD IDAC 2 */ -#define B2055_C1_TX_MXBGTRIM 0x82 /* Core 1 TX MX B/G TRIM */ -#define B2055_C1_TX_RF_RCAL 0x83 /* Core 1 TX RF RCAL */ -#define B2055_C1_TX_RF_PADTSSI1 0x84 /* Core 1 TX RF PAD TSSI1 */ -#define B2055_C1_TX_RF_PADTSSI2 0x85 /* Core 1 TX RF PAD TSSI2 */ -#define B2055_C1_TX_RF_SPARE 0x86 /* Core 1 TX RF spare */ -#define B2055_C1_TX_RF_IQCAL1 0x87 /* Core 1 TX RF I/Q CAL 1 */ -#define B2055_C1_TX_RF_IQCAL2 0x88 /* Core 1 TX RF I/Q CAL 2 */ -#define B2055_C1_TXBB_RCCAL 0x89 /* Core 1 TXBB RC CAL Control */ -#define B2055_C1_TXBB_LPF1 0x8A /* Core 1 TXBB LPF 1 */ -#define B2055_C1_TX_VOSCNCL 0x8B /* Core 1 TX VOS CNCL */ -#define B2055_C1_TX_LPF_MXGMIDAC 0x8C /* Core 1 TX LPF MXGM IDAC */ -#define B2055_C1_TX_BB_MXGM 0x8D /* Core 1 TX BB MXGM */ -#define B2055_C2_LGBUF_ATUNE 0x8E /* Core 2 LGBUF A tune */ -#define B2055_C2_LGBUF_GTUNE 0x8F /* Core 2 LGBUF G tune */ -#define B2055_C2_LGBUF_DIV 0x90 /* Core 2 LGBUF div */ -#define B2055_C2_LGBUF_AIDAC 0x91 /* Core 2 LGBUF A IDAC */ -#define B2055_C2_LGBUF_GIDAC 0x92 /* Core 2 LGBUF G IDAC */ -#define B2055_C2_LGBUF_IDACFO 0x93 /* Core 2 LGBUF IDAC filter override */ -#define B2055_C2_LGBUF_SPARE 0x94 /* Core 2 LGBUF spare */ -#define B2055_C2_RX_RFSPC1 0x95 /* Core 2 RX RF SPC1 */ -#define B2055_C2_RX_RFR1 0x96 /* Core 2 RX RF reg 1 */ -#define B2055_C2_RX_RFR2 0x97 /* Core 2 RX RF reg 2 */ -#define B2055_C2_RX_RFRCAL 0x98 /* Core 2 RX RF RCAL */ -#define B2055_C2_RX_BB_BLCMP 0x99 /* Core 2 RX Baseband BUFI LPF CMP */ -#define B2055_C2_RX_BB_LPF 0x9A /* Core 2 RX Baseband LPF */ -#define B2055_C2_RX_BB_MIDACHP 0x9B /* Core 2 RX Baseband MIDAC High-pass */ -#define B2055_C2_RX_BB_VGA1IDAC 0x9C /* Core 2 RX Baseband VGA1 IDAC */ -#define B2055_C2_RX_BB_VGA2IDAC 0x9D /* Core 2 RX Baseband VGA2 IDAC */ -#define B2055_C2_RX_BB_VGA3IDAC 0x9E /* Core 2 RX Baseband VGA3 IDAC */ -#define B2055_C2_RX_BB_BUFOCTL 0x9F /* Core 2 RX Baseband BUFO Control */ -#define B2055_C2_RX_BB_RCCALCTL 0xA0 /* Core 2 RX Baseband RCCAL Control */ -#define B2055_C2_RX_BB_RSSICTL1 0xA1 /* Core 2 RX Baseband RSSI Control 1 */ -#define B2055_C2_RX_BB_RSSICTL2 0xA2 /* Core 2 RX Baseband RSSI Control 2 */ -#define B2055_C2_RX_BB_RSSICTL3 0xA3 /* Core 2 RX Baseband RSSI Control 3 */ -#define B2055_C2_RX_BB_RSSICTL4 0xA4 /* Core 2 RX Baseband RSSI Control 4 */ -#define B2055_C2_RX_BB_RSSICTL5 0xA5 /* Core 2 RX Baseband RSSI Control 5 */ -#define B2055_C2_RX_BB_REG 0xA6 /* Core 2 RX Baseband Regulator */ -#define B2055_C2_RX_BB_SPARE1 0xA7 /* Core 2 RX Baseband spare 1 */ -#define B2055_C2_RX_TXBBRCAL 0xA8 /* Core 2 RX TX BB RCAL */ -#define B2055_C2_TX_RF_SPGA 0xA9 /* Core 2 TX RF SGM PGA */ -#define B2055_C2_TX_RF_SPAD 0xAA /* Core 2 TX RF SGM PAD */ -#define B2055_C2_TX_RF_CNTPGA1 0xAB /* Core 2 TX RF counter PGA 1 */ -#define B2055_C2_TX_RF_CNTPAD1 0xAC /* Core 2 TX RF counter PAD 1 */ -#define B2055_C2_TX_RF_PGAIDAC 0xAD /* Core 2 TX RF PGA IDAC */ -#define B2055_C2_TX_PGAPADTN 0xAE /* Core 2 TX PGA PAD TN */ -#define B2055_C2_TX_PADIDAC1 0xAF /* Core 2 TX PAD IDAC 1 */ -#define B2055_C2_TX_PADIDAC2 0xB0 /* Core 2 TX PAD IDAC 2 */ -#define B2055_C2_TX_MXBGTRIM 0xB1 /* Core 2 TX MX B/G TRIM */ -#define B2055_C2_TX_RF_RCAL 0xB2 /* Core 2 TX RF RCAL */ -#define B2055_C2_TX_RF_PADTSSI1 0xB3 /* Core 2 TX RF PAD TSSI1 */ -#define B2055_C2_TX_RF_PADTSSI2 0xB4 /* Core 2 TX RF PAD TSSI2 */ -#define B2055_C2_TX_RF_SPARE 0xB5 /* Core 2 TX RF spare */ -#define B2055_C2_TX_RF_IQCAL1 0xB6 /* Core 2 TX RF I/Q CAL 1 */ -#define B2055_C2_TX_RF_IQCAL2 0xB7 /* Core 2 TX RF I/Q CAL 2 */ -#define B2055_C2_TXBB_RCCAL 0xB8 /* Core 2 TXBB RC CAL Control */ -#define B2055_C2_TXBB_LPF1 0xB9 /* Core 2 TXBB LPF 1 */ -#define B2055_C2_TX_VOSCNCL 0xBA /* Core 2 TX VOS CNCL */ -#define B2055_C2_TX_LPF_MXGMIDAC 0xBB /* Core 2 TX LPF MXGM IDAC */ -#define B2055_C2_TX_BB_MXGM 0xBC /* Core 2 TX BB MXGM */ -#define B2055_PRG_GCHP21 0xBD /* PRG GC HPVGA23 21 */ -#define B2055_PRG_GCHP22 0xBE /* PRG GC HPVGA23 22 */ -#define B2055_PRG_GCHP23 0xBF /* PRG GC HPVGA23 23 */ -#define B2055_PRG_GCHP24 0xC0 /* PRG GC HPVGA23 24 */ -#define B2055_PRG_GCHP25 0xC1 /* PRG GC HPVGA23 25 */ -#define B2055_PRG_GCHP26 0xC2 /* PRG GC HPVGA23 26 */ -#define B2055_PRG_GCHP27 0xC3 /* PRG GC HPVGA23 27 */ -#define B2055_PRG_GCHP28 0xC4 /* PRG GC HPVGA23 28 */ -#define B2055_PRG_GCHP29 0xC5 /* PRG GC HPVGA23 29 */ -#define B2055_PRG_GCHP30 0xC6 /* PRG GC HPVGA23 30 */ -#define B2055_C1_LNA_GAINBST 0xCD /* Core 1 LNA GAINBST */ -#define B2055_C1_B0NB_RSSIVCM 0xD2 /* Core 1 B0 narrow-band RSSI VCM */ -#define B2055_C1_GENSPARE2 0xD6 /* Core 1 GEN spare 2 */ -#define B2055_C2_LNA_GAINBST 0xD9 /* Core 2 LNA GAINBST */ -#define B2055_C2_B0NB_RSSIVCM 0xDE /* Core 2 B0 narrow-band RSSI VCM */ -#define B2055_C2_GENSPARE2 0xE2 /* Core 2 GEN spare 2 */ - -struct b43_nphy_channeltab_entry_rev2 { - /* The channel number */ - u8 channel; - /* The channel frequency in MHz */ - u16 freq; - /* An unknown value */ - u16 unk2; - /* Radio register values on channelswitch */ - u8 radio_pll_ref; - u8 radio_rf_pllmod0; - u8 radio_rf_pllmod1; - u8 radio_vco_captail; - u8 radio_vco_cal1; - u8 radio_vco_cal2; - u8 radio_pll_lfc1; - u8 radio_pll_lfr1; - u8 radio_pll_lfc2; - u8 radio_lgbuf_cenbuf; - u8 radio_lgen_tune1; - u8 radio_lgen_tune2; - u8 radio_c1_lgbuf_atune; - u8 radio_c1_lgbuf_gtune; - u8 radio_c1_rx_rfr1; - u8 radio_c1_tx_pgapadtn; - u8 radio_c1_tx_mxbgtrim; - u8 radio_c2_lgbuf_atune; - u8 radio_c2_lgbuf_gtune; - u8 radio_c2_rx_rfr1; - u8 radio_c2_tx_pgapadtn; - u8 radio_c2_tx_mxbgtrim; - /* PHY register values on channelswitch */ - struct b43_phy_n_sfo_cfg phy_regs; -}; - -/* Upload the default register value table. - * If "ghz5" is true, we upload the 5Ghz table. Otherwise the 2.4Ghz - * table is uploaded. If "ignore_uploadflag" is true, we upload any value - * and ignore the "UPLOAD" flag. */ -void b2055_upload_inittab(struct b43_wldev *dev, - bool ghz5, bool ignore_uploadflag); - -/* Get the NPHY Channel Switch Table entry for a channel. - * Returns NULL on failure to find an entry. */ -const struct b43_nphy_channeltab_entry_rev2 * -b43_nphy_get_chantabent_rev2(struct b43_wldev *dev, u8 channel); - -#endif /* B43_RADIO_2055_H_ */ diff --git a/drivers/net/wireless/b43/radio_2056.c b/drivers/net/wireless/b43/radio_2056.c deleted file mode 100644 index b4fd9345d673..000000000000 --- a/drivers/net/wireless/b43/radio_2056.c +++ /dev/null @@ -1,9116 +0,0 @@ -/* - - Broadcom B43 wireless driver - IEEE 802.11n 2056 radio device data tables - - Copyright (c) 2010 Rafał Miłecki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "radio_2056.h" -#include "phy_common.h" - -struct b2056_inittab_entry { - /* Value to write if we use the 5GHz band. */ - u16 ghz5; - /* Value to write if we use the 2.4GHz band. */ - u16 ghz2; - /* Flags */ - u8 flags; -}; -#define B2056_INITTAB_ENTRY_OK 0x01 -#define B2056_INITTAB_UPLOAD 0x02 -#define UPLOAD .flags = B2056_INITTAB_ENTRY_OK | B2056_INITTAB_UPLOAD -#define NOUPLOAD .flags = B2056_INITTAB_ENTRY_OK - -struct b2056_inittabs_pts { - const struct b2056_inittab_entry *syn; - unsigned int syn_length; - const struct b2056_inittab_entry *tx; - unsigned int tx_length; - const struct b2056_inittab_entry *rx; - unsigned int rx_length; -}; - -static const struct b2056_inittab_entry b2056_inittab_rev3_syn[] = { - [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_PU] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_GPIO_MASTER1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_GPIO_MASTER2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TOPBIAS_MASTER] = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, }, - [B2056_SYN_TOPBIAS_RCAL] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_AFEREG] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSE] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSEIDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSERCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LPO] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_VDDCAL_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_VDDCAL_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_VDDCAL_STATUS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCAL_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCAL_CODE_OUT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL0] = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL1] = { .ghz5 = 0x001f, .ghz2 = 0x001f, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL2] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL3] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_ZCAL_SPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_ZCAL_SPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_MAST1] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_SYN_PLL_MAST2] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_PLL_MAST3] = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, }, - [B2056_SYN_PLL_BIAS_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL1] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL3] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL5] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL6] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_SYN_PLL_REFDIV] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_PLL_PFD] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_CP1] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_PLL_CP2] = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, }, - [B2056_SYN_PLL_CP3] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER1] = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER2] = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER3] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER4] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER5] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_PLL_MMD1] = { .ghz5 = 0x001c, .ghz2 = 0x001c, NOUPLOAD, }, - [B2056_SYN_PLL_MMD2] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCO1] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCO2] = { .ghz5 = 0x00f7, .ghz2 = 0x00f7, UPLOAD, }, - [B2056_SYN_PLL_MONITOR1] = { .ghz5 = 0x00b4, .ghz2 = 0x00b4, NOUPLOAD, }, - [B2056_SYN_PLL_MONITOR2] = { .ghz5 = 0x00d2, .ghz2 = 0x00d2, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL4] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL5] = { .ghz5 = 0x0096, .ghz2 = 0x0096, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL6] = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL7] = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL8] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL9] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL11] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL12] = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, }, - [B2056_SYN_PLL_VCOCAL13] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_SYN_PLL_VREG] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU2] = { .ghz5 = 0x0040, .ghz2 = 0x0040, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU8] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_LOGEN_BIAS_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RCCR1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF1] = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER1] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER2] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF1] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGENBUF2] = { .ghz5 = 0x008f, .ghz2 = 0x008f, UPLOAD, }, - [B2056_SYN_LOGEN_BUF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF4] = { .ghz5 = 0x00cc, .ghz2 = 0x00cc, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV1] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV2] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV3] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLOUT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_CALEN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PEAKDET1] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, NOUPLOAD, }, - [B2056_SYN_LOGEN_CORE_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_DIFF_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_DIFF_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_CMOS_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_CMOS_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF2_OVRVAL]= { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER3_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF5_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF6_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL_WAITCNT] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_SYN_LOGEN_CORE_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_CMOS_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev3_tx[] = { - [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_IQCAL_GAIN_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_LOFT_FINE_I] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_FINE_Q] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_COARSE_I] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_COARSE_Q] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_TX_COM_MASTER1] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_TX_COM_MASTER2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RXIQCAL_TXMUX] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_TX_SSI_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_IQCAL_VCM_HG] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_IQCAL_IDAC] = { .ghz5 = 0x0037, .ghz2 = 0x0037, NOUPLOAD, }, - [B2056_TX_TSSI_VCM] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_TX_AMP_DET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TX_SSI_MUX] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSIA] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_TSSIG] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_TSSI_MISC1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSI_MISC2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSI_MISC3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PA_SPARE1] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_TX_PA_SPARE2] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_TX_INTPAA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_BOOST_TUNE] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAA_IAUX_STAT] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_TX_INTPAA_IAUX_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_IMAIN_STAT] = { .ghz5 = 0x002d, .ghz2 = 0x002d, NOUPLOAD, }, - [B2056_TX_INTPAA_IMAIN_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_CASCBIAS] = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, }, - [B2056_TX_INTPAA_PASLOPE] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_TX_INTPAA_PA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_BOOST_TUNE] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAG_IAUX_STAT] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAG_IAUX_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_IMAIN_STAT] = { .ghz5 = 0x001e, .ghz2 = 0x001e, NOUPLOAD, }, - [B2056_TX_INTPAG_IMAIN_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_CASCBIAS] = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, }, - [B2056_TX_INTPAG_PASLOPE] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_TX_INTPAG_PA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADA_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PADA_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_TX_PADA_CASCBIAS] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_PADA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADA_BOOST_TUNE] = { .ghz5 = 0x0038, .ghz2 = 0x0038, NOUPLOAD, }, - [B2056_TX_PADA_SLOPE] = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, }, - [B2056_TX_PADG_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PADG_IDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_PADG_CASCBIAS] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_PADG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADG_BOOST_TUNE] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_TX_PADG_SLOPE] = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, }, - [B2056_TX_PGAA_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PGAA_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_TX_PGAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAA_BOOST_TUNE] = { .ghz5 = 0x0083, .ghz2 = 0x0083, NOUPLOAD, }, - [B2056_TX_PGAA_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, }, - [B2056_TX_PGAA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAG_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PGAG_IDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_PGAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAG_BOOST_TUNE] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_TX_PGAG_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, }, - [B2056_TX_PGAG_MISC] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_MIXA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_MIXA_BOOST_TUNE] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_TX_MIXG] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_MIXG_BOOST_TUNE] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_TX_BB_GM_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_GM] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC] = { .ghz5 = 0x0074, .ghz2 = 0x0074, UPLOAD, }, - [B2056_TX_TXLPF_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_BW] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_0] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_1] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_2] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_3] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_4] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_5] = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_6] = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, }, - [B2056_TX_TXLPF_OPAMP_IDAC] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_TX_TXLPF_MISC] = { .ghz5 = 0x005b, .ghz2 = 0x005b, NOUPLOAD, }, - [B2056_TX_TXSPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE12] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE13] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE14] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE15] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_INTPA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_PAD_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_PGA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_GM_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_TXLPF_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_TXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev3_rx[] = { - [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXIQCAL_RXMUX] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_RX_RSSI_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RSSI_SEL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RSSI_GAIN] = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, }, - [B2056_RX_RSSI_NB_IDAC] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_RX_RSSI_WB2I_IDAC_1] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_RX_RSSI_WB2I_IDAC_2] = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, }, - [B2056_RX_RSSI_WB2Q_IDAC_1] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_RX_RSSI_WB2Q_IDAC_2] = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, }, - [B2056_RX_RSSI_POLE] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_RSSI_WB1_IDAC] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_RX_RSSI_MISC] = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, }, - [B2056_RX_LNAA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_LNAA_TUNE] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_RX_LNAA_GAIN] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_RX_LNA_A_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_RX_BIASPOLE_LNAA1_IDAC] = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, }, - [B2056_RX_LNAA2_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_RX_LNA1A_MISC] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_LNAG_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_LNAG_TUNE] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_RX_LNAG_GAIN] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_RX_LNA_G_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_RX_BIASPOLE_LNAG1_IDAC] = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, }, - [B2056_RX_LNAG2_IDAC] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_RX_LNA1G_MISC] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_MIXA_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_MIXA_VCM] = { .ghz5 = 0x0099, .ghz2 = 0x0099, NOUPLOAD, }, - [B2056_RX_MIXA_CTRLPTAT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXA_LOB_BIAS] = { .ghz5 = 0x0044, .ghz2 = 0x0044, UPLOAD, }, - [B2056_RX_MIXA_CORE_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXA_CMFB_IDAC] = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, }, - [B2056_RX_MIXA_BIAS_AUX] = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, }, - [B2056_RX_MIXA_BIAS_MAIN] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_RX_MIXA_BIAS_MISC] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_RX_MIXA_MAST_BIAS] = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, }, - [B2056_RX_MIXG_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_MIXG_VCM] = { .ghz5 = 0x0099, .ghz2 = 0x0099, NOUPLOAD, }, - [B2056_RX_MIXG_CTRLPTAT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_LOB_BIAS] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_RX_MIXG_CORE_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_CMFB_IDAC] = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_AUX] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_MAIN] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_MISC] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_RX_MIXG_MAST_BIAS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_IOPAMP] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_RX_TIA_QOPAMP] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_RX_TIA_IMISC] = { .ghz5 = 0x0057, .ghz2 = 0x0057, NOUPLOAD, }, - [B2056_RX_TIA_QMISC] = { .ghz5 = 0x0057, .ghz2 = 0x0057, NOUPLOAD, }, - [B2056_RX_TIA_GAIN] = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, }, - [B2056_RX_TIA_SPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_SPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_BB_LPF_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_AACI_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_RXLPF_IDAC] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_RXLPF_OPAMPBIAS_LOWQ] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_RXLPF_OPAMPBIAS_HIGHQ]= { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_RXLPF_BIAS_DCCANCEL] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_RX_RXLPF_OUTVCM] = { .ghz5 = 0x0023, .ghz2 = 0x0023, NOUPLOAD, }, - [B2056_RX_RXLPF_INVCM_BODY] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_RXLPF_CC_OP] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_RX_RXLPF_GAIN] = { .ghz5 = 0x0023, .ghz2 = 0x0023, NOUPLOAD, }, - [B2056_RX_RXLPF_Q_BW] = { .ghz5 = 0x0041, .ghz2 = 0x0041, NOUPLOAD, }, - [B2056_RX_RXLPF_HP_CORNER_BW] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_RX_RXLPF_RCCAL_HPC] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_RCCAL_LPC] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_UNUSED] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_VGA_MASTER] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGA_BIAS] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGA_BIAS_DCCANCEL] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_RX_VGA_GAIN] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_RX_VGA_HP_CORNER_BW] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_RX_VGABUF_BIAS] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGABUF_GAIN_BW] = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, }, - [B2056_RX_TXFBMIX_A] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TXFBMIX_G] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE12] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE13] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE14] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE15] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_LNAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_LNAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_MIXTIA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_VGA_BUF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_Q] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_BUF_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_VGA_HPC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev4_syn[] = { - [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_PU] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_GPIO_MASTER1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_GPIO_MASTER2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TOPBIAS_MASTER] = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, }, - [B2056_SYN_TOPBIAS_RCAL] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_AFEREG] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSE] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSEIDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSERCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LPO] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_VDDCAL_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_VDDCAL_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_VDDCAL_STATUS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCAL_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCAL_CODE_OUT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL0] = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL1] = { .ghz5 = 0x001f, .ghz2 = 0x001f, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL2] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL3] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_ZCAL_SPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_ZCAL_SPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_MAST1] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_SYN_PLL_MAST2] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_PLL_MAST3] = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, }, - [B2056_SYN_PLL_BIAS_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL1] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL3] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL5] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL6] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_SYN_PLL_REFDIV] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_PLL_PFD] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_CP1] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_PLL_CP2] = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, }, - [B2056_SYN_PLL_CP3] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER1] = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER2] = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER3] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER4] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER5] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_PLL_MMD1] = { .ghz5 = 0x001c, .ghz2 = 0x001c, NOUPLOAD, }, - [B2056_SYN_PLL_MMD2] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCO1] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCO2] = { .ghz5 = 0x00f7, .ghz2 = 0x00f7, UPLOAD, }, - [B2056_SYN_PLL_MONITOR1] = { .ghz5 = 0x00b4, .ghz2 = 0x00b4, NOUPLOAD, }, - [B2056_SYN_PLL_MONITOR2] = { .ghz5 = 0x00d2, .ghz2 = 0x00d2, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL4] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL5] = { .ghz5 = 0x0096, .ghz2 = 0x0096, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL6] = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL7] = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL8] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL9] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL11] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL12] = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, }, - [B2056_SYN_PLL_VCOCAL13] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_SYN_PLL_VREG] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU2] = { .ghz5 = 0x0040, .ghz2 = 0x0040, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU8] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_LOGEN_BIAS_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RCCR1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF1] = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER1] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER2] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF1] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGENBUF2] = { .ghz5 = 0x008f, .ghz2 = 0x008f, UPLOAD, }, - [B2056_SYN_LOGEN_BUF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF4] = { .ghz5 = 0x00cc, .ghz2 = 0x00cc, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV1] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV2] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV3] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLOUT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_CALEN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PEAKDET1] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, NOUPLOAD, }, - [B2056_SYN_LOGEN_CORE_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_DIFF_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_DIFF_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_CMOS_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_CMOS_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF2_OVRVAL]= { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER3_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF5_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF6_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL_WAITCNT] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_SYN_LOGEN_CORE_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_CMOS_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev4_tx[] = { - [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_IQCAL_GAIN_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_LOFT_FINE_I] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_FINE_Q] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_COARSE_I] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_COARSE_Q] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_TX_COM_MASTER1] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_TX_COM_MASTER2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RXIQCAL_TXMUX] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_TX_SSI_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_IQCAL_VCM_HG] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_IQCAL_IDAC] = { .ghz5 = 0x0037, .ghz2 = 0x0037, NOUPLOAD, }, - [B2056_TX_TSSI_VCM] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_TX_AMP_DET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TX_SSI_MUX] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSIA] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_TSSIG] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_TSSI_MISC1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSI_MISC2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSI_MISC3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PA_SPARE1] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_TX_PA_SPARE2] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_TX_INTPAA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_BOOST_TUNE] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAA_IAUX_STAT] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_TX_INTPAA_IAUX_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_IMAIN_STAT] = { .ghz5 = 0x002d, .ghz2 = 0x002d, NOUPLOAD, }, - [B2056_TX_INTPAA_IMAIN_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_CASCBIAS] = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, }, - [B2056_TX_INTPAA_PASLOPE] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_TX_INTPAA_PA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_BOOST_TUNE] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAG_IAUX_STAT] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAG_IAUX_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_IMAIN_STAT] = { .ghz5 = 0x001e, .ghz2 = 0x001e, NOUPLOAD, }, - [B2056_TX_INTPAG_IMAIN_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_CASCBIAS] = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, }, - [B2056_TX_INTPAG_PASLOPE] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_TX_INTPAG_PA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADA_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PADA_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_TX_PADA_CASCBIAS] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_PADA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADA_BOOST_TUNE] = { .ghz5 = 0x0038, .ghz2 = 0x0038, NOUPLOAD, }, - [B2056_TX_PADA_SLOPE] = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, }, - [B2056_TX_PADG_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PADG_IDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_PADG_CASCBIAS] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_PADG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADG_BOOST_TUNE] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_TX_PADG_SLOPE] = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, }, - [B2056_TX_PGAA_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PGAA_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_TX_PGAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAA_BOOST_TUNE] = { .ghz5 = 0x0083, .ghz2 = 0x0083, NOUPLOAD, }, - [B2056_TX_PGAA_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, }, - [B2056_TX_PGAA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAG_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PGAG_IDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_PGAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAG_BOOST_TUNE] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_TX_PGAG_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, }, - [B2056_TX_PGAG_MISC] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_MIXA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_MIXA_BOOST_TUNE] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_TX_MIXG] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_MIXG_BOOST_TUNE] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_TX_BB_GM_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_GM] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC] = { .ghz5 = 0x0072, .ghz2 = 0x0072, UPLOAD, }, - [B2056_TX_TXLPF_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_BW] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_0] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_1] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_2] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_3] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_4] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_5] = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_6] = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, }, - [B2056_TX_TXLPF_OPAMP_IDAC] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_TX_TXLPF_MISC] = { .ghz5 = 0x005b, .ghz2 = 0x005b, NOUPLOAD, }, - [B2056_TX_TXSPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE12] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE13] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE14] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE15] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_INTPA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_PAD_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_PGA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_GM_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_TXLPF_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_TXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev4_rx[] = { - [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXIQCAL_RXMUX] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_RX_RSSI_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RSSI_SEL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RSSI_GAIN] = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, }, - [B2056_RX_RSSI_NB_IDAC] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_RX_RSSI_WB2I_IDAC_1] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_RX_RSSI_WB2I_IDAC_2] = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, }, - [B2056_RX_RSSI_WB2Q_IDAC_1] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_RX_RSSI_WB2Q_IDAC_2] = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, }, - [B2056_RX_RSSI_POLE] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_RSSI_WB1_IDAC] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_RX_RSSI_MISC] = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, }, - [B2056_RX_LNAA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_LNAA_TUNE] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_RX_LNAA_GAIN] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_RX_LNA_A_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_RX_BIASPOLE_LNAA1_IDAC] = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, }, - [B2056_RX_LNAA2_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_RX_LNA1A_MISC] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_LNAG_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_LNAG_TUNE] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_RX_LNAG_GAIN] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_RX_LNA_G_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_RX_BIASPOLE_LNAG1_IDAC] = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, }, - [B2056_RX_LNAG2_IDAC] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_RX_LNA1G_MISC] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_MIXA_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_MIXA_VCM] = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, }, - [B2056_RX_MIXA_CTRLPTAT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXA_LOB_BIAS] = { .ghz5 = 0x0044, .ghz2 = 0x0044, UPLOAD, }, - [B2056_RX_MIXA_CORE_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXA_CMFB_IDAC] = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, }, - [B2056_RX_MIXA_BIAS_AUX] = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, }, - [B2056_RX_MIXA_BIAS_MAIN] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_RX_MIXA_BIAS_MISC] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_RX_MIXA_MAST_BIAS] = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, }, - [B2056_RX_MIXG_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_MIXG_VCM] = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, }, - [B2056_RX_MIXG_CTRLPTAT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_LOB_BIAS] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_RX_MIXG_CORE_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_CMFB_IDAC] = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_AUX] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_MAIN] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_MISC] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_RX_MIXG_MAST_BIAS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_IOPAMP] = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, }, - [B2056_RX_TIA_QOPAMP] = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, }, - [B2056_RX_TIA_IMISC] = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, }, - [B2056_RX_TIA_QMISC] = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, }, - [B2056_RX_TIA_GAIN] = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, }, - [B2056_RX_TIA_SPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_SPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_BB_LPF_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_AACI_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_RXLPF_IDAC] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_RXLPF_OPAMPBIAS_LOWQ] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_RXLPF_OPAMPBIAS_HIGHQ]= { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_RXLPF_BIAS_DCCANCEL] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_RX_RXLPF_OUTVCM] = { .ghz5 = 0x002f, .ghz2 = 0x002f, UPLOAD, }, - [B2056_RX_RXLPF_INVCM_BODY] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_RXLPF_CC_OP] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_RX_RXLPF_GAIN] = { .ghz5 = 0x0023, .ghz2 = 0x0023, NOUPLOAD, }, - [B2056_RX_RXLPF_Q_BW] = { .ghz5 = 0x0041, .ghz2 = 0x0041, NOUPLOAD, }, - [B2056_RX_RXLPF_HP_CORNER_BW] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_RX_RXLPF_RCCAL_HPC] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_RCCAL_LPC] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_UNUSED] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_VGA_MASTER] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGA_BIAS] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGA_BIAS_DCCANCEL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, - [B2056_RX_VGA_GAIN] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_RX_VGA_HP_CORNER_BW] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_RX_VGABUF_BIAS] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGABUF_GAIN_BW] = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, }, - [B2056_RX_TXFBMIX_A] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TXFBMIX_G] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE12] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE13] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE14] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE15] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_LNAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_LNAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_MIXTIA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_VGA_BUF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_Q] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_BUF_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_VGA_HPC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev5_syn[] = { - [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_PU] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_GPIO_MASTER1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_GPIO_MASTER2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TOPBIAS_MASTER] = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, }, - [B2056_SYN_TOPBIAS_RCAL] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_AFEREG] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSE] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSEIDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSERCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LPO] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_VDDCAL_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_VDDCAL_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_VDDCAL_STATUS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCAL_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCAL_CODE_OUT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL1] = { .ghz5 = 0x001f, .ghz2 = 0x001f, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL2] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL3] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_ZCAL_SPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_ZCAL_SPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_MAST1] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_SYN_PLL_MAST2] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_PLL_MAST3] = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, }, - [B2056_SYN_PLL_BIAS_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL1] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL3] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL5] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL6] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_SYN_PLL_REFDIV] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_PLL_PFD] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_CP1] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_PLL_CP2] = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, }, - [B2056_SYN_PLL_CP3] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER1] = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER2] = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER3] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER4] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER5] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_PLL_MMD1] = { .ghz5 = 0x001c, .ghz2 = 0x001c, NOUPLOAD, }, - [B2056_SYN_PLL_MMD2] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCO1] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCO2] = { .ghz5 = 0x00f7, .ghz2 = 0x00f7, UPLOAD, }, - [B2056_SYN_PLL_MONITOR1] = { .ghz5 = 0x00b4, .ghz2 = 0x00b4, NOUPLOAD, }, - [B2056_SYN_PLL_MONITOR2] = { .ghz5 = 0x00d2, .ghz2 = 0x00d2, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL4] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL5] = { .ghz5 = 0x0096, .ghz2 = 0x0096, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL6] = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL7] = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL8] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL9] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL11] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL12] = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, }, - [B2056_SYN_PLL_VCOCAL13] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_SYN_PLL_VREG] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU2] = { .ghz5 = 0x0040, .ghz2 = 0x0040, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU8] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_LOGEN_BIAS_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RCCR1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF1] = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER1] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER2] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF1] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGENBUF2] = { .ghz5 = 0x008f, .ghz2 = 0x008f, UPLOAD, }, - [B2056_SYN_LOGEN_BUF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF4] = { .ghz5 = 0x00cc, .ghz2 = 0x00cc, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV1] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV2] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV3] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLOUT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_CALEN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PEAKDET1] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, NOUPLOAD, }, - [B2056_SYN_LOGEN_CORE_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_DIFF_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_DIFF_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_CMOS_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_CMOS_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF2_OVRVAL]= { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER3_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF5_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF6_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL_WAITCNT] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_SYN_LOGEN_CORE_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_CMOS_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev5_tx[] = { - [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_IQCAL_GAIN_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_LOFT_FINE_I] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_FINE_Q] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_COARSE_I] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_COARSE_Q] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_TX_COM_MASTER1] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_TX_COM_MASTER2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RXIQCAL_TXMUX] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_TX_SSI_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_IQCAL_VCM_HG] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_IQCAL_IDAC] = { .ghz5 = 0x0037, .ghz2 = 0x0037, NOUPLOAD, }, - [B2056_TX_TSSI_VCM] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_TX_AMP_DET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TX_SSI_MUX] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSIA] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_TSSIG] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_TSSI_MISC1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSI_MISC2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSI_MISC3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PA_SPARE1] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_TX_PA_SPARE2] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_TX_INTPAA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_BOOST_TUNE] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAA_IAUX_STAT] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_TX_INTPAA_IAUX_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_IMAIN_STAT] = { .ghz5 = 0x002d, .ghz2 = 0x002d, NOUPLOAD, }, - [B2056_TX_INTPAA_IMAIN_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_CASCBIAS] = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, }, - [B2056_TX_INTPAA_PASLOPE] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_TX_INTPAA_PA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_BOOST_TUNE] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAG_IAUX_STAT] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAG_IAUX_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_IMAIN_STAT] = { .ghz5 = 0x001e, .ghz2 = 0x001e, NOUPLOAD, }, - [B2056_TX_INTPAG_IMAIN_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_CASCBIAS] = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, }, - [B2056_TX_INTPAG_PASLOPE] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_TX_INTPAG_PA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADA_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PADA_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_TX_PADA_CASCBIAS] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_PADA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADA_BOOST_TUNE] = { .ghz5 = 0x0038, .ghz2 = 0x0038, NOUPLOAD, }, - [B2056_TX_PADA_SLOPE] = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, }, - [B2056_TX_PADG_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PADG_IDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_PADG_CASCBIAS] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_PADG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADG_BOOST_TUNE] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_TX_PADG_SLOPE] = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, }, - [B2056_TX_PGAA_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PGAA_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_TX_PGAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAA_BOOST_TUNE] = { .ghz5 = 0x0083, .ghz2 = 0x0083, NOUPLOAD, }, - [B2056_TX_PGAA_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, }, - [B2056_TX_PGAA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAG_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PGAG_IDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_PGAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAG_BOOST_TUNE] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_TX_PGAG_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, }, - [B2056_TX_PGAG_MISC] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_MIXA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_MIXA_BOOST_TUNE] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_TX_MIXG] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_MIXG_BOOST_TUNE] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_TX_BB_GM_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_GM] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, - [B2056_TX_TXLPF_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_BW] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_0] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_1] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_2] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_3] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_4] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_5] = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_6] = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, }, - [B2056_TX_TXLPF_OPAMP_IDAC] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_TX_TXLPF_MISC] = { .ghz5 = 0x005b, .ghz2 = 0x005b, NOUPLOAD, }, - [B2056_TX_TXSPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE12] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE13] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE14] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE15] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_INTPA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_PAD_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_PGA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_GM_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_TXLPF_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_TXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC0] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC1] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC2] = { .ghz5 = 0x0071, .ghz2 = 0x0071, UPLOAD, }, - [B2056_TX_GMBB_IDAC3] = { .ghz5 = 0x0071, .ghz2 = 0x0071, UPLOAD, }, - [B2056_TX_GMBB_IDAC4] = { .ghz5 = 0x0072, .ghz2 = 0x0072, UPLOAD, }, - [B2056_TX_GMBB_IDAC5] = { .ghz5 = 0x0073, .ghz2 = 0x0073, UPLOAD, }, - [B2056_TX_GMBB_IDAC6] = { .ghz5 = 0x0074, .ghz2 = 0x0074, UPLOAD, }, - [B2056_TX_GMBB_IDAC7] = { .ghz5 = 0x0075, .ghz2 = 0x0075, UPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev5_rx[] = { - [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXIQCAL_RXMUX] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_RX_RSSI_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RSSI_SEL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RSSI_GAIN] = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, }, - [B2056_RX_RSSI_NB_IDAC] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_RX_RSSI_WB2I_IDAC_1] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_RX_RSSI_WB2I_IDAC_2] = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, }, - [B2056_RX_RSSI_WB2Q_IDAC_1] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_RX_RSSI_WB2Q_IDAC_2] = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, }, - [B2056_RX_RSSI_POLE] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_RSSI_WB1_IDAC] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_RX_RSSI_MISC] = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, }, - [B2056_RX_LNAA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_LNAA_TUNE] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_RX_LNAA_GAIN] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_RX_LNA_A_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_RX_BIASPOLE_LNAA1_IDAC] = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, }, - [B2056_RX_LNAA2_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_RX_LNA1A_MISC] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_LNAG_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_LNAG_TUNE] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_RX_LNAG_GAIN] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_RX_LNA_G_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_RX_BIASPOLE_LNAG1_IDAC] = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, }, - [B2056_RX_LNAG2_IDAC] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_RX_LNA1G_MISC] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_MIXA_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_MIXA_VCM] = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, }, - [B2056_RX_MIXA_CTRLPTAT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXA_LOB_BIAS] = { .ghz5 = 0x0088, .ghz2 = 0x0088, UPLOAD, }, - [B2056_RX_MIXA_CORE_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXA_CMFB_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, - [B2056_RX_MIXA_BIAS_AUX] = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, }, - [B2056_RX_MIXA_BIAS_MAIN] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_RX_MIXA_BIAS_MISC] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_RX_MIXA_MAST_BIAS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_MIXG_VCM] = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, }, - [B2056_RX_MIXG_CTRLPTAT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_LOB_BIAS] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_RX_MIXG_CORE_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_CMFB_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, - [B2056_RX_MIXG_BIAS_AUX] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_MAIN] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_MISC] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_RX_MIXG_MAST_BIAS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_IOPAMP] = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, }, - [B2056_RX_TIA_QOPAMP] = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, }, - [B2056_RX_TIA_IMISC] = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, }, - [B2056_RX_TIA_QMISC] = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, }, - [B2056_RX_TIA_GAIN] = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, }, - [B2056_RX_TIA_SPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_SPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_BB_LPF_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_AACI_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_RXLPF_IDAC] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_RXLPF_OPAMPBIAS_LOWQ] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_RXLPF_OPAMPBIAS_HIGHQ]= { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_RXLPF_BIAS_DCCANCEL] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_RX_RXLPF_OUTVCM] = { .ghz5 = 0x0004, .ghz2 = 0x0004, UPLOAD, }, - [B2056_RX_RXLPF_INVCM_BODY] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_RXLPF_CC_OP] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_RX_RXLPF_GAIN] = { .ghz5 = 0x0023, .ghz2 = 0x0023, NOUPLOAD, }, - [B2056_RX_RXLPF_Q_BW] = { .ghz5 = 0x0041, .ghz2 = 0x0041, NOUPLOAD, }, - [B2056_RX_RXLPF_HP_CORNER_BW] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_RX_RXLPF_RCCAL_HPC] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_RCCAL_LPC] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_UNUSED] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_VGA_MASTER] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGA_BIAS] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGA_BIAS_DCCANCEL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, - [B2056_RX_VGA_GAIN] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_RX_VGA_HP_CORNER_BW] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_RX_VGABUF_BIAS] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGABUF_GAIN_BW] = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, }, - [B2056_RX_TXFBMIX_A] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TXFBMIX_G] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE12] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE13] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE14] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE15] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_LNAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_LNAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_MIXTIA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_VGA_BUF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_Q] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_BUF_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_VGA_HPC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev6_syn[] = { - [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_PU] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_GPIO_MASTER1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_GPIO_MASTER2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TOPBIAS_MASTER] = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, }, - [B2056_SYN_TOPBIAS_RCAL] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_AFEREG] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSE] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSEIDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSERCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LPO] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_VDDCAL_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_VDDCAL_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_VDDCAL_STATUS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCAL_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCAL_CODE_OUT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL1] = { .ghz5 = 0x001f, .ghz2 = 0x001f, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL2] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL3] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_ZCAL_SPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_ZCAL_SPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_MAST1] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_SYN_PLL_MAST2] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_PLL_MAST3] = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, }, - [B2056_SYN_PLL_BIAS_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL1] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL3] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL5] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL6] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_SYN_PLL_REFDIV] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_PLL_PFD] = { .ghz5 = 0x0006, .ghz2 = 0x0006, UPLOAD, }, - [B2056_SYN_PLL_CP1] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_PLL_CP2] = { .ghz5 = 0x003f, .ghz2 = 0x003f, UPLOAD, }, - [B2056_SYN_PLL_CP3] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER1] = { .ghz5 = 0x0006, .ghz2 = 0x0006, UPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER2] = { .ghz5 = 0x0006, .ghz2 = 0x0006, UPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER3] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER4] = { .ghz5 = 0x002b, .ghz2 = 0x002b, UPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER5] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_PLL_MMD1] = { .ghz5 = 0x001c, .ghz2 = 0x001c, NOUPLOAD, }, - [B2056_SYN_PLL_MMD2] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCO1] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCO2] = { .ghz5 = 0x00f7, .ghz2 = 0x00f7, UPLOAD, }, - [B2056_SYN_PLL_MONITOR1] = { .ghz5 = 0x00b4, .ghz2 = 0x00b4, NOUPLOAD, }, - [B2056_SYN_PLL_MONITOR2] = { .ghz5 = 0x00d2, .ghz2 = 0x00d2, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL4] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL5] = { .ghz5 = 0x0096, .ghz2 = 0x0096, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL6] = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL7] = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL8] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL9] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL11] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL12] = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, }, - [B2056_SYN_PLL_VCOCAL13] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_SYN_PLL_VREG] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU2] = { .ghz5 = 0x0040, .ghz2 = 0x0040, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU8] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_LOGEN_BIAS_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RCCR1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF1] = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER1] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER2] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF1] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGENBUF2] = { .ghz5 = 0x008f, .ghz2 = 0x008f, UPLOAD, }, - [B2056_SYN_LOGEN_BUF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF4] = { .ghz5 = 0x00cc, .ghz2 = 0x00cc, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV1] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV2] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV3] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLOUT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_CALEN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PEAKDET1] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, NOUPLOAD, }, - [B2056_SYN_LOGEN_CORE_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_DIFF_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_DIFF_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_CMOS_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_CMOS_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF2_OVRVAL]= { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER3_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF5_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF6_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL_WAITCNT] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_SYN_LOGEN_CORE_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_CMOS_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev6_tx[] = { - [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_IQCAL_GAIN_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_LOFT_FINE_I] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_FINE_Q] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_COARSE_I] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_COARSE_Q] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_TX_COM_MASTER1] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_TX_COM_MASTER2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RXIQCAL_TXMUX] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_TX_SSI_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_IQCAL_VCM_HG] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_IQCAL_IDAC] = { .ghz5 = 0x0037, .ghz2 = 0x0037, NOUPLOAD, }, - [B2056_TX_TSSI_VCM] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_TX_AMP_DET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TX_SSI_MUX] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSIA] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_TSSIG] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_TSSI_MISC1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSI_MISC2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSI_MISC3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PA_SPARE1] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_TX_PA_SPARE2] = { .ghz5 = 0x00ee, .ghz2 = 0x00ee, UPLOAD, }, - [B2056_TX_INTPAA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_BOOST_TUNE] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAA_IAUX_STAT] = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, }, - [B2056_TX_INTPAA_IAUX_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_IMAIN_STAT] = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, }, - [B2056_TX_INTPAA_IMAIN_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_CASCBIAS] = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, }, - [B2056_TX_INTPAA_PASLOPE] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_TX_INTPAA_PA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_BOOST_TUNE] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAG_IAUX_STAT] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAG_IAUX_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_IMAIN_STAT] = { .ghz5 = 0x001e, .ghz2 = 0x001e, NOUPLOAD, }, - [B2056_TX_INTPAG_IMAIN_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_CASCBIAS] = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, }, - [B2056_TX_INTPAG_PASLOPE] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_TX_INTPAG_PA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADA_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PADA_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_TX_PADA_CASCBIAS] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_PADA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADA_BOOST_TUNE] = { .ghz5 = 0x0038, .ghz2 = 0x0038, NOUPLOAD, }, - [B2056_TX_PADA_SLOPE] = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, }, - [B2056_TX_PADG_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PADG_IDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_PADG_CASCBIAS] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_PADG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADG_BOOST_TUNE] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_TX_PADG_SLOPE] = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, }, - [B2056_TX_PGAA_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PGAA_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_TX_PGAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAA_BOOST_TUNE] = { .ghz5 = 0x0083, .ghz2 = 0x0083, NOUPLOAD, }, - [B2056_TX_PGAA_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, }, - [B2056_TX_PGAA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAG_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PGAG_IDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_PGAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAG_BOOST_TUNE] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_TX_PGAG_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, }, - [B2056_TX_PGAG_MISC] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_MIXA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_MIXA_BOOST_TUNE] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_TX_MIXG] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_MIXG_BOOST_TUNE] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_TX_BB_GM_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_GM] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, - [B2056_TX_TXLPF_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_BW] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_0] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_1] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_2] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_3] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_4] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_5] = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_6] = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, }, - [B2056_TX_TXLPF_OPAMP_IDAC] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_TX_TXLPF_MISC] = { .ghz5 = 0x005b, .ghz2 = 0x005b, NOUPLOAD, }, - [B2056_TX_TXSPARE1] = { .ghz5 = 0x0030, .ghz2 = 0x0030, UPLOAD, }, - [B2056_TX_TXSPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE12] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE13] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE14] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE15] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_INTPA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_PAD_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_PGA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_GM_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_TXLPF_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_TXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC0] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC1] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC2] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC3] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC4] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC5] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC6] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC7] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev6_rx[] = { - [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXIQCAL_RXMUX] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_RX_RSSI_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RSSI_SEL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RSSI_GAIN] = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, }, - [B2056_RX_RSSI_NB_IDAC] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_RX_RSSI_WB2I_IDAC_1] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_RX_RSSI_WB2I_IDAC_2] = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, }, - [B2056_RX_RSSI_WB2Q_IDAC_1] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_RX_RSSI_WB2Q_IDAC_2] = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, }, - [B2056_RX_RSSI_POLE] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_RSSI_WB1_IDAC] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_RX_RSSI_MISC] = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, }, - [B2056_RX_LNAA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_LNAA_TUNE] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_RX_LNAA_GAIN] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_RX_LNA_A_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_RX_BIASPOLE_LNAA1_IDAC] = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, }, - [B2056_RX_LNAA2_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_RX_LNA1A_MISC] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_LNAG_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_LNAG_TUNE] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_RX_LNAG_GAIN] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_RX_LNA_G_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_RX_BIASPOLE_LNAG1_IDAC] = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, }, - [B2056_RX_LNAG2_IDAC] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_RX_LNA1G_MISC] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_MIXA_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_MIXA_VCM] = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, }, - [B2056_RX_MIXA_CTRLPTAT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXA_LOB_BIAS] = { .ghz5 = 0x0088, .ghz2 = 0x0088, UPLOAD, }, - [B2056_RX_MIXA_CORE_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXA_CMFB_IDAC] = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, }, - [B2056_RX_MIXA_BIAS_AUX] = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, }, - [B2056_RX_MIXA_BIAS_MAIN] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_RX_MIXA_BIAS_MISC] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_RX_MIXA_MAST_BIAS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_MIXG_VCM] = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, }, - [B2056_RX_MIXG_CTRLPTAT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_LOB_BIAS] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_RX_MIXG_CORE_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_CMFB_IDAC] = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_AUX] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_MAIN] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_MISC] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_RX_MIXG_MAST_BIAS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_IOPAMP] = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, }, - [B2056_RX_TIA_QOPAMP] = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, }, - [B2056_RX_TIA_IMISC] = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, }, - [B2056_RX_TIA_QMISC] = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, }, - [B2056_RX_TIA_GAIN] = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, }, - [B2056_RX_TIA_SPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_SPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_BB_LPF_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_AACI_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_RXLPF_IDAC] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_RXLPF_OPAMPBIAS_LOWQ] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_RXLPF_OPAMPBIAS_HIGHQ]= { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_RXLPF_BIAS_DCCANCEL] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_RX_RXLPF_OUTVCM] = { .ghz5 = 0x0004, .ghz2 = 0x0004, UPLOAD, }, - [B2056_RX_RXLPF_INVCM_BODY] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_RXLPF_CC_OP] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_RX_RXLPF_GAIN] = { .ghz5 = 0x0023, .ghz2 = 0x0023, NOUPLOAD, }, - [B2056_RX_RXLPF_Q_BW] = { .ghz5 = 0x0041, .ghz2 = 0x0041, NOUPLOAD, }, - [B2056_RX_RXLPF_HP_CORNER_BW] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_RX_RXLPF_RCCAL_HPC] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_RCCAL_LPC] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_UNUSED] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_VGA_MASTER] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGA_BIAS] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGA_BIAS_DCCANCEL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, - [B2056_RX_VGA_GAIN] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_RX_VGA_HP_CORNER_BW] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_RX_VGABUF_BIAS] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGABUF_GAIN_BW] = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, }, - [B2056_RX_TXFBMIX_A] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TXFBMIX_G] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE3] = { .ghz5 = 0x0005, .ghz2 = 0x0005, UPLOAD, }, - [B2056_RX_RXSPARE4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE12] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE13] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE14] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE15] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_LNAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_LNAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_MIXTIA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_VGA_BUF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_Q] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_BUF_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_VGA_HPC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev7_syn[] = { - [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_PU] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_GPIO_MASTER1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_GPIO_MASTER2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TOPBIAS_MASTER] = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, }, - [B2056_SYN_TOPBIAS_RCAL] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_AFEREG] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSE] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSEIDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSERCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LPO] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_VDDCAL_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_VDDCAL_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_VDDCAL_STATUS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCAL_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCAL_CODE_OUT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL1] = { .ghz5 = 0x001f, .ghz2 = 0x001f, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL2] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL3] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_ZCAL_SPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_ZCAL_SPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_MAST1] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_SYN_PLL_MAST2] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_PLL_MAST3] = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, }, - [B2056_SYN_PLL_BIAS_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL1] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL3] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL5] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL6] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_SYN_PLL_REFDIV] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_PLL_PFD] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_CP1] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_PLL_CP2] = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, }, - [B2056_SYN_PLL_CP3] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER1] = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER2] = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER3] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER4] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER5] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_PLL_MMD1] = { .ghz5 = 0x001c, .ghz2 = 0x001c, NOUPLOAD, }, - [B2056_SYN_PLL_MMD2] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCO1] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCO2] = { .ghz5 = 0x00f7, .ghz2 = 0x00f7, UPLOAD, }, - [B2056_SYN_PLL_MONITOR1] = { .ghz5 = 0x00b4, .ghz2 = 0x00b4, NOUPLOAD, }, - [B2056_SYN_PLL_MONITOR2] = { .ghz5 = 0x00d2, .ghz2 = 0x00d2, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL4] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL5] = { .ghz5 = 0x0096, .ghz2 = 0x0096, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL6] = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL7] = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL8] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL9] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL11] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL12] = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, }, - [B2056_SYN_PLL_VCOCAL13] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_SYN_PLL_VREG] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU2] = { .ghz5 = 0x0040, .ghz2 = 0x0040, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU8] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_LOGEN_BIAS_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RCCR1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF1] = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER1] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER2] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF1] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGENBUF2] = { .ghz5 = 0x008f, .ghz2 = 0x008f, UPLOAD, }, - [B2056_SYN_LOGEN_BUF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF4] = { .ghz5 = 0x00cc, .ghz2 = 0x00cc, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV1] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV2] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV3] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLOUT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_CALEN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PEAKDET1] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, NOUPLOAD, }, - [B2056_SYN_LOGEN_CORE_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_DIFF_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_DIFF_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_CMOS_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_CMOS_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF2_OVRVAL]= { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER3_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF5_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF6_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL_WAITCNT] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_SYN_LOGEN_CORE_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_CMOS_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev7_tx[] = { - [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_IQCAL_GAIN_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_LOFT_FINE_I] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_FINE_Q] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_COARSE_I] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_COARSE_Q] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_TX_COM_MASTER1] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_TX_COM_MASTER2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RXIQCAL_TXMUX] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_TX_SSI_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_IQCAL_VCM_HG] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_IQCAL_IDAC] = { .ghz5 = 0x0037, .ghz2 = 0x0037, NOUPLOAD, }, - [B2056_TX_TSSI_VCM] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_TX_AMP_DET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TX_SSI_MUX] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSIA] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_TSSIG] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_TSSI_MISC1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSI_MISC2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSI_MISC3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PA_SPARE1] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_TX_PA_SPARE2] = { .ghz5 = 0x00ee, .ghz2 = 0x00ee, UPLOAD, }, - [B2056_TX_INTPAA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_BOOST_TUNE] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAA_IAUX_STAT] = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, }, - [B2056_TX_INTPAA_IAUX_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_IMAIN_STAT] = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, }, - [B2056_TX_INTPAA_IMAIN_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_CASCBIAS] = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, }, - [B2056_TX_INTPAA_PASLOPE] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_TX_INTPAA_PA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_BOOST_TUNE] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAG_IAUX_STAT] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAG_IAUX_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_IMAIN_STAT] = { .ghz5 = 0x001e, .ghz2 = 0x001e, NOUPLOAD, }, - [B2056_TX_INTPAG_IMAIN_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_CASCBIAS] = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, }, - [B2056_TX_INTPAG_PASLOPE] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_TX_INTPAG_PA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADA_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PADA_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_TX_PADA_CASCBIAS] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_PADA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADA_BOOST_TUNE] = { .ghz5 = 0x0038, .ghz2 = 0x0038, NOUPLOAD, }, - [B2056_TX_PADA_SLOPE] = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, }, - [B2056_TX_PADG_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PADG_IDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_PADG_CASCBIAS] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_PADG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADG_BOOST_TUNE] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_TX_PADG_SLOPE] = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, }, - [B2056_TX_PGAA_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PGAA_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_TX_PGAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAA_BOOST_TUNE] = { .ghz5 = 0x0083, .ghz2 = 0x0083, NOUPLOAD, }, - [B2056_TX_PGAA_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, }, - [B2056_TX_PGAA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAG_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PGAG_IDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_PGAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAG_BOOST_TUNE] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_TX_PGAG_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, }, - [B2056_TX_PGAG_MISC] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_MIXA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_MIXA_BOOST_TUNE] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_TX_MIXG] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_MIXG_BOOST_TUNE] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_TX_BB_GM_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_GM] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, - [B2056_TX_TXLPF_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_BW] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_0] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_1] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_2] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_3] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_4] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_5] = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_6] = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, }, - [B2056_TX_TXLPF_OPAMP_IDAC] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_TX_TXLPF_MISC] = { .ghz5 = 0x005b, .ghz2 = 0x005b, NOUPLOAD, }, - [B2056_TX_TXSPARE1] = { .ghz5 = 0x0030, .ghz2 = 0x0030, UPLOAD, }, - [B2056_TX_TXSPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE12] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE13] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE14] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE15] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_INTPA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_PAD_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_PGA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_GM_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_TXLPF_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_TXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC0] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC1] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC2] = { .ghz5 = 0x0071, .ghz2 = 0x0071, UPLOAD, }, - [B2056_TX_GMBB_IDAC3] = { .ghz5 = 0x0071, .ghz2 = 0x0071, UPLOAD, }, - [B2056_TX_GMBB_IDAC4] = { .ghz5 = 0x0072, .ghz2 = 0x0072, UPLOAD, }, - [B2056_TX_GMBB_IDAC5] = { .ghz5 = 0x0073, .ghz2 = 0x0073, UPLOAD, }, - [B2056_TX_GMBB_IDAC6] = { .ghz5 = 0x0074, .ghz2 = 0x0074, UPLOAD, }, - [B2056_TX_GMBB_IDAC7] = { .ghz5 = 0x0075, .ghz2 = 0x0075, UPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev7_rx[] = { - [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXIQCAL_RXMUX] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_RX_RSSI_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RSSI_SEL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RSSI_GAIN] = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, }, - [B2056_RX_RSSI_NB_IDAC] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_RX_RSSI_WB2I_IDAC_1] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_RX_RSSI_WB2I_IDAC_2] = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, }, - [B2056_RX_RSSI_WB2Q_IDAC_1] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_RX_RSSI_WB2Q_IDAC_2] = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, }, - [B2056_RX_RSSI_POLE] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_RSSI_WB1_IDAC] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_RX_RSSI_MISC] = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, }, - [B2056_RX_LNAA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_LNAA_TUNE] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_RX_LNAA_GAIN] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_RX_LNA_A_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_RX_BIASPOLE_LNAA1_IDAC] = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, }, - [B2056_RX_LNAA2_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_RX_LNA1A_MISC] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_LNAG_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_LNAG_TUNE] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_RX_LNAG_GAIN] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_RX_LNA_G_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_RX_BIASPOLE_LNAG1_IDAC] = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, }, - [B2056_RX_LNAG2_IDAC] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_RX_LNA1G_MISC] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_MIXA_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_MIXA_VCM] = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, }, - [B2056_RX_MIXA_CTRLPTAT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXA_LOB_BIAS] = { .ghz5 = 0x0088, .ghz2 = 0x0088, UPLOAD, }, - [B2056_RX_MIXA_CORE_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXA_CMFB_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, - [B2056_RX_MIXA_BIAS_AUX] = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, }, - [B2056_RX_MIXA_BIAS_MAIN] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_RX_MIXA_BIAS_MISC] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_RX_MIXA_MAST_BIAS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_MIXG_VCM] = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, }, - [B2056_RX_MIXG_CTRLPTAT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_LOB_BIAS] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_RX_MIXG_CORE_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_CMFB_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, - [B2056_RX_MIXG_BIAS_AUX] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_MAIN] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_MISC] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_RX_MIXG_MAST_BIAS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_IOPAMP] = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, }, - [B2056_RX_TIA_QOPAMP] = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, }, - [B2056_RX_TIA_IMISC] = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, }, - [B2056_RX_TIA_QMISC] = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, }, - [B2056_RX_TIA_GAIN] = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, }, - [B2056_RX_TIA_SPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_SPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_BB_LPF_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_AACI_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_RXLPF_IDAC] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_RXLPF_OPAMPBIAS_LOWQ] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_RXLPF_OPAMPBIAS_HIGHQ]= { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_RXLPF_BIAS_DCCANCEL] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_RX_RXLPF_OUTVCM] = { .ghz5 = 0x0004, .ghz2 = 0x0004, UPLOAD, }, - [B2056_RX_RXLPF_INVCM_BODY] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_RXLPF_CC_OP] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_RX_RXLPF_GAIN] = { .ghz5 = 0x0023, .ghz2 = 0x0023, NOUPLOAD, }, - [B2056_RX_RXLPF_Q_BW] = { .ghz5 = 0x0041, .ghz2 = 0x0041, NOUPLOAD, }, - [B2056_RX_RXLPF_HP_CORNER_BW] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_RX_RXLPF_RCCAL_HPC] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_RCCAL_LPC] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_UNUSED] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_VGA_MASTER] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGA_BIAS] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGA_BIAS_DCCANCEL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, - [B2056_RX_VGA_GAIN] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_RX_VGA_HP_CORNER_BW] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_RX_VGABUF_BIAS] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGABUF_GAIN_BW] = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, }, - [B2056_RX_TXFBMIX_A] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TXFBMIX_G] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE12] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE13] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE14] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE15] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_LNAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_LNAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_MIXTIA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_VGA_BUF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_Q] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_BUF_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_VGA_HPC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev8_syn[] = { - [B2056_SYN_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_PU] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_GPIO_MASTER1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_GPIO_MASTER2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TOPBIAS_MASTER] = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, }, - [B2056_SYN_TOPBIAS_RCAL] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_AFEREG] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSE] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSEIDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_TEMPPROCSENSERCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LPO] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_VDDCAL_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_VDDCAL_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_VDDCAL_STATUS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCAL_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCAL_CODE_OUT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL1] = { .ghz5 = 0x001f, .ghz2 = 0x001f, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL2] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL3] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_RCCAL_CTRL11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_ZCAL_SPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_ZCAL_SPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_MAST1] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_SYN_PLL_MAST2] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_PLL_MAST3] = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, }, - [B2056_SYN_PLL_BIAS_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL1] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL3] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL5] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_SYN_PLL_XTAL6] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_SYN_PLL_REFDIV] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_PLL_PFD] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_CP1] = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, }, - [B2056_SYN_PLL_CP2] = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, }, - [B2056_SYN_PLL_CP3] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER1] = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER2] = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER3] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER4] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_PLL_LOOPFILTER5] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_PLL_MMD1] = { .ghz5 = 0x001c, .ghz2 = 0x001c, NOUPLOAD, }, - [B2056_SYN_PLL_MMD2] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCO1] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCO2] = { .ghz5 = 0x00f7, .ghz2 = 0x00f7, UPLOAD, }, - [B2056_SYN_PLL_MONITOR1] = { .ghz5 = 0x00b4, .ghz2 = 0x00b4, NOUPLOAD, }, - [B2056_SYN_PLL_MONITOR2] = { .ghz5 = 0x00d2, .ghz2 = 0x00d2, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL4] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL5] = { .ghz5 = 0x0096, .ghz2 = 0x0096, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL6] = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL7] = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL8] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL9] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL11] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_SYN_PLL_VCOCAL12] = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, }, - [B2056_SYN_PLL_VCOCAL13] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_SYN_PLL_VREG] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_PLL_STATUS3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU2] = { .ghz5 = 0x0040, .ghz2 = 0x0040, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PU8] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_LOGEN_BIAS_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RCCR1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF1] = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER1] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER2] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF1] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGENBUF2] = { .ghz5 = 0x008f, .ghz2 = 0x008f, UPLOAD, }, - [B2056_SYN_LOGEN_BUF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF4] = { .ghz5 = 0x00cc, .ghz2 = 0x00cc, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV1] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV2] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_DIV3] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLOUT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACLCAL3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_CALEN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_PEAKDET1] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, NOUPLOAD, }, - [B2056_SYN_LOGEN_CORE_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_DIFF_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_DIFF_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_CMOS_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_CMOS_ACL_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_VCOBUF2_OVRVAL]= { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_SYN_LOGEN_MIXER3_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF5_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_BUF6_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CBUFTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_CMOSTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, }, - [B2056_SYN_LOGEN_ACL_WAITCNT] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_SYN_LOGEN_CORE_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_RX_CMOS_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev8_tx[] = { - [B2056_TX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_IQCAL_GAIN_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_LOFT_FINE_I] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_FINE_Q] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_COARSE_I] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_LOFT_COARSE_Q] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_TX_COM_MASTER1] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_TX_COM_MASTER2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_RXIQCAL_TXMUX] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_TX_SSI_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_IQCAL_VCM_HG] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_IQCAL_IDAC] = { .ghz5 = 0x0037, .ghz2 = 0x0037, NOUPLOAD, }, - [B2056_TX_TSSI_VCM] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_TX_AMP_DET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TX_SSI_MUX] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSIA] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_TSSIG] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_TSSI_MISC1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSI_MISC2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TSSI_MISC3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PA_SPARE1] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_TX_PA_SPARE2] = { .ghz5 = 0x00ee, .ghz2 = 0x00ee, UPLOAD, }, - [B2056_TX_INTPAA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_BOOST_TUNE] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAA_IAUX_STAT] = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, }, - [B2056_TX_INTPAA_IAUX_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_IMAIN_STAT] = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, }, - [B2056_TX_INTPAA_IMAIN_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAA_CASCBIAS] = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, }, - [B2056_TX_INTPAA_PASLOPE] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_TX_INTPAA_PA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_BOOST_TUNE] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAG_IAUX_STAT] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_TX_INTPAG_IAUX_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_IMAIN_STAT] = { .ghz5 = 0x001e, .ghz2 = 0x001e, NOUPLOAD, }, - [B2056_TX_INTPAG_IMAIN_DYN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_INTPAG_CASCBIAS] = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, }, - [B2056_TX_INTPAG_PASLOPE] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_TX_INTPAG_PA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADA_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PADA_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_TX_PADA_CASCBIAS] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_PADA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADA_BOOST_TUNE] = { .ghz5 = 0x0038, .ghz2 = 0x0038, NOUPLOAD, }, - [B2056_TX_PADA_SLOPE] = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, }, - [B2056_TX_PADG_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PADG_IDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_PADG_CASCBIAS] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_TX_PADG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PADG_BOOST_TUNE] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_TX_PADG_SLOPE] = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, }, - [B2056_TX_PGAA_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PGAA_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_TX_PGAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAA_BOOST_TUNE] = { .ghz5 = 0x0083, .ghz2 = 0x0083, NOUPLOAD, }, - [B2056_TX_PGAA_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, }, - [B2056_TX_PGAA_MISC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAG_MASTER] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_PGAG_IDAC] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_TX_PGAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_PGAG_BOOST_TUNE] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_TX_PGAG_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, }, - [B2056_TX_PGAG_MISC] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_TX_MIXA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_MIXA_BOOST_TUNE] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_TX_MIXG] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_MIXG_BOOST_TUNE] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_TX_BB_GM_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_GM] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, - [B2056_TX_TXLPF_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_RCCAL_OFF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_BW] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_TX_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_0] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_1] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_2] = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_3] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_4] = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_5] = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, }, - [B2056_TX_TXLPF_IDAC_6] = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, }, - [B2056_TX_TXLPF_OPAMP_IDAC] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_TX_TXLPF_MISC] = { .ghz5 = 0x005b, .ghz2 = 0x005b, NOUPLOAD, }, - [B2056_TX_TXSPARE1] = { .ghz5 = 0x0030, .ghz2 = 0x0030, UPLOAD, }, - [B2056_TX_TXSPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE12] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE13] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE14] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE15] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_TXSPARE16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_INTPA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_PAD_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_PGA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_GM_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_TXLPF_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_STATUS_TXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC0] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC1] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC2] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC3] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC4] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC5] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC6] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, - [B2056_TX_GMBB_IDAC7] = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, }, -}; - -static const struct b2056_inittab_entry b2056_inittab_rev8_rx[] = { - [B2056_RX_RESERVED_ADDR2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_CTRL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_OVR] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RESET] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RCAL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_RXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_TXLPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_COM_RC_RXHPF] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR17] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR18] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR19] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR20] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR21] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR22] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR23] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR24] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR25] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR26] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR27] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR28] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR29] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR30] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RESERVED_ADDR31] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXIQCAL_RXMUX] = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, }, - [B2056_RX_RSSI_PU] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RSSI_SEL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RSSI_GAIN] = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, }, - [B2056_RX_RSSI_NB_IDAC] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_RX_RSSI_WB2I_IDAC_1] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_RX_RSSI_WB2I_IDAC_2] = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, }, - [B2056_RX_RSSI_WB2Q_IDAC_1] = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, }, - [B2056_RX_RSSI_WB2Q_IDAC_2] = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, }, - [B2056_RX_RSSI_POLE] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_RSSI_WB1_IDAC] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_RX_RSSI_MISC] = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, }, - [B2056_RX_LNAA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_LNAA_TUNE] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_RX_LNAA_GAIN] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_RX_LNA_A_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_RX_BIASPOLE_LNAA1_IDAC] = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, }, - [B2056_RX_LNAA2_IDAC] = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, }, - [B2056_RX_LNA1A_MISC] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_LNAG_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_LNAG_TUNE] = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, }, - [B2056_RX_LNAG_GAIN] = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, }, - [B2056_RX_LNA_G_SLOPE] = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, }, - [B2056_RX_BIASPOLE_LNAG1_IDAC] = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, }, - [B2056_RX_LNAG2_IDAC] = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, }, - [B2056_RX_LNA1G_MISC] = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, }, - [B2056_RX_MIXA_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_MIXA_VCM] = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, }, - [B2056_RX_MIXA_CTRLPTAT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXA_LOB_BIAS] = { .ghz5 = 0x0088, .ghz2 = 0x0088, UPLOAD, }, - [B2056_RX_MIXA_CORE_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXA_CMFB_IDAC] = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, }, - [B2056_RX_MIXA_BIAS_AUX] = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, }, - [B2056_RX_MIXA_BIAS_MAIN] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_RX_MIXA_BIAS_MISC] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_RX_MIXA_MAST_BIAS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_MIXG_VCM] = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, }, - [B2056_RX_MIXG_CTRLPTAT] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_LOB_BIAS] = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, }, - [B2056_RX_MIXG_CORE_IDAC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_MIXG_CMFB_IDAC] = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_AUX] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_MAIN] = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, }, - [B2056_RX_MIXG_BIAS_MISC] = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, }, - [B2056_RX_MIXG_MAST_BIAS] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_MASTER] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_IOPAMP] = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, }, - [B2056_RX_TIA_QOPAMP] = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, }, - [B2056_RX_TIA_IMISC] = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, }, - [B2056_RX_TIA_QMISC] = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, }, - [B2056_RX_TIA_GAIN] = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, }, - [B2056_RX_TIA_SPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TIA_SPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_BB_LPF_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_AACI_MASTER] = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, }, - [B2056_RX_RXLPF_IDAC] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_RXLPF_OPAMPBIAS_LOWQ] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_RXLPF_OPAMPBIAS_HIGHQ]= { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_RXLPF_BIAS_DCCANCEL] = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, }, - [B2056_RX_RXLPF_OUTVCM] = { .ghz5 = 0x0004, .ghz2 = 0x0004, UPLOAD, }, - [B2056_RX_RXLPF_INVCM_BODY] = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, }, - [B2056_RX_RXLPF_CC_OP] = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, }, - [B2056_RX_RXLPF_GAIN] = { .ghz5 = 0x0023, .ghz2 = 0x0023, NOUPLOAD, }, - [B2056_RX_RXLPF_Q_BW] = { .ghz5 = 0x0041, .ghz2 = 0x0041, NOUPLOAD, }, - [B2056_RX_RXLPF_HP_CORNER_BW] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_RX_RXLPF_RCCAL_HPC] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXHPF_OFF7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_RCCAL_LPC] = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_0] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_3] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXLPF_OFF_4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_UNUSED] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_VGA_MASTER] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGA_BIAS] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGA_BIAS_DCCANCEL] = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, }, - [B2056_RX_VGA_GAIN] = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, }, - [B2056_RX_VGA_HP_CORNER_BW] = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, }, - [B2056_RX_VGABUF_BIAS] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, }, - [B2056_RX_VGABUF_GAIN_BW] = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, }, - [B2056_RX_TXFBMIX_A] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_TXFBMIX_G] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE1] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE2] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE3] = { .ghz5 = 0x0005, .ghz2 = 0x0005, UPLOAD, }, - [B2056_RX_RXSPARE4] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE5] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE6] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE7] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE8] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE9] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE10] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE11] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE12] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE13] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE14] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE15] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_RXSPARE16] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_LNAA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_LNAG_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_MIXTIA_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_VGA_BUF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_Q] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_BUF_BW] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_VGA_HPC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_RXLPF_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, - [B2056_RX_STATUS_HPC_RC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, }, -}; - -#define INITTABSPTS(prefix) \ - .syn = prefix##_syn, \ - .syn_length = ARRAY_SIZE(prefix##_syn), \ - .tx = prefix##_tx, \ - .tx_length = ARRAY_SIZE(prefix##_tx), \ - .rx = prefix##_rx, \ - .rx_length = ARRAY_SIZE(prefix##_rx) - -static const struct b2056_inittabs_pts b2056_inittabs[] = { - [3] = { INITTABSPTS(b2056_inittab_rev3) }, - [4] = { INITTABSPTS(b2056_inittab_rev4) }, - [5] = { INITTABSPTS(b2056_inittab_rev5) }, - [6] = { INITTABSPTS(b2056_inittab_rev6) }, - [7] = { INITTABSPTS(b2056_inittab_rev7) }, - [8] = { INITTABSPTS(b2056_inittab_rev8) }, - [9] = { INITTABSPTS(b2056_inittab_rev7) }, -}; - -#define RADIOREGS3(r00, r01, r02, r03, r04, r05, r06, r07, r08, r09, \ - r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, \ - r20, r21, r22, r23, r24, r25, r26, r27, r28, r29, \ - r30, r31, r32, r33, r34, r35, r36) \ - .radio_syn_pll_vcocal1 = r00, \ - .radio_syn_pll_vcocal2 = r01, \ - .radio_syn_pll_refdiv = r02, \ - .radio_syn_pll_mmd2 = r03, \ - .radio_syn_pll_mmd1 = r04, \ - .radio_syn_pll_loopfilter1 = r05, \ - .radio_syn_pll_loopfilter2 = r06, \ - .radio_syn_pll_loopfilter3 = r07, \ - .radio_syn_pll_loopfilter4 = r08, \ - .radio_syn_pll_loopfilter5 = r09, \ - .radio_syn_reserved_addr27 = r10, \ - .radio_syn_reserved_addr28 = r11, \ - .radio_syn_reserved_addr29 = r12, \ - .radio_syn_logen_vcobuf1 = r13, \ - .radio_syn_logen_mixer2 = r14, \ - .radio_syn_logen_buf3 = r15, \ - .radio_syn_logen_buf4 = r16, \ - .radio_rx0_lnaa_tune = r17, \ - .radio_rx0_lnag_tune = r18, \ - .radio_tx0_intpaa_boost_tune = r19, \ - .radio_tx0_intpag_boost_tune = r20, \ - .radio_tx0_pada_boost_tune = r21, \ - .radio_tx0_padg_boost_tune = r22, \ - .radio_tx0_pgaa_boost_tune = r23, \ - .radio_tx0_pgag_boost_tune = r24, \ - .radio_tx0_mixa_boost_tune = r25, \ - .radio_tx0_mixg_boost_tune = r26, \ - .radio_rx1_lnaa_tune = r27, \ - .radio_rx1_lnag_tune = r28, \ - .radio_tx1_intpaa_boost_tune = r29, \ - .radio_tx1_intpag_boost_tune = r30, \ - .radio_tx1_pada_boost_tune = r31, \ - .radio_tx1_padg_boost_tune = r32, \ - .radio_tx1_pgaa_boost_tune = r33, \ - .radio_tx1_pgag_boost_tune = r34, \ - .radio_tx1_mixa_boost_tune = r35, \ - .radio_tx1_mixg_boost_tune = r36 - -#define PHYREGS(r0, r1, r2, r3, r4, r5) \ - .phy_regs.phy_bw1a = r0, \ - .phy_regs.phy_bw2 = r1, \ - .phy_regs.phy_bw3 = r2, \ - .phy_regs.phy_bw4 = r3, \ - .phy_regs.phy_bw5 = r4, \ - .phy_regs.phy_bw6 = r5 - -/* http://bcm-v4.sipsolutions.net/802.11/Radio/2056/ChannelTable */ -static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev3[] = { - { .freq = 4920, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216), - }, - { .freq = 4930, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215), - }, - { .freq = 4940, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214), - }, - { .freq = 4950, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213), - }, - { .freq = 4960, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212), - }, - { .freq = 4970, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211), - }, - { .freq = 4980, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f), - }, - { .freq = 4990, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e), - }, - { .freq = 5000, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d), - }, - { .freq = 5010, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c), - }, - { .freq = 5020, - RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b), - }, - { .freq = 5030, - RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a), - }, - { .freq = 5040, - RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209), - }, - { .freq = 5050, - RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208), - }, - { .freq = 5060, - RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207), - }, - { .freq = 5070, - RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206), - }, - { .freq = 5080, - RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205), - }, - { .freq = 5090, - RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204), - }, - { .freq = 5100, - RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00), - PHYREGS(0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203), - }, - { .freq = 5110, - RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00), - PHYREGS(0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202), - }, - { .freq = 5120, - RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00), - PHYREGS(0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201), - }, - { .freq = 5130, - RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00), - PHYREGS(0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200), - }, - { .freq = 5140, - RADIOREGS3(0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00), - PHYREGS(0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff), - }, - { .freq = 5160, - RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00), - PHYREGS(0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd), - }, - { .freq = 5170, - RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00), - PHYREGS(0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc), - }, - { .freq = 5180, - RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xef, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0xef, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00), - PHYREGS(0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb), - }, - { .freq = 5190, - RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xef, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0xef, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00), - PHYREGS(0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa), - }, - { .freq = 5200, - RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x08, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xef, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0xef, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00), - PHYREGS(0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9), - }, - { .freq = 5210, - RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xdf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0xdf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00), - PHYREGS(0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8), - }, - { .freq = 5220, - RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xdf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0xdf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00), - PHYREGS(0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7), - }, - { .freq = 5230, - RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xdf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0xdf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00), - PHYREGS(0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6), - }, - { .freq = 5240, - RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xcf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00), - PHYREGS(0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5), - }, - { .freq = 5250, - RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xcf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00), - PHYREGS(0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4), - }, - { .freq = 5260, - RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xcf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00), - PHYREGS(0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3), - }, - { .freq = 5270, - RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, - 0xff, 0xcf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00), - PHYREGS(0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2), - }, - { .freq = 5280, - RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, - 0xff, 0xbf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0xbf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00), - PHYREGS(0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1), - }, - { .freq = 5290, - RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, - 0xff, 0xbf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0xbf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00), - PHYREGS(0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0), - }, - { .freq = 5300, - RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xbf, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfc, 0x00, 0xbf, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfc, 0x00), - PHYREGS(0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0), - }, - { .freq = 5310, - RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xbf, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0xbf, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00), - PHYREGS(0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef), - }, - { .freq = 5320, - RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xbf, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0xbf, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00), - PHYREGS(0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee), - }, - { .freq = 5330, - RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xaf, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0xaf, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00), - PHYREGS(0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed), - }, - { .freq = 5340, - RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xaf, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0xaf, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00), - PHYREGS(0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec), - }, - { .freq = 5350, - RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0x9f, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00), - PHYREGS(0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb), - }, - { .freq = 5360, - RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0x9f, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00), - PHYREGS(0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea), - }, - { .freq = 5370, - RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0x9f, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00), - PHYREGS(0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9), - }, - { .freq = 5380, - RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0x9f, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00), - PHYREGS(0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8), - }, - { .freq = 5390, - RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0x8f, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0x8f, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00), - PHYREGS(0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7), - }, - { .freq = 5400, - RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xc8, 0x8f, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xfa, 0x00, 0x8f, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xfa, 0x00), - PHYREGS(0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6), - }, - { .freq = 5410, - RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xc8, 0x8f, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xfa, 0x00, 0x8f, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xfa, 0x00), - PHYREGS(0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5), - }, - { .freq = 5420, - RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xc8, 0x8e, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xfa, 0x00, 0x8e, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xfa, 0x00), - PHYREGS(0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5), - }, - { .freq = 5430, - RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xc8, 0x8e, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xfa, 0x00, 0x8e, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xfa, 0x00), - PHYREGS(0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4), - }, - { .freq = 5440, - RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x7e, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xfa, 0x00, 0x7e, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xfa, 0x00), - PHYREGS(0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3), - }, - { .freq = 5450, - RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x7d, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xfa, 0x00, 0x7d, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xfa, 0x00), - PHYREGS(0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2), - }, - { .freq = 5460, - RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x6d, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xf8, 0x00, 0x6d, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xf8, 0x00), - PHYREGS(0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1), - }, - { .freq = 5470, - RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x6d, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xf8, 0x00, 0x6d, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xf8, 0x00), - PHYREGS(0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0), - }, - { .freq = 5480, - RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x5d, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xf8, 0x00, 0x5d, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xf8, 0x00), - PHYREGS(0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df), - }, - { .freq = 5490, - RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x5c, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xf8, 0x00, 0x5c, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xf8, 0x00), - PHYREGS(0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de), - }, - { .freq = 5500, - RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x5c, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x5c, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd), - }, - { .freq = 5510, - RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x4c, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x4c, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd), - }, - { .freq = 5520, - RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x4c, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x4c, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc), - }, - { .freq = 5530, - RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x3b, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x3b, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db), - }, - { .freq = 5540, - RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x3b, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x3b, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da), - }, - { .freq = 5550, - RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x3b, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x3b, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9), - }, - { .freq = 5560, - RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x2b, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x2b, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8), - }, - { .freq = 5570, - RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x2a, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x2a, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7), - }, - { .freq = 5580, - RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x1a, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x1a, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7), - }, - { .freq = 5590, - RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x1a, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x1a, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6), - }, - { .freq = 5600, - RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x1a, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x1a, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5), - }, - { .freq = 5610, - RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x19, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x19, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4), - }, - { .freq = 5620, - RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x19, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x19, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3), - }, - { .freq = 5630, - RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x09, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x09, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2), - }, - { .freq = 5640, - RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x09, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x09, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2), - }, - { .freq = 5650, - RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x08, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00), - PHYREGS(0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1), - }, - { .freq = 5660, - RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x08, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf6, 0x00, 0x08, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf6, 0x00), - PHYREGS(0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0), - }, - { .freq = 5670, - RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x08, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf6, 0x00, 0x08, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf6, 0x00), - PHYREGS(0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf), - }, - { .freq = 5680, - RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x08, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf6, 0x00, 0x08, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf6, 0x00), - PHYREGS(0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce), - }, - { .freq = 5690, - RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x07, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf6, 0x00, 0x07, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf6, 0x00), - PHYREGS(0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce), - }, - { .freq = 5700, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x07, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf6, 0x00, 0x07, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf6, 0x00), - PHYREGS(0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd), - }, - { .freq = 5710, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x07, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x07, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc), - }, - { .freq = 5720, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x07, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x07, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb), - }, - { .freq = 5725, - RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x79, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x06, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x06, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb), - }, - { .freq = 5730, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x06, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x06, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca), - }, - { .freq = 5735, - RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x7b, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x06, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x06, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca), - }, - { .freq = 5740, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x06, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x06, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9), - }, - { .freq = 5745, - RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7d, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x06, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x06, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9), - }, - { .freq = 5750, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x06, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x06, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9), - }, - { .freq = 5755, - RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7f, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x05, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x05, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8), - }, - { .freq = 5760, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x05, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x05, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8), - }, - { .freq = 5765, - RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x81, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x05, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x05, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8), - }, - { .freq = 5770, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x05, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x05, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7), - }, - { .freq = 5775, - RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x83, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x05, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x05, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7), - }, - { .freq = 5780, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x05, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x05, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6), - }, - { .freq = 5785, - RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x85, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, - 0x40, 0x04, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x04, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6), - }, - { .freq = 5790, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, - 0x40, 0x04, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x04, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6), - }, - { .freq = 5795, - RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x87, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, - 0x40, 0x04, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x04, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5), - }, - { .freq = 5800, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x04, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5), - }, - { .freq = 5805, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x89, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x04, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4), - }, - { .freq = 5810, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x04, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4), - }, - { .freq = 5815, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8b, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x04, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4), - }, - { .freq = 5820, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x03, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3), - }, - { .freq = 5825, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8d, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x03, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3), - }, - { .freq = 5830, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x03, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2), - }, - { .freq = 5840, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x03, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2), - }, - { .freq = 5850, - RADIOREGS3(0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x03, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00), - PHYREGS(0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1), - }, - { .freq = 5860, - RADIOREGS3(0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x03, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf2, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf2, 0x00), - PHYREGS(0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0), - }, - { .freq = 5870, - RADIOREGS3(0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf2, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf2, 0x00), - PHYREGS(0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf), - }, - { .freq = 5880, - RADIOREGS3(0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf2, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf2, 0x00), - PHYREGS(0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf), - }, - { .freq = 5890, - RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf2, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf2, 0x00), - PHYREGS(0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be), - }, - { .freq = 5900, - RADIOREGS3(0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x87, 0x03, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x05, - 0x00, 0xf2, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x05, 0x00, 0xf2, 0x00), - PHYREGS(0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd), - }, - { .freq = 5910, - RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x87, 0x03, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x05, - 0x00, 0xf2, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x05, 0x00, 0xf2, 0x00), - PHYREGS(0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc), - }, - { .freq = 2412, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x6c, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x04, 0x04, 0x04, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x00, 0xff, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f), - PHYREGS(0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443), - }, - { .freq = 2417, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x71, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x00, 0xff, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f), - PHYREGS(0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441), - }, - { .freq = 2422, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x76, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x00, 0xff, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f), - PHYREGS(0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f), - }, - { .freq = 2427, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x7b, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xfd, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x00, 0xfd, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f), - PHYREGS(0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d), - }, - { .freq = 2432, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x80, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xfb, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x00, 0xfb, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f), - PHYREGS(0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a), - }, - { .freq = 2437, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x85, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xfa, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x00, 0xfa, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f), - PHYREGS(0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438), - }, - { .freq = 2442, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x8a, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf8, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x00, 0xf8, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f), - PHYREGS(0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436), - }, - { .freq = 2447, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x8f, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf7, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x00, 0xf7, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f), - PHYREGS(0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434), - }, - { .freq = 2452, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x94, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf6, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x00, 0xf6, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f), - PHYREGS(0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431), - }, - { .freq = 2457, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x99, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf5, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0d, 0x00, 0xf5, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0d), - PHYREGS(0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f), - }, - { .freq = 2462, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x9e, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf4, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0d, 0x00, 0xf4, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0d), - PHYREGS(0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d), - }, - { .freq = 2467, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0xa3, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf3, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0d, 0x00, 0xf3, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0d), - PHYREGS(0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b), - }, - { .freq = 2472, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0xa8, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf2, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0d, 0x00, 0xf2, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0d), - PHYREGS(0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429), - }, - { .freq = 2484, - RADIOREGS3(0xff, 0x01, 0x03, 0x09, 0xb4, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf0, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0d, 0x00, 0xf0, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0d), - PHYREGS(0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424), - }, -}; - -static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev4[] = { - { .freq = 4920, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216), - }, - { .freq = 4930, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215), - }, - { .freq = 4940, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214), - }, - { .freq = 4950, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213), - }, - { .freq = 4960, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212), - }, - { .freq = 4970, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211), - }, - { .freq = 4980, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f), - }, - { .freq = 4990, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e), - }, - { .freq = 5000, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d), - }, - { .freq = 5010, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c), - }, - { .freq = 5020, - RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b), - }, - { .freq = 5030, - RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a), - }, - { .freq = 5040, - RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209), - }, - { .freq = 5050, - RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208), - }, - { .freq = 5060, - RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207), - }, - { .freq = 5070, - RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206), - }, - { .freq = 5080, - RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205), - }, - { .freq = 5090, - RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00), - PHYREGS(0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204), - }, - { .freq = 5100, - RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0xff, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00), - PHYREGS(0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203), - }, - { .freq = 5110, - RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0xff, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00), - PHYREGS(0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202), - }, - { .freq = 5120, - RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0xff, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00), - PHYREGS(0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201), - }, - { .freq = 5130, - RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0xff, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00), - PHYREGS(0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200), - }, - { .freq = 5140, - RADIOREGS3(0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0xff, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00), - PHYREGS(0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff), - }, - { .freq = 5160, - RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0xff, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00), - PHYREGS(0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd), - }, - { .freq = 5170, - RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0xff, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00), - PHYREGS(0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc), - }, - { .freq = 5180, - RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xef, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0xef, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00), - PHYREGS(0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb), - }, - { .freq = 5190, - RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xef, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0xef, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00), - PHYREGS(0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa), - }, - { .freq = 5200, - RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x08, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xef, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0xef, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00), - PHYREGS(0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9), - }, - { .freq = 5210, - RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xdf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0xdf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00), - PHYREGS(0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8), - }, - { .freq = 5220, - RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xdf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0xdf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00), - PHYREGS(0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7), - }, - { .freq = 5230, - RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xdf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0xdf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00), - PHYREGS(0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6), - }, - { .freq = 5240, - RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xcf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00), - PHYREGS(0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5), - }, - { .freq = 5250, - RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xcf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00), - PHYREGS(0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4), - }, - { .freq = 5260, - RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xcf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00), - PHYREGS(0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3), - }, - { .freq = 5270, - RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, - 0xff, 0xcf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00), - PHYREGS(0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2), - }, - { .freq = 5280, - RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, - 0xff, 0xbf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0xbf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00), - PHYREGS(0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1), - }, - { .freq = 5290, - RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, - 0xff, 0xbf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0xbf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00), - PHYREGS(0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0), - }, - { .freq = 5300, - RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xbf, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0xbf, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00), - PHYREGS(0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0), - }, - { .freq = 5310, - RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xbf, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0xbf, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00), - PHYREGS(0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef), - }, - { .freq = 5320, - RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xbf, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0xbf, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00), - PHYREGS(0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee), - }, - { .freq = 5330, - RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xaf, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0xaf, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00), - PHYREGS(0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed), - }, - { .freq = 5340, - RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xaf, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0xaf, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00), - PHYREGS(0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec), - }, - { .freq = 5350, - RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0x9f, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00), - PHYREGS(0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb), - }, - { .freq = 5360, - RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0x9f, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00), - PHYREGS(0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea), - }, - { .freq = 5370, - RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0x9f, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00), - PHYREGS(0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9), - }, - { .freq = 5380, - RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0x9f, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00), - PHYREGS(0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8), - }, - { .freq = 5390, - RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0x8f, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x8f, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00), - PHYREGS(0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7), - }, - { .freq = 5400, - RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xc8, 0x8f, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x8f, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00), - PHYREGS(0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6), - }, - { .freq = 5410, - RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xc8, 0x8f, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x8f, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00), - PHYREGS(0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5), - }, - { .freq = 5420, - RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xc8, 0x8e, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x8e, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00), - PHYREGS(0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5), - }, - { .freq = 5430, - RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xc8, 0x8e, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x8e, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00), - PHYREGS(0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4), - }, - { .freq = 5440, - RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x7e, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x7e, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00), - PHYREGS(0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3), - }, - { .freq = 5450, - RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x7d, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x7d, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00), - PHYREGS(0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2), - }, - { .freq = 5460, - RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x6d, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x6d, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00), - PHYREGS(0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1), - }, - { .freq = 5470, - RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x6d, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x6d, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00), - PHYREGS(0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0), - }, - { .freq = 5480, - RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x5d, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x5d, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00), - PHYREGS(0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df), - }, - { .freq = 5490, - RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x5c, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x5c, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00), - PHYREGS(0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de), - }, - { .freq = 5500, - RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x5c, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x5c, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00), - PHYREGS(0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd), - }, - { .freq = 5510, - RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x4c, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x4c, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00), - PHYREGS(0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd), - }, - { .freq = 5520, - RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x4c, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x4c, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00), - PHYREGS(0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc), - }, - { .freq = 5530, - RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x3b, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x3b, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00), - PHYREGS(0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db), - }, - { .freq = 5540, - RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x3b, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x3b, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00), - PHYREGS(0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da), - }, - { .freq = 5550, - RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x3b, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x3b, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00), - PHYREGS(0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9), - }, - { .freq = 5560, - RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x2b, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x2b, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00), - PHYREGS(0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8), - }, - { .freq = 5570, - RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x2a, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x2a, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00), - PHYREGS(0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7), - }, - { .freq = 5580, - RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x1a, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x1a, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00), - PHYREGS(0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7), - }, - { .freq = 5590, - RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x1a, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x1a, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00), - PHYREGS(0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6), - }, - { .freq = 5600, - RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x1a, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x1a, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00), - PHYREGS(0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5), - }, - { .freq = 5610, - RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x19, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x19, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00), - PHYREGS(0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4), - }, - { .freq = 5620, - RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x19, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x19, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00), - PHYREGS(0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3), - }, - { .freq = 5630, - RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x09, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x09, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00), - PHYREGS(0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2), - }, - { .freq = 5640, - RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x09, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x09, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00), - PHYREGS(0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2), - }, - { .freq = 5650, - RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x08, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x08, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00), - PHYREGS(0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1), - }, - { .freq = 5660, - RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x08, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x08, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00), - PHYREGS(0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0), - }, - { .freq = 5670, - RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x08, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x08, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00), - PHYREGS(0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf), - }, - { .freq = 5680, - RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x08, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x08, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00), - PHYREGS(0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce), - }, - { .freq = 5690, - RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x07, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x07, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00), - PHYREGS(0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce), - }, - { .freq = 5700, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x07, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x07, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd), - }, - { .freq = 5710, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x07, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x07, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc), - }, - { .freq = 5720, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x07, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x07, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb), - }, - { .freq = 5725, - RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x79, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x06, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x06, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb), - }, - { .freq = 5730, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x06, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x06, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca), - }, - { .freq = 5735, - RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x7b, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x06, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x06, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca), - }, - { .freq = 5740, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x06, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x06, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9), - }, - { .freq = 5745, - RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7d, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x06, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x06, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9), - }, - { .freq = 5750, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x06, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x06, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9), - }, - { .freq = 5755, - RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7f, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8), - }, - { .freq = 5760, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8), - }, - { .freq = 5765, - RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x81, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8), - }, - { .freq = 5770, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7), - }, - { .freq = 5775, - RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x83, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7), - }, - { .freq = 5780, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6), - }, - { .freq = 5785, - RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x85, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, - 0x40, 0x04, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x04, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6), - }, - { .freq = 5790, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, - 0x40, 0x04, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x04, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6), - }, - { .freq = 5795, - RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x87, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, - 0x40, 0x04, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x04, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00), - PHYREGS(0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5), - }, - { .freq = 5800, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x04, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x04, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00), - PHYREGS(0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5), - }, - { .freq = 5805, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x89, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x04, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x04, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00), - PHYREGS(0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4), - }, - { .freq = 5810, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x04, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x04, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00), - PHYREGS(0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4), - }, - { .freq = 5815, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8b, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x04, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x04, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00), - PHYREGS(0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4), - }, - { .freq = 5820, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x03, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x03, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00), - PHYREGS(0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3), - }, - { .freq = 5825, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8d, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x03, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x03, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00), - PHYREGS(0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3), - }, - { .freq = 5830, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x03, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x03, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00), - PHYREGS(0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2), - }, - { .freq = 5840, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x03, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x03, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00), - PHYREGS(0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2), - }, - { .freq = 5850, - RADIOREGS3(0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x03, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x03, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00), - PHYREGS(0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1), - }, - { .freq = 5860, - RADIOREGS3(0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x03, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x03, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00), - PHYREGS(0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0), - }, - { .freq = 5870, - RADIOREGS3(0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x02, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x02, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00), - PHYREGS(0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf), - }, - { .freq = 5880, - RADIOREGS3(0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x02, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x02, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00), - PHYREGS(0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf), - }, - { .freq = 5890, - RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x02, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x02, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00), - PHYREGS(0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be), - }, - { .freq = 5900, - RADIOREGS3(0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x87, 0x03, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf0, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf0, 0x00), - PHYREGS(0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd), - }, - { .freq = 5910, - RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x87, 0x03, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf0, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf0, 0x00), - PHYREGS(0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc), - }, - { .freq = 2412, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x6c, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x04, 0x04, 0x04, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x00, 0xff, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e), - PHYREGS(0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443), - }, - { .freq = 2417, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x71, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x00, 0xff, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e), - PHYREGS(0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441), - }, - { .freq = 2422, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x76, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xff, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x00, 0xff, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e), - PHYREGS(0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f), - }, - { .freq = 2427, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x7b, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xfd, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x00, 0xfd, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e), - PHYREGS(0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d), - }, - { .freq = 2432, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x80, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xfb, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x00, 0xfb, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e), - PHYREGS(0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a), - }, - { .freq = 2437, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x85, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x00, 0xfa, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e), - PHYREGS(0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438), - }, - { .freq = 2442, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x8a, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf8, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x00, 0xf8, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e), - PHYREGS(0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436), - }, - { .freq = 2447, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x8f, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf7, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x00, 0xf7, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e), - PHYREGS(0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434), - }, - { .freq = 2452, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x94, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf6, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x00, 0xf6, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e), - PHYREGS(0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431), - }, - { .freq = 2457, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x99, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf5, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x00, 0xf5, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e), - PHYREGS(0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f), - }, - { .freq = 2462, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x9e, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf4, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x00, 0xf4, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e), - PHYREGS(0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d), - }, - { .freq = 2467, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0xa3, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf3, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x00, 0xf3, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e), - PHYREGS(0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b), - }, - { .freq = 2472, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0xa8, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf2, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x00, 0xf2, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e), - PHYREGS(0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429), - }, - { .freq = 2484, - RADIOREGS3(0xff, 0x01, 0x03, 0x09, 0xb4, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0xf0, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x00, 0xf0, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e), - PHYREGS(0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424), - }, -}; - -static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev5[] = { - { .freq = 4920, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0f, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216), - }, - { .freq = 4930, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x6f, 0x00), - PHYREGS(0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215), - }, - { .freq = 4940, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x6f, 0x00), - PHYREGS(0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214), - }, - { .freq = 4950, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x6f, 0x00), - PHYREGS(0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213), - }, - { .freq = 4960, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x6f, 0x00), - PHYREGS(0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212), - }, - { .freq = 4970, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211), - }, - { .freq = 4980, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f), - }, - { .freq = 4990, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e), - }, - { .freq = 5000, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d), - }, - { .freq = 5010, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c), - }, - { .freq = 5020, - RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b), - }, - { .freq = 5030, - RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a), - }, - { .freq = 5040, - RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x9f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209), - }, - { .freq = 5050, - RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x9f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208), - }, - { .freq = 5060, - RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfd, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x9f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207), - }, - { .freq = 5070, - RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfd, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x9f, 0x00, 0xfd, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206), - }, - { .freq = 5080, - RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205), - }, - { .freq = 5090, - RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204), - }, - { .freq = 5100, - RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203), - }, - { .freq = 5110, - RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202), - }, - { .freq = 5120, - RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201), - }, - { .freq = 5130, - RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfb, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0a, - 0x00, 0x9f, 0x00, 0xfb, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200), - }, - { .freq = 5140, - RADIOREGS3(0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfb, 0x00, 0x07, 0x00, 0x70, 0x00, 0x0a, - 0x00, 0x9f, 0x00, 0xfb, 0x00, 0x07, 0x00, 0x70, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff), - }, - { .freq = 5160, - RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfb, 0x00, 0x07, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x9e, 0x00, 0xfb, 0x00, 0x07, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x6e, 0x00), - PHYREGS(0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd), - }, - { .freq = 5170, - RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfb, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x9e, 0x00, 0xfb, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x6e, 0x00), - PHYREGS(0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc), - }, - { .freq = 5180, - RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x6e, 0x00), - PHYREGS(0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb), - }, - { .freq = 5190, - RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x6e, 0x00), - PHYREGS(0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa), - }, - { .freq = 5200, - RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x08, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x6e, 0x00), - PHYREGS(0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9), - }, - { .freq = 5210, - RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x6e, 0x00), - PHYREGS(0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8), - }, - { .freq = 5220, - RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x6e, 0x00), - PHYREGS(0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7), - }, - { .freq = 5230, - RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xea, 0x00, 0x06, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x9e, 0x00, 0xea, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x6e, 0x00), - PHYREGS(0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6), - }, - { .freq = 5240, - RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xe9, 0x00, 0x05, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x9d, 0x00, 0xe9, 0x00, 0x05, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x6d, 0x00), - PHYREGS(0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5), - }, - { .freq = 5250, - RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xe9, 0x00, 0x05, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x9d, 0x00, 0xe9, 0x00, 0x05, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x6d, 0x00), - PHYREGS(0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4), - }, - { .freq = 5260, - RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xd9, 0x00, 0x05, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x9d, 0x00, 0xd9, 0x00, 0x05, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x6d, 0x00), - PHYREGS(0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3), - }, - { .freq = 5270, - RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, - 0xff, 0xd8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9c, 0x00, 0xd8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6c, 0x00), - PHYREGS(0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2), - }, - { .freq = 5280, - RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, - 0xff, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6c, 0x00), - PHYREGS(0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1), - }, - { .freq = 5290, - RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, - 0xff, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6c, 0x00), - PHYREGS(0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0), - }, - { .freq = 5300, - RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6c, 0x00), - PHYREGS(0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0), - }, - { .freq = 5310, - RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6c, 0x00), - PHYREGS(0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef), - }, - { .freq = 5320, - RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xb8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9c, 0x00, 0xb8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6c, 0x00), - PHYREGS(0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee), - }, - { .freq = 5330, - RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xb7, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9b, 0x00, 0xb7, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6b, 0x00), - PHYREGS(0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed), - }, - { .freq = 5340, - RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xb7, 0x00, 0x03, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9b, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6b, 0x00), - PHYREGS(0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec), - }, - { .freq = 5350, - RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xa7, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x9b, 0x00, 0xa7, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x6b, 0x00), - PHYREGS(0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb), - }, - { .freq = 5360, - RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xa6, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x9b, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x6b, 0x00), - PHYREGS(0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea), - }, - { .freq = 5370, - RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0xa6, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x9b, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x5b, 0x00), - PHYREGS(0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9), - }, - { .freq = 5380, - RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0x96, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x9a, 0x00, 0x96, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x5a, 0x00), - PHYREGS(0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8), - }, - { .freq = 5390, - RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, - 0xff, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x5a, 0x00), - PHYREGS(0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7), - }, - { .freq = 5400, - RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xc8, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x5a, 0x00), - PHYREGS(0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6), - }, - { .freq = 5410, - RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xc8, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x5a, 0x00), - PHYREGS(0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5), - }, - { .freq = 5420, - RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xc8, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x5a, 0x00), - PHYREGS(0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5), - }, - { .freq = 5430, - RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xc8, 0x85, 0x00, 0x02, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x99, 0x00, 0x85, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x59, 0x00), - PHYREGS(0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4), - }, - { .freq = 5440, - RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x84, 0x00, 0x02, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x99, 0x00, 0x84, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x59, 0x00), - PHYREGS(0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3), - }, - { .freq = 5450, - RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x84, 0x00, 0x02, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x99, 0x00, 0x84, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x59, 0x00), - PHYREGS(0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2), - }, - { .freq = 5460, - RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x84, 0x00, 0x02, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x99, 0x00, 0x84, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x69, 0x00), - PHYREGS(0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1), - }, - { .freq = 5470, - RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x74, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x99, 0x00, 0x74, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x69, 0x00), - PHYREGS(0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0), - }, - { .freq = 5480, - RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x68, 0x00), - PHYREGS(0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df), - }, - { .freq = 5490, - RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, - 0xc8, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x68, 0x00), - PHYREGS(0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de), - }, - { .freq = 5500, - RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x78, 0x00), - PHYREGS(0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd), - }, - { .freq = 5510, - RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x78, 0x00), - PHYREGS(0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd), - }, - { .freq = 5520, - RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x78, 0x00), - PHYREGS(0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc), - }, - { .freq = 5530, - RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x63, 0x00, 0x01, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x98, 0x00, 0x63, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x78, 0x00), - PHYREGS(0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db), - }, - { .freq = 5540, - RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x62, 0x00, 0x00, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x97, 0x00, 0x62, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x77, 0x00), - PHYREGS(0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da), - }, - { .freq = 5550, - RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x62, 0x00, 0x00, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x97, 0x00, 0x62, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x77, 0x00), - PHYREGS(0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9), - }, - { .freq = 5560, - RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x62, 0x00, 0x00, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x97, 0x00, 0x62, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x77, 0x00), - PHYREGS(0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8), - }, - { .freq = 5570, - RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x52, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x96, 0x00, 0x52, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x76, 0x00), - PHYREGS(0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7), - }, - { .freq = 5580, - RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x52, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x96, 0x00, 0x52, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x76, 0x00), - PHYREGS(0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7), - }, - { .freq = 5590, - RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, - 0x84, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x76, 0x00), - PHYREGS(0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6), - }, - { .freq = 5600, - RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x76, 0x00), - PHYREGS(0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5), - }, - { .freq = 5610, - RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x76, 0x00), - PHYREGS(0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4), - }, - { .freq = 5620, - RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x76, 0x00), - PHYREGS(0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3), - }, - { .freq = 5630, - RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x76, 0x00), - PHYREGS(0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2), - }, - { .freq = 5640, - RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x95, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x75, 0x00), - PHYREGS(0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2), - }, - { .freq = 5650, - RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x50, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x95, 0x00, 0x50, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x75, 0x00), - PHYREGS(0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1), - }, - { .freq = 5660, - RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x50, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x95, 0x00, 0x50, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x75, 0x00), - PHYREGS(0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0), - }, - { .freq = 5670, - RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x74, 0x00), - PHYREGS(0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf), - }, - { .freq = 5680, - RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x74, 0x00), - PHYREGS(0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce), - }, - { .freq = 5690, - RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, - 0x70, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x74, 0x00), - PHYREGS(0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce), - }, - { .freq = 5700, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x74, 0x00), - PHYREGS(0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd), - }, - { .freq = 5710, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x74, 0x00), - PHYREGS(0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc), - }, - { .freq = 5720, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x74, 0x00), - PHYREGS(0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb), - }, - { .freq = 5725, - RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x79, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x74, 0x00), - PHYREGS(0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb), - }, - { .freq = 5730, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x84, 0x00), - PHYREGS(0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca), - }, - { .freq = 5735, - RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x7b, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x83, 0x00), - PHYREGS(0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca), - }, - { .freq = 5740, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x83, 0x00), - PHYREGS(0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9), - }, - { .freq = 5745, - RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7d, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x83, 0x00), - PHYREGS(0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9), - }, - { .freq = 5750, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x83, 0x00), - PHYREGS(0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9), - }, - { .freq = 5755, - RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7f, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x83, 0x00), - PHYREGS(0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8), - }, - { .freq = 5760, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x83, 0x00), - PHYREGS(0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8), - }, - { .freq = 5765, - RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x81, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x82, 0x00), - PHYREGS(0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8), - }, - { .freq = 5770, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x82, 0x00), - PHYREGS(0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7), - }, - { .freq = 5775, - RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x83, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x82, 0x00), - PHYREGS(0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7), - }, - { .freq = 5780, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, - 0x40, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x82, 0x00), - PHYREGS(0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6), - }, - { .freq = 5785, - RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x85, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, - 0x40, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x82, 0x00), - PHYREGS(0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6), - }, - { .freq = 5790, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, - 0x40, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x82, 0x00), - PHYREGS(0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6), - }, - { .freq = 5795, - RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x87, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, - 0x40, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x82, 0x00), - PHYREGS(0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5), - }, - { .freq = 5800, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x82, 0x00), - PHYREGS(0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5), - }, - { .freq = 5805, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x89, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x82, 0x00), - PHYREGS(0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4), - }, - { .freq = 5810, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x82, 0x00), - PHYREGS(0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4), - }, - { .freq = 5815, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8b, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x82, 0x00), - PHYREGS(0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4), - }, - { .freq = 5820, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x82, 0x00), - PHYREGS(0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3), - }, - { .freq = 5825, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8d, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x82, 0x00), - PHYREGS(0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3), - }, - { .freq = 5830, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x72, 0x00), - PHYREGS(0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2), - }, - { .freq = 5840, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x72, 0x00), - PHYREGS(0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2), - }, - { .freq = 5850, - RADIOREGS3(0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x72, 0x00), - PHYREGS(0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1), - }, - { .freq = 5860, - RADIOREGS3(0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x72, 0x00), - PHYREGS(0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0), - }, - { .freq = 5870, - RADIOREGS3(0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x71, 0x00), - PHYREGS(0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf), - }, - { .freq = 5880, - RADIOREGS3(0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x71, 0x00), - PHYREGS(0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf), - }, - { .freq = 5890, - RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x71, 0x00), - PHYREGS(0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be), - }, - { .freq = 5900, - RADIOREGS3(0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x87, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x71, 0x00), - PHYREGS(0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd), - }, - { .freq = 5910, - RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x87, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x71, 0x00), - PHYREGS(0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc), - }, - { .freq = 2412, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x6c, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x04, 0x04, 0x04, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x1f, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0b, 0x00, 0x1f, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0b), - PHYREGS(0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443), - }, - { .freq = 2417, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x71, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x1f, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0a, 0x00, 0x1f, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0a), - PHYREGS(0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441), - }, - { .freq = 2422, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x76, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0a, 0x00, 0x0e, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0a), - PHYREGS(0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f), - }, - { .freq = 2427, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x7b, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x0d, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x00, 0x0d, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a), - PHYREGS(0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d), - }, - { .freq = 2432, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x80, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x0c, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x00, 0x0c, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a), - PHYREGS(0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a), - }, - { .freq = 2437, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x85, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x0b, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x00, 0x0b, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a), - PHYREGS(0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438), - }, - { .freq = 2442, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x8a, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x09, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a), - PHYREGS(0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436), - }, - { .freq = 2447, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x8f, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x09, 0x00, 0x08, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x09), - PHYREGS(0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434), - }, - { .freq = 2452, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x94, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x07, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x09, 0x00, 0x07, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x09), - PHYREGS(0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431), - }, - { .freq = 2457, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x99, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x06, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x09, 0x00, 0x06, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x09), - PHYREGS(0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f), - }, - { .freq = 2462, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x9e, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x05, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x09, 0x00, 0x05, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x09), - PHYREGS(0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d), - }, - { .freq = 2467, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0xa3, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x08, 0x00, 0x04, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x08), - PHYREGS(0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b), - }, - { .freq = 2472, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0xa8, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x08, 0x00, 0x03, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x08), - PHYREGS(0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429), - }, - { .freq = 2484, - RADIOREGS3(0xff, 0x01, 0x03, 0x09, 0xb4, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x08), - PHYREGS(0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424), - }, -}; - -static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev6[] = { - { .freq = 4920, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216), - }, - { .freq = 4930, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215), - }, - { .freq = 4940, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214), - }, - { .freq = 4950, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213), - }, - { .freq = 4960, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212), - }, - { .freq = 4970, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211), - }, - { .freq = 4980, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f), - }, - { .freq = 4990, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e), - }, - { .freq = 5000, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d), - }, - { .freq = 5010, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c), - }, - { .freq = 5020, - RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b), - }, - { .freq = 5030, - RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a), - }, - { .freq = 5040, - RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209), - }, - { .freq = 5050, - RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208), - }, - { .freq = 5060, - RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207), - }, - { .freq = 5070, - RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206), - }, - { .freq = 5080, - RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205), - }, - { .freq = 5090, - RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204), - }, - { .freq = 5100, - RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfd, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203), - }, - { .freq = 5110, - RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202), - }, - { .freq = 5120, - RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201), - }, - { .freq = 5130, - RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200), - }, - { .freq = 5140, - RADIOREGS3(0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfb, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfb, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff), - }, - { .freq = 5160, - RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfa, 0x00, 0x07, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0xfa, 0x00, 0x07, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00), - PHYREGS(0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd), - }, - { .freq = 5170, - RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfa, 0x00, 0x07, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0xfa, 0x00, 0x07, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00), - PHYREGS(0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc), - }, - { .freq = 5180, - RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xf9, 0x00, 0x06, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x06, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00), - PHYREGS(0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb), - }, - { .freq = 5190, - RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xf9, 0x00, 0x06, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x06, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa), - }, - { .freq = 5200, - RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x08, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xf9, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9), - }, - { .freq = 5210, - RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xf9, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8), - }, - { .freq = 5220, - RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, - 0xfe, 0xd8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xd8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7), - }, - { .freq = 5230, - RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, - 0xee, 0xd8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xd8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6), - }, - { .freq = 5240, - RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, - 0xee, 0xc8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xc8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5), - }, - { .freq = 5250, - RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, - 0xed, 0xc7, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4), - }, - { .freq = 5260, - RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0e, 0x00, - 0xed, 0xc7, 0x00, 0x04, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x04, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3), - }, - { .freq = 5270, - RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8e, 0x0e, 0x00, - 0xed, 0xc7, 0x00, 0x04, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x04, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2), - }, - { .freq = 5280, - RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1), - }, - { .freq = 5290, - RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0), - }, - { .freq = 5300, - RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0), - }, - { .freq = 5310, - RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef), - }, - { .freq = 5320, - RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdb, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee), - }, - { .freq = 5330, - RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xcb, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed), - }, - { .freq = 5340, - RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xca, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec), - }, - { .freq = 5350, - RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, - 0xca, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb), - }, - { .freq = 5360, - RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, - 0xc9, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea), - }, - { .freq = 5370, - RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, - 0xc9, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9), - }, - { .freq = 5380, - RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xb8, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8), - }, - { .freq = 5390, - RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xb8, 0x84, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7), - }, - { .freq = 5400, - RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xb8, 0x84, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6), - }, - { .freq = 5410, - RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xb7, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5), - }, - { .freq = 5420, - RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xa7, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5), - }, - { .freq = 5430, - RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0b, 0x00, - 0xa6, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4), - }, - { .freq = 5440, - RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, - 0xa6, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3), - }, - { .freq = 5450, - RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, - 0x95, 0x84, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2), - }, - { .freq = 5460, - RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, - 0x95, 0x84, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1), - }, - { .freq = 5470, - RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, - 0x94, 0x73, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0), - }, - { .freq = 5480, - RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x84, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df), - }, - { .freq = 5490, - RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x83, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de), - }, - { .freq = 5500, - RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x82, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd), - }, - { .freq = 5510, - RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x82, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd), - }, - { .freq = 5520, - RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x72, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc), - }, - { .freq = 5530, - RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, - 0x72, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db), - }, - { .freq = 5540, - RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, - 0x71, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da), - }, - { .freq = 5550, - RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, - 0x61, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9), - }, - { .freq = 5560, - RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, - 0x61, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8), - }, - { .freq = 5570, - RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, - 0x61, 0x62, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x62, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7), - }, - { .freq = 5580, - RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, - 0x60, 0x62, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x62, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00), - PHYREGS(0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7), - }, - { .freq = 5590, - RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, - 0x50, 0x61, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x61, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00), - PHYREGS(0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6), - }, - { .freq = 5600, - RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, - 0x50, 0x51, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00), - PHYREGS(0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5), - }, - { .freq = 5610, - RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, - 0x50, 0x51, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00), - PHYREGS(0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4), - }, - { .freq = 5620, - RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, - 0x50, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00), - PHYREGS(0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3), - }, - { .freq = 5630, - RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x50, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00), - PHYREGS(0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2), - }, - { .freq = 5640, - RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x40, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00), - PHYREGS(0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2), - }, - { .freq = 5650, - RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x40, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00), - PHYREGS(0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1), - }, - { .freq = 5660, - RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x40, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00), - PHYREGS(0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0), - }, - { .freq = 5670, - RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x40, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00), - PHYREGS(0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf), - }, - { .freq = 5680, - RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00), - PHYREGS(0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce), - }, - { .freq = 5690, - RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00), - PHYREGS(0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce), - }, - { .freq = 5700, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00), - PHYREGS(0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd), - }, - { .freq = 5710, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00), - PHYREGS(0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc), - }, - { .freq = 5720, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00), - PHYREGS(0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb), - }, - { .freq = 5725, - RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x79, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00), - PHYREGS(0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb), - }, - { .freq = 5730, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00), - PHYREGS(0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca), - }, - { .freq = 5735, - RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x7b, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00), - PHYREGS(0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca), - }, - { .freq = 5740, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00), - PHYREGS(0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9), - }, - { .freq = 5745, - RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7d, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00), - PHYREGS(0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9), - }, - { .freq = 5750, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6d, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6d, 0x00), - PHYREGS(0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9), - }, - { .freq = 5755, - RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7f, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x10, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00), - PHYREGS(0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8), - }, - { .freq = 5760, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, - 0x10, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00), - PHYREGS(0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8), - }, - { .freq = 5765, - RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x81, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, - 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00), - PHYREGS(0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8), - }, - { .freq = 5770, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, - 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00), - PHYREGS(0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7), - }, - { .freq = 5775, - RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x83, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, - 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00), - PHYREGS(0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7), - }, - { .freq = 5780, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, - 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00), - PHYREGS(0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6), - }, - { .freq = 5785, - RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x85, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00), - PHYREGS(0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6), - }, - { .freq = 5790, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00), - PHYREGS(0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6), - }, - { .freq = 5795, - RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x87, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00), - PHYREGS(0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5), - }, - { .freq = 5800, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00), - PHYREGS(0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5), - }, - { .freq = 5805, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x89, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00), - PHYREGS(0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4), - }, - { .freq = 5810, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00), - PHYREGS(0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4), - }, - { .freq = 5815, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8b, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00), - PHYREGS(0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4), - }, - { .freq = 5820, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00), - PHYREGS(0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3), - }, - { .freq = 5825, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8d, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x69, 0x00), - PHYREGS(0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3), - }, - { .freq = 5830, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x69, 0x00), - PHYREGS(0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2), - }, - { .freq = 5840, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00), - PHYREGS(0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2), - }, - { .freq = 5850, - RADIOREGS3(0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00), - PHYREGS(0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1), - }, - { .freq = 5860, - RADIOREGS3(0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00), - PHYREGS(0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0), - }, - { .freq = 5870, - RADIOREGS3(0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00), - PHYREGS(0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf), - }, - { .freq = 5880, - RADIOREGS3(0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00), - PHYREGS(0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf), - }, - { .freq = 5890, - RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00), - PHYREGS(0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be), - }, - { .freq = 5900, - RADIOREGS3(0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00), - PHYREGS(0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd), - }, - { .freq = 5910, - RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00), - PHYREGS(0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc), - }, - { .freq = 2412, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x6c, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x04, 0x04, 0x04, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x00, 0x78, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a), - PHYREGS(0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443), - }, - { .freq = 2417, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x71, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x00, 0x78, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a), - PHYREGS(0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441), - }, - { .freq = 2422, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x76, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x67, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x00, 0x67, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a), - PHYREGS(0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f), - }, - { .freq = 2427, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x7b, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x57, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x00, 0x57, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a), - PHYREGS(0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d), - }, - { .freq = 2432, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x80, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x56, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x00, 0x56, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a), - PHYREGS(0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a), - }, - { .freq = 2437, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x85, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x46, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x00, 0x46, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a), - PHYREGS(0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438), - }, - { .freq = 2442, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x8a, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x45, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x00, 0x45, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a), - PHYREGS(0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436), - }, - { .freq = 2447, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x8f, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x34, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x00, 0x34, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09), - PHYREGS(0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434), - }, - { .freq = 2452, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x94, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x23, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x00, 0x23, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09), - PHYREGS(0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431), - }, - { .freq = 2457, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x99, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x12, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x00, 0x12, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09), - PHYREGS(0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f), - }, - { .freq = 2462, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x9e, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x00, 0x02, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09), - PHYREGS(0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d), - }, - { .freq = 2467, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0xa3, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x00, 0x01, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09), - PHYREGS(0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b), - }, - { .freq = 2472, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0xa8, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x00, 0x01, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09), - PHYREGS(0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429), - }, - { .freq = 2484, - RADIOREGS3(0xff, 0x01, 0x03, 0x09, 0xb4, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x07, 0x07, 0x07, 0x8f, 0x20, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09), - PHYREGS(0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424), - }, -}; - -static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev7_9[] = { - { .freq = 4920, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0f, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216), - }, - { .freq = 4930, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x6f, 0x00), - PHYREGS(0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215), - }, - { .freq = 4940, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x6f, 0x00), - PHYREGS(0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214), - }, - { .freq = 4950, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x6f, 0x00), - PHYREGS(0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213), - }, - { .freq = 4960, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x6f, 0x00), - PHYREGS(0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212), - }, - { .freq = 4970, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211), - }, - { .freq = 4980, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f), - }, - { .freq = 4990, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e), - }, - { .freq = 5000, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d), - }, - { .freq = 5010, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c), - }, - { .freq = 5020, - RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b), - }, - { .freq = 5030, - RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xff, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x9f, 0x00, 0xff, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a), - }, - { .freq = 5040, - RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x9f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209), - }, - { .freq = 5050, - RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x9f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208), - }, - { .freq = 5060, - RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfd, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x9f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207), - }, - { .freq = 5070, - RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfd, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x9f, 0x00, 0xfd, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206), - }, - { .freq = 5080, - RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205), - }, - { .freq = 5090, - RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204), - }, - { .freq = 5100, - RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203), - }, - { .freq = 5110, - RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202), - }, - { .freq = 5120, - RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201), - }, - { .freq = 5130, - RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfb, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0a, - 0x00, 0x9f, 0x00, 0xfb, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200), - }, - { .freq = 5140, - RADIOREGS3(0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfb, 0x00, 0x07, 0x00, 0x70, 0x00, 0x0a, - 0x00, 0x9f, 0x00, 0xfb, 0x00, 0x07, 0x00, 0x70, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff), - }, - { .freq = 5160, - RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfb, 0x00, 0x07, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x9e, 0x00, 0xfb, 0x00, 0x07, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x6e, 0x00), - PHYREGS(0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd), - }, - { .freq = 5170, - RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfb, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x9e, 0x00, 0xfb, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x6e, 0x00), - PHYREGS(0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc), - }, - { .freq = 5180, - RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x6e, 0x00), - PHYREGS(0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb), - }, - { .freq = 5190, - RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x6e, 0x00), - PHYREGS(0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa), - }, - { .freq = 5200, - RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x08, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x6e, 0x00), - PHYREGS(0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9), - }, - { .freq = 5210, - RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x6e, 0x00), - PHYREGS(0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8), - }, - { .freq = 5220, - RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, - 0xfe, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x6e, 0x00), - PHYREGS(0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7), - }, - { .freq = 5230, - RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, - 0xee, 0xea, 0x00, 0x06, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x9e, 0x00, 0xea, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x6e, 0x00), - PHYREGS(0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6), - }, - { .freq = 5240, - RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, - 0xee, 0xe9, 0x00, 0x05, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x9d, 0x00, 0xe9, 0x00, 0x05, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x6d, 0x00), - PHYREGS(0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5), - }, - { .freq = 5250, - RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, - 0xed, 0xe9, 0x00, 0x05, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x9d, 0x00, 0xe9, 0x00, 0x05, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x6d, 0x00), - PHYREGS(0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4), - }, - { .freq = 5260, - RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0e, 0x00, - 0xed, 0xd9, 0x00, 0x05, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x9d, 0x00, 0xd9, 0x00, 0x05, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x6d, 0x00), - PHYREGS(0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3), - }, - { .freq = 5270, - RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8e, 0x0e, 0x00, - 0xed, 0xd8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9c, 0x00, 0xd8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6c, 0x00), - PHYREGS(0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2), - }, - { .freq = 5280, - RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdc, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6c, 0x00), - PHYREGS(0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1), - }, - { .freq = 5290, - RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdc, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6c, 0x00), - PHYREGS(0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0), - }, - { .freq = 5300, - RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdc, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6c, 0x00), - PHYREGS(0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0), - }, - { .freq = 5310, - RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdc, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6c, 0x00), - PHYREGS(0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef), - }, - { .freq = 5320, - RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdb, 0xb8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9c, 0x00, 0xb8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6c, 0x00), - PHYREGS(0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee), - }, - { .freq = 5330, - RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xcb, 0xb7, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9b, 0x00, 0xb7, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6b, 0x00), - PHYREGS(0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed), - }, - { .freq = 5340, - RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xca, 0xb7, 0x00, 0x03, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x9b, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x6b, 0x00), - PHYREGS(0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec), - }, - { .freq = 5350, - RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, - 0xca, 0xa7, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x9b, 0x00, 0xa7, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x6b, 0x00), - PHYREGS(0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb), - }, - { .freq = 5360, - RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, - 0xc9, 0xa6, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x9b, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x6b, 0x00), - PHYREGS(0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea), - }, - { .freq = 5370, - RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, - 0xc9, 0xa6, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x9b, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x7b, 0x00), - PHYREGS(0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9), - }, - { .freq = 5380, - RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xb8, 0x96, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x9a, 0x00, 0x96, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x7a, 0x00), - PHYREGS(0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8), - }, - { .freq = 5390, - RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xb8, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x7a, 0x00), - PHYREGS(0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7), - }, - { .freq = 5400, - RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xb8, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x7a, 0x00), - PHYREGS(0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6), - }, - { .freq = 5410, - RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xb7, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x7a, 0x00), - PHYREGS(0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5), - }, - { .freq = 5420, - RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xa7, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x7a, 0x00), - PHYREGS(0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5), - }, - { .freq = 5430, - RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0b, 0x00, - 0xa6, 0x85, 0x00, 0x02, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x99, 0x00, 0x85, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x79, 0x00), - PHYREGS(0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4), - }, - { .freq = 5440, - RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, - 0xa6, 0x84, 0x00, 0x02, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x99, 0x00, 0x84, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x79, 0x00), - PHYREGS(0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3), - }, - { .freq = 5450, - RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, - 0x95, 0x84, 0x00, 0x02, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x99, 0x00, 0x84, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x79, 0x00), - PHYREGS(0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2), - }, - { .freq = 5460, - RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, - 0x95, 0x84, 0x00, 0x02, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x99, 0x00, 0x84, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x79, 0x00), - PHYREGS(0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1), - }, - { .freq = 5470, - RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, - 0x94, 0x74, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x99, 0x00, 0x74, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x79, 0x00), - PHYREGS(0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0), - }, - { .freq = 5480, - RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x84, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x78, 0x00), - PHYREGS(0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df), - }, - { .freq = 5490, - RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x83, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x78, 0x00), - PHYREGS(0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de), - }, - { .freq = 5500, - RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x82, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x78, 0x00), - PHYREGS(0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd), - }, - { .freq = 5510, - RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x82, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x78, 0x00), - PHYREGS(0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd), - }, - { .freq = 5520, - RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x72, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x78, 0x00), - PHYREGS(0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc), - }, - { .freq = 5530, - RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, - 0x72, 0x63, 0x00, 0x01, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x98, 0x00, 0x63, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x78, 0x00), - PHYREGS(0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db), - }, - { .freq = 5540, - RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, - 0x71, 0x62, 0x00, 0x00, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x97, 0x00, 0x62, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x77, 0x00), - PHYREGS(0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da), - }, - { .freq = 5550, - RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, - 0x61, 0x62, 0x00, 0x00, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x97, 0x00, 0x62, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x77, 0x00), - PHYREGS(0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9), - }, - { .freq = 5560, - RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, - 0x61, 0x62, 0x00, 0x00, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x97, 0x00, 0x62, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x77, 0x00), - PHYREGS(0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8), - }, - { .freq = 5570, - RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, - 0x61, 0x52, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x96, 0x00, 0x52, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x76, 0x00), - PHYREGS(0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7), - }, - { .freq = 5580, - RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, - 0x60, 0x52, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x96, 0x00, 0x52, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x86, 0x00), - PHYREGS(0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7), - }, - { .freq = 5590, - RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, - 0x50, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x86, 0x00), - PHYREGS(0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6), - }, - { .freq = 5600, - RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, - 0x50, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x86, 0x00), - PHYREGS(0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5), - }, - { .freq = 5610, - RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, - 0x50, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x86, 0x00), - PHYREGS(0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4), - }, - { .freq = 5620, - RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, - 0x50, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x86, 0x00), - PHYREGS(0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3), - }, - { .freq = 5630, - RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x50, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x86, 0x00), - PHYREGS(0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2), - }, - { .freq = 5640, - RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x40, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x95, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x85, 0x00), - PHYREGS(0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2), - }, - { .freq = 5650, - RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x40, 0x50, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x95, 0x00, 0x50, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x85, 0x00), - PHYREGS(0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1), - }, - { .freq = 5660, - RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x40, 0x50, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x95, 0x00, 0x50, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x85, 0x00), - PHYREGS(0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0), - }, - { .freq = 5670, - RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x40, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x84, 0x00), - PHYREGS(0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf), - }, - { .freq = 5680, - RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x84, 0x00), - PHYREGS(0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce), - }, - { .freq = 5690, - RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00), - PHYREGS(0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce), - }, - { .freq = 5700, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00), - PHYREGS(0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd), - }, - { .freq = 5710, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00), - PHYREGS(0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc), - }, - { .freq = 5720, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00), - PHYREGS(0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb), - }, - { .freq = 5725, - RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x79, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00), - PHYREGS(0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb), - }, - { .freq = 5730, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00), - PHYREGS(0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca), - }, - { .freq = 5735, - RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x7b, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00), - PHYREGS(0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca), - }, - { .freq = 5740, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00), - PHYREGS(0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9), - }, - { .freq = 5745, - RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7d, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00), - PHYREGS(0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9), - }, - { .freq = 5750, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00), - PHYREGS(0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9), - }, - { .freq = 5755, - RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7f, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x10, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00), - PHYREGS(0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8), - }, - { .freq = 5760, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, - 0x10, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00), - PHYREGS(0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8), - }, - { .freq = 5765, - RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x81, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, - 0x10, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8), - }, - { .freq = 5770, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, - 0x10, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7), - }, - { .freq = 5775, - RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x83, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, - 0x10, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7), - }, - { .freq = 5780, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, - 0x10, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6), - }, - { .freq = 5785, - RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x85, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6), - }, - { .freq = 5790, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6), - }, - { .freq = 5795, - RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x87, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5), - }, - { .freq = 5800, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5), - }, - { .freq = 5805, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x89, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4), - }, - { .freq = 5810, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4), - }, - { .freq = 5815, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8b, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4), - }, - { .freq = 5820, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3), - }, - { .freq = 5825, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8d, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3), - }, - { .freq = 5830, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2), - }, - { .freq = 5840, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2), - }, - { .freq = 5850, - RADIOREGS3(0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1), - }, - { .freq = 5860, - RADIOREGS3(0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00), - PHYREGS(0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0), - }, - { .freq = 5870, - RADIOREGS3(0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00), - PHYREGS(0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf), - }, - { .freq = 5880, - RADIOREGS3(0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00), - PHYREGS(0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf), - }, - { .freq = 5890, - RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00), - PHYREGS(0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be), - }, - { .freq = 5900, - RADIOREGS3(0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00), - PHYREGS(0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd), - }, - { .freq = 5910, - RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00), - PHYREGS(0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc), - }, - { .freq = 2412, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x6c, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x04, 0x04, 0x04, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x89, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0b, 0x00, 0x89, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0b), - PHYREGS(0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443), - }, - { .freq = 2417, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x71, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x89, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0a), - PHYREGS(0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441), - }, - { .freq = 2422, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x76, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x89, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0a), - PHYREGS(0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f), - }, - { .freq = 2427, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x7b, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x00, 0x78, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a), - PHYREGS(0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d), - }, - { .freq = 2432, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x80, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x77, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x00, 0x77, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a), - PHYREGS(0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a), - }, - { .freq = 2437, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x85, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x76, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x00, 0x76, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a), - PHYREGS(0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438), - }, - { .freq = 2442, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x8a, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x66, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x00, 0x66, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a), - PHYREGS(0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436), - }, - { .freq = 2447, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x8f, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x55, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x09, 0x00, 0x55, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x09), - PHYREGS(0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434), - }, - { .freq = 2452, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x94, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x45, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x09, 0x00, 0x45, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x09), - PHYREGS(0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431), - }, - { .freq = 2457, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x99, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x34, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x09, 0x00, 0x34, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x09), - PHYREGS(0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f), - }, - { .freq = 2462, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x9e, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x09, 0x00, 0x33, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x09), - PHYREGS(0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d), - }, - { .freq = 2467, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0xa3, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x22, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x08, 0x00, 0x22, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x08), - PHYREGS(0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b), - }, - { .freq = 2472, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0xa8, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x08, 0x00, 0x11, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x08), - PHYREGS(0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429), - }, - { .freq = 2484, - RADIOREGS3(0xff, 0x01, 0x03, 0x09, 0xb4, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x07, 0x07, 0x07, 0x8f, 0x20, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x08), - PHYREGS(0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424), - }, -}; - -static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev8[] = { - { .freq = 4920, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216), - }, - { .freq = 4930, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215), - }, - { .freq = 4940, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214), - }, - { .freq = 4950, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213), - }, - { .freq = 4960, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212), - }, - { .freq = 4970, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211), - }, - { .freq = 4980, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f), - }, - { .freq = 4990, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e), - }, - { .freq = 5000, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d), - }, - { .freq = 5010, - RADIOREGS3(0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c), - }, - { .freq = 5020, - RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b), - }, - { .freq = 5030, - RADIOREGS3(0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a), - }, - { .freq = 5040, - RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209), - }, - { .freq = 5050, - RADIOREGS3(0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208), - }, - { .freq = 5060, - RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207), - }, - { .freq = 5070, - RADIOREGS3(0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206), - }, - { .freq = 5080, - RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205), - }, - { .freq = 5090, - RADIOREGS3(0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, - 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204), - }, - { .freq = 5100, - RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfd, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203), - }, - { .freq = 5110, - RADIOREGS3(0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202), - }, - { .freq = 5120, - RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201), - }, - { .freq = 5130, - RADIOREGS3(0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200), - }, - { .freq = 5140, - RADIOREGS3(0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfb, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0xfb, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00), - PHYREGS(0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff), - }, - { .freq = 5160, - RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfa, 0x00, 0x07, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0xfa, 0x00, 0x07, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00), - PHYREGS(0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd), - }, - { .freq = 5170, - RADIOREGS3(0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xfa, 0x00, 0x07, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0xfa, 0x00, 0x07, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00), - PHYREGS(0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc), - }, - { .freq = 5180, - RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xf9, 0x00, 0x06, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x06, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00), - PHYREGS(0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb), - }, - { .freq = 5190, - RADIOREGS3(0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xf9, 0x00, 0x06, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x06, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa), - }, - { .freq = 5200, - RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x08, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xf9, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9), - }, - { .freq = 5210, - RADIOREGS3(0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, - 0xff, 0xf9, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8), - }, - { .freq = 5220, - RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, - 0xfe, 0xd8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xd8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7), - }, - { .freq = 5230, - RADIOREGS3(0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, - 0xee, 0xd8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xd8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6), - }, - { .freq = 5240, - RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, - 0xee, 0xc8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xc8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5), - }, - { .freq = 5250, - RADIOREGS3(0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, - 0xed, 0xc7, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4), - }, - { .freq = 5260, - RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x02, 0x02, 0x02, 0x8e, 0x0e, 0x00, - 0xed, 0xc7, 0x00, 0x04, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x04, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00), - PHYREGS(0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3), - }, - { .freq = 5270, - RADIOREGS3(0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8e, 0x0e, 0x00, - 0xed, 0xc7, 0x00, 0x04, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x04, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2), - }, - { .freq = 5280, - RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1), - }, - { .freq = 5290, - RADIOREGS3(0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0), - }, - { .freq = 5300, - RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0), - }, - { .freq = 5310, - RADIOREGS3(0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef), - }, - { .freq = 5320, - RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, - 0xdb, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00), - PHYREGS(0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee), - }, - { .freq = 5330, - RADIOREGS3(0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xcb, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed), - }, - { .freq = 5340, - RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, - 0xca, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec), - }, - { .freq = 5350, - RADIOREGS3(0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, - 0xca, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00), - PHYREGS(0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb), - }, - { .freq = 5360, - RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, - 0xc9, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea), - }, - { .freq = 5370, - RADIOREGS3(0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, - 0xc9, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9), - }, - { .freq = 5380, - RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xb8, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8), - }, - { .freq = 5390, - RADIOREGS3(0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xb8, 0x84, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7), - }, - { .freq = 5400, - RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xb8, 0x84, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6), - }, - { .freq = 5410, - RADIOREGS3(0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xb7, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5), - }, - { .freq = 5420, - RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, - 0xa7, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5), - }, - { .freq = 5430, - RADIOREGS3(0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x03, 0x03, 0x03, 0x8c, 0x0b, 0x00, - 0xa6, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00), - PHYREGS(0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4), - }, - { .freq = 5440, - RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, - 0xa6, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3), - }, - { .freq = 5450, - RADIOREGS3(0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, - 0x95, 0x84, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2), - }, - { .freq = 5460, - RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, - 0x95, 0x84, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x84, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1), - }, - { .freq = 5470, - RADIOREGS3(0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, - 0x94, 0x73, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0), - }, - { .freq = 5480, - RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x84, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df), - }, - { .freq = 5490, - RADIOREGS3(0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x83, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de), - }, - { .freq = 5500, - RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x82, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd), - }, - { .freq = 5510, - RADIOREGS3(0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x82, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd), - }, - { .freq = 5520, - RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, - 0x72, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc), - }, - { .freq = 5530, - RADIOREGS3(0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, - 0x72, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db), - }, - { .freq = 5540, - RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, - 0x71, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da), - }, - { .freq = 5550, - RADIOREGS3(0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, - 0x61, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9), - }, - { .freq = 5560, - RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, - 0x61, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8), - }, - { .freq = 5570, - RADIOREGS3(0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, - 0x61, 0x62, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x62, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00), - PHYREGS(0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7), - }, - { .freq = 5580, - RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, - 0x60, 0x62, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x62, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00), - PHYREGS(0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7), - }, - { .freq = 5590, - RADIOREGS3(0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, - 0x50, 0x61, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x61, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00), - PHYREGS(0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6), - }, - { .freq = 5600, - RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, - 0x50, 0x51, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00), - PHYREGS(0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5), - }, - { .freq = 5610, - RADIOREGS3(0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, - 0x50, 0x51, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00), - PHYREGS(0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4), - }, - { .freq = 5620, - RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, - 0x50, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00), - PHYREGS(0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3), - }, - { .freq = 5630, - RADIOREGS3(0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x50, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00), - PHYREGS(0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2), - }, - { .freq = 5640, - RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x40, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00), - PHYREGS(0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2), - }, - { .freq = 5650, - RADIOREGS3(0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x40, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00), - PHYREGS(0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1), - }, - { .freq = 5660, - RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x40, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00), - PHYREGS(0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0), - }, - { .freq = 5670, - RADIOREGS3(0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, - 0x40, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00), - PHYREGS(0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf), - }, - { .freq = 5680, - RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00), - PHYREGS(0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce), - }, - { .freq = 5690, - RADIOREGS3(0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00), - PHYREGS(0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce), - }, - { .freq = 5700, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00), - PHYREGS(0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd), - }, - { .freq = 5710, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00), - PHYREGS(0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc), - }, - { .freq = 5720, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00), - PHYREGS(0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb), - }, - { .freq = 5725, - RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x79, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, - 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00), - PHYREGS(0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb), - }, - { .freq = 5730, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00), - PHYREGS(0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca), - }, - { .freq = 5735, - RADIOREGS3(0x03, 0x01, 0x02, 0x04, 0x7b, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00), - PHYREGS(0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca), - }, - { .freq = 5740, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00), - PHYREGS(0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9), - }, - { .freq = 5745, - RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7d, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00), - PHYREGS(0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9), - }, - { .freq = 5750, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x20, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6d, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6d, 0x00), - PHYREGS(0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9), - }, - { .freq = 5755, - RADIOREGS3(0xfe, 0x00, 0x02, 0x04, 0x7f, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, - 0x10, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00), - PHYREGS(0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8), - }, - { .freq = 5760, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, - 0x10, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00), - PHYREGS(0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8), - }, - { .freq = 5765, - RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x81, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, - 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00), - PHYREGS(0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8), - }, - { .freq = 5770, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, - 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00), - PHYREGS(0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7), - }, - { .freq = 5775, - RADIOREGS3(0xf8, 0x00, 0x02, 0x04, 0x83, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, - 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00), - PHYREGS(0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7), - }, - { .freq = 5780, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, - 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00), - PHYREGS(0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6), - }, - { .freq = 5785, - RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x85, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00), - PHYREGS(0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6), - }, - { .freq = 5790, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00), - PHYREGS(0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6), - }, - { .freq = 5795, - RADIOREGS3(0xf2, 0x00, 0x02, 0x04, 0x87, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00), - PHYREGS(0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5), - }, - { .freq = 5800, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00), - PHYREGS(0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5), - }, - { .freq = 5805, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x89, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00), - PHYREGS(0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4), - }, - { .freq = 5810, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00), - PHYREGS(0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4), - }, - { .freq = 5815, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8b, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00), - PHYREGS(0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4), - }, - { .freq = 5820, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00), - PHYREGS(0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3), - }, - { .freq = 5825, - RADIOREGS3(0xed, 0x00, 0x02, 0x04, 0x8d, 0x07, 0x07, 0x04, - 0x10, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x69, 0x00), - PHYREGS(0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3), - }, - { .freq = 5830, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x69, 0x00), - PHYREGS(0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2), - }, - { .freq = 5840, - RADIOREGS3(0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00), - PHYREGS(0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2), - }, - { .freq = 5850, - RADIOREGS3(0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00), - PHYREGS(0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1), - }, - { .freq = 5860, - RADIOREGS3(0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00), - PHYREGS(0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0), - }, - { .freq = 5870, - RADIOREGS3(0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00), - PHYREGS(0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf), - }, - { .freq = 5880, - RADIOREGS3(0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00), - PHYREGS(0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf), - }, - { .freq = 5890, - RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00), - PHYREGS(0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be), - }, - { .freq = 5900, - RADIOREGS3(0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00), - PHYREGS(0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd), - }, - { .freq = 5910, - RADIOREGS3(0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x04, - 0x0c, 0x01, 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00), - PHYREGS(0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc), - }, - { .freq = 2412, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x6c, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x04, 0x04, 0x04, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a), - PHYREGS(0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443), - }, - { .freq = 2417, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x71, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a), - PHYREGS(0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441), - }, - { .freq = 2422, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x76, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x67, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a), - PHYREGS(0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f), - }, - { .freq = 2427, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x7b, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x57, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x00, 0x78, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a), - PHYREGS(0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d), - }, - { .freq = 2432, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x80, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x56, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x00, 0x77, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a), - PHYREGS(0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a), - }, - { .freq = 2437, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x85, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x46, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x00, 0x76, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a), - PHYREGS(0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438), - }, - { .freq = 2442, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x8a, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x45, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x00, 0x66, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a), - PHYREGS(0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436), - }, - { .freq = 2447, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x8f, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x34, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x00, 0x55, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09), - PHYREGS(0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434), - }, - { .freq = 2452, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x94, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x23, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x00, 0x45, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09), - PHYREGS(0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431), - }, - { .freq = 2457, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x99, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x12, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x00, 0x34, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09), - PHYREGS(0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f), - }, - { .freq = 2462, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0x9e, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x00, 0x33, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09), - PHYREGS(0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d), - }, - { .freq = 2467, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0xa3, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x00, 0x22, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09), - PHYREGS(0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b), - }, - { .freq = 2472, - RADIOREGS3(0x00, 0x01, 0x03, 0x09, 0xa8, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x00, 0x11, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09), - PHYREGS(0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429), - }, - { .freq = 2484, - RADIOREGS3(0xff, 0x01, 0x03, 0x09, 0xb4, 0x08, 0x08, 0x04, - 0x16, 0x01, 0x07, 0x07, 0x07, 0x8f, 0x20, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09), - PHYREGS(0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424), - }, -}; - -static void b2056_upload_inittab(struct b43_wldev *dev, bool ghz5, - bool ignore_uploadflag, u16 routing, - const struct b2056_inittab_entry *e, - unsigned int length) -{ - unsigned int i; - u16 value; - - for (i = 0; i < length; i++, e++) { - if (!(e->flags & B2056_INITTAB_ENTRY_OK)) - continue; - if ((e->flags & B2056_INITTAB_UPLOAD) || ignore_uploadflag) { - if (ghz5) - value = e->ghz5; - else - value = e->ghz2; - b43_radio_write(dev, routing | i, value); - } - } -} - -void b2056_upload_inittabs(struct b43_wldev *dev, - bool ghz5, bool ignore_uploadflag) -{ - const struct b2056_inittabs_pts *pts; - - if (dev->phy.rev >= ARRAY_SIZE(b2056_inittabs)) { - B43_WARN_ON(1); - return; - } - pts = &b2056_inittabs[dev->phy.rev]; - - b2056_upload_inittab(dev, ghz5, ignore_uploadflag, - B2056_SYN, pts->syn, pts->syn_length); - b2056_upload_inittab(dev, ghz5, ignore_uploadflag, - B2056_TX0, pts->tx, pts->tx_length); - b2056_upload_inittab(dev, ghz5, ignore_uploadflag, - B2056_TX1, pts->tx, pts->tx_length); - b2056_upload_inittab(dev, ghz5, ignore_uploadflag, - B2056_RX0, pts->rx, pts->rx_length); - b2056_upload_inittab(dev, ghz5, ignore_uploadflag, - B2056_RX1, pts->rx, pts->rx_length); -} - -void b2056_upload_syn_pll_cp2(struct b43_wldev *dev, bool ghz5) -{ - const struct b2056_inittabs_pts *pts; - const struct b2056_inittab_entry *e; - - if (dev->phy.rev >= ARRAY_SIZE(b2056_inittabs)) { - B43_WARN_ON(1); - return; - } - pts = &b2056_inittabs[dev->phy.rev]; - e = &pts->syn[B2056_SYN_PLL_CP2]; - - b43_radio_write(dev, B2056_SYN_PLL_CP2, ghz5 ? e->ghz5 : e->ghz2); -} - -const struct b43_nphy_channeltab_entry_rev3 * -b43_nphy_get_chantabent_rev3(struct b43_wldev *dev, u16 freq) -{ - const struct b43_nphy_channeltab_entry_rev3 *e; - unsigned int length, i; - - switch (dev->phy.rev) { - case 3: - e = b43_nphy_channeltab_rev3; - length = ARRAY_SIZE(b43_nphy_channeltab_rev3); - break; - case 4: - e = b43_nphy_channeltab_rev4; - length = ARRAY_SIZE(b43_nphy_channeltab_rev4); - break; - case 5: - e = b43_nphy_channeltab_rev5; - length = ARRAY_SIZE(b43_nphy_channeltab_rev5); - break; - case 6: - e = b43_nphy_channeltab_rev6; - length = ARRAY_SIZE(b43_nphy_channeltab_rev6); - break; - case 7: - case 9: - e = b43_nphy_channeltab_rev7_9; - length = ARRAY_SIZE(b43_nphy_channeltab_rev7_9); - break; - case 8: - e = b43_nphy_channeltab_rev8; - length = ARRAY_SIZE(b43_nphy_channeltab_rev8); - break; - default: - B43_WARN_ON(1); - return NULL; - } - - for (i = 0; i < length; i++, e++) { - if (e->freq == freq) - return e; - } - - return NULL; -} diff --git a/drivers/net/wireless/b43/radio_2056.h b/drivers/net/wireless/b43/radio_2056.h deleted file mode 100644 index 5b86673459fa..000000000000 --- a/drivers/net/wireless/b43/radio_2056.h +++ /dev/null @@ -1,1100 +0,0 @@ -#ifndef B43_RADIO_2056_H_ -#define B43_RADIO_2056_H_ - -#include - -#include "tables_nphy.h" - -#define B2056_SYN (0x0 << 12) -#define B2056_TX0 (0x2 << 12) -#define B2056_TX1 (0x3 << 12) -#define B2056_RX0 (0x6 << 12) -#define B2056_RX1 (0x7 << 12) -#define B2056_ALLTX (0xE << 12) -#define B2056_ALLRX (0xF << 12) - -#define B2056_SYN_RESERVED_ADDR0 0x00 -#define B2056_SYN_IDCODE 0x01 -#define B2056_SYN_RESERVED_ADDR2 0x02 -#define B2056_SYN_RESERVED_ADDR3 0x03 -#define B2056_SYN_RESERVED_ADDR4 0x04 -#define B2056_SYN_RESERVED_ADDR5 0x05 -#define B2056_SYN_RESERVED_ADDR6 0x06 -#define B2056_SYN_RESERVED_ADDR7 0x07 -#define B2056_SYN_COM_CTRL 0x08 -#define B2056_SYN_COM_PU 0x09 -#define B2056_SYN_COM_OVR 0x0A -#define B2056_SYN_COM_RESET 0x0B -#define B2056_SYN_COM_RCAL 0x0C -#define B2056_SYN_COM_RC_RXLPF 0x0D -#define B2056_SYN_COM_RC_TXLPF 0x0E -#define B2056_SYN_COM_RC_RXHPF 0x0F -#define B2056_SYN_RESERVED_ADDR16 0x10 -#define B2056_SYN_RESERVED_ADDR17 0x11 -#define B2056_SYN_RESERVED_ADDR18 0x12 -#define B2056_SYN_RESERVED_ADDR19 0x13 -#define B2056_SYN_RESERVED_ADDR20 0x14 -#define B2056_SYN_RESERVED_ADDR21 0x15 -#define B2056_SYN_RESERVED_ADDR22 0x16 -#define B2056_SYN_RESERVED_ADDR23 0x17 -#define B2056_SYN_RESERVED_ADDR24 0x18 -#define B2056_SYN_RESERVED_ADDR25 0x19 -#define B2056_SYN_RESERVED_ADDR26 0x1A -#define B2056_SYN_RESERVED_ADDR27 0x1B -#define B2056_SYN_RESERVED_ADDR28 0x1C -#define B2056_SYN_RESERVED_ADDR29 0x1D -#define B2056_SYN_RESERVED_ADDR30 0x1E -#define B2056_SYN_RESERVED_ADDR31 0x1F -#define B2056_SYN_GPIO_MASTER1 0x20 -#define B2056_SYN_GPIO_MASTER2 0x21 -#define B2056_SYN_TOPBIAS_MASTER 0x22 -#define B2056_SYN_TOPBIAS_RCAL 0x23 -#define B2056_SYN_AFEREG 0x24 -#define B2056_SYN_TEMPPROCSENSE 0x25 -#define B2056_SYN_TEMPPROCSENSEIDAC 0x26 -#define B2056_SYN_TEMPPROCSENSERCAL 0x27 -#define B2056_SYN_LPO 0x28 -#define B2056_SYN_VDDCAL_MASTER 0x29 -#define B2056_SYN_VDDCAL_IDAC 0x2A -#define B2056_SYN_VDDCAL_STATUS 0x2B -#define B2056_SYN_RCAL_MASTER 0x2C -#define B2056_SYN_RCAL_CODE_OUT 0x2D -#define B2056_SYN_RCCAL_CTRL0 0x2E -#define B2056_SYN_RCCAL_CTRL1 0x2F -#define B2056_SYN_RCCAL_CTRL2 0x30 -#define B2056_SYN_RCCAL_CTRL3 0x31 -#define B2056_SYN_RCCAL_CTRL4 0x32 -#define B2056_SYN_RCCAL_CTRL5 0x33 -#define B2056_SYN_RCCAL_CTRL6 0x34 -#define B2056_SYN_RCCAL_CTRL7 0x35 -#define B2056_SYN_RCCAL_CTRL8 0x36 -#define B2056_SYN_RCCAL_CTRL9 0x37 -#define B2056_SYN_RCCAL_CTRL10 0x38 -#define B2056_SYN_RCCAL_CTRL11 0x39 -#define B2056_SYN_ZCAL_SPARE1 0x3A -#define B2056_SYN_ZCAL_SPARE2 0x3B -#define B2056_SYN_PLL_MAST1 0x3C -#define B2056_SYN_PLL_MAST2 0x3D -#define B2056_SYN_PLL_MAST3 0x3E -#define B2056_SYN_PLL_BIAS_RESET 0x3F -#define B2056_SYN_PLL_XTAL0 0x40 -#define B2056_SYN_PLL_XTAL1 0x41 -#define B2056_SYN_PLL_XTAL3 0x42 -#define B2056_SYN_PLL_XTAL4 0x43 -#define B2056_SYN_PLL_XTAL5 0x44 -#define B2056_SYN_PLL_XTAL6 0x45 -#define B2056_SYN_PLL_REFDIV 0x46 -#define B2056_SYN_PLL_PFD 0x47 -#define B2056_SYN_PLL_CP1 0x48 -#define B2056_SYN_PLL_CP2 0x49 -#define B2056_SYN_PLL_CP3 0x4A -#define B2056_SYN_PLL_LOOPFILTER1 0x4B -#define B2056_SYN_PLL_LOOPFILTER2 0x4C -#define B2056_SYN_PLL_LOOPFILTER3 0x4D -#define B2056_SYN_PLL_LOOPFILTER4 0x4E -#define B2056_SYN_PLL_LOOPFILTER5 0x4F -#define B2056_SYN_PLL_MMD1 0x50 -#define B2056_SYN_PLL_MMD2 0x51 -#define B2056_SYN_PLL_VCO1 0x52 -#define B2056_SYN_PLL_VCO2 0x53 -#define B2056_SYN_PLL_MONITOR1 0x54 -#define B2056_SYN_PLL_MONITOR2 0x55 -#define B2056_SYN_PLL_VCOCAL1 0x56 -#define B2056_SYN_PLL_VCOCAL2 0x57 -#define B2056_SYN_PLL_VCOCAL4 0x58 -#define B2056_SYN_PLL_VCOCAL5 0x59 -#define B2056_SYN_PLL_VCOCAL6 0x5A -#define B2056_SYN_PLL_VCOCAL7 0x5B -#define B2056_SYN_PLL_VCOCAL8 0x5C -#define B2056_SYN_PLL_VCOCAL9 0x5D -#define B2056_SYN_PLL_VCOCAL10 0x5E -#define B2056_SYN_PLL_VCOCAL11 0x5F -#define B2056_SYN_PLL_VCOCAL12 0x60 -#define B2056_SYN_PLL_VCOCAL13 0x61 -#define B2056_SYN_PLL_VREG 0x62 -#define B2056_SYN_PLL_STATUS1 0x63 -#define B2056_SYN_PLL_STATUS2 0x64 -#define B2056_SYN_PLL_STATUS3 0x65 -#define B2056_SYN_LOGEN_PU0 0x66 -#define B2056_SYN_LOGEN_PU1 0x67 -#define B2056_SYN_LOGEN_PU2 0x68 -#define B2056_SYN_LOGEN_PU3 0x69 -#define B2056_SYN_LOGEN_PU5 0x6A -#define B2056_SYN_LOGEN_PU6 0x6B -#define B2056_SYN_LOGEN_PU7 0x6C -#define B2056_SYN_LOGEN_PU8 0x6D -#define B2056_SYN_LOGEN_BIAS_RESET 0x6E -#define B2056_SYN_LOGEN_RCCR1 0x6F -#define B2056_SYN_LOGEN_VCOBUF1 0x70 -#define B2056_SYN_LOGEN_MIXER1 0x71 -#define B2056_SYN_LOGEN_MIXER2 0x72 -#define B2056_SYN_LOGEN_BUF1 0x73 -#define B2056_SYN_LOGENBUF2 0x74 -#define B2056_SYN_LOGEN_BUF3 0x75 -#define B2056_SYN_LOGEN_BUF4 0x76 -#define B2056_SYN_LOGEN_DIV1 0x77 -#define B2056_SYN_LOGEN_DIV2 0x78 -#define B2056_SYN_LOGEN_DIV3 0x79 -#define B2056_SYN_LOGEN_ACL1 0x7A -#define B2056_SYN_LOGEN_ACL2 0x7B -#define B2056_SYN_LOGEN_ACL3 0x7C -#define B2056_SYN_LOGEN_ACL4 0x7D -#define B2056_SYN_LOGEN_ACL5 0x7E -#define B2056_SYN_LOGEN_ACL6 0x7F -#define B2056_SYN_LOGEN_ACLOUT 0x80 -#define B2056_SYN_LOGEN_ACLCAL1 0x81 -#define B2056_SYN_LOGEN_ACLCAL2 0x82 -#define B2056_SYN_LOGEN_ACLCAL3 0x83 -#define B2056_SYN_CALEN 0x84 -#define B2056_SYN_LOGEN_PEAKDET1 0x85 -#define B2056_SYN_LOGEN_CORE_ACL_OVR 0x86 -#define B2056_SYN_LOGEN_RX_DIFF_ACL_OVR 0x87 -#define B2056_SYN_LOGEN_TX_DIFF_ACL_OVR 0x88 -#define B2056_SYN_LOGEN_RX_CMOS_ACL_OVR 0x89 -#define B2056_SYN_LOGEN_TX_CMOS_ACL_OVR 0x8A -#define B2056_SYN_LOGEN_VCOBUF2 0x8B -#define B2056_SYN_LOGEN_MIXER3 0x8C -#define B2056_SYN_LOGEN_BUF5 0x8D -#define B2056_SYN_LOGEN_BUF6 0x8E -#define B2056_SYN_LOGEN_CBUFRX1 0x8F -#define B2056_SYN_LOGEN_CBUFRX2 0x90 -#define B2056_SYN_LOGEN_CBUFRX3 0x91 -#define B2056_SYN_LOGEN_CBUFRX4 0x92 -#define B2056_SYN_LOGEN_CBUFTX1 0x93 -#define B2056_SYN_LOGEN_CBUFTX2 0x94 -#define B2056_SYN_LOGEN_CBUFTX3 0x95 -#define B2056_SYN_LOGEN_CBUFTX4 0x96 -#define B2056_SYN_LOGEN_CMOSRX1 0x97 -#define B2056_SYN_LOGEN_CMOSRX2 0x98 -#define B2056_SYN_LOGEN_CMOSRX3 0x99 -#define B2056_SYN_LOGEN_CMOSRX4 0x9A -#define B2056_SYN_LOGEN_CMOSTX1 0x9B -#define B2056_SYN_LOGEN_CMOSTX2 0x9C -#define B2056_SYN_LOGEN_CMOSTX3 0x9D -#define B2056_SYN_LOGEN_CMOSTX4 0x9E -#define B2056_SYN_LOGEN_VCOBUF2_OVRVAL 0x9F -#define B2056_SYN_LOGEN_MIXER3_OVRVAL 0xA0 -#define B2056_SYN_LOGEN_BUF5_OVRVAL 0xA1 -#define B2056_SYN_LOGEN_BUF6_OVRVAL 0xA2 -#define B2056_SYN_LOGEN_CBUFRX1_OVRVAL 0xA3 -#define B2056_SYN_LOGEN_CBUFRX2_OVRVAL 0xA4 -#define B2056_SYN_LOGEN_CBUFRX3_OVRVAL 0xA5 -#define B2056_SYN_LOGEN_CBUFRX4_OVRVAL 0xA6 -#define B2056_SYN_LOGEN_CBUFTX1_OVRVAL 0xA7 -#define B2056_SYN_LOGEN_CBUFTX2_OVRVAL 0xA8 -#define B2056_SYN_LOGEN_CBUFTX3_OVRVAL 0xA9 -#define B2056_SYN_LOGEN_CBUFTX4_OVRVAL 0xAA -#define B2056_SYN_LOGEN_CMOSRX1_OVRVAL 0xAB -#define B2056_SYN_LOGEN_CMOSRX2_OVRVAL 0xAC -#define B2056_SYN_LOGEN_CMOSRX3_OVRVAL 0xAD -#define B2056_SYN_LOGEN_CMOSRX4_OVRVAL 0xAE -#define B2056_SYN_LOGEN_CMOSTX1_OVRVAL 0xAF -#define B2056_SYN_LOGEN_CMOSTX2_OVRVAL 0xB0 -#define B2056_SYN_LOGEN_CMOSTX3_OVRVAL 0xB1 -#define B2056_SYN_LOGEN_CMOSTX4_OVRVAL 0xB2 -#define B2056_SYN_LOGEN_ACL_WAITCNT 0xB3 -#define B2056_SYN_LOGEN_CORE_CALVALID 0xB4 -#define B2056_SYN_LOGEN_RX_CMOS_CALVALID 0xB5 -#define B2056_SYN_LOGEN_TX_CMOS_VALID 0xB6 - -#define B2056_TX_RESERVED_ADDR0 0x00 -#define B2056_TX_IDCODE 0x01 -#define B2056_TX_RESERVED_ADDR2 0x02 -#define B2056_TX_RESERVED_ADDR3 0x03 -#define B2056_TX_RESERVED_ADDR4 0x04 -#define B2056_TX_RESERVED_ADDR5 0x05 -#define B2056_TX_RESERVED_ADDR6 0x06 -#define B2056_TX_RESERVED_ADDR7 0x07 -#define B2056_TX_COM_CTRL 0x08 -#define B2056_TX_COM_PU 0x09 -#define B2056_TX_COM_OVR 0x0A -#define B2056_TX_COM_RESET 0x0B -#define B2056_TX_COM_RCAL 0x0C -#define B2056_TX_COM_RC_RXLPF 0x0D -#define B2056_TX_COM_RC_TXLPF 0x0E -#define B2056_TX_COM_RC_RXHPF 0x0F -#define B2056_TX_RESERVED_ADDR16 0x10 -#define B2056_TX_RESERVED_ADDR17 0x11 -#define B2056_TX_RESERVED_ADDR18 0x12 -#define B2056_TX_RESERVED_ADDR19 0x13 -#define B2056_TX_RESERVED_ADDR20 0x14 -#define B2056_TX_RESERVED_ADDR21 0x15 -#define B2056_TX_RESERVED_ADDR22 0x16 -#define B2056_TX_RESERVED_ADDR23 0x17 -#define B2056_TX_RESERVED_ADDR24 0x18 -#define B2056_TX_RESERVED_ADDR25 0x19 -#define B2056_TX_RESERVED_ADDR26 0x1A -#define B2056_TX_RESERVED_ADDR27 0x1B -#define B2056_TX_RESERVED_ADDR28 0x1C -#define B2056_TX_RESERVED_ADDR29 0x1D -#define B2056_TX_RESERVED_ADDR30 0x1E -#define B2056_TX_RESERVED_ADDR31 0x1F -#define B2056_TX_IQCAL_GAIN_BW 0x20 -#define B2056_TX_LOFT_FINE_I 0x21 -#define B2056_TX_LOFT_FINE_Q 0x22 -#define B2056_TX_LOFT_COARSE_I 0x23 -#define B2056_TX_LOFT_COARSE_Q 0x24 -#define B2056_TX_TX_COM_MASTER1 0x25 -#define B2056_TX_TX_COM_MASTER2 0x26 -#define B2056_TX_RXIQCAL_TXMUX 0x27 -#define B2056_TX_TX_SSI_MASTER 0x28 -#define B2056_TX_IQCAL_VCM_HG 0x29 -#define B2056_TX_IQCAL_IDAC 0x2A -#define B2056_TX_TSSI_VCM 0x2B -#define B2056_TX_TX_AMP_DET 0x2C -#define B2056_TX_TX_SSI_MUX 0x2D -#define B2056_TX_TSSIA 0x2E -#define B2056_TX_TSSIG 0x2F -#define B2056_TX_TSSI_MISC1 0x30 -#define B2056_TX_TSSI_MISC2 0x31 -#define B2056_TX_TSSI_MISC3 0x32 -#define B2056_TX_PA_SPARE1 0x33 -#define B2056_TX_PA_SPARE2 0x34 -#define B2056_TX_INTPAA_MASTER 0x35 -#define B2056_TX_INTPAA_GAIN 0x36 -#define B2056_TX_INTPAA_BOOST_TUNE 0x37 -#define B2056_TX_INTPAA_IAUX_STAT 0x38 -#define B2056_TX_INTPAA_IAUX_DYN 0x39 -#define B2056_TX_INTPAA_IMAIN_STAT 0x3A -#define B2056_TX_INTPAA_IMAIN_DYN 0x3B -#define B2056_TX_INTPAA_CASCBIAS 0x3C -#define B2056_TX_INTPAA_PASLOPE 0x3D -#define B2056_TX_INTPAA_PA_MISC 0x3E -#define B2056_TX_INTPAG_MASTER 0x3F -#define B2056_TX_INTPAG_GAIN 0x40 -#define B2056_TX_INTPAG_BOOST_TUNE 0x41 -#define B2056_TX_INTPAG_IAUX_STAT 0x42 -#define B2056_TX_INTPAG_IAUX_DYN 0x43 -#define B2056_TX_INTPAG_IMAIN_STAT 0x44 -#define B2056_TX_INTPAG_IMAIN_DYN 0x45 -#define B2056_TX_INTPAG_CASCBIAS 0x46 -#define B2056_TX_INTPAG_PASLOPE 0x47 -#define B2056_TX_INTPAG_PA_MISC 0x48 -#define B2056_TX_PADA_MASTER 0x49 -#define B2056_TX_PADA_IDAC 0x4A -#define B2056_TX_PADA_CASCBIAS 0x4B -#define B2056_TX_PADA_GAIN 0x4C -#define B2056_TX_PADA_BOOST_TUNE 0x4D -#define B2056_TX_PADA_SLOPE 0x4E -#define B2056_TX_PADG_MASTER 0x4F -#define B2056_TX_PADG_IDAC 0x50 -#define B2056_TX_PADG_CASCBIAS 0x51 -#define B2056_TX_PADG_GAIN 0x52 -#define B2056_TX_PADG_BOOST_TUNE 0x53 -#define B2056_TX_PADG_SLOPE 0x54 -#define B2056_TX_PGAA_MASTER 0x55 -#define B2056_TX_PGAA_IDAC 0x56 -#define B2056_TX_PGAA_GAIN 0x57 -#define B2056_TX_PGAA_BOOST_TUNE 0x58 -#define B2056_TX_PGAA_SLOPE 0x59 -#define B2056_TX_PGAA_MISC 0x5A -#define B2056_TX_PGAG_MASTER 0x5B -#define B2056_TX_PGAG_IDAC 0x5C -#define B2056_TX_PGAG_GAIN 0x5D -#define B2056_TX_PGAG_BOOST_TUNE 0x5E -#define B2056_TX_PGAG_SLOPE 0x5F -#define B2056_TX_PGAG_MISC 0x60 -#define B2056_TX_MIXA_MASTER 0x61 -#define B2056_TX_MIXA_BOOST_TUNE 0x62 -#define B2056_TX_MIXG 0x63 -#define B2056_TX_MIXG_BOOST_TUNE 0x64 -#define B2056_TX_BB_GM_MASTER 0x65 -#define B2056_TX_GMBB_GM 0x66 -#define B2056_TX_GMBB_IDAC 0x67 -#define B2056_TX_TXLPF_MASTER 0x68 -#define B2056_TX_TXLPF_RCCAL 0x69 -#define B2056_TX_TXLPF_RCCAL_OFF0 0x6A -#define B2056_TX_TXLPF_RCCAL_OFF1 0x6B -#define B2056_TX_TXLPF_RCCAL_OFF2 0x6C -#define B2056_TX_TXLPF_RCCAL_OFF3 0x6D -#define B2056_TX_TXLPF_RCCAL_OFF4 0x6E -#define B2056_TX_TXLPF_RCCAL_OFF5 0x6F -#define B2056_TX_TXLPF_RCCAL_OFF6 0x70 -#define B2056_TX_TXLPF_BW 0x71 -#define B2056_TX_TXLPF_GAIN 0x72 -#define B2056_TX_TXLPF_IDAC 0x73 -#define B2056_TX_TXLPF_IDAC_0 0x74 -#define B2056_TX_TXLPF_IDAC_1 0x75 -#define B2056_TX_TXLPF_IDAC_2 0x76 -#define B2056_TX_TXLPF_IDAC_3 0x77 -#define B2056_TX_TXLPF_IDAC_4 0x78 -#define B2056_TX_TXLPF_IDAC_5 0x79 -#define B2056_TX_TXLPF_IDAC_6 0x7A -#define B2056_TX_TXLPF_OPAMP_IDAC 0x7B -#define B2056_TX_TXLPF_MISC 0x7C -#define B2056_TX_TXSPARE1 0x7D -#define B2056_TX_TXSPARE2 0x7E -#define B2056_TX_TXSPARE3 0x7F -#define B2056_TX_TXSPARE4 0x80 -#define B2056_TX_TXSPARE5 0x81 -#define B2056_TX_TXSPARE6 0x82 -#define B2056_TX_TXSPARE7 0x83 -#define B2056_TX_TXSPARE8 0x84 -#define B2056_TX_TXSPARE9 0x85 -#define B2056_TX_TXSPARE10 0x86 -#define B2056_TX_TXSPARE11 0x87 -#define B2056_TX_TXSPARE12 0x88 -#define B2056_TX_TXSPARE13 0x89 -#define B2056_TX_TXSPARE14 0x8A -#define B2056_TX_TXSPARE15 0x8B -#define B2056_TX_TXSPARE16 0x8C -#define B2056_TX_STATUS_INTPA_GAIN 0x8D -#define B2056_TX_STATUS_PAD_GAIN 0x8E -#define B2056_TX_STATUS_PGA_GAIN 0x8F -#define B2056_TX_STATUS_GM_TXLPF_GAIN 0x90 -#define B2056_TX_STATUS_TXLPF_BW 0x91 -#define B2056_TX_STATUS_TXLPF_RC 0x92 -#define B2056_TX_GMBB_IDAC0 0x93 -#define B2056_TX_GMBB_IDAC1 0x94 -#define B2056_TX_GMBB_IDAC2 0x95 -#define B2056_TX_GMBB_IDAC3 0x96 -#define B2056_TX_GMBB_IDAC4 0x97 -#define B2056_TX_GMBB_IDAC5 0x98 -#define B2056_TX_GMBB_IDAC6 0x99 -#define B2056_TX_GMBB_IDAC7 0x9A - -#define B2056_RX_RESERVED_ADDR0 0x00 -#define B2056_RX_IDCODE 0x01 -#define B2056_RX_RESERVED_ADDR2 0x02 -#define B2056_RX_RESERVED_ADDR3 0x03 -#define B2056_RX_RESERVED_ADDR4 0x04 -#define B2056_RX_RESERVED_ADDR5 0x05 -#define B2056_RX_RESERVED_ADDR6 0x06 -#define B2056_RX_RESERVED_ADDR7 0x07 -#define B2056_RX_COM_CTRL 0x08 -#define B2056_RX_COM_PU 0x09 -#define B2056_RX_COM_OVR 0x0A -#define B2056_RX_COM_RESET 0x0B -#define B2056_RX_COM_RCAL 0x0C -#define B2056_RX_COM_RC_RXLPF 0x0D -#define B2056_RX_COM_RC_TXLPF 0x0E -#define B2056_RX_COM_RC_RXHPF 0x0F -#define B2056_RX_RESERVED_ADDR16 0x10 -#define B2056_RX_RESERVED_ADDR17 0x11 -#define B2056_RX_RESERVED_ADDR18 0x12 -#define B2056_RX_RESERVED_ADDR19 0x13 -#define B2056_RX_RESERVED_ADDR20 0x14 -#define B2056_RX_RESERVED_ADDR21 0x15 -#define B2056_RX_RESERVED_ADDR22 0x16 -#define B2056_RX_RESERVED_ADDR23 0x17 -#define B2056_RX_RESERVED_ADDR24 0x18 -#define B2056_RX_RESERVED_ADDR25 0x19 -#define B2056_RX_RESERVED_ADDR26 0x1A -#define B2056_RX_RESERVED_ADDR27 0x1B -#define B2056_RX_RESERVED_ADDR28 0x1C -#define B2056_RX_RESERVED_ADDR29 0x1D -#define B2056_RX_RESERVED_ADDR30 0x1E -#define B2056_RX_RESERVED_ADDR31 0x1F -#define B2056_RX_RXIQCAL_RXMUX 0x20 -#define B2056_RX_RSSI_PU 0x21 -#define B2056_RX_RSSI_SEL 0x22 -#define B2056_RX_RSSI_GAIN 0x23 -#define B2056_RX_RSSI_NB_IDAC 0x24 -#define B2056_RX_RSSI_WB2I_IDAC_1 0x25 -#define B2056_RX_RSSI_WB2I_IDAC_2 0x26 -#define B2056_RX_RSSI_WB2Q_IDAC_1 0x27 -#define B2056_RX_RSSI_WB2Q_IDAC_2 0x28 -#define B2056_RX_RSSI_POLE 0x29 -#define B2056_RX_RSSI_WB1_IDAC 0x2A -#define B2056_RX_RSSI_MISC 0x2B -#define B2056_RX_LNAA_MASTER 0x2C -#define B2056_RX_LNAA_TUNE 0x2D -#define B2056_RX_LNAA_GAIN 0x2E -#define B2056_RX_LNA_A_SLOPE 0x2F -#define B2056_RX_BIASPOLE_LNAA1_IDAC 0x30 -#define B2056_RX_LNAA2_IDAC 0x31 -#define B2056_RX_LNA1A_MISC 0x32 -#define B2056_RX_LNAG_MASTER 0x33 -#define B2056_RX_LNAG_TUNE 0x34 -#define B2056_RX_LNAG_GAIN 0x35 -#define B2056_RX_LNA_G_SLOPE 0x36 -#define B2056_RX_BIASPOLE_LNAG1_IDAC 0x37 -#define B2056_RX_LNAG2_IDAC 0x38 -#define B2056_RX_LNA1G_MISC 0x39 -#define B2056_RX_MIXA_MASTER 0x3A -#define B2056_RX_MIXA_VCM 0x3B -#define B2056_RX_MIXA_CTRLPTAT 0x3C -#define B2056_RX_MIXA_LOB_BIAS 0x3D -#define B2056_RX_MIXA_CORE_IDAC 0x3E -#define B2056_RX_MIXA_CMFB_IDAC 0x3F -#define B2056_RX_MIXA_BIAS_AUX 0x40 -#define B2056_RX_MIXA_BIAS_MAIN 0x41 -#define B2056_RX_MIXA_BIAS_MISC 0x42 -#define B2056_RX_MIXA_MAST_BIAS 0x43 -#define B2056_RX_MIXG_MASTER 0x44 -#define B2056_RX_MIXG_VCM 0x45 -#define B2056_RX_MIXG_CTRLPTAT 0x46 -#define B2056_RX_MIXG_LOB_BIAS 0x47 -#define B2056_RX_MIXG_CORE_IDAC 0x48 -#define B2056_RX_MIXG_CMFB_IDAC 0x49 -#define B2056_RX_MIXG_BIAS_AUX 0x4A -#define B2056_RX_MIXG_BIAS_MAIN 0x4B -#define B2056_RX_MIXG_BIAS_MISC 0x4C -#define B2056_RX_MIXG_MAST_BIAS 0x4D -#define B2056_RX_TIA_MASTER 0x4E -#define B2056_RX_TIA_IOPAMP 0x4F -#define B2056_RX_TIA_QOPAMP 0x50 -#define B2056_RX_TIA_IMISC 0x51 -#define B2056_RX_TIA_QMISC 0x52 -#define B2056_RX_TIA_GAIN 0x53 -#define B2056_RX_TIA_SPARE1 0x54 -#define B2056_RX_TIA_SPARE2 0x55 -#define B2056_RX_BB_LPF_MASTER 0x56 -#define B2056_RX_AACI_MASTER 0x57 -#define B2056_RX_RXLPF_IDAC 0x58 -#define B2056_RX_RXLPF_OPAMPBIAS_LOWQ 0x59 -#define B2056_RX_RXLPF_OPAMPBIAS_HIGHQ 0x5A -#define B2056_RX_RXLPF_BIAS_DCCANCEL 0x5B -#define B2056_RX_RXLPF_OUTVCM 0x5C -#define B2056_RX_RXLPF_INVCM_BODY 0x5D -#define B2056_RX_RXLPF_CC_OP 0x5E -#define B2056_RX_RXLPF_GAIN 0x5F -#define B2056_RX_RXLPF_Q_BW 0x60 -#define B2056_RX_RXLPF_HP_CORNER_BW 0x61 -#define B2056_RX_RXLPF_RCCAL_HPC 0x62 -#define B2056_RX_RXHPF_OFF0 0x63 -#define B2056_RX_RXHPF_OFF1 0x64 -#define B2056_RX_RXHPF_OFF2 0x65 -#define B2056_RX_RXHPF_OFF3 0x66 -#define B2056_RX_RXHPF_OFF4 0x67 -#define B2056_RX_RXHPF_OFF5 0x68 -#define B2056_RX_RXHPF_OFF6 0x69 -#define B2056_RX_RXHPF_OFF7 0x6A -#define B2056_RX_RXLPF_RCCAL_LPC 0x6B -#define B2056_RX_RXLPF_OFF_0 0x6C -#define B2056_RX_RXLPF_OFF_1 0x6D -#define B2056_RX_RXLPF_OFF_2 0x6E -#define B2056_RX_RXLPF_OFF_3 0x6F -#define B2056_RX_RXLPF_OFF_4 0x70 -#define B2056_RX_UNUSED 0x71 -#define B2056_RX_VGA_MASTER 0x72 -#define B2056_RX_VGA_BIAS 0x73 -#define B2056_RX_VGA_BIAS_DCCANCEL 0x74 -#define B2056_RX_VGA_GAIN 0x75 -#define B2056_RX_VGA_HP_CORNER_BW 0x76 -#define B2056_RX_VGABUF_BIAS 0x77 -#define B2056_RX_VGABUF_GAIN_BW 0x78 -#define B2056_RX_TXFBMIX_A 0x79 -#define B2056_RX_TXFBMIX_G 0x7A -#define B2056_RX_RXSPARE1 0x7B -#define B2056_RX_RXSPARE2 0x7C -#define B2056_RX_RXSPARE3 0x7D -#define B2056_RX_RXSPARE4 0x7E -#define B2056_RX_RXSPARE5 0x7F -#define B2056_RX_RXSPARE6 0x80 -#define B2056_RX_RXSPARE7 0x81 -#define B2056_RX_RXSPARE8 0x82 -#define B2056_RX_RXSPARE9 0x83 -#define B2056_RX_RXSPARE10 0x84 -#define B2056_RX_RXSPARE11 0x85 -#define B2056_RX_RXSPARE12 0x86 -#define B2056_RX_RXSPARE13 0x87 -#define B2056_RX_RXSPARE14 0x88 -#define B2056_RX_RXSPARE15 0x89 -#define B2056_RX_RXSPARE16 0x8A -#define B2056_RX_STATUS_LNAA_GAIN 0x8B -#define B2056_RX_STATUS_LNAG_GAIN 0x8C -#define B2056_RX_STATUS_MIXTIA_GAIN 0x8D -#define B2056_RX_STATUS_RXLPF_GAIN 0x8E -#define B2056_RX_STATUS_VGA_BUF_GAIN 0x8F -#define B2056_RX_STATUS_RXLPF_Q 0x90 -#define B2056_RX_STATUS_RXLPF_BUF_BW 0x91 -#define B2056_RX_STATUS_RXLPF_VGA_HPC 0x92 -#define B2056_RX_STATUS_RXLPF_RC 0x93 -#define B2056_RX_STATUS_HPC_RC 0x94 - -#define B2056_LNA1_A_PU 0x01 -#define B2056_LNA2_A_PU 0x02 -#define B2056_LNA1_G_PU 0x01 -#define B2056_LNA2_G_PU 0x02 -#define B2056_MIXA_PU_I 0x01 -#define B2056_MIXA_PU_Q 0x02 -#define B2056_MIXA_PU_GM 0x10 -#define B2056_MIXG_PU_I 0x01 -#define B2056_MIXG_PU_Q 0x02 -#define B2056_MIXG_PU_GM 0x10 -#define B2056_TIA_PU 0x01 -#define B2056_BB_LPF_PU 0x20 -#define B2056_W1_PU 0x02 -#define B2056_W2_PU 0x04 -#define B2056_NB_PU 0x08 -#define B2056_RSSI_W1_SEL 0x02 -#define B2056_RSSI_W2_SEL 0x04 -#define B2056_RSSI_NB_SEL 0x08 -#define B2056_VCM_MASK 0x1C -#define B2056_RSSI_VCM_SHIFT 0x02 - -#define B2056_SYN (0x0 << 12) -#define B2056_TX0 (0x2 << 12) -#define B2056_TX1 (0x3 << 12) -#define B2056_RX0 (0x6 << 12) -#define B2056_RX1 (0x7 << 12) -#define B2056_ALLTX (0xE << 12) -#define B2056_ALLRX (0xF << 12) - -#define B2056_SYN_RESERVED_ADDR0 0x00 -#define B2056_SYN_IDCODE 0x01 -#define B2056_SYN_RESERVED_ADDR2 0x02 -#define B2056_SYN_RESERVED_ADDR3 0x03 -#define B2056_SYN_RESERVED_ADDR4 0x04 -#define B2056_SYN_RESERVED_ADDR5 0x05 -#define B2056_SYN_RESERVED_ADDR6 0x06 -#define B2056_SYN_RESERVED_ADDR7 0x07 -#define B2056_SYN_COM_CTRL 0x08 -#define B2056_SYN_COM_PU 0x09 -#define B2056_SYN_COM_OVR 0x0A -#define B2056_SYN_COM_RESET 0x0B -#define B2056_SYN_COM_RCAL 0x0C -#define B2056_SYN_COM_RC_RXLPF 0x0D -#define B2056_SYN_COM_RC_TXLPF 0x0E -#define B2056_SYN_COM_RC_RXHPF 0x0F -#define B2056_SYN_RESERVED_ADDR16 0x10 -#define B2056_SYN_RESERVED_ADDR17 0x11 -#define B2056_SYN_RESERVED_ADDR18 0x12 -#define B2056_SYN_RESERVED_ADDR19 0x13 -#define B2056_SYN_RESERVED_ADDR20 0x14 -#define B2056_SYN_RESERVED_ADDR21 0x15 -#define B2056_SYN_RESERVED_ADDR22 0x16 -#define B2056_SYN_RESERVED_ADDR23 0x17 -#define B2056_SYN_RESERVED_ADDR24 0x18 -#define B2056_SYN_RESERVED_ADDR25 0x19 -#define B2056_SYN_RESERVED_ADDR26 0x1A -#define B2056_SYN_RESERVED_ADDR27 0x1B -#define B2056_SYN_RESERVED_ADDR28 0x1C -#define B2056_SYN_RESERVED_ADDR29 0x1D -#define B2056_SYN_RESERVED_ADDR30 0x1E -#define B2056_SYN_RESERVED_ADDR31 0x1F -#define B2056_SYN_GPIO_MASTER1 0x20 -#define B2056_SYN_GPIO_MASTER2 0x21 -#define B2056_SYN_TOPBIAS_MASTER 0x22 -#define B2056_SYN_TOPBIAS_RCAL 0x23 -#define B2056_SYN_AFEREG 0x24 -#define B2056_SYN_TEMPPROCSENSE 0x25 -#define B2056_SYN_TEMPPROCSENSEIDAC 0x26 -#define B2056_SYN_TEMPPROCSENSERCAL 0x27 -#define B2056_SYN_LPO 0x28 -#define B2056_SYN_VDDCAL_MASTER 0x29 -#define B2056_SYN_VDDCAL_IDAC 0x2A -#define B2056_SYN_VDDCAL_STATUS 0x2B -#define B2056_SYN_RCAL_MASTER 0x2C -#define B2056_SYN_RCAL_CODE_OUT 0x2D -#define B2056_SYN_RCCAL_CTRL0 0x2E -#define B2056_SYN_RCCAL_CTRL1 0x2F -#define B2056_SYN_RCCAL_CTRL2 0x30 -#define B2056_SYN_RCCAL_CTRL3 0x31 -#define B2056_SYN_RCCAL_CTRL4 0x32 -#define B2056_SYN_RCCAL_CTRL5 0x33 -#define B2056_SYN_RCCAL_CTRL6 0x34 -#define B2056_SYN_RCCAL_CTRL7 0x35 -#define B2056_SYN_RCCAL_CTRL8 0x36 -#define B2056_SYN_RCCAL_CTRL9 0x37 -#define B2056_SYN_RCCAL_CTRL10 0x38 -#define B2056_SYN_RCCAL_CTRL11 0x39 -#define B2056_SYN_ZCAL_SPARE1 0x3A -#define B2056_SYN_ZCAL_SPARE2 0x3B -#define B2056_SYN_PLL_MAST1 0x3C -#define B2056_SYN_PLL_MAST2 0x3D -#define B2056_SYN_PLL_MAST3 0x3E -#define B2056_SYN_PLL_BIAS_RESET 0x3F -#define B2056_SYN_PLL_XTAL0 0x40 -#define B2056_SYN_PLL_XTAL1 0x41 -#define B2056_SYN_PLL_XTAL3 0x42 -#define B2056_SYN_PLL_XTAL4 0x43 -#define B2056_SYN_PLL_XTAL5 0x44 -#define B2056_SYN_PLL_XTAL6 0x45 -#define B2056_SYN_PLL_REFDIV 0x46 -#define B2056_SYN_PLL_PFD 0x47 -#define B2056_SYN_PLL_CP1 0x48 -#define B2056_SYN_PLL_CP2 0x49 -#define B2056_SYN_PLL_CP3 0x4A -#define B2056_SYN_PLL_LOOPFILTER1 0x4B -#define B2056_SYN_PLL_LOOPFILTER2 0x4C -#define B2056_SYN_PLL_LOOPFILTER3 0x4D -#define B2056_SYN_PLL_LOOPFILTER4 0x4E -#define B2056_SYN_PLL_LOOPFILTER5 0x4F -#define B2056_SYN_PLL_MMD1 0x50 -#define B2056_SYN_PLL_MMD2 0x51 -#define B2056_SYN_PLL_VCO1 0x52 -#define B2056_SYN_PLL_VCO2 0x53 -#define B2056_SYN_PLL_MONITOR1 0x54 -#define B2056_SYN_PLL_MONITOR2 0x55 -#define B2056_SYN_PLL_VCOCAL1 0x56 -#define B2056_SYN_PLL_VCOCAL2 0x57 -#define B2056_SYN_PLL_VCOCAL4 0x58 -#define B2056_SYN_PLL_VCOCAL5 0x59 -#define B2056_SYN_PLL_VCOCAL6 0x5A -#define B2056_SYN_PLL_VCOCAL7 0x5B -#define B2056_SYN_PLL_VCOCAL8 0x5C -#define B2056_SYN_PLL_VCOCAL9 0x5D -#define B2056_SYN_PLL_VCOCAL10 0x5E -#define B2056_SYN_PLL_VCOCAL11 0x5F -#define B2056_SYN_PLL_VCOCAL12 0x60 -#define B2056_SYN_PLL_VCOCAL13 0x61 -#define B2056_SYN_PLL_VREG 0x62 -#define B2056_SYN_PLL_STATUS1 0x63 -#define B2056_SYN_PLL_STATUS2 0x64 -#define B2056_SYN_PLL_STATUS3 0x65 -#define B2056_SYN_LOGEN_PU0 0x66 -#define B2056_SYN_LOGEN_PU1 0x67 -#define B2056_SYN_LOGEN_PU2 0x68 -#define B2056_SYN_LOGEN_PU3 0x69 -#define B2056_SYN_LOGEN_PU5 0x6A -#define B2056_SYN_LOGEN_PU6 0x6B -#define B2056_SYN_LOGEN_PU7 0x6C -#define B2056_SYN_LOGEN_PU8 0x6D -#define B2056_SYN_LOGEN_BIAS_RESET 0x6E -#define B2056_SYN_LOGEN_RCCR1 0x6F -#define B2056_SYN_LOGEN_VCOBUF1 0x70 -#define B2056_SYN_LOGEN_MIXER1 0x71 -#define B2056_SYN_LOGEN_MIXER2 0x72 -#define B2056_SYN_LOGEN_BUF1 0x73 -#define B2056_SYN_LOGENBUF2 0x74 -#define B2056_SYN_LOGEN_BUF3 0x75 -#define B2056_SYN_LOGEN_BUF4 0x76 -#define B2056_SYN_LOGEN_DIV1 0x77 -#define B2056_SYN_LOGEN_DIV2 0x78 -#define B2056_SYN_LOGEN_DIV3 0x79 -#define B2056_SYN_LOGEN_ACL1 0x7A -#define B2056_SYN_LOGEN_ACL2 0x7B -#define B2056_SYN_LOGEN_ACL3 0x7C -#define B2056_SYN_LOGEN_ACL4 0x7D -#define B2056_SYN_LOGEN_ACL5 0x7E -#define B2056_SYN_LOGEN_ACL6 0x7F -#define B2056_SYN_LOGEN_ACLOUT 0x80 -#define B2056_SYN_LOGEN_ACLCAL1 0x81 -#define B2056_SYN_LOGEN_ACLCAL2 0x82 -#define B2056_SYN_LOGEN_ACLCAL3 0x83 -#define B2056_SYN_CALEN 0x84 -#define B2056_SYN_LOGEN_PEAKDET1 0x85 -#define B2056_SYN_LOGEN_CORE_ACL_OVR 0x86 -#define B2056_SYN_LOGEN_RX_DIFF_ACL_OVR 0x87 -#define B2056_SYN_LOGEN_TX_DIFF_ACL_OVR 0x88 -#define B2056_SYN_LOGEN_RX_CMOS_ACL_OVR 0x89 -#define B2056_SYN_LOGEN_TX_CMOS_ACL_OVR 0x8A -#define B2056_SYN_LOGEN_VCOBUF2 0x8B -#define B2056_SYN_LOGEN_MIXER3 0x8C -#define B2056_SYN_LOGEN_BUF5 0x8D -#define B2056_SYN_LOGEN_BUF6 0x8E -#define B2056_SYN_LOGEN_CBUFRX1 0x8F -#define B2056_SYN_LOGEN_CBUFRX2 0x90 -#define B2056_SYN_LOGEN_CBUFRX3 0x91 -#define B2056_SYN_LOGEN_CBUFRX4 0x92 -#define B2056_SYN_LOGEN_CBUFTX1 0x93 -#define B2056_SYN_LOGEN_CBUFTX2 0x94 -#define B2056_SYN_LOGEN_CBUFTX3 0x95 -#define B2056_SYN_LOGEN_CBUFTX4 0x96 -#define B2056_SYN_LOGEN_CMOSRX1 0x97 -#define B2056_SYN_LOGEN_CMOSRX2 0x98 -#define B2056_SYN_LOGEN_CMOSRX3 0x99 -#define B2056_SYN_LOGEN_CMOSRX4 0x9A -#define B2056_SYN_LOGEN_CMOSTX1 0x9B -#define B2056_SYN_LOGEN_CMOSTX2 0x9C -#define B2056_SYN_LOGEN_CMOSTX3 0x9D -#define B2056_SYN_LOGEN_CMOSTX4 0x9E -#define B2056_SYN_LOGEN_VCOBUF2_OVRVAL 0x9F -#define B2056_SYN_LOGEN_MIXER3_OVRVAL 0xA0 -#define B2056_SYN_LOGEN_BUF5_OVRVAL 0xA1 -#define B2056_SYN_LOGEN_BUF6_OVRVAL 0xA2 -#define B2056_SYN_LOGEN_CBUFRX1_OVRVAL 0xA3 -#define B2056_SYN_LOGEN_CBUFRX2_OVRVAL 0xA4 -#define B2056_SYN_LOGEN_CBUFRX3_OVRVAL 0xA5 -#define B2056_SYN_LOGEN_CBUFRX4_OVRVAL 0xA6 -#define B2056_SYN_LOGEN_CBUFTX1_OVRVAL 0xA7 -#define B2056_SYN_LOGEN_CBUFTX2_OVRVAL 0xA8 -#define B2056_SYN_LOGEN_CBUFTX3_OVRVAL 0xA9 -#define B2056_SYN_LOGEN_CBUFTX4_OVRVAL 0xAA -#define B2056_SYN_LOGEN_CMOSRX1_OVRVAL 0xAB -#define B2056_SYN_LOGEN_CMOSRX2_OVRVAL 0xAC -#define B2056_SYN_LOGEN_CMOSRX3_OVRVAL 0xAD -#define B2056_SYN_LOGEN_CMOSRX4_OVRVAL 0xAE -#define B2056_SYN_LOGEN_CMOSTX1_OVRVAL 0xAF -#define B2056_SYN_LOGEN_CMOSTX2_OVRVAL 0xB0 -#define B2056_SYN_LOGEN_CMOSTX3_OVRVAL 0xB1 -#define B2056_SYN_LOGEN_CMOSTX4_OVRVAL 0xB2 -#define B2056_SYN_LOGEN_ACL_WAITCNT 0xB3 -#define B2056_SYN_LOGEN_CORE_CALVALID 0xB4 -#define B2056_SYN_LOGEN_RX_CMOS_CALVALID 0xB5 -#define B2056_SYN_LOGEN_TX_CMOS_VALID 0xB6 - -#define B2056_TX_RESERVED_ADDR0 0x00 -#define B2056_TX_IDCODE 0x01 -#define B2056_TX_RESERVED_ADDR2 0x02 -#define B2056_TX_RESERVED_ADDR3 0x03 -#define B2056_TX_RESERVED_ADDR4 0x04 -#define B2056_TX_RESERVED_ADDR5 0x05 -#define B2056_TX_RESERVED_ADDR6 0x06 -#define B2056_TX_RESERVED_ADDR7 0x07 -#define B2056_TX_COM_CTRL 0x08 -#define B2056_TX_COM_PU 0x09 -#define B2056_TX_COM_OVR 0x0A -#define B2056_TX_COM_RESET 0x0B -#define B2056_TX_COM_RCAL 0x0C -#define B2056_TX_COM_RC_RXLPF 0x0D -#define B2056_TX_COM_RC_TXLPF 0x0E -#define B2056_TX_COM_RC_RXHPF 0x0F -#define B2056_TX_RESERVED_ADDR16 0x10 -#define B2056_TX_RESERVED_ADDR17 0x11 -#define B2056_TX_RESERVED_ADDR18 0x12 -#define B2056_TX_RESERVED_ADDR19 0x13 -#define B2056_TX_RESERVED_ADDR20 0x14 -#define B2056_TX_RESERVED_ADDR21 0x15 -#define B2056_TX_RESERVED_ADDR22 0x16 -#define B2056_TX_RESERVED_ADDR23 0x17 -#define B2056_TX_RESERVED_ADDR24 0x18 -#define B2056_TX_RESERVED_ADDR25 0x19 -#define B2056_TX_RESERVED_ADDR26 0x1A -#define B2056_TX_RESERVED_ADDR27 0x1B -#define B2056_TX_RESERVED_ADDR28 0x1C -#define B2056_TX_RESERVED_ADDR29 0x1D -#define B2056_TX_RESERVED_ADDR30 0x1E -#define B2056_TX_RESERVED_ADDR31 0x1F -#define B2056_TX_IQCAL_GAIN_BW 0x20 -#define B2056_TX_LOFT_FINE_I 0x21 -#define B2056_TX_LOFT_FINE_Q 0x22 -#define B2056_TX_LOFT_COARSE_I 0x23 -#define B2056_TX_LOFT_COARSE_Q 0x24 -#define B2056_TX_TX_COM_MASTER1 0x25 -#define B2056_TX_TX_COM_MASTER2 0x26 -#define B2056_TX_RXIQCAL_TXMUX 0x27 -#define B2056_TX_TX_SSI_MASTER 0x28 -#define B2056_TX_IQCAL_VCM_HG 0x29 -#define B2056_TX_IQCAL_IDAC 0x2A -#define B2056_TX_TSSI_VCM 0x2B -#define B2056_TX_TX_AMP_DET 0x2C -#define B2056_TX_TX_SSI_MUX 0x2D -#define B2056_TX_TSSIA 0x2E -#define B2056_TX_TSSIG 0x2F -#define B2056_TX_TSSI_MISC1 0x30 -#define B2056_TX_TSSI_MISC2 0x31 -#define B2056_TX_TSSI_MISC3 0x32 -#define B2056_TX_PA_SPARE1 0x33 -#define B2056_TX_PA_SPARE2 0x34 -#define B2056_TX_INTPAA_MASTER 0x35 -#define B2056_TX_INTPAA_GAIN 0x36 -#define B2056_TX_INTPAA_BOOST_TUNE 0x37 -#define B2056_TX_INTPAA_IAUX_STAT 0x38 -#define B2056_TX_INTPAA_IAUX_DYN 0x39 -#define B2056_TX_INTPAA_IMAIN_STAT 0x3A -#define B2056_TX_INTPAA_IMAIN_DYN 0x3B -#define B2056_TX_INTPAA_CASCBIAS 0x3C -#define B2056_TX_INTPAA_PASLOPE 0x3D -#define B2056_TX_INTPAA_PA_MISC 0x3E -#define B2056_TX_INTPAG_MASTER 0x3F -#define B2056_TX_INTPAG_GAIN 0x40 -#define B2056_TX_INTPAG_BOOST_TUNE 0x41 -#define B2056_TX_INTPAG_IAUX_STAT 0x42 -#define B2056_TX_INTPAG_IAUX_DYN 0x43 -#define B2056_TX_INTPAG_IMAIN_STAT 0x44 -#define B2056_TX_INTPAG_IMAIN_DYN 0x45 -#define B2056_TX_INTPAG_CASCBIAS 0x46 -#define B2056_TX_INTPAG_PASLOPE 0x47 -#define B2056_TX_INTPAG_PA_MISC 0x48 -#define B2056_TX_PADA_MASTER 0x49 -#define B2056_TX_PADA_IDAC 0x4A -#define B2056_TX_PADA_CASCBIAS 0x4B -#define B2056_TX_PADA_GAIN 0x4C -#define B2056_TX_PADA_BOOST_TUNE 0x4D -#define B2056_TX_PADA_SLOPE 0x4E -#define B2056_TX_PADG_MASTER 0x4F -#define B2056_TX_PADG_IDAC 0x50 -#define B2056_TX_PADG_CASCBIAS 0x51 -#define B2056_TX_PADG_GAIN 0x52 -#define B2056_TX_PADG_BOOST_TUNE 0x53 -#define B2056_TX_PADG_SLOPE 0x54 -#define B2056_TX_PGAA_MASTER 0x55 -#define B2056_TX_PGAA_IDAC 0x56 -#define B2056_TX_PGAA_GAIN 0x57 -#define B2056_TX_PGAA_BOOST_TUNE 0x58 -#define B2056_TX_PGAA_SLOPE 0x59 -#define B2056_TX_PGAA_MISC 0x5A -#define B2056_TX_PGAG_MASTER 0x5B -#define B2056_TX_PGAG_IDAC 0x5C -#define B2056_TX_PGAG_GAIN 0x5D -#define B2056_TX_PGAG_BOOST_TUNE 0x5E -#define B2056_TX_PGAG_SLOPE 0x5F -#define B2056_TX_PGAG_MISC 0x60 -#define B2056_TX_MIXA_MASTER 0x61 -#define B2056_TX_MIXA_BOOST_TUNE 0x62 -#define B2056_TX_MIXG 0x63 -#define B2056_TX_MIXG_BOOST_TUNE 0x64 -#define B2056_TX_BB_GM_MASTER 0x65 -#define B2056_TX_GMBB_GM 0x66 -#define B2056_TX_GMBB_IDAC 0x67 -#define B2056_TX_TXLPF_MASTER 0x68 -#define B2056_TX_TXLPF_RCCAL 0x69 -#define B2056_TX_TXLPF_RCCAL_OFF0 0x6A -#define B2056_TX_TXLPF_RCCAL_OFF1 0x6B -#define B2056_TX_TXLPF_RCCAL_OFF2 0x6C -#define B2056_TX_TXLPF_RCCAL_OFF3 0x6D -#define B2056_TX_TXLPF_RCCAL_OFF4 0x6E -#define B2056_TX_TXLPF_RCCAL_OFF5 0x6F -#define B2056_TX_TXLPF_RCCAL_OFF6 0x70 -#define B2056_TX_TXLPF_BW 0x71 -#define B2056_TX_TXLPF_GAIN 0x72 -#define B2056_TX_TXLPF_IDAC 0x73 -#define B2056_TX_TXLPF_IDAC_0 0x74 -#define B2056_TX_TXLPF_IDAC_1 0x75 -#define B2056_TX_TXLPF_IDAC_2 0x76 -#define B2056_TX_TXLPF_IDAC_3 0x77 -#define B2056_TX_TXLPF_IDAC_4 0x78 -#define B2056_TX_TXLPF_IDAC_5 0x79 -#define B2056_TX_TXLPF_IDAC_6 0x7A -#define B2056_TX_TXLPF_OPAMP_IDAC 0x7B -#define B2056_TX_TXLPF_MISC 0x7C -#define B2056_TX_TXSPARE1 0x7D -#define B2056_TX_TXSPARE2 0x7E -#define B2056_TX_TXSPARE3 0x7F -#define B2056_TX_TXSPARE4 0x80 -#define B2056_TX_TXSPARE5 0x81 -#define B2056_TX_TXSPARE6 0x82 -#define B2056_TX_TXSPARE7 0x83 -#define B2056_TX_TXSPARE8 0x84 -#define B2056_TX_TXSPARE9 0x85 -#define B2056_TX_TXSPARE10 0x86 -#define B2056_TX_TXSPARE11 0x87 -#define B2056_TX_TXSPARE12 0x88 -#define B2056_TX_TXSPARE13 0x89 -#define B2056_TX_TXSPARE14 0x8A -#define B2056_TX_TXSPARE15 0x8B -#define B2056_TX_TXSPARE16 0x8C -#define B2056_TX_STATUS_INTPA_GAIN 0x8D -#define B2056_TX_STATUS_PAD_GAIN 0x8E -#define B2056_TX_STATUS_PGA_GAIN 0x8F -#define B2056_TX_STATUS_GM_TXLPF_GAIN 0x90 -#define B2056_TX_STATUS_TXLPF_BW 0x91 -#define B2056_TX_STATUS_TXLPF_RC 0x92 -#define B2056_TX_GMBB_IDAC0 0x93 -#define B2056_TX_GMBB_IDAC1 0x94 -#define B2056_TX_GMBB_IDAC2 0x95 -#define B2056_TX_GMBB_IDAC3 0x96 -#define B2056_TX_GMBB_IDAC4 0x97 -#define B2056_TX_GMBB_IDAC5 0x98 -#define B2056_TX_GMBB_IDAC6 0x99 -#define B2056_TX_GMBB_IDAC7 0x9A - -#define B2056_RX_RESERVED_ADDR0 0x00 -#define B2056_RX_IDCODE 0x01 -#define B2056_RX_RESERVED_ADDR2 0x02 -#define B2056_RX_RESERVED_ADDR3 0x03 -#define B2056_RX_RESERVED_ADDR4 0x04 -#define B2056_RX_RESERVED_ADDR5 0x05 -#define B2056_RX_RESERVED_ADDR6 0x06 -#define B2056_RX_RESERVED_ADDR7 0x07 -#define B2056_RX_COM_CTRL 0x08 -#define B2056_RX_COM_PU 0x09 -#define B2056_RX_COM_OVR 0x0A -#define B2056_RX_COM_RESET 0x0B -#define B2056_RX_COM_RCAL 0x0C -#define B2056_RX_COM_RC_RXLPF 0x0D -#define B2056_RX_COM_RC_TXLPF 0x0E -#define B2056_RX_COM_RC_RXHPF 0x0F -#define B2056_RX_RESERVED_ADDR16 0x10 -#define B2056_RX_RESERVED_ADDR17 0x11 -#define B2056_RX_RESERVED_ADDR18 0x12 -#define B2056_RX_RESERVED_ADDR19 0x13 -#define B2056_RX_RESERVED_ADDR20 0x14 -#define B2056_RX_RESERVED_ADDR21 0x15 -#define B2056_RX_RESERVED_ADDR22 0x16 -#define B2056_RX_RESERVED_ADDR23 0x17 -#define B2056_RX_RESERVED_ADDR24 0x18 -#define B2056_RX_RESERVED_ADDR25 0x19 -#define B2056_RX_RESERVED_ADDR26 0x1A -#define B2056_RX_RESERVED_ADDR27 0x1B -#define B2056_RX_RESERVED_ADDR28 0x1C -#define B2056_RX_RESERVED_ADDR29 0x1D -#define B2056_RX_RESERVED_ADDR30 0x1E -#define B2056_RX_RESERVED_ADDR31 0x1F -#define B2056_RX_RXIQCAL_RXMUX 0x20 -#define B2056_RX_RSSI_PU 0x21 -#define B2056_RX_RSSI_SEL 0x22 -#define B2056_RX_RSSI_GAIN 0x23 -#define B2056_RX_RSSI_NB_IDAC 0x24 -#define B2056_RX_RSSI_WB2I_IDAC_1 0x25 -#define B2056_RX_RSSI_WB2I_IDAC_2 0x26 -#define B2056_RX_RSSI_WB2Q_IDAC_1 0x27 -#define B2056_RX_RSSI_WB2Q_IDAC_2 0x28 -#define B2056_RX_RSSI_POLE 0x29 -#define B2056_RX_RSSI_WB1_IDAC 0x2A -#define B2056_RX_RSSI_MISC 0x2B -#define B2056_RX_LNAA_MASTER 0x2C -#define B2056_RX_LNAA_TUNE 0x2D -#define B2056_RX_LNAA_GAIN 0x2E -#define B2056_RX_LNA_A_SLOPE 0x2F -#define B2056_RX_BIASPOLE_LNAA1_IDAC 0x30 -#define B2056_RX_LNAA2_IDAC 0x31 -#define B2056_RX_LNA1A_MISC 0x32 -#define B2056_RX_LNAG_MASTER 0x33 -#define B2056_RX_LNAG_TUNE 0x34 -#define B2056_RX_LNAG_GAIN 0x35 -#define B2056_RX_LNA_G_SLOPE 0x36 -#define B2056_RX_BIASPOLE_LNAG1_IDAC 0x37 -#define B2056_RX_LNAG2_IDAC 0x38 -#define B2056_RX_LNA1G_MISC 0x39 -#define B2056_RX_MIXA_MASTER 0x3A -#define B2056_RX_MIXA_VCM 0x3B -#define B2056_RX_MIXA_CTRLPTAT 0x3C -#define B2056_RX_MIXA_LOB_BIAS 0x3D -#define B2056_RX_MIXA_CORE_IDAC 0x3E -#define B2056_RX_MIXA_CMFB_IDAC 0x3F -#define B2056_RX_MIXA_BIAS_AUX 0x40 -#define B2056_RX_MIXA_BIAS_MAIN 0x41 -#define B2056_RX_MIXA_BIAS_MISC 0x42 -#define B2056_RX_MIXA_MAST_BIAS 0x43 -#define B2056_RX_MIXG_MASTER 0x44 -#define B2056_RX_MIXG_VCM 0x45 -#define B2056_RX_MIXG_CTRLPTAT 0x46 -#define B2056_RX_MIXG_LOB_BIAS 0x47 -#define B2056_RX_MIXG_CORE_IDAC 0x48 -#define B2056_RX_MIXG_CMFB_IDAC 0x49 -#define B2056_RX_MIXG_BIAS_AUX 0x4A -#define B2056_RX_MIXG_BIAS_MAIN 0x4B -#define B2056_RX_MIXG_BIAS_MISC 0x4C -#define B2056_RX_MIXG_MAST_BIAS 0x4D -#define B2056_RX_TIA_MASTER 0x4E -#define B2056_RX_TIA_IOPAMP 0x4F -#define B2056_RX_TIA_QOPAMP 0x50 -#define B2056_RX_TIA_IMISC 0x51 -#define B2056_RX_TIA_QMISC 0x52 -#define B2056_RX_TIA_GAIN 0x53 -#define B2056_RX_TIA_SPARE1 0x54 -#define B2056_RX_TIA_SPARE2 0x55 -#define B2056_RX_BB_LPF_MASTER 0x56 -#define B2056_RX_AACI_MASTER 0x57 -#define B2056_RX_RXLPF_IDAC 0x58 -#define B2056_RX_RXLPF_OPAMPBIAS_LOWQ 0x59 -#define B2056_RX_RXLPF_OPAMPBIAS_HIGHQ 0x5A -#define B2056_RX_RXLPF_BIAS_DCCANCEL 0x5B -#define B2056_RX_RXLPF_OUTVCM 0x5C -#define B2056_RX_RXLPF_INVCM_BODY 0x5D -#define B2056_RX_RXLPF_CC_OP 0x5E -#define B2056_RX_RXLPF_GAIN 0x5F -#define B2056_RX_RXLPF_Q_BW 0x60 -#define B2056_RX_RXLPF_HP_CORNER_BW 0x61 -#define B2056_RX_RXLPF_RCCAL_HPC 0x62 -#define B2056_RX_RXHPF_OFF0 0x63 -#define B2056_RX_RXHPF_OFF1 0x64 -#define B2056_RX_RXHPF_OFF2 0x65 -#define B2056_RX_RXHPF_OFF3 0x66 -#define B2056_RX_RXHPF_OFF4 0x67 -#define B2056_RX_RXHPF_OFF5 0x68 -#define B2056_RX_RXHPF_OFF6 0x69 -#define B2056_RX_RXHPF_OFF7 0x6A -#define B2056_RX_RXLPF_RCCAL_LPC 0x6B -#define B2056_RX_RXLPF_OFF_0 0x6C -#define B2056_RX_RXLPF_OFF_1 0x6D -#define B2056_RX_RXLPF_OFF_2 0x6E -#define B2056_RX_RXLPF_OFF_3 0x6F -#define B2056_RX_RXLPF_OFF_4 0x70 -#define B2056_RX_UNUSED 0x71 -#define B2056_RX_VGA_MASTER 0x72 -#define B2056_RX_VGA_BIAS 0x73 -#define B2056_RX_VGA_BIAS_DCCANCEL 0x74 -#define B2056_RX_VGA_GAIN 0x75 -#define B2056_RX_VGA_HP_CORNER_BW 0x76 -#define B2056_RX_VGABUF_BIAS 0x77 -#define B2056_RX_VGABUF_GAIN_BW 0x78 -#define B2056_RX_TXFBMIX_A 0x79 -#define B2056_RX_TXFBMIX_G 0x7A -#define B2056_RX_RXSPARE1 0x7B -#define B2056_RX_RXSPARE2 0x7C -#define B2056_RX_RXSPARE3 0x7D -#define B2056_RX_RXSPARE4 0x7E -#define B2056_RX_RXSPARE5 0x7F -#define B2056_RX_RXSPARE6 0x80 -#define B2056_RX_RXSPARE7 0x81 -#define B2056_RX_RXSPARE8 0x82 -#define B2056_RX_RXSPARE9 0x83 -#define B2056_RX_RXSPARE10 0x84 -#define B2056_RX_RXSPARE11 0x85 -#define B2056_RX_RXSPARE12 0x86 -#define B2056_RX_RXSPARE13 0x87 -#define B2056_RX_RXSPARE14 0x88 -#define B2056_RX_RXSPARE15 0x89 -#define B2056_RX_RXSPARE16 0x8A -#define B2056_RX_STATUS_LNAA_GAIN 0x8B -#define B2056_RX_STATUS_LNAG_GAIN 0x8C -#define B2056_RX_STATUS_MIXTIA_GAIN 0x8D -#define B2056_RX_STATUS_RXLPF_GAIN 0x8E -#define B2056_RX_STATUS_VGA_BUF_GAIN 0x8F -#define B2056_RX_STATUS_RXLPF_Q 0x90 -#define B2056_RX_STATUS_RXLPF_BUF_BW 0x91 -#define B2056_RX_STATUS_RXLPF_VGA_HPC 0x92 -#define B2056_RX_STATUS_RXLPF_RC 0x93 -#define B2056_RX_STATUS_HPC_RC 0x94 - -#define B2056_LNA1_A_PU 0x01 -#define B2056_LNA2_A_PU 0x02 -#define B2056_LNA1_G_PU 0x01 -#define B2056_LNA2_G_PU 0x02 -#define B2056_MIXA_PU_I 0x01 -#define B2056_MIXA_PU_Q 0x02 -#define B2056_MIXA_PU_GM 0x10 -#define B2056_MIXG_PU_I 0x01 -#define B2056_MIXG_PU_Q 0x02 -#define B2056_MIXG_PU_GM 0x10 -#define B2056_TIA_PU 0x01 -#define B2056_BB_LPF_PU 0x20 -#define B2056_W1_PU 0x02 -#define B2056_W2_PU 0x04 -#define B2056_NB_PU 0x08 -#define B2056_RSSI_W1_SEL 0x02 -#define B2056_RSSI_W2_SEL 0x04 -#define B2056_RSSI_NB_SEL 0x08 -#define B2056_VCM_MASK 0x1C -#define B2056_RSSI_VCM_SHIFT 0x02 - -struct b43_nphy_channeltab_entry_rev3 { - /* The channel frequency in MHz */ - u16 freq; - /* Radio register values on channelswitch */ - u8 radio_syn_pll_vcocal1; - u8 radio_syn_pll_vcocal2; - u8 radio_syn_pll_refdiv; - u8 radio_syn_pll_mmd2; - u8 radio_syn_pll_mmd1; - u8 radio_syn_pll_loopfilter1; - u8 radio_syn_pll_loopfilter2; - u8 radio_syn_pll_loopfilter3; - u8 radio_syn_pll_loopfilter4; - u8 radio_syn_pll_loopfilter5; - u8 radio_syn_reserved_addr27; - u8 radio_syn_reserved_addr28; - u8 radio_syn_reserved_addr29; - u8 radio_syn_logen_vcobuf1; - u8 radio_syn_logen_mixer2; - u8 radio_syn_logen_buf3; - u8 radio_syn_logen_buf4; - u8 radio_rx0_lnaa_tune; - u8 radio_rx0_lnag_tune; - u8 radio_tx0_intpaa_boost_tune; - u8 radio_tx0_intpag_boost_tune; - u8 radio_tx0_pada_boost_tune; - u8 radio_tx0_padg_boost_tune; - u8 radio_tx0_pgaa_boost_tune; - u8 radio_tx0_pgag_boost_tune; - u8 radio_tx0_mixa_boost_tune; - u8 radio_tx0_mixg_boost_tune; - u8 radio_rx1_lnaa_tune; - u8 radio_rx1_lnag_tune; - u8 radio_tx1_intpaa_boost_tune; - u8 radio_tx1_intpag_boost_tune; - u8 radio_tx1_pada_boost_tune; - u8 radio_tx1_padg_boost_tune; - u8 radio_tx1_pgaa_boost_tune; - u8 radio_tx1_pgag_boost_tune; - u8 radio_tx1_mixa_boost_tune; - u8 radio_tx1_mixg_boost_tune; - /* PHY register values on channelswitch */ - struct b43_phy_n_sfo_cfg phy_regs; -}; - -void b2056_upload_inittabs(struct b43_wldev *dev, - bool ghz5, bool ignore_uploadflag); -void b2056_upload_syn_pll_cp2(struct b43_wldev *dev, bool ghz5); - -/* Get the NPHY Channel Switch Table entry for a channel. - * Returns NULL on failure to find an entry. */ -const struct b43_nphy_channeltab_entry_rev3 * -b43_nphy_get_chantabent_rev3(struct b43_wldev *dev, u16 freq); - -#endif /* B43_RADIO_2056_H_ */ diff --git a/drivers/net/wireless/b43/radio_2057.c b/drivers/net/wireless/b43/radio_2057.c deleted file mode 100644 index d61d6830c5c7..000000000000 --- a/drivers/net/wireless/b43/radio_2057.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - - Broadcom B43 wireless driver - IEEE 802.11n 2057 radio device data tables - - Copyright (c) 2010 Rafał Miłecki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "radio_2057.h" -#include "phy_common.h" - -static u16 r2057_rev4_init[42][2] = { - { 0x0E, 0x20 }, { 0x31, 0x00 }, { 0x32, 0x00 }, { 0x33, 0x00 }, - { 0x35, 0x26 }, { 0x3C, 0xff }, { 0x3D, 0xff }, { 0x3E, 0xff }, - { 0x3F, 0xff }, { 0x62, 0x33 }, { 0x8A, 0xf0 }, { 0x8B, 0x10 }, - { 0x8C, 0xf0 }, { 0x91, 0x3f }, { 0x92, 0x36 }, { 0xA4, 0x8c }, - { 0xA8, 0x55 }, { 0xAF, 0x01 }, { 0x10F, 0xf0 }, { 0x110, 0x10 }, - { 0x111, 0xf0 }, { 0x116, 0x3f }, { 0x117, 0x36 }, { 0x129, 0x8c }, - { 0x12D, 0x55 }, { 0x134, 0x01 }, { 0x15E, 0x00 }, { 0x15F, 0x00 }, - { 0x160, 0x00 }, { 0x161, 0x00 }, { 0x162, 0x00 }, { 0x163, 0x00 }, - { 0x169, 0x02 }, { 0x16A, 0x00 }, { 0x16B, 0x00 }, { 0x16C, 0x00 }, - { 0x1A4, 0x00 }, { 0x1A5, 0x00 }, { 0x1A6, 0x00 }, { 0x1AA, 0x00 }, - { 0x1AB, 0x00 }, { 0x1AC, 0x00 }, -}; - -static u16 r2057_rev5_init[44][2] = { - { 0x00, 0x00 }, { 0x01, 0x57 }, { 0x02, 0x20 }, { 0x23, 0x6 }, - { 0x31, 0x00 }, { 0x32, 0x00 }, { 0x33, 0x00 }, { 0x51, 0x70 }, - { 0x59, 0x88 }, { 0x5C, 0x20 }, { 0x62, 0x33 }, { 0x63, 0x0f }, - { 0x64, 0x0f }, { 0x81, 0x01 }, { 0x91, 0x3f }, { 0x92, 0x36 }, - { 0xA1, 0x20 }, { 0xD6, 0x70 }, { 0xDE, 0x88 }, { 0xE1, 0x20 }, - { 0xE8, 0x0f }, { 0xE9, 0x0f }, { 0x106, 0x01 }, { 0x116, 0x3f }, - { 0x117, 0x36 }, { 0x126, 0x20 }, { 0x15E, 0x00 }, { 0x15F, 0x00 }, - { 0x160, 0x00 }, { 0x161, 0x00 }, { 0x162, 0x00 }, { 0x163, 0x00 }, - { 0x16A, 0x00 }, { 0x16B, 0x00 }, { 0x16C, 0x00 }, { 0x1A4, 0x00 }, - { 0x1A5, 0x00 }, { 0x1A6, 0x00 }, { 0x1AA, 0x00 }, { 0x1AB, 0x00 }, - { 0x1AC, 0x00 }, { 0x1B7, 0x0c }, { 0x1C1, 0x01 }, { 0x1C2, 0x80 }, -}; - -static u16 r2057_rev5a_init[45][2] = { - { 0x00, 0x15 }, { 0x01, 0x57 }, { 0x02, 0x20 }, { 0x23, 0x6 }, - { 0x31, 0x00 }, { 0x32, 0x00 }, { 0x33, 0x00 }, { 0x51, 0x70 }, - { 0x59, 0x88 }, { 0x5C, 0x20 }, { 0x62, 0x33 }, { 0x63, 0x0f }, - { 0x64, 0x0f }, { 0x81, 0x01 }, { 0x91, 0x3f }, { 0x92, 0x36 }, - { 0xC9, 0x01 }, { 0xD6, 0x70 }, { 0xDE, 0x88 }, { 0xE1, 0x20 }, - { 0xE8, 0x0f }, { 0xE9, 0x0f }, { 0x106, 0x01 }, { 0x116, 0x3f }, - { 0x117, 0x36 }, { 0x126, 0x20 }, { 0x14E, 0x01 }, { 0x15E, 0x00 }, - { 0x15F, 0x00 }, { 0x160, 0x00 }, { 0x161, 0x00 }, { 0x162, 0x00 }, - { 0x163, 0x00 }, { 0x16A, 0x00 }, { 0x16B, 0x00 }, { 0x16C, 0x00 }, - { 0x1A4, 0x00 }, { 0x1A5, 0x00 }, { 0x1A6, 0x00 }, { 0x1AA, 0x00 }, - { 0x1AB, 0x00 }, { 0x1AC, 0x00 }, { 0x1B7, 0x0c }, { 0x1C1, 0x01 }, - { 0x1C2, 0x80 }, -}; - -static u16 r2057_rev7_init[54][2] = { - { 0x00, 0x00 }, { 0x01, 0x57 }, { 0x02, 0x20 }, { 0x31, 0x00 }, - { 0x32, 0x00 }, { 0x33, 0x00 }, { 0x51, 0x70 }, { 0x59, 0x88 }, - { 0x5C, 0x20 }, { 0x62, 0x33 }, { 0x63, 0x0f }, { 0x64, 0x13 }, - { 0x66, 0xee }, { 0x6E, 0x58 }, { 0x75, 0x13 }, { 0x7B, 0x13 }, - { 0x7C, 0x14 }, { 0x7D, 0xee }, { 0x81, 0x01 }, { 0x91, 0x3f }, - { 0x92, 0x36 }, { 0xA1, 0x20 }, { 0xD6, 0x70 }, { 0xDE, 0x88 }, - { 0xE1, 0x20 }, { 0xE8, 0x0f }, { 0xE9, 0x13 }, { 0xEB, 0xee }, - { 0xF3, 0x58 }, { 0xFA, 0x13 }, { 0x100, 0x13 }, { 0x101, 0x14 }, - { 0x102, 0xee }, { 0x106, 0x01 }, { 0x116, 0x3f }, { 0x117, 0x36 }, - { 0x126, 0x20 }, { 0x15E, 0x00 }, { 0x15F, 0x00 }, { 0x160, 0x00 }, - { 0x161, 0x00 }, { 0x162, 0x00 }, { 0x163, 0x00 }, { 0x16A, 0x00 }, - { 0x16B, 0x00 }, { 0x16C, 0x00 }, { 0x1A4, 0x00 }, { 0x1A5, 0x00 }, - { 0x1A6, 0x00 }, { 0x1AA, 0x00 }, { 0x1AB, 0x00 }, { 0x1AC, 0x00 }, - { 0x1B7, 0x05 }, { 0x1C2, 0xa0 }, -}; - -static u16 r2057_rev8_init[54][2] = { - { 0x00, 0x08 }, { 0x01, 0x57 }, { 0x02, 0x20 }, { 0x31, 0x00 }, - { 0x32, 0x00 }, { 0x33, 0x00 }, { 0x51, 0x70 }, { 0x59, 0x88 }, - { 0x5C, 0x20 }, { 0x62, 0x33 }, { 0x63, 0x0f }, { 0x64, 0x0f }, - { 0x6E, 0x58 }, { 0x75, 0x13 }, { 0x7B, 0x13 }, { 0x7C, 0x0f }, - { 0x7D, 0xee }, { 0x81, 0x01 }, { 0x91, 0x3f }, { 0x92, 0x36 }, - { 0xA1, 0x20 }, { 0xC9, 0x01 }, { 0xD6, 0x70 }, { 0xDE, 0x88 }, - { 0xE1, 0x20 }, { 0xE8, 0x0f }, { 0xE9, 0x0f }, { 0xF3, 0x58 }, - { 0xFA, 0x13 }, { 0x100, 0x13 }, { 0x101, 0x0f }, { 0x102, 0xee }, - { 0x106, 0x01 }, { 0x116, 0x3f }, { 0x117, 0x36 }, { 0x126, 0x20 }, - { 0x14E, 0x01 }, { 0x15E, 0x00 }, { 0x15F, 0x00 }, { 0x160, 0x00 }, - { 0x161, 0x00 }, { 0x162, 0x00 }, { 0x163, 0x00 }, { 0x16A, 0x00 }, - { 0x16B, 0x00 }, { 0x16C, 0x00 }, { 0x1A4, 0x00 }, { 0x1A5, 0x00 }, - { 0x1A6, 0x00 }, { 0x1AA, 0x00 }, { 0x1AB, 0x00 }, { 0x1AC, 0x00 }, - { 0x1B7, 0x05 }, { 0x1C2, 0xa0 }, -}; - -void r2057_upload_inittabs(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - u16 *table = NULL; - u16 size, i; - - if (phy->rev == 7) { - table = r2057_rev4_init[0]; - size = ARRAY_SIZE(r2057_rev4_init); - } else if (phy->rev == 8 || phy->rev == 9) { - if (phy->radio_rev == 5) { - if (phy->radio_rev == 8) { - table = r2057_rev5_init[0]; - size = ARRAY_SIZE(r2057_rev5_init); - } else { - table = r2057_rev5a_init[0]; - size = ARRAY_SIZE(r2057_rev5a_init); - } - } else if (phy->radio_rev == 7) { - table = r2057_rev7_init[0]; - size = ARRAY_SIZE(r2057_rev7_init); - } else if (phy->radio_rev == 9) { - table = r2057_rev8_init[0]; - size = ARRAY_SIZE(r2057_rev8_init); - } - } - - if (table) { - for (i = 0; i < 10; i++) { - pr_info("radio_write 0x%X ", *table); - table++; - pr_info("0x%X\n", *table); - table++; - } - } -} diff --git a/drivers/net/wireless/b43/radio_2057.h b/drivers/net/wireless/b43/radio_2057.h deleted file mode 100644 index eeebd8fbeb0d..000000000000 --- a/drivers/net/wireless/b43/radio_2057.h +++ /dev/null @@ -1,430 +0,0 @@ -#ifndef B43_RADIO_2057_H_ -#define B43_RADIO_2057_H_ - -#include - -#include "tables_nphy.h" - -#define R2057_DACBUF_VINCM_CORE0 0x000 -#define R2057_IDCODE 0x001 -#define R2057_RCCAL_MASTER 0x002 -#define R2057_RCCAL_CAP_SIZE 0x003 -#define R2057_RCAL_CONFIG 0x004 -#define R2057_GPAIO_CONFIG 0x005 -#define R2057_GPAIO_SEL1 0x006 -#define R2057_GPAIO_SEL0 0x007 -#define R2057_CLPO_CONFIG 0x008 -#define R2057_BANDGAP_CONFIG 0x009 -#define R2057_BANDGAP_RCAL_TRIM 0x00a -#define R2057_AFEREG_CONFIG 0x00b -#define R2057_TEMPSENSE_CONFIG 0x00c -#define R2057_XTAL_CONFIG1 0x00d -#define R2057_XTAL_ICORE_SIZE 0x00e -#define R2057_XTAL_BUF_SIZE 0x00f -#define R2057_XTAL_PULLCAP_SIZE 0x010 -#define R2057_RFPLL_MASTER 0x011 -#define R2057_VCOMONITOR_VTH_L 0x012 -#define R2057_VCOMONITOR_VTH_H 0x013 -#define R2057_VCOCAL_BIASRESET_RFPLLREG_VOUT 0x014 -#define R2057_VCO_VARCSIZE_IDAC 0x015 -#define R2057_VCOCAL_COUNTVAL0 0x016 -#define R2057_VCOCAL_COUNTVAL1 0x017 -#define R2057_VCOCAL_INTCLK_COUNT 0x018 -#define R2057_VCOCAL_MASTER 0x019 -#define R2057_VCOCAL_NUMCAPCHANGE 0x01a -#define R2057_VCOCAL_WINSIZE 0x01b -#define R2057_VCOCAL_DELAY_AFTER_REFRESH 0x01c -#define R2057_VCOCAL_DELAY_AFTER_CLOSELOOP 0x01d -#define R2057_VCOCAL_DELAY_AFTER_OPENLOOP 0x01e -#define R2057_VCOCAL_DELAY_BEFORE_OPENLOOP 0x01f -#define R2057_VCO_FORCECAPEN_FORCECAP1 0x020 -#define R2057_VCO_FORCECAP0 0x021 -#define R2057_RFPLL_REFMASTER_SPAREXTALSIZE 0x022 -#define R2057_RFPLL_PFD_RESET_PW 0x023 -#define R2057_RFPLL_LOOPFILTER_R2 0x024 -#define R2057_RFPLL_LOOPFILTER_R1 0x025 -#define R2057_RFPLL_LOOPFILTER_C3 0x026 -#define R2057_RFPLL_LOOPFILTER_C2 0x027 -#define R2057_RFPLL_LOOPFILTER_C1 0x028 -#define R2057_CP_KPD_IDAC 0x029 -#define R2057_RFPLL_IDACS 0x02a -#define R2057_RFPLL_MISC_EN 0x02b -#define R2057_RFPLL_MMD0 0x02c -#define R2057_RFPLL_MMD1 0x02d -#define R2057_RFPLL_MISC_CAL_RESETN 0x02e -#define R2057_JTAGXTAL_SIZE_CPBIAS_FILTRES 0x02f -#define R2057_VCO_ALCREF_BBPLLXTAL_SIZE 0x030 -#define R2057_VCOCAL_READCAP0 0x031 -#define R2057_VCOCAL_READCAP1 0x032 -#define R2057_VCOCAL_STATUS 0x033 -#define R2057_LOGEN_PUS 0x034 -#define R2057_LOGEN_PTAT_RESETS 0x035 -#define R2057_VCOBUF_IDACS 0x036 -#define R2057_VCOBUF_TUNE 0x037 -#define R2057_CMOSBUF_TX2GQ_IDACS 0x038 -#define R2057_CMOSBUF_TX2GI_IDACS 0x039 -#define R2057_CMOSBUF_TX5GQ_IDACS 0x03a -#define R2057_CMOSBUF_TX5GI_IDACS 0x03b -#define R2057_CMOSBUF_RX2GQ_IDACS 0x03c -#define R2057_CMOSBUF_RX2GI_IDACS 0x03d -#define R2057_CMOSBUF_RX5GQ_IDACS 0x03e -#define R2057_CMOSBUF_RX5GI_IDACS 0x03f -#define R2057_LOGEN_MX2G_IDACS 0x040 -#define R2057_LOGEN_MX2G_TUNE 0x041 -#define R2057_LOGEN_MX5G_IDACS 0x042 -#define R2057_LOGEN_MX5G_TUNE 0x043 -#define R2057_LOGEN_MX5G_RCCR 0x044 -#define R2057_LOGEN_INDBUF2G_IDAC 0x045 -#define R2057_LOGEN_INDBUF2G_IBOOST 0x046 -#define R2057_LOGEN_INDBUF2G_TUNE 0x047 -#define R2057_LOGEN_INDBUF5G_IDAC 0x048 -#define R2057_LOGEN_INDBUF5G_IBOOST 0x049 -#define R2057_LOGEN_INDBUF5G_TUNE 0x04a -#define R2057_CMOSBUF_TX_RCCR 0x04b -#define R2057_CMOSBUF_RX_RCCR 0x04c -#define R2057_LOGEN_SEL_PKDET 0x04d -#define R2057_CMOSBUF_SHAREIQ_PTAT 0x04e -#define R2057_RXTXBIAS_CONFIG_CORE0 0x04f -#define R2057_TXGM_TXRF_PUS_CORE0 0x050 -#define R2057_TXGM_IDAC_BLEED_CORE0 0x051 -#define R2057_TXGM_GAIN_CORE0 0x056 -#define R2057_TXGM2G_PKDET_PUS_CORE0 0x057 -#define R2057_PAD2G_PTATS_CORE0 0x058 -#define R2057_PAD2G_IDACS_CORE0 0x059 -#define R2057_PAD2G_BOOST_PU_CORE0 0x05a -#define R2057_PAD2G_CASCV_GAIN_CORE0 0x05b -#define R2057_TXMIX2G_TUNE_BOOST_PU_CORE0 0x05c -#define R2057_TXMIX2G_LODC_CORE0 0x05d -#define R2057_PAD2G_TUNE_PUS_CORE0 0x05e -#define R2057_IPA2G_GAIN_CORE0 0x05f -#define R2057_TSSI2G_SPARE1_CORE0 0x060 -#define R2057_TSSI2G_SPARE2_CORE0 0x061 -#define R2057_IPA2G_TUNEV_CASCV_PTAT_CORE0 0x062 -#define R2057_IPA2G_IMAIN_CORE0 0x063 -#define R2057_IPA2G_CASCONV_CORE0 0x064 -#define R2057_IPA2G_CASCOFFV_CORE0 0x065 -#define R2057_IPA2G_BIAS_FILTER_CORE0 0x066 -#define R2057_TX5G_PKDET_CORE0 0x069 -#define R2057_PGA_PTAT_TXGM5G_PU_CORE0 0x06a -#define R2057_PAD5G_PTATS1_CORE0 0x06b -#define R2057_PAD5G_CLASS_PTATS2_CORE0 0x06c -#define R2057_PGA_BOOSTPTAT_IMAIN_CORE0 0x06d -#define R2057_PAD5G_CASCV_IMAIN_CORE0 0x06e -#define R2057_TXMIX5G_IBOOST_PAD_IAUX_CORE0 0x06f -#define R2057_PGA_BOOST_TUNE_CORE0 0x070 -#define R2057_PGA_GAIN_CORE0 0x071 -#define R2057_PAD5G_CASCOFFV_GAIN_PUS_CORE0 0x072 -#define R2057_TXMIX5G_BOOST_TUNE_CORE0 0x073 -#define R2057_PAD5G_TUNE_MISC_PUS_CORE0 0x074 -#define R2057_IPA5G_IAUX_CORE0 0x075 -#define R2057_IPA5G_GAIN_CORE0 0x076 -#define R2057_TSSI5G_SPARE1_CORE0 0x077 -#define R2057_TSSI5G_SPARE2_CORE0 0x078 -#define R2057_IPA5G_CASCOFFV_PU_CORE0 0x079 -#define R2057_IPA5G_PTAT_CORE0 0x07a -#define R2057_IPA5G_IMAIN_CORE0 0x07b -#define R2057_IPA5G_CASCONV_CORE0 0x07c -#define R2057_IPA5G_BIAS_FILTER_CORE0 0x07d -#define R2057_PAD_BIAS_FILTER_BWS_CORE0 0x080 -#define R2057_TR2G_CONFIG1_CORE0_NU 0x081 -#define R2057_TR2G_CONFIG2_CORE0_NU 0x082 -#define R2057_LNA5G_RFEN_CORE0 0x083 -#define R2057_TR5G_CONFIG2_CORE0_NU 0x084 -#define R2057_RXRFBIAS_IBOOST_PU_CORE0 0x085 -#define R2057_RXRF_IABAND_RXGM_IMAIN_PTAT_CORE0 0x086 -#define R2057_RXGM_CMFBITAIL_AUXPTAT_CORE0 0x087 -#define R2057_RXMIX_ICORE_RXGM_IAUX_CORE0 0x088 -#define R2057_RXMIX_CMFBITAIL_PU_CORE0 0x089 -#define R2057_LNA2_IMAIN_PTAT_PU_CORE0 0x08a -#define R2057_LNA2_IAUX_PTAT_CORE0 0x08b -#define R2057_LNA1_IMAIN_PTAT_PU_CORE0 0x08c -#define R2057_LNA15G_INPUT_MATCH_TUNE_CORE0 0x08d -#define R2057_RXRFBIAS_BANDSEL_CORE0 0x08e -#define R2057_TIA_CONFIG_CORE0 0x08f -#define R2057_TIA_IQGAIN_CORE0 0x090 -#define R2057_TIA_IBIAS2_CORE0 0x091 -#define R2057_TIA_IBIAS1_CORE0 0x092 -#define R2057_TIA_SPARE_Q_CORE0 0x093 -#define R2057_TIA_SPARE_I_CORE0 0x094 -#define R2057_RXMIX2G_PUS_CORE0 0x095 -#define R2057_RXMIX2G_VCMREFS_CORE0 0x096 -#define R2057_RXMIX2G_LODC_QI_CORE0 0x097 -#define R2057_W12G_BW_LNA2G_PUS_CORE0 0x098 -#define R2057_LNA2G_GAIN_CORE0 0x099 -#define R2057_LNA2G_TUNE_CORE0 0x09a -#define R2057_RXMIX5G_PUS_CORE0 0x09b -#define R2057_RXMIX5G_VCMREFS_CORE0 0x09c -#define R2057_RXMIX5G_LODC_QI_CORE0 0x09d -#define R2057_W15G_BW_LNA5G_PUS_CORE0 0x09e -#define R2057_LNA5G_GAIN_CORE0 0x09f -#define R2057_LNA5G_TUNE_CORE0 0x0a0 -#define R2057_LPFSEL_TXRX_RXBB_PUS_CORE0 0x0a1 -#define R2057_RXBB_BIAS_MASTER_CORE0 0x0a2 -#define R2057_RXBB_VGABUF_IDACS_CORE0 0x0a3 -#define R2057_LPF_VCMREF_TXBUF_VCMREF_CORE0 0x0a4 -#define R2057_TXBUF_VINCM_CORE0 0x0a5 -#define R2057_TXBUF_IDACS_CORE0 0x0a6 -#define R2057_LPF_RESP_RXBUF_BW_CORE0 0x0a7 -#define R2057_RXBB_CC_CORE0 0x0a8 -#define R2057_RXBB_SPARE3_CORE0 0x0a9 -#define R2057_RXBB_RCCAL_HPC_CORE0 0x0aa -#define R2057_LPF_IDACS_CORE0 0x0ab -#define R2057_LPFBYP_DCLOOP_BYP_IDAC_CORE0 0x0ac -#define R2057_TXBUF_GAIN_CORE0 0x0ad -#define R2057_AFELOOPBACK_AACI_RESP_CORE0 0x0ae -#define R2057_RXBUF_DEGEN_CORE0 0x0af -#define R2057_RXBB_SPARE2_CORE0 0x0b0 -#define R2057_RXBB_SPARE1_CORE0 0x0b1 -#define R2057_RSSI_MASTER_CORE0 0x0b2 -#define R2057_W2_MASTER_CORE0 0x0b3 -#define R2057_NB_MASTER_CORE0 0x0b4 -#define R2057_W2_IDACS0_Q_CORE0 0x0b5 -#define R2057_W2_IDACS1_Q_CORE0 0x0b6 -#define R2057_W2_IDACS0_I_CORE0 0x0b7 -#define R2057_W2_IDACS1_I_CORE0 0x0b8 -#define R2057_RSSI_GPAIOSEL_W1_IDACS_CORE0 0x0b9 -#define R2057_NB_IDACS_Q_CORE0 0x0ba -#define R2057_NB_IDACS_I_CORE0 0x0bb -#define R2057_BACKUP4_CORE0 0x0c1 -#define R2057_BACKUP3_CORE0 0x0c2 -#define R2057_BACKUP2_CORE0 0x0c3 -#define R2057_BACKUP1_CORE0 0x0c4 -#define R2057_SPARE16_CORE0 0x0c5 -#define R2057_SPARE15_CORE0 0x0c6 -#define R2057_SPARE14_CORE0 0x0c7 -#define R2057_SPARE13_CORE0 0x0c8 -#define R2057_SPARE12_CORE0 0x0c9 -#define R2057_SPARE11_CORE0 0x0ca -#define R2057_TX2G_BIAS_RESETS_CORE0 0x0cb -#define R2057_TX5G_BIAS_RESETS_CORE0 0x0cc -#define R2057_IQTEST_SEL_PU 0x0cd -#define R2057_XTAL_CONFIG2 0x0ce -#define R2057_BUFS_MISC_LPFBW_CORE0 0x0cf -#define R2057_TXLPF_RCCAL_CORE0 0x0d0 -#define R2057_RXBB_GPAIOSEL_RXLPF_RCCAL_CORE0 0x0d1 -#define R2057_LPF_GAIN_CORE0 0x0d2 -#define R2057_DACBUF_IDACS_BW_CORE0 0x0d3 -#define R2057_RXTXBIAS_CONFIG_CORE1 0x0d4 -#define R2057_TXGM_TXRF_PUS_CORE1 0x0d5 -#define R2057_TXGM_IDAC_BLEED_CORE1 0x0d6 -#define R2057_TXGM_GAIN_CORE1 0x0db -#define R2057_TXGM2G_PKDET_PUS_CORE1 0x0dc -#define R2057_PAD2G_PTATS_CORE1 0x0dd -#define R2057_PAD2G_IDACS_CORE1 0x0de -#define R2057_PAD2G_BOOST_PU_CORE1 0x0df -#define R2057_PAD2G_CASCV_GAIN_CORE1 0x0e0 -#define R2057_TXMIX2G_TUNE_BOOST_PU_CORE1 0x0e1 -#define R2057_TXMIX2G_LODC_CORE1 0x0e2 -#define R2057_PAD2G_TUNE_PUS_CORE1 0x0e3 -#define R2057_IPA2G_GAIN_CORE1 0x0e4 -#define R2057_TSSI2G_SPARE1_CORE1 0x0e5 -#define R2057_TSSI2G_SPARE2_CORE1 0x0e6 -#define R2057_IPA2G_TUNEV_CASCV_PTAT_CORE1 0x0e7 -#define R2057_IPA2G_IMAIN_CORE1 0x0e8 -#define R2057_IPA2G_CASCONV_CORE1 0x0e9 -#define R2057_IPA2G_CASCOFFV_CORE1 0x0ea -#define R2057_IPA2G_BIAS_FILTER_CORE1 0x0eb -#define R2057_TX5G_PKDET_CORE1 0x0ee -#define R2057_PGA_PTAT_TXGM5G_PU_CORE1 0x0ef -#define R2057_PAD5G_PTATS1_CORE1 0x0f0 -#define R2057_PAD5G_CLASS_PTATS2_CORE1 0x0f1 -#define R2057_PGA_BOOSTPTAT_IMAIN_CORE1 0x0f2 -#define R2057_PAD5G_CASCV_IMAIN_CORE1 0x0f3 -#define R2057_TXMIX5G_IBOOST_PAD_IAUX_CORE1 0x0f4 -#define R2057_PGA_BOOST_TUNE_CORE1 0x0f5 -#define R2057_PGA_GAIN_CORE1 0x0f6 -#define R2057_PAD5G_CASCOFFV_GAIN_PUS_CORE1 0x0f7 -#define R2057_TXMIX5G_BOOST_TUNE_CORE1 0x0f8 -#define R2057_PAD5G_TUNE_MISC_PUS_CORE1 0x0f9 -#define R2057_IPA5G_IAUX_CORE1 0x0fa -#define R2057_IPA5G_GAIN_CORE1 0x0fb -#define R2057_TSSI5G_SPARE1_CORE1 0x0fc -#define R2057_TSSI5G_SPARE2_CORE1 0x0fd -#define R2057_IPA5G_CASCOFFV_PU_CORE1 0x0fe -#define R2057_IPA5G_PTAT_CORE1 0x0ff -#define R2057_IPA5G_IMAIN_CORE1 0x100 -#define R2057_IPA5G_CASCONV_CORE1 0x101 -#define R2057_IPA5G_BIAS_FILTER_CORE1 0x102 -#define R2057_PAD_BIAS_FILTER_BWS_CORE1 0x105 -#define R2057_TR2G_CONFIG1_CORE1_NU 0x106 -#define R2057_TR2G_CONFIG2_CORE1_NU 0x107 -#define R2057_LNA5G_RFEN_CORE1 0x108 -#define R2057_TR5G_CONFIG2_CORE1_NU 0x109 -#define R2057_RXRFBIAS_IBOOST_PU_CORE1 0x10a -#define R2057_RXRF_IABAND_RXGM_IMAIN_PTAT_CORE1 0x10b -#define R2057_RXGM_CMFBITAIL_AUXPTAT_CORE1 0x10c -#define R2057_RXMIX_ICORE_RXGM_IAUX_CORE1 0x10d -#define R2057_RXMIX_CMFBITAIL_PU_CORE1 0x10e -#define R2057_LNA2_IMAIN_PTAT_PU_CORE1 0x10f -#define R2057_LNA2_IAUX_PTAT_CORE1 0x110 -#define R2057_LNA1_IMAIN_PTAT_PU_CORE1 0x111 -#define R2057_LNA15G_INPUT_MATCH_TUNE_CORE1 0x112 -#define R2057_RXRFBIAS_BANDSEL_CORE1 0x113 -#define R2057_TIA_CONFIG_CORE1 0x114 -#define R2057_TIA_IQGAIN_CORE1 0x115 -#define R2057_TIA_IBIAS2_CORE1 0x116 -#define R2057_TIA_IBIAS1_CORE1 0x117 -#define R2057_TIA_SPARE_Q_CORE1 0x118 -#define R2057_TIA_SPARE_I_CORE1 0x119 -#define R2057_RXMIX2G_PUS_CORE1 0x11a -#define R2057_RXMIX2G_VCMREFS_CORE1 0x11b -#define R2057_RXMIX2G_LODC_QI_CORE1 0x11c -#define R2057_W12G_BW_LNA2G_PUS_CORE1 0x11d -#define R2057_LNA2G_GAIN_CORE1 0x11e -#define R2057_LNA2G_TUNE_CORE1 0x11f -#define R2057_RXMIX5G_PUS_CORE1 0x120 -#define R2057_RXMIX5G_VCMREFS_CORE1 0x121 -#define R2057_RXMIX5G_LODC_QI_CORE1 0x122 -#define R2057_W15G_BW_LNA5G_PUS_CORE1 0x123 -#define R2057_LNA5G_GAIN_CORE1 0x124 -#define R2057_LNA5G_TUNE_CORE1 0x125 -#define R2057_LPFSEL_TXRX_RXBB_PUS_CORE1 0x126 -#define R2057_RXBB_BIAS_MASTER_CORE1 0x127 -#define R2057_RXBB_VGABUF_IDACS_CORE1 0x128 -#define R2057_LPF_VCMREF_TXBUF_VCMREF_CORE1 0x129 -#define R2057_TXBUF_VINCM_CORE1 0x12a -#define R2057_TXBUF_IDACS_CORE1 0x12b -#define R2057_LPF_RESP_RXBUF_BW_CORE1 0x12c -#define R2057_RXBB_CC_CORE1 0x12d -#define R2057_RXBB_SPARE3_CORE1 0x12e -#define R2057_RXBB_RCCAL_HPC_CORE1 0x12f -#define R2057_LPF_IDACS_CORE1 0x130 -#define R2057_LPFBYP_DCLOOP_BYP_IDAC_CORE1 0x131 -#define R2057_TXBUF_GAIN_CORE1 0x132 -#define R2057_AFELOOPBACK_AACI_RESP_CORE1 0x133 -#define R2057_RXBUF_DEGEN_CORE1 0x134 -#define R2057_RXBB_SPARE2_CORE1 0x135 -#define R2057_RXBB_SPARE1_CORE1 0x136 -#define R2057_RSSI_MASTER_CORE1 0x137 -#define R2057_W2_MASTER_CORE1 0x138 -#define R2057_NB_MASTER_CORE1 0x139 -#define R2057_W2_IDACS0_Q_CORE1 0x13a -#define R2057_W2_IDACS1_Q_CORE1 0x13b -#define R2057_W2_IDACS0_I_CORE1 0x13c -#define R2057_W2_IDACS1_I_CORE1 0x13d -#define R2057_RSSI_GPAIOSEL_W1_IDACS_CORE1 0x13e -#define R2057_NB_IDACS_Q_CORE1 0x13f -#define R2057_NB_IDACS_I_CORE1 0x140 -#define R2057_BACKUP4_CORE1 0x146 -#define R2057_BACKUP3_CORE1 0x147 -#define R2057_BACKUP2_CORE1 0x148 -#define R2057_BACKUP1_CORE1 0x149 -#define R2057_SPARE16_CORE1 0x14a -#define R2057_SPARE15_CORE1 0x14b -#define R2057_SPARE14_CORE1 0x14c -#define R2057_SPARE13_CORE1 0x14d -#define R2057_SPARE12_CORE1 0x14e -#define R2057_SPARE11_CORE1 0x14f -#define R2057_TX2G_BIAS_RESETS_CORE1 0x150 -#define R2057_TX5G_BIAS_RESETS_CORE1 0x151 -#define R2057_SPARE8_CORE1 0x152 -#define R2057_SPARE7_CORE1 0x153 -#define R2057_BUFS_MISC_LPFBW_CORE1 0x154 -#define R2057_TXLPF_RCCAL_CORE1 0x155 -#define R2057_RXBB_GPAIOSEL_RXLPF_RCCAL_CORE1 0x156 -#define R2057_LPF_GAIN_CORE1 0x157 -#define R2057_DACBUF_IDACS_BW_CORE1 0x158 -#define R2057_DACBUF_VINCM_CORE1 0x159 -#define R2057_RCCAL_START_R1_Q1_P1 0x15a -#define R2057_RCCAL_X1 0x15b -#define R2057_RCCAL_TRC0 0x15c -#define R2057_RCCAL_TRC1 0x15d -#define R2057_RCCAL_DONE_OSCCAP 0x15e -#define R2057_RCCAL_N0_0 0x15f -#define R2057_RCCAL_N0_1 0x160 -#define R2057_RCCAL_N1_0 0x161 -#define R2057_RCCAL_N1_1 0x162 -#define R2057_RCAL_STATUS 0x163 -#define R2057_XTALPUOVR_PINCTRL 0x164 -#define R2057_OVR_REG0 0x165 -#define R2057_OVR_REG1 0x166 -#define R2057_OVR_REG2 0x167 -#define R2057_OVR_REG3 0x168 -#define R2057_OVR_REG4 0x169 -#define R2057_RCCAL_SCAP_VAL 0x16a -#define R2057_RCCAL_BCAP_VAL 0x16b -#define R2057_RCCAL_HPC_VAL 0x16c -#define R2057_RCCAL_OVERRIDES 0x16d -#define R2057_TX0_IQCAL_GAIN_BW 0x170 -#define R2057_TX0_LOFT_FINE_I 0x171 -#define R2057_TX0_LOFT_FINE_Q 0x172 -#define R2057_TX0_LOFT_COARSE_I 0x173 -#define R2057_TX0_LOFT_COARSE_Q 0x174 -#define R2057_TX0_TX_SSI_MASTER 0x175 -#define R2057_TX0_IQCAL_VCM_HG 0x176 -#define R2057_TX0_IQCAL_IDAC 0x177 -#define R2057_TX0_TSSI_VCM 0x178 -#define R2057_TX0_TX_SSI_MUX 0x179 -#define R2057_TX0_TSSIA 0x17a -#define R2057_TX0_TSSIG 0x17b -#define R2057_TX0_TSSI_MISC1 0x17c -#define R2057_TX0_TXRXCOUPLE_2G_ATTEN 0x17d -#define R2057_TX0_TXRXCOUPLE_2G_PWRUP 0x17e -#define R2057_TX0_TXRXCOUPLE_5G_ATTEN 0x17f -#define R2057_TX0_TXRXCOUPLE_5G_PWRUP 0x180 -#define R2057_TX1_IQCAL_GAIN_BW 0x190 -#define R2057_TX1_LOFT_FINE_I 0x191 -#define R2057_TX1_LOFT_FINE_Q 0x192 -#define R2057_TX1_LOFT_COARSE_I 0x193 -#define R2057_TX1_LOFT_COARSE_Q 0x194 -#define R2057_TX1_TX_SSI_MASTER 0x195 -#define R2057_TX1_IQCAL_VCM_HG 0x196 -#define R2057_TX1_IQCAL_IDAC 0x197 -#define R2057_TX1_TSSI_VCM 0x198 -#define R2057_TX1_TX_SSI_MUX 0x199 -#define R2057_TX1_TSSIA 0x19a -#define R2057_TX1_TSSIG 0x19b -#define R2057_TX1_TSSI_MISC1 0x19c -#define R2057_TX1_TXRXCOUPLE_2G_ATTEN 0x19d -#define R2057_TX1_TXRXCOUPLE_2G_PWRUP 0x19e -#define R2057_TX1_TXRXCOUPLE_5G_ATTEN 0x19f -#define R2057_TX1_TXRXCOUPLE_5G_PWRUP 0x1a0 -#define R2057_AFE_VCM_CAL_MASTER_CORE0 0x1a1 -#define R2057_AFE_SET_VCM_I_CORE0 0x1a2 -#define R2057_AFE_SET_VCM_Q_CORE0 0x1a3 -#define R2057_AFE_STATUS_VCM_IQADC_CORE0 0x1a4 -#define R2057_AFE_STATUS_VCM_I_CORE0 0x1a5 -#define R2057_AFE_STATUS_VCM_Q_CORE0 0x1a6 -#define R2057_AFE_VCM_CAL_MASTER_CORE1 0x1a7 -#define R2057_AFE_SET_VCM_I_CORE1 0x1a8 -#define R2057_AFE_SET_VCM_Q_CORE1 0x1a9 -#define R2057_AFE_STATUS_VCM_IQADC_CORE1 0x1aa -#define R2057_AFE_STATUS_VCM_I_CORE1 0x1ab -#define R2057_AFE_STATUS_VCM_Q_CORE1 0x1ac - -#define R2057v7_DACBUF_VINCM_CORE0 0x1ad -#define R2057v7_RCCAL_MASTER 0x1ae -#define R2057v7_TR2G_CONFIG3_CORE0_NU 0x1af -#define R2057v7_TR2G_CONFIG3_CORE1_NU 0x1b0 -#define R2057v7_LOGEN_PUS1 0x1b1 -#define R2057v7_OVR_REG5 0x1b2 -#define R2057v7_OVR_REG6 0x1b3 -#define R2057v7_OVR_REG7 0x1b4 -#define R2057v7_OVR_REG8 0x1b5 -#define R2057v7_OVR_REG9 0x1b6 -#define R2057v7_OVR_REG10 0x1b7 -#define R2057v7_OVR_REG11 0x1b8 -#define R2057v7_OVR_REG12 0x1b9 -#define R2057v7_OVR_REG13 0x1ba -#define R2057v7_OVR_REG14 0x1bb -#define R2057v7_OVR_REG15 0x1bc -#define R2057v7_OVR_REG16 0x1bd -#define R2057v7_OVR_REG1 0x1be -#define R2057v7_OVR_REG18 0x1bf -#define R2057v7_OVR_REG19 0x1c0 -#define R2057v7_OVR_REG20 0x1c1 -#define R2057v7_OVR_REG21 0x1c2 -#define R2057v7_OVR_REG2 0x1c3 -#define R2057v7_OVR_REG23 0x1c4 -#define R2057v7_OVR_REG24 0x1c5 -#define R2057v7_OVR_REG25 0x1c6 -#define R2057v7_OVR_REG26 0x1c7 -#define R2057v7_OVR_REG27 0x1c8 -#define R2057v7_OVR_REG28 0x1c9 -#define R2057v7_IQTEST_SEL_PU2 0x1ca - -#define R2057_VCM_MASK 0x7 - -void r2057_upload_inittabs(struct b43_wldev *dev); - -#endif /* B43_RADIO_2057_H_ */ diff --git a/drivers/net/wireless/b43/radio_2059.c b/drivers/net/wireless/b43/radio_2059.c deleted file mode 100644 index 38e31d857e3e..000000000000 --- a/drivers/net/wireless/b43/radio_2059.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - - Broadcom B43 wireless driver - IEEE 802.11n 2059 radio device data tables - - Copyright (c) 2011 Rafał Miłecki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "radio_2059.h" - -#define RADIOREGS(r00, r01, r02, r03, r04, r05, r06, r07, r08, r09, \ - r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, \ - r20) \ - .radio_syn16 = r00, \ - .radio_syn17 = r01, \ - .radio_syn22 = r02, \ - .radio_syn25 = r03, \ - .radio_syn27 = r04, \ - .radio_syn28 = r05, \ - .radio_syn29 = r06, \ - .radio_syn2c = r07, \ - .radio_syn2d = r08, \ - .radio_syn37 = r09, \ - .radio_syn41 = r10, \ - .radio_syn43 = r11, \ - .radio_syn47 = r12, \ - .radio_rxtx4a = r13, \ - .radio_rxtx58 = r14, \ - .radio_rxtx5a = r15, \ - .radio_rxtx6a = r16, \ - .radio_rxtx6d = r17, \ - .radio_rxtx6e = r18, \ - .radio_rxtx92 = r19, \ - .radio_rxtx98 = r20 - -#define PHYREGS(r0, r1, r2, r3, r4, r5) \ - .phy_regs.bw1 = r0, \ - .phy_regs.bw2 = r1, \ - .phy_regs.bw3 = r2, \ - .phy_regs.bw4 = r3, \ - .phy_regs.bw5 = r4, \ - .phy_regs.bw6 = r5 - -static const struct b43_phy_ht_channeltab_e_radio2059 b43_phy_ht_channeltab_radio2059[] = { - { .freq = 2412, - RADIOREGS(0x48, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x6c, - 0x09, 0x0f, 0x0a, 0x00, 0x0a, 0x00, 0x61, 0x03, - 0x00, 0x00, 0x00, 0xf0, 0x00), - PHYREGS(0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443), - }, - { .freq = 2417, - RADIOREGS(0x4b, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x71, - 0x09, 0x0f, 0x0a, 0x00, 0x0a, 0x00, 0x61, 0x03, - 0x00, 0x00, 0x00, 0xf0, 0x00), - PHYREGS(0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441), - }, - { .freq = 2422, - RADIOREGS(0x4e, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x76, - 0x09, 0x0f, 0x09, 0x00, 0x09, 0x00, 0x61, 0x03, - 0x00, 0x00, 0x00, 0xf0, 0x00), - PHYREGS(0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f), - }, - { .freq = 2427, - RADIOREGS(0x52, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x7b, - 0x09, 0x0f, 0x09, 0x00, 0x09, 0x00, 0x61, 0x03, - 0x00, 0x00, 0x00, 0xf0, 0x00), - PHYREGS(0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d), - }, - { .freq = 2432, - RADIOREGS(0x55, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x80, - 0x09, 0x0f, 0x08, 0x00, 0x08, 0x00, 0x61, 0x03, - 0x00, 0x00, 0x00, 0xf0, 0x00), - PHYREGS(0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a), - }, - { .freq = 2437, - RADIOREGS(0x58, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x85, - 0x09, 0x0f, 0x08, 0x00, 0x08, 0x00, 0x61, 0x03, - 0x00, 0x00, 0x00, 0xf0, 0x00), - PHYREGS(0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438), - }, - { .freq = 2442, - RADIOREGS(0x5c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8a, - 0x09, 0x0f, 0x07, 0x00, 0x07, 0x00, 0x61, 0x03, - 0x00, 0x00, 0x00, 0xf0, 0x00), - PHYREGS(0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436), - }, - { .freq = 2447, - RADIOREGS(0x5f, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8f, - 0x09, 0x0f, 0x07, 0x00, 0x07, 0x00, 0x61, 0x03, - 0x00, 0x00, 0x00, 0xf0, 0x00), - PHYREGS(0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434), - }, - { .freq = 2452, - RADIOREGS(0x62, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x94, - 0x09, 0x0f, 0x07, 0x00, 0x07, 0x00, 0x61, 0x03, - 0x00, 0x00, 0x00, 0xf0, 0x00), - PHYREGS(0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431), - }, - { .freq = 2457, - RADIOREGS(0x66, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x99, - 0x09, 0x0f, 0x06, 0x00, 0x06, 0x00, 0x61, 0x03, - 0x00, 0x00, 0x00, 0xf0, 0x00), - PHYREGS(0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f), - }, - { .freq = 2462, - RADIOREGS(0x69, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x9e, - 0x09, 0x0f, 0x06, 0x00, 0x06, 0x00, 0x61, 0x03, - 0x00, 0x00, 0x00, 0xf0, 0x00), - PHYREGS(0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d), - }, - { .freq = 2467, - RADIOREGS(0x6c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa3, - 0x09, 0x0f, 0x05, 0x00, 0x05, 0x00, 0x61, 0x03, - 0x00, 0x00, 0x00, 0xf0, 0x00), - PHYREGS(0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b), - }, - { .freq = 2472, - RADIOREGS(0x70, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa8, - 0x09, 0x0f, 0x05, 0x00, 0x05, 0x00, 0x61, 0x03, - 0x00, 0x00, 0x00, 0xf0, 0x00), - PHYREGS(0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429), - }, -}; - -const struct b43_phy_ht_channeltab_e_radio2059 -*b43_phy_ht_get_channeltab_e_r2059(struct b43_wldev *dev, u16 freq) -{ - const struct b43_phy_ht_channeltab_e_radio2059 *e; - unsigned int i; - - e = b43_phy_ht_channeltab_radio2059; - for (i = 0; i < ARRAY_SIZE(b43_phy_ht_channeltab_radio2059); i++, e++) { - if (e->freq == freq) - return e; - } - - return NULL; -} diff --git a/drivers/net/wireless/b43/radio_2059.h b/drivers/net/wireless/b43/radio_2059.h deleted file mode 100644 index 40a82d7f510c..000000000000 --- a/drivers/net/wireless/b43/radio_2059.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef B43_RADIO_2059_H_ -#define B43_RADIO_2059_H_ - -#include - -#include "phy_ht.h" - -#define R2059_C1 0x000 -#define R2059_C2 0x400 -#define R2059_C3 0x800 -#define R2059_ALL 0xC00 - -/* Values for various registers uploaded on channel switching */ -struct b43_phy_ht_channeltab_e_radio2059 { - /* The channel frequency in MHz */ - u16 freq; - /* Values for radio registers */ - u8 radio_syn16; - u8 radio_syn17; - u8 radio_syn22; - u8 radio_syn25; - u8 radio_syn27; - u8 radio_syn28; - u8 radio_syn29; - u8 radio_syn2c; - u8 radio_syn2d; - u8 radio_syn37; - u8 radio_syn41; - u8 radio_syn43; - u8 radio_syn47; - u8 radio_rxtx4a; - u8 radio_rxtx58; - u8 radio_rxtx5a; - u8 radio_rxtx6a; - u8 radio_rxtx6d; - u8 radio_rxtx6e; - u8 radio_rxtx92; - u8 radio_rxtx98; - /* Values for PHY registers */ - struct b43_phy_ht_channeltab_e_phy phy_regs; -}; - -const struct b43_phy_ht_channeltab_e_radio2059 -*b43_phy_ht_get_channeltab_e_r2059(struct b43_wldev *dev, u16 freq); - -#endif /* B43_RADIO_2059_H_ */ diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c deleted file mode 100644 index 70c2fcedd1bb..000000000000 --- a/drivers/net/wireless/b43/rfkill.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - - Broadcom B43 wireless driver - RFKILL support - - Copyright (c) 2007 Michael Buesch - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" - - -/* Returns TRUE, if the radio is enabled in hardware. */ -bool b43_is_hw_radio_enabled(struct b43_wldev *dev) -{ - return !(b43_read32(dev, B43_MMIO_RADIO_HWENABLED_HI) - & B43_MMIO_RADIO_HWENABLED_HI_MASK); -} - -/* The poll callback for the hardware button. */ -void b43_rfkill_poll(struct ieee80211_hw *hw) -{ - struct b43_wl *wl = hw_to_b43_wl(hw); - struct b43_wldev *dev = wl->current_dev; - bool enabled; - bool brought_up = false; - - mutex_lock(&wl->mutex); - if (unlikely(b43_status(dev) < B43_STAT_INITIALIZED)) { - if (b43_bus_powerup(dev, 0)) { - mutex_unlock(&wl->mutex); - return; - } - b43_device_enable(dev, 0); - brought_up = true; - } - - enabled = b43_is_hw_radio_enabled(dev); - - if (unlikely(enabled != dev->radio_hw_enable)) { - dev->radio_hw_enable = enabled; - b43info(wl, "Radio hardware status changed to %s\n", - enabled ? "ENABLED" : "DISABLED"); - wiphy_rfkill_set_hw_state(hw->wiphy, !enabled); - if (enabled != dev->phy.radio_on) - b43_software_rfkill(dev, !enabled); - } - - if (brought_up) { - b43_device_disable(dev, 0); - b43_bus_may_powerdown(dev); - } - - mutex_unlock(&wl->mutex); -} diff --git a/drivers/net/wireless/b43/rfkill.h b/drivers/net/wireless/b43/rfkill.h deleted file mode 100644 index f046c3ca0519..000000000000 --- a/drivers/net/wireless/b43/rfkill.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef B43_RFKILL_H_ -#define B43_RFKILL_H_ - -struct ieee80211_hw; -struct b43_wldev; - -void b43_rfkill_poll(struct ieee80211_hw *hw); - -bool b43_is_hw_radio_enabled(struct b43_wldev *dev); - -#endif /* B43_RFKILL_H_ */ diff --git a/drivers/net/wireless/b43/sdio.c b/drivers/net/wireless/b43/sdio.c deleted file mode 100644 index 59a521800694..000000000000 --- a/drivers/net/wireless/b43/sdio.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Broadcom B43 wireless driver - * - * SDIO over Sonics Silicon Backplane bus glue for b43. - * - * Copyright (C) 2009 Albert Herranz - * Copyright (C) 2009 Michael Buesch - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - */ - -#include -#include -#include -#include -#include -#include - -#include "sdio.h" -#include "b43.h" - - -#define HNBU_CHIPID 0x01 /* vendor & device id */ - -#define B43_SDIO_BLOCK_SIZE 64 /* rx fifo max size in bytes */ - - -static const struct b43_sdio_quirk { - u16 vendor; - u16 device; - unsigned int quirks; -} b43_sdio_quirks[] = { - { 0x14E4, 0x4318, SSB_QUIRK_SDIO_READ_AFTER_WRITE32, }, - { }, -}; - - -static unsigned int b43_sdio_get_quirks(u16 vendor, u16 device) -{ - const struct b43_sdio_quirk *q; - - for (q = b43_sdio_quirks; q->quirks; q++) { - if (vendor == q->vendor && device == q->device) - return q->quirks; - } - - return 0; -} - -static void b43_sdio_interrupt_dispatcher(struct sdio_func *func) -{ - struct b43_sdio *sdio = sdio_get_drvdata(func); - struct b43_wldev *dev = sdio->irq_handler_opaque; - - if (unlikely(b43_status(dev) < B43_STAT_STARTED)) - return; - - sdio_release_host(func); - sdio->irq_handler(dev); - sdio_claim_host(func); -} - -int b43_sdio_request_irq(struct b43_wldev *dev, - void (*handler)(struct b43_wldev *dev)) -{ - struct ssb_bus *bus = dev->dev->sdev->bus; - struct sdio_func *func = bus->host_sdio; - struct b43_sdio *sdio = sdio_get_drvdata(func); - int err; - - sdio->irq_handler_opaque = dev; - sdio->irq_handler = handler; - sdio_claim_host(func); - err = sdio_claim_irq(func, b43_sdio_interrupt_dispatcher); - sdio_release_host(func); - - return err; -} - -void b43_sdio_free_irq(struct b43_wldev *dev) -{ - struct ssb_bus *bus = dev->dev->sdev->bus; - struct sdio_func *func = bus->host_sdio; - struct b43_sdio *sdio = sdio_get_drvdata(func); - - sdio_claim_host(func); - sdio_release_irq(func); - sdio_release_host(func); - sdio->irq_handler_opaque = NULL; - sdio->irq_handler = NULL; -} - -static int b43_sdio_probe(struct sdio_func *func, - const struct sdio_device_id *id) -{ - struct b43_sdio *sdio; - struct sdio_func_tuple *tuple; - u16 vendor = 0, device = 0; - int error; - - /* Look for the card chip identifier. */ - tuple = func->tuples; - while (tuple) { - switch (tuple->code) { - case 0x80: - switch (tuple->data[0]) { - case HNBU_CHIPID: - if (tuple->size != 5) - break; - vendor = tuple->data[1] | (tuple->data[2]<<8); - device = tuple->data[3] | (tuple->data[4]<<8); - dev_info(&func->dev, "Chip ID %04x:%04x\n", - vendor, device); - break; - default: - break; - } - break; - default: - break; - } - tuple = tuple->next; - } - if (!vendor || !device) { - error = -ENODEV; - goto out; - } - - sdio_claim_host(func); - error = sdio_set_block_size(func, B43_SDIO_BLOCK_SIZE); - if (error) { - dev_err(&func->dev, "failed to set block size to %u bytes," - " error %d\n", B43_SDIO_BLOCK_SIZE, error); - goto err_release_host; - } - error = sdio_enable_func(func); - if (error) { - dev_err(&func->dev, "failed to enable func, error %d\n", error); - goto err_release_host; - } - sdio_release_host(func); - - sdio = kzalloc(sizeof(*sdio), GFP_KERNEL); - if (!sdio) { - error = -ENOMEM; - dev_err(&func->dev, "failed to allocate ssb bus\n"); - goto err_disable_func; - } - error = ssb_bus_sdiobus_register(&sdio->ssb, func, - b43_sdio_get_quirks(vendor, device)); - if (error) { - dev_err(&func->dev, "failed to register ssb sdio bus," - " error %d\n", error); - goto err_free_ssb; - } - sdio_set_drvdata(func, sdio); - - return 0; - -err_free_ssb: - kfree(sdio); -err_disable_func: - sdio_claim_host(func); - sdio_disable_func(func); -err_release_host: - sdio_release_host(func); -out: - return error; -} - -static void b43_sdio_remove(struct sdio_func *func) -{ - struct b43_sdio *sdio = sdio_get_drvdata(func); - - ssb_bus_unregister(&sdio->ssb); - sdio_claim_host(func); - sdio_disable_func(func); - sdio_release_host(func); - kfree(sdio); - sdio_set_drvdata(func, NULL); -} - -static const struct sdio_device_id b43_sdio_ids[] = { - { SDIO_DEVICE(0x02d0, 0x044b) }, /* Nintendo Wii WLAN daughter card */ - { SDIO_DEVICE(0x0092, 0x0004) }, /* C-guys, Inc. EW-CG1102GC */ - { }, -}; - -static struct sdio_driver b43_sdio_driver = { - .name = "b43-sdio", - .id_table = b43_sdio_ids, - .probe = b43_sdio_probe, - .remove = b43_sdio_remove, -}; - -int b43_sdio_init(void) -{ - return sdio_register_driver(&b43_sdio_driver); -} - -void b43_sdio_exit(void) -{ - sdio_unregister_driver(&b43_sdio_driver); -} diff --git a/drivers/net/wireless/b43/sdio.h b/drivers/net/wireless/b43/sdio.h deleted file mode 100644 index 1e93926f388f..000000000000 --- a/drivers/net/wireless/b43/sdio.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef B43_SDIO_H_ -#define B43_SDIO_H_ - -#include - -struct b43_wldev; - - -#ifdef CONFIG_B43_SDIO - -struct b43_sdio { - struct ssb_bus ssb; - void *irq_handler_opaque; - void (*irq_handler)(struct b43_wldev *dev); -}; - -int b43_sdio_request_irq(struct b43_wldev *dev, - void (*handler)(struct b43_wldev *dev)); -void b43_sdio_free_irq(struct b43_wldev *dev); - -int b43_sdio_init(void); -void b43_sdio_exit(void); - - -#else /* CONFIG_B43_SDIO */ - - -static inline int b43_sdio_request_irq(struct b43_wldev *dev, - void (*handler)(struct b43_wldev *dev)) -{ - return -ENODEV; -} -static inline void b43_sdio_free_irq(struct b43_wldev *dev) -{ -} -static inline int b43_sdio_init(void) -{ - return 0; -} -static inline void b43_sdio_exit(void) -{ -} - -#endif /* CONFIG_B43_SDIO */ -#endif /* B43_SDIO_H_ */ diff --git a/drivers/net/wireless/b43/sysfs.c b/drivers/net/wireless/b43/sysfs.c deleted file mode 100644 index 8e8431d4eb0c..000000000000 --- a/drivers/net/wireless/b43/sysfs.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - - Broadcom B43 wireless driver - - SYSFS support routines - - Copyright (c) 2006 Michael Buesch - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include -#include - -#include "b43.h" -#include "sysfs.h" -#include "main.h" -#include "phy_common.h" - -#define GENERIC_FILESIZE 64 - -static int get_integer(const char *buf, size_t count) -{ - char tmp[10 + 1] = { 0 }; - int ret = -EINVAL; - - if (count == 0) - goto out; - count = min(count, (size_t) 10); - memcpy(tmp, buf, count); - ret = simple_strtol(tmp, NULL, 10); - out: - return ret; -} - -static ssize_t b43_attr_interfmode_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct b43_wldev *wldev = dev_to_b43_wldev(dev); - ssize_t count = 0; - - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - mutex_lock(&wldev->wl->mutex); - - if (wldev->phy.type != B43_PHYTYPE_G) { - mutex_unlock(&wldev->wl->mutex); - return -ENOSYS; - } - - switch (wldev->phy.g->interfmode) { - case B43_INTERFMODE_NONE: - count = - snprintf(buf, PAGE_SIZE, - "0 (No Interference Mitigation)\n"); - break; - case B43_INTERFMODE_NONWLAN: - count = - snprintf(buf, PAGE_SIZE, - "1 (Non-WLAN Interference Mitigation)\n"); - break; - case B43_INTERFMODE_MANUALWLAN: - count = - snprintf(buf, PAGE_SIZE, - "2 (WLAN Interference Mitigation)\n"); - break; - default: - B43_WARN_ON(1); - } - - mutex_unlock(&wldev->wl->mutex); - - return count; -} - -static ssize_t b43_attr_interfmode_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct b43_wldev *wldev = dev_to_b43_wldev(dev); - int err; - int mode; - - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - mode = get_integer(buf, count); - switch (mode) { - case 0: - mode = B43_INTERFMODE_NONE; - break; - case 1: - mode = B43_INTERFMODE_NONWLAN; - break; - case 2: - mode = B43_INTERFMODE_MANUALWLAN; - break; - case 3: - mode = B43_INTERFMODE_AUTOWLAN; - break; - default: - return -EINVAL; - } - - mutex_lock(&wldev->wl->mutex); - - if (wldev->phy.ops->interf_mitigation) { - err = wldev->phy.ops->interf_mitigation(wldev, mode); - if (err) { - b43err(wldev->wl, "Interference Mitigation not " - "supported by device\n"); - } - } else - err = -ENOSYS; - - mmiowb(); - mutex_unlock(&wldev->wl->mutex); - - return err ? err : count; -} - -static DEVICE_ATTR(interference, 0644, - b43_attr_interfmode_show, b43_attr_interfmode_store); - -int b43_sysfs_register(struct b43_wldev *wldev) -{ - struct device *dev = wldev->dev->dev; - - B43_WARN_ON(b43_status(wldev) != B43_STAT_INITIALIZED); - - return device_create_file(dev, &dev_attr_interference); -} - -void b43_sysfs_unregister(struct b43_wldev *wldev) -{ - struct device *dev = wldev->dev->dev; - - device_remove_file(dev, &dev_attr_interference); -} diff --git a/drivers/net/wireless/b43/sysfs.h b/drivers/net/wireless/b43/sysfs.h deleted file mode 100644 index 12bda9ef1a85..000000000000 --- a/drivers/net/wireless/b43/sysfs.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef B43_SYSFS_H_ -#define B43_SYSFS_H_ - -struct b43_wldev; - -int b43_sysfs_register(struct b43_wldev *dev); -void b43_sysfs_unregister(struct b43_wldev *dev); - -#endif /* B43_SYSFS_H_ */ diff --git a/drivers/net/wireless/b43/tables.c b/drivers/net/wireless/b43/tables.c deleted file mode 100644 index ea288df8aee9..000000000000 --- a/drivers/net/wireless/b43/tables.c +++ /dev/null @@ -1,466 +0,0 @@ -/* - - Broadcom B43 wireless driver - - Copyright (c) 2005 Martin Langer , - Copyright (c) 2005-2007 Stefano Brivio - Copyright (c) 2006, 2006 Michael Buesch - Copyright (c) 2005 Danny van Dyk - Copyright (c) 2005 Andreas Jaggi - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "tables.h" -#include "phy_g.h" - - -const u32 b43_tab_rotor[] = { - 0xFEB93FFD, 0xFEC63FFD, /* 0 */ - 0xFED23FFD, 0xFEDF3FFD, - 0xFEEC3FFE, 0xFEF83FFE, - 0xFF053FFE, 0xFF113FFE, - 0xFF1E3FFE, 0xFF2A3FFF, /* 8 */ - 0xFF373FFF, 0xFF443FFF, - 0xFF503FFF, 0xFF5D3FFF, - 0xFF693FFF, 0xFF763FFF, - 0xFF824000, 0xFF8F4000, /* 16 */ - 0xFF9B4000, 0xFFA84000, - 0xFFB54000, 0xFFC14000, - 0xFFCE4000, 0xFFDA4000, - 0xFFE74000, 0xFFF34000, /* 24 */ - 0x00004000, 0x000D4000, - 0x00194000, 0x00264000, - 0x00324000, 0x003F4000, - 0x004B4000, 0x00584000, /* 32 */ - 0x00654000, 0x00714000, - 0x007E4000, 0x008A3FFF, - 0x00973FFF, 0x00A33FFF, - 0x00B03FFF, 0x00BC3FFF, /* 40 */ - 0x00C93FFF, 0x00D63FFF, - 0x00E23FFE, 0x00EF3FFE, - 0x00FB3FFE, 0x01083FFE, - 0x01143FFE, 0x01213FFD, /* 48 */ - 0x012E3FFD, 0x013A3FFD, - 0x01473FFD, -}; - -const u32 b43_tab_retard[] = { - 0xDB93CB87, 0xD666CF64, /* 0 */ - 0xD1FDD358, 0xCDA6D826, - 0xCA38DD9F, 0xC729E2B4, - 0xC469E88E, 0xC26AEE2B, - 0xC0DEF46C, 0xC073FA62, /* 8 */ - 0xC01D00D5, 0xC0760743, - 0xC1560D1E, 0xC2E51369, - 0xC4ED18FF, 0xC7AC1ED7, - 0xCB2823B2, 0xCEFA28D9, /* 16 */ - 0xD2F62D3F, 0xD7BB3197, - 0xDCE53568, 0xE1FE3875, - 0xE7D13B35, 0xED663D35, - 0xF39B3EC4, 0xF98E3FA7, /* 24 */ - 0x00004000, 0x06723FA7, - 0x0C653EC4, 0x129A3D35, - 0x182F3B35, 0x1E023875, - 0x231B3568, 0x28453197, /* 32 */ - 0x2D0A2D3F, 0x310628D9, - 0x34D823B2, 0x38541ED7, - 0x3B1318FF, 0x3D1B1369, - 0x3EAA0D1E, 0x3F8A0743, /* 40 */ - 0x3FE300D5, 0x3F8DFA62, - 0x3F22F46C, 0x3D96EE2B, - 0x3B97E88E, 0x38D7E2B4, - 0x35C8DD9F, 0x325AD826, /* 48 */ - 0x2E03D358, 0x299ACF64, - 0x246DCB87, -}; - -const u16 b43_tab_finefreqa[] = { - 0x0082, 0x0082, 0x0102, 0x0182, /* 0 */ - 0x0202, 0x0282, 0x0302, 0x0382, - 0x0402, 0x0482, 0x0502, 0x0582, - 0x05E2, 0x0662, 0x06E2, 0x0762, - 0x07E2, 0x0842, 0x08C2, 0x0942, /* 16 */ - 0x09C2, 0x0A22, 0x0AA2, 0x0B02, - 0x0B82, 0x0BE2, 0x0C62, 0x0CC2, - 0x0D42, 0x0DA2, 0x0E02, 0x0E62, - 0x0EE2, 0x0F42, 0x0FA2, 0x1002, /* 32 */ - 0x1062, 0x10C2, 0x1122, 0x1182, - 0x11E2, 0x1242, 0x12A2, 0x12E2, - 0x1342, 0x13A2, 0x1402, 0x1442, - 0x14A2, 0x14E2, 0x1542, 0x1582, /* 48 */ - 0x15E2, 0x1622, 0x1662, 0x16C1, - 0x1701, 0x1741, 0x1781, 0x17E1, - 0x1821, 0x1861, 0x18A1, 0x18E1, - 0x1921, 0x1961, 0x19A1, 0x19E1, /* 64 */ - 0x1A21, 0x1A61, 0x1AA1, 0x1AC1, - 0x1B01, 0x1B41, 0x1B81, 0x1BA1, - 0x1BE1, 0x1C21, 0x1C41, 0x1C81, - 0x1CA1, 0x1CE1, 0x1D01, 0x1D41, /* 80 */ - 0x1D61, 0x1DA1, 0x1DC1, 0x1E01, - 0x1E21, 0x1E61, 0x1E81, 0x1EA1, - 0x1EE1, 0x1F01, 0x1F21, 0x1F41, - 0x1F81, 0x1FA1, 0x1FC1, 0x1FE1, /* 96 */ - 0x2001, 0x2041, 0x2061, 0x2081, - 0x20A1, 0x20C1, 0x20E1, 0x2101, - 0x2121, 0x2141, 0x2161, 0x2181, - 0x21A1, 0x21C1, 0x21E1, 0x2201, /* 112 */ - 0x2221, 0x2241, 0x2261, 0x2281, - 0x22A1, 0x22C1, 0x22C1, 0x22E1, - 0x2301, 0x2321, 0x2341, 0x2361, - 0x2361, 0x2381, 0x23A1, 0x23C1, /* 128 */ - 0x23E1, 0x23E1, 0x2401, 0x2421, - 0x2441, 0x2441, 0x2461, 0x2481, - 0x2481, 0x24A1, 0x24C1, 0x24C1, - 0x24E1, 0x2501, 0x2501, 0x2521, /* 144 */ - 0x2541, 0x2541, 0x2561, 0x2561, - 0x2581, 0x25A1, 0x25A1, 0x25C1, - 0x25C1, 0x25E1, 0x2601, 0x2601, - 0x2621, 0x2621, 0x2641, 0x2641, /* 160 */ - 0x2661, 0x2661, 0x2681, 0x2681, - 0x26A1, 0x26A1, 0x26C1, 0x26C1, - 0x26E1, 0x26E1, 0x2701, 0x2701, - 0x2721, 0x2721, 0x2740, 0x2740, /* 176 */ - 0x2760, 0x2760, 0x2780, 0x2780, - 0x2780, 0x27A0, 0x27A0, 0x27C0, - 0x27C0, 0x27E0, 0x27E0, 0x27E0, - 0x2800, 0x2800, 0x2820, 0x2820, /* 192 */ - 0x2820, 0x2840, 0x2840, 0x2840, - 0x2860, 0x2860, 0x2880, 0x2880, - 0x2880, 0x28A0, 0x28A0, 0x28A0, - 0x28C0, 0x28C0, 0x28C0, 0x28E0, /* 208 */ - 0x28E0, 0x28E0, 0x2900, 0x2900, - 0x2900, 0x2920, 0x2920, 0x2920, - 0x2940, 0x2940, 0x2940, 0x2960, - 0x2960, 0x2960, 0x2960, 0x2980, /* 224 */ - 0x2980, 0x2980, 0x29A0, 0x29A0, - 0x29A0, 0x29A0, 0x29C0, 0x29C0, - 0x29C0, 0x29E0, 0x29E0, 0x29E0, - 0x29E0, 0x2A00, 0x2A00, 0x2A00, /* 240 */ - 0x2A00, 0x2A20, 0x2A20, 0x2A20, - 0x2A20, 0x2A40, 0x2A40, 0x2A40, - 0x2A40, 0x2A60, 0x2A60, 0x2A60, -}; - -const u16 b43_tab_finefreqg[] = { - 0x0089, 0x02E9, 0x0409, 0x04E9, /* 0 */ - 0x05A9, 0x0669, 0x0709, 0x0789, - 0x0829, 0x08A9, 0x0929, 0x0989, - 0x0A09, 0x0A69, 0x0AC9, 0x0B29, - 0x0BA9, 0x0BE9, 0x0C49, 0x0CA9, /* 16 */ - 0x0D09, 0x0D69, 0x0DA9, 0x0E09, - 0x0E69, 0x0EA9, 0x0F09, 0x0F49, - 0x0FA9, 0x0FE9, 0x1029, 0x1089, - 0x10C9, 0x1109, 0x1169, 0x11A9, /* 32 */ - 0x11E9, 0x1229, 0x1289, 0x12C9, - 0x1309, 0x1349, 0x1389, 0x13C9, - 0x1409, 0x1449, 0x14A9, 0x14E9, - 0x1529, 0x1569, 0x15A9, 0x15E9, /* 48 */ - 0x1629, 0x1669, 0x16A9, 0x16E8, - 0x1728, 0x1768, 0x17A8, 0x17E8, - 0x1828, 0x1868, 0x18A8, 0x18E8, - 0x1928, 0x1968, 0x19A8, 0x19E8, /* 64 */ - 0x1A28, 0x1A68, 0x1AA8, 0x1AE8, - 0x1B28, 0x1B68, 0x1BA8, 0x1BE8, - 0x1C28, 0x1C68, 0x1CA8, 0x1CE8, - 0x1D28, 0x1D68, 0x1DC8, 0x1E08, /* 80 */ - 0x1E48, 0x1E88, 0x1EC8, 0x1F08, - 0x1F48, 0x1F88, 0x1FE8, 0x2028, - 0x2068, 0x20A8, 0x2108, 0x2148, - 0x2188, 0x21C8, 0x2228, 0x2268, /* 96 */ - 0x22C8, 0x2308, 0x2348, 0x23A8, - 0x23E8, 0x2448, 0x24A8, 0x24E8, - 0x2548, 0x25A8, 0x2608, 0x2668, - 0x26C8, 0x2728, 0x2787, 0x27E7, /* 112 */ - 0x2847, 0x28C7, 0x2947, 0x29A7, - 0x2A27, 0x2AC7, 0x2B47, 0x2BE7, - 0x2CA7, 0x2D67, 0x2E47, 0x2F67, - 0x3247, 0x3526, 0x3646, 0x3726, /* 128 */ - 0x3806, 0x38A6, 0x3946, 0x39E6, - 0x3A66, 0x3AE6, 0x3B66, 0x3BC6, - 0x3C45, 0x3CA5, 0x3D05, 0x3D85, - 0x3DE5, 0x3E45, 0x3EA5, 0x3EE5, /* 144 */ - 0x3F45, 0x3FA5, 0x4005, 0x4045, - 0x40A5, 0x40E5, 0x4145, 0x4185, - 0x41E5, 0x4225, 0x4265, 0x42C5, - 0x4305, 0x4345, 0x43A5, 0x43E5, /* 160 */ - 0x4424, 0x4464, 0x44C4, 0x4504, - 0x4544, 0x4584, 0x45C4, 0x4604, - 0x4644, 0x46A4, 0x46E4, 0x4724, - 0x4764, 0x47A4, 0x47E4, 0x4824, /* 176 */ - 0x4864, 0x48A4, 0x48E4, 0x4924, - 0x4964, 0x49A4, 0x49E4, 0x4A24, - 0x4A64, 0x4AA4, 0x4AE4, 0x4B23, - 0x4B63, 0x4BA3, 0x4BE3, 0x4C23, /* 192 */ - 0x4C63, 0x4CA3, 0x4CE3, 0x4D23, - 0x4D63, 0x4DA3, 0x4DE3, 0x4E23, - 0x4E63, 0x4EA3, 0x4EE3, 0x4F23, - 0x4F63, 0x4FC3, 0x5003, 0x5043, /* 208 */ - 0x5083, 0x50C3, 0x5103, 0x5143, - 0x5183, 0x51E2, 0x5222, 0x5262, - 0x52A2, 0x52E2, 0x5342, 0x5382, - 0x53C2, 0x5402, 0x5462, 0x54A2, /* 224 */ - 0x5502, 0x5542, 0x55A2, 0x55E2, - 0x5642, 0x5682, 0x56E2, 0x5722, - 0x5782, 0x57E1, 0x5841, 0x58A1, - 0x5901, 0x5961, 0x59C1, 0x5A21, /* 240 */ - 0x5AA1, 0x5B01, 0x5B81, 0x5BE1, - 0x5C61, 0x5D01, 0x5D80, 0x5E20, - 0x5EE0, 0x5FA0, 0x6080, 0x61C0, -}; - -const u16 b43_tab_noisea2[] = { - 0x0001, 0x0001, 0x0001, 0xFFFE, - 0xFFFE, 0x3FFF, 0x1000, 0x0393, -}; - -const u16 b43_tab_noisea3[] = { - 0x5E5E, 0x5E5E, 0x5E5E, 0x3F48, - 0x4C4C, 0x4C4C, 0x4C4C, 0x2D36, -}; - -const u16 b43_tab_noiseg1[] = { - 0x013C, 0x01F5, 0x031A, 0x0631, - 0x0001, 0x0001, 0x0001, 0x0001, -}; - -const u16 b43_tab_noiseg2[] = { - 0x5484, 0x3C40, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, -}; - -const u16 b43_tab_noisescalea2[] = { - 0x6767, 0x6767, 0x6767, 0x6767, /* 0 */ - 0x6767, 0x6767, 0x6767, 0x6767, - 0x6767, 0x6767, 0x6767, 0x6767, - 0x6767, 0x6700, 0x6767, 0x6767, - 0x6767, 0x6767, 0x6767, 0x6767, /* 16 */ - 0x6767, 0x6767, 0x6767, 0x6767, - 0x6767, 0x6767, 0x0067, -}; - -const u16 b43_tab_noisescalea3[] = { - 0x2323, 0x2323, 0x2323, 0x2323, /* 0 */ - 0x2323, 0x2323, 0x2323, 0x2323, - 0x2323, 0x2323, 0x2323, 0x2323, - 0x2323, 0x2300, 0x2323, 0x2323, - 0x2323, 0x2323, 0x2323, 0x2323, /* 16 */ - 0x2323, 0x2323, 0x2323, 0x2323, - 0x2323, 0x2323, 0x0023, -}; - -const u16 b43_tab_noisescaleg1[] = { - 0x6C77, 0x5162, 0x3B40, 0x3335, /* 0 */ - 0x2F2D, 0x2A2A, 0x2527, 0x1F21, - 0x1A1D, 0x1719, 0x1616, 0x1414, - 0x1414, 0x1400, 0x1414, 0x1614, - 0x1716, 0x1A19, 0x1F1D, 0x2521, /* 16 */ - 0x2A27, 0x2F2A, 0x332D, 0x3B35, - 0x5140, 0x6C62, 0x0077, -}; - -const u16 b43_tab_noisescaleg2[] = { - 0xD8DD, 0xCBD4, 0xBCC0, 0xB6B7, /* 0 */ - 0xB2B0, 0xADAD, 0xA7A9, 0x9FA1, - 0x969B, 0x9195, 0x8F8F, 0x8A8A, - 0x8A8A, 0x8A00, 0x8A8A, 0x8F8A, - 0x918F, 0x9695, 0x9F9B, 0xA7A1, /* 16 */ - 0xADA9, 0xB2AD, 0xB6B0, 0xBCB7, - 0xCBC0, 0xD8D4, 0x00DD, -}; - -const u16 b43_tab_noisescaleg3[] = { - 0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4, /* 0 */ - 0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4, - 0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4, - 0xA4A4, 0xA400, 0xA4A4, 0xA4A4, - 0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4, /* 16 */ - 0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4, - 0xA4A4, 0xA4A4, 0x00A4, -}; - -const u16 b43_tab_sigmasqr1[] = { - 0x007A, 0x0075, 0x0071, 0x006C, /* 0 */ - 0x0067, 0x0063, 0x005E, 0x0059, - 0x0054, 0x0050, 0x004B, 0x0046, - 0x0042, 0x003D, 0x003D, 0x003D, - 0x003D, 0x003D, 0x003D, 0x003D, /* 16 */ - 0x003D, 0x003D, 0x003D, 0x003D, - 0x003D, 0x003D, 0x0000, 0x003D, - 0x003D, 0x003D, 0x003D, 0x003D, - 0x003D, 0x003D, 0x003D, 0x003D, /* 32 */ - 0x003D, 0x003D, 0x003D, 0x003D, - 0x0042, 0x0046, 0x004B, 0x0050, - 0x0054, 0x0059, 0x005E, 0x0063, - 0x0067, 0x006C, 0x0071, 0x0075, /* 48 */ - 0x007A, -}; - -const u16 b43_tab_sigmasqr2[] = { - 0x00DE, 0x00DC, 0x00DA, 0x00D8, /* 0 */ - 0x00D6, 0x00D4, 0x00D2, 0x00CF, - 0x00CD, 0x00CA, 0x00C7, 0x00C4, - 0x00C1, 0x00BE, 0x00BE, 0x00BE, - 0x00BE, 0x00BE, 0x00BE, 0x00BE, /* 16 */ - 0x00BE, 0x00BE, 0x00BE, 0x00BE, - 0x00BE, 0x00BE, 0x0000, 0x00BE, - 0x00BE, 0x00BE, 0x00BE, 0x00BE, - 0x00BE, 0x00BE, 0x00BE, 0x00BE, /* 32 */ - 0x00BE, 0x00BE, 0x00BE, 0x00BE, - 0x00C1, 0x00C4, 0x00C7, 0x00CA, - 0x00CD, 0x00CF, 0x00D2, 0x00D4, - 0x00D6, 0x00D8, 0x00DA, 0x00DC, /* 48 */ - 0x00DE, -}; - -const u16 b43_tab_rssiagc1[] = { - 0xFFF8, 0xFFF8, 0xFFF8, 0xFFF8, /* 0 */ - 0xFFF8, 0xFFF9, 0xFFFC, 0xFFFE, - 0xFFF8, 0xFFF8, 0xFFF8, 0xFFF8, - 0xFFF8, 0xFFF8, 0xFFF8, 0xFFF8, -}; - -const u16 b43_tab_rssiagc2[] = { - 0x0820, 0x0820, 0x0920, 0x0C38, /* 0 */ - 0x0820, 0x0820, 0x0820, 0x0820, - 0x0820, 0x0820, 0x0920, 0x0A38, - 0x0820, 0x0820, 0x0820, 0x0820, - 0x0820, 0x0820, 0x0920, 0x0A38, /* 16 */ - 0x0820, 0x0820, 0x0820, 0x0820, - 0x0820, 0x0820, 0x0920, 0x0A38, - 0x0820, 0x0820, 0x0820, 0x0820, - 0x0820, 0x0820, 0x0920, 0x0A38, /* 32 */ - 0x0820, 0x0820, 0x0820, 0x0820, - 0x0820, 0x0820, 0x0920, 0x0A38, - 0x0820, 0x0820, 0x0820, 0x0820, -}; - -static inline void assert_sizes(void) -{ - BUILD_BUG_ON(B43_TAB_ROTOR_SIZE != ARRAY_SIZE(b43_tab_rotor)); - BUILD_BUG_ON(B43_TAB_RETARD_SIZE != ARRAY_SIZE(b43_tab_retard)); - BUILD_BUG_ON(B43_TAB_FINEFREQA_SIZE != ARRAY_SIZE(b43_tab_finefreqa)); - BUILD_BUG_ON(B43_TAB_FINEFREQG_SIZE != ARRAY_SIZE(b43_tab_finefreqg)); - BUILD_BUG_ON(B43_TAB_NOISEA2_SIZE != ARRAY_SIZE(b43_tab_noisea2)); - BUILD_BUG_ON(B43_TAB_NOISEA3_SIZE != ARRAY_SIZE(b43_tab_noisea3)); - BUILD_BUG_ON(B43_TAB_NOISEG1_SIZE != ARRAY_SIZE(b43_tab_noiseg1)); - BUILD_BUG_ON(B43_TAB_NOISEG2_SIZE != ARRAY_SIZE(b43_tab_noiseg2)); - BUILD_BUG_ON(B43_TAB_NOISESCALE_SIZE != - ARRAY_SIZE(b43_tab_noisescalea2)); - BUILD_BUG_ON(B43_TAB_NOISESCALE_SIZE != - ARRAY_SIZE(b43_tab_noisescalea3)); - BUILD_BUG_ON(B43_TAB_NOISESCALE_SIZE != - ARRAY_SIZE(b43_tab_noisescaleg1)); - BUILD_BUG_ON(B43_TAB_NOISESCALE_SIZE != - ARRAY_SIZE(b43_tab_noisescaleg2)); - BUILD_BUG_ON(B43_TAB_NOISESCALE_SIZE != - ARRAY_SIZE(b43_tab_noisescaleg3)); - BUILD_BUG_ON(B43_TAB_SIGMASQR_SIZE != ARRAY_SIZE(b43_tab_sigmasqr1)); - BUILD_BUG_ON(B43_TAB_SIGMASQR_SIZE != ARRAY_SIZE(b43_tab_sigmasqr2)); - BUILD_BUG_ON(B43_TAB_RSSIAGC1_SIZE != ARRAY_SIZE(b43_tab_rssiagc1)); - BUILD_BUG_ON(B43_TAB_RSSIAGC2_SIZE != ARRAY_SIZE(b43_tab_rssiagc2)); -} - -u16 b43_ofdmtab_read16(struct b43_wldev *dev, u16 table, u16 offset) -{ - struct b43_phy_g *gphy = dev->phy.g; - u16 addr; - - addr = table + offset; - if ((gphy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_READ) || - (addr - 1 != gphy->ofdmtab_addr)) { - /* The hardware has a different address in memory. Update it. */ - b43_phy_write(dev, B43_PHY_OTABLECTL, addr); - gphy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_READ; - } - gphy->ofdmtab_addr = addr; - - return b43_phy_read(dev, B43_PHY_OTABLEI); - - /* Some compiletime assertions... */ - assert_sizes(); -} - -void b43_ofdmtab_write16(struct b43_wldev *dev, u16 table, - u16 offset, u16 value) -{ - struct b43_phy_g *gphy = dev->phy.g; - u16 addr; - - addr = table + offset; - if ((gphy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_WRITE) || - (addr - 1 != gphy->ofdmtab_addr)) { - /* The hardware has a different address in memory. Update it. */ - b43_phy_write(dev, B43_PHY_OTABLECTL, addr); - gphy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_WRITE; - } - gphy->ofdmtab_addr = addr; - b43_phy_write(dev, B43_PHY_OTABLEI, value); -} - -u32 b43_ofdmtab_read32(struct b43_wldev *dev, u16 table, u16 offset) -{ - struct b43_phy_g *gphy = dev->phy.g; - u32 ret; - u16 addr; - - addr = table + offset; - if ((gphy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_READ) || - (addr - 1 != gphy->ofdmtab_addr)) { - /* The hardware has a different address in memory. Update it. */ - b43_phy_write(dev, B43_PHY_OTABLECTL, addr); - gphy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_READ; - } - gphy->ofdmtab_addr = addr; - ret = b43_phy_read(dev, B43_PHY_OTABLEQ); - ret <<= 16; - ret |= b43_phy_read(dev, B43_PHY_OTABLEI); - - return ret; -} - -void b43_ofdmtab_write32(struct b43_wldev *dev, u16 table, - u16 offset, u32 value) -{ - struct b43_phy_g *gphy = dev->phy.g; - u16 addr; - - addr = table + offset; - if ((gphy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_WRITE) || - (addr - 1 != gphy->ofdmtab_addr)) { - /* The hardware has a different address in memory. Update it. */ - b43_phy_write(dev, B43_PHY_OTABLECTL, addr); - gphy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_WRITE; - } - gphy->ofdmtab_addr = addr; - - b43_phy_write(dev, B43_PHY_OTABLEI, value); - b43_phy_write(dev, B43_PHY_OTABLEQ, (value >> 16)); -} - -u16 b43_gtab_read(struct b43_wldev *dev, u16 table, u16 offset) -{ - b43_phy_write(dev, B43_PHY_GTABCTL, table + offset); - return b43_phy_read(dev, B43_PHY_GTABDATA); -} - -void b43_gtab_write(struct b43_wldev *dev, u16 table, u16 offset, u16 value) -{ - b43_phy_write(dev, B43_PHY_GTABCTL, table + offset); - b43_phy_write(dev, B43_PHY_GTABDATA, value); -} diff --git a/drivers/net/wireless/b43/tables.h b/drivers/net/wireless/b43/tables.h deleted file mode 100644 index 80e73c7cbac5..000000000000 --- a/drivers/net/wireless/b43/tables.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef B43_TABLES_H_ -#define B43_TABLES_H_ - -#define B43_TAB_ROTOR_SIZE 53 -extern const u32 b43_tab_rotor[]; -#define B43_TAB_RETARD_SIZE 53 -extern const u32 b43_tab_retard[]; -#define B43_TAB_FINEFREQA_SIZE 256 -extern const u16 b43_tab_finefreqa[]; -#define B43_TAB_FINEFREQG_SIZE 256 -extern const u16 b43_tab_finefreqg[]; -#define B43_TAB_NOISEA2_SIZE 8 -extern const u16 b43_tab_noisea2[]; -#define B43_TAB_NOISEA3_SIZE 8 -extern const u16 b43_tab_noisea3[]; -#define B43_TAB_NOISEG1_SIZE 8 -extern const u16 b43_tab_noiseg1[]; -#define B43_TAB_NOISEG2_SIZE 8 -extern const u16 b43_tab_noiseg2[]; -#define B43_TAB_NOISESCALE_SIZE 27 -extern const u16 b43_tab_noisescalea2[]; -extern const u16 b43_tab_noisescalea3[]; -extern const u16 b43_tab_noisescaleg1[]; -extern const u16 b43_tab_noisescaleg2[]; -extern const u16 b43_tab_noisescaleg3[]; -#define B43_TAB_SIGMASQR_SIZE 53 -extern const u16 b43_tab_sigmasqr1[]; -extern const u16 b43_tab_sigmasqr2[]; -#define B43_TAB_RSSIAGC1_SIZE 16 -extern const u16 b43_tab_rssiagc1[]; -#define B43_TAB_RSSIAGC2_SIZE 48 -extern const u16 b43_tab_rssiagc2[]; - -#endif /* B43_TABLES_H_ */ diff --git a/drivers/net/wireless/b43/tables_lpphy.c b/drivers/net/wireless/b43/tables_lpphy.c deleted file mode 100644 index cff187c5616d..000000000000 --- a/drivers/net/wireless/b43/tables_lpphy.c +++ /dev/null @@ -1,2456 +0,0 @@ -/* - - Broadcom B43 wireless driver - IEEE 802.11a/g LP-PHY and radio device data tables - - Copyright (c) 2009 Michael Buesch - Copyright (c) 2009 Gábor Stefanik - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "tables_lpphy.h" -#include "phy_common.h" -#include "phy_lp.h" - - -/* Entry of the 2062/2063 radio init table */ -struct b206x_init_tab_entry { - u16 offset; - u16 value_a; - u16 value_g; - u8 flags; -}; -#define B206X_FLAG_A 0x01 /* Flag: Init in A mode */ -#define B206X_FLAG_G 0x02 /* Flag: Init in G mode */ - -static const struct b206x_init_tab_entry b2062_init_tab[] = { - /* { .offset = B2062_N_COMM1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = 0x0001, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_COMM2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_COMM3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_N_COMM4, .value_a = 0x0001, .value_g = 0x0000, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_N_COMM5, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_COMM6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_COMM7, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_COMM8, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_COMM9, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_COMM10, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_COMM11, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_COMM12, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_COMM13, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_COMM14, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_COMM15, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_PDN_CTL0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_N_PDN_CTL1, .value_a = 0x0000, .value_g = 0x00CA, .flags = B206X_FLAG_G, }, - /* { .offset = B2062_N_PDN_CTL2, .value_a = 0x0018, .value_g = 0x0018, .flags = 0, }, */ - { .offset = B2062_N_PDN_CTL3, .value_a = 0x0000, .value_g = 0x0000, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_N_PDN_CTL4, .value_a = 0x0015, .value_g = 0x002A, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_N_GEN_CTL0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_IQ_CALIB, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */ - { .offset = B2062_N_LGENC, .value_a = 0x00DB, .value_g = 0x00FF, .flags = B206X_FLAG_A, }, - /* { .offset = B2062_N_LGENA_LPF, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */ - /* { .offset = B2062_N_LGENA_BIAS0, .value_a = 0x0041, .value_g = 0x0041, .flags = 0, }, */ - /* { .offset = B2062_N_LGNEA_BIAS1, .value_a = 0x0002, .value_g = 0x0002, .flags = 0, }, */ - /* { .offset = B2062_N_LGENA_CTL0, .value_a = 0x0032, .value_g = 0x0032, .flags = 0, }, */ - /* { .offset = B2062_N_LGENA_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_LGENA_CTL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_N_LGENA_TUNE0, .value_a = 0x00DD, .value_g = 0x0000, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_N_LGENA_TUNE1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_N_LGENA_TUNE2, .value_a = 0x00DD, .value_g = 0x0000, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_N_LGENA_TUNE3, .value_a = 0x0077, .value_g = 0x00B5, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_N_LGENA_CTL3, .value_a = 0x0000, .value_g = 0x00FF, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_N_LGENA_CTL4, .value_a = 0x001F, .value_g = 0x001F, .flags = 0, }, */ - /* { .offset = B2062_N_LGENA_CTL5, .value_a = 0x0032, .value_g = 0x0032, .flags = 0, }, */ - /* { .offset = B2062_N_LGENA_CTL6, .value_a = 0x0032, .value_g = 0x0032, .flags = 0, }, */ - { .offset = B2062_N_LGENA_CTL7, .value_a = 0x0033, .value_g = 0x0033, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_N_RXA_CTL0, .value_a = 0x0009, .value_g = 0x0009, .flags = 0, }, */ - { .offset = B2062_N_RXA_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = B206X_FLAG_G, }, - /* { .offset = B2062_N_RXA_CTL2, .value_a = 0x0018, .value_g = 0x0018, .flags = 0, }, */ - /* { .offset = B2062_N_RXA_CTL3, .value_a = 0x0027, .value_g = 0x0027, .flags = 0, }, */ - /* { .offset = B2062_N_RXA_CTL4, .value_a = 0x0028, .value_g = 0x0028, .flags = 0, }, */ - /* { .offset = B2062_N_RXA_CTL5, .value_a = 0x0007, .value_g = 0x0007, .flags = 0, }, */ - /* { .offset = B2062_N_RXA_CTL6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_RXA_CTL7, .value_a = 0x0008, .value_g = 0x0008, .flags = 0, }, */ - { .offset = B2062_N_RXBB_CTL0, .value_a = 0x0082, .value_g = 0x0080, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_N_RXBB_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_CTL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_GAIN0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_N_RXBB_GAIN1, .value_a = 0x0004, .value_g = 0x0004, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_N_RXBB_GAIN2, .value_a = 0x0000, .value_g = 0x0000, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_N_RXBB_GAIN3, .value_a = 0x0011, .value_g = 0x0011, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_RSSI0, .value_a = 0x0043, .value_g = 0x0043, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_RSSI1, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_CALIB0, .value_a = 0x0010, .value_g = 0x0010, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_CALIB1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_CALIB2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_BIAS0, .value_a = 0x0006, .value_g = 0x0006, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_BIAS1, .value_a = 0x002A, .value_g = 0x002A, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_BIAS2, .value_a = 0x00AA, .value_g = 0x00AA, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_BIAS3, .value_a = 0x0021, .value_g = 0x0021, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_BIAS4, .value_a = 0x00AA, .value_g = 0x00AA, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_BIAS5, .value_a = 0x0022, .value_g = 0x0022, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_RSSI2, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_RSSI3, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_RSSI4, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */ - /* { .offset = B2062_N_RXBB_RSSI5, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */ - /* { .offset = B2062_N_TX_CTL0, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */ - /* { .offset = B2062_N_TX_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_TX_CTL2, .value_a = 0x0084, .value_g = 0x0084, .flags = 0, }, */ - /* { .offset = B2062_N_TX_CTL3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_N_TX_CTL4, .value_a = 0x0003, .value_g = 0x0003, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_N_TX_CTL5, .value_a = 0x0002, .value_g = 0x0002, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_N_TX_CTL6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_TX_CTL7, .value_a = 0x0058, .value_g = 0x0058, .flags = 0, }, */ - /* { .offset = B2062_N_TX_CTL8, .value_a = 0x0082, .value_g = 0x0082, .flags = 0, }, */ - /* { .offset = B2062_N_TX_CTL9, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_TX_CTL_A, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_TX_GC2G, .value_a = 0x00FF, .value_g = 0x00FF, .flags = 0, }, */ - /* { .offset = B2062_N_TX_GC5G, .value_a = 0x00FF, .value_g = 0x00FF, .flags = 0, }, */ - { .offset = B2062_N_TX_TUNE, .value_a = 0x0088, .value_g = 0x001B, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_N_TX_PAD, .value_a = 0x0088, .value_g = 0x0088, .flags = 0, }, */ - /* { .offset = B2062_N_TX_PGA, .value_a = 0x0088, .value_g = 0x0088, .flags = 0, }, */ - /* { .offset = B2062_N_TX_PADAUX, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */ - /* { .offset = B2062_N_TX_PGAAUX, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */ - /* { .offset = B2062_N_TSSI_CTL0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_TSSI_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_TSSI_CTL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_IQ_CALIB_CTL0, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */ - /* { .offset = B2062_N_IQ_CALIB_CTL1, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */ - /* { .offset = B2062_N_IQ_CALIB_CTL2, .value_a = 0x0032, .value_g = 0x0032, .flags = 0, }, */ - /* { .offset = B2062_N_CALIB_TS, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_CALIB_CTL0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_CALIB_CTL1, .value_a = 0x0015, .value_g = 0x0015, .flags = 0, }, */ - /* { .offset = B2062_N_CALIB_CTL2, .value_a = 0x000F, .value_g = 0x000F, .flags = 0, }, */ - /* { .offset = B2062_N_CALIB_CTL3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_CALIB_CTL4, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_CALIB_DBG0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_CALIB_DBG1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_CALIB_DBG2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_CALIB_DBG3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_PSENSE_CTL0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_PSENSE_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_PSENSE_CTL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_N_TEST_BUF0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_COMM1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_RADIO_ID_CODE, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_COMM2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_COMM3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_S_COMM4, .value_a = 0x0001, .value_g = 0x0000, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_S_COMM5, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_COMM6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_COMM7, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_COMM8, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_COMM9, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_COMM10, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_COMM11, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_COMM12, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_COMM13, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_COMM14, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_COMM15, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_S_PDS_CTL0, .value_a = 0x00FF, .value_g = 0x00FF, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_S_PDS_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_PDS_CTL2, .value_a = 0x008E, .value_g = 0x008E, .flags = 0, }, */ - /* { .offset = B2062_S_PDS_CTL3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_BG_CTL0, .value_a = 0x0006, .value_g = 0x0006, .flags = 0, }, */ - /* { .offset = B2062_S_BG_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_BG_CTL2, .value_a = 0x0011, .value_g = 0x0011, .flags = 0, }, */ - { .offset = B2062_S_LGENG_CTL0, .value_a = 0x00F8, .value_g = 0x00D8, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_LGENG_CTL1, .value_a = 0x003C, .value_g = 0x0024, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_S_LGENG_CTL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_LGENG_CTL3, .value_a = 0x0041, .value_g = 0x0041, .flags = 0, }, */ - /* { .offset = B2062_S_LGENG_CTL4, .value_a = 0x0002, .value_g = 0x0002, .flags = 0, }, */ - /* { .offset = B2062_S_LGENG_CTL5, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */ - /* { .offset = B2062_S_LGENG_CTL6, .value_a = 0x0022, .value_g = 0x0022, .flags = 0, }, */ - /* { .offset = B2062_S_LGENG_CTL7, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_S_LGENG_CTL8, .value_a = 0x0088, .value_g = 0x0080, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_S_LGENG_CTL9, .value_a = 0x0088, .value_g = 0x0088, .flags = 0, }, */ - { .offset = B2062_S_LGENG_CTL10, .value_a = 0x0088, .value_g = 0x0080, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_S_LGENG_CTL11, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL1, .value_a = 0x0007, .value_g = 0x0007, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL2, .value_a = 0x00AF, .value_g = 0x00AF, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL3, .value_a = 0x0012, .value_g = 0x0012, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL4, .value_a = 0x000B, .value_g = 0x000B, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL5, .value_a = 0x005F, .value_g = 0x005F, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL7, .value_a = 0x0040, .value_g = 0x0040, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL8, .value_a = 0x0052, .value_g = 0x0052, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL9, .value_a = 0x0026, .value_g = 0x0026, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL10, .value_a = 0x0003, .value_g = 0x0003, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL11, .value_a = 0x0036, .value_g = 0x0036, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL12, .value_a = 0x0057, .value_g = 0x0057, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL13, .value_a = 0x0011, .value_g = 0x0011, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL14, .value_a = 0x0075, .value_g = 0x0075, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL15, .value_a = 0x00B4, .value_g = 0x00B4, .flags = 0, }, */ - /* { .offset = B2062_S_REFPLL_CTL16, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_S_RFPLL_CTL0, .value_a = 0x0098, .value_g = 0x0098, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL1, .value_a = 0x0010, .value_g = 0x0010, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_S_RFPLL_CTL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_RFPLL_CTL3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_RFPLL_CTL4, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_S_RFPLL_CTL5, .value_a = 0x0043, .value_g = 0x0043, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL6, .value_a = 0x0047, .value_g = 0x0047, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL7, .value_a = 0x000C, .value_g = 0x000C, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL8, .value_a = 0x0011, .value_g = 0x0011, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL9, .value_a = 0x0011, .value_g = 0x0011, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL10, .value_a = 0x000E, .value_g = 0x000E, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL11, .value_a = 0x0008, .value_g = 0x0008, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL12, .value_a = 0x0033, .value_g = 0x0033, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL13, .value_a = 0x000A, .value_g = 0x000A, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL14, .value_a = 0x0006, .value_g = 0x0006, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_S_RFPLL_CTL15, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_RFPLL_CTL16, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_RFPLL_CTL17, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_S_RFPLL_CTL18, .value_a = 0x003E, .value_g = 0x003E, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL19, .value_a = 0x0013, .value_g = 0x0013, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_S_RFPLL_CTL20, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_S_RFPLL_CTL21, .value_a = 0x0062, .value_g = 0x0062, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL22, .value_a = 0x0007, .value_g = 0x0007, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL23, .value_a = 0x0016, .value_g = 0x0016, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL24, .value_a = 0x005C, .value_g = 0x005C, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL25, .value_a = 0x0095, .value_g = 0x0095, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_S_RFPLL_CTL26, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_RFPLL_CTL27, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_RFPLL_CTL28, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_RFPLL_CTL29, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_S_RFPLL_CTL30, .value_a = 0x00A0, .value_g = 0x00A0, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL31, .value_a = 0x0004, .value_g = 0x0004, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_S_RFPLL_CTL32, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2062_S_RFPLL_CTL33, .value_a = 0x00CC, .value_g = 0x00CC, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2062_S_RFPLL_CTL34, .value_a = 0x0007, .value_g = 0x0007, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2062_S_RXG_CNT0, .value_a = 0x0010, .value_g = 0x0010, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT4, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT5, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT6, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT7, .value_a = 0x0005, .value_g = 0x0005, .flags = 0, }, */ - { .offset = B2062_S_RXG_CNT8, .value_a = 0x000F, .value_g = 0x000F, .flags = B206X_FLAG_A, }, - /* { .offset = B2062_S_RXG_CNT9, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT10, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT11, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT12, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT13, .value_a = 0x0044, .value_g = 0x0044, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT14, .value_a = 0x00A0, .value_g = 0x00A0, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT15, .value_a = 0x0004, .value_g = 0x0004, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT16, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2062_S_RXG_CNT17, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */ -}; - -static const struct b206x_init_tab_entry b2063_init_tab[] = { - { .offset = B2063_COMM1, .value_a = 0x0000, .value_g = 0x0000, .flags = B206X_FLAG_G, }, - /* { .offset = B2063_COMM2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_COMM3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_COMM4, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_COMM5, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_COMM6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_COMM7, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_COMM8, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_COMM9, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2063_COMM10, .value_a = 0x0001, .value_g = 0x0000, .flags = B206X_FLAG_A, }, - /* { .offset = B2063_COMM11, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_COMM12, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_COMM13, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_COMM14, .value_a = 0x0006, .value_g = 0x0006, .flags = 0, }, */ - /* { .offset = B2063_COMM15, .value_a = 0x000f, .value_g = 0x000f, .flags = 0, }, */ - { .offset = B2063_COMM16, .value_a = 0x0000, .value_g = 0x0000, .flags = B206X_FLAG_G, }, - { .offset = B2063_COMM17, .value_a = 0x0000, .value_g = 0x0000, .flags = B206X_FLAG_G, }, - { .offset = B2063_COMM18, .value_a = 0x0000, .value_g = 0x0000, .flags = B206X_FLAG_G, }, - { .offset = B2063_COMM19, .value_a = 0x0000, .value_g = 0x0000, .flags = B206X_FLAG_G, }, - { .offset = B2063_COMM20, .value_a = 0x0000, .value_g = 0x0000, .flags = B206X_FLAG_G, }, - { .offset = B2063_COMM21, .value_a = 0x0000, .value_g = 0x0000, .flags = B206X_FLAG_G, }, - { .offset = B2063_COMM22, .value_a = 0x0000, .value_g = 0x0000, .flags = B206X_FLAG_G, }, - { .offset = B2063_COMM23, .value_a = 0x0000, .value_g = 0x0000, .flags = B206X_FLAG_G, }, - { .offset = B2063_COMM24, .value_a = 0x0000, .value_g = 0x0000, .flags = B206X_FLAG_G, }, - /* { .offset = B2063_PWR_SWITCH_CTL, .value_a = 0x007f, .value_g = 0x007f, .flags = 0, }, */ - /* { .offset = B2063_PLL_SP1, .value_a = 0x003f, .value_g = 0x003f, .flags = 0, }, */ - /* { .offset = B2063_PLL_SP2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2063_LOGEN_SP1, .value_a = 0x00e8, .value_g = 0x00d4, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2063_LOGEN_SP2, .value_a = 0x00a7, .value_g = 0x0053, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_LOGEN_SP3, .value_a = 0x00ff, .value_g = 0x00ff, .flags = 0, }, */ - { .offset = B2063_LOGEN_SP4, .value_a = 0x00f0, .value_g = 0x000f, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_LOGEN_SP5, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */ - { .offset = B2063_G_RX_SP1, .value_a = 0x001f, .value_g = 0x005e, .flags = B206X_FLAG_G, }, - { .offset = B2063_G_RX_SP2, .value_a = 0x007f, .value_g = 0x007e, .flags = B206X_FLAG_G, }, - { .offset = B2063_G_RX_SP3, .value_a = 0x0030, .value_g = 0x00f0, .flags = B206X_FLAG_G, }, - /* { .offset = B2063_G_RX_SP4, .value_a = 0x0035, .value_g = 0x0035, .flags = 0, }, */ - /* { .offset = B2063_G_RX_SP5, .value_a = 0x003f, .value_g = 0x003f, .flags = 0, }, */ - /* { .offset = B2063_G_RX_SP6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2063_G_RX_SP7, .value_a = 0x007f, .value_g = 0x007f, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_G_RX_SP8, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_G_RX_SP9, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2063_G_RX_SP10, .value_a = 0x000c, .value_g = 0x000c, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_G_RX_SP11, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2063_A_RX_SP1, .value_a = 0x003c, .value_g = 0x003f, .flags = B206X_FLAG_A, }, - { .offset = B2063_A_RX_SP2, .value_a = 0x00fc, .value_g = 0x00fe, .flags = B206X_FLAG_A, }, - /* { .offset = B2063_A_RX_SP3, .value_a = 0x00ff, .value_g = 0x00ff, .flags = 0, }, */ - /* { .offset = B2063_A_RX_SP4, .value_a = 0x00ff, .value_g = 0x00ff, .flags = 0, }, */ - /* { .offset = B2063_A_RX_SP5, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_A_RX_SP6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2063_A_RX_SP7, .value_a = 0x0008, .value_g = 0x0008, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_RX_BB_SP1, .value_a = 0x000f, .value_g = 0x000f, .flags = 0, }, */ - /* { .offset = B2063_RX_BB_SP2, .value_a = 0x0022, .value_g = 0x0022, .flags = 0, }, */ - /* { .offset = B2063_RX_BB_SP3, .value_a = 0x00a8, .value_g = 0x00a8, .flags = 0, }, */ - { .offset = B2063_RX_BB_SP4, .value_a = 0x0060, .value_g = 0x0060, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_RX_BB_SP5, .value_a = 0x0011, .value_g = 0x0011, .flags = 0, }, */ - /* { .offset = B2063_RX_BB_SP6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_RX_BB_SP7, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2063_RX_BB_SP8, .value_a = 0x0030, .value_g = 0x0030, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_TX_RF_SP1, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_SP2, .value_a = 0x0003, .value_g = 0x0003, .flags = 0, }, */ - { .offset = B2063_TX_RF_SP3, .value_a = 0x000c, .value_g = 0x000b, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2063_TX_RF_SP4, .value_a = 0x0010, .value_g = 0x000f, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_TX_RF_SP5, .value_a = 0x000f, .value_g = 0x000f, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_SP6, .value_a = 0x0080, .value_g = 0x0080, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_SP7, .value_a = 0x0068, .value_g = 0x0068, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_SP8, .value_a = 0x0068, .value_g = 0x0068, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_SP9, .value_a = 0x0080, .value_g = 0x0080, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_SP10, .value_a = 0x00ff, .value_g = 0x00ff, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_SP11, .value_a = 0x0003, .value_g = 0x0003, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_SP12, .value_a = 0x0038, .value_g = 0x0038, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_SP13, .value_a = 0x00ff, .value_g = 0x00ff, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_SP14, .value_a = 0x0038, .value_g = 0x0038, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_SP15, .value_a = 0x00c0, .value_g = 0x00c0, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_SP16, .value_a = 0x00ff, .value_g = 0x00ff, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_SP17, .value_a = 0x00ff, .value_g = 0x00ff, .flags = 0, }, */ - { .offset = B2063_PA_SP1, .value_a = 0x003d, .value_g = 0x00fd, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_PA_SP2, .value_a = 0x000c, .value_g = 0x000c, .flags = 0, }, */ - /* { .offset = B2063_PA_SP3, .value_a = 0x0096, .value_g = 0x0096, .flags = 0, }, */ - /* { .offset = B2063_PA_SP4, .value_a = 0x005a, .value_g = 0x005a, .flags = 0, }, */ - /* { .offset = B2063_PA_SP5, .value_a = 0x007f, .value_g = 0x007f, .flags = 0, }, */ - /* { .offset = B2063_PA_SP6, .value_a = 0x007f, .value_g = 0x007f, .flags = 0, }, */ - /* { .offset = B2063_PA_SP7, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */ - { .offset = B2063_TX_BB_SP1, .value_a = 0x0002, .value_g = 0x0002, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_TX_BB_SP2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_TX_BB_SP3, .value_a = 0x0030, .value_g = 0x0030, .flags = 0, }, */ - /* { .offset = B2063_REG_SP1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2063_BANDGAP_CTL1, .value_a = 0x0056, .value_g = 0x0056, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_BANDGAP_CTL2, .value_a = 0x0006, .value_g = 0x0006, .flags = 0, }, */ - /* { .offset = B2063_LPO_CTL1, .value_a = 0x000e, .value_g = 0x000e, .flags = 0, }, */ - /* { .offset = B2063_RC_CALIB_CTL1, .value_a = 0x007e, .value_g = 0x007e, .flags = 0, }, */ - /* { .offset = B2063_RC_CALIB_CTL2, .value_a = 0x0015, .value_g = 0x0015, .flags = 0, }, */ - /* { .offset = B2063_RC_CALIB_CTL3, .value_a = 0x000f, .value_g = 0x000f, .flags = 0, }, */ - /* { .offset = B2063_RC_CALIB_CTL4, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_RC_CALIB_CTL5, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_RC_CALIB_CTL6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_RC_CALIB_CTL7, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_RC_CALIB_CTL8, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_RC_CALIB_CTL9, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_RC_CALIB_CTL10, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_CALNRST, .value_a = 0x0004, .value_g = 0x0004, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_IN_PLL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_IN_PLL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_CP1, .value_a = 0x00cf, .value_g = 0x00cf, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_CP2, .value_a = 0x0059, .value_g = 0x0059, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_CP3, .value_a = 0x0007, .value_g = 0x0007, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_CP4, .value_a = 0x0042, .value_g = 0x0042, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_LF1, .value_a = 0x00db, .value_g = 0x00db, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_LF2, .value_a = 0x0094, .value_g = 0x0094, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_LF3, .value_a = 0x0028, .value_g = 0x0028, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_LF4, .value_a = 0x0063, .value_g = 0x0063, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_SG1, .value_a = 0x0007, .value_g = 0x0007, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_SG2, .value_a = 0x00d3, .value_g = 0x00d3, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_SG3, .value_a = 0x00b1, .value_g = 0x00b1, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_SG4, .value_a = 0x003b, .value_g = 0x003b, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_SG5, .value_a = 0x0006, .value_g = 0x0006, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_VCO1, .value_a = 0x0058, .value_g = 0x0058, .flags = 0, }, */ - { .offset = B2063_PLL_JTAG_PLL_VCO2, .value_a = 0x00f7, .value_g = 0x00f7, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_PLL_JTAG_PLL_VCO_CALIB1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_VCO_CALIB2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_VCO_CALIB3, .value_a = 0x0002, .value_g = 0x0002, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_VCO_CALIB4, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_VCO_CALIB5, .value_a = 0x0009, .value_g = 0x0009, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_VCO_CALIB6, .value_a = 0x0005, .value_g = 0x0005, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_VCO_CALIB7, .value_a = 0x0016, .value_g = 0x0016, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_VCO_CALIB8, .value_a = 0x006b, .value_g = 0x006b, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_VCO_CALIB9, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_VCO_CALIB10, .value_a = 0x00b3, .value_g = 0x00b3, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_XTAL_12, .value_a = 0x0004, .value_g = 0x0004, .flags = 0, }, */ - /* { .offset = B2063_PLL_JTAG_PLL_XTAL3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_ACL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_ACL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_ACL3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_ACL4, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_ACL5, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_INPUTS, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_CTL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_CTL3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_WAITCNT, .value_a = 0x0002, .value_g = 0x0002, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_OVR1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_OVR2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_OVAL1, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_OVAL2, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_OVAL3, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_OVAL4, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_OVAL5, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_OVAL6, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_OVAL7, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_CALVLD1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_CALVLD2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_CVAL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_CVAL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_CVAL3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_CVAL4, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_CVAL5, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_CVAL6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LO_CALIB_CVAL7, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_CALIB_EN, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_PEAKDET1, .value_a = 0x00ff, .value_g = 0x00ff, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_RCCR1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_VCOBUF1, .value_a = 0x0060, .value_g = 0x0060, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_MIXER1, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_MIXER2, .value_a = 0x000c, .value_g = 0x000c, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_BUF1, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_BUF2, .value_a = 0x000c, .value_g = 0x000c, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_DIV1, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_DIV2, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_DIV3, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_CBUFRX1, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_CBUFRX2, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_CBUFTX1, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_CBUFTX2, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_IDAC1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_SPARE1, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_SPARE2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_LOGEN_SPARE3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_G_RX_1ST1, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */ - /* { .offset = B2063_G_RX_1ST2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_G_RX_1ST3, .value_a = 0x0005, .value_g = 0x0005, .flags = 0, }, */ - /* { .offset = B2063_G_RX_2ND1, .value_a = 0x0030, .value_g = 0x0030, .flags = 0, }, */ - /* { .offset = B2063_G_RX_2ND2, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */ - /* { .offset = B2063_G_RX_2ND3, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */ - /* { .offset = B2063_G_RX_2ND4, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_G_RX_2ND5, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */ - /* { .offset = B2063_G_RX_2ND6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_G_RX_2ND7, .value_a = 0x0035, .value_g = 0x0035, .flags = 0, }, */ - /* { .offset = B2063_G_RX_2ND8, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_G_RX_PS1, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */ - /* { .offset = B2063_G_RX_PS2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_G_RX_PS3, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */ - /* { .offset = B2063_G_RX_PS4, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_G_RX_PS5, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_G_RX_MIX1, .value_a = 0x0044, .value_g = 0x0044, .flags = 0, }, */ - /* { .offset = B2063_G_RX_MIX2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2063_G_RX_MIX3, .value_a = 0x0071, .value_g = 0x0071, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2063_G_RX_MIX4, .value_a = 0x0071, .value_g = 0x0071, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_G_RX_MIX5, .value_a = 0x0003, .value_g = 0x0003, .flags = 0, }, */ - /* { .offset = B2063_G_RX_MIX6, .value_a = 0x0088, .value_g = 0x0088, .flags = 0, }, */ - /* { .offset = B2063_G_RX_MIX7, .value_a = 0x0044, .value_g = 0x0044, .flags = 0, }, */ - /* { .offset = B2063_G_RX_MIX8, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */ - /* { .offset = B2063_G_RX_PDET1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_G_RX_SPARES1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_G_RX_SPARES2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_G_RX_SPARES3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_A_RX_1ST1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2063_A_RX_1ST2, .value_a = 0x00f0, .value_g = 0x0030, .flags = B206X_FLAG_A, }, - /* { .offset = B2063_A_RX_1ST3, .value_a = 0x0005, .value_g = 0x0005, .flags = 0, }, */ - /* { .offset = B2063_A_RX_1ST4, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */ - /* { .offset = B2063_A_RX_1ST5, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_A_RX_2ND1, .value_a = 0x0005, .value_g = 0x0005, .flags = 0, }, */ - /* { .offset = B2063_A_RX_2ND2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_A_RX_2ND3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_A_RX_2ND4, .value_a = 0x0005, .value_g = 0x0005, .flags = 0, }, */ - /* { .offset = B2063_A_RX_2ND5, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_A_RX_2ND6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_A_RX_2ND7, .value_a = 0x0005, .value_g = 0x0005, .flags = 0, }, */ - /* { .offset = B2063_A_RX_PS1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_A_RX_PS2, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */ - /* { .offset = B2063_A_RX_PS3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_A_RX_PS4, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */ - /* { .offset = B2063_A_RX_PS5, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2063_A_RX_PS6, .value_a = 0x0077, .value_g = 0x0077, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_A_RX_MIX1, .value_a = 0x0088, .value_g = 0x0088, .flags = 0, }, */ - /* { .offset = B2063_A_RX_MIX2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_A_RX_MIX3, .value_a = 0x0044, .value_g = 0x0044, .flags = 0, }, */ - { .offset = B2063_A_RX_MIX4, .value_a = 0x0003, .value_g = 0x0003, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2063_A_RX_MIX5, .value_a = 0x000f, .value_g = 0x000f, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - { .offset = B2063_A_RX_MIX6, .value_a = 0x000f, .value_g = 0x000f, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_A_RX_MIX7, .value_a = 0x0044, .value_g = 0x0044, .flags = 0, }, */ - /* { .offset = B2063_A_RX_MIX8, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */ - /* { .offset = B2063_A_RX_PWRDET1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_A_RX_SPARE1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_A_RX_SPARE2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_A_RX_SPARE3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2063_RX_TIA_CTL1, .value_a = 0x0077, .value_g = 0x0077, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_RX_TIA_CTL2, .value_a = 0x0058, .value_g = 0x0058, .flags = 0, }, */ - { .offset = B2063_RX_TIA_CTL3, .value_a = 0x0077, .value_g = 0x0077, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_RX_TIA_CTL4, .value_a = 0x0058, .value_g = 0x0058, .flags = 0, }, */ - /* { .offset = B2063_RX_TIA_CTL5, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_RX_TIA_CTL6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_RX_BB_CTL1, .value_a = 0x0074, .value_g = 0x0074, .flags = 0, }, */ - { .offset = B2063_RX_BB_CTL2, .value_a = 0x0004, .value_g = 0x0004, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_RX_BB_CTL3, .value_a = 0x00a2, .value_g = 0x00a2, .flags = 0, }, */ - /* { .offset = B2063_RX_BB_CTL4, .value_a = 0x00aa, .value_g = 0x00aa, .flags = 0, }, */ - /* { .offset = B2063_RX_BB_CTL5, .value_a = 0x0024, .value_g = 0x0024, .flags = 0, }, */ - /* { .offset = B2063_RX_BB_CTL6, .value_a = 0x00a9, .value_g = 0x00a9, .flags = 0, }, */ - /* { .offset = B2063_RX_BB_CTL7, .value_a = 0x0028, .value_g = 0x0028, .flags = 0, }, */ - /* { .offset = B2063_RX_BB_CTL8, .value_a = 0x0010, .value_g = 0x0010, .flags = 0, }, */ - /* { .offset = B2063_RX_BB_CTL9, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_CTL1, .value_a = 0x0080, .value_g = 0x0080, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_IDAC_LO_RF_I, .value_a = 0x0088, .value_g = 0x0088, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_IDAC_LO_RF_Q, .value_a = 0x0088, .value_g = 0x0088, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_IDAC_LO_BB_I, .value_a = 0x0088, .value_g = 0x0088, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_IDAC_LO_BB_Q, .value_a = 0x0088, .value_g = 0x0088, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_CTL2, .value_a = 0x0080, .value_g = 0x0080, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_CTL3, .value_a = 0x0038, .value_g = 0x0038, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_CTL4, .value_a = 0x00b8, .value_g = 0x00b8, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_CTL5, .value_a = 0x0080, .value_g = 0x0080, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_CTL6, .value_a = 0x0038, .value_g = 0x0038, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_CTL7, .value_a = 0x0078, .value_g = 0x0078, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_CTL8, .value_a = 0x00c0, .value_g = 0x00c0, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_CTL9, .value_a = 0x0003, .value_g = 0x0003, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_CTL10, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_CTL14, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_TX_RF_CTL15, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2063_PA_CTL1, .value_a = 0x0000, .value_g = 0x0004, .flags = B206X_FLAG_A, }, - /* { .offset = B2063_PA_CTL2, .value_a = 0x000c, .value_g = 0x000c, .flags = 0, }, */ - /* { .offset = B2063_PA_CTL3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_PA_CTL4, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_PA_CTL5, .value_a = 0x0096, .value_g = 0x0096, .flags = 0, }, */ - /* { .offset = B2063_PA_CTL6, .value_a = 0x0077, .value_g = 0x0077, .flags = 0, }, */ - /* { .offset = B2063_PA_CTL7, .value_a = 0x005a, .value_g = 0x005a, .flags = 0, }, */ - /* { .offset = B2063_PA_CTL8, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_PA_CTL9, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_PA_CTL10, .value_a = 0x0021, .value_g = 0x0021, .flags = 0, }, */ - /* { .offset = B2063_PA_CTL11, .value_a = 0x0070, .value_g = 0x0070, .flags = 0, }, */ - /* { .offset = B2063_PA_CTL12, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_PA_CTL13, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_TX_BB_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_TX_BB_CTL2, .value_a = 0x00b3, .value_g = 0x00b3, .flags = 0, }, */ - /* { .offset = B2063_TX_BB_CTL3, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */ - /* { .offset = B2063_TX_BB_CTL4, .value_a = 0x000b, .value_g = 0x000b, .flags = 0, }, */ - /* { .offset = B2063_GPIO_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - { .offset = B2063_VREG_CTL1, .value_a = 0x0003, .value_g = 0x0003, .flags = B206X_FLAG_A | B206X_FLAG_G, }, - /* { .offset = B2063_AMUX_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_IQ_CALIB_GVAR, .value_a = 0x00b3, .value_g = 0x00b3, .flags = 0, }, */ - /* { .offset = B2063_IQ_CALIB_CTL1, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */ - /* { .offset = B2063_IQ_CALIB_CTL2, .value_a = 0x0030, .value_g = 0x0030, .flags = 0, }, */ - /* { .offset = B2063_TEMPSENSE_CTL1, .value_a = 0x0046, .value_g = 0x0046, .flags = 0, }, */ - /* { .offset = B2063_TEMPSENSE_CTL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_TX_RX_LOOPBACK1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_TX_RX_LOOPBACK2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */ - /* { .offset = B2063_EXT_TSSI_CTL1, .value_a = 0x0021, .value_g = 0x0021, .flags = 0, }, */ - /* { .offset = B2063_EXT_TSSI_CTL2, .value_a = 0x0023, .value_g = 0x0023, .flags = 0, }, */ - /* { .offset = B2063_AFE_CTL , .value_a = 0x0002, .value_g = 0x0002, .flags = 0, }, */ -}; - -void b2062_upload_init_table(struct b43_wldev *dev) -{ - const struct b206x_init_tab_entry *e; - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(b2062_init_tab); i++) { - e = &b2062_init_tab[i]; - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - if (!(e->flags & B206X_FLAG_G)) - continue; - b43_radio_write(dev, e->offset, e->value_g); - } else { - if (!(e->flags & B206X_FLAG_A)) - continue; - b43_radio_write(dev, e->offset, e->value_a); - } - } -} - -void b2063_upload_init_table(struct b43_wldev *dev) -{ - const struct b206x_init_tab_entry *e; - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(b2063_init_tab); i++) { - e = &b2063_init_tab[i]; - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - if (!(e->flags & B206X_FLAG_G)) - continue; - b43_radio_write(dev, e->offset, e->value_g); - } else { - if (!(e->flags & B206X_FLAG_A)) - continue; - b43_radio_write(dev, e->offset, e->value_a); - } - } -} - -u32 b43_lptab_read(struct b43_wldev *dev, u32 offset) -{ - u32 type, value; - - type = offset & B43_LPTAB_TYPEMASK; - offset &= ~B43_LPTAB_TYPEMASK; - B43_WARN_ON(offset > 0xFFFF); - - switch (type) { - case B43_LPTAB_8BIT: - b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset); - value = b43_phy_read(dev, B43_LPPHY_TABLEDATALO) & 0xFF; - break; - case B43_LPTAB_16BIT: - b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset); - value = b43_phy_read(dev, B43_LPPHY_TABLEDATALO); - break; - case B43_LPTAB_32BIT: - b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset); - value = b43_phy_read(dev, B43_LPPHY_TABLEDATAHI); - value <<= 16; - value |= b43_phy_read(dev, B43_LPPHY_TABLEDATALO); - break; - default: - B43_WARN_ON(1); - value = 0; - } - - return value; -} - -void b43_lptab_read_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, void *_data) -{ - u32 type; - u8 *data = _data; - unsigned int i; - - type = offset & B43_LPTAB_TYPEMASK; - offset &= ~B43_LPTAB_TYPEMASK; - B43_WARN_ON(offset > 0xFFFF); - - b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset); - - for (i = 0; i < nr_elements; i++) { - switch (type) { - case B43_LPTAB_8BIT: - *data = b43_phy_read(dev, B43_LPPHY_TABLEDATALO) & 0xFF; - data++; - break; - case B43_LPTAB_16BIT: - *((u16 *)data) = b43_phy_read(dev, B43_LPPHY_TABLEDATALO); - data += 2; - break; - case B43_LPTAB_32BIT: - *((u32 *)data) = b43_phy_read(dev, B43_LPPHY_TABLEDATAHI); - *((u32 *)data) <<= 16; - *((u32 *)data) |= b43_phy_read(dev, B43_LPPHY_TABLEDATALO); - data += 4; - break; - default: - B43_WARN_ON(1); - } - } -} - -void b43_lptab_write(struct b43_wldev *dev, u32 offset, u32 value) -{ - u32 type; - - type = offset & B43_LPTAB_TYPEMASK; - offset &= ~B43_LPTAB_TYPEMASK; - B43_WARN_ON(offset > 0xFFFF); - - switch (type) { - case B43_LPTAB_8BIT: - B43_WARN_ON(value & ~0xFF); - b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset); - b43_phy_write(dev, B43_LPPHY_TABLEDATALO, value); - break; - case B43_LPTAB_16BIT: - B43_WARN_ON(value & ~0xFFFF); - b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset); - b43_phy_write(dev, B43_LPPHY_TABLEDATALO, value); - break; - case B43_LPTAB_32BIT: - b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset); - b43_phy_write(dev, B43_LPPHY_TABLEDATAHI, value >> 16); - b43_phy_write(dev, B43_LPPHY_TABLEDATALO, value); - break; - default: - B43_WARN_ON(1); - } -} - -void b43_lptab_write_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, const void *_data) -{ - u32 type, value; - const u8 *data = _data; - unsigned int i; - - type = offset & B43_LPTAB_TYPEMASK; - offset &= ~B43_LPTAB_TYPEMASK; - B43_WARN_ON(offset > 0xFFFF); - - b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset); - - for (i = 0; i < nr_elements; i++) { - switch (type) { - case B43_LPTAB_8BIT: - value = *data; - data++; - B43_WARN_ON(value & ~0xFF); - b43_phy_write(dev, B43_LPPHY_TABLEDATALO, value); - break; - case B43_LPTAB_16BIT: - value = *((u16 *)data); - data += 2; - B43_WARN_ON(value & ~0xFFFF); - b43_phy_write(dev, B43_LPPHY_TABLEDATALO, value); - break; - case B43_LPTAB_32BIT: - value = *((u32 *)data); - data += 4; - b43_phy_write(dev, B43_LPPHY_TABLEDATAHI, value >> 16); - b43_phy_write(dev, B43_LPPHY_TABLEDATALO, value); - break; - default: - B43_WARN_ON(1); - } - } -} - -static const u8 lpphy_min_sig_sq_table[] = { - 0xde, 0xdc, 0xda, 0xd8, 0xd6, 0xd4, 0xd2, 0xcf, 0xcd, - 0xca, 0xc7, 0xc4, 0xc1, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, - 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0x00, - 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, - 0xbe, 0xbe, 0xbe, 0xbe, 0xc1, 0xc4, 0xc7, 0xca, 0xcd, - 0xcf, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, -}; - -static const u16 lpphy_rev01_noise_scale_table[] = { - 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, - 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa400, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, - 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0xa4a4, 0x00a4, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4c00, 0x2d36, - 0x0000, 0x0000, 0x4c00, 0x2d36, -}; - -static const u16 lpphy_rev2plus_noise_scale_table[] = { - 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, - 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, - 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x0000, - 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, - 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, - 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, 0x00a4, - 0x00a4, -}; - -static const u16 lpphy_crs_gain_nft_table[] = { - 0x0366, 0x036a, 0x036f, 0x0364, 0x0367, 0x036d, 0x0374, 0x037f, 0x036f, - 0x037b, 0x038a, 0x0378, 0x0367, 0x036d, 0x0375, 0x0381, 0x0374, 0x0381, - 0x0392, 0x03a9, 0x03c4, 0x03e1, 0x0001, 0x001f, 0x0040, 0x005e, 0x007f, - 0x009e, 0x00bd, 0x00dd, 0x00fd, 0x011d, 0x013d, -}; - -static const u16 lpphy_rev01_filter_control_table[] = { - 0xa0fc, 0x10fc, 0x10db, 0x20b7, 0xff93, 0x10bf, 0x109b, 0x2077, 0xff53, - 0x0127, -}; - -static const u32 lpphy_rev2plus_filter_control_table[] = { - 0x000141fc, 0x000021fc, 0x000021b7, 0x0000416f, 0x0001ff27, 0x0000217f, - 0x00002137, 0x000040ef, 0x0001fea7, 0x0000024f, -}; - -static const u32 lpphy_rev01_ps_control_table[] = { - 0x00010000, 0x000000a0, 0x00040000, 0x00000048, 0x08080101, 0x00000080, - 0x08080101, 0x00000040, 0x08080101, 0x000000c0, 0x08a81501, 0x000000c0, - 0x0fe8fd01, 0x000000c0, 0x08300105, 0x000000c0, 0x08080201, 0x000000c0, - 0x08280205, 0x000000c0, 0xe80802fe, 0x000000c7, 0x28080206, 0x000000c0, - 0x08080202, 0x000000c0, 0x0ba87602, 0x000000c0, 0x1068013d, 0x000000c0, - 0x10280105, 0x000000c0, 0x08880102, 0x000000c0, 0x08280106, 0x000000c0, - 0xe80801fd, 0x000000c7, 0xa8080115, 0x000000c0, -}; - -static const u32 lpphy_rev2plus_ps_control_table[] = { - 0x00e38e08, 0x00e08e38, 0x00000000, 0x00000000, 0x00000000, 0x00002080, - 0x00006180, 0x00003002, 0x00000040, 0x00002042, 0x00180047, 0x00080043, - 0x00000041, 0x000020c1, 0x00046006, 0x00042002, 0x00040000, 0x00002003, - 0x00180006, 0x00080002, -}; - -static const u8 lpphy_pll_fraction_table[] = { - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, -}; - -static const u16 lpphy_iqlo_cal_table[] = { - 0x0200, 0x0300, 0x0400, 0x0600, 0x0800, 0x0b00, 0x1000, 0x1001, 0x1002, - 0x1003, 0x1004, 0x1005, 0x1006, 0x1007, 0x1707, 0x2007, 0x2d07, 0x4007, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0200, 0x0300, 0x0400, 0x0600, - 0x0800, 0x0b00, 0x1000, 0x1001, 0x1002, 0x1003, 0x1004, 0x1005, 0x1006, - 0x1007, 0x1707, 0x2007, 0x2d07, 0x4007, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -}; - -static const u16 lpphy_rev0_ofdm_cck_gain_table[] = { - 0x0001, 0x0001, 0x0001, 0x0001, 0x1001, 0x2001, 0x3001, 0x4001, 0x5001, - 0x6001, 0x7001, 0x7011, 0x7021, 0x2035, 0x2045, 0x2055, 0x2065, 0x2075, - 0x006d, 0x007d, 0x014d, 0x015d, 0x115d, 0x035d, 0x135d, 0x055d, 0x155d, - 0x0d5d, 0x1d5d, 0x2d5d, 0x555d, 0x655d, 0x755d, -}; - -static const u16 lpphy_rev1_ofdm_cck_gain_table[] = { - 0x5000, 0x6000, 0x7000, 0x0001, 0x1001, 0x2001, 0x3001, 0x4001, 0x5001, - 0x6001, 0x7001, 0x7011, 0x7021, 0x2035, 0x2045, 0x2055, 0x2065, 0x2075, - 0x006d, 0x007d, 0x014d, 0x015d, 0x115d, 0x035d, 0x135d, 0x055d, 0x155d, - 0x0d5d, 0x1d5d, 0x2d5d, 0x555d, 0x655d, 0x755d, -}; - -static const u16 lpphy_gain_delta_table[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -}; - -static const u32 lpphy_tx_power_control_table[] = { - 0x00000050, 0x0000004f, 0x0000004e, 0x0000004d, 0x0000004c, 0x0000004b, - 0x0000004a, 0x00000049, 0x00000048, 0x00000047, 0x00000046, 0x00000045, - 0x00000044, 0x00000043, 0x00000042, 0x00000041, 0x00000040, 0x0000003f, - 0x0000003e, 0x0000003d, 0x0000003c, 0x0000003b, 0x0000003a, 0x00000039, - 0x00000038, 0x00000037, 0x00000036, 0x00000035, 0x00000034, 0x00000033, - 0x00000032, 0x00000031, 0x00000030, 0x0000002f, 0x0000002e, 0x0000002d, - 0x0000002c, 0x0000002b, 0x0000002a, 0x00000029, 0x00000028, 0x00000027, - 0x00000026, 0x00000025, 0x00000024, 0x00000023, 0x00000022, 0x00000021, - 0x00000020, 0x0000001f, 0x0000001e, 0x0000001d, 0x0000001c, 0x0000001b, - 0x0000001a, 0x00000019, 0x00000018, 0x00000017, 0x00000016, 0x00000015, - 0x00000014, 0x00000013, 0x00000012, 0x00000011, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x000075a0, 0x000075a0, 0x000075a1, 0x000075a1, 0x000075a2, 0x000075a2, - 0x000075a3, 0x000075a3, 0x000074b0, 0x000074b0, 0x000074b1, 0x000074b1, - 0x000074b2, 0x000074b2, 0x000074b3, 0x000074b3, 0x00006d20, 0x00006d20, - 0x00006d21, 0x00006d21, 0x00006d22, 0x00006d22, 0x00006d23, 0x00006d23, - 0x00004660, 0x00004660, 0x00004661, 0x00004661, 0x00004662, 0x00004662, - 0x00004663, 0x00004663, 0x00003e60, 0x00003e60, 0x00003e61, 0x00003e61, - 0x00003e62, 0x00003e62, 0x00003e63, 0x00003e63, 0x00003660, 0x00003660, - 0x00003661, 0x00003661, 0x00003662, 0x00003662, 0x00003663, 0x00003663, - 0x00002e60, 0x00002e60, 0x00002e61, 0x00002e61, 0x00002e62, 0x00002e62, - 0x00002e63, 0x00002e63, 0x00002660, 0x00002660, 0x00002661, 0x00002661, - 0x00002662, 0x00002662, 0x00002663, 0x00002663, 0x000025e0, 0x000025e0, - 0x000025e1, 0x000025e1, 0x000025e2, 0x000025e2, 0x000025e3, 0x000025e3, - 0x00001de0, 0x00001de0, 0x00001de1, 0x00001de1, 0x00001de2, 0x00001de2, - 0x00001de3, 0x00001de3, 0x00001d60, 0x00001d60, 0x00001d61, 0x00001d61, - 0x00001d62, 0x00001d62, 0x00001d63, 0x00001d63, 0x00001560, 0x00001560, - 0x00001561, 0x00001561, 0x00001562, 0x00001562, 0x00001563, 0x00001563, - 0x00000d60, 0x00000d60, 0x00000d61, 0x00000d61, 0x00000d62, 0x00000d62, - 0x00000d63, 0x00000d63, 0x00000ce0, 0x00000ce0, 0x00000ce1, 0x00000ce1, - 0x00000ce2, 0x00000ce2, 0x00000ce3, 0x00000ce3, 0x00000e10, 0x00000e10, - 0x00000e11, 0x00000e11, 0x00000e12, 0x00000e12, 0x00000e13, 0x00000e13, - 0x00000bf0, 0x00000bf0, 0x00000bf1, 0x00000bf1, 0x00000bf2, 0x00000bf2, - 0x00000bf3, 0x00000bf3, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x04200000, 0x04000000, - 0x04200000, 0x04000000, 0x04200000, 0x04000000, 0x000000ff, 0x000002fc, - 0x0000fa08, 0x00000305, 0x00000206, 0x00000304, 0x0000fb04, 0x0000fcff, - 0x000005fb, 0x0000fd01, 0x00000401, 0x00000006, 0x0000ff03, 0x000007fc, - 0x0000fc08, 0x00000203, 0x0000fffb, 0x00000600, 0x0000fa01, 0x0000fc03, - 0x0000fe06, 0x0000fe00, 0x00000102, 0x000007fd, 0x000004fb, 0x000006ff, - 0x000004fd, 0x0000fdfa, 0x000007fb, 0x0000fdfa, 0x0000fa06, 0x00000500, - 0x0000f902, 0x000007fa, 0x0000fafa, 0x00000500, 0x000007fa, 0x00000700, - 0x00000305, 0x000004ff, 0x00000801, 0x00000503, 0x000005f9, 0x00000404, - 0x0000fb08, 0x000005fd, 0x00000501, 0x00000405, 0x0000fb03, 0x000007fc, - 0x00000403, 0x00000303, 0x00000402, 0x0000faff, 0x0000fe05, 0x000005fd, - 0x0000fe01, 0x000007fa, 0x00000202, 0x00000504, 0x00000102, 0x000008fe, - 0x0000fa04, 0x0000fafc, 0x0000fe08, 0x000000f9, 0x000002fa, 0x000003fe, - 0x00000304, 0x000004f9, 0x00000100, 0x0000fd06, 0x000008fc, 0x00000701, - 0x00000504, 0x0000fdfe, 0x0000fdfc, 0x000003fe, 0x00000704, 0x000002fc, - 0x000004f9, 0x0000fdfd, 0x0000fa07, 0x00000205, 0x000003fd, 0x000005fb, - 0x000004f9, 0x00000804, 0x0000fc06, 0x0000fcf9, 0x00000100, 0x0000fe05, - 0x00000408, 0x0000fb02, 0x00000304, 0x000006fe, 0x000004fa, 0x00000305, - 0x000008fc, 0x00000102, 0x000001fd, 0x000004fc, 0x0000fe03, 0x00000701, - 0x000001fb, 0x000001f9, 0x00000206, 0x000006fd, 0x00000508, 0x00000700, - 0x00000304, 0x000005fe, 0x000005ff, 0x0000fa04, 0x00000303, 0x0000fefb, - 0x000007f9, 0x0000fefc, 0x000004fd, 0x000005fc, 0x0000fffd, 0x0000fc08, - 0x0000fbf9, 0x0000fd07, 0x000008fb, 0x0000fe02, 0x000006fb, 0x00000702, -}; - -static const u32 lpphy_gain_idx_table[] = { - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x10000001, 0x00000000, 0x20000082, 0x00000000, 0x40000104, 0x00000000, - 0x60004207, 0x00000001, 0x7000838a, 0x00000001, 0xd021050d, 0x00000001, - 0xe041c683, 0x00000001, 0x50828805, 0x00000000, 0x80e34288, 0x00000000, - 0xb144040b, 0x00000000, 0xe1a6058e, 0x00000000, 0x12064711, 0x00000001, - 0xb0a18612, 0x00000010, 0xe1024794, 0x00000010, 0x11630915, 0x00000011, - 0x31c3ca1b, 0x00000011, 0xc1848a9c, 0x00000018, 0xf1e50da0, 0x00000018, - 0x22468e21, 0x00000019, 0x4286d023, 0x00000019, 0xa347d0a4, 0x00000019, - 0xb36811a6, 0x00000019, 0xf3e89227, 0x00000019, 0x0408d329, 0x0000001a, - 0x244953aa, 0x0000001a, 0x346994ab, 0x0000001a, 0x54aa152c, 0x0000001a, - 0x64ca55ad, 0x0000001a, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x10000001, 0x00000000, 0x20000082, 0x00000000, - 0x40000104, 0x00000000, 0x60004207, 0x00000001, 0x7000838a, 0x00000001, - 0xd021050d, 0x00000001, 0xe041c683, 0x00000001, 0x50828805, 0x00000000, - 0x80e34288, 0x00000000, 0xb144040b, 0x00000000, 0xe1a6058e, 0x00000000, - 0x12064711, 0x00000001, 0xb0a18612, 0x00000010, 0xe1024794, 0x00000010, - 0x11630915, 0x00000011, 0x31c3ca1b, 0x00000011, 0xc1848a9c, 0x00000018, - 0xf1e50da0, 0x00000018, 0x22468e21, 0x00000019, 0x4286d023, 0x00000019, - 0xa347d0a4, 0x00000019, 0xb36811a6, 0x00000019, 0xf3e89227, 0x00000019, - 0x0408d329, 0x0000001a, 0x244953aa, 0x0000001a, 0x346994ab, 0x0000001a, - 0x54aa152c, 0x0000001a, 0x64ca55ad, 0x0000001a, -}; - -static const u16 lpphy_aux_gain_idx_table[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0001, 0x0002, 0x0004, 0x0016, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0002, 0x0004, 0x0016, -}; - -static const u32 lpphy_gain_value_table[] = { - 0x00000008, 0x0000000e, 0x00000014, 0x0000001a, 0x000000fb, 0x00000004, - 0x00000008, 0x0000000d, 0x00000001, 0x00000004, 0x00000007, 0x0000000a, - 0x0000000d, 0x00000010, 0x00000012, 0x00000015, 0x00000000, 0x00000006, - 0x0000000c, 0x00000000, 0x00000000, 0x00000000, 0x00000012, 0x00000000, - 0x00000000, 0x00000000, 0x00000018, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x0000001e, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000003, 0x00000006, 0x00000009, 0x0000000c, 0x0000000f, - 0x00000012, 0x00000015, 0x00000018, 0x0000001b, 0x0000001e, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000009, 0x000000f1, - 0x00000000, 0x00000000, -}; - -static const u16 lpphy_gain_table[] = { - 0x0000, 0x0400, 0x0800, 0x0802, 0x0804, 0x0806, 0x0807, 0x0808, 0x080a, - 0x080b, 0x080c, 0x080e, 0x080f, 0x0810, 0x0812, 0x0813, 0x0814, 0x0816, - 0x0817, 0x081a, 0x081b, 0x081f, 0x0820, 0x0824, 0x0830, 0x0834, 0x0837, - 0x083b, 0x083f, 0x0840, 0x0844, 0x0857, 0x085b, 0x085f, 0x08d7, 0x08db, - 0x08df, 0x0957, 0x095b, 0x095f, 0x0b57, 0x0b5b, 0x0b5f, 0x0f5f, 0x135f, - 0x175f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -}; - -static const u32 lpphy_a0_gain_idx_table[] = { - 0x001111e0, 0x00652051, 0x00606055, 0x005b005a, 0x00555060, 0x00511065, - 0x004c806b, 0x0047d072, 0x00444078, 0x00400080, 0x003ca087, 0x0039408f, - 0x0035e098, 0x0032e0a1, 0x003030aa, 0x002d80b4, 0x002ae0bf, 0x002880ca, - 0x002640d6, 0x002410e3, 0x002220f0, 0x002020ff, 0x001e510e, 0x001ca11e, - 0x001b012f, 0x00199140, 0x00182153, 0x0016c168, 0x0015817d, 0x00145193, - 0x001321ab, 0x001211c5, 0x001111e0, 0x001021fc, 0x000f321a, 0x000e523a, - 0x000d925c, 0x000cd27f, 0x000c12a5, 0x000b62cd, 0x000ac2f8, 0x000a2325, - 0x00099355, 0x00091387, 0x000883bd, 0x000813f5, 0x0007a432, 0x00073471, - 0x0006c4b5, 0x000664fc, 0x00061547, 0x0005b598, 0x000565ec, 0x00051646, - 0x0004d6a5, 0x0004870a, 0x00044775, 0x000407e6, 0x0003d85e, 0x000398dd, - 0x00036963, 0x000339f2, 0x00030a89, 0x0002db28, -}; - -static const u16 lpphy_a0_aux_gain_idx_table[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0002, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0002, 0x0014, -}; - -static const u32 lpphy_a0_gain_value_table[] = { - 0x00000008, 0x0000000e, 0x00000014, 0x0000001a, 0x000000fb, 0x00000004, - 0x00000008, 0x0000000d, 0x00000001, 0x00000004, 0x00000007, 0x0000000a, - 0x0000000d, 0x00000010, 0x00000012, 0x00000015, 0x00000000, 0x00000006, - 0x0000000c, 0x00000000, 0x00000000, 0x00000000, 0x00000012, 0x00000000, - 0x00000000, 0x00000000, 0x00000018, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x0000001e, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000003, 0x00000006, 0x00000009, 0x0000000c, 0x0000000f, - 0x00000012, 0x00000015, 0x00000018, 0x0000001b, 0x0000001e, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000f, 0x000000f7, - 0x00000000, 0x00000000, -}; - -static const u16 lpphy_a0_gain_table[] = { - 0x0000, 0x0002, 0x0004, 0x0006, 0x0007, 0x0008, 0x000a, 0x000b, 0x000c, - 0x000e, 0x000f, 0x0010, 0x0012, 0x0013, 0x0014, 0x0016, 0x0017, 0x001a, - 0x001b, 0x001f, 0x0020, 0x0024, 0x0030, 0x0034, 0x0037, 0x003b, 0x003f, - 0x0040, 0x0044, 0x0057, 0x005b, 0x005f, 0x00d7, 0x00db, 0x00df, 0x0157, - 0x015b, 0x015f, 0x0357, 0x035b, 0x035f, 0x075f, 0x0b5f, 0x0f5f, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -}; - -static const u16 lpphy_sw_control_table[] = { - 0x0128, 0x0128, 0x0009, 0x0009, 0x0028, 0x0028, 0x0028, 0x0028, 0x0128, - 0x0128, 0x0009, 0x0009, 0x0028, 0x0028, 0x0028, 0x0028, 0x0009, 0x0009, - 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0018, 0x0018, 0x0018, - 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0128, 0x0128, 0x0009, 0x0009, - 0x0028, 0x0028, 0x0028, 0x0028, 0x0128, 0x0128, 0x0009, 0x0009, 0x0028, - 0x0028, 0x0028, 0x0028, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, 0x0009, - 0x0009, 0x0009, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, - 0x0018, -}; - -static const u8 lpphy_hf_table[] = { - 0x4b, 0x36, 0x24, 0x18, 0x49, 0x34, 0x23, 0x17, 0x48, - 0x33, 0x23, 0x17, 0x48, 0x33, 0x23, 0x17, -}; - -static const u32 lpphy_papd_eps_table[] = { - 0x00000000, 0x00013ffc, 0x0001dff3, 0x0001bff0, 0x00023fe9, 0x00021fdf, - 0x00028fdf, 0x00033fd2, 0x00039fcb, 0x00043fc7, 0x0004efc2, 0x00055fb5, - 0x0005cfb0, 0x00063fa8, 0x00068fa3, 0x00071f98, 0x0007ef92, 0x00084f8b, - 0x0008df82, 0x00097f77, 0x0009df69, 0x000a3f62, 0x000adf57, 0x000b6f4c, - 0x000bff41, 0x000c9f39, 0x000cff30, 0x000dbf27, 0x000e4f1e, 0x000edf16, - 0x000f7f13, 0x00102f11, 0x00110f10, 0x0011df11, 0x0012ef15, 0x00143f1c, - 0x00158f27, 0x00172f35, 0x00193f47, 0x001baf5f, 0x001e6f7e, 0x0021cfa4, - 0x0025bfd2, 0x002a2008, 0x002fb047, 0x00360090, 0x003d40e0, 0x0045c135, - 0x004fb189, 0x005ae1d7, 0x0067221d, 0x0075025a, 0x007ff291, 0x007ff2bf, - 0x007ff2e3, 0x007ff2ff, 0x007ff315, 0x007ff329, 0x007ff33f, 0x007ff356, - 0x007ff36e, 0x007ff39c, 0x007ff441, 0x007ff506, -}; - -static const u32 lpphy_papd_mult_table[] = { - 0x001111e0, 0x00652051, 0x00606055, 0x005b005a, 0x00555060, 0x00511065, - 0x004c806b, 0x0047d072, 0x00444078, 0x00400080, 0x003ca087, 0x0039408f, - 0x0035e098, 0x0032e0a1, 0x003030aa, 0x002d80b4, 0x002ae0bf, 0x002880ca, - 0x002640d6, 0x002410e3, 0x002220f0, 0x002020ff, 0x001e510e, 0x001ca11e, - 0x001b012f, 0x00199140, 0x00182153, 0x0016c168, 0x0015817d, 0x00145193, - 0x001321ab, 0x001211c5, 0x001111e0, 0x001021fc, 0x000f321a, 0x000e523a, - 0x000d925c, 0x000cd27f, 0x000c12a5, 0x000b62cd, 0x000ac2f8, 0x000a2325, - 0x00099355, 0x00091387, 0x000883bd, 0x000813f5, 0x0007a432, 0x00073471, - 0x0006c4b5, 0x000664fc, 0x00061547, 0x0005b598, 0x000565ec, 0x00051646, - 0x0004d6a5, 0x0004870a, 0x00044775, 0x000407e6, 0x0003d85e, 0x000398dd, - 0x00036963, 0x000339f2, 0x00030a89, 0x0002db28, -}; - -static struct lpphy_tx_gain_table_entry lpphy_rev0_nopa_tx_gain_table[] = { - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 152, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 147, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 143, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 139, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 135, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 131, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 128, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 124, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 121, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 117, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 114, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 111, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 107, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 104, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 101, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 99, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 96, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 93, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 90, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 88, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 85, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 83, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 81, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 78, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 76, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 74, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 71, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 69, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 67, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 71, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 69, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 67, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 56, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 73, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 71, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 69, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 67, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 73, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 71, }, -}; - -static struct lpphy_tx_gain_table_entry lpphy_rev0_2ghz_tx_gain_table[] = { - { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 63, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 61, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 57, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 61, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 73, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 71, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 69, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 67, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 65, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 63, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 61, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 65, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 63, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 61, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 73, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 71, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 69, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 67, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 65, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 63, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 61, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 10, .pad = 5, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 10, .pad = 5, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 10, .pad = 5, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 10, .pad = 5, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 10, .pad = 5, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 10, .pad = 5, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 10, .pad = 5, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 10, .pad = 5, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 9, .pad = 5, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 9, .pad = 5, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 9, .pad = 5, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 9, .pad = 5, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 9, .pad = 5, .dac = 0, .bb_mult = 63, }, - { .gm = 4, .pga = 9, .pad = 5, .dac = 0, .bb_mult = 61, }, - { .gm = 4, .pga = 9, .pad = 5, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 9, .pad = 4, .dac = 0, .bb_mult = 71, }, - { .gm = 4, .pga = 9, .pad = 4, .dac = 0, .bb_mult = 69, }, - { .gm = 4, .pga = 9, .pad = 4, .dac = 0, .bb_mult = 67, }, - { .gm = 4, .pga = 9, .pad = 4, .dac = 0, .bb_mult = 65, }, - { .gm = 4, .pga = 9, .pad = 4, .dac = 0, .bb_mult = 63, }, - { .gm = 4, .pga = 9, .pad = 4, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 9, .pad = 4, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 9, .pad = 4, .dac = 0, .bb_mult = 58, }, - { .gm = 4, .pga = 8, .pad = 4, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 8, .pad = 4, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 8, .pad = 4, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 8, .pad = 4, .dac = 0, .bb_mult = 65, }, - { .gm = 4, .pga = 8, .pad = 4, .dac = 0, .bb_mult = 63, }, - { .gm = 4, .pga = 8, .pad = 4, .dac = 0, .bb_mult = 61, }, - { .gm = 4, .pga = 8, .pad = 4, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 7, .pad = 4, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 7, .pad = 4, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 7, .pad = 4, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 7, .pad = 4, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 7, .pad = 4, .dac = 0, .bb_mult = 61, }, - { .gm = 4, .pga = 7, .pad = 4, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 7, .pad = 3, .dac = 0, .bb_mult = 67, }, - { .gm = 4, .pga = 7, .pad = 3, .dac = 0, .bb_mult = 65, }, - { .gm = 4, .pga = 7, .pad = 3, .dac = 0, .bb_mult = 63, }, - { .gm = 4, .pga = 7, .pad = 3, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 7, .pad = 3, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 6, .pad = 3, .dac = 0, .bb_mult = 65, }, - { .gm = 4, .pga = 6, .pad = 3, .dac = 0, .bb_mult = 63, }, - { .gm = 4, .pga = 6, .pad = 3, .dac = 0, .bb_mult = 61, }, - { .gm = 4, .pga = 6, .pad = 3, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 6, .pad = 3, .dac = 0, .bb_mult = 58, }, - { .gm = 4, .pga = 5, .pad = 3, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 5, .pad = 3, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 5, .pad = 3, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 5, .pad = 3, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 5, .pad = 3, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 5, .pad = 3, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 5, .pad = 3, .dac = 0, .bb_mult = 57, }, - { .gm = 4, .pga = 4, .pad = 2, .dac = 0, .bb_mult = 83, }, - { .gm = 4, .pga = 4, .pad = 2, .dac = 0, .bb_mult = 81, }, - { .gm = 4, .pga = 4, .pad = 2, .dac = 0, .bb_mult = 78, }, - { .gm = 4, .pga = 4, .pad = 2, .dac = 0, .bb_mult = 76, }, - { .gm = 4, .pga = 4, .pad = 2, .dac = 0, .bb_mult = 74, }, - { .gm = 4, .pga = 4, .pad = 2, .dac = 0, .bb_mult = 72, }, -}; - -static struct lpphy_tx_gain_table_entry lpphy_rev0_5ghz_tx_gain_table[] = { - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 99, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 96, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 93, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 90, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 88, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 85, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 83, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 81, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 78, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 76, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 74, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 55, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 56, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 55, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 71, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 69, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 67, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 56, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 73, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 71, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 69, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 67, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 71, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 69, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 67, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 56, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 69, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 67, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 60, }, -}; - -static struct lpphy_tx_gain_table_entry lpphy_rev1_nopa_tx_gain_table[] = { - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 152, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 147, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 143, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 139, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 135, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 131, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 128, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 124, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 121, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 117, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 114, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 111, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 107, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 104, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 101, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 99, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 96, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 93, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 90, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 88, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 85, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 83, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 81, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 78, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 76, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 74, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 71, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 69, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 67, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 71, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 69, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 67, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 56, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 73, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 71, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 69, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 67, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 73, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 71, }, -}; - -static struct lpphy_tx_gain_table_entry lpphy_rev1_2ghz_tx_gain_table[] = { - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 90, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 88, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 85, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 83, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 81, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 78, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 76, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 74, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 63, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 61, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 57, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 61, }, - { .gm = 4, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 73, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 71, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 69, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 67, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 65, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 63, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 61, }, - { .gm = 4, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 65, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 63, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 61, }, - { .gm = 4, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 59, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 73, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 71, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 69, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 67, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 65, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 63, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 61, }, - { .gm = 4, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 60, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 72, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 70, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 68, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 66, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 64, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 62, }, - { .gm = 4, .pga = 10, .pad = 6, .dac = 0, .bb_mult = 60, }, -}; - -static struct lpphy_tx_gain_table_entry lpphy_rev1_5ghz_tx_gain_table[] = { - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 99, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 96, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 93, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 90, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 88, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 85, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 83, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 81, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 78, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 76, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 74, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 15, .pad = 15, .dac = 0, .bb_mult = 55, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 56, }, - { .gm = 7, .pga = 15, .pad = 14, .dac = 0, .bb_mult = 55, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 71, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 69, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 67, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 15, .pad = 13, .dac = 0, .bb_mult = 56, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 72, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 15, .pad = 12, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 73, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 71, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 69, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 67, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 11, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 71, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 69, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 67, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 15, .pad = 10, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 15, .pad = 9, .dac = 0, .bb_mult = 56, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 14, .pad = 9, .dac = 0, .bb_mult = 58, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 13, .pad = 9, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 60, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 13, .pad = 8, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 12, .pad = 8, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 12, .pad = 7, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 70, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 68, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 66, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 61, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 59, }, - { .gm = 7, .pga = 11, .pad = 7, .dac = 0, .bb_mult = 57, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 69, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 67, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 65, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 63, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 62, }, - { .gm = 7, .pga = 11, .pad = 6, .dac = 0, .bb_mult = 60, }, -}; - -static struct lpphy_tx_gain_table_entry lpphy_rev2_nopa_tx_gain_table[] = { - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 152, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 147, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 143, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 139, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 135, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 131, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 128, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 124, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 121, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 117, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 114, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 111, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 107, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 104, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 101, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 99, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 96, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 93, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 90, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 88, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 85, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 83, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 81, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 78, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 76, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 74, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 72, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 70, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 68, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 66, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 197, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 192, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 186, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 181, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 176, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 171, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 166, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 161, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 157, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 152, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 148, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 144, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 140, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 136, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 132, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 128, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 124, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 121, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 117, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 114, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 111, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 108, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 105, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 102, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 99, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 96, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 93, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 91, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 88, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 86, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 83, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 81, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 79, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 76, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 74, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 72, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 70, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 68, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 66, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 64, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 248, .pad = 64, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 248, .pad = 62, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 241, .pad = 62, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 241, .pad = 60, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 234, .pad = 60, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 234, .pad = 59, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 227, .pad = 59, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 227, .pad = 57, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 221, .pad = 57, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 221, .pad = 55, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 215, .pad = 55, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 215, .pad = 54, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 208, .pad = 54, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 208, .pad = 52, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 203, .pad = 52, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 203, .pad = 51, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 197, .pad = 51, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 197, .pad = 49, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 191, .pad = 49, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 191, .pad = 48, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 186, .pad = 48, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 186, .pad = 47, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 181, .pad = 47, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 181, .pad = 45, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 175, .pad = 45, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 175, .pad = 44, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 170, .pad = 44, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 170, .pad = 43, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 166, .pad = 43, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 166, .pad = 42, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 161, .pad = 42, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 161, .pad = 40, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 156, .pad = 40, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 156, .pad = 39, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 152, .pad = 39, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 152, .pad = 38, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 148, .pad = 38, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 148, .pad = 37, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 143, .pad = 37, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 143, .pad = 36, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 139, .pad = 36, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 139, .pad = 35, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 135, .pad = 35, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 135, .pad = 34, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 132, .pad = 34, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 132, .pad = 33, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 128, .pad = 33, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 128, .pad = 32, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 124, .pad = 32, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 124, .pad = 31, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 121, .pad = 31, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 121, .pad = 30, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 117, .pad = 30, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 117, .pad = 29, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 114, .pad = 29, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 114, .pad = 29, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 111, .pad = 29, .dac = 0, .bb_mult = 64, }, -}; - -static struct lpphy_tx_gain_table_entry lpphy_rev2_2ghz_tx_gain_table[] = { - { .gm = 7, .pga = 99, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 96, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 93, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 90, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 88, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 85, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 83, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 81, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 78, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 76, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 74, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 72, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 70, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 68, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 66, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 64, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 64, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 62, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 62, .pad = 248, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 60, .pad = 248, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 60, .pad = 241, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 59, .pad = 241, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 59, .pad = 234, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 57, .pad = 234, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 57, .pad = 227, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 55, .pad = 227, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 55, .pad = 221, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 54, .pad = 221, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 54, .pad = 215, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 52, .pad = 215, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 52, .pad = 208, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 51, .pad = 208, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 51, .pad = 203, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 49, .pad = 203, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 49, .pad = 197, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 48, .pad = 197, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 48, .pad = 191, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 47, .pad = 191, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 47, .pad = 186, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 45, .pad = 186, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 45, .pad = 181, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 44, .pad = 181, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 44, .pad = 175, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 43, .pad = 175, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 43, .pad = 170, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 42, .pad = 170, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 42, .pad = 166, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 40, .pad = 166, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 40, .pad = 161, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 39, .pad = 161, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 39, .pad = 156, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 38, .pad = 156, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 38, .pad = 152, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 37, .pad = 152, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 37, .pad = 148, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 36, .pad = 148, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 36, .pad = 143, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 35, .pad = 143, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 35, .pad = 139, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 34, .pad = 139, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 34, .pad = 135, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 33, .pad = 135, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 33, .pad = 132, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 32, .pad = 132, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 32, .pad = 128, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 31, .pad = 128, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 31, .pad = 124, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 30, .pad = 124, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 30, .pad = 121, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 29, .pad = 121, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 29, .pad = 117, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 29, .pad = 117, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 29, .pad = 114, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 28, .pad = 114, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 28, .pad = 111, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 27, .pad = 111, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 27, .pad = 108, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 26, .pad = 108, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 26, .pad = 104, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 25, .pad = 104, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 25, .pad = 102, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 25, .pad = 102, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 25, .pad = 99, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 24, .pad = 99, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 24, .pad = 96, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 23, .pad = 96, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 23, .pad = 93, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 23, .pad = 93, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 23, .pad = 90, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 22, .pad = 90, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 22, .pad = 88, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 21, .pad = 88, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 21, .pad = 85, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 21, .pad = 85, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 21, .pad = 83, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 20, .pad = 83, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 20, .pad = 81, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 20, .pad = 81, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 20, .pad = 78, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 19, .pad = 78, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 19, .pad = 76, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 19, .pad = 76, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 19, .pad = 74, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 18, .pad = 74, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 18, .pad = 72, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 18, .pad = 72, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 18, .pad = 70, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 17, .pad = 70, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 17, .pad = 68, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 17, .pad = 68, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 17, .pad = 66, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 16, .pad = 66, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 16, .pad = 64, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 16, .pad = 64, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 16, .pad = 62, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 62, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 60, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 60, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 15, .pad = 59, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 14, .pad = 59, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 14, .pad = 57, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 14, .pad = 57, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 14, .pad = 55, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 14, .pad = 55, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 14, .pad = 54, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 13, .pad = 54, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 13, .pad = 52, .dac = 0, .bb_mult = 64, }, - { .gm = 7, .pga = 13, .pad = 52, .dac = 0, .bb_mult = 64, }, -}; - -static struct lpphy_tx_gain_table_entry lpphy_rev2_5ghz_tx_gain_table[] = { - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 152, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 147, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 143, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 139, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 135, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 131, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 128, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 124, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 121, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 117, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 114, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 111, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 107, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 104, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 101, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 99, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 96, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 93, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 90, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 88, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 85, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 83, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 81, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 78, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 76, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 74, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 72, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 70, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 68, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 66, }, - { .gm = 255, .pga = 255, .pad = 255, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 248, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 241, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 234, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 227, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 221, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 215, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 208, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 203, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 197, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 191, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 186, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 181, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 175, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 170, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 166, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 161, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 156, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 152, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 148, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 143, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 139, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 135, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 132, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 128, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 124, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 121, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 117, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 114, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 111, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 108, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 104, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 102, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 99, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 96, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 93, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 90, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 88, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 85, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 83, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 81, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 78, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 76, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 74, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 72, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 70, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 68, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 66, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 64, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 64, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 255, .pad = 62, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 248, .pad = 62, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 248, .pad = 60, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 241, .pad = 60, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 241, .pad = 59, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 234, .pad = 59, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 234, .pad = 57, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 227, .pad = 57, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 227, .pad = 55, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 221, .pad = 55, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 221, .pad = 54, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 215, .pad = 54, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 215, .pad = 52, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 208, .pad = 52, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 208, .pad = 51, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 203, .pad = 51, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 203, .pad = 49, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 197, .pad = 49, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 197, .pad = 48, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 191, .pad = 48, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 191, .pad = 47, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 186, .pad = 47, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 186, .pad = 45, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 181, .pad = 45, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 181, .pad = 44, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 175, .pad = 44, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 175, .pad = 43, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 170, .pad = 43, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 170, .pad = 42, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 166, .pad = 42, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 166, .pad = 40, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 161, .pad = 40, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 161, .pad = 39, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 156, .pad = 39, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 156, .pad = 38, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 152, .pad = 38, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 152, .pad = 37, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 148, .pad = 37, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 148, .pad = 36, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 143, .pad = 36, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 143, .pad = 35, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 139, .pad = 35, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 139, .pad = 34, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 135, .pad = 34, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 135, .pad = 33, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 132, .pad = 33, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 132, .pad = 32, .dac = 0, .bb_mult = 64, }, - { .gm = 255, .pga = 128, .pad = 32, .dac = 0, .bb_mult = 64, }, -}; - -void lpphy_rev0_1_table_init(struct b43_wldev *dev) -{ - B43_WARN_ON(dev->phy.rev >= 2); - - b43_lptab_write_bulk(dev, B43_LPTAB8(2, 0), - ARRAY_SIZE(lpphy_min_sig_sq_table), lpphy_min_sig_sq_table); - b43_lptab_write_bulk(dev, B43_LPTAB16(1, 0), - ARRAY_SIZE(lpphy_rev01_noise_scale_table), lpphy_rev01_noise_scale_table); - b43_lptab_write_bulk(dev, B43_LPTAB16(14, 0), - ARRAY_SIZE(lpphy_crs_gain_nft_table), lpphy_crs_gain_nft_table); - b43_lptab_write_bulk(dev, B43_LPTAB16(8, 0), - ARRAY_SIZE(lpphy_rev01_filter_control_table), lpphy_rev01_filter_control_table); - b43_lptab_write_bulk(dev, B43_LPTAB32(9, 0), - ARRAY_SIZE(lpphy_rev01_ps_control_table), lpphy_rev01_ps_control_table); - b43_lptab_write_bulk(dev, B43_LPTAB8(6, 0), - ARRAY_SIZE(lpphy_pll_fraction_table), lpphy_pll_fraction_table); - b43_lptab_write_bulk(dev, B43_LPTAB16(0, 0), - ARRAY_SIZE(lpphy_iqlo_cal_table), lpphy_iqlo_cal_table); - if (dev->phy.rev == 0) { - b43_lptab_write_bulk(dev, B43_LPTAB16(13, 0), - ARRAY_SIZE(lpphy_rev0_ofdm_cck_gain_table), lpphy_rev0_ofdm_cck_gain_table); - b43_lptab_write_bulk(dev, B43_LPTAB16(12, 0), - ARRAY_SIZE(lpphy_rev0_ofdm_cck_gain_table), lpphy_rev0_ofdm_cck_gain_table); - } else { - b43_lptab_write_bulk(dev, B43_LPTAB16(13, 0), - ARRAY_SIZE(lpphy_rev1_ofdm_cck_gain_table), lpphy_rev1_ofdm_cck_gain_table); - b43_lptab_write_bulk(dev, B43_LPTAB16(12, 0), - ARRAY_SIZE(lpphy_rev1_ofdm_cck_gain_table), lpphy_rev1_ofdm_cck_gain_table); -} - b43_lptab_write_bulk(dev, B43_LPTAB16(15, 0), - ARRAY_SIZE(lpphy_gain_delta_table), lpphy_gain_delta_table); - b43_lptab_write_bulk(dev, B43_LPTAB32(10, 0), - ARRAY_SIZE(lpphy_tx_power_control_table), lpphy_tx_power_control_table); -} - -void lpphy_rev2plus_table_init(struct b43_wldev *dev) -{ - int i; - - B43_WARN_ON(dev->phy.rev < 2); - - for (i = 0; i < 704; i++) - b43_lptab_write(dev, B43_LPTAB32(7, i), 0); - - b43_lptab_write_bulk(dev, B43_LPTAB8(2, 0), - ARRAY_SIZE(lpphy_min_sig_sq_table), lpphy_min_sig_sq_table); - b43_lptab_write_bulk(dev, B43_LPTAB16(1, 0), - ARRAY_SIZE(lpphy_rev2plus_noise_scale_table), lpphy_rev2plus_noise_scale_table); - b43_lptab_write_bulk(dev, B43_LPTAB32(11, 0), - ARRAY_SIZE(lpphy_rev2plus_filter_control_table), lpphy_rev2plus_filter_control_table); - b43_lptab_write_bulk(dev, B43_LPTAB32(12, 0), - ARRAY_SIZE(lpphy_rev2plus_ps_control_table), lpphy_rev2plus_ps_control_table); - b43_lptab_write_bulk(dev, B43_LPTAB32(13, 0), - ARRAY_SIZE(lpphy_gain_idx_table), lpphy_gain_idx_table); - b43_lptab_write_bulk(dev, B43_LPTAB16(14, 0), - ARRAY_SIZE(lpphy_aux_gain_idx_table), lpphy_aux_gain_idx_table); - b43_lptab_write_bulk(dev, B43_LPTAB16(15, 0), - ARRAY_SIZE(lpphy_sw_control_table), lpphy_sw_control_table); - b43_lptab_write_bulk(dev, B43_LPTAB8(16, 0), - ARRAY_SIZE(lpphy_hf_table), lpphy_hf_table); - b43_lptab_write_bulk(dev, B43_LPTAB32(17, 0), - ARRAY_SIZE(lpphy_gain_value_table), lpphy_gain_value_table); - b43_lptab_write_bulk(dev, B43_LPTAB16(18, 0), - ARRAY_SIZE(lpphy_gain_table), lpphy_gain_table); - b43_lptab_write_bulk(dev, B43_LPTAB8(6, 0), - ARRAY_SIZE(lpphy_pll_fraction_table), lpphy_pll_fraction_table); - b43_lptab_write_bulk(dev, B43_LPTAB16(0, 0), - ARRAY_SIZE(lpphy_iqlo_cal_table), lpphy_iqlo_cal_table); - b43_lptab_write_bulk(dev, B43_LPTAB32(9, 0), - ARRAY_SIZE(lpphy_papd_eps_table), lpphy_papd_eps_table); - b43_lptab_write_bulk(dev, B43_LPTAB32(10, 0), - ARRAY_SIZE(lpphy_papd_mult_table), lpphy_papd_mult_table); - - if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) { - b43_lptab_write_bulk(dev, B43_LPTAB32(13, 0), - ARRAY_SIZE(lpphy_a0_gain_idx_table), lpphy_a0_gain_idx_table); - b43_lptab_write_bulk(dev, B43_LPTAB16(14, 0), - ARRAY_SIZE(lpphy_a0_aux_gain_idx_table), lpphy_a0_aux_gain_idx_table); - b43_lptab_write_bulk(dev, B43_LPTAB32(17, 0), - ARRAY_SIZE(lpphy_a0_gain_value_table), lpphy_a0_gain_value_table); - b43_lptab_write_bulk(dev, B43_LPTAB16(18, 0), - ARRAY_SIZE(lpphy_a0_gain_table), lpphy_a0_gain_table); - } -} - -static void lpphy_rev0_1_write_gain_table(struct b43_wldev *dev, int offset, - struct lpphy_tx_gain_table_entry data) -{ - u32 tmp; - - B43_WARN_ON(dev->phy.rev >= 2); - - tmp = data.pad << 11; - tmp |= data.pga << 7; - tmp |= data.gm << 4; - tmp |= data.dac; - b43_lptab_write(dev, B43_LPTAB32(10, 0xC0 + offset), tmp); - tmp = data.bb_mult << 20; - b43_lptab_write(dev, B43_LPTAB32(10, 0x140 + offset), tmp); -} - -static void lpphy_rev2plus_write_gain_table(struct b43_wldev *dev, int offset, - struct lpphy_tx_gain_table_entry data) -{ - u32 tmp; - - B43_WARN_ON(dev->phy.rev < 2); - - tmp = data.pad << 16; - tmp |= data.pga << 8; - tmp |= data.gm; - if (dev->phy.rev >= 3) { - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) - tmp |= 0x10 << 24; - else - tmp |= 0x70 << 24; - } else { - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) - tmp |= 0x14 << 24; - else - tmp |= 0x7F << 24; - } - b43_lptab_write(dev, B43_LPTAB32(7, 0xC0 + offset), tmp); - tmp = data.bb_mult << 20; - tmp |= data.dac << 28; - b43_lptab_write(dev, B43_LPTAB32(7, 0x140 + offset), tmp); -} - -void lpphy_write_gain_table(struct b43_wldev *dev, int offset, - struct lpphy_tx_gain_table_entry data) -{ - if (dev->phy.rev >= 2) - lpphy_rev2plus_write_gain_table(dev, offset, data); - else - lpphy_rev0_1_write_gain_table(dev, offset, data); -} - -void lpphy_write_gain_table_bulk(struct b43_wldev *dev, int offset, int count, - struct lpphy_tx_gain_table_entry *table) -{ - int i; - - for (i = offset; i < count; i++) - lpphy_write_gain_table(dev, i, table[i]); -} - -void lpphy_init_tx_gain_table(struct b43_wldev *dev) -{ - struct ssb_sprom *sprom = dev->dev->bus_sprom; - - switch (dev->phy.rev) { - case 0: - if ((sprom->boardflags_hi & B43_BFH_NOPA) || - (sprom->boardflags_lo & B43_BFL_HGPA)) - lpphy_write_gain_table_bulk(dev, 0, 128, - lpphy_rev0_nopa_tx_gain_table); - else if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - lpphy_write_gain_table_bulk(dev, 0, 128, - lpphy_rev0_2ghz_tx_gain_table); - else - lpphy_write_gain_table_bulk(dev, 0, 128, - lpphy_rev0_5ghz_tx_gain_table); - break; - case 1: - if ((sprom->boardflags_hi & B43_BFH_NOPA) || - (sprom->boardflags_lo & B43_BFL_HGPA)) - lpphy_write_gain_table_bulk(dev, 0, 128, - lpphy_rev1_nopa_tx_gain_table); - else if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - lpphy_write_gain_table_bulk(dev, 0, 128, - lpphy_rev1_2ghz_tx_gain_table); - else - lpphy_write_gain_table_bulk(dev, 0, 128, - lpphy_rev1_5ghz_tx_gain_table); - break; - default: - if (sprom->boardflags_hi & B43_BFH_NOPA) - lpphy_write_gain_table_bulk(dev, 0, 128, - lpphy_rev2_nopa_tx_gain_table); - else if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) - lpphy_write_gain_table_bulk(dev, 0, 128, - lpphy_rev2_2ghz_tx_gain_table); - else - lpphy_write_gain_table_bulk(dev, 0, 128, - lpphy_rev2_5ghz_tx_gain_table); - } -} diff --git a/drivers/net/wireless/b43/tables_lpphy.h b/drivers/net/wireless/b43/tables_lpphy.h deleted file mode 100644 index 84f1d265f657..000000000000 --- a/drivers/net/wireless/b43/tables_lpphy.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef B43_TABLES_LPPHY_H_ -#define B43_TABLES_LPPHY_H_ - - -#define B43_LPTAB_TYPEMASK 0xF0000000 -#define B43_LPTAB_8BIT 0x10000000 -#define B43_LPTAB_16BIT 0x20000000 -#define B43_LPTAB_32BIT 0x30000000 -#define B43_LPTAB8(table, offset) (((table) << 10) | (offset) | B43_LPTAB_8BIT) -#define B43_LPTAB16(table, offset) (((table) << 10) | (offset) | B43_LPTAB_16BIT) -#define B43_LPTAB32(table, offset) (((table) << 10) | (offset) | B43_LPTAB_32BIT) - -/* Table definitions */ -#define B43_LPTAB_TXPWR_R2PLUS B43_LPTAB32(0x07, 0) /* TX power lookup table (rev >= 2) */ -#define B43_LPTAB_TXPWR_R0_1 B43_LPTAB32(0xA0, 0) /* TX power lookup table (rev < 2) */ - -u32 b43_lptab_read(struct b43_wldev *dev, u32 offset); -void b43_lptab_write(struct b43_wldev *dev, u32 offset, u32 value); - -/* Bulk table access. Note that these functions return the bulk data in - * host endianness! The returned data is _not_ a bytearray, but an array - * consisting of nr_elements of the data type. */ -void b43_lptab_read_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, void *data); -void b43_lptab_write_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, const void *data); - -void b2062_upload_init_table(struct b43_wldev *dev); -void b2063_upload_init_table(struct b43_wldev *dev); - -struct lpphy_tx_gain_table_entry { - u8 gm, pga, pad, dac, bb_mult; -}; - -void lpphy_write_gain_table(struct b43_wldev *dev, int offset, - struct lpphy_tx_gain_table_entry data); -void lpphy_write_gain_table_bulk(struct b43_wldev *dev, int offset, int count, - struct lpphy_tx_gain_table_entry *table); - -void lpphy_rev0_1_table_init(struct b43_wldev *dev); -void lpphy_rev2plus_table_init(struct b43_wldev *dev); -void lpphy_init_tx_gain_table(struct b43_wldev *dev); - -#endif /* B43_TABLES_LPPHY_H_ */ diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c deleted file mode 100644 index 94c755fdda14..000000000000 --- a/drivers/net/wireless/b43/tables_nphy.c +++ /dev/null @@ -1,3322 +0,0 @@ -/* - - Broadcom B43 wireless driver - IEEE 802.11n PHY data tables - - Copyright (c) 2008 Michael Buesch - Copyright (c) 2010 Rafał Miłecki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "tables_nphy.h" -#include "phy_common.h" -#include "phy_n.h" - -static const u8 b43_ntab_adjustpower0[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -static const u8 b43_ntab_adjustpower1[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -static const u16 b43_ntab_bdi[] = { - 0x0070, 0x0126, 0x012C, 0x0246, 0x048D, 0x04D2, -}; - -static const u32 b43_ntab_channelest[] = { - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, -}; - -static const u8 b43_ntab_estimatepowerlt0[] = { - 0x50, 0x4F, 0x4E, 0x4D, 0x4C, 0x4B, 0x4A, 0x49, - 0x48, 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41, - 0x40, 0x3F, 0x3E, 0x3D, 0x3C, 0x3B, 0x3A, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, - 0x30, 0x2F, 0x2E, 0x2D, 0x2C, 0x2B, 0x2A, 0x29, - 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, - 0x20, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, - 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, -}; - -static const u8 b43_ntab_estimatepowerlt1[] = { - 0x50, 0x4F, 0x4E, 0x4D, 0x4C, 0x4B, 0x4A, 0x49, - 0x48, 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41, - 0x40, 0x3F, 0x3E, 0x3D, 0x3C, 0x3B, 0x3A, 0x39, - 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, - 0x30, 0x2F, 0x2E, 0x2D, 0x2C, 0x2B, 0x2A, 0x29, - 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, - 0x20, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, - 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, -}; - -static const u8 b43_ntab_framelookup[] = { - 0x02, 0x04, 0x14, 0x14, 0x03, 0x05, 0x16, 0x16, - 0x0A, 0x0C, 0x1C, 0x1C, 0x0B, 0x0D, 0x1E, 0x1E, - 0x06, 0x08, 0x18, 0x18, 0x07, 0x09, 0x1A, 0x1A, - 0x0E, 0x10, 0x20, 0x28, 0x0F, 0x11, 0x22, 0x2A, -}; - -static const u32 b43_ntab_framestruct[] = { - 0x08004A04, 0x00100000, 0x01000A05, 0x00100020, - 0x09804506, 0x00100030, 0x09804507, 0x00100030, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x08004A0C, 0x00100004, 0x01000A0D, 0x00100024, - 0x0980450E, 0x00100034, 0x0980450F, 0x00100034, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000A04, 0x00100000, 0x11008A05, 0x00100020, - 0x1980C506, 0x00100030, 0x21810506, 0x00100030, - 0x21810506, 0x00100030, 0x01800504, 0x00100030, - 0x11808505, 0x00100030, 0x29814507, 0x01100030, - 0x00000A04, 0x00100000, 0x11008A05, 0x00100020, - 0x21810506, 0x00100030, 0x21810506, 0x00100030, - 0x29814507, 0x01100030, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000A0C, 0x00100008, 0x11008A0D, 0x00100028, - 0x1980C50E, 0x00100038, 0x2181050E, 0x00100038, - 0x2181050E, 0x00100038, 0x0180050C, 0x00100038, - 0x1180850D, 0x00100038, 0x2981450F, 0x01100038, - 0x00000A0C, 0x00100008, 0x11008A0D, 0x00100028, - 0x2181050E, 0x00100038, 0x2181050E, 0x00100038, - 0x2981450F, 0x01100038, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x08004A04, 0x00100000, 0x01000A05, 0x00100020, - 0x1980C506, 0x00100030, 0x1980C506, 0x00100030, - 0x11808504, 0x00100030, 0x3981CA05, 0x00100030, - 0x29814507, 0x01100030, 0x00000000, 0x00000000, - 0x10008A04, 0x00100000, 0x3981CA05, 0x00100030, - 0x1980C506, 0x00100030, 0x29814507, 0x01100030, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x08004A0C, 0x00100008, 0x01000A0D, 0x00100028, - 0x1980C50E, 0x00100038, 0x1980C50E, 0x00100038, - 0x1180850C, 0x00100038, 0x3981CA0D, 0x00100038, - 0x2981450F, 0x01100038, 0x00000000, 0x00000000, - 0x10008A0C, 0x00100008, 0x3981CA0D, 0x00100038, - 0x1980C50E, 0x00100038, 0x2981450F, 0x01100038, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x40021404, 0x00100000, 0x02001405, 0x00100040, - 0x0B004A06, 0x01900060, 0x13008A06, 0x01900060, - 0x13008A06, 0x01900060, 0x43020A04, 0x00100060, - 0x1B00CA05, 0x00100060, 0x23010A07, 0x01500060, - 0x40021404, 0x00100000, 0x1A00D405, 0x00100040, - 0x13008A06, 0x01900060, 0x13008A06, 0x01900060, - 0x23010A07, 0x01500060, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x4002140C, 0x00100010, 0x0200140D, 0x00100050, - 0x0B004A0E, 0x01900070, 0x13008A0E, 0x01900070, - 0x13008A0E, 0x01900070, 0x43020A0C, 0x00100070, - 0x1B00CA0D, 0x00100070, 0x23010A0F, 0x01500070, - 0x4002140C, 0x00100010, 0x1A00D40D, 0x00100050, - 0x13008A0E, 0x01900070, 0x13008A0E, 0x01900070, - 0x23010A0F, 0x01500070, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x50029404, 0x00100000, 0x32019405, 0x00100040, - 0x0B004A06, 0x01900060, 0x0B004A06, 0x01900060, - 0x5B02CA04, 0x00100060, 0x3B01D405, 0x00100060, - 0x23010A07, 0x01500060, 0x00000000, 0x00000000, - 0x5802D404, 0x00100000, 0x3B01D405, 0x00100060, - 0x0B004A06, 0x01900060, 0x23010A07, 0x01500060, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x5002940C, 0x00100010, 0x3201940D, 0x00100050, - 0x0B004A0E, 0x01900070, 0x0B004A0E, 0x01900070, - 0x5B02CA0C, 0x00100070, 0x3B01D40D, 0x00100070, - 0x23010A0F, 0x01500070, 0x00000000, 0x00000000, - 0x5802D40C, 0x00100010, 0x3B01D40D, 0x00100070, - 0x0B004A0E, 0x01900070, 0x23010A0F, 0x01500070, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x40021404, 0x000F4800, 0x62031405, 0x00100040, - 0x53028A06, 0x01900060, 0x53028A07, 0x01900060, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x4002140C, 0x000F4808, 0x6203140D, 0x00100048, - 0x53028A0E, 0x01900068, 0x53028A0F, 0x01900068, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000A0C, 0x00100004, 0x11008A0D, 0x00100024, - 0x1980C50E, 0x00100034, 0x2181050E, 0x00100034, - 0x2181050E, 0x00100034, 0x0180050C, 0x00100038, - 0x1180850D, 0x00100038, 0x1181850D, 0x00100038, - 0x2981450F, 0x01100038, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000A0C, 0x00100008, 0x11008A0D, 0x00100028, - 0x2181050E, 0x00100038, 0x2181050E, 0x00100038, - 0x1181850D, 0x00100038, 0x2981450F, 0x01100038, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x08004A04, 0x00100000, 0x01000A05, 0x00100020, - 0x0180C506, 0x00100030, 0x0180C506, 0x00100030, - 0x2180C50C, 0x00100030, 0x49820A0D, 0x0016A130, - 0x41824A0D, 0x0016A130, 0x2981450F, 0x01100030, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x2000CA0C, 0x00100000, 0x49820A0D, 0x0016A130, - 0x1980C50E, 0x00100030, 0x41824A0D, 0x0016A130, - 0x2981450F, 0x01100030, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x4002140C, 0x00100008, 0x0200140D, 0x00100048, - 0x0B004A0E, 0x01900068, 0x13008A0E, 0x01900068, - 0x13008A0E, 0x01900068, 0x43020A0C, 0x00100070, - 0x1B00CA0D, 0x00100070, 0x1B014A0D, 0x00100070, - 0x23010A0F, 0x01500070, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x4002140C, 0x00100010, 0x1A00D40D, 0x00100050, - 0x13008A0E, 0x01900070, 0x13008A0E, 0x01900070, - 0x1B014A0D, 0x00100070, 0x23010A0F, 0x01500070, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x50029404, 0x00100000, 0x32019405, 0x00100040, - 0x03004A06, 0x01900060, 0x03004A06, 0x01900060, - 0x6B030A0C, 0x00100060, 0x4B02140D, 0x0016A160, - 0x4302540D, 0x0016A160, 0x23010A0F, 0x01500060, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x6B03140C, 0x00100060, 0x4B02140D, 0x0016A160, - 0x0B004A0E, 0x01900060, 0x4302540D, 0x0016A160, - 0x23010A0F, 0x01500060, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x40021404, 0x00100000, 0x1A00D405, 0x00100040, - 0x53028A06, 0x01900060, 0x5B02CA06, 0x01900060, - 0x5B02CA06, 0x01900060, 0x43020A04, 0x00100060, - 0x1B00CA05, 0x00100060, 0x53028A07, 0x0190C060, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x4002140C, 0x00100010, 0x1A00D40D, 0x00100050, - 0x53028A0E, 0x01900070, 0x5B02CA0E, 0x01900070, - 0x5B02CA0E, 0x01900070, 0x43020A0C, 0x00100070, - 0x1B00CA0D, 0x00100070, 0x53028A0F, 0x0190C070, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x40021404, 0x00100000, 0x1A00D405, 0x00100040, - 0x5B02CA06, 0x01900060, 0x5B02CA06, 0x01900060, - 0x53028A07, 0x0190C060, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x4002140C, 0x00100010, 0x1A00D40D, 0x00100050, - 0x5B02CA0E, 0x01900070, 0x5B02CA0E, 0x01900070, - 0x53028A0F, 0x0190C070, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static const u32 b43_ntab_gainctl0[] = { - 0x03CC2B44, 0x03CC2B42, 0x03CC2B40, 0x03CC2B3E, - 0x03CC2B3D, 0x03CC2B3B, 0x03C82B44, 0x03C82B42, - 0x03C82B40, 0x03C82B3E, 0x03C82B3D, 0x03C82B3B, - 0x03C82B39, 0x03C82B38, 0x03C82B36, 0x03C82B34, - 0x03C42B44, 0x03C42B42, 0x03C42B40, 0x03C42B3E, - 0x03C42B3D, 0x03C42B3B, 0x03C42B39, 0x03C42B38, - 0x03C42B36, 0x03C42B34, 0x03C42B33, 0x03C42B32, - 0x03C42B30, 0x03C42B2F, 0x03C42B2D, 0x03C02B44, - 0x03C02B42, 0x03C02B40, 0x03C02B3E, 0x03C02B3D, - 0x03C02B3B, 0x03C02B39, 0x03C02B38, 0x03C02B36, - 0x03C02B34, 0x03B02B44, 0x03B02B42, 0x03B02B40, - 0x03B02B3E, 0x03B02B3D, 0x03B02B3B, 0x03B02B39, - 0x03B02B38, 0x03B02B36, 0x03B02B34, 0x03B02B33, - 0x03B02B32, 0x03B02B30, 0x03B02B2F, 0x03B02B2D, - 0x03A02B44, 0x03A02B42, 0x03A02B40, 0x03A02B3E, - 0x03A02B3D, 0x03A02B3B, 0x03A02B39, 0x03A02B38, - 0x03A02B36, 0x03A02B34, 0x03902B44, 0x03902B42, - 0x03902B40, 0x03902B3E, 0x03902B3D, 0x03902B3B, - 0x03902B39, 0x03902B38, 0x03902B36, 0x03902B34, - 0x03902B33, 0x03902B32, 0x03902B30, 0x03802B44, - 0x03802B42, 0x03802B40, 0x03802B3E, 0x03802B3D, - 0x03802B3B, 0x03802B39, 0x03802B38, 0x03802B36, - 0x03802B34, 0x03802B33, 0x03802B32, 0x03802B30, - 0x03802B2F, 0x03802B2D, 0x03802B2C, 0x03802B2B, - 0x03802B2A, 0x03802B29, 0x03802B27, 0x03802B26, - 0x03802B25, 0x03802B24, 0x03802B23, 0x03802B22, - 0x03802B21, 0x03802B20, 0x03802B1F, 0x03802B1E, - 0x03802B1E, 0x03802B1D, 0x03802B1C, 0x03802B1B, - 0x03802B1A, 0x03802B1A, 0x03802B19, 0x03802B18, - 0x03802B18, 0x03802B18, 0x03802B18, 0x03802B18, - 0x03802B18, 0x03802B18, 0x03802B18, 0x03802B18, - 0x03802B18, 0x03802B18, 0x03802B18, 0x00002B00, -}; - -static const u32 b43_ntab_gainctl1[] = { - 0x03CC2B44, 0x03CC2B42, 0x03CC2B40, 0x03CC2B3E, - 0x03CC2B3D, 0x03CC2B3B, 0x03C82B44, 0x03C82B42, - 0x03C82B40, 0x03C82B3E, 0x03C82B3D, 0x03C82B3B, - 0x03C82B39, 0x03C82B38, 0x03C82B36, 0x03C82B34, - 0x03C42B44, 0x03C42B42, 0x03C42B40, 0x03C42B3E, - 0x03C42B3D, 0x03C42B3B, 0x03C42B39, 0x03C42B38, - 0x03C42B36, 0x03C42B34, 0x03C42B33, 0x03C42B32, - 0x03C42B30, 0x03C42B2F, 0x03C42B2D, 0x03C02B44, - 0x03C02B42, 0x03C02B40, 0x03C02B3E, 0x03C02B3D, - 0x03C02B3B, 0x03C02B39, 0x03C02B38, 0x03C02B36, - 0x03C02B34, 0x03B02B44, 0x03B02B42, 0x03B02B40, - 0x03B02B3E, 0x03B02B3D, 0x03B02B3B, 0x03B02B39, - 0x03B02B38, 0x03B02B36, 0x03B02B34, 0x03B02B33, - 0x03B02B32, 0x03B02B30, 0x03B02B2F, 0x03B02B2D, - 0x03A02B44, 0x03A02B42, 0x03A02B40, 0x03A02B3E, - 0x03A02B3D, 0x03A02B3B, 0x03A02B39, 0x03A02B38, - 0x03A02B36, 0x03A02B34, 0x03902B44, 0x03902B42, - 0x03902B40, 0x03902B3E, 0x03902B3D, 0x03902B3B, - 0x03902B39, 0x03902B38, 0x03902B36, 0x03902B34, - 0x03902B33, 0x03902B32, 0x03902B30, 0x03802B44, - 0x03802B42, 0x03802B40, 0x03802B3E, 0x03802B3D, - 0x03802B3B, 0x03802B39, 0x03802B38, 0x03802B36, - 0x03802B34, 0x03802B33, 0x03802B32, 0x03802B30, - 0x03802B2F, 0x03802B2D, 0x03802B2C, 0x03802B2B, - 0x03802B2A, 0x03802B29, 0x03802B27, 0x03802B26, - 0x03802B25, 0x03802B24, 0x03802B23, 0x03802B22, - 0x03802B21, 0x03802B20, 0x03802B1F, 0x03802B1E, - 0x03802B1E, 0x03802B1D, 0x03802B1C, 0x03802B1B, - 0x03802B1A, 0x03802B1A, 0x03802B19, 0x03802B18, - 0x03802B18, 0x03802B18, 0x03802B18, 0x03802B18, - 0x03802B18, 0x03802B18, 0x03802B18, 0x03802B18, - 0x03802B18, 0x03802B18, 0x03802B18, 0x00002B00, -}; - -static const u32 b43_ntab_intlevel[] = { - 0x00802070, 0x0671188D, 0x0A60192C, 0x0A300E46, - 0x00C1188D, 0x080024D2, 0x00000070, -}; - -static const u32 b43_ntab_iqlt0[] = { - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, -}; - -static const u32 b43_ntab_iqlt1[] = { - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, - 0x0000007F, 0x0000007F, 0x0000007F, 0x0000007F, -}; - -static const u16 b43_ntab_loftlt0[] = { - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, -}; - -static const u16 b43_ntab_loftlt1[] = { - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, 0x0000, 0x0101, 0x0002, 0x0103, - 0x0000, 0x0101, 0x0002, 0x0103, 0x0000, 0x0101, - 0x0002, 0x0103, -}; - -static const u8 b43_ntab_mcs[] = { - 0x00, 0x08, 0x0A, 0x10, 0x12, 0x19, 0x1A, 0x1C, - 0x40, 0x48, 0x4A, 0x50, 0x52, 0x59, 0x5A, 0x5C, - 0x80, 0x88, 0x8A, 0x90, 0x92, 0x99, 0x9A, 0x9C, - 0xC0, 0xC8, 0xCA, 0xD0, 0xD2, 0xD9, 0xDA, 0xDC, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x02, 0x04, 0x08, 0x09, 0x0A, 0x0C, - 0x10, 0x11, 0x12, 0x14, 0x18, 0x19, 0x1A, 0x1C, - 0x20, 0x21, 0x22, 0x24, 0x40, 0x41, 0x42, 0x44, - 0x48, 0x49, 0x4A, 0x4C, 0x50, 0x51, 0x52, 0x54, - 0x58, 0x59, 0x5A, 0x5C, 0x60, 0x61, 0x62, 0x64, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -static const u32 b43_ntab_noisevar10[] = { - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, -}; - -static const u32 b43_ntab_noisevar11[] = { - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, - 0x020C020C, 0x0000014D, 0x020C020C, 0x0000014D, -}; - -static const u16 b43_ntab_pilot[] = { - 0xFF08, 0xFF08, 0xFF08, 0xFF08, 0xFF08, 0xFF08, - 0xFF08, 0xFF08, 0x80D5, 0x80D5, 0x80D5, 0x80D5, - 0x80D5, 0x80D5, 0x80D5, 0x80D5, 0xFF0A, 0xFF82, - 0xFFA0, 0xFF28, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xFF82, 0xFFA0, 0xFF28, 0xFF0A, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xF83F, 0xFA1F, 0xFA97, 0xFAB5, - 0xF2BD, 0xF0BF, 0xFFFF, 0xFFFF, 0xF017, 0xF815, - 0xF215, 0xF095, 0xF035, 0xF01D, 0xFFFF, 0xFFFF, - 0xFF08, 0xFF02, 0xFF80, 0xFF20, 0xFF08, 0xFF02, - 0xFF80, 0xFF20, 0xF01F, 0xF817, 0xFA15, 0xF295, - 0xF0B5, 0xF03D, 0xFFFF, 0xFFFF, 0xF82A, 0xFA0A, - 0xFA82, 0xFAA0, 0xF2A8, 0xF0AA, 0xFFFF, 0xFFFF, - 0xF002, 0xF800, 0xF200, 0xF080, 0xF020, 0xF008, - 0xFFFF, 0xFFFF, 0xF00A, 0xF802, 0xFA00, 0xF280, - 0xF0A0, 0xF028, 0xFFFF, 0xFFFF, -}; - -static const u32 b43_ntab_pilotlt[] = { - 0x76540123, 0x62407351, 0x76543201, 0x76540213, - 0x76540123, 0x76430521, -}; - -static const u32 b43_ntab_tdi20a0[] = { - 0x00091226, 0x000A1429, 0x000B56AD, 0x000C58B0, - 0x000D5AB3, 0x000E9CB6, 0x000F9EBA, 0x0000C13D, - 0x00020301, 0x00030504, 0x00040708, 0x0005090B, - 0x00064B8E, 0x00095291, 0x000A5494, 0x000B9718, - 0x000C9927, 0x000D9B2A, 0x000EDD2E, 0x000FDF31, - 0x000101B4, 0x000243B7, 0x000345BB, 0x000447BE, - 0x00058982, 0x00068C05, 0x00099309, 0x000A950C, - 0x000BD78F, 0x000CD992, 0x000DDB96, 0x000F1D99, - 0x00005FA8, 0x0001422C, 0x0002842F, 0x00038632, - 0x00048835, 0x0005CA38, 0x0006CCBC, 0x0009D3BF, - 0x000B1603, 0x000C1806, 0x000D1A0A, 0x000E1C0D, - 0x000F5E10, 0x00008093, 0x00018297, 0x0002C49A, - 0x0003C680, 0x0004C880, 0x00060B00, 0x00070D00, - 0x00000000, 0x00000000, 0x00000000, -}; - -static const u32 b43_ntab_tdi20a1[] = { - 0x00014B26, 0x00028D29, 0x000393AD, 0x00049630, - 0x0005D833, 0x0006DA36, 0x00099C3A, 0x000A9E3D, - 0x000BC081, 0x000CC284, 0x000DC488, 0x000F068B, - 0x0000488E, 0x00018B91, 0x0002D214, 0x0003D418, - 0x0004D6A7, 0x000618AA, 0x00071AAE, 0x0009DCB1, - 0x000B1EB4, 0x000C0137, 0x000D033B, 0x000E053E, - 0x000F4702, 0x00008905, 0x00020C09, 0x0003128C, - 0x0004148F, 0x00051712, 0x00065916, 0x00091B19, - 0x000A1D28, 0x000B5F2C, 0x000C41AF, 0x000D43B2, - 0x000E85B5, 0x000F87B8, 0x0000C9BC, 0x00024CBF, - 0x00035303, 0x00045506, 0x0005978A, 0x0006998D, - 0x00095B90, 0x000A5D93, 0x000B9F97, 0x000C821A, - 0x000D8400, 0x000EC600, 0x000FC800, 0x00010A00, - 0x00000000, 0x00000000, 0x00000000, -}; - -static const u32 b43_ntab_tdi40a0[] = { - 0x0011A346, 0x00136CCF, 0x0014F5D9, 0x001641E2, - 0x0017CB6B, 0x00195475, 0x001B2383, 0x001CAD0C, - 0x001E7616, 0x0000821F, 0x00020BA8, 0x0003D4B2, - 0x00056447, 0x00072DD0, 0x0008B6DA, 0x000A02E3, - 0x000B8C6C, 0x000D15F6, 0x0011E484, 0x0013AE0D, - 0x00153717, 0x00168320, 0x00180CA9, 0x00199633, - 0x001B6548, 0x001CEED1, 0x001EB7DB, 0x0000C3E4, - 0x00024D6D, 0x000416F7, 0x0005A585, 0x00076F0F, - 0x0008F818, 0x000A4421, 0x000BCDAB, 0x000D9734, - 0x00122649, 0x0013EFD2, 0x001578DC, 0x0016C4E5, - 0x00184E6E, 0x001A17F8, 0x001BA686, 0x001D3010, - 0x001EF999, 0x00010522, 0x00028EAC, 0x00045835, - 0x0005E74A, 0x0007B0D3, 0x00093A5D, 0x000A85E6, - 0x000C0F6F, 0x000DD8F9, 0x00126787, 0x00143111, - 0x0015BA9A, 0x00170623, 0x00188FAD, 0x001A5936, - 0x001BE84B, 0x001DB1D4, 0x001F3B5E, 0x000146E7, - 0x00031070, 0x000499FA, 0x00062888, 0x0007F212, - 0x00097B9B, 0x000AC7A4, 0x000C50AE, 0x000E1A37, - 0x0012A94C, 0x001472D5, 0x0015FC5F, 0x00174868, - 0x0018D171, 0x001A9AFB, 0x001C2989, 0x001DF313, - 0x001F7C9C, 0x000188A5, 0x000351AF, 0x0004DB38, - 0x0006AA4D, 0x000833D7, 0x0009BD60, 0x000B0969, - 0x000C9273, 0x000E5BFC, 0x00132A8A, 0x0014B414, - 0x00163D9D, 0x001789A6, 0x001912B0, 0x001ADC39, - 0x001C6BCE, 0x001E34D8, 0x001FBE61, 0x0001CA6A, - 0x00039374, 0x00051CFD, 0x0006EC0B, 0x00087515, - 0x0009FE9E, 0x000B4AA7, 0x000CD3B1, 0x000E9D3A, - 0x00000000, 0x00000000, -}; - -static const u32 b43_ntab_tdi40a1[] = { - 0x001EDB36, 0x000129CA, 0x0002B353, 0x00047CDD, - 0x0005C8E6, 0x000791EF, 0x00091BF9, 0x000AAA07, - 0x000C3391, 0x000DFD1A, 0x00120923, 0x0013D22D, - 0x00155C37, 0x0016EACB, 0x00187454, 0x001A3DDE, - 0x001B89E7, 0x001D12F0, 0x001F1CFA, 0x00016B88, - 0x00033492, 0x0004BE1B, 0x00060A24, 0x0007D32E, - 0x00095D38, 0x000AEC4C, 0x000C7555, 0x000E3EDF, - 0x00124AE8, 0x001413F1, 0x0015A37B, 0x00172C89, - 0x0018B593, 0x001A419C, 0x001BCB25, 0x001D942F, - 0x001F63B9, 0x0001AD4D, 0x00037657, 0x0004C260, - 0x00068BE9, 0x000814F3, 0x0009A47C, 0x000B2D8A, - 0x000CB694, 0x000E429D, 0x00128C26, 0x001455B0, - 0x0015E4BA, 0x00176E4E, 0x0018F758, 0x001A8361, - 0x001C0CEA, 0x001DD674, 0x001FA57D, 0x0001EE8B, - 0x0003B795, 0x0005039E, 0x0006CD27, 0x000856B1, - 0x0009E5C6, 0x000B6F4F, 0x000CF859, 0x000E8462, - 0x00130DEB, 0x00149775, 0x00162603, 0x0017AF8C, - 0x00193896, 0x001AC49F, 0x001C4E28, 0x001E17B2, - 0x0000A6C7, 0x00023050, 0x0003F9DA, 0x00054563, - 0x00070EEC, 0x00089876, 0x000A2704, 0x000BB08D, - 0x000D3A17, 0x001185A0, 0x00134F29, 0x0014D8B3, - 0x001667C8, 0x0017F151, 0x00197ADB, 0x001B0664, - 0x001C8FED, 0x001E5977, 0x0000E805, 0x0002718F, - 0x00043B18, 0x000586A1, 0x0007502B, 0x0008D9B4, - 0x000A68C9, 0x000BF252, 0x000DBBDC, 0x0011C7E5, - 0x001390EE, 0x00151A78, 0x0016A906, 0x00183290, - 0x0019BC19, 0x001B4822, 0x001CD12C, 0x001E9AB5, - 0x00000000, 0x00000000, -}; - -static const u32 b43_ntab_tdtrn[] = { - 0x061C061C, 0x0050EE68, 0xF592FE36, 0xFE5212F6, - 0x00000C38, 0xFE5212F6, 0xF592FE36, 0x0050EE68, - 0x061C061C, 0xEE680050, 0xFE36F592, 0x12F6FE52, - 0x0C380000, 0x12F6FE52, 0xFE36F592, 0xEE680050, - 0x061C061C, 0x0050EE68, 0xF592FE36, 0xFE5212F6, - 0x00000C38, 0xFE5212F6, 0xF592FE36, 0x0050EE68, - 0x061C061C, 0xEE680050, 0xFE36F592, 0x12F6FE52, - 0x0C380000, 0x12F6FE52, 0xFE36F592, 0xEE680050, - 0x05E305E3, 0x004DEF0C, 0xF5F3FE47, 0xFE611246, - 0x00000BC7, 0xFE611246, 0xF5F3FE47, 0x004DEF0C, - 0x05E305E3, 0xEF0C004D, 0xFE47F5F3, 0x1246FE61, - 0x0BC70000, 0x1246FE61, 0xFE47F5F3, 0xEF0C004D, - 0x05E305E3, 0x004DEF0C, 0xF5F3FE47, 0xFE611246, - 0x00000BC7, 0xFE611246, 0xF5F3FE47, 0x004DEF0C, - 0x05E305E3, 0xEF0C004D, 0xFE47F5F3, 0x1246FE61, - 0x0BC70000, 0x1246FE61, 0xFE47F5F3, 0xEF0C004D, - 0xFA58FA58, 0xF895043B, 0xFF4C09C0, 0xFBC6FFA8, - 0xFB84F384, 0x0798F6F9, 0x05760122, 0x058409F6, - 0x0B500000, 0x05B7F542, 0x08860432, 0x06DDFEE7, - 0xFB84F384, 0xF9D90664, 0xF7E8025C, 0x00FFF7BD, - 0x05A805A8, 0xF7BD00FF, 0x025CF7E8, 0x0664F9D9, - 0xF384FB84, 0xFEE706DD, 0x04320886, 0xF54205B7, - 0x00000B50, 0x09F60584, 0x01220576, 0xF6F90798, - 0xF384FB84, 0xFFA8FBC6, 0x09C0FF4C, 0x043BF895, - 0x02D402D4, 0x07DE0270, 0xFC96079C, 0xF90AFE94, - 0xFE00FF2C, 0x02D4065D, 0x092A0096, 0x0014FBB8, - 0xFD2CFD2C, 0x076AFB3C, 0x0096F752, 0xF991FD87, - 0xFB2C0200, 0xFEB8F960, 0x08E0FC96, 0x049802A8, - 0xFD2CFD2C, 0x02A80498, 0xFC9608E0, 0xF960FEB8, - 0x0200FB2C, 0xFD87F991, 0xF7520096, 0xFB3C076A, - 0xFD2CFD2C, 0xFBB80014, 0x0096092A, 0x065D02D4, - 0xFF2CFE00, 0xFE94F90A, 0x079CFC96, 0x027007DE, - 0x02D402D4, 0x027007DE, 0x079CFC96, 0xFE94F90A, - 0xFF2CFE00, 0x065D02D4, 0x0096092A, 0xFBB80014, - 0xFD2CFD2C, 0xFB3C076A, 0xF7520096, 0xFD87F991, - 0x0200FB2C, 0xF960FEB8, 0xFC9608E0, 0x02A80498, - 0xFD2CFD2C, 0x049802A8, 0x08E0FC96, 0xFEB8F960, - 0xFB2C0200, 0xF991FD87, 0x0096F752, 0x076AFB3C, - 0xFD2CFD2C, 0x0014FBB8, 0x092A0096, 0x02D4065D, - 0xFE00FF2C, 0xF90AFE94, 0xFC96079C, 0x07DE0270, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x062A0000, 0xFEFA0759, 0x08B80908, 0xF396FC2D, - 0xF9D6045C, 0xFC4EF608, 0xF748F596, 0x07B207BF, - 0x062A062A, 0xF84EF841, 0xF748F596, 0x03B209F8, - 0xF9D6045C, 0x0C6A03D3, 0x08B80908, 0x0106F8A7, - 0x062A0000, 0xFEFAF8A7, 0x08B8F6F8, 0xF39603D3, - 0xF9D6FBA4, 0xFC4E09F8, 0xF7480A6A, 0x07B2F841, - 0x062AF9D6, 0xF84E07BF, 0xF7480A6A, 0x03B2F608, - 0xF9D6FBA4, 0x0C6AFC2D, 0x08B8F6F8, 0x01060759, - 0x062A0000, 0xFEFA0759, 0x08B80908, 0xF396FC2D, - 0xF9D6045C, 0xFC4EF608, 0xF748F596, 0x07B207BF, - 0x062A062A, 0xF84EF841, 0xF748F596, 0x03B209F8, - 0xF9D6045C, 0x0C6A03D3, 0x08B80908, 0x0106F8A7, - 0x062A0000, 0xFEFAF8A7, 0x08B8F6F8, 0xF39603D3, - 0xF9D6FBA4, 0xFC4E09F8, 0xF7480A6A, 0x07B2F841, - 0x062AF9D6, 0xF84E07BF, 0xF7480A6A, 0x03B2F608, - 0xF9D6FBA4, 0x0C6AFC2D, 0x08B8F6F8, 0x01060759, - 0x061C061C, 0xFF30009D, 0xFFB21141, 0xFD87FB54, - 0xF65DFE59, 0x02EEF99E, 0x0166F03C, 0xFFF809B6, - 0x000008A4, 0x000AF42B, 0x00EFF577, 0xFA840BF2, - 0xFC02FF51, 0x08260F67, 0xFFF0036F, 0x0842F9C3, - 0x00000000, 0x063DF7BE, 0xFC910010, 0xF099F7DA, - 0x00AF03FE, 0xF40E057C, 0x0A89FF11, 0x0BD5FFF6, - 0xF75C0000, 0xF64A0008, 0x0FC4FE9A, 0x0662FD12, - 0x01A709A3, 0x04AC0279, 0xEEBF004E, 0xFF6300D0, - 0xF9E4F9E4, 0x00D0FF63, 0x004EEEBF, 0x027904AC, - 0x09A301A7, 0xFD120662, 0xFE9A0FC4, 0x0008F64A, - 0x0000F75C, 0xFFF60BD5, 0xFF110A89, 0x057CF40E, - 0x03FE00AF, 0xF7DAF099, 0x0010FC91, 0xF7BE063D, - 0x00000000, 0xF9C30842, 0x036FFFF0, 0x0F670826, - 0xFF51FC02, 0x0BF2FA84, 0xF57700EF, 0xF42B000A, - 0x08A40000, 0x09B6FFF8, 0xF03C0166, 0xF99E02EE, - 0xFE59F65D, 0xFB54FD87, 0x1141FFB2, 0x009DFF30, - 0x05E30000, 0xFF060705, 0x085408A0, 0xF425FC59, - 0xFA1D042A, 0xFC78F67A, 0xF7ACF60E, 0x075A0766, - 0x05E305E3, 0xF8A6F89A, 0xF7ACF60E, 0x03880986, - 0xFA1D042A, 0x0BDB03A7, 0x085408A0, 0x00FAF8FB, - 0x05E30000, 0xFF06F8FB, 0x0854F760, 0xF42503A7, - 0xFA1DFBD6, 0xFC780986, 0xF7AC09F2, 0x075AF89A, - 0x05E3FA1D, 0xF8A60766, 0xF7AC09F2, 0x0388F67A, - 0xFA1DFBD6, 0x0BDBFC59, 0x0854F760, 0x00FA0705, - 0x05E30000, 0xFF060705, 0x085408A0, 0xF425FC59, - 0xFA1D042A, 0xFC78F67A, 0xF7ACF60E, 0x075A0766, - 0x05E305E3, 0xF8A6F89A, 0xF7ACF60E, 0x03880986, - 0xFA1D042A, 0x0BDB03A7, 0x085408A0, 0x00FAF8FB, - 0x05E30000, 0xFF06F8FB, 0x0854F760, 0xF42503A7, - 0xFA1DFBD6, 0xFC780986, 0xF7AC09F2, 0x075AF89A, - 0x05E3FA1D, 0xF8A60766, 0xF7AC09F2, 0x0388F67A, - 0xFA1DFBD6, 0x0BDBFC59, 0x0854F760, 0x00FA0705, - 0xFA58FA58, 0xF8F0FE00, 0x0448073D, 0xFDC9FE46, - 0xF9910258, 0x089D0407, 0xFD5CF71A, 0x02AFFDE0, - 0x083E0496, 0xFF5A0740, 0xFF7AFD97, 0x00FE01F1, - 0x0009082E, 0xFA94FF75, 0xFECDF8EA, 0xFFB0F693, - 0xFD2CFA58, 0x0433FF16, 0xFBA405DD, 0xFA610341, - 0x06A606CB, 0x0039FD2D, 0x0677FA97, 0x01FA05E0, - 0xF896003E, 0x075A068B, 0x012CFC3E, 0xFA23F98D, - 0xFC7CFD43, 0xFF90FC0D, 0x01C10982, 0x00C601D6, - 0xFD2CFD2C, 0x01D600C6, 0x098201C1, 0xFC0DFF90, - 0xFD43FC7C, 0xF98DFA23, 0xFC3E012C, 0x068B075A, - 0x003EF896, 0x05E001FA, 0xFA970677, 0xFD2D0039, - 0x06CB06A6, 0x0341FA61, 0x05DDFBA4, 0xFF160433, - 0xFA58FD2C, 0xF693FFB0, 0xF8EAFECD, 0xFF75FA94, - 0x082E0009, 0x01F100FE, 0xFD97FF7A, 0x0740FF5A, - 0x0496083E, 0xFDE002AF, 0xF71AFD5C, 0x0407089D, - 0x0258F991, 0xFE46FDC9, 0x073D0448, 0xFE00F8F0, - 0xFD2CFD2C, 0xFCE00500, 0xFC09FDDC, 0xFE680157, - 0x04C70571, 0xFC3AFF21, 0xFCD70228, 0x056D0277, - 0x0200FE00, 0x0022F927, 0xFE3C032B, 0xFC44FF3C, - 0x03E9FBDB, 0x04570313, 0x04C9FF5C, 0x000D03B8, - 0xFA580000, 0xFBE900D2, 0xF9D0FE0B, 0x0125FDF9, - 0x042501BF, 0x0328FA2B, 0xFFA902F0, 0xFA250157, - 0x0200FE00, 0x03740438, 0xFF0405FD, 0x030CFE52, - 0x0037FB39, 0xFF6904C5, 0x04F8FD23, 0xFD31FC1B, - 0xFD2CFD2C, 0xFC1BFD31, 0xFD2304F8, 0x04C5FF69, - 0xFB390037, 0xFE52030C, 0x05FDFF04, 0x04380374, - 0xFE000200, 0x0157FA25, 0x02F0FFA9, 0xFA2B0328, - 0x01BF0425, 0xFDF90125, 0xFE0BF9D0, 0x00D2FBE9, - 0x0000FA58, 0x03B8000D, 0xFF5C04C9, 0x03130457, - 0xFBDB03E9, 0xFF3CFC44, 0x032BFE3C, 0xF9270022, - 0xFE000200, 0x0277056D, 0x0228FCD7, 0xFF21FC3A, - 0x057104C7, 0x0157FE68, 0xFDDCFC09, 0x0500FCE0, - 0xFD2CFD2C, 0x0500FCE0, 0xFDDCFC09, 0x0157FE68, - 0x057104C7, 0xFF21FC3A, 0x0228FCD7, 0x0277056D, - 0xFE000200, 0xF9270022, 0x032BFE3C, 0xFF3CFC44, - 0xFBDB03E9, 0x03130457, 0xFF5C04C9, 0x03B8000D, - 0x0000FA58, 0x00D2FBE9, 0xFE0BF9D0, 0xFDF90125, - 0x01BF0425, 0xFA2B0328, 0x02F0FFA9, 0x0157FA25, - 0xFE000200, 0x04380374, 0x05FDFF04, 0xFE52030C, - 0xFB390037, 0x04C5FF69, 0xFD2304F8, 0xFC1BFD31, - 0xFD2CFD2C, 0xFD31FC1B, 0x04F8FD23, 0xFF6904C5, - 0x0037FB39, 0x030CFE52, 0xFF0405FD, 0x03740438, - 0x0200FE00, 0xFA250157, 0xFFA902F0, 0x0328FA2B, - 0x042501BF, 0x0125FDF9, 0xF9D0FE0B, 0xFBE900D2, - 0xFA580000, 0x000D03B8, 0x04C9FF5C, 0x04570313, - 0x03E9FBDB, 0xFC44FF3C, 0xFE3C032B, 0x0022F927, - 0x0200FE00, 0x056D0277, 0xFCD70228, 0xFC3AFF21, - 0x04C70571, 0xFE680157, 0xFC09FDDC, 0xFCE00500, - 0x05A80000, 0xFF1006BE, 0x0800084A, 0xF49CFC7E, - 0xFA580400, 0xFC9CF6DA, 0xF800F672, 0x0710071C, - 0x05A805A8, 0xF8F0F8E4, 0xF800F672, 0x03640926, - 0xFA580400, 0x0B640382, 0x0800084A, 0x00F0F942, - 0x05A80000, 0xFF10F942, 0x0800F7B6, 0xF49C0382, - 0xFA58FC00, 0xFC9C0926, 0xF800098E, 0x0710F8E4, - 0x05A8FA58, 0xF8F0071C, 0xF800098E, 0x0364F6DA, - 0xFA58FC00, 0x0B64FC7E, 0x0800F7B6, 0x00F006BE, - 0x05A80000, 0xFF1006BE, 0x0800084A, 0xF49CFC7E, - 0xFA580400, 0xFC9CF6DA, 0xF800F672, 0x0710071C, - 0x05A805A8, 0xF8F0F8E4, 0xF800F672, 0x03640926, - 0xFA580400, 0x0B640382, 0x0800084A, 0x00F0F942, - 0x05A80000, 0xFF10F942, 0x0800F7B6, 0xF49C0382, - 0xFA58FC00, 0xFC9C0926, 0xF800098E, 0x0710F8E4, - 0x05A8FA58, 0xF8F0071C, 0xF800098E, 0x0364F6DA, - 0xFA58FC00, 0x0B64FC7E, 0x0800F7B6, 0x00F006BE, -}; - -static const u32 b43_ntab_tmap[] = { - 0x8A88AA80, 0x8AAAAA8A, 0x8A8A8AA8, 0x00000888, - 0x88000000, 0x8A8A88AA, 0x8AA88888, 0x8888A8A8, - 0xF1111110, 0x11111111, 0x11F11111, 0x00000111, - 0x11000000, 0x1111F111, 0x11111111, 0x111111F1, - 0x8A88AA80, 0x8AAAAA8A, 0x8A8A8AA8, 0x000AA888, - 0x88880000, 0x8A8A88AA, 0x8AA88888, 0x8888A8A8, - 0xA1111110, 0x11111111, 0x11C11111, 0x00000111, - 0x11000000, 0x1111A111, 0x11111111, 0x111111A1, - 0xA2222220, 0x22222222, 0x22C22222, 0x00000222, - 0x22000000, 0x2222A222, 0x22222222, 0x222222A2, - 0xF1111110, 0x11111111, 0x11F11111, 0x00011111, - 0x11110000, 0x1111F111, 0x11111111, 0x111111F1, - 0xA8AA88A0, 0xA88888A8, 0xA8A8A88A, 0x00088AAA, - 0xAAAA0000, 0xA8A8AA88, 0xA88AAAAA, 0xAAAA8A8A, - 0xAAA8AAA0, 0x8AAA8AAA, 0xAA8A8A8A, 0x000AAA88, - 0x8AAA0000, 0xAAA8A888, 0x8AA88A8A, 0x8A88A888, - 0x08080A00, 0x0A08080A, 0x080A0A08, 0x00080808, - 0x080A0000, 0x080A0808, 0x080A0808, 0x0A0A0A08, - 0xA0A0A0A0, 0x80A0A080, 0x8080A0A0, 0x00008080, - 0x80A00000, 0x80A080A0, 0xA080A0A0, 0x8080A0A0, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x99999000, 0x9B9B99BB, 0x9BB99999, 0x9999B9B9, - 0x9B99BB90, 0x9BBBBB9B, 0x9B9B9BB9, 0x00000999, - 0x88000000, 0x8A8A88AA, 0x8AA88888, 0x8888A8A8, - 0x8A88AA80, 0x8AAAAA8A, 0x8A8A8AA8, 0x00AAA888, - 0x22000000, 0x2222B222, 0x22222222, 0x222222B2, - 0xB2222220, 0x22222222, 0x22D22222, 0x00000222, - 0x11000000, 0x1111A111, 0x11111111, 0x111111A1, - 0xA1111110, 0x11111111, 0x11C11111, 0x00000111, - 0x33000000, 0x3333B333, 0x33333333, 0x333333B3, - 0xB3333330, 0x33333333, 0x33D33333, 0x00000333, - 0x22000000, 0x2222A222, 0x22222222, 0x222222A2, - 0xA2222220, 0x22222222, 0x22C22222, 0x00000222, - 0x99B99B00, 0x9B9B99BB, 0x9BB99999, 0x9999B9B9, - 0x9B99BB99, 0x9BBBBB9B, 0x9B9B9BB9, 0x00000999, - 0x88000000, 0x8A8A88AA, 0x8AA88888, 0x8888A8A8, - 0x8A88AA88, 0x8AAAAA8A, 0x8A8A8AA8, 0x08AAA888, - 0x22222200, 0x2222F222, 0x22222222, 0x222222F2, - 0x22222222, 0x22222222, 0x22F22222, 0x00000222, - 0x11000000, 0x1111F111, 0x11111111, 0x11111111, - 0xF1111111, 0x11111111, 0x11F11111, 0x01111111, - 0xBB9BB900, 0xB9B9BB99, 0xB99BBBBB, 0xBBBB9B9B, - 0xB9BB99BB, 0xB99999B9, 0xB9B9B99B, 0x00000BBB, - 0xAA000000, 0xA8A8AA88, 0xA88AAAAA, 0xAAAA8A8A, - 0xA8AA88AA, 0xA88888A8, 0xA8A8A88A, 0x0A888AAA, - 0xAA000000, 0xA8A8AA88, 0xA88AAAAA, 0xAAAA8A8A, - 0xA8AA88A0, 0xA88888A8, 0xA8A8A88A, 0x00000AAA, - 0x88000000, 0x8A8A88AA, 0x8AA88888, 0x8888A8A8, - 0x8A88AA80, 0x8AAAAA8A, 0x8A8A8AA8, 0x00000888, - 0xBBBBBB00, 0x999BBBBB, 0x9BB99B9B, 0xB9B9B9BB, - 0xB9B99BBB, 0xB9B9B9BB, 0xB9BB9B99, 0x00000999, - 0x8A000000, 0xAA88A888, 0xA88888AA, 0xA88A8A88, - 0xA88AA88A, 0x88A8AAAA, 0xA8AA8AAA, 0x0888A88A, - 0x0B0B0B00, 0x090B0B0B, 0x0B090B0B, 0x0909090B, - 0x09090B0B, 0x09090B0B, 0x09090B09, 0x00000909, - 0x0A000000, 0x0A080808, 0x080A080A, 0x080A0A08, - 0x080A080A, 0x0808080A, 0x0A0A0A08, 0x0808080A, - 0xB0B0B000, 0x9090B0B0, 0x90B09090, 0xB0B0B090, - 0xB0B090B0, 0x90B0B0B0, 0xB0B09090, 0x00000090, - 0x80000000, 0xA080A080, 0xA08080A0, 0xA0808080, - 0xA080A080, 0x80A0A0A0, 0xA0A080A0, 0x00A0A0A0, - 0x22000000, 0x2222F222, 0x22222222, 0x222222F2, - 0xF2222220, 0x22222222, 0x22F22222, 0x00000222, - 0x11000000, 0x1111F111, 0x11111111, 0x111111F1, - 0xF1111110, 0x11111111, 0x11F11111, 0x00000111, - 0x33000000, 0x3333F333, 0x33333333, 0x333333F3, - 0xF3333330, 0x33333333, 0x33F33333, 0x00000333, - 0x22000000, 0x2222F222, 0x22222222, 0x222222F2, - 0xF2222220, 0x22222222, 0x22F22222, 0x00000222, - 0x99000000, 0x9B9B99BB, 0x9BB99999, 0x9999B9B9, - 0x9B99BB90, 0x9BBBBB9B, 0x9B9B9BB9, 0x00000999, - 0x88000000, 0x8A8A88AA, 0x8AA88888, 0x8888A8A8, - 0x8A88AA80, 0x8AAAAA8A, 0x8A8A8AA8, 0x00000888, - 0x88888000, 0x8A8A88AA, 0x8AA88888, 0x8888A8A8, - 0x8A88AA80, 0x8AAAAA8A, 0x8A8A8AA8, 0x00000888, - 0x88000000, 0x8A8A88AA, 0x8AA88888, 0x8888A8A8, - 0x8A88AA80, 0x8AAAAA8A, 0x8A8A8AA8, 0x00AAA888, - 0x88A88A00, 0x8A8A88AA, 0x8AA88888, 0x8888A8A8, - 0x8A88AA88, 0x8AAAAA8A, 0x8A8A8AA8, 0x00000888, - 0x88000000, 0x8A8A88AA, 0x8AA88888, 0x8888A8A8, - 0x8A88AA88, 0x8AAAAA8A, 0x8A8A8AA8, 0x08AAA888, - 0x11000000, 0x1111A111, 0x11111111, 0x111111A1, - 0xA1111110, 0x11111111, 0x11C11111, 0x00000111, - 0x11000000, 0x1111A111, 0x11111111, 0x111111A1, - 0xA1111110, 0x11111111, 0x11C11111, 0x00000111, - 0x88000000, 0x8A8A88AA, 0x8AA88888, 0x8888A8A8, - 0x8A88AA80, 0x8AAAAA8A, 0x8A8A8AA8, 0x00000888, - 0x88000000, 0x8A8A88AA, 0x8AA88888, 0x8888A8A8, - 0x8A88AA80, 0x8AAAAA8A, 0x8A8A8AA8, 0x00000888, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -/* static tables, PHY revision >= 3 */ -static const u32 b43_ntab_framestruct_r3[] = { - 0x08004a04, 0x00100000, 0x01000a05, 0x00100020, - 0x09804506, 0x00100030, 0x09804507, 0x00100030, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x08004a0c, 0x00100004, 0x01000a0d, 0x00100024, - 0x0980450e, 0x00100034, 0x0980450f, 0x00100034, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000a04, 0x00100000, 0x11008a05, 0x00100020, - 0x1980c506, 0x00100030, 0x21810506, 0x00100030, - 0x21810506, 0x00100030, 0x01800504, 0x00100030, - 0x11808505, 0x00100030, 0x29814507, 0x01100030, - 0x00000a04, 0x00100000, 0x11008a05, 0x00100020, - 0x21810506, 0x00100030, 0x21810506, 0x00100030, - 0x29814507, 0x01100030, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000a0c, 0x00100008, 0x11008a0d, 0x00100028, - 0x1980c50e, 0x00100038, 0x2181050e, 0x00100038, - 0x2181050e, 0x00100038, 0x0180050c, 0x00100038, - 0x1180850d, 0x00100038, 0x2981450f, 0x01100038, - 0x00000a0c, 0x00100008, 0x11008a0d, 0x00100028, - 0x2181050e, 0x00100038, 0x2181050e, 0x00100038, - 0x2981450f, 0x01100038, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x08004a04, 0x00100000, 0x01000a05, 0x00100020, - 0x1980c506, 0x00100030, 0x1980c506, 0x00100030, - 0x11808504, 0x00100030, 0x3981ca05, 0x00100030, - 0x29814507, 0x01100030, 0x00000000, 0x00000000, - 0x10008a04, 0x00100000, 0x3981ca05, 0x00100030, - 0x1980c506, 0x00100030, 0x29814507, 0x01100030, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x08004a0c, 0x00100008, 0x01000a0d, 0x00100028, - 0x1980c50e, 0x00100038, 0x1980c50e, 0x00100038, - 0x1180850c, 0x00100038, 0x3981ca0d, 0x00100038, - 0x2981450f, 0x01100038, 0x00000000, 0x00000000, - 0x10008a0c, 0x00100008, 0x3981ca0d, 0x00100038, - 0x1980c50e, 0x00100038, 0x2981450f, 0x01100038, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x40021404, 0x00100000, 0x02001405, 0x00100040, - 0x0b004a06, 0x01900060, 0x13008a06, 0x01900060, - 0x13008a06, 0x01900060, 0x43020a04, 0x00100060, - 0x1b00ca05, 0x00100060, 0x23010a07, 0x01500060, - 0x40021404, 0x00100000, 0x1a00d405, 0x00100040, - 0x13008a06, 0x01900060, 0x13008a06, 0x01900060, - 0x23010a07, 0x01500060, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x4002140c, 0x00100010, 0x0200140d, 0x00100050, - 0x0b004a0e, 0x01900070, 0x13008a0e, 0x01900070, - 0x13008a0e, 0x01900070, 0x43020a0c, 0x00100070, - 0x1b00ca0d, 0x00100070, 0x23010a0f, 0x01500070, - 0x4002140c, 0x00100010, 0x1a00d40d, 0x00100050, - 0x13008a0e, 0x01900070, 0x13008a0e, 0x01900070, - 0x23010a0f, 0x01500070, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x50029404, 0x00100000, 0x32019405, 0x00100040, - 0x0b004a06, 0x01900060, 0x0b004a06, 0x01900060, - 0x5b02ca04, 0x00100060, 0x3b01d405, 0x00100060, - 0x23010a07, 0x01500060, 0x00000000, 0x00000000, - 0x5802d404, 0x00100000, 0x3b01d405, 0x00100060, - 0x0b004a06, 0x01900060, 0x23010a07, 0x01500060, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x5002940c, 0x00100010, 0x3201940d, 0x00100050, - 0x0b004a0e, 0x01900070, 0x0b004a0e, 0x01900070, - 0x5b02ca0c, 0x00100070, 0x3b01d40d, 0x00100070, - 0x23010a0f, 0x01500070, 0x00000000, 0x00000000, - 0x5802d40c, 0x00100010, 0x3b01d40d, 0x00100070, - 0x0b004a0e, 0x01900070, 0x23010a0f, 0x01500070, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x40021404, 0x000f4800, 0x62031405, 0x00100040, - 0x53028a06, 0x01900060, 0x53028a07, 0x01900060, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x4002140c, 0x000f4808, 0x6203140d, 0x00100048, - 0x53028a0e, 0x01900068, 0x53028a0f, 0x01900068, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000a0c, 0x00100004, 0x11008a0d, 0x00100024, - 0x1980c50e, 0x00100034, 0x2181050e, 0x00100034, - 0x2181050e, 0x00100034, 0x0180050c, 0x00100038, - 0x1180850d, 0x00100038, 0x1181850d, 0x00100038, - 0x2981450f, 0x01100038, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000a0c, 0x00100008, 0x11008a0d, 0x00100028, - 0x2181050e, 0x00100038, 0x2181050e, 0x00100038, - 0x1181850d, 0x00100038, 0x2981450f, 0x01100038, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x08004a04, 0x00100000, 0x01000a05, 0x00100020, - 0x0180c506, 0x00100030, 0x0180c506, 0x00100030, - 0x2180c50c, 0x00100030, 0x49820a0d, 0x0016a130, - 0x41824a0d, 0x0016a130, 0x2981450f, 0x01100030, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x2000ca0c, 0x00100000, 0x49820a0d, 0x0016a130, - 0x1980c50e, 0x00100030, 0x41824a0d, 0x0016a130, - 0x2981450f, 0x01100030, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x4002140c, 0x00100008, 0x0200140d, 0x00100048, - 0x0b004a0e, 0x01900068, 0x13008a0e, 0x01900068, - 0x13008a0e, 0x01900068, 0x43020a0c, 0x00100070, - 0x1b00ca0d, 0x00100070, 0x1b014a0d, 0x00100070, - 0x23010a0f, 0x01500070, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x4002140c, 0x00100010, 0x1a00d40d, 0x00100050, - 0x13008a0e, 0x01900070, 0x13008a0e, 0x01900070, - 0x1b014a0d, 0x00100070, 0x23010a0f, 0x01500070, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x50029404, 0x00100000, 0x32019405, 0x00100040, - 0x03004a06, 0x01900060, 0x03004a06, 0x01900060, - 0x6b030a0c, 0x00100060, 0x4b02140d, 0x0016a160, - 0x4302540d, 0x0016a160, 0x23010a0f, 0x01500060, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x6b03140c, 0x00100060, 0x4b02140d, 0x0016a160, - 0x0b004a0e, 0x01900060, 0x4302540d, 0x0016a160, - 0x23010a0f, 0x01500060, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x40021404, 0x00100000, 0x1a00d405, 0x00100040, - 0x53028a06, 0x01900060, 0x5b02ca06, 0x01900060, - 0x5b02ca06, 0x01900060, 0x43020a04, 0x00100060, - 0x1b00ca05, 0x00100060, 0x53028a07, 0x0190c060, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x4002140c, 0x00100010, 0x1a00d40d, 0x00100050, - 0x53028a0e, 0x01900070, 0x5b02ca0e, 0x01900070, - 0x5b02ca0e, 0x01900070, 0x43020a0c, 0x00100070, - 0x1b00ca0d, 0x00100070, 0x53028a0f, 0x0190c070, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x40021404, 0x00100000, 0x1a00d405, 0x00100040, - 0x5b02ca06, 0x01900060, 0x5b02ca06, 0x01900060, - 0x53028a07, 0x0190c060, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x4002140c, 0x00100010, 0x1a00d40d, 0x00100050, - 0x5b02ca0e, 0x01900070, 0x5b02ca0e, 0x01900070, - 0x53028a0f, 0x0190c070, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static const u16 b43_ntab_pilot_r3[] = { - 0xff08, 0xff08, 0xff08, 0xff08, 0xff08, 0xff08, - 0xff08, 0xff08, 0x80d5, 0x80d5, 0x80d5, 0x80d5, - 0x80d5, 0x80d5, 0x80d5, 0x80d5, 0xff0a, 0xff82, - 0xffa0, 0xff28, 0xffff, 0xffff, 0xffff, 0xffff, - 0xff82, 0xffa0, 0xff28, 0xff0a, 0xffff, 0xffff, - 0xffff, 0xffff, 0xf83f, 0xfa1f, 0xfa97, 0xfab5, - 0xf2bd, 0xf0bf, 0xffff, 0xffff, 0xf017, 0xf815, - 0xf215, 0xf095, 0xf035, 0xf01d, 0xffff, 0xffff, - 0xff08, 0xff02, 0xff80, 0xff20, 0xff08, 0xff02, - 0xff80, 0xff20, 0xf01f, 0xf817, 0xfa15, 0xf295, - 0xf0b5, 0xf03d, 0xffff, 0xffff, 0xf82a, 0xfa0a, - 0xfa82, 0xfaa0, 0xf2a8, 0xf0aa, 0xffff, 0xffff, - 0xf002, 0xf800, 0xf200, 0xf080, 0xf020, 0xf008, - 0xffff, 0xffff, 0xf00a, 0xf802, 0xfa00, 0xf280, - 0xf0a0, 0xf028, 0xffff, 0xffff, -}; - -static const u32 b43_ntab_tmap_r3[] = { - 0x8a88aa80, 0x8aaaaa8a, 0x8a8a8aa8, 0x00000888, - 0x88000000, 0x8a8a88aa, 0x8aa88888, 0x8888a8a8, - 0xf1111110, 0x11111111, 0x11f11111, 0x00000111, - 0x11000000, 0x1111f111, 0x11111111, 0x111111f1, - 0x8a88aa80, 0x8aaaaa8a, 0x8a8a8aa8, 0x000aa888, - 0x88880000, 0x8a8a88aa, 0x8aa88888, 0x8888a8a8, - 0xa1111110, 0x11111111, 0x11c11111, 0x00000111, - 0x11000000, 0x1111a111, 0x11111111, 0x111111a1, - 0xa2222220, 0x22222222, 0x22c22222, 0x00000222, - 0x22000000, 0x2222a222, 0x22222222, 0x222222a2, - 0xf1111110, 0x11111111, 0x11f11111, 0x00011111, - 0x11110000, 0x1111f111, 0x11111111, 0x111111f1, - 0xa8aa88a0, 0xa88888a8, 0xa8a8a88a, 0x00088aaa, - 0xaaaa0000, 0xa8a8aa88, 0xa88aaaaa, 0xaaaa8a8a, - 0xaaa8aaa0, 0x8aaa8aaa, 0xaa8a8a8a, 0x000aaa88, - 0x8aaa0000, 0xaaa8a888, 0x8aa88a8a, 0x8a88a888, - 0x08080a00, 0x0a08080a, 0x080a0a08, 0x00080808, - 0x080a0000, 0x080a0808, 0x080a0808, 0x0a0a0a08, - 0xa0a0a0a0, 0x80a0a080, 0x8080a0a0, 0x00008080, - 0x80a00000, 0x80a080a0, 0xa080a0a0, 0x8080a0a0, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x99999000, 0x9b9b99bb, 0x9bb99999, 0x9999b9b9, - 0x9b99bb90, 0x9bbbbb9b, 0x9b9b9bb9, 0x00000999, - 0x88000000, 0x8a8a88aa, 0x8aa88888, 0x8888a8a8, - 0x8a88aa80, 0x8aaaaa8a, 0x8a8a8aa8, 0x00aaa888, - 0x22000000, 0x2222b222, 0x22222222, 0x222222b2, - 0xb2222220, 0x22222222, 0x22d22222, 0x00000222, - 0x11000000, 0x1111a111, 0x11111111, 0x111111a1, - 0xa1111110, 0x11111111, 0x11c11111, 0x00000111, - 0x33000000, 0x3333b333, 0x33333333, 0x333333b3, - 0xb3333330, 0x33333333, 0x33d33333, 0x00000333, - 0x22000000, 0x2222a222, 0x22222222, 0x222222a2, - 0xa2222220, 0x22222222, 0x22c22222, 0x00000222, - 0x99b99b00, 0x9b9b99bb, 0x9bb99999, 0x9999b9b9, - 0x9b99bb99, 0x9bbbbb9b, 0x9b9b9bb9, 0x00000999, - 0x88000000, 0x8a8a88aa, 0x8aa88888, 0x8888a8a8, - 0x8a88aa88, 0x8aaaaa8a, 0x8a8a8aa8, 0x08aaa888, - 0x22222200, 0x2222f222, 0x22222222, 0x222222f2, - 0x22222222, 0x22222222, 0x22f22222, 0x00000222, - 0x11000000, 0x1111f111, 0x11111111, 0x11111111, - 0xf1111111, 0x11111111, 0x11f11111, 0x01111111, - 0xbb9bb900, 0xb9b9bb99, 0xb99bbbbb, 0xbbbb9b9b, - 0xb9bb99bb, 0xb99999b9, 0xb9b9b99b, 0x00000bbb, - 0xaa000000, 0xa8a8aa88, 0xa88aaaaa, 0xaaaa8a8a, - 0xa8aa88aa, 0xa88888a8, 0xa8a8a88a, 0x0a888aaa, - 0xaa000000, 0xa8a8aa88, 0xa88aaaaa, 0xaaaa8a8a, - 0xa8aa88a0, 0xa88888a8, 0xa8a8a88a, 0x00000aaa, - 0x88000000, 0x8a8a88aa, 0x8aa88888, 0x8888a8a8, - 0x8a88aa80, 0x8aaaaa8a, 0x8a8a8aa8, 0x00000888, - 0xbbbbbb00, 0x999bbbbb, 0x9bb99b9b, 0xb9b9b9bb, - 0xb9b99bbb, 0xb9b9b9bb, 0xb9bb9b99, 0x00000999, - 0x8a000000, 0xaa88a888, 0xa88888aa, 0xa88a8a88, - 0xa88aa88a, 0x88a8aaaa, 0xa8aa8aaa, 0x0888a88a, - 0x0b0b0b00, 0x090b0b0b, 0x0b090b0b, 0x0909090b, - 0x09090b0b, 0x09090b0b, 0x09090b09, 0x00000909, - 0x0a000000, 0x0a080808, 0x080a080a, 0x080a0a08, - 0x080a080a, 0x0808080a, 0x0a0a0a08, 0x0808080a, - 0xb0b0b000, 0x9090b0b0, 0x90b09090, 0xb0b0b090, - 0xb0b090b0, 0x90b0b0b0, 0xb0b09090, 0x00000090, - 0x80000000, 0xa080a080, 0xa08080a0, 0xa0808080, - 0xa080a080, 0x80a0a0a0, 0xa0a080a0, 0x00a0a0a0, - 0x22000000, 0x2222f222, 0x22222222, 0x222222f2, - 0xf2222220, 0x22222222, 0x22f22222, 0x00000222, - 0x11000000, 0x1111f111, 0x11111111, 0x111111f1, - 0xf1111110, 0x11111111, 0x11f11111, 0x00000111, - 0x33000000, 0x3333f333, 0x33333333, 0x333333f3, - 0xf3333330, 0x33333333, 0x33f33333, 0x00000333, - 0x22000000, 0x2222f222, 0x22222222, 0x222222f2, - 0xf2222220, 0x22222222, 0x22f22222, 0x00000222, - 0x99000000, 0x9b9b99bb, 0x9bb99999, 0x9999b9b9, - 0x9b99bb90, 0x9bbbbb9b, 0x9b9b9bb9, 0x00000999, - 0x88000000, 0x8a8a88aa, 0x8aa88888, 0x8888a8a8, - 0x8a88aa80, 0x8aaaaa8a, 0x8a8a8aa8, 0x00000888, - 0x88888000, 0x8a8a88aa, 0x8aa88888, 0x8888a8a8, - 0x8a88aa80, 0x8aaaaa8a, 0x8a8a8aa8, 0x00000888, - 0x88000000, 0x8a8a88aa, 0x8aa88888, 0x8888a8a8, - 0x8a88aa80, 0x8aaaaa8a, 0x8a8a8aa8, 0x00aaa888, - 0x88a88a00, 0x8a8a88aa, 0x8aa88888, 0x8888a8a8, - 0x8a88aa88, 0x8aaaaa8a, 0x8a8a8aa8, 0x00000888, - 0x88000000, 0x8a8a88aa, 0x8aa88888, 0x8888a8a8, - 0x8a88aa88, 0x8aaaaa8a, 0x8a8a8aa8, 0x08aaa888, - 0x11000000, 0x1111a111, 0x11111111, 0x111111a1, - 0xa1111110, 0x11111111, 0x11c11111, 0x00000111, - 0x11000000, 0x1111a111, 0x11111111, 0x111111a1, - 0xa1111110, 0x11111111, 0x11c11111, 0x00000111, - 0x88000000, 0x8a8a88aa, 0x8aa88888, 0x8888a8a8, - 0x8a88aa80, 0x8aaaaa8a, 0x8a8a8aa8, 0x00000888, - 0x88000000, 0x8a8a88aa, 0x8aa88888, 0x8888a8a8, - 0x8a88aa80, 0x8aaaaa8a, 0x8a8a8aa8, 0x00000888, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static const u32 b43_ntab_intlevel_r3[] = { - 0x00802070, 0x0671188d, 0x0a60192c, 0x0a300e46, - 0x00c1188d, 0x080024d2, 0x00000070, -}; - -static const u32 b43_ntab_tdtrn_r3[] = { - 0x061c061c, 0x0050ee68, 0xf592fe36, 0xfe5212f6, - 0x00000c38, 0xfe5212f6, 0xf592fe36, 0x0050ee68, - 0x061c061c, 0xee680050, 0xfe36f592, 0x12f6fe52, - 0x0c380000, 0x12f6fe52, 0xfe36f592, 0xee680050, - 0x061c061c, 0x0050ee68, 0xf592fe36, 0xfe5212f6, - 0x00000c38, 0xfe5212f6, 0xf592fe36, 0x0050ee68, - 0x061c061c, 0xee680050, 0xfe36f592, 0x12f6fe52, - 0x0c380000, 0x12f6fe52, 0xfe36f592, 0xee680050, - 0x05e305e3, 0x004def0c, 0xf5f3fe47, 0xfe611246, - 0x00000bc7, 0xfe611246, 0xf5f3fe47, 0x004def0c, - 0x05e305e3, 0xef0c004d, 0xfe47f5f3, 0x1246fe61, - 0x0bc70000, 0x1246fe61, 0xfe47f5f3, 0xef0c004d, - 0x05e305e3, 0x004def0c, 0xf5f3fe47, 0xfe611246, - 0x00000bc7, 0xfe611246, 0xf5f3fe47, 0x004def0c, - 0x05e305e3, 0xef0c004d, 0xfe47f5f3, 0x1246fe61, - 0x0bc70000, 0x1246fe61, 0xfe47f5f3, 0xef0c004d, - 0xfa58fa58, 0xf895043b, 0xff4c09c0, 0xfbc6ffa8, - 0xfb84f384, 0x0798f6f9, 0x05760122, 0x058409f6, - 0x0b500000, 0x05b7f542, 0x08860432, 0x06ddfee7, - 0xfb84f384, 0xf9d90664, 0xf7e8025c, 0x00fff7bd, - 0x05a805a8, 0xf7bd00ff, 0x025cf7e8, 0x0664f9d9, - 0xf384fb84, 0xfee706dd, 0x04320886, 0xf54205b7, - 0x00000b50, 0x09f60584, 0x01220576, 0xf6f90798, - 0xf384fb84, 0xffa8fbc6, 0x09c0ff4c, 0x043bf895, - 0x02d402d4, 0x07de0270, 0xfc96079c, 0xf90afe94, - 0xfe00ff2c, 0x02d4065d, 0x092a0096, 0x0014fbb8, - 0xfd2cfd2c, 0x076afb3c, 0x0096f752, 0xf991fd87, - 0xfb2c0200, 0xfeb8f960, 0x08e0fc96, 0x049802a8, - 0xfd2cfd2c, 0x02a80498, 0xfc9608e0, 0xf960feb8, - 0x0200fb2c, 0xfd87f991, 0xf7520096, 0xfb3c076a, - 0xfd2cfd2c, 0xfbb80014, 0x0096092a, 0x065d02d4, - 0xff2cfe00, 0xfe94f90a, 0x079cfc96, 0x027007de, - 0x02d402d4, 0x027007de, 0x079cfc96, 0xfe94f90a, - 0xff2cfe00, 0x065d02d4, 0x0096092a, 0xfbb80014, - 0xfd2cfd2c, 0xfb3c076a, 0xf7520096, 0xfd87f991, - 0x0200fb2c, 0xf960feb8, 0xfc9608e0, 0x02a80498, - 0xfd2cfd2c, 0x049802a8, 0x08e0fc96, 0xfeb8f960, - 0xfb2c0200, 0xf991fd87, 0x0096f752, 0x076afb3c, - 0xfd2cfd2c, 0x0014fbb8, 0x092a0096, 0x02d4065d, - 0xfe00ff2c, 0xf90afe94, 0xfc96079c, 0x07de0270, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x062a0000, 0xfefa0759, 0x08b80908, 0xf396fc2d, - 0xf9d6045c, 0xfc4ef608, 0xf748f596, 0x07b207bf, - 0x062a062a, 0xf84ef841, 0xf748f596, 0x03b209f8, - 0xf9d6045c, 0x0c6a03d3, 0x08b80908, 0x0106f8a7, - 0x062a0000, 0xfefaf8a7, 0x08b8f6f8, 0xf39603d3, - 0xf9d6fba4, 0xfc4e09f8, 0xf7480a6a, 0x07b2f841, - 0x062af9d6, 0xf84e07bf, 0xf7480a6a, 0x03b2f608, - 0xf9d6fba4, 0x0c6afc2d, 0x08b8f6f8, 0x01060759, - 0x062a0000, 0xfefa0759, 0x08b80908, 0xf396fc2d, - 0xf9d6045c, 0xfc4ef608, 0xf748f596, 0x07b207bf, - 0x062a062a, 0xf84ef841, 0xf748f596, 0x03b209f8, - 0xf9d6045c, 0x0c6a03d3, 0x08b80908, 0x0106f8a7, - 0x062a0000, 0xfefaf8a7, 0x08b8f6f8, 0xf39603d3, - 0xf9d6fba4, 0xfc4e09f8, 0xf7480a6a, 0x07b2f841, - 0x062af9d6, 0xf84e07bf, 0xf7480a6a, 0x03b2f608, - 0xf9d6fba4, 0x0c6afc2d, 0x08b8f6f8, 0x01060759, - 0x061c061c, 0xff30009d, 0xffb21141, 0xfd87fb54, - 0xf65dfe59, 0x02eef99e, 0x0166f03c, 0xfff809b6, - 0x000008a4, 0x000af42b, 0x00eff577, 0xfa840bf2, - 0xfc02ff51, 0x08260f67, 0xfff0036f, 0x0842f9c3, - 0x00000000, 0x063df7be, 0xfc910010, 0xf099f7da, - 0x00af03fe, 0xf40e057c, 0x0a89ff11, 0x0bd5fff6, - 0xf75c0000, 0xf64a0008, 0x0fc4fe9a, 0x0662fd12, - 0x01a709a3, 0x04ac0279, 0xeebf004e, 0xff6300d0, - 0xf9e4f9e4, 0x00d0ff63, 0x004eeebf, 0x027904ac, - 0x09a301a7, 0xfd120662, 0xfe9a0fc4, 0x0008f64a, - 0x0000f75c, 0xfff60bd5, 0xff110a89, 0x057cf40e, - 0x03fe00af, 0xf7daf099, 0x0010fc91, 0xf7be063d, - 0x00000000, 0xf9c30842, 0x036ffff0, 0x0f670826, - 0xff51fc02, 0x0bf2fa84, 0xf57700ef, 0xf42b000a, - 0x08a40000, 0x09b6fff8, 0xf03c0166, 0xf99e02ee, - 0xfe59f65d, 0xfb54fd87, 0x1141ffb2, 0x009dff30, - 0x05e30000, 0xff060705, 0x085408a0, 0xf425fc59, - 0xfa1d042a, 0xfc78f67a, 0xf7acf60e, 0x075a0766, - 0x05e305e3, 0xf8a6f89a, 0xf7acf60e, 0x03880986, - 0xfa1d042a, 0x0bdb03a7, 0x085408a0, 0x00faf8fb, - 0x05e30000, 0xff06f8fb, 0x0854f760, 0xf42503a7, - 0xfa1dfbd6, 0xfc780986, 0xf7ac09f2, 0x075af89a, - 0x05e3fa1d, 0xf8a60766, 0xf7ac09f2, 0x0388f67a, - 0xfa1dfbd6, 0x0bdbfc59, 0x0854f760, 0x00fa0705, - 0x05e30000, 0xff060705, 0x085408a0, 0xf425fc59, - 0xfa1d042a, 0xfc78f67a, 0xf7acf60e, 0x075a0766, - 0x05e305e3, 0xf8a6f89a, 0xf7acf60e, 0x03880986, - 0xfa1d042a, 0x0bdb03a7, 0x085408a0, 0x00faf8fb, - 0x05e30000, 0xff06f8fb, 0x0854f760, 0xf42503a7, - 0xfa1dfbd6, 0xfc780986, 0xf7ac09f2, 0x075af89a, - 0x05e3fa1d, 0xf8a60766, 0xf7ac09f2, 0x0388f67a, - 0xfa1dfbd6, 0x0bdbfc59, 0x0854f760, 0x00fa0705, - 0xfa58fa58, 0xf8f0fe00, 0x0448073d, 0xfdc9fe46, - 0xf9910258, 0x089d0407, 0xfd5cf71a, 0x02affde0, - 0x083e0496, 0xff5a0740, 0xff7afd97, 0x00fe01f1, - 0x0009082e, 0xfa94ff75, 0xfecdf8ea, 0xffb0f693, - 0xfd2cfa58, 0x0433ff16, 0xfba405dd, 0xfa610341, - 0x06a606cb, 0x0039fd2d, 0x0677fa97, 0x01fa05e0, - 0xf896003e, 0x075a068b, 0x012cfc3e, 0xfa23f98d, - 0xfc7cfd43, 0xff90fc0d, 0x01c10982, 0x00c601d6, - 0xfd2cfd2c, 0x01d600c6, 0x098201c1, 0xfc0dff90, - 0xfd43fc7c, 0xf98dfa23, 0xfc3e012c, 0x068b075a, - 0x003ef896, 0x05e001fa, 0xfa970677, 0xfd2d0039, - 0x06cb06a6, 0x0341fa61, 0x05ddfba4, 0xff160433, - 0xfa58fd2c, 0xf693ffb0, 0xf8eafecd, 0xff75fa94, - 0x082e0009, 0x01f100fe, 0xfd97ff7a, 0x0740ff5a, - 0x0496083e, 0xfde002af, 0xf71afd5c, 0x0407089d, - 0x0258f991, 0xfe46fdc9, 0x073d0448, 0xfe00f8f0, - 0xfd2cfd2c, 0xfce00500, 0xfc09fddc, 0xfe680157, - 0x04c70571, 0xfc3aff21, 0xfcd70228, 0x056d0277, - 0x0200fe00, 0x0022f927, 0xfe3c032b, 0xfc44ff3c, - 0x03e9fbdb, 0x04570313, 0x04c9ff5c, 0x000d03b8, - 0xfa580000, 0xfbe900d2, 0xf9d0fe0b, 0x0125fdf9, - 0x042501bf, 0x0328fa2b, 0xffa902f0, 0xfa250157, - 0x0200fe00, 0x03740438, 0xff0405fd, 0x030cfe52, - 0x0037fb39, 0xff6904c5, 0x04f8fd23, 0xfd31fc1b, - 0xfd2cfd2c, 0xfc1bfd31, 0xfd2304f8, 0x04c5ff69, - 0xfb390037, 0xfe52030c, 0x05fdff04, 0x04380374, - 0xfe000200, 0x0157fa25, 0x02f0ffa9, 0xfa2b0328, - 0x01bf0425, 0xfdf90125, 0xfe0bf9d0, 0x00d2fbe9, - 0x0000fa58, 0x03b8000d, 0xff5c04c9, 0x03130457, - 0xfbdb03e9, 0xff3cfc44, 0x032bfe3c, 0xf9270022, - 0xfe000200, 0x0277056d, 0x0228fcd7, 0xff21fc3a, - 0x057104c7, 0x0157fe68, 0xfddcfc09, 0x0500fce0, - 0xfd2cfd2c, 0x0500fce0, 0xfddcfc09, 0x0157fe68, - 0x057104c7, 0xff21fc3a, 0x0228fcd7, 0x0277056d, - 0xfe000200, 0xf9270022, 0x032bfe3c, 0xff3cfc44, - 0xfbdb03e9, 0x03130457, 0xff5c04c9, 0x03b8000d, - 0x0000fa58, 0x00d2fbe9, 0xfe0bf9d0, 0xfdf90125, - 0x01bf0425, 0xfa2b0328, 0x02f0ffa9, 0x0157fa25, - 0xfe000200, 0x04380374, 0x05fdff04, 0xfe52030c, - 0xfb390037, 0x04c5ff69, 0xfd2304f8, 0xfc1bfd31, - 0xfd2cfd2c, 0xfd31fc1b, 0x04f8fd23, 0xff6904c5, - 0x0037fb39, 0x030cfe52, 0xff0405fd, 0x03740438, - 0x0200fe00, 0xfa250157, 0xffa902f0, 0x0328fa2b, - 0x042501bf, 0x0125fdf9, 0xf9d0fe0b, 0xfbe900d2, - 0xfa580000, 0x000d03b8, 0x04c9ff5c, 0x04570313, - 0x03e9fbdb, 0xfc44ff3c, 0xfe3c032b, 0x0022f927, - 0x0200fe00, 0x056d0277, 0xfcd70228, 0xfc3aff21, - 0x04c70571, 0xfe680157, 0xfc09fddc, 0xfce00500, - 0x05a80000, 0xff1006be, 0x0800084a, 0xf49cfc7e, - 0xfa580400, 0xfc9cf6da, 0xf800f672, 0x0710071c, - 0x05a805a8, 0xf8f0f8e4, 0xf800f672, 0x03640926, - 0xfa580400, 0x0b640382, 0x0800084a, 0x00f0f942, - 0x05a80000, 0xff10f942, 0x0800f7b6, 0xf49c0382, - 0xfa58fc00, 0xfc9c0926, 0xf800098e, 0x0710f8e4, - 0x05a8fa58, 0xf8f0071c, 0xf800098e, 0x0364f6da, - 0xfa58fc00, 0x0b64fc7e, 0x0800f7b6, 0x00f006be, - 0x05a80000, 0xff1006be, 0x0800084a, 0xf49cfc7e, - 0xfa580400, 0xfc9cf6da, 0xf800f672, 0x0710071c, - 0x05a805a8, 0xf8f0f8e4, 0xf800f672, 0x03640926, - 0xfa580400, 0x0b640382, 0x0800084a, 0x00f0f942, - 0x05a80000, 0xff10f942, 0x0800f7b6, 0xf49c0382, - 0xfa58fc00, 0xfc9c0926, 0xf800098e, 0x0710f8e4, - 0x05a8fa58, 0xf8f0071c, 0xf800098e, 0x0364f6da, - 0xfa58fc00, 0x0b64fc7e, 0x0800f7b6, 0x00f006be, -}; - -static const u32 b43_ntab_noisevar0_r3[] = { - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, -}; - -static const u32 b43_ntab_noisevar1_r3[] = { - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, - 0x02110211, 0x0000014d, 0x02110211, 0x0000014d, -}; - -static const u16 b43_ntab_mcs_r3[] = { - 0x0000, 0x0008, 0x000a, 0x0010, 0x0012, 0x0019, - 0x001a, 0x001c, 0x0080, 0x0088, 0x008a, 0x0090, - 0x0092, 0x0099, 0x009a, 0x009c, 0x0100, 0x0108, - 0x010a, 0x0110, 0x0112, 0x0119, 0x011a, 0x011c, - 0x0180, 0x0188, 0x018a, 0x0190, 0x0192, 0x0199, - 0x019a, 0x019c, 0x0000, 0x0098, 0x00a0, 0x00a8, - 0x009a, 0x00a2, 0x00aa, 0x0120, 0x0128, 0x0128, - 0x0130, 0x0138, 0x0138, 0x0140, 0x0122, 0x012a, - 0x012a, 0x0132, 0x013a, 0x013a, 0x0142, 0x01a8, - 0x01b0, 0x01b8, 0x01b0, 0x01b8, 0x01c0, 0x01c8, - 0x01c0, 0x01c8, 0x01d0, 0x01d0, 0x01d8, 0x01aa, - 0x01b2, 0x01ba, 0x01b2, 0x01ba, 0x01c2, 0x01ca, - 0x01c2, 0x01ca, 0x01d2, 0x01d2, 0x01da, 0x0001, - 0x0002, 0x0004, 0x0009, 0x000c, 0x0011, 0x0014, - 0x0018, 0x0020, 0x0021, 0x0022, 0x0024, 0x0081, - 0x0082, 0x0084, 0x0089, 0x008c, 0x0091, 0x0094, - 0x0098, 0x00a0, 0x00a1, 0x00a2, 0x00a4, 0x0007, - 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, - 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, - 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, - 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, - 0x0007, 0x0007, -}; - -static const u32 b43_ntab_tdi20a0_r3[] = { - 0x00091226, 0x000a1429, 0x000b56ad, 0x000c58b0, - 0x000d5ab3, 0x000e9cb6, 0x000f9eba, 0x0000c13d, - 0x00020301, 0x00030504, 0x00040708, 0x0005090b, - 0x00064b8e, 0x00095291, 0x000a5494, 0x000b9718, - 0x000c9927, 0x000d9b2a, 0x000edd2e, 0x000fdf31, - 0x000101b4, 0x000243b7, 0x000345bb, 0x000447be, - 0x00058982, 0x00068c05, 0x00099309, 0x000a950c, - 0x000bd78f, 0x000cd992, 0x000ddb96, 0x000f1d99, - 0x00005fa8, 0x0001422c, 0x0002842f, 0x00038632, - 0x00048835, 0x0005ca38, 0x0006ccbc, 0x0009d3bf, - 0x000b1603, 0x000c1806, 0x000d1a0a, 0x000e1c0d, - 0x000f5e10, 0x00008093, 0x00018297, 0x0002c49a, - 0x0003c680, 0x0004c880, 0x00060b00, 0x00070d00, - 0x00000000, 0x00000000, 0x00000000, -}; - -static const u32 b43_ntab_tdi20a1_r3[] = { - 0x00014b26, 0x00028d29, 0x000393ad, 0x00049630, - 0x0005d833, 0x0006da36, 0x00099c3a, 0x000a9e3d, - 0x000bc081, 0x000cc284, 0x000dc488, 0x000f068b, - 0x0000488e, 0x00018b91, 0x0002d214, 0x0003d418, - 0x0004d6a7, 0x000618aa, 0x00071aae, 0x0009dcb1, - 0x000b1eb4, 0x000c0137, 0x000d033b, 0x000e053e, - 0x000f4702, 0x00008905, 0x00020c09, 0x0003128c, - 0x0004148f, 0x00051712, 0x00065916, 0x00091b19, - 0x000a1d28, 0x000b5f2c, 0x000c41af, 0x000d43b2, - 0x000e85b5, 0x000f87b8, 0x0000c9bc, 0x00024cbf, - 0x00035303, 0x00045506, 0x0005978a, 0x0006998d, - 0x00095b90, 0x000a5d93, 0x000b9f97, 0x000c821a, - 0x000d8400, 0x000ec600, 0x000fc800, 0x00010a00, - 0x00000000, 0x00000000, 0x00000000, -}; - -static const u32 b43_ntab_tdi40a0_r3[] = { - 0x0011a346, 0x00136ccf, 0x0014f5d9, 0x001641e2, - 0x0017cb6b, 0x00195475, 0x001b2383, 0x001cad0c, - 0x001e7616, 0x0000821f, 0x00020ba8, 0x0003d4b2, - 0x00056447, 0x00072dd0, 0x0008b6da, 0x000a02e3, - 0x000b8c6c, 0x000d15f6, 0x0011e484, 0x0013ae0d, - 0x00153717, 0x00168320, 0x00180ca9, 0x00199633, - 0x001b6548, 0x001ceed1, 0x001eb7db, 0x0000c3e4, - 0x00024d6d, 0x000416f7, 0x0005a585, 0x00076f0f, - 0x0008f818, 0x000a4421, 0x000bcdab, 0x000d9734, - 0x00122649, 0x0013efd2, 0x001578dc, 0x0016c4e5, - 0x00184e6e, 0x001a17f8, 0x001ba686, 0x001d3010, - 0x001ef999, 0x00010522, 0x00028eac, 0x00045835, - 0x0005e74a, 0x0007b0d3, 0x00093a5d, 0x000a85e6, - 0x000c0f6f, 0x000dd8f9, 0x00126787, 0x00143111, - 0x0015ba9a, 0x00170623, 0x00188fad, 0x001a5936, - 0x001be84b, 0x001db1d4, 0x001f3b5e, 0x000146e7, - 0x00031070, 0x000499fa, 0x00062888, 0x0007f212, - 0x00097b9b, 0x000ac7a4, 0x000c50ae, 0x000e1a37, - 0x0012a94c, 0x001472d5, 0x0015fc5f, 0x00174868, - 0x0018d171, 0x001a9afb, 0x001c2989, 0x001df313, - 0x001f7c9c, 0x000188a5, 0x000351af, 0x0004db38, - 0x0006aa4d, 0x000833d7, 0x0009bd60, 0x000b0969, - 0x000c9273, 0x000e5bfc, 0x00132a8a, 0x0014b414, - 0x00163d9d, 0x001789a6, 0x001912b0, 0x001adc39, - 0x001c6bce, 0x001e34d8, 0x001fbe61, 0x0001ca6a, - 0x00039374, 0x00051cfd, 0x0006ec0b, 0x00087515, - 0x0009fe9e, 0x000b4aa7, 0x000cd3b1, 0x000e9d3a, - 0x00000000, 0x00000000, -}; - -static const u32 b43_ntab_tdi40a1_r3[] = { - 0x001edb36, 0x000129ca, 0x0002b353, 0x00047cdd, - 0x0005c8e6, 0x000791ef, 0x00091bf9, 0x000aaa07, - 0x000c3391, 0x000dfd1a, 0x00120923, 0x0013d22d, - 0x00155c37, 0x0016eacb, 0x00187454, 0x001a3dde, - 0x001b89e7, 0x001d12f0, 0x001f1cfa, 0x00016b88, - 0x00033492, 0x0004be1b, 0x00060a24, 0x0007d32e, - 0x00095d38, 0x000aec4c, 0x000c7555, 0x000e3edf, - 0x00124ae8, 0x001413f1, 0x0015a37b, 0x00172c89, - 0x0018b593, 0x001a419c, 0x001bcb25, 0x001d942f, - 0x001f63b9, 0x0001ad4d, 0x00037657, 0x0004c260, - 0x00068be9, 0x000814f3, 0x0009a47c, 0x000b2d8a, - 0x000cb694, 0x000e429d, 0x00128c26, 0x001455b0, - 0x0015e4ba, 0x00176e4e, 0x0018f758, 0x001a8361, - 0x001c0cea, 0x001dd674, 0x001fa57d, 0x0001ee8b, - 0x0003b795, 0x0005039e, 0x0006cd27, 0x000856b1, - 0x0009e5c6, 0x000b6f4f, 0x000cf859, 0x000e8462, - 0x00130deb, 0x00149775, 0x00162603, 0x0017af8c, - 0x00193896, 0x001ac49f, 0x001c4e28, 0x001e17b2, - 0x0000a6c7, 0x00023050, 0x0003f9da, 0x00054563, - 0x00070eec, 0x00089876, 0x000a2704, 0x000bb08d, - 0x000d3a17, 0x001185a0, 0x00134f29, 0x0014d8b3, - 0x001667c8, 0x0017f151, 0x00197adb, 0x001b0664, - 0x001c8fed, 0x001e5977, 0x0000e805, 0x0002718f, - 0x00043b18, 0x000586a1, 0x0007502b, 0x0008d9b4, - 0x000a68c9, 0x000bf252, 0x000dbbdc, 0x0011c7e5, - 0x001390ee, 0x00151a78, 0x0016a906, 0x00183290, - 0x0019bc19, 0x001b4822, 0x001cd12c, 0x001e9ab5, - 0x00000000, 0x00000000, -}; - -static const u32 b43_ntab_pilotlt_r3[] = { - 0x76540213, 0x62407351, 0x76543210, 0x76540213, - 0x76540213, 0x76430521, -}; - -static const u32 b43_ntab_channelest_r3[] = { - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x44444444, 0x44444444, 0x44444444, 0x44444444, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, - 0x10101010, 0x10101010, 0x10101010, 0x10101010, -}; - -static const u8 b43_ntab_framelookup_r3[] = { - 0x02, 0x04, 0x14, 0x14, 0x03, 0x05, 0x16, 0x16, - 0x0a, 0x0c, 0x1c, 0x1c, 0x0b, 0x0d, 0x1e, 0x1e, - 0x06, 0x08, 0x18, 0x18, 0x07, 0x09, 0x1a, 0x1a, - 0x0e, 0x10, 0x20, 0x28, 0x0f, 0x11, 0x22, 0x2a, -}; - -static const u8 b43_ntab_estimatepowerlt0_r3[] = { - 0x55, 0x54, 0x54, 0x53, 0x52, 0x52, 0x51, 0x51, - 0x50, 0x4f, 0x4f, 0x4e, 0x4e, 0x4d, 0x4c, 0x4c, - 0x4b, 0x4a, 0x49, 0x49, 0x48, 0x47, 0x46, 0x46, - 0x45, 0x44, 0x43, 0x42, 0x41, 0x40, 0x40, 0x3f, - 0x3e, 0x3d, 0x3c, 0x3a, 0x39, 0x38, 0x37, 0x36, - 0x35, 0x33, 0x32, 0x31, 0x2f, 0x2e, 0x2c, 0x2b, - 0x29, 0x27, 0x25, 0x23, 0x21, 0x1f, 0x1d, 0x1a, - 0x18, 0x15, 0x12, 0x0e, 0x0b, 0x07, 0x02, 0xfd, -}; - -static const u8 b43_ntab_estimatepowerlt1_r3[] = { - 0x55, 0x54, 0x54, 0x53, 0x52, 0x52, 0x51, 0x51, - 0x50, 0x4f, 0x4f, 0x4e, 0x4e, 0x4d, 0x4c, 0x4c, - 0x4b, 0x4a, 0x49, 0x49, 0x48, 0x47, 0x46, 0x46, - 0x45, 0x44, 0x43, 0x42, 0x41, 0x40, 0x40, 0x3f, - 0x3e, 0x3d, 0x3c, 0x3a, 0x39, 0x38, 0x37, 0x36, - 0x35, 0x33, 0x32, 0x31, 0x2f, 0x2e, 0x2c, 0x2b, - 0x29, 0x27, 0x25, 0x23, 0x21, 0x1f, 0x1d, 0x1a, - 0x18, 0x15, 0x12, 0x0e, 0x0b, 0x07, 0x02, 0xfd, -}; - -static const u8 b43_ntab_adjustpower0_r3[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -static const u8 b43_ntab_adjustpower1_r3[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -static const u32 b43_ntab_gainctl0_r3[] = { - 0x5bf70044, 0x5bf70042, 0x5bf70040, 0x5bf7003e, - 0x5bf7003c, 0x5bf7003b, 0x5bf70039, 0x5bf70037, - 0x5bf70036, 0x5bf70034, 0x5bf70033, 0x5bf70031, - 0x5bf70030, 0x5ba70044, 0x5ba70042, 0x5ba70040, - 0x5ba7003e, 0x5ba7003c, 0x5ba7003b, 0x5ba70039, - 0x5ba70037, 0x5ba70036, 0x5ba70034, 0x5ba70033, - 0x5b770044, 0x5b770042, 0x5b770040, 0x5b77003e, - 0x5b77003c, 0x5b77003b, 0x5b770039, 0x5b770037, - 0x5b770036, 0x5b770034, 0x5b770033, 0x5b770031, - 0x5b770030, 0x5b77002f, 0x5b77002d, 0x5b77002c, - 0x5b470044, 0x5b470042, 0x5b470040, 0x5b47003e, - 0x5b47003c, 0x5b47003b, 0x5b470039, 0x5b470037, - 0x5b470036, 0x5b470034, 0x5b470033, 0x5b470031, - 0x5b470030, 0x5b47002f, 0x5b47002d, 0x5b47002c, - 0x5b47002b, 0x5b47002a, 0x5b270044, 0x5b270042, - 0x5b270040, 0x5b27003e, 0x5b27003c, 0x5b27003b, - 0x5b270039, 0x5b270037, 0x5b270036, 0x5b270034, - 0x5b270033, 0x5b270031, 0x5b270030, 0x5b27002f, - 0x5b170044, 0x5b170042, 0x5b170040, 0x5b17003e, - 0x5b17003c, 0x5b17003b, 0x5b170039, 0x5b170037, - 0x5b170036, 0x5b170034, 0x5b170033, 0x5b170031, - 0x5b170030, 0x5b17002f, 0x5b17002d, 0x5b17002c, - 0x5b17002b, 0x5b17002a, 0x5b170028, 0x5b170027, - 0x5b170026, 0x5b170025, 0x5b170024, 0x5b170023, - 0x5b070044, 0x5b070042, 0x5b070040, 0x5b07003e, - 0x5b07003c, 0x5b07003b, 0x5b070039, 0x5b070037, - 0x5b070036, 0x5b070034, 0x5b070033, 0x5b070031, - 0x5b070030, 0x5b07002f, 0x5b07002d, 0x5b07002c, - 0x5b07002b, 0x5b07002a, 0x5b070028, 0x5b070027, - 0x5b070026, 0x5b070025, 0x5b070024, 0x5b070023, - 0x5b070022, 0x5b070021, 0x5b070020, 0x5b07001f, - 0x5b07001e, 0x5b07001d, 0x5b07001d, 0x5b07001c, -}; - -static const u32 b43_ntab_gainctl1_r3[] = { - 0x5bf70044, 0x5bf70042, 0x5bf70040, 0x5bf7003e, - 0x5bf7003c, 0x5bf7003b, 0x5bf70039, 0x5bf70037, - 0x5bf70036, 0x5bf70034, 0x5bf70033, 0x5bf70031, - 0x5bf70030, 0x5ba70044, 0x5ba70042, 0x5ba70040, - 0x5ba7003e, 0x5ba7003c, 0x5ba7003b, 0x5ba70039, - 0x5ba70037, 0x5ba70036, 0x5ba70034, 0x5ba70033, - 0x5b770044, 0x5b770042, 0x5b770040, 0x5b77003e, - 0x5b77003c, 0x5b77003b, 0x5b770039, 0x5b770037, - 0x5b770036, 0x5b770034, 0x5b770033, 0x5b770031, - 0x5b770030, 0x5b77002f, 0x5b77002d, 0x5b77002c, - 0x5b470044, 0x5b470042, 0x5b470040, 0x5b47003e, - 0x5b47003c, 0x5b47003b, 0x5b470039, 0x5b470037, - 0x5b470036, 0x5b470034, 0x5b470033, 0x5b470031, - 0x5b470030, 0x5b47002f, 0x5b47002d, 0x5b47002c, - 0x5b47002b, 0x5b47002a, 0x5b270044, 0x5b270042, - 0x5b270040, 0x5b27003e, 0x5b27003c, 0x5b27003b, - 0x5b270039, 0x5b270037, 0x5b270036, 0x5b270034, - 0x5b270033, 0x5b270031, 0x5b270030, 0x5b27002f, - 0x5b170044, 0x5b170042, 0x5b170040, 0x5b17003e, - 0x5b17003c, 0x5b17003b, 0x5b170039, 0x5b170037, - 0x5b170036, 0x5b170034, 0x5b170033, 0x5b170031, - 0x5b170030, 0x5b17002f, 0x5b17002d, 0x5b17002c, - 0x5b17002b, 0x5b17002a, 0x5b170028, 0x5b170027, - 0x5b170026, 0x5b170025, 0x5b170024, 0x5b170023, - 0x5b070044, 0x5b070042, 0x5b070040, 0x5b07003e, - 0x5b07003c, 0x5b07003b, 0x5b070039, 0x5b070037, - 0x5b070036, 0x5b070034, 0x5b070033, 0x5b070031, - 0x5b070030, 0x5b07002f, 0x5b07002d, 0x5b07002c, - 0x5b07002b, 0x5b07002a, 0x5b070028, 0x5b070027, - 0x5b070026, 0x5b070025, 0x5b070024, 0x5b070023, - 0x5b070022, 0x5b070021, 0x5b070020, 0x5b07001f, - 0x5b07001e, 0x5b07001d, 0x5b07001d, 0x5b07001c, -}; - -static const u32 b43_ntab_iqlt0_r3[] = { - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static const u32 b43_ntab_iqlt1_r3[] = { - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static const u16 b43_ntab_loftlt0_r3[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, -}; - -static const u16 b43_ntab_loftlt1_r3[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, -}; - -/* volatile tables, PHY revision >= 3 */ - -/* indexed by antswctl2g */ -static const u16 b43_ntab_antswctl_r3[4][32] = { - { - 0x0082, 0x0082, 0x0211, 0x0222, 0x0328, - 0x0000, 0x0000, 0x0000, 0x0144, 0x0000, - 0x0000, 0x0000, 0x0188, 0x0000, 0x0000, - 0x0000, 0x0082, 0x0082, 0x0211, 0x0222, - 0x0328, 0x0000, 0x0000, 0x0000, 0x0144, - 0x0000, 0x0000, 0x0000, 0x0188, 0x0000, - 0x0000, 0x0000, - }, - { - 0x0022, 0x0022, 0x0011, 0x0022, 0x0022, - 0x0000, 0x0000, 0x0000, 0x0011, 0x0000, - 0x0000, 0x0000, 0x0022, 0x0000, 0x0000, - 0x0000, 0x0022, 0x0022, 0x0011, 0x0022, - 0x0022, 0x0000, 0x0000, 0x0000, 0x0011, - 0x0000, 0x0000, 0x0000, 0x0022, 0x0000, - 0x0000, 0x0000, - }, - { - 0x0088, 0x0088, 0x0044, 0x0088, 0x0088, - 0x0000, 0x0000, 0x0000, 0x0044, 0x0000, - 0x0000, 0x0000, 0x0088, 0x0000, 0x0000, - 0x0000, 0x0088, 0x0088, 0x0044, 0x0088, - 0x0088, 0x0000, 0x0000, 0x0000, 0x0044, - 0x0000, 0x0000, 0x0000, 0x0088, 0x0000, - 0x0000, 0x0000, - }, - { - 0x0022, 0x0022, 0x0011, 0x0022, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0011, 0x0000, - 0x0000, 0x0000, 0x0022, 0x0000, 0x0000, - 0x03cc, 0x0022, 0x0022, 0x0011, 0x0022, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0011, - 0x0000, 0x0000, 0x0000, 0x0022, 0x0000, - 0x0000, 0x03cc, - } -}; - -/* TX gain tables */ -static const u32 b43_ntab_tx_gain_rev0_1_2[] = { - 0x03cc2b44, 0x03cc2b42, 0x03cc2a44, 0x03cc2a42, - 0x03cc2944, 0x03c82b44, 0x03c82b42, 0x03c82a44, - 0x03c82a42, 0x03c82944, 0x03c82942, 0x03c82844, - 0x03c82842, 0x03c42b44, 0x03c42b42, 0x03c42a44, - 0x03c42a42, 0x03c42944, 0x03c42942, 0x03c42844, - 0x03c42842, 0x03c42744, 0x03c42742, 0x03c42644, - 0x03c42642, 0x03c42544, 0x03c42542, 0x03c42444, - 0x03c42442, 0x03c02b44, 0x03c02b42, 0x03c02a44, - 0x03c02a42, 0x03c02944, 0x03c02942, 0x03c02844, - 0x03c02842, 0x03c02744, 0x03c02742, 0x03b02b44, - 0x03b02b42, 0x03b02a44, 0x03b02a42, 0x03b02944, - 0x03b02942, 0x03b02844, 0x03b02842, 0x03b02744, - 0x03b02742, 0x03b02644, 0x03b02642, 0x03b02544, - 0x03b02542, 0x03a02b44, 0x03a02b42, 0x03a02a44, - 0x03a02a42, 0x03a02944, 0x03a02942, 0x03a02844, - 0x03a02842, 0x03a02744, 0x03a02742, 0x03902b44, - 0x03902b42, 0x03902a44, 0x03902a42, 0x03902944, - 0x03902942, 0x03902844, 0x03902842, 0x03902744, - 0x03902742, 0x03902644, 0x03902642, 0x03902544, - 0x03902542, 0x03802b44, 0x03802b42, 0x03802a44, - 0x03802a42, 0x03802944, 0x03802942, 0x03802844, - 0x03802842, 0x03802744, 0x03802742, 0x03802644, - 0x03802642, 0x03802544, 0x03802542, 0x03802444, - 0x03802442, 0x03802344, 0x03802342, 0x03802244, - 0x03802242, 0x03802144, 0x03802142, 0x03802044, - 0x03802042, 0x03801f44, 0x03801f42, 0x03801e44, - 0x03801e42, 0x03801d44, 0x03801d42, 0x03801c44, - 0x03801c42, 0x03801b44, 0x03801b42, 0x03801a44, - 0x03801a42, 0x03801944, 0x03801942, 0x03801844, - 0x03801842, 0x03801744, 0x03801742, 0x03801644, - 0x03801642, 0x03801544, 0x03801542, 0x03801444, - 0x03801442, 0x03801344, 0x03801342, 0x00002b00, -}; - -static const u32 b43_ntab_tx_gain_rev3plus_2ghz[] = { - 0x1f410044, 0x1f410042, 0x1f410040, 0x1f41003e, - 0x1f41003c, 0x1f41003b, 0x1f410039, 0x1f410037, - 0x1e410044, 0x1e410042, 0x1e410040, 0x1e41003e, - 0x1e41003c, 0x1e41003b, 0x1e410039, 0x1e410037, - 0x1d410044, 0x1d410042, 0x1d410040, 0x1d41003e, - 0x1d41003c, 0x1d41003b, 0x1d410039, 0x1d410037, - 0x1c410044, 0x1c410042, 0x1c410040, 0x1c41003e, - 0x1c41003c, 0x1c41003b, 0x1c410039, 0x1c410037, - 0x1b410044, 0x1b410042, 0x1b410040, 0x1b41003e, - 0x1b41003c, 0x1b41003b, 0x1b410039, 0x1b410037, - 0x1a410044, 0x1a410042, 0x1a410040, 0x1a41003e, - 0x1a41003c, 0x1a41003b, 0x1a410039, 0x1a410037, - 0x19410044, 0x19410042, 0x19410040, 0x1941003e, - 0x1941003c, 0x1941003b, 0x19410039, 0x19410037, - 0x18410044, 0x18410042, 0x18410040, 0x1841003e, - 0x1841003c, 0x1841003b, 0x18410039, 0x18410037, - 0x17410044, 0x17410042, 0x17410040, 0x1741003e, - 0x1741003c, 0x1741003b, 0x17410039, 0x17410037, - 0x16410044, 0x16410042, 0x16410040, 0x1641003e, - 0x1641003c, 0x1641003b, 0x16410039, 0x16410037, - 0x15410044, 0x15410042, 0x15410040, 0x1541003e, - 0x1541003c, 0x1541003b, 0x15410039, 0x15410037, - 0x14410044, 0x14410042, 0x14410040, 0x1441003e, - 0x1441003c, 0x1441003b, 0x14410039, 0x14410037, - 0x13410044, 0x13410042, 0x13410040, 0x1341003e, - 0x1341003c, 0x1341003b, 0x13410039, 0x13410037, - 0x12410044, 0x12410042, 0x12410040, 0x1241003e, - 0x1241003c, 0x1241003b, 0x12410039, 0x12410037, - 0x11410044, 0x11410042, 0x11410040, 0x1141003e, - 0x1141003c, 0x1141003b, 0x11410039, 0x11410037, - 0x10410044, 0x10410042, 0x10410040, 0x1041003e, - 0x1041003c, 0x1041003b, 0x10410039, 0x10410037, -}; - -static const u32 b43_ntab_tx_gain_rev3_5ghz[] = { - 0xcff70044, 0xcff70042, 0xcff70040, 0xcff7003e, - 0xcff7003c, 0xcff7003b, 0xcff70039, 0xcff70037, - 0xcef70044, 0xcef70042, 0xcef70040, 0xcef7003e, - 0xcef7003c, 0xcef7003b, 0xcef70039, 0xcef70037, - 0xcdf70044, 0xcdf70042, 0xcdf70040, 0xcdf7003e, - 0xcdf7003c, 0xcdf7003b, 0xcdf70039, 0xcdf70037, - 0xccf70044, 0xccf70042, 0xccf70040, 0xccf7003e, - 0xccf7003c, 0xccf7003b, 0xccf70039, 0xccf70037, - 0xcbf70044, 0xcbf70042, 0xcbf70040, 0xcbf7003e, - 0xcbf7003c, 0xcbf7003b, 0xcbf70039, 0xcbf70037, - 0xcaf70044, 0xcaf70042, 0xcaf70040, 0xcaf7003e, - 0xcaf7003c, 0xcaf7003b, 0xcaf70039, 0xcaf70037, - 0xc9f70044, 0xc9f70042, 0xc9f70040, 0xc9f7003e, - 0xc9f7003c, 0xc9f7003b, 0xc9f70039, 0xc9f70037, - 0xc8f70044, 0xc8f70042, 0xc8f70040, 0xc8f7003e, - 0xc8f7003c, 0xc8f7003b, 0xc8f70039, 0xc8f70037, - 0xc7f70044, 0xc7f70042, 0xc7f70040, 0xc7f7003e, - 0xc7f7003c, 0xc7f7003b, 0xc7f70039, 0xc7f70037, - 0xc6f70044, 0xc6f70042, 0xc6f70040, 0xc6f7003e, - 0xc6f7003c, 0xc6f7003b, 0xc6f70039, 0xc6f70037, - 0xc5f70044, 0xc5f70042, 0xc5f70040, 0xc5f7003e, - 0xc5f7003c, 0xc5f7003b, 0xc5f70039, 0xc5f70037, - 0xc4f70044, 0xc4f70042, 0xc4f70040, 0xc4f7003e, - 0xc4f7003c, 0xc4f7003b, 0xc4f70039, 0xc4f70037, - 0xc3f70044, 0xc3f70042, 0xc3f70040, 0xc3f7003e, - 0xc3f7003c, 0xc3f7003b, 0xc3f70039, 0xc3f70037, - 0xc2f70044, 0xc2f70042, 0xc2f70040, 0xc2f7003e, - 0xc2f7003c, 0xc2f7003b, 0xc2f70039, 0xc2f70037, - 0xc1f70044, 0xc1f70042, 0xc1f70040, 0xc1f7003e, - 0xc1f7003c, 0xc1f7003b, 0xc1f70039, 0xc1f70037, - 0xc0f70044, 0xc0f70042, 0xc0f70040, 0xc0f7003e, - 0xc0f7003c, 0xc0f7003b, 0xc0f70039, 0xc0f70037, -}; - -static const u32 b43_ntab_tx_gain_rev4_5ghz[] = { - 0x2ff20044, 0x2ff20042, 0x2ff20040, 0x2ff2003e, - 0x2ff2003c, 0x2ff2003b, 0x2ff20039, 0x2ff20037, - 0x2ef20044, 0x2ef20042, 0x2ef20040, 0x2ef2003e, - 0x2ef2003c, 0x2ef2003b, 0x2ef20039, 0x2ef20037, - 0x2df20044, 0x2df20042, 0x2df20040, 0x2df2003e, - 0x2df2003c, 0x2df2003b, 0x2df20039, 0x2df20037, - 0x2cf20044, 0x2cf20042, 0x2cf20040, 0x2cf2003e, - 0x2cf2003c, 0x2cf2003b, 0x2cf20039, 0x2cf20037, - 0x2bf20044, 0x2bf20042, 0x2bf20040, 0x2bf2003e, - 0x2bf2003c, 0x2bf2003b, 0x2bf20039, 0x2bf20037, - 0x2af20044, 0x2af20042, 0x2af20040, 0x2af2003e, - 0x2af2003c, 0x2af2003b, 0x2af20039, 0x2af20037, - 0x29f20044, 0x29f20042, 0x29f20040, 0x29f2003e, - 0x29f2003c, 0x29f2003b, 0x29f20039, 0x29f20037, - 0x28f20044, 0x28f20042, 0x28f20040, 0x28f2003e, - 0x28f2003c, 0x28f2003b, 0x28f20039, 0x28f20037, - 0x27f20044, 0x27f20042, 0x27f20040, 0x27f2003e, - 0x27f2003c, 0x27f2003b, 0x27f20039, 0x27f20037, - 0x26f20044, 0x26f20042, 0x26f20040, 0x26f2003e, - 0x26f2003c, 0x26f2003b, 0x26f20039, 0x26f20037, - 0x25f20044, 0x25f20042, 0x25f20040, 0x25f2003e, - 0x25f2003c, 0x25f2003b, 0x25f20039, 0x25f20037, - 0x24f20044, 0x24f20042, 0x24f20040, 0x24f2003e, - 0x24f2003c, 0x24f2003b, 0x24f20039, 0x24f20038, - 0x23f20041, 0x23f20040, 0x23f2003f, 0x23f2003e, - 0x23f2003c, 0x23f2003b, 0x23f20039, 0x23f20037, - 0x22f20044, 0x22f20042, 0x22f20040, 0x22f2003e, - 0x22f2003c, 0x22f2003b, 0x22f20039, 0x22f20037, - 0x21f20044, 0x21f20042, 0x21f20040, 0x21f2003e, - 0x21f2003c, 0x21f2003b, 0x21f20039, 0x21f20037, - 0x20d20043, 0x20d20041, 0x20d2003e, 0x20d2003c, - 0x20d2003a, 0x20d20038, 0x20d20036, 0x20d20034, -}; - -static const u32 b43_ntab_tx_gain_rev5plus_5ghz[] = { - 0x0f62004a, 0x0f620048, 0x0f620046, 0x0f620044, - 0x0f620042, 0x0f620040, 0x0f62003e, 0x0f62003c, - 0x0e620044, 0x0e620042, 0x0e620040, 0x0e62003e, - 0x0e62003c, 0x0e62003d, 0x0e62003b, 0x0e62003a, - 0x0d620043, 0x0d620041, 0x0d620040, 0x0d62003e, - 0x0d62003d, 0x0d62003c, 0x0d62003b, 0x0d62003a, - 0x0c620041, 0x0c620040, 0x0c62003f, 0x0c62003e, - 0x0c62003c, 0x0c62003b, 0x0c620039, 0x0c620037, - 0x0b620046, 0x0b620044, 0x0b620042, 0x0b620040, - 0x0b62003e, 0x0b62003c, 0x0b62003b, 0x0b62003a, - 0x0a620041, 0x0a620040, 0x0a62003e, 0x0a62003c, - 0x0a62003b, 0x0a62003a, 0x0a620039, 0x0a620038, - 0x0962003e, 0x0962003d, 0x0962003c, 0x0962003b, - 0x09620039, 0x09620037, 0x09620035, 0x09620033, - 0x08620044, 0x08620042, 0x08620040, 0x0862003e, - 0x0862003c, 0x0862003b, 0x0862003a, 0x08620039, - 0x07620043, 0x07620042, 0x07620040, 0x0762003f, - 0x0762003d, 0x0762003b, 0x0762003a, 0x07620039, - 0x0662003e, 0x0662003d, 0x0662003c, 0x0662003b, - 0x06620039, 0x06620037, 0x06620035, 0x06620033, - 0x05620046, 0x05620044, 0x05620042, 0x05620040, - 0x0562003e, 0x0562003c, 0x0562003b, 0x05620039, - 0x04620044, 0x04620042, 0x04620040, 0x0462003e, - 0x0462003c, 0x0462003b, 0x04620039, 0x04620038, - 0x0362003c, 0x0362003b, 0x0362003a, 0x03620039, - 0x03620038, 0x03620037, 0x03620035, 0x03620033, - 0x0262004c, 0x0262004a, 0x02620048, 0x02620047, - 0x02620046, 0x02620044, 0x02620043, 0x02620042, - 0x0162004a, 0x01620048, 0x01620046, 0x01620044, - 0x01620043, 0x01620042, 0x01620041, 0x01620040, - 0x00620042, 0x00620040, 0x0062003e, 0x0062003c, - 0x0062003b, 0x00620039, 0x00620037, 0x00620035, -}; - -static const u32 txpwrctrl_tx_gain_ipa[] = { - 0x5ff7002d, 0x5ff7002b, 0x5ff7002a, 0x5ff70029, - 0x5ff70028, 0x5ff70027, 0x5ff70026, 0x5ff70025, - 0x5ef7002d, 0x5ef7002b, 0x5ef7002a, 0x5ef70029, - 0x5ef70028, 0x5ef70027, 0x5ef70026, 0x5ef70025, - 0x5df7002d, 0x5df7002b, 0x5df7002a, 0x5df70029, - 0x5df70028, 0x5df70027, 0x5df70026, 0x5df70025, - 0x5cf7002d, 0x5cf7002b, 0x5cf7002a, 0x5cf70029, - 0x5cf70028, 0x5cf70027, 0x5cf70026, 0x5cf70025, - 0x5bf7002d, 0x5bf7002b, 0x5bf7002a, 0x5bf70029, - 0x5bf70028, 0x5bf70027, 0x5bf70026, 0x5bf70025, - 0x5af7002d, 0x5af7002b, 0x5af7002a, 0x5af70029, - 0x5af70028, 0x5af70027, 0x5af70026, 0x5af70025, - 0x59f7002d, 0x59f7002b, 0x59f7002a, 0x59f70029, - 0x59f70028, 0x59f70027, 0x59f70026, 0x59f70025, - 0x58f7002d, 0x58f7002b, 0x58f7002a, 0x58f70029, - 0x58f70028, 0x58f70027, 0x58f70026, 0x58f70025, - 0x57f7002d, 0x57f7002b, 0x57f7002a, 0x57f70029, - 0x57f70028, 0x57f70027, 0x57f70026, 0x57f70025, - 0x56f7002d, 0x56f7002b, 0x56f7002a, 0x56f70029, - 0x56f70028, 0x56f70027, 0x56f70026, 0x56f70025, - 0x55f7002d, 0x55f7002b, 0x55f7002a, 0x55f70029, - 0x55f70028, 0x55f70027, 0x55f70026, 0x55f70025, - 0x54f7002d, 0x54f7002b, 0x54f7002a, 0x54f70029, - 0x54f70028, 0x54f70027, 0x54f70026, 0x54f70025, - 0x53f7002d, 0x53f7002b, 0x53f7002a, 0x53f70029, - 0x53f70028, 0x53f70027, 0x53f70026, 0x53f70025, - 0x52f7002d, 0x52f7002b, 0x52f7002a, 0x52f70029, - 0x52f70028, 0x52f70027, 0x52f70026, 0x52f70025, - 0x51f7002d, 0x51f7002b, 0x51f7002a, 0x51f70029, - 0x51f70028, 0x51f70027, 0x51f70026, 0x51f70025, - 0x50f7002d, 0x50f7002b, 0x50f7002a, 0x50f70029, - 0x50f70028, 0x50f70027, 0x50f70026, 0x50f70025, -}; - -static const u32 txpwrctrl_tx_gain_ipa_rev5[] = { - 0x1ff7002d, 0x1ff7002b, 0x1ff7002a, 0x1ff70029, - 0x1ff70028, 0x1ff70027, 0x1ff70026, 0x1ff70025, - 0x1ef7002d, 0x1ef7002b, 0x1ef7002a, 0x1ef70029, - 0x1ef70028, 0x1ef70027, 0x1ef70026, 0x1ef70025, - 0x1df7002d, 0x1df7002b, 0x1df7002a, 0x1df70029, - 0x1df70028, 0x1df70027, 0x1df70026, 0x1df70025, - 0x1cf7002d, 0x1cf7002b, 0x1cf7002a, 0x1cf70029, - 0x1cf70028, 0x1cf70027, 0x1cf70026, 0x1cf70025, - 0x1bf7002d, 0x1bf7002b, 0x1bf7002a, 0x1bf70029, - 0x1bf70028, 0x1bf70027, 0x1bf70026, 0x1bf70025, - 0x1af7002d, 0x1af7002b, 0x1af7002a, 0x1af70029, - 0x1af70028, 0x1af70027, 0x1af70026, 0x1af70025, - 0x19f7002d, 0x19f7002b, 0x19f7002a, 0x19f70029, - 0x19f70028, 0x19f70027, 0x19f70026, 0x19f70025, - 0x18f7002d, 0x18f7002b, 0x18f7002a, 0x18f70029, - 0x18f70028, 0x18f70027, 0x18f70026, 0x18f70025, - 0x17f7002d, 0x17f7002b, 0x17f7002a, 0x17f70029, - 0x17f70028, 0x17f70027, 0x17f70026, 0x17f70025, - 0x16f7002d, 0x16f7002b, 0x16f7002a, 0x16f70029, - 0x16f70028, 0x16f70027, 0x16f70026, 0x16f70025, - 0x15f7002d, 0x15f7002b, 0x15f7002a, 0x15f70029, - 0x15f70028, 0x15f70027, 0x15f70026, 0x15f70025, - 0x14f7002d, 0x14f7002b, 0x14f7002a, 0x14f70029, - 0x14f70028, 0x14f70027, 0x14f70026, 0x14f70025, - 0x13f7002d, 0x13f7002b, 0x13f7002a, 0x13f70029, - 0x13f70028, 0x13f70027, 0x13f70026, 0x13f70025, - 0x12f7002d, 0x12f7002b, 0x12f7002a, 0x12f70029, - 0x12f70028, 0x12f70027, 0x12f70026, 0x12f70025, - 0x11f7002d, 0x11f7002b, 0x11f7002a, 0x11f70029, - 0x11f70028, 0x11f70027, 0x11f70026, 0x11f70025, - 0x10f7002d, 0x10f7002b, 0x10f7002a, 0x10f70029, - 0x10f70028, 0x10f70027, 0x10f70026, 0x10f70025, -}; - -static const u32 txpwrctrl_tx_gain_ipa_rev6[] = { - 0x0ff7002d, 0x0ff7002b, 0x0ff7002a, 0x0ff70029, - 0x0ff70028, 0x0ff70027, 0x0ff70026, 0x0ff70025, - 0x0ef7002d, 0x0ef7002b, 0x0ef7002a, 0x0ef70029, - 0x0ef70028, 0x0ef70027, 0x0ef70026, 0x0ef70025, - 0x0df7002d, 0x0df7002b, 0x0df7002a, 0x0df70029, - 0x0df70028, 0x0df70027, 0x0df70026, 0x0df70025, - 0x0cf7002d, 0x0cf7002b, 0x0cf7002a, 0x0cf70029, - 0x0cf70028, 0x0cf70027, 0x0cf70026, 0x0cf70025, - 0x0bf7002d, 0x0bf7002b, 0x0bf7002a, 0x0bf70029, - 0x0bf70028, 0x0bf70027, 0x0bf70026, 0x0bf70025, - 0x0af7002d, 0x0af7002b, 0x0af7002a, 0x0af70029, - 0x0af70028, 0x0af70027, 0x0af70026, 0x0af70025, - 0x09f7002d, 0x09f7002b, 0x09f7002a, 0x09f70029, - 0x09f70028, 0x09f70027, 0x09f70026, 0x09f70025, - 0x08f7002d, 0x08f7002b, 0x08f7002a, 0x08f70029, - 0x08f70028, 0x08f70027, 0x08f70026, 0x08f70025, - 0x07f7002d, 0x07f7002b, 0x07f7002a, 0x07f70029, - 0x07f70028, 0x07f70027, 0x07f70026, 0x07f70025, - 0x06f7002d, 0x06f7002b, 0x06f7002a, 0x06f70029, - 0x06f70028, 0x06f70027, 0x06f70026, 0x06f70025, - 0x05f7002d, 0x05f7002b, 0x05f7002a, 0x05f70029, - 0x05f70028, 0x05f70027, 0x05f70026, 0x05f70025, - 0x04f7002d, 0x04f7002b, 0x04f7002a, 0x04f70029, - 0x04f70028, 0x04f70027, 0x04f70026, 0x04f70025, - 0x03f7002d, 0x03f7002b, 0x03f7002a, 0x03f70029, - 0x03f70028, 0x03f70027, 0x03f70026, 0x03f70025, - 0x02f7002d, 0x02f7002b, 0x02f7002a, 0x02f70029, - 0x02f70028, 0x02f70027, 0x02f70026, 0x02f70025, - 0x01f7002d, 0x01f7002b, 0x01f7002a, 0x01f70029, - 0x01f70028, 0x01f70027, 0x01f70026, 0x01f70025, - 0x00f7002d, 0x00f7002b, 0x00f7002a, 0x00f70029, - 0x00f70028, 0x00f70027, 0x00f70026, 0x00f70025, -}; - -static const u32 txpwrctrl_tx_gain_ipa_5g[] = { - 0x7ff70035, 0x7ff70033, 0x7ff70032, 0x7ff70031, - 0x7ff7002f, 0x7ff7002e, 0x7ff7002d, 0x7ff7002b, - 0x7ff7002a, 0x7ff70029, 0x7ff70028, 0x7ff70027, - 0x7ff70026, 0x7ff70024, 0x7ff70023, 0x7ff70022, - 0x7ef70028, 0x7ef70027, 0x7ef70026, 0x7ef70025, - 0x7ef70024, 0x7ef70023, 0x7df70028, 0x7df70027, - 0x7df70026, 0x7df70025, 0x7df70024, 0x7df70023, - 0x7df70022, 0x7cf70029, 0x7cf70028, 0x7cf70027, - 0x7cf70026, 0x7cf70025, 0x7cf70023, 0x7cf70022, - 0x7bf70029, 0x7bf70028, 0x7bf70026, 0x7bf70025, - 0x7bf70024, 0x7bf70023, 0x7bf70022, 0x7bf70021, - 0x7af70029, 0x7af70028, 0x7af70027, 0x7af70026, - 0x7af70025, 0x7af70024, 0x7af70023, 0x7af70022, - 0x79f70029, 0x79f70028, 0x79f70027, 0x79f70026, - 0x79f70025, 0x79f70024, 0x79f70023, 0x79f70022, - 0x78f70029, 0x78f70028, 0x78f70027, 0x78f70026, - 0x78f70025, 0x78f70024, 0x78f70023, 0x78f70022, - 0x77f70029, 0x77f70028, 0x77f70027, 0x77f70026, - 0x77f70025, 0x77f70024, 0x77f70023, 0x77f70022, - 0x76f70029, 0x76f70028, 0x76f70027, 0x76f70026, - 0x76f70024, 0x76f70023, 0x76f70022, 0x76f70021, - 0x75f70029, 0x75f70028, 0x75f70027, 0x75f70026, - 0x75f70025, 0x75f70024, 0x75f70023, 0x74f70029, - 0x74f70028, 0x74f70026, 0x74f70025, 0x74f70024, - 0x74f70023, 0x74f70022, 0x73f70029, 0x73f70027, - 0x73f70026, 0x73f70025, 0x73f70024, 0x73f70023, - 0x73f70022, 0x72f70028, 0x72f70027, 0x72f70026, - 0x72f70025, 0x72f70024, 0x72f70023, 0x72f70022, - 0x71f70028, 0x71f70027, 0x71f70026, 0x71f70025, - 0x71f70024, 0x71f70023, 0x70f70028, 0x70f70027, - 0x70f70026, 0x70f70024, 0x70f70023, 0x70f70022, - 0x70f70021, 0x70f70020, 0x70f70020, 0x70f7001f, -}; - -const s8 b43_ntab_papd_pga_gain_delta_ipa_2g[] = { - -114, -108, -98, -91, -84, -78, -70, -62, - -54, -46, -39, -31, -23, -15, -8, 0 -}; - -const u16 tbl_iqcal_gainparams[2][9][8] = { - { - { 0x000, 0, 0, 2, 0x69, 0x69, 0x69, 0x69 }, - { 0x700, 7, 0, 0, 0x69, 0x69, 0x69, 0x69 }, - { 0x710, 7, 1, 0, 0x68, 0x68, 0x68, 0x68 }, - { 0x720, 7, 2, 0, 0x67, 0x67, 0x67, 0x67 }, - { 0x730, 7, 3, 0, 0x66, 0x66, 0x66, 0x66 }, - { 0x740, 7, 4, 0, 0x65, 0x65, 0x65, 0x65 }, - { 0x741, 7, 4, 1, 0x65, 0x65, 0x65, 0x65 }, - { 0x742, 7, 4, 2, 0x65, 0x65, 0x65, 0x65 }, - { 0x743, 7, 4, 3, 0x65, 0x65, 0x65, 0x65 } - }, - { - { 0x000, 7, 0, 0, 0x79, 0x79, 0x79, 0x79 }, - { 0x700, 7, 0, 0, 0x79, 0x79, 0x79, 0x79 }, - { 0x710, 7, 1, 0, 0x79, 0x79, 0x79, 0x79 }, - { 0x720, 7, 2, 0, 0x78, 0x78, 0x78, 0x78 }, - { 0x730, 7, 3, 0, 0x78, 0x78, 0x78, 0x78 }, - { 0x740, 7, 4, 0, 0x78, 0x78, 0x78, 0x78 }, - { 0x741, 7, 4, 1, 0x78, 0x78, 0x78, 0x78 }, - { 0x742, 7, 4, 2, 0x78, 0x78, 0x78, 0x78 }, - { 0x743, 7, 4, 3, 0x78, 0x78, 0x78, 0x78 } - } -}; - -const struct nphy_txiqcal_ladder ladder_lo[] = { - { 3, 0 }, - { 4, 0 }, - { 6, 0 }, - { 9, 0 }, - { 13, 0 }, - { 18, 0 }, - { 25, 0 }, - { 25, 1 }, - { 25, 2 }, - { 25, 3 }, - { 25, 4 }, - { 25, 5 }, - { 25, 6 }, - { 25, 7 }, - { 35, 7 }, - { 50, 7 }, - { 71, 7 }, - { 100, 7 } -}; - -const struct nphy_txiqcal_ladder ladder_iq[] = { - { 3, 0 }, - { 4, 0 }, - { 6, 0 }, - { 9, 0 }, - { 13, 0 }, - { 18, 0 }, - { 25, 0 }, - { 35, 0 }, - { 50, 0 }, - { 71, 0 }, - { 100, 0 }, - { 100, 1 }, - { 100, 2 }, - { 100, 3 }, - { 100, 4 }, - { 100, 5 }, - { 100, 6 }, - { 100, 7 } -}; - -const u16 loscale[] = { - 256, 256, 271, 271, - 287, 256, 256, 271, - 271, 287, 287, 304, - 304, 256, 256, 271, - 271, 287, 287, 304, - 304, 322, 322, 341, - 341, 362, 362, 383, - 383, 256, 256, 271, - 271, 287, 287, 304, - 304, 322, 322, 256, - 256, 271, 271, 287, - 287, 304, 304, 322, - 322, 341, 341, 362, - 362, 256, 256, 271, - 271, 287, 287, 304, - 304, 322, 322, 256, - 256, 271, 271, 287, - 287, 304, 304, 322, - 322, 341, 341, 362, - 362, 256, 256, 271, - 271, 287, 287, 304, - 304, 322, 322, 341, - 341, 362, 362, 383, - 383, 406, 406, 430, - 430, 455, 455, 482, - 482, 511, 511, 541, - 541, 573, 573, 607, - 607, 643, 643, 681, - 681, 722, 722, 764, - 764, 810, 810, 858, - 858, 908, 908, 962, - 962, 1019, 1019, 256 -}; - -const u16 tbl_tx_iqlo_cal_loft_ladder_40[] = { - 0x0200, 0x0300, 0x0400, 0x0700, - 0x0900, 0x0c00, 0x1200, 0x1201, - 0x1202, 0x1203, 0x1204, 0x1205, - 0x1206, 0x1207, 0x1907, 0x2307, - 0x3207, 0x4707 -}; - -const u16 tbl_tx_iqlo_cal_loft_ladder_20[] = { - 0x0300, 0x0500, 0x0700, 0x0900, - 0x0d00, 0x1100, 0x1900, 0x1901, - 0x1902, 0x1903, 0x1904, 0x1905, - 0x1906, 0x1907, 0x2407, 0x3207, - 0x4607, 0x6407 -}; - -const u16 tbl_tx_iqlo_cal_iqimb_ladder_40[] = { - 0x0100, 0x0200, 0x0400, 0x0700, - 0x0900, 0x0c00, 0x1200, 0x1900, - 0x2300, 0x3200, 0x4700, 0x4701, - 0x4702, 0x4703, 0x4704, 0x4705, - 0x4706, 0x4707 -}; - -const u16 tbl_tx_iqlo_cal_iqimb_ladder_20[] = { - 0x0200, 0x0300, 0x0600, 0x0900, - 0x0d00, 0x1100, 0x1900, 0x2400, - 0x3200, 0x4600, 0x6400, 0x6401, - 0x6402, 0x6403, 0x6404, 0x6405, - 0x6406, 0x6407 -}; - -const u16 tbl_tx_iqlo_cal_startcoefs_nphyrev3[B43_NTAB_TX_IQLO_CAL_STARTCOEFS_REV3] = { }; - -const u16 tbl_tx_iqlo_cal_startcoefs[B43_NTAB_TX_IQLO_CAL_STARTCOEFS] = { }; - -const u16 tbl_tx_iqlo_cal_cmds_recal_nphyrev3[] = { - 0x8423, 0x8323, 0x8073, 0x8256, - 0x8045, 0x8223, 0x9423, 0x9323, - 0x9073, 0x9256, 0x9045, 0x9223 -}; - -const u16 tbl_tx_iqlo_cal_cmds_recal[] = { - 0x8101, 0x8253, 0x8053, 0x8234, - 0x8034, 0x9101, 0x9253, 0x9053, - 0x9234, 0x9034 -}; - -const u16 tbl_tx_iqlo_cal_cmds_fullcal[] = { - 0x8123, 0x8264, 0x8086, 0x8245, - 0x8056, 0x9123, 0x9264, 0x9086, - 0x9245, 0x9056 -}; - -const u16 tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[] = { - 0x8434, 0x8334, 0x8084, 0x8267, - 0x8056, 0x8234, 0x9434, 0x9334, - 0x9084, 0x9267, 0x9056, 0x9234 -}; - -const s16 tbl_tx_filter_coef_rev4[7][15] = { - { -377, 137, -407, 208, -1527, - 956, 93, 186, 93, 230, - -44, 230, 201, -191, 201 }, - { -77, 20, -98, 49, -93, - 60, 56, 111, 56, 26, - -5, 26, 34, -32, 34 }, - { -360, 164, -376, 164, -1533, - 576, 308, -314, 308, 121, - -73, 121, 91, 124, 91 }, - { -295, 200, -363, 142, -1391, - 826, 151, 301, 151, 151, - 301, 151, 602, -752, 602 }, - { -92, 58, -96, 49, -104, - 44, 17, 35, 17, 12, - 25, 12, 13, 27, 13 }, - { -375, 136, -399, 209, -1479, - 949, 130, 260, 130, 230, - -44, 230, 201, -191, 201 }, - { 0xed9, 0xc8, 0xe95, 0x8e, 0xa91, - 0x33a, 0x97, 0x12d, 0x97, 0x97, - 0x12d, 0x97, 0x25a, 0xd10, 0x25a } -}; - -/* addr0, addr1, bmask, shift */ -const struct nphy_rf_control_override_rev2 tbl_rf_control_override_rev2[] = { - { 0x78, 0x78, 0x0038, 3 }, /* for field == 0x0002 (fls == 2) */ - { 0x7A, 0x7D, 0x0001, 0 }, /* for field == 0x0004 (fls == 3) */ - { 0x7A, 0x7D, 0x0002, 1 }, /* for field == 0x0008 (fls == 4) */ - { 0x7A, 0x7D, 0x0004, 2 }, /* for field == 0x0010 (fls == 5) */ - { 0x7A, 0x7D, 0x0030, 4 }, /* for field == 0x0020 (fls == 6) */ - { 0x7A, 0x7D, 0x00C0, 6 }, /* for field == 0x0040 (fls == 7) */ - { 0x7A, 0x7D, 0x0100, 8 }, /* for field == 0x0080 (fls == 8) */ - { 0x7A, 0x7D, 0x0200, 9 }, /* for field == 0x0100 (fls == 9) */ - { 0x78, 0x78, 0x0004, 2 }, /* for field == 0x0200 (fls == 10) */ - { 0x7B, 0x7E, 0x01FF, 0 }, /* for field == 0x0400 (fls == 11) */ - { 0x7C, 0x7F, 0x01FF, 0 }, /* for field == 0x0800 (fls == 12) */ - { 0x78, 0x78, 0x0100, 8 }, /* for field == 0x1000 (fls == 13) */ - { 0x78, 0x78, 0x0200, 9 }, /* for field == 0x2000 (fls == 14) */ - { 0x78, 0x78, 0xF000, 12 } /* for field == 0x4000 (fls == 15) */ -}; - -/* val_mask, val_shift, en_addr0, val_addr0, en_addr1, val_addr1 */ -const struct nphy_rf_control_override_rev3 tbl_rf_control_override_rev3[] = { - { 0x8000, 15, 0xE5, 0xF9, 0xE6, 0xFB }, /* field == 0x0001 (fls 1) */ - { 0x0001, 0, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0002 (fls 2) */ - { 0x0002, 1, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0004 (fls 3) */ - { 0x0004, 2, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0008 (fls 4) */ - { 0x0010, 4, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0010 (fls 5) */ - { 0x0020, 5, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0020 (fls 6) */ - { 0x0040, 6, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0040 (fls 7) */ - { 0x0080, 7, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0080 (fls 8) */ - { 0x0100, 8, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0100 (fls 9) */ - { 0x0007, 0, 0xE7, 0xF8, 0xEC, 0xFA }, /* field == 0x0200 (fls 10) */ - { 0x0070, 4, 0xE7, 0xF8, 0xEC, 0xFA }, /* field == 0x0400 (fls 11) */ - { 0xE000, 13, 0xE7, 0x7A, 0xEC, 0x7D }, /* field == 0x0800 (fls 12) */ - { 0xFFFF, 0, 0xE7, 0x7B, 0xEC, 0x7E }, /* field == 0x1000 (fls 13) */ - { 0xFFFF, 0, 0xE7, 0x7C, 0xEC, 0x7F }, /* field == 0x2000 (fls 14) */ - { 0x00C0, 6, 0xE7, 0xF9, 0xEC, 0xFB } /* field == 0x4000 (fls 15) */ -}; - -/* field, val_addr_core0, val_addr_core1, val_mask, val_shift */ -static const struct nphy_rf_control_override_rev7 - tbl_rf_control_override_rev7_over0[] = { - { 0x0004, 0x07A, 0x07D, 0x0002, 1 }, - { 0x0008, 0x07A, 0x07D, 0x0004, 2 }, - { 0x0010, 0x07A, 0x07D, 0x0010, 4 }, - { 0x0020, 0x07A, 0x07D, 0x0020, 5 }, - { 0x0040, 0x07A, 0x07D, 0x0040, 6 }, - { 0x0080, 0x0F8, 0x0FA, 0x0080, 7 }, - { 0x0400, 0x0F8, 0x0FA, 0x0070, 4 }, - { 0x0800, 0x07B, 0x07E, 0xFFFF, 0 }, - { 0x1000, 0x07C, 0x07F, 0xFFFF, 0 }, - { 0x6000, 0x348, 0x349, 0xFFFF, 0 }, - { 0x2000, 0x348, 0x349, 0x000F, 0 }, -}; - -/* field, val_addr_core0, val_addr_core1, val_mask, val_shift */ -static const struct nphy_rf_control_override_rev7 - tbl_rf_control_override_rev7_over1[] = { - { 0x0002, 0x340, 0x341, 0x0002, 1 }, - { 0x0008, 0x340, 0x341, 0x0008, 3 }, - { 0x0020, 0x340, 0x341, 0x0020, 5 }, - { 0x0010, 0x340, 0x341, 0x0010, 4 }, - { 0x0004, 0x340, 0x341, 0x0004, 2 }, - { 0x0080, 0x340, 0x341, 0x0700, 8 }, - { 0x0800, 0x340, 0x341, 0x4000, 14 }, - { 0x0400, 0x340, 0x341, 0x2000, 13 }, - { 0x0200, 0x340, 0x341, 0x0800, 12 }, - { 0x0100, 0x340, 0x341, 0x0100, 11 }, - { 0x0040, 0x340, 0x341, 0x0040, 6 }, - { 0x0001, 0x340, 0x341, 0x0001, 0 }, -}; - -/* field, val_addr_core0, val_addr_core1, val_mask, val_shift */ -static const struct nphy_rf_control_override_rev7 - tbl_rf_control_override_rev7_over2[] = { - { 0x0008, 0x344, 0x345, 0x0008, 3 }, - { 0x0002, 0x344, 0x345, 0x0002, 1 }, - { 0x0001, 0x344, 0x345, 0x0001, 0 }, - { 0x0004, 0x344, 0x345, 0x0004, 2 }, - { 0x0010, 0x344, 0x345, 0x0010, 4 }, -}; - -static struct nphy_gain_ctl_workaround_entry nphy_gain_ctl_wa_phy6_radio11_ghz2 = { - { 10, 14, 19, 27 }, - { -5, 6, 10, 15 }, - { 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA }, - { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - 0x427E, - { 0x413F, 0x413F, 0x413F, 0x413F }, - 0x007E, 0x0066, 0x1074, - 0x18, 0x18, 0x18, - 0x01D0, 0x5, -}; -static struct nphy_gain_ctl_workaround_entry nphy_gain_ctl_workaround[2][4] = { - { /* 2GHz */ - { /* PHY rev 3 */ - { 7, 11, 16, 23 }, - { -5, 6, 10, 14 }, - { 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA }, - { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - 0x627E, - { 0x613F, 0x613F, 0x613F, 0x613F }, - 0x107E, 0x0066, 0x0074, - 0x18, 0x18, 0x18, - 0x020D, 0x5, - }, - { /* PHY rev 4 */ - { 8, 12, 17, 25 }, - { -5, 6, 10, 14 }, - { 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA }, - { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - 0x527E, - { 0x513F, 0x513F, 0x513F, 0x513F }, - 0x007E, 0x0066, 0x0074, - 0x18, 0x18, 0x18, - 0x01A1, 0x5, - }, - { /* PHY rev 5 */ - { 9, 13, 18, 26 }, - { -3, 7, 11, 16 }, - { 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA }, - { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - 0x427E, /* invalid for external LNA! */ - { 0x413F, 0x413F, 0x413F, 0x413F }, /* invalid for external LNA! */ - 0x1076, 0x0066, 0x0000, /* low is invalid (the last one) */ - 0x18, 0x18, 0x18, - 0x01D0, 0x9, - }, - { /* PHY rev 6+ */ - { 8, 13, 18, 25 }, - { -5, 6, 10, 14 }, - { 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA }, - { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - 0x527E, /* invalid for external LNA! */ - { 0x513F, 0x513F, 0x513F, 0x513F }, /* invalid for external LNA! */ - 0x1076, 0x0066, 0x0000, /* low is invalid (the last one) */ - 0x18, 0x18, 0x18, - 0x01D0, 0x5, - }, - }, - { /* 5GHz */ - { /* PHY rev 3 */ - { 7, 11, 17, 23 }, - { -6, 2, 6, 10 }, - { 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13 }, - { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }, - 0x52DE, - { 0x516F, 0x516F, 0x516F, 0x516F }, - 0x00DE, 0x00CA, 0x00CC, - 0x1E, 0x1E, 0x1E, - 0x01A1, 25, - }, - { /* PHY rev 4 */ - { 8, 12, 18, 23 }, - { -5, 2, 6, 10 }, - { 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - 0x629E, - { 0x614F, 0x614F, 0x614F, 0x614F }, - 0x029E, 0x1084, 0x0086, - 0x24, 0x24, 0x24, - 0x0107, 25, - }, - { /* PHY rev 5 */ - { 6, 10, 16, 21 }, - { -7, 0, 4, 8 }, - { 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - 0x729E, - { 0x714F, 0x714F, 0x714F, 0x714F }, - 0x029E, 0x2084, 0x2086, - 0x24, 0x24, 0x24, - 0x00A9, 25, - }, - { /* PHY rev 6+ */ - { 6, 10, 16, 21 }, - { -7, 0, 4, 8 }, - { 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD, 0xD }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - 0x729E, - { 0x714F, 0x714F, 0x714F, 0x714F }, - 0x029E, 0x2084, 0x2086, - 0x24, 0x24, 0x24, /* low is invalid for radio rev 11! */ - 0x00F0, 25, - }, - }, -}; - -static inline void assert_ntab_array_sizes(void) -{ -#undef check -#define check(table, size) \ - BUILD_BUG_ON(ARRAY_SIZE(b43_ntab_##table) != B43_NTAB_##size##_SIZE) - - check(adjustpower0, C0_ADJPLT); - check(adjustpower1, C1_ADJPLT); - check(bdi, BDI); - check(channelest, CHANEST); - check(estimatepowerlt0, C0_ESTPLT); - check(estimatepowerlt1, C1_ESTPLT); - check(framelookup, FRAMELT); - check(framestruct, FRAMESTRUCT); - check(gainctl0, C0_GAINCTL); - check(gainctl1, C1_GAINCTL); - check(intlevel, INTLEVEL); - check(iqlt0, C0_IQLT); - check(iqlt1, C1_IQLT); - check(loftlt0, C0_LOFEEDTH); - check(loftlt1, C1_LOFEEDTH); - check(mcs, MCS); - check(noisevar10, NOISEVAR10); - check(noisevar11, NOISEVAR11); - check(pilot, PILOT); - check(pilotlt, PILOTLT); - check(tdi20a0, TDI20A0); - check(tdi20a1, TDI20A1); - check(tdi40a0, TDI40A0); - check(tdi40a1, TDI40A1); - check(tdtrn, TDTRN); - check(tmap, TMAP); - -#undef check -} - -u32 b43_ntab_read(struct b43_wldev *dev, u32 offset) -{ - u32 type, value; - - type = offset & B43_NTAB_TYPEMASK; - offset &= ~B43_NTAB_TYPEMASK; - B43_WARN_ON(offset > 0xFFFF); - - switch (type) { - case B43_NTAB_8BIT: - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset); - value = b43_phy_read(dev, B43_NPHY_TABLE_DATALO) & 0xFF; - break; - case B43_NTAB_16BIT: - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset); - value = b43_phy_read(dev, B43_NPHY_TABLE_DATALO); - break; - case B43_NTAB_32BIT: - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset); - value = b43_phy_read(dev, B43_NPHY_TABLE_DATALO); - value |= b43_phy_read(dev, B43_NPHY_TABLE_DATAHI) << 16; - break; - default: - B43_WARN_ON(1); - value = 0; - } - - return value; -} - -void b43_ntab_read_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, void *_data) -{ - u32 type; - u8 *data = _data; - unsigned int i; - - type = offset & B43_NTAB_TYPEMASK; - offset &= ~B43_NTAB_TYPEMASK; - B43_WARN_ON(offset > 0xFFFF); - - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset); - - for (i = 0; i < nr_elements; i++) { - /* Auto increment broken + caching issue on BCM43224? */ - if (dev->dev->chip_id == 43224 && dev->dev->chip_rev == 1) { - b43_phy_read(dev, B43_NPHY_TABLE_DATALO); - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset + i); - } - - switch (type) { - case B43_NTAB_8BIT: - *data = b43_phy_read(dev, B43_NPHY_TABLE_DATALO) & 0xFF; - data++; - break; - case B43_NTAB_16BIT: - *((u16 *)data) = b43_phy_read(dev, B43_NPHY_TABLE_DATALO); - data += 2; - break; - case B43_NTAB_32BIT: - *((u32 *)data) = - b43_phy_read(dev, B43_NPHY_TABLE_DATALO); - *((u32 *)data) |= - b43_phy_read(dev, B43_NPHY_TABLE_DATAHI) << 16; - data += 4; - break; - default: - B43_WARN_ON(1); - } - } -} - -void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value) -{ - u32 type; - - type = offset & B43_NTAB_TYPEMASK; - offset &= 0xFFFF; - - switch (type) { - case B43_NTAB_8BIT: - B43_WARN_ON(value & ~0xFF); - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, value); - break; - case B43_NTAB_16BIT: - B43_WARN_ON(value & ~0xFFFF); - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, value); - break; - case B43_NTAB_32BIT: - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset); - b43_phy_write(dev, B43_NPHY_TABLE_DATAHI, value >> 16); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, value & 0xFFFF); - break; - default: - B43_WARN_ON(1); - } - - return; - - /* Some compiletime assertions... */ - assert_ntab_array_sizes(); -} - -void b43_ntab_write_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, const void *_data) -{ - u32 type, value; - const u8 *data = _data; - unsigned int i; - - type = offset & B43_NTAB_TYPEMASK; - offset &= ~B43_NTAB_TYPEMASK; - B43_WARN_ON(offset > 0xFFFF); - - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset); - - for (i = 0; i < nr_elements; i++) { - /* Auto increment broken + caching issue on BCM43224? */ - if ((offset >> 10) == 9 && dev->dev->chip_id == 43224 && - dev->dev->chip_rev == 1) { - b43_phy_read(dev, B43_NPHY_TABLE_DATALO); - b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset + i); - } - - switch (type) { - case B43_NTAB_8BIT: - value = *data; - data++; - B43_WARN_ON(value & ~0xFF); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, value); - break; - case B43_NTAB_16BIT: - value = *((u16 *)data); - data += 2; - B43_WARN_ON(value & ~0xFFFF); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, value); - break; - case B43_NTAB_32BIT: - value = *((u32 *)data); - data += 4; - b43_phy_write(dev, B43_NPHY_TABLE_DATAHI, value >> 16); - b43_phy_write(dev, B43_NPHY_TABLE_DATALO, - value & 0xFFFF); - break; - default: - B43_WARN_ON(1); - } - } -} - -#define ntab_upload(dev, offset, data) do { \ - b43_ntab_write_bulk(dev, offset, ARRAY_SIZE(data), data); \ - } while (0) - -static void b43_nphy_tables_init_rev3(struct b43_wldev *dev) -{ - struct ssb_sprom *sprom = dev->dev->bus_sprom; - u8 antswlut; - - if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) - antswlut = sprom->fem.ghz5.antswlut; - else - antswlut = sprom->fem.ghz2.antswlut; - - /* Static tables */ - ntab_upload(dev, B43_NTAB_FRAMESTRUCT_R3, b43_ntab_framestruct_r3); - ntab_upload(dev, B43_NTAB_PILOT_R3, b43_ntab_pilot_r3); - ntab_upload(dev, B43_NTAB_TMAP_R3, b43_ntab_tmap_r3); - ntab_upload(dev, B43_NTAB_INTLEVEL_R3, b43_ntab_intlevel_r3); - ntab_upload(dev, B43_NTAB_TDTRN_R3, b43_ntab_tdtrn_r3); - ntab_upload(dev, B43_NTAB_NOISEVAR0_R3, b43_ntab_noisevar0_r3); - ntab_upload(dev, B43_NTAB_NOISEVAR1_R3, b43_ntab_noisevar1_r3); - ntab_upload(dev, B43_NTAB_MCS_R3, b43_ntab_mcs_r3); - ntab_upload(dev, B43_NTAB_TDI20A0_R3, b43_ntab_tdi20a0_r3); - ntab_upload(dev, B43_NTAB_TDI20A1_R3, b43_ntab_tdi20a1_r3); - ntab_upload(dev, B43_NTAB_TDI40A0_R3, b43_ntab_tdi40a0_r3); - ntab_upload(dev, B43_NTAB_TDI40A1_R3, b43_ntab_tdi40a1_r3); - ntab_upload(dev, B43_NTAB_PILOTLT_R3, b43_ntab_pilotlt_r3); - ntab_upload(dev, B43_NTAB_CHANEST_R3, b43_ntab_channelest_r3); - ntab_upload(dev, B43_NTAB_FRAMELT_R3, b43_ntab_framelookup_r3); - ntab_upload(dev, B43_NTAB_C0_ESTPLT_R3, b43_ntab_estimatepowerlt0_r3); - ntab_upload(dev, B43_NTAB_C1_ESTPLT_R3, b43_ntab_estimatepowerlt1_r3); - ntab_upload(dev, B43_NTAB_C0_ADJPLT_R3, b43_ntab_adjustpower0_r3); - ntab_upload(dev, B43_NTAB_C1_ADJPLT_R3, b43_ntab_adjustpower1_r3); - ntab_upload(dev, B43_NTAB_C0_GAINCTL_R3, b43_ntab_gainctl0_r3); - ntab_upload(dev, B43_NTAB_C1_GAINCTL_R3, b43_ntab_gainctl1_r3); - ntab_upload(dev, B43_NTAB_C0_IQLT_R3, b43_ntab_iqlt0_r3); - ntab_upload(dev, B43_NTAB_C1_IQLT_R3, b43_ntab_iqlt1_r3); - ntab_upload(dev, B43_NTAB_C0_LOFEEDTH_R3, b43_ntab_loftlt0_r3); - ntab_upload(dev, B43_NTAB_C1_LOFEEDTH_R3, b43_ntab_loftlt1_r3); - - /* Volatile tables */ - if (antswlut < ARRAY_SIZE(b43_ntab_antswctl_r3)) - ntab_upload(dev, B43_NTAB_ANT_SW_CTL_R3, - b43_ntab_antswctl_r3[antswlut]); - else - B43_WARN_ON(1); -} - -static void b43_nphy_tables_init_rev0(struct b43_wldev *dev) -{ - /* Static tables */ - ntab_upload(dev, B43_NTAB_FRAMESTRUCT, b43_ntab_framestruct); - ntab_upload(dev, B43_NTAB_FRAMELT, b43_ntab_framelookup); - ntab_upload(dev, B43_NTAB_TMAP, b43_ntab_tmap); - ntab_upload(dev, B43_NTAB_TDTRN, b43_ntab_tdtrn); - ntab_upload(dev, B43_NTAB_INTLEVEL, b43_ntab_intlevel); - ntab_upload(dev, B43_NTAB_PILOT, b43_ntab_pilot); - ntab_upload(dev, B43_NTAB_TDI20A0, b43_ntab_tdi20a0); - ntab_upload(dev, B43_NTAB_TDI20A1, b43_ntab_tdi20a1); - ntab_upload(dev, B43_NTAB_TDI40A0, b43_ntab_tdi40a0); - ntab_upload(dev, B43_NTAB_TDI40A1, b43_ntab_tdi40a1); - ntab_upload(dev, B43_NTAB_CHANEST, b43_ntab_channelest); - ntab_upload(dev, B43_NTAB_MCS, b43_ntab_mcs); - ntab_upload(dev, B43_NTAB_NOISEVAR10, b43_ntab_noisevar10); - ntab_upload(dev, B43_NTAB_NOISEVAR11, b43_ntab_noisevar11); - - /* Volatile tables */ - ntab_upload(dev, B43_NTAB_BDI, b43_ntab_bdi); - ntab_upload(dev, B43_NTAB_PILOTLT, b43_ntab_pilotlt); - ntab_upload(dev, B43_NTAB_C0_GAINCTL, b43_ntab_gainctl0); - ntab_upload(dev, B43_NTAB_C1_GAINCTL, b43_ntab_gainctl1); - ntab_upload(dev, B43_NTAB_C0_ESTPLT, b43_ntab_estimatepowerlt0); - ntab_upload(dev, B43_NTAB_C1_ESTPLT, b43_ntab_estimatepowerlt1); - ntab_upload(dev, B43_NTAB_C0_ADJPLT, b43_ntab_adjustpower0); - ntab_upload(dev, B43_NTAB_C1_ADJPLT, b43_ntab_adjustpower1); - ntab_upload(dev, B43_NTAB_C0_IQLT, b43_ntab_iqlt0); - ntab_upload(dev, B43_NTAB_C1_IQLT, b43_ntab_iqlt1); - ntab_upload(dev, B43_NTAB_C0_LOFEEDTH, b43_ntab_loftlt0); - ntab_upload(dev, B43_NTAB_C1_LOFEEDTH, b43_ntab_loftlt1); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/InitTables */ -void b43_nphy_tables_init(struct b43_wldev *dev) -{ - if (dev->phy.rev >= 3) - b43_nphy_tables_init_rev3(dev); - else - b43_nphy_tables_init_rev0(dev); -} - -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GetIpaGainTbl */ -static const u32 *b43_nphy_get_ipa_gain_table(struct b43_wldev *dev) -{ - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - if (dev->phy.rev >= 6) { - if (dev->dev->chip_id == 47162) - return txpwrctrl_tx_gain_ipa_rev5; - return txpwrctrl_tx_gain_ipa_rev6; - } else if (dev->phy.rev >= 5) { - return txpwrctrl_tx_gain_ipa_rev5; - } else { - return txpwrctrl_tx_gain_ipa; - } - } else { - return txpwrctrl_tx_gain_ipa_5g; - } -} - -const u32 *b43_nphy_get_tx_gain_table(struct b43_wldev *dev) -{ - enum ieee80211_band band = b43_current_band(dev->wl); - struct ssb_sprom *sprom = dev->dev->bus_sprom; - - if (dev->phy.rev < 3) - return b43_ntab_tx_gain_rev0_1_2; - - /* rev 3+ */ - if ((dev->phy.n->ipa2g_on && band == IEEE80211_BAND_2GHZ) || - (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ)) { - return b43_nphy_get_ipa_gain_table(dev); - } else if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) { - if (dev->phy.rev == 3) - return b43_ntab_tx_gain_rev3_5ghz; - if (dev->phy.rev == 4) - return sprom->fem.ghz5.extpa_gain == 3 ? - b43_ntab_tx_gain_rev4_5ghz : - b43_ntab_tx_gain_rev4_5ghz; /* FIXME */ - else - return b43_ntab_tx_gain_rev5plus_5ghz; - } else { - if (dev->phy.rev >= 5 && sprom->fem.ghz5.extpa_gain == 3) - return b43_ntab_tx_gain_rev3plus_2ghz; /* FIXME */ - else - return b43_ntab_tx_gain_rev3plus_2ghz; - } -} - -struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent( - struct b43_wldev *dev, bool ghz5, bool ext_lna) -{ - struct nphy_gain_ctl_workaround_entry *e; - u8 phy_idx; - - if (!ghz5 && dev->phy.rev >= 6 && dev->phy.radio_rev == 11) - return &nphy_gain_ctl_wa_phy6_radio11_ghz2; - - B43_WARN_ON(dev->phy.rev < 3); - if (dev->phy.rev >= 6) - phy_idx = 3; - else if (dev->phy.rev == 5) - phy_idx = 2; - else if (dev->phy.rev == 4) - phy_idx = 1; - else - phy_idx = 0; - e = &nphy_gain_ctl_workaround[ghz5][phy_idx]; - - /* Some workarounds to the workarounds... */ - if (ghz5 && dev->phy.rev >= 6) { - if (dev->phy.radio_rev == 11 && - !b43_channel_type_is_40mhz(dev->phy.channel_type)) - e->cliplo_gain = 0x2d; - } else if (!ghz5 && dev->phy.rev >= 5) { - static const int gain_data[] = {0x0062, 0x0064, 0x006a, 0x106a, - 0x106c, 0x1074, 0x107c, 0x207c}; - u8 tr_iso = dev->dev->bus_sprom->fem.ghz2.tr_iso; - - if (ext_lna) { - e->rfseq_init[0] &= ~0x4000; - e->rfseq_init[1] &= ~0x4000; - e->rfseq_init[2] &= ~0x4000; - e->rfseq_init[3] &= ~0x4000; - e->init_gain &= ~0x4000; - } - if (tr_iso > 7) - tr_iso = 3; - e->cliplo_gain = gain_data[tr_iso]; - - } else if (ghz5 && dev->phy.rev == 4 && ext_lna) { - e->rfseq_init[0] &= ~0x4000; - e->rfseq_init[1] &= ~0x4000; - e->rfseq_init[2] &= ~0x4000; - e->rfseq_init[3] &= ~0x4000; - e->init_gain &= ~0x4000; - e->rfseq_init[0] |= 0x1000; - e->rfseq_init[1] |= 0x1000; - e->rfseq_init[2] |= 0x1000; - e->rfseq_init[3] |= 0x1000; - e->init_gain |= 0x1000; - } - - return e; -} - -const struct nphy_rf_control_override_rev7 *b43_nphy_get_rf_ctl_over_rev7( - struct b43_wldev *dev, u16 field, u8 override) -{ - const struct nphy_rf_control_override_rev7 *e; - u8 size, i; - - switch (override) { - case 0: - e = tbl_rf_control_override_rev7_over0; - size = ARRAY_SIZE(tbl_rf_control_override_rev7_over0); - break; - case 1: - e = tbl_rf_control_override_rev7_over1; - size = ARRAY_SIZE(tbl_rf_control_override_rev7_over1); - break; - case 2: - e = tbl_rf_control_override_rev7_over2; - size = ARRAY_SIZE(tbl_rf_control_override_rev7_over2); - break; - default: - b43err(dev->wl, "Invalid override value %d\n", override); - return NULL; - } - - for (i = 0; i < size; i++) { - if (e[i].field == field) - return &e[i]; - } - - return NULL; -} diff --git a/drivers/net/wireless/b43/tables_nphy.h b/drivers/net/wireless/b43/tables_nphy.h deleted file mode 100644 index 9ff33adcff89..000000000000 --- a/drivers/net/wireless/b43/tables_nphy.h +++ /dev/null @@ -1,217 +0,0 @@ -#ifndef B43_TABLES_NPHY_H_ -#define B43_TABLES_NPHY_H_ - -#include - -struct b43_phy_n_sfo_cfg { - u16 phy_bw1a; - u16 phy_bw2; - u16 phy_bw3; - u16 phy_bw4; - u16 phy_bw5; - u16 phy_bw6; -}; - -struct b43_wldev; - -struct nphy_txiqcal_ladder { - u8 percent; - u8 g_env; -}; - -struct nphy_rf_control_override_rev2 { - u8 addr0; - u8 addr1; - u16 bmask; - u8 shift; -}; - -struct nphy_rf_control_override_rev3 { - u16 val_mask; - u8 val_shift; - u8 en_addr0; - u8 val_addr0; - u8 en_addr1; - u8 val_addr1; -}; - -struct nphy_rf_control_override_rev7 { - u16 field; - u16 val_addr_core0; - u16 val_addr_core1; - u16 val_mask; - u8 val_shift; -}; - -struct nphy_gain_ctl_workaround_entry { - s8 lna1_gain[4]; - s8 lna2_gain[4]; - u8 gain_db[10]; - u8 gain_bits[10]; - - u16 init_gain; - u16 rfseq_init[4]; - - u16 cliphi_gain; - u16 clipmd_gain; - u16 cliplo_gain; - - u16 crsmin; - u16 crsminl; - u16 crsminu; - - u16 nbclip; - u16 wlclip; -}; - -/* Get entry with workaround values for gain ctl. Does not return NULL. */ -struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent( - struct b43_wldev *dev, bool ghz5, bool ext_lna); - - -/* The N-PHY tables. */ -#define B43_NTAB_TYPEMASK 0xF0000000 -#define B43_NTAB_8BIT 0x10000000 -#define B43_NTAB_16BIT 0x20000000 -#define B43_NTAB_32BIT 0x30000000 -#define B43_NTAB8(table, offset) (((table) << 10) | (offset) | B43_NTAB_8BIT) -#define B43_NTAB16(table, offset) (((table) << 10) | (offset) | B43_NTAB_16BIT) -#define B43_NTAB32(table, offset) (((table) << 10) | (offset) | B43_NTAB_32BIT) - -/* Static N-PHY tables */ -#define B43_NTAB_FRAMESTRUCT B43_NTAB32(0x0A, 0x000) /* Frame Struct Table */ -#define B43_NTAB_FRAMESTRUCT_SIZE 832 -#define B43_NTAB_FRAMELT B43_NTAB8 (0x18, 0x000) /* Frame Lookup Table */ -#define B43_NTAB_FRAMELT_SIZE 32 -#define B43_NTAB_TMAP B43_NTAB32(0x0C, 0x000) /* T Map Table */ -#define B43_NTAB_TMAP_SIZE 448 -#define B43_NTAB_TDTRN B43_NTAB32(0x0E, 0x000) /* TDTRN Table */ -#define B43_NTAB_TDTRN_SIZE 704 -#define B43_NTAB_INTLEVEL B43_NTAB32(0x0D, 0x000) /* Int Level Table */ -#define B43_NTAB_INTLEVEL_SIZE 7 -#define B43_NTAB_PILOT B43_NTAB16(0x0B, 0x000) /* Pilot Table */ -#define B43_NTAB_PILOT_SIZE 88 -#define B43_NTAB_PILOTLT B43_NTAB32(0x14, 0x000) /* Pilot Lookup Table */ -#define B43_NTAB_PILOTLT_SIZE 6 -#define B43_NTAB_TDI20A0 B43_NTAB32(0x13, 0x080) /* TDI Table 20 Antenna 0 */ -#define B43_NTAB_TDI20A0_SIZE 55 -#define B43_NTAB_TDI20A1 B43_NTAB32(0x13, 0x100) /* TDI Table 20 Antenna 1 */ -#define B43_NTAB_TDI20A1_SIZE 55 -#define B43_NTAB_TDI40A0 B43_NTAB32(0x13, 0x280) /* TDI Table 40 Antenna 0 */ -#define B43_NTAB_TDI40A0_SIZE 110 -#define B43_NTAB_TDI40A1 B43_NTAB32(0x13, 0x300) /* TDI Table 40 Antenna 1 */ -#define B43_NTAB_TDI40A1_SIZE 110 -#define B43_NTAB_BDI B43_NTAB16(0x15, 0x000) /* BDI Table */ -#define B43_NTAB_BDI_SIZE 6 -#define B43_NTAB_CHANEST B43_NTAB32(0x16, 0x000) /* Channel Estimate Table */ -#define B43_NTAB_CHANEST_SIZE 96 -#define B43_NTAB_MCS B43_NTAB8 (0x12, 0x000) /* MCS Table */ -#define B43_NTAB_MCS_SIZE 128 - -/* Volatile N-PHY tables */ -#define B43_NTAB_NOISEVAR10 B43_NTAB32(0x10, 0x000) /* Noise Var Table 10 */ -#define B43_NTAB_NOISEVAR10_SIZE 256 -#define B43_NTAB_NOISEVAR11 B43_NTAB32(0x10, 0x080) /* Noise Var Table 11 */ -#define B43_NTAB_NOISEVAR11_SIZE 256 -#define B43_NTAB_C0_ESTPLT B43_NTAB8 (0x1A, 0x000) /* Estimate Power Lookup Table Core 0 */ -#define B43_NTAB_C0_ESTPLT_SIZE 64 -#define B43_NTAB_C0_ADJPLT B43_NTAB8 (0x1A, 0x040) /* Adjust Power Lookup Table Core 0 */ -#define B43_NTAB_C0_ADJPLT_SIZE 128 -#define B43_NTAB_C0_GAINCTL B43_NTAB32(0x1A, 0x0C0) /* Gain Control Lookup Table Core 0 */ -#define B43_NTAB_C0_GAINCTL_SIZE 128 -#define B43_NTAB_C0_IQLT B43_NTAB32(0x1A, 0x140) /* IQ Lookup Table Core 0 */ -#define B43_NTAB_C0_IQLT_SIZE 128 -#define B43_NTAB_C0_LOFEEDTH B43_NTAB16(0x1A, 0x1C0) /* Local Oscillator Feed Through Lookup Table Core 0 */ -#define B43_NTAB_C0_LOFEEDTH_SIZE 128 -#define B43_NTAB_C1_ESTPLT B43_NTAB8 (0x1B, 0x000) /* Estimate Power Lookup Table Core 1 */ -#define B43_NTAB_C1_ESTPLT_SIZE 64 -#define B43_NTAB_C1_ADJPLT B43_NTAB8 (0x1B, 0x040) /* Adjust Power Lookup Table Core 1 */ -#define B43_NTAB_C1_ADJPLT_SIZE 128 -#define B43_NTAB_C1_GAINCTL B43_NTAB32(0x1B, 0x0C0) /* Gain Control Lookup Table Core 1 */ -#define B43_NTAB_C1_GAINCTL_SIZE 128 -#define B43_NTAB_C1_IQLT B43_NTAB32(0x1B, 0x140) /* IQ Lookup Table Core 1 */ -#define B43_NTAB_C1_IQLT_SIZE 128 -#define B43_NTAB_C1_LOFEEDTH B43_NTAB16(0x1B, 0x1C0) /* Local Oscillator Feed Through Lookup Table Core 1 */ -#define B43_NTAB_C1_LOFEEDTH_SIZE 128 - -/* Volatile N-PHY tables, PHY revision >= 3 */ -#define B43_NTAB_ANT_SW_CTL_R3 B43_NTAB16( 9, 0) /* antenna software control */ - -/* Static N-PHY tables, PHY revision >= 3 */ -#define B43_NTAB_FRAMESTRUCT_R3 B43_NTAB32(10, 0) /* frame struct */ -#define B43_NTAB_PILOT_R3 B43_NTAB16(11, 0) /* pilot */ -#define B43_NTAB_TMAP_R3 B43_NTAB32(12, 0) /* TM AP */ -#define B43_NTAB_INTLEVEL_R3 B43_NTAB32(13, 0) /* INT LV */ -#define B43_NTAB_TDTRN_R3 B43_NTAB32(14, 0) /* TD TRN */ -#define B43_NTAB_NOISEVAR0_R3 B43_NTAB32(16, 0) /* noise variance 0 */ -#define B43_NTAB_NOISEVAR1_R3 B43_NTAB32(16, 128) /* noise variance 1 */ -#define B43_NTAB_MCS_R3 B43_NTAB16(18, 0) /* MCS */ -#define B43_NTAB_TDI20A0_R3 B43_NTAB32(19, 128) /* TDI 20/0 */ -#define B43_NTAB_TDI20A1_R3 B43_NTAB32(19, 256) /* TDI 20/1 */ -#define B43_NTAB_TDI40A0_R3 B43_NTAB32(19, 640) /* TDI 40/0 */ -#define B43_NTAB_TDI40A1_R3 B43_NTAB32(19, 768) /* TDI 40/1 */ -#define B43_NTAB_PILOTLT_R3 B43_NTAB32(20, 0) /* PLT lookup */ -#define B43_NTAB_CHANEST_R3 B43_NTAB32(22, 0) /* channel estimate */ -#define B43_NTAB_FRAMELT_R3 B43_NTAB8(24, 0) /* frame lookup */ -#define B43_NTAB_C0_ESTPLT_R3 B43_NTAB8(26, 0) /* estimated power lookup 0 */ -#define B43_NTAB_C0_ADJPLT_R3 B43_NTAB8(26, 64) /* adjusted power lookup 0 */ -#define B43_NTAB_C0_GAINCTL_R3 B43_NTAB32(26, 192) /* gain control lookup 0 */ -#define B43_NTAB_C0_IQLT_R3 B43_NTAB32(26, 320) /* I/Q lookup 0 */ -#define B43_NTAB_C0_LOFEEDTH_R3 B43_NTAB16(26, 448) /* Local Oscillator Feed Through lookup 0 */ -#define B43_NTAB_C0_PAPD_COMP_R3 B43_NTAB16(26, 576) -#define B43_NTAB_C1_ESTPLT_R3 B43_NTAB8(27, 0) /* estimated power lookup 1 */ -#define B43_NTAB_C1_ADJPLT_R3 B43_NTAB8(27, 64) /* adjusted power lookup 1 */ -#define B43_NTAB_C1_GAINCTL_R3 B43_NTAB32(27, 192) /* gain control lookup 1 */ -#define B43_NTAB_C1_IQLT_R3 B43_NTAB32(27, 320) /* I/Q lookup 1 */ -#define B43_NTAB_C1_LOFEEDTH_R3 B43_NTAB16(27, 448) /* Local Oscillator Feed Through lookup 1 */ -#define B43_NTAB_C1_PAPD_COMP_R3 B43_NTAB16(27, 576) - -#define B43_NTAB_TX_IQLO_CAL_LOFT_LADDER_40_SIZE 18 -#define B43_NTAB_TX_IQLO_CAL_LOFT_LADDER_20_SIZE 18 -#define B43_NTAB_TX_IQLO_CAL_IQIMB_LADDER_40_SIZE 18 -#define B43_NTAB_TX_IQLO_CAL_IQIMB_LADDER_20_SIZE 18 -#define B43_NTAB_TX_IQLO_CAL_STARTCOEFS_REV3 11 -#define B43_NTAB_TX_IQLO_CAL_STARTCOEFS 9 -#define B43_NTAB_TX_IQLO_CAL_CMDS_RECAL_REV3 12 -#define B43_NTAB_TX_IQLO_CAL_CMDS_RECAL 10 -#define B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL 10 -#define B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL_REV3 12 - -u32 b43_ntab_read(struct b43_wldev *dev, u32 offset); -void b43_ntab_read_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, void *_data); -void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value); -void b43_ntab_write_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, const void *_data); - -void b43_nphy_tables_init(struct b43_wldev *dev); - -const u32 *b43_nphy_get_tx_gain_table(struct b43_wldev *dev); - -extern const s8 b43_ntab_papd_pga_gain_delta_ipa_2g[]; - -extern const u16 tbl_iqcal_gainparams[2][9][8]; -extern const struct nphy_txiqcal_ladder ladder_lo[]; -extern const struct nphy_txiqcal_ladder ladder_iq[]; -extern const u16 loscale[]; - -extern const u16 tbl_tx_iqlo_cal_loft_ladder_40[]; -extern const u16 tbl_tx_iqlo_cal_loft_ladder_20[]; -extern const u16 tbl_tx_iqlo_cal_iqimb_ladder_40[]; -extern const u16 tbl_tx_iqlo_cal_iqimb_ladder_20[]; -extern const u16 tbl_tx_iqlo_cal_startcoefs_nphyrev3[]; -extern const u16 tbl_tx_iqlo_cal_startcoefs[]; -extern const u16 tbl_tx_iqlo_cal_cmds_recal_nphyrev3[]; -extern const u16 tbl_tx_iqlo_cal_cmds_recal[]; -extern const u16 tbl_tx_iqlo_cal_cmds_fullcal[]; -extern const u16 tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[]; -extern const s16 tbl_tx_filter_coef_rev4[7][15]; - -extern const struct nphy_rf_control_override_rev2 - tbl_rf_control_override_rev2[]; -extern const struct nphy_rf_control_override_rev3 - tbl_rf_control_override_rev3[]; -const struct nphy_rf_control_override_rev7 *b43_nphy_get_rf_ctl_over_rev7( - struct b43_wldev *dev, u16 field, u8 override); - -#endif /* B43_TABLES_NPHY_H_ */ diff --git a/drivers/net/wireless/b43/tables_phy_ht.c b/drivers/net/wireless/b43/tables_phy_ht.c deleted file mode 100644 index 176c49d74ef4..000000000000 --- a/drivers/net/wireless/b43/tables_phy_ht.c +++ /dev/null @@ -1,836 +0,0 @@ -/* - - Broadcom B43 wireless driver - IEEE 802.11n HT-PHY data tables - - Copyright (c) 2011 Rafał Miłecki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "tables_phy_ht.h" -#include "phy_common.h" -#include "phy_ht.h" - -static const u16 b43_httab_0x12[] = { - 0x0000, 0x0008, 0x000a, 0x0010, 0x0012, 0x0019, - 0x001a, 0x001c, 0x0080, 0x0088, 0x008a, 0x0090, - 0x0092, 0x0099, 0x009a, 0x009c, 0x0100, 0x0108, - 0x010a, 0x0110, 0x0112, 0x0119, 0x011a, 0x011c, - 0x0180, 0x0188, 0x018a, 0x0190, 0x0192, 0x0199, - 0x019a, 0x019c, 0x0000, 0x0098, 0x00a0, 0x00a8, - 0x009a, 0x00a2, 0x00aa, 0x0120, 0x0128, 0x0128, - 0x0130, 0x0138, 0x0138, 0x0140, 0x0122, 0x012a, - 0x012a, 0x0132, 0x013a, 0x013a, 0x0142, 0x01a8, - 0x01b0, 0x01b8, 0x01b0, 0x01b8, 0x01c0, 0x01c8, - 0x01c0, 0x01c8, 0x01d0, 0x01d0, 0x01d8, 0x01aa, - 0x01b2, 0x01ba, 0x01b2, 0x01ba, 0x01c2, 0x01ca, - 0x01c2, 0x01ca, 0x01d2, 0x01d2, 0x01da, 0x0001, - 0x0002, 0x0004, 0x0009, 0x000c, 0x0011, 0x0014, - 0x0018, 0x0020, 0x0021, 0x0022, 0x0024, 0x0081, - 0x0082, 0x0084, 0x0089, 0x008c, 0x0091, 0x0094, - 0x0098, 0x00a0, 0x00a1, 0x00a2, 0x00a4, 0x0007, - 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, - 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, - 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, - 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, - 0x0007, 0x0007, -}; - -static const u16 b43_httab_0x27[] = { - 0x0009, 0x000e, 0x0011, 0x0014, 0x0017, 0x001a, - 0x001d, 0x0020, 0x0009, 0x000e, 0x0011, 0x0014, - 0x0017, 0x001a, 0x001d, 0x0020, 0x0009, 0x000e, - 0x0011, 0x0014, 0x0017, 0x001a, 0x001d, 0x0020, - 0x0009, 0x000e, 0x0011, 0x0014, 0x0017, 0x001a, - 0x001d, 0x0020, -}; - -static const u16 b43_httab_0x26[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, -}; - -static const u32 b43_httab_0x25[] = { - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static const u32 b43_httab_0x2f[] = { - 0x00035700, 0x0002cc9a, 0x00026666, 0x0001581f, - 0x0001581f, 0x0001581f, 0x0001581f, 0x0001581f, - 0x0001581f, 0x0001581f, 0x0001581f, 0x00035700, - 0x0002cc9a, 0x00026666, 0x0001581f, 0x0001581f, - 0x0001581f, 0x0001581f, 0x0001581f, 0x0001581f, - 0x0001581f, 0x0001581f, -}; - -static const u16 b43_httab_0x1a[] = { - 0x0055, 0x0054, 0x0054, 0x0053, 0x0052, 0x0052, - 0x0051, 0x0051, 0x0050, 0x004f, 0x004f, 0x004e, - 0x004e, 0x004d, 0x004c, 0x004c, 0x004b, 0x004a, - 0x0049, 0x0049, 0x0048, 0x0047, 0x0046, 0x0046, - 0x0045, 0x0044, 0x0043, 0x0042, 0x0041, 0x0040, - 0x0040, 0x003f, 0x003e, 0x003d, 0x003c, 0x003a, - 0x0039, 0x0038, 0x0037, 0x0036, 0x0035, 0x0033, - 0x0032, 0x0031, 0x002f, 0x002e, 0x002c, 0x002b, - 0x0029, 0x0027, 0x0025, 0x0023, 0x0021, 0x001f, - 0x001d, 0x001a, 0x0018, 0x0015, 0x0012, 0x000e, - 0x000b, 0x0007, 0x0002, 0x00fd, -}; - -static const u16 b43_httab_0x1b[] = { - 0x0055, 0x0054, 0x0054, 0x0053, 0x0052, 0x0052, - 0x0051, 0x0051, 0x0050, 0x004f, 0x004f, 0x004e, - 0x004e, 0x004d, 0x004c, 0x004c, 0x004b, 0x004a, - 0x0049, 0x0049, 0x0048, 0x0047, 0x0046, 0x0046, - 0x0045, 0x0044, 0x0043, 0x0042, 0x0041, 0x0040, - 0x0040, 0x003f, 0x003e, 0x003d, 0x003c, 0x003a, - 0x0039, 0x0038, 0x0037, 0x0036, 0x0035, 0x0033, - 0x0032, 0x0031, 0x002f, 0x002e, 0x002c, 0x002b, - 0x0029, 0x0027, 0x0025, 0x0023, 0x0021, 0x001f, - 0x001d, 0x001a, 0x0018, 0x0015, 0x0012, 0x000e, - 0x000b, 0x0007, 0x0002, 0x00fd, -}; - -static const u16 b43_httab_0x1c[] = { - 0x0055, 0x0054, 0x0054, 0x0053, 0x0052, 0x0052, - 0x0051, 0x0051, 0x0050, 0x004f, 0x004f, 0x004e, - 0x004e, 0x004d, 0x004c, 0x004c, 0x004b, 0x004a, - 0x0049, 0x0049, 0x0048, 0x0047, 0x0046, 0x0046, - 0x0045, 0x0044, 0x0043, 0x0042, 0x0041, 0x0040, - 0x0040, 0x003f, 0x003e, 0x003d, 0x003c, 0x003a, - 0x0039, 0x0038, 0x0037, 0x0036, 0x0035, 0x0033, - 0x0032, 0x0031, 0x002f, 0x002e, 0x002c, 0x002b, - 0x0029, 0x0027, 0x0025, 0x0023, 0x0021, 0x001f, - 0x001d, 0x001a, 0x0018, 0x0015, 0x0012, 0x000e, - 0x000b, 0x0007, 0x0002, 0x00fd, -}; - -static const u32 b43_httab_0x1a_0xc0[] = { - 0x5bf70044, 0x5bf70042, 0x5bf70040, 0x5bf7003e, - 0x5bf7003c, 0x5bf7003b, 0x5bf70039, 0x5bf70037, - 0x5bf70036, 0x5bf70034, 0x5bf70033, 0x5bf70031, - 0x5bf70030, 0x5ba70044, 0x5ba70042, 0x5ba70040, - 0x5ba7003e, 0x5ba7003c, 0x5ba7003b, 0x5ba70039, - 0x5ba70037, 0x5ba70036, 0x5ba70034, 0x5ba70033, - 0x5b770044, 0x5b770042, 0x5b770040, 0x5b77003e, - 0x5b77003c, 0x5b77003b, 0x5b770039, 0x5b770037, - 0x5b770036, 0x5b770034, 0x5b770033, 0x5b770031, - 0x5b770030, 0x5b77002f, 0x5b77002d, 0x5b77002c, - 0x5b470044, 0x5b470042, 0x5b470040, 0x5b47003e, - 0x5b47003c, 0x5b47003b, 0x5b470039, 0x5b470037, - 0x5b470036, 0x5b470034, 0x5b470033, 0x5b470031, - 0x5b470030, 0x5b47002f, 0x5b47002d, 0x5b47002c, - 0x5b47002b, 0x5b47002a, 0x5b270044, 0x5b270042, - 0x5b270040, 0x5b27003e, 0x5b27003c, 0x5b27003b, - 0x5b270039, 0x5b270037, 0x5b270036, 0x5b270034, - 0x5b270033, 0x5b270031, 0x5b270030, 0x5b27002f, - 0x5b170044, 0x5b170042, 0x5b170040, 0x5b17003e, - 0x5b17003c, 0x5b17003b, 0x5b170039, 0x5b170037, - 0x5b170036, 0x5b170034, 0x5b170033, 0x5b170031, - 0x5b170030, 0x5b17002f, 0x5b17002d, 0x5b17002c, - 0x5b17002b, 0x5b17002a, 0x5b170028, 0x5b170027, - 0x5b170026, 0x5b170025, 0x5b170024, 0x5b170023, - 0x5b070044, 0x5b070042, 0x5b070040, 0x5b07003e, - 0x5b07003c, 0x5b07003b, 0x5b070039, 0x5b070037, - 0x5b070036, 0x5b070034, 0x5b070033, 0x5b070031, - 0x5b070030, 0x5b07002f, 0x5b07002d, 0x5b07002c, - 0x5b07002b, 0x5b07002a, 0x5b070028, 0x5b070027, - 0x5b070026, 0x5b070025, 0x5b070024, 0x5b070023, - 0x5b070022, 0x5b070021, 0x5b070020, 0x5b07001f, - 0x5b07001e, 0x5b07001d, 0x5b07001d, 0x5b07001c, -}; - -static const u32 b43_httab_0x1a_0x140[] = { - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static const u32 b43_httab_0x1b_0x140[] = { - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static const u32 b43_httab_0x1c_0x140[] = { - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static const u16 b43_httab_0x1a_0x1c0[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, -}; - -static const u16 b43_httab_0x1b_0x1c0[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, -}; - -static const u16 b43_httab_0x1c_0x1c0[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, -}; - -static const u16 b43_httab_0x1a_0x240[] = { - 0x0036, 0x0036, 0x0036, 0x0036, 0x0036, 0x0036, - 0x0036, 0x0036, 0x0036, 0x0036, 0x0036, 0x0036, - 0x0036, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, - 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, - 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, - 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, - 0x001e, 0x001e, 0x001e, 0x001e, 0x000e, 0x000e, - 0x000e, 0x000e, 0x000e, 0x000e, 0x000e, 0x000e, - 0x000e, 0x000e, 0x000e, 0x000e, 0x000e, 0x000e, - 0x000e, 0x000e, 0x000e, 0x000e, 0x01fc, 0x01fc, - 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, - 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, - 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, - 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, - 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, - 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, -}; - -static const u16 b43_httab_0x1b_0x240[] = { - 0x0036, 0x0036, 0x0036, 0x0036, 0x0036, 0x0036, - 0x0036, 0x0036, 0x0036, 0x0036, 0x0036, 0x0036, - 0x0036, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, - 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, - 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, - 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, - 0x001e, 0x001e, 0x001e, 0x001e, 0x000e, 0x000e, - 0x000e, 0x000e, 0x000e, 0x000e, 0x000e, 0x000e, - 0x000e, 0x000e, 0x000e, 0x000e, 0x000e, 0x000e, - 0x000e, 0x000e, 0x000e, 0x000e, 0x01fc, 0x01fc, - 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, - 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, - 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, - 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, - 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, - 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, -}; - -static const u16 b43_httab_0x1c_0x240[] = { - 0x0036, 0x0036, 0x0036, 0x0036, 0x0036, 0x0036, - 0x0036, 0x0036, 0x0036, 0x0036, 0x0036, 0x0036, - 0x0036, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, - 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a, - 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, - 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, - 0x001e, 0x001e, 0x001e, 0x001e, 0x000e, 0x000e, - 0x000e, 0x000e, 0x000e, 0x000e, 0x000e, 0x000e, - 0x000e, 0x000e, 0x000e, 0x000e, 0x000e, 0x000e, - 0x000e, 0x000e, 0x000e, 0x000e, 0x01fc, 0x01fc, - 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, - 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, - 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, - 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, - 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, - 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, - 0x01d6, 0x01d6, -}; - -static const u32 b43_httab_0x1f[] = { - 0x00000000, 0x00000000, 0x00016023, 0x00006028, - 0x00034036, 0x0003402e, 0x0007203c, 0x0006e037, - 0x00070030, 0x0009401f, 0x0009a00f, 0x000b600d, - 0x000c8007, 0x000ce007, 0x00101fff, 0x00121ff9, - 0x0012e004, 0x0014dffc, 0x0016dff6, 0x0018dfe9, - 0x001b3fe5, 0x001c5fd0, 0x001ddfc2, 0x001f1fb6, - 0x00207fa4, 0x00219f8f, 0x0022ff7d, 0x00247f6c, - 0x0024df5b, 0x00267f4b, 0x0027df3b, 0x0029bf3b, - 0x002b5f2f, 0x002d3f2e, 0x002f5f2a, 0x002fff15, - 0x00315f0b, 0x0032defa, 0x0033beeb, 0x0034fed9, - 0x00353ec5, 0x00361eb0, 0x00363e9b, 0x0036be87, - 0x0036be70, 0x0038fe67, 0x0044beb2, 0x00513ef3, - 0x00595f11, 0x00669f3d, 0x0078dfdf, 0x00a143aa, - 0x01642fff, 0x0162afff, 0x01620fff, 0x0160cfff, - 0x015f0fff, 0x015dafff, 0x015bcfff, 0x015bcfff, - 0x015b4fff, 0x015acfff, 0x01590fff, 0x0156cfff, -}; - -static const u32 b43_httab_0x21[] = { - 0x00000000, 0x00000000, 0x00016023, 0x00006028, - 0x00034036, 0x0003402e, 0x0007203c, 0x0006e037, - 0x00070030, 0x0009401f, 0x0009a00f, 0x000b600d, - 0x000c8007, 0x000ce007, 0x00101fff, 0x00121ff9, - 0x0012e004, 0x0014dffc, 0x0016dff6, 0x0018dfe9, - 0x001b3fe5, 0x001c5fd0, 0x001ddfc2, 0x001f1fb6, - 0x00207fa4, 0x00219f8f, 0x0022ff7d, 0x00247f6c, - 0x0024df5b, 0x00267f4b, 0x0027df3b, 0x0029bf3b, - 0x002b5f2f, 0x002d3f2e, 0x002f5f2a, 0x002fff15, - 0x00315f0b, 0x0032defa, 0x0033beeb, 0x0034fed9, - 0x00353ec5, 0x00361eb0, 0x00363e9b, 0x0036be87, - 0x0036be70, 0x0038fe67, 0x0044beb2, 0x00513ef3, - 0x00595f11, 0x00669f3d, 0x0078dfdf, 0x00a143aa, - 0x01642fff, 0x0162afff, 0x01620fff, 0x0160cfff, - 0x015f0fff, 0x015dafff, 0x015bcfff, 0x015bcfff, - 0x015b4fff, 0x015acfff, 0x01590fff, 0x0156cfff, -}; - -static const u32 b43_httab_0x23[] = { - 0x00000000, 0x00000000, 0x00016023, 0x00006028, - 0x00034036, 0x0003402e, 0x0007203c, 0x0006e037, - 0x00070030, 0x0009401f, 0x0009a00f, 0x000b600d, - 0x000c8007, 0x000ce007, 0x00101fff, 0x00121ff9, - 0x0012e004, 0x0014dffc, 0x0016dff6, 0x0018dfe9, - 0x001b3fe5, 0x001c5fd0, 0x001ddfc2, 0x001f1fb6, - 0x00207fa4, 0x00219f8f, 0x0022ff7d, 0x00247f6c, - 0x0024df5b, 0x00267f4b, 0x0027df3b, 0x0029bf3b, - 0x002b5f2f, 0x002d3f2e, 0x002f5f2a, 0x002fff15, - 0x00315f0b, 0x0032defa, 0x0033beeb, 0x0034fed9, - 0x00353ec5, 0x00361eb0, 0x00363e9b, 0x0036be87, - 0x0036be70, 0x0038fe67, 0x0044beb2, 0x00513ef3, - 0x00595f11, 0x00669f3d, 0x0078dfdf, 0x00a143aa, - 0x01642fff, 0x0162afff, 0x01620fff, 0x0160cfff, - 0x015f0fff, 0x015dafff, 0x015bcfff, 0x015bcfff, - 0x015b4fff, 0x015acfff, 0x01590fff, 0x0156cfff, -}; - -static const u32 b43_httab_0x20[] = { - 0x0b5e002d, 0x0ae2002f, 0x0a3b0032, 0x09a70035, - 0x09220038, 0x08ab003b, 0x081f003f, 0x07a20043, - 0x07340047, 0x06d2004b, 0x067a004f, 0x06170054, - 0x05bf0059, 0x0571005e, 0x051e0064, 0x04d3006a, - 0x04910070, 0x044c0077, 0x040f007e, 0x03d90085, - 0x03a1008d, 0x036f0095, 0x033d009e, 0x030b00a8, - 0x02e000b2, 0x02b900bc, 0x029200c7, 0x026d00d3, - 0x024900e0, 0x022900ed, 0x020a00fb, 0x01ec010a, - 0x01d20119, 0x01b7012a, 0x019e013c, 0x0188014e, - 0x01720162, 0x015d0177, 0x0149018e, 0x013701a5, - 0x012601be, 0x011501d8, 0x010601f4, 0x00f70212, - 0x00e90231, 0x00dc0253, 0x00d00276, 0x00c4029b, - 0x00b902c3, 0x00af02ed, 0x00a50319, 0x009c0348, - 0x0093037a, 0x008b03af, 0x008303e6, 0x007c0422, - 0x00750460, 0x006e04a3, 0x006804e9, 0x00620533, - 0x005d0582, 0x005805d6, 0x0053062e, 0x004e068c, -}; - -static const u32 b43_httab_0x22[] = { - 0x0b5e002d, 0x0ae2002f, 0x0a3b0032, 0x09a70035, - 0x09220038, 0x08ab003b, 0x081f003f, 0x07a20043, - 0x07340047, 0x06d2004b, 0x067a004f, 0x06170054, - 0x05bf0059, 0x0571005e, 0x051e0064, 0x04d3006a, - 0x04910070, 0x044c0077, 0x040f007e, 0x03d90085, - 0x03a1008d, 0x036f0095, 0x033d009e, 0x030b00a8, - 0x02e000b2, 0x02b900bc, 0x029200c7, 0x026d00d3, - 0x024900e0, 0x022900ed, 0x020a00fb, 0x01ec010a, - 0x01d20119, 0x01b7012a, 0x019e013c, 0x0188014e, - 0x01720162, 0x015d0177, 0x0149018e, 0x013701a5, - 0x012601be, 0x011501d8, 0x010601f4, 0x00f70212, - 0x00e90231, 0x00dc0253, 0x00d00276, 0x00c4029b, - 0x00b902c3, 0x00af02ed, 0x00a50319, 0x009c0348, - 0x0093037a, 0x008b03af, 0x008303e6, 0x007c0422, - 0x00750460, 0x006e04a3, 0x006804e9, 0x00620533, - 0x005d0582, 0x005805d6, 0x0053062e, 0x004e068c, -}; - -static const u32 b43_httab_0x24[] = { - 0x0b5e002d, 0x0ae2002f, 0x0a3b0032, 0x09a70035, - 0x09220038, 0x08ab003b, 0x081f003f, 0x07a20043, - 0x07340047, 0x06d2004b, 0x067a004f, 0x06170054, - 0x05bf0059, 0x0571005e, 0x051e0064, 0x04d3006a, - 0x04910070, 0x044c0077, 0x040f007e, 0x03d90085, - 0x03a1008d, 0x036f0095, 0x033d009e, 0x030b00a8, - 0x02e000b2, 0x02b900bc, 0x029200c7, 0x026d00d3, - 0x024900e0, 0x022900ed, 0x020a00fb, 0x01ec010a, - 0x01d20119, 0x01b7012a, 0x019e013c, 0x0188014e, - 0x01720162, 0x015d0177, 0x0149018e, 0x013701a5, - 0x012601be, 0x011501d8, 0x010601f4, 0x00f70212, - 0x00e90231, 0x00dc0253, 0x00d00276, 0x00c4029b, - 0x00b902c3, 0x00af02ed, 0x00a50319, 0x009c0348, - 0x0093037a, 0x008b03af, 0x008303e6, 0x007c0422, - 0x00750460, 0x006e04a3, 0x006804e9, 0x00620533, - 0x005d0582, 0x005805d6, 0x0053062e, 0x004e068c, -}; - -/* Some late-init table */ -const u32 b43_httab_0x1a_0xc0_late[] = { - 0x10f90040, 0x10e10040, 0x10e1003c, 0x10c9003d, - 0x10b9003c, 0x10a9003d, 0x10a1003c, 0x1099003b, - 0x1091003b, 0x1089003a, 0x1081003a, 0x10790039, - 0x10710039, 0x1069003a, 0x1061003b, 0x1059003d, - 0x1051003f, 0x10490042, 0x1049003e, 0x1049003b, - 0x1041003e, 0x1041003b, 0x1039003e, 0x1039003b, - 0x10390038, 0x10390035, 0x1031003a, 0x10310036, - 0x10310033, 0x1029003a, 0x10290037, 0x10290034, - 0x10290031, 0x10210039, 0x10210036, 0x10210033, - 0x10210030, 0x1019003c, 0x10190039, 0x10190036, - 0x10190033, 0x10190030, 0x1019002d, 0x1019002b, - 0x10190028, 0x1011003a, 0x10110036, 0x10110033, - 0x10110030, 0x1011002e, 0x1011002b, 0x10110029, - 0x10110027, 0x10110024, 0x10110022, 0x10110020, - 0x1011001f, 0x1011001d, 0x1009003a, 0x10090037, - 0x10090034, 0x10090031, 0x1009002e, 0x1009002c, - 0x10090029, 0x10090027, 0x10090025, 0x10090023, - 0x10090021, 0x1009001f, 0x1009001d, 0x1009001b, - 0x1009001a, 0x10090018, 0x10090017, 0x10090016, - 0x10090015, 0x10090013, 0x10090012, 0x10090011, - 0x10090010, 0x1009000f, 0x1009000f, 0x1009000e, - 0x1009000d, 0x1009000c, 0x1009000c, 0x1009000b, - 0x1009000a, 0x1009000a, 0x10090009, 0x10090009, - 0x10090008, 0x10090008, 0x10090007, 0x10090007, - 0x10090007, 0x10090006, 0x10090006, 0x10090005, - 0x10090005, 0x10090005, 0x10090005, 0x10090004, - 0x10090004, 0x10090004, 0x10090004, 0x10090003, - 0x10090003, 0x10090003, 0x10090003, 0x10090003, - 0x10090003, 0x10090002, 0x10090002, 0x10090002, - 0x10090002, 0x10090002, 0x10090002, 0x10090002, - 0x10090002, 0x10090002, 0x10090001, 0x10090001, - 0x10090001, 0x10090001, 0x10090001, 0x10090001, -}; - -/************************************************** - * R/W ops. - **************************************************/ - -u32 b43_httab_read(struct b43_wldev *dev, u32 offset) -{ - u32 type, value; - - type = offset & B43_HTTAB_TYPEMASK; - offset &= ~B43_HTTAB_TYPEMASK; - B43_WARN_ON(offset > 0xFFFF); - - switch (type) { - case B43_HTTAB_8BIT: - b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset); - value = b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO) & 0xFF; - break; - case B43_HTTAB_16BIT: - b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset); - value = b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO); - break; - case B43_HTTAB_32BIT: - b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset); - value = b43_phy_read(dev, B43_PHY_HT_TABLE_DATAHI); - value <<= 16; - value |= b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO); - break; - default: - B43_WARN_ON(1); - value = 0; - } - - return value; -} - -void b43_httab_read_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, void *_data) -{ - u32 type; - u8 *data = _data; - unsigned int i; - - type = offset & B43_HTTAB_TYPEMASK; - offset &= ~B43_HTTAB_TYPEMASK; - B43_WARN_ON(offset > 0xFFFF); - - b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset); - - for (i = 0; i < nr_elements; i++) { - switch (type) { - case B43_HTTAB_8BIT: - *data = b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO) & 0xFF; - data++; - break; - case B43_HTTAB_16BIT: - *((u16 *)data) = b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO); - data += 2; - break; - case B43_HTTAB_32BIT: - *((u32 *)data) = b43_phy_read(dev, B43_PHY_HT_TABLE_DATAHI); - *((u32 *)data) <<= 16; - *((u32 *)data) |= b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO); - data += 4; - break; - default: - B43_WARN_ON(1); - } - } -} - -void b43_httab_write(struct b43_wldev *dev, u32 offset, u32 value) -{ - u32 type; - - type = offset & B43_HTTAB_TYPEMASK; - offset &= 0xFFFF; - - switch (type) { - case B43_HTTAB_8BIT: - B43_WARN_ON(value & ~0xFF); - b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset); - b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value); - break; - case B43_HTTAB_16BIT: - B43_WARN_ON(value & ~0xFFFF); - b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset); - b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value); - break; - case B43_HTTAB_32BIT: - b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset); - b43_phy_write(dev, B43_PHY_HT_TABLE_DATAHI, value >> 16); - b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value & 0xFFFF); - break; - default: - B43_WARN_ON(1); - } - - return; -} - -void b43_httab_write_few(struct b43_wldev *dev, u32 offset, size_t num, ...) -{ - va_list args; - u32 type, value; - unsigned int i; - - type = offset & B43_HTTAB_TYPEMASK; - offset &= 0xFFFF; - - va_start(args, num); - switch (type) { - case B43_HTTAB_8BIT: - b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset); - for (i = 0; i < num; i++) { - value = va_arg(args, int); - B43_WARN_ON(value & ~0xFF); - b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value); - } - break; - case B43_HTTAB_16BIT: - b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset); - for (i = 0; i < num; i++) { - value = va_arg(args, int); - B43_WARN_ON(value & ~0xFFFF); - b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value); - } - break; - case B43_HTTAB_32BIT: - b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset); - for (i = 0; i < num; i++) { - value = va_arg(args, int); - b43_phy_write(dev, B43_PHY_HT_TABLE_DATAHI, - value >> 16); - b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, - value & 0xFFFF); - } - break; - default: - B43_WARN_ON(1); - } - va_end(args); - - return; -} - -void b43_httab_write_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, const void *_data) -{ - u32 type, value; - const u8 *data = _data; - unsigned int i; - - type = offset & B43_HTTAB_TYPEMASK; - offset &= ~B43_HTTAB_TYPEMASK; - B43_WARN_ON(offset > 0xFFFF); - - b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset); - - for (i = 0; i < nr_elements; i++) { - switch (type) { - case B43_HTTAB_8BIT: - value = *data; - data++; - B43_WARN_ON(value & ~0xFF); - b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value); - break; - case B43_HTTAB_16BIT: - value = *((u16 *)data); - data += 2; - B43_WARN_ON(value & ~0xFFFF); - b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value); - break; - case B43_HTTAB_32BIT: - value = *((u32 *)data); - data += 4; - b43_phy_write(dev, B43_PHY_HT_TABLE_DATAHI, value >> 16); - b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, - value & 0xFFFF); - break; - default: - B43_WARN_ON(1); - } - } -} - -/************************************************** - * Tables ops. - **************************************************/ - -#define httab_upload(dev, offset, data) do { \ - b43_httab_write_bulk(dev, offset, ARRAY_SIZE(data), data); \ - } while (0) -void b43_phy_ht_tables_init(struct b43_wldev *dev) -{ - BUILD_BUG_ON(ARRAY_SIZE(b43_httab_0x1a_0xc0_late) != - B43_HTTAB_1A_C0_LATE_SIZE); - - httab_upload(dev, B43_HTTAB16(0x12, 0), b43_httab_0x12); - httab_upload(dev, B43_HTTAB16(0x27, 0), b43_httab_0x27); - httab_upload(dev, B43_HTTAB16(0x26, 0), b43_httab_0x26); - httab_upload(dev, B43_HTTAB32(0x25, 0), b43_httab_0x25); - httab_upload(dev, B43_HTTAB32(0x2f, 0), b43_httab_0x2f); - httab_upload(dev, B43_HTTAB16(0x1a, 0), b43_httab_0x1a); - httab_upload(dev, B43_HTTAB16(0x1b, 0), b43_httab_0x1b); - httab_upload(dev, B43_HTTAB16(0x1c, 0), b43_httab_0x1c); - httab_upload(dev, B43_HTTAB32(0x1a, 0x0c0), b43_httab_0x1a_0xc0); - httab_upload(dev, B43_HTTAB32(0x1a, 0x140), b43_httab_0x1a_0x140); - httab_upload(dev, B43_HTTAB32(0x1b, 0x140), b43_httab_0x1b_0x140); - httab_upload(dev, B43_HTTAB32(0x1c, 0x140), b43_httab_0x1c_0x140); - httab_upload(dev, B43_HTTAB16(0x1a, 0x1c0), b43_httab_0x1a_0x1c0); - httab_upload(dev, B43_HTTAB16(0x1b, 0x1c0), b43_httab_0x1b_0x1c0); - httab_upload(dev, B43_HTTAB16(0x1c, 0x1c0), b43_httab_0x1c_0x1c0); - httab_upload(dev, B43_HTTAB16(0x1a, 0x240), b43_httab_0x1a_0x240); - httab_upload(dev, B43_HTTAB16(0x1b, 0x240), b43_httab_0x1b_0x240); - httab_upload(dev, B43_HTTAB16(0x1c, 0x240), b43_httab_0x1c_0x240); - httab_upload(dev, B43_HTTAB32(0x1f, 0), b43_httab_0x1f); - httab_upload(dev, B43_HTTAB32(0x21, 0), b43_httab_0x21); - httab_upload(dev, B43_HTTAB32(0x23, 0), b43_httab_0x23); - httab_upload(dev, B43_HTTAB32(0x20, 0), b43_httab_0x20); - httab_upload(dev, B43_HTTAB32(0x22, 0), b43_httab_0x22); - httab_upload(dev, B43_HTTAB32(0x24, 0), b43_httab_0x24); -} diff --git a/drivers/net/wireless/b43/tables_phy_ht.h b/drivers/net/wireless/b43/tables_phy_ht.h deleted file mode 100644 index 1b5ef2bc770c..000000000000 --- a/drivers/net/wireless/b43/tables_phy_ht.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef B43_TABLES_PHY_HT_H_ -#define B43_TABLES_PHY_HT_H_ - -/* The HT-PHY tables. */ -#define B43_HTTAB_TYPEMASK 0xF0000000 -#define B43_HTTAB_8BIT 0x10000000 -#define B43_HTTAB_16BIT 0x20000000 -#define B43_HTTAB_32BIT 0x30000000 -#define B43_HTTAB8(table, offset) (((table) << 10) | (offset) | B43_HTTAB_8BIT) -#define B43_HTTAB16(table, offset) (((table) << 10) | (offset) | B43_HTTAB_16BIT) -#define B43_HTTAB32(table, offset) (((table) << 10) | (offset) | B43_HTTAB_32BIT) - -u32 b43_httab_read(struct b43_wldev *dev, u32 offset); -void b43_httab_read_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, void *_data); -void b43_httab_write(struct b43_wldev *dev, u32 offset, u32 value); -void b43_httab_write_few(struct b43_wldev *dev, u32 offset, size_t num, ...); -void b43_httab_write_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, const void *_data); - -void b43_phy_ht_tables_init(struct b43_wldev *dev); - -#define B43_HTTAB_1A_C0_LATE_SIZE 128 -extern const u32 b43_httab_0x1a_0xc0_late[]; - -#endif /* B43_TABLES_PHY_HT_H_ */ diff --git a/drivers/net/wireless/b43/tables_phy_lcn.c b/drivers/net/wireless/b43/tables_phy_lcn.c deleted file mode 100644 index e347b8d80ea4..000000000000 --- a/drivers/net/wireless/b43/tables_phy_lcn.c +++ /dev/null @@ -1,724 +0,0 @@ -/* - - Broadcom B43 wireless driver - IEEE 802.11n LCN-PHY data tables - - Copyright (c) 2011 Rafał Miłecki - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "tables_phy_lcn.h" -#include "phy_common.h" -#include "phy_lcn.h" - -struct b43_lcntab_tx_gain_tbl_entry { - u8 gm; - u8 pga; - u8 pad; - u8 dac; - u8 bb_mult; -}; - -/************************************************** - * Static tables. - **************************************************/ - -static const u16 b43_lcntab_0x02[] = { - 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, - 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, - 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, - 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, - 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, - 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, - 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, - 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, - 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, - 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, - 0x014d, 0x014d, 0x014d, 0x014d, -}; - -static const u16 b43_lcntab_0x01[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, -}; - -static const u32 b43_lcntab_0x0b[] = { - 0x000141f8, 0x000021f8, 0x000021fb, 0x000041fb, - 0x0001fedb, 0x0000217b, 0x00002133, 0x000040eb, - 0x0001fea3, 0x0000024b, -}; - -static const u32 b43_lcntab_0x0c[] = { - 0x00100001, 0x00200010, 0x00300001, 0x00400010, - 0x00500022, 0x00600122, 0x00700222, 0x00800322, - 0x00900422, 0x00a00522, 0x00b00622, 0x00c00722, - 0x00d00822, 0x00f00922, 0x00100a22, 0x00200b22, - 0x00300c22, 0x00400d22, 0x00500e22, 0x00600f22, -}; - -static const u32 b43_lcntab_0x0d[] = { - 0x00000000, 0x00000000, 0x10000000, 0x00000000, - 0x20000000, 0x00000000, 0x30000000, 0x00000000, - 0x40000000, 0x00000000, 0x50000000, 0x00000000, - 0x60000000, 0x00000000, 0x70000000, 0x00000000, - 0x80000000, 0x00000000, 0x90000000, 0x00000008, - 0xa0000000, 0x00000008, 0xb0000000, 0x00000008, - 0xc0000000, 0x00000008, 0xd0000000, 0x00000008, - 0xe0000000, 0x00000008, 0xf0000000, 0x00000008, - 0x00000000, 0x00000009, 0x10000000, 0x00000009, - 0x20000000, 0x00000019, 0x30000000, 0x00000019, - 0x40000000, 0x00000019, 0x50000000, 0x00000019, - 0x60000000, 0x00000019, 0x70000000, 0x00000019, - 0x80000000, 0x00000019, 0x90000000, 0x00000019, - 0xa0000000, 0x00000019, 0xb0000000, 0x00000019, - 0xc0000000, 0x00000019, 0xd0000000, 0x00000019, - 0xe0000000, 0x00000019, 0xf0000000, 0x00000019, - 0x00000000, 0x0000001a, 0x10000000, 0x0000001a, - 0x20000000, 0x0000001a, 0x30000000, 0x0000001a, - 0x40000000, 0x0000001a, 0x50000000, 0x00000002, - 0x60000000, 0x00000002, 0x70000000, 0x00000002, - 0x80000000, 0x00000002, 0x90000000, 0x00000002, - 0xa0000000, 0x00000002, 0xb0000000, 0x00000002, - 0xc0000000, 0x0000000a, 0xd0000000, 0x0000000a, - 0xe0000000, 0x0000000a, 0xf0000000, 0x0000000a, - 0x00000000, 0x0000000b, 0x10000000, 0x0000000b, - 0x20000000, 0x0000000b, 0x30000000, 0x0000000b, - 0x40000000, 0x0000000b, 0x50000000, 0x0000001b, - 0x60000000, 0x0000001b, 0x70000000, 0x0000001b, - 0x80000000, 0x0000001b, 0x90000000, 0x0000001b, - 0xa0000000, 0x0000001b, 0xb0000000, 0x0000001b, - 0xc0000000, 0x0000001b, 0xd0000000, 0x0000001b, - 0xe0000000, 0x0000001b, 0xf0000000, 0x0000001b, - 0x00000000, 0x0000001c, 0x10000000, 0x0000001c, - 0x20000000, 0x0000001c, 0x30000000, 0x0000001c, - 0x40000000, 0x0000001c, 0x50000000, 0x0000001c, - 0x60000000, 0x0000001c, 0x70000000, 0x0000001c, - 0x80000000, 0x0000001c, 0x90000000, 0x0000001c, -}; - -static const u16 b43_lcntab_0x0e[] = { - 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, - 0x0407, 0x0408, 0x0409, 0x040a, 0x058b, 0x058c, - 0x058d, 0x058e, 0x058f, 0x0090, 0x0091, 0x0092, - 0x0193, 0x0194, 0x0195, 0x0196, 0x0197, 0x0198, - 0x0199, 0x019a, 0x019b, 0x019c, 0x019d, 0x019e, - 0x019f, 0x01a0, 0x01a1, 0x01a2, 0x01a3, 0x01a4, - 0x01a5, 0x0000, -}; - -static const u16 b43_lcntab_0x0f[] = { - 0x000a, 0x0009, 0x0006, 0x0005, 0x000a, 0x0009, - 0x0006, 0x0005, 0x000a, 0x0009, 0x0006, 0x0005, - 0x000a, 0x0009, 0x0006, 0x0005, 0x000a, 0x0009, - 0x0006, 0x0005, 0x000a, 0x0009, 0x0006, 0x0005, - 0x000a, 0x0009, 0x0006, 0x0005, 0x000a, 0x0009, - 0x0006, 0x0005, 0x000a, 0x0009, 0x0006, 0x0005, - 0x000a, 0x0009, 0x0006, 0x0005, 0x000a, 0x0009, - 0x0006, 0x0005, 0x000a, 0x0009, 0x0006, 0x0005, - 0x000a, 0x0009, 0x0006, 0x0005, 0x000a, 0x0009, - 0x0006, 0x0005, 0x000a, 0x0009, 0x0006, 0x0005, - 0x000a, 0x0009, 0x0006, 0x0005, -}; - -static const u16 b43_lcntab_0x10[] = { - 0x005f, 0x0036, 0x0029, 0x001f, 0x005f, 0x0036, - 0x0029, 0x001f, 0x005f, 0x0036, 0x0029, 0x001f, - 0x005f, 0x0036, 0x0029, 0x001f, -}; - -static const u16 b43_lcntab_0x11[] = { - 0x0009, 0x000f, 0x0014, 0x0018, 0x00fe, 0x0007, - 0x000b, 0x000f, 0x00fb, 0x00fe, 0x0001, 0x0005, - 0x0008, 0x000b, 0x000e, 0x0011, 0x0014, 0x0017, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0003, 0x0006, 0x0009, 0x000c, 0x000f, - 0x0012, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0003, - 0x0006, 0x0009, 0x000c, 0x000f, 0x0012, 0x0015, - 0x0018, 0x001b, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0003, 0x00eb, 0x0000, 0x0000, -}; - -static const u32 b43_lcntab_0x12[] = { - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000004, 0x00000000, 0x00000004, 0x00000008, - 0x00000001, 0x00000005, 0x00000009, 0x0000000d, - 0x0000004d, 0x0000008d, 0x0000000d, 0x0000004d, - 0x0000008d, 0x000000cd, 0x0000004f, 0x0000008f, - 0x000000cf, 0x000000d3, 0x00000113, 0x00000513, - 0x00000913, 0x00000953, 0x00000d53, 0x00001153, - 0x00001193, 0x00005193, 0x00009193, 0x0000d193, - 0x00011193, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000004, - 0x00000000, 0x00000004, 0x00000008, 0x00000001, - 0x00000005, 0x00000009, 0x0000000d, 0x0000004d, - 0x0000008d, 0x0000000d, 0x0000004d, 0x0000008d, - 0x000000cd, 0x0000004f, 0x0000008f, 0x000000cf, - 0x000000d3, 0x00000113, 0x00000513, 0x00000913, - 0x00000953, 0x00000d53, 0x00001153, 0x00005153, - 0x00009153, 0x0000d153, 0x00011153, 0x00015153, - 0x00019153, 0x0001d153, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, -}; - -static const u16 b43_lcntab_0x14[] = { - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0002, 0x0003, 0x0001, 0x0003, 0x0002, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0003, - 0x0001, 0x0003, 0x0002, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, -}; - -static const u16 b43_lcntab_0x17[] = { - 0x001a, 0x0034, 0x004e, 0x0068, 0x009c, 0x00d0, - 0x00ea, 0x0104, 0x0034, 0x0068, 0x009c, 0x00d0, - 0x0138, 0x01a0, 0x01d4, 0x0208, 0x004e, 0x009c, - 0x00ea, 0x0138, 0x01d4, 0x0270, 0x02be, 0x030c, - 0x0068, 0x00d0, 0x0138, 0x01a0, 0x0270, 0x0340, - 0x03a8, 0x0410, 0x0018, 0x009c, 0x00d0, 0x0104, - 0x00ea, 0x0138, 0x0186, 0x00d0, 0x0104, 0x0104, - 0x0138, 0x016c, 0x016c, 0x01a0, 0x0138, 0x0186, - 0x0186, 0x01d4, 0x0222, 0x0222, 0x0270, 0x0104, - 0x0138, 0x016c, 0x0138, 0x016c, 0x01a0, 0x01d4, - 0x01a0, 0x01d4, 0x0208, 0x0208, 0x023c, 0x0186, - 0x01d4, 0x0222, 0x01d4, 0x0222, 0x0270, 0x02be, - 0x0270, 0x02be, 0x030c, 0x030c, 0x035a, 0x0036, - 0x006c, 0x00a2, 0x00d8, 0x0144, 0x01b0, 0x01e6, - 0x021c, 0x006c, 0x00d8, 0x0144, 0x01b0, 0x0288, - 0x0360, 0x03cc, 0x0438, 0x00a2, 0x0144, 0x01e6, - 0x0288, 0x03cc, 0x0510, 0x05b2, 0x0654, 0x00d8, - 0x01b0, 0x0288, 0x0360, 0x0510, 0x06c0, 0x0798, - 0x0870, 0x0018, 0x0144, 0x01b0, 0x021c, 0x01e6, - 0x0288, 0x032a, 0x01b0, 0x021c, 0x021c, 0x0288, - 0x02f4, 0x02f4, 0x0360, 0x0288, 0x032a, 0x032a, - 0x03cc, 0x046e, 0x046e, 0x0510, 0x021c, 0x0288, - 0x02f4, 0x0288, 0x02f4, 0x0360, 0x03cc, 0x0360, - 0x03cc, 0x0438, 0x0438, 0x04a4, 0x032a, 0x03cc, - 0x046e, 0x03cc, 0x046e, 0x0510, 0x05b2, 0x0510, - 0x05b2, 0x0654, 0x0654, 0x06f6, -}; - -static const u16 b43_lcntab_0x00[] = { - 0x0200, 0x0300, 0x0400, 0x0600, 0x0800, 0x0b00, - 0x1000, 0x1001, 0x1002, 0x1003, 0x1004, 0x1005, - 0x1006, 0x1007, 0x1707, 0x2007, 0x2d07, 0x4007, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0200, 0x0300, 0x0400, 0x0600, - 0x0800, 0x0b00, 0x1000, 0x1001, 0x1002, 0x1003, - 0x1004, 0x1005, 0x1006, 0x1007, 0x1707, 0x2007, - 0x2d07, 0x4007, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x4000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -}; - -static const u32 b43_lcntab_0x18[] = { - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, - 0x00080000, 0x00080000, 0x00080000, 0x00080000, -}; - -/************************************************** - * TX gain. - **************************************************/ - -static const struct b43_lcntab_tx_gain_tbl_entry - b43_lcntab_tx_gain_tbl_2ghz_ext_pa_rev0[B43_LCNTAB_TX_GAIN_SIZE] = { - { 0x03, 0x00, 0x1f, 0x0, 0x48 }, - { 0x03, 0x00, 0x1f, 0x0, 0x46 }, - { 0x03, 0x00, 0x1f, 0x0, 0x44 }, - { 0x03, 0x00, 0x1e, 0x0, 0x43 }, - { 0x03, 0x00, 0x1d, 0x0, 0x44 }, - { 0x03, 0x00, 0x1c, 0x0, 0x44 }, - { 0x03, 0x00, 0x1b, 0x0, 0x45 }, - { 0x03, 0x00, 0x1a, 0x0, 0x46 }, - { 0x03, 0x00, 0x19, 0x0, 0x46 }, - { 0x03, 0x00, 0x18, 0x0, 0x47 }, - { 0x03, 0x00, 0x17, 0x0, 0x48 }, - { 0x03, 0x00, 0x17, 0x0, 0x46 }, - { 0x03, 0x00, 0x16, 0x0, 0x47 }, - { 0x03, 0x00, 0x15, 0x0, 0x48 }, - { 0x03, 0x00, 0x15, 0x0, 0x46 }, - { 0x03, 0x00, 0x15, 0x0, 0x44 }, - { 0x03, 0x00, 0x15, 0x0, 0x42 }, - { 0x03, 0x00, 0x15, 0x0, 0x40 }, - { 0x03, 0x00, 0x15, 0x0, 0x3f }, - { 0x03, 0x00, 0x14, 0x0, 0x40 }, - { 0x03, 0x00, 0x13, 0x0, 0x41 }, - { 0x03, 0x00, 0x13, 0x0, 0x40 }, - { 0x03, 0x00, 0x12, 0x0, 0x41 }, - { 0x03, 0x00, 0x12, 0x0, 0x40 }, - { 0x03, 0x00, 0x11, 0x0, 0x41 }, - { 0x03, 0x00, 0x11, 0x0, 0x40 }, - { 0x03, 0x00, 0x10, 0x0, 0x41 }, - { 0x03, 0x00, 0x10, 0x0, 0x40 }, - { 0x03, 0x00, 0x10, 0x0, 0x3e }, - { 0x03, 0x00, 0x10, 0x0, 0x3c }, - { 0x03, 0x00, 0x10, 0x0, 0x3a }, - { 0x03, 0x00, 0x0f, 0x0, 0x3d }, - { 0x03, 0x00, 0x0f, 0x0, 0x3b }, - { 0x03, 0x00, 0x0e, 0x0, 0x3d }, - { 0x03, 0x00, 0x0e, 0x0, 0x3c }, - { 0x03, 0x00, 0x0e, 0x0, 0x3a }, - { 0x03, 0x00, 0x0d, 0x0, 0x3c }, - { 0x03, 0x00, 0x0d, 0x0, 0x3b }, - { 0x03, 0x00, 0x0c, 0x0, 0x3e }, - { 0x03, 0x00, 0x0c, 0x0, 0x3c }, - { 0x03, 0x00, 0x0c, 0x0, 0x3a }, - { 0x03, 0x00, 0x0b, 0x0, 0x3e }, - { 0x03, 0x00, 0x0b, 0x0, 0x3c }, - { 0x03, 0x00, 0x0b, 0x0, 0x3b }, - { 0x03, 0x00, 0x0b, 0x0, 0x39 }, - { 0x03, 0x00, 0x0a, 0x0, 0x3d }, - { 0x03, 0x00, 0x0a, 0x0, 0x3b }, - { 0x03, 0x00, 0x0a, 0x0, 0x39 }, - { 0x03, 0x00, 0x09, 0x0, 0x3e }, - { 0x03, 0x00, 0x09, 0x0, 0x3c }, - { 0x03, 0x00, 0x09, 0x0, 0x3a }, - { 0x03, 0x00, 0x09, 0x0, 0x39 }, - { 0x03, 0x00, 0x08, 0x0, 0x3e }, - { 0x03, 0x00, 0x08, 0x0, 0x3c }, - { 0x03, 0x00, 0x08, 0x0, 0x3a }, - { 0x03, 0x00, 0x08, 0x0, 0x39 }, - { 0x03, 0x00, 0x08, 0x0, 0x37 }, - { 0x03, 0x00, 0x07, 0x0, 0x3d }, - { 0x03, 0x00, 0x07, 0x0, 0x3c }, - { 0x03, 0x00, 0x07, 0x0, 0x3a }, - { 0x03, 0x00, 0x07, 0x0, 0x38 }, - { 0x03, 0x00, 0x07, 0x0, 0x37 }, - { 0x03, 0x00, 0x06, 0x0, 0x3e }, - { 0x03, 0x00, 0x06, 0x0, 0x3c }, - { 0x03, 0x00, 0x06, 0x0, 0x3a }, - { 0x03, 0x00, 0x06, 0x0, 0x39 }, - { 0x03, 0x00, 0x06, 0x0, 0x37 }, - { 0x03, 0x00, 0x06, 0x0, 0x36 }, - { 0x03, 0x00, 0x06, 0x0, 0x34 }, - { 0x03, 0x00, 0x05, 0x0, 0x3d }, - { 0x03, 0x00, 0x05, 0x0, 0x3b }, - { 0x03, 0x00, 0x05, 0x0, 0x39 }, - { 0x03, 0x00, 0x05, 0x0, 0x38 }, - { 0x03, 0x00, 0x05, 0x0, 0x36 }, - { 0x03, 0x00, 0x05, 0x0, 0x35 }, - { 0x03, 0x00, 0x05, 0x0, 0x33 }, - { 0x03, 0x00, 0x04, 0x0, 0x3e }, - { 0x03, 0x00, 0x04, 0x0, 0x3c }, - { 0x03, 0x00, 0x04, 0x0, 0x3a }, - { 0x03, 0x00, 0x04, 0x0, 0x39 }, - { 0x03, 0x00, 0x04, 0x0, 0x37 }, - { 0x03, 0x00, 0x04, 0x0, 0x36 }, - { 0x03, 0x00, 0x04, 0x0, 0x34 }, - { 0x03, 0x00, 0x04, 0x0, 0x33 }, - { 0x03, 0x00, 0x04, 0x0, 0x31 }, - { 0x03, 0x00, 0x04, 0x0, 0x30 }, - { 0x03, 0x00, 0x04, 0x0, 0x2e }, - { 0x03, 0x00, 0x03, 0x0, 0x3c }, - { 0x03, 0x00, 0x03, 0x0, 0x3a }, - { 0x03, 0x00, 0x03, 0x0, 0x39 }, - { 0x03, 0x00, 0x03, 0x0, 0x37 }, - { 0x03, 0x00, 0x03, 0x0, 0x36 }, - { 0x03, 0x00, 0x03, 0x0, 0x34 }, - { 0x03, 0x00, 0x03, 0x0, 0x33 }, - { 0x03, 0x00, 0x03, 0x0, 0x31 }, - { 0x03, 0x00, 0x03, 0x0, 0x30 }, - { 0x03, 0x00, 0x03, 0x0, 0x2e }, - { 0x03, 0x00, 0x03, 0x0, 0x2d }, - { 0x03, 0x00, 0x03, 0x0, 0x2c }, - { 0x03, 0x00, 0x03, 0x0, 0x2b }, - { 0x03, 0x00, 0x03, 0x0, 0x29 }, - { 0x03, 0x00, 0x02, 0x0, 0x3d }, - { 0x03, 0x00, 0x02, 0x0, 0x3b }, - { 0x03, 0x00, 0x02, 0x0, 0x39 }, - { 0x03, 0x00, 0x02, 0x0, 0x38 }, - { 0x03, 0x00, 0x02, 0x0, 0x36 }, - { 0x03, 0x00, 0x02, 0x0, 0x35 }, - { 0x03, 0x00, 0x02, 0x0, 0x33 }, - { 0x03, 0x00, 0x02, 0x0, 0x32 }, - { 0x03, 0x00, 0x02, 0x0, 0x30 }, - { 0x03, 0x00, 0x02, 0x0, 0x2f }, - { 0x03, 0x00, 0x02, 0x0, 0x2e }, - { 0x03, 0x00, 0x02, 0x0, 0x2c }, - { 0x03, 0x00, 0x02, 0x0, 0x2b }, - { 0x03, 0x00, 0x02, 0x0, 0x2a }, - { 0x03, 0x00, 0x02, 0x0, 0x29 }, - { 0x03, 0x00, 0x02, 0x0, 0x27 }, - { 0x03, 0x00, 0x02, 0x0, 0x26 }, - { 0x03, 0x00, 0x02, 0x0, 0x25 }, - { 0x03, 0x00, 0x02, 0x0, 0x24 }, - { 0x03, 0x00, 0x02, 0x0, 0x23 }, - { 0x03, 0x00, 0x02, 0x0, 0x22 }, - { 0x03, 0x00, 0x02, 0x0, 0x21 }, - { 0x03, 0x00, 0x02, 0x0, 0x20 }, - { 0x03, 0x00, 0x01, 0x0, 0x3f }, - { 0x03, 0x00, 0x01, 0x0, 0x3d }, - { 0x03, 0x00, 0x01, 0x0, 0x3b }, - { 0x03, 0x00, 0x01, 0x0, 0x39 }, -}; - -/************************************************** - * SW control. - **************************************************/ - -static const u16 b43_lcntab_sw_ctl_4313_epa_rev0[] = { - 0x0002, 0x0008, 0x0004, 0x0001, 0x0002, 0x0008, - 0x0004, 0x0001, 0x0002, 0x0008, 0x0004, 0x0001, - 0x0002, 0x0008, 0x0004, 0x0001, 0x0002, 0x0008, - 0x0004, 0x0001, 0x0002, 0x0008, 0x0004, 0x0001, - 0x0002, 0x0008, 0x0004, 0x0001, 0x0002, 0x0008, - 0x0004, 0x0001, 0x0002, 0x0008, 0x0004, 0x0001, - 0x0002, 0x0008, 0x0004, 0x0001, 0x0002, 0x0008, - 0x0004, 0x0001, 0x0002, 0x0008, 0x0004, 0x0001, - 0x0002, 0x0008, 0x0004, 0x0001, 0x0002, 0x0008, - 0x0004, 0x0001, 0x0002, 0x0008, 0x0004, 0x0001, - 0x0002, 0x0008, 0x0004, 0x0001, -}; - -/************************************************** - * R/W ops. - **************************************************/ - -u32 b43_lcntab_read(struct b43_wldev *dev, u32 offset) -{ - u32 type, value; - - type = offset & B43_LCNTAB_TYPEMASK; - offset &= ~B43_LCNTAB_TYPEMASK; - B43_WARN_ON(offset > 0xFFFF); - - switch (type) { - case B43_LCNTAB_8BIT: - b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset); - value = b43_phy_read(dev, B43_PHY_LCN_TABLE_DATALO) & 0xFF; - break; - case B43_LCNTAB_16BIT: - b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset); - value = b43_phy_read(dev, B43_PHY_LCN_TABLE_DATALO); - break; - case B43_LCNTAB_32BIT: - b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset); - value = b43_phy_read(dev, B43_PHY_LCN_TABLE_DATALO); - value |= (b43_phy_read(dev, B43_PHY_LCN_TABLE_DATAHI) << 16); - break; - default: - B43_WARN_ON(1); - value = 0; - } - - return value; -} - -void b43_lcntab_read_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, void *_data) -{ - u32 type; - u8 *data = _data; - unsigned int i; - - type = offset & B43_LCNTAB_TYPEMASK; - offset &= ~B43_LCNTAB_TYPEMASK; - B43_WARN_ON(offset > 0xFFFF); - - b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset); - - for (i = 0; i < nr_elements; i++) { - switch (type) { - case B43_LCNTAB_8BIT: - *data = b43_phy_read(dev, - B43_PHY_LCN_TABLE_DATALO) & 0xFF; - data++; - break; - case B43_LCNTAB_16BIT: - *((u16 *)data) = b43_phy_read(dev, - B43_PHY_LCN_TABLE_DATALO); - data += 2; - break; - case B43_LCNTAB_32BIT: - *((u32 *)data) = b43_phy_read(dev, - B43_PHY_LCN_TABLE_DATALO); - *((u32 *)data) |= (b43_phy_read(dev, - B43_PHY_LCN_TABLE_DATAHI) << 16); - data += 4; - break; - default: - B43_WARN_ON(1); - } - } -} - -void b43_lcntab_write(struct b43_wldev *dev, u32 offset, u32 value) -{ - u32 type; - - type = offset & B43_LCNTAB_TYPEMASK; - offset &= 0xFFFF; - - switch (type) { - case B43_LCNTAB_8BIT: - B43_WARN_ON(value & ~0xFF); - b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset); - b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, value); - break; - case B43_LCNTAB_16BIT: - B43_WARN_ON(value & ~0xFFFF); - b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset); - b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, value); - break; - case B43_LCNTAB_32BIT: - b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset); - b43_phy_write(dev, B43_PHY_LCN_TABLE_DATAHI, value >> 16); - b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, value & 0xFFFF); - break; - default: - B43_WARN_ON(1); - } - - return; -} - -void b43_lcntab_write_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, const void *_data) -{ - u32 type, value; - const u8 *data = _data; - unsigned int i; - - type = offset & B43_LCNTAB_TYPEMASK; - offset &= ~B43_LCNTAB_TYPEMASK; - B43_WARN_ON(offset > 0xFFFF); - - b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset); - - for (i = 0; i < nr_elements; i++) { - switch (type) { - case B43_LCNTAB_8BIT: - value = *data; - data++; - B43_WARN_ON(value & ~0xFF); - b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, value); - break; - case B43_LCNTAB_16BIT: - value = *((u16 *)data); - data += 2; - B43_WARN_ON(value & ~0xFFFF); - b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, value); - break; - case B43_LCNTAB_32BIT: - value = *((u32 *)data); - data += 4; - b43_phy_write(dev, B43_PHY_LCN_TABLE_DATAHI, - value >> 16); - b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, - value & 0xFFFF); - break; - default: - B43_WARN_ON(1); - } - } -} - -/************************************************** - * Tables ops. - **************************************************/ - -#define lcntab_upload(dev, offset, data) do { \ - b43_lcntab_write_bulk(dev, offset, ARRAY_SIZE(data), data); \ - } while (0) -static void b43_phy_lcn_upload_static_tables(struct b43_wldev *dev) -{ - lcntab_upload(dev, B43_LCNTAB16(0x02, 0), b43_lcntab_0x02); - lcntab_upload(dev, B43_LCNTAB16(0x01, 0), b43_lcntab_0x01); - lcntab_upload(dev, B43_LCNTAB32(0x0b, 0), b43_lcntab_0x0b); - lcntab_upload(dev, B43_LCNTAB32(0x0c, 0), b43_lcntab_0x0c); - lcntab_upload(dev, B43_LCNTAB32(0x0d, 0), b43_lcntab_0x0d); - lcntab_upload(dev, B43_LCNTAB16(0x0e, 0), b43_lcntab_0x0e); - lcntab_upload(dev, B43_LCNTAB16(0x0f, 0), b43_lcntab_0x0f); - lcntab_upload(dev, B43_LCNTAB16(0x10, 0), b43_lcntab_0x10); - lcntab_upload(dev, B43_LCNTAB16(0x11, 0), b43_lcntab_0x11); - lcntab_upload(dev, B43_LCNTAB32(0x12, 0), b43_lcntab_0x12); - lcntab_upload(dev, B43_LCNTAB16(0x14, 0), b43_lcntab_0x14); - lcntab_upload(dev, B43_LCNTAB16(0x17, 0), b43_lcntab_0x17); - lcntab_upload(dev, B43_LCNTAB16(0x00, 0), b43_lcntab_0x00); - lcntab_upload(dev, B43_LCNTAB32(0x18, 0), b43_lcntab_0x18); -} - -static void b43_phy_lcn_load_tx_gain_tab(struct b43_wldev *dev, - const struct b43_lcntab_tx_gain_tbl_entry *gain_table) -{ - u32 i; - u32 val; - - u16 pa_gain = 0x70; - if (dev->dev->bus_sprom->boardflags_lo & B43_BFL_FEM) - pa_gain = 0x10; - - for (i = 0; i < B43_LCNTAB_TX_GAIN_SIZE; i++) { - val = ((pa_gain << 24) | - (gain_table[i].pad << 16) | - (gain_table[i].pga << 8) | - gain_table[i].gm); - b43_lcntab_write(dev, B43_LCNTAB32(0x7, 0xc0 + i), val); - - /* brcmsmac doesn't maskset, we follow newer wl here */ - val = b43_lcntab_read(dev, B43_LCNTAB32(0x7, 0x140 + i)); - val &= 0x000fffff; - val |= ((gain_table[i].dac << 28) | - (gain_table[i].bb_mult << 20)); - b43_lcntab_write(dev, B43_LCNTAB32(0x7, 0x140 + i), val); - } -} - -/* wlc_lcnphy_load_rfpower */ -static void b43_phy_lcn_load_rfpower(struct b43_wldev *dev) -{ - u32 bbmult, rfgain; - u8 i; - - for (i = 0; i < 128; i++) { - bbmult = b43_lcntab_read(dev, B43_LCNTAB32(0x7, 0x140 + i)); - bbmult >>= 20; - rfgain = b43_lcntab_read(dev, B43_LCNTAB32(0x7, 0xc0 + i)); - - /* TODO: calculate value for 0x240 + i table offset - * b43_lcntab_write(dev, B43_LCNTAB32(0x7, 0x240 + i), val); - */ - } -} - -/* Not implemented in brcmsmac, noticed in wl in MMIO dump */ -static void b43_phy_lcn_rewrite_rfpower_table(struct b43_wldev *dev) -{ - int i; - u32 tmp; - for (i = 0; i < 128; i++) { - tmp = b43_lcntab_read(dev, B43_LCNTAB32(0x7, 0x240 + i)); - b43_lcntab_write(dev, B43_LCNTAB32(0x7, 0x240 + i), tmp); - } -} - -/* wlc_lcnphy_clear_papd_comptable */ -static void b43_phy_lcn_clean_papd_comp_table(struct b43_wldev *dev) -{ - u8 i; - - for (i = 0; i < 0x80; i++) - b43_lcntab_write(dev, B43_LCNTAB32(0x18, i), 0x80000); -} - -/* wlc_lcnphy_tbl_init */ -void b43_phy_lcn_tables_init(struct b43_wldev *dev) -{ - struct ssb_sprom *sprom = dev->dev->bus_sprom; - - b43_phy_lcn_upload_static_tables(dev); - - if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { - if (sprom->boardflags_lo & B43_BFL_FEM) - b43_phy_lcn_load_tx_gain_tab(dev, - b43_lcntab_tx_gain_tbl_2ghz_ext_pa_rev0); - else - b43err(dev->wl, - "TX gain table unknown for this card\n"); - } - - if (sprom->boardflags_lo & B43_BFL_FEM && - !(sprom->boardflags_hi & B43_BFH_FEM_BT)) - b43_lcntab_write_bulk(dev, B43_LCNTAB16(0xf, 0), - ARRAY_SIZE(b43_lcntab_sw_ctl_4313_epa_rev0), - b43_lcntab_sw_ctl_4313_epa_rev0); - else - b43err(dev->wl, "SW ctl table is unknown for this card\n"); - - b43_phy_lcn_load_rfpower(dev); - b43_phy_lcn_rewrite_rfpower_table(dev); - b43_phy_lcn_clean_papd_comp_table(dev); -} diff --git a/drivers/net/wireless/b43/tables_phy_lcn.h b/drivers/net/wireless/b43/tables_phy_lcn.h deleted file mode 100644 index caff9db6831f..000000000000 --- a/drivers/net/wireless/b43/tables_phy_lcn.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef B43_TABLES_PHY_LCN_H_ -#define B43_TABLES_PHY_LCN_H_ - -/* The LCN-PHY tables. */ -#define B43_LCNTAB_TYPEMASK 0xF0000000 -#define B43_LCNTAB_8BIT 0x10000000 -#define B43_LCNTAB_16BIT 0x20000000 -#define B43_LCNTAB_32BIT 0x30000000 -#define B43_LCNTAB8(table, offset) (((table) << 10) | (offset) | B43_LCNTAB_8BIT) -#define B43_LCNTAB16(table, offset) (((table) << 10) | (offset) | B43_LCNTAB_16BIT) -#define B43_LCNTAB32(table, offset) (((table) << 10) | (offset) | B43_LCNTAB_32BIT) - -#define B43_LCNTAB_TX_GAIN_SIZE 128 - -u32 b43_lcntab_read(struct b43_wldev *dev, u32 offset); -void b43_lcntab_read_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, void *_data); -void b43_lcntab_write(struct b43_wldev *dev, u32 offset, u32 value); -void b43_lcntab_write_bulk(struct b43_wldev *dev, u32 offset, - unsigned int nr_elements, const void *_data); - -void b43_phy_lcn_tables_init(struct b43_wldev *dev); - -#endif /* B43_TABLES_PHY_LCN_H_ */ diff --git a/drivers/net/wireless/b43/wa.c b/drivers/net/wireless/b43/wa.c deleted file mode 100644 index 9b1a038be08b..000000000000 --- a/drivers/net/wireless/b43/wa.c +++ /dev/null @@ -1,634 +0,0 @@ -/* - - Broadcom B43 wireless driver - - PHY workarounds. - - Copyright (c) 2005-2007 Stefano Brivio - Copyright (c) 2005-2007 Michael Buesch - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43.h" -#include "main.h" -#include "tables.h" -#include "phy_common.h" -#include "wa.h" - -static void b43_wa_papd(struct b43_wldev *dev) -{ - u16 backup; - - backup = b43_ofdmtab_read16(dev, B43_OFDMTAB_PWRDYN2, 0); - b43_ofdmtab_write16(dev, B43_OFDMTAB_PWRDYN2, 0, 7); - b43_ofdmtab_write16(dev, B43_OFDMTAB_UNKNOWN_APHY, 0, 0); - b43_dummy_transmission(dev, true, true); - b43_ofdmtab_write16(dev, B43_OFDMTAB_PWRDYN2, 0, backup); -} - -static void b43_wa_auxclipthr(struct b43_wldev *dev) -{ - b43_phy_write(dev, B43_PHY_OFDM(0x8E), 0x3800); -} - -static void b43_wa_afcdac(struct b43_wldev *dev) -{ - b43_phy_write(dev, 0x0035, 0x03FF); - b43_phy_write(dev, 0x0036, 0x0400); -} - -static void b43_wa_txdc_offset(struct b43_wldev *dev) -{ - b43_ofdmtab_write16(dev, B43_OFDMTAB_DC, 0, 0x0051); -} - -void b43_wa_initgains(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - - b43_phy_write(dev, B43_PHY_LNAHPFCTL, 0x1FF9); - b43_phy_mask(dev, B43_PHY_LPFGAINCTL, 0xFF0F); - if (phy->rev <= 2) - b43_ofdmtab_write16(dev, B43_OFDMTAB_LPFGAIN, 0, 0x1FBF); - b43_radio_write16(dev, 0x0002, 0x1FBF); - - b43_phy_write(dev, 0x0024, 0x4680); - b43_phy_write(dev, 0x0020, 0x0003); - b43_phy_write(dev, 0x001D, 0x0F40); - b43_phy_write(dev, 0x001F, 0x1C00); - if (phy->rev <= 3) - b43_phy_maskset(dev, 0x002A, 0x00FF, 0x0400); - else if (phy->rev == 5) { - b43_phy_maskset(dev, 0x002A, 0x00FF, 0x1A00); - b43_phy_write(dev, 0x00CC, 0x2121); - } - if (phy->rev >= 3) - b43_phy_write(dev, 0x00BA, 0x3ED5); -} - -static void b43_wa_divider(struct b43_wldev *dev) -{ - b43_phy_mask(dev, 0x002B, ~0x0100); - b43_phy_write(dev, 0x008E, 0x58C1); -} - -static void b43_wa_gt(struct b43_wldev *dev) /* Gain table. */ -{ - if (dev->phy.rev <= 2) { - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN2, 0, 15); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN2, 1, 31); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN2, 2, 42); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN2, 3, 48); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN2, 4, 58); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 0, 19); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 1, 19); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 2, 19); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 3, 19); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 4, 21); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 5, 21); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 6, 25); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN1, 0, 3); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN1, 1, 3); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN1, 2, 7); - } else { - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 0, 19); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 1, 19); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 2, 19); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 3, 19); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 4, 21); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 5, 21); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAIN0, 6, 25); - } -} - -static void b43_wa_rssi_lt(struct b43_wldev *dev) /* RSSI lookup table */ -{ - int i; - - if (0 /* FIXME: For APHY.rev=2 this might be needed */) { - for (i = 0; i < 8; i++) - b43_ofdmtab_write16(dev, B43_OFDMTAB_RSSI, i, i + 8); - for (i = 8; i < 16; i++) - b43_ofdmtab_write16(dev, B43_OFDMTAB_RSSI, i, i - 8); - } else { - for (i = 0; i < 64; i++) - b43_ofdmtab_write16(dev, B43_OFDMTAB_RSSI, i, i); - } -} - -static void b43_wa_analog(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - u16 ofdmrev; - - ofdmrev = b43_phy_read(dev, B43_PHY_VERSION_OFDM) & B43_PHYVER_VERSION; - if (ofdmrev > 2) { - if (phy->type == B43_PHYTYPE_A) - b43_phy_write(dev, B43_PHY_PWRDOWN, 0x1808); - else - b43_phy_write(dev, B43_PHY_PWRDOWN, 0x1000); - } else { - b43_ofdmtab_write16(dev, B43_OFDMTAB_DAC, 3, 0x1044); - b43_ofdmtab_write16(dev, B43_OFDMTAB_DAC, 4, 0x7201); - b43_ofdmtab_write16(dev, B43_OFDMTAB_DAC, 6, 0x0040); - } -} - -static void b43_wa_dac(struct b43_wldev *dev) -{ - if (dev->phy.analog == 1) - b43_ofdmtab_write16(dev, B43_OFDMTAB_DAC, 1, - (b43_ofdmtab_read16(dev, B43_OFDMTAB_DAC, 1) & ~0x0034) | 0x0008); - else - b43_ofdmtab_write16(dev, B43_OFDMTAB_DAC, 1, - (b43_ofdmtab_read16(dev, B43_OFDMTAB_DAC, 1) & ~0x0078) | 0x0010); -} - -static void b43_wa_fft(struct b43_wldev *dev) /* Fine frequency table */ -{ - int i; - - if (dev->phy.type == B43_PHYTYPE_A) - for (i = 0; i < B43_TAB_FINEFREQA_SIZE; i++) - b43_ofdmtab_write16(dev, B43_OFDMTAB_DACRFPABB, i, b43_tab_finefreqa[i]); - else - for (i = 0; i < B43_TAB_FINEFREQG_SIZE; i++) - b43_ofdmtab_write16(dev, B43_OFDMTAB_DACRFPABB, i, b43_tab_finefreqg[i]); -} - -static void b43_wa_nft(struct b43_wldev *dev) /* Noise figure table */ -{ - struct b43_phy *phy = &dev->phy; - int i; - - if (phy->type == B43_PHYTYPE_A) { - if (phy->rev == 2) - for (i = 0; i < B43_TAB_NOISEA2_SIZE; i++) - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, i, b43_tab_noisea2[i]); - else - for (i = 0; i < B43_TAB_NOISEA3_SIZE; i++) - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, i, b43_tab_noisea3[i]); - } else { - if (phy->rev == 1) - for (i = 0; i < B43_TAB_NOISEG1_SIZE; i++) - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, i, b43_tab_noiseg1[i]); - else - for (i = 0; i < B43_TAB_NOISEG2_SIZE; i++) - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, i, b43_tab_noiseg2[i]); - } -} - -static void b43_wa_rt(struct b43_wldev *dev) /* Rotor table */ -{ - int i; - - for (i = 0; i < B43_TAB_ROTOR_SIZE; i++) - b43_ofdmtab_write32(dev, B43_OFDMTAB_ROTOR, i, b43_tab_rotor[i]); -} - -static void b43_write_null_nst(struct b43_wldev *dev) -{ - int i; - - for (i = 0; i < B43_TAB_NOISESCALE_SIZE; i++) - b43_ofdmtab_write16(dev, B43_OFDMTAB_NOISESCALE, i, 0); -} - -static void b43_write_nst(struct b43_wldev *dev, const u16 *nst) -{ - int i; - - for (i = 0; i < B43_TAB_NOISESCALE_SIZE; i++) - b43_ofdmtab_write16(dev, B43_OFDMTAB_NOISESCALE, i, nst[i]); -} - -static void b43_wa_nst(struct b43_wldev *dev) /* Noise scale table */ -{ - struct b43_phy *phy = &dev->phy; - - if (phy->type == B43_PHYTYPE_A) { - if (phy->rev <= 1) - b43_write_null_nst(dev); - else if (phy->rev == 2) - b43_write_nst(dev, b43_tab_noisescalea2); - else if (phy->rev == 3) - b43_write_nst(dev, b43_tab_noisescalea3); - else - b43_write_nst(dev, b43_tab_noisescaleg3); - } else { - if (phy->rev >= 6) { - if (b43_phy_read(dev, B43_PHY_ENCORE) & B43_PHY_ENCORE_EN) - b43_write_nst(dev, b43_tab_noisescaleg3); - else - b43_write_nst(dev, b43_tab_noisescaleg2); - } else { - b43_write_nst(dev, b43_tab_noisescaleg1); - } - } -} - -static void b43_wa_art(struct b43_wldev *dev) /* ADV retard table */ -{ - int i; - - for (i = 0; i < B43_TAB_RETARD_SIZE; i++) - b43_ofdmtab_write32(dev, B43_OFDMTAB_ADVRETARD, - i, b43_tab_retard[i]); -} - -static void b43_wa_txlna_gain(struct b43_wldev *dev) -{ - b43_ofdmtab_write16(dev, B43_OFDMTAB_DC, 13, 0x0000); -} - -static void b43_wa_crs_reset(struct b43_wldev *dev) -{ - b43_phy_write(dev, 0x002C, 0x0064); -} - -static void b43_wa_2060txlna_gain(struct b43_wldev *dev) -{ - b43_hf_write(dev, b43_hf_read(dev) | - B43_HF_2060W); -} - -static void b43_wa_lms(struct b43_wldev *dev) -{ - b43_phy_maskset(dev, 0x0055, 0xFFC0, 0x0004); -} - -static void b43_wa_mixedsignal(struct b43_wldev *dev) -{ - b43_ofdmtab_write16(dev, B43_OFDMTAB_DAC, 1, 3); -} - -static void b43_wa_msst(struct b43_wldev *dev) /* Min sigma square table */ -{ - struct b43_phy *phy = &dev->phy; - int i; - const u16 *tab; - - if (phy->type == B43_PHYTYPE_A) { - tab = b43_tab_sigmasqr1; - } else if (phy->type == B43_PHYTYPE_G) { - tab = b43_tab_sigmasqr2; - } else { - B43_WARN_ON(1); - return; - } - - for (i = 0; i < B43_TAB_SIGMASQR_SIZE; i++) { - b43_ofdmtab_write16(dev, B43_OFDMTAB_MINSIGSQ, - i, tab[i]); - } -} - -static void b43_wa_iqadc(struct b43_wldev *dev) -{ - if (dev->phy.analog == 4) - b43_ofdmtab_write16(dev, B43_OFDMTAB_DAC, 0, - b43_ofdmtab_read16(dev, B43_OFDMTAB_DAC, 0) & ~0xF000); -} - -static void b43_wa_crs_ed(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - - if (phy->rev == 1) { - b43_phy_write(dev, B43_PHY_CRSTHRES1_R1, 0x4F19); - } else if (phy->rev == 2) { - b43_phy_write(dev, B43_PHY_CRSTHRES1, 0x1861); - b43_phy_write(dev, B43_PHY_CRSTHRES2, 0x0271); - b43_phy_set(dev, B43_PHY_ANTDWELL, 0x0800); - } else { - b43_phy_write(dev, B43_PHY_CRSTHRES1, 0x0098); - b43_phy_write(dev, B43_PHY_CRSTHRES2, 0x0070); - b43_phy_write(dev, B43_PHY_OFDM(0xC9), 0x0080); - b43_phy_set(dev, B43_PHY_ANTDWELL, 0x0800); - } -} - -static void b43_wa_crs_thr(struct b43_wldev *dev) -{ - b43_phy_maskset(dev, B43_PHY_CRS0, ~0x03C0, 0xD000); -} - -static void b43_wa_crs_blank(struct b43_wldev *dev) -{ - b43_phy_write(dev, B43_PHY_OFDM(0x2C), 0x005A); -} - -static void b43_wa_cck_shiftbits(struct b43_wldev *dev) -{ - b43_phy_write(dev, B43_PHY_CCKSHIFTBITS, 0x0026); -} - -static void b43_wa_wrssi_offset(struct b43_wldev *dev) -{ - int i; - - if (dev->phy.rev == 1) { - for (i = 0; i < 16; i++) { - b43_ofdmtab_write16(dev, B43_OFDMTAB_WRSSI_R1, - i, 0x0020); - } - } else { - for (i = 0; i < 32; i++) { - b43_ofdmtab_write16(dev, B43_OFDMTAB_WRSSI, - i, 0x0820); - } - } -} - -static void b43_wa_txpuoff_rxpuon(struct b43_wldev *dev) -{ - b43_ofdmtab_write16(dev, B43_OFDMTAB_UNKNOWN_0F, 2, 15); - b43_ofdmtab_write16(dev, B43_OFDMTAB_UNKNOWN_0F, 3, 20); -} - -static void b43_wa_altagc(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - - if (phy->rev == 1) { - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1_R1, 0, 254); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1_R1, 1, 13); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1_R1, 2, 19); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1_R1, 3, 25); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, 0, 0x2710); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, 1, 0x9B83); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, 2, 0x9B83); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC2, 3, 0x0F8D); - b43_phy_write(dev, B43_PHY_LMS, 4); - } else { - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1, 0, 254); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1, 1, 13); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1, 2, 19); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1, 3, 25); - } - - b43_phy_maskset(dev, B43_PHY_CCKSHIFTBITS_WA, 0x00FF, 0x5700); - b43_phy_maskset(dev, B43_PHY_OFDM(0x1A), ~0x007F, 0x000F); - b43_phy_maskset(dev, B43_PHY_OFDM(0x1A), ~0x3F80, 0x2B80); - b43_phy_maskset(dev, B43_PHY_ANTWRSETT, 0xF0FF, 0x0300); - b43_radio_set(dev, 0x7A, 0x0008); - b43_phy_maskset(dev, B43_PHY_N1P1GAIN, ~0x000F, 0x0008); - b43_phy_maskset(dev, B43_PHY_P1P2GAIN, ~0x0F00, 0x0600); - b43_phy_maskset(dev, B43_PHY_N1N2GAIN, ~0x0F00, 0x0700); - b43_phy_maskset(dev, B43_PHY_N1P1GAIN, ~0x0F00, 0x0100); - if (phy->rev == 1) { - b43_phy_maskset(dev, B43_PHY_N1N2GAIN, ~0x000F, 0x0007); - } - b43_phy_maskset(dev, B43_PHY_OFDM(0x88), ~0x00FF, 0x001C); - b43_phy_maskset(dev, B43_PHY_OFDM(0x88), ~0x3F00, 0x0200); - b43_phy_maskset(dev, B43_PHY_OFDM(0x96), ~0x00FF, 0x001C); - b43_phy_maskset(dev, B43_PHY_OFDM(0x89), ~0x00FF, 0x0020); - b43_phy_maskset(dev, B43_PHY_OFDM(0x89), ~0x3F00, 0x0200); - b43_phy_maskset(dev, B43_PHY_OFDM(0x82), ~0x00FF, 0x002E); - b43_phy_maskset(dev, B43_PHY_OFDM(0x96), 0x00FF, 0x1A00); - b43_phy_maskset(dev, B43_PHY_OFDM(0x81), ~0x00FF, 0x0028); - b43_phy_maskset(dev, B43_PHY_OFDM(0x81), 0x00FF, 0x2C00); - if (phy->rev == 1) { - b43_phy_write(dev, B43_PHY_PEAK_COUNT, 0x092B); - b43_phy_maskset(dev, B43_PHY_OFDM(0x1B), ~0x001E, 0x0002); - } else { - b43_phy_mask(dev, B43_PHY_OFDM(0x1B), ~0x001E); - b43_phy_write(dev, B43_PHY_OFDM(0x1F), 0x287A); - b43_phy_maskset(dev, B43_PHY_LPFGAINCTL, ~0x000F, 0x0004); - if (phy->rev >= 6) { - b43_phy_write(dev, B43_PHY_OFDM(0x22), 0x287A); - b43_phy_maskset(dev, B43_PHY_LPFGAINCTL, 0x0FFF, 0x3000); - } - } - b43_phy_maskset(dev, B43_PHY_DIVSRCHIDX, 0x8080, 0x7874); - b43_phy_write(dev, B43_PHY_OFDM(0x8E), 0x1C00); - if (phy->rev == 1) { - b43_phy_maskset(dev, B43_PHY_DIVP1P2GAIN, ~0x0F00, 0x0600); - b43_phy_write(dev, B43_PHY_OFDM(0x8B), 0x005E); - b43_phy_maskset(dev, B43_PHY_ANTWRSETT, ~0x00FF, 0x001E); - b43_phy_write(dev, B43_PHY_OFDM(0x8D), 0x0002); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3_R1, 0, 0); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3_R1, 1, 7); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3_R1, 2, 16); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3_R1, 3, 28); - } else { - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3, 0, 0); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3, 1, 7); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3, 2, 16); - b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC3, 3, 28); - } - if (phy->rev >= 6) { - b43_phy_mask(dev, B43_PHY_OFDM(0x26), ~0x0003); - b43_phy_mask(dev, B43_PHY_OFDM(0x26), ~0x1000); - } - b43_phy_read(dev, B43_PHY_VERSION_OFDM); /* Dummy read */ -} - -static void b43_wa_tr_ltov(struct b43_wldev *dev) /* TR Lookup Table Original Values */ -{ - b43_gtab_write(dev, B43_GTAB_ORIGTR, 0, 0xC480); -} - -static void b43_wa_cpll_nonpilot(struct b43_wldev *dev) -{ - b43_ofdmtab_write16(dev, B43_OFDMTAB_UNKNOWN_11, 0, 0); - b43_ofdmtab_write16(dev, B43_OFDMTAB_UNKNOWN_11, 1, 0); -} - -static void b43_wa_rssi_adc(struct b43_wldev *dev) -{ - if (dev->phy.analog == 4) - b43_phy_write(dev, 0x00DC, 0x7454); -} - -static void b43_wa_boards_a(struct b43_wldev *dev) -{ - if (dev->dev->board_vendor == SSB_BOARDVENDOR_BCM && - dev->dev->board_type == SSB_BOARD_BU4306 && - dev->dev->board_rev < 0x30) { - b43_phy_write(dev, 0x0010, 0xE000); - b43_phy_write(dev, 0x0013, 0x0140); - b43_phy_write(dev, 0x0014, 0x0280); - } else { - if (dev->dev->board_type == SSB_BOARD_MP4318 && - dev->dev->board_rev < 0x20) { - b43_phy_write(dev, 0x0013, 0x0210); - b43_phy_write(dev, 0x0014, 0x0840); - } else { - b43_phy_write(dev, 0x0013, 0x0140); - b43_phy_write(dev, 0x0014, 0x0280); - } - if (dev->phy.rev <= 4) - b43_phy_write(dev, 0x0010, 0xE000); - else - b43_phy_write(dev, 0x0010, 0x2000); - b43_ofdmtab_write16(dev, B43_OFDMTAB_DC, 1, 0x0039); - b43_ofdmtab_write16(dev, B43_OFDMTAB_UNKNOWN_APHY, 7, 0x0040); - } -} - -static void b43_wa_boards_g(struct b43_wldev *dev) -{ - struct ssb_sprom *sprom = dev->dev->bus_sprom; - struct b43_phy *phy = &dev->phy; - - if (dev->dev->board_vendor != SSB_BOARDVENDOR_BCM || - dev->dev->board_type != SSB_BOARD_BU4306 || - dev->dev->board_rev != 0x17) { - if (phy->rev < 2) { - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX_R1, 1, 0x0002); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX_R1, 2, 0x0001); - } else { - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 1, 0x0002); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 2, 0x0001); - if ((sprom->boardflags_lo & B43_BFL_EXTLNA) && - (phy->rev >= 7)) { - b43_phy_mask(dev, B43_PHY_EXTG(0x11), 0xF7FF); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 0x0020, 0x0001); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 0x0021, 0x0001); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 0x0022, 0x0001); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 0x0023, 0x0000); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 0x0000, 0x0000); - b43_ofdmtab_write16(dev, B43_OFDMTAB_GAINX, 0x0003, 0x0002); - } - } - } - if (sprom->boardflags_lo & B43_BFL_FEM) { - b43_phy_write(dev, B43_PHY_GTABCTL, 0x3120); - b43_phy_write(dev, B43_PHY_GTABDATA, 0xC480); - } -} - -void b43_wa_all(struct b43_wldev *dev) -{ - struct b43_phy *phy = &dev->phy; - - if (phy->type == B43_PHYTYPE_A) { - switch (phy->rev) { - case 2: - b43_wa_papd(dev); - b43_wa_auxclipthr(dev); - b43_wa_afcdac(dev); - b43_wa_txdc_offset(dev); - b43_wa_initgains(dev); - b43_wa_divider(dev); - b43_wa_gt(dev); - b43_wa_rssi_lt(dev); - b43_wa_analog(dev); - b43_wa_dac(dev); - b43_wa_fft(dev); - b43_wa_nft(dev); - b43_wa_rt(dev); - b43_wa_nst(dev); - b43_wa_art(dev); - b43_wa_txlna_gain(dev); - b43_wa_crs_reset(dev); - b43_wa_2060txlna_gain(dev); - b43_wa_lms(dev); - break; - case 3: - b43_wa_papd(dev); - b43_wa_mixedsignal(dev); - b43_wa_rssi_lt(dev); - b43_wa_txdc_offset(dev); - b43_wa_initgains(dev); - b43_wa_dac(dev); - b43_wa_nft(dev); - b43_wa_nst(dev); - b43_wa_msst(dev); - b43_wa_analog(dev); - b43_wa_gt(dev); - b43_wa_txpuoff_rxpuon(dev); - b43_wa_txlna_gain(dev); - break; - case 5: - b43_wa_iqadc(dev); - case 6: - b43_wa_papd(dev); - b43_wa_rssi_lt(dev); - b43_wa_txdc_offset(dev); - b43_wa_initgains(dev); - b43_wa_dac(dev); - b43_wa_nft(dev); - b43_wa_nst(dev); - b43_wa_msst(dev); - b43_wa_analog(dev); - b43_wa_gt(dev); - b43_wa_txpuoff_rxpuon(dev); - b43_wa_txlna_gain(dev); - break; - case 7: - b43_wa_iqadc(dev); - b43_wa_papd(dev); - b43_wa_rssi_lt(dev); - b43_wa_txdc_offset(dev); - b43_wa_initgains(dev); - b43_wa_dac(dev); - b43_wa_nft(dev); - b43_wa_nst(dev); - b43_wa_msst(dev); - b43_wa_analog(dev); - b43_wa_gt(dev); - b43_wa_txpuoff_rxpuon(dev); - b43_wa_txlna_gain(dev); - b43_wa_rssi_adc(dev); - default: - B43_WARN_ON(1); - } - b43_wa_boards_a(dev); - } else if (phy->type == B43_PHYTYPE_G) { - switch (phy->rev) { - case 1://XXX review rev1 - b43_wa_crs_ed(dev); - b43_wa_crs_thr(dev); - b43_wa_crs_blank(dev); - b43_wa_cck_shiftbits(dev); - b43_wa_fft(dev); - b43_wa_nft(dev); - b43_wa_rt(dev); - b43_wa_nst(dev); - b43_wa_art(dev); - b43_wa_wrssi_offset(dev); - b43_wa_altagc(dev); - break; - case 2: - case 6: - case 7: - case 8: - case 9: - b43_wa_tr_ltov(dev); - b43_wa_crs_ed(dev); - b43_wa_rssi_lt(dev); - b43_wa_nft(dev); - b43_wa_nst(dev); - b43_wa_msst(dev); - b43_wa_wrssi_offset(dev); - b43_wa_altagc(dev); - b43_wa_analog(dev); - b43_wa_txpuoff_rxpuon(dev); - break; - default: - B43_WARN_ON(1); - } - b43_wa_boards_g(dev); - } else { /* No N PHY support so far, LP PHY is in phy_lp.c */ - B43_WARN_ON(1); - } - - b43_wa_cpll_nonpilot(dev); -} diff --git a/drivers/net/wireless/b43/wa.h b/drivers/net/wireless/b43/wa.h deleted file mode 100644 index e163c5e56e81..000000000000 --- a/drivers/net/wireless/b43/wa.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef B43_WA_H_ -#define B43_WA_H_ - -void b43_wa_initgains(struct b43_wldev *dev); -void b43_wa_all(struct b43_wldev *dev); - -#endif /* B43_WA_H_ */ diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c deleted file mode 100644 index 8cb206a89083..000000000000 --- a/drivers/net/wireless/b43/xmit.c +++ /dev/null @@ -1,942 +0,0 @@ -/* - - Broadcom B43 wireless driver - - Transmission (TX/RX) related functions. - - Copyright (C) 2005 Martin Langer - Copyright (C) 2005 Stefano Brivio - Copyright (C) 2005, 2006 Michael Buesch - Copyright (C) 2005 Danny van Dyk - Copyright (C) 2005 Andreas Jaggi - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "xmit.h" -#include "phy_common.h" -#include "dma.h" -#include "pio.h" - -static const struct b43_tx_legacy_rate_phy_ctl_entry b43_tx_legacy_rate_phy_ctl[] = { - { B43_CCK_RATE_1MB, 0x0, 0x0 }, - { B43_CCK_RATE_2MB, 0x0, 0x1 }, - { B43_CCK_RATE_5MB, 0x0, 0x2 }, - { B43_CCK_RATE_11MB, 0x0, 0x3 }, - { B43_OFDM_RATE_6MB, B43_TXH_PHY1_CRATE_1_2, B43_TXH_PHY1_MODUL_BPSK }, - { B43_OFDM_RATE_9MB, B43_TXH_PHY1_CRATE_3_4, B43_TXH_PHY1_MODUL_BPSK }, - { B43_OFDM_RATE_12MB, B43_TXH_PHY1_CRATE_1_2, B43_TXH_PHY1_MODUL_QPSK }, - { B43_OFDM_RATE_18MB, B43_TXH_PHY1_CRATE_3_4, B43_TXH_PHY1_MODUL_QPSK }, - { B43_OFDM_RATE_24MB, B43_TXH_PHY1_CRATE_1_2, B43_TXH_PHY1_MODUL_QAM16 }, - { B43_OFDM_RATE_36MB, B43_TXH_PHY1_CRATE_3_4, B43_TXH_PHY1_MODUL_QAM16 }, - { B43_OFDM_RATE_48MB, B43_TXH_PHY1_CRATE_2_3, B43_TXH_PHY1_MODUL_QAM64 }, - { B43_OFDM_RATE_54MB, B43_TXH_PHY1_CRATE_3_4, B43_TXH_PHY1_MODUL_QAM64 }, -}; - -static const struct b43_tx_legacy_rate_phy_ctl_entry * -b43_tx_legacy_rate_phy_ctl_ent(u8 bitrate) -{ - const struct b43_tx_legacy_rate_phy_ctl_entry *e; - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(b43_tx_legacy_rate_phy_ctl); i++) { - e = &(b43_tx_legacy_rate_phy_ctl[i]); - if (e->bitrate == bitrate) - return e; - } - - B43_WARN_ON(1); - return NULL; -} - -/* Extract the bitrate index out of a CCK PLCP header. */ -static int b43_plcp_get_bitrate_idx_cck(struct b43_plcp_hdr6 *plcp) -{ - switch (plcp->raw[0]) { - case 0x0A: - return 0; - case 0x14: - return 1; - case 0x37: - return 2; - case 0x6E: - return 3; - } - return -1; -} - -/* Extract the bitrate index out of an OFDM PLCP header. */ -static int b43_plcp_get_bitrate_idx_ofdm(struct b43_plcp_hdr6 *plcp, bool aphy) -{ - int base = aphy ? 0 : 4; - - switch (plcp->raw[0] & 0xF) { - case 0xB: - return base + 0; - case 0xF: - return base + 1; - case 0xA: - return base + 2; - case 0xE: - return base + 3; - case 0x9: - return base + 4; - case 0xD: - return base + 5; - case 0x8: - return base + 6; - case 0xC: - return base + 7; - } - return -1; -} - -u8 b43_plcp_get_ratecode_cck(const u8 bitrate) -{ - switch (bitrate) { - case B43_CCK_RATE_1MB: - return 0x0A; - case B43_CCK_RATE_2MB: - return 0x14; - case B43_CCK_RATE_5MB: - return 0x37; - case B43_CCK_RATE_11MB: - return 0x6E; - } - B43_WARN_ON(1); - return 0; -} - -u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate) -{ - switch (bitrate) { - case B43_OFDM_RATE_6MB: - return 0xB; - case B43_OFDM_RATE_9MB: - return 0xF; - case B43_OFDM_RATE_12MB: - return 0xA; - case B43_OFDM_RATE_18MB: - return 0xE; - case B43_OFDM_RATE_24MB: - return 0x9; - case B43_OFDM_RATE_36MB: - return 0xD; - case B43_OFDM_RATE_48MB: - return 0x8; - case B43_OFDM_RATE_54MB: - return 0xC; - } - B43_WARN_ON(1); - return 0; -} - -void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp, - const u16 octets, const u8 bitrate) -{ - __u8 *raw = plcp->raw; - - if (b43_is_ofdm_rate(bitrate)) { - u32 d; - - d = b43_plcp_get_ratecode_ofdm(bitrate); - B43_WARN_ON(octets & 0xF000); - d |= (octets << 5); - plcp->data = cpu_to_le32(d); - } else { - u32 plen; - - plen = octets * 16 / bitrate; - if ((octets * 16 % bitrate) > 0) { - plen++; - if ((bitrate == B43_CCK_RATE_11MB) - && ((octets * 8 % 11) < 4)) { - raw[1] = 0x84; - } else - raw[1] = 0x04; - } else - raw[1] = 0x04; - plcp->data |= cpu_to_le32(plen << 16); - raw[0] = b43_plcp_get_ratecode_cck(bitrate); - } -} - -/* TODO: verify if needed for SSLPN or LCN */ -static u16 b43_generate_tx_phy_ctl1(struct b43_wldev *dev, u8 bitrate) -{ - const struct b43_phy *phy = &dev->phy; - const struct b43_tx_legacy_rate_phy_ctl_entry *e; - u16 control = 0; - u16 bw; - - if (phy->type == B43_PHYTYPE_LP) - bw = B43_TXH_PHY1_BW_20; - else /* FIXME */ - bw = B43_TXH_PHY1_BW_20; - - if (0) { /* FIXME: MIMO */ - } else if (b43_is_cck_rate(bitrate) && phy->type != B43_PHYTYPE_LP) { - control = bw; - } else { - control = bw; - e = b43_tx_legacy_rate_phy_ctl_ent(bitrate); - if (e) { - control |= e->coding_rate; - control |= e->modulation; - } - control |= B43_TXH_PHY1_MODE_SISO; - } - - return control; -} - -static u8 b43_calc_fallback_rate(u8 bitrate) -{ - switch (bitrate) { - case B43_CCK_RATE_1MB: - return B43_CCK_RATE_1MB; - case B43_CCK_RATE_2MB: - return B43_CCK_RATE_1MB; - case B43_CCK_RATE_5MB: - return B43_CCK_RATE_2MB; - case B43_CCK_RATE_11MB: - return B43_CCK_RATE_5MB; - case B43_OFDM_RATE_6MB: - return B43_CCK_RATE_5MB; - case B43_OFDM_RATE_9MB: - return B43_OFDM_RATE_6MB; - case B43_OFDM_RATE_12MB: - return B43_OFDM_RATE_9MB; - case B43_OFDM_RATE_18MB: - return B43_OFDM_RATE_12MB; - case B43_OFDM_RATE_24MB: - return B43_OFDM_RATE_18MB; - case B43_OFDM_RATE_36MB: - return B43_OFDM_RATE_24MB; - case B43_OFDM_RATE_48MB: - return B43_OFDM_RATE_36MB; - case B43_OFDM_RATE_54MB: - return B43_OFDM_RATE_48MB; - } - B43_WARN_ON(1); - return 0; -} - -/* Generate a TX data header. */ -int b43_generate_txhdr(struct b43_wldev *dev, - u8 *_txhdr, - struct sk_buff *skb_frag, - struct ieee80211_tx_info *info, - u16 cookie) -{ - const unsigned char *fragment_data = skb_frag->data; - unsigned int fragment_len = skb_frag->len; - struct b43_txhdr *txhdr = (struct b43_txhdr *)_txhdr; - const struct b43_phy *phy = &dev->phy; - const struct ieee80211_hdr *wlhdr = - (const struct ieee80211_hdr *)fragment_data; - int use_encryption = !!info->control.hw_key; - __le16 fctl = wlhdr->frame_control; - struct ieee80211_rate *fbrate; - u8 rate, rate_fb; - int rate_ofdm, rate_fb_ofdm; - unsigned int plcp_fragment_len; - u32 mac_ctl = 0; - u16 phy_ctl = 0; - bool fill_phy_ctl1 = (phy->type == B43_PHYTYPE_LP || - phy->type == B43_PHYTYPE_N || - phy->type == B43_PHYTYPE_HT); - u8 extra_ft = 0; - struct ieee80211_rate *txrate; - struct ieee80211_tx_rate *rates; - - memset(txhdr, 0, sizeof(*txhdr)); - - txrate = ieee80211_get_tx_rate(dev->wl->hw, info); - rate = txrate ? txrate->hw_value : B43_CCK_RATE_1MB; - rate_ofdm = b43_is_ofdm_rate(rate); - fbrate = ieee80211_get_alt_retry_rate(dev->wl->hw, info, 0) ? : txrate; - rate_fb = fbrate->hw_value; - rate_fb_ofdm = b43_is_ofdm_rate(rate_fb); - - if (rate_ofdm) - txhdr->phy_rate = b43_plcp_get_ratecode_ofdm(rate); - else - txhdr->phy_rate = b43_plcp_get_ratecode_cck(rate); - txhdr->mac_frame_ctl = wlhdr->frame_control; - memcpy(txhdr->tx_receiver, wlhdr->addr1, 6); - - /* Calculate duration for fallback rate */ - if ((rate_fb == rate) || - (wlhdr->duration_id & cpu_to_le16(0x8000)) || - (wlhdr->duration_id == cpu_to_le16(0))) { - /* If the fallback rate equals the normal rate or the - * dur_id field contains an AID, CFP magic or 0, - * use the original dur_id field. */ - txhdr->dur_fb = wlhdr->duration_id; - } else { - txhdr->dur_fb = ieee80211_generic_frame_duration( - dev->wl->hw, info->control.vif, info->band, - fragment_len, fbrate); - } - - plcp_fragment_len = fragment_len + FCS_LEN; - if (use_encryption) { - u8 key_idx = info->control.hw_key->hw_key_idx; - struct b43_key *key; - int wlhdr_len; - size_t iv_len; - - B43_WARN_ON(key_idx >= ARRAY_SIZE(dev->key)); - key = &(dev->key[key_idx]); - - if (unlikely(!key->keyconf)) { - /* This key is invalid. This might only happen - * in a short timeframe after machine resume before - * we were able to reconfigure keys. - * Drop this packet completely. Do not transmit it - * unencrypted to avoid leaking information. */ - return -ENOKEY; - } - - /* Hardware appends ICV. */ - plcp_fragment_len += info->control.hw_key->icv_len; - - key_idx = b43_kidx_to_fw(dev, key_idx); - mac_ctl |= (key_idx << B43_TXH_MAC_KEYIDX_SHIFT) & - B43_TXH_MAC_KEYIDX; - mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) & - B43_TXH_MAC_KEYALG; - wlhdr_len = ieee80211_hdrlen(fctl); - if (key->algorithm == B43_SEC_ALGO_TKIP) { - u16 phase1key[5]; - int i; - /* we give the phase1key and iv16 here, the key is stored in - * shm. With that the hardware can do phase 2 and encryption. - */ - ieee80211_get_tkip_p1k(info->control.hw_key, skb_frag, phase1key); - /* phase1key is in host endian. Copy to little-endian txhdr->iv. */ - for (i = 0; i < 5; i++) { - txhdr->iv[i * 2 + 0] = phase1key[i]; - txhdr->iv[i * 2 + 1] = phase1key[i] >> 8; - } - /* iv16 */ - memcpy(txhdr->iv + 10, ((u8 *) wlhdr) + wlhdr_len, 3); - } else { - iv_len = min((size_t) info->control.hw_key->iv_len, - ARRAY_SIZE(txhdr->iv)); - memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len); - } - } - switch (dev->fw.hdr_format) { - case B43_FW_HDR_598: - b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->format_598.plcp), - plcp_fragment_len, rate); - break; - case B43_FW_HDR_351: - b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->format_351.plcp), - plcp_fragment_len, rate); - break; - case B43_FW_HDR_410: - b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->format_410.plcp), - plcp_fragment_len, rate); - break; - } - b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)(&txhdr->plcp_fb), - plcp_fragment_len, rate_fb); - - /* Extra Frame Types */ - if (rate_fb_ofdm) - extra_ft |= B43_TXH_EFT_FB_OFDM; - else - extra_ft |= B43_TXH_EFT_FB_CCK; - - /* Set channel radio code. Note that the micrcode ORs 0x100 to - * this value before comparing it to the value in SHM, if this - * is a 5Ghz packet. - */ - txhdr->chan_radio_code = phy->channel; - - /* PHY TX Control word */ - if (rate_ofdm) - phy_ctl |= B43_TXH_PHY_ENC_OFDM; - else - phy_ctl |= B43_TXH_PHY_ENC_CCK; - if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) - phy_ctl |= B43_TXH_PHY_SHORTPRMBL; - - switch (b43_ieee80211_antenna_sanitize(dev, 0)) { - case 0: /* Default */ - phy_ctl |= B43_TXH_PHY_ANT01AUTO; - break; - case 1: /* Antenna 0 */ - phy_ctl |= B43_TXH_PHY_ANT0; - break; - case 2: /* Antenna 1 */ - phy_ctl |= B43_TXH_PHY_ANT1; - break; - case 3: /* Antenna 2 */ - phy_ctl |= B43_TXH_PHY_ANT2; - break; - case 4: /* Antenna 3 */ - phy_ctl |= B43_TXH_PHY_ANT3; - break; - default: - B43_WARN_ON(1); - } - - rates = info->control.rates; - /* MAC control */ - if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) - mac_ctl |= B43_TXH_MAC_ACK; - /* use hardware sequence counter as the non-TID counter */ - if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) - mac_ctl |= B43_TXH_MAC_HWSEQ; - if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) - mac_ctl |= B43_TXH_MAC_STMSDU; - if (phy->type == B43_PHYTYPE_A) - mac_ctl |= B43_TXH_MAC_5GHZ; - - /* Overwrite rates[0].count to make the retry calculation - * in the tx status easier. need the actual retry limit to - * detect whether the fallback rate was used. - */ - if ((rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || - (rates[0].count <= dev->wl->hw->conf.long_frame_max_tx_count)) { - rates[0].count = dev->wl->hw->conf.long_frame_max_tx_count; - mac_ctl |= B43_TXH_MAC_LONGFRAME; - } else { - rates[0].count = dev->wl->hw->conf.short_frame_max_tx_count; - } - - /* Generate the RTS or CTS-to-self frame */ - if ((rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || - (rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) { - unsigned int len; - struct ieee80211_hdr *uninitialized_var(hdr); - int rts_rate, rts_rate_fb; - int rts_rate_ofdm, rts_rate_fb_ofdm; - struct b43_plcp_hdr6 *uninitialized_var(plcp); - struct ieee80211_rate *rts_cts_rate; - - rts_cts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, info); - - rts_rate = rts_cts_rate ? rts_cts_rate->hw_value : B43_CCK_RATE_1MB; - rts_rate_ofdm = b43_is_ofdm_rate(rts_rate); - rts_rate_fb = b43_calc_fallback_rate(rts_rate); - rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb); - - if (rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { - struct ieee80211_cts *uninitialized_var(cts); - - switch (dev->fw.hdr_format) { - case B43_FW_HDR_598: - cts = (struct ieee80211_cts *) - (txhdr->format_598.rts_frame); - break; - case B43_FW_HDR_351: - cts = (struct ieee80211_cts *) - (txhdr->format_351.rts_frame); - break; - case B43_FW_HDR_410: - cts = (struct ieee80211_cts *) - (txhdr->format_410.rts_frame); - break; - } - ieee80211_ctstoself_get(dev->wl->hw, info->control.vif, - fragment_data, fragment_len, - info, cts); - mac_ctl |= B43_TXH_MAC_SENDCTS; - len = sizeof(struct ieee80211_cts); - } else { - struct ieee80211_rts *uninitialized_var(rts); - - switch (dev->fw.hdr_format) { - case B43_FW_HDR_598: - rts = (struct ieee80211_rts *) - (txhdr->format_598.rts_frame); - break; - case B43_FW_HDR_351: - rts = (struct ieee80211_rts *) - (txhdr->format_351.rts_frame); - break; - case B43_FW_HDR_410: - rts = (struct ieee80211_rts *) - (txhdr->format_410.rts_frame); - break; - } - ieee80211_rts_get(dev->wl->hw, info->control.vif, - fragment_data, fragment_len, - info, rts); - mac_ctl |= B43_TXH_MAC_SENDRTS; - len = sizeof(struct ieee80211_rts); - } - len += FCS_LEN; - - /* Generate the PLCP headers for the RTS/CTS frame */ - switch (dev->fw.hdr_format) { - case B43_FW_HDR_598: - plcp = &txhdr->format_598.rts_plcp; - break; - case B43_FW_HDR_351: - plcp = &txhdr->format_351.rts_plcp; - break; - case B43_FW_HDR_410: - plcp = &txhdr->format_410.rts_plcp; - break; - } - b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)plcp, - len, rts_rate); - plcp = &txhdr->rts_plcp_fb; - b43_generate_plcp_hdr((struct b43_plcp_hdr4 *)plcp, - len, rts_rate_fb); - - switch (dev->fw.hdr_format) { - case B43_FW_HDR_598: - hdr = (struct ieee80211_hdr *) - (&txhdr->format_598.rts_frame); - break; - case B43_FW_HDR_351: - hdr = (struct ieee80211_hdr *) - (&txhdr->format_351.rts_frame); - break; - case B43_FW_HDR_410: - hdr = (struct ieee80211_hdr *) - (&txhdr->format_410.rts_frame); - break; - } - txhdr->rts_dur_fb = hdr->duration_id; - - if (rts_rate_ofdm) { - extra_ft |= B43_TXH_EFT_RTS_OFDM; - txhdr->phy_rate_rts = - b43_plcp_get_ratecode_ofdm(rts_rate); - } else { - extra_ft |= B43_TXH_EFT_RTS_CCK; - txhdr->phy_rate_rts = - b43_plcp_get_ratecode_cck(rts_rate); - } - if (rts_rate_fb_ofdm) - extra_ft |= B43_TXH_EFT_RTSFB_OFDM; - else - extra_ft |= B43_TXH_EFT_RTSFB_CCK; - - if (rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS && - fill_phy_ctl1) { - txhdr->phy_ctl1_rts = cpu_to_le16( - b43_generate_tx_phy_ctl1(dev, rts_rate)); - txhdr->phy_ctl1_rts_fb = cpu_to_le16( - b43_generate_tx_phy_ctl1(dev, rts_rate_fb)); - } - } - - /* Magic cookie */ - switch (dev->fw.hdr_format) { - case B43_FW_HDR_598: - txhdr->format_598.cookie = cpu_to_le16(cookie); - break; - case B43_FW_HDR_351: - txhdr->format_351.cookie = cpu_to_le16(cookie); - break; - case B43_FW_HDR_410: - txhdr->format_410.cookie = cpu_to_le16(cookie); - break; - } - - if (fill_phy_ctl1) { - txhdr->phy_ctl1 = - cpu_to_le16(b43_generate_tx_phy_ctl1(dev, rate)); - txhdr->phy_ctl1_fb = - cpu_to_le16(b43_generate_tx_phy_ctl1(dev, rate_fb)); - } - - /* Apply the bitfields */ - txhdr->mac_ctl = cpu_to_le32(mac_ctl); - txhdr->phy_ctl = cpu_to_le16(phy_ctl); - txhdr->extra_ft = extra_ft; - - return 0; -} - -static s8 b43_rssi_postprocess(struct b43_wldev *dev, - u8 in_rssi, int ofdm, - int adjust_2053, int adjust_2050) -{ - struct b43_phy *phy = &dev->phy; - struct b43_phy_g *gphy = phy->g; - s32 tmp; - - switch (phy->radio_ver) { - case 0x2050: - if (ofdm) { - tmp = in_rssi; - if (tmp > 127) - tmp -= 256; - tmp *= 73; - tmp /= 64; - if (adjust_2050) - tmp += 25; - else - tmp -= 3; - } else { - if (dev->dev->bus_sprom-> - boardflags_lo & B43_BFL_RSSI) { - if (in_rssi > 63) - in_rssi = 63; - B43_WARN_ON(phy->type != B43_PHYTYPE_G); - tmp = gphy->nrssi_lt[in_rssi]; - tmp = 31 - tmp; - tmp *= -131; - tmp /= 128; - tmp -= 57; - } else { - tmp = in_rssi; - tmp = 31 - tmp; - tmp *= -149; - tmp /= 128; - tmp -= 68; - } - if (phy->type == B43_PHYTYPE_G && adjust_2050) - tmp += 25; - } - break; - case 0x2060: - if (in_rssi > 127) - tmp = in_rssi - 256; - else - tmp = in_rssi; - break; - default: - tmp = in_rssi; - tmp -= 11; - tmp *= 103; - tmp /= 64; - if (adjust_2053) - tmp -= 109; - else - tmp -= 83; - } - - return (s8) tmp; -} - -//TODO -#if 0 -static s8 b43_rssinoise_postprocess(struct b43_wldev *dev, u8 in_rssi) -{ - struct b43_phy *phy = &dev->phy; - s8 ret; - - if (phy->type == B43_PHYTYPE_A) { - //TODO: Incomplete specs. - ret = 0; - } else - ret = b43_rssi_postprocess(dev, in_rssi, 0, 1, 1); - - return ret; -} -#endif - -void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) -{ - struct ieee80211_rx_status status; - struct b43_plcp_hdr6 *plcp; - struct ieee80211_hdr *wlhdr; - const struct b43_rxhdr_fw4 *rxhdr = _rxhdr; - __le16 fctl; - u16 phystat0, phystat3; - u16 uninitialized_var(chanstat), uninitialized_var(mactime); - u32 uninitialized_var(macstat); - u16 chanid; - u16 phytype; - int padding, rate_idx; - - memset(&status, 0, sizeof(status)); - - /* Get metadata about the frame from the header. */ - phystat0 = le16_to_cpu(rxhdr->phy_status0); - phystat3 = le16_to_cpu(rxhdr->phy_status3); - switch (dev->fw.hdr_format) { - case B43_FW_HDR_598: - macstat = le32_to_cpu(rxhdr->format_598.mac_status); - mactime = le16_to_cpu(rxhdr->format_598.mac_time); - chanstat = le16_to_cpu(rxhdr->format_598.channel); - break; - case B43_FW_HDR_410: - case B43_FW_HDR_351: - macstat = le32_to_cpu(rxhdr->format_351.mac_status); - mactime = le16_to_cpu(rxhdr->format_351.mac_time); - chanstat = le16_to_cpu(rxhdr->format_351.channel); - break; - } - phytype = chanstat & B43_RX_CHAN_PHYTYPE; - - if (unlikely(macstat & B43_RX_MAC_FCSERR)) { - dev->wl->ieee_stats.dot11FCSErrorCount++; - status.flag |= RX_FLAG_FAILED_FCS_CRC; - } - if (unlikely(phystat0 & (B43_RX_PHYST0_PLCPHCF | B43_RX_PHYST0_PLCPFV))) - status.flag |= RX_FLAG_FAILED_PLCP_CRC; - if (phystat0 & B43_RX_PHYST0_SHORTPRMBL) - status.flag |= RX_FLAG_SHORTPRE; - if (macstat & B43_RX_MAC_DECERR) { - /* Decryption with the given key failed. - * Drop the packet. We also won't be able to decrypt it with - * the key in software. */ - goto drop; - } - - /* Skip PLCP and padding */ - padding = (macstat & B43_RX_MAC_PADDING) ? 2 : 0; - if (unlikely(skb->len < (sizeof(struct b43_plcp_hdr6) + padding))) { - b43dbg(dev->wl, "RX: Packet size underrun (1)\n"); - goto drop; - } - plcp = (struct b43_plcp_hdr6 *)(skb->data + padding); - skb_pull(skb, sizeof(struct b43_plcp_hdr6) + padding); - /* The skb contains the Wireless Header + payload data now */ - if (unlikely(skb->len < (2 + 2 + 6 /*minimum hdr */ + FCS_LEN))) { - b43dbg(dev->wl, "RX: Packet size underrun (2)\n"); - goto drop; - } - wlhdr = (struct ieee80211_hdr *)(skb->data); - fctl = wlhdr->frame_control; - - if (macstat & B43_RX_MAC_DEC) { - unsigned int keyidx; - int wlhdr_len; - - keyidx = ((macstat & B43_RX_MAC_KEYIDX) - >> B43_RX_MAC_KEYIDX_SHIFT); - /* We must adjust the key index here. We want the "physical" - * key index, but the ucode passed it slightly different. - */ - keyidx = b43_kidx_to_raw(dev, keyidx); - B43_WARN_ON(keyidx >= ARRAY_SIZE(dev->key)); - - if (dev->key[keyidx].algorithm != B43_SEC_ALGO_NONE) { - wlhdr_len = ieee80211_hdrlen(fctl); - if (unlikely(skb->len < (wlhdr_len + 3))) { - b43dbg(dev->wl, - "RX: Packet size underrun (3)\n"); - goto drop; - } - status.flag |= RX_FLAG_DECRYPTED; - } - } - - /* Link quality statistics */ - switch (chanstat & B43_RX_CHAN_PHYTYPE) { - case B43_PHYTYPE_HT: - /* TODO: is max the right choice? */ - status.signal = max_t(__s8, - max(rxhdr->phy_ht_power0, rxhdr->phy_ht_power1), - rxhdr->phy_ht_power2); - break; - case B43_PHYTYPE_N: - /* Broadcom has code for min and avg, but always uses max */ - if (rxhdr->power0 == 16 || rxhdr->power0 == 32) - status.signal = max(rxhdr->power1, rxhdr->power2); - else - status.signal = max(rxhdr->power0, rxhdr->power1); - break; - case B43_PHYTYPE_A: - case B43_PHYTYPE_B: - case B43_PHYTYPE_G: - case B43_PHYTYPE_LP: - status.signal = b43_rssi_postprocess(dev, rxhdr->jssi, - (phystat0 & B43_RX_PHYST0_OFDM), - (phystat0 & B43_RX_PHYST0_GAINCTL), - (phystat3 & B43_RX_PHYST3_TRSTATE)); - break; - } - - if (phystat0 & B43_RX_PHYST0_OFDM) - rate_idx = b43_plcp_get_bitrate_idx_ofdm(plcp, - phytype == B43_PHYTYPE_A); - else - rate_idx = b43_plcp_get_bitrate_idx_cck(plcp); - if (unlikely(rate_idx == -1)) { - /* PLCP seems to be corrupted. - * Drop the frame, if we are not interested in corrupted frames. */ - if (!(dev->wl->filter_flags & FIF_PLCPFAIL)) - goto drop; - } - status.rate_idx = rate_idx; - status.antenna = !!(phystat0 & B43_RX_PHYST0_ANT); - - /* - * All frames on monitor interfaces and beacons always need a full - * 64-bit timestamp. Monitor interfaces need it for diagnostic - * purposes and beacons for IBSS merging. - * This code assumes we get to process the packet within 16 bits - * of timestamp, i.e. about 65 milliseconds after the PHY received - * the first symbol. - */ - if (ieee80211_is_beacon(fctl) || dev->wl->radiotap_enabled) { - u16 low_mactime_now; - - b43_tsf_read(dev, &status.mactime); - low_mactime_now = status.mactime; - status.mactime = status.mactime & ~0xFFFFULL; - status.mactime += mactime; - if (low_mactime_now <= mactime) - status.mactime -= 0x10000; - status.flag |= RX_FLAG_MACTIME_START; - } - - chanid = (chanstat & B43_RX_CHAN_ID) >> B43_RX_CHAN_ID_SHIFT; - switch (chanstat & B43_RX_CHAN_PHYTYPE) { - case B43_PHYTYPE_A: - status.band = IEEE80211_BAND_5GHZ; - B43_WARN_ON(1); - /* FIXME: We don't really know which value the "chanid" contains. - * So the following assignment might be wrong. */ - status.freq = b43_channel_to_freq_5ghz(chanid); - break; - case B43_PHYTYPE_G: - status.band = IEEE80211_BAND_2GHZ; - /* chanid is the radio channel cookie value as used - * to tune the radio. */ - status.freq = chanid + 2400; - break; - case B43_PHYTYPE_N: - case B43_PHYTYPE_LP: - case B43_PHYTYPE_HT: - /* chanid is the SHM channel cookie. Which is the plain - * channel number in b43. */ - if (chanstat & B43_RX_CHAN_5GHZ) { - status.band = IEEE80211_BAND_5GHZ; - status.freq = b43_freq_to_channel_5ghz(chanid); - } else { - status.band = IEEE80211_BAND_2GHZ; - status.freq = b43_freq_to_channel_2ghz(chanid); - } - break; - default: - B43_WARN_ON(1); - goto drop; - } - - memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); - ieee80211_rx_ni(dev->wl->hw, skb); - -#if B43_DEBUG - dev->rx_count++; -#endif - return; -drop: - dev_kfree_skb_any(skb); -} - -void b43_handle_txstatus(struct b43_wldev *dev, - const struct b43_txstatus *status) -{ - b43_debugfs_log_txstat(dev, status); - - if (status->intermediate) - return; - if (status->for_ampdu) - return; - if (!status->acked) - dev->wl->ieee_stats.dot11ACKFailureCount++; - if (status->rts_count) { - if (status->rts_count == 0xF) //FIXME - dev->wl->ieee_stats.dot11RTSFailureCount++; - else - dev->wl->ieee_stats.dot11RTSSuccessCount++; - } - - if (b43_using_pio_transfers(dev)) - b43_pio_handle_txstatus(dev, status); - else - b43_dma_handle_txstatus(dev, status); - - b43_phy_txpower_check(dev, 0); -} - -/* Fill out the mac80211 TXstatus report based on the b43-specific - * txstatus report data. This returns a boolean whether the frame was - * successfully transmitted. */ -bool b43_fill_txstatus_report(struct b43_wldev *dev, - struct ieee80211_tx_info *report, - const struct b43_txstatus *status) -{ - bool frame_success = true; - int retry_limit; - - /* preserve the confiured retry limit before clearing the status - * The xmit function has overwritten the rc's value with the actual - * retry limit done by the hardware */ - retry_limit = report->status.rates[0].count; - ieee80211_tx_info_clear_status(report); - - if (status->acked) { - /* The frame was ACKed. */ - report->flags |= IEEE80211_TX_STAT_ACK; - } else { - /* The frame was not ACKed... */ - if (!(report->flags & IEEE80211_TX_CTL_NO_ACK)) { - /* ...but we expected an ACK. */ - frame_success = false; - } - } - if (status->frame_count == 0) { - /* The frame was not transmitted at all. */ - report->status.rates[0].count = 0; - } else if (status->rts_count > dev->wl->hw->conf.short_frame_max_tx_count) { - /* - * If the short retries (RTS, not data frame) have exceeded - * the limit, the hw will not have tried the selected rate, - * but will have used the fallback rate instead. - * Don't let the rate control count attempts for the selected - * rate in this case, otherwise the statistics will be off. - */ - report->status.rates[0].count = 0; - report->status.rates[1].count = status->frame_count; - } else { - if (status->frame_count > retry_limit) { - report->status.rates[0].count = retry_limit; - report->status.rates[1].count = status->frame_count - - retry_limit; - - } else { - report->status.rates[0].count = status->frame_count; - report->status.rates[1].idx = -1; - } - } - - return frame_success; -} - -/* Stop any TX operation on the device (suspend the hardware queues) */ -void b43_tx_suspend(struct b43_wldev *dev) -{ - if (b43_using_pio_transfers(dev)) - b43_pio_tx_suspend(dev); - else - b43_dma_tx_suspend(dev); -} - -/* Resume any TX operation on the device (resume the hardware queues) */ -void b43_tx_resume(struct b43_wldev *dev) -{ - if (b43_using_pio_transfers(dev)) - b43_pio_tx_resume(dev); - else - b43_dma_tx_resume(dev); -} diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h deleted file mode 100644 index 98d90747836a..000000000000 --- a/drivers/net/wireless/b43/xmit.h +++ /dev/null @@ -1,412 +0,0 @@ -#ifndef B43_XMIT_H_ -#define B43_XMIT_H_ - -#include "main.h" -#include - - -#define _b43_declare_plcp_hdr(size) \ - struct b43_plcp_hdr##size { \ - union { \ - __le32 data; \ - __u8 raw[size]; \ - } __packed; \ - } __packed - -/* struct b43_plcp_hdr4 */ -_b43_declare_plcp_hdr(4); -/* struct b43_plcp_hdr6 */ -_b43_declare_plcp_hdr(6); - -#undef _b43_declare_plcp_hdr - -/* TX header for v4 firmware */ -struct b43_txhdr { - __le32 mac_ctl; /* MAC TX control */ - __le16 mac_frame_ctl; /* Copy of the FrameControl field */ - __le16 tx_fes_time_norm; /* TX FES Time Normal */ - __le16 phy_ctl; /* PHY TX control */ - __le16 phy_ctl1; /* PHY TX control word 1 */ - __le16 phy_ctl1_fb; /* PHY TX control word 1 for fallback rates */ - __le16 phy_ctl1_rts; /* PHY TX control word 1 RTS */ - __le16 phy_ctl1_rts_fb; /* PHY TX control word 1 RTS for fallback rates */ - __u8 phy_rate; /* PHY rate */ - __u8 phy_rate_rts; /* PHY rate for RTS/CTS */ - __u8 extra_ft; /* Extra Frame Types */ - __u8 chan_radio_code; /* Channel Radio Code */ - __u8 iv[16]; /* Encryption IV */ - __u8 tx_receiver[6]; /* TX Frame Receiver address */ - __le16 tx_fes_time_fb; /* TX FES Time Fallback */ - struct b43_plcp_hdr6 rts_plcp_fb; /* RTS fallback PLCP header */ - __le16 rts_dur_fb; /* RTS fallback duration */ - struct b43_plcp_hdr6 plcp_fb; /* Fallback PLCP header */ - __le16 dur_fb; /* Fallback duration */ - __le16 mimo_modelen; /* MIMO mode length */ - __le16 mimo_ratelen_fb; /* MIMO fallback rate length */ - __le32 timeout; /* Timeout */ - - union { - /* Tested with 598.314, 644.1001 and 666.2 */ - struct { - __le16 mimo_antenna; /* MIMO antenna select */ - __le16 preload_size; /* Preload size */ - PAD_BYTES(2); - __le16 cookie; /* TX frame cookie */ - __le16 tx_status; /* TX status */ - __le16 max_n_mpdus; - __le16 max_a_bytes_mrt; - __le16 max_a_bytes_fbr; - __le16 min_m_bytes; - struct b43_plcp_hdr6 rts_plcp; /* RTS PLCP header */ - __u8 rts_frame[16]; /* The RTS frame (if used) */ - PAD_BYTES(2); - struct b43_plcp_hdr6 plcp; /* Main PLCP header */ - } format_598 __packed; - - /* Tested with 410.2160, 478.104 and 508.* */ - struct { - __le16 mimo_antenna; /* MIMO antenna select */ - __le16 preload_size; /* Preload size */ - PAD_BYTES(2); - __le16 cookie; /* TX frame cookie */ - __le16 tx_status; /* TX status */ - struct b43_plcp_hdr6 rts_plcp; /* RTS PLCP header */ - __u8 rts_frame[16]; /* The RTS frame (if used) */ - PAD_BYTES(2); - struct b43_plcp_hdr6 plcp; /* Main PLCP header */ - } format_410 __packed; - - /* Tested with 351.126 */ - struct { - PAD_BYTES(2); - __le16 cookie; /* TX frame cookie */ - __le16 tx_status; /* TX status */ - struct b43_plcp_hdr6 rts_plcp; /* RTS PLCP header */ - __u8 rts_frame[16]; /* The RTS frame (if used) */ - PAD_BYTES(2); - struct b43_plcp_hdr6 plcp; /* Main PLCP header */ - } format_351 __packed; - - } __packed; -} __packed; - -struct b43_tx_legacy_rate_phy_ctl_entry { - u8 bitrate; - u16 coding_rate; - u16 modulation; -}; - -/* MAC TX control */ -#define B43_TXH_MAC_USEFBR 0x10000000 /* Use fallback rate for this AMPDU */ -#define B43_TXH_MAC_KEYIDX 0x0FF00000 /* Security key index */ -#define B43_TXH_MAC_KEYIDX_SHIFT 20 -#define B43_TXH_MAC_KEYALG 0x00070000 /* Security key algorithm */ -#define B43_TXH_MAC_KEYALG_SHIFT 16 -#define B43_TXH_MAC_AMIC 0x00008000 /* AMIC */ -#define B43_TXH_MAC_RIFS 0x00004000 /* Use RIFS */ -#define B43_TXH_MAC_LIFETIME 0x00002000 /* Lifetime */ -#define B43_TXH_MAC_FRAMEBURST 0x00001000 /* Frameburst */ -#define B43_TXH_MAC_SENDCTS 0x00000800 /* Send CTS-to-self */ -#define B43_TXH_MAC_AMPDU 0x00000600 /* AMPDU status */ -#define B43_TXH_MAC_AMPDU_MPDU 0x00000000 /* Regular MPDU, not an AMPDU */ -#define B43_TXH_MAC_AMPDU_FIRST 0x00000200 /* First MPDU or AMPDU */ -#define B43_TXH_MAC_AMPDU_INTER 0x00000400 /* Intermediate MPDU or AMPDU */ -#define B43_TXH_MAC_AMPDU_LAST 0x00000600 /* Last (or only) MPDU of AMPDU */ -#define B43_TXH_MAC_40MHZ 0x00000100 /* Use 40 MHz bandwidth */ -#define B43_TXH_MAC_5GHZ 0x00000080 /* 5GHz band */ -#define B43_TXH_MAC_DFCS 0x00000040 /* DFCS */ -#define B43_TXH_MAC_IGNPMQ 0x00000020 /* Ignore PMQ */ -#define B43_TXH_MAC_HWSEQ 0x00000010 /* Use Hardware Sequence Number */ -#define B43_TXH_MAC_STMSDU 0x00000008 /* Start MSDU */ -#define B43_TXH_MAC_SENDRTS 0x00000004 /* Send RTS */ -#define B43_TXH_MAC_LONGFRAME 0x00000002 /* Long frame */ -#define B43_TXH_MAC_ACK 0x00000001 /* Immediate ACK */ - -/* Extra Frame Types */ -#define B43_TXH_EFT_FB 0x03 /* Data frame fallback encoding */ -#define B43_TXH_EFT_FB_CCK 0x00 /* CCK */ -#define B43_TXH_EFT_FB_OFDM 0x01 /* OFDM */ -#define B43_TXH_EFT_FB_EWC 0x02 /* EWC */ -#define B43_TXH_EFT_FB_N 0x03 /* N */ -#define B43_TXH_EFT_RTS 0x0C /* RTS/CTS encoding */ -#define B43_TXH_EFT_RTS_CCK 0x00 /* CCK */ -#define B43_TXH_EFT_RTS_OFDM 0x04 /* OFDM */ -#define B43_TXH_EFT_RTS_EWC 0x08 /* EWC */ -#define B43_TXH_EFT_RTS_N 0x0C /* N */ -#define B43_TXH_EFT_RTSFB 0x30 /* RTS/CTS fallback encoding */ -#define B43_TXH_EFT_RTSFB_CCK 0x00 /* CCK */ -#define B43_TXH_EFT_RTSFB_OFDM 0x10 /* OFDM */ -#define B43_TXH_EFT_RTSFB_EWC 0x20 /* EWC */ -#define B43_TXH_EFT_RTSFB_N 0x30 /* N */ - -/* PHY TX control word */ -#define B43_TXH_PHY_ENC 0x0003 /* Data frame encoding */ -#define B43_TXH_PHY_ENC_CCK 0x0000 /* CCK */ -#define B43_TXH_PHY_ENC_OFDM 0x0001 /* OFDM */ -#define B43_TXH_PHY_ENC_EWC 0x0002 /* EWC */ -#define B43_TXH_PHY_ENC_N 0x0003 /* N */ -#define B43_TXH_PHY_SHORTPRMBL 0x0010 /* Use short preamble */ -#define B43_TXH_PHY_ANT 0x03C0 /* Antenna selection */ -#define B43_TXH_PHY_ANT0 0x0000 /* Use antenna 0 */ -#define B43_TXH_PHY_ANT1 0x0040 /* Use antenna 1 */ -#define B43_TXH_PHY_ANT01AUTO 0x00C0 /* Use antenna 0/1 auto */ -#define B43_TXH_PHY_ANT2 0x0100 /* Use antenna 2 */ -#define B43_TXH_PHY_ANT3 0x0200 /* Use antenna 3 */ -#define B43_TXH_PHY_TXPWR 0xFC00 /* TX power */ -#define B43_TXH_PHY_TXPWR_SHIFT 10 - -/* PHY TX control word 1 */ -#define B43_TXH_PHY1_BW 0x0007 /* Bandwidth */ -#define B43_TXH_PHY1_BW_10 0x0000 /* 10 MHz */ -#define B43_TXH_PHY1_BW_10U 0x0001 /* 10 MHz upper */ -#define B43_TXH_PHY1_BW_20 0x0002 /* 20 MHz */ -#define B43_TXH_PHY1_BW_20U 0x0003 /* 20 MHz upper */ -#define B43_TXH_PHY1_BW_40 0x0004 /* 40 MHz */ -#define B43_TXH_PHY1_BW_40DUP 0x0005 /* 50 MHz duplicate */ -#define B43_TXH_PHY1_MODE 0x0038 /* Mode */ -#define B43_TXH_PHY1_MODE_SISO 0x0000 /* SISO */ -#define B43_TXH_PHY1_MODE_CDD 0x0008 /* CDD */ -#define B43_TXH_PHY1_MODE_STBC 0x0010 /* STBC */ -#define B43_TXH_PHY1_MODE_SDM 0x0018 /* SDM */ -#define B43_TXH_PHY1_CRATE 0x0700 /* Coding rate */ -#define B43_TXH_PHY1_CRATE_1_2 0x0000 /* 1/2 */ -#define B43_TXH_PHY1_CRATE_2_3 0x0100 /* 2/3 */ -#define B43_TXH_PHY1_CRATE_3_4 0x0200 /* 3/4 */ -#define B43_TXH_PHY1_CRATE_4_5 0x0300 /* 4/5 */ -#define B43_TXH_PHY1_CRATE_5_6 0x0400 /* 5/6 */ -#define B43_TXH_PHY1_CRATE_7_8 0x0600 /* 7/8 */ -#define B43_TXH_PHY1_MODUL 0x3800 /* Modulation scheme */ -#define B43_TXH_PHY1_MODUL_BPSK 0x0000 /* BPSK */ -#define B43_TXH_PHY1_MODUL_QPSK 0x0800 /* QPSK */ -#define B43_TXH_PHY1_MODUL_QAM16 0x1000 /* QAM16 */ -#define B43_TXH_PHY1_MODUL_QAM64 0x1800 /* QAM64 */ -#define B43_TXH_PHY1_MODUL_QAM256 0x2000 /* QAM256 */ - - -static inline -size_t b43_txhdr_size(struct b43_wldev *dev) -{ - switch (dev->fw.hdr_format) { - case B43_FW_HDR_598: - return 112 + sizeof(struct b43_plcp_hdr6); - case B43_FW_HDR_410: - return 104 + sizeof(struct b43_plcp_hdr6); - case B43_FW_HDR_351: - return 100 + sizeof(struct b43_plcp_hdr6); - } - return 0; -} - - -int b43_generate_txhdr(struct b43_wldev *dev, - u8 * txhdr, - struct sk_buff *skb_frag, - struct ieee80211_tx_info *txctl, u16 cookie); - -/* Transmit Status */ -struct b43_txstatus { - u16 cookie; /* The cookie from the txhdr */ - u16 seq; /* Sequence number */ - u8 phy_stat; /* PHY TX status */ - u8 frame_count; /* Frame transmit count */ - u8 rts_count; /* RTS transmit count */ - u8 supp_reason; /* Suppression reason */ - /* flags */ - u8 pm_indicated; /* PM mode indicated to AP */ - u8 intermediate; /* Intermediate status notification (not final) */ - u8 for_ampdu; /* Status is for an AMPDU (afterburner) */ - u8 acked; /* Wireless ACK received */ -}; - -/* txstatus supp_reason values */ -enum { - B43_TXST_SUPP_NONE, /* Not suppressed */ - B43_TXST_SUPP_PMQ, /* Suppressed due to PMQ entry */ - B43_TXST_SUPP_FLUSH, /* Suppressed due to flush request */ - B43_TXST_SUPP_PREV, /* Previous fragment failed */ - B43_TXST_SUPP_CHAN, /* Channel mismatch */ - B43_TXST_SUPP_LIFE, /* Lifetime expired */ - B43_TXST_SUPP_UNDER, /* Buffer underflow */ - B43_TXST_SUPP_ABNACK, /* Afterburner NACK */ -}; - -/* Receive header for v4 firmware. */ -struct b43_rxhdr_fw4 { - __le16 frame_len; /* Frame length */ - PAD_BYTES(2); - __le16 phy_status0; /* PHY RX Status 0 */ - union { - /* RSSI for A/B/G-PHYs */ - struct { - __u8 jssi; /* PHY RX Status 1: JSSI */ - __u8 sig_qual; /* PHY RX Status 1: Signal Quality */ - } __packed; - - /* RSSI for N-PHYs */ - struct { - __s8 power0; /* PHY RX Status 1: Power 0 */ - __s8 power1; /* PHY RX Status 1: Power 1 */ - } __packed; - } __packed; - union { - /* HT-PHY */ - struct { - PAD_BYTES(1); - __s8 phy_ht_power0; - } __packed; - - /* RSSI for N-PHYs */ - struct { - __s8 power2; - PAD_BYTES(1); - } __packed; - - __le16 phy_status2; /* PHY RX Status 2 */ - } __packed; - union { - /* HT-PHY */ - struct { - __s8 phy_ht_power1; - __s8 phy_ht_power2; - } __packed; - - __le16 phy_status3; /* PHY RX Status 3 */ - } __packed; - union { - /* Tested with 598.314, 644.1001 and 666.2 */ - struct { - __le16 phy_status4; /* PHY RX Status 4 */ - __le16 phy_status5; /* PHY RX Status 5 */ - __le32 mac_status; /* MAC RX status */ - __le16 mac_time; - __le16 channel; - } format_598 __packed; - - /* Tested with 351.126, 410.2160, 478.104 and 508.* */ - struct { - __le32 mac_status; /* MAC RX status */ - __le16 mac_time; - __le16 channel; - } format_351 __packed; - } __packed; -} __packed; - -/* PHY RX Status 0 */ -#define B43_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */ -#define B43_RX_PHYST0_PLCPHCF 0x0200 -#define B43_RX_PHYST0_PLCPFV 0x0100 -#define B43_RX_PHYST0_SHORTPRMBL 0x0080 /* Received with Short Preamble */ -#define B43_RX_PHYST0_LCRS 0x0040 -#define B43_RX_PHYST0_ANT 0x0020 /* Antenna */ -#define B43_RX_PHYST0_UNSRATE 0x0010 -#define B43_RX_PHYST0_CLIP 0x000C -#define B43_RX_PHYST0_CLIP_SHIFT 2 -#define B43_RX_PHYST0_FTYPE 0x0003 /* Frame type */ -#define B43_RX_PHYST0_CCK 0x0000 /* Frame type: CCK */ -#define B43_RX_PHYST0_OFDM 0x0001 /* Frame type: OFDM */ -#define B43_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */ -#define B43_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */ - -/* PHY RX Status 2 */ -#define B43_RX_PHYST2_LNAG 0xC000 /* LNA Gain */ -#define B43_RX_PHYST2_LNAG_SHIFT 14 -#define B43_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */ -#define B43_RX_PHYST2_PNAG_SHIFT 10 -#define B43_RX_PHYST2_FOFF 0x03FF /* F offset */ - -/* PHY RX Status 3 */ -#define B43_RX_PHYST3_DIGG 0x1800 /* DIG Gain */ -#define B43_RX_PHYST3_DIGG_SHIFT 11 -#define B43_RX_PHYST3_TRSTATE 0x0400 /* TR state */ - -/* MAC RX Status */ -#define B43_RX_MAC_RXST_VALID 0x01000000 /* PHY RXST valid */ -#define B43_RX_MAC_TKIP_MICERR 0x00100000 /* TKIP MIC error */ -#define B43_RX_MAC_TKIP_MICATT 0x00080000 /* TKIP MIC attempted */ -#define B43_RX_MAC_AGGTYPE 0x00060000 /* Aggregation type */ -#define B43_RX_MAC_AGGTYPE_SHIFT 17 -#define B43_RX_MAC_AMSDU 0x00010000 /* A-MSDU mask */ -#define B43_RX_MAC_BEACONSENT 0x00008000 /* Beacon sent flag */ -#define B43_RX_MAC_KEYIDX 0x000007E0 /* Key index */ -#define B43_RX_MAC_KEYIDX_SHIFT 5 -#define B43_RX_MAC_DECERR 0x00000010 /* Decrypt error */ -#define B43_RX_MAC_DEC 0x00000008 /* Decryption attempted */ -#define B43_RX_MAC_PADDING 0x00000004 /* Pad bytes present */ -#define B43_RX_MAC_RESP 0x00000002 /* Response frame transmitted */ -#define B43_RX_MAC_FCSERR 0x00000001 /* FCS error */ - -/* RX channel */ -#define B43_RX_CHAN_40MHZ 0x1000 /* 40 Mhz channel width */ -#define B43_RX_CHAN_5GHZ 0x0800 /* 5 Ghz band */ -#define B43_RX_CHAN_ID 0x07F8 /* Channel ID */ -#define B43_RX_CHAN_ID_SHIFT 3 -#define B43_RX_CHAN_PHYTYPE 0x0007 /* PHY type */ - - -u8 b43_plcp_get_ratecode_cck(const u8 bitrate); -u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate); - -void b43_generate_plcp_hdr(struct b43_plcp_hdr4 *plcp, - const u16 octets, const u8 bitrate); - -void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr); - -void b43_handle_txstatus(struct b43_wldev *dev, - const struct b43_txstatus *status); -bool b43_fill_txstatus_report(struct b43_wldev *dev, - struct ieee80211_tx_info *report, - const struct b43_txstatus *status); - -void b43_tx_suspend(struct b43_wldev *dev); -void b43_tx_resume(struct b43_wldev *dev); - - -/* Helper functions for converting the key-table index from "firmware-format" - * to "raw-format" and back. The firmware API changed for this at some revision. - * We need to account for that here. */ -static inline int b43_new_kidx_api(struct b43_wldev *dev) -{ - /* FIXME: Not sure the change was at rev 351 */ - return (dev->fw.rev >= 351); -} -static inline u8 b43_kidx_to_fw(struct b43_wldev *dev, u8 raw_kidx) -{ - u8 firmware_kidx; - if (b43_new_kidx_api(dev)) { - firmware_kidx = raw_kidx; - } else { - if (raw_kidx >= 4) /* Is per STA key? */ - firmware_kidx = raw_kidx - 4; - else - firmware_kidx = raw_kidx; /* TX default key */ - } - return firmware_kidx; -} -static inline u8 b43_kidx_to_raw(struct b43_wldev *dev, u8 firmware_kidx) -{ - u8 raw_kidx; - if (b43_new_kidx_api(dev)) - raw_kidx = firmware_kidx; - else - raw_kidx = firmware_kidx + 4; /* RX default keys or per STA keys */ - return raw_kidx; -} - -/* struct b43_private_tx_info - TX info private to b43. - * The structure is placed in (struct ieee80211_tx_info *)->rate_driver_data - * - * @bouncebuffer: DMA Bouncebuffer (if used) - */ -struct b43_private_tx_info { - void *bouncebuffer; -}; - -static inline struct b43_private_tx_info * -b43_get_priv_tx_info(struct ieee80211_tx_info *info) -{ - BUILD_BUG_ON(sizeof(struct b43_private_tx_info) > - sizeof(info->rate_driver_data)); - return (struct b43_private_tx_info *)info->rate_driver_data; -} - -#endif /* B43_XMIT_H_ */ diff --git a/drivers/net/wireless/b43legacy/Kconfig b/drivers/net/wireless/b43legacy/Kconfig deleted file mode 100644 index 1ffa28835c58..000000000000 --- a/drivers/net/wireless/b43legacy/Kconfig +++ /dev/null @@ -1,104 +0,0 @@ -config B43LEGACY - tristate "Broadcom 43xx-legacy wireless support (mac80211 stack)" - depends on SSB_POSSIBLE && MAC80211 && HAS_DMA - select SSB - select FW_LOADER - ---help--- - b43legacy is a driver for 802.11b devices from Broadcom (BCM4301 and - BCM4303) and early model 802.11g chips (BCM4306 Ver. 2) used in the - Linksys WPC54G V1 PCMCIA devices. - - Newer 802.11g and 802.11a devices need b43. - - It is safe to include both b43 and b43legacy as the underlying glue - layer will automatically load the correct version for your device. - - This driver uses V3 firmware, which must be installed separately using - b43-fwcutter. - - This driver can be built as a module (recommended) that will be - called "b43legacy". If unsure, say M. - -# Auto-select SSB PCI-HOST support, if possible -config B43LEGACY_PCI_AUTOSELECT - bool - depends on B43LEGACY && SSB_PCIHOST_POSSIBLE - select SSB_PCIHOST - select SSB_B43_PCI_BRIDGE - default y - -# Auto-select SSB PCICORE driver, if possible -config B43LEGACY_PCICORE_AUTOSELECT - bool - depends on B43LEGACY && SSB_DRIVER_PCICORE_POSSIBLE - select SSB_DRIVER_PCICORE - default y - -# LED support -# This config option automatically enables b43legacy LEDS support, -# if it's possible. -config B43LEGACY_LEDS - bool - depends on B43LEGACY && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = B43LEGACY) - default y - -# This config option automatically enables b43 HW-RNG support, -# if the HW-RNG core is enabled. -config B43LEGACY_HWRNG - bool - depends on B43LEGACY && (HW_RANDOM = y || HW_RANDOM = B43LEGACY) - default y - -config B43LEGACY_DEBUG - bool "Broadcom 43xx-legacy debugging" - depends on B43LEGACY - default y - ---help--- - Say Y, because this information will help you get the driver running. - This option generates a minimum of log output. - -config B43LEGACY_DMA - bool - depends on B43LEGACY - -config B43LEGACY_PIO - bool - depends on B43LEGACY - -choice - prompt "Broadcom 43xx-legacy data transfer mode" - depends on B43LEGACY - default B43LEGACY_DMA_AND_PIO_MODE - -config B43LEGACY_DMA_AND_PIO_MODE - bool "DMA + PIO" - select B43LEGACY_DMA - select B43LEGACY_PIO - ---help--- - Include both, Direct Memory Access (DMA) and Programmed I/O (PIO) - data transfer modes. The mode actually used is selectable through - the module parameter "pio". With pio=0 as a module parameter, the - default DMA is used, otherwise PIO is used. - - If unsure, choose this option. - -config B43LEGACY_DMA_MODE - bool "DMA (Direct Memory Access) only" - select B43LEGACY_DMA - ---help--- - Only include Direct Memory Access (DMA). - This reduces the size of the driver module, by omitting the PIO code. - -config B43LEGACY_PIO_MODE - bool "PIO (Programmed I/O) only" - select B43LEGACY_PIO - ---help--- - Only include Programmed I/O (PIO). - This reduces the size of the driver module, by omitting the DMA code. - Please note that PIO transfers are slow (compared to DMA). - - Also note that not all devices of the b43legacy series support PIO. - - You should use PIO only if DMA does not work for you. - -endchoice diff --git a/drivers/net/wireless/b43legacy/Makefile b/drivers/net/wireless/b43legacy/Makefile deleted file mode 100644 index 227a77e84362..000000000000 --- a/drivers/net/wireless/b43legacy/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# b43legacy core -b43legacy-y += main.o -b43legacy-y += ilt.o -b43legacy-y += phy.o -b43legacy-y += radio.o -b43legacy-y += sysfs.o -b43legacy-y += xmit.o -# b43 RFKILL button support -b43legacy-y += rfkill.o -# b43legacy LED support -b43legacy-$(CONFIG_B43LEGACY_LEDS) += leds.o -# b43legacy debugging -b43legacy-$(CONFIG_B43LEGACY_DEBUG) += debugfs.o -# b43legacy DMA and PIO -b43legacy-$(CONFIG_B43LEGACY_DMA) += dma.o -b43legacy-$(CONFIG_B43LEGACY_PIO) += pio.o - -obj-$(CONFIG_B43LEGACY) += b43legacy.o - diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h deleted file mode 100644 index 482476fdb1f3..000000000000 --- a/drivers/net/wireless/b43legacy/b43legacy.h +++ /dev/null @@ -1,858 +0,0 @@ -#ifndef B43legacy_H_ -#define B43legacy_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "debugfs.h" -#include "leds.h" -#include "rfkill.h" -#include "phy.h" - - -#define B43legacy_IRQWAIT_MAX_RETRIES 20 - -/* MMIO offsets */ -#define B43legacy_MMIO_DMA0_REASON 0x20 -#define B43legacy_MMIO_DMA0_IRQ_MASK 0x24 -#define B43legacy_MMIO_DMA1_REASON 0x28 -#define B43legacy_MMIO_DMA1_IRQ_MASK 0x2C -#define B43legacy_MMIO_DMA2_REASON 0x30 -#define B43legacy_MMIO_DMA2_IRQ_MASK 0x34 -#define B43legacy_MMIO_DMA3_REASON 0x38 -#define B43legacy_MMIO_DMA3_IRQ_MASK 0x3C -#define B43legacy_MMIO_DMA4_REASON 0x40 -#define B43legacy_MMIO_DMA4_IRQ_MASK 0x44 -#define B43legacy_MMIO_DMA5_REASON 0x48 -#define B43legacy_MMIO_DMA5_IRQ_MASK 0x4C -#define B43legacy_MMIO_MACCTL 0x120 /* MAC control */ -#define B43legacy_MMIO_MACCMD 0x124 /* MAC command */ -#define B43legacy_MMIO_GEN_IRQ_REASON 0x128 -#define B43legacy_MMIO_GEN_IRQ_MASK 0x12C -#define B43legacy_MMIO_RAM_CONTROL 0x130 -#define B43legacy_MMIO_RAM_DATA 0x134 -#define B43legacy_MMIO_PS_STATUS 0x140 -#define B43legacy_MMIO_RADIO_HWENABLED_HI 0x158 -#define B43legacy_MMIO_SHM_CONTROL 0x160 -#define B43legacy_MMIO_SHM_DATA 0x164 -#define B43legacy_MMIO_SHM_DATA_UNALIGNED 0x166 -#define B43legacy_MMIO_XMITSTAT_0 0x170 -#define B43legacy_MMIO_XMITSTAT_1 0x174 -#define B43legacy_MMIO_REV3PLUS_TSF_LOW 0x180 /* core rev >= 3 only */ -#define B43legacy_MMIO_REV3PLUS_TSF_HIGH 0x184 /* core rev >= 3 only */ -#define B43legacy_MMIO_TSF_CFP_REP 0x188 -#define B43legacy_MMIO_TSF_CFP_START 0x18C -/* 32-bit DMA */ -#define B43legacy_MMIO_DMA32_BASE0 0x200 -#define B43legacy_MMIO_DMA32_BASE1 0x220 -#define B43legacy_MMIO_DMA32_BASE2 0x240 -#define B43legacy_MMIO_DMA32_BASE3 0x260 -#define B43legacy_MMIO_DMA32_BASE4 0x280 -#define B43legacy_MMIO_DMA32_BASE5 0x2A0 -/* 64-bit DMA */ -#define B43legacy_MMIO_DMA64_BASE0 0x200 -#define B43legacy_MMIO_DMA64_BASE1 0x240 -#define B43legacy_MMIO_DMA64_BASE2 0x280 -#define B43legacy_MMIO_DMA64_BASE3 0x2C0 -#define B43legacy_MMIO_DMA64_BASE4 0x300 -#define B43legacy_MMIO_DMA64_BASE5 0x340 -/* PIO */ -#define B43legacy_MMIO_PIO1_BASE 0x300 -#define B43legacy_MMIO_PIO2_BASE 0x310 -#define B43legacy_MMIO_PIO3_BASE 0x320 -#define B43legacy_MMIO_PIO4_BASE 0x330 - -#define B43legacy_MMIO_PHY_VER 0x3E0 -#define B43legacy_MMIO_PHY_RADIO 0x3E2 -#define B43legacy_MMIO_PHY0 0x3E6 -#define B43legacy_MMIO_ANTENNA 0x3E8 -#define B43legacy_MMIO_CHANNEL 0x3F0 -#define B43legacy_MMIO_CHANNEL_EXT 0x3F4 -#define B43legacy_MMIO_RADIO_CONTROL 0x3F6 -#define B43legacy_MMIO_RADIO_DATA_HIGH 0x3F8 -#define B43legacy_MMIO_RADIO_DATA_LOW 0x3FA -#define B43legacy_MMIO_PHY_CONTROL 0x3FC -#define B43legacy_MMIO_PHY_DATA 0x3FE -#define B43legacy_MMIO_MACFILTER_CONTROL 0x420 -#define B43legacy_MMIO_MACFILTER_DATA 0x422 -#define B43legacy_MMIO_RCMTA_COUNT 0x43C /* Receive Match Transmitter Addr */ -#define B43legacy_MMIO_RADIO_HWENABLED_LO 0x49A -#define B43legacy_MMIO_GPIO_CONTROL 0x49C -#define B43legacy_MMIO_GPIO_MASK 0x49E -#define B43legacy_MMIO_TSF_CFP_PRETBTT 0x612 -#define B43legacy_MMIO_TSF_0 0x632 /* core rev < 3 only */ -#define B43legacy_MMIO_TSF_1 0x634 /* core rev < 3 only */ -#define B43legacy_MMIO_TSF_2 0x636 /* core rev < 3 only */ -#define B43legacy_MMIO_TSF_3 0x638 /* core rev < 3 only */ -#define B43legacy_MMIO_RNG 0x65A -#define B43legacy_MMIO_POWERUP_DELAY 0x6A8 - -/* SPROM boardflags_lo values */ -#define B43legacy_BFL_PACTRL 0x0002 -#define B43legacy_BFL_RSSI 0x0008 -#define B43legacy_BFL_EXTLNA 0x1000 - -/* GPIO register offset, in both ChipCommon and PCI core. */ -#define B43legacy_GPIO_CONTROL 0x6c - -/* SHM Routing */ -#define B43legacy_SHM_SHARED 0x0001 -#define B43legacy_SHM_WIRELESS 0x0002 -#define B43legacy_SHM_HW 0x0004 -#define B43legacy_SHM_UCODE 0x0300 - -/* SHM Routing modifiers */ -#define B43legacy_SHM_AUTOINC_R 0x0200 /* Read Auto-increment */ -#define B43legacy_SHM_AUTOINC_W 0x0100 /* Write Auto-increment */ -#define B43legacy_SHM_AUTOINC_RW (B43legacy_SHM_AUTOINC_R | \ - B43legacy_SHM_AUTOINC_W) - -/* Misc SHM_SHARED offsets */ -#define B43legacy_SHM_SH_WLCOREREV 0x0016 /* 802.11 core revision */ -#define B43legacy_SHM_SH_HOSTFLO 0x005E /* Hostflags ucode opts (low) */ -#define B43legacy_SHM_SH_HOSTFHI 0x0060 /* Hostflags ucode opts (high) */ -/* SHM_SHARED crypto engine */ -#define B43legacy_SHM_SH_KEYIDXBLOCK 0x05D4 /* Key index/algorithm block */ -/* SHM_SHARED beacon/AP variables */ -#define B43legacy_SHM_SH_DTIMP 0x0012 /* DTIM period */ -#define B43legacy_SHM_SH_BTL0 0x0018 /* Beacon template length 0 */ -#define B43legacy_SHM_SH_BTL1 0x001A /* Beacon template length 1 */ -#define B43legacy_SHM_SH_BTSFOFF 0x001C /* Beacon TSF offset */ -#define B43legacy_SHM_SH_TIMPOS 0x001E /* TIM position in beacon */ -#define B43legacy_SHM_SH_BEACPHYCTL 0x0054 /* Beacon PHY TX control word */ -/* SHM_SHARED ACK/CTS control */ -#define B43legacy_SHM_SH_ACKCTSPHYCTL 0x0022 /* ACK/CTS PHY control word */ -/* SHM_SHARED probe response variables */ -#define B43legacy_SHM_SH_PRTLEN 0x004A /* Probe Response template length */ -#define B43legacy_SHM_SH_PRMAXTIME 0x0074 /* Probe Response max time */ -#define B43legacy_SHM_SH_PRPHYCTL 0x0188 /* Probe Resp PHY TX control */ -/* SHM_SHARED rate tables */ -#define B43legacy_SHM_SH_OFDMDIRECT 0x0480 /* Pointer to OFDM direct map */ -#define B43legacy_SHM_SH_OFDMBASIC 0x04A0 /* Pointer to OFDM basic rate map */ -#define B43legacy_SHM_SH_CCKDIRECT 0x04C0 /* Pointer to CCK direct map */ -#define B43legacy_SHM_SH_CCKBASIC 0x04E0 /* Pointer to CCK basic rate map */ -/* SHM_SHARED microcode soft registers */ -#define B43legacy_SHM_SH_UCODEREV 0x0000 /* Microcode revision */ -#define B43legacy_SHM_SH_UCODEPATCH 0x0002 /* Microcode patchlevel */ -#define B43legacy_SHM_SH_UCODEDATE 0x0004 /* Microcode date */ -#define B43legacy_SHM_SH_UCODETIME 0x0006 /* Microcode time */ -#define B43legacy_SHM_SH_SPUWKUP 0x0094 /* pre-wakeup for synth PU in us */ -#define B43legacy_SHM_SH_PRETBTT 0x0096 /* pre-TBTT in us */ - -#define B43legacy_UCODEFLAGS_OFFSET 0x005E - -/* Hardware Radio Enable masks */ -#define B43legacy_MMIO_RADIO_HWENABLED_HI_MASK (1 << 16) -#define B43legacy_MMIO_RADIO_HWENABLED_LO_MASK (1 << 4) - -/* HostFlags. See b43legacy_hf_read/write() */ -#define B43legacy_HF_SYMW 0x00000002 /* G-PHY SYM workaround */ -#define B43legacy_HF_GDCW 0x00000020 /* G-PHY DV cancel filter */ -#define B43legacy_HF_OFDMPABOOST 0x00000040 /* Enable PA boost OFDM */ -#define B43legacy_HF_EDCF 0x00000100 /* on if WME/MAC suspended */ - -/* MacFilter offsets. */ -#define B43legacy_MACFILTER_SELF 0x0000 -#define B43legacy_MACFILTER_BSSID 0x0003 -#define B43legacy_MACFILTER_MAC 0x0010 - -/* PHYVersioning */ -#define B43legacy_PHYTYPE_B 0x01 -#define B43legacy_PHYTYPE_G 0x02 - -/* PHYRegisters */ -#define B43legacy_PHY_G_LO_CONTROL 0x0810 -#define B43legacy_PHY_ILT_G_CTRL 0x0472 -#define B43legacy_PHY_ILT_G_DATA1 0x0473 -#define B43legacy_PHY_ILT_G_DATA2 0x0474 -#define B43legacy_PHY_G_PCTL 0x0029 -#define B43legacy_PHY_RADIO_BITFIELD 0x0401 -#define B43legacy_PHY_G_CRS 0x0429 -#define B43legacy_PHY_NRSSILT_CTRL 0x0803 -#define B43legacy_PHY_NRSSILT_DATA 0x0804 - -/* RadioRegisters */ -#define B43legacy_RADIOCTL_ID 0x01 - -/* MAC Control bitfield */ -#define B43legacy_MACCTL_ENABLED 0x00000001 /* MAC Enabled */ -#define B43legacy_MACCTL_PSM_RUN 0x00000002 /* Run Microcode */ -#define B43legacy_MACCTL_PSM_JMP0 0x00000004 /* Microcode jump to 0 */ -#define B43legacy_MACCTL_SHM_ENABLED 0x00000100 /* SHM Enabled */ -#define B43legacy_MACCTL_IHR_ENABLED 0x00000400 /* IHR Region Enabled */ -#define B43legacy_MACCTL_BE 0x00010000 /* Big Endian mode */ -#define B43legacy_MACCTL_INFRA 0x00020000 /* Infrastructure mode */ -#define B43legacy_MACCTL_AP 0x00040000 /* AccessPoint mode */ -#define B43legacy_MACCTL_RADIOLOCK 0x00080000 /* Radio lock */ -#define B43legacy_MACCTL_BEACPROMISC 0x00100000 /* Beacon Promiscuous */ -#define B43legacy_MACCTL_KEEP_BADPLCP 0x00200000 /* Keep bad PLCP frames */ -#define B43legacy_MACCTL_KEEP_CTL 0x00400000 /* Keep control frames */ -#define B43legacy_MACCTL_KEEP_BAD 0x00800000 /* Keep bad frames (FCS) */ -#define B43legacy_MACCTL_PROMISC 0x01000000 /* Promiscuous mode */ -#define B43legacy_MACCTL_HWPS 0x02000000 /* Hardware Power Saving */ -#define B43legacy_MACCTL_AWAKE 0x04000000 /* Device is awake */ -#define B43legacy_MACCTL_TBTTHOLD 0x10000000 /* TBTT Hold */ -#define B43legacy_MACCTL_GMODE 0x80000000 /* G Mode */ - -/* MAC Command bitfield */ -#define B43legacy_MACCMD_BEACON0_VALID 0x00000001 /* Beacon 0 in template RAM is busy/valid */ -#define B43legacy_MACCMD_BEACON1_VALID 0x00000002 /* Beacon 1 in template RAM is busy/valid */ -#define B43legacy_MACCMD_DFQ_VALID 0x00000004 /* Directed frame queue valid (IBSS PS mode, ATIM) */ -#define B43legacy_MACCMD_CCA 0x00000008 /* Clear channel assessment */ -#define B43legacy_MACCMD_BGNOISE 0x00000010 /* Background noise */ - -/* 802.11 core specific TM State Low flags */ -#define B43legacy_TMSLOW_GMODE 0x20000000 /* G Mode Enable */ -#define B43legacy_TMSLOW_PLLREFSEL 0x00200000 /* PLL Freq Ref Select */ -#define B43legacy_TMSLOW_MACPHYCLKEN 0x00100000 /* MAC PHY Clock Ctrl Enbl */ -#define B43legacy_TMSLOW_PHYRESET 0x00080000 /* PHY Reset */ -#define B43legacy_TMSLOW_PHYCLKEN 0x00040000 /* PHY Clock Enable */ - -/* 802.11 core specific TM State High flags */ -#define B43legacy_TMSHIGH_FCLOCK 0x00040000 /* Fast Clock Available */ -#define B43legacy_TMSHIGH_GPHY 0x00010000 /* G-PHY avail (rev >= 5) */ - -#define B43legacy_UCODEFLAG_AUTODIV 0x0001 - -/* Generic-Interrupt reasons. */ -#define B43legacy_IRQ_MAC_SUSPENDED 0x00000001 -#define B43legacy_IRQ_BEACON 0x00000002 -#define B43legacy_IRQ_TBTT_INDI 0x00000004 /* Target Beacon Transmit Time */ -#define B43legacy_IRQ_BEACON_TX_OK 0x00000008 -#define B43legacy_IRQ_BEACON_CANCEL 0x00000010 -#define B43legacy_IRQ_ATIM_END 0x00000020 -#define B43legacy_IRQ_PMQ 0x00000040 -#define B43legacy_IRQ_PIO_WORKAROUND 0x00000100 -#define B43legacy_IRQ_MAC_TXERR 0x00000200 -#define B43legacy_IRQ_PHY_TXERR 0x00000800 -#define B43legacy_IRQ_PMEVENT 0x00001000 -#define B43legacy_IRQ_TIMER0 0x00002000 -#define B43legacy_IRQ_TIMER1 0x00004000 -#define B43legacy_IRQ_DMA 0x00008000 -#define B43legacy_IRQ_TXFIFO_FLUSH_OK 0x00010000 -#define B43legacy_IRQ_CCA_MEASURE_OK 0x00020000 -#define B43legacy_IRQ_NOISESAMPLE_OK 0x00040000 -#define B43legacy_IRQ_UCODE_DEBUG 0x08000000 -#define B43legacy_IRQ_RFKILL 0x10000000 -#define B43legacy_IRQ_TX_OK 0x20000000 -#define B43legacy_IRQ_PHY_G_CHANGED 0x40000000 -#define B43legacy_IRQ_TIMEOUT 0x80000000 - -#define B43legacy_IRQ_ALL 0xFFFFFFFF -#define B43legacy_IRQ_MASKTEMPLATE (B43legacy_IRQ_MAC_SUSPENDED | \ - B43legacy_IRQ_TBTT_INDI | \ - B43legacy_IRQ_ATIM_END | \ - B43legacy_IRQ_PMQ | \ - B43legacy_IRQ_MAC_TXERR | \ - B43legacy_IRQ_PHY_TXERR | \ - B43legacy_IRQ_DMA | \ - B43legacy_IRQ_TXFIFO_FLUSH_OK | \ - B43legacy_IRQ_NOISESAMPLE_OK | \ - B43legacy_IRQ_UCODE_DEBUG | \ - B43legacy_IRQ_RFKILL | \ - B43legacy_IRQ_TX_OK) - -/* Device specific rate values. - * The actual values defined here are (rate_in_mbps * 2). - * Some code depends on this. Don't change it. */ -#define B43legacy_CCK_RATE_1MB 2 -#define B43legacy_CCK_RATE_2MB 4 -#define B43legacy_CCK_RATE_5MB 11 -#define B43legacy_CCK_RATE_11MB 22 -#define B43legacy_OFDM_RATE_6MB 12 -#define B43legacy_OFDM_RATE_9MB 18 -#define B43legacy_OFDM_RATE_12MB 24 -#define B43legacy_OFDM_RATE_18MB 36 -#define B43legacy_OFDM_RATE_24MB 48 -#define B43legacy_OFDM_RATE_36MB 72 -#define B43legacy_OFDM_RATE_48MB 96 -#define B43legacy_OFDM_RATE_54MB 108 -/* Convert a b43legacy rate value to a rate in 100kbps */ -#define B43legacy_RATE_TO_100KBPS(rate) (((rate) * 10) / 2) - - -#define B43legacy_DEFAULT_SHORT_RETRY_LIMIT 7 -#define B43legacy_DEFAULT_LONG_RETRY_LIMIT 4 - -#define B43legacy_PHY_TX_BADNESS_LIMIT 1000 - -/* Max size of a security key */ -#define B43legacy_SEC_KEYSIZE 16 -/* Security algorithms. */ -enum { - B43legacy_SEC_ALGO_NONE = 0, /* unencrypted, as of TX header. */ - B43legacy_SEC_ALGO_WEP40, - B43legacy_SEC_ALGO_TKIP, - B43legacy_SEC_ALGO_AES, - B43legacy_SEC_ALGO_WEP104, - B43legacy_SEC_ALGO_AES_LEGACY, -}; - -/* Core Information Registers */ -#define B43legacy_CIR_BASE 0xf00 -#define B43legacy_CIR_SBTPSFLAG (B43legacy_CIR_BASE + 0x18) -#define B43legacy_CIR_SBIMSTATE (B43legacy_CIR_BASE + 0x90) -#define B43legacy_CIR_SBINTVEC (B43legacy_CIR_BASE + 0x94) -#define B43legacy_CIR_SBTMSTATELOW (B43legacy_CIR_BASE + 0x98) -#define B43legacy_CIR_SBTMSTATEHIGH (B43legacy_CIR_BASE + 0x9c) -#define B43legacy_CIR_SBIMCONFIGLOW (B43legacy_CIR_BASE + 0xa8) -#define B43legacy_CIR_SB_ID_HI (B43legacy_CIR_BASE + 0xfc) - -/* sbtmstatehigh state flags */ -#define B43legacy_SBTMSTATEHIGH_SERROR 0x00000001 -#define B43legacy_SBTMSTATEHIGH_BUSY 0x00000004 -#define B43legacy_SBTMSTATEHIGH_TIMEOUT 0x00000020 -#define B43legacy_SBTMSTATEHIGH_G_PHY_AVAIL 0x00010000 -#define B43legacy_SBTMSTATEHIGH_COREFLAGS 0x1FFF0000 -#define B43legacy_SBTMSTATEHIGH_DMA64BIT 0x10000000 -#define B43legacy_SBTMSTATEHIGH_GATEDCLK 0x20000000 -#define B43legacy_SBTMSTATEHIGH_BISTFAILED 0x40000000 -#define B43legacy_SBTMSTATEHIGH_BISTCOMPLETE 0x80000000 - -/* sbimstate flags */ -#define B43legacy_SBIMSTATE_IB_ERROR 0x20000 -#define B43legacy_SBIMSTATE_TIMEOUT 0x40000 - -#define PFX KBUILD_MODNAME ": " -#ifdef assert -# undef assert -#endif -#ifdef CONFIG_B43LEGACY_DEBUG -# define B43legacy_WARN_ON(x) WARN_ON(x) -# define B43legacy_BUG_ON(expr) \ - do { \ - if (unlikely((expr))) { \ - printk(KERN_INFO PFX "Test (%s) failed\n", \ - #expr); \ - BUG_ON(expr); \ - } \ - } while (0) -# define B43legacy_DEBUG 1 -#else -/* This will evaluate the argument even if debugging is disabled. */ -static inline bool __b43legacy_warn_on_dummy(bool x) { return x; } -# define B43legacy_WARN_ON(x) __b43legacy_warn_on_dummy(unlikely(!!(x))) -# define B43legacy_BUG_ON(x) do { /* nothing */ } while (0) -# define B43legacy_DEBUG 0 -#endif - - -struct net_device; -struct pci_dev; -struct b43legacy_dmaring; -struct b43legacy_pioqueue; - -/* The firmware file header */ -#define B43legacy_FW_TYPE_UCODE 'u' -#define B43legacy_FW_TYPE_PCM 'p' -#define B43legacy_FW_TYPE_IV 'i' -struct b43legacy_fw_header { - /* File type */ - u8 type; - /* File format version */ - u8 ver; - u8 __padding[2]; - /* Size of the data. For ucode and PCM this is in bytes. - * For IV this is number-of-ivs. */ - __be32 size; -} __packed; - -/* Initial Value file format */ -#define B43legacy_IV_OFFSET_MASK 0x7FFF -#define B43legacy_IV_32BIT 0x8000 -struct b43legacy_iv { - __be16 offset_size; - union { - __be16 d16; - __be32 d32; - } data __packed; -} __packed; - -#define B43legacy_PHYMODE(phytype) (1 << (phytype)) -#define B43legacy_PHYMODE_B B43legacy_PHYMODE \ - ((B43legacy_PHYTYPE_B)) -#define B43legacy_PHYMODE_G B43legacy_PHYMODE \ - ((B43legacy_PHYTYPE_G)) - -/* Value pair to measure the LocalOscillator. */ -struct b43legacy_lopair { - s8 low; - s8 high; - u8 used:1; -}; -#define B43legacy_LO_COUNT (14*4) - -struct b43legacy_phy { - /* Possible PHYMODEs on this PHY */ - u8 possible_phymodes; - /* GMODE bit enabled in MACCTL? */ - bool gmode; - - /* Analog Type */ - u8 analog; - /* B43legacy_PHYTYPE_ */ - u8 type; - /* PHY revision number. */ - u8 rev; - - u16 antenna_diversity; - u16 savedpctlreg; - /* Radio versioning */ - u16 radio_manuf; /* Radio manufacturer */ - u16 radio_ver; /* Radio version */ - u8 calibrated:1; - u8 radio_rev; /* Radio revision */ - - bool dyn_tssi_tbl; /* tssi2dbm is kmalloc()ed. */ - - /* ACI (adjacent channel interference) flags. */ - bool aci_enable; - bool aci_wlan_automatic; - bool aci_hw_rssi; - - /* Radio switched on/off */ - bool radio_on; - struct { - /* Values saved when turning the radio off. - * They are needed when turning it on again. */ - bool valid; - u16 rfover; - u16 rfoverval; - } radio_off_context; - - u16 minlowsig[2]; - u16 minlowsigpos[2]; - - /* LO Measurement Data. - * Use b43legacy_get_lopair() to get a value. - */ - struct b43legacy_lopair *_lo_pairs; - /* TSSI to dBm table in use */ - const s8 *tssi2dbm; - /* idle TSSI value */ - s8 idle_tssi; - /* Target idle TSSI */ - int tgt_idle_tssi; - /* Current idle TSSI */ - int cur_idle_tssi; - - /* LocalOscillator control values. */ - struct b43legacy_txpower_lo_control *lo_control; - /* Values from b43legacy_calc_loopback_gain() */ - s16 max_lb_gain; /* Maximum Loopback gain in hdB */ - s16 trsw_rx_gain; /* TRSW RX gain in hdB */ - s16 lna_lod_gain; /* LNA lod */ - s16 lna_gain; /* LNA */ - s16 pga_gain; /* PGA */ - - /* Desired TX power level (in dBm). This is set by the user and - * adjusted in b43legacy_phy_xmitpower(). */ - u8 power_level; - - /* Values from b43legacy_calc_loopback_gain() */ - u16 loopback_gain[2]; - - /* TX Power control values. */ - /* B/G PHY */ - struct { - /* Current Radio Attenuation for TXpower recalculation. */ - u16 rfatt; - /* Current Baseband Attenuation for TXpower recalculation. */ - u16 bbatt; - /* Current TXpower control value for TXpower recalculation. */ - u16 txctl1; - u16 txctl2; - }; - /* A PHY */ - struct { - u16 txpwr_offset; - }; - - /* Current Interference Mitigation mode */ - int interfmode; - /* Stack of saved values from the Interference Mitigation code. - * Each value in the stack is laid out as follows: - * bit 0-11: offset - * bit 12-15: register ID - * bit 16-32: value - * register ID is: 0x1 PHY, 0x2 Radio, 0x3 ILT - */ -#define B43legacy_INTERFSTACK_SIZE 26 - u32 interfstack[B43legacy_INTERFSTACK_SIZE]; - - /* Saved values from the NRSSI Slope calculation */ - s16 nrssi[2]; - s32 nrssislope; - /* In memory nrssi lookup table. */ - s8 nrssi_lt[64]; - - /* current channel */ - u8 channel; - - u16 lofcal; - - u16 initval; - - /* PHY TX errors counter. */ - atomic_t txerr_cnt; - -#if B43legacy_DEBUG - /* Manual TX-power control enabled? */ - bool manual_txpower_control; - /* PHY registers locked by b43legacy_phy_lock()? */ - bool phy_locked; -#endif /* B43legacy_DEBUG */ -}; - -/* Data structures for DMA transmission, per 80211 core. */ -struct b43legacy_dma { - struct b43legacy_dmaring *tx_ring0; - struct b43legacy_dmaring *tx_ring1; - struct b43legacy_dmaring *tx_ring2; - struct b43legacy_dmaring *tx_ring3; - struct b43legacy_dmaring *tx_ring4; - struct b43legacy_dmaring *tx_ring5; - - struct b43legacy_dmaring *rx_ring0; - struct b43legacy_dmaring *rx_ring3; /* only on core.rev < 5 */ - - u32 translation; /* Routing bits */ -}; - -/* Data structures for PIO transmission, per 80211 core. */ -struct b43legacy_pio { - struct b43legacy_pioqueue *queue0; - struct b43legacy_pioqueue *queue1; - struct b43legacy_pioqueue *queue2; - struct b43legacy_pioqueue *queue3; -}; - -/* Context information for a noise calculation (Link Quality). */ -struct b43legacy_noise_calculation { - u8 channel_at_start; - bool calculation_running; - u8 nr_samples; - s8 samples[8][4]; -}; - -struct b43legacy_stats { - u8 link_noise; - /* Store the last TX/RX times here for updating the leds. */ - unsigned long last_tx; - unsigned long last_rx; -}; - -struct b43legacy_key { - void *keyconf; - bool enabled; - u8 algorithm; -}; - -#define B43legacy_QOS_QUEUE_NUM 4 - -struct b43legacy_wldev; - -/* QOS parameters for a queue. */ -struct b43legacy_qos_params { - /* The QOS parameters */ - struct ieee80211_tx_queue_params p; -}; - -/* Data structure for the WLAN parts (802.11 cores) of the b43legacy chip. */ -struct b43legacy_wl { - /* Pointer to the active wireless device on this chip */ - struct b43legacy_wldev *current_dev; - /* Pointer to the ieee80211 hardware data structure */ - struct ieee80211_hw *hw; - - spinlock_t irq_lock; /* locks IRQ */ - struct mutex mutex; /* locks wireless core state */ - spinlock_t leds_lock; /* lock for leds */ - - /* firmware loading work */ - struct work_struct firmware_load; - - /* We can only have one operating interface (802.11 core) - * at a time. General information about this interface follows. - */ - - struct ieee80211_vif *vif; - /* MAC address (can be NULL). */ - u8 mac_addr[ETH_ALEN]; - /* Current BSSID (can be NULL). */ - u8 bssid[ETH_ALEN]; - /* Interface type. (IEEE80211_IF_TYPE_XXX) */ - int if_type; - /* Is the card operating in AP, STA or IBSS mode? */ - bool operating; - /* filter flags */ - unsigned int filter_flags; - /* Stats about the wireless interface */ - struct ieee80211_low_level_stats ieee_stats; - -#ifdef CONFIG_B43LEGACY_HWRNG - struct hwrng rng; - u8 rng_initialized; - char rng_name[30 + 1]; -#endif - - /* List of all wireless devices on this chip */ - struct list_head devlist; - u8 nr_devs; - - bool radiotap_enabled; - bool radio_enabled; - - /* The beacon we are currently using (AP or IBSS mode). - * This beacon stuff is protected by the irq_lock. */ - struct sk_buff *current_beacon; - bool beacon0_uploaded; - bool beacon1_uploaded; - bool beacon_templates_virgin; /* Never wrote the templates? */ - struct work_struct beacon_update_trigger; - /* The current QOS parameters for the 4 queues. */ - struct b43legacy_qos_params qos_params[B43legacy_QOS_QUEUE_NUM]; - - /* Packet transmit work */ - struct work_struct tx_work; - - /* Queue of packets to be transmitted. */ - struct sk_buff_head tx_queue[B43legacy_QOS_QUEUE_NUM]; - - /* Flag that implement the queues stopping. */ - bool tx_queue_stopped[B43legacy_QOS_QUEUE_NUM]; - -}; - -/* Pointers to the firmware data and meta information about it. */ -struct b43legacy_firmware { - /* Microcode */ - const struct firmware *ucode; - /* PCM code */ - const struct firmware *pcm; - /* Initial MMIO values for the firmware */ - const struct firmware *initvals; - /* Initial MMIO values for the firmware, band-specific */ - const struct firmware *initvals_band; - /* Firmware revision */ - u16 rev; - /* Firmware patchlevel */ - u16 patch; -}; - -/* Device (802.11 core) initialization status. */ -enum { - B43legacy_STAT_UNINIT = 0, /* Uninitialized. */ - B43legacy_STAT_INITIALIZED = 1, /* Initialized, not yet started. */ - B43legacy_STAT_STARTED = 2, /* Up and running. */ -}; -#define b43legacy_status(wldev) atomic_read(&(wldev)->__init_status) -#define b43legacy_set_status(wldev, stat) do { \ - atomic_set(&(wldev)->__init_status, (stat)); \ - smp_wmb(); \ - } while (0) - -/* *** --- HOW LOCKING WORKS IN B43legacy --- *** - * - * You should always acquire both, wl->mutex and wl->irq_lock unless: - * - You don't need to acquire wl->irq_lock, if the interface is stopped. - * - You don't need to acquire wl->mutex in the IRQ handler, IRQ tasklet - * and packet TX path (and _ONLY_ there.) - */ - -/* Data structure for one wireless device (802.11 core) */ -struct b43legacy_wldev { - struct ssb_device *dev; - struct b43legacy_wl *wl; - - /* The device initialization status. - * Use b43legacy_status() to query. */ - atomic_t __init_status; - /* Saved init status for handling suspend. */ - int suspend_init_status; - - bool __using_pio; /* Using pio rather than dma. */ - bool bad_frames_preempt;/* Use "Bad Frames Preemption". */ - bool dfq_valid; /* Directed frame queue valid (IBSS PS mode, ATIM). */ - bool short_preamble; /* TRUE if using short preamble. */ - bool radio_hw_enable; /* State of radio hardware enable bit. */ - - /* PHY/Radio device. */ - struct b43legacy_phy phy; - union { - /* DMA engines. */ - struct b43legacy_dma dma; - /* PIO engines. */ - struct b43legacy_pio pio; - }; - - /* Various statistics about the physical device. */ - struct b43legacy_stats stats; - - /* The device LEDs. */ - struct b43legacy_led led_tx; - struct b43legacy_led led_rx; - struct b43legacy_led led_assoc; - struct b43legacy_led led_radio; - - /* Reason code of the last interrupt. */ - u32 irq_reason; - u32 dma_reason[6]; - /* The currently active generic-interrupt mask. */ - u32 irq_mask; - /* Link Quality calculation context. */ - struct b43legacy_noise_calculation noisecalc; - /* if > 0 MAC is suspended. if == 0 MAC is enabled. */ - int mac_suspended; - - /* Interrupt Service Routine tasklet (bottom-half) */ - struct tasklet_struct isr_tasklet; - - /* Periodic tasks */ - struct delayed_work periodic_work; - unsigned int periodic_state; - - struct work_struct restart_work; - - /* encryption/decryption */ - u16 ktp; /* Key table pointer */ - u8 max_nr_keys; - struct b43legacy_key key[58]; - - /* Firmware data */ - struct b43legacy_firmware fw; - const struct firmware *fwp; /* needed to pass fw pointer */ - - /* completion struct for firmware loading */ - struct completion fw_load_complete; - - /* Devicelist in struct b43legacy_wl (all 802.11 cores) */ - struct list_head list; - - /* Debugging stuff follows. */ -#ifdef CONFIG_B43LEGACY_DEBUG - struct b43legacy_dfsentry *dfsentry; -#endif -}; - - -static inline -struct b43legacy_wl *hw_to_b43legacy_wl(struct ieee80211_hw *hw) -{ - return hw->priv; -} - -/* Helper function, which returns a boolean. - * TRUE, if PIO is used; FALSE, if DMA is used. - */ -#if defined(CONFIG_B43LEGACY_DMA) && defined(CONFIG_B43LEGACY_PIO) -static inline -int b43legacy_using_pio(struct b43legacy_wldev *dev) -{ - return dev->__using_pio; -} -#elif defined(CONFIG_B43LEGACY_DMA) -static inline -int b43legacy_using_pio(struct b43legacy_wldev *dev) -{ - return 0; -} -#elif defined(CONFIG_B43LEGACY_PIO) -static inline -int b43legacy_using_pio(struct b43legacy_wldev *dev) -{ - return 1; -} -#else -# error "Using neither DMA nor PIO? Confused..." -#endif - - -static inline -struct b43legacy_wldev *dev_to_b43legacy_wldev(struct device *dev) -{ - struct ssb_device *ssb_dev = dev_to_ssb_dev(dev); - return ssb_get_drvdata(ssb_dev); -} - -/* Is the device operating in a specified mode (IEEE80211_IF_TYPE_XXX). */ -static inline -int b43legacy_is_mode(struct b43legacy_wl *wl, int type) -{ - return (wl->operating && - wl->if_type == type); -} - -static inline -bool is_bcm_board_vendor(struct b43legacy_wldev *dev) -{ - return (dev->dev->bus->boardinfo.vendor == PCI_VENDOR_ID_BROADCOM); -} - -static inline -u16 b43legacy_read16(struct b43legacy_wldev *dev, u16 offset) -{ - return ssb_read16(dev->dev, offset); -} - -static inline -void b43legacy_write16(struct b43legacy_wldev *dev, u16 offset, u16 value) -{ - ssb_write16(dev->dev, offset, value); -} - -static inline -u32 b43legacy_read32(struct b43legacy_wldev *dev, u16 offset) -{ - return ssb_read32(dev->dev, offset); -} - -static inline -void b43legacy_write32(struct b43legacy_wldev *dev, u16 offset, u32 value) -{ - ssb_write32(dev->dev, offset, value); -} - -static inline -struct b43legacy_lopair *b43legacy_get_lopair(struct b43legacy_phy *phy, - u16 radio_attenuation, - u16 baseband_attenuation) -{ - return phy->_lo_pairs + (radio_attenuation - + 14 * (baseband_attenuation / 2)); -} - - - -/* Message printing */ -__printf(2, 3) -void b43legacyinfo(struct b43legacy_wl *wl, const char *fmt, ...); -__printf(2, 3) -void b43legacyerr(struct b43legacy_wl *wl, const char *fmt, ...); -__printf(2, 3) -void b43legacywarn(struct b43legacy_wl *wl, const char *fmt, ...); -#if B43legacy_DEBUG -__printf(2, 3) -void b43legacydbg(struct b43legacy_wl *wl, const char *fmt, ...); -#else /* DEBUG */ -# define b43legacydbg(wl, fmt...) do { /* nothing */ } while (0) -#endif /* DEBUG */ - -/* Macros for printing a value in Q5.2 format */ -#define Q52_FMT "%u.%u" -#define Q52_ARG(q52) ((q52) / 4), (((q52) & 3) * 100 / 4) - -#endif /* B43legacy_H_ */ diff --git a/drivers/net/wireless/b43legacy/debugfs.c b/drivers/net/wireless/b43legacy/debugfs.c deleted file mode 100644 index 1965edb765a2..000000000000 --- a/drivers/net/wireless/b43legacy/debugfs.c +++ /dev/null @@ -1,500 +0,0 @@ -/* - - Broadcom B43legacy wireless driver - - debugfs driver debugging code - - Copyright (c) 2005-2007 Michael Buesch - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include -#include -#include -#include -#include -#include - -#include "b43legacy.h" -#include "main.h" -#include "debugfs.h" -#include "dma.h" -#include "pio.h" -#include "xmit.h" - - -/* The root directory. */ -static struct dentry *rootdir; - -struct b43legacy_debugfs_fops { - ssize_t (*read)(struct b43legacy_wldev *dev, char *buf, size_t bufsize); - int (*write)(struct b43legacy_wldev *dev, const char *buf, size_t count); - struct file_operations fops; - /* Offset of struct b43legacy_dfs_file in struct b43legacy_dfsentry */ - size_t file_struct_offset; - /* Take wl->irq_lock before calling read/write? */ - bool take_irqlock; -}; - -static inline -struct b43legacy_dfs_file * fops_to_dfs_file(struct b43legacy_wldev *dev, - const struct b43legacy_debugfs_fops *dfops) -{ - void *p; - - p = dev->dfsentry; - p += dfops->file_struct_offset; - - return p; -} - - -#define fappend(fmt, x...) \ - do { \ - if (bufsize - count) \ - count += snprintf(buf + count, \ - bufsize - count, \ - fmt , ##x); \ - else \ - printk(KERN_ERR "b43legacy: fappend overflow\n"); \ - } while (0) - - -/* wl->irq_lock is locked */ -static ssize_t tsf_read_file(struct b43legacy_wldev *dev, char *buf, size_t bufsize) -{ - ssize_t count = 0; - u64 tsf; - - b43legacy_tsf_read(dev, &tsf); - fappend("0x%08x%08x\n", - (unsigned int)((tsf & 0xFFFFFFFF00000000ULL) >> 32), - (unsigned int)(tsf & 0xFFFFFFFFULL)); - - return count; -} - -/* wl->irq_lock is locked */ -static int tsf_write_file(struct b43legacy_wldev *dev, const char *buf, size_t count) -{ - u64 tsf; - - if (sscanf(buf, "%llu", (unsigned long long *)(&tsf)) != 1) - return -EINVAL; - b43legacy_tsf_write(dev, tsf); - - return 0; -} - -/* wl->irq_lock is locked */ -static ssize_t ucode_regs_read_file(struct b43legacy_wldev *dev, char *buf, size_t bufsize) -{ - ssize_t count = 0; - int i; - - for (i = 0; i < 64; i++) { - fappend("r%d = 0x%04x\n", i, - b43legacy_shm_read16(dev, B43legacy_SHM_WIRELESS, i)); - } - - return count; -} - -/* wl->irq_lock is locked */ -static ssize_t shm_read_file(struct b43legacy_wldev *dev, char *buf, size_t bufsize) -{ - ssize_t count = 0; - int i; - u16 tmp; - __le16 *le16buf = (__le16 *)buf; - - for (i = 0; i < 0x1000; i++) { - if (bufsize < sizeof(tmp)) - break; - tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, 2 * i); - le16buf[i] = cpu_to_le16(tmp); - count += sizeof(tmp); - bufsize -= sizeof(tmp); - } - - return count; -} - -static ssize_t txstat_read_file(struct b43legacy_wldev *dev, char *buf, size_t bufsize) -{ - struct b43legacy_txstatus_log *log = &dev->dfsentry->txstatlog; - ssize_t count = 0; - unsigned long flags; - int i, idx; - struct b43legacy_txstatus *stat; - - spin_lock_irqsave(&log->lock, flags); - if (log->end < 0) { - fappend("Nothing transmitted, yet\n"); - goto out_unlock; - } - fappend("b43legacy TX status reports:\n\n" - "index | cookie | seq | phy_stat | frame_count | " - "rts_count | supp_reason | pm_indicated | " - "intermediate | for_ampdu | acked\n" "---\n"); - i = log->end + 1; - idx = 0; - while (1) { - if (i == B43legacy_NR_LOGGED_TXSTATUS) - i = 0; - stat = &(log->log[i]); - if (stat->cookie) { - fappend("%03d | " - "0x%04X | 0x%04X | 0x%02X | " - "0x%X | 0x%X | " - "%u | %u | " - "%u | %u | %u\n", - idx, - stat->cookie, stat->seq, stat->phy_stat, - stat->frame_count, stat->rts_count, - stat->supp_reason, stat->pm_indicated, - stat->intermediate, stat->for_ampdu, - stat->acked); - idx++; - } - if (i == log->end) - break; - i++; - } -out_unlock: - spin_unlock_irqrestore(&log->lock, flags); - - return count; -} - -/* wl->irq_lock is locked */ -static int restart_write_file(struct b43legacy_wldev *dev, const char *buf, size_t count) -{ - int err = 0; - - if (count > 0 && buf[0] == '1') { - b43legacy_controller_restart(dev, "manually restarted"); - } else - err = -EINVAL; - - return err; -} - -#undef fappend - -static ssize_t b43legacy_debugfs_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct b43legacy_wldev *dev; - struct b43legacy_debugfs_fops *dfops; - struct b43legacy_dfs_file *dfile; - ssize_t uninitialized_var(ret); - char *buf; - const size_t bufsize = 1024 * 16; /* 16 KiB buffer */ - const size_t buforder = get_order(bufsize); - int err = 0; - - if (!count) - return 0; - dev = file->private_data; - if (!dev) - return -ENODEV; - - mutex_lock(&dev->wl->mutex); - if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) { - err = -ENODEV; - goto out_unlock; - } - - dfops = container_of(file->f_op, struct b43legacy_debugfs_fops, fops); - if (!dfops->read) { - err = -ENOSYS; - goto out_unlock; - } - dfile = fops_to_dfs_file(dev, dfops); - - if (!dfile->buffer) { - buf = (char *)__get_free_pages(GFP_KERNEL, buforder); - if (!buf) { - err = -ENOMEM; - goto out_unlock; - } - memset(buf, 0, bufsize); - if (dfops->take_irqlock) { - spin_lock_irq(&dev->wl->irq_lock); - ret = dfops->read(dev, buf, bufsize); - spin_unlock_irq(&dev->wl->irq_lock); - } else - ret = dfops->read(dev, buf, bufsize); - if (ret <= 0) { - free_pages((unsigned long)buf, buforder); - err = ret; - goto out_unlock; - } - dfile->data_len = ret; - dfile->buffer = buf; - } - - ret = simple_read_from_buffer(userbuf, count, ppos, - dfile->buffer, - dfile->data_len); - if (*ppos >= dfile->data_len) { - free_pages((unsigned long)dfile->buffer, buforder); - dfile->buffer = NULL; - dfile->data_len = 0; - } -out_unlock: - mutex_unlock(&dev->wl->mutex); - - return err ? err : ret; -} - -static ssize_t b43legacy_debugfs_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct b43legacy_wldev *dev; - struct b43legacy_debugfs_fops *dfops; - char *buf; - int err = 0; - - if (!count) - return 0; - if (count > PAGE_SIZE) - return -E2BIG; - dev = file->private_data; - if (!dev) - return -ENODEV; - - mutex_lock(&dev->wl->mutex); - if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) { - err = -ENODEV; - goto out_unlock; - } - - dfops = container_of(file->f_op, struct b43legacy_debugfs_fops, fops); - if (!dfops->write) { - err = -ENOSYS; - goto out_unlock; - } - - buf = (char *)get_zeroed_page(GFP_KERNEL); - if (!buf) { - err = -ENOMEM; - goto out_unlock; - } - if (copy_from_user(buf, userbuf, count)) { - err = -EFAULT; - goto out_freepage; - } - if (dfops->take_irqlock) { - spin_lock_irq(&dev->wl->irq_lock); - err = dfops->write(dev, buf, count); - spin_unlock_irq(&dev->wl->irq_lock); - } else - err = dfops->write(dev, buf, count); - if (err) - goto out_freepage; - -out_freepage: - free_page((unsigned long)buf); -out_unlock: - mutex_unlock(&dev->wl->mutex); - - return err ? err : count; -} - - -#define B43legacy_DEBUGFS_FOPS(name, _read, _write, _take_irqlock) \ - static struct b43legacy_debugfs_fops fops_##name = { \ - .read = _read, \ - .write = _write, \ - .fops = { \ - .open = simple_open, \ - .read = b43legacy_debugfs_read, \ - .write = b43legacy_debugfs_write, \ - .llseek = generic_file_llseek, \ - }, \ - .file_struct_offset = offsetof(struct b43legacy_dfsentry, \ - file_##name), \ - .take_irqlock = _take_irqlock, \ - } - -B43legacy_DEBUGFS_FOPS(tsf, tsf_read_file, tsf_write_file, 1); -B43legacy_DEBUGFS_FOPS(ucode_regs, ucode_regs_read_file, NULL, 1); -B43legacy_DEBUGFS_FOPS(shm, shm_read_file, NULL, 1); -B43legacy_DEBUGFS_FOPS(txstat, txstat_read_file, NULL, 0); -B43legacy_DEBUGFS_FOPS(restart, NULL, restart_write_file, 1); - - -int b43legacy_debug(struct b43legacy_wldev *dev, enum b43legacy_dyndbg feature) -{ - return !!(dev->dfsentry && dev->dfsentry->dyn_debug[feature]); -} - -static void b43legacy_remove_dynamic_debug(struct b43legacy_wldev *dev) -{ - struct b43legacy_dfsentry *e = dev->dfsentry; - int i; - - for (i = 0; i < __B43legacy_NR_DYNDBG; i++) - debugfs_remove(e->dyn_debug_dentries[i]); -} - -static void b43legacy_add_dynamic_debug(struct b43legacy_wldev *dev) -{ - struct b43legacy_dfsentry *e = dev->dfsentry; - struct dentry *d; - -#define add_dyn_dbg(name, id, initstate) do { \ - e->dyn_debug[id] = (initstate); \ - d = debugfs_create_bool(name, 0600, e->subdir, \ - &(e->dyn_debug[id])); \ - if (!IS_ERR(d)) \ - e->dyn_debug_dentries[id] = d; \ - } while (0) - - add_dyn_dbg("debug_xmitpower", B43legacy_DBG_XMITPOWER, 0); - add_dyn_dbg("debug_dmaoverflow", B43legacy_DBG_DMAOVERFLOW, 0); - add_dyn_dbg("debug_dmaverbose", B43legacy_DBG_DMAVERBOSE, 0); - add_dyn_dbg("debug_pwork_fast", B43legacy_DBG_PWORK_FAST, 0); - add_dyn_dbg("debug_pwork_stop", B43legacy_DBG_PWORK_STOP, 0); - -#undef add_dyn_dbg -} - -void b43legacy_debugfs_add_device(struct b43legacy_wldev *dev) -{ - struct b43legacy_dfsentry *e; - struct b43legacy_txstatus_log *log; - char devdir[16]; - - B43legacy_WARN_ON(!dev); - e = kzalloc(sizeof(*e), GFP_KERNEL); - if (!e) { - b43legacyerr(dev->wl, "debugfs: add device OOM\n"); - return; - } - e->dev = dev; - log = &e->txstatlog; - log->log = kcalloc(B43legacy_NR_LOGGED_TXSTATUS, - sizeof(struct b43legacy_txstatus), GFP_KERNEL); - if (!log->log) { - b43legacyerr(dev->wl, "debugfs: add device txstatus OOM\n"); - kfree(e); - return; - } - log->end = -1; - spin_lock_init(&log->lock); - - dev->dfsentry = e; - - snprintf(devdir, sizeof(devdir), "%s", wiphy_name(dev->wl->hw->wiphy)); - e->subdir = debugfs_create_dir(devdir, rootdir); - if (!e->subdir || IS_ERR(e->subdir)) { - if (e->subdir == ERR_PTR(-ENODEV)) { - b43legacydbg(dev->wl, "DebugFS (CONFIG_DEBUG_FS) not " - "enabled in kernel config\n"); - } else { - b43legacyerr(dev->wl, "debugfs: cannot create %s directory\n", - devdir); - } - dev->dfsentry = NULL; - kfree(log->log); - kfree(e); - return; - } - -#define ADD_FILE(name, mode) \ - do { \ - struct dentry *d; \ - d = debugfs_create_file(__stringify(name), \ - mode, e->subdir, dev, \ - &fops_##name.fops); \ - e->file_##name.dentry = NULL; \ - if (!IS_ERR(d)) \ - e->file_##name.dentry = d; \ - } while (0) - - - ADD_FILE(tsf, 0600); - ADD_FILE(ucode_regs, 0400); - ADD_FILE(shm, 0400); - ADD_FILE(txstat, 0400); - ADD_FILE(restart, 0200); - -#undef ADD_FILE - - b43legacy_add_dynamic_debug(dev); -} - -void b43legacy_debugfs_remove_device(struct b43legacy_wldev *dev) -{ - struct b43legacy_dfsentry *e; - - if (!dev) - return; - e = dev->dfsentry; - if (!e) - return; - b43legacy_remove_dynamic_debug(dev); - - debugfs_remove(e->file_tsf.dentry); - debugfs_remove(e->file_ucode_regs.dentry); - debugfs_remove(e->file_shm.dentry); - debugfs_remove(e->file_txstat.dentry); - debugfs_remove(e->file_restart.dentry); - - debugfs_remove(e->subdir); - kfree(e->txstatlog.log); - kfree(e); -} - -void b43legacy_debugfs_log_txstat(struct b43legacy_wldev *dev, - const struct b43legacy_txstatus *status) -{ - struct b43legacy_dfsentry *e = dev->dfsentry; - struct b43legacy_txstatus_log *log; - struct b43legacy_txstatus *cur; - int i; - - if (!e) - return; - log = &e->txstatlog; - B43legacy_WARN_ON(!irqs_disabled()); - spin_lock(&log->lock); - i = log->end + 1; - if (i == B43legacy_NR_LOGGED_TXSTATUS) - i = 0; - log->end = i; - cur = &(log->log[i]); - memcpy(cur, status, sizeof(*cur)); - spin_unlock(&log->lock); -} - -void b43legacy_debugfs_init(void) -{ - rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL); - if (IS_ERR(rootdir)) - rootdir = NULL; -} - -void b43legacy_debugfs_exit(void) -{ - debugfs_remove(rootdir); -} diff --git a/drivers/net/wireless/b43legacy/debugfs.h b/drivers/net/wireless/b43legacy/debugfs.h deleted file mode 100644 index ae3b0d0fa849..000000000000 --- a/drivers/net/wireless/b43legacy/debugfs.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef B43legacy_DEBUGFS_H_ -#define B43legacy_DEBUGFS_H_ - -struct b43legacy_wldev; -struct b43legacy_txstatus; - -enum b43legacy_dyndbg { /* Dynamic debugging features */ - B43legacy_DBG_XMITPOWER, - B43legacy_DBG_DMAOVERFLOW, - B43legacy_DBG_DMAVERBOSE, - B43legacy_DBG_PWORK_FAST, - B43legacy_DBG_PWORK_STOP, - __B43legacy_NR_DYNDBG, -}; - - -#ifdef CONFIG_B43LEGACY_DEBUG - -struct dentry; - -#define B43legacy_NR_LOGGED_TXSTATUS 100 - -struct b43legacy_txstatus_log { - struct b43legacy_txstatus *log; - int end; - spinlock_t lock; /* lock for debugging */ -}; - -struct b43legacy_dfs_file { - struct dentry *dentry; - char *buffer; - size_t data_len; -}; - -struct b43legacy_dfsentry { - struct b43legacy_wldev *dev; - struct dentry *subdir; - - struct b43legacy_dfs_file file_tsf; - struct b43legacy_dfs_file file_ucode_regs; - struct b43legacy_dfs_file file_shm; - struct b43legacy_dfs_file file_txstat; - struct b43legacy_dfs_file file_txpower_g; - struct b43legacy_dfs_file file_restart; - struct b43legacy_dfs_file file_loctls; - - struct b43legacy_txstatus_log txstatlog; - - /* Enabled/Disabled list for the dynamic debugging features. */ - u32 dyn_debug[__B43legacy_NR_DYNDBG]; - /* Dentries for the dynamic debugging entries. */ - struct dentry *dyn_debug_dentries[__B43legacy_NR_DYNDBG]; -}; - -int b43legacy_debug(struct b43legacy_wldev *dev, - enum b43legacy_dyndbg feature); - -void b43legacy_debugfs_init(void); -void b43legacy_debugfs_exit(void); -void b43legacy_debugfs_add_device(struct b43legacy_wldev *dev); -void b43legacy_debugfs_remove_device(struct b43legacy_wldev *dev); -void b43legacy_debugfs_log_txstat(struct b43legacy_wldev *dev, - const struct b43legacy_txstatus *status); - -#else /* CONFIG_B43LEGACY_DEBUG*/ - -static inline -int b43legacy_debug(struct b43legacy_wldev *dev, - enum b43legacy_dyndbg feature) -{ - return 0; -} - -static inline -void b43legacy_debugfs_init(void) { } -static inline -void b43legacy_debugfs_exit(void) { } -static inline -void b43legacy_debugfs_add_device(struct b43legacy_wldev *dev) { } -static inline -void b43legacy_debugfs_remove_device(struct b43legacy_wldev *dev) { } -static inline -void b43legacy_debugfs_log_txstat(struct b43legacy_wldev *dev, - const struct b43legacy_txstatus *status) - { } - -#endif /* CONFIG_B43LEGACY_DEBUG*/ - -#endif /* B43legacy_DEBUGFS_H_ */ diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c deleted file mode 100644 index faeafe219c57..000000000000 --- a/drivers/net/wireless/b43legacy/dma.c +++ /dev/null @@ -1,1459 +0,0 @@ -/* - - Broadcom B43legacy wireless driver - - DMA ringbuffer and descriptor allocation/management - - Copyright (c) 2005, 2006 Michael Buesch - - Some code in this file is derived from the b44.c driver - Copyright (C) 2002 David S. Miller - Copyright (C) Pekka Pietikainen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43legacy.h" -#include "dma.h" -#include "main.h" -#include "debugfs.h" -#include "xmit.h" - -#include -#include -#include -#include -#include -#include - -/* 32bit DMA ops. */ -static -struct b43legacy_dmadesc32 *op32_idx2desc(struct b43legacy_dmaring *ring, - int slot, - struct b43legacy_dmadesc_meta **meta) -{ - struct b43legacy_dmadesc32 *desc; - - *meta = &(ring->meta[slot]); - desc = ring->descbase; - desc = &(desc[slot]); - - return desc; -} - -static void op32_fill_descriptor(struct b43legacy_dmaring *ring, - struct b43legacy_dmadesc32 *desc, - dma_addr_t dmaaddr, u16 bufsize, - int start, int end, int irq) -{ - struct b43legacy_dmadesc32 *descbase = ring->descbase; - int slot; - u32 ctl; - u32 addr; - u32 addrext; - - slot = (int)(desc - descbase); - B43legacy_WARN_ON(!(slot >= 0 && slot < ring->nr_slots)); - - addr = (u32)(dmaaddr & ~SSB_DMA_TRANSLATION_MASK); - addrext = (u32)(dmaaddr & SSB_DMA_TRANSLATION_MASK) - >> SSB_DMA_TRANSLATION_SHIFT; - addr |= ring->dev->dma.translation; - ctl = (bufsize - ring->frameoffset) - & B43legacy_DMA32_DCTL_BYTECNT; - if (slot == ring->nr_slots - 1) - ctl |= B43legacy_DMA32_DCTL_DTABLEEND; - if (start) - ctl |= B43legacy_DMA32_DCTL_FRAMESTART; - if (end) - ctl |= B43legacy_DMA32_DCTL_FRAMEEND; - if (irq) - ctl |= B43legacy_DMA32_DCTL_IRQ; - ctl |= (addrext << B43legacy_DMA32_DCTL_ADDREXT_SHIFT) - & B43legacy_DMA32_DCTL_ADDREXT_MASK; - - desc->control = cpu_to_le32(ctl); - desc->address = cpu_to_le32(addr); -} - -static void op32_poke_tx(struct b43legacy_dmaring *ring, int slot) -{ - b43legacy_dma_write(ring, B43legacy_DMA32_TXINDEX, - (u32)(slot * sizeof(struct b43legacy_dmadesc32))); -} - -static void op32_tx_suspend(struct b43legacy_dmaring *ring) -{ - b43legacy_dma_write(ring, B43legacy_DMA32_TXCTL, - b43legacy_dma_read(ring, B43legacy_DMA32_TXCTL) - | B43legacy_DMA32_TXSUSPEND); -} - -static void op32_tx_resume(struct b43legacy_dmaring *ring) -{ - b43legacy_dma_write(ring, B43legacy_DMA32_TXCTL, - b43legacy_dma_read(ring, B43legacy_DMA32_TXCTL) - & ~B43legacy_DMA32_TXSUSPEND); -} - -static int op32_get_current_rxslot(struct b43legacy_dmaring *ring) -{ - u32 val; - - val = b43legacy_dma_read(ring, B43legacy_DMA32_RXSTATUS); - val &= B43legacy_DMA32_RXDPTR; - - return (val / sizeof(struct b43legacy_dmadesc32)); -} - -static void op32_set_current_rxslot(struct b43legacy_dmaring *ring, - int slot) -{ - b43legacy_dma_write(ring, B43legacy_DMA32_RXINDEX, - (u32)(slot * sizeof(struct b43legacy_dmadesc32))); -} - -static inline int free_slots(struct b43legacy_dmaring *ring) -{ - return (ring->nr_slots - ring->used_slots); -} - -static inline int next_slot(struct b43legacy_dmaring *ring, int slot) -{ - B43legacy_WARN_ON(!(slot >= -1 && slot <= ring->nr_slots - 1)); - if (slot == ring->nr_slots - 1) - return 0; - return slot + 1; -} - -static inline int prev_slot(struct b43legacy_dmaring *ring, int slot) -{ - B43legacy_WARN_ON(!(slot >= 0 && slot <= ring->nr_slots - 1)); - if (slot == 0) - return ring->nr_slots - 1; - return slot - 1; -} - -#ifdef CONFIG_B43LEGACY_DEBUG -static void update_max_used_slots(struct b43legacy_dmaring *ring, - int current_used_slots) -{ - if (current_used_slots <= ring->max_used_slots) - return; - ring->max_used_slots = current_used_slots; - if (b43legacy_debug(ring->dev, B43legacy_DBG_DMAVERBOSE)) - b43legacydbg(ring->dev->wl, - "max_used_slots increased to %d on %s ring %d\n", - ring->max_used_slots, - ring->tx ? "TX" : "RX", - ring->index); -} -#else -static inline -void update_max_used_slots(struct b43legacy_dmaring *ring, - int current_used_slots) -{ } -#endif /* DEBUG */ - -/* Request a slot for usage. */ -static inline -int request_slot(struct b43legacy_dmaring *ring) -{ - int slot; - - B43legacy_WARN_ON(!ring->tx); - B43legacy_WARN_ON(ring->stopped); - B43legacy_WARN_ON(free_slots(ring) == 0); - - slot = next_slot(ring, ring->current_slot); - ring->current_slot = slot; - ring->used_slots++; - - update_max_used_slots(ring, ring->used_slots); - - return slot; -} - -/* Mac80211-queue to b43legacy-ring mapping */ -static struct b43legacy_dmaring *priority_to_txring( - struct b43legacy_wldev *dev, - int queue_priority) -{ - struct b43legacy_dmaring *ring; - -/*FIXME: For now we always run on TX-ring-1 */ -return dev->dma.tx_ring1; - - /* 0 = highest priority */ - switch (queue_priority) { - default: - B43legacy_WARN_ON(1); - /* fallthrough */ - case 0: - ring = dev->dma.tx_ring3; - break; - case 1: - ring = dev->dma.tx_ring2; - break; - case 2: - ring = dev->dma.tx_ring1; - break; - case 3: - ring = dev->dma.tx_ring0; - break; - case 4: - ring = dev->dma.tx_ring4; - break; - case 5: - ring = dev->dma.tx_ring5; - break; - } - - return ring; -} - -/* Bcm4301-ring to mac80211-queue mapping */ -static inline int txring_to_priority(struct b43legacy_dmaring *ring) -{ - static const u8 idx_to_prio[] = - { 3, 2, 1, 0, 4, 5, }; - -/*FIXME: have only one queue, for now */ -return 0; - - return idx_to_prio[ring->index]; -} - - -static u16 b43legacy_dmacontroller_base(enum b43legacy_dmatype type, - int controller_idx) -{ - static const u16 map32[] = { - B43legacy_MMIO_DMA32_BASE0, - B43legacy_MMIO_DMA32_BASE1, - B43legacy_MMIO_DMA32_BASE2, - B43legacy_MMIO_DMA32_BASE3, - B43legacy_MMIO_DMA32_BASE4, - B43legacy_MMIO_DMA32_BASE5, - }; - - B43legacy_WARN_ON(!(controller_idx >= 0 && - controller_idx < ARRAY_SIZE(map32))); - return map32[controller_idx]; -} - -static inline -dma_addr_t map_descbuffer(struct b43legacy_dmaring *ring, - unsigned char *buf, - size_t len, - int tx) -{ - dma_addr_t dmaaddr; - - if (tx) - dmaaddr = dma_map_single(ring->dev->dev->dma_dev, - buf, len, - DMA_TO_DEVICE); - else - dmaaddr = dma_map_single(ring->dev->dev->dma_dev, - buf, len, - DMA_FROM_DEVICE); - - return dmaaddr; -} - -static inline -void unmap_descbuffer(struct b43legacy_dmaring *ring, - dma_addr_t addr, - size_t len, - int tx) -{ - if (tx) - dma_unmap_single(ring->dev->dev->dma_dev, - addr, len, - DMA_TO_DEVICE); - else - dma_unmap_single(ring->dev->dev->dma_dev, - addr, len, - DMA_FROM_DEVICE); -} - -static inline -void sync_descbuffer_for_cpu(struct b43legacy_dmaring *ring, - dma_addr_t addr, - size_t len) -{ - B43legacy_WARN_ON(ring->tx); - - dma_sync_single_for_cpu(ring->dev->dev->dma_dev, - addr, len, DMA_FROM_DEVICE); -} - -static inline -void sync_descbuffer_for_device(struct b43legacy_dmaring *ring, - dma_addr_t addr, - size_t len) -{ - B43legacy_WARN_ON(ring->tx); - - dma_sync_single_for_device(ring->dev->dev->dma_dev, - addr, len, DMA_FROM_DEVICE); -} - -static inline -void free_descriptor_buffer(struct b43legacy_dmaring *ring, - struct b43legacy_dmadesc_meta *meta, - int irq_context) -{ - if (meta->skb) { - if (irq_context) - dev_kfree_skb_irq(meta->skb); - else - dev_kfree_skb(meta->skb); - meta->skb = NULL; - } -} - -static int alloc_ringmemory(struct b43legacy_dmaring *ring) -{ - /* GFP flags must match the flags in free_ringmemory()! */ - ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev, - B43legacy_DMA_RINGMEMSIZE, - &(ring->dmabase), - GFP_KERNEL | __GFP_ZERO); - if (!ring->descbase) - return -ENOMEM; - - return 0; -} - -static void free_ringmemory(struct b43legacy_dmaring *ring) -{ - dma_free_coherent(ring->dev->dev->dma_dev, B43legacy_DMA_RINGMEMSIZE, - ring->descbase, ring->dmabase); -} - -/* Reset the RX DMA channel */ -static int b43legacy_dmacontroller_rx_reset(struct b43legacy_wldev *dev, - u16 mmio_base, - enum b43legacy_dmatype type) -{ - int i; - u32 value; - u16 offset; - - might_sleep(); - - offset = B43legacy_DMA32_RXCTL; - b43legacy_write32(dev, mmio_base + offset, 0); - for (i = 0; i < 10; i++) { - offset = B43legacy_DMA32_RXSTATUS; - value = b43legacy_read32(dev, mmio_base + offset); - value &= B43legacy_DMA32_RXSTATE; - if (value == B43legacy_DMA32_RXSTAT_DISABLED) { - i = -1; - break; - } - msleep(1); - } - if (i != -1) { - b43legacyerr(dev->wl, "DMA RX reset timed out\n"); - return -ENODEV; - } - - return 0; -} - -/* Reset the RX DMA channel */ -static int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev, - u16 mmio_base, - enum b43legacy_dmatype type) -{ - int i; - u32 value; - u16 offset; - - might_sleep(); - - for (i = 0; i < 10; i++) { - offset = B43legacy_DMA32_TXSTATUS; - value = b43legacy_read32(dev, mmio_base + offset); - value &= B43legacy_DMA32_TXSTATE; - if (value == B43legacy_DMA32_TXSTAT_DISABLED || - value == B43legacy_DMA32_TXSTAT_IDLEWAIT || - value == B43legacy_DMA32_TXSTAT_STOPPED) - break; - msleep(1); - } - offset = B43legacy_DMA32_TXCTL; - b43legacy_write32(dev, mmio_base + offset, 0); - for (i = 0; i < 10; i++) { - offset = B43legacy_DMA32_TXSTATUS; - value = b43legacy_read32(dev, mmio_base + offset); - value &= B43legacy_DMA32_TXSTATE; - if (value == B43legacy_DMA32_TXSTAT_DISABLED) { - i = -1; - break; - } - msleep(1); - } - if (i != -1) { - b43legacyerr(dev->wl, "DMA TX reset timed out\n"); - return -ENODEV; - } - /* ensure the reset is completed. */ - msleep(1); - - return 0; -} - -/* Check if a DMA mapping address is invalid. */ -static bool b43legacy_dma_mapping_error(struct b43legacy_dmaring *ring, - dma_addr_t addr, - size_t buffersize, - bool dma_to_device) -{ - if (unlikely(dma_mapping_error(ring->dev->dev->dma_dev, addr))) - return 1; - - switch (ring->type) { - case B43legacy_DMA_30BIT: - if ((u64)addr + buffersize > (1ULL << 30)) - goto address_error; - break; - case B43legacy_DMA_32BIT: - if ((u64)addr + buffersize > (1ULL << 32)) - goto address_error; - break; - } - - /* The address is OK. */ - return 0; - -address_error: - /* We can't support this address. Unmap it again. */ - unmap_descbuffer(ring, addr, buffersize, dma_to_device); - - return 1; -} - -static int setup_rx_descbuffer(struct b43legacy_dmaring *ring, - struct b43legacy_dmadesc32 *desc, - struct b43legacy_dmadesc_meta *meta, - gfp_t gfp_flags) -{ - struct b43legacy_rxhdr_fw3 *rxhdr; - struct b43legacy_hwtxstatus *txstat; - dma_addr_t dmaaddr; - struct sk_buff *skb; - - B43legacy_WARN_ON(ring->tx); - - skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); - if (unlikely(!skb)) - return -ENOMEM; - dmaaddr = map_descbuffer(ring, skb->data, - ring->rx_buffersize, 0); - if (b43legacy_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { - /* ugh. try to realloc in zone_dma */ - gfp_flags |= GFP_DMA; - - dev_kfree_skb_any(skb); - - skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); - if (unlikely(!skb)) - return -ENOMEM; - dmaaddr = map_descbuffer(ring, skb->data, - ring->rx_buffersize, 0); - } - - if (b43legacy_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { - dev_kfree_skb_any(skb); - return -EIO; - } - - meta->skb = skb; - meta->dmaaddr = dmaaddr; - op32_fill_descriptor(ring, desc, dmaaddr, ring->rx_buffersize, 0, 0, 0); - - rxhdr = (struct b43legacy_rxhdr_fw3 *)(skb->data); - rxhdr->frame_len = 0; - txstat = (struct b43legacy_hwtxstatus *)(skb->data); - txstat->cookie = 0; - - return 0; -} - -/* Allocate the initial descbuffers. - * This is used for an RX ring only. - */ -static int alloc_initial_descbuffers(struct b43legacy_dmaring *ring) -{ - int i; - int err = -ENOMEM; - struct b43legacy_dmadesc32 *desc; - struct b43legacy_dmadesc_meta *meta; - - for (i = 0; i < ring->nr_slots; i++) { - desc = op32_idx2desc(ring, i, &meta); - - err = setup_rx_descbuffer(ring, desc, meta, GFP_KERNEL); - if (err) { - b43legacyerr(ring->dev->wl, - "Failed to allocate initial descbuffers\n"); - goto err_unwind; - } - } - mb(); /* all descbuffer setup before next line */ - ring->used_slots = ring->nr_slots; - err = 0; -out: - return err; - -err_unwind: - for (i--; i >= 0; i--) { - desc = op32_idx2desc(ring, i, &meta); - - unmap_descbuffer(ring, meta->dmaaddr, ring->rx_buffersize, 0); - dev_kfree_skb(meta->skb); - } - goto out; -} - -/* Do initial setup of the DMA controller. - * Reset the controller, write the ring busaddress - * and switch the "enable" bit on. - */ -static int dmacontroller_setup(struct b43legacy_dmaring *ring) -{ - int err = 0; - u32 value; - u32 addrext; - u32 trans = ring->dev->dma.translation; - u32 ringbase = (u32)(ring->dmabase); - - if (ring->tx) { - addrext = (ringbase & SSB_DMA_TRANSLATION_MASK) - >> SSB_DMA_TRANSLATION_SHIFT; - value = B43legacy_DMA32_TXENABLE; - value |= (addrext << B43legacy_DMA32_TXADDREXT_SHIFT) - & B43legacy_DMA32_TXADDREXT_MASK; - b43legacy_dma_write(ring, B43legacy_DMA32_TXCTL, value); - b43legacy_dma_write(ring, B43legacy_DMA32_TXRING, - (ringbase & ~SSB_DMA_TRANSLATION_MASK) - | trans); - } else { - err = alloc_initial_descbuffers(ring); - if (err) - goto out; - - addrext = (ringbase & SSB_DMA_TRANSLATION_MASK) - >> SSB_DMA_TRANSLATION_SHIFT; - value = (ring->frameoffset << - B43legacy_DMA32_RXFROFF_SHIFT); - value |= B43legacy_DMA32_RXENABLE; - value |= (addrext << B43legacy_DMA32_RXADDREXT_SHIFT) - & B43legacy_DMA32_RXADDREXT_MASK; - b43legacy_dma_write(ring, B43legacy_DMA32_RXCTL, value); - b43legacy_dma_write(ring, B43legacy_DMA32_RXRING, - (ringbase & ~SSB_DMA_TRANSLATION_MASK) - | trans); - b43legacy_dma_write(ring, B43legacy_DMA32_RXINDEX, 200); - } - -out: - return err; -} - -/* Shutdown the DMA controller. */ -static void dmacontroller_cleanup(struct b43legacy_dmaring *ring) -{ - if (ring->tx) { - b43legacy_dmacontroller_tx_reset(ring->dev, ring->mmio_base, - ring->type); - b43legacy_dma_write(ring, B43legacy_DMA32_TXRING, 0); - } else { - b43legacy_dmacontroller_rx_reset(ring->dev, ring->mmio_base, - ring->type); - b43legacy_dma_write(ring, B43legacy_DMA32_RXRING, 0); - } -} - -static void free_all_descbuffers(struct b43legacy_dmaring *ring) -{ - struct b43legacy_dmadesc_meta *meta; - int i; - - if (!ring->used_slots) - return; - for (i = 0; i < ring->nr_slots; i++) { - op32_idx2desc(ring, i, &meta); - - if (!meta->skb) { - B43legacy_WARN_ON(!ring->tx); - continue; - } - if (ring->tx) - unmap_descbuffer(ring, meta->dmaaddr, - meta->skb->len, 1); - else - unmap_descbuffer(ring, meta->dmaaddr, - ring->rx_buffersize, 0); - free_descriptor_buffer(ring, meta, 0); - } -} - -static u64 supported_dma_mask(struct b43legacy_wldev *dev) -{ - u32 tmp; - u16 mmio_base; - - mmio_base = b43legacy_dmacontroller_base(0, 0); - b43legacy_write32(dev, - mmio_base + B43legacy_DMA32_TXCTL, - B43legacy_DMA32_TXADDREXT_MASK); - tmp = b43legacy_read32(dev, mmio_base + - B43legacy_DMA32_TXCTL); - if (tmp & B43legacy_DMA32_TXADDREXT_MASK) - return DMA_BIT_MASK(32); - - return DMA_BIT_MASK(30); -} - -static enum b43legacy_dmatype dma_mask_to_engine_type(u64 dmamask) -{ - if (dmamask == DMA_BIT_MASK(30)) - return B43legacy_DMA_30BIT; - if (dmamask == DMA_BIT_MASK(32)) - return B43legacy_DMA_32BIT; - B43legacy_WARN_ON(1); - return B43legacy_DMA_30BIT; -} - -/* Main initialization function. */ -static -struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev, - int controller_index, - int for_tx, - enum b43legacy_dmatype type) -{ - struct b43legacy_dmaring *ring; - int err; - int nr_slots; - dma_addr_t dma_test; - - ring = kzalloc(sizeof(*ring), GFP_KERNEL); - if (!ring) - goto out; - ring->type = type; - ring->dev = dev; - - nr_slots = B43legacy_RXRING_SLOTS; - if (for_tx) - nr_slots = B43legacy_TXRING_SLOTS; - - ring->meta = kcalloc(nr_slots, sizeof(struct b43legacy_dmadesc_meta), - GFP_KERNEL); - if (!ring->meta) - goto err_kfree_ring; - if (for_tx) { - ring->txhdr_cache = kcalloc(nr_slots, - sizeof(struct b43legacy_txhdr_fw3), - GFP_KERNEL); - if (!ring->txhdr_cache) - goto err_kfree_meta; - - /* test for ability to dma to txhdr_cache */ - dma_test = dma_map_single(dev->dev->dma_dev, ring->txhdr_cache, - sizeof(struct b43legacy_txhdr_fw3), - DMA_TO_DEVICE); - - if (b43legacy_dma_mapping_error(ring, dma_test, - sizeof(struct b43legacy_txhdr_fw3), 1)) { - /* ugh realloc */ - kfree(ring->txhdr_cache); - ring->txhdr_cache = kcalloc(nr_slots, - sizeof(struct b43legacy_txhdr_fw3), - GFP_KERNEL | GFP_DMA); - if (!ring->txhdr_cache) - goto err_kfree_meta; - - dma_test = dma_map_single(dev->dev->dma_dev, - ring->txhdr_cache, - sizeof(struct b43legacy_txhdr_fw3), - DMA_TO_DEVICE); - - if (b43legacy_dma_mapping_error(ring, dma_test, - sizeof(struct b43legacy_txhdr_fw3), 1)) - goto err_kfree_txhdr_cache; - } - - dma_unmap_single(dev->dev->dma_dev, dma_test, - sizeof(struct b43legacy_txhdr_fw3), - DMA_TO_DEVICE); - } - - ring->nr_slots = nr_slots; - ring->mmio_base = b43legacy_dmacontroller_base(type, controller_index); - ring->index = controller_index; - if (for_tx) { - ring->tx = true; - ring->current_slot = -1; - } else { - if (ring->index == 0) { - ring->rx_buffersize = B43legacy_DMA0_RX_BUFFERSIZE; - ring->frameoffset = B43legacy_DMA0_RX_FRAMEOFFSET; - } else if (ring->index == 3) { - ring->rx_buffersize = B43legacy_DMA3_RX_BUFFERSIZE; - ring->frameoffset = B43legacy_DMA3_RX_FRAMEOFFSET; - } else - B43legacy_WARN_ON(1); - } -#ifdef CONFIG_B43LEGACY_DEBUG - ring->last_injected_overflow = jiffies; -#endif - - err = alloc_ringmemory(ring); - if (err) - goto err_kfree_txhdr_cache; - err = dmacontroller_setup(ring); - if (err) - goto err_free_ringmemory; - -out: - return ring; - -err_free_ringmemory: - free_ringmemory(ring); -err_kfree_txhdr_cache: - kfree(ring->txhdr_cache); -err_kfree_meta: - kfree(ring->meta); -err_kfree_ring: - kfree(ring); - ring = NULL; - goto out; -} - -/* Main cleanup function. */ -static void b43legacy_destroy_dmaring(struct b43legacy_dmaring *ring) -{ - if (!ring) - return; - - b43legacydbg(ring->dev->wl, "DMA-%u 0x%04X (%s) max used slots:" - " %d/%d\n", (unsigned int)(ring->type), ring->mmio_base, - (ring->tx) ? "TX" : "RX", ring->max_used_slots, - ring->nr_slots); - /* Device IRQs are disabled prior entering this function, - * so no need to take care of concurrency with rx handler stuff. - */ - dmacontroller_cleanup(ring); - free_all_descbuffers(ring); - free_ringmemory(ring); - - kfree(ring->txhdr_cache); - kfree(ring->meta); - kfree(ring); -} - -void b43legacy_dma_free(struct b43legacy_wldev *dev) -{ - struct b43legacy_dma *dma; - - if (b43legacy_using_pio(dev)) - return; - dma = &dev->dma; - - b43legacy_destroy_dmaring(dma->rx_ring3); - dma->rx_ring3 = NULL; - b43legacy_destroy_dmaring(dma->rx_ring0); - dma->rx_ring0 = NULL; - - b43legacy_destroy_dmaring(dma->tx_ring5); - dma->tx_ring5 = NULL; - b43legacy_destroy_dmaring(dma->tx_ring4); - dma->tx_ring4 = NULL; - b43legacy_destroy_dmaring(dma->tx_ring3); - dma->tx_ring3 = NULL; - b43legacy_destroy_dmaring(dma->tx_ring2); - dma->tx_ring2 = NULL; - b43legacy_destroy_dmaring(dma->tx_ring1); - dma->tx_ring1 = NULL; - b43legacy_destroy_dmaring(dma->tx_ring0); - dma->tx_ring0 = NULL; -} - -static int b43legacy_dma_set_mask(struct b43legacy_wldev *dev, u64 mask) -{ - u64 orig_mask = mask; - bool fallback = false; - int err; - - /* Try to set the DMA mask. If it fails, try falling back to a - * lower mask, as we can always also support a lower one. */ - while (1) { - err = dma_set_mask(dev->dev->dma_dev, mask); - if (!err) { - err = dma_set_coherent_mask(dev->dev->dma_dev, mask); - if (!err) - break; - } - if (mask == DMA_BIT_MASK(64)) { - mask = DMA_BIT_MASK(32); - fallback = true; - continue; - } - if (mask == DMA_BIT_MASK(32)) { - mask = DMA_BIT_MASK(30); - fallback = true; - continue; - } - b43legacyerr(dev->wl, "The machine/kernel does not support " - "the required %u-bit DMA mask\n", - (unsigned int)dma_mask_to_engine_type(orig_mask)); - return -EOPNOTSUPP; - } - if (fallback) { - b43legacyinfo(dev->wl, "DMA mask fallback from %u-bit to %u-" - "bit\n", - (unsigned int)dma_mask_to_engine_type(orig_mask), - (unsigned int)dma_mask_to_engine_type(mask)); - } - - return 0; -} - -int b43legacy_dma_init(struct b43legacy_wldev *dev) -{ - struct b43legacy_dma *dma = &dev->dma; - struct b43legacy_dmaring *ring; - int err; - u64 dmamask; - enum b43legacy_dmatype type; - - dmamask = supported_dma_mask(dev); - type = dma_mask_to_engine_type(dmamask); - err = b43legacy_dma_set_mask(dev, dmamask); - if (err) { -#ifdef CONFIG_B43LEGACY_PIO - b43legacywarn(dev->wl, "DMA for this device not supported. " - "Falling back to PIO\n"); - dev->__using_pio = true; - return -EAGAIN; -#else - b43legacyerr(dev->wl, "DMA for this device not supported and " - "no PIO support compiled in\n"); - return -EOPNOTSUPP; -#endif - } - dma->translation = ssb_dma_translation(dev->dev); - - err = -ENOMEM; - /* setup TX DMA channels. */ - ring = b43legacy_setup_dmaring(dev, 0, 1, type); - if (!ring) - goto out; - dma->tx_ring0 = ring; - - ring = b43legacy_setup_dmaring(dev, 1, 1, type); - if (!ring) - goto err_destroy_tx0; - dma->tx_ring1 = ring; - - ring = b43legacy_setup_dmaring(dev, 2, 1, type); - if (!ring) - goto err_destroy_tx1; - dma->tx_ring2 = ring; - - ring = b43legacy_setup_dmaring(dev, 3, 1, type); - if (!ring) - goto err_destroy_tx2; - dma->tx_ring3 = ring; - - ring = b43legacy_setup_dmaring(dev, 4, 1, type); - if (!ring) - goto err_destroy_tx3; - dma->tx_ring4 = ring; - - ring = b43legacy_setup_dmaring(dev, 5, 1, type); - if (!ring) - goto err_destroy_tx4; - dma->tx_ring5 = ring; - - /* setup RX DMA channels. */ - ring = b43legacy_setup_dmaring(dev, 0, 0, type); - if (!ring) - goto err_destroy_tx5; - dma->rx_ring0 = ring; - - if (dev->dev->id.revision < 5) { - ring = b43legacy_setup_dmaring(dev, 3, 0, type); - if (!ring) - goto err_destroy_rx0; - dma->rx_ring3 = ring; - } - - b43legacydbg(dev->wl, "%u-bit DMA initialized\n", (unsigned int)type); - err = 0; -out: - return err; - -err_destroy_rx0: - b43legacy_destroy_dmaring(dma->rx_ring0); - dma->rx_ring0 = NULL; -err_destroy_tx5: - b43legacy_destroy_dmaring(dma->tx_ring5); - dma->tx_ring5 = NULL; -err_destroy_tx4: - b43legacy_destroy_dmaring(dma->tx_ring4); - dma->tx_ring4 = NULL; -err_destroy_tx3: - b43legacy_destroy_dmaring(dma->tx_ring3); - dma->tx_ring3 = NULL; -err_destroy_tx2: - b43legacy_destroy_dmaring(dma->tx_ring2); - dma->tx_ring2 = NULL; -err_destroy_tx1: - b43legacy_destroy_dmaring(dma->tx_ring1); - dma->tx_ring1 = NULL; -err_destroy_tx0: - b43legacy_destroy_dmaring(dma->tx_ring0); - dma->tx_ring0 = NULL; - goto out; -} - -/* Generate a cookie for the TX header. */ -static u16 generate_cookie(struct b43legacy_dmaring *ring, - int slot) -{ - u16 cookie = 0x1000; - - /* Use the upper 4 bits of the cookie as - * DMA controller ID and store the slot number - * in the lower 12 bits. - * Note that the cookie must never be 0, as this - * is a special value used in RX path. - */ - switch (ring->index) { - case 0: - cookie = 0xA000; - break; - case 1: - cookie = 0xB000; - break; - case 2: - cookie = 0xC000; - break; - case 3: - cookie = 0xD000; - break; - case 4: - cookie = 0xE000; - break; - case 5: - cookie = 0xF000; - break; - } - B43legacy_WARN_ON(!(((u16)slot & 0xF000) == 0x0000)); - cookie |= (u16)slot; - - return cookie; -} - -/* Inspect a cookie and find out to which controller/slot it belongs. */ -static -struct b43legacy_dmaring *parse_cookie(struct b43legacy_wldev *dev, - u16 cookie, int *slot) -{ - struct b43legacy_dma *dma = &dev->dma; - struct b43legacy_dmaring *ring = NULL; - - switch (cookie & 0xF000) { - case 0xA000: - ring = dma->tx_ring0; - break; - case 0xB000: - ring = dma->tx_ring1; - break; - case 0xC000: - ring = dma->tx_ring2; - break; - case 0xD000: - ring = dma->tx_ring3; - break; - case 0xE000: - ring = dma->tx_ring4; - break; - case 0xF000: - ring = dma->tx_ring5; - break; - default: - B43legacy_WARN_ON(1); - } - *slot = (cookie & 0x0FFF); - B43legacy_WARN_ON(!(ring && *slot >= 0 && *slot < ring->nr_slots)); - - return ring; -} - -static int dma_tx_fragment(struct b43legacy_dmaring *ring, - struct sk_buff **in_skb) -{ - struct sk_buff *skb = *in_skb; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - u8 *header; - int slot, old_top_slot, old_used_slots; - int err; - struct b43legacy_dmadesc32 *desc; - struct b43legacy_dmadesc_meta *meta; - struct b43legacy_dmadesc_meta *meta_hdr; - struct sk_buff *bounce_skb; - -#define SLOTS_PER_PACKET 2 - B43legacy_WARN_ON(skb_shinfo(skb)->nr_frags != 0); - - old_top_slot = ring->current_slot; - old_used_slots = ring->used_slots; - - /* Get a slot for the header. */ - slot = request_slot(ring); - desc = op32_idx2desc(ring, slot, &meta_hdr); - memset(meta_hdr, 0, sizeof(*meta_hdr)); - - header = &(ring->txhdr_cache[slot * sizeof( - struct b43legacy_txhdr_fw3)]); - err = b43legacy_generate_txhdr(ring->dev, header, - skb->data, skb->len, info, - generate_cookie(ring, slot)); - if (unlikely(err)) { - ring->current_slot = old_top_slot; - ring->used_slots = old_used_slots; - return err; - } - - meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header, - sizeof(struct b43legacy_txhdr_fw3), 1); - if (b43legacy_dma_mapping_error(ring, meta_hdr->dmaaddr, - sizeof(struct b43legacy_txhdr_fw3), 1)) { - ring->current_slot = old_top_slot; - ring->used_slots = old_used_slots; - return -EIO; - } - op32_fill_descriptor(ring, desc, meta_hdr->dmaaddr, - sizeof(struct b43legacy_txhdr_fw3), 1, 0, 0); - - /* Get a slot for the payload. */ - slot = request_slot(ring); - desc = op32_idx2desc(ring, slot, &meta); - memset(meta, 0, sizeof(*meta)); - - meta->skb = skb; - meta->is_last_fragment = true; - - meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); - /* create a bounce buffer in zone_dma on mapping failure. */ - if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { - bounce_skb = alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); - if (!bounce_skb) { - ring->current_slot = old_top_slot; - ring->used_slots = old_used_slots; - err = -ENOMEM; - goto out_unmap_hdr; - } - - memcpy(skb_put(bounce_skb, skb->len), skb->data, skb->len); - memcpy(bounce_skb->cb, skb->cb, sizeof(skb->cb)); - bounce_skb->dev = skb->dev; - skb_set_queue_mapping(bounce_skb, skb_get_queue_mapping(skb)); - info = IEEE80211_SKB_CB(bounce_skb); - - dev_kfree_skb_any(skb); - skb = bounce_skb; - *in_skb = bounce_skb; - meta->skb = skb; - meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); - if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { - ring->current_slot = old_top_slot; - ring->used_slots = old_used_slots; - err = -EIO; - goto out_free_bounce; - } - } - - op32_fill_descriptor(ring, desc, meta->dmaaddr, - skb->len, 0, 1, 1); - - wmb(); /* previous stuff MUST be done */ - /* Now transfer the whole frame. */ - op32_poke_tx(ring, next_slot(ring, slot)); - return 0; - -out_free_bounce: - dev_kfree_skb_any(skb); -out_unmap_hdr: - unmap_descbuffer(ring, meta_hdr->dmaaddr, - sizeof(struct b43legacy_txhdr_fw3), 1); - return err; -} - -static inline -int should_inject_overflow(struct b43legacy_dmaring *ring) -{ -#ifdef CONFIG_B43LEGACY_DEBUG - if (unlikely(b43legacy_debug(ring->dev, - B43legacy_DBG_DMAOVERFLOW))) { - /* Check if we should inject another ringbuffer overflow - * to test handling of this situation in the stack. */ - unsigned long next_overflow; - - next_overflow = ring->last_injected_overflow + HZ; - if (time_after(jiffies, next_overflow)) { - ring->last_injected_overflow = jiffies; - b43legacydbg(ring->dev->wl, - "Injecting TX ring overflow on " - "DMA controller %d\n", ring->index); - return 1; - } - } -#endif /* CONFIG_B43LEGACY_DEBUG */ - return 0; -} - -int b43legacy_dma_tx(struct b43legacy_wldev *dev, - struct sk_buff *skb) -{ - struct b43legacy_dmaring *ring; - int err = 0; - - ring = priority_to_txring(dev, skb_get_queue_mapping(skb)); - B43legacy_WARN_ON(!ring->tx); - - if (unlikely(ring->stopped)) { - /* We get here only because of a bug in mac80211. - * Because of a race, one packet may be queued after - * the queue is stopped, thus we got called when we shouldn't. - * For now, just refuse the transmit. */ - if (b43legacy_debug(dev, B43legacy_DBG_DMAVERBOSE)) - b43legacyerr(dev->wl, "Packet after queue stopped\n"); - return -ENOSPC; - } - - if (unlikely(WARN_ON(free_slots(ring) < SLOTS_PER_PACKET))) { - /* If we get here, we have a real error with the queue - * full, but queues not stopped. */ - b43legacyerr(dev->wl, "DMA queue overflow\n"); - return -ENOSPC; - } - - /* dma_tx_fragment might reallocate the skb, so invalidate pointers pointing - * into the skb data or cb now. */ - err = dma_tx_fragment(ring, &skb); - if (unlikely(err == -ENOKEY)) { - /* Drop this packet, as we don't have the encryption key - * anymore and must not transmit it unencrypted. */ - dev_kfree_skb_any(skb); - return 0; - } - if (unlikely(err)) { - b43legacyerr(dev->wl, "DMA tx mapping failure\n"); - return err; - } - if ((free_slots(ring) < SLOTS_PER_PACKET) || - should_inject_overflow(ring)) { - /* This TX ring is full. */ - unsigned int skb_mapping = skb_get_queue_mapping(skb); - ieee80211_stop_queue(dev->wl->hw, skb_mapping); - dev->wl->tx_queue_stopped[skb_mapping] = 1; - ring->stopped = true; - if (b43legacy_debug(dev, B43legacy_DBG_DMAVERBOSE)) - b43legacydbg(dev->wl, "Stopped TX ring %d\n", - ring->index); - } - return err; -} - -void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev, - const struct b43legacy_txstatus *status) -{ - struct b43legacy_dmaring *ring; - struct b43legacy_dmadesc_meta *meta; - int retry_limit; - int slot; - int firstused; - - ring = parse_cookie(dev, status->cookie, &slot); - if (unlikely(!ring)) - return; - B43legacy_WARN_ON(!ring->tx); - - /* Sanity check: TX packets are processed in-order on one ring. - * Check if the slot deduced from the cookie really is the first - * used slot. */ - firstused = ring->current_slot - ring->used_slots + 1; - if (firstused < 0) - firstused = ring->nr_slots + firstused; - if (unlikely(slot != firstused)) { - /* This possibly is a firmware bug and will result in - * malfunction, memory leaks and/or stall of DMA functionality. - */ - b43legacydbg(dev->wl, "Out of order TX status report on DMA " - "ring %d. Expected %d, but got %d\n", - ring->index, firstused, slot); - return; - } - - while (1) { - B43legacy_WARN_ON(!(slot >= 0 && slot < ring->nr_slots)); - op32_idx2desc(ring, slot, &meta); - - if (meta->skb) - unmap_descbuffer(ring, meta->dmaaddr, - meta->skb->len, 1); - else - unmap_descbuffer(ring, meta->dmaaddr, - sizeof(struct b43legacy_txhdr_fw3), - 1); - - if (meta->is_last_fragment) { - struct ieee80211_tx_info *info; - BUG_ON(!meta->skb); - info = IEEE80211_SKB_CB(meta->skb); - - /* preserve the confiured retry limit before clearing the status - * The xmit function has overwritten the rc's value with the actual - * retry limit done by the hardware */ - retry_limit = info->status.rates[0].count; - ieee80211_tx_info_clear_status(info); - - if (status->acked) - info->flags |= IEEE80211_TX_STAT_ACK; - - if (status->rts_count > dev->wl->hw->conf.short_frame_max_tx_count) { - /* - * If the short retries (RTS, not data frame) have exceeded - * the limit, the hw will not have tried the selected rate, - * but will have used the fallback rate instead. - * Don't let the rate control count attempts for the selected - * rate in this case, otherwise the statistics will be off. - */ - info->status.rates[0].count = 0; - info->status.rates[1].count = status->frame_count; - } else { - if (status->frame_count > retry_limit) { - info->status.rates[0].count = retry_limit; - info->status.rates[1].count = status->frame_count - - retry_limit; - - } else { - info->status.rates[0].count = status->frame_count; - info->status.rates[1].idx = -1; - } - } - - /* Call back to inform the ieee80211 subsystem about the - * status of the transmission. - * Some fields of txstat are already filled in dma_tx(). - */ - ieee80211_tx_status_irqsafe(dev->wl->hw, meta->skb); - /* skb is freed by ieee80211_tx_status_irqsafe() */ - meta->skb = NULL; - } else { - /* No need to call free_descriptor_buffer here, as - * this is only the txhdr, which is not allocated. - */ - B43legacy_WARN_ON(meta->skb != NULL); - } - - /* Everything unmapped and free'd. So it's not used anymore. */ - ring->used_slots--; - - if (meta->is_last_fragment) - break; - slot = next_slot(ring, slot); - } - dev->stats.last_tx = jiffies; - if (ring->stopped) { - B43legacy_WARN_ON(free_slots(ring) < SLOTS_PER_PACKET); - ring->stopped = false; - } - - if (dev->wl->tx_queue_stopped[ring->queue_prio]) { - dev->wl->tx_queue_stopped[ring->queue_prio] = 0; - } else { - /* If the driver queue is running wake the corresponding - * mac80211 queue. */ - ieee80211_wake_queue(dev->wl->hw, ring->queue_prio); - if (b43legacy_debug(dev, B43legacy_DBG_DMAVERBOSE)) - b43legacydbg(dev->wl, "Woke up TX ring %d\n", - ring->index); - } - /* Add work to the queue. */ - ieee80211_queue_work(dev->wl->hw, &dev->wl->tx_work); -} - -static void dma_rx(struct b43legacy_dmaring *ring, - int *slot) -{ - struct b43legacy_dmadesc32 *desc; - struct b43legacy_dmadesc_meta *meta; - struct b43legacy_rxhdr_fw3 *rxhdr; - struct sk_buff *skb; - u16 len; - int err; - dma_addr_t dmaaddr; - - desc = op32_idx2desc(ring, *slot, &meta); - - sync_descbuffer_for_cpu(ring, meta->dmaaddr, ring->rx_buffersize); - skb = meta->skb; - - if (ring->index == 3) { - /* We received an xmit status. */ - struct b43legacy_hwtxstatus *hw = - (struct b43legacy_hwtxstatus *)skb->data; - int i = 0; - - while (hw->cookie == 0) { - if (i > 100) - break; - i++; - udelay(2); - barrier(); - } - b43legacy_handle_hwtxstatus(ring->dev, hw); - /* recycle the descriptor buffer. */ - sync_descbuffer_for_device(ring, meta->dmaaddr, - ring->rx_buffersize); - - return; - } - rxhdr = (struct b43legacy_rxhdr_fw3 *)skb->data; - len = le16_to_cpu(rxhdr->frame_len); - if (len == 0) { - int i = 0; - - do { - udelay(2); - barrier(); - len = le16_to_cpu(rxhdr->frame_len); - } while (len == 0 && i++ < 5); - if (unlikely(len == 0)) { - /* recycle the descriptor buffer. */ - sync_descbuffer_for_device(ring, meta->dmaaddr, - ring->rx_buffersize); - goto drop; - } - } - if (unlikely(len > ring->rx_buffersize)) { - /* The data did not fit into one descriptor buffer - * and is split over multiple buffers. - * This should never happen, as we try to allocate buffers - * big enough. So simply ignore this packet. - */ - int cnt = 0; - s32 tmp = len; - - while (1) { - desc = op32_idx2desc(ring, *slot, &meta); - /* recycle the descriptor buffer. */ - sync_descbuffer_for_device(ring, meta->dmaaddr, - ring->rx_buffersize); - *slot = next_slot(ring, *slot); - cnt++; - tmp -= ring->rx_buffersize; - if (tmp <= 0) - break; - } - b43legacyerr(ring->dev->wl, "DMA RX buffer too small " - "(len: %u, buffer: %u, nr-dropped: %d)\n", - len, ring->rx_buffersize, cnt); - goto drop; - } - - dmaaddr = meta->dmaaddr; - err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC); - if (unlikely(err)) { - b43legacydbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer()" - " failed\n"); - sync_descbuffer_for_device(ring, dmaaddr, - ring->rx_buffersize); - goto drop; - } - - unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); - skb_put(skb, len + ring->frameoffset); - skb_pull(skb, ring->frameoffset); - - b43legacy_rx(ring->dev, skb, rxhdr); -drop: - return; -} - -void b43legacy_dma_rx(struct b43legacy_dmaring *ring) -{ - int slot; - int current_slot; - int used_slots = 0; - - B43legacy_WARN_ON(ring->tx); - current_slot = op32_get_current_rxslot(ring); - B43legacy_WARN_ON(!(current_slot >= 0 && current_slot < - ring->nr_slots)); - - slot = ring->current_slot; - for (; slot != current_slot; slot = next_slot(ring, slot)) { - dma_rx(ring, &slot); - update_max_used_slots(ring, ++used_slots); - } - op32_set_current_rxslot(ring, slot); - ring->current_slot = slot; -} - -static void b43legacy_dma_tx_suspend_ring(struct b43legacy_dmaring *ring) -{ - B43legacy_WARN_ON(!ring->tx); - op32_tx_suspend(ring); -} - -static void b43legacy_dma_tx_resume_ring(struct b43legacy_dmaring *ring) -{ - B43legacy_WARN_ON(!ring->tx); - op32_tx_resume(ring); -} - -void b43legacy_dma_tx_suspend(struct b43legacy_wldev *dev) -{ - b43legacy_power_saving_ctl_bits(dev, -1, 1); - b43legacy_dma_tx_suspend_ring(dev->dma.tx_ring0); - b43legacy_dma_tx_suspend_ring(dev->dma.tx_ring1); - b43legacy_dma_tx_suspend_ring(dev->dma.tx_ring2); - b43legacy_dma_tx_suspend_ring(dev->dma.tx_ring3); - b43legacy_dma_tx_suspend_ring(dev->dma.tx_ring4); - b43legacy_dma_tx_suspend_ring(dev->dma.tx_ring5); -} - -void b43legacy_dma_tx_resume(struct b43legacy_wldev *dev) -{ - b43legacy_dma_tx_resume_ring(dev->dma.tx_ring5); - b43legacy_dma_tx_resume_ring(dev->dma.tx_ring4); - b43legacy_dma_tx_resume_ring(dev->dma.tx_ring3); - b43legacy_dma_tx_resume_ring(dev->dma.tx_ring2); - b43legacy_dma_tx_resume_ring(dev->dma.tx_ring1); - b43legacy_dma_tx_resume_ring(dev->dma.tx_ring0); - b43legacy_power_saving_ctl_bits(dev, -1, -1); -} diff --git a/drivers/net/wireless/b43legacy/dma.h b/drivers/net/wireless/b43legacy/dma.h deleted file mode 100644 index c3282f906bc7..000000000000 --- a/drivers/net/wireless/b43legacy/dma.h +++ /dev/null @@ -1,231 +0,0 @@ -#ifndef B43legacy_DMA_H_ -#define B43legacy_DMA_H_ - -#include -#include -#include -#include -#include - -#include "b43legacy.h" - - -/* DMA-Interrupt reasons. */ -#define B43legacy_DMAIRQ_FATALMASK ((1 << 10) | (1 << 11) | (1 << 12) \ - | (1 << 14) | (1 << 15)) -#define B43legacy_DMAIRQ_NONFATALMASK (1 << 13) -#define B43legacy_DMAIRQ_RX_DONE (1 << 16) - - -/*** 32-bit DMA Engine. ***/ - -/* 32-bit DMA controller registers. */ -#define B43legacy_DMA32_TXCTL 0x00 -#define B43legacy_DMA32_TXENABLE 0x00000001 -#define B43legacy_DMA32_TXSUSPEND 0x00000002 -#define B43legacy_DMA32_TXLOOPBACK 0x00000004 -#define B43legacy_DMA32_TXFLUSH 0x00000010 -#define B43legacy_DMA32_TXADDREXT_MASK 0x00030000 -#define B43legacy_DMA32_TXADDREXT_SHIFT 16 -#define B43legacy_DMA32_TXRING 0x04 -#define B43legacy_DMA32_TXINDEX 0x08 -#define B43legacy_DMA32_TXSTATUS 0x0C -#define B43legacy_DMA32_TXDPTR 0x00000FFF -#define B43legacy_DMA32_TXSTATE 0x0000F000 -#define B43legacy_DMA32_TXSTAT_DISABLED 0x00000000 -#define B43legacy_DMA32_TXSTAT_ACTIVE 0x00001000 -#define B43legacy_DMA32_TXSTAT_IDLEWAIT 0x00002000 -#define B43legacy_DMA32_TXSTAT_STOPPED 0x00003000 -#define B43legacy_DMA32_TXSTAT_SUSP 0x00004000 -#define B43legacy_DMA32_TXERROR 0x000F0000 -#define B43legacy_DMA32_TXERR_NOERR 0x00000000 -#define B43legacy_DMA32_TXERR_PROT 0x00010000 -#define B43legacy_DMA32_TXERR_UNDERRUN 0x00020000 -#define B43legacy_DMA32_TXERR_BUFREAD 0x00030000 -#define B43legacy_DMA32_TXERR_DESCREAD 0x00040000 -#define B43legacy_DMA32_TXACTIVE 0xFFF00000 -#define B43legacy_DMA32_RXCTL 0x10 -#define B43legacy_DMA32_RXENABLE 0x00000001 -#define B43legacy_DMA32_RXFROFF_MASK 0x000000FE -#define B43legacy_DMA32_RXFROFF_SHIFT 1 -#define B43legacy_DMA32_RXDIRECTFIFO 0x00000100 -#define B43legacy_DMA32_RXADDREXT_MASK 0x00030000 -#define B43legacy_DMA32_RXADDREXT_SHIFT 16 -#define B43legacy_DMA32_RXRING 0x14 -#define B43legacy_DMA32_RXINDEX 0x18 -#define B43legacy_DMA32_RXSTATUS 0x1C -#define B43legacy_DMA32_RXDPTR 0x00000FFF -#define B43legacy_DMA32_RXSTATE 0x0000F000 -#define B43legacy_DMA32_RXSTAT_DISABLED 0x00000000 -#define B43legacy_DMA32_RXSTAT_ACTIVE 0x00001000 -#define B43legacy_DMA32_RXSTAT_IDLEWAIT 0x00002000 -#define B43legacy_DMA32_RXSTAT_STOPPED 0x00003000 -#define B43legacy_DMA32_RXERROR 0x000F0000 -#define B43legacy_DMA32_RXERR_NOERR 0x00000000 -#define B43legacy_DMA32_RXERR_PROT 0x00010000 -#define B43legacy_DMA32_RXERR_OVERFLOW 0x00020000 -#define B43legacy_DMA32_RXERR_BUFWRITE 0x00030000 -#define B43legacy_DMA32_RXERR_DESCREAD 0x00040000 -#define B43legacy_DMA32_RXACTIVE 0xFFF00000 - -/* 32-bit DMA descriptor. */ -struct b43legacy_dmadesc32 { - __le32 control; - __le32 address; -} __packed; -#define B43legacy_DMA32_DCTL_BYTECNT 0x00001FFF -#define B43legacy_DMA32_DCTL_ADDREXT_MASK 0x00030000 -#define B43legacy_DMA32_DCTL_ADDREXT_SHIFT 16 -#define B43legacy_DMA32_DCTL_DTABLEEND 0x10000000 -#define B43legacy_DMA32_DCTL_IRQ 0x20000000 -#define B43legacy_DMA32_DCTL_FRAMEEND 0x40000000 -#define B43legacy_DMA32_DCTL_FRAMESTART 0x80000000 - - -/* Misc DMA constants */ -#define B43legacy_DMA_RINGMEMSIZE PAGE_SIZE -#define B43legacy_DMA0_RX_FRAMEOFFSET 30 -#define B43legacy_DMA3_RX_FRAMEOFFSET 0 - - -/* DMA engine tuning knobs */ -#define B43legacy_TXRING_SLOTS 128 -#define B43legacy_RXRING_SLOTS 64 -#define B43legacy_DMA0_RX_BUFFERSIZE (2304 + 100) -#define B43legacy_DMA3_RX_BUFFERSIZE 16 - - - -#ifdef CONFIG_B43LEGACY_DMA - - -struct sk_buff; -struct b43legacy_private; -struct b43legacy_txstatus; - - -struct b43legacy_dmadesc_meta { - /* The kernel DMA-able buffer. */ - struct sk_buff *skb; - /* DMA base bus-address of the descriptor buffer. */ - dma_addr_t dmaaddr; - /* ieee80211 TX status. Only used once per 802.11 frag. */ - bool is_last_fragment; -}; - -enum b43legacy_dmatype { - B43legacy_DMA_30BIT = 30, - B43legacy_DMA_32BIT = 32, -}; - -struct b43legacy_dmaring { - /* Kernel virtual base address of the ring memory. */ - void *descbase; - /* Meta data about all descriptors. */ - struct b43legacy_dmadesc_meta *meta; - /* Cache of TX headers for each slot. - * This is to avoid an allocation on each TX. - * This is NULL for an RX ring. - */ - u8 *txhdr_cache; - /* (Unadjusted) DMA base bus-address of the ring memory. */ - dma_addr_t dmabase; - /* Number of descriptor slots in the ring. */ - int nr_slots; - /* Number of used descriptor slots. */ - int used_slots; - /* Currently used slot in the ring. */ - int current_slot; - /* Frameoffset in octets. */ - u32 frameoffset; - /* Descriptor buffer size. */ - u16 rx_buffersize; - /* The MMIO base register of the DMA controller. */ - u16 mmio_base; - /* DMA controller index number (0-5). */ - int index; - /* Boolean. Is this a TX ring? */ - bool tx; - /* The type of DMA engine used. */ - enum b43legacy_dmatype type; - /* Boolean. Is this ring stopped at ieee80211 level? */ - bool stopped; - /* The QOS priority assigned to this ring. Only used for TX rings. - * This is the mac80211 "queue" value. */ - u8 queue_prio; - struct b43legacy_wldev *dev; -#ifdef CONFIG_B43LEGACY_DEBUG - /* Maximum number of used slots. */ - int max_used_slots; - /* Last time we injected a ring overflow. */ - unsigned long last_injected_overflow; -#endif /* CONFIG_B43LEGACY_DEBUG*/ -}; - - -static inline -u32 b43legacy_dma_read(struct b43legacy_dmaring *ring, - u16 offset) -{ - return b43legacy_read32(ring->dev, ring->mmio_base + offset); -} - -static inline -void b43legacy_dma_write(struct b43legacy_dmaring *ring, - u16 offset, u32 value) -{ - b43legacy_write32(ring->dev, ring->mmio_base + offset, value); -} - - -int b43legacy_dma_init(struct b43legacy_wldev *dev); -void b43legacy_dma_free(struct b43legacy_wldev *dev); - -void b43legacy_dma_tx_suspend(struct b43legacy_wldev *dev); -void b43legacy_dma_tx_resume(struct b43legacy_wldev *dev); - -int b43legacy_dma_tx(struct b43legacy_wldev *dev, - struct sk_buff *skb); -void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev, - const struct b43legacy_txstatus *status); - -void b43legacy_dma_rx(struct b43legacy_dmaring *ring); - -#else /* CONFIG_B43LEGACY_DMA */ - - -static inline -int b43legacy_dma_init(struct b43legacy_wldev *dev) -{ - return 0; -} -static inline -void b43legacy_dma_free(struct b43legacy_wldev *dev) -{ -} -static inline -int b43legacy_dma_tx(struct b43legacy_wldev *dev, - struct sk_buff *skb) -{ - return 0; -} -static inline -void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev, - const struct b43legacy_txstatus *status) -{ -} -static inline -void b43legacy_dma_rx(struct b43legacy_dmaring *ring) -{ -} -static inline -void b43legacy_dma_tx_suspend(struct b43legacy_wldev *dev) -{ -} -static inline -void b43legacy_dma_tx_resume(struct b43legacy_wldev *dev) -{ -} - -#endif /* CONFIG_B43LEGACY_DMA */ -#endif /* B43legacy_DMA_H_ */ diff --git a/drivers/net/wireless/b43legacy/ilt.c b/drivers/net/wireless/b43legacy/ilt.c deleted file mode 100644 index ee5682e54204..000000000000 --- a/drivers/net/wireless/b43legacy/ilt.c +++ /dev/null @@ -1,336 +0,0 @@ -/* - - Broadcom B43legacy wireless driver - - Copyright (c) 2005 Martin Langer , - Stefano Brivio - Michael Buesch - Danny van Dyk - Andreas Jaggi - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43legacy.h" -#include "ilt.h" -#include "phy.h" - - -/**** Initial Internal Lookup Tables ****/ - -const u32 b43legacy_ilt_rotor[B43legacy_ILT_ROTOR_SIZE] = { - 0xFEB93FFD, 0xFEC63FFD, /* 0 */ - 0xFED23FFD, 0xFEDF3FFD, - 0xFEEC3FFE, 0xFEF83FFE, - 0xFF053FFE, 0xFF113FFE, - 0xFF1E3FFE, 0xFF2A3FFF, /* 8 */ - 0xFF373FFF, 0xFF443FFF, - 0xFF503FFF, 0xFF5D3FFF, - 0xFF693FFF, 0xFF763FFF, - 0xFF824000, 0xFF8F4000, /* 16 */ - 0xFF9B4000, 0xFFA84000, - 0xFFB54000, 0xFFC14000, - 0xFFCE4000, 0xFFDA4000, - 0xFFE74000, 0xFFF34000, /* 24 */ - 0x00004000, 0x000D4000, - 0x00194000, 0x00264000, - 0x00324000, 0x003F4000, - 0x004B4000, 0x00584000, /* 32 */ - 0x00654000, 0x00714000, - 0x007E4000, 0x008A3FFF, - 0x00973FFF, 0x00A33FFF, - 0x00B03FFF, 0x00BC3FFF, /* 40 */ - 0x00C93FFF, 0x00D63FFF, - 0x00E23FFE, 0x00EF3FFE, - 0x00FB3FFE, 0x01083FFE, - 0x01143FFE, 0x01213FFD, /* 48 */ - 0x012E3FFD, 0x013A3FFD, - 0x01473FFD, -}; - -const u32 b43legacy_ilt_retard[B43legacy_ILT_RETARD_SIZE] = { - 0xDB93CB87, 0xD666CF64, /* 0 */ - 0xD1FDD358, 0xCDA6D826, - 0xCA38DD9F, 0xC729E2B4, - 0xC469E88E, 0xC26AEE2B, - 0xC0DEF46C, 0xC073FA62, /* 8 */ - 0xC01D00D5, 0xC0760743, - 0xC1560D1E, 0xC2E51369, - 0xC4ED18FF, 0xC7AC1ED7, - 0xCB2823B2, 0xCEFA28D9, /* 16 */ - 0xD2F62D3F, 0xD7BB3197, - 0xDCE53568, 0xE1FE3875, - 0xE7D13B35, 0xED663D35, - 0xF39B3EC4, 0xF98E3FA7, /* 24 */ - 0x00004000, 0x06723FA7, - 0x0C653EC4, 0x129A3D35, - 0x182F3B35, 0x1E023875, - 0x231B3568, 0x28453197, /* 32 */ - 0x2D0A2D3F, 0x310628D9, - 0x34D823B2, 0x38541ED7, - 0x3B1318FF, 0x3D1B1369, - 0x3EAA0D1E, 0x3F8A0743, /* 40 */ - 0x3FE300D5, 0x3F8DFA62, - 0x3F22F46C, 0x3D96EE2B, - 0x3B97E88E, 0x38D7E2B4, - 0x35C8DD9F, 0x325AD826, /* 48 */ - 0x2E03D358, 0x299ACF64, - 0x246DCB87, -}; - -const u16 b43legacy_ilt_finefreqa[B43legacy_ILT_FINEFREQA_SIZE] = { - 0x0082, 0x0082, 0x0102, 0x0182, /* 0 */ - 0x0202, 0x0282, 0x0302, 0x0382, - 0x0402, 0x0482, 0x0502, 0x0582, - 0x05E2, 0x0662, 0x06E2, 0x0762, - 0x07E2, 0x0842, 0x08C2, 0x0942, /* 16 */ - 0x09C2, 0x0A22, 0x0AA2, 0x0B02, - 0x0B82, 0x0BE2, 0x0C62, 0x0CC2, - 0x0D42, 0x0DA2, 0x0E02, 0x0E62, - 0x0EE2, 0x0F42, 0x0FA2, 0x1002, /* 32 */ - 0x1062, 0x10C2, 0x1122, 0x1182, - 0x11E2, 0x1242, 0x12A2, 0x12E2, - 0x1342, 0x13A2, 0x1402, 0x1442, - 0x14A2, 0x14E2, 0x1542, 0x1582, /* 48 */ - 0x15E2, 0x1622, 0x1662, 0x16C1, - 0x1701, 0x1741, 0x1781, 0x17E1, - 0x1821, 0x1861, 0x18A1, 0x18E1, - 0x1921, 0x1961, 0x19A1, 0x19E1, /* 64 */ - 0x1A21, 0x1A61, 0x1AA1, 0x1AC1, - 0x1B01, 0x1B41, 0x1B81, 0x1BA1, - 0x1BE1, 0x1C21, 0x1C41, 0x1C81, - 0x1CA1, 0x1CE1, 0x1D01, 0x1D41, /* 80 */ - 0x1D61, 0x1DA1, 0x1DC1, 0x1E01, - 0x1E21, 0x1E61, 0x1E81, 0x1EA1, - 0x1EE1, 0x1F01, 0x1F21, 0x1F41, - 0x1F81, 0x1FA1, 0x1FC1, 0x1FE1, /* 96 */ - 0x2001, 0x2041, 0x2061, 0x2081, - 0x20A1, 0x20C1, 0x20E1, 0x2101, - 0x2121, 0x2141, 0x2161, 0x2181, - 0x21A1, 0x21C1, 0x21E1, 0x2201, /* 112 */ - 0x2221, 0x2241, 0x2261, 0x2281, - 0x22A1, 0x22C1, 0x22C1, 0x22E1, - 0x2301, 0x2321, 0x2341, 0x2361, - 0x2361, 0x2381, 0x23A1, 0x23C1, /* 128 */ - 0x23E1, 0x23E1, 0x2401, 0x2421, - 0x2441, 0x2441, 0x2461, 0x2481, - 0x2481, 0x24A1, 0x24C1, 0x24C1, - 0x24E1, 0x2501, 0x2501, 0x2521, /* 144 */ - 0x2541, 0x2541, 0x2561, 0x2561, - 0x2581, 0x25A1, 0x25A1, 0x25C1, - 0x25C1, 0x25E1, 0x2601, 0x2601, - 0x2621, 0x2621, 0x2641, 0x2641, /* 160 */ - 0x2661, 0x2661, 0x2681, 0x2681, - 0x26A1, 0x26A1, 0x26C1, 0x26C1, - 0x26E1, 0x26E1, 0x2701, 0x2701, - 0x2721, 0x2721, 0x2740, 0x2740, /* 176 */ - 0x2760, 0x2760, 0x2780, 0x2780, - 0x2780, 0x27A0, 0x27A0, 0x27C0, - 0x27C0, 0x27E0, 0x27E0, 0x27E0, - 0x2800, 0x2800, 0x2820, 0x2820, /* 192 */ - 0x2820, 0x2840, 0x2840, 0x2840, - 0x2860, 0x2860, 0x2880, 0x2880, - 0x2880, 0x28A0, 0x28A0, 0x28A0, - 0x28C0, 0x28C0, 0x28C0, 0x28E0, /* 208 */ - 0x28E0, 0x28E0, 0x2900, 0x2900, - 0x2900, 0x2920, 0x2920, 0x2920, - 0x2940, 0x2940, 0x2940, 0x2960, - 0x2960, 0x2960, 0x2960, 0x2980, /* 224 */ - 0x2980, 0x2980, 0x29A0, 0x29A0, - 0x29A0, 0x29A0, 0x29C0, 0x29C0, - 0x29C0, 0x29E0, 0x29E0, 0x29E0, - 0x29E0, 0x2A00, 0x2A00, 0x2A00, /* 240 */ - 0x2A00, 0x2A20, 0x2A20, 0x2A20, - 0x2A20, 0x2A40, 0x2A40, 0x2A40, - 0x2A40, 0x2A60, 0x2A60, 0x2A60, -}; - -const u16 b43legacy_ilt_finefreqg[B43legacy_ILT_FINEFREQG_SIZE] = { - 0x0089, 0x02E9, 0x0409, 0x04E9, /* 0 */ - 0x05A9, 0x0669, 0x0709, 0x0789, - 0x0829, 0x08A9, 0x0929, 0x0989, - 0x0A09, 0x0A69, 0x0AC9, 0x0B29, - 0x0BA9, 0x0BE9, 0x0C49, 0x0CA9, /* 16 */ - 0x0D09, 0x0D69, 0x0DA9, 0x0E09, - 0x0E69, 0x0EA9, 0x0F09, 0x0F49, - 0x0FA9, 0x0FE9, 0x1029, 0x1089, - 0x10C9, 0x1109, 0x1169, 0x11A9, /* 32 */ - 0x11E9, 0x1229, 0x1289, 0x12C9, - 0x1309, 0x1349, 0x1389, 0x13C9, - 0x1409, 0x1449, 0x14A9, 0x14E9, - 0x1529, 0x1569, 0x15A9, 0x15E9, /* 48 */ - 0x1629, 0x1669, 0x16A9, 0x16E8, - 0x1728, 0x1768, 0x17A8, 0x17E8, - 0x1828, 0x1868, 0x18A8, 0x18E8, - 0x1928, 0x1968, 0x19A8, 0x19E8, /* 64 */ - 0x1A28, 0x1A68, 0x1AA8, 0x1AE8, - 0x1B28, 0x1B68, 0x1BA8, 0x1BE8, - 0x1C28, 0x1C68, 0x1CA8, 0x1CE8, - 0x1D28, 0x1D68, 0x1DC8, 0x1E08, /* 80 */ - 0x1E48, 0x1E88, 0x1EC8, 0x1F08, - 0x1F48, 0x1F88, 0x1FE8, 0x2028, - 0x2068, 0x20A8, 0x2108, 0x2148, - 0x2188, 0x21C8, 0x2228, 0x2268, /* 96 */ - 0x22C8, 0x2308, 0x2348, 0x23A8, - 0x23E8, 0x2448, 0x24A8, 0x24E8, - 0x2548, 0x25A8, 0x2608, 0x2668, - 0x26C8, 0x2728, 0x2787, 0x27E7, /* 112 */ - 0x2847, 0x28C7, 0x2947, 0x29A7, - 0x2A27, 0x2AC7, 0x2B47, 0x2BE7, - 0x2CA7, 0x2D67, 0x2E47, 0x2F67, - 0x3247, 0x3526, 0x3646, 0x3726, /* 128 */ - 0x3806, 0x38A6, 0x3946, 0x39E6, - 0x3A66, 0x3AE6, 0x3B66, 0x3BC6, - 0x3C45, 0x3CA5, 0x3D05, 0x3D85, - 0x3DE5, 0x3E45, 0x3EA5, 0x3EE5, /* 144 */ - 0x3F45, 0x3FA5, 0x4005, 0x4045, - 0x40A5, 0x40E5, 0x4145, 0x4185, - 0x41E5, 0x4225, 0x4265, 0x42C5, - 0x4305, 0x4345, 0x43A5, 0x43E5, /* 160 */ - 0x4424, 0x4464, 0x44C4, 0x4504, - 0x4544, 0x4584, 0x45C4, 0x4604, - 0x4644, 0x46A4, 0x46E4, 0x4724, - 0x4764, 0x47A4, 0x47E4, 0x4824, /* 176 */ - 0x4864, 0x48A4, 0x48E4, 0x4924, - 0x4964, 0x49A4, 0x49E4, 0x4A24, - 0x4A64, 0x4AA4, 0x4AE4, 0x4B23, - 0x4B63, 0x4BA3, 0x4BE3, 0x4C23, /* 192 */ - 0x4C63, 0x4CA3, 0x4CE3, 0x4D23, - 0x4D63, 0x4DA3, 0x4DE3, 0x4E23, - 0x4E63, 0x4EA3, 0x4EE3, 0x4F23, - 0x4F63, 0x4FC3, 0x5003, 0x5043, /* 208 */ - 0x5083, 0x50C3, 0x5103, 0x5143, - 0x5183, 0x51E2, 0x5222, 0x5262, - 0x52A2, 0x52E2, 0x5342, 0x5382, - 0x53C2, 0x5402, 0x5462, 0x54A2, /* 224 */ - 0x5502, 0x5542, 0x55A2, 0x55E2, - 0x5642, 0x5682, 0x56E2, 0x5722, - 0x5782, 0x57E1, 0x5841, 0x58A1, - 0x5901, 0x5961, 0x59C1, 0x5A21, /* 240 */ - 0x5AA1, 0x5B01, 0x5B81, 0x5BE1, - 0x5C61, 0x5D01, 0x5D80, 0x5E20, - 0x5EE0, 0x5FA0, 0x6080, 0x61C0, -}; - -const u16 b43legacy_ilt_noisea2[B43legacy_ILT_NOISEA2_SIZE] = { - 0x0001, 0x0001, 0x0001, 0xFFFE, - 0xFFFE, 0x3FFF, 0x1000, 0x0393, -}; - -const u16 b43legacy_ilt_noisea3[B43legacy_ILT_NOISEA3_SIZE] = { - 0x4C4C, 0x4C4C, 0x4C4C, 0x2D36, - 0x4C4C, 0x4C4C, 0x4C4C, 0x2D36, -}; - -const u16 b43legacy_ilt_noiseg1[B43legacy_ILT_NOISEG1_SIZE] = { - 0x013C, 0x01F5, 0x031A, 0x0631, - 0x0001, 0x0001, 0x0001, 0x0001, -}; - -const u16 b43legacy_ilt_noiseg2[B43legacy_ILT_NOISEG2_SIZE] = { - 0x5484, 0x3C40, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, -}; - -const u16 b43legacy_ilt_noisescaleg1[B43legacy_ILT_NOISESCALEG_SIZE] = { - 0x6C77, 0x5162, 0x3B40, 0x3335, /* 0 */ - 0x2F2D, 0x2A2A, 0x2527, 0x1F21, - 0x1A1D, 0x1719, 0x1616, 0x1414, - 0x1414, 0x1400, 0x1414, 0x1614, - 0x1716, 0x1A19, 0x1F1D, 0x2521, /* 16 */ - 0x2A27, 0x2F2A, 0x332D, 0x3B35, - 0x5140, 0x6C62, 0x0077, -}; - -const u16 b43legacy_ilt_noisescaleg2[B43legacy_ILT_NOISESCALEG_SIZE] = { - 0xD8DD, 0xCBD4, 0xBCC0, 0XB6B7, /* 0 */ - 0xB2B0, 0xADAD, 0xA7A9, 0x9FA1, - 0x969B, 0x9195, 0x8F8F, 0x8A8A, - 0x8A8A, 0x8A00, 0x8A8A, 0x8F8A, - 0x918F, 0x9695, 0x9F9B, 0xA7A1, /* 16 */ - 0xADA9, 0xB2AD, 0xB6B0, 0xBCB7, - 0xCBC0, 0xD8D4, 0x00DD, -}; - -const u16 b43legacy_ilt_noisescaleg3[B43legacy_ILT_NOISESCALEG_SIZE] = { - 0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4, /* 0 */ - 0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4, - 0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4, - 0xA4A4, 0xA400, 0xA4A4, 0xA4A4, - 0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4, /* 16 */ - 0xA4A4, 0xA4A4, 0xA4A4, 0xA4A4, - 0xA4A4, 0xA4A4, 0x00A4, -}; - -const u16 b43legacy_ilt_sigmasqr1[B43legacy_ILT_SIGMASQR_SIZE] = { - 0x007A, 0x0075, 0x0071, 0x006C, /* 0 */ - 0x0067, 0x0063, 0x005E, 0x0059, - 0x0054, 0x0050, 0x004B, 0x0046, - 0x0042, 0x003D, 0x003D, 0x003D, - 0x003D, 0x003D, 0x003D, 0x003D, /* 16 */ - 0x003D, 0x003D, 0x003D, 0x003D, - 0x003D, 0x003D, 0x0000, 0x003D, - 0x003D, 0x003D, 0x003D, 0x003D, - 0x003D, 0x003D, 0x003D, 0x003D, /* 32 */ - 0x003D, 0x003D, 0x003D, 0x003D, - 0x0042, 0x0046, 0x004B, 0x0050, - 0x0054, 0x0059, 0x005E, 0x0063, - 0x0067, 0x006C, 0x0071, 0x0075, /* 48 */ - 0x007A, -}; - -const u16 b43legacy_ilt_sigmasqr2[B43legacy_ILT_SIGMASQR_SIZE] = { - 0x00DE, 0x00DC, 0x00DA, 0x00D8, /* 0 */ - 0x00D6, 0x00D4, 0x00D2, 0x00CF, - 0x00CD, 0x00CA, 0x00C7, 0x00C4, - 0x00C1, 0x00BE, 0x00BE, 0x00BE, - 0x00BE, 0x00BE, 0x00BE, 0x00BE, /* 16 */ - 0x00BE, 0x00BE, 0x00BE, 0x00BE, - 0x00BE, 0x00BE, 0x0000, 0x00BE, - 0x00BE, 0x00BE, 0x00BE, 0x00BE, - 0x00BE, 0x00BE, 0x00BE, 0x00BE, /* 32 */ - 0x00BE, 0x00BE, 0x00BE, 0x00BE, - 0x00C1, 0x00C4, 0x00C7, 0x00CA, - 0x00CD, 0x00CF, 0x00D2, 0x00D4, - 0x00D6, 0x00D8, 0x00DA, 0x00DC, /* 48 */ - 0x00DE, -}; - -/**** Helper functions to access the device Internal Lookup Tables ****/ - -void b43legacy_ilt_write(struct b43legacy_wldev *dev, u16 offset, u16 val) -{ - b43legacy_phy_write(dev, B43legacy_PHY_ILT_G_CTRL, offset); - mmiowb(); - b43legacy_phy_write(dev, B43legacy_PHY_ILT_G_DATA1, val); -} - -void b43legacy_ilt_write32(struct b43legacy_wldev *dev, u16 offset, u32 val) -{ - b43legacy_phy_write(dev, B43legacy_PHY_ILT_G_CTRL, offset); - mmiowb(); - b43legacy_phy_write(dev, B43legacy_PHY_ILT_G_DATA2, - (val & 0xFFFF0000) >> 16); - b43legacy_phy_write(dev, B43legacy_PHY_ILT_G_DATA1, - val & 0x0000FFFF); -} - -u16 b43legacy_ilt_read(struct b43legacy_wldev *dev, u16 offset) -{ - b43legacy_phy_write(dev, B43legacy_PHY_ILT_G_CTRL, offset); - return b43legacy_phy_read(dev, B43legacy_PHY_ILT_G_DATA1); -} diff --git a/drivers/net/wireless/b43legacy/ilt.h b/drivers/net/wireless/b43legacy/ilt.h deleted file mode 100644 index 48bcf37eccb8..000000000000 --- a/drivers/net/wireless/b43legacy/ilt.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef B43legacy_ILT_H_ -#define B43legacy_ILT_H_ - -#define B43legacy_ILT_ROTOR_SIZE 53 -extern const u32 b43legacy_ilt_rotor[B43legacy_ILT_ROTOR_SIZE]; -#define B43legacy_ILT_RETARD_SIZE 53 -extern const u32 b43legacy_ilt_retard[B43legacy_ILT_RETARD_SIZE]; -#define B43legacy_ILT_FINEFREQA_SIZE 256 -extern const u16 b43legacy_ilt_finefreqa[B43legacy_ILT_FINEFREQA_SIZE]; -#define B43legacy_ILT_FINEFREQG_SIZE 256 -extern const u16 b43legacy_ilt_finefreqg[B43legacy_ILT_FINEFREQG_SIZE]; -#define B43legacy_ILT_NOISEA2_SIZE 8 -extern const u16 b43legacy_ilt_noisea2[B43legacy_ILT_NOISEA2_SIZE]; -#define B43legacy_ILT_NOISEA3_SIZE 8 -extern const u16 b43legacy_ilt_noisea3[B43legacy_ILT_NOISEA3_SIZE]; -#define B43legacy_ILT_NOISEG1_SIZE 8 -extern const u16 b43legacy_ilt_noiseg1[B43legacy_ILT_NOISEG1_SIZE]; -#define B43legacy_ILT_NOISEG2_SIZE 8 -extern const u16 b43legacy_ilt_noiseg2[B43legacy_ILT_NOISEG2_SIZE]; -#define B43legacy_ILT_NOISESCALEG_SIZE 27 -extern const u16 b43legacy_ilt_noisescaleg1[B43legacy_ILT_NOISESCALEG_SIZE]; -extern const u16 b43legacy_ilt_noisescaleg2[B43legacy_ILT_NOISESCALEG_SIZE]; -extern const u16 b43legacy_ilt_noisescaleg3[B43legacy_ILT_NOISESCALEG_SIZE]; -#define B43legacy_ILT_SIGMASQR_SIZE 53 -extern const u16 b43legacy_ilt_sigmasqr1[B43legacy_ILT_SIGMASQR_SIZE]; -extern const u16 b43legacy_ilt_sigmasqr2[B43legacy_ILT_SIGMASQR_SIZE]; - - -void b43legacy_ilt_write(struct b43legacy_wldev *dev, u16 offset, u16 val); -void b43legacy_ilt_write32(struct b43legacy_wldev *dev, u16 offset, - u32 val); -u16 b43legacy_ilt_read(struct b43legacy_wldev *dev, u16 offset); - -#endif /* B43legacy_ILT_H_ */ diff --git a/drivers/net/wireless/b43legacy/leds.c b/drivers/net/wireless/b43legacy/leds.c deleted file mode 100644 index fd4565389c77..000000000000 --- a/drivers/net/wireless/b43legacy/leds.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - - Broadcom B43 wireless driver - LED control - - Copyright (c) 2005 Martin Langer , - Copyright (c) 2005 Stefano Brivio - Copyright (c) 2005-2007 Michael Buesch - Copyright (c) 2005 Danny van Dyk - Copyright (c) 2005 Andreas Jaggi - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43legacy.h" -#include "leds.h" -#include "rfkill.h" - - -static void b43legacy_led_turn_on(struct b43legacy_wldev *dev, u8 led_index, - bool activelow) -{ - struct b43legacy_wl *wl = dev->wl; - unsigned long flags; - u16 ctl; - - spin_lock_irqsave(&wl->leds_lock, flags); - ctl = b43legacy_read16(dev, B43legacy_MMIO_GPIO_CONTROL); - if (activelow) - ctl &= ~(1 << led_index); - else - ctl |= (1 << led_index); - b43legacy_write16(dev, B43legacy_MMIO_GPIO_CONTROL, ctl); - spin_unlock_irqrestore(&wl->leds_lock, flags); -} - -static void b43legacy_led_turn_off(struct b43legacy_wldev *dev, u8 led_index, - bool activelow) -{ - struct b43legacy_wl *wl = dev->wl; - unsigned long flags; - u16 ctl; - - spin_lock_irqsave(&wl->leds_lock, flags); - ctl = b43legacy_read16(dev, B43legacy_MMIO_GPIO_CONTROL); - if (activelow) - ctl |= (1 << led_index); - else - ctl &= ~(1 << led_index); - b43legacy_write16(dev, B43legacy_MMIO_GPIO_CONTROL, ctl); - spin_unlock_irqrestore(&wl->leds_lock, flags); -} - -/* Callback from the LED subsystem. */ -static void b43legacy_led_brightness_set(struct led_classdev *led_dev, - enum led_brightness brightness) -{ - struct b43legacy_led *led = container_of(led_dev, struct b43legacy_led, - led_dev); - struct b43legacy_wldev *dev = led->dev; - bool radio_enabled; - - /* Checking the radio-enabled status here is slightly racy, - * but we want to avoid the locking overhead and we don't care - * whether the LED has the wrong state for a second. */ - radio_enabled = (dev->phy.radio_on && dev->radio_hw_enable); - - if (brightness == LED_OFF || !radio_enabled) - b43legacy_led_turn_off(dev, led->index, led->activelow); - else - b43legacy_led_turn_on(dev, led->index, led->activelow); -} - -static int b43legacy_register_led(struct b43legacy_wldev *dev, - struct b43legacy_led *led, - const char *name, - const char *default_trigger, - u8 led_index, bool activelow) -{ - int err; - - b43legacy_led_turn_off(dev, led_index, activelow); - if (led->dev) - return -EEXIST; - if (!default_trigger) - return -EINVAL; - led->dev = dev; - led->index = led_index; - led->activelow = activelow; - strncpy(led->name, name, sizeof(led->name)); - - led->led_dev.name = led->name; - led->led_dev.default_trigger = default_trigger; - led->led_dev.brightness_set = b43legacy_led_brightness_set; - - err = led_classdev_register(dev->dev->dev, &led->led_dev); - if (err) { - b43legacywarn(dev->wl, "LEDs: Failed to register %s\n", name); - led->dev = NULL; - return err; - } - return 0; -} - -static void b43legacy_unregister_led(struct b43legacy_led *led) -{ - if (!led->dev) - return; - led_classdev_unregister(&led->led_dev); - b43legacy_led_turn_off(led->dev, led->index, led->activelow); - led->dev = NULL; -} - -static void b43legacy_map_led(struct b43legacy_wldev *dev, - u8 led_index, - enum b43legacy_led_behaviour behaviour, - bool activelow) -{ - struct ieee80211_hw *hw = dev->wl->hw; - char name[B43legacy_LED_MAX_NAME_LEN + 1]; - - /* Map the b43 specific LED behaviour value to the - * generic LED triggers. */ - switch (behaviour) { - case B43legacy_LED_INACTIVE: - break; - case B43legacy_LED_OFF: - b43legacy_led_turn_off(dev, led_index, activelow); - break; - case B43legacy_LED_ON: - b43legacy_led_turn_on(dev, led_index, activelow); - break; - case B43legacy_LED_ACTIVITY: - case B43legacy_LED_TRANSFER: - case B43legacy_LED_APTRANSFER: - snprintf(name, sizeof(name), - "b43legacy-%s::tx", wiphy_name(hw->wiphy)); - b43legacy_register_led(dev, &dev->led_tx, name, - ieee80211_get_tx_led_name(hw), - led_index, activelow); - snprintf(name, sizeof(name), - "b43legacy-%s::rx", wiphy_name(hw->wiphy)); - b43legacy_register_led(dev, &dev->led_rx, name, - ieee80211_get_rx_led_name(hw), - led_index, activelow); - break; - case B43legacy_LED_RADIO_ALL: - case B43legacy_LED_RADIO_A: - case B43legacy_LED_RADIO_B: - case B43legacy_LED_MODE_BG: - snprintf(name, sizeof(name), - "b43legacy-%s::radio", wiphy_name(hw->wiphy)); - b43legacy_register_led(dev, &dev->led_radio, name, - ieee80211_get_radio_led_name(hw), - led_index, activelow); - /* Sync the RF-kill LED state with radio and switch states. */ - if (dev->phy.radio_on && b43legacy_is_hw_radio_enabled(dev)) - b43legacy_led_turn_on(dev, led_index, activelow); - break; - case B43legacy_LED_WEIRD: - case B43legacy_LED_ASSOC: - snprintf(name, sizeof(name), - "b43legacy-%s::assoc", wiphy_name(hw->wiphy)); - b43legacy_register_led(dev, &dev->led_assoc, name, - ieee80211_get_assoc_led_name(hw), - led_index, activelow); - break; - default: - b43legacywarn(dev->wl, "LEDs: Unknown behaviour 0x%02X\n", - behaviour); - break; - } -} - -void b43legacy_leds_init(struct b43legacy_wldev *dev) -{ - struct ssb_bus *bus = dev->dev->bus; - u8 sprom[4]; - int i; - enum b43legacy_led_behaviour behaviour; - bool activelow; - - sprom[0] = bus->sprom.gpio0; - sprom[1] = bus->sprom.gpio1; - sprom[2] = bus->sprom.gpio2; - sprom[3] = bus->sprom.gpio3; - - for (i = 0; i < 4; i++) { - if (sprom[i] == 0xFF) { - /* There is no LED information in the SPROM - * for this LED. Hardcode it here. */ - activelow = false; - switch (i) { - case 0: - behaviour = B43legacy_LED_ACTIVITY; - activelow = true; - if (bus->boardinfo.vendor == PCI_VENDOR_ID_COMPAQ) - behaviour = B43legacy_LED_RADIO_ALL; - break; - case 1: - behaviour = B43legacy_LED_RADIO_B; - if (bus->boardinfo.vendor == PCI_VENDOR_ID_ASUSTEK) - behaviour = B43legacy_LED_ASSOC; - break; - case 2: - behaviour = B43legacy_LED_RADIO_A; - break; - case 3: - behaviour = B43legacy_LED_OFF; - break; - default: - B43legacy_WARN_ON(1); - return; - } - } else { - behaviour = sprom[i] & B43legacy_LED_BEHAVIOUR; - activelow = !!(sprom[i] & B43legacy_LED_ACTIVELOW); - } - b43legacy_map_led(dev, i, behaviour, activelow); - } -} - -void b43legacy_leds_exit(struct b43legacy_wldev *dev) -{ - b43legacy_unregister_led(&dev->led_tx); - b43legacy_unregister_led(&dev->led_rx); - b43legacy_unregister_led(&dev->led_assoc); - b43legacy_unregister_led(&dev->led_radio); -} diff --git a/drivers/net/wireless/b43legacy/leds.h b/drivers/net/wireless/b43legacy/leds.h deleted file mode 100644 index 9ff6750dc57f..000000000000 --- a/drivers/net/wireless/b43legacy/leds.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef B43legacy_LEDS_H_ -#define B43legacy_LEDS_H_ - -struct b43legacy_wldev; - -#ifdef CONFIG_B43LEGACY_LEDS - -#include -#include - - -#define B43legacy_LED_MAX_NAME_LEN 31 - -struct b43legacy_led { - struct b43legacy_wldev *dev; - /* The LED class device */ - struct led_classdev led_dev; - /* The index number of the LED. */ - u8 index; - /* If activelow is true, the LED is ON if the - * bit is switched off. */ - bool activelow; - /* The unique name string for this LED device. */ - char name[B43legacy_LED_MAX_NAME_LEN + 1]; -}; - -#define B43legacy_LED_BEHAVIOUR 0x7F -#define B43legacy_LED_ACTIVELOW 0x80 -/* LED behaviour values */ -enum b43legacy_led_behaviour { - B43legacy_LED_OFF, - B43legacy_LED_ON, - B43legacy_LED_ACTIVITY, - B43legacy_LED_RADIO_ALL, - B43legacy_LED_RADIO_A, - B43legacy_LED_RADIO_B, - B43legacy_LED_MODE_BG, - B43legacy_LED_TRANSFER, - B43legacy_LED_APTRANSFER, - B43legacy_LED_WEIRD, - B43legacy_LED_ASSOC, - B43legacy_LED_INACTIVE, -}; - -void b43legacy_leds_init(struct b43legacy_wldev *dev); -void b43legacy_leds_exit(struct b43legacy_wldev *dev); - -#else /* CONFIG_B43LEGACY_LEDS */ -/* LED support disabled */ - -struct b43legacy_led { - /* empty */ -}; - -static inline void b43legacy_leds_init(struct b43legacy_wldev *dev) -{ -} -static inline void b43legacy_leds_exit(struct b43legacy_wldev *dev) -{ -} -#endif /* CONFIG_B43LEGACY_LEDS */ - -#endif /* B43legacy_LEDS_H_ */ diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c deleted file mode 100644 index 572668821862..000000000000 --- a/drivers/net/wireless/b43legacy/main.c +++ /dev/null @@ -1,4064 +0,0 @@ -/* - * - * Broadcom B43legacy wireless driver - * - * Copyright (c) 2005 Martin Langer - * Copyright (c) 2005-2008 Stefano Brivio - * Copyright (c) 2005, 2006 Michael Buesch - * Copyright (c) 2005 Danny van Dyk - * Copyright (c) 2005 Andreas Jaggi - * Copyright (c) 2007 Larry Finger - * - * Some parts of the code in this file are derived from the ipw2200 - * driver Copyright(c) 2003 - 2004 Intel Corporation. - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "b43legacy.h" -#include "main.h" -#include "debugfs.h" -#include "phy.h" -#include "dma.h" -#include "pio.h" -#include "sysfs.h" -#include "xmit.h" -#include "radio.h" - - -MODULE_DESCRIPTION("Broadcom B43legacy wireless driver"); -MODULE_AUTHOR("Martin Langer"); -MODULE_AUTHOR("Stefano Brivio"); -MODULE_AUTHOR("Michael Buesch"); -MODULE_LICENSE("GPL"); - -MODULE_FIRMWARE("b43legacy/ucode2.fw"); -MODULE_FIRMWARE("b43legacy/ucode4.fw"); - -#if defined(CONFIG_B43LEGACY_DMA) && defined(CONFIG_B43LEGACY_PIO) -static int modparam_pio; -module_param_named(pio, modparam_pio, int, 0444); -MODULE_PARM_DESC(pio, "enable(1) / disable(0) PIO mode"); -#elif defined(CONFIG_B43LEGACY_DMA) -# define modparam_pio 0 -#elif defined(CONFIG_B43LEGACY_PIO) -# define modparam_pio 1 -#endif - -static int modparam_bad_frames_preempt; -module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444); -MODULE_PARM_DESC(bad_frames_preempt, "enable(1) / disable(0) Bad Frames" - " Preemption"); - -static char modparam_fwpostfix[16]; -module_param_string(fwpostfix, modparam_fwpostfix, 16, 0444); -MODULE_PARM_DESC(fwpostfix, "Postfix for the firmware files to load."); - -/* The following table supports BCM4301, BCM4303 and BCM4306/2 devices. */ -static const struct ssb_device_id b43legacy_ssb_tbl[] = { - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 2), - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 4), - SSB_DEVTABLE_END -}; -MODULE_DEVICE_TABLE(ssb, b43legacy_ssb_tbl); - - -/* Channel and ratetables are shared for all devices. - * They can't be const, because ieee80211 puts some precalculated - * data in there. This data is the same for all devices, so we don't - * get concurrency issues */ -#define RATETAB_ENT(_rateid, _flags) \ - { \ - .bitrate = B43legacy_RATE_TO_100KBPS(_rateid), \ - .hw_value = (_rateid), \ - .flags = (_flags), \ - } -/* - * NOTE: When changing this, sync with xmit.c's - * b43legacy_plcp_get_bitrate_idx_* functions! - */ -static struct ieee80211_rate __b43legacy_ratetable[] = { - RATETAB_ENT(B43legacy_CCK_RATE_1MB, 0), - RATETAB_ENT(B43legacy_CCK_RATE_2MB, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(B43legacy_CCK_RATE_5MB, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(B43legacy_CCK_RATE_11MB, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(B43legacy_OFDM_RATE_6MB, 0), - RATETAB_ENT(B43legacy_OFDM_RATE_9MB, 0), - RATETAB_ENT(B43legacy_OFDM_RATE_12MB, 0), - RATETAB_ENT(B43legacy_OFDM_RATE_18MB, 0), - RATETAB_ENT(B43legacy_OFDM_RATE_24MB, 0), - RATETAB_ENT(B43legacy_OFDM_RATE_36MB, 0), - RATETAB_ENT(B43legacy_OFDM_RATE_48MB, 0), - RATETAB_ENT(B43legacy_OFDM_RATE_54MB, 0), -}; -#define b43legacy_b_ratetable (__b43legacy_ratetable + 0) -#define b43legacy_b_ratetable_size 4 -#define b43legacy_g_ratetable (__b43legacy_ratetable + 0) -#define b43legacy_g_ratetable_size 12 - -#define CHANTAB_ENT(_chanid, _freq) \ - { \ - .center_freq = (_freq), \ - .hw_value = (_chanid), \ - } -static struct ieee80211_channel b43legacy_bg_chantable[] = { - CHANTAB_ENT(1, 2412), - CHANTAB_ENT(2, 2417), - CHANTAB_ENT(3, 2422), - CHANTAB_ENT(4, 2427), - CHANTAB_ENT(5, 2432), - CHANTAB_ENT(6, 2437), - CHANTAB_ENT(7, 2442), - CHANTAB_ENT(8, 2447), - CHANTAB_ENT(9, 2452), - CHANTAB_ENT(10, 2457), - CHANTAB_ENT(11, 2462), - CHANTAB_ENT(12, 2467), - CHANTAB_ENT(13, 2472), - CHANTAB_ENT(14, 2484), -}; - -static struct ieee80211_supported_band b43legacy_band_2GHz_BPHY = { - .channels = b43legacy_bg_chantable, - .n_channels = ARRAY_SIZE(b43legacy_bg_chantable), - .bitrates = b43legacy_b_ratetable, - .n_bitrates = b43legacy_b_ratetable_size, -}; - -static struct ieee80211_supported_band b43legacy_band_2GHz_GPHY = { - .channels = b43legacy_bg_chantable, - .n_channels = ARRAY_SIZE(b43legacy_bg_chantable), - .bitrates = b43legacy_g_ratetable, - .n_bitrates = b43legacy_g_ratetable_size, -}; - -static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev); -static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev); -static void b43legacy_wireless_core_stop(struct b43legacy_wldev *dev); -static int b43legacy_wireless_core_start(struct b43legacy_wldev *dev); - - -static int b43legacy_ratelimit(struct b43legacy_wl *wl) -{ - if (!wl || !wl->current_dev) - return 1; - if (b43legacy_status(wl->current_dev) < B43legacy_STAT_STARTED) - return 1; - /* We are up and running. - * Ratelimit the messages to avoid DoS over the net. */ - return net_ratelimit(); -} - -void b43legacyinfo(struct b43legacy_wl *wl, const char *fmt, ...) -{ - struct va_format vaf; - va_list args; - - if (!b43legacy_ratelimit(wl)) - return; - - va_start(args, fmt); - - vaf.fmt = fmt; - vaf.va = &args; - - printk(KERN_INFO "b43legacy-%s: %pV", - (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf); - - va_end(args); -} - -void b43legacyerr(struct b43legacy_wl *wl, const char *fmt, ...) -{ - struct va_format vaf; - va_list args; - - if (!b43legacy_ratelimit(wl)) - return; - - va_start(args, fmt); - - vaf.fmt = fmt; - vaf.va = &args; - - printk(KERN_ERR "b43legacy-%s ERROR: %pV", - (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf); - - va_end(args); -} - -void b43legacywarn(struct b43legacy_wl *wl, const char *fmt, ...) -{ - struct va_format vaf; - va_list args; - - if (!b43legacy_ratelimit(wl)) - return; - - va_start(args, fmt); - - vaf.fmt = fmt; - vaf.va = &args; - - printk(KERN_WARNING "b43legacy-%s warning: %pV", - (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf); - - va_end(args); -} - -#if B43legacy_DEBUG -void b43legacydbg(struct b43legacy_wl *wl, const char *fmt, ...) -{ - struct va_format vaf; - va_list args; - - va_start(args, fmt); - - vaf.fmt = fmt; - vaf.va = &args; - - printk(KERN_DEBUG "b43legacy-%s debug: %pV", - (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf); - - va_end(args); -} -#endif /* DEBUG */ - -static void b43legacy_ram_write(struct b43legacy_wldev *dev, u16 offset, - u32 val) -{ - u32 status; - - B43legacy_WARN_ON(offset % 4 != 0); - - status = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - if (status & B43legacy_MACCTL_BE) - val = swab32(val); - - b43legacy_write32(dev, B43legacy_MMIO_RAM_CONTROL, offset); - mmiowb(); - b43legacy_write32(dev, B43legacy_MMIO_RAM_DATA, val); -} - -static inline -void b43legacy_shm_control_word(struct b43legacy_wldev *dev, - u16 routing, u16 offset) -{ - u32 control; - - /* "offset" is the WORD offset. */ - - control = routing; - control <<= 16; - control |= offset; - b43legacy_write32(dev, B43legacy_MMIO_SHM_CONTROL, control); -} - -u32 b43legacy_shm_read32(struct b43legacy_wldev *dev, - u16 routing, u16 offset) -{ - u32 ret; - - if (routing == B43legacy_SHM_SHARED) { - B43legacy_WARN_ON((offset & 0x0001) != 0); - if (offset & 0x0003) { - /* Unaligned access */ - b43legacy_shm_control_word(dev, routing, offset >> 2); - ret = b43legacy_read16(dev, - B43legacy_MMIO_SHM_DATA_UNALIGNED); - ret <<= 16; - b43legacy_shm_control_word(dev, routing, - (offset >> 2) + 1); - ret |= b43legacy_read16(dev, B43legacy_MMIO_SHM_DATA); - - return ret; - } - offset >>= 2; - } - b43legacy_shm_control_word(dev, routing, offset); - ret = b43legacy_read32(dev, B43legacy_MMIO_SHM_DATA); - - return ret; -} - -u16 b43legacy_shm_read16(struct b43legacy_wldev *dev, - u16 routing, u16 offset) -{ - u16 ret; - - if (routing == B43legacy_SHM_SHARED) { - B43legacy_WARN_ON((offset & 0x0001) != 0); - if (offset & 0x0003) { - /* Unaligned access */ - b43legacy_shm_control_word(dev, routing, offset >> 2); - ret = b43legacy_read16(dev, - B43legacy_MMIO_SHM_DATA_UNALIGNED); - - return ret; - } - offset >>= 2; - } - b43legacy_shm_control_word(dev, routing, offset); - ret = b43legacy_read16(dev, B43legacy_MMIO_SHM_DATA); - - return ret; -} - -void b43legacy_shm_write32(struct b43legacy_wldev *dev, - u16 routing, u16 offset, - u32 value) -{ - if (routing == B43legacy_SHM_SHARED) { - B43legacy_WARN_ON((offset & 0x0001) != 0); - if (offset & 0x0003) { - /* Unaligned access */ - b43legacy_shm_control_word(dev, routing, offset >> 2); - mmiowb(); - b43legacy_write16(dev, - B43legacy_MMIO_SHM_DATA_UNALIGNED, - (value >> 16) & 0xffff); - mmiowb(); - b43legacy_shm_control_word(dev, routing, - (offset >> 2) + 1); - mmiowb(); - b43legacy_write16(dev, B43legacy_MMIO_SHM_DATA, - value & 0xffff); - return; - } - offset >>= 2; - } - b43legacy_shm_control_word(dev, routing, offset); - mmiowb(); - b43legacy_write32(dev, B43legacy_MMIO_SHM_DATA, value); -} - -void b43legacy_shm_write16(struct b43legacy_wldev *dev, u16 routing, u16 offset, - u16 value) -{ - if (routing == B43legacy_SHM_SHARED) { - B43legacy_WARN_ON((offset & 0x0001) != 0); - if (offset & 0x0003) { - /* Unaligned access */ - b43legacy_shm_control_word(dev, routing, offset >> 2); - mmiowb(); - b43legacy_write16(dev, - B43legacy_MMIO_SHM_DATA_UNALIGNED, - value); - return; - } - offset >>= 2; - } - b43legacy_shm_control_word(dev, routing, offset); - mmiowb(); - b43legacy_write16(dev, B43legacy_MMIO_SHM_DATA, value); -} - -/* Read HostFlags */ -u32 b43legacy_hf_read(struct b43legacy_wldev *dev) -{ - u32 ret; - - ret = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_HOSTFHI); - ret <<= 16; - ret |= b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_HOSTFLO); - - return ret; -} - -/* Write HostFlags */ -void b43legacy_hf_write(struct b43legacy_wldev *dev, u32 value) -{ - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_HOSTFLO, - (value & 0x0000FFFF)); - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_HOSTFHI, - ((value & 0xFFFF0000) >> 16)); -} - -void b43legacy_tsf_read(struct b43legacy_wldev *dev, u64 *tsf) -{ - /* We need to be careful. As we read the TSF from multiple - * registers, we should take care of register overflows. - * In theory, the whole tsf read process should be atomic. - * We try to be atomic here, by restaring the read process, - * if any of the high registers changed (overflew). - */ - if (dev->dev->id.revision >= 3) { - u32 low; - u32 high; - u32 high2; - - do { - high = b43legacy_read32(dev, - B43legacy_MMIO_REV3PLUS_TSF_HIGH); - low = b43legacy_read32(dev, - B43legacy_MMIO_REV3PLUS_TSF_LOW); - high2 = b43legacy_read32(dev, - B43legacy_MMIO_REV3PLUS_TSF_HIGH); - } while (unlikely(high != high2)); - - *tsf = high; - *tsf <<= 32; - *tsf |= low; - } else { - u64 tmp; - u16 v0; - u16 v1; - u16 v2; - u16 v3; - u16 test1; - u16 test2; - u16 test3; - - do { - v3 = b43legacy_read16(dev, B43legacy_MMIO_TSF_3); - v2 = b43legacy_read16(dev, B43legacy_MMIO_TSF_2); - v1 = b43legacy_read16(dev, B43legacy_MMIO_TSF_1); - v0 = b43legacy_read16(dev, B43legacy_MMIO_TSF_0); - - test3 = b43legacy_read16(dev, B43legacy_MMIO_TSF_3); - test2 = b43legacy_read16(dev, B43legacy_MMIO_TSF_2); - test1 = b43legacy_read16(dev, B43legacy_MMIO_TSF_1); - } while (v3 != test3 || v2 != test2 || v1 != test1); - - *tsf = v3; - *tsf <<= 48; - tmp = v2; - tmp <<= 32; - *tsf |= tmp; - tmp = v1; - tmp <<= 16; - *tsf |= tmp; - *tsf |= v0; - } -} - -static void b43legacy_time_lock(struct b43legacy_wldev *dev) -{ - u32 status; - - status = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - status |= B43legacy_MACCTL_TBTTHOLD; - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, status); - mmiowb(); -} - -static void b43legacy_time_unlock(struct b43legacy_wldev *dev) -{ - u32 status; - - status = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - status &= ~B43legacy_MACCTL_TBTTHOLD; - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, status); -} - -static void b43legacy_tsf_write_locked(struct b43legacy_wldev *dev, u64 tsf) -{ - /* Be careful with the in-progress timer. - * First zero out the low register, so we have a full - * register-overflow duration to complete the operation. - */ - if (dev->dev->id.revision >= 3) { - u32 lo = (tsf & 0x00000000FFFFFFFFULL); - u32 hi = (tsf & 0xFFFFFFFF00000000ULL) >> 32; - - b43legacy_write32(dev, B43legacy_MMIO_REV3PLUS_TSF_LOW, 0); - mmiowb(); - b43legacy_write32(dev, B43legacy_MMIO_REV3PLUS_TSF_HIGH, - hi); - mmiowb(); - b43legacy_write32(dev, B43legacy_MMIO_REV3PLUS_TSF_LOW, - lo); - } else { - u16 v0 = (tsf & 0x000000000000FFFFULL); - u16 v1 = (tsf & 0x00000000FFFF0000ULL) >> 16; - u16 v2 = (tsf & 0x0000FFFF00000000ULL) >> 32; - u16 v3 = (tsf & 0xFFFF000000000000ULL) >> 48; - - b43legacy_write16(dev, B43legacy_MMIO_TSF_0, 0); - mmiowb(); - b43legacy_write16(dev, B43legacy_MMIO_TSF_3, v3); - mmiowb(); - b43legacy_write16(dev, B43legacy_MMIO_TSF_2, v2); - mmiowb(); - b43legacy_write16(dev, B43legacy_MMIO_TSF_1, v1); - mmiowb(); - b43legacy_write16(dev, B43legacy_MMIO_TSF_0, v0); - } -} - -void b43legacy_tsf_write(struct b43legacy_wldev *dev, u64 tsf) -{ - b43legacy_time_lock(dev); - b43legacy_tsf_write_locked(dev, tsf); - b43legacy_time_unlock(dev); -} - -static -void b43legacy_macfilter_set(struct b43legacy_wldev *dev, - u16 offset, const u8 *mac) -{ - static const u8 zero_addr[ETH_ALEN] = { 0 }; - u16 data; - - if (!mac) - mac = zero_addr; - - offset |= 0x0020; - b43legacy_write16(dev, B43legacy_MMIO_MACFILTER_CONTROL, offset); - - data = mac[0]; - data |= mac[1] << 8; - b43legacy_write16(dev, B43legacy_MMIO_MACFILTER_DATA, data); - data = mac[2]; - data |= mac[3] << 8; - b43legacy_write16(dev, B43legacy_MMIO_MACFILTER_DATA, data); - data = mac[4]; - data |= mac[5] << 8; - b43legacy_write16(dev, B43legacy_MMIO_MACFILTER_DATA, data); -} - -static void b43legacy_write_mac_bssid_templates(struct b43legacy_wldev *dev) -{ - static const u8 zero_addr[ETH_ALEN] = { 0 }; - const u8 *mac = dev->wl->mac_addr; - const u8 *bssid = dev->wl->bssid; - u8 mac_bssid[ETH_ALEN * 2]; - int i; - u32 tmp; - - if (!bssid) - bssid = zero_addr; - if (!mac) - mac = zero_addr; - - b43legacy_macfilter_set(dev, B43legacy_MACFILTER_BSSID, bssid); - - memcpy(mac_bssid, mac, ETH_ALEN); - memcpy(mac_bssid + ETH_ALEN, bssid, ETH_ALEN); - - /* Write our MAC address and BSSID to template ram */ - for (i = 0; i < ARRAY_SIZE(mac_bssid); i += sizeof(u32)) { - tmp = (u32)(mac_bssid[i + 0]); - tmp |= (u32)(mac_bssid[i + 1]) << 8; - tmp |= (u32)(mac_bssid[i + 2]) << 16; - tmp |= (u32)(mac_bssid[i + 3]) << 24; - b43legacy_ram_write(dev, 0x20 + i, tmp); - b43legacy_ram_write(dev, 0x78 + i, tmp); - b43legacy_ram_write(dev, 0x478 + i, tmp); - } -} - -static void b43legacy_upload_card_macaddress(struct b43legacy_wldev *dev) -{ - b43legacy_write_mac_bssid_templates(dev); - b43legacy_macfilter_set(dev, B43legacy_MACFILTER_SELF, - dev->wl->mac_addr); -} - -static void b43legacy_set_slot_time(struct b43legacy_wldev *dev, - u16 slot_time) -{ - /* slot_time is in usec. */ - if (dev->phy.type != B43legacy_PHYTYPE_G) - return; - b43legacy_write16(dev, 0x684, 510 + slot_time); - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x0010, - slot_time); -} - -static void b43legacy_short_slot_timing_enable(struct b43legacy_wldev *dev) -{ - b43legacy_set_slot_time(dev, 9); -} - -static void b43legacy_short_slot_timing_disable(struct b43legacy_wldev *dev) -{ - b43legacy_set_slot_time(dev, 20); -} - -/* Synchronize IRQ top- and bottom-half. - * IRQs must be masked before calling this. - * This must not be called with the irq_lock held. - */ -static void b43legacy_synchronize_irq(struct b43legacy_wldev *dev) -{ - synchronize_irq(dev->dev->irq); - tasklet_kill(&dev->isr_tasklet); -} - -/* DummyTransmission function, as documented on - * http://bcm-specs.sipsolutions.net/DummyTransmission - */ -void b43legacy_dummy_transmission(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - unsigned int i; - unsigned int max_loop; - u16 value; - u32 buffer[5] = { - 0x00000000, - 0x00D40000, - 0x00000000, - 0x01000000, - 0x00000000, - }; - - switch (phy->type) { - case B43legacy_PHYTYPE_B: - case B43legacy_PHYTYPE_G: - max_loop = 0xFA; - buffer[0] = 0x000B846E; - break; - default: - B43legacy_BUG_ON(1); - return; - } - - for (i = 0; i < 5; i++) - b43legacy_ram_write(dev, i * 4, buffer[i]); - - /* dummy read follows */ - b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - - b43legacy_write16(dev, 0x0568, 0x0000); - b43legacy_write16(dev, 0x07C0, 0x0000); - b43legacy_write16(dev, 0x050C, 0x0000); - b43legacy_write16(dev, 0x0508, 0x0000); - b43legacy_write16(dev, 0x050A, 0x0000); - b43legacy_write16(dev, 0x054C, 0x0000); - b43legacy_write16(dev, 0x056A, 0x0014); - b43legacy_write16(dev, 0x0568, 0x0826); - b43legacy_write16(dev, 0x0500, 0x0000); - b43legacy_write16(dev, 0x0502, 0x0030); - - if (phy->radio_ver == 0x2050 && phy->radio_rev <= 0x5) - b43legacy_radio_write16(dev, 0x0051, 0x0017); - for (i = 0x00; i < max_loop; i++) { - value = b43legacy_read16(dev, 0x050E); - if (value & 0x0080) - break; - udelay(10); - } - for (i = 0x00; i < 0x0A; i++) { - value = b43legacy_read16(dev, 0x050E); - if (value & 0x0400) - break; - udelay(10); - } - for (i = 0x00; i < 0x0A; i++) { - value = b43legacy_read16(dev, 0x0690); - if (!(value & 0x0100)) - break; - udelay(10); - } - if (phy->radio_ver == 0x2050 && phy->radio_rev <= 0x5) - b43legacy_radio_write16(dev, 0x0051, 0x0037); -} - -/* Turn the Analog ON/OFF */ -static void b43legacy_switch_analog(struct b43legacy_wldev *dev, int on) -{ - b43legacy_write16(dev, B43legacy_MMIO_PHY0, on ? 0 : 0xF4); -} - -void b43legacy_wireless_core_reset(struct b43legacy_wldev *dev, u32 flags) -{ - u32 tmslow; - u32 macctl; - - flags |= B43legacy_TMSLOW_PHYCLKEN; - flags |= B43legacy_TMSLOW_PHYRESET; - ssb_device_enable(dev->dev, flags); - msleep(2); /* Wait for the PLL to turn on. */ - - /* Now take the PHY out of Reset again */ - tmslow = ssb_read32(dev->dev, SSB_TMSLOW); - tmslow |= SSB_TMSLOW_FGC; - tmslow &= ~B43legacy_TMSLOW_PHYRESET; - ssb_write32(dev->dev, SSB_TMSLOW, tmslow); - ssb_read32(dev->dev, SSB_TMSLOW); /* flush */ - msleep(1); - tmslow &= ~SSB_TMSLOW_FGC; - ssb_write32(dev->dev, SSB_TMSLOW, tmslow); - ssb_read32(dev->dev, SSB_TMSLOW); /* flush */ - msleep(1); - - /* Turn Analog ON */ - b43legacy_switch_analog(dev, 1); - - macctl = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - macctl &= ~B43legacy_MACCTL_GMODE; - if (flags & B43legacy_TMSLOW_GMODE) { - macctl |= B43legacy_MACCTL_GMODE; - dev->phy.gmode = true; - } else - dev->phy.gmode = false; - macctl |= B43legacy_MACCTL_IHR_ENABLED; - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl); -} - -static void handle_irq_transmit_status(struct b43legacy_wldev *dev) -{ - u32 v0; - u32 v1; - u16 tmp; - struct b43legacy_txstatus stat; - - while (1) { - v0 = b43legacy_read32(dev, B43legacy_MMIO_XMITSTAT_0); - if (!(v0 & 0x00000001)) - break; - v1 = b43legacy_read32(dev, B43legacy_MMIO_XMITSTAT_1); - - stat.cookie = (v0 >> 16); - stat.seq = (v1 & 0x0000FFFF); - stat.phy_stat = ((v1 & 0x00FF0000) >> 16); - tmp = (v0 & 0x0000FFFF); - stat.frame_count = ((tmp & 0xF000) >> 12); - stat.rts_count = ((tmp & 0x0F00) >> 8); - stat.supp_reason = ((tmp & 0x001C) >> 2); - stat.pm_indicated = !!(tmp & 0x0080); - stat.intermediate = !!(tmp & 0x0040); - stat.for_ampdu = !!(tmp & 0x0020); - stat.acked = !!(tmp & 0x0002); - - b43legacy_handle_txstatus(dev, &stat); - } -} - -static void drain_txstatus_queue(struct b43legacy_wldev *dev) -{ - u32 dummy; - - if (dev->dev->id.revision < 5) - return; - /* Read all entries from the microcode TXstatus FIFO - * and throw them away. - */ - while (1) { - dummy = b43legacy_read32(dev, B43legacy_MMIO_XMITSTAT_0); - if (!(dummy & 0x00000001)) - break; - dummy = b43legacy_read32(dev, B43legacy_MMIO_XMITSTAT_1); - } -} - -static u32 b43legacy_jssi_read(struct b43legacy_wldev *dev) -{ - u32 val = 0; - - val = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, 0x40A); - val <<= 16; - val |= b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, 0x408); - - return val; -} - -static void b43legacy_jssi_write(struct b43legacy_wldev *dev, u32 jssi) -{ - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x408, - (jssi & 0x0000FFFF)); - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x40A, - (jssi & 0xFFFF0000) >> 16); -} - -static void b43legacy_generate_noise_sample(struct b43legacy_wldev *dev) -{ - b43legacy_jssi_write(dev, 0x7F7F7F7F); - b43legacy_write32(dev, B43legacy_MMIO_MACCMD, - b43legacy_read32(dev, B43legacy_MMIO_MACCMD) - | B43legacy_MACCMD_BGNOISE); - B43legacy_WARN_ON(dev->noisecalc.channel_at_start != - dev->phy.channel); -} - -static void b43legacy_calculate_link_quality(struct b43legacy_wldev *dev) -{ - /* Top half of Link Quality calculation. */ - - if (dev->noisecalc.calculation_running) - return; - dev->noisecalc.channel_at_start = dev->phy.channel; - dev->noisecalc.calculation_running = true; - dev->noisecalc.nr_samples = 0; - - b43legacy_generate_noise_sample(dev); -} - -static void handle_irq_noise(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 tmp; - u8 noise[4]; - u8 i; - u8 j; - s32 average; - - /* Bottom half of Link Quality calculation. */ - - B43legacy_WARN_ON(!dev->noisecalc.calculation_running); - if (dev->noisecalc.channel_at_start != phy->channel) - goto drop_calculation; - *((__le32 *)noise) = cpu_to_le32(b43legacy_jssi_read(dev)); - if (noise[0] == 0x7F || noise[1] == 0x7F || - noise[2] == 0x7F || noise[3] == 0x7F) - goto generate_new; - - /* Get the noise samples. */ - B43legacy_WARN_ON(dev->noisecalc.nr_samples >= 8); - i = dev->noisecalc.nr_samples; - noise[0] = clamp_val(noise[0], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); - noise[1] = clamp_val(noise[1], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); - noise[2] = clamp_val(noise[2], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); - noise[3] = clamp_val(noise[3], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); - dev->noisecalc.samples[i][0] = phy->nrssi_lt[noise[0]]; - dev->noisecalc.samples[i][1] = phy->nrssi_lt[noise[1]]; - dev->noisecalc.samples[i][2] = phy->nrssi_lt[noise[2]]; - dev->noisecalc.samples[i][3] = phy->nrssi_lt[noise[3]]; - dev->noisecalc.nr_samples++; - if (dev->noisecalc.nr_samples == 8) { - /* Calculate the Link Quality by the noise samples. */ - average = 0; - for (i = 0; i < 8; i++) { - for (j = 0; j < 4; j++) - average += dev->noisecalc.samples[i][j]; - } - average /= (8 * 4); - average *= 125; - average += 64; - average /= 128; - tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - 0x40C); - tmp = (tmp / 128) & 0x1F; - if (tmp >= 8) - average += 2; - else - average -= 25; - if (tmp == 8) - average -= 72; - else - average -= 48; - - dev->stats.link_noise = average; -drop_calculation: - dev->noisecalc.calculation_running = false; - return; - } -generate_new: - b43legacy_generate_noise_sample(dev); -} - -static void handle_irq_tbtt_indication(struct b43legacy_wldev *dev) -{ - if (b43legacy_is_mode(dev->wl, NL80211_IFTYPE_AP)) { - /* TODO: PS TBTT */ - } else { - if (1/*FIXME: the last PSpoll frame was sent successfully */) - b43legacy_power_saving_ctl_bits(dev, -1, -1); - } - if (b43legacy_is_mode(dev->wl, NL80211_IFTYPE_ADHOC)) - dev->dfq_valid = true; -} - -static void handle_irq_atim_end(struct b43legacy_wldev *dev) -{ - if (dev->dfq_valid) { - b43legacy_write32(dev, B43legacy_MMIO_MACCMD, - b43legacy_read32(dev, B43legacy_MMIO_MACCMD) - | B43legacy_MACCMD_DFQ_VALID); - dev->dfq_valid = false; - } -} - -static void handle_irq_pmq(struct b43legacy_wldev *dev) -{ - u32 tmp; - - /* TODO: AP mode. */ - - while (1) { - tmp = b43legacy_read32(dev, B43legacy_MMIO_PS_STATUS); - if (!(tmp & 0x00000008)) - break; - } - /* 16bit write is odd, but correct. */ - b43legacy_write16(dev, B43legacy_MMIO_PS_STATUS, 0x0002); -} - -static void b43legacy_write_template_common(struct b43legacy_wldev *dev, - const u8 *data, u16 size, - u16 ram_offset, - u16 shm_size_offset, u8 rate) -{ - u32 i; - u32 tmp; - struct b43legacy_plcp_hdr4 plcp; - - plcp.data = 0; - b43legacy_generate_plcp_hdr(&plcp, size + FCS_LEN, rate); - b43legacy_ram_write(dev, ram_offset, le32_to_cpu(plcp.data)); - ram_offset += sizeof(u32); - /* The PLCP is 6 bytes long, but we only wrote 4 bytes, yet. - * So leave the first two bytes of the next write blank. - */ - tmp = (u32)(data[0]) << 16; - tmp |= (u32)(data[1]) << 24; - b43legacy_ram_write(dev, ram_offset, tmp); - ram_offset += sizeof(u32); - for (i = 2; i < size; i += sizeof(u32)) { - tmp = (u32)(data[i + 0]); - if (i + 1 < size) - tmp |= (u32)(data[i + 1]) << 8; - if (i + 2 < size) - tmp |= (u32)(data[i + 2]) << 16; - if (i + 3 < size) - tmp |= (u32)(data[i + 3]) << 24; - b43legacy_ram_write(dev, ram_offset + i - 2, tmp); - } - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, shm_size_offset, - size + sizeof(struct b43legacy_plcp_hdr6)); -} - -/* Convert a b43legacy antenna number value to the PHY TX control value. */ -static u16 b43legacy_antenna_to_phyctl(int antenna) -{ - switch (antenna) { - case B43legacy_ANTENNA0: - return B43legacy_TX4_PHY_ANT0; - case B43legacy_ANTENNA1: - return B43legacy_TX4_PHY_ANT1; - } - return B43legacy_TX4_PHY_ANTLAST; -} - -static void b43legacy_write_beacon_template(struct b43legacy_wldev *dev, - u16 ram_offset, - u16 shm_size_offset) -{ - - unsigned int i, len, variable_len; - const struct ieee80211_mgmt *bcn; - const u8 *ie; - bool tim_found = false; - unsigned int rate; - u16 ctl; - int antenna; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(dev->wl->current_beacon); - - bcn = (const struct ieee80211_mgmt *)(dev->wl->current_beacon->data); - len = min((size_t)dev->wl->current_beacon->len, - 0x200 - sizeof(struct b43legacy_plcp_hdr6)); - rate = ieee80211_get_tx_rate(dev->wl->hw, info)->hw_value; - - b43legacy_write_template_common(dev, (const u8 *)bcn, len, ram_offset, - shm_size_offset, rate); - - /* Write the PHY TX control parameters. */ - antenna = B43legacy_ANTENNA_DEFAULT; - antenna = b43legacy_antenna_to_phyctl(antenna); - ctl = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_BEACPHYCTL); - /* We can't send beacons with short preamble. Would get PHY errors. */ - ctl &= ~B43legacy_TX4_PHY_SHORTPRMBL; - ctl &= ~B43legacy_TX4_PHY_ANT; - ctl &= ~B43legacy_TX4_PHY_ENC; - ctl |= antenna; - ctl |= B43legacy_TX4_PHY_ENC_CCK; - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_BEACPHYCTL, ctl); - - /* Find the position of the TIM and the DTIM_period value - * and write them to SHM. */ - ie = bcn->u.beacon.variable; - variable_len = len - offsetof(struct ieee80211_mgmt, u.beacon.variable); - for (i = 0; i < variable_len - 2; ) { - uint8_t ie_id, ie_len; - - ie_id = ie[i]; - ie_len = ie[i + 1]; - if (ie_id == 5) { - u16 tim_position; - u16 dtim_period; - /* This is the TIM Information Element */ - - /* Check whether the ie_len is in the beacon data range. */ - if (variable_len < ie_len + 2 + i) - break; - /* A valid TIM is at least 4 bytes long. */ - if (ie_len < 4) - break; - tim_found = true; - - tim_position = sizeof(struct b43legacy_plcp_hdr6); - tim_position += offsetof(struct ieee80211_mgmt, - u.beacon.variable); - tim_position += i; - - dtim_period = ie[i + 3]; - - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_TIMPOS, tim_position); - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_DTIMP, dtim_period); - break; - } - i += ie_len + 2; - } - if (!tim_found) { - b43legacywarn(dev->wl, "Did not find a valid TIM IE in the " - "beacon template packet. AP or IBSS operation " - "may be broken.\n"); - } else - b43legacydbg(dev->wl, "Updated beacon template\n"); -} - -static void b43legacy_write_probe_resp_plcp(struct b43legacy_wldev *dev, - u16 shm_offset, u16 size, - struct ieee80211_rate *rate) -{ - struct b43legacy_plcp_hdr4 plcp; - u32 tmp; - __le16 dur; - - plcp.data = 0; - b43legacy_generate_plcp_hdr(&plcp, size + FCS_LEN, rate->hw_value); - dur = ieee80211_generic_frame_duration(dev->wl->hw, - dev->wl->vif, - IEEE80211_BAND_2GHZ, - size, - rate); - /* Write PLCP in two parts and timing for packet transfer */ - tmp = le32_to_cpu(plcp.data); - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, shm_offset, - tmp & 0xFFFF); - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, shm_offset + 2, - tmp >> 16); - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, shm_offset + 6, - le16_to_cpu(dur)); -} - -/* Instead of using custom probe response template, this function - * just patches custom beacon template by: - * 1) Changing packet type - * 2) Patching duration field - * 3) Stripping TIM - */ -static const u8 *b43legacy_generate_probe_resp(struct b43legacy_wldev *dev, - u16 *dest_size, - struct ieee80211_rate *rate) -{ - const u8 *src_data; - u8 *dest_data; - u16 src_size, elem_size, src_pos, dest_pos; - __le16 dur; - struct ieee80211_hdr *hdr; - size_t ie_start; - - src_size = dev->wl->current_beacon->len; - src_data = (const u8 *)dev->wl->current_beacon->data; - - /* Get the start offset of the variable IEs in the packet. */ - ie_start = offsetof(struct ieee80211_mgmt, u.probe_resp.variable); - B43legacy_WARN_ON(ie_start != offsetof(struct ieee80211_mgmt, - u.beacon.variable)); - - if (B43legacy_WARN_ON(src_size < ie_start)) - return NULL; - - dest_data = kmalloc(src_size, GFP_ATOMIC); - if (unlikely(!dest_data)) - return NULL; - - /* Copy the static data and all Information Elements, except the TIM. */ - memcpy(dest_data, src_data, ie_start); - src_pos = ie_start; - dest_pos = ie_start; - for ( ; src_pos < src_size - 2; src_pos += elem_size) { - elem_size = src_data[src_pos + 1] + 2; - if (src_data[src_pos] == 5) { - /* This is the TIM. */ - continue; - } - memcpy(dest_data + dest_pos, src_data + src_pos, elem_size); - dest_pos += elem_size; - } - *dest_size = dest_pos; - hdr = (struct ieee80211_hdr *)dest_data; - - /* Set the frame control. */ - hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_PROBE_RESP); - dur = ieee80211_generic_frame_duration(dev->wl->hw, - dev->wl->vif, - IEEE80211_BAND_2GHZ, - *dest_size, - rate); - hdr->duration_id = dur; - - return dest_data; -} - -static void b43legacy_write_probe_resp_template(struct b43legacy_wldev *dev, - u16 ram_offset, - u16 shm_size_offset, - struct ieee80211_rate *rate) -{ - const u8 *probe_resp_data; - u16 size; - - size = dev->wl->current_beacon->len; - probe_resp_data = b43legacy_generate_probe_resp(dev, &size, rate); - if (unlikely(!probe_resp_data)) - return; - - /* Looks like PLCP headers plus packet timings are stored for - * all possible basic rates - */ - b43legacy_write_probe_resp_plcp(dev, 0x31A, size, - &b43legacy_b_ratetable[0]); - b43legacy_write_probe_resp_plcp(dev, 0x32C, size, - &b43legacy_b_ratetable[1]); - b43legacy_write_probe_resp_plcp(dev, 0x33E, size, - &b43legacy_b_ratetable[2]); - b43legacy_write_probe_resp_plcp(dev, 0x350, size, - &b43legacy_b_ratetable[3]); - - size = min((size_t)size, - 0x200 - sizeof(struct b43legacy_plcp_hdr6)); - b43legacy_write_template_common(dev, probe_resp_data, - size, ram_offset, - shm_size_offset, rate->hw_value); - kfree(probe_resp_data); -} - -static void b43legacy_upload_beacon0(struct b43legacy_wldev *dev) -{ - struct b43legacy_wl *wl = dev->wl; - - if (wl->beacon0_uploaded) - return; - b43legacy_write_beacon_template(dev, 0x68, 0x18); - /* FIXME: Probe resp upload doesn't really belong here, - * but we don't use that feature anyway. */ - b43legacy_write_probe_resp_template(dev, 0x268, 0x4A, - &__b43legacy_ratetable[3]); - wl->beacon0_uploaded = true; -} - -static void b43legacy_upload_beacon1(struct b43legacy_wldev *dev) -{ - struct b43legacy_wl *wl = dev->wl; - - if (wl->beacon1_uploaded) - return; - b43legacy_write_beacon_template(dev, 0x468, 0x1A); - wl->beacon1_uploaded = true; -} - -static void handle_irq_beacon(struct b43legacy_wldev *dev) -{ - struct b43legacy_wl *wl = dev->wl; - u32 cmd, beacon0_valid, beacon1_valid; - - if (!b43legacy_is_mode(wl, NL80211_IFTYPE_AP)) - return; - - /* This is the bottom half of the asynchronous beacon update. */ - - /* Ignore interrupt in the future. */ - dev->irq_mask &= ~B43legacy_IRQ_BEACON; - - cmd = b43legacy_read32(dev, B43legacy_MMIO_MACCMD); - beacon0_valid = (cmd & B43legacy_MACCMD_BEACON0_VALID); - beacon1_valid = (cmd & B43legacy_MACCMD_BEACON1_VALID); - - /* Schedule interrupt manually, if busy. */ - if (beacon0_valid && beacon1_valid) { - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_REASON, B43legacy_IRQ_BEACON); - dev->irq_mask |= B43legacy_IRQ_BEACON; - return; - } - - if (unlikely(wl->beacon_templates_virgin)) { - /* We never uploaded a beacon before. - * Upload both templates now, but only mark one valid. */ - wl->beacon_templates_virgin = false; - b43legacy_upload_beacon0(dev); - b43legacy_upload_beacon1(dev); - cmd = b43legacy_read32(dev, B43legacy_MMIO_MACCMD); - cmd |= B43legacy_MACCMD_BEACON0_VALID; - b43legacy_write32(dev, B43legacy_MMIO_MACCMD, cmd); - } else { - if (!beacon0_valid) { - b43legacy_upload_beacon0(dev); - cmd = b43legacy_read32(dev, B43legacy_MMIO_MACCMD); - cmd |= B43legacy_MACCMD_BEACON0_VALID; - b43legacy_write32(dev, B43legacy_MMIO_MACCMD, cmd); - } else if (!beacon1_valid) { - b43legacy_upload_beacon1(dev); - cmd = b43legacy_read32(dev, B43legacy_MMIO_MACCMD); - cmd |= B43legacy_MACCMD_BEACON1_VALID; - b43legacy_write32(dev, B43legacy_MMIO_MACCMD, cmd); - } - } -} - -static void b43legacy_beacon_update_trigger_work(struct work_struct *work) -{ - struct b43legacy_wl *wl = container_of(work, struct b43legacy_wl, - beacon_update_trigger); - struct b43legacy_wldev *dev; - - mutex_lock(&wl->mutex); - dev = wl->current_dev; - if (likely(dev && (b43legacy_status(dev) >= B43legacy_STAT_INITIALIZED))) { - spin_lock_irq(&wl->irq_lock); - /* Update beacon right away or defer to IRQ. */ - handle_irq_beacon(dev); - /* The handler might have updated the IRQ mask. */ - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, - dev->irq_mask); - mmiowb(); - spin_unlock_irq(&wl->irq_lock); - } - mutex_unlock(&wl->mutex); -} - -/* Asynchronously update the packet templates in template RAM. - * Locking: Requires wl->irq_lock to be locked. */ -static void b43legacy_update_templates(struct b43legacy_wl *wl) -{ - struct sk_buff *beacon; - /* This is the top half of the ansynchronous beacon update. The bottom - * half is the beacon IRQ. Beacon update must be asynchronous to avoid - * sending an invalid beacon. This can happen for example, if the - * firmware transmits a beacon while we are updating it. */ - - /* We could modify the existing beacon and set the aid bit in the TIM - * field, but that would probably require resizing and moving of data - * within the beacon template. Simply request a new beacon and let - * mac80211 do the hard work. */ - beacon = ieee80211_beacon_get(wl->hw, wl->vif); - if (unlikely(!beacon)) - return; - - if (wl->current_beacon) - dev_kfree_skb_any(wl->current_beacon); - wl->current_beacon = beacon; - wl->beacon0_uploaded = false; - wl->beacon1_uploaded = false; - ieee80211_queue_work(wl->hw, &wl->beacon_update_trigger); -} - -static void b43legacy_set_beacon_int(struct b43legacy_wldev *dev, - u16 beacon_int) -{ - b43legacy_time_lock(dev); - if (dev->dev->id.revision >= 3) { - b43legacy_write32(dev, B43legacy_MMIO_TSF_CFP_REP, - (beacon_int << 16)); - b43legacy_write32(dev, B43legacy_MMIO_TSF_CFP_START, - (beacon_int << 10)); - } else { - b43legacy_write16(dev, 0x606, (beacon_int >> 6)); - b43legacy_write16(dev, 0x610, beacon_int); - } - b43legacy_time_unlock(dev); - b43legacydbg(dev->wl, "Set beacon interval to %u\n", beacon_int); -} - -static void handle_irq_ucode_debug(struct b43legacy_wldev *dev) -{ -} - -/* Interrupt handler bottom-half */ -static void b43legacy_interrupt_tasklet(struct b43legacy_wldev *dev) -{ - u32 reason; - u32 dma_reason[ARRAY_SIZE(dev->dma_reason)]; - u32 merged_dma_reason = 0; - int i; - unsigned long flags; - - spin_lock_irqsave(&dev->wl->irq_lock, flags); - - B43legacy_WARN_ON(b43legacy_status(dev) < - B43legacy_STAT_INITIALIZED); - - reason = dev->irq_reason; - for (i = 0; i < ARRAY_SIZE(dma_reason); i++) { - dma_reason[i] = dev->dma_reason[i]; - merged_dma_reason |= dma_reason[i]; - } - - if (unlikely(reason & B43legacy_IRQ_MAC_TXERR)) - b43legacyerr(dev->wl, "MAC transmission error\n"); - - if (unlikely(reason & B43legacy_IRQ_PHY_TXERR)) { - b43legacyerr(dev->wl, "PHY transmission error\n"); - rmb(); - if (unlikely(atomic_dec_and_test(&dev->phy.txerr_cnt))) { - b43legacyerr(dev->wl, "Too many PHY TX errors, " - "restarting the controller\n"); - b43legacy_controller_restart(dev, "PHY TX errors"); - } - } - - if (unlikely(merged_dma_reason & (B43legacy_DMAIRQ_FATALMASK | - B43legacy_DMAIRQ_NONFATALMASK))) { - if (merged_dma_reason & B43legacy_DMAIRQ_FATALMASK) { - b43legacyerr(dev->wl, "Fatal DMA error: " - "0x%08X, 0x%08X, 0x%08X, " - "0x%08X, 0x%08X, 0x%08X\n", - dma_reason[0], dma_reason[1], - dma_reason[2], dma_reason[3], - dma_reason[4], dma_reason[5]); - b43legacy_controller_restart(dev, "DMA error"); - mmiowb(); - spin_unlock_irqrestore(&dev->wl->irq_lock, flags); - return; - } - if (merged_dma_reason & B43legacy_DMAIRQ_NONFATALMASK) - b43legacyerr(dev->wl, "DMA error: " - "0x%08X, 0x%08X, 0x%08X, " - "0x%08X, 0x%08X, 0x%08X\n", - dma_reason[0], dma_reason[1], - dma_reason[2], dma_reason[3], - dma_reason[4], dma_reason[5]); - } - - if (unlikely(reason & B43legacy_IRQ_UCODE_DEBUG)) - handle_irq_ucode_debug(dev); - if (reason & B43legacy_IRQ_TBTT_INDI) - handle_irq_tbtt_indication(dev); - if (reason & B43legacy_IRQ_ATIM_END) - handle_irq_atim_end(dev); - if (reason & B43legacy_IRQ_BEACON) - handle_irq_beacon(dev); - if (reason & B43legacy_IRQ_PMQ) - handle_irq_pmq(dev); - if (reason & B43legacy_IRQ_TXFIFO_FLUSH_OK) - ;/*TODO*/ - if (reason & B43legacy_IRQ_NOISESAMPLE_OK) - handle_irq_noise(dev); - - /* Check the DMA reason registers for received data. */ - if (dma_reason[0] & B43legacy_DMAIRQ_RX_DONE) { - if (b43legacy_using_pio(dev)) - b43legacy_pio_rx(dev->pio.queue0); - else - b43legacy_dma_rx(dev->dma.rx_ring0); - } - B43legacy_WARN_ON(dma_reason[1] & B43legacy_DMAIRQ_RX_DONE); - B43legacy_WARN_ON(dma_reason[2] & B43legacy_DMAIRQ_RX_DONE); - if (dma_reason[3] & B43legacy_DMAIRQ_RX_DONE) { - if (b43legacy_using_pio(dev)) - b43legacy_pio_rx(dev->pio.queue3); - else - b43legacy_dma_rx(dev->dma.rx_ring3); - } - B43legacy_WARN_ON(dma_reason[4] & B43legacy_DMAIRQ_RX_DONE); - B43legacy_WARN_ON(dma_reason[5] & B43legacy_DMAIRQ_RX_DONE); - - if (reason & B43legacy_IRQ_TX_OK) - handle_irq_transmit_status(dev); - - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, dev->irq_mask); - mmiowb(); - spin_unlock_irqrestore(&dev->wl->irq_lock, flags); -} - -static void pio_irq_workaround(struct b43legacy_wldev *dev, - u16 base, int queueidx) -{ - u16 rxctl; - - rxctl = b43legacy_read16(dev, base + B43legacy_PIO_RXCTL); - if (rxctl & B43legacy_PIO_RXCTL_DATAAVAILABLE) - dev->dma_reason[queueidx] |= B43legacy_DMAIRQ_RX_DONE; - else - dev->dma_reason[queueidx] &= ~B43legacy_DMAIRQ_RX_DONE; -} - -static void b43legacy_interrupt_ack(struct b43legacy_wldev *dev, u32 reason) -{ - if (b43legacy_using_pio(dev) && - (dev->dev->id.revision < 3) && - (!(reason & B43legacy_IRQ_PIO_WORKAROUND))) { - /* Apply a PIO specific workaround to the dma_reasons */ - pio_irq_workaround(dev, B43legacy_MMIO_PIO1_BASE, 0); - pio_irq_workaround(dev, B43legacy_MMIO_PIO2_BASE, 1); - pio_irq_workaround(dev, B43legacy_MMIO_PIO3_BASE, 2); - pio_irq_workaround(dev, B43legacy_MMIO_PIO4_BASE, 3); - } - - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_REASON, reason); - - b43legacy_write32(dev, B43legacy_MMIO_DMA0_REASON, - dev->dma_reason[0]); - b43legacy_write32(dev, B43legacy_MMIO_DMA1_REASON, - dev->dma_reason[1]); - b43legacy_write32(dev, B43legacy_MMIO_DMA2_REASON, - dev->dma_reason[2]); - b43legacy_write32(dev, B43legacy_MMIO_DMA3_REASON, - dev->dma_reason[3]); - b43legacy_write32(dev, B43legacy_MMIO_DMA4_REASON, - dev->dma_reason[4]); - b43legacy_write32(dev, B43legacy_MMIO_DMA5_REASON, - dev->dma_reason[5]); -} - -/* Interrupt handler top-half */ -static irqreturn_t b43legacy_interrupt_handler(int irq, void *dev_id) -{ - irqreturn_t ret = IRQ_NONE; - struct b43legacy_wldev *dev = dev_id; - u32 reason; - - B43legacy_WARN_ON(!dev); - - spin_lock(&dev->wl->irq_lock); - - if (unlikely(b43legacy_status(dev) < B43legacy_STAT_STARTED)) - /* This can only happen on shared IRQ lines. */ - goto out; - reason = b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_REASON); - if (reason == 0xffffffff) /* shared IRQ */ - goto out; - ret = IRQ_HANDLED; - reason &= dev->irq_mask; - if (!reason) - goto out; - - dev->dma_reason[0] = b43legacy_read32(dev, - B43legacy_MMIO_DMA0_REASON) - & 0x0001DC00; - dev->dma_reason[1] = b43legacy_read32(dev, - B43legacy_MMIO_DMA1_REASON) - & 0x0000DC00; - dev->dma_reason[2] = b43legacy_read32(dev, - B43legacy_MMIO_DMA2_REASON) - & 0x0000DC00; - dev->dma_reason[3] = b43legacy_read32(dev, - B43legacy_MMIO_DMA3_REASON) - & 0x0001DC00; - dev->dma_reason[4] = b43legacy_read32(dev, - B43legacy_MMIO_DMA4_REASON) - & 0x0000DC00; - dev->dma_reason[5] = b43legacy_read32(dev, - B43legacy_MMIO_DMA5_REASON) - & 0x0000DC00; - - b43legacy_interrupt_ack(dev, reason); - /* Disable all IRQs. They are enabled again in the bottom half. */ - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, 0); - /* Save the reason code and call our bottom half. */ - dev->irq_reason = reason; - tasklet_schedule(&dev->isr_tasklet); -out: - mmiowb(); - spin_unlock(&dev->wl->irq_lock); - - return ret; -} - -static void b43legacy_release_firmware(struct b43legacy_wldev *dev) -{ - release_firmware(dev->fw.ucode); - dev->fw.ucode = NULL; - release_firmware(dev->fw.pcm); - dev->fw.pcm = NULL; - release_firmware(dev->fw.initvals); - dev->fw.initvals = NULL; - release_firmware(dev->fw.initvals_band); - dev->fw.initvals_band = NULL; -} - -static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl) -{ - b43legacyerr(wl, "You must go to http://wireless.kernel.org/en/users/" - "Drivers/b43#devicefirmware " - "and download the correct firmware (version 3).\n"); -} - -static void b43legacy_fw_cb(const struct firmware *firmware, void *context) -{ - struct b43legacy_wldev *dev = context; - - dev->fwp = firmware; - complete(&dev->fw_load_complete); -} - -static int do_request_fw(struct b43legacy_wldev *dev, - const char *name, - const struct firmware **fw, bool async) -{ - char path[sizeof(modparam_fwpostfix) + 32]; - struct b43legacy_fw_header *hdr; - u32 size; - int err; - - if (!name) - return 0; - - snprintf(path, ARRAY_SIZE(path), - "b43legacy%s/%s.fw", - modparam_fwpostfix, name); - b43legacyinfo(dev->wl, "Loading firmware %s\n", path); - if (async) { - init_completion(&dev->fw_load_complete); - err = request_firmware_nowait(THIS_MODULE, 1, path, - dev->dev->dev, GFP_KERNEL, - dev, b43legacy_fw_cb); - if (err) { - b43legacyerr(dev->wl, "Unable to load firmware\n"); - return err; - } - /* stall here until fw ready */ - wait_for_completion(&dev->fw_load_complete); - if (!dev->fwp) - err = -EINVAL; - *fw = dev->fwp; - } else { - err = request_firmware(fw, path, dev->dev->dev); - } - if (err) { - b43legacyerr(dev->wl, "Firmware file \"%s\" not found " - "or load failed.\n", path); - return err; - } - if ((*fw)->size < sizeof(struct b43legacy_fw_header)) - goto err_format; - hdr = (struct b43legacy_fw_header *)((*fw)->data); - switch (hdr->type) { - case B43legacy_FW_TYPE_UCODE: - case B43legacy_FW_TYPE_PCM: - size = be32_to_cpu(hdr->size); - if (size != (*fw)->size - sizeof(struct b43legacy_fw_header)) - goto err_format; - /* fallthrough */ - case B43legacy_FW_TYPE_IV: - if (hdr->ver != 1) - goto err_format; - break; - default: - goto err_format; - } - - return err; - -err_format: - b43legacyerr(dev->wl, "Firmware file \"%s\" format error.\n", path); - return -EPROTO; -} - -static int b43legacy_one_core_attach(struct ssb_device *dev, - struct b43legacy_wl *wl); -static void b43legacy_one_core_detach(struct ssb_device *dev); - -static void b43legacy_request_firmware(struct work_struct *work) -{ - struct b43legacy_wl *wl = container_of(work, - struct b43legacy_wl, firmware_load); - struct b43legacy_wldev *dev = wl->current_dev; - struct b43legacy_firmware *fw = &dev->fw; - const u8 rev = dev->dev->id.revision; - const char *filename; - int err; - - if (!fw->ucode) { - if (rev == 2) - filename = "ucode2"; - else if (rev == 4) - filename = "ucode4"; - else - filename = "ucode5"; - err = do_request_fw(dev, filename, &fw->ucode, true); - if (err) - goto err_load; - } - if (!fw->pcm) { - if (rev < 5) - filename = "pcm4"; - else - filename = "pcm5"; - err = do_request_fw(dev, filename, &fw->pcm, false); - if (err) - goto err_load; - } - if (!fw->initvals) { - switch (dev->phy.type) { - case B43legacy_PHYTYPE_B: - case B43legacy_PHYTYPE_G: - if ((rev >= 5) && (rev <= 10)) - filename = "b0g0initvals5"; - else if (rev == 2 || rev == 4) - filename = "b0g0initvals2"; - else - goto err_no_initvals; - break; - default: - goto err_no_initvals; - } - err = do_request_fw(dev, filename, &fw->initvals, false); - if (err) - goto err_load; - } - if (!fw->initvals_band) { - switch (dev->phy.type) { - case B43legacy_PHYTYPE_B: - case B43legacy_PHYTYPE_G: - if ((rev >= 5) && (rev <= 10)) - filename = "b0g0bsinitvals5"; - else if (rev >= 11) - filename = NULL; - else if (rev == 2 || rev == 4) - filename = NULL; - else - goto err_no_initvals; - break; - default: - goto err_no_initvals; - } - err = do_request_fw(dev, filename, &fw->initvals_band, false); - if (err) - goto err_load; - } - err = ieee80211_register_hw(wl->hw); - if (err) - goto err_one_core_detach; - return; - -err_one_core_detach: - b43legacy_one_core_detach(dev->dev); - goto error; - -err_load: - b43legacy_print_fw_helptext(dev->wl); - goto error; - -err_no_initvals: - err = -ENODEV; - b43legacyerr(dev->wl, "No Initial Values firmware file for PHY %u, " - "core rev %u\n", dev->phy.type, rev); - goto error; - -error: - b43legacy_release_firmware(dev); - return; -} - -static int b43legacy_upload_microcode(struct b43legacy_wldev *dev) -{ - struct wiphy *wiphy = dev->wl->hw->wiphy; - const size_t hdr_len = sizeof(struct b43legacy_fw_header); - const __be32 *data; - unsigned int i; - unsigned int len; - u16 fwrev; - u16 fwpatch; - u16 fwdate; - u16 fwtime; - u32 tmp, macctl; - int err = 0; - - /* Jump the microcode PSM to offset 0 */ - macctl = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - B43legacy_WARN_ON(macctl & B43legacy_MACCTL_PSM_RUN); - macctl |= B43legacy_MACCTL_PSM_JMP0; - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl); - /* Zero out all microcode PSM registers and shared memory. */ - for (i = 0; i < 64; i++) - b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, i, 0); - for (i = 0; i < 4096; i += 2) - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, i, 0); - - /* Upload Microcode. */ - data = (__be32 *) (dev->fw.ucode->data + hdr_len); - len = (dev->fw.ucode->size - hdr_len) / sizeof(__be32); - b43legacy_shm_control_word(dev, - B43legacy_SHM_UCODE | - B43legacy_SHM_AUTOINC_W, - 0x0000); - for (i = 0; i < len; i++) { - b43legacy_write32(dev, B43legacy_MMIO_SHM_DATA, - be32_to_cpu(data[i])); - udelay(10); - } - - if (dev->fw.pcm) { - /* Upload PCM data. */ - data = (__be32 *) (dev->fw.pcm->data + hdr_len); - len = (dev->fw.pcm->size - hdr_len) / sizeof(__be32); - b43legacy_shm_control_word(dev, B43legacy_SHM_HW, 0x01EA); - b43legacy_write32(dev, B43legacy_MMIO_SHM_DATA, 0x00004000); - /* No need for autoinc bit in SHM_HW */ - b43legacy_shm_control_word(dev, B43legacy_SHM_HW, 0x01EB); - for (i = 0; i < len; i++) { - b43legacy_write32(dev, B43legacy_MMIO_SHM_DATA, - be32_to_cpu(data[i])); - udelay(10); - } - } - - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_REASON, - B43legacy_IRQ_ALL); - - /* Start the microcode PSM */ - macctl = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - macctl &= ~B43legacy_MACCTL_PSM_JMP0; - macctl |= B43legacy_MACCTL_PSM_RUN; - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl); - - /* Wait for the microcode to load and respond */ - i = 0; - while (1) { - tmp = b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_REASON); - if (tmp == B43legacy_IRQ_MAC_SUSPENDED) - break; - i++; - if (i >= B43legacy_IRQWAIT_MAX_RETRIES) { - b43legacyerr(dev->wl, "Microcode not responding\n"); - b43legacy_print_fw_helptext(dev->wl); - err = -ENODEV; - goto error; - } - msleep_interruptible(50); - if (signal_pending(current)) { - err = -EINTR; - goto error; - } - } - /* dummy read follows */ - b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_REASON); - - /* Get and check the revisions. */ - fwrev = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_UCODEREV); - fwpatch = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_UCODEPATCH); - fwdate = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_UCODEDATE); - fwtime = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_UCODETIME); - - if (fwrev > 0x128) { - b43legacyerr(dev->wl, "YOU ARE TRYING TO LOAD V4 FIRMWARE." - " Only firmware from binary drivers version 3.x" - " is supported. You must change your firmware" - " files.\n"); - b43legacy_print_fw_helptext(dev->wl); - err = -EOPNOTSUPP; - goto error; - } - b43legacyinfo(dev->wl, "Loading firmware version 0x%X, patch level %u " - "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n", fwrev, fwpatch, - (fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF, - (fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F, - fwtime & 0x1F); - - dev->fw.rev = fwrev; - dev->fw.patch = fwpatch; - - snprintf(wiphy->fw_version, sizeof(wiphy->fw_version), "%u.%u", - dev->fw.rev, dev->fw.patch); - wiphy->hw_version = dev->dev->id.coreid; - - return 0; - -error: - macctl = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - macctl &= ~B43legacy_MACCTL_PSM_RUN; - macctl |= B43legacy_MACCTL_PSM_JMP0; - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl); - - return err; -} - -static int b43legacy_write_initvals(struct b43legacy_wldev *dev, - const struct b43legacy_iv *ivals, - size_t count, - size_t array_size) -{ - const struct b43legacy_iv *iv; - u16 offset; - size_t i; - bool bit32; - - BUILD_BUG_ON(sizeof(struct b43legacy_iv) != 6); - iv = ivals; - for (i = 0; i < count; i++) { - if (array_size < sizeof(iv->offset_size)) - goto err_format; - array_size -= sizeof(iv->offset_size); - offset = be16_to_cpu(iv->offset_size); - bit32 = !!(offset & B43legacy_IV_32BIT); - offset &= B43legacy_IV_OFFSET_MASK; - if (offset >= 0x1000) - goto err_format; - if (bit32) { - u32 value; - - if (array_size < sizeof(iv->data.d32)) - goto err_format; - array_size -= sizeof(iv->data.d32); - - value = get_unaligned_be32(&iv->data.d32); - b43legacy_write32(dev, offset, value); - - iv = (const struct b43legacy_iv *)((const uint8_t *)iv + - sizeof(__be16) + - sizeof(__be32)); - } else { - u16 value; - - if (array_size < sizeof(iv->data.d16)) - goto err_format; - array_size -= sizeof(iv->data.d16); - - value = be16_to_cpu(iv->data.d16); - b43legacy_write16(dev, offset, value); - - iv = (const struct b43legacy_iv *)((const uint8_t *)iv + - sizeof(__be16) + - sizeof(__be16)); - } - } - if (array_size) - goto err_format; - - return 0; - -err_format: - b43legacyerr(dev->wl, "Initial Values Firmware file-format error.\n"); - b43legacy_print_fw_helptext(dev->wl); - - return -EPROTO; -} - -static int b43legacy_upload_initvals(struct b43legacy_wldev *dev) -{ - const size_t hdr_len = sizeof(struct b43legacy_fw_header); - const struct b43legacy_fw_header *hdr; - struct b43legacy_firmware *fw = &dev->fw; - const struct b43legacy_iv *ivals; - size_t count; - int err; - - hdr = (const struct b43legacy_fw_header *)(fw->initvals->data); - ivals = (const struct b43legacy_iv *)(fw->initvals->data + hdr_len); - count = be32_to_cpu(hdr->size); - err = b43legacy_write_initvals(dev, ivals, count, - fw->initvals->size - hdr_len); - if (err) - goto out; - if (fw->initvals_band) { - hdr = (const struct b43legacy_fw_header *) - (fw->initvals_band->data); - ivals = (const struct b43legacy_iv *)(fw->initvals_band->data - + hdr_len); - count = be32_to_cpu(hdr->size); - err = b43legacy_write_initvals(dev, ivals, count, - fw->initvals_band->size - hdr_len); - if (err) - goto out; - } -out: - - return err; -} - -/* Initialize the GPIOs - * http://bcm-specs.sipsolutions.net/GPIO - */ -static int b43legacy_gpio_init(struct b43legacy_wldev *dev) -{ - struct ssb_bus *bus = dev->dev->bus; - struct ssb_device *gpiodev, *pcidev = NULL; - u32 mask; - u32 set; - - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, - b43legacy_read32(dev, - B43legacy_MMIO_MACCTL) - & 0xFFFF3FFF); - - b43legacy_write16(dev, B43legacy_MMIO_GPIO_MASK, - b43legacy_read16(dev, - B43legacy_MMIO_GPIO_MASK) - | 0x000F); - - mask = 0x0000001F; - set = 0x0000000F; - if (dev->dev->bus->chip_id == 0x4301) { - mask |= 0x0060; - set |= 0x0060; - } - if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_PACTRL) { - b43legacy_write16(dev, B43legacy_MMIO_GPIO_MASK, - b43legacy_read16(dev, - B43legacy_MMIO_GPIO_MASK) - | 0x0200); - mask |= 0x0200; - set |= 0x0200; - } - if (dev->dev->id.revision >= 2) - mask |= 0x0010; /* FIXME: This is redundant. */ - -#ifdef CONFIG_SSB_DRIVER_PCICORE - pcidev = bus->pcicore.dev; -#endif - gpiodev = bus->chipco.dev ? : pcidev; - if (!gpiodev) - return 0; - ssb_write32(gpiodev, B43legacy_GPIO_CONTROL, - (ssb_read32(gpiodev, B43legacy_GPIO_CONTROL) - & ~mask) | set); - - return 0; -} - -/* Turn off all GPIO stuff. Call this on module unload, for example. */ -static void b43legacy_gpio_cleanup(struct b43legacy_wldev *dev) -{ - struct ssb_bus *bus = dev->dev->bus; - struct ssb_device *gpiodev, *pcidev = NULL; - -#ifdef CONFIG_SSB_DRIVER_PCICORE - pcidev = bus->pcicore.dev; -#endif - gpiodev = bus->chipco.dev ? : pcidev; - if (!gpiodev) - return; - ssb_write32(gpiodev, B43legacy_GPIO_CONTROL, 0); -} - -/* http://bcm-specs.sipsolutions.net/EnableMac */ -void b43legacy_mac_enable(struct b43legacy_wldev *dev) -{ - dev->mac_suspended--; - B43legacy_WARN_ON(dev->mac_suspended < 0); - B43legacy_WARN_ON(irqs_disabled()); - if (dev->mac_suspended == 0) { - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, - b43legacy_read32(dev, - B43legacy_MMIO_MACCTL) - | B43legacy_MACCTL_ENABLED); - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_REASON, - B43legacy_IRQ_MAC_SUSPENDED); - /* the next two are dummy reads */ - b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_REASON); - b43legacy_power_saving_ctl_bits(dev, -1, -1); - - /* Re-enable IRQs. */ - spin_lock_irq(&dev->wl->irq_lock); - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, - dev->irq_mask); - spin_unlock_irq(&dev->wl->irq_lock); - } -} - -/* http://bcm-specs.sipsolutions.net/SuspendMAC */ -void b43legacy_mac_suspend(struct b43legacy_wldev *dev) -{ - int i; - u32 tmp; - - might_sleep(); - B43legacy_WARN_ON(irqs_disabled()); - B43legacy_WARN_ON(dev->mac_suspended < 0); - - if (dev->mac_suspended == 0) { - /* Mask IRQs before suspending MAC. Otherwise - * the MAC stays busy and won't suspend. */ - spin_lock_irq(&dev->wl->irq_lock); - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, 0); - spin_unlock_irq(&dev->wl->irq_lock); - b43legacy_synchronize_irq(dev); - - b43legacy_power_saving_ctl_bits(dev, -1, 1); - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, - b43legacy_read32(dev, - B43legacy_MMIO_MACCTL) - & ~B43legacy_MACCTL_ENABLED); - b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_REASON); - for (i = 40; i; i--) { - tmp = b43legacy_read32(dev, - B43legacy_MMIO_GEN_IRQ_REASON); - if (tmp & B43legacy_IRQ_MAC_SUSPENDED) - goto out; - msleep(1); - } - b43legacyerr(dev->wl, "MAC suspend failed\n"); - } -out: - dev->mac_suspended++; -} - -static void b43legacy_adjust_opmode(struct b43legacy_wldev *dev) -{ - struct b43legacy_wl *wl = dev->wl; - u32 ctl; - u16 cfp_pretbtt; - - ctl = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - /* Reset status to STA infrastructure mode. */ - ctl &= ~B43legacy_MACCTL_AP; - ctl &= ~B43legacy_MACCTL_KEEP_CTL; - ctl &= ~B43legacy_MACCTL_KEEP_BADPLCP; - ctl &= ~B43legacy_MACCTL_KEEP_BAD; - ctl &= ~B43legacy_MACCTL_PROMISC; - ctl &= ~B43legacy_MACCTL_BEACPROMISC; - ctl |= B43legacy_MACCTL_INFRA; - - if (b43legacy_is_mode(wl, NL80211_IFTYPE_AP)) - ctl |= B43legacy_MACCTL_AP; - else if (b43legacy_is_mode(wl, NL80211_IFTYPE_ADHOC)) - ctl &= ~B43legacy_MACCTL_INFRA; - - if (wl->filter_flags & FIF_CONTROL) - ctl |= B43legacy_MACCTL_KEEP_CTL; - if (wl->filter_flags & FIF_FCSFAIL) - ctl |= B43legacy_MACCTL_KEEP_BAD; - if (wl->filter_flags & FIF_PLCPFAIL) - ctl |= B43legacy_MACCTL_KEEP_BADPLCP; - if (wl->filter_flags & FIF_PROMISC_IN_BSS) - ctl |= B43legacy_MACCTL_PROMISC; - if (wl->filter_flags & FIF_BCN_PRBRESP_PROMISC) - ctl |= B43legacy_MACCTL_BEACPROMISC; - - /* Workaround: On old hardware the HW-MAC-address-filter - * doesn't work properly, so always run promisc in filter - * it in software. */ - if (dev->dev->id.revision <= 4) - ctl |= B43legacy_MACCTL_PROMISC; - - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, ctl); - - cfp_pretbtt = 2; - if ((ctl & B43legacy_MACCTL_INFRA) && - !(ctl & B43legacy_MACCTL_AP)) { - if (dev->dev->bus->chip_id == 0x4306 && - dev->dev->bus->chip_rev == 3) - cfp_pretbtt = 100; - else - cfp_pretbtt = 50; - } - b43legacy_write16(dev, 0x612, cfp_pretbtt); -} - -static void b43legacy_rate_memory_write(struct b43legacy_wldev *dev, - u16 rate, - int is_ofdm) -{ - u16 offset; - - if (is_ofdm) { - offset = 0x480; - offset += (b43legacy_plcp_get_ratecode_ofdm(rate) & 0x000F) * 2; - } else { - offset = 0x4C0; - offset += (b43legacy_plcp_get_ratecode_cck(rate) & 0x000F) * 2; - } - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, offset + 0x20, - b43legacy_shm_read16(dev, - B43legacy_SHM_SHARED, offset)); -} - -static void b43legacy_rate_memory_init(struct b43legacy_wldev *dev) -{ - switch (dev->phy.type) { - case B43legacy_PHYTYPE_G: - b43legacy_rate_memory_write(dev, B43legacy_OFDM_RATE_6MB, 1); - b43legacy_rate_memory_write(dev, B43legacy_OFDM_RATE_12MB, 1); - b43legacy_rate_memory_write(dev, B43legacy_OFDM_RATE_18MB, 1); - b43legacy_rate_memory_write(dev, B43legacy_OFDM_RATE_24MB, 1); - b43legacy_rate_memory_write(dev, B43legacy_OFDM_RATE_36MB, 1); - b43legacy_rate_memory_write(dev, B43legacy_OFDM_RATE_48MB, 1); - b43legacy_rate_memory_write(dev, B43legacy_OFDM_RATE_54MB, 1); - /* fallthrough */ - case B43legacy_PHYTYPE_B: - b43legacy_rate_memory_write(dev, B43legacy_CCK_RATE_1MB, 0); - b43legacy_rate_memory_write(dev, B43legacy_CCK_RATE_2MB, 0); - b43legacy_rate_memory_write(dev, B43legacy_CCK_RATE_5MB, 0); - b43legacy_rate_memory_write(dev, B43legacy_CCK_RATE_11MB, 0); - break; - default: - B43legacy_BUG_ON(1); - } -} - -/* Set the TX-Antenna for management frames sent by firmware. */ -static void b43legacy_mgmtframe_txantenna(struct b43legacy_wldev *dev, - int antenna) -{ - u16 ant = 0; - u16 tmp; - - switch (antenna) { - case B43legacy_ANTENNA0: - ant |= B43legacy_TX4_PHY_ANT0; - break; - case B43legacy_ANTENNA1: - ant |= B43legacy_TX4_PHY_ANT1; - break; - case B43legacy_ANTENNA_AUTO: - ant |= B43legacy_TX4_PHY_ANTLAST; - break; - default: - B43legacy_BUG_ON(1); - } - - /* FIXME We also need to set the other flags of the PHY control - * field somewhere. */ - - /* For Beacons */ - tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_BEACPHYCTL); - tmp = (tmp & ~B43legacy_TX4_PHY_ANT) | ant; - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_BEACPHYCTL, tmp); - /* For ACK/CTS */ - tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_ACKCTSPHYCTL); - tmp = (tmp & ~B43legacy_TX4_PHY_ANT) | ant; - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_ACKCTSPHYCTL, tmp); - /* For Probe Resposes */ - tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_PRPHYCTL); - tmp = (tmp & ~B43legacy_TX4_PHY_ANT) | ant; - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_PRPHYCTL, tmp); -} - -/* This is the opposite of b43legacy_chip_init() */ -static void b43legacy_chip_exit(struct b43legacy_wldev *dev) -{ - b43legacy_radio_turn_off(dev, 1); - b43legacy_gpio_cleanup(dev); - /* firmware is released later */ -} - -/* Initialize the chip - * http://bcm-specs.sipsolutions.net/ChipInit - */ -static int b43legacy_chip_init(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - int err; - int tmp; - u32 value32, macctl; - u16 value16; - - /* Initialize the MAC control */ - macctl = B43legacy_MACCTL_IHR_ENABLED | B43legacy_MACCTL_SHM_ENABLED; - if (dev->phy.gmode) - macctl |= B43legacy_MACCTL_GMODE; - macctl |= B43legacy_MACCTL_INFRA; - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl); - - err = b43legacy_upload_microcode(dev); - if (err) - goto out; /* firmware is released later */ - - err = b43legacy_gpio_init(dev); - if (err) - goto out; /* firmware is released later */ - - err = b43legacy_upload_initvals(dev); - if (err) - goto err_gpio_clean; - b43legacy_radio_turn_on(dev); - - b43legacy_write16(dev, 0x03E6, 0x0000); - err = b43legacy_phy_init(dev); - if (err) - goto err_radio_off; - - /* Select initial Interference Mitigation. */ - tmp = phy->interfmode; - phy->interfmode = B43legacy_INTERFMODE_NONE; - b43legacy_radio_set_interference_mitigation(dev, tmp); - - b43legacy_phy_set_antenna_diversity(dev); - b43legacy_mgmtframe_txantenna(dev, B43legacy_ANTENNA_DEFAULT); - - if (phy->type == B43legacy_PHYTYPE_B) { - value16 = b43legacy_read16(dev, 0x005E); - value16 |= 0x0004; - b43legacy_write16(dev, 0x005E, value16); - } - b43legacy_write32(dev, 0x0100, 0x01000000); - if (dev->dev->id.revision < 5) - b43legacy_write32(dev, 0x010C, 0x01000000); - - value32 = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - value32 &= ~B43legacy_MACCTL_INFRA; - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, value32); - value32 = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - value32 |= B43legacy_MACCTL_INFRA; - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, value32); - - if (b43legacy_using_pio(dev)) { - b43legacy_write32(dev, 0x0210, 0x00000100); - b43legacy_write32(dev, 0x0230, 0x00000100); - b43legacy_write32(dev, 0x0250, 0x00000100); - b43legacy_write32(dev, 0x0270, 0x00000100); - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x0034, - 0x0000); - } - - /* Probe Response Timeout value */ - /* FIXME: Default to 0, has to be set by ioctl probably... :-/ */ - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x0074, 0x0000); - - /* Initially set the wireless operation mode. */ - b43legacy_adjust_opmode(dev); - - if (dev->dev->id.revision < 3) { - b43legacy_write16(dev, 0x060E, 0x0000); - b43legacy_write16(dev, 0x0610, 0x8000); - b43legacy_write16(dev, 0x0604, 0x0000); - b43legacy_write16(dev, 0x0606, 0x0200); - } else { - b43legacy_write32(dev, 0x0188, 0x80000000); - b43legacy_write32(dev, 0x018C, 0x02000000); - } - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_REASON, 0x00004000); - b43legacy_write32(dev, B43legacy_MMIO_DMA0_IRQ_MASK, 0x0001DC00); - b43legacy_write32(dev, B43legacy_MMIO_DMA1_IRQ_MASK, 0x0000DC00); - b43legacy_write32(dev, B43legacy_MMIO_DMA2_IRQ_MASK, 0x0000DC00); - b43legacy_write32(dev, B43legacy_MMIO_DMA3_IRQ_MASK, 0x0001DC00); - b43legacy_write32(dev, B43legacy_MMIO_DMA4_IRQ_MASK, 0x0000DC00); - b43legacy_write32(dev, B43legacy_MMIO_DMA5_IRQ_MASK, 0x0000DC00); - - value32 = ssb_read32(dev->dev, SSB_TMSLOW); - value32 |= B43legacy_TMSLOW_MACPHYCLKEN; - ssb_write32(dev->dev, SSB_TMSLOW, value32); - - b43legacy_write16(dev, B43legacy_MMIO_POWERUP_DELAY, - dev->dev->bus->chipco.fast_pwrup_delay); - - /* PHY TX errors counter. */ - atomic_set(&phy->txerr_cnt, B43legacy_PHY_TX_BADNESS_LIMIT); - - B43legacy_WARN_ON(err != 0); - b43legacydbg(dev->wl, "Chip initialized\n"); -out: - return err; - -err_radio_off: - b43legacy_radio_turn_off(dev, 1); -err_gpio_clean: - b43legacy_gpio_cleanup(dev); - goto out; -} - -static void b43legacy_periodic_every120sec(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - - if (phy->type != B43legacy_PHYTYPE_G || phy->rev < 2) - return; - - b43legacy_mac_suspend(dev); - b43legacy_phy_lo_g_measure(dev); - b43legacy_mac_enable(dev); -} - -static void b43legacy_periodic_every60sec(struct b43legacy_wldev *dev) -{ - b43legacy_phy_lo_mark_all_unused(dev); - if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_RSSI) { - b43legacy_mac_suspend(dev); - b43legacy_calc_nrssi_slope(dev); - b43legacy_mac_enable(dev); - } -} - -static void b43legacy_periodic_every30sec(struct b43legacy_wldev *dev) -{ - /* Update device statistics. */ - b43legacy_calculate_link_quality(dev); -} - -static void b43legacy_periodic_every15sec(struct b43legacy_wldev *dev) -{ - b43legacy_phy_xmitpower(dev); /* FIXME: unless scanning? */ - - atomic_set(&dev->phy.txerr_cnt, B43legacy_PHY_TX_BADNESS_LIMIT); - wmb(); -} - -static void do_periodic_work(struct b43legacy_wldev *dev) -{ - unsigned int state; - - state = dev->periodic_state; - if (state % 8 == 0) - b43legacy_periodic_every120sec(dev); - if (state % 4 == 0) - b43legacy_periodic_every60sec(dev); - if (state % 2 == 0) - b43legacy_periodic_every30sec(dev); - b43legacy_periodic_every15sec(dev); -} - -/* Periodic work locking policy: - * The whole periodic work handler is protected by - * wl->mutex. If another lock is needed somewhere in the - * pwork callchain, it's acquired in-place, where it's needed. - */ -static void b43legacy_periodic_work_handler(struct work_struct *work) -{ - struct b43legacy_wldev *dev = container_of(work, struct b43legacy_wldev, - periodic_work.work); - struct b43legacy_wl *wl = dev->wl; - unsigned long delay; - - mutex_lock(&wl->mutex); - - if (unlikely(b43legacy_status(dev) != B43legacy_STAT_STARTED)) - goto out; - if (b43legacy_debug(dev, B43legacy_DBG_PWORK_STOP)) - goto out_requeue; - - do_periodic_work(dev); - - dev->periodic_state++; -out_requeue: - if (b43legacy_debug(dev, B43legacy_DBG_PWORK_FAST)) - delay = msecs_to_jiffies(50); - else - delay = round_jiffies_relative(HZ * 15); - ieee80211_queue_delayed_work(wl->hw, &dev->periodic_work, delay); -out: - mutex_unlock(&wl->mutex); -} - -static void b43legacy_periodic_tasks_setup(struct b43legacy_wldev *dev) -{ - struct delayed_work *work = &dev->periodic_work; - - dev->periodic_state = 0; - INIT_DELAYED_WORK(work, b43legacy_periodic_work_handler); - ieee80211_queue_delayed_work(dev->wl->hw, work, 0); -} - -/* Validate access to the chip (SHM) */ -static int b43legacy_validate_chipaccess(struct b43legacy_wldev *dev) -{ - u32 value; - u32 shm_backup; - - shm_backup = b43legacy_shm_read32(dev, B43legacy_SHM_SHARED, 0); - b43legacy_shm_write32(dev, B43legacy_SHM_SHARED, 0, 0xAA5555AA); - if (b43legacy_shm_read32(dev, B43legacy_SHM_SHARED, 0) != - 0xAA5555AA) - goto error; - b43legacy_shm_write32(dev, B43legacy_SHM_SHARED, 0, 0x55AAAA55); - if (b43legacy_shm_read32(dev, B43legacy_SHM_SHARED, 0) != - 0x55AAAA55) - goto error; - b43legacy_shm_write32(dev, B43legacy_SHM_SHARED, 0, shm_backup); - - value = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - if ((value | B43legacy_MACCTL_GMODE) != - (B43legacy_MACCTL_GMODE | B43legacy_MACCTL_IHR_ENABLED)) - goto error; - - value = b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_REASON); - if (value) - goto error; - - return 0; -error: - b43legacyerr(dev->wl, "Failed to validate the chipaccess\n"); - return -ENODEV; -} - -static void b43legacy_security_init(struct b43legacy_wldev *dev) -{ - dev->max_nr_keys = (dev->dev->id.revision >= 5) ? 58 : 20; - B43legacy_WARN_ON(dev->max_nr_keys > ARRAY_SIZE(dev->key)); - dev->ktp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - 0x0056); - /* KTP is a word address, but we address SHM bytewise. - * So multiply by two. - */ - dev->ktp *= 2; - if (dev->dev->id.revision >= 5) - /* Number of RCMTA address slots */ - b43legacy_write16(dev, B43legacy_MMIO_RCMTA_COUNT, - dev->max_nr_keys - 8); -} - -#ifdef CONFIG_B43LEGACY_HWRNG -static int b43legacy_rng_read(struct hwrng *rng, u32 *data) -{ - struct b43legacy_wl *wl = (struct b43legacy_wl *)rng->priv; - unsigned long flags; - - /* Don't take wl->mutex here, as it could deadlock with - * hwrng internal locking. It's not needed to take - * wl->mutex here, anyway. */ - - spin_lock_irqsave(&wl->irq_lock, flags); - *data = b43legacy_read16(wl->current_dev, B43legacy_MMIO_RNG); - spin_unlock_irqrestore(&wl->irq_lock, flags); - - return (sizeof(u16)); -} -#endif - -static void b43legacy_rng_exit(struct b43legacy_wl *wl) -{ -#ifdef CONFIG_B43LEGACY_HWRNG - if (wl->rng_initialized) - hwrng_unregister(&wl->rng); -#endif -} - -static int b43legacy_rng_init(struct b43legacy_wl *wl) -{ - int err = 0; - -#ifdef CONFIG_B43LEGACY_HWRNG - snprintf(wl->rng_name, ARRAY_SIZE(wl->rng_name), - "%s_%s", KBUILD_MODNAME, wiphy_name(wl->hw->wiphy)); - wl->rng.name = wl->rng_name; - wl->rng.data_read = b43legacy_rng_read; - wl->rng.priv = (unsigned long)wl; - wl->rng_initialized = 1; - err = hwrng_register(&wl->rng); - if (err) { - wl->rng_initialized = 0; - b43legacyerr(wl, "Failed to register the random " - "number generator (%d)\n", err); - } - -#endif - return err; -} - -static void b43legacy_tx_work(struct work_struct *work) -{ - struct b43legacy_wl *wl = container_of(work, struct b43legacy_wl, - tx_work); - struct b43legacy_wldev *dev; - struct sk_buff *skb; - int queue_num; - int err = 0; - - mutex_lock(&wl->mutex); - dev = wl->current_dev; - if (unlikely(!dev || b43legacy_status(dev) < B43legacy_STAT_STARTED)) { - mutex_unlock(&wl->mutex); - return; - } - - for (queue_num = 0; queue_num < B43legacy_QOS_QUEUE_NUM; queue_num++) { - while (skb_queue_len(&wl->tx_queue[queue_num])) { - skb = skb_dequeue(&wl->tx_queue[queue_num]); - if (b43legacy_using_pio(dev)) - err = b43legacy_pio_tx(dev, skb); - else - err = b43legacy_dma_tx(dev, skb); - if (err == -ENOSPC) { - wl->tx_queue_stopped[queue_num] = 1; - ieee80211_stop_queue(wl->hw, queue_num); - skb_queue_head(&wl->tx_queue[queue_num], skb); - break; - } - if (unlikely(err)) - dev_kfree_skb(skb); /* Drop it */ - err = 0; - } - - if (!err) - wl->tx_queue_stopped[queue_num] = 0; - } - - mutex_unlock(&wl->mutex); -} - -static void b43legacy_op_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); - - if (unlikely(skb->len < 2 + 2 + 6)) { - /* Too short, this can't be a valid frame. */ - dev_kfree_skb_any(skb); - return; - } - B43legacy_WARN_ON(skb_shinfo(skb)->nr_frags); - - skb_queue_tail(&wl->tx_queue[skb->queue_mapping], skb); - if (!wl->tx_queue_stopped[skb->queue_mapping]) - ieee80211_queue_work(wl->hw, &wl->tx_work); - else - ieee80211_stop_queue(wl->hw, skb->queue_mapping); -} - -static int b43legacy_op_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - return 0; -} - -static int b43legacy_op_get_stats(struct ieee80211_hw *hw, - struct ieee80211_low_level_stats *stats) -{ - struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); - unsigned long flags; - - spin_lock_irqsave(&wl->irq_lock, flags); - memcpy(stats, &wl->ieee_stats, sizeof(*stats)); - spin_unlock_irqrestore(&wl->irq_lock, flags); - - return 0; -} - -static const char *phymode_to_string(unsigned int phymode) -{ - switch (phymode) { - case B43legacy_PHYMODE_B: - return "B"; - case B43legacy_PHYMODE_G: - return "G"; - default: - B43legacy_BUG_ON(1); - } - return ""; -} - -static int find_wldev_for_phymode(struct b43legacy_wl *wl, - unsigned int phymode, - struct b43legacy_wldev **dev, - bool *gmode) -{ - struct b43legacy_wldev *d; - - list_for_each_entry(d, &wl->devlist, list) { - if (d->phy.possible_phymodes & phymode) { - /* Ok, this device supports the PHY-mode. - * Set the gmode bit. */ - *gmode = true; - *dev = d; - - return 0; - } - } - - return -ESRCH; -} - -static void b43legacy_put_phy_into_reset(struct b43legacy_wldev *dev) -{ - struct ssb_device *sdev = dev->dev; - u32 tmslow; - - tmslow = ssb_read32(sdev, SSB_TMSLOW); - tmslow &= ~B43legacy_TMSLOW_GMODE; - tmslow |= B43legacy_TMSLOW_PHYRESET; - tmslow |= SSB_TMSLOW_FGC; - ssb_write32(sdev, SSB_TMSLOW, tmslow); - msleep(1); - - tmslow = ssb_read32(sdev, SSB_TMSLOW); - tmslow &= ~SSB_TMSLOW_FGC; - tmslow |= B43legacy_TMSLOW_PHYRESET; - ssb_write32(sdev, SSB_TMSLOW, tmslow); - msleep(1); -} - -/* Expects wl->mutex locked */ -static int b43legacy_switch_phymode(struct b43legacy_wl *wl, - unsigned int new_mode) -{ - struct b43legacy_wldev *uninitialized_var(up_dev); - struct b43legacy_wldev *down_dev; - int err; - bool gmode = false; - int prev_status; - - err = find_wldev_for_phymode(wl, new_mode, &up_dev, &gmode); - if (err) { - b43legacyerr(wl, "Could not find a device for %s-PHY mode\n", - phymode_to_string(new_mode)); - return err; - } - if ((up_dev == wl->current_dev) && - (!!wl->current_dev->phy.gmode == !!gmode)) - /* This device is already running. */ - return 0; - b43legacydbg(wl, "Reconfiguring PHYmode to %s-PHY\n", - phymode_to_string(new_mode)); - down_dev = wl->current_dev; - - prev_status = b43legacy_status(down_dev); - /* Shutdown the currently running core. */ - if (prev_status >= B43legacy_STAT_STARTED) - b43legacy_wireless_core_stop(down_dev); - if (prev_status >= B43legacy_STAT_INITIALIZED) - b43legacy_wireless_core_exit(down_dev); - - if (down_dev != up_dev) - /* We switch to a different core, so we put PHY into - * RESET on the old core. */ - b43legacy_put_phy_into_reset(down_dev); - - /* Now start the new core. */ - up_dev->phy.gmode = gmode; - if (prev_status >= B43legacy_STAT_INITIALIZED) { - err = b43legacy_wireless_core_init(up_dev); - if (err) { - b43legacyerr(wl, "Fatal: Could not initialize device" - " for newly selected %s-PHY mode\n", - phymode_to_string(new_mode)); - goto init_failure; - } - } - if (prev_status >= B43legacy_STAT_STARTED) { - err = b43legacy_wireless_core_start(up_dev); - if (err) { - b43legacyerr(wl, "Fatal: Could not start device for " - "newly selected %s-PHY mode\n", - phymode_to_string(new_mode)); - b43legacy_wireless_core_exit(up_dev); - goto init_failure; - } - } - B43legacy_WARN_ON(b43legacy_status(up_dev) != prev_status); - - b43legacy_shm_write32(up_dev, B43legacy_SHM_SHARED, 0x003E, 0); - - wl->current_dev = up_dev; - - return 0; -init_failure: - /* Whoops, failed to init the new core. No core is operating now. */ - wl->current_dev = NULL; - return err; -} - -/* Write the short and long frame retry limit values. */ -static void b43legacy_set_retry_limits(struct b43legacy_wldev *dev, - unsigned int short_retry, - unsigned int long_retry) -{ - /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing - * the chip-internal counter. */ - short_retry = min(short_retry, (unsigned int)0xF); - long_retry = min(long_retry, (unsigned int)0xF); - - b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0006, short_retry); - b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0007, long_retry); -} - -static int b43legacy_op_dev_config(struct ieee80211_hw *hw, - u32 changed) -{ - struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); - struct b43legacy_wldev *dev; - struct b43legacy_phy *phy; - struct ieee80211_conf *conf = &hw->conf; - unsigned long flags; - unsigned int new_phymode = 0xFFFF; - int antenna_tx; - int err = 0; - - antenna_tx = B43legacy_ANTENNA_DEFAULT; - - mutex_lock(&wl->mutex); - dev = wl->current_dev; - phy = &dev->phy; - - if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) - b43legacy_set_retry_limits(dev, - conf->short_frame_max_tx_count, - conf->long_frame_max_tx_count); - changed &= ~IEEE80211_CONF_CHANGE_RETRY_LIMITS; - if (!changed) - goto out_unlock_mutex; - - /* Switch the PHY mode (if necessary). */ - switch (conf->chandef.chan->band) { - case IEEE80211_BAND_2GHZ: - if (phy->type == B43legacy_PHYTYPE_B) - new_phymode = B43legacy_PHYMODE_B; - else - new_phymode = B43legacy_PHYMODE_G; - break; - default: - B43legacy_WARN_ON(1); - } - err = b43legacy_switch_phymode(wl, new_phymode); - if (err) - goto out_unlock_mutex; - - /* Disable IRQs while reconfiguring the device. - * This makes it possible to drop the spinlock throughout - * the reconfiguration process. */ - spin_lock_irqsave(&wl->irq_lock, flags); - if (b43legacy_status(dev) < B43legacy_STAT_STARTED) { - spin_unlock_irqrestore(&wl->irq_lock, flags); - goto out_unlock_mutex; - } - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, 0); - spin_unlock_irqrestore(&wl->irq_lock, flags); - b43legacy_synchronize_irq(dev); - - /* Switch to the requested channel. - * The firmware takes care of races with the TX handler. */ - if (conf->chandef.chan->hw_value != phy->channel) - b43legacy_radio_selectchannel(dev, conf->chandef.chan->hw_value, - 0); - - dev->wl->radiotap_enabled = !!(conf->flags & IEEE80211_CONF_MONITOR); - - /* Adjust the desired TX power level. */ - if (conf->power_level != 0) { - if (conf->power_level != phy->power_level) { - phy->power_level = conf->power_level; - b43legacy_phy_xmitpower(dev); - } - } - - /* Antennas for RX and management frame TX. */ - b43legacy_mgmtframe_txantenna(dev, antenna_tx); - - if (wl->radio_enabled != phy->radio_on) { - if (wl->radio_enabled) { - b43legacy_radio_turn_on(dev); - b43legacyinfo(dev->wl, "Radio turned on by software\n"); - if (!dev->radio_hw_enable) - b43legacyinfo(dev->wl, "The hardware RF-kill" - " button still turns the radio" - " physically off. Press the" - " button to turn it on.\n"); - } else { - b43legacy_radio_turn_off(dev, 0); - b43legacyinfo(dev->wl, "Radio turned off by" - " software\n"); - } - } - - spin_lock_irqsave(&wl->irq_lock, flags); - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, dev->irq_mask); - mmiowb(); - spin_unlock_irqrestore(&wl->irq_lock, flags); -out_unlock_mutex: - mutex_unlock(&wl->mutex); - - return err; -} - -static void b43legacy_update_basic_rates(struct b43legacy_wldev *dev, u32 brates) -{ - struct ieee80211_supported_band *sband = - dev->wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ]; - struct ieee80211_rate *rate; - int i; - u16 basic, direct, offset, basic_offset, rateptr; - - for (i = 0; i < sband->n_bitrates; i++) { - rate = &sband->bitrates[i]; - - if (b43legacy_is_cck_rate(rate->hw_value)) { - direct = B43legacy_SHM_SH_CCKDIRECT; - basic = B43legacy_SHM_SH_CCKBASIC; - offset = b43legacy_plcp_get_ratecode_cck(rate->hw_value); - offset &= 0xF; - } else { - direct = B43legacy_SHM_SH_OFDMDIRECT; - basic = B43legacy_SHM_SH_OFDMBASIC; - offset = b43legacy_plcp_get_ratecode_ofdm(rate->hw_value); - offset &= 0xF; - } - - rate = ieee80211_get_response_rate(sband, brates, rate->bitrate); - - if (b43legacy_is_cck_rate(rate->hw_value)) { - basic_offset = b43legacy_plcp_get_ratecode_cck(rate->hw_value); - basic_offset &= 0xF; - } else { - basic_offset = b43legacy_plcp_get_ratecode_ofdm(rate->hw_value); - basic_offset &= 0xF; - } - - /* - * Get the pointer that we need to point to - * from the direct map - */ - rateptr = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - direct + 2 * basic_offset); - /* and write it to the basic map */ - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - basic + 2 * offset, rateptr); - } -} - -static void b43legacy_op_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *conf, - u32 changed) -{ - struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); - struct b43legacy_wldev *dev; - unsigned long flags; - - mutex_lock(&wl->mutex); - B43legacy_WARN_ON(wl->vif != vif); - - dev = wl->current_dev; - - /* Disable IRQs while reconfiguring the device. - * This makes it possible to drop the spinlock throughout - * the reconfiguration process. */ - spin_lock_irqsave(&wl->irq_lock, flags); - if (b43legacy_status(dev) < B43legacy_STAT_STARTED) { - spin_unlock_irqrestore(&wl->irq_lock, flags); - goto out_unlock_mutex; - } - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, 0); - - if (changed & BSS_CHANGED_BSSID) { - b43legacy_synchronize_irq(dev); - - if (conf->bssid) - memcpy(wl->bssid, conf->bssid, ETH_ALEN); - else - memset(wl->bssid, 0, ETH_ALEN); - } - - if (b43legacy_status(dev) >= B43legacy_STAT_INITIALIZED) { - if (changed & BSS_CHANGED_BEACON && - (b43legacy_is_mode(wl, NL80211_IFTYPE_AP) || - b43legacy_is_mode(wl, NL80211_IFTYPE_ADHOC))) - b43legacy_update_templates(wl); - - if (changed & BSS_CHANGED_BSSID) - b43legacy_write_mac_bssid_templates(dev); - } - spin_unlock_irqrestore(&wl->irq_lock, flags); - - b43legacy_mac_suspend(dev); - - if (changed & BSS_CHANGED_BEACON_INT && - (b43legacy_is_mode(wl, NL80211_IFTYPE_AP) || - b43legacy_is_mode(wl, NL80211_IFTYPE_ADHOC))) - b43legacy_set_beacon_int(dev, conf->beacon_int); - - if (changed & BSS_CHANGED_BASIC_RATES) - b43legacy_update_basic_rates(dev, conf->basic_rates); - - if (changed & BSS_CHANGED_ERP_SLOT) { - if (conf->use_short_slot) - b43legacy_short_slot_timing_enable(dev); - else - b43legacy_short_slot_timing_disable(dev); - } - - b43legacy_mac_enable(dev); - - spin_lock_irqsave(&wl->irq_lock, flags); - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, dev->irq_mask); - /* XXX: why? */ - mmiowb(); - spin_unlock_irqrestore(&wl->irq_lock, flags); - out_unlock_mutex: - mutex_unlock(&wl->mutex); -} - -static void b43legacy_op_configure_filter(struct ieee80211_hw *hw, - unsigned int changed, - unsigned int *fflags,u64 multicast) -{ - struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); - struct b43legacy_wldev *dev = wl->current_dev; - unsigned long flags; - - if (!dev) { - *fflags = 0; - return; - } - - spin_lock_irqsave(&wl->irq_lock, flags); - *fflags &= FIF_PROMISC_IN_BSS | - FIF_ALLMULTI | - FIF_FCSFAIL | - FIF_PLCPFAIL | - FIF_CONTROL | - FIF_OTHER_BSS | - FIF_BCN_PRBRESP_PROMISC; - - changed &= FIF_PROMISC_IN_BSS | - FIF_ALLMULTI | - FIF_FCSFAIL | - FIF_PLCPFAIL | - FIF_CONTROL | - FIF_OTHER_BSS | - FIF_BCN_PRBRESP_PROMISC; - - wl->filter_flags = *fflags; - - if (changed && b43legacy_status(dev) >= B43legacy_STAT_INITIALIZED) - b43legacy_adjust_opmode(dev); - spin_unlock_irqrestore(&wl->irq_lock, flags); -} - -/* Locking: wl->mutex */ -static void b43legacy_wireless_core_stop(struct b43legacy_wldev *dev) -{ - struct b43legacy_wl *wl = dev->wl; - unsigned long flags; - int queue_num; - - if (b43legacy_status(dev) < B43legacy_STAT_STARTED) - return; - - /* Disable and sync interrupts. We must do this before than - * setting the status to INITIALIZED, as the interrupt handler - * won't care about IRQs then. */ - spin_lock_irqsave(&wl->irq_lock, flags); - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, 0); - b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_MASK); /* flush */ - spin_unlock_irqrestore(&wl->irq_lock, flags); - b43legacy_synchronize_irq(dev); - - b43legacy_set_status(dev, B43legacy_STAT_INITIALIZED); - - mutex_unlock(&wl->mutex); - /* Must unlock as it would otherwise deadlock. No races here. - * Cancel the possibly running self-rearming periodic work. */ - cancel_delayed_work_sync(&dev->periodic_work); - cancel_work_sync(&wl->tx_work); - mutex_lock(&wl->mutex); - - /* Drain all TX queues. */ - for (queue_num = 0; queue_num < B43legacy_QOS_QUEUE_NUM; queue_num++) { - while (skb_queue_len(&wl->tx_queue[queue_num])) - dev_kfree_skb(skb_dequeue(&wl->tx_queue[queue_num])); - } - -b43legacy_mac_suspend(dev); - free_irq(dev->dev->irq, dev); - b43legacydbg(wl, "Wireless interface stopped\n"); -} - -/* Locking: wl->mutex */ -static int b43legacy_wireless_core_start(struct b43legacy_wldev *dev) -{ - int err; - - B43legacy_WARN_ON(b43legacy_status(dev) != B43legacy_STAT_INITIALIZED); - - drain_txstatus_queue(dev); - err = request_irq(dev->dev->irq, b43legacy_interrupt_handler, - IRQF_SHARED, KBUILD_MODNAME, dev); - if (err) { - b43legacyerr(dev->wl, "Cannot request IRQ-%d\n", - dev->dev->irq); - goto out; - } - /* We are ready to run. */ - ieee80211_wake_queues(dev->wl->hw); - b43legacy_set_status(dev, B43legacy_STAT_STARTED); - - /* Start data flow (TX/RX) */ - b43legacy_mac_enable(dev); - b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_MASK, dev->irq_mask); - - /* Start maintenance work */ - b43legacy_periodic_tasks_setup(dev); - - b43legacydbg(dev->wl, "Wireless interface started\n"); -out: - return err; -} - -/* Get PHY and RADIO versioning numbers */ -static int b43legacy_phy_versioning(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u32 tmp; - u8 analog_type; - u8 phy_type; - u8 phy_rev; - u16 radio_manuf; - u16 radio_ver; - u16 radio_rev; - int unsupported = 0; - - /* Get PHY versioning */ - tmp = b43legacy_read16(dev, B43legacy_MMIO_PHY_VER); - analog_type = (tmp & B43legacy_PHYVER_ANALOG) - >> B43legacy_PHYVER_ANALOG_SHIFT; - phy_type = (tmp & B43legacy_PHYVER_TYPE) >> B43legacy_PHYVER_TYPE_SHIFT; - phy_rev = (tmp & B43legacy_PHYVER_VERSION); - switch (phy_type) { - case B43legacy_PHYTYPE_B: - if (phy_rev != 2 && phy_rev != 4 - && phy_rev != 6 && phy_rev != 7) - unsupported = 1; - break; - case B43legacy_PHYTYPE_G: - if (phy_rev > 8) - unsupported = 1; - break; - default: - unsupported = 1; - } - if (unsupported) { - b43legacyerr(dev->wl, "FOUND UNSUPPORTED PHY " - "(Analog %u, Type %u, Revision %u)\n", - analog_type, phy_type, phy_rev); - return -EOPNOTSUPP; - } - b43legacydbg(dev->wl, "Found PHY: Analog %u, Type %u, Revision %u\n", - analog_type, phy_type, phy_rev); - - - /* Get RADIO versioning */ - if (dev->dev->bus->chip_id == 0x4317) { - if (dev->dev->bus->chip_rev == 0) - tmp = 0x3205017F; - else if (dev->dev->bus->chip_rev == 1) - tmp = 0x4205017F; - else - tmp = 0x5205017F; - } else { - b43legacy_write16(dev, B43legacy_MMIO_RADIO_CONTROL, - B43legacy_RADIOCTL_ID); - tmp = b43legacy_read16(dev, B43legacy_MMIO_RADIO_DATA_HIGH); - tmp <<= 16; - b43legacy_write16(dev, B43legacy_MMIO_RADIO_CONTROL, - B43legacy_RADIOCTL_ID); - tmp |= b43legacy_read16(dev, B43legacy_MMIO_RADIO_DATA_LOW); - } - radio_manuf = (tmp & 0x00000FFF); - radio_ver = (tmp & 0x0FFFF000) >> 12; - radio_rev = (tmp & 0xF0000000) >> 28; - switch (phy_type) { - case B43legacy_PHYTYPE_B: - if ((radio_ver & 0xFFF0) != 0x2050) - unsupported = 1; - break; - case B43legacy_PHYTYPE_G: - if (radio_ver != 0x2050) - unsupported = 1; - break; - default: - B43legacy_BUG_ON(1); - } - if (unsupported) { - b43legacyerr(dev->wl, "FOUND UNSUPPORTED RADIO " - "(Manuf 0x%X, Version 0x%X, Revision %u)\n", - radio_manuf, radio_ver, radio_rev); - return -EOPNOTSUPP; - } - b43legacydbg(dev->wl, "Found Radio: Manuf 0x%X, Version 0x%X," - " Revision %u\n", radio_manuf, radio_ver, radio_rev); - - - phy->radio_manuf = radio_manuf; - phy->radio_ver = radio_ver; - phy->radio_rev = radio_rev; - - phy->analog = analog_type; - phy->type = phy_type; - phy->rev = phy_rev; - - return 0; -} - -static void setup_struct_phy_for_init(struct b43legacy_wldev *dev, - struct b43legacy_phy *phy) -{ - struct b43legacy_lopair *lo; - int i; - - memset(phy->minlowsig, 0xFF, sizeof(phy->minlowsig)); - memset(phy->minlowsigpos, 0, sizeof(phy->minlowsigpos)); - - /* Assume the radio is enabled. If it's not enabled, the state will - * immediately get fixed on the first periodic work run. */ - dev->radio_hw_enable = true; - - phy->savedpctlreg = 0xFFFF; - phy->aci_enable = false; - phy->aci_wlan_automatic = false; - phy->aci_hw_rssi = false; - - lo = phy->_lo_pairs; - if (lo) - memset(lo, 0, sizeof(struct b43legacy_lopair) * - B43legacy_LO_COUNT); - phy->max_lb_gain = 0; - phy->trsw_rx_gain = 0; - - /* Set default attenuation values. */ - phy->bbatt = b43legacy_default_baseband_attenuation(dev); - phy->rfatt = b43legacy_default_radio_attenuation(dev); - phy->txctl1 = b43legacy_default_txctl1(dev); - phy->txpwr_offset = 0; - - /* NRSSI */ - phy->nrssislope = 0; - for (i = 0; i < ARRAY_SIZE(phy->nrssi); i++) - phy->nrssi[i] = -1000; - for (i = 0; i < ARRAY_SIZE(phy->nrssi_lt); i++) - phy->nrssi_lt[i] = i; - - phy->lofcal = 0xFFFF; - phy->initval = 0xFFFF; - - phy->interfmode = B43legacy_INTERFMODE_NONE; - phy->channel = 0xFF; -} - -static void setup_struct_wldev_for_init(struct b43legacy_wldev *dev) -{ - /* Flags */ - dev->dfq_valid = false; - - /* Stats */ - memset(&dev->stats, 0, sizeof(dev->stats)); - - setup_struct_phy_for_init(dev, &dev->phy); - - /* IRQ related flags */ - dev->irq_reason = 0; - memset(dev->dma_reason, 0, sizeof(dev->dma_reason)); - dev->irq_mask = B43legacy_IRQ_MASKTEMPLATE; - - dev->mac_suspended = 1; - - /* Noise calculation context */ - memset(&dev->noisecalc, 0, sizeof(dev->noisecalc)); -} - -static void b43legacy_set_synth_pu_delay(struct b43legacy_wldev *dev, - bool idle) { - u16 pu_delay = 1050; - - if (b43legacy_is_mode(dev->wl, NL80211_IFTYPE_ADHOC) || idle) - pu_delay = 500; - if ((dev->phy.radio_ver == 0x2050) && (dev->phy.radio_rev == 8)) - pu_delay = max(pu_delay, (u16)2400); - - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_SPUWKUP, pu_delay); -} - -/* Set the TSF CFP pre-TargetBeaconTransmissionTime. */ -static void b43legacy_set_pretbtt(struct b43legacy_wldev *dev) -{ - u16 pretbtt; - - /* The time value is in microseconds. */ - if (b43legacy_is_mode(dev->wl, NL80211_IFTYPE_ADHOC)) - pretbtt = 2; - else - pretbtt = 250; - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_PRETBTT, pretbtt); - b43legacy_write16(dev, B43legacy_MMIO_TSF_CFP_PRETBTT, pretbtt); -} - -/* Shutdown a wireless core */ -/* Locking: wl->mutex */ -static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u32 macctl; - - B43legacy_WARN_ON(b43legacy_status(dev) > B43legacy_STAT_INITIALIZED); - if (b43legacy_status(dev) != B43legacy_STAT_INITIALIZED) - return; - b43legacy_set_status(dev, B43legacy_STAT_UNINIT); - - /* Stop the microcode PSM. */ - macctl = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - macctl &= ~B43legacy_MACCTL_PSM_RUN; - macctl |= B43legacy_MACCTL_PSM_JMP0; - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl); - - b43legacy_leds_exit(dev); - b43legacy_rng_exit(dev->wl); - b43legacy_pio_free(dev); - b43legacy_dma_free(dev); - b43legacy_chip_exit(dev); - b43legacy_radio_turn_off(dev, 1); - b43legacy_switch_analog(dev, 0); - if (phy->dyn_tssi_tbl) - kfree(phy->tssi2dbm); - kfree(phy->lo_control); - phy->lo_control = NULL; - if (dev->wl->current_beacon) { - dev_kfree_skb_any(dev->wl->current_beacon); - dev->wl->current_beacon = NULL; - } - - ssb_device_disable(dev->dev, 0); - ssb_bus_may_powerdown(dev->dev->bus); -} - -static void prepare_phy_data_for_init(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - int i; - - /* Set default attenuation values. */ - phy->bbatt = b43legacy_default_baseband_attenuation(dev); - phy->rfatt = b43legacy_default_radio_attenuation(dev); - phy->txctl1 = b43legacy_default_txctl1(dev); - phy->txctl2 = 0xFFFF; - phy->txpwr_offset = 0; - - /* NRSSI */ - phy->nrssislope = 0; - for (i = 0; i < ARRAY_SIZE(phy->nrssi); i++) - phy->nrssi[i] = -1000; - for (i = 0; i < ARRAY_SIZE(phy->nrssi_lt); i++) - phy->nrssi_lt[i] = i; - - phy->lofcal = 0xFFFF; - phy->initval = 0xFFFF; - - phy->aci_enable = false; - phy->aci_wlan_automatic = false; - phy->aci_hw_rssi = false; - - phy->antenna_diversity = 0xFFFF; - memset(phy->minlowsig, 0xFF, sizeof(phy->minlowsig)); - memset(phy->minlowsigpos, 0, sizeof(phy->minlowsigpos)); - - /* Flags */ - phy->calibrated = 0; - - if (phy->_lo_pairs) - memset(phy->_lo_pairs, 0, - sizeof(struct b43legacy_lopair) * B43legacy_LO_COUNT); - memset(phy->loopback_gain, 0, sizeof(phy->loopback_gain)); -} - -/* Initialize a wireless core */ -static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev) -{ - struct b43legacy_wl *wl = dev->wl; - struct ssb_bus *bus = dev->dev->bus; - struct b43legacy_phy *phy = &dev->phy; - struct ssb_sprom *sprom = &dev->dev->bus->sprom; - int err; - u32 hf; - u32 tmp; - - B43legacy_WARN_ON(b43legacy_status(dev) != B43legacy_STAT_UNINIT); - - err = ssb_bus_powerup(bus, 0); - if (err) - goto out; - if (!ssb_device_is_enabled(dev->dev)) { - tmp = phy->gmode ? B43legacy_TMSLOW_GMODE : 0; - b43legacy_wireless_core_reset(dev, tmp); - } - - if ((phy->type == B43legacy_PHYTYPE_B) || - (phy->type == B43legacy_PHYTYPE_G)) { - phy->_lo_pairs = kzalloc(sizeof(struct b43legacy_lopair) - * B43legacy_LO_COUNT, - GFP_KERNEL); - if (!phy->_lo_pairs) - return -ENOMEM; - } - setup_struct_wldev_for_init(dev); - - err = b43legacy_phy_init_tssi2dbm_table(dev); - if (err) - goto err_kfree_lo_control; - - /* Enable IRQ routing to this device. */ - ssb_pcicore_dev_irqvecs_enable(&bus->pcicore, dev->dev); - - prepare_phy_data_for_init(dev); - b43legacy_phy_calibrate(dev); - err = b43legacy_chip_init(dev); - if (err) - goto err_kfree_tssitbl; - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_WLCOREREV, - dev->dev->id.revision); - hf = b43legacy_hf_read(dev); - if (phy->type == B43legacy_PHYTYPE_G) { - hf |= B43legacy_HF_SYMW; - if (phy->rev == 1) - hf |= B43legacy_HF_GDCW; - if (sprom->boardflags_lo & B43legacy_BFL_PACTRL) - hf |= B43legacy_HF_OFDMPABOOST; - } else if (phy->type == B43legacy_PHYTYPE_B) { - hf |= B43legacy_HF_SYMW; - if (phy->rev >= 2 && phy->radio_ver == 0x2050) - hf &= ~B43legacy_HF_GDCW; - } - b43legacy_hf_write(dev, hf); - - b43legacy_set_retry_limits(dev, - B43legacy_DEFAULT_SHORT_RETRY_LIMIT, - B43legacy_DEFAULT_LONG_RETRY_LIMIT); - - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - 0x0044, 3); - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - 0x0046, 2); - - /* Disable sending probe responses from firmware. - * Setting the MaxTime to one usec will always trigger - * a timeout, so we never send any probe resp. - * A timeout of zero is infinite. */ - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, - B43legacy_SHM_SH_PRMAXTIME, 1); - - b43legacy_rate_memory_init(dev); - - /* Minimum Contention Window */ - if (phy->type == B43legacy_PHYTYPE_B) - b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, - 0x0003, 31); - else - b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, - 0x0003, 15); - /* Maximum Contention Window */ - b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, - 0x0004, 1023); - - do { - if (b43legacy_using_pio(dev)) - err = b43legacy_pio_init(dev); - else { - err = b43legacy_dma_init(dev); - if (!err) - b43legacy_qos_init(dev); - } - } while (err == -EAGAIN); - if (err) - goto err_chip_exit; - - b43legacy_set_synth_pu_delay(dev, 1); - - ssb_bus_powerup(bus, 1); /* Enable dynamic PCTL */ - b43legacy_upload_card_macaddress(dev); - b43legacy_security_init(dev); - b43legacy_rng_init(wl); - - ieee80211_wake_queues(dev->wl->hw); - b43legacy_set_status(dev, B43legacy_STAT_INITIALIZED); - - b43legacy_leds_init(dev); -out: - return err; - -err_chip_exit: - b43legacy_chip_exit(dev); -err_kfree_tssitbl: - if (phy->dyn_tssi_tbl) - kfree(phy->tssi2dbm); -err_kfree_lo_control: - kfree(phy->lo_control); - phy->lo_control = NULL; - ssb_bus_may_powerdown(bus); - B43legacy_WARN_ON(b43legacy_status(dev) != B43legacy_STAT_UNINIT); - return err; -} - -static int b43legacy_op_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); - struct b43legacy_wldev *dev; - unsigned long flags; - int err = -EOPNOTSUPP; - - /* TODO: allow WDS/AP devices to coexist */ - - if (vif->type != NL80211_IFTYPE_AP && - vif->type != NL80211_IFTYPE_STATION && - vif->type != NL80211_IFTYPE_WDS && - vif->type != NL80211_IFTYPE_ADHOC) - return -EOPNOTSUPP; - - mutex_lock(&wl->mutex); - if (wl->operating) - goto out_mutex_unlock; - - b43legacydbg(wl, "Adding Interface type %d\n", vif->type); - - dev = wl->current_dev; - wl->operating = true; - wl->vif = vif; - wl->if_type = vif->type; - memcpy(wl->mac_addr, vif->addr, ETH_ALEN); - - spin_lock_irqsave(&wl->irq_lock, flags); - b43legacy_adjust_opmode(dev); - b43legacy_set_pretbtt(dev); - b43legacy_set_synth_pu_delay(dev, 0); - b43legacy_upload_card_macaddress(dev); - spin_unlock_irqrestore(&wl->irq_lock, flags); - - err = 0; - out_mutex_unlock: - mutex_unlock(&wl->mutex); - - return err; -} - -static void b43legacy_op_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); - struct b43legacy_wldev *dev = wl->current_dev; - unsigned long flags; - - b43legacydbg(wl, "Removing Interface type %d\n", vif->type); - - mutex_lock(&wl->mutex); - - B43legacy_WARN_ON(!wl->operating); - B43legacy_WARN_ON(wl->vif != vif); - wl->vif = NULL; - - wl->operating = false; - - spin_lock_irqsave(&wl->irq_lock, flags); - b43legacy_adjust_opmode(dev); - memset(wl->mac_addr, 0, ETH_ALEN); - b43legacy_upload_card_macaddress(dev); - spin_unlock_irqrestore(&wl->irq_lock, flags); - - mutex_unlock(&wl->mutex); -} - -static int b43legacy_op_start(struct ieee80211_hw *hw) -{ - struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); - struct b43legacy_wldev *dev = wl->current_dev; - int did_init = 0; - int err = 0; - - /* Kill all old instance specific information to make sure - * the card won't use it in the short timeframe between start - * and mac80211 reconfiguring it. */ - memset(wl->bssid, 0, ETH_ALEN); - memset(wl->mac_addr, 0, ETH_ALEN); - wl->filter_flags = 0; - wl->beacon0_uploaded = false; - wl->beacon1_uploaded = false; - wl->beacon_templates_virgin = true; - wl->radio_enabled = true; - - mutex_lock(&wl->mutex); - - if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) { - err = b43legacy_wireless_core_init(dev); - if (err) - goto out_mutex_unlock; - did_init = 1; - } - - if (b43legacy_status(dev) < B43legacy_STAT_STARTED) { - err = b43legacy_wireless_core_start(dev); - if (err) { - if (did_init) - b43legacy_wireless_core_exit(dev); - goto out_mutex_unlock; - } - } - - wiphy_rfkill_start_polling(hw->wiphy); - -out_mutex_unlock: - mutex_unlock(&wl->mutex); - - return err; -} - -static void b43legacy_op_stop(struct ieee80211_hw *hw) -{ - struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); - struct b43legacy_wldev *dev = wl->current_dev; - - cancel_work_sync(&(wl->beacon_update_trigger)); - - mutex_lock(&wl->mutex); - if (b43legacy_status(dev) >= B43legacy_STAT_STARTED) - b43legacy_wireless_core_stop(dev); - b43legacy_wireless_core_exit(dev); - wl->radio_enabled = false; - mutex_unlock(&wl->mutex); -} - -static int b43legacy_op_beacon_set_tim(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, bool set) -{ - struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); - unsigned long flags; - - spin_lock_irqsave(&wl->irq_lock, flags); - b43legacy_update_templates(wl); - spin_unlock_irqrestore(&wl->irq_lock, flags); - - return 0; -} - -static int b43legacy_op_get_survey(struct ieee80211_hw *hw, int idx, - struct survey_info *survey) -{ - struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); - struct b43legacy_wldev *dev = wl->current_dev; - struct ieee80211_conf *conf = &hw->conf; - - if (idx != 0) - return -ENOENT; - - survey->channel = conf->chandef.chan; - survey->filled = SURVEY_INFO_NOISE_DBM; - survey->noise = dev->stats.link_noise; - - return 0; -} - -static const struct ieee80211_ops b43legacy_hw_ops = { - .tx = b43legacy_op_tx, - .conf_tx = b43legacy_op_conf_tx, - .add_interface = b43legacy_op_add_interface, - .remove_interface = b43legacy_op_remove_interface, - .config = b43legacy_op_dev_config, - .bss_info_changed = b43legacy_op_bss_info_changed, - .configure_filter = b43legacy_op_configure_filter, - .get_stats = b43legacy_op_get_stats, - .start = b43legacy_op_start, - .stop = b43legacy_op_stop, - .set_tim = b43legacy_op_beacon_set_tim, - .get_survey = b43legacy_op_get_survey, - .rfkill_poll = b43legacy_rfkill_poll, -}; - -/* Hard-reset the chip. Do not call this directly. - * Use b43legacy_controller_restart() - */ -static void b43legacy_chip_reset(struct work_struct *work) -{ - struct b43legacy_wldev *dev = - container_of(work, struct b43legacy_wldev, restart_work); - struct b43legacy_wl *wl = dev->wl; - int err = 0; - int prev_status; - - mutex_lock(&wl->mutex); - - prev_status = b43legacy_status(dev); - /* Bring the device down... */ - if (prev_status >= B43legacy_STAT_STARTED) - b43legacy_wireless_core_stop(dev); - if (prev_status >= B43legacy_STAT_INITIALIZED) - b43legacy_wireless_core_exit(dev); - - /* ...and up again. */ - if (prev_status >= B43legacy_STAT_INITIALIZED) { - err = b43legacy_wireless_core_init(dev); - if (err) - goto out; - } - if (prev_status >= B43legacy_STAT_STARTED) { - err = b43legacy_wireless_core_start(dev); - if (err) { - b43legacy_wireless_core_exit(dev); - goto out; - } - } -out: - if (err) - wl->current_dev = NULL; /* Failed to init the dev. */ - mutex_unlock(&wl->mutex); - if (err) - b43legacyerr(wl, "Controller restart FAILED\n"); - else - b43legacyinfo(wl, "Controller restarted\n"); -} - -static int b43legacy_setup_modes(struct b43legacy_wldev *dev, - int have_bphy, - int have_gphy) -{ - struct ieee80211_hw *hw = dev->wl->hw; - struct b43legacy_phy *phy = &dev->phy; - - phy->possible_phymodes = 0; - if (have_bphy) { - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = - &b43legacy_band_2GHz_BPHY; - phy->possible_phymodes |= B43legacy_PHYMODE_B; - } - - if (have_gphy) { - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = - &b43legacy_band_2GHz_GPHY; - phy->possible_phymodes |= B43legacy_PHYMODE_G; - } - - return 0; -} - -static void b43legacy_wireless_core_detach(struct b43legacy_wldev *dev) -{ - /* We release firmware that late to not be required to re-request - * is all the time when we reinit the core. */ - b43legacy_release_firmware(dev); -} - -static int b43legacy_wireless_core_attach(struct b43legacy_wldev *dev) -{ - struct b43legacy_wl *wl = dev->wl; - struct ssb_bus *bus = dev->dev->bus; - struct pci_dev *pdev = (bus->bustype == SSB_BUSTYPE_PCI) ? bus->host_pci : NULL; - int err; - int have_bphy = 0; - int have_gphy = 0; - u32 tmp; - - /* Do NOT do any device initialization here. - * Do it in wireless_core_init() instead. - * This function is for gathering basic information about the HW, only. - * Also some structs may be set up here. But most likely you want to - * have that in core_init(), too. - */ - - err = ssb_bus_powerup(bus, 0); - if (err) { - b43legacyerr(wl, "Bus powerup failed\n"); - goto out; - } - /* Get the PHY type. */ - if (dev->dev->id.revision >= 5) { - u32 tmshigh; - - tmshigh = ssb_read32(dev->dev, SSB_TMSHIGH); - have_gphy = !!(tmshigh & B43legacy_TMSHIGH_GPHY); - if (!have_gphy) - have_bphy = 1; - } else if (dev->dev->id.revision == 4) - have_gphy = 1; - else - have_bphy = 1; - - dev->phy.gmode = (have_gphy || have_bphy); - dev->phy.radio_on = true; - tmp = dev->phy.gmode ? B43legacy_TMSLOW_GMODE : 0; - b43legacy_wireless_core_reset(dev, tmp); - - err = b43legacy_phy_versioning(dev); - if (err) - goto err_powerdown; - /* Check if this device supports multiband. */ - if (!pdev || - (pdev->device != 0x4312 && - pdev->device != 0x4319 && - pdev->device != 0x4324)) { - /* No multiband support. */ - have_bphy = 0; - have_gphy = 0; - switch (dev->phy.type) { - case B43legacy_PHYTYPE_B: - have_bphy = 1; - break; - case B43legacy_PHYTYPE_G: - have_gphy = 1; - break; - default: - B43legacy_BUG_ON(1); - } - } - dev->phy.gmode = (have_gphy || have_bphy); - tmp = dev->phy.gmode ? B43legacy_TMSLOW_GMODE : 0; - b43legacy_wireless_core_reset(dev, tmp); - - err = b43legacy_validate_chipaccess(dev); - if (err) - goto err_powerdown; - err = b43legacy_setup_modes(dev, have_bphy, have_gphy); - if (err) - goto err_powerdown; - - /* Now set some default "current_dev" */ - if (!wl->current_dev) - wl->current_dev = dev; - INIT_WORK(&dev->restart_work, b43legacy_chip_reset); - - b43legacy_radio_turn_off(dev, 1); - b43legacy_switch_analog(dev, 0); - ssb_device_disable(dev->dev, 0); - ssb_bus_may_powerdown(bus); - -out: - return err; - -err_powerdown: - ssb_bus_may_powerdown(bus); - return err; -} - -static void b43legacy_one_core_detach(struct ssb_device *dev) -{ - struct b43legacy_wldev *wldev; - struct b43legacy_wl *wl; - - /* Do not cancel ieee80211-workqueue based work here. - * See comment in b43legacy_remove(). */ - - wldev = ssb_get_drvdata(dev); - wl = wldev->wl; - b43legacy_debugfs_remove_device(wldev); - b43legacy_wireless_core_detach(wldev); - list_del(&wldev->list); - wl->nr_devs--; - ssb_set_drvdata(dev, NULL); - kfree(wldev); -} - -static int b43legacy_one_core_attach(struct ssb_device *dev, - struct b43legacy_wl *wl) -{ - struct b43legacy_wldev *wldev; - int err = -ENOMEM; - - wldev = kzalloc(sizeof(*wldev), GFP_KERNEL); - if (!wldev) - goto out; - - wldev->dev = dev; - wldev->wl = wl; - b43legacy_set_status(wldev, B43legacy_STAT_UNINIT); - wldev->bad_frames_preempt = modparam_bad_frames_preempt; - tasklet_init(&wldev->isr_tasklet, - (void (*)(unsigned long))b43legacy_interrupt_tasklet, - (unsigned long)wldev); - if (modparam_pio) - wldev->__using_pio = true; - INIT_LIST_HEAD(&wldev->list); - - err = b43legacy_wireless_core_attach(wldev); - if (err) - goto err_kfree_wldev; - - list_add(&wldev->list, &wl->devlist); - wl->nr_devs++; - ssb_set_drvdata(dev, wldev); - b43legacy_debugfs_add_device(wldev); -out: - return err; - -err_kfree_wldev: - kfree(wldev); - return err; -} - -static void b43legacy_sprom_fixup(struct ssb_bus *bus) -{ - /* boardflags workarounds */ - if (bus->boardinfo.vendor == PCI_VENDOR_ID_APPLE && - bus->boardinfo.type == 0x4E && - bus->sprom.board_rev > 0x40) - bus->sprom.boardflags_lo |= B43legacy_BFL_PACTRL; -} - -static void b43legacy_wireless_exit(struct ssb_device *dev, - struct b43legacy_wl *wl) -{ - struct ieee80211_hw *hw = wl->hw; - - ssb_set_devtypedata(dev, NULL); - ieee80211_free_hw(hw); -} - -static int b43legacy_wireless_init(struct ssb_device *dev) -{ - struct ssb_sprom *sprom = &dev->bus->sprom; - struct ieee80211_hw *hw; - struct b43legacy_wl *wl; - int err = -ENOMEM; - int queue_num; - - b43legacy_sprom_fixup(dev->bus); - - hw = ieee80211_alloc_hw(sizeof(*wl), &b43legacy_hw_ops); - if (!hw) { - b43legacyerr(NULL, "Could not allocate ieee80211 device\n"); - goto out; - } - - /* fill hw info */ - hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_SIGNAL_DBM; - hw->wiphy->interface_modes = - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_WDS) | - BIT(NL80211_IFTYPE_ADHOC); - hw->queues = 1; /* FIXME: hardware has more queues */ - hw->max_rates = 2; - SET_IEEE80211_DEV(hw, dev->dev); - if (is_valid_ether_addr(sprom->et1mac)) - SET_IEEE80211_PERM_ADDR(hw, sprom->et1mac); - else - SET_IEEE80211_PERM_ADDR(hw, sprom->il0mac); - - /* Get and initialize struct b43legacy_wl */ - wl = hw_to_b43legacy_wl(hw); - memset(wl, 0, sizeof(*wl)); - wl->hw = hw; - spin_lock_init(&wl->irq_lock); - spin_lock_init(&wl->leds_lock); - mutex_init(&wl->mutex); - INIT_LIST_HEAD(&wl->devlist); - INIT_WORK(&wl->beacon_update_trigger, b43legacy_beacon_update_trigger_work); - INIT_WORK(&wl->tx_work, b43legacy_tx_work); - - /* Initialize queues and flags. */ - for (queue_num = 0; queue_num < B43legacy_QOS_QUEUE_NUM; queue_num++) { - skb_queue_head_init(&wl->tx_queue[queue_num]); - wl->tx_queue_stopped[queue_num] = 0; - } - - ssb_set_devtypedata(dev, wl); - b43legacyinfo(wl, "Broadcom %04X WLAN found (core revision %u)\n", - dev->bus->chip_id, dev->id.revision); - err = 0; -out: - return err; -} - -static int b43legacy_probe(struct ssb_device *dev, - const struct ssb_device_id *id) -{ - struct b43legacy_wl *wl; - int err; - int first = 0; - - wl = ssb_get_devtypedata(dev); - if (!wl) { - /* Probing the first core - setup common struct b43legacy_wl */ - first = 1; - err = b43legacy_wireless_init(dev); - if (err) - goto out; - wl = ssb_get_devtypedata(dev); - B43legacy_WARN_ON(!wl); - } - err = b43legacy_one_core_attach(dev, wl); - if (err) - goto err_wireless_exit; - - /* setup and start work to load firmware */ - INIT_WORK(&wl->firmware_load, b43legacy_request_firmware); - schedule_work(&wl->firmware_load); - -out: - return err; - -err_wireless_exit: - if (first) - b43legacy_wireless_exit(dev, wl); - return err; -} - -static void b43legacy_remove(struct ssb_device *dev) -{ - struct b43legacy_wl *wl = ssb_get_devtypedata(dev); - struct b43legacy_wldev *wldev = ssb_get_drvdata(dev); - - /* We must cancel any work here before unregistering from ieee80211, - * as the ieee80211 unreg will destroy the workqueue. */ - cancel_work_sync(&wldev->restart_work); - cancel_work_sync(&wl->firmware_load); - - B43legacy_WARN_ON(!wl); - if (!wldev->fw.ucode) - return; /* NULL if fw never loaded */ - if (wl->current_dev == wldev) - ieee80211_unregister_hw(wl->hw); - - b43legacy_one_core_detach(dev); - - if (list_empty(&wl->devlist)) - /* Last core on the chip unregistered. - * We can destroy common struct b43legacy_wl. - */ - b43legacy_wireless_exit(dev, wl); -} - -/* Perform a hardware reset. This can be called from any context. */ -void b43legacy_controller_restart(struct b43legacy_wldev *dev, - const char *reason) -{ - /* Must avoid requeueing, if we are in shutdown. */ - if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) - return; - b43legacyinfo(dev->wl, "Controller RESET (%s) ...\n", reason); - ieee80211_queue_work(dev->wl->hw, &dev->restart_work); -} - -#ifdef CONFIG_PM - -static int b43legacy_suspend(struct ssb_device *dev, pm_message_t state) -{ - struct b43legacy_wldev *wldev = ssb_get_drvdata(dev); - struct b43legacy_wl *wl = wldev->wl; - - b43legacydbg(wl, "Suspending...\n"); - - mutex_lock(&wl->mutex); - wldev->suspend_init_status = b43legacy_status(wldev); - if (wldev->suspend_init_status >= B43legacy_STAT_STARTED) - b43legacy_wireless_core_stop(wldev); - if (wldev->suspend_init_status >= B43legacy_STAT_INITIALIZED) - b43legacy_wireless_core_exit(wldev); - mutex_unlock(&wl->mutex); - - b43legacydbg(wl, "Device suspended.\n"); - - return 0; -} - -static int b43legacy_resume(struct ssb_device *dev) -{ - struct b43legacy_wldev *wldev = ssb_get_drvdata(dev); - struct b43legacy_wl *wl = wldev->wl; - int err = 0; - - b43legacydbg(wl, "Resuming...\n"); - - mutex_lock(&wl->mutex); - if (wldev->suspend_init_status >= B43legacy_STAT_INITIALIZED) { - err = b43legacy_wireless_core_init(wldev); - if (err) { - b43legacyerr(wl, "Resume failed at core init\n"); - goto out; - } - } - if (wldev->suspend_init_status >= B43legacy_STAT_STARTED) { - err = b43legacy_wireless_core_start(wldev); - if (err) { - b43legacy_wireless_core_exit(wldev); - b43legacyerr(wl, "Resume failed at core start\n"); - goto out; - } - } - - b43legacydbg(wl, "Device resumed.\n"); -out: - mutex_unlock(&wl->mutex); - return err; -} - -#else /* CONFIG_PM */ -# define b43legacy_suspend NULL -# define b43legacy_resume NULL -#endif /* CONFIG_PM */ - -static struct ssb_driver b43legacy_ssb_driver = { - .name = KBUILD_MODNAME, - .id_table = b43legacy_ssb_tbl, - .probe = b43legacy_probe, - .remove = b43legacy_remove, - .suspend = b43legacy_suspend, - .resume = b43legacy_resume, -}; - -static void b43legacy_print_driverinfo(void) -{ - const char *feat_pci = "", *feat_leds = "", - *feat_pio = "", *feat_dma = ""; - -#ifdef CONFIG_B43LEGACY_PCI_AUTOSELECT - feat_pci = "P"; -#endif -#ifdef CONFIG_B43LEGACY_LEDS - feat_leds = "L"; -#endif -#ifdef CONFIG_B43LEGACY_PIO - feat_pio = "I"; -#endif -#ifdef CONFIG_B43LEGACY_DMA - feat_dma = "D"; -#endif - printk(KERN_INFO "Broadcom 43xx-legacy driver loaded " - "[ Features: %s%s%s%s ]\n", - feat_pci, feat_leds, feat_pio, feat_dma); -} - -static int __init b43legacy_init(void) -{ - int err; - - b43legacy_debugfs_init(); - - err = ssb_driver_register(&b43legacy_ssb_driver); - if (err) - goto err_dfs_exit; - - b43legacy_print_driverinfo(); - - return err; - -err_dfs_exit: - b43legacy_debugfs_exit(); - return err; -} - -static void __exit b43legacy_exit(void) -{ - ssb_driver_unregister(&b43legacy_ssb_driver); - b43legacy_debugfs_exit(); -} - -module_init(b43legacy_init) -module_exit(b43legacy_exit) diff --git a/drivers/net/wireless/b43legacy/main.h b/drivers/net/wireless/b43legacy/main.h deleted file mode 100644 index b74a058d7bac..000000000000 --- a/drivers/net/wireless/b43legacy/main.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - - Broadcom B43legacy wireless driver - - Copyright (c) 2005 Martin Langer , - Copyright (c) 2005 Stefano Brivio - Copyright (c) 2005, 2006 Michael Buesch - Copyright (c) 2005 Danny van Dyk - Copyright (c) 2005 Andreas Jaggi - Copyright (c) 2007 Larry Finger - - Some parts of the code in this file are derived from the ipw2200 - driver Copyright(c) 2003 - 2004 Intel Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#ifndef B43legacy_MAIN_H_ -#define B43legacy_MAIN_H_ - -#include "b43legacy.h" - - -#define P4D_BYT3S(magic, nr_bytes) u8 __p4dding##magic[nr_bytes] -#define P4D_BYTES(line, nr_bytes) P4D_BYT3S(line, nr_bytes) -/* Magic helper macro to pad structures. Ignore those above. It's magic. */ -#define PAD_BYTES(nr_bytes) P4D_BYTES(__LINE__ , (nr_bytes)) - - -/* Lightweight function to convert a frequency (in Mhz) to a channel number. */ -static inline -u8 b43legacy_freq_to_channel_bg(int freq) -{ - u8 channel; - - if (freq == 2484) - channel = 14; - else - channel = (freq - 2407) / 5; - - return channel; -} -static inline -u8 b43legacy_freq_to_channel(struct b43legacy_wldev *dev, - int freq) -{ - return b43legacy_freq_to_channel_bg(freq); -} - -/* Lightweight function to convert a channel number to a frequency (in Mhz). */ -static inline -int b43legacy_channel_to_freq_bg(u8 channel) -{ - int freq; - - if (channel == 14) - freq = 2484; - else - freq = 2407 + (5 * channel); - - return freq; -} - -static inline -int b43legacy_channel_to_freq(struct b43legacy_wldev *dev, - u8 channel) -{ - return b43legacy_channel_to_freq_bg(channel); -} - -static inline -int b43legacy_is_cck_rate(int rate) -{ - return (rate == B43legacy_CCK_RATE_1MB || - rate == B43legacy_CCK_RATE_2MB || - rate == B43legacy_CCK_RATE_5MB || - rate == B43legacy_CCK_RATE_11MB); -} - -static inline -int b43legacy_is_ofdm_rate(int rate) -{ - return !b43legacy_is_cck_rate(rate); -} - -void b43legacy_tsf_read(struct b43legacy_wldev *dev, u64 *tsf); -void b43legacy_tsf_write(struct b43legacy_wldev *dev, u64 tsf); - -u32 b43legacy_shm_read32(struct b43legacy_wldev *dev, - u16 routing, u16 offset); -u16 b43legacy_shm_read16(struct b43legacy_wldev *dev, - u16 routing, u16 offset); -void b43legacy_shm_write32(struct b43legacy_wldev *dev, - u16 routing, u16 offset, - u32 value); -void b43legacy_shm_write16(struct b43legacy_wldev *dev, - u16 routing, u16 offset, - u16 value); - -u32 b43legacy_hf_read(struct b43legacy_wldev *dev); -void b43legacy_hf_write(struct b43legacy_wldev *dev, u32 value); - -void b43legacy_dummy_transmission(struct b43legacy_wldev *dev); - -void b43legacy_wireless_core_reset(struct b43legacy_wldev *dev, u32 flags); - -void b43legacy_mac_suspend(struct b43legacy_wldev *dev); -void b43legacy_mac_enable(struct b43legacy_wldev *dev); - -void b43legacy_controller_restart(struct b43legacy_wldev *dev, - const char *reason); - -#endif /* B43legacy_MAIN_H_ */ diff --git a/drivers/net/wireless/b43legacy/phy.c b/drivers/net/wireless/b43legacy/phy.c deleted file mode 100644 index 995c7d0c212a..000000000000 --- a/drivers/net/wireless/b43legacy/phy.c +++ /dev/null @@ -1,2258 +0,0 @@ -/* - - Broadcom B43legacy wireless driver - - Copyright (c) 2005 Martin Langer , - Stefano Brivio - Michael Buesch - Danny van Dyk - Andreas Jaggi - Copyright (c) 2007 Larry Finger - - Some parts of the code in this file are derived from the ipw2200 - driver Copyright(c) 2003 - 2004 Intel Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include -#include -#include -#include -#include - -#include "b43legacy.h" -#include "phy.h" -#include "main.h" -#include "radio.h" -#include "ilt.h" - - -static const s8 b43legacy_tssi2dbm_b_table[] = { - 0x4D, 0x4C, 0x4B, 0x4A, - 0x4A, 0x49, 0x48, 0x47, - 0x47, 0x46, 0x45, 0x45, - 0x44, 0x43, 0x42, 0x42, - 0x41, 0x40, 0x3F, 0x3E, - 0x3D, 0x3C, 0x3B, 0x3A, - 0x39, 0x38, 0x37, 0x36, - 0x35, 0x34, 0x32, 0x31, - 0x30, 0x2F, 0x2D, 0x2C, - 0x2B, 0x29, 0x28, 0x26, - 0x25, 0x23, 0x21, 0x1F, - 0x1D, 0x1A, 0x17, 0x14, - 0x10, 0x0C, 0x06, 0x00, - -7, -7, -7, -7, - -7, -7, -7, -7, - -7, -7, -7, -7, -}; - -static const s8 b43legacy_tssi2dbm_g_table[] = { - 77, 77, 77, 76, - 76, 76, 75, 75, - 74, 74, 73, 73, - 73, 72, 72, 71, - 71, 70, 70, 69, - 68, 68, 67, 67, - 66, 65, 65, 64, - 63, 63, 62, 61, - 60, 59, 58, 57, - 56, 55, 54, 53, - 52, 50, 49, 47, - 45, 43, 40, 37, - 33, 28, 22, 14, - 5, -7, -20, -20, - -20, -20, -20, -20, - -20, -20, -20, -20, -}; - -static void b43legacy_phy_initg(struct b43legacy_wldev *dev); - - -static inline -void b43legacy_voluntary_preempt(void) -{ - B43legacy_BUG_ON(!(!in_atomic() && !in_irq() && - !in_interrupt() && !irqs_disabled())); -#ifndef CONFIG_PREEMPT - cond_resched(); -#endif /* CONFIG_PREEMPT */ -} - -/* Lock the PHY registers against concurrent access from the microcode. - * This lock is nonrecursive. */ -void b43legacy_phy_lock(struct b43legacy_wldev *dev) -{ -#if B43legacy_DEBUG - B43legacy_WARN_ON(dev->phy.phy_locked); - dev->phy.phy_locked = 1; -#endif - - if (dev->dev->id.revision < 3) { - b43legacy_mac_suspend(dev); - } else { - if (!b43legacy_is_mode(dev->wl, NL80211_IFTYPE_AP)) - b43legacy_power_saving_ctl_bits(dev, -1, 1); - } -} - -void b43legacy_phy_unlock(struct b43legacy_wldev *dev) -{ -#if B43legacy_DEBUG - B43legacy_WARN_ON(!dev->phy.phy_locked); - dev->phy.phy_locked = 0; -#endif - - if (dev->dev->id.revision < 3) { - b43legacy_mac_enable(dev); - } else { - if (!b43legacy_is_mode(dev->wl, NL80211_IFTYPE_AP)) - b43legacy_power_saving_ctl_bits(dev, -1, -1); - } -} - -u16 b43legacy_phy_read(struct b43legacy_wldev *dev, u16 offset) -{ - b43legacy_write16(dev, B43legacy_MMIO_PHY_CONTROL, offset); - return b43legacy_read16(dev, B43legacy_MMIO_PHY_DATA); -} - -void b43legacy_phy_write(struct b43legacy_wldev *dev, u16 offset, u16 val) -{ - b43legacy_write16(dev, B43legacy_MMIO_PHY_CONTROL, offset); - mmiowb(); - b43legacy_write16(dev, B43legacy_MMIO_PHY_DATA, val); -} - -void b43legacy_phy_calibrate(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - - b43legacy_read32(dev, B43legacy_MMIO_MACCTL); /* Dummy read. */ - if (phy->calibrated) - return; - if (phy->type == B43legacy_PHYTYPE_G && phy->rev == 1) { - b43legacy_wireless_core_reset(dev, 0); - b43legacy_phy_initg(dev); - b43legacy_wireless_core_reset(dev, B43legacy_TMSLOW_GMODE); - } - phy->calibrated = 1; -} - -/* initialize B PHY power control - * as described in http://bcm-specs.sipsolutions.net/InitPowerControl - */ -static void b43legacy_phy_init_pctl(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 saved_batt = 0; - u16 saved_ratt = 0; - u16 saved_txctl1 = 0; - int must_reset_txpower = 0; - - B43legacy_BUG_ON(!(phy->type == B43legacy_PHYTYPE_B || - phy->type == B43legacy_PHYTYPE_G)); - if (is_bcm_board_vendor(dev) && - (dev->dev->bus->boardinfo.type == 0x0416)) - return; - - b43legacy_phy_write(dev, 0x0028, 0x8018); - b43legacy_write16(dev, 0x03E6, b43legacy_read16(dev, 0x03E6) & 0xFFDF); - - if (phy->type == B43legacy_PHYTYPE_G) { - if (!phy->gmode) - return; - b43legacy_phy_write(dev, 0x047A, 0xC111); - } - if (phy->savedpctlreg != 0xFFFF) - return; -#ifdef CONFIG_B43LEGACY_DEBUG - if (phy->manual_txpower_control) - return; -#endif - - if (phy->type == B43legacy_PHYTYPE_B && - phy->rev >= 2 && - phy->radio_ver == 0x2050) - b43legacy_radio_write16(dev, 0x0076, - b43legacy_radio_read16(dev, 0x0076) - | 0x0084); - else { - saved_batt = phy->bbatt; - saved_ratt = phy->rfatt; - saved_txctl1 = phy->txctl1; - if ((phy->radio_rev >= 6) && (phy->radio_rev <= 8) - && /*FIXME: incomplete specs for 5 < revision < 9 */ 0) - b43legacy_radio_set_txpower_bg(dev, 0xB, 0x1F, 0); - else - b43legacy_radio_set_txpower_bg(dev, 0xB, 9, 0); - must_reset_txpower = 1; - } - b43legacy_dummy_transmission(dev); - - phy->savedpctlreg = b43legacy_phy_read(dev, B43legacy_PHY_G_PCTL); - - if (must_reset_txpower) - b43legacy_radio_set_txpower_bg(dev, saved_batt, saved_ratt, - saved_txctl1); - else - b43legacy_radio_write16(dev, 0x0076, b43legacy_radio_read16(dev, - 0x0076) & 0xFF7B); - b43legacy_radio_clear_tssi(dev); -} - -static void b43legacy_phy_agcsetup(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 offset = 0x0000; - - if (phy->rev == 1) - offset = 0x4C00; - - b43legacy_ilt_write(dev, offset, 0x00FE); - b43legacy_ilt_write(dev, offset + 1, 0x000D); - b43legacy_ilt_write(dev, offset + 2, 0x0013); - b43legacy_ilt_write(dev, offset + 3, 0x0019); - - if (phy->rev == 1) { - b43legacy_ilt_write(dev, 0x1800, 0x2710); - b43legacy_ilt_write(dev, 0x1801, 0x9B83); - b43legacy_ilt_write(dev, 0x1802, 0x9B83); - b43legacy_ilt_write(dev, 0x1803, 0x0F8D); - b43legacy_phy_write(dev, 0x0455, 0x0004); - } - - b43legacy_phy_write(dev, 0x04A5, (b43legacy_phy_read(dev, 0x04A5) - & 0x00FF) | 0x5700); - b43legacy_phy_write(dev, 0x041A, (b43legacy_phy_read(dev, 0x041A) - & 0xFF80) | 0x000F); - b43legacy_phy_write(dev, 0x041A, (b43legacy_phy_read(dev, 0x041A) - & 0xC07F) | 0x2B80); - b43legacy_phy_write(dev, 0x048C, (b43legacy_phy_read(dev, 0x048C) - & 0xF0FF) | 0x0300); - - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) - | 0x0008); - - b43legacy_phy_write(dev, 0x04A0, (b43legacy_phy_read(dev, 0x04A0) - & 0xFFF0) | 0x0008); - b43legacy_phy_write(dev, 0x04A1, (b43legacy_phy_read(dev, 0x04A1) - & 0xF0FF) | 0x0600); - b43legacy_phy_write(dev, 0x04A2, (b43legacy_phy_read(dev, 0x04A2) - & 0xF0FF) | 0x0700); - b43legacy_phy_write(dev, 0x04A0, (b43legacy_phy_read(dev, 0x04A0) - & 0xF0FF) | 0x0100); - - if (phy->rev == 1) - b43legacy_phy_write(dev, 0x04A2, - (b43legacy_phy_read(dev, 0x04A2) - & 0xFFF0) | 0x0007); - - b43legacy_phy_write(dev, 0x0488, (b43legacy_phy_read(dev, 0x0488) - & 0xFF00) | 0x001C); - b43legacy_phy_write(dev, 0x0488, (b43legacy_phy_read(dev, 0x0488) - & 0xC0FF) | 0x0200); - b43legacy_phy_write(dev, 0x0496, (b43legacy_phy_read(dev, 0x0496) - & 0xFF00) | 0x001C); - b43legacy_phy_write(dev, 0x0489, (b43legacy_phy_read(dev, 0x0489) - & 0xFF00) | 0x0020); - b43legacy_phy_write(dev, 0x0489, (b43legacy_phy_read(dev, 0x0489) - & 0xC0FF) | 0x0200); - b43legacy_phy_write(dev, 0x0482, (b43legacy_phy_read(dev, 0x0482) - & 0xFF00) | 0x002E); - b43legacy_phy_write(dev, 0x0496, (b43legacy_phy_read(dev, 0x0496) - & 0x00FF) | 0x1A00); - b43legacy_phy_write(dev, 0x0481, (b43legacy_phy_read(dev, 0x0481) - & 0xFF00) | 0x0028); - b43legacy_phy_write(dev, 0x0481, (b43legacy_phy_read(dev, 0x0481) - & 0x00FF) | 0x2C00); - - if (phy->rev == 1) { - b43legacy_phy_write(dev, 0x0430, 0x092B); - b43legacy_phy_write(dev, 0x041B, - (b43legacy_phy_read(dev, 0x041B) - & 0xFFE1) | 0x0002); - } else { - b43legacy_phy_write(dev, 0x041B, - b43legacy_phy_read(dev, 0x041B) & 0xFFE1); - b43legacy_phy_write(dev, 0x041F, 0x287A); - b43legacy_phy_write(dev, 0x0420, - (b43legacy_phy_read(dev, 0x0420) - & 0xFFF0) | 0x0004); - } - - if (phy->rev > 2) { - b43legacy_phy_write(dev, 0x0422, 0x287A); - b43legacy_phy_write(dev, 0x0420, - (b43legacy_phy_read(dev, 0x0420) - & 0x0FFF) | 0x3000); - } - - b43legacy_phy_write(dev, 0x04A8, (b43legacy_phy_read(dev, 0x04A8) - & 0x8080) | 0x7874); - b43legacy_phy_write(dev, 0x048E, 0x1C00); - - if (phy->rev == 1) { - b43legacy_phy_write(dev, 0x04AB, - (b43legacy_phy_read(dev, 0x04AB) - & 0xF0FF) | 0x0600); - b43legacy_phy_write(dev, 0x048B, 0x005E); - b43legacy_phy_write(dev, 0x048C, - (b43legacy_phy_read(dev, 0x048C) & 0xFF00) - | 0x001E); - b43legacy_phy_write(dev, 0x048D, 0x0002); - } - - b43legacy_ilt_write(dev, offset + 0x0800, 0); - b43legacy_ilt_write(dev, offset + 0x0801, 7); - b43legacy_ilt_write(dev, offset + 0x0802, 16); - b43legacy_ilt_write(dev, offset + 0x0803, 28); - - if (phy->rev >= 6) { - b43legacy_phy_write(dev, 0x0426, - (b43legacy_phy_read(dev, 0x0426) & 0xFFFC)); - b43legacy_phy_write(dev, 0x0426, - (b43legacy_phy_read(dev, 0x0426) & 0xEFFF)); - } -} - -static void b43legacy_phy_setupg(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 i; - - B43legacy_BUG_ON(phy->type != B43legacy_PHYTYPE_G); - if (phy->rev == 1) { - b43legacy_phy_write(dev, 0x0406, 0x4F19); - b43legacy_phy_write(dev, B43legacy_PHY_G_CRS, - (b43legacy_phy_read(dev, - B43legacy_PHY_G_CRS) & 0xFC3F) | 0x0340); - b43legacy_phy_write(dev, 0x042C, 0x005A); - b43legacy_phy_write(dev, 0x0427, 0x001A); - - for (i = 0; i < B43legacy_ILT_FINEFREQG_SIZE; i++) - b43legacy_ilt_write(dev, 0x5800 + i, - b43legacy_ilt_finefreqg[i]); - for (i = 0; i < B43legacy_ILT_NOISEG1_SIZE; i++) - b43legacy_ilt_write(dev, 0x1800 + i, - b43legacy_ilt_noiseg1[i]); - for (i = 0; i < B43legacy_ILT_ROTOR_SIZE; i++) - b43legacy_ilt_write32(dev, 0x2000 + i, - b43legacy_ilt_rotor[i]); - } else { - /* nrssi values are signed 6-bit values. Why 0x7654 here? */ - b43legacy_nrssi_hw_write(dev, 0xBA98, (s16)0x7654); - - if (phy->rev == 2) { - b43legacy_phy_write(dev, 0x04C0, 0x1861); - b43legacy_phy_write(dev, 0x04C1, 0x0271); - } else if (phy->rev > 2) { - b43legacy_phy_write(dev, 0x04C0, 0x0098); - b43legacy_phy_write(dev, 0x04C1, 0x0070); - b43legacy_phy_write(dev, 0x04C9, 0x0080); - } - b43legacy_phy_write(dev, 0x042B, b43legacy_phy_read(dev, - 0x042B) | 0x800); - - for (i = 0; i < 64; i++) - b43legacy_ilt_write(dev, 0x4000 + i, i); - for (i = 0; i < B43legacy_ILT_NOISEG2_SIZE; i++) - b43legacy_ilt_write(dev, 0x1800 + i, - b43legacy_ilt_noiseg2[i]); - } - - if (phy->rev <= 2) - for (i = 0; i < B43legacy_ILT_NOISESCALEG_SIZE; i++) - b43legacy_ilt_write(dev, 0x1400 + i, - b43legacy_ilt_noisescaleg1[i]); - else if ((phy->rev >= 7) && (b43legacy_phy_read(dev, 0x0449) & 0x0200)) - for (i = 0; i < B43legacy_ILT_NOISESCALEG_SIZE; i++) - b43legacy_ilt_write(dev, 0x1400 + i, - b43legacy_ilt_noisescaleg3[i]); - else - for (i = 0; i < B43legacy_ILT_NOISESCALEG_SIZE; i++) - b43legacy_ilt_write(dev, 0x1400 + i, - b43legacy_ilt_noisescaleg2[i]); - - if (phy->rev == 2) - for (i = 0; i < B43legacy_ILT_SIGMASQR_SIZE; i++) - b43legacy_ilt_write(dev, 0x5000 + i, - b43legacy_ilt_sigmasqr1[i]); - else if ((phy->rev > 2) && (phy->rev <= 8)) - for (i = 0; i < B43legacy_ILT_SIGMASQR_SIZE; i++) - b43legacy_ilt_write(dev, 0x5000 + i, - b43legacy_ilt_sigmasqr2[i]); - - if (phy->rev == 1) { - for (i = 0; i < B43legacy_ILT_RETARD_SIZE; i++) - b43legacy_ilt_write32(dev, 0x2400 + i, - b43legacy_ilt_retard[i]); - for (i = 4; i < 20; i++) - b43legacy_ilt_write(dev, 0x5400 + i, 0x0020); - b43legacy_phy_agcsetup(dev); - - if (is_bcm_board_vendor(dev) && - (dev->dev->bus->boardinfo.type == 0x0416) && - (dev->dev->bus->sprom.board_rev == 0x0017)) - return; - - b43legacy_ilt_write(dev, 0x5001, 0x0002); - b43legacy_ilt_write(dev, 0x5002, 0x0001); - } else { - for (i = 0; i <= 0x20; i++) - b43legacy_ilt_write(dev, 0x1000 + i, 0x0820); - b43legacy_phy_agcsetup(dev); - b43legacy_phy_read(dev, 0x0400); /* dummy read */ - b43legacy_phy_write(dev, 0x0403, 0x1000); - b43legacy_ilt_write(dev, 0x3C02, 0x000F); - b43legacy_ilt_write(dev, 0x3C03, 0x0014); - - if (is_bcm_board_vendor(dev) && - (dev->dev->bus->boardinfo.type == 0x0416) && - (dev->dev->bus->sprom.board_rev == 0x0017)) - return; - - b43legacy_ilt_write(dev, 0x0401, 0x0002); - b43legacy_ilt_write(dev, 0x0402, 0x0001); - } -} - -/* Initialize the APHY portion of a GPHY. */ -static void b43legacy_phy_inita(struct b43legacy_wldev *dev) -{ - - might_sleep(); - - b43legacy_phy_setupg(dev); - if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_PACTRL) - b43legacy_phy_write(dev, 0x046E, 0x03CF); -} - -static void b43legacy_phy_initb2(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 offset; - int val; - - b43legacy_write16(dev, 0x03EC, 0x3F22); - b43legacy_phy_write(dev, 0x0020, 0x301C); - b43legacy_phy_write(dev, 0x0026, 0x0000); - b43legacy_phy_write(dev, 0x0030, 0x00C6); - b43legacy_phy_write(dev, 0x0088, 0x3E00); - val = 0x3C3D; - for (offset = 0x0089; offset < 0x00A7; offset++) { - b43legacy_phy_write(dev, offset, val); - val -= 0x0202; - } - b43legacy_phy_write(dev, 0x03E4, 0x3000); - b43legacy_radio_selectchannel(dev, phy->channel, 0); - if (phy->radio_ver != 0x2050) { - b43legacy_radio_write16(dev, 0x0075, 0x0080); - b43legacy_radio_write16(dev, 0x0079, 0x0081); - } - b43legacy_radio_write16(dev, 0x0050, 0x0020); - b43legacy_radio_write16(dev, 0x0050, 0x0023); - if (phy->radio_ver == 0x2050) { - b43legacy_radio_write16(dev, 0x0050, 0x0020); - b43legacy_radio_write16(dev, 0x005A, 0x0070); - b43legacy_radio_write16(dev, 0x005B, 0x007B); - b43legacy_radio_write16(dev, 0x005C, 0x00B0); - b43legacy_radio_write16(dev, 0x007A, 0x000F); - b43legacy_phy_write(dev, 0x0038, 0x0677); - b43legacy_radio_init2050(dev); - } - b43legacy_phy_write(dev, 0x0014, 0x0080); - b43legacy_phy_write(dev, 0x0032, 0x00CA); - b43legacy_phy_write(dev, 0x0032, 0x00CC); - b43legacy_phy_write(dev, 0x0035, 0x07C2); - b43legacy_phy_lo_b_measure(dev); - b43legacy_phy_write(dev, 0x0026, 0xCC00); - if (phy->radio_ver != 0x2050) - b43legacy_phy_write(dev, 0x0026, 0xCE00); - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL_EXT, 0x1000); - b43legacy_phy_write(dev, 0x002A, 0x88A3); - if (phy->radio_ver != 0x2050) - b43legacy_phy_write(dev, 0x002A, 0x88C2); - b43legacy_radio_set_txpower_bg(dev, 0xFFFF, 0xFFFF, 0xFFFF); - b43legacy_phy_init_pctl(dev); -} - -static void b43legacy_phy_initb4(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 offset; - u16 val; - - b43legacy_write16(dev, 0x03EC, 0x3F22); - b43legacy_phy_write(dev, 0x0020, 0x301C); - b43legacy_phy_write(dev, 0x0026, 0x0000); - b43legacy_phy_write(dev, 0x0030, 0x00C6); - b43legacy_phy_write(dev, 0x0088, 0x3E00); - val = 0x3C3D; - for (offset = 0x0089; offset < 0x00A7; offset++) { - b43legacy_phy_write(dev, offset, val); - val -= 0x0202; - } - b43legacy_phy_write(dev, 0x03E4, 0x3000); - b43legacy_radio_selectchannel(dev, phy->channel, 0); - if (phy->radio_ver != 0x2050) { - b43legacy_radio_write16(dev, 0x0075, 0x0080); - b43legacy_radio_write16(dev, 0x0079, 0x0081); - } - b43legacy_radio_write16(dev, 0x0050, 0x0020); - b43legacy_radio_write16(dev, 0x0050, 0x0023); - if (phy->radio_ver == 0x2050) { - b43legacy_radio_write16(dev, 0x0050, 0x0020); - b43legacy_radio_write16(dev, 0x005A, 0x0070); - b43legacy_radio_write16(dev, 0x005B, 0x007B); - b43legacy_radio_write16(dev, 0x005C, 0x00B0); - b43legacy_radio_write16(dev, 0x007A, 0x000F); - b43legacy_phy_write(dev, 0x0038, 0x0677); - b43legacy_radio_init2050(dev); - } - b43legacy_phy_write(dev, 0x0014, 0x0080); - b43legacy_phy_write(dev, 0x0032, 0x00CA); - if (phy->radio_ver == 0x2050) - b43legacy_phy_write(dev, 0x0032, 0x00E0); - b43legacy_phy_write(dev, 0x0035, 0x07C2); - - b43legacy_phy_lo_b_measure(dev); - - b43legacy_phy_write(dev, 0x0026, 0xCC00); - if (phy->radio_ver == 0x2050) - b43legacy_phy_write(dev, 0x0026, 0xCE00); - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL_EXT, 0x1100); - b43legacy_phy_write(dev, 0x002A, 0x88A3); - if (phy->radio_ver == 0x2050) - b43legacy_phy_write(dev, 0x002A, 0x88C2); - b43legacy_radio_set_txpower_bg(dev, 0xFFFF, 0xFFFF, 0xFFFF); - if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_RSSI) { - b43legacy_calc_nrssi_slope(dev); - b43legacy_calc_nrssi_threshold(dev); - } - b43legacy_phy_init_pctl(dev); -} - -static void b43legacy_phy_initb5(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 offset; - u16 value; - u8 old_channel; - - if (phy->analog == 1) - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) - | 0x0050); - if (!is_bcm_board_vendor(dev) && - (dev->dev->bus->boardinfo.type != 0x0416)) { - value = 0x2120; - for (offset = 0x00A8 ; offset < 0x00C7; offset++) { - b43legacy_phy_write(dev, offset, value); - value += 0x0202; - } - } - b43legacy_phy_write(dev, 0x0035, - (b43legacy_phy_read(dev, 0x0035) & 0xF0FF) - | 0x0700); - if (phy->radio_ver == 0x2050) - b43legacy_phy_write(dev, 0x0038, 0x0667); - - if (phy->gmode) { - if (phy->radio_ver == 0x2050) { - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) - | 0x0020); - b43legacy_radio_write16(dev, 0x0051, - b43legacy_radio_read16(dev, 0x0051) - | 0x0004); - } - b43legacy_write16(dev, B43legacy_MMIO_PHY_RADIO, 0x0000); - - b43legacy_phy_write(dev, 0x0802, b43legacy_phy_read(dev, 0x0802) - | 0x0100); - b43legacy_phy_write(dev, 0x042B, b43legacy_phy_read(dev, 0x042B) - | 0x2000); - - b43legacy_phy_write(dev, 0x001C, 0x186A); - - b43legacy_phy_write(dev, 0x0013, (b43legacy_phy_read(dev, - 0x0013) & 0x00FF) | 0x1900); - b43legacy_phy_write(dev, 0x0035, (b43legacy_phy_read(dev, - 0x0035) & 0xFFC0) | 0x0064); - b43legacy_phy_write(dev, 0x005D, (b43legacy_phy_read(dev, - 0x005D) & 0xFF80) | 0x000A); - b43legacy_phy_write(dev, 0x5B, 0x0000); - b43legacy_phy_write(dev, 0x5C, 0x0000); - } - - if (dev->bad_frames_preempt) - b43legacy_phy_write(dev, B43legacy_PHY_RADIO_BITFIELD, - b43legacy_phy_read(dev, - B43legacy_PHY_RADIO_BITFIELD) | (1 << 12)); - - if (phy->analog == 1) { - b43legacy_phy_write(dev, 0x0026, 0xCE00); - b43legacy_phy_write(dev, 0x0021, 0x3763); - b43legacy_phy_write(dev, 0x0022, 0x1BC3); - b43legacy_phy_write(dev, 0x0023, 0x06F9); - b43legacy_phy_write(dev, 0x0024, 0x037E); - } else - b43legacy_phy_write(dev, 0x0026, 0xCC00); - b43legacy_phy_write(dev, 0x0030, 0x00C6); - b43legacy_write16(dev, 0x03EC, 0x3F22); - - if (phy->analog == 1) - b43legacy_phy_write(dev, 0x0020, 0x3E1C); - else - b43legacy_phy_write(dev, 0x0020, 0x301C); - - if (phy->analog == 0) - b43legacy_write16(dev, 0x03E4, 0x3000); - - old_channel = (phy->channel == 0xFF) ? 1 : phy->channel; - /* Force to channel 7, even if not supported. */ - b43legacy_radio_selectchannel(dev, 7, 0); - - if (phy->radio_ver != 0x2050) { - b43legacy_radio_write16(dev, 0x0075, 0x0080); - b43legacy_radio_write16(dev, 0x0079, 0x0081); - } - - b43legacy_radio_write16(dev, 0x0050, 0x0020); - b43legacy_radio_write16(dev, 0x0050, 0x0023); - - if (phy->radio_ver == 0x2050) { - b43legacy_radio_write16(dev, 0x0050, 0x0020); - b43legacy_radio_write16(dev, 0x005A, 0x0070); - } - - b43legacy_radio_write16(dev, 0x005B, 0x007B); - b43legacy_radio_write16(dev, 0x005C, 0x00B0); - - b43legacy_radio_write16(dev, 0x007A, b43legacy_radio_read16(dev, - 0x007A) | 0x0007); - - b43legacy_radio_selectchannel(dev, old_channel, 0); - - b43legacy_phy_write(dev, 0x0014, 0x0080); - b43legacy_phy_write(dev, 0x0032, 0x00CA); - b43legacy_phy_write(dev, 0x002A, 0x88A3); - - b43legacy_radio_set_txpower_bg(dev, 0xFFFF, 0xFFFF, 0xFFFF); - - if (phy->radio_ver == 0x2050) - b43legacy_radio_write16(dev, 0x005D, 0x000D); - - b43legacy_write16(dev, 0x03E4, (b43legacy_read16(dev, 0x03E4) & - 0xFFC0) | 0x0004); -} - -static void b43legacy_phy_initb6(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 offset; - u16 val; - u8 old_channel; - - b43legacy_phy_write(dev, 0x003E, 0x817A); - b43legacy_radio_write16(dev, 0x007A, - (b43legacy_radio_read16(dev, 0x007A) | 0x0058)); - if (phy->radio_rev == 4 || - phy->radio_rev == 5) { - b43legacy_radio_write16(dev, 0x0051, 0x0037); - b43legacy_radio_write16(dev, 0x0052, 0x0070); - b43legacy_radio_write16(dev, 0x0053, 0x00B3); - b43legacy_radio_write16(dev, 0x0054, 0x009B); - b43legacy_radio_write16(dev, 0x005A, 0x0088); - b43legacy_radio_write16(dev, 0x005B, 0x0088); - b43legacy_radio_write16(dev, 0x005D, 0x0088); - b43legacy_radio_write16(dev, 0x005E, 0x0088); - b43legacy_radio_write16(dev, 0x007D, 0x0088); - b43legacy_shm_write32(dev, B43legacy_SHM_SHARED, - B43legacy_UCODEFLAGS_OFFSET, - (b43legacy_shm_read32(dev, - B43legacy_SHM_SHARED, - B43legacy_UCODEFLAGS_OFFSET) - | 0x00000200)); - } - if (phy->radio_rev == 8) { - b43legacy_radio_write16(dev, 0x0051, 0x0000); - b43legacy_radio_write16(dev, 0x0052, 0x0040); - b43legacy_radio_write16(dev, 0x0053, 0x00B7); - b43legacy_radio_write16(dev, 0x0054, 0x0098); - b43legacy_radio_write16(dev, 0x005A, 0x0088); - b43legacy_radio_write16(dev, 0x005B, 0x006B); - b43legacy_radio_write16(dev, 0x005C, 0x000F); - if (dev->dev->bus->sprom.boardflags_lo & 0x8000) { - b43legacy_radio_write16(dev, 0x005D, 0x00FA); - b43legacy_radio_write16(dev, 0x005E, 0x00D8); - } else { - b43legacy_radio_write16(dev, 0x005D, 0x00F5); - b43legacy_radio_write16(dev, 0x005E, 0x00B8); - } - b43legacy_radio_write16(dev, 0x0073, 0x0003); - b43legacy_radio_write16(dev, 0x007D, 0x00A8); - b43legacy_radio_write16(dev, 0x007C, 0x0001); - b43legacy_radio_write16(dev, 0x007E, 0x0008); - } - val = 0x1E1F; - for (offset = 0x0088; offset < 0x0098; offset++) { - b43legacy_phy_write(dev, offset, val); - val -= 0x0202; - } - val = 0x3E3F; - for (offset = 0x0098; offset < 0x00A8; offset++) { - b43legacy_phy_write(dev, offset, val); - val -= 0x0202; - } - val = 0x2120; - for (offset = 0x00A8; offset < 0x00C8; offset++) { - b43legacy_phy_write(dev, offset, (val & 0x3F3F)); - val += 0x0202; - } - if (phy->type == B43legacy_PHYTYPE_G) { - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) | - 0x0020); - b43legacy_radio_write16(dev, 0x0051, - b43legacy_radio_read16(dev, 0x0051) | - 0x0004); - b43legacy_phy_write(dev, 0x0802, - b43legacy_phy_read(dev, 0x0802) | 0x0100); - b43legacy_phy_write(dev, 0x042B, - b43legacy_phy_read(dev, 0x042B) | 0x2000); - b43legacy_phy_write(dev, 0x5B, 0x0000); - b43legacy_phy_write(dev, 0x5C, 0x0000); - } - - old_channel = phy->channel; - if (old_channel >= 8) - b43legacy_radio_selectchannel(dev, 1, 0); - else - b43legacy_radio_selectchannel(dev, 13, 0); - - b43legacy_radio_write16(dev, 0x0050, 0x0020); - b43legacy_radio_write16(dev, 0x0050, 0x0023); - udelay(40); - if (phy->radio_rev < 6 || phy->radio_rev == 8) { - b43legacy_radio_write16(dev, 0x007C, - (b43legacy_radio_read16(dev, 0x007C) - | 0x0002)); - b43legacy_radio_write16(dev, 0x0050, 0x0020); - } - if (phy->radio_rev <= 2) { - b43legacy_radio_write16(dev, 0x0050, 0x0020); - b43legacy_radio_write16(dev, 0x005A, 0x0070); - b43legacy_radio_write16(dev, 0x005B, 0x007B); - b43legacy_radio_write16(dev, 0x005C, 0x00B0); - } - b43legacy_radio_write16(dev, 0x007A, - (b43legacy_radio_read16(dev, - 0x007A) & 0x00F8) | 0x0007); - - b43legacy_radio_selectchannel(dev, old_channel, 0); - - b43legacy_phy_write(dev, 0x0014, 0x0200); - if (phy->radio_rev >= 6) - b43legacy_phy_write(dev, 0x002A, 0x88C2); - else - b43legacy_phy_write(dev, 0x002A, 0x8AC0); - b43legacy_phy_write(dev, 0x0038, 0x0668); - b43legacy_radio_set_txpower_bg(dev, 0xFFFF, 0xFFFF, 0xFFFF); - if (phy->radio_rev == 4 || phy->radio_rev == 5) - b43legacy_phy_write(dev, 0x005D, (b43legacy_phy_read(dev, - 0x005D) & 0xFF80) | 0x0003); - if (phy->radio_rev <= 2) - b43legacy_radio_write16(dev, 0x005D, 0x000D); - - if (phy->analog == 4) { - b43legacy_write16(dev, 0x03E4, 0x0009); - b43legacy_phy_write(dev, 0x61, b43legacy_phy_read(dev, 0x61) - & 0xFFF); - } else - b43legacy_phy_write(dev, 0x0002, (b43legacy_phy_read(dev, - 0x0002) & 0xFFC0) | 0x0004); - if (phy->type == B43legacy_PHYTYPE_G) - b43legacy_write16(dev, 0x03E6, 0x0); - if (phy->type == B43legacy_PHYTYPE_B) { - b43legacy_write16(dev, 0x03E6, 0x8140); - b43legacy_phy_write(dev, 0x0016, 0x0410); - b43legacy_phy_write(dev, 0x0017, 0x0820); - b43legacy_phy_write(dev, 0x0062, 0x0007); - b43legacy_radio_init2050(dev); - b43legacy_phy_lo_g_measure(dev); - if (dev->dev->bus->sprom.boardflags_lo & - B43legacy_BFL_RSSI) { - b43legacy_calc_nrssi_slope(dev); - b43legacy_calc_nrssi_threshold(dev); - } - b43legacy_phy_init_pctl(dev); - } -} - -static void b43legacy_calc_loopback_gain(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 backup_phy[15] = {0}; - u16 backup_radio[3]; - u16 backup_bband; - u16 i; - u16 loop1_cnt; - u16 loop1_done; - u16 loop1_omitted; - u16 loop2_done; - - backup_phy[0] = b43legacy_phy_read(dev, 0x0429); - backup_phy[1] = b43legacy_phy_read(dev, 0x0001); - backup_phy[2] = b43legacy_phy_read(dev, 0x0811); - backup_phy[3] = b43legacy_phy_read(dev, 0x0812); - if (phy->rev != 1) { - backup_phy[4] = b43legacy_phy_read(dev, 0x0814); - backup_phy[5] = b43legacy_phy_read(dev, 0x0815); - } - backup_phy[6] = b43legacy_phy_read(dev, 0x005A); - backup_phy[7] = b43legacy_phy_read(dev, 0x0059); - backup_phy[8] = b43legacy_phy_read(dev, 0x0058); - backup_phy[9] = b43legacy_phy_read(dev, 0x000A); - backup_phy[10] = b43legacy_phy_read(dev, 0x0003); - backup_phy[11] = b43legacy_phy_read(dev, 0x080F); - backup_phy[12] = b43legacy_phy_read(dev, 0x0810); - backup_phy[13] = b43legacy_phy_read(dev, 0x002B); - backup_phy[14] = b43legacy_phy_read(dev, 0x0015); - b43legacy_phy_read(dev, 0x002D); /* dummy read */ - backup_bband = phy->bbatt; - backup_radio[0] = b43legacy_radio_read16(dev, 0x0052); - backup_radio[1] = b43legacy_radio_read16(dev, 0x0043); - backup_radio[2] = b43legacy_radio_read16(dev, 0x007A); - - b43legacy_phy_write(dev, 0x0429, - b43legacy_phy_read(dev, 0x0429) & 0x3FFF); - b43legacy_phy_write(dev, 0x0001, - b43legacy_phy_read(dev, 0x0001) & 0x8000); - b43legacy_phy_write(dev, 0x0811, - b43legacy_phy_read(dev, 0x0811) | 0x0002); - b43legacy_phy_write(dev, 0x0812, - b43legacy_phy_read(dev, 0x0812) & 0xFFFD); - b43legacy_phy_write(dev, 0x0811, - b43legacy_phy_read(dev, 0x0811) | 0x0001); - b43legacy_phy_write(dev, 0x0812, - b43legacy_phy_read(dev, 0x0812) & 0xFFFE); - if (phy->rev != 1) { - b43legacy_phy_write(dev, 0x0814, - b43legacy_phy_read(dev, 0x0814) | 0x0001); - b43legacy_phy_write(dev, 0x0815, - b43legacy_phy_read(dev, 0x0815) & 0xFFFE); - b43legacy_phy_write(dev, 0x0814, - b43legacy_phy_read(dev, 0x0814) | 0x0002); - b43legacy_phy_write(dev, 0x0815, - b43legacy_phy_read(dev, 0x0815) & 0xFFFD); - } - b43legacy_phy_write(dev, 0x0811, b43legacy_phy_read(dev, 0x0811) | - 0x000C); - b43legacy_phy_write(dev, 0x0812, b43legacy_phy_read(dev, 0x0812) | - 0x000C); - - b43legacy_phy_write(dev, 0x0811, (b43legacy_phy_read(dev, 0x0811) - & 0xFFCF) | 0x0030); - b43legacy_phy_write(dev, 0x0812, (b43legacy_phy_read(dev, 0x0812) - & 0xFFCF) | 0x0010); - - b43legacy_phy_write(dev, 0x005A, 0x0780); - b43legacy_phy_write(dev, 0x0059, 0xC810); - b43legacy_phy_write(dev, 0x0058, 0x000D); - if (phy->analog == 0) - b43legacy_phy_write(dev, 0x0003, 0x0122); - else - b43legacy_phy_write(dev, 0x000A, - b43legacy_phy_read(dev, 0x000A) - | 0x2000); - if (phy->rev != 1) { - b43legacy_phy_write(dev, 0x0814, - b43legacy_phy_read(dev, 0x0814) | 0x0004); - b43legacy_phy_write(dev, 0x0815, - b43legacy_phy_read(dev, 0x0815) & 0xFFFB); - } - b43legacy_phy_write(dev, 0x0003, - (b43legacy_phy_read(dev, 0x0003) - & 0xFF9F) | 0x0040); - if (phy->radio_ver == 0x2050 && phy->radio_rev == 2) { - b43legacy_radio_write16(dev, 0x0052, 0x0000); - b43legacy_radio_write16(dev, 0x0043, - (b43legacy_radio_read16(dev, 0x0043) - & 0xFFF0) | 0x0009); - loop1_cnt = 9; - } else if (phy->radio_rev == 8) { - b43legacy_radio_write16(dev, 0x0043, 0x000F); - loop1_cnt = 15; - } else - loop1_cnt = 0; - - b43legacy_phy_set_baseband_attenuation(dev, 11); - - if (phy->rev >= 3) - b43legacy_phy_write(dev, 0x080F, 0xC020); - else - b43legacy_phy_write(dev, 0x080F, 0x8020); - b43legacy_phy_write(dev, 0x0810, 0x0000); - - b43legacy_phy_write(dev, 0x002B, - (b43legacy_phy_read(dev, 0x002B) - & 0xFFC0) | 0x0001); - b43legacy_phy_write(dev, 0x002B, - (b43legacy_phy_read(dev, 0x002B) - & 0xC0FF) | 0x0800); - b43legacy_phy_write(dev, 0x0811, - b43legacy_phy_read(dev, 0x0811) | 0x0100); - b43legacy_phy_write(dev, 0x0812, - b43legacy_phy_read(dev, 0x0812) & 0xCFFF); - if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_EXTLNA) { - if (phy->rev >= 7) { - b43legacy_phy_write(dev, 0x0811, - b43legacy_phy_read(dev, 0x0811) - | 0x0800); - b43legacy_phy_write(dev, 0x0812, - b43legacy_phy_read(dev, 0x0812) - | 0x8000); - } - } - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) - & 0x00F7); - - for (i = 0; i < loop1_cnt; i++) { - b43legacy_radio_write16(dev, 0x0043, loop1_cnt); - b43legacy_phy_write(dev, 0x0812, - (b43legacy_phy_read(dev, 0x0812) - & 0xF0FF) | (i << 8)); - b43legacy_phy_write(dev, 0x0015, - (b43legacy_phy_read(dev, 0x0015) - & 0x0FFF) | 0xA000); - b43legacy_phy_write(dev, 0x0015, - (b43legacy_phy_read(dev, 0x0015) - & 0x0FFF) | 0xF000); - udelay(20); - if (b43legacy_phy_read(dev, 0x002D) >= 0x0DFC) - break; - } - loop1_done = i; - loop1_omitted = loop1_cnt - loop1_done; - - loop2_done = 0; - if (loop1_done >= 8) { - b43legacy_phy_write(dev, 0x0812, - b43legacy_phy_read(dev, 0x0812) - | 0x0030); - for (i = loop1_done - 8; i < 16; i++) { - b43legacy_phy_write(dev, 0x0812, - (b43legacy_phy_read(dev, 0x0812) - & 0xF0FF) | (i << 8)); - b43legacy_phy_write(dev, 0x0015, - (b43legacy_phy_read(dev, 0x0015) - & 0x0FFF) | 0xA000); - b43legacy_phy_write(dev, 0x0015, - (b43legacy_phy_read(dev, 0x0015) - & 0x0FFF) | 0xF000); - udelay(20); - if (b43legacy_phy_read(dev, 0x002D) >= 0x0DFC) - break; - } - } - - if (phy->rev != 1) { - b43legacy_phy_write(dev, 0x0814, backup_phy[4]); - b43legacy_phy_write(dev, 0x0815, backup_phy[5]); - } - b43legacy_phy_write(dev, 0x005A, backup_phy[6]); - b43legacy_phy_write(dev, 0x0059, backup_phy[7]); - b43legacy_phy_write(dev, 0x0058, backup_phy[8]); - b43legacy_phy_write(dev, 0x000A, backup_phy[9]); - b43legacy_phy_write(dev, 0x0003, backup_phy[10]); - b43legacy_phy_write(dev, 0x080F, backup_phy[11]); - b43legacy_phy_write(dev, 0x0810, backup_phy[12]); - b43legacy_phy_write(dev, 0x002B, backup_phy[13]); - b43legacy_phy_write(dev, 0x0015, backup_phy[14]); - - b43legacy_phy_set_baseband_attenuation(dev, backup_bband); - - b43legacy_radio_write16(dev, 0x0052, backup_radio[0]); - b43legacy_radio_write16(dev, 0x0043, backup_radio[1]); - b43legacy_radio_write16(dev, 0x007A, backup_radio[2]); - - b43legacy_phy_write(dev, 0x0811, backup_phy[2] | 0x0003); - udelay(10); - b43legacy_phy_write(dev, 0x0811, backup_phy[2]); - b43legacy_phy_write(dev, 0x0812, backup_phy[3]); - b43legacy_phy_write(dev, 0x0429, backup_phy[0]); - b43legacy_phy_write(dev, 0x0001, backup_phy[1]); - - phy->loopback_gain[0] = ((loop1_done * 6) - (loop1_omitted * 4)) - 11; - phy->loopback_gain[1] = (24 - (3 * loop2_done)) * 2; -} - -static void b43legacy_phy_initg(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 tmp; - - if (phy->rev == 1) - b43legacy_phy_initb5(dev); - else - b43legacy_phy_initb6(dev); - if (phy->rev >= 2 && phy->gmode) - b43legacy_phy_inita(dev); - - if (phy->rev >= 2) { - b43legacy_phy_write(dev, 0x0814, 0x0000); - b43legacy_phy_write(dev, 0x0815, 0x0000); - } - if (phy->rev == 2) { - b43legacy_phy_write(dev, 0x0811, 0x0000); - b43legacy_phy_write(dev, 0x0015, 0x00C0); - } - if (phy->rev > 5) { - b43legacy_phy_write(dev, 0x0811, 0x0400); - b43legacy_phy_write(dev, 0x0015, 0x00C0); - } - if (phy->gmode) { - tmp = b43legacy_phy_read(dev, 0x0400) & 0xFF; - if (tmp == 3) { - b43legacy_phy_write(dev, 0x04C2, 0x1816); - b43legacy_phy_write(dev, 0x04C3, 0x8606); - } - if (tmp == 4 || tmp == 5) { - b43legacy_phy_write(dev, 0x04C2, 0x1816); - b43legacy_phy_write(dev, 0x04C3, 0x8006); - b43legacy_phy_write(dev, 0x04CC, - (b43legacy_phy_read(dev, - 0x04CC) & 0x00FF) | - 0x1F00); - } - if (phy->rev >= 2) - b43legacy_phy_write(dev, 0x047E, 0x0078); - } - if (phy->radio_rev == 8) { - b43legacy_phy_write(dev, 0x0801, b43legacy_phy_read(dev, 0x0801) - | 0x0080); - b43legacy_phy_write(dev, 0x043E, b43legacy_phy_read(dev, 0x043E) - | 0x0004); - } - if (phy->rev >= 2 && phy->gmode) - b43legacy_calc_loopback_gain(dev); - if (phy->radio_rev != 8) { - if (phy->initval == 0xFFFF) - phy->initval = b43legacy_radio_init2050(dev); - else - b43legacy_radio_write16(dev, 0x0078, phy->initval); - } - if (phy->txctl2 == 0xFFFF) - b43legacy_phy_lo_g_measure(dev); - else { - if (phy->radio_ver == 0x2050 && phy->radio_rev == 8) - b43legacy_radio_write16(dev, 0x0052, - (phy->txctl1 << 4) | - phy->txctl2); - else - b43legacy_radio_write16(dev, 0x0052, - (b43legacy_radio_read16(dev, - 0x0052) & 0xFFF0) | - phy->txctl1); - if (phy->rev >= 6) - b43legacy_phy_write(dev, 0x0036, - (b43legacy_phy_read(dev, 0x0036) - & 0x0FFF) | (phy->txctl2 << 12)); - if (dev->dev->bus->sprom.boardflags_lo & - B43legacy_BFL_PACTRL) - b43legacy_phy_write(dev, 0x002E, 0x8075); - else - b43legacy_phy_write(dev, 0x002E, 0x807F); - if (phy->rev < 2) - b43legacy_phy_write(dev, 0x002F, 0x0101); - else - b43legacy_phy_write(dev, 0x002F, 0x0202); - } - if (phy->gmode) { - b43legacy_phy_lo_adjust(dev, 0); - b43legacy_phy_write(dev, 0x080F, 0x8078); - } - - if (!(dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_RSSI)) { - /* The specs state to update the NRSSI LT with - * the value 0x7FFFFFFF here. I think that is some weird - * compiler optimization in the original driver. - * Essentially, what we do here is resetting all NRSSI LT - * entries to -32 (see the clamp_val() in nrssi_hw_update()) - */ - b43legacy_nrssi_hw_update(dev, 0xFFFF); - b43legacy_calc_nrssi_threshold(dev); - } else if (phy->gmode || phy->rev >= 2) { - if (phy->nrssi[0] == -1000) { - B43legacy_WARN_ON(phy->nrssi[1] != -1000); - b43legacy_calc_nrssi_slope(dev); - } else { - B43legacy_WARN_ON(phy->nrssi[1] == -1000); - b43legacy_calc_nrssi_threshold(dev); - } - } - if (phy->radio_rev == 8) - b43legacy_phy_write(dev, 0x0805, 0x3230); - b43legacy_phy_init_pctl(dev); - if (dev->dev->bus->chip_id == 0x4306 - && dev->dev->bus->chip_package == 2) { - b43legacy_phy_write(dev, 0x0429, - b43legacy_phy_read(dev, 0x0429) & 0xBFFF); - b43legacy_phy_write(dev, 0x04C3, - b43legacy_phy_read(dev, 0x04C3) & 0x7FFF); - } -} - -static u16 b43legacy_phy_lo_b_r15_loop(struct b43legacy_wldev *dev) -{ - int i; - u16 ret = 0; - unsigned long flags; - - local_irq_save(flags); - for (i = 0; i < 10; i++) { - b43legacy_phy_write(dev, 0x0015, 0xAFA0); - udelay(1); - b43legacy_phy_write(dev, 0x0015, 0xEFA0); - udelay(10); - b43legacy_phy_write(dev, 0x0015, 0xFFA0); - udelay(40); - ret += b43legacy_phy_read(dev, 0x002C); - } - local_irq_restore(flags); - b43legacy_voluntary_preempt(); - - return ret; -} - -void b43legacy_phy_lo_b_measure(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 regstack[12] = { 0 }; - u16 mls; - u16 fval; - int i; - int j; - - regstack[0] = b43legacy_phy_read(dev, 0x0015); - regstack[1] = b43legacy_radio_read16(dev, 0x0052) & 0xFFF0; - - if (phy->radio_ver == 0x2053) { - regstack[2] = b43legacy_phy_read(dev, 0x000A); - regstack[3] = b43legacy_phy_read(dev, 0x002A); - regstack[4] = b43legacy_phy_read(dev, 0x0035); - regstack[5] = b43legacy_phy_read(dev, 0x0003); - regstack[6] = b43legacy_phy_read(dev, 0x0001); - regstack[7] = b43legacy_phy_read(dev, 0x0030); - - regstack[8] = b43legacy_radio_read16(dev, 0x0043); - regstack[9] = b43legacy_radio_read16(dev, 0x007A); - regstack[10] = b43legacy_read16(dev, 0x03EC); - regstack[11] = b43legacy_radio_read16(dev, 0x0052) & 0x00F0; - - b43legacy_phy_write(dev, 0x0030, 0x00FF); - b43legacy_write16(dev, 0x03EC, 0x3F3F); - b43legacy_phy_write(dev, 0x0035, regstack[4] & 0xFF7F); - b43legacy_radio_write16(dev, 0x007A, regstack[9] & 0xFFF0); - } - b43legacy_phy_write(dev, 0x0015, 0xB000); - b43legacy_phy_write(dev, 0x002B, 0x0004); - - if (phy->radio_ver == 0x2053) { - b43legacy_phy_write(dev, 0x002B, 0x0203); - b43legacy_phy_write(dev, 0x002A, 0x08A3); - } - - phy->minlowsig[0] = 0xFFFF; - - for (i = 0; i < 4; i++) { - b43legacy_radio_write16(dev, 0x0052, regstack[1] | i); - b43legacy_phy_lo_b_r15_loop(dev); - } - for (i = 0; i < 10; i++) { - b43legacy_radio_write16(dev, 0x0052, regstack[1] | i); - mls = b43legacy_phy_lo_b_r15_loop(dev) / 10; - if (mls < phy->minlowsig[0]) { - phy->minlowsig[0] = mls; - phy->minlowsigpos[0] = i; - } - } - b43legacy_radio_write16(dev, 0x0052, regstack[1] - | phy->minlowsigpos[0]); - - phy->minlowsig[1] = 0xFFFF; - - for (i = -4; i < 5; i += 2) { - for (j = -4; j < 5; j += 2) { - if (j < 0) - fval = (0x0100 * i) + j + 0x0100; - else - fval = (0x0100 * i) + j; - b43legacy_phy_write(dev, 0x002F, fval); - mls = b43legacy_phy_lo_b_r15_loop(dev) / 10; - if (mls < phy->minlowsig[1]) { - phy->minlowsig[1] = mls; - phy->minlowsigpos[1] = fval; - } - } - } - phy->minlowsigpos[1] += 0x0101; - - b43legacy_phy_write(dev, 0x002F, phy->minlowsigpos[1]); - if (phy->radio_ver == 0x2053) { - b43legacy_phy_write(dev, 0x000A, regstack[2]); - b43legacy_phy_write(dev, 0x002A, regstack[3]); - b43legacy_phy_write(dev, 0x0035, regstack[4]); - b43legacy_phy_write(dev, 0x0003, regstack[5]); - b43legacy_phy_write(dev, 0x0001, regstack[6]); - b43legacy_phy_write(dev, 0x0030, regstack[7]); - - b43legacy_radio_write16(dev, 0x0043, regstack[8]); - b43legacy_radio_write16(dev, 0x007A, regstack[9]); - - b43legacy_radio_write16(dev, 0x0052, - (b43legacy_radio_read16(dev, 0x0052) - & 0x000F) | regstack[11]); - - b43legacy_write16(dev, 0x03EC, regstack[10]); - } - b43legacy_phy_write(dev, 0x0015, regstack[0]); -} - -static inline -u16 b43legacy_phy_lo_g_deviation_subval(struct b43legacy_wldev *dev, - u16 control) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 ret; - unsigned long flags; - - local_irq_save(flags); - if (phy->gmode) { - b43legacy_phy_write(dev, 0x15, 0xE300); - control <<= 8; - b43legacy_phy_write(dev, 0x0812, control | 0x00B0); - udelay(5); - b43legacy_phy_write(dev, 0x0812, control | 0x00B2); - udelay(2); - b43legacy_phy_write(dev, 0x0812, control | 0x00B3); - udelay(4); - b43legacy_phy_write(dev, 0x0015, 0xF300); - udelay(8); - } else { - b43legacy_phy_write(dev, 0x0015, control | 0xEFA0); - udelay(2); - b43legacy_phy_write(dev, 0x0015, control | 0xEFE0); - udelay(4); - b43legacy_phy_write(dev, 0x0015, control | 0xFFE0); - udelay(8); - } - ret = b43legacy_phy_read(dev, 0x002D); - local_irq_restore(flags); - b43legacy_voluntary_preempt(); - - return ret; -} - -static u32 b43legacy_phy_lo_g_singledeviation(struct b43legacy_wldev *dev, - u16 control) -{ - int i; - u32 ret = 0; - - for (i = 0; i < 8; i++) - ret += b43legacy_phy_lo_g_deviation_subval(dev, control); - - return ret; -} - -/* Write the LocalOscillator CONTROL */ -static inline -void b43legacy_lo_write(struct b43legacy_wldev *dev, - struct b43legacy_lopair *pair) -{ - u16 value; - - value = (u8)(pair->low); - value |= ((u8)(pair->high)) << 8; - -#ifdef CONFIG_B43LEGACY_DEBUG - /* Sanity check. */ - if (pair->low < -8 || pair->low > 8 || - pair->high < -8 || pair->high > 8) { - b43legacydbg(dev->wl, - "WARNING: Writing invalid LOpair " - "(low: %d, high: %d)\n", - pair->low, pair->high); - dump_stack(); - } -#endif - - b43legacy_phy_write(dev, B43legacy_PHY_G_LO_CONTROL, value); -} - -static inline -struct b43legacy_lopair *b43legacy_find_lopair(struct b43legacy_wldev *dev, - u16 bbatt, - u16 rfatt, - u16 tx) -{ - static const u8 dict[10] = { 11, 10, 11, 12, 13, 12, 13, 12, 13, 12 }; - struct b43legacy_phy *phy = &dev->phy; - - if (bbatt > 6) - bbatt = 6; - B43legacy_WARN_ON(rfatt >= 10); - - if (tx == 3) - return b43legacy_get_lopair(phy, rfatt, bbatt); - return b43legacy_get_lopair(phy, dict[rfatt], bbatt); -} - -static inline -struct b43legacy_lopair *b43legacy_current_lopair(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - - return b43legacy_find_lopair(dev, phy->bbatt, - phy->rfatt, phy->txctl1); -} - -/* Adjust B/G LO */ -void b43legacy_phy_lo_adjust(struct b43legacy_wldev *dev, int fixed) -{ - struct b43legacy_lopair *pair; - - if (fixed) { - /* Use fixed values. Only for initialization. */ - pair = b43legacy_find_lopair(dev, 2, 3, 0); - } else - pair = b43legacy_current_lopair(dev); - b43legacy_lo_write(dev, pair); -} - -static void b43legacy_phy_lo_g_measure_txctl2(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 txctl2 = 0; - u16 i; - u32 smallest; - u32 tmp; - - b43legacy_radio_write16(dev, 0x0052, 0x0000); - udelay(10); - smallest = b43legacy_phy_lo_g_singledeviation(dev, 0); - for (i = 0; i < 16; i++) { - b43legacy_radio_write16(dev, 0x0052, i); - udelay(10); - tmp = b43legacy_phy_lo_g_singledeviation(dev, 0); - if (tmp < smallest) { - smallest = tmp; - txctl2 = i; - } - } - phy->txctl2 = txctl2; -} - -static -void b43legacy_phy_lo_g_state(struct b43legacy_wldev *dev, - const struct b43legacy_lopair *in_pair, - struct b43legacy_lopair *out_pair, - u16 r27) -{ - static const struct b43legacy_lopair transitions[8] = { - { .high = 1, .low = 1, }, - { .high = 1, .low = 0, }, - { .high = 1, .low = -1, }, - { .high = 0, .low = -1, }, - { .high = -1, .low = -1, }, - { .high = -1, .low = 0, }, - { .high = -1, .low = 1, }, - { .high = 0, .low = 1, }, - }; - struct b43legacy_lopair lowest_transition = { - .high = in_pair->high, - .low = in_pair->low, - }; - struct b43legacy_lopair tmp_pair; - struct b43legacy_lopair transition; - int i = 12; - int state = 0; - int found_lower; - int j; - int begin; - int end; - u32 lowest_deviation; - u32 tmp; - - /* Note that in_pair and out_pair can point to the same pair. - * Be careful. */ - - b43legacy_lo_write(dev, &lowest_transition); - lowest_deviation = b43legacy_phy_lo_g_singledeviation(dev, r27); - do { - found_lower = 0; - B43legacy_WARN_ON(!(state >= 0 && state <= 8)); - if (state == 0) { - begin = 1; - end = 8; - } else if (state % 2 == 0) { - begin = state - 1; - end = state + 1; - } else { - begin = state - 2; - end = state + 2; - } - if (begin < 1) - begin += 8; - if (end > 8) - end -= 8; - - j = begin; - tmp_pair.high = lowest_transition.high; - tmp_pair.low = lowest_transition.low; - while (1) { - B43legacy_WARN_ON(!(j >= 1 && j <= 8)); - transition.high = tmp_pair.high + - transitions[j - 1].high; - transition.low = tmp_pair.low + transitions[j - 1].low; - if ((abs(transition.low) < 9) - && (abs(transition.high) < 9)) { - b43legacy_lo_write(dev, &transition); - tmp = b43legacy_phy_lo_g_singledeviation(dev, - r27); - if (tmp < lowest_deviation) { - lowest_deviation = tmp; - state = j; - found_lower = 1; - - lowest_transition.high = - transition.high; - lowest_transition.low = transition.low; - } - } - if (j == end) - break; - if (j == 8) - j = 1; - else - j++; - } - } while (i-- && found_lower); - - out_pair->high = lowest_transition.high; - out_pair->low = lowest_transition.low; -} - -/* Set the baseband attenuation value on chip. */ -void b43legacy_phy_set_baseband_attenuation(struct b43legacy_wldev *dev, - u16 bbatt) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 value; - - if (phy->analog == 0) { - value = (b43legacy_read16(dev, 0x03E6) & 0xFFF0); - value |= (bbatt & 0x000F); - b43legacy_write16(dev, 0x03E6, value); - return; - } - - if (phy->analog > 1) { - value = b43legacy_phy_read(dev, 0x0060) & 0xFFC3; - value |= (bbatt << 2) & 0x003C; - } else { - value = b43legacy_phy_read(dev, 0x0060) & 0xFF87; - value |= (bbatt << 3) & 0x0078; - } - b43legacy_phy_write(dev, 0x0060, value); -} - -/* http://bcm-specs.sipsolutions.net/LocalOscillator/Measure */ -void b43legacy_phy_lo_g_measure(struct b43legacy_wldev *dev) -{ - static const u8 pairorder[10] = { 3, 1, 5, 7, 9, 2, 0, 4, 6, 8 }; - const int is_initializing = (b43legacy_status(dev) - < B43legacy_STAT_STARTED); - struct b43legacy_phy *phy = &dev->phy; - u16 h; - u16 i; - u16 oldi = 0; - u16 j; - struct b43legacy_lopair control; - struct b43legacy_lopair *tmp_control; - u16 tmp; - u16 regstack[16] = { 0 }; - u8 oldchannel; - - /* XXX: What are these? */ - u8 r27 = 0; - u16 r31; - - oldchannel = phy->channel; - /* Setup */ - if (phy->gmode) { - regstack[0] = b43legacy_phy_read(dev, B43legacy_PHY_G_CRS); - regstack[1] = b43legacy_phy_read(dev, 0x0802); - b43legacy_phy_write(dev, B43legacy_PHY_G_CRS, regstack[0] - & 0x7FFF); - b43legacy_phy_write(dev, 0x0802, regstack[1] & 0xFFFC); - } - regstack[3] = b43legacy_read16(dev, 0x03E2); - b43legacy_write16(dev, 0x03E2, regstack[3] | 0x8000); - regstack[4] = b43legacy_read16(dev, B43legacy_MMIO_CHANNEL_EXT); - regstack[5] = b43legacy_phy_read(dev, 0x15); - regstack[6] = b43legacy_phy_read(dev, 0x2A); - regstack[7] = b43legacy_phy_read(dev, 0x35); - regstack[8] = b43legacy_phy_read(dev, 0x60); - regstack[9] = b43legacy_radio_read16(dev, 0x43); - regstack[10] = b43legacy_radio_read16(dev, 0x7A); - regstack[11] = b43legacy_radio_read16(dev, 0x52); - if (phy->gmode) { - regstack[12] = b43legacy_phy_read(dev, 0x0811); - regstack[13] = b43legacy_phy_read(dev, 0x0812); - regstack[14] = b43legacy_phy_read(dev, 0x0814); - regstack[15] = b43legacy_phy_read(dev, 0x0815); - } - b43legacy_radio_selectchannel(dev, 6, 0); - if (phy->gmode) { - b43legacy_phy_write(dev, B43legacy_PHY_G_CRS, regstack[0] - & 0x7FFF); - b43legacy_phy_write(dev, 0x0802, regstack[1] & 0xFFFC); - b43legacy_dummy_transmission(dev); - } - b43legacy_radio_write16(dev, 0x0043, 0x0006); - - b43legacy_phy_set_baseband_attenuation(dev, 2); - - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL_EXT, 0x0000); - b43legacy_phy_write(dev, 0x002E, 0x007F); - b43legacy_phy_write(dev, 0x080F, 0x0078); - b43legacy_phy_write(dev, 0x0035, regstack[7] & ~(1 << 7)); - b43legacy_radio_write16(dev, 0x007A, regstack[10] & 0xFFF0); - b43legacy_phy_write(dev, 0x002B, 0x0203); - b43legacy_phy_write(dev, 0x002A, 0x08A3); - if (phy->gmode) { - b43legacy_phy_write(dev, 0x0814, regstack[14] | 0x0003); - b43legacy_phy_write(dev, 0x0815, regstack[15] & 0xFFFC); - b43legacy_phy_write(dev, 0x0811, 0x01B3); - b43legacy_phy_write(dev, 0x0812, 0x00B2); - } - if (is_initializing) - b43legacy_phy_lo_g_measure_txctl2(dev); - b43legacy_phy_write(dev, 0x080F, 0x8078); - - /* Measure */ - control.low = 0; - control.high = 0; - for (h = 0; h < 10; h++) { - /* Loop over each possible RadioAttenuation (0-9) */ - i = pairorder[h]; - if (is_initializing) { - if (i == 3) { - control.low = 0; - control.high = 0; - } else if (((i % 2 == 1) && (oldi % 2 == 1)) || - ((i % 2 == 0) && (oldi % 2 == 0))) { - tmp_control = b43legacy_get_lopair(phy, oldi, - 0); - memcpy(&control, tmp_control, sizeof(control)); - } else { - tmp_control = b43legacy_get_lopair(phy, 3, 0); - memcpy(&control, tmp_control, sizeof(control)); - } - } - /* Loop over each possible BasebandAttenuation/2 */ - for (j = 0; j < 4; j++) { - if (is_initializing) { - tmp = i * 2 + j; - r27 = 0; - r31 = 0; - if (tmp > 14) { - r31 = 1; - if (tmp > 17) - r27 = 1; - if (tmp > 19) - r27 = 2; - } - } else { - tmp_control = b43legacy_get_lopair(phy, i, - j * 2); - if (!tmp_control->used) - continue; - memcpy(&control, tmp_control, sizeof(control)); - r27 = 3; - r31 = 0; - } - b43legacy_radio_write16(dev, 0x43, i); - b43legacy_radio_write16(dev, 0x52, phy->txctl2); - udelay(10); - b43legacy_voluntary_preempt(); - - b43legacy_phy_set_baseband_attenuation(dev, j * 2); - - tmp = (regstack[10] & 0xFFF0); - if (r31) - tmp |= 0x0008; - b43legacy_radio_write16(dev, 0x007A, tmp); - - tmp_control = b43legacy_get_lopair(phy, i, j * 2); - b43legacy_phy_lo_g_state(dev, &control, tmp_control, - r27); - } - oldi = i; - } - /* Loop over each possible RadioAttenuation (10-13) */ - for (i = 10; i < 14; i++) { - /* Loop over each possible BasebandAttenuation/2 */ - for (j = 0; j < 4; j++) { - if (is_initializing) { - tmp_control = b43legacy_get_lopair(phy, i - 9, - j * 2); - memcpy(&control, tmp_control, sizeof(control)); - /* FIXME: The next line is wrong, as the - * following if statement can never trigger. */ - tmp = (i - 9) * 2 + j - 5; - r27 = 0; - r31 = 0; - if (tmp > 14) { - r31 = 1; - if (tmp > 17) - r27 = 1; - if (tmp > 19) - r27 = 2; - } - } else { - tmp_control = b43legacy_get_lopair(phy, i - 9, - j * 2); - if (!tmp_control->used) - continue; - memcpy(&control, tmp_control, sizeof(control)); - r27 = 3; - r31 = 0; - } - b43legacy_radio_write16(dev, 0x43, i - 9); - /* FIXME: shouldn't txctl1 be zero in the next line - * and 3 in the loop above? */ - b43legacy_radio_write16(dev, 0x52, - phy->txctl2 - | (3/*txctl1*/ << 4)); - udelay(10); - b43legacy_voluntary_preempt(); - - b43legacy_phy_set_baseband_attenuation(dev, j * 2); - - tmp = (regstack[10] & 0xFFF0); - if (r31) - tmp |= 0x0008; - b43legacy_radio_write16(dev, 0x7A, tmp); - - tmp_control = b43legacy_get_lopair(phy, i, j * 2); - b43legacy_phy_lo_g_state(dev, &control, tmp_control, - r27); - } - } - - /* Restoration */ - if (phy->gmode) { - b43legacy_phy_write(dev, 0x0015, 0xE300); - b43legacy_phy_write(dev, 0x0812, (r27 << 8) | 0xA0); - udelay(5); - b43legacy_phy_write(dev, 0x0812, (r27 << 8) | 0xA2); - udelay(2); - b43legacy_phy_write(dev, 0x0812, (r27 << 8) | 0xA3); - b43legacy_voluntary_preempt(); - } else - b43legacy_phy_write(dev, 0x0015, r27 | 0xEFA0); - b43legacy_phy_lo_adjust(dev, is_initializing); - b43legacy_phy_write(dev, 0x002E, 0x807F); - if (phy->gmode) - b43legacy_phy_write(dev, 0x002F, 0x0202); - else - b43legacy_phy_write(dev, 0x002F, 0x0101); - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL_EXT, regstack[4]); - b43legacy_phy_write(dev, 0x0015, regstack[5]); - b43legacy_phy_write(dev, 0x002A, regstack[6]); - b43legacy_phy_write(dev, 0x0035, regstack[7]); - b43legacy_phy_write(dev, 0x0060, regstack[8]); - b43legacy_radio_write16(dev, 0x0043, regstack[9]); - b43legacy_radio_write16(dev, 0x007A, regstack[10]); - regstack[11] &= 0x00F0; - regstack[11] |= (b43legacy_radio_read16(dev, 0x52) & 0x000F); - b43legacy_radio_write16(dev, 0x52, regstack[11]); - b43legacy_write16(dev, 0x03E2, regstack[3]); - if (phy->gmode) { - b43legacy_phy_write(dev, 0x0811, regstack[12]); - b43legacy_phy_write(dev, 0x0812, regstack[13]); - b43legacy_phy_write(dev, 0x0814, regstack[14]); - b43legacy_phy_write(dev, 0x0815, regstack[15]); - b43legacy_phy_write(dev, B43legacy_PHY_G_CRS, regstack[0]); - b43legacy_phy_write(dev, 0x0802, regstack[1]); - } - b43legacy_radio_selectchannel(dev, oldchannel, 1); - -#ifdef CONFIG_B43LEGACY_DEBUG - { - /* Sanity check for all lopairs. */ - for (i = 0; i < B43legacy_LO_COUNT; i++) { - tmp_control = phy->_lo_pairs + i; - if (tmp_control->low < -8 || tmp_control->low > 8 || - tmp_control->high < -8 || tmp_control->high > 8) - b43legacywarn(dev->wl, - "WARNING: Invalid LOpair (low: %d, high:" - " %d, index: %d)\n", - tmp_control->low, tmp_control->high, i); - } - } -#endif /* CONFIG_B43LEGACY_DEBUG */ -} - -static -void b43legacy_phy_lo_mark_current_used(struct b43legacy_wldev *dev) -{ - struct b43legacy_lopair *pair; - - pair = b43legacy_current_lopair(dev); - pair->used = 1; -} - -void b43legacy_phy_lo_mark_all_unused(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - struct b43legacy_lopair *pair; - int i; - - for (i = 0; i < B43legacy_LO_COUNT; i++) { - pair = phy->_lo_pairs + i; - pair->used = 0; - } -} - -/* http://bcm-specs.sipsolutions.net/EstimatePowerOut - * This function converts a TSSI value to dBm in Q5.2 - */ -static s8 b43legacy_phy_estimate_power_out(struct b43legacy_wldev *dev, s8 tssi) -{ - struct b43legacy_phy *phy = &dev->phy; - s8 dbm = 0; - s32 tmp; - - tmp = phy->idle_tssi; - tmp += tssi; - tmp -= phy->savedpctlreg; - - switch (phy->type) { - case B43legacy_PHYTYPE_B: - case B43legacy_PHYTYPE_G: - tmp = clamp_val(tmp, 0x00, 0x3F); - dbm = phy->tssi2dbm[tmp]; - break; - default: - B43legacy_BUG_ON(1); - } - - return dbm; -} - -/* http://bcm-specs.sipsolutions.net/RecalculateTransmissionPower */ -void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 tmp; - u16 txpower; - s8 v0; - s8 v1; - s8 v2; - s8 v3; - s8 average; - int max_pwr; - s16 desired_pwr; - s16 estimated_pwr; - s16 pwr_adjust; - s16 radio_att_delta; - s16 baseband_att_delta; - s16 radio_attenuation; - s16 baseband_attenuation; - - if (phy->savedpctlreg == 0xFFFF) - return; - if ((dev->dev->bus->boardinfo.type == 0x0416) && - is_bcm_board_vendor(dev)) - return; -#ifdef CONFIG_B43LEGACY_DEBUG - if (phy->manual_txpower_control) - return; -#endif - - B43legacy_BUG_ON(!(phy->type == B43legacy_PHYTYPE_B || - phy->type == B43legacy_PHYTYPE_G)); - tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, 0x0058); - v0 = (s8)(tmp & 0x00FF); - v1 = (s8)((tmp & 0xFF00) >> 8); - tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, 0x005A); - v2 = (s8)(tmp & 0x00FF); - v3 = (s8)((tmp & 0xFF00) >> 8); - tmp = 0; - - if (v0 == 0x7F || v1 == 0x7F || v2 == 0x7F || v3 == 0x7F) { - tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - 0x0070); - v0 = (s8)(tmp & 0x00FF); - v1 = (s8)((tmp & 0xFF00) >> 8); - tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, - 0x0072); - v2 = (s8)(tmp & 0x00FF); - v3 = (s8)((tmp & 0xFF00) >> 8); - if (v0 == 0x7F || v1 == 0x7F || v2 == 0x7F || v3 == 0x7F) - return; - v0 = (v0 + 0x20) & 0x3F; - v1 = (v1 + 0x20) & 0x3F; - v2 = (v2 + 0x20) & 0x3F; - v3 = (v3 + 0x20) & 0x3F; - tmp = 1; - } - b43legacy_radio_clear_tssi(dev); - - average = (v0 + v1 + v2 + v3 + 2) / 4; - - if (tmp && (b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, 0x005E) - & 0x8)) - average -= 13; - - estimated_pwr = b43legacy_phy_estimate_power_out(dev, average); - - max_pwr = dev->dev->bus->sprom.maxpwr_bg; - - if ((dev->dev->bus->sprom.boardflags_lo - & B43legacy_BFL_PACTRL) && - (phy->type == B43legacy_PHYTYPE_G)) - max_pwr -= 0x3; - if (unlikely(max_pwr <= 0)) { - b43legacywarn(dev->wl, "Invalid max-TX-power value in SPROM." - "\n"); - max_pwr = 74; /* fake it */ - dev->dev->bus->sprom.maxpwr_bg = max_pwr; - } - - /* Use regulatory information to get the maximum power. - * In the absence of such data from mac80211, we will use 20 dBm, which - * is the value for the EU, US, Canada, and most of the world. - * The regulatory maximum is reduced by the antenna gain (from sprom) - * and 1.5 dBm (a safety factor??). The result is in Q5.2 format - * which accounts for the factor of 4 */ -#define REG_MAX_PWR 20 - max_pwr = min(REG_MAX_PWR * 4 - - dev->dev->bus->sprom.antenna_gain.a0 - - 0x6, max_pwr); - - /* find the desired power in Q5.2 - power_level is in dBm - * and limit it - max_pwr is already in Q5.2 */ - desired_pwr = clamp_val(phy->power_level << 2, 0, max_pwr); - if (b43legacy_debug(dev, B43legacy_DBG_XMITPOWER)) - b43legacydbg(dev->wl, "Current TX power output: " Q52_FMT - " dBm, Desired TX power output: " Q52_FMT - " dBm\n", Q52_ARG(estimated_pwr), - Q52_ARG(desired_pwr)); - /* Check if we need to adjust the current power. The factor of 2 is - * for damping */ - pwr_adjust = (desired_pwr - estimated_pwr) / 2; - /* RF attenuation delta - * The minus sign is because lower attenuation => more power */ - radio_att_delta = -(pwr_adjust + 7) >> 3; - /* Baseband attenuation delta */ - baseband_att_delta = -(pwr_adjust >> 1) - (4 * radio_att_delta); - /* Do we need to adjust anything? */ - if ((radio_att_delta == 0) && (baseband_att_delta == 0)) { - b43legacy_phy_lo_mark_current_used(dev); - return; - } - - /* Calculate the new attenuation values. */ - baseband_attenuation = phy->bbatt; - baseband_attenuation += baseband_att_delta; - radio_attenuation = phy->rfatt; - radio_attenuation += radio_att_delta; - - /* Get baseband and radio attenuation values into permitted ranges. - * baseband 0-11, radio 0-9. - * Radio attenuation affects power level 4 times as much as baseband. - */ - if (radio_attenuation < 0) { - baseband_attenuation -= (4 * -radio_attenuation); - radio_attenuation = 0; - } else if (radio_attenuation > 9) { - baseband_attenuation += (4 * (radio_attenuation - 9)); - radio_attenuation = 9; - } else { - while (baseband_attenuation < 0 && radio_attenuation > 0) { - baseband_attenuation += 4; - radio_attenuation--; - } - while (baseband_attenuation > 11 && radio_attenuation < 9) { - baseband_attenuation -= 4; - radio_attenuation++; - } - } - baseband_attenuation = clamp_val(baseband_attenuation, 0, 11); - - txpower = phy->txctl1; - if ((phy->radio_ver == 0x2050) && (phy->radio_rev == 2)) { - if (radio_attenuation <= 1) { - if (txpower == 0) { - txpower = 3; - radio_attenuation += 2; - baseband_attenuation += 2; - } else if (dev->dev->bus->sprom.boardflags_lo - & B43legacy_BFL_PACTRL) { - baseband_attenuation += 4 * - (radio_attenuation - 2); - radio_attenuation = 2; - } - } else if (radio_attenuation > 4 && txpower != 0) { - txpower = 0; - if (baseband_attenuation < 3) { - radio_attenuation -= 3; - baseband_attenuation += 2; - } else { - radio_attenuation -= 2; - baseband_attenuation -= 2; - } - } - } - /* Save the control values */ - phy->txctl1 = txpower; - baseband_attenuation = clamp_val(baseband_attenuation, 0, 11); - radio_attenuation = clamp_val(radio_attenuation, 0, 9); - phy->rfatt = radio_attenuation; - phy->bbatt = baseband_attenuation; - - /* Adjust the hardware */ - b43legacy_phy_lock(dev); - b43legacy_radio_lock(dev); - b43legacy_radio_set_txpower_bg(dev, baseband_attenuation, - radio_attenuation, txpower); - b43legacy_phy_lo_mark_current_used(dev); - b43legacy_radio_unlock(dev); - b43legacy_phy_unlock(dev); -} - -static inline -s32 b43legacy_tssi2dbm_ad(s32 num, s32 den) -{ - if (num < 0) - return num/den; - else - return (num+den/2)/den; -} - -static inline -s8 b43legacy_tssi2dbm_entry(s8 entry [], u8 index, s16 pab0, s16 pab1, s16 pab2) -{ - s32 m1; - s32 m2; - s32 f = 256; - s32 q; - s32 delta; - s8 i = 0; - - m1 = b43legacy_tssi2dbm_ad(16 * pab0 + index * pab1, 32); - m2 = max(b43legacy_tssi2dbm_ad(32768 + index * pab2, 256), 1); - do { - if (i > 15) - return -EINVAL; - q = b43legacy_tssi2dbm_ad(f * 4096 - - b43legacy_tssi2dbm_ad(m2 * f, 16) * - f, 2048); - delta = abs(q - f); - f = q; - i++; - } while (delta >= 2); - entry[index] = clamp_val(b43legacy_tssi2dbm_ad(m1 * f, 8192), - -127, 128); - return 0; -} - -/* http://bcm-specs.sipsolutions.net/TSSI_to_DBM_Table */ -int b43legacy_phy_init_tssi2dbm_table(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - s16 pab0; - s16 pab1; - s16 pab2; - u8 idx; - s8 *dyn_tssi2dbm; - - B43legacy_WARN_ON(!(phy->type == B43legacy_PHYTYPE_B || - phy->type == B43legacy_PHYTYPE_G)); - pab0 = (s16)(dev->dev->bus->sprom.pa0b0); - pab1 = (s16)(dev->dev->bus->sprom.pa0b1); - pab2 = (s16)(dev->dev->bus->sprom.pa0b2); - - if ((dev->dev->bus->chip_id == 0x4301) && (phy->radio_ver != 0x2050)) { - phy->idle_tssi = 0x34; - phy->tssi2dbm = b43legacy_tssi2dbm_b_table; - return 0; - } - - if (pab0 != 0 && pab1 != 0 && pab2 != 0 && - pab0 != -1 && pab1 != -1 && pab2 != -1) { - /* The pabX values are set in SPROM. Use them. */ - if ((s8)dev->dev->bus->sprom.itssi_bg != 0 && - (s8)dev->dev->bus->sprom.itssi_bg != -1) - phy->idle_tssi = (s8)(dev->dev->bus->sprom. - itssi_bg); - else - phy->idle_tssi = 62; - dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); - if (dyn_tssi2dbm == NULL) { - b43legacyerr(dev->wl, "Could not allocate memory " - "for tssi2dbm table\n"); - return -ENOMEM; - } - for (idx = 0; idx < 64; idx++) - if (b43legacy_tssi2dbm_entry(dyn_tssi2dbm, idx, pab0, - pab1, pab2)) { - phy->tssi2dbm = NULL; - b43legacyerr(dev->wl, "Could not generate " - "tssi2dBm table\n"); - kfree(dyn_tssi2dbm); - return -ENODEV; - } - phy->tssi2dbm = dyn_tssi2dbm; - phy->dyn_tssi_tbl = 1; - } else { - /* pabX values not set in SPROM. */ - switch (phy->type) { - case B43legacy_PHYTYPE_B: - phy->idle_tssi = 0x34; - phy->tssi2dbm = b43legacy_tssi2dbm_b_table; - break; - case B43legacy_PHYTYPE_G: - phy->idle_tssi = 0x34; - phy->tssi2dbm = b43legacy_tssi2dbm_g_table; - break; - } - } - - return 0; -} - -int b43legacy_phy_init(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - int err = -ENODEV; - - switch (phy->type) { - case B43legacy_PHYTYPE_B: - switch (phy->rev) { - case 2: - b43legacy_phy_initb2(dev); - err = 0; - break; - case 4: - b43legacy_phy_initb4(dev); - err = 0; - break; - case 5: - b43legacy_phy_initb5(dev); - err = 0; - break; - case 6: - b43legacy_phy_initb6(dev); - err = 0; - break; - } - break; - case B43legacy_PHYTYPE_G: - b43legacy_phy_initg(dev); - err = 0; - break; - } - if (err) - b43legacyerr(dev->wl, "Unknown PHYTYPE found\n"); - - return err; -} - -void b43legacy_phy_set_antenna_diversity(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 antennadiv; - u16 offset; - u16 value; - u32 ucodeflags; - - antennadiv = phy->antenna_diversity; - - if (antennadiv == 0xFFFF) - antennadiv = 3; - B43legacy_WARN_ON(antennadiv > 3); - - ucodeflags = b43legacy_shm_read32(dev, B43legacy_SHM_SHARED, - B43legacy_UCODEFLAGS_OFFSET); - b43legacy_shm_write32(dev, B43legacy_SHM_SHARED, - B43legacy_UCODEFLAGS_OFFSET, - ucodeflags & ~B43legacy_UCODEFLAG_AUTODIV); - - switch (phy->type) { - case B43legacy_PHYTYPE_G: - offset = 0x0400; - - if (antennadiv == 2) - value = (3/*automatic*/ << 7); - else - value = (antennadiv << 7); - b43legacy_phy_write(dev, offset + 1, - (b43legacy_phy_read(dev, offset + 1) - & 0x7E7F) | value); - - if (antennadiv >= 2) { - if (antennadiv == 2) - value = (antennadiv << 7); - else - value = (0/*force0*/ << 7); - b43legacy_phy_write(dev, offset + 0x2B, - (b43legacy_phy_read(dev, - offset + 0x2B) - & 0xFEFF) | value); - } - - if (phy->type == B43legacy_PHYTYPE_G) { - if (antennadiv >= 2) - b43legacy_phy_write(dev, 0x048C, - b43legacy_phy_read(dev, - 0x048C) | 0x2000); - else - b43legacy_phy_write(dev, 0x048C, - b43legacy_phy_read(dev, - 0x048C) & ~0x2000); - if (phy->rev >= 2) { - b43legacy_phy_write(dev, 0x0461, - b43legacy_phy_read(dev, - 0x0461) | 0x0010); - b43legacy_phy_write(dev, 0x04AD, - (b43legacy_phy_read(dev, - 0x04AD) - & 0x00FF) | 0x0015); - if (phy->rev == 2) - b43legacy_phy_write(dev, 0x0427, - 0x0008); - else - b43legacy_phy_write(dev, 0x0427, - (b43legacy_phy_read(dev, 0x0427) - & 0x00FF) | 0x0008); - } else if (phy->rev >= 6) - b43legacy_phy_write(dev, 0x049B, 0x00DC); - } else { - if (phy->rev < 3) - b43legacy_phy_write(dev, 0x002B, - (b43legacy_phy_read(dev, - 0x002B) & 0x00FF) - | 0x0024); - else { - b43legacy_phy_write(dev, 0x0061, - b43legacy_phy_read(dev, - 0x0061) | 0x0010); - if (phy->rev == 3) { - b43legacy_phy_write(dev, 0x0093, - 0x001D); - b43legacy_phy_write(dev, 0x0027, - 0x0008); - } else { - b43legacy_phy_write(dev, 0x0093, - 0x003A); - b43legacy_phy_write(dev, 0x0027, - (b43legacy_phy_read(dev, 0x0027) - & 0x00FF) | 0x0008); - } - } - } - break; - case B43legacy_PHYTYPE_B: - if (dev->dev->id.revision == 2) - value = (3/*automatic*/ << 7); - else - value = (antennadiv << 7); - b43legacy_phy_write(dev, 0x03E2, - (b43legacy_phy_read(dev, 0x03E2) - & 0xFE7F) | value); - break; - default: - B43legacy_WARN_ON(1); - } - - if (antennadiv >= 2) { - ucodeflags = b43legacy_shm_read32(dev, B43legacy_SHM_SHARED, - B43legacy_UCODEFLAGS_OFFSET); - b43legacy_shm_write32(dev, B43legacy_SHM_SHARED, - B43legacy_UCODEFLAGS_OFFSET, - ucodeflags | B43legacy_UCODEFLAG_AUTODIV); - } - - phy->antenna_diversity = antennadiv; -} - -/* Set the PowerSavingControlBits. - * Bitvalues: - * 0 => unset the bit - * 1 => set the bit - * -1 => calculate the bit - */ -void b43legacy_power_saving_ctl_bits(struct b43legacy_wldev *dev, - int bit25, int bit26) -{ - int i; - u32 status; - -/* FIXME: Force 25 to off and 26 to on for now: */ -bit25 = 0; -bit26 = 1; - - if (bit25 == -1) { - /* TODO: If powersave is not off and FIXME is not set and we - * are not in adhoc and thus is not an AP and we arei - * associated, set bit 25 */ - } - if (bit26 == -1) { - /* TODO: If the device is awake or this is an AP, or we are - * scanning, or FIXME, or we are associated, or FIXME, - * or the latest PS-Poll packet sent was successful, - * set bit26 */ - } - status = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - if (bit25) - status |= B43legacy_MACCTL_HWPS; - else - status &= ~B43legacy_MACCTL_HWPS; - if (bit26) - status |= B43legacy_MACCTL_AWAKE; - else - status &= ~B43legacy_MACCTL_AWAKE; - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, status); - if (bit26 && dev->dev->id.revision >= 5) { - for (i = 0; i < 100; i++) { - if (b43legacy_shm_read32(dev, B43legacy_SHM_SHARED, - 0x0040) != 4) - break; - udelay(10); - } - } -} diff --git a/drivers/net/wireless/b43legacy/phy.h b/drivers/net/wireless/b43legacy/phy.h deleted file mode 100644 index 831a7a4760e5..000000000000 --- a/drivers/net/wireless/b43legacy/phy.h +++ /dev/null @@ -1,209 +0,0 @@ -/* - - Broadcom B43legacy wireless driver - - Copyright (c) 2005 Martin Langer , - Stefano Brivio - Michael Buesch - Danny van Dyk - Andreas Jaggi - Copyright (c) 2007 Larry Finger - - Some parts of the code in this file are derived from the ipw2200 - driver Copyright(c) 2003 - 2004 Intel Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#ifndef B43legacy_PHY_H_ -#define B43legacy_PHY_H_ - -#include - -enum { - B43legacy_ANTENNA0, /* Antenna 0 */ - B43legacy_ANTENNA1, /* Antenna 0 */ - B43legacy_ANTENNA_AUTO1, /* Automatic, starting with antenna 1 */ - B43legacy_ANTENNA_AUTO0, /* Automatic, starting with antenna 0 */ - - B43legacy_ANTENNA_AUTO = B43legacy_ANTENNA_AUTO0, - B43legacy_ANTENNA_DEFAULT = B43legacy_ANTENNA_AUTO, -}; - -enum { - B43legacy_INTERFMODE_NONE, - B43legacy_INTERFMODE_NONWLAN, - B43legacy_INTERFMODE_MANUALWLAN, - B43legacy_INTERFMODE_AUTOWLAN, -}; - -/*** PHY Registers ***/ - -/* Routing */ -#define B43legacy_PHYROUTE_OFDM_GPHY 0x400 -#define B43legacy_PHYROUTE_EXT_GPHY 0x800 - -/* Base registers. */ -#define B43legacy_PHY_BASE(reg) (reg) -/* OFDM (A) registers of a G-PHY */ -#define B43legacy_PHY_OFDM(reg) ((reg) | B43legacy_PHYROUTE_OFDM_GPHY) -/* Extended G-PHY registers */ -#define B43legacy_PHY_EXTG(reg) ((reg) | B43legacy_PHYROUTE_EXT_GPHY) - - -/* Extended G-PHY Registers */ -#define B43legacy_PHY_CLASSCTL B43legacy_PHY_EXTG(0x02) /* Classify control */ -#define B43legacy_PHY_GTABCTL B43legacy_PHY_EXTG(0x03) /* G-PHY table control (see below) */ -#define B43legacy_PHY_GTABOFF 0x03FF /* G-PHY table offset (see below) */ -#define B43legacy_PHY_GTABNR 0xFC00 /* G-PHY table number (see below) */ -#define B43legacy_PHY_GTABNR_SHIFT 10 -#define B43legacy_PHY_GTABDATA B43legacy_PHY_EXTG(0x04) /* G-PHY table data */ -#define B43legacy_PHY_LO_MASK B43legacy_PHY_EXTG(0x0F) /* Local Oscillator control mask */ -#define B43legacy_PHY_LO_CTL B43legacy_PHY_EXTG(0x10) /* Local Oscillator control */ -#define B43legacy_PHY_RFOVER B43legacy_PHY_EXTG(0x11) /* RF override */ -#define B43legacy_PHY_RFOVERVAL B43legacy_PHY_EXTG(0x12) /* RF override value */ -/*** OFDM table numbers ***/ -#define B43legacy_OFDMTAB(number, offset) \ - (((number) << B43legacy_PHY_OTABLENR_SHIFT) \ - | (offset)) -#define B43legacy_OFDMTAB_AGC1 B43legacy_OFDMTAB(0x00, 0) -#define B43legacy_OFDMTAB_GAIN0 B43legacy_OFDMTAB(0x00, 0) -#define B43legacy_OFDMTAB_GAINX B43legacy_OFDMTAB(0x01, 0) -#define B43legacy_OFDMTAB_GAIN1 B43legacy_OFDMTAB(0x01, 4) -#define B43legacy_OFDMTAB_AGC3 B43legacy_OFDMTAB(0x02, 0) -#define B43legacy_OFDMTAB_GAIN2 B43legacy_OFDMTAB(0x02, 3) -#define B43legacy_OFDMTAB_LNAHPFGAIN1 B43legacy_OFDMTAB(0x03, 0) -#define B43legacy_OFDMTAB_WRSSI B43legacy_OFDMTAB(0x04, 0) -#define B43legacy_OFDMTAB_LNAHPFGAIN2 B43legacy_OFDMTAB(0x04, 0) -#define B43legacy_OFDMTAB_NOISESCALE B43legacy_OFDMTAB(0x05, 0) -#define B43legacy_OFDMTAB_AGC2 B43legacy_OFDMTAB(0x06, 0) -#define B43legacy_OFDMTAB_ROTOR B43legacy_OFDMTAB(0x08, 0) -#define B43legacy_OFDMTAB_ADVRETARD B43legacy_OFDMTAB(0x09, 0) -#define B43legacy_OFDMTAB_DAC B43legacy_OFDMTAB(0x0C, 0) -#define B43legacy_OFDMTAB_DC B43legacy_OFDMTAB(0x0E, 7) -#define B43legacy_OFDMTAB_PWRDYN2 B43legacy_OFDMTAB(0x0E, 12) -#define B43legacy_OFDMTAB_LNAGAIN B43legacy_OFDMTAB(0x0E, 13) - -#define B43legacy_OFDMTAB_LPFGAIN B43legacy_OFDMTAB(0x0F, 12) -#define B43legacy_OFDMTAB_RSSI B43legacy_OFDMTAB(0x10, 0) - -#define B43legacy_OFDMTAB_AGC1_R1 B43legacy_OFDMTAB(0x13, 0) -#define B43legacy_OFDMTAB_GAINX_R1 B43legacy_OFDMTAB(0x14, 0) -#define B43legacy_OFDMTAB_MINSIGSQ B43legacy_OFDMTAB(0x14, 1) -#define B43legacy_OFDMTAB_AGC3_R1 B43legacy_OFDMTAB(0x15, 0) -#define B43legacy_OFDMTAB_WRSSI_R1 B43legacy_OFDMTAB(0x15, 4) -#define B43legacy_OFDMTAB_TSSI B43legacy_OFDMTAB(0x15, 0) -#define B43legacy_OFDMTAB_DACRFPABB B43legacy_OFDMTAB(0x16, 0) -#define B43legacy_OFDMTAB_DACOFF B43legacy_OFDMTAB(0x17, 0) -#define B43legacy_OFDMTAB_DCBIAS B43legacy_OFDMTAB(0x18, 0) - -void b43legacy_put_attenuation_into_ranges(int *_bbatt, int *_rfatt); - -/* OFDM (A) PHY Registers */ -#define B43legacy_PHY_VERSION_OFDM B43legacy_PHY_OFDM(0x00) /* Versioning register for A-PHY */ -#define B43legacy_PHY_BBANDCFG B43legacy_PHY_OFDM(0x01) /* Baseband config */ -#define B43legacy_PHY_BBANDCFG_RXANT 0x180 /* RX Antenna selection */ -#define B43legacy_PHY_BBANDCFG_RXANT_SHIFT 7 -#define B43legacy_PHY_PWRDOWN B43legacy_PHY_OFDM(0x03) /* Powerdown */ -#define B43legacy_PHY_CRSTHRES1 B43legacy_PHY_OFDM(0x06) /* CRS Threshold 1 */ -#define B43legacy_PHY_LNAHPFCTL B43legacy_PHY_OFDM(0x1C) /* LNA/HPF control */ -#define B43legacy_PHY_ADIVRELATED B43legacy_PHY_OFDM(0x27) /* FIXME rename */ -#define B43legacy_PHY_CRS0 B43legacy_PHY_OFDM(0x29) -#define B43legacy_PHY_ANTDWELL B43legacy_PHY_OFDM(0x2B) /* Antenna dwell */ -#define B43legacy_PHY_ANTDWELL_AUTODIV1 0x0100 /* Automatic RX diversity start antenna */ -#define B43legacy_PHY_ENCORE B43legacy_PHY_OFDM(0x49) /* "Encore" (RangeMax / BroadRange) */ -#define B43legacy_PHY_ENCORE_EN 0x0200 /* Encore enable */ -#define B43legacy_PHY_LMS B43legacy_PHY_OFDM(0x55) -#define B43legacy_PHY_OFDM61 B43legacy_PHY_OFDM(0x61) /* FIXME rename */ -#define B43legacy_PHY_OFDM61_10 0x0010 /* FIXME rename */ -#define B43legacy_PHY_IQBAL B43legacy_PHY_OFDM(0x69) /* I/Q balance */ -#define B43legacy_PHY_OTABLECTL B43legacy_PHY_OFDM(0x72) /* OFDM table control (see below) */ -#define B43legacy_PHY_OTABLEOFF 0x03FF /* OFDM table offset (see below) */ -#define B43legacy_PHY_OTABLENR 0xFC00 /* OFDM table number (see below) */ -#define B43legacy_PHY_OTABLENR_SHIFT 10 -#define B43legacy_PHY_OTABLEI B43legacy_PHY_OFDM(0x73) /* OFDM table data I */ -#define B43legacy_PHY_OTABLEQ B43legacy_PHY_OFDM(0x74) /* OFDM table data Q */ -#define B43legacy_PHY_HPWR_TSSICTL B43legacy_PHY_OFDM(0x78) /* Hardware power TSSI control */ -#define B43legacy_PHY_NRSSITHRES B43legacy_PHY_OFDM(0x8A) /* NRSSI threshold */ -#define B43legacy_PHY_ANTWRSETT B43legacy_PHY_OFDM(0x8C) /* Antenna WR settle */ -#define B43legacy_PHY_ANTWRSETT_ARXDIV 0x2000 /* Automatic RX diversity enabled */ -#define B43legacy_PHY_CLIPPWRDOWNT B43legacy_PHY_OFDM(0x93) /* Clip powerdown threshold */ -#define B43legacy_PHY_OFDM9B B43legacy_PHY_OFDM(0x9B) /* FIXME rename */ -#define B43legacy_PHY_N1P1GAIN B43legacy_PHY_OFDM(0xA0) -#define B43legacy_PHY_P1P2GAIN B43legacy_PHY_OFDM(0xA1) -#define B43legacy_PHY_N1N2GAIN B43legacy_PHY_OFDM(0xA2) -#define B43legacy_PHY_CLIPTHRES B43legacy_PHY_OFDM(0xA3) -#define B43legacy_PHY_CLIPN1P2THRES B43legacy_PHY_OFDM(0xA4) -#define B43legacy_PHY_DIVSRCHIDX B43legacy_PHY_OFDM(0xA8) /* Divider search gain/index */ -#define B43legacy_PHY_CLIPP2THRES B43legacy_PHY_OFDM(0xA9) -#define B43legacy_PHY_CLIPP3THRES B43legacy_PHY_OFDM(0xAA) -#define B43legacy_PHY_DIVP1P2GAIN B43legacy_PHY_OFDM(0xAB) -#define B43legacy_PHY_DIVSRCHGAINBACK B43legacy_PHY_OFDM(0xAD) /* Divider search gain back */ -#define B43legacy_PHY_DIVSRCHGAINCHNG B43legacy_PHY_OFDM(0xAE) /* Divider search gain change */ -#define B43legacy_PHY_CRSTHRES1_R1 B43legacy_PHY_OFDM(0xC0) /* CRS Threshold 1 (rev 1 only) */ -#define B43legacy_PHY_CRSTHRES2_R1 B43legacy_PHY_OFDM(0xC1) /* CRS Threshold 2 (rev 1 only) */ -#define B43legacy_PHY_TSSIP_LTBASE B43legacy_PHY_OFDM(0x380) /* TSSI power lookup table base */ -#define B43legacy_PHY_DC_LTBASE B43legacy_PHY_OFDM(0x3A0) /* DC lookup table base */ -#define B43legacy_PHY_GAIN_LTBASE B43legacy_PHY_OFDM(0x3C0) /* Gain lookup table base */ - -void b43legacy_put_attenuation_into_ranges(int *_bbatt, int *_rfatt); - -/* Masks for the different PHY versioning registers. */ -#define B43legacy_PHYVER_ANALOG 0xF000 -#define B43legacy_PHYVER_ANALOG_SHIFT 12 -#define B43legacy_PHYVER_TYPE 0x0F00 -#define B43legacy_PHYVER_TYPE_SHIFT 8 -#define B43legacy_PHYVER_VERSION 0x00FF - -struct b43legacy_wldev; - -void b43legacy_phy_lock(struct b43legacy_wldev *dev); -void b43legacy_phy_unlock(struct b43legacy_wldev *dev); - -/* Card uses the loopback gain stuff */ -#define has_loopback_gain(phy) \ - (((phy)->rev > 1) || ((phy)->gmode)) - -u16 b43legacy_phy_read(struct b43legacy_wldev *dev, u16 offset); -void b43legacy_phy_write(struct b43legacy_wldev *dev, u16 offset, u16 val); - -int b43legacy_phy_init_tssi2dbm_table(struct b43legacy_wldev *dev); -int b43legacy_phy_init(struct b43legacy_wldev *dev); - -void b43legacy_set_rx_antenna(struct b43legacy_wldev *dev, int antenna); - -void b43legacy_phy_set_antenna_diversity(struct b43legacy_wldev *dev); -void b43legacy_phy_calibrate(struct b43legacy_wldev *dev); -int b43legacy_phy_connect(struct b43legacy_wldev *dev, int connect); - -void b43legacy_phy_lo_b_measure(struct b43legacy_wldev *dev); -void b43legacy_phy_lo_g_measure(struct b43legacy_wldev *dev); -void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev); - -/* Adjust the LocalOscillator to the saved values. - * "fixed" is only set to 1 once in initialization. Set to 0 otherwise. - */ -void b43legacy_phy_lo_adjust(struct b43legacy_wldev *dev, int fixed); -void b43legacy_phy_lo_mark_all_unused(struct b43legacy_wldev *dev); - -void b43legacy_phy_set_baseband_attenuation(struct b43legacy_wldev *dev, - u16 baseband_attenuation); - -void b43legacy_power_saving_ctl_bits(struct b43legacy_wldev *dev, - int bit25, int bit26); - -#endif /* B43legacy_PHY_H_ */ diff --git a/drivers/net/wireless/b43legacy/pio.c b/drivers/net/wireless/b43legacy/pio.c deleted file mode 100644 index 282eedec675e..000000000000 --- a/drivers/net/wireless/b43legacy/pio.c +++ /dev/null @@ -1,695 +0,0 @@ -/* - - Broadcom B43legacy wireless driver - - PIO Transmission - - Copyright (c) 2005 Michael Buesch - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "b43legacy.h" -#include "pio.h" -#include "main.h" -#include "xmit.h" - -#include -#include - - -static void tx_start(struct b43legacy_pioqueue *queue) -{ - b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, - B43legacy_PIO_TXCTL_INIT); -} - -static void tx_octet(struct b43legacy_pioqueue *queue, - u8 octet) -{ - if (queue->need_workarounds) { - b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, octet); - b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, - B43legacy_PIO_TXCTL_WRITELO); - } else { - b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, - B43legacy_PIO_TXCTL_WRITELO); - b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, octet); - } -} - -static u16 tx_get_next_word(const u8 *txhdr, - const u8 *packet, - size_t txhdr_size, - unsigned int *pos) -{ - const u8 *source; - unsigned int i = *pos; - u16 ret; - - if (i < txhdr_size) - source = txhdr; - else { - source = packet; - i -= txhdr_size; - } - ret = le16_to_cpu(*((__le16 *)(source + i))); - *pos += 2; - - return ret; -} - -static void tx_data(struct b43legacy_pioqueue *queue, - u8 *txhdr, - const u8 *packet, - unsigned int octets) -{ - u16 data; - unsigned int i = 0; - - if (queue->need_workarounds) { - data = tx_get_next_word(txhdr, packet, - sizeof(struct b43legacy_txhdr_fw3), &i); - b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, data); - } - b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, - B43legacy_PIO_TXCTL_WRITELO | - B43legacy_PIO_TXCTL_WRITEHI); - while (i < octets - 1) { - data = tx_get_next_word(txhdr, packet, - sizeof(struct b43legacy_txhdr_fw3), &i); - b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, data); - } - if (octets % 2) - tx_octet(queue, packet[octets - - sizeof(struct b43legacy_txhdr_fw3) - 1]); -} - -static void tx_complete(struct b43legacy_pioqueue *queue, - struct sk_buff *skb) -{ - if (queue->need_workarounds) { - b43legacy_pio_write(queue, B43legacy_PIO_TXDATA, - skb->data[skb->len - 1]); - b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, - B43legacy_PIO_TXCTL_WRITELO | - B43legacy_PIO_TXCTL_COMPLETE); - } else - b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, - B43legacy_PIO_TXCTL_COMPLETE); -} - -static u16 generate_cookie(struct b43legacy_pioqueue *queue, - struct b43legacy_pio_txpacket *packet) -{ - u16 cookie = 0x0000; - int packetindex; - - /* We use the upper 4 bits for the PIO - * controller ID and the lower 12 bits - * for the packet index (in the cache). - */ - switch (queue->mmio_base) { - case B43legacy_MMIO_PIO1_BASE: - break; - case B43legacy_MMIO_PIO2_BASE: - cookie = 0x1000; - break; - case B43legacy_MMIO_PIO3_BASE: - cookie = 0x2000; - break; - case B43legacy_MMIO_PIO4_BASE: - cookie = 0x3000; - break; - default: - B43legacy_WARN_ON(1); - } - packetindex = pio_txpacket_getindex(packet); - B43legacy_WARN_ON(!(((u16)packetindex & 0xF000) == 0x0000)); - cookie |= (u16)packetindex; - - return cookie; -} - -static -struct b43legacy_pioqueue *parse_cookie(struct b43legacy_wldev *dev, - u16 cookie, - struct b43legacy_pio_txpacket **packet) -{ - struct b43legacy_pio *pio = &dev->pio; - struct b43legacy_pioqueue *queue = NULL; - int packetindex; - - switch (cookie & 0xF000) { - case 0x0000: - queue = pio->queue0; - break; - case 0x1000: - queue = pio->queue1; - break; - case 0x2000: - queue = pio->queue2; - break; - case 0x3000: - queue = pio->queue3; - break; - default: - B43legacy_WARN_ON(1); - } - packetindex = (cookie & 0x0FFF); - B43legacy_WARN_ON(!(packetindex >= 0 && packetindex - < B43legacy_PIO_MAXTXPACKETS)); - *packet = &(queue->tx_packets_cache[packetindex]); - - return queue; -} - -union txhdr_union { - struct b43legacy_txhdr_fw3 txhdr_fw3; -}; - -static int pio_tx_write_fragment(struct b43legacy_pioqueue *queue, - struct sk_buff *skb, - struct b43legacy_pio_txpacket *packet, - size_t txhdr_size) -{ - union txhdr_union txhdr_data; - u8 *txhdr = NULL; - unsigned int octets; - int err; - - txhdr = (u8 *)(&txhdr_data.txhdr_fw3); - - B43legacy_WARN_ON(skb_shinfo(skb)->nr_frags != 0); - err = b43legacy_generate_txhdr(queue->dev, - txhdr, skb->data, skb->len, - IEEE80211_SKB_CB(skb), - generate_cookie(queue, packet)); - if (err) - return err; - - tx_start(queue); - octets = skb->len + txhdr_size; - if (queue->need_workarounds) - octets--; - tx_data(queue, txhdr, (u8 *)skb->data, octets); - tx_complete(queue, skb); - - return 0; -} - -static void free_txpacket(struct b43legacy_pio_txpacket *packet, - int irq_context) -{ - struct b43legacy_pioqueue *queue = packet->queue; - - if (packet->skb) { - if (irq_context) - dev_kfree_skb_irq(packet->skb); - else - dev_kfree_skb(packet->skb); - } - list_move(&packet->list, &queue->txfree); - queue->nr_txfree++; -} - -static int pio_tx_packet(struct b43legacy_pio_txpacket *packet) -{ - struct b43legacy_pioqueue *queue = packet->queue; - struct sk_buff *skb = packet->skb; - u16 octets; - int err; - - octets = (u16)skb->len + sizeof(struct b43legacy_txhdr_fw3); - if (queue->tx_devq_size < octets) { - b43legacywarn(queue->dev->wl, "PIO queue too small. " - "Dropping packet.\n"); - /* Drop it silently (return success) */ - free_txpacket(packet, 1); - return 0; - } - B43legacy_WARN_ON(queue->tx_devq_packets > - B43legacy_PIO_MAXTXDEVQPACKETS); - B43legacy_WARN_ON(queue->tx_devq_used > queue->tx_devq_size); - /* Check if there is sufficient free space on the device - * TX queue. If not, return and let the TX tasklet - * retry later. - */ - if (queue->tx_devq_packets == B43legacy_PIO_MAXTXDEVQPACKETS) - return -EBUSY; - if (queue->tx_devq_used + octets > queue->tx_devq_size) - return -EBUSY; - /* Now poke the device. */ - err = pio_tx_write_fragment(queue, skb, packet, - sizeof(struct b43legacy_txhdr_fw3)); - if (unlikely(err == -ENOKEY)) { - /* Drop this packet, as we don't have the encryption key - * anymore and must not transmit it unencrypted. */ - free_txpacket(packet, 1); - return 0; - } - - /* Account for the packet size. - * (We must not overflow the device TX queue) - */ - queue->tx_devq_packets++; - queue->tx_devq_used += octets; - - /* Transmission started, everything ok, move the - * packet to the txrunning list. - */ - list_move_tail(&packet->list, &queue->txrunning); - - return 0; -} - -static void tx_tasklet(unsigned long d) -{ - struct b43legacy_pioqueue *queue = (struct b43legacy_pioqueue *)d; - struct b43legacy_wldev *dev = queue->dev; - unsigned long flags; - struct b43legacy_pio_txpacket *packet, *tmp_packet; - int err; - u16 txctl; - - spin_lock_irqsave(&dev->wl->irq_lock, flags); - if (queue->tx_frozen) - goto out_unlock; - txctl = b43legacy_pio_read(queue, B43legacy_PIO_TXCTL); - if (txctl & B43legacy_PIO_TXCTL_SUSPEND) - goto out_unlock; - - list_for_each_entry_safe(packet, tmp_packet, &queue->txqueue, list) { - /* Try to transmit the packet. This can fail, if - * the device queue is full. In case of failure, the - * packet is left in the txqueue. - * If transmission succeed, the packet is moved to txrunning. - * If it is impossible to transmit the packet, it - * is dropped. - */ - err = pio_tx_packet(packet); - if (err) - break; - } -out_unlock: - spin_unlock_irqrestore(&dev->wl->irq_lock, flags); -} - -static void setup_txqueues(struct b43legacy_pioqueue *queue) -{ - struct b43legacy_pio_txpacket *packet; - int i; - - queue->nr_txfree = B43legacy_PIO_MAXTXPACKETS; - for (i = 0; i < B43legacy_PIO_MAXTXPACKETS; i++) { - packet = &(queue->tx_packets_cache[i]); - - packet->queue = queue; - INIT_LIST_HEAD(&packet->list); - - list_add(&packet->list, &queue->txfree); - } -} - -static -struct b43legacy_pioqueue *b43legacy_setup_pioqueue(struct b43legacy_wldev *dev, - u16 pio_mmio_base) -{ - struct b43legacy_pioqueue *queue; - u32 value; - u16 qsize; - - queue = kzalloc(sizeof(*queue), GFP_KERNEL); - if (!queue) - goto out; - - queue->dev = dev; - queue->mmio_base = pio_mmio_base; - queue->need_workarounds = (dev->dev->id.revision < 3); - - INIT_LIST_HEAD(&queue->txfree); - INIT_LIST_HEAD(&queue->txqueue); - INIT_LIST_HEAD(&queue->txrunning); - tasklet_init(&queue->txtask, tx_tasklet, - (unsigned long)queue); - - value = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - value &= ~B43legacy_MACCTL_BE; - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, value); - - qsize = b43legacy_read16(dev, queue->mmio_base - + B43legacy_PIO_TXQBUFSIZE); - if (qsize == 0) { - b43legacyerr(dev->wl, "This card does not support PIO " - "operation mode. Please use DMA mode " - "(module parameter pio=0).\n"); - goto err_freequeue; - } - if (qsize <= B43legacy_PIO_TXQADJUST) { - b43legacyerr(dev->wl, "PIO tx device-queue too small (%u)\n", - qsize); - goto err_freequeue; - } - qsize -= B43legacy_PIO_TXQADJUST; - queue->tx_devq_size = qsize; - - setup_txqueues(queue); - -out: - return queue; - -err_freequeue: - kfree(queue); - queue = NULL; - goto out; -} - -static void cancel_transfers(struct b43legacy_pioqueue *queue) -{ - struct b43legacy_pio_txpacket *packet, *tmp_packet; - - tasklet_kill(&queue->txtask); - - list_for_each_entry_safe(packet, tmp_packet, &queue->txrunning, list) - free_txpacket(packet, 0); - list_for_each_entry_safe(packet, tmp_packet, &queue->txqueue, list) - free_txpacket(packet, 0); -} - -static void b43legacy_destroy_pioqueue(struct b43legacy_pioqueue *queue) -{ - if (!queue) - return; - - cancel_transfers(queue); - kfree(queue); -} - -void b43legacy_pio_free(struct b43legacy_wldev *dev) -{ - struct b43legacy_pio *pio; - - if (!b43legacy_using_pio(dev)) - return; - pio = &dev->pio; - - b43legacy_destroy_pioqueue(pio->queue3); - pio->queue3 = NULL; - b43legacy_destroy_pioqueue(pio->queue2); - pio->queue2 = NULL; - b43legacy_destroy_pioqueue(pio->queue1); - pio->queue1 = NULL; - b43legacy_destroy_pioqueue(pio->queue0); - pio->queue0 = NULL; -} - -int b43legacy_pio_init(struct b43legacy_wldev *dev) -{ - struct b43legacy_pio *pio = &dev->pio; - struct b43legacy_pioqueue *queue; - int err = -ENOMEM; - - queue = b43legacy_setup_pioqueue(dev, B43legacy_MMIO_PIO1_BASE); - if (!queue) - goto out; - pio->queue0 = queue; - - queue = b43legacy_setup_pioqueue(dev, B43legacy_MMIO_PIO2_BASE); - if (!queue) - goto err_destroy0; - pio->queue1 = queue; - - queue = b43legacy_setup_pioqueue(dev, B43legacy_MMIO_PIO3_BASE); - if (!queue) - goto err_destroy1; - pio->queue2 = queue; - - queue = b43legacy_setup_pioqueue(dev, B43legacy_MMIO_PIO4_BASE); - if (!queue) - goto err_destroy2; - pio->queue3 = queue; - - if (dev->dev->id.revision < 3) - dev->irq_mask |= B43legacy_IRQ_PIO_WORKAROUND; - - b43legacydbg(dev->wl, "PIO initialized\n"); - err = 0; -out: - return err; - -err_destroy2: - b43legacy_destroy_pioqueue(pio->queue2); - pio->queue2 = NULL; -err_destroy1: - b43legacy_destroy_pioqueue(pio->queue1); - pio->queue1 = NULL; -err_destroy0: - b43legacy_destroy_pioqueue(pio->queue0); - pio->queue0 = NULL; - goto out; -} - -int b43legacy_pio_tx(struct b43legacy_wldev *dev, - struct sk_buff *skb) -{ - struct b43legacy_pioqueue *queue = dev->pio.queue1; - struct b43legacy_pio_txpacket *packet; - - B43legacy_WARN_ON(queue->tx_suspended); - B43legacy_WARN_ON(list_empty(&queue->txfree)); - - packet = list_entry(queue->txfree.next, struct b43legacy_pio_txpacket, - list); - packet->skb = skb; - - list_move_tail(&packet->list, &queue->txqueue); - queue->nr_txfree--; - B43legacy_WARN_ON(queue->nr_txfree >= B43legacy_PIO_MAXTXPACKETS); - - tasklet_schedule(&queue->txtask); - - return 0; -} - -void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev, - const struct b43legacy_txstatus *status) -{ - struct b43legacy_pioqueue *queue; - struct b43legacy_pio_txpacket *packet; - struct ieee80211_tx_info *info; - int retry_limit; - - queue = parse_cookie(dev, status->cookie, &packet); - B43legacy_WARN_ON(!queue); - - if (!packet->skb) - return; - - queue->tx_devq_packets--; - queue->tx_devq_used -= (packet->skb->len + - sizeof(struct b43legacy_txhdr_fw3)); - - info = IEEE80211_SKB_CB(packet->skb); - - /* preserve the confiured retry limit before clearing the status - * The xmit function has overwritten the rc's value with the actual - * retry limit done by the hardware */ - retry_limit = info->status.rates[0].count; - ieee80211_tx_info_clear_status(info); - - if (status->acked) - info->flags |= IEEE80211_TX_STAT_ACK; - - if (status->rts_count > dev->wl->hw->conf.short_frame_max_tx_count) { - /* - * If the short retries (RTS, not data frame) have exceeded - * the limit, the hw will not have tried the selected rate, - * but will have used the fallback rate instead. - * Don't let the rate control count attempts for the selected - * rate in this case, otherwise the statistics will be off. - */ - info->status.rates[0].count = 0; - info->status.rates[1].count = status->frame_count; - } else { - if (status->frame_count > retry_limit) { - info->status.rates[0].count = retry_limit; - info->status.rates[1].count = status->frame_count - - retry_limit; - - } else { - info->status.rates[0].count = status->frame_count; - info->status.rates[1].idx = -1; - } - } - ieee80211_tx_status_irqsafe(dev->wl->hw, packet->skb); - packet->skb = NULL; - - free_txpacket(packet, 1); - /* If there are packets on the txqueue, poke the tasklet - * to transmit them. - */ - if (!list_empty(&queue->txqueue)) - tasklet_schedule(&queue->txtask); -} - -static void pio_rx_error(struct b43legacy_pioqueue *queue, - int clear_buffers, - const char *error) -{ - int i; - - b43legacyerr(queue->dev->wl, "PIO RX error: %s\n", error); - b43legacy_pio_write(queue, B43legacy_PIO_RXCTL, - B43legacy_PIO_RXCTL_READY); - if (clear_buffers) { - B43legacy_WARN_ON(queue->mmio_base != B43legacy_MMIO_PIO1_BASE); - for (i = 0; i < 15; i++) { - /* Dummy read. */ - b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); - } - } -} - -void b43legacy_pio_rx(struct b43legacy_pioqueue *queue) -{ - __le16 preamble[21] = { 0 }; - struct b43legacy_rxhdr_fw3 *rxhdr; - u16 tmp; - u16 len; - u16 macstat; - int i; - int preamble_readwords; - struct sk_buff *skb; - - tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXCTL); - if (!(tmp & B43legacy_PIO_RXCTL_DATAAVAILABLE)) - return; - b43legacy_pio_write(queue, B43legacy_PIO_RXCTL, - B43legacy_PIO_RXCTL_DATAAVAILABLE); - - for (i = 0; i < 10; i++) { - tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXCTL); - if (tmp & B43legacy_PIO_RXCTL_READY) - goto data_ready; - udelay(10); - } - b43legacydbg(queue->dev->wl, "PIO RX timed out\n"); - return; -data_ready: - - len = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); - if (unlikely(len > 0x700)) { - pio_rx_error(queue, 0, "len > 0x700"); - return; - } - if (unlikely(len == 0 && queue->mmio_base != - B43legacy_MMIO_PIO4_BASE)) { - pio_rx_error(queue, 0, "len == 0"); - return; - } - preamble[0] = cpu_to_le16(len); - if (queue->mmio_base == B43legacy_MMIO_PIO4_BASE) - preamble_readwords = 14 / sizeof(u16); - else - preamble_readwords = 18 / sizeof(u16); - for (i = 0; i < preamble_readwords; i++) { - tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); - preamble[i + 1] = cpu_to_le16(tmp); - } - rxhdr = (struct b43legacy_rxhdr_fw3 *)preamble; - macstat = le16_to_cpu(rxhdr->mac_status); - if (macstat & B43legacy_RX_MAC_FCSERR) { - pio_rx_error(queue, - (queue->mmio_base == B43legacy_MMIO_PIO1_BASE), - "Frame FCS error"); - return; - } - if (queue->mmio_base == B43legacy_MMIO_PIO4_BASE) { - /* We received an xmit status. */ - struct b43legacy_hwtxstatus *hw; - - hw = (struct b43legacy_hwtxstatus *)(preamble + 1); - b43legacy_handle_hwtxstatus(queue->dev, hw); - - return; - } - - skb = dev_alloc_skb(len); - if (unlikely(!skb)) { - pio_rx_error(queue, 1, "OOM"); - return; - } - skb_put(skb, len); - for (i = 0; i < len - 1; i += 2) { - tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); - *((__le16 *)(skb->data + i)) = cpu_to_le16(tmp); - } - if (len % 2) { - tmp = b43legacy_pio_read(queue, B43legacy_PIO_RXDATA); - skb->data[len - 1] = (tmp & 0x00FF); - } - b43legacy_rx(queue->dev, skb, rxhdr); -} - -void b43legacy_pio_tx_suspend(struct b43legacy_pioqueue *queue) -{ - b43legacy_power_saving_ctl_bits(queue->dev, -1, 1); - b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, - b43legacy_pio_read(queue, B43legacy_PIO_TXCTL) - | B43legacy_PIO_TXCTL_SUSPEND); -} - -void b43legacy_pio_tx_resume(struct b43legacy_pioqueue *queue) -{ - b43legacy_pio_write(queue, B43legacy_PIO_TXCTL, - b43legacy_pio_read(queue, B43legacy_PIO_TXCTL) - & ~B43legacy_PIO_TXCTL_SUSPEND); - b43legacy_power_saving_ctl_bits(queue->dev, -1, -1); - tasklet_schedule(&queue->txtask); -} - -void b43legacy_pio_freeze_txqueues(struct b43legacy_wldev *dev) -{ - struct b43legacy_pio *pio; - - B43legacy_WARN_ON(!b43legacy_using_pio(dev)); - pio = &dev->pio; - pio->queue0->tx_frozen = 1; - pio->queue1->tx_frozen = 1; - pio->queue2->tx_frozen = 1; - pio->queue3->tx_frozen = 1; -} - -void b43legacy_pio_thaw_txqueues(struct b43legacy_wldev *dev) -{ - struct b43legacy_pio *pio; - - B43legacy_WARN_ON(!b43legacy_using_pio(dev)); - pio = &dev->pio; - pio->queue0->tx_frozen = 0; - pio->queue1->tx_frozen = 0; - pio->queue2->tx_frozen = 0; - pio->queue3->tx_frozen = 0; - if (!list_empty(&pio->queue0->txqueue)) - tasklet_schedule(&pio->queue0->txtask); - if (!list_empty(&pio->queue1->txqueue)) - tasklet_schedule(&pio->queue1->txtask); - if (!list_empty(&pio->queue2->txqueue)) - tasklet_schedule(&pio->queue2->txtask); - if (!list_empty(&pio->queue3->txqueue)) - tasklet_schedule(&pio->queue3->txtask); -} diff --git a/drivers/net/wireless/b43legacy/pio.h b/drivers/net/wireless/b43legacy/pio.h deleted file mode 100644 index 8e6773ea6e75..000000000000 --- a/drivers/net/wireless/b43legacy/pio.h +++ /dev/null @@ -1,158 +0,0 @@ -#ifndef B43legacy_PIO_H_ -#define B43legacy_PIO_H_ - -#include "b43legacy.h" - -#include -#include -#include - - -#define B43legacy_PIO_TXCTL 0x00 -#define B43legacy_PIO_TXDATA 0x02 -#define B43legacy_PIO_TXQBUFSIZE 0x04 -#define B43legacy_PIO_RXCTL 0x08 -#define B43legacy_PIO_RXDATA 0x0A - -#define B43legacy_PIO_TXCTL_WRITELO (1 << 0) -#define B43legacy_PIO_TXCTL_WRITEHI (1 << 1) -#define B43legacy_PIO_TXCTL_COMPLETE (1 << 2) -#define B43legacy_PIO_TXCTL_INIT (1 << 3) -#define B43legacy_PIO_TXCTL_SUSPEND (1 << 7) - -#define B43legacy_PIO_RXCTL_DATAAVAILABLE (1 << 0) -#define B43legacy_PIO_RXCTL_READY (1 << 1) - -/* PIO constants */ -#define B43legacy_PIO_MAXTXDEVQPACKETS 31 -#define B43legacy_PIO_TXQADJUST 80 - -/* PIO tuning knobs */ -#define B43legacy_PIO_MAXTXPACKETS 256 - - - -#ifdef CONFIG_B43LEGACY_PIO - - -struct b43legacy_pioqueue; -struct b43legacy_xmitstatus; - -struct b43legacy_pio_txpacket { - struct b43legacy_pioqueue *queue; - struct sk_buff *skb; - struct list_head list; -}; - -#define pio_txpacket_getindex(packet) ((int)((packet) - \ - (packet)->queue->tx_packets_cache)) - -struct b43legacy_pioqueue { - struct b43legacy_wldev *dev; - u16 mmio_base; - - bool tx_suspended; - bool tx_frozen; - bool need_workarounds; /* Workarounds needed for core.rev < 3 */ - - /* Adjusted size of the device internal TX buffer. */ - u16 tx_devq_size; - /* Used octets of the device internal TX buffer. */ - u16 tx_devq_used; - /* Used packet slots in the device internal TX buffer. */ - u8 tx_devq_packets; - /* Packets from the txfree list can - * be taken on incoming TX requests. - */ - struct list_head txfree; - unsigned int nr_txfree; - /* Packets on the txqueue are queued, - * but not completely written to the chip, yet. - */ - struct list_head txqueue; - /* Packets on the txrunning queue are completely - * posted to the device. We are waiting for the txstatus. - */ - struct list_head txrunning; - struct tasklet_struct txtask; - struct b43legacy_pio_txpacket - tx_packets_cache[B43legacy_PIO_MAXTXPACKETS]; -}; - -static inline -u16 b43legacy_pio_read(struct b43legacy_pioqueue *queue, - u16 offset) -{ - return b43legacy_read16(queue->dev, queue->mmio_base + offset); -} - -static inline -void b43legacy_pio_write(struct b43legacy_pioqueue *queue, - u16 offset, u16 value) -{ - b43legacy_write16(queue->dev, queue->mmio_base + offset, value); - mmiowb(); -} - - -int b43legacy_pio_init(struct b43legacy_wldev *dev); -void b43legacy_pio_free(struct b43legacy_wldev *dev); - -int b43legacy_pio_tx(struct b43legacy_wldev *dev, - struct sk_buff *skb); -void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev, - const struct b43legacy_txstatus *status); -void b43legacy_pio_rx(struct b43legacy_pioqueue *queue); - -/* Suspend TX queue in hardware. */ -void b43legacy_pio_tx_suspend(struct b43legacy_pioqueue *queue); -void b43legacy_pio_tx_resume(struct b43legacy_pioqueue *queue); -/* Suspend (freeze) the TX tasklet (software level). */ -void b43legacy_pio_freeze_txqueues(struct b43legacy_wldev *dev); -void b43legacy_pio_thaw_txqueues(struct b43legacy_wldev *dev); - -#else /* CONFIG_B43LEGACY_PIO */ - -static inline -int b43legacy_pio_init(struct b43legacy_wldev *dev) -{ - return 0; -} -static inline -void b43legacy_pio_free(struct b43legacy_wldev *dev) -{ -} -static inline -int b43legacy_pio_tx(struct b43legacy_wldev *dev, - struct sk_buff *skb) -{ - return 0; -} -static inline -void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev, - const struct b43legacy_txstatus *status) -{ -} -static inline -void b43legacy_pio_rx(struct b43legacy_pioqueue *queue) -{ -} -static inline -void b43legacy_pio_tx_suspend(struct b43legacy_pioqueue *queue) -{ -} -static inline -void b43legacy_pio_tx_resume(struct b43legacy_pioqueue *queue) -{ -} -static inline -void b43legacy_pio_freeze_txqueues(struct b43legacy_wldev *dev) -{ -} -static inline -void b43legacy_pio_thaw_txqueues(struct b43legacy_wldev *dev) -{ -} - -#endif /* CONFIG_B43LEGACY_PIO */ -#endif /* B43legacy_PIO_H_ */ diff --git a/drivers/net/wireless/b43legacy/radio.c b/drivers/net/wireless/b43legacy/radio.c deleted file mode 100644 index 896177690394..000000000000 --- a/drivers/net/wireless/b43legacy/radio.c +++ /dev/null @@ -1,2162 +0,0 @@ -/* - - Broadcom B43legacy wireless driver - - Copyright (c) 2005 Martin Langer , - Stefano Brivio - Michael Buesch - Danny van Dyk - Andreas Jaggi - Copyright (c) 2007 Larry Finger - - Some parts of the code in this file are derived from the ipw2200 - driver Copyright(c) 2003 - 2004 Intel Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include - -#include "b43legacy.h" -#include "main.h" -#include "phy.h" -#include "radio.h" -#include "ilt.h" - - -/* Table for b43legacy_radio_calibrationvalue() */ -static const u16 rcc_table[16] = { - 0x0002, 0x0003, 0x0001, 0x000F, - 0x0006, 0x0007, 0x0005, 0x000F, - 0x000A, 0x000B, 0x0009, 0x000F, - 0x000E, 0x000F, 0x000D, 0x000F, -}; - -/* Reverse the bits of a 4bit value. - * Example: 1101 is flipped 1011 - */ -static u16 flip_4bit(u16 value) -{ - u16 flipped = 0x0000; - - B43legacy_BUG_ON(!((value & ~0x000F) == 0x0000)); - - flipped |= (value & 0x0001) << 3; - flipped |= (value & 0x0002) << 1; - flipped |= (value & 0x0004) >> 1; - flipped |= (value & 0x0008) >> 3; - - return flipped; -} - -/* Get the freq, as it has to be written to the device. */ -static inline -u16 channel2freq_bg(u8 channel) -{ - /* Frequencies are given as frequencies_bg[index] + 2.4GHz - * Starting with channel 1 - */ - static const u16 frequencies_bg[14] = { - 12, 17, 22, 27, - 32, 37, 42, 47, - 52, 57, 62, 67, - 72, 84, - }; - - if (unlikely(channel < 1 || channel > 14)) { - printk(KERN_INFO "b43legacy: Channel %d is out of range\n", - channel); - dump_stack(); - return 2412; - } - - return frequencies_bg[channel - 1]; -} - -void b43legacy_radio_lock(struct b43legacy_wldev *dev) -{ - u32 status; - - status = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - B43legacy_WARN_ON(status & B43legacy_MACCTL_RADIOLOCK); - status |= B43legacy_MACCTL_RADIOLOCK; - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, status); - mmiowb(); - udelay(10); -} - -void b43legacy_radio_unlock(struct b43legacy_wldev *dev) -{ - u32 status; - - b43legacy_read16(dev, B43legacy_MMIO_PHY_VER); /* dummy read */ - status = b43legacy_read32(dev, B43legacy_MMIO_MACCTL); - B43legacy_WARN_ON(!(status & B43legacy_MACCTL_RADIOLOCK)); - status &= ~B43legacy_MACCTL_RADIOLOCK; - b43legacy_write32(dev, B43legacy_MMIO_MACCTL, status); - mmiowb(); -} - -u16 b43legacy_radio_read16(struct b43legacy_wldev *dev, u16 offset) -{ - struct b43legacy_phy *phy = &dev->phy; - - switch (phy->type) { - case B43legacy_PHYTYPE_B: - if (phy->radio_ver == 0x2053) { - if (offset < 0x70) - offset += 0x80; - else if (offset < 0x80) - offset += 0x70; - } else if (phy->radio_ver == 0x2050) - offset |= 0x80; - else - B43legacy_WARN_ON(1); - break; - case B43legacy_PHYTYPE_G: - offset |= 0x80; - break; - default: - B43legacy_BUG_ON(1); - } - - b43legacy_write16(dev, B43legacy_MMIO_RADIO_CONTROL, offset); - return b43legacy_read16(dev, B43legacy_MMIO_RADIO_DATA_LOW); -} - -void b43legacy_radio_write16(struct b43legacy_wldev *dev, u16 offset, u16 val) -{ - b43legacy_write16(dev, B43legacy_MMIO_RADIO_CONTROL, offset); - mmiowb(); - b43legacy_write16(dev, B43legacy_MMIO_RADIO_DATA_LOW, val); -} - -static void b43legacy_set_all_gains(struct b43legacy_wldev *dev, - s16 first, s16 second, s16 third) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 i; - u16 start = 0x08; - u16 end = 0x18; - u16 offset = 0x0400; - u16 tmp; - - if (phy->rev <= 1) { - offset = 0x5000; - start = 0x10; - end = 0x20; - } - - for (i = 0; i < 4; i++) - b43legacy_ilt_write(dev, offset + i, first); - - for (i = start; i < end; i++) - b43legacy_ilt_write(dev, offset + i, second); - - if (third != -1) { - tmp = ((u16)third << 14) | ((u16)third << 6); - b43legacy_phy_write(dev, 0x04A0, - (b43legacy_phy_read(dev, 0x04A0) & 0xBFBF) - | tmp); - b43legacy_phy_write(dev, 0x04A1, - (b43legacy_phy_read(dev, 0x04A1) & 0xBFBF) - | tmp); - b43legacy_phy_write(dev, 0x04A2, - (b43legacy_phy_read(dev, 0x04A2) & 0xBFBF) - | tmp); - } - b43legacy_dummy_transmission(dev); -} - -static void b43legacy_set_original_gains(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 i; - u16 tmp; - u16 offset = 0x0400; - u16 start = 0x0008; - u16 end = 0x0018; - - if (phy->rev <= 1) { - offset = 0x5000; - start = 0x0010; - end = 0x0020; - } - - for (i = 0; i < 4; i++) { - tmp = (i & 0xFFFC); - tmp |= (i & 0x0001) << 1; - tmp |= (i & 0x0002) >> 1; - - b43legacy_ilt_write(dev, offset + i, tmp); - } - - for (i = start; i < end; i++) - b43legacy_ilt_write(dev, offset + i, i - start); - - b43legacy_phy_write(dev, 0x04A0, - (b43legacy_phy_read(dev, 0x04A0) & 0xBFBF) - | 0x4040); - b43legacy_phy_write(dev, 0x04A1, - (b43legacy_phy_read(dev, 0x04A1) & 0xBFBF) - | 0x4040); - b43legacy_phy_write(dev, 0x04A2, - (b43legacy_phy_read(dev, 0x04A2) & 0xBFBF) - | 0x4000); - b43legacy_dummy_transmission(dev); -} - -/* Synthetic PU workaround */ -static void b43legacy_synth_pu_workaround(struct b43legacy_wldev *dev, - u8 channel) -{ - struct b43legacy_phy *phy = &dev->phy; - - might_sleep(); - - if (phy->radio_ver != 0x2050 || phy->radio_rev >= 6) - /* We do not need the workaround. */ - return; - - if (channel <= 10) - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL, - channel2freq_bg(channel + 4)); - else - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL, - channel2freq_bg(channel)); - msleep(1); - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL, - channel2freq_bg(channel)); -} - -u8 b43legacy_radio_aci_detect(struct b43legacy_wldev *dev, u8 channel) -{ - struct b43legacy_phy *phy = &dev->phy; - u8 ret = 0; - u16 saved; - u16 rssi; - u16 temp; - int i; - int j = 0; - - saved = b43legacy_phy_read(dev, 0x0403); - b43legacy_radio_selectchannel(dev, channel, 0); - b43legacy_phy_write(dev, 0x0403, (saved & 0xFFF8) | 5); - if (phy->aci_hw_rssi) - rssi = b43legacy_phy_read(dev, 0x048A) & 0x3F; - else - rssi = saved & 0x3F; - /* clamp temp to signed 5bit */ - if (rssi > 32) - rssi -= 64; - for (i = 0; i < 100; i++) { - temp = (b43legacy_phy_read(dev, 0x047F) >> 8) & 0x3F; - if (temp > 32) - temp -= 64; - if (temp < rssi) - j++; - if (j >= 20) - ret = 1; - } - b43legacy_phy_write(dev, 0x0403, saved); - - return ret; -} - -u8 b43legacy_radio_aci_scan(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u8 ret[13]; - unsigned int channel = phy->channel; - unsigned int i; - unsigned int j; - unsigned int start; - unsigned int end; - - if (!((phy->type == B43legacy_PHYTYPE_G) && (phy->rev > 0))) - return 0; - - b43legacy_phy_lock(dev); - b43legacy_radio_lock(dev); - b43legacy_phy_write(dev, 0x0802, - b43legacy_phy_read(dev, 0x0802) & 0xFFFC); - b43legacy_phy_write(dev, B43legacy_PHY_G_CRS, - b43legacy_phy_read(dev, B43legacy_PHY_G_CRS) - & 0x7FFF); - b43legacy_set_all_gains(dev, 3, 8, 1); - - start = (channel - 5 > 0) ? channel - 5 : 1; - end = (channel + 5 < 14) ? channel + 5 : 13; - - for (i = start; i <= end; i++) { - if (abs(channel - i) > 2) - ret[i-1] = b43legacy_radio_aci_detect(dev, i); - } - b43legacy_radio_selectchannel(dev, channel, 0); - b43legacy_phy_write(dev, 0x0802, - (b43legacy_phy_read(dev, 0x0802) & 0xFFFC) - | 0x0003); - b43legacy_phy_write(dev, 0x0403, - b43legacy_phy_read(dev, 0x0403) & 0xFFF8); - b43legacy_phy_write(dev, B43legacy_PHY_G_CRS, - b43legacy_phy_read(dev, B43legacy_PHY_G_CRS) - | 0x8000); - b43legacy_set_original_gains(dev); - for (i = 0; i < 13; i++) { - if (!ret[i]) - continue; - end = (i + 5 < 13) ? i + 5 : 13; - for (j = i; j < end; j++) - ret[j] = 1; - } - b43legacy_radio_unlock(dev); - b43legacy_phy_unlock(dev); - - return ret[channel - 1]; -} - -/* http://bcm-specs.sipsolutions.net/NRSSILookupTable */ -void b43legacy_nrssi_hw_write(struct b43legacy_wldev *dev, u16 offset, s16 val) -{ - b43legacy_phy_write(dev, B43legacy_PHY_NRSSILT_CTRL, offset); - mmiowb(); - b43legacy_phy_write(dev, B43legacy_PHY_NRSSILT_DATA, (u16)val); -} - -/* http://bcm-specs.sipsolutions.net/NRSSILookupTable */ -s16 b43legacy_nrssi_hw_read(struct b43legacy_wldev *dev, u16 offset) -{ - u16 val; - - b43legacy_phy_write(dev, B43legacy_PHY_NRSSILT_CTRL, offset); - val = b43legacy_phy_read(dev, B43legacy_PHY_NRSSILT_DATA); - - return (s16)val; -} - -/* http://bcm-specs.sipsolutions.net/NRSSILookupTable */ -void b43legacy_nrssi_hw_update(struct b43legacy_wldev *dev, u16 val) -{ - u16 i; - s16 tmp; - - for (i = 0; i < 64; i++) { - tmp = b43legacy_nrssi_hw_read(dev, i); - tmp -= val; - tmp = clamp_val(tmp, -32, 31); - b43legacy_nrssi_hw_write(dev, i, tmp); - } -} - -/* http://bcm-specs.sipsolutions.net/NRSSILookupTable */ -void b43legacy_nrssi_mem_update(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - s16 i; - s16 delta; - s32 tmp; - - delta = 0x1F - phy->nrssi[0]; - for (i = 0; i < 64; i++) { - tmp = (i - delta) * phy->nrssislope; - tmp /= 0x10000; - tmp += 0x3A; - tmp = clamp_val(tmp, 0, 0x3F); - phy->nrssi_lt[i] = tmp; - } -} - -static void b43legacy_calc_nrssi_offset(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 backup[20] = { 0 }; - s16 v47F; - u16 i; - u16 saved = 0xFFFF; - - backup[0] = b43legacy_phy_read(dev, 0x0001); - backup[1] = b43legacy_phy_read(dev, 0x0811); - backup[2] = b43legacy_phy_read(dev, 0x0812); - backup[3] = b43legacy_phy_read(dev, 0x0814); - backup[4] = b43legacy_phy_read(dev, 0x0815); - backup[5] = b43legacy_phy_read(dev, 0x005A); - backup[6] = b43legacy_phy_read(dev, 0x0059); - backup[7] = b43legacy_phy_read(dev, 0x0058); - backup[8] = b43legacy_phy_read(dev, 0x000A); - backup[9] = b43legacy_phy_read(dev, 0x0003); - backup[10] = b43legacy_radio_read16(dev, 0x007A); - backup[11] = b43legacy_radio_read16(dev, 0x0043); - - b43legacy_phy_write(dev, 0x0429, - b43legacy_phy_read(dev, 0x0429) & 0x7FFF); - b43legacy_phy_write(dev, 0x0001, - (b43legacy_phy_read(dev, 0x0001) & 0x3FFF) - | 0x4000); - b43legacy_phy_write(dev, 0x0811, - b43legacy_phy_read(dev, 0x0811) | 0x000C); - b43legacy_phy_write(dev, 0x0812, - (b43legacy_phy_read(dev, 0x0812) & 0xFFF3) - | 0x0004); - b43legacy_phy_write(dev, 0x0802, - b43legacy_phy_read(dev, 0x0802) & ~(0x1 | 0x2)); - if (phy->rev >= 6) { - backup[12] = b43legacy_phy_read(dev, 0x002E); - backup[13] = b43legacy_phy_read(dev, 0x002F); - backup[14] = b43legacy_phy_read(dev, 0x080F); - backup[15] = b43legacy_phy_read(dev, 0x0810); - backup[16] = b43legacy_phy_read(dev, 0x0801); - backup[17] = b43legacy_phy_read(dev, 0x0060); - backup[18] = b43legacy_phy_read(dev, 0x0014); - backup[19] = b43legacy_phy_read(dev, 0x0478); - - b43legacy_phy_write(dev, 0x002E, 0); - b43legacy_phy_write(dev, 0x002F, 0); - b43legacy_phy_write(dev, 0x080F, 0); - b43legacy_phy_write(dev, 0x0810, 0); - b43legacy_phy_write(dev, 0x0478, - b43legacy_phy_read(dev, 0x0478) | 0x0100); - b43legacy_phy_write(dev, 0x0801, - b43legacy_phy_read(dev, 0x0801) | 0x0040); - b43legacy_phy_write(dev, 0x0060, - b43legacy_phy_read(dev, 0x0060) | 0x0040); - b43legacy_phy_write(dev, 0x0014, - b43legacy_phy_read(dev, 0x0014) | 0x0200); - } - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) | 0x0070); - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) | 0x0080); - udelay(30); - - v47F = (s16)((b43legacy_phy_read(dev, 0x047F) >> 8) & 0x003F); - if (v47F >= 0x20) - v47F -= 0x40; - if (v47F == 31) { - for (i = 7; i >= 4; i--) { - b43legacy_radio_write16(dev, 0x007B, i); - udelay(20); - v47F = (s16)((b43legacy_phy_read(dev, 0x047F) >> 8) - & 0x003F); - if (v47F >= 0x20) - v47F -= 0x40; - if (v47F < 31 && saved == 0xFFFF) - saved = i; - } - if (saved == 0xFFFF) - saved = 4; - } else { - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) - & 0x007F); - b43legacy_phy_write(dev, 0x0814, - b43legacy_phy_read(dev, 0x0814) | 0x0001); - b43legacy_phy_write(dev, 0x0815, - b43legacy_phy_read(dev, 0x0815) & 0xFFFE); - b43legacy_phy_write(dev, 0x0811, - b43legacy_phy_read(dev, 0x0811) | 0x000C); - b43legacy_phy_write(dev, 0x0812, - b43legacy_phy_read(dev, 0x0812) | 0x000C); - b43legacy_phy_write(dev, 0x0811, - b43legacy_phy_read(dev, 0x0811) | 0x0030); - b43legacy_phy_write(dev, 0x0812, - b43legacy_phy_read(dev, 0x0812) | 0x0030); - b43legacy_phy_write(dev, 0x005A, 0x0480); - b43legacy_phy_write(dev, 0x0059, 0x0810); - b43legacy_phy_write(dev, 0x0058, 0x000D); - if (phy->analog == 0) - b43legacy_phy_write(dev, 0x0003, 0x0122); - else - b43legacy_phy_write(dev, 0x000A, - b43legacy_phy_read(dev, 0x000A) - | 0x2000); - b43legacy_phy_write(dev, 0x0814, - b43legacy_phy_read(dev, 0x0814) | 0x0004); - b43legacy_phy_write(dev, 0x0815, - b43legacy_phy_read(dev, 0x0815) & 0xFFFB); - b43legacy_phy_write(dev, 0x0003, - (b43legacy_phy_read(dev, 0x0003) & 0xFF9F) - | 0x0040); - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) - | 0x000F); - b43legacy_set_all_gains(dev, 3, 0, 1); - b43legacy_radio_write16(dev, 0x0043, - (b43legacy_radio_read16(dev, 0x0043) - & 0x00F0) | 0x000F); - udelay(30); - v47F = (s16)((b43legacy_phy_read(dev, 0x047F) >> 8) & 0x003F); - if (v47F >= 0x20) - v47F -= 0x40; - if (v47F == -32) { - for (i = 0; i < 4; i++) { - b43legacy_radio_write16(dev, 0x007B, i); - udelay(20); - v47F = (s16)((b43legacy_phy_read(dev, 0x047F) >> - 8) & 0x003F); - if (v47F >= 0x20) - v47F -= 0x40; - if (v47F > -31 && saved == 0xFFFF) - saved = i; - } - if (saved == 0xFFFF) - saved = 3; - } else - saved = 0; - } - b43legacy_radio_write16(dev, 0x007B, saved); - - if (phy->rev >= 6) { - b43legacy_phy_write(dev, 0x002E, backup[12]); - b43legacy_phy_write(dev, 0x002F, backup[13]); - b43legacy_phy_write(dev, 0x080F, backup[14]); - b43legacy_phy_write(dev, 0x0810, backup[15]); - } - b43legacy_phy_write(dev, 0x0814, backup[3]); - b43legacy_phy_write(dev, 0x0815, backup[4]); - b43legacy_phy_write(dev, 0x005A, backup[5]); - b43legacy_phy_write(dev, 0x0059, backup[6]); - b43legacy_phy_write(dev, 0x0058, backup[7]); - b43legacy_phy_write(dev, 0x000A, backup[8]); - b43legacy_phy_write(dev, 0x0003, backup[9]); - b43legacy_radio_write16(dev, 0x0043, backup[11]); - b43legacy_radio_write16(dev, 0x007A, backup[10]); - b43legacy_phy_write(dev, 0x0802, - b43legacy_phy_read(dev, 0x0802) | 0x1 | 0x2); - b43legacy_phy_write(dev, 0x0429, - b43legacy_phy_read(dev, 0x0429) | 0x8000); - b43legacy_set_original_gains(dev); - if (phy->rev >= 6) { - b43legacy_phy_write(dev, 0x0801, backup[16]); - b43legacy_phy_write(dev, 0x0060, backup[17]); - b43legacy_phy_write(dev, 0x0014, backup[18]); - b43legacy_phy_write(dev, 0x0478, backup[19]); - } - b43legacy_phy_write(dev, 0x0001, backup[0]); - b43legacy_phy_write(dev, 0x0812, backup[2]); - b43legacy_phy_write(dev, 0x0811, backup[1]); -} - -void b43legacy_calc_nrssi_slope(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 backup[18] = { 0 }; - u16 tmp; - s16 nrssi0; - s16 nrssi1; - - switch (phy->type) { - case B43legacy_PHYTYPE_B: - backup[0] = b43legacy_radio_read16(dev, 0x007A); - backup[1] = b43legacy_radio_read16(dev, 0x0052); - backup[2] = b43legacy_radio_read16(dev, 0x0043); - backup[3] = b43legacy_phy_read(dev, 0x0030); - backup[4] = b43legacy_phy_read(dev, 0x0026); - backup[5] = b43legacy_phy_read(dev, 0x0015); - backup[6] = b43legacy_phy_read(dev, 0x002A); - backup[7] = b43legacy_phy_read(dev, 0x0020); - backup[8] = b43legacy_phy_read(dev, 0x005A); - backup[9] = b43legacy_phy_read(dev, 0x0059); - backup[10] = b43legacy_phy_read(dev, 0x0058); - backup[11] = b43legacy_read16(dev, 0x03E2); - backup[12] = b43legacy_read16(dev, 0x03E6); - backup[13] = b43legacy_read16(dev, B43legacy_MMIO_CHANNEL_EXT); - - tmp = b43legacy_radio_read16(dev, 0x007A); - tmp &= (phy->rev >= 5) ? 0x007F : 0x000F; - b43legacy_radio_write16(dev, 0x007A, tmp); - b43legacy_phy_write(dev, 0x0030, 0x00FF); - b43legacy_write16(dev, 0x03EC, 0x7F7F); - b43legacy_phy_write(dev, 0x0026, 0x0000); - b43legacy_phy_write(dev, 0x0015, - b43legacy_phy_read(dev, 0x0015) | 0x0020); - b43legacy_phy_write(dev, 0x002A, 0x08A3); - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) - | 0x0080); - - nrssi0 = (s16)b43legacy_phy_read(dev, 0x0027); - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) - & 0x007F); - if (phy->analog >= 2) - b43legacy_write16(dev, 0x03E6, 0x0040); - else if (phy->analog == 0) - b43legacy_write16(dev, 0x03E6, 0x0122); - else - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL_EXT, - b43legacy_read16(dev, - B43legacy_MMIO_CHANNEL_EXT) & 0x2000); - b43legacy_phy_write(dev, 0x0020, 0x3F3F); - b43legacy_phy_write(dev, 0x0015, 0xF330); - b43legacy_radio_write16(dev, 0x005A, 0x0060); - b43legacy_radio_write16(dev, 0x0043, - b43legacy_radio_read16(dev, 0x0043) - & 0x00F0); - b43legacy_phy_write(dev, 0x005A, 0x0480); - b43legacy_phy_write(dev, 0x0059, 0x0810); - b43legacy_phy_write(dev, 0x0058, 0x000D); - udelay(20); - - nrssi1 = (s16)b43legacy_phy_read(dev, 0x0027); - b43legacy_phy_write(dev, 0x0030, backup[3]); - b43legacy_radio_write16(dev, 0x007A, backup[0]); - b43legacy_write16(dev, 0x03E2, backup[11]); - b43legacy_phy_write(dev, 0x0026, backup[4]); - b43legacy_phy_write(dev, 0x0015, backup[5]); - b43legacy_phy_write(dev, 0x002A, backup[6]); - b43legacy_synth_pu_workaround(dev, phy->channel); - if (phy->analog != 0) - b43legacy_write16(dev, 0x03F4, backup[13]); - - b43legacy_phy_write(dev, 0x0020, backup[7]); - b43legacy_phy_write(dev, 0x005A, backup[8]); - b43legacy_phy_write(dev, 0x0059, backup[9]); - b43legacy_phy_write(dev, 0x0058, backup[10]); - b43legacy_radio_write16(dev, 0x0052, backup[1]); - b43legacy_radio_write16(dev, 0x0043, backup[2]); - - if (nrssi0 == nrssi1) - phy->nrssislope = 0x00010000; - else - phy->nrssislope = 0x00400000 / (nrssi0 - nrssi1); - - if (nrssi0 <= -4) { - phy->nrssi[0] = nrssi0; - phy->nrssi[1] = nrssi1; - } - break; - case B43legacy_PHYTYPE_G: - if (phy->radio_rev >= 9) - return; - if (phy->radio_rev == 8) - b43legacy_calc_nrssi_offset(dev); - - b43legacy_phy_write(dev, B43legacy_PHY_G_CRS, - b43legacy_phy_read(dev, B43legacy_PHY_G_CRS) - & 0x7FFF); - b43legacy_phy_write(dev, 0x0802, - b43legacy_phy_read(dev, 0x0802) & 0xFFFC); - backup[7] = b43legacy_read16(dev, 0x03E2); - b43legacy_write16(dev, 0x03E2, - b43legacy_read16(dev, 0x03E2) | 0x8000); - backup[0] = b43legacy_radio_read16(dev, 0x007A); - backup[1] = b43legacy_radio_read16(dev, 0x0052); - backup[2] = b43legacy_radio_read16(dev, 0x0043); - backup[3] = b43legacy_phy_read(dev, 0x0015); - backup[4] = b43legacy_phy_read(dev, 0x005A); - backup[5] = b43legacy_phy_read(dev, 0x0059); - backup[6] = b43legacy_phy_read(dev, 0x0058); - backup[8] = b43legacy_read16(dev, 0x03E6); - backup[9] = b43legacy_read16(dev, B43legacy_MMIO_CHANNEL_EXT); - if (phy->rev >= 3) { - backup[10] = b43legacy_phy_read(dev, 0x002E); - backup[11] = b43legacy_phy_read(dev, 0x002F); - backup[12] = b43legacy_phy_read(dev, 0x080F); - backup[13] = b43legacy_phy_read(dev, - B43legacy_PHY_G_LO_CONTROL); - backup[14] = b43legacy_phy_read(dev, 0x0801); - backup[15] = b43legacy_phy_read(dev, 0x0060); - backup[16] = b43legacy_phy_read(dev, 0x0014); - backup[17] = b43legacy_phy_read(dev, 0x0478); - b43legacy_phy_write(dev, 0x002E, 0); - b43legacy_phy_write(dev, B43legacy_PHY_G_LO_CONTROL, 0); - switch (phy->rev) { - case 4: case 6: case 7: - b43legacy_phy_write(dev, 0x0478, - b43legacy_phy_read(dev, - 0x0478) | 0x0100); - b43legacy_phy_write(dev, 0x0801, - b43legacy_phy_read(dev, - 0x0801) | 0x0040); - break; - case 3: case 5: - b43legacy_phy_write(dev, 0x0801, - b43legacy_phy_read(dev, - 0x0801) & 0xFFBF); - break; - } - b43legacy_phy_write(dev, 0x0060, - b43legacy_phy_read(dev, 0x0060) - | 0x0040); - b43legacy_phy_write(dev, 0x0014, - b43legacy_phy_read(dev, 0x0014) - | 0x0200); - } - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) - | 0x0070); - b43legacy_set_all_gains(dev, 0, 8, 0); - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) - & 0x00F7); - if (phy->rev >= 2) { - b43legacy_phy_write(dev, 0x0811, - (b43legacy_phy_read(dev, 0x0811) - & 0xFFCF) | 0x0030); - b43legacy_phy_write(dev, 0x0812, - (b43legacy_phy_read(dev, 0x0812) - & 0xFFCF) | 0x0010); - } - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) - | 0x0080); - udelay(20); - - nrssi0 = (s16)((b43legacy_phy_read(dev, 0x047F) >> 8) & 0x003F); - if (nrssi0 >= 0x0020) - nrssi0 -= 0x0040; - - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) - & 0x007F); - if (phy->analog >= 2) - b43legacy_phy_write(dev, 0x0003, - (b43legacy_phy_read(dev, 0x0003) - & 0xFF9F) | 0x0040); - - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL_EXT, - b43legacy_read16(dev, - B43legacy_MMIO_CHANNEL_EXT) | 0x2000); - b43legacy_radio_write16(dev, 0x007A, - b43legacy_radio_read16(dev, 0x007A) - | 0x000F); - b43legacy_phy_write(dev, 0x0015, 0xF330); - if (phy->rev >= 2) { - b43legacy_phy_write(dev, 0x0812, - (b43legacy_phy_read(dev, 0x0812) - & 0xFFCF) | 0x0020); - b43legacy_phy_write(dev, 0x0811, - (b43legacy_phy_read(dev, 0x0811) - & 0xFFCF) | 0x0020); - } - - b43legacy_set_all_gains(dev, 3, 0, 1); - if (phy->radio_rev == 8) - b43legacy_radio_write16(dev, 0x0043, 0x001F); - else { - tmp = b43legacy_radio_read16(dev, 0x0052) & 0xFF0F; - b43legacy_radio_write16(dev, 0x0052, tmp | 0x0060); - tmp = b43legacy_radio_read16(dev, 0x0043) & 0xFFF0; - b43legacy_radio_write16(dev, 0x0043, tmp | 0x0009); - } - b43legacy_phy_write(dev, 0x005A, 0x0480); - b43legacy_phy_write(dev, 0x0059, 0x0810); - b43legacy_phy_write(dev, 0x0058, 0x000D); - udelay(20); - nrssi1 = (s16)((b43legacy_phy_read(dev, 0x047F) >> 8) & 0x003F); - if (nrssi1 >= 0x0020) - nrssi1 -= 0x0040; - if (nrssi0 == nrssi1) - phy->nrssislope = 0x00010000; - else - phy->nrssislope = 0x00400000 / (nrssi0 - nrssi1); - if (nrssi0 >= -4) { - phy->nrssi[0] = nrssi1; - phy->nrssi[1] = nrssi0; - } - if (phy->rev >= 3) { - b43legacy_phy_write(dev, 0x002E, backup[10]); - b43legacy_phy_write(dev, 0x002F, backup[11]); - b43legacy_phy_write(dev, 0x080F, backup[12]); - b43legacy_phy_write(dev, B43legacy_PHY_G_LO_CONTROL, - backup[13]); - } - if (phy->rev >= 2) { - b43legacy_phy_write(dev, 0x0812, - b43legacy_phy_read(dev, 0x0812) - & 0xFFCF); - b43legacy_phy_write(dev, 0x0811, - b43legacy_phy_read(dev, 0x0811) - & 0xFFCF); - } - - b43legacy_radio_write16(dev, 0x007A, backup[0]); - b43legacy_radio_write16(dev, 0x0052, backup[1]); - b43legacy_radio_write16(dev, 0x0043, backup[2]); - b43legacy_write16(dev, 0x03E2, backup[7]); - b43legacy_write16(dev, 0x03E6, backup[8]); - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL_EXT, backup[9]); - b43legacy_phy_write(dev, 0x0015, backup[3]); - b43legacy_phy_write(dev, 0x005A, backup[4]); - b43legacy_phy_write(dev, 0x0059, backup[5]); - b43legacy_phy_write(dev, 0x0058, backup[6]); - b43legacy_synth_pu_workaround(dev, phy->channel); - b43legacy_phy_write(dev, 0x0802, - b43legacy_phy_read(dev, 0x0802) | 0x0003); - b43legacy_set_original_gains(dev); - b43legacy_phy_write(dev, B43legacy_PHY_G_CRS, - b43legacy_phy_read(dev, B43legacy_PHY_G_CRS) - | 0x8000); - if (phy->rev >= 3) { - b43legacy_phy_write(dev, 0x0801, backup[14]); - b43legacy_phy_write(dev, 0x0060, backup[15]); - b43legacy_phy_write(dev, 0x0014, backup[16]); - b43legacy_phy_write(dev, 0x0478, backup[17]); - } - b43legacy_nrssi_mem_update(dev); - b43legacy_calc_nrssi_threshold(dev); - break; - default: - B43legacy_BUG_ON(1); - } -} - -void b43legacy_calc_nrssi_threshold(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - s32 threshold; - s32 a; - s32 b; - s16 tmp16; - u16 tmp_u16; - - switch (phy->type) { - case B43legacy_PHYTYPE_B: { - if (phy->radio_ver != 0x2050) - return; - if (!(dev->dev->bus->sprom.boardflags_lo & - B43legacy_BFL_RSSI)) - return; - - if (phy->radio_rev >= 6) { - threshold = (phy->nrssi[1] - phy->nrssi[0]) * 32; - threshold += 20 * (phy->nrssi[0] + 1); - threshold /= 40; - } else - threshold = phy->nrssi[1] - 5; - - threshold = clamp_val(threshold, 0, 0x3E); - b43legacy_phy_read(dev, 0x0020); /* dummy read */ - b43legacy_phy_write(dev, 0x0020, (((u16)threshold) << 8) - | 0x001C); - - if (phy->radio_rev >= 6) { - b43legacy_phy_write(dev, 0x0087, 0x0E0D); - b43legacy_phy_write(dev, 0x0086, 0x0C0B); - b43legacy_phy_write(dev, 0x0085, 0x0A09); - b43legacy_phy_write(dev, 0x0084, 0x0808); - b43legacy_phy_write(dev, 0x0083, 0x0808); - b43legacy_phy_write(dev, 0x0082, 0x0604); - b43legacy_phy_write(dev, 0x0081, 0x0302); - b43legacy_phy_write(dev, 0x0080, 0x0100); - } - break; - } - case B43legacy_PHYTYPE_G: - if (!phy->gmode || - !(dev->dev->bus->sprom.boardflags_lo & - B43legacy_BFL_RSSI)) { - tmp16 = b43legacy_nrssi_hw_read(dev, 0x20); - if (tmp16 >= 0x20) - tmp16 -= 0x40; - if (tmp16 < 3) - b43legacy_phy_write(dev, 0x048A, - (b43legacy_phy_read(dev, - 0x048A) & 0xF000) | 0x09EB); - else - b43legacy_phy_write(dev, 0x048A, - (b43legacy_phy_read(dev, - 0x048A) & 0xF000) | 0x0AED); - } else { - if (phy->interfmode == - B43legacy_RADIO_INTERFMODE_NONWLAN) { - a = 0xE; - b = 0xA; - } else if (!phy->aci_wlan_automatic && - phy->aci_enable) { - a = 0x13; - b = 0x12; - } else { - a = 0xE; - b = 0x11; - } - - a = a * (phy->nrssi[1] - phy->nrssi[0]); - a += (phy->nrssi[0] << 6); - if (a < 32) - a += 31; - else - a += 32; - a = a >> 6; - a = clamp_val(a, -31, 31); - - b = b * (phy->nrssi[1] - phy->nrssi[0]); - b += (phy->nrssi[0] << 6); - if (b < 32) - b += 31; - else - b += 32; - b = b >> 6; - b = clamp_val(b, -31, 31); - - tmp_u16 = b43legacy_phy_read(dev, 0x048A) & 0xF000; - tmp_u16 |= ((u32)b & 0x0000003F); - tmp_u16 |= (((u32)a & 0x0000003F) << 6); - b43legacy_phy_write(dev, 0x048A, tmp_u16); - } - break; - default: - B43legacy_BUG_ON(1); - } -} - -/* Stack implementation to save/restore values from the - * interference mitigation code. - * It is save to restore values in random order. - */ -static void _stack_save(u32 *_stackptr, size_t *stackidx, - u8 id, u16 offset, u16 value) -{ - u32 *stackptr = &(_stackptr[*stackidx]); - - B43legacy_WARN_ON(!((offset & 0xE000) == 0x0000)); - B43legacy_WARN_ON(!((id & 0xF8) == 0x00)); - *stackptr = offset; - *stackptr |= ((u32)id) << 13; - *stackptr |= ((u32)value) << 16; - (*stackidx)++; - B43legacy_WARN_ON(!(*stackidx < B43legacy_INTERFSTACK_SIZE)); -} - -static u16 _stack_restore(u32 *stackptr, - u8 id, u16 offset) -{ - size_t i; - - B43legacy_WARN_ON(!((offset & 0xE000) == 0x0000)); - B43legacy_WARN_ON(!((id & 0xF8) == 0x00)); - for (i = 0; i < B43legacy_INTERFSTACK_SIZE; i++, stackptr++) { - if ((*stackptr & 0x00001FFF) != offset) - continue; - if (((*stackptr & 0x00007000) >> 13) != id) - continue; - return ((*stackptr & 0xFFFF0000) >> 16); - } - B43legacy_BUG_ON(1); - - return 0; -} - -#define phy_stacksave(offset) \ - do { \ - _stack_save(stack, &stackidx, 0x1, (offset), \ - b43legacy_phy_read(dev, (offset))); \ - } while (0) -#define phy_stackrestore(offset) \ - do { \ - b43legacy_phy_write(dev, (offset), \ - _stack_restore(stack, 0x1, \ - (offset))); \ - } while (0) -#define radio_stacksave(offset) \ - do { \ - _stack_save(stack, &stackidx, 0x2, (offset), \ - b43legacy_radio_read16(dev, (offset))); \ - } while (0) -#define radio_stackrestore(offset) \ - do { \ - b43legacy_radio_write16(dev, (offset), \ - _stack_restore(stack, 0x2, \ - (offset))); \ - } while (0) -#define ilt_stacksave(offset) \ - do { \ - _stack_save(stack, &stackidx, 0x3, (offset), \ - b43legacy_ilt_read(dev, (offset))); \ - } while (0) -#define ilt_stackrestore(offset) \ - do { \ - b43legacy_ilt_write(dev, (offset), \ - _stack_restore(stack, 0x3, \ - (offset))); \ - } while (0) - -static void -b43legacy_radio_interference_mitigation_enable(struct b43legacy_wldev *dev, - int mode) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 tmp; - u16 flipped; - u32 tmp32; - size_t stackidx = 0; - u32 *stack = phy->interfstack; - - switch (mode) { - case B43legacy_RADIO_INTERFMODE_NONWLAN: - if (phy->rev != 1) { - b43legacy_phy_write(dev, 0x042B, - b43legacy_phy_read(dev, 0x042B) - | 0x0800); - b43legacy_phy_write(dev, B43legacy_PHY_G_CRS, - b43legacy_phy_read(dev, - B43legacy_PHY_G_CRS) & ~0x4000); - break; - } - radio_stacksave(0x0078); - tmp = (b43legacy_radio_read16(dev, 0x0078) & 0x001E); - flipped = flip_4bit(tmp); - if (flipped < 10 && flipped >= 8) - flipped = 7; - else if (flipped >= 10) - flipped -= 3; - flipped = flip_4bit(flipped); - flipped = (flipped << 1) | 0x0020; - b43legacy_radio_write16(dev, 0x0078, flipped); - - b43legacy_calc_nrssi_threshold(dev); - - phy_stacksave(0x0406); - b43legacy_phy_write(dev, 0x0406, 0x7E28); - - b43legacy_phy_write(dev, 0x042B, - b43legacy_phy_read(dev, 0x042B) | 0x0800); - b43legacy_phy_write(dev, B43legacy_PHY_RADIO_BITFIELD, - b43legacy_phy_read(dev, - B43legacy_PHY_RADIO_BITFIELD) | 0x1000); - - phy_stacksave(0x04A0); - b43legacy_phy_write(dev, 0x04A0, - (b43legacy_phy_read(dev, 0x04A0) & 0xC0C0) - | 0x0008); - phy_stacksave(0x04A1); - b43legacy_phy_write(dev, 0x04A1, - (b43legacy_phy_read(dev, 0x04A1) & 0xC0C0) - | 0x0605); - phy_stacksave(0x04A2); - b43legacy_phy_write(dev, 0x04A2, - (b43legacy_phy_read(dev, 0x04A2) & 0xC0C0) - | 0x0204); - phy_stacksave(0x04A8); - b43legacy_phy_write(dev, 0x04A8, - (b43legacy_phy_read(dev, 0x04A8) & 0xC0C0) - | 0x0803); - phy_stacksave(0x04AB); - b43legacy_phy_write(dev, 0x04AB, - (b43legacy_phy_read(dev, 0x04AB) & 0xC0C0) - | 0x0605); - - phy_stacksave(0x04A7); - b43legacy_phy_write(dev, 0x04A7, 0x0002); - phy_stacksave(0x04A3); - b43legacy_phy_write(dev, 0x04A3, 0x287A); - phy_stacksave(0x04A9); - b43legacy_phy_write(dev, 0x04A9, 0x2027); - phy_stacksave(0x0493); - b43legacy_phy_write(dev, 0x0493, 0x32F5); - phy_stacksave(0x04AA); - b43legacy_phy_write(dev, 0x04AA, 0x2027); - phy_stacksave(0x04AC); - b43legacy_phy_write(dev, 0x04AC, 0x32F5); - break; - case B43legacy_RADIO_INTERFMODE_MANUALWLAN: - if (b43legacy_phy_read(dev, 0x0033) & 0x0800) - break; - - phy->aci_enable = true; - - phy_stacksave(B43legacy_PHY_RADIO_BITFIELD); - phy_stacksave(B43legacy_PHY_G_CRS); - if (phy->rev < 2) - phy_stacksave(0x0406); - else { - phy_stacksave(0x04C0); - phy_stacksave(0x04C1); - } - phy_stacksave(0x0033); - phy_stacksave(0x04A7); - phy_stacksave(0x04A3); - phy_stacksave(0x04A9); - phy_stacksave(0x04AA); - phy_stacksave(0x04AC); - phy_stacksave(0x0493); - phy_stacksave(0x04A1); - phy_stacksave(0x04A0); - phy_stacksave(0x04A2); - phy_stacksave(0x048A); - phy_stacksave(0x04A8); - phy_stacksave(0x04AB); - if (phy->rev == 2) { - phy_stacksave(0x04AD); - phy_stacksave(0x04AE); - } else if (phy->rev >= 3) { - phy_stacksave(0x04AD); - phy_stacksave(0x0415); - phy_stacksave(0x0416); - phy_stacksave(0x0417); - ilt_stacksave(0x1A00 + 0x2); - ilt_stacksave(0x1A00 + 0x3); - } - phy_stacksave(0x042B); - phy_stacksave(0x048C); - - b43legacy_phy_write(dev, B43legacy_PHY_RADIO_BITFIELD, - b43legacy_phy_read(dev, - B43legacy_PHY_RADIO_BITFIELD) & ~0x1000); - b43legacy_phy_write(dev, B43legacy_PHY_G_CRS, - (b43legacy_phy_read(dev, - B43legacy_PHY_G_CRS) - & 0xFFFC) | 0x0002); - - b43legacy_phy_write(dev, 0x0033, 0x0800); - b43legacy_phy_write(dev, 0x04A3, 0x2027); - b43legacy_phy_write(dev, 0x04A9, 0x1CA8); - b43legacy_phy_write(dev, 0x0493, 0x287A); - b43legacy_phy_write(dev, 0x04AA, 0x1CA8); - b43legacy_phy_write(dev, 0x04AC, 0x287A); - - b43legacy_phy_write(dev, 0x04A0, - (b43legacy_phy_read(dev, 0x04A0) - & 0xFFC0) | 0x001A); - b43legacy_phy_write(dev, 0x04A7, 0x000D); - - if (phy->rev < 2) - b43legacy_phy_write(dev, 0x0406, 0xFF0D); - else if (phy->rev == 2) { - b43legacy_phy_write(dev, 0x04C0, 0xFFFF); - b43legacy_phy_write(dev, 0x04C1, 0x00A9); - } else { - b43legacy_phy_write(dev, 0x04C0, 0x00C1); - b43legacy_phy_write(dev, 0x04C1, 0x0059); - } - - b43legacy_phy_write(dev, 0x04A1, - (b43legacy_phy_read(dev, 0x04A1) - & 0xC0FF) | 0x1800); - b43legacy_phy_write(dev, 0x04A1, - (b43legacy_phy_read(dev, 0x04A1) - & 0xFFC0) | 0x0015); - b43legacy_phy_write(dev, 0x04A8, - (b43legacy_phy_read(dev, 0x04A8) - & 0xCFFF) | 0x1000); - b43legacy_phy_write(dev, 0x04A8, - (b43legacy_phy_read(dev, 0x04A8) - & 0xF0FF) | 0x0A00); - b43legacy_phy_write(dev, 0x04AB, - (b43legacy_phy_read(dev, 0x04AB) - & 0xCFFF) | 0x1000); - b43legacy_phy_write(dev, 0x04AB, - (b43legacy_phy_read(dev, 0x04AB) - & 0xF0FF) | 0x0800); - b43legacy_phy_write(dev, 0x04AB, - (b43legacy_phy_read(dev, 0x04AB) - & 0xFFCF) | 0x0010); - b43legacy_phy_write(dev, 0x04AB, - (b43legacy_phy_read(dev, 0x04AB) - & 0xFFF0) | 0x0005); - b43legacy_phy_write(dev, 0x04A8, - (b43legacy_phy_read(dev, 0x04A8) - & 0xFFCF) | 0x0010); - b43legacy_phy_write(dev, 0x04A8, - (b43legacy_phy_read(dev, 0x04A8) - & 0xFFF0) | 0x0006); - b43legacy_phy_write(dev, 0x04A2, - (b43legacy_phy_read(dev, 0x04A2) - & 0xF0FF) | 0x0800); - b43legacy_phy_write(dev, 0x04A0, - (b43legacy_phy_read(dev, 0x04A0) - & 0xF0FF) | 0x0500); - b43legacy_phy_write(dev, 0x04A2, - (b43legacy_phy_read(dev, 0x04A2) - & 0xFFF0) | 0x000B); - - if (phy->rev >= 3) { - b43legacy_phy_write(dev, 0x048A, - b43legacy_phy_read(dev, 0x048A) - & ~0x8000); - b43legacy_phy_write(dev, 0x0415, - (b43legacy_phy_read(dev, 0x0415) - & 0x8000) | 0x36D8); - b43legacy_phy_write(dev, 0x0416, - (b43legacy_phy_read(dev, 0x0416) - & 0x8000) | 0x36D8); - b43legacy_phy_write(dev, 0x0417, - (b43legacy_phy_read(dev, 0x0417) - & 0xFE00) | 0x016D); - } else { - b43legacy_phy_write(dev, 0x048A, - b43legacy_phy_read(dev, 0x048A) - | 0x1000); - b43legacy_phy_write(dev, 0x048A, - (b43legacy_phy_read(dev, 0x048A) - & 0x9FFF) | 0x2000); - tmp32 = b43legacy_shm_read32(dev, B43legacy_SHM_SHARED, - B43legacy_UCODEFLAGS_OFFSET); - if (!(tmp32 & 0x800)) { - tmp32 |= 0x800; - b43legacy_shm_write32(dev, B43legacy_SHM_SHARED, - B43legacy_UCODEFLAGS_OFFSET, - tmp32); - } - } - if (phy->rev >= 2) - b43legacy_phy_write(dev, 0x042B, - b43legacy_phy_read(dev, 0x042B) - | 0x0800); - b43legacy_phy_write(dev, 0x048C, - (b43legacy_phy_read(dev, 0x048C) - & 0xF0FF) | 0x0200); - if (phy->rev == 2) { - b43legacy_phy_write(dev, 0x04AE, - (b43legacy_phy_read(dev, 0x04AE) - & 0xFF00) | 0x007F); - b43legacy_phy_write(dev, 0x04AD, - (b43legacy_phy_read(dev, 0x04AD) - & 0x00FF) | 0x1300); - } else if (phy->rev >= 6) { - b43legacy_ilt_write(dev, 0x1A00 + 0x3, 0x007F); - b43legacy_ilt_write(dev, 0x1A00 + 0x2, 0x007F); - b43legacy_phy_write(dev, 0x04AD, - b43legacy_phy_read(dev, 0x04AD) - & 0x00FF); - } - b43legacy_calc_nrssi_slope(dev); - break; - default: - B43legacy_BUG_ON(1); - } -} - -static void -b43legacy_radio_interference_mitigation_disable(struct b43legacy_wldev *dev, - int mode) -{ - struct b43legacy_phy *phy = &dev->phy; - u32 tmp32; - u32 *stack = phy->interfstack; - - switch (mode) { - case B43legacy_RADIO_INTERFMODE_NONWLAN: - if (phy->rev != 1) { - b43legacy_phy_write(dev, 0x042B, - b43legacy_phy_read(dev, 0x042B) - & ~0x0800); - b43legacy_phy_write(dev, B43legacy_PHY_G_CRS, - b43legacy_phy_read(dev, - B43legacy_PHY_G_CRS) | 0x4000); - break; - } - phy_stackrestore(0x0078); - b43legacy_calc_nrssi_threshold(dev); - phy_stackrestore(0x0406); - b43legacy_phy_write(dev, 0x042B, - b43legacy_phy_read(dev, 0x042B) & ~0x0800); - if (!dev->bad_frames_preempt) - b43legacy_phy_write(dev, B43legacy_PHY_RADIO_BITFIELD, - b43legacy_phy_read(dev, - B43legacy_PHY_RADIO_BITFIELD) - & ~(1 << 11)); - b43legacy_phy_write(dev, B43legacy_PHY_G_CRS, - b43legacy_phy_read(dev, B43legacy_PHY_G_CRS) - | 0x4000); - phy_stackrestore(0x04A0); - phy_stackrestore(0x04A1); - phy_stackrestore(0x04A2); - phy_stackrestore(0x04A8); - phy_stackrestore(0x04AB); - phy_stackrestore(0x04A7); - phy_stackrestore(0x04A3); - phy_stackrestore(0x04A9); - phy_stackrestore(0x0493); - phy_stackrestore(0x04AA); - phy_stackrestore(0x04AC); - break; - case B43legacy_RADIO_INTERFMODE_MANUALWLAN: - if (!(b43legacy_phy_read(dev, 0x0033) & 0x0800)) - break; - - phy->aci_enable = false; - - phy_stackrestore(B43legacy_PHY_RADIO_BITFIELD); - phy_stackrestore(B43legacy_PHY_G_CRS); - phy_stackrestore(0x0033); - phy_stackrestore(0x04A3); - phy_stackrestore(0x04A9); - phy_stackrestore(0x0493); - phy_stackrestore(0x04AA); - phy_stackrestore(0x04AC); - phy_stackrestore(0x04A0); - phy_stackrestore(0x04A7); - if (phy->rev >= 2) { - phy_stackrestore(0x04C0); - phy_stackrestore(0x04C1); - } else - phy_stackrestore(0x0406); - phy_stackrestore(0x04A1); - phy_stackrestore(0x04AB); - phy_stackrestore(0x04A8); - if (phy->rev == 2) { - phy_stackrestore(0x04AD); - phy_stackrestore(0x04AE); - } else if (phy->rev >= 3) { - phy_stackrestore(0x04AD); - phy_stackrestore(0x0415); - phy_stackrestore(0x0416); - phy_stackrestore(0x0417); - ilt_stackrestore(0x1A00 + 0x2); - ilt_stackrestore(0x1A00 + 0x3); - } - phy_stackrestore(0x04A2); - phy_stackrestore(0x04A8); - phy_stackrestore(0x042B); - phy_stackrestore(0x048C); - tmp32 = b43legacy_shm_read32(dev, B43legacy_SHM_SHARED, - B43legacy_UCODEFLAGS_OFFSET); - if (tmp32 & 0x800) { - tmp32 &= ~0x800; - b43legacy_shm_write32(dev, B43legacy_SHM_SHARED, - B43legacy_UCODEFLAGS_OFFSET, - tmp32); - } - b43legacy_calc_nrssi_slope(dev); - break; - default: - B43legacy_BUG_ON(1); - } -} - -#undef phy_stacksave -#undef phy_stackrestore -#undef radio_stacksave -#undef radio_stackrestore -#undef ilt_stacksave -#undef ilt_stackrestore - -int b43legacy_radio_set_interference_mitigation(struct b43legacy_wldev *dev, - int mode) -{ - struct b43legacy_phy *phy = &dev->phy; - int currentmode; - - if ((phy->type != B43legacy_PHYTYPE_G) || - (phy->rev == 0) || (!phy->gmode)) - return -ENODEV; - - phy->aci_wlan_automatic = false; - switch (mode) { - case B43legacy_RADIO_INTERFMODE_AUTOWLAN: - phy->aci_wlan_automatic = true; - if (phy->aci_enable) - mode = B43legacy_RADIO_INTERFMODE_MANUALWLAN; - else - mode = B43legacy_RADIO_INTERFMODE_NONE; - break; - case B43legacy_RADIO_INTERFMODE_NONE: - case B43legacy_RADIO_INTERFMODE_NONWLAN: - case B43legacy_RADIO_INTERFMODE_MANUALWLAN: - break; - default: - return -EINVAL; - } - - currentmode = phy->interfmode; - if (currentmode == mode) - return 0; - if (currentmode != B43legacy_RADIO_INTERFMODE_NONE) - b43legacy_radio_interference_mitigation_disable(dev, - currentmode); - - if (mode == B43legacy_RADIO_INTERFMODE_NONE) { - phy->aci_enable = false; - phy->aci_hw_rssi = false; - } else - b43legacy_radio_interference_mitigation_enable(dev, mode); - phy->interfmode = mode; - - return 0; -} - -u16 b43legacy_radio_calibrationvalue(struct b43legacy_wldev *dev) -{ - u16 reg; - u16 index; - u16 ret; - - reg = b43legacy_radio_read16(dev, 0x0060); - index = (reg & 0x001E) >> 1; - ret = rcc_table[index] << 1; - ret |= (reg & 0x0001); - ret |= 0x0020; - - return ret; -} - -#define LPD(L, P, D) (((L) << 2) | ((P) << 1) | ((D) << 0)) -static u16 b43legacy_get_812_value(struct b43legacy_wldev *dev, u8 lpd) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 loop_or = 0; - u16 adj_loopback_gain = phy->loopback_gain[0]; - u8 loop; - u16 extern_lna_control; - - if (!phy->gmode) - return 0; - if (!has_loopback_gain(phy)) { - if (phy->rev < 7 || !(dev->dev->bus->sprom.boardflags_lo - & B43legacy_BFL_EXTLNA)) { - switch (lpd) { - case LPD(0, 1, 1): - return 0x0FB2; - case LPD(0, 0, 1): - return 0x00B2; - case LPD(1, 0, 1): - return 0x30B2; - case LPD(1, 0, 0): - return 0x30B3; - default: - B43legacy_BUG_ON(1); - } - } else { - switch (lpd) { - case LPD(0, 1, 1): - return 0x8FB2; - case LPD(0, 0, 1): - return 0x80B2; - case LPD(1, 0, 1): - return 0x20B2; - case LPD(1, 0, 0): - return 0x20B3; - default: - B43legacy_BUG_ON(1); - } - } - } else { - if (phy->radio_rev == 8) - adj_loopback_gain += 0x003E; - else - adj_loopback_gain += 0x0026; - if (adj_loopback_gain >= 0x46) { - adj_loopback_gain -= 0x46; - extern_lna_control = 0x3000; - } else if (adj_loopback_gain >= 0x3A) { - adj_loopback_gain -= 0x3A; - extern_lna_control = 0x2000; - } else if (adj_loopback_gain >= 0x2E) { - adj_loopback_gain -= 0x2E; - extern_lna_control = 0x1000; - } else { - adj_loopback_gain -= 0x10; - extern_lna_control = 0x0000; - } - for (loop = 0; loop < 16; loop++) { - u16 tmp = adj_loopback_gain - 6 * loop; - if (tmp < 6) - break; - } - - loop_or = (loop << 8) | extern_lna_control; - if (phy->rev >= 7 && dev->dev->bus->sprom.boardflags_lo - & B43legacy_BFL_EXTLNA) { - if (extern_lna_control) - loop_or |= 0x8000; - switch (lpd) { - case LPD(0, 1, 1): - return 0x8F92; - case LPD(0, 0, 1): - return (0x8092 | loop_or); - case LPD(1, 0, 1): - return (0x2092 | loop_or); - case LPD(1, 0, 0): - return (0x2093 | loop_or); - default: - B43legacy_BUG_ON(1); - } - } else { - switch (lpd) { - case LPD(0, 1, 1): - return 0x0F92; - case LPD(0, 0, 1): - case LPD(1, 0, 1): - return (0x0092 | loop_or); - case LPD(1, 0, 0): - return (0x0093 | loop_or); - default: - B43legacy_BUG_ON(1); - } - } - } - return 0; -} - -u16 b43legacy_radio_init2050(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 backup[21] = { 0 }; - u16 ret; - u16 i; - u16 j; - u32 tmp1 = 0; - u32 tmp2 = 0; - - backup[0] = b43legacy_radio_read16(dev, 0x0043); - backup[14] = b43legacy_radio_read16(dev, 0x0051); - backup[15] = b43legacy_radio_read16(dev, 0x0052); - backup[1] = b43legacy_phy_read(dev, 0x0015); - backup[16] = b43legacy_phy_read(dev, 0x005A); - backup[17] = b43legacy_phy_read(dev, 0x0059); - backup[18] = b43legacy_phy_read(dev, 0x0058); - if (phy->type == B43legacy_PHYTYPE_B) { - backup[2] = b43legacy_phy_read(dev, 0x0030); - backup[3] = b43legacy_read16(dev, 0x03EC); - b43legacy_phy_write(dev, 0x0030, 0x00FF); - b43legacy_write16(dev, 0x03EC, 0x3F3F); - } else { - if (phy->gmode) { - backup[4] = b43legacy_phy_read(dev, 0x0811); - backup[5] = b43legacy_phy_read(dev, 0x0812); - backup[6] = b43legacy_phy_read(dev, 0x0814); - backup[7] = b43legacy_phy_read(dev, 0x0815); - backup[8] = b43legacy_phy_read(dev, - B43legacy_PHY_G_CRS); - backup[9] = b43legacy_phy_read(dev, 0x0802); - b43legacy_phy_write(dev, 0x0814, - (b43legacy_phy_read(dev, 0x0814) - | 0x0003)); - b43legacy_phy_write(dev, 0x0815, - (b43legacy_phy_read(dev, 0x0815) - & 0xFFFC)); - b43legacy_phy_write(dev, B43legacy_PHY_G_CRS, - (b43legacy_phy_read(dev, - B43legacy_PHY_G_CRS) & 0x7FFF)); - b43legacy_phy_write(dev, 0x0802, - (b43legacy_phy_read(dev, 0x0802) - & 0xFFFC)); - if (phy->rev > 1) { /* loopback gain enabled */ - backup[19] = b43legacy_phy_read(dev, 0x080F); - backup[20] = b43legacy_phy_read(dev, 0x0810); - if (phy->rev >= 3) - b43legacy_phy_write(dev, 0x080F, - 0xC020); - else - b43legacy_phy_write(dev, 0x080F, - 0x8020); - b43legacy_phy_write(dev, 0x0810, 0x0000); - } - b43legacy_phy_write(dev, 0x0812, - b43legacy_get_812_value(dev, - LPD(0, 1, 1))); - if (phy->rev < 7 || - !(dev->dev->bus->sprom.boardflags_lo - & B43legacy_BFL_EXTLNA)) - b43legacy_phy_write(dev, 0x0811, 0x01B3); - else - b43legacy_phy_write(dev, 0x0811, 0x09B3); - } - } - b43legacy_write16(dev, B43legacy_MMIO_PHY_RADIO, - (b43legacy_read16(dev, B43legacy_MMIO_PHY_RADIO) - | 0x8000)); - backup[10] = b43legacy_phy_read(dev, 0x0035); - b43legacy_phy_write(dev, 0x0035, - (b43legacy_phy_read(dev, 0x0035) & 0xFF7F)); - backup[11] = b43legacy_read16(dev, 0x03E6); - backup[12] = b43legacy_read16(dev, B43legacy_MMIO_CHANNEL_EXT); - - /* Initialization */ - if (phy->analog == 0) - b43legacy_write16(dev, 0x03E6, 0x0122); - else { - if (phy->analog >= 2) - b43legacy_phy_write(dev, 0x0003, - (b43legacy_phy_read(dev, 0x0003) - & 0xFFBF) | 0x0040); - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL_EXT, - (b43legacy_read16(dev, - B43legacy_MMIO_CHANNEL_EXT) | 0x2000)); - } - - ret = b43legacy_radio_calibrationvalue(dev); - - if (phy->type == B43legacy_PHYTYPE_B) - b43legacy_radio_write16(dev, 0x0078, 0x0026); - - if (phy->gmode) - b43legacy_phy_write(dev, 0x0812, - b43legacy_get_812_value(dev, - LPD(0, 1, 1))); - b43legacy_phy_write(dev, 0x0015, 0xBFAF); - b43legacy_phy_write(dev, 0x002B, 0x1403); - if (phy->gmode) - b43legacy_phy_write(dev, 0x0812, - b43legacy_get_812_value(dev, - LPD(0, 0, 1))); - b43legacy_phy_write(dev, 0x0015, 0xBFA0); - b43legacy_radio_write16(dev, 0x0051, - (b43legacy_radio_read16(dev, 0x0051) - | 0x0004)); - if (phy->radio_rev == 8) - b43legacy_radio_write16(dev, 0x0043, 0x001F); - else { - b43legacy_radio_write16(dev, 0x0052, 0x0000); - b43legacy_radio_write16(dev, 0x0043, - (b43legacy_radio_read16(dev, 0x0043) - & 0xFFF0) | 0x0009); - } - b43legacy_phy_write(dev, 0x0058, 0x0000); - - for (i = 0; i < 16; i++) { - b43legacy_phy_write(dev, 0x005A, 0x0480); - b43legacy_phy_write(dev, 0x0059, 0xC810); - b43legacy_phy_write(dev, 0x0058, 0x000D); - if (phy->gmode) - b43legacy_phy_write(dev, 0x0812, - b43legacy_get_812_value(dev, - LPD(1, 0, 1))); - b43legacy_phy_write(dev, 0x0015, 0xAFB0); - udelay(10); - if (phy->gmode) - b43legacy_phy_write(dev, 0x0812, - b43legacy_get_812_value(dev, - LPD(1, 0, 1))); - b43legacy_phy_write(dev, 0x0015, 0xEFB0); - udelay(10); - if (phy->gmode) - b43legacy_phy_write(dev, 0x0812, - b43legacy_get_812_value(dev, - LPD(1, 0, 0))); - b43legacy_phy_write(dev, 0x0015, 0xFFF0); - udelay(20); - tmp1 += b43legacy_phy_read(dev, 0x002D); - b43legacy_phy_write(dev, 0x0058, 0x0000); - if (phy->gmode) - b43legacy_phy_write(dev, 0x0812, - b43legacy_get_812_value(dev, - LPD(1, 0, 1))); - b43legacy_phy_write(dev, 0x0015, 0xAFB0); - } - - tmp1++; - tmp1 >>= 9; - udelay(10); - b43legacy_phy_write(dev, 0x0058, 0x0000); - - for (i = 0; i < 16; i++) { - b43legacy_radio_write16(dev, 0x0078, (flip_4bit(i) << 1) - | 0x0020); - backup[13] = b43legacy_radio_read16(dev, 0x0078); - udelay(10); - for (j = 0; j < 16; j++) { - b43legacy_phy_write(dev, 0x005A, 0x0D80); - b43legacy_phy_write(dev, 0x0059, 0xC810); - b43legacy_phy_write(dev, 0x0058, 0x000D); - if (phy->gmode) - b43legacy_phy_write(dev, 0x0812, - b43legacy_get_812_value(dev, - LPD(1, 0, 1))); - b43legacy_phy_write(dev, 0x0015, 0xAFB0); - udelay(10); - if (phy->gmode) - b43legacy_phy_write(dev, 0x0812, - b43legacy_get_812_value(dev, - LPD(1, 0, 1))); - b43legacy_phy_write(dev, 0x0015, 0xEFB0); - udelay(10); - if (phy->gmode) - b43legacy_phy_write(dev, 0x0812, - b43legacy_get_812_value(dev, - LPD(1, 0, 0))); - b43legacy_phy_write(dev, 0x0015, 0xFFF0); - udelay(10); - tmp2 += b43legacy_phy_read(dev, 0x002D); - b43legacy_phy_write(dev, 0x0058, 0x0000); - if (phy->gmode) - b43legacy_phy_write(dev, 0x0812, - b43legacy_get_812_value(dev, - LPD(1, 0, 1))); - b43legacy_phy_write(dev, 0x0015, 0xAFB0); - } - tmp2++; - tmp2 >>= 8; - if (tmp1 < tmp2) - break; - } - - /* Restore the registers */ - b43legacy_phy_write(dev, 0x0015, backup[1]); - b43legacy_radio_write16(dev, 0x0051, backup[14]); - b43legacy_radio_write16(dev, 0x0052, backup[15]); - b43legacy_radio_write16(dev, 0x0043, backup[0]); - b43legacy_phy_write(dev, 0x005A, backup[16]); - b43legacy_phy_write(dev, 0x0059, backup[17]); - b43legacy_phy_write(dev, 0x0058, backup[18]); - b43legacy_write16(dev, 0x03E6, backup[11]); - if (phy->analog != 0) - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL_EXT, backup[12]); - b43legacy_phy_write(dev, 0x0035, backup[10]); - b43legacy_radio_selectchannel(dev, phy->channel, 1); - if (phy->type == B43legacy_PHYTYPE_B) { - b43legacy_phy_write(dev, 0x0030, backup[2]); - b43legacy_write16(dev, 0x03EC, backup[3]); - } else { - if (phy->gmode) { - b43legacy_write16(dev, B43legacy_MMIO_PHY_RADIO, - (b43legacy_read16(dev, - B43legacy_MMIO_PHY_RADIO) & 0x7FFF)); - b43legacy_phy_write(dev, 0x0811, backup[4]); - b43legacy_phy_write(dev, 0x0812, backup[5]); - b43legacy_phy_write(dev, 0x0814, backup[6]); - b43legacy_phy_write(dev, 0x0815, backup[7]); - b43legacy_phy_write(dev, B43legacy_PHY_G_CRS, - backup[8]); - b43legacy_phy_write(dev, 0x0802, backup[9]); - if (phy->rev > 1) { - b43legacy_phy_write(dev, 0x080F, backup[19]); - b43legacy_phy_write(dev, 0x0810, backup[20]); - } - } - } - if (i >= 15) - ret = backup[13]; - - return ret; -} - -static inline -u16 freq_r3A_value(u16 frequency) -{ - u16 value; - - if (frequency < 5091) - value = 0x0040; - else if (frequency < 5321) - value = 0x0000; - else if (frequency < 5806) - value = 0x0080; - else - value = 0x0040; - - return value; -} - -void b43legacy_radio_set_tx_iq(struct b43legacy_wldev *dev) -{ - static const u8 data_high[5] = { 0x00, 0x40, 0x80, 0x90, 0xD0 }; - static const u8 data_low[5] = { 0x00, 0x01, 0x05, 0x06, 0x0A }; - u16 tmp = b43legacy_radio_read16(dev, 0x001E); - int i; - int j; - - for (i = 0; i < 5; i++) { - for (j = 0; j < 5; j++) { - if (tmp == (data_high[i] | data_low[j])) { - b43legacy_phy_write(dev, 0x0069, (i - j) << 8 | - 0x00C0); - return; - } - } - } -} - -int b43legacy_radio_selectchannel(struct b43legacy_wldev *dev, - u8 channel, - int synthetic_pu_workaround) -{ - struct b43legacy_phy *phy = &dev->phy; - - if (channel == 0xFF) { - switch (phy->type) { - case B43legacy_PHYTYPE_B: - case B43legacy_PHYTYPE_G: - channel = B43legacy_RADIO_DEFAULT_CHANNEL_BG; - break; - default: - B43legacy_WARN_ON(1); - } - } - -/* TODO: Check if channel is valid - return -EINVAL if not */ - if (synthetic_pu_workaround) - b43legacy_synth_pu_workaround(dev, channel); - - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL, - channel2freq_bg(channel)); - - if (channel == 14) { - if (dev->dev->bus->sprom.country_code == 5) /* JAPAN) */ - b43legacy_shm_write32(dev, B43legacy_SHM_SHARED, - B43legacy_UCODEFLAGS_OFFSET, - b43legacy_shm_read32(dev, - B43legacy_SHM_SHARED, - B43legacy_UCODEFLAGS_OFFSET) - & ~(1 << 7)); - else - b43legacy_shm_write32(dev, B43legacy_SHM_SHARED, - B43legacy_UCODEFLAGS_OFFSET, - b43legacy_shm_read32(dev, - B43legacy_SHM_SHARED, - B43legacy_UCODEFLAGS_OFFSET) - | (1 << 7)); - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL_EXT, - b43legacy_read16(dev, - B43legacy_MMIO_CHANNEL_EXT) | (1 << 11)); - } else - b43legacy_write16(dev, B43legacy_MMIO_CHANNEL_EXT, - b43legacy_read16(dev, - B43legacy_MMIO_CHANNEL_EXT) & 0xF7BF); - - phy->channel = channel; - /*XXX: Using the longer of 2 timeouts (8000 vs 2000 usecs). Specs states - * that 2000 usecs might suffice. */ - msleep(8); - - return 0; -} - -void b43legacy_radio_set_txantenna(struct b43legacy_wldev *dev, u32 val) -{ - u16 tmp; - - val <<= 8; - tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, 0x0022) & 0xFCFF; - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x0022, tmp | val); - tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, 0x03A8) & 0xFCFF; - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x03A8, tmp | val); - tmp = b43legacy_shm_read16(dev, B43legacy_SHM_SHARED, 0x0054) & 0xFCFF; - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x0054, tmp | val); -} - -/* http://bcm-specs.sipsolutions.net/TX_Gain_Base_Band */ -static u16 b43legacy_get_txgain_base_band(u16 txpower) -{ - u16 ret; - - B43legacy_WARN_ON(txpower > 63); - - if (txpower >= 54) - ret = 2; - else if (txpower >= 49) - ret = 4; - else if (txpower >= 44) - ret = 5; - else - ret = 6; - - return ret; -} - -/* http://bcm-specs.sipsolutions.net/TX_Gain_Radio_Frequency_Power_Amplifier */ -static u16 b43legacy_get_txgain_freq_power_amp(u16 txpower) -{ - u16 ret; - - B43legacy_WARN_ON(txpower > 63); - - if (txpower >= 32) - ret = 0; - else if (txpower >= 25) - ret = 1; - else if (txpower >= 20) - ret = 2; - else if (txpower >= 12) - ret = 3; - else - ret = 4; - - return ret; -} - -/* http://bcm-specs.sipsolutions.net/TX_Gain_Digital_Analog_Converter */ -static u16 b43legacy_get_txgain_dac(u16 txpower) -{ - u16 ret; - - B43legacy_WARN_ON(txpower > 63); - - if (txpower >= 54) - ret = txpower - 53; - else if (txpower >= 49) - ret = txpower - 42; - else if (txpower >= 44) - ret = txpower - 37; - else if (txpower >= 32) - ret = txpower - 32; - else if (txpower >= 25) - ret = txpower - 20; - else if (txpower >= 20) - ret = txpower - 13; - else if (txpower >= 12) - ret = txpower - 8; - else - ret = txpower; - - return ret; -} - -void b43legacy_radio_set_txpower_a(struct b43legacy_wldev *dev, u16 txpower) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 pamp; - u16 base; - u16 dac; - u16 ilt; - - txpower = clamp_val(txpower, 0, 63); - - pamp = b43legacy_get_txgain_freq_power_amp(txpower); - pamp <<= 5; - pamp &= 0x00E0; - b43legacy_phy_write(dev, 0x0019, pamp); - - base = b43legacy_get_txgain_base_band(txpower); - base &= 0x000F; - b43legacy_phy_write(dev, 0x0017, base | 0x0020); - - ilt = b43legacy_ilt_read(dev, 0x3001); - ilt &= 0x0007; - - dac = b43legacy_get_txgain_dac(txpower); - dac <<= 3; - dac |= ilt; - - b43legacy_ilt_write(dev, 0x3001, dac); - - phy->txpwr_offset = txpower; - - /* TODO: FuncPlaceholder (Adjust BB loft cancel) */ -} - -void b43legacy_radio_set_txpower_bg(struct b43legacy_wldev *dev, - u16 baseband_attenuation, - u16 radio_attenuation, - u16 txpower) -{ - struct b43legacy_phy *phy = &dev->phy; - - if (baseband_attenuation == 0xFFFF) - baseband_attenuation = phy->bbatt; - if (radio_attenuation == 0xFFFF) - radio_attenuation = phy->rfatt; - if (txpower == 0xFFFF) - txpower = phy->txctl1; - phy->bbatt = baseband_attenuation; - phy->rfatt = radio_attenuation; - phy->txctl1 = txpower; - - B43legacy_WARN_ON(baseband_attenuation > 11); - if (phy->radio_rev < 6) - B43legacy_WARN_ON(radio_attenuation > 9); - else - B43legacy_WARN_ON(radio_attenuation > 31); - B43legacy_WARN_ON(txpower > 7); - - b43legacy_phy_set_baseband_attenuation(dev, baseband_attenuation); - b43legacy_radio_write16(dev, 0x0043, radio_attenuation); - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x0064, - radio_attenuation); - if (phy->radio_ver == 0x2050) - b43legacy_radio_write16(dev, 0x0052, - (b43legacy_radio_read16(dev, 0x0052) - & ~0x0070) | ((txpower << 4) & 0x0070)); - /* FIXME: The spec is very weird and unclear here. */ - if (phy->type == B43legacy_PHYTYPE_G) - b43legacy_phy_lo_adjust(dev, 0); -} - -u16 b43legacy_default_baseband_attenuation(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - - if (phy->radio_ver == 0x2050 && phy->radio_rev < 6) - return 0; - return 2; -} - -u16 b43legacy_default_radio_attenuation(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - u16 att = 0xFFFF; - - switch (phy->radio_ver) { - case 0x2053: - switch (phy->radio_rev) { - case 1: - att = 6; - break; - } - break; - case 0x2050: - switch (phy->radio_rev) { - case 0: - att = 5; - break; - case 1: - if (phy->type == B43legacy_PHYTYPE_G) { - if (is_bcm_board_vendor(dev) && - dev->dev->bus->boardinfo.type == 0x421 && - dev->dev->bus->sprom.board_rev >= 30) - att = 3; - else if (is_bcm_board_vendor(dev) && - dev->dev->bus->boardinfo.type == 0x416) - att = 3; - else - att = 1; - } else { - if (is_bcm_board_vendor(dev) && - dev->dev->bus->boardinfo.type == 0x421 && - dev->dev->bus->sprom.board_rev >= 30) - att = 7; - else - att = 6; - } - break; - case 2: - if (phy->type == B43legacy_PHYTYPE_G) { - if (is_bcm_board_vendor(dev) && - dev->dev->bus->boardinfo.type == 0x421 && - dev->dev->bus->sprom.board_rev >= 30) - att = 3; - else if (is_bcm_board_vendor(dev) && - dev->dev->bus->boardinfo.type == - 0x416) - att = 5; - else if (dev->dev->bus->chip_id == 0x4320) - att = 4; - else - att = 3; - } else - att = 6; - break; - case 3: - att = 5; - break; - case 4: - case 5: - att = 1; - break; - case 6: - case 7: - att = 5; - break; - case 8: - att = 0x1A; - break; - case 9: - default: - att = 5; - } - } - if (is_bcm_board_vendor(dev) && - dev->dev->bus->boardinfo.type == 0x421) { - if (dev->dev->bus->sprom.board_rev < 0x43) - att = 2; - else if (dev->dev->bus->sprom.board_rev < 0x51) - att = 3; - } - if (att == 0xFFFF) - att = 5; - - return att; -} - -u16 b43legacy_default_txctl1(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - - if (phy->radio_ver != 0x2050) - return 0; - if (phy->radio_rev == 1) - return 3; - if (phy->radio_rev < 6) - return 2; - if (phy->radio_rev == 8) - return 1; - return 0; -} - -void b43legacy_radio_turn_on(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - int err; - u8 channel; - - might_sleep(); - - if (phy->radio_on) - return; - - switch (phy->type) { - case B43legacy_PHYTYPE_B: - case B43legacy_PHYTYPE_G: - b43legacy_phy_write(dev, 0x0015, 0x8000); - b43legacy_phy_write(dev, 0x0015, 0xCC00); - b43legacy_phy_write(dev, 0x0015, - (phy->gmode ? 0x00C0 : 0x0000)); - if (phy->radio_off_context.valid) { - /* Restore the RFover values. */ - b43legacy_phy_write(dev, B43legacy_PHY_RFOVER, - phy->radio_off_context.rfover); - b43legacy_phy_write(dev, B43legacy_PHY_RFOVERVAL, - phy->radio_off_context.rfoverval); - phy->radio_off_context.valid = false; - } - channel = phy->channel; - err = b43legacy_radio_selectchannel(dev, - B43legacy_RADIO_DEFAULT_CHANNEL_BG, 1); - err |= b43legacy_radio_selectchannel(dev, channel, 0); - B43legacy_WARN_ON(err); - break; - default: - B43legacy_BUG_ON(1); - } - phy->radio_on = true; -} - -void b43legacy_radio_turn_off(struct b43legacy_wldev *dev, bool force) -{ - struct b43legacy_phy *phy = &dev->phy; - - if (!phy->radio_on && !force) - return; - - if (phy->type == B43legacy_PHYTYPE_G && dev->dev->id.revision >= 5) { - u16 rfover, rfoverval; - - rfover = b43legacy_phy_read(dev, B43legacy_PHY_RFOVER); - rfoverval = b43legacy_phy_read(dev, B43legacy_PHY_RFOVERVAL); - if (!force) { - phy->radio_off_context.rfover = rfover; - phy->radio_off_context.rfoverval = rfoverval; - phy->radio_off_context.valid = true; - } - b43legacy_phy_write(dev, B43legacy_PHY_RFOVER, rfover | 0x008C); - b43legacy_phy_write(dev, B43legacy_PHY_RFOVERVAL, - rfoverval & 0xFF73); - } else - b43legacy_phy_write(dev, 0x0015, 0xAA00); - phy->radio_on = false; - b43legacydbg(dev->wl, "Radio initialized\n"); -} - -void b43legacy_radio_clear_tssi(struct b43legacy_wldev *dev) -{ - struct b43legacy_phy *phy = &dev->phy; - - switch (phy->type) { - case B43legacy_PHYTYPE_B: - case B43legacy_PHYTYPE_G: - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x0058, - 0x7F7F); - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x005a, - 0x7F7F); - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x0070, - 0x7F7F); - b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x0072, - 0x7F7F); - break; - } -} diff --git a/drivers/net/wireless/b43legacy/radio.h b/drivers/net/wireless/b43legacy/radio.h deleted file mode 100644 index bccb3d7da682..000000000000 --- a/drivers/net/wireless/b43legacy/radio.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - - Broadcom B43legacy wireless driver - - Copyright (c) 2005 Martin Langer , - Stefano Brivio - Michael Buesch - Danny van Dyk - Andreas Jaggi - - Some parts of the code in this file are derived from the ipw2200 - driver Copyright(c) 2003 - 2004 Intel Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#ifndef B43legacy_RADIO_H_ -#define B43legacy_RADIO_H_ - -#include "b43legacy.h" - - -#define B43legacy_RADIO_DEFAULT_CHANNEL_BG 6 - -/* Force antenna 0. */ -#define B43legacy_RADIO_TXANTENNA_0 0 -/* Force antenna 1. */ -#define B43legacy_RADIO_TXANTENNA_1 1 -/* Use the RX antenna, that was selected for the most recently - * received good PLCP header. - */ -#define B43legacy_RADIO_TXANTENNA_LASTPLCP 3 -#define B43legacy_RADIO_TXANTENNA_DEFAULT B43legacy_RADIO_TXANTENNA_LASTPLCP - -#define B43legacy_RADIO_INTERFMODE_NONE 0 -#define B43legacy_RADIO_INTERFMODE_NONWLAN 1 -#define B43legacy_RADIO_INTERFMODE_MANUALWLAN 2 -#define B43legacy_RADIO_INTERFMODE_AUTOWLAN 3 - - -void b43legacy_radio_lock(struct b43legacy_wldev *dev); -void b43legacy_radio_unlock(struct b43legacy_wldev *dev); - -u16 b43legacy_radio_read16(struct b43legacy_wldev *dev, u16 offset); -void b43legacy_radio_write16(struct b43legacy_wldev *dev, u16 offset, u16 val); - -u16 b43legacy_radio_init2050(struct b43legacy_wldev *dev); - -void b43legacy_radio_turn_on(struct b43legacy_wldev *dev); -void b43legacy_radio_turn_off(struct b43legacy_wldev *dev, bool force); - -int b43legacy_radio_selectchannel(struct b43legacy_wldev *dev, u8 channel, - int synthetic_pu_workaround); - -void b43legacy_radio_set_txpower_a(struct b43legacy_wldev *dev, u16 txpower); -void b43legacy_radio_set_txpower_bg(struct b43legacy_wldev *dev, - u16 baseband_attenuation, u16 attenuation, - u16 txpower); - -u16 b43legacy_default_baseband_attenuation(struct b43legacy_wldev *dev); -u16 b43legacy_default_radio_attenuation(struct b43legacy_wldev *dev); -u16 b43legacy_default_txctl1(struct b43legacy_wldev *dev); - -void b43legacy_radio_set_txantenna(struct b43legacy_wldev *dev, u32 val); - -void b43legacy_radio_clear_tssi(struct b43legacy_wldev *dev); - -u8 b43legacy_radio_aci_detect(struct b43legacy_wldev *dev, u8 channel); -u8 b43legacy_radio_aci_scan(struct b43legacy_wldev *dev); - -int b43legacy_radio_set_interference_mitigation(struct b43legacy_wldev *dev, - int mode); - -void b43legacy_calc_nrssi_slope(struct b43legacy_wldev *dev); -void b43legacy_calc_nrssi_threshold(struct b43legacy_wldev *dev); -s16 b43legacy_nrssi_hw_read(struct b43legacy_wldev *dev, u16 offset); -void b43legacy_nrssi_hw_write(struct b43legacy_wldev *dev, u16 offset, s16 val); -void b43legacy_nrssi_hw_update(struct b43legacy_wldev *dev, u16 val); -void b43legacy_nrssi_mem_update(struct b43legacy_wldev *dev); - -void b43legacy_radio_set_tx_iq(struct b43legacy_wldev *dev); -u16 b43legacy_radio_calibrationvalue(struct b43legacy_wldev *dev); - -#endif /* B43legacy_RADIO_H_ */ diff --git a/drivers/net/wireless/b43legacy/rfkill.c b/drivers/net/wireless/b43legacy/rfkill.c deleted file mode 100644 index c4559bcbc707..000000000000 --- a/drivers/net/wireless/b43legacy/rfkill.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - - Broadcom B43 wireless driver - RFKILL support - - Copyright (c) 2007 Michael Buesch - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "radio.h" -#include "b43legacy.h" - - -/* Returns TRUE, if the radio is enabled in hardware. */ -bool b43legacy_is_hw_radio_enabled(struct b43legacy_wldev *dev) -{ - if (dev->dev->id.revision >= 3) { - if (!(b43legacy_read32(dev, B43legacy_MMIO_RADIO_HWENABLED_HI) - & B43legacy_MMIO_RADIO_HWENABLED_HI_MASK)) - return 1; - } else { - /* To prevent CPU fault on PPC, do not read a register - * unless the interface is started; however, on resume - * for hibernation, this routine is entered early. When - * that happens, unconditionally return TRUE. - */ - if (b43legacy_status(dev) < B43legacy_STAT_STARTED) - return 1; - if (b43legacy_read16(dev, B43legacy_MMIO_RADIO_HWENABLED_LO) - & B43legacy_MMIO_RADIO_HWENABLED_LO_MASK) - return 1; - } - return 0; -} - -/* The poll callback for the hardware button. */ -void b43legacy_rfkill_poll(struct ieee80211_hw *hw) -{ - struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); - struct b43legacy_wldev *dev = wl->current_dev; - struct ssb_bus *bus = dev->dev->bus; - bool enabled; - bool brought_up = false; - - mutex_lock(&wl->mutex); - if (unlikely(b43legacy_status(dev) < B43legacy_STAT_INITIALIZED)) { - if (ssb_bus_powerup(bus, 0)) { - mutex_unlock(&wl->mutex); - return; - } - ssb_device_enable(dev->dev, 0); - brought_up = true; - } - - enabled = b43legacy_is_hw_radio_enabled(dev); - - if (unlikely(enabled != dev->radio_hw_enable)) { - dev->radio_hw_enable = enabled; - b43legacyinfo(wl, "Radio hardware status changed to %s\n", - enabled ? "ENABLED" : "DISABLED"); - wiphy_rfkill_set_hw_state(hw->wiphy, !enabled); - if (enabled != dev->phy.radio_on) { - if (enabled) - b43legacy_radio_turn_on(dev); - else - b43legacy_radio_turn_off(dev, 0); - } - } - - if (brought_up) { - ssb_device_disable(dev->dev, 0); - ssb_bus_may_powerdown(bus); - } - - mutex_unlock(&wl->mutex); -} diff --git a/drivers/net/wireless/b43legacy/rfkill.h b/drivers/net/wireless/b43legacy/rfkill.h deleted file mode 100644 index 75585571c544..000000000000 --- a/drivers/net/wireless/b43legacy/rfkill.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef B43legacy_RFKILL_H_ -#define B43legacy_RFKILL_H_ - -struct ieee80211_hw; -struct b43legacy_wldev; - -void b43legacy_rfkill_poll(struct ieee80211_hw *hw); - -bool b43legacy_is_hw_radio_enabled(struct b43legacy_wldev *dev); - -#endif /* B43legacy_RFKILL_H_ */ diff --git a/drivers/net/wireless/b43legacy/sysfs.c b/drivers/net/wireless/b43legacy/sysfs.c deleted file mode 100644 index 57f8b089767c..000000000000 --- a/drivers/net/wireless/b43legacy/sysfs.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - - Broadcom B43legacy wireless driver - - SYSFS support routines - - Copyright (c) 2006 Michael Buesch - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include "sysfs.h" -#include "b43legacy.h" -#include "main.h" -#include "phy.h" -#include "radio.h" - -#include - - -#define GENERIC_FILESIZE 64 - - -static int get_integer(const char *buf, size_t count) -{ - char tmp[10 + 1] = { 0 }; - int ret = -EINVAL; - - if (count == 0) - goto out; - count = min(count, (size_t)10); - memcpy(tmp, buf, count); - ret = simple_strtol(tmp, NULL, 10); -out: - return ret; -} - -static int get_boolean(const char *buf, size_t count) -{ - if (count != 0) { - if (buf[0] == '1') - return 1; - if (buf[0] == '0') - return 0; - if (count >= 4 && memcmp(buf, "true", 4) == 0) - return 1; - if (count >= 5 && memcmp(buf, "false", 5) == 0) - return 0; - if (count >= 3 && memcmp(buf, "yes", 3) == 0) - return 1; - if (count >= 2 && memcmp(buf, "no", 2) == 0) - return 0; - if (count >= 2 && memcmp(buf, "on", 2) == 0) - return 1; - if (count >= 3 && memcmp(buf, "off", 3) == 0) - return 0; - } - return -EINVAL; -} - -static ssize_t b43legacy_attr_interfmode_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct b43legacy_wldev *wldev = dev_to_b43legacy_wldev(dev); - ssize_t count = 0; - - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - mutex_lock(&wldev->wl->mutex); - - switch (wldev->phy.interfmode) { - case B43legacy_INTERFMODE_NONE: - count = snprintf(buf, PAGE_SIZE, "0 (No Interference" - " Mitigation)\n"); - break; - case B43legacy_INTERFMODE_NONWLAN: - count = snprintf(buf, PAGE_SIZE, "1 (Non-WLAN Interference" - " Mitigation)\n"); - break; - case B43legacy_INTERFMODE_MANUALWLAN: - count = snprintf(buf, PAGE_SIZE, "2 (WLAN Interference" - " Mitigation)\n"); - break; - default: - B43legacy_WARN_ON(1); - } - - mutex_unlock(&wldev->wl->mutex); - - return count; -} - -static ssize_t b43legacy_attr_interfmode_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct b43legacy_wldev *wldev = dev_to_b43legacy_wldev(dev); - unsigned long flags; - int err; - int mode; - - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - mode = get_integer(buf, count); - switch (mode) { - case 0: - mode = B43legacy_INTERFMODE_NONE; - break; - case 1: - mode = B43legacy_INTERFMODE_NONWLAN; - break; - case 2: - mode = B43legacy_INTERFMODE_MANUALWLAN; - break; - case 3: - mode = B43legacy_INTERFMODE_AUTOWLAN; - break; - default: - return -EINVAL; - } - - mutex_lock(&wldev->wl->mutex); - spin_lock_irqsave(&wldev->wl->irq_lock, flags); - - err = b43legacy_radio_set_interference_mitigation(wldev, mode); - if (err) - b43legacyerr(wldev->wl, "Interference Mitigation not " - "supported by device\n"); - mmiowb(); - spin_unlock_irqrestore(&wldev->wl->irq_lock, flags); - mutex_unlock(&wldev->wl->mutex); - - return err ? err : count; -} - -static DEVICE_ATTR(interference, 0644, - b43legacy_attr_interfmode_show, - b43legacy_attr_interfmode_store); - -static ssize_t b43legacy_attr_preamble_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct b43legacy_wldev *wldev = dev_to_b43legacy_wldev(dev); - ssize_t count; - - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - mutex_lock(&wldev->wl->mutex); - - if (wldev->short_preamble) - count = snprintf(buf, PAGE_SIZE, "1 (Short Preamble" - " enabled)\n"); - else - count = snprintf(buf, PAGE_SIZE, "0 (Short Preamble" - " disabled)\n"); - - mutex_unlock(&wldev->wl->mutex); - - return count; -} - -static ssize_t b43legacy_attr_preamble_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct b43legacy_wldev *wldev = dev_to_b43legacy_wldev(dev); - unsigned long flags; - int value; - - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - value = get_boolean(buf, count); - if (value < 0) - return value; - mutex_lock(&wldev->wl->mutex); - spin_lock_irqsave(&wldev->wl->irq_lock, flags); - - wldev->short_preamble = !!value; - - spin_unlock_irqrestore(&wldev->wl->irq_lock, flags); - mutex_unlock(&wldev->wl->mutex); - - return count; -} - -static DEVICE_ATTR(shortpreamble, 0644, - b43legacy_attr_preamble_show, - b43legacy_attr_preamble_store); - -int b43legacy_sysfs_register(struct b43legacy_wldev *wldev) -{ - struct device *dev = wldev->dev->dev; - int err; - - B43legacy_WARN_ON(b43legacy_status(wldev) != - B43legacy_STAT_INITIALIZED); - - err = device_create_file(dev, &dev_attr_interference); - if (err) - goto out; - err = device_create_file(dev, &dev_attr_shortpreamble); - if (err) - goto err_remove_interfmode; - -out: - return err; -err_remove_interfmode: - device_remove_file(dev, &dev_attr_interference); - goto out; -} - -void b43legacy_sysfs_unregister(struct b43legacy_wldev *wldev) -{ - struct device *dev = wldev->dev->dev; - - device_remove_file(dev, &dev_attr_shortpreamble); - device_remove_file(dev, &dev_attr_interference); -} diff --git a/drivers/net/wireless/b43legacy/sysfs.h b/drivers/net/wireless/b43legacy/sysfs.h deleted file mode 100644 index 417d509803c7..000000000000 --- a/drivers/net/wireless/b43legacy/sysfs.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef B43legacy_SYSFS_H_ -#define B43legacy_SYSFS_H_ - -struct b43legacy_wldev; - -int b43legacy_sysfs_register(struct b43legacy_wldev *dev); -void b43legacy_sysfs_unregister(struct b43legacy_wldev *dev); - -#endif /* B43legacy_SYSFS_H_ */ diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c deleted file mode 100644 index 849a28c80302..000000000000 --- a/drivers/net/wireless/b43legacy/xmit.c +++ /dev/null @@ -1,664 +0,0 @@ -/* - - Broadcom B43legacy wireless driver - - Transmission (TX/RX) related functions. - - Copyright (C) 2005 Martin Langer - Copyright (C) 2005 Stefano Brivio - Copyright (C) 2005, 2006 Michael Buesch - Copyright (C) 2005 Danny van Dyk - Copyright (C) 2005 Andreas Jaggi - Copyright (C) 2007 Larry Finger - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include - -#include "xmit.h" -#include "phy.h" -#include "dma.h" -#include "pio.h" - - -/* Extract the bitrate out of a CCK PLCP header. */ -static u8 b43legacy_plcp_get_bitrate_idx_cck(struct b43legacy_plcp_hdr6 *plcp) -{ - switch (plcp->raw[0]) { - case 0x0A: - return 0; - case 0x14: - return 1; - case 0x37: - return 2; - case 0x6E: - return 3; - } - B43legacy_BUG_ON(1); - return -1; -} - -/* Extract the bitrate out of an OFDM PLCP header. */ -static u8 b43legacy_plcp_get_bitrate_idx_ofdm(struct b43legacy_plcp_hdr6 *plcp, - bool aphy) -{ - int base = aphy ? 0 : 4; - - switch (plcp->raw[0] & 0xF) { - case 0xB: - return base + 0; - case 0xF: - return base + 1; - case 0xA: - return base + 2; - case 0xE: - return base + 3; - case 0x9: - return base + 4; - case 0xD: - return base + 5; - case 0x8: - return base + 6; - case 0xC: - return base + 7; - } - B43legacy_BUG_ON(1); - return -1; -} - -u8 b43legacy_plcp_get_ratecode_cck(const u8 bitrate) -{ - switch (bitrate) { - case B43legacy_CCK_RATE_1MB: - return 0x0A; - case B43legacy_CCK_RATE_2MB: - return 0x14; - case B43legacy_CCK_RATE_5MB: - return 0x37; - case B43legacy_CCK_RATE_11MB: - return 0x6E; - } - B43legacy_BUG_ON(1); - return 0; -} - -u8 b43legacy_plcp_get_ratecode_ofdm(const u8 bitrate) -{ - switch (bitrate) { - case B43legacy_OFDM_RATE_6MB: - return 0xB; - case B43legacy_OFDM_RATE_9MB: - return 0xF; - case B43legacy_OFDM_RATE_12MB: - return 0xA; - case B43legacy_OFDM_RATE_18MB: - return 0xE; - case B43legacy_OFDM_RATE_24MB: - return 0x9; - case B43legacy_OFDM_RATE_36MB: - return 0xD; - case B43legacy_OFDM_RATE_48MB: - return 0x8; - case B43legacy_OFDM_RATE_54MB: - return 0xC; - } - B43legacy_BUG_ON(1); - return 0; -} - -void b43legacy_generate_plcp_hdr(struct b43legacy_plcp_hdr4 *plcp, - const u16 octets, const u8 bitrate) -{ - __le32 *data = &(plcp->data); - __u8 *raw = plcp->raw; - - if (b43legacy_is_ofdm_rate(bitrate)) { - u16 d; - - d = b43legacy_plcp_get_ratecode_ofdm(bitrate); - B43legacy_WARN_ON(octets & 0xF000); - d |= (octets << 5); - *data = cpu_to_le32(d); - } else { - u32 plen; - - plen = octets * 16 / bitrate; - if ((octets * 16 % bitrate) > 0) { - plen++; - if ((bitrate == B43legacy_CCK_RATE_11MB) - && ((octets * 8 % 11) < 4)) - raw[1] = 0x84; - else - raw[1] = 0x04; - } else - raw[1] = 0x04; - *data |= cpu_to_le32(plen << 16); - raw[0] = b43legacy_plcp_get_ratecode_cck(bitrate); - } -} - -static u8 b43legacy_calc_fallback_rate(u8 bitrate) -{ - switch (bitrate) { - case B43legacy_CCK_RATE_1MB: - return B43legacy_CCK_RATE_1MB; - case B43legacy_CCK_RATE_2MB: - return B43legacy_CCK_RATE_1MB; - case B43legacy_CCK_RATE_5MB: - return B43legacy_CCK_RATE_2MB; - case B43legacy_CCK_RATE_11MB: - return B43legacy_CCK_RATE_5MB; - case B43legacy_OFDM_RATE_6MB: - return B43legacy_CCK_RATE_5MB; - case B43legacy_OFDM_RATE_9MB: - return B43legacy_OFDM_RATE_6MB; - case B43legacy_OFDM_RATE_12MB: - return B43legacy_OFDM_RATE_9MB; - case B43legacy_OFDM_RATE_18MB: - return B43legacy_OFDM_RATE_12MB; - case B43legacy_OFDM_RATE_24MB: - return B43legacy_OFDM_RATE_18MB; - case B43legacy_OFDM_RATE_36MB: - return B43legacy_OFDM_RATE_24MB; - case B43legacy_OFDM_RATE_48MB: - return B43legacy_OFDM_RATE_36MB; - case B43legacy_OFDM_RATE_54MB: - return B43legacy_OFDM_RATE_48MB; - } - B43legacy_BUG_ON(1); - return 0; -} - -static int generate_txhdr_fw3(struct b43legacy_wldev *dev, - struct b43legacy_txhdr_fw3 *txhdr, - const unsigned char *fragment_data, - unsigned int fragment_len, - struct ieee80211_tx_info *info, - u16 cookie) -{ - const struct ieee80211_hdr *wlhdr; - int use_encryption = !!info->control.hw_key; - u8 rate; - struct ieee80211_rate *rate_fb; - int rate_ofdm; - int rate_fb_ofdm; - unsigned int plcp_fragment_len; - u32 mac_ctl = 0; - u16 phy_ctl = 0; - struct ieee80211_rate *tx_rate; - struct ieee80211_tx_rate *rates; - - wlhdr = (const struct ieee80211_hdr *)fragment_data; - - memset(txhdr, 0, sizeof(*txhdr)); - - tx_rate = ieee80211_get_tx_rate(dev->wl->hw, info); - - rate = tx_rate->hw_value; - rate_ofdm = b43legacy_is_ofdm_rate(rate); - rate_fb = ieee80211_get_alt_retry_rate(dev->wl->hw, info, 0) ? : tx_rate; - rate_fb_ofdm = b43legacy_is_ofdm_rate(rate_fb->hw_value); - - txhdr->mac_frame_ctl = wlhdr->frame_control; - memcpy(txhdr->tx_receiver, wlhdr->addr1, 6); - - /* Calculate duration for fallback rate */ - if ((rate_fb->hw_value == rate) || - (wlhdr->duration_id & cpu_to_le16(0x8000)) || - (wlhdr->duration_id == cpu_to_le16(0))) { - /* If the fallback rate equals the normal rate or the - * dur_id field contains an AID, CFP magic or 0, - * use the original dur_id field. */ - txhdr->dur_fb = wlhdr->duration_id; - } else { - txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, - info->control.vif, - info->band, - fragment_len, - rate_fb); - } - - plcp_fragment_len = fragment_len + FCS_LEN; - if (use_encryption) { - u8 key_idx = info->control.hw_key->hw_key_idx; - struct b43legacy_key *key; - int wlhdr_len; - size_t iv_len; - - B43legacy_WARN_ON(key_idx >= dev->max_nr_keys); - key = &(dev->key[key_idx]); - - if (key->enabled) { - /* Hardware appends ICV. */ - plcp_fragment_len += info->control.hw_key->icv_len; - - key_idx = b43legacy_kidx_to_fw(dev, key_idx); - mac_ctl |= (key_idx << B43legacy_TX4_MAC_KEYIDX_SHIFT) & - B43legacy_TX4_MAC_KEYIDX; - mac_ctl |= (key->algorithm << - B43legacy_TX4_MAC_KEYALG_SHIFT) & - B43legacy_TX4_MAC_KEYALG; - wlhdr_len = ieee80211_hdrlen(wlhdr->frame_control); - iv_len = min((size_t)info->control.hw_key->iv_len, - ARRAY_SIZE(txhdr->iv)); - memcpy(txhdr->iv, ((u8 *)wlhdr) + wlhdr_len, iv_len); - } else { - /* This key is invalid. This might only happen - * in a short timeframe after machine resume before - * we were able to reconfigure keys. - * Drop this packet completely. Do not transmit it - * unencrypted to avoid leaking information. */ - return -ENOKEY; - } - } - b43legacy_generate_plcp_hdr((struct b43legacy_plcp_hdr4 *) - (&txhdr->plcp), plcp_fragment_len, - rate); - b43legacy_generate_plcp_hdr(&txhdr->plcp_fb, plcp_fragment_len, - rate_fb->hw_value); - - /* PHY TX Control word */ - if (rate_ofdm) - phy_ctl |= B43legacy_TX4_PHY_ENC_OFDM; - if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) - phy_ctl |= B43legacy_TX4_PHY_SHORTPRMBL; - phy_ctl |= B43legacy_TX4_PHY_ANTLAST; - - /* MAC control */ - rates = info->control.rates; - if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) - mac_ctl |= B43legacy_TX4_MAC_ACK; - if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) - mac_ctl |= B43legacy_TX4_MAC_HWSEQ; - if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) - mac_ctl |= B43legacy_TX4_MAC_STMSDU; - if (rate_fb_ofdm) - mac_ctl |= B43legacy_TX4_MAC_FALLBACKOFDM; - - /* Overwrite rates[0].count to make the retry calculation - * in the tx status easier. need the actual retry limit to - * detect whether the fallback rate was used. - */ - if ((rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || - (rates[0].count <= dev->wl->hw->conf.long_frame_max_tx_count)) { - rates[0].count = dev->wl->hw->conf.long_frame_max_tx_count; - mac_ctl |= B43legacy_TX4_MAC_LONGFRAME; - } else { - rates[0].count = dev->wl->hw->conf.short_frame_max_tx_count; - } - - /* Generate the RTS or CTS-to-self frame */ - if ((rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || - (rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) { - unsigned int len; - struct ieee80211_hdr *hdr; - int rts_rate; - int rts_rate_fb; - int rts_rate_fb_ofdm; - - rts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, info)->hw_value; - rts_rate_fb = b43legacy_calc_fallback_rate(rts_rate); - rts_rate_fb_ofdm = b43legacy_is_ofdm_rate(rts_rate_fb); - if (rts_rate_fb_ofdm) - mac_ctl |= B43legacy_TX4_MAC_CTSFALLBACKOFDM; - - if (rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { - ieee80211_ctstoself_get(dev->wl->hw, - info->control.vif, - fragment_data, - fragment_len, info, - (struct ieee80211_cts *) - (txhdr->rts_frame)); - mac_ctl |= B43legacy_TX4_MAC_SENDCTS; - len = sizeof(struct ieee80211_cts); - } else { - ieee80211_rts_get(dev->wl->hw, - info->control.vif, - fragment_data, fragment_len, info, - (struct ieee80211_rts *) - (txhdr->rts_frame)); - mac_ctl |= B43legacy_TX4_MAC_SENDRTS; - len = sizeof(struct ieee80211_rts); - } - len += FCS_LEN; - b43legacy_generate_plcp_hdr((struct b43legacy_plcp_hdr4 *) - (&txhdr->rts_plcp), - len, rts_rate); - b43legacy_generate_plcp_hdr(&txhdr->rts_plcp_fb, - len, rts_rate_fb); - hdr = (struct ieee80211_hdr *)(&txhdr->rts_frame); - txhdr->rts_dur_fb = hdr->duration_id; - } - - /* Magic cookie */ - txhdr->cookie = cpu_to_le16(cookie); - - /* Apply the bitfields */ - txhdr->mac_ctl = cpu_to_le32(mac_ctl); - txhdr->phy_ctl = cpu_to_le16(phy_ctl); - - return 0; -} - -int b43legacy_generate_txhdr(struct b43legacy_wldev *dev, - u8 *txhdr, - const unsigned char *fragment_data, - unsigned int fragment_len, - struct ieee80211_tx_info *info, - u16 cookie) -{ - return generate_txhdr_fw3(dev, (struct b43legacy_txhdr_fw3 *)txhdr, - fragment_data, fragment_len, - info, cookie); -} - -static s8 b43legacy_rssi_postprocess(struct b43legacy_wldev *dev, - u8 in_rssi, int ofdm, - int adjust_2053, int adjust_2050) -{ - struct b43legacy_phy *phy = &dev->phy; - s32 tmp; - - switch (phy->radio_ver) { - case 0x2050: - if (ofdm) { - tmp = in_rssi; - if (tmp > 127) - tmp -= 256; - tmp *= 73; - tmp /= 64; - if (adjust_2050) - tmp += 25; - else - tmp -= 3; - } else { - if (dev->dev->bus->sprom.boardflags_lo - & B43legacy_BFL_RSSI) { - if (in_rssi > 63) - in_rssi = 63; - tmp = phy->nrssi_lt[in_rssi]; - tmp = 31 - tmp; - tmp *= -131; - tmp /= 128; - tmp -= 57; - } else { - tmp = in_rssi; - tmp = 31 - tmp; - tmp *= -149; - tmp /= 128; - tmp -= 68; - } - if (phy->type == B43legacy_PHYTYPE_G && - adjust_2050) - tmp += 25; - } - break; - case 0x2060: - if (in_rssi > 127) - tmp = in_rssi - 256; - else - tmp = in_rssi; - break; - default: - tmp = in_rssi; - tmp -= 11; - tmp *= 103; - tmp /= 64; - if (adjust_2053) - tmp -= 109; - else - tmp -= 83; - } - - return (s8)tmp; -} - -void b43legacy_rx(struct b43legacy_wldev *dev, - struct sk_buff *skb, - const void *_rxhdr) -{ - struct ieee80211_rx_status status; - struct b43legacy_plcp_hdr6 *plcp; - struct ieee80211_hdr *wlhdr; - const struct b43legacy_rxhdr_fw3 *rxhdr = _rxhdr; - __le16 fctl; - u16 phystat0; - u16 phystat3; - u16 chanstat; - u16 mactime; - u32 macstat; - u16 chanid; - u8 jssi; - int padding; - - memset(&status, 0, sizeof(status)); - - /* Get metadata about the frame from the header. */ - phystat0 = le16_to_cpu(rxhdr->phy_status0); - phystat3 = le16_to_cpu(rxhdr->phy_status3); - jssi = rxhdr->jssi; - macstat = le16_to_cpu(rxhdr->mac_status); - mactime = le16_to_cpu(rxhdr->mac_time); - chanstat = le16_to_cpu(rxhdr->channel); - - if (macstat & B43legacy_RX_MAC_FCSERR) - dev->wl->ieee_stats.dot11FCSErrorCount++; - - /* Skip PLCP and padding */ - padding = (macstat & B43legacy_RX_MAC_PADDING) ? 2 : 0; - if (unlikely(skb->len < (sizeof(struct b43legacy_plcp_hdr6) + - padding))) { - b43legacydbg(dev->wl, "RX: Packet size underrun (1)\n"); - goto drop; - } - plcp = (struct b43legacy_plcp_hdr6 *)(skb->data + padding); - skb_pull(skb, sizeof(struct b43legacy_plcp_hdr6) + padding); - /* The skb contains the Wireless Header + payload data now */ - if (unlikely(skb->len < (2+2+6/*minimum hdr*/ + FCS_LEN))) { - b43legacydbg(dev->wl, "RX: Packet size underrun (2)\n"); - goto drop; - } - wlhdr = (struct ieee80211_hdr *)(skb->data); - fctl = wlhdr->frame_control; - - if ((macstat & B43legacy_RX_MAC_DEC) && - !(macstat & B43legacy_RX_MAC_DECERR)) { - unsigned int keyidx; - int wlhdr_len; - int iv_len; - int icv_len; - - keyidx = ((macstat & B43legacy_RX_MAC_KEYIDX) - >> B43legacy_RX_MAC_KEYIDX_SHIFT); - /* We must adjust the key index here. We want the "physical" - * key index, but the ucode passed it slightly different. - */ - keyidx = b43legacy_kidx_to_raw(dev, keyidx); - B43legacy_WARN_ON(keyidx >= dev->max_nr_keys); - - if (dev->key[keyidx].algorithm != B43legacy_SEC_ALGO_NONE) { - /* Remove PROTECTED flag to mark it as decrypted. */ - B43legacy_WARN_ON(!ieee80211_has_protected(fctl)); - fctl &= ~cpu_to_le16(IEEE80211_FCTL_PROTECTED); - wlhdr->frame_control = fctl; - - wlhdr_len = ieee80211_hdrlen(fctl); - if (unlikely(skb->len < (wlhdr_len + 3))) { - b43legacydbg(dev->wl, "RX: Packet size" - " underrun3\n"); - goto drop; - } - if (skb->data[wlhdr_len + 3] & (1 << 5)) { - /* The Ext-IV Bit is set in the "KeyID" - * octet of the IV. - */ - iv_len = 8; - icv_len = 8; - } else { - iv_len = 4; - icv_len = 4; - } - if (unlikely(skb->len < (wlhdr_len + iv_len + - icv_len))) { - b43legacydbg(dev->wl, "RX: Packet size" - " underrun4\n"); - goto drop; - } - /* Remove the IV */ - memmove(skb->data + iv_len, skb->data, wlhdr_len); - skb_pull(skb, iv_len); - /* Remove the ICV */ - skb_trim(skb, skb->len - icv_len); - - status.flag |= RX_FLAG_DECRYPTED; - } - } - - status.signal = b43legacy_rssi_postprocess(dev, jssi, - (phystat0 & B43legacy_RX_PHYST0_OFDM), - (phystat0 & B43legacy_RX_PHYST0_GAINCTL), - (phystat3 & B43legacy_RX_PHYST3_TRSTATE)); - /* change to support A PHY */ - if (phystat0 & B43legacy_RX_PHYST0_OFDM) - status.rate_idx = b43legacy_plcp_get_bitrate_idx_ofdm(plcp, false); - else - status.rate_idx = b43legacy_plcp_get_bitrate_idx_cck(plcp); - status.antenna = !!(phystat0 & B43legacy_RX_PHYST0_ANT); - - /* - * All frames on monitor interfaces and beacons always need a full - * 64-bit timestamp. Monitor interfaces need it for diagnostic - * purposes and beacons for IBSS merging. - * This code assumes we get to process the packet within 16 bits - * of timestamp, i.e. about 65 milliseconds after the PHY received - * the first symbol. - */ - if (ieee80211_is_beacon(fctl) || dev->wl->radiotap_enabled) { - u16 low_mactime_now; - - b43legacy_tsf_read(dev, &status.mactime); - low_mactime_now = status.mactime; - status.mactime = status.mactime & ~0xFFFFULL; - status.mactime += mactime; - if (low_mactime_now <= mactime) - status.mactime -= 0x10000; - status.flag |= RX_FLAG_MACTIME_START; - } - - chanid = (chanstat & B43legacy_RX_CHAN_ID) >> - B43legacy_RX_CHAN_ID_SHIFT; - switch (chanstat & B43legacy_RX_CHAN_PHYTYPE) { - case B43legacy_PHYTYPE_B: - case B43legacy_PHYTYPE_G: - status.band = IEEE80211_BAND_2GHZ; - status.freq = chanid + 2400; - break; - default: - b43legacywarn(dev->wl, "Unexpected value for chanstat (0x%X)\n", - chanstat); - } - - memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); - ieee80211_rx_irqsafe(dev->wl->hw, skb); - - return; -drop: - b43legacydbg(dev->wl, "RX: Packet dropped\n"); - dev_kfree_skb_any(skb); -} - -void b43legacy_handle_txstatus(struct b43legacy_wldev *dev, - const struct b43legacy_txstatus *status) -{ - b43legacy_debugfs_log_txstat(dev, status); - - if (status->intermediate) - return; - if (status->for_ampdu) - return; - if (!status->acked) - dev->wl->ieee_stats.dot11ACKFailureCount++; - if (status->rts_count) { - if (status->rts_count == 0xF) /* FIXME */ - dev->wl->ieee_stats.dot11RTSFailureCount++; - else - dev->wl->ieee_stats.dot11RTSSuccessCount++; - } - - if (b43legacy_using_pio(dev)) - b43legacy_pio_handle_txstatus(dev, status); - else - b43legacy_dma_handle_txstatus(dev, status); -} - -/* Handle TX status report as received through DMA/PIO queues */ -void b43legacy_handle_hwtxstatus(struct b43legacy_wldev *dev, - const struct b43legacy_hwtxstatus *hw) -{ - struct b43legacy_txstatus status; - u8 tmp; - - status.cookie = le16_to_cpu(hw->cookie); - status.seq = le16_to_cpu(hw->seq); - status.phy_stat = hw->phy_stat; - tmp = hw->count; - status.frame_count = (tmp >> 4); - status.rts_count = (tmp & 0x0F); - tmp = hw->flags << 1; - status.supp_reason = ((tmp & 0x1C) >> 2); - status.pm_indicated = !!(tmp & 0x80); - status.intermediate = !!(tmp & 0x40); - status.for_ampdu = !!(tmp & 0x20); - status.acked = !!(tmp & 0x02); - - b43legacy_handle_txstatus(dev, &status); -} - -/* Stop any TX operation on the device (suspend the hardware queues) */ -void b43legacy_tx_suspend(struct b43legacy_wldev *dev) -{ - if (b43legacy_using_pio(dev)) - b43legacy_pio_freeze_txqueues(dev); - else - b43legacy_dma_tx_suspend(dev); -} - -/* Resume any TX operation on the device (resume the hardware queues) */ -void b43legacy_tx_resume(struct b43legacy_wldev *dev) -{ - if (b43legacy_using_pio(dev)) - b43legacy_pio_thaw_txqueues(dev); - else - b43legacy_dma_tx_resume(dev); -} - -/* Initialize the QoS parameters */ -void b43legacy_qos_init(struct b43legacy_wldev *dev) -{ - /* FIXME: This function must probably be called from the mac80211 - * config callback. */ -return; - - b43legacy_hf_write(dev, b43legacy_hf_read(dev) | B43legacy_HF_EDCF); - /* FIXME kill magic */ - b43legacy_write16(dev, 0x688, - b43legacy_read16(dev, 0x688) | 0x4); - - - /*TODO: We might need some stack support here to get the values. */ -} diff --git a/drivers/net/wireless/b43legacy/xmit.h b/drivers/net/wireless/b43legacy/xmit.h deleted file mode 100644 index 289db00a4a7b..000000000000 --- a/drivers/net/wireless/b43legacy/xmit.h +++ /dev/null @@ -1,261 +0,0 @@ -#ifndef B43legacy_XMIT_H_ -#define B43legacy_XMIT_H_ - -#include "main.h" - - -#define _b43legacy_declare_plcp_hdr(size) \ - struct b43legacy_plcp_hdr##size { \ - union { \ - __le32 data; \ - __u8 raw[size]; \ - } __packed; \ - } __packed - -/* struct b43legacy_plcp_hdr4 */ -_b43legacy_declare_plcp_hdr(4); -/* struct b43legacy_plcp_hdr6 */ -_b43legacy_declare_plcp_hdr(6); - -#undef _b43legacy_declare_plcp_hdr - - -/* TX header for v3 firmware */ -struct b43legacy_txhdr_fw3 { - __le32 mac_ctl; /* MAC TX control */ - __le16 mac_frame_ctl; /* Copy of the FrameControl */ - __le16 tx_fes_time_norm; /* TX FES Time Normal */ - __le16 phy_ctl; /* PHY TX control */ - __u8 iv[16]; /* Encryption IV */ - __u8 tx_receiver[6]; /* TX Frame Receiver address */ - __le16 tx_fes_time_fb; /* TX FES Time Fallback */ - struct b43legacy_plcp_hdr4 rts_plcp_fb; /* RTS fallback PLCP */ - __le16 rts_dur_fb; /* RTS fallback duration */ - struct b43legacy_plcp_hdr4 plcp_fb; /* Fallback PLCP */ - __le16 dur_fb; /* Fallback duration */ - PAD_BYTES(2); - __le16 cookie; - __le16 unknown_scb_stuff; - struct b43legacy_plcp_hdr6 rts_plcp; /* RTS PLCP */ - __u8 rts_frame[18]; /* The RTS frame (if used) */ - struct b43legacy_plcp_hdr6 plcp; -} __packed; - -/* MAC TX control */ -#define B43legacy_TX4_MAC_KEYIDX 0x0FF00000 /* Security key index */ -#define B43legacy_TX4_MAC_KEYIDX_SHIFT 20 -#define B43legacy_TX4_MAC_KEYALG 0x00070000 /* Security key algorithm */ -#define B43legacy_TX4_MAC_KEYALG_SHIFT 16 -#define B43legacy_TX4_MAC_LIFETIME 0x00001000 -#define B43legacy_TX4_MAC_FRAMEBURST 0x00000800 -#define B43legacy_TX4_MAC_SENDCTS 0x00000400 -#define B43legacy_TX4_MAC_AMPDU 0x00000300 -#define B43legacy_TX4_MAC_AMPDU_SHIFT 8 -#define B43legacy_TX4_MAC_CTSFALLBACKOFDM 0x00000200 -#define B43legacy_TX4_MAC_FALLBACKOFDM 0x00000100 -#define B43legacy_TX4_MAC_5GHZ 0x00000080 -#define B43legacy_TX4_MAC_IGNPMQ 0x00000020 -#define B43legacy_TX4_MAC_HWSEQ 0x00000010 /* Use Hardware Seq No */ -#define B43legacy_TX4_MAC_STMSDU 0x00000008 /* Start MSDU */ -#define B43legacy_TX4_MAC_SENDRTS 0x00000004 -#define B43legacy_TX4_MAC_LONGFRAME 0x00000002 -#define B43legacy_TX4_MAC_ACK 0x00000001 - -/* Extra Frame Types */ -#define B43legacy_TX4_EFT_FBOFDM 0x0001 /* Data frame fb rate type */ -#define B43legacy_TX4_EFT_RTSOFDM 0x0004 /* RTS/CTS rate type */ -#define B43legacy_TX4_EFT_RTSFBOFDM 0x0010 /* RTS/CTS fallback rate type */ - -/* PHY TX control word */ -#define B43legacy_TX4_PHY_ENC 0x0003 /* Data frame encoding */ -#define B43legacy_TX4_PHY_ENC_CCK 0x0000 /* CCK */ -#define B43legacy_TX4_PHY_ENC_OFDM 0x0001 /* Data frame rate type */ -#define B43legacy_TX4_PHY_SHORTPRMBL 0x0010 /* Use short preamble */ -#define B43legacy_TX4_PHY_ANT 0x03C0 /* Antenna selection */ -#define B43legacy_TX4_PHY_ANT0 0x0000 /* Use antenna 0 */ -#define B43legacy_TX4_PHY_ANT1 0x0100 /* Use antenna 1 */ -#define B43legacy_TX4_PHY_ANTLAST 0x0300 /* Use last used antenna */ - - - -int b43legacy_generate_txhdr(struct b43legacy_wldev *dev, - u8 *txhdr, - const unsigned char *fragment_data, - unsigned int fragment_len, - struct ieee80211_tx_info *info, - u16 cookie); - - -/* Transmit Status */ -struct b43legacy_txstatus { - u16 cookie; /* The cookie from the txhdr */ - u16 seq; /* Sequence number */ - u8 phy_stat; /* PHY TX status */ - u8 frame_count; /* Frame transmit count */ - u8 rts_count; /* RTS transmit count */ - u8 supp_reason; /* Suppression reason */ - /* flags */ - u8 pm_indicated;/* PM mode indicated to AP */ - u8 intermediate;/* Intermediate status notification */ - u8 for_ampdu; /* Status is for an AMPDU (afterburner) */ - u8 acked; /* Wireless ACK received */ -}; - -/* txstatus supp_reason values */ -enum { - B43legacy_TXST_SUPP_NONE, /* Not suppressed */ - B43legacy_TXST_SUPP_PMQ, /* Suppressed due to PMQ entry */ - B43legacy_TXST_SUPP_FLUSH, /* Suppressed due to flush request */ - B43legacy_TXST_SUPP_PREV, /* Previous fragment failed */ - B43legacy_TXST_SUPP_CHAN, /* Channel mismatch */ - B43legacy_TXST_SUPP_LIFE, /* Lifetime expired */ - B43legacy_TXST_SUPP_UNDER, /* Buffer underflow */ - B43legacy_TXST_SUPP_ABNACK, /* Afterburner NACK */ -}; - -/* Transmit Status as received through DMA/PIO on old chips */ -struct b43legacy_hwtxstatus { - PAD_BYTES(4); - __le16 cookie; - u8 flags; - u8 count; - PAD_BYTES(2); - __le16 seq; - u8 phy_stat; - PAD_BYTES(1); -} __packed; - - -/* Receive header for v3 firmware. */ -struct b43legacy_rxhdr_fw3 { - __le16 frame_len; /* Frame length */ - PAD_BYTES(2); - __le16 phy_status0; /* PHY RX Status 0 */ - __u8 jssi; /* PHY RX Status 1: JSSI */ - __u8 sig_qual; /* PHY RX Status 1: Signal Quality */ - PAD_BYTES(2); /* PHY RX Status 2 */ - __le16 phy_status3; /* PHY RX Status 3 */ - __le16 mac_status; /* MAC RX status */ - __le16 mac_time; - __le16 channel; -} __packed; - - -/* PHY RX Status 0 */ -#define B43legacy_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */ -#define B43legacy_RX_PHYST0_PLCPHCF 0x0200 -#define B43legacy_RX_PHYST0_PLCPFV 0x0100 -#define B43legacy_RX_PHYST0_SHORTPRMBL 0x0080 /* Recvd with Short Preamble */ -#define B43legacy_RX_PHYST0_LCRS 0x0040 -#define B43legacy_RX_PHYST0_ANT 0x0020 /* Antenna */ -#define B43legacy_RX_PHYST0_UNSRATE 0x0010 -#define B43legacy_RX_PHYST0_CLIP 0x000C -#define B43legacy_RX_PHYST0_CLIP_SHIFT 2 -#define B43legacy_RX_PHYST0_FTYPE 0x0003 /* Frame type */ -#define B43legacy_RX_PHYST0_CCK 0x0000 /* Frame type: CCK */ -#define B43legacy_RX_PHYST0_OFDM 0x0001 /* Frame type: OFDM */ -#define B43legacy_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */ -#define B43legacy_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */ - -/* PHY RX Status 2 */ -#define B43legacy_RX_PHYST2_LNAG 0xC000 /* LNA Gain */ -#define B43legacy_RX_PHYST2_LNAG_SHIFT 14 -#define B43legacy_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */ -#define B43legacy_RX_PHYST2_PNAG_SHIFT 10 -#define B43legacy_RX_PHYST2_FOFF 0x03FF /* F offset */ - -/* PHY RX Status 3 */ -#define B43legacy_RX_PHYST3_DIGG 0x1800 /* DIG Gain */ -#define B43legacy_RX_PHYST3_DIGG_SHIFT 11 -#define B43legacy_RX_PHYST3_TRSTATE 0x0400 /* TR state */ - -/* MAC RX Status */ -#define B43legacy_RX_MAC_BEACONSENT 0x00008000 /* Beacon send flag */ -#define B43legacy_RX_MAC_KEYIDX 0x000007E0 /* Key index */ -#define B43legacy_RX_MAC_KEYIDX_SHIFT 5 -#define B43legacy_RX_MAC_DECERR 0x00000010 /* Decrypt error */ -#define B43legacy_RX_MAC_DEC 0x00000008 /* Decryption attempted */ -#define B43legacy_RX_MAC_PADDING 0x00000004 /* Pad bytes present */ -#define B43legacy_RX_MAC_RESP 0x00000002 /* Response frame xmitted */ -#define B43legacy_RX_MAC_FCSERR 0x00000001 /* FCS error */ - -/* RX channel */ -#define B43legacy_RX_CHAN_GAIN 0xFC00 /* Gain */ -#define B43legacy_RX_CHAN_GAIN_SHIFT 10 -#define B43legacy_RX_CHAN_ID 0x03FC /* Channel ID */ -#define B43legacy_RX_CHAN_ID_SHIFT 2 -#define B43legacy_RX_CHAN_PHYTYPE 0x0003 /* PHY type */ - - - -u8 b43legacy_plcp_get_ratecode_cck(const u8 bitrate); -u8 b43legacy_plcp_get_ratecode_ofdm(const u8 bitrate); - -void b43legacy_generate_plcp_hdr(struct b43legacy_plcp_hdr4 *plcp, - const u16 octets, const u8 bitrate); - -void b43legacy_rx(struct b43legacy_wldev *dev, - struct sk_buff *skb, - const void *_rxhdr); - -void b43legacy_handle_txstatus(struct b43legacy_wldev *dev, - const struct b43legacy_txstatus *status); - -void b43legacy_handle_hwtxstatus(struct b43legacy_wldev *dev, - const struct b43legacy_hwtxstatus *hw); - -void b43legacy_tx_suspend(struct b43legacy_wldev *dev); -void b43legacy_tx_resume(struct b43legacy_wldev *dev); - - -#define B43legacy_NR_QOSPARMS 22 -enum { - B43legacy_QOSPARM_TXOP = 0, - B43legacy_QOSPARM_CWMIN, - B43legacy_QOSPARM_CWMAX, - B43legacy_QOSPARM_CWCUR, - B43legacy_QOSPARM_AIFS, - B43legacy_QOSPARM_BSLOTS, - B43legacy_QOSPARM_REGGAP, - B43legacy_QOSPARM_STATUS, -}; - -void b43legacy_qos_init(struct b43legacy_wldev *dev); - - -/* Helper functions for converting the key-table index from "firmware-format" - * to "raw-format" and back. The firmware API changed for this at some revision. - * We need to account for that here. */ -static inline -int b43legacy_new_kidx_api(struct b43legacy_wldev *dev) -{ - /* FIXME: Not sure the change was at rev 351 */ - return (dev->fw.rev >= 351); -} -static inline -u8 b43legacy_kidx_to_fw(struct b43legacy_wldev *dev, u8 raw_kidx) -{ - u8 firmware_kidx; - if (b43legacy_new_kidx_api(dev)) - firmware_kidx = raw_kidx; - else { - if (raw_kidx >= 4) /* Is per STA key? */ - firmware_kidx = raw_kidx - 4; - else - firmware_kidx = raw_kidx; /* TX default key */ - } - return firmware_kidx; -} -static inline -u8 b43legacy_kidx_to_raw(struct b43legacy_wldev *dev, u8 firmware_kidx) -{ - u8 raw_kidx; - if (b43legacy_new_kidx_api(dev)) - raw_kidx = firmware_kidx; - else - /* RX default keys or per STA keys */ - raw_kidx = firmware_kidx + 4; - return raw_kidx; -} - -#endif /* B43legacy_XMIT_H_ */ diff --git a/drivers/net/wireless/bcm4319/Makefile b/drivers/net/wireless/bcm4319/Makefile deleted file mode 100644 index 3d9df6a001e2..000000000000 --- a/drivers/net/wireless/bcm4319/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# bcm4319 -DHDCFLAGS = -DLINUX -DBCMDRIVER -DBCMDONGLEHOST -DDHDTHREAD -DBCMWPA2 \ - -DUNRELEASEDCHIP -Dlinux -DDHD_SDALIGN=64 -DMAX_HDR_READ=64 \ - -DDHD_FIRSTREAD=64 -DDHD_GPL -DDHD_SCHED -DBDC -DTOE -DDHD_BCMEVENTS \ - -DSHOW_EVENTS -DBCMSDIO -DDHD_GPL -DBCMLXSDMMC -DBCMPLATFORM_BUS \ - -Wall -Wstrict-prototypes -Werror -DCUSTOMER_HW2 \ - -DDHD_USE_STATIC_BUF -DDHD_DEBUG_TRAP -DSOFTAP -DSDIO_ISR_THREAD \ - -DEMBEDDED_PLATFORM -DARP_OFFLOAD_SUPPORT -DPKT_FILTER_SUPPORT \ - -DGET_CUSTOM_MAC_ENABLE -DSET_RANDOM_MAC_SOFTAP -DCSCAN \ - -DKEEP_ALIVE -DCONFIG_US_NON_DFS_CHANNELS_ONLY \ - -Idrivers/net/wireless/bcm4319 -Idrivers/net/wireless/bcm4319/include - -#options defines dependent on platform board and applicantion requirements: -#-DOOB_INTR_ONLY -DMMC_SDIO_ABORT -DHW_OOB - -DHDOFILES = dhd_linux.o linux_osl.o bcmutils.o dhd_common.o dhd_custom_gpio.o \ - wl_iw.o siutils.o sbutils.o aiutils.o hndpmu.o bcmwifi.o dhd_sdio.o \ - dhd_linux_sched.o dhd_cdc.o bcmsdh_sdmmc.o bcmsdh.o bcmsdh_linux.o \ - bcmsdh_sdmmc_linux.o - -obj-$(CONFIG_BCM4319) += bcm4319.o -bcm4319-objs += $(DHDOFILES) -EXTRA_CFLAGS = $(DHDCFLAGS) -EXTRA_LDFLAGS += --strip-debug diff --git a/drivers/net/wireless/bcm4319/aiutils.c b/drivers/net/wireless/bcm4319/aiutils.c deleted file mode 100644 index df48ac0d83d4..000000000000 --- a/drivers/net/wireless/bcm4319/aiutils.c +++ /dev/null @@ -1,686 +0,0 @@ -/* - * Misc utility routines for accessing chip-specific features - * of the SiliconBackplane-based Broadcom chips. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: aiutils.c,v 1.6.4.7.4.6 2010/04/21 20:43:47 Exp $ - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "siutils_priv.h" - -STATIC uint32 -get_asd(si_t *sih, uint32 *eromptr, uint sp, uint ad, uint st, - uint32 *addrl, uint32 *addrh, uint32 *sizel, uint32 *sizeh); - - -/* EROM parsing */ - -static uint32 -get_erom_ent(si_t *sih, uint32 *eromptr, uint32 mask, uint32 match) -{ - uint32 ent; - uint inv = 0, nom = 0; - - while (TRUE) { - ent = R_REG(si_osh(sih), (uint32 *)(uintptr)(*eromptr)); - *eromptr += sizeof(uint32); - - if (mask == 0) - break; - - if ((ent & ER_VALID) == 0) { - inv++; - continue; - } - - if (ent == (ER_END | ER_VALID)) - break; - - if ((ent & mask) == match) - break; - - nom++; - } - - SI_MSG(("%s: Returning ent 0x%08x\n", __FUNCTION__, ent)); - if (inv + nom) - SI_MSG((" after %d invalid and %d non-matching entries\n", inv, nom)); - return ent; -} - -STATIC uint32 -get_asd(si_t *sih, uint32 *eromptr, uint sp, uint ad, uint st, - uint32 *addrl, uint32 *addrh, uint32 *sizel, uint32 *sizeh) -{ - uint32 asd, sz, szd; - - asd = get_erom_ent(sih, eromptr, ER_VALID, ER_VALID); - if (((asd & ER_TAG1) != ER_ADD) || - (((asd & AD_SP_MASK) >> AD_SP_SHIFT) != sp) || - ((asd & AD_ST_MASK) != st)) { - /* This is not what we want, "push" it back */ - *eromptr -= sizeof(uint32); - return 0; - } - *addrl = asd & AD_ADDR_MASK; - if (asd & AD_AG32) - *addrh = get_erom_ent(sih, eromptr, 0, 0); - else - *addrh = 0; - *sizeh = 0; - sz = asd & AD_SZ_MASK; - if (sz == AD_SZ_SZD) { - szd = get_erom_ent(sih, eromptr, 0, 0); - *sizel = szd & SD_SZ_MASK; - if (szd & SD_SG32) - *sizeh = get_erom_ent(sih, eromptr, 0, 0); - } else - *sizel = AD_SZ_BASE << (sz >> AD_SZ_SHIFT); - - SI_MSG((" SP %d, ad %d: st = %d, 0x%08x_0x%08x @ 0x%08x_0x%08x\n", - sp, ad, st, *sizeh, *sizel, *addrh, *addrl)); - - return asd; -} - -/* parse the enumeration rom to identify all cores */ -void -ai_scan(si_t *sih, void *regs, uint devid) -{ - si_info_t *sii = SI_INFO(sih); - chipcregs_t *cc = (chipcregs_t *)regs; - uint32 erombase, eromptr, eromlim; - - erombase = R_REG(sii->osh, &cc->eromptr); - - switch (BUSTYPE(sih->bustype)) { - case SI_BUS: - eromptr = (uintptr)REG_MAP(erombase, SI_CORE_SIZE); - break; - - case PCI_BUS: - /* Set wrappers address */ - sii->curwrap = (void *)((uintptr)regs + SI_CORE_SIZE); - - /* Now point the window at the erom */ - OSL_PCI_WRITE_CONFIG(sii->osh, PCI_BAR0_WIN, 4, erombase); - eromptr = (uint32)(uintptr)regs; - break; - - case SPI_BUS: - case SDIO_BUS: - eromptr = erombase; - break; - - case PCMCIA_BUS: - default: - SI_ERROR(("Don't know how to do AXI enumertion on bus %d\n", sih->bustype)); - ASSERT(0); - return; - } - eromlim = eromptr + ER_REMAPCONTROL; - - SI_MSG(("ai_scan: regs = 0x%p, erombase = 0x%08x, eromptr = 0x%08x, eromlim = 0x%08x\n", - regs, erombase, eromptr, eromlim)); - while (eromptr < eromlim) { - uint32 cia, cib, base, cid, mfg, crev, nmw, nsw, nmp, nsp; - uint32 mpd, asd, addrl, addrh, sizel, sizeh; - uint i, j, idx; - bool br; - - br = FALSE; - - /* Grok a component */ - cia = get_erom_ent(sih, &eromptr, ER_TAG, ER_CI); - if (cia == (ER_END | ER_VALID)) { - SI_MSG(("Found END of erom after %d cores\n", sii->numcores)); - return; - } - base = eromptr - sizeof(uint32); - cib = get_erom_ent(sih, &eromptr, 0, 0); - - if ((cib & ER_TAG) != ER_CI) { - SI_ERROR(("CIA not followed by CIB\n")); - goto error; - } - - cid = (cia & CIA_CID_MASK) >> CIA_CID_SHIFT; - mfg = (cia & CIA_MFG_MASK) >> CIA_MFG_SHIFT; - crev = (cib & CIB_REV_MASK) >> CIB_REV_SHIFT; - nmw = (cib & CIB_NMW_MASK) >> CIB_NMW_SHIFT; - nsw = (cib & CIB_NSW_MASK) >> CIB_NSW_SHIFT; - nmp = (cib & CIB_NMP_MASK) >> CIB_NMP_SHIFT; - nsp = (cib & CIB_NSP_MASK) >> CIB_NSP_SHIFT; - - SI_MSG(("Found component 0x%04x/0x%4x rev %d at erom addr 0x%08x, with nmw = %d, " - "nsw = %d, nmp = %d & nsp = %d\n", - mfg, cid, crev, base, nmw, nsw, nmp, nsp)); - - if (((mfg == MFGID_ARM) && (cid == DEF_AI_COMP)) || (nsp == 0)) - continue; - if ((nmw + nsw == 0)) { - /* A component which is not a core */ - if (cid == OOB_ROUTER_CORE_ID) { - asd = get_asd(sih, &eromptr, 0, 0, AD_ST_SLAVE, - &addrl, &addrh, &sizel, &sizeh); - if (asd != 0) { - sii->common_info->oob_router = addrl; - } - } - continue; - } - - idx = sii->numcores; -/* sii->eromptr[idx] = base; */ - sii->common_info->cia[idx] = cia; - sii->common_info->cib[idx] = cib; - sii->common_info->coreid[idx] = cid; - - for (i = 0; i < nmp; i++) { - mpd = get_erom_ent(sih, &eromptr, ER_VALID, ER_VALID); - if ((mpd & ER_TAG) != ER_MP) { - SI_ERROR(("Not enough MP entries for component 0x%x\n", cid)); - goto error; - } - SI_MSG((" Master port %d, mp: %d id: %d\n", i, - (mpd & MPD_MP_MASK) >> MPD_MP_SHIFT, - (mpd & MPD_MUI_MASK) >> MPD_MUI_SHIFT)); - } - - /* First Slave Address Descriptor should be port 0: - * the main register space for the core - */ - asd = get_asd(sih, &eromptr, 0, 0, AD_ST_SLAVE, &addrl, &addrh, &sizel, &sizeh); - if (asd == 0) { - /* Try again to see if it is a bridge */ - asd = get_asd(sih, &eromptr, 0, 0, AD_ST_BRIDGE, &addrl, &addrh, - &sizel, &sizeh); - if (asd != 0) - br = TRUE; - else - if ((addrh != 0) || (sizeh != 0) || (sizel != SI_CORE_SIZE)) { - SI_ERROR(("First Slave ASD for core 0x%04x malformed " - "(0x%08x)\n", cid, asd)); - goto error; - } - } - sii->common_info->coresba[idx] = addrl; - sii->common_info->coresba_size[idx] = sizel; - /* Get any more ASDs in port 0 */ - j = 1; - do { - asd = get_asd(sih, &eromptr, 0, j, AD_ST_SLAVE, &addrl, &addrh, - &sizel, &sizeh); - if ((asd != 0) && (j == 1) && (sizel == SI_CORE_SIZE)) - sii->common_info->coresba2[idx] = addrl; - sii->common_info->coresba2_size[idx] = sizel; - j++; - } while (asd != 0); - - /* Go through the ASDs for other slave ports */ - for (i = 1; i < nsp; i++) { - j = 0; - do { - asd = get_asd(sih, &eromptr, i, j++, AD_ST_SLAVE, &addrl, &addrh, - &sizel, &sizeh); - } while (asd != 0); - if (j == 0) { - SI_ERROR((" SP %d has no address descriptors\n", i)); - goto error; - } - } - - /* Now get master wrappers */ - for (i = 0; i < nmw; i++) { - asd = get_asd(sih, &eromptr, i, 0, AD_ST_MWRAP, &addrl, &addrh, - &sizel, &sizeh); - if (asd == 0) { - SI_ERROR(("Missing descriptor for MW %d\n", i)); - goto error; - } - if ((sizeh != 0) || (sizel != SI_CORE_SIZE)) { - SI_ERROR(("Master wrapper %d is not 4KB\n", i)); - goto error; - } - if (i == 0) - sii->common_info->wrapba[idx] = addrl; - } - - /* And finally slave wrappers */ - for (i = 0; i < nsw; i++) { - uint fwp = (nsp == 1) ? 0 : 1; - asd = get_asd(sih, &eromptr, fwp + i, 0, AD_ST_SWRAP, &addrl, &addrh, - &sizel, &sizeh); - if (asd == 0) { - SI_ERROR(("Missing descriptor for SW %d\n", i)); - goto error; - } - if ((sizeh != 0) || (sizel != SI_CORE_SIZE)) { - SI_ERROR(("Slave wrapper %d is not 4KB\n", i)); - goto error; - } - if ((nmw == 0) && (i == 0)) - sii->common_info->wrapba[idx] = addrl; - } - - /* Don't record bridges */ - if (br) - continue; - - /* Done with core */ - sii->numcores++; - } - - SI_ERROR(("Reached end of erom without finding END")); - -error: - sii->numcores = 0; - return; -} - -/* This function changes the logical "focus" to the indicated core. - * Return the current core's virtual address. - */ -void * -ai_setcoreidx(si_t *sih, uint coreidx) -{ - si_info_t *sii = SI_INFO(sih); - uint32 addr = sii->common_info->coresba[coreidx]; - uint32 wrap = sii->common_info->wrapba[coreidx]; - void *regs; - - if (coreidx >= sii->numcores) - return (NULL); - - /* - * If the user has provided an interrupt mask enabled function, - * then assert interrupts are disabled before switching the core. - */ - ASSERT((sii->intrsenabled_fn == NULL) || !(*(sii)->intrsenabled_fn)((sii)->intr_arg)); - - switch (BUSTYPE(sih->bustype)) { - case SI_BUS: - /* map new one */ - if (!sii->common_info->regs[coreidx]) { - sii->common_info->regs[coreidx] = REG_MAP(addr, SI_CORE_SIZE); - ASSERT(GOODREGS(sii->common_info->regs[coreidx])); - } - sii->curmap = regs = sii->common_info->regs[coreidx]; - if (!sii->common_info->wrappers[coreidx]) { - sii->common_info->wrappers[coreidx] = REG_MAP(wrap, SI_CORE_SIZE); - ASSERT(GOODREGS(sii->common_info->wrappers[coreidx])); - } - sii->curwrap = sii->common_info->wrappers[coreidx]; - break; - - - case SPI_BUS: - case SDIO_BUS: - sii->curmap = regs = (void *)((uintptr)addr); - sii->curwrap = (void *)((uintptr)wrap); - break; - - case PCMCIA_BUS: - default: - ASSERT(0); - regs = NULL; - break; - } - - sii->curmap = regs; - sii->curidx = coreidx; - - return regs; -} - -/* Return the number of address spaces in current core */ -int -ai_numaddrspaces(si_t *sih) -{ - return 2; -} - -/* Return the address of the nth address space in the current core */ -uint32 -ai_addrspace(si_t *sih, uint asidx) -{ - si_info_t *sii; - uint cidx; - - sii = SI_INFO(sih); - cidx = sii->curidx; - - if (asidx == 0) - return sii->common_info->coresba[cidx]; - else if (asidx == 1) - return sii->common_info->coresba2[cidx]; - else { - SI_ERROR(("%s: Need to parse the erom again to find addr space %d\n", - __FUNCTION__, asidx)); - return 0; - } -} - -/* Return the size of the nth address space in the current core */ -uint32 -ai_addrspacesize(si_t *sih, uint asidx) -{ - si_info_t *sii; - uint cidx; - - sii = SI_INFO(sih); - cidx = sii->curidx; - - if (asidx == 0) - return sii->common_info->coresba_size[cidx]; - else if (asidx == 1) - return sii->common_info->coresba2_size[cidx]; - else { - SI_ERROR(("%s: Need to parse the erom again to find addr space %d\n", - __FUNCTION__, asidx)); - return 0; - } -} - -uint -ai_flag(si_t *sih) -{ - si_info_t *sii; - aidmp_t *ai; - - sii = SI_INFO(sih); - ai = sii->curwrap; - - return (R_REG(sii->osh, &ai->oobselouta30) & 0x1f); -} - -void -ai_setint(si_t *sih, int siflag) -{ -} - -void -ai_write_wrap_reg(si_t *sih, uint32 offset, uint32 val) -{ - si_info_t *sii = SI_INFO(sih); - aidmp_t *ai = sii->curwrap; - W_REG(sii->osh, (uint32 *)((uint8 *)ai+offset), val); - return; -} - -uint -ai_corevendor(si_t *sih) -{ - si_info_t *sii; - uint32 cia; - - sii = SI_INFO(sih); - cia = sii->common_info->cia[sii->curidx]; - return ((cia & CIA_MFG_MASK) >> CIA_MFG_SHIFT); -} - -uint -ai_corerev(si_t *sih) -{ - si_info_t *sii; - uint32 cib; - - sii = SI_INFO(sih); - cib = sii->common_info->cib[sii->curidx]; - return ((cib & CIB_REV_MASK) >> CIB_REV_SHIFT); -} - -bool -ai_iscoreup(si_t *sih) -{ - si_info_t *sii; - aidmp_t *ai; - - sii = SI_INFO(sih); - ai = sii->curwrap; - - return (((R_REG(sii->osh, &ai->ioctrl) & (SICF_FGC | SICF_CLOCK_EN)) == SICF_CLOCK_EN) && - ((R_REG(sii->osh, &ai->resetctrl) & AIRC_RESET) == 0)); -} - -/* - * Switch to 'coreidx', issue a single arbitrary 32bit register mask&set operation, - * switch back to the original core, and return the new value. - * - * When using the silicon backplane, no fidleing with interrupts or core switches are needed. - * - * Also, when using pci/pcie, we can optimize away the core switching for pci registers - * and (on newer pci cores) chipcommon registers. - */ -uint -ai_corereg(si_t *sih, uint coreidx, uint regoff, uint mask, uint val) -{ - uint origidx = 0; - uint32 *r = NULL; - uint w; - uint intr_val = 0; - bool fast = FALSE; - si_info_t *sii; - - sii = SI_INFO(sih); - - ASSERT(GOODIDX(coreidx)); - ASSERT(regoff < SI_CORE_SIZE); - ASSERT((val & ~mask) == 0); - - if (coreidx >= SI_MAXCORES) - return 0; - - if (BUSTYPE(sih->bustype) == SI_BUS) { - /* If internal bus, we can always get at everything */ - fast = TRUE; - /* map if does not exist */ - if (!sii->common_info->wrappers[coreidx]) { - sii->common_info->regs[coreidx] = - REG_MAP(sii->common_info->coresba[coreidx], SI_CORE_SIZE); - ASSERT(GOODREGS(sii->common_info->regs[coreidx])); - } - r = (uint32 *)((uchar *)sii->common_info->regs[coreidx] + regoff); - } else if (BUSTYPE(sih->bustype) == PCI_BUS) { - /* If pci/pcie, we can get at pci/pcie regs and on newer cores to chipc */ - - if ((sii->common_info->coreid[coreidx] == CC_CORE_ID) && SI_FAST(sii)) { - /* Chipc registers are mapped at 12KB */ - - fast = TRUE; - r = (uint32 *)((char *)sii->curmap + PCI_16KB0_CCREGS_OFFSET + regoff); - } else if (sii->pub.buscoreidx == coreidx) { - /* pci registers are at either in the last 2KB of an 8KB window - * or, in pcie and pci rev 13 at 8KB - */ - fast = TRUE; - if (SI_FAST(sii)) - r = (uint32 *)((char *)sii->curmap + - PCI_16KB0_PCIREGS_OFFSET + regoff); - else - r = (uint32 *)((char *)sii->curmap + - ((regoff >= SBCONFIGOFF) ? - PCI_BAR0_PCISBR_OFFSET : PCI_BAR0_PCIREGS_OFFSET) + - regoff); - } - } - - if (!fast) { - INTR_OFF(sii, intr_val); - - /* save current core index */ - origidx = si_coreidx(&sii->pub); - - /* switch core */ - r = (uint32*) ((uchar*) ai_setcoreidx(&sii->pub, coreidx) + regoff); - } - ASSERT(r != NULL); - - /* mask and set */ - if (mask || val) { - w = (R_REG(sii->osh, r) & ~mask) | val; - W_REG(sii->osh, r, w); - } - - /* readback */ - w = R_REG(sii->osh, r); - - if (!fast) { - /* restore core index */ - if (origidx != coreidx) - ai_setcoreidx(&sii->pub, origidx); - - INTR_RESTORE(sii, intr_val); - } - - return (w); -} - -void -ai_core_disable(si_t *sih, uint32 bits) -{ - si_info_t *sii; - volatile uint32 dummy; - aidmp_t *ai; - - sii = SI_INFO(sih); - - ASSERT(GOODREGS(sii->curwrap)); - ai = sii->curwrap; - - /* if core is already in reset, just return */ - if (R_REG(sii->osh, &ai->resetctrl) & AIRC_RESET) - return; - - W_REG(sii->osh, &ai->ioctrl, bits); - dummy = R_REG(sii->osh, &ai->ioctrl); - OSL_DELAY(10); - - W_REG(sii->osh, &ai->resetctrl, AIRC_RESET); - OSL_DELAY(1); -} - -/* reset and re-enable a core - * inputs: - * bits - core specific bits that are set during and after reset sequence - * resetbits - core specific bits that are set only during reset sequence - */ -void -ai_core_reset(si_t *sih, uint32 bits, uint32 resetbits) -{ - si_info_t *sii; - aidmp_t *ai; - volatile uint32 dummy; - - sii = SI_INFO(sih); - ASSERT(GOODREGS(sii->curwrap)); - ai = sii->curwrap; - - /* - * Must do the disable sequence first to work for arbitrary current core state. - */ - ai_core_disable(sih, (bits | resetbits)); - - /* - * Now do the initialization sequence. - */ - W_REG(sii->osh, &ai->ioctrl, (bits | SICF_FGC | SICF_CLOCK_EN)); - dummy = R_REG(sii->osh, &ai->ioctrl); - W_REG(sii->osh, &ai->resetctrl, 0); - OSL_DELAY(1); - - W_REG(sii->osh, &ai->ioctrl, (bits | SICF_CLOCK_EN)); - dummy = R_REG(sii->osh, &ai->ioctrl); - OSL_DELAY(1); -} - - -void -ai_core_cflags_wo(si_t *sih, uint32 mask, uint32 val) -{ - si_info_t *sii; - aidmp_t *ai; - uint32 w; - - sii = SI_INFO(sih); - ASSERT(GOODREGS(sii->curwrap)); - ai = sii->curwrap; - - ASSERT((val & ~mask) == 0); - - if (mask || val) { - w = ((R_REG(sii->osh, &ai->ioctrl) & ~mask) | val); - W_REG(sii->osh, &ai->ioctrl, w); - } -} - -uint32 -ai_core_cflags(si_t *sih, uint32 mask, uint32 val) -{ - si_info_t *sii; - aidmp_t *ai; - uint32 w; - - sii = SI_INFO(sih); - ASSERT(GOODREGS(sii->curwrap)); - ai = sii->curwrap; - - ASSERT((val & ~mask) == 0); - - if (mask || val) { - w = ((R_REG(sii->osh, &ai->ioctrl) & ~mask) | val); - W_REG(sii->osh, &ai->ioctrl, w); - } - - return R_REG(sii->osh, &ai->ioctrl); -} - -uint32 -ai_core_sflags(si_t *sih, uint32 mask, uint32 val) -{ - si_info_t *sii; - aidmp_t *ai; - uint32 w; - - sii = SI_INFO(sih); - ASSERT(GOODREGS(sii->curwrap)); - ai = sii->curwrap; - - ASSERT((val & ~mask) == 0); - ASSERT((mask & ~SISF_CORE_BITS) == 0); - - if (mask || val) { - w = ((R_REG(sii->osh, &ai->iostatus) & ~mask) | val); - W_REG(sii->osh, &ai->iostatus, w); - } - - return R_REG(sii->osh, &ai->iostatus); -} diff --git a/drivers/net/wireless/bcm4319/bcmpcispi.c b/drivers/net/wireless/bcm4319/bcmpcispi.c deleted file mode 100644 index 1a8b6717f924..000000000000 --- a/drivers/net/wireless/bcm4319/bcmpcispi.c +++ /dev/null @@ -1,630 +0,0 @@ -/* - * Broadcom SPI over PCI-SPI Host Controller, low-level hardware driver - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmpcispi.c,v 1.22.2.4.4.5.6.1 2010/08/13 00:26:05 Exp $ - */ - -#include -#include - -#include /* SDIO Specs */ -#include /* bcmsdh to/from specific controller APIs */ -#include /* to get msglevel bit values */ - -#include -#include -#include -#include /* BRCM PCI-SPI Host Controller Register definitions */ - - -/* ndis_osl.h needs to do a runtime check of the osh to map - * R_REG/W_REG to bus specific access similar to linux_osl.h. - * Until then... - */ -/* linux */ - -#define SPIPCI_RREG R_REG -#define SPIPCI_WREG W_REG - - -#define SPIPCI_ANDREG(osh, r, v) SPIPCI_WREG(osh, (r), (SPIPCI_RREG(osh, r) & (v))) -#define SPIPCI_ORREG(osh, r, v) SPIPCI_WREG(osh, (r), (SPIPCI_RREG(osh, r) | (v))) - - -int bcmpcispi_dump = 0; /* Set to dump complete trace of all SPI bus transactions */ - -typedef struct spih_info_ { - uint bar0; /* BAR0 of PCI Card */ - uint bar1; /* BAR1 of PCI Card */ - osl_t *osh; /* osh handle */ - spih_pciregs_t *pciregs; /* PCI Core Registers */ - spih_regs_t *regs; /* SPI Controller Registers */ - uint8 rev; /* PCI Card Revision ID */ -} spih_info_t; - - -/* Attach to PCI-SPI Host Controller Hardware */ -bool -spi_hw_attach(sdioh_info_t *sd) -{ - osl_t *osh; - spih_info_t *si; - - sd_trace(("%s: enter\n", __FUNCTION__)); - - osh = sd->osh; - - if ((si = (spih_info_t *)MALLOC(osh, sizeof(spih_info_t))) == NULL) { - sd_err(("%s: out of memory, malloced %d bytes\n", __FUNCTION__, MALLOCED(osh))); - return FALSE; - } - - bzero(si, sizeof(spih_info_t)); - - sd->controller = si; - - si->osh = sd->osh; - si->rev = OSL_PCI_READ_CONFIG(sd->osh, PCI_CFG_REV, 4) & 0xFF; - - if (si->rev < 3) { - sd_err(("Host controller %d not supported, please upgrade to rev >= 3\n", si->rev)); - MFREE(osh, si, sizeof(spih_info_t)); - return (FALSE); - } - - sd_err(("Attaching to Generic PCI SPI Host Controller Rev %d\n", si->rev)); - - /* FPGA Revision < 3 not supported by driver anymore. */ - ASSERT(si->rev >= 3); - - si->bar0 = sd->bar0; - - /* Rev < 10 PciSpiHost has 2 BARs: - * BAR0 = PCI Core Registers - * BAR1 = PciSpiHost Registers (all other cores on backplane) - * - * Rev 10 and up use a different PCI core which only has a single - * BAR0 which contains the PciSpiHost Registers. - */ - if (si->rev < 10) { - si->pciregs = (spih_pciregs_t *)spi_reg_map(osh, - (uintptr)si->bar0, - sizeof(spih_pciregs_t)); - sd_err(("Mapped PCI Core regs to BAR0 at %p\n", si->pciregs)); - - si->bar1 = OSL_PCI_READ_CONFIG(sd->osh, PCI_CFG_BAR1, 4); - si->regs = (spih_regs_t *)spi_reg_map(osh, - (uintptr)si->bar1, - sizeof(spih_regs_t)); - sd_err(("Mapped SPI Controller regs to BAR1 at %p\n", si->regs)); - } else { - si->regs = (spih_regs_t *)spi_reg_map(osh, - (uintptr)si->bar0, - sizeof(spih_regs_t)); - sd_err(("Mapped SPI Controller regs to BAR0 at %p\n", si->regs)); - si->pciregs = NULL; - } - /* Enable SPI Controller, 16.67MHz SPI Clock */ - SPIPCI_WREG(osh, &si->regs->spih_ctrl, 0x000000d1); - - /* Set extended feature register to defaults */ - SPIPCI_WREG(osh, &si->regs->spih_ext, 0x00000000); - - /* Set GPIO CS# High (de-asserted) */ - SPIPCI_WREG(osh, &si->regs->spih_gpio_data, SPIH_CS); - - /* set GPIO[0] to output for CS# */ - /* set GPIO[1] to output for power control */ - /* set GPIO[2] to input for card detect */ - SPIPCI_WREG(osh, &si->regs->spih_gpio_ctrl, (SPIH_CS | SPIH_SLOT_POWER)); - - /* Clear out the Read FIFO in case there is any stuff left in there from a previous run. */ - while ((SPIPCI_RREG(osh, &si->regs->spih_stat) & SPIH_RFEMPTY) == 0) { - SPIPCI_RREG(osh, &si->regs->spih_data); - } - - /* Wait for power to stabilize to the SDIO Card (100msec was insufficient) */ - OSL_DELAY(250000); - - /* Check card detect on FPGA Revision >= 4 */ - if (si->rev >= 4) { - if (SPIPCI_RREG(osh, &si->regs->spih_gpio_data) & SPIH_CARD_DETECT) { - sd_err(("%s: no card detected in SD slot\n", __FUNCTION__)); - spi_reg_unmap(osh, (uintptr)si->regs, sizeof(spih_regs_t)); - if (si->pciregs) { - spi_reg_unmap(osh, (uintptr)si->pciregs, sizeof(spih_pciregs_t)); - } - MFREE(osh, si, sizeof(spih_info_t)); - return FALSE; - } - } - - /* Interrupts are level sensitive */ - SPIPCI_WREG(osh, &si->regs->spih_int_edge, 0x80000000); - - /* Interrupts are active low. */ - SPIPCI_WREG(osh, &si->regs->spih_int_pol, 0x40000004); - - /* Enable interrupts through PCI Core. */ - if (si->pciregs) { - SPIPCI_WREG(osh, &si->pciregs->ICR, PCI_INT_PROP_EN); - } - - sd_trace(("%s: exit\n", __FUNCTION__)); - return TRUE; -} - -/* Detach and return PCI-SPI Hardware to unconfigured state */ -bool -spi_hw_detach(sdioh_info_t *sd) -{ - spih_info_t *si = (spih_info_t *)sd->controller; - osl_t *osh = si->osh; - spih_regs_t *regs = si->regs; - spih_pciregs_t *pciregs = si->pciregs; - - sd_trace(("%s: enter\n", __FUNCTION__)); - - SPIPCI_WREG(osh, ®s->spih_ctrl, 0x00000010); - SPIPCI_WREG(osh, ®s->spih_gpio_ctrl, 0x00000000); /* Disable GPIO for CS# */ - SPIPCI_WREG(osh, ®s->spih_int_mask, 0x00000000); /* Clear Intmask */ - SPIPCI_WREG(osh, ®s->spih_hex_disp, 0x0000DEAF); - SPIPCI_WREG(osh, ®s->spih_int_edge, 0x00000000); - SPIPCI_WREG(osh, ®s->spih_int_pol, 0x00000000); - SPIPCI_WREG(osh, ®s->spih_hex_disp, 0x0000DEAD); - - /* Disable interrupts through PCI Core. */ - if (si->pciregs) { - SPIPCI_WREG(osh, &pciregs->ICR, 0x00000000); - spi_reg_unmap(osh, (uintptr)pciregs, sizeof(spih_pciregs_t)); - } - spi_reg_unmap(osh, (uintptr)regs, sizeof(spih_regs_t)); - - MFREE(osh, si, sizeof(spih_info_t)); - - sd->controller = NULL; - - sd_trace(("%s: exit\n", __FUNCTION__)); - return TRUE; -} - -/* Switch between internal (PCI) and external clock oscillator */ -static bool -sdspi_switch_clock(sdioh_info_t *sd, bool ext_clk) -{ - spih_info_t *si = (spih_info_t *)sd->controller; - osl_t *osh = si->osh; - spih_regs_t *regs = si->regs; - - /* Switch to desired clock, and reset the PLL. */ - SPIPCI_WREG(osh, ®s->spih_pll_ctrl, ext_clk ? SPIH_EXT_CLK : 0); - - SPINWAIT(((SPIPCI_RREG(osh, ®s->spih_pll_status) & SPIH_PLL_LOCKED) - != SPIH_PLL_LOCKED), 1000); - if ((SPIPCI_RREG(osh, ®s->spih_pll_status) & SPIH_PLL_LOCKED) != SPIH_PLL_LOCKED) { - sd_err(("%s: timeout waiting for PLL to lock\n", __FUNCTION__)); - return (FALSE); - } - return (TRUE); - -} - -/* Configure PCI-SPI Host Controller's SPI Clock rate as a divisor into the - * base clock rate. The base clock is either the PCI Clock (33MHz) or the - * external clock oscillator at U17 on the PciSpiHost. - */ -bool -spi_start_clock(sdioh_info_t *sd, uint16 div) -{ - spih_info_t *si = (spih_info_t *)sd->controller; - osl_t *osh = si->osh; - spih_regs_t *regs = si->regs; - uint32 t, espr, disp; - uint32 disp_xtal_freq; - bool ext_clock = FALSE; - char disp_string[5]; - - if (div > 2048) { - sd_err(("%s: divisor %d too large; using max of 2048\n", __FUNCTION__, div)); - div = 2048; - } else if (div & (div - 1)) { /* Not a power of 2? */ - /* Round up to a power of 2 */ - while ((div + 1) & div) - div |= div >> 1; - div++; - } - - /* For FPGA Rev >= 5, the use of an external clock oscillator is supported. - * If the oscillator is populated, use it to provide the SPI base clock, - * otherwise, default to the PCI clock as the SPI base clock. - */ - if (si->rev >= 5) { - uint32 clk_tick; - /* Enable the External Clock Oscillator as PLL clock source. */ - if (!sdspi_switch_clock(sd, TRUE)) { - sd_err(("%s: error switching to external clock\n", __FUNCTION__)); - } - - /* Check to make sure the external clock is running. If not, then it - * is not populated on the card, so we will default to the PCI clock. - */ - clk_tick = SPIPCI_RREG(osh, ®s->spih_clk_count); - if (clk_tick == SPIPCI_RREG(osh, ®s->spih_clk_count)) { - - /* Switch back to the PCI clock as the clock source. */ - if (!sdspi_switch_clock(sd, FALSE)) { - sd_err(("%s: error switching to external clock\n", __FUNCTION__)); - } - } else { - ext_clock = TRUE; - } - } - - /* Hack to allow hot-swapping oscillators: - * 1. Force PCI clock as clock source, using sd_divisor of 0. - * 2. Swap oscillator - * 3. Set desired sd_divisor (will switch to external oscillator as clock source. - */ - if (div == 0) { - ext_clock = FALSE; - div = 2; - - /* Select PCI clock as the clock source. */ - if (!sdspi_switch_clock(sd, FALSE)) { - sd_err(("%s: error switching to external clock\n", __FUNCTION__)); - } - - sd_err(("%s: Ok to hot-swap oscillators.\n", __FUNCTION__)); - } - - /* If using the external oscillator, read the clock frequency from the controller - * The value read is in units of 10000Hz, and it's not a nice round number because - * it is calculated by the FPGA. So to make up for that, we round it off. - */ - if (ext_clock == TRUE) { - uint32 xtal_freq; - - OSL_DELAY(1000); - xtal_freq = SPIPCI_RREG(osh, ®s->spih_xtal_freq) * 10000; - - sd_info(("%s: Oscillator is %dHz\n", __FUNCTION__, xtal_freq)); - - - disp_xtal_freq = xtal_freq / 10000; - - /* Round it off to a nice number. */ - if ((disp_xtal_freq % 100) > 50) { - disp_xtal_freq += 100; - } - - disp_xtal_freq = (disp_xtal_freq / 100) * 100; - } else { - sd_err(("%s: no external oscillator installed, using PCI clock.\n", __FUNCTION__)); - disp_xtal_freq = 3333; - } - - /* Convert the SPI Clock frequency to BCD format. */ - sprintf(disp_string, "%04d", disp_xtal_freq / div); - - disp = (disp_string[0] - '0') << 12; - disp |= (disp_string[1] - '0') << 8; - disp |= (disp_string[2] - '0') << 4; - disp |= (disp_string[3] - '0'); - - /* Select the correct ESPR register value based on the divisor. */ - switch (div) { - case 1: espr = 0x0; break; - case 2: espr = 0x1; break; - case 4: espr = 0x2; break; - case 8: espr = 0x5; break; - case 16: espr = 0x3; break; - case 32: espr = 0x4; break; - case 64: espr = 0x6; break; - case 128: espr = 0x7; break; - case 256: espr = 0x8; break; - case 512: espr = 0x9; break; - case 1024: espr = 0xa; break; - case 2048: espr = 0xb; break; - default: espr = 0x0; ASSERT(0); break; - } - - t = SPIPCI_RREG(osh, ®s->spih_ctrl); - t &= ~3; - t |= espr & 3; - SPIPCI_WREG(osh, ®s->spih_ctrl, t); - - t = SPIPCI_RREG(osh, ®s->spih_ext); - t &= ~3; - t |= (espr >> 2) & 3; - SPIPCI_WREG(osh, ®s->spih_ext, t); - - SPIPCI_WREG(osh, ®s->spih_hex_disp, disp); - - /* For Rev 8, writing to the PLL_CTRL register resets - * the PLL, and it can re-acquire in 200uS. For - * Rev 7 and older, we use a software delay to allow - * the PLL to re-acquire, which takes more than 2mS. - */ - if (si->rev < 8) { - /* Wait for clock to settle. */ - OSL_DELAY(5000); - } - - sd_info(("%s: SPI_CTRL=0x%08x SPI_EXT=0x%08x\n", - __FUNCTION__, - SPIPCI_RREG(osh, ®s->spih_ctrl), - SPIPCI_RREG(osh, ®s->spih_ext))); - - return TRUE; -} - -/* Configure PCI-SPI Host Controller High-Speed Clocking mode setting */ -bool -spi_controller_highspeed_mode(sdioh_info_t *sd, bool hsmode) -{ - spih_info_t *si = (spih_info_t *)sd->controller; - osl_t *osh = si->osh; - spih_regs_t *regs = si->regs; - - if (si->rev >= 10) { - if (hsmode) { - SPIPCI_ORREG(osh, ®s->spih_ext, 0x10); - } else { - SPIPCI_ANDREG(osh, ®s->spih_ext, ~0x10); - } - } - - return TRUE; -} - -/* Disable device interrupt */ -void -spi_devintr_off(sdioh_info_t *sd) -{ - spih_info_t *si = (spih_info_t *)sd->controller; - osl_t *osh = si->osh; - spih_regs_t *regs = si->regs; - - sd_trace(("%s: %d\n", __FUNCTION__, sd->use_client_ints)); - if (sd->use_client_ints) { - sd->intmask &= ~SPIH_DEV_INTR; - SPIPCI_WREG(osh, ®s->spih_int_mask, sd->intmask); /* Clear Intmask */ - } -} - -/* Enable device interrupt */ -void -spi_devintr_on(sdioh_info_t *sd) -{ - spih_info_t *si = (spih_info_t *)sd->controller; - osl_t *osh = si->osh; - spih_regs_t *regs = si->regs; - - ASSERT(sd->lockcount == 0); - sd_trace(("%s: %d\n", __FUNCTION__, sd->use_client_ints)); - if (sd->use_client_ints) { - if (SPIPCI_RREG(osh, ®s->spih_ctrl) & 0x02) { - /* Ack in case one was pending but is no longer... */ - SPIPCI_WREG(osh, ®s->spih_int_status, SPIH_DEV_INTR); - } - sd->intmask |= SPIH_DEV_INTR; - /* Set device intr in Intmask */ - SPIPCI_WREG(osh, ®s->spih_int_mask, sd->intmask); - } -} - -/* Check to see if an interrupt belongs to the PCI-SPI Host or a SPI Device */ -bool -spi_check_client_intr(sdioh_info_t *sd, int *is_dev_intr) -{ - spih_info_t *si = (spih_info_t *)sd->controller; - osl_t *osh = si->osh; - spih_regs_t *regs = si->regs; - bool ours = FALSE; - - uint32 raw_int, cur_int; - ASSERT(sd); - - if (is_dev_intr) - *is_dev_intr = FALSE; - raw_int = SPIPCI_RREG(osh, ®s->spih_int_status); - cur_int = raw_int & sd->intmask; - if (cur_int & SPIH_DEV_INTR) { - if (sd->client_intr_enabled && sd->use_client_ints) { - sd->intrcount++; - ASSERT(sd->intr_handler); - ASSERT(sd->intr_handler_arg); - (sd->intr_handler)(sd->intr_handler_arg); - if (is_dev_intr) - *is_dev_intr = TRUE; - } else { - sd_trace(("%s: Not ready for intr: enabled %d, handler 0x%p\n", - __FUNCTION__, sd->client_intr_enabled, sd->intr_handler)); - } - SPIPCI_WREG(osh, ®s->spih_int_status, SPIH_DEV_INTR); - SPIPCI_RREG(osh, ®s->spih_int_status); - ours = TRUE; - } else if (cur_int & SPIH_CTLR_INTR) { - /* Interrupt is from SPI FIFO... just clear and ack it... */ - sd_trace(("%s: SPI CTLR interrupt: raw_int 0x%08x cur_int 0x%08x\n", - __FUNCTION__, raw_int, cur_int)); - - /* Clear the interrupt in the SPI_STAT register */ - SPIPCI_WREG(osh, ®s->spih_stat, 0x00000080); - - /* Ack the interrupt in the interrupt controller */ - SPIPCI_WREG(osh, ®s->spih_int_status, SPIH_CTLR_INTR); - SPIPCI_RREG(osh, ®s->spih_int_status); - - ours = TRUE; - } else if (cur_int & SPIH_WFIFO_INTR) { - sd_trace(("%s: SPI WR FIFO Empty interrupt: raw_int 0x%08x cur_int 0x%08x\n", - __FUNCTION__, raw_int, cur_int)); - - /* Disable the FIFO Empty Interrupt */ - sd->intmask &= ~SPIH_WFIFO_INTR; - SPIPCI_WREG(osh, ®s->spih_int_mask, sd->intmask); - - sd->local_intrcount++; - sd->got_hcint = TRUE; - ours = TRUE; - } else { - /* Not an error: can share interrupts... */ - sd_trace(("%s: Not my interrupt: raw_int 0x%08x cur_int 0x%08x\n", - __FUNCTION__, raw_int, cur_int)); - ours = FALSE; - } - - return ours; -} - -static void -hexdump(char *pfx, unsigned char *msg, int msglen) -{ - int i, col; - char buf[80]; - - ASSERT(strlen(pfx) + 49 <= sizeof(buf)); - - col = 0; - - for (i = 0; i < msglen; i++, col++) { - if (col % 16 == 0) - strcpy(buf, pfx); - sprintf(buf + strlen(buf), "%02x", msg[i]); - if ((col + 1) % 16 == 0) - printf("%s\n", buf); - else - sprintf(buf + strlen(buf), " "); - } - - if (col % 16 != 0) - printf("%s\n", buf); -} - -/* Send/Receive an SPI Packet */ -void -spi_sendrecv(sdioh_info_t *sd, uint8 *msg_out, uint8 *msg_in, int msglen) -{ - spih_info_t *si = (spih_info_t *)sd->controller; - osl_t *osh = si->osh; - spih_regs_t *regs = si->regs; - uint32 count; - uint32 spi_data_out; - uint32 spi_data_in; - bool yield; - - sd_trace(("%s: enter\n", __FUNCTION__)); - - if (bcmpcispi_dump) { - printf("SENDRECV(len=%d)\n", msglen); - hexdump(" OUT: ", msg_out, msglen); - } - -#ifdef BCMSDYIELD - /* Only yield the CPU and wait for interrupt on Rev 8 and newer FPGA images. */ - yield = ((msglen > 500) && (si->rev >= 8)); -#else - yield = FALSE; -#endif /* BCMSDYIELD */ - - ASSERT(msglen % 4 == 0); - - - SPIPCI_ANDREG(osh, ®s->spih_gpio_data, ~SPIH_CS); /* Set GPIO CS# Low (asserted) */ - - for (count = 0; count < (uint32)msglen/4; count++) { - spi_data_out = ((uint32)((uint32 *)msg_out)[count]); - SPIPCI_WREG(osh, ®s->spih_data, spi_data_out); - } - -#ifdef BCMSDYIELD - if (yield) { - /* Ack the interrupt in the interrupt controller */ - SPIPCI_WREG(osh, ®s->spih_int_status, SPIH_WFIFO_INTR); - SPIPCI_RREG(osh, ®s->spih_int_status); - - /* Enable the FIFO Empty Interrupt */ - sd->intmask |= SPIH_WFIFO_INTR; - sd->got_hcint = FALSE; - SPIPCI_WREG(osh, ®s->spih_int_mask, sd->intmask); - - } -#endif /* BCMSDYIELD */ - - /* Wait for write fifo to empty... */ - SPIPCI_ANDREG(osh, ®s->spih_gpio_data, ~0x00000020); /* Set GPIO 5 Low */ - - if (yield) { - ASSERT((SPIPCI_RREG(sd->osh, ®s->spih_stat) & SPIH_WFEMPTY) == 0); - } - - spi_waitbits(sd, yield); - SPIPCI_ORREG(osh, ®s->spih_gpio_data, 0x00000020); /* Set GPIO 5 High (de-asserted) */ - - for (count = 0; count < (uint32)msglen/4; count++) { - spi_data_in = SPIPCI_RREG(osh, ®s->spih_data); - ((uint32 *)msg_in)[count] = spi_data_in; - } - - /* Set GPIO CS# High (de-asserted) */ - SPIPCI_ORREG(osh, ®s->spih_gpio_data, SPIH_CS); - - if (bcmpcispi_dump) { - hexdump(" IN : ", msg_in, msglen); - } -} - -void -spi_spinbits(sdioh_info_t *sd) -{ - spih_info_t *si = (spih_info_t *)sd->controller; - osl_t *osh = si->osh; - spih_regs_t *regs = si->regs; - uint spin_count; /* Spin loop bound check */ - - spin_count = 0; - while ((SPIPCI_RREG(sd->osh, ®s->spih_stat) & SPIH_WFEMPTY) == 0) { - if (spin_count > SPI_SPIN_BOUND) { - sd_err(("%s: SPIH_WFEMPTY spin bits out of bound %u times \n", - __FUNCTION__, spin_count)); - ASSERT(FALSE); - } - spin_count++; - } - - /* Wait for SPI Transfer state machine to return to IDLE state. - * The state bits are only implemented in Rev >= 5 FPGA. These - * bits are hardwired to 00 for Rev < 5, so this check doesn't cause - * any problems. - */ - spin_count = 0; - while ((SPIPCI_RREG(osh, ®s->spih_stat) & SPIH_STATE_MASK) != 0) { - if (spin_count > SPI_SPIN_BOUND) { - sd_err(("%s: SPIH_STATE_MASK spin bits out of bound %u times \n", - __FUNCTION__, spin_count)); - ASSERT(FALSE); - } - spin_count++; - } -} diff --git a/drivers/net/wireless/bcm4319/bcmsdh.c b/drivers/net/wireless/bcm4319/bcmsdh.c deleted file mode 100644 index 4bf5889e5a68..000000000000 --- a/drivers/net/wireless/bcm4319/bcmsdh.c +++ /dev/null @@ -1,652 +0,0 @@ -/* - * BCMSDH interface glue - * implement bcmsdh API for SDIOH driver - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmsdh.c,v 1.35.2.1.4.8.6.13 2010/04/06 03:26:57 Exp $ - */ -/* ****************** BCMSDH Interface Functions *************************** */ - -#include -#include -#include -#include -#include -#include -#include - -#include /* BRCM API for SDIO clients (such as wl, dhd) */ -#include /* common SDIO/controller interface */ -#include /* BRCM sdio device core */ - -#include /* sdio spec */ - -#define SDIOH_API_ACCESS_RETRY_LIMIT 2 -const uint bcmsdh_msglevel = BCMSDH_ERROR_VAL; - - -struct bcmsdh_info -{ - bool init_success; /* underlying driver successfully attached */ - void *sdioh; /* handler for sdioh */ - uint32 vendevid; /* Target Vendor and Device ID on SD bus */ - osl_t *osh; - bool regfail; /* Save status of last reg_read/reg_write call */ - uint32 sbwad; /* Save backplane window address */ -}; -/* local copy of bcm sd handler */ -bcmsdh_info_t * l_bcmsdh = NULL; - -#if defined(OOB_INTR_ONLY) && defined(HW_OOB) -extern int -sdioh_enable_hw_oob_intr(void *sdioh, bool enable); - -void -bcmsdh_enable_hw_oob_intr(bcmsdh_info_t *sdh, bool enable) -{ - sdioh_enable_hw_oob_intr(sdh->sdioh, enable); -} -#endif - -bcmsdh_info_t * -bcmsdh_attach(osl_t *osh, void *cfghdl, void **regsva, uint irq) -{ - bcmsdh_info_t *bcmsdh; - - if ((bcmsdh = (bcmsdh_info_t *)MALLOC(osh, sizeof(bcmsdh_info_t))) == NULL) { - BCMSDH_ERROR(("bcmsdh_attach: out of memory, malloced %d bytes\n", MALLOCED(osh))); - return NULL; - } - bzero((char *)bcmsdh, sizeof(bcmsdh_info_t)); - - /* save the handler locally */ - l_bcmsdh = bcmsdh; - - if (!(bcmsdh->sdioh = sdioh_attach(osh, cfghdl, irq))) { - bcmsdh_detach(osh, bcmsdh); - return NULL; - } - - bcmsdh->osh = osh; - bcmsdh->init_success = TRUE; - - *regsva = (uint32 *)SI_ENUM_BASE; - - /* Report the BAR, to fix if needed */ - bcmsdh->sbwad = SI_ENUM_BASE; - return bcmsdh; -} - -int -bcmsdh_detach(osl_t *osh, void *sdh) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - - if (bcmsdh != NULL) { - if (bcmsdh->sdioh) { - sdioh_detach(osh, bcmsdh->sdioh); - bcmsdh->sdioh = NULL; - } - MFREE(osh, bcmsdh, sizeof(bcmsdh_info_t)); - } - - l_bcmsdh = NULL; - return 0; -} - -int -bcmsdh_iovar_op(void *sdh, const char *name, - void *params, int plen, void *arg, int len, bool set) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - return sdioh_iovar_op(bcmsdh->sdioh, name, params, plen, arg, len, set); -} - -bool -bcmsdh_intr_query(void *sdh) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; - bool on; - - ASSERT(bcmsdh); - status = sdioh_interrupt_query(bcmsdh->sdioh, &on); - if (SDIOH_API_SUCCESS(status)) - return FALSE; - else - return on; -} - -int -bcmsdh_intr_enable(void *sdh) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; - ASSERT(bcmsdh); - - status = sdioh_interrupt_set(bcmsdh->sdioh, TRUE); - return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR); -} - -int -bcmsdh_intr_disable(void *sdh) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; - ASSERT(bcmsdh); - - status = sdioh_interrupt_set(bcmsdh->sdioh, FALSE); - return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR); -} - -int -bcmsdh_intr_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; - ASSERT(bcmsdh); - - status = sdioh_interrupt_register(bcmsdh->sdioh, fn, argh); - return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR); -} - -int -bcmsdh_intr_dereg(void *sdh) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; - ASSERT(bcmsdh); - - status = sdioh_interrupt_deregister(bcmsdh->sdioh); - return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR); -} - -#if defined(DHD_DEBUG) -bool -bcmsdh_intr_pending(void *sdh) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - - ASSERT(sdh); - return sdioh_interrupt_pending(bcmsdh->sdioh); -} -#endif - - -int -bcmsdh_devremove_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh) -{ - ASSERT(sdh); - - /* don't support yet */ - return BCME_UNSUPPORTED; -} - -uint8 -bcmsdh_cfg_read(void *sdh, uint fnc_num, uint32 addr, int *err) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; -#ifdef SDIOH_API_ACCESS_RETRY_LIMIT - int32 retry = 0; -#endif - uint8 data = 0; - - if (!bcmsdh) - bcmsdh = l_bcmsdh; - - ASSERT(bcmsdh->init_success); - -#ifdef SDIOH_API_ACCESS_RETRY_LIMIT - do { - if (retry) /* wait for 1 ms till bus get settled down */ - OSL_DELAY(1000); -#endif - status = sdioh_cfg_read(bcmsdh->sdioh, fnc_num, addr, (uint8 *)&data); -#ifdef SDIOH_API_ACCESS_RETRY_LIMIT - } while (!SDIOH_API_SUCCESS(status) && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT)); -#endif - if (err) - *err = (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR); - - BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, uint8data = 0x%x\n", __FUNCTION__, - fnc_num, addr, data)); - - return data; -} - -void -bcmsdh_cfg_write(void *sdh, uint fnc_num, uint32 addr, uint8 data, int *err) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; -#ifdef SDIOH_API_ACCESS_RETRY_LIMIT - int32 retry = 0; -#endif - - if (!bcmsdh) - bcmsdh = l_bcmsdh; - - ASSERT(bcmsdh->init_success); - -#ifdef SDIOH_API_ACCESS_RETRY_LIMIT - do { - if (retry) /* wait for 1 ms till bus get settled down */ - OSL_DELAY(1000); -#endif - status = sdioh_cfg_write(bcmsdh->sdioh, fnc_num, addr, (uint8 *)&data); -#ifdef SDIOH_API_ACCESS_RETRY_LIMIT - } while (!SDIOH_API_SUCCESS(status) && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT)); -#endif - if (err) - *err = SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR; - - BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, uint8data = 0x%x\n", __FUNCTION__, - fnc_num, addr, data)); -} - -uint32 -bcmsdh_cfg_read_word(void *sdh, uint fnc_num, uint32 addr, int *err) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; - uint32 data = 0; - - if (!bcmsdh) - bcmsdh = l_bcmsdh; - - ASSERT(bcmsdh->init_success); - - status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, SDIOH_READ, fnc_num, - addr, &data, 4); - - if (err) - *err = (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR); - - BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, uint32data = 0x%x\n", __FUNCTION__, - fnc_num, addr, data)); - - return data; -} - -void -bcmsdh_cfg_write_word(void *sdh, uint fnc_num, uint32 addr, uint32 data, int *err) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; - - if (!bcmsdh) - bcmsdh = l_bcmsdh; - - ASSERT(bcmsdh->init_success); - - status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, SDIOH_WRITE, fnc_num, - addr, &data, 4); - - if (err) - *err = (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR); - - BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, uint32data = 0x%x\n", __FUNCTION__, fnc_num, - addr, data)); -} - - -int -bcmsdh_cis_read(void *sdh, uint func, uint8 *cis, uint length) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; - - uint8 *tmp_buf, *tmp_ptr; - uint8 *ptr; - bool ascii = func & ~0xf; - func &= 0x7; - - if (!bcmsdh) - bcmsdh = l_bcmsdh; - - ASSERT(bcmsdh->init_success); - ASSERT(cis); - ASSERT(length <= SBSDIO_CIS_SIZE_LIMIT); - - status = sdioh_cis_read(bcmsdh->sdioh, func, cis, length); - - if (ascii) { - /* Move binary bits to tmp and format them into the provided buffer. */ - if ((tmp_buf = (uint8 *)MALLOC(bcmsdh->osh, length)) == NULL) { - BCMSDH_ERROR(("%s: out of memory\n", __FUNCTION__)); - return BCME_NOMEM; - } - bcopy(cis, tmp_buf, length); - for (tmp_ptr = tmp_buf, ptr = cis; ptr < (cis + length - 4); tmp_ptr++) { - ptr += sprintf((char*)ptr, "%.2x ", *tmp_ptr & 0xff); - if ((((tmp_ptr - tmp_buf) + 1) & 0xf) == 0) - ptr += sprintf((char *)ptr, "\n"); - } - MFREE(bcmsdh->osh, tmp_buf, length); - } - - return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR); -} - - -static int -bcmsdhsdio_set_sbaddr_window(void *sdh, uint32 address) -{ - int err = 0; - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW, - (address >> 8) & SBSDIO_SBADDRLOW_MASK, &err); - if (!err) - bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRMID, - (address >> 16) & SBSDIO_SBADDRMID_MASK, &err); - if (!err) - bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRHIGH, - (address >> 24) & SBSDIO_SBADDRHIGH_MASK, &err); - - - return err; -} - -uint32 -bcmsdh_reg_read(void *sdh, uint32 addr, uint size) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; - uint32 word = 0; - uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK; - - BCMSDH_INFO(("%s:fun = 1, addr = 0x%x, ", __FUNCTION__, addr)); - - if (!bcmsdh) - bcmsdh = l_bcmsdh; - - ASSERT(bcmsdh->init_success); - - if (bar0 != bcmsdh->sbwad) { - if (bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0)) - return 0xFFFFFFFF; - - bcmsdh->sbwad = bar0; - } - - addr &= SBSDIO_SB_OFT_ADDR_MASK; - if (size == 4) - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, - SDIOH_READ, SDIO_FUNC_1, addr, &word, size); - - bcmsdh->regfail = !(SDIOH_API_SUCCESS(status)); - - BCMSDH_INFO(("uint32data = 0x%x\n", word)); - - /* if ok, return appropriately masked word */ - if (SDIOH_API_SUCCESS(status)) { - switch (size) { - case sizeof(uint8): - return (word & 0xff); - case sizeof(uint16): - return (word & 0xffff); - case sizeof(uint32): - return word; - default: - bcmsdh->regfail = TRUE; - - } - } - - /* otherwise, bad sdio access or invalid size */ - BCMSDH_ERROR(("%s: error reading addr 0x%04x size %d\n", __FUNCTION__, addr, size)); - return 0xFFFFFFFF; -} - -uint32 -bcmsdh_reg_write(void *sdh, uint32 addr, uint size, uint32 data) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; - uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK; - int err = 0; - - BCMSDH_INFO(("%s:fun = 1, addr = 0x%x, uint%ddata = 0x%x\n", - __FUNCTION__, addr, size*8, data)); - - if (!bcmsdh) - bcmsdh = l_bcmsdh; - - ASSERT(bcmsdh->init_success); - - if (bar0 != bcmsdh->sbwad) { - if ((err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0))) - return err; - - bcmsdh->sbwad = bar0; - } - - addr &= SBSDIO_SB_OFT_ADDR_MASK; - if (size == 4) - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, SDIOH_WRITE, SDIO_FUNC_1, - addr, &data, size); - bcmsdh->regfail = !(SDIOH_API_SUCCESS(status)); - - if (SDIOH_API_SUCCESS(status)) - return 0; - - BCMSDH_ERROR(("%s: error writing 0x%08x to addr 0x%04x size %d\n", - __FUNCTION__, data, addr, size)); - return 0xFFFFFFFF; -} - -bool -bcmsdh_regfail(void *sdh) -{ - return ((bcmsdh_info_t *)sdh)->regfail; -} - -int -bcmsdh_recv_buf(void *sdh, uint32 addr, uint fn, uint flags, - uint8 *buf, uint nbytes, void *pkt, - bcmsdh_cmplt_fn_t complete, void *handle) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; - uint incr_fix; - uint width; - uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK; - int err = 0; - - ASSERT(bcmsdh); - ASSERT(bcmsdh->init_success); - - BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n", - __FUNCTION__, fn, addr, nbytes)); - - /* Async not implemented yet */ - ASSERT(!(flags & SDIO_REQ_ASYNC)); - if (flags & SDIO_REQ_ASYNC) - return BCME_UNSUPPORTED; - - if (bar0 != bcmsdh->sbwad) { - if ((err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0))) - return err; - - bcmsdh->sbwad = bar0; - } - - addr &= SBSDIO_SB_OFT_ADDR_MASK; - - incr_fix = (flags & SDIO_REQ_FIXED) ? SDIOH_DATA_FIX : SDIOH_DATA_INC; - width = (flags & SDIO_REQ_4BYTE) ? 4 : 2; - if (width == 4) - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, incr_fix, - SDIOH_READ, fn, addr, width, nbytes, buf, pkt); - - return (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR); -} - -int -bcmsdh_send_buf(void *sdh, uint32 addr, uint fn, uint flags, - uint8 *buf, uint nbytes, void *pkt, - bcmsdh_cmplt_fn_t complete, void *handle) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; - uint incr_fix; - uint width; - uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK; - int err = 0; - - ASSERT(bcmsdh); - ASSERT(bcmsdh->init_success); - - BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n", - __FUNCTION__, fn, addr, nbytes)); - - /* Async not implemented yet */ - ASSERT(!(flags & SDIO_REQ_ASYNC)); - if (flags & SDIO_REQ_ASYNC) - return BCME_UNSUPPORTED; - - if (bar0 != bcmsdh->sbwad) { - if ((err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0))) - return err; - - bcmsdh->sbwad = bar0; - } - - addr &= SBSDIO_SB_OFT_ADDR_MASK; - - incr_fix = (flags & SDIO_REQ_FIXED) ? SDIOH_DATA_FIX : SDIOH_DATA_INC; - width = (flags & SDIO_REQ_4BYTE) ? 4 : 2; - if (width == 4) - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, incr_fix, - SDIOH_WRITE, fn, addr, width, nbytes, buf, pkt); - - return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR); -} - -int -bcmsdh_rwdata(void *sdh, uint rw, uint32 addr, uint8 *buf, uint nbytes) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - SDIOH_API_RC status; - - ASSERT(bcmsdh); - ASSERT(bcmsdh->init_success); - ASSERT((addr & SBSDIO_SBWINDOW_MASK) == 0); - - addr &= SBSDIO_SB_OFT_ADDR_MASK; - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, SDIOH_DATA_INC, - (rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1, - addr, 4, nbytes, buf, NULL); - - return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR); -} - -int -bcmsdh_abort(void *sdh, uint fn) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - - return sdioh_abort(bcmsdh->sdioh, fn); -} - -int -bcmsdh_start(void *sdh, int stage) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - - return sdioh_start(bcmsdh->sdioh, stage); -} - -int -bcmsdh_stop(void *sdh) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - - return sdioh_stop(bcmsdh->sdioh); -} - - -int -bcmsdh_query_device(void *sdh) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - bcmsdh->vendevid = (VENDOR_BROADCOM << 16) | 0; - return (bcmsdh->vendevid); -} - -uint -bcmsdh_query_iofnum(void *sdh) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - - if (!bcmsdh) - bcmsdh = l_bcmsdh; - - return (sdioh_query_iofnum(bcmsdh->sdioh)); -} - -int -bcmsdh_reset(bcmsdh_info_t *sdh) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - - return sdioh_sdio_reset(bcmsdh->sdioh); -} - -void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh) -{ - ASSERT(sdh); - return sdh->sdioh; -} - -/* Function to pass device-status bits to DHD. */ -uint32 -bcmsdh_get_dstatus(void *sdh) -{ - return 0; -} -uint32 -bcmsdh_cur_sbwad(void *sdh) -{ - bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh; - - if (!bcmsdh) - bcmsdh = l_bcmsdh; - - return (bcmsdh->sbwad); -} - -void -bcmsdh_chipinfo(void *sdh, uint32 chip, uint32 chiprev) -{ - return; -} diff --git a/drivers/net/wireless/bcm4319/bcmsdh_linux.c b/drivers/net/wireless/bcm4319/bcmsdh_linux.c deleted file mode 100644 index cdb2c5e1f1ec..000000000000 --- a/drivers/net/wireless/bcm4319/bcmsdh_linux.c +++ /dev/null @@ -1,733 +0,0 @@ -/* - * SDIO access interface for drivers - linux specific (pci only) - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmsdh_linux.c,v 1.42.10.10.2.14.4.2 2010/09/15 00:30:11 Exp $ - */ - -/** - * @file bcmsdh_linux.c - */ - -#define __UNDEF_NO_VERSION__ - -#include -#include - -#include -#include - -#include -#include -#include -#include - -#if defined(OOB_INTR_ONLY) -#include -extern void dhdsdio_isr(void * args); -#include -#include -#include -#endif /* defined(OOB_INTR_ONLY) */ -#if defined(CONFIG_MACH_SANDGATE2G) || defined(CONFIG_MACH_LOGICPD_PXA270) -#if !defined(BCMPLATFORM_BUS) -#define BCMPLATFORM_BUS -#endif /* !defined(BCMPLATFORM_BUS) */ - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) -#include -#endif /* KERNEL_VERSION(2, 6, 19) */ -#endif /* CONFIG_MACH_SANDGATE2G || CONFIG_MACH_LOGICPD_PXA270 */ - -/** - * SDIO Host Controller info - */ -typedef struct bcmsdh_hc bcmsdh_hc_t; - -struct bcmsdh_hc { - bcmsdh_hc_t *next; -#ifdef BCMPLATFORM_BUS - struct device *dev; /* platform device handle */ -#else - struct pci_dev *dev; /* pci device handle */ -#endif /* BCMPLATFORM_BUS */ - osl_t *osh; - void *regs; /* SDIO Host Controller address */ - bcmsdh_info_t *sdh; /* SDIO Host Controller handle */ - void *ch; - unsigned int oob_irq; - unsigned long oob_flags; /* OOB Host specifiction as edge and etc */ - bool oob_irq_registered; -#if defined(OOB_INTR_ONLY) - spinlock_t irq_lock; -#endif -}; -static bcmsdh_hc_t *sdhcinfo = NULL; - -/* driver info, initialized when bcmsdh_register is called */ -static bcmsdh_driver_t drvinfo = {NULL, NULL}; - -/* debugging macros */ -#define SDLX_MSG(x) - -/** - * Checks to see if vendor and device IDs match a supported SDIO Host Controller. - */ -bool -bcmsdh_chipmatch(uint16 vendor, uint16 device) -{ - /* Add other vendors and devices as required */ - -#ifdef BCMSDIOH_STD - /* Check for Arasan host controller */ - if (vendor == VENDOR_SI_IMAGE) { - return (TRUE); - } - /* Check for BRCM 27XX Standard host controller */ - if (device == BCM27XX_SDIOH_ID && vendor == VENDOR_BROADCOM) { - return (TRUE); - } - /* Check for BRCM Standard host controller */ - if (device == SDIOH_FPGA_ID && vendor == VENDOR_BROADCOM) { - return (TRUE); - } - /* Check for TI PCIxx21 Standard host controller */ - if (device == PCIXX21_SDIOH_ID && vendor == VENDOR_TI) { - return (TRUE); - } - if (device == PCIXX21_SDIOH0_ID && vendor == VENDOR_TI) { - return (TRUE); - } - /* Ricoh R5C822 Standard SDIO Host */ - if (device == R5C822_SDIOH_ID && vendor == VENDOR_RICOH) { - return (TRUE); - } - /* JMicron Standard SDIO Host */ - if (device == JMICRON_SDIOH_ID && vendor == VENDOR_JMICRON) { - return (TRUE); - } - -#endif /* BCMSDIOH_STD */ -#ifdef BCMSDIOH_SPI - /* This is the PciSpiHost. */ - if (device == SPIH_FPGA_ID && vendor == VENDOR_BROADCOM) { - printf("Found PCI SPI Host Controller\n"); - return (TRUE); - } - -#endif /* BCMSDIOH_SPI */ - - return (FALSE); -} - -#if defined(BCMPLATFORM_BUS) -#if defined(BCMLXSDMMC) -/* forward declarations */ -int bcmsdh_probe(struct device *dev); -int bcmsdh_remove(struct device *dev); - -EXPORT_SYMBOL(bcmsdh_probe); -EXPORT_SYMBOL(bcmsdh_remove); - -#else -/* forward declarations */ -static int __devinit bcmsdh_probe(struct device *dev); -static int __devexit bcmsdh_remove(struct device *dev); -#endif /* BCMLXSDMMC */ - -#ifndef BCMLXSDMMC -static struct device_driver bcmsdh_driver = { - .name = "pxa2xx-mci", - .bus = &platform_bus_type, - .probe = bcmsdh_probe, - .remove = bcmsdh_remove, - .suspend = NULL, - .resume = NULL, - }; -#endif /* BCMLXSDMMC */ - -#ifndef BCMLXSDMMC -static -#endif /* BCMLXSDMMC */ -int bcmsdh_probe(struct device *dev) -{ - osl_t *osh = NULL; - bcmsdh_hc_t *sdhc = NULL; - ulong regs = 0; - bcmsdh_info_t *sdh = NULL; -#if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS) - struct platform_device *pdev; - struct resource *r; -#endif /* BCMLXSDMMC */ - int irq = 0; - uint32 vendevid; - unsigned long irq_flags = 0; - -#if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS) - pdev = to_platform_device(dev); - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - irq = platform_get_irq(pdev, 0); - if (!r || irq == NO_IRQ) - return -ENXIO; -#endif /* BCMLXSDMMC */ - -#if defined(OOB_INTR_ONLY) -#ifdef HW_OOB - irq_flags = \ - IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL | IORESOURCE_IRQ_SHAREABLE; -#else - irq_flags = IRQF_TRIGGER_FALLING; -#endif /* HW_OOB */ - irq = dhd_customer_oob_irq_map(&irq_flags); - if (irq < 0) { - SDLX_MSG(("%s: Host irq is not defined\n", __FUNCTION__)); - return 1; - } -#endif /* defined(OOB_INTR_ONLY) */ - /* allocate SDIO Host Controller state info */ - if (!(osh = osl_attach(dev, PCI_BUS, FALSE))) { - SDLX_MSG(("%s: osl_attach failed\n", __FUNCTION__)); - goto err; - } - if (!(sdhc = MALLOC(osh, sizeof(bcmsdh_hc_t)))) { - SDLX_MSG(("%s: out of memory, allocated %d bytes\n", - __FUNCTION__, - MALLOCED(osh))); - goto err; - } - bzero(sdhc, sizeof(bcmsdh_hc_t)); - sdhc->osh = osh; - - sdhc->dev = (void *)dev; - -#ifdef BCMLXSDMMC - if (!(sdh = bcmsdh_attach(osh, (void *)0, - (void **)®s, irq))) { - SDLX_MSG(("%s: bcmsdh_attach failed\n", __FUNCTION__)); - goto err; - } -#else - if (!(sdh = bcmsdh_attach(osh, (void *)r->start, - (void **)®s, irq))) { - SDLX_MSG(("%s: bcmsdh_attach failed\n", __FUNCTION__)); - goto err; - } -#endif /* BCMLXSDMMC */ - sdhc->sdh = sdh; - sdhc->oob_irq = irq; - sdhc->oob_flags = irq_flags; - sdhc->oob_irq_registered = FALSE; /* to make sure.. */ -#if defined(OOB_INTR_ONLY) - spin_lock_init(&sdhc->irq_lock); -#endif - - /* chain SDIO Host Controller info together */ - sdhc->next = sdhcinfo; - sdhcinfo = sdhc; - /* Read the vendor/device ID from the CIS */ - vendevid = bcmsdh_query_device(sdh); - - /* try to attach to the target device */ - if (!(sdhc->ch = drvinfo.attach((vendevid >> 16), - (vendevid & 0xFFFF), 0, 0, 0, 0, - (void *)regs, NULL, sdh))) { - SDLX_MSG(("%s: device attach failed\n", __FUNCTION__)); - goto err; - } - - return 0; - - /* error handling */ -err: - if (sdhc) { - if (sdhc->sdh) - bcmsdh_detach(sdhc->osh, sdhc->sdh); - MFREE(osh, sdhc, sizeof(bcmsdh_hc_t)); - } - if (osh) - osl_detach(osh); - return -ENODEV; -} - -#ifndef BCMLXSDMMC -static -#endif /* BCMLXSDMMC */ -int bcmsdh_remove(struct device *dev) -{ - bcmsdh_hc_t *sdhc, *prev; - osl_t *osh; - - sdhc = sdhcinfo; - drvinfo.detach(sdhc->ch); - bcmsdh_detach(sdhc->osh, sdhc->sdh); - /* find the SDIO Host Controller state for this pdev and take it out from the list */ - for (sdhc = sdhcinfo, prev = NULL; sdhc; sdhc = sdhc->next) { - if (sdhc->dev == (void *)dev) { - if (prev) - prev->next = sdhc->next; - else - sdhcinfo = NULL; - break; - } - prev = sdhc; - } - if (!sdhc) { - SDLX_MSG(("%s: failed\n", __FUNCTION__)); - return 0; - } - - - /* release SDIO Host Controller info */ - osh = sdhc->osh; - MFREE(osh, sdhc, sizeof(bcmsdh_hc_t)); - osl_detach(osh); - -#if !defined(BCMLXSDMMC) - dev_set_drvdata(dev, NULL); -#endif /* !defined(BCMLXSDMMC) */ - - return 0; -} - -#else /* BCMPLATFORM_BUS */ - -#if !defined(BCMLXSDMMC) -/* forward declarations for PCI probe and remove functions. */ -static int __devinit bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent); -static void __devexit bcmsdh_pci_remove(struct pci_dev *pdev); - -/** - * pci id table - */ -static struct pci_device_id bcmsdh_pci_devid[] __devinitdata = { - { vendor: PCI_ANY_ID, - device: PCI_ANY_ID, - subvendor: PCI_ANY_ID, - subdevice: PCI_ANY_ID, - class: 0, - class_mask: 0, - driver_data: 0, - }, - { 0, } -}; -MODULE_DEVICE_TABLE(pci, bcmsdh_pci_devid); - -/** - * SDIO Host Controller pci driver info - */ -static struct pci_driver bcmsdh_pci_driver = { - node: {}, - name: "bcmsdh", - id_table: bcmsdh_pci_devid, - probe: bcmsdh_pci_probe, - remove: bcmsdh_pci_remove, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) - save_state: NULL, -#endif - suspend: NULL, - resume: NULL, -}; - - -extern uint sd_pci_slot; /* Force detection to a particular PCI */ - /* slot only . Allows for having multiple */ - /* WL devices at once in a PC */ - /* Only one instance of dhd will be */ - /* usable at a time */ - /* Upper word is bus number, */ - /* lower word is slot number */ - /* Default value of 0xFFFFffff turns this */ - /* off */ -module_param(sd_pci_slot, uint, 0); - - -/** - * Detect supported SDIO Host Controller and attach if found. - * - * Determine if the device described by pdev is a supported SDIO Host - * Controller. If so, attach to it and attach to the target device. - */ -static int __devinit -bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - osl_t *osh = NULL; - bcmsdh_hc_t *sdhc = NULL; - ulong regs; - bcmsdh_info_t *sdh = NULL; - int rc; - - if (sd_pci_slot != 0xFFFFffff) { - if (pdev->bus->number != (sd_pci_slot>>16) || - PCI_SLOT(pdev->devfn) != (sd_pci_slot&0xffff)) { - SDLX_MSG(("%s: %s: bus %X, slot %X, vend %X, dev %X\n", - __FUNCTION__, - bcmsdh_chipmatch(pdev->vendor, pdev->device) ? - "Found compatible SDIOHC" : - "Probing unknown device", - pdev->bus->number, PCI_SLOT(pdev->devfn), - pdev->vendor, pdev->device)); - return -ENODEV; - } - SDLX_MSG(("%s: %s: bus %X, slot %X, vendor %X, device %X (good PCI location)\n", - __FUNCTION__, - bcmsdh_chipmatch(pdev->vendor, pdev->device) ? - "Using compatible SDIOHC" : - "WARNING, forced use of unkown device", - pdev->bus->number, PCI_SLOT(pdev->devfn), - pdev->vendor, pdev->device)); - } - - if ((pdev->vendor == VENDOR_TI) && ((pdev->device == PCIXX21_FLASHMEDIA_ID) || - (pdev->device == PCIXX21_FLASHMEDIA0_ID))) { - uint32 config_reg; - - SDLX_MSG(("%s: Disabling TI FlashMedia Controller.\n", __FUNCTION__)); - if (!(osh = osl_attach(pdev, PCI_BUS, FALSE))) { - SDLX_MSG(("%s: osl_attach failed\n", __FUNCTION__)); - goto err; - } - - config_reg = OSL_PCI_READ_CONFIG(osh, 0x4c, 4); - - /* - * Set MMC_SD_DIS bit in FlashMedia Controller. - * Disbling the SD/MMC Controller in the FlashMedia Controller - * allows the Standard SD Host Controller to take over control - * of the SD Slot. - */ - config_reg |= 0x02; - OSL_PCI_WRITE_CONFIG(osh, 0x4c, 4, config_reg); - osl_detach(osh); - } - /* match this pci device with what we support */ - /* we can't solely rely on this to believe it is our SDIO Host Controller! */ - if (!bcmsdh_chipmatch(pdev->vendor, pdev->device)) { - return -ENODEV; - } - - /* this is a pci device we might support */ - SDLX_MSG(("%s: Found possible SDIO Host Controller: bus %d slot %d func %d irq %d\n", - __FUNCTION__, - pdev->bus->number, PCI_SLOT(pdev->devfn), - PCI_FUNC(pdev->devfn), pdev->irq)); - - /* use bcmsdh_query_device() to get the vendor ID of the target device so - * it will eventually appear in the Broadcom string on the console - */ - - /* allocate SDIO Host Controller state info */ - if (!(osh = osl_attach(pdev, PCI_BUS, FALSE))) { - SDLX_MSG(("%s: osl_attach failed\n", __FUNCTION__)); - goto err; - } - if (!(sdhc = MALLOC(osh, sizeof(bcmsdh_hc_t)))) { - SDLX_MSG(("%s: out of memory, allocated %d bytes\n", - __FUNCTION__, - MALLOCED(osh))); - goto err; - } - bzero(sdhc, sizeof(bcmsdh_hc_t)); - sdhc->osh = osh; - - sdhc->dev = pdev; - - /* map to address where host can access */ - pci_set_master(pdev); - rc = pci_enable_device(pdev); - if (rc) { - SDLX_MSG(("%s: Cannot enable PCI device\n", __FUNCTION__)); - goto err; - } - if (!(sdh = bcmsdh_attach(osh, (void *)(uintptr)pci_resource_start(pdev, 0), - (void **)®s, pdev->irq))) { - SDLX_MSG(("%s: bcmsdh_attach failed\n", __FUNCTION__)); - goto err; - } - - sdhc->sdh = sdh; - - /* try to attach to the target device */ - if (!(sdhc->ch = drvinfo.attach(VENDOR_BROADCOM, /* pdev->vendor, */ - bcmsdh_query_device(sdh) & 0xFFFF, 0, 0, 0, 0, - (void *)regs, NULL, sdh))) { - SDLX_MSG(("%s: device attach failed\n", __FUNCTION__)); - goto err; - } - - /* chain SDIO Host Controller info together */ - sdhc->next = sdhcinfo; - sdhcinfo = sdhc; - - return 0; - - /* error handling */ -err: - if (sdhc->sdh) - bcmsdh_detach(sdhc->osh, sdhc->sdh); - if (sdhc) - MFREE(osh, sdhc, sizeof(bcmsdh_hc_t)); - if (osh) - osl_detach(osh); - return -ENODEV; -} - - -/** - * Detach from target devices and SDIO Host Controller - */ -static void __devexit -bcmsdh_pci_remove(struct pci_dev *pdev) -{ - bcmsdh_hc_t *sdhc, *prev; - osl_t *osh; - - /* find the SDIO Host Controller state for this pdev and take it out from the list */ - for (sdhc = sdhcinfo, prev = NULL; sdhc; sdhc = sdhc->next) { - if (sdhc->dev == pdev) { - if (prev) - prev->next = sdhc->next; - else - sdhcinfo = NULL; - break; - } - prev = sdhc; - } - if (!sdhc) - return; - - drvinfo.detach(sdhc->ch); - - bcmsdh_detach(sdhc->osh, sdhc->sdh); - - /* release SDIO Host Controller info */ - osh = sdhc->osh; - MFREE(osh, sdhc, sizeof(bcmsdh_hc_t)); - osl_detach(osh); -} -#endif /* BCMLXSDMMC */ -#endif /* BCMPLATFORM_BUS */ - -extern int sdio_function_init(void); - -int -bcmsdh_register(bcmsdh_driver_t *driver) -{ - int error = 0; - - drvinfo = *driver; - -#if defined(BCMPLATFORM_BUS) -#if defined(BCMLXSDMMC) - SDLX_MSG(("Linux Kernel SDIO/MMC Driver\n")); - error = sdio_function_init(); -#else - SDLX_MSG(("Intel PXA270 SDIO Driver\n")); - error = driver_register(&bcmsdh_driver); -#endif /* defined(BCMLXSDMMC) */ - return error; -#endif /* defined(BCMPLATFORM_BUS) */ - -#if !defined(BCMPLATFORM_BUS) && !defined(BCMLXSDMMC) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) - if (!(error = pci_module_init(&bcmsdh_pci_driver))) - return 0; -#else - if (!(error = pci_register_driver(&bcmsdh_pci_driver))) - return 0; -#endif - - SDLX_MSG(("%s: pci_module_init failed 0x%x\n", __FUNCTION__, error)); -#endif /* BCMPLATFORM_BUS */ - - return error; -} - -extern void sdio_function_cleanup(void); - -void -bcmsdh_unregister(void) -{ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) - if (bcmsdh_pci_driver.node.next) -#endif - -#if defined(BCMPLATFORM_BUS) && !defined(BCMLXSDMMC) - driver_unregister(&bcmsdh_driver); -#endif -#if defined(BCMLXSDMMC) - sdio_function_cleanup(); -#endif /* BCMLXSDMMC */ -#if !defined(BCMPLATFORM_BUS) && !defined(BCMLXSDMMC) - pci_unregister_driver(&bcmsdh_pci_driver); -#endif /* BCMPLATFORM_BUS */ -} - -#if defined(OOB_INTR_ONLY) -void bcmsdh_oob_intr_set(bool enable) -{ - static bool curstate = 1; - unsigned long flags; - - spin_lock_irqsave(&sdhcinfo->irq_lock, flags); - if (curstate != enable) { - if (enable) - enable_irq(sdhcinfo->oob_irq); - else - disable_irq_nosync(sdhcinfo->oob_irq); - curstate = enable; - } - spin_unlock_irqrestore(&sdhcinfo->irq_lock, flags); -} - -static irqreturn_t wlan_oob_irq(int irq, void *dev_id) -{ - dhd_pub_t *dhdp; - - dhdp = (dhd_pub_t *)dev_get_drvdata(sdhcinfo->dev); - - bcmsdh_oob_intr_set(0); - - if (dhdp == NULL) { - SDLX_MSG(("Out of band GPIO interrupt fired way too early\n")); - return IRQ_HANDLED; - } - - dhdsdio_isr((void *)dhdp->bus); - - return IRQ_HANDLED; -} - -int bcmsdh_register_oob_intr(void * dhdp) -{ - int error = 0; - - SDLX_MSG(("%s Enter\n", __FUNCTION__)); - -/* Example of HW_OOB for HW2: please refer to your host specifiction */ -/* sdhcinfo->oob_flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL | IORESOURCE_IRQ_SHAREABLE; */ - - dev_set_drvdata(sdhcinfo->dev, dhdp); - - if (!sdhcinfo->oob_irq_registered) { - SDLX_MSG(("%s IRQ=%d Type=%X \n", __FUNCTION__, \ - (int)sdhcinfo->oob_irq, (int)sdhcinfo->oob_flags)); - /* Refer to customer Host IRQ docs about proper irqflags definition */ - error = request_irq(sdhcinfo->oob_irq, wlan_oob_irq, sdhcinfo->oob_flags, - "bcmsdh_sdmmc", NULL); - if (error) - return -ENODEV; - - set_irq_wake(sdhcinfo->oob_irq, 1); - sdhcinfo->oob_irq_registered = TRUE; - } - - return 0; -} - -void bcmsdh_set_irq(int flag) -{ - if (sdhcinfo->oob_irq_registered) { - SDLX_MSG(("%s Flag = %d", __FUNCTION__, flag)); - if (flag) { - enable_irq(sdhcinfo->oob_irq); - enable_irq_wake(sdhcinfo->oob_irq); - } else { - disable_irq_wake(sdhcinfo->oob_irq); - disable_irq(sdhcinfo->oob_irq); - } - } -} - -void bcmsdh_unregister_oob_intr(void) -{ - SDLX_MSG(("%s: Enter\n", __FUNCTION__)); - - set_irq_wake(sdhcinfo->oob_irq, 0); - disable_irq(sdhcinfo->oob_irq); /* just in case.. */ - free_irq(sdhcinfo->oob_irq, NULL); - sdhcinfo->oob_irq_registered = FALSE; -} -#endif /* defined(OOB_INTR_ONLY) */ -/* Module parameters specific to each host-controller driver */ - -extern uint sd_msglevel; /* Debug message level */ -module_param(sd_msglevel, uint, 0); - -extern uint sd_power; /* 0 = SD Power OFF, 1 = SD Power ON. */ -module_param(sd_power, uint, 0); - -extern uint sd_clock; /* SD Clock Control, 0 = SD Clock OFF, 1 = SD Clock ON */ -module_param(sd_clock, uint, 0); - -extern uint sd_divisor; /* Divisor (-1 means external clock) */ -module_param(sd_divisor, uint, 0); - -extern uint sd_sdmode; /* Default is SD4, 0=SPI, 1=SD1, 2=SD4 */ -module_param(sd_sdmode, uint, 0); - -extern uint sd_hiok; /* Ok to use hi-speed mode */ -module_param(sd_hiok, uint, 0); - -extern uint sd_f2_blocksize; -module_param(sd_f2_blocksize, int, 0); - - -#ifdef BCMSDH_MODULE -EXPORT_SYMBOL(bcmsdh_attach); -EXPORT_SYMBOL(bcmsdh_detach); -EXPORT_SYMBOL(bcmsdh_intr_query); -EXPORT_SYMBOL(bcmsdh_intr_enable); -EXPORT_SYMBOL(bcmsdh_intr_disable); -EXPORT_SYMBOL(bcmsdh_intr_reg); -EXPORT_SYMBOL(bcmsdh_intr_dereg); - -#if defined(DHD_DEBUG) -EXPORT_SYMBOL(bcmsdh_intr_pending); -#endif - -EXPORT_SYMBOL(bcmsdh_devremove_reg); -EXPORT_SYMBOL(bcmsdh_cfg_read); -EXPORT_SYMBOL(bcmsdh_cfg_write); -EXPORT_SYMBOL(bcmsdh_cis_read); -EXPORT_SYMBOL(bcmsdh_reg_read); -EXPORT_SYMBOL(bcmsdh_reg_write); -EXPORT_SYMBOL(bcmsdh_regfail); -EXPORT_SYMBOL(bcmsdh_send_buf); -EXPORT_SYMBOL(bcmsdh_recv_buf); - -EXPORT_SYMBOL(bcmsdh_rwdata); -EXPORT_SYMBOL(bcmsdh_abort); -EXPORT_SYMBOL(bcmsdh_query_device); -EXPORT_SYMBOL(bcmsdh_query_iofnum); -EXPORT_SYMBOL(bcmsdh_iovar_op); -EXPORT_SYMBOL(bcmsdh_register); -EXPORT_SYMBOL(bcmsdh_unregister); -EXPORT_SYMBOL(bcmsdh_chipmatch); -EXPORT_SYMBOL(bcmsdh_reset); - -EXPORT_SYMBOL(bcmsdh_get_dstatus); -EXPORT_SYMBOL(bcmsdh_cfg_read_word); -EXPORT_SYMBOL(bcmsdh_cfg_write_word); -EXPORT_SYMBOL(bcmsdh_cur_sbwad); -EXPORT_SYMBOL(bcmsdh_chipinfo); - -#endif /* BCMSDH_MODULE */ diff --git a/drivers/net/wireless/bcm4319/bcmsdh_sdmmc.c b/drivers/net/wireless/bcm4319/bcmsdh_sdmmc.c deleted file mode 100644 index 031367b8f18f..000000000000 --- a/drivers/net/wireless/bcm4319/bcmsdh_sdmmc.c +++ /dev/null @@ -1,1304 +0,0 @@ -/* - * BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmsdh_sdmmc.c,v 1.1.2.5.6.30.4.1 2010/09/02 23:12:21 Exp $ - */ -#include - -#include -#include -#include -#include -#include /* SDIO Device and Protocol Specs */ -#include /* SDIO Host Controller Specification */ -#include /* bcmsdh to/from specific controller APIs */ -#include /* ioctl/iovars */ - -#include -#include -#include - -#include -#include - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) -#include -extern volatile bool dhd_mmc_suspend; -#endif -#include "bcmsdh_sdmmc.h" - -#ifndef BCMSDH_MODULE -extern int sdio_function_init(void); -extern void sdio_function_cleanup(void); -#endif /* BCMSDH_MODULE */ - -#if !defined(OOB_INTR_ONLY) -static void IRQHandler(struct sdio_func *func); -static void IRQHandlerF2(struct sdio_func *func); -#endif /* !defined(OOB_INTR_ONLY) */ -static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, uint32 regaddr); -extern int sdio_reset_comm(struct mmc_card *card); - -extern PBCMSDH_SDMMC_INSTANCE gInstance; - -uint sd_sdmode = SDIOH_MODE_SD4; /* Use SD4 mode by default */ -uint sd_f2_blocksize = 512; /* Default blocksize */ - -uint sd_divisor = 2; /* Default 48MHz/2 = 24MHz */ - -uint sd_power = 1; /* Default to SD Slot powered ON */ -uint sd_clock = 1; /* Default to SD Clock turned ON */ -uint sd_hiok = FALSE; /* Don't use hi-speed mode by default */ -uint sd_msglevel = 0x01; -uint sd_use_dma = TRUE; -DHD_PM_RESUME_WAIT_INIT(sdioh_request_byte_wait); -DHD_PM_RESUME_WAIT_INIT(sdioh_request_word_wait); -DHD_PM_RESUME_WAIT_INIT(sdioh_request_packet_wait); -DHD_PM_RESUME_WAIT_INIT(sdioh_request_buffer_wait); - -#define DMA_ALIGN_MASK 0x03 - -int sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 *data); - -static int -sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd) -{ - int err_ret; - uint32 fbraddr; - uint8 func; - - sd_trace(("%s\n", __FUNCTION__)); - - /* Get the Card's common CIS address */ - sd->com_cis_ptr = sdioh_sdmmc_get_cisaddr(sd, SDIOD_CCCR_CISPTR_0); - sd->func_cis_ptr[0] = sd->com_cis_ptr; - sd_info(("%s: Card's Common CIS Ptr = 0x%x\n", __FUNCTION__, sd->com_cis_ptr)); - - /* Get the Card's function CIS (for each function) */ - for (fbraddr = SDIOD_FBR_STARTADDR, func = 1; - func <= sd->num_funcs; func++, fbraddr += SDIOD_FBR_SIZE) { - sd->func_cis_ptr[func] = sdioh_sdmmc_get_cisaddr(sd, SDIOD_FBR_CISPTR_0 + fbraddr); - sd_info(("%s: Function %d CIS Ptr = 0x%x\n", - __FUNCTION__, func, sd->func_cis_ptr[func])); - } - - sd->func_cis_ptr[0] = sd->com_cis_ptr; - sd_info(("%s: Card's Common CIS Ptr = 0x%x\n", __FUNCTION__, sd->com_cis_ptr)); - - /* Enable Function 1 */ - sdio_claim_host(gInstance->func[1]); - err_ret = sdio_enable_func(gInstance->func[1]); - sdio_release_host(gInstance->func[1]); - if (err_ret) { - sd_err(("bcmsdh_sdmmc: Failed to enable F1 Err: 0x%08x", err_ret)); - } - - return FALSE; -} - -/* - * Public entry points & extern's - */ -extern sdioh_info_t * -sdioh_attach(osl_t *osh, void *bar0, uint irq) -{ - sdioh_info_t *sd; - int err_ret; - - sd_trace(("%s\n", __FUNCTION__)); - - if (gInstance == NULL) { - sd_err(("%s: SDIO Device not present\n", __FUNCTION__)); - return NULL; - } - - if ((sd = (sdioh_info_t *)MALLOC(osh, sizeof(sdioh_info_t))) == NULL) { - sd_err(("sdioh_attach: out of memory, malloced %d bytes\n", MALLOCED(osh))); - return NULL; - } - bzero((char *)sd, sizeof(sdioh_info_t)); - sd->osh = osh; - if (sdioh_sdmmc_osinit(sd) != 0) { - sd_err(("%s:sdioh_sdmmc_osinit() failed\n", __FUNCTION__)); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return NULL; - } - - sd->num_funcs = 2; - sd->sd_blockmode = TRUE; - sd->use_client_ints = TRUE; - sd->client_block_size[0] = 64; - - gInstance->sd = sd; - - /* Claim host controller */ - sdio_claim_host(gInstance->func[1]); - - sd->client_block_size[1] = 64; - err_ret = sdio_set_block_size(gInstance->func[1], 64); - if (err_ret) { - sd_err(("bcmsdh_sdmmc: Failed to set F1 blocksize\n")); - } - - /* Release host controller F1 */ - sdio_release_host(gInstance->func[1]); - - if (gInstance->func[2]) { - /* Claim host controller F2 */ - sdio_claim_host(gInstance->func[2]); - - sd->client_block_size[2] = sd_f2_blocksize; - err_ret = sdio_set_block_size(gInstance->func[2], sd_f2_blocksize); - if (err_ret) { - sd_err(("bcmsdh_sdmmc: Failed to set F2 blocksize to %d\n", - sd_f2_blocksize)); - } - - /* Release host controller F2 */ - sdio_release_host(gInstance->func[2]); - } - - sdioh_sdmmc_card_enablefuncs(sd); - - sd_trace(("%s: Done\n", __FUNCTION__)); - return sd; -} - - -extern SDIOH_API_RC -sdioh_detach(osl_t *osh, sdioh_info_t *sd) -{ - sd_trace(("%s\n", __FUNCTION__)); - - if (sd) { - - /* Disable Function 2 */ - sdio_claim_host(gInstance->func[2]); - sdio_disable_func(gInstance->func[2]); - sdio_release_host(gInstance->func[2]); - - /* Disable Function 1 */ - sdio_claim_host(gInstance->func[1]); - sdio_disable_func(gInstance->func[1]); - sdio_release_host(gInstance->func[1]); - - /* deregister irq */ - sdioh_sdmmc_osfree(sd); - - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - } - return SDIOH_API_RC_SUCCESS; -} - -#if defined(OOB_INTR_ONLY) && defined(HW_OOB) - -extern SDIOH_API_RC -sdioh_enable_func_intr(void) -{ - uint8 reg; - int err; - - if (gInstance->func[0]) { - sdio_claim_host(gInstance->func[0]); - - reg = sdio_readb(gInstance->func[0], SDIOD_CCCR_INTEN, &err); - if (err) { - sd_err(("%s: error for read SDIO_CCCR_IENx : 0x%x\n", __FUNCTION__, err)); - sdio_release_host(gInstance->func[0]); - return SDIOH_API_RC_FAIL; - } - - /* Enable F1 and F2 interrupts, set master enable */ - reg |= (INTR_CTL_FUNC1_EN | INTR_CTL_FUNC2_EN | INTR_CTL_MASTER_EN); - - sdio_writeb(gInstance->func[0], reg, SDIOD_CCCR_INTEN, &err); - sdio_release_host(gInstance->func[0]); - - if (err) { - sd_err(("%s: error for write SDIO_CCCR_IENx : 0x%x\n", __FUNCTION__, err)); - return SDIOH_API_RC_FAIL; - } - } - - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_disable_func_intr(void) -{ - uint8 reg; - int err; - - if (gInstance->func[0]) { - sdio_claim_host(gInstance->func[0]); - reg = sdio_readb(gInstance->func[0], SDIOD_CCCR_INTEN, &err); - if (err) { - sd_err(("%s: error for read SDIO_CCCR_IENx : 0x%x\n", __FUNCTION__, err)); - sdio_release_host(gInstance->func[0]); - return SDIOH_API_RC_FAIL; - } - - reg &= ~(INTR_CTL_FUNC1_EN | INTR_CTL_FUNC2_EN); - /* Disable master interrupt with the last function interrupt */ - if (!(reg & 0xFE)) - reg = 0; - sdio_writeb(gInstance->func[0], reg, SDIOD_CCCR_INTEN, &err); - - sdio_release_host(gInstance->func[0]); - if (err) { - sd_err(("%s: error for write SDIO_CCCR_IENx : 0x%x\n", __FUNCTION__, err)); - return SDIOH_API_RC_FAIL; - } - } - return SDIOH_API_RC_SUCCESS; -} -#endif /* defined(OOB_INTR_ONLY) && defined(HW_OOB) */ - -/* Configure callback to client when we recieve client interrupt */ -extern SDIOH_API_RC -sdioh_interrupt_register(sdioh_info_t *sd, sdioh_cb_fn_t fn, void *argh) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - if (fn == NULL) { - sd_err(("%s: interrupt handler is NULL, not registering\n", __FUNCTION__)); - return SDIOH_API_RC_FAIL; - } -#if !defined(OOB_INTR_ONLY) - sd->intr_handler = fn; - sd->intr_handler_arg = argh; - sd->intr_handler_valid = TRUE; - - /* register and unmask irq */ - if (gInstance->func[2]) { - sdio_claim_host(gInstance->func[2]); - sdio_claim_irq(gInstance->func[2], IRQHandlerF2); - sdio_release_host(gInstance->func[2]); - } - - if (gInstance->func[1]) { - sdio_claim_host(gInstance->func[1]); - sdio_claim_irq(gInstance->func[1], IRQHandler); - sdio_release_host(gInstance->func[1]); - } -#elif defined(HW_OOB) - sdioh_enable_func_intr(); -#endif /* defined(OOB_INTR_ONLY) */ - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_interrupt_deregister(sdioh_info_t *sd) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - -#if !defined(OOB_INTR_ONLY) - if (gInstance->func[1]) { - /* register and unmask irq */ - sdio_claim_host(gInstance->func[1]); - sdio_release_irq(gInstance->func[1]); - sdio_release_host(gInstance->func[1]); - } - - if (gInstance->func[2]) { - /* Claim host controller F2 */ - sdio_claim_host(gInstance->func[2]); - sdio_release_irq(gInstance->func[2]); - /* Release host controller F2 */ - sdio_release_host(gInstance->func[2]); - } - - sd->intr_handler_valid = FALSE; - sd->intr_handler = NULL; - sd->intr_handler_arg = NULL; -#elif defined(HW_OOB) - sdioh_disable_func_intr(); -#endif /* !defined(OOB_INTR_ONLY) */ - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_interrupt_query(sdioh_info_t *sd, bool *onoff) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - *onoff = sd->client_intr_enabled; - return SDIOH_API_RC_SUCCESS; -} - -#if defined(DHD_DEBUG) -extern bool -sdioh_interrupt_pending(sdioh_info_t *sd) -{ - return (0); -} -#endif - -uint -sdioh_query_iofnum(sdioh_info_t *sd) -{ - return sd->num_funcs; -} - -/* IOVar table */ -enum { - IOV_MSGLEVEL = 1, - IOV_BLOCKMODE, - IOV_BLOCKSIZE, - IOV_DMA, - IOV_USEINTS, - IOV_NUMINTS, - IOV_NUMLOCALINTS, - IOV_HOSTREG, - IOV_DEVREG, - IOV_DIVISOR, - IOV_SDMODE, - IOV_HISPEED, - IOV_HCIREGS, - IOV_POWER, - IOV_CLOCK, - IOV_RXCHAIN -}; - -const bcm_iovar_t sdioh_iovars[] = { - {"sd_msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0 }, - {"sd_blockmode", IOV_BLOCKMODE, 0, IOVT_BOOL, 0 }, - {"sd_blocksize", IOV_BLOCKSIZE, 0, IOVT_UINT32, 0 }, /* ((fn << 16) | size) */ - {"sd_dma", IOV_DMA, 0, IOVT_BOOL, 0 }, - {"sd_ints", IOV_USEINTS, 0, IOVT_BOOL, 0 }, - {"sd_numints", IOV_NUMINTS, 0, IOVT_UINT32, 0 }, - {"sd_numlocalints", IOV_NUMLOCALINTS, 0, IOVT_UINT32, 0 }, - {"sd_hostreg", IOV_HOSTREG, 0, IOVT_BUFFER, sizeof(sdreg_t) }, - {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(sdreg_t) }, - {"sd_divisor", IOV_DIVISOR, 0, IOVT_UINT32, 0 }, - {"sd_power", IOV_POWER, 0, IOVT_UINT32, 0 }, - {"sd_clock", IOV_CLOCK, 0, IOVT_UINT32, 0 }, - {"sd_mode", IOV_SDMODE, 0, IOVT_UINT32, 100}, - {"sd_highspeed", IOV_HISPEED, 0, IOVT_UINT32, 0 }, - {"sd_rxchain", IOV_RXCHAIN, 0, IOVT_BOOL, 0 }, - {NULL, 0, 0, 0, 0 } -}; - -int -sdioh_iovar_op(sdioh_info_t *si, const char *name, - void *params, int plen, void *arg, int len, bool set) -{ - const bcm_iovar_t *vi = NULL; - int bcmerror = 0; - int val_size; - int32 int_val = 0; - bool bool_val; - uint32 actionid; - - ASSERT(name); - ASSERT(len >= 0); - - /* Get must have return space; Set does not take qualifiers */ - ASSERT(set || (arg && len)); - ASSERT(!set || (!params && !plen)); - - sd_trace(("%s: Enter (%s %s)\n", __FUNCTION__, (set ? "set" : "get"), name)); - - if ((vi = bcm_iovar_lookup(sdioh_iovars, name)) == NULL) { - bcmerror = BCME_UNSUPPORTED; - goto exit; - } - - if ((bcmerror = bcm_iovar_lencheck(vi, arg, len, set)) != 0) - goto exit; - - /* Set up params so get and set can share the convenience variables */ - if (params == NULL) { - params = arg; - plen = len; - } - - if (vi->type == IOVT_VOID) - val_size = 0; - else if (vi->type == IOVT_BUFFER) - val_size = len; - else - val_size = sizeof(int); - - if (plen >= (int)sizeof(int_val)) - bcopy(params, &int_val, sizeof(int_val)); - - bool_val = (int_val != 0) ? TRUE : FALSE; - - actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid); - switch (actionid) { - case IOV_GVAL(IOV_MSGLEVEL): - int_val = (int32)sd_msglevel; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_MSGLEVEL): - sd_msglevel = int_val; - break; - - case IOV_GVAL(IOV_BLOCKMODE): - int_val = (int32)si->sd_blockmode; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_BLOCKMODE): - si->sd_blockmode = (bool)int_val; - /* Haven't figured out how to make non-block mode with DMA */ - break; - - case IOV_GVAL(IOV_BLOCKSIZE): - if ((uint32)int_val > si->num_funcs) { - bcmerror = BCME_BADARG; - break; - } - int_val = (int32)si->client_block_size[int_val]; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_BLOCKSIZE): - { - uint func = ((uint32)int_val >> 16); - uint blksize = (uint16)int_val; - uint maxsize; - - if (func > si->num_funcs) { - bcmerror = BCME_BADARG; - break; - } - - switch (func) { - case 0: maxsize = 32; break; - case 1: maxsize = BLOCK_SIZE_4318; break; - case 2: maxsize = BLOCK_SIZE_4328; break; - default: maxsize = 0; - } - if (blksize > maxsize) { - bcmerror = BCME_BADARG; - break; - } - if (!blksize) { - blksize = maxsize; - } - - /* Now set it */ - si->client_block_size[func] = blksize; - - break; - } - - case IOV_GVAL(IOV_RXCHAIN): - int_val = FALSE; - bcopy(&int_val, arg, val_size); - break; - - case IOV_GVAL(IOV_DMA): - int_val = (int32)si->sd_use_dma; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_DMA): - si->sd_use_dma = (bool)int_val; - break; - - case IOV_GVAL(IOV_USEINTS): - int_val = (int32)si->use_client_ints; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_USEINTS): - si->use_client_ints = (bool)int_val; - if (si->use_client_ints) - si->intmask |= CLIENT_INTR; - else - si->intmask &= ~CLIENT_INTR; - - break; - - case IOV_GVAL(IOV_DIVISOR): - int_val = (uint32)sd_divisor; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_DIVISOR): - sd_divisor = int_val; - break; - - case IOV_GVAL(IOV_POWER): - int_val = (uint32)sd_power; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_POWER): - sd_power = int_val; - break; - - case IOV_GVAL(IOV_CLOCK): - int_val = (uint32)sd_clock; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_CLOCK): - sd_clock = int_val; - break; - - case IOV_GVAL(IOV_SDMODE): - int_val = (uint32)sd_sdmode; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_SDMODE): - sd_sdmode = int_val; - break; - - case IOV_GVAL(IOV_HISPEED): - int_val = (uint32)sd_hiok; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_HISPEED): - sd_hiok = int_val; - break; - - case IOV_GVAL(IOV_NUMINTS): - int_val = (int32)si->intrcount; - bcopy(&int_val, arg, val_size); - break; - - case IOV_GVAL(IOV_NUMLOCALINTS): - int_val = (int32)0; - bcopy(&int_val, arg, val_size); - break; - - case IOV_GVAL(IOV_HOSTREG): - { - sdreg_t *sd_ptr = (sdreg_t *)params; - - if (sd_ptr->offset < SD_SysAddr || sd_ptr->offset > SD_MaxCurCap) { - sd_err(("%s: bad offset 0x%x\n", __FUNCTION__, sd_ptr->offset)); - bcmerror = BCME_BADARG; - break; - } - - sd_trace(("%s: rreg%d at offset %d\n", __FUNCTION__, - (sd_ptr->offset & 1) ? 8 : ((sd_ptr->offset & 2) ? 16 : 32), - sd_ptr->offset)); - if (sd_ptr->offset & 1) - int_val = 8; /* sdioh_sdmmc_rreg8(si, sd_ptr->offset); */ - else if (sd_ptr->offset & 2) - int_val = 16; /* sdioh_sdmmc_rreg16(si, sd_ptr->offset); */ - else - int_val = 32; /* sdioh_sdmmc_rreg(si, sd_ptr->offset); */ - - bcopy(&int_val, arg, sizeof(int_val)); - break; - } - - case IOV_SVAL(IOV_HOSTREG): - { - sdreg_t *sd_ptr = (sdreg_t *)params; - - if (sd_ptr->offset < SD_SysAddr || sd_ptr->offset > SD_MaxCurCap) { - sd_err(("%s: bad offset 0x%x\n", __FUNCTION__, sd_ptr->offset)); - bcmerror = BCME_BADARG; - break; - } - - sd_trace(("%s: wreg%d value 0x%08x at offset %d\n", __FUNCTION__, sd_ptr->value, - (sd_ptr->offset & 1) ? 8 : ((sd_ptr->offset & 2) ? 16 : 32), - sd_ptr->offset)); - break; - } - - case IOV_GVAL(IOV_DEVREG): - { - sdreg_t *sd_ptr = (sdreg_t *)params; - uint8 data = 0; - - if (sdioh_cfg_read(si, sd_ptr->func, sd_ptr->offset, &data)) { - bcmerror = BCME_SDIO_ERROR; - break; - } - - int_val = (int)data; - bcopy(&int_val, arg, sizeof(int_val)); - break; - } - - case IOV_SVAL(IOV_DEVREG): - { - sdreg_t *sd_ptr = (sdreg_t *)params; - uint8 data = (uint8)sd_ptr->value; - - if (sdioh_cfg_write(si, sd_ptr->func, sd_ptr->offset, &data)) { - bcmerror = BCME_SDIO_ERROR; - break; - } - break; - } - - default: - bcmerror = BCME_UNSUPPORTED; - break; - } -exit: - - return bcmerror; -} - -#if defined(OOB_INTR_ONLY) && defined(HW_OOB) - -SDIOH_API_RC -sdioh_enable_hw_oob_intr(sdioh_info_t *sd, bool enable) -{ - SDIOH_API_RC status; - uint8 data; - - if (enable) - data = 3; /* enable hw oob interrupt */ - else - data = 4; /* disable hw oob interrupt */ - data |= 4; /* Active HIGH */ - - status = sdioh_request_byte(sd, SDIOH_WRITE, 0, 0xf2, &data); - return status; -} -#endif /* defined(OOB_INTR_ONLY) && defined(HW_OOB) */ - -extern SDIOH_API_RC -sdioh_cfg_read(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data) -{ - SDIOH_API_RC status; - /* No lock needed since sdioh_request_byte does locking */ - status = sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data); - return status; -} - -extern SDIOH_API_RC -sdioh_cfg_write(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data) -{ - /* No lock needed since sdioh_request_byte does locking */ - SDIOH_API_RC status; - status = sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data); - return status; -} - -static int -sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, uint32 regaddr) -{ - /* read 24 bits and return valid 17 bit addr */ - int i; - uint32 scratch, regdata; - uint8 *ptr = (uint8 *)&scratch; - for (i = 0; i < 3; i++) { - if ((sdioh_sdmmc_card_regread (sd, 0, regaddr, 1, ®data)) != SUCCESS) - sd_err(("%s: Can't read!\n", __FUNCTION__)); - - *ptr++ = (uint8) regdata; - regaddr++; - } - - /* Only the lower 17-bits are valid */ - scratch = ltoh32(scratch); - scratch &= 0x0001FFFF; - return (scratch); -} - -extern SDIOH_API_RC -sdioh_cis_read(sdioh_info_t *sd, uint func, uint8 *cisd, uint32 length) -{ - uint32 count; - int offset; - uint32 foo; - uint8 *cis = cisd; - - sd_trace(("%s: Func = %d\n", __FUNCTION__, func)); - - if (!sd->func_cis_ptr[func]) { - bzero(cis, length); - sd_err(("%s: no func_cis_ptr[%d]\n", __FUNCTION__, func)); - return SDIOH_API_RC_FAIL; - } - - sd_err(("%s: func_cis_ptr[%d]=0x%04x\n", __FUNCTION__, func, sd->func_cis_ptr[func])); - - for (count = 0; count < length; count++) { - offset = sd->func_cis_ptr[func] + count; - if (sdioh_sdmmc_card_regread (sd, 0, offset, 1, &foo) < 0) { - sd_err(("%s: regread failed: Can't read CIS\n", __FUNCTION__)); - return SDIOH_API_RC_FAIL; - } - - *cis = (uint8)(foo & 0xff); - cis++; - } - - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *byte) -{ - int err_ret; - - sd_info(("%s: rw=%d, func=%d, addr=0x%05x\n", __FUNCTION__, rw, func, regaddr)); - - DHD_PM_RESUME_WAIT(sdioh_request_byte_wait); - DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL); - if(rw) { /* CMD52 Write */ - if (func == 0) { - /* Can only directly write to some F0 registers. Handle F2 enable - * as a special case. - */ - if (regaddr == SDIOD_CCCR_IOEN) { - if (gInstance->func[2]) { - sdio_claim_host(gInstance->func[2]); - if (*byte & SDIO_FUNC_ENABLE_2) { - /* Enable Function 2 */ - err_ret = sdio_enable_func(gInstance->func[2]); - if (err_ret) { - sd_err(("bcmsdh_sdmmc: enable F2 failed:%d", - err_ret)); - } - } else { - /* Disable Function 2 */ - err_ret = sdio_disable_func(gInstance->func[2]); - if (err_ret) { - sd_err(("bcmsdh_sdmmc: Disab F2 failed:%d", - err_ret)); - } - } - sdio_release_host(gInstance->func[2]); - } - } -#if defined(MMC_SDIO_ABORT) - /* to allow abort command through F1 */ - else if (regaddr == SDIOD_CCCR_IOABORT) { - sdio_claim_host(gInstance->func[func]); - /* - * this sdio_f0_writeb() can be replaced with another api - * depending upon MMC driver change. - * As of this time, this is temporaray one - */ - sdio_writeb(gInstance->func[func], *byte, regaddr, &err_ret); - sdio_release_host(gInstance->func[func]); - } -#endif /* MMC_SDIO_ABORT */ - else if (regaddr < 0xF0) { - sd_err(("bcmsdh_sdmmc: F0 Wr:0x%02x: write disallowed\n", regaddr)); - } else { - /* Claim host controller, perform F0 write, and release */ - sdio_claim_host(gInstance->func[func]); - sdio_f0_writeb(gInstance->func[func], *byte, regaddr, &err_ret); - sdio_release_host(gInstance->func[func]); - } - } else { - /* Claim host controller, perform Fn write, and release */ - sdio_claim_host(gInstance->func[func]); - sdio_writeb(gInstance->func[func], *byte, regaddr, &err_ret); - sdio_release_host(gInstance->func[func]); - } - } else { /* CMD52 Read */ - /* Claim host controller, perform Fn read, and release */ - sdio_claim_host(gInstance->func[func]); - - if (func == 0) { - *byte = sdio_f0_readb(gInstance->func[func], regaddr, &err_ret); - } else { - *byte = sdio_readb(gInstance->func[func], regaddr, &err_ret); - } - - sdio_release_host(gInstance->func[func]); - } - - if (err_ret) { - sd_err(("bcmsdh_sdmmc: Failed to %s byte F%d:@0x%05x=%02x, Err: %d\n", - rw ? "Write" : "Read", func, regaddr, *byte, err_ret)); - } - - return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL); -} - -extern SDIOH_API_RC -sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, uint addr, - uint32 *word, uint nbytes) -{ - int err_ret = SDIOH_API_RC_FAIL; - - if (func == 0) { - sd_err(("%s: Only CMD52 allowed to F0.\n", __FUNCTION__)); - return SDIOH_API_RC_FAIL; - } - - sd_info(("%s: cmd_type=%d, rw=%d, func=%d, addr=0x%05x, nbytes=%d\n", - __FUNCTION__, cmd_type, rw, func, addr, nbytes)); - - DHD_PM_RESUME_WAIT(sdioh_request_word_wait); - DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL); - /* Claim host controller */ - sdio_claim_host(gInstance->func[func]); - - if(rw) { /* CMD52 Write */ - if (nbytes == 4) { - sdio_writel(gInstance->func[func], *word, addr, &err_ret); - } else if (nbytes == 2) { - sdio_writew(gInstance->func[func], (*word & 0xFFFF), addr, &err_ret); - } else { - sd_err(("%s: Invalid nbytes: %d\n", __FUNCTION__, nbytes)); - } - } else { /* CMD52 Read */ - if (nbytes == 4) { - *word = sdio_readl(gInstance->func[func], addr, &err_ret); - } else if (nbytes == 2) { - *word = sdio_readw(gInstance->func[func], addr, &err_ret) & 0xFFFF; - } else { - sd_err(("%s: Invalid nbytes: %d\n", __FUNCTION__, nbytes)); - } - } - - /* Release host controller */ - sdio_release_host(gInstance->func[func]); - - if (err_ret) { - sd_err(("bcmsdh_sdmmc: Failed to %s word, Err: 0x%08x", - rw ? "Write" : "Read", err_ret)); - } - - return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL); -} - -static SDIOH_API_RC -sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, - uint addr, void *pkt) -{ - bool fifo = (fix_inc == SDIOH_DATA_FIX); - uint32 SGCount = 0; - int err_ret = 0; - - void *pnext; - - sd_trace(("%s: Enter\n", __FUNCTION__)); - - ASSERT(pkt); - DHD_PM_RESUME_WAIT(sdioh_request_packet_wait); - DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL); - - /* Claim host controller */ - sdio_claim_host(gInstance->func[func]); - for (pnext = pkt; pnext; pnext = PKTNEXT(sd->osh, pnext)) { - uint pkt_len = PKTLEN(sd->osh, pnext); - pkt_len += 3; - pkt_len &= 0xFFFFFFFC; - -#ifdef CONFIG_MMC_MSM7X00A - if ((pkt_len % 64) == 32) { - sd_trace(("%s: Rounding up TX packet +=32\n", __FUNCTION__)); - pkt_len += 32; - } -#endif /* CONFIG_MMC_MSM7X00A */ - /* Make sure the packet is aligned properly. If it isn't, then this - * is the fault of sdioh_request_buffer() which is supposed to give - * us something we can work with. - */ - ASSERT(((uint32)(PKTDATA(sd->osh, pkt)) & DMA_ALIGN_MASK) == 0); - - if ((write) && (!fifo)) { - err_ret = sdio_memcpy_toio(gInstance->func[func], addr, - ((uint8*)PKTDATA(sd->osh, pnext)), - pkt_len); - } else if (write) { - err_ret = sdio_memcpy_toio(gInstance->func[func], addr, - ((uint8*)PKTDATA(sd->osh, pnext)), - pkt_len); - } else if (fifo) { - err_ret = sdio_readsb(gInstance->func[func], - ((uint8*)PKTDATA(sd->osh, pnext)), - addr, - pkt_len); - } else { - err_ret = sdio_memcpy_fromio(gInstance->func[func], - ((uint8*)PKTDATA(sd->osh, pnext)), - addr, - pkt_len); - } - - if (err_ret) { - sd_err(("%s: %s FAILED %p[%d], addr=0x%05x, pkt_len=%d, ERR=0x%08x\n", - __FUNCTION__, - (write) ? "TX" : "RX", - pnext, SGCount, addr, pkt_len, err_ret)); - } else { - sd_trace(("%s: %s xfr'd %p[%d], addr=0x%05x, len=%d\n", - __FUNCTION__, - (write) ? "TX" : "RX", - pnext, SGCount, addr, pkt_len)); - } - - if (!fifo) { - addr += pkt_len; - } - SGCount ++; - - } - - /* Release host controller */ - sdio_release_host(gInstance->func[func]); - - sd_trace(("%s: Exit\n", __FUNCTION__)); - return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL); -} - - -/* - * This function takes a buffer or packet, and fixes everything up so that in the - * end, a DMA-able packet is created. - * - * A buffer does not have an associated packet pointer, and may or may not be aligned. - * A packet may consist of a single packet, or a packet chain. If it is a packet chain, - * then all the packets in the chain must be properly aligned. If the packet data is not - * aligned, then there may only be one packet, and in this case, it is copied to a new - * aligned packet. - * - */ -extern SDIOH_API_RC -sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write, uint func, - uint addr, uint reg_width, uint buflen_u, uint8 *buffer, void *pkt) -{ - SDIOH_API_RC Status; - void *mypkt = NULL; - - sd_trace(("%s: Enter\n", __FUNCTION__)); - - DHD_PM_RESUME_WAIT(sdioh_request_buffer_wait); - DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL); - /* Case 1: we don't have a packet. */ - if (pkt == NULL) { - sd_data(("%s: Creating new %s Packet, len=%d\n", - __FUNCTION__, write ? "TX" : "RX", buflen_u)); -#ifdef DHD_USE_STATIC_BUF - if (!(mypkt = PKTGET_STATIC(sd->osh, buflen_u, write ? TRUE : FALSE))) { -#else - if (!(mypkt = PKTGET(sd->osh, buflen_u, write ? TRUE : FALSE))) { -#endif /* DHD_USE_STATIC_BUF */ - sd_err(("%s: PKTGET failed: len %d\n", - __FUNCTION__, buflen_u)); - return SDIOH_API_RC_FAIL; - } - - /* For a write, copy the buffer data into the packet. */ - if (write) { - bcopy(buffer, PKTDATA(sd->osh, mypkt), buflen_u); - } - - Status = sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt); - - /* For a read, copy the packet data back to the buffer. */ - if (!write) { - bcopy(PKTDATA(sd->osh, mypkt), buffer, buflen_u); - } -#ifdef DHD_USE_STATIC_BUF - PKTFREE_STATIC(sd->osh, mypkt, write ? TRUE : FALSE); -#else - PKTFREE(sd->osh, mypkt, write ? TRUE : FALSE); -#endif /* DHD_USE_STATIC_BUF */ - } else if (((uint32)(PKTDATA(sd->osh, pkt)) & DMA_ALIGN_MASK) != 0) { - /* Case 2: We have a packet, but it is unaligned. */ - - /* In this case, we cannot have a chain. */ - ASSERT(PKTNEXT(sd->osh, pkt) == NULL); - - sd_data(("%s: Creating aligned %s Packet, len=%d\n", - __FUNCTION__, write ? "TX" : "RX", PKTLEN(sd->osh, pkt))); -#ifdef DHD_USE_STATIC_BUF - if (!(mypkt = PKTGET_STATIC(sd->osh, PKTLEN(sd->osh, pkt), write ? TRUE : FALSE))) { -#else - if (!(mypkt = PKTGET(sd->osh, PKTLEN(sd->osh, pkt), write ? TRUE : FALSE))) { -#endif /* DHD_USE_STATIC_BUF */ - sd_err(("%s: PKTGET failed: len %d\n", - __FUNCTION__, PKTLEN(sd->osh, pkt))); - return SDIOH_API_RC_FAIL; - } - - /* For a write, copy the buffer data into the packet. */ - if (write) { - bcopy(PKTDATA(sd->osh, pkt), - PKTDATA(sd->osh, mypkt), - PKTLEN(sd->osh, pkt)); - } - - Status = sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt); - - /* For a read, copy the packet data back to the buffer. */ - if (!write) { - bcopy(PKTDATA(sd->osh, mypkt), - PKTDATA(sd->osh, pkt), - PKTLEN(sd->osh, mypkt)); - } -#ifdef DHD_USE_STATIC_BUF - PKTFREE_STATIC(sd->osh, mypkt, write ? TRUE : FALSE); -#else - PKTFREE(sd->osh, mypkt, write ? TRUE : FALSE); -#endif /* DHD_USE_STATIC_BUF */ - } else { /* case 3: We have a packet and it is aligned. */ - sd_data(("%s: Aligned %s Packet, direct DMA\n", - __FUNCTION__, write ? "Tx" : "Rx")); - Status = sdioh_request_packet(sd, fix_inc, write, func, addr, pkt); - } - - return (Status); -} - -/* this function performs "abort" for both of host & device */ -extern int -sdioh_abort(sdioh_info_t *sd, uint func) -{ -#if defined(MMC_SDIO_ABORT) - char t_func = (char) func; -#endif /* defined(MMC_SDIO_ABORT) */ - sd_trace(("%s: Enter\n", __FUNCTION__)); - -#if defined(MMC_SDIO_ABORT) - /* issue abort cmd52 command through F1 */ - sdioh_request_byte(sd, SD_IO_OP_WRITE, SDIO_FUNC_0, SDIOD_CCCR_IOABORT, &t_func); -#endif /* defined(MMC_SDIO_ABORT) */ - - sd_trace(("%s: Exit\n", __FUNCTION__)); - return SDIOH_API_RC_SUCCESS; -} - -/* Reset and re-initialize the device */ -int sdioh_sdio_reset(sdioh_info_t *si) -{ - sd_trace(("%s: Enter\n", __FUNCTION__)); - sd_trace(("%s: Exit\n", __FUNCTION__)); - return SDIOH_API_RC_SUCCESS; -} - -/* Disable device interrupt */ -void -sdioh_sdmmc_devintr_off(sdioh_info_t *sd) -{ - sd_trace(("%s: %d\n", __FUNCTION__, sd->use_client_ints)); - sd->intmask &= ~CLIENT_INTR; -} - -/* Enable device interrupt */ -void -sdioh_sdmmc_devintr_on(sdioh_info_t *sd) -{ - sd_trace(("%s: %d\n", __FUNCTION__, sd->use_client_ints)); - sd->intmask |= CLIENT_INTR; -} - -/* Read client card reg */ -int -sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 *data) -{ - - if ((func == 0) || (regsize == 1)) { - uint8 temp = 0; - - sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp); - *data = temp; - *data &= 0xff; - sd_data(("%s: byte read data=0x%02x\n", - __FUNCTION__, *data)); - } else { - sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, data, regsize); - if (regsize == 2) - *data &= 0xffff; - - sd_data(("%s: word read data=0x%08x\n", - __FUNCTION__, *data)); - } - - return SUCCESS; -} - -#if !defined(OOB_INTR_ONLY) -/* bcmsdh_sdmmc interrupt handler */ -static void IRQHandler(struct sdio_func *func) -{ - sdioh_info_t *sd; - - sd_trace(("bcmsdh_sdmmc: ***IRQHandler\n")); - sd = gInstance->sd; - - ASSERT(sd != NULL); - sdio_release_host(gInstance->func[0]); - - if (sd->use_client_ints) { - sd->intrcount++; - ASSERT(sd->intr_handler); - ASSERT(sd->intr_handler_arg); - (sd->intr_handler)(sd->intr_handler_arg); - } else { - sd_err(("bcmsdh_sdmmc: ***IRQHandler\n")); - - sd_err(("%s: Not ready for intr: enabled %d, handler %p\n", - __FUNCTION__, sd->client_intr_enabled, sd->intr_handler)); - } - - sdio_claim_host(gInstance->func[0]); -} - -/* bcmsdh_sdmmc interrupt handler for F2 (dummy handler) */ -static void IRQHandlerF2(struct sdio_func *func) -{ - sdioh_info_t *sd; - - sd_trace(("bcmsdh_sdmmc: ***IRQHandlerF2\n")); - - sd = gInstance->sd; - - ASSERT(sd != NULL); -} -#endif /* !defined(OOB_INTR_ONLY) */ - -#ifdef NOTUSED -/* Write client card reg */ -static int -sdioh_sdmmc_card_regwrite(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 data) -{ - - if ((func == 0) || (regsize == 1)) { - uint8 temp; - - temp = data & 0xff; - sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp); - sd_data(("%s: byte write data=0x%02x\n", - __FUNCTION__, data)); - } else { - if (regsize == 2) - data &= 0xffff; - - sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, &data, regsize); - - sd_data(("%s: word write data=0x%08x\n", - __FUNCTION__, data)); - } - - return SUCCESS; -} -#endif /* NOTUSED */ - -int -sdioh_start(sdioh_info_t *si, int stage) -{ - int ret; - sdioh_info_t *sd = gInstance->sd; - - /* Need to do this stages as we can't enable the interrupt till - downloading of the firmware is complete, other wise polling - sdio access will come in way - */ - if (gInstance->func[0]) { - if (stage == 0) { - /* Since the power to the chip is killed, we will have - re enumerate the device again. Set the block size - and enable the fucntion 1 for in preparation for - downloading the code - */ - /* sdio_reset_comm() - has been fixed in latest kernel/msm.git for Linux - 2.6.27. The implementation prior to that is buggy, and needs broadcom's - patch for it - */ - if ((ret = sdio_reset_comm(gInstance->func[0]->card))) - sd_err(("%s Failed, error = %d\n", __FUNCTION__, ret)); - else { - sd->num_funcs = 2; - sd->sd_blockmode = TRUE; - sd->use_client_ints = TRUE; - sd->client_block_size[0] = 64; - - /* Claim host controller */ - sdio_claim_host(gInstance->func[1]); - - sd->client_block_size[1] = 64; - if (sdio_set_block_size(gInstance->func[1], 64)) { - sd_err(("bcmsdh_sdmmc: Failed to set F1 blocksize\n")); - } - - /* Release host controller F1 */ - sdio_release_host(gInstance->func[1]); - - if (gInstance->func[2]) { - /* Claim host controller F2 */ - sdio_claim_host(gInstance->func[2]); - - sd->client_block_size[2] = sd_f2_blocksize; - if (sdio_set_block_size(gInstance->func[2], - sd_f2_blocksize)) { - sd_err(("bcmsdh_sdmmc: Failed to set F2 " - "blocksize to %d\n", sd_f2_blocksize)); - } - - /* Release host controller F2 */ - sdio_release_host(gInstance->func[2]); - } - - sdioh_sdmmc_card_enablefuncs(sd); - } - } else { -#if !defined(OOB_INTR_ONLY) - sdio_claim_host(gInstance->func[0]); - sdio_claim_irq(gInstance->func[2], IRQHandlerF2); - sdio_claim_irq(gInstance->func[1], IRQHandler); - sdio_release_host(gInstance->func[0]); -#else /* defined(OOB_INTR_ONLY) */ -#if defined(HW_OOB) - sdioh_enable_func_intr(); -#endif - bcmsdh_oob_intr_set(TRUE); -#endif /* !defined(OOB_INTR_ONLY) */ - } - } - else - sd_err(("%s Failed\n", __FUNCTION__)); - - return (0); -} - -int -sdioh_stop(sdioh_info_t *si) -{ - /* MSM7201A Android sdio stack has bug with interrupt - So internaly within SDIO stack they are polling - which cause issue when device is turned off. So - unregister interrupt with SDIO stack to stop the - polling - */ - if (gInstance->func[0]) { -#if !defined(OOB_INTR_ONLY) - sdio_claim_host(gInstance->func[0]); - sdio_release_irq(gInstance->func[1]); - sdio_release_irq(gInstance->func[2]); - sdio_release_host(gInstance->func[0]); -#else /* defined(OOB_INTR_ONLY) */ -#if defined(HW_OOB) - sdioh_disable_func_intr(); -#endif - bcmsdh_oob_intr_set(FALSE); -#endif /* !defined(OOB_INTR_ONLY) */ - } - else - sd_err(("%s Failed\n", __FUNCTION__)); - return (0); -} diff --git a/drivers/net/wireless/bcm4319/bcmsdh_sdmmc_linux.c b/drivers/net/wireless/bcm4319/bcmsdh_sdmmc_linux.c deleted file mode 100644 index 8992a4267f9f..000000000000 --- a/drivers/net/wireless/bcm4319/bcmsdh_sdmmc_linux.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmsdh_sdmmc_linux.c,v 1.1.2.5.6.17 2010/08/13 00:36:19 Exp $ - */ - -#include -#include -#include /* SDIO Specs */ -#include /* bcmsdh to/from specific controller APIs */ -#include /* to get msglevel bit values */ - -#include /* request_irq() */ - -#include -#include -#include -#include - -#if !defined(SDIO_VENDOR_ID_BROADCOM) -#define SDIO_VENDOR_ID_BROADCOM 0x02d0 -#endif /* !defined(SDIO_VENDOR_ID_BROADCOM) */ - -#define SDIO_DEVICE_ID_BROADCOM_DEFAULT 0x0000 - -#if !defined(SDIO_DEVICE_ID_BROADCOM_4325_SDGWB) -#define SDIO_DEVICE_ID_BROADCOM_4325_SDGWB 0x0492 /* BCM94325SDGWB */ -#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4325_SDGWB) */ -#if !defined(SDIO_DEVICE_ID_BROADCOM_4325) -#define SDIO_DEVICE_ID_BROADCOM_4325 0x0493 -#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4325) */ -#if !defined(SDIO_DEVICE_ID_BROADCOM_4329) -#define SDIO_DEVICE_ID_BROADCOM_4329 0x4329 -#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4329) */ -#if !defined(SDIO_DEVICE_ID_BROADCOM_4319) -#define SDIO_DEVICE_ID_BROADCOM_4319 0x4319 -#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4329) */ - -#include - -#include - -extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd); -extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd); - -int sdio_function_init(void); -void sdio_function_cleanup(void); - -#define DESCRIPTION "bcmsdh_sdmmc Driver" -#define AUTHOR "Broadcom Corporation" - -/* module param defaults */ -static int clockoverride = 0; - -module_param(clockoverride, int, 0644); -MODULE_PARM_DESC(clockoverride, "SDIO card clock override"); - -PBCMSDH_SDMMC_INSTANCE gInstance; - -/* Maximum number of bcmsdh_sdmmc devices supported by driver */ -#define BCMSDH_SDMMC_MAX_DEVICES 1 - -extern int bcmsdh_probe(struct device *dev); -extern int bcmsdh_remove(struct device *dev); -struct device sdmmc_dev; - -static int bcmsdh_sdmmc_probe(struct sdio_func *func, - const struct sdio_device_id *id) -{ - int ret = 0; - static struct sdio_func sdio_func_0; - sd_trace(("bcmsdh_sdmmc: %s Enter\n", __FUNCTION__)); - sd_trace(("sdio_bcmsdh: func->class=%x\n", func->class)); - sd_trace(("sdio_vendor: 0x%04x\n", func->vendor)); - sd_trace(("sdio_device: 0x%04x\n", func->device)); - sd_trace(("Function#: 0x%04x\n", func->num)); - - if (func->num == 1) { - sdio_func_0.num = 0; - sdio_func_0.card = func->card; - gInstance->func[0] = &sdio_func_0; - if(func->device == 0x4) { /* 4318 */ - gInstance->func[2] = NULL; - sd_trace(("NIC found, calling bcmsdh_probe...\n")); - ret = bcmsdh_probe(&sdmmc_dev); - } - } - - gInstance->func[func->num] = func; - - if (func->num == 2) { - sd_trace(("F2 found, calling bcmsdh_probe...\n")); - ret = bcmsdh_probe(&sdmmc_dev); - } - - return ret; -} - -static void bcmsdh_sdmmc_remove(struct sdio_func *func) -{ - sd_trace(("bcmsdh_sdmmc: %s Enter\n", __FUNCTION__)); - sd_info(("sdio_bcmsdh: func->class=%x\n", func->class)); - sd_info(("sdio_vendor: 0x%04x\n", func->vendor)); - sd_info(("sdio_device: 0x%04x\n", func->device)); - sd_info(("Function#: 0x%04x\n", func->num)); - - if (func->num == 2) { - sd_trace(("F2 found, calling bcmsdh_remove...\n")); - bcmsdh_remove(&sdmmc_dev); - } -} - -/* devices we support, null terminated */ -static const struct sdio_device_id bcmsdh_sdmmc_ids[] = { - { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_DEFAULT) }, - { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325_SDGWB) }, - { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325) }, - { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4329) }, - { SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4319) }, - { /* end: all zeroes */ }, -}; - -MODULE_DEVICE_TABLE(sdio, bcmsdh_sdmmc_ids); - -static struct sdio_driver bcmsdh_sdmmc_driver = { - .probe = bcmsdh_sdmmc_probe, - .remove = bcmsdh_sdmmc_remove, - .name = "bcmsdh_sdmmc", - .id_table = bcmsdh_sdmmc_ids, - }; - -struct sdos_info { - sdioh_info_t *sd; - spinlock_t lock; -}; - - -int -sdioh_sdmmc_osinit(sdioh_info_t *sd) -{ - struct sdos_info *sdos; - - sdos = (struct sdos_info*)MALLOC(sd->osh, sizeof(struct sdos_info)); - sd->sdos_info = (void*)sdos; - if (sdos == NULL) - return BCME_NOMEM; - - sdos->sd = sd; - spin_lock_init(&sdos->lock); - return BCME_OK; -} - -void -sdioh_sdmmc_osfree(sdioh_info_t *sd) -{ - struct sdos_info *sdos; - ASSERT(sd && sd->sdos_info); - - sdos = (struct sdos_info *)sd->sdos_info; - MFREE(sd->osh, sdos, sizeof(struct sdos_info)); -} - -/* Interrupt enable/disable */ -SDIOH_API_RC -sdioh_interrupt_set(sdioh_info_t *sd, bool enable) -{ - ulong flags; - struct sdos_info *sdos; - - sd_trace(("%s: %s\n", __FUNCTION__, enable ? "Enabling" : "Disabling")); - - sdos = (struct sdos_info *)sd->sdos_info; - ASSERT(sdos); - -#if !defined(OOB_INTR_ONLY) - if (enable && !(sd->intr_handler && sd->intr_handler_arg)) { - sd_err(("%s: no handler registered, will not enable\n", __FUNCTION__)); - return SDIOH_API_RC_FAIL; - } -#endif /* !defined(OOB_INTR_ONLY) */ - - /* Ensure atomicity for enable/disable calls */ - spin_lock_irqsave(&sdos->lock, flags); - - sd->client_intr_enabled = enable; - if (enable) { - sdioh_sdmmc_devintr_on(sd); - } else { - sdioh_sdmmc_devintr_off(sd); - } - - spin_unlock_irqrestore(&sdos->lock, flags); - - return SDIOH_API_RC_SUCCESS; -} - - -#ifdef BCMSDH_MODULE -static int __init -bcmsdh_module_init(void) -{ - int error = 0; - sdio_function_init(); - return error; -} - -static void __exit -bcmsdh_module_cleanup(void) -{ - sdio_function_cleanup(); -} - -module_init(bcmsdh_module_init); -module_exit(bcmsdh_module_cleanup); - -MODULE_LICENSE("GPL v2"); -MODULE_DESCRIPTION(DESCRIPTION); -MODULE_AUTHOR(AUTHOR); - -#endif /* BCMSDH_MODULE */ -/* - * module init -*/ -int sdio_function_init(void) -{ - int error = 0; - sd_trace(("bcmsdh_sdmmc: %s Enter\n", __FUNCTION__)); - - gInstance = kzalloc(sizeof(BCMSDH_SDMMC_INSTANCE), GFP_KERNEL); - if (!gInstance) - return -ENOMEM; - - bzero(&sdmmc_dev, sizeof(sdmmc_dev)); - error = sdio_register_driver(&bcmsdh_sdmmc_driver); - - - return error; -} - -/* - * module cleanup -*/ -extern int bcmsdh_remove(struct device *dev); -void sdio_function_cleanup(void) -{ - sd_trace(("%s Enter\n", __FUNCTION__)); - - - sdio_unregister_driver(&bcmsdh_sdmmc_driver); - - if (gInstance) - kfree(gInstance); -} diff --git a/drivers/net/wireless/bcm4319/bcmsdspi.c b/drivers/net/wireless/bcm4319/bcmsdspi.c deleted file mode 100644 index 636539be5ea5..000000000000 --- a/drivers/net/wireless/bcm4319/bcmsdspi.c +++ /dev/null @@ -1,1596 +0,0 @@ -/* - * Broadcom BCMSDH to SPI Protocol Conversion Layer - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmsdspi.c,v 1.14.4.2.4.4.6.5 2010/03/10 03:09:48 Exp $ - */ - -#include - -#include -#include -#include -#include -#include -#include /* SDIO Device and Protocol Specs */ -#include /* SDIO Host Controller Specification */ -#include /* bcmsdh to/from specific controller APIs */ -#include /* ioctl/iovars */ - -#include - - -#include -#include - -#include - -#define SD_PAGE 4096 - -/* Globals */ - -uint sd_msglevel = SDH_ERROR_VAL; -uint sd_hiok = FALSE; /* Use hi-speed mode if available? */ -uint sd_sdmode = SDIOH_MODE_SPI; /* Use SD4 mode by default */ -uint sd_f2_blocksize = 512; /* Default blocksize */ - -uint sd_divisor = 2; /* Default 33MHz/2 = 16MHz for dongle */ -uint sd_power = 1; /* Default to SD Slot powered ON */ -uint sd_clock = 1; /* Default to SD Clock turned ON */ -uint sd_crc = 0; /* Default to SPI CRC Check turned OFF */ -uint sd_pci_slot = 0xFFFFffff; /* Used to force selection of a particular PCI slot */ - -uint sd_toctl = 7; - -/* Prototypes */ -static bool sdspi_start_power(sdioh_info_t *sd); -static int sdspi_set_highspeed_mode(sdioh_info_t *sd, bool HSMode); -static int sdspi_card_enablefuncs(sdioh_info_t *sd); -static void sdspi_cmd_getrsp(sdioh_info_t *sd, uint32 *rsp_buffer, int count); -static int sdspi_cmd_issue(sdioh_info_t *sd, bool use_dma, uint32 cmd, uint32 arg, - uint32 *data, uint32 datalen); -static int sdspi_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, - int regsize, uint32 *data); -static int sdspi_card_regwrite(sdioh_info_t *sd, int func, uint32 regaddr, - int regsize, uint32 data); -static int sdspi_driver_init(sdioh_info_t *sd); -static bool sdspi_reset(sdioh_info_t *sd, bool host_reset, bool client_reset); -static int sdspi_card_buf(sdioh_info_t *sd, int rw, int func, bool fifo, - uint32 addr, int nbytes, uint32 *data); -static int sdspi_abort(sdioh_info_t *sd, uint func); - -static int set_client_block_size(sdioh_info_t *sd, int func, int blocksize); - -static uint8 sdspi_crc7(unsigned char* p, uint32 len); -static uint16 sdspi_crc16(unsigned char* p, uint32 len); -static int sdspi_crc_onoff(sdioh_info_t *sd, bool use_crc); - -/* - * Public entry points & extern's - */ -extern sdioh_info_t * -sdioh_attach(osl_t *osh, void *bar0, uint irq) -{ - sdioh_info_t *sd; - - sd_trace(("%s\n", __FUNCTION__)); - if ((sd = (sdioh_info_t *)MALLOC(osh, sizeof(sdioh_info_t))) == NULL) { - sd_err(("sdioh_attach: out of memory, malloced %d bytes\n", MALLOCED(osh))); - return NULL; - } - bzero((char *)sd, sizeof(sdioh_info_t)); - sd->osh = osh; - - if (spi_osinit(sd) != 0) { - sd_err(("%s: spi_osinit() failed\n", __FUNCTION__)); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return NULL; - } - - sd->bar0 = (uintptr)bar0; - sd->irq = irq; - sd->intr_handler = NULL; - sd->intr_handler_arg = NULL; - sd->intr_handler_valid = FALSE; - - /* Set defaults */ - sd->sd_blockmode = FALSE; - sd->use_client_ints = TRUE; - sd->sd_use_dma = FALSE; /* DMA Not supported */ - - /* Haven't figured out how to make bytemode work with dma */ - if (!sd->sd_blockmode) - sd->sd_use_dma = 0; - - if (!spi_hw_attach(sd)) { - sd_err(("%s: spi_hw_attach() failed\n", __FUNCTION__)); - spi_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return NULL; - } - - if (sdspi_driver_init(sd) != SUCCESS) { - if (sdspi_driver_init(sd) != SUCCESS) { - sd_err(("%s:sdspi_driver_init() failed()\n", __FUNCTION__)); - spi_hw_detach(sd); - spi_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return (NULL); - } - } - - if (spi_register_irq(sd, irq) != SUCCESS) { - sd_err(("%s: spi_register_irq() failed for irq = %d\n", __FUNCTION__, irq)); - spi_hw_detach(sd); - spi_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return (NULL); - } - - sd_trace(("%s: Done\n", __FUNCTION__)); - return sd; -} - -extern SDIOH_API_RC -sdioh_detach(osl_t *osh, sdioh_info_t *sd) -{ - sd_trace(("%s\n", __FUNCTION__)); - - if (sd) { - if (sd->card_init_done) - sdspi_reset(sd, 1, 1); - - sd_info(("%s: detaching from hardware\n", __FUNCTION__)); - spi_free_irq(sd->irq, sd); - spi_hw_detach(sd); - spi_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - } - - return SDIOH_API_RC_SUCCESS; -} - -/* Configure callback to client when we recieve client interrupt */ -extern SDIOH_API_RC -sdioh_interrupt_register(sdioh_info_t *sd, sdioh_cb_fn_t fn, void *argh) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - - sd->intr_handler = fn; - sd->intr_handler_arg = argh; - sd->intr_handler_valid = TRUE; - - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_interrupt_deregister(sdioh_info_t *sd) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - - sd->intr_handler_valid = FALSE; - sd->intr_handler = NULL; - sd->intr_handler_arg = NULL; - - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_interrupt_query(sdioh_info_t *sd, bool *onoff) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - - *onoff = sd->client_intr_enabled; - - return SDIOH_API_RC_SUCCESS; -} - -#if defined(DHD_DEBUG) -extern bool -sdioh_interrupt_pending(sdioh_info_t *sd) -{ - return 0; -} -#endif - -uint -sdioh_query_iofnum(sdioh_info_t *sd) -{ - return sd->num_funcs; -} - -/* IOVar table */ -enum { - IOV_MSGLEVEL = 1, - IOV_BLOCKMODE, - IOV_BLOCKSIZE, - IOV_DMA, - IOV_USEINTS, - IOV_NUMINTS, - IOV_NUMLOCALINTS, - IOV_HOSTREG, - IOV_DEVREG, - IOV_DIVISOR, - IOV_SDMODE, - IOV_HISPEED, - IOV_HCIREGS, - IOV_POWER, - IOV_CLOCK, - IOV_CRC -}; - -const bcm_iovar_t sdioh_iovars[] = { - {"sd_msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0 }, - {"sd_blockmode", IOV_BLOCKMODE, 0, IOVT_BOOL, 0 }, - {"sd_blocksize", IOV_BLOCKSIZE, 0, IOVT_UINT32, 0 }, /* ((fn << 16) | size) */ - {"sd_dma", IOV_DMA, 0, IOVT_BOOL, 0 }, - {"sd_ints", IOV_USEINTS, 0, IOVT_BOOL, 0 }, - {"sd_numints", IOV_NUMINTS, 0, IOVT_UINT32, 0 }, - {"sd_numlocalints", IOV_NUMLOCALINTS, 0, IOVT_UINT32, 0 }, - {"sd_hostreg", IOV_HOSTREG, 0, IOVT_BUFFER, sizeof(sdreg_t) }, - {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(sdreg_t) }, - {"sd_divisor", IOV_DIVISOR, 0, IOVT_UINT32, 0 }, - {"sd_power", IOV_POWER, 0, IOVT_UINT32, 0 }, - {"sd_clock", IOV_CLOCK, 0, IOVT_UINT32, 0 }, - {"sd_crc", IOV_CRC, 0, IOVT_UINT32, 0 }, - {"sd_mode", IOV_SDMODE, 0, IOVT_UINT32, 100}, - {"sd_highspeed", IOV_HISPEED, 0, IOVT_UINT32, 0}, - {NULL, 0, 0, 0, 0 } -}; - -int -sdioh_iovar_op(sdioh_info_t *si, const char *name, - void *params, int plen, void *arg, int len, bool set) -{ - const bcm_iovar_t *vi = NULL; - int bcmerror = 0; - int val_size; - int32 int_val = 0; - bool bool_val; - uint32 actionid; - - ASSERT(name); - ASSERT(len >= 0); - - /* Get must have return space; Set does not take qualifiers */ - ASSERT(set || (arg && len)); - ASSERT(!set || (!params && !plen)); - - sd_trace(("%s: Enter (%s %s)\n", __FUNCTION__, (set ? "set" : "get"), name)); - - if ((vi = bcm_iovar_lookup(sdioh_iovars, name)) == NULL) { - bcmerror = BCME_UNSUPPORTED; - goto exit; - } - - if ((bcmerror = bcm_iovar_lencheck(vi, arg, len, set)) != 0) - goto exit; - - /* Set up params so get and set can share the convenience variables */ - if (params == NULL) { - params = arg; - plen = len; - } - - if (vi->type == IOVT_VOID) - val_size = 0; - else if (vi->type == IOVT_BUFFER) - val_size = len; - else - val_size = sizeof(int); - - if (plen >= (int)sizeof(int_val)) - bcopy(params, &int_val, sizeof(int_val)); - - bool_val = (int_val != 0) ? TRUE : FALSE; - - actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid); - switch (actionid) { - case IOV_GVAL(IOV_MSGLEVEL): - int_val = (int32)sd_msglevel; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_MSGLEVEL): - sd_msglevel = int_val; - break; - - case IOV_GVAL(IOV_BLOCKMODE): - int_val = (int32)si->sd_blockmode; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_BLOCKMODE): - si->sd_blockmode = (bool)int_val; - /* Haven't figured out how to make non-block mode with DMA */ - if (!si->sd_blockmode) - si->sd_use_dma = 0; - break; - - case IOV_GVAL(IOV_BLOCKSIZE): - if ((uint32)int_val > si->num_funcs) { - bcmerror = BCME_BADARG; - break; - } - int_val = (int32)si->client_block_size[int_val]; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_BLOCKSIZE): - { - uint func = ((uint32)int_val >> 16); - uint blksize = (uint16)int_val; - uint maxsize; - - if (func > si->num_funcs) { - bcmerror = BCME_BADARG; - break; - } - - switch (func) { - case 0: maxsize = 32; break; - case 1: maxsize = BLOCK_SIZE_4318; break; - case 2: maxsize = BLOCK_SIZE_4328; break; - default: maxsize = 0; - } - if (blksize > maxsize) { - bcmerror = BCME_BADARG; - break; - } - if (!blksize) { - blksize = maxsize; - } - - /* Now set it */ - spi_lock(si); - bcmerror = set_client_block_size(si, func, blksize); - spi_unlock(si); - break; - } - - case IOV_GVAL(IOV_DMA): - int_val = (int32)si->sd_use_dma; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_DMA): - si->sd_use_dma = (bool)int_val; - break; - - case IOV_GVAL(IOV_USEINTS): - int_val = (int32)si->use_client_ints; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_USEINTS): - break; - - case IOV_GVAL(IOV_DIVISOR): - int_val = (uint32)sd_divisor; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_DIVISOR): - sd_divisor = int_val; - if (!spi_start_clock(si, (uint16)sd_divisor)) { - sd_err(("set clock failed!\n")); - bcmerror = BCME_ERROR; - } - break; - - case IOV_GVAL(IOV_POWER): - int_val = (uint32)sd_power; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_POWER): - sd_power = int_val; - break; - - case IOV_GVAL(IOV_CLOCK): - int_val = (uint32)sd_clock; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_CLOCK): - sd_clock = int_val; - break; - - case IOV_GVAL(IOV_CRC): - int_val = (uint32)sd_crc; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_CRC): - /* Apply new setting, but don't change sd_crc until - * after the CRC-mode is selected in the device. This - * is required because the software must generate a - * correct CRC for the CMD59 in order to be able to - * turn OFF the CRC. - */ - sdspi_crc_onoff(si, int_val ? 1 : 0); - sd_crc = int_val; - break; - - case IOV_GVAL(IOV_SDMODE): - int_val = (uint32)sd_sdmode; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_SDMODE): - sd_sdmode = int_val; - break; - - case IOV_GVAL(IOV_HISPEED): - int_val = (uint32)sd_hiok; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_HISPEED): - sd_hiok = int_val; - - if (!sdspi_set_highspeed_mode(si, (bool)sd_hiok)) { - sd_err(("Failed changing highspeed mode to %d.\n", sd_hiok)); - bcmerror = BCME_ERROR; - return ERROR; - } - break; - - case IOV_GVAL(IOV_NUMINTS): - int_val = (int32)si->intrcount; - bcopy(&int_val, arg, val_size); - break; - - case IOV_GVAL(IOV_NUMLOCALINTS): - int_val = (int32)si->local_intrcount; - bcopy(&int_val, arg, val_size); - break; - - case IOV_GVAL(IOV_HOSTREG): - { - break; - } - - case IOV_SVAL(IOV_HOSTREG): - { - sd_err(("IOV_HOSTREG unsupported\n")); - break; - } - - case IOV_GVAL(IOV_DEVREG): - { - sdreg_t *sd_ptr = (sdreg_t *)params; - uint8 data; - - if (sdioh_cfg_read(si, sd_ptr->func, sd_ptr->offset, &data)) { - bcmerror = BCME_SDIO_ERROR; - break; - } - - int_val = (int)data; - bcopy(&int_val, arg, sizeof(int_val)); - break; - } - - case IOV_SVAL(IOV_DEVREG): - { - sdreg_t *sd_ptr = (sdreg_t *)params; - uint8 data = (uint8)sd_ptr->value; - - if (sdioh_cfg_write(si, sd_ptr->func, sd_ptr->offset, &data)) { - bcmerror = BCME_SDIO_ERROR; - break; - } - break; - } - - - default: - bcmerror = BCME_UNSUPPORTED; - break; - } -exit: - - return bcmerror; -} - -extern SDIOH_API_RC -sdioh_cfg_read(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data) -{ - SDIOH_API_RC status; - /* No lock needed since sdioh_request_byte does locking */ - status = sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data); - return status; -} - -extern SDIOH_API_RC -sdioh_cfg_write(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data) -{ - /* No lock needed since sdioh_request_byte does locking */ - SDIOH_API_RC status; - status = sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data); - return status; -} - -extern SDIOH_API_RC -sdioh_cis_read(sdioh_info_t *sd, uint func, uint8 *cisd, uint32 length) -{ - uint32 count; - int offset; - uint32 foo; - uint8 *cis = cisd; - - sd_trace(("%s: Func = %d\n", __FUNCTION__, func)); - - if (!sd->func_cis_ptr[func]) { - bzero(cis, length); - return SDIOH_API_RC_FAIL; - } - - spi_lock(sd); - *cis = 0; - for (count = 0; count < length; count++) { - offset = sd->func_cis_ptr[func] + count; - if (sdspi_card_regread (sd, 0, offset, 1, &foo) < 0) { - sd_err(("%s: regread failed: Can't read CIS\n", __FUNCTION__)); - spi_unlock(sd); - return SDIOH_API_RC_FAIL; - } - *cis = (uint8)(foo & 0xff); - cis++; - } - spi_unlock(sd); - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *byte) -{ - int status; - uint32 cmd_arg; - uint32 rsp5; - - spi_lock(sd); - - cmd_arg = 0; - cmd_arg = SFIELD(cmd_arg, CMD52_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, CMD52_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, CMD52_RW_FLAG, rw == SDIOH_READ ? 0 : 1); - cmd_arg = SFIELD(cmd_arg, CMD52_RAW, 0); - cmd_arg = SFIELD(cmd_arg, CMD52_DATA, rw == SDIOH_READ ? 0 : *byte); - - sd_trace(("%s: rw=%d, func=%d, regaddr=0x%08x\n", __FUNCTION__, rw, func, regaddr)); - - if ((status = sdspi_cmd_issue(sd, sd->sd_use_dma, - SDIOH_CMD_52, cmd_arg, NULL, 0)) != SUCCESS) { - spi_unlock(sd); - return status; - } - - sdspi_cmd_getrsp(sd, &rsp5, 1); - if (rsp5 != 0x00) { - sd_err(("%s: rsp5 flags is 0x%x func=%d\n", - __FUNCTION__, rsp5, func)); - /* ASSERT(0); */ - spi_unlock(sd); - return SDIOH_API_RC_FAIL; - } - - if (rw == SDIOH_READ) - *byte = sd->card_rsp_data >> 24; - - spi_unlock(sd); - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, uint addr, - uint32 *word, uint nbytes) -{ - int status; - - spi_lock(sd); - - if (rw == SDIOH_READ) - status = sdspi_card_regread(sd, func, addr, nbytes, word); - else - status = sdspi_card_regwrite(sd, func, addr, nbytes, *word); - - spi_unlock(sd); - return (status == SUCCESS ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL); -} - -extern SDIOH_API_RC -sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint rw, uint func, - uint addr, uint reg_width, uint buflen_u, uint8 *buffer, void *pkt) -{ - int len; - int buflen = (int)buflen_u; - bool fifo = (fix_inc == SDIOH_DATA_FIX); - - spi_lock(sd); - - ASSERT(reg_width == 4); - ASSERT(buflen_u < (1 << 30)); - ASSERT(sd->client_block_size[func]); - - sd_data(("%s: %c len %d r_cnt %d t_cnt %d, pkt @0x%p\n", - __FUNCTION__, rw == SDIOH_READ ? 'R' : 'W', - buflen_u, sd->r_cnt, sd->t_cnt, pkt)); - - /* Break buffer down into blocksize chunks: - * Bytemode: 1 block at a time. - */ - while (buflen > 0) { - if (sd->sd_blockmode) { - /* Max xfer is Page size */ - len = MIN(SD_PAGE, buflen); - - /* Round down to a block boundry */ - if (buflen > sd->client_block_size[func]) - len = (len/sd->client_block_size[func]) * - sd->client_block_size[func]; - } else { - /* Byte mode: One block at a time */ - len = MIN(sd->client_block_size[func], buflen); - } - - if (sdspi_card_buf(sd, rw, func, fifo, addr, len, (uint32 *)buffer) != SUCCESS) { - spi_unlock(sd); - return SDIOH_API_RC_FAIL; - } - buffer += len; - buflen -= len; - if (!fifo) - addr += len; - } - spi_unlock(sd); - return SDIOH_API_RC_SUCCESS; -} - -static int -sdspi_abort(sdioh_info_t *sd, uint func) -{ - uint8 spi_databuf[] = { 0x74, 0x80, 0x00, 0x0C, 0xFF, 0x95, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - uint8 spi_rspbuf[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - int err = 0; - - sd_err(("Sending SPI Abort to F%d\n", func)); - spi_databuf[4] = func & 0x7; - /* write to function 0, addr 6 (IOABORT) func # in 3 LSBs. */ - spi_sendrecv(sd, spi_databuf, spi_rspbuf, sizeof(spi_databuf)); - - return err; -} - -extern int -sdioh_abort(sdioh_info_t *sd, uint fnum) -{ - int ret; - - spi_lock(sd); - ret = sdspi_abort(sd, fnum); - spi_unlock(sd); - - return ret; -} - -int -sdioh_start(sdioh_info_t *sd, int stage) -{ - return SUCCESS; -} - -int -sdioh_stop(sdioh_info_t *sd) -{ - return SUCCESS; -} - - -/* - * Private/Static work routines - */ -static bool -sdspi_reset(sdioh_info_t *sd, bool host_reset, bool client_reset) -{ - if (!sd) - return TRUE; - - spi_lock(sd); - /* Reset client card */ - if (client_reset && (sd->adapter_slot != -1)) { - if (sdspi_card_regwrite(sd, 0, SDIOD_CCCR_IOABORT, 1, 0x8) != SUCCESS) - sd_err(("%s: Cannot write to card reg 0x%x\n", - __FUNCTION__, SDIOD_CCCR_IOABORT)); - else - sd->card_rca = 0; - } - - /* The host reset is a NOP in the sd-spi case. */ - if (host_reset) { - sd->sd_mode = SDIOH_MODE_SPI; - } - spi_unlock(sd); - return TRUE; -} - -static int -sdspi_host_init(sdioh_info_t *sd) -{ - sdspi_reset(sd, 1, 0); - - /* Default power on mode is SD1 */ - sd->sd_mode = SDIOH_MODE_SPI; - sd->polled_mode = TRUE; - sd->host_init_done = TRUE; - sd->card_init_done = FALSE; - sd->adapter_slot = 1; - - return (SUCCESS); -} - -#define CMD0_RETRIES 3 -#define CMD5_RETRIES 10 - -static int -get_ocr(sdioh_info_t *sd, uint32 *cmd_arg, uint32 *cmd_rsp) -{ - uint32 rsp5; - int retries, status; - - /* First issue a CMD0 to get the card into SPI mode. */ - for (retries = 0; retries <= CMD0_RETRIES; retries++) { - if ((status = sdspi_cmd_issue(sd, sd->sd_use_dma, - SDIOH_CMD_0, *cmd_arg, NULL, 0)) != SUCCESS) { - sd_err(("%s: No response to CMD0\n", __FUNCTION__)); - continue; - } - - sdspi_cmd_getrsp(sd, &rsp5, 1); - - if (GFIELD(rsp5, SPI_RSP_ILL_CMD)) { - printf("%s: Card already initialized (continuing)\n", __FUNCTION__); - break; - } - - if (GFIELD(rsp5, SPI_RSP_IDLE)) { - printf("%s: Card in SPI mode\n", __FUNCTION__); - break; - } - } - - if (retries > CMD0_RETRIES) { - sd_err(("%s: Too many retries for CMD0\n", __FUNCTION__)); - return ERROR; - } - - /* Get the Card's Operation Condition. */ - /* Occasionally the board takes a while to become ready. */ - for (retries = 0; retries <= CMD5_RETRIES; retries++) { - if ((status = sdspi_cmd_issue(sd, sd->sd_use_dma, - SDIOH_CMD_5, *cmd_arg, NULL, 0)) != SUCCESS) { - sd_err(("%s: No response to CMD5\n", __FUNCTION__)); - continue; - } - - printf("CMD5 response data was: 0x%08x\n", sd->card_rsp_data); - - if (GFIELD(sd->card_rsp_data, RSP4_CARD_READY)) { - printf("%s: Card ready\n", __FUNCTION__); - break; - } - } - - if (retries > CMD5_RETRIES) { - sd_err(("%s: Too many retries for CMD5\n", __FUNCTION__)); - return ERROR; - } - - *cmd_rsp = sd->card_rsp_data; - - sdspi_crc_onoff(sd, sd_crc ? 1 : 0); - - return (SUCCESS); -} - -static int -sdspi_crc_onoff(sdioh_info_t *sd, bool use_crc) -{ - uint32 args; - int status; - - args = use_crc ? 1 : 0; - if ((status = sdspi_cmd_issue(sd, sd->sd_use_dma, - SDIOH_CMD_59, args, NULL, 0)) != SUCCESS) { - sd_err(("%s: No response to CMD59\n", __FUNCTION__)); - } - - sd_info(("CMD59 response data was: 0x%08x\n", sd->card_rsp_data)); - - sd_err(("SD-SPI CRC turned %s\n", use_crc ? "ON" : "OFF")); - return (SUCCESS); -} - -static int -sdspi_client_init(sdioh_info_t *sd) -{ - uint8 fn_ints; - - sd_trace(("%s: Powering up slot %d\n", __FUNCTION__, sd->adapter_slot)); - - /* Start at ~400KHz clock rate for initialization */ - if (!spi_start_clock(sd, 128)) { - sd_err(("spi_start_clock failed\n")); - return ERROR; - } - - if (!sdspi_start_power(sd)) { - sd_err(("sdspi_start_power failed\n")); - return ERROR; - } - - if (sd->num_funcs == 0) { - sd_err(("%s: No IO funcs!\n", __FUNCTION__)); - return ERROR; - } - - sdspi_card_enablefuncs(sd); - - set_client_block_size(sd, 1, BLOCK_SIZE_4318); - fn_ints = INTR_CTL_FUNC1_EN; - - if (sd->num_funcs >= 2) { - set_client_block_size(sd, 2, sd_f2_blocksize /* BLOCK_SIZE_4328 */); - fn_ints |= INTR_CTL_FUNC2_EN; - } - - /* Enable/Disable Client interrupts */ - /* Turn on here but disable at host controller */ - if (sdspi_card_regwrite(sd, 0, SDIOD_CCCR_INTEN, 1, - (fn_ints | INTR_CTL_MASTER_EN)) != SUCCESS) { - sd_err(("%s: Could not enable ints in CCCR\n", __FUNCTION__)); - return ERROR; - } - - /* Switch to High-speed clocking mode if both host and device support it */ - sdspi_set_highspeed_mode(sd, (bool)sd_hiok); - - /* After configuring for High-Speed mode, set the desired clock rate. */ - if (!spi_start_clock(sd, (uint16)sd_divisor)) { - sd_err(("spi_start_clock failed\n")); - return ERROR; - } - - sd->card_init_done = TRUE; - - return SUCCESS; -} - -static int -sdspi_set_highspeed_mode(sdioh_info_t *sd, bool HSMode) -{ - uint32 regdata; - int status; - bool hsmode; - - if (HSMode == TRUE) { - - sd_err(("Attempting to enable High-Speed mode.\n")); - - if ((status = sdspi_card_regread(sd, 0, SDIOD_CCCR_SPEED_CONTROL, - 1, ®data)) != SUCCESS) { - return status; - } - if (regdata & SDIO_SPEED_SHS) { - sd_err(("Device supports High-Speed mode.\n")); - - regdata |= SDIO_SPEED_EHS; - - sd_err(("Writing %08x to Card at %08x\n", - regdata, SDIOD_CCCR_SPEED_CONTROL)); - if ((status = sdspi_card_regwrite(sd, 0, SDIOD_CCCR_SPEED_CONTROL, - 1, regdata)) != BCME_OK) { - return status; - } - - hsmode = 1; - - sd_err(("High-speed clocking mode enabled.\n")); - } - else { - sd_err(("Device does not support High-Speed Mode.\n")); - hsmode = 0; - } - } else { - if ((status = sdspi_card_regread(sd, 0, SDIOD_CCCR_SPEED_CONTROL, - 1, ®data)) != SUCCESS) { - return status; - } - - regdata = ~SDIO_SPEED_EHS; - - sd_err(("Writing %08x to Card at %08x\n", - regdata, SDIOD_CCCR_SPEED_CONTROL)); - if ((status = sdspi_card_regwrite(sd, 0, SDIOD_CCCR_SPEED_CONTROL, - 1, regdata)) != BCME_OK) { - return status; - } - - sd_err(("Low-speed clocking mode enabled.\n")); - hsmode = 0; - } - - spi_controller_highspeed_mode(sd, hsmode); - - return TRUE; -} - -bool -sdspi_start_power(sdioh_info_t *sd) -{ - uint32 cmd_arg; - uint32 cmd_rsp; - - sd_trace(("%s\n", __FUNCTION__)); - - /* Get the Card's Operation Condition. Occasionally the board - * takes a while to become ready - */ - - cmd_arg = 0; - if (get_ocr(sd, &cmd_arg, &cmd_rsp) != SUCCESS) { - sd_err(("%s: Failed to get OCR; bailing\n", __FUNCTION__)); - return FALSE; - } - - sd_err(("mem_present = %d\n", GFIELD(cmd_rsp, RSP4_MEM_PRESENT))); - sd_err(("num_funcs = %d\n", GFIELD(cmd_rsp, RSP4_NUM_FUNCS))); - sd_err(("card_ready = %d\n", GFIELD(cmd_rsp, RSP4_CARD_READY))); - sd_err(("OCR = 0x%x\n", GFIELD(cmd_rsp, RSP4_IO_OCR))); - - /* Verify that the card supports I/O mode */ - if (GFIELD(cmd_rsp, RSP4_NUM_FUNCS) == 0) { - sd_err(("%s: Card does not support I/O\n", __FUNCTION__)); - return ERROR; - } - - sd->num_funcs = GFIELD(cmd_rsp, RSP4_NUM_FUNCS); - - /* Examine voltage: Arasan only supports 3.3 volts, - * so look for 3.2-3.3 Volts and also 3.3-3.4 volts. - */ - - if ((GFIELD(cmd_rsp, RSP4_IO_OCR) & (0x3 << 20)) == 0) { - sd_err(("This client does not support 3.3 volts!\n")); - return ERROR; - } - - - return TRUE; -} - -static int -sdspi_driver_init(sdioh_info_t *sd) -{ - sd_trace(("%s\n", __FUNCTION__)); - - if ((sdspi_host_init(sd)) != SUCCESS) { - return ERROR; - } - - if (sdspi_client_init(sd) != SUCCESS) { - return ERROR; - } - - return SUCCESS; -} - -static int -sdspi_card_enablefuncs(sdioh_info_t *sd) -{ - int status; - uint32 regdata; - uint32 regaddr, fbraddr; - uint8 func; - uint8 *ptr; - - sd_trace(("%s\n", __FUNCTION__)); - /* Get the Card's common CIS address */ - ptr = (uint8 *) &sd->com_cis_ptr; - for (regaddr = SDIOD_CCCR_CISPTR_0; regaddr <= SDIOD_CCCR_CISPTR_2; regaddr++) { - if ((status = sdspi_card_regread (sd, 0, regaddr, 1, ®data)) != SUCCESS) - return status; - - *ptr++ = (uint8) regdata; - } - - /* Only the lower 17-bits are valid */ - sd->com_cis_ptr &= 0x0001FFFF; - sd->func_cis_ptr[0] = sd->com_cis_ptr; - sd_info(("%s: Card's Common CIS Ptr = 0x%x\n", __FUNCTION__, sd->com_cis_ptr)); - - /* Get the Card's function CIS (for each function) */ - for (fbraddr = SDIOD_FBR_STARTADDR, func = 1; - func <= sd->num_funcs; func++, fbraddr += SDIOD_FBR_SIZE) { - ptr = (uint8 *) &sd->func_cis_ptr[func]; - for (regaddr = SDIOD_FBR_CISPTR_0; regaddr <= SDIOD_FBR_CISPTR_2; regaddr++) { - if ((status = sdspi_card_regread (sd, 0, regaddr + fbraddr, 1, ®data)) - != SUCCESS) - return status; - - *ptr++ = (uint8) regdata; - } - - /* Only the lower 17-bits are valid */ - sd->func_cis_ptr[func] &= 0x0001FFFF; - sd_info(("%s: Function %d CIS Ptr = 0x%x\n", - __FUNCTION__, func, sd->func_cis_ptr[func])); - } - - sd_info(("%s: write ESCI bit\n", __FUNCTION__)); - /* Enable continuous SPI interrupt (ESCI bit) */ - sdspi_card_regwrite(sd, 0, SDIOD_CCCR_BICTRL, 1, 0x60); - - sd_info(("%s: enable f1\n", __FUNCTION__)); - /* Enable function 1 on the card */ - regdata = SDIO_FUNC_ENABLE_1; - if ((status = sdspi_card_regwrite(sd, 0, SDIOD_CCCR_IOEN, 1, regdata)) != SUCCESS) - return status; - - sd_info(("%s: done\n", __FUNCTION__)); - return SUCCESS; -} - -/* Read client card reg */ -static int -sdspi_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 *data) -{ - int status; - uint32 cmd_arg; - uint32 rsp5; - - cmd_arg = 0; - - if ((func == 0) || (regsize == 1)) { - cmd_arg = SFIELD(cmd_arg, CMD52_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, CMD52_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, CMD52_RW_FLAG, SDIOH_XFER_TYPE_READ); - cmd_arg = SFIELD(cmd_arg, CMD52_RAW, 0); - cmd_arg = SFIELD(cmd_arg, CMD52_DATA, 0); - - if ((status = sdspi_cmd_issue(sd, sd->sd_use_dma, SDIOH_CMD_52, cmd_arg, NULL, 0)) - != SUCCESS) - return status; - - sdspi_cmd_getrsp(sd, &rsp5, 1); - - if (rsp5 != 0x00) - sd_err(("%s: rsp5 flags is 0x%x\t %d\n", - __FUNCTION__, rsp5, func)); - - *data = sd->card_rsp_data >> 24; - } else { - cmd_arg = SFIELD(cmd_arg, CMD53_BYTE_BLK_CNT, regsize); - cmd_arg = SFIELD(cmd_arg, CMD53_OP_CODE, 1); - cmd_arg = SFIELD(cmd_arg, CMD53_BLK_MODE, 0); - cmd_arg = SFIELD(cmd_arg, CMD53_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, CMD53_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, CMD53_RW_FLAG, SDIOH_XFER_TYPE_READ); - - sd->data_xfer_count = regsize; - - /* sdspi_cmd_issue() returns with the command complete bit - * in the ISR already cleared - */ - if ((status = sdspi_cmd_issue(sd, sd->sd_use_dma, SDIOH_CMD_53, cmd_arg, NULL, 0)) - != SUCCESS) - return status; - - sdspi_cmd_getrsp(sd, &rsp5, 1); - - if (rsp5 != 0x00) - sd_err(("%s: rsp5 flags is 0x%x\t %d\n", - __FUNCTION__, rsp5, func)); - - *data = sd->card_rsp_data; - if (regsize == 2) { - *data &= 0xffff; - } - - sd_info(("%s: CMD53 func %d, addr 0x%x, size %d, data 0x%08x\n", - __FUNCTION__, func, regaddr, regsize, *data)); - - - } - - return SUCCESS; -} - -/* write a client register */ -static int -sdspi_card_regwrite(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 data) -{ - int status; - uint32 cmd_arg, rsp5, flags; - - cmd_arg = 0; - - if ((func == 0) || (regsize == 1)) { - cmd_arg = SFIELD(cmd_arg, CMD52_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, CMD52_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, CMD52_RW_FLAG, SDIOH_XFER_TYPE_WRITE); - cmd_arg = SFIELD(cmd_arg, CMD52_RAW, 0); - cmd_arg = SFIELD(cmd_arg, CMD52_DATA, data & 0xff); - if ((status = sdspi_cmd_issue(sd, sd->sd_use_dma, SDIOH_CMD_52, cmd_arg, NULL, 0)) - != SUCCESS) - return status; - - sdspi_cmd_getrsp(sd, &rsp5, 1); - flags = GFIELD(rsp5, RSP5_FLAGS); - if (flags && (flags != 0x10)) - sd_err(("%s: rsp5.rsp5.flags = 0x%x, expecting 0x10\n", - __FUNCTION__, flags)); - } - else { - cmd_arg = SFIELD(cmd_arg, CMD53_BYTE_BLK_CNT, regsize); - cmd_arg = SFIELD(cmd_arg, CMD53_OP_CODE, 1); - cmd_arg = SFIELD(cmd_arg, CMD53_BLK_MODE, 0); - cmd_arg = SFIELD(cmd_arg, CMD53_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, CMD53_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, CMD53_RW_FLAG, SDIOH_XFER_TYPE_WRITE); - - sd->data_xfer_count = regsize; - sd->cmd53_wr_data = data; - - sd_info(("%s: CMD53 func %d, addr 0x%x, size %d, data 0x%08x\n", - __FUNCTION__, func, regaddr, regsize, data)); - - /* sdspi_cmd_issue() returns with the command complete bit - * in the ISR already cleared - */ - if ((status = sdspi_cmd_issue(sd, sd->sd_use_dma, SDIOH_CMD_53, cmd_arg, NULL, 0)) - != SUCCESS) - return status; - - sdspi_cmd_getrsp(sd, &rsp5, 1); - - if (rsp5 != 0x00) - sd_err(("%s: rsp5 flags = 0x%x, expecting 0x00\n", - __FUNCTION__, rsp5)); - - } - return SUCCESS; -} - -void -sdspi_cmd_getrsp(sdioh_info_t *sd, uint32 *rsp_buffer, int count /* num 32 bit words */) -{ - *rsp_buffer = sd->card_response; -} - -int max_errors = 0; - -#define SPI_MAX_PKT_LEN 768 -uint8 spi_databuf[SPI_MAX_PKT_LEN]; -uint8 spi_rspbuf[SPI_MAX_PKT_LEN]; - -/* datalen is used for CMD53 length only (0 for sd->data_xfer_count) */ -static int -sdspi_cmd_issue(sdioh_info_t *sd, bool use_dma, uint32 cmd, uint32 arg, - uint32 *data, uint32 datalen) -{ - uint32 cmd_reg; - uint32 cmd_arg = arg; - uint8 cmd_crc = 0x95; /* correct CRC for CMD0 and don't care for others. */ - uint16 dat_crc; - uint8 cmd52data = 0; - uint32 i, j; - uint32 spi_datalen = 0; - uint32 spi_pre_cmd_pad = 0; - uint32 spi_max_response_pad = 128; - - cmd_reg = 0; - cmd_reg = SFIELD(cmd_reg, SPI_DIR, 1); - cmd_reg = SFIELD(cmd_reg, SPI_CMD_INDEX, cmd); - - if (GFIELD(cmd_arg, CMD52_RW_FLAG) == 1) { /* Same for CMD52 and CMD53 */ - cmd_reg = SFIELD(cmd_reg, SPI_RW, 1); - } - - switch (cmd) { - case SDIOH_CMD_59: /* CRC_ON_OFF (SPI Mode Only) - Response R1 */ - cmd52data = arg & 0x1; - case SDIOH_CMD_0: /* Set Card to Idle State - No Response */ - case SDIOH_CMD_5: /* Send Operation condition - Response R4 */ - sd_trace(("%s: CMD%d\n", __FUNCTION__, cmd)); - spi_datalen = 44; - spi_pre_cmd_pad = 12; - spi_max_response_pad = 28; - break; - - case SDIOH_CMD_3: /* Ask card to send RCA - Response R6 */ - case SDIOH_CMD_7: /* Select card - Response R1 */ - case SDIOH_CMD_15: /* Set card to inactive state - Response None */ - sd_err(("%s: CMD%d is invalid for SPI Mode.\n", __FUNCTION__, cmd)); - return ERROR; - break; - - case SDIOH_CMD_52: /* IO R/W Direct (single byte) - Response R5 */ - cmd52data = GFIELD(cmd_arg, CMD52_DATA); - cmd_arg = arg; - cmd_reg = SFIELD(cmd_reg, SPI_FUNC, GFIELD(cmd_arg, CMD52_FUNCTION)); - cmd_reg = SFIELD(cmd_reg, SPI_ADDR, GFIELD(cmd_arg, CMD52_REG_ADDR)); - /* Display trace for byte write */ - if (GFIELD(cmd_arg, CMD52_RW_FLAG) == 1) { - sd_trace(("%s: CMD52: Wr F:%d @0x%04x=%02x\n", - __FUNCTION__, - GFIELD(cmd_arg, CMD52_FUNCTION), - GFIELD(cmd_arg, CMD52_REG_ADDR), - cmd52data)); - } - - spi_datalen = 32; - spi_max_response_pad = 28; - - break; - case SDIOH_CMD_53: /* IO R/W Extended (multiple bytes/blocks) */ - cmd_arg = arg; - cmd_reg = SFIELD(cmd_reg, SPI_FUNC, GFIELD(cmd_arg, CMD53_FUNCTION)); - cmd_reg = SFIELD(cmd_reg, SPI_ADDR, GFIELD(cmd_arg, CMD53_REG_ADDR)); - cmd_reg = SFIELD(cmd_reg, SPI_BLKMODE, 0); - cmd_reg = SFIELD(cmd_reg, SPI_OPCODE, GFIELD(cmd_arg, CMD53_OP_CODE)); - cmd_reg = SFIELD(cmd_reg, SPI_STUFF0, (sd->data_xfer_count>>8)); - cmd52data = (uint8)sd->data_xfer_count; - - /* Set upper bit in byte count if necessary, but don't set it for 512 bytes. */ - if ((sd->data_xfer_count > 255) && (sd->data_xfer_count < 512)) { - cmd_reg |= 1; - } - - if (GFIELD(cmd_reg, SPI_RW) == 1) { /* Write */ - spi_max_response_pad = 32; - spi_datalen = (sd->data_xfer_count + spi_max_response_pad) & 0xFFFC; - } else { /* Read */ - - spi_max_response_pad = 32; - spi_datalen = (sd->data_xfer_count + spi_max_response_pad) & 0xFFFC; - } - sd_trace(("%s: CMD53: %s F:%d @0x%04x len=0x%02x\n", - __FUNCTION__, - (GFIELD(cmd_reg, SPI_RW) == 1 ? "Wr" : "Rd"), - GFIELD(cmd_arg, CMD53_FUNCTION), - GFIELD(cmd_arg, CMD53_REG_ADDR), - cmd52data)); - break; - - default: - sd_err(("%s: Unknown command %d\n", __FUNCTION__, cmd)); - return ERROR; - } - - /* Set up and issue the SDIO command */ - memset(spi_databuf, SDSPI_IDLE_PAD, spi_datalen); - spi_databuf[spi_pre_cmd_pad + 0] = (cmd_reg & 0xFF000000) >> 24; - spi_databuf[spi_pre_cmd_pad + 1] = (cmd_reg & 0x00FF0000) >> 16; - spi_databuf[spi_pre_cmd_pad + 2] = (cmd_reg & 0x0000FF00) >> 8; - spi_databuf[spi_pre_cmd_pad + 3] = (cmd_reg & 0x000000FF); - spi_databuf[spi_pre_cmd_pad + 4] = cmd52data; - - /* Generate CRC7 for command, if CRC is enabled, otherwise, a - * default CRC7 of 0x95, which is correct for CMD0, is used. - */ - if (sd_crc) { - cmd_crc = sdspi_crc7(&spi_databuf[spi_pre_cmd_pad], 5); - } - spi_databuf[spi_pre_cmd_pad + 5] = cmd_crc; -#define SPI_STOP_TRAN 0xFD - - /* for CMD53 Write, put the data into the output buffer */ - if ((cmd == SDIOH_CMD_53) && (GFIELD(cmd_arg, CMD53_RW_FLAG) == 1)) { - if (datalen != 0) { - spi_databuf[spi_pre_cmd_pad + 9] = SDSPI_IDLE_PAD; - spi_databuf[spi_pre_cmd_pad + 10] = SDSPI_START_BLOCK; - - for (i = 0; i < sd->data_xfer_count; i++) { - spi_databuf[i + 11 + spi_pre_cmd_pad] = ((uint8 *)data)[i]; - } - if (sd_crc) { - dat_crc = sdspi_crc16(&spi_databuf[spi_pre_cmd_pad+11], i); - } else { - dat_crc = 0xAAAA; - } - spi_databuf[i + 11 + spi_pre_cmd_pad] = (dat_crc >> 8) & 0xFF; - spi_databuf[i + 12 + spi_pre_cmd_pad] = dat_crc & 0xFF; - } else if (sd->data_xfer_count == 2) { - spi_databuf[spi_pre_cmd_pad + 9] = SDSPI_IDLE_PAD; - spi_databuf[spi_pre_cmd_pad + 10] = SDSPI_START_BLOCK; - spi_databuf[spi_pre_cmd_pad + 11] = sd->cmd53_wr_data & 0xFF; - spi_databuf[spi_pre_cmd_pad + 12] = (sd->cmd53_wr_data & 0x0000FF00) >> 8; - if (sd_crc) { - dat_crc = sdspi_crc16(&spi_databuf[spi_pre_cmd_pad+11], 2); - } else { - dat_crc = 0x22AA; - } - spi_databuf[spi_pre_cmd_pad + 13] = (dat_crc >> 8) & 0xFF; - spi_databuf[spi_pre_cmd_pad + 14] = (dat_crc & 0xFF); - } else if (sd->data_xfer_count == 4) { - spi_databuf[spi_pre_cmd_pad + 9] = SDSPI_IDLE_PAD; - spi_databuf[spi_pre_cmd_pad + 10] = SDSPI_START_BLOCK; - spi_databuf[spi_pre_cmd_pad + 11] = sd->cmd53_wr_data & 0xFF; - spi_databuf[spi_pre_cmd_pad + 12] = (sd->cmd53_wr_data & 0x0000FF00) >> 8; - spi_databuf[spi_pre_cmd_pad + 13] = (sd->cmd53_wr_data & 0x00FF0000) >> 16; - spi_databuf[spi_pre_cmd_pad + 14] = (sd->cmd53_wr_data & 0xFF000000) >> 24; - if (sd_crc) { - dat_crc = sdspi_crc16(&spi_databuf[spi_pre_cmd_pad+11], 4); - } else { - dat_crc = 0x44AA; - } - spi_databuf[spi_pre_cmd_pad + 15] = (dat_crc >> 8) & 0xFF; - spi_databuf[spi_pre_cmd_pad + 16] = (dat_crc & 0xFF); - } else { - printf("CMD53 Write: size %d unsupported\n", sd->data_xfer_count); - } - } - - spi_sendrecv(sd, spi_databuf, spi_rspbuf, spi_datalen); - - for (i = spi_pre_cmd_pad + SDSPI_COMMAND_LEN; i < spi_max_response_pad; i++) { - if ((spi_rspbuf[i] & SDSPI_START_BIT_MASK) == 0) { - break; - } - } - - if (i == spi_max_response_pad) { - sd_err(("%s: Did not get a response for CMD%d\n", __FUNCTION__, cmd)); - return ERROR; - } - - /* Extract the response. */ - sd->card_response = spi_rspbuf[i]; - - /* for CMD53 Read, find the start of the response data... */ - if ((cmd == SDIOH_CMD_53) && (GFIELD(cmd_arg, CMD52_RW_FLAG) == 0)) { - for (; i < spi_max_response_pad; i++) { - if (spi_rspbuf[i] == SDSPI_START_BLOCK) { - break; - } - } - - if (i == spi_max_response_pad) { - printf("Did not get a start of data phase for CMD%d\n", cmd); - max_errors++; - sdspi_abort(sd, GFIELD(cmd_arg, CMD53_FUNCTION)); - } - sd->card_rsp_data = spi_rspbuf[i+1]; - sd->card_rsp_data |= spi_rspbuf[i+2] << 8; - sd->card_rsp_data |= spi_rspbuf[i+3] << 16; - sd->card_rsp_data |= spi_rspbuf[i+4] << 24; - - if (datalen != 0) { - i++; - for (j = 0; j < sd->data_xfer_count; j++) { - ((uint8 *)data)[j] = spi_rspbuf[i+j]; - } - if (sd_crc) { - uint16 recv_crc; - - recv_crc = spi_rspbuf[i+j] << 8 | spi_rspbuf[i+j+1]; - dat_crc = sdspi_crc16((uint8 *)data, datalen); - if (dat_crc != recv_crc) { - sd_err(("%s: Incorrect data CRC: expected 0x%04x, " - "received 0x%04x\n", - __FUNCTION__, dat_crc, recv_crc)); - } - } - } - return SUCCESS; - } - - sd->card_rsp_data = spi_rspbuf[i+4]; - sd->card_rsp_data |= spi_rspbuf[i+3] << 8; - sd->card_rsp_data |= spi_rspbuf[i+2] << 16; - sd->card_rsp_data |= spi_rspbuf[i+1] << 24; - - /* Display trace for byte read */ - if ((cmd == SDIOH_CMD_52) && (GFIELD(cmd_arg, CMD52_RW_FLAG) == 0)) { - sd_trace(("%s: CMD52: Rd F:%d @0x%04x=%02x\n", - __FUNCTION__, - GFIELD(cmd_arg, CMD53_FUNCTION), - GFIELD(cmd_arg, CMD53_REG_ADDR), - sd->card_rsp_data >> 24)); - } - - return SUCCESS; -} - -/* - * On entry: if single-block or non-block, buffer size <= block size. - * If multi-block, buffer size is unlimited. - * Question is how to handle the left-overs in either single- or multi-block. - * I think the caller should break the buffer up so this routine will always - * use block size == buffer size to handle the end piece of the buffer - */ - -static int -sdspi_card_buf(sdioh_info_t *sd, int rw, int func, bool fifo, uint32 addr, int nbytes, uint32 *data) -{ - int status; - uint32 cmd_arg; - uint32 rsp5; - int num_blocks, blocksize; - bool local_blockmode, local_dma; - bool read = rw == SDIOH_READ ? 1 : 0; - - ASSERT(nbytes); - - cmd_arg = 0; - sd_data(("%s: %s 53 func %d, %s, addr 0x%x, len %d bytes, r_cnt %d t_cnt %d\n", - __FUNCTION__, read ? "Rd" : "Wr", func, fifo ? "FIXED" : "INCR", - addr, nbytes, sd->r_cnt, sd->t_cnt)); - - if (read) sd->r_cnt++; else sd->t_cnt++; - - local_blockmode = sd->sd_blockmode; - local_dma = sd->sd_use_dma; - - /* Don't bother with block mode on small xfers */ - if (nbytes < sd->client_block_size[func]) { - sd_info(("setting local blockmode to false: nbytes (%d) != block_size (%d)\n", - nbytes, sd->client_block_size[func])); - local_blockmode = FALSE; - local_dma = FALSE; - } - - if (local_blockmode) { - blocksize = MIN(sd->client_block_size[func], nbytes); - num_blocks = nbytes/blocksize; - cmd_arg = SFIELD(cmd_arg, CMD53_BYTE_BLK_CNT, num_blocks); - cmd_arg = SFIELD(cmd_arg, CMD53_BLK_MODE, 1); - } else { - num_blocks = 1; - blocksize = nbytes; - cmd_arg = SFIELD(cmd_arg, CMD53_BYTE_BLK_CNT, nbytes); - cmd_arg = SFIELD(cmd_arg, CMD53_BLK_MODE, 0); - } - - if (fifo) - cmd_arg = SFIELD(cmd_arg, CMD53_OP_CODE, 0); - else - cmd_arg = SFIELD(cmd_arg, CMD53_OP_CODE, 1); - - cmd_arg = SFIELD(cmd_arg, CMD53_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, CMD53_REG_ADDR, addr); - if (read) - cmd_arg = SFIELD(cmd_arg, CMD53_RW_FLAG, SDIOH_XFER_TYPE_READ); - else - cmd_arg = SFIELD(cmd_arg, CMD53_RW_FLAG, SDIOH_XFER_TYPE_WRITE); - - sd->data_xfer_count = nbytes; - if ((func == 2) && (fifo == 1)) { - sd_data(("%s: %s 53 func %d, %s, addr 0x%x, len %d bytes, r_cnt %d t_cnt %d\n", - __FUNCTION__, read ? "Rd" : "Wr", func, fifo ? "FIXED" : "INCR", - addr, nbytes, sd->r_cnt, sd->t_cnt)); - } - - /* sdspi_cmd_issue() returns with the command complete bit - * in the ISR already cleared - */ - if ((status = sdspi_cmd_issue(sd, local_dma, - SDIOH_CMD_53, cmd_arg, - data, nbytes)) != SUCCESS) { - sd_err(("%s: cmd_issue failed for %s\n", __FUNCTION__, (read ? "read" : "write"))); - return status; - } - - sdspi_cmd_getrsp(sd, &rsp5, 1); - - if (rsp5 != 0x00) { - sd_err(("%s: rsp5 flags = 0x%x, expecting 0x00\n", - __FUNCTION__, rsp5)); - return ERROR; - } - - return SUCCESS; -} - -static int -set_client_block_size(sdioh_info_t *sd, int func, int block_size) -{ - int base; - int err = 0; - - sd_err(("%s: Setting block size %d, func %d\n", __FUNCTION__, block_size, func)); - sd->client_block_size[func] = block_size; - - /* Set the block size in the SDIO Card register */ - base = func * SDIOD_FBR_SIZE; - err = sdspi_card_regwrite(sd, 0, base + SDIOD_CCCR_BLKSIZE_0, 1, block_size & 0xff); - if (!err) { - err = sdspi_card_regwrite(sd, 0, base + SDIOD_CCCR_BLKSIZE_1, 1, - (block_size >> 8) & 0xff); - } - - /* - * Do not set the block size in the SDIO Host register; that - * is func dependent and will get done on an individual - * transaction basis. - */ - - return (err ? BCME_SDIO_ERROR : 0); -} - -/* Reset and re-initialize the device */ -int -sdioh_sdio_reset(sdioh_info_t *si) -{ - si->card_init_done = FALSE; - return sdspi_client_init(si); -} - -#define CRC7_POLYNOM 0x09 -#define CRC7_CRCHIGHBIT 0x40 - -static uint8 sdspi_crc7(unsigned char* p, uint32 len) -{ - uint8 c, j, bit, crc = 0; - uint32 i; - - for (i = 0; i < len; i++) { - c = *p++; - for (j = 0x80; j; j >>= 1) { - bit = crc & CRC7_CRCHIGHBIT; - crc <<= 1; - if (c & j) bit ^= CRC7_CRCHIGHBIT; - if (bit) crc ^= CRC7_POLYNOM; - } - } - - /* Convert the CRC7 to an 8-bit SD CRC */ - crc = (crc << 1) | 1; - - return (crc); -} - -#define CRC16_POLYNOM 0x1021 -#define CRC16_CRCHIGHBIT 0x8000 - -static uint16 sdspi_crc16(unsigned char* p, uint32 len) -{ - uint32 i; - uint16 j, c, bit; - uint16 crc = 0; - - for (i = 0; i < len; i++) { - c = *p++; - for (j = 0x80; j; j >>= 1) { - bit = crc & CRC16_CRCHIGHBIT; - crc <<= 1; - if (c & j) bit ^= CRC16_CRCHIGHBIT; - if (bit) crc ^= CRC16_POLYNOM; - } - } - - return (crc); -} diff --git a/drivers/net/wireless/bcm4319/bcmsdspi_linux.c b/drivers/net/wireless/bcm4319/bcmsdspi_linux.c deleted file mode 100644 index e2e0ca6abe46..000000000000 --- a/drivers/net/wireless/bcm4319/bcmsdspi_linux.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Broadcom SPI Host Controller Driver - Linux Per-port - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmsdspi_linux.c,v 1.7.2.1.4.3 2008/06/30 21:09:36 Exp $ - */ - -#include -#include -#include - -#include /* SDIO Specs */ -#include /* bcmsdh to/from specific controller APIs */ -#include /* to get msglevel bit values */ - -#include /* request_irq(), free_irq() */ - -#include -#include - -extern uint sd_crc; -module_param(sd_crc, uint, 0); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) -#define KERNEL26 -#endif - -struct sdos_info { - sdioh_info_t *sd; - spinlock_t lock; - wait_queue_head_t intr_wait_queue; -}; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) -#define BLOCKABLE() (!in_atomic()) -#else -#define BLOCKABLE() (!in_interrupt()) -#endif - -/* Interrupt handler */ -static irqreturn_t -sdspi_isr(int irq, void *dev_id -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) -, struct pt_regs *ptregs -#endif -) -{ - sdioh_info_t *sd; - struct sdos_info *sdos; - bool ours; - - sd = (sdioh_info_t *)dev_id; - sd->local_intrcount++; - - if (!sd->card_init_done) { - sd_err(("%s: Hey Bogus intr...not even initted: irq %d\n", __FUNCTION__, irq)); - return IRQ_RETVAL(FALSE); - } else { - ours = spi_check_client_intr(sd, NULL); - - /* For local interrupts, wake the waiting process */ - if (ours && sd->got_hcint) { - sdos = (struct sdos_info *)sd->sdos_info; - wake_up_interruptible(&sdos->intr_wait_queue); - } - - return IRQ_RETVAL(ours); - } -} - -/* Register with Linux for interrupts */ -int -spi_register_irq(sdioh_info_t *sd, uint irq) -{ - sd_trace(("Entering %s: irq == %d\n", __FUNCTION__, irq)); - if (request_irq(irq, sdspi_isr, IRQF_SHARED, "bcmsdspi", sd) < 0) { - sd_err(("%s: request_irq() failed\n", __FUNCTION__)); - return ERROR; - } - return SUCCESS; -} - -/* Free Linux irq */ -void -spi_free_irq(uint irq, sdioh_info_t *sd) -{ - free_irq(irq, sd); -} - -/* Map Host controller registers */ - -uint32 * -spi_reg_map(osl_t *osh, uintptr addr, int size) -{ - return (uint32 *)REG_MAP(addr, size); -} - -void -spi_reg_unmap(osl_t *osh, uintptr addr, int size) -{ - REG_UNMAP((void*)(uintptr)addr); -} - -int -spi_osinit(sdioh_info_t *sd) -{ - struct sdos_info *sdos; - - sdos = (struct sdos_info*)MALLOC(sd->osh, sizeof(struct sdos_info)); - sd->sdos_info = (void*)sdos; - if (sdos == NULL) - return BCME_NOMEM; - - sdos->sd = sd; - spin_lock_init(&sdos->lock); - init_waitqueue_head(&sdos->intr_wait_queue); - return BCME_OK; -} - -void -spi_osfree(sdioh_info_t *sd) -{ - struct sdos_info *sdos; - ASSERT(sd && sd->sdos_info); - - sdos = (struct sdos_info *)sd->sdos_info; - MFREE(sd->osh, sdos, sizeof(struct sdos_info)); -} - -/* Interrupt enable/disable */ -SDIOH_API_RC -sdioh_interrupt_set(sdioh_info_t *sd, bool enable) -{ - ulong flags; - struct sdos_info *sdos; - - sd_trace(("%s: %s\n", __FUNCTION__, enable ? "Enabling" : "Disabling")); - - sdos = (struct sdos_info *)sd->sdos_info; - ASSERT(sdos); - - if (!(sd->host_init_done && sd->card_init_done)) { - sd_err(("%s: Card & Host are not initted - bailing\n", __FUNCTION__)); - return SDIOH_API_RC_FAIL; - } - - if (enable && !(sd->intr_handler && sd->intr_handler_arg)) { - sd_err(("%s: no handler registered, will not enable\n", __FUNCTION__)); - return SDIOH_API_RC_FAIL; - } - - /* Ensure atomicity for enable/disable calls */ - spin_lock_irqsave(&sdos->lock, flags); - - sd->client_intr_enabled = enable; - if (enable && !sd->lockcount) - spi_devintr_on(sd); - else - spi_devintr_off(sd); - - spin_unlock_irqrestore(&sdos->lock, flags); - - return SDIOH_API_RC_SUCCESS; -} - -/* Protect against reentrancy (disable device interrupts while executing) */ -void -spi_lock(sdioh_info_t *sd) -{ - ulong flags; - struct sdos_info *sdos; - - sdos = (struct sdos_info *)sd->sdos_info; - ASSERT(sdos); - - sd_trace(("%s: %d\n", __FUNCTION__, sd->lockcount)); - - spin_lock_irqsave(&sdos->lock, flags); - if (sd->lockcount) { - sd_err(("%s: Already locked!\n", __FUNCTION__)); - ASSERT(sd->lockcount == 0); - } - spi_devintr_off(sd); - sd->lockcount++; - spin_unlock_irqrestore(&sdos->lock, flags); -} - -/* Enable client interrupt */ -void -spi_unlock(sdioh_info_t *sd) -{ - ulong flags; - struct sdos_info *sdos; - - sd_trace(("%s: %d, %d\n", __FUNCTION__, sd->lockcount, sd->client_intr_enabled)); - ASSERT(sd->lockcount > 0); - - sdos = (struct sdos_info *)sd->sdos_info; - ASSERT(sdos); - - spin_lock_irqsave(&sdos->lock, flags); - if (--sd->lockcount == 0 && sd->client_intr_enabled) { - spi_devintr_on(sd); - } - spin_unlock_irqrestore(&sdos->lock, flags); -} - -void spi_waitbits(sdioh_info_t *sd, bool yield) -{ - struct sdos_info *sdos; - - sdos = (struct sdos_info *)sd->sdos_info; - -#ifndef BCMSDYIELD - ASSERT(!yield); -#endif - sd_trace(("%s: yield %d canblock %d\n", - __FUNCTION__, yield, BLOCKABLE())); - - /* Clear the "interrupt happened" flag and last intrstatus */ - sd->got_hcint = FALSE; - -#ifdef BCMSDYIELD - if (yield && BLOCKABLE()) { - /* Wait for the indication, the interrupt will be masked when the ISR fires. */ - wait_event_interruptible(sdos->intr_wait_queue, (sd->got_hcint)); - } else -#endif /* BCMSDYIELD */ - { - spi_spinbits(sd); - } - -} diff --git a/drivers/net/wireless/bcm4319/bcmsdstd.c b/drivers/net/wireless/bcm4319/bcmsdstd.c deleted file mode 100644 index 0ca1f8ff8a24..000000000000 --- a/drivers/net/wireless/bcm4319/bcmsdstd.c +++ /dev/null @@ -1,3127 +0,0 @@ -/* - * 'Standard' SDIO HOST CONTROLLER driver - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmsdstd.c,v 1.64.4.1.4.4.2.18 2010/08/17 17:00:48 Exp $ - */ - -#include - -#include -#include -#include -#include -#include -#include /* SDIO Device and Protocol Specs */ -#include /* SDIO Host Controller Specification */ -#include /* bcmsdh to/from specific controller APIs */ -#include /* ioctl/iovars */ -#include - - -#define SD_PAGE_BITS 12 -#define SD_PAGE (1 << SD_PAGE_BITS) - -#include - -/* Globals */ -uint sd_msglevel = SDH_ERROR_VAL; -uint sd_hiok = TRUE; /* Use hi-speed mode if available? */ -uint sd_sdmode = SDIOH_MODE_SD4; /* Use SD4 mode by default */ -uint sd_f2_blocksize = 64; /* Default blocksize */ - -#ifdef BCMSDYIELD -bool sd_yieldcpu = TRUE; /* Allow CPU yielding for buffer requests */ -uint sd_minyield = 0; /* Minimum xfer size to allow CPU yield */ -bool sd_forcerb = FALSE; /* Force sync readback in intrs_on/off */ -#endif - -uint sd_divisor = 2; /* Default 48MHz/2 = 24MHz */ - -uint sd_power = 1; /* Default to SD Slot powered ON */ -uint sd_clock = 1; /* Default to SD Clock turned ON */ -uint sd_pci_slot = 0xFFFFffff; /* Used to force selection of a particular PCI slot */ -uint8 sd_dma_mode = DMA_MODE_SDMA; /* Default to SDMA for now */ - -uint sd_toctl = 7; - -static bool trap_errs = FALSE; - -static const char *dma_mode_description[] = { "PIO", "SDMA", "ADMA1", "32b ADMA2", "64b ADMA2" }; - -/* Prototypes */ -static bool sdstd_start_clock(sdioh_info_t *sd, uint16 divisor); -static bool sdstd_start_power(sdioh_info_t *sd); -static bool sdstd_bus_width(sdioh_info_t *sd, int width); -static int sdstd_set_highspeed_mode(sdioh_info_t *sd, bool HSMode); -static int sdstd_set_dma_mode(sdioh_info_t *sd, int8 dma_mode); -static int sdstd_card_enablefuncs(sdioh_info_t *sd); -static void sdstd_cmd_getrsp(sdioh_info_t *sd, uint32 *rsp_buffer, int count); -static int sdstd_cmd_issue(sdioh_info_t *sd, bool use_dma, uint32 cmd, uint32 arg); -static int sdstd_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, - int regsize, uint32 *data); -static int sdstd_card_regwrite(sdioh_info_t *sd, int func, uint32 regaddr, - int regsize, uint32 data); -static int sdstd_driver_init(sdioh_info_t *sd); -static bool sdstd_reset(sdioh_info_t *sd, bool host_reset, bool client_reset); -static int sdstd_card_buf(sdioh_info_t *sd, int rw, int func, bool fifo, - uint32 addr, int nbytes, uint32 *data); -static int sdstd_abort(sdioh_info_t *sd, uint func); -static int sdstd_check_errs(sdioh_info_t *sdioh_info, uint32 cmd, uint32 arg); -static int set_client_block_size(sdioh_info_t *sd, int func, int blocksize); -static void sd_map_dma(sdioh_info_t * sd); -static void sd_unmap_dma(sdioh_info_t * sd); -static void sd_clear_adma_dscr_buf(sdioh_info_t *sd); -static void sd_fill_dma_data_buf(sdioh_info_t *sd, uint8 data); -static void sd_create_adma_descriptor(sdioh_info_t *sd, - uint32 index, uint32 addr_phys, - uint16 length, uint16 flags); -static void sd_dump_adma_dscr(sdioh_info_t *sd); -static void sdstd_dumpregs(sdioh_info_t *sd); - - -/* - * Private register access routines. - */ - -/* 16 bit PCI regs */ - -extern uint16 sdstd_rreg16(sdioh_info_t *sd, uint reg); -uint16 -sdstd_rreg16(sdioh_info_t *sd, uint reg) -{ - - volatile uint16 data = *(volatile uint16 *)(sd->mem_space + reg); - sd_ctrl(("16: R Reg 0x%02x, Data 0x%x\n", reg, data)); - return data; -} - -extern void sdstd_wreg16(sdioh_info_t *sd, uint reg, uint16 data); -void -sdstd_wreg16(sdioh_info_t *sd, uint reg, uint16 data) -{ - *(volatile uint16 *)(sd->mem_space + reg) = (uint16)data; - sd_ctrl(("16: W Reg 0x%02x, Data 0x%x\n", reg, data)); -} - -static void -sdstd_or_reg16(sdioh_info_t *sd, uint reg, uint16 val) -{ - volatile uint16 data = *(volatile uint16 *)(sd->mem_space + reg); - sd_ctrl(("16: OR Reg 0x%02x, Val 0x%x\n", reg, val)); - data |= val; - *(volatile uint16 *)(sd->mem_space + reg) = (uint16)data; - -} -static void -sdstd_mod_reg16(sdioh_info_t *sd, uint reg, int16 mask, uint16 val) -{ - - volatile uint16 data = *(volatile uint16 *)(sd->mem_space + reg); - sd_ctrl(("16: MOD Reg 0x%02x, Mask 0x%x, Val 0x%x\n", reg, mask, val)); - data &= ~mask; - data |= (val & mask); - *(volatile uint16 *)(sd->mem_space + reg) = (uint16)data; -} - - -/* 32 bit PCI regs */ -static uint32 -sdstd_rreg(sdioh_info_t *sd, uint reg) -{ - volatile uint32 data = *(volatile uint32 *)(sd->mem_space + reg); - sd_ctrl(("32: R Reg 0x%02x, Data 0x%x\n", reg, data)); - return data; -} -static inline void -sdstd_wreg(sdioh_info_t *sd, uint reg, uint32 data) -{ - *(volatile uint32 *)(sd->mem_space + reg) = (uint32)data; - sd_ctrl(("32: W Reg 0x%02x, Data 0x%x\n", reg, data)); - -} - -/* 8 bit PCI regs */ -static inline void -sdstd_wreg8(sdioh_info_t *sd, uint reg, uint8 data) -{ - *(volatile uint8 *)(sd->mem_space + reg) = (uint8)data; - sd_ctrl(("08: W Reg 0x%02x, Data 0x%x\n", reg, data)); -} -static uint8 -sdstd_rreg8(sdioh_info_t *sd, uint reg) -{ - volatile uint8 data = *(volatile uint8 *)(sd->mem_space + reg); - sd_ctrl(("08: R Reg 0x%02x, Data 0x%x\n", reg, data)); - return data; -} - -/* - * Private work routines - */ - -sdioh_info_t *glob_sd; - -/* - * Public entry points & extern's - */ -extern sdioh_info_t * -sdioh_attach(osl_t *osh, void *bar0, uint irq) -{ - sdioh_info_t *sd; - - sd_trace(("%s\n", __FUNCTION__)); - if ((sd = (sdioh_info_t *)MALLOC(osh, sizeof(sdioh_info_t))) == NULL) { - sd_err(("sdioh_attach: out of memory, malloced %d bytes\n", MALLOCED(osh))); - return NULL; - } - bzero((char *)sd, sizeof(sdioh_info_t)); - glob_sd = sd; - sd->osh = osh; - if (sdstd_osinit(sd) != 0) { - sd_err(("%s:sdstd_osinit() failed\n", __FUNCTION__)); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return NULL; - } - sd->mem_space = (volatile char *)sdstd_reg_map(osh, (uintptr)bar0, SDIOH_REG_WINSZ); - sd_init_dma(sd); - sd->irq = irq; - if (sd->mem_space == NULL) { - sd_err(("%s:ioremap() failed\n", __FUNCTION__)); - sdstd_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return NULL; - } - sd_info(("%s:sd->mem_space = %p\n", __FUNCTION__, sd->mem_space)); - sd->intr_handler = NULL; - sd->intr_handler_arg = NULL; - sd->intr_handler_valid = FALSE; - - /* Set defaults */ - sd->sd_blockmode = TRUE; - sd->use_client_ints = TRUE; - sd->sd_dma_mode = sd_dma_mode; - - if (!sd->sd_blockmode) - sd->sd_dma_mode = DMA_MODE_NONE; - - if (sdstd_driver_init(sd) != SUCCESS) { - /* If host CPU was reset without resetting SD bus or - SD device, the device will still have its RCA but - driver no longer knows what it is (since driver has been restarted). - go through once to clear the RCA and a gain reassign it. - */ - sd_info(("driver_init failed - Reset RCA and try again\n")); - if (sdstd_driver_init(sd) != SUCCESS) { - sd_err(("%s:driver_init() failed()\n", __FUNCTION__)); - if (sd->mem_space) { - sdstd_reg_unmap(osh, (uintptr)sd->mem_space, SDIOH_REG_WINSZ); - sd->mem_space = NULL; - } - sdstd_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return (NULL); - } - } - - OSL_DMADDRWIDTH(osh, 32); - - /* Always map DMA buffers, so we can switch between DMA modes. */ - sd_map_dma(sd); - - if (sdstd_register_irq(sd, irq) != SUCCESS) { - sd_err(("%s: sdstd_register_irq() failed for irq = %d\n", __FUNCTION__, irq)); - sdstd_free_irq(sd->irq, sd); - if (sd->mem_space) { - sdstd_reg_unmap(osh, (uintptr)sd->mem_space, SDIOH_REG_WINSZ); - sd->mem_space = NULL; - } - - sdstd_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return (NULL); - } - - sd_trace(("%s: Done\n", __FUNCTION__)); - return sd; -} - -extern SDIOH_API_RC -sdioh_detach(osl_t *osh, sdioh_info_t *sd) -{ - sd_trace(("%s\n", __FUNCTION__)); - if (sd) { - sd_unmap_dma(sd); - sdstd_wreg16(sd, SD_IntrSignalEnable, 0); - sd_trace(("%s: freeing irq %d\n", __FUNCTION__, sd->irq)); - sdstd_free_irq(sd->irq, sd); - if (sd->card_init_done) - sdstd_reset(sd, 1, 1); - if (sd->mem_space) { - sdstd_reg_unmap(osh, (uintptr)sd->mem_space, SDIOH_REG_WINSZ); - sd->mem_space = NULL; - } - - sdstd_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - } - return SDIOH_API_RC_SUCCESS; -} - -/* Configure callback to client when we receive client interrupt */ -extern SDIOH_API_RC -sdioh_interrupt_register(sdioh_info_t *sd, sdioh_cb_fn_t fn, void *argh) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - sd->intr_handler = fn; - sd->intr_handler_arg = argh; - sd->intr_handler_valid = TRUE; - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_interrupt_deregister(sdioh_info_t *sd) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - sd->intr_handler_valid = FALSE; - sd->intr_handler = NULL; - sd->intr_handler_arg = NULL; - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_interrupt_query(sdioh_info_t *sd, bool *onoff) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - *onoff = sd->client_intr_enabled; - return SDIOH_API_RC_SUCCESS; -} - -#if defined(DHD_DEBUG) -extern bool -sdioh_interrupt_pending(sdioh_info_t *sd) -{ - uint16 intrstatus; - intrstatus = sdstd_rreg16(sd, SD_IntrStatus); - return !!(intrstatus & CLIENT_INTR); -} -#endif - -uint -sdioh_query_iofnum(sdioh_info_t *sd) -{ - return sd->num_funcs; -} - -/* IOVar table */ -enum { - IOV_MSGLEVEL = 1, - IOV_BLOCKMODE, - IOV_BLOCKSIZE, - IOV_DMA, - IOV_USEINTS, - IOV_NUMINTS, - IOV_NUMLOCALINTS, - IOV_HOSTREG, - IOV_DEVREG, - IOV_DIVISOR, - IOV_SDMODE, - IOV_HISPEED, - IOV_HCIREGS, - IOV_POWER, - IOV_YIELDCPU, - IOV_MINYIELD, - IOV_FORCERB, - IOV_CLOCK -}; - -const bcm_iovar_t sdioh_iovars[] = { - {"sd_msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0 }, - {"sd_blockmode", IOV_BLOCKMODE, 0, IOVT_BOOL, 0 }, - {"sd_blocksize", IOV_BLOCKSIZE, 0, IOVT_UINT32, 0 }, /* ((fn << 16) | size) */ - {"sd_dma", IOV_DMA, 0, IOVT_UINT32, 0 }, -#ifdef BCMSDYIELD - {"sd_yieldcpu", IOV_YIELDCPU, 0, IOVT_BOOL, 0 }, - {"sd_minyield", IOV_MINYIELD, 0, IOVT_UINT32, 0 }, - {"sd_forcerb", IOV_FORCERB, 0, IOVT_BOOL, 0 }, -#endif - {"sd_ints", IOV_USEINTS, 0, IOVT_BOOL, 0 }, - {"sd_numints", IOV_NUMINTS, 0, IOVT_UINT32, 0 }, - {"sd_numlocalints", IOV_NUMLOCALINTS, 0, IOVT_UINT32, 0 }, - {"sd_hostreg", IOV_HOSTREG, 0, IOVT_BUFFER, sizeof(sdreg_t) }, - {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(sdreg_t) }, - {"sd_divisor", IOV_DIVISOR, 0, IOVT_UINT32, 0 }, - {"sd_power", IOV_POWER, 0, IOVT_UINT32, 0 }, - {"sd_clock", IOV_CLOCK, 0, IOVT_UINT32, 0 }, - {"sd_mode", IOV_SDMODE, 0, IOVT_UINT32, 100}, - {"sd_highspeed", IOV_HISPEED, 0, IOVT_UINT32, 0}, - {NULL, 0, 0, 0, 0 } -}; - -int -sdioh_iovar_op(sdioh_info_t *si, const char *name, - void *params, int plen, void *arg, int len, bool set) -{ - const bcm_iovar_t *vi = NULL; - int bcmerror = 0; - int val_size; - int32 int_val = 0; - bool bool_val; - uint32 actionid; - - ASSERT(name); - ASSERT(len >= 0); - - /* Get must have return space; Set does not take qualifiers */ - ASSERT(set || (arg && len)); - ASSERT(!set || (!params && !plen)); - - sd_trace(("%s: Enter (%s %s)\n", __FUNCTION__, (set ? "set" : "get"), name)); - - if ((vi = bcm_iovar_lookup(sdioh_iovars, name)) == NULL) { - bcmerror = BCME_UNSUPPORTED; - goto exit; - } - - if ((bcmerror = bcm_iovar_lencheck(vi, arg, len, set)) != 0) - goto exit; - - /* Set up params so get and set can share the convenience variables */ - if (params == NULL) { - params = arg; - plen = len; - } - - if (vi->type == IOVT_VOID) - val_size = 0; - else if (vi->type == IOVT_BUFFER) - val_size = len; - else - val_size = sizeof(int); - - if (plen >= (int)sizeof(int_val)) - bcopy(params, &int_val, sizeof(int_val)); - - bool_val = (int_val != 0) ? TRUE : FALSE; - - actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid); - switch (actionid) { - case IOV_GVAL(IOV_MSGLEVEL): - int_val = (int32)sd_msglevel; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_MSGLEVEL): - sd_msglevel = int_val; - break; - - case IOV_GVAL(IOV_BLOCKMODE): - int_val = (int32)si->sd_blockmode; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_BLOCKMODE): - si->sd_blockmode = (bool)int_val; - /* Haven't figured out how to make non-block mode with DMA */ - if (!si->sd_blockmode) - si->sd_dma_mode = DMA_MODE_NONE; - break; - -#ifdef BCMSDYIELD - case IOV_GVAL(IOV_YIELDCPU): - int_val = sd_yieldcpu; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_YIELDCPU): - sd_yieldcpu = (bool)int_val; - break; - - case IOV_GVAL(IOV_MINYIELD): - int_val = sd_minyield; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_MINYIELD): - sd_minyield = (bool)int_val; - break; - - case IOV_GVAL(IOV_FORCERB): - int_val = sd_forcerb; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_FORCERB): - sd_forcerb = (bool)int_val; - break; -#endif /* BCMSDYIELD */ - - case IOV_GVAL(IOV_BLOCKSIZE): - if ((uint32)int_val > si->num_funcs) { - bcmerror = BCME_BADARG; - break; - } - int_val = (int32)si->client_block_size[int_val]; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_BLOCKSIZE): - { - uint func = ((uint32)int_val >> 16); - uint blksize = (uint16)int_val; - uint maxsize; - - if (func > si->num_funcs) { - bcmerror = BCME_BADARG; - break; - } - - switch (func) { - case 0: maxsize = 32; break; - case 1: maxsize = BLOCK_SIZE_4318; break; - case 2: maxsize = BLOCK_SIZE_4328; break; - default: maxsize = 0; - } - if (blksize > maxsize) { - bcmerror = BCME_BADARG; - break; - } - if (!blksize) { - blksize = maxsize; - } - - /* Now set it */ - sdstd_lock(si); - bcmerror = set_client_block_size(si, func, blksize); - sdstd_unlock(si); - break; - } - - case IOV_GVAL(IOV_DMA): - int_val = (int32)si->sd_dma_mode; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_DMA): - si->sd_dma_mode = (char)int_val; - sdstd_set_dma_mode(si, si->sd_dma_mode); - break; - - case IOV_GVAL(IOV_USEINTS): - int_val = (int32)si->use_client_ints; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_USEINTS): - si->use_client_ints = (bool)int_val; - if (si->use_client_ints) - si->intmask |= CLIENT_INTR; - else - si->intmask &= ~CLIENT_INTR; - break; - - case IOV_GVAL(IOV_DIVISOR): - int_val = (uint32)sd_divisor; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_DIVISOR): - sd_divisor = int_val; - if (!sdstd_start_clock(si, (uint16)sd_divisor)) { - sd_err(("set clock failed!\n")); - bcmerror = BCME_ERROR; - } - break; - - case IOV_GVAL(IOV_POWER): - int_val = (uint32)sd_power; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_POWER): - sd_power = int_val; - if (sd_power == 1) { - if (sdstd_driver_init(si) != SUCCESS) { - sd_err(("set SD Slot power failed!\n")); - bcmerror = BCME_ERROR; - } else { - sd_err(("SD Slot Powered ON.\n")); - } - } else { - uint8 pwr = 0; - - pwr = SFIELD(pwr, PWR_BUS_EN, 0); - sdstd_wreg8(si, SD_PwrCntrl, pwr); /* Set Voltage level */ - sd_err(("SD Slot Powered OFF.\n")); - } - break; - - case IOV_GVAL(IOV_CLOCK): - int_val = (uint32)sd_clock; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_CLOCK): - sd_clock = int_val; - if (sd_clock == 1) { - sd_info(("SD Clock turned ON.\n")); - if (!sdstd_start_clock(si, (uint16)sd_divisor)) { - sd_err(("sdstd_start_clock failed\n")); - bcmerror = BCME_ERROR; - } - } else { - /* turn off HC clock */ - sdstd_wreg16(si, SD_ClockCntrl, - sdstd_rreg16(si, SD_ClockCntrl) & ~((uint16)0x4)); - - sd_info(("SD Clock turned OFF.\n")); - } - break; - - case IOV_GVAL(IOV_SDMODE): - int_val = (uint32)sd_sdmode; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_SDMODE): - sd_sdmode = int_val; - - if (!sdstd_bus_width(si, sd_sdmode)) { - sd_err(("sdstd_bus_width failed\n")); - bcmerror = BCME_ERROR; - } - break; - - case IOV_GVAL(IOV_HISPEED): - int_val = (uint32)sd_hiok; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_HISPEED): - sd_hiok = int_val; - bcmerror = sdstd_set_highspeed_mode(si, (bool)sd_hiok); - break; - - case IOV_GVAL(IOV_NUMINTS): - int_val = (int32)si->intrcount; - bcopy(&int_val, arg, val_size); - break; - - case IOV_GVAL(IOV_NUMLOCALINTS): - int_val = (int32)si->local_intrcount; - bcopy(&int_val, arg, val_size); - break; - - case IOV_GVAL(IOV_HOSTREG): - { - sdreg_t *sd_ptr = (sdreg_t *)params; - - if (sd_ptr->offset < SD_SysAddr || sd_ptr->offset > SD_MaxCurCap) { - sd_err(("%s: bad offset 0x%x\n", __FUNCTION__, sd_ptr->offset)); - bcmerror = BCME_BADARG; - break; - } - - sd_trace(("%s: rreg%d at offset %d\n", __FUNCTION__, - (sd_ptr->offset & 1) ? 8 : ((sd_ptr->offset & 2) ? 16 : 32), - sd_ptr->offset)); - if (sd_ptr->offset & 1) - int_val = sdstd_rreg8(si, sd_ptr->offset); - else if (sd_ptr->offset & 2) - int_val = sdstd_rreg16(si, sd_ptr->offset); - else - int_val = sdstd_rreg(si, sd_ptr->offset); - - bcopy(&int_val, arg, sizeof(int_val)); - break; - } - - case IOV_SVAL(IOV_HOSTREG): - { - sdreg_t *sd_ptr = (sdreg_t *)params; - - if (sd_ptr->offset < SD_SysAddr || sd_ptr->offset > SD_MaxCurCap) { - sd_err(("%s: bad offset 0x%x\n", __FUNCTION__, sd_ptr->offset)); - bcmerror = BCME_BADARG; - break; - } - - sd_trace(("%s: wreg%d value 0x%08x at offset %d\n", __FUNCTION__, sd_ptr->value, - (sd_ptr->offset & 1) ? 8 : ((sd_ptr->offset & 2) ? 16 : 32), - sd_ptr->offset)); - if (sd_ptr->offset & 1) - sdstd_wreg8(si, sd_ptr->offset, (uint8)sd_ptr->value); - else if (sd_ptr->offset & 2) - sdstd_wreg16(si, sd_ptr->offset, (uint16)sd_ptr->value); - else - sdstd_wreg(si, sd_ptr->offset, (uint32)sd_ptr->value); - - break; - } - - case IOV_GVAL(IOV_DEVREG): - { - sdreg_t *sd_ptr = (sdreg_t *)params; - uint8 data; - - if (sdioh_cfg_read(si, sd_ptr->func, sd_ptr->offset, &data)) { - bcmerror = BCME_SDIO_ERROR; - break; - } - - int_val = (int)data; - bcopy(&int_val, arg, sizeof(int_val)); - break; - } - - case IOV_SVAL(IOV_DEVREG): - { - sdreg_t *sd_ptr = (sdreg_t *)params; - uint8 data = (uint8)sd_ptr->value; - - if (sdioh_cfg_write(si, sd_ptr->func, sd_ptr->offset, &data)) { - bcmerror = BCME_SDIO_ERROR; - break; - } - break; - } - - - default: - bcmerror = BCME_UNSUPPORTED; - break; - } -exit: - - return bcmerror; -} - -extern SDIOH_API_RC -sdioh_cfg_read(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data) -{ - SDIOH_API_RC status; - /* No lock needed since sdioh_request_byte does locking */ - status = sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data); - return status; -} - -extern SDIOH_API_RC -sdioh_cfg_write(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data) -{ - /* No lock needed since sdioh_request_byte does locking */ - SDIOH_API_RC status; - status = sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data); - return status; -} - -extern SDIOH_API_RC -sdioh_cis_read(sdioh_info_t *sd, uint func, uint8 *cisd, uint32 length) -{ - uint32 count; - int offset; - uint32 foo; - uint8 *cis = cisd; - - sd_trace(("%s: Func = %d\n", __FUNCTION__, func)); - - if (!sd->func_cis_ptr[func]) { - bzero(cis, length); - return SDIOH_API_RC_FAIL; - } - - sdstd_lock(sd); - *cis = 0; - for (count = 0; count < length; count++) { - offset = sd->func_cis_ptr[func] + count; - if (sdstd_card_regread(sd, 0, offset, 1, &foo)) { - sd_err(("%s: regread failed: Can't read CIS\n", __FUNCTION__)); - sdstd_unlock(sd); - return SDIOH_API_RC_FAIL; - } - *cis = (uint8)(foo & 0xff); - cis++; - } - sdstd_unlock(sd); - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *byte) -{ - int status; - uint32 cmd_arg; - uint32 rsp5; - - sdstd_lock(sd); - cmd_arg = 0; - cmd_arg = SFIELD(cmd_arg, CMD52_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, CMD52_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, CMD52_RW_FLAG, rw == SDIOH_READ ? 0 : 1); - cmd_arg = SFIELD(cmd_arg, CMD52_RAW, 0); - cmd_arg = SFIELD(cmd_arg, CMD52_DATA, rw == SDIOH_READ ? 0 : *byte); - - if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_52, cmd_arg)) != SUCCESS) { - sdstd_unlock(sd); - return status; - } - - sdstd_cmd_getrsp(sd, &rsp5, 1); - if (sdstd_rreg16 (sd, SD_ErrorIntrStatus) != 0) { - sd_err(("%s: 1: ErrorintrStatus 0x%x\n", - __FUNCTION__, sdstd_rreg16(sd, SD_ErrorIntrStatus))); - } - if (GFIELD(rsp5, RSP5_FLAGS) != 0x10) - sd_err(("%s: rsp5 flags is 0x%x\t %d\n", - __FUNCTION__, GFIELD(rsp5, RSP5_FLAGS), func)); - - if (GFIELD(rsp5, RSP5_STUFF)) - sd_err(("%s: rsp5 stuff is 0x%x: should be 0\n", - __FUNCTION__, GFIELD(rsp5, RSP5_STUFF))); - - if (rw == SDIOH_READ) - *byte = GFIELD(rsp5, RSP5_DATA); - - sdstd_unlock(sd); - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, uint addr, - uint32 *word, uint nbytes) -{ - int status; - bool swap = FALSE; - - sdstd_lock(sd); - - if (rw == SDIOH_READ) { - status = sdstd_card_regread(sd, func, addr, nbytes, word); - if (swap) - *word = BCMSWAP32(*word); - } else { - if (swap) - *word = BCMSWAP32(*word); - status = sdstd_card_regwrite(sd, func, addr, nbytes, *word); - } - - sdstd_unlock(sd); - return (status == SUCCESS ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL); -} - -extern SDIOH_API_RC -sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint rw, uint func, - uint addr, uint reg_width, uint buflen_u, uint8 *buffer, void *pkt) -{ - int len; - int buflen = (int)buflen_u; - bool fifo = (fix_inc == SDIOH_DATA_FIX); - uint8 *localbuf = NULL, *tmpbuf = NULL; - uint tmplen = 0; - bool local_blockmode = sd->sd_blockmode; - - sdstd_lock(sd); - - ASSERT(reg_width == 4); - ASSERT(buflen_u < (1 << 30)); - ASSERT(sd->client_block_size[func]); - - sd_data(("%s: %c len %d r_cnt %d t_cnt %d, pkt @0x%p\n", - __FUNCTION__, rw == SDIOH_READ ? 'R' : 'W', - buflen_u, sd->r_cnt, sd->t_cnt, pkt)); - - /* Break buffer down into blocksize chunks: - * Bytemode: 1 block at a time. - * Blockmode: Multiples of blocksizes at a time w/ max of SD_PAGE. - * Both: leftovers are handled last (will be sent via bytemode). - */ - while (buflen > 0) { - if (local_blockmode) { - /* Max xfer is Page size */ - len = MIN(SD_PAGE, buflen); - - /* Round down to a block boundry */ - if (buflen > sd->client_block_size[func]) - len = (len/sd->client_block_size[func]) * - sd->client_block_size[func]; - if ((func == SDIO_FUNC_1) && ((len % 4) == 3) && (rw == SDIOH_WRITE)) { - tmplen = len; - sd_err(("%s: Rounding up buffer to mod4 length.\n", __FUNCTION__)); - len++; - tmpbuf = buffer; - if ((localbuf = (uint8 *)MALLOC(sd->osh, len)) == NULL) { - sd_err(("out of memory, malloced %d bytes\n", - MALLOCED(sd->osh))); - sdstd_unlock(sd); - return SDIOH_API_RC_FAIL; - } - bcopy(buffer, localbuf, len); - buffer = localbuf; - } - } else { - /* Byte mode: One block at a time */ - len = MIN(sd->client_block_size[func], buflen); - } - - if (sdstd_card_buf(sd, rw, func, fifo, addr, len, (uint32 *)buffer) != SUCCESS) { - sdstd_unlock(sd); - return SDIOH_API_RC_FAIL; - } - - if (local_blockmode) { - if ((func == SDIO_FUNC_1) && ((tmplen % 4) == 3) && (rw == SDIOH_WRITE)) { - if (localbuf) - MFREE(sd->osh, localbuf, len); - len--; - buffer = tmpbuf; - sd_err(("%s: Restoring back buffer ptr and len.\n", __FUNCTION__)); - } - } - - buffer += len; - buflen -= len; - if (!fifo) - addr += len; - } - sdstd_unlock(sd); - return SDIOH_API_RC_SUCCESS; -} - -static -int sdstd_abort(sdioh_info_t *sd, uint func) -{ - int err = 0; - int retries; - - uint16 cmd_reg; - uint32 cmd_arg; - uint32 rsp5; - uint8 rflags; - - uint16 int_reg = 0; - uint16 plain_intstatus; - - /* Argument is write to F0 (CCCR) IOAbort with function number */ - cmd_arg = 0; - cmd_arg = SFIELD(cmd_arg, CMD52_FUNCTION, SDIO_FUNC_0); - cmd_arg = SFIELD(cmd_arg, CMD52_REG_ADDR, SDIOD_CCCR_IOABORT); - cmd_arg = SFIELD(cmd_arg, CMD52_RW_FLAG, SD_IO_OP_WRITE); - cmd_arg = SFIELD(cmd_arg, CMD52_RAW, 0); - cmd_arg = SFIELD(cmd_arg, CMD52_DATA, func); - - /* Command is CMD52 write */ - cmd_reg = 0; - cmd_reg = SFIELD(cmd_reg, CMD_RESP_TYPE, RESP_TYPE_48_BUSY); - cmd_reg = SFIELD(cmd_reg, CMD_CRC_EN, 1); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX_EN, 1); - cmd_reg = SFIELD(cmd_reg, CMD_DATA_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_TYPE, CMD_TYPE_ABORT); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX, SDIOH_CMD_52); - - if (sd->sd_mode == SDIOH_MODE_SPI) { - cmd_reg = SFIELD(cmd_reg, CMD_CRC_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX_EN, 0); - } - - /* Wait for CMD_INHIBIT to go away as per spec section 3.6.1.1 */ - retries = RETRIES_SMALL; - while (GFIELD(sdstd_rreg(sd, SD_PresentState), PRES_CMD_INHIBIT)) { - if (retries == RETRIES_SMALL) - sd_err(("%s: Waiting for Command Inhibit, state 0x%08x\n", - __FUNCTION__, sdstd_rreg(sd, SD_PresentState))); - if (!--retries) { - sd_err(("%s: Command Inhibit timeout, state 0x%08x\n", - __FUNCTION__, sdstd_rreg(sd, SD_PresentState))); - if (trap_errs) - ASSERT(0); - err = BCME_SDIO_ERROR; - goto done; - } - } - - /* Clear errors from any previous commands */ - if ((plain_intstatus = sdstd_rreg16(sd, SD_ErrorIntrStatus)) != 0) { - sd_err(("abort: clearing errstat 0x%04x\n", plain_intstatus)); - sdstd_wreg16(sd, SD_ErrorIntrStatus, plain_intstatus); - } - plain_intstatus = sdstd_rreg16(sd, SD_IntrStatus); - if (plain_intstatus & ~(SFIELD(0, INTSTAT_CARD_INT, 1))) { - sd_err(("abort: intstatus 0x%04x\n", plain_intstatus)); - if (GFIELD(plain_intstatus, INTSTAT_CMD_COMPLETE)) { - sd_err(("SDSTD_ABORT: CMD COMPLETE SET BEFORE COMMAND GIVEN!!!\n")); - } - if (GFIELD(plain_intstatus, INTSTAT_CARD_REMOVAL)) { - sd_err(("SDSTD_ABORT: INTSTAT_CARD_REMOVAL\n")); - err = BCME_NODEVICE; - goto done; - } - } - - /* Issue the command */ - sdstd_wreg(sd, SD_Arg0, cmd_arg); - sdstd_wreg16(sd, SD_Command, cmd_reg); - - /* In interrupt mode return, expect later CMD_COMPLETE interrupt */ - if (!sd->polled_mode) - return err; - - /* Otherwise, wait for the command to complete */ - retries = RETRIES_LARGE; - do { - int_reg = sdstd_rreg16(sd, SD_IntrStatus); - } while (--retries && - (GFIELD(int_reg, INTSTAT_ERROR_INT) == 0) && - (GFIELD(int_reg, INTSTAT_CMD_COMPLETE) == 0)); - - /* If command completion fails, do a cmd reset and note the error */ - if (!retries) { - sd_err(("%s: CMD_COMPLETE timeout: intr 0x%04x err 0x%04x state 0x%08x\n", - __FUNCTION__, int_reg, - sdstd_rreg16(sd, SD_ErrorIntrStatus), - sdstd_rreg(sd, SD_PresentState))); - - sdstd_wreg8(sd, SD_SoftwareReset, SFIELD(0, SW_RESET_CMD, 1)); - retries = RETRIES_LARGE; - do { - sd_trace(("%s: waiting for CMD line reset\n", __FUNCTION__)); - } while ((GFIELD(sdstd_rreg8(sd, SD_SoftwareReset), - SW_RESET_CMD)) && retries--); - - if (!retries) { - sd_err(("%s: Timeout waiting for CMD line reset\n", __FUNCTION__)); - } - - if (trap_errs) - ASSERT(0); - - err = BCME_SDIO_ERROR; - } - - /* Clear Command Complete interrupt */ - int_reg = SFIELD(0, INTSTAT_CMD_COMPLETE, 1); - sdstd_wreg16(sd, SD_IntrStatus, int_reg); - - /* Check for Errors */ - if ((plain_intstatus = sdstd_rreg16 (sd, SD_ErrorIntrStatus)) != 0) { - sd_err(("%s: ErrorintrStatus: 0x%x, " - "(intrstatus = 0x%x, present state 0x%x) clearing\n", - __FUNCTION__, plain_intstatus, - sdstd_rreg16(sd, SD_IntrStatus), - sdstd_rreg(sd, SD_PresentState))); - - sdstd_wreg16(sd, SD_ErrorIntrStatus, plain_intstatus); - - sdstd_wreg8(sd, SD_SoftwareReset, SFIELD(0, SW_RESET_DAT, 1)); - retries = RETRIES_LARGE; - do { - sd_trace(("%s: waiting for DAT line reset\n", __FUNCTION__)); - } while ((GFIELD(sdstd_rreg8(sd, SD_SoftwareReset), - SW_RESET_DAT)) && retries--); - - if (!retries) { - sd_err(("%s: Timeout waiting for DAT line reset\n", __FUNCTION__)); - } - - if (trap_errs) - ASSERT(0); - - /* ABORT is dataless, only cmd errs count */ - if (plain_intstatus & ERRINT_CMD_ERRS) - err = BCME_SDIO_ERROR; - } - - /* If command failed don't bother looking at response */ - if (err) - goto done; - - /* Otherwise, check the response */ - sdstd_cmd_getrsp(sd, &rsp5, 1); - rflags = GFIELD(rsp5, RSP5_FLAGS); - - if (rflags & SD_RSP_R5_ERRBITS) { - sd_err(("%s: R5 flags include errbits: 0x%02x\n", __FUNCTION__, rflags)); - - /* The CRC error flag applies to the previous command */ - if (rflags & (SD_RSP_R5_ERRBITS & ~SD_RSP_R5_COM_CRC_ERROR)) { - err = BCME_SDIO_ERROR; - goto done; - } - } - - if (((rflags & (SD_RSP_R5_IO_CURRENTSTATE0 | SD_RSP_R5_IO_CURRENTSTATE1)) != 0x10) && - ((rflags & (SD_RSP_R5_IO_CURRENTSTATE0 | SD_RSP_R5_IO_CURRENTSTATE1)) != 0x20)) { - sd_err(("%s: R5 flags has bad state: 0x%02x\n", __FUNCTION__, rflags)); - err = BCME_SDIO_ERROR; - goto done; - } - - if (GFIELD(rsp5, RSP5_STUFF)) { - sd_err(("%s: rsp5 stuff is 0x%x: should be 0\n", - __FUNCTION__, GFIELD(rsp5, RSP5_STUFF))); - err = BCME_SDIO_ERROR; - goto done; - } - -done: - if (err == BCME_NODEVICE) - return err; - - sdstd_wreg8(sd, SD_SoftwareReset, - SFIELD(SFIELD(0, SW_RESET_DAT, 1), SW_RESET_CMD, 1)); - - retries = RETRIES_LARGE; - do { - rflags = sdstd_rreg8(sd, SD_SoftwareReset); - if (!GFIELD(rflags, SW_RESET_DAT) && !GFIELD(rflags, SW_RESET_CMD)) - break; - } while (--retries); - - if (!retries) { - sd_err(("%s: Timeout waiting for DAT/CMD reset: 0x%02x\n", - __FUNCTION__, rflags)); - err = BCME_SDIO_ERROR; - } - - return err; -} - -extern int -sdioh_abort(sdioh_info_t *sd, uint fnum) -{ - int ret; - - sdstd_lock(sd); - ret = sdstd_abort(sd, fnum); - sdstd_unlock(sd); - - return ret; -} - -int -sdioh_start(sdioh_info_t *sd, int stage) -{ - return SUCCESS; -} - -int -sdioh_stop(sdioh_info_t *sd) -{ - return SUCCESS; -} - -static int -sdstd_check_errs(sdioh_info_t *sdioh_info, uint32 cmd, uint32 arg) -{ - uint16 regval; - uint retries; - uint function = 0; - - /* If no errors, we're done */ - if ((regval = sdstd_rreg16(sdioh_info, SD_ErrorIntrStatus)) == 0) - return SUCCESS; - - sd_info(("%s: ErrorIntrStatus 0x%04x (clearing), IntrStatus 0x%04x PresentState 0x%08x\n", - __FUNCTION__, regval, sdstd_rreg16(sdioh_info, SD_IntrStatus), - sdstd_rreg(sdioh_info, SD_PresentState))); - sdstd_wreg16(sdioh_info, SD_ErrorIntrStatus, regval); - - /* On command error, issue CMD reset */ - if (regval & ERRINT_CMD_ERRS) { - sd_trace(("%s: issuing CMD reset\n", __FUNCTION__)); - sdstd_wreg8(sdioh_info, SD_SoftwareReset, SFIELD(0, SW_RESET_CMD, 1)); - for (retries = RETRIES_LARGE; retries; retries--) - if (!(GFIELD(sdstd_rreg8(sdioh_info, SD_SoftwareReset), SW_RESET_CMD))) - break; - if (!retries) { - sd_err(("%s: Timeout waiting for CMD line reset\n", __FUNCTION__)); - } - } - - /* On data error, issue DAT reset */ - if (regval & ERRINT_DATA_ERRS) { - sd_trace(("%s: issuing DAT reset\n", __FUNCTION__)); - sdstd_wreg8(sdioh_info, SD_SoftwareReset, SFIELD(0, SW_RESET_DAT, 1)); - for (retries = RETRIES_LARGE; retries; retries--) - if (!(GFIELD(sdstd_rreg8(sdioh_info, SD_SoftwareReset), SW_RESET_DAT))) - break; - if (!retries) { - sd_err(("%s: Timeout waiting for DAT line reset\n", __FUNCTION__)); - } - } - - /* For an IO command (CMD52 or CMD53) issue an abort to the appropriate function */ - if (cmd == SDIOH_CMD_53) - function = GFIELD(arg, CMD53_FUNCTION); - else if (cmd == SDIOH_CMD_52) - function = GFIELD(arg, CMD52_FUNCTION); - if (function) { - sd_trace(("%s: requesting abort for function %d after cmd %d\n", - __FUNCTION__, function, cmd)); - sdstd_abort(sdioh_info, function); - } - - if (trap_errs) - ASSERT(0); - - return ERROR; -} - - - -/* - * Private/Static work routines - */ -static bool -sdstd_reset(sdioh_info_t *sd, bool host_reset, bool client_reset) -{ - int retries = RETRIES_LARGE; - uchar regval; - - if (!sd) - return TRUE; - - sdstd_lock(sd); - /* Reset client card */ - if (client_reset && (sd->adapter_slot != -1)) { - if (sdstd_card_regwrite(sd, 0, SDIOD_CCCR_IOABORT, 1, 0x8) != SUCCESS) - sd_err(("%s: Cannot write to card reg 0x%x\n", - __FUNCTION__, SDIOD_CCCR_IOABORT)); - else - sd->card_rca = 0; - } - - /* Reset host controller */ - if (host_reset) { - regval = SFIELD(0, SW_RESET_ALL, 1); - sdstd_wreg8(sd, SD_SoftwareReset, regval); - do { - sd_trace(("%s: waiting for reset\n", __FUNCTION__)); - } while ((sdstd_rreg8(sd, SD_SoftwareReset) & regval) && retries--); - - if (!retries) { - sd_err(("%s: Timeout waiting for host reset\n", __FUNCTION__)); - sdstd_unlock(sd); - return (FALSE); - } - - /* A reset should reset bus back to 1 bit mode */ - sd->sd_mode = SDIOH_MODE_SD1; - sdstd_set_dma_mode(sd, sd->sd_dma_mode); - } - sdstd_unlock(sd); - return TRUE; -} - -/* Disable device interrupt */ -void -sdstd_devintr_off(sdioh_info_t *sd) -{ - sd_trace(("%s: %d\n", __FUNCTION__, sd->use_client_ints)); - if (sd->use_client_ints) { - sd->intmask &= ~CLIENT_INTR; - sdstd_wreg16(sd, SD_IntrSignalEnable, sd->intmask); - sdstd_rreg16(sd, SD_IntrSignalEnable); /* Sync readback */ - } -} - -/* Enable device interrupt */ -void -sdstd_devintr_on(sdioh_info_t *sd) -{ - ASSERT(sd->lockcount == 0); - sd_trace(("%s: %d\n", __FUNCTION__, sd->use_client_ints)); - if (sd->use_client_ints) { - uint16 status = sdstd_rreg16(sd, SD_IntrStatusEnable); - sdstd_wreg16(sd, SD_IntrStatusEnable, SFIELD(status, INTSTAT_CARD_INT, 0)); - sdstd_wreg16(sd, SD_IntrStatusEnable, status); - - sd->intmask |= CLIENT_INTR; - sdstd_wreg16(sd, SD_IntrSignalEnable, sd->intmask); - sdstd_rreg16(sd, SD_IntrSignalEnable); /* Sync readback */ - } -} - -#ifdef BCMSDYIELD -/* Enable/disable other interrupts */ -void -sdstd_intrs_on(sdioh_info_t *sd, uint16 norm, uint16 err) -{ - if (err) { - norm = SFIELD(norm, INTSTAT_ERROR_INT, 1); - sdstd_wreg16(sd, SD_ErrorIntrSignalEnable, err); - } - - sd->intmask |= norm; - sdstd_wreg16(sd, SD_IntrSignalEnable, sd->intmask); - if (sd_forcerb) - sdstd_rreg16(sd, SD_IntrSignalEnable); /* Sync readback */ -} - -void -sdstd_intrs_off(sdioh_info_t *sd, uint16 norm, uint16 err) -{ - if (err) { - norm = SFIELD(norm, INTSTAT_ERROR_INT, 1); - sdstd_wreg16(sd, SD_ErrorIntrSignalEnable, 0); - } - - sd->intmask &= ~norm; - sdstd_wreg16(sd, SD_IntrSignalEnable, sd->intmask); - if (sd_forcerb) - sdstd_rreg16(sd, SD_IntrSignalEnable); /* Sync readback */ -} -#endif /* BCMSDYIELD */ - -static int -sdstd_host_init(sdioh_info_t *sd) -{ - int num_slots, full_slot; - uint8 reg8; - - uint32 card_ins; - int slot, first_bar = 0; - bool detect_slots = FALSE; - uint bar; - - /* Check for Arasan ID */ - if ((OSL_PCI_READ_CONFIG(sd->osh, PCI_CFG_VID, 4) & 0xFFFF) == VENDOR_SI_IMAGE) { - sd_info(("%s: Found Arasan Standard SDIO Host Controller\n", __FUNCTION__)); - sd->controller_type = SDIOH_TYPE_ARASAN_HDK; - detect_slots = TRUE; - } else if ((OSL_PCI_READ_CONFIG(sd->osh, PCI_CFG_VID, 4) & 0xFFFF) == VENDOR_BROADCOM) { - sd_info(("%s: Found Broadcom 27xx Standard SDIO Host Controller\n", __FUNCTION__)); - sd->controller_type = SDIOH_TYPE_BCM27XX; - detect_slots = FALSE; - } else if ((OSL_PCI_READ_CONFIG(sd->osh, PCI_CFG_VID, 4) & 0xFFFF) == VENDOR_TI) { - sd_info(("%s: Found TI PCIxx21 Standard SDIO Host Controller\n", __FUNCTION__)); - sd->controller_type = SDIOH_TYPE_TI_PCIXX21; - detect_slots = TRUE; - } else if ((OSL_PCI_READ_CONFIG(sd->osh, PCI_CFG_VID, 4) & 0xFFFF) == VENDOR_RICOH) { - sd_info(("%s: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter\n", - __FUNCTION__)); - sd->controller_type = SDIOH_TYPE_RICOH_R5C822; - detect_slots = TRUE; - } else if ((OSL_PCI_READ_CONFIG(sd->osh, PCI_CFG_VID, 4) & 0xFFFF) == VENDOR_JMICRON) { - sd_info(("%s: JMicron Standard SDIO Host Controller\n", - __FUNCTION__)); - sd->controller_type = SDIOH_TYPE_JMICRON; - detect_slots = TRUE; - } else { - return ERROR; - } - - /* - * Determine num of slots - * Search each slot - */ - - first_bar = OSL_PCI_READ_CONFIG(sd->osh, SD_SlotInfo, 4) & 0x7; - num_slots = (OSL_PCI_READ_CONFIG(sd->osh, SD_SlotInfo, 4) & 0xff) >> 4; - num_slots &= 7; - num_slots++; /* map bits to num slots according to spec */ - - if (OSL_PCI_READ_CONFIG(sd->osh, PCI_CFG_VID, 4) == - ((SDIOH_FPGA_ID << 16) | VENDOR_BROADCOM)) { - sd_err(("%s: Found Broadcom Standard SDIO Host Controller FPGA\n", __FUNCTION__)); - /* Set BAR0 Window to SDIOSTH core */ - OSL_PCI_WRITE_CONFIG(sd->osh, PCI_BAR0_WIN, 4, 0x18001000); - - /* Set defaults particular to this controller. */ - detect_slots = TRUE; - num_slots = 1; - first_bar = 0; - - /* Controller supports ADMA2, so turn it on here. */ - sd->sd_dma_mode = DMA_MODE_ADMA2; - } - - /* Map in each slot on the board and query it to see if a - * card is inserted. Use the first populated slot found. - */ - if (sd->mem_space) { - sdstd_reg_unmap(sd->osh, (uintptr)sd->mem_space, SDIOH_REG_WINSZ); - sd->mem_space = NULL; - } - - full_slot = -1; - - for (slot = 0; slot < num_slots; slot++) { - bar = OSL_PCI_READ_CONFIG(sd->osh, PCI_CFG_BAR0 + (4*(slot + first_bar)), 4); - sd->mem_space = (volatile char *)sdstd_reg_map(sd->osh, - (uintptr)bar, SDIOH_REG_WINSZ); - - sd->adapter_slot = -1; - - if (detect_slots) { - card_ins = GFIELD(sdstd_rreg(sd, SD_PresentState), PRES_CARD_PRESENT); - } else { - card_ins = TRUE; - } - - if (card_ins) { - sd_info(("%s: SDIO slot %d: Full\n", __FUNCTION__, slot)); - if (full_slot < 0) - full_slot = slot; - } else { - sd_info(("%s: SDIO slot %d: Empty\n", __FUNCTION__, slot)); - } - - if (sd->mem_space) { - sdstd_reg_unmap(sd->osh, (uintptr)sd->mem_space, SDIOH_REG_WINSZ); - sd->mem_space = NULL; - } - } - - if (full_slot < 0) { - sd_err(("No slots on SDIO controller are populated\n")); - return -1; - } - - bar = OSL_PCI_READ_CONFIG(sd->osh, PCI_CFG_BAR0 + (4*(full_slot + first_bar)), 4); - sd->mem_space = (volatile char *)sdstd_reg_map(sd->osh, (uintptr)bar, SDIOH_REG_WINSZ); - - sd_err(("Using slot %d at BAR%d [0x%08x] mem_space 0x%p\n", - full_slot, - (full_slot + first_bar), - OSL_PCI_READ_CONFIG(sd->osh, PCI_CFG_BAR0 + (4*(full_slot + first_bar)), 4), - sd->mem_space)); - - - sd->adapter_slot = full_slot; - - sd->version = sdstd_rreg16(sd, SD_HostControllerVersion) & 0xFF; - switch (sd->version) { - case 0: - sd_err(("Host Controller version 1.0, Vendor Revision: 0x%02x\n", - sdstd_rreg16(sd, SD_HostControllerVersion) >> 8)); - break; - case 1: - case 2: - sd_err(("Host Controller version 2.0, Vendor Revision: 0x%02x\n", - sdstd_rreg16(sd, SD_HostControllerVersion) >> 8)); - break; - default: - sd_err(("%s: Host Controller version 0x%02x not supported.\n", - __FUNCTION__, sd->version)); - break; - } - - sd->caps = sdstd_rreg(sd, SD_Capabilities); /* Cache this for later use */ - sd->curr_caps = sdstd_rreg(sd, SD_MaxCurCap); - - sdstd_set_dma_mode(sd, sd->sd_dma_mode); - - - sdstd_reset(sd, 1, 0); - - /* Read SD4/SD1 mode */ - if ((reg8 = sdstd_rreg8(sd, SD_HostCntrl))) { - if (reg8 & SD4_MODE) { - sd_err(("%s: Host cntrlr already in 4 bit mode: 0x%x\n", - __FUNCTION__, reg8)); - } - } - - /* Default power on mode is SD1 */ - sd->sd_mode = SDIOH_MODE_SD1; - sd->polled_mode = TRUE; - sd->host_init_done = TRUE; - sd->card_init_done = FALSE; - sd->adapter_slot = full_slot; - - return (SUCCESS); -} -#define CMD5_RETRIES 200 -static int -get_ocr(sdioh_info_t *sd, uint32 *cmd_arg, uint32 *cmd_rsp) -{ - int retries, status; - - /* Get the Card's Operation Condition. Occasionally the board - * takes a while to become ready - */ - retries = CMD5_RETRIES; - do { - *cmd_rsp = 0; - if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_5, *cmd_arg)) - != SUCCESS) { - sd_err(("%s: CMD5 failed\n", __FUNCTION__)); - return status; - } - sdstd_cmd_getrsp(sd, cmd_rsp, 1); - if (!GFIELD(*cmd_rsp, RSP4_CARD_READY)) - sd_trace(("%s: Waiting for card to become ready\n", __FUNCTION__)); - } while ((!GFIELD(*cmd_rsp, RSP4_CARD_READY)) && --retries); - if (!retries) - return ERROR; - - return (SUCCESS); -} - -static int -sdstd_client_init(sdioh_info_t *sd) -{ - uint32 cmd_arg, cmd_rsp; - int status; - uint8 fn_ints; - - - sd_trace(("%s: Powering up slot %d\n", __FUNCTION__, sd->adapter_slot)); - - /* Clear any pending ints */ - sdstd_wreg16(sd, SD_IntrStatus, 0x1ff); - sdstd_wreg16(sd, SD_ErrorIntrStatus, 0x0fff); - - /* Enable both Normal and Error Status. This does not enable - * interrupts, it only enables the status bits to - * become 'live' - */ - sdstd_wreg16(sd, SD_IntrStatusEnable, 0x1ff); - sdstd_wreg16(sd, SD_ErrorIntrStatusEnable, 0xffff); - - sdstd_wreg16(sd, SD_IntrSignalEnable, 0); /* Disable ints for now. */ - - /* Start at ~400KHz clock rate for initialization */ - if (!sdstd_start_clock(sd, 128)) { - sd_err(("sdstd_start_clock failed\n")); - return ERROR; - } - if (!sdstd_start_power(sd)) { - sd_err(("sdstd_start_power failed\n")); - return ERROR; - } - - if (sd->num_funcs == 0) { - sd_err(("%s: No IO funcs!\n", __FUNCTION__)); - return ERROR; - } - - /* In SPI mode, issue CMD0 first */ - if (sd->sd_mode == SDIOH_MODE_SPI) { - cmd_arg = 0; - if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_0, cmd_arg)) - != SUCCESS) { - sd_err(("BCMSDIOH: cardinit: CMD0 failed!\n")); - return status; - } - } - - if (sd->sd_mode != SDIOH_MODE_SPI) { - uint16 rsp6_status; - - /* Card is operational. Ask it to send an RCA */ - cmd_arg = 0; - if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_3, cmd_arg)) - != SUCCESS) { - sd_err(("%s: CMD3 failed!\n", __FUNCTION__)); - return status; - } - - /* Verify the card status returned with the cmd response */ - sdstd_cmd_getrsp(sd, &cmd_rsp, 1); - rsp6_status = GFIELD(cmd_rsp, RSP6_STATUS); - if (GFIELD(rsp6_status, RSP6STAT_COM_CRC_ERROR) || - GFIELD(rsp6_status, RSP6STAT_ILLEGAL_CMD) || - GFIELD(rsp6_status, RSP6STAT_ERROR)) { - sd_err(("%s: CMD3 response error. Response = 0x%x!\n", - __FUNCTION__, rsp6_status)); - return ERROR; - } - - /* Save the Card's RCA */ - sd->card_rca = GFIELD(cmd_rsp, RSP6_IO_RCA); - sd_info(("RCA is 0x%x\n", sd->card_rca)); - - if (rsp6_status) - sd_err(("raw status is 0x%x\n", rsp6_status)); - - /* Select the card */ - cmd_arg = SFIELD(0, CMD7_RCA, sd->card_rca); - if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_7, cmd_arg)) - != SUCCESS) { - sd_err(("%s: CMD7 failed!\n", __FUNCTION__)); - return status; - } - sdstd_cmd_getrsp(sd, &cmd_rsp, 1); - if (cmd_rsp != SDIOH_CMD7_EXP_STATUS) { - sd_err(("%s: CMD7 response error. Response = 0x%x!\n", - __FUNCTION__, cmd_rsp)); - return ERROR; - } - } - - sdstd_card_enablefuncs(sd); - - if (!sdstd_bus_width(sd, sd_sdmode)) { - sd_err(("sdstd_bus_width failed\n")); - return ERROR; - } - - set_client_block_size(sd, 1, BLOCK_SIZE_4318); - fn_ints = INTR_CTL_FUNC1_EN; - - if (sd->num_funcs >= 2) { - set_client_block_size(sd, 2, sd_f2_blocksize /* BLOCK_SIZE_4328 */); - fn_ints |= INTR_CTL_FUNC2_EN; - } - - /* Enable/Disable Client interrupts */ - /* Turn on here but disable at host controller? */ - if (sdstd_card_regwrite(sd, 0, SDIOD_CCCR_INTEN, 1, - (fn_ints | INTR_CTL_MASTER_EN)) != SUCCESS) { - sd_err(("%s: Could not enable ints in CCCR\n", __FUNCTION__)); - return ERROR; - } - - /* Switch to High-speed clocking mode if both host and device support it */ - sdstd_set_highspeed_mode(sd, (bool)sd_hiok); - - /* After configuring for High-Speed mode, set the desired clock rate. */ - if (!sdstd_start_clock(sd, (uint16)sd_divisor)) { - sd_err(("sdstd_start_clock failed\n")); - return ERROR; - } - - sd->card_init_done = TRUE; - - return SUCCESS; -} - -static int -sdstd_set_highspeed_mode(sdioh_info_t *sd, bool HSMode) -{ - uint32 regdata; - int status; - uint8 reg8; - - reg8 = sdstd_rreg8(sd, SD_HostCntrl); - - - if (HSMode == TRUE) { - if (sd_hiok && (GFIELD(sd->caps, CAP_HIGHSPEED)) == 0) { - sd_err(("Host Controller does not support hi-speed mode.\n")); - return BCME_ERROR; - } - - sd_info(("Attempting to enable High-Speed mode.\n")); - - if ((status = sdstd_card_regread(sd, 0, SDIOD_CCCR_SPEED_CONTROL, - 1, ®data)) != SUCCESS) { - return BCME_SDIO_ERROR; - } - if (regdata & SDIO_SPEED_SHS) { - sd_info(("Device supports High-Speed mode.\n")); - - regdata |= SDIO_SPEED_EHS; - - sd_info(("Writing %08x to Card at %08x\n", - regdata, SDIOD_CCCR_SPEED_CONTROL)); - if ((status = sdstd_card_regwrite(sd, 0, SDIOD_CCCR_SPEED_CONTROL, - 1, regdata)) != BCME_OK) { - return BCME_SDIO_ERROR; - } - - if ((status = sdstd_card_regread(sd, 0, SDIOD_CCCR_SPEED_CONTROL, - 1, ®data)) != BCME_OK) { - return BCME_SDIO_ERROR; - } - - sd_info(("Read %08x to Card at %08x\n", regdata, SDIOD_CCCR_SPEED_CONTROL)); - - reg8 = SFIELD(reg8, HOST_HI_SPEED_EN, 1); - - sd_err(("High-speed clocking mode enabled.\n")); - } - else { - sd_err(("Device does not support High-Speed Mode.\n")); - reg8 = SFIELD(reg8, HOST_HI_SPEED_EN, 0); - } - } else { - /* Force off device bit */ - if ((status = sdstd_card_regread(sd, 0, SDIOD_CCCR_SPEED_CONTROL, - 1, ®data)) != BCME_OK) { - return status; - } - if (regdata & SDIO_SPEED_EHS) { - regdata &= ~SDIO_SPEED_EHS; - if ((status = sdstd_card_regwrite(sd, 0, SDIOD_CCCR_SPEED_CONTROL, - 1, regdata)) != BCME_OK) { - return status; - } - } - - sd_err(("High-speed clocking mode disabled.\n")); - reg8 = SFIELD(reg8, HOST_HI_SPEED_EN, 0); - } - - sdstd_wreg8(sd, SD_HostCntrl, reg8); - - return BCME_OK; -} - -/* Select DMA Mode: - * If dma_mode == DMA_MODE_AUTO, pick the "best" mode. - * Otherwise, pick the selected mode if supported. - * If not supported, use PIO mode. - */ -static int -sdstd_set_dma_mode(sdioh_info_t *sd, int8 dma_mode) -{ - uint8 reg8, dma_sel_bits = SDIOH_SDMA_MODE; - int8 prev_dma_mode = sd->sd_dma_mode; - - switch (prev_dma_mode) { - case DMA_MODE_AUTO: - sd_dma(("%s: Selecting best DMA mode supported by controller.\n", - __FUNCTION__)); - if (GFIELD(sd->caps, CAP_ADMA2)) { - sd->sd_dma_mode = DMA_MODE_ADMA2; - dma_sel_bits = SDIOH_ADMA2_MODE; - } else if (GFIELD(sd->caps, CAP_ADMA1)) { - sd->sd_dma_mode = DMA_MODE_ADMA1; - dma_sel_bits = SDIOH_ADMA1_MODE; - } else if (GFIELD(sd->caps, CAP_DMA)) { - sd->sd_dma_mode = DMA_MODE_SDMA; - } else { - sd->sd_dma_mode = DMA_MODE_NONE; - } - break; - case DMA_MODE_NONE: - sd->sd_dma_mode = DMA_MODE_NONE; - break; - case DMA_MODE_SDMA: - if (GFIELD(sd->caps, CAP_DMA)) { - sd->sd_dma_mode = DMA_MODE_SDMA; - } else { - sd_err(("%s: SDMA not supported by controller.\n", __FUNCTION__)); - sd->sd_dma_mode = DMA_MODE_NONE; - } - break; - case DMA_MODE_ADMA1: - if (GFIELD(sd->caps, CAP_ADMA1)) { - sd->sd_dma_mode = DMA_MODE_ADMA1; - dma_sel_bits = SDIOH_ADMA1_MODE; - } else { - sd_err(("%s: ADMA1 not supported by controller.\n", __FUNCTION__)); - sd->sd_dma_mode = DMA_MODE_NONE; - } - break; - case DMA_MODE_ADMA2: - if (GFIELD(sd->caps, CAP_ADMA2)) { - sd->sd_dma_mode = DMA_MODE_ADMA2; - dma_sel_bits = SDIOH_ADMA2_MODE; - } else { - sd_err(("%s: ADMA2 not supported by controller.\n", __FUNCTION__)); - sd->sd_dma_mode = DMA_MODE_NONE; - } - break; - case DMA_MODE_ADMA2_64: - sd_err(("%s: 64b ADMA2 not supported by driver.\n", __FUNCTION__)); - sd->sd_dma_mode = DMA_MODE_NONE; - break; - default: - sd_err(("%s: Unsupported DMA Mode %d requested.\n", __FUNCTION__, - prev_dma_mode)); - sd->sd_dma_mode = DMA_MODE_NONE; - break; - } - - /* clear SysAddr, only used for SDMA */ - sdstd_wreg(sd, SD_SysAddr, 0); - - sd_err(("%s: %s mode selected.\n", __FUNCTION__, dma_mode_description[sd->sd_dma_mode])); - - reg8 = sdstd_rreg8(sd, SD_HostCntrl); - reg8 = SFIELD(reg8, HOST_DMA_SEL, dma_sel_bits); - sdstd_wreg8(sd, SD_HostCntrl, reg8); - sd_dma(("%s: SD_HostCntrl=0x%02x\n", __FUNCTION__, reg8)); - - return BCME_OK; -} - - -bool -sdstd_start_clock(sdioh_info_t *sd, uint16 new_sd_divisor) -{ - uint rc, count; - uint16 divisor; - - /* turn off HC clock */ - sdstd_wreg16(sd, SD_ClockCntrl, - sdstd_rreg16(sd, SD_ClockCntrl) & ~((uint16)0x4)); /* Disable the HC clock */ - - /* Set divisor */ - - divisor = (new_sd_divisor >> 1) << 8; - - sd_info(("Clock control is 0x%x\n", sdstd_rreg16(sd, SD_ClockCntrl))); - sdstd_mod_reg16(sd, SD_ClockCntrl, 0xff00, divisor); - sd_info(("%s: Using clock divisor of %d (regval 0x%04x)\n", __FUNCTION__, - new_sd_divisor, divisor)); - - sd_info(("Primary Clock Freq = %d MHz\n", GFIELD(sd->caps, CAP_TO_CLKFREQ))); - - if (GFIELD(sd->caps, CAP_TO_CLKFREQ) == 50) { - sd_info(("%s: Resulting SDIO clock is %d %s\n", __FUNCTION__, - ((50 % new_sd_divisor) ? (50000 / new_sd_divisor) : (50 / new_sd_divisor)), - ((50 % new_sd_divisor) ? "KHz" : "MHz"))); - } else if (GFIELD(sd->caps, CAP_TO_CLKFREQ) == 48) { - sd_info(("%s: Resulting SDIO clock is %d %s\n", __FUNCTION__, - ((48 % new_sd_divisor) ? (48000 / new_sd_divisor) : (48 / new_sd_divisor)), - ((48 % new_sd_divisor) ? "KHz" : "MHz"))); - } else if (GFIELD(sd->caps, CAP_TO_CLKFREQ) == 33) { - sd_info(("%s: Resulting SDIO clock is %d %s\n", __FUNCTION__, - ((33 % new_sd_divisor) ? (33000 / new_sd_divisor) : (33 / new_sd_divisor)), - ((33 % new_sd_divisor) ? "KHz" : "MHz"))); - - } else if (sd->controller_type == SDIOH_TYPE_BCM27XX) { - } else { - sd_err(("Need to determine divisor for %d MHz clocks\n", - GFIELD(sd->caps, CAP_TO_CLKFREQ))); - sd_err(("Consult SD Host Controller Spec: Clock Control Register\n")); - return (FALSE); - } - - sdstd_or_reg16(sd, SD_ClockCntrl, 0x1); /* Enable the clock */ - - /* Wait for clock to stabilize */ - rc = (sdstd_rreg16(sd, SD_ClockCntrl) & 2); - count = 0; - while (!rc) { - OSL_DELAY(1); - sd_info(("Waiting for clock to become stable 0x%x\n", rc)); - rc = (sdstd_rreg16(sd, SD_ClockCntrl) & 2); - count++; - if (count > 10000) { - sd_err(("%s:Clocks failed to stabilize after %u attempts", - __FUNCTION__, count)); - return (FALSE); - } - } - /* Turn on clock */ - sdstd_or_reg16(sd, SD_ClockCntrl, 0x4); - - /* Set timeout control (adjust default value based on divisor). - * Disabling timeout interrupts during setting is advised by host spec. - */ - { - uint16 regdata; - uint toval; - - toval = sd_toctl; - divisor = new_sd_divisor; - - while (toval && !(divisor & 1)) { - toval -= 1; - divisor >>= 1; - } - - regdata = sdstd_rreg16(sd, SD_ErrorIntrStatusEnable); - sdstd_wreg16(sd, SD_ErrorIntrStatusEnable, (regdata & ~ERRINT_DATA_TIMEOUT_BIT)); - sdstd_wreg8(sd, SD_TimeoutCntrl, (uint8)toval); - sdstd_wreg16(sd, SD_ErrorIntrStatusEnable, regdata); - } - - OSL_DELAY(2); - - sd_info(("Final Clock control is 0x%x\n", sdstd_rreg16(sd, SD_ClockCntrl))); - - return TRUE; -} - -bool -sdstd_start_power(sdioh_info_t *sd) -{ - char *s; - uint32 cmd_arg; - uint32 cmd_rsp; - uint8 pwr = 0; - int volts; - - volts = 0; - s = NULL; - if (GFIELD(sd->caps, CAP_VOLT_1_8)) { - volts = 5; - s = "1.8"; - } - if (GFIELD(sd->caps, CAP_VOLT_3_0)) { - volts = 6; - s = "3.0"; - } - if (GFIELD(sd->caps, CAP_VOLT_3_3)) { - volts = 7; - s = "3.3"; - } - - pwr = SFIELD(pwr, PWR_VOLTS, volts); - pwr = SFIELD(pwr, PWR_BUS_EN, 1); - sdstd_wreg8(sd, SD_PwrCntrl, pwr); /* Set Voltage level */ - sd_info(("Setting Bus Power to %s Volts\n", s)); - - /* Wait for power to stabilize, Dongle takes longer than NIC. */ - OSL_DELAY(250000); - - /* Get the Card's Operation Condition. Occasionally the board - * takes a while to become ready - */ - cmd_arg = 0; - cmd_rsp = 0; - if (get_ocr(sd, &cmd_arg, &cmd_rsp) != SUCCESS) { - sd_err(("%s: Failed to get OCR bailing\n", __FUNCTION__)); - sdstd_reset(sd, 0, 1); - return FALSE; - } - - sd_info(("mem_present = %d\n", GFIELD(cmd_rsp, RSP4_MEM_PRESENT))); - sd_info(("num_funcs = %d\n", GFIELD(cmd_rsp, RSP4_NUM_FUNCS))); - sd_info(("card_ready = %d\n", GFIELD(cmd_rsp, RSP4_CARD_READY))); - sd_info(("OCR = 0x%x\n", GFIELD(cmd_rsp, RSP4_IO_OCR))); - - /* Verify that the card supports I/O mode */ - if (GFIELD(cmd_rsp, RSP4_NUM_FUNCS) == 0) { - sd_err(("%s: Card does not support I/O\n", __FUNCTION__)); - return ERROR; - } - sd->num_funcs = GFIELD(cmd_rsp, RSP4_NUM_FUNCS); - - /* Examine voltage: Arasan only supports 3.3 volts, - * so look for 3.2-3.3 Volts and also 3.3-3.4 volts. - */ - - if ((GFIELD(cmd_rsp, RSP4_IO_OCR) & (0x3 << 20)) == 0) { - sd_err(("This client does not support 3.3 volts!\n")); - return ERROR; - } - sd_info(("Leaving bus power at 3.3 Volts\n")); - - cmd_arg = SFIELD(0, CMD5_OCR, 0xfff000); - cmd_rsp = 0; - get_ocr(sd, &cmd_arg, &cmd_rsp); - sd_info(("OCR = 0x%x\n", GFIELD(cmd_rsp, RSP4_IO_OCR))); - return TRUE; -} - -bool -sdstd_bus_width(sdioh_info_t *sd, int new_mode) -{ - uint32 regdata; - int status; - uint8 reg8; - - sd_trace(("%s\n", __FUNCTION__)); - if (sd->sd_mode == new_mode) { - sd_info(("%s: Already at width %d\n", __FUNCTION__, new_mode)); - /* Could exit, but continue just in case... */ - } - - /* Set client side via reg 0x7 in CCCR */ - if ((status = sdstd_card_regread (sd, 0, SDIOD_CCCR_BICTRL, 1, ®data)) != SUCCESS) - return (bool)status; - regdata &= ~BUS_SD_DATA_WIDTH_MASK; - if (new_mode == SDIOH_MODE_SD4) { - sd_info(("Changing to SD4 Mode\n")); - regdata |= SD4_MODE; - } else if (new_mode == SDIOH_MODE_SD1) { - sd_info(("Changing to SD1 Mode\n")); - } else { - sd_err(("SPI Mode not supported by Standard Host Controller\n")); - } - - if ((status = sdstd_card_regwrite (sd, 0, SDIOD_CCCR_BICTRL, 1, regdata)) != SUCCESS) - return (bool)status; - - /* Set host side via Host reg */ - reg8 = sdstd_rreg8(sd, SD_HostCntrl) & ~SD4_MODE; - if (new_mode == SDIOH_MODE_SD4) - reg8 |= SD4_MODE; - sdstd_wreg8(sd, SD_HostCntrl, reg8); - - sd->sd_mode = new_mode; - - return TRUE; -} - -static int -sdstd_driver_init(sdioh_info_t *sd) -{ - sd_trace(("%s\n", __FUNCTION__)); - if ((sdstd_host_init(sd)) != SUCCESS) { - return ERROR; - } - - if (sdstd_client_init(sd) != SUCCESS) { - return ERROR; - } - - return SUCCESS; -} - -static int -sdstd_get_cisaddr(sdioh_info_t *sd, uint32 regaddr) -{ - /* read 24 bits and return valid 17 bit addr */ - int i; - uint32 scratch, regdata; - uint8 *ptr = (uint8 *)&scratch; - for (i = 0; i < 3; i++) { - if ((sdstd_card_regread (sd, 0, regaddr, 1, ®data)) != SUCCESS) - sd_err(("%s: Can't read!\n", __FUNCTION__)); - - *ptr++ = (uint8) regdata; - regaddr++; - } - /* Only the lower 17-bits are valid */ - scratch = ltoh32(scratch); - scratch &= 0x0001FFFF; - return (scratch); -} - -static int -sdstd_card_enablefuncs(sdioh_info_t *sd) -{ - int status; - uint32 regdata; - uint32 fbraddr; - uint8 func; - - sd_trace(("%s\n", __FUNCTION__)); - - /* Get the Card's common CIS address */ - sd->com_cis_ptr = sdstd_get_cisaddr(sd, SDIOD_CCCR_CISPTR_0); - sd->func_cis_ptr[0] = sd->com_cis_ptr; - sd_info(("%s: Card's Common CIS Ptr = 0x%x\n", __FUNCTION__, sd->com_cis_ptr)); - - /* Get the Card's function CIS (for each function) */ - for (fbraddr = SDIOD_FBR_STARTADDR, func = 1; - func <= sd->num_funcs; func++, fbraddr += SDIOD_FBR_SIZE) { - sd->func_cis_ptr[func] = sdstd_get_cisaddr(sd, SDIOD_FBR_CISPTR_0 + fbraddr); - sd_info(("%s: Function %d CIS Ptr = 0x%x\n", - __FUNCTION__, func, sd->func_cis_ptr[func])); - } - - /* Enable function 1 on the card */ - regdata = SDIO_FUNC_ENABLE_1; - if ((status = sdstd_card_regwrite(sd, 0, SDIOD_CCCR_IOEN, 1, regdata)) != SUCCESS) - return status; - - return SUCCESS; -} - -/* Read client card reg */ -static int -sdstd_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 *data) -{ - int status; - uint32 cmd_arg; - uint32 rsp5; - - - cmd_arg = 0; - - if ((func == 0) || (regsize == 1)) { - cmd_arg = SFIELD(cmd_arg, CMD52_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, CMD52_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, CMD52_RW_FLAG, SDIOH_XFER_TYPE_READ); - cmd_arg = SFIELD(cmd_arg, CMD52_RAW, 0); - cmd_arg = SFIELD(cmd_arg, CMD52_DATA, 0); - - if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_52, cmd_arg)) - != SUCCESS) - return status; - - sdstd_cmd_getrsp(sd, &rsp5, 1); - if (sdstd_rreg16(sd, SD_ErrorIntrStatus) != 0) { - sd_err(("%s: 1: ErrorintrStatus 0x%x\n", - __FUNCTION__, sdstd_rreg16(sd, SD_ErrorIntrStatus))); - } - - if (GFIELD(rsp5, RSP5_FLAGS) != 0x10) - sd_err(("%s: rsp5 flags is 0x%x\t %d\n", - __FUNCTION__, GFIELD(rsp5, RSP5_FLAGS), func)); - - if (GFIELD(rsp5, RSP5_STUFF)) - sd_err(("%s: rsp5 stuff is 0x%x: should be 0\n", - __FUNCTION__, GFIELD(rsp5, RSP5_STUFF))); - *data = GFIELD(rsp5, RSP5_DATA); - } else { - cmd_arg = SFIELD(cmd_arg, CMD53_BYTE_BLK_CNT, regsize); - cmd_arg = SFIELD(cmd_arg, CMD53_OP_CODE, 1); - cmd_arg = SFIELD(cmd_arg, CMD53_BLK_MODE, 0); - cmd_arg = SFIELD(cmd_arg, CMD53_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, CMD53_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, CMD53_RW_FLAG, SDIOH_XFER_TYPE_READ); - - sd->data_xfer_count = regsize; - - /* sdstd_cmd_issue() returns with the command complete bit - * in the ISR already cleared - */ - if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_53, cmd_arg)) - != SUCCESS) - return status; - - sdstd_cmd_getrsp(sd, &rsp5, 1); - - if (GFIELD(rsp5, RSP5_FLAGS) != 0x10) - sd_err(("%s: rsp5 flags is 0x%x\t %d\n", - __FUNCTION__, GFIELD(rsp5, RSP5_FLAGS), func)); - - if (GFIELD(rsp5, RSP5_STUFF)) - sd_err(("%s: rsp5 stuff is 0x%x: should be 0\n", - __FUNCTION__, GFIELD(rsp5, RSP5_STUFF))); - - if (sd->polled_mode) { - volatile uint16 int_reg; - int retries = RETRIES_LARGE; - - /* Wait for Read Buffer to become ready */ - do { - int_reg = sdstd_rreg16(sd, SD_IntrStatus); - } while (--retries && (GFIELD(int_reg, INTSTAT_BUF_READ_READY) == 0)); - - if (!retries) { - sd_err(("%s: Timeout on Buf_Read_Ready: " - "intStat: 0x%x errint: 0x%x PresentState 0x%x\n", - __FUNCTION__, int_reg, - sdstd_rreg16(sd, SD_ErrorIntrStatus), - sdstd_rreg(sd, SD_PresentState))); - sdstd_check_errs(sd, SDIOH_CMD_53, cmd_arg); - return (ERROR); - } - - /* Have Buffer Ready, so clear it and read the data */ - sdstd_wreg16(sd, SD_IntrStatus, SFIELD(0, INTSTAT_BUF_READ_READY, 1)); - if (regsize == 2) - *data = sdstd_rreg16(sd, SD_BufferDataPort0); - else - *data = sdstd_rreg(sd, SD_BufferDataPort0); - - /* Check Status. - * After the data is read, the Transfer Complete bit should be on - */ - retries = RETRIES_LARGE; - do { - int_reg = sdstd_rreg16(sd, SD_IntrStatus); - } while (--retries && (GFIELD(int_reg, INTSTAT_XFER_COMPLETE) == 0)); - - /* Check for any errors from the data phase */ - if (sdstd_check_errs(sd, SDIOH_CMD_53, cmd_arg)) - return ERROR; - - if (!retries) { - sd_err(("%s: Timeout on xfer complete: " - "intr 0x%04x err 0x%04x state 0x%08x\n", - __FUNCTION__, int_reg, - sdstd_rreg16(sd, SD_ErrorIntrStatus), - sdstd_rreg(sd, SD_PresentState))); - return (ERROR); - } - - sdstd_wreg16(sd, SD_IntrStatus, SFIELD(0, INTSTAT_XFER_COMPLETE, 1)); - } - } - if (sd->polled_mode) { - if (regsize == 2) - *data &= 0xffff; - } - return SUCCESS; -} - -bool -check_client_intr(sdioh_info_t *sd) -{ - uint16 raw_int, cur_int, old_int; - - raw_int = sdstd_rreg16(sd, SD_IntrStatus); - cur_int = raw_int & sd->intmask; - - if (!cur_int) { - /* Not an error -- might share interrupts... */ - return FALSE; - } - - if (GFIELD(cur_int, INTSTAT_CARD_INT)) { - old_int = sdstd_rreg16(sd, SD_IntrStatusEnable); - sdstd_wreg16(sd, SD_IntrStatusEnable, SFIELD(old_int, INTSTAT_CARD_INT, 0)); - - if (sd->client_intr_enabled && sd->use_client_ints) { - sd->intrcount++; - ASSERT(sd->intr_handler); - ASSERT(sd->intr_handler_arg); - (sd->intr_handler)(sd->intr_handler_arg); - } else { - sd_err(("%s: Not ready for intr: enabled %d, handler %p\n", - __FUNCTION__, sd->client_intr_enabled, sd->intr_handler)); - } - sdstd_wreg16(sd, SD_IntrStatusEnable, old_int); - } else { - /* Local interrupt: disable, set flag, and save intrstatus */ - sdstd_wreg16(sd, SD_IntrSignalEnable, 0); - sdstd_wreg16(sd, SD_ErrorIntrSignalEnable, 0); - sd->local_intrcount++; - sd->got_hcint = TRUE; - sd->last_intrstatus = cur_int; - } - - return TRUE; -} - -void -sdstd_spinbits(sdioh_info_t *sd, uint16 norm, uint16 err) -{ - uint16 int_reg, err_reg; - int retries = RETRIES_LARGE; - - do { - int_reg = sdstd_rreg16(sd, SD_IntrStatus); - err_reg = sdstd_rreg16(sd, SD_ErrorIntrStatus); - } while (--retries && !(int_reg & norm) && !(err_reg & err)); - - norm |= sd->intmask; - if (err_reg & err) - norm = SFIELD(norm, INTSTAT_ERROR_INT, 1); - sd->last_intrstatus = int_reg & norm; -} - -/* write a client register */ -static int -sdstd_card_regwrite(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 data) -{ - int status; - uint32 cmd_arg, rsp5, flags; - - cmd_arg = 0; - - if ((func == 0) || (regsize == 1)) { - cmd_arg = SFIELD(cmd_arg, CMD52_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, CMD52_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, CMD52_RW_FLAG, SDIOH_XFER_TYPE_WRITE); - cmd_arg = SFIELD(cmd_arg, CMD52_RAW, 0); - cmd_arg = SFIELD(cmd_arg, CMD52_DATA, data & 0xff); - if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_52, cmd_arg)) - != SUCCESS) - return status; - - sdstd_cmd_getrsp(sd, &rsp5, 1); - flags = GFIELD(rsp5, RSP5_FLAGS); - if (flags && (flags != 0x10)) - sd_err(("%s: rsp5.rsp5.flags = 0x%x, expecting 0x10\n", - __FUNCTION__, flags)); - } - else { - cmd_arg = SFIELD(cmd_arg, CMD53_BYTE_BLK_CNT, regsize); - cmd_arg = SFIELD(cmd_arg, CMD53_OP_CODE, 1); - cmd_arg = SFIELD(cmd_arg, CMD53_BLK_MODE, 0); - cmd_arg = SFIELD(cmd_arg, CMD53_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, CMD53_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, CMD53_RW_FLAG, SDIOH_XFER_TYPE_WRITE); - - sd->data_xfer_count = regsize; - - /* sdstd_cmd_issue() returns with the command complete bit - * in the ISR already cleared - */ - if ((status = sdstd_cmd_issue(sd, USE_DMA(sd), SDIOH_CMD_53, cmd_arg)) - != SUCCESS) - return status; - - sdstd_cmd_getrsp(sd, &rsp5, 1); - - if (GFIELD(rsp5, RSP5_FLAGS) != 0x10) - sd_err(("%s: rsp5 flags = 0x%x, expecting 0x10\n", - __FUNCTION__, GFIELD(rsp5, RSP5_FLAGS))); - if (GFIELD(rsp5, RSP5_STUFF)) - sd_err(("%s: rsp5 stuff is 0x%x: expecting 0\n", - __FUNCTION__, GFIELD(rsp5, RSP5_STUFF))); - - if (sd->polled_mode) { - uint16 int_reg; - int retries = RETRIES_LARGE; - - /* Wait for Write Buffer to become ready */ - do { - int_reg = sdstd_rreg16(sd, SD_IntrStatus); - } while (--retries && (GFIELD(int_reg, INTSTAT_BUF_WRITE_READY) == 0)); - - if (!retries) { - sd_err(("%s: Timeout on Buf_Write_Ready: intStat: 0x%x " - "errint: 0x%x PresentState 0x%x\n", - __FUNCTION__, int_reg, - sdstd_rreg16(sd, SD_ErrorIntrStatus), - sdstd_rreg(sd, SD_PresentState))); - sdstd_check_errs(sd, SDIOH_CMD_53, cmd_arg); - return (ERROR); - } - /* Clear Write Buf Ready bit */ - int_reg = 0; - int_reg = SFIELD(int_reg, INTSTAT_BUF_WRITE_READY, 1); - sdstd_wreg16(sd, SD_IntrStatus, int_reg); - - /* At this point we have Buffer Ready, so write the data */ - if (regsize == 2) - sdstd_wreg16(sd, SD_BufferDataPort0, (uint16) data); - else - sdstd_wreg(sd, SD_BufferDataPort0, data); - - /* Wait for Transfer Complete */ - retries = RETRIES_LARGE; - do { - int_reg = sdstd_rreg16(sd, SD_IntrStatus); - } while (--retries && (GFIELD(int_reg, INTSTAT_XFER_COMPLETE) == 0)); - - /* Check for any errors from the data phase */ - if (sdstd_check_errs(sd, SDIOH_CMD_53, cmd_arg)) - return ERROR; - - if (retries == 0) { - sd_err(("%s: Timeout for xfer complete; State = 0x%x, " - "intr state=0x%x, Errintstatus 0x%x rcnt %d, tcnt %d\n", - __FUNCTION__, sdstd_rreg(sd, SD_PresentState), - int_reg, sdstd_rreg16(sd, SD_ErrorIntrStatus), - sd->r_cnt, sd->t_cnt)); - } - /* Clear the status bits */ - sdstd_wreg16(sd, SD_IntrStatus, SFIELD(int_reg, INTSTAT_CARD_INT, 0)); - } - } - return SUCCESS; -} - -void -sdstd_cmd_getrsp(sdioh_info_t *sd, uint32 *rsp_buffer, int count /* num 32 bit words */) -{ - int rsp_count; - int respaddr = SD_Response0; - - if (count > 4) - count = 4; - - for (rsp_count = 0; rsp_count < count; rsp_count++) { - *rsp_buffer++ = sdstd_rreg(sd, respaddr); - respaddr += 4; - } -} - -static int -sdstd_cmd_issue(sdioh_info_t *sdioh_info, bool use_dma, uint32 cmd, uint32 arg) -{ - uint16 cmd_reg; - int retries; - uint32 cmd_arg; - uint16 xfer_reg = 0; - - - if ((sdioh_info->sd_mode == SDIOH_MODE_SPI) && - ((cmd == SDIOH_CMD_3) || (cmd == SDIOH_CMD_7) || (cmd == SDIOH_CMD_15))) { - sd_err(("%s: Cmd %d is not for SPI\n", __FUNCTION__, cmd)); - return ERROR; - } - - retries = RETRIES_SMALL; - while ((GFIELD(sdstd_rreg(sdioh_info, SD_PresentState), PRES_CMD_INHIBIT)) && --retries) { - if (retries == RETRIES_SMALL) - sd_err(("%s: Waiting for Command Inhibit cmd = %d 0x%x\n", - __FUNCTION__, cmd, sdstd_rreg(sdioh_info, SD_PresentState))); - } - if (!retries) { - sd_err(("%s: Command Inhibit timeout\n", __FUNCTION__)); - if (trap_errs) - ASSERT(0); - return ERROR; - } - - - cmd_reg = 0; - switch (cmd) { - case SDIOH_CMD_0: /* Set Card to Idle State - No Response */ - sd_data(("%s: CMD%d\n", __FUNCTION__, cmd)); - cmd_reg = SFIELD(cmd_reg, CMD_RESP_TYPE, RESP_TYPE_NONE); - cmd_reg = SFIELD(cmd_reg, CMD_CRC_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_DATA_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_TYPE, CMD_TYPE_NORMAL); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX, cmd); - break; - - case SDIOH_CMD_3: /* Ask card to send RCA - Response R6 */ - sd_data(("%s: CMD%d\n", __FUNCTION__, cmd)); - cmd_reg = SFIELD(cmd_reg, CMD_RESP_TYPE, RESP_TYPE_48); - cmd_reg = SFIELD(cmd_reg, CMD_CRC_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_DATA_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_TYPE, CMD_TYPE_NORMAL); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX, cmd); - break; - - case SDIOH_CMD_5: /* Send Operation condition - Response R4 */ - sd_data(("%s: CMD%d\n", __FUNCTION__, cmd)); - cmd_reg = SFIELD(cmd_reg, CMD_RESP_TYPE, RESP_TYPE_48); - cmd_reg = SFIELD(cmd_reg, CMD_CRC_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_DATA_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_TYPE, CMD_TYPE_NORMAL); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX, cmd); - break; - - case SDIOH_CMD_7: /* Select card - Response R1 */ - sd_data(("%s: CMD%d\n", __FUNCTION__, cmd)); - cmd_reg = SFIELD(cmd_reg, CMD_RESP_TYPE, RESP_TYPE_48); - cmd_reg = SFIELD(cmd_reg, CMD_CRC_EN, 1); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX_EN, 1); - cmd_reg = SFIELD(cmd_reg, CMD_DATA_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_TYPE, CMD_TYPE_NORMAL); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX, cmd); - break; - - case SDIOH_CMD_15: /* Set card to inactive state - Response None */ - sd_data(("%s: CMD%d\n", __FUNCTION__, cmd)); - cmd_reg = SFIELD(cmd_reg, CMD_RESP_TYPE, RESP_TYPE_NONE); - cmd_reg = SFIELD(cmd_reg, CMD_CRC_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_DATA_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_TYPE, CMD_TYPE_NORMAL); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX, cmd); - break; - - case SDIOH_CMD_52: /* IO R/W Direct (single byte) - Response R5 */ - - sd_data(("%s: CMD52 func(%d) addr(0x%x) %s data(0x%x)\n", - __FUNCTION__, - GFIELD(arg, CMD52_FUNCTION), - GFIELD(arg, CMD52_REG_ADDR), - GFIELD(arg, CMD52_RW_FLAG) ? "W" : "R", - GFIELD(arg, CMD52_DATA))); - - cmd_reg = SFIELD(cmd_reg, CMD_RESP_TYPE, RESP_TYPE_48); - cmd_reg = SFIELD(cmd_reg, CMD_CRC_EN, 1); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX_EN, 1); - cmd_reg = SFIELD(cmd_reg, CMD_DATA_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_TYPE, CMD_TYPE_NORMAL); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX, cmd); - break; - - case SDIOH_CMD_53: /* IO R/W Extended (multiple bytes/blocks) */ - - sd_data(("%s: CMD53 func(%d) addr(0x%x) %s mode(%s) cnt(%d), %s\n", - __FUNCTION__, - GFIELD(arg, CMD53_FUNCTION), - GFIELD(arg, CMD53_REG_ADDR), - GFIELD(arg, CMD53_RW_FLAG) ? "W" : "R", - GFIELD(arg, CMD53_BLK_MODE) ? "Block" : "Byte", - GFIELD(arg, CMD53_BYTE_BLK_CNT), - GFIELD(arg, CMD53_OP_CODE) ? "Incrementing addr" : "Single addr")); - - cmd_arg = arg; - xfer_reg = 0; - - cmd_reg = SFIELD(cmd_reg, CMD_RESP_TYPE, RESP_TYPE_48); - cmd_reg = SFIELD(cmd_reg, CMD_CRC_EN, 1); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX_EN, 1); - cmd_reg = SFIELD(cmd_reg, CMD_DATA_EN, 1); - cmd_reg = SFIELD(cmd_reg, CMD_TYPE, CMD_TYPE_NORMAL); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX, cmd); - - use_dma = USE_DMA(sdioh_info) && GFIELD(cmd_arg, CMD53_BLK_MODE); - - if (GFIELD(cmd_arg, CMD53_BLK_MODE)) { - uint16 blocksize; - uint16 blockcount; - int func; - - ASSERT(sdioh_info->sd_blockmode); - - func = GFIELD(cmd_arg, CMD53_FUNCTION); - blocksize = MIN((int)sdioh_info->data_xfer_count, - sdioh_info->client_block_size[func]); - blockcount = GFIELD(cmd_arg, CMD53_BYTE_BLK_CNT); - - /* data_xfer_cnt is already setup so that for multiblock mode, - * it is the entire buffer length. For non-block or single block, - * it is < 64 bytes - */ - if (use_dma) { - switch (sdioh_info->sd_dma_mode) { - case DMA_MODE_SDMA: - sd_dma(("%s: SDMA: SysAddr reg was 0x%x now 0x%x\n", - __FUNCTION__, sdstd_rreg(sdioh_info, SD_SysAddr), - (uint32)sdioh_info->dma_phys)); - sdstd_wreg(sdioh_info, SD_SysAddr, sdioh_info->dma_phys); - break; - case DMA_MODE_ADMA1: - case DMA_MODE_ADMA2: - sd_dma(("%s: ADMA: Using ADMA\n", __FUNCTION__)); - sd_create_adma_descriptor(sdioh_info, 0, - sdioh_info->dma_phys, blockcount*blocksize, - ADMA2_ATTRIBUTE_VALID | ADMA2_ATTRIBUTE_END | - ADMA2_ATTRIBUTE_INT | ADMA2_ATTRIBUTE_ACT_TRAN); - /* Dump descriptor if DMA debugging is enabled. */ - if (sd_msglevel & SDH_DMA_VAL) { - sd_dump_adma_dscr(sdioh_info); - } - - sdstd_wreg(sdioh_info, SD_ADMA_SysAddr, - sdioh_info->adma2_dscr_phys); - break; - default: - sd_err(("%s: unsupported DMA mode %d.\n", - __FUNCTION__, sdioh_info->sd_dma_mode)); - break; - } - } - - sd_trace(("%s: Setting block count %d, block size %d bytes\n", - __FUNCTION__, blockcount, blocksize)); - sdstd_wreg16(sdioh_info, SD_BlockSize, blocksize); - sdstd_wreg16(sdioh_info, SD_BlockCount, blockcount); - - xfer_reg = SFIELD(xfer_reg, XFER_DMA_ENABLE, use_dma); - - if (sdioh_info->client_block_size[func] != blocksize) - set_client_block_size(sdioh_info, 1, blocksize); - - if (blockcount > 1) { - xfer_reg = SFIELD(xfer_reg, XFER_MULTI_BLOCK, 1); - xfer_reg = SFIELD(xfer_reg, XFER_BLK_COUNT_EN, 1); - xfer_reg = SFIELD(xfer_reg, XFER_CMD_12_EN, 0); - } else { - xfer_reg = SFIELD(xfer_reg, XFER_MULTI_BLOCK, 0); - xfer_reg = SFIELD(xfer_reg, XFER_BLK_COUNT_EN, 0); - xfer_reg = SFIELD(xfer_reg, XFER_CMD_12_EN, 0); - } - - if (GFIELD(cmd_arg, CMD53_RW_FLAG) == SDIOH_XFER_TYPE_READ) - xfer_reg = SFIELD(xfer_reg, XFER_DATA_DIRECTION, 1); - else - xfer_reg = SFIELD(xfer_reg, XFER_DATA_DIRECTION, 0); - - retries = RETRIES_SMALL; - while (GFIELD(sdstd_rreg(sdioh_info, SD_PresentState), - PRES_DAT_INHIBIT) && --retries) - sd_err(("%s: Waiting for Data Inhibit cmd = %d\n", - __FUNCTION__, cmd)); - if (!retries) { - sd_err(("%s: Data Inhibit timeout\n", __FUNCTION__)); - if (trap_errs) - ASSERT(0); - return ERROR; - } - sdstd_wreg16(sdioh_info, SD_TransferMode, xfer_reg); - - } else { /* Non block mode */ - uint16 bytes = GFIELD(cmd_arg, CMD53_BYTE_BLK_CNT); - /* The byte/block count field only has 9 bits, - * so, to do a 512-byte bytemode transfer, this - * field will contain 0, but we need to tell the - * controller we're transferring 512 bytes. - */ - if (bytes == 0) bytes = 512; - - if (use_dma) - sdstd_wreg(sdioh_info, SD_SysAddr, sdioh_info->dma_phys); - - /* PCI: Transfer Mode register 0x0c */ - xfer_reg = SFIELD(xfer_reg, XFER_DMA_ENABLE, bytes <= 4 ? 0 : use_dma); - xfer_reg = SFIELD(xfer_reg, XFER_CMD_12_EN, 0); - if (GFIELD(cmd_arg, CMD53_RW_FLAG) == SDIOH_XFER_TYPE_READ) - xfer_reg = SFIELD(xfer_reg, XFER_DATA_DIRECTION, 1); - else - xfer_reg = SFIELD(xfer_reg, XFER_DATA_DIRECTION, 0); - /* See table 2-8 Host Controller spec ver 1.00 */ - xfer_reg = SFIELD(xfer_reg, XFER_BLK_COUNT_EN, 0); /* Dont care */ - xfer_reg = SFIELD(xfer_reg, XFER_MULTI_BLOCK, 0); - - sdstd_wreg16(sdioh_info, SD_BlockSize, bytes); - - sdstd_wreg16(sdioh_info, SD_BlockCount, 1); - - retries = RETRIES_SMALL; - while (GFIELD(sdstd_rreg(sdioh_info, SD_PresentState), - PRES_DAT_INHIBIT) && --retries) - sd_err(("%s: Waiting for Data Inhibit cmd = %d\n", - __FUNCTION__, cmd)); - if (!retries) { - sd_err(("%s: Data Inhibit timeout\n", __FUNCTION__)); - if (trap_errs) - ASSERT(0); - return ERROR; - } - sdstd_wreg16(sdioh_info, SD_TransferMode, xfer_reg); - } - break; - - default: - sd_err(("%s: Unknown command\n", __FUNCTION__)); - return ERROR; - } - - if (sdioh_info->sd_mode == SDIOH_MODE_SPI) { - cmd_reg = SFIELD(cmd_reg, CMD_CRC_EN, 0); - cmd_reg = SFIELD(cmd_reg, CMD_INDEX_EN, 0); - } - - /* Setup and issue the SDIO command */ - sdstd_wreg(sdioh_info, SD_Arg0, arg); - sdstd_wreg16(sdioh_info, SD_Command, cmd_reg); - - /* If we are in polled mode, wait for the command to complete. - * In interrupt mode, return immediately. The calling function will - * know that the command has completed when the CMDATDONE interrupt - * is asserted - */ - if (sdioh_info->polled_mode) { - uint16 int_reg = 0; - int retries = RETRIES_LARGE; - - do { - int_reg = sdstd_rreg16(sdioh_info, SD_IntrStatus); - } while (--retries && - (GFIELD(int_reg, INTSTAT_ERROR_INT) == 0) && - (GFIELD(int_reg, INTSTAT_CMD_COMPLETE) == 0)); - - if (!retries) { - sd_err(("%s: CMD_COMPLETE timeout: intrStatus: 0x%x " - "error stat 0x%x state 0x%x\n", - __FUNCTION__, int_reg, - sdstd_rreg16(sdioh_info, SD_ErrorIntrStatus), - sdstd_rreg(sdioh_info, SD_PresentState))); - - /* Attempt to reset CMD line when we get a CMD timeout */ - sdstd_wreg8(sdioh_info, SD_SoftwareReset, SFIELD(0, SW_RESET_CMD, 1)); - retries = RETRIES_LARGE; - do { - sd_trace(("%s: waiting for CMD line reset\n", __FUNCTION__)); - } while ((GFIELD(sdstd_rreg8(sdioh_info, SD_SoftwareReset), - SW_RESET_CMD)) && retries--); - - if (!retries) { - sd_err(("%s: Timeout waiting for CMD line reset\n", __FUNCTION__)); - } - - if (trap_errs) - ASSERT(0); - return (ERROR); - } - - /* Clear Command Complete interrupt */ - int_reg = SFIELD(0, INTSTAT_CMD_COMPLETE, 1); - sdstd_wreg16(sdioh_info, SD_IntrStatus, int_reg); - - /* Check for Errors */ - if (sdstd_check_errs(sdioh_info, cmd, arg)) { - if (trap_errs) - ASSERT(0); - return ERROR; - } - } - return SUCCESS; -} - - -static int -sdstd_card_buf(sdioh_info_t *sd, int rw, int func, bool fifo, uint32 addr, int nbytes, uint32 *data) -{ - int status; - uint32 cmd_arg; - uint32 rsp5; - uint16 int_reg, int_bit; - uint flags; - int num_blocks, blocksize; - bool local_blockmode, local_dma; - bool read = rw == SDIOH_READ ? 1 : 0; - bool yield = FALSE; - - ASSERT(nbytes); - - cmd_arg = 0; - - sd_data(("%s: %s 53 addr 0x%x, len %d bytes, r_cnt %d t_cnt %d\n", - __FUNCTION__, read ? "Rd" : "Wr", addr, nbytes, sd->r_cnt, sd->t_cnt)); - - if (read) sd->r_cnt++; else sd->t_cnt++; - - local_blockmode = sd->sd_blockmode; - local_dma = USE_DMA(sd); - - /* Don't bother with block mode on small xfers */ - if (nbytes < sd->client_block_size[func]) { - sd_data(("setting local blockmode to false: nbytes (%d) != block_size (%d)\n", - nbytes, sd->client_block_size[func])); - local_blockmode = FALSE; - local_dma = FALSE; - } - - if (local_blockmode) { - blocksize = MIN(sd->client_block_size[func], nbytes); - num_blocks = nbytes/blocksize; - cmd_arg = SFIELD(cmd_arg, CMD53_BYTE_BLK_CNT, num_blocks); - cmd_arg = SFIELD(cmd_arg, CMD53_BLK_MODE, 1); - } else { - num_blocks = 1; - blocksize = nbytes; - cmd_arg = SFIELD(cmd_arg, CMD53_BYTE_BLK_CNT, nbytes); - cmd_arg = SFIELD(cmd_arg, CMD53_BLK_MODE, 0); - } - - if (local_dma && !read) { - bcopy(data, sd->dma_buf, nbytes); - sd_sync_dma(sd, read, nbytes); - } - - if (fifo) - cmd_arg = SFIELD(cmd_arg, CMD53_OP_CODE, 0); - else - cmd_arg = SFIELD(cmd_arg, CMD53_OP_CODE, 1); - - cmd_arg = SFIELD(cmd_arg, CMD53_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, CMD53_REG_ADDR, addr); - if (read) - cmd_arg = SFIELD(cmd_arg, CMD53_RW_FLAG, SDIOH_XFER_TYPE_READ); - else - cmd_arg = SFIELD(cmd_arg, CMD53_RW_FLAG, SDIOH_XFER_TYPE_WRITE); - - sd->data_xfer_count = nbytes; - - /* sdstd_cmd_issue() returns with the command complete bit - * in the ISR already cleared - */ - if ((status = sdstd_cmd_issue(sd, local_dma, SDIOH_CMD_53, cmd_arg)) != SUCCESS) { - sd_err(("%s: cmd_issue failed for %s\n", __FUNCTION__, (read ? "read" : "write"))); - return status; - } - - sdstd_cmd_getrsp(sd, &rsp5, 1); - - if ((flags = GFIELD(rsp5, RSP5_FLAGS)) != 0x10) { - sd_err(("%s: Rsp5: nbytes %d, dma %d blockmode %d, read %d " - "numblocks %d, blocksize %d\n", - __FUNCTION__, nbytes, local_dma, local_dma, read, num_blocks, blocksize)); - - if (flags & 1) - sd_err(("%s: rsp5: Command not accepted: arg out of range 0x%x, " - "bytes %d dma %d\n", - __FUNCTION__, flags, GFIELD(cmd_arg, CMD53_BYTE_BLK_CNT), - GFIELD(cmd_arg, CMD53_BLK_MODE))); - if (flags & 0x8) - sd_err(("%s: Rsp5: General Error\n", __FUNCTION__)); - - sd_err(("%s: rsp5 flags = 0x%x, expecting 0x10 returning error\n", - __FUNCTION__, flags)); - if (trap_errs) - ASSERT(0); - return ERROR; - } - - if (GFIELD(rsp5, RSP5_STUFF)) - sd_err(("%s: rsp5 stuff is 0x%x: expecting 0\n", - __FUNCTION__, GFIELD(rsp5, RSP5_STUFF))); - -#ifdef BCMSDYIELD - yield = sd_yieldcpu && ((uint)nbytes >= sd_minyield); -#endif - - if (!local_dma) { - int bytes, i; - uint32 tmp; - for (i = 0; i < num_blocks; i++) { - int words; - - /* Decide which status bit we're waiting for */ - if (read) - int_bit = SFIELD(0, INTSTAT_BUF_READ_READY, 1); - else - int_bit = SFIELD(0, INTSTAT_BUF_WRITE_READY, 1); - - /* If not on, wait for it (or for xfer error) */ - int_reg = sdstd_rreg16(sd, SD_IntrStatus); - if (!(int_reg & int_bit)) - int_reg = sdstd_waitbits(sd, int_bit, ERRINT_TRANSFER_ERRS, yield); - - /* Confirm we got the bit w/o error */ - if (!(int_reg & int_bit) || GFIELD(int_reg, INTSTAT_ERROR_INT)) { - sd_err(("%s: Error or timeout for Buf_%s_Ready: intStat: 0x%x " - "errint: 0x%x PresentState 0x%x\n", - __FUNCTION__, read ? "Read" : "Write", int_reg, - sdstd_rreg16(sd, SD_ErrorIntrStatus), - sdstd_rreg(sd, SD_PresentState))); - sdstd_dumpregs(sd); - sdstd_check_errs(sd, SDIOH_CMD_53, cmd_arg); - return (ERROR); - } - - /* Clear Buf Ready bit */ - sdstd_wreg16(sd, SD_IntrStatus, int_bit); - - /* At this point we have Buffer Ready, write the data 4 bytes at a time */ - for (words = blocksize/4; words; words--) { - if (read) - *data = sdstd_rreg(sd, SD_BufferDataPort0); - else - sdstd_wreg(sd, SD_BufferDataPort0, *data); - data++; - } - - bytes = blocksize % 4; - - /* If no leftover bytes, go to next block */ - if (!bytes) - continue; - - switch (bytes) { - case 1: - /* R/W 8 bits */ - if (read) - *(data++) = (uint32)(sdstd_rreg8(sd, SD_BufferDataPort0)); - else - sdstd_wreg8(sd, SD_BufferDataPort0, - (uint8)(*(data++) & 0xff)); - break; - case 2: - /* R/W 16 bits */ - if (read) - *(data++) = (uint32)sdstd_rreg16(sd, SD_BufferDataPort0); - else - sdstd_wreg16(sd, SD_BufferDataPort0, (uint16)(*(data++))); - break; - case 3: - /* R/W 24 bits: - * SD_BufferDataPort0[0-15] | SD_BufferDataPort1[16-23] - */ - if (read) { - tmp = (uint32)sdstd_rreg16(sd, SD_BufferDataPort0); - tmp |= ((uint32)(sdstd_rreg8(sd, - SD_BufferDataPort1)) << 16); - *(data++) = tmp; - } else { - tmp = *(data++); - sdstd_wreg16(sd, SD_BufferDataPort0, (uint16)tmp & 0xffff); - sdstd_wreg8(sd, SD_BufferDataPort1, - (uint8)((tmp >> 16) & 0xff)); - } - break; - default: - sd_err(("%s: Unexpected bytes leftover %d\n", - __FUNCTION__, bytes)); - ASSERT(0); - break; - } - } - } /* End PIO processing */ - - /* Wait for Transfer Complete or Transfer Error */ - int_bit = SFIELD(0, INTSTAT_XFER_COMPLETE, 1); - - /* If not on, wait for it (or for xfer error) */ - int_reg = sdstd_rreg16(sd, SD_IntrStatus); - if (!(int_reg & int_bit)) - int_reg = sdstd_waitbits(sd, int_bit, ERRINT_TRANSFER_ERRS, yield); - - /* Check for any errors from the data phase */ - if (sdstd_check_errs(sd, SDIOH_CMD_53, cmd_arg)) - return ERROR; - - /* May have gotten a software timeout if not blocking? */ - int_reg = sdstd_rreg16(sd, SD_IntrStatus); - if (!(int_reg & int_bit)) { - sd_err(("%s: Error or Timeout for xfer complete; %s, dma %d, State 0x%08x, " - "intr 0x%04x, Err 0x%04x, len = %d, rcnt %d, tcnt %d\n", - __FUNCTION__, read ? "R" : "W", local_dma, - sdstd_rreg(sd, SD_PresentState), int_reg, - sdstd_rreg16(sd, SD_ErrorIntrStatus), nbytes, - sd->r_cnt, sd->t_cnt)); - sdstd_dumpregs(sd); - return ERROR; - } - - /* Clear the status bits */ - int_reg = int_bit; - if (local_dma) { - /* DMA Complete */ - /* Reads in particular don't have DMA_COMPLETE set */ - int_reg = SFIELD(int_reg, INTSTAT_DMA_INT, 1); - } - sdstd_wreg16(sd, SD_IntrStatus, int_reg); - - /* Fetch data */ - if (local_dma && read) { - sd_sync_dma(sd, read, nbytes); - bcopy(sd->dma_buf, data, nbytes); - } - return SUCCESS; -} - -static int -set_client_block_size(sdioh_info_t *sd, int func, int block_size) -{ - int base; - int err = 0; - - - sd_err(("%s: Setting block size %d, func %d\n", __FUNCTION__, block_size, func)); - sd->client_block_size[func] = block_size; - - /* Set the block size in the SDIO Card register */ - base = func * SDIOD_FBR_SIZE; - err = sdstd_card_regwrite(sd, 0, base+SDIOD_CCCR_BLKSIZE_0, 1, block_size & 0xff); - if (!err) { - err = sdstd_card_regwrite(sd, 0, base+SDIOD_CCCR_BLKSIZE_1, 1, - (block_size >> 8) & 0xff); - } - - /* Do not set the block size in the SDIO Host register, that - * is func dependent and will get done on an individual - * transaction basis - */ - - return (err ? BCME_SDIO_ERROR : 0); -} - -/* Reset and re-initialize the device */ -int -sdioh_sdio_reset(sdioh_info_t *si) -{ - uint8 hreg; - - /* Reset the attached device (use slower clock for safety) */ - sdstd_start_clock(si, 128); - sdstd_reset(si, 0, 1); - - /* Reset portions of the host state accordingly */ - hreg = sdstd_rreg8(si, SD_HostCntrl); - hreg = SFIELD(hreg, HOST_HI_SPEED_EN, 0); - hreg = SFIELD(hreg, HOST_DATA_WIDTH, 0); - si->sd_mode = SDIOH_MODE_SD1; - - /* Reinitialize the card */ - si->card_init_done = FALSE; - return sdstd_client_init(si); -} - - -static void -sd_map_dma(sdioh_info_t * sd) -{ - - void *va; - - if ((va = DMA_ALLOC_CONSISTENT(sd->osh, SD_PAGE, - &sd->dma_start_phys, 0x12, 12)) == NULL) { - sd->sd_dma_mode = DMA_MODE_NONE; - sd->dma_start_buf = 0; - sd->dma_buf = (void *)0; - sd->dma_phys = 0; - sd->alloced_dma_size = SD_PAGE; - sd_err(("%s: DMA_ALLOC failed. Disabling DMA support.\n", __FUNCTION__)); - } else { - sd->dma_start_buf = va; - sd->dma_buf = (void *)ROUNDUP((uintptr)va, SD_PAGE); - sd->dma_phys = ROUNDUP((sd->dma_start_phys), SD_PAGE); - sd->alloced_dma_size = SD_PAGE; - sd_err(("%s: Mapped DMA Buffer %dbytes @virt/phys: %p/0x%lx\n", - __FUNCTION__, sd->alloced_dma_size, sd->dma_buf, sd->dma_phys)); - sd_fill_dma_data_buf(sd, 0xA5); - } - - if ((va = DMA_ALLOC_CONSISTENT(sd->osh, SD_PAGE, - &sd->adma2_dscr_start_phys, 0x12, 12)) == NULL) { - sd->sd_dma_mode = DMA_MODE_NONE; - sd->adma2_dscr_start_buf = 0; - sd->adma2_dscr_buf = (void *)0; - sd->adma2_dscr_phys = 0; - sd->alloced_adma2_dscr_size = 0; - sd_err(("%s: DMA_ALLOC failed for descriptor buffer. " - "Disabling DMA support.\n", __FUNCTION__)); - } else { - sd->adma2_dscr_start_buf = va; - sd->adma2_dscr_buf = (void *)ROUNDUP((uintptr)va, SD_PAGE); - sd->adma2_dscr_phys = ROUNDUP((sd->adma2_dscr_start_phys), SD_PAGE); - sd->alloced_adma2_dscr_size = SD_PAGE; - } - - sd_err(("%s: Mapped ADMA2 Descriptor Buffer %dbytes @virt/phys: %p/0x%lx\n", - __FUNCTION__, sd->alloced_adma2_dscr_size, sd->adma2_dscr_buf, - sd->adma2_dscr_phys)); - sd_clear_adma_dscr_buf(sd); -} - -static void -sd_unmap_dma(sdioh_info_t * sd) -{ - if (sd->dma_start_buf) { - DMA_FREE_CONSISTENT(sd->osh, sd->dma_start_buf, sd->alloced_dma_size, - sd->dma_start_phys, 0x12); - } - - if (sd->adma2_dscr_start_buf) { - DMA_FREE_CONSISTENT(sd->osh, sd->adma2_dscr_start_buf, sd->alloced_adma2_dscr_size, - sd->adma2_dscr_start_phys, 0x12); - } -} - -static void sd_clear_adma_dscr_buf(sdioh_info_t *sd) -{ - bzero((char *)sd->adma2_dscr_buf, SD_PAGE); - sd_dump_adma_dscr(sd); -} - -static void sd_fill_dma_data_buf(sdioh_info_t *sd, uint8 data) -{ - memset((char *)sd->dma_buf, data, SD_PAGE); -} - - -static void sd_create_adma_descriptor(sdioh_info_t *sd, uint32 index, - uint32 addr_phys, uint16 length, uint16 flags) -{ - adma2_dscr_32b_t *adma2_dscr_table; - adma1_dscr_t *adma1_dscr_table; - - adma2_dscr_table = sd->adma2_dscr_buf; - adma1_dscr_table = sd->adma2_dscr_buf; - - switch (sd->sd_dma_mode) { - case DMA_MODE_ADMA2: - sd_dma(("%s: creating ADMA2 descriptor for index %d\n", - __FUNCTION__, index)); - - adma2_dscr_table[index].phys_addr = addr_phys; - adma2_dscr_table[index].len_attr = length << 16; - adma2_dscr_table[index].len_attr |= flags; - break; - case DMA_MODE_ADMA1: - /* ADMA1 requires two descriptors, one for len - * and the other for data transfer - */ - index <<= 1; - - sd_dma(("%s: creating ADMA1 descriptor for index %d\n", - __FUNCTION__, index)); - - adma1_dscr_table[index].phys_addr_attr = length << 12; - adma1_dscr_table[index].phys_addr_attr |= (ADMA1_ATTRIBUTE_ACT_SET | - ADMA2_ATTRIBUTE_VALID); - adma1_dscr_table[index+1].phys_addr_attr = addr_phys & 0xFFFFF000; - adma1_dscr_table[index+1].phys_addr_attr |= (flags & 0x3f); - break; - default: - sd_err(("%s: cannot create ADMA descriptor for DMA mode %d\n", - __FUNCTION__, sd->sd_dma_mode)); - break; - } -} - - -static void sd_dump_adma_dscr(sdioh_info_t *sd) -{ - adma2_dscr_32b_t *adma2_dscr_table; - adma1_dscr_t *adma1_dscr_table; - uint32 i = 0; - uint16 flags; - char flags_str[32]; - - ASSERT(sd->adma2_dscr_buf != NULL); - - adma2_dscr_table = sd->adma2_dscr_buf; - adma1_dscr_table = sd->adma2_dscr_buf; - - switch (sd->sd_dma_mode) { - case DMA_MODE_ADMA2: - sd_err(("ADMA2 Descriptor Table (%dbytes) @virt/phys: %p/0x%lx\n", - SD_PAGE, sd->adma2_dscr_buf, sd->adma2_dscr_phys)); - sd_err((" #[Descr VA ] Buffer PA | Len | Flags (5:4 2 1 0)" - " |\n")); - while (adma2_dscr_table->len_attr & ADMA2_ATTRIBUTE_VALID) { - flags = adma2_dscr_table->len_attr & 0xFFFF; - sprintf(flags_str, "%s%s%s%s", - ((flags & ADMA2_ATTRIBUTE_ACT_LINK) == - ADMA2_ATTRIBUTE_ACT_LINK) ? "LINK " : - ((flags & ADMA2_ATTRIBUTE_ACT_LINK) == - ADMA2_ATTRIBUTE_ACT_TRAN) ? "TRAN " : - ((flags & ADMA2_ATTRIBUTE_ACT_LINK) == - ADMA2_ATTRIBUTE_ACT_NOP) ? "NOP " : "RSV ", - (flags & ADMA2_ATTRIBUTE_INT ? "INT " : " "), - (flags & ADMA2_ATTRIBUTE_END ? "END " : " "), - (flags & ADMA2_ATTRIBUTE_VALID ? "VALID" : "")); - sd_err(("%2d[0x%p]: 0x%08x | 0x%04x | 0x%04x (%s) |\n", - i, adma2_dscr_table, adma2_dscr_table->phys_addr, - adma2_dscr_table->len_attr >> 16, flags, flags_str)); - i++; - - /* Follow LINK descriptors or skip to next. */ - if ((flags & ADMA2_ATTRIBUTE_ACT_LINK) == - ADMA2_ATTRIBUTE_ACT_LINK) { - adma2_dscr_table = phys_to_virt( - adma2_dscr_table->phys_addr); - } else { - adma2_dscr_table++; - } - - } - break; - case DMA_MODE_ADMA1: - sd_err(("ADMA1 Descriptor Table (%dbytes) @virt/phys: %p/0x%lx\n", - SD_PAGE, sd->adma2_dscr_buf, sd->adma2_dscr_phys)); - sd_err((" #[Descr VA ] Buffer PA | Flags (5:4 2 1 0) |\n")); - - for (i = 0; adma1_dscr_table->phys_addr_attr & ADMA2_ATTRIBUTE_VALID; i++) { - flags = adma1_dscr_table->phys_addr_attr & 0x3F; - sprintf(flags_str, "%s%s%s%s", - ((flags & ADMA2_ATTRIBUTE_ACT_LINK) == - ADMA2_ATTRIBUTE_ACT_LINK) ? "LINK " : - ((flags & ADMA2_ATTRIBUTE_ACT_LINK) == - ADMA2_ATTRIBUTE_ACT_TRAN) ? "TRAN " : - ((flags & ADMA2_ATTRIBUTE_ACT_LINK) == - ADMA2_ATTRIBUTE_ACT_NOP) ? "NOP " : "SET ", - (flags & ADMA2_ATTRIBUTE_INT ? "INT " : " "), - (flags & ADMA2_ATTRIBUTE_END ? "END " : " "), - (flags & ADMA2_ATTRIBUTE_VALID ? "VALID" : "")); - sd_err(("%2d[0x%p]: 0x%08x | 0x%04x | (%s) |\n", - i, adma1_dscr_table, - adma1_dscr_table->phys_addr_attr & 0xFFFFF000, - flags, flags_str)); - - /* Follow LINK descriptors or skip to next. */ - if ((flags & ADMA2_ATTRIBUTE_ACT_LINK) == - ADMA2_ATTRIBUTE_ACT_LINK) { - adma1_dscr_table = phys_to_virt( - adma1_dscr_table->phys_addr_attr & 0xFFFFF000); - } else { - adma1_dscr_table++; - } - } - break; - default: - sd_err(("Unknown DMA Descriptor Table Format.\n")); - break; - } -} - -static void sdstd_dumpregs(sdioh_info_t *sd) -{ - sd_err(("IntrStatus: 0x%04x ErrorIntrStatus 0x%04x\n", - sdstd_rreg16(sd, SD_IntrStatus), - sdstd_rreg16(sd, SD_ErrorIntrStatus))); - sd_err(("IntrStatusEnable: 0x%04x ErrorIntrStatusEnable 0x%04x\n", - sdstd_rreg16(sd, SD_IntrStatusEnable), - sdstd_rreg16(sd, SD_ErrorIntrStatusEnable))); - sd_err(("IntrSignalEnable: 0x%04x ErrorIntrSignalEnable 0x%04x\n", - sdstd_rreg16(sd, SD_IntrSignalEnable), - sdstd_rreg16(sd, SD_ErrorIntrSignalEnable))); -} diff --git a/drivers/net/wireless/bcm4319/bcmsdstd_linux.c b/drivers/net/wireless/bcm4319/bcmsdstd_linux.c deleted file mode 100644 index a8b98e2054a0..000000000000 --- a/drivers/net/wireless/bcm4319/bcmsdstd_linux.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * 'Standard' SDIO HOST CONTROLLER driver - linux portion - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmsdstd_linux.c,v 1.11.18.2.16.1 2010/08/17 17:03:13 Exp $ - */ - -#include -#include -#include -#include /* SDIO Specs */ -#include /* bcmsdh to/from specific controller APIs */ -#include /* to get msglevel bit values */ - -#include /* request_irq() */ - -#include - -struct sdos_info { - sdioh_info_t *sd; - spinlock_t lock; - wait_queue_head_t intr_wait_queue; -}; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) -#define BLOCKABLE() (!in_atomic()) -#else -#define BLOCKABLE() (!in_interrupt()) -#endif - -/* Interrupt handler */ -static irqreturn_t -sdstd_isr(int irq, void *dev_id -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) -, struct pt_regs *ptregs -#endif -) -{ - sdioh_info_t *sd; - struct sdos_info *sdos; - bool ours; - - sd = (sdioh_info_t *)dev_id; - - if (!sd->card_init_done) { - sd_err(("%s: Hey Bogus intr...not even initted: irq %d\n", __FUNCTION__, irq)); - return IRQ_RETVAL(FALSE); - } else { - ours = check_client_intr(sd); - - /* For local interrupts, wake the waiting process */ - if (ours && sd->got_hcint) { - sd_trace(("INTR->WAKE\n")); - sdos = (struct sdos_info *)sd->sdos_info; - wake_up_interruptible(&sdos->intr_wait_queue); - } - return IRQ_RETVAL(ours); - } -} - -/* Register with Linux for interrupts */ -int -sdstd_register_irq(sdioh_info_t *sd, uint irq) -{ - sd_trace(("Entering %s: irq == %d\n", __FUNCTION__, irq)); - if (request_irq(irq, sdstd_isr, IRQF_SHARED, "bcmsdstd", sd) < 0) { - sd_err(("%s: request_irq() failed\n", __FUNCTION__)); - return ERROR; - } - return SUCCESS; -} - -/* Free Linux irq */ -void -sdstd_free_irq(uint irq, sdioh_info_t *sd) -{ - free_irq(irq, sd); -} - -/* Map Host controller registers */ - -uint32 * -sdstd_reg_map(osl_t *osh, int32 addr, int size) -{ - return (uint32 *)REG_MAP(addr, size); -} - -void -sdstd_reg_unmap(osl_t *osh, int32 addr, int size) -{ - REG_UNMAP((void*)(uintptr)addr); -} - -int -sdstd_osinit(sdioh_info_t *sd) -{ - struct sdos_info *sdos; - - sdos = (struct sdos_info*)MALLOC(sd->osh, sizeof(struct sdos_info)); - sd->sdos_info = (void*)sdos; - if (sdos == NULL) - return BCME_NOMEM; - - sdos->sd = sd; - spin_lock_init(&sdos->lock); - init_waitqueue_head(&sdos->intr_wait_queue); - return BCME_OK; -} - -void -sdstd_osfree(sdioh_info_t *sd) -{ - struct sdos_info *sdos; - ASSERT(sd && sd->sdos_info); - - sdos = (struct sdos_info *)sd->sdos_info; - MFREE(sd->osh, sdos, sizeof(struct sdos_info)); -} - -/* Interrupt enable/disable */ -SDIOH_API_RC -sdioh_interrupt_set(sdioh_info_t *sd, bool enable) -{ - ulong flags; - struct sdos_info *sdos; - - sd_trace(("%s: %s\n", __FUNCTION__, enable ? "Enabling" : "Disabling")); - - sdos = (struct sdos_info *)sd->sdos_info; - ASSERT(sdos); - - if (!(sd->host_init_done && sd->card_init_done)) { - sd_err(("%s: Card & Host are not initted - bailing\n", __FUNCTION__)); - return SDIOH_API_RC_FAIL; - } - - if (enable && !(sd->intr_handler && sd->intr_handler_arg)) { - sd_err(("%s: no handler registered, will not enable\n", __FUNCTION__)); - return SDIOH_API_RC_FAIL; - } - - /* Ensure atomicity for enable/disable calls */ - spin_lock_irqsave(&sdos->lock, flags); - - sd->client_intr_enabled = enable; - if (enable && !sd->lockcount) - sdstd_devintr_on(sd); - else - sdstd_devintr_off(sd); - - spin_unlock_irqrestore(&sdos->lock, flags); - - return SDIOH_API_RC_SUCCESS; -} - -/* Protect against reentrancy (disable device interrupts while executing) */ -void -sdstd_lock(sdioh_info_t *sd) -{ - ulong flags; - struct sdos_info *sdos; - - sdos = (struct sdos_info *)sd->sdos_info; - ASSERT(sdos); - - sd_trace(("%s: %d\n", __FUNCTION__, sd->lockcount)); - - spin_lock_irqsave(&sdos->lock, flags); - if (sd->lockcount) { - sd_err(("%s: Already locked! called from %p\n", - __FUNCTION__, - __builtin_return_address(0))); - ASSERT(sd->lockcount == 0); - } - sdstd_devintr_off(sd); - sd->lockcount++; - spin_unlock_irqrestore(&sdos->lock, flags); -} - -/* Enable client interrupt */ -void -sdstd_unlock(sdioh_info_t *sd) -{ - ulong flags; - struct sdos_info *sdos; - - sd_trace(("%s: %d, %d\n", __FUNCTION__, sd->lockcount, sd->client_intr_enabled)); - ASSERT(sd->lockcount > 0); - - sdos = (struct sdos_info *)sd->sdos_info; - ASSERT(sdos); - - spin_lock_irqsave(&sdos->lock, flags); - if (--sd->lockcount == 0 && sd->client_intr_enabled) { - sdstd_devintr_on(sd); - } - spin_unlock_irqrestore(&sdos->lock, flags); -} - -uint16 -sdstd_waitbits(sdioh_info_t *sd, uint16 norm, uint16 err, bool yield) -{ - struct sdos_info *sdos; - - sdos = (struct sdos_info *)sd->sdos_info; - -#ifndef BCMSDYIELD - ASSERT(!yield); -#endif - sd_trace(("%s: int 0x%02x err 0x%02x yield %d canblock %d\n", - __FUNCTION__, norm, err, yield, BLOCKABLE())); - - /* Clear the "interrupt happened" flag and last intrstatus */ - sd->got_hcint = FALSE; - sd->last_intrstatus = 0; - -#ifdef BCMSDYIELD - if (yield && BLOCKABLE()) { - /* Enable interrupts, wait for the indication, then disable */ - sdstd_intrs_on(sd, norm, err); - wait_event_interruptible(sdos->intr_wait_queue, (sd->got_hcint)); - sdstd_intrs_off(sd, norm, err); - } else -#endif /* BCMSDYIELD */ - { - sdstd_spinbits(sd, norm, err); - } - - sd_trace(("%s: last_intrstatus 0x%04x\n", __FUNCTION__, sd->last_intrstatus)); - - return sd->last_intrstatus; -} diff --git a/drivers/net/wireless/bcm4319/bcmspibrcm.c b/drivers/net/wireless/bcm4319/bcmspibrcm.c deleted file mode 100644 index 0f131a40f4b8..000000000000 --- a/drivers/net/wireless/bcm4319/bcmspibrcm.c +++ /dev/null @@ -1,1726 +0,0 @@ -/* - * Broadcom BCMSDH to gSPI Protocol Conversion Layer - * - * Copyright (C) 2010, Broadcom Corporation - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; - * the contents of this file may not be disclosed to third parties, copied - * or duplicated in any form, in whole or in part, without the prior - * written permission of Broadcom Corporation. - * - * $Id: bcmspibrcm.c,v 1.11.2.10.2.9.6.11 2009/05/21 13:21:57 Exp $ - */ - -#define HSMODE - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include /* bcmsdh to/from specific controller APIs */ -#include /* ioctl/iovars */ -#include - -#include - - -#include -#include - -#define F0_RESPONSE_DELAY 16 -#define F1_RESPONSE_DELAY 16 -#define F2_RESPONSE_DELAY F0_RESPONSE_DELAY - -#define CMDLEN 4 - -#define DWORDMODE_ON (sd->chip == BCM4329_CHIP_ID) && (sd->chiprev == 2) && (sd->dwordmode == TRUE) - -/* Globals */ -uint sd_msglevel = 0; - -uint sd_hiok = FALSE; /* Use hi-speed mode if available? */ -uint sd_sdmode = SDIOH_MODE_SPI; /* Use SD4 mode by default */ -uint sd_f2_blocksize = 64; /* Default blocksize */ - - -uint sd_divisor = 2; -uint sd_power = 1; /* Default to SD Slot powered ON */ -uint sd_clock = 1; /* Default to SD Clock turned ON */ -uint sd_crc = 0; /* Default to SPI CRC Check turned OFF */ - -uint8 spi_outbuf[SPI_MAX_PKT_LEN]; -uint8 spi_inbuf[SPI_MAX_PKT_LEN]; - -/* 128bytes buffer is enough to clear data-not-available and program response-delay F0 bits - * assuming we will not exceed F0 response delay > 100 bytes at 48MHz. - */ -#define BUF2_PKT_LEN 128 -uint8 spi_outbuf2[BUF2_PKT_LEN]; -uint8 spi_inbuf2[BUF2_PKT_LEN]; - -/* Prototypes */ -static bool bcmspi_test_card(sdioh_info_t *sd); -static bool bcmspi_host_device_init_adapt(sdioh_info_t *sd); -static int bcmspi_set_highspeed_mode(sdioh_info_t *sd, bool hsmode); -static int bcmspi_cmd_issue(sdioh_info_t *sd, bool use_dma, uint32 cmd_arg, - uint32 *data, uint32 datalen); -static int bcmspi_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, - int regsize, uint32 *data); -static int bcmspi_card_regwrite(sdioh_info_t *sd, int func, uint32 regaddr, - int regsize, uint32 data); -static int bcmspi_card_bytewrite(sdioh_info_t *sd, int func, uint32 regaddr, - uint8 *data); -static int bcmspi_driver_init(sdioh_info_t *sd); -static int bcmspi_card_buf(sdioh_info_t *sd, int rw, int func, bool fifo, - uint32 addr, int nbytes, uint32 *data); -static int bcmspi_card_regread_fixedaddr(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, - uint32 *data); -static void bcmspi_cmd_getdstatus(sdioh_info_t *sd, uint32 *dstatus_buffer); -static int bcmspi_update_stats(sdioh_info_t *sd, uint32 cmd_arg); - -/* - * Public entry points & extern's - */ -extern sdioh_info_t * -sdioh_attach(osl_t *osh, void *bar0, uint irq) -{ - sdioh_info_t *sd; - - sd_trace(("%s\n", __FUNCTION__)); - if ((sd = (sdioh_info_t *)MALLOC(osh, sizeof(sdioh_info_t))) == NULL) { - sd_err(("%s: out of memory, malloced %d bytes\n", __FUNCTION__, MALLOCED(osh))); - return NULL; - } - bzero((char *)sd, sizeof(sdioh_info_t)); - sd->osh = osh; - if (spi_osinit(sd) != 0) { - sd_err(("%s: spi_osinit() failed\n", __FUNCTION__)); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return NULL; - } - - sd->bar0 = bar0; - sd->irq = irq; - sd->intr_handler = NULL; - sd->intr_handler_arg = NULL; - sd->intr_handler_valid = FALSE; - - /* Set defaults */ - sd->use_client_ints = TRUE; - sd->sd_use_dma = FALSE; /* DMA Not supported */ - - /* Spi device default is 16bit mode, change to 4 when device is changed to 32bit - * mode - */ - sd->wordlen = 2; - - if (!spi_hw_attach(sd)) { - sd_err(("%s: spi_hw_attach() failed\n", __FUNCTION__)); - spi_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return (NULL); - } - - if (bcmspi_driver_init(sd) != SUCCESS) { - sd_err(("%s: bcmspi_driver_init() failed()\n", __FUNCTION__)); - spi_hw_detach(sd); - spi_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return (NULL); - } - - if (spi_register_irq(sd, irq) != SUCCESS) { - sd_err(("%s: spi_register_irq() failed for irq = %d\n", __FUNCTION__, irq)); - spi_hw_detach(sd); - spi_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return (NULL); - } - - sd_trace(("%s: Done\n", __FUNCTION__)); - - return sd; -} - -extern SDIOH_API_RC -sdioh_detach(osl_t *osh, sdioh_info_t *sd) -{ - sd_trace(("%s\n", __FUNCTION__)); - if (sd) { - sd_err(("%s: detaching from hardware\n", __FUNCTION__)); - spi_free_irq(sd->irq, sd); - spi_hw_detach(sd); - spi_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - } - return SDIOH_API_RC_SUCCESS; -} - -/* Configure callback to client when we recieve client interrupt */ -extern SDIOH_API_RC -sdioh_interrupt_register(sdioh_info_t *sd, sdioh_cb_fn_t fn, void *argh) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - sd->intr_handler = fn; - sd->intr_handler_arg = argh; - sd->intr_handler_valid = TRUE; - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_interrupt_deregister(sdioh_info_t *sd) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - sd->intr_handler_valid = FALSE; - sd->intr_handler = NULL; - sd->intr_handler_arg = NULL; - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_interrupt_query(sdioh_info_t *sd, bool *onoff) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - *onoff = sd->client_intr_enabled; - return SDIOH_API_RC_SUCCESS; -} - -#if defined(DHD_DEBUG) -extern bool -sdioh_interrupt_pending(sdioh_info_t *sd) -{ - return 0; -} -#endif - -extern SDIOH_API_RC -sdioh_query_device(sdioh_info_t *sd) -{ - /* Return a BRCM ID appropriate to the dongle class */ - return (sd->num_funcs > 1) ? BCM4329_D11NDUAL_ID : BCM4318_D11G_ID; -} - -/* Provide dstatus bits of spi-transaction for dhd layers. */ -extern uint32 -sdioh_get_dstatus(sdioh_info_t *sd) -{ - return sd->card_dstatus; -} - -extern void -sdioh_chipinfo(sdioh_info_t *sd, uint32 chip, uint32 chiprev) -{ - sd->chip = chip; - sd->chiprev = chiprev; -} - -extern void -sdioh_dwordmode(sdioh_info_t *sd, bool set) -{ - uint8 reg = 0; - int status; - - if ((status = sdioh_request_byte(sd, SDIOH_READ, SPI_FUNC_0, SPID_STATUS_ENABLE, ®)) != - SUCCESS) { - sd_err(("%s: Failed to set dwordmode in gSPI\n", __FUNCTION__)); - return; - } - - if (set) { - reg |= DWORD_PKT_LEN_EN; - sd->dwordmode = TRUE; - sd->client_block_size[SPI_FUNC_2] = 4096; /* h2spi's limit is 4KB, we support 8KB */ - } else { - reg &= ~DWORD_PKT_LEN_EN; - sd->dwordmode = FALSE; - sd->client_block_size[SPI_FUNC_2] = 2048; - } - - if ((status = sdioh_request_byte(sd, SDIOH_WRITE, SPI_FUNC_0, SPID_STATUS_ENABLE, ®)) != - SUCCESS) { - sd_err(("%s: Failed to set dwordmode in gSPI\n", __FUNCTION__)); - return; - } -} - - -uint -sdioh_query_iofnum(sdioh_info_t *sd) -{ - return sd->num_funcs; -} - -/* IOVar table */ -enum { - IOV_MSGLEVEL = 1, - IOV_BLOCKMODE, - IOV_BLOCKSIZE, - IOV_DMA, - IOV_USEINTS, - IOV_NUMINTS, - IOV_NUMLOCALINTS, - IOV_HOSTREG, - IOV_DEVREG, - IOV_DIVISOR, - IOV_SDMODE, - IOV_HISPEED, - IOV_HCIREGS, - IOV_POWER, - IOV_CLOCK, - IOV_SPIERRSTATS, - IOV_RESP_DELAY_ALL -}; - -const bcm_iovar_t sdioh_iovars[] = { - {"sd_msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0 }, - {"sd_blocksize", IOV_BLOCKSIZE, 0, IOVT_UINT32, 0 }, /* ((fn << 16) | size) */ - {"sd_dma", IOV_DMA, 0, IOVT_BOOL, 0 }, - {"sd_ints", IOV_USEINTS, 0, IOVT_BOOL, 0 }, - {"sd_numints", IOV_NUMINTS, 0, IOVT_UINT32, 0 }, - {"sd_numlocalints", IOV_NUMLOCALINTS, 0, IOVT_UINT32, 0 }, - {"sd_hostreg", IOV_HOSTREG, 0, IOVT_BUFFER, sizeof(sdreg_t) }, - {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(sdreg_t) }, - {"sd_divisor", IOV_DIVISOR, 0, IOVT_UINT32, 0 }, - {"sd_power", IOV_POWER, 0, IOVT_UINT32, 0 }, - {"sd_clock", IOV_CLOCK, 0, IOVT_UINT32, 0 }, - {"sd_mode", IOV_SDMODE, 0, IOVT_UINT32, 100}, - {"sd_highspeed", IOV_HISPEED, 0, IOVT_UINT32, 0}, - {"spi_errstats", IOV_SPIERRSTATS, 0, IOVT_BUFFER, sizeof(struct spierrstats_t) }, - {"spi_respdelay", IOV_RESP_DELAY_ALL, 0, IOVT_BOOL, 0 }, - {NULL, 0, 0, 0, 0 } -}; - -int -sdioh_iovar_op(sdioh_info_t *si, const char *name, - void *params, int plen, void *arg, int len, bool set) -{ - const bcm_iovar_t *vi = NULL; - int bcmerror = 0; - int val_size; - int32 int_val = 0; - bool bool_val; - uint32 actionid; -/* - sdioh_regs_t *regs; -*/ - - ASSERT(name); - ASSERT(len >= 0); - - /* Get must have return space; Set does not take qualifiers */ - ASSERT(set || (arg && len)); - ASSERT(!set || (!params && !plen)); - - sd_trace(("%s: Enter (%s %s)\n", __FUNCTION__, (set ? "set" : "get"), name)); - - if ((vi = bcm_iovar_lookup(sdioh_iovars, name)) == NULL) { - bcmerror = BCME_UNSUPPORTED; - goto exit; - } - - if ((bcmerror = bcm_iovar_lencheck(vi, arg, len, set)) != 0) - goto exit; - - /* Set up params so get and set can share the convenience variables */ - if (params == NULL) { - params = arg; - plen = len; - } - - if (vi->type == IOVT_VOID) - val_size = 0; - else if (vi->type == IOVT_BUFFER) - val_size = len; - else - val_size = sizeof(int); - - if (plen >= (int)sizeof(int_val)) - bcopy(params, &int_val, sizeof(int_val)); - - bool_val = (int_val != 0) ? TRUE : FALSE; - - actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid); - switch (actionid) { - case IOV_GVAL(IOV_MSGLEVEL): - int_val = (int32)sd_msglevel; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_MSGLEVEL): - sd_msglevel = int_val; - break; - - case IOV_GVAL(IOV_BLOCKSIZE): - if ((uint32)int_val > si->num_funcs) { - bcmerror = BCME_BADARG; - break; - } - int_val = (int32)si->client_block_size[int_val]; - bcopy(&int_val, arg, val_size); - break; - - case IOV_GVAL(IOV_DMA): - int_val = (int32)si->sd_use_dma; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_DMA): - si->sd_use_dma = (bool)int_val; - break; - - case IOV_GVAL(IOV_USEINTS): - int_val = (int32)si->use_client_ints; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_USEINTS): - break; - - case IOV_GVAL(IOV_DIVISOR): - int_val = (uint32)sd_divisor; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_DIVISOR): - sd_divisor = int_val; - if (!spi_start_clock(si, (uint16)sd_divisor)) { - sd_err(("%s: set clock failed\n", __FUNCTION__)); - bcmerror = BCME_ERROR; - } - break; - - case IOV_GVAL(IOV_POWER): - int_val = (uint32)sd_power; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_POWER): - sd_power = int_val; - break; - - case IOV_GVAL(IOV_CLOCK): - int_val = (uint32)sd_clock; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_CLOCK): - sd_clock = int_val; - break; - - case IOV_GVAL(IOV_SDMODE): - int_val = (uint32)sd_sdmode; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_SDMODE): - sd_sdmode = int_val; - break; - - case IOV_GVAL(IOV_HISPEED): - int_val = (uint32)sd_hiok; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_HISPEED): - sd_hiok = int_val; - - if (!bcmspi_set_highspeed_mode(si, (bool)sd_hiok)) { - sd_err(("%s: Failed changing highspeed mode to %d.\n", - __FUNCTION__, sd_hiok)); - bcmerror = BCME_ERROR; - return ERROR; - } - break; - - case IOV_GVAL(IOV_NUMINTS): - int_val = (int32)si->intrcount; - bcopy(&int_val, arg, val_size); - break; - - case IOV_GVAL(IOV_NUMLOCALINTS): - int_val = (int32)si->local_intrcount; - bcopy(&int_val, arg, val_size); - break; - case IOV_GVAL(IOV_DEVREG): - { - sdreg_t *sd_ptr = (sdreg_t *)params; - uint8 data; - - if (sdioh_cfg_read(si, sd_ptr->func, sd_ptr->offset, &data)) { - bcmerror = BCME_SDIO_ERROR; - break; - } - - int_val = (int)data; - bcopy(&int_val, arg, sizeof(int_val)); - break; - } - - case IOV_SVAL(IOV_DEVREG): - { - sdreg_t *sd_ptr = (sdreg_t *)params; - uint8 data = (uint8)sd_ptr->value; - - if (sdioh_cfg_write(si, sd_ptr->func, sd_ptr->offset, &data)) { - bcmerror = BCME_SDIO_ERROR; - break; - } - break; - } - - - case IOV_GVAL(IOV_SPIERRSTATS): - { - bcopy(&si->spierrstats, arg, sizeof(struct spierrstats_t)); - break; - } - - case IOV_SVAL(IOV_SPIERRSTATS): - { - bzero(&si->spierrstats, sizeof(struct spierrstats_t)); - break; - } - - case IOV_GVAL(IOV_RESP_DELAY_ALL): - int_val = (int32)si->resp_delay_all; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_RESP_DELAY_ALL): - si->resp_delay_all = (bool)int_val; - int_val = STATUS_ENABLE|INTR_WITH_STATUS; - if (si->resp_delay_all) - int_val |= RESP_DELAY_ALL; - else { - if (bcmspi_card_regwrite(si, SPI_FUNC_0, SPID_RESPONSE_DELAY, 1, - F1_RESPONSE_DELAY) != SUCCESS) { - sd_err(("%s: Unable to set response delay.\n", __FUNCTION__)); - bcmerror = BCME_SDIO_ERROR; - break; - } - } - - if (bcmspi_card_regwrite(si, SPI_FUNC_0, SPID_STATUS_ENABLE, 1, int_val) - != SUCCESS) { - sd_err(("%s: Unable to set response delay.\n", __FUNCTION__)); - bcmerror = BCME_SDIO_ERROR; - break; - } - break; - - default: - bcmerror = BCME_UNSUPPORTED; - break; - } -exit: - - return bcmerror; -} - -extern SDIOH_API_RC -sdioh_cfg_read(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data) -{ - SDIOH_API_RC status; - /* No lock needed since sdioh_request_byte does locking */ - status = sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data); - return status; -} - -extern SDIOH_API_RC -sdioh_cfg_write(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data) -{ - /* No lock needed since sdioh_request_byte does locking */ - SDIOH_API_RC status; - - if ((fnc_num == SPI_FUNC_1) && (addr == SBSDIO_FUNC1_FRAMECTRL)) { - uint8 dummy_data; - status = sdioh_cfg_read(sd, fnc_num, addr, &dummy_data); - if (status) { - sd_err(("sdioh_cfg_read() failed.\n")); - return status; - } - } - - status = sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data); - return status; -} - -extern SDIOH_API_RC -sdioh_cis_read(sdioh_info_t *sd, uint func, uint8 *cisd, uint32 length) -{ - uint32 count; - int offset; - uint32 cis_byte; - uint16 *cis = (uint16 *)cisd; - uint bar0 = SI_ENUM_BASE; - int status; - uint8 data; - - sd_trace(("%s: Func %d\n", __FUNCTION__, func)); - - spi_lock(sd); - - /* Set sb window address to 0x18000000 */ - data = (bar0 >> 8) & SBSDIO_SBADDRLOW_MASK; - status = bcmspi_card_bytewrite(sd, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW, &data); - if (status == SUCCESS) { - data = (bar0 >> 16) & SBSDIO_SBADDRMID_MASK; - status = bcmspi_card_bytewrite(sd, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRMID, &data); - } else { - sd_err(("%s: Unable to set sb-addr-windows\n", __FUNCTION__)); - spi_unlock(sd); - return (BCME_ERROR); - } - if (status == SUCCESS) { - data = (bar0 >> 24) & SBSDIO_SBADDRHIGH_MASK; - status = bcmspi_card_bytewrite(sd, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRHIGH, &data); - } else { - sd_err(("%s: Unable to set sb-addr-windows\n", __FUNCTION__)); - spi_unlock(sd); - return (BCME_ERROR); - } - - offset = CC_OTP; /* OTP offset in chipcommon. */ - for (count = 0; count < length/2; count++) { - if (bcmspi_card_regread (sd, SDIO_FUNC_1, offset, 2, &cis_byte) < 0) { - sd_err(("%s: regread failed: Can't read CIS\n", __FUNCTION__)); - spi_unlock(sd); - return (BCME_ERROR); - } - - *cis = (uint16)cis_byte; - cis++; - offset += 2; - } - - spi_unlock(sd); - - return (BCME_OK); -} - -extern SDIOH_API_RC -sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *byte) -{ - int status; - uint32 cmd_arg; - uint32 dstatus; - uint32 data = (uint32)(*byte); - - spi_lock(sd); - - cmd_arg = 0; - cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */ - cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, rw == SDIOH_READ ? 0 : 1); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, 1); - - sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg)); - sd_trace(("%s: rw=%d, func=%d, regaddr=0x%08x, data=0x%x\n", __FUNCTION__, rw, func, - regaddr, data)); - - if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, - cmd_arg, &data, 1)) != SUCCESS) { - spi_unlock(sd); - return status; - } - - if (rw == SDIOH_READ) - *byte = (uint8)data; - - bcmspi_cmd_getdstatus(sd, &dstatus); - if (dstatus) - sd_trace(("dstatus =0x%x\n", dstatus)); - - spi_unlock(sd); - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, uint addr, - uint32 *word, uint nbytes) -{ - int status; - - spi_lock(sd); - - if (rw == SDIOH_READ) - status = bcmspi_card_regread(sd, func, addr, nbytes, word); - else - status = bcmspi_card_regwrite(sd, func, addr, nbytes, *word); - - spi_unlock(sd); - return (status == SUCCESS ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL); -} - -extern SDIOH_API_RC -sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint rw, uint func, - uint addr, uint reg_width, uint buflen_u, uint8 *buffer, void *pkt) -{ - int len; - int buflen = (int)buflen_u; - bool fifo = (fix_inc == SDIOH_DATA_FIX); - - spi_lock(sd); - - ASSERT(reg_width == 4); - ASSERT(buflen_u < (1 << 30)); - ASSERT(sd->client_block_size[func]); - - sd_data(("%s: %c len %d r_cnt %d t_cnt %d, pkt @0x%p\n", - __FUNCTION__, rw == SDIOH_READ ? 'R' : 'W', - buflen_u, sd->r_cnt, sd->t_cnt, pkt)); - - /* Break buffer down into blocksize chunks. */ - while (buflen > 0) { - len = MIN(sd->client_block_size[func], buflen); - if (bcmspi_card_buf(sd, rw, func, fifo, addr, len, (uint32 *)buffer) != SUCCESS) { - sd_err(("%s: bcmspi_card_buf %s failed\n", - __FUNCTION__, rw == SDIOH_READ ? "Read" : "Write")); - spi_unlock(sd); - return SDIOH_API_RC_FAIL; - } - buffer += len; - buflen -= len; - if (!fifo) - addr += len; - } - spi_unlock(sd); - return SDIOH_API_RC_SUCCESS; -} - -/* This function allows write to gspi bus when another rd/wr function is deep down the call stack. - * Its main aim is to have simpler spi writes rather than recursive writes. - * e.g. When there is a need to program response delay on the fly after detecting the SPI-func - * this call will allow to program the response delay. - */ -static int -bcmspi_card_byterewrite(sdioh_info_t *sd, int func, uint32 regaddr, uint8 byte) -{ - uint32 cmd_arg; - uint32 datalen = 1; - uint32 hostlen; - - cmd_arg = 0; - - cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 1); - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */ - cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, datalen); - - sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg)); - - - /* Set up and issue the SPI command. MSByte goes out on bus first. Increase datalen - * according to the wordlen mode(16/32bit) the device is in. - */ - ASSERT(sd->wordlen == 4 || sd->wordlen == 2); - datalen = ROUNDUP(datalen, sd->wordlen); - - /* Start by copying command in the spi-outbuffer */ - if (sd->wordlen == 4) { /* 32bit spid */ - *(uint32 *)spi_outbuf2 = bcmswap32(cmd_arg); - if (datalen & 0x3) - datalen += (4 - (datalen & 0x3)); - } else if (sd->wordlen == 2) { /* 16bit spid */ - *(uint16 *)spi_outbuf2 = bcmswap16(cmd_arg & 0xffff); - *(uint16 *)&spi_outbuf2[2] = bcmswap16((cmd_arg & 0xffff0000) >> 16); - if (datalen & 0x1) - datalen++; - } else { - sd_err(("%s: Host is %d bit spid, could not create SPI command.\n", - __FUNCTION__, 8 * sd->wordlen)); - return ERROR; - } - - /* for Write, put the data into the output buffer */ - if (datalen != 0) { - if (sd->wordlen == 4) { /* 32bit spid */ - *(uint32 *)&spi_outbuf2[CMDLEN] = bcmswap32(byte); - } else if (sd->wordlen == 2) { /* 16bit spid */ - *(uint16 *)&spi_outbuf2[CMDLEN] = bcmswap16(byte & 0xffff); - *(uint16 *)&spi_outbuf2[CMDLEN + 2] = - bcmswap16((byte & 0xffff0000) >> 16); - } - } - - /* +4 for cmd, +4 for dstatus */ - hostlen = datalen + 8; - hostlen += (4 - (hostlen & 0x3)); - spi_sendrecv(sd, spi_outbuf2, spi_inbuf2, hostlen); - - /* Last 4bytes are dstatus. Device is configured to return status bits. */ - if (sd->wordlen == 4) { /* 32bit spid */ - sd->card_dstatus = bcmswap32(*(uint32 *)&spi_inbuf2[datalen + CMDLEN ]); - } else if (sd->wordlen == 2) { /* 16bit spid */ - sd->card_dstatus = (bcmswap16(*(uint16 *)&spi_inbuf2[datalen + CMDLEN ]) | - (bcmswap16(*(uint16 *)&spi_inbuf2[datalen + CMDLEN + 2]) << 16)); - } else { - sd_err(("%s: Host is %d bit machine, could not read SPI dstatus.\n", - __FUNCTION__, 8 * sd->wordlen)); - return ERROR; - } - - if (sd->card_dstatus) - sd_trace(("dstatus after byte rewrite = 0x%x\n", sd->card_dstatus)); - - return (BCME_OK); -} - -/* Program the response delay corresponding to the spi function */ -static int -bcmspi_prog_resp_delay(sdioh_info_t *sd, int func, uint8 resp_delay) -{ - if (sd->resp_delay_all == FALSE) - return (BCME_OK); - - if (sd->prev_fun == func) - return (BCME_OK); - - if (F0_RESPONSE_DELAY == F1_RESPONSE_DELAY) - return (BCME_OK); - - bcmspi_card_byterewrite(sd, SPI_FUNC_0, SPID_RESPONSE_DELAY, resp_delay); - - /* Remember function for which to avoid reprogramming resp-delay in next iteration */ - sd->prev_fun = func; - - return (BCME_OK); - -} - -#define GSPI_RESYNC_PATTERN 0x0 - -/* A resync pattern is a 32bit MOSI line with all zeros. Its a special command in gSPI. - * It resets the spi-bkplane logic so that all F1 related ping-pong buffer logic is - * synchronised and all queued resuests are cancelled. - */ -static int -bcmspi_resync_f1(sdioh_info_t *sd) -{ - uint32 cmd_arg = GSPI_RESYNC_PATTERN, data = 0, datalen = 0; - - - /* Set up and issue the SPI command. MSByte goes out on bus first. Increase datalen - * according to the wordlen mode(16/32bit) the device is in. - */ - ASSERT(sd->wordlen == 4 || sd->wordlen == 2); - datalen = ROUNDUP(datalen, sd->wordlen); - - /* Start by copying command in the spi-outbuffer */ - *(uint32 *)spi_outbuf2 = cmd_arg; - - /* for Write, put the data into the output buffer */ - *(uint32 *)&spi_outbuf2[CMDLEN] = data; - - /* +4 for cmd, +4 for dstatus */ - spi_sendrecv(sd, spi_outbuf2, spi_inbuf2, datalen + 8); - - /* Last 4bytes are dstatus. Device is configured to return status bits. */ - if (sd->wordlen == 4) { /* 32bit spid */ - sd->card_dstatus = bcmswap32(*(uint32 *)&spi_inbuf2[datalen + CMDLEN ]); - } else if (sd->wordlen == 2) { /* 16bit spid */ - sd->card_dstatus = (bcmswap16(*(uint16 *)&spi_inbuf2[datalen + CMDLEN ]) | - (bcmswap16(*(uint16 *)&spi_inbuf2[datalen + CMDLEN + 2]) << 16)); - } else { - sd_err(("%s: Host is %d bit machine, could not read SPI dstatus.\n", - __FUNCTION__, 8 * sd->wordlen)); - return ERROR; - } - - if (sd->card_dstatus) - sd_trace(("dstatus after resync pattern write = 0x%x\n", sd->card_dstatus)); - - return (BCME_OK); -} - -uint32 dstatus_count = 0; - -static int -bcmspi_update_stats(sdioh_info_t *sd, uint32 cmd_arg) -{ - uint32 dstatus = sd->card_dstatus; - struct spierrstats_t *spierrstats = &sd->spierrstats; - int err = SUCCESS; - - sd_trace(("cmd = 0x%x, dstatus = 0x%x\n", cmd_arg, dstatus)); - - /* Store dstatus of last few gSPI transactions */ - spierrstats->dstatus[dstatus_count % NUM_PREV_TRANSACTIONS] = dstatus; - spierrstats->spicmd[dstatus_count % NUM_PREV_TRANSACTIONS] = cmd_arg; - dstatus_count++; - - if (sd->card_init_done == FALSE) - return err; - - if (dstatus & STATUS_DATA_NOT_AVAILABLE) { - spierrstats->dna++; - sd_trace(("Read data not available on F1 addr = 0x%x\n", - GFIELD(cmd_arg, SPI_REG_ADDR))); - /* Clear dna bit */ - bcmspi_card_byterewrite(sd, SPI_FUNC_0, SPID_INTR_REG, DATA_UNAVAILABLE); - } - - if (dstatus & STATUS_UNDERFLOW) { - spierrstats->rdunderflow++; - sd_err(("FIFO underflow happened due to current F2 read command.\n")); - } - - if (dstatus & STATUS_OVERFLOW) { - spierrstats->wroverflow++; - sd_err(("FIFO overflow happened due to current (F1/F2) write command.\n")); - if ((sd->chip == BCM4329_CHIP_ID) && (sd->chiprev == 0)) { - bcmspi_card_byterewrite(sd, SPI_FUNC_0, SPID_INTR_REG, F1_OVERFLOW); - bcmspi_resync_f1(sd); - sd_err(("Recovering from F1 FIFO overflow.\n")); - } else { - err = ERROR_OF; - } - } - - if (dstatus & STATUS_F2_INTR) { - spierrstats->f2interrupt++; - sd_trace(("Interrupt from F2. SW should clear corresponding IntStatus bits\n")); - } - - if (dstatus & STATUS_F3_INTR) { - spierrstats->f3interrupt++; - sd_err(("Interrupt from F3. SW should clear corresponding IntStatus bits\n")); - } - - if (dstatus & STATUS_HOST_CMD_DATA_ERR) { - spierrstats->hostcmddataerr++; - sd_err(("Error in CMD or Host data, detected by CRC/Checksum (optional)\n")); - } - - if (dstatus & STATUS_F2_PKT_AVAILABLE) { - spierrstats->f2pktavailable++; - sd_trace(("Packet is available/ready in F2 TX FIFO\n")); - sd_trace(("Packet length = %d\n", sd->dwordmode ? - ((dstatus & STATUS_F2_PKT_LEN_MASK) >> (STATUS_F2_PKT_LEN_SHIFT - 2)) : - ((dstatus & STATUS_F2_PKT_LEN_MASK) >> STATUS_F2_PKT_LEN_SHIFT))); - } - - if (dstatus & STATUS_F3_PKT_AVAILABLE) { - spierrstats->f3pktavailable++; - sd_err(("Packet is available/ready in F3 TX FIFO\n")); - sd_err(("Packet length = %d\n", - (dstatus & STATUS_F3_PKT_LEN_MASK) >> STATUS_F3_PKT_LEN_SHIFT)); - } - - return err; -} - -extern int -sdioh_abort(sdioh_info_t *sd, uint func) -{ - return 0; -} - -int -sdioh_start(sdioh_info_t *sd, int stage) -{ - return SUCCESS; -} - -int -sdioh_stop(sdioh_info_t *sd) -{ - return SUCCESS; -} - - - -/* - * Private/Static work routines - */ -static int -bcmspi_host_init(sdioh_info_t *sd) -{ - - /* Default power on mode */ - sd->sd_mode = SDIOH_MODE_SPI; - sd->polled_mode = TRUE; - sd->host_init_done = TRUE; - sd->card_init_done = FALSE; - sd->adapter_slot = 1; - - return (SUCCESS); -} - -static int -get_client_blocksize(sdioh_info_t *sd) -{ - uint32 regdata[2]; - int status; - - /* Find F1/F2/F3 max packet size */ - if ((status = bcmspi_card_regread(sd, 0, SPID_F1_INFO_REG, - 8, regdata)) != SUCCESS) { - return status; - } - - sd_trace(("pkt_size regdata[0] = 0x%x, regdata[1] = 0x%x\n", - regdata[0], regdata[1])); - - sd->client_block_size[1] = (regdata[0] & F1_MAX_PKT_SIZE) >> 2; - sd_trace(("Func1 blocksize = %d\n", sd->client_block_size[1])); - ASSERT(sd->client_block_size[1] == BLOCK_SIZE_F1); - - sd->client_block_size[2] = ((regdata[0] >> 16) & F2_MAX_PKT_SIZE) >> 2; - sd_trace(("Func2 blocksize = %d\n", sd->client_block_size[2])); - ASSERT(sd->client_block_size[2] == BLOCK_SIZE_F2); - - sd->client_block_size[3] = (regdata[1] & F3_MAX_PKT_SIZE) >> 2; - sd_trace(("Func3 blocksize = %d\n", sd->client_block_size[3])); - ASSERT(sd->client_block_size[3] == BLOCK_SIZE_F3); - - return 0; -} - -static int -bcmspi_client_init(sdioh_info_t *sd) -{ - uint32 status_en_reg = 0; - sd_trace(("%s: Powering up slot %d\n", __FUNCTION__, sd->adapter_slot)); - -#ifdef HSMODE - if (!spi_start_clock(sd, (uint16)sd_divisor)) { - sd_err(("spi_start_clock failed\n")); - return ERROR; - } -#else - /* Start at ~400KHz clock rate for initialization */ - if (!spi_start_clock(sd, 128)) { - sd_err(("spi_start_clock failed\n")); - return ERROR; - } -#endif /* HSMODE */ - - if (!bcmspi_host_device_init_adapt(sd)) { - sd_err(("bcmspi_host_device_init_adapt failed\n")); - return ERROR; - } - - if (!bcmspi_test_card(sd)) { - sd_err(("bcmspi_test_card failed\n")); - return ERROR; - } - - sd->num_funcs = SPI_MAX_IOFUNCS; - - get_client_blocksize(sd); - - /* Apply resync pattern cmd with all zeros to reset spi-bkplane F1 logic */ - bcmspi_resync_f1(sd); - - sd->dwordmode = FALSE; - - bcmspi_card_regread(sd, 0, SPID_STATUS_ENABLE, 1, &status_en_reg); - - sd_trace(("%s: Enabling interrupt with dstatus \n", __FUNCTION__)); - status_en_reg |= INTR_WITH_STATUS; - - - if (bcmspi_card_regwrite(sd, SPI_FUNC_0, SPID_STATUS_ENABLE, 1, - status_en_reg & 0xff) != SUCCESS) { - sd_err(("%s: Unable to set response delay for all fun's.\n", __FUNCTION__)); - return ERROR; - } - - -#ifndef HSMODE - /* After configuring for High-Speed mode, set the desired clock rate. */ - if (!spi_start_clock(sd, 4)) { - sd_err(("spi_start_clock failed\n")); - return ERROR; - } -#endif /* HSMODE */ - - sd->card_init_done = TRUE; - - - return SUCCESS; -} - -static int -bcmspi_set_highspeed_mode(sdioh_info_t *sd, bool hsmode) -{ - uint32 regdata; - int status; - - if ((status = bcmspi_card_regread(sd, 0, SPID_CONFIG, - 4, ®data)) != SUCCESS) - return status; - - sd_trace(("In %s spih-ctrl = 0x%x \n", __FUNCTION__, regdata)); - - - if (hsmode == TRUE) { - sd_trace(("Attempting to enable High-Speed mode.\n")); - - if (regdata & HIGH_SPEED_MODE) { - sd_trace(("Device is already in High-Speed mode.\n")); - return status; - } else { - regdata |= HIGH_SPEED_MODE; - sd_trace(("Writing %08x to device at %08x\n", regdata, SPID_CONFIG)); - if ((status = bcmspi_card_regwrite(sd, 0, SPID_CONFIG, - 4, regdata)) != SUCCESS) { - return status; - } - } - } else { - sd_trace(("Attempting to disable High-Speed mode.\n")); - - if (regdata & HIGH_SPEED_MODE) { - regdata &= ~HIGH_SPEED_MODE; - sd_trace(("Writing %08x to device at %08x\n", regdata, SPID_CONFIG)); - if ((status = bcmspi_card_regwrite(sd, 0, SPID_CONFIG, - 4, regdata)) != SUCCESS) - return status; - } - else { - sd_trace(("Device is already in Low-Speed mode.\n")); - return status; - } - } - - spi_controller_highspeed_mode(sd, hsmode); - - return TRUE; -} - -#define bcmspi_find_curr_mode(sd) { \ - sd->wordlen = 2; \ - status = bcmspi_card_regread_fixedaddr(sd, 0, SPID_TEST_READ, 4, ®data); \ - regdata &= 0xff; \ - if ((regdata == 0xad) || (regdata == 0x5b) || \ - (regdata == 0x5d) || (regdata == 0x5a)) \ - break; \ - sd->wordlen = 4; \ - status = bcmspi_card_regread_fixedaddr(sd, 0, SPID_TEST_READ, 4, ®data); \ - regdata &= 0xff; \ - if ((regdata == 0xad) || (regdata == 0x5b) || \ - (regdata == 0x5d) || (regdata == 0x5a)) \ - break; \ - sd_trace(("Silicon testability issue: regdata = 0x%x." \ - " Expected 0xad, 0x5a, 0x5b or 0x5d.\n", regdata)); \ - OSL_DELAY(100000); \ -} - -#define INIT_ADAPT_LOOP 100 - -/* Adapt clock-phase-speed-bitwidth between host and device */ -static bool -bcmspi_host_device_init_adapt(sdioh_info_t *sd) -{ - uint32 wrregdata, regdata = 0; - int status; - int i; - - /* Due to a silicon testability issue, the first command from the Host - * to the device will get corrupted (first bit will be lost). So the - * Host should poll the device with a safe read request. ie: The Host - * should try to read F0 addr 0x14 using the Fixed address mode - * (This will prevent a unintended write command to be detected by device) - */ - for (i = 0; i < INIT_ADAPT_LOOP; i++) { - /* If device was not power-cycled it will stay in 32bit mode with - * response-delay-all bit set. Alternate the iteration so that - * read either with or without response-delay for F0 to succeed. - */ - bcmspi_find_curr_mode(sd); - sd->resp_delay_all = (i & 0x1) ? TRUE : FALSE; - - bcmspi_find_curr_mode(sd); - sd->dwordmode = TRUE; - - bcmspi_find_curr_mode(sd); - sd->dwordmode = FALSE; - } - - /* Bail out, device not detected */ - if (i == INIT_ADAPT_LOOP) - return FALSE; - - /* Softreset the spid logic */ - if ((sd->dwordmode) || (sd->wordlen == 4)) { - bcmspi_card_regwrite(sd, 0, SPID_RESET_BP, 1, RESET_ON_WLAN_BP_RESET|RESET_SPI); - bcmspi_card_regread(sd, 0, SPID_RESET_BP, 1, ®data); - sd_trace(("reset reg read = 0x%x\n", regdata)); - sd_trace(("dwordmode = %d, wordlen = %d, resp_delay_all = %d\n", sd->dwordmode, - sd->wordlen, sd->resp_delay_all)); - /* Restore default state after softreset */ - sd->wordlen = 2; - sd->dwordmode = FALSE; - } - - if (sd->wordlen == 4) { - if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4, ®data)) != - SUCCESS) - return FALSE; - if (regdata == TEST_RO_DATA_32BIT_LE) { - sd_trace(("Spid is already in 32bit LE mode. Value read = 0x%x\n", - regdata)); - sd_trace(("Spid power was left on.\n")); - } else { - sd_err(("Spid power was left on but signature read failed." - " Value read = 0x%x\n", regdata)); - return FALSE; - } - } else { - sd->wordlen = 2; - -#define CTRL_REG_DEFAULT 0x00010430 /* according to the host m/c */ - - wrregdata = (CTRL_REG_DEFAULT); - sd->resp_delay_all = TRUE; - if (sd->resp_delay_all == TRUE) { - /* Enable response delay for all */ - wrregdata |= (RESP_DELAY_ALL << 16); - /* Program response delay value */ - wrregdata &= 0xffff00ff; - wrregdata |= (F1_RESPONSE_DELAY << 8); - sd->prev_fun = SPI_FUNC_1; - bcmspi_card_regwrite(sd, 0, SPID_CONFIG, 4, wrregdata); - } - - if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4, ®data)) != SUCCESS) - return FALSE; - sd_trace(("(we are still in 16bit mode) 32bit READ LE regdata = 0x%x\n", regdata)); - -#ifndef HSMODE - wrregdata |= (CLOCK_PHASE | CLOCK_POLARITY); - wrregdata &= ~HIGH_SPEED_MODE; - bcmspi_card_regwrite(sd, 0, SPID_CONFIG, 4, wrregdata); -#endif /* HSMODE */ - - for (i = 0; i < INIT_ADAPT_LOOP; i++) { - if ((regdata == 0xfdda7d5b) || (regdata == 0xfdda7d5a)) { - sd_trace(("0xfeedbead was leftshifted by 1-bit.\n")); - if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4, - ®data)) != SUCCESS) - return FALSE; - } - OSL_DELAY(1000); - } - - - /* Change to host controller intr-polarity of active-low */ - wrregdata &= ~INTR_POLARITY; - sd_trace(("(we are still in 16bit mode) 32bit Write LE reg-ctrl-data = 0x%x\n", - wrregdata)); - /* Change to 32bit mode */ - wrregdata |= WORD_LENGTH_32; - bcmspi_card_regwrite(sd, 0, SPID_CONFIG, 4, wrregdata); - - /* Change command/data packaging in 32bit LE mode */ - sd->wordlen = 4; - - if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4, ®data)) != SUCCESS) - return FALSE; - - if (regdata == TEST_RO_DATA_32BIT_LE) { - sd_trace(("Read spid passed. Value read = 0x%x\n", regdata)); - sd_trace(("Spid had power-on cycle OR spi was soft-resetted \n")); - } else { - sd_err(("Stale spid reg values read as it was kept powered. Value read =" - "0x%x\n", regdata)); - return FALSE; - } - } - - - return TRUE; -} - -static bool -bcmspi_test_card(sdioh_info_t *sd) -{ - uint32 regdata; - int status; - - if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4, ®data)) != SUCCESS) - return FALSE; - - if (regdata == (TEST_RO_DATA_32BIT_LE)) - sd_trace(("32bit LE regdata = 0x%x\n", regdata)); - else { - sd_trace(("Incorrect 32bit LE regdata = 0x%x\n", regdata)); - return FALSE; - } - - -#define RW_PATTERN1 0xA0A1A2A3 -#define RW_PATTERN2 0x4B5B6B7B - - regdata = RW_PATTERN1; - if ((status = bcmspi_card_regwrite(sd, 0, SPID_TEST_RW, 4, regdata)) != SUCCESS) - return FALSE; - regdata = 0; - if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_RW, 4, ®data)) != SUCCESS) - return FALSE; - if (regdata != RW_PATTERN1) { - sd_err(("Write-Read spid failed. Value wrote = 0x%x, Value read = 0x%x\n", - RW_PATTERN1, regdata)); - return FALSE; - } else - sd_trace(("R/W spid passed. Value read = 0x%x\n", regdata)); - - regdata = RW_PATTERN2; - if ((status = bcmspi_card_regwrite(sd, 0, SPID_TEST_RW, 4, regdata)) != SUCCESS) - return FALSE; - regdata = 0; - if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_RW, 4, ®data)) != SUCCESS) - return FALSE; - if (regdata != RW_PATTERN2) { - sd_err(("Write-Read spid failed. Value wrote = 0x%x, Value read = 0x%x\n", - RW_PATTERN2, regdata)); - return FALSE; - } else - sd_trace(("R/W spid passed. Value read = 0x%x\n", regdata)); - - return TRUE; -} - -static int -bcmspi_driver_init(sdioh_info_t *sd) -{ - sd_trace(("%s\n", __FUNCTION__)); - if ((bcmspi_host_init(sd)) != SUCCESS) { - return ERROR; - } - - if (bcmspi_client_init(sd) != SUCCESS) { - return ERROR; - } - - return SUCCESS; -} - -/* Read device reg */ -static int -bcmspi_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 *data) -{ - int status; - uint32 cmd_arg, dstatus; - - ASSERT(regsize); - - if (func == 2) - sd_trace(("Reg access on F2 will generate error indication in dstatus bits.\n")); - - cmd_arg = 0; - cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 0); - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */ - cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, regsize == BLOCK_SIZE_F2 ? 0 : regsize); - - sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg)); - sd_trace(("%s: rw=%d, func=%d, regaddr=0x%08x, data=0x%x\n", __FUNCTION__, 0, func, - regaddr, *data)); - - if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, cmd_arg, data, regsize)) - != SUCCESS) - return status; - - bcmspi_cmd_getdstatus(sd, &dstatus); - if (dstatus) - sd_trace(("dstatus =0x%x\n", dstatus)); - - return SUCCESS; -} - -static int -bcmspi_card_regread_fixedaddr(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 *data) -{ - - int status; - uint32 cmd_arg; - uint32 dstatus; - - ASSERT(regsize); - - if (func == 2) - sd_trace(("Reg access on F2 will generate error indication in dstatus bits.\n")); - - cmd_arg = 0; - cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 0); - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 0); /* Fixed access */ - cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, regsize); - - sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg)); - - if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, cmd_arg, data, regsize)) - != SUCCESS) - return status; - - sd_trace(("%s: rw=%d, func=%d, regaddr=0x%08x, data=0x%x\n", __FUNCTION__, 0, func, - regaddr, *data)); - - bcmspi_cmd_getdstatus(sd, &dstatus); - sd_trace(("dstatus =0x%x\n", dstatus)); - return SUCCESS; -} - -/* write a device register */ -static int -bcmspi_card_regwrite(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 data) -{ - int status; - uint32 cmd_arg, dstatus; - - ASSERT(regsize); - - cmd_arg = 0; - - cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 1); - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */ - cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, regsize == BLOCK_SIZE_F2 ? 0 : regsize); - - sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg)); - sd_trace(("%s: rw=%d, func=%d, regaddr=0x%08x, data=0x%x\n", __FUNCTION__, 1, func, - regaddr, data)); - - - if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, cmd_arg, &data, regsize)) - != SUCCESS) - return status; - - bcmspi_cmd_getdstatus(sd, &dstatus); - if (dstatus) - sd_trace(("dstatus =0x%x\n", dstatus)); - - return SUCCESS; -} - -/* write a device register - 1 byte */ -static int -bcmspi_card_bytewrite(sdioh_info_t *sd, int func, uint32 regaddr, uint8 *byte) -{ - int status; - uint32 cmd_arg; - uint32 dstatus; - uint32 data = (uint32)(*byte); - - cmd_arg = 0; - cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */ - cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 1); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, 1); - - sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg)); - sd_trace(("%s: func=%d, regaddr=0x%08x, data=0x%x\n", __FUNCTION__, func, - regaddr, data)); - - if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, - cmd_arg, &data, 1)) != SUCCESS) { - return status; - } - - bcmspi_cmd_getdstatus(sd, &dstatus); - if (dstatus) - sd_trace(("dstatus =0x%x\n", dstatus)); - - return SUCCESS; -} - -void -bcmspi_cmd_getdstatus(sdioh_info_t *sd, uint32 *dstatus_buffer) -{ - *dstatus_buffer = sd->card_dstatus; -} - -/* 'data' is of type uint32 whereas other buffers are of type uint8 */ -static int -bcmspi_cmd_issue(sdioh_info_t *sd, bool use_dma, uint32 cmd_arg, - uint32 *data, uint32 datalen) -{ - uint32 i, j; - uint8 resp_delay = 0; - int err = SUCCESS; - uint32 hostlen; - uint32 spilen = 0; - uint32 dstatus_idx = 0; - uint16 templen, buslen, len, *ptr = NULL; - - sd_trace(("spi cmd = 0x%x\n", cmd_arg)); - - if (DWORDMODE_ON) { - spilen = GFIELD(cmd_arg, SPI_LEN); - if ((GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_0) || - (GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_1)) - dstatus_idx = spilen * 3; - - if ((GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2) && - (GFIELD(cmd_arg, SPI_RW_FLAG) == 1)) { - spilen = spilen << 2; - dstatus_idx = (spilen % 16) ? (16 - (spilen % 16)) : 0; - /* convert len to mod16 size */ - spilen = ROUNDUP(spilen, 16); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, (spilen >> 2)); - } - } - - /* Set up and issue the SPI command. MSByte goes out on bus first. Increase datalen - * according to the wordlen mode(16/32bit) the device is in. - */ - if (sd->wordlen == 4) { /* 32bit spid */ - *(uint32 *)spi_outbuf = bcmswap32(cmd_arg); - if (datalen & 0x3) - datalen += (4 - (datalen & 0x3)); - } else if (sd->wordlen == 2) { /* 16bit spid */ - *(uint16 *)spi_outbuf = bcmswap16(cmd_arg & 0xffff); - *(uint16 *)&spi_outbuf[2] = bcmswap16((cmd_arg & 0xffff0000) >> 16); - if (datalen & 0x1) - datalen++; - if (datalen < 4) - datalen = ROUNDUP(datalen, 4); - } else { - sd_err(("Host is %d bit spid, could not create SPI command.\n", - 8 * sd->wordlen)); - return ERROR; - } - - /* for Write, put the data into the output buffer */ - if (GFIELD(cmd_arg, SPI_RW_FLAG) == 1) { - /* We send len field of hw-header always a mod16 size, both from host and dongle */ - if (DWORDMODE_ON) { - if (GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2) { - ptr = (uint16 *)&data[0]; - templen = *ptr; - /* ASSERT(*ptr == ~*(ptr + 1)); */ - templen = ROUNDUP(templen, 16); - *ptr = templen; - sd_trace(("actual tx len = %d\n", (uint16)(~*(ptr+1)))); - } - } - - if (datalen != 0) { - for (i = 0; i < datalen/4; i++) { - if (sd->wordlen == 4) { /* 32bit spid */ - *(uint32 *)&spi_outbuf[i * 4 + CMDLEN] = - bcmswap32(data[i]); - } else if (sd->wordlen == 2) { /* 16bit spid */ - *(uint16 *)&spi_outbuf[i * 4 + CMDLEN] = - bcmswap16(data[i] & 0xffff); - *(uint16 *)&spi_outbuf[i * 4 + CMDLEN + 2] = - bcmswap16((data[i] & 0xffff0000) >> 16); - } - } - } - } - - /* Append resp-delay number of bytes and clock them out for F0/1/2 reads. */ - if (GFIELD(cmd_arg, SPI_RW_FLAG) == 0) { - int func = GFIELD(cmd_arg, SPI_FUNCTION); - switch (func) { - case 0: - resp_delay = sd->resp_delay_all ? F0_RESPONSE_DELAY : 0; - break; - case 1: - resp_delay = F1_RESPONSE_DELAY; - break; - case 2: - resp_delay = sd->resp_delay_all ? F2_RESPONSE_DELAY : 0; - break; - default: - ASSERT(0); - break; - } - /* Program response delay */ - bcmspi_prog_resp_delay(sd, func, resp_delay); - } - - /* +4 for cmd and +4 for dstatus */ - hostlen = datalen + 8 + resp_delay; - hostlen += dstatus_idx; - hostlen += (4 - (hostlen & 0x3)); - spi_sendrecv(sd, spi_outbuf, spi_inbuf, hostlen); - - /* for Read, get the data into the input buffer */ - if (datalen != 0) { - if (GFIELD(cmd_arg, SPI_RW_FLAG) == 0) { /* if read cmd */ - for (j = 0; j < datalen/4; j++) { - if (sd->wordlen == 4) { /* 32bit spid */ - data[j] = bcmswap32(*(uint32 *)&spi_inbuf[j * 4 + - CMDLEN + resp_delay]); - } else if (sd->wordlen == 2) { /* 16bit spid */ - data[j] = (bcmswap16(*(uint16 *)&spi_inbuf[j * 4 + - CMDLEN + resp_delay])) | - ((bcmswap16(*(uint16 *)&spi_inbuf[j * 4 + - CMDLEN + resp_delay + 2])) << 16); - } - } - - if ((DWORDMODE_ON) && (GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2)) { - ptr = (uint16 *)&data[0]; - templen = *ptr; - buslen = len = ~(*(ptr + 1)); - buslen = ROUNDUP(buslen, 16); - /* populate actual len in hw-header */ - if (templen == buslen) - *ptr = len; - } - } - } - - /* Restore back the len field of the hw header */ - if (DWORDMODE_ON) { - if ((GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2) && - (GFIELD(cmd_arg, SPI_RW_FLAG) == 1)) { - ptr = (uint16 *)&data[0]; - *ptr = (uint16)(~*(ptr+1)); - } - } - - dstatus_idx += (datalen + CMDLEN + resp_delay); - /* Last 4bytes are dstatus. Device is configured to return status bits. */ - if (sd->wordlen == 4) { /* 32bit spid */ - sd->card_dstatus = bcmswap32(*(uint32 *)&spi_inbuf[dstatus_idx]); - } else if (sd->wordlen == 2) { /* 16bit spid */ - sd->card_dstatus = (bcmswap16(*(uint16 *)&spi_inbuf[dstatus_idx]) | - (bcmswap16(*(uint16 *)&spi_inbuf[dstatus_idx + 2]) << 16)); - } else { - sd_err(("Host is %d bit machine, could not read SPI dstatus.\n", - 8 * sd->wordlen)); - return ERROR; - } - if (sd->card_dstatus == 0xffffffff) { - sd_err(("looks like not a GSPI device or device is not powered.\n")); - } - - err = bcmspi_update_stats(sd, cmd_arg); - - return err; - -} - -static int -bcmspi_card_buf(sdioh_info_t *sd, int rw, int func, bool fifo, - uint32 addr, int nbytes, uint32 *data) -{ - int status; - uint32 cmd_arg; - bool write = rw == SDIOH_READ ? 0 : 1; - uint retries = 0; - - bool enable; - uint32 spilen; - - cmd_arg = 0; - - ASSERT(nbytes); - ASSERT(nbytes <= sd->client_block_size[func]); - - if (write) sd->t_cnt++; else sd->r_cnt++; - - if (func == 2) { - /* Frame len check limited by gSPI. */ - if ((nbytes > 2000) && write) { - sd_trace((">2KB write: F2 wr of %d bytes\n", nbytes)); - } - /* ASSERT(nbytes <= 2048); Fix bigger len gspi issue and uncomment. */ - /* If F2 fifo on device is not ready to receive data, don't do F2 transfer */ - if (write) { - uint32 dstatus; - /* check F2 ready with cached one */ - bcmspi_cmd_getdstatus(sd, &dstatus); - if ((dstatus & STATUS_F2_RX_READY) == 0) { - retries = WAIT_F2RXFIFORDY; - enable = 0; - while (retries-- && !enable) { - OSL_DELAY(WAIT_F2RXFIFORDY_DELAY * 1000); - bcmspi_card_regread(sd, SPI_FUNC_0, SPID_STATUS_REG, 4, - &dstatus); - if (dstatus & STATUS_F2_RX_READY) - enable = TRUE; - } - if (!enable) { - struct spierrstats_t *spierrstats = &sd->spierrstats; - spierrstats->f2rxnotready++; - sd_err(("F2 FIFO is not ready to receive data.\n")); - return ERROR; - } - sd_trace(("No of retries on F2 ready %d\n", - (WAIT_F2RXFIFORDY - retries))); - } - } - } - - /* F2 transfers happen on 0 addr */ - addr = (func == 2) ? 0 : addr; - - /* In pio mode buffer is read using fixed address fifo in func 1 */ - if ((func == 1) && (fifo)) - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 0); - else - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); - - cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, addr); - cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, write); - spilen = sd->data_xfer_count = MIN(sd->client_block_size[func], nbytes); - if ((sd->dwordmode == TRUE) && (GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2)) { - /* convert len to mod4 size */ - spilen = spilen + ((spilen & 0x3) ? (4 - (spilen & 0x3)): 0); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, (spilen >> 2)); - } else - cmd_arg = SFIELD(cmd_arg, SPI_LEN, spilen); - - if ((func == 2) && (fifo == 1)) { - sd_data(("%s: %s func %d, %s, addr 0x%x, len %d bytes, r_cnt %d t_cnt %d\n", - __FUNCTION__, write ? "Wr" : "Rd", func, "INCR", - addr, nbytes, sd->r_cnt, sd->t_cnt)); - } - - sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg)); - sd_data(("%s: %s func %d, %s, addr 0x%x, len %d bytes, r_cnt %d t_cnt %d\n", - __FUNCTION__, write ? "Wd" : "Rd", func, "INCR", - addr, nbytes, sd->r_cnt, sd->t_cnt)); - - - if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, cmd_arg, - data, nbytes)) != SUCCESS) { - sd_err(("%s: cmd_issue failed for %s\n", __FUNCTION__, - (write ? "write" : "read"))); - return status; - } - - /* gSPI expects that hw-header-len is equal to spi-command-len */ - if ((func == 2) && (rw == SDIOH_WRITE) && (sd->dwordmode == FALSE)) { - ASSERT((uint16)sd->data_xfer_count == (uint16)(*data & 0xffff)); - ASSERT((uint16)sd->data_xfer_count == (uint16)(~((*data & 0xffff0000) >> 16))); - } - - if ((nbytes > 2000) && !write) { - sd_trace((">2KB read: F2 rd of %d bytes\n", nbytes)); - } - - return SUCCESS; -} - -/* Reset and re-initialize the device */ -int -sdioh_sdio_reset(sdioh_info_t *si) -{ - si->card_init_done = FALSE; - return bcmspi_client_init(si); -} diff --git a/drivers/net/wireless/bcm4319/bcmutils.c b/drivers/net/wireless/bcm4319/bcmutils.c deleted file mode 100644 index 43c04ee92f38..000000000000 --- a/drivers/net/wireless/bcm4319/bcmutils.c +++ /dev/null @@ -1,1838 +0,0 @@ -/* - * Driver O/S-independent utility routines - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * $Id: bcmutils.c,v 1.210.4.5.2.4.6.19 2010/04/26 06:05:25 Exp $ - */ - -#include -#include -#include -#include -#ifdef BCMDRIVER -#include -#include -#else -#include -#include -/* This case for external supplicant use */ -#if defined(BCMEXTSUP) -#include -#endif - -#endif /* BCMDRIVER */ -#include -#include -#include -#include -#include -#include -#include - - -#ifdef BCMDRIVER - - -/* copy a pkt buffer chain into a buffer */ -uint -pktcopy(osl_t *osh, void *p, uint offset, int len, uchar *buf) -{ - uint n, ret = 0; - - if (len < 0) - len = 4096; /* "infinite" */ - - /* skip 'offset' bytes */ - for (; p && offset; p = PKTNEXT(osh, p)) { - if (offset < (uint)PKTLEN(osh, p)) - break; - offset -= PKTLEN(osh, p); - } - - if (!p) - return 0; - - /* copy the data */ - for (; p && len; p = PKTNEXT(osh, p)) { - n = MIN((uint)PKTLEN(osh, p) - offset, (uint)len); - bcopy(PKTDATA(osh, p) + offset, buf, n); - buf += n; - len -= n; - ret += n; - offset = 0; - } - - return ret; -} - -/* copy a buffer into a pkt buffer chain */ -uint -pktfrombuf(osl_t *osh, void *p, uint offset, int len, uchar *buf) -{ - uint n, ret = 0; - - /* skip 'offset' bytes */ - for (; p && offset; p = PKTNEXT(osh, p)) { - if (offset < (uint)PKTLEN(osh, p)) - break; - offset -= PKTLEN(osh, p); - } - - if (!p) - return 0; - - /* copy the data */ - for (; p && len; p = PKTNEXT(osh, p)) { - n = MIN((uint)PKTLEN(osh, p) - offset, (uint)len); - bcopy(buf, PKTDATA(osh, p) + offset, n); - buf += n; - len -= n; - ret += n; - offset = 0; - } - - return ret; -} - - - -/* return total length of buffer chain */ -uint -pkttotlen(osl_t *osh, void *p) -{ - uint total; - - total = 0; - for (; p; p = PKTNEXT(osh, p)) - total += PKTLEN(osh, p); - return (total); -} - -/* return the last buffer of chained pkt */ -void * -pktlast(osl_t *osh, void *p) -{ - for (; PKTNEXT(osh, p); p = PKTNEXT(osh, p)) - ; - - return (p); -} - -/* count segments of a chained packet */ -uint -pktsegcnt(osl_t *osh, void *p) -{ - uint cnt; - - for (cnt = 0; p; p = PKTNEXT(osh, p)) - cnt++; - - return cnt; -} - - -/* - * osl multiple-precedence packet queue - * hi_prec is always >= the number of the highest non-empty precedence - */ -void * -pktq_penq(struct pktq *pq, int prec, void *p) -{ - struct pktq_prec *q; - - ASSERT(prec >= 0 && prec < pq->num_prec); - ASSERT(PKTLINK(p) == NULL); /* queueing chains not allowed */ - - ASSERT(!pktq_full(pq)); - ASSERT(!pktq_pfull(pq, prec)); - - q = &pq->q[prec]; - - if (q->head) - PKTSETLINK(q->tail, p); - else - q->head = p; - - q->tail = p; - q->len++; - - pq->len++; - - if (pq->hi_prec < prec) - pq->hi_prec = (uint8)prec; - - return p; -} - -void * -pktq_penq_head(struct pktq *pq, int prec, void *p) -{ - struct pktq_prec *q; - - ASSERT(prec >= 0 && prec < pq->num_prec); - ASSERT(PKTLINK(p) == NULL); /* queueing chains not allowed */ - - ASSERT(!pktq_full(pq)); - ASSERT(!pktq_pfull(pq, prec)); - - q = &pq->q[prec]; - - if (q->head == NULL) - q->tail = p; - - PKTSETLINK(p, q->head); - q->head = p; - q->len++; - - pq->len++; - - if (pq->hi_prec < prec) - pq->hi_prec = (uint8)prec; - - return p; -} - -void * -pktq_pdeq(struct pktq *pq, int prec) -{ - struct pktq_prec *q; - void *p; - - ASSERT(prec >= 0 && prec < pq->num_prec); - - q = &pq->q[prec]; - - if ((p = q->head) == NULL) - return NULL; - - if ((q->head = PKTLINK(p)) == NULL) - q->tail = NULL; - - q->len--; - - pq->len--; - - PKTSETLINK(p, NULL); - - return p; -} - -void * -pktq_pdeq_tail(struct pktq *pq, int prec) -{ - struct pktq_prec *q; - void *p, *prev; - - ASSERT(prec >= 0 && prec < pq->num_prec); - - q = &pq->q[prec]; - - if ((p = q->head) == NULL) - return NULL; - - for (prev = NULL; p != q->tail; p = PKTLINK(p)) - prev = p; - - if (prev) - PKTSETLINK(prev, NULL); - else - q->head = NULL; - - q->tail = prev; - q->len--; - - pq->len--; - - return p; -} - -void -pktq_pflush(osl_t *osh, struct pktq *pq, int prec, bool dir) -{ - struct pktq_prec *q; - void *p; - - q = &pq->q[prec]; - p = q->head; - while (p) { - q->head = PKTLINK(p); - PKTSETLINK(p, NULL); - PKTFREE(osh, p, dir); - q->len--; - pq->len--; - p = q->head; - } - ASSERT(q->len == 0); - q->tail = NULL; -} - -bool -pktq_pdel(struct pktq *pq, void *pktbuf, int prec) -{ - struct pktq_prec *q; - void *p; - - ASSERT(prec >= 0 && prec < pq->num_prec); - - if (!pktbuf) - return FALSE; - - q = &pq->q[prec]; - - if (q->head == pktbuf) { - if ((q->head = PKTLINK(pktbuf)) == NULL) - q->tail = NULL; - } else { - for (p = q->head; p && PKTLINK(p) != pktbuf; p = PKTLINK(p)) - ; - if (p == NULL) - return FALSE; - - PKTSETLINK(p, PKTLINK(pktbuf)); - if (q->tail == pktbuf) - q->tail = p; - } - - q->len--; - pq->len--; - PKTSETLINK(pktbuf, NULL); - return TRUE; -} - -void -pktq_init(struct pktq *pq, int num_prec, int max_len) -{ - int prec; - - ASSERT(num_prec > 0 && num_prec <= PKTQ_MAX_PREC); - - /* pq is variable size; only zero out what's requested */ - bzero(pq, OFFSETOF(struct pktq, q) + (sizeof(struct pktq_prec) * num_prec)); - - pq->num_prec = (uint16)num_prec; - - pq->max = (uint16)max_len; - - for (prec = 0; prec < num_prec; prec++) - pq->q[prec].max = pq->max; -} - -void * -pktq_deq(struct pktq *pq, int *prec_out) -{ - struct pktq_prec *q; - void *p; - int prec; - - if (pq->len == 0) - return NULL; - - while ((prec = pq->hi_prec) > 0 && pq->q[prec].head == NULL) - pq->hi_prec--; - - q = &pq->q[prec]; - - if ((p = q->head) == NULL) - return NULL; - - if ((q->head = PKTLINK(p)) == NULL) - q->tail = NULL; - - q->len--; - - pq->len--; - - if (prec_out) - *prec_out = prec; - - PKTSETLINK(p, NULL); - - return p; -} - -void * -pktq_deq_tail(struct pktq *pq, int *prec_out) -{ - struct pktq_prec *q; - void *p, *prev; - int prec; - - if (pq->len == 0) - return NULL; - - for (prec = 0; prec < pq->hi_prec; prec++) - if (pq->q[prec].head) - break; - - q = &pq->q[prec]; - - if ((p = q->head) == NULL) - return NULL; - - for (prev = NULL; p != q->tail; p = PKTLINK(p)) - prev = p; - - if (prev) - PKTSETLINK(prev, NULL); - else - q->head = NULL; - - q->tail = prev; - q->len--; - - pq->len--; - - if (prec_out) - *prec_out = prec; - - PKTSETLINK(p, NULL); - - return p; -} - -void * -pktq_peek(struct pktq *pq, int *prec_out) -{ - int prec; - - if (pq->len == 0) - return NULL; - - while ((prec = pq->hi_prec) > 0 && pq->q[prec].head == NULL) - pq->hi_prec--; - - if (prec_out) - *prec_out = prec; - - return (pq->q[prec].head); -} - -void * -pktq_peek_tail(struct pktq *pq, int *prec_out) -{ - int prec; - - if (pq->len == 0) - return NULL; - - for (prec = 0; prec < pq->hi_prec; prec++) - if (pq->q[prec].head) - break; - - if (prec_out) - *prec_out = prec; - - return (pq->q[prec].tail); -} - -void -pktq_flush(osl_t *osh, struct pktq *pq, bool dir) -{ - int prec; - for (prec = 0; prec < pq->num_prec; prec++) - pktq_pflush(osh, pq, prec, dir); - ASSERT(pq->len == 0); -} - -/* Return sum of lengths of a specific set of precedences */ -int -pktq_mlen(struct pktq *pq, uint prec_bmp) -{ - int prec, len; - - len = 0; - - for (prec = 0; prec <= pq->hi_prec; prec++) - if (prec_bmp & (1 << prec)) - len += pq->q[prec].len; - - return len; -} - -/* Priority dequeue from a specific set of precedences */ -void * -pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out) -{ - struct pktq_prec *q; - void *p; - int prec; - - if (pq->len == 0) - return NULL; - - while ((prec = pq->hi_prec) > 0 && pq->q[prec].head == NULL) - pq->hi_prec--; - - while ((prec_bmp & (1 << prec)) == 0 || pq->q[prec].head == NULL) - if (prec-- == 0) - return NULL; - - q = &pq->q[prec]; - - if ((p = q->head) == NULL) - return NULL; - - if ((q->head = PKTLINK(p)) == NULL) - q->tail = NULL; - - q->len--; - - if (prec_out) - *prec_out = prec; - - pq->len--; - - PKTSETLINK(p, NULL); - - return p; -} -#endif /* BCMDRIVER */ - - - -const unsigned char bcm_ctype[] = { - _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 0-7 */ - _BCM_C, _BCM_C|_BCM_S, _BCM_C|_BCM_S, _BCM_C|_BCM_S, _BCM_C|_BCM_S, _BCM_C|_BCM_S, _BCM_C, - _BCM_C, /* 8-15 */ - _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 16-23 */ - _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 24-31 */ - _BCM_S|_BCM_SP,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 32-39 */ - _BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 40-47 */ - _BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D, /* 48-55 */ - _BCM_D,_BCM_D,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 56-63 */ - _BCM_P, _BCM_U|_BCM_X, _BCM_U|_BCM_X, _BCM_U|_BCM_X, _BCM_U|_BCM_X, _BCM_U|_BCM_X, - _BCM_U|_BCM_X, _BCM_U, /* 64-71 */ - _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U, /* 72-79 */ - _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U, /* 80-87 */ - _BCM_U,_BCM_U,_BCM_U,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 88-95 */ - _BCM_P, _BCM_L|_BCM_X, _BCM_L|_BCM_X, _BCM_L|_BCM_X, _BCM_L|_BCM_X, _BCM_L|_BCM_X, - _BCM_L|_BCM_X, _BCM_L, /* 96-103 */ - _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L, /* 104-111 */ - _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L, /* 112-119 */ - _BCM_L,_BCM_L,_BCM_L,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_C, /* 120-127 */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 128-143 */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 144-159 */ - _BCM_S|_BCM_SP, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, - _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, /* 160-175 */ - _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, - _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, /* 176-191 */ - _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, - _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, /* 192-207 */ - _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_P, _BCM_U, _BCM_U, _BCM_U, - _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_L, /* 208-223 */ - _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, - _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, /* 224-239 */ - _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_P, _BCM_L, _BCM_L, _BCM_L, - _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L /* 240-255 */ -}; - -ulong -bcm_strtoul(char *cp, char **endp, uint base) -{ - ulong result, last_result = 0, value; - bool minus; - - minus = FALSE; - - while (bcm_isspace(*cp)) - cp++; - - if (cp[0] == '+') - cp++; - else if (cp[0] == '-') { - minus = TRUE; - cp++; - } - - if (base == 0) { - if (cp[0] == '0') { - if ((cp[1] == 'x') || (cp[1] == 'X')) { - base = 16; - cp = &cp[2]; - } else { - base = 8; - cp = &cp[1]; - } - } else - base = 10; - } else if (base == 16 && (cp[0] == '0') && ((cp[1] == 'x') || (cp[1] == 'X'))) { - cp = &cp[2]; - } - - result = 0; - - while (bcm_isxdigit(*cp) && - (value = bcm_isdigit(*cp) ? *cp-'0' : bcm_toupper(*cp)-'A'+10) < base) { - result = result*base + value; - /* Detected overflow */ - if (result < last_result && !minus) - return (ulong)-1; - last_result = result; - cp++; - } - - if (minus) - result = (ulong)(-(long)result); - - if (endp) - *endp = (char *)cp; - - return (result); -} - -int -bcm_atoi(char *s) -{ - return (int)bcm_strtoul(s, NULL, 10); -} - -/* return pointer to location of substring 'needle' in 'haystack' */ -char* -bcmstrstr(char *haystack, char *needle) -{ - int len, nlen; - int i; - - if ((haystack == NULL) || (needle == NULL)) - return (haystack); - - nlen = strlen(needle); - len = strlen(haystack) - nlen + 1; - - for (i = 0; i < len; i++) - if (memcmp(needle, &haystack[i], nlen) == 0) - return (&haystack[i]); - return (NULL); -} - -char* -bcmstrcat(char *dest, const char *src) -{ - char *p; - - p = dest + strlen(dest); - - while ((*p++ = *src++) != '\0') - ; - - return (dest); -} - -char* -bcmstrncat(char *dest, const char *src, uint size) -{ - char *endp; - char *p; - - p = dest + strlen(dest); - endp = p + size; - - while (p != endp && (*p++ = *src++) != '\0') - ; - - return (dest); -} - - -/**************************************************************************** -* Function: bcmstrtok -* -* Purpose: -* Tokenizes a string. This function is conceptually similiar to ANSI C strtok(), -* but allows strToken() to be used by different strings or callers at the same -* time. Each call modifies '*string' by substituting a NULL character for the -* first delimiter that is encountered, and updates 'string' to point to the char -* after the delimiter. Leading delimiters are skipped. -* -* Parameters: -* string (mod) Ptr to string ptr, updated by token. -* delimiters (in) Set of delimiter characters. -* tokdelim (out) Character that delimits the returned token. (May -* be set to NULL if token delimiter is not required). -* -* Returns: Pointer to the next token found. NULL when no more tokens are found. -***************************************************************************** -*/ -char * -bcmstrtok(char **string, const char *delimiters, char *tokdelim) -{ - unsigned char *str; - unsigned long map[8]; - int count; - char *nextoken; - - if (tokdelim != NULL) { - /* Prime the token delimiter */ - *tokdelim = '\0'; - } - - /* Clear control map */ - for (count = 0; count < 8; count++) { - map[count] = 0; - } - - /* Set bits in delimiter table */ - do { - map[*delimiters >> 5] |= (1 << (*delimiters & 31)); - } - while (*delimiters++); - - str = (unsigned char*)*string; - - /* Find beginning of token (skip over leading delimiters). Note that - * there is no token iff this loop sets str to point to the terminal - * null (*str == '\0') - */ - while (((map[*str >> 5] & (1 << (*str & 31))) && *str) || (*str == ' ')) { - str++; - } - - nextoken = (char*)str; - - /* Find the end of the token. If it is not the end of the string, - * put a null there. - */ - for (; *str; str++) { - if (map[*str >> 5] & (1 << (*str & 31))) { - if (tokdelim != NULL) { - *tokdelim = *str; - } - - *str++ = '\0'; - break; - } - } - - *string = (char*)str; - - /* Determine if a token has been found. */ - if (nextoken == (char *) str) { - return NULL; - } - else { - return nextoken; - } -} - - -#define xToLower(C) \ - ((C >= 'A' && C <= 'Z') ? (char)((int)C - (int)'A' + (int)'a') : C) - - -/**************************************************************************** -* Function: bcmstricmp -* -* Purpose: Compare to strings case insensitively. -* -* Parameters: s1 (in) First string to compare. -* s2 (in) Second string to compare. -* -* Returns: Return 0 if the two strings are equal, -1 if t1 < t2 and 1 if -* t1 > t2, when ignoring case sensitivity. -***************************************************************************** -*/ -int -bcmstricmp(const char *s1, const char *s2) -{ - char dc, sc; - - while (*s2 && *s1) { - dc = xToLower(*s1); - sc = xToLower(*s2); - if (dc < sc) return -1; - if (dc > sc) return 1; - s1++; - s2++; - } - - if (*s1 && !*s2) return 1; - if (!*s1 && *s2) return -1; - return 0; -} - - -/**************************************************************************** -* Function: bcmstrnicmp -* -* Purpose: Compare to strings case insensitively, upto a max of 'cnt' -* characters. -* -* Parameters: s1 (in) First string to compare. -* s2 (in) Second string to compare. -* cnt (in) Max characters to compare. -* -* Returns: Return 0 if the two strings are equal, -1 if t1 < t2 and 1 if -* t1 > t2, when ignoring case sensitivity. -***************************************************************************** -*/ -int -bcmstrnicmp(const char* s1, const char* s2, int cnt) -{ - char dc, sc; - - while (*s2 && *s1 && cnt) { - dc = xToLower(*s1); - sc = xToLower(*s2); - if (dc < sc) return -1; - if (dc > sc) return 1; - s1++; - s2++; - cnt--; - } - - if (!cnt) return 0; - if (*s1 && !*s2) return 1; - if (!*s1 && *s2) return -1; - return 0; -} - -/* parse a xx:xx:xx:xx:xx:xx format ethernet address */ -int -bcm_ether_atoe(char *p, struct ether_addr *ea) -{ - int i = 0; - - for (;;) { - ea->octet[i++] = (char) bcm_strtoul(p, &p, 16); - if (!*p++ || i == 6) - break; - } - - return (i == 6); -} - - -#if defined(CONFIG_USBRNDIS_RETAIL) || defined(NDIS_MINIPORT_DRIVER) -/* registry routine buffer preparation utility functions: - * parameter order is like strncpy, but returns count - * of bytes copied. Minimum bytes copied is null char(1)/wchar(2) - */ -ulong -wchar2ascii(char *abuf, ushort *wbuf, ushort wbuflen, ulong abuflen) -{ - ulong copyct = 1; - ushort i; - - if (abuflen == 0) - return 0; - - /* wbuflen is in bytes */ - wbuflen /= sizeof(ushort); - - for (i = 0; i < wbuflen; ++i) { - if (--abuflen == 0) - break; - *abuf++ = (char) *wbuf++; - ++copyct; - } - *abuf = '\0'; - - return copyct; -} -#endif /* CONFIG_USBRNDIS_RETAIL || NDIS_MINIPORT_DRIVER */ - -char * -bcm_ether_ntoa(const struct ether_addr *ea, char *buf) -{ - static const char template[] = "%02x:%02x:%02x:%02x:%02x:%02x"; - snprintf(buf, 18, template, - ea->octet[0]&0xff, ea->octet[1]&0xff, ea->octet[2]&0xff, - ea->octet[3]&0xff, ea->octet[4]&0xff, ea->octet[5]&0xff); - return (buf); -} - -char * -bcm_ip_ntoa(struct ipv4_addr *ia, char *buf) -{ - snprintf(buf, 16, "%d.%d.%d.%d", - ia->addr[0], ia->addr[1], ia->addr[2], ia->addr[3]); - return (buf); -} - -#ifdef BCMDRIVER - -void -bcm_mdelay(uint ms) -{ - uint i; - - for (i = 0; i < ms; i++) { - OSL_DELAY(1000); - } -} - - - - - - -#if defined(DHD_DEBUG) -/* pretty hex print a pkt buffer chain */ -void -prpkt(const char *msg, osl_t *osh, void *p0) -{ - void *p; - - if (msg && (msg[0] != '\0')) - printf("%s:\n", msg); - - for (p = p0; p; p = PKTNEXT(osh, p)) - prhex(NULL, PKTDATA(osh, p), PKTLEN(osh, p)); -} -#endif - -/* Takes an Ethernet frame and sets out-of-bound PKTPRIO. - * Also updates the inplace vlan tag if requested. - * For debugging, it returns an indication of what it did. - */ -uint -pktsetprio(void *pkt, bool update_vtag) -{ - struct ether_header *eh; - struct ethervlan_header *evh; - uint8 *pktdata; - int priority = 0; - int rc = 0; - - pktdata = (uint8 *) PKTDATA(NULL, pkt); - ASSERT(ISALIGNED((uintptr)pktdata, sizeof(uint16))); - - eh = (struct ether_header *) pktdata; - - if (ntoh16(eh->ether_type) == ETHER_TYPE_8021Q) { - uint16 vlan_tag; - int vlan_prio, dscp_prio = 0; - - evh = (struct ethervlan_header *)eh; - - vlan_tag = ntoh16(evh->vlan_tag); - vlan_prio = (int) (vlan_tag >> VLAN_PRI_SHIFT) & VLAN_PRI_MASK; - - if (ntoh16(evh->ether_type) == ETHER_TYPE_IP) { - uint8 *ip_body = pktdata + sizeof(struct ethervlan_header); - uint8 tos_tc = IP_TOS(ip_body); - dscp_prio = (int)(tos_tc >> IPV4_TOS_PREC_SHIFT); - } - - /* DSCP priority gets precedence over 802.1P (vlan tag) */ - if (dscp_prio != 0) { - priority = dscp_prio; - rc |= PKTPRIO_VDSCP; - } else { - priority = vlan_prio; - rc |= PKTPRIO_VLAN; - } - /* - * If the DSCP priority is not the same as the VLAN priority, - * then overwrite the priority field in the vlan tag, with the - * DSCP priority value. This is required for Linux APs because - * the VLAN driver on Linux, overwrites the skb->priority field - * with the priority value in the vlan tag - */ - if (update_vtag && (priority != vlan_prio)) { - vlan_tag &= ~(VLAN_PRI_MASK << VLAN_PRI_SHIFT); - vlan_tag |= (uint16)priority << VLAN_PRI_SHIFT; - evh->vlan_tag = hton16(vlan_tag); - rc |= PKTPRIO_UPD; - } - } else if (ntoh16(eh->ether_type) == ETHER_TYPE_IP) { - uint8 *ip_body = pktdata + sizeof(struct ether_header); - uint8 tos_tc = IP_TOS(ip_body); - priority = (int)(tos_tc >> IPV4_TOS_PREC_SHIFT); - rc |= PKTPRIO_DSCP; - } - - ASSERT(priority >= 0 && priority <= MAXPRIO); - PKTSETPRIO(pkt, priority); - return (rc | priority); -} - -static char bcm_undeferrstr[BCME_STRLEN]; - -static const char *bcmerrorstrtable[] = BCMERRSTRINGTABLE; - -/* Convert the error codes into related error strings */ -const char * -bcmerrorstr(int bcmerror) -{ - /* check if someone added a bcmerror code but forgot to add errorstring */ - ASSERT(ABS(BCME_LAST) == (ARRAYSIZE(bcmerrorstrtable) - 1)); - - if (bcmerror > 0 || bcmerror < BCME_LAST) { - snprintf(bcm_undeferrstr, BCME_STRLEN, "Undefined error %d", bcmerror); - return bcm_undeferrstr; - } - - ASSERT(strlen(bcmerrorstrtable[-bcmerror]) < BCME_STRLEN); - - return bcmerrorstrtable[-bcmerror]; -} - - - -/* iovar table lookup */ -const bcm_iovar_t* -bcm_iovar_lookup(const bcm_iovar_t *table, const char *name) -{ - const bcm_iovar_t *vi; - const char *lookup_name; - - /* skip any ':' delimited option prefixes */ - lookup_name = strrchr(name, ':'); - if (lookup_name != NULL) - lookup_name++; - else - lookup_name = name; - - ASSERT(table != NULL); - - for (vi = table; vi->name; vi++) { - if (!strcmp(vi->name, lookup_name)) - return vi; - } - /* ran to end of table */ - - return NULL; /* var name not found */ -} - -int -bcm_iovar_lencheck(const bcm_iovar_t *vi, void *arg, int len, bool set) -{ - int bcmerror = 0; - - /* length check on io buf */ - switch (vi->type) { - case IOVT_BOOL: - case IOVT_INT8: - case IOVT_INT16: - case IOVT_INT32: - case IOVT_UINT8: - case IOVT_UINT16: - case IOVT_UINT32: - /* all integers are int32 sized args at the ioctl interface */ - if (len < (int)sizeof(int)) { - bcmerror = BCME_BUFTOOSHORT; - } - break; - - case IOVT_BUFFER: - /* buffer must meet minimum length requirement */ - if (len < vi->minlen) { - bcmerror = BCME_BUFTOOSHORT; - } - break; - - case IOVT_VOID: - if (!set) { - /* Cannot return nil... */ - bcmerror = BCME_UNSUPPORTED; - } else if (len) { - /* Set is an action w/o parameters */ - bcmerror = BCME_BUFTOOLONG; - } - break; - - default: - /* unknown type for length check in iovar info */ - ASSERT(0); - bcmerror = BCME_UNSUPPORTED; - } - - return bcmerror; -} - -#endif /* BCMDRIVER */ - -/******************************************************************************* - * crc8 - * - * Computes a crc8 over the input data using the polynomial: - * - * x^8 + x^7 +x^6 + x^4 + x^2 + 1 - * - * The caller provides the initial value (either CRC8_INIT_VALUE - * or the previous returned value) to allow for processing of - * discontiguous blocks of data. When generating the CRC the - * caller is responsible for complementing the final return value - * and inserting it into the byte stream. When checking, a final - * return value of CRC8_GOOD_VALUE indicates a valid CRC. - * - * Reference: Dallas Semiconductor Application Note 27 - * Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms", - * ver 3, Aug 1993, ross@guest.adelaide.edu.au, Rocksoft Pty Ltd., - * ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt - * - * **************************************************************************** - */ - -STATIC const uint8 crc8_table[256] = { - 0x00, 0xF7, 0xB9, 0x4E, 0x25, 0xD2, 0x9C, 0x6B, - 0x4A, 0xBD, 0xF3, 0x04, 0x6F, 0x98, 0xD6, 0x21, - 0x94, 0x63, 0x2D, 0xDA, 0xB1, 0x46, 0x08, 0xFF, - 0xDE, 0x29, 0x67, 0x90, 0xFB, 0x0C, 0x42, 0xB5, - 0x7F, 0x88, 0xC6, 0x31, 0x5A, 0xAD, 0xE3, 0x14, - 0x35, 0xC2, 0x8C, 0x7B, 0x10, 0xE7, 0xA9, 0x5E, - 0xEB, 0x1C, 0x52, 0xA5, 0xCE, 0x39, 0x77, 0x80, - 0xA1, 0x56, 0x18, 0xEF, 0x84, 0x73, 0x3D, 0xCA, - 0xFE, 0x09, 0x47, 0xB0, 0xDB, 0x2C, 0x62, 0x95, - 0xB4, 0x43, 0x0D, 0xFA, 0x91, 0x66, 0x28, 0xDF, - 0x6A, 0x9D, 0xD3, 0x24, 0x4F, 0xB8, 0xF6, 0x01, - 0x20, 0xD7, 0x99, 0x6E, 0x05, 0xF2, 0xBC, 0x4B, - 0x81, 0x76, 0x38, 0xCF, 0xA4, 0x53, 0x1D, 0xEA, - 0xCB, 0x3C, 0x72, 0x85, 0xEE, 0x19, 0x57, 0xA0, - 0x15, 0xE2, 0xAC, 0x5B, 0x30, 0xC7, 0x89, 0x7E, - 0x5F, 0xA8, 0xE6, 0x11, 0x7A, 0x8D, 0xC3, 0x34, - 0xAB, 0x5C, 0x12, 0xE5, 0x8E, 0x79, 0x37, 0xC0, - 0xE1, 0x16, 0x58, 0xAF, 0xC4, 0x33, 0x7D, 0x8A, - 0x3F, 0xC8, 0x86, 0x71, 0x1A, 0xED, 0xA3, 0x54, - 0x75, 0x82, 0xCC, 0x3B, 0x50, 0xA7, 0xE9, 0x1E, - 0xD4, 0x23, 0x6D, 0x9A, 0xF1, 0x06, 0x48, 0xBF, - 0x9E, 0x69, 0x27, 0xD0, 0xBB, 0x4C, 0x02, 0xF5, - 0x40, 0xB7, 0xF9, 0x0E, 0x65, 0x92, 0xDC, 0x2B, - 0x0A, 0xFD, 0xB3, 0x44, 0x2F, 0xD8, 0x96, 0x61, - 0x55, 0xA2, 0xEC, 0x1B, 0x70, 0x87, 0xC9, 0x3E, - 0x1F, 0xE8, 0xA6, 0x51, 0x3A, 0xCD, 0x83, 0x74, - 0xC1, 0x36, 0x78, 0x8F, 0xE4, 0x13, 0x5D, 0xAA, - 0x8B, 0x7C, 0x32, 0xC5, 0xAE, 0x59, 0x17, 0xE0, - 0x2A, 0xDD, 0x93, 0x64, 0x0F, 0xF8, 0xB6, 0x41, - 0x60, 0x97, 0xD9, 0x2E, 0x45, 0xB2, 0xFC, 0x0B, - 0xBE, 0x49, 0x07, 0xF0, 0x9B, 0x6C, 0x22, 0xD5, - 0xF4, 0x03, 0x4D, 0xBA, 0xD1, 0x26, 0x68, 0x9F -}; - -#define CRC_INNER_LOOP(n, c, x) \ - (c) = ((c) >> 8) ^ crc##n##_table[((c) ^ (x)) & 0xff] - -uint8 -hndcrc8( - uint8 *pdata, /* pointer to array of data to process */ - uint nbytes, /* number of input data bytes to process */ - uint8 crc /* either CRC8_INIT_VALUE or previous return value */ -) -{ - /* hard code the crc loop instead of using CRC_INNER_LOOP macro - * to avoid the undefined and unnecessary (uint8 >> 8) operation. - */ - while (nbytes-- > 0) - crc = crc8_table[(crc ^ *pdata++) & 0xff]; - - return crc; -} - -/******************************************************************************* - * crc16 - * - * Computes a crc16 over the input data using the polynomial: - * - * x^16 + x^12 +x^5 + 1 - * - * The caller provides the initial value (either CRC16_INIT_VALUE - * or the previous returned value) to allow for processing of - * discontiguous blocks of data. When generating the CRC the - * caller is responsible for complementing the final return value - * and inserting it into the byte stream. When checking, a final - * return value of CRC16_GOOD_VALUE indicates a valid CRC. - * - * Reference: Dallas Semiconductor Application Note 27 - * Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms", - * ver 3, Aug 1993, ross@guest.adelaide.edu.au, Rocksoft Pty Ltd., - * ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt - * - * **************************************************************************** - */ - -static const uint16 crc16_table[256] = { - 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF, - 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7, - 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E, - 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876, - 0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD, - 0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5, - 0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C, - 0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974, - 0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB, - 0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3, - 0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A, - 0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72, - 0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9, - 0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1, - 0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738, - 0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70, - 0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7, - 0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF, - 0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036, - 0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E, - 0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5, - 0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD, - 0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134, - 0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C, - 0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3, - 0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB, - 0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232, - 0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A, - 0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1, - 0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9, - 0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330, - 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78 -}; - -uint16 -hndcrc16( - uint8 *pdata, /* pointer to array of data to process */ - uint nbytes, /* number of input data bytes to process */ - uint16 crc /* either CRC16_INIT_VALUE or previous return value */ -) -{ - while (nbytes-- > 0) - CRC_INNER_LOOP(16, crc, *pdata++); - return crc; -} - -STATIC const uint32 crc32_table[256] = { - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, - 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, - 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, - 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, - 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, - 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, - 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, - 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, - 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, - 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, - 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, - 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, - 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, - 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, - 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, - 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, - 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, - 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, - 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, - 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, - 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, - 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, - 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, - 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, - 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, - 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, - 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, - 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, - 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, - 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, - 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, - 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, - 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, - 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, - 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, - 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, - 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, - 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, - 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, - 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, - 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, - 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, - 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, - 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, - 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, - 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, - 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, - 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, - 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, - 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, - 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, - 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, - 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, - 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D -}; - -uint32 -hndcrc32( - uint8 *pdata, /* pointer to array of data to process */ - uint nbytes, /* number of input data bytes to process */ - uint32 crc /* either CRC32_INIT_VALUE or previous return value */ -) -{ - uint8 *pend; -#ifdef __mips__ - uint8 tmp[4]; - ulong *tptr = (ulong *)tmp; - - /* in case the beginning of the buffer isn't aligned */ - pend = (uint8 *)((uint)(pdata + 3) & 0xfffffffc); - nbytes -= (pend - pdata); - while (pdata < pend) - CRC_INNER_LOOP(32, crc, *pdata++); - - /* handle bulk of data as 32-bit words */ - pend = pdata + (nbytes & 0xfffffffc); - while (pdata < pend) { - *tptr = *(ulong *)pdata; - pdata += sizeof(ulong *); - CRC_INNER_LOOP(32, crc, tmp[0]); - CRC_INNER_LOOP(32, crc, tmp[1]); - CRC_INNER_LOOP(32, crc, tmp[2]); - CRC_INNER_LOOP(32, crc, tmp[3]); - } - - /* 1-3 bytes at end of buffer */ - pend = pdata + (nbytes & 0x03); - while (pdata < pend) - CRC_INNER_LOOP(32, crc, *pdata++); -#else - pend = pdata + nbytes; - while (pdata < pend) - CRC_INNER_LOOP(32, crc, *pdata++); -#endif /* __mips__ */ - - return crc; -} - -#ifdef notdef -#define CLEN 1499 /* CRC Length */ -#define CBUFSIZ (CLEN+4) -#define CNBUFS 5 /* # of bufs */ - -void testcrc32(void) -{ - uint j, k, l; - uint8 *buf; - uint len[CNBUFS]; - uint32 crcr; - uint32 crc32tv[CNBUFS] = - {0xd2cb1faa, 0xd385c8fa, 0xf5b4f3f3, 0x55789e20, 0x00343110}; - - ASSERT((buf = MALLOC(CBUFSIZ*CNBUFS)) != NULL); - - /* step through all possible alignments */ - for (l = 0; l <= 4; l++) { - for (j = 0; j < CNBUFS; j++) { - len[j] = CLEN; - for (k = 0; k < len[j]; k++) - *(buf + j*CBUFSIZ + (k+l)) = (j+k) & 0xff; - } - - for (j = 0; j < CNBUFS; j++) { - crcr = crc32(buf + j*CBUFSIZ + l, len[j], CRC32_INIT_VALUE); - ASSERT(crcr == crc32tv[j]); - } - } - - MFREE(buf, CBUFSIZ*CNBUFS); - return; -} -#endif /* notdef */ - -/* - * Advance from the current 1-byte tag/1-byte length/variable-length value - * triple, to the next, returning a pointer to the next. - * If the current or next TLV is invalid (does not fit in given buffer length), - * NULL is returned. - * *buflen is not modified if the TLV elt parameter is invalid, or is decremented - * by the TLV parameter's length if it is valid. - */ -bcm_tlv_t * -bcm_next_tlv(bcm_tlv_t *elt, int *buflen) -{ - int len; - - /* validate current elt */ - if (!bcm_valid_tlv(elt, *buflen)) - return NULL; - - /* advance to next elt */ - len = elt->len; - elt = (bcm_tlv_t*)(elt->data + len); - *buflen -= (2 + len); - - /* validate next elt */ - if (!bcm_valid_tlv(elt, *buflen)) - return NULL; - - return elt; -} - -/* - * Traverse a string of 1-byte tag/1-byte length/variable-length value - * triples, returning a pointer to the substring whose first element - * matches tag - */ -bcm_tlv_t * -bcm_parse_tlvs(void *buf, int buflen, uint key) -{ - bcm_tlv_t *elt; - int totlen; - - elt = (bcm_tlv_t*)buf; - totlen = buflen; - - /* find tagged parameter */ - while (totlen >= 2) { - int len = elt->len; - - /* validate remaining totlen */ - if ((elt->id == key) && (totlen >= (len + 2))) - return (elt); - - elt = (bcm_tlv_t*)((uint8*)elt + (len + 2)); - totlen -= (len + 2); - } - - return NULL; -} - -/* - * Traverse a string of 1-byte tag/1-byte length/variable-length value - * triples, returning a pointer to the substring whose first element - * matches tag. Stop parsing when we see an element whose ID is greater - * than the target key. - */ -bcm_tlv_t * -bcm_parse_ordered_tlvs(void *buf, int buflen, uint key) -{ - bcm_tlv_t *elt; - int totlen; - - elt = (bcm_tlv_t*)buf; - totlen = buflen; - - /* find tagged parameter */ - while (totlen >= 2) { - uint id = elt->id; - int len = elt->len; - - /* Punt if we start seeing IDs > than target key */ - if (id > key) - return (NULL); - - /* validate remaining totlen */ - if ((id == key) && (totlen >= (len + 2))) - return (elt); - - elt = (bcm_tlv_t*)((uint8*)elt + (len + 2)); - totlen -= (len + 2); - } - return NULL; -} - -#if defined(WLMSG_PRHDRS) || defined(WLMSG_PRPKT) || defined(WLMSG_ASSOC) || \ - defined(DHD_DEBUG) -int -bcm_format_flags(const bcm_bit_desc_t *bd, uint32 flags, char* buf, int len) -{ - int i; - char* p = buf; - char hexstr[16]; - int slen = 0; - uint32 bit; - const char* name; - - if (len < 2 || !buf) - return 0; - - buf[0] = '\0'; - len -= 1; - - for (i = 0; flags != 0; i++) { - bit = bd[i].bit; - name = bd[i].name; - if (bit == 0 && flags) { - /* print any unnamed bits */ - sprintf(hexstr, "0x%X", flags); - name = hexstr; - flags = 0; /* exit loop */ - } else if ((flags & bit) == 0) - continue; - slen += strlen(name); - if (len < slen) - break; - if (p != buf) p += sprintf(p, " "); /* btwn flag space */ - strcat(p, name); - p += strlen(name); - flags &= ~bit; - len -= slen; - slen = 1; /* account for btwn flag space */ - } - - /* indicate the str was too short */ - if (flags != 0) { - if (len == 0) - p--; /* overwrite last char */ - p += sprintf(p, ">"); - } - - return (int)(p - buf); -} - -/* print bytes formatted as hex to a string. return the resulting string length */ -int -bcm_format_hex(char *str, const void *bytes, int len) -{ - int i; - char *p = str; - const uint8 *src = (const uint8*)bytes; - - for (i = 0; i < len; i++) { - p += sprintf(p, "%02X", *src); - src++; - } - return (int)(p - str); -} - -/* pretty hex print a contiguous buffer */ -void -prhex(const char *msg, uchar *buf, uint nbytes) -{ - char line[128], *p; - uint i; - - if (msg && (msg[0] != '\0')) - printf("%s:\n", msg); - - p = line; - for (i = 0; i < nbytes; i++) { - if (i % 16 == 0) { - p += sprintf(p, " %04d: ", i); /* line prefix */ - } - p += sprintf(p, "%02x ", buf[i]); - if (i % 16 == 15) { - printf("%s\n", line); /* flush line */ - p = line; - } - } - - /* flush last partial line */ - if (p != line) - printf("%s\n", line); -} -#endif - - -/* Produce a human-readable string for boardrev */ -char * -bcm_brev_str(uint32 brev, char *buf) -{ - if (brev < 0x100) - snprintf(buf, 8, "%d.%d", (brev & 0xf0) >> 4, brev & 0xf); - else - snprintf(buf, 8, "%c%03x", ((brev & 0xf000) == 0x1000) ? 'P' : 'A', brev & 0xfff); - - return (buf); -} - -#define BUFSIZE_TODUMP_ATONCE 512 /* Buffer size */ - -/* dump large strings to console */ -void -printbig(char *buf) -{ - uint len, max_len; - char c; - - len = strlen(buf); - - max_len = BUFSIZE_TODUMP_ATONCE; - - while (len > max_len) { - c = buf[max_len]; - buf[max_len] = '\0'; - printf("%s", buf); - buf[max_len] = c; - - buf += max_len; - len -= max_len; - } - /* print the remaining string */ - printf("%s\n", buf); - return; -} - -/* routine to dump fields in a fileddesc structure */ -uint -bcmdumpfields(bcmutl_rdreg_rtn read_rtn, void *arg0, uint arg1, struct fielddesc *fielddesc_array, - char *buf, uint32 bufsize) -{ - uint filled_len; - int len; - struct fielddesc *cur_ptr; - - filled_len = 0; - cur_ptr = fielddesc_array; - - while (bufsize > 1) { - if (cur_ptr->nameandfmt == NULL) - break; - len = snprintf(buf, bufsize, cur_ptr->nameandfmt, - read_rtn(arg0, arg1, cur_ptr->offset)); - /* check for snprintf overflow or error */ - if (len < 0 || (uint32)len >= bufsize) - len = bufsize - 1; - buf += len; - bufsize -= len; - filled_len += len; - cur_ptr++; - } - return filled_len; -} - -uint -bcm_mkiovar(char *name, char *data, uint datalen, char *buf, uint buflen) -{ - uint len; - - len = strlen(name) + 1; - - if ((len + datalen) > buflen) - return 0; - - strncpy(buf, name, buflen); - - /* append data onto the end of the name string */ - memcpy(&buf[len], data, datalen); - len += datalen; - - return len; -} - -/* Quarter dBm units to mW - * Table starts at QDBM_OFFSET, so the first entry is mW for qdBm=153 - * Table is offset so the last entry is largest mW value that fits in - * a uint16. - */ - -#define QDBM_OFFSET 153 /* Offset for first entry */ -#define QDBM_TABLE_LEN 40 /* Table size */ - -/* Smallest mW value that will round up to the first table entry, QDBM_OFFSET. - * Value is ( mW(QDBM_OFFSET - 1) + mW(QDBM_OFFSET) ) / 2 - */ -#define QDBM_TABLE_LOW_BOUND 6493 /* Low bound */ - -/* Largest mW value that will round down to the last table entry, - * QDBM_OFFSET + QDBM_TABLE_LEN-1. - * Value is ( mW(QDBM_OFFSET + QDBM_TABLE_LEN - 1) + mW(QDBM_OFFSET + QDBM_TABLE_LEN) ) / 2. - */ -#define QDBM_TABLE_HIGH_BOUND 64938 /* High bound */ - -static const uint16 nqdBm_to_mW_map[QDBM_TABLE_LEN] = { -/* qdBm: +0 +1 +2 +3 +4 +5 +6 +7 */ -/* 153: */ 6683, 7079, 7499, 7943, 8414, 8913, 9441, 10000, -/* 161: */ 10593, 11220, 11885, 12589, 13335, 14125, 14962, 15849, -/* 169: */ 16788, 17783, 18836, 19953, 21135, 22387, 23714, 25119, -/* 177: */ 26607, 28184, 29854, 31623, 33497, 35481, 37584, 39811, -/* 185: */ 42170, 44668, 47315, 50119, 53088, 56234, 59566, 63096 -}; - -uint16 -bcm_qdbm_to_mw(uint8 qdbm) -{ - uint factor = 1; - int idx = qdbm - QDBM_OFFSET; - - if (idx >= QDBM_TABLE_LEN) { - /* clamp to max uint16 mW value */ - return 0xFFFF; - } - - /* scale the qdBm index up to the range of the table 0-40 - * where an offset of 40 qdBm equals a factor of 10 mW. - */ - while (idx < 0) { - idx += 40; - factor *= 10; - } - - /* return the mW value scaled down to the correct factor of 10, - * adding in factor/2 to get proper rounding. - */ - return ((nqdBm_to_mW_map[idx] + factor/2) / factor); -} - -uint8 -bcm_mw_to_qdbm(uint16 mw) -{ - uint8 qdbm; - int offset; - uint mw_uint = mw; - uint boundary; - - /* handle boundary case */ - if (mw_uint <= 1) - return 0; - - offset = QDBM_OFFSET; - - /* move mw into the range of the table */ - while (mw_uint < QDBM_TABLE_LOW_BOUND) { - mw_uint *= 10; - offset -= 40; - } - - for (qdbm = 0; qdbm < QDBM_TABLE_LEN-1; qdbm++) { - boundary = nqdBm_to_mW_map[qdbm] + (nqdBm_to_mW_map[qdbm+1] - - nqdBm_to_mW_map[qdbm])/2; - if (mw_uint < boundary) break; - } - - qdbm += (uint8)offset; - - return (qdbm); -} - - -uint -bcm_bitcount(uint8 *bitmap, uint length) -{ - uint bitcount = 0, i; - uint8 tmp; - for (i = 0; i < length; i++) { - tmp = bitmap[i]; - while (tmp) { - bitcount++; - tmp &= (tmp - 1); - } - } - return bitcount; -} - -#ifdef BCMDRIVER - -/* Initialization of bcmstrbuf structure */ -void -bcm_binit(struct bcmstrbuf *b, char *buf, uint size) -{ - b->origsize = b->size = size; - b->origbuf = b->buf = buf; -} - -/* Buffer sprintf wrapper to guard against buffer overflow */ -int -bcm_bprintf(struct bcmstrbuf *b, const char *fmt, ...) -{ - va_list ap; - int r; - - va_start(ap, fmt); - r = vsnprintf(b->buf, b->size, fmt, ap); - - /* Non Ansi C99 compliant returns -1, - * Ansi compliant return r >= b->size, - * bcmstdlib returns 0, handle all - */ - if ((r == -1) || (r >= (int)b->size) || (r == 0)) { - b->size = 0; - } else { - b->size -= r; - b->buf += r; - } - - va_end(ap); - - return r; -} - -void -bcm_inc_bytes(uchar *num, int num_bytes, uint8 amount) -{ - int i; - - for (i = 0; i < num_bytes; i++) { - num[i] += amount; - if (num[i] >= amount) - break; - amount = 1; - } -} - -int -bcm_cmp_bytes(uchar *arg1, uchar *arg2, uint8 nbytes) -{ - int i; - - for (i = nbytes - 1; i >= 0; i--) { - if (arg1[i] != arg2[i]) - return (arg1[i] - arg2[i]); - } - return 0; -} - -void -bcm_print_bytes(char *name, const uchar *data, int len) -{ - int i; - int per_line = 0; - - printf("%s: %d \n", name ? name : "", len); - for (i = 0; i < len; i++) { - printf("%02x ", *data++); - per_line++; - if (per_line == 16) { - per_line = 0; - printf("\n"); - } - } - printf("\n"); -} - -/* - * buffer length needed for wlc_format_ssid - * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL. - */ - -#if defined(WLTINYDUMP) || defined(WLMSG_INFORM) || defined(WLMSG_ASSOC) || \ - defined(WLMSG_PRPKT) || defined(WLMSG_WSEC) -int -bcm_format_ssid(char* buf, const uchar ssid[], uint ssid_len) -{ - uint i, c; - char *p = buf; - char *endp = buf + SSID_FMT_BUF_LEN; - - if (ssid_len > DOT11_MAX_SSID_LEN) ssid_len = DOT11_MAX_SSID_LEN; - - for (i = 0; i < ssid_len; i++) { - c = (uint)ssid[i]; - if (c == '\\') { - *p++ = '\\'; - *p++ = '\\'; - } else if (bcm_isprint((uchar)c)) { - *p++ = (char)c; - } else { - p += snprintf(p, (endp - p), "\\x%02X", c); - } - } - *p = '\0'; - ASSERT(p < endp); - - return (int)(p - buf); -} -#endif - -#endif /* BCMDRIVER */ diff --git a/drivers/net/wireless/bcm4319/bcmwifi.c b/drivers/net/wireless/bcm4319/bcmwifi.c deleted file mode 100644 index 803acf842a29..000000000000 --- a/drivers/net/wireless/bcm4319/bcmwifi.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Misc utility routines used by kernel or app-level. - * Contents are wifi-specific, used by any kernel or app-level - * software that might want wifi things as it grows. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * $Id: bcmwifi.c,v 1.18.24.2.4.1 2009/09/25 00:32:01 Exp $ - */ - - -#include - -#ifdef BCMDRIVER -#include -#include -#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base)) -#define tolower(c) (bcm_isupper((c)) ? ((c) + 'a' - 'A') : (c)) -#else -#include -#include -#include -#endif -#include - -#if defined(WIN32) && (defined(BCMDLL) || defined(WLMDLL)) -#include -#endif - - - - - -char * -wf_chspec_ntoa(chanspec_t chspec, char *buf) -{ - const char *band, *bw, *sb; - uint channel; - - band = ""; - bw = ""; - sb = ""; - channel = CHSPEC_CHANNEL(chspec); - - if ((CHSPEC_IS2G(chspec) && channel > CH_MAX_2G_CHANNEL) || - (CHSPEC_IS5G(chspec) && channel <= CH_MAX_2G_CHANNEL)) - band = (CHSPEC_IS2G(chspec)) ? "b" : "a"; - if (CHSPEC_IS40(chspec)) { - if (CHSPEC_SB_UPPER(chspec)) { - sb = "u"; - channel += CH_10MHZ_APART; - } else { - sb = "l"; - channel -= CH_10MHZ_APART; - } - } else if (CHSPEC_IS10(chspec)) { - bw = "n"; - } - - - snprintf(buf, 6, "%d%s%s%s", channel, band, bw, sb); - return (buf); -} - - -chanspec_t -wf_chspec_aton(char *a) -{ - char *endp = NULL; - uint channel, band, bw, ctl_sb; - char c; - - channel = strtoul(a, &endp, 10); - - - if (endp == a) - return 0; - - if (channel > MAXCHANNEL) - return 0; - - band = ((channel <= CH_MAX_2G_CHANNEL) ? WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G); - bw = WL_CHANSPEC_BW_20; - ctl_sb = WL_CHANSPEC_CTL_SB_NONE; - - a = endp; - - c = tolower(a[0]); - if (c == '\0') - goto done; - - - if (c == 'a' || c == 'b') { - band = (c == 'a') ? WL_CHANSPEC_BAND_5G : WL_CHANSPEC_BAND_2G; - a++; - c = tolower(a[0]); - if (c == '\0') - goto done; - } - - - if (c == 'n') { - bw = WL_CHANSPEC_BW_10; - } else if (c == 'l') { - bw = WL_CHANSPEC_BW_40; - ctl_sb = WL_CHANSPEC_CTL_SB_LOWER; - - if (channel <= (MAXCHANNEL - CH_20MHZ_APART)) - channel += CH_10MHZ_APART; - else - return 0; - } else if (c == 'u') { - bw = WL_CHANSPEC_BW_40; - ctl_sb = WL_CHANSPEC_CTL_SB_UPPER; - - if (channel > CH_20MHZ_APART) - channel -= CH_10MHZ_APART; - else - return 0; - } else { - return 0; - } - -done: - return (channel | band | bw | ctl_sb); -} - - -int -wf_mhz2channel(uint freq, uint start_factor) -{ - int ch = -1; - uint base; - int offset; - - - if (start_factor == 0) { - if (freq >= 2400 && freq <= 2500) - start_factor = WF_CHAN_FACTOR_2_4_G; - else if (freq >= 5000 && freq <= 6000) - start_factor = WF_CHAN_FACTOR_5_G; - } - - if (freq == 2484 && start_factor == WF_CHAN_FACTOR_2_4_G) - return 14; - - base = start_factor / 2; - - - if ((freq < base) || (freq > base + 1000)) - return -1; - - offset = freq - base; - ch = offset / 5; - - - if (offset != (ch * 5)) - return -1; - - - if (start_factor == WF_CHAN_FACTOR_2_4_G && (ch < 1 || ch > 13)) - return -1; - - return ch; -} - - -int -wf_channel2mhz(uint ch, uint start_factor) -{ - int freq; - - if ((start_factor == WF_CHAN_FACTOR_2_4_G && (ch < 1 || ch > 14)) || - (ch <= 200)) - freq = -1; - if ((start_factor == WF_CHAN_FACTOR_2_4_G) && (ch == 14)) - freq = 2484; - else - freq = ch * 5 + start_factor / 2; - - return freq; -} diff --git a/drivers/net/wireless/bcm4319/dhd.h b/drivers/net/wireless/bcm4319/dhd.h deleted file mode 100644 index dca30396a4e6..000000000000 --- a/drivers/net/wireless/bcm4319/dhd.h +++ /dev/null @@ -1,438 +0,0 @@ -/* - * Header file describing the internal (inter-module) DHD interfaces. - * - * Provides type definitions and function prototypes used to link the - * DHD OS, bus, and protocol modules. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: dhd.h,v 1.32.4.7.2.4.14.49.4.7 2010/11/12 22:48:36 Exp $ - */ - -/**************** - * Common types * - */ - -#ifndef _dhd_h_ -#define _dhd_h_ - -#if defined(LINUX) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* The kernel threading is sdio-specific */ -#else /* LINUX */ -#define ENOMEM 1 -#define EFAULT 2 -#define EINVAL 3 -#define EIO 4 -#define ETIMEDOUT 5 -#define ERESTARTSYS 6 -#endif /* LINUX */ - -#include - -#ifdef DHD_DEBUG -#ifndef DHD_DEBUG_TRAP -#define DHD_DEBUG_TRAP -#endif -#endif - -/* Forward decls */ -struct dhd_bus; -struct dhd_prot; -struct dhd_info; - -/* The level of bus communication with the dongle */ -enum dhd_bus_state { - DHD_BUS_DOWN, /* Not ready for frame transfers */ - DHD_BUS_LOAD, /* Download access only (CPU reset) */ - DHD_BUS_DATA /* Ready for frame transfers */ -}; - -enum dhd_bus_wake_state { - WAKE_LOCK_OFF, - WAKE_LOCK_PRIV, - WAKE_LOCK_DPC, - WAKE_LOCK_IOCTL, - WAKE_LOCK_DOWNLOAD, - WAKE_LOCK_TMOUT, - WAKE_LOCK_WATCHDOG, - WAKE_LOCK_LINK_DOWN_TMOUT, - WAKE_LOCK_PNO_FIND_TMOUT, - WAKE_LOCK_SOFTAP_SET, - WAKE_LOCK_SOFTAP_STOP, - WAKE_LOCK_SOFTAP_START, - WAKE_LOCK_SOFTAP_THREAD, - WAKE_LOCK_MAX -}; -enum dhd_prealloc_index { - DHD_PREALLOC_PROT = 0, - DHD_PREALLOC_RXBUF, - DHD_PREALLOC_DATABUF, - DHD_PREALLOC_OSL_BUF -}; -#ifdef DHD_USE_STATIC_BUF -extern void * dhd_os_prealloc(int section, unsigned long size); -#endif -/* Common structure for module and instance linkage */ -typedef struct dhd_pub { - /* Linkage ponters */ - osl_t *osh; /* OSL handle */ - struct dhd_bus *bus; /* Bus module handle */ - struct dhd_prot *prot; /* Protocol module handle */ - struct dhd_info *info; /* Info module handle */ - - /* Internal dhd items */ - bool up; /* Driver up/down (to OS) */ - bool txoff; /* Transmit flow-controlled */ - bool dongle_reset; /* TRUE = DEVRESET put dongle into reset */ - enum dhd_bus_state busstate; - uint hdrlen; /* Total DHD header length (proto + bus) */ - uint maxctl; /* Max size rxctl request from proto to bus */ - uint rxsz; /* Rx buffer size bus module should use */ - uint8 wme_dp; /* wme discard priority */ - - /* Dongle media info */ - bool iswl; /* Dongle-resident driver is wl */ - ulong drv_version; /* Version of dongle-resident driver */ - struct ether_addr mac; /* MAC address obtained from dongle */ - dngl_stats_t dstats; /* Stats for dongle-based data */ - - /* Additional stats for the bus level */ - ulong tx_packets; /* Data packets sent to dongle */ - ulong tx_multicast; /* Multicast data packets sent to dongle */ - ulong tx_errors; /* Errors in sending data to dongle */ - ulong tx_ctlpkts; /* Control packets sent to dongle */ - ulong tx_ctlerrs; /* Errors sending control frames to dongle */ - ulong rx_packets; /* Packets sent up the network interface */ - ulong rx_multicast; /* Multicast packets sent up the network interface */ - ulong rx_errors; /* Errors processing rx data packets */ - ulong rx_ctlpkts; /* Control frames processed from dongle */ - ulong rx_ctlerrs; /* Errors in processing rx control frames */ - ulong rx_dropped; /* Packets dropped locally (no memory) */ - ulong rx_flushed; /* Packets flushed due to unscheduled sendup thread */ - ulong wd_dpc_sched; /* Number of times dhd dpc scheduled by watchdog timer */ - - ulong rx_readahead_cnt; /* Number of packets where header read-ahead was used. */ - ulong tx_realloc; /* Number of tx packets we had to realloc for headroom */ - ulong fc_packets; /* Number of flow control pkts recvd */ - - /* Last error return */ - int bcmerror; - uint tickcnt; - - /* Last error from dongle */ - int dongle_error; - - /* Suspend disable flag and "in suspend" flag */ - int suspend_disable_flag; /* "1" to disable all extra powersaving during suspend */ - int in_suspend; /* flag set to 1 when early suspend called */ -#ifdef PNO_SUPPORT - int pno_enable; /* pno status : "1" is pno enable */ -#endif /* PNO_SUPPORT */ - int dtim_skip; /* dtim skip , default 0 means wake each dtim */ - - /* Pkt filter defination */ - char * pktfilter[100]; - int pktfilter_count; - - uint8 country_code[WLC_CNTRY_BUF_SZ]; - char eventmask[WL_EVENTING_MASK_LEN]; - -} dhd_pub_t; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) - - #define DHD_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a); - #define _DHD_PM_RESUME_WAIT(a, b) do { \ - int retry = 0; \ - smp_mb(); \ - while (dhd_mmc_suspend && retry++ != b) { \ - wait_event_interruptible_timeout(a, FALSE, HZ/100); \ - } \ - } while (0) - #define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 30) - #define DHD_PM_RESUME_WAIT_FOREVER(a) _DHD_PM_RESUME_WAIT(a, ~0) - #define DHD_PM_RESUME_RETURN_ERROR(a) do { if (dhd_mmc_suspend) return a; } while (0) - #define DHD_PM_RESUME_RETURN do { if (dhd_mmc_suspend) return; } while (0) - - #define DHD_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a); - #define SPINWAIT_SLEEP(a, exp, us) do { \ - uint countdown = (us) + 9999; \ - while ((exp) && (countdown >= 10000)) { \ - wait_event_interruptible_timeout(a, FALSE, HZ/100); \ - countdown -= 10000; \ - } \ - } while (0) - -#else - - #define DHD_PM_RESUME_WAIT_INIT(a) - #define DHD_PM_RESUME_WAIT(a) - #define DHD_PM_RESUME_WAIT_FOREVER(a) - #define DHD_PM_RESUME_RETURN_ERROR(a) - #define DHD_PM_RESUME_RETURN - - #define DHD_SPINWAIT_SLEEP_INIT(a) - #define SPINWAIT_SLEEP(a, exp, us) do { \ - uint countdown = (us) + 9; \ - while ((exp) && (countdown >= 10)) { \ - OSL_DELAY(10); \ - countdown -= 10; \ - } \ - } while (0) - -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */ - -#define DHD_IF_VIF 0x01 /* Virtual IF (Hidden from user) */ - -/* Wakelock Functions */ -extern int dhd_os_wake_lock(dhd_pub_t *pub); -extern int dhd_os_wake_unlock(dhd_pub_t *pub); -extern int dhd_os_wake_lock_timeout(dhd_pub_t *pub); -extern int dhd_os_wake_lock_timeout_enable(dhd_pub_t *pub); - -extern void dhd_os_start_lock(dhd_pub_t *pub); -extern void dhd_os_start_unlock(dhd_pub_t *pub); -extern unsigned long dhd_os_spin_lock(dhd_pub_t *pub); -extern void dhd_os_spin_unlock(dhd_pub_t *pub, unsigned long flags); - -typedef struct dhd_if_event { - uint8 ifidx; - uint8 action; - uint8 flags; - uint8 bssidx; -} dhd_if_event_t; - -/* - * Exported from dhd OS modules (dhd_linux/dhd_ndis) - */ - -/* To allow osl_attach/detach calls from os-independent modules */ -osl_t *dhd_osl_attach(void *pdev, uint bustype); -void dhd_osl_detach(osl_t *osh); - -/* Indication from bus module regarding presence/insertion of dongle. - * Return dhd_pub_t pointer, used as handle to OS module in later calls. - * Returned structure should have bus and prot pointers filled in. - * bus_hdrlen specifies required headroom for bus module header. - */ -extern dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen); -extern int dhd_net_attach(dhd_pub_t *dhdp, int idx); - -/* Indication from bus module regarding removal/absence of dongle */ -extern void dhd_detach(dhd_pub_t *dhdp); - -/* Indication from bus module to change flow-control state */ -extern void dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool on); - -extern bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, void *pkt, int prec); - -/* Receive frame for delivery to OS. Callee disposes of rxp. */ -extern void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *rxp, int numpkt); - -/* Return pointer to interface name */ -extern char *dhd_ifname(dhd_pub_t *dhdp, int idx); - -/* Request scheduling of the bus dpc */ -extern void dhd_sched_dpc(dhd_pub_t *dhdp); - -/* Notify tx completion */ -extern void dhd_txcomplete(dhd_pub_t *dhdp, void *txp, bool success); - -/* Query ioctl */ -extern int dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len); - -/* OS independent layer functions */ -extern int dhd_os_proto_block(dhd_pub_t * pub); -extern int dhd_os_proto_unblock(dhd_pub_t * pub); -extern int dhd_os_ioctl_resp_wait(dhd_pub_t * pub, uint * condition, bool * pending); -extern int dhd_os_ioctl_resp_wake(dhd_pub_t * pub); -extern unsigned int dhd_os_get_ioctl_resp_timeout(void); -extern void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec); -extern void * dhd_os_open_image(char * filename); -extern int dhd_os_get_image_block(char * buf, int len, void * image); -extern void dhd_os_close_image(void * image); -extern void dhd_os_wd_timer(void *bus, uint wdtick); -extern void dhd_os_sdlock(dhd_pub_t * pub); -extern void dhd_os_sdunlock(dhd_pub_t * pub); -extern void dhd_os_sdlock_txq(dhd_pub_t * pub); -extern void dhd_os_sdunlock_txq(dhd_pub_t * pub); -extern void dhd_os_sdlock_rxq(dhd_pub_t * pub); -extern void dhd_os_sdunlock_rxq(dhd_pub_t * pub); -extern void dhd_os_sdlock_sndup_rxq(dhd_pub_t * pub); -extern void dhd_customer_gpio_wlan_ctrl(int onoff); -extern int dhd_custom_get_mac_address(unsigned char *buf); -extern void dhd_os_sdunlock_sndup_rxq(dhd_pub_t * pub); -extern void dhd_os_sdlock_eventq(dhd_pub_t * pub); -extern void dhd_os_sdunlock_eventq(dhd_pub_t * pub); -#ifdef DHD_DEBUG -extern int write_to_file(dhd_pub_t *dhd, uint8 *buf, int size); -#endif /* DHD_DEBUG */ -#if defined(OOB_INTR_ONLY) -extern int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr); -#endif /* defined(OOB_INTR_ONLY) */ -extern void dhd_os_sdtxlock(dhd_pub_t * pub); -extern void dhd_os_sdtxunlock(dhd_pub_t * pub); - -int setScheduler(struct task_struct *p, int policy, struct sched_param *param); - -typedef struct { - uint32 limit; /* Expiration time (usec) */ - uint32 increment; /* Current expiration increment (usec) */ - uint32 elapsed; /* Current elapsed time (usec) */ - uint32 tick; /* O/S tick time (usec) */ -} dhd_timeout_t; - -extern void dhd_timeout_start(dhd_timeout_t *tmo, uint usec); -extern int dhd_timeout_expired(dhd_timeout_t *tmo); - -extern int dhd_ifname2idx(struct dhd_info *dhd, char *name); -extern uint8 *dhd_bssidx2bssid(dhd_pub_t *dhd, int idx); -extern int wl_host_event(struct dhd_info *dhd, int *idx, void *pktdata, - wl_event_msg_t *, void **data_ptr); -extern void wl_event_to_host_order(wl_event_msg_t * evt); - -extern void dhd_common_init(void); - -extern int dhd_add_if(struct dhd_info *dhd, int ifidx, void *handle, - char *name, uint8 *mac_addr, uint32 flags, uint8 bssidx); -extern void dhd_del_if(struct dhd_info *dhd, int ifidx); - -extern void dhd_vif_add(struct dhd_info *dhd, int ifidx, char * name); -extern void dhd_vif_del(struct dhd_info *dhd, int ifidx); - -extern void dhd_event(struct dhd_info *dhd, char *evpkt, int evlen, int ifidx); -extern void dhd_vif_sendup(struct dhd_info *dhd, int ifidx, uchar *cp, int len); - - -/* Send packet to dongle via data channel */ -extern int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, void *pkt); - -/* Send event to host */ -extern void dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data); -extern int dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag); -extern uint dhd_bus_status(dhd_pub_t *dhdp); -extern int dhd_bus_start(dhd_pub_t *dhdp); - -extern void print_buf(void *pbuf, int len, int bytes_per_line); - - -typedef enum cust_gpio_modes { - WLAN_RESET_ON, - WLAN_RESET_OFF, - WLAN_POWER_ON, - WLAN_POWER_OFF -} cust_gpio_modes_t; - -extern int wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag); -extern int wl_iw_send_priv_event(struct net_device *dev, char *flag); -extern int net_os_send_hang_message(struct net_device *dev); - -/* - * Insmod parameters for debug/test - */ - -/* Watchdog timer interval */ -extern uint dhd_watchdog_ms; - -#if defined(DHD_DEBUG) -/* Console output poll interval */ -extern uint dhd_console_ms; -#endif /* defined(DHD_DEBUG) */ - -/* Use interrupts */ -extern uint dhd_intr; - -/* Use polling */ -extern uint dhd_poll; - -/* ARP offload agent mode */ -extern uint dhd_arp_mode; - -/* ARP offload enable */ -extern uint dhd_arp_enable; - -/* Pkt filte enable control */ -extern uint dhd_pkt_filter_enable; - -/* Pkt filter init setup */ -extern uint dhd_pkt_filter_init; - -/* Pkt filter mode control */ -extern uint dhd_master_mode; - -/* Roaming mode control */ -extern uint dhd_roam; - -/* Roaming mode control */ -extern uint dhd_radio_up; - -/* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */ -extern int dhd_idletime; -#define DHD_IDLETIME_TICKS 1 - -/* SDIO Drive Strength */ -extern uint dhd_sdiod_drive_strength; - -/* Override to force tx queueing all the time */ -extern uint dhd_force_tx_queueing; - -/* Default KEEP_ALIVE Period is 55 sec to prevent AP from sending Keep Alive probe frame */ -#define KEEP_ALIVE_PERIOD 55000 -#define NULL_PKT_STR "null_pkt" - -#ifdef SDTEST -/* Echo packet generator (SDIO), pkts/s */ -extern uint dhd_pktgen; - -/* Echo packet len (0 => sawtooth, max 1800) */ -extern uint dhd_pktgen_len; -#define MAX_PKTGEN_LEN 1800 -#endif - - -/* optionally set by a module_param_string() */ -#define MOD_PARAM_PATHLEN 2048 -extern char fw_path[MOD_PARAM_PATHLEN]; -extern char nv_path[MOD_PARAM_PATHLEN]; - -/* For supporting multiple interfaces */ -#define DHD_MAX_IFS 16 -#define DHD_DEL_IF -0xe -#define DHD_BAD_IF -0xf - - -extern void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar); -extern void dhd_wait_event_wakeup(dhd_pub_t*dhd); - -#endif /* _dhd_h_ */ diff --git a/drivers/net/wireless/bcm4319/dhd_bus.h b/drivers/net/wireless/bcm4319/dhd_bus.h deleted file mode 100644 index 97af41b313d0..000000000000 --- a/drivers/net/wireless/bcm4319/dhd_bus.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Header file describing the internal (inter-module) DHD interfaces. - * - * Provides type definitions and function prototypes used to link the - * DHD OS, bus, and protocol modules. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: dhd_bus.h,v 1.4.6.3.2.3.6.7 2010/08/13 01:35:24 Exp $ - */ - -#ifndef _dhd_bus_h_ -#define _dhd_bus_h_ - -/* - * Exported from dhd bus module (dhd_usb, dhd_sdio) - */ - -/* Indicate (dis)interest in finding dongles. */ -extern int dhd_bus_register(void); -extern void dhd_bus_unregister(void); - -/* Download firmware image and nvram image */ -extern bool dhd_bus_download_firmware(struct dhd_bus *bus, osl_t *osh, - char *fw_path, char *nv_path); - -/* Stop bus module: clear pending frames, disable data flow */ -extern void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex); - -/* Initialize bus module: prepare for communication w/dongle */ -extern int dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex); - -/* Send a data frame to the dongle. Callee disposes of txp. */ -extern int dhd_bus_txdata(struct dhd_bus *bus, void *txp); - -/* Send/receive a control message to/from the dongle. - * Expects caller to enforce a single outstanding transaction. - */ -extern int dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen); -extern int dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen); - -/* Watchdog timer function */ -extern bool dhd_bus_watchdog(dhd_pub_t *dhd); - -#ifdef DHD_DEBUG -/* Device console input function */ -extern int dhd_bus_console_in(dhd_pub_t *dhd, uchar *msg, uint msglen); -#endif /* DHD_DEBUG */ - -/* Deferred processing for the bus, return TRUE requests reschedule */ -extern bool dhd_bus_dpc(struct dhd_bus *bus); -extern void dhd_bus_isr(bool * InterruptRecognized, bool * QueueMiniportHandleInterrupt, void *arg); - - -/* Check for and handle local prot-specific iovar commands */ -extern int dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name, - void *params, int plen, void *arg, int len, bool set); - -/* Add bus dump output to a buffer */ -extern void dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf); - -/* Clear any bus counters */ -extern void dhd_bus_clearcounts(dhd_pub_t *dhdp); - -/* return the dongle chipid */ -extern uint dhd_bus_chip(struct dhd_bus *bus); - -/* Set user-specified nvram parameters. */ -extern void dhd_bus_set_nvram_params(struct dhd_bus * bus, const char *nvram_params); - -extern void *dhd_bus_pub(struct dhd_bus *bus); -extern void *dhd_bus_txq(struct dhd_bus *bus); -extern uint dhd_bus_hdrlen(struct dhd_bus *bus); - -#endif /* _dhd_bus_h_ */ diff --git a/drivers/net/wireless/bcm4319/dhd_cdc.c b/drivers/net/wireless/bcm4319/dhd_cdc.c deleted file mode 100644 index a68ad61c58b4..000000000000 --- a/drivers/net/wireless/bcm4319/dhd_cdc.c +++ /dev/null @@ -1,525 +0,0 @@ -/* - * DHD Protocol Module for CDC and BDC. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: dhd_cdc.c,v 1.22.4.2.4.7.2.41 2010/06/23 19:58:18 Exp $ - * - * BDC is like CDC, except it includes a header for data packets to convey - * packet priority over the bus, and flags (e.g. to indicate checksum status - * for dongle offload). - */ - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -uint8 wlan_mac_addr[ETHER_ADDR_LEN]; - -extern int dhd_preinit_ioctls(dhd_pub_t *dhd); - -/* Packet alignment for most efficient SDIO (can change based on platform) */ -#ifndef DHD_SDALIGN -#define DHD_SDALIGN 32 -#endif -#if !ISPOWEROF2(DHD_SDALIGN) -#error DHD_SDALIGN is not a power of 2! -#endif - -#define RETRIES 2 /* # of retries to retrieve matching ioctl response */ -#define BUS_HEADER_LEN (16+DHD_SDALIGN) /* Must be atleast SDPCM_RESERVE - * defined in dhd_sdio.c (amount of header tha might be added) - * plus any space that might be needed for alignment padding. - */ -#define ROUND_UP_MARGIN 2048 /* Biggest SDIO block size possible for - * round off at the end of buffer - */ - -typedef struct dhd_prot { - uint16 reqid; - uint8 pending; - uint32 lastcmd; - uint8 bus_header[BUS_HEADER_LEN]; - cdc_ioctl_t msg; - unsigned char buf[WLC_IOCTL_MAXLEN + ROUND_UP_MARGIN]; -} dhd_prot_t; - -static int -dhdcdc_msg(dhd_pub_t *dhd) -{ - dhd_prot_t *prot = dhd->prot; - int len = ltoh32(prot->msg.len) + sizeof(cdc_ioctl_t); - int ret; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - dhd_os_wake_lock(dhd); - - /* NOTE : cdc->msg.len holds the desired length of the buffer to be - * returned. Only up to CDC_MAX_MSG_SIZE of this buffer area - * is actually sent to the dongle - */ - if (len > CDC_MAX_MSG_SIZE) - len = CDC_MAX_MSG_SIZE; - - /* Send request */ - ret = dhd_bus_txctl(dhd->bus, (uchar*)&prot->msg, len); - dhd_os_wake_unlock(dhd); - return ret; -} - -static int -dhdcdc_cmplt(dhd_pub_t *dhd, uint32 id, uint32 len) -{ - int ret; - dhd_prot_t *prot = dhd->prot; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - do { - ret = dhd_bus_rxctl(dhd->bus, (uchar*)&prot->msg, len+sizeof(cdc_ioctl_t)); - if (ret < 0) - break; - } while (CDC_IOC_ID(ltoh32(prot->msg.flags)) != id); - - return ret; -} - -int -dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len) -{ - dhd_prot_t *prot = dhd->prot; - cdc_ioctl_t *msg = &prot->msg; - void *info; - int ret = 0, retries = 0; - uint32 id, flags = 0; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - DHD_CTL(("%s: cmd %d len %d\n", __FUNCTION__, cmd, len)); - - - /* Respond "bcmerror" and "bcmerrorstr" with local cache */ - if (cmd == WLC_GET_VAR && buf) - { - if (!strcmp((char *)buf, "bcmerrorstr")) - { - strncpy((char *)buf, bcmerrorstr(dhd->dongle_error), BCME_STRLEN); - goto done; - } - else if (!strcmp((char *)buf, "bcmerror")) - { - *(int *)buf = dhd->dongle_error; - goto done; - } - } - - memset(msg, 0, sizeof(cdc_ioctl_t)); - - msg->cmd = htol32(cmd); - msg->len = htol32(len); - msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT); - CDC_SET_IF_IDX(msg, ifidx); - msg->flags = htol32(msg->flags); - - if (buf) - memcpy(prot->buf, buf, len); - - if ((ret = dhdcdc_msg(dhd)) < 0) { - DHD_ERROR(("dhdcdc_query_ioctl: dhdcdc_msg failed w/status %d\n", ret)); - goto done; - } - -retry: - /* wait for interrupt and get first fragment */ - if ((ret = dhdcdc_cmplt(dhd, prot->reqid, len)) < 0) - goto done; - - flags = ltoh32(msg->flags); - id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT; - - if ((id < prot->reqid) && (++retries < RETRIES)) - goto retry; - if (id != prot->reqid) { - DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n", - dhd_ifname(dhd, ifidx), __FUNCTION__, id, prot->reqid)); - ret = -EINVAL; - goto done; - } - - /* Check info buffer */ - info = (void*)&msg[1]; - - /* Copy info buffer */ - if (buf) - { - if (ret < (int)len) - len = ret; - memcpy(buf, info, len); - } - - /* Check the ERROR flag */ - if (flags & CDCF_IOC_ERROR) - { - ret = ltoh32(msg->status); - /* Cache error from dongle */ - dhd->dongle_error = ret; - } - -done: - return ret; -} - -int -dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len) -{ - dhd_prot_t *prot = dhd->prot; - cdc_ioctl_t *msg = &prot->msg; - int ret = 0; - uint32 flags, id; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - DHD_CTL(("%s: cmd %d len %d\n", __FUNCTION__, cmd, len)); - - memset(msg, 0, sizeof(cdc_ioctl_t)); - - msg->cmd = htol32(cmd); - msg->len = htol32(len); - msg->flags = (++prot->reqid << CDCF_IOC_ID_SHIFT) | CDCF_IOC_SET; - CDC_SET_IF_IDX(msg, ifidx); - msg->flags = htol32(msg->flags); - - if (buf) - memcpy(prot->buf, buf, len); - - if ((ret = dhdcdc_msg(dhd)) < 0) - goto done; - - if ((ret = dhdcdc_cmplt(dhd, prot->reqid, len)) < 0) - goto done; - - flags = ltoh32(msg->flags); - id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT; - - if (id != prot->reqid) { - DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n", - dhd_ifname(dhd, ifidx), __FUNCTION__, id, prot->reqid)); - ret = -EINVAL; - goto done; - } - - /* Check the ERROR flag */ - if (flags & CDCF_IOC_ERROR) - { - ret = ltoh32(msg->status); - /* Cache error from dongle */ - dhd->dongle_error = ret; - } - -done: - return ret; -} - -extern int dhd_bus_interface(struct dhd_bus *bus, uint arg, void* arg2); -int -dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t * ioc, void * buf, int len) -{ - dhd_prot_t *prot = dhd->prot; - int ret = -1; - - if (dhd->busstate == DHD_BUS_DOWN) { - DHD_ERROR(("%s : bus is down. we have nothing to do\n", __FUNCTION__)); - return ret; - } - dhd_os_proto_block(dhd); - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - ASSERT(len <= WLC_IOCTL_MAXLEN); - - if (len > WLC_IOCTL_MAXLEN) - goto done; - - if (prot->pending == TRUE) { - DHD_TRACE(("CDC packet is pending!!!! cmd=0x%x (%lu) lastcmd=0x%x (%lu)\n", - ioc->cmd, (unsigned long)ioc->cmd, prot->lastcmd, - (unsigned long)prot->lastcmd)); - if ((ioc->cmd == WLC_SET_VAR) || (ioc->cmd == WLC_GET_VAR)) { - DHD_TRACE(("iovar cmd=%s\n", (char*)buf)); - } - goto done; - } - - prot->pending = TRUE; - prot->lastcmd = ioc->cmd; - if (ioc->set) - ret = dhdcdc_set_ioctl(dhd, ifidx, ioc->cmd, buf, len); - else { - ret = dhdcdc_query_ioctl(dhd, ifidx, ioc->cmd, buf, len); - if (ret > 0) - ioc->used = ret - sizeof(cdc_ioctl_t); - } - - /* Too many programs assume ioctl() returns 0 on success */ - if (ret >= 0) - ret = 0; - else { - cdc_ioctl_t *msg = &prot->msg; - ioc->needed = ltoh32(msg->len); /* len == needed when set/query fails from dongle */ - } - - /* Intercept the wme_dp ioctl here */ - if ((!ret) && (ioc->cmd == WLC_SET_VAR) && (!strcmp(buf, "wme_dp"))) { - int slen, val = 0; - - slen = strlen("wme_dp") + 1; - if (len >= (int)(slen + sizeof(int))) - bcopy(((char *)buf + slen), &val, sizeof(int)); - dhd->wme_dp = (uint8) ltoh32(val); - } - - prot->pending = FALSE; - -done: - dhd_os_proto_unblock(dhd); - - return ret; -} - -int -dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name, - void *params, int plen, void *arg, int len, bool set) -{ - return BCME_UNSUPPORTED; -} - -void -dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf) -{ - bcm_bprintf(strbuf, "Protocol CDC: reqid %d\n", dhdp->prot->reqid); -} - - -void -dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, void *pktbuf) -{ -#ifdef BDC - struct bdc_header *h; -#endif /* BDC */ - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - -#ifdef BDC - /* Push BDC header used to convey priority for buses that don't */ - - - PKTPUSH(dhd->osh, pktbuf, BDC_HEADER_LEN); - - h = (struct bdc_header *)PKTDATA(dhd->osh, pktbuf); - - h->flags = (BDC_PROTO_VER << BDC_FLAG_VER_SHIFT); - if (PKTSUMNEEDED(pktbuf)) - h->flags |= BDC_FLAG_SUM_NEEDED; - - - h->priority = (PKTPRIO(pktbuf) & BDC_PRIORITY_MASK); - h->flags2 = 0; - h->rssi = 0; -#endif /* BDC */ - BDC_SET_IF_IDX(h, ifidx); -} - - -bool -dhd_proto_fcinfo(dhd_pub_t *dhd, void *pktbuf, uint8 *fcbits) -{ -#ifdef BDC - struct bdc_header *h; - - if (PKTLEN(dhd->osh, pktbuf) < BDC_HEADER_LEN) { - DHD_ERROR(("%s: rx data too short (%d < %d)\n", - __FUNCTION__, PKTLEN(dhd->osh, pktbuf), BDC_HEADER_LEN)); - return BCME_ERROR; - } - - h = (struct bdc_header *)PKTDATA(dhd->osh, pktbuf); - - *fcbits = h->priority >> BDC_PRIORITY_FC_SHIFT; - if ((h->flags2 & BDC_FLAG2_FC_FLAG) == BDC_FLAG2_FC_FLAG) - return TRUE; -#endif - return FALSE; -} - - -int -dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, void *pktbuf) -{ -#ifdef BDC - struct bdc_header *h; -#endif - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - -#ifdef BDC - /* Pop BDC header used to convey priority for buses that don't */ - - if (PKTLEN(dhd->osh, pktbuf) < BDC_HEADER_LEN) { - DHD_ERROR(("%s: rx data too short (%d < %d)\n", __FUNCTION__, - PKTLEN(dhd->osh, pktbuf), BDC_HEADER_LEN)); - return BCME_ERROR; - } - - h = (struct bdc_header *)PKTDATA(dhd->osh, pktbuf); - - if ((*ifidx = BDC_GET_IF_IDX(h)) >= DHD_MAX_IFS) { - DHD_ERROR(("%s: rx data ifnum out of range (%d)\n", - __FUNCTION__, *ifidx)); - return BCME_ERROR; - } - - if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) != BDC_PROTO_VER) { - DHD_ERROR(("%s: non-BDC packet received, flags 0x%x\n", - dhd_ifname(dhd, *ifidx), h->flags)); - return BCME_ERROR; - } - - if (h->flags & BDC_FLAG_SUM_GOOD) { - DHD_INFO(("%s: BDC packet received with good rx-csum, flags 0x%x\n", - dhd_ifname(dhd, *ifidx), h->flags)); - PKTSETSUMGOOD(pktbuf, TRUE); - } - - PKTSETPRIO(pktbuf, (h->priority & BDC_PRIORITY_MASK)); - - PKTPULL(dhd->osh, pktbuf, BDC_HEADER_LEN); -#endif /* BDC */ - - return 0; -} - -int -dhd_prot_attach(dhd_pub_t *dhd) -{ - dhd_prot_t *cdc; - -#ifndef DHD_USE_STATIC_BUF - if (!(cdc = (dhd_prot_t *)MALLOC(dhd->osh, sizeof(dhd_prot_t)))) { - DHD_ERROR(("%s: kmalloc failed\n", __FUNCTION__)); - goto fail; - } -#else - if (!(cdc = (dhd_prot_t *)dhd_os_prealloc(DHD_PREALLOC_PROT, sizeof(dhd_prot_t)))) { - DHD_ERROR(("%s: kmalloc failed\n", __FUNCTION__)); - goto fail; - } -#endif /* DHD_USE_STATIC_BUF */ - memset(cdc, 0, sizeof(dhd_prot_t)); - - /* ensure that the msg buf directly follows the cdc msg struct */ - if ((uintptr)(&cdc->msg + 1) != (uintptr)cdc->buf) { - DHD_ERROR(("dhd_prot_t is not correctly defined\n")); - goto fail; - } - - dhd->prot = cdc; -#ifdef BDC - dhd->hdrlen += BDC_HEADER_LEN; -#endif - dhd->maxctl = WLC_IOCTL_MAXLEN + sizeof(cdc_ioctl_t) + ROUND_UP_MARGIN; - return 0; - -fail: -#ifndef DHD_USE_STATIC_BUF - if (cdc != NULL) - MFREE(dhd->osh, cdc, sizeof(dhd_prot_t)); -#endif - return BCME_NOMEM; -} - -/* ~NOTE~ What if another thread is waiting on the semaphore? Holding it? */ -void -dhd_prot_detach(dhd_pub_t *dhd) -{ -#ifndef DHD_USE_STATIC_BUF - MFREE(dhd->osh, dhd->prot, sizeof(dhd_prot_t)); -#endif - dhd->prot = NULL; -} - -void -dhd_prot_dstats(dhd_pub_t *dhd) -{ - /* No stats from dongle added yet, copy bus stats */ - dhd->dstats.tx_packets = dhd->tx_packets; - dhd->dstats.tx_errors = dhd->tx_errors; - dhd->dstats.rx_packets = dhd->rx_packets; - dhd->dstats.rx_errors = dhd->rx_errors; - dhd->dstats.rx_dropped = dhd->rx_dropped; - dhd->dstats.multicast = dhd->rx_multicast; - return; -} - -int -dhd_prot_init(dhd_pub_t *dhd) -{ - int ret = 0; - char buf[128]; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - dhd_os_proto_block(dhd); - - /* Get the device MAC address */ - strcpy(buf, "cur_etheraddr"); - ret = dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, buf, sizeof(buf)); - if (ret < 0) { - dhd_os_proto_unblock(dhd); - return ret; - } - memcpy(dhd->mac.octet, buf, ETHER_ADDR_LEN); - memcpy(wlan_mac_addr, buf, ETHER_ADDR_LEN); - - dhd_os_proto_unblock(dhd); - -#ifdef EMBEDDED_PLATFORM - ret = dhd_preinit_ioctls(dhd); -#endif /* EMBEDDED_PLATFORM */ - - /* Always assumes wl for now */ - dhd->iswl = TRUE; - - return ret; -} - -void -dhd_prot_stop(dhd_pub_t *dhd) -{ - /* Nothing to do for CDC */ -} diff --git a/drivers/net/wireless/bcm4319/dhd_common.c b/drivers/net/wireless/bcm4319/dhd_common.c deleted file mode 100644 index 946ff3f8166b..000000000000 --- a/drivers/net/wireless/bcm4319/dhd_common.c +++ /dev/null @@ -1,2331 +0,0 @@ -/* - * Broadcom Dongle Host Driver (DHD), common DHD core. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: dhd_common.c,v 1.5.6.8.2.6.6.69.4.20 2010/12/20 23:37:28 Exp $ - */ -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#define CONFIG_BCM4319_FW_PATH "/system/etc/firmware/fw_bcm4319.bin" -#define CONFIG_BCM4319_NVRAM_PATH "/system/etc/firmware/nvram.txt" - -#ifdef SET_RANDOM_MAC_SOFTAP -#include -#include -#endif - -#ifdef GET_CUSTOM_MAC_ENABLE -int wifi_get_mac_addr(unsigned char *buf); -#endif /* GET_CUSTOM_MAC_ENABLE */ - -int dhd_msg_level; - -#include - -char fw_path[MOD_PARAM_PATHLEN]; -char nv_path[MOD_PARAM_PATHLEN]; - -/* Last connection success/failure status */ -uint32 dhd_conn_event; -uint32 dhd_conn_status; -uint32 dhd_conn_reason; - -#define htod32(i) i -#define htod16(i) i -#define dtoh32(i) i -#define dtoh16(i) i - -extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len); -extern void dhd_ind_scan_confirm(void *h, bool status); -extern int dhd_wl_ioctl(dhd_pub_t *dhd, uint cmd, char *buf, uint buflen); -void dhd_iscan_lock(void); -void dhd_iscan_unlock(void); - -#if defined(SOFTAP) -extern bool ap_fw_loaded; -#endif -#if defined(KEEP_ALIVE) -int dhd_keep_alive_onoff(dhd_pub_t *dhd, int ka_on); -#endif /* KEEP_ALIVE */ - -/* Packet alignment for most efficient SDIO (can change based on platform) */ -#ifndef DHD_SDALIGN -#define DHD_SDALIGN 32 -#endif -#if !ISPOWEROF2(DHD_SDALIGN) -#error DHD_SDALIGN is not a power of 2! -#endif - -#ifdef DHD_DEBUG -const char dhd_version[] = "Dongle Host Driver, version " EPI_VERSION_STR "\nCompiled on " - __DATE__ " at " __TIME__; -#else -const char dhd_version[] = "Dongle Host Driver, version " EPI_VERSION_STR; -#endif - -void dhd_set_timer(void *bus, uint wdtick); - -/* IOVar table */ -enum { - IOV_VERSION = 1, - IOV_MSGLEVEL, - IOV_BCMERRORSTR, - IOV_BCMERROR, - IOV_WDTICK, - IOV_DUMP, -#ifdef DHD_DEBUG - IOV_CONS, - IOV_DCONSOLE_POLL, -#endif - IOV_CLEARCOUNTS, - IOV_LOGDUMP, - IOV_LOGCAL, - IOV_LOGSTAMP, - IOV_GPIOOB, - IOV_IOCTLTIMEOUT, - IOV_LAST -}; - -const bcm_iovar_t dhd_iovars[] = { - {"version", IOV_VERSION, 0, IOVT_BUFFER, sizeof(dhd_version) }, -#ifdef DHD_DEBUG - {"msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0 }, -#endif /* DHD_DEBUG */ - {"bcmerrorstr", IOV_BCMERRORSTR, 0, IOVT_BUFFER, BCME_STRLEN }, - {"bcmerror", IOV_BCMERROR, 0, IOVT_INT8, 0 }, - {"wdtick", IOV_WDTICK, 0, IOVT_UINT32, 0 }, - {"dump", IOV_DUMP, 0, IOVT_BUFFER, DHD_IOCTL_MAXLEN }, -#ifdef DHD_DEBUG - {"dconpoll", IOV_DCONSOLE_POLL, 0, IOVT_UINT32, 0 }, - {"cons", IOV_CONS, 0, IOVT_BUFFER, 0 }, -#endif - {"clearcounts", IOV_CLEARCOUNTS, 0, IOVT_VOID, 0 }, - {"gpioob", IOV_GPIOOB, 0, IOVT_UINT32, 0 }, - {"ioctl_timeout", IOV_IOCTLTIMEOUT, 0, IOVT_UINT32, 0 }, - {NULL, 0, 0, 0, 0 } -}; - -void -dhd_common_init(void) -{ - /* Init global variables at run-time, not as part of the declaration. - * This is required to support init/de-init of the driver. Initialization - * of globals as part of the declaration results in non-deterministic - * behaviour since the value of the globals may be different on the - * first time that the driver is initialized vs subsequent initializations. - */ - dhd_msg_level = DHD_ERROR_VAL; -#ifdef CONFIG_BCM4319_FW_PATH - strncpy(fw_path, CONFIG_BCM4319_FW_PATH, MOD_PARAM_PATHLEN-1); -#else - fw_path[0] = '\0'; -#endif -#ifdef CONFIG_BCM4319_NVRAM_PATH - strncpy(nv_path, CONFIG_BCM4319_NVRAM_PATH, MOD_PARAM_PATHLEN-1); -#else - nv_path[0] = '\0'; -#endif -} - -static int -dhd_dump(dhd_pub_t *dhdp, char *buf, int buflen) -{ - char eabuf[ETHER_ADDR_STR_LEN]; - - struct bcmstrbuf b; - struct bcmstrbuf *strbuf = &b; - - bcm_binit(strbuf, buf, buflen); - - /* Base DHD info */ - bcm_bprintf(strbuf, "%s\n", dhd_version); - bcm_bprintf(strbuf, "\n"); - bcm_bprintf(strbuf, "pub.up %d pub.txoff %d pub.busstate %d\n", - dhdp->up, dhdp->txoff, dhdp->busstate); - bcm_bprintf(strbuf, "pub.hdrlen %d pub.maxctl %d pub.rxsz %d\n", - dhdp->hdrlen, dhdp->maxctl, dhdp->rxsz); - bcm_bprintf(strbuf, "pub.iswl %d pub.drv_version %ld pub.mac %s\n", - dhdp->iswl, dhdp->drv_version, bcm_ether_ntoa(&dhdp->mac, eabuf)); - bcm_bprintf(strbuf, "pub.bcmerror %d tickcnt %d\n", dhdp->bcmerror, dhdp->tickcnt); - - bcm_bprintf(strbuf, "dongle stats:\n"); - bcm_bprintf(strbuf, "tx_packets %ld tx_bytes %ld tx_errors %ld tx_dropped %ld\n", - dhdp->dstats.tx_packets, dhdp->dstats.tx_bytes, - dhdp->dstats.tx_errors, dhdp->dstats.tx_dropped); - bcm_bprintf(strbuf, "rx_packets %ld rx_bytes %ld rx_errors %ld rx_dropped %ld\n", - dhdp->dstats.rx_packets, dhdp->dstats.rx_bytes, - dhdp->dstats.rx_errors, dhdp->dstats.rx_dropped); - bcm_bprintf(strbuf, "multicast %ld\n", dhdp->dstats.multicast); - - bcm_bprintf(strbuf, "bus stats:\n"); - bcm_bprintf(strbuf, "tx_packets %ld tx_multicast %ld tx_errors %ld\n", - dhdp->tx_packets, dhdp->tx_multicast, dhdp->tx_errors); - bcm_bprintf(strbuf, "tx_ctlpkts %ld tx_ctlerrs %ld\n", - dhdp->tx_ctlpkts, dhdp->tx_ctlerrs); - bcm_bprintf(strbuf, "rx_packets %ld rx_multicast %ld rx_errors %ld \n", - dhdp->rx_packets, dhdp->rx_multicast, dhdp->rx_errors); - bcm_bprintf(strbuf, "rx_ctlpkts %ld rx_ctlerrs %ld rx_dropped %ld rx_flushed %ld\n", - dhdp->rx_ctlpkts, dhdp->rx_ctlerrs, dhdp->rx_dropped, dhdp->rx_flushed); - bcm_bprintf(strbuf, "rx_readahead_cnt %ld tx_realloc %ld fc_packets %ld\n", - dhdp->rx_readahead_cnt, dhdp->tx_realloc, dhdp->fc_packets); - bcm_bprintf(strbuf, "wd_dpc_sched %ld\n", dhdp->wd_dpc_sched); - bcm_bprintf(strbuf, "\n"); - - /* Add any prot info */ - dhd_prot_dump(dhdp, strbuf); - bcm_bprintf(strbuf, "\n"); - - /* Add any bus info */ - dhd_bus_dump(dhdp, strbuf); - - return (!strbuf->size ? BCME_BUFTOOSHORT : 0); -} - -static int -dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, uint32 actionid, const char *name, - void *params, int plen, void *arg, int len, int val_size) -{ - int bcmerror = 0; - int32 int_val = 0; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - if ((bcmerror = bcm_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid))) != 0) - goto exit; - - if (plen >= (int)sizeof(int_val)) - bcopy(params, &int_val, sizeof(int_val)); - - switch (actionid) { - case IOV_GVAL(IOV_VERSION): - /* Need to have checked buffer length */ - strncpy((char*)arg, dhd_version, len); - break; - - case IOV_GVAL(IOV_MSGLEVEL): - int_val = (int32)dhd_msg_level; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_MSGLEVEL): - dhd_msg_level = int_val; - break; - - case IOV_GVAL(IOV_BCMERRORSTR): - strncpy((char *)arg, bcmerrorstr(dhd_pub->bcmerror), BCME_STRLEN); - ((char *)arg)[BCME_STRLEN - 1] = 0x00; - break; - - case IOV_GVAL(IOV_BCMERROR): - int_val = (int32)dhd_pub->bcmerror; - bcopy(&int_val, arg, val_size); - break; - - case IOV_GVAL(IOV_WDTICK): - int_val = (int32)dhd_watchdog_ms; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_WDTICK): - if (!dhd_pub->up) { - bcmerror = BCME_NOTUP; - break; - } - dhd_os_wd_timer(dhd_pub, (uint)int_val); - break; - - case IOV_GVAL(IOV_DUMP): - bcmerror = dhd_dump(dhd_pub, arg, len); - break; - -#ifdef DHD_DEBUG - case IOV_GVAL(IOV_DCONSOLE_POLL): - int_val = (int32)dhd_console_ms; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_DCONSOLE_POLL): - dhd_console_ms = (uint)int_val; - break; - - case IOV_SVAL(IOV_CONS): - if (len > 0) - bcmerror = dhd_bus_console_in(dhd_pub, arg, len - 1); - break; -#endif - - case IOV_SVAL(IOV_CLEARCOUNTS): - dhd_pub->tx_packets = dhd_pub->rx_packets = 0; - dhd_pub->tx_errors = dhd_pub->rx_errors = 0; - dhd_pub->tx_ctlpkts = dhd_pub->rx_ctlpkts = 0; - dhd_pub->tx_ctlerrs = dhd_pub->rx_ctlerrs = 0; - dhd_pub->rx_dropped = 0; - dhd_pub->rx_readahead_cnt = 0; - dhd_pub->tx_realloc = 0; - dhd_pub->wd_dpc_sched = 0; - memset(&dhd_pub->dstats, 0, sizeof(dhd_pub->dstats)); - dhd_bus_clearcounts(dhd_pub); - break; - - - case IOV_GVAL(IOV_IOCTLTIMEOUT): { - int_val = (int32)dhd_os_get_ioctl_resp_timeout(); - bcopy(&int_val, arg, sizeof(int_val)); - break; - } - - case IOV_SVAL(IOV_IOCTLTIMEOUT): { - if (int_val <= 0) - bcmerror = BCME_BADARG; - else - dhd_os_set_ioctl_resp_timeout((unsigned int)int_val); - break; - } - - - default: - bcmerror = BCME_UNSUPPORTED; - break; - } - -exit: - return bcmerror; -} - -/* Store the status of a connection attempt for later retrieval by an iovar */ -void -dhd_store_conn_status(uint32 event, uint32 status, uint32 reason) -{ - /* Do not overwrite a WLC_E_PRUNE with a WLC_E_SET_SSID - * because an encryption/rsn mismatch results in both events, and - * the important information is in the WLC_E_PRUNE. - */ - if (!(event == WLC_E_SET_SSID && status == WLC_E_STATUS_FAIL && - dhd_conn_event == WLC_E_PRUNE)) { - dhd_conn_event = event; - dhd_conn_status = status; - dhd_conn_reason = reason; - } -} - -bool -dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, void *pkt, int prec) -{ - void *p; - int eprec = -1; /* precedence to evict from */ - bool discard_oldest; - - /* Fast case, precedence queue is not full and we are also not - * exceeding total queue length - */ - if (!pktq_pfull(q, prec) && !pktq_full(q)) { - pktq_penq(q, prec, pkt); - return TRUE; - } - - /* Determine precedence from which to evict packet, if any */ - if (pktq_pfull(q, prec)) - eprec = prec; - else if (pktq_full(q)) { - p = pktq_peek_tail(q, &eprec); - ASSERT(p); - if (eprec > prec) - return FALSE; - } - - /* Evict if needed */ - if (eprec >= 0) { - /* Detect queueing to unconfigured precedence */ - ASSERT(!pktq_pempty(q, eprec)); - discard_oldest = AC_BITMAP_TST(dhdp->wme_dp, eprec); - if (eprec == prec && !discard_oldest) - return FALSE; /* refuse newer (incoming) packet */ - /* Evict packet according to discard policy */ - p = discard_oldest ? pktq_pdeq(q, eprec) : pktq_pdeq_tail(q, eprec); - if (p == NULL) { - DHD_ERROR(("%s: pktq_penq() failed, oldest %d.", - __FUNCTION__, discard_oldest)); - ASSERT(p); - } - - PKTFREE(dhdp->osh, p, TRUE); - } - - /* Enqueue */ - p = pktq_penq(q, prec, pkt); - if (p == NULL) { - DHD_ERROR(("%s: pktq_penq() failed.", __FUNCTION__)); - ASSERT(p); - } - - return TRUE; -} - -static int -dhd_iovar_op(dhd_pub_t *dhd_pub, const char *name, - void *params, int plen, void *arg, int len, bool set) -{ - int bcmerror = 0; - int val_size; - const bcm_iovar_t *vi = NULL; - uint32 actionid; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - ASSERT(name); - ASSERT(len >= 0); - - /* Get MUST have return space */ - ASSERT(set || (arg && len)); - - /* Set does NOT take qualifiers */ - ASSERT(!set || (!params && !plen)); - - if ((vi = bcm_iovar_lookup(dhd_iovars, name)) == NULL) { - bcmerror = BCME_UNSUPPORTED; - goto exit; - } - - DHD_CTL(("%s: %s %s, len %d plen %d\n", __FUNCTION__, - name, (set ? "set" : "get"), len, plen)); - - /* set up 'params' pointer in case this is a set command so that - * the convenience int and bool code can be common to set and get - */ - if (params == NULL) { - params = arg; - plen = len; - } - - if (vi->type == IOVT_VOID) - val_size = 0; - else if (vi->type == IOVT_BUFFER) - val_size = len; - else - /* all other types are integer sized */ - val_size = sizeof(int); - - actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid); - bcmerror = dhd_doiovar(dhd_pub, vi, actionid, name, params, plen, arg, len, val_size); - -exit: - return bcmerror; -} - -int -dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen) -{ - int bcmerror = 0; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - if (!buf) return BCME_BADARG; - - switch (ioc->cmd) { - case DHD_GET_MAGIC: - if (buflen < sizeof(int)) - bcmerror = BCME_BUFTOOSHORT; - else - *(int*)buf = DHD_IOCTL_MAGIC; - break; - - case DHD_GET_VERSION: - if (buflen < sizeof(int)) - bcmerror = -BCME_BUFTOOSHORT; - else - *(int*)buf = DHD_IOCTL_VERSION; - break; - - case DHD_GET_VAR: - case DHD_SET_VAR: { - char *arg; - uint arglen; - - /* scan past the name to any arguments */ - for (arg = buf, arglen = buflen; *arg && arglen; arg++, arglen--); - - if (*arg) { - bcmerror = BCME_BUFTOOSHORT; - break; - } - - /* account for the NUL terminator */ - arg++, arglen--; - - /* call with the appropriate arguments */ - if (ioc->cmd == DHD_GET_VAR) - bcmerror = dhd_iovar_op(dhd_pub, buf, arg, arglen, - buf, buflen, IOV_GET); - else - bcmerror = dhd_iovar_op(dhd_pub, buf, NULL, 0, arg, arglen, IOV_SET); - if (bcmerror != BCME_UNSUPPORTED) - break; - - /* not in generic table, try protocol module */ - if (ioc->cmd == DHD_GET_VAR) - bcmerror = dhd_prot_iovar_op(dhd_pub, buf, arg, - arglen, buf, buflen, IOV_GET); - else - bcmerror = dhd_prot_iovar_op(dhd_pub, buf, - NULL, 0, arg, arglen, IOV_SET); - if (bcmerror != BCME_UNSUPPORTED) - break; - - /* if still not found, try bus module */ - if (ioc->cmd == DHD_GET_VAR) - bcmerror = dhd_bus_iovar_op(dhd_pub, buf, - arg, arglen, buf, buflen, IOV_GET); - else - bcmerror = dhd_bus_iovar_op(dhd_pub, buf, - NULL, 0, arg, arglen, IOV_SET); - - break; - } - - default: - bcmerror = BCME_UNSUPPORTED; - } - - return bcmerror; -} - - -#ifdef SHOW_EVENTS -static void -wl_show_host_event(wl_event_msg_t *event, void *event_data) -{ - uint i, status, reason; - bool group = FALSE, flush_txq = FALSE, link = FALSE; - char *auth_str, *event_name; - uchar *buf; - char err_msg[256], eabuf[ETHER_ADDR_STR_LEN]; - static struct {uint event; char *event_name;} event_names[] = { - {WLC_E_SET_SSID, "SET_SSID"}, - {WLC_E_JOIN, "JOIN"}, - {WLC_E_START, "START"}, - {WLC_E_AUTH, "AUTH"}, - {WLC_E_AUTH_IND, "AUTH_IND"}, - {WLC_E_DEAUTH, "DEAUTH"}, - {WLC_E_DEAUTH_IND, "DEAUTH_IND"}, - {WLC_E_ASSOC, "ASSOC"}, - {WLC_E_ASSOC_IND, "ASSOC_IND"}, - {WLC_E_REASSOC, "REASSOC"}, - {WLC_E_REASSOC_IND, "REASSOC_IND"}, - {WLC_E_DISASSOC, "DISASSOC"}, - {WLC_E_DISASSOC_IND, "DISASSOC_IND"}, - {WLC_E_QUIET_START, "START_QUIET"}, - {WLC_E_QUIET_END, "END_QUIET"}, - {WLC_E_BEACON_RX, "BEACON_RX"}, - {WLC_E_LINK, "LINK"}, - {WLC_E_MIC_ERROR, "MIC_ERROR"}, - {WLC_E_NDIS_LINK, "NDIS_LINK"}, - {WLC_E_ROAM, "ROAM"}, - {WLC_E_TXFAIL, "TXFAIL"}, - {WLC_E_PMKID_CACHE, "PMKID_CACHE"}, - {WLC_E_RETROGRADE_TSF, "RETROGRADE_TSF"}, - {WLC_E_PRUNE, "PRUNE"}, - {WLC_E_AUTOAUTH, "AUTOAUTH"}, - {WLC_E_EAPOL_MSG, "EAPOL_MSG"}, - {WLC_E_SCAN_COMPLETE, "SCAN_COMPLETE"}, - {WLC_E_ADDTS_IND, "ADDTS_IND"}, - {WLC_E_DELTS_IND, "DELTS_IND"}, - {WLC_E_BCNSENT_IND, "BCNSENT_IND"}, - {WLC_E_BCNRX_MSG, "BCNRX_MSG"}, - {WLC_E_BCNLOST_MSG, "BCNLOST_MSG"}, - {WLC_E_ROAM_PREP, "ROAM_PREP"}, - {WLC_E_PFN_NET_FOUND, "PNO_NET_FOUND"}, - {WLC_E_PFN_NET_LOST, "PNO_NET_LOST"}, - {WLC_E_RESET_COMPLETE, "RESET_COMPLETE"}, - {WLC_E_JOIN_START, "JOIN_START"}, - {WLC_E_ROAM_START, "ROAM_START"}, - {WLC_E_ASSOC_START, "ASSOC_START"}, - {WLC_E_IBSS_ASSOC, "IBSS_ASSOC"}, - {WLC_E_RADIO, "RADIO"}, - {WLC_E_PSM_WATCHDOG, "PSM_WATCHDOG"}, - {WLC_E_PROBREQ_MSG, "PROBREQ_MSG"}, - {WLC_E_SCAN_CONFIRM_IND, "SCAN_CONFIRM_IND"}, - {WLC_E_PSK_SUP, "PSK_SUP"}, - {WLC_E_COUNTRY_CODE_CHANGED, "COUNTRY_CODE_CHANGED"}, - {WLC_E_EXCEEDED_MEDIUM_TIME, "EXCEEDED_MEDIUM_TIME"}, - {WLC_E_ICV_ERROR, "ICV_ERROR"}, - {WLC_E_UNICAST_DECODE_ERROR, "UNICAST_DECODE_ERROR"}, - {WLC_E_MULTICAST_DECODE_ERROR, "MULTICAST_DECODE_ERROR"}, - {WLC_E_TRACE, "TRACE"}, - {WLC_E_ACTION_FRAME, "ACTION FRAME"}, - {WLC_E_ACTION_FRAME_COMPLETE, "ACTION FRAME TX COMPLETE"}, - {WLC_E_IF, "IF"}, - {WLC_E_RSSI, "RSSI"}, - {WLC_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"} - }; - uint event_type, flags, auth_type, datalen; - event_type = ntoh32(event->event_type); - flags = ntoh16(event->flags); - status = ntoh32(event->status); - reason = ntoh32(event->reason); - auth_type = ntoh32(event->auth_type); - datalen = ntoh32(event->datalen); - /* debug dump of event messages */ - sprintf(eabuf, "%02x:%02x:%02x:%02x:%02x:%02x", - (uchar)event->addr.octet[0]&0xff, - (uchar)event->addr.octet[1]&0xff, - (uchar)event->addr.octet[2]&0xff, - (uchar)event->addr.octet[3]&0xff, - (uchar)event->addr.octet[4]&0xff, - (uchar)event->addr.octet[5]&0xff); - - event_name = "UNKNOWN"; - for (i = 0; i < ARRAYSIZE(event_names); i++) { - if (event_names[i].event == event_type) - event_name = event_names[i].event_name; - } - - DHD_EVENT(("EVENT: %s, event ID = %d\n", event_name, event_type)); - - if (flags & WLC_EVENT_MSG_LINK) - link = TRUE; - if (flags & WLC_EVENT_MSG_GROUP) - group = TRUE; - if (flags & WLC_EVENT_MSG_FLUSHTXQ) - flush_txq = TRUE; - - switch (event_type) { - case WLC_E_START: - case WLC_E_DEAUTH: - case WLC_E_DISASSOC: - DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf)); - break; - - case WLC_E_ASSOC_IND: - case WLC_E_REASSOC_IND: - DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf)); - break; - - case WLC_E_ASSOC: - case WLC_E_REASSOC: - if (status == WLC_E_STATUS_SUCCESS) { - DHD_EVENT(("MACEVENT: %s, MAC %s, SUCCESS\n", event_name, eabuf)); - } else if (status == WLC_E_STATUS_TIMEOUT) { - DHD_EVENT(("MACEVENT: %s, MAC %s, TIMEOUT\n", event_name, eabuf)); - } else if (status == WLC_E_STATUS_FAIL) { - DHD_EVENT(("MACEVENT: %s, MAC %s, FAILURE, reason %d\n", - event_name, eabuf, (int)reason)); - } else { - DHD_EVENT(("MACEVENT: %s, MAC %s, unexpected status %d\n", - event_name, eabuf, (int)status)); - } - break; - - case WLC_E_DEAUTH_IND: - case WLC_E_DISASSOC_IND: - DHD_EVENT(("MACEVENT: %s, MAC %s, reason %d\n", event_name, eabuf, (int)reason)); - break; - - case WLC_E_AUTH: - case WLC_E_AUTH_IND: - if (auth_type == DOT11_OPEN_SYSTEM) - auth_str = "Open System"; - else if (auth_type == DOT11_SHARED_KEY) - auth_str = "Shared Key"; - else { - sprintf(err_msg, "AUTH unknown: %d", (int)auth_type); - auth_str = err_msg; - } - if (event_type == WLC_E_AUTH_IND) { - DHD_EVENT(("MACEVENT: %s, MAC %s, %s\n", event_name, eabuf, auth_str)); - } else if (status == WLC_E_STATUS_SUCCESS) { - DHD_EVENT(("MACEVENT: %s, MAC %s, %s, SUCCESS\n", - event_name, eabuf, auth_str)); - } else if (status == WLC_E_STATUS_TIMEOUT) { - DHD_EVENT(("MACEVENT: %s, MAC %s, %s, TIMEOUT\n", - event_name, eabuf, auth_str)); - } else if (status == WLC_E_STATUS_FAIL) { - DHD_EVENT(("MACEVENT: %s, MAC %s, %s, FAILURE, reason %d\n", - event_name, eabuf, auth_str, (int)reason)); - } - - break; - - case WLC_E_JOIN: - case WLC_E_ROAM: - case WLC_E_SET_SSID: - if (status == WLC_E_STATUS_SUCCESS) { - DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf)); - } else if (status == WLC_E_STATUS_FAIL) { - DHD_EVENT(("MACEVENT: %s, failed\n", event_name)); - } else if (status == WLC_E_STATUS_NO_NETWORKS) { - DHD_EVENT(("MACEVENT: %s, no networks found\n", event_name)); - } else { - DHD_EVENT(("MACEVENT: %s, unexpected status %d\n", - event_name, (int)status)); - } - break; - - case WLC_E_BEACON_RX: - if (status == WLC_E_STATUS_SUCCESS) { - DHD_EVENT(("MACEVENT: %s, SUCCESS\n", event_name)); - } else if (status == WLC_E_STATUS_FAIL) { - DHD_EVENT(("MACEVENT: %s, FAIL\n", event_name)); - } else { - DHD_EVENT(("MACEVENT: %s, status %d\n", event_name, status)); - } - break; - - case WLC_E_LINK: - DHD_EVENT(("MACEVENT: %s %s\n", event_name, link?"UP":"DOWN")); - break; - - case WLC_E_MIC_ERROR: - DHD_EVENT(("MACEVENT: %s, MAC %s, Group %d, Flush %d\n", - event_name, eabuf, group, flush_txq)); - break; - - case WLC_E_ICV_ERROR: - case WLC_E_UNICAST_DECODE_ERROR: - case WLC_E_MULTICAST_DECODE_ERROR: - DHD_EVENT(("MACEVENT: %s, MAC %s\n", - event_name, eabuf)); - break; - - case WLC_E_TXFAIL: - DHD_EVENT(("MACEVENT: %s, RA %s\n", event_name, eabuf)); - break; - - case WLC_E_SCAN_COMPLETE: - case WLC_E_PMKID_CACHE: - DHD_EVENT(("MACEVENT: %s\n", event_name)); - break; - - case WLC_E_PFN_NET_FOUND: - case WLC_E_PFN_NET_LOST: - case WLC_E_PFN_SCAN_COMPLETE: - DHD_EVENT(("PNOEVENT: %s\n", event_name)); - break; - - case WLC_E_PSK_SUP: - case WLC_E_PRUNE: - DHD_EVENT(("MACEVENT: %s, status %d, reason %d\n", - event_name, (int)status, (int)reason)); - break; - - case WLC_E_TRACE: - { - static uint32 seqnum_prev = 0; - msgtrace_hdr_t hdr; - uint32 nblost; - char *s, *p; - - buf = (uchar *) event_data; - memcpy(&hdr, buf, MSGTRACE_HDRLEN); - - if (hdr.version != MSGTRACE_VERSION) { - printf("\nMACEVENT: %s [unsupported version --> " - "dhd version:%d dongle version:%d]\n", - event_name, MSGTRACE_VERSION, hdr.version); - /* Reset datalen to avoid display below */ - datalen = 0; - break; - } - - /* There are 2 bytes available at the end of data */ - buf[MSGTRACE_HDRLEN + ntoh16(hdr.len)] = '\0'; - - if (ntoh32(hdr.discarded_bytes) || ntoh32(hdr.discarded_printf)) { - printf("\nWLC_E_TRACE: [Discarded traces in dongle -->" - "discarded_bytes %d discarded_printf %d]\n", - ntoh32(hdr.discarded_bytes), ntoh32(hdr.discarded_printf)); - } - - nblost = ntoh32(hdr.seqnum) - seqnum_prev - 1; - if (nblost > 0) { - printf("\nWLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n", - ntoh32(hdr.seqnum), nblost); - } - seqnum_prev = ntoh32(hdr.seqnum); - - /* Display the trace buffer. Advance from \n to \n to avoid display big - * printf (issue with Linux printk ) - */ - p = (char *)&buf[MSGTRACE_HDRLEN]; - while ((s = strstr(p, "\n")) != NULL) { - *s = '\0'; - printf("%s\n", p); - p = s + 1; - } - printf("%s\n", p); - - /* Reset datalen to avoid display below */ - datalen = 0; - } - break; - - - case WLC_E_RSSI: - DHD_EVENT(("MACEVENT: %s %d\n", event_name, ntoh32(*((int *)event_data)))); - break; - - default: - DHD_EVENT(("MACEVENT: %s %d, MAC %s, status %d, reason %d, auth %d\n", - event_name, event_type, eabuf, (int)status, (int)reason, - (int)auth_type)); - break; - } - - /* show any appended data */ - if (datalen) { - buf = (uchar *) event_data; - DHD_EVENT((" data (%d) : ", datalen)); - for (i = 0; i < datalen; i++) - DHD_EVENT((" 0x%02x ", *buf++)); - DHD_EVENT(("\n")); - } -} -#endif /* SHOW_EVENTS */ - -int -wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata, - wl_event_msg_t *event, void **data_ptr) -{ - /* check whether packet is a BRCM event pkt */ - bcm_event_t *pvt_data = (bcm_event_t *)pktdata; - char *event_data; - uint32 type, status; - uint16 flags; - int evlen; - - if (bcmp(BRCM_OUI, &pvt_data->bcm_hdr.oui[0], DOT11_OUI_LEN)) { - DHD_ERROR(("%s: mismatched OUI, bailing\n", __FUNCTION__)); - return (BCME_ERROR); - } - - /* BRCM event pkt may be unaligned - use xxx_ua to load user_subtype. */ - if (ntoh16_ua((void *)&pvt_data->bcm_hdr.usr_subtype) != BCMILCP_BCM_SUBTYPE_EVENT) { - DHD_ERROR(("%s: mismatched subtype, bailing\n", __FUNCTION__)); - return (BCME_ERROR); - } - - *data_ptr = &pvt_data[1]; - event_data = *data_ptr; - - /* memcpy since BRCM event pkt may be unaligned. */ - memcpy(event, &pvt_data->event, sizeof(wl_event_msg_t)); - - type = ntoh32_ua((void *)&event->event_type); - flags = ntoh16_ua((void *)&event->flags); - status = ntoh32_ua((void *)&event->status); - evlen = ntoh32_ua((void *)&event->datalen) + sizeof(bcm_event_t); - - switch (type) { - case WLC_E_IF: - { - dhd_if_event_t *ifevent = (dhd_if_event_t *)event_data; - DHD_TRACE(("%s: if event\n", __FUNCTION__)); - - if (ifevent->ifidx > 0 && ifevent->ifidx < DHD_MAX_IFS) - { - if (ifevent->action == WLC_E_IF_ADD) - dhd_add_if(dhd, ifevent->ifidx, - NULL, event->ifname, - pvt_data->eth.ether_dhost, - ifevent->flags, ifevent->bssidx); - else - dhd_del_if(dhd, ifevent->ifidx); - } else { - DHD_ERROR(("%s: Invalid ifidx %d for %s\n", - __FUNCTION__, ifevent->ifidx, event->ifname)); - } - } - /* send up the if event: btamp user needs it */ - *ifidx = dhd_ifname2idx(dhd, event->ifname); - /* push up to external supp/auth */ - dhd_event(dhd, (char *)pvt_data, evlen, *ifidx); - break; - - -#ifdef P2P - case WLC_E_NDIS_LINK: - break; -#endif - /* fall through */ - /* These are what external supplicant/authenticator wants */ - case WLC_E_LINK: - case WLC_E_ASSOC_IND: - case WLC_E_REASSOC_IND: - case WLC_E_DISASSOC_IND: - case WLC_E_MIC_ERROR: - default: - /* Fall through: this should get _everything_ */ - - *ifidx = dhd_ifname2idx(dhd, event->ifname); - /* push up to external supp/auth */ - dhd_event(dhd, (char *)pvt_data, evlen, *ifidx); - DHD_TRACE(("%s: MAC event %d, flags %x, status %x\n", - __FUNCTION__, type, flags, status)); - - /* put it back to WLC_E_NDIS_LINK */ - if (type == WLC_E_NDIS_LINK) { - uint32 temp; - - temp = ntoh32_ua((void *)&event->event_type); - DHD_TRACE(("Converted to WLC_E_LINK type %d\n", temp)); - - temp = ntoh32(WLC_E_NDIS_LINK); - memcpy((void *)(&pvt_data->event.event_type), &temp, - sizeof(pvt_data->event.event_type)); - } - break; - } - -#ifdef SHOW_EVENTS - wl_show_host_event(event, event_data); -#endif /* SHOW_EVENTS */ - - return (BCME_OK); -} - - -void -wl_event_to_host_order(wl_event_msg_t *evt) -{ - /* Event struct members passed from dongle to host are stored in network - * byte order. Convert all members to host-order. - */ - evt->event_type = ntoh32(evt->event_type); - evt->flags = ntoh16(evt->flags); - evt->status = ntoh32(evt->status); - evt->reason = ntoh32(evt->reason); - evt->auth_type = ntoh32(evt->auth_type); - evt->datalen = ntoh32(evt->datalen); - evt->version = ntoh16(evt->version); -} - -void print_buf(void *pbuf, int len, int bytes_per_line) -{ - int i, j = 0; - unsigned char *buf = pbuf; - - if (bytes_per_line == 0) { - bytes_per_line = len; - } - - for (i = 0; i < len; i++) { - printf("%2.2x", *buf++); - j++; - if (j == bytes_per_line) { - printf("\n"); - j = 0; - } else { - printf(":"); - } - } - printf("\n"); -} - -#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base)) - -#ifdef PKT_FILTER_SUPPORT -/* Convert user's input in hex pattern to byte-size mask */ -static int -wl_pattern_atoh(char *src, char *dst) -{ - int i; - if (strncmp(src, "0x", 2) != 0 && - strncmp(src, "0X", 2) != 0) { - DHD_ERROR(("Mask invalid format. Needs to start with 0x\n")); - return -1; - } - src = src + 2; /* Skip past 0x */ - if (strlen(src) % 2 != 0) { - DHD_ERROR(("Mask invalid format. Needs to be of even length\n")); - return -1; - } - for (i = 0; *src != '\0'; i++) { - char num[3]; - strncpy(num, src, 2); - num[2] = '\0'; - dst[i] = (uint8)strtoul(num, NULL, 16); - src += 2; - } - return i; -} - -void -dhd_pktfilter_offload_enable(dhd_pub_t * dhd, char *arg, int enable, int master_mode) -{ - char *argv[8]; - int i = 0; - const char *str; - int buf_len; - int str_len; - char *arg_save = 0, *arg_org = 0; - int rc; - char buf[128]; - wl_pkt_filter_enable_t enable_parm; - wl_pkt_filter_enable_t * pkt_filterp; - - if (!(arg_save = MALLOC(dhd->osh, strlen(arg) + 1))) { - DHD_ERROR(("%s: kmalloc failed\n", __FUNCTION__)); - goto fail; - } - arg_org = arg_save; - memcpy(arg_save, arg, strlen(arg) + 1); - - argv[i] = bcmstrtok(&arg_save, " ", 0); - - i = 0; - if (NULL == argv[i]) { - DHD_ERROR(("No args provided\n")); - goto fail; - } - - str = "pkt_filter_enable"; - str_len = strlen(str); - strncpy(buf, str, str_len); - buf[str_len] = '\0'; - buf_len = str_len + 1; - - pkt_filterp = (wl_pkt_filter_enable_t *)(buf + str_len + 1); - - /* Parse packet filter id. */ - enable_parm.id = htod32(strtoul(argv[i], NULL, 0)); - - /* Parse enable/disable value. */ - enable_parm.enable = htod32(enable); - - buf_len += sizeof(enable_parm); - memcpy((char *)pkt_filterp, - &enable_parm, - sizeof(enable_parm)); - - /* Enable/disable the specified filter. */ - rc = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, buf_len); - rc = rc >= 0 ? 0 : rc; - if (rc) - DHD_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n", - __FUNCTION__, arg, rc)); - else - DHD_TRACE(("%s: successfully added pktfilter %s\n", - __FUNCTION__, arg)); - - /* Contorl the master mode */ - bcm_mkiovar("pkt_filter_mode", (char *)&master_mode, 4, buf, sizeof(buf)); - rc = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, sizeof(buf)); - rc = rc >= 0 ? 0 : rc; - if (rc) - DHD_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n", - __FUNCTION__, arg, rc)); - -fail: - if (arg_org) - MFREE(dhd->osh, arg_org, strlen(arg) + 1); -} - -void -dhd_pktfilter_offload_set(dhd_pub_t * dhd, char *arg) -{ - const char *str; - wl_pkt_filter_t pkt_filter; - wl_pkt_filter_t *pkt_filterp; - int buf_len; - int str_len; - int rc; - uint32 mask_size; - uint32 pattern_size; - char *argv[8], * buf = 0; - int i = 0; - char *arg_save = 0, *arg_org = 0; -#define BUF_SIZE 2048 - - if (!(arg_save = MALLOC(dhd->osh, strlen(arg) + 1))) { - DHD_ERROR(("%s: kmalloc failed\n", __FUNCTION__)); - goto fail; - } - - arg_org = arg_save; - - if (!(buf = MALLOC(dhd->osh, BUF_SIZE))) { - DHD_ERROR(("%s: kmalloc failed\n", __FUNCTION__)); - goto fail; - } - - memcpy(arg_save, arg, strlen(arg) + 1); - - if (strlen(arg) > BUF_SIZE) { - DHD_ERROR(("Not enough buffer %d < %d\n", (int)strlen(arg), (int)sizeof(buf))); - goto fail; - } - - argv[i] = bcmstrtok(&arg_save, " ", 0); - while (argv[i++]) - argv[i] = bcmstrtok(&arg_save, " ", 0); - - i = 0; - if (NULL == argv[i]) { - DHD_ERROR(("No args provided\n")); - goto fail; - } - - str = "pkt_filter_add"; - str_len = strlen(str); - strncpy(buf, str, str_len); - buf[ str_len ] = '\0'; - buf_len = str_len + 1; - - pkt_filterp = (wl_pkt_filter_t *) (buf + str_len + 1); - - /* Parse packet filter id. */ - pkt_filter.id = htod32(strtoul(argv[i], NULL, 0)); - - if (NULL == argv[++i]) { - DHD_ERROR(("Polarity not provided\n")); - goto fail; - } - - /* Parse filter polarity. */ - pkt_filter.negate_match = htod32(strtoul(argv[i], NULL, 0)); - - if (NULL == argv[++i]) { - DHD_ERROR(("Filter type not provided\n")); - goto fail; - } - - /* Parse filter type. */ - pkt_filter.type = htod32(strtoul(argv[i], NULL, 0)); - - if (NULL == argv[++i]) { - DHD_ERROR(("Offset not provided\n")); - goto fail; - } - - /* Parse pattern filter offset. */ - pkt_filter.u.pattern.offset = htod32(strtoul(argv[i], NULL, 0)); - - if (NULL == argv[++i]) { - DHD_ERROR(("Bitmask not provided\n")); - goto fail; - } - - /* Parse pattern filter mask. */ - mask_size = - htod32(wl_pattern_atoh(argv[i], (char *) pkt_filterp->u.pattern.mask_and_pattern)); - - if (NULL == argv[++i]) { - DHD_ERROR(("Pattern not provided\n")); - goto fail; - } - - /* Parse pattern filter pattern. */ - pattern_size = - htod32(wl_pattern_atoh(argv[i], - (char *) &pkt_filterp->u.pattern.mask_and_pattern[mask_size])); - - if (mask_size != pattern_size) { - DHD_ERROR(("Mask and pattern not the same size\n")); - goto fail; - } - - pkt_filter.u.pattern.size_bytes = mask_size; - buf_len += WL_PKT_FILTER_FIXED_LEN; - buf_len += (WL_PKT_FILTER_PATTERN_FIXED_LEN + 2 * mask_size); - - /* Keep-alive attributes are set in local variable (keep_alive_pkt), and - ** then memcpy'ed into buffer (keep_alive_pktp) since there is no - ** guarantee that the buffer is properly aligned. - */ - memcpy((char *)pkt_filterp, - &pkt_filter, - WL_PKT_FILTER_FIXED_LEN + WL_PKT_FILTER_PATTERN_FIXED_LEN); - - rc = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, buf_len); - rc = rc >= 0 ? 0 : rc; - - if (rc) - DHD_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n", - __FUNCTION__, arg, rc)); - else - DHD_TRACE(("%s: successfully added pktfilter %s\n", - __FUNCTION__, arg)); - -fail: - if (arg_org) - MFREE(dhd->osh, arg_org, strlen(arg) + 1); - - if (buf) - MFREE(dhd->osh, buf, BUF_SIZE); -} -#endif - -#ifdef ARP_OFFLOAD_SUPPORT -void -dhd_arp_offload_set(dhd_pub_t * dhd, int arp_mode) -{ - char iovbuf[32]; - int retcode; - - bcm_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf)); - retcode = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); - retcode = retcode >= 0 ? 0 : retcode; - if (retcode) - DHD_TRACE(("%s: failed to set ARP offload mode to 0x%x, retcode = %d\n", - __FUNCTION__, arp_mode, retcode)); - else - DHD_TRACE(("%s: successfully set ARP offload mode to 0x%x\n", - __FUNCTION__, arp_mode)); -} - -void -dhd_arp_offload_enable(dhd_pub_t * dhd, int arp_enable) -{ - char iovbuf[32]; - int retcode; - - bcm_mkiovar("arpoe", (char *)&arp_enable, 4, iovbuf, sizeof(iovbuf)); - retcode = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); - retcode = retcode >= 0 ? 0 : retcode; - if (retcode) - DHD_TRACE(("%s: failed to enabe ARP offload to %d, retcode = %d\n", - __FUNCTION__, arp_enable, retcode)); - else - DHD_TRACE(("%s: successfully enabed ARP offload to %d\n", - __FUNCTION__, arp_enable)); -} -#endif - -int -dhd_preinit_ioctls(dhd_pub_t *dhd) -{ - char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ - uint up = 0; - char buf[128], *ptr; - uint power_mode = PM_FAST; - uint32 dongle_align = DHD_SDALIGN; - uint32 glom = 0; - uint bcn_timeout = 4; - int scan_assoc_time = 40; - int scan_unassoc_time = 40; - uint32 listen_interval = LISTEN_INTERVAL; /* Default Listen Interval in Beacons */ -#if defined(SOFTAP) - uint dtim = 1; -#endif - int ret = 0; -#ifdef GET_CUSTOM_MAC_ENABLE - struct ether_addr ea_addr; -#endif /* GET_CUSTOM_MAC_ENABLE */ - - dhd_os_proto_block(dhd); - -#ifdef GET_CUSTOM_MAC_ENABLE - /* - ** Read MAC address from external customer place - ** NOTE that default mac address has to be present in otp or nvram file - ** to bring up firmware but unique per board mac address maybe provided - ** by customer code - */ - ret = dhd_custom_get_mac_address(ea_addr.octet); - if (!ret) { - bcm_mkiovar("cur_etheraddr", (void *)&ea_addr, ETHER_ADDR_LEN, buf, sizeof(buf)); - ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, sizeof(buf)); - if (ret < 0) { - DHD_ERROR(("%s: can't set MAC address , error=%d\n", __FUNCTION__, ret)); - } else - memcpy(dhd->mac.octet, (void *)&ea_addr, ETHER_ADDR_LEN); - } -#endif /* GET_CUSTOM_MAC_ENABLE */ - -#ifdef SET_RANDOM_MAC_SOFTAP - if (strstr(fw_path, "apsta") != NULL) { - uint rand_mac; - - srandom32((uint)jiffies); - rand_mac = random32(); - iovbuf[0] = 0x02; /* locally administered bit */ - iovbuf[1] = 0x1A; - iovbuf[2] = 0x11; - iovbuf[3] = (unsigned char)(rand_mac & 0x0F) | 0xF0; - iovbuf[4] = (unsigned char)(rand_mac >> 8); - iovbuf[5] = (unsigned char)(rand_mac >> 16); - - printk("Broadcom Dongle Host Driver mac=%02x:%02x:%02x:%02x:%02x:%02x\n", - iovbuf[0], iovbuf[1], iovbuf[2], iovbuf[3], iovbuf[4], iovbuf[5]); - - bcm_mkiovar("cur_etheraddr", (void *)iovbuf, ETHER_ADDR_LEN, buf, sizeof(buf)); - ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, sizeof(buf)); - if (ret < 0) { - DHD_ERROR(("%s: can't set MAC address , error=%d\n", __FUNCTION__, ret)); - } else - memcpy(dhd->mac.octet, iovbuf, ETHER_ADDR_LEN); - } -#endif /* SET_RANDOM_MAC_SOFTAP */ - - /* Set Country code - * "US" ---> 11 channels, this is default setting. - * "EU" ---> 13 channels - * "JP" ---> 14 channels - */ - strcpy(dhd->country_code, "EU"); - if (dhd->country_code[0] != 0) { - if (dhdcdc_set_ioctl(dhd, 0, WLC_SET_COUNTRY, - dhd->country_code, sizeof(dhd->country_code)) < 0) { - DHD_ERROR(("%s: country code setting failed\n", __FUNCTION__)); - } - } - - /* Set Listen Interval */ - bcm_mkiovar("assoc_listen", (char *)&listen_interval, 4, iovbuf, sizeof(iovbuf)); - if ((ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf))) < 0) - DHD_ERROR(("%s assoc_listen failed %d\n", __FUNCTION__, ret)); - - /* query for 'ver' to get version info from firmware */ - memset(buf, 0, sizeof(buf)); - ptr = buf; - bcm_mkiovar("ver", 0, 0, buf, sizeof(buf)); - dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, buf, sizeof(buf)); - bcmstrtok(&ptr, "\n", 0); - /* Print fw version info */ - DHD_ERROR(("Firmware version = %s\n", buf)); - - /* Set PowerSave mode */ - dhdcdc_set_ioctl(dhd, 0, WLC_SET_PM, (char *)&power_mode, sizeof(power_mode)); - - /* Match Host and Dongle rx alignment */ - bcm_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf, sizeof(iovbuf)); - dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); - - /* disable glom option per default */ - bcm_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf)); - dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); - - /* Setup timeout if Beacons are lost and roam is off to report link down */ - bcm_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, sizeof(iovbuf)); - dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); - - /* Enable/Disable build-in roaming to allowed ext supplicant to take of romaing */ - bcm_mkiovar("roam_off", (char *)&dhd_roam, 4, iovbuf, sizeof(iovbuf)); - dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); - -#if defined(SOFTAP) - if (ap_fw_loaded == TRUE) { - dhdcdc_set_ioctl(dhd, 0, WLC_SET_DTIMPRD, (char *)&dtim, sizeof(dtim)); - } -#endif - - if (dhd_roam == 0) - { - /* set internal roaming roaming parameters */ - int roam_scan_period = 30; /* in sec */ - int roam_fullscan_period = 120; /* in sec */ - int roam_trigger = -85; - int roam_delta = 15; - int band; - int band_temp_set = WLC_BAND_2G; - - if (dhdcdc_set_ioctl(dhd, 0, WLC_SET_ROAM_SCAN_PERIOD, \ - (char *)&roam_scan_period, sizeof(roam_scan_period)) < 0) - DHD_ERROR(("%s: roam scan setup failed\n", __FUNCTION__)); - - bcm_mkiovar("fullroamperiod", (char *)&roam_fullscan_period, \ - 4, iovbuf, sizeof(iovbuf)); - if (dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, \ - iovbuf, sizeof(iovbuf)) < 0) - DHD_ERROR(("%s: roam fullscan setup failed\n", __FUNCTION__)); - - if (dhdcdc_query_ioctl(dhd, 0, WLC_GET_BAND, \ - (char *)&band, sizeof(band)) < 0) - DHD_ERROR(("%s: roam delta setting failed\n", __FUNCTION__)); - else { - if ((band == WLC_BAND_AUTO) || (band == WLC_BAND_ALL)) - { - /* temp set band to insert new roams values */ - if (dhdcdc_set_ioctl(dhd, 0, WLC_SET_BAND, \ - (char *)&band_temp_set, sizeof(band_temp_set)) < 0) - DHD_ERROR(("%s: local band seting failed\n", __FUNCTION__)); - } - if (dhdcdc_set_ioctl(dhd, 0, WLC_SET_ROAM_DELTA, \ - (char *)&roam_delta, sizeof(roam_delta)) < 0) - DHD_ERROR(("%s: roam delta setting failed\n", __FUNCTION__)); - - if (dhdcdc_set_ioctl(dhd, 0, WLC_SET_ROAM_TRIGGER, \ - (char *)&roam_trigger, sizeof(roam_trigger)) < 0) - DHD_ERROR(("%s: roam trigger setting failed\n", __FUNCTION__)); - - /* Restore original band settinngs */ - if (dhdcdc_set_ioctl(dhd, 0, WLC_SET_BAND, \ - (char *)&band, sizeof(band)) < 0) - DHD_ERROR(("%s: Original band restore failed\n", __FUNCTION__)); - } - } - - /* Force STA UP */ - if (dhd_radio_up) - dhdcdc_set_ioctl(dhd, 0, WLC_UP, (char *)&up, sizeof(up)); - - /* Setup event_msgs */ - bcm_mkiovar("event_msgs", dhd->eventmask, WL_EVENTING_MASK_LEN, iovbuf, sizeof(iovbuf)); - dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); - - dhdcdc_set_ioctl(dhd, 0, WLC_SET_SCAN_CHANNEL_TIME, (char *)&scan_assoc_time, - sizeof(scan_assoc_time)); - dhdcdc_set_ioctl(dhd, 0, WLC_SET_SCAN_UNASSOC_TIME, (char *)&scan_unassoc_time, - sizeof(scan_unassoc_time)); - -#ifdef ARP_OFFLOAD_SUPPORT - /* Set and enable ARP offload feature */ - if (dhd_arp_enable) - dhd_arp_offload_set(dhd, dhd_arp_mode); - dhd_arp_offload_enable(dhd, dhd_arp_enable); -#endif /* ARP_OFFLOAD_SUPPORT */ - -#ifdef PKT_FILTER_SUPPORT - { - int i; - /* Set up pkt filter */ - if (dhd_pkt_filter_enable) { - for (i = 0; i < dhd->pktfilter_count; i++) { - dhd_pktfilter_offload_set(dhd, dhd->pktfilter[i]); - dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i], - dhd_pkt_filter_init, dhd_master_mode); - } - } - } -#endif /* PKT_FILTER_SUPPORT */ - -#if defined(KEEP_ALIVE) - { - /* Set Keep Alive : be sure to use FW with -keepalive */ - int res; - - if (ap_fw_loaded == FALSE) { - if ((res = dhd_keep_alive_onoff(dhd, 1)) < 0) - DHD_ERROR(("%s set keeplive failed %d\n", \ - __FUNCTION__, res)); - } - } -#endif - - dhd_os_proto_unblock(dhd); - - return 0; -} - -#ifdef SIMPLE_ISCAN - -uint iscan_thread_id; -iscan_buf_t * iscan_chain = 0; - -iscan_buf_t * -dhd_iscan_allocate_buf(dhd_pub_t *dhd, iscan_buf_t **iscanbuf) -{ - iscan_buf_t *iscanbuf_alloc = 0; - iscan_buf_t *iscanbuf_head; - - dhd_iscan_lock(); - - iscanbuf_alloc = (iscan_buf_t*)MALLOC(dhd->osh, sizeof(iscan_buf_t)); - if (iscanbuf_alloc == NULL) - goto fail; - - iscanbuf_alloc->next = NULL; - iscanbuf_head = *iscanbuf; - - DHD_ISCAN(("%s: addr of allocated node = 0x%X" - "addr of iscanbuf_head = 0x%X dhd = 0x%X\n", - __FUNCTION__, iscanbuf_alloc, iscanbuf_head, dhd)); - - if (iscanbuf_head == NULL) { - *iscanbuf = iscanbuf_alloc; - DHD_ISCAN(("%s: Head is allocated\n", __FUNCTION__)); - goto fail; - } - - while (iscanbuf_head->next) - iscanbuf_head = iscanbuf_head->next; - - iscanbuf_head->next = iscanbuf_alloc; - -fail: - dhd_iscan_unlock(); - return iscanbuf_alloc; -} - -void -dhd_iscan_free_buf(void *dhdp, iscan_buf_t *iscan_delete) -{ - iscan_buf_t *iscanbuf_free = 0; - iscan_buf_t *iscanbuf_prv = 0; - iscan_buf_t *iscanbuf_cur = iscan_chain; - dhd_pub_t *dhd = dhd_bus_pub(dhdp); - - dhd_iscan_lock(); - /* If iscan_delete is null then delete the entire - * chain or else delete specific one provided - */ - if (!iscan_delete) { - while (iscanbuf_cur) { - iscanbuf_free = iscanbuf_cur; - iscanbuf_cur = iscanbuf_cur->next; - iscanbuf_free->next = 0; - MFREE(dhd->osh, iscanbuf_free, sizeof(iscan_buf_t)); - } - iscan_chain = 0; - } else { - while (iscanbuf_cur) { - if (iscanbuf_cur == iscan_delete) - break; - iscanbuf_prv = iscanbuf_cur; - iscanbuf_cur = iscanbuf_cur->next; - } - if (iscanbuf_prv) - iscanbuf_prv->next = iscan_delete->next; - - iscan_delete->next = 0; - MFREE(dhd->osh, iscan_delete, sizeof(iscan_buf_t)); - - if (!iscanbuf_prv) - iscan_chain = 0; - } - dhd_iscan_unlock(); -} - -iscan_buf_t * -dhd_iscan_result_buf(void) -{ - return iscan_chain; -} - - - -/* -* print scan cache -* print partial iscan_skip list differently -*/ -int -dhd_iscan_print_cache(iscan_buf_t *iscan_skip) -{ - int i = 0, l = 0; - iscan_buf_t *iscan_cur; - wl_iscan_results_t *list; - wl_scan_results_t *results; - wl_bss_info_t UNALIGNED *bi; - - dhd_iscan_lock(); - - iscan_cur = dhd_iscan_result_buf(); - - while (iscan_cur) { - list = (wl_iscan_results_t *)iscan_cur->iscan_buf; - if (!list) - break; - - results = (wl_scan_results_t *)&list->results; - if (!results) - break; - - if (results->version != WL_BSS_INFO_VERSION) { - DHD_ISCAN(("%s: results->version %d != WL_BSS_INFO_VERSION\n", - __FUNCTION__, results->version)); - goto done; - } - - bi = results->bss_info; - for (i = 0; i < results->count; i++) { - if (!bi) - break; - - DHD_ISCAN(("%s[%2.2d:%2.2d] %X:%X:%X:%X:%X:%X\n", - iscan_cur != iscan_skip?"BSS":"bss", l, i, - bi->BSSID.octet[0], bi->BSSID.octet[1], bi->BSSID.octet[2], - bi->BSSID.octet[3], bi->BSSID.octet[4], bi->BSSID.octet[5])); - - bi = (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)); - } - iscan_cur = iscan_cur->next; - l++; - } - -done: - dhd_iscan_unlock(); - return 0; -} - -/* -* delete disappeared AP from specific scan cache but skip partial list in iscan_skip -*/ -int -dhd_iscan_delete_bss(void *dhdp, void *addr, iscan_buf_t *iscan_skip) -{ - int i = 0, j = 0, l = 0; - iscan_buf_t *iscan_cur; - wl_iscan_results_t *list; - wl_scan_results_t *results; - wl_bss_info_t UNALIGNED *bi, *bi_new, *bi_next; - - uchar *s_addr = addr; - - dhd_iscan_lock(); - DHD_ISCAN(("%s: BSS to remove %X:%X:%X:%X:%X:%X\n", - __FUNCTION__, s_addr[0], s_addr[1], s_addr[2], - s_addr[3], s_addr[4], s_addr[5])); - - iscan_cur = dhd_iscan_result_buf(); - - while (iscan_cur) { - if (iscan_cur != iscan_skip) { - list = (wl_iscan_results_t *)iscan_cur->iscan_buf; - if (!list) - break; - - results = (wl_scan_results_t *)&list->results; - if (!results) - break; - - if (results->version != WL_BSS_INFO_VERSION) { - DHD_ERROR(("%s: results->version %d != WL_BSS_INFO_VERSION\n", - __FUNCTION__, results->version)); - goto done; - } - - bi = results->bss_info; - for (i = 0; i < results->count; i++) { - if (!bi) - break; - - if (!memcmp(bi->BSSID.octet, addr, ETHER_ADDR_LEN)) { - DHD_ISCAN(("%s: Del BSS[%2.2d:%2.2d] %X:%X:%X:%X:%X:%X\n", - __FUNCTION__, l, i, bi->BSSID.octet[0], - bi->BSSID.octet[1], bi->BSSID.octet[2], - bi->BSSID.octet[3], bi->BSSID.octet[4], - bi->BSSID.octet[5])); - - bi_new = bi; - bi = (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)); -/* - if(bi && bi_new) { - bcopy(bi, bi_new, results->buflen - - dtoh32(bi_new->length)); - results->buflen -= dtoh32(bi_new->length); - } -*/ - results->buflen -= dtoh32(bi_new->length); - results->count--; - - for (j = i; j < results->count; j++) { - if (bi && bi_new) { - DHD_ISCAN(("%s: Moved up BSS[%2.2d:%2.2d]" - "%X:%X:%X:%X:%X:%X\n", - __FUNCTION__, l, j, bi->BSSID.octet[0], - bi->BSSID.octet[1], bi->BSSID.octet[2], - bi->BSSID.octet[3], bi->BSSID.octet[4], - bi->BSSID.octet[5])); - - bi_next = (wl_bss_info_t *)((uintptr)bi + - dtoh32(bi->length)); - bcopy(bi, bi_new, dtoh32(bi->length)); - bi_new = (wl_bss_info_t *)((uintptr)bi_new + - dtoh32(bi_new->length)); - bi = bi_next; - } - } - - if (results->count == 0) { - /* Prune now empty partial scan list */ - dhd_iscan_free_buf(dhdp, iscan_cur); - goto done; - } - break; - } - bi = (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)); - } - } - iscan_cur = iscan_cur->next; - l++; - } - -done: - dhd_iscan_unlock(); - return 0; -} - -int -dhd_iscan_remove_duplicates(void * dhdp, iscan_buf_t *iscan_cur) -{ - int i = 0; - wl_iscan_results_t *list; - wl_scan_results_t *results; - wl_bss_info_t UNALIGNED *bi, *bi_new, *bi_next; - - dhd_iscan_lock(); - - DHD_ISCAN(("%s: Scan cache before delete\n", - __FUNCTION__)); - dhd_iscan_print_cache(iscan_cur); - - if (!iscan_cur) - goto done; - - list = (wl_iscan_results_t *)iscan_cur->iscan_buf; - if (!list) - goto done; - - results = (wl_scan_results_t *)&list->results; - if (!results) - goto done; - - if (results->version != WL_BSS_INFO_VERSION) { - DHD_ERROR(("%s: results->version %d != WL_BSS_INFO_VERSION\n", - __FUNCTION__, results->version)); - goto done; - } - - bi = results->bss_info; - for (i = 0; i < results->count; i++) { - if (!bi) - break; - - DHD_ISCAN(("%s: Find dups for BSS[%2.2d] %X:%X:%X:%X:%X:%X\n", - __FUNCTION__, i, bi->BSSID.octet[0], bi->BSSID.octet[1], bi->BSSID.octet[2], - bi->BSSID.octet[3], bi->BSSID.octet[4], bi->BSSID.octet[5])); - - dhd_iscan_delete_bss(dhdp, bi->BSSID.octet, iscan_cur); - - bi = (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)); - } - -done: - DHD_ISCAN(("%s: Scan cache after delete\n", __FUNCTION__)); - dhd_iscan_print_cache(iscan_cur); - dhd_iscan_unlock(); - return 0; -} - -void -dhd_iscan_ind_scan_confirm(void *dhdp, bool status) -{ - - dhd_ind_scan_confirm(dhdp, status); -} - -int -dhd_iscan_request(void * dhdp, uint16 action) -{ - int rc; - wl_iscan_params_t params; - dhd_pub_t *dhd = dhd_bus_pub(dhdp); - char buf[WLC_IOCTL_SMLEN]; - - - memset(¶ms, 0, sizeof(wl_iscan_params_t)); - memcpy(¶ms.params.bssid, ðer_bcast, ETHER_ADDR_LEN); - - params.params.bss_type = DOT11_BSSTYPE_ANY; - params.params.scan_type = DOT11_SCANTYPE_ACTIVE; - - params.params.nprobes = htod32(-1); - params.params.active_time = htod32(-1); - params.params.passive_time = htod32(-1); - params.params.home_time = htod32(-1); - params.params.channel_num = htod32(0); - - params.version = htod32(ISCAN_REQ_VERSION); - params.action = htod16(action); - params.scan_duration = htod16(0); - - bcm_mkiovar("iscan", (char *)¶ms, sizeof(wl_iscan_params_t), buf, WLC_IOCTL_SMLEN); - rc = dhd_wl_ioctl(dhdp, WLC_SET_VAR, buf, WLC_IOCTL_SMLEN); - - return rc; -} - -static int -dhd_iscan_get_partial_result(void *dhdp, uint *scan_count) -{ - wl_iscan_results_t *list_buf; - wl_iscan_results_t list; - wl_scan_results_t *results; - iscan_buf_t *iscan_cur; - int status = -1; - dhd_pub_t *dhd = dhd_bus_pub(dhdp); - int rc; - - - iscan_cur = dhd_iscan_allocate_buf(dhd, &iscan_chain); - if (!iscan_cur) { - DHD_ERROR(("%s: Failed to allocate node\n", __FUNCTION__)); - dhd_iscan_free_buf(dhdp, 0); - dhd_iscan_request(dhdp, WL_SCAN_ACTION_ABORT); - goto fail; - } - - dhd_iscan_lock(); - - memset(iscan_cur->iscan_buf, 0, WLC_IW_ISCAN_MAXLEN); - list_buf = (wl_iscan_results_t*)iscan_cur->iscan_buf; - results = &list_buf->results; - results->buflen = WL_ISCAN_RESULTS_FIXED_SIZE; - results->version = 0; - results->count = 0; - - memset(&list, 0, sizeof(list)); - list.results.buflen = htod32(WLC_IW_ISCAN_MAXLEN); - bcm_mkiovar("iscanresults", (char *)&list, WL_ISCAN_RESULTS_FIXED_SIZE, - iscan_cur->iscan_buf, WLC_IW_ISCAN_MAXLEN); - rc = dhd_wl_ioctl(dhdp, WLC_GET_VAR, iscan_cur->iscan_buf, WLC_IW_ISCAN_MAXLEN); - - results->buflen = dtoh32(results->buflen); - results->version = dtoh32(results->version); - *scan_count = results->count = dtoh32(results->count); - status = dtoh32(list_buf->status); - - dhd_iscan_unlock(); - - if (!(*scan_count)) - dhd_iscan_free_buf(dhdp, iscan_cur); - else - dhd_iscan_remove_duplicates(dhdp, iscan_cur); - - -fail: - return status; -} - -#endif - -/* Function to estimate possible DTIM_SKIP value */ -int dhd_get_dtim_skip(dhd_pub_t *dhd) -{ - int bcn_li_dtim; - char buf[128]; - int ret; - int dtim_assoc = 0; - - if ((dhd->dtim_skip == 0) || (dhd->dtim_skip == 1)) - bcn_li_dtim = 3; - else - bcn_li_dtim = dhd->dtim_skip; - - /* Read DTIM value if associated */ - memset(buf, 0, sizeof(buf)); - bcm_mkiovar("dtim_assoc", 0, 0, buf, sizeof(buf)); - if ((ret = dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, buf, sizeof(buf))) < 0) { - DHD_ERROR(("%s failed code %d\n", __FUNCTION__, ret)); - bcn_li_dtim = 1; - goto exit; - } - else - dtim_assoc = dtoh32(*(int *)buf); - - DHD_ERROR(("%s bcn_li_dtim=%d DTIM=%d Listen=%d\n", \ - __FUNCTION__, bcn_li_dtim, dtim_assoc, LISTEN_INTERVAL)); - - /* if not assocated just eixt */ - if (dtim_assoc == 0) { - goto exit; - } - - /* check if sta listen interval fits into AP dtim */ - if (dtim_assoc > LISTEN_INTERVAL) { - /* AP DTIM to big for our Listen Interval : no dtim skiping */ - bcn_li_dtim = 1; - DHD_ERROR(("%s DTIM=%d > Listen=%d : too big ...\n", \ - __FUNCTION__, dtim_assoc, LISTEN_INTERVAL)); - goto exit; - } - - if ((bcn_li_dtim * dtim_assoc) > LISTEN_INTERVAL) { - /* Round up dtim_skip to fit into STAs Listen Interval */ - bcn_li_dtim = (int)(LISTEN_INTERVAL / dtim_assoc); - DHD_TRACE(("%s agjust dtim_skip as %d\n", __FUNCTION__, bcn_li_dtim)); - } - -exit: - return bcn_li_dtim; -} - -#ifdef PNO_SUPPORT -int dhd_pno_clean(dhd_pub_t *dhd) -{ - char iovbuf[128]; - int pfn_enabled = 0; - int iov_len = 0; - int ret; - - /* Disable pfn */ - iov_len = bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf, sizeof(iovbuf)); - if ((ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf))) >= 0) { - /* clear pfn */ - iov_len = bcm_mkiovar("pfnclear", 0, 0, iovbuf, sizeof(iovbuf)); - if (iov_len) { - if ((ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, iov_len)) < 0) { - DHD_ERROR(("%s failed code %d\n", __FUNCTION__, ret)); - } - } - else { - ret = -1; - DHD_ERROR(("%s failed code %d\n", __FUNCTION__, iov_len)); - } - } - else - DHD_ERROR(("%s failed code %d\n", __FUNCTION__, ret)); - - return ret; -} - -int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled) -{ - char iovbuf[128]; - int ret = -1; - - if ((!dhd) && ((pfn_enabled != 0) || (pfn_enabled != 1))) { - DHD_ERROR(("%s error exit\n", __FUNCTION__)); - return ret; - } - - /* Enable/disable PNO */ - if ((ret = bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf, sizeof(iovbuf))) > 0) { - if ((ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf))) < 0) { - DHD_ERROR(("%s failed for error=%d\n", __FUNCTION__, ret)); - return ret; - } - else { - dhd->pno_enable = pfn_enabled; - DHD_TRACE(("%s set pno as %d\n", __FUNCTION__, dhd->pno_enable)); - } - } - else DHD_ERROR(("%s failed err=%d\n", __FUNCTION__, ret)); - - return ret; -} - -/* Function to execute combined scan */ -int -dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr) -{ - int err = -1; - char iovbuf[128]; - int k, i; - wl_pfn_param_t pfn_param; - wl_pfn_t pfn_element; - - DHD_TRACE(("%s nssid=%d nchan=%d\n", __FUNCTION__, nssid, scan_fr)); - - if ((!dhd) && (!ssids_local)) { - DHD_ERROR(("%s error exit\n", __FUNCTION__)); - err = -1; - } - - /* Check for broadcast ssid */ - for (k = 0; k < nssid; k++) { - if (!ssids_local[k].SSID_len) { - DHD_ERROR(("%d: Broadcast SSID is ilegal for PNO setting\n", k)); - return err; - } - } -/* #define PNO_DUMP 1 */ -#ifdef PNO_DUMP - { - int j; - for (j = 0; j < nssid; j++) { - DHD_ERROR(("%d: scan for %s size =%d\n", j, - ssids_local[j].SSID, ssids_local[j].SSID_len)); - } - } -#endif /* PNO_DUMP */ - - /* clean up everything */ - if ((err = dhd_pno_clean(dhd)) < 0) { - DHD_ERROR(("%s failed error=%d\n", __FUNCTION__, err)); - return err; - } - memset(&pfn_param, 0, sizeof(pfn_param)); - memset(&pfn_element, 0, sizeof(pfn_element)); - - /* set pfn parameters */ - pfn_param.version = htod32(PFN_VERSION); - pfn_param.flags = htod16((PFN_LIST_ORDER << SORT_CRITERIA_BIT)); - - /* set up pno scan fr */ - if (scan_fr != 0) - pfn_param.scan_freq = htod32(scan_fr); - - if (pfn_param.scan_freq > PNO_SCAN_MAX_FW) { - DHD_ERROR(("%s pno freq above %d sec\n", __FUNCTION__, PNO_SCAN_MAX_FW)); - return err; - } - - bcm_mkiovar("pfn_set", (char *)&pfn_param, sizeof(pfn_param), iovbuf, sizeof(iovbuf)); - dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); - - /* set all pfn ssid */ - for (i = 0; i < nssid; i++) { - - pfn_element.bss_type = htod32(DOT11_BSSTYPE_INFRASTRUCTURE); - pfn_element.auth = (DOT11_OPEN_SYSTEM); - pfn_element.wpa_auth = htod32(WPA_AUTH_PFN_ANY); - pfn_element.wsec = htod32(0); - pfn_element.infra = htod32(1); - - memcpy((char *)pfn_element.ssid.SSID, ssids_local[i].SSID, ssids_local[i].SSID_len); - pfn_element.ssid.SSID_len = ssids_local[i].SSID_len; - - if ((err = - bcm_mkiovar("pfn_add", (char *)&pfn_element, - sizeof(pfn_element), iovbuf, sizeof(iovbuf))) > 0) { - if ((err = - dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf))) < 0) { - DHD_ERROR(("%s failed for i=%d error=%d\n", - __FUNCTION__, i, err)); - return err; - } - else - DHD_ERROR(("%s set OK with PNO time=%d\n", __FUNCTION__, \ - pfn_param.scan_freq)); - } - else DHD_ERROR(("%s failed err=%d\n", __FUNCTION__, err)); - } - - /* Enable PNO */ - /* dhd_pno_enable(dhd, 1); */ - return err; -} - -int dhd_pno_get_status(dhd_pub_t *dhd) -{ - int ret = -1; - - if (!dhd) - return ret; - else - return (dhd->pno_enable); -} - -#endif /* PNO_SUPPORT */ - -#if defined(KEEP_ALIVE) -int dhd_keep_alive_onoff(dhd_pub_t *dhd, int ka_on) -{ - char buf[256]; - char *buf_ptr = buf; - wl_keep_alive_pkt_t keep_alive_pkt; - char * str; - int str_len, buf_len; - int res = 0; - int keep_alive_period = KEEP_ALIVE_PERIOD; /* in ms */ - - DHD_TRACE(("%s: ka:%d\n", __FUNCTION__, ka_on)); - - if (ka_on) { /* on suspend */ - keep_alive_pkt.period_msec = keep_alive_period; - - } else { - /* on resume, turn off keep_alive packets */ - keep_alive_pkt.period_msec = 0; - } - - /* IOC var name */ - str = "keep_alive"; - str_len = strlen(str); - strncpy(buf, str, str_len); - buf[str_len] = '\0'; - buf_len = str_len + 1; - - /* set ptr to IOCTL payload after the var name */ - buf_ptr += buf_len; /* include term Z */ - - /* copy Keep-alive attributes from local var keep_alive_pkt */ - str = NULL_PKT_STR; - keep_alive_pkt.len_bytes = strlen(str); - - memcpy(buf_ptr, &keep_alive_pkt, WL_KEEP_ALIVE_FIXED_LEN); - buf_ptr += WL_KEEP_ALIVE_FIXED_LEN; - - /* copy packet data */ - memcpy(buf_ptr, str, keep_alive_pkt.len_bytes); - buf_len += (WL_KEEP_ALIVE_FIXED_LEN + keep_alive_pkt.len_bytes); - - res = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, buf_len); - return res; -} -#endif /* defined(KEEP_ALIVE) */ - -#if defined(CSCAN) - -/* Androd ComboSCAN support */ -/* - * data parsing from ComboScan tlv list -*/ -int -wl_iw_parse_data_tlv(char** list_str, void *dst, int dst_size, const char token, - int input_size, int *bytes_left) -{ - char* str = *list_str; - uint16 short_temp; - uint32 int_temp; - - if ((list_str == NULL) || (*list_str == NULL) ||(bytes_left == NULL) || (*bytes_left < 0)) { - DHD_ERROR(("%s error paramters\n", __FUNCTION__)); - return -1; - } - - /* Clean all dest bytes */ - memset(dst, 0, dst_size); - while (*bytes_left > 0) { - - if (str[0] != token) { - DHD_TRACE(("%s NOT Type=%d get=%d left_parse=%d \n", - __FUNCTION__, token, str[0], *bytes_left)); - return -1; - } - - *bytes_left -= 1; - str += 1; - - if (input_size == 1) { - memcpy(dst, str, input_size); - } - else if (input_size == 2) { - memcpy(dst, (char *)htod16(memcpy(&short_temp, str, input_size)), - input_size); - } - else if (input_size == 4) { - memcpy(dst, (char *)htod32(memcpy(&int_temp, str, input_size)), - input_size); - } - - *bytes_left -= input_size; - str += input_size; - *list_str = str; - return 1; - } - return 1; -} - -/* - * channel list parsing from cscan tlv list -*/ -int -wl_iw_parse_channel_list_tlv(char** list_str, uint16* channel_list, - int channel_num, int *bytes_left) -{ - char* str = *list_str; - int idx = 0; - - if ((list_str == NULL) || (*list_str == NULL) ||(bytes_left == NULL) || (*bytes_left < 0)) { - DHD_ERROR(("%s error paramters\n", __FUNCTION__)); - return -1; - } - - while (*bytes_left > 0) { - - if (str[0] != CSCAN_TLV_TYPE_CHANNEL_IE) { - *list_str = str; - DHD_TRACE(("End channel=%d left_parse=%d %d\n", idx, *bytes_left, str[0])); - return idx; - } - /* Get proper CSCAN_TLV_TYPE_CHANNEL_IE */ - *bytes_left -= 1; - str += 1; - - if (str[0] == 0) { - /* All channels */ - channel_list[idx] = 0x0; - } - else { - channel_list[idx] = (uint16)str[0]; - DHD_TRACE(("%s channel=%d \n", __FUNCTION__, channel_list[idx])); - } - *bytes_left -= 1; - str += 1; - - if (idx++ > 255) { - DHD_ERROR(("%s Too many channels \n", __FUNCTION__)); - return -1; - } - } - - *list_str = str; - return idx; -} - -/* - * SSIDs list parsing from cscan tlv list - */ -int -wl_iw_parse_ssid_list_tlv(char** list_str, wlc_ssid_t* ssid, int max, int *bytes_left) -{ - char* str = *list_str; - int idx = 0; - - if ((list_str == NULL) || (*list_str == NULL) || (*bytes_left < 0)) { - DHD_ERROR(("%s error paramters\n", __FUNCTION__)); - return -1; - } - - while (*bytes_left > 0) { - - if (str[0] != CSCAN_TLV_TYPE_SSID_IE) { - *list_str = str; - DHD_TRACE(("nssid=%d left_parse=%d %d\n", idx, *bytes_left, str[0])); - return idx; - } - - /* Get proper CSCAN_TLV_TYPE_SSID_IE */ - *bytes_left -= 1; - str += 1; - - if (str[0] == 0) { - /* Broadcast SSID */ - ssid[idx].SSID_len = 0; - memset((char*)ssid[idx].SSID, 0x0, DOT11_MAX_SSID_LEN); - *bytes_left -= 1; - str += 1; - - DHD_TRACE(("BROADCAST SCAN left=%d\n", *bytes_left)); - } - else if (str[0] <= DOT11_MAX_SSID_LEN) { - /* Get proper SSID size */ - ssid[idx].SSID_len = str[0]; - *bytes_left -= 1; - str += 1; - - /* Get SSID */ - if (ssid[idx].SSID_len > *bytes_left) { - DHD_ERROR(("%s out of memory range len=%d but left=%d\n", - __FUNCTION__, ssid[idx].SSID_len, *bytes_left)); - return -1; - } - - memcpy((char*)ssid[idx].SSID, str, ssid[idx].SSID_len); - - *bytes_left -= ssid[idx].SSID_len; - str += ssid[idx].SSID_len; - - DHD_TRACE(("%s :size=%d left=%d\n", - (char*)ssid[idx].SSID, ssid[idx].SSID_len, *bytes_left)); - } - else { - DHD_ERROR(("### SSID size more that %d\n", str[0])); - return -1; - } - - if (idx++ > max) { - DHD_ERROR(("%s number of SSIDs more that %d\n", __FUNCTION__, idx)); - return -1; - } - } - - *list_str = str; - return idx; -} - -/* Parse a comma-separated list from list_str into ssid array, starting - * at index idx. Max specifies size of the ssid array. Parses ssids - * and returns updated idx; if idx >= max not all fit, the excess have - * not been copied. Returns -1 on empty string, or on ssid too long. - */ -int -wl_iw_parse_ssid_list(char** list_str, wlc_ssid_t* ssid, int idx, int max) -{ - char* str, *ptr; - - if ((list_str == NULL) || (*list_str == NULL)) - return -1; - - for (str = *list_str; str != NULL; str = ptr) { - - /* check for next TAG */ - if (!strncmp(str, GET_CHANNEL, strlen(GET_CHANNEL))) { - *list_str = str + strlen(GET_CHANNEL); - return idx; - } - - if ((ptr = strchr(str, ',')) != NULL) { - *ptr++ = '\0'; - } - - if (strlen(str) > DOT11_MAX_SSID_LEN) { - DHD_ERROR(("ssid <%s> exceeds %d\n", str, DOT11_MAX_SSID_LEN)); - return -1; - } - - if (strlen(str) == 0) - ssid[idx].SSID_len = 0; - - if (idx < max) { - strcpy((char*)ssid[idx].SSID, str); - ssid[idx].SSID_len = strlen(str); - } - idx++; - } - return idx; -} - -/* - * Parse channel list from iwpriv CSCAN - */ -int -wl_iw_parse_channel_list(char** list_str, uint16* channel_list, int channel_num) -{ - int num; - int val; - char* str; - char* endptr = NULL; - - if ((list_str == NULL)||(*list_str == NULL)) - return -1; - - str = *list_str; - num = 0; - while (strncmp(str, GET_NPROBE, strlen(GET_NPROBE))) { - val = (int)strtoul(str, &endptr, 0); - if (endptr == str) { - printf("could not parse channel number starting at" - " substring \"%s\" in list:\n%s\n", - str, *list_str); - return -1; - } - str = endptr + strspn(endptr, " ,"); - - if (num == channel_num) { - DHD_ERROR(("too many channels (more than %d) in channel list:\n%s\n", - channel_num, *list_str)); - return -1; - } - - channel_list[num++] = (uint16)val; - } - *list_str = str; - return num; -} - -#endif diff --git a/drivers/net/wireless/bcm4319/dhd_custom_gpio.c b/drivers/net/wireless/bcm4319/dhd_custom_gpio.c deleted file mode 100644 index 8c6ec470b8bd..000000000000 --- a/drivers/net/wireless/bcm4319/dhd_custom_gpio.c +++ /dev/null @@ -1,179 +0,0 @@ -/* -* Customer code to add GPIO control during WLAN start/stop -* Copyright (C) 1999-2010, Broadcom Corporation -* -* Unless you and Broadcom execute a separate written software license -* agreement governing use of this software, this software is licensed to you -* under the terms of the GNU General Public License version 2 (the "GPL"), -* available at http://www.broadcom.com/licenses/GPLv2.php, with the -* following added to such license: -* -* As a special exception, the copyright holders of this software give you -* permission to link this software with independent modules, and to copy and -* distribute the resulting executable under terms of your choice, provided that -* you also meet, for each linked independent module, the terms and conditions of -* the license of that module. An independent module is a module which is not -* derived from this software. The special exception does not apply to any -* modifications of the software. -* -* Notwithstanding the above, under no circumstances may you combine this -* software in any way with any other Broadcom software provided under a license -* other than the GPL, without Broadcom's express prior written consent. -* -* $Id: dhd_custom_gpio.c,v 1.1.4.8.4.1 2010/09/02 23:13:16 Exp $ -*/ - - -#include -#include -#include -#include - -#include -#include - -#include -#include - -#define WL_ERROR(x) printf x -#define WL_TRACE(x) - -#ifdef CUSTOMER_HW -extern void bcm_wlan_power_off(int); -extern void bcm_wlan_power_on(int); -#endif /* CUSTOMER_HW */ -#ifdef CUSTOMER_HW2 -int wifi_set_carddetect(int on); -int wifi_set_power(int on, unsigned long msec); -int wifi_get_irq_number(unsigned long *irq_flags_ptr); -int wifi_get_mac_addr(unsigned char *buf); -#endif - -#if defined(OOB_INTR_ONLY) - -#if defined(BCMLXSDMMC) -extern int sdioh_mmc_irq(int irq); -#endif /* (BCMLXSDMMC) */ - -#ifdef CUSTOMER_HW3 -#include -#endif - -/* Customer specific Host GPIO defintion */ -static int dhd_oob_gpio_num = -1; /* GG 19 */ - -module_param(dhd_oob_gpio_num, int, 0644); -MODULE_PARM_DESC(dhd_oob_gpio_num, "DHD oob gpio number"); - -int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr) -{ - int host_oob_irq = 0; - -#ifdef CUSTOMER_HW2 - host_oob_irq = wifi_get_irq_number(irq_flags_ptr); - -#else /* for NOT CUSTOMER_HW2 */ -#if defined(CUSTOM_OOB_GPIO_NUM) - if (dhd_oob_gpio_num < 0) { - dhd_oob_gpio_num = CUSTOM_OOB_GPIO_NUM; - } -#endif - - if (dhd_oob_gpio_num < 0) { - WL_ERROR(("%s: ERROR customer specific Host GPIO is NOT defined \n", - __FUNCTION__)); - return (dhd_oob_gpio_num); - } - - WL_ERROR(("%s: customer specific Host GPIO number is (%d)\n", - __FUNCTION__, dhd_oob_gpio_num)); - -#if defined CUSTOMER_HW - host_oob_irq = MSM_GPIO_TO_INT(dhd_oob_gpio_num); -#elif defined CUSTOMER_HW3 - gpio_request(dhd_oob_gpio_num, "oob irq"); - host_oob_irq = gpio_to_irq(dhd_oob_gpio_num); - gpio_direction_input(dhd_oob_gpio_num); -#endif /* CUSTOMER_HW */ -#endif /* CUSTOMER_HW2 */ - - return (host_oob_irq); -} -#endif /* defined(OOB_INTR_ONLY) */ - -/* Customer function to control hw specific wlan gpios */ -void -dhd_customer_gpio_wlan_ctrl(int onoff) -{ - switch (onoff) { - case WLAN_RESET_OFF: - WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n", - __FUNCTION__)); -#ifdef CUSTOMER_HW - bcm_wlan_power_off(2); -#endif /* CUSTOMER_HW */ -#ifdef CUSTOMER_HW2 - wifi_set_power(0, 0); -#endif - WL_ERROR(("=========== WLAN placed in RESET ========\n")); - break; - - case WLAN_RESET_ON: - WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n", - __FUNCTION__)); -#ifdef CUSTOMER_HW - bcm_wlan_power_on(2); -#endif /* CUSTOMER_HW */ -#ifdef CUSTOMER_HW2 - wifi_set_power(1, 0); -#endif - WL_ERROR(("=========== WLAN going back to live ========\n")); - break; - - case WLAN_POWER_OFF: - WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n", - __FUNCTION__)); -#ifdef CUSTOMER_HW - bcm_wlan_power_off(1); -#endif /* CUSTOMER_HW */ - break; - - case WLAN_POWER_ON: - WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n", - __FUNCTION__)); -#ifdef CUSTOMER_HW - bcm_wlan_power_on(1); - /* Lets customer power to get stable */ - OSL_DELAY(50); -#endif /* CUSTOMER_HW */ - break; - } -} - -#ifdef GET_CUSTOM_MAC_ENABLE -/* Function to get custom MAC address */ -int -dhd_custom_get_mac_address(unsigned char *buf) -{ - int ret = 0; - - WL_TRACE(("%s Enter\n", __FUNCTION__)); - if (!buf) - return -EINVAL; - - /* Customer access to MAC address stored outside of DHD driver */ -#ifdef CUSTOMER_HW2 - ret = wifi_get_mac_addr(buf); -#endif - -#ifdef EXAMPLE_GET_MAC - /* EXAMPLE code */ - { - struct ether_addr ea_example = {{0x00, 0x11, 0x22, 0x33, 0x44, 0xFF}}; - bcopy((char *)&ea_example, buf, sizeof(struct ether_addr)); - } -#endif /* EXAMPLE_GET_MAC */ - - return ret; -} -#endif /* GET_CUSTOM_MAC_ENABLE */ diff --git a/drivers/net/wireless/bcm4319/dhd_dbg.h b/drivers/net/wireless/bcm4319/dhd_dbg.h deleted file mode 100644 index b48c1d70f144..000000000000 --- a/drivers/net/wireless/bcm4319/dhd_dbg.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Debug/trace/assert driver definitions for Dongle Host Driver. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: dhd_dbg.h,v 1.5.6.2.4.2.14.10 2010/05/21 21:49:38 Exp $ - */ - -#ifndef _dhd_dbg_ -#define _dhd_dbg_ - -#ifdef DHD_DEBUG - -#define DHD_ERROR(args) do {if ((dhd_msg_level & DHD_ERROR_VAL) && (net_ratelimit())) \ - printf args;} while (0) -#define DHD_TRACE(args) do {if (dhd_msg_level & DHD_TRACE_VAL) printf args;} while (0) -#define DHD_INFO(args) do {if (dhd_msg_level & DHD_INFO_VAL) printf args;} while (0) -#define DHD_DATA(args) do {if (dhd_msg_level & DHD_DATA_VAL) printf args;} while (0) -#define DHD_CTL(args) do {if (dhd_msg_level & DHD_CTL_VAL) printf args;} while (0) -#define DHD_TIMER(args) do {if (dhd_msg_level & DHD_TIMER_VAL) printf args;} while (0) -#define DHD_HDRS(args) do {if (dhd_msg_level & DHD_HDRS_VAL) printf args;} while (0) -#define DHD_BYTES(args) do {if (dhd_msg_level & DHD_BYTES_VAL) printf args;} while (0) -#define DHD_INTR(args) do {if (dhd_msg_level & DHD_INTR_VAL) printf args;} while (0) -#define DHD_GLOM(args) do {if (dhd_msg_level & DHD_GLOM_VAL) printf args;} while (0) -#define DHD_EVENT(args) do {if (dhd_msg_level & DHD_EVENT_VAL) printf args;} while (0) -#define DHD_BTA(args) do {if (dhd_msg_level & DHD_BTA_VAL) printf args;} while (0) -#define DHD_ISCAN(args) do {if (dhd_msg_level & DHD_ISCAN_VAL) printf args;} while (0) - -#define DHD_ERROR_ON() (dhd_msg_level & DHD_ERROR_VAL) -#define DHD_TRACE_ON() (dhd_msg_level & DHD_TRACE_VAL) -#define DHD_INFO_ON() (dhd_msg_level & DHD_INFO_VAL) -#define DHD_DATA_ON() (dhd_msg_level & DHD_DATA_VAL) -#define DHD_CTL_ON() (dhd_msg_level & DHD_CTL_VAL) -#define DHD_TIMER_ON() (dhd_msg_level & DHD_TIMER_VAL) -#define DHD_HDRS_ON() (dhd_msg_level & DHD_HDRS_VAL) -#define DHD_BYTES_ON() (dhd_msg_level & DHD_BYTES_VAL) -#define DHD_INTR_ON() (dhd_msg_level & DHD_INTR_VAL) -#define DHD_GLOM_ON() (dhd_msg_level & DHD_GLOM_VAL) -#define DHD_EVENT_ON() (dhd_msg_level & DHD_EVENT_VAL) -#define DHD_BTA_ON() (dhd_msg_level & DHD_BTA_VAL) -#define DHD_ISCAN_ON() (dhd_msg_level & DHD_ISCAN_VAL) - -#else /* DHD_DEBUG */ - -#define DHD_ERROR(args) do {if (net_ratelimit()) printf args;} while (0) -#define DHD_TRACE(args) -#define DHD_INFO(args) -#define DHD_DATA(args) -#define DHD_CTL(args) -#define DHD_TIMER(args) -#define DHD_HDRS(args) -#define DHD_BYTES(args) -#define DHD_INTR(args) -#define DHD_GLOM(args) -#define DHD_EVENT(args) -#define DHD_BTA(args) -#define DHD_ISCAN(args) - -#define DHD_ERROR_ON() 0 -#define DHD_TRACE_ON() 0 -#define DHD_INFO_ON() 0 -#define DHD_DATA_ON() 0 -#define DHD_CTL_ON() 0 -#define DHD_TIMER_ON() 0 -#define DHD_HDRS_ON() 0 -#define DHD_BYTES_ON() 0 -#define DHD_INTR_ON() 0 -#define DHD_GLOM_ON() 0 -#define DHD_EVENT_ON() 0 -#define DHD_BTA_ON() 0 -#define DHD_ISCAN_ON() 0 -#endif /* DHD_DEBUG */ - -#define DHD_LOG(args) - -#define DHD_NONE(args) -extern int dhd_msg_level; - -/* Defines msg bits */ -#include - -#endif /* _dhd_dbg_ */ diff --git a/drivers/net/wireless/bcm4319/dhd_linux.c b/drivers/net/wireless/bcm4319/dhd_linux.c deleted file mode 100644 index edfbc1080479..000000000000 --- a/drivers/net/wireless/bcm4319/dhd_linux.c +++ /dev/null @@ -1,3343 +0,0 @@ -/* - * Broadcom Dongle Host Driver (DHD), Linux-specific network interface - * Basically selected code segments from usb-cdc.c and usb-rndis.c - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: dhd_linux.c,v 1.65.4.9.2.12.2.104.4.35 2010/11/17 03:13:21 Exp $ - */ - -#ifdef CONFIG_WIFI_CONTROL_FUNC -#include -#endif -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_HAS_WAKELOCK -#include -#endif -#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) -//#include -#include - -struct semaphore wifi_control_sem; - -struct dhd_bus *g_bus; - -extern void bcm4329_power_save_exit(void); -extern void bcm4329_power_save_init(void); - -static struct wifi_platform_data *wifi_control_data = NULL; -static struct resource *wifi_irqres = NULL; - -int wifi_get_irq_number(unsigned long *irq_flags_ptr) -{ - if (wifi_irqres) { - *irq_flags_ptr = wifi_irqres->flags & IRQF_TRIGGER_MASK; - return (int)wifi_irqres->start; - } -#ifdef CUSTOM_OOB_GPIO_NUM - return CUSTOM_OOB_GPIO_NUM; -#else - return -1; -#endif -} - -int wifi_set_carddetect(int on) -{ - printk("%s = %d\n", __FUNCTION__, on); - if (wifi_control_data && wifi_control_data->set_carddetect) { - wifi_control_data->set_carddetect(on); - } - return 0; -} - -int wifi_set_power(int on, unsigned long msec) -{ - printk("%s = %d\n", __FUNCTION__, on); - if (wifi_control_data && wifi_control_data->set_power) { - wifi_control_data->set_power(on); - } - if (msec) - mdelay(msec); - return 0; -} - -int wifi_set_reset(int on, unsigned long msec) -{ - DHD_TRACE(("%s = %d\n", __FUNCTION__, on)); - if (wifi_control_data && wifi_control_data->set_reset) { - wifi_control_data->set_reset(on); - } - if (msec) - mdelay(msec); - return 0; -} - -int wifi_get_mac_addr(unsigned char *buf) -{ - DHD_TRACE(("%s\n", __FUNCTION__)); - if (!buf) - return -EINVAL; - if (wifi_control_data && wifi_control_data->get_mac_addr) { - return wifi_control_data->get_mac_addr(buf); - } - return -EOPNOTSUPP; -} - -static int wifi_probe(struct platform_device *pdev) -{ - struct wifi_platform_data *wifi_ctrl = - (struct wifi_platform_data *)(pdev->dev.platform_data); - - DHD_TRACE(("## %s\n", __FUNCTION__)); - wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "bcm4329_wlan_irq"); - wifi_control_data = wifi_ctrl; - - /* make sure power-off */ - wifi_set_reset(0, 5); - wifi_set_power(0, 5); - - wifi_set_power(1, 50); /* Power On */ - wifi_set_reset(1, 150); /* Reset */ - wifi_set_carddetect(1); /* CardDetect (0->1) */ - - up(&wifi_control_sem); - return 0; -} - -static int wifi_remove(struct platform_device *pdev) -{ - struct wifi_platform_data *wifi_ctrl = - (struct wifi_platform_data *)(pdev->dev.platform_data); - - DHD_TRACE(("## %s\n", __FUNCTION__)); - wifi_control_data = wifi_ctrl; - - wifi_set_reset(0, 5); /* Reset */ - wifi_set_power(0, 5); /* Power Off */ - wifi_set_carddetect(0); /* CardDetect (1->0) */ - - up(&wifi_control_sem); - return 0; -} -static int wifi_suspend(struct platform_device *pdev, pm_message_t state) -{ - DHD_TRACE(("##> %s\n", __FUNCTION__)); - return 0; -} -static int wifi_resume(struct platform_device *pdev) -{ - DHD_TRACE(("##> %s\n", __FUNCTION__)); - return 0; -} - -static struct platform_driver wifi_device = { - .probe = wifi_probe, - .remove = wifi_remove, - .suspend = wifi_suspend, - .resume = wifi_resume, - .driver = { - .name = "bcm4329_wlan", - } -}; - -int wifi_add_dev(void) -{ - DHD_TRACE(("## Calling platform_driver_register\n")); - return platform_driver_register(&wifi_device); -} - -void wifi_del_dev(void) -{ - DHD_TRACE(("## Unregister platform_driver_register\n")); - platform_driver_unregister(&wifi_device); -} -#endif /* defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */ - - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) -#include -volatile bool dhd_mmc_suspend = FALSE; -DECLARE_WAIT_QUEUE_HEAD(dhd_dpc_wait); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */ - -#if defined(OOB_INTR_ONLY) -extern void dhd_enable_oob_intr(struct dhd_bus *bus, bool enable); -#endif /* defined(OOB_INTR_ONLY) */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) -MODULE_LICENSE("GPL v2"); -#endif /* LinuxVer */ - -#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 15) -const char * -print_tainted() -{ - return ""; -} -#endif /* LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 15) */ - -/* Linux wireless extension support */ -#if defined(CONFIG_WIRELESS_EXT) -#include -#endif /* defined(CONFIG_WIRELESS_EXT) */ - -extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len); - -#if defined(CONFIG_HAS_EARLYSUSPEND) -#include -#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */ - -#ifdef PKT_FILTER_SUPPORT -extern void dhd_pktfilter_offload_set(dhd_pub_t * dhd, char *arg); -extern void dhd_pktfilter_offload_enable(dhd_pub_t * dhd, char *arg, int enable, int master_mode); -#endif - -/* Interface control information */ -typedef struct dhd_if { - struct dhd_info *info; /* back pointer to dhd_info */ - /* OS/stack specifics */ - struct net_device *net; - struct net_device_stats stats; - int idx; /* iface idx in dongle */ - int state; /* interface state */ - uint subunit; /* subunit */ - uint8 mac_addr[ETHER_ADDR_LEN]; /* assigned MAC address */ - bool attached; /* Delayed attachment when unset */ - bool txflowcontrol; /* Per interface flow control indicator */ - char name[IFNAMSIZ+1]; /* linux interface name */ -} dhd_if_t; - -/* Local private structure (extension of pub) */ -typedef struct dhd_info { -#if defined(CONFIG_WIRELESS_EXT) - wl_iw_t iw; /* wireless extensions state (must be first) */ -#endif /* defined(CONFIG_WIRELESS_EXT) */ - - dhd_pub_t pub; - - /* OS/stack specifics */ - dhd_if_t *iflist[DHD_MAX_IFS]; - - struct mutex proto_sem; - wait_queue_head_t ioctl_resp_wait; - struct timer_list timer; - bool wd_timer_valid; - struct tasklet_struct tasklet; - spinlock_t sdlock; - spinlock_t txqlock; - spinlock_t dhd_lock; - - /* Thread based operation */ - bool threads_only; - struct mutex sdsem; - long watchdog_pid; - struct semaphore watchdog_sem; - struct completion watchdog_exited; - long dpc_pid; - struct semaphore dpc_sem; - struct completion dpc_exited; - - /* Wakelocks */ -#ifdef CONFIG_HAS_WAKELOCK - struct wake_lock wl_wifi; /* Wifi wakelock */ - struct wake_lock wl_rxwake; /* Wifi rx wakelock */ -#endif - spinlock_t wl_lock; - int wl_count; - int wl_packet; - - int hang_was_sent; /* flag that message was send at least once */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) - struct mutex wl_start_lock; /* mutex when START called to prevent any other Linux calls */ -#endif - /* Thread to issue ioctl for multicast */ - long sysioc_pid; - struct semaphore sysioc_sem; - struct completion sysioc_exited; - bool set_multicast; - bool set_macaddress; - struct ether_addr macvalue; - wait_queue_head_t ctrl_wait; - atomic_t pend_8021x_cnt; - -#ifdef CONFIG_HAS_EARLYSUSPEND - struct early_suspend early_suspend; -#endif /* CONFIG_HAS_EARLYSUSPEND */ -} dhd_info_t; - -/* Definitions to provide path to the firmware and nvram - * example nvram_path[MOD_PARAM_PATHLEN]="/projects/wlan/nvram.txt" - */ -char firmware_path[MOD_PARAM_PATHLEN]; -char nvram_path[MOD_PARAM_PATHLEN]; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) -struct semaphore dhd_registration_sem; -#define DHD_REGISTRATION_TIMEOUT 12000 /* msec : allowed time to finished dhd registration */ -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */ -/* load firmware and/or nvram values from the filesystem */ -module_param_string(firmware_path, firmware_path, MOD_PARAM_PATHLEN, 0); -module_param_string(nvram_path, nvram_path, MOD_PARAM_PATHLEN, 0); - -/* Error bits */ -module_param(dhd_msg_level, int, 0); - -/* Spawn a thread for system ioctls (set mac, set mcast) */ -uint dhd_sysioc = TRUE; -module_param(dhd_sysioc, uint, 0); - -/* Watchdog interval */ -uint dhd_watchdog_ms = 10; -module_param(dhd_watchdog_ms, uint, 0); - -#ifdef DHD_DEBUG -/* Console poll interval */ -uint dhd_console_ms = 0; -module_param(dhd_console_ms, uint, 0); -#endif /* DHD_DEBUG */ - -/* ARP offload agent mode : Enable ARP Host Auto-Reply and ARP Peer Auto-Reply */ -uint dhd_arp_mode = 0xb; -module_param(dhd_arp_mode, uint, 0); - -/* ARP offload enable */ -uint dhd_arp_enable = TRUE; -module_param(dhd_arp_enable, uint, 0); - -/* Global Pkt filter enable control */ -uint dhd_pkt_filter_enable = TRUE; -module_param(dhd_pkt_filter_enable, uint, 0); - -/* Pkt filter init setup */ -uint dhd_pkt_filter_init = 0; -module_param(dhd_pkt_filter_init, uint, 0); - -/* Pkt filter mode control */ -uint dhd_master_mode = TRUE; -module_param(dhd_master_mode, uint, 1); - -/* Watchdog thread priority, -1 to use kernel timer */ -int dhd_watchdog_prio = 97; -module_param(dhd_watchdog_prio, int, 0); - -/* DPC thread priority, -1 to use tasklet */ -int dhd_dpc_prio = 98; -module_param(dhd_dpc_prio, int, 0); - -/* DPC thread priority, -1 to use tasklet */ -extern int dhd_dongle_memsize; -module_param(dhd_dongle_memsize, int, 0); - -/* Control fw roaming */ -#ifdef CUSTOMER_HW2 -uint dhd_roam = 0; -#else -uint dhd_roam = 1; -#endif - -/* Control radio state */ -uint dhd_radio_up = 1; - -/* Network inteface name */ -char iface_name[IFNAMSIZ] = "wlan0"; -module_param_string(iface_name, iface_name, IFNAMSIZ, 0); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) -#define DAEMONIZE(a) daemonize(a); \ - allow_signal(SIGKILL); \ - allow_signal(SIGTERM); -#else /* Linux 2.4 (w/o preemption patch) */ -#define RAISE_RX_SOFTIRQ() \ - cpu_raise_softirq(smp_processor_id(), NET_RX_SOFTIRQ) -#define DAEMONIZE(a) daemonize(); \ - do { if (a) \ - strncpy(current->comm, a, MIN(sizeof(current->comm), (strlen(a) + 1))); \ - } while (0); -#endif /* LINUX_VERSION_CODE */ - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) -#define BLOCKABLE() (!in_atomic()) -#else -#define BLOCKABLE() (!in_interrupt()) -#endif - -/* The following are specific to the SDIO dongle */ - -/* IOCTL response timeout */ -int dhd_ioctl_timeout_msec = IOCTL_RESP_TIMEOUT; - -/* Idle timeout for backplane clock */ -int dhd_idletime = DHD_IDLETIME_TICKS; -module_param(dhd_idletime, int, 0); - -/* Use polling */ -uint dhd_poll = FALSE; -module_param(dhd_poll, uint, 0); - -/* Use interrupts */ -uint dhd_intr = TRUE; -module_param(dhd_intr, uint, 0); - -/* SDIO Drive Strength (in milliamps) */ -uint dhd_sdiod_drive_strength = 6; -module_param(dhd_sdiod_drive_strength, uint, 0); - -/* Tx/Rx bounds */ -extern uint dhd_txbound; -extern uint dhd_rxbound; -module_param(dhd_txbound, uint, 0); -module_param(dhd_rxbound, uint, 0); - -/* Deferred transmits */ -extern uint dhd_deferred_tx; -module_param(dhd_deferred_tx, uint, 0); - - - -#ifdef SDTEST -/* Echo packet generator (pkts/s) */ -uint dhd_pktgen = 0; -module_param(dhd_pktgen, uint, 0); - -/* Echo packet len (0 => sawtooth, max 2040) */ -uint dhd_pktgen_len = 0; -module_param(dhd_pktgen_len, uint, 0); -#endif - -/* Version string to report */ -#ifdef DHD_DEBUG -#ifndef SRCBASE -#define SRCBASE "drivers/net/wireless/bcm4329" -#endif -#define DHD_COMPILED "\nCompiled in " SRCBASE -#else -#define DHD_COMPILED -#endif - -static char dhd_version[] = "Dongle Host Driver, version " EPI_VERSION_STR -#ifdef DHD_DEBUG -"\nCompiled in " SRCBASE " on " __DATE__ " at " __TIME__ -#endif -; - - -#if defined(CONFIG_WIRELESS_EXT) -struct iw_statistics *dhd_get_wireless_stats(struct net_device *dev); -#endif /* defined(CONFIG_WIRELESS_EXT) */ - -static void dhd_dpc(ulong data); -/* forward decl */ -extern int dhd_wait_pend8021x(struct net_device *dev); - -#ifdef TOE -#ifndef BDC -#error TOE requires BDC -#endif /* !BDC */ -static int dhd_toe_get(dhd_info_t *dhd, int idx, uint32 *toe_ol); -static int dhd_toe_set(dhd_info_t *dhd, int idx, uint32 toe_ol); -#endif /* TOE */ - -static int dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata, - wl_event_msg_t *event_ptr, void **data_ptr); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) -static int dhd_sleep_pm_callback(struct notifier_block *nfb, unsigned long action, void *ignored) -{ - int ret = NOTIFY_DONE; - - switch (action) { - case PM_HIBERNATION_PREPARE: - case PM_SUSPEND_PREPARE: - dhd_mmc_suspend = TRUE; - ret = NOTIFY_OK; - break; - case PM_POST_HIBERNATION: - case PM_POST_SUSPEND: - dhd_mmc_suspend = FALSE; - ret = NOTIFY_OK; - break; - } - smp_mb(); - return ret; -} - -static struct notifier_block dhd_sleep_pm_notifier = { - .notifier_call = dhd_sleep_pm_callback, - .priority = 0 -}; -extern int register_pm_notifier(struct notifier_block *nb); -extern int unregister_pm_notifier(struct notifier_block *nb); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */ - -static void dhd_set_packet_filter(int value, dhd_pub_t *dhd) -{ -#ifdef PKT_FILTER_SUPPORT - DHD_TRACE(("%s: %d\n", __FUNCTION__, value)); - /* 1 - Enable packet filter, only allow unicast packet to send up */ - /* 0 - Disable packet filter */ - if (dhd_pkt_filter_enable) { - int i; - - for (i = 0; i < dhd->pktfilter_count; i++) { - dhd_pktfilter_offload_set(dhd, dhd->pktfilter[i]); - dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i], - value, dhd_master_mode); - } - } -#endif -} - - - -#if defined(CONFIG_HAS_EARLYSUSPEND) -static int dhd_set_suspend(int value, dhd_pub_t *dhd) -{ - int power_mode = PM_MAX; - /* wl_pkt_filter_enable_t enable_parm; */ - char iovbuf[32]; - int bcn_li_dtim = 3; -#ifdef CUSTOMER_HW2 - uint roamvar = 1; -#endif /* CUSTOMER_HW2 */ - - DHD_TRACE(("%s: enter, value = %d in_suspend = %d\n", - __FUNCTION__, value, dhd->in_suspend)); - - if (dhd && dhd->up) { - if (value && dhd->in_suspend) { - - /* Kernel suspended */ - DHD_TRACE(("%s: force extra Suspend setting \n", __FUNCTION__)); - - dhdcdc_set_ioctl(dhd, 0, WLC_SET_PM, - (char *)&power_mode, sizeof(power_mode)); - - /* Enable packet filter, only allow unicast packet to send up */ - dhd_set_packet_filter(1, dhd); - - /* if dtim skip setup as default force it to wake each thrid dtim - * for better power saving. - * Note that side effect is chance to miss BC/MC packet - */ - bcn_li_dtim = dhd_get_dtim_skip(dhd); - bcm_mkiovar("bcn_li_dtim", (char *)&bcn_li_dtim, - 4, iovbuf, sizeof(iovbuf)); - dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); -#ifdef CUSTOMER_HW2 - /* Disable build-in roaming during suspend */ - bcm_mkiovar("roam_off", (char *)&roamvar, 4, iovbuf, sizeof(iovbuf)); - dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); -#endif /* CUSTOMER_HW2 */ - - } else { - - /* Kernel resumed */ - DHD_TRACE(("%s: Remove extra suspend setting \n", __FUNCTION__)); - - power_mode = PM_FAST; - dhdcdc_set_ioctl(dhd, 0, WLC_SET_PM, (char *)&power_mode, - sizeof(power_mode)); - - /* disable pkt filter */ - dhd_set_packet_filter(0, dhd); - - /* restore pre-suspend setting for dtim_skip */ - bcm_mkiovar("bcn_li_dtim", (char *)&dhd->dtim_skip, - 4, iovbuf, sizeof(iovbuf)); - - dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); -#ifdef CUSTOMER_HW2 - roamvar = dhd_roam; - bcm_mkiovar("roam_off", (char *)&roamvar, 4, iovbuf, sizeof(iovbuf)); - dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); -#endif /* CUSTOMER_HW2 */ - } - } - - return 0; -} - -static void dhd_suspend_resume_helper(struct dhd_info *dhd, int val) -{ - dhd_pub_t *dhdp = &dhd->pub; - - dhd_os_wake_lock(dhdp); - dhd_os_proto_block(dhdp); - /* Set flag when early suspend was called */ - dhdp->in_suspend = val; - if (!dhdp->suspend_disable_flag) - dhd_set_suspend(val, dhdp); - dhd_os_proto_unblock(dhdp); - dhd_os_wake_unlock(dhdp); -} - -static void dhd_early_suspend(struct early_suspend *h) -{ - struct dhd_info *dhd = container_of(h, struct dhd_info, early_suspend); - - DHD_TRACE(("%s: enter\n", __FUNCTION__)); - - if (dhd) - dhd_suspend_resume_helper(dhd, 1); -} - -static void dhd_late_resume(struct early_suspend *h) -{ - struct dhd_info *dhd = container_of(h, struct dhd_info, early_suspend); - - DHD_TRACE(("%s: enter\n", __FUNCTION__)); - - if (dhd) - dhd_suspend_resume_helper(dhd, 0); -} -#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */ - -/* - * Generalized timeout mechanism. Uses spin sleep with exponential back-off until - * the sleep time reaches one jiffy, then switches over to task delay. Usage: - * - * dhd_timeout_start(&tmo, usec); - * while (!dhd_timeout_expired(&tmo)) - * if (poll_something()) - * break; - * if (dhd_timeout_expired(&tmo)) - * fatal(); - */ - -void -dhd_timeout_start(dhd_timeout_t *tmo, uint usec) -{ - tmo->limit = usec; - tmo->increment = 0; - tmo->elapsed = 0; - tmo->tick = 1000000 / HZ; -} - -int -dhd_timeout_expired(dhd_timeout_t *tmo) -{ - /* Does nothing the first call */ - if (tmo->increment == 0) { - tmo->increment = 1; - return 0; - } - - if (tmo->elapsed >= tmo->limit) - return 1; - - /* Add the delay that's about to take place */ - tmo->elapsed += tmo->increment; - - if (tmo->increment < tmo->tick) { - OSL_DELAY(tmo->increment); - tmo->increment *= 2; - if (tmo->increment > tmo->tick) - tmo->increment = tmo->tick; - } else { - wait_queue_head_t delay_wait; - DECLARE_WAITQUEUE(wait, current); - int pending; - init_waitqueue_head(&delay_wait); - add_wait_queue(&delay_wait, &wait); - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(1); - pending = signal_pending(current); - remove_wait_queue(&delay_wait, &wait); - set_current_state(TASK_RUNNING); - if (pending) - return 1; /* Interrupted */ - } - - return 0; -} - -static int -dhd_net2idx(dhd_info_t *dhd, struct net_device *net) -{ - int i = 0; - - ASSERT(dhd); - while (i < DHD_MAX_IFS) { - if (dhd->iflist[i] && (dhd->iflist[i]->net == net)) - return i; - i++; - } - - return DHD_BAD_IF; -} - -int -dhd_ifname2idx(dhd_info_t *dhd, char *name) -{ - int i = DHD_MAX_IFS; - - ASSERT(dhd); - - if (name == NULL || *name == '\0') - return 0; - - while (--i > 0) - if (dhd->iflist[i] && !strncmp(dhd->iflist[i]->name, name, IFNAMSIZ)) - break; - - DHD_TRACE(("%s: return idx %d for \"%s\"\n", __FUNCTION__, i, name)); - - return i; /* default - the primary interface */ -} - -char * -dhd_ifname(dhd_pub_t *dhdp, int ifidx) -{ - dhd_info_t *dhd = (dhd_info_t *)dhdp->info; - - ASSERT(dhd); - - if (ifidx < 0 || ifidx >= DHD_MAX_IFS) { - DHD_ERROR(("%s: ifidx %d out of range\n", __FUNCTION__, ifidx)); - return ""; - } - - if (dhd->iflist[ifidx] == NULL) { - DHD_ERROR(("%s: null i/f %d\n", __FUNCTION__, ifidx)); - return ""; - } - - if (dhd->iflist[ifidx]->net) - return dhd->iflist[ifidx]->net->name; - - return ""; -} - -static void -_dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) -{ - struct net_device *dev; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - struct netdev_hw_addr *ha; -#else - struct dev_mc_list *mclist; -#endif - uint32 allmulti, cnt; - - wl_ioctl_t ioc; - char *buf, *bufp; - uint buflen; - int ret; - - ASSERT(dhd && dhd->iflist[ifidx]); - dev = dhd->iflist[ifidx]->net; - - netif_addr_lock_bh(dev); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - cnt = netdev_mc_count(dev); -#else - cnt = dev->mc_count; -#endif - netif_addr_unlock_bh(dev); - - /* Determine initial value of allmulti flag */ - allmulti = (dev->flags & IFF_ALLMULTI) ? TRUE : FALSE; - - /* Send down the multicast list first. */ - buflen = sizeof("mcast_list") + sizeof(cnt) + (cnt * ETHER_ADDR_LEN); - if (!(bufp = buf = MALLOC(dhd->pub.osh, buflen))) { - DHD_ERROR(("%s: out of memory for mcast_list, cnt %d\n", - dhd_ifname(&dhd->pub, ifidx), cnt)); - return; - } - - strcpy(bufp, "mcast_list"); - bufp += strlen("mcast_list") + 1; - - cnt = htol32(cnt); - memcpy(bufp, &cnt, sizeof(cnt)); - bufp += sizeof(cnt); - - netif_addr_lock_bh(dev); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - netdev_for_each_mc_addr(ha, dev) { - if (!cnt) - break; - memcpy(bufp, ha->addr, ETHER_ADDR_LEN); - bufp += ETHER_ADDR_LEN; - cnt--; - } -#else - for (mclist = dev->mc_list;(mclist && (cnt > 0)); cnt--, mclist = mclist->next) { - memcpy(bufp, (void *)mclist->dmi_addr, ETHER_ADDR_LEN); - bufp += ETHER_ADDR_LEN; - } -#endif - netif_addr_unlock_bh(dev); - - memset(&ioc, 0, sizeof(ioc)); - ioc.cmd = WLC_SET_VAR; - ioc.buf = buf; - ioc.len = buflen; - ioc.set = TRUE; - - ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); - if (ret < 0) { - DHD_ERROR(("%s: set mcast_list failed, cnt %d\n", - dhd_ifname(&dhd->pub, ifidx), cnt)); - allmulti = cnt ? TRUE : allmulti; - } - - MFREE(dhd->pub.osh, buf, buflen); - - /* Now send the allmulti setting. This is based on the setting in the - * net_device flags, but might be modified above to be turned on if we - * were trying to set some addresses and dongle rejected it... - */ - - buflen = sizeof("allmulti") + sizeof(allmulti); - if (!(buf = MALLOC(dhd->pub.osh, buflen))) { - DHD_ERROR(("%s: out of memory for allmulti\n", dhd_ifname(&dhd->pub, ifidx))); - return; - } - allmulti = htol32(allmulti); - - if (!bcm_mkiovar("allmulti", (void*)&allmulti, sizeof(allmulti), buf, buflen)) { - DHD_ERROR(("%s: mkiovar failed for allmulti, datalen %d buflen %u\n", - dhd_ifname(&dhd->pub, ifidx), (int)sizeof(allmulti), buflen)); - MFREE(dhd->pub.osh, buf, buflen); - return; - } - - - memset(&ioc, 0, sizeof(ioc)); - ioc.cmd = WLC_SET_VAR; - ioc.buf = buf; - ioc.len = buflen; - ioc.set = TRUE; - - ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); - if (ret < 0) { - DHD_ERROR(("%s: set allmulti %d failed\n", - dhd_ifname(&dhd->pub, ifidx), ltoh32(allmulti))); - } - - MFREE(dhd->pub.osh, buf, buflen); - - /* Finally, pick up the PROMISC flag as well, like the NIC driver does */ - - allmulti = (dev->flags & IFF_PROMISC) ? TRUE : FALSE; - allmulti = htol32(allmulti); - - memset(&ioc, 0, sizeof(ioc)); - ioc.cmd = WLC_SET_PROMISC; - ioc.buf = &allmulti; - ioc.len = sizeof(allmulti); - ioc.set = TRUE; - - ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); - if (ret < 0) { - DHD_ERROR(("%s: set promisc %d failed\n", - dhd_ifname(&dhd->pub, ifidx), ltoh32(allmulti))); - } -} - -static int -_dhd_set_mac_address(dhd_info_t *dhd, int ifidx, struct ether_addr *addr) -{ - char buf[32]; - wl_ioctl_t ioc; - int ret; - - DHD_TRACE(("%s enter\n", __FUNCTION__)); - if (!bcm_mkiovar("cur_etheraddr", (char*)addr, ETHER_ADDR_LEN, buf, 32)) { - DHD_ERROR(("%s: mkiovar failed for cur_etheraddr\n", dhd_ifname(&dhd->pub, ifidx))); - return -1; - } - memset(&ioc, 0, sizeof(ioc)); - ioc.cmd = WLC_SET_VAR; - ioc.buf = buf; - ioc.len = 32; - ioc.set = TRUE; - - ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); - if (ret < 0) { - DHD_ERROR(("%s: set cur_etheraddr failed\n", dhd_ifname(&dhd->pub, ifidx))); - } else { - memcpy(dhd->iflist[ifidx]->net->dev_addr, addr, ETHER_ADDR_LEN); - } - - return ret; -} - -#ifdef SOFTAP -extern struct net_device *ap_net_dev; -/* semaphore that the soft AP CODE waits on */ -extern struct semaphore ap_eth_sema; -#endif - -static void -dhd_op_if(dhd_if_t *ifp) -{ - dhd_info_t *dhd; - int ret = 0, err = 0; -#ifdef SOFTAP - unsigned long flags; -#endif - - ASSERT(ifp && ifp->info && ifp->idx); /* Virtual interfaces only */ - - dhd = ifp->info; - - DHD_TRACE(("%s: idx %d, state %d\n", __FUNCTION__, ifp->idx, ifp->state)); - - switch (ifp->state) { - case WLC_E_IF_ADD: - /* - * Delete the existing interface before overwriting it - * in case we missed the WLC_E_IF_DEL event. - */ - if (ifp->net != NULL) { - DHD_ERROR(("%s: ERROR: netdev:%s already exists, try free & unregister \n", - __FUNCTION__, ifp->net->name)); - netif_stop_queue(ifp->net); - unregister_netdev(ifp->net); - free_netdev(ifp->net); - } - /* Allocate etherdev, including space for private structure */ - if (!(ifp->net = alloc_etherdev(sizeof(dhd)))) { - DHD_ERROR(("%s: OOM - alloc_etherdev\n", __FUNCTION__)); - ret = -ENOMEM; - } - if (ret == 0) { - strcpy(ifp->net->name, ifp->name); - memcpy(netdev_priv(ifp->net), &dhd, sizeof(dhd)); - if ((err = dhd_net_attach(&dhd->pub, ifp->idx)) != 0) { - DHD_ERROR(("%s: dhd_net_attach failed, err %d\n", - __FUNCTION__, err)); - ret = -EOPNOTSUPP; - } else { -#ifdef SOFTAP - flags = dhd_os_spin_lock(&dhd->pub); - /* save ptr to wl0.1 netdev for use in wl_iw.c */ - ap_net_dev = ifp->net; - /* signal to the SOFTAP 'sleeper' thread, wl0.1 is ready */ - up(&ap_eth_sema); - dhd_os_spin_unlock(&dhd->pub, flags); -#endif - DHD_TRACE(("\n ==== pid:%x, net_device for if:%s created ===\n\n", - current->pid, ifp->net->name)); - ifp->state = 0; - } - } - break; - case WLC_E_IF_DEL: - if (ifp->net != NULL) { - DHD_TRACE(("\n%s: got 'WLC_E_IF_DEL' state\n", __FUNCTION__)); - netif_stop_queue(ifp->net); - unregister_netdev(ifp->net); - ret = DHD_DEL_IF; /* Make sure the free_netdev() is called */ - } - break; - default: - DHD_ERROR(("%s: bad op %d\n", __FUNCTION__, ifp->state)); - ASSERT(!ifp->state); - break; - } - - if (ret < 0) { - if (ifp->net) { - free_netdev(ifp->net); - } - dhd->iflist[ifp->idx] = NULL; - MFREE(dhd->pub.osh, ifp, sizeof(*ifp)); -#ifdef SOFTAP - flags = dhd_os_spin_lock(&dhd->pub); - if (ifp->net == ap_net_dev) - ap_net_dev = NULL; /* NULL SOFTAP global as well */ - dhd_os_spin_unlock(&dhd->pub, flags); -#endif /* SOFTAP */ - } -} - -static int -_dhd_sysioc_thread(void *data) -{ - dhd_info_t *dhd = (dhd_info_t *)data; - int i; -#ifdef SOFTAP - bool in_ap = FALSE; - unsigned long flags; -#endif - - DAEMONIZE("dhd_sysioc"); - - while (down_interruptible(&dhd->sysioc_sem) == 0) { - dhd_os_start_lock(&dhd->pub); - dhd_os_wake_lock(&dhd->pub); - for (i = 0; i < DHD_MAX_IFS; i++) { - if (dhd->iflist[i]) { - DHD_TRACE(("%s: interface %d\n",__FUNCTION__, i)); -#ifdef SOFTAP - flags = dhd_os_spin_lock(&dhd->pub); - in_ap = (ap_net_dev != NULL); - dhd_os_spin_unlock(&dhd->pub, flags); -#endif /* SOFTAP */ - if (dhd->iflist[i]->state) - dhd_op_if(dhd->iflist[i]); -#ifdef SOFTAP - if (dhd->iflist[i] == NULL) { - DHD_TRACE(("%s: interface %d just been removed!\n\n", __FUNCTION__, i)); - continue; - } - - if (in_ap && dhd->set_macaddress) { - DHD_TRACE(("attempt to set MAC for %s in AP Mode blocked.\n", dhd->iflist[i]->net->name)); - dhd->set_macaddress = FALSE; - continue; - } - - if (in_ap && dhd->set_multicast) { - DHD_TRACE(("attempt to set MULTICAST list for %s in AP Mode blocked.\n", dhd->iflist[i]->net->name)); - dhd->set_multicast = FALSE; - continue; - } -#endif /* SOFTAP */ - if (dhd->set_multicast) { - dhd->set_multicast = FALSE; - _dhd_set_multicast_list(dhd, i); - } - if (dhd->set_macaddress) { - dhd->set_macaddress = FALSE; - _dhd_set_mac_address(dhd, i, &dhd->macvalue); - } - } - } - dhd_os_wake_unlock(&dhd->pub); - dhd_os_start_unlock(&dhd->pub); - } - DHD_TRACE(("%s: stopped\n",__FUNCTION__)); - complete_and_exit(&dhd->sysioc_exited, 0); -} - -static int -dhd_set_mac_address(struct net_device *dev, void *addr) -{ - int ret = 0; - - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - struct sockaddr *sa = (struct sockaddr *)addr; - int ifidx; - - DHD_TRACE(("%s: Enter\n",__FUNCTION__)); - ifidx = dhd_net2idx(dhd, dev); - if (ifidx == DHD_BAD_IF) - return -1; - - ASSERT(dhd->sysioc_pid >= 0); - memcpy(&dhd->macvalue, sa->sa_data, ETHER_ADDR_LEN); - dhd->set_macaddress = TRUE; - up(&dhd->sysioc_sem); - - return ret; -} - -static void -dhd_set_multicast_list(struct net_device *dev) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - int ifidx; - - DHD_TRACE(("%s: Enter\n",__FUNCTION__)); - ifidx = dhd_net2idx(dhd, dev); - if (ifidx == DHD_BAD_IF) - return; - - ASSERT(dhd->sysioc_pid >= 0); - dhd->set_multicast = TRUE; - up(&dhd->sysioc_sem); -} - -int -dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, void *pktbuf) -{ - int ret; - dhd_info_t *dhd = (dhd_info_t *)(dhdp->info); - - /* Reject if down */ - if (!dhdp->up || (dhdp->busstate == DHD_BUS_DOWN)) { - return -ENODEV; - } - - /* Update multicast statistic */ - if (PKTLEN(dhdp->osh, pktbuf) >= ETHER_ADDR_LEN) { - uint8 *pktdata = (uint8 *)PKTDATA(dhdp->osh, pktbuf); - struct ether_header *eh = (struct ether_header *)pktdata; - - if (ETHER_ISMULTI(eh->ether_dhost)) - dhdp->tx_multicast++; - if (ntoh16(eh->ether_type) == ETHER_TYPE_802_1X) - atomic_inc(&dhd->pend_8021x_cnt); - } - - /* Look into the packet and update the packet priority */ - if ((PKTPRIO(pktbuf) == 0)) - pktsetprio(pktbuf, FALSE); - - /* If the protocol uses a data header, apply it */ - dhd_prot_hdrpush(dhdp, ifidx, pktbuf); - - /* Use bus module to send data frame */ -#ifdef BCMDBUS - ret = dbus_send_pkt(dhdp->dbus, pktbuf, NULL /* pktinfo */); -#else - ret = dhd_bus_txdata(dhdp->bus, pktbuf); -#endif /* BCMDBUS */ - - return ret; -} - -static int -dhd_start_xmit(struct sk_buff *skb, struct net_device *net) -{ - int ret; - void *pktbuf; - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(net); - int ifidx; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - dhd_os_wake_lock(&dhd->pub); - - /* Reject if down */ - if (!dhd->pub.up || (dhd->pub.busstate == DHD_BUS_DOWN)) { - DHD_ERROR(("%s: xmit rejected pub.up=%d busstate=%d\n", - __FUNCTION__, dhd->pub.up, dhd->pub.busstate)); - netif_stop_queue(net); - /* Send Event when bus down detected during data session */ - if (dhd->pub.busstate == DHD_BUS_DOWN) { - DHD_ERROR(("%s: Event HANG send up\n", __FUNCTION__)); - net_os_send_hang_message(net); - } - dhd_os_wake_unlock(&dhd->pub); - return -ENODEV; - } - - ifidx = dhd_net2idx(dhd, net); - if (ifidx == DHD_BAD_IF) { - DHD_ERROR(("%s: bad ifidx %d\n", __FUNCTION__, ifidx)); - netif_stop_queue(net); - dhd_os_wake_unlock(&dhd->pub); - return -ENODEV; - } - - /* Make sure there's enough room for any header */ - if (skb_headroom(skb) < dhd->pub.hdrlen) { - struct sk_buff *skb2; - - DHD_INFO(("%s: insufficient headroom\n", - dhd_ifname(&dhd->pub, ifidx))); - dhd->pub.tx_realloc++; - skb2 = skb_realloc_headroom(skb, dhd->pub.hdrlen); - dev_kfree_skb(skb); - if ((skb = skb2) == NULL) { - DHD_ERROR(("%s: skb_realloc_headroom failed\n", - dhd_ifname(&dhd->pub, ifidx))); - ret = -ENOMEM; - goto done; - } - } - - /* Convert to packet */ - if (!(pktbuf = PKTFRMNATIVE(dhd->pub.osh, skb))) { - DHD_ERROR(("%s: PKTFRMNATIVE failed\n", - dhd_ifname(&dhd->pub, ifidx))); - dev_kfree_skb_any(skb); - ret = -ENOMEM; - goto done; - } - - ret = dhd_sendpkt(&dhd->pub, ifidx, pktbuf); - -done: - if (ret) - dhd->pub.dstats.tx_dropped++; - else - dhd->pub.tx_packets++; - - dhd_os_wake_unlock(&dhd->pub); - - /* Return ok: we always eat the packet */ - return 0; -} - -void -dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool state) -{ - struct net_device *net; - dhd_info_t *dhd = dhdp->info; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - dhdp->txoff = state; - ASSERT(dhd && dhd->iflist[ifidx]); - net = dhd->iflist[ifidx]->net; - if (state == ON) - netif_stop_queue(net); - else - netif_wake_queue(net); -} - -void -dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *pktbuf, int numpkt) -{ - dhd_info_t *dhd = (dhd_info_t *)dhdp->info; - struct sk_buff *skb; - uchar *eth; - uint len; - void * data, *pnext, *save_pktbuf; - int i; - dhd_if_t *ifp; - wl_event_msg_t event; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - save_pktbuf = pktbuf; - - for (i = 0; pktbuf && i < numpkt; i++, pktbuf = pnext) { - - pnext = PKTNEXT(dhdp->osh, pktbuf); - PKTSETNEXT(wl->sh.osh, pktbuf, NULL); - - - skb = PKTTONATIVE(dhdp->osh, pktbuf); - - /* Get the protocol, maintain skb around eth_type_trans() - * The main reason for this hack is for the limitation of - * Linux 2.4 where 'eth_type_trans' uses the 'net->hard_header_len' - * to perform skb_pull inside vs ETH_HLEN. Since to avoid - * coping of the packet coming from the network stack to add - * BDC, Hardware header etc, during network interface registration - * we set the 'net->hard_header_len' to ETH_HLEN + extra space required - * for BDC, Hardware header etc. and not just the ETH_HLEN - */ - eth = skb->data; - len = skb->len; - - ifp = dhd->iflist[ifidx]; - if (ifp == NULL) - ifp = dhd->iflist[0]; - - ASSERT(ifp); - skb->dev = ifp->net; - skb->protocol = eth_type_trans(skb, skb->dev); - - if (skb->pkt_type == PACKET_MULTICAST) { - dhd->pub.rx_multicast++; - } - - skb->data = eth; - skb->len = len; - - /* Strip header, count, deliver upward */ - skb_pull(skb, ETH_HLEN); - - /* Process special event packets and then discard them */ - if (ntoh16(skb->protocol) == ETHER_TYPE_BRCM) - dhd_wl_host_event(dhd, &ifidx, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) - skb->mac_header, -#else - skb->mac.raw, -#endif - &event, - &data); - - ASSERT(ifidx < DHD_MAX_IFS && dhd->iflist[ifidx]); - if (dhd->iflist[ifidx] && !dhd->iflist[ifidx]->state) - ifp = dhd->iflist[ifidx]; - - if (ifp->net) - ifp->net->last_rx = jiffies; - - dhdp->dstats.rx_bytes += skb->len; - dhdp->rx_packets++; /* Local count */ - - if (in_interrupt()) { - netif_rx(skb); - } else { - /* If the receive is not processed inside an ISR, - * the softirqd must be woken explicitly to service - * the NET_RX_SOFTIRQ. In 2.6 kernels, this is handled - * by netif_rx_ni(), but in earlier kernels, we need - * to do it manually. - */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) - netif_rx_ni(skb); -#else - ulong flags; - netif_rx(skb); - local_irq_save(flags); - RAISE_RX_SOFTIRQ(); - local_irq_restore(flags); -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) */ - } - } - dhd_os_wake_lock_timeout_enable(dhdp); -} - -void -dhd_event(struct dhd_info *dhd, char *evpkt, int evlen, int ifidx) -{ - /* Linux version has nothing to do */ - return; -} - -void -dhd_txcomplete(dhd_pub_t *dhdp, void *txp, bool success) -{ - uint ifidx; - dhd_info_t *dhd = (dhd_info_t *)(dhdp->info); - struct ether_header *eh; - uint16 type; - - dhd_prot_hdrpull(dhdp, &ifidx, txp); - - eh = (struct ether_header *)PKTDATA(dhdp->osh, txp); - type = ntoh16(eh->ether_type); - - if (type == ETHER_TYPE_802_1X) - atomic_dec(&dhd->pend_8021x_cnt); - -} - -static struct net_device_stats * -dhd_get_stats(struct net_device *net) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(net); - dhd_if_t *ifp; - int ifidx; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - ifidx = dhd_net2idx(dhd, net); - if (ifidx == DHD_BAD_IF) - return NULL; - - ifp = dhd->iflist[ifidx]; - ASSERT(dhd && ifp); - - if (dhd->pub.up) { - /* Use the protocol to get dongle stats */ - dhd_prot_dstats(&dhd->pub); - } - - /* Copy dongle stats to net device stats */ - ifp->stats.rx_packets = dhd->pub.dstats.rx_packets; - ifp->stats.tx_packets = dhd->pub.dstats.tx_packets; - ifp->stats.rx_bytes = dhd->pub.dstats.rx_bytes; - ifp->stats.tx_bytes = dhd->pub.dstats.tx_bytes; - ifp->stats.rx_errors = dhd->pub.dstats.rx_errors; - ifp->stats.tx_errors = dhd->pub.dstats.tx_errors; - ifp->stats.rx_dropped = dhd->pub.dstats.rx_dropped; - ifp->stats.tx_dropped = dhd->pub.dstats.tx_dropped; - ifp->stats.multicast = dhd->pub.dstats.multicast; - - return &ifp->stats; -} - -static int -dhd_watchdog_thread(void *data) -{ - dhd_info_t *dhd = (dhd_info_t *)data; - - /* This thread doesn't need any user-level access, - * so get rid of all our resources - */ -#ifdef DHD_SCHED - if (dhd_watchdog_prio > 0) { - struct sched_param param; - param.sched_priority = (dhd_watchdog_prio < MAX_RT_PRIO)? - dhd_watchdog_prio:(MAX_RT_PRIO-1); - setScheduler(current, SCHED_FIFO, ¶m); - } -#endif /* DHD_SCHED */ - - DAEMONIZE("dhd_watchdog"); - - /* Run until signal received */ - while (1) { - if (down_interruptible (&dhd->watchdog_sem) == 0) { - dhd_os_sdlock(&dhd->pub); - if (dhd->pub.dongle_reset == FALSE) { - DHD_TIMER(("%s:\n", __FUNCTION__)); - /* Call the bus module watchdog */ - dhd_bus_watchdog(&dhd->pub); - - /* Count the tick for reference */ - dhd->pub.tickcnt++; - - /* Reschedule the watchdog */ - if (dhd->wd_timer_valid) - mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000); - } - dhd_os_sdunlock(&dhd->pub); - dhd_os_wake_unlock(&dhd->pub); - } else { - break; - } - } - - complete_and_exit(&dhd->watchdog_exited, 0); -} - -static void -dhd_watchdog(ulong data) -{ - dhd_info_t *dhd = (dhd_info_t *)data; - - dhd_os_wake_lock(&dhd->pub); - if (dhd->pub.dongle_reset) { - dhd_os_wake_unlock(&dhd->pub); - return; - } - - if (dhd->watchdog_pid >= 0) { - up(&dhd->watchdog_sem); - return; - } - - dhd_os_sdlock(&dhd->pub); - /* Call the bus module watchdog */ - dhd_bus_watchdog(&dhd->pub); - - /* Count the tick for reference */ - dhd->pub.tickcnt++; - - /* Reschedule the watchdog */ - if (dhd->wd_timer_valid) - mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000); - dhd_os_sdunlock(&dhd->pub); - dhd_os_wake_unlock(&dhd->pub); -} - -static int -dhd_dpc_thread(void *data) -{ - dhd_info_t *dhd = (dhd_info_t *)data; - - /* This thread doesn't need any user-level access, - * so get rid of all our resources - */ -#ifdef DHD_SCHED - if (dhd_dpc_prio > 0) - { - struct sched_param param; - param.sched_priority = (dhd_dpc_prio < MAX_RT_PRIO)?dhd_dpc_prio:(MAX_RT_PRIO-1); - setScheduler(current, SCHED_FIFO, ¶m); - } -#endif /* DHD_SCHED */ - - DAEMONIZE("dhd_dpc"); - - /* Run until signal received */ - while (1) { - if (down_interruptible(&dhd->dpc_sem) == 0) { - /* Call bus dpc unless it indicated down (then clean stop) */ - if (dhd->pub.busstate != DHD_BUS_DOWN) { - if (dhd_bus_dpc(dhd->pub.bus)) { - up(&dhd->dpc_sem); - } - else { - dhd_os_wake_unlock(&dhd->pub); - } - } else { - dhd_bus_stop(dhd->pub.bus, TRUE); - dhd_os_wake_unlock(&dhd->pub); - } - } - else - break; - } - - complete_and_exit(&dhd->dpc_exited, 0); -} - -static void -dhd_dpc(ulong data) -{ - dhd_info_t *dhd; - - dhd = (dhd_info_t *)data; - - /* Call bus dpc unless it indicated down (then clean stop) */ - if (dhd->pub.busstate != DHD_BUS_DOWN) { - if (dhd_bus_dpc(dhd->pub.bus)) - tasklet_schedule(&dhd->tasklet); - } else { - dhd_bus_stop(dhd->pub.bus, TRUE); - } -} - -void -dhd_sched_dpc(dhd_pub_t *dhdp) -{ - dhd_info_t *dhd = (dhd_info_t *)dhdp->info; - - dhd_os_wake_lock(dhdp); - if (dhd->dpc_pid >= 0) { - up(&dhd->dpc_sem); - return; - } - - tasklet_schedule(&dhd->tasklet); -} - -#ifdef TOE -/* Retrieve current toe component enables, which are kept as a bitmap in toe_ol iovar */ -static int -dhd_toe_get(dhd_info_t *dhd, int ifidx, uint32 *toe_ol) -{ - wl_ioctl_t ioc; - char buf[32]; - int ret; - - memset(&ioc, 0, sizeof(ioc)); - - ioc.cmd = WLC_GET_VAR; - ioc.buf = buf; - ioc.len = (uint)sizeof(buf); - ioc.set = FALSE; - - strcpy(buf, "toe_ol"); - if ((ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len)) < 0) { - /* Check for older dongle image that doesn't support toe_ol */ - if (ret == -EIO) { - DHD_ERROR(("%s: toe not supported by device\n", - dhd_ifname(&dhd->pub, ifidx))); - return -EOPNOTSUPP; - } - - DHD_INFO(("%s: could not get toe_ol: ret=%d\n", dhd_ifname(&dhd->pub, ifidx), ret)); - return ret; - } - - memcpy(toe_ol, buf, sizeof(uint32)); - return 0; -} - -/* Set current toe component enables in toe_ol iovar, and set toe global enable iovar */ -static int -dhd_toe_set(dhd_info_t *dhd, int ifidx, uint32 toe_ol) -{ - wl_ioctl_t ioc; - char buf[32]; - int toe, ret; - - memset(&ioc, 0, sizeof(ioc)); - - ioc.cmd = WLC_SET_VAR; - ioc.buf = buf; - ioc.len = (uint)sizeof(buf); - ioc.set = TRUE; - - /* Set toe_ol as requested */ - - strcpy(buf, "toe_ol"); - memcpy(&buf[sizeof("toe_ol")], &toe_ol, sizeof(uint32)); - - if ((ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len)) < 0) { - DHD_ERROR(("%s: could not set toe_ol: ret=%d\n", - dhd_ifname(&dhd->pub, ifidx), ret)); - return ret; - } - - /* Enable toe globally only if any components are enabled. */ - - toe = (toe_ol != 0); - - strcpy(buf, "toe"); - memcpy(&buf[sizeof("toe")], &toe, sizeof(uint32)); - - if ((ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len)) < 0) { - DHD_ERROR(("%s: could not set toe: ret=%d\n", dhd_ifname(&dhd->pub, ifidx), ret)); - return ret; - } - - return 0; -} -#endif /* TOE */ - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) -static void dhd_ethtool_get_drvinfo(struct net_device *net, - struct ethtool_drvinfo *info) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(net); - - sprintf(info->driver, "wl"); - sprintf(info->version, "%lu", dhd->pub.drv_version); -} - -struct ethtool_ops dhd_ethtool_ops = { - .get_drvinfo = dhd_ethtool_get_drvinfo -}; -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) */ - - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 2) -static int -dhd_ethtool(dhd_info_t *dhd, void *uaddr) -{ - struct ethtool_drvinfo info; - char drvname[sizeof(info.driver)]; - uint32 cmd; -#ifdef TOE - struct ethtool_value edata; - uint32 toe_cmpnt, csum_dir; - int ret; -#endif - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - /* all ethtool calls start with a cmd word */ - if (copy_from_user(&cmd, uaddr, sizeof (uint32))) - return -EFAULT; - - switch (cmd) { - case ETHTOOL_GDRVINFO: - /* Copy out any request driver name */ - if (copy_from_user(&info, uaddr, sizeof(info))) - return -EFAULT; - strncpy(drvname, info.driver, sizeof(info.driver)); - drvname[sizeof(info.driver)-1] = '\0'; - - /* clear struct for return */ - memset(&info, 0, sizeof(info)); - info.cmd = cmd; - - /* if dhd requested, identify ourselves */ - if (strcmp(drvname, "?dhd") == 0) { - sprintf(info.driver, "dhd"); - strcpy(info.version, EPI_VERSION_STR); - } - - /* otherwise, require dongle to be up */ - else if (!dhd->pub.up) { - DHD_ERROR(("%s: dongle is not up\n", __FUNCTION__)); - return -ENODEV; - } - - /* finally, report dongle driver type */ - else if (dhd->pub.iswl) - sprintf(info.driver, "wl"); - else - sprintf(info.driver, "xx"); - - sprintf(info.version, "%lu", dhd->pub.drv_version); - if (copy_to_user(uaddr, &info, sizeof(info))) - return -EFAULT; - DHD_CTL(("%s: given %*s, returning %s\n", __FUNCTION__, - (int)sizeof(drvname), drvname, info.driver)); - break; - -#ifdef TOE - /* Get toe offload components from dongle */ - case ETHTOOL_GRXCSUM: - case ETHTOOL_GTXCSUM: - if ((ret = dhd_toe_get(dhd, 0, &toe_cmpnt)) < 0) - return ret; - - csum_dir = (cmd == ETHTOOL_GTXCSUM) ? TOE_TX_CSUM_OL : TOE_RX_CSUM_OL; - - edata.cmd = cmd; - edata.data = (toe_cmpnt & csum_dir) ? 1 : 0; - - if (copy_to_user(uaddr, &edata, sizeof(edata))) - return -EFAULT; - break; - - /* Set toe offload components in dongle */ - case ETHTOOL_SRXCSUM: - case ETHTOOL_STXCSUM: - if (copy_from_user(&edata, uaddr, sizeof(edata))) - return -EFAULT; - - /* Read the current settings, update and write back */ - if ((ret = dhd_toe_get(dhd, 0, &toe_cmpnt)) < 0) - return ret; - - csum_dir = (cmd == ETHTOOL_STXCSUM) ? TOE_TX_CSUM_OL : TOE_RX_CSUM_OL; - - if (edata.data != 0) - toe_cmpnt |= csum_dir; - else - toe_cmpnt &= ~csum_dir; - - if ((ret = dhd_toe_set(dhd, 0, toe_cmpnt)) < 0) - return ret; - - /* If setting TX checksum mode, tell Linux the new mode */ - if (cmd == ETHTOOL_STXCSUM) { - if (edata.data) - dhd->iflist[0]->net->features |= NETIF_F_IP_CSUM; - else - dhd->iflist[0]->net->features &= ~NETIF_F_IP_CSUM; - } - - break; -#endif /* TOE */ - - default: - return -EOPNOTSUPP; - } - - return 0; -} -#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 2) */ - -static int -dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(net); - dhd_ioctl_t ioc; - int bcmerror = 0; - int buflen = 0; - void *buf = NULL; - uint driver = 0; - int ifidx; - bool is_set_key_cmd; - int ret; - - dhd_os_wake_lock(&dhd->pub); - - ifidx = dhd_net2idx(dhd, net); - DHD_TRACE(("%s: ifidx %d, cmd 0x%04x\n", __FUNCTION__, ifidx, cmd)); - - if (ifidx == DHD_BAD_IF) { - dhd_os_wake_unlock(&dhd->pub); - return -1; - } - -#if defined(CONFIG_WIRELESS_EXT) - /* linux wireless extensions */ - if ((cmd >= SIOCIWFIRST) && (cmd <= SIOCIWLAST)) { - /* may recurse, do NOT lock */ - ret = wl_iw_ioctl(net, ifr, cmd); - dhd_os_wake_unlock(&dhd->pub); - return ret; - } -#endif /* defined(CONFIG_WIRELESS_EXT) */ - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 2) - if (cmd == SIOCETHTOOL) { - ret = dhd_ethtool(dhd, (void*)ifr->ifr_data); - dhd_os_wake_unlock(&dhd->pub); - return ret; - } -#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 2) */ - - if (cmd != SIOCDEVPRIVATE) { - dhd_os_wake_unlock(&dhd->pub); - return -EOPNOTSUPP; - } - - memset(&ioc, 0, sizeof(ioc)); - - /* Copy the ioc control structure part of ioctl request */ - if (copy_from_user(&ioc, ifr->ifr_data, sizeof(wl_ioctl_t))) { - bcmerror = -BCME_BADADDR; - goto done; - } - - /* Copy out any buffer passed */ - if (ioc.buf) { - buflen = MIN(ioc.len, DHD_IOCTL_MAXLEN); - /* optimization for direct ioctl calls from kernel */ - /* - if (segment_eq(get_fs(), KERNEL_DS)) { - buf = ioc.buf; - } else { - */ - { - if (!(buf = (char*)MALLOC(dhd->pub.osh, buflen))) { - bcmerror = -BCME_NOMEM; - goto done; - } - if (copy_from_user(buf, ioc.buf, buflen)) { - bcmerror = -BCME_BADADDR; - goto done; - } - } - } - - /* To differentiate between wl and dhd read 4 more byes */ - if ((copy_from_user(&driver, (char *)ifr->ifr_data + sizeof(wl_ioctl_t), - sizeof(uint)) != 0)) { - bcmerror = -BCME_BADADDR; - goto done; - } - - if (!capable(CAP_NET_ADMIN)) { - bcmerror = -BCME_EPERM; - goto done; - } - - /* check for local dhd ioctl and handle it */ - if (driver == DHD_IOCTL_MAGIC) { - bcmerror = dhd_ioctl((void *)&dhd->pub, &ioc, buf, buflen); - if (bcmerror) - dhd->pub.bcmerror = bcmerror; - goto done; - } - - /* send to dongle (must be up, and wl) */ - if (dhd->pub.busstate != DHD_BUS_DATA) { - DHD_ERROR(("%s DONGLE_DOWN\n", __FUNCTION__)); - bcmerror = BCME_DONGLE_DOWN; - goto done; - } - - if (!dhd->pub.iswl) { - bcmerror = BCME_DONGLE_DOWN; - goto done; - } - - /* Intercept WLC_SET_KEY IOCTL - serialize M4 send and set key IOCTL to - * prevent M4 encryption. - */ - is_set_key_cmd = ((ioc.cmd == WLC_SET_KEY) || - ((ioc.cmd == WLC_SET_VAR) && - !(strncmp("wsec_key", ioc.buf, 9))) || - ((ioc.cmd == WLC_SET_VAR) && - !(strncmp("bsscfg:wsec_key", ioc.buf, 15)))); - if (is_set_key_cmd) { - dhd_wait_pend8021x(net); - } - - bcmerror = dhd_prot_ioctl(&dhd->pub, ifidx, (wl_ioctl_t *)&ioc, buf, buflen); - -done: - if ((bcmerror == -ETIMEDOUT) || ((dhd->pub.busstate == DHD_BUS_DOWN) && - (!dhd->pub.dongle_reset))) { - DHD_ERROR(("%s: Event HANG send up\n", __FUNCTION__)); - net_os_send_hang_message(net); - } - - if (!bcmerror && buf && ioc.buf) { - if (copy_to_user(ioc.buf, buf, buflen)) - bcmerror = -EFAULT; - } - - if (buf) - MFREE(dhd->pub.osh, buf, buflen); - - dhd_os_wake_unlock(&dhd->pub); - - return OSL_ERROR(bcmerror); -} - -static int -dhd_stop(struct net_device *net) -{ -#if !defined(IGNORE_ETH0_DOWN) - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(net); - - DHD_TRACE(("%s: Enter %s\n", __FUNCTION__, net->name)); - if (dhd->pub.up == 0) { - return 0; - } - - /* Set state and stop OS transmissions */ - dhd->pub.up = 0; - netif_stop_queue(net); -#else - DHD_ERROR(("BYPASS %s:due to BRCM compilation : under investigation ...\n", __FUNCTION__)); -#endif /* !defined(IGNORE_ETH0_DOWN) */ - - OLD_MOD_DEC_USE_COUNT; - return 0; -} - -static int -dhd_open(struct net_device *net) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(net); -#ifdef TOE - uint32 toe_ol; -#endif - int ifidx; - - /* Force start if ifconfig_up gets called before START command */ - wl_control_wl_start(net); - - ifidx = dhd_net2idx(dhd, net); - if (ifidx == DHD_BAD_IF) - return -1; - DHD_TRACE(("%s: ifidx %d\n", __FUNCTION__, ifidx)); - - if ((dhd->iflist[ifidx]) && (dhd->iflist[ifidx]->state == WLC_E_IF_DEL)) { - DHD_ERROR(("%s: Error: called when IF already deleted\n", __FUNCTION__)); - return -1; - } - - if (ifidx == 0) { /* do it only for primary eth0 */ - - atomic_set(&dhd->pend_8021x_cnt, 0); - - memcpy(net->dev_addr, dhd->pub.mac.octet, ETHER_ADDR_LEN); - -#ifdef TOE - /* Get current TOE mode from dongle */ - if (dhd_toe_get(dhd, ifidx, &toe_ol) >= 0 && (toe_ol & TOE_TX_CSUM_OL) != 0) - dhd->iflist[ifidx]->net->features |= NETIF_F_IP_CSUM; - else - dhd->iflist[ifidx]->net->features &= ~NETIF_F_IP_CSUM; -#endif - } - /* Allow transmit calls */ - netif_start_queue(net); - dhd->pub.up = 1; - - OLD_MOD_INC_USE_COUNT; - return 0; -} - -osl_t * -dhd_osl_attach(void *pdev, uint bustype) -{ - return osl_attach(pdev, bustype, TRUE); -} - -void -dhd_osl_detach(osl_t *osh) -{ - if (MALLOCED(osh)) { - DHD_ERROR(("%s: MEMORY LEAK %d bytes\n", __FUNCTION__, MALLOCED(osh))); - } - osl_detach(osh); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && 1 - up(&dhd_registration_sem); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */ -} - -int -dhd_add_if(dhd_info_t *dhd, int ifidx, void *handle, char *name, - uint8 *mac_addr, uint32 flags, uint8 bssidx) -{ - dhd_if_t *ifp; - - DHD_TRACE(("%s: idx %d, handle->%p\n", __FUNCTION__, ifidx, handle)); - - ASSERT(dhd && (ifidx < DHD_MAX_IFS)); - - ifp = dhd->iflist[ifidx]; - if (!ifp && !(ifp = MALLOC(dhd->pub.osh, sizeof(dhd_if_t)))) { - DHD_ERROR(("%s: OOM - dhd_if_t\n", __FUNCTION__)); - return -ENOMEM; - } - - memset(ifp, 0, sizeof(dhd_if_t)); - ifp->info = dhd; - dhd->iflist[ifidx] = ifp; - strncpy(ifp->name, name, IFNAMSIZ); - ifp->name[IFNAMSIZ] = '\0'; - if (mac_addr != NULL) - memcpy(&ifp->mac_addr, mac_addr, ETHER_ADDR_LEN); - - if (handle == NULL) { - ifp->state = WLC_E_IF_ADD; - ifp->idx = ifidx; - ASSERT(dhd->sysioc_pid >= 0); - up(&dhd->sysioc_sem); - } else - ifp->net = (struct net_device *)handle; - - return 0; -} - -void -dhd_del_if(dhd_info_t *dhd, int ifidx) -{ - dhd_if_t *ifp; - - DHD_TRACE(("%s: idx %d\n", __FUNCTION__, ifidx)); - - ASSERT(dhd && ifidx && (ifidx < DHD_MAX_IFS)); - ifp = dhd->iflist[ifidx]; - if (!ifp) { - DHD_ERROR(("%s: Null interface\n", __FUNCTION__)); - return; - } - - ifp->state = WLC_E_IF_DEL; - ifp->idx = ifidx; - ASSERT(dhd->sysioc_pid >= 0); - up(&dhd->sysioc_sem); -} - -dhd_pub_t * -dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) -{ - dhd_info_t *dhd = NULL; - struct net_device *net; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - /* updates firmware nvram path if it was provided as module paramters */ - if ((firmware_path != NULL) && (firmware_path[0] != '\0')) - strcpy(fw_path, firmware_path); - if ((nvram_path != NULL) && (nvram_path[0] != '\0')) - strcpy(nv_path, nvram_path); - - /* Allocate etherdev, including space for private structure */ - if (!(net = alloc_etherdev(sizeof(dhd)))) { - DHD_ERROR(("%s: OOM - alloc_etherdev\n", __FUNCTION__)); - goto fail; - } - - /* Allocate primary dhd_info */ - if (!(dhd = MALLOC(osh, sizeof(dhd_info_t)))) { - DHD_ERROR(("%s: OOM - alloc dhd_info\n", __FUNCTION__)); - goto fail; - } - - memset(dhd, 0, sizeof(dhd_info_t)); - - /* - * Save the dhd_info into the priv - */ - memcpy(netdev_priv(net), &dhd, sizeof(dhd)); - dhd->pub.osh = osh; - - /* Set network interface name if it was provided as module parameter */ - if (iface_name[0]) { - int len; - char ch; - strncpy(net->name, iface_name, IFNAMSIZ); - net->name[IFNAMSIZ - 1] = 0; - len = strlen(net->name); - ch = net->name[len - 1]; - if ((ch > '9' || ch < '0') && (len < IFNAMSIZ - 2)) - strcat(net->name, "%d"); - } - - if (dhd_add_if(dhd, 0, (void *)net, net->name, NULL, 0, 0) == DHD_BAD_IF) - goto fail; - -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) - net->open = NULL; -#else - net->netdev_ops = NULL; -#endif - - mutex_init(&dhd->proto_sem); - /* Initialize other structure content */ - init_waitqueue_head(&dhd->ioctl_resp_wait); - init_waitqueue_head(&dhd->ctrl_wait); - - /* Initialize the spinlocks */ - spin_lock_init(&dhd->sdlock); - spin_lock_init(&dhd->txqlock); - spin_lock_init(&dhd->dhd_lock); - - /* Initialize Wakelock stuff */ - spin_lock_init(&dhd->wl_lock); - dhd->wl_count = 0; - dhd->wl_packet = 0; -#ifdef CONFIG_HAS_WAKELOCK - wake_lock_init(&dhd->wl_wifi, WAKE_LOCK_SUSPEND, "wlan_wake"); - wake_lock_init(&dhd->wl_rxwake, WAKE_LOCK_SUSPEND, "wlan_rx_wake"); -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) - mutex_init(&dhd->wl_start_lock); -#endif - /* Link to info module */ - dhd->pub.info = dhd; - - /* Link to bus module */ - dhd->pub.bus = bus; - dhd->pub.hdrlen = bus_hdrlen; - - /* Attach and link in the protocol */ - if (dhd_prot_attach(&dhd->pub) != 0) { - DHD_ERROR(("dhd_prot_attach failed\n")); - goto fail; - } -#if defined(CONFIG_WIRELESS_EXT) - /* Attach and link in the iw */ - if (wl_iw_attach(net, (void *)&dhd->pub) != 0) { - DHD_ERROR(("wl_iw_attach failed\n")); - goto fail; - } -#endif /* defined(CONFIG_WIRELESS_EXT) */ - - /* Set up the watchdog timer */ - init_timer(&dhd->timer); - dhd->timer.data = (ulong)dhd; - dhd->timer.function = dhd_watchdog; - - /* Initialize thread based operation and lock */ - mutex_init(&dhd->sdsem); - if ((dhd_watchdog_prio >= 0) && (dhd_dpc_prio >= 0)) { - dhd->threads_only = TRUE; - } - else { - dhd->threads_only = FALSE; - } - - if (dhd_dpc_prio >= 0) { - /* Initialize watchdog thread */ - sema_init(&dhd->watchdog_sem, 0); - init_completion(&dhd->watchdog_exited); - dhd->watchdog_pid = kernel_thread(dhd_watchdog_thread, dhd, 0); - } else { - dhd->watchdog_pid = -1; - } - - /* Set up the bottom half handler */ - if (dhd_dpc_prio >= 0) { - /* Initialize DPC thread */ - sema_init(&dhd->dpc_sem, 0); - init_completion(&dhd->dpc_exited); - dhd->dpc_pid = kernel_thread(dhd_dpc_thread, dhd, 0); - } else { - tasklet_init(&dhd->tasklet, dhd_dpc, (ulong)dhd); - dhd->dpc_pid = -1; - } - - if (dhd_sysioc) { - sema_init(&dhd->sysioc_sem, 0); - init_completion(&dhd->sysioc_exited); - dhd->sysioc_pid = kernel_thread(_dhd_sysioc_thread, dhd, 0); - } else { - dhd->sysioc_pid = -1; - } - - /* - * Save the dhd_info into the priv - */ - memcpy(netdev_priv(net), &dhd, sizeof(dhd)); - -#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) - g_bus = bus; -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) - register_pm_notifier(&dhd_sleep_pm_notifier); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */ - -#ifdef CONFIG_HAS_EARLYSUSPEND - dhd->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 20; - dhd->early_suspend.suspend = dhd_early_suspend; - dhd->early_suspend.resume = dhd_late_resume; - register_early_suspend(&dhd->early_suspend); -#endif - - return &dhd->pub; - -fail: - if (net) - free_netdev(net); - if (dhd) - dhd_detach(&dhd->pub); - - return NULL; -} - - -int -dhd_bus_start(dhd_pub_t *dhdp) -{ - int ret = -1; - dhd_info_t *dhd = (dhd_info_t*)dhdp->info; -#ifdef EMBEDDED_PLATFORM - char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ -#endif /* EMBEDDED_PLATFORM */ - - ASSERT(dhd); - - DHD_TRACE(("%s: \n", __FUNCTION__)); - - /* try to download image and nvram to the dongle */ - if (dhd->pub.busstate == DHD_BUS_DOWN) { - if (!(dhd_bus_download_firmware(dhd->pub.bus, dhd->pub.osh, - fw_path, nv_path))) { - DHD_ERROR(("%s: dhdsdio_probe_download failed. firmware = %s nvram = %s\n", - __FUNCTION__, fw_path, nv_path)); - return -1; - } - } - - /* Start the watchdog timer */ - dhd->pub.tickcnt = 0; - dhd_os_wd_timer(&dhd->pub, dhd_watchdog_ms); - - /* Bring up the bus */ - if ((ret = dhd_bus_init(&dhd->pub, TRUE)) != 0) { - DHD_ERROR(("%s, dhd_bus_init failed %d\n", __FUNCTION__, ret)); - return ret; - } -#if defined(OOB_INTR_ONLY) - /* Host registration for OOB interrupt */ - if (bcmsdh_register_oob_intr(dhdp)) { - dhd->wd_timer_valid = FALSE; - del_timer_sync(&dhd->timer); - DHD_ERROR(("%s Host failed to resgister for OOB\n", __FUNCTION__)); - return -ENODEV; - } - - /* Enable oob at firmware */ - dhd_enable_oob_intr(dhd->pub.bus, TRUE); -#endif /* defined(OOB_INTR_ONLY) */ - - /* If bus is not ready, can't come up */ - if (dhd->pub.busstate != DHD_BUS_DATA) { - dhd->wd_timer_valid = FALSE; - del_timer_sync(&dhd->timer); - DHD_ERROR(("%s failed bus is not ready\n", __FUNCTION__)); - return -ENODEV; - } - -#ifdef EMBEDDED_PLATFORM - bcm_mkiovar("event_msgs", dhdp->eventmask, WL_EVENTING_MASK_LEN, iovbuf, sizeof(iovbuf)); - dhdcdc_query_ioctl(dhdp, 0, WLC_GET_VAR, iovbuf, sizeof(iovbuf)); - bcopy(iovbuf, dhdp->eventmask, WL_EVENTING_MASK_LEN); - - setbit(dhdp->eventmask, WLC_E_SET_SSID); - setbit(dhdp->eventmask, WLC_E_PRUNE); - setbit(dhdp->eventmask, WLC_E_AUTH); - setbit(dhdp->eventmask, WLC_E_REASSOC); - setbit(dhdp->eventmask, WLC_E_REASSOC_IND); - setbit(dhdp->eventmask, WLC_E_DEAUTH_IND); - setbit(dhdp->eventmask, WLC_E_DISASSOC_IND); - setbit(dhdp->eventmask, WLC_E_DISASSOC); - setbit(dhdp->eventmask, WLC_E_JOIN); - setbit(dhdp->eventmask, WLC_E_ASSOC_IND); - setbit(dhdp->eventmask, WLC_E_PSK_SUP); - setbit(dhdp->eventmask, WLC_E_LINK); - setbit(dhdp->eventmask, WLC_E_NDIS_LINK); - setbit(dhdp->eventmask, WLC_E_MIC_ERROR); - setbit(dhdp->eventmask, WLC_E_PMKID_CACHE); - setbit(dhdp->eventmask, WLC_E_TXFAIL); - setbit(dhdp->eventmask, WLC_E_JOIN_START); - setbit(dhdp->eventmask, WLC_E_SCAN_COMPLETE); - setbit(dhdp->eventmask, WLC_E_RELOAD); -#ifdef PNO_SUPPORT - setbit(dhdp->eventmask, WLC_E_PFN_NET_FOUND); -#endif /* PNO_SUPPORT */ - -/* enable dongle roaming event */ - setbit(dhdp->eventmask, WLC_E_ROAM); - - dhdp->pktfilter_count = 1; - /* Setup filter to allow only unicast */ - dhdp->pktfilter[0] = "100 0 0 0 0x01 0x00"; -#endif /* EMBEDDED_PLATFORM */ - - /* Bus is ready, do any protocol initialization */ - if ((ret = dhd_prot_init(&dhd->pub)) < 0) - return ret; - - return 0; -} - -int -dhd_iovar(dhd_pub_t *pub, int ifidx, char *name, char *cmd_buf, uint cmd_len, int set) -{ - char buf[strlen(name) + 1 + cmd_len]; - int len = sizeof(buf); - wl_ioctl_t ioc; - int ret; - - len = bcm_mkiovar(name, cmd_buf, cmd_len, buf, len); - - memset(&ioc, 0, sizeof(ioc)); - - ioc.cmd = set? WLC_SET_VAR : WLC_GET_VAR; - ioc.buf = buf; - ioc.len = len; - ioc.set = set; - - ret = dhd_prot_ioctl(pub, ifidx, &ioc, ioc.buf, ioc.len); - if (!set && ret >= 0) - memcpy(cmd_buf, buf, cmd_len); - - return ret; -} - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31)) -static struct net_device_ops dhd_ops_pri = { - .ndo_open = dhd_open, - .ndo_stop = dhd_stop, - .ndo_get_stats = dhd_get_stats, - .ndo_do_ioctl = dhd_ioctl_entry, - .ndo_start_xmit = dhd_start_xmit, - .ndo_set_mac_address = dhd_set_mac_address, - .ndo_set_multicast_list = dhd_set_multicast_list, -}; - -static struct net_device_ops dhd_ops_virt = { - .ndo_get_stats = dhd_get_stats, - .ndo_do_ioctl = dhd_ioctl_entry, - .ndo_start_xmit = dhd_start_xmit, - .ndo_set_mac_address = dhd_set_mac_address, - .ndo_set_multicast_list = dhd_set_multicast_list, -}; -#endif - -int -dhd_net_attach(dhd_pub_t *dhdp, int ifidx) -{ - dhd_info_t *dhd = (dhd_info_t *)dhdp->info; - struct net_device *net; - uint8 temp_addr[ETHER_ADDR_LEN] = { 0x00, 0x90, 0x4c, 0x11, 0x22, 0x33 }; - - DHD_TRACE(("%s: ifidx %d\n", __FUNCTION__, ifidx)); - - ASSERT(dhd && dhd->iflist[ifidx]); - net = dhd->iflist[ifidx]->net; - - ASSERT(net); -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) - ASSERT(!net->open); - net->get_stats = dhd_get_stats; - net->do_ioctl = dhd_ioctl_entry; - net->hard_start_xmit = dhd_start_xmit; - net->set_mac_address = dhd_set_mac_address; - net->set_multicast_list = dhd_set_multicast_list; - net->open = net->stop = NULL; -#else - ASSERT(!net->netdev_ops); - net->netdev_ops = &dhd_ops_virt; -#endif - -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) - net->open = dhd_open; - net->stop = dhd_stop; -#else - net->netdev_ops = &dhd_ops_pri; -#endif - - /* - * We have to use the primary MAC for virtual interfaces - */ - if (ifidx != 0) { - /* for virtual interfaces use the primary MAC */ - memcpy(temp_addr, dhd->pub.mac.octet, ETHER_ADDR_LEN); - } - - if (ifidx == 1) { - DHD_TRACE(("%s ACCESS POINT MAC: \n", __FUNCTION__)); - /* ACCESSPOINT INTERFACE CASE */ - temp_addr[0] |= 0x02; /* set bit 2 , - Locally Administered address */ - } - net->hard_header_len = ETH_HLEN + dhd->pub.hdrlen; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) - net->ethtool_ops = &dhd_ethtool_ops; -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) */ - -#if defined(CONFIG_WIRELESS_EXT) -#if WIRELESS_EXT < 19 - net->get_wireless_stats = dhd_get_wireless_stats; -#endif /* WIRELESS_EXT < 19 */ -#if WIRELESS_EXT > 12 - net->wireless_handlers = (struct iw_handler_def *)&wl_iw_handler_def; -#endif /* WIRELESS_EXT > 12 */ -#endif /* defined(CONFIG_WIRELESS_EXT) */ - - dhd->pub.rxsz = net->mtu + net->hard_header_len + dhd->pub.hdrlen; - - memcpy(net->dev_addr, temp_addr, ETHER_ADDR_LEN); - - if (register_netdev(net) != 0) { - DHD_ERROR(("%s: couldn't register the net device\n", __FUNCTION__)); - goto fail; - } - - printf("%s: Broadcom Dongle Host Driver mac=%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", net->name, - dhd->pub.mac.octet[0], dhd->pub.mac.octet[1], dhd->pub.mac.octet[2], - dhd->pub.mac.octet[3], dhd->pub.mac.octet[4], dhd->pub.mac.octet[5]); - -#if defined(CONFIG_WIRELESS_EXT) -#if defined(CONFIG_FIRST_SCAN) -#ifdef SOFTAP - if (ifidx == 0) - /* Don't call for SOFTAP Interface in SOFTAP MODE */ - wl_iw_iscan_set_scan_broadcast_prep(net, 1); -#else - wl_iw_iscan_set_scan_broadcast_prep(net, 1); -#endif /* SOFTAP */ -#endif /* CONFIG_FIRST_SCAN */ -#endif /* CONFIG_WIRELESS_EXT */ - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) - up(&dhd_registration_sem); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */ - return 0; - -fail: -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) - net->open = NULL; -#else - net->netdev_ops = NULL; -#endif - return BCME_ERROR; -} - -void -dhd_bus_detach(dhd_pub_t *dhdp) -{ - dhd_info_t *dhd; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - if (dhdp) { - dhd = (dhd_info_t *)dhdp->info; - if (dhd) { - /* Stop the protocol module */ - dhd_prot_stop(&dhd->pub); - - /* Stop the bus module */ - dhd_bus_stop(dhd->pub.bus, TRUE); -#if defined(OOB_INTR_ONLY) - bcmsdh_unregister_oob_intr(); -#endif /* defined(OOB_INTR_ONLY) */ - - /* Clear the watchdog timer */ - dhd->wd_timer_valid = FALSE; - del_timer_sync(&dhd->timer); - } - } -} - -void -dhd_detach(dhd_pub_t *dhdp) -{ - dhd_info_t *dhd; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - if (dhdp) { - dhd = (dhd_info_t *)dhdp->info; - if (dhd) { - dhd_if_t *ifp; - int i; - -#if defined(CONFIG_HAS_EARLYSUSPEND) - if (dhd->early_suspend.suspend) - unregister_early_suspend(&dhd->early_suspend); -#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */ -#if defined(CONFIG_WIRELESS_EXT) - /* Attach and link in the iw */ - wl_iw_detach(); -#endif - if (dhd->sysioc_pid >= 0) { - KILL_PROC(dhd->sysioc_pid, SIGTERM); - wait_for_completion(&dhd->sysioc_exited); - } - - for (i = 1; i < DHD_MAX_IFS; i++) - if (dhd->iflist[i]) { - dhd->iflist[i]->state = WLC_E_IF_DEL; - dhd->iflist[i]->idx = i; - dhd_op_if(dhd->iflist[i]); - } - - ifp = dhd->iflist[0]; - ASSERT(ifp); -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) - if (ifp->net->open) { -#else - if (ifp->net->netdev_ops == &dhd_ops_pri) { -#endif - dhd_stop(ifp->net); - unregister_netdev(ifp->net); - } - - if (dhd->watchdog_pid >= 0) - { - KILL_PROC(dhd->watchdog_pid, SIGTERM); - wait_for_completion(&dhd->watchdog_exited); - } - - if (dhd->dpc_pid >= 0) - { - KILL_PROC(dhd->dpc_pid, SIGTERM); - wait_for_completion(&dhd->dpc_exited); - } - else - tasklet_kill(&dhd->tasklet); - - dhd_bus_detach(dhdp); - - if (dhdp->prot) - dhd_prot_detach(dhdp); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) - unregister_pm_notifier(&dhd_sleep_pm_notifier); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */ - free_netdev(ifp->net); -#ifdef CONFIG_HAS_WAKELOCK - wake_lock_destroy(&dhd->wl_wifi); - wake_lock_destroy(&dhd->wl_rxwake); -#endif - MFREE(dhd->pub.osh, ifp, sizeof(*ifp)); - MFREE(dhd->pub.osh, dhd, sizeof(*dhd)); - } - } -} - -extern void reset_g_onoff(void); -void -rockchip_wifi_exit_module(void) -{ - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - dhd_bus_unregister(); -#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) - wifi_del_dev(); -#endif - /* Call customer gpio to turn off power with WL_REG_ON signal */ - dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF); - bcm4329_power_save_exit(); -} - -int -rockchip_wifi_init_module(void) -{ - int error; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - printk("BCM4319 Wi-Fi driver (Powered by Rockchip,Ver %s) init.\n", BCM4319_DRV_VERSION); - /* Sanity check on the module parameters */ - do { - /* Both watchdog and DPC as tasklets are ok */ - if ((dhd_watchdog_prio < 0) && (dhd_dpc_prio < 0)) - break; - - /* If both watchdog and DPC are threads, TX must be deferred */ - if ((dhd_watchdog_prio >= 0) && (dhd_dpc_prio >= 0) && dhd_deferred_tx) - break; - - DHD_ERROR(("Invalid module parameters.\n")); - return -EINVAL; - } while (0); - - reset_g_onoff(); - - /* Call customer gpio to turn on power with WL_REG_ON signal */ - dhd_customer_gpio_wlan_ctrl(WLAN_POWER_ON); - -#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) - sema_init(&wifi_control_sem, 0); - - error = wifi_add_dev(); - if (error) { - DHD_ERROR(("%s: platform_driver_register failed\n", __FUNCTION__)); - goto fail_0; - } - - /* Waiting callback after platform_driver_register is done or exit with error */ - if (down_timeout(&wifi_control_sem, msecs_to_jiffies(5000)) != 0) { - error = -EINVAL; - DHD_ERROR(("%s: platform_driver_register timeout\n", __FUNCTION__)); - goto fail_1; - } -#endif /* #if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */ - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) - sema_init(&dhd_registration_sem, 0); -#endif - - error = dhd_bus_register(); - - if (!error) - printf("\n%s\n", dhd_version); - else { - DHD_ERROR(("%s: sdio_register_driver failed\n", __FUNCTION__)); - goto fail_1; - } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) - /* - * Wait till MMC sdio_register_driver callback called and made driver attach. - * It's needed to make sync up exit from dhd insmod and - * Kernel MMC sdio device callback registration - */ - if (down_timeout(&dhd_registration_sem, msecs_to_jiffies(DHD_REGISTRATION_TIMEOUT)) != 0) { - error = -EINVAL; - DHD_ERROR(("%s: sdio_register_driver timeout\n", __FUNCTION__)); - goto fail_2; - } -#endif - bcm4329_power_save_init(); - - return error; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) -fail_2: - dhd_bus_unregister(); -#endif -fail_1: -#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) - wifi_del_dev(); -fail_0: -#endif /* defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */ - - /* Call customer gpio to turn off power with WL_REG_ON signal */ - dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF); - - return error; -} - -//module_init(dhd_module_init); -//module_exit(dhd_module_cleanup); -int mv88w8686_if_sdio_init_module(void) -{ - return rockchip_wifi_init_module(); -} - -void mv88w8686_if_sdio_exit_module(void) -{ - rockchip_wifi_exit_module(); -} - -EXPORT_SYMBOL(rockchip_wifi_init_module); -EXPORT_SYMBOL(rockchip_wifi_exit_module); -EXPORT_SYMBOL(mv88w8686_if_sdio_init_module); -EXPORT_SYMBOL(mv88w8686_if_sdio_exit_module); - - -/* - * OS specific functions required to implement DHD driver in OS independent way - */ -int -dhd_os_proto_block(dhd_pub_t *pub) -{ - dhd_info_t *dhd = (dhd_info_t *)(pub->info); - - if (dhd) { - mutex_lock(&dhd->proto_sem); - return 1; - } - - return 0; -} - -int -dhd_os_proto_unblock(dhd_pub_t *pub) -{ - dhd_info_t *dhd = (dhd_info_t *)(pub->info); - - if (dhd) { - mutex_unlock(&dhd->proto_sem); - return 1; - } - - return 0; -} - -unsigned int -dhd_os_get_ioctl_resp_timeout(void) -{ - return ((unsigned int)dhd_ioctl_timeout_msec); -} - -void -dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec) -{ - dhd_ioctl_timeout_msec = (int)timeout_msec; -} - -int -dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, bool *pending) -{ - dhd_info_t *dhd = (dhd_info_t *)(pub->info); - DECLARE_WAITQUEUE(wait, current); - int timeout = dhd_ioctl_timeout_msec; - - /* Convert timeout in millsecond to jiffies */ - /* timeout = timeout * HZ / 1000; */ - timeout = msecs_to_jiffies(timeout); - - /* Wait until control frame is available */ - add_wait_queue(&dhd->ioctl_resp_wait, &wait); - set_current_state(TASK_INTERRUPTIBLE); - smp_mb(); - while (!(*condition) && (!signal_pending(current) && timeout)) { - timeout = schedule_timeout(timeout); - smp_mb(); - } - - if (signal_pending(current)) - *pending = TRUE; - - set_current_state(TASK_RUNNING); - remove_wait_queue(&dhd->ioctl_resp_wait, &wait); - - return timeout; -} - -int -dhd_os_ioctl_resp_wake(dhd_pub_t *pub) -{ - dhd_info_t *dhd = (dhd_info_t *)(pub->info); - - if (waitqueue_active(&dhd->ioctl_resp_wait)) { - wake_up_interruptible(&dhd->ioctl_resp_wait); - } - - return 0; -} - -void -dhd_os_wd_timer(void *bus, uint wdtick) -{ - dhd_pub_t *pub = bus; - dhd_info_t *dhd = (dhd_info_t *)pub->info; - unsigned long flags; - int del_timer_flag = FALSE; - - flags = dhd_os_spin_lock(pub); - - /* don't start the wd until fw is loaded */ - if (pub->busstate != DHD_BUS_DOWN) { - if (wdtick) { - dhd_watchdog_ms = (uint)wdtick; - dhd->wd_timer_valid = TRUE; - /* Re arm the timer, at last watchdog period */ - mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000); - } else if (dhd->wd_timer_valid == TRUE) { - /* Totally stop the timer */ - dhd->wd_timer_valid = FALSE; - del_timer_flag = TRUE; - } - } - dhd_os_spin_unlock(pub, flags); - if (del_timer_flag) { - del_timer_sync(&dhd->timer); - } -} - -void * -dhd_os_open_image(char *filename) -{ - struct file *fp; - - fp = filp_open(filename, O_RDONLY, 0); - /* - * 2.6.11 (FC4) supports filp_open() but later revs don't? - * Alternative: - * fp = open_namei(AT_FDCWD, filename, O_RD, 0); - * ??? - */ - if (IS_ERR(fp)) - fp = NULL; - - return fp; -} - -int -dhd_os_get_image_block(char *buf, int len, void *image) -{ - struct file *fp = (struct file *)image; - int rdlen; - - if (!image) - return 0; - - rdlen = kernel_read(fp, fp->f_pos, buf, len); - if (rdlen > 0) - fp->f_pos += rdlen; - - return rdlen; -} - -void -dhd_os_close_image(void *image) -{ - if (image) - filp_close((struct file *)image, NULL); -} - - -void -dhd_os_sdlock(dhd_pub_t *pub) -{ - dhd_info_t *dhd; - - dhd = (dhd_info_t *)(pub->info); - - if (dhd->threads_only) - mutex_lock(&dhd->sdsem); - else - spin_lock_bh(&dhd->sdlock); -} - -void -dhd_os_sdunlock(dhd_pub_t *pub) -{ - dhd_info_t *dhd; - - dhd = (dhd_info_t *)(pub->info); - - if (dhd->threads_only) - mutex_unlock(&dhd->sdsem); - else - spin_unlock_bh(&dhd->sdlock); -} - -void -dhd_os_sdlock_txq(dhd_pub_t *pub) -{ - dhd_info_t *dhd; - - dhd = (dhd_info_t *)(pub->info); - spin_lock_bh(&dhd->txqlock); -} - -void -dhd_os_sdunlock_txq(dhd_pub_t *pub) -{ - dhd_info_t *dhd; - - dhd = (dhd_info_t *)(pub->info); - spin_unlock_bh(&dhd->txqlock); -} -void -dhd_os_sdlock_rxq(dhd_pub_t *pub) -{ -} -void -dhd_os_sdunlock_rxq(dhd_pub_t *pub) -{ -} - -void -dhd_os_sdtxlock(dhd_pub_t *pub) -{ - dhd_os_sdlock(pub); -} - -void -dhd_os_sdtxunlock(dhd_pub_t *pub) -{ - dhd_os_sdunlock(pub); -} - -#ifdef DHD_USE_STATIC_BUF -void * dhd_os_prealloc(int section, unsigned long size) -{ -#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) - void *alloc_ptr = NULL; - if (wifi_control_data && wifi_control_data->mem_prealloc) - { - alloc_ptr = wifi_control_data->mem_prealloc(section, size); - if (alloc_ptr) - { - DHD_INFO(("success alloc section %d\n", section)); - bzero(alloc_ptr, size); - return alloc_ptr; - } - } - - DHD_ERROR(("can't alloc section %d\n", section)); - return 0; -#else -return MALLOC(0, size); -#endif /* #if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */ -} -#endif /* DHD_USE_STATIC_BUF */ -#if defined(CONFIG_WIRELESS_EXT) -struct iw_statistics * -dhd_get_wireless_stats(struct net_device *dev) -{ - int res = 0; - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - - res = wl_iw_get_wireless_stats(dev, &dhd->iw.wstats); - - if (res == 0) - return &dhd->iw.wstats; - else - return NULL; -} -#endif /* defined(CONFIG_WIRELESS_EXT) */ - -static int -dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata, - wl_event_msg_t *event, void **data) -{ - int bcmerror = 0; - - ASSERT(dhd != NULL); - - bcmerror = wl_host_event(dhd, ifidx, pktdata, event, data); - if (bcmerror != BCME_OK) - return (bcmerror); - -#if defined(CONFIG_WIRELESS_EXT) - ASSERT(dhd->iflist[*ifidx] != NULL); - - if (ntoh32(event->event_type) == WLC_E_IF) { - DHD_INFO(("<0> interface:%d OP:%d don't pass to wext," - "net_device might not be created yet\n", - *ifidx, ntoh32(event->event_type))); - return bcmerror; - } - - ASSERT(dhd->iflist[*ifidx]->net != NULL); - - if (dhd->iflist[*ifidx]->net) - wl_iw_event(dhd->iflist[*ifidx]->net, event, *data); -#endif /* defined(CONFIG_WIRELESS_EXT) */ - - return (bcmerror); -} - -/* send up locally generated event */ -void -dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data) -{ - switch (ntoh32(event->event_type)) { - default: - break; - } -} - -void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) - struct dhd_info *dhdinfo = dhd->info; - dhd_os_sdunlock(dhd); - wait_event_interruptible_timeout(dhdinfo->ctrl_wait, (*lockvar == FALSE), HZ * 2); - dhd_os_sdlock(dhd); -#endif - return; -} - -void dhd_wait_event_wakeup(dhd_pub_t *dhd) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) - struct dhd_info *dhdinfo = dhd->info; - if (waitqueue_active(&dhdinfo->ctrl_wait)) - wake_up_interruptible(&dhdinfo->ctrl_wait); -#endif - return; -} - -int -dhd_dev_reset(struct net_device *dev, uint8 flag) -{ - int ret; - - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - - ret = dhd_bus_devreset(&dhd->pub, flag); - if (ret) { - DHD_ERROR(("%s: dhd_bus_devreset: %d\n", __FUNCTION__, ret)); - return ret; - } - DHD_ERROR(("%s: WLAN %s DONE\n", __FUNCTION__, flag ? "OFF" : "ON")); - - return ret; -} - -int net_os_set_suspend_disable(struct net_device *dev, int val) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - int ret = 0; - - if (dhd) { - ret = dhd->pub.suspend_disable_flag; - dhd->pub.suspend_disable_flag = val; - } - return ret; -} - -int net_os_set_suspend(struct net_device *dev, int val) -{ - int ret = 0; -#if defined(CONFIG_HAS_EARLYSUSPEND) - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - - if (dhd) { - dhd_os_proto_block(&dhd->pub); - ret = dhd_set_suspend(val, &dhd->pub); - dhd_os_proto_unblock(&dhd->pub); - } -#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */ - return ret; -} - -int net_os_set_dtim_skip(struct net_device *dev, int val) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - - if (dhd) - dhd->pub.dtim_skip = val; - - return 0; -} - -int net_os_set_packet_filter(struct net_device *dev, int val) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - int ret = 0; - - /* Packet filtering is set only if we still in early-suspend and - * we need either to turn it ON or turn it OFF - * We can always turn it OFF in case of early-suspend, but we turn it - * back ON only if suspend_disable_flag was not set - */ - if (dhd && dhd->pub.up) { - dhd_os_proto_block(&dhd->pub); - if (dhd->pub.in_suspend) { - if (!val || (val && !dhd->pub.suspend_disable_flag)) - dhd_set_packet_filter(val, &dhd->pub); - } - dhd_os_proto_unblock(&dhd->pub); - } - return ret; -} - - -void -dhd_dev_init_ioctl(struct net_device *dev) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - - dhd_preinit_ioctls(&dhd->pub); -} - -#ifdef PNO_SUPPORT -/* Linux wrapper to call common dhd_pno_clean */ -int -dhd_dev_pno_reset(struct net_device *dev) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - - return (dhd_pno_clean(&dhd->pub)); -} - - -/* Linux wrapper to call common dhd_pno_enable */ -int -dhd_dev_pno_enable(struct net_device *dev, int pfn_enabled) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - - return (dhd_pno_enable(&dhd->pub, pfn_enabled)); -} - - -/* Linux wrapper to call common dhd_pno_set */ -int -dhd_dev_pno_set(struct net_device *dev, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - - return (dhd_pno_set(&dhd->pub, ssids_local, nssid, scan_fr)); -} - -/* Linux wrapper to get pno status */ -int -dhd_dev_get_pno_status(struct net_device *dev) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - - return (dhd_pno_get_status(&dhd->pub)); -} - -#endif /* PNO_SUPPORT */ - -int net_os_send_hang_message(struct net_device *dev) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - int ret = 0; - - if (dhd) { - if (!dhd->hang_was_sent) { - dhd->hang_was_sent = 1; - ret = wl_iw_send_priv_event(dev, "HANG"); - } - } - return ret; -} - -void dhd_bus_country_set(struct net_device *dev, char *country_code) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - - if (dhd && dhd->pub.up) - strncpy(dhd->pub.country_code, country_code, WLC_CNTRY_BUF_SZ); -} - -char *dhd_bus_country_get(struct net_device *dev) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - - if (dhd && (dhd->pub.country_code[0] != 0)) - return dhd->pub.country_code; - return NULL; -} - -void dhd_os_start_lock(dhd_pub_t *pub) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) - dhd_info_t *dhd = (dhd_info_t *)(pub->info); - - if (dhd) - mutex_lock(&dhd->wl_start_lock); -#endif -} - -void dhd_os_start_unlock(dhd_pub_t *pub) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) - dhd_info_t *dhd = (dhd_info_t *)(pub->info); - - if (dhd) - mutex_unlock(&dhd->wl_start_lock); -#endif -} - -static int -dhd_get_pend_8021x_cnt(dhd_info_t *dhd) -{ - return (atomic_read(&dhd->pend_8021x_cnt)); -} - -#define MAX_WAIT_FOR_8021X_TX 10 - -int -dhd_wait_pend8021x(struct net_device *dev) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - int timeout = 10 * HZ / 1000; - int ntimes = MAX_WAIT_FOR_8021X_TX; - int pend = dhd_get_pend_8021x_cnt(dhd); - - while (ntimes && pend) { - if (pend) { - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(timeout); - set_current_state(TASK_RUNNING); - ntimes--; - } - pend = dhd_get_pend_8021x_cnt(dhd); - } - return pend; -} - -#ifdef DHD_DEBUG -int -write_to_file(dhd_pub_t *dhd, uint8 *buf, int size) -{ - int ret = 0; - struct file *fp; - mm_segment_t old_fs; - loff_t pos = 0; - - /* change to KERNEL_DS address limit */ - old_fs = get_fs(); - set_fs(KERNEL_DS); - - /* open file to write */ - fp = filp_open("/tmp/mem_dump", O_WRONLY|O_CREAT, 0640); - if (!fp) { - printf("%s: open file error\n", __FUNCTION__); - ret = -1; - goto exit; - } - - /* Write buf to file */ - fp->f_op->write(fp, buf, size, &pos); - -exit: - /* free buf before return */ - MFREE(dhd->osh, buf, size); - /* close file before return */ - if (fp) - filp_close(fp, current->files); - /* restore previous address limit */ - set_fs(old_fs); - - return ret; -} -#endif /* DHD_DEBUG */ - -int dhd_os_wake_lock_timeout(dhd_pub_t *pub) -{ - dhd_info_t *dhd = (dhd_info_t *)(pub->info); - unsigned long flags; - int ret = 0; - - if (dhd) { - spin_lock_irqsave(&dhd->wl_lock, flags); - ret = dhd->wl_packet; -#ifdef CONFIG_HAS_WAKELOCK - if (dhd->wl_packet) - wake_lock_timeout(&dhd->wl_rxwake, HZ); -#endif - dhd->wl_packet = 0; - spin_unlock_irqrestore(&dhd->wl_lock, flags); - } - /* printk("%s: %d\n", __FUNCTION__, ret); */ - return ret; -} - -int net_os_wake_lock_timeout(struct net_device *dev) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - int ret = 0; - - if (dhd) - ret = dhd_os_wake_lock_timeout(&dhd->pub); - return ret; -} - -int dhd_os_wake_lock_timeout_enable(dhd_pub_t *pub) -{ - dhd_info_t *dhd = (dhd_info_t *)(pub->info); - unsigned long flags; - - if (dhd) { - spin_lock_irqsave(&dhd->wl_lock, flags); - dhd->wl_packet = 1; - spin_unlock_irqrestore(&dhd->wl_lock, flags); - } - /* printk("%s\n",__func__); */ - return 0; -} - -int net_os_wake_lock_timeout_enable(struct net_device *dev) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - int ret = 0; - - if (dhd) - ret = dhd_os_wake_lock_timeout_enable(&dhd->pub); - return ret; -} - -int dhd_os_wake_lock(dhd_pub_t *pub) -{ - dhd_info_t *dhd = (dhd_info_t *)(pub->info); - unsigned long flags; - int ret = 0; - - if (dhd) { - spin_lock_irqsave(&dhd->wl_lock, flags); -#ifdef CONFIG_HAS_WAKELOCK - if (!dhd->wl_count) - wake_lock(&dhd->wl_wifi); -#endif - dhd->wl_count++; - ret = dhd->wl_count; - spin_unlock_irqrestore(&dhd->wl_lock, flags); - } - /* printk("%s: %d\n", __FUNCTION__, ret); */ - return ret; -} - -int net_os_wake_lock(struct net_device *dev) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - int ret = 0; - - if (dhd) - ret = dhd_os_wake_lock(&dhd->pub); - return ret; -} - -int dhd_os_wake_unlock(dhd_pub_t *pub) -{ - dhd_info_t *dhd = (dhd_info_t *)(pub->info); - unsigned long flags; - int ret = 0; - - dhd_os_wake_lock_timeout(pub); - if (dhd) { - spin_lock_irqsave(&dhd->wl_lock, flags); - if (dhd->wl_count) { - dhd->wl_count--; -#ifdef CONFIG_HAS_WAKELOCK - if (!dhd->wl_count) - wake_unlock(&dhd->wl_wifi); -#endif - ret = dhd->wl_count; - } - spin_unlock_irqrestore(&dhd->wl_lock, flags); - } - /* printk("%s: %d\n", __FUNCTION__, ret); */ - return ret; -} - -int net_os_wake_unlock(struct net_device *dev) -{ - dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); - int ret = 0; - - if (dhd) - ret = dhd_os_wake_unlock(&dhd->pub); - return ret; -} - -unsigned long dhd_os_spin_lock(dhd_pub_t *pub) -{ - dhd_info_t *dhd = (dhd_info_t *)(pub->info); - unsigned long flags = 0; - - if (dhd) - spin_lock_irqsave(&dhd->dhd_lock, flags); - - return flags; -} - -void dhd_os_spin_unlock(dhd_pub_t *pub, unsigned long flags) -{ - dhd_info_t *dhd = (dhd_info_t *)(pub->info); - - if (dhd) - spin_unlock_irqrestore(&dhd->dhd_lock, flags); -} diff --git a/drivers/net/wireless/bcm4319/dhd_linux_sched.c b/drivers/net/wireless/bcm4319/dhd_linux_sched.c deleted file mode 100644 index 480b416657ee..000000000000 --- a/drivers/net/wireless/bcm4319/dhd_linux_sched.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Expose some of the kernel scheduler routines - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: dhd_linux_sched.c,v 1.1.34.1.6.1 2009/01/16 01:17:40 Exp $ - */ -#include -#include -#include -#include - -int setScheduler(struct task_struct *p, int policy, struct sched_param *param) -{ - int rc = 0; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) - rc = sched_setscheduler(p, policy, param); -#endif /* LinuxVer */ - return rc; -} diff --git a/drivers/net/wireless/bcm4319/dhd_proto.h b/drivers/net/wireless/bcm4319/dhd_proto.h deleted file mode 100644 index 7ef6929a5bf7..000000000000 --- a/drivers/net/wireless/bcm4319/dhd_proto.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Header file describing the internal (inter-module) DHD interfaces. - * - * Provides type definitions and function prototypes used to link the - * DHD OS, bus, and protocol modules. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: dhd_proto.h,v 1.2.82.1.4.1.16.7 2010/05/10 12:54:59 Exp $ - */ - -#ifndef _dhd_proto_h_ -#define _dhd_proto_h_ - -#include -#include - -#ifndef IOCTL_RESP_TIMEOUT -#define IOCTL_RESP_TIMEOUT 3000 /* In milli second */ -#endif - -#ifndef IOCTL_CHIP_ACTIVE_TIMEOUT -#define IOCTL_CHIP_ACTIVE_TIMEOUT 10 /* In milli second */ -#endif - -/* - * Exported from the dhd protocol module (dhd_cdc, dhd_rndis) - */ - -/* Linkage, sets prot link and updates hdrlen in pub */ -extern int dhd_prot_attach(dhd_pub_t *dhdp); - -/* Unlink, frees allocated protocol memory (including dhd_prot) */ -extern void dhd_prot_detach(dhd_pub_t *dhdp); - -/* Initialize protocol: sync w/dongle state. - * Sets dongle media info (iswl, drv_version, mac address). - */ -extern int dhd_prot_init(dhd_pub_t *dhdp); - -/* Stop protocol: sync w/dongle state. */ -extern void dhd_prot_stop(dhd_pub_t *dhdp); - -extern bool dhd_proto_fcinfo(dhd_pub_t *dhd, void *pktbuf, uint8 *fcbits); - -/* Add any protocol-specific data header. - * Caller must reserve prot_hdrlen prepend space. - */ -extern void dhd_prot_hdrpush(dhd_pub_t *, int ifidx, void *txp); - -/* Remove any protocol-specific data header. */ -extern int dhd_prot_hdrpull(dhd_pub_t *, int *ifidx, void *rxp); - -/* Use protocol to issue ioctl to dongle */ -extern int dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t * ioc, void * buf, int len); - -/* Check for and handle local prot-specific iovar commands */ -extern int dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name, - void *params, int plen, void *arg, int len, bool set); - -/* Add prot dump output to a buffer */ -extern void dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf); - -/* Update local copy of dongle statistics */ -extern void dhd_prot_dstats(dhd_pub_t *dhdp); - -extern int dhd_ioctl(dhd_pub_t * dhd_pub, dhd_ioctl_t *ioc, void * buf, uint buflen); - -extern int dhd_preinit_ioctls(dhd_pub_t *dhd); - -/******************************** - * For version-string expansion * - */ -#if defined(BDC) -#define DHD_PROTOCOL "bdc" -#elif defined(CDC) -#define DHD_PROTOCOL "cdc" -#elif defined(RNDIS) -#define DHD_PROTOCOL "rndis" -#else -#define DHD_PROTOCOL "unknown" -#endif /* proto */ - -#endif /* _dhd_proto_h_ */ diff --git a/drivers/net/wireless/bcm4319/dhd_sdio.c b/drivers/net/wireless/bcm4319/dhd_sdio.c deleted file mode 100644 index 78dff1c489b8..000000000000 --- a/drivers/net/wireless/bcm4319/dhd_sdio.c +++ /dev/null @@ -1,5883 +0,0 @@ -/* - * DHD Bus Module for SDIO - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: dhd_sdio.c,v 1.157.2.27.2.33.2.129.4.1 2010/09/02 23:13:16 Exp $ - */ - -#include -#include -#include - -#ifdef BCMEMBEDIMAGE -#include BCMEMBEDIMAGE -#endif /* BCMEMBEDIMAGE */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#ifdef DHD_DEBUG -#include -#endif /* DHD_DEBUG */ -#ifdef DHD_DEBUG_TRAP -#include -#endif /* DHD_DEBUG_TRAP */ - -#define QLEN 256 /* bulk rx and tx queue lengths */ -#define FCHI (QLEN - 10) -#define FCLOW (FCHI / 2) -#define PRIOMASK 7 - -#define TXRETRIES 2 /* # of retries for tx frames */ - -#if defined(CONFIG_MACH_SANDGATE2G) -#define DHD_RXBOUND 250 /* Default for max rx frames in one scheduling */ -#else -#define DHD_RXBOUND 50 /* Default for max rx frames in one scheduling */ -#endif /* defined(CONFIG_MACH_SANDGATE2G) */ - -#define DHD_TXBOUND 20 /* Default for max tx frames in one scheduling */ - -#define DHD_TXMINMAX 1 /* Max tx frames if rx still pending */ - -#define MEMBLOCK 2048 /* Block size used for downloading of dongle image */ -#define MAX_DATA_BUF (32 * 1024) /* Must be large enough to hold biggest possible glom */ - -/* Packet alignment for most efficient SDIO (can change based on platform) */ -#ifndef DHD_SDALIGN -#define DHD_SDALIGN 32 -#endif -#if !ISPOWEROF2(DHD_SDALIGN) -#error DHD_SDALIGN is not a power of 2! -#endif - -#ifndef DHD_FIRSTREAD -#define DHD_FIRSTREAD 32 -#endif -#if !ISPOWEROF2(DHD_FIRSTREAD) -#error DHD_FIRSTREAD is not a power of 2! -#endif - -/* Total length of frame header for dongle protocol */ -#define SDPCM_HDRLEN (SDPCM_FRAMETAG_LEN + SDPCM_SWHEADER_LEN) -#ifdef SDTEST -#define SDPCM_RESERVE (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN) -#else -#define SDPCM_RESERVE (SDPCM_HDRLEN + DHD_SDALIGN) -#endif - -/* Space for header read, limit for data packets */ -#ifndef MAX_HDR_READ -#define MAX_HDR_READ 32 -#endif -#if !ISPOWEROF2(MAX_HDR_READ) -#error MAX_HDR_READ is not a power of 2! -#endif - -#define MAX_RX_DATASZ 2048 - -/* Maximum milliseconds to wait for F2 to come up */ -#define DHD_WAIT_F2RDY 3000 - -/* Bump up limit on waiting for HT to account for first startup; - * if the image is doing a CRC calculation before programming the PMU - * for HT availability, it could take a couple hundred ms more, so - * max out at a 1 second (1000000us). - */ -#if (PMU_MAX_TRANSITION_DLY < 1000000) -#undef PMU_MAX_TRANSITION_DLY -#define PMU_MAX_TRANSITION_DLY 1000000 -#endif - -/* Value for ChipClockCSR during initial setup */ -#define DHD_INIT_CLKCTL1 (SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ) -#define DHD_INIT_CLKCTL2 (SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_FORCE_ALP) - -/* Flags for SDH calls */ -#define F2SYNC (SDIO_REQ_4BYTE | SDIO_REQ_FIXED) - -/* Packet free applicable unconditionally for sdio and sdspi. Conditional if - * bufpool was present for gspi bus. - */ -#define PKTFREE2() if ((bus->bus != SPI_BUS) || bus->usebufpool) \ - PKTFREE(bus->dhd->osh, pkt, FALSE); -DHD_SPINWAIT_SLEEP_INIT(sdioh_spinwait_sleep); -extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len); - -extern void bcmsdh_set_irq(int flag); - -#ifdef DHD_DEBUG -/* Device console log buffer state */ -typedef struct dhd_console { - uint count; /* Poll interval msec counter */ - uint log_addr; /* Log struct address (fixed) */ - hndrte_log_t log; /* Log struct (host copy) */ - uint bufsize; /* Size of log buffer */ - uint8 *buf; /* Log buffer (host copy) */ - uint last; /* Last buffer read index */ -} dhd_console_t; -#endif /* DHD_DEBUG */ - -/* Private data for SDIO bus interaction */ -typedef struct dhd_bus { - dhd_pub_t *dhd; - - bcmsdh_info_t *sdh; /* Handle for BCMSDH calls */ - si_t *sih; /* Handle for SI calls */ - char *vars; /* Variables (from CIS and/or other) */ - uint varsz; /* Size of variables buffer */ - uint32 sbaddr; /* Current SB window pointer (-1, invalid) */ - - sdpcmd_regs_t *regs; /* Registers for SDIO core */ - uint sdpcmrev; /* SDIO core revision */ - uint armrev; /* CPU core revision */ - uint ramrev; /* SOCRAM core revision */ - uint32 ramsize; /* Size of RAM in SOCRAM (bytes) */ - uint32 orig_ramsize; /* Size of RAM in SOCRAM (bytes) */ - - uint32 bus; /* gSPI or SDIO bus */ - uint32 hostintmask; /* Copy of Host Interrupt Mask */ - uint32 intstatus; /* Intstatus bits (events) pending */ - bool dpc_sched; /* Indicates DPC schedule (intrpt rcvd) */ - bool fcstate; /* State of dongle flow-control */ - - uint16 cl_devid; /* cached devid for dhdsdio_probe_attach() */ - char *fw_path; /* module_param: path to firmware image */ - char *nv_path; /* module_param: path to nvram vars file */ - const char *nvram_params; /* user specified nvram params. */ - - uint blocksize; /* Block size of SDIO transfers */ - uint roundup; /* Max roundup limit */ - - struct pktq txq; /* Queue length used for flow-control */ - uint8 flowcontrol; /* per prio flow control bitmask */ - uint8 tx_seq; /* Transmit sequence number (next) */ - uint8 tx_max; /* Maximum transmit sequence allowed */ - - uint8 hdrbuf[MAX_HDR_READ + DHD_SDALIGN]; - uint8 *rxhdr; /* Header of current rx frame (in hdrbuf) */ - uint16 nextlen; /* Next Read Len from last header */ - uint8 rx_seq; /* Receive sequence number (expected) */ - bool rxskip; /* Skip receive (awaiting NAK ACK) */ - - void *glomd; /* Packet containing glomming descriptor */ - void *glom; /* Packet chain for glommed superframe */ - uint glomerr; /* Glom packet read errors */ - - uint8 *rxbuf; /* Buffer for receiving control packets */ - uint rxblen; /* Allocated length of rxbuf */ - uint8 *rxctl; /* Aligned pointer into rxbuf */ - uint8 *databuf; /* Buffer for receiving big glom packet */ - uint8 *dataptr; /* Aligned pointer into databuf */ - uint rxlen; /* Length of valid data in buffer */ - - uint8 sdpcm_ver; /* Bus protocol reported by dongle */ - - bool intr; /* Use interrupts */ - bool poll; /* Use polling */ - bool ipend; /* Device interrupt is pending */ - bool intdis; /* Interrupts disabled by isr */ - uint intrcount; /* Count of device interrupt callbacks */ - uint lastintrs; /* Count as of last watchdog timer */ - uint spurious; /* Count of spurious interrupts */ - uint pollrate; /* Ticks between device polls */ - uint polltick; /* Tick counter */ - uint pollcnt; /* Count of active polls */ - -#ifdef DHD_DEBUG - dhd_console_t console; /* Console output polling support */ - uint console_addr; /* Console address from shared struct */ -#endif /* DHD_DEBUG */ - - uint regfails; /* Count of R_REG/W_REG failures */ - - uint clkstate; /* State of sd and backplane clock(s) */ - bool activity; /* Activity flag for clock down */ - int32 idletime; /* Control for activity timeout */ - int32 idlecount; /* Activity timeout counter */ - int32 idleclock; /* How to set bus driver when idle */ - int32 sd_divisor; /* Speed control to bus driver */ - int32 sd_mode; /* Mode control to bus driver */ - int32 sd_rxchain; /* If bcmsdh api accepts PKT chains */ - bool use_rxchain; /* If dhd should use PKT chains */ - bool sleeping; /* Is SDIO bus sleeping? */ - bool rxflow_mode; /* Rx flow control mode */ - bool rxflow; /* Is rx flow control on */ - uint prev_rxlim_hit; /* Is prev rx limit exceeded (per dpc schedule) */ - bool alp_only; /* Don't use HT clock (ALP only) */ - /* Field to decide if rx of control frames happen in rxbuf or lb-pool */ - bool usebufpool; - -#ifdef SDTEST - /* external loopback */ - bool ext_loop; - uint8 loopid; - - /* pktgen configuration */ - uint pktgen_freq; /* Ticks between bursts */ - uint pktgen_count; /* Packets to send each burst */ - uint pktgen_print; /* Bursts between count displays */ - uint pktgen_total; /* Stop after this many */ - uint pktgen_minlen; /* Minimum packet data len */ - uint pktgen_maxlen; /* Maximum packet data len */ - uint pktgen_mode; /* Configured mode: tx, rx, or echo */ - uint pktgen_stop; /* Number of tx failures causing stop */ - - /* active pktgen fields */ - uint pktgen_tick; /* Tick counter for bursts */ - uint pktgen_ptick; /* Burst counter for printing */ - uint pktgen_sent; /* Number of test packets generated */ - uint pktgen_rcvd; /* Number of test packets received */ - uint pktgen_fail; /* Number of failed send attempts */ - uint16 pktgen_len; /* Length of next packet to send */ -#endif /* SDTEST */ - - /* Some additional counters */ - uint tx_sderrs; /* Count of tx attempts with sd errors */ - uint fcqueued; /* Tx packets that got queued */ - uint rxrtx; /* Count of rtx requests (NAK to dongle) */ - uint rx_toolong; /* Receive frames too long to receive */ - uint rxc_errors; /* SDIO errors when reading control frames */ - uint rx_hdrfail; /* SDIO errors on header reads */ - uint rx_badhdr; /* Bad received headers (roosync?) */ - uint rx_badseq; /* Mismatched rx sequence number */ - uint fc_rcvd; /* Number of flow-control events received */ - uint fc_xoff; /* Number which turned on flow-control */ - uint fc_xon; /* Number which turned off flow-control */ - uint rxglomfail; /* Failed deglom attempts */ - uint rxglomframes; /* Number of glom frames (superframes) */ - uint rxglompkts; /* Number of packets from glom frames */ - uint f2rxhdrs; /* Number of header reads */ - uint f2rxdata; /* Number of frame data reads */ - uint f2txdata; /* Number of f2 frame writes */ - uint f1regdata; /* Number of f1 register accesses */ - - uint8 *ctrl_frame_buf; - uint32 ctrl_frame_len; - bool ctrl_frame_stat; -} dhd_bus_t; - -/* clkstate */ -#define CLK_NONE 0 -#define CLK_SDONLY 1 -#define CLK_PENDING 2 /* Not used yet */ -#define CLK_AVAIL 3 - -#define DHD_NOPMU(dhd) (FALSE) - -#ifdef DHD_DEBUG -static int qcount[NUMPRIO]; -static int tx_packets[NUMPRIO]; -#endif /* DHD_DEBUG */ - -/* Deferred transmit */ -const uint dhd_deferred_tx = 1; - -extern uint dhd_watchdog_ms; -extern void dhd_os_wd_timer(void *bus, uint wdtick); - -/* Tx/Rx bounds */ -uint dhd_txbound; -uint dhd_rxbound; -uint dhd_txminmax; - -/* override the RAM size if possible */ -#define DONGLE_MIN_MEMSIZE (128 *1024) -int dhd_dongle_memsize; - -static bool dhd_doflow; -static bool dhd_alignctl; - -static bool sd1idle; - -static bool retrydata; -#define RETRYCHAN(chan) (((chan) == SDPCM_EVENT_CHANNEL) || retrydata) - -static const uint watermark = 8; -static const uint firstread = DHD_FIRSTREAD; - -#define HDATLEN (firstread - (SDPCM_HDRLEN)) - -/* Retry count for register access failures */ -static const uint retry_limit = 2; - -/* Force even SD lengths (some host controllers mess up on odd bytes) */ -static bool forcealign; - -#define ALIGNMENT 4 - -#if defined(OOB_INTR_ONLY) && defined(HW_OOB) -extern void bcmsdh_enable_hw_oob_intr(void *sdh, bool enable); -#endif - -#if defined(OOB_INTR_ONLY) && defined(SDIO_ISR_THREAD) -#error OOB_INTR_ONLY is NOT working with SDIO_ISR_THREAD -#endif /* defined(OOB_INTR_ONLY) && defined(SDIO_ISR_THREAD) */ -#define PKTALIGN(osh, p, len, align) \ - do { \ - uint datalign; \ - datalign = (uintptr)PKTDATA((osh), (p)); \ - datalign = ROUNDUP(datalign, (align)) - datalign; \ - ASSERT(datalign < (align)); \ - ASSERT(PKTLEN((osh), (p)) >= ((len) + datalign)); \ - if (datalign) \ - PKTPULL((osh), (p), datalign); \ - PKTSETLEN((osh), (p), (len)); \ - } while (0) - -/* Limit on rounding up frames */ -static const uint max_roundup = 512; - -/* Try doing readahead */ -static bool dhd_readahead; - - -/* To check if there's window offered */ -#define DATAOK(bus) \ - (((uint8)(bus->tx_max - bus->tx_seq) != 0) && \ - (((uint8)(bus->tx_max - bus->tx_seq) & 0x80) == 0)) - -/* Macros to get register read/write status */ -/* NOTE: these assume a local dhdsdio_bus_t *bus! */ -#define R_SDREG(regvar, regaddr, retryvar) \ -do { \ - retryvar = 0; \ - do { \ - regvar = R_REG(bus->dhd->osh, regaddr); \ - } while (bcmsdh_regfail(bus->sdh) && (++retryvar <= retry_limit)); \ - if (retryvar) { \ - bus->regfails += (retryvar-1); \ - if (retryvar > retry_limit) { \ - DHD_ERROR(("%s: FAILED" #regvar "READ, LINE %d\n", \ - __FUNCTION__, __LINE__)); \ - regvar = 0; \ - } \ - } \ -} while (0) - -#define W_SDREG(regval, regaddr, retryvar) \ -do { \ - retryvar = 0; \ - do { \ - W_REG(bus->dhd->osh, regaddr, regval); \ - } while (bcmsdh_regfail(bus->sdh) && (++retryvar <= retry_limit)); \ - if (retryvar) { \ - bus->regfails += (retryvar-1); \ - if (retryvar > retry_limit) \ - DHD_ERROR(("%s: FAILED REGISTER WRITE, LINE %d\n", \ - __FUNCTION__, __LINE__)); \ - } \ -} while (0) - - -#define DHD_BUS SDIO_BUS - -#define PKT_AVAILABLE() (intstatus & I_HMB_FRAME_IND) - -#define HOSTINTMASK (I_HMB_SW_MASK | I_CHIPACTIVE) - -#define GSPI_PR55150_BAILOUT - - -#ifdef SDTEST -static void dhdsdio_testrcv(dhd_bus_t *bus, void *pkt, uint seq); -static void dhdsdio_sdtest_set(dhd_bus_t *bus, bool start); -#endif - -#ifdef DHD_DEBUG_TRAP -static int dhdsdio_checkdied(dhd_bus_t *bus, uint8 *data, uint size); -static int dhdsdio_mem_dump(dhd_bus_t *bus); -#endif /* DHD_DEBUG_TRAP */ -static int dhdsdio_download_state(dhd_bus_t *bus, bool enter); - -static void dhdsdio_release(dhd_bus_t *bus, osl_t *osh); -static void dhdsdio_release_malloc(dhd_bus_t *bus, osl_t *osh); -static void dhdsdio_disconnect(void *ptr); -static bool dhdsdio_chipmatch(uint16 chipid); -static bool dhdsdio_probe_attach(dhd_bus_t *bus, osl_t *osh, void *sdh, - void * regsva, uint16 devid); -static bool dhdsdio_probe_malloc(dhd_bus_t *bus, osl_t *osh, void *sdh); -static bool dhdsdio_probe_init(dhd_bus_t *bus, osl_t *osh, void *sdh); -static void dhdsdio_release_dongle(dhd_bus_t *bus, osl_t *osh, int reset_flag); - -static uint process_nvram_vars(char *varbuf, uint len); - -static void dhd_dongle_setmemsize(struct dhd_bus *bus, int mem_size); -static int dhd_bcmsdh_recv_buf(dhd_bus_t *bus, uint32 addr, uint fn, uint flags, - uint8 *buf, uint nbytes, - void *pkt, bcmsdh_cmplt_fn_t complete, void *handle); -static int dhd_bcmsdh_send_buf(dhd_bus_t *bus, uint32 addr, uint fn, uint flags, - uint8 *buf, uint nbytes, - void *pkt, bcmsdh_cmplt_fn_t complete, void *handle); - -static bool dhdsdio_download_firmware(struct dhd_bus *bus, osl_t *osh, void *sdh); -static int _dhdsdio_download_firmware(struct dhd_bus *bus); - -static int dhdsdio_download_code_file(struct dhd_bus *bus, char *image_path); -static int dhdsdio_download_nvram(struct dhd_bus *bus); -#ifdef BCMEMBEDIMAGE -static int dhdsdio_download_code_array(struct dhd_bus *bus); -#endif - - -static void -dhd_dongle_setmemsize(struct dhd_bus *bus, int mem_size) -{ - int32 min_size = DONGLE_MIN_MEMSIZE; - /* Restrict the memsize to user specified limit */ - DHD_ERROR(("user: Restrict the dongle ram size to %d, min accepted %d\n", - dhd_dongle_memsize, min_size)); - if ((dhd_dongle_memsize > min_size) && - (dhd_dongle_memsize < (int32)bus->orig_ramsize)) - bus->ramsize = dhd_dongle_memsize; -} - -static int -dhdsdio_set_siaddr_window(dhd_bus_t *bus, uint32 address) -{ - int err = 0; - bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW, - (address >> 8) & SBSDIO_SBADDRLOW_MASK, &err); - if (!err) - bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRMID, - (address >> 16) & SBSDIO_SBADDRMID_MASK, &err); - if (!err) - bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRHIGH, - (address >> 24) & SBSDIO_SBADDRHIGH_MASK, &err); - return err; -} - - -/* Turn backplane clock on or off */ -static int -dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) -{ - int err; - uint8 clkctl, clkreq, devctl; - bcmsdh_info_t *sdh; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - -#if defined(OOB_INTR_ONLY) - pendok = FALSE; -#endif - clkctl = 0; - sdh = bus->sdh; - - - if (on) { - /* Request HT Avail */ - clkreq = bus->alp_only ? SBSDIO_ALP_AVAIL_REQ : SBSDIO_HT_AVAIL_REQ; - - if ((bus->sih->chip == BCM4329_CHIP_ID) && (bus->sih->chiprev == 0)) - clkreq |= SBSDIO_FORCE_ALP; - - - - - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err); - if (err) { - DHD_ERROR(("%s: HT Avail request error: %d\n", __FUNCTION__, err)); - return BCME_ERROR; - } - - if (pendok && - ((bus->sih->buscoretype == PCMCIA_CORE_ID) && (bus->sih->buscorerev == 9))) { - uint32 dummy, retries; - R_SDREG(dummy, &bus->regs->clockctlstatus, retries); - } - - /* Check current status */ - clkctl = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, &err); - if (err) { - DHD_ERROR(("%s: HT Avail read error: %d\n", __FUNCTION__, err)); - return BCME_ERROR; - } - - /* Go to pending and await interrupt if appropriate */ - if (!SBSDIO_CLKAV(clkctl, bus->alp_only) && pendok) { - /* Allow only clock-available interrupt */ - devctl = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, &err); - if (err) { - DHD_ERROR(("%s: Devctl access error setting CA: %d\n", - __FUNCTION__, err)); - return BCME_ERROR; - } - - devctl |= SBSDIO_DEVCTL_CA_INT_ONLY; - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, devctl, &err); - DHD_INFO(("CLKCTL: set PENDING\n")); - bus->clkstate = CLK_PENDING; - return BCME_OK; - } else if (bus->clkstate == CLK_PENDING) { - /* Cancel CA-only interrupt filter */ - devctl = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, &err); - devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, devctl, &err); - } - - /* Otherwise, wait here (polling) for HT Avail */ - if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) { - SPINWAIT_SLEEP(sdioh_spinwait_sleep, - ((clkctl = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, - SBSDIO_FUNC1_CHIPCLKCSR, &err)), - !SBSDIO_CLKAV(clkctl, bus->alp_only)), PMU_MAX_TRANSITION_DLY); - } - if (err) { - DHD_ERROR(("%s: HT Avail request error: %d\n", __FUNCTION__, err)); - return BCME_ERROR; - } - if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) { - DHD_ERROR(("%s: HT Avail timeout (%d): clkctl 0x%02x\n", - __FUNCTION__, PMU_MAX_TRANSITION_DLY, clkctl)); - return BCME_ERROR; - } - - - /* Mark clock available */ - bus->clkstate = CLK_AVAIL; - DHD_INFO(("CLKCTL: turned ON\n")); - -#if defined(DHD_DEBUG) - if (bus->alp_only == TRUE) { -#if !defined(BCMLXSDMMC) - if (!SBSDIO_ALPONLY(clkctl)) { - DHD_ERROR(("%s: HT Clock, when ALP Only\n", __FUNCTION__)); - } -#endif /* !defined(BCMLXSDMMC) */ - } else { - if (SBSDIO_ALPONLY(clkctl)) { - DHD_ERROR(("%s: HT Clock should be on.\n", __FUNCTION__)); - } - } -#endif /* defined (DHD_DEBUG) */ - - bus->activity = TRUE; - } else { - clkreq = 0; - - if (bus->clkstate == CLK_PENDING) { - /* Cancel CA-only interrupt filter */ - devctl = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, &err); - devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, devctl, &err); - } - - bus->clkstate = CLK_SDONLY; - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err); - DHD_INFO(("CLKCTL: turned OFF\n")); - if (err) { - DHD_ERROR(("%s: Failed access turning clock off: %d\n", - __FUNCTION__, err)); - return BCME_ERROR; - } - } - return BCME_OK; -} - -/* Change idle/active SD state */ -static int -dhdsdio_sdclk(dhd_bus_t *bus, bool on) -{ - int err; - int32 iovalue; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - if (on) { - if (bus->idleclock == DHD_IDLE_STOP) { - /* Turn on clock and restore mode */ - iovalue = 1; - err = bcmsdh_iovar_op(bus->sdh, "sd_clock", NULL, 0, - &iovalue, sizeof(iovalue), TRUE); - if (err) { - DHD_ERROR(("%s: error enabling sd_clock: %d\n", - __FUNCTION__, err)); - return BCME_ERROR; - } - - iovalue = bus->sd_mode; - err = bcmsdh_iovar_op(bus->sdh, "sd_mode", NULL, 0, - &iovalue, sizeof(iovalue), TRUE); - if (err) { - DHD_ERROR(("%s: error changing sd_mode: %d\n", - __FUNCTION__, err)); - return BCME_ERROR; - } - } else if (bus->idleclock != DHD_IDLE_ACTIVE) { - /* Restore clock speed */ - iovalue = bus->sd_divisor; - err = bcmsdh_iovar_op(bus->sdh, "sd_divisor", NULL, 0, - &iovalue, sizeof(iovalue), TRUE); - if (err) { - DHD_ERROR(("%s: error restoring sd_divisor: %d\n", - __FUNCTION__, err)); - return BCME_ERROR; - } - } - bus->clkstate = CLK_SDONLY; - } else { - /* Stop or slow the SD clock itself */ - if ((bus->sd_divisor == -1) || (bus->sd_mode == -1)) { - DHD_TRACE(("%s: can't idle clock, divisor %d mode %d\n", - __FUNCTION__, bus->sd_divisor, bus->sd_mode)); - return BCME_ERROR; - } - if (bus->idleclock == DHD_IDLE_STOP) { - if (sd1idle) { - /* Change to SD1 mode and turn off clock */ - iovalue = 1; - err = bcmsdh_iovar_op(bus->sdh, "sd_mode", NULL, 0, - &iovalue, sizeof(iovalue), TRUE); - if (err) { - DHD_ERROR(("%s: error changing sd_clock: %d\n", - __FUNCTION__, err)); - return BCME_ERROR; - } - } - - iovalue = 0; - err = bcmsdh_iovar_op(bus->sdh, "sd_clock", NULL, 0, - &iovalue, sizeof(iovalue), TRUE); - if (err) { - DHD_ERROR(("%s: error disabling sd_clock: %d\n", - __FUNCTION__, err)); - return BCME_ERROR; - } - } else if (bus->idleclock != DHD_IDLE_ACTIVE) { - /* Set divisor to idle value */ - iovalue = bus->idleclock; - err = bcmsdh_iovar_op(bus->sdh, "sd_divisor", NULL, 0, - &iovalue, sizeof(iovalue), TRUE); - if (err) { - DHD_ERROR(("%s: error changing sd_divisor: %d\n", - __FUNCTION__, err)); - return BCME_ERROR; - } - } - bus->clkstate = CLK_NONE; - } - - return BCME_OK; -} - -/* Transition SD and backplane clock readiness */ -static int -dhdsdio_clkctl(dhd_bus_t *bus, uint target, bool pendok) -{ - int ret = BCME_OK; -#ifdef DHD_DEBUG - uint oldstate = bus->clkstate; -#endif /* DHD_DEBUG */ - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - /* Early exit if we're already there */ - if (bus->clkstate == target) { - if (target == CLK_AVAIL) { - dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms); - bus->activity = TRUE; - } - return ret; - } - - switch (target) { - case CLK_AVAIL: - /* Make sure SD clock is available */ - if (bus->clkstate == CLK_NONE) - dhdsdio_sdclk(bus, TRUE); - /* Now request HT Avail on the backplane */ - ret = dhdsdio_htclk(bus, TRUE, pendok); - if (ret == BCME_OK) { - dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms); - bus->activity = TRUE; - } - break; - - case CLK_SDONLY: - /* Remove HT request, or bring up SD clock */ - if (bus->clkstate == CLK_NONE) - ret = dhdsdio_sdclk(bus, TRUE); - else if (bus->clkstate == CLK_AVAIL) - ret = dhdsdio_htclk(bus, FALSE, FALSE); - else - DHD_ERROR(("dhdsdio_clkctl: request for %d -> %d\n", - bus->clkstate, target)); - if (ret == BCME_OK) - dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms); - break; - - case CLK_NONE: - /* Make sure to remove HT request */ - if (bus->clkstate == CLK_AVAIL) - ret = dhdsdio_htclk(bus, FALSE, FALSE); - /* Now remove the SD clock */ - ret = dhdsdio_sdclk(bus, FALSE); - dhd_os_wd_timer(bus->dhd, 0); - break; - } -#ifdef DHD_DEBUG - DHD_INFO(("dhdsdio_clkctl: %d -> %d\n", oldstate, bus->clkstate)); -#endif /* DHD_DEBUG */ - - return ret; -} - -int -dhdsdio_bussleep(dhd_bus_t *bus, bool sleep) -{ - bcmsdh_info_t *sdh = bus->sdh; - sdpcmd_regs_t *regs = bus->regs; - uint retries = 0; - - DHD_INFO(("dhdsdio_bussleep: request %s (currently %s)\n", - (sleep ? "SLEEP" : "WAKE"), - (bus->sleeping ? "SLEEP" : "WAKE"))); - - /* Done if we're already in the requested state */ - if (sleep == bus->sleeping) - return BCME_OK; - - /* Going to sleep: set the alarm and turn off the lights... */ - if (sleep) { - /* Don't sleep if something is pending */ - if (bus->dpc_sched || bus->rxskip || pktq_len(&bus->txq)) - return BCME_BUSY; - - - /* Disable SDIO interrupts (no longer interested) */ - bcmsdh_intr_disable(bus->sdh); - - /* Make sure the controller has the bus up */ - dhdsdio_clkctl(bus, CLK_AVAIL, FALSE); - - /* Tell device to start using OOB wakeup */ - W_SDREG(SMB_USE_OOB, ®s->tosbmailbox, retries); - if (retries > retry_limit) - DHD_ERROR(("CANNOT SIGNAL CHIP, WILL NOT WAKE UP!!\n")); - - /* Turn off our contribution to the HT clock request */ - dhdsdio_clkctl(bus, CLK_SDONLY, FALSE); - - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, - SBSDIO_FORCE_HW_CLKREQ_OFF, NULL); - - /* Isolate the bus */ - if (bus->sih->chip != BCM4329_CHIP_ID && bus->sih->chip != BCM4319_CHIP_ID) { - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, - SBSDIO_DEVCTL_PADS_ISO, NULL); - } - - /* Change state */ - bus->sleeping = TRUE; - - } else { - /* Waking up: bus power up is ok, set local state */ - - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, - 0, NULL); - - /* Force pad isolation off if possible (in case power never toggled) */ - if ((bus->sih->buscoretype == PCMCIA_CORE_ID) && (bus->sih->buscorerev >= 10)) - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, 0, NULL); - - - /* Make sure the controller has the bus up */ - dhdsdio_clkctl(bus, CLK_AVAIL, FALSE); - - /* Send misc interrupt to indicate OOB not needed */ - W_SDREG(0, ®s->tosbmailboxdata, retries); - if (retries <= retry_limit) - W_SDREG(SMB_DEV_INT, ®s->tosbmailbox, retries); - - if (retries > retry_limit) - DHD_ERROR(("CANNOT SIGNAL CHIP TO CLEAR OOB!!\n")); - - /* Make sure we have SD bus access */ - dhdsdio_clkctl(bus, CLK_SDONLY, FALSE); - - /* Change state */ - bus->sleeping = FALSE; - - /* Enable interrupts again */ - if (bus->intr && (bus->dhd->busstate == DHD_BUS_DATA)) { - bus->intdis = FALSE; - bcmsdh_intr_enable(bus->sdh); - } - } - - return BCME_OK; -} -#if defined(OOB_INTR_ONLY) -void -dhd_enable_oob_intr(struct dhd_bus *bus, bool enable) -{ -#if defined(HW_OOB) - bcmsdh_enable_hw_oob_intr(bus->sdh, enable); -#else - sdpcmd_regs_t *regs = bus->regs; - uint retries = 0; - - dhdsdio_clkctl(bus, CLK_AVAIL, FALSE); - if (enable == TRUE) { - - /* Tell device to start using OOB wakeup */ - W_SDREG(SMB_USE_OOB, ®s->tosbmailbox, retries); - if (retries > retry_limit) - DHD_ERROR(("CANNOT SIGNAL CHIP, WILL NOT WAKE UP!!\n")); - - } else { - /* Send misc interrupt to indicate OOB not needed */ - W_SDREG(0, ®s->tosbmailboxdata, retries); - if (retries <= retry_limit) - W_SDREG(SMB_DEV_INT, ®s->tosbmailbox, retries); - } - - /* Turn off our contribution to the HT clock request */ - dhdsdio_clkctl(bus, CLK_SDONLY, FALSE); -#endif /* !defined(HW_OOB) */ -} -#endif /* defined(OOB_INTR_ONLY) */ - -#define BUS_WAKE(bus) \ - do { \ - if ((bus)->sleeping) \ - dhdsdio_bussleep((bus), FALSE); \ - } while (0); - - -/* Writes a HW/SW header into the packet and sends it. */ -/* Assumes: (a) header space already there, (b) caller holds lock */ -static int -dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt) -{ - int ret; - osl_t *osh; - uint8 *frame; - uint16 len, pad = 0; - uint32 swheader; - uint retries = 0; - bcmsdh_info_t *sdh; - void *new; - int i; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - sdh = bus->sdh; - osh = bus->dhd->osh; - - if (bus->dhd->dongle_reset) { - ret = BCME_NOTREADY; - goto done; - } - - frame = (uint8*)PKTDATA(osh, pkt); - - /* Add alignment padding, allocate new packet if needed */ - if ((pad = ((uintptr)frame % DHD_SDALIGN))) { - if (PKTHEADROOM(osh, pkt) < pad) { - DHD_INFO(("%s: insufficient headroom %d for %d pad\n", - __FUNCTION__, (int)PKTHEADROOM(osh, pkt), pad)); - bus->dhd->tx_realloc++; - new = PKTGET(osh, (PKTLEN(osh, pkt) + DHD_SDALIGN), TRUE); - if (!new) { - DHD_ERROR(("%s: couldn't allocate new %d-byte packet\n", - __FUNCTION__, PKTLEN(osh, pkt) + DHD_SDALIGN)); - ret = BCME_NOMEM; - goto done; - } - - PKTALIGN(osh, new, PKTLEN(osh, pkt), DHD_SDALIGN); - bcopy(PKTDATA(osh, pkt), PKTDATA(osh, new), PKTLEN(osh, pkt)); - if (free_pkt) - PKTFREE(osh, pkt, TRUE); - /* free the pkt if canned one is not used */ - free_pkt = TRUE; - pkt = new; - frame = (uint8*)PKTDATA(osh, pkt); - ASSERT(((uintptr)frame % DHD_SDALIGN) == 0); - pad = 0; - } else { - PKTPUSH(osh, pkt, pad); - frame = (uint8*)PKTDATA(osh, pkt); - - ASSERT((pad + SDPCM_HDRLEN) <= (int) PKTLEN(osh, pkt)); - bzero(frame, pad + SDPCM_HDRLEN); - } - } - ASSERT(pad < DHD_SDALIGN); - - /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ - len = (uint16)PKTLEN(osh, pkt); - *(uint16*)frame = htol16(len); - *(((uint16*)frame) + 1) = htol16(~len); - - /* Software tag: channel, sequence number, data offset */ - swheader = ((chan << SDPCM_CHANNEL_SHIFT) & SDPCM_CHANNEL_MASK) | bus->tx_seq | - (((pad + SDPCM_HDRLEN) << SDPCM_DOFFSET_SHIFT) & SDPCM_DOFFSET_MASK); - htol32_ua_store(swheader, frame + SDPCM_FRAMETAG_LEN); - htol32_ua_store(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader)); - -#ifdef DHD_DEBUG - tx_packets[PKTPRIO(pkt)]++; - if (DHD_BYTES_ON() && - (((DHD_CTL_ON() && (chan == SDPCM_CONTROL_CHANNEL)) || - (DHD_DATA_ON() && (chan != SDPCM_CONTROL_CHANNEL))))) { - prhex("Tx Frame", frame, len); - } else if (DHD_HDRS_ON()) { - prhex("TxHdr", frame, MIN(len, 16)); - } -#endif - - /* Raise len to next SDIO block to eliminate tail command */ - if (bus->roundup && bus->blocksize && (len > bus->blocksize)) { - uint16 pad = bus->blocksize - (len % bus->blocksize); - if ((pad <= bus->roundup) && (pad < bus->blocksize)) -#ifdef NOTUSED - if (pad <= PKTTAILROOM(osh, pkt)) -#endif /* NOTUSED */ - len += pad; - } else if (len % DHD_SDALIGN) { - len += DHD_SDALIGN - (len % DHD_SDALIGN); - } - - /* Some controllers have trouble with odd bytes -- round to even */ - if (forcealign && (len & (ALIGNMENT - 1))) { -#ifdef NOTUSED - if (PKTTAILROOM(osh, pkt)) -#endif - len = ROUNDUP(len, ALIGNMENT); -#ifdef NOTUSED - else - DHD_ERROR(("%s: sending unrounded %d-byte packet\n", __FUNCTION__, len)); -#endif - } - - do { - ret = dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, F2SYNC, - frame, len, pkt, NULL, NULL); - bus->f2txdata++; - ASSERT(ret != BCME_PENDING); - - if (ret < 0) { - /* On failure, abort the command and terminate the frame */ - DHD_INFO(("%s: sdio error %d, abort command and terminate frame.\n", - __FUNCTION__, ret)); - bus->tx_sderrs++; - - bcmsdh_abort(sdh, SDIO_FUNC_2); - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL, - SFC_WF_TERM, NULL); - bus->f1regdata++; - - for (i = 0; i < 3; i++) { - uint8 hi, lo; - hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, - SBSDIO_FUNC1_WFRAMEBCHI, NULL); - lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, - SBSDIO_FUNC1_WFRAMEBCLO, NULL); - bus->f1regdata += 2; - if ((hi == 0) && (lo == 0)) - break; - } - - } - if (ret == 0) { - bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP; - } - } while ((ret < 0) && retrydata && retries++ < TXRETRIES); - -done: - /* restore pkt buffer pointer before calling tx complete routine */ - PKTPULL(osh, pkt, SDPCM_HDRLEN + pad); - dhd_os_sdunlock(bus->dhd); - dhd_txcomplete(bus->dhd, pkt, ret != 0); - dhd_os_sdlock(bus->dhd); - - if (free_pkt) - PKTFREE(osh, pkt, TRUE); - - return ret; -} - -int -dhd_bus_txdata(struct dhd_bus *bus, void *pkt) -{ - int ret = BCME_ERROR; - osl_t *osh; - uint datalen, prec; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - osh = bus->dhd->osh; - datalen = PKTLEN(osh, pkt); - -#ifdef SDTEST - /* Push the test header if doing loopback */ - if (bus->ext_loop) { - uint8* data; - PKTPUSH(osh, pkt, SDPCM_TEST_HDRLEN); - data = PKTDATA(osh, pkt); - *data++ = SDPCM_TEST_ECHOREQ; - *data++ = (uint8)bus->loopid++; - *data++ = (datalen >> 0); - *data++ = (datalen >> 8); - datalen += SDPCM_TEST_HDRLEN; - } -#endif /* SDTEST */ - - /* Add space for the header */ - PKTPUSH(osh, pkt, SDPCM_HDRLEN); - ASSERT(ISALIGNED((uintptr)PKTDATA(osh, pkt), 2)); - - prec = PRIO2PREC((PKTPRIO(pkt) & PRIOMASK)); - - - /* Check for existing queue, current flow-control, pending event, or pending clock */ - if (dhd_deferred_tx || bus->fcstate || pktq_len(&bus->txq) || bus->dpc_sched || - (!DATAOK(bus)) || (bus->flowcontrol & NBITVAL(prec)) || - (bus->clkstate != CLK_AVAIL)) { - DHD_TRACE(("%s: deferring pktq len %d\n", __FUNCTION__, - pktq_len(&bus->txq))); - bus->fcqueued++; - - /* Priority based enq */ - dhd_os_sdlock_txq(bus->dhd); - if (dhd_prec_enq(bus->dhd, &bus->txq, pkt, prec) == FALSE) { - PKTPULL(osh, pkt, SDPCM_HDRLEN); - dhd_txcomplete(bus->dhd, pkt, FALSE); - PKTFREE(osh, pkt, TRUE); - DHD_ERROR(("%s: out of bus->txq !!!\n", __FUNCTION__)); - ret = BCME_NORESOURCE; - } else { - ret = BCME_OK; - } - dhd_os_sdunlock_txq(bus->dhd); - - if ((pktq_len(&bus->txq) >= FCHI) && dhd_doflow) - dhd_txflowcontrol(bus->dhd, 0, ON); - -#ifdef DHD_DEBUG - if (pktq_plen(&bus->txq, prec) > qcount[prec]) - qcount[prec] = pktq_plen(&bus->txq, prec); -#endif - /* Schedule DPC if needed to send queued packet(s) */ - if (dhd_deferred_tx && !bus->dpc_sched) { - bus->dpc_sched = TRUE; - dhd_sched_dpc(bus->dhd); - } - } else { - /* Lock: we're about to use shared data/code (and SDIO) */ - dhd_os_sdlock(bus->dhd); - - /* Otherwise, send it now */ - BUS_WAKE(bus); - /* Make sure back plane ht clk is on, no pending allowed */ - dhdsdio_clkctl(bus, CLK_AVAIL, TRUE); - -#ifndef SDTEST - DHD_TRACE(("%s: calling txpkt\n", __FUNCTION__)); - ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, TRUE); -#else - ret = dhdsdio_txpkt(bus, pkt, - (bus->ext_loop ? SDPCM_TEST_CHANNEL : SDPCM_DATA_CHANNEL), TRUE); -#endif - if (ret) - bus->dhd->tx_errors++; - else - bus->dhd->dstats.tx_bytes += datalen; - - if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) { - bus->activity = FALSE; - dhdsdio_clkctl(bus, CLK_NONE, TRUE); - } - - dhd_os_sdunlock(bus->dhd); - } - - - return ret; -} - -static uint -dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes) -{ - void *pkt; - uint32 intstatus = 0; - uint retries = 0; - int ret = 0, prec_out; - uint cnt = 0; - uint datalen; - uint8 tx_prec_map; - - dhd_pub_t *dhd = bus->dhd; - sdpcmd_regs_t *regs = bus->regs; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - tx_prec_map = ~bus->flowcontrol; - - /* Send frames until the limit or some other event */ - for (cnt = 0; (cnt < maxframes) && DATAOK(bus); cnt++) { - dhd_os_sdlock_txq(bus->dhd); - if ((pkt = pktq_mdeq(&bus->txq, tx_prec_map, &prec_out)) == NULL) { - dhd_os_sdunlock_txq(bus->dhd); - break; - } - dhd_os_sdunlock_txq(bus->dhd); - datalen = PKTLEN(bus->dhd->osh, pkt) - SDPCM_HDRLEN; - -#ifndef SDTEST - ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, TRUE); -#else - ret = dhdsdio_txpkt(bus, pkt, - (bus->ext_loop ? SDPCM_TEST_CHANNEL : SDPCM_DATA_CHANNEL), TRUE); -#endif - if (ret) - bus->dhd->tx_errors++; - else - bus->dhd->dstats.tx_bytes += datalen; - - /* In poll mode, need to check for other events */ - if (!bus->intr && cnt) - { - /* Check device status, signal pending interrupt */ - R_SDREG(intstatus, ®s->intstatus, retries); - bus->f2txdata++; - if (bcmsdh_regfail(bus->sdh)) - break; - if (intstatus & bus->hostintmask) - bus->ipend = TRUE; - } - } - - /* Deflow-control stack if needed */ - if (dhd_doflow && dhd->up && (dhd->busstate == DHD_BUS_DATA) && - dhd->txoff && (pktq_len(&bus->txq) < FCLOW)) - dhd_txflowcontrol(dhd, 0, OFF); - - return cnt; -} - -int -dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen) -{ - uint8 *frame; - uint16 len; - uint32 swheader; - uint retries = 0; - bcmsdh_info_t *sdh = bus->sdh; - uint8 doff = 0; - int ret = -1; - int i; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - if (bus->dhd->dongle_reset) - return -EIO; - - /* Back the pointer to make a room for bus header */ - frame = msg - SDPCM_HDRLEN; - len = (msglen += SDPCM_HDRLEN); - - /* Add alignment padding (optional for ctl frames) */ - if (dhd_alignctl) { - if ((doff = ((uintptr)frame % DHD_SDALIGN))) { - frame -= doff; - len += doff; - msglen += doff; - bzero(frame, doff + SDPCM_HDRLEN); - } - ASSERT(doff < DHD_SDALIGN); - } - doff += SDPCM_HDRLEN; - - /* Round send length to next SDIO block */ - if (bus->roundup && bus->blocksize && (len > bus->blocksize)) { - uint16 pad = bus->blocksize - (len % bus->blocksize); - if ((pad <= bus->roundup) && (pad < bus->blocksize)) - len += pad; - } else if (len % DHD_SDALIGN) { - len += DHD_SDALIGN - (len % DHD_SDALIGN); - } - - /* Satisfy length-alignment requirements */ - if (forcealign && (len & (ALIGNMENT - 1))) - len = ROUNDUP(len, ALIGNMENT); - - ASSERT(ISALIGNED((uintptr)frame, 2)); - - - /* Need to lock here to protect txseq and SDIO tx calls */ - dhd_os_sdlock(bus->dhd); - - BUS_WAKE(bus); - - /* Make sure backplane clock is on */ - dhdsdio_clkctl(bus, CLK_AVAIL, FALSE); - - /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ - *(uint16*)frame = htol16((uint16)msglen); - *(((uint16*)frame) + 1) = htol16(~msglen); - - /* Software tag: channel, sequence number, data offset */ - swheader = ((SDPCM_CONTROL_CHANNEL << SDPCM_CHANNEL_SHIFT) & SDPCM_CHANNEL_MASK) - | bus->tx_seq | ((doff << SDPCM_DOFFSET_SHIFT) & SDPCM_DOFFSET_MASK); - htol32_ua_store(swheader, frame + SDPCM_FRAMETAG_LEN); - htol32_ua_store(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader)); - - if (!DATAOK(bus)) { - DHD_INFO(("%s: No bus credit bus->tx_max %d, bus->tx_seq %d\n", - __FUNCTION__, bus->tx_max, bus->tx_seq)); - bus->ctrl_frame_stat = TRUE; - /* Send from dpc */ - bus->ctrl_frame_buf = frame; - bus->ctrl_frame_len = len; - - dhd_wait_for_event(bus->dhd, &bus->ctrl_frame_stat); - - if (bus->ctrl_frame_stat == FALSE) { - DHD_INFO(("%s: ctrl_frame_stat == FALSE\n", __FUNCTION__)); - ret = 0; - } else { - DHD_INFO(("%s: ctrl_frame_stat == TRUE\n", __FUNCTION__)); - ret = -1; - } - } - - if (ret == -1) { -#ifdef DHD_DEBUG - if (DHD_BYTES_ON() && DHD_CTL_ON()) { - prhex("Tx Frame", frame, len); - } else if (DHD_HDRS_ON()) { - prhex("TxHdr", frame, MIN(len, 16)); - } -#endif - - do { - bus->ctrl_frame_stat = FALSE; - ret = dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, F2SYNC, - frame, len, NULL, NULL, NULL); - ASSERT(ret != BCME_PENDING); - - if (ret < 0) { - /* On failure, abort the command and terminate the frame */ - DHD_INFO(("%s: sdio error %d, abort command and terminate frame.\n", - __FUNCTION__, ret)); - bus->tx_sderrs++; - - bcmsdh_abort(sdh, SDIO_FUNC_2); - - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL, - SFC_WF_TERM, NULL); - bus->f1regdata++; - - for (i = 0; i < 3; i++) { - uint8 hi, lo; - hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, - SBSDIO_FUNC1_WFRAMEBCHI, NULL); - lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, - SBSDIO_FUNC1_WFRAMEBCLO, NULL); - bus->f1regdata += 2; - if ((hi == 0) && (lo == 0)) - break; - } - - } - if (ret == 0) { - bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP; - } - } while ((ret < 0) && retries++ < TXRETRIES); - } - - if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) { - bus->activity = FALSE; - dhdsdio_clkctl(bus, CLK_NONE, TRUE); - } - - dhd_os_sdunlock(bus->dhd); - - if (ret) - bus->dhd->tx_ctlerrs++; - else - bus->dhd->tx_ctlpkts++; - - return ret ? -EIO : 0; -} - -int -dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen) -{ - int timeleft; - uint rxlen = 0; - bool pending; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - if (bus->dhd->dongle_reset) - return -EIO; - - /* Wait until control frame is available */ - timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen, &pending); - - dhd_os_sdlock(bus->dhd); - rxlen = bus->rxlen; - bcopy(bus->rxctl, msg, MIN(msglen, rxlen)); - bus->rxlen = 0; - dhd_os_sdunlock(bus->dhd); - - if (rxlen) { - DHD_CTL(("%s: resumed on rxctl frame, got %d expected %d\n", - __FUNCTION__, rxlen, msglen)); - } else if (timeleft == 0) { - DHD_ERROR(("%s: resumed on timeout\n", __FUNCTION__)); -#ifdef DHD_DEBUG_TRAP - dhd_os_sdlock(bus->dhd); - dhdsdio_checkdied(bus, NULL, 0); - dhd_os_sdunlock(bus->dhd); -#endif /* DHD_DEBUG_TRAP */ - } else if (pending == TRUE) { - DHD_CTL(("%s: cancelled\n", __FUNCTION__)); - return -ERESTARTSYS; - } else { - DHD_CTL(("%s: resumed for unknown reason?\n", __FUNCTION__)); -#ifdef DHD_DEBUG_TRAP - dhd_os_sdlock(bus->dhd); - dhdsdio_checkdied(bus, NULL, 0); - dhd_os_sdunlock(bus->dhd); -#endif /* DHD_DEBUG_TRAP */ - } - - if (rxlen) - bus->dhd->rx_ctlpkts++; - else - bus->dhd->rx_ctlerrs++; - - return rxlen ? (int)rxlen : -ETIMEDOUT; -} - -/* IOVar table */ -enum { - IOV_INTR = 1, - IOV_POLLRATE, - IOV_SDREG, - IOV_SBREG, - IOV_SDCIS, - IOV_MEMBYTES, - IOV_MEMSIZE, -#ifdef DHD_DEBUG_TRAP - IOV_CHECKDIED, -#endif - IOV_DOWNLOAD, - IOV_FORCEEVEN, - IOV_SDIOD_DRIVE, - IOV_READAHEAD, - IOV_SDRXCHAIN, - IOV_ALIGNCTL, - IOV_SDALIGN, - IOV_DEVRESET, - IOV_CPU, -#ifdef SDTEST - IOV_PKTGEN, - IOV_EXTLOOP, -#endif /* SDTEST */ - IOV_SPROM, - IOV_TXBOUND, - IOV_RXBOUND, - IOV_TXMINMAX, - IOV_IDLETIME, - IOV_IDLECLOCK, - IOV_SD1IDLE, - IOV_SLEEP, - IOV_VARS -}; - -const bcm_iovar_t dhdsdio_iovars[] = { - {"intr", IOV_INTR, 0, IOVT_BOOL, 0 }, - {"sleep", IOV_SLEEP, 0, IOVT_BOOL, 0 }, - {"pollrate", IOV_POLLRATE, 0, IOVT_UINT32, 0 }, - {"idletime", IOV_IDLETIME, 0, IOVT_INT32, 0 }, - {"idleclock", IOV_IDLECLOCK, 0, IOVT_INT32, 0 }, - {"sd1idle", IOV_SD1IDLE, 0, IOVT_BOOL, 0 }, - {"membytes", IOV_MEMBYTES, 0, IOVT_BUFFER, 2 * sizeof(int) }, - {"memsize", IOV_MEMSIZE, 0, IOVT_UINT32, 0 }, - {"download", IOV_DOWNLOAD, 0, IOVT_BOOL, 0 }, - {"vars", IOV_VARS, 0, IOVT_BUFFER, 0 }, - {"sdiod_drive", IOV_SDIOD_DRIVE, 0, IOVT_UINT32, 0 }, - {"readahead", IOV_READAHEAD, 0, IOVT_BOOL, 0 }, - {"sdrxchain", IOV_SDRXCHAIN, 0, IOVT_BOOL, 0 }, - {"alignctl", IOV_ALIGNCTL, 0, IOVT_BOOL, 0 }, - {"sdalign", IOV_SDALIGN, 0, IOVT_BOOL, 0 }, - {"devreset", IOV_DEVRESET, 0, IOVT_BOOL, 0 }, -#ifdef DHD_DEBUG - {"sdreg", IOV_SDREG, 0, IOVT_BUFFER, sizeof(sdreg_t) }, - {"sbreg", IOV_SBREG, 0, IOVT_BUFFER, sizeof(sdreg_t) }, - {"sd_cis", IOV_SDCIS, 0, IOVT_BUFFER, DHD_IOCTL_MAXLEN }, - {"forcealign", IOV_FORCEEVEN, 0, IOVT_BOOL, 0 }, - {"txbound", IOV_TXBOUND, 0, IOVT_UINT32, 0 }, - {"rxbound", IOV_RXBOUND, 0, IOVT_UINT32, 0 }, - {"txminmax", IOV_TXMINMAX, 0, IOVT_UINT32, 0 }, - {"cpu", IOV_CPU, 0, IOVT_BOOL, 0 }, -#endif /* DHD_DEBUG */ -#ifdef DHD_DEBUG_TRAP - {"checkdied", IOV_CHECKDIED, 0, IOVT_BUFFER, 0 }, -#endif /* DHD_DEBUG_TRAP */ -#ifdef SDTEST - {"extloop", IOV_EXTLOOP, 0, IOVT_BOOL, 0 }, - {"pktgen", IOV_PKTGEN, 0, IOVT_BUFFER, sizeof(dhd_pktgen_t) }, -#endif /* SDTEST */ - - {NULL, 0, 0, 0, 0 } -}; - -static void -dhd_dump_pct(struct bcmstrbuf *strbuf, char *desc, uint num, uint div) -{ - uint q1, q2; - - if (!div) { - bcm_bprintf(strbuf, "%s N/A", desc); - } else { - q1 = num / div; - q2 = (100 * (num - (q1 * div))) / div; - bcm_bprintf(strbuf, "%s %d.%02d", desc, q1, q2); - } -} - -void -dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf) -{ - dhd_bus_t *bus = dhdp->bus; - - bcm_bprintf(strbuf, "Bus SDIO structure:\n"); - bcm_bprintf(strbuf, "hostintmask 0x%08x intstatus 0x%08x sdpcm_ver %d\n", - bus->hostintmask, bus->intstatus, bus->sdpcm_ver); - bcm_bprintf(strbuf, "fcstate %d qlen %d tx_seq %d, max %d, rxskip %d rxlen %d rx_seq %d\n", - bus->fcstate, pktq_len(&bus->txq), bus->tx_seq, bus->tx_max, bus->rxskip, - bus->rxlen, bus->rx_seq); - bcm_bprintf(strbuf, "intr %d intrcount %d lastintrs %d spurious %d\n", - bus->intr, bus->intrcount, bus->lastintrs, bus->spurious); - bcm_bprintf(strbuf, "pollrate %d pollcnt %d regfails %d\n", - bus->pollrate, bus->pollcnt, bus->regfails); - - bcm_bprintf(strbuf, "\nAdditional counters:\n"); - bcm_bprintf(strbuf, "tx_sderrs %d fcqueued %d rxrtx %d rx_toolong %d rxc_errors %d\n", - bus->tx_sderrs, bus->fcqueued, bus->rxrtx, bus->rx_toolong, - bus->rxc_errors); - bcm_bprintf(strbuf, "rx_hdrfail %d badhdr %d badseq %d\n", - bus->rx_hdrfail, bus->rx_badhdr, bus->rx_badseq); - bcm_bprintf(strbuf, "fc_rcvd %d, fc_xoff %d, fc_xon %d\n", - bus->fc_rcvd, bus->fc_xoff, bus->fc_xon); - bcm_bprintf(strbuf, "rxglomfail %d, rxglomframes %d, rxglompkts %d\n", - bus->rxglomfail, bus->rxglomframes, bus->rxglompkts); - bcm_bprintf(strbuf, "f2rx (hdrs/data) %d (%d/%d), f2tx %d f1regs %d\n", - (bus->f2rxhdrs + bus->f2rxdata), bus->f2rxhdrs, bus->f2rxdata, - bus->f2txdata, bus->f1regdata); - { - dhd_dump_pct(strbuf, "\nRx: pkts/f2rd", bus->dhd->rx_packets, - (bus->f2rxhdrs + bus->f2rxdata)); - dhd_dump_pct(strbuf, ", pkts/f1sd", bus->dhd->rx_packets, bus->f1regdata); - dhd_dump_pct(strbuf, ", pkts/sd", bus->dhd->rx_packets, - (bus->f2rxhdrs + bus->f2rxdata + bus->f1regdata)); - dhd_dump_pct(strbuf, ", pkts/int", bus->dhd->rx_packets, bus->intrcount); - bcm_bprintf(strbuf, "\n"); - - dhd_dump_pct(strbuf, "Rx: glom pct", (100 * bus->rxglompkts), - bus->dhd->rx_packets); - dhd_dump_pct(strbuf, ", pkts/glom", bus->rxglompkts, bus->rxglomframes); - bcm_bprintf(strbuf, "\n"); - - dhd_dump_pct(strbuf, "Tx: pkts/f2wr", bus->dhd->tx_packets, bus->f2txdata); - dhd_dump_pct(strbuf, ", pkts/f1sd", bus->dhd->tx_packets, bus->f1regdata); - dhd_dump_pct(strbuf, ", pkts/sd", bus->dhd->tx_packets, - (bus->f2txdata + bus->f1regdata)); - dhd_dump_pct(strbuf, ", pkts/int", bus->dhd->tx_packets, bus->intrcount); - bcm_bprintf(strbuf, "\n"); - - dhd_dump_pct(strbuf, "Total: pkts/f2rw", - (bus->dhd->tx_packets + bus->dhd->rx_packets), - (bus->f2txdata + bus->f2rxhdrs + bus->f2rxdata)); - dhd_dump_pct(strbuf, ", pkts/f1sd", - (bus->dhd->tx_packets + bus->dhd->rx_packets), bus->f1regdata); - dhd_dump_pct(strbuf, ", pkts/sd", - (bus->dhd->tx_packets + bus->dhd->rx_packets), - (bus->f2txdata + bus->f2rxhdrs + bus->f2rxdata + bus->f1regdata)); - dhd_dump_pct(strbuf, ", pkts/int", - (bus->dhd->tx_packets + bus->dhd->rx_packets), bus->intrcount); - bcm_bprintf(strbuf, "\n\n"); - } - -#ifdef SDTEST - if (bus->pktgen_count) { - bcm_bprintf(strbuf, "pktgen config and count:\n"); - bcm_bprintf(strbuf, "freq %d count %d print %d total %d min %d len %d\n", - bus->pktgen_freq, bus->pktgen_count, bus->pktgen_print, - bus->pktgen_total, bus->pktgen_minlen, bus->pktgen_maxlen); - bcm_bprintf(strbuf, "send attempts %d rcvd %d fail %d\n", - bus->pktgen_sent, bus->pktgen_rcvd, bus->pktgen_fail); - } -#endif /* SDTEST */ -#ifdef DHD_DEBUG - bcm_bprintf(strbuf, "dpc_sched %d host interrupt%spending\n", - bus->dpc_sched, (bcmsdh_intr_pending(bus->sdh) ? " " : " not ")); - bcm_bprintf(strbuf, "blocksize %d roundup %d\n", bus->blocksize, bus->roundup); -#endif /* DHD_DEBUG */ - bcm_bprintf(strbuf, "clkstate %d activity %d idletime %d idlecount %d sleeping %d\n", - bus->clkstate, bus->activity, bus->idletime, bus->idlecount, bus->sleeping); -} - -void -dhd_bus_clearcounts(dhd_pub_t *dhdp) -{ - dhd_bus_t *bus = (dhd_bus_t *)dhdp->bus; - - bus->intrcount = bus->lastintrs = bus->spurious = bus->regfails = 0; - bus->rxrtx = bus->rx_toolong = bus->rxc_errors = 0; - bus->rx_hdrfail = bus->rx_badhdr = bus->rx_badseq = 0; - bus->tx_sderrs = bus->fc_rcvd = bus->fc_xoff = bus->fc_xon = 0; - bus->rxglomfail = bus->rxglomframes = bus->rxglompkts = 0; - bus->f2rxhdrs = bus->f2rxdata = bus->f2txdata = bus->f1regdata = 0; -} - -#ifdef SDTEST -static int -dhdsdio_pktgen_get(dhd_bus_t *bus, uint8 *arg) -{ - dhd_pktgen_t pktgen; - - pktgen.version = DHD_PKTGEN_VERSION; - pktgen.freq = bus->pktgen_freq; - pktgen.count = bus->pktgen_count; - pktgen.print = bus->pktgen_print; - pktgen.total = bus->pktgen_total; - pktgen.minlen = bus->pktgen_minlen; - pktgen.maxlen = bus->pktgen_maxlen; - pktgen.numsent = bus->pktgen_sent; - pktgen.numrcvd = bus->pktgen_rcvd; - pktgen.numfail = bus->pktgen_fail; - pktgen.mode = bus->pktgen_mode; - pktgen.stop = bus->pktgen_stop; - - bcopy(&pktgen, arg, sizeof(pktgen)); - - return 0; -} - -static int -dhdsdio_pktgen_set(dhd_bus_t *bus, uint8 *arg) -{ - dhd_pktgen_t pktgen; - uint oldcnt, oldmode; - - bcopy(arg, &pktgen, sizeof(pktgen)); - if (pktgen.version != DHD_PKTGEN_VERSION) - return BCME_BADARG; - - oldcnt = bus->pktgen_count; - oldmode = bus->pktgen_mode; - - bus->pktgen_freq = pktgen.freq; - bus->pktgen_count = pktgen.count; - bus->pktgen_print = pktgen.print; - bus->pktgen_total = pktgen.total; - bus->pktgen_minlen = pktgen.minlen; - bus->pktgen_maxlen = pktgen.maxlen; - bus->pktgen_mode = pktgen.mode; - bus->pktgen_stop = pktgen.stop; - - bus->pktgen_tick = bus->pktgen_ptick = 0; - bus->pktgen_len = MAX(bus->pktgen_len, bus->pktgen_minlen); - bus->pktgen_len = MIN(bus->pktgen_len, bus->pktgen_maxlen); - - /* Clear counts for a new pktgen (mode change, or was stopped) */ - if (bus->pktgen_count && (!oldcnt || oldmode != bus->pktgen_mode)) - bus->pktgen_sent = bus->pktgen_rcvd = bus->pktgen_fail = 0; - - return 0; -} -#endif /* SDTEST */ - -static int -dhdsdio_membytes(dhd_bus_t *bus, bool write, uint32 address, uint8 *data, uint size) -{ - int bcmerror = 0; - uint32 sdaddr; - uint dsize; - - /* Determine initial transfer parameters */ - sdaddr = address & SBSDIO_SB_OFT_ADDR_MASK; - if ((sdaddr + size) & SBSDIO_SBWINDOW_MASK) - dsize = (SBSDIO_SB_OFT_ADDR_LIMIT - sdaddr); - else - dsize = size; - - /* Set the backplane window to include the start address */ - if ((bcmerror = dhdsdio_set_siaddr_window(bus, address))) { - DHD_ERROR(("%s: window change failed\n", __FUNCTION__)); - goto xfer_done; - } - - /* Do the transfer(s) */ - while (size) { - DHD_INFO(("%s: %s %d bytes at offset 0x%08x in window 0x%08x\n", - __FUNCTION__, (write ? "write" : "read"), dsize, sdaddr, - (address & SBSDIO_SBWINDOW_MASK))); - if ((bcmerror = bcmsdh_rwdata(bus->sdh, write, sdaddr, data, dsize))) { - DHD_ERROR(("%s: membytes transfer failed\n", __FUNCTION__)); - break; - } - - /* Adjust for next transfer (if any) */ - if ((size -= dsize)) { - data += dsize; - address += dsize; - if ((bcmerror = dhdsdio_set_siaddr_window(bus, address))) { - DHD_ERROR(("%s: window change failed\n", __FUNCTION__)); - break; - } - sdaddr = 0; - dsize = MIN(SBSDIO_SB_OFT_ADDR_LIMIT, size); - } - } - -xfer_done: - /* Return the window to backplane enumeration space for core access */ - if (dhdsdio_set_siaddr_window(bus, bcmsdh_cur_sbwad(bus->sdh))) { - DHD_ERROR(("%s: FAILED to set window back to 0x%x\n", __FUNCTION__, - bcmsdh_cur_sbwad(bus->sdh))); - } - - return bcmerror; -} - -#ifdef DHD_DEBUG_TRAP -static int -dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh) -{ - uint32 addr; - int rv; - - /* Read last word in memory to determine address of sdpcm_shared structure */ - if ((rv = dhdsdio_membytes(bus, FALSE, bus->ramsize - 4, (uint8 *)&addr, 4)) < 0) - return rv; - - addr = ltoh32(addr); - - DHD_INFO(("sdpcm_shared address 0x%08X\n", addr)); - - /* - * Check if addr is valid. - * NVRAM length at the end of memory should have been overwritten. - */ - if (addr == 0 || ((~addr >> 16) & 0xffff) == (addr & 0xffff)) { - DHD_ERROR(("%s: address (0x%08x) of sdpcm_shared invalid\n", __FUNCTION__, addr)); - return BCME_ERROR; - } - - /* Read hndrte_shared structure */ - if ((rv = dhdsdio_membytes(bus, FALSE, addr, (uint8 *)sh, sizeof(sdpcm_shared_t))) < 0) - return rv; - - /* Endianness */ - sh->flags = ltoh32(sh->flags); - sh->trap_addr = ltoh32(sh->trap_addr); - sh->assert_exp_addr = ltoh32(sh->assert_exp_addr); - sh->assert_file_addr = ltoh32(sh->assert_file_addr); - sh->assert_line = ltoh32(sh->assert_line); - sh->console_addr = ltoh32(sh->console_addr); - sh->msgtrace_addr = ltoh32(sh->msgtrace_addr); - - if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) { - DHD_ERROR(("%s: sdpcm_shared version %d in dhd " - "is different than sdpcm_shared version %d in dongle\n", - __FUNCTION__, SDPCM_SHARED_VERSION, - sh->flags & SDPCM_SHARED_VERSION_MASK)); - return BCME_ERROR; - } - - return BCME_OK; -} - -static int -dhdsdio_checkdied(dhd_bus_t *bus, uint8 *data, uint size) -{ - int bcmerror = 0; - uint msize = 512; - char *mbuffer = NULL; - uint maxstrlen = 256; - char *str = NULL; - trap_t tr; - sdpcm_shared_t sdpcm_shared; - struct bcmstrbuf strbuf; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - if (data == NULL) { - /* - * Called after a rx ctrl timeout. "data" is NULL. - * allocate memory to trace the trap or assert. - */ - size = msize; - mbuffer = data = MALLOC(bus->dhd->osh, msize); - if (mbuffer == NULL) { - DHD_ERROR(("%s: MALLOC(%d) failed \n", __FUNCTION__, msize)); - bcmerror = BCME_NOMEM; - goto done; - } - } - - if ((str = MALLOC(bus->dhd->osh, maxstrlen)) == NULL) { - DHD_ERROR(("%s: MALLOC(%d) failed \n", __FUNCTION__, maxstrlen)); - bcmerror = BCME_NOMEM; - goto done; - } - - if ((bcmerror = dhdsdio_readshared(bus, &sdpcm_shared)) < 0) - goto done; - - bcm_binit(&strbuf, data, size); - - bcm_bprintf(&strbuf, "msgtrace address : 0x%08X\nconsole address : 0x%08X\n", - sdpcm_shared.msgtrace_addr, sdpcm_shared.console_addr); - - if ((sdpcm_shared.flags & SDPCM_SHARED_ASSERT_BUILT) == 0) { - /* NOTE: Misspelled assert is intentional - DO NOT FIX. - * (Avoids conflict with real asserts for programmatic parsing of output.) - */ - bcm_bprintf(&strbuf, "Assrt not built in dongle\n"); - } - - if ((sdpcm_shared.flags & (SDPCM_SHARED_ASSERT|SDPCM_SHARED_TRAP)) == 0) { - /* NOTE: Misspelled assert is intentional - DO NOT FIX. - * (Avoids conflict with real asserts for programmatic parsing of output.) - */ - bcm_bprintf(&strbuf, "No trap%s in dongle", - (sdpcm_shared.flags & SDPCM_SHARED_ASSERT_BUILT) - ?"/assrt" :""); - } else { - if (sdpcm_shared.flags & SDPCM_SHARED_ASSERT) { - /* Download assert */ - bcm_bprintf(&strbuf, "Dongle assert"); - if (sdpcm_shared.assert_exp_addr != 0) { - str[0] = '\0'; - if ((bcmerror = dhdsdio_membytes(bus, FALSE, - sdpcm_shared.assert_exp_addr, - (uint8 *)str, maxstrlen)) < 0) - goto done; - - str[maxstrlen - 1] = '\0'; - bcm_bprintf(&strbuf, " expr \"%s\"", str); - } - - if (sdpcm_shared.assert_file_addr != 0) { - str[0] = '\0'; - if ((bcmerror = dhdsdio_membytes(bus, FALSE, - sdpcm_shared.assert_file_addr, - (uint8 *)str, maxstrlen)) < 0) - goto done; - - str[maxstrlen - 1] = '\0'; - bcm_bprintf(&strbuf, " file \"%s\"", str); - } - - bcm_bprintf(&strbuf, " line %d ", sdpcm_shared.assert_line); - } - - if (sdpcm_shared.flags & SDPCM_SHARED_TRAP) { - if ((bcmerror = dhdsdio_membytes(bus, FALSE, - sdpcm_shared.trap_addr, - (uint8*)&tr, sizeof(trap_t))) < 0) - goto done; - - bcm_bprintf(&strbuf, - "Dongle trap type 0x%x @ epc 0x%x, cpsr 0x%x, spsr 0x%x, sp 0x%x," - "lp 0x%x, rpc 0x%x Trap offset 0x%x, " - "r0 0x%x, r1 0x%x, r2 0x%x, r3 0x%x, r4 0x%x, r5 0x%x, r6 0x%x, r7 0x%x\n", - tr.type, tr.epc, tr.cpsr, tr.spsr, tr.r13, tr.r14, tr.pc, - sdpcm_shared.trap_addr, - tr.r0, tr.r1, tr.r2, tr.r3, tr.r4, tr.r5, tr.r6, tr.r7); - } - } - - if (sdpcm_shared.flags & (SDPCM_SHARED_ASSERT | SDPCM_SHARED_TRAP)) { - DHD_ERROR(("%s: %s\n", __FUNCTION__, strbuf.origbuf)); - } - - if (sdpcm_shared.flags & SDPCM_SHARED_TRAP) { - /* Mem dump to a file on device */ - dhdsdio_mem_dump(bus); - } - -done: - if (mbuffer) - MFREE(bus->dhd->osh, mbuffer, msize); - if (str) - MFREE(bus->dhd->osh, str, maxstrlen); - - return bcmerror; -} - -static int -dhdsdio_mem_dump(dhd_bus_t *bus) -{ - int ret = 0; - int size; /* Full mem size */ - int start = 0; /* Start address */ - int read_size = 0; /* Read size of each iteration */ - uint8 *buf = NULL, *databuf = NULL; - - /* Get full mem size */ - size = bus->ramsize; - buf = MALLOC(bus->dhd->osh, size); - if (!buf) { - printf("%s: Out of memory (%d bytes)\n", __FUNCTION__, size); - return -1; - } - - /* Read mem content */ - printf("Dump dongle memory"); - databuf = buf; - while (size) - { - read_size = MIN(MEMBLOCK, size); - if ((ret = dhdsdio_membytes(bus, FALSE, start, databuf, read_size))) - { - printf("%s: Error membytes %d\n", __FUNCTION__, ret); - if (buf) { - MFREE(bus->dhd->osh, buf, size); - } - return -1; - } - printf("."); - - /* Decrement size and increment start address */ - size -= read_size; - start += read_size; - databuf += read_size; - } - printf("Done\n"); - -#ifdef DHD_DEBUG - /* free buf before return !!! */ - if (write_to_file(bus->dhd, buf, bus->ramsize)) - { - printf("%s: Error writing to files\n", __FUNCTION__); - return -1; - } - /* buf free handled in write_to_file, not here */ -#else - MFREE(bus->dhd->osh, buf, size); -#endif - return 0; -} -#endif /* DHD_DEBUG_TRAP */ - -#ifdef DHD_DEBUG -#define CONSOLE_LINE_MAX 192 - -static int -dhdsdio_readconsole(dhd_bus_t *bus) -{ - dhd_console_t *c = &bus->console; - uint8 line[CONSOLE_LINE_MAX], ch; - uint32 n, idx, addr; - int rv; - - /* Don't do anything until FWREADY updates console address */ - if (bus->console_addr == 0) - return 0; - - /* Read console log struct */ - addr = bus->console_addr + OFFSETOF(hndrte_cons_t, log); - if ((rv = dhdsdio_membytes(bus, FALSE, addr, (uint8 *)&c->log, sizeof(c->log))) < 0) - return rv; - - /* Allocate console buffer (one time only) */ - if (c->buf == NULL) { - c->bufsize = ltoh32(c->log.buf_size); - if ((c->buf = MALLOC(bus->dhd->osh, c->bufsize)) == NULL) - return BCME_NOMEM; - } - - idx = ltoh32(c->log.idx); - - /* Protect against corrupt value */ - if (idx > c->bufsize) - return BCME_ERROR; - - /* Skip reading the console buffer if the index pointer has not moved */ - if (idx == c->last) - return BCME_OK; - - /* Read the console buffer */ - addr = ltoh32(c->log.buf); - if ((rv = dhdsdio_membytes(bus, FALSE, addr, c->buf, c->bufsize)) < 0) - return rv; - - while (c->last != idx) { - for (n = 0; n < CONSOLE_LINE_MAX - 2; n++) { - if (c->last == idx) { - /* This would output a partial line. Instead, back up - * the buffer pointer and output this line next time around. - */ - if (c->last >= n) - c->last -= n; - else - c->last = c->bufsize - n; - goto break2; - } - ch = c->buf[c->last]; - c->last = (c->last + 1) % c->bufsize; - if (ch == '\n') - break; - line[n] = ch; - } - - if (n > 0) { - if (line[n - 1] == '\r') - n--; - line[n] = 0; - printf("CONSOLE: %s\n", line); - } - } -break2: - - return BCME_OK; -} -#endif /* DHD_DEBUG */ - -int -dhdsdio_downloadvars(dhd_bus_t *bus, void *arg, int len) -{ - int bcmerror = BCME_OK; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - /* Basic sanity checks */ - if (bus->dhd->up) { - bcmerror = BCME_NOTDOWN; - goto err; - } - if (!len) { - bcmerror = BCME_BUFTOOSHORT; - goto err; - } - - /* Free the old ones and replace with passed variables */ - if (bus->vars) - MFREE(bus->dhd->osh, bus->vars, bus->varsz); - - bus->vars = MALLOC(bus->dhd->osh, len); - bus->varsz = bus->vars ? len : 0; - if (bus->vars == NULL) { - bcmerror = BCME_NOMEM; - goto err; - } - - /* Copy the passed variables, which should include the terminating double-null */ - bcopy(arg, bus->vars, bus->varsz); -err: - return bcmerror; -} - -static int -dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, uint32 actionid, const char *name, - void *params, int plen, void *arg, int len, int val_size) -{ - int bcmerror = 0; - int32 int_val = 0; - bool bool_val = 0; - - DHD_TRACE(("%s: Enter, action %d name %s params %p plen %d arg %p len %d val_size %d\n", - __FUNCTION__, actionid, name, params, plen, arg, len, val_size)); - - if ((bcmerror = bcm_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid))) != 0) - goto exit; - - if (plen >= (int)sizeof(int_val)) - bcopy(params, &int_val, sizeof(int_val)); - - bool_val = (int_val != 0) ? TRUE : FALSE; - - - /* Some ioctls use the bus */ - dhd_os_sdlock(bus->dhd); - - /* Check if dongle is in reset. If so, only allow DEVRESET iovars */ - if (bus->dhd->dongle_reset && !(actionid == IOV_SVAL(IOV_DEVRESET) || - actionid == IOV_GVAL(IOV_DEVRESET))) { - bcmerror = BCME_NOTREADY; - goto exit; - } - - /* Handle sleep stuff before any clock mucking */ - if (vi->varid == IOV_SLEEP) { - if (IOV_ISSET(actionid)) { - bcmerror = dhdsdio_bussleep(bus, bool_val); - } else { - int_val = (int32)bus->sleeping; - bcopy(&int_val, arg, val_size); - } - goto exit; - } - - /* Request clock to allow SDIO accesses */ - if (!bus->dhd->dongle_reset) { - BUS_WAKE(bus); - dhdsdio_clkctl(bus, CLK_AVAIL, FALSE); - } - - switch (actionid) { - case IOV_GVAL(IOV_INTR): - int_val = (int32)bus->intr; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_INTR): - bus->intr = bool_val; - bus->intdis = FALSE; - if (bus->dhd->up) { - if (bus->intr) { - DHD_INTR(("%s: enable SDIO device interrupts\n", __FUNCTION__)); - bcmsdh_intr_enable(bus->sdh); - } else { - DHD_INTR(("%s: disable SDIO interrupts\n", __FUNCTION__)); - bcmsdh_intr_disable(bus->sdh); - } - } - break; - - case IOV_GVAL(IOV_POLLRATE): - int_val = (int32)bus->pollrate; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_POLLRATE): - bus->pollrate = (uint)int_val; - bus->poll = (bus->pollrate != 0); - break; - - case IOV_GVAL(IOV_IDLETIME): - int_val = bus->idletime; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_IDLETIME): - if ((int_val < 0) && (int_val != DHD_IDLE_IMMEDIATE)) { - bcmerror = BCME_BADARG; - } else { - bus->idletime = int_val; - } - break; - - case IOV_GVAL(IOV_IDLECLOCK): - int_val = (int32)bus->idleclock; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_IDLECLOCK): - bus->idleclock = int_val; - break; - - case IOV_GVAL(IOV_SD1IDLE): - int_val = (int32)sd1idle; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_SD1IDLE): - sd1idle = bool_val; - break; - - - case IOV_SVAL(IOV_MEMBYTES): - case IOV_GVAL(IOV_MEMBYTES): - { - uint32 address; - uint size, dsize; - uint8 *data; - - bool set = (actionid == IOV_SVAL(IOV_MEMBYTES)); - - ASSERT(plen >= 2*sizeof(int)); - - address = (uint32)int_val; - bcopy((char *)params + sizeof(int_val), &int_val, sizeof(int_val)); - size = (uint)int_val; - - /* Do some validation */ - dsize = set ? plen - (2 * sizeof(int)) : len; - if (dsize < size) { - DHD_ERROR(("%s: error on %s membytes, addr 0x%08x size %d dsize %d\n", - __FUNCTION__, (set ? "set" : "get"), address, size, dsize)); - bcmerror = BCME_BADARG; - break; - } - - DHD_INFO(("%s: Request to %s %d bytes at address 0x%08x\n", __FUNCTION__, - (set ? "write" : "read"), size, address)); - - /* If we know about SOCRAM, check for a fit */ - if ((bus->orig_ramsize) && - ((address > bus->orig_ramsize) || (address + size > bus->orig_ramsize))) { - DHD_ERROR(("%s: ramsize 0x%08x doesn't have %d bytes at 0x%08x\n", - __FUNCTION__, bus->orig_ramsize, size, address)); - bcmerror = BCME_BADARG; - break; - } - - /* Generate the actual data pointer */ - data = set ? (uint8*)params + 2 * sizeof(int): (uint8*)arg; - - /* Call to do the transfer */ - bcmerror = dhdsdio_membytes(bus, set, address, data, size); - - break; - } - - case IOV_GVAL(IOV_MEMSIZE): - int_val = (int32)bus->ramsize; - bcopy(&int_val, arg, val_size); - break; - - case IOV_GVAL(IOV_SDIOD_DRIVE): - int_val = (int32)dhd_sdiod_drive_strength; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_SDIOD_DRIVE): - dhd_sdiod_drive_strength = int_val; - si_sdiod_drive_strength_init(bus->sih, bus->dhd->osh, dhd_sdiod_drive_strength); - break; - - case IOV_SVAL(IOV_DOWNLOAD): - bcmerror = dhdsdio_download_state(bus, bool_val); - break; - - case IOV_SVAL(IOV_VARS): - bcmerror = dhdsdio_downloadvars(bus, arg, len); - break; - - case IOV_GVAL(IOV_READAHEAD): - int_val = (int32)dhd_readahead; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_READAHEAD): - if (bool_val && !dhd_readahead) - bus->nextlen = 0; - dhd_readahead = bool_val; - break; - - case IOV_GVAL(IOV_SDRXCHAIN): - int_val = (int32)bus->use_rxchain; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_SDRXCHAIN): - if (bool_val && !bus->sd_rxchain) - bcmerror = BCME_UNSUPPORTED; - else - bus->use_rxchain = bool_val; - break; - case IOV_GVAL(IOV_ALIGNCTL): - int_val = (int32)dhd_alignctl; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_ALIGNCTL): - dhd_alignctl = bool_val; - break; - - case IOV_GVAL(IOV_SDALIGN): - int_val = DHD_SDALIGN; - bcopy(&int_val, arg, val_size); - break; - -#ifdef DHD_DEBUG - case IOV_GVAL(IOV_VARS): - if (bus->varsz < (uint)len) - bcopy(bus->vars, arg, bus->varsz); - else - bcmerror = BCME_BUFTOOSHORT; - break; -#endif /* DHD_DEBUG */ - -#ifdef DHD_DEBUG - case IOV_GVAL(IOV_SDREG): - { - sdreg_t *sd_ptr; - uint32 addr, size; - - sd_ptr = (sdreg_t *)params; - - addr = (uintptr)bus->regs + sd_ptr->offset; - size = sd_ptr->func; - int_val = (int32)bcmsdh_reg_read(bus->sdh, addr, size); - if (bcmsdh_regfail(bus->sdh)) - bcmerror = BCME_SDIO_ERROR; - bcopy(&int_val, arg, sizeof(int32)); - break; - } - - case IOV_SVAL(IOV_SDREG): - { - sdreg_t *sd_ptr; - uint32 addr, size; - - sd_ptr = (sdreg_t *)params; - - addr = (uintptr)bus->regs + sd_ptr->offset; - size = sd_ptr->func; - bcmsdh_reg_write(bus->sdh, addr, size, sd_ptr->value); - if (bcmsdh_regfail(bus->sdh)) - bcmerror = BCME_SDIO_ERROR; - break; - } - - /* Same as above, but offset is not backplane (not SDIO core) */ - case IOV_GVAL(IOV_SBREG): - { - sdreg_t sdreg; - uint32 addr, size; - - bcopy(params, &sdreg, sizeof(sdreg)); - - addr = SI_ENUM_BASE + sdreg.offset; - size = sdreg.func; - int_val = (int32)bcmsdh_reg_read(bus->sdh, addr, size); - if (bcmsdh_regfail(bus->sdh)) - bcmerror = BCME_SDIO_ERROR; - bcopy(&int_val, arg, sizeof(int32)); - break; - } - - case IOV_SVAL(IOV_SBREG): - { - sdreg_t sdreg; - uint32 addr, size; - - bcopy(params, &sdreg, sizeof(sdreg)); - - addr = SI_ENUM_BASE + sdreg.offset; - size = sdreg.func; - bcmsdh_reg_write(bus->sdh, addr, size, sdreg.value); - if (bcmsdh_regfail(bus->sdh)) - bcmerror = BCME_SDIO_ERROR; - break; - } - - case IOV_GVAL(IOV_SDCIS): - { - *(char *)arg = 0; - - bcmstrcat(arg, "\nFunc 0\n"); - bcmsdh_cis_read(bus->sdh, 0x10, (uint8 *)arg + strlen(arg), SBSDIO_CIS_SIZE_LIMIT); - bcmstrcat(arg, "\nFunc 1\n"); - bcmsdh_cis_read(bus->sdh, 0x11, (uint8 *)arg + strlen(arg), SBSDIO_CIS_SIZE_LIMIT); - bcmstrcat(arg, "\nFunc 2\n"); - bcmsdh_cis_read(bus->sdh, 0x12, (uint8 *)arg + strlen(arg), SBSDIO_CIS_SIZE_LIMIT); - break; - } - - case IOV_GVAL(IOV_FORCEEVEN): - int_val = (int32)forcealign; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_FORCEEVEN): - forcealign = bool_val; - break; - - case IOV_GVAL(IOV_TXBOUND): - int_val = (int32)dhd_txbound; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_TXBOUND): - dhd_txbound = (uint)int_val; - break; - - case IOV_GVAL(IOV_RXBOUND): - int_val = (int32)dhd_rxbound; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_RXBOUND): - dhd_rxbound = (uint)int_val; - break; - - case IOV_GVAL(IOV_TXMINMAX): - int_val = (int32)dhd_txminmax; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_TXMINMAX): - dhd_txminmax = (uint)int_val; - break; - - - -#endif /* DHD_DEBUG */ - - -#ifdef SDTEST - case IOV_GVAL(IOV_EXTLOOP): - int_val = (int32)bus->ext_loop; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_EXTLOOP): - bus->ext_loop = bool_val; - break; - - case IOV_GVAL(IOV_PKTGEN): - bcmerror = dhdsdio_pktgen_get(bus, arg); - break; - - case IOV_SVAL(IOV_PKTGEN): - bcmerror = dhdsdio_pktgen_set(bus, arg); - break; -#endif /* SDTEST */ - - - case IOV_SVAL(IOV_DEVRESET): - DHD_TRACE(("%s: Called set IOV_DEVRESET=%d dongle_reset=%d busstate=%d\n", - __FUNCTION__, bool_val, bus->dhd->dongle_reset, - bus->dhd->busstate)); - - ASSERT(bus->dhd->osh); - /* ASSERT(bus->cl_devid); */ - - dhd_bus_devreset(bus->dhd, (uint8)bool_val); - - break; - - case IOV_GVAL(IOV_DEVRESET): - DHD_TRACE(("%s: Called get IOV_DEVRESET\n", __FUNCTION__)); - - /* Get its status */ - int_val = (bool) bus->dhd->dongle_reset; - bcopy(&int_val, arg, val_size); - - break; - - default: - bcmerror = BCME_UNSUPPORTED; - break; - } - -exit: - if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) { - bus->activity = FALSE; - dhdsdio_clkctl(bus, CLK_NONE, TRUE); - } - - dhd_os_sdunlock(bus->dhd); - - if (actionid == IOV_SVAL(IOV_DEVRESET) && bool_val == FALSE) - dhd_preinit_ioctls((dhd_pub_t *) bus->dhd); - - return bcmerror; -} - -static int -dhdsdio_write_vars(dhd_bus_t *bus) -{ - int bcmerror = 0; - uint32 varsize; - uint32 varaddr; - uint8 *vbuffer; - uint32 varsizew; -#ifdef DHD_DEBUG - char *nvram_ularray; -#endif /* DHD_DEBUG */ - - /* Even if there are no vars are to be written, we still need to set the ramsize. */ - varsize = bus->varsz ? ROUNDUP(bus->varsz, 4) : 0; - varaddr = (bus->ramsize - 4) - varsize; - - if (bus->vars) { - vbuffer = (uint8 *)MALLOC(bus->dhd->osh, varsize); - if (!vbuffer) - return BCME_NOMEM; - - bzero(vbuffer, varsize); - bcopy(bus->vars, vbuffer, bus->varsz); - - /* Write the vars list */ - bcmerror = dhdsdio_membytes(bus, TRUE, varaddr, vbuffer, varsize); -#ifdef DHD_DEBUG - /* Verify NVRAM bytes */ - DHD_INFO(("Compare NVRAM dl & ul; varsize=%d\n", varsize)); - nvram_ularray = (char*)MALLOC(bus->dhd->osh, varsize); - if (!nvram_ularray) - return BCME_NOMEM; - - /* Upload image to verify downloaded contents. */ - memset(nvram_ularray, 0xaa, varsize); - - /* Read the vars list to temp buffer for comparison */ - bcmerror = dhdsdio_membytes(bus, FALSE, varaddr, nvram_ularray, varsize); - if (bcmerror) { - DHD_ERROR(("%s: error %d on reading %d nvram bytes at 0x%08x\n", - __FUNCTION__, bcmerror, varsize, varaddr)); - } - /* Compare the org NVRAM with the one read from RAM */ - if (memcmp(vbuffer, nvram_ularray, varsize)) { - DHD_ERROR(("%s: Downloaded NVRAM image is corrupted.\n", __FUNCTION__)); - } else - DHD_ERROR(("%s: Download, Upload and compare of NVRAM succeeded.\n", - __FUNCTION__)); - - MFREE(bus->dhd->osh, nvram_ularray, varsize); -#endif /* DHD_DEBUG */ - - MFREE(bus->dhd->osh, vbuffer, varsize); - } - - /* adjust to the user specified RAM */ - DHD_INFO(("Physical memory size: %d, usable memory size: %d\n", - bus->orig_ramsize, bus->ramsize)); - DHD_INFO(("Vars are at %d, orig varsize is %d\n", - varaddr, varsize)); - varsize = ((bus->orig_ramsize - 4) - varaddr); - - /* - * Determine the length token: - * Varsize, converted to words, in lower 16-bits, checksum in upper 16-bits. - */ - if (bcmerror) { - varsizew = 0; - } else { - varsizew = varsize / 4; - varsizew = (~varsizew << 16) | (varsizew & 0x0000FFFF); - varsizew = htol32(varsizew); - } - - DHD_INFO(("New varsize is %d, length token=0x%08x\n", varsize, varsizew)); - - /* Write the length token to the last word */ - bcmerror = dhdsdio_membytes(bus, TRUE, (bus->orig_ramsize - 4), - (uint8*)&varsizew, 4); - - return bcmerror; -} - -static int -dhdsdio_download_state(dhd_bus_t *bus, bool enter) -{ - uint retries; - int bcmerror = 0; - - /* To enter download state, disable ARM and reset SOCRAM. - * To exit download state, simply reset ARM (default is RAM boot). - */ - if (enter) { - - bus->alp_only = TRUE; - - if (!(si_setcore(bus->sih, ARM7S_CORE_ID, 0)) && - !(si_setcore(bus->sih, ARMCM3_CORE_ID, 0))) { - DHD_ERROR(("%s: Failed to find ARM core!\n", __FUNCTION__)); - bcmerror = BCME_ERROR; - goto fail; - } - - si_core_disable(bus->sih, 0); - if (bcmsdh_regfail(bus->sdh)) { - bcmerror = BCME_SDIO_ERROR; - goto fail; - } - - if (!(si_setcore(bus->sih, SOCRAM_CORE_ID, 0))) { - DHD_ERROR(("%s: Failed to find SOCRAM core!\n", __FUNCTION__)); - bcmerror = BCME_ERROR; - goto fail; - } - - si_core_reset(bus->sih, 0, 0); - if (bcmsdh_regfail(bus->sdh)) { - DHD_ERROR(("%s: Failure trying reset SOCRAM core?\n", __FUNCTION__)); - bcmerror = BCME_SDIO_ERROR; - goto fail; - } - - /* Clear the top bit of memory */ - if (bus->ramsize) { - uint32 zeros = 0; - dhdsdio_membytes(bus, TRUE, bus->ramsize - 4, (uint8*)&zeros, 4); - } - } else { - if (!(si_setcore(bus->sih, SOCRAM_CORE_ID, 0))) { - DHD_ERROR(("%s: Failed to find SOCRAM core!\n", __FUNCTION__)); - bcmerror = BCME_ERROR; - goto fail; - } - - if (!si_iscoreup(bus->sih)) { - DHD_ERROR(("%s: SOCRAM core is down after reset?\n", __FUNCTION__)); - bcmerror = BCME_ERROR; - goto fail; - } - - if ((bcmerror = dhdsdio_write_vars(bus))) { - DHD_ERROR(("%s: no vars written to RAM\n", __FUNCTION__)); - bcmerror = 0; - } - - if (!si_setcore(bus->sih, PCMCIA_CORE_ID, 0) && - !si_setcore(bus->sih, SDIOD_CORE_ID, 0)) { - DHD_ERROR(("%s: Can't change back to SDIO core?\n", __FUNCTION__)); - bcmerror = BCME_ERROR; - goto fail; - } - W_SDREG(0xFFFFFFFF, &bus->regs->intstatus, retries); - - - if (!(si_setcore(bus->sih, ARM7S_CORE_ID, 0)) && - !(si_setcore(bus->sih, ARMCM3_CORE_ID, 0))) { - DHD_ERROR(("%s: Failed to find ARM core!\n", __FUNCTION__)); - bcmerror = BCME_ERROR; - goto fail; - } - - si_core_reset(bus->sih, 0, 0); - if (bcmsdh_regfail(bus->sdh)) { - DHD_ERROR(("%s: Failure trying to reset ARM core?\n", __FUNCTION__)); - bcmerror = BCME_SDIO_ERROR; - goto fail; - } - - /* Allow HT Clock now that the ARM is running. */ - bus->alp_only = FALSE; - - bus->dhd->busstate = DHD_BUS_LOAD; - } - -fail: - /* Always return to SDIOD core */ - if (!si_setcore(bus->sih, PCMCIA_CORE_ID, 0)) - si_setcore(bus->sih, SDIOD_CORE_ID, 0); - - return bcmerror; -} - -int -dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name, - void *params, int plen, void *arg, int len, bool set) -{ - dhd_bus_t *bus = dhdp->bus; - const bcm_iovar_t *vi = NULL; - int bcmerror = 0; - int val_size; - uint32 actionid; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - ASSERT(name); - ASSERT(len >= 0); - - /* Get MUST have return space */ - ASSERT(set || (arg && len)); - - /* Set does NOT take qualifiers */ - ASSERT(!set || (!params && !plen)); - - /* Look up var locally; if not found pass to host driver */ - if ((vi = bcm_iovar_lookup(dhdsdio_iovars, name)) == NULL) { - dhd_os_sdlock(bus->dhd); - - BUS_WAKE(bus); - - /* Turn on clock in case SD command needs backplane */ - dhdsdio_clkctl(bus, CLK_AVAIL, FALSE); - - bcmerror = bcmsdh_iovar_op(bus->sdh, name, params, plen, arg, len, set); - - /* Check for bus configuration changes of interest */ - - /* If it was divisor change, read the new one */ - if (set && strcmp(name, "sd_divisor") == 0) { - if (bcmsdh_iovar_op(bus->sdh, "sd_divisor", NULL, 0, - &bus->sd_divisor, sizeof(int32), FALSE) != BCME_OK) { - bus->sd_divisor = -1; - DHD_ERROR(("%s: fail on %s get\n", __FUNCTION__, name)); - } else { - DHD_INFO(("%s: noted %s update, value now %d\n", - __FUNCTION__, name, bus->sd_divisor)); - } - } - /* If it was a mode change, read the new one */ - if (set && strcmp(name, "sd_mode") == 0) { - if (bcmsdh_iovar_op(bus->sdh, "sd_mode", NULL, 0, - &bus->sd_mode, sizeof(int32), FALSE) != BCME_OK) { - bus->sd_mode = -1; - DHD_ERROR(("%s: fail on %s get\n", __FUNCTION__, name)); - } else { - DHD_INFO(("%s: noted %s update, value now %d\n", - __FUNCTION__, name, bus->sd_mode)); - } - } - /* Similar check for blocksize change */ - if (set && strcmp(name, "sd_blocksize") == 0) { - int32 fnum = 2; - if (bcmsdh_iovar_op(bus->sdh, "sd_blocksize", &fnum, sizeof(int32), - &bus->blocksize, sizeof(int32), FALSE) != BCME_OK) { - bus->blocksize = 0; - DHD_ERROR(("%s: fail on %s get\n", __FUNCTION__, "sd_blocksize")); - } else { - DHD_INFO(("%s: noted %s update, value now %d\n", - __FUNCTION__, "sd_blocksize", bus->blocksize)); - } - } - bus->roundup = MIN(max_roundup, bus->blocksize); - - if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) { - bus->activity = FALSE; - dhdsdio_clkctl(bus, CLK_NONE, TRUE); - } - - dhd_os_sdunlock(bus->dhd); - goto exit; - } - - DHD_CTL(("%s: %s %s, len %d plen %d\n", __FUNCTION__, - name, (set ? "set" : "get"), len, plen)); - - /* set up 'params' pointer in case this is a set command so that - * the convenience int and bool code can be common to set and get - */ - if (params == NULL) { - params = arg; - plen = len; - } - - if (vi->type == IOVT_VOID) - val_size = 0; - else if (vi->type == IOVT_BUFFER) - val_size = len; - else - /* all other types are integer sized */ - val_size = sizeof(int); - - actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid); - bcmerror = dhdsdio_doiovar(bus, vi, actionid, name, params, plen, arg, len, val_size); - -exit: - return bcmerror; -} - -void -dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex) -{ - osl_t *osh = bus->dhd->osh; - uint32 local_hostintmask; - uint8 saveclk; - uint retries; - int err; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - if (enforce_mutex) - dhd_os_sdlock(bus->dhd); - - BUS_WAKE(bus); - - /* Change our idea of bus state */ - bus->dhd->busstate = DHD_BUS_DOWN; - - /* Enable clock for device interrupts */ - dhdsdio_clkctl(bus, CLK_AVAIL, FALSE); - - /* Disable and clear interrupts at the chip level also */ - W_SDREG(0, &bus->regs->hostintmask, retries); - local_hostintmask = bus->hostintmask; - bus->hostintmask = 0; - - /* Force clocks on backplane to be sure F2 interrupt propagates */ - saveclk = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, &err); - if (!err) { - bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, - (saveclk | SBSDIO_FORCE_HT), &err); - } - if (err) { - DHD_ERROR(("%s: Failed to force clock for F2: err %d\n", __FUNCTION__, err)); - } - - /* Turn off the bus (F2), free any pending packets */ - DHD_INTR(("%s: disable SDIO interrupts\n", __FUNCTION__)); - bcmsdh_intr_disable(bus->sdh); - bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, SDIO_FUNC_ENABLE_1, NULL); - - /* Clear any pending interrupts now that F2 is disabled */ - W_SDREG(local_hostintmask, &bus->regs->intstatus, retries); - - /* Turn off the backplane clock (only) */ - dhdsdio_clkctl(bus, CLK_SDONLY, FALSE); - - /* Clear the data packet queues */ - pktq_flush(osh, &bus->txq, TRUE); - - /* Clear any held glomming stuff */ - if (bus->glomd) - PKTFREE(osh, bus->glomd, FALSE); - - if (bus->glom) - PKTFREE(osh, bus->glom, FALSE); - - bus->glom = bus->glomd = NULL; - - /* Clear rx control and wake any waiters */ - bus->rxlen = 0; - dhd_os_ioctl_resp_wake(bus->dhd); - - /* Reset some F2 state stuff */ - bus->rxskip = FALSE; - bus->tx_seq = bus->rx_seq = 0; - - if (enforce_mutex) - dhd_os_sdunlock(bus->dhd); -} - -int -dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex) -{ - dhd_bus_t *bus = dhdp->bus; - dhd_timeout_t tmo; - uint retries = 0; - uint8 ready, enable; - int err, ret = BCME_ERROR; - uint8 saveclk; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - ASSERT(bus->dhd); - if (!bus->dhd) - return BCME_OK; - - if (enforce_mutex) - dhd_os_sdlock(bus->dhd); - - /* Make sure backplane clock is on, needed to generate F2 interrupt */ - err = dhdsdio_clkctl(bus, CLK_AVAIL, FALSE); - if ((err != BCME_OK) || (bus->clkstate != CLK_AVAIL)) { - DHD_ERROR(("%s: Failed to set backplane clock: err %d\n", __FUNCTION__, err)); - goto exit; - } - - /* Force clocks on backplane to be sure F2 interrupt propagates */ - saveclk = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, &err); - if (!err) { - bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, - (saveclk | SBSDIO_FORCE_HT), &err); - } - if (err) { - DHD_ERROR(("%s: Failed to force clock for F2: err %d\n", __FUNCTION__, err)); - goto exit; - } - - /* Enable function 2 (frame transfers) */ - W_SDREG((SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT), - &bus->regs->tosbmailboxdata, retries); - enable = (SDIO_FUNC_ENABLE_1 | SDIO_FUNC_ENABLE_2); - - bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, enable, NULL); - - /* Give the dongle some time to do its thing and set IOR2 */ - dhd_timeout_start(&tmo, DHD_WAIT_F2RDY * 1000); - - ready = 0; - while (ready != enable && !dhd_timeout_expired(&tmo)) - ready = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IORDY, NULL); - - - DHD_INFO(("%s: enable 0x%02x, ready 0x%02x (waited %uus)\n", - __FUNCTION__, enable, ready, tmo.elapsed)); - - - /* If F2 successfully enabled, set core and enable interrupts */ - if (ready == enable) { - /* Make sure we're talking to the core. */ - if (!(bus->regs = si_setcore(bus->sih, PCMCIA_CORE_ID, 0))) - bus->regs = si_setcore(bus->sih, SDIOD_CORE_ID, 0); - - /* Set up the interrupt mask and enable interrupts */ - bus->hostintmask = HOSTINTMASK; - W_SDREG(bus->hostintmask, &bus->regs->hostintmask, retries); - - bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_WATERMARK, (uint8)watermark, &err); - - /* Set bus state according to enable result */ - dhdp->busstate = DHD_BUS_DATA; - - /* bcmsdh_intr_unmask(bus->sdh); */ - - bus->intdis = FALSE; - if (bus->intr) { - DHD_INTR(("%s: enable SDIO device interrupts\n", __FUNCTION__)); - bcmsdh_intr_enable(bus->sdh); - } else { - DHD_INTR(("%s: disable SDIO interrupts\n", __FUNCTION__)); - bcmsdh_intr_disable(bus->sdh); - } - - } - - - else { - /* Disable F2 again */ - enable = SDIO_FUNC_ENABLE_1; - bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, enable, NULL); - } - - /* Restore previous clock setting */ - bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, saveclk, &err); - - - /* If we didn't come up, turn off backplane clock */ - if (dhdp->busstate != DHD_BUS_DATA) - dhdsdio_clkctl(bus, CLK_NONE, FALSE); - - ret = BCME_OK; -exit: - if (enforce_mutex) - dhd_os_sdunlock(bus->dhd); - - return ret; -} - -static void -dhdsdio_rxfail(dhd_bus_t *bus, bool abort, bool rtx) -{ - bcmsdh_info_t *sdh = bus->sdh; - sdpcmd_regs_t *regs = bus->regs; - uint retries = 0; - uint16 lastrbc; - uint8 hi, lo; - int err; - - DHD_ERROR(("%s: %sterminate frame%s\n", __FUNCTION__, - (abort ? "abort command, " : ""), (rtx ? ", send NAK" : ""))); - - if (abort) { - bcmsdh_abort(sdh, SDIO_FUNC_2); - } - - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL, SFC_RF_TERM, &err); - bus->f1regdata++; - - /* Wait until the packet has been flushed (device/FIFO stable) */ - for (lastrbc = retries = 0xffff; retries > 0; retries--) { - hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_RFRAMEBCHI, NULL); - lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_RFRAMEBCLO, NULL); - bus->f1regdata += 2; - - if ((hi == 0) && (lo == 0)) - break; - - if ((hi > (lastrbc >> 8)) && (lo > (lastrbc & 0x00ff))) { - DHD_ERROR(("%s: count growing: last 0x%04x now 0x%04x\n", - __FUNCTION__, lastrbc, ((hi << 8) + lo))); - } - lastrbc = (hi << 8) + lo; - } - - if (!retries) { - DHD_ERROR(("%s: count never zeroed: last 0x%04x\n", __FUNCTION__, lastrbc)); - } else { - DHD_INFO(("%s: flush took %d iterations\n", __FUNCTION__, (0xffff - retries))); - } - - if (rtx) { - bus->rxrtx++; - W_SDREG(SMB_NAK, ®s->tosbmailbox, retries); - bus->f1regdata++; - if (retries <= retry_limit) { - bus->rxskip = TRUE; - } - } - - /* Clear partial in any case */ - bus->nextlen = 0; - - /* If we can't reach the device, signal failure */ - if (err || bcmsdh_regfail(sdh)) - bus->dhd->busstate = DHD_BUS_DOWN; -} - -static void -dhdsdio_read_control(dhd_bus_t *bus, uint8 *hdr, uint len, uint doff) -{ - bcmsdh_info_t *sdh = bus->sdh; - uint rdlen, pad; - - int sdret; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - /* Control data already received in aligned rxctl */ - if ((bus->bus == SPI_BUS) && (!bus->usebufpool)) - goto gotpkt; - - ASSERT(bus->rxbuf); - /* Set rxctl for frame (w/optional alignment) */ - bus->rxctl = bus->rxbuf; - if (dhd_alignctl) { - bus->rxctl += firstread; - if ((pad = ((uintptr)bus->rxctl % DHD_SDALIGN))) - bus->rxctl += (DHD_SDALIGN - pad); - bus->rxctl -= firstread; - } - ASSERT(bus->rxctl >= bus->rxbuf); - - /* Copy the already-read portion over */ - bcopy(hdr, bus->rxctl, firstread); - if (len <= firstread) - goto gotpkt; - - /* Copy the full data pkt in gSPI case and process ioctl. */ - if (bus->bus == SPI_BUS) { - bcopy(hdr, bus->rxctl, len); - goto gotpkt; - } - - /* Raise rdlen to next SDIO block to avoid tail command */ - rdlen = len - firstread; - if (bus->roundup && bus->blocksize && (rdlen > bus->blocksize)) { - pad = bus->blocksize - (rdlen % bus->blocksize); - if ((pad <= bus->roundup) && (pad < bus->blocksize) && - ((len + pad) < bus->dhd->maxctl)) - rdlen += pad; - } else if (rdlen % DHD_SDALIGN) { - rdlen += DHD_SDALIGN - (rdlen % DHD_SDALIGN); - } - - /* Satisfy length-alignment requirements */ - if (forcealign && (rdlen & (ALIGNMENT - 1))) - rdlen = ROUNDUP(rdlen, ALIGNMENT); - - /* Drop if the read is too big or it exceeds our maximum */ - if ((rdlen + firstread) > bus->dhd->maxctl) { - DHD_ERROR(("%s: %d-byte control read exceeds %d-byte buffer\n", - __FUNCTION__, rdlen, bus->dhd->maxctl)); - bus->dhd->rx_errors++; - dhdsdio_rxfail(bus, FALSE, FALSE); - goto done; - } - - if ((len - doff) > bus->dhd->maxctl) { - DHD_ERROR(("%s: %d-byte ctl frame (%d-byte ctl data) exceeds %d-byte limit\n", - __FUNCTION__, len, (len - doff), bus->dhd->maxctl)); - bus->dhd->rx_errors++; bus->rx_toolong++; - dhdsdio_rxfail(bus, FALSE, FALSE); - goto done; - } - - - /* Read remainder of frame body into the rxctl buffer */ - sdret = dhd_bcmsdh_recv_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, F2SYNC, - (bus->rxctl + firstread), rdlen, NULL, NULL, NULL); - bus->f2rxdata++; - ASSERT(sdret != BCME_PENDING); - - /* Control frame failures need retransmission */ - if (sdret < 0) { - DHD_ERROR(("%s: read %d control bytes failed: %d\n", __FUNCTION__, rdlen, sdret)); - bus->rxc_errors++; /* dhd.rx_ctlerrs is higher level */ - dhdsdio_rxfail(bus, TRUE, TRUE); - goto done; - } - -gotpkt: - -#ifdef DHD_DEBUG - if (DHD_BYTES_ON() && DHD_CTL_ON()) { - prhex("RxCtrl", bus->rxctl, len); - } -#endif - - /* Point to valid data and indicate its length */ - bus->rxctl += doff; - bus->rxlen = len - doff; - -done: - /* Awake any waiters */ - dhd_os_ioctl_resp_wake(bus->dhd); -} - -static uint8 -dhdsdio_rxglom(dhd_bus_t *bus, uint8 rxseq) -{ - uint16 dlen, totlen; - uint8 *dptr, num = 0; - - uint16 sublen, check; - void *pfirst, *plast, *pnext, *save_pfirst; - osl_t *osh = bus->dhd->osh; - - int errcode; - uint8 chan, seq, doff, sfdoff; - uint8 txmax; - - int ifidx = 0; - bool usechain = bus->use_rxchain; - - /* If packets, issue read(s) and send up packet chain */ - /* Return sequence numbers consumed? */ - - DHD_TRACE(("dhdsdio_rxglom: start: glomd %p glom %p\n", bus->glomd, bus->glom)); - - /* If there's a descriptor, generate the packet chain */ - if (bus->glomd) { - dhd_os_sdlock_rxq(bus->dhd); - - pfirst = plast = pnext = NULL; - dlen = (uint16)PKTLEN(osh, bus->glomd); - dptr = PKTDATA(osh, bus->glomd); - if (!dlen || (dlen & 1)) { - DHD_ERROR(("%s: bad glomd len (%d), ignore descriptor\n", - __FUNCTION__, dlen)); - dlen = 0; - } - - for (totlen = num = 0; dlen; num++) { - /* Get (and move past) next length */ - sublen = ltoh16_ua(dptr); - dlen -= sizeof(uint16); - dptr += sizeof(uint16); - if ((sublen < SDPCM_HDRLEN) || - ((num == 0) && (sublen < (2 * SDPCM_HDRLEN)))) { - DHD_ERROR(("%s: descriptor len %d bad: %d\n", - __FUNCTION__, num, sublen)); - pnext = NULL; - break; - } - if (sublen % DHD_SDALIGN) { - DHD_ERROR(("%s: sublen %d not a multiple of %d\n", - __FUNCTION__, sublen, DHD_SDALIGN)); - usechain = FALSE; - } - totlen += sublen; - - /* For last frame, adjust read len so total is a block multiple */ - if (!dlen) { - sublen += (ROUNDUP(totlen, bus->blocksize) - totlen); - totlen = ROUNDUP(totlen, bus->blocksize); - } - - /* Allocate/chain packet for next subframe */ - if ((pnext = PKTGET(osh, sublen + DHD_SDALIGN, FALSE)) == NULL) { - DHD_ERROR(("%s: PKTGET failed, num %d len %d\n", - __FUNCTION__, num, sublen)); - break; - } - ASSERT(!PKTLINK(pnext)); - if (!pfirst) { - ASSERT(!plast); - pfirst = plast = pnext; - } else { - ASSERT(plast); - PKTSETNEXT(osh, plast, pnext); - plast = pnext; - } - - /* Adhere to start alignment requirements */ - PKTALIGN(osh, pnext, sublen, DHD_SDALIGN); - } - - /* If all allocations succeeded, save packet chain in bus structure */ - if (pnext) { - DHD_GLOM(("%s: allocated %d-byte packet chain for %d subframes\n", - __FUNCTION__, totlen, num)); - if (DHD_GLOM_ON() && bus->nextlen) { - if (totlen != bus->nextlen) { - DHD_GLOM(("%s: glomdesc mismatch: nextlen %d glomdesc %d " - "rxseq %d\n", __FUNCTION__, bus->nextlen, - totlen, rxseq)); - } - } - bus->glom = pfirst; - pfirst = pnext = NULL; - } else { - if (pfirst) - PKTFREE(osh, pfirst, FALSE); - bus->glom = NULL; - num = 0; - } - - /* Done with descriptor packet */ - PKTFREE(osh, bus->glomd, FALSE); - bus->glomd = NULL; - bus->nextlen = 0; - - dhd_os_sdunlock_rxq(bus->dhd); - } - - /* Ok -- either we just generated a packet chain, or had one from before */ - if (bus->glom) { - if (DHD_GLOM_ON()) { - DHD_GLOM(("%s: attempt superframe read, packet chain:\n", __FUNCTION__)); - for (pnext = bus->glom; pnext; pnext = PKTNEXT(osh, pnext)) { - DHD_GLOM((" %p: %p len 0x%04x (%d)\n", - pnext, (uint8*)PKTDATA(osh, pnext), - PKTLEN(osh, pnext), PKTLEN(osh, pnext))); - } - } - - pfirst = bus->glom; - dlen = (uint16)pkttotlen(osh, pfirst); - - /* Do an SDIO read for the superframe. Configurable iovar to - * read directly into the chained packet, or allocate a large - * packet and and copy into the chain. - */ - if (usechain) { - errcode = dhd_bcmsdh_recv_buf(bus, - bcmsdh_cur_sbwad(bus->sdh), SDIO_FUNC_2, - F2SYNC, (uint8*)PKTDATA(osh, pfirst), - dlen, pfirst, NULL, NULL); - } else if (bus->dataptr) { - errcode = dhd_bcmsdh_recv_buf(bus, - bcmsdh_cur_sbwad(bus->sdh), SDIO_FUNC_2, - F2SYNC, bus->dataptr, - dlen, NULL, NULL, NULL); - sublen = (uint16)pktfrombuf(osh, pfirst, 0, dlen, bus->dataptr); - if (sublen != dlen) { - DHD_ERROR(("%s: FAILED TO COPY, dlen %d sublen %d\n", - __FUNCTION__, dlen, sublen)); - errcode = -1; - } - pnext = NULL; - } else { - DHD_ERROR(("COULDN'T ALLOC %d-BYTE GLOM, FORCE FAILURE\n", dlen)); - errcode = -1; - } - bus->f2rxdata++; - ASSERT(errcode != BCME_PENDING); - - /* On failure, kill the superframe, allow a couple retries */ - if (errcode < 0) { - DHD_ERROR(("%s: glom read of %d bytes failed: %d\n", - __FUNCTION__, dlen, errcode)); - bus->dhd->rx_errors++; - - if (bus->glomerr++ < 3) { - dhdsdio_rxfail(bus, TRUE, TRUE); - } else { - bus->glomerr = 0; - dhdsdio_rxfail(bus, TRUE, FALSE); - dhd_os_sdlock_rxq(bus->dhd); - PKTFREE(osh, bus->glom, FALSE); - dhd_os_sdunlock_rxq(bus->dhd); - bus->rxglomfail++; - bus->glom = NULL; - } - return 0; - } - -#ifdef DHD_DEBUG - if (DHD_GLOM_ON()) { - prhex("SUPERFRAME", PKTDATA(osh, pfirst), - MIN(PKTLEN(osh, pfirst), 48)); - } -#endif - - - /* Validate the superframe header */ - dptr = (uint8 *)PKTDATA(osh, pfirst); - sublen = ltoh16_ua(dptr); - check = ltoh16_ua(dptr + sizeof(uint16)); - - chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]); - seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]); - bus->nextlen = dptr[SDPCM_FRAMETAG_LEN + SDPCM_NEXTLEN_OFFSET]; - if ((bus->nextlen << 4) > MAX_RX_DATASZ) { - DHD_INFO(("%s: got frame w/nextlen too large (%d) seq %d\n", - __FUNCTION__, bus->nextlen, seq)); - bus->nextlen = 0; - } - doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]); - txmax = SDPCM_WINDOW_VALUE(&dptr[SDPCM_FRAMETAG_LEN]); - - errcode = 0; - if ((uint16)~(sublen^check)) { - DHD_ERROR(("%s (superframe): HW hdr error: len/check 0x%04x/0x%04x\n", - __FUNCTION__, sublen, check)); - errcode = -1; - } else if (ROUNDUP(sublen, bus->blocksize) != dlen) { - DHD_ERROR(("%s (superframe): len 0x%04x, rounded 0x%04x, expect 0x%04x\n", - __FUNCTION__, sublen, ROUNDUP(sublen, bus->blocksize), dlen)); - errcode = -1; - } else if (SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]) != SDPCM_GLOM_CHANNEL) { - DHD_ERROR(("%s (superframe): bad channel %d\n", __FUNCTION__, - SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]))); - errcode = -1; - } else if (SDPCM_GLOMDESC(&dptr[SDPCM_FRAMETAG_LEN])) { - DHD_ERROR(("%s (superframe): got second descriptor?\n", __FUNCTION__)); - errcode = -1; - } else if ((doff < SDPCM_HDRLEN) || - (doff > (PKTLEN(osh, pfirst) - SDPCM_HDRLEN))) { - DHD_ERROR(("%s (superframe): Bad data offset %d: HW %d pkt %d min %d\n", - __FUNCTION__, doff, sublen, PKTLEN(osh, pfirst), SDPCM_HDRLEN)); - errcode = -1; - } - - /* Check sequence number of superframe SW header */ - if (rxseq != seq) { - DHD_INFO(("%s: (superframe) rx_seq %d, expected %d\n", - __FUNCTION__, seq, rxseq)); - bus->rx_badseq++; - rxseq = seq; - } - - /* Check window for sanity */ - if ((uint8)(txmax - bus->tx_seq) > 0x40) { - DHD_ERROR(("%s: got unlikely tx max %d with tx_seq %d\n", - __FUNCTION__, txmax, bus->tx_seq)); - txmax = bus->tx_seq + 2; - } - bus->tx_max = txmax; - - /* Remove superframe header, remember offset */ - PKTPULL(osh, pfirst, doff); - sfdoff = doff; - - /* Validate all the subframe headers */ - for (num = 0, pnext = pfirst; pnext && !errcode; - num++, pnext = PKTNEXT(osh, pnext)) { - dptr = (uint8 *)PKTDATA(osh, pnext); - dlen = (uint16)PKTLEN(osh, pnext); - sublen = ltoh16_ua(dptr); - check = ltoh16_ua(dptr + sizeof(uint16)); - chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]); - doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]); -#ifdef DHD_DEBUG - if (DHD_GLOM_ON()) { - prhex("subframe", dptr, 32); - } -#endif - - if ((uint16)~(sublen^check)) { - DHD_ERROR(("%s (subframe %d): HW hdr error: " - "len/check 0x%04x/0x%04x\n", - __FUNCTION__, num, sublen, check)); - errcode = -1; - } else if ((sublen > dlen) || (sublen < SDPCM_HDRLEN)) { - DHD_ERROR(("%s (subframe %d): length mismatch: " - "len 0x%04x, expect 0x%04x\n", - __FUNCTION__, num, sublen, dlen)); - errcode = -1; - } else if ((chan != SDPCM_DATA_CHANNEL) && - (chan != SDPCM_EVENT_CHANNEL)) { - DHD_ERROR(("%s (subframe %d): bad channel %d\n", - __FUNCTION__, num, chan)); - errcode = -1; - } else if ((doff < SDPCM_HDRLEN) || (doff > sublen)) { - DHD_ERROR(("%s (subframe %d): Bad data offset %d: HW %d min %d\n", - __FUNCTION__, num, doff, sublen, SDPCM_HDRLEN)); - errcode = -1; - } - } - - if (errcode) { - /* Terminate frame on error, request a couple retries */ - if (bus->glomerr++ < 3) { - /* Restore superframe header space */ - PKTPUSH(osh, pfirst, sfdoff); - dhdsdio_rxfail(bus, TRUE, TRUE); - } else { - bus->glomerr = 0; - dhdsdio_rxfail(bus, TRUE, FALSE); - dhd_os_sdlock_rxq(bus->dhd); - PKTFREE(osh, bus->glom, FALSE); - dhd_os_sdunlock_rxq(bus->dhd); - bus->rxglomfail++; - bus->glom = NULL; - } - bus->nextlen = 0; - return 0; - } - - /* Basic SD framing looks ok - process each packet (header) */ - save_pfirst = pfirst; - bus->glom = NULL; - plast = NULL; - - dhd_os_sdlock_rxq(bus->dhd); - for (num = 0; pfirst; rxseq++, pfirst = pnext) { - pnext = PKTNEXT(osh, pfirst); - PKTSETNEXT(osh, pfirst, NULL); - - dptr = (uint8 *)PKTDATA(osh, pfirst); - sublen = ltoh16_ua(dptr); - chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]); - seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]); - doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]); - - DHD_GLOM(("%s: Get subframe %d, %p(%p/%d), sublen %d chan %d seq %d\n", - __FUNCTION__, num, pfirst, PKTDATA(osh, pfirst), - PKTLEN(osh, pfirst), sublen, chan, seq)); - - ASSERT((chan == SDPCM_DATA_CHANNEL) || (chan == SDPCM_EVENT_CHANNEL)); - - if (rxseq != seq) { - DHD_GLOM(("%s: rx_seq %d, expected %d\n", - __FUNCTION__, seq, rxseq)); - bus->rx_badseq++; - rxseq = seq; - } - -#ifdef DHD_DEBUG - if (DHD_BYTES_ON() && DHD_DATA_ON()) { - prhex("Rx Subframe Data", dptr, dlen); - } -#endif - - PKTSETLEN(osh, pfirst, sublen); - PKTPULL(osh, pfirst, doff); - - if (PKTLEN(osh, pfirst) == 0) { - PKTFREE(bus->dhd->osh, pfirst, FALSE); - if (plast) { - PKTSETNEXT(osh, plast, pnext); - } else { - ASSERT(save_pfirst == pfirst); - save_pfirst = pnext; - } - continue; - } else if (dhd_prot_hdrpull(bus->dhd, &ifidx, pfirst) != 0) { - DHD_ERROR(("%s: rx protocol error\n", __FUNCTION__)); - bus->dhd->rx_errors++; - PKTFREE(osh, pfirst, FALSE); - if (plast) { - PKTSETNEXT(osh, plast, pnext); - } else { - ASSERT(save_pfirst == pfirst); - save_pfirst = pnext; - } - continue; - } - - /* this packet will go up, link back into chain and count it */ - PKTSETNEXT(osh, pfirst, pnext); - plast = pfirst; - num++; - -#ifdef DHD_DEBUG - if (DHD_GLOM_ON()) { - DHD_GLOM(("%s subframe %d to stack, %p(%p/%d) nxt/lnk %p/%p\n", - __FUNCTION__, num, pfirst, - PKTDATA(osh, pfirst), PKTLEN(osh, pfirst), - PKTNEXT(osh, pfirst), PKTLINK(pfirst))); - prhex("", (uint8 *)PKTDATA(osh, pfirst), - MIN(PKTLEN(osh, pfirst), 32)); - } -#endif /* DHD_DEBUG */ - } - dhd_os_sdunlock_rxq(bus->dhd); - if (num) { - dhd_os_sdunlock(bus->dhd); - dhd_rx_frame(bus->dhd, ifidx, save_pfirst, num); - dhd_os_sdlock(bus->dhd); - } - - bus->rxglomframes++; - bus->rxglompkts += num; - } - return num; -} - -/* Return TRUE if there may be more frames to read */ -static uint -dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) -{ - osl_t *osh = bus->dhd->osh; - bcmsdh_info_t *sdh = bus->sdh; - - uint16 len, check; /* Extracted hardware header fields */ - uint8 chan, seq, doff; /* Extracted software header fields */ - uint8 fcbits; /* Extracted fcbits from software header */ - uint8 delta; - - void *pkt; /* Packet for event or data frames */ - uint16 pad; /* Number of pad bytes to read */ - uint16 rdlen; /* Total number of bytes to read */ - uint8 rxseq; /* Next sequence number to expect */ - uint rxleft = 0; /* Remaining number of frames allowed */ - int sdret; /* Return code from bcmsdh calls */ - uint8 txmax; /* Maximum tx sequence offered */ - bool len_consistent; /* Result of comparing readahead len and len from hw-hdr */ - uint8 *rxbuf; - int ifidx = 0; - uint rxcount = 0; /* Total frames read */ - -#if defined(DHD_DEBUG) || defined(SDTEST) - bool sdtest = FALSE; /* To limit message spew from test mode */ -#endif - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - ASSERT(maxframes); - -#ifdef SDTEST - /* Allow pktgen to override maxframes */ - if (bus->pktgen_count && (bus->pktgen_mode == DHD_PKTGEN_RECV)) { - maxframes = bus->pktgen_count; - sdtest = TRUE; - } -#endif - - /* Not finished unless we encounter no more frames indication */ - *finished = FALSE; - - - for (rxseq = bus->rx_seq, rxleft = maxframes; - !bus->rxskip && rxleft && bus->dhd->busstate != DHD_BUS_DOWN; - rxseq++, rxleft--) { - - /* Handle glomming separately */ - if (bus->glom || bus->glomd) { - uint8 cnt; - DHD_GLOM(("%s: calling rxglom: glomd %p, glom %p\n", - __FUNCTION__, bus->glomd, bus->glom)); - cnt = dhdsdio_rxglom(bus, rxseq); - DHD_GLOM(("%s: rxglom returned %d\n", __FUNCTION__, cnt)); - rxseq += cnt - 1; - rxleft = (rxleft > cnt) ? (rxleft - cnt) : 1; - continue; - } - - /* Try doing single read if we can */ - if (dhd_readahead && bus->nextlen) { - uint16 nextlen = bus->nextlen; - bus->nextlen = 0; - - if (bus->bus == SPI_BUS) { - rdlen = len = nextlen; - } - else { - rdlen = len = nextlen << 4; - - /* Pad read to blocksize for efficiency */ - if (bus->roundup && bus->blocksize && (rdlen > bus->blocksize)) { - pad = bus->blocksize - (rdlen % bus->blocksize); - if ((pad <= bus->roundup) && (pad < bus->blocksize) && - ((rdlen + pad + firstread) < MAX_RX_DATASZ)) - rdlen += pad; - } else if (rdlen % DHD_SDALIGN) { - rdlen += DHD_SDALIGN - (rdlen % DHD_SDALIGN); - } - } - - /* We use bus->rxctl buffer in WinXP for initial control pkt receives. - * Later we use buffer-poll for data as well as control packets. - * This is required becuase dhd receives full frame in gSPI unlike SDIO. - * After the frame is received we have to distinguish whether it is data - * or non-data frame. - */ - /* Allocate a packet buffer */ - dhd_os_sdlock_rxq(bus->dhd); - if (!(pkt = PKTGET(osh, rdlen + DHD_SDALIGN, FALSE))) { - if (bus->bus == SPI_BUS) { - bus->usebufpool = FALSE; - bus->rxctl = bus->rxbuf; - if (dhd_alignctl) { - bus->rxctl += firstread; - if ((pad = ((uintptr)bus->rxctl % DHD_SDALIGN))) - bus->rxctl += (DHD_SDALIGN - pad); - bus->rxctl -= firstread; - } - ASSERT(bus->rxctl >= bus->rxbuf); - rxbuf = bus->rxctl; - /* Read the entire frame */ - sdret = dhd_bcmsdh_recv_buf(bus, - bcmsdh_cur_sbwad(sdh), - SDIO_FUNC_2, - F2SYNC, rxbuf, rdlen, - NULL, NULL, NULL); - bus->f2rxdata++; - ASSERT(sdret != BCME_PENDING); - - - /* Control frame failures need retransmission */ - if (sdret < 0) { - DHD_ERROR(("%s: read %d control bytes failed: %d\n", - __FUNCTION__, rdlen, sdret)); - /* dhd.rx_ctlerrs is higher level */ - bus->rxc_errors++; - dhd_os_sdunlock_rxq(bus->dhd); - dhdsdio_rxfail(bus, TRUE, - (bus->bus == SPI_BUS) ? FALSE : TRUE); - continue; - } - } else { - /* Give up on data, request rtx of events */ - DHD_ERROR(("%s (nextlen): PKTGET failed: len %d rdlen %d " - "expected rxseq %d\n", - __FUNCTION__, len, rdlen, rxseq)); - /* Just go try again w/normal header read */ - dhd_os_sdunlock_rxq(bus->dhd); - continue; - } - } else { - if (bus->bus == SPI_BUS) - bus->usebufpool = TRUE; - - ASSERT(!PKTLINK(pkt)); - PKTALIGN(osh, pkt, rdlen, DHD_SDALIGN); - rxbuf = (uint8 *)PKTDATA(osh, pkt); - /* Read the entire frame */ - sdret = dhd_bcmsdh_recv_buf(bus, bcmsdh_cur_sbwad(sdh), - SDIO_FUNC_2, - F2SYNC, rxbuf, rdlen, - pkt, NULL, NULL); - bus->f2rxdata++; - ASSERT(sdret != BCME_PENDING); - - if (sdret < 0) { - DHD_ERROR(("%s (nextlen): read %d bytes failed: %d\n", - __FUNCTION__, rdlen, sdret)); - PKTFREE(bus->dhd->osh, pkt, FALSE); - bus->dhd->rx_errors++; - dhd_os_sdunlock_rxq(bus->dhd); - /* Force retry w/normal header read. Don't attemp NAK for - * gSPI - */ - dhdsdio_rxfail(bus, TRUE, - (bus->bus == SPI_BUS) ? FALSE : TRUE); - continue; - } - } - dhd_os_sdunlock_rxq(bus->dhd); - - /* Now check the header */ - bcopy(rxbuf, bus->rxhdr, SDPCM_HDRLEN); - - /* Extract hardware header fields */ - len = ltoh16_ua(bus->rxhdr); - check = ltoh16_ua(bus->rxhdr + sizeof(uint16)); - - /* All zeros means readahead info was bad */ - if (!(len|check)) { - DHD_INFO(("%s (nextlen): read zeros in HW header???\n", - __FUNCTION__)); - dhd_os_sdlock_rxq(bus->dhd); - PKTFREE2(); - dhd_os_sdunlock_rxq(bus->dhd); - GSPI_PR55150_BAILOUT; - continue; - } - - /* Validate check bytes */ - if ((uint16)~(len^check)) { - DHD_ERROR(("%s (nextlen): HW hdr error: nextlen/len/check" - " 0x%04x/0x%04x/0x%04x\n", __FUNCTION__, nextlen, - len, check)); - dhd_os_sdlock_rxq(bus->dhd); - PKTFREE2(); - dhd_os_sdunlock_rxq(bus->dhd); - bus->rx_badhdr++; - dhdsdio_rxfail(bus, FALSE, FALSE); - GSPI_PR55150_BAILOUT; - continue; - } - - /* Validate frame length */ - if (len < SDPCM_HDRLEN) { - DHD_ERROR(("%s (nextlen): HW hdr length invalid: %d\n", - __FUNCTION__, len)); - dhd_os_sdlock_rxq(bus->dhd); - PKTFREE2(); - dhd_os_sdunlock_rxq(bus->dhd); - GSPI_PR55150_BAILOUT; - continue; - } - - /* Check for consistency with readahead info */ - len_consistent = (nextlen != (ROUNDUP(len, 16) >> 4)); - if (len_consistent) { - /* Mismatch, force retry w/normal header (may be >4K) */ - DHD_ERROR(("%s (nextlen): mismatch, nextlen %d len %d rnd %d; " - "expected rxseq %d\n", - __FUNCTION__, nextlen, len, ROUNDUP(len, 16), rxseq)); - dhd_os_sdlock_rxq(bus->dhd); - PKTFREE2(); - dhd_os_sdunlock_rxq(bus->dhd); - dhdsdio_rxfail(bus, TRUE, (bus->bus == SPI_BUS) ? FALSE : TRUE); - GSPI_PR55150_BAILOUT; - continue; - } - - - /* Extract software header fields */ - chan = SDPCM_PACKET_CHANNEL(&bus->rxhdr[SDPCM_FRAMETAG_LEN]); - seq = SDPCM_PACKET_SEQUENCE(&bus->rxhdr[SDPCM_FRAMETAG_LEN]); - doff = SDPCM_DOFFSET_VALUE(&bus->rxhdr[SDPCM_FRAMETAG_LEN]); - txmax = SDPCM_WINDOW_VALUE(&bus->rxhdr[SDPCM_FRAMETAG_LEN]); - - bus->nextlen = - bus->rxhdr[SDPCM_FRAMETAG_LEN + SDPCM_NEXTLEN_OFFSET]; - if ((bus->nextlen << 4) > MAX_RX_DATASZ) { - DHD_INFO(("%s (nextlen): got frame w/nextlen too large" - " (%d), seq %d\n", __FUNCTION__, bus->nextlen, - seq)); - bus->nextlen = 0; - } - - bus->dhd->rx_readahead_cnt ++; - /* Handle Flow Control */ - fcbits = SDPCM_FCMASK_VALUE(&bus->rxhdr[SDPCM_FRAMETAG_LEN]); - - delta = 0; - if (~bus->flowcontrol & fcbits) { - bus->fc_xoff++; - delta = 1; - } - if (bus->flowcontrol & ~fcbits) { - bus->fc_xon++; - delta = 1; - } - - if (delta) { - bus->fc_rcvd++; - bus->flowcontrol = fcbits; - } - - /* Check and update sequence number */ - if (rxseq != seq) { - DHD_INFO(("%s (nextlen): rx_seq %d, expected %d\n", - __FUNCTION__, seq, rxseq)); - bus->rx_badseq++; - rxseq = seq; - } - - /* Check window for sanity */ - if ((uint8)(txmax - bus->tx_seq) > 0x40) { - DHD_ERROR(("%s: got unlikely tx max %d with tx_seq %d\n", - __FUNCTION__, txmax, bus->tx_seq)); - txmax = bus->tx_seq + 2; - } - bus->tx_max = txmax; - -#ifdef DHD_DEBUG - if (DHD_BYTES_ON() && DHD_DATA_ON()) { - prhex("Rx Data", rxbuf, len); - } else if (DHD_HDRS_ON()) { - prhex("RxHdr", bus->rxhdr, SDPCM_HDRLEN); - } -#endif - - if (chan == SDPCM_CONTROL_CHANNEL) { - if (bus->bus == SPI_BUS) { - dhdsdio_read_control(bus, rxbuf, len, doff); - if (bus->usebufpool) { - dhd_os_sdlock_rxq(bus->dhd); - PKTFREE(bus->dhd->osh, pkt, FALSE); - dhd_os_sdunlock_rxq(bus->dhd); - } - continue; - } else { - DHD_ERROR(("%s (nextlen): readahead on control" - " packet %d?\n", __FUNCTION__, seq)); - /* Force retry w/normal header read */ - bus->nextlen = 0; - dhdsdio_rxfail(bus, FALSE, TRUE); - dhd_os_sdlock_rxq(bus->dhd); - PKTFREE2(); - dhd_os_sdunlock_rxq(bus->dhd); - continue; - } - } - - if ((bus->bus == SPI_BUS) && !bus->usebufpool) { - DHD_ERROR(("Received %d bytes on %d channel. Running out of " - "rx pktbuf's or not yet malloced.\n", len, chan)); - continue; - } - - /* Validate data offset */ - if ((doff < SDPCM_HDRLEN) || (doff > len)) { - DHD_ERROR(("%s (nextlen): bad data offset %d: HW len %d min %d\n", - __FUNCTION__, doff, len, SDPCM_HDRLEN)); - dhd_os_sdlock_rxq(bus->dhd); - PKTFREE2(); - dhd_os_sdunlock_rxq(bus->dhd); - ASSERT(0); - dhdsdio_rxfail(bus, FALSE, FALSE); - continue; - } - - /* All done with this one -- now deliver the packet */ - goto deliver; - } - /* gSPI frames should not be handled in fractions */ - if (bus->bus == SPI_BUS) { - break; - } - - /* Read frame header (hardware and software) */ - sdret = dhd_bcmsdh_recv_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, F2SYNC, - bus->rxhdr, firstread, NULL, NULL, NULL); - bus->f2rxhdrs++; - ASSERT(sdret != BCME_PENDING); - - if (sdret < 0) { - DHD_ERROR(("%s: RXHEADER FAILED: %d\n", __FUNCTION__, sdret)); - bus->rx_hdrfail++; - dhdsdio_rxfail(bus, TRUE, TRUE); - continue; - } - -#ifdef DHD_DEBUG - if (DHD_BYTES_ON() || DHD_HDRS_ON()) { - prhex("RxHdr", bus->rxhdr, SDPCM_HDRLEN); - } -#endif - - /* Extract hardware header fields */ - len = ltoh16_ua(bus->rxhdr); - check = ltoh16_ua(bus->rxhdr + sizeof(uint16)); - - /* All zeros means no more frames */ - if (!(len|check)) { - *finished = TRUE; - break; - } - - /* Validate check bytes */ - if ((uint16)~(len^check)) { - DHD_ERROR(("%s: HW hdr error: len/check 0x%04x/0x%04x\n", - __FUNCTION__, len, check)); - bus->rx_badhdr++; - dhdsdio_rxfail(bus, FALSE, FALSE); - continue; - } - - /* Validate frame length */ - if (len < SDPCM_HDRLEN) { - DHD_ERROR(("%s: HW hdr length invalid: %d\n", __FUNCTION__, len)); - continue; - } - - /* Extract software header fields */ - chan = SDPCM_PACKET_CHANNEL(&bus->rxhdr[SDPCM_FRAMETAG_LEN]); - seq = SDPCM_PACKET_SEQUENCE(&bus->rxhdr[SDPCM_FRAMETAG_LEN]); - doff = SDPCM_DOFFSET_VALUE(&bus->rxhdr[SDPCM_FRAMETAG_LEN]); - txmax = SDPCM_WINDOW_VALUE(&bus->rxhdr[SDPCM_FRAMETAG_LEN]); - - /* Validate data offset */ - if ((doff < SDPCM_HDRLEN) || (doff > len)) { - DHD_ERROR(("%s: Bad data offset %d: HW len %d, min %d seq %d\n", - __FUNCTION__, doff, len, SDPCM_HDRLEN, seq)); - bus->rx_badhdr++; - ASSERT(0); - dhdsdio_rxfail(bus, FALSE, FALSE); - continue; - } - - /* Save the readahead length if there is one */ - bus->nextlen = bus->rxhdr[SDPCM_FRAMETAG_LEN + SDPCM_NEXTLEN_OFFSET]; - if ((bus->nextlen << 4) > MAX_RX_DATASZ) { - DHD_INFO(("%s (nextlen): got frame w/nextlen too large (%d), seq %d\n", - __FUNCTION__, bus->nextlen, seq)); - bus->nextlen = 0; - } - - /* Handle Flow Control */ - fcbits = SDPCM_FCMASK_VALUE(&bus->rxhdr[SDPCM_FRAMETAG_LEN]); - - delta = 0; - if (~bus->flowcontrol & fcbits) { - bus->fc_xoff++; - delta = 1; - } - if (bus->flowcontrol & ~fcbits) { - bus->fc_xon++; - delta = 1; - } - - if (delta) { - bus->fc_rcvd++; - bus->flowcontrol = fcbits; - } - - /* Check and update sequence number */ - if (rxseq != seq) { - DHD_INFO(("%s: rx_seq %d, expected %d\n", __FUNCTION__, seq, rxseq)); - bus->rx_badseq++; - rxseq = seq; - } - - /* Check window for sanity */ - if ((uint8)(txmax - bus->tx_seq) > 0x40) { - DHD_ERROR(("%s: got unlikely tx max %d with tx_seq %d\n", - __FUNCTION__, txmax, bus->tx_seq)); - txmax = bus->tx_seq + 2; - } - bus->tx_max = txmax; - - /* Call a separate function for control frames */ - if (chan == SDPCM_CONTROL_CHANNEL) { - dhdsdio_read_control(bus, bus->rxhdr, len, doff); - continue; - } - - ASSERT((chan == SDPCM_DATA_CHANNEL) || (chan == SDPCM_EVENT_CHANNEL) || - (chan == SDPCM_TEST_CHANNEL) || (chan == SDPCM_GLOM_CHANNEL)); - - /* Length to read */ - rdlen = (len > firstread) ? (len - firstread) : 0; - - /* May pad read to blocksize for efficiency */ - if (bus->roundup && bus->blocksize && (rdlen > bus->blocksize)) { - pad = bus->blocksize - (rdlen % bus->blocksize); - if ((pad <= bus->roundup) && (pad < bus->blocksize) && - ((rdlen + pad + firstread) < MAX_RX_DATASZ)) - rdlen += pad; - } else if (rdlen % DHD_SDALIGN) { - rdlen += DHD_SDALIGN - (rdlen % DHD_SDALIGN); - } - - /* Satisfy length-alignment requirements */ - if (forcealign && (rdlen & (ALIGNMENT - 1))) - rdlen = ROUNDUP(rdlen, ALIGNMENT); - - if ((rdlen + firstread) > MAX_RX_DATASZ) { - /* Too long -- skip this frame */ - DHD_ERROR(("%s: too long: len %d rdlen %d\n", __FUNCTION__, len, rdlen)); - bus->dhd->rx_errors++; bus->rx_toolong++; - dhdsdio_rxfail(bus, FALSE, FALSE); - continue; - } - - dhd_os_sdlock_rxq(bus->dhd); - if (!(pkt = PKTGET(osh, (rdlen + firstread + DHD_SDALIGN), FALSE))) { - /* Give up on data, request rtx of events */ - DHD_ERROR(("%s: PKTGET failed: rdlen %d chan %d\n", - __FUNCTION__, rdlen, chan)); - bus->dhd->rx_dropped++; - dhd_os_sdunlock_rxq(bus->dhd); - dhdsdio_rxfail(bus, FALSE, RETRYCHAN(chan)); - continue; - } - dhd_os_sdunlock_rxq(bus->dhd); - - ASSERT(!PKTLINK(pkt)); - - /* Leave room for what we already read, and align remainder */ - ASSERT(firstread < (PKTLEN(osh, pkt))); - PKTPULL(osh, pkt, firstread); - PKTALIGN(osh, pkt, rdlen, DHD_SDALIGN); - - /* Read the remaining frame data */ - sdret = dhd_bcmsdh_recv_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, F2SYNC, - ((uint8 *)PKTDATA(osh, pkt)), rdlen, pkt, NULL, NULL); - bus->f2rxdata++; - ASSERT(sdret != BCME_PENDING); - - if (sdret < 0) { - DHD_ERROR(("%s: read %d %s bytes failed: %d\n", __FUNCTION__, rdlen, - ((chan == SDPCM_EVENT_CHANNEL) ? "event" : - ((chan == SDPCM_DATA_CHANNEL) ? "data" : "test")), sdret)); - dhd_os_sdlock_rxq(bus->dhd); - PKTFREE(bus->dhd->osh, pkt, FALSE); - dhd_os_sdunlock_rxq(bus->dhd); - bus->dhd->rx_errors++; - dhdsdio_rxfail(bus, TRUE, RETRYCHAN(chan)); - continue; - } - - /* Copy the already-read portion */ - PKTPUSH(osh, pkt, firstread); - bcopy(bus->rxhdr, PKTDATA(osh, pkt), firstread); - -#ifdef DHD_DEBUG - if (DHD_BYTES_ON() && DHD_DATA_ON()) { - prhex("Rx Data", PKTDATA(osh, pkt), len); - } -#endif - -deliver: - /* Save superframe descriptor and allocate packet frame */ - if (chan == SDPCM_GLOM_CHANNEL) { - if (SDPCM_GLOMDESC(&bus->rxhdr[SDPCM_FRAMETAG_LEN])) { - DHD_GLOM(("%s: got glom descriptor, %d bytes:\n", - __FUNCTION__, len)); -#ifdef DHD_DEBUG - if (DHD_GLOM_ON()) { - prhex("Glom Data", PKTDATA(osh, pkt), len); - } -#endif - PKTSETLEN(osh, pkt, len); - ASSERT(doff == SDPCM_HDRLEN); - PKTPULL(osh, pkt, SDPCM_HDRLEN); - bus->glomd = pkt; - } else { - DHD_ERROR(("%s: glom superframe w/o descriptor!\n", __FUNCTION__)); - dhdsdio_rxfail(bus, FALSE, FALSE); - } - continue; - } - - /* Fill in packet len and prio, deliver upward */ - PKTSETLEN(osh, pkt, len); - PKTPULL(osh, pkt, doff); - -#ifdef SDTEST - /* Test channel packets are processed separately */ - if (chan == SDPCM_TEST_CHANNEL) { - dhdsdio_testrcv(bus, pkt, seq); - continue; - } -#endif /* SDTEST */ - - if (PKTLEN(osh, pkt) == 0) { - dhd_os_sdlock_rxq(bus->dhd); - PKTFREE(bus->dhd->osh, pkt, FALSE); - dhd_os_sdunlock_rxq(bus->dhd); - continue; - } else if (dhd_prot_hdrpull(bus->dhd, &ifidx, pkt) != 0) { - DHD_ERROR(("%s: rx protocol error\n", __FUNCTION__)); - dhd_os_sdlock_rxq(bus->dhd); - PKTFREE(bus->dhd->osh, pkt, FALSE); - dhd_os_sdunlock_rxq(bus->dhd); - bus->dhd->rx_errors++; - continue; - } - - - /* Unlock during rx call */ - dhd_os_sdunlock(bus->dhd); - dhd_rx_frame(bus->dhd, ifidx, pkt, 1); - dhd_os_sdlock(bus->dhd); - } - rxcount = maxframes - rxleft; -#ifdef DHD_DEBUG - /* Message if we hit the limit */ - if (!rxleft && !sdtest) - DHD_DATA(("%s: hit rx limit of %d frames\n", __FUNCTION__, maxframes)); - else -#endif /* DHD_DEBUG */ - DHD_DATA(("%s: processed %d frames\n", __FUNCTION__, rxcount)); - /* Back off rxseq if awaiting rtx, update rx_seq */ - if (bus->rxskip) - rxseq--; - bus->rx_seq = rxseq; - - return rxcount; -} - -static uint32 -dhdsdio_hostmail(dhd_bus_t *bus) -{ - sdpcmd_regs_t *regs = bus->regs; - uint32 intstatus = 0; - uint32 hmb_data; - uint8 fcbits; - uint retries = 0; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - /* Read mailbox data and ack that we did so */ - R_SDREG(hmb_data, ®s->tohostmailboxdata, retries); - if (retries <= retry_limit) - W_SDREG(SMB_INT_ACK, ®s->tosbmailbox, retries); - bus->f1regdata += 2; - - /* Dongle recomposed rx frames, accept them again */ - if (hmb_data & HMB_DATA_NAKHANDLED) { - DHD_INFO(("Dongle reports NAK handled, expect rtx of %d\n", bus->rx_seq)); - if (!bus->rxskip) { - DHD_ERROR(("%s: unexpected NAKHANDLED!\n", __FUNCTION__)); - } - bus->rxskip = FALSE; - intstatus |= I_HMB_FRAME_IND; - } - - /* - * DEVREADY does not occur with gSPI. - */ - if (hmb_data & (HMB_DATA_DEVREADY | HMB_DATA_FWREADY)) { - bus->sdpcm_ver = (hmb_data & HMB_DATA_VERSION_MASK) >> HMB_DATA_VERSION_SHIFT; - if (bus->sdpcm_ver != SDPCM_PROT_VERSION) - DHD_ERROR(("Version mismatch, dongle reports %d, expecting %d\n", - bus->sdpcm_ver, SDPCM_PROT_VERSION)); - else - DHD_INFO(("Dongle ready, protocol version %d\n", bus->sdpcm_ver)); - } - - /* - * Flow Control has been moved into the RX headers and this out of band - * method isn't used any more. Leae this here for possibly remaining backward - * compatible with older dongles - */ - if (hmb_data & HMB_DATA_FC) { - fcbits = (hmb_data & HMB_DATA_FCDATA_MASK) >> HMB_DATA_FCDATA_SHIFT; - - if (fcbits & ~bus->flowcontrol) - bus->fc_xoff++; - if (bus->flowcontrol & ~fcbits) - bus->fc_xon++; - - bus->fc_rcvd++; - bus->flowcontrol = fcbits; - } - - /* Shouldn't be any others */ - if (hmb_data & ~(HMB_DATA_DEVREADY | - HMB_DATA_NAKHANDLED | - HMB_DATA_FC | - HMB_DATA_FWREADY | - HMB_DATA_FCDATA_MASK | - HMB_DATA_VERSION_MASK)) { - DHD_ERROR(("Unknown mailbox data content: 0x%02x\n", hmb_data)); - } - - return intstatus; -} - -bool -dhdsdio_dpc(dhd_bus_t *bus) -{ - bcmsdh_info_t *sdh = bus->sdh; - sdpcmd_regs_t *regs = bus->regs; - uint32 intstatus, newstatus = 0; - uint retries = 0; - uint rxlimit = dhd_rxbound; /* Rx frames to read before resched */ - uint txlimit = dhd_txbound; /* Tx frames to send before resched */ - uint framecnt = 0; /* Temporary counter of tx/rx frames */ - bool rxdone = TRUE; /* Flag for no more read data */ - bool resched = FALSE; /* Flag indicating resched wanted */ - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - /* Start with leftover status bits */ - intstatus = bus->intstatus; - - dhd_os_sdlock(bus->dhd); - - /* If waiting for HTAVAIL, check status */ - if (bus->clkstate == CLK_PENDING) { - int err; - uint8 clkctl, devctl = 0; - -#ifdef DHD_DEBUG - /* Check for inconsistent device control */ - devctl = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, &err); - if (err) { - DHD_ERROR(("%s: error reading DEVCTL: %d\n", __FUNCTION__, err)); - bus->dhd->busstate = DHD_BUS_DOWN; - } else { - ASSERT(devctl & SBSDIO_DEVCTL_CA_INT_ONLY); - } -#endif /* DHD_DEBUG */ - - /* Read CSR, if clock on switch to AVAIL, else ignore */ - clkctl = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, &err); - if (err) { - DHD_ERROR(("%s: error reading CSR: %d\n", __FUNCTION__, err)); - bus->dhd->busstate = DHD_BUS_DOWN; - } - - DHD_INFO(("DPC: PENDING, devctl 0x%02x clkctl 0x%02x\n", devctl, clkctl)); - - if (SBSDIO_HTAV(clkctl)) { - devctl = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, &err); - if (err) { - DHD_ERROR(("%s: error reading DEVCTL: %d\n", - __FUNCTION__, err)); - bus->dhd->busstate = DHD_BUS_DOWN; - } - devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, devctl, &err); - if (err) { - DHD_ERROR(("%s: error writing DEVCTL: %d\n", - __FUNCTION__, err)); - bus->dhd->busstate = DHD_BUS_DOWN; - } - bus->clkstate = CLK_AVAIL; - } else { - goto clkwait; - } - } - - BUS_WAKE(bus); - - /* Make sure backplane clock is on */ - dhdsdio_clkctl(bus, CLK_AVAIL, TRUE); - if (bus->clkstate == CLK_PENDING) - goto clkwait; - - /* Pending interrupt indicates new device status */ - if (bus->ipend) { - bus->ipend = FALSE; - R_SDREG(newstatus, ®s->intstatus, retries); - bus->f1regdata++; - if (bcmsdh_regfail(bus->sdh)) - newstatus = 0; - newstatus &= bus->hostintmask; - bus->fcstate = !!(newstatus & I_HMB_FC_STATE); - if (newstatus) { - W_SDREG(newstatus, ®s->intstatus, retries); - bus->f1regdata++; - } - } - - /* Merge new bits with previous */ - intstatus |= newstatus; - bus->intstatus = 0; - - /* Handle flow-control change: read new state in case our ack - * crossed another change interrupt. If change still set, assume - * FC ON for safety, let next loop through do the debounce. - */ - if (intstatus & I_HMB_FC_CHANGE) { - intstatus &= ~I_HMB_FC_CHANGE; - W_SDREG(I_HMB_FC_CHANGE, ®s->intstatus, retries); - R_SDREG(newstatus, ®s->intstatus, retries); - bus->f1regdata += 2; - bus->fcstate = !!(newstatus & (I_HMB_FC_STATE | I_HMB_FC_CHANGE)); - intstatus |= (newstatus & bus->hostintmask); - } - - /* Handle host mailbox indication */ - if (intstatus & I_HMB_HOST_INT) { - intstatus &= ~I_HMB_HOST_INT; - intstatus |= dhdsdio_hostmail(bus); - } - - /* Generally don't ask for these, can get CRC errors... */ - if (intstatus & I_WR_OOSYNC) { - DHD_ERROR(("Dongle reports WR_OOSYNC\n")); - intstatus &= ~I_WR_OOSYNC; - } - - if (intstatus & I_RD_OOSYNC) { - DHD_ERROR(("Dongle reports RD_OOSYNC\n")); - intstatus &= ~I_RD_OOSYNC; - } - - if (intstatus & I_SBINT) { - DHD_ERROR(("Dongle reports SBINT\n")); - intstatus &= ~I_SBINT; - } - - /* Would be active due to wake-wlan in gSPI */ - if (intstatus & I_CHIPACTIVE) { - DHD_INFO(("Dongle reports CHIPACTIVE\n")); - intstatus &= ~I_CHIPACTIVE; - } - - /* Ignore frame indications if rxskip is set */ - if (bus->rxskip) - intstatus &= ~I_HMB_FRAME_IND; - - /* On frame indication, read available frames */ - if (PKT_AVAILABLE()) { - framecnt = dhdsdio_readframes(bus, rxlimit, &rxdone); - if (rxdone || bus->rxskip) - intstatus &= ~I_HMB_FRAME_IND; - rxlimit -= MIN(framecnt, rxlimit); - } - - /* Keep still-pending events for next scheduling */ - bus->intstatus = intstatus; - -clkwait: - /* Re-enable interrupts to detect new device events (mailbox, rx frame) - * or clock availability. (Allows tx loop to check ipend if desired.) - * (Unless register access seems hosed, as we may not be able to ACK...) - */ - if (bus->intr && bus->intdis && !bcmsdh_regfail(sdh)) { - DHD_INTR(("%s: enable SDIO interrupts, rxdone %d framecnt %d\n", - __FUNCTION__, rxdone, framecnt)); - bus->intdis = FALSE; -#if defined(OOB_INTR_ONLY) - bcmsdh_oob_intr_set(1); -#endif /* (OOB_INTR_ONLY) */ - bcmsdh_intr_enable(sdh); - } - - if (DATAOK(bus) && bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL)) { - int ret, i; - - ret = dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, F2SYNC, - (uint8 *)bus->ctrl_frame_buf, (uint32)bus->ctrl_frame_len, - NULL, NULL, NULL); - ASSERT(ret != BCME_PENDING); - - if (ret < 0) { - /* On failure, abort the command and terminate the frame */ - DHD_INFO(("%s: sdio error %d, abort command and terminate frame.\n", - __FUNCTION__, ret)); - bus->tx_sderrs++; - - bcmsdh_abort(sdh, SDIO_FUNC_2); - - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL, - SFC_WF_TERM, NULL); - bus->f1regdata++; - - for (i = 0; i < 3; i++) { - uint8 hi, lo; - hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, - SBSDIO_FUNC1_WFRAMEBCHI, NULL); - lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, - SBSDIO_FUNC1_WFRAMEBCLO, NULL); - bus->f1regdata += 2; - if ((hi == 0) && (lo == 0)) - break; - } - - } - if (ret == 0) { - bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP; - } - - printf("Return_dpc value is : %d\n", ret); - bus->ctrl_frame_stat = FALSE; - dhd_wait_event_wakeup(bus->dhd); - } - /* Send queued frames (limit 1 if rx may still be pending) */ - else if ((bus->clkstate == CLK_AVAIL) && !bus->fcstate && - pktq_mlen(&bus->txq, ~bus->flowcontrol) && txlimit && DATAOK(bus)) { - framecnt = rxdone ? txlimit : MIN(txlimit, dhd_txminmax); - framecnt = dhdsdio_sendfromq(bus, framecnt); - txlimit -= framecnt; - } - - /* Resched if events or tx frames are pending, else await next interrupt */ - /* On failed register access, all bets are off: no resched or interrupts */ - if ((bus->dhd->busstate == DHD_BUS_DOWN) || bcmsdh_regfail(sdh)) { - DHD_ERROR(("%s: failed backplane access over SDIO, halting operation %d \n", - __FUNCTION__, bcmsdh_regfail(sdh))); - bus->dhd->busstate = DHD_BUS_DOWN; - bus->intstatus = 0; - } else if (bus->clkstate == CLK_PENDING) { - DHD_INFO(("%s: rescheduled due to CLK_PENDING awaiting \ - I_CHIPACTIVE interrupt", __FUNCTION__)); - resched = TRUE; - } else if (bus->intstatus || bus->ipend || - (!bus->fcstate && pktq_mlen(&bus->txq, ~bus->flowcontrol) && DATAOK(bus)) || - PKT_AVAILABLE()) { /* Read multiple frames */ - resched = TRUE; - } - - - bus->dpc_sched = resched; - - /* If we're done for now, turn off clock request. */ - if ((bus->clkstate != CLK_PENDING) && bus->idletime == DHD_IDLE_IMMEDIATE) { - bus->activity = FALSE; - dhdsdio_clkctl(bus, CLK_NONE, FALSE); - } - - dhd_os_sdunlock(bus->dhd); - - return resched; -} - -bool -dhd_bus_dpc(struct dhd_bus *bus) -{ - bool resched; - - /* Call the DPC directly. */ - DHD_TRACE(("Calling dhdsdio_dpc() from %s\n", __FUNCTION__)); - resched = dhdsdio_dpc(bus); - - return resched; -} - -void -dhdsdio_isr(void *arg) -{ - dhd_bus_t *bus = (dhd_bus_t*)arg; - bcmsdh_info_t *sdh; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - if (!bus) { - DHD_ERROR(("%s : bus is null pointer , exit \n", __FUNCTION__)); - return; - } - sdh = bus->sdh; - - if (bus->dhd->busstate == DHD_BUS_DOWN) { - DHD_ERROR(("%s : bus is down. we have nothing to do\n", __FUNCTION__)); - return; - } - /* Count the interrupt call */ - bus->intrcount++; - bus->ipend = TRUE; - - /* Shouldn't get this interrupt if we're sleeping? */ - if (bus->sleeping) { - DHD_ERROR(("INTERRUPT WHILE SLEEPING??\n")); - return; - } - - /* Disable additional interrupts (is this needed now)? */ - if (bus->intr) { - DHD_INTR(("%s: disable SDIO interrupts\n", __FUNCTION__)); - } else { - DHD_ERROR(("dhdsdio_isr() w/o interrupt configured!\n")); - } - - bcmsdh_intr_disable(sdh); - bus->intdis = TRUE; - -#if defined(SDIO_ISR_THREAD) - DHD_TRACE(("Calling dhdsdio_dpc() from %s\n", __FUNCTION__)); - dhd_os_wake_lock(bus->dhd); - while (dhdsdio_dpc(bus)); - dhd_os_wake_unlock(bus->dhd); -#else - bus->dpc_sched = TRUE; - dhd_sched_dpc(bus->dhd); -#endif - -} - -#ifdef SDTEST -static void -dhdsdio_pktgen_init(dhd_bus_t *bus) -{ - /* Default to specified length, or full range */ - if (dhd_pktgen_len) { - bus->pktgen_maxlen = MIN(dhd_pktgen_len, MAX_PKTGEN_LEN); - bus->pktgen_minlen = bus->pktgen_maxlen; - } else { - bus->pktgen_maxlen = MAX_PKTGEN_LEN; - bus->pktgen_minlen = 0; - } - bus->pktgen_len = (uint16)bus->pktgen_minlen; - - /* Default to per-watchdog burst with 10s print time */ - bus->pktgen_freq = 1; - bus->pktgen_print = 10000 / dhd_watchdog_ms; - bus->pktgen_count = (dhd_pktgen * dhd_watchdog_ms + 999) / 1000; - - /* Default to echo mode */ - bus->pktgen_mode = DHD_PKTGEN_ECHO; - bus->pktgen_stop = 1; -} - -static void -dhdsdio_pktgen(dhd_bus_t *bus) -{ - void *pkt; - uint8 *data; - uint pktcount; - uint fillbyte; - osl_t *osh = bus->dhd->osh; - uint16 len; - - /* Display current count if appropriate */ - if (bus->pktgen_print && (++bus->pktgen_ptick >= bus->pktgen_print)) { - bus->pktgen_ptick = 0; - printf("%s: send attempts %d rcvd %d\n", - __FUNCTION__, bus->pktgen_sent, bus->pktgen_rcvd); - } - - /* For recv mode, just make sure dongle has started sending */ - if (bus->pktgen_mode == DHD_PKTGEN_RECV) { - if (!bus->pktgen_rcvd) - dhdsdio_sdtest_set(bus, TRUE); - return; - } - - /* Otherwise, generate or request the specified number of packets */ - for (pktcount = 0; pktcount < bus->pktgen_count; pktcount++) { - /* Stop if total has been reached */ - if (bus->pktgen_total && (bus->pktgen_sent >= bus->pktgen_total)) { - bus->pktgen_count = 0; - break; - } - - /* Allocate an appropriate-sized packet */ - len = bus->pktgen_len; - if (!(pkt = PKTGET(osh, (len + SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN), - TRUE))) {; - DHD_ERROR(("%s: PKTGET failed!\n", __FUNCTION__)); - break; - } - PKTALIGN(osh, pkt, (len + SDPCM_HDRLEN + SDPCM_TEST_HDRLEN), DHD_SDALIGN); - data = (uint8*)PKTDATA(osh, pkt) + SDPCM_HDRLEN; - - /* Write test header cmd and extra based on mode */ - switch (bus->pktgen_mode) { - case DHD_PKTGEN_ECHO: - *data++ = SDPCM_TEST_ECHOREQ; - *data++ = (uint8)bus->pktgen_sent; - break; - - case DHD_PKTGEN_SEND: - *data++ = SDPCM_TEST_DISCARD; - *data++ = (uint8)bus->pktgen_sent; - break; - - case DHD_PKTGEN_RXBURST: - *data++ = SDPCM_TEST_BURST; - *data++ = (uint8)bus->pktgen_count; - break; - - default: - DHD_ERROR(("Unrecognized pktgen mode %d\n", bus->pktgen_mode)); - PKTFREE(osh, pkt, TRUE); - bus->pktgen_count = 0; - return; - } - - /* Write test header length field */ - *data++ = (len >> 0); - *data++ = (len >> 8); - - /* Then fill in the remainder -- N/A for burst, but who cares... */ - for (fillbyte = 0; fillbyte < len; fillbyte++) - *data++ = SDPCM_TEST_FILL(fillbyte, (uint8)bus->pktgen_sent); - -#ifdef DHD_DEBUG - if (DHD_BYTES_ON() && DHD_DATA_ON()) { - data = (uint8*)PKTDATA(osh, pkt) + SDPCM_HDRLEN; - prhex("dhdsdio_pktgen: Tx Data", data, PKTLEN(osh, pkt) - SDPCM_HDRLEN); - } -#endif - - /* Send it */ - if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, TRUE)) { - bus->pktgen_fail++; - if (bus->pktgen_stop && bus->pktgen_stop == bus->pktgen_fail) - bus->pktgen_count = 0; - } - bus->pktgen_sent++; - - /* Bump length if not fixed, wrap at max */ - if (++bus->pktgen_len > bus->pktgen_maxlen) - bus->pktgen_len = (uint16)bus->pktgen_minlen; - - /* Special case for burst mode: just send one request! */ - if (bus->pktgen_mode == DHD_PKTGEN_RXBURST) - break; - } -} - -static void -dhdsdio_sdtest_set(dhd_bus_t *bus, bool start) -{ - void *pkt; - uint8 *data; - osl_t *osh = bus->dhd->osh; - - /* Allocate the packet */ - if (!(pkt = PKTGET(osh, SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN, TRUE))) { - DHD_ERROR(("%s: PKTGET failed!\n", __FUNCTION__)); - return; - } - PKTALIGN(osh, pkt, (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN), DHD_SDALIGN); - data = (uint8*)PKTDATA(osh, pkt) + SDPCM_HDRLEN; - - /* Fill in the test header */ - *data++ = SDPCM_TEST_SEND; - *data++ = start; - *data++ = (bus->pktgen_maxlen >> 0); - *data++ = (bus->pktgen_maxlen >> 8); - - /* Send it */ - if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, TRUE)) - bus->pktgen_fail++; -} - - -static void -dhdsdio_testrcv(dhd_bus_t *bus, void *pkt, uint seq) -{ - osl_t *osh = bus->dhd->osh; - uint8 *data; - uint pktlen; - - uint8 cmd; - uint8 extra; - uint16 len; - uint16 offset; - - /* Check for min length */ - if ((pktlen = PKTLEN(osh, pkt)) < SDPCM_TEST_HDRLEN) { - DHD_ERROR(("dhdsdio_restrcv: toss runt frame, pktlen %d\n", pktlen)); - PKTFREE(osh, pkt, FALSE); - return; - } - - /* Extract header fields */ - data = PKTDATA(osh, pkt); - cmd = *data++; - extra = *data++; - len = *data++; len += *data++ << 8; - - /* Check length for relevant commands */ - if (cmd == SDPCM_TEST_DISCARD || cmd == SDPCM_TEST_ECHOREQ || cmd == SDPCM_TEST_ECHORSP) { - if (pktlen != len + SDPCM_TEST_HDRLEN) { - DHD_ERROR(("dhdsdio_testrcv: frame length mismatch, pktlen %d seq %d" - " cmd %d extra %d len %d\n", pktlen, seq, cmd, extra, len)); - PKTFREE(osh, pkt, FALSE); - return; - } - } - - /* Process as per command */ - switch (cmd) { - case SDPCM_TEST_ECHOREQ: - /* Rx->Tx turnaround ok (even on NDIS w/current implementation) */ - *(uint8 *)(PKTDATA(osh, pkt)) = SDPCM_TEST_ECHORSP; - if (dhdsdio_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, TRUE) == 0) { - bus->pktgen_sent++; - } else { - bus->pktgen_fail++; - PKTFREE(osh, pkt, FALSE); - } - bus->pktgen_rcvd++; - break; - - case SDPCM_TEST_ECHORSP: - if (bus->ext_loop) { - PKTFREE(osh, pkt, FALSE); - bus->pktgen_rcvd++; - break; - } - - for (offset = 0; offset < len; offset++, data++) { - if (*data != SDPCM_TEST_FILL(offset, extra)) { - DHD_ERROR(("dhdsdio_testrcv: echo data mismatch: " - "offset %d (len %d) expect 0x%02x rcvd 0x%02x\n", - offset, len, SDPCM_TEST_FILL(offset, extra), *data)); - break; - } - } - PKTFREE(osh, pkt, FALSE); - bus->pktgen_rcvd++; - break; - - case SDPCM_TEST_DISCARD: - PKTFREE(osh, pkt, FALSE); - bus->pktgen_rcvd++; - break; - - case SDPCM_TEST_BURST: - case SDPCM_TEST_SEND: - default: - DHD_INFO(("dhdsdio_testrcv: unsupported or unknown command, pktlen %d seq %d" - " cmd %d extra %d len %d\n", pktlen, seq, cmd, extra, len)); - PKTFREE(osh, pkt, FALSE); - break; - } - - /* For recv mode, stop at limie (and tell dongle to stop sending) */ - if (bus->pktgen_mode == DHD_PKTGEN_RECV) { - if (bus->pktgen_total && (bus->pktgen_rcvd >= bus->pktgen_total)) { - bus->pktgen_count = 0; - dhdsdio_sdtest_set(bus, FALSE); - } - } -} -#endif /* SDTEST */ - -extern bool -dhd_bus_watchdog(dhd_pub_t *dhdp) -{ - dhd_bus_t *bus; - - DHD_TIMER(("%s: Enter\n", __FUNCTION__)); - - bus = dhdp->bus; - - if (bus->dhd->dongle_reset) - return FALSE; - - /* Ignore the timer if simulating bus down */ - if (bus->sleeping) - return FALSE; - - /* Poll period: check device if appropriate. */ - if (bus->poll && (++bus->polltick >= bus->pollrate)) { - uint32 intstatus = 0; - - /* Reset poll tick */ - bus->polltick = 0; - - /* Check device if no interrupts */ - if (!bus->intr || (bus->intrcount == bus->lastintrs)) { - - if (!bus->dpc_sched) { - uint8 devpend; - devpend = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_0, - SDIOD_CCCR_INTPEND, NULL); - intstatus = devpend & (INTR_STATUS_FUNC1 | INTR_STATUS_FUNC2); - } - - /* If there is something, make like the ISR and schedule the DPC */ - if (intstatus) { - bus->pollcnt++; - bus->ipend = TRUE; - if (bus->intr) { - bcmsdh_intr_disable(bus->sdh); - } - bus->dpc_sched = TRUE; - dhd_sched_dpc(bus->dhd); - - } - } - - /* Update interrupt tracking */ - bus->lastintrs = bus->intrcount; - } - -#ifdef DHD_DEBUG - /* Poll for console output periodically */ - if (dhdp->busstate == DHD_BUS_DATA && dhd_console_ms != 0) { - bus->console.count += dhd_watchdog_ms; - if (bus->console.count >= dhd_console_ms) { - bus->console.count -= dhd_console_ms; - /* Make sure backplane clock is on */ - dhdsdio_clkctl(bus, CLK_AVAIL, FALSE); - if (dhdsdio_readconsole(bus) < 0) - dhd_console_ms = 0; /* On error, stop trying */ - } - } -#endif /* DHD_DEBUG */ - -#ifdef SDTEST - /* Generate packets if configured */ - if (bus->pktgen_count && (++bus->pktgen_tick >= bus->pktgen_freq)) { - /* Make sure backplane clock is on */ - dhdsdio_clkctl(bus, CLK_AVAIL, FALSE); - bus->pktgen_tick = 0; - dhdsdio_pktgen(bus); - } -#endif - - /* On idle timeout clear activity flag and/or turn off clock */ - if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) { - if (++bus->idlecount >= bus->idletime) { - bus->idlecount = 0; - if (bus->activity) { - bus->activity = FALSE; - dhdsdio_clkctl(bus, CLK_NONE, FALSE); - } - } - } - - return bus->ipend; -} - -#ifdef DHD_DEBUG -extern int -dhd_bus_console_in(dhd_pub_t *dhdp, uchar *msg, uint msglen) -{ - dhd_bus_t *bus = dhdp->bus; - uint32 addr, val; - int rv; - void *pkt; - - /* Address could be zero if CONSOLE := 0 in dongle Makefile */ - if (bus->console_addr == 0) - return BCME_UNSUPPORTED; - - /* Exclusive bus access */ - dhd_os_sdlock(bus->dhd); - - /* Don't allow input if dongle is in reset */ - if (bus->dhd->dongle_reset) { - dhd_os_sdunlock(bus->dhd); - return BCME_NOTREADY; - } - - /* Request clock to allow SDIO accesses */ - BUS_WAKE(bus); - /* No pend allowed since txpkt is called later, ht clk has to be on */ - dhdsdio_clkctl(bus, CLK_AVAIL, FALSE); - - /* Zero cbuf_index */ - addr = bus->console_addr + OFFSETOF(hndrte_cons_t, cbuf_idx); - val = htol32(0); - if ((rv = dhdsdio_membytes(bus, TRUE, addr, (uint8 *)&val, sizeof(val))) < 0) - goto done; - - /* Write message into cbuf */ - addr = bus->console_addr + OFFSETOF(hndrte_cons_t, cbuf); - if ((rv = dhdsdio_membytes(bus, TRUE, addr, (uint8 *)msg, msglen)) < 0) - goto done; - - /* Write length into vcons_in */ - addr = bus->console_addr + OFFSETOF(hndrte_cons_t, vcons_in); - val = htol32(msglen); - if ((rv = dhdsdio_membytes(bus, TRUE, addr, (uint8 *)&val, sizeof(val))) < 0) - goto done; - - /* Bump dongle by sending an empty event pkt. - * sdpcm_sendup (RX) checks for virtual console input. - */ - if (((pkt = PKTGET(bus->dhd->osh, 4 + SDPCM_RESERVE, TRUE)) != NULL) && - bus->clkstate == CLK_AVAIL) - dhdsdio_txpkt(bus, pkt, SDPCM_EVENT_CHANNEL, TRUE); - -done: - if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) { - bus->activity = FALSE; - dhdsdio_clkctl(bus, CLK_NONE, TRUE); - } - - dhd_os_sdunlock(bus->dhd); - - return rv; -} -#endif /* DHD_DEBUG */ - -#ifdef DHD_DEBUG -static void -dhd_dump_cis(uint fn, uint8 *cis) -{ - uint byte, tag, tdata; - DHD_INFO(("Function %d CIS:\n", fn)); - - for (tdata = byte = 0; byte < SBSDIO_CIS_SIZE_LIMIT; byte++) { - if ((byte % 16) == 0) - DHD_INFO((" ")); - DHD_INFO(("%02x ", cis[byte])); - if ((byte % 16) == 15) - DHD_INFO(("\n")); - if (!tdata--) { - tag = cis[byte]; - if (tag == 0xff) - break; - else if (!tag) - tdata = 0; - else if ((byte + 1) < SBSDIO_CIS_SIZE_LIMIT) - tdata = cis[byte + 1] + 1; - else - DHD_INFO(("]")); - } - } - if ((byte % 16) != 15) - DHD_INFO(("\n")); -} -#endif /* DHD_DEBUG */ - -static bool -dhdsdio_chipmatch(uint16 chipid) -{ - if (chipid == BCM4325_CHIP_ID) - return TRUE; - if (chipid == BCM4329_CHIP_ID) - return TRUE; - if (chipid == BCM4315_CHIP_ID) - return TRUE; - if (chipid == BCM4319_CHIP_ID) - return TRUE; - return FALSE; -} - -static void * -dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot, - uint16 func, uint bustype, void *regsva, osl_t * osh, void *sdh) -{ - int ret; - dhd_bus_t *bus; - - /* Init global variables at run-time, not as part of the declaration. - * This is required to support init/de-init of the driver. Initialization - * of globals as part of the declaration results in non-deterministic - * behavior since the value of the globals may be different on the - * first time that the driver is initialized vs subsequent initializations. - */ - dhd_txbound = DHD_TXBOUND; - dhd_rxbound = DHD_RXBOUND; - dhd_alignctl = TRUE; - sd1idle = TRUE; - dhd_readahead = TRUE; - retrydata = FALSE; - dhd_doflow = FALSE; - dhd_dongle_memsize = 0; - dhd_txminmax = DHD_TXMINMAX; - - forcealign = TRUE; - - - dhd_common_init(); - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - DHD_INFO(("%s: venid 0x%04x devid 0x%04x\n", __FUNCTION__, venid, devid)); - - /* We make assumptions about address window mappings */ - ASSERT((uintptr)regsva == SI_ENUM_BASE); - - /* BCMSDH passes venid and devid based on CIS parsing -- but low-power start - * means early parse could fail, so here we should get either an ID - * we recognize OR (-1) indicating we must request power first. - */ - /* Check the Vendor ID */ - switch (venid) { - case 0x0000: - case VENDOR_BROADCOM: - break; - default: - DHD_ERROR(("%s: unknown vendor: 0x%04x\n", - __FUNCTION__, venid)); - return NULL; - } - - /* Check the Device ID and make sure it's one that we support */ - switch (devid) { - case BCM4325_D11DUAL_ID: /* 4325 802.11a/g id */ - case BCM4325_D11G_ID: /* 4325 802.11g 2.4Ghz band id */ - case BCM4325_D11A_ID: /* 4325 802.11a 5Ghz band id */ - DHD_INFO(("%s: found 4325 Dongle\n", __FUNCTION__)); - break; - case BCM4329_D11NDUAL_ID: /* 4329 802.11n dualband device */ - case BCM4329_D11N2G_ID: /* 4329 802.11n 2.4G device */ - case BCM4329_D11N5G_ID: /* 4329 802.11n 5G device */ - case 0x4329: - DHD_INFO(("%s: found 4329 Dongle\n", __FUNCTION__)); - break; - case BCM4315_D11DUAL_ID: /* 4315 802.11a/g id */ - case BCM4315_D11G_ID: /* 4315 802.11g id */ - case BCM4315_D11A_ID: /* 4315 802.11a id */ - DHD_INFO(("%s: found 4315 Dongle\n", __FUNCTION__)); - break; - case BCM4319_D11N_ID: /* 4319 802.11n id */ - case BCM4319_D11N2G_ID: /* 4319 802.11n2g id */ - case BCM4319_D11N5G_ID: /* 4319 802.11n5g id */ - DHD_INFO(("%s: found 4319 Dongle\n", __FUNCTION__)); - break; - case 0: - DHD_INFO(("%s: allow device id 0, will check chip internals\n", - __FUNCTION__)); - break; - - default: - DHD_ERROR(("%s: skipping 0x%04x/0x%04x, not a dongle\n", - __FUNCTION__, venid, devid)); - return NULL; - } - - if (osh == NULL) { - /* Ask the OS interface part for an OSL handle */ - if (!(osh = dhd_osl_attach(sdh, DHD_BUS))) { - DHD_ERROR(("%s: osl_attach failed!\n", __FUNCTION__)); - return NULL; - } - } - - /* Allocate private bus interface state */ - if (!(bus = MALLOC(osh, sizeof(dhd_bus_t)))) { - DHD_ERROR(("%s: MALLOC of dhd_bus_t failed\n", __FUNCTION__)); - goto fail; - } - bzero(bus, sizeof(dhd_bus_t)); - bus->sdh = sdh; - bus->cl_devid = (uint16)devid; - bus->bus = DHD_BUS; - bus->tx_seq = SDPCM_SEQUENCE_WRAP - 1; - bus->usebufpool = FALSE; /* Use bufpool if allocated, else use locally malloced rxbuf */ - - /* attempt to attach to the dongle */ - if (!(dhdsdio_probe_attach(bus, osh, sdh, regsva, devid))) { - DHD_ERROR(("%s: dhdsdio_probe_attach failed\n", __FUNCTION__)); - goto fail; - } - - /* Attach to the dhd/OS/network interface */ - if (!(bus->dhd = dhd_attach(osh, bus, SDPCM_RESERVE))) { - DHD_ERROR(("%s: dhd_attach failed\n", __FUNCTION__)); - goto fail; - } - - /* Allocate buffers */ - if (!(dhdsdio_probe_malloc(bus, osh, sdh))) { - DHD_ERROR(("%s: dhdsdio_probe_malloc failed\n", __FUNCTION__)); - goto fail; - } - - if (!(dhdsdio_probe_init(bus, osh, sdh))) { - DHD_ERROR(("%s: dhdsdio_probe_init failed\n", __FUNCTION__)); - goto fail; - } - - /* Register interrupt callback, but mask it (not operational yet). */ - DHD_INTR(("%s: disable SDIO interrupts (not interested yet)\n", __FUNCTION__)); - bcmsdh_intr_disable(sdh); - if ((ret = bcmsdh_intr_reg(sdh, dhdsdio_isr, bus)) != 0) { - DHD_ERROR(("%s: FAILED: bcmsdh_intr_reg returned %d\n", - __FUNCTION__, ret)); - goto fail; - } - DHD_INTR(("%s: registered SDIO interrupt function ok\n", __FUNCTION__)); - - DHD_INFO(("%s: completed!!\n", __FUNCTION__)); - - - /* if firmware path present try to download and bring up bus */ - if ((ret = dhd_bus_start(bus->dhd)) != 0) { -#if 1 - DHD_ERROR(("%s: failed\n", __FUNCTION__)); - goto fail; -#else - if (ret == BCME_NOTUP) { - DHD_ERROR(("%s: dongle is not responding\n", __FUNCTION__)); - goto fail; - } -#endif - } - /* Ok, have the per-port tell the stack we're open for business */ - if (dhd_net_attach(bus->dhd, 0) != 0) { - DHD_ERROR(("%s: Net attach failed!!\n", __FUNCTION__)); - goto fail; - } - - return bus; - -fail: - dhdsdio_release(bus, osh); - return NULL; -} - - -static bool -dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva, - uint16 devid) -{ - uint8 clkctl = 0; - int err = 0; - - bus->alp_only = TRUE; - - /* Return the window to backplane enumeration space for core access */ - if (dhdsdio_set_siaddr_window(bus, SI_ENUM_BASE)) { - DHD_ERROR(("%s: FAILED to return to SI_ENUM_BASE\n", __FUNCTION__)); - } - -#ifdef DHD_DEBUG - printf("F1 signature read @0x18000000=0x%4x\n", - bcmsdh_reg_read(bus->sdh, SI_ENUM_BASE, 4)); - - -#endif /* DHD_DEBUG */ - - - /* Force PLL off until si_attach() programs PLL control regs */ - - - - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, DHD_INIT_CLKCTL1, &err); - if (!err) - clkctl = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, &err); - - if (err || ((clkctl & ~SBSDIO_AVBITS) != DHD_INIT_CLKCTL1)) { - DHD_ERROR(("dhdsdio_probe: ChipClkCSR access: err %d wrote 0x%02x read 0x%02x\n", - err, DHD_INIT_CLKCTL1, clkctl)); - goto fail; - } - - -#ifdef DHD_DEBUG - if (DHD_INFO_ON()) { - uint fn, numfn; - uint8 *cis[SDIOD_MAX_IOFUNCS]; - int err = 0; - - numfn = bcmsdh_query_iofnum(sdh); - ASSERT(numfn <= SDIOD_MAX_IOFUNCS); - - /* Make sure ALP is available before trying to read CIS */ - SPINWAIT(((clkctl = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, - SBSDIO_FUNC1_CHIPCLKCSR, NULL)), - !SBSDIO_ALPAV(clkctl)), PMU_MAX_TRANSITION_DLY); - - /* Now request ALP be put on the bus */ - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, - DHD_INIT_CLKCTL2, &err); - OSL_DELAY(65); - - for (fn = 0; fn <= numfn; fn++) { - if (!(cis[fn] = MALLOC(osh, SBSDIO_CIS_SIZE_LIMIT))) { - DHD_INFO(("dhdsdio_probe: fn %d cis malloc failed\n", fn)); - break; - } - bzero(cis[fn], SBSDIO_CIS_SIZE_LIMIT); - - if ((err = bcmsdh_cis_read(sdh, fn, cis[fn], SBSDIO_CIS_SIZE_LIMIT))) { - DHD_INFO(("dhdsdio_probe: fn %d cis read err %d\n", fn, err)); - MFREE(osh, cis[fn], SBSDIO_CIS_SIZE_LIMIT); - break; - } - dhd_dump_cis(fn, cis[fn]); - } - - while (fn-- > 0) { - ASSERT(cis[fn]); - MFREE(osh, cis[fn], SBSDIO_CIS_SIZE_LIMIT); - } - - if (err) { - DHD_ERROR(("dhdsdio_probe: failure reading or parsing CIS\n")); - goto fail; - } - } -#endif /* DHD_DEBUG */ - - /* si_attach() will provide an SI handle and scan the backplane */ - if (!(bus->sih = si_attach((uint)devid, osh, regsva, DHD_BUS, sdh, - &bus->vars, &bus->varsz))) { - DHD_ERROR(("%s: si_attach failed!\n", __FUNCTION__)); - goto fail; - } - - bcmsdh_chipinfo(sdh, bus->sih->chip, bus->sih->chiprev); - - if (!dhdsdio_chipmatch((uint16)bus->sih->chip)) { - DHD_ERROR(("%s: unsupported chip: 0x%04x\n", - __FUNCTION__, bus->sih->chip)); - goto fail; - } - - si_sdiod_drive_strength_init(bus->sih, osh, dhd_sdiod_drive_strength); - - - /* Get info on the ARM and SOCRAM cores... */ - if (!DHD_NOPMU(bus)) { - if ((si_setcore(bus->sih, ARM7S_CORE_ID, 0)) || - (si_setcore(bus->sih, ARMCM3_CORE_ID, 0))) { - bus->armrev = si_corerev(bus->sih); - } else { - DHD_ERROR(("%s: failed to find ARM core!\n", __FUNCTION__)); - goto fail; - } - if (!(bus->orig_ramsize = si_socram_size(bus->sih))) { - DHD_ERROR(("%s: failed to find SOCRAM memory!\n", __FUNCTION__)); - goto fail; - } - bus->ramsize = bus->orig_ramsize; - if (dhd_dongle_memsize) - dhd_dongle_setmemsize(bus, dhd_dongle_memsize); - - DHD_ERROR(("DHD: dongle ram size is set to %d(orig %d)\n", - bus->ramsize, bus->orig_ramsize)); - } - - /* ...but normally deal with the SDPCMDEV core */ - if (!(bus->regs = si_setcore(bus->sih, PCMCIA_CORE_ID, 0)) && - !(bus->regs = si_setcore(bus->sih, SDIOD_CORE_ID, 0))) { - DHD_ERROR(("%s: failed to find SDIODEV core!\n", __FUNCTION__)); - goto fail; - } - bus->sdpcmrev = si_corerev(bus->sih); - - /* Set core control so an SDIO reset does a backplane reset */ - OR_REG(osh, &bus->regs->corecontrol, CC_BPRESEN); - - pktq_init(&bus->txq, (PRIOMASK + 1), QLEN); - - /* Locate an appropriately-aligned portion of hdrbuf */ - bus->rxhdr = (uint8 *)ROUNDUP((uintptr)&bus->hdrbuf[0], DHD_SDALIGN); - - /* Set the poll and/or interrupt flags */ - bus->intr = (bool)dhd_intr; - if ((bus->poll = (bool)dhd_poll)) - bus->pollrate = 1; - - return TRUE; - -fail: - return FALSE; -} - -static bool -dhdsdio_probe_malloc(dhd_bus_t *bus, osl_t *osh, void *sdh) -{ - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - -#ifndef DHD_USE_STATIC_BUF - if (bus->dhd->maxctl) { - bus->rxblen = ROUNDUP((bus->dhd->maxctl + SDPCM_HDRLEN), ALIGNMENT) + DHD_SDALIGN; - if (!(bus->rxbuf = MALLOC(osh, bus->rxblen))) { - DHD_ERROR(("%s: MALLOC of %d-byte rxbuf failed\n", - __FUNCTION__, bus->rxblen)); - goto fail; - } - } - - /* Allocate buffer to receive glomed packet */ - if (!(bus->databuf = MALLOC(osh, MAX_DATA_BUF))) { - DHD_ERROR(("%s: MALLOC of %d-byte databuf failed\n", - __FUNCTION__, MAX_DATA_BUF)); - /* release rxbuf which was already located as above */ - if (!bus->rxblen) MFREE(osh, bus->rxbuf, bus->rxblen); - goto fail; - } -#else - if (bus->dhd->maxctl) { - bus->rxblen = ROUNDUP((bus->dhd->maxctl + SDPCM_HDRLEN), ALIGNMENT) + DHD_SDALIGN; - if (!(bus->rxbuf = dhd_os_prealloc(DHD_PREALLOC_RXBUF, bus->rxblen))) { - DHD_ERROR(("%s: MALLOC of %d-byte rxbuf failed\n", - __FUNCTION__, bus->rxblen)); - goto fail; - } - } - /* Allocate buffer to receive glomed packet */ - if (!(bus->databuf = dhd_os_prealloc(DHD_PREALLOC_DATABUF, MAX_DATA_BUF))) { - DHD_ERROR(("%s: MALLOC of %d-byte databuf failed\n", - __FUNCTION__, MAX_DATA_BUF)); - goto fail; - } -#endif /* DHD_USE_STATIC_BUF */ - - /* Align the buffer */ - if ((uintptr)bus->databuf % DHD_SDALIGN) - bus->dataptr = bus->databuf + (DHD_SDALIGN - ((uintptr)bus->databuf % DHD_SDALIGN)); - else - bus->dataptr = bus->databuf; - - return TRUE; - -fail: - return FALSE; -} - - -static bool -dhdsdio_probe_init(dhd_bus_t *bus, osl_t *osh, void *sdh) -{ - int32 fnum; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - -#ifdef SDTEST - dhdsdio_pktgen_init(bus); -#endif /* SDTEST */ - - /* Disable F2 to clear any intermediate frame state on the dongle */ - bcmsdh_cfg_write(sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, SDIO_FUNC_ENABLE_1, NULL); - - bus->dhd->busstate = DHD_BUS_DOWN; - bus->sleeping = FALSE; - bus->rxflow = FALSE; - bus->prev_rxlim_hit = 0; - - - /* Done with backplane-dependent accesses, can drop clock... */ - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL); - - /* ...and initialize clock/power states */ - bus->clkstate = CLK_SDONLY; - bus->idletime = (int32)dhd_idletime; - bus->idleclock = DHD_IDLE_ACTIVE; - - /* Query the SD clock speed */ - if (bcmsdh_iovar_op(sdh, "sd_divisor", NULL, 0, - &bus->sd_divisor, sizeof(int32), FALSE) != BCME_OK) { - DHD_ERROR(("%s: fail on %s get\n", __FUNCTION__, "sd_divisor")); - bus->sd_divisor = -1; - } else { - DHD_INFO(("%s: Initial value for %s is %d\n", - __FUNCTION__, "sd_divisor", bus->sd_divisor)); - } - - /* Query the SD bus mode */ - if (bcmsdh_iovar_op(sdh, "sd_mode", NULL, 0, - &bus->sd_mode, sizeof(int32), FALSE) != BCME_OK) { - DHD_ERROR(("%s: fail on %s get\n", __FUNCTION__, "sd_mode")); - bus->sd_mode = -1; - } else { - DHD_INFO(("%s: Initial value for %s is %d\n", - __FUNCTION__, "sd_mode", bus->sd_mode)); - } - - /* Query the F2 block size, set roundup accordingly */ - fnum = 2; - if (bcmsdh_iovar_op(sdh, "sd_blocksize", &fnum, sizeof(int32), - &bus->blocksize, sizeof(int32), FALSE) != BCME_OK) { - bus->blocksize = 0; - DHD_ERROR(("%s: fail on %s get\n", __FUNCTION__, "sd_blocksize")); - } else { - DHD_INFO(("%s: Initial value for %s is %d\n", - __FUNCTION__, "sd_blocksize", bus->blocksize)); - } - bus->roundup = MIN(max_roundup, bus->blocksize); - - /* Query if bus module supports packet chaining, default to use if supported */ - if (bcmsdh_iovar_op(sdh, "sd_rxchain", NULL, 0, - &bus->sd_rxchain, sizeof(int32), FALSE) != BCME_OK) { - bus->sd_rxchain = FALSE; - } else { - DHD_INFO(("%s: bus module (through bcmsdh API) %s chaining\n", - __FUNCTION__, (bus->sd_rxchain ? "supports" : "does not support"))); - } - bus->use_rxchain = (bool)bus->sd_rxchain; - - return TRUE; -} - -bool -dhd_bus_download_firmware(struct dhd_bus *bus, osl_t *osh, - char *fw_path, char *nv_path) -{ - bool ret; - bus->fw_path = fw_path; - bus->nv_path = nv_path; - - ret = dhdsdio_download_firmware(bus, osh, bus->sdh); - - return ret; -} - -static bool -dhdsdio_download_firmware(struct dhd_bus *bus, osl_t *osh, void *sdh) -{ - bool ret; - - /* Download the firmware */ - dhd_os_wake_lock(bus->dhd); - dhdsdio_clkctl(bus, CLK_AVAIL, FALSE); - - ret = _dhdsdio_download_firmware(bus) == 0; - - dhdsdio_clkctl(bus, CLK_SDONLY, FALSE); - dhd_os_wake_unlock(bus->dhd); - return ret; -} - -/* Detach and free everything */ -static void -dhdsdio_release(dhd_bus_t *bus, osl_t *osh) -{ - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - if (bus) { - ASSERT(osh); - - - /* De-register interrupt handler */ - bcmsdh_intr_disable(bus->sdh); - bcmsdh_intr_dereg(bus->sdh); - - if (bus->dhd) { - - dhdsdio_release_dongle(bus, osh, TRUE); - - dhd_detach(bus->dhd); - bus->dhd = NULL; - } - - dhdsdio_release_malloc(bus, osh); - - - MFREE(osh, bus, sizeof(dhd_bus_t)); - } - - if (osh) - dhd_osl_detach(osh); - - DHD_TRACE(("%s: Disconnected\n", __FUNCTION__)); -} - -static void -dhdsdio_release_malloc(dhd_bus_t *bus, osl_t *osh) -{ - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - if (bus->dhd && bus->dhd->dongle_reset) - return; - - if (bus->rxbuf) { -#ifndef DHD_USE_STATIC_BUF - MFREE(osh, bus->rxbuf, bus->rxblen); -#endif - bus->rxctl = bus->rxbuf = NULL; - bus->rxlen = 0; - } - - if (bus->databuf) { -#ifndef DHD_USE_STATIC_BUF - MFREE(osh, bus->databuf, MAX_DATA_BUF); -#endif - bus->databuf = NULL; - } -} - - -static void -dhdsdio_release_dongle(dhd_bus_t *bus, osl_t *osh, int reset_flag) -{ - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - if ((bus->dhd && bus->dhd->dongle_reset) && reset_flag) - return; - - if (bus->sih) { - dhdsdio_clkctl(bus, CLK_AVAIL, FALSE); -#if !defined(BCMLXSDMMC) - si_watchdog(bus->sih, 4); -#endif /* !defined(BCMLXSDMMC) */ - dhdsdio_clkctl(bus, CLK_NONE, FALSE); - si_detach(bus->sih); - if (bus->vars && bus->varsz) - MFREE(osh, bus->vars, bus->varsz); - bus->vars = NULL; - } - - DHD_TRACE(("%s: Disconnected\n", __FUNCTION__)); -} - -static void -dhdsdio_disconnect(void *ptr) -{ - dhd_bus_t *bus = (dhd_bus_t *)ptr; - - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - if (bus) { - ASSERT(bus->dhd); - dhdsdio_release(bus, bus->dhd->osh); - } - - DHD_TRACE(("%s: Disconnected\n", __FUNCTION__)); -} - - -/* Register/Unregister functions are called by the main DHD entry - * point (e.g. module insertion) to link with the bus driver, in - * order to look for or await the device. - */ - -static bcmsdh_driver_t dhd_sdio = { - dhdsdio_probe, - dhdsdio_disconnect -}; - -int -dhd_bus_register(void) -{ - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - return bcmsdh_register(&dhd_sdio); -} - -void -dhd_bus_unregister(void) -{ - DHD_TRACE(("%s: Enter\n", __FUNCTION__)); - - bcmsdh_unregister(); -} - -#ifdef BCMEMBEDIMAGE -static int -dhdsdio_download_code_array(struct dhd_bus *bus) -{ - int bcmerror = -1; - int offset = 0; - - DHD_INFO(("%s: download embedded firmware...\n", __FUNCTION__)); - - /* Download image */ - while ((offset + MEMBLOCK) < sizeof(dlarray)) { - bcmerror = dhdsdio_membytes(bus, TRUE, offset, dlarray + offset, MEMBLOCK); - if (bcmerror) { - DHD_ERROR(("%s: error %d on writing %d membytes at 0x%08x\n", - __FUNCTION__, bcmerror, MEMBLOCK, offset)); - goto err; - } - - offset += MEMBLOCK; - } - - if (offset < sizeof(dlarray)) { - bcmerror = dhdsdio_membytes(bus, TRUE, offset, - dlarray + offset, sizeof(dlarray) - offset); - if (bcmerror) { - DHD_ERROR(("%s: error %d on writing %d membytes at 0x%08x\n", - __FUNCTION__, bcmerror, sizeof(dlarray) - offset, offset)); - goto err; - } - } - -#ifdef DHD_DEBUG - /* Upload and compare the downloaded code */ - { - unsigned char *ularray; - - ularray = MALLOC(bus->dhd->osh, bus->ramsize); - /* Upload image to verify downloaded contents. */ - offset = 0; - memset(ularray, 0xaa, bus->ramsize); - while ((offset + MEMBLOCK) < sizeof(dlarray)) { - bcmerror = dhdsdio_membytes(bus, FALSE, offset, ularray + offset, MEMBLOCK); - if (bcmerror) { - DHD_ERROR(("%s: error %d on reading %d membytes at 0x%08x\n", - __FUNCTION__, bcmerror, MEMBLOCK, offset)); - goto err; - } - - offset += MEMBLOCK; - } - - if (offset < sizeof(dlarray)) { - bcmerror = dhdsdio_membytes(bus, FALSE, offset, - ularray + offset, sizeof(dlarray) - offset); - if (bcmerror) { - DHD_ERROR(("%s: error %d on reading %d membytes at 0x%08x\n", - __FUNCTION__, bcmerror, sizeof(dlarray) - offset, offset)); - goto err; - } - } - - if (memcmp(dlarray, ularray, sizeof(dlarray))) { - DHD_ERROR(("%s: Downloaded image is corrupted.\n", __FUNCTION__)); - ASSERT(0); - goto err; - } else - DHD_ERROR(("%s: Download, Upload and compare succeeded.\n", __FUNCTION__)); - - MFREE(bus->dhd->osh, ularray, bus->ramsize); - } -#endif /* DHD_DEBUG */ - -err: - return bcmerror; -} -#endif /* BCMEMBEDIMAGE */ - -static int -dhdsdio_download_code_file(struct dhd_bus *bus, char *fw_path) -{ - int bcmerror = -1; - int offset = 0; - uint len; - void *image = NULL; - uint8 *memblock = NULL, *memptr; - - DHD_INFO(("%s: download firmware %s\n", __FUNCTION__, fw_path)); - - image = dhd_os_open_image(fw_path); - if (image == NULL) - goto err; - - memptr = memblock = MALLOC(bus->dhd->osh, MEMBLOCK + DHD_SDALIGN); - if (memblock == NULL) { - DHD_ERROR(("%s: Failed to allocate memory %d bytes\n", __FUNCTION__, MEMBLOCK)); - goto err; - } - if ((uint32)(uintptr)memblock % DHD_SDALIGN) - memptr += (DHD_SDALIGN - ((uint32)(uintptr)memblock % DHD_SDALIGN)); - - /* Download image */ - while ((len = dhd_os_get_image_block((char*)memptr, MEMBLOCK, image))) { - bcmerror = dhdsdio_membytes(bus, TRUE, offset, memptr, len); - if (bcmerror) { - DHD_ERROR(("%s: error %d on writing %d membytes at 0x%08x\n", - __FUNCTION__, bcmerror, MEMBLOCK, offset)); - goto err; - } - - offset += MEMBLOCK; - } - -err: - if (memblock) - MFREE(bus->dhd->osh, memblock, MEMBLOCK + DHD_SDALIGN); - - if (image) - dhd_os_close_image(image); - - return bcmerror; -} - -/* - * ProcessVars:Takes a buffer of "=\n" lines read from a file and ending in a NUL. - * Removes carriage returns, empty lines, comment lines, and converts newlines to NULs. - * Shortens buffer as needed and pads with NULs. End of buffer is marked by two NULs. -*/ - -static uint -process_nvram_vars(char *varbuf, uint len) -{ - char *dp; - bool findNewline; - int column; - uint buf_len, n; - - dp = varbuf; - - findNewline = FALSE; - column = 0; - - for (n = 0; n < len; n++) { - if (varbuf[n] == 0) - break; - if (varbuf[n] == '\r') - continue; - if (findNewline && varbuf[n] != '\n') - continue; - findNewline = FALSE; - if (varbuf[n] == '#') { - findNewline = TRUE; - continue; - } - if (varbuf[n] == '\n') { - if (column == 0) - continue; - *dp++ = 0; - column = 0; - continue; - } - *dp++ = varbuf[n]; - column++; - } - buf_len = dp - varbuf; - - while (dp < varbuf + n) - *dp++ = 0; - - return buf_len; -} - -/* - EXAMPLE: nvram_array - nvram_arry format: - name=value - Use carriage return at the end of each assignment, and an empty string with - carriage return at the end of array. - - For example: - unsigned char nvram_array[] = {"name1=value1\n", "name2=value2\n", "\n"}; - Hex values start with 0x, and mac addr format: xx:xx:xx:xx:xx:xx. - - Search "EXAMPLE: nvram_array" to see how the array is activated. -*/ - -void -dhd_bus_set_nvram_params(struct dhd_bus * bus, const char *nvram_params) -{ - bus->nvram_params = nvram_params; -} - -static int -dhdsdio_download_nvram(struct dhd_bus *bus) -{ - int bcmerror = -1; - uint len; - void * image = NULL; - char * memblock = NULL; - char *bufp; - char *nv_path; - bool nvram_file_exists; - - nv_path = bus->nv_path; - - nvram_file_exists = ((nv_path != NULL) && (nv_path[0] != '\0')); - if (!nvram_file_exists && (bus->nvram_params == NULL)) - return (0); - - if (nvram_file_exists) { - image = dhd_os_open_image(nv_path); - if (image == NULL) - goto err; - } - - memblock = MALLOC(bus->dhd->osh, MEMBLOCK); - if (memblock == NULL) { - DHD_ERROR(("%s: Failed to allocate memory %d bytes\n", - __FUNCTION__, MEMBLOCK)); - goto err; - } - - /* Download variables */ - if (nvram_file_exists) { - len = dhd_os_get_image_block(memblock, MEMBLOCK, image); - } - else { - len = strlen(bus->nvram_params); - ASSERT(len <= MEMBLOCK); - if (len > MEMBLOCK) - len = MEMBLOCK; - memcpy(memblock, bus->nvram_params, len); - } - - if (len > 0 && len < MEMBLOCK) { - bufp = (char *)memblock; - bufp[len] = 0; - len = process_nvram_vars(bufp, len); - bufp += len; - *bufp++ = 0; - if (len) - bcmerror = dhdsdio_downloadvars(bus, memblock, len + 1); - if (bcmerror) { - DHD_ERROR(("%s: error downloading vars: %d\n", - __FUNCTION__, bcmerror)); - } - } - else { - DHD_ERROR(("%s: error reading nvram file: %d\n", - __FUNCTION__, len)); - bcmerror = BCME_SDIO_ERROR; - } - -err: - if (memblock) - MFREE(bus->dhd->osh, memblock, MEMBLOCK); - - if (image) - dhd_os_close_image(image); - - return bcmerror; -} - -static int -_dhdsdio_download_firmware(struct dhd_bus *bus) -{ - int bcmerror = -1; - - bool embed = FALSE; /* download embedded firmware */ - bool dlok = FALSE; /* download firmware succeeded */ - - /* Out immediately if no image to download */ - if ((bus->fw_path == NULL) || (bus->fw_path[0] == '\0')) { -#ifdef BCMEMBEDIMAGE - embed = TRUE; -#else - return bcmerror; -#endif - } - - /* Keep arm in reset */ - if (dhdsdio_download_state(bus, TRUE)) { - DHD_ERROR(("%s: error placing ARM core in reset\n", __FUNCTION__)); - goto err; - } - - /* External image takes precedence if specified */ - if ((bus->fw_path != NULL) && (bus->fw_path[0] != '\0')) { - if (dhdsdio_download_code_file(bus, bus->fw_path)) { - DHD_ERROR(("%s: dongle image file download failed\n", __FUNCTION__)); -#ifdef BCMEMBEDIMAGE - embed = TRUE; -#else - goto err; -#endif - } - else { - embed = FALSE; - dlok = TRUE; - } - } -#ifdef BCMEMBEDIMAGE - if (embed) { - if (dhdsdio_download_code_array(bus)) { - DHD_ERROR(("%s: dongle image array download failed\n", __FUNCTION__)); - goto err; - } - else { - dlok = TRUE; - } - } -#endif - if (!dlok) { - DHD_ERROR(("%s: dongle image download failed\n", __FUNCTION__)); - goto err; - } - - /* EXAMPLE: nvram_array */ - /* If a valid nvram_arry is specified as above, it can be passed down to dongle */ - /* dhd_bus_set_nvram_params(bus, (char *)&nvram_array); */ - - /* External nvram takes precedence if specified */ - if (dhdsdio_download_nvram(bus)) { - DHD_ERROR(("%s: dongle nvram file download failed\n", __FUNCTION__)); - } - - /* Take arm out of reset */ - if (dhdsdio_download_state(bus, FALSE)) { - DHD_ERROR(("%s: error getting out of ARM core reset\n", __FUNCTION__)); - goto err; - } - - bcmerror = 0; - -err: - return bcmerror; -} - -static int -dhd_bcmsdh_recv_buf(dhd_bus_t *bus, uint32 addr, uint fn, uint flags, uint8 *buf, uint nbytes, - void *pkt, bcmsdh_cmplt_fn_t complete, void *handle) -{ - int status; - - /* 4329: GSPI check */ - status = bcmsdh_recv_buf(bus->sdh, addr, fn, flags, buf, nbytes, pkt, complete, handle); - return status; -} - -static int -dhd_bcmsdh_send_buf(dhd_bus_t *bus, uint32 addr, uint fn, uint flags, uint8 *buf, uint nbytes, - void *pkt, bcmsdh_cmplt_fn_t complete, void *handle) -{ - return (bcmsdh_send_buf(bus->sdh, addr, fn, flags, buf, nbytes, pkt, complete, handle)); -} - -uint -dhd_bus_chip(struct dhd_bus *bus) -{ - ASSERT(bus->sih != NULL); - return bus->sih->chip; -} - -void * -dhd_bus_pub(struct dhd_bus *bus) -{ - return bus->dhd; -} - -void * -dhd_bus_txq(struct dhd_bus *bus) -{ - return &bus->txq; -} - -uint -dhd_bus_hdrlen(struct dhd_bus *bus) -{ - return SDPCM_HDRLEN; -} - -int -dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag) -{ - int bcmerror = 0; - dhd_bus_t *bus; - - bus = dhdp->bus; - - if (flag == TRUE) { - if (!bus->dhd->dongle_reset) { - dhd_os_sdlock(dhdp); - /* Turning off watchdog */ - dhd_os_wd_timer(dhdp, 0); -#if !defined(IGNORE_ETH0_DOWN) - /* Force flow control as protection when stop come before ifconfig_down */ - dhd_txflowcontrol(bus->dhd, 0, ON); -#endif /* !defined(IGNORE_ETH0_DOWN) */ - /* Expect app to have torn down any connection before calling */ - /* Stop the bus, disable F2 */ - dhd_bus_stop(bus, FALSE); -#if defined(OOB_INTR_ONLY) - bcmsdh_set_irq(FALSE); -#endif /* defined(OOB_INTR_ONLY) */ - /* Clean tx/rx buffer pointers, detach from the dongle */ - dhdsdio_release_dongle(bus, bus->dhd->osh, TRUE); - - bus->dhd->dongle_reset = TRUE; - bus->dhd->up = FALSE; - dhd_os_sdunlock(dhdp); - - DHD_TRACE(("%s: WLAN OFF DONE\n", __FUNCTION__)); - /* App can now remove power from device */ - } else - bcmerror = BCME_SDIO_ERROR; - } else { - /* App must have restored power to device before calling */ - - DHD_TRACE(("\n\n%s: == WLAN ON ==\n", __FUNCTION__)); - - if (bus->dhd->dongle_reset) { - /* Turn on WLAN */ - dhd_os_sdlock(dhdp); - - /* Reset SD client */ - bcmsdh_reset(bus->sdh); - - /* Attempt to re-attach & download */ - if (dhdsdio_probe_attach(bus, bus->dhd->osh, bus->sdh, - (uint32 *)SI_ENUM_BASE, - bus->cl_devid)) { - /* Attempt to download binary to the dongle */ - if (dhdsdio_probe_init(bus, bus->dhd->osh, bus->sdh) && - dhdsdio_download_firmware(bus, bus->dhd->osh, bus->sdh)) { - - /* Re-init bus, enable F2 transfer */ - bcmerror = dhd_bus_init((dhd_pub_t *) bus->dhd, FALSE); - if (bcmerror == BCME_OK) { -#if defined(OOB_INTR_ONLY) - bcmsdh_set_irq(TRUE); - dhd_enable_oob_intr(bus, TRUE); -#endif /* defined(OOB_INTR_ONLY) */ - bus->dhd->dongle_reset = FALSE; - bus->dhd->up = TRUE; -#if !defined(IGNORE_ETH0_DOWN) - /* Restore flow control */ - dhd_txflowcontrol(bus->dhd, 0, OFF); -#endif - /* Turning on watchdog back */ - dhd_os_wd_timer(dhdp, dhd_watchdog_ms); - - DHD_TRACE(("%s: WLAN ON DONE\n", __FUNCTION__)); - } else { - dhd_bus_stop(bus, FALSE); - dhdsdio_release_dongle(bus, bus->dhd->osh, FALSE); - } - } else - bcmerror = BCME_SDIO_ERROR; - } else - bcmerror = BCME_SDIO_ERROR; - - dhd_os_sdunlock(dhdp); - } else { - bcmerror = BCME_NOTDOWN; - DHD_ERROR(("%s: Set DEVRESET=FALSE invoked when device is on\n", - __FUNCTION__)); - bcmerror = BCME_SDIO_ERROR; - } - } - return bcmerror; -} diff --git a/drivers/net/wireless/bcm4319/dngl_stats.h b/drivers/net/wireless/bcm4319/dngl_stats.h deleted file mode 100644 index e5db54e7edfe..000000000000 --- a/drivers/net/wireless/bcm4319/dngl_stats.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Common stats definitions for clients of dongle - * ports - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: dngl_stats.h,v 1.2.140.3 2008/05/26 16:52:08 Exp $ - */ - -#ifndef _dngl_stats_h_ -#define _dngl_stats_h_ - -typedef struct { - unsigned long rx_packets; /* total packets received */ - unsigned long tx_packets; /* total packets transmitted */ - unsigned long rx_bytes; /* total bytes received */ - unsigned long tx_bytes; /* total bytes transmitted */ - unsigned long rx_errors; /* bad packets received */ - unsigned long tx_errors; /* packet transmit problems */ - unsigned long rx_dropped; /* packets dropped by dongle */ - unsigned long tx_dropped; /* packets dropped by dongle */ - unsigned long multicast; /* multicast packets received */ -} dngl_stats_t; - -#endif /* _dngl_stats_h_ */ diff --git a/drivers/net/wireless/bcm4319/hndpmu.c b/drivers/net/wireless/bcm4319/hndpmu.c deleted file mode 100644 index 307347a43bde..000000000000 --- a/drivers/net/wireless/bcm4319/hndpmu.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Misc utility routines for accessing PMU corerev specific features - * of the SiliconBackplane-based Broadcom chips. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: hndpmu.c,v 1.95.2.17.4.11.2.63 2010/07/21 13:55:09 Exp $ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* debug/trace */ -#define PMU_ERROR(args) - -#define PMU_MSG(args) - - -/* SDIO Pad drive strength to select value mappings */ -typedef struct { - uint8 strength; /* Pad Drive Strength in mA */ - uint8 sel; /* Chip-specific select value */ -} sdiod_drive_str_t; - -/* SDIO Drive Strength to sel value table for PMU Rev 1 */ -static const sdiod_drive_str_t sdiod_drive_strength_tab1[] = { - {4, 0x2}, - {2, 0x3}, - {1, 0x0}, - {0, 0x0} }; - -/* SDIO Drive Strength to sel value table for PMU Rev 2, 3 */ -static const sdiod_drive_str_t sdiod_drive_strength_tab2[] = { - {12, 0x7}, - {10, 0x6}, - {8, 0x5}, - {6, 0x4}, - {4, 0x2}, - {2, 0x1}, - {0, 0x0} }; - -#define SDIOD_DRVSTR_KEY(chip, pmu) (((chip) << 16) | (pmu)) - -void -si_sdiod_drive_strength_init(si_t *sih, osl_t *osh, uint32 drivestrength) -{ - chipcregs_t *cc; - uint origidx, intr_val = 0; - sdiod_drive_str_t *str_tab = NULL; - uint32 str_mask = 0; - uint32 str_shift = 0; - - if (!(sih->cccaps & CC_CAP_PMU)) { - return; - } - - /* Remember original core before switch to chipc */ - cc = (chipcregs_t *) si_switch_core(sih, CC_CORE_ID, &origidx, &intr_val); - - switch (SDIOD_DRVSTR_KEY(sih->chip, sih->pmurev)) { - case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 1): - str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab1; - str_mask = 0x30000000; - str_shift = 28; - break; - case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 2): - case SDIOD_DRVSTR_KEY(BCM4325_CHIP_ID, 3): - case SDIOD_DRVSTR_KEY(BCM4315_CHIP_ID, 4): - str_tab = (sdiod_drive_str_t *)&sdiod_drive_strength_tab2; - str_mask = 0x00003800; - str_shift = 11; - break; - - default: - PMU_MSG(("No SDIO Drive strength init done for chip %x rev %d pmurev %d\n", - sih->chip, sih->chiprev, sih->pmurev)); - - break; - } - - if (str_tab != NULL) { - uint32 drivestrength_sel = 0; - uint32 cc_data_temp; - int i; - - for (i = 0; str_tab[i].strength != 0; i ++) { - if (drivestrength >= str_tab[i].strength) { - drivestrength_sel = str_tab[i].sel; - break; - } - } - - W_REG(osh, &cc->chipcontrol_addr, 1); - cc_data_temp = R_REG(osh, &cc->chipcontrol_data); - cc_data_temp &= ~str_mask; - drivestrength_sel <<= str_shift; - cc_data_temp |= drivestrength_sel; - W_REG(osh, &cc->chipcontrol_data, cc_data_temp); - - PMU_MSG(("SDIO: %dmA drive strength selected, set to 0x%08x\n", - drivestrength, cc_data_temp)); - } - - /* Return to original core */ - si_restore_core(sih, origidx, intr_val); -} diff --git a/drivers/net/wireless/bcm4319/include/Makefile b/drivers/net/wireless/bcm4319/include/Makefile deleted file mode 100644 index 439ead14a0e6..000000000000 --- a/drivers/net/wireless/bcm4319/include/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# -# include/Makefile -# -# Copyright 2005, Broadcom, Inc. -# -# $Id: Makefile,v 13.5 2005/02/17 19:11:31 Exp $ -# - -SRCBASE = .. - -TARGETS = epivers.h - - -all release: - bash epivers.sh - -clean: - rm -rf ${TARGETS} *.prev - - -.PHONY: all release clean diff --git a/drivers/net/wireless/bcm4319/include/aidmp.h b/drivers/net/wireless/bcm4319/include/aidmp.h deleted file mode 100644 index a927e5dae586..000000000000 --- a/drivers/net/wireless/bcm4319/include/aidmp.h +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Broadcom AMBA Interconnect definitions. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: aidmp.h,v 13.2.10.1 2008/05/07 20:32:12 Exp $ - */ - - -#ifndef _AIDMP_H -#define _AIDMP_H - - -#define MFGID_ARM 0x43b -#define MFGID_BRCM 0x4bf -#define MFGID_MIPS 0x4a7 - - -#define CC_SIM 0 -#define CC_EROM 1 -#define CC_CORESIGHT 9 -#define CC_VERIF 0xb -#define CC_OPTIMO 0xd -#define CC_GEN 0xe -#define CC_PRIMECELL 0xf - - -#define ER_EROMENTRY 0x000 -#define ER_REMAPCONTROL 0xe00 -#define ER_REMAPSELECT 0xe04 -#define ER_MASTERSELECT 0xe10 -#define ER_ITCR 0xf00 -#define ER_ITIP 0xf04 - - -#define ER_TAG 0xe -#define ER_TAG1 0x6 -#define ER_VALID 1 -#define ER_CI 0 -#define ER_MP 2 -#define ER_ADD 4 -#define ER_END 0xe -#define ER_BAD 0xffffffff - - -#define CIA_MFG_MASK 0xfff00000 -#define CIA_MFG_SHIFT 20 -#define CIA_CID_MASK 0x000fff00 -#define CIA_CID_SHIFT 8 -#define CIA_CCL_MASK 0x000000f0 -#define CIA_CCL_SHIFT 4 - - -#define CIB_REV_MASK 0xff000000 -#define CIB_REV_SHIFT 24 -#define CIB_NSW_MASK 0x00f80000 -#define CIB_NSW_SHIFT 19 -#define CIB_NMW_MASK 0x0007c000 -#define CIB_NMW_SHIFT 14 -#define CIB_NSP_MASK 0x00003e00 -#define CIB_NSP_SHIFT 9 -#define CIB_NMP_MASK 0x000001f0 -#define CIB_NMP_SHIFT 4 - - -#define MPD_MUI_MASK 0x0000ff00 -#define MPD_MUI_SHIFT 8 -#define MPD_MP_MASK 0x000000f0 -#define MPD_MP_SHIFT 4 - - -#define AD_ADDR_MASK 0xfffff000 -#define AD_SP_MASK 0x00000f00 -#define AD_SP_SHIFT 8 -#define AD_ST_MASK 0x000000c0 -#define AD_ST_SHIFT 6 -#define AD_ST_SLAVE 0x00000000 -#define AD_ST_BRIDGE 0x00000040 -#define AD_ST_SWRAP 0x00000080 -#define AD_ST_MWRAP 0x000000c0 -#define AD_SZ_MASK 0x00000030 -#define AD_SZ_SHIFT 4 -#define AD_SZ_4K 0x00000000 -#define AD_SZ_8K 0x00000010 -#define AD_SZ_16K 0x00000020 -#define AD_SZ_SZD 0x00000030 -#define AD_AG32 0x00000008 -#define AD_ADDR_ALIGN 0x00000fff -#define AD_SZ_BASE 0x00001000 - - -#define SD_SZ_MASK 0xfffff000 -#define SD_SG32 0x00000008 -#define SD_SZ_ALIGN 0x00000fff - - -#ifndef _LANGUAGE_ASSEMBLY - -typedef volatile struct _aidmp { - uint32 oobselina30; - uint32 oobselina74; - uint32 PAD[6]; - uint32 oobselinb30; - uint32 oobselinb74; - uint32 PAD[6]; - uint32 oobselinc30; - uint32 oobselinc74; - uint32 PAD[6]; - uint32 oobselind30; - uint32 oobselind74; - uint32 PAD[38]; - uint32 oobselouta30; - uint32 oobselouta74; - uint32 PAD[6]; - uint32 oobseloutb30; - uint32 oobseloutb74; - uint32 PAD[6]; - uint32 oobseloutc30; - uint32 oobseloutc74; - uint32 PAD[6]; - uint32 oobseloutd30; - uint32 oobseloutd74; - uint32 PAD[38]; - uint32 oobsynca; - uint32 oobseloutaen; - uint32 PAD[6]; - uint32 oobsyncb; - uint32 oobseloutben; - uint32 PAD[6]; - uint32 oobsyncc; - uint32 oobseloutcen; - uint32 PAD[6]; - uint32 oobsyncd; - uint32 oobseloutden; - uint32 PAD[38]; - uint32 oobaextwidth; - uint32 oobainwidth; - uint32 oobaoutwidth; - uint32 PAD[5]; - uint32 oobbextwidth; - uint32 oobbinwidth; - uint32 oobboutwidth; - uint32 PAD[5]; - uint32 oobcextwidth; - uint32 oobcinwidth; - uint32 oobcoutwidth; - uint32 PAD[5]; - uint32 oobdextwidth; - uint32 oobdinwidth; - uint32 oobdoutwidth; - uint32 PAD[37]; - uint32 ioctrlset; - uint32 ioctrlclear; - uint32 ioctrl; - uint32 PAD[61]; - uint32 iostatus; - uint32 PAD[127]; - uint32 ioctrlwidth; - uint32 iostatuswidth; - uint32 PAD[62]; - uint32 resetctrl; - uint32 resetstatus; - uint32 resetreadid; - uint32 resetwriteid; - uint32 PAD[60]; - uint32 errlogctrl; - uint32 errlogdone; - uint32 errlogstatus; - uint32 errlogaddrlo; - uint32 errlogaddrhi; - uint32 errlogid; - uint32 errloguser; - uint32 errlogflags; - uint32 PAD[56]; - uint32 intstatus; - uint32 PAD[127]; - uint32 config; - uint32 PAD[63]; - uint32 itcr; - uint32 PAD[3]; - uint32 itipooba; - uint32 itipoobb; - uint32 itipoobc; - uint32 itipoobd; - uint32 PAD[4]; - uint32 itipoobaout; - uint32 itipoobbout; - uint32 itipoobcout; - uint32 itipoobdout; - uint32 PAD[4]; - uint32 itopooba; - uint32 itopoobb; - uint32 itopoobc; - uint32 itopoobd; - uint32 PAD[4]; - uint32 itopoobain; - uint32 itopoobbin; - uint32 itopoobcin; - uint32 itopoobdin; - uint32 PAD[4]; - uint32 itopreset; - uint32 PAD[15]; - uint32 peripherialid4; - uint32 peripherialid5; - uint32 peripherialid6; - uint32 peripherialid7; - uint32 peripherialid0; - uint32 peripherialid1; - uint32 peripherialid2; - uint32 peripherialid3; - uint32 componentid0; - uint32 componentid1; - uint32 componentid2; - uint32 componentid3; -} aidmp_t; - -#endif - - -#define OOB_BUSCONFIG 0x020 -#define OOB_STATUSA 0x100 -#define OOB_STATUSB 0x104 -#define OOB_STATUSC 0x108 -#define OOB_STATUSD 0x10c -#define OOB_ENABLEA0 0x200 -#define OOB_ENABLEA1 0x204 -#define OOB_ENABLEA2 0x208 -#define OOB_ENABLEA3 0x20c -#define OOB_ENABLEB0 0x280 -#define OOB_ENABLEB1 0x284 -#define OOB_ENABLEB2 0x288 -#define OOB_ENABLEB3 0x28c -#define OOB_ENABLEC0 0x300 -#define OOB_ENABLEC1 0x304 -#define OOB_ENABLEC2 0x308 -#define OOB_ENABLEC3 0x30c -#define OOB_ENABLED0 0x380 -#define OOB_ENABLED1 0x384 -#define OOB_ENABLED2 0x388 -#define OOB_ENABLED3 0x38c -#define OOB_ITCR 0xf00 -#define OOB_ITIPOOBA 0xf10 -#define OOB_ITIPOOBB 0xf14 -#define OOB_ITIPOOBC 0xf18 -#define OOB_ITIPOOBD 0xf1c -#define OOB_ITOPOOBA 0xf30 -#define OOB_ITOPOOBB 0xf34 -#define OOB_ITOPOOBC 0xf38 -#define OOB_ITOPOOBD 0xf3c - - -#define AI_OOBSELINA30 0x000 -#define AI_OOBSELINA74 0x004 -#define AI_OOBSELINB30 0x020 -#define AI_OOBSELINB74 0x024 -#define AI_OOBSELINC30 0x040 -#define AI_OOBSELINC74 0x044 -#define AI_OOBSELIND30 0x060 -#define AI_OOBSELIND74 0x064 -#define AI_OOBSELOUTA30 0x100 -#define AI_OOBSELOUTA74 0x104 -#define AI_OOBSELOUTB30 0x120 -#define AI_OOBSELOUTB74 0x124 -#define AI_OOBSELOUTC30 0x140 -#define AI_OOBSELOUTC74 0x144 -#define AI_OOBSELOUTD30 0x160 -#define AI_OOBSELOUTD74 0x164 -#define AI_OOBSYNCA 0x200 -#define AI_OOBSELOUTAEN 0x204 -#define AI_OOBSYNCB 0x220 -#define AI_OOBSELOUTBEN 0x224 -#define AI_OOBSYNCC 0x240 -#define AI_OOBSELOUTCEN 0x244 -#define AI_OOBSYNCD 0x260 -#define AI_OOBSELOUTDEN 0x264 -#define AI_OOBAEXTWIDTH 0x300 -#define AI_OOBAINWIDTH 0x304 -#define AI_OOBAOUTWIDTH 0x308 -#define AI_OOBBEXTWIDTH 0x320 -#define AI_OOBBINWIDTH 0x324 -#define AI_OOBBOUTWIDTH 0x328 -#define AI_OOBCEXTWIDTH 0x340 -#define AI_OOBCINWIDTH 0x344 -#define AI_OOBCOUTWIDTH 0x348 -#define AI_OOBDEXTWIDTH 0x360 -#define AI_OOBDINWIDTH 0x364 -#define AI_OOBDOUTWIDTH 0x368 -#define AI_IOCTRLSET 0x400 -#define AI_IOCTRLCLEAR 0x404 -#define AI_IOCTRL 0x408 -#define AI_IOSTATUS 0x500 -#define AI_IOCTRLWIDTH 0x700 -#define AI_IOSTATUSWIDTH 0x704 -#define AI_RESETCTRL 0x800 -#define AI_RESETSTATUS 0x804 -#define AI_RESETREADID 0x808 -#define AI_RESETWRITEID 0x80c -#define AI_ERRLOGCTRL 0xa00 -#define AI_ERRLOGDONE 0xa04 -#define AI_ERRLOGSTATUS 0xa08 -#define AI_ERRLOGADDRLO 0xa0c -#define AI_ERRLOGADDRHI 0xa10 -#define AI_ERRLOGID 0xa14 -#define AI_ERRLOGUSER 0xa18 -#define AI_ERRLOGFLAGS 0xa1c -#define AI_INTSTATUS 0xa00 -#define AI_CONFIG 0xe00 -#define AI_ITCR 0xf00 -#define AI_ITIPOOBA 0xf10 -#define AI_ITIPOOBB 0xf14 -#define AI_ITIPOOBC 0xf18 -#define AI_ITIPOOBD 0xf1c -#define AI_ITIPOOBAOUT 0xf30 -#define AI_ITIPOOBBOUT 0xf34 -#define AI_ITIPOOBCOUT 0xf38 -#define AI_ITIPOOBDOUT 0xf3c -#define AI_ITOPOOBA 0xf50 -#define AI_ITOPOOBB 0xf54 -#define AI_ITOPOOBC 0xf58 -#define AI_ITOPOOBD 0xf5c -#define AI_ITOPOOBAIN 0xf70 -#define AI_ITOPOOBBIN 0xf74 -#define AI_ITOPOOBCIN 0xf78 -#define AI_ITOPOOBDIN 0xf7c -#define AI_ITOPRESET 0xf90 -#define AI_PERIPHERIALID4 0xfd0 -#define AI_PERIPHERIALID5 0xfd4 -#define AI_PERIPHERIALID6 0xfd8 -#define AI_PERIPHERIALID7 0xfdc -#define AI_PERIPHERIALID0 0xfe0 -#define AI_PERIPHERIALID1 0xfe4 -#define AI_PERIPHERIALID2 0xfe8 -#define AI_PERIPHERIALID3 0xfec -#define AI_COMPONENTID0 0xff0 -#define AI_COMPONENTID1 0xff4 -#define AI_COMPONENTID2 0xff8 -#define AI_COMPONENTID3 0xffc - - -#define AIRC_RESET 1 - - -#define AICFG_OOB 0x00000020 -#define AICFG_IOS 0x00000010 -#define AICFG_IOC 0x00000008 -#define AICFG_TO 0x00000004 -#define AICFG_ERRL 0x00000002 -#define AICFG_RST 0x00000001 - -#endif diff --git a/drivers/net/wireless/bcm4319/include/bcmcdc.h b/drivers/net/wireless/bcm4319/include/bcmcdc.h deleted file mode 100644 index c2a860beab24..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmcdc.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * CDC network driver ioctl/indication encoding - * Broadcom 802.11abg Networking Device Driver - * - * Definitions subject to change without notice. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmcdc.h,v 13.14.16.3.16.4 2009/04/12 16:58:45 Exp $ - */ -#include - -typedef struct cdc_ioctl { - uint32 cmd; /* ioctl command value */ - uint32 len; /* lower 16: output buflen; upper 16: input buflen (excludes header) */ - uint32 flags; /* flag defns given below */ - uint32 status; /* status code returned from the device */ -} cdc_ioctl_t; - -/* Max valid buffer size that can be sent to the dongle */ -#define CDC_MAX_MSG_SIZE ETHER_MAX_LEN - -/* len field is divided into input and output buffer lengths */ -#define CDCL_IOC_OUTLEN_MASK 0x0000FFFF /* maximum or expected response length, */ - /* excluding IOCTL header */ -#define CDCL_IOC_OUTLEN_SHIFT 0 -#define CDCL_IOC_INLEN_MASK 0xFFFF0000 /* input buffer length, excluding IOCTL header */ -#define CDCL_IOC_INLEN_SHIFT 16 - -/* CDC flag definitions */ -#define CDCF_IOC_ERROR 0x01 /* 0=success, 1=ioctl cmd failed */ -#define CDCF_IOC_SET 0x02 /* 0=get, 1=set cmd */ -#define CDCF_IOC_IF_MASK 0xF000 /* I/F index */ -#define CDCF_IOC_IF_SHIFT 12 -#define CDCF_IOC_ID_MASK 0xFFFF0000 /* used to uniquely id an ioctl req/resp pairing */ -#define CDCF_IOC_ID_SHIFT 16 /* # of bits of shift for ID Mask */ - -#define CDC_IOC_IF_IDX(flags) (((flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT) -#define CDC_IOC_ID(flags) (((flags) & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT) - -#define CDC_GET_IF_IDX(hdr) \ - ((int)((((hdr)->flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT)) -#define CDC_SET_IF_IDX(hdr, idx) \ - ((hdr)->flags = (((hdr)->flags & ~CDCF_IOC_IF_MASK) | ((idx) << CDCF_IOC_IF_SHIFT))) - -/* - * BDC header - * - * The BDC header is used on data packets to convey priority across USB. - */ - -#define BDC_HEADER_LEN 4 - -#define BDC_PROTO_VER 1 /* Protocol version */ - -#define BDC_FLAG_VER_MASK 0xf0 /* Protocol version mask */ -#define BDC_FLAG_VER_SHIFT 4 /* Protocol version shift */ - -#define BDC_FLAG__UNUSED 0x03 /* Unassigned */ -#define BDC_FLAG_SUM_GOOD 0x04 /* Dongle has verified good RX checksums */ -#define BDC_FLAG_SUM_NEEDED 0x08 /* Dongle needs to do TX checksums */ - -#define BDC_PRIORITY_MASK 0x7 - -#define BDC_FLAG2_FC_FLAG 0x10 /* flag to indicate if pkt contains */ - /* FLOW CONTROL info only */ -#define BDC_PRIORITY_FC_SHIFT 4 /* flow control info shift */ - -#define BDC_FLAG2_IF_MASK 0x0f /* APSTA: interface on which the packet was received */ -#define BDC_FLAG2_IF_SHIFT 0 - -#define BDC_GET_IF_IDX(hdr) \ - ((int)((((hdr)->flags2) & BDC_FLAG2_IF_MASK) >> BDC_FLAG2_IF_SHIFT)) -#define BDC_SET_IF_IDX(hdr, idx) \ - ((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_IF_MASK) | ((idx) << BDC_FLAG2_IF_SHIFT))) - -struct bdc_header { - uint8 flags; /* Flags */ - uint8 priority; /* 802.1d Priority 0:2 bits, 4:7 flow control info for usb */ - uint8 flags2; - uint8 rssi; -}; diff --git a/drivers/net/wireless/bcm4319/include/bcmdefs.h b/drivers/net/wireless/bcm4319/include/bcmdefs.h deleted file mode 100644 index f4e99461971b..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmdefs.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Misc system wide definitions - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * $Id: bcmdefs.h,v 13.38.4.10.2.7.6.11 2010/02/01 05:51:55 Exp $ - */ - - -#ifndef _bcmdefs_h_ -#define _bcmdefs_h_ - -#define STATIC static - -#define SI_BUS 0 -#define PCI_BUS 1 -#define PCMCIA_BUS 2 -#define SDIO_BUS 3 -#define JTAG_BUS 4 -#define USB_BUS 5 -#define SPI_BUS 6 - - -#ifdef BCMBUSTYPE -#define BUSTYPE(bus) (BCMBUSTYPE) -#else -#define BUSTYPE(bus) (bus) -#endif - - -#ifdef BCMCHIPTYPE -#define CHIPTYPE(bus) (BCMCHIPTYPE) -#else -#define CHIPTYPE(bus) (bus) -#endif - - - -#if defined(BCMSPROMBUS) -#define SPROMBUS (BCMSPROMBUS) -#elif defined(SI_PCMCIA_SROM) -#define SPROMBUS (PCMCIA_BUS) -#else -#define SPROMBUS (PCI_BUS) -#endif - - -#ifdef BCMCHIPID -#define CHIPID(chip) (BCMCHIPID) -#else -#define CHIPID(chip) (chip) -#endif - - -#define DMADDR_MASK_32 0x0 -#define DMADDR_MASK_30 0xc0000000 -#define DMADDR_MASK_0 0xffffffff - -#define DMADDRWIDTH_30 30 -#define DMADDRWIDTH_32 32 -#define DMADDRWIDTH_63 63 -#define DMADDRWIDTH_64 64 - - -#define BCMEXTRAHDROOM 164 - - -#define BCMDONGLEHDRSZ 12 -#define BCMDONGLEPADSZ 16 - -#define BCMDONGLEOVERHEAD (BCMDONGLEHDRSZ + BCMDONGLEPADSZ) - - - -#define BITFIELD_MASK(width) \ - (((unsigned)1 << (width)) - 1) -#define GFIELD(val, field) \ - (((val) >> field ## _S) & field ## _M) -#define SFIELD(val, field, bits) \ - (((val) & (~(field ## _M << field ## _S))) | \ - ((unsigned)(bits) << field ## _S)) - - -#ifdef BCMSMALL -#undef BCMSPACE -#define bcmspace FALSE -#else -#define BCMSPACE -#define bcmspace TRUE -#endif - - -#define MAXSZ_NVRAM_VARS 4096 - -#define LOCATOR_EXTERN static - -#endif diff --git a/drivers/net/wireless/bcm4319/include/bcmdevs.h b/drivers/net/wireless/bcm4319/include/bcmdevs.h deleted file mode 100644 index 14853f17795c..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmdevs.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Broadcom device-specific manifest constants. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmdevs.h,v 13.172.4.5.4.10.2.36 2010/05/25 08:33:44 Exp $ - */ - - -#ifndef _BCMDEVS_H -#define _BCMDEVS_H - - -#define VENDOR_EPIGRAM 0xfeda -#define VENDOR_BROADCOM 0x14e4 -#define VENDOR_SI_IMAGE 0x1095 -#define VENDOR_TI 0x104c -#define VENDOR_RICOH 0x1180 -#define VENDOR_JMICRON 0x197b - - -#define VENDOR_BROADCOM_PCMCIA 0x02d0 - - -#define VENDOR_BROADCOM_SDIO 0x00BF - - -#define BCM_DNGL_VID 0xa5c -#define BCM_DNGL_BL_PID_4320 0xbd11 -#define BCM_DNGL_BL_PID_4328 0xbd12 -#define BCM_DNGL_BL_PID_4322 0xbd13 -#define BCM_DNGL_BL_PID_4325 0xbd14 -#define BCM_DNGL_BL_PID_4315 0xbd15 -#define BCM_DNGL_BL_PID_4319 0xbd16 -#define BCM_DNGL_BDC_PID 0xbdc - -#define BCM4325_D11DUAL_ID 0x431b -#define BCM4325_D11G_ID 0x431c -#define BCM4325_D11A_ID 0x431d -#define BCM4329_D11NDUAL_ID 0x432e -#define BCM4329_D11N2G_ID 0x432f -#define BCM4329_D11N5G_ID 0x4330 -#define BCM4336_D11N_ID 0x4343 -#define BCM4315_D11DUAL_ID 0x4334 -#define BCM4315_D11G_ID 0x4335 -#define BCM4315_D11A_ID 0x4336 -#define BCM4319_D11N_ID 0x4337 -#define BCM4319_D11N2G_ID 0x4338 -#define BCM4319_D11N5G_ID 0x4339 - - -#define SDIOH_FPGA_ID 0x43f2 -#define SPIH_FPGA_ID 0x43f5 -#define BCM4710_DEVICE_ID 0x4710 -#define BCM27XX_SDIOH_ID 0x2702 -#define PCIXX21_FLASHMEDIA0_ID 0x8033 -#define PCIXX21_SDIOH0_ID 0x8034 -#define PCIXX21_FLASHMEDIA_ID 0x803b -#define PCIXX21_SDIOH_ID 0x803c -#define R5C822_SDIOH_ID 0x0822 -#define JMICRON_SDIOH_ID 0x2381 - - -#define BCM4306_CHIP_ID 0x4306 -#define BCM4311_CHIP_ID 0x4311 -#define BCM4312_CHIP_ID 0x4312 -#define BCM4315_CHIP_ID 0x4315 -#define BCM4318_CHIP_ID 0x4318 -#define BCM4319_CHIP_ID 0x4319 -#define BCM4320_CHIP_ID 0x4320 -#define BCM4321_CHIP_ID 0x4321 -#define BCM4322_CHIP_ID 0x4322 -#define BCM4325_CHIP_ID 0x4325 -#define BCM4328_CHIP_ID 0x4328 -#define BCM4329_CHIP_ID 0x4329 -#define BCM4336_CHIP_ID 0x4336 -#define BCM4402_CHIP_ID 0x4402 -#define BCM4704_CHIP_ID 0x4704 -#define BCM4710_CHIP_ID 0x4710 -#define BCM4712_CHIP_ID 0x4712 -#define BCM4785_CHIP_ID 0x4785 -#define BCM5350_CHIP_ID 0x5350 -#define BCM5352_CHIP_ID 0x5352 -#define BCM5354_CHIP_ID 0x5354 -#define BCM5365_CHIP_ID 0x5365 - - - -#define BCM4303_PKG_ID 2 -#define BCM4309_PKG_ID 1 -#define BCM4712LARGE_PKG_ID 0 -#define BCM4712SMALL_PKG_ID 1 -#define BCM4712MID_PKG_ID 2 -#define BCM4328USBD11G_PKG_ID 2 -#define BCM4328USBDUAL_PKG_ID 3 -#define BCM4328SDIOD11G_PKG_ID 4 -#define BCM4328SDIODUAL_PKG_ID 5 -#define BCM4329_289PIN_PKG_ID 0 -#define BCM4329_182PIN_PKG_ID 1 -#define BCM5354E_PKG_ID 1 -#define HDLSIM5350_PKG_ID 1 -#define HDLSIM_PKG_ID 14 -#define HWSIM_PKG_ID 15 - - -#endif diff --git a/drivers/net/wireless/bcm4319/include/bcmendian.h b/drivers/net/wireless/bcm4319/include/bcmendian.h deleted file mode 100644 index ae468383aa74..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmendian.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Byte order utilities - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmendian.h,v 1.31.302.1.16.1 2009/02/03 18:34:31 Exp $ - * - * This file by default provides proper behavior on little-endian architectures. - * On big-endian architectures, IL_BIGENDIAN should be defined. - */ - - -#ifndef _BCMENDIAN_H_ -#define _BCMENDIAN_H_ - -#include - - -#define BCMSWAP16(val) \ - ((uint16)((((uint16)(val) & (uint16)0x00ffU) << 8) | \ - (((uint16)(val) & (uint16)0xff00U) >> 8))) - - -#define BCMSWAP32(val) \ - ((uint32)((((uint32)(val) & (uint32)0x000000ffU) << 24) | \ - (((uint32)(val) & (uint32)0x0000ff00U) << 8) | \ - (((uint32)(val) & (uint32)0x00ff0000U) >> 8) | \ - (((uint32)(val) & (uint32)0xff000000U) >> 24))) - - -#define BCMSWAP32BY16(val) \ - ((uint32)((((uint32)(val) & (uint32)0x0000ffffU) << 16) | \ - (((uint32)(val) & (uint32)0xffff0000U) >> 16))) - - -static INLINE uint16 -bcmswap16(uint16 val) -{ - return BCMSWAP16(val); -} - -static INLINE uint32 -bcmswap32(uint32 val) -{ - return BCMSWAP32(val); -} - -static INLINE uint32 -bcmswap32by16(uint32 val) -{ - return BCMSWAP32BY16(val); -} - - - - -static INLINE void -bcmswap16_buf(uint16 *buf, uint len) -{ - len = len / 2; - - while (len--) { - *buf = bcmswap16(*buf); - buf++; - } -} - -#ifndef hton16 -#ifndef IL_BIGENDIAN -#define HTON16(i) BCMSWAP16(i) -#define HTON32(i) BCMSWAP32(i) -#define hton16(i) bcmswap16(i) -#define hton32(i) bcmswap32(i) -#define ntoh16(i) bcmswap16(i) -#define ntoh32(i) bcmswap32(i) -#define HTOL16(i) (i) -#define HTOL32(i) (i) -#define ltoh16(i) (i) -#define ltoh32(i) (i) -#define htol16(i) (i) -#define htol32(i) (i) -#else -#define HTON16(i) (i) -#define HTON32(i) (i) -#define hton16(i) (i) -#define hton32(i) (i) -#define ntoh16(i) (i) -#define ntoh32(i) (i) -#define HTOL16(i) BCMSWAP16(i) -#define HTOL32(i) BCMSWAP32(i) -#define ltoh16(i) bcmswap16(i) -#define ltoh32(i) bcmswap32(i) -#define htol16(i) bcmswap16(i) -#define htol32(i) bcmswap32(i) -#endif -#endif - -#ifndef IL_BIGENDIAN -#define ltoh16_buf(buf, i) -#define htol16_buf(buf, i) -#else -#define ltoh16_buf(buf, i) bcmswap16_buf((uint16 *)buf, i) -#define htol16_buf(buf, i) bcmswap16_buf((uint16 *)buf, i) -#endif - - -static INLINE void -htol16_ua_store(uint16 val, uint8 *bytes) -{ - bytes[0] = val & 0xff; - bytes[1] = val >> 8; -} - - -static INLINE void -htol32_ua_store(uint32 val, uint8 *bytes) -{ - bytes[0] = val & 0xff; - bytes[1] = (val >> 8) & 0xff; - bytes[2] = (val >> 16) & 0xff; - bytes[3] = val >> 24; -} - - -static INLINE void -hton16_ua_store(uint16 val, uint8 *bytes) -{ - bytes[0] = val >> 8; - bytes[1] = val & 0xff; -} - - -static INLINE void -hton32_ua_store(uint32 val, uint8 *bytes) -{ - bytes[0] = val >> 24; - bytes[1] = (val >> 16) & 0xff; - bytes[2] = (val >> 8) & 0xff; - bytes[3] = val & 0xff; -} - -#define _LTOH16_UA(cp) ((cp)[0] | ((cp)[1] << 8)) -#define _LTOH32_UA(cp) ((cp)[0] | ((cp)[1] << 8) | ((cp)[2] << 16) | ((cp)[3] << 24)) -#define _NTOH16_UA(cp) (((cp)[0] << 8) | (cp)[1]) -#define _NTOH32_UA(cp) (((cp)[0] << 24) | ((cp)[1] << 16) | ((cp)[2] << 8) | (cp)[3]) - - -static INLINE uint16 -ltoh16_ua(const void *bytes) -{ - return _LTOH16_UA((const uint8 *)bytes); -} - - -static INLINE uint32 -ltoh32_ua(const void *bytes) -{ - return _LTOH32_UA((const uint8 *)bytes); -} - - -static INLINE uint16 -ntoh16_ua(const void *bytes) -{ - return _NTOH16_UA((const uint8 *)bytes); -} - - -static INLINE uint32 -ntoh32_ua(const void *bytes) -{ - return _NTOH32_UA((const uint8 *)bytes); -} - -#define ltoh_ua(ptr) \ - (sizeof(*(ptr)) == sizeof(uint8) ? *(const uint8 *)ptr : \ - sizeof(*(ptr)) == sizeof(uint16) ? _LTOH16_UA((const uint8 *)ptr) : \ - sizeof(*(ptr)) == sizeof(uint32) ? _LTOH32_UA((const uint8 *)ptr) : \ - 0xfeedf00d) - -#define ntoh_ua(ptr) \ - (sizeof(*(ptr)) == sizeof(uint8) ? *(const uint8 *)ptr : \ - sizeof(*(ptr)) == sizeof(uint16) ? _NTOH16_UA((const uint8 *)ptr) : \ - sizeof(*(ptr)) == sizeof(uint32) ? _NTOH32_UA((const uint8 *)ptr) : \ - 0xfeedf00d) - -#endif diff --git a/drivers/net/wireless/bcm4319/include/bcmpcispi.h b/drivers/net/wireless/bcm4319/include/bcmpcispi.h deleted file mode 100644 index 7d98fb7cbdc8..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmpcispi.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Broadcom PCI-SPI Host Controller Register Definitions - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmpcispi.h,v 13.11.8.3 2008/07/09 21:23:29 Exp $ - */ - -/* cpp contortions to concatenate w/arg prescan */ -#ifndef PAD -#define _PADLINE(line) pad ## line -#define _XSTR(line) _PADLINE(line) -#define PAD _XSTR(__LINE__) -#endif /* PAD */ - -/* -+---------------------------------------------------------------------------+ -| | -| 7 6 5 4 3 2 1 0 | -| 0x0000 SPI_CTRL SPIE SPE 0 MSTR CPOL CPHA SPR1 SPR0 | -| 0x0004 SPI_STAT SPIF WCOL ST1 ST0 WFFUL WFEMP RFFUL RFEMP | -| 0x0008 SPI_DATA Bits 31:0, data to send out on MOSI | -| 0x000C SPI_EXT ICNT1 ICNT0 BSWAP *HSMODE ESPR1 ESPR0 | -| 0x0020 GPIO_OE 0=input, 1=output PWR_OE CS_OE | -| 0x0024 GPIO_DATA CARD:1=missing, 0=present CARD PWR_DAT CS_DAT | -| 0x0040 INT_EDGE 0=level, 1=edge DEV_E SPI_E | -| 0x0044 INT_POL 1=active high, 0=active low DEV_P SPI_P | -| 0x0048 INTMASK DEV SPI | -| 0x004C INTSTATUS DEV SPI | -| 0x0060 HEXDISP Reset value: 0x14e443f5. In hexdisp mode, value | -| shows on the Raggedstone1 4-digit 7-segment display. | -| 0x0064 CURRENT_MA Low 16 bits indicate card current consumption in mA | -| 0x006C DISP_SEL Display mode (0=hexdisp, 1=current) DSP | -| 0x00C0 PLL_CTL bit31=ext_clk, remainder unused. | -| 0x00C4 PLL_STAT LOCK | -| 0x00C8 CLK_FREQ | -| 0x00CC CLK_CNT | -| | -| *Notes: HSMODE is not implemented, never set this bit! | -| BSWAP is available in rev >= 8 | -| | -+---------------------------------------------------------------------------+ -*/ - -typedef volatile struct { - uint32 spih_ctrl; /* 0x00 SPI Control Register */ - uint32 spih_stat; /* 0x04 SPI Status Register */ - uint32 spih_data; /* 0x08 SPI Data Register, 32-bits wide */ - uint32 spih_ext; /* 0x0C SPI Extension Register */ - uint32 PAD[4]; /* 0x10-0x1F PADDING */ - - uint32 spih_gpio_ctrl; /* 0x20 SPI GPIO Control Register */ - uint32 spih_gpio_data; /* 0x24 SPI GPIO Data Register */ - uint32 PAD[6]; /* 0x28-0x3F PADDING */ - - uint32 spih_int_edge; /* 0x40 SPI Interrupt Edge Register (0=Level, 1=Edge) */ - uint32 spih_int_pol; /* 0x44 SPI Interrupt Polarity Register (0=Active Low, */ - /* 1=Active High) */ - uint32 spih_int_mask; /* 0x48 SPI Interrupt Mask */ - uint32 spih_int_status; /* 0x4C SPI Interrupt Status */ - uint32 PAD[4]; /* 0x50-0x5F PADDING */ - - uint32 spih_hex_disp; /* 0x60 SPI 4-digit hex display value */ - uint32 spih_current_ma; /* 0x64 SPI SD card current consumption in mA */ - uint32 PAD[1]; /* 0x68 PADDING */ - uint32 spih_disp_sel; /* 0x6c SPI 4-digit hex display mode select (1=current) */ - uint32 PAD[4]; /* 0x70-0x7F PADDING */ - uint32 PAD[8]; /* 0x80-0x9F PADDING */ - uint32 PAD[8]; /* 0xA0-0xBF PADDING */ - uint32 spih_pll_ctrl; /* 0xC0 PLL Control Register */ - uint32 spih_pll_status; /* 0xC4 PLL Status Register */ - uint32 spih_xtal_freq; /* 0xC8 External Clock Frequency in units of 10000Hz */ - uint32 spih_clk_count; /* 0xCC External Clock Count Register */ - -} spih_regs_t; - -typedef volatile struct { - uint32 cfg_space[0x40]; /* 0x000-0x0FF PCI Configuration Space (Read Only) */ - uint32 P_IMG_CTRL0; /* 0x100 PCI Image0 Control Register */ - - uint32 P_BA0; /* 0x104 32 R/W PCI Image0 Base Address register */ - uint32 P_AM0; /* 0x108 32 R/W PCI Image0 Address Mask register */ - uint32 P_TA0; /* 0x10C 32 R/W PCI Image0 Translation Address register */ - uint32 P_IMG_CTRL1; /* 0x110 32 R/W PCI Image1 Control register */ - uint32 P_BA1; /* 0x114 32 R/W PCI Image1 Base Address register */ - uint32 P_AM1; /* 0x118 32 R/W PCI Image1 Address Mask register */ - uint32 P_TA1; /* 0x11C 32 R/W PCI Image1 Translation Address register */ - uint32 P_IMG_CTRL2; /* 0x120 32 R/W PCI Image2 Control register */ - uint32 P_BA2; /* 0x124 32 R/W PCI Image2 Base Address register */ - uint32 P_AM2; /* 0x128 32 R/W PCI Image2 Address Mask register */ - uint32 P_TA2; /* 0x12C 32 R/W PCI Image2 Translation Address register */ - uint32 P_IMG_CTRL3; /* 0x130 32 R/W PCI Image3 Control register */ - uint32 P_BA3; /* 0x134 32 R/W PCI Image3 Base Address register */ - uint32 P_AM3; /* 0x138 32 R/W PCI Image3 Address Mask register */ - uint32 P_TA3; /* 0x13C 32 R/W PCI Image3 Translation Address register */ - uint32 P_IMG_CTRL4; /* 0x140 32 R/W PCI Image4 Control register */ - uint32 P_BA4; /* 0x144 32 R/W PCI Image4 Base Address register */ - uint32 P_AM4; /* 0x148 32 R/W PCI Image4 Address Mask register */ - uint32 P_TA4; /* 0x14C 32 R/W PCI Image4 Translation Address register */ - uint32 P_IMG_CTRL5; /* 0x150 32 R/W PCI Image5 Control register */ - uint32 P_BA5; /* 0x154 32 R/W PCI Image5 Base Address register */ - uint32 P_AM5; /* 0x158 32 R/W PCI Image5 Address Mask register */ - uint32 P_TA5; /* 0x15C 32 R/W PCI Image5 Translation Address register */ - uint32 P_ERR_CS; /* 0x160 32 R/W PCI Error Control and Status register */ - uint32 P_ERR_ADDR; /* 0x164 32 R PCI Erroneous Address register */ - uint32 P_ERR_DATA; /* 0x168 32 R PCI Erroneous Data register */ - - uint32 PAD[5]; /* 0x16C-0x17F PADDING */ - - uint32 WB_CONF_SPC_BAR; /* 0x180 32 R WISHBONE Configuration Space Base Address */ - uint32 W_IMG_CTRL1; /* 0x184 32 R/W WISHBONE Image1 Control register */ - uint32 W_BA1; /* 0x188 32 R/W WISHBONE Image1 Base Address register */ - uint32 W_AM1; /* 0x18C 32 R/W WISHBONE Image1 Address Mask register */ - uint32 W_TA1; /* 0x190 32 R/W WISHBONE Image1 Translation Address reg */ - uint32 W_IMG_CTRL2; /* 0x194 32 R/W WISHBONE Image2 Control register */ - uint32 W_BA2; /* 0x198 32 R/W WISHBONE Image2 Base Address register */ - uint32 W_AM2; /* 0x19C 32 R/W WISHBONE Image2 Address Mask register */ - uint32 W_TA2; /* 0x1A0 32 R/W WISHBONE Image2 Translation Address reg */ - uint32 W_IMG_CTRL3; /* 0x1A4 32 R/W WISHBONE Image3 Control register */ - uint32 W_BA3; /* 0x1A8 32 R/W WISHBONE Image3 Base Address register */ - uint32 W_AM3; /* 0x1AC 32 R/W WISHBONE Image3 Address Mask register */ - uint32 W_TA3; /* 0x1B0 32 R/W WISHBONE Image3 Translation Address reg */ - uint32 W_IMG_CTRL4; /* 0x1B4 32 R/W WISHBONE Image4 Control register */ - uint32 W_BA4; /* 0x1B8 32 R/W WISHBONE Image4 Base Address register */ - uint32 W_AM4; /* 0x1BC 32 R/W WISHBONE Image4 Address Mask register */ - uint32 W_TA4; /* 0x1C0 32 R/W WISHBONE Image4 Translation Address reg */ - uint32 W_IMG_CTRL5; /* 0x1C4 32 R/W WISHBONE Image5 Control register */ - uint32 W_BA5; /* 0x1C8 32 R/W WISHBONE Image5 Base Address register */ - uint32 W_AM5; /* 0x1CC 32 R/W WISHBONE Image5 Address Mask register */ - uint32 W_TA5; /* 0x1D0 32 R/W WISHBONE Image5 Translation Address reg */ - uint32 W_ERR_CS; /* 0x1D4 32 R/W WISHBONE Error Control and Status reg */ - uint32 W_ERR_ADDR; /* 0x1D8 32 R WISHBONE Erroneous Address register */ - uint32 W_ERR_DATA; /* 0x1DC 32 R WISHBONE Erroneous Data register */ - uint32 CNF_ADDR; /* 0x1E0 32 R/W Configuration Cycle register */ - uint32 CNF_DATA; /* 0x1E4 32 R/W Configuration Cycle Generation Data reg */ - - uint32 INT_ACK; /* 0x1E8 32 R Interrupt Acknowledge register */ - uint32 ICR; /* 0x1EC 32 R/W Interrupt Control register */ - uint32 ISR; /* 0x1F0 32 R/W Interrupt Status register */ -} spih_pciregs_t; - -/* - * PCI Core interrupt enable and status bit definitions. - */ - -/* PCI Core ICR Register bit definitions */ -#define PCI_INT_PROP_EN (1 << 0) /* Interrupt Propagation Enable */ -#define PCI_WB_ERR_INT_EN (1 << 1) /* Wishbone Error Interrupt Enable */ -#define PCI_PCI_ERR_INT_EN (1 << 2) /* PCI Error Interrupt Enable */ -#define PCI_PAR_ERR_INT_EN (1 << 3) /* Parity Error Interrupt Enable */ -#define PCI_SYS_ERR_INT_EN (1 << 4) /* System Error Interrupt Enable */ -#define PCI_SOFTWARE_RESET (1U << 31) /* Software reset of the PCI Core. */ - - -/* PCI Core ISR Register bit definitions */ -#define PCI_INT_PROP_ST (1 << 0) /* Interrupt Propagation Status */ -#define PCI_WB_ERR_INT_ST (1 << 1) /* Wishbone Error Interrupt Status */ -#define PCI_PCI_ERR_INT_ST (1 << 2) /* PCI Error Interrupt Status */ -#define PCI_PAR_ERR_INT_ST (1 << 3) /* Parity Error Interrupt Status */ -#define PCI_SYS_ERR_INT_ST (1 << 4) /* System Error Interrupt Status */ - - -/* Registers on the Wishbone bus */ -#define SPIH_CTLR_INTR (1 << 0) /* SPI Host Controller Core Interrupt */ -#define SPIH_DEV_INTR (1 << 1) /* SPI Device Interrupt */ -#define SPIH_WFIFO_INTR (1 << 2) /* SPI Tx FIFO Empty Intr (FPGA Rev >= 8) */ - -/* GPIO Bit definitions */ -#define SPIH_CS (1 << 0) /* SPI Chip Select (active low) */ -#define SPIH_SLOT_POWER (1 << 1) /* SD Card Slot Power Enable */ -#define SPIH_CARD_DETECT (1 << 2) /* SD Card Detect */ - -/* SPI Status Register Bit definitions */ -#define SPIH_STATE_MASK 0x30 /* SPI Transfer State Machine state mask */ -#define SPIH_STATE_SHIFT 4 /* SPI Transfer State Machine state shift */ -#define SPIH_WFFULL (1 << 3) /* SPI Write FIFO Full */ -#define SPIH_WFEMPTY (1 << 2) /* SPI Write FIFO Empty */ -#define SPIH_RFFULL (1 << 1) /* SPI Read FIFO Full */ -#define SPIH_RFEMPTY (1 << 0) /* SPI Read FIFO Empty */ - -#define SPIH_EXT_CLK (1U << 31) /* Use External Clock as PLL Clock source. */ - -#define SPIH_PLL_NO_CLK (1 << 1) /* Set to 1 if the PLL's input clock is lost. */ -#define SPIH_PLL_LOCKED (1 << 3) /* Set to 1 when the PLL is locked. */ - -/* Spin bit loop bound check */ -#define SPI_SPIN_BOUND 0xf4240 /* 1 million */ diff --git a/drivers/net/wireless/bcm4319/include/bcmperf.h b/drivers/net/wireless/bcm4319/include/bcmperf.h deleted file mode 100644 index 2a78784e85d3..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmperf.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Performance counters software interface. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmperf.h,v 13.5 2007/09/14 22:00:59 Exp $ - */ -/* essai */ -#ifndef _BCMPERF_H_ -#define _BCMPERF_H_ -/* get cache hits and misses */ -#define BCMPERF_ENABLE_INSTRCOUNT() -#define BCMPERF_ENABLE_ICACHE_MISS() -#define BCMPERF_ENABLE_ICACHE_HIT() -#define BCMPERF_GETICACHE_MISS(x) ((x) = 0) -#define BCMPERF_GETICACHE_HIT(x) ((x) = 0) -#define BCMPERF_GETINSTRCOUNT(x) ((x) = 0) -#endif /* _BCMPERF_H_ */ diff --git a/drivers/net/wireless/bcm4319/include/bcmsdbus.h b/drivers/net/wireless/bcm4319/include/bcmsdbus.h deleted file mode 100644 index b7b67bc66248..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmsdbus.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Definitions for API from sdio common code (bcmsdh) to individual - * host controller drivers. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmsdbus.h,v 13.11.14.2.6.6 2009/10/27 17:20:28 Exp $ - */ - -#ifndef _sdio_api_h_ -#define _sdio_api_h_ - - -#define SDIOH_API_RC_SUCCESS (0x00) -#define SDIOH_API_RC_FAIL (0x01) -#define SDIOH_API_SUCCESS(status) (status == 0) - -#define SDIOH_READ 0 /* Read request */ -#define SDIOH_WRITE 1 /* Write request */ - -#define SDIOH_DATA_FIX 0 /* Fixed addressing */ -#define SDIOH_DATA_INC 1 /* Incremental addressing */ - -#define SDIOH_CMD_TYPE_NORMAL 0 /* Normal command */ -#define SDIOH_CMD_TYPE_APPEND 1 /* Append command */ -#define SDIOH_CMD_TYPE_CUTTHRU 2 /* Cut-through command */ - -#define SDIOH_DATA_PIO 0 /* PIO mode */ -#define SDIOH_DATA_DMA 1 /* DMA mode */ - - -typedef int SDIOH_API_RC; - -/* SDio Host structure */ -typedef struct sdioh_info sdioh_info_t; - -/* callback function, taking one arg */ -typedef void (*sdioh_cb_fn_t)(void *); - -/* attach, return handler on success, NULL if failed. - * The handler shall be provided by all subsequent calls. No local cache - * cfghdl points to the starting address of pci device mapped memory - */ -extern sdioh_info_t * sdioh_attach(osl_t *osh, void *cfghdl, uint irq); -extern SDIOH_API_RC sdioh_detach(osl_t *osh, sdioh_info_t *si); -extern SDIOH_API_RC sdioh_interrupt_register(sdioh_info_t *si, sdioh_cb_fn_t fn, void *argh); -extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *si); - -/* query whether SD interrupt is enabled or not */ -extern SDIOH_API_RC sdioh_interrupt_query(sdioh_info_t *si, bool *onoff); - -/* enable or disable SD interrupt */ -extern SDIOH_API_RC sdioh_interrupt_set(sdioh_info_t *si, bool enable_disable); - -#if defined(DHD_DEBUG) -extern bool sdioh_interrupt_pending(sdioh_info_t *si); -#endif - -/* read or write one byte using cmd52 */ -extern SDIOH_API_RC sdioh_request_byte(sdioh_info_t *si, uint rw, uint fnc, uint addr, uint8 *byte); - -/* read or write 2/4 bytes using cmd53 */ -extern SDIOH_API_RC sdioh_request_word(sdioh_info_t *si, uint cmd_type, uint rw, uint fnc, - uint addr, uint32 *word, uint nbyte); - -/* read or write any buffer using cmd53 */ -extern SDIOH_API_RC sdioh_request_buffer(sdioh_info_t *si, uint pio_dma, uint fix_inc, - uint rw, uint fnc_num, uint32 addr, uint regwidth, uint32 buflen, uint8 *buffer, - void *pkt); - -/* get cis data */ -extern SDIOH_API_RC sdioh_cis_read(sdioh_info_t *si, uint fuc, uint8 *cis, uint32 length); - -extern SDIOH_API_RC sdioh_cfg_read(sdioh_info_t *si, uint fuc, uint32 addr, uint8 *data); -extern SDIOH_API_RC sdioh_cfg_write(sdioh_info_t *si, uint fuc, uint32 addr, uint8 *data); - -/* query number of io functions */ -extern uint sdioh_query_iofnum(sdioh_info_t *si); - -/* handle iovars */ -extern int sdioh_iovar_op(sdioh_info_t *si, const char *name, - void *params, int plen, void *arg, int len, bool set); - -/* Issue abort to the specified function and clear controller as needed */ -extern int sdioh_abort(sdioh_info_t *si, uint fnc); - -/* Start and Stop SDIO without re-enumerating the SD card. */ -extern int sdioh_start(sdioh_info_t *si, int stage); -extern int sdioh_stop(sdioh_info_t *si); - -/* Reset and re-initialize the device */ -extern int sdioh_sdio_reset(sdioh_info_t *si); - -/* Helper function */ -void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh); - - - -#endif /* _sdio_api_h_ */ diff --git a/drivers/net/wireless/bcm4319/include/bcmsdh.h b/drivers/net/wireless/bcm4319/include/bcmsdh.h deleted file mode 100644 index f5dee5c58445..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmsdh.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * SDIO host client driver interface of Broadcom HNBU - * export functions to client drivers - * abstract OS and BUS specific details of SDIO - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmsdh.h,v 13.35.14.7.6.8 2009/10/14 04:22:25 Exp $ - */ - -#ifndef _bcmsdh_h_ -#define _bcmsdh_h_ - -#define BCMSDH_ERROR_VAL 0x0001 /* Error */ -#define BCMSDH_INFO_VAL 0x0002 /* Info */ -extern const uint bcmsdh_msglevel; - -#define BCMSDH_ERROR(x) -#define BCMSDH_INFO(x) - -/* forward declarations */ -typedef struct bcmsdh_info bcmsdh_info_t; -typedef void (*bcmsdh_cb_fn_t)(void *); - -/* Attach and build an interface to the underlying SD host driver. - * - Allocates resources (structs, arrays, mem, OS handles, etc) needed by bcmsdh. - * - Returns the bcmsdh handle and virtual address base for register access. - * The returned handle should be used in all subsequent calls, but the bcmsh - * implementation may maintain a single "default" handle (e.g. the first or - * most recent one) to enable single-instance implementations to pass NULL. - */ -extern bcmsdh_info_t *bcmsdh_attach(osl_t *osh, void *cfghdl, void **regsva, uint irq); - -/* Detach - freeup resources allocated in attach */ -extern int bcmsdh_detach(osl_t *osh, void *sdh); - -/* Query if SD device interrupts are enabled */ -extern bool bcmsdh_intr_query(void *sdh); - -/* Enable/disable SD interrupt */ -extern int bcmsdh_intr_enable(void *sdh); -extern int bcmsdh_intr_disable(void *sdh); - -/* Register/deregister device interrupt handler. */ -extern int bcmsdh_intr_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh); -extern int bcmsdh_intr_dereg(void *sdh); - -#if defined(DHD_DEBUG) -/* Query pending interrupt status from the host controller */ -extern bool bcmsdh_intr_pending(void *sdh); -#endif - -#ifdef BCMLXSDMMC -extern int bcmsdh_claim_host_and_lock(void *sdh); -extern int bcmsdh_release_host_and_unlock(void *sdh); -#endif /* BCMLXSDMMC */ - -/* Register a callback to be called if and when bcmsdh detects - * device removal. No-op in the case of non-removable/hardwired devices. - */ -extern int bcmsdh_devremove_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh); - -/* Access SDIO address space (e.g. CCCR) using CMD52 (single-byte interface). - * fn: function number - * addr: unmodified SDIO-space address - * data: data byte to write - * err: pointer to error code (or NULL) - */ -extern uint8 bcmsdh_cfg_read(void *sdh, uint func, uint32 addr, int *err); -extern void bcmsdh_cfg_write(void *sdh, uint func, uint32 addr, uint8 data, int *err); - -/* Read/Write 4bytes from/to cfg space */ -extern uint32 bcmsdh_cfg_read_word(void *sdh, uint fnc_num, uint32 addr, int *err); -extern void bcmsdh_cfg_write_word(void *sdh, uint fnc_num, uint32 addr, uint32 data, int *err); - -/* Read CIS content for specified function. - * fn: function whose CIS is being requested (0 is common CIS) - * cis: pointer to memory location to place results - * length: number of bytes to read - * Internally, this routine uses the values from the cis base regs (0x9-0xB) - * to form an SDIO-space address to read the data from. - */ -extern int bcmsdh_cis_read(void *sdh, uint func, uint8 *cis, uint length); - -/* Synchronous access to device (client) core registers via CMD53 to F1. - * addr: backplane address (i.e. >= regsva from attach) - * size: register width in bytes (2 or 4) - * data: data for register write - */ -extern uint32 bcmsdh_reg_read(void *sdh, uint32 addr, uint size); -extern uint32 bcmsdh_reg_write(void *sdh, uint32 addr, uint size, uint32 data); - -/* Indicate if last reg read/write failed */ -extern bool bcmsdh_regfail(void *sdh); - -/* Buffer transfer to/from device (client) core via cmd53. - * fn: function number - * addr: backplane address (i.e. >= regsva from attach) - * flags: backplane width, address increment, sync/async - * buf: pointer to memory data buffer - * nbytes: number of bytes to transfer to/from buf - * pkt: pointer to packet associated with buf (if any) - * complete: callback function for command completion (async only) - * handle: handle for completion callback (first arg in callback) - * Returns 0 or error code. - * NOTE: Async operation is not currently supported. - */ -typedef void (*bcmsdh_cmplt_fn_t)(void *handle, int status, bool sync_waiting); -extern int bcmsdh_send_buf(void *sdh, uint32 addr, uint fn, uint flags, - uint8 *buf, uint nbytes, void *pkt, - bcmsdh_cmplt_fn_t complete, void *handle); -extern int bcmsdh_recv_buf(void *sdh, uint32 addr, uint fn, uint flags, - uint8 *buf, uint nbytes, void *pkt, - bcmsdh_cmplt_fn_t complete, void *handle); - -/* Flags bits */ -#define SDIO_REQ_4BYTE 0x1 /* Four-byte target (backplane) width (vs. two-byte) */ -#define SDIO_REQ_FIXED 0x2 /* Fixed address (FIFO) (vs. incrementing address) */ -#define SDIO_REQ_ASYNC 0x4 /* Async request (vs. sync request) */ - -/* Pending (non-error) return code */ -#define BCME_PENDING 1 - -/* Read/write to memory block (F1, no FIFO) via CMD53 (sync only). - * rw: read or write (0/1) - * addr: direct SDIO address - * buf: pointer to memory data buffer - * nbytes: number of bytes to transfer to/from buf - * Returns 0 or error code. - */ -extern int bcmsdh_rwdata(void *sdh, uint rw, uint32 addr, uint8 *buf, uint nbytes); - -/* Issue an abort to the specified function */ -extern int bcmsdh_abort(void *sdh, uint fn); - -/* Start SDIO Host Controller communication */ -extern int bcmsdh_start(void *sdh, int stage); - -/* Stop SDIO Host Controller communication */ -extern int bcmsdh_stop(void *sdh); - -/* Returns the "Device ID" of target device on the SDIO bus. */ -extern int bcmsdh_query_device(void *sdh); - -/* Returns the number of IO functions reported by the device */ -extern uint bcmsdh_query_iofnum(void *sdh); - -/* Miscellaneous knob tweaker. */ -extern int bcmsdh_iovar_op(void *sdh, const char *name, - void *params, int plen, void *arg, int len, bool set); - -/* Reset and reinitialize the device */ -extern int bcmsdh_reset(bcmsdh_info_t *sdh); - -/* helper functions */ - -extern void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh); - -/* callback functions */ -typedef struct { - /* attach to device */ - void *(*attach)(uint16 vend_id, uint16 dev_id, uint16 bus, uint16 slot, - uint16 func, uint bustype, void * regsva, osl_t * osh, - void * param); - /* detach from device */ - void (*detach)(void *ch); -} bcmsdh_driver_t; - -/* platform specific/high level functions */ -extern int bcmsdh_register(bcmsdh_driver_t *driver); -extern void bcmsdh_unregister(void); -extern bool bcmsdh_chipmatch(uint16 vendor, uint16 device); -extern void bcmsdh_device_remove(void * sdh); - -#if defined(OOB_INTR_ONLY) -extern int bcmsdh_register_oob_intr(void * dhdp); -extern void bcmsdh_unregister_oob_intr(void); -extern void bcmsdh_oob_intr_set(bool enable); -#endif /* defined(OOB_INTR_ONLY) */ -/* Function to pass device-status bits to DHD. */ -extern uint32 bcmsdh_get_dstatus(void *sdh); - -/* Function to return current window addr */ -extern uint32 bcmsdh_cur_sbwad(void *sdh); - -/* Function to pass chipid and rev to lower layers for controlling pr's */ -extern void bcmsdh_chipinfo(void *sdh, uint32 chip, uint32 chiprev); - - -#endif /* _bcmsdh_h_ */ diff --git a/drivers/net/wireless/bcm4319/include/bcmsdh_sdmmc.h b/drivers/net/wireless/bcm4319/include/bcmsdh_sdmmc.h deleted file mode 100644 index 4e6d1b5bd94f..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmsdh_sdmmc.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmsdh_sdmmc.h,v 13.1.2.1.8.7 2009/10/27 18:22:52 Exp $ - */ - -#ifndef __BCMSDH_SDMMC_H__ -#define __BCMSDH_SDMMC_H__ - -#define sd_err(x) -#define sd_trace(x) -#define sd_info(x) -#define sd_debug(x) -#define sd_data(x) -#define sd_ctrl(x) - -#define sd_sync_dma(sd, read, nbytes) -#define sd_init_dma(sd) -#define sd_ack_intr(sd) -#define sd_wakeup(sd); - -/* Allocate/init/free per-OS private data */ -extern int sdioh_sdmmc_osinit(sdioh_info_t *sd); -extern void sdioh_sdmmc_osfree(sdioh_info_t *sd); - -#define sd_log(x) - -#define SDIOH_ASSERT(exp) \ - do { if (!(exp)) \ - printf("!!!ASSERT fail: file %s lines %d", __FILE__, __LINE__); \ - } while (0) - -#define BLOCK_SIZE_4318 64 -#define BLOCK_SIZE_4328 512 - -/* internal return code */ -#define SUCCESS 0 -#define ERROR 1 - -/* private bus modes */ -#define SDIOH_MODE_SD4 2 -#define CLIENT_INTR 0x100 /* Get rid of this! */ - -struct sdioh_info { - osl_t *osh; /* osh handler */ - bool client_intr_enabled; /* interrupt connnected flag */ - bool intr_handler_valid; /* client driver interrupt handler valid */ - sdioh_cb_fn_t intr_handler; /* registered interrupt handler */ - void *intr_handler_arg; /* argument to call interrupt handler */ - uint16 intmask; /* Current active interrupts */ - void *sdos_info; /* Pointer to per-OS private data */ - - uint irq; /* Client irq */ - int intrcount; /* Client interrupts */ - - bool sd_use_dma; /* DMA on CMD53 */ - bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */ - /* Must be on for sd_multiblock to be effective */ - bool use_client_ints; /* If this is false, make sure to restore */ - int sd_mode; /* SD1/SD4/SPI */ - int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */ - uint8 num_funcs; /* Supported funcs on client */ - uint32 com_cis_ptr; - uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS]; - uint max_dma_len; - uint max_dma_descriptors; /* DMA Descriptors supported by this controller. */ -// SDDMA_DESCRIPTOR SGList[32]; /* Scatter/Gather DMA List */ -}; - -/************************************************************ - * Internal interfaces: per-port references into bcmsdh_sdmmc.c - */ - -/* Global message bits */ -extern uint sd_msglevel; - -/* OS-independent interrupt handler */ -extern bool check_client_intr(sdioh_info_t *sd); - -/* Core interrupt enable/disable of device interrupts */ -extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd); -extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd); - - -/************************************************************** - * Internal interfaces: bcmsdh_sdmmc.c references to per-port code - */ - -/* Register mapping routines */ -extern uint32 *sdioh_sdmmc_reg_map(osl_t *osh, int32 addr, int size); -extern void sdioh_sdmmc_reg_unmap(osl_t *osh, int32 addr, int size); - -/* Interrupt (de)registration routines */ -extern int sdioh_sdmmc_register_irq(sdioh_info_t *sd, uint irq); -extern void sdioh_sdmmc_free_irq(uint irq, sdioh_info_t *sd); - -typedef struct _BCMSDH_SDMMC_INSTANCE { - sdioh_info_t *sd; - struct sdio_func *func[SDIOD_MAX_IOFUNCS]; -} BCMSDH_SDMMC_INSTANCE, *PBCMSDH_SDMMC_INSTANCE; - -#endif /* __BCMSDH_SDMMC_H__ */ diff --git a/drivers/net/wireless/bcm4319/include/bcmsdpcm.h b/drivers/net/wireless/bcm4319/include/bcmsdpcm.h deleted file mode 100644 index 77aca4500ad8..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmsdpcm.h +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Broadcom SDIO/PCMCIA - * Software-specific definitions shared between device and host side - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmsdpcm.h,v 1.1.2.4 2010/07/02 01:15:46 Exp $ - */ - -#ifndef _bcmsdpcm_h_ -#define _bcmsdpcm_h_ - -/* - * Software allocation of To SB Mailbox resources - */ - -/* intstatus bits */ -#define I_SMB_NAK I_SMB_SW0 /* To SB Mailbox Frame NAK */ -#define I_SMB_INT_ACK I_SMB_SW1 /* To SB Mailbox Host Interrupt ACK */ -#define I_SMB_USE_OOB I_SMB_SW2 /* To SB Mailbox Use OOB Wakeup */ -#define I_SMB_DEV_INT I_SMB_SW3 /* To SB Mailbox Miscellaneous Interrupt */ - -/* tosbmailbox bits corresponding to intstatus bits */ -#define SMB_NAK (1 << 0) /* To SB Mailbox Frame NAK */ -#define SMB_INT_ACK (1 << 1) /* To SB Mailbox Host Interrupt ACK */ -#define SMB_USE_OOB (1 << 2) /* To SB Mailbox Use OOB Wakeup */ -#define SMB_DEV_INT (1 << 3) /* To SB Mailbox Miscellaneous Interrupt */ -#define SMB_MASK 0x0000000f /* To SB Mailbox Mask */ - -/* tosbmailboxdata */ -#define SMB_DATA_VERSION_MASK 0x00ff0000 /* host protocol version (sent with F2 enable) */ -#define SMB_DATA_VERSION_SHIFT 16 /* host protocol version (sent with F2 enable) */ - -/* - * Software allocation of To Host Mailbox resources - */ - -/* intstatus bits */ -#define I_HMB_FC_STATE I_HMB_SW0 /* To Host Mailbox Flow Control State */ -#define I_HMB_FC_CHANGE I_HMB_SW1 /* To Host Mailbox Flow Control State Changed */ -#define I_HMB_FRAME_IND I_HMB_SW2 /* To Host Mailbox Frame Indication */ -#define I_HMB_HOST_INT I_HMB_SW3 /* To Host Mailbox Miscellaneous Interrupt */ - -/* tohostmailbox bits corresponding to intstatus bits */ -#define HMB_FC_ON (1 << 0) /* To Host Mailbox Flow Control State */ -#define HMB_FC_CHANGE (1 << 1) /* To Host Mailbox Flow Control State Changed */ -#define HMB_FRAME_IND (1 << 2) /* To Host Mailbox Frame Indication */ -#define HMB_HOST_INT (1 << 3) /* To Host Mailbox Miscellaneous Interrupt */ -#define HMB_MASK 0x0000000f /* To Host Mailbox Mask */ - -/* tohostmailboxdata */ -#define HMB_DATA_NAKHANDLED 1 /* we're ready to retransmit NAK'd frame to host */ -#define HMB_DATA_DEVREADY 2 /* we're ready to to talk to host after enable */ -#define HMB_DATA_FC 4 /* per prio flowcontrol update flag to host */ -#define HMB_DATA_FWREADY 8 /* firmware is ready for protocol activity */ - -#define HMB_DATA_FCDATA_MASK 0xff000000 /* per prio flowcontrol data */ -#define HMB_DATA_FCDATA_SHIFT 24 /* per prio flowcontrol data */ - -#define HMB_DATA_VERSION_MASK 0x00ff0000 /* device protocol version (with devready) */ -#define HMB_DATA_VERSION_SHIFT 16 /* device protocol version (with devready) */ - -/* - * Software-defined protocol header - */ - -/* Current protocol version */ -#define SDPCM_PROT_VERSION 4 - -/* SW frame header */ -#define SDPCM_SEQUENCE_MASK 0x000000ff /* Sequence Number Mask */ -#define SDPCM_PACKET_SEQUENCE(p) (((uint8 *)p)[0] & 0xff) /* p starts w/SW Header */ - -#define SDPCM_CHANNEL_MASK 0x00000f00 /* Channel Number Mask */ -#define SDPCM_CHANNEL_SHIFT 8 /* Channel Number Shift */ -#define SDPCM_PACKET_CHANNEL(p) (((uint8 *)p)[1] & 0x0f) /* p starts w/SW Header */ - -#define SDPCM_FLAGS_MASK 0x0000f000 /* Mask of flag bits */ -#define SDPCM_FLAGS_SHIFT 12 /* Flag bits shift */ -#define SDPCM_PACKET_FLAGS(p) ((((uint8 *)p)[1] & 0xf0) >> 4) /* p starts w/SW Header */ - -/* Next Read Len: lookahead length of next frame, in 16-byte units (rounded up) */ -#define SDPCM_NEXTLEN_MASK 0x00ff0000 /* Next Read Len Mask */ -#define SDPCM_NEXTLEN_SHIFT 16 /* Next Read Len Shift */ -#define SDPCM_NEXTLEN_VALUE(p) ((((uint8 *)p)[2] & 0xff) << 4) /* p starts w/SW Header */ -#define SDPCM_NEXTLEN_OFFSET 2 - -/* Data Offset from SOF (HW Tag, SW Tag, Pad) */ -#define SDPCM_DOFFSET_OFFSET 3 /* Data Offset */ -#define SDPCM_DOFFSET_VALUE(p) (((uint8 *)p)[SDPCM_DOFFSET_OFFSET] & 0xff) -#define SDPCM_DOFFSET_MASK 0xff000000 -#define SDPCM_DOFFSET_SHIFT 24 - -#define SDPCM_FCMASK_OFFSET 4 /* Flow control */ -#define SDPCM_FCMASK_VALUE(p) (((uint8 *)p)[SDPCM_FCMASK_OFFSET ] & 0xff) -#define SDPCM_WINDOW_OFFSET 5 /* Credit based fc */ -#define SDPCM_WINDOW_VALUE(p) (((uint8 *)p)[SDPCM_WINDOW_OFFSET] & 0xff) -#define SDPCM_VERSION_OFFSET 6 /* Version # */ -#define SDPCM_VERSION_VALUE(p) (((uint8 *)p)[SDPCM_VERSION_OFFSET] & 0xff) -#define SDPCM_UNUSED_OFFSET 7 /* Spare */ -#define SDPCM_UNUSED_VALUE(p) (((uint8 *)p)[SDPCM_UNUSED_OFFSET] & 0xff) - -#define SDPCM_SWHEADER_LEN 8 /* SW header is 64 bits */ - -/* logical channel numbers */ -#define SDPCM_CONTROL_CHANNEL 0 /* Control Request/Response Channel Id */ -#define SDPCM_EVENT_CHANNEL 1 /* Asyc Event Indication Channel Id */ -#define SDPCM_DATA_CHANNEL 2 /* Data Xmit/Recv Channel Id */ -#define SDPCM_GLOM_CHANNEL 3 /* For coalesced packets (superframes) */ -#define SDPCM_TEST_CHANNEL 15 /* Reserved for test/debug packets */ -#define SDPCM_MAX_CHANNEL 15 - -#define SDPCM_SEQUENCE_WRAP 256 /* wrap-around val for eight-bit frame seq number */ - -#define SDPCM_FLAG_RESVD0 0x01 -#define SDPCM_FLAG_RESVD1 0x02 -#define SDPCM_FLAG_GSPI_TXENAB 0x04 -#define SDPCM_FLAG_GLOMDESC 0x08 /* Superframe descriptor mask */ - -/* For GLOM_CHANNEL frames, use a flag to indicate descriptor frame */ -#define SDPCM_GLOMDESC_FLAG (SDPCM_FLAG_GLOMDESC << SDPCM_FLAGS_SHIFT) - -#define SDPCM_GLOMDESC(p) (((uint8 *)p)[1] & 0x80) - -/* For TEST_CHANNEL packets, define another 4-byte header */ -#define SDPCM_TEST_HDRLEN 4 /* Generally: Cmd(1), Ext(1), Len(2); - * Semantics of Ext byte depend on command. - * Len is current or requested frame length, not - * including test header; sent little-endian. - */ -#define SDPCM_TEST_DISCARD 0x01 /* Receiver discards. Ext is a pattern id. */ -#define SDPCM_TEST_ECHOREQ 0x02 /* Echo request. Ext is a pattern id. */ -#define SDPCM_TEST_ECHORSP 0x03 /* Echo response. Ext is a pattern id. */ -#define SDPCM_TEST_BURST 0x04 /* Receiver to send a burst. Ext is a frame count */ -#define SDPCM_TEST_SEND 0x05 /* Receiver sets send mode. Ext is boolean on/off */ - -/* Handy macro for filling in datagen packets with a pattern */ -#define SDPCM_TEST_FILL(byteno, id) ((uint8)(id + byteno)) - -/* - * Software counters (first part matches hardware counters) - */ - -typedef volatile struct { - uint32 cmd52rd; /* Cmd52RdCount, SDIO: cmd52 reads */ - uint32 cmd52wr; /* Cmd52WrCount, SDIO: cmd52 writes */ - uint32 cmd53rd; /* Cmd53RdCount, SDIO: cmd53 reads */ - uint32 cmd53wr; /* Cmd53WrCount, SDIO: cmd53 writes */ - uint32 abort; /* AbortCount, SDIO: aborts */ - uint32 datacrcerror; /* DataCrcErrorCount, SDIO: frames w/CRC error */ - uint32 rdoutofsync; /* RdOutOfSyncCount, SDIO/PCMCIA: Rd Frm out of sync */ - uint32 wroutofsync; /* RdOutOfSyncCount, SDIO/PCMCIA: Wr Frm out of sync */ - uint32 writebusy; /* WriteBusyCount, SDIO: device asserted "busy" */ - uint32 readwait; /* ReadWaitCount, SDIO: no data ready for a read cmd */ - uint32 readterm; /* ReadTermCount, SDIO: read frame termination cmds */ - uint32 writeterm; /* WriteTermCount, SDIO: write frames termination cmds */ - uint32 rxdescuflo; /* receive descriptor underflows */ - uint32 rxfifooflo; /* receive fifo overflows */ - uint32 txfifouflo; /* transmit fifo underflows */ - uint32 runt; /* runt (too short) frames recv'd from bus */ - uint32 badlen; /* frame's rxh len does not match its hw tag len */ - uint32 badcksum; /* frame's hw tag chksum doesn't agree with len value */ - uint32 seqbreak; /* break in sequence # space from one rx frame to the next */ - uint32 rxfcrc; /* frame rx header indicates crc error */ - uint32 rxfwoos; /* frame rx header indicates write out of sync */ - uint32 rxfwft; /* frame rx header indicates write frame termination */ - uint32 rxfabort; /* frame rx header indicates frame aborted */ - uint32 woosint; /* write out of sync interrupt */ - uint32 roosint; /* read out of sync interrupt */ - uint32 rftermint; /* read frame terminate interrupt */ - uint32 wftermint; /* write frame terminate interrupt */ -} sdpcmd_cnt_t; - -/* - * Register Access Macros - */ - -#define SDIODREV_IS(var, val) ((var) == (val)) -#define SDIODREV_GE(var, val) ((var) >= (val)) -#define SDIODREV_GT(var, val) ((var) > (val)) -#define SDIODREV_LT(var, val) ((var) < (val)) -#define SDIODREV_LE(var, val) ((var) <= (val)) - -#define SDIODDMAREG32(h, dir, chnl) \ - ((dir) == DMA_TX ? \ - (void *)(uintptr)&((h)->regs->dma.sdiod32.dma32regs[chnl].xmt) : \ - (void *)(uintptr)&((h)->regs->dma.sdiod32.dma32regs[chnl].rcv)) - -#define SDIODDMAREG64(h, dir, chnl) \ - ((dir) == DMA_TX ? \ - (void *)(uintptr)&((h)->regs->dma.sdiod64.dma64regs[chnl].xmt) : \ - (void *)(uintptr)&((h)->regs->dma.sdiod64.dma64regs[chnl].rcv)) - -#define SDIODDMAREG(h, dir, chnl) \ - (SDIODREV_LT((h)->corerev, 1) ? \ - SDIODDMAREG32((h), (dir), (chnl)) : \ - SDIODDMAREG64((h), (dir), (chnl))) - -#define PCMDDMAREG(h, dir, chnl) \ - ((dir) == DMA_TX ? \ - (void *)(uintptr)&((h)->regs->dma.pcm32.dmaregs.xmt) : \ - (void *)(uintptr)&((h)->regs->dma.pcm32.dmaregs.rcv)) - -#define SDPCMDMAREG(h, dir, chnl, coreid) \ - ((coreid) == SDIOD_CORE_ID ? \ - SDIODDMAREG(h, dir, chnl) : \ - PCMDDMAREG(h, dir, chnl)) - -#define SDIODFIFOREG(h, corerev) \ - (SDIODREV_LT((corerev), 1) ? \ - ((dma32diag_t *)(uintptr)&((h)->regs->dma.sdiod32.dmafifo)) : \ - ((dma32diag_t *)(uintptr)&((h)->regs->dma.sdiod64.dmafifo))) - -#define PCMDFIFOREG(h) \ - ((dma32diag_t *)(uintptr)&((h)->regs->dma.pcm32.dmafifo)) - -#define SDPCMFIFOREG(h, coreid, corerev) \ - ((coreid) == SDIOD_CORE_ID ? \ - SDIODFIFOREG(h, corerev) : \ - PCMDFIFOREG(h)) - -/* - * Shared structure between dongle and the host - * The structure contains pointers to trap or assert information shared with the host - */ -#define SDPCM_SHARED_VERSION 0x0002 -#define SDPCM_SHARED_VERSION_MASK 0x00FF -#define SDPCM_SHARED_ASSERT_BUILT 0x0100 -#define SDPCM_SHARED_ASSERT 0x0200 -#define SDPCM_SHARED_TRAP 0x0400 - -typedef struct { - uint32 flags; - uint32 trap_addr; - uint32 assert_exp_addr; - uint32 assert_file_addr; - uint32 assert_line; - uint32 console_addr; /* Address of hndrte_cons_t */ - uint32 msgtrace_addr; - uint8 tag[32]; -} sdpcm_shared_t; - -extern sdpcm_shared_t sdpcm_shared; - -#endif /* _bcmsdpcm_h_ */ diff --git a/drivers/net/wireless/bcm4319/include/bcmsdspi.h b/drivers/net/wireless/bcm4319/include/bcmsdspi.h deleted file mode 100644 index eaae10d8bf19..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmsdspi.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * SD-SPI Protocol Conversion - BCMSDH->SPI Translation Layer - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmsdspi.h,v 13.8.10.2 2008/06/30 21:09:40 Exp $ - */ - -/* global msglevel for debug messages - bitvals come from sdiovar.h */ - -#define sd_err(x) -#define sd_trace(x) -#define sd_info(x) -#define sd_debug(x) -#define sd_data(x) -#define sd_ctrl(x) - -#define sd_log(x) - -#define SDIOH_ASSERT(exp) \ - do { if (!(exp)) \ - printf("!!!ASSERT fail: file %s lines %d", __FILE__, __LINE__); \ - } while (0) - -#define BLOCK_SIZE_4318 64 -#define BLOCK_SIZE_4328 512 - -/* internal return code */ -#define SUCCESS 0 -#undef ERROR -#define ERROR 1 - -/* private bus modes */ -#define SDIOH_MODE_SPI 0 - -#define USE_BLOCKMODE 0x2 /* Block mode can be single block or multi */ -#define USE_MULTIBLOCK 0x4 - -struct sdioh_info { - uint cfg_bar; /* pci cfg address for bar */ - uint32 caps; /* cached value of capabilities reg */ - uint bar0; /* BAR0 for PCI Device */ - osl_t *osh; /* osh handler */ - void *controller; /* Pointer to SPI Controller's private data struct */ - - uint lockcount; /* nest count of sdspi_lock() calls */ - bool client_intr_enabled; /* interrupt connnected flag */ - bool intr_handler_valid; /* client driver interrupt handler valid */ - sdioh_cb_fn_t intr_handler; /* registered interrupt handler */ - void *intr_handler_arg; /* argument to call interrupt handler */ - bool initialized; /* card initialized */ - uint32 target_dev; /* Target device ID */ - uint32 intmask; /* Current active interrupts */ - void *sdos_info; /* Pointer to per-OS private data */ - - uint32 controller_type; /* Host controller type */ - uint8 version; /* Host Controller Spec Compliance Version */ - uint irq; /* Client irq */ - uint32 intrcount; /* Client interrupts */ - uint32 local_intrcount; /* Controller interrupts */ - bool host_init_done; /* Controller initted */ - bool card_init_done; /* Client SDIO interface initted */ - bool polled_mode; /* polling for command completion */ - - bool sd_use_dma; /* DMA on CMD53 */ - bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */ - /* Must be on for sd_multiblock to be effective */ - bool use_client_ints; /* If this is false, make sure to restore */ - bool got_hcint; /* Host Controller interrupt. */ - /* polling hack in wl_linux.c:wl_timer() */ - int adapter_slot; /* Maybe dealing with multiple slots/controllers */ - int sd_mode; /* SD1/SD4/SPI */ - int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */ - uint32 data_xfer_count; /* Current register transfer size */ - uint32 cmd53_wr_data; /* Used to pass CMD53 write data */ - uint32 card_response; /* Used to pass back response status byte */ - uint32 card_rsp_data; /* Used to pass back response data word */ - uint16 card_rca; /* Current Address */ - uint8 num_funcs; /* Supported funcs on client */ - uint32 com_cis_ptr; - uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS]; - void *dma_buf; - ulong dma_phys; - int r_cnt; /* rx count */ - int t_cnt; /* tx_count */ -}; - -/************************************************************ - * Internal interfaces: per-port references into bcmsdspi.c - */ - -/* Global message bits */ -extern uint sd_msglevel; - -/************************************************************** - * Internal interfaces: bcmsdspi.c references to per-port code - */ - -/* Register mapping routines */ -extern uint32 *spi_reg_map(osl_t *osh, uintptr addr, int size); -extern void spi_reg_unmap(osl_t *osh, uintptr addr, int size); - -/* Interrupt (de)registration routines */ -extern int spi_register_irq(sdioh_info_t *sd, uint irq); -extern void spi_free_irq(uint irq, sdioh_info_t *sd); - -/* OS-specific interrupt wrappers (atomic interrupt enable/disable) */ -extern void spi_lock(sdioh_info_t *sd); -extern void spi_unlock(sdioh_info_t *sd); - -/* Allocate/init/free per-OS private data */ -extern int spi_osinit(sdioh_info_t *sd); -extern void spi_osfree(sdioh_info_t *sd); diff --git a/drivers/net/wireless/bcm4319/include/bcmsdstd.h b/drivers/net/wireless/bcm4319/include/bcmsdstd.h deleted file mode 100644 index 974b3d41698d..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmsdstd.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - * 'Standard' SDIO HOST CONTROLLER driver - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmsdstd.h,v 13.16.18.1.16.3 2009/12/10 01:09:23 Exp $ - */ - -/* global msglevel for debug messages - bitvals come from sdiovar.h */ - -#define sd_err(x) do { if (sd_msglevel & SDH_ERROR_VAL) printf x; } while (0) -#define sd_trace(x) -#define sd_info(x) -#define sd_debug(x) -#define sd_data(x) -#define sd_ctrl(x) -#define sd_dma(x) - -#define sd_sync_dma(sd, read, nbytes) -#define sd_init_dma(sd) -#define sd_ack_intr(sd) -#define sd_wakeup(sd); -/* Allocate/init/free per-OS private data */ -extern int sdstd_osinit(sdioh_info_t *sd); -extern void sdstd_osfree(sdioh_info_t *sd); - -#define sd_log(x) - -#define SDIOH_ASSERT(exp) \ - do { if (!(exp)) \ - printf("!!!ASSERT fail: file %s lines %d", __FILE__, __LINE__); \ - } while (0) - -#define BLOCK_SIZE_4318 64 -#define BLOCK_SIZE_4328 512 - -/* internal return code */ -#define SUCCESS 0 -#define ERROR 1 - -/* private bus modes */ -#define SDIOH_MODE_SPI 0 -#define SDIOH_MODE_SD1 1 -#define SDIOH_MODE_SD4 2 - -#define MAX_SLOTS 6 /* For PCI: Only 6 BAR entries => 6 slots */ -#define SDIOH_REG_WINSZ 0x100 /* Number of registers in Standard Host Controller */ - -#define SDIOH_TYPE_ARASAN_HDK 1 -#define SDIOH_TYPE_BCM27XX 2 -#define SDIOH_TYPE_TI_PCIXX21 4 /* TI PCIxx21 Standard Host Controller */ -#define SDIOH_TYPE_RICOH_R5C822 5 /* Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter */ -#define SDIOH_TYPE_JMICRON 6 /* JMicron Standard SDIO Host Controller */ - -/* For linux, allow yielding for dongle */ -#define BCMSDYIELD - -/* Expected card status value for CMD7 */ -#define SDIOH_CMD7_EXP_STATUS 0x00001E00 - -#define RETRIES_LARGE 100000 -#define RETRIES_SMALL 100 - - -#define USE_BLOCKMODE 0x2 /* Block mode can be single block or multi */ -#define USE_MULTIBLOCK 0x4 - -#define USE_FIFO 0x8 /* Fifo vs non-fifo */ - -#define CLIENT_INTR 0x100 /* Get rid of this! */ - - -struct sdioh_info { - uint cfg_bar; /* pci cfg address for bar */ - uint32 caps; /* cached value of capabilities reg */ - uint32 curr_caps; /* max current capabilities reg */ - - osl_t *osh; /* osh handler */ - volatile char *mem_space; /* pci device memory va */ - uint lockcount; /* nest count of sdstd_lock() calls */ - bool client_intr_enabled; /* interrupt connnected flag */ - bool intr_handler_valid; /* client driver interrupt handler valid */ - sdioh_cb_fn_t intr_handler; /* registered interrupt handler */ - void *intr_handler_arg; /* argument to call interrupt handler */ - bool initialized; /* card initialized */ - uint target_dev; /* Target device ID */ - uint16 intmask; /* Current active interrupts */ - void *sdos_info; /* Pointer to per-OS private data */ - - uint32 controller_type; /* Host controller type */ - uint8 version; /* Host Controller Spec Compliance Version */ - uint irq; /* Client irq */ - int intrcount; /* Client interrupts */ - int local_intrcount; /* Controller interrupts */ - bool host_init_done; /* Controller initted */ - bool card_init_done; /* Client SDIO interface initted */ - bool polled_mode; /* polling for command completion */ - - bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */ - /* Must be on for sd_multiblock to be effective */ - bool use_client_ints; /* If this is false, make sure to restore */ - /* polling hack in wl_linux.c:wl_timer() */ - int adapter_slot; /* Maybe dealing with multiple slots/controllers */ - int sd_mode; /* SD1/SD4/SPI */ - int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */ - uint32 data_xfer_count; /* Current transfer */ - uint16 card_rca; /* Current Address */ - int8 sd_dma_mode; /* DMA Mode (PIO, SDMA, ... ADMA2) on CMD53 */ - uint8 num_funcs; /* Supported funcs on client */ - uint32 com_cis_ptr; - uint32 func_cis_ptr[SDIOD_MAX_IOFUNCS]; - void *dma_buf; /* DMA Buffer virtual address */ - ulong dma_phys; /* DMA Buffer physical address */ - void *adma2_dscr_buf; /* ADMA2 Descriptor Buffer virtual address */ - ulong adma2_dscr_phys; /* ADMA2 Descriptor Buffer physical address */ - - /* adjustments needed to make the dma align properly */ - void *dma_start_buf; - ulong dma_start_phys; - uint alloced_dma_size; - void *adma2_dscr_start_buf; - ulong adma2_dscr_start_phys; - uint alloced_adma2_dscr_size; - - int r_cnt; /* rx count */ - int t_cnt; /* tx_count */ - bool got_hcint; /* local interrupt flag */ - uint16 last_intrstatus; /* to cache intrstatus */ -}; - -#define DMA_MODE_NONE 0 -#define DMA_MODE_SDMA 1 -#define DMA_MODE_ADMA1 2 -#define DMA_MODE_ADMA2 3 -#define DMA_MODE_ADMA2_64 4 -#define DMA_MODE_AUTO -1 - -#define USE_DMA(sd) ((bool)((sd->sd_dma_mode > 0) ? TRUE : FALSE)) - -/* SDIO Host Control Register DMA Mode Definitions */ -#define SDIOH_SDMA_MODE 0 -#define SDIOH_ADMA1_MODE 1 -#define SDIOH_ADMA2_MODE 2 -#define SDIOH_ADMA2_64_MODE 3 - -#define ADMA2_ATTRIBUTE_VALID (1 << 0) /* ADMA Descriptor line valid */ -#define ADMA2_ATTRIBUTE_END (1 << 1) /* End of Descriptor */ -#define ADMA2_ATTRIBUTE_INT (1 << 2) /* Interrupt when line is done */ -#define ADMA2_ATTRIBUTE_ACT_NOP (0 << 4) /* Skip current line, go to next. */ -#define ADMA2_ATTRIBUTE_ACT_RSV (1 << 4) /* Same as NOP */ -#define ADMA1_ATTRIBUTE_ACT_SET (1 << 4) /* ADMA1 Only - set transfer length */ -#define ADMA2_ATTRIBUTE_ACT_TRAN (2 << 4) /* Transfer Data of one descriptor line. */ -#define ADMA2_ATTRIBUTE_ACT_LINK (3 << 4) /* Link Descriptor */ - -/* ADMA2 Descriptor Table Entry for 32-bit Address */ -typedef struct adma2_dscr_32b { - uint32 len_attr; - uint32 phys_addr; -} adma2_dscr_32b_t; - -/* ADMA1 Descriptor Table Entry */ -typedef struct adma1_dscr { - uint32 phys_addr_attr; -} adma1_dscr_t; - -/************************************************************ - * Internal interfaces: per-port references into bcmsdstd.c - */ - -/* Global message bits */ -extern uint sd_msglevel; - -/* OS-independent interrupt handler */ -extern bool check_client_intr(sdioh_info_t *sd); - -/* Core interrupt enable/disable of device interrupts */ -extern void sdstd_devintr_on(sdioh_info_t *sd); -extern void sdstd_devintr_off(sdioh_info_t *sd); - -/* Enable/disable interrupts for local controller events */ -extern void sdstd_intrs_on(sdioh_info_t *sd, uint16 norm, uint16 err); -extern void sdstd_intrs_off(sdioh_info_t *sd, uint16 norm, uint16 err); - -/* Wait for specified interrupt and error bits to be set */ -extern void sdstd_spinbits(sdioh_info_t *sd, uint16 norm, uint16 err); - - -/************************************************************** - * Internal interfaces: bcmsdstd.c references to per-port code - */ - -/* Register mapping routines */ -extern uint32 *sdstd_reg_map(osl_t *osh, int32 addr, int size); -extern void sdstd_reg_unmap(osl_t *osh, int32 addr, int size); - -/* Interrupt (de)registration routines */ -extern int sdstd_register_irq(sdioh_info_t *sd, uint irq); -extern void sdstd_free_irq(uint irq, sdioh_info_t *sd); - -/* OS-specific interrupt wrappers (atomic interrupt enable/disable) */ -extern void sdstd_lock(sdioh_info_t *sd); -extern void sdstd_unlock(sdioh_info_t *sd); - -/* OS-specific wait-for-interrupt-or-status */ -extern uint16 sdstd_waitbits(sdioh_info_t *sd, uint16 norm, uint16 err, bool yield); diff --git a/drivers/net/wireless/bcm4319/include/bcmspi.h b/drivers/net/wireless/bcm4319/include/bcmspi.h deleted file mode 100644 index 2e2bc935716f..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmspi.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Broadcom SPI Low-Level Hardware Driver API - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmspi.h,v 13.3.10.2 2008/06/30 21:09:40 Exp $ - */ - -extern void spi_devintr_off(sdioh_info_t *sd); -extern void spi_devintr_on(sdioh_info_t *sd); -extern bool spi_start_clock(sdioh_info_t *sd, uint16 new_sd_divisor); -extern bool spi_controller_highspeed_mode(sdioh_info_t *sd, bool hsmode); -extern bool spi_check_client_intr(sdioh_info_t *sd, int *is_dev_intr); -extern bool spi_hw_attach(sdioh_info_t *sd); -extern bool spi_hw_detach(sdioh_info_t *sd); -extern void spi_sendrecv(sdioh_info_t *sd, uint8 *msg_out, uint8 *msg_in, int msglen); -extern void spi_spinbits(sdioh_info_t *sd); -extern void spi_waitbits(sdioh_info_t *sd, bool yield); diff --git a/drivers/net/wireless/bcm4319/include/bcmspibrcm.h b/drivers/net/wireless/bcm4319/include/bcmspibrcm.h deleted file mode 100644 index 9dce878d11e2..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmspibrcm.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * SD-SPI Protocol Conversion - BCMSDH->gSPI Translation Layer - * - * Copyright (C) 2010, Broadcom Corporation - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; - * the contents of this file may not be disclosed to third parties, copied - * or duplicated in any form, in whole or in part, without the prior - * written permission of Broadcom Corporation. - * - * $Id: bcmspibrcm.h,v 1.4.4.1.4.3.6.1 2008/09/27 17:03:25 Exp $ - */ - -/* global msglevel for debug messages - bitvals come from sdiovar.h */ - -#define sd_err(x) -#define sd_trace(x) -#define sd_info(x) -#define sd_debug(x) -#define sd_data(x) -#define sd_ctrl(x) - -#define sd_log(x) - -#define SDIOH_ASSERT(exp) \ - do { if (!(exp)) \ - printf("!!!ASSERT fail: file %s lines %d", __FILE__, __LINE__); \ - } while (0) - -#define BLOCK_SIZE_F1 64 -#define BLOCK_SIZE_F2 2048 -#define BLOCK_SIZE_F3 2048 - -/* internal return code */ -#define SUCCESS 0 -#undef ERROR -#define ERROR 1 -#define ERROR_UF 2 -#define ERROR_OF 3 - -/* private bus modes */ -#define SDIOH_MODE_SPI 0 - -#define USE_BLOCKMODE 0x2 /* Block mode can be single block or multi */ -#define USE_MULTIBLOCK 0x4 - -struct sdioh_info { - uint cfg_bar; /* pci cfg address for bar */ - uint32 caps; /* cached value of capabilities reg */ - void *bar0; /* BAR0 for PCI Device */ - osl_t *osh; /* osh handler */ - void *controller; /* Pointer to SPI Controller's private data struct */ - - uint lockcount; /* nest count of spi_lock() calls */ - bool client_intr_enabled; /* interrupt connnected flag */ - bool intr_handler_valid; /* client driver interrupt handler valid */ - sdioh_cb_fn_t intr_handler; /* registered interrupt handler */ - void *intr_handler_arg; /* argument to call interrupt handler */ - bool initialized; /* card initialized */ - uint32 target_dev; /* Target device ID */ - uint32 intmask; /* Current active interrupts */ - void *sdos_info; /* Pointer to per-OS private data */ - - uint32 controller_type; /* Host controller type */ - uint8 version; /* Host Controller Spec Compliance Version */ - uint irq; /* Client irq */ - uint32 intrcount; /* Client interrupts */ - uint32 local_intrcount; /* Controller interrupts */ - bool host_init_done; /* Controller initted */ - bool card_init_done; /* Client SDIO interface initted */ - bool polled_mode; /* polling for command completion */ - - bool sd_use_dma; /* DMA on CMD53 */ - bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */ - /* Must be on for sd_multiblock to be effective */ - bool use_client_ints; /* If this is false, make sure to restore */ - /* polling hack in wl_linux.c:wl_timer() */ - int adapter_slot; /* Maybe dealing with multiple slots/controllers */ - int sd_mode; /* SD1/SD4/SPI */ - int client_block_size[SPI_MAX_IOFUNCS]; /* Blocksize */ - uint32 data_xfer_count; /* Current transfer */ - uint16 card_rca; /* Current Address */ - uint8 num_funcs; /* Supported funcs on client */ - uint32 card_dstatus; /* 32bit device status */ - uint32 com_cis_ptr; - uint32 func_cis_ptr[SPI_MAX_IOFUNCS]; - void *dma_buf; - ulong dma_phys; - int r_cnt; /* rx count */ - int t_cnt; /* tx_count */ - uint32 wordlen; /* host processor 16/32bits */ - uint32 prev_fun; - uint32 chip; - uint32 chiprev; - bool resp_delay_all; - bool dwordmode; - - struct spierrstats_t spierrstats; -}; - -/************************************************************ - * Internal interfaces: per-port references into bcmspibrcm.c - */ - -/* Global message bits */ -extern uint sd_msglevel; - -/************************************************************** - * Internal interfaces: bcmspibrcm.c references to per-port code - */ - -/* Interrupt (de)registration routines */ -extern int spi_register_irq(sdioh_info_t *sd, uint irq); -extern void spi_free_irq(uint irq, sdioh_info_t *sd); - -/* OS-specific interrupt wrappers (atomic interrupt enable/disable) */ -extern void spi_lock(sdioh_info_t *sd); -extern void spi_unlock(sdioh_info_t *sd); - -/* Allocate/init/free per-OS private data */ -extern int spi_osinit(sdioh_info_t *sd); -extern void spi_osfree(sdioh_info_t *sd); - -#define SPI_RW_FLAG_M BITFIELD_MASK(1) /* Bit [31] - R/W Command Bit */ -#define SPI_RW_FLAG_S 31 -#define SPI_ACCESS_M BITFIELD_MASK(1) /* Bit [30] - Fixed/Incr Access */ -#define SPI_ACCESS_S 30 -#define SPI_FUNCTION_M BITFIELD_MASK(2) /* Bit [29:28] - Function Number */ -#define SPI_FUNCTION_S 28 -#define SPI_REG_ADDR_M BITFIELD_MASK(17) /* Bit [27:11] - Address */ -#define SPI_REG_ADDR_S 11 -#define SPI_LEN_M BITFIELD_MASK(11) /* Bit [10:0] - Packet length */ -#define SPI_LEN_S 0 diff --git a/drivers/net/wireless/bcm4319/include/bcmutils.h b/drivers/net/wireless/bcm4319/include/bcmutils.h deleted file mode 100644 index f85ed351d663..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmutils.h +++ /dev/null @@ -1,637 +0,0 @@ -/* - * Misc useful os-independent macros and functions. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * $Id: bcmutils.h,v 13.184.4.6.2.1.18.25 2010/04/26 06:05:24 Exp $ - */ - - -#ifndef _bcmutils_h_ -#define _bcmutils_h_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#define _BCM_U 0x01 -#define _BCM_L 0x02 -#define _BCM_D 0x04 -#define _BCM_C 0x08 -#define _BCM_P 0x10 -#define _BCM_S 0x20 -#define _BCM_X 0x40 -#define _BCM_SP 0x80 - -extern const unsigned char bcm_ctype[]; -#define bcm_ismask(x) (bcm_ctype[(int)(unsigned char)(x)]) - -#define bcm_isalnum(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L|_BCM_D)) != 0) -#define bcm_isalpha(c) ((bcm_ismask(c)&(_BCM_U|_BCM_L)) != 0) -#define bcm_iscntrl(c) ((bcm_ismask(c)&(_BCM_C)) != 0) -#define bcm_isdigit(c) ((bcm_ismask(c)&(_BCM_D)) != 0) -#define bcm_isgraph(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D)) != 0) -#define bcm_islower(c) ((bcm_ismask(c)&(_BCM_L)) != 0) -#define bcm_isprint(c) ((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D|_BCM_SP)) != 0) -#define bcm_ispunct(c) ((bcm_ismask(c)&(_BCM_P)) != 0) -#define bcm_isspace(c) ((bcm_ismask(c)&(_BCM_S)) != 0) -#define bcm_isupper(c) ((bcm_ismask(c)&(_BCM_U)) != 0) -#define bcm_isxdigit(c) ((bcm_ismask(c)&(_BCM_D|_BCM_X)) != 0) -#define bcm_tolower(c) (bcm_isupper((c)) ? ((c) + 'a' - 'A') : (c)) -#define bcm_toupper(c) (bcm_islower((c)) ? ((c) + 'A' - 'a') : (c)) - - - -struct bcmstrbuf { - char *buf; - unsigned int size; - char *origbuf; - unsigned int origsize; -}; - - -#ifdef BCMDRIVER -#include - -#define GPIO_PIN_NOTDEFINED 0x20 - - -#define SPINWAIT(exp, us) { \ - uint countdown = (us) + 9; \ - while ((exp) && (countdown >= 10)) {\ - OSL_DELAY(10); \ - countdown -= 10; \ - } \ -} - - - -#ifndef PKTQ_LEN_DEFAULT -#define PKTQ_LEN_DEFAULT 128 -#endif -#ifndef PKTQ_MAX_PREC -#define PKTQ_MAX_PREC 16 -#endif - -typedef struct pktq_prec { - void *head; - void *tail; - uint16 len; - uint16 max; -} pktq_prec_t; - - - -struct pktq { - uint16 num_prec; - uint16 hi_prec; - uint16 max; - uint16 len; - - struct pktq_prec q[PKTQ_MAX_PREC]; -}; - - -struct spktq { - uint16 num_prec; - uint16 hi_prec; - uint16 max; - uint16 len; - - struct pktq_prec q[1]; -}; - -#define PKTQ_PREC_ITER(pq, prec) for (prec = (pq)->num_prec - 1; prec >= 0; prec--) - - - - -struct ether_addr; - -extern int ether_isbcast(const void *ea); -extern int ether_isnulladdr(const void *ea); - - - -#define pktq_psetmax(pq, prec, _max) ((pq)->q[prec].max = (_max)) -#define pktq_plen(pq, prec) ((pq)->q[prec].len) -#define pktq_pavail(pq, prec) ((pq)->q[prec].max - (pq)->q[prec].len) -#define pktq_pfull(pq, prec) ((pq)->q[prec].len >= (pq)->q[prec].max) -#define pktq_pempty(pq, prec) ((pq)->q[prec].len == 0) - -#define pktq_ppeek(pq, prec) ((pq)->q[prec].head) -#define pktq_ppeek_tail(pq, prec) ((pq)->q[prec].tail) - -extern void *pktq_penq(struct pktq *pq, int prec, void *p); -extern void *pktq_penq_head(struct pktq *pq, int prec, void *p); -extern void *pktq_pdeq(struct pktq *pq, int prec); -extern void *pktq_pdeq_tail(struct pktq *pq, int prec); - -extern bool pktq_pdel(struct pktq *pq, void *p, int prec); - - -extern void pktq_pflush(osl_t *osh, struct pktq *pq, int prec, bool dir); - -extern void pktq_flush(osl_t *osh, struct pktq *pq, bool dir); - - - -extern int pktq_mlen(struct pktq *pq, uint prec_bmp); -extern void *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out); - - - -#define pktq_len(pq) ((int)(pq)->len) -#define pktq_max(pq) ((int)(pq)->max) -#define pktq_avail(pq) ((int)((pq)->max - (pq)->len)) -#define pktq_full(pq) ((pq)->len >= (pq)->max) -#define pktq_empty(pq) ((pq)->len == 0) - - -#define pktenq(pq, p) pktq_penq(((struct pktq *)pq), 0, (p)) -#define pktenq_head(pq, p) pktq_penq_head(((struct pktq *)pq), 0, (p)) -#define pktdeq(pq) pktq_pdeq(((struct pktq *)pq), 0) -#define pktdeq_tail(pq) pktq_pdeq_tail(((struct pktq *)pq), 0) -#define pktqinit(pq, len) pktq_init(((struct pktq *)pq), 1, len) - -extern void pktq_init(struct pktq *pq, int num_prec, int max_len); - -extern void *pktq_deq(struct pktq *pq, int *prec_out); -extern void *pktq_deq_tail(struct pktq *pq, int *prec_out); -extern void *pktq_peek(struct pktq *pq, int *prec_out); -extern void *pktq_peek_tail(struct pktq *pq, int *prec_out); - - - -extern uint pktcopy(osl_t *osh, void *p, uint offset, int len, uchar *buf); -extern uint pktfrombuf(osl_t *osh, void *p, uint offset, int len, uchar *buf); -extern uint pkttotlen(osl_t *osh, void *p); -extern void *pktlast(osl_t *osh, void *p); -extern uint pktsegcnt(osl_t *osh, void *p); - - -extern uint pktsetprio(void *pkt, bool update_vtag); -#define PKTPRIO_VDSCP 0x100 -#define PKTPRIO_VLAN 0x200 -#define PKTPRIO_UPD 0x400 -#define PKTPRIO_DSCP 0x800 - - -extern int bcm_atoi(char *s); -extern ulong bcm_strtoul(char *cp, char **endp, uint base); -extern char *bcmstrstr(char *haystack, char *needle); -extern char *bcmstrcat(char *dest, const char *src); -extern char *bcmstrncat(char *dest, const char *src, uint size); -extern ulong wchar2ascii(char *abuf, ushort *wbuf, ushort wbuflen, ulong abuflen); -char* bcmstrtok(char **string, const char *delimiters, char *tokdelim); -int bcmstricmp(const char *s1, const char *s2); -int bcmstrnicmp(const char* s1, const char* s2, int cnt); - - - -extern char *bcm_ether_ntoa(const struct ether_addr *ea, char *buf); -extern int bcm_ether_atoe(char *p, struct ether_addr *ea); - - -struct ipv4_addr; -extern char *bcm_ip_ntoa(struct ipv4_addr *ia, char *buf); - - -extern void bcm_mdelay(uint ms); - -extern char *getvar(char *vars, const char *name); -extern int getintvar(char *vars, const char *name); -extern uint getgpiopin(char *vars, char *pin_name, uint def_pin); -#define bcm_perf_enable() -#define bcmstats(fmt) -#define bcmlog(fmt, a1, a2) -#define bcmdumplog(buf, size) *buf = '\0' -#define bcmdumplogent(buf, idx) -1 - -#define bcmtslog(tstamp, fmt, a1, a2) -#define bcmprinttslogs() -#define bcmprinttstamp(us) - - - - -typedef struct bcm_iovar { - const char *name; - uint16 varid; - uint16 flags; - uint16 type; - uint16 minlen; -} bcm_iovar_t; - - - - -#define IOV_GET 0 -#define IOV_SET 1 - - -#define IOV_GVAL(id) ((id)*2) -#define IOV_SVAL(id) (((id)*2)+IOV_SET) -#define IOV_ISSET(actionid) ((actionid & IOV_SET) == IOV_SET) - - - -extern const bcm_iovar_t *bcm_iovar_lookup(const bcm_iovar_t *table, const char *name); -extern int bcm_iovar_lencheck(const bcm_iovar_t *table, void *arg, int len, bool set); - -#endif - - -#define IOVT_VOID 0 -#define IOVT_BOOL 1 -#define IOVT_INT8 2 -#define IOVT_UINT8 3 -#define IOVT_INT16 4 -#define IOVT_UINT16 5 -#define IOVT_INT32 6 -#define IOVT_UINT32 7 -#define IOVT_BUFFER 8 -#define BCM_IOVT_VALID(type) (((unsigned int)(type)) <= IOVT_BUFFER) - - -#define BCM_IOV_TYPE_INIT { \ - "void", \ - "bool", \ - "int8", \ - "uint8", \ - "int16", \ - "uint16", \ - "int32", \ - "uint32", \ - "buffer", \ - "" } - -#define BCM_IOVT_IS_INT(type) (\ - (type == IOVT_BOOL) || \ - (type == IOVT_INT8) || \ - (type == IOVT_UINT8) || \ - (type == IOVT_INT16) || \ - (type == IOVT_UINT16) || \ - (type == IOVT_INT32) || \ - (type == IOVT_UINT32)) - - - -#define BCME_STRLEN 64 -#define VALID_BCMERROR(e) ((e <= 0) && (e >= BCME_LAST)) - - - - -#define BCME_OK 0 -#define BCME_ERROR -1 -#define BCME_BADARG -2 -#define BCME_BADOPTION -3 -#define BCME_NOTUP -4 -#define BCME_NOTDOWN -5 -#define BCME_NOTAP -6 -#define BCME_NOTSTA -7 -#define BCME_BADKEYIDX -8 -#define BCME_RADIOOFF -9 -#define BCME_NOTBANDLOCKED -10 -#define BCME_NOCLK -11 -#define BCME_BADRATESET -12 -#define BCME_BADBAND -13 -#define BCME_BUFTOOSHORT -14 -#define BCME_BUFTOOLONG -15 -#define BCME_BUSY -16 -#define BCME_NOTASSOCIATED -17 -#define BCME_BADSSIDLEN -18 -#define BCME_OUTOFRANGECHAN -19 -#define BCME_BADCHAN -20 -#define BCME_BADADDR -21 -#define BCME_NORESOURCE -22 -#define BCME_UNSUPPORTED -23 -#define BCME_BADLEN -24 -#define BCME_NOTREADY -25 -#define BCME_EPERM -26 -#define BCME_NOMEM -27 -#define BCME_ASSOCIATED -28 -#define BCME_RANGE -29 -#define BCME_NOTFOUND -30 -#define BCME_WME_NOT_ENABLED -31 -#define BCME_TSPEC_NOTFOUND -32 -#define BCME_ACM_NOTSUPPORTED -33 -#define BCME_NOT_WME_ASSOCIATION -34 -#define BCME_SDIO_ERROR -35 -#define BCME_DONGLE_DOWN -36 -#define BCME_VERSION -37 -#define BCME_TXFAIL -38 -#define BCME_RXFAIL -39 -#define BCME_NODEVICE -40 -#define BCME_UNFINISHED -41 -#define BCME_LAST BCME_UNFINISHED - - -#define BCMERRSTRINGTABLE { \ - "OK", \ - "Undefined error", \ - "Bad Argument", \ - "Bad Option", \ - "Not up", \ - "Not down", \ - "Not AP", \ - "Not STA", \ - "Bad Key Index", \ - "Radio Off", \ - "Not band locked", \ - "No clock", \ - "Bad Rate valueset", \ - "Bad Band", \ - "Buffer too short", \ - "Buffer too long", \ - "Busy", \ - "Not Associated", \ - "Bad SSID len", \ - "Out of Range Channel", \ - "Bad Channel", \ - "Bad Address", \ - "Not Enough Resources", \ - "Unsupported", \ - "Bad length", \ - "Not Ready", \ - "Not Permitted", \ - "No Memory", \ - "Associated", \ - "Not In Range", \ - "Not Found", \ - "WME Not Enabled", \ - "TSPEC Not Found", \ - "ACM Not Supported", \ - "Not WME Association", \ - "SDIO Bus Error", \ - "Dongle Not Accessible", \ - "Incorrect version", \ - "TX Failure", \ - "RX Failure", \ - "Device Not Present", \ - "Command not finished", \ -} - -#ifndef ABS -#define ABS(a) (((a) < 0)?-(a):(a)) -#endif - -#ifndef MIN -#define MIN(a, b) (((a) < (b))?(a):(b)) -#endif - -#ifndef MAX -#define MAX(a, b) (((a) > (b))?(a):(b)) -#endif - -#define CEIL(x, y) (((x) + ((y)-1)) / (y)) -#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y)) -#define ISALIGNED(a, x) (((a) & ((x)-1)) == 0) -#define ALIGN_ADDR(addr, boundary) (void *)(((uintptr)(addr) + (boundary) - 1) \ - & ~((boundary) - 1)) -#define ISPOWEROF2(x) ((((x)-1)&(x)) == 0) -#define VALID_MASK(mask) !((mask) & ((mask) + 1)) -#ifndef OFFSETOF -#define OFFSETOF(type, member) ((uint)(uintptr)&((type *)0)->member) -#endif -#ifndef ARRAYSIZE -#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0])) -#endif - - -#ifndef setbit -#ifndef NBBY -#define NBBY 8 -#endif -#define setbit(a, i) (((uint8 *)a)[(i)/NBBY] |= 1<<((i)%NBBY)) -#define clrbit(a, i) (((uint8 *)a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) -#define isset(a, i) (((const uint8 *)a)[(i)/NBBY] & (1<<((i)%NBBY))) -#define isclr(a, i) ((((const uint8 *)a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) -#endif - -#define NBITS(type) (sizeof(type) * 8) -#define NBITVAL(nbits) (1 << (nbits)) -#define MAXBITVAL(nbits) ((1 << (nbits)) - 1) -#define NBITMASK(nbits) MAXBITVAL(nbits) -#define MAXNBVAL(nbyte) MAXBITVAL((nbyte) * 8) - - -#define MUX(pred, true, false) ((pred) ? (true) : (false)) - - -#define MODDEC(x, bound) MUX((x) == 0, (bound) - 1, (x) - 1) -#define MODINC(x, bound) MUX((x) == (bound) - 1, 0, (x) + 1) - - -#define MODDEC_POW2(x, bound) (((x) - 1) & ((bound) - 1)) -#define MODINC_POW2(x, bound) (((x) + 1) & ((bound) - 1)) - - -#define MODADD(x, y, bound) \ - MUX((x) + (y) >= (bound), (x) + (y) - (bound), (x) + (y)) -#define MODSUB(x, y, bound) \ - MUX(((int)(x)) - ((int)(y)) < 0, (x) - (y) + (bound), (x) - (y)) - - -#define MODADD_POW2(x, y, bound) (((x) + (y)) & ((bound) - 1)) -#define MODSUB_POW2(x, y, bound) (((x) - (y)) & ((bound) - 1)) - - -#define CRC8_INIT_VALUE 0xff -#define CRC8_GOOD_VALUE 0x9f -#define CRC16_INIT_VALUE 0xffff -#define CRC16_GOOD_VALUE 0xf0b8 -#define CRC32_INIT_VALUE 0xffffffff -#define CRC32_GOOD_VALUE 0xdebb20e3 - - -typedef struct bcm_bit_desc { - uint32 bit; - const char* name; -} bcm_bit_desc_t; - - -typedef struct bcm_tlv { - uint8 id; - uint8 len; - uint8 data[1]; -} bcm_tlv_t; - - -#define bcm_valid_tlv(elt, buflen) ((buflen) >= 2 && (int)(buflen) >= (int)(2 + (elt)->len)) - - -#define ETHER_ADDR_STR_LEN 18 - - -#ifdef IL_BIGENDIAN -static INLINE uint32 -load32_ua(uint8 *a) -{ - return ((a[0] << 24) | (a[1] << 16) | (a[2] << 8) | a[3]); -} - -static INLINE void -store32_ua(uint8 *a, uint32 v) -{ - a[0] = (v >> 24) & 0xff; - a[1] = (v >> 16) & 0xff; - a[2] = (v >> 8) & 0xff; - a[3] = v & 0xff; -} - -static INLINE uint16 -load16_ua(uint8 *a) -{ - return ((a[0] << 8) | a[1]); -} - -static INLINE void -store16_ua(uint8 *a, uint16 v) -{ - a[0] = (v >> 8) & 0xff; - a[1] = v & 0xff; -} - -#else - -static INLINE uint32 -load32_ua(uint8 *a) -{ - return ((a[3] << 24) | (a[2] << 16) | (a[1] << 8) | a[0]); -} - -static INLINE void -store32_ua(uint8 *a, uint32 v) -{ - a[3] = (v >> 24) & 0xff; - a[2] = (v >> 16) & 0xff; - a[1] = (v >> 8) & 0xff; - a[0] = v & 0xff; -} - -static INLINE uint16 -load16_ua(uint8 *a) -{ - return ((a[1] << 8) | a[0]); -} - -static INLINE void -store16_ua(uint8 *a, uint16 v) -{ - a[1] = (v >> 8) & 0xff; - a[0] = v & 0xff; -} - -#endif - - - -static INLINE void -xor_128bit_block(const uint8 *src1, const uint8 *src2, uint8 *dst) -{ - if ( -#ifdef __i386__ - 1 || -#endif - (((uintptr)src1 | (uintptr)src2 | (uintptr)dst) & 3) == 0) { - - - ((uint32 *)dst)[0] = ((uint32 *)src1)[0] ^ ((uint32 *)src2)[0]; - ((uint32 *)dst)[1] = ((uint32 *)src1)[1] ^ ((uint32 *)src2)[1]; - ((uint32 *)dst)[2] = ((uint32 *)src1)[2] ^ ((uint32 *)src2)[2]; - ((uint32 *)dst)[3] = ((uint32 *)src1)[3] ^ ((uint32 *)src2)[3]; - } else { - - int k; - for (k = 0; k < 16; k++) - dst[k] = src1[k] ^ src2[k]; - } -} - - - -extern uint8 hndcrc8(uint8 *p, uint nbytes, uint8 crc); -extern uint16 hndcrc16(uint8 *p, uint nbytes, uint16 crc); -extern uint32 hndcrc32(uint8 *p, uint nbytes, uint32 crc); - -#if defined(DHD_DEBUG) || defined(WLMSG_PRHDRS) || defined(WLMSG_PRPKT) || \ - defined(WLMSG_ASSOC) -extern int bcm_format_flags(const bcm_bit_desc_t *bd, uint32 flags, char* buf, int len); -extern int bcm_format_hex(char *str, const void *bytes, int len); -extern void prhex(const char *msg, uchar *buf, uint len); -#endif -extern char *bcm_brev_str(uint32 brev, char *buf); -extern void printbig(char *buf); - - -extern bcm_tlv_t *bcm_next_tlv(bcm_tlv_t *elt, int *buflen); -extern bcm_tlv_t *bcm_parse_tlvs(void *buf, int buflen, uint key); -extern bcm_tlv_t *bcm_parse_ordered_tlvs(void *buf, int buflen, uint key); - - -extern const char *bcmerrorstr(int bcmerror); - - -typedef uint32 mbool; -#define mboolset(mb, bit) ((mb) |= (bit)) -#define mboolclr(mb, bit) ((mb) &= ~(bit)) -#define mboolisset(mb, bit) (((mb) & (bit)) != 0) -#define mboolmaskset(mb, mask, val) ((mb) = (((mb) & ~(mask)) | (val))) - - -extern uint16 bcm_qdbm_to_mw(uint8 qdbm); -extern uint8 bcm_mw_to_qdbm(uint16 mw); - - -struct fielddesc { - const char *nameandfmt; - uint32 offset; - uint32 len; -}; - -extern void bcm_binit(struct bcmstrbuf *b, char *buf, uint size); -extern int bcm_bprintf(struct bcmstrbuf *b, const char *fmt, ...); -extern void bcm_inc_bytes(uchar *num, int num_bytes, uint8 amount); -extern int bcm_cmp_bytes(uchar *arg1, uchar *arg2, uint8 nbytes); -extern void bcm_print_bytes(char *name, const uchar *cdata, int len); - -typedef uint32 (*bcmutl_rdreg_rtn)(void *arg0, uint arg1, uint32 offset); -extern uint bcmdumpfields(bcmutl_rdreg_rtn func_ptr, void *arg0, uint arg1, struct fielddesc *str, - char *buf, uint32 bufsize); - -extern uint bcm_mkiovar(char *name, char *data, uint datalen, char *buf, uint len); -extern uint bcm_bitcount(uint8 *bitmap, uint bytelength); - -#if defined(WLTINYDUMP) || defined(WLMSG_INFORM) || defined(WLMSG_ASSOC) || \ - defined(WLMSG_PRPKT) || defined(WLMSG_WSEC) -extern int bcm_format_ssid(char* buf, const uchar ssid[], uint ssid_len); -#endif - - -#define SSID_FMT_BUF_LEN ((4 * DOT11_MAX_SSID_LEN) + 1) - -#ifdef __cplusplus - } -#endif - -#endif diff --git a/drivers/net/wireless/bcm4319/include/bcmwifi.h b/drivers/net/wireless/bcm4319/include/bcmwifi.h deleted file mode 100644 index 038aedcdb3c8..000000000000 --- a/drivers/net/wireless/bcm4319/include/bcmwifi.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Misc utility routines for WL and Apps - * This header file housing the define and function prototype use by - * both the wl driver, tools & Apps. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * $Id: bcmwifi.h,v 1.15.30.4 2010/03/10 20:10:52 Exp $ - */ - - -#ifndef _bcmwifi_h_ -#define _bcmwifi_h_ - - - -typedef uint16 chanspec_t; - - -#define CH_UPPER_SB 0x01 -#define CH_LOWER_SB 0x02 -#define CH_EWA_VALID 0x04 -#define CH_20MHZ_APART 4 -#define CH_10MHZ_APART 2 -#define CH_5MHZ_APART 1 -#define CH_MAX_2G_CHANNEL 14 -#define WLC_MAX_2G_CHANNEL CH_MAX_2G_CHANNEL -#define MAXCHANNEL 224 - -#define WL_CHANSPEC_CHAN_MASK 0x00ff -#define WL_CHANSPEC_CHAN_SHIFT 0 - -#define WL_CHANSPEC_CTL_SB_MASK 0x0300 -#define WL_CHANSPEC_CTL_SB_SHIFT 8 -#define WL_CHANSPEC_CTL_SB_LOWER 0x0100 -#define WL_CHANSPEC_CTL_SB_UPPER 0x0200 -#define WL_CHANSPEC_CTL_SB_NONE 0x0300 - -#define WL_CHANSPEC_BW_MASK 0x0C00 -#define WL_CHANSPEC_BW_SHIFT 10 -#define WL_CHANSPEC_BW_10 0x0400 -#define WL_CHANSPEC_BW_20 0x0800 -#define WL_CHANSPEC_BW_40 0x0C00 - -#define WL_CHANSPEC_BAND_MASK 0xf000 -#define WL_CHANSPEC_BAND_SHIFT 12 -#define WL_CHANSPEC_BAND_5G 0x1000 -#define WL_CHANSPEC_BAND_2G 0x2000 -#define INVCHANSPEC 255 - - -#define WF_CHAN_FACTOR_2_4_G 4814 -#define WF_CHAN_FACTOR_5_G 10000 -#define WF_CHAN_FACTOR_4_G 8000 - - -#define LOWER_20_SB(channel) ((channel > CH_10MHZ_APART) ? (channel - CH_10MHZ_APART) : 0) -#define UPPER_20_SB(channel) ((channel < (MAXCHANNEL - CH_10MHZ_APART)) ? \ - (channel + CH_10MHZ_APART) : 0) -#define CHSPEC_WLCBANDUNIT(chspec) (CHSPEC_IS5G(chspec) ? BAND_5G_INDEX : BAND_2G_INDEX) -#define CH20MHZ_CHSPEC(channel) (chanspec_t)((chanspec_t)(channel) | WL_CHANSPEC_BW_20 | \ - WL_CHANSPEC_CTL_SB_NONE | (((channel) <= CH_MAX_2G_CHANNEL) ? \ - WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G)) -#define NEXT_20MHZ_CHAN(channel) ((channel < (MAXCHANNEL - CH_20MHZ_APART)) ? \ - (channel + CH_20MHZ_APART) : 0) -#define CH40MHZ_CHSPEC(channel, ctlsb) (chanspec_t) \ - ((channel) | (ctlsb) | WL_CHANSPEC_BW_40 | \ - ((channel) <= CH_MAX_2G_CHANNEL ? WL_CHANSPEC_BAND_2G : \ - WL_CHANSPEC_BAND_5G)) -#define CHSPEC_CHANNEL(chspec) ((uint8)(chspec & WL_CHANSPEC_CHAN_MASK)) -#define CHSPEC_BAND(chspec) (chspec & WL_CHANSPEC_BAND_MASK) - -#ifdef WL20MHZ_ONLY - -#define CHSPEC_CTL_SB(chspec) WL_CHANSPEC_CTL_SB_NONE -#define CHSPEC_BW(chspec) WL_CHANSPEC_BW_20 -#define CHSPEC_IS10(chspec) 0 -#define CHSPEC_IS20(chspec) 1 -#ifndef CHSPEC_IS40 -#define CHSPEC_IS40(chspec) 0 -#endif - -#else - -#define CHSPEC_CTL_SB(chspec) (chspec & WL_CHANSPEC_CTL_SB_MASK) -#define CHSPEC_BW(chspec) (chspec & WL_CHANSPEC_BW_MASK) -#define CHSPEC_IS10(chspec) ((chspec & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_10) -#define CHSPEC_IS20(chspec) ((chspec & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_20) -#ifndef CHSPEC_IS40 -#define CHSPEC_IS40(chspec) (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_40) -#endif - -#endif - -#define CHSPEC_IS5G(chspec) ((chspec & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_5G) -#define CHSPEC_IS2G(chspec) ((chspec & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_2G) -#define CHSPEC_SB_NONE(chspec) ((chspec & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_NONE) -#define CHSPEC_SB_UPPER(chspec) ((chspec & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_UPPER) -#define CHSPEC_SB_LOWER(chspec) ((chspec & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_LOWER) -#define CHSPEC_CTL_CHAN(chspec) ((CHSPEC_SB_LOWER(chspec)) ? \ - (LOWER_20_SB(((chspec) & WL_CHANSPEC_CHAN_MASK))) : \ - (UPPER_20_SB(((chspec) & WL_CHANSPEC_CHAN_MASK)))) - -#define CHSPEC2WLC_BAND(chspec) (CHSPEC_IS5G((chspec))? WLC_BAND_5G: WLC_BAND_2G) - -#define CHANSPEC_STR_LEN 8 - - -#define WLC_MAXRATE 108 -#define WLC_RATE_1M 2 -#define WLC_RATE_2M 4 -#define WLC_RATE_5M5 11 -#define WLC_RATE_11M 22 -#define WLC_RATE_6M 12 -#define WLC_RATE_9M 18 -#define WLC_RATE_12M 24 -#define WLC_RATE_18M 36 -#define WLC_RATE_24M 48 -#define WLC_RATE_36M 72 -#define WLC_RATE_48M 96 -#define WLC_RATE_54M 108 - -#define WLC_2G_25MHZ_OFFSET 5 - - -extern char * wf_chspec_ntoa(chanspec_t chspec, char *buf); - - -extern chanspec_t wf_chspec_aton(char *a); - - -extern int wf_mhz2channel(uint freq, uint start_factor); - - -extern int wf_channel2mhz(uint channel, uint start_factor); - -#endif diff --git a/drivers/net/wireless/bcm4319/include/dhdioctl.h b/drivers/net/wireless/bcm4319/include/dhdioctl.h deleted file mode 100644 index 980a14301003..000000000000 --- a/drivers/net/wireless/bcm4319/include/dhdioctl.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Definitions for ioctls to access DHD iovars. - * Based on wlioctl.h (for Broadcom 802.11abg driver). - * (Moves towards generic ioctls for BCM drivers/iovars.) - * - * Definitions subject to change without notice. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: dhdioctl.h,v 13.7.8.1.4.1.16.5 2010/05/21 21:49:38 Exp $ - */ - -#ifndef _dhdioctl_h_ -#define _dhdioctl_h_ - -#include - - -/* require default structure packing */ -#define BWL_DEFAULT_PACKING -#include - - -/* Linux network driver ioctl encoding */ -typedef struct dhd_ioctl { - uint cmd; /* common ioctl definition */ - void *buf; /* pointer to user buffer */ - uint len; /* length of user buffer */ - bool set; /* get or set request (optional) */ - uint used; /* bytes read or written (optional) */ - uint needed; /* bytes needed (optional) */ - uint driver; /* to identify target driver */ -} dhd_ioctl_t; - -/* per-driver magic numbers */ -#define DHD_IOCTL_MAGIC 0x00444944 - -/* bump this number if you change the ioctl interface */ -#define DHD_IOCTL_VERSION 1 - -#define DHD_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */ -#define DHD_IOCTL_SMLEN 256 /* "small" length ioctl buffer required */ - -/* common ioctl definitions */ -#define DHD_GET_MAGIC 0 -#define DHD_GET_VERSION 1 -#define DHD_GET_VAR 2 -#define DHD_SET_VAR 3 - -/* message levels */ -#define DHD_ERROR_VAL 0x0001 -#define DHD_TRACE_VAL 0x0002 -#define DHD_INFO_VAL 0x0004 -#define DHD_DATA_VAL 0x0008 -#define DHD_CTL_VAL 0x0010 -#define DHD_TIMER_VAL 0x0020 -#define DHD_HDRS_VAL 0x0040 -#define DHD_BYTES_VAL 0x0080 -#define DHD_INTR_VAL 0x0100 -#define DHD_LOG_VAL 0x0200 -#define DHD_GLOM_VAL 0x0400 -#define DHD_EVENT_VAL 0x0800 -#define DHD_BTA_VAL 0x1000 -#define DHD_ISCAN_VAL 0x2000 - -#ifdef SDTEST -/* For pktgen iovar */ -typedef struct dhd_pktgen { - uint version; /* To allow structure change tracking */ - uint freq; /* Max ticks between tx/rx attempts */ - uint count; /* Test packets to send/rcv each attempt */ - uint print; /* Print counts every attempts */ - uint total; /* Total packets (or bursts) */ - uint minlen; /* Minimum length of packets to send */ - uint maxlen; /* Maximum length of packets to send */ - uint numsent; /* Count of test packets sent */ - uint numrcvd; /* Count of test packets received */ - uint numfail; /* Count of test send failures */ - uint mode; /* Test mode (type of test packets) */ - uint stop; /* Stop after this many tx failures */ -} dhd_pktgen_t; - -/* Version in case structure changes */ -#define DHD_PKTGEN_VERSION 2 - -/* Type of test packets to use */ -#define DHD_PKTGEN_ECHO 1 /* Send echo requests */ -#define DHD_PKTGEN_SEND 2 /* Send discard packets */ -#define DHD_PKTGEN_RXBURST 3 /* Request dongle send N packets */ -#define DHD_PKTGEN_RECV 4 /* Continuous rx from continuous tx dongle */ -#endif /* SDTEST */ - -/* Enter idle immediately (no timeout) */ -#define DHD_IDLE_IMMEDIATE (-1) - -/* Values for idleclock iovar: other values are the sd_divisor to use when idle */ -#define DHD_IDLE_ACTIVE 0 /* Do not request any SD clock change when idle */ -#define DHD_IDLE_STOP (-1) /* Request SD clock be stopped (and use SD1 mode) */ - - -/* require default structure packing */ -#include - - -#endif /* _dhdioctl_h_ */ diff --git a/drivers/net/wireless/bcm4319/include/epivers.h b/drivers/net/wireless/bcm4319/include/epivers.h deleted file mode 100644 index 23ee514a7b6b..000000000000 --- a/drivers/net/wireless/bcm4319/include/epivers.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: epivers.h.in,v 13.25 2005/10/28 18:35:33 Exp $ - * -*/ - - -#ifndef _epivers_h_ -#define _epivers_h_ - -#define EPI_MAJOR_VERSION 4 - -#define EPI_MINOR_VERSION 218 - -#define EPI_RC_NUMBER 248 - -#define EPI_INCREMENTAL_NUMBER 18 - -#define EPI_BUILD_NUMBER 0 - -#define EPI_VERSION 4, 218, 248, 18 - -#define EPI_VERSION_NUM 0x04daf812 - - -#define EPI_VERSION_STR "4.218.248.18" -#define EPI_ROUTER_VERSION_STR "4.219.248.18" - -#endif diff --git a/drivers/net/wireless/bcm4319/include/hndpmu.h b/drivers/net/wireless/bcm4319/include/hndpmu.h deleted file mode 100644 index e829b3df2d0b..000000000000 --- a/drivers/net/wireless/bcm4319/include/hndpmu.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * HND SiliconBackplane PMU support. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: hndpmu.h,v 13.14.4.3.4.3.8.7 2010/04/09 13:20:51 Exp $ - */ - -#ifndef _hndpmu_h_ -#define _hndpmu_h_ - - -extern void si_pmu_otp_power(si_t *sih, osl_t *osh, bool on); -extern void si_sdiod_drive_strength_init(si_t *sih, osl_t *osh, uint32 drivestrength); - -#endif /* _hndpmu_h_ */ diff --git a/drivers/net/wireless/bcm4319/include/hndrte_armtrap.h b/drivers/net/wireless/bcm4319/include/hndrte_armtrap.h deleted file mode 100644 index ca3281b6d901..000000000000 --- a/drivers/net/wireless/bcm4319/include/hndrte_armtrap.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * HNDRTE arm trap handling. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: hndrte_armtrap.h,v 13.3.196.2 2010/07/15 19:06:11 Exp $ - */ - -#ifndef _hndrte_armtrap_h -#define _hndrte_armtrap_h - - -/* ARM trap handling */ - -/* Trap types defined by ARM (see arminc.h) */ - -/* Trap locations in lo memory */ -#define TRAP_STRIDE 4 -#define FIRST_TRAP TR_RST -#define LAST_TRAP (TR_FIQ * TRAP_STRIDE) - -#if defined(__ARM_ARCH_4T__) -#define MAX_TRAP_TYPE (TR_FIQ + 1) -#elif defined(__ARM_ARCH_7M__) -#define MAX_TRAP_TYPE (TR_ISR + ARMCM3_NUMINTS) -#endif /* __ARM_ARCH_7M__ */ - -/* The trap structure is defined here as offsets for assembly */ -#define TR_TYPE 0x00 -#define TR_EPC 0x04 -#define TR_CPSR 0x08 -#define TR_SPSR 0x0c -#define TR_REGS 0x10 -#define TR_REG(n) (TR_REGS + (n) * 4) -#define TR_SP TR_REG(13) -#define TR_LR TR_REG(14) -#define TR_PC TR_REG(15) - -#define TRAP_T_SIZE 80 - -#ifndef _LANGUAGE_ASSEMBLY - -#include - -typedef struct _trap_struct { - uint32 type; - uint32 epc; - uint32 cpsr; - uint32 spsr; - uint32 r0; - uint32 r1; - uint32 r2; - uint32 r3; - uint32 r4; - uint32 r5; - uint32 r6; - uint32 r7; - uint32 r8; - uint32 r9; - uint32 r10; - uint32 r11; - uint32 r12; - uint32 r13; - uint32 r14; - uint32 pc; -} trap_t; - -#endif /* !_LANGUAGE_ASSEMBLY */ - -#endif /* _hndrte_armtrap_h */ diff --git a/drivers/net/wireless/bcm4319/include/hndrte_cons.h b/drivers/net/wireless/bcm4319/include/hndrte_cons.h deleted file mode 100644 index a42417478a16..000000000000 --- a/drivers/net/wireless/bcm4319/include/hndrte_cons.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Console support for hndrte. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: hndrte_cons.h,v 13.1.2.4 2010/07/15 19:06:11 Exp $ - */ - -#include - -#define CBUF_LEN (128) - -#define LOG_BUF_LEN 1024 - -typedef struct { - uint32 buf; /* Can't be pointer on (64-bit) hosts */ - uint buf_size; - uint idx; - char *_buf_compat; /* Redundant pointer for backward compat. */ -} hndrte_log_t; - -typedef struct { - /* Virtual UART - * When there is no UART (e.g. Quickturn), the host should write a complete - * input line directly into cbuf and then write the length into vcons_in. - * This may also be used when there is a real UART (at risk of conflicting with - * the real UART). vcons_out is currently unused. - */ - volatile uint vcons_in; - volatile uint vcons_out; - - /* Output (logging) buffer - * Console output is written to a ring buffer log_buf at index log_idx. - * The host may read the output when it sees log_idx advance. - * Output will be lost if the output wraps around faster than the host polls. - */ - hndrte_log_t log; - - /* Console input line buffer - * Characters are read one at a time into cbuf until is received, then - * the buffer is processed as a command line. Also used for virtual UART. - */ - uint cbuf_idx; - char cbuf[CBUF_LEN]; -} hndrte_cons_t; diff --git a/drivers/net/wireless/bcm4319/include/hndsoc.h b/drivers/net/wireless/bcm4319/include/hndsoc.h deleted file mode 100644 index 35424175f55e..000000000000 --- a/drivers/net/wireless/bcm4319/include/hndsoc.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Broadcom HND chip & on-chip-interconnect-related definitions. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: hndsoc.h,v 13.3.10.3 2008/08/06 03:43:25 Exp $ - */ - -#ifndef _HNDSOC_H -#define _HNDSOC_H - -/* Include the soci specific files */ -#include -#include - -/* - * SOC Interconnect Address Map. - * All regions may not exist on all chips. - */ -#define SI_SDRAM_BASE 0x00000000 /* Physical SDRAM */ -#define SI_PCI_MEM 0x08000000 /* Host Mode sb2pcitranslation0 (64 MB) */ -#define SI_PCI_MEM_SZ (64 * 1024 * 1024) -#define SI_PCI_CFG 0x0c000000 /* Host Mode sb2pcitranslation1 (64 MB) */ -#define SI_SDRAM_SWAPPED 0x10000000 /* Byteswapped Physical SDRAM */ - -#define SI_ENUM_BASE 0x18000000 /* Enumeration space base */ -#define SI_CORE_SIZE 0x1000 /* each core gets 4Kbytes for registers */ -#ifndef SI_MAXCORES -#define SI_MAXCORES 16 /* Max cores (this is arbitrary, for software - * convenience and could be changed if we - * make any larger chips - */ -#endif - -#define SI_FASTRAM 0x19000000 /* On-chip RAM on chips that also have DDR */ - -#define SI_FLASH2 0x1c000000 /* Flash Region 2 (region 1 shadowed here) */ -#define SI_FLASH2_SZ 0x02000000 /* Size of Flash Region 2 */ -#define SI_ARMCM3_ROM 0x1e000000 /* ARM Cortex-M3 ROM */ -#define SI_FLASH1 0x1fc00000 /* MIPS Flash Region 1 */ -#define SI_FLASH1_SZ 0x00400000 /* MIPS Size of Flash Region 1 */ -#define SI_ARM7S_ROM 0x20000000 /* ARM7TDMI-S ROM */ -#define SI_ARMCM3_SRAM2 0x60000000 /* ARM Cortex-M3 SRAM Region 2 */ -#define SI_ARM7S_SRAM2 0x80000000 /* ARM7TDMI-S SRAM Region 2 */ -#define SI_ARM_FLASH1 0xffff0000 /* ARM Flash Region 1 */ -#define SI_ARM_FLASH1_SZ 0x00010000 /* ARM Size of Flash Region 1 */ - -#define SI_PCI_DMA 0x40000000 /* Client Mode sb2pcitranslation2 (1 GB) */ -#define SI_PCI_DMA2 0x80000000 /* Client Mode sb2pcitranslation2 (1 GB) */ -#define SI_PCI_DMA_SZ 0x40000000 /* Client Mode sb2pcitranslation2 size in bytes */ -#define SI_PCIE_DMA_L32 0x00000000 /* PCIE Client Mode sb2pcitranslation2 - * (2 ZettaBytes), low 32 bits - */ -#define SI_PCIE_DMA_H32 0x80000000 /* PCIE Client Mode sb2pcitranslation2 - * (2 ZettaBytes), high 32 bits - */ - -/* core codes */ -#define NODEV_CORE_ID 0x700 /* Invalid coreid */ -#define CC_CORE_ID 0x800 /* chipcommon core */ -#define ILINE20_CORE_ID 0x801 /* iline20 core */ -#define SRAM_CORE_ID 0x802 /* sram core */ -#define SDRAM_CORE_ID 0x803 /* sdram core */ -#define PCI_CORE_ID 0x804 /* pci core */ -#define MIPS_CORE_ID 0x805 /* mips core */ -#define ENET_CORE_ID 0x806 /* enet mac core */ -#define CODEC_CORE_ID 0x807 /* v90 codec core */ -#define USB_CORE_ID 0x808 /* usb 1.1 host/device core */ -#define ADSL_CORE_ID 0x809 /* ADSL core */ -#define ILINE100_CORE_ID 0x80a /* iline100 core */ -#define IPSEC_CORE_ID 0x80b /* ipsec core */ -#define UTOPIA_CORE_ID 0x80c /* utopia core */ -#define PCMCIA_CORE_ID 0x80d /* pcmcia core */ -#define SOCRAM_CORE_ID 0x80e /* internal memory core */ -#define MEMC_CORE_ID 0x80f /* memc sdram core */ -#define OFDM_CORE_ID 0x810 /* OFDM phy core */ -#define EXTIF_CORE_ID 0x811 /* external interface core */ -#define D11_CORE_ID 0x812 /* 802.11 MAC core */ -#define APHY_CORE_ID 0x813 /* 802.11a phy core */ -#define BPHY_CORE_ID 0x814 /* 802.11b phy core */ -#define GPHY_CORE_ID 0x815 /* 802.11g phy core */ -#define MIPS33_CORE_ID 0x816 /* mips3302 core */ -#define USB11H_CORE_ID 0x817 /* usb 1.1 host core */ -#define USB11D_CORE_ID 0x818 /* usb 1.1 device core */ -#define USB20H_CORE_ID 0x819 /* usb 2.0 host core */ -#define USB20D_CORE_ID 0x81a /* usb 2.0 device core */ -#define SDIOH_CORE_ID 0x81b /* sdio host core */ -#define ROBO_CORE_ID 0x81c /* roboswitch core */ -#define ATA100_CORE_ID 0x81d /* parallel ATA core */ -#define SATAXOR_CORE_ID 0x81e /* serial ATA & XOR DMA core */ -#define GIGETH_CORE_ID 0x81f /* gigabit ethernet core */ -#define PCIE_CORE_ID 0x820 /* pci express core */ -#define NPHY_CORE_ID 0x821 /* 802.11n 2x2 phy core */ -#define SRAMC_CORE_ID 0x822 /* SRAM controller core */ -#define MINIMAC_CORE_ID 0x823 /* MINI MAC/phy core */ -#define ARM11_CORE_ID 0x824 /* ARM 1176 core */ -#define ARM7S_CORE_ID 0x825 /* ARM7tdmi-s core */ -#define LPPHY_CORE_ID 0x826 /* 802.11a/b/g phy core */ -#define PMU_CORE_ID 0x827 /* PMU core */ -#define SSNPHY_CORE_ID 0x828 /* 802.11n single-stream phy core */ -#define SDIOD_CORE_ID 0x829 /* SDIO device core */ -#define ARMCM3_CORE_ID 0x82a /* ARM Cortex M3 core */ -#define QNPHY_CORE_ID 0x82b /* 802.11n 4x4 phy core */ -#define MIPS74K_CORE_ID 0x82c /* mips 74k core */ -#define GMAC_CORE_ID 0x82d /* Gigabit MAC core */ -#define DMEMC_CORE_ID 0x82e /* DDR1/2 memory controller core */ -#define PCIERC_CORE_ID 0x82f /* PCIE Root Complex core */ -#define OCP_CORE_ID 0x830 /* OCP2OCP bridge core */ -#define SC_CORE_ID 0x831 /* shared common core */ -#define AHB_CORE_ID 0x832 /* OCP2AHB bridge core */ -#define SPIH_CORE_ID 0x833 /* SPI host core */ -#define I2S_CORE_ID 0x834 /* I2S core */ -#define OOB_ROUTER_CORE_ID 0x367 /* OOB router core ID */ -#define DEF_AI_COMP 0xfff /* Default component, in ai chips it maps all - * unused address ranges - */ - -/* There are TWO constants on all HND chips: SI_ENUM_BASE above, - * and chipcommon being the first core: - */ -#define SI_CC_IDX 0 - -/* SOC Interconnect types (aka chip types) */ -#define SOCI_SB 0 -#define SOCI_AI 1 - -/* Common core control flags */ -#define SICF_BIST_EN 0x8000 -#define SICF_PME_EN 0x4000 -#define SICF_CORE_BITS 0x3ffc -#define SICF_FGC 0x0002 -#define SICF_CLOCK_EN 0x0001 - -/* Common core status flags */ -#define SISF_BIST_DONE 0x8000 -#define SISF_BIST_ERROR 0x4000 -#define SISF_GATED_CLK 0x2000 -#define SISF_DMA64 0x1000 -#define SISF_CORE_BITS 0x0fff - -/* A register that is common to all cores to - * communicate w/PMU regarding clock control. - */ -#define SI_CLK_CTL_ST 0x1e0 /* clock control and status */ - -/* clk_ctl_st register */ -#define CCS_FORCEALP 0x00000001 /* force ALP request */ -#define CCS_FORCEHT 0x00000002 /* force HT request */ -#define CCS_FORCEILP 0x00000004 /* force ILP request */ -#define CCS_ALPAREQ 0x00000008 /* ALP Avail Request */ -#define CCS_HTAREQ 0x00000010 /* HT Avail Request */ -#define CCS_FORCEHWREQOFF 0x00000020 /* Force HW Clock Request Off */ -#define CCS_ALPAVAIL 0x00010000 /* ALP is available */ -#define CCS_HTAVAIL 0x00020000 /* HT is available */ -#define CCS0_HTAVAIL 0x00010000 /* HT avail in chipc and pcmcia on 4328a0 */ -#define CCS0_ALPAVAIL 0x00020000 /* ALP avail in chipc and pcmcia on 4328a0 */ - -/* Not really related to SOC Interconnect, but a couple of software - * conventions for the use the flash space: - */ - -/* Minumum amount of flash we support */ -#define FLASH_MIN 0x00020000 /* Minimum flash size */ - -/* A boot/binary may have an embedded block that describes its size */ -#define BISZ_OFFSET 0x3e0 /* At this offset into the binary */ -#define BISZ_MAGIC 0x4249535a /* Marked with this value: 'BISZ' */ -#define BISZ_MAGIC_IDX 0 /* Word 0: magic */ -#define BISZ_TXTST_IDX 1 /* 1: text start */ -#define BISZ_TXTEND_IDX 2 /* 2: text end */ -#define BISZ_DATAST_IDX 3 /* 3: data start */ -#define BISZ_DATAEND_IDX 4 /* 4: data end */ -#define BISZ_BSSST_IDX 5 /* 5: bss start */ -#define BISZ_BSSEND_IDX 6 /* 6: bss end */ -#define BISZ_SIZE 7 /* descriptor size in 32-bit intergers */ - -#endif /* _HNDSOC_H */ diff --git a/drivers/net/wireless/bcm4319/include/linux_osl.h b/drivers/net/wireless/bcm4319/include/linux_osl.h deleted file mode 100644 index b059c2adb17d..000000000000 --- a/drivers/net/wireless/bcm4319/include/linux_osl.h +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Linux OS Independent Layer - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: linux_osl.h,v 13.131.30.8 2010/04/26 05:42:18 Exp $ - */ - - -#ifndef _linux_osl_h_ -#define _linux_osl_h_ - -#include - - -#include - - -#ifdef __GNUC__ -#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) -#if GCC_VERSION > 30100 -#define ASSERT(exp) do {} while (0) -#else - -#define ASSERT(exp) -#endif -#endif - - -#define OSL_DELAY(usec) osl_delay(usec) -extern void osl_delay(uint usec); - - - -#define OSL_PCMCIA_READ_ATTR(osh, offset, buf, size) \ - osl_pcmcia_read_attr((osh), (offset), (buf), (size)) -#define OSL_PCMCIA_WRITE_ATTR(osh, offset, buf, size) \ - osl_pcmcia_write_attr((osh), (offset), (buf), (size)) -extern void osl_pcmcia_read_attr(osl_t *osh, uint offset, void *buf, int size); -extern void osl_pcmcia_write_attr(osl_t *osh, uint offset, void *buf, int size); - - -#define OSL_PCI_READ_CONFIG(osh, offset, size) \ - osl_pci_read_config((osh), (offset), (size)) -#define OSL_PCI_WRITE_CONFIG(osh, offset, size, val) \ - osl_pci_write_config((osh), (offset), (size), (val)) -extern uint32 osl_pci_read_config(osl_t *osh, uint offset, uint size); -extern void osl_pci_write_config(osl_t *osh, uint offset, uint size, uint val); - - -#define OSL_PCI_BUS(osh) osl_pci_bus(osh) -#define OSL_PCI_SLOT(osh) osl_pci_slot(osh) -extern uint osl_pci_bus(osl_t *osh); -extern uint osl_pci_slot(osl_t *osh); - - -typedef struct { - bool pkttag; - uint pktalloced; - bool mmbus; - pktfree_cb_fn_t tx_fn; - void *tx_ctx; -} osl_pubinfo_t; - - -extern osl_t *osl_attach(void *pdev, uint bustype, bool pkttag); -extern void osl_detach(osl_t *osh); - -#define PKTFREESETCB(osh, _tx_fn, _tx_ctx) \ - do { \ - ((osl_pubinfo_t*)osh)->tx_fn = _tx_fn; \ - ((osl_pubinfo_t*)osh)->tx_ctx = _tx_ctx; \ - } while (0) - - -#define BUS_SWAP32(v) (v) - - -#define MALLOC(osh, size) osl_malloc((osh), (size)) -#define MFREE(osh, addr, size) osl_mfree((osh), (addr), (size)) -#define MALLOCED(osh) osl_malloced((osh)) - - -#define MALLOC_FAILED(osh) osl_malloc_failed((osh)) - -extern void *osl_malloc(osl_t *osh, uint size); -extern void osl_mfree(osl_t *osh, void *addr, uint size); -extern uint osl_malloced(osl_t *osh); -extern uint osl_malloc_failed(osl_t *osh); - - -#define DMA_CONSISTENT_ALIGN PAGE_SIZE -#define DMA_ALLOC_CONSISTENT(osh, size, pap, dmah, alignbits) \ - osl_dma_alloc_consistent((osh), (size), (pap)) -#define DMA_FREE_CONSISTENT(osh, va, size, pa, dmah) \ - osl_dma_free_consistent((osh), (void*)(va), (size), (pa)) -extern void *osl_dma_alloc_consistent(osl_t *osh, uint size, ulong *pap); -extern void osl_dma_free_consistent(osl_t *osh, void *va, uint size, ulong pa); - - -#define DMA_TX 1 -#define DMA_RX 2 - - -#define DMA_MAP(osh, va, size, direction, p, dmah) \ - osl_dma_map((osh), (va), (size), (direction)) -#define DMA_UNMAP(osh, pa, size, direction, p, dmah) \ - osl_dma_unmap((osh), (pa), (size), (direction)) -extern uint osl_dma_map(osl_t *osh, void *va, uint size, int direction); -extern void osl_dma_unmap(osl_t *osh, uint pa, uint size, int direction); - - -#define OSL_DMADDRWIDTH(osh, addrwidth) do {} while (0) - - -#include -#define OSL_WRITE_REG(osh, r, v) (bcmsdh_reg_write(NULL, (uintptr)(r), sizeof(*(r)), (v))) -#define OSL_READ_REG(osh, r) (bcmsdh_reg_read(NULL, (uintptr)(r), sizeof(*(r)))) - -#define SELECT_BUS_WRITE(osh, mmap_op, bus_op) if (((osl_pubinfo_t*)(osh))->mmbus) \ - mmap_op else bus_op -#define SELECT_BUS_READ(osh, mmap_op, bus_op) (((osl_pubinfo_t*)(osh))->mmbus) ? \ - mmap_op : bus_op - - - - -#ifndef printf -#define printf(fmt, args...) printk(fmt, ## args) -#endif -#include -#include - - -#ifndef IL_BIGENDIAN -#define R_REG(osh, r) (\ - SELECT_BUS_READ(osh, sizeof(*(r)) == sizeof(uint8) ? readb((volatile uint8*)(r)) : \ - sizeof(*(r)) == sizeof(uint16) ? readw((volatile uint16*)(r)) : \ - readl((volatile uint32*)(r)), OSL_READ_REG(osh, r)) \ -) -#define W_REG(osh, r, v) do { \ - SELECT_BUS_WRITE(osh, \ - switch (sizeof(*(r))) { \ - case sizeof(uint8): writeb((uint8)(v), (volatile uint8*)(r)); break; \ - case sizeof(uint16): writew((uint16)(v), (volatile uint16*)(r)); break; \ - case sizeof(uint32): writel((uint32)(v), (volatile uint32*)(r)); break; \ - }, \ - (OSL_WRITE_REG(osh, r, v))); \ - } while (0) -#else -#define R_REG(osh, r) (\ - SELECT_BUS_READ(osh, \ - ({ \ - __typeof(*(r)) __osl_v; \ - switch (sizeof(*(r))) { \ - case sizeof(uint8): __osl_v = \ - readb((volatile uint8*)((uintptr)(r)^3)); break; \ - case sizeof(uint16): __osl_v = \ - readw((volatile uint16*)((uintptr)(r)^2)); break; \ - case sizeof(uint32): __osl_v = \ - readl((volatile uint32*)(r)); break; \ - } \ - __osl_v; \ - }), \ - OSL_READ_REG(osh, r)) \ -) -#define W_REG(osh, r, v) do { \ - SELECT_BUS_WRITE(osh, \ - switch (sizeof(*(r))) { \ - case sizeof(uint8): writeb((uint8)(v), \ - (volatile uint8*)((uintptr)(r)^3)); break; \ - case sizeof(uint16): writew((uint16)(v), \ - (volatile uint16*)((uintptr)(r)^2)); break; \ - case sizeof(uint32): writel((uint32)(v), \ - (volatile uint32*)(r)); break; \ - }, \ - (OSL_WRITE_REG(osh, r, v))); \ - } while (0) -#endif - -#define AND_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) & (v)) -#define OR_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) | (v)) - - -#define bcopy(src, dst, len) memcpy((dst), (src), (len)) -#define bcmp(b1, b2, len) memcmp((b1), (b2), (len)) -#define bzero(b, len) memset((b), '\0', (len)) - - -#define OSL_UNCACHED(va) ((void*)va) - - -#if defined(__i386__) -#define OSL_GETCYCLES(x) rdtscl((x)) -#else -#define OSL_GETCYCLES(x) ((x) = 0) -#endif - - -#define BUSPROBE(val, addr) ({ (val) = R_REG(NULL, (addr)); 0; }) - - -#if !defined(CONFIG_MMC_MSM7X00A) -#define REG_MAP(pa, size) ioremap_nocache((unsigned long)(pa), (unsigned long)(size)) -#else -#define REG_MAP(pa, size) (void *)(0) -#endif -#define REG_UNMAP(va) iounmap((va)) - - -#define R_SM(r) *(r) -#define W_SM(r, v) (*(r) = (v)) -#define BZERO_SM(r, len) memset((r), '\0', (len)) - - -#define PKTGET(osh, len, send) osl_pktget((osh), (len)) -#define PKTFREE(osh, skb, send) osl_pktfree((osh), (skb), (send)) -#ifdef DHD_USE_STATIC_BUF -#define PKTGET_STATIC(osh, len, send) osl_pktget_static((osh), (len)) -#define PKTFREE_STATIC(osh, skb, send) osl_pktfree_static((osh), (skb), (send)) -#endif -#define PKTDATA(osh, skb) (((struct sk_buff*)(skb))->data) -#define PKTLEN(osh, skb) (((struct sk_buff*)(skb))->len) -#define PKTHEADROOM(osh, skb) (PKTDATA(osh, skb)-(((struct sk_buff*)(skb))->head)) -#define PKTTAILROOM(osh, skb) ((((struct sk_buff*)(skb))->end)-(((struct sk_buff*)(skb))->tail)) -#define PKTNEXT(osh, skb) (((struct sk_buff*)(skb))->next) -#define PKTSETNEXT(osh, skb, x) (((struct sk_buff*)(skb))->next = (struct sk_buff*)(x)) -#define PKTSETLEN(osh, skb, len) __skb_trim((struct sk_buff*)(skb), (len)) -#define PKTPUSH(osh, skb, bytes) skb_push((struct sk_buff*)(skb), (bytes)) -#define PKTPULL(osh, skb, bytes) skb_pull((struct sk_buff*)(skb), (bytes)) -#define PKTDUP(osh, skb) osl_pktdup((osh), (skb)) -#define PKTTAG(skb) ((void*)(((struct sk_buff*)(skb))->cb)) -#define PKTALLOCED(osh) ((osl_pubinfo_t *)(osh))->pktalloced -#define PKTSETPOOL(osh, skb, x, y) do {} while (0) -#define PKTPOOL(osh, skb) FALSE -#define PKTPOOLLEN(osh, pktp) (0) -#define PKTPOOLAVAIL(osh, pktp) (0) -#define PKTPOOLADD(osh, pktp, p) BCME_ERROR -#define PKTPOOLGET(osh, pktp) NULL -#define PKTLIST_DUMP(osh, buf) - -extern void *osl_pktget(osl_t *osh, uint len); -extern void osl_pktfree(osl_t *osh, void *skb, bool send); -extern void *osl_pktget_static(osl_t *osh, uint len); -extern void osl_pktfree_static(osl_t *osh, void *skb, bool send); -extern void *osl_pktdup(osl_t *osh, void *skb); - - - -static INLINE void * -osl_pkt_frmnative(osl_pubinfo_t *osh, struct sk_buff *skb) -{ - struct sk_buff *nskb; - - if (osh->pkttag) - bzero((void*)skb->cb, OSL_PKTTAG_SZ); - - - for (nskb = skb; nskb; nskb = nskb->next) { - osh->pktalloced++; - } - - return (void *)skb; -} -#define PKTFRMNATIVE(osh, skb) osl_pkt_frmnative(((osl_pubinfo_t *)osh), (struct sk_buff*)(skb)) - - -static INLINE struct sk_buff * -osl_pkt_tonative(osl_pubinfo_t *osh, void *pkt) -{ - struct sk_buff *nskb; - - if (osh->pkttag) - bzero(((struct sk_buff*)pkt)->cb, OSL_PKTTAG_SZ); - - - for (nskb = (struct sk_buff *)pkt; nskb; nskb = nskb->next) { - osh->pktalloced--; - } - - return (struct sk_buff *)pkt; -} -#define PKTTONATIVE(osh, pkt) osl_pkt_tonative((osl_pubinfo_t *)(osh), (pkt)) - -#define PKTLINK(skb) (((struct sk_buff*)(skb))->prev) -#define PKTSETLINK(skb, x) (((struct sk_buff*)(skb))->prev = (struct sk_buff*)(x)) -#define PKTPRIO(skb) (((struct sk_buff*)(skb))->priority) -#define PKTSETPRIO(skb, x) (((struct sk_buff*)(skb))->priority = (x)) -#define PKTSUMNEEDED(skb) (((struct sk_buff*)(skb))->ip_summed == CHECKSUM_HW) -#define PKTSETSUMGOOD(skb, x) (((struct sk_buff*)(skb))->ip_summed = \ - ((x) ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE)) - -#define PKTSHARED(skb) (((struct sk_buff*)(skb))->cloned) - - -#define OSL_ERROR(bcmerror) osl_error(bcmerror) -extern int osl_error(int bcmerror); - - -#define PKTBUFSZ 2048 - - -#define OSL_SYSUPTIME() ((uint32)jiffies * (1000 / HZ)) -#endif diff --git a/drivers/net/wireless/bcm4319/include/linuxver.h b/drivers/net/wireless/bcm4319/include/linuxver.h deleted file mode 100644 index 6ed22658a72b..000000000000 --- a/drivers/net/wireless/bcm4319/include/linuxver.h +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Linux-specific abstractions to gain some independence from linux kernel versions. - * Pave over some 2.2 versus 2.4 versus 2.6 kernel differences. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: linuxver.h,v 13.38.8.1.8.6 2010/04/29 05:00:46 Exp $ - */ - - -#ifndef _linuxver_h_ -#define _linuxver_h_ - -#include -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) -#include -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)) -#include -#endif -#include - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)) - -#ifdef __UNDEF_NO_VERSION__ -#undef __NO_VERSION__ -#else -#define __NO_VERSION__ -#endif -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) -#define module_param(_name_, _type_, _perm_) MODULE_PARM(_name_, "i") -#define module_param_string(_name_, _string_, _size_, _perm_) \ - MODULE_PARM(_string_, "c" __MODULE_STRING(_size_)) -#endif - - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 9)) -#include -#else -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)) -#undef IP_TOS -#endif -#include - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 41)) -#include -#else -#include -#ifndef work_struct -#define work_struct tq_struct -#endif -#ifndef INIT_WORK -#define INIT_WORK(_work, _func, _data) INIT_TQUEUE((_work), (_func), (_data)) -#endif -#ifndef schedule_work -#define schedule_work(_work) schedule_task((_work)) -#endif -#ifndef flush_scheduled_work -#define flush_scheduled_work() flush_scheduled_tasks() -#endif -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) -#define MY_INIT_WORK(_work, _func, _data) INIT_WORK(_work, _func) -#else -#define MY_INIT_WORK(_work, _func, _data) INIT_WORK(_work, _func, _data) -typedef void (*work_func_t)(void *work); -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) - -#ifndef IRQ_NONE -typedef void irqreturn_t; -#define IRQ_NONE -#define IRQ_HANDLED -#define IRQ_RETVAL(x) -#endif -#else -typedef irqreturn_t(*FN_ISR) (int irq, void *dev_id, struct pt_regs *ptregs); -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) -#define IRQF_SHARED SA_SHIRQ -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17) -#ifdef CONFIG_NET_RADIO -#define CONFIG_WIRELESS_EXT -#endif -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 67) -#ifndef SANDGATE2G -#define MOD_INC_USE_COUNT -#endif -#endif - - -#ifndef __exit -#define __exit -#endif -#ifndef __devexit -#define __devexit -#endif -#ifndef __devinit -#define __devinit __init -#endif -#ifndef __devinitdata -#define __devinitdata -#endif -#ifndef __devexit_p -#define __devexit_p(x) x -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)) - -#define pci_get_drvdata(dev) (dev)->sysdata -#define pci_set_drvdata(dev, value) (dev)->sysdata = (value) - - - -struct pci_device_id { - unsigned int vendor, device; - unsigned int subvendor, subdevice; - unsigned int class, class_mask; - unsigned long driver_data; -}; - -struct pci_driver { - struct list_head node; - char *name; - const struct pci_device_id *id_table; - int (*probe)(struct pci_dev *dev, - const struct pci_device_id *id); - void (*remove)(struct pci_dev *dev); - void (*suspend)(struct pci_dev *dev); - void (*resume)(struct pci_dev *dev); -}; - -#define MODULE_DEVICE_TABLE(type, name) -#define PCI_ANY_ID (~0) - - -#define pci_module_init pci_register_driver -extern int pci_register_driver(struct pci_driver *drv); -extern void pci_unregister_driver(struct pci_driver *drv); - -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)) -#define pci_module_init pci_register_driver -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 18)) -#ifdef MODULE -#define module_init(x) int init_module(void) { return x(); } -#define module_exit(x) void cleanup_module(void) { x(); } -#else -#define module_init(x) __initcall(x); -#define module_exit(x) __exitcall(x); -#endif -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 48)) -#define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 13)) -#define pci_resource_start(dev, bar) ((dev)->base_address[(bar)]) -#elif (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 44)) -#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 23)) -#define pci_enable_device(dev) do { } while (0) -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 14)) -#define net_device device -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 42)) - - - -#ifndef PCI_DMA_TODEVICE -#define PCI_DMA_TODEVICE 1 -#define PCI_DMA_FROMDEVICE 2 -#endif - -typedef u32 dma_addr_t; - - -static inline int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - -static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, - dma_addr_t *dma_handle) -{ - void *ret; - int gfp = GFP_ATOMIC | GFP_DMA; - - ret = (void *)__get_free_pages(gfp, get_order(size)); - - if (ret != NULL) { - memset(ret, 0, size); - *dma_handle = virt_to_bus(ret); - } - return ret; -} -static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size, - void *vaddr, dma_addr_t dma_handle) -{ - free_pages((unsigned long)vaddr, get_order(size)); -} -#define pci_map_single(cookie, address, size, dir) virt_to_bus(address) -#define pci_unmap_single(cookie, address, size, dir) - -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 43)) - -#define dev_kfree_skb_any(a) dev_kfree_skb(a) -#define netif_down(dev) do { (dev)->start = 0; } while (0) - - -#ifndef _COMPAT_NETDEVICE_H - - - -#define dev_kfree_skb_irq(a) dev_kfree_skb(a) -#define netif_wake_queue(dev) \ - do { clear_bit(0, &(dev)->tbusy); mark_bh(NET_BH); } while (0) -#define netif_stop_queue(dev) set_bit(0, &(dev)->tbusy) - -static inline void netif_start_queue(struct net_device *dev) -{ - dev->tbusy = 0; - dev->interrupt = 0; - dev->start = 1; -} - -#define netif_queue_stopped(dev) (dev)->tbusy -#define netif_running(dev) (dev)->start - -#endif - -#define netif_device_attach(dev) netif_start_queue(dev) -#define netif_device_detach(dev) netif_stop_queue(dev) - - -#define tasklet_struct tq_struct -static inline void tasklet_schedule(struct tasklet_struct *tasklet) -{ - queue_task(tasklet, &tq_immediate); - mark_bh(IMMEDIATE_BH); -} - -static inline void tasklet_init(struct tasklet_struct *tasklet, - void (*func)(unsigned long), - unsigned long data) -{ - tasklet->next = NULL; - tasklet->sync = 0; - tasklet->routine = (void (*)(void *))func; - tasklet->data = (void *)data; -} -#define tasklet_kill(tasklet) { do {} while (0); } - - -#define del_timer_sync(timer) del_timer(timer) - -#else - -#define netif_down(dev) - -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 3)) - - -#define PREPARE_TQUEUE(_tq, _routine, _data) \ - do { \ - (_tq)->routine = _routine; \ - (_tq)->data = _data; \ - } while (0) - - -#define INIT_TQUEUE(_tq, _routine, _data) \ - do { \ - INIT_LIST_HEAD(&(_tq)->list); \ - (_tq)->sync = 0; \ - PREPARE_TQUEUE((_tq), (_routine), (_data)); \ - } while (0) - -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 6)) - - - -static inline int -pci_save_state(struct pci_dev *dev, u32 *buffer) -{ - int i; - if (buffer) { - for (i = 0; i < 16; i++) - pci_read_config_dword(dev, i * 4, &buffer[i]); - } - return 0; -} - -static inline int -pci_restore_state(struct pci_dev *dev, u32 *buffer) -{ - int i; - - if (buffer) { - for (i = 0; i < 16; i++) - pci_write_config_dword(dev, i * 4, buffer[i]); - } - - else { - for (i = 0; i < 6; i ++) - pci_write_config_dword(dev, - PCI_BASE_ADDRESS_0 + (i * 4), - pci_resource_start(dev, i)); - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); - } - return 0; -} - -#endif - - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 19)) -#define read_c0_count() read_32bit_cp0_register(CP0_COUNT) -#endif - - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)) -#ifndef SET_MODULE_OWNER -#define SET_MODULE_OWNER(dev) do {} while (0) -#define OLD_MOD_INC_USE_COUNT MOD_INC_USE_COUNT -#define OLD_MOD_DEC_USE_COUNT MOD_DEC_USE_COUNT -#else -#define OLD_MOD_INC_USE_COUNT do {} while (0) -#define OLD_MOD_DEC_USE_COUNT do {} while (0) -#endif -#else -#ifndef SET_MODULE_OWNER -#define SET_MODULE_OWNER(dev) do {} while (0) -#endif -#ifndef MOD_INC_USE_COUNT -#define MOD_INC_USE_COUNT do {} while (0) -#endif -#ifndef MOD_DEC_USE_COUNT -#define MOD_DEC_USE_COUNT do {} while (0) -#endif -#define OLD_MOD_INC_USE_COUNT MOD_INC_USE_COUNT -#define OLD_MOD_DEC_USE_COUNT MOD_DEC_USE_COUNT -#endif - -#ifndef SET_NETDEV_DEV -#define SET_NETDEV_DEV(net, pdev) do {} while (0) -#endif - -#ifndef HAVE_FREE_NETDEV -#define free_netdev(dev) kfree(dev) -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) - -#define af_packet_priv data -#endif - - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) -#define DRV_SUSPEND_STATE_TYPE pm_message_t -#else -#define DRV_SUSPEND_STATE_TYPE uint32 -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) -#define CHECKSUM_HW CHECKSUM_PARTIAL -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) -#define KILL_PROC(pid, sig) \ -{ \ - struct task_struct *tsk; \ - tsk = pid_task(find_vpid(pid), PIDTYPE_PID); \ - if (tsk) send_sig(sig, tsk, 1); \ -} -#else -#define KILL_PROC(pid, sig) \ -{ \ - kill_proc(pid, sig, 1); \ -} -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) -#define netdev_priv(dev) dev->priv -#endif - -#endif diff --git a/drivers/net/wireless/bcm4319/include/miniopt.h b/drivers/net/wireless/bcm4319/include/miniopt.h deleted file mode 100644 index 3667fb1e215b..000000000000 --- a/drivers/net/wireless/bcm4319/include/miniopt.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Command line options parser. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * $Id: miniopt.h,v 1.1.6.2 2009/01/14 23:52:48 Exp $ - */ - - -#ifndef MINI_OPT_H -#define MINI_OPT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* ---- Include Files ---------------------------------------------------- */ -/* ---- Constants and Types ---------------------------------------------- */ - -#define MINIOPT_MAXKEY 128 /* Max options */ -typedef struct miniopt { - - /* These are persistent after miniopt_init() */ - const char* name; /* name for prompt in error strings */ - const char* flags; /* option chars that take no args */ - bool longflags; /* long options may be flags */ - bool opt_end; /* at end of options (passed a "--") */ - - /* These are per-call to miniopt() */ - - int consumed; /* number of argv entries cosumed in - * the most recent call to miniopt() - */ - bool positional; - bool good_int; /* 'val' member is the result of a sucessful - * strtol conversion of the option value - */ - char opt; - char key[MINIOPT_MAXKEY]; - char* valstr; /* positional param, or value for the option, - * or null if the option had - * no accompanying value - */ - uint uval; /* strtol translation of valstr */ - int val; /* strtol translation of valstr */ -} miniopt_t; - -void miniopt_init(miniopt_t *t, const char* name, const char* flags, bool longflags); -int miniopt(miniopt_t *t, char **argv); - - -/* ---- Variable Externs ------------------------------------------------- */ -/* ---- Function Prototypes ---------------------------------------------- */ - - -#ifdef __cplusplus - } -#endif - -#endif /* MINI_OPT_H */ diff --git a/drivers/net/wireless/bcm4319/include/msgtrace.h b/drivers/net/wireless/bcm4319/include/msgtrace.h deleted file mode 100644 index 1479086dba3e..000000000000 --- a/drivers/net/wireless/bcm4319/include/msgtrace.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Trace messages sent over HBUS - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: msgtrace.h,v 1.1.2.4 2009/01/27 04:09:40 Exp $ - */ - -#ifndef _MSGTRACE_H -#define _MSGTRACE_H - -#ifndef _TYPEDEFS_H_ -#include -#endif - - -/* This marks the start of a packed structure section. */ -#include - -#define MSGTRACE_VERSION 1 - -/* Message trace header */ -typedef BWL_PRE_PACKED_STRUCT struct msgtrace_hdr { - uint8 version; - uint8 spare; - uint16 len; /* Len of the trace */ - uint32 seqnum; /* Sequence number of message. Useful if the messsage has been lost - * because of DMA error or a bus reset (ex: SDIO Func2) - */ - uint32 discarded_bytes; /* Number of discarded bytes because of trace overflow */ - uint32 discarded_printf; /* Number of discarded printf because of trace overflow */ -} BWL_POST_PACKED_STRUCT msgtrace_hdr_t; - -#define MSGTRACE_HDRLEN sizeof(msgtrace_hdr_t) - -/* The hbus driver generates traces when sending a trace message. This causes endless traces. - * This flag must be set to TRUE in any hbus traces. The flag is reset in the function msgtrace_put. - * This prevents endless traces but generates hasardous lost of traces only in bus device code. - * It is recommendat to set this flag in macro SD_TRACE but not in SD_ERROR for avoiding missing - * hbus error traces. hbus error trace should not generates endless traces. - */ -extern bool msgtrace_hbus_trace; - -typedef void (*msgtrace_func_send_t)(void *hdl1, void *hdl2, uint8 *hdr, - uint16 hdrlen, uint8 *buf, uint16 buflen); - -extern void msgtrace_sent(void); -extern void msgtrace_put(char *buf, int count); -extern void msgtrace_init(void *hdl1, void *hdl2, msgtrace_func_send_t func_send); - -/* This marks the end of a packed structure section. */ -#include - -#endif /* _MSGTRACE_H */ diff --git a/drivers/net/wireless/bcm4319/include/osl.h b/drivers/net/wireless/bcm4319/include/osl.h deleted file mode 100644 index 5599e536eeea..000000000000 --- a/drivers/net/wireless/bcm4319/include/osl.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * OS Abstraction Layer - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * $Id: osl.h,v 13.37.32.1 2008/11/20 00:51:15 Exp $ - */ - - -#ifndef _osl_h_ -#define _osl_h_ - - -typedef struct osl_info osl_t; -typedef struct osl_dmainfo osldma_t; - -#define OSL_PKTTAG_SZ 32 - - -typedef void (*pktfree_cb_fn_t)(void *ctx, void *pkt, unsigned int status); - -#include - - - - -#define SET_REG(osh, r, mask, val) W_REG((osh), (r), ((R_REG((osh), r) & ~(mask)) | (val))) - -#ifndef AND_REG -#define AND_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) & (v)) -#endif - -#ifndef OR_REG -#define OR_REG(osh, r, v) W_REG(osh, (r), R_REG(osh, r) | (v)) -#endif - - -#endif diff --git a/drivers/net/wireless/bcm4319/include/packed_section_end.h b/drivers/net/wireless/bcm4319/include/packed_section_end.h deleted file mode 100644 index 5b61c18fcd08..000000000000 --- a/drivers/net/wireless/bcm4319/include/packed_section_end.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Declare directives for structure packing. No padding will be provided - * between the members of packed structures, and therefore, there is no - * guarantee that structure members will be aligned. - * - * Declaring packed structures is compiler specific. In order to handle all - * cases, packed structures should be delared as: - * - * #include - * - * typedef BWL_PRE_PACKED_STRUCT struct foobar_t { - * some_struct_members; - * } BWL_POST_PACKED_STRUCT foobar_t; - * - * #include - * - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * $Id: packed_section_end.h,v 1.1.6.3 2008/12/10 00:27:54 Exp $ - */ - - - - -#ifdef BWL_PACKED_SECTION - #undef BWL_PACKED_SECTION -#else - #error "BWL_PACKED_SECTION is NOT defined!" -#endif - - - - - -#undef BWL_PRE_PACKED_STRUCT -#undef BWL_POST_PACKED_STRUCT diff --git a/drivers/net/wireless/bcm4319/include/packed_section_start.h b/drivers/net/wireless/bcm4319/include/packed_section_start.h deleted file mode 100644 index cb93aa64079a..000000000000 --- a/drivers/net/wireless/bcm4319/include/packed_section_start.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Declare directives for structure packing. No padding will be provided - * between the members of packed structures, and therefore, there is no - * guarantee that structure members will be aligned. - * - * Declaring packed structures is compiler specific. In order to handle all - * cases, packed structures should be delared as: - * - * #include - * - * typedef BWL_PRE_PACKED_STRUCT struct foobar_t { - * some_struct_members; - * } BWL_POST_PACKED_STRUCT foobar_t; - * - * #include - * - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * $Id: packed_section_start.h,v 1.1.6.3 2008/12/10 00:27:54 Exp $ - */ - - - - -#ifdef BWL_PACKED_SECTION - #error "BWL_PACKED_SECTION is already defined!" -#else - #define BWL_PACKED_SECTION -#endif - - - - - -#if defined(__GNUC__) - #define BWL_PRE_PACKED_STRUCT - #define BWL_POST_PACKED_STRUCT __attribute__((packed)) -#elif defined(__CC_ARM) - #define BWL_PRE_PACKED_STRUCT __packed - #define BWL_POST_PACKED_STRUCT -#else - #error "Unknown compiler!" -#endif diff --git a/drivers/net/wireless/bcm4319/include/pcicfg.h b/drivers/net/wireless/bcm4319/include/pcicfg.h deleted file mode 100644 index 898962c942a8..000000000000 --- a/drivers/net/wireless/bcm4319/include/pcicfg.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * pcicfg.h: PCI configuration constants and structures. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: pcicfg.h,v 1.41.12.3 2008/06/26 22:49:41 Exp $ - */ - - -#ifndef _h_pcicfg_ -#define _h_pcicfg_ - - -#define PCI_CFG_VID 0 -#define PCI_CFG_CMD 4 -#define PCI_CFG_REV 8 -#define PCI_CFG_BAR0 0x10 -#define PCI_CFG_BAR1 0x14 -#define PCI_BAR0_WIN 0x80 -#define PCI_INT_STATUS 0x90 -#define PCI_INT_MASK 0x94 - -#define PCIE_EXTCFG_OFFSET 0x100 -#define PCI_BAR0_PCIREGS_OFFSET (6 * 1024) -#define PCI_BAR0_PCISBR_OFFSET (4 * 1024) - -#define PCI_BAR0_WINSZ (16 * 1024) - - -#define PCI_16KB0_PCIREGS_OFFSET (8 * 1024) -#define PCI_16KB0_CCREGS_OFFSET (12 * 1024) -#define PCI_16KBB0_WINSZ (16 * 1024) - -#endif diff --git a/drivers/net/wireless/bcm4319/include/proto/802.11.h b/drivers/net/wireless/bcm4319/include/proto/802.11.h deleted file mode 100644 index fd26317361da..000000000000 --- a/drivers/net/wireless/bcm4319/include/proto/802.11.h +++ /dev/null @@ -1,1433 +0,0 @@ -/* - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * Fundamental types and constants relating to 802.11 - * - * $Id: 802.11.h,v 9.219.4.1.4.5.6.11 2010/02/09 13:23:26 Exp $ - */ - - -#ifndef _802_11_H_ -#define _802_11_H_ - -#ifndef _TYPEDEFS_H_ -#include -#endif - -#ifndef _NET_ETHERNET_H_ -#include -#endif - -#include - - -#include - - -#define DOT11_TU_TO_US 1024 - - -#define DOT11_A3_HDR_LEN 24 -#define DOT11_A4_HDR_LEN 30 -#define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN -#define DOT11_FCS_LEN 4 -#define DOT11_ICV_LEN 4 -#define DOT11_ICV_AES_LEN 8 -#define DOT11_QOS_LEN 2 -#define DOT11_HTC_LEN 4 - -#define DOT11_KEY_INDEX_SHIFT 6 -#define DOT11_IV_LEN 4 -#define DOT11_IV_TKIP_LEN 8 -#define DOT11_IV_AES_OCB_LEN 4 -#define DOT11_IV_AES_CCM_LEN 8 -#define DOT11_IV_MAX_LEN 8 - - -#define DOT11_MAX_MPDU_BODY_LEN 2304 - -#define DOT11_MAX_MPDU_LEN (DOT11_A4_HDR_LEN + \ - DOT11_QOS_LEN + \ - DOT11_IV_AES_CCM_LEN + \ - DOT11_MAX_MPDU_BODY_LEN + \ - DOT11_ICV_LEN + \ - DOT11_FCS_LEN) - -#define DOT11_MAX_SSID_LEN 32 - - -#define DOT11_DEFAULT_RTS_LEN 2347 -#define DOT11_MAX_RTS_LEN 2347 - - -#define DOT11_MIN_FRAG_LEN 256 -#define DOT11_MAX_FRAG_LEN 2346 -#define DOT11_DEFAULT_FRAG_LEN 2346 - - -#define DOT11_MIN_BEACON_PERIOD 1 -#define DOT11_MAX_BEACON_PERIOD 0xFFFF - - -#define DOT11_MIN_DTIM_PERIOD 1 -#define DOT11_MAX_DTIM_PERIOD 0xFF - - -#define DOT11_LLC_SNAP_HDR_LEN 8 -#define DOT11_OUI_LEN 3 -BWL_PRE_PACKED_STRUCT struct dot11_llc_snap_header { - uint8 dsap; - uint8 ssap; - uint8 ctl; - uint8 oui[DOT11_OUI_LEN]; - uint16 type; -} BWL_POST_PACKED_STRUCT; - - -#define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN) - - - -BWL_PRE_PACKED_STRUCT struct dot11_header { - uint16 fc; - uint16 durid; - struct ether_addr a1; - struct ether_addr a2; - struct ether_addr a3; - uint16 seq; - struct ether_addr a4; -} BWL_POST_PACKED_STRUCT; - - - -BWL_PRE_PACKED_STRUCT struct dot11_rts_frame { - uint16 fc; - uint16 durid; - struct ether_addr ra; - struct ether_addr ta; -} BWL_POST_PACKED_STRUCT; -#define DOT11_RTS_LEN 16 - -BWL_PRE_PACKED_STRUCT struct dot11_cts_frame { - uint16 fc; - uint16 durid; - struct ether_addr ra; -} BWL_POST_PACKED_STRUCT; -#define DOT11_CTS_LEN 10 - -BWL_PRE_PACKED_STRUCT struct dot11_ack_frame { - uint16 fc; - uint16 durid; - struct ether_addr ra; -} BWL_POST_PACKED_STRUCT; -#define DOT11_ACK_LEN 10 - -BWL_PRE_PACKED_STRUCT struct dot11_ps_poll_frame { - uint16 fc; - uint16 durid; - struct ether_addr bssid; - struct ether_addr ta; -} BWL_POST_PACKED_STRUCT; -#define DOT11_PS_POLL_LEN 16 - -BWL_PRE_PACKED_STRUCT struct dot11_cf_end_frame { - uint16 fc; - uint16 durid; - struct ether_addr ra; - struct ether_addr bssid; -} BWL_POST_PACKED_STRUCT; -#define DOT11_CS_END_LEN 16 - -BWL_PRE_PACKED_STRUCT struct dot11_action_wifi_vendor_specific { - uint8 category; - uint8 OUI[3]; - uint8 type; - uint8 subtype; - uint8 data[1040]; - struct dot11_action_wifi_vendor_specific* next_node; -} BWL_POST_PACKED_STRUCT; - -typedef struct dot11_action_wifi_vendor_specific dot11_action_wifi_vendor_specific_t; - -#define DOT11_BA_CTL_POLICY_NORMAL 0x0000 -#define DOT11_BA_CTL_POLICY_NOACK 0x0001 -#define DOT11_BA_CTL_POLICY_MASK 0x0001 - -#define DOT11_BA_CTL_MTID 0x0002 -#define DOT11_BA_CTL_COMPRESSED 0x0004 - -#define DOT11_BA_CTL_NUMMSDU_MASK 0x0FC0 -#define DOT11_BA_CTL_NUMMSDU_SHIFT 6 - -#define DOT11_BA_CTL_TID_MASK 0xF000 -#define DOT11_BA_CTL_TID_SHIFT 12 - - -BWL_PRE_PACKED_STRUCT struct dot11_ctl_header { - uint16 fc; - uint16 durid; - struct ether_addr ra; - struct ether_addr ta; -} BWL_POST_PACKED_STRUCT; -#define DOT11_CTL_HDR_LEN 16 - - -BWL_PRE_PACKED_STRUCT struct dot11_bar { - uint16 bar_control; - uint16 seqnum; -} BWL_POST_PACKED_STRUCT; -#define DOT11_BAR_LEN 4 - -#define DOT11_BA_BITMAP_LEN 128 -#define DOT11_BA_CMP_BITMAP_LEN 8 - -BWL_PRE_PACKED_STRUCT struct dot11_ba { - uint16 ba_control; - uint16 seqnum; - uint8 bitmap[DOT11_BA_BITMAP_LEN]; -} BWL_POST_PACKED_STRUCT; -#define DOT11_BA_LEN 4 - - -BWL_PRE_PACKED_STRUCT struct dot11_management_header { - uint16 fc; - uint16 durid; - struct ether_addr da; - struct ether_addr sa; - struct ether_addr bssid; - uint16 seq; -} BWL_POST_PACKED_STRUCT; -#define DOT11_MGMT_HDR_LEN 24 - - - -BWL_PRE_PACKED_STRUCT struct dot11_bcn_prb { - uint32 timestamp[2]; - uint16 beacon_interval; - uint16 capability; -} BWL_POST_PACKED_STRUCT; -#define DOT11_BCN_PRB_LEN 12 - -BWL_PRE_PACKED_STRUCT struct dot11_auth { - uint16 alg; - uint16 seq; - uint16 status; -} BWL_POST_PACKED_STRUCT; -#define DOT11_AUTH_FIXED_LEN 6 - -BWL_PRE_PACKED_STRUCT struct dot11_assoc_req { - uint16 capability; - uint16 listen; -} BWL_POST_PACKED_STRUCT; -#define DOT11_ASSOC_REQ_FIXED_LEN 4 - -BWL_PRE_PACKED_STRUCT struct dot11_reassoc_req { - uint16 capability; - uint16 listen; - struct ether_addr ap; -} BWL_POST_PACKED_STRUCT; -#define DOT11_REASSOC_REQ_FIXED_LEN 10 - -BWL_PRE_PACKED_STRUCT struct dot11_assoc_resp { - uint16 capability; - uint16 status; - uint16 aid; -} BWL_POST_PACKED_STRUCT; -#define DOT11_ASSOC_RESP_FIXED_LEN 6 - -BWL_PRE_PACKED_STRUCT struct dot11_action_measure { - uint8 category; - uint8 action; - uint8 token; - uint8 data[1]; -} BWL_POST_PACKED_STRUCT; -#define DOT11_ACTION_MEASURE_LEN 3 - -BWL_PRE_PACKED_STRUCT struct dot11_action_ht_ch_width { - uint8 category; - uint8 action; - uint8 ch_width; -} BWL_POST_PACKED_STRUCT; - -BWL_PRE_PACKED_STRUCT struct dot11_action_ht_mimops { - uint8 category; - uint8 action; - uint8 control; -} BWL_POST_PACKED_STRUCT; - -#define SM_PWRSAVE_ENABLE 1 -#define SM_PWRSAVE_MODE 2 - - -BWL_PRE_PACKED_STRUCT struct dot11_power_cnst { - uint8 id; - uint8 len; - uint8 power; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_power_cnst dot11_power_cnst_t; - -BWL_PRE_PACKED_STRUCT struct dot11_power_cap { - uint8 min; - uint8 max; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_power_cap dot11_power_cap_t; - -BWL_PRE_PACKED_STRUCT struct dot11_tpc_rep { - uint8 id; - uint8 len; - uint8 tx_pwr; - uint8 margin; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_tpc_rep dot11_tpc_rep_t; -#define DOT11_MNG_IE_TPC_REPORT_LEN 2 - -BWL_PRE_PACKED_STRUCT struct dot11_supp_channels { - uint8 id; - uint8 len; - uint8 first_channel; - uint8 num_channels; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_supp_channels dot11_supp_channels_t; - - -BWL_PRE_PACKED_STRUCT struct dot11_extch { - uint8 id; - uint8 len; - uint8 extch; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_extch dot11_extch_ie_t; - -BWL_PRE_PACKED_STRUCT struct dot11_brcm_extch { - uint8 id; - uint8 len; - uint8 oui[3]; - uint8 type; - uint8 extch; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_brcm_extch dot11_brcm_extch_ie_t; - -#define BRCM_EXTCH_IE_LEN 5 -#define BRCM_EXTCH_IE_TYPE 53 -#define DOT11_EXTCH_IE_LEN 1 -#define DOT11_EXT_CH_MASK 0x03 -#define DOT11_EXT_CH_UPPER 0x01 -#define DOT11_EXT_CH_LOWER 0x03 -#define DOT11_EXT_CH_NONE 0x00 - -BWL_PRE_PACKED_STRUCT struct dot11_action_frmhdr { - uint8 category; - uint8 action; - uint8 data[1]; -} BWL_POST_PACKED_STRUCT; -#define DOT11_ACTION_FRMHDR_LEN 2 - - -BWL_PRE_PACKED_STRUCT struct dot11_channel_switch { - uint8 id; - uint8 len; - uint8 mode; - uint8 channel; - uint8 count; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_channel_switch dot11_chan_switch_ie_t; - -#define DOT11_SWITCH_IE_LEN 3 - -#define DOT11_CSA_MODE_ADVISORY 0 -#define DOT11_CSA_MODE_NO_TX 1 - -BWL_PRE_PACKED_STRUCT struct dot11_action_switch_channel { - uint8 category; - uint8 action; - dot11_chan_switch_ie_t chan_switch_ie; - dot11_brcm_extch_ie_t extch_ie; -} BWL_POST_PACKED_STRUCT; - -BWL_PRE_PACKED_STRUCT struct dot11_csa_body { - uint8 mode; - uint8 reg; - uint8 channel; - uint8 count; -} BWL_POST_PACKED_STRUCT; - - -BWL_PRE_PACKED_STRUCT struct dot11_ext_csa { - uint8 id; - uint8 len; - struct dot11_csa_body b; -} BWL_POST_PACKED_STRUCT; - -BWL_PRE_PACKED_STRUCT struct dot11y_action_ext_csa { - uint8 category; - uint8 action; - struct dot11_csa_body b; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_ext_csa dot11_ext_csa_ie_t; -#define DOT11_EXT_CSA_IE_LEN 4 - -BWL_PRE_PACKED_STRUCT struct dot11_action_ext_csa { - uint8 category; - uint8 action; - dot11_ext_csa_ie_t chan_switch_ie; -} BWL_POST_PACKED_STRUCT; - -BWL_PRE_PACKED_STRUCT struct dot11_obss_coex { - uint8 id; - uint8 len; - uint8 info; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_obss_coex dot11_obss_coex_t; -#define DOT11_OBSS_COEXINFO_LEN 1 - -#define DOT11_OBSS_COEX_INFO_REQ 0x01 -#define DOT11_OBSS_COEX_40MHZ_INTOLERANT 0x02 -#define DOT11_OBSS_COEX_20MHZ_WIDTH_REQ 0x04 - -BWL_PRE_PACKED_STRUCT struct dot11_obss_chanlist { - uint8 id; - uint8 len; - uint8 regclass; - uint8 chanlist[1]; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_obss_chanlist dot11_obss_chanlist_t; -#define DOT11_OBSS_CHANLIST_FIXED_LEN 1 - -BWL_PRE_PACKED_STRUCT struct dot11_extcap_ie { - uint8 id; - uint8 len; - uint8 cap; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_extcap_ie dot11_extcap_ie_t; -#define DOT11_EXTCAP_LEN 1 - - - -#define DOT11_MEASURE_TYPE_BASIC 0 -#define DOT11_MEASURE_TYPE_CCA 1 -#define DOT11_MEASURE_TYPE_RPI 2 - - -#define DOT11_MEASURE_MODE_ENABLE (1<<1) -#define DOT11_MEASURE_MODE_REQUEST (1<<2) -#define DOT11_MEASURE_MODE_REPORT (1<<3) - -#define DOT11_MEASURE_MODE_LATE (1<<0) -#define DOT11_MEASURE_MODE_INCAPABLE (1<<1) -#define DOT11_MEASURE_MODE_REFUSED (1<<2) - -#define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0)) -#define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1)) -#define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2)) -#define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3)) -#define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4)) - -BWL_PRE_PACKED_STRUCT struct dot11_meas_req { - uint8 id; - uint8 len; - uint8 token; - uint8 mode; - uint8 type; - uint8 channel; - uint8 start_time[8]; - uint16 duration; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_meas_req dot11_meas_req_t; -#define DOT11_MNG_IE_MREQ_LEN 14 - -#define DOT11_MNG_IE_MREQ_FIXED_LEN 3 - -BWL_PRE_PACKED_STRUCT struct dot11_meas_rep { - uint8 id; - uint8 len; - uint8 token; - uint8 mode; - uint8 type; - BWL_PRE_PACKED_STRUCT union - { - BWL_PRE_PACKED_STRUCT struct { - uint8 channel; - uint8 start_time[8]; - uint16 duration; - uint8 map; - } BWL_POST_PACKED_STRUCT basic; - uint8 data[1]; - } BWL_POST_PACKED_STRUCT rep; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_meas_rep dot11_meas_rep_t; - - -#define DOT11_MNG_IE_MREP_FIXED_LEN 3 - -BWL_PRE_PACKED_STRUCT struct dot11_meas_rep_basic { - uint8 channel; - uint8 start_time[8]; - uint16 duration; - uint8 map; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t; -#define DOT11_MEASURE_BASIC_REP_LEN 12 - -BWL_PRE_PACKED_STRUCT struct dot11_quiet { - uint8 id; - uint8 len; - uint8 count; - uint8 period; - uint16 duration; - uint16 offset; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_quiet dot11_quiet_t; - -BWL_PRE_PACKED_STRUCT struct chan_map_tuple { - uint8 channel; - uint8 map; -} BWL_POST_PACKED_STRUCT; -typedef struct chan_map_tuple chan_map_tuple_t; - -BWL_PRE_PACKED_STRUCT struct dot11_ibss_dfs { - uint8 id; - uint8 len; - uint8 eaddr[ETHER_ADDR_LEN]; - uint8 interval; - chan_map_tuple_t map[1]; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_ibss_dfs dot11_ibss_dfs_t; - - -#define WME_OUI "\x00\x50\xf2" -#define WME_VER 1 -#define WME_TYPE 2 -#define WME_SUBTYPE_IE 0 -#define WME_SUBTYPE_PARAM_IE 1 -#define WME_SUBTYPE_TSPEC 2 - - -#define AC_BE 0 -#define AC_BK 1 -#define AC_VI 2 -#define AC_VO 3 -#define AC_COUNT 4 - -typedef uint8 ac_bitmap_t; - -#define AC_BITMAP_NONE 0x0 -#define AC_BITMAP_ALL 0xf -#define AC_BITMAP_TST(ab, ac) (((ab) & (1 << (ac))) != 0) -#define AC_BITMAP_SET(ab, ac) (((ab) |= (1 << (ac)))) -#define AC_BITMAP_RESET(ab, ac) (((ab) &= ~(1 << (ac)))) - - -BWL_PRE_PACKED_STRUCT struct wme_ie { - uint8 oui[3]; - uint8 type; - uint8 subtype; - uint8 version; - uint8 qosinfo; -} BWL_POST_PACKED_STRUCT; -typedef struct wme_ie wme_ie_t; -#define WME_IE_LEN 7 - -BWL_PRE_PACKED_STRUCT struct edcf_acparam { - uint8 ACI; - uint8 ECW; - uint16 TXOP; -} BWL_POST_PACKED_STRUCT; -typedef struct edcf_acparam edcf_acparam_t; - - -BWL_PRE_PACKED_STRUCT struct wme_param_ie { - uint8 oui[3]; - uint8 type; - uint8 subtype; - uint8 version; - uint8 qosinfo; - uint8 rsvd; - edcf_acparam_t acparam[AC_COUNT]; -} BWL_POST_PACKED_STRUCT; -typedef struct wme_param_ie wme_param_ie_t; -#define WME_PARAM_IE_LEN 24 - - -#define WME_QI_AP_APSD_MASK 0x80 -#define WME_QI_AP_APSD_SHIFT 7 -#define WME_QI_AP_COUNT_MASK 0x0f -#define WME_QI_AP_COUNT_SHIFT 0 - - -#define WME_QI_STA_MAXSPLEN_MASK 0x60 -#define WME_QI_STA_MAXSPLEN_SHIFT 5 -#define WME_QI_STA_APSD_ALL_MASK 0xf -#define WME_QI_STA_APSD_ALL_SHIFT 0 -#define WME_QI_STA_APSD_BE_MASK 0x8 -#define WME_QI_STA_APSD_BE_SHIFT 3 -#define WME_QI_STA_APSD_BK_MASK 0x4 -#define WME_QI_STA_APSD_BK_SHIFT 2 -#define WME_QI_STA_APSD_VI_MASK 0x2 -#define WME_QI_STA_APSD_VI_SHIFT 1 -#define WME_QI_STA_APSD_VO_MASK 0x1 -#define WME_QI_STA_APSD_VO_SHIFT 0 - - -#define EDCF_AIFSN_MIN 1 -#define EDCF_AIFSN_MAX 15 -#define EDCF_AIFSN_MASK 0x0f -#define EDCF_ACM_MASK 0x10 -#define EDCF_ACI_MASK 0x60 -#define EDCF_ACI_SHIFT 5 -#define EDCF_AIFSN_SHIFT 12 - - -#define EDCF_ECW_MIN 0 -#define EDCF_ECW_MAX 15 -#define EDCF_ECW2CW(exp) ((1 << (exp)) - 1) -#define EDCF_ECWMIN_MASK 0x0f -#define EDCF_ECWMAX_MASK 0xf0 -#define EDCF_ECWMAX_SHIFT 4 - - -#define EDCF_TXOP_MIN 0 -#define EDCF_TXOP_MAX 65535 -#define EDCF_TXOP2USEC(txop) ((txop) << 5) - - -#define NON_EDCF_AC_BE_ACI_STA 0x02 - - -#define EDCF_AC_BE_ACI_STA 0x03 -#define EDCF_AC_BE_ECW_STA 0xA4 -#define EDCF_AC_BE_TXOP_STA 0x0000 -#define EDCF_AC_BK_ACI_STA 0x27 -#define EDCF_AC_BK_ECW_STA 0xA4 -#define EDCF_AC_BK_TXOP_STA 0x0000 -#define EDCF_AC_VI_ACI_STA 0x42 -#define EDCF_AC_VI_ECW_STA 0x43 -#define EDCF_AC_VI_TXOP_STA 0x005e -#define EDCF_AC_VO_ACI_STA 0x62 -#define EDCF_AC_VO_ECW_STA 0x32 -#define EDCF_AC_VO_TXOP_STA 0x002f - - -#define EDCF_AC_BE_ACI_AP 0x03 -#define EDCF_AC_BE_ECW_AP 0x64 -#define EDCF_AC_BE_TXOP_AP 0x0000 -#define EDCF_AC_BK_ACI_AP 0x27 -#define EDCF_AC_BK_ECW_AP 0xA4 -#define EDCF_AC_BK_TXOP_AP 0x0000 -#define EDCF_AC_VI_ACI_AP 0x41 -#define EDCF_AC_VI_ECW_AP 0x43 -#define EDCF_AC_VI_TXOP_AP 0x005e -#define EDCF_AC_VO_ACI_AP 0x61 -#define EDCF_AC_VO_ECW_AP 0x32 -#define EDCF_AC_VO_TXOP_AP 0x002f - - -BWL_PRE_PACKED_STRUCT struct edca_param_ie { - uint8 qosinfo; - uint8 rsvd; - edcf_acparam_t acparam[AC_COUNT]; -} BWL_POST_PACKED_STRUCT; -typedef struct edca_param_ie edca_param_ie_t; -#define EDCA_PARAM_IE_LEN 18 - - -BWL_PRE_PACKED_STRUCT struct qos_cap_ie { - uint8 qosinfo; -} BWL_POST_PACKED_STRUCT; -typedef struct qos_cap_ie qos_cap_ie_t; - -BWL_PRE_PACKED_STRUCT struct dot11_qbss_load_ie { - uint8 id; - uint8 length; - uint16 station_count; - uint8 channel_utilization; - uint16 aac; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_qbss_load_ie dot11_qbss_load_ie_t; - - -#define FIXED_MSDU_SIZE 0x8000 -#define MSDU_SIZE_MASK 0x7fff - - - -#define INTEGER_SHIFT 13 -#define FRACTION_MASK 0x1FFF - - -BWL_PRE_PACKED_STRUCT struct dot11_management_notification { - uint8 category; - uint8 action; - uint8 token; - uint8 status; - uint8 data[1]; -} BWL_POST_PACKED_STRUCT; -#define DOT11_MGMT_NOTIFICATION_LEN 4 - - -#define WME_ADDTS_REQUEST 0 -#define WME_ADDTS_RESPONSE 1 -#define WME_DELTS_REQUEST 2 - - -#define WME_ADMISSION_ACCEPTED 0 -#define WME_INVALID_PARAMETERS 1 -#define WME_ADMISSION_REFUSED 3 - - -#define BCN_PRB_SSID(body) ((char*)(body) + DOT11_BCN_PRB_LEN) - - -#define DOT11_OPEN_SYSTEM 0 -#define DOT11_SHARED_KEY 1 - -#define DOT11_OPEN_SHARED 2 -#define DOT11_CHALLENGE_LEN 128 - - -#define FC_PVER_MASK 0x3 -#define FC_PVER_SHIFT 0 -#define FC_TYPE_MASK 0xC -#define FC_TYPE_SHIFT 2 -#define FC_SUBTYPE_MASK 0xF0 -#define FC_SUBTYPE_SHIFT 4 -#define FC_TODS 0x100 -#define FC_TODS_SHIFT 8 -#define FC_FROMDS 0x200 -#define FC_FROMDS_SHIFT 9 -#define FC_MOREFRAG 0x400 -#define FC_MOREFRAG_SHIFT 10 -#define FC_RETRY 0x800 -#define FC_RETRY_SHIFT 11 -#define FC_PM 0x1000 -#define FC_PM_SHIFT 12 -#define FC_MOREDATA 0x2000 -#define FC_MOREDATA_SHIFT 13 -#define FC_WEP 0x4000 -#define FC_WEP_SHIFT 14 -#define FC_ORDER 0x8000 -#define FC_ORDER_SHIFT 15 - - -#define SEQNUM_SHIFT 4 -#define SEQNUM_MAX 0x1000 -#define FRAGNUM_MASK 0xF - - - - -#define FC_TYPE_MNG 0 -#define FC_TYPE_CTL 1 -#define FC_TYPE_DATA 2 - - -#define FC_SUBTYPE_ASSOC_REQ 0 -#define FC_SUBTYPE_ASSOC_RESP 1 -#define FC_SUBTYPE_REASSOC_REQ 2 -#define FC_SUBTYPE_REASSOC_RESP 3 -#define FC_SUBTYPE_PROBE_REQ 4 -#define FC_SUBTYPE_PROBE_RESP 5 -#define FC_SUBTYPE_BEACON 8 -#define FC_SUBTYPE_ATIM 9 -#define FC_SUBTYPE_DISASSOC 10 -#define FC_SUBTYPE_AUTH 11 -#define FC_SUBTYPE_DEAUTH 12 -#define FC_SUBTYPE_ACTION 13 -#define FC_SUBTYPE_ACTION_NOACK 14 - - -#define FC_SUBTYPE_CTL_WRAPPER 7 -#define FC_SUBTYPE_BLOCKACK_REQ 8 -#define FC_SUBTYPE_BLOCKACK 9 -#define FC_SUBTYPE_PS_POLL 10 -#define FC_SUBTYPE_RTS 11 -#define FC_SUBTYPE_CTS 12 -#define FC_SUBTYPE_ACK 13 -#define FC_SUBTYPE_CF_END 14 -#define FC_SUBTYPE_CF_END_ACK 15 - - -#define FC_SUBTYPE_DATA 0 -#define FC_SUBTYPE_DATA_CF_ACK 1 -#define FC_SUBTYPE_DATA_CF_POLL 2 -#define FC_SUBTYPE_DATA_CF_ACK_POLL 3 -#define FC_SUBTYPE_NULL 4 -#define FC_SUBTYPE_CF_ACK 5 -#define FC_SUBTYPE_CF_POLL 6 -#define FC_SUBTYPE_CF_ACK_POLL 7 -#define FC_SUBTYPE_QOS_DATA 8 -#define FC_SUBTYPE_QOS_DATA_CF_ACK 9 -#define FC_SUBTYPE_QOS_DATA_CF_POLL 10 -#define FC_SUBTYPE_QOS_DATA_CF_ACK_POLL 11 -#define FC_SUBTYPE_QOS_NULL 12 -#define FC_SUBTYPE_QOS_CF_POLL 14 -#define FC_SUBTYPE_QOS_CF_ACK_POLL 15 - - -#define FC_SUBTYPE_ANY_QOS(s) (((s) & 8) != 0) -#define FC_SUBTYPE_ANY_NULL(s) (((s) & 4) != 0) -#define FC_SUBTYPE_ANY_CF_POLL(s) (((s) & 2) != 0) -#define FC_SUBTYPE_ANY_CF_ACK(s) (((s) & 1) != 0) - - -#define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK) - -#define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT)) - -#define FC_SUBTYPE(fc) (((fc) & FC_SUBTYPE_MASK) >> FC_SUBTYPE_SHIFT) -#define FC_TYPE(fc) (((fc) & FC_TYPE_MASK) >> FC_TYPE_SHIFT) - -#define FC_ASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ) -#define FC_ASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP) -#define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ) -#define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP) -#define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ) -#define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP) -#define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON) -#define FC_DISASSOC FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC) -#define FC_AUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH) -#define FC_DEAUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH) -#define FC_ACTION FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION) -#define FC_ACTION_NOACK FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION_NOACK) - -#define FC_CTL_WRAPPER FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTL_WRAPPER) -#define FC_BLOCKACK_REQ FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK_REQ) -#define FC_BLOCKACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK) -#define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL) -#define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS) -#define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS) -#define FC_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK) -#define FC_CF_END FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END) -#define FC_CF_END_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK) - -#define FC_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA) -#define FC_NULL_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL) -#define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK) -#define FC_QOS_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_DATA) -#define FC_QOS_NULL FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_NULL) - - - - -#define QOS_PRIO_SHIFT 0 -#define QOS_PRIO_MASK 0x0007 -#define QOS_PRIO(qos) (((qos) & QOS_PRIO_MASK) >> QOS_PRIO_SHIFT) - - -#define QOS_TID_SHIFT 0 -#define QOS_TID_MASK 0x000f -#define QOS_TID(qos) (((qos) & QOS_TID_MASK) >> QOS_TID_SHIFT) - - -#define QOS_EOSP_SHIFT 4 -#define QOS_EOSP_MASK 0x0010 -#define QOS_EOSP(qos) (((qos) & QOS_EOSP_MASK) >> QOS_EOSP_SHIFT) - - -#define QOS_ACK_NORMAL_ACK 0 -#define QOS_ACK_NO_ACK 1 -#define QOS_ACK_NO_EXP_ACK 2 -#define QOS_ACK_BLOCK_ACK 3 -#define QOS_ACK_SHIFT 5 -#define QOS_ACK_MASK 0x0060 -#define QOS_ACK(qos) (((qos) & QOS_ACK_MASK) >> QOS_ACK_SHIFT) - - -#define QOS_AMSDU_SHIFT 7 -#define QOS_AMSDU_MASK 0x0080 - - - - - - -#define DOT11_MNG_AUTH_ALGO_LEN 2 -#define DOT11_MNG_AUTH_SEQ_LEN 2 -#define DOT11_MNG_BEACON_INT_LEN 2 -#define DOT11_MNG_CAP_LEN 2 -#define DOT11_MNG_AP_ADDR_LEN 6 -#define DOT11_MNG_LISTEN_INT_LEN 2 -#define DOT11_MNG_REASON_LEN 2 -#define DOT11_MNG_AID_LEN 2 -#define DOT11_MNG_STATUS_LEN 2 -#define DOT11_MNG_TIMESTAMP_LEN 8 - - -#define DOT11_AID_MASK 0x3fff - - -#define DOT11_RC_RESERVED 0 -#define DOT11_RC_UNSPECIFIED 1 -#define DOT11_RC_AUTH_INVAL 2 -#define DOT11_RC_DEAUTH_LEAVING 3 -#define DOT11_RC_INACTIVITY 4 -#define DOT11_RC_BUSY 5 -#define DOT11_RC_INVAL_CLASS_2 6 -#define DOT11_RC_INVAL_CLASS_3 7 -#define DOT11_RC_DISASSOC_LEAVING 8 -#define DOT11_RC_NOT_AUTH 9 -#define DOT11_RC_BAD_PC 10 -#define DOT11_RC_BAD_CHANNELS 11 - - - -#define DOT11_RC_UNSPECIFIED_QOS 32 -#define DOT11_RC_INSUFFCIENT_BW 33 -#define DOT11_RC_EXCESSIVE_FRAMES 34 -#define DOT11_RC_TX_OUTSIDE_TXOP 35 -#define DOT11_RC_LEAVING_QBSS 36 -#define DOT11_RC_BAD_MECHANISM 37 -#define DOT11_RC_SETUP_NEEDED 38 -#define DOT11_RC_TIMEOUT 39 - -#define DOT11_RC_MAX 23 - - -#define DOT11_SC_SUCCESS 0 -#define DOT11_SC_FAILURE 1 -#define DOT11_SC_CAP_MISMATCH 10 -#define DOT11_SC_REASSOC_FAIL 11 -#define DOT11_SC_ASSOC_FAIL 12 -#define DOT11_SC_AUTH_MISMATCH 13 -#define DOT11_SC_AUTH_SEQ 14 -#define DOT11_SC_AUTH_CHALLENGE_FAIL 15 -#define DOT11_SC_AUTH_TIMEOUT 16 -#define DOT11_SC_ASSOC_BUSY_FAIL 17 -#define DOT11_SC_ASSOC_RATE_MISMATCH 18 -#define DOT11_SC_ASSOC_SHORT_REQUIRED 19 -#define DOT11_SC_ASSOC_PBCC_REQUIRED 20 -#define DOT11_SC_ASSOC_AGILITY_REQUIRED 21 -#define DOT11_SC_ASSOC_SPECTRUM_REQUIRED 22 -#define DOT11_SC_ASSOC_BAD_POWER_CAP 23 -#define DOT11_SC_ASSOC_BAD_SUP_CHANNELS 24 -#define DOT11_SC_ASSOC_SHORTSLOT_REQUIRED 25 -#define DOT11_SC_ASSOC_ERPBCC_REQUIRED 26 -#define DOT11_SC_ASSOC_DSSOFDM_REQUIRED 27 - -#define DOT11_SC_DECLINED 37 -#define DOT11_SC_INVALID_PARAMS 38 - - -#define DOT11_MNG_DS_PARAM_LEN 1 -#define DOT11_MNG_IBSS_PARAM_LEN 2 - - -#define DOT11_MNG_TIM_FIXED_LEN 3 -#define DOT11_MNG_TIM_DTIM_COUNT 0 -#define DOT11_MNG_TIM_DTIM_PERIOD 1 -#define DOT11_MNG_TIM_BITMAP_CTL 2 -#define DOT11_MNG_TIM_PVB 3 - - -#define TLV_TAG_OFF 0 -#define TLV_LEN_OFF 1 -#define TLV_HDR_LEN 2 -#define TLV_BODY_OFF 2 - - -#define DOT11_MNG_SSID_ID 0 -#define DOT11_MNG_RATES_ID 1 -#define DOT11_MNG_FH_PARMS_ID 2 -#define DOT11_MNG_DS_PARMS_ID 3 -#define DOT11_MNG_CF_PARMS_ID 4 -#define DOT11_MNG_TIM_ID 5 -#define DOT11_MNG_IBSS_PARMS_ID 6 -#define DOT11_MNG_COUNTRY_ID 7 -#define DOT11_MNG_HOPPING_PARMS_ID 8 -#define DOT11_MNG_HOPPING_TABLE_ID 9 -#define DOT11_MNG_REQUEST_ID 10 -#define DOT11_MNG_QBSS_LOAD_ID 11 -#define DOT11_MNG_EDCA_PARAM_ID 12 -#define DOT11_MNG_CHALLENGE_ID 16 -#define DOT11_MNG_PWR_CONSTRAINT_ID 32 -#define DOT11_MNG_PWR_CAP_ID 33 -#define DOT11_MNG_TPC_REQUEST_ID 34 -#define DOT11_MNG_TPC_REPORT_ID 35 -#define DOT11_MNG_SUPP_CHANNELS_ID 36 -#define DOT11_MNG_CHANNEL_SWITCH_ID 37 -#define DOT11_MNG_MEASURE_REQUEST_ID 38 -#define DOT11_MNG_MEASURE_REPORT_ID 39 -#define DOT11_MNG_QUIET_ID 40 -#define DOT11_MNG_IBSS_DFS_ID 41 -#define DOT11_MNG_ERP_ID 42 -#define DOT11_MNG_TS_DELAY_ID 43 -#define DOT11_MNG_HT_CAP 45 -#define DOT11_MNG_QOS_CAP_ID 46 -#define DOT11_MNG_NONERP_ID 47 -#define DOT11_MNG_RSN_ID 48 -#define DOT11_MNG_EXT_RATES_ID 50 -#define DOT11_MNG_REGCLASS_ID 59 -#define DOT11_MNG_EXT_CSA_ID 60 -#define DOT11_MNG_HT_ADD 61 -#define DOT11_MNG_EXT_CHANNEL_OFFSET 62 -#define DOT11_MNG_WAPI_ID 68 -#define DOT11_MNG_HT_BSS_COEXINFO_ID 72 -#define DOT11_MNG_HT_BSS_CHANNEL_REPORT_ID 73 -#define DOT11_MNG_HT_OBSS_ID 74 -#define DOT11_MNG_EXT_CAP 127 -#define DOT11_MNG_WPA_ID 221 -#define DOT11_MNG_PROPR_ID 221 - - -#define DOT11_RATE_BASIC 0x80 -#define DOT11_RATE_MASK 0x7F - - -#define DOT11_MNG_ERP_LEN 1 -#define DOT11_MNG_NONERP_PRESENT 0x01 -#define DOT11_MNG_USE_PROTECTION 0x02 -#define DOT11_MNG_BARKER_PREAMBLE 0x04 - -#define DOT11_MGN_TS_DELAY_LEN 4 -#define TS_DELAY_FIELD_SIZE 4 - - -#define DOT11_CAP_ESS 0x0001 -#define DOT11_CAP_IBSS 0x0002 -#define DOT11_CAP_POLLABLE 0x0004 -#define DOT11_CAP_POLL_RQ 0x0008 -#define DOT11_CAP_PRIVACY 0x0010 -#define DOT11_CAP_SHORT 0x0020 -#define DOT11_CAP_PBCC 0x0040 -#define DOT11_CAP_AGILITY 0x0080 -#define DOT11_CAP_SPECTRUM 0x0100 -#define DOT11_CAP_SHORTSLOT 0x0400 -#define DOT11_CAP_CCK_OFDM 0x2000 - - -#define DOT11_OBSS_COEX_MNG_SUPPORT 0x01 - - -#define DOT11_ACTION_HDR_LEN 2 -#define DOT11_ACTION_CAT_ERR_MASK 0x80 -#define DOT11_ACTION_CAT_MASK 0x7F -#define DOT11_ACTION_CAT_SPECT_MNG 0 -#define DOT11_ACTION_CAT_BLOCKACK 3 -#define DOT11_ACTION_CAT_PUBLIC 4 -#define DOT11_ACTION_CAT_HT 7 -#define DOT11_ACTION_CAT_VS 127 -#define DOT11_ACTION_NOTIFICATION 0x11 - -#define DOT11_ACTION_ID_M_REQ 0 -#define DOT11_ACTION_ID_M_REP 1 -#define DOT11_ACTION_ID_TPC_REQ 2 -#define DOT11_ACTION_ID_TPC_REP 3 -#define DOT11_ACTION_ID_CHANNEL_SWITCH 4 -#define DOT11_ACTION_ID_EXT_CSA 5 - - -#define DOT11_ACTION_ID_HT_CH_WIDTH 0 -#define DOT11_ACTION_ID_HT_MIMO_PS 1 - - -#define DOT11_PUB_ACTION_BSS_COEX_MNG 0 -#define DOT11_PUB_ACTION_CHANNEL_SWITCH 4 - - -#define DOT11_BA_ACTION_ADDBA_REQ 0 -#define DOT11_BA_ACTION_ADDBA_RESP 1 -#define DOT11_BA_ACTION_DELBA 2 - - -#define DOT11_ADDBA_PARAM_AMSDU_SUP 0x0001 -#define DOT11_ADDBA_PARAM_POLICY_MASK 0x0002 -#define DOT11_ADDBA_PARAM_POLICY_SHIFT 1 -#define DOT11_ADDBA_PARAM_TID_MASK 0x003c -#define DOT11_ADDBA_PARAM_TID_SHIFT 2 -#define DOT11_ADDBA_PARAM_BSIZE_MASK 0xffc0 -#define DOT11_ADDBA_PARAM_BSIZE_SHIFT 6 - -#define DOT11_ADDBA_POLICY_DELAYED 0 -#define DOT11_ADDBA_POLICY_IMMEDIATE 1 - -BWL_PRE_PACKED_STRUCT struct dot11_addba_req { - uint8 category; - uint8 action; - uint8 token; - uint16 addba_param_set; - uint16 timeout; - uint16 start_seqnum; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_addba_req dot11_addba_req_t; -#define DOT11_ADDBA_REQ_LEN 9 - -BWL_PRE_PACKED_STRUCT struct dot11_addba_resp { - uint8 category; - uint8 action; - uint8 token; - uint16 status; - uint16 addba_param_set; - uint16 timeout; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_addba_resp dot11_addba_resp_t; -#define DOT11_ADDBA_RESP_LEN 9 - - -#define DOT11_DELBA_PARAM_INIT_MASK 0x0800 -#define DOT11_DELBA_PARAM_INIT_SHIFT 11 -#define DOT11_DELBA_PARAM_TID_MASK 0xf000 -#define DOT11_DELBA_PARAM_TID_SHIFT 12 - -BWL_PRE_PACKED_STRUCT struct dot11_delba { - uint8 category; - uint8 action; - uint16 delba_param_set; - uint16 reason; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_delba dot11_delba_t; -#define DOT11_DELBA_LEN 6 - - -#define DOT11_BSSTYPE_INFRASTRUCTURE 0 -#define DOT11_BSSTYPE_INDEPENDENT 1 -#define DOT11_BSSTYPE_ANY 2 -#define DOT11_SCANTYPE_ACTIVE 0 -#define DOT11_SCANTYPE_PASSIVE 1 - - -#define PREN_PREAMBLE 24 -#define PREN_MM_EXT 8 -#define PREN_PREAMBLE_EXT 4 - - -#define NPHY_RIFS_TIME 2 - - -#define APHY_SLOT_TIME 9 -#define APHY_SIFS_TIME 16 -#define APHY_DIFS_TIME (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME)) -#define APHY_PREAMBLE_TIME 16 -#define APHY_SIGNAL_TIME 4 -#define APHY_SYMBOL_TIME 4 -#define APHY_SERVICE_NBITS 16 -#define APHY_TAIL_NBITS 6 -#define APHY_CWMIN 15 - - -#define BPHY_SLOT_TIME 20 -#define BPHY_SIFS_TIME 10 -#define BPHY_DIFS_TIME 50 -#define BPHY_PLCP_TIME 192 -#define BPHY_PLCP_SHORT_TIME 96 -#define BPHY_CWMIN 31 - - -#define DOT11_OFDM_SIGNAL_EXTENSION 6 - -#define PHY_CWMAX 1023 - -#define DOT11_MAXNUMFRAGS 16 - - -typedef struct d11cnt { - uint32 txfrag; - uint32 txmulti; - uint32 txfail; - uint32 txretry; - uint32 txretrie; - uint32 rxdup; - uint32 txrts; - uint32 txnocts; - uint32 txnoack; - uint32 rxfrag; - uint32 rxmulti; - uint32 rxcrc; - uint32 txfrmsnt; - uint32 rxundec; -} d11cnt_t; - - -#define BRCM_PROP_OUI "\x00\x90\x4C" - - - - -BWL_PRE_PACKED_STRUCT struct brcm_prop_ie_s { - uint8 id; - uint8 len; - uint8 oui[3]; - uint8 type; - uint16 cap; -} BWL_POST_PACKED_STRUCT; -typedef struct brcm_prop_ie_s brcm_prop_ie_t; - -#define BRCM_PROP_IE_LEN 6 - -#define DPT_IE_TYPE 2 - - -#define BRCM_OUI "\x00\x10\x18" - - -BWL_PRE_PACKED_STRUCT struct brcm_ie { - uint8 id; - uint8 len; - uint8 oui[3]; - uint8 ver; - uint8 assoc; - uint8 flags; - uint8 flags1; - uint16 amsdu_mtu_pref; -} BWL_POST_PACKED_STRUCT; -typedef struct brcm_ie brcm_ie_t; -#define BRCM_IE_LEN 11 -#define BRCM_IE_VER 2 -#define BRCM_IE_LEGACY_AES_VER 1 - - -#ifdef WLAFTERBURNER -#define BRF_ABCAP 0x1 -#define BRF_ABRQRD 0x2 -#define BRF_ABCOUNTER_MASK 0xf0 -#define BRF_ABCOUNTER_SHIFT 4 -#endif -#define BRF_LZWDS 0x4 -#define BRF_BLOCKACK 0x8 - - -#define BRF1_AMSDU 0x1 -#define BRF1_WMEPS 0x4 -#define BRF1_PSOFIX 0x8 - -#ifdef WLAFTERBURNER -#define AB_WDS_TIMEOUT_MAX 15 -#define AB_WDS_TIMEOUT_MIN 1 -#endif - -#define AB_GUARDCOUNT 10 - -#define MCSSET_LEN 16 -#define MAX_MCS_NUM (128) - -BWL_PRE_PACKED_STRUCT struct ht_cap_ie { - uint16 cap; - uint8 params; - uint8 supp_mcs[MCSSET_LEN]; - uint16 ext_htcap; - uint32 txbf_cap; - uint8 as_cap; -} BWL_POST_PACKED_STRUCT; -typedef struct ht_cap_ie ht_cap_ie_t; - - - -BWL_PRE_PACKED_STRUCT struct ht_prop_cap_ie { - uint8 id; - uint8 len; - uint8 oui[3]; - uint8 type; - ht_cap_ie_t cap_ie; -} BWL_POST_PACKED_STRUCT; -typedef struct ht_prop_cap_ie ht_prop_cap_ie_t; -#define HT_PROP_IE_OVERHEAD 4 -#define HT_CAP_IE_LEN 26 -#define HT_CAP_IE_TYPE 51 - -#define HT_CAP_LDPC_CODING 0x0001 -#define HT_CAP_40MHZ 0x0002 -#define HT_CAP_MIMO_PS_MASK 0x000C -#define HT_CAP_MIMO_PS_SHIFT 0x0002 -#define HT_CAP_MIMO_PS_OFF 0x0003 -#define HT_CAP_MIMO_PS_RTS 0x0001 -#define HT_CAP_MIMO_PS_ON 0x0000 -#define HT_CAP_GF 0x0010 -#define HT_CAP_SHORT_GI_20 0x0020 -#define HT_CAP_SHORT_GI_40 0x0040 -#define HT_CAP_TX_STBC 0x0080 -#define HT_CAP_RX_STBC_MASK 0x0300 -#define HT_CAP_RX_STBC_SHIFT 8 -#define HT_CAP_DELAYED_BA 0x0400 -#define HT_CAP_MAX_AMSDU 0x0800 -#define HT_CAP_DSSS_CCK 0x1000 -#define HT_CAP_PSMP 0x2000 -#define HT_CAP_40MHZ_INTOLERANT 0x4000 -#define HT_CAP_LSIG_TXOP 0x8000 - -#define HT_CAP_RX_STBC_NO 0x0 -#define HT_CAP_RX_STBC_ONE_STREAM 0x1 -#define HT_CAP_RX_STBC_TWO_STREAM 0x2 -#define HT_CAP_RX_STBC_THREE_STREAM 0x3 - -#define HT_MAX_AMSDU 7935 -#define HT_MIN_AMSDU 3835 - -#define HT_PARAMS_RX_FACTOR_MASK 0x03 -#define HT_PARAMS_DENSITY_MASK 0x1C -#define HT_PARAMS_DENSITY_SHIFT 2 - - -#define AMPDU_MAX_MPDU_DENSITY 7 -#define AMPDU_RX_FACTOR_64K 3 -#define AMPDU_RX_FACTOR_BASE 8*1024 -#define AMPDU_DELIMITER_LEN 4 - -#define HT_CAP_EXT_PCO 0x0001 -#define HT_CAP_EXT_PCO_TTIME_MASK 0x0006 -#define HT_CAP_EXT_PCO_TTIME_SHIFT 1 -#define HT_CAP_EXT_MCS_FEEDBACK_MASK 0x0300 -#define HT_CAP_EXT_MCS_FEEDBACK_SHIFT 8 -#define HT_CAP_EXT_HTC 0x0400 -#define HT_CAP_EXT_RD_RESP 0x0800 - -BWL_PRE_PACKED_STRUCT struct ht_add_ie { - uint8 ctl_ch; - uint8 byte1; - uint16 opmode; - uint16 misc_bits; - uint8 basic_mcs[MCSSET_LEN]; -} BWL_POST_PACKED_STRUCT; -typedef struct ht_add_ie ht_add_ie_t; - - - -BWL_PRE_PACKED_STRUCT struct ht_prop_add_ie { - uint8 id; - uint8 len; - uint8 oui[3]; - uint8 type; - ht_add_ie_t add_ie; -} BWL_POST_PACKED_STRUCT; -typedef struct ht_prop_add_ie ht_prop_add_ie_t; - -#define HT_ADD_IE_LEN 22 -#define HT_ADD_IE_TYPE 52 - - -#define HT_BW_ANY 0x04 -#define HT_RIFS_PERMITTED 0x08 - - -#define HT_OPMODE_MASK 0x0003 -#define HT_OPMODE_SHIFT 0 -#define HT_OPMODE_PURE 0x0000 -#define HT_OPMODE_OPTIONAL 0x0001 -#define HT_OPMODE_HT20IN40 0x0002 -#define HT_OPMODE_MIXED 0x0003 -#define HT_OPMODE_NONGF 0x0004 -#define DOT11N_TXBURST 0x0008 -#define DOT11N_OBSS_NONHT 0x0010 - - -#define HT_BASIC_STBC_MCS 0x007f -#define HT_DUAL_STBC_PROT 0x0080 -#define HT_SECOND_BCN 0x0100 -#define HT_LSIG_TXOP 0x0200 -#define HT_PCO_ACTIVE 0x0400 -#define HT_PCO_PHASE 0x0800 -#define HT_DUALCTS_PROTECTION 0x0080 - - -#define DOT11N_2G_TXBURST_LIMIT 6160 -#define DOT11N_5G_TXBURST_LIMIT 3080 - - -#define GET_HT_OPMODE(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \ - >> HT_OPMODE_SHIFT) -#define HT_MIXEDMODE_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \ - == HT_OPMODE_MIXED) -#define HT_HT20_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \ - == HT_OPMODE_HT20IN40) -#define HT_OPTIONAL_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \ - == HT_OPMODE_OPTIONAL) -#define HT_USE_PROTECTION(add_ie) (HT_HT20_PRESENT((add_ie)) || \ - HT_MIXEDMODE_PRESENT((add_ie))) -#define HT_NONGF_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_NONGF) \ - == HT_OPMODE_NONGF) -#define DOT11N_TXBURST_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & DOT11N_TXBURST) \ - == DOT11N_TXBURST) -#define DOT11N_OBSS_NONHT_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & DOT11N_OBSS_NONHT) \ - == DOT11N_OBSS_NONHT) - -BWL_PRE_PACKED_STRUCT struct obss_params { - uint16 passive_dwell; - uint16 active_dwell; - uint16 bss_widthscan_interval; - uint16 passive_total; - uint16 active_total; - uint16 chanwidth_transition_dly; - uint16 activity_threshold; -} BWL_POST_PACKED_STRUCT; -typedef struct obss_params obss_params_t; - -BWL_PRE_PACKED_STRUCT struct dot11_obss_ie { - uint8 id; - uint8 len; - obss_params_t obss_params; -} BWL_POST_PACKED_STRUCT; -typedef struct dot11_obss_ie dot11_obss_ie_t; -#define DOT11_OBSS_SCAN_IE_LEN sizeof(obss_params_t) - - -BWL_PRE_PACKED_STRUCT struct vndr_ie { - uchar id; - uchar len; - uchar oui [3]; - uchar data [1]; -} BWL_POST_PACKED_STRUCT; -typedef struct vndr_ie vndr_ie_t; - -#define VNDR_IE_HDR_LEN 2 -#define VNDR_IE_MIN_LEN 3 -#define VNDR_IE_MAX_LEN 256 - - -#define WPA_VERSION 1 -#define WPA_OUI "\x00\x50\xF2" - -#define WPA2_VERSION 1 -#define WPA2_VERSION_LEN 2 -#define WPA2_OUI "\x00\x0F\xAC" - -#define WPA_OUI_LEN 3 - - -#define RSN_AKM_NONE 0 -#define RSN_AKM_UNSPECIFIED 1 -#define RSN_AKM_PSK 2 - - -#define DOT11_MAX_DEFAULT_KEYS 4 -#define DOT11_MAX_KEY_SIZE 32 -#define DOT11_MAX_IV_SIZE 16 -#define DOT11_EXT_IV_FLAG (1<<5) -#define DOT11_WPA_KEY_RSC_LEN 8 - -#define WEP1_KEY_SIZE 5 -#define WEP1_KEY_HEX_SIZE 10 -#define WEP128_KEY_SIZE 13 -#define WEP128_KEY_HEX_SIZE 26 -#define TKIP_MIC_SIZE 8 -#define TKIP_EOM_SIZE 7 -#define TKIP_EOM_FLAG 0x5a -#define TKIP_KEY_SIZE 32 -#define TKIP_MIC_AUTH_TX 16 -#define TKIP_MIC_AUTH_RX 24 -#define TKIP_MIC_SUP_RX TKIP_MIC_AUTH_TX -#define TKIP_MIC_SUP_TX TKIP_MIC_AUTH_RX -#define AES_KEY_SIZE 16 -#define AES_MIC_SIZE 8 - -#define SMS4_KEY_LEN 16 -#define SMS4_WPI_CBC_MAC_LEN 16 - - -#include - - -#endif diff --git a/drivers/net/wireless/bcm4319/include/proto/802.11e.h b/drivers/net/wireless/bcm4319/include/proto/802.11e.h deleted file mode 100644 index 1dd6f45b1ed8..000000000000 --- a/drivers/net/wireless/bcm4319/include/proto/802.11e.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 802.11e protocol header file - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: 802.11e.h,v 1.5.56.1 2008/11/20 00:51:18 Exp $ - */ - -#ifndef _802_11e_H_ -#define _802_11e_H_ - -#ifndef _TYPEDEFS_H_ -#include -#endif - -/* This marks the start of a packed structure section. */ -#include - - -/* WME Traffic Specification (TSPEC) element */ -#define WME_TSPEC_HDR_LEN 2 /* WME TSPEC header length */ -#define WME_TSPEC_BODY_OFF 2 /* WME TSPEC body offset */ - -#define WME_CATEGORY_CODE_OFFSET 0 /* WME Category code offset */ -#define WME_ACTION_CODE_OFFSET 1 /* WME Action code offset */ -#define WME_TOKEN_CODE_OFFSET 2 /* WME Token code offset */ -#define WME_STATUS_CODE_OFFSET 3 /* WME Status code offset */ - -BWL_PRE_PACKED_STRUCT struct tsinfo { - uint8 octets[3]; -} BWL_POST_PACKED_STRUCT; - -typedef struct tsinfo tsinfo_t; - -/* 802.11e TSPEC IE */ -typedef BWL_PRE_PACKED_STRUCT struct tspec { - uint8 oui[DOT11_OUI_LEN]; /* WME_OUI */ - uint8 type; /* WME_TYPE */ - uint8 subtype; /* WME_SUBTYPE_TSPEC */ - uint8 version; /* WME_VERSION */ - tsinfo_t tsinfo; /* TS Info bit field */ - uint16 nom_msdu_size; /* (Nominal or fixed) MSDU Size (bytes) */ - uint16 max_msdu_size; /* Maximum MSDU Size (bytes) */ - uint32 min_srv_interval; /* Minimum Service Interval (us) */ - uint32 max_srv_interval; /* Maximum Service Interval (us) */ - uint32 inactivity_interval; /* Inactivity Interval (us) */ - uint32 suspension_interval; /* Suspension Interval (us) */ - uint32 srv_start_time; /* Service Start Time (us) */ - uint32 min_data_rate; /* Minimum Data Rate (bps) */ - uint32 mean_data_rate; /* Mean Data Rate (bps) */ - uint32 peak_data_rate; /* Peak Data Rate (bps) */ - uint32 max_burst_size; /* Maximum Burst Size (bytes) */ - uint32 delay_bound; /* Delay Bound (us) */ - uint32 min_phy_rate; /* Minimum PHY Rate (bps) */ - uint16 surplus_bw; /* Surplus Bandwidth Allowance (range 1.0-8.0) */ - uint16 medium_time; /* Medium Time (32 us/s periods) */ -} BWL_POST_PACKED_STRUCT tspec_t; - -#define WME_TSPEC_LEN (sizeof(tspec_t)) /* not including 2-bytes of header */ - -/* ts_info */ -/* 802.1D priority is duplicated - bits 13-11 AND bits 3-1 */ -#define TS_INFO_TID_SHIFT 1 /* TS info. TID shift */ -#define TS_INFO_TID_MASK (0xf << TS_INFO_TID_SHIFT) /* TS info. TID mask */ -#define TS_INFO_CONTENTION_SHIFT 7 /* TS info. contention shift */ -#define TS_INFO_CONTENTION_MASK (0x1 << TS_INFO_CONTENTION_SHIFT) /* TS info. contention mask */ -#define TS_INFO_DIRECTION_SHIFT 5 /* TS info. direction shift */ -#define TS_INFO_DIRECTION_MASK (0x3 << TS_INFO_DIRECTION_SHIFT) /* TS info. direction mask */ -#define TS_INFO_PSB_SHIFT 2 /* TS info. PSB bit Shift */ -#define TS_INFO_PSB_MASK (1 << TS_INFO_PSB_SHIFT) /* TS info. PSB mask */ -#define TS_INFO_UPLINK (0 << TS_INFO_DIRECTION_SHIFT) /* TS info. uplink */ -#define TS_INFO_DOWNLINK (1 << TS_INFO_DIRECTION_SHIFT) /* TS info. downlink */ -#define TS_INFO_BIDIRECTIONAL (3 << TS_INFO_DIRECTION_SHIFT) /* TS info. bidirectional */ -#define TS_INFO_USER_PRIO_SHIFT 3 /* TS info. user priority shift */ -/* TS info. user priority mask */ -#define TS_INFO_USER_PRIO_MASK (0x7 << TS_INFO_USER_PRIO_SHIFT) - -/* Macro to get/set bit(s) field in TSINFO */ -#define WLC_CAC_GET_TID(pt) ((((pt).octets[0]) & TS_INFO_TID_MASK) >> TS_INFO_TID_SHIFT) -#define WLC_CAC_GET_DIR(pt) ((((pt).octets[0]) & \ - TS_INFO_DIRECTION_MASK) >> TS_INFO_DIRECTION_SHIFT) -#define WLC_CAC_GET_PSB(pt) ((((pt).octets[1]) & TS_INFO_PSB_MASK) >> TS_INFO_PSB_SHIFT) -#define WLC_CAC_GET_USER_PRIO(pt) ((((pt).octets[1]) & \ - TS_INFO_USER_PRIO_MASK) >> TS_INFO_USER_PRIO_SHIFT) - -#define WLC_CAC_SET_TID(pt, id) ((((pt).octets[0]) & (~TS_INFO_TID_MASK)) | \ - ((id) << TS_INFO_TID_SHIFT)) -#define WLC_CAC_SET_USER_PRIO(pt, prio) ((((pt).octets[0]) & (~TS_INFO_USER_PRIO_MASK)) | \ - ((prio) << TS_INFO_USER_PRIO_SHIFT)) - -/* 802.11e QBSS Load IE */ -#define QBSS_LOAD_IE_LEN 5 /* QBSS Load IE length */ -#define QBSS_LOAD_AAC_OFF 3 /* AAC offset in IE */ - -#define CAC_ADDTS_RESP_TIMEOUT 300 /* default ADDTS response timeout in ms */ - -/* 802.11e ADDTS status code */ -#define DOT11E_STATUS_ADMISSION_ACCEPTED 0 /* TSPEC Admission accepted status */ -#define DOT11E_STATUS_ADDTS_INVALID_PARAM 1 /* TSPEC invalid parameter status */ -#define DOT11E_STATUS_ADDTS_REFUSED_NSBW 3 /* ADDTS refused (non-sufficient BW) */ -#define DOT11E_STATUS_ADDTS_REFUSED_AWHILE 47 /* ADDTS refused but could retry later */ - -/* 802.11e DELTS status code */ -#define DOT11E_STATUS_QSTA_LEAVE_QBSS 36 /* STA leave QBSS */ -#define DOT11E_STATUS_END_TS 37 /* END TS */ -#define DOT11E_STATUS_UNKNOWN_TS 38 /* UNKNOWN TS */ -#define DOT11E_STATUS_QSTA_REQ_TIMEOUT 39 /* STA ADDTS request timeout */ - - -/* This marks the end of a packed structure section. */ -#include - -#endif /* _802_11e_CAC_H_ */ diff --git a/drivers/net/wireless/bcm4319/include/proto/802.1d.h b/drivers/net/wireless/bcm4319/include/proto/802.1d.h deleted file mode 100644 index 45c728bc2976..000000000000 --- a/drivers/net/wireless/bcm4319/include/proto/802.1d.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * Fundamental types and constants relating to 802.1D - * - * $Id: 802.1d.h,v 9.3 2007/04/10 21:33:06 Exp $ - */ - - -#ifndef _802_1_D_ -#define _802_1_D_ - - -#define PRIO_8021D_NONE 2 -#define PRIO_8021D_BK 1 -#define PRIO_8021D_BE 0 -#define PRIO_8021D_EE 3 -#define PRIO_8021D_CL 4 -#define PRIO_8021D_VI 5 -#define PRIO_8021D_VO 6 -#define PRIO_8021D_NC 7 -#define MAXPRIO 7 -#define NUMPRIO (MAXPRIO + 1) - -#define ALLPRIO -1 - - -#define PRIO2PREC(prio) \ - (((prio) == PRIO_8021D_NONE || (prio) == PRIO_8021D_BE) ? ((prio^2)) : (prio)) - -#endif diff --git a/drivers/net/wireless/bcm4319/include/proto/bcmeth.h b/drivers/net/wireless/bcm4319/include/proto/bcmeth.h deleted file mode 100644 index fdb5a2a5648f..000000000000 --- a/drivers/net/wireless/bcm4319/include/proto/bcmeth.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Broadcom Ethernettype protocol definitions - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: bcmeth.h,v 9.9.46.1 2008/11/20 00:51:20 Exp $ - */ - - - - -#ifndef _BCMETH_H_ -#define _BCMETH_H_ - -#ifndef _TYPEDEFS_H_ -#include -#endif - - -#include - - - - - - - -#define BCMILCP_SUBTYPE_RATE 1 -#define BCMILCP_SUBTYPE_LINK 2 -#define BCMILCP_SUBTYPE_CSA 3 -#define BCMILCP_SUBTYPE_LARQ 4 -#define BCMILCP_SUBTYPE_VENDOR 5 -#define BCMILCP_SUBTYPE_FLH 17 - -#define BCMILCP_SUBTYPE_VENDOR_LONG 32769 -#define BCMILCP_SUBTYPE_CERT 32770 -#define BCMILCP_SUBTYPE_SES 32771 - - -#define BCMILCP_BCM_SUBTYPE_RESERVED 0 -#define BCMILCP_BCM_SUBTYPE_EVENT 1 -#define BCMILCP_BCM_SUBTYPE_SES 2 - - -#define BCMILCP_BCM_SUBTYPE_DPT 4 - -#define BCMILCP_BCM_SUBTYPEHDR_MINLENGTH 8 -#define BCMILCP_BCM_SUBTYPEHDR_VERSION 0 - - -typedef BWL_PRE_PACKED_STRUCT struct bcmeth_hdr -{ - uint16 subtype; - uint16 length; - uint8 version; - uint8 oui[3]; - - uint16 usr_subtype; -} BWL_POST_PACKED_STRUCT bcmeth_hdr_t; - - - -#include - -#endif diff --git a/drivers/net/wireless/bcm4319/include/proto/bcmevent.h b/drivers/net/wireless/bcm4319/include/proto/bcmevent.h deleted file mode 100644 index 1f8ecb14d97a..000000000000 --- a/drivers/net/wireless/bcm4319/include/proto/bcmevent.h +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Broadcom Event protocol definitions - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * - * Dependencies: proto/bcmeth.h - * - * $Id: bcmevent.h,v 9.34.4.1.20.16.64.1 2010/11/08 21:57:03 Exp $ - * - */ - - - - -#ifndef _BCMEVENT_H_ -#define _BCMEVENT_H_ - -#ifndef _TYPEDEFS_H_ -#include -#endif - - -#include - -#define BCM_EVENT_MSG_VERSION 1 -#define BCM_MSG_IFNAME_MAX 16 - - -#define WLC_EVENT_MSG_LINK 0x01 -#define WLC_EVENT_MSG_FLUSHTXQ 0x02 -#define WLC_EVENT_MSG_GROUP 0x04 - - -typedef BWL_PRE_PACKED_STRUCT struct -{ - uint16 version; - uint16 flags; - uint32 event_type; - uint32 status; - uint32 reason; - uint32 auth_type; - uint32 datalen; - struct ether_addr addr; - char ifname[BCM_MSG_IFNAME_MAX]; -} BWL_POST_PACKED_STRUCT wl_event_msg_t; - - -typedef BWL_PRE_PACKED_STRUCT struct bcm_event { - struct ether_header eth; - bcmeth_hdr_t bcm_hdr; - wl_event_msg_t event; - -} BWL_POST_PACKED_STRUCT bcm_event_t; - -#define BCM_MSG_LEN (sizeof(bcm_event_t) - sizeof(bcmeth_hdr_t) - sizeof(struct ether_header)) - - -#define WLC_E_SET_SSID 0 -#define WLC_E_JOIN 1 -#define WLC_E_START 2 -#define WLC_E_AUTH 3 -#define WLC_E_AUTH_IND 4 -#define WLC_E_DEAUTH 5 -#define WLC_E_DEAUTH_IND 6 -#define WLC_E_ASSOC 7 -#define WLC_E_ASSOC_IND 8 -#define WLC_E_REASSOC 9 -#define WLC_E_REASSOC_IND 10 -#define WLC_E_DISASSOC 11 -#define WLC_E_DISASSOC_IND 12 -#define WLC_E_QUIET_START 13 -#define WLC_E_QUIET_END 14 -#define WLC_E_BEACON_RX 15 -#define WLC_E_LINK 16 -#define WLC_E_MIC_ERROR 17 -#define WLC_E_NDIS_LINK 18 -#define WLC_E_ROAM 19 -#define WLC_E_TXFAIL 20 -#define WLC_E_PMKID_CACHE 21 -#define WLC_E_RETROGRADE_TSF 22 -#define WLC_E_PRUNE 23 -#define WLC_E_AUTOAUTH 24 -#define WLC_E_EAPOL_MSG 25 -#define WLC_E_SCAN_COMPLETE 26 -#define WLC_E_ADDTS_IND 27 -#define WLC_E_DELTS_IND 28 -#define WLC_E_BCNSENT_IND 29 -#define WLC_E_BCNRX_MSG 30 -#define WLC_E_BCNLOST_MSG 31 -#define WLC_E_ROAM_PREP 32 -#define WLC_E_PFN_NET_FOUND 33 -#define WLC_E_PFN_NET_LOST 34 -#define WLC_E_RESET_COMPLETE 35 -#define WLC_E_JOIN_START 36 -#define WLC_E_ROAM_START 37 -#define WLC_E_ASSOC_START 38 -#define WLC_E_IBSS_ASSOC 39 -#define WLC_E_RADIO 40 -#define WLC_E_PSM_WATCHDOG 41 -#define WLC_E_PROBREQ_MSG 44 -#define WLC_E_SCAN_CONFIRM_IND 45 -#define WLC_E_PSK_SUP 46 -#define WLC_E_COUNTRY_CODE_CHANGED 47 -#define WLC_E_EXCEEDED_MEDIUM_TIME 48 -#define WLC_E_ICV_ERROR 49 -#define WLC_E_UNICAST_DECODE_ERROR 50 -#define WLC_E_MULTICAST_DECODE_ERROR 51 -#define WLC_E_TRACE 52 -#define WLC_E_IF 54 -#define WLC_E_RSSI 56 -#define WLC_E_PFN_SCAN_COMPLETE 57 -#define WLC_E_ACTION_FRAME 58 -#define WLC_E_ACTION_FRAME_COMPLETE 59 - -#define WLC_E_ESCAN_RESULT 69 -#define WLC_E_WAKE_EVENT 70 -#define WLC_E_RELOAD 71 -#define WLC_E_LAST 72 - - - -#define WLC_E_STATUS_SUCCESS 0 -#define WLC_E_STATUS_FAIL 1 -#define WLC_E_STATUS_TIMEOUT 2 -#define WLC_E_STATUS_NO_NETWORKS 3 -#define WLC_E_STATUS_ABORT 4 -#define WLC_E_STATUS_NO_ACK 5 -#define WLC_E_STATUS_UNSOLICITED 6 -#define WLC_E_STATUS_ATTEMPT 7 -#define WLC_E_STATUS_PARTIAL 8 -#define WLC_E_STATUS_NEWSCAN 9 -#define WLC_E_STATUS_NEWASSOC 10 -#define WLC_E_STATUS_11HQUIET 11 -#define WLC_E_STATUS_SUPPRESS 12 -#define WLC_E_STATUS_NOCHANS 13 -#define WLC_E_STATUS_CCXFASTRM 14 -#define WLC_E_STATUS_CS_ABORT 15 - - -#define WLC_E_REASON_INITIAL_ASSOC 0 -#define WLC_E_REASON_LOW_RSSI 1 -#define WLC_E_REASON_DEAUTH 2 -#define WLC_E_REASON_DISASSOC 3 -#define WLC_E_REASON_BCNS_LOST 4 -#define WLC_E_REASON_FAST_ROAM_FAILED 5 -#define WLC_E_REASON_DIRECTED_ROAM 6 -#define WLC_E_REASON_TSPEC_REJECTED 7 -#define WLC_E_REASON_BETTER_AP 8 - - -#define WLC_E_PRUNE_ENCR_MISMATCH 1 -#define WLC_E_PRUNE_BCAST_BSSID 2 -#define WLC_E_PRUNE_MAC_DENY 3 -#define WLC_E_PRUNE_MAC_NA 4 -#define WLC_E_PRUNE_REG_PASSV 5 -#define WLC_E_PRUNE_SPCT_MGMT 6 -#define WLC_E_PRUNE_RADAR 7 -#define WLC_E_RSN_MISMATCH 8 -#define WLC_E_PRUNE_NO_COMMON_RATES 9 -#define WLC_E_PRUNE_BASIC_RATES 10 -#define WLC_E_PRUNE_CIPHER_NA 12 -#define WLC_E_PRUNE_KNOWN_STA 13 -#define WLC_E_PRUNE_WDS_PEER 15 -#define WLC_E_PRUNE_QBSS_LOAD 16 -#define WLC_E_PRUNE_HOME_AP 17 - - -#define WLC_E_SUP_OTHER 0 -#define WLC_E_SUP_DECRYPT_KEY_DATA 1 -#define WLC_E_SUP_BAD_UCAST_WEP128 2 -#define WLC_E_SUP_BAD_UCAST_WEP40 3 -#define WLC_E_SUP_UNSUP_KEY_LEN 4 -#define WLC_E_SUP_PW_KEY_CIPHER 5 -#define WLC_E_SUP_MSG3_TOO_MANY_IE 6 -#define WLC_E_SUP_MSG3_IE_MISMATCH 7 -#define WLC_E_SUP_NO_INSTALL_FLAG 8 -#define WLC_E_SUP_MSG3_NO_GTK 9 -#define WLC_E_SUP_GRP_KEY_CIPHER 10 -#define WLC_E_SUP_GRP_MSG1_NO_GTK 11 -#define WLC_E_SUP_GTK_DECRYPT_FAIL 12 -#define WLC_E_SUP_SEND_FAIL 13 -#define WLC_E_SUP_DEAUTH 14 -#define WLC_E_SUP_WPA_PSK_TMO 15 - - -#define WLC_E_IF_ADD 1 -#define WLC_E_IF_DEL 2 - -#define WLC_E_RELOAD_STATUS1 1 - -#include - -#endif diff --git a/drivers/net/wireless/bcm4319/include/proto/bcmip.h b/drivers/net/wireless/bcm4319/include/proto/bcmip.h deleted file mode 100644 index 9d2fd6fba484..000000000000 --- a/drivers/net/wireless/bcm4319/include/proto/bcmip.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * Fundamental constants relating to IP Protocol - * - * $Id: bcmip.h,v 9.16.186.4 2009/01/27 04:25:25 Exp $ - */ - - -#ifndef _bcmip_h_ -#define _bcmip_h_ - -#ifndef _TYPEDEFS_H_ -#include -#endif - - -#include - - - -#define IP_VER_OFFSET 0x0 -#define IP_VER_MASK 0xf0 -#define IP_VER_SHIFT 4 -#define IP_VER_4 4 -#define IP_VER_6 6 - -#define IP_VER(ip_body) \ - ((((uint8 *)(ip_body))[IP_VER_OFFSET] & IP_VER_MASK) >> IP_VER_SHIFT) - -#define IP_PROT_ICMP 0x1 -#define IP_PROT_TCP 0x6 -#define IP_PROT_UDP 0x11 - - -#define IPV4_VER_HL_OFFSET 0 -#define IPV4_TOS_OFFSET 1 -#define IPV4_PKTLEN_OFFSET 2 -#define IPV4_PKTFLAG_OFFSET 6 -#define IPV4_PROT_OFFSET 9 -#define IPV4_CHKSUM_OFFSET 10 -#define IPV4_SRC_IP_OFFSET 12 -#define IPV4_DEST_IP_OFFSET 16 -#define IPV4_OPTIONS_OFFSET 20 - - -#define IPV4_VER_MASK 0xf0 -#define IPV4_VER_SHIFT 4 - -#define IPV4_HLEN_MASK 0x0f -#define IPV4_HLEN(ipv4_body) (4 * (((uint8 *)(ipv4_body))[IPV4_VER_HL_OFFSET] & IPV4_HLEN_MASK)) - -#define IPV4_ADDR_LEN 4 - -#define IPV4_ADDR_NULL(a) ((((uint8 *)(a))[0] | ((uint8 *)(a))[1] | \ - ((uint8 *)(a))[2] | ((uint8 *)(a))[3]) == 0) - -#define IPV4_ADDR_BCAST(a) ((((uint8 *)(a))[0] & ((uint8 *)(a))[1] & \ - ((uint8 *)(a))[2] & ((uint8 *)(a))[3]) == 0xff) - -#define IPV4_TOS_DSCP_MASK 0xfc -#define IPV4_TOS_DSCP_SHIFT 2 - -#define IPV4_TOS(ipv4_body) (((uint8 *)(ipv4_body))[IPV4_TOS_OFFSET]) - -#define IPV4_TOS_PREC_MASK 0xe0 -#define IPV4_TOS_PREC_SHIFT 5 - -#define IPV4_TOS_LOWDELAY 0x10 -#define IPV4_TOS_THROUGHPUT 0x8 -#define IPV4_TOS_RELIABILITY 0x4 - -#define IPV4_PROT(ipv4_body) (((uint8 *)(ipv4_body))[IPV4_PROT_OFFSET]) - -#define IPV4_FRAG_RESV 0x8000 -#define IPV4_FRAG_DONT 0x4000 -#define IPV4_FRAG_MORE 0x2000 -#define IPV4_FRAG_OFFSET_MASK 0x1fff - -#define IPV4_ADDR_STR_LEN 16 - - -BWL_PRE_PACKED_STRUCT struct ipv4_addr { - uint8 addr[IPV4_ADDR_LEN]; -} BWL_POST_PACKED_STRUCT; - -BWL_PRE_PACKED_STRUCT struct ipv4_hdr { - uint8 version_ihl; - uint8 tos; - uint16 tot_len; - uint16 id; - uint16 frag; - uint8 ttl; - uint8 prot; - uint16 hdr_chksum; - uint8 src_ip[IPV4_ADDR_LEN]; - uint8 dst_ip[IPV4_ADDR_LEN]; -} BWL_POST_PACKED_STRUCT; - - -#define IPV6_PAYLOAD_LEN_OFFSET 4 -#define IPV6_NEXT_HDR_OFFSET 6 -#define IPV6_HOP_LIMIT_OFFSET 7 -#define IPV6_SRC_IP_OFFSET 8 -#define IPV6_DEST_IP_OFFSET 24 - - -#define IPV6_TRAFFIC_CLASS(ipv6_body) \ - (((((uint8 *)(ipv6_body))[0] & 0x0f) << 4) | \ - ((((uint8 *)(ipv6_body))[1] & 0xf0) >> 4)) - -#define IPV6_FLOW_LABEL(ipv6_body) \ - (((((uint8 *)(ipv6_body))[1] & 0x0f) << 16) | \ - (((uint8 *)(ipv6_body))[2] << 8) | \ - (((uint8 *)(ipv6_body))[3])) - -#define IPV6_PAYLOAD_LEN(ipv6_body) \ - ((((uint8 *)(ipv6_body))[IPV6_PAYLOAD_LEN_OFFSET + 0] << 8) | \ - ((uint8 *)(ipv6_body))[IPV6_PAYLOAD_LEN_OFFSET + 1]) - -#define IPV6_NEXT_HDR(ipv6_body) \ - (((uint8 *)(ipv6_body))[IPV6_NEXT_HDR_OFFSET]) - -#define IPV6_PROT(ipv6_body) IPV6_NEXT_HDR(ipv6_body) - -#define IPV6_ADDR_LEN 16 - - -#ifndef IP_TOS -#define IP_TOS(ip_body) \ - (IP_VER(ip_body) == IP_VER_4 ? IPV4_TOS(ip_body) : \ - IP_VER(ip_body) == IP_VER_6 ? IPV6_TRAFFIC_CLASS(ip_body) : 0) -#endif - - - -#include - -#endif diff --git a/drivers/net/wireless/bcm4319/include/proto/eapol.h b/drivers/net/wireless/bcm4319/include/proto/eapol.h deleted file mode 100644 index 95e76ff18c6b..000000000000 --- a/drivers/net/wireless/bcm4319/include/proto/eapol.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 802.1x EAPOL definitions - * - * See - * IEEE Std 802.1X-2001 - * IEEE 802.1X RADIUS Usage Guidelines - * - * Copyright (C) 2002 Broadcom Corporation - * - * $Id: eapol.h,v 9.18.260.1.2.1.6.6 2009/04/08 05:00:08 Exp $ - */ - -#ifndef _eapol_h_ -#define _eapol_h_ - -#ifndef _TYPEDEFS_H_ -#include -#endif - -/* This marks the start of a packed structure section. */ -#include - -#define AKW_BLOCK_LEN 8 /* The only def we need here */ - -/* EAPOL for 802.3/Ethernet */ -typedef struct { - struct ether_header eth; /* 802.3/Ethernet header */ - unsigned char version; /* EAPOL protocol version */ - unsigned char type; /* EAPOL type */ - unsigned short length; /* Length of body */ - unsigned char body[1]; /* Body (optional) */ -} eapol_header_t; - -#define EAPOL_HEADER_LEN 18 - -/* EAPOL version */ -#define WPA2_EAPOL_VERSION 2 -#define WPA_EAPOL_VERSION 1 -#define LEAP_EAPOL_VERSION 1 -#define SES_EAPOL_VERSION 1 - -/* EAPOL types */ -#define EAP_PACKET 0 -#define EAPOL_START 1 -#define EAPOL_LOGOFF 2 -#define EAPOL_KEY 3 -#define EAPOL_ASF 4 - -/* EAPOL-Key types */ -#define EAPOL_RC4_KEY 1 -#define EAPOL_WPA2_KEY 2 /* 802.11i/WPA2 */ -#define EAPOL_WPA_KEY 254 /* WPA */ - -/* RC4 EAPOL-Key header field sizes */ -#define EAPOL_KEY_REPLAY_LEN 8 -#define EAPOL_KEY_IV_LEN 16 -#define EAPOL_KEY_SIG_LEN 16 - -/* RC4 EAPOL-Key */ -typedef BWL_PRE_PACKED_STRUCT struct { - unsigned char type; /* Key Descriptor Type */ - unsigned short length; /* Key Length (unaligned) */ - unsigned char replay[EAPOL_KEY_REPLAY_LEN]; /* Replay Counter */ - unsigned char iv[EAPOL_KEY_IV_LEN]; /* Key IV */ - unsigned char index; /* Key Flags & Index */ - unsigned char signature[EAPOL_KEY_SIG_LEN]; /* Key Signature */ - unsigned char key[1]; /* Key (optional) */ -} BWL_POST_PACKED_STRUCT eapol_key_header_t; - -#define EAPOL_KEY_HEADER_LEN 44 - -/* RC4 EAPOL-Key flags */ -#define EAPOL_KEY_FLAGS_MASK 0x80 -#define EAPOL_KEY_BROADCAST 0 -#define EAPOL_KEY_UNICAST 0x80 - -/* RC4 EAPOL-Key index */ -#define EAPOL_KEY_INDEX_MASK 0x7f - -/* WPA/802.11i/WPA2 EAPOL-Key header field sizes */ -#define EAPOL_WPA_KEY_REPLAY_LEN 8 -#define EAPOL_WPA_KEY_NONCE_LEN 32 -#define EAPOL_WPA_KEY_IV_LEN 16 -#define EAPOL_WPA_KEY_ID_LEN 8 -#define EAPOL_WPA_KEY_RSC_LEN 8 -#define EAPOL_WPA_KEY_MIC_LEN 16 -#define EAPOL_WPA_KEY_DATA_LEN (EAPOL_WPA_MAX_KEY_SIZE + AKW_BLOCK_LEN) -#define EAPOL_WPA_MAX_KEY_SIZE 32 - -/* WPA EAPOL-Key */ -typedef BWL_PRE_PACKED_STRUCT struct { - unsigned char type; /* Key Descriptor Type */ - unsigned short key_info; /* Key Information (unaligned) */ - unsigned short key_len; /* Key Length (unaligned) */ - unsigned char replay[EAPOL_WPA_KEY_REPLAY_LEN]; /* Replay Counter */ - unsigned char nonce[EAPOL_WPA_KEY_NONCE_LEN]; /* Nonce */ - unsigned char iv[EAPOL_WPA_KEY_IV_LEN]; /* Key IV */ - unsigned char rsc[EAPOL_WPA_KEY_RSC_LEN]; /* Key RSC */ - unsigned char id[EAPOL_WPA_KEY_ID_LEN]; /* WPA:Key ID, 802.11i/WPA2: Reserved */ - unsigned char mic[EAPOL_WPA_KEY_MIC_LEN]; /* Key MIC */ - unsigned short data_len; /* Key Data Length */ - unsigned char data[EAPOL_WPA_KEY_DATA_LEN]; /* Key data */ -} BWL_POST_PACKED_STRUCT eapol_wpa_key_header_t; - -#define EAPOL_WPA_KEY_LEN 95 - -/* WPA/802.11i/WPA2 KEY KEY_INFO bits */ -#define WPA_KEY_DESC_V1 0x01 -#define WPA_KEY_DESC_V2 0x02 -#define WPA_KEY_PAIRWISE 0x08 -#define WPA_KEY_INSTALL 0x40 -#define WPA_KEY_ACK 0x80 -#define WPA_KEY_MIC 0x100 -#define WPA_KEY_SECURE 0x200 -#define WPA_KEY_ERROR 0x400 -#define WPA_KEY_REQ 0x800 - -/* WPA-only KEY KEY_INFO bits */ -#define WPA_KEY_INDEX_0 0x00 -#define WPA_KEY_INDEX_1 0x10 -#define WPA_KEY_INDEX_2 0x20 -#define WPA_KEY_INDEX_3 0x30 -#define WPA_KEY_INDEX_MASK 0x30 -#define WPA_KEY_INDEX_SHIFT 0x04 - -/* 802.11i/WPA2-only KEY KEY_INFO bits */ -#define WPA_KEY_ENCRYPTED_DATA 0x1000 - -/* Key Data encapsulation */ -typedef BWL_PRE_PACKED_STRUCT struct { - uint8 type; - uint8 length; - uint8 oui[3]; - uint8 subtype; - uint8 data[1]; -} BWL_POST_PACKED_STRUCT eapol_wpa2_encap_data_t; - -#define EAPOL_WPA2_ENCAP_DATA_HDR_LEN 6 - -#define WPA2_KEY_DATA_SUBTYPE_GTK 1 -#define WPA2_KEY_DATA_SUBTYPE_STAKEY 2 -#define WPA2_KEY_DATA_SUBTYPE_MAC 3 -#define WPA2_KEY_DATA_SUBTYPE_PMKID 4 - -/* GTK encapsulation */ -typedef BWL_PRE_PACKED_STRUCT struct { - uint8 flags; - uint8 reserved; - uint8 gtk[EAPOL_WPA_MAX_KEY_SIZE]; -} BWL_POST_PACKED_STRUCT eapol_wpa2_key_gtk_encap_t; - -#define EAPOL_WPA2_KEY_GTK_ENCAP_HDR_LEN 2 - -#define WPA2_GTK_INDEX_MASK 0x03 -#define WPA2_GTK_INDEX_SHIFT 0x00 - -#define WPA2_GTK_TRANSMIT 0x04 - -/* STAKey encapsulation */ -typedef BWL_PRE_PACKED_STRUCT struct { - uint8 reserved[2]; - uint8 mac[ETHER_ADDR_LEN]; - uint8 stakey[EAPOL_WPA_MAX_KEY_SIZE]; -} BWL_POST_PACKED_STRUCT eapol_wpa2_key_stakey_encap_t; - -#define WPA2_KEY_DATA_PAD 0xdd - - -/* This marks the end of a packed structure section. */ -#include - -#endif /* _eapol_h_ */ diff --git a/drivers/net/wireless/bcm4319/include/proto/ethernet.h b/drivers/net/wireless/bcm4319/include/proto/ethernet.h deleted file mode 100644 index 9ad2ea0c70fd..000000000000 --- a/drivers/net/wireless/bcm4319/include/proto/ethernet.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * From FreeBSD 2.2.7: Fundamental constants relating to ethernet. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: ethernet.h,v 9.45.56.5 2010/02/22 22:04:36 Exp $ - */ - - -#ifndef _NET_ETHERNET_H_ -#define _NET_ETHERNET_H_ - -#ifndef _TYPEDEFS_H_ -#include "typedefs.h" -#endif - - -#include - - - -#define ETHER_ADDR_LEN 6 - - -#define ETHER_TYPE_LEN 2 - - -#define ETHER_CRC_LEN 4 - - -#define ETHER_HDR_LEN (ETHER_ADDR_LEN * 2 + ETHER_TYPE_LEN) - - -#define ETHER_MIN_LEN 64 - - -#define ETHER_MIN_DATA 46 - - -#define ETHER_MAX_LEN 1518 - - -#define ETHER_MAX_DATA 1500 - - -#define ETHER_TYPE_MIN 0x0600 -#define ETHER_TYPE_IP 0x0800 -#define ETHER_TYPE_ARP 0x0806 -#define ETHER_TYPE_8021Q 0x8100 -#define ETHER_TYPE_BRCM 0x886c -#define ETHER_TYPE_802_1X 0x888e -#define ETHER_TYPE_WAI 0x88b4 -#ifdef BCMWPA2 -#define ETHER_TYPE_802_1X_PREAUTH 0x88c7 -#endif - - -#define ETHER_BRCM_SUBTYPE_LEN 4 -#define ETHER_BRCM_CRAM 1 - - -#define ETHER_DEST_OFFSET (0 * ETHER_ADDR_LEN) -#define ETHER_SRC_OFFSET (1 * ETHER_ADDR_LEN) -#define ETHER_TYPE_OFFSET (2 * ETHER_ADDR_LEN) - - -#define ETHER_IS_VALID_LEN(foo) \ - ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) - - -#ifndef __INCif_etherh - -BWL_PRE_PACKED_STRUCT struct ether_header { - uint8 ether_dhost[ETHER_ADDR_LEN]; - uint8 ether_shost[ETHER_ADDR_LEN]; - uint16 ether_type; -} BWL_POST_PACKED_STRUCT; - - -BWL_PRE_PACKED_STRUCT struct ether_addr { - uint8 octet[ETHER_ADDR_LEN]; -} BWL_POST_PACKED_STRUCT; -#endif - - -#define ETHER_SET_LOCALADDR(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] | 2)) -#define ETHER_IS_LOCALADDR(ea) (((uint8 *)(ea))[0] & 2) -#define ETHER_CLR_LOCALADDR(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] & 0xd)) -#define ETHER_TOGGLE_LOCALADDR(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] ^ 2)) - - -#define ETHER_SET_UNICAST(ea) (((uint8 *)(ea))[0] = (((uint8 *)(ea))[0] & ~1)) - - -#define ETHER_ISMULTI(ea) (((const uint8 *)(ea))[0] & 1) - - - -#define ether_cmp(a, b) (!(((short*)a)[0] == ((short*)b)[0]) | \ - !(((short*)a)[1] == ((short*)b)[1]) | \ - !(((short*)a)[2] == ((short*)b)[2])) - - -#define ether_copy(s, d) { \ - ((short*)d)[0] = ((short*)s)[0]; \ - ((short*)d)[1] = ((short*)s)[1]; \ - ((short*)d)[2] = ((short*)s)[2]; } - - -static const struct ether_addr ether_bcast = {{255, 255, 255, 255, 255, 255}}; -static const struct ether_addr ether_null = {{0, 0, 0, 0, 0, 0}}; - -#define ETHER_ISBCAST(ea) ((((uint8 *)(ea))[0] & \ - ((uint8 *)(ea))[1] & \ - ((uint8 *)(ea))[2] & \ - ((uint8 *)(ea))[3] & \ - ((uint8 *)(ea))[4] & \ - ((uint8 *)(ea))[5]) == 0xff) -#define ETHER_ISNULLADDR(ea) ((((uint8 *)(ea))[0] | \ - ((uint8 *)(ea))[1] | \ - ((uint8 *)(ea))[2] | \ - ((uint8 *)(ea))[3] | \ - ((uint8 *)(ea))[4] | \ - ((uint8 *)(ea))[5]) == 0) - - - -#include - -#endif diff --git a/drivers/net/wireless/bcm4319/include/proto/sdspi.h b/drivers/net/wireless/bcm4319/include/proto/sdspi.h deleted file mode 100644 index 7739e68a2440..000000000000 --- a/drivers/net/wireless/bcm4319/include/proto/sdspi.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SD-SPI Protocol Standard - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: sdspi.h,v 9.1.20.1 2008/05/06 22:59:19 Exp $ - */ - -#define SPI_START_M BITFIELD_MASK(1) /* Bit [31] - Start Bit */ -#define SPI_START_S 31 -#define SPI_DIR_M BITFIELD_MASK(1) /* Bit [30] - Direction */ -#define SPI_DIR_S 30 -#define SPI_CMD_INDEX_M BITFIELD_MASK(6) /* Bits [29:24] - Command number */ -#define SPI_CMD_INDEX_S 24 -#define SPI_RW_M BITFIELD_MASK(1) /* Bit [23] - Read=0, Write=1 */ -#define SPI_RW_S 23 -#define SPI_FUNC_M BITFIELD_MASK(3) /* Bits [22:20] - Function Number */ -#define SPI_FUNC_S 20 -#define SPI_RAW_M BITFIELD_MASK(1) /* Bit [19] - Read After Wr */ -#define SPI_RAW_S 19 -#define SPI_STUFF_M BITFIELD_MASK(1) /* Bit [18] - Stuff bit */ -#define SPI_STUFF_S 18 -#define SPI_BLKMODE_M BITFIELD_MASK(1) /* Bit [19] - Blockmode 1=blk */ -#define SPI_BLKMODE_S 19 -#define SPI_OPCODE_M BITFIELD_MASK(1) /* Bit [18] - OP Code */ -#define SPI_OPCODE_S 18 -#define SPI_ADDR_M BITFIELD_MASK(17) /* Bits [17:1] - Address */ -#define SPI_ADDR_S 1 -#define SPI_STUFF0_M BITFIELD_MASK(1) /* Bit [0] - Stuff bit */ -#define SPI_STUFF0_S 0 - -#define SPI_RSP_START_M BITFIELD_MASK(1) /* Bit [7] - Start Bit (always 0) */ -#define SPI_RSP_START_S 7 -#define SPI_RSP_PARAM_ERR_M BITFIELD_MASK(1) /* Bit [6] - Parameter Error */ -#define SPI_RSP_PARAM_ERR_S 6 -#define SPI_RSP_RFU5_M BITFIELD_MASK(1) /* Bit [5] - RFU (Always 0) */ -#define SPI_RSP_RFU5_S 5 -#define SPI_RSP_FUNC_ERR_M BITFIELD_MASK(1) /* Bit [4] - Function number error */ -#define SPI_RSP_FUNC_ERR_S 4 -#define SPI_RSP_CRC_ERR_M BITFIELD_MASK(1) /* Bit [3] - COM CRC Error */ -#define SPI_RSP_CRC_ERR_S 3 -#define SPI_RSP_ILL_CMD_M BITFIELD_MASK(1) /* Bit [2] - Illegal Command error */ -#define SPI_RSP_ILL_CMD_S 2 -#define SPI_RSP_RFU1_M BITFIELD_MASK(1) /* Bit [1] - RFU (Always 0) */ -#define SPI_RSP_RFU1_S 1 -#define SPI_RSP_IDLE_M BITFIELD_MASK(1) /* Bit [0] - In idle state */ -#define SPI_RSP_IDLE_S 0 - -/* SD-SPI Protocol Definitions */ -#define SDSPI_COMMAND_LEN 6 /* Number of bytes in an SD command */ -#define SDSPI_START_BLOCK 0xFE /* SD Start Block Token */ -#define SDSPI_IDLE_PAD 0xFF /* SD-SPI idle value for MOSI */ -#define SDSPI_START_BIT_MASK 0x80 diff --git a/drivers/net/wireless/bcm4319/include/proto/vlan.h b/drivers/net/wireless/bcm4319/include/proto/vlan.h deleted file mode 100644 index 670bc44c6bd6..000000000000 --- a/drivers/net/wireless/bcm4319/include/proto/vlan.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 802.1Q VLAN protocol definitions - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: vlan.h,v 9.4.196.2 2008/12/07 21:19:20 Exp $ - */ - - -#ifndef _vlan_h_ -#define _vlan_h_ - -#ifndef _TYPEDEFS_H_ -#include -#endif - - -#include - -#define VLAN_VID_MASK 0xfff -#define VLAN_CFI_SHIFT 12 -#define VLAN_PRI_SHIFT 13 - -#define VLAN_PRI_MASK 7 - -#define VLAN_TAG_LEN 4 -#define VLAN_TAG_OFFSET (2 * ETHER_ADDR_LEN) - -#define VLAN_TPID 0x8100 - -struct ethervlan_header { - uint8 ether_dhost[ETHER_ADDR_LEN]; - uint8 ether_shost[ETHER_ADDR_LEN]; - uint16 vlan_type; - uint16 vlan_tag; - uint16 ether_type; -}; - -#define ETHERVLAN_HDR_LEN (ETHER_HDR_LEN + VLAN_TAG_LEN) - - - -#include - -#endif diff --git a/drivers/net/wireless/bcm4319/include/proto/wpa.h b/drivers/net/wireless/bcm4319/include/proto/wpa.h deleted file mode 100644 index f5d0cd539777..000000000000 --- a/drivers/net/wireless/bcm4319/include/proto/wpa.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Fundamental types and constants relating to WPA - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: wpa.h,v 1.16.166.1.20.1 2008/11/20 00:51:31 Exp $ - */ - - -#ifndef _proto_wpa_h_ -#define _proto_wpa_h_ - -#include -#include - - - -#include - - - - -#define DOT11_RC_INVALID_WPA_IE 13 -#define DOT11_RC_MIC_FAILURE 14 -#define DOT11_RC_4WH_TIMEOUT 15 -#define DOT11_RC_GTK_UPDATE_TIMEOUT 16 -#define DOT11_RC_WPA_IE_MISMATCH 17 -#define DOT11_RC_INVALID_MC_CIPHER 18 -#define DOT11_RC_INVALID_UC_CIPHER 19 -#define DOT11_RC_INVALID_AKMP 20 -#define DOT11_RC_BAD_WPA_VERSION 21 -#define DOT11_RC_INVALID_WPA_CAP 22 -#define DOT11_RC_8021X_AUTH_FAIL 23 - -#define WPA2_PMKID_LEN 16 - - -typedef BWL_PRE_PACKED_STRUCT struct -{ - uint8 tag; - uint8 length; - uint8 oui[3]; - uint8 oui_type; - BWL_PRE_PACKED_STRUCT struct { - uint8 low; - uint8 high; - } BWL_POST_PACKED_STRUCT version; -} BWL_POST_PACKED_STRUCT wpa_ie_fixed_t; -#define WPA_IE_OUITYPE_LEN 4 -#define WPA_IE_FIXED_LEN 8 -#define WPA_IE_TAG_FIXED_LEN 6 - -typedef BWL_PRE_PACKED_STRUCT struct { - uint8 tag; - uint8 length; - BWL_PRE_PACKED_STRUCT struct { - uint8 low; - uint8 high; - } BWL_POST_PACKED_STRUCT version; -} BWL_POST_PACKED_STRUCT wpa_rsn_ie_fixed_t; -#define WPA_RSN_IE_FIXED_LEN 4 -#define WPA_RSN_IE_TAG_FIXED_LEN 2 -typedef uint8 wpa_pmkid_t[WPA2_PMKID_LEN]; - - -typedef BWL_PRE_PACKED_STRUCT struct -{ - uint8 oui[3]; - uint8 type; -} BWL_POST_PACKED_STRUCT wpa_suite_t, wpa_suite_mcast_t; -#define WPA_SUITE_LEN 4 - - -typedef BWL_PRE_PACKED_STRUCT struct -{ - BWL_PRE_PACKED_STRUCT struct { - uint8 low; - uint8 high; - } BWL_POST_PACKED_STRUCT count; - wpa_suite_t list[1]; -} BWL_POST_PACKED_STRUCT wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t; -#define WPA_IE_SUITE_COUNT_LEN 2 -typedef BWL_PRE_PACKED_STRUCT struct -{ - BWL_PRE_PACKED_STRUCT struct { - uint8 low; - uint8 high; - } BWL_POST_PACKED_STRUCT count; - wpa_pmkid_t list[1]; -} BWL_POST_PACKED_STRUCT wpa_pmkid_list_t; - - -#define WPA_CIPHER_NONE 0 -#define WPA_CIPHER_WEP_40 1 -#define WPA_CIPHER_TKIP 2 -#define WPA_CIPHER_AES_OCB 3 -#define WPA_CIPHER_AES_CCM 4 -#define WPA_CIPHER_WEP_104 5 - -#define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \ - (cipher) == WPA_CIPHER_WEP_40 || \ - (cipher) == WPA_CIPHER_WEP_104 || \ - (cipher) == WPA_CIPHER_TKIP || \ - (cipher) == WPA_CIPHER_AES_OCB || \ - (cipher) == WPA_CIPHER_AES_CCM) - - -#define WPA_TKIP_CM_DETECT 60 -#define WPA_TKIP_CM_BLOCK 60 - - -#define RSN_CAP_LEN 2 - - -#define RSN_CAP_PREAUTH 0x0001 -#define RSN_CAP_NOPAIRWISE 0x0002 -#define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C -#define RSN_CAP_PTK_REPLAY_CNTR_SHIFT 2 -#define RSN_CAP_GTK_REPLAY_CNTR_MASK 0x0030 -#define RSN_CAP_GTK_REPLAY_CNTR_SHIFT 4 -#define RSN_CAP_1_REPLAY_CNTR 0 -#define RSN_CAP_2_REPLAY_CNTRS 1 -#define RSN_CAP_4_REPLAY_CNTRS 2 -#define RSN_CAP_16_REPLAY_CNTRS 3 - - -#define WPA_CAP_4_REPLAY_CNTRS RSN_CAP_4_REPLAY_CNTRS -#define WPA_CAP_16_REPLAY_CNTRS RSN_CAP_16_REPLAY_CNTRS -#define WPA_CAP_REPLAY_CNTR_SHIFT RSN_CAP_PTK_REPLAY_CNTR_SHIFT -#define WPA_CAP_REPLAY_CNTR_MASK RSN_CAP_PTK_REPLAY_CNTR_MASK - - -#define WPA_CAP_LEN RSN_CAP_LEN - -#define WPA_CAP_WPA2_PREAUTH RSN_CAP_PREAUTH - - - -#include - -#endif diff --git a/drivers/net/wireless/bcm4319/include/sbchipc.h b/drivers/net/wireless/bcm4319/include/sbchipc.h deleted file mode 100644 index 39e5c8d6aed0..000000000000 --- a/drivers/net/wireless/bcm4319/include/sbchipc.h +++ /dev/null @@ -1,1026 +0,0 @@ -/* - * SiliconBackplane Chipcommon core hardware definitions. - * - * The chipcommon core provides chip identification, SB control, - * jtag, 0/1/2 uarts, clock frequency control, a watchdog interrupt timer, - * gpio interface, extbus, and support for serial and parallel flashes. - * - * $Id: sbchipc.h,v 13.103.2.5.4.5.2.9 2009/07/03 14:23:21 Exp $ - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - */ - - -#ifndef _SBCHIPC_H -#define _SBCHIPC_H - -#ifndef _LANGUAGE_ASSEMBLY - - -#ifndef PAD -#define _PADLINE(line) pad ## line -#define _XSTR(line) _PADLINE(line) -#define PAD _XSTR(__LINE__) -#endif - -typedef volatile struct { - uint32 chipid; - uint32 capabilities; - uint32 corecontrol; - uint32 bist; - - - uint32 otpstatus; - uint32 otpcontrol; - uint32 otpprog; - uint32 PAD; - - - uint32 intstatus; - uint32 intmask; - uint32 chipcontrol; - uint32 chipstatus; - - - uint32 jtagcmd; - uint32 jtagir; - uint32 jtagdr; - uint32 jtagctrl; - - - uint32 flashcontrol; - uint32 flashaddress; - uint32 flashdata; - uint32 PAD[1]; - - - uint32 broadcastaddress; - uint32 broadcastdata; - - - uint32 gpiopullup; - uint32 gpiopulldown; - uint32 gpioin; - uint32 gpioout; - uint32 gpioouten; - uint32 gpiocontrol; - uint32 gpiointpolarity; - uint32 gpiointmask; - - - uint32 gpioevent; - uint32 gpioeventintmask; - - - uint32 watchdog; - - - uint32 gpioeventintpolarity; - - - uint32 gpiotimerval; - uint32 gpiotimeroutmask; - - - uint32 clockcontrol_n; - uint32 clockcontrol_sb; - uint32 clockcontrol_pci; - uint32 clockcontrol_m2; - uint32 clockcontrol_m3; - uint32 clkdiv; - uint32 PAD[2]; - - - uint32 pll_on_delay; - uint32 fref_sel_delay; - uint32 slow_clk_ctl; - uint32 PAD[1]; - - - uint32 system_clk_ctl; - uint32 clkstatestretch; - uint32 PAD[13]; - - - uint32 eromptr; - - - uint32 pcmcia_config; - uint32 pcmcia_memwait; - uint32 pcmcia_attrwait; - uint32 pcmcia_iowait; - uint32 ide_config; - uint32 ide_memwait; - uint32 ide_attrwait; - uint32 ide_iowait; - uint32 prog_config; - uint32 prog_waitcount; - uint32 flash_config; - uint32 flash_waitcount; - uint32 PAD[4]; - uint32 PAD[40]; - - - - uint32 clk_ctl_st; - uint32 hw_war; - uint32 PAD[70]; - - - uint8 uart0data; - uint8 uart0imr; - uint8 uart0fcr; - uint8 uart0lcr; - uint8 uart0mcr; - uint8 uart0lsr; - uint8 uart0msr; - uint8 uart0scratch; - uint8 PAD[248]; - - uint8 uart1data; - uint8 uart1imr; - uint8 uart1fcr; - uint8 uart1lcr; - uint8 uart1mcr; - uint8 uart1lsr; - uint8 uart1msr; - uint8 uart1scratch; - uint32 PAD[126]; - - - uint32 pmucontrol; - uint32 pmucapabilities; - uint32 pmustatus; - uint32 res_state; - uint32 res_pending; - uint32 pmutimer; - uint32 min_res_mask; - uint32 max_res_mask; - uint32 res_table_sel; - uint32 res_dep_mask; - uint32 res_updn_timer; - uint32 res_timer; - uint32 clkstretch; - uint32 pmuwatchdog; - uint32 gpiosel; - uint32 gpioenable; - uint32 res_req_timer_sel; - uint32 res_req_timer; - uint32 res_req_mask; - uint32 PAD; - uint32 chipcontrol_addr; - uint32 chipcontrol_data; - uint32 regcontrol_addr; - uint32 regcontrol_data; - uint32 pllcontrol_addr; - uint32 pllcontrol_data; - uint32 PAD[102]; - uint16 otp[768]; -} chipcregs_t; - -#endif - -#define CC_CHIPID 0 -#define CC_CAPABILITIES 4 -#define CC_OTPST 0x10 -#define CC_CHIPST 0x2c -#define CC_JTAGCMD 0x30 -#define CC_JTAGIR 0x34 -#define CC_JTAGDR 0x38 -#define CC_JTAGCTRL 0x3c -#define CC_WATCHDOG 0x80 -#define CC_CLKC_N 0x90 -#define CC_CLKC_M0 0x94 -#define CC_CLKC_M1 0x98 -#define CC_CLKC_M2 0x9c -#define CC_CLKC_M3 0xa0 -#define CC_CLKDIV 0xa4 -#define CC_SYS_CLK_CTL 0xc0 -#define CC_CLK_CTL_ST SI_CLK_CTL_ST -#define CC_EROMPTR 0xfc -#define PMU_CTL 0x600 -#define PMU_CAP 0x604 -#define PMU_ST 0x608 -#define PMU_RES_STATE 0x60c -#define PMU_TIMER 0x614 -#define PMU_MIN_RES_MASK 0x618 -#define PMU_MAX_RES_MASK 0x61c -#define PMU_REG_CONTROL_ADDR 0x658 -#define PMU_REG_CONTROL_DATA 0x65C -#define PMU_PLL_CONTROL_ADDR 0x660 -#define PMU_PLL_CONTROL_DATA 0x664 -#define CC_OTP 0x800 - - -#define CID_ID_MASK 0x0000ffff -#define CID_REV_MASK 0x000f0000 -#define CID_REV_SHIFT 16 -#define CID_PKG_MASK 0x00f00000 -#define CID_PKG_SHIFT 20 -#define CID_CC_MASK 0x0f000000 -#define CID_CC_SHIFT 24 -#define CID_TYPE_MASK 0xf0000000 -#define CID_TYPE_SHIFT 28 - - -#define CC_CAP_UARTS_MASK 0x00000003 -#define CC_CAP_MIPSEB 0x00000004 -#define CC_CAP_UCLKSEL 0x00000018 -#define CC_CAP_UINTCLK 0x00000008 -#define CC_CAP_UARTGPIO 0x00000020 -#define CC_CAP_EXTBUS_MASK 0x000000c0 -#define CC_CAP_EXTBUS_NONE 0x00000000 -#define CC_CAP_EXTBUS_FULL 0x00000040 -#define CC_CAP_EXTBUS_PROG 0x00000080 -#define CC_CAP_FLASH_MASK 0x00000700 -#define CC_CAP_PLL_MASK 0x00038000 -#define CC_CAP_PWR_CTL 0x00040000 -#define CC_CAP_OTPSIZE 0x00380000 -#define CC_CAP_OTPSIZE_SHIFT 19 -#define CC_CAP_OTPSIZE_BASE 5 -#define CC_CAP_JTAGP 0x00400000 -#define CC_CAP_ROM 0x00800000 -#define CC_CAP_BKPLN64 0x08000000 -#define CC_CAP_PMU 0x10000000 -#define CC_CAP_ECI 0x20000000 - - -#define PLL_NONE 0x00000000 -#define PLL_TYPE1 0x00010000 -#define PLL_TYPE2 0x00020000 -#define PLL_TYPE3 0x00030000 -#define PLL_TYPE4 0x00008000 -#define PLL_TYPE5 0x00018000 -#define PLL_TYPE6 0x00028000 -#define PLL_TYPE7 0x00038000 - - -#define ILP_CLOCK 32000 - - -#define ALP_CLOCK 20000000 - - -#define HT_CLOCK 80000000 - - -#define CC_UARTCLKO 0x00000001 -#define CC_SE 0x00000002 -#define CC_UARTCLKEN 0x00000008 - - -#define CHIPCTRL_4321A0_DEFAULT 0x3a4 -#define CHIPCTRL_4321A1_DEFAULT 0x0a4 -#define CHIPCTRL_4321_PLL_DOWN 0x800000 - - -#define OTPS_OL_MASK 0x000000ff -#define OTPS_OL_MFG 0x00000001 -#define OTPS_OL_OR1 0x00000002 -#define OTPS_OL_OR2 0x00000004 -#define OTPS_OL_GU 0x00000008 -#define OTPS_GUP_MASK 0x00000f00 -#define OTPS_GUP_SHIFT 8 -#define OTPS_GUP_HW 0x00000100 -#define OTPS_GUP_SW 0x00000200 -#define OTPS_GUP_CI 0x00000400 -#define OTPS_GUP_FUSE 0x00000800 -#define OTPS_READY 0x00001000 -#define OTPS_RV(x) (1 << (16 + (x))) -#define OTPS_RV_MASK 0x0fff0000 - - -#define OTPC_PROGSEL 0x00000001 -#define OTPC_PCOUNT_MASK 0x0000000e -#define OTPC_PCOUNT_SHIFT 1 -#define OTPC_VSEL_MASK 0x000000f0 -#define OTPC_VSEL_SHIFT 4 -#define OTPC_TMM_MASK 0x00000700 -#define OTPC_TMM_SHIFT 8 -#define OTPC_ODM 0x00000800 -#define OTPC_PROGEN 0x80000000 - - -#define OTPP_COL_MASK 0x000000ff -#define OTPP_COL_SHIFT 0 -#define OTPP_ROW_MASK 0x0000ff00 -#define OTPP_ROW_SHIFT 8 -#define OTPP_OC_MASK 0x0f000000 -#define OTPP_OC_SHIFT 24 -#define OTPP_READERR 0x10000000 -#define OTPP_VALUE_MASK 0x20000000 -#define OTPP_VALUE_SHIFT 29 -#define OTPP_START_BUSY 0x80000000 - - -#define OTPPOC_READ 0 -#define OTPPOC_BIT_PROG 1 -#define OTPPOC_VERIFY 3 -#define OTPPOC_INIT 4 -#define OTPPOC_SET 5 -#define OTPPOC_RESET 6 -#define OTPPOC_OCST 7 -#define OTPPOC_ROW_LOCK 8 -#define OTPPOC_PRESCN_TEST 9 - - -#define JCMD_START 0x80000000 -#define JCMD_BUSY 0x80000000 -#define JCMD_STATE_MASK 0x60000000 -#define JCMD_STATE_TLR 0x00000000 -#define JCMD_STATE_PIR 0x20000000 -#define JCMD_STATE_PDR 0x40000000 -#define JCMD_STATE_RTI 0x60000000 -#define JCMD0_ACC_MASK 0x0000f000 -#define JCMD0_ACC_IRDR 0x00000000 -#define JCMD0_ACC_DR 0x00001000 -#define JCMD0_ACC_IR 0x00002000 -#define JCMD0_ACC_RESET 0x00003000 -#define JCMD0_ACC_IRPDR 0x00004000 -#define JCMD0_ACC_PDR 0x00005000 -#define JCMD0_IRW_MASK 0x00000f00 -#define JCMD_ACC_MASK 0x000f0000 -#define JCMD_ACC_IRDR 0x00000000 -#define JCMD_ACC_DR 0x00010000 -#define JCMD_ACC_IR 0x00020000 -#define JCMD_ACC_RESET 0x00030000 -#define JCMD_ACC_IRPDR 0x00040000 -#define JCMD_ACC_PDR 0x00050000 -#define JCMD_ACC_PIR 0x00060000 -#define JCMD_ACC_IRDR_I 0x00070000 -#define JCMD_ACC_DR_I 0x00080000 -#define JCMD_IRW_MASK 0x00001f00 -#define JCMD_IRW_SHIFT 8 -#define JCMD_DRW_MASK 0x0000003f - - -#define JCTRL_FORCE_CLK 4 -#define JCTRL_EXT_EN 2 -#define JCTRL_EN 1 - - -#define CLKD_SFLASH 0x0f000000 -#define CLKD_SFLASH_SHIFT 24 -#define CLKD_OTP 0x000f0000 -#define CLKD_OTP_SHIFT 16 -#define CLKD_JTAG 0x00000f00 -#define CLKD_JTAG_SHIFT 8 -#define CLKD_UART 0x000000ff - - -#define CI_GPIO 0x00000001 -#define CI_EI 0x00000002 -#define CI_TEMP 0x00000004 -#define CI_SIRQ 0x00000008 -#define CI_ECI 0x00000010 -#define CI_PMU 0x00000020 -#define CI_UART 0x00000040 -#define CI_WDRESET 0x80000000 - - -#define SCC_SS_MASK 0x00000007 -#define SCC_SS_LPO 0x00000000 -#define SCC_SS_XTAL 0x00000001 -#define SCC_SS_PCI 0x00000002 -#define SCC_LF 0x00000200 -#define SCC_LP 0x00000400 -#define SCC_FS 0x00000800 -#define SCC_IP 0x00001000 -#define SCC_XC 0x00002000 -#define SCC_XP 0x00004000 -#define SCC_CD_MASK 0xffff0000 -#define SCC_CD_SHIFT 16 - - -#define SYCC_IE 0x00000001 -#define SYCC_AE 0x00000002 -#define SYCC_FP 0x00000004 -#define SYCC_AR 0x00000008 -#define SYCC_HR 0x00000010 -#define SYCC_CD_MASK 0xffff0000 -#define SYCC_CD_SHIFT 16 - - -#define CF_EN 0x00000001 -#define CF_EM_MASK 0x0000000e -#define CF_EM_SHIFT 1 -#define CF_EM_FLASH 0 -#define CF_EM_SYNC 2 -#define CF_EM_PCMCIA 4 -#define CF_DS 0x00000010 -#define CF_BS 0x00000020 -#define CF_CD_MASK 0x000000c0 -#define CF_CD_SHIFT 6 -#define CF_CD_DIV2 0x00000000 -#define CF_CD_DIV3 0x00000040 -#define CF_CD_DIV4 0x00000080 -#define CF_CE 0x00000100 -#define CF_SB 0x00000200 - - -#define PM_W0_MASK 0x0000003f -#define PM_W1_MASK 0x00001f00 -#define PM_W1_SHIFT 8 -#define PM_W2_MASK 0x001f0000 -#define PM_W2_SHIFT 16 -#define PM_W3_MASK 0x1f000000 -#define PM_W3_SHIFT 24 - - -#define PA_W0_MASK 0x0000003f -#define PA_W1_MASK 0x00001f00 -#define PA_W1_SHIFT 8 -#define PA_W2_MASK 0x001f0000 -#define PA_W2_SHIFT 16 -#define PA_W3_MASK 0x1f000000 -#define PA_W3_SHIFT 24 - - -#define PI_W0_MASK 0x0000003f -#define PI_W1_MASK 0x00001f00 -#define PI_W1_SHIFT 8 -#define PI_W2_MASK 0x001f0000 -#define PI_W2_SHIFT 16 -#define PI_W3_MASK 0x1f000000 -#define PI_W3_SHIFT 24 - - -#define PW_W0_MASK 0x0000001f -#define PW_W1_MASK 0x00001f00 -#define PW_W1_SHIFT 8 -#define PW_W2_MASK 0x001f0000 -#define PW_W2_SHIFT 16 -#define PW_W3_MASK 0x1f000000 -#define PW_W3_SHIFT 24 - -#define PW_W0 0x0000000c -#define PW_W1 0x00000a00 -#define PW_W2 0x00020000 -#define PW_W3 0x01000000 - - -#define FW_W0_MASK 0x0000003f -#define FW_W1_MASK 0x00001f00 -#define FW_W1_SHIFT 8 -#define FW_W2_MASK 0x001f0000 -#define FW_W2_SHIFT 16 -#define FW_W3_MASK 0x1f000000 -#define FW_W3_SHIFT 24 - - -#define WATCHDOG_CLOCK 48000000 -#define WATCHDOG_CLOCK_5354 32000 - - -#define PCTL_ILP_DIV_MASK 0xffff0000 -#define PCTL_ILP_DIV_SHIFT 16 -#define PCTL_PLL_PLLCTL_UPD 0x00000400 -#define PCTL_NOILP_ON_WAIT 0x00000200 -#define PCTL_HT_REQ_EN 0x00000100 -#define PCTL_ALP_REQ_EN 0x00000080 -#define PCTL_XTALFREQ_MASK 0x0000007c -#define PCTL_XTALFREQ_SHIFT 2 -#define PCTL_ILP_DIV_EN 0x00000002 -#define PCTL_LPO_SEL 0x00000001 - - -#define CSTRETCH_HT 0xffff0000 -#define CSTRETCH_ALP 0x0000ffff - - -#define GPIO_ONTIME_SHIFT 16 - - -#define CN_N1_MASK 0x3f -#define CN_N2_MASK 0x3f00 -#define CN_N2_SHIFT 8 -#define CN_PLLC_MASK 0xf0000 -#define CN_PLLC_SHIFT 16 - - -#define CC_M1_MASK 0x3f -#define CC_M2_MASK 0x3f00 -#define CC_M2_SHIFT 8 -#define CC_M3_MASK 0x3f0000 -#define CC_M3_SHIFT 16 -#define CC_MC_MASK 0x1f000000 -#define CC_MC_SHIFT 24 - - -#define CC_F6_2 0x02 -#define CC_F6_3 0x03 -#define CC_F6_4 0x05 -#define CC_F6_5 0x09 -#define CC_F6_6 0x11 -#define CC_F6_7 0x21 - -#define CC_F5_BIAS 5 - -#define CC_MC_BYPASS 0x08 -#define CC_MC_M1 0x04 -#define CC_MC_M1M2 0x02 -#define CC_MC_M1M2M3 0x01 -#define CC_MC_M1M3 0x11 - - -#define CC_T2_BIAS 2 -#define CC_T2M2_BIAS 3 - -#define CC_T2MC_M1BYP 1 -#define CC_T2MC_M2BYP 2 -#define CC_T2MC_M3BYP 4 - - -#define CC_T6_MMASK 1 -#define CC_T6_M0 120000000 -#define CC_T6_M1 100000000 -#define SB2MIPS_T6(sb) (2 * (sb)) - - -#define CC_CLOCK_BASE1 24000000 -#define CC_CLOCK_BASE2 12500000 - - -#define CLKC_5350_N 0x0311 -#define CLKC_5350_M 0x04020009 - - -#define FLASH_NONE 0x000 -#define SFLASH_ST 0x100 -#define SFLASH_AT 0x200 -#define PFLASH 0x700 - - -#define CC_CFG_EN 0x0001 -#define CC_CFG_EM_MASK 0x000e -#define CC_CFG_EM_ASYNC 0x0000 -#define CC_CFG_EM_SYNC 0x0002 -#define CC_CFG_EM_PCMCIA 0x0004 -#define CC_CFG_EM_IDE 0x0006 -#define CC_CFG_DS 0x0010 -#define CC_CFG_CD_MASK 0x00e0 -#define CC_CFG_CE 0x0100 -#define CC_CFG_SB 0x0200 -#define CC_CFG_IS 0x0400 - - -#define CC_EB_BASE 0x1a000000 -#define CC_EB_PCMCIA_MEM 0x1a000000 -#define CC_EB_PCMCIA_IO 0x1a200000 -#define CC_EB_PCMCIA_CFG 0x1a400000 -#define CC_EB_IDE 0x1a800000 -#define CC_EB_PCMCIA1_MEM 0x1a800000 -#define CC_EB_PCMCIA1_IO 0x1aa00000 -#define CC_EB_PCMCIA1_CFG 0x1ac00000 -#define CC_EB_PROGIF 0x1b000000 - - - -#define SFLASH_OPCODE 0x000000ff -#define SFLASH_ACTION 0x00000700 -#define SFLASH_CS_ACTIVE 0x00001000 -#define SFLASH_START 0x80000000 -#define SFLASH_BUSY SFLASH_START - - -#define SFLASH_ACT_OPONLY 0x0000 -#define SFLASH_ACT_OP1D 0x0100 -#define SFLASH_ACT_OP3A 0x0200 -#define SFLASH_ACT_OP3A1D 0x0300 -#define SFLASH_ACT_OP3A4D 0x0400 -#define SFLASH_ACT_OP3A4X4D 0x0500 -#define SFLASH_ACT_OP3A1X4D 0x0700 - - -#define SFLASH_ST_WREN 0x0006 -#define SFLASH_ST_WRDIS 0x0004 -#define SFLASH_ST_RDSR 0x0105 -#define SFLASH_ST_WRSR 0x0101 -#define SFLASH_ST_READ 0x0303 -#define SFLASH_ST_PP 0x0302 -#define SFLASH_ST_SE 0x02d8 -#define SFLASH_ST_BE 0x00c7 -#define SFLASH_ST_DP 0x00b9 -#define SFLASH_ST_RES 0x03ab -#define SFLASH_ST_CSA 0x1000 - - -#define SFLASH_ST_WIP 0x01 -#define SFLASH_ST_WEL 0x02 -#define SFLASH_ST_BP_MASK 0x1c -#define SFLASH_ST_BP_SHIFT 2 -#define SFLASH_ST_SRWD 0x80 - - -#define SFLASH_AT_READ 0x07e8 -#define SFLASH_AT_PAGE_READ 0x07d2 -#define SFLASH_AT_BUF1_READ -#define SFLASH_AT_BUF2_READ -#define SFLASH_AT_STATUS 0x01d7 -#define SFLASH_AT_BUF1_WRITE 0x0384 -#define SFLASH_AT_BUF2_WRITE 0x0387 -#define SFLASH_AT_BUF1_ERASE_PROGRAM 0x0283 -#define SFLASH_AT_BUF2_ERASE_PROGRAM 0x0286 -#define SFLASH_AT_BUF1_PROGRAM 0x0288 -#define SFLASH_AT_BUF2_PROGRAM 0x0289 -#define SFLASH_AT_PAGE_ERASE 0x0281 -#define SFLASH_AT_BLOCK_ERASE 0x0250 -#define SFLASH_AT_BUF1_WRITE_ERASE_PROGRAM 0x0382 -#define SFLASH_AT_BUF2_WRITE_ERASE_PROGRAM 0x0385 -#define SFLASH_AT_BUF1_LOAD 0x0253 -#define SFLASH_AT_BUF2_LOAD 0x0255 -#define SFLASH_AT_BUF1_COMPARE 0x0260 -#define SFLASH_AT_BUF2_COMPARE 0x0261 -#define SFLASH_AT_BUF1_REPROGRAM 0x0258 -#define SFLASH_AT_BUF2_REPROGRAM 0x0259 - - -#define SFLASH_AT_READY 0x80 -#define SFLASH_AT_MISMATCH 0x40 -#define SFLASH_AT_ID_MASK 0x38 -#define SFLASH_AT_ID_SHIFT 3 - - - -#define UART_RX 0 -#define UART_TX 0 -#define UART_DLL 0 -#define UART_IER 1 -#define UART_DLM 1 -#define UART_IIR 2 -#define UART_FCR 2 -#define UART_LCR 3 -#define UART_MCR 4 -#define UART_LSR 5 -#define UART_MSR 6 -#define UART_SCR 7 -#define UART_LCR_DLAB 0x80 -#define UART_LCR_WLEN8 0x03 -#define UART_MCR_OUT2 0x08 -#define UART_MCR_LOOP 0x10 -#define UART_LSR_RX_FIFO 0x80 -#define UART_LSR_TDHR 0x40 -#define UART_LSR_THRE 0x20 -#define UART_LSR_BREAK 0x10 -#define UART_LSR_FRAMING 0x08 -#define UART_LSR_PARITY 0x04 -#define UART_LSR_OVERRUN 0x02 -#define UART_LSR_RXRDY 0x01 -#define UART_FCR_FIFO_ENABLE 1 - - -#define UART_IIR_FIFO_MASK 0xc0 -#define UART_IIR_INT_MASK 0xf -#define UART_IIR_MDM_CHG 0x0 -#define UART_IIR_NOINT 0x1 -#define UART_IIR_THRE 0x2 -#define UART_IIR_RCVD_DATA 0x4 -#define UART_IIR_RCVR_STATUS 0x6 -#define UART_IIR_CHAR_TIME 0xc - - -#define UART_IER_EDSSI 8 -#define UART_IER_ELSI 4 -#define UART_IER_ETBEI 2 -#define UART_IER_ERBFI 1 - - -#define PST_INTPEND 0x0040 -#define PST_SBCLKST 0x0030 -#define PST_SBCLKST_ILP 0x0010 -#define PST_SBCLKST_ALP 0x0020 -#define PST_SBCLKST_HT 0x0030 -#define PST_ALPAVAIL 0x0008 -#define PST_HTAVAIL 0x0004 -#define PST_RESINIT 0x0003 - - -#define PCAP_REV_MASK 0x000000ff -#define PCAP_RC_MASK 0x00001f00 -#define PCAP_RC_SHIFT 8 -#define PCAP_TC_MASK 0x0001e000 -#define PCAP_TC_SHIFT 13 -#define PCAP_PC_MASK 0x001e0000 -#define PCAP_PC_SHIFT 17 -#define PCAP_VC_MASK 0x01e00000 -#define PCAP_VC_SHIFT 21 -#define PCAP_CC_MASK 0x1e000000 -#define PCAP_CC_SHIFT 25 -#define PCAP5_PC_MASK 0x003e0000 -#define PCAP5_PC_SHIFT 17 -#define PCAP5_VC_MASK 0x07c00000 -#define PCAP5_VC_SHIFT 22 -#define PCAP5_CC_MASK 0xf8000000 -#define PCAP5_CC_SHIFT 27 - - - -#define PRRT_TIME_MASK 0x03ff -#define PRRT_INTEN 0x0400 -#define PRRT_REQ_ACTIVE 0x0800 -#define PRRT_ALP_REQ 0x1000 -#define PRRT_HT_REQ 0x2000 - - -#define PMURES_BIT(bit) (1 << (bit)) - - -#define PMURES_MAX_RESNUM 30 - - - - -#define PMU0_PLL0_PLLCTL0 0 -#define PMU0_PLL0_PC0_PDIV_MASK 1 -#define PMU0_PLL0_PC0_PDIV_FREQ 25000 -#define PMU0_PLL0_PC0_DIV_ARM_MASK 0x00000038 -#define PMU0_PLL0_PC0_DIV_ARM_SHIFT 3 -#define PMU0_PLL0_PC0_DIV_ARM_BASE 8 - - -#define PMU0_PLL0_PC0_DIV_ARM_110MHZ 0 -#define PMU0_PLL0_PC0_DIV_ARM_97_7MHZ 1 -#define PMU0_PLL0_PC0_DIV_ARM_88MHZ 2 -#define PMU0_PLL0_PC0_DIV_ARM_80MHZ 3 -#define PMU0_PLL0_PC0_DIV_ARM_73_3MHZ 4 -#define PMU0_PLL0_PC0_DIV_ARM_67_7MHZ 5 -#define PMU0_PLL0_PC0_DIV_ARM_62_9MHZ 6 -#define PMU0_PLL0_PC0_DIV_ARM_58_6MHZ 7 - - -#define PMU0_PLL0_PLLCTL1 1 -#define PMU0_PLL0_PC1_WILD_INT_MASK 0xf0000000 -#define PMU0_PLL0_PC1_WILD_INT_SHIFT 28 -#define PMU0_PLL0_PC1_WILD_FRAC_MASK 0x0fffff00 -#define PMU0_PLL0_PC1_WILD_FRAC_SHIFT 8 -#define PMU0_PLL0_PC1_STOP_MOD 0x00000040 - - -#define PMU0_PLL0_PLLCTL2 2 -#define PMU0_PLL0_PC2_WILD_INT_MASK 0xf -#define PMU0_PLL0_PC2_WILD_INT_SHIFT 4 - - -#define RES4328_EXT_SWITCHER_PWM 0 -#define RES4328_BB_SWITCHER_PWM 1 -#define RES4328_BB_SWITCHER_BURST 2 -#define RES4328_BB_EXT_SWITCHER_BURST 3 -#define RES4328_ILP_REQUEST 4 -#define RES4328_RADIO_SWITCHER_PWM 5 -#define RES4328_RADIO_SWITCHER_BURST 6 -#define RES4328_ROM_SWITCH 7 -#define RES4328_PA_REF_LDO 8 -#define RES4328_RADIO_LDO 9 -#define RES4328_AFE_LDO 10 -#define RES4328_PLL_LDO 11 -#define RES4328_BG_FILTBYP 12 -#define RES4328_TX_FILTBYP 13 -#define RES4328_RX_FILTBYP 14 -#define RES4328_XTAL_PU 15 -#define RES4328_XTAL_EN 16 -#define RES4328_BB_PLL_FILTBYP 17 -#define RES4328_RF_PLL_FILTBYP 18 -#define RES4328_BB_PLL_PU 19 - -#define RES5354_EXT_SWITCHER_PWM 0 -#define RES5354_BB_SWITCHER_PWM 1 -#define RES5354_BB_SWITCHER_BURST 2 -#define RES5354_BB_EXT_SWITCHER_BURST 3 -#define RES5354_ILP_REQUEST 4 -#define RES5354_RADIO_SWITCHER_PWM 5 -#define RES5354_RADIO_SWITCHER_BURST 6 -#define RES5354_ROM_SWITCH 7 -#define RES5354_PA_REF_LDO 8 -#define RES5354_RADIO_LDO 9 -#define RES5354_AFE_LDO 10 -#define RES5354_PLL_LDO 11 -#define RES5354_BG_FILTBYP 12 -#define RES5354_TX_FILTBYP 13 -#define RES5354_RX_FILTBYP 14 -#define RES5354_XTAL_PU 15 -#define RES5354_XTAL_EN 16 -#define RES5354_BB_PLL_FILTBYP 17 -#define RES5354_RF_PLL_FILTBYP 18 -#define RES5354_BB_PLL_PU 19 - - - -#define DOT11MAC_880MHZ_CLK_DIVISOR_SHIFT 8 -#define DOT11MAC_880MHZ_CLK_DIVISOR_MASK (0xFF << DOT11MAC_880MHZ_CLK_DIVISOR_SHIFT) -#define DOT11MAC_880MHZ_CLK_DIVISOR_VAL (0xE << DOT11MAC_880MHZ_CLK_DIVISOR_SHIFT) - - -#define PMU2_PHY_PLL_PLLCTL 4 -#define PMU2_SI_PLL_PLLCTL 10 - - -#define RES4325_BUCK_BOOST_BURST 0 -#define RES4325_CBUCK_BURST 1 -#define RES4325_CBUCK_PWM 2 -#define RES4325_CLDO_CBUCK_BURST 3 -#define RES4325_CLDO_CBUCK_PWM 4 -#define RES4325_BUCK_BOOST_PWM 5 -#define RES4325_ILP_REQUEST 6 -#define RES4325_ABUCK_BURST 7 -#define RES4325_ABUCK_PWM 8 -#define RES4325_LNLDO1_PU 9 -#define RES4325_OTP_PU 10 -#define RES4325_LNLDO3_PU 11 -#define RES4325_LNLDO4_PU 12 -#define RES4325_XTAL_PU 13 -#define RES4325_ALP_AVAIL 14 -#define RES4325_RX_PWRSW_PU 15 -#define RES4325_TX_PWRSW_PU 16 -#define RES4325_RFPLL_PWRSW_PU 17 -#define RES4325_LOGEN_PWRSW_PU 18 -#define RES4325_AFE_PWRSW_PU 19 -#define RES4325_BBPLL_PWRSW_PU 20 -#define RES4325_HT_AVAIL 21 - - -#define RES4325B0_CBUCK_LPOM 1 -#define RES4325B0_CBUCK_BURST 2 -#define RES4325B0_CBUCK_PWM 3 -#define RES4325B0_CLDO_PU 4 - - -#define RES4325C1_OTP_PWRSW_PU 10 -#define RES4325C1_LNLDO2_PU 12 - - -#define CST4325_SPROM_OTP_SEL_MASK 0x00000003 -#define CST4325_DEFCIS_SEL 0 -#define CST4325_SPROM_SEL 1 -#define CST4325_OTP_SEL 2 -#define CST4325_OTP_PWRDN 3 -#define CST4325_SDIO_USB_MODE_MASK 0x00000004 -#define CST4325_SDIO_USB_MODE_SHIFT 2 -#define CST4325_RCAL_VALID_MASK 0x00000008 -#define CST4325_RCAL_VALID_SHIFT 3 -#define CST4325_RCAL_VALUE_MASK 0x000001f0 -#define CST4325_RCAL_VALUE_SHIFT 4 -#define CST4325_PMUTOP_2B_MASK 0x00000200 -#define CST4325_PMUTOP_2B_SHIFT 9 - -#define RES4329_RESERVED0 0 -#define RES4329_CBUCK_LPOM 1 -#define RES4329_CBUCK_BURST 2 -#define RES4329_CBUCK_PWM 3 -#define RES4329_CLDO_PU 4 -#define RES4329_PALDO_PU 5 -#define RES4329_ILP_REQUEST 6 -#define RES4329_RESERVED7 7 -#define RES4329_RESERVED8 8 -#define RES4329_LNLDO1_PU 9 -#define RES4329_OTP_PU 10 -#define RES4329_RESERVED11 11 -#define RES4329_LNLDO2_PU 12 -#define RES4329_XTAL_PU 13 -#define RES4329_ALP_AVAIL 14 -#define RES4329_RX_PWRSW_PU 15 -#define RES4329_TX_PWRSW_PU 16 -#define RES4329_RFPLL_PWRSW_PU 17 -#define RES4329_LOGEN_PWRSW_PU 18 -#define RES4329_AFE_PWRSW_PU 19 -#define RES4329_BBPLL_PWRSW_PU 20 -#define RES4329_HT_AVAIL 21 - -#define CST4329_SPROM_OTP_SEL_MASK 0x00000003 -#define CST4329_DEFCIS_SEL 0 -#define CST4329_SPROM_SEL 1 -#define CST4329_OTP_SEL 2 -#define CST4329_OTP_PWRDN 3 -#define CST4329_SPI_SDIO_MODE_MASK 0x00000004 -#define CST4329_SPI_SDIO_MODE_SHIFT 2 - - -#define RES4312_SWITCHER_BURST 0 -#define RES4312_SWITCHER_PWM 1 -#define RES4312_PA_REF_LDO 2 -#define RES4312_CORE_LDO_BURST 3 -#define RES4312_CORE_LDO_PWM 4 -#define RES4312_RADIO_LDO 5 -#define RES4312_ILP_REQUEST 6 -#define RES4312_BG_FILTBYP 7 -#define RES4312_TX_FILTBYP 8 -#define RES4312_RX_FILTBYP 9 -#define RES4312_XTAL_PU 10 -#define RES4312_ALP_AVAIL 11 -#define RES4312_BB_PLL_FILTBYP 12 -#define RES4312_RF_PLL_FILTBYP 13 -#define RES4312_HT_AVAIL 14 - -#define RES4322_RF_LDO 0 -#define RES4322_ILP_REQUEST 1 -#define RES4322_XTAL_PU 2 -#define RES4322_ALP_AVAIL 3 -#define RES4322_SI_PLL_ON 4 -#define RES4322_HT_SI_AVAIL 5 -#define RES4322_PHY_PLL_ON 6 -#define RES4322_HT_PHY_AVAIL 7 -#define RES4322_OTP_PU 8 - - -#define CST4322_XTAL_FREQ_20_40MHZ 0x00000020 -#define CST4322_SPROM_OTP_SEL_MASK 0x000000c0 -#define CST4322_SPROM_OTP_SEL_SHIFT 6 -#define CST4322_NO_SPROM_OTP 0 -#define CST4322_SPROM_PRESENT 1 -#define CST4322_OTP_PRESENT 2 -#define CST4322_PCI_OR_USB 0x00000100 -#define CST4322_BOOT_MASK 0x00000600 -#define CST4322_BOOT_SHIFT 9 -#define CST4322_BOOT_FROM_SRAM 0 -#define CST4322_BOOT_FROM_ROM 1 -#define CST4322_BOOT_FROM_FLASH 2 -#define CST4322_BOOT_FROM_INVALID 3 -#define CST4322_ILP_DIV_EN 0x00000800 -#define CST4322_FLASH_TYPE_MASK 0x00001000 -#define CST4322_FLASH_TYPE_SHIFT 12 -#define CST4322_FLASH_TYPE_SHIFT_ST 0 -#define CST4322_FLASH_TYPE_SHIFT_ATMEL 1 -#define CST4322_ARM_TAP_SEL 0x00002000 -#define CST4322_RES_INIT_MODE_MASK 0x0000c000 -#define CST4322_RES_INIT_MODE_SHIFT 14 -#define CST4322_RES_INIT_MODE_ILPAVAIL 0 -#define CST4322_RES_INIT_MODE_ILPREQ 1 -#define CST4322_RES_INIT_MODE_ALPAVAIL 2 -#define CST4322_RES_INIT_MODE_HTAVAIL 3 -#define CST4322_PCIPLLCLK_GATING 0x00010000 -#define CST4322_CLK_SWITCH_PCI_TO_ALP 0x00020000 -#define CST4322_PCI_CARDBUS_MODE 0x00040000 - -#define RES4315_CBUCK_LPOM 1 -#define RES4315_CBUCK_BURST 2 -#define RES4315_CBUCK_PWM 3 -#define RES4315_CLDO_PU 4 -#define RES4315_PALDO_PU 5 -#define RES4315_ILP_REQUEST 6 -#define RES4315_LNLDO1_PU 9 -#define RES4315_OTP_PU 10 -#define RES4315_LNLDO2_PU 12 -#define RES4315_XTAL_PU 13 -#define RES4315_ALP_AVAIL 14 -#define RES4315_RX_PWRSW_PU 15 -#define RES4315_TX_PWRSW_PU 16 -#define RES4315_RFPLL_PWRSW_PU 17 -#define RES4315_LOGEN_PWRSW_PU 18 -#define RES4315_AFE_PWRSW_PU 19 -#define RES4315_BBPLL_PWRSW_PU 20 -#define RES4315_HT_AVAIL 21 - -#define CST4315_SPROM_OTP_SEL_MASK 0x00000003 -#define CST4315_DEFCIS_SEL 0x00000000 -#define CST4315_SPROM_SEL 0x00000001 -#define CST4315_OTP_SEL 0x00000002 -#define CST4315_OTP_PWRDN 0x00000003 -#define CST4315_SDIO_MODE 0x00000004 -#define CST4315_RCAL_VALID 0x00000008 -#define CST4315_RCAL_VALUE_MASK 0x000001f0 -#define CST4315_RCAL_VALUE_SHIFT 4 -#define CST4315_PALDO_EXTPNP 0x00000200 -#define CST4315_CBUCK_MODE_MASK 0x00000c00 -#define CST4315_CBUCK_MODE_BURST 0x00000400 -#define CST4315_CBUCK_MODE_LPBURST 0x00000c00 - -#define PMU_MAX_TRANSITION_DLY 15000 - - -#define PMURES_UP_TRANSITION 2 - - - - - -#define ECI_BW_20 0x0 -#define ECI_BW_25 0x1 -#define ECI_BW_30 0x2 -#define ECI_BW_35 0x3 -#define ECI_BW_40 0x4 -#define ECI_BW_45 0x5 -#define ECI_BW_50 0x6 -#define ECI_BW_ALL 0x7 - - -#define WLAN_NUM_ANT1 TXANT_0 -#define WLAN_NUM_ANT2 TXANT_1 - -#endif diff --git a/drivers/net/wireless/bcm4319/include/sbconfig.h b/drivers/net/wireless/bcm4319/include/sbconfig.h deleted file mode 100644 index da18ccbe9ab8..000000000000 --- a/drivers/net/wireless/bcm4319/include/sbconfig.h +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Broadcom SiliconBackplane hardware register definitions. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: sbconfig.h,v 13.67.30.1 2008/05/07 20:17:27 Exp $ - */ - - -#ifndef _SBCONFIG_H -#define _SBCONFIG_H - - -#ifndef PAD -#define _PADLINE(line) pad ## line -#define _XSTR(line) _PADLINE(line) -#define PAD _XSTR(__LINE__) -#endif - - -#define SB_BUS_SIZE 0x10000 -#define SB_BUS_BASE(b) (SI_ENUM_BASE + (b) * SB_BUS_SIZE) -#define SB_BUS_MAXCORES (SB_BUS_SIZE / SI_CORE_SIZE) - - -#define SBCONFIGOFF 0xf00 -#define SBCONFIGSIZE 256 - -#define SBIPSFLAG 0x08 -#define SBTPSFLAG 0x18 -#define SBTMERRLOGA 0x48 -#define SBTMERRLOG 0x50 -#define SBADMATCH3 0x60 -#define SBADMATCH2 0x68 -#define SBADMATCH1 0x70 -#define SBIMSTATE 0x90 -#define SBINTVEC 0x94 -#define SBTMSTATELOW 0x98 -#define SBTMSTATEHIGH 0x9c -#define SBBWA0 0xa0 -#define SBIMCONFIGLOW 0xa8 -#define SBIMCONFIGHIGH 0xac -#define SBADMATCH0 0xb0 -#define SBTMCONFIGLOW 0xb8 -#define SBTMCONFIGHIGH 0xbc -#define SBBCONFIG 0xc0 -#define SBBSTATE 0xc8 -#define SBACTCNFG 0xd8 -#define SBFLAGST 0xe8 -#define SBIDLOW 0xf8 -#define SBIDHIGH 0xfc - - - -#define SBIMERRLOGA 0xea8 -#define SBIMERRLOG 0xeb0 -#define SBTMPORTCONNID0 0xed8 -#define SBTMPORTLOCK0 0xef8 - -#ifndef _LANGUAGE_ASSEMBLY - -typedef volatile struct _sbconfig { - uint32 PAD[2]; - uint32 sbipsflag; - uint32 PAD[3]; - uint32 sbtpsflag; - uint32 PAD[11]; - uint32 sbtmerrloga; - uint32 PAD; - uint32 sbtmerrlog; - uint32 PAD[3]; - uint32 sbadmatch3; - uint32 PAD; - uint32 sbadmatch2; - uint32 PAD; - uint32 sbadmatch1; - uint32 PAD[7]; - uint32 sbimstate; - uint32 sbintvec; - uint32 sbtmstatelow; - uint32 sbtmstatehigh; - uint32 sbbwa0; - uint32 PAD; - uint32 sbimconfiglow; - uint32 sbimconfighigh; - uint32 sbadmatch0; - uint32 PAD; - uint32 sbtmconfiglow; - uint32 sbtmconfighigh; - uint32 sbbconfig; - uint32 PAD; - uint32 sbbstate; - uint32 PAD[3]; - uint32 sbactcnfg; - uint32 PAD[3]; - uint32 sbflagst; - uint32 PAD[3]; - uint32 sbidlow; - uint32 sbidhigh; -} sbconfig_t; - -#endif - - -#define SBIPS_INT1_MASK 0x3f -#define SBIPS_INT1_SHIFT 0 -#define SBIPS_INT2_MASK 0x3f00 -#define SBIPS_INT2_SHIFT 8 -#define SBIPS_INT3_MASK 0x3f0000 -#define SBIPS_INT3_SHIFT 16 -#define SBIPS_INT4_MASK 0x3f000000 -#define SBIPS_INT4_SHIFT 24 - - -#define SBTPS_NUM0_MASK 0x3f -#define SBTPS_F0EN0 0x40 - - -#define SBTMEL_CM 0x00000007 -#define SBTMEL_CI 0x0000ff00 -#define SBTMEL_EC 0x0f000000 -#define SBTMEL_ME 0x80000000 - - -#define SBIM_PC 0xf -#define SBIM_AP_MASK 0x30 -#define SBIM_AP_BOTH 0x00 -#define SBIM_AP_TS 0x10 -#define SBIM_AP_TK 0x20 -#define SBIM_AP_RSV 0x30 -#define SBIM_IBE 0x20000 -#define SBIM_TO 0x40000 -#define SBIM_BY 0x01800000 -#define SBIM_RJ 0x02000000 - - -#define SBTML_RESET 0x0001 -#define SBTML_REJ_MASK 0x0006 -#define SBTML_REJ 0x0002 -#define SBTML_TMPREJ 0x0004 - -#define SBTML_SICF_SHIFT 16 - - -#define SBTMH_SERR 0x0001 -#define SBTMH_INT 0x0002 -#define SBTMH_BUSY 0x0004 -#define SBTMH_TO 0x0020 - -#define SBTMH_SISF_SHIFT 16 - - -#define SBBWA_TAB0_MASK 0xffff -#define SBBWA_TAB1_MASK 0xffff -#define SBBWA_TAB1_SHIFT 16 - - -#define SBIMCL_STO_MASK 0x7 -#define SBIMCL_RTO_MASK 0x70 -#define SBIMCL_RTO_SHIFT 4 -#define SBIMCL_CID_MASK 0xff0000 -#define SBIMCL_CID_SHIFT 16 - - -#define SBIMCH_IEM_MASK 0xc -#define SBIMCH_TEM_MASK 0x30 -#define SBIMCH_TEM_SHIFT 4 -#define SBIMCH_BEM_MASK 0xc0 -#define SBIMCH_BEM_SHIFT 6 - - -#define SBAM_TYPE_MASK 0x3 -#define SBAM_AD64 0x4 -#define SBAM_ADINT0_MASK 0xf8 -#define SBAM_ADINT0_SHIFT 3 -#define SBAM_ADINT1_MASK 0x1f8 -#define SBAM_ADINT1_SHIFT 3 -#define SBAM_ADINT2_MASK 0x1f8 -#define SBAM_ADINT2_SHIFT 3 -#define SBAM_ADEN 0x400 -#define SBAM_ADNEG 0x800 -#define SBAM_BASE0_MASK 0xffffff00 -#define SBAM_BASE0_SHIFT 8 -#define SBAM_BASE1_MASK 0xfffff000 -#define SBAM_BASE1_SHIFT 12 -#define SBAM_BASE2_MASK 0xffff0000 -#define SBAM_BASE2_SHIFT 16 - - -#define SBTMCL_CD_MASK 0xff -#define SBTMCL_CO_MASK 0xf800 -#define SBTMCL_CO_SHIFT 11 -#define SBTMCL_IF_MASK 0xfc0000 -#define SBTMCL_IF_SHIFT 18 -#define SBTMCL_IM_MASK 0x3000000 -#define SBTMCL_IM_SHIFT 24 - - -#define SBTMCH_BM_MASK 0x3 -#define SBTMCH_RM_MASK 0x3 -#define SBTMCH_RM_SHIFT 2 -#define SBTMCH_SM_MASK 0x30 -#define SBTMCH_SM_SHIFT 4 -#define SBTMCH_EM_MASK 0x300 -#define SBTMCH_EM_SHIFT 8 -#define SBTMCH_IM_MASK 0xc00 -#define SBTMCH_IM_SHIFT 10 - - -#define SBBC_LAT_MASK 0x3 -#define SBBC_MAX0_MASK 0xf0000 -#define SBBC_MAX0_SHIFT 16 -#define SBBC_MAX1_MASK 0xf00000 -#define SBBC_MAX1_SHIFT 20 - - -#define SBBS_SRD 0x1 -#define SBBS_HRD 0x2 - - -#define SBIDL_CS_MASK 0x3 -#define SBIDL_AR_MASK 0x38 -#define SBIDL_AR_SHIFT 3 -#define SBIDL_SYNCH 0x40 -#define SBIDL_INIT 0x80 -#define SBIDL_MINLAT_MASK 0xf00 -#define SBIDL_MINLAT_SHIFT 8 -#define SBIDL_MAXLAT 0xf000 -#define SBIDL_MAXLAT_SHIFT 12 -#define SBIDL_FIRST 0x10000 -#define SBIDL_CW_MASK 0xc0000 -#define SBIDL_CW_SHIFT 18 -#define SBIDL_TP_MASK 0xf00000 -#define SBIDL_TP_SHIFT 20 -#define SBIDL_IP_MASK 0xf000000 -#define SBIDL_IP_SHIFT 24 -#define SBIDL_RV_MASK 0xf0000000 -#define SBIDL_RV_SHIFT 28 -#define SBIDL_RV_2_2 0x00000000 -#define SBIDL_RV_2_3 0x10000000 - - -#define SBIDH_RC_MASK 0x000f -#define SBIDH_RCE_MASK 0x7000 -#define SBIDH_RCE_SHIFT 8 -#define SBCOREREV(sbidh) \ - ((((sbidh) & SBIDH_RCE_MASK) >> SBIDH_RCE_SHIFT) | ((sbidh) & SBIDH_RC_MASK)) -#define SBIDH_CC_MASK 0x8ff0 -#define SBIDH_CC_SHIFT 4 -#define SBIDH_VC_MASK 0xffff0000 -#define SBIDH_VC_SHIFT 16 - -#define SB_COMMIT 0xfd8 - - -#define SB_VEND_BCM 0x4243 - -#endif diff --git a/drivers/net/wireless/bcm4319/include/sbhnddma.h b/drivers/net/wireless/bcm4319/include/sbhnddma.h deleted file mode 100644 index 7681395f5b3b..000000000000 --- a/drivers/net/wireless/bcm4319/include/sbhnddma.h +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Generic Broadcom Home Networking Division (HND) DMA engine HW interface - * This supports the following chips: BCM42xx, 44xx, 47xx . - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: sbhnddma.h,v 13.11.250.5.16.1 2009/07/21 14:04:51 Exp $ - */ - - -#ifndef _sbhnddma_h_ -#define _sbhnddma_h_ - - - - - - - -typedef volatile struct { - uint32 control; - uint32 addr; - uint32 ptr; - uint32 status; -} dma32regs_t; - -typedef volatile struct { - dma32regs_t xmt; - dma32regs_t rcv; -} dma32regp_t; - -typedef volatile struct { - uint32 fifoaddr; - uint32 fifodatalow; - uint32 fifodatahigh; - uint32 pad; -} dma32diag_t; - - -typedef volatile struct { - uint32 ctrl; - uint32 addr; -} dma32dd_t; - - -#define D32RINGALIGN_BITS 12 -#define D32MAXRINGSZ (1 << D32RINGALIGN_BITS) -#define D32RINGALIGN (1 << D32RINGALIGN_BITS) -#define D32MAXDD (D32MAXRINGSZ / sizeof (dma32dd_t)) - - -#define XC_XE ((uint32)1 << 0) -#define XC_SE ((uint32)1 << 1) -#define XC_LE ((uint32)1 << 2) -#define XC_FL ((uint32)1 << 4) -#define XC_PD ((uint32)1 << 11) -#define XC_AE ((uint32)3 << 16) -#define XC_AE_SHIFT 16 - - -#define XP_LD_MASK 0xfff - - -#define XS_CD_MASK 0x0fff -#define XS_XS_MASK 0xf000 -#define XS_XS_SHIFT 12 -#define XS_XS_DISABLED 0x0000 -#define XS_XS_ACTIVE 0x1000 -#define XS_XS_IDLE 0x2000 -#define XS_XS_STOPPED 0x3000 -#define XS_XS_SUSP 0x4000 -#define XS_XE_MASK 0xf0000 -#define XS_XE_SHIFT 16 -#define XS_XE_NOERR 0x00000 -#define XS_XE_DPE 0x10000 -#define XS_XE_DFU 0x20000 -#define XS_XE_BEBR 0x30000 -#define XS_XE_BEDA 0x40000 -#define XS_AD_MASK 0xfff00000 -#define XS_AD_SHIFT 20 - - -#define RC_RE ((uint32)1 << 0) -#define RC_RO_MASK 0xfe -#define RC_RO_SHIFT 1 -#define RC_FM ((uint32)1 << 8) -#define RC_SH ((uint32)1 << 9) -#define RC_OC ((uint32)1 << 10) -#define RC_PD ((uint32)1 << 11) -#define RC_AE ((uint32)3 << 16) -#define RC_AE_SHIFT 16 - - -#define RP_LD_MASK 0xfff - - -#define RS_CD_MASK 0x0fff -#define RS_RS_MASK 0xf000 -#define RS_RS_SHIFT 12 -#define RS_RS_DISABLED 0x0000 -#define RS_RS_ACTIVE 0x1000 -#define RS_RS_IDLE 0x2000 -#define RS_RS_STOPPED 0x3000 -#define RS_RE_MASK 0xf0000 -#define RS_RE_SHIFT 16 -#define RS_RE_NOERR 0x00000 -#define RS_RE_DPE 0x10000 -#define RS_RE_DFO 0x20000 -#define RS_RE_BEBW 0x30000 -#define RS_RE_BEDA 0x40000 -#define RS_AD_MASK 0xfff00000 -#define RS_AD_SHIFT 20 - - -#define FA_OFF_MASK 0xffff -#define FA_SEL_MASK 0xf0000 -#define FA_SEL_SHIFT 16 -#define FA_SEL_XDD 0x00000 -#define FA_SEL_XDP 0x10000 -#define FA_SEL_RDD 0x40000 -#define FA_SEL_RDP 0x50000 -#define FA_SEL_XFD 0x80000 -#define FA_SEL_XFP 0x90000 -#define FA_SEL_RFD 0xc0000 -#define FA_SEL_RFP 0xd0000 -#define FA_SEL_RSD 0xe0000 -#define FA_SEL_RSP 0xf0000 - - -#define CTRL_BC_MASK 0x1fff -#define CTRL_AE ((uint32)3 << 16) -#define CTRL_AE_SHIFT 16 -#define CTRL_EOT ((uint32)1 << 28) -#define CTRL_IOC ((uint32)1 << 29) -#define CTRL_EOF ((uint32)1 << 30) -#define CTRL_SOF ((uint32)1 << 31) - - -#define CTRL_CORE_MASK 0x0ff00000 - - - - -typedef volatile struct { - uint32 control; - uint32 ptr; - uint32 addrlow; - uint32 addrhigh; - uint32 status0; - uint32 status1; -} dma64regs_t; - -typedef volatile struct { - dma64regs_t tx; - dma64regs_t rx; -} dma64regp_t; - -typedef volatile struct { - uint32 fifoaddr; - uint32 fifodatalow; - uint32 fifodatahigh; - uint32 pad; -} dma64diag_t; - - -typedef volatile struct { - uint32 ctrl1; - uint32 ctrl2; - uint32 addrlow; - uint32 addrhigh; -} dma64dd_t; - - -#define D64RINGALIGN_BITS 13 -#define D64MAXRINGSZ (1 << D64RINGALIGN_BITS) -#define D64RINGALIGN (1 << D64RINGALIGN_BITS) -#define D64MAXDD (D64MAXRINGSZ / sizeof (dma64dd_t)) - - -#define D64_XC_XE 0x00000001 -#define D64_XC_SE 0x00000002 -#define D64_XC_LE 0x00000004 -#define D64_XC_FL 0x00000010 -#define D64_XC_PD 0x00000800 -#define D64_XC_AE 0x00030000 -#define D64_XC_AE_SHIFT 16 - - -#define D64_XP_LD_MASK 0x00000fff - - -#define D64_XS0_CD_MASK 0x00001fff -#define D64_XS0_XS_MASK 0xf0000000 -#define D64_XS0_XS_SHIFT 28 -#define D64_XS0_XS_DISABLED 0x00000000 -#define D64_XS0_XS_ACTIVE 0x10000000 -#define D64_XS0_XS_IDLE 0x20000000 -#define D64_XS0_XS_STOPPED 0x30000000 -#define D64_XS0_XS_SUSP 0x40000000 - -#define D64_XS1_AD_MASK 0x0001ffff -#define D64_XS1_XE_MASK 0xf0000000 -#define D64_XS1_XE_SHIFT 28 -#define D64_XS1_XE_NOERR 0x00000000 -#define D64_XS1_XE_DPE 0x10000000 -#define D64_XS1_XE_DFU 0x20000000 -#define D64_XS1_XE_DTE 0x30000000 -#define D64_XS1_XE_DESRE 0x40000000 -#define D64_XS1_XE_COREE 0x50000000 - - -#define D64_RC_RE 0x00000001 -#define D64_RC_RO_MASK 0x000000fe -#define D64_RC_RO_SHIFT 1 -#define D64_RC_FM 0x00000100 -#define D64_RC_SH 0x00000200 -#define D64_RC_OC 0x00000400 -#define D64_RC_PD 0x00000800 -#define D64_RC_AE 0x00030000 -#define D64_RC_AE_SHIFT 16 - - -#define D64_RP_LD_MASK 0x00000fff - - -#define D64_RS0_CD_MASK 0x00001fff -#define D64_RS0_RS_MASK 0xf0000000 -#define D64_RS0_RS_SHIFT 28 -#define D64_RS0_RS_DISABLED 0x00000000 -#define D64_RS0_RS_ACTIVE 0x10000000 -#define D64_RS0_RS_IDLE 0x20000000 -#define D64_RS0_RS_STOPPED 0x30000000 -#define D64_RS0_RS_SUSP 0x40000000 - -#define D64_RS1_AD_MASK 0x0001ffff -#define D64_RS1_RE_MASK 0xf0000000 -#define D64_RS1_RE_SHIFT 28 -#define D64_RS1_RE_NOERR 0x00000000 -#define D64_RS1_RE_DPO 0x10000000 -#define D64_RS1_RE_DFU 0x20000000 -#define D64_RS1_RE_DTE 0x30000000 -#define D64_RS1_RE_DESRE 0x40000000 -#define D64_RS1_RE_COREE 0x50000000 - - -#define D64_FA_OFF_MASK 0xffff -#define D64_FA_SEL_MASK 0xf0000 -#define D64_FA_SEL_SHIFT 16 -#define D64_FA_SEL_XDD 0x00000 -#define D64_FA_SEL_XDP 0x10000 -#define D64_FA_SEL_RDD 0x40000 -#define D64_FA_SEL_RDP 0x50000 -#define D64_FA_SEL_XFD 0x80000 -#define D64_FA_SEL_XFP 0x90000 -#define D64_FA_SEL_RFD 0xc0000 -#define D64_FA_SEL_RFP 0xd0000 -#define D64_FA_SEL_RSD 0xe0000 -#define D64_FA_SEL_RSP 0xf0000 - - -#define D64_CTRL1_EOT ((uint32)1 << 28) -#define D64_CTRL1_IOC ((uint32)1 << 29) -#define D64_CTRL1_EOF ((uint32)1 << 30) -#define D64_CTRL1_SOF ((uint32)1 << 31) - - -#define D64_CTRL2_BC_MASK 0x00007fff -#define D64_CTRL2_AE 0x00030000 -#define D64_CTRL2_AE_SHIFT 16 -#define D64_CTRL2_PARITY 0x00040000 - - -#define D64_CTRL_CORE_MASK 0x0ff00000 - - -#endif diff --git a/drivers/net/wireless/bcm4319/include/sbpcmcia.h b/drivers/net/wireless/bcm4319/include/sbpcmcia.h deleted file mode 100644 index d6d80334258a..000000000000 --- a/drivers/net/wireless/bcm4319/include/sbpcmcia.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * BCM43XX Sonics SiliconBackplane PCMCIA core hardware definitions. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: sbpcmcia.h,v 13.31.4.1.2.3.8.7 2009/06/22 05:14:24 Exp $ - */ - - -#ifndef _SBPCMCIA_H -#define _SBPCMCIA_H - - - - -#define PCMCIA_FCR (0x700 / 2) - -#define FCR0_OFF 0 -#define FCR1_OFF (0x40 / 2) -#define FCR2_OFF (0x80 / 2) -#define FCR3_OFF (0xc0 / 2) - -#define PCMCIA_FCR0 (0x700 / 2) -#define PCMCIA_FCR1 (0x740 / 2) -#define PCMCIA_FCR2 (0x780 / 2) -#define PCMCIA_FCR3 (0x7c0 / 2) - - - -#define PCMCIA_COR 0 - -#define COR_RST 0x80 -#define COR_LEV 0x40 -#define COR_IRQEN 0x04 -#define COR_BLREN 0x01 -#define COR_FUNEN 0x01 - - -#define PCICIA_FCSR (2 / 2) -#define PCICIA_PRR (4 / 2) -#define PCICIA_SCR (6 / 2) -#define PCICIA_ESR (8 / 2) - - -#define PCM_MEMOFF 0x0000 -#define F0_MEMOFF 0x1000 -#define F1_MEMOFF 0x2000 -#define F2_MEMOFF 0x3000 -#define F3_MEMOFF 0x4000 - - -#define MEM_ADDR0 (0x728 / 2) -#define MEM_ADDR1 (0x72a / 2) -#define MEM_ADDR2 (0x72c / 2) - - -#define PCMCIA_ADDR0 (0x072e / 2) -#define PCMCIA_ADDR1 (0x0730 / 2) -#define PCMCIA_ADDR2 (0x0732 / 2) - -#define MEM_SEG (0x0734 / 2) -#define SROM_CS (0x0736 / 2) -#define SROM_DATAL (0x0738 / 2) -#define SROM_DATAH (0x073a / 2) -#define SROM_ADDRL (0x073c / 2) -#define SROM_ADDRH (0x073e / 2) -#define SROM_INFO2 (0x0772 / 2) -#define SROM_INFO (0x07be / 2) - - -#define SROM_IDLE 0 -#define SROM_WRITE 1 -#define SROM_READ 2 -#define SROM_WEN 4 -#define SROM_WDS 7 -#define SROM_DONE 8 - - -#define SRI_SZ_MASK 0x03 -#define SRI_BLANK 0x04 -#define SRI_OTP 0x80 - - - -#define SBTML_INT_ACK 0x40000 -#define SBTML_INT_EN 0x20000 - - -#define SBTMH_INT_STATUS 0x40000 - -#endif diff --git a/drivers/net/wireless/bcm4319/include/sbsdio.h b/drivers/net/wireless/bcm4319/include/sbsdio.h deleted file mode 100644 index 75aaf4d88f7d..000000000000 --- a/drivers/net/wireless/bcm4319/include/sbsdio.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * SDIO device core hardware definitions. - * sdio is a portion of the pcmcia core in core rev 3 - rev 8 - * - * SDIO core support 1bit, 4 bit SDIO mode as well as SPI mode. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: sbsdio.h,v 13.29.4.1.22.3 2009/03/11 20:26:57 Exp $ - */ - -#ifndef _SBSDIO_H -#define _SBSDIO_H - -#define SBSDIO_NUM_FUNCTION 3 /* as of sdiod rev 0, supports 3 functions */ - -/* function 1 miscellaneous registers */ -#define SBSDIO_SPROM_CS 0x10000 /* sprom command and status */ -#define SBSDIO_SPROM_INFO 0x10001 /* sprom info register */ -#define SBSDIO_SPROM_DATA_LOW 0x10002 /* sprom indirect access data byte 0 */ -#define SBSDIO_SPROM_DATA_HIGH 0x10003 /* sprom indirect access data byte 1 */ -#define SBSDIO_SPROM_ADDR_LOW 0x10004 /* sprom indirect access addr byte 0 */ -#define SBSDIO_SPROM_ADDR_HIGH 0x10005 /* sprom indirect access addr byte 0 */ -#define SBSDIO_CHIP_CTRL_DATA 0x10006 /* xtal_pu (gpio) output */ -#define SBSDIO_CHIP_CTRL_EN 0x10007 /* xtal_pu (gpio) enable */ -#define SBSDIO_WATERMARK 0x10008 /* rev < 7, watermark for sdio device */ -#define SBSDIO_DEVICE_CTL 0x10009 /* control busy signal generation */ - -/* registers introduced in rev 8, some content (mask/bits) defs in sbsdpcmdev.h */ -#define SBSDIO_FUNC1_SBADDRLOW 0x1000A /* SB Address Window Low (b15) */ -#define SBSDIO_FUNC1_SBADDRMID 0x1000B /* SB Address Window Mid (b23:b16) */ -#define SBSDIO_FUNC1_SBADDRHIGH 0x1000C /* SB Address Window High (b31:b24) */ -#define SBSDIO_FUNC1_FRAMECTRL 0x1000D /* Frame Control (frame term/abort) */ -#define SBSDIO_FUNC1_CHIPCLKCSR 0x1000E /* ChipClockCSR (ALP/HT ctl/status) */ -#define SBSDIO_FUNC1_SDIOPULLUP 0x1000F /* SdioPullUp (on cmd, d0-d2) */ -#define SBSDIO_FUNC1_WFRAMEBCLO 0x10019 /* Write Frame Byte Count Low */ -#define SBSDIO_FUNC1_WFRAMEBCHI 0x1001A /* Write Frame Byte Count High */ -#define SBSDIO_FUNC1_RFRAMEBCLO 0x1001B /* Read Frame Byte Count Low */ -#define SBSDIO_FUNC1_RFRAMEBCHI 0x1001C /* Read Frame Byte Count High */ - -#define SBSDIO_FUNC1_MISC_REG_START 0x10000 /* f1 misc register start */ -#define SBSDIO_FUNC1_MISC_REG_LIMIT 0x1001C /* f1 misc register end */ - -/* SBSDIO_SPROM_CS */ -#define SBSDIO_SPROM_IDLE 0 -#define SBSDIO_SPROM_WRITE 1 -#define SBSDIO_SPROM_READ 2 -#define SBSDIO_SPROM_WEN 4 -#define SBSDIO_SPROM_WDS 7 -#define SBSDIO_SPROM_DONE 8 - -/* SBSDIO_SPROM_INFO */ -#define SROM_SZ_MASK 0x03 /* SROM size, 1: 4k, 2: 16k */ -#define SROM_BLANK 0x04 /* depreciated in corerev 6 */ -#define SROM_OTP 0x80 /* OTP present */ - -/* SBSDIO_CHIP_CTRL */ -#define SBSDIO_CHIP_CTRL_XTAL 0x01 /* or'd with onchip xtal_pu, - * 1: power on oscillator - * (for 4318 only) - */ -/* SBSDIO_WATERMARK */ -#define SBSDIO_WATERMARK_MASK 0x7f /* number of words - 1 for sd device - * to wait before sending data to host - */ - -/* SBSDIO_DEVICE_CTL */ -#define SBSDIO_DEVCTL_SETBUSY 0x01 /* 1: device will assert busy signal when - * receiving CMD53 - */ -#define SBSDIO_DEVCTL_SPI_INTR_SYNC 0x02 /* 1: assertion of sdio interrupt is - * synchronous to the sdio clock - */ -#define SBSDIO_DEVCTL_CA_INT_ONLY 0x04 /* 1: mask all interrupts to host - * except the chipActive (rev 8) - */ -#define SBSDIO_DEVCTL_PADS_ISO 0x08 /* 1: isolate internal sdio signals, put - * external pads in tri-state; requires - * sdio bus power cycle to clear (rev 9) - */ -#define SBSDIO_DEVCTL_SB_RST_CTL 0x30 /* Force SD->SB reset mapping (rev 11) */ -#define SBSDIO_DEVCTL_RST_CORECTL 0x00 /* Determined by CoreControl bit */ -#define SBSDIO_DEVCTL_RST_BPRESET 0x10 /* Force backplane reset */ -#define SBSDIO_DEVCTL_RST_NOBPRESET 0x20 /* Force no backplane reset */ - - -/* SBSDIO_FUNC1_CHIPCLKCSR */ -#define SBSDIO_FORCE_ALP 0x01 /* Force ALP request to backplane */ -#define SBSDIO_FORCE_HT 0x02 /* Force HT request to backplane */ -#define SBSDIO_FORCE_ILP 0x04 /* Force ILP request to backplane */ -#define SBSDIO_ALP_AVAIL_REQ 0x08 /* Make ALP ready (power up xtal) */ -#define SBSDIO_HT_AVAIL_REQ 0x10 /* Make HT ready (power up PLL) */ -#define SBSDIO_FORCE_HW_CLKREQ_OFF 0x20 /* Squelch clock requests from HW */ -#define SBSDIO_ALP_AVAIL 0x40 /* Status: ALP is ready */ -#define SBSDIO_HT_AVAIL 0x80 /* Status: HT is ready */ -/* In rev8, actual avail bits followed original docs */ -#define SBSDIO_Rev8_HT_AVAIL 0x40 -#define SBSDIO_Rev8_ALP_AVAIL 0x80 - -#define SBSDIO_AVBITS (SBSDIO_HT_AVAIL | SBSDIO_ALP_AVAIL) -#define SBSDIO_ALPAV(regval) ((regval) & SBSDIO_AVBITS) -#define SBSDIO_HTAV(regval) (((regval) & SBSDIO_AVBITS) == SBSDIO_AVBITS) -#define SBSDIO_ALPONLY(regval) (SBSDIO_ALPAV(regval) && !SBSDIO_HTAV(regval)) -#define SBSDIO_CLKAV(regval, alponly) (SBSDIO_ALPAV(regval) && \ - (alponly ? 1 : SBSDIO_HTAV(regval))) - -/* SBSDIO_FUNC1_SDIOPULLUP */ -#define SBSDIO_PULLUP_D0 0x01 /* Enable D0/MISO pullup */ -#define SBSDIO_PULLUP_D1 0x02 /* Enable D1/INT# pullup */ -#define SBSDIO_PULLUP_D2 0x04 /* Enable D2 pullup */ -#define SBSDIO_PULLUP_CMD 0x08 /* Enable CMD/MOSI pullup */ -#define SBSDIO_PULLUP_ALL 0x0f /* All valid bits */ - -/* function 1 OCP space */ -#define SBSDIO_SB_OFT_ADDR_MASK 0x07FFF /* sb offset addr is <= 15 bits, 32k */ -#define SBSDIO_SB_OFT_ADDR_LIMIT 0x08000 -#define SBSDIO_SB_ACCESS_2_4B_FLAG 0x08000 /* with b15, maps to 32-bit SB access */ - -/* some duplication with sbsdpcmdev.h here */ -/* valid bits in SBSDIO_FUNC1_SBADDRxxx regs */ -#define SBSDIO_SBADDRLOW_MASK 0x80 /* Valid bits in SBADDRLOW */ -#define SBSDIO_SBADDRMID_MASK 0xff /* Valid bits in SBADDRMID */ -#define SBSDIO_SBADDRHIGH_MASK 0xffU /* Valid bits in SBADDRHIGH */ -#define SBSDIO_SBWINDOW_MASK 0xffff8000 /* Address bits from SBADDR regs */ - -/* direct(mapped) cis space */ -#define SBSDIO_CIS_BASE_COMMON 0x1000 /* MAPPED common CIS address */ -#define SBSDIO_CIS_SIZE_LIMIT 0x200 /* maximum bytes in one CIS */ -#define SBSDIO_OTP_CIS_SIZE_LIMIT 0x078 /* maximum bytes OTP CIS */ - -#define SBSDIO_CIS_OFT_ADDR_MASK 0x1FFFF /* cis offset addr is < 17 bits */ - -#define SBSDIO_CIS_MANFID_TUPLE_LEN 6 /* manfid tuple length, include tuple, - * link bytes - */ - -/* indirect cis access (in sprom) */ -#define SBSDIO_SPROM_CIS_OFFSET 0x8 /* 8 control bytes first, CIS starts from - * 8th byte - */ - -#define SBSDIO_BYTEMODE_DATALEN_MAX 64 /* sdio byte mode: maximum length of one - * data comamnd - */ - -#define SBSDIO_CORE_ADDR_MASK 0x1FFFF /* sdio core function one address mask */ - -#endif /* _SBSDIO_H */ diff --git a/drivers/net/wireless/bcm4319/include/sbsdpcmdev.h b/drivers/net/wireless/bcm4319/include/sbsdpcmdev.h deleted file mode 100644 index 7c7c7e4de0f6..000000000000 --- a/drivers/net/wireless/bcm4319/include/sbsdpcmdev.h +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Broadcom SiliconBackplane SDIO/PCMCIA hardware-specific device core support - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: sbsdpcmdev.h,v 13.29.4.1.4.6.6.2 2008/12/31 21:16:51 Exp $ - */ - -#ifndef _sbsdpcmdev_h_ -#define _sbsdpcmdev_h_ - -/* cpp contortions to concatenate w/arg prescan */ -#ifndef PAD -#define _PADLINE(line) pad ## line -#define _XSTR(line) _PADLINE(line) -#define PAD _XSTR(__LINE__) -#endif /* PAD */ - - -typedef volatile struct { - dma64regs_t xmt; /* dma tx */ - uint32 PAD[2]; - dma64regs_t rcv; /* dma rx */ - uint32 PAD[2]; -} dma64p_t; - -/* dma64 sdiod corerev >= 1 */ -typedef volatile struct { - dma64p_t dma64regs[2]; - dma64diag_t dmafifo; /* DMA Diagnostic Regs, 0x280-0x28c */ - uint32 PAD[92]; -} sdiodma64_t; - -/* dma32 sdiod corerev == 0 */ -typedef volatile struct { - dma32regp_t dma32regs[2]; /* dma tx & rx, 0x200-0x23c */ - dma32diag_t dmafifo; /* DMA Diagnostic Regs, 0x240-0x24c */ - uint32 PAD[108]; -} sdiodma32_t; - -/* dma32 regs for pcmcia core */ -typedef volatile struct { - dma32regp_t dmaregs; /* DMA Regs, 0x200-0x21c, rev8 */ - dma32diag_t dmafifo; /* DMA Diagnostic Regs, 0x220-0x22c */ - uint32 PAD[116]; -} pcmdma32_t; - -/* core registers */ -typedef volatile struct { - uint32 corecontrol; /* CoreControl, 0x000, rev8 */ - uint32 corestatus; /* CoreStatus, 0x004, rev8 */ - uint32 PAD[1]; - uint32 biststatus; /* BistStatus, 0x00c, rev8 */ - - /* PCMCIA access */ - uint16 pcmciamesportaladdr; /* PcmciaMesPortalAddr, 0x010, rev8 */ - uint16 PAD[1]; - uint16 pcmciamesportalmask; /* PcmciaMesPortalMask, 0x014, rev8 */ - uint16 PAD[1]; - uint16 pcmciawrframebc; /* PcmciaWrFrameBC, 0x018, rev8 */ - uint16 PAD[1]; - uint16 pcmciaunderflowtimer; /* PcmciaUnderflowTimer, 0x01c, rev8 */ - uint16 PAD[1]; - - /* interrupt */ - uint32 intstatus; /* IntStatus, 0x020, rev8 */ - uint32 hostintmask; /* IntHostMask, 0x024, rev8 */ - uint32 intmask; /* IntSbMask, 0x028, rev8 */ - uint32 sbintstatus; /* SBIntStatus, 0x02c, rev8 */ - uint32 sbintmask; /* SBIntMask, 0x030, rev8 */ - uint32 PAD[3]; - uint32 tosbmailbox; /* ToSBMailbox, 0x040, rev8 */ - uint32 tohostmailbox; /* ToHostMailbox, 0x044, rev8 */ - uint32 tosbmailboxdata; /* ToSbMailboxData, 0x048, rev8 */ - uint32 tohostmailboxdata; /* ToHostMailboxData, 0x04c, rev8 */ - - /* synchronized access to registers in SDIO clock domain */ - uint32 sdioaccess; /* SdioAccess, 0x050, rev8 */ - uint32 PAD[3]; - - /* PCMCIA frame control */ - uint8 pcmciaframectrl; /* pcmciaFrameCtrl, 0x060, rev8 */ - uint8 PAD[3]; - uint8 pcmciawatermark; /* pcmciaWaterMark, 0x064, rev8 */ - uint8 PAD[155]; - - /* interrupt batching control */ - uint32 intrcvlazy; /* IntRcvLazy, 0x100, rev8 */ - uint32 PAD[3]; - - /* counters */ - uint32 cmd52rd; /* Cmd52RdCount, 0x110, rev8, SDIO: cmd52 reads */ - uint32 cmd52wr; /* Cmd52WrCount, 0x114, rev8, SDIO: cmd52 writes */ - uint32 cmd53rd; /* Cmd53RdCount, 0x118, rev8, SDIO: cmd53 reads */ - uint32 cmd53wr; /* Cmd53WrCount, 0x11c, rev8, SDIO: cmd53 writes */ - uint32 abort; /* AbortCount, 0x120, rev8, SDIO: aborts */ - uint32 datacrcerror; /* DataCrcErrorCount, 0x124, rev8, SDIO: frames w/bad CRC */ - uint32 rdoutofsync; /* RdOutOfSyncCount, 0x128, rev8, SDIO/PCMCIA: Rd Frm OOS */ - uint32 wroutofsync; /* RdOutOfSyncCount, 0x12c, rev8, SDIO/PCMCIA: Wr Frm OOS */ - uint32 writebusy; /* WriteBusyCount, 0x130, rev8, SDIO: dev asserted "busy" */ - uint32 readwait; /* ReadWaitCount, 0x134, rev8, SDIO: read: no data avail */ - uint32 readterm; /* ReadTermCount, 0x138, rev8, SDIO: rd frm terminates */ - uint32 writeterm; /* WriteTermCount, 0x13c, rev8, SDIO: wr frm terminates */ - uint32 PAD[40]; - uint32 clockctlstatus; /* ClockCtlStatus, 0x1e0, rev8 */ - uint32 PAD[7]; - - /* DMA engines */ - volatile union { - pcmdma32_t pcm32; - sdiodma32_t sdiod32; - sdiodma64_t sdiod64; - } dma; - - /* SDIO/PCMCIA CIS region */ - char cis[512]; /* 512 byte CIS, 0x400-0x5ff, rev6 */ - - /* PCMCIA function control registers */ - char pcmciafcr[256]; /* PCMCIA FCR, 0x600-6ff, rev6 */ - uint16 PAD[55]; - - /* PCMCIA backplane access */ - uint16 backplanecsr; /* BackplaneCSR, 0x76E, rev6 */ - uint16 backplaneaddr0; /* BackplaneAddr0, 0x770, rev6 */ - uint16 backplaneaddr1; /* BackplaneAddr1, 0x772, rev6 */ - uint16 backplaneaddr2; /* BackplaneAddr2, 0x774, rev6 */ - uint16 backplaneaddr3; /* BackplaneAddr3, 0x776, rev6 */ - uint16 backplanedata0; /* BackplaneData0, 0x778, rev6 */ - uint16 backplanedata1; /* BackplaneData1, 0x77a, rev6 */ - uint16 backplanedata2; /* BackplaneData2, 0x77c, rev6 */ - uint16 backplanedata3; /* BackplaneData3, 0x77e, rev6 */ - uint16 PAD[31]; - - /* sprom "size" & "blank" info */ - uint16 spromstatus; /* SPROMStatus, 0x7BE, rev2 */ - uint32 PAD[464]; - - /* Sonics SiliconBackplane registers */ - sbconfig_t sbconfig; /* SbConfig Regs, 0xf00-0xfff, rev8 */ -} sdpcmd_regs_t; - -/* corecontrol */ -#define CC_CISRDY (1 << 0) /* CIS Ready */ -#define CC_BPRESEN (1 << 1) /* CCCR RES signal causes backplane reset */ -#define CC_F2RDY (1 << 2) /* set CCCR IOR2 bit */ -#define CC_CLRPADSISO (1 << 3) /* clear SDIO pads isolation bit (rev 11) */ - -/* corestatus */ -#define CS_PCMCIAMODE (1 << 0) /* Device Mode; 0=SDIO, 1=PCMCIA */ -#define CS_SMARTDEV (1 << 1) /* 1=smartDev enabled */ -#define CS_F2ENABLED (1 << 2) /* 1=host has enabled the device */ - -#define PCMCIA_MES_PA_MASK 0x7fff /* PCMCIA Message Portal Address Mask */ -#define PCMCIA_MES_PM_MASK 0x7fff /* PCMCIA Message Portal Mask Mask */ -#define PCMCIA_WFBC_MASK 0xffff /* PCMCIA Write Frame Byte Count Mask */ -#define PCMCIA_UT_MASK 0x07ff /* PCMCIA Underflow Timer Mask */ - -/* intstatus */ -#define I_SMB_SW0 (1 << 0) /* To SB Mail S/W interrupt 0 */ -#define I_SMB_SW1 (1 << 1) /* To SB Mail S/W interrupt 1 */ -#define I_SMB_SW2 (1 << 2) /* To SB Mail S/W interrupt 2 */ -#define I_SMB_SW3 (1 << 3) /* To SB Mail S/W interrupt 3 */ -#define I_SMB_SW_MASK 0x0000000f /* To SB Mail S/W interrupts mask */ -#define I_SMB_SW_SHIFT 0 /* To SB Mail S/W interrupts shift */ -#define I_HMB_SW0 (1 << 4) /* To Host Mail S/W interrupt 0 */ -#define I_HMB_SW1 (1 << 5) /* To Host Mail S/W interrupt 1 */ -#define I_HMB_SW2 (1 << 6) /* To Host Mail S/W interrupt 2 */ -#define I_HMB_SW3 (1 << 7) /* To Host Mail S/W interrupt 3 */ -#define I_HMB_SW_MASK 0x000000f0 /* To Host Mail S/W interrupts mask */ -#define I_HMB_SW_SHIFT 4 /* To Host Mail S/W interrupts shift */ -#define I_WR_OOSYNC (1 << 8) /* Write Frame Out Of Sync */ -#define I_RD_OOSYNC (1 << 9) /* Read Frame Out Of Sync */ -#define I_PC (1 << 10) /* descriptor error */ -#define I_PD (1 << 11) /* data error */ -#define I_DE (1 << 12) /* Descriptor protocol Error */ -#define I_RU (1 << 13) /* Receive descriptor Underflow */ -#define I_RO (1 << 14) /* Receive fifo Overflow */ -#define I_XU (1 << 15) /* Transmit fifo Underflow */ -#define I_RI (1 << 16) /* Receive Interrupt */ -#define I_BUSPWR (1 << 17) /* SDIO Bus Power Change (rev 9) */ -#define I_XI (1 << 24) /* Transmit Interrupt */ -#define I_RF_TERM (1 << 25) /* Read Frame Terminate */ -#define I_WF_TERM (1 << 26) /* Write Frame Terminate */ -#define I_PCMCIA_XU (1 << 27) /* PCMCIA Transmit FIFO Underflow */ -#define I_SBINT (1 << 28) /* sbintstatus Interrupt */ -#define I_CHIPACTIVE (1 << 29) /* chip transitioned from doze to active state */ -#define I_SRESET (1 << 30) /* CCCR RES interrupt */ -#define I_IOE2 (1U << 31) /* CCCR IOE2 Bit Changed */ -#define I_ERRORS (I_PC | I_PD | I_DE | I_RU | I_RO | I_XU) /* DMA Errors */ -#define I_DMA (I_RI | I_XI | I_ERRORS) - -/* sbintstatus */ -#define I_SB_SERR (1 << 8) /* Backplane SError (write) */ -#define I_SB_RESPERR (1 << 9) /* Backplane Response Error (read) */ -#define I_SB_SPROMERR (1 << 10) /* Error accessing the sprom */ - -/* sdioaccess */ -#define SDA_DATA_MASK 0x000000ff /* Read/Write Data Mask */ -#define SDA_ADDR_MASK 0x000fff00 /* Read/Write Address Mask */ -#define SDA_ADDR_SHIFT 8 /* Read/Write Address Shift */ -#define SDA_WRITE 0x01000000 /* Write bit */ -#define SDA_READ 0x00000000 /* Write bit cleared for Read */ -#define SDA_BUSY 0x80000000 /* Busy bit */ - -/* sdioaccess-accessible register address spaces */ -#define SDA_CCCR_SPACE 0x000 /* sdioAccess CCCR register space */ -#define SDA_F1_FBR_SPACE 0x100 /* sdioAccess F1 FBR register space */ -#define SDA_F2_FBR_SPACE 0x200 /* sdioAccess F2 FBR register space */ -#define SDA_F1_REG_SPACE 0x300 /* sdioAccess F1 core-specific register space */ - -/* SDA_F1_REG_SPACE sdioaccess-accessible F1 reg space register offsets */ -#define SDA_CHIPCONTROLDATA 0x006 /* ChipControlData */ -#define SDA_CHIPCONTROLENAB 0x007 /* ChipControlEnable */ -#define SDA_F2WATERMARK 0x008 /* Function 2 Watermark */ -#define SDA_DEVICECONTROL 0x009 /* DeviceControl */ -#define SDA_SBADDRLOW 0x00a /* SbAddrLow */ -#define SDA_SBADDRMID 0x00b /* SbAddrMid */ -#define SDA_SBADDRHIGH 0x00c /* SbAddrHigh */ -#define SDA_FRAMECTRL 0x00d /* FrameCtrl */ -#define SDA_CHIPCLOCKCSR 0x00e /* ChipClockCSR */ -#define SDA_SDIOPULLUP 0x00f /* SdioPullUp */ -#define SDA_SDIOWRFRAMEBCLOW 0x019 /* SdioWrFrameBCLow */ -#define SDA_SDIOWRFRAMEBCHIGH 0x01a /* SdioWrFrameBCHigh */ -#define SDA_SDIORDFRAMEBCLOW 0x01b /* SdioRdFrameBCLow */ -#define SDA_SDIORDFRAMEBCHIGH 0x01c /* SdioRdFrameBCHigh */ - -/* SDA_F2WATERMARK */ -#define SDA_F2WATERMARK_MASK 0x7f /* F2Watermark Mask */ - -/* SDA_SBADDRLOW */ -#define SDA_SBADDRLOW_MASK 0x80 /* SbAddrLow Mask */ - -/* SDA_SBADDRMID */ -#define SDA_SBADDRMID_MASK 0xff /* SbAddrMid Mask */ - -/* SDA_SBADDRHIGH */ -#define SDA_SBADDRHIGH_MASK 0xff /* SbAddrHigh Mask */ - -/* SDA_FRAMECTRL */ -#define SFC_RF_TERM (1 << 0) /* Read Frame Terminate */ -#define SFC_WF_TERM (1 << 1) /* Write Frame Terminate */ -#define SFC_CRC4WOOS (1 << 2) /* HW reports CRC error for write out of sync */ -#define SFC_ABORTALL (1 << 3) /* Abort cancels all in-progress frames */ - -/* pcmciaframectrl */ -#define PFC_RF_TERM (1 << 0) /* Read Frame Terminate */ -#define PFC_WF_TERM (1 << 1) /* Write Frame Terminate */ - -/* intrcvlazy */ -#define IRL_TO_MASK 0x00ffffff /* timeout */ -#define IRL_FC_MASK 0xff000000 /* frame count */ -#define IRL_FC_SHIFT 24 /* frame count */ - -/* rx header */ -typedef volatile struct { - uint16 len; - uint16 flags; -} sdpcmd_rxh_t; - -/* rx header flags */ -#define RXF_CRC 0x0001 /* CRC error detected */ -#define RXF_WOOS 0x0002 /* write frame out of sync */ -#define RXF_WF_TERM 0x0004 /* write frame terminated */ -#define RXF_ABORT 0x0008 /* write frame aborted */ -#define RXF_DISCARD (RXF_CRC | RXF_WOOS | RXF_WF_TERM | RXF_ABORT) /* bad frame */ - -/* HW frame tag */ -#define SDPCM_FRAMETAG_LEN 4 /* HW frametag: 2 bytes len, 2 bytes check val */ - -#endif /* _sbsdpcmdev_h_ */ diff --git a/drivers/net/wireless/bcm4319/include/sbsocram.h b/drivers/net/wireless/bcm4319/include/sbsocram.h deleted file mode 100644 index 5ede0b66d97f..000000000000 --- a/drivers/net/wireless/bcm4319/include/sbsocram.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * BCM47XX Sonics SiliconBackplane embedded ram core - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: sbsocram.h,v 13.9.162.2 2008/12/12 14:13:27 Exp $ - */ - - -#ifndef _SBSOCRAM_H -#define _SBSOCRAM_H - -#ifndef _LANGUAGE_ASSEMBLY - - -#ifndef PAD -#define _PADLINE(line) pad ## line -#define _XSTR(line) _PADLINE(line) -#define PAD _XSTR(__LINE__) -#endif - - -typedef volatile struct sbsocramregs { - uint32 coreinfo; - uint32 bwalloc; - uint32 extracoreinfo; - uint32 biststat; - uint32 bankidx; - uint32 standbyctrl; - - uint32 errlogstatus; - uint32 errlogaddr; - - uint32 cambankidx; - uint32 cambankstandbyctrl; - uint32 cambankpatchctrl; - uint32 cambankpatchtblbaseaddr; - uint32 cambankcmdreg; - uint32 cambankdatareg; - uint32 cambankmaskreg; - uint32 PAD[17]; - uint32 extmemconfig; - uint32 extmemparitycsr; - uint32 extmemparityerrdata; - uint32 extmemparityerrcnt; - uint32 extmemwrctrlandsize; - uint32 PAD[84]; - uint32 workaround; - uint32 pwrctl; -} sbsocramregs_t; - -#endif - - -#define SR_COREINFO 0x00 -#define SR_BWALLOC 0x04 -#define SR_BISTSTAT 0x0c -#define SR_BANKINDEX 0x10 -#define SR_BANKSTBYCTL 0x14 -#define SR_PWRCTL 0x1e8 - - -#define SRCI_PT_MASK 0x00070000 -#define SRCI_PT_SHIFT 16 - -#define SRCI_PT_OCP_OCP 0 -#define SRCI_PT_AXI_OCP 1 -#define SRCI_PT_ARM7AHB_OCP 2 -#define SRCI_PT_CM3AHB_OCP 3 -#define SRCI_PT_AXI_AXI 4 -#define SRCI_PT_AHB_AXI 5 - -#define SRCI_LSS_MASK 0x00f00000 -#define SRCI_LSS_SHIFT 20 -#define SRCI_LRS_MASK 0x0f000000 -#define SRCI_LRS_SHIFT 24 - - -#define SRCI_MS0_MASK 0xf -#define SR_MS0_BASE 16 - - -#define SRCI_ROMNB_MASK 0xf000 -#define SRCI_ROMNB_SHIFT 12 -#define SRCI_ROMBSZ_MASK 0xf00 -#define SRCI_ROMBSZ_SHIFT 8 -#define SRCI_SRNB_MASK 0xf0 -#define SRCI_SRNB_SHIFT 4 -#define SRCI_SRBSZ_MASK 0xf -#define SRCI_SRBSZ_SHIFT 0 - -#define SR_BSZ_BASE 14 - - -#define SRSC_SBYOVR_MASK 0x80000000 -#define SRSC_SBYOVR_SHIFT 31 -#define SRSC_SBYOVRVAL_MASK 0x60000000 -#define SRSC_SBYOVRVAL_SHIFT 29 -#define SRSC_SBYEN_MASK 0x01000000 -#define SRSC_SBYEN_SHIFT 24 - - -#define SRPC_PMU_STBYDIS_MASK 0x00000010 -#define SRPC_PMU_STBYDIS_SHIFT 4 -#define SRPC_STBYOVRVAL_MASK 0x00000008 -#define SRPC_STBYOVRVAL_SHIFT 3 -#define SRPC_STBYOVR_MASK 0x00000007 -#define SRPC_STBYOVR_SHIFT 0 - - -#define SRECC_NUM_BANKS_MASK 0x000000F0 -#define SRECC_NUM_BANKS_SHIFT 4 -#define SRECC_BANKSIZE_MASK 0x0000000F -#define SRECC_BANKSIZE_SHIFT 0 - -#define SRECC_BANKSIZE(value) (1 << (value)) - - -#define SRCBPC_PATCHENABLE 0x80000000 - -#define SRP_ADDRESS 0x0001FFFC -#define SRP_VALID 0x8000 - - -#define SRCMD_WRITE 0x00020000 -#define SRCMD_READ 0x00010000 -#define SRCMD_DONE 0x80000000 - -#define SRCMD_DONE_DLY 1000 - - -#endif diff --git a/drivers/net/wireless/bcm4319/include/sdio.h b/drivers/net/wireless/bcm4319/include/sdio.h deleted file mode 100644 index 280cb845fb04..000000000000 --- a/drivers/net/wireless/bcm4319/include/sdio.h +++ /dev/null @@ -1,566 +0,0 @@ -/* - * SDIO spec header file - * Protocol and standard (common) device definitions - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: sdio.h,v 13.24.4.1.4.1.16.1 2009/08/12 01:08:02 Exp $ - */ - -#ifndef _SDIO_H -#define _SDIO_H - - -/* CCCR structure for function 0 */ -typedef volatile struct { - uint8 cccr_sdio_rev; /* RO, cccr and sdio revision */ - uint8 sd_rev; /* RO, sd spec revision */ - uint8 io_en; /* I/O enable */ - uint8 io_rdy; /* I/O ready reg */ - uint8 intr_ctl; /* Master and per function interrupt enable control */ - uint8 intr_status; /* RO, interrupt pending status */ - uint8 io_abort; /* read/write abort or reset all functions */ - uint8 bus_inter; /* bus interface control */ - uint8 capability; /* RO, card capability */ - - uint8 cis_base_low; /* 0x9 RO, common CIS base address, LSB */ - uint8 cis_base_mid; - uint8 cis_base_high; /* 0xB RO, common CIS base address, MSB */ - - /* suspend/resume registers */ - uint8 bus_suspend; /* 0xC */ - uint8 func_select; /* 0xD */ - uint8 exec_flag; /* 0xE */ - uint8 ready_flag; /* 0xF */ - - uint8 fn0_blk_size[2]; /* 0x10(LSB), 0x11(MSB) */ - - uint8 power_control; /* 0x12 (SDIO version 1.10) */ - - uint8 speed_control; /* 0x13 */ -} sdio_regs_t; - -/* SDIO Device CCCR offsets */ -#define SDIOD_CCCR_REV 0x00 -#define SDIOD_CCCR_SDREV 0x01 -#define SDIOD_CCCR_IOEN 0x02 -#define SDIOD_CCCR_IORDY 0x03 -#define SDIOD_CCCR_INTEN 0x04 -#define SDIOD_CCCR_INTPEND 0x05 -#define SDIOD_CCCR_IOABORT 0x06 -#define SDIOD_CCCR_BICTRL 0x07 -#define SDIOD_CCCR_CAPABLITIES 0x08 -#define SDIOD_CCCR_CISPTR_0 0x09 -#define SDIOD_CCCR_CISPTR_1 0x0A -#define SDIOD_CCCR_CISPTR_2 0x0B -#define SDIOD_CCCR_BUSSUSP 0x0C -#define SDIOD_CCCR_FUNCSEL 0x0D -#define SDIOD_CCCR_EXECFLAGS 0x0E -#define SDIOD_CCCR_RDYFLAGS 0x0F -#define SDIOD_CCCR_BLKSIZE_0 0x10 -#define SDIOD_CCCR_BLKSIZE_1 0x11 -#define SDIOD_CCCR_POWER_CONTROL 0x12 -#define SDIOD_CCCR_SPEED_CONTROL 0x13 - -/* Broadcom extensions (corerev >= 1) */ -#define SDIOD_CCCR_BRCM_SEPINT 0xf2 - -/* cccr_sdio_rev */ -#define SDIO_REV_SDIOID_MASK 0xf0 /* SDIO spec revision number */ -#define SDIO_REV_CCCRID_MASK 0x0f /* CCCR format version number */ - -/* sd_rev */ -#define SD_REV_PHY_MASK 0x0f /* SD format version number */ - -/* io_en */ -#define SDIO_FUNC_ENABLE_1 0x02 /* function 1 I/O enable */ -#define SDIO_FUNC_ENABLE_2 0x04 /* function 2 I/O enable */ - -/* io_rdys */ -#define SDIO_FUNC_READY_1 0x02 /* function 1 I/O ready */ -#define SDIO_FUNC_READY_2 0x04 /* function 2 I/O ready */ - -/* intr_ctl */ -#define INTR_CTL_MASTER_EN 0x1 /* interrupt enable master */ -#define INTR_CTL_FUNC1_EN 0x2 /* interrupt enable for function 1 */ -#define INTR_CTL_FUNC2_EN 0x4 /* interrupt enable for function 2 */ - -/* intr_status */ -#define INTR_STATUS_FUNC1 0x2 /* interrupt pending for function 1 */ -#define INTR_STATUS_FUNC2 0x4 /* interrupt pending for function 2 */ - -/* io_abort */ -#define IO_ABORT_RESET_ALL 0x08 /* I/O card reset */ -#define IO_ABORT_FUNC_MASK 0x07 /* abort selction: function x */ - -/* bus_inter */ -#define BUS_CARD_DETECT_DIS 0x80 /* Card Detect disable */ -#define BUS_SPI_CONT_INTR_CAP 0x40 /* support continuous SPI interrupt */ -#define BUS_SPI_CONT_INTR_EN 0x20 /* continuous SPI interrupt enable */ -#define BUS_SD_DATA_WIDTH_MASK 0x03 /* bus width mask */ -#define BUS_SD_DATA_WIDTH_4BIT 0x02 /* bus width 4-bit mode */ -#define BUS_SD_DATA_WIDTH_1BIT 0x00 /* bus width 1-bit mode */ - -/* capability */ -#define SDIO_CAP_4BLS 0x80 /* 4-bit support for low speed card */ -#define SDIO_CAP_LSC 0x40 /* low speed card */ -#define SDIO_CAP_E4MI 0x20 /* enable interrupt between block of data in 4-bit mode */ -#define SDIO_CAP_S4MI 0x10 /* support interrupt between block of data in 4-bit mode */ -#define SDIO_CAP_SBS 0x08 /* support suspend/resume */ -#define SDIO_CAP_SRW 0x04 /* support read wait */ -#define SDIO_CAP_SMB 0x02 /* support multi-block transfer */ -#define SDIO_CAP_SDC 0x01 /* Support Direct commands during multi-byte transfer */ - -/* power_control */ -#define SDIO_POWER_SMPC 0x01 /* supports master power control (RO) */ -#define SDIO_POWER_EMPC 0x02 /* enable master power control (allow > 200mA) (RW) */ - -/* speed_control (control device entry into high-speed clocking mode) */ -#define SDIO_SPEED_SHS 0x01 /* supports high-speed [clocking] mode (RO) */ -#define SDIO_SPEED_EHS 0x02 /* enable high-speed [clocking] mode (RW) */ - -/* brcm sepint */ -#define SDIO_SEPINT_MASK 0x01 /* route sdpcmdev intr onto separate pad (chip-specific) */ -#define SDIO_SEPINT_OE 0x02 /* 1 asserts output enable for above pad */ -#define SDIO_SEPINT_ACT_HI 0x04 /* use active high interrupt level instead of active low */ - -/* FBR structure for function 1-7, FBR addresses and register offsets */ -typedef volatile struct { - uint8 devctr; /* device interface, CSA control */ - uint8 ext_dev; /* extended standard I/O device type code */ - uint8 pwr_sel; /* power selection support */ - uint8 PAD[6]; /* reserved */ - - uint8 cis_low; /* CIS LSB */ - uint8 cis_mid; - uint8 cis_high; /* CIS MSB */ - uint8 csa_low; /* code storage area, LSB */ - uint8 csa_mid; - uint8 csa_high; /* code storage area, MSB */ - uint8 csa_dat_win; /* data access window to function */ - - uint8 fnx_blk_size[2]; /* block size, little endian */ -} sdio_fbr_t; - -/* Maximum number of I/O funcs */ -#define SDIOD_MAX_IOFUNCS 7 - -/* SDIO Device FBR Start Address */ -#define SDIOD_FBR_STARTADDR 0x100 - -/* SDIO Device FBR Size */ -#define SDIOD_FBR_SIZE 0x100 - -/* Macro to calculate FBR register base */ -#define SDIOD_FBR_BASE(n) ((n) * 0x100) - -/* Function register offsets */ -#define SDIOD_FBR_DEVCTR 0x00 /* basic info for function */ -#define SDIOD_FBR_EXT_DEV 0x01 /* extended I/O device code */ -#define SDIOD_FBR_PWR_SEL 0x02 /* power selection bits */ - -/* SDIO Function CIS ptr offset */ -#define SDIOD_FBR_CISPTR_0 0x09 -#define SDIOD_FBR_CISPTR_1 0x0A -#define SDIOD_FBR_CISPTR_2 0x0B - -/* Code Storage Area pointer */ -#define SDIOD_FBR_CSA_ADDR_0 0x0C -#define SDIOD_FBR_CSA_ADDR_1 0x0D -#define SDIOD_FBR_CSA_ADDR_2 0x0E -#define SDIOD_FBR_CSA_DATA 0x0F - -/* SDIO Function I/O Block Size */ -#define SDIOD_FBR_BLKSIZE_0 0x10 -#define SDIOD_FBR_BLKSIZE_1 0x11 - -/* devctr */ -#define SDIOD_FBR_DEVCTR_DIC 0x0f /* device interface code */ -#define SDIOD_FBR_DECVTR_CSA 0x40 /* CSA support flag */ -#define SDIOD_FBR_DEVCTR_CSA_EN 0x80 /* CSA enabled */ -/* interface codes */ -#define SDIOD_DIC_NONE 0 /* SDIO standard interface is not supported */ -#define SDIOD_DIC_UART 1 -#define SDIOD_DIC_BLUETOOTH_A 2 -#define SDIOD_DIC_BLUETOOTH_B 3 -#define SDIOD_DIC_GPS 4 -#define SDIOD_DIC_CAMERA 5 -#define SDIOD_DIC_PHS 6 -#define SDIOD_DIC_WLAN 7 -#define SDIOD_DIC_EXT 0xf /* extended device interface, read ext_dev register */ - -/* pwr_sel */ -#define SDIOD_PWR_SEL_SPS 0x01 /* supports power selection */ -#define SDIOD_PWR_SEL_EPS 0x02 /* enable power selection (low-current mode) */ - -/* misc defines */ -#define SDIO_FUNC_0 0 -#define SDIO_FUNC_1 1 -#define SDIO_FUNC_2 2 -#define SDIO_FUNC_3 3 -#define SDIO_FUNC_4 4 -#define SDIO_FUNC_5 5 -#define SDIO_FUNC_6 6 -#define SDIO_FUNC_7 7 - -#define SD_CARD_TYPE_UNKNOWN 0 /* bad type or unrecognized */ -#define SD_CARD_TYPE_IO 1 /* IO only card */ -#define SD_CARD_TYPE_MEMORY 2 /* memory only card */ -#define SD_CARD_TYPE_COMBO 3 /* IO and memory combo card */ - -#define SDIO_MAX_BLOCK_SIZE 2048 /* maximum block size for block mode operation */ -#define SDIO_MIN_BLOCK_SIZE 1 /* minimum block size for block mode operation */ - -/* Card registers: status bit position */ -#define CARDREG_STATUS_BIT_OUTOFRANGE 31 -#define CARDREG_STATUS_BIT_COMCRCERROR 23 -#define CARDREG_STATUS_BIT_ILLEGALCOMMAND 22 -#define CARDREG_STATUS_BIT_ERROR 19 -#define CARDREG_STATUS_BIT_IOCURRENTSTATE3 12 -#define CARDREG_STATUS_BIT_IOCURRENTSTATE2 11 -#define CARDREG_STATUS_BIT_IOCURRENTSTATE1 10 -#define CARDREG_STATUS_BIT_IOCURRENTSTATE0 9 -#define CARDREG_STATUS_BIT_FUN_NUM_ERROR 4 - - - -#define SD_CMD_GO_IDLE_STATE 0 /* mandatory for SDIO */ -#define SD_CMD_SEND_OPCOND 1 -#define SD_CMD_MMC_SET_RCA 3 -#define SD_CMD_IO_SEND_OP_COND 5 /* mandatory for SDIO */ -#define SD_CMD_SELECT_DESELECT_CARD 7 -#define SD_CMD_SEND_CSD 9 -#define SD_CMD_SEND_CID 10 -#define SD_CMD_STOP_TRANSMISSION 12 -#define SD_CMD_SEND_STATUS 13 -#define SD_CMD_GO_INACTIVE_STATE 15 -#define SD_CMD_SET_BLOCKLEN 16 -#define SD_CMD_READ_SINGLE_BLOCK 17 -#define SD_CMD_READ_MULTIPLE_BLOCK 18 -#define SD_CMD_WRITE_BLOCK 24 -#define SD_CMD_WRITE_MULTIPLE_BLOCK 25 -#define SD_CMD_PROGRAM_CSD 27 -#define SD_CMD_SET_WRITE_PROT 28 -#define SD_CMD_CLR_WRITE_PROT 29 -#define SD_CMD_SEND_WRITE_PROT 30 -#define SD_CMD_ERASE_WR_BLK_START 32 -#define SD_CMD_ERASE_WR_BLK_END 33 -#define SD_CMD_ERASE 38 -#define SD_CMD_LOCK_UNLOCK 42 -#define SD_CMD_IO_RW_DIRECT 52 /* mandatory for SDIO */ -#define SD_CMD_IO_RW_EXTENDED 53 /* mandatory for SDIO */ -#define SD_CMD_APP_CMD 55 -#define SD_CMD_GEN_CMD 56 -#define SD_CMD_READ_OCR 58 -#define SD_CMD_CRC_ON_OFF 59 /* mandatory for SDIO */ -#define SD_ACMD_SD_STATUS 13 -#define SD_ACMD_SEND_NUM_WR_BLOCKS 22 -#define SD_ACMD_SET_WR_BLOCK_ERASE_CNT 23 -#define SD_ACMD_SD_SEND_OP_COND 41 -#define SD_ACMD_SET_CLR_CARD_DETECT 42 -#define SD_ACMD_SEND_SCR 51 - -/* argument for SD_CMD_IO_RW_DIRECT and SD_CMD_IO_RW_EXTENDED */ -#define SD_IO_OP_READ 0 /* Read_Write: Read */ -#define SD_IO_OP_WRITE 1 /* Read_Write: Write */ -#define SD_IO_RW_NORMAL 0 /* no RAW */ -#define SD_IO_RW_RAW 1 /* RAW */ -#define SD_IO_BYTE_MODE 0 /* Byte Mode */ -#define SD_IO_BLOCK_MODE 1 /* BlockMode */ -#define SD_IO_FIXED_ADDRESS 0 /* fix Address */ -#define SD_IO_INCREMENT_ADDRESS 1 /* IncrementAddress */ - -/* build SD_CMD_IO_RW_DIRECT Argument */ -#define SDIO_IO_RW_DIRECT_ARG(rw, raw, func, addr, data) \ - ((((rw) & 1) << 31) | (((func) & 0x7) << 28) | (((raw) & 1) << 27) | \ - (((addr) & 0x1FFFF) << 9) | ((data) & 0xFF)) - -/* build SD_CMD_IO_RW_EXTENDED Argument */ -#define SDIO_IO_RW_EXTENDED_ARG(rw, blk, func, addr, inc_addr, count) \ - ((((rw) & 1) << 31) | (((func) & 0x7) << 28) | (((blk) & 1) << 27) | \ - (((inc_addr) & 1) << 26) | (((addr) & 0x1FFFF) << 9) | ((count) & 0x1FF)) - -/* SDIO response parameters */ -#define SD_RSP_NO_NONE 0 -#define SD_RSP_NO_1 1 -#define SD_RSP_NO_2 2 -#define SD_RSP_NO_3 3 -#define SD_RSP_NO_4 4 -#define SD_RSP_NO_5 5 -#define SD_RSP_NO_6 6 - - /* Modified R6 response (to CMD3) */ -#define SD_RSP_MR6_COM_CRC_ERROR 0x8000 -#define SD_RSP_MR6_ILLEGAL_COMMAND 0x4000 -#define SD_RSP_MR6_ERROR 0x2000 - - /* Modified R1 in R4 Response (to CMD5) */ -#define SD_RSP_MR1_SBIT 0x80 -#define SD_RSP_MR1_PARAMETER_ERROR 0x40 -#define SD_RSP_MR1_RFU5 0x20 -#define SD_RSP_MR1_FUNC_NUM_ERROR 0x10 -#define SD_RSP_MR1_COM_CRC_ERROR 0x08 -#define SD_RSP_MR1_ILLEGAL_COMMAND 0x04 -#define SD_RSP_MR1_RFU1 0x02 -#define SD_RSP_MR1_IDLE_STATE 0x01 - - /* R5 response (to CMD52 and CMD53) */ -#define SD_RSP_R5_COM_CRC_ERROR 0x80 -#define SD_RSP_R5_ILLEGAL_COMMAND 0x40 -#define SD_RSP_R5_IO_CURRENTSTATE1 0x20 -#define SD_RSP_R5_IO_CURRENTSTATE0 0x10 -#define SD_RSP_R5_ERROR 0x08 -#define SD_RSP_R5_RFU 0x04 -#define SD_RSP_R5_FUNC_NUM_ERROR 0x02 -#define SD_RSP_R5_OUT_OF_RANGE 0x01 - -#define SD_RSP_R5_ERRBITS 0xCB - - -/* ------------------------------------------------ - * SDIO Commands and responses - * - * I/O only commands are: - * CMD0, CMD3, CMD5, CMD7, CMD15, CMD52, CMD53 - * ------------------------------------------------ - */ - -/* SDIO Commands */ -#define SDIOH_CMD_0 0 -#define SDIOH_CMD_3 3 -#define SDIOH_CMD_5 5 -#define SDIOH_CMD_7 7 -#define SDIOH_CMD_15 15 -#define SDIOH_CMD_52 52 -#define SDIOH_CMD_53 53 -#define SDIOH_CMD_59 59 - -/* SDIO Command Responses */ -#define SDIOH_RSP_NONE 0 -#define SDIOH_RSP_R1 1 -#define SDIOH_RSP_R2 2 -#define SDIOH_RSP_R3 3 -#define SDIOH_RSP_R4 4 -#define SDIOH_RSP_R5 5 -#define SDIOH_RSP_R6 6 - -/* - * SDIO Response Error flags - */ -#define SDIOH_RSP5_ERROR_FLAGS 0xCB - -/* ------------------------------------------------ - * SDIO Command structures. I/O only commands are: - * - * CMD0, CMD3, CMD5, CMD7, CMD15, CMD52, CMD53 - * ------------------------------------------------ - */ - -#define CMD5_OCR_M BITFIELD_MASK(24) -#define CMD5_OCR_S 0 - -#define CMD7_RCA_M BITFIELD_MASK(16) -#define CMD7_RCA_S 16 - -#define CMD_15_RCA_M BITFIELD_MASK(16) -#define CMD_15_RCA_S 16 - -#define CMD52_DATA_M BITFIELD_MASK(8) /* Bits [7:0] - Write Data/Stuff bits of CMD52 - */ -#define CMD52_DATA_S 0 -#define CMD52_REG_ADDR_M BITFIELD_MASK(17) /* Bits [25:9] - register address */ -#define CMD52_REG_ADDR_S 9 -#define CMD52_RAW_M BITFIELD_MASK(1) /* Bit 27 - Read after Write flag */ -#define CMD52_RAW_S 27 -#define CMD52_FUNCTION_M BITFIELD_MASK(3) /* Bits [30:28] - Function number */ -#define CMD52_FUNCTION_S 28 -#define CMD52_RW_FLAG_M BITFIELD_MASK(1) /* Bit 31 - R/W flag */ -#define CMD52_RW_FLAG_S 31 - - -#define CMD53_BYTE_BLK_CNT_M BITFIELD_MASK(9) /* Bits [8:0] - Byte/Block Count of CMD53 */ -#define CMD53_BYTE_BLK_CNT_S 0 -#define CMD53_REG_ADDR_M BITFIELD_MASK(17) /* Bits [25:9] - register address */ -#define CMD53_REG_ADDR_S 9 -#define CMD53_OP_CODE_M BITFIELD_MASK(1) /* Bit 26 - R/W Operation Code */ -#define CMD53_OP_CODE_S 26 -#define CMD53_BLK_MODE_M BITFIELD_MASK(1) /* Bit 27 - Block Mode */ -#define CMD53_BLK_MODE_S 27 -#define CMD53_FUNCTION_M BITFIELD_MASK(3) /* Bits [30:28] - Function number */ -#define CMD53_FUNCTION_S 28 -#define CMD53_RW_FLAG_M BITFIELD_MASK(1) /* Bit 31 - R/W flag */ -#define CMD53_RW_FLAG_S 31 - -/* ------------------------------------------------------ - * SDIO Command Response structures for SD1 and SD4 modes - * ----------------------------------------------------- - */ -#define RSP4_IO_OCR_M BITFIELD_MASK(24) /* Bits [23:0] - Card's OCR Bits [23:0] */ -#define RSP4_IO_OCR_S 0 -#define RSP4_STUFF_M BITFIELD_MASK(3) /* Bits [26:24] - Stuff bits */ -#define RSP4_STUFF_S 24 -#define RSP4_MEM_PRESENT_M BITFIELD_MASK(1) /* Bit 27 - Memory present */ -#define RSP4_MEM_PRESENT_S 27 -#define RSP4_NUM_FUNCS_M BITFIELD_MASK(3) /* Bits [30:28] - Number of I/O funcs */ -#define RSP4_NUM_FUNCS_S 28 -#define RSP4_CARD_READY_M BITFIELD_MASK(1) /* Bit 31 - SDIO card ready */ -#define RSP4_CARD_READY_S 31 - -#define RSP6_STATUS_M BITFIELD_MASK(16) /* Bits [15:0] - Card status bits [19,22,23,12:0] - */ -#define RSP6_STATUS_S 0 -#define RSP6_IO_RCA_M BITFIELD_MASK(16) /* Bits [31:16] - RCA bits[31-16] */ -#define RSP6_IO_RCA_S 16 - -#define RSP1_AKE_SEQ_ERROR_M BITFIELD_MASK(1) /* Bit 3 - Authentication seq error */ -#define RSP1_AKE_SEQ_ERROR_S 3 -#define RSP1_APP_CMD_M BITFIELD_MASK(1) /* Bit 5 - Card expects ACMD */ -#define RSP1_APP_CMD_S 5 -#define RSP1_READY_FOR_DATA_M BITFIELD_MASK(1) /* Bit 8 - Ready for data (buff empty) */ -#define RSP1_READY_FOR_DATA_S 8 -#define RSP1_CURR_STATE_M BITFIELD_MASK(4) /* Bits [12:9] - State of card - * when Cmd was received - */ -#define RSP1_CURR_STATE_S 9 -#define RSP1_EARSE_RESET_M BITFIELD_MASK(1) /* Bit 13 - Erase seq cleared */ -#define RSP1_EARSE_RESET_S 13 -#define RSP1_CARD_ECC_DISABLE_M BITFIELD_MASK(1) /* Bit 14 - Card ECC disabled */ -#define RSP1_CARD_ECC_DISABLE_S 14 -#define RSP1_WP_ERASE_SKIP_M BITFIELD_MASK(1) /* Bit 15 - Partial blocks erased due to W/P */ -#define RSP1_WP_ERASE_SKIP_S 15 -#define RSP1_CID_CSD_OVERW_M BITFIELD_MASK(1) /* Bit 16 - Illegal write to CID or R/O bits - * of CSD - */ -#define RSP1_CID_CSD_OVERW_S 16 -#define RSP1_ERROR_M BITFIELD_MASK(1) /* Bit 19 - General/Unknown error */ -#define RSP1_ERROR_S 19 -#define RSP1_CC_ERROR_M BITFIELD_MASK(1) /* Bit 20 - Internal Card Control error */ -#define RSP1_CC_ERROR_S 20 -#define RSP1_CARD_ECC_FAILED_M BITFIELD_MASK(1) /* Bit 21 - Card internal ECC failed - * to correct data - */ -#define RSP1_CARD_ECC_FAILED_S 21 -#define RSP1_ILLEGAL_CMD_M BITFIELD_MASK(1) /* Bit 22 - Cmd not legal for the card state */ -#define RSP1_ILLEGAL_CMD_S 22 -#define RSP1_COM_CRC_ERROR_M BITFIELD_MASK(1) /* Bit 23 - CRC check of previous command failed - */ -#define RSP1_COM_CRC_ERROR_S 23 -#define RSP1_LOCK_UNLOCK_FAIL_M BITFIELD_MASK(1) /* Bit 24 - Card lock-unlock Cmd Seq error */ -#define RSP1_LOCK_UNLOCK_FAIL_S 24 -#define RSP1_CARD_LOCKED_M BITFIELD_MASK(1) /* Bit 25 - Card locked by the host */ -#define RSP1_CARD_LOCKED_S 25 -#define RSP1_WP_VIOLATION_M BITFIELD_MASK(1) /* Bit 26 - Attempt to program - * write-protected blocks - */ -#define RSP1_WP_VIOLATION_S 26 -#define RSP1_ERASE_PARAM_M BITFIELD_MASK(1) /* Bit 27 - Invalid erase blocks */ -#define RSP1_ERASE_PARAM_S 27 -#define RSP1_ERASE_SEQ_ERR_M BITFIELD_MASK(1) /* Bit 28 - Erase Cmd seq error */ -#define RSP1_ERASE_SEQ_ERR_S 28 -#define RSP1_BLK_LEN_ERR_M BITFIELD_MASK(1) /* Bit 29 - Block length error */ -#define RSP1_BLK_LEN_ERR_S 29 -#define RSP1_ADDR_ERR_M BITFIELD_MASK(1) /* Bit 30 - Misaligned address */ -#define RSP1_ADDR_ERR_S 30 -#define RSP1_OUT_OF_RANGE_M BITFIELD_MASK(1) /* Bit 31 - Cmd arg was out of range */ -#define RSP1_OUT_OF_RANGE_S 31 - - -#define RSP5_DATA_M BITFIELD_MASK(8) /* Bits [0:7] - data */ -#define RSP5_DATA_S 0 -#define RSP5_FLAGS_M BITFIELD_MASK(8) /* Bit [15:8] - Rsp flags */ -#define RSP5_FLAGS_S 8 -#define RSP5_STUFF_M BITFIELD_MASK(16) /* Bits [31:16] - Stuff bits */ -#define RSP5_STUFF_S 16 - -/* ---------------------------------------------- - * SDIO Command Response structures for SPI mode - * ---------------------------------------------- - */ -#define SPIRSP4_IO_OCR_M BITFIELD_MASK(16) /* Bits [15:0] - Card's OCR Bits [23:8] */ -#define SPIRSP4_IO_OCR_S 0 -#define SPIRSP4_STUFF_M BITFIELD_MASK(3) /* Bits [18:16] - Stuff bits */ -#define SPIRSP4_STUFF_S 16 -#define SPIRSP4_MEM_PRESENT_M BITFIELD_MASK(1) /* Bit 19 - Memory present */ -#define SPIRSP4_MEM_PRESENT_S 19 -#define SPIRSP4_NUM_FUNCS_M BITFIELD_MASK(3) /* Bits [22:20] - Number of I/O funcs */ -#define SPIRSP4_NUM_FUNCS_S 20 -#define SPIRSP4_CARD_READY_M BITFIELD_MASK(1) /* Bit 23 - SDIO card ready */ -#define SPIRSP4_CARD_READY_S 23 -#define SPIRSP4_IDLE_STATE_M BITFIELD_MASK(1) /* Bit 24 - idle state */ -#define SPIRSP4_IDLE_STATE_S 24 -#define SPIRSP4_ILLEGAL_CMD_M BITFIELD_MASK(1) /* Bit 26 - Illegal Cmd error */ -#define SPIRSP4_ILLEGAL_CMD_S 26 -#define SPIRSP4_COM_CRC_ERROR_M BITFIELD_MASK(1) /* Bit 27 - COM CRC error */ -#define SPIRSP4_COM_CRC_ERROR_S 27 -#define SPIRSP4_FUNC_NUM_ERROR_M BITFIELD_MASK(1) /* Bit 28 - Function number error - */ -#define SPIRSP4_FUNC_NUM_ERROR_S 28 -#define SPIRSP4_PARAM_ERROR_M BITFIELD_MASK(1) /* Bit 30 - Parameter Error Bit */ -#define SPIRSP4_PARAM_ERROR_S 30 -#define SPIRSP4_START_BIT_M BITFIELD_MASK(1) /* Bit 31 - Start Bit */ -#define SPIRSP4_START_BIT_S 31 - -#define SPIRSP5_DATA_M BITFIELD_MASK(8) /* Bits [23:16] - R/W Data */ -#define SPIRSP5_DATA_S 16 -#define SPIRSP5_IDLE_STATE_M BITFIELD_MASK(1) /* Bit 24 - Idle state */ -#define SPIRSP5_IDLE_STATE_S 24 -#define SPIRSP5_ILLEGAL_CMD_M BITFIELD_MASK(1) /* Bit 26 - Illegal Cmd error */ -#define SPIRSP5_ILLEGAL_CMD_S 26 -#define SPIRSP5_COM_CRC_ERROR_M BITFIELD_MASK(1) /* Bit 27 - COM CRC error */ -#define SPIRSP5_COM_CRC_ERROR_S 27 -#define SPIRSP5_FUNC_NUM_ERROR_M BITFIELD_MASK(1) /* Bit 28 - Function number error - */ -#define SPIRSP5_FUNC_NUM_ERROR_S 28 -#define SPIRSP5_PARAM_ERROR_M BITFIELD_MASK(1) /* Bit 30 - Parameter Error Bit */ -#define SPIRSP5_PARAM_ERROR_S 30 -#define SPIRSP5_START_BIT_M BITFIELD_MASK(1) /* Bit 31 - Start Bit */ -#define SPIRSP5_START_BIT_S 31 - -/* RSP6 card status format; Pg 68 Physical Layer spec v 1.10 */ -#define RSP6STAT_AKE_SEQ_ERROR_M BITFIELD_MASK(1) /* Bit 3 - Authentication seq error - */ -#define RSP6STAT_AKE_SEQ_ERROR_S 3 -#define RSP6STAT_APP_CMD_M BITFIELD_MASK(1) /* Bit 5 - Card expects ACMD */ -#define RSP6STAT_APP_CMD_S 5 -#define RSP6STAT_READY_FOR_DATA_M BITFIELD_MASK(1) /* Bit 8 - Ready for data - * (buff empty) - */ -#define RSP6STAT_READY_FOR_DATA_S 8 -#define RSP6STAT_CURR_STATE_M BITFIELD_MASK(4) /* Bits [12:9] - Card state at - * Cmd reception - */ -#define RSP6STAT_CURR_STATE_S 9 -#define RSP6STAT_ERROR_M BITFIELD_MASK(1) /* Bit 13 - General/Unknown error Bit 19 - */ -#define RSP6STAT_ERROR_S 13 -#define RSP6STAT_ILLEGAL_CMD_M BITFIELD_MASK(1) /* Bit 14 - Illegal cmd for - * card state Bit 22 - */ -#define RSP6STAT_ILLEGAL_CMD_S 14 -#define RSP6STAT_COM_CRC_ERROR_M BITFIELD_MASK(1) /* Bit 15 - CRC previous command - * failed Bit 23 - */ -#define RSP6STAT_COM_CRC_ERROR_S 15 - -#define SDIOH_XFER_TYPE_READ SD_IO_OP_READ -#define SDIOH_XFER_TYPE_WRITE SD_IO_OP_WRITE - -#endif /* _SDIO_H */ diff --git a/drivers/net/wireless/bcm4319/include/sdioh.h b/drivers/net/wireless/bcm4319/include/sdioh.h deleted file mode 100644 index 8123452eac2b..000000000000 --- a/drivers/net/wireless/bcm4319/include/sdioh.h +++ /dev/null @@ -1,299 +0,0 @@ -/* - * SDIO Host Controller Spec header file - * Register map and definitions for the Standard Host Controller - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: sdioh.h,v 13.13.18.1.16.3 2009/12/08 22:34:21 Exp $ - */ - -#ifndef _SDIOH_H -#define _SDIOH_H - -#define SD_SysAddr 0x000 -#define SD_BlockSize 0x004 -#define SD_BlockCount 0x006 -#define SD_Arg0 0x008 -#define SD_Arg1 0x00A -#define SD_TransferMode 0x00C -#define SD_Command 0x00E -#define SD_Response0 0x010 -#define SD_Response1 0x012 -#define SD_Response2 0x014 -#define SD_Response3 0x016 -#define SD_Response4 0x018 -#define SD_Response5 0x01A -#define SD_Response6 0x01C -#define SD_Response7 0x01E -#define SD_BufferDataPort0 0x020 -#define SD_BufferDataPort1 0x022 -#define SD_PresentState 0x024 -#define SD_HostCntrl 0x028 -#define SD_PwrCntrl 0x029 -#define SD_BlockGapCntrl 0x02A -#define SD_WakeupCntrl 0x02B -#define SD_ClockCntrl 0x02C -#define SD_TimeoutCntrl 0x02E -#define SD_SoftwareReset 0x02F -#define SD_IntrStatus 0x030 -#define SD_ErrorIntrStatus 0x032 -#define SD_IntrStatusEnable 0x034 -#define SD_ErrorIntrStatusEnable 0x036 -#define SD_IntrSignalEnable 0x038 -#define SD_ErrorIntrSignalEnable 0x03A -#define SD_CMD12ErrorStatus 0x03C -#define SD_Capabilities 0x040 -#define SD_Capabilities_Reserved 0x044 -#define SD_MaxCurCap 0x048 -#define SD_MaxCurCap_Reserved 0x04C -#define SD_ADMA_SysAddr 0x58 -#define SD_SlotInterruptStatus 0x0FC -#define SD_HostControllerVersion 0x0FE - -/* SD specific registers in PCI config space */ -#define SD_SlotInfo 0x40 - -/* SD_Capabilities reg (0x040) */ -#define CAP_TO_CLKFREQ_M BITFIELD_MASK(6) -#define CAP_TO_CLKFREQ_S 0 -#define CAP_TO_CLKUNIT_M BITFIELD_MASK(1) -#define CAP_TO_CLKUNIT_S 7 -#define CAP_BASECLK_M BITFIELD_MASK(6) -#define CAP_BASECLK_S 8 -#define CAP_MAXBLOCK_M BITFIELD_MASK(2) -#define CAP_MAXBLOCK_S 16 -#define CAP_ADMA2_M BITFIELD_MASK(1) -#define CAP_ADMA2_S 19 -#define CAP_ADMA1_M BITFIELD_MASK(1) -#define CAP_ADMA1_S 20 -#define CAP_HIGHSPEED_M BITFIELD_MASK(1) -#define CAP_HIGHSPEED_S 21 -#define CAP_DMA_M BITFIELD_MASK(1) -#define CAP_DMA_S 22 -#define CAP_SUSPEND_M BITFIELD_MASK(1) -#define CAP_SUSPEND_S 23 -#define CAP_VOLT_3_3_M BITFIELD_MASK(1) -#define CAP_VOLT_3_3_S 24 -#define CAP_VOLT_3_0_M BITFIELD_MASK(1) -#define CAP_VOLT_3_0_S 25 -#define CAP_VOLT_1_8_M BITFIELD_MASK(1) -#define CAP_VOLT_1_8_S 26 -#define CAP_64BIT_HOST_M BITFIELD_MASK(1) -#define CAP_64BIT_HOST_S 28 - -/* SD_MaxCurCap reg (0x048) */ -#define CAP_CURR_3_3_M BITFIELD_MASK(8) -#define CAP_CURR_3_3_S 0 -#define CAP_CURR_3_0_M BITFIELD_MASK(8) -#define CAP_CURR_3_0_S 8 -#define CAP_CURR_1_8_M BITFIELD_MASK(8) -#define CAP_CURR_1_8_S 16 - -/* SD_SysAddr: Offset 0x0000, Size 4 bytes */ - -/* SD_BlockSize: Offset 0x004, Size 2 bytes */ -#define BLKSZ_BLKSZ_M BITFIELD_MASK(12) -#define BLKSZ_BLKSZ_S 0 -#define BLKSZ_BNDRY_M BITFIELD_MASK(3) -#define BLKSZ_BNDRY_S 12 - -/* SD_BlockCount: Offset 0x006, size 2 bytes */ - -/* SD_Arg0: Offset 0x008, size = 4 bytes */ -/* SD_TransferMode Offset 0x00C, size = 2 bytes */ -#define XFER_DMA_ENABLE_M BITFIELD_MASK(1) -#define XFER_DMA_ENABLE_S 0 -#define XFER_BLK_COUNT_EN_M BITFIELD_MASK(1) -#define XFER_BLK_COUNT_EN_S 1 -#define XFER_CMD_12_EN_M BITFIELD_MASK(1) -#define XFER_CMD_12_EN_S 2 -#define XFER_DATA_DIRECTION_M BITFIELD_MASK(1) -#define XFER_DATA_DIRECTION_S 4 -#define XFER_MULTI_BLOCK_M BITFIELD_MASK(1) -#define XFER_MULTI_BLOCK_S 5 - -/* SD_Command: Offset 0x00E, size = 2 bytes */ -/* resp_type field */ -#define RESP_TYPE_NONE 0 -#define RESP_TYPE_136 1 -#define RESP_TYPE_48 2 -#define RESP_TYPE_48_BUSY 3 -/* type field */ -#define CMD_TYPE_NORMAL 0 -#define CMD_TYPE_SUSPEND 1 -#define CMD_TYPE_RESUME 2 -#define CMD_TYPE_ABORT 3 - -#define CMD_RESP_TYPE_M BITFIELD_MASK(2) /* Bits [0-1] - Response type */ -#define CMD_RESP_TYPE_S 0 -#define CMD_CRC_EN_M BITFIELD_MASK(1) /* Bit 3 - CRC enable */ -#define CMD_CRC_EN_S 3 -#define CMD_INDEX_EN_M BITFIELD_MASK(1) /* Bit 4 - Enable index checking */ -#define CMD_INDEX_EN_S 4 -#define CMD_DATA_EN_M BITFIELD_MASK(1) /* Bit 5 - Using DAT line */ -#define CMD_DATA_EN_S 5 -#define CMD_TYPE_M BITFIELD_MASK(2) /* Bit [6-7] - Normal, abort, resume, etc - */ -#define CMD_TYPE_S 6 -#define CMD_INDEX_M BITFIELD_MASK(6) /* Bits [8-13] - Command number */ -#define CMD_INDEX_S 8 - -/* SD_BufferDataPort0 : Offset 0x020, size = 2 or 4 bytes */ -/* SD_BufferDataPort1 : Offset 0x022, size = 2 bytes */ -/* SD_PresentState : Offset 0x024, size = 4 bytes */ -#define PRES_CMD_INHIBIT_M BITFIELD_MASK(1) /* Bit 0 May use CMD */ -#define PRES_CMD_INHIBIT_S 0 -#define PRES_DAT_INHIBIT_M BITFIELD_MASK(1) /* Bit 1 May use DAT */ -#define PRES_DAT_INHIBIT_S 1 -#define PRES_DAT_BUSY_M BITFIELD_MASK(1) /* Bit 2 DAT is busy */ -#define PRES_DAT_BUSY_S 2 -#define PRES_PRESENT_RSVD_M BITFIELD_MASK(5) /* Bit [3-7] rsvd */ -#define PRES_PRESENT_RSVD_S 3 -#define PRES_WRITE_ACTIVE_M BITFIELD_MASK(1) /* Bit 8 Write is active */ -#define PRES_WRITE_ACTIVE_S 8 -#define PRES_READ_ACTIVE_M BITFIELD_MASK(1) /* Bit 9 Read is active */ -#define PRES_READ_ACTIVE_S 9 -#define PRES_WRITE_DATA_RDY_M BITFIELD_MASK(1) /* Bit 10 Write buf is avail */ -#define PRES_WRITE_DATA_RDY_S 10 -#define PRES_READ_DATA_RDY_M BITFIELD_MASK(1) /* Bit 11 Read buf data avail */ -#define PRES_READ_DATA_RDY_S 11 -#define PRES_CARD_PRESENT_M BITFIELD_MASK(1) /* Bit 16 Card present - debounced */ -#define PRES_CARD_PRESENT_S 16 -#define PRES_CARD_STABLE_M BITFIELD_MASK(1) /* Bit 17 Debugging */ -#define PRES_CARD_STABLE_S 17 -#define PRES_CARD_PRESENT_RAW_M BITFIELD_MASK(1) /* Bit 18 Not debounced */ -#define PRES_CARD_PRESENT_RAW_S 18 -#define PRES_WRITE_ENABLED_M BITFIELD_MASK(1) /* Bit 19 Write protected? */ -#define PRES_WRITE_ENABLED_S 19 -#define PRES_DAT_SIGNAL_M BITFIELD_MASK(4) /* Bit [20-23] Debugging */ -#define PRES_DAT_SIGNAL_S 20 -#define PRES_CMD_SIGNAL_M BITFIELD_MASK(1) /* Bit 24 Debugging */ -#define PRES_CMD_SIGNAL_S 24 - -/* SD_HostCntrl: Offset 0x028, size = 1 bytes */ -#define HOST_LED_M BITFIELD_MASK(1) /* Bit 0 LED On/Off */ -#define HOST_LED_S 0 -#define HOST_DATA_WIDTH_M BITFIELD_MASK(1) /* Bit 1 4 bit enable */ -#define HOST_DATA_WIDTH_S 1 -#define HOST_HI_SPEED_EN_M BITFIELD_MASK(1) /* Bit 2 High speed vs low speed */ -#define HOST_DMA_SEL_S 3 -#define HOST_DMA_SEL_M BITFIELD_MASK(2) /* Bit 4:3 DMA Select */ -#define HOST_HI_SPEED_EN_S 2 - -/* misc defines */ -#define SD1_MODE 0x1 /* SD Host Cntrlr Spec */ -#define SD4_MODE 0x2 /* SD Host Cntrlr Spec */ - -/* SD_PwrCntrl: Offset 0x029, size = 1 bytes */ -#define PWR_BUS_EN_M BITFIELD_MASK(1) /* Bit 0 Power the bus */ -#define PWR_BUS_EN_S 0 -#define PWR_VOLTS_M BITFIELD_MASK(3) /* Bit [1-3] Voltage Select */ -#define PWR_VOLTS_S 1 - -/* SD_SoftwareReset: Offset 0x02F, size = 1 byte */ -#define SW_RESET_ALL_M BITFIELD_MASK(1) /* Bit 0 Reset All */ -#define SW_RESET_ALL_S 0 -#define SW_RESET_CMD_M BITFIELD_MASK(1) /* Bit 1 CMD Line Reset */ -#define SW_RESET_CMD_S 1 -#define SW_RESET_DAT_M BITFIELD_MASK(1) /* Bit 2 DAT Line Reset */ -#define SW_RESET_DAT_S 2 - -/* SD_IntrStatus: Offset 0x030, size = 2 bytes */ -/* Defs also serve SD_IntrStatusEnable and SD_IntrSignalEnable */ -#define INTSTAT_CMD_COMPLETE_M BITFIELD_MASK(1) /* Bit 0 */ -#define INTSTAT_CMD_COMPLETE_S 0 -#define INTSTAT_XFER_COMPLETE_M BITFIELD_MASK(1) -#define INTSTAT_XFER_COMPLETE_S 1 -#define INTSTAT_BLOCK_GAP_EVENT_M BITFIELD_MASK(1) -#define INTSTAT_BLOCK_GAP_EVENT_S 2 -#define INTSTAT_DMA_INT_M BITFIELD_MASK(1) -#define INTSTAT_DMA_INT_S 3 -#define INTSTAT_BUF_WRITE_READY_M BITFIELD_MASK(1) -#define INTSTAT_BUF_WRITE_READY_S 4 -#define INTSTAT_BUF_READ_READY_M BITFIELD_MASK(1) -#define INTSTAT_BUF_READ_READY_S 5 -#define INTSTAT_CARD_INSERTION_M BITFIELD_MASK(1) -#define INTSTAT_CARD_INSERTION_S 6 -#define INTSTAT_CARD_REMOVAL_M BITFIELD_MASK(1) -#define INTSTAT_CARD_REMOVAL_S 7 -#define INTSTAT_CARD_INT_M BITFIELD_MASK(1) -#define INTSTAT_CARD_INT_S 8 -#define INTSTAT_ERROR_INT_M BITFIELD_MASK(1) /* Bit 15 */ -#define INTSTAT_ERROR_INT_S 15 - -/* SD_ErrorIntrStatus: Offset 0x032, size = 2 bytes */ -/* Defs also serve SD_ErrorIntrStatusEnable and SD_ErrorIntrSignalEnable */ -#define ERRINT_CMD_TIMEOUT_M BITFIELD_MASK(1) -#define ERRINT_CMD_TIMEOUT_S 0 -#define ERRINT_CMD_CRC_M BITFIELD_MASK(1) -#define ERRINT_CMD_CRC_S 1 -#define ERRINT_CMD_ENDBIT_M BITFIELD_MASK(1) -#define ERRINT_CMD_ENDBIT_S 2 -#define ERRINT_CMD_INDEX_M BITFIELD_MASK(1) -#define ERRINT_CMD_INDEX_S 3 -#define ERRINT_DATA_TIMEOUT_M BITFIELD_MASK(1) -#define ERRINT_DATA_TIMEOUT_S 4 -#define ERRINT_DATA_CRC_M BITFIELD_MASK(1) -#define ERRINT_DATA_CRC_S 5 -#define ERRINT_DATA_ENDBIT_M BITFIELD_MASK(1) -#define ERRINT_DATA_ENDBIT_S 6 -#define ERRINT_CURRENT_LIMIT_M BITFIELD_MASK(1) -#define ERRINT_CURRENT_LIMIT_S 7 -#define ERRINT_AUTO_CMD12_M BITFIELD_MASK(1) -#define ERRINT_AUTO_CMD12_S 8 -#define ERRINT_VENDOR_M BITFIELD_MASK(4) -#define ERRINT_VENDOR_S 12 - -/* Also provide definitions in "normal" form to allow combined masks */ -#define ERRINT_CMD_TIMEOUT_BIT 0x0001 -#define ERRINT_CMD_CRC_BIT 0x0002 -#define ERRINT_CMD_ENDBIT_BIT 0x0004 -#define ERRINT_CMD_INDEX_BIT 0x0008 -#define ERRINT_DATA_TIMEOUT_BIT 0x0010 -#define ERRINT_DATA_CRC_BIT 0x0020 -#define ERRINT_DATA_ENDBIT_BIT 0x0040 -#define ERRINT_CURRENT_LIMIT_BIT 0x0080 -#define ERRINT_AUTO_CMD12_BIT 0x0100 - -/* Masks to select CMD vs. DATA errors */ -#define ERRINT_CMD_ERRS (ERRINT_CMD_TIMEOUT_BIT | ERRINT_CMD_CRC_BIT |\ - ERRINT_CMD_ENDBIT_BIT | ERRINT_CMD_INDEX_BIT) -#define ERRINT_DATA_ERRS (ERRINT_DATA_TIMEOUT_BIT | ERRINT_DATA_CRC_BIT |\ - ERRINT_DATA_ENDBIT_BIT) -#define ERRINT_TRANSFER_ERRS (ERRINT_CMD_ERRS | ERRINT_DATA_ERRS) - -/* SD_WakeupCntr_BlockGapCntrl : Offset 0x02A , size = bytes */ -/* SD_ClockCntrl : Offset 0x02C , size = bytes */ -/* SD_SoftwareReset_TimeoutCntrl : Offset 0x02E , size = bytes */ -/* SD_IntrStatus : Offset 0x030 , size = bytes */ -/* SD_ErrorIntrStatus : Offset 0x032 , size = bytes */ -/* SD_IntrStatusEnable : Offset 0x034 , size = bytes */ -/* SD_ErrorIntrStatusEnable : Offset 0x036 , size = bytes */ -/* SD_IntrSignalEnable : Offset 0x038 , size = bytes */ -/* SD_ErrorIntrSignalEnable : Offset 0x03A , size = bytes */ -/* SD_CMD12ErrorStatus : Offset 0x03C , size = bytes */ -/* SD_Capabilities : Offset 0x040 , size = bytes */ -/* SD_MaxCurCap : Offset 0x048 , size = bytes */ -/* SD_MaxCurCap_Reserved: Offset 0x04C , size = bytes */ -/* SD_SlotInterruptStatus: Offset 0x0FC , size = bytes */ -/* SD_HostControllerVersion : Offset 0x0FE , size = bytes */ - -#endif /* _SDIOH_H */ diff --git a/drivers/net/wireless/bcm4319/include/sdiovar.h b/drivers/net/wireless/bcm4319/include/sdiovar.h deleted file mode 100644 index 0179d4cb96db..000000000000 --- a/drivers/net/wireless/bcm4319/include/sdiovar.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Structure used by apps whose drivers access SDIO drivers. - * Pulled out separately so dhdu and wlu can both use it. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: sdiovar.h,v 13.5.14.2.16.2 2009/12/08 22:34:21 Exp $ - */ - -#ifndef _sdiovar_h_ -#define _sdiovar_h_ - -#include - -/* require default structure packing */ -#define BWL_DEFAULT_PACKING -#include - -typedef struct sdreg { - int func; - int offset; - int value; -} sdreg_t; - -/* Common msglevel constants */ -#define SDH_ERROR_VAL 0x0001 /* Error */ -#define SDH_TRACE_VAL 0x0002 /* Trace */ -#define SDH_INFO_VAL 0x0004 /* Info */ -#define SDH_DEBUG_VAL 0x0008 /* Debug */ -#define SDH_DATA_VAL 0x0010 /* Data */ -#define SDH_CTRL_VAL 0x0020 /* Control Regs */ -#define SDH_LOG_VAL 0x0040 /* Enable bcmlog */ -#define SDH_DMA_VAL 0x0080 /* DMA */ - -#define NUM_PREV_TRANSACTIONS 16 - - -#include - -#endif /* _sdiovar_h_ */ diff --git a/drivers/net/wireless/bcm4319/include/siutils.h b/drivers/net/wireless/bcm4319/include/siutils.h deleted file mode 100644 index cb9f1407b73b..000000000000 --- a/drivers/net/wireless/bcm4319/include/siutils.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Misc utility routines for accessing the SOC Interconnects - * of Broadcom HNBU chips. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: siutils.h,v 13.197.4.2.4.3.8.16 2010/06/23 21:36:05 Exp $ - */ - - -#ifndef _siutils_h_ -#define _siutils_h_ - - -struct si_pub { - uint socitype; - - uint bustype; - uint buscoretype; - uint buscorerev; - uint buscoreidx; - int ccrev; - uint32 cccaps; - int pmurev; - uint32 pmucaps; - uint boardtype; - uint boardvendor; - uint boardflags; - uint chip; - uint chiprev; - uint chippkg; - uint32 chipst; - bool issim; - uint socirev; - bool pci_pr32414; -}; - -#if defined(WLC_HIGH) && !defined(WLC_LOW) -typedef struct si_pub si_t; -#else -typedef const struct si_pub si_t; -#endif - - -#define SI_OSH NULL - - -#define XTAL 0x1 -#define PLL 0x2 - - -#define CLK_FAST 0 -#define CLK_DYNAMIC 2 - - -#define GPIO_DRV_PRIORITY 0 -#define GPIO_APP_PRIORITY 1 -#define GPIO_HI_PRIORITY 2 - - -#define GPIO_PULLUP 0 -#define GPIO_PULLDN 1 - - -#define GPIO_REGEVT 0 -#define GPIO_REGEVT_INTMSK 1 -#define GPIO_REGEVT_INTPOL 2 - - -#define SI_DEVPATH_BUFSZ 16 - - -#define SI_DOATTACH 1 -#define SI_PCIDOWN 2 -#define SI_PCIUP 3 - -#define ISSIM_ENAB(sih) 0 - - -#if defined(BCMPMUCTL) -#define PMUCTL_ENAB(sih) (BCMPMUCTL) -#else -#define PMUCTL_ENAB(sih) ((sih)->cccaps & CC_CAP_PMU) -#endif - - -#if defined(BCMPMUCTL) && BCMPMUCTL -#define CCCTL_ENAB(sih) (0) -#define CCPLL_ENAB(sih) (0) -#else -#define CCCTL_ENAB(sih) ((sih)->cccaps & CC_CAP_PWR_CTL) -#define CCPLL_ENAB(sih) ((sih)->cccaps & CC_CAP_PLL_MASK) -#endif - -typedef void (*gpio_handler_t)(uint32 stat, void *arg); - - - -extern si_t *si_attach(uint pcidev, osl_t *osh, void *regs, uint bustype, - void *sdh, char **vars, uint *varsz); -extern si_t *si_kattach(osl_t *osh); -extern void si_detach(si_t *sih); -extern bool si_pci_war16165(si_t *sih); - -extern uint si_corelist(si_t *sih, uint coreid[]); -extern uint si_coreid(si_t *sih); -extern uint si_flag(si_t *sih); -extern uint si_intflag(si_t *sih); -extern uint si_coreidx(si_t *sih); -extern uint si_coreunit(si_t *sih); -extern uint si_corevendor(si_t *sih); -extern uint si_corerev(si_t *sih); -extern void *si_osh(si_t *sih); -extern void si_setosh(si_t *sih, osl_t *osh); -extern uint si_corereg(si_t *sih, uint coreidx, uint regoff, uint mask, uint val); -extern void *si_coreregs(si_t *sih); -extern void si_write_wrapperreg(si_t *sih, uint32 offset, uint32 val); -extern uint32 si_core_cflags(si_t *sih, uint32 mask, uint32 val); -extern void si_core_cflags_wo(si_t *sih, uint32 mask, uint32 val); -extern uint32 si_core_sflags(si_t *sih, uint32 mask, uint32 val); -extern bool si_iscoreup(si_t *sih); -extern uint si_findcoreidx(si_t *sih, uint coreid, uint coreunit); -extern void *si_setcoreidx(si_t *sih, uint coreidx); -extern void *si_setcore(si_t *sih, uint coreid, uint coreunit); -extern void *si_switch_core(si_t *sih, uint coreid, uint *origidx, uint *intr_val); -extern void si_restore_core(si_t *sih, uint coreid, uint intr_val); -extern int si_numaddrspaces(si_t *sih); -extern uint32 si_addrspace(si_t *sih, uint asidx); -extern uint32 si_addrspacesize(si_t *sih, uint asidx); -extern int si_corebist(si_t *sih); -extern void si_core_reset(si_t *sih, uint32 bits, uint32 resetbits); -extern void si_core_tofixup(si_t *sih); -extern void si_core_disable(si_t *sih, uint32 bits); -extern uint32 si_clock_rate(uint32 pll_type, uint32 n, uint32 m); -extern uint32 si_clock(si_t *sih); -extern void si_clock_pmu_spuravoid(si_t *sih, bool spuravoid); -extern uint32 si_alp_clock(si_t *sih); -extern uint32 si_ilp_clock(si_t *sih); -extern void si_pci_setup(si_t *sih, uint coremask); -extern void si_pcmcia_init(si_t *sih); -extern void si_setint(si_t *sih, int siflag); -extern bool si_backplane64(si_t *sih); -extern void si_register_intr_callback(si_t *sih, void *intrsoff_fn, void *intrsrestore_fn, - void *intrsenabled_fn, void *intr_arg); -extern void si_deregister_intr_callback(si_t *sih); -extern void si_clkctl_init(si_t *sih); -extern uint16 si_clkctl_fast_pwrup_delay(si_t *sih); -extern bool si_clkctl_cc(si_t *sih, uint mode); -extern int si_clkctl_xtal(si_t *sih, uint what, bool on); -extern uint32 si_gpiotimerval(si_t *sih, uint32 mask, uint32 val); -extern bool si_backplane64(si_t *sih); -extern void si_btcgpiowar(si_t *sih); -extern bool si_deviceremoved(si_t *sih); -extern uint32 si_socram_size(si_t *sih); - -extern void si_watchdog(si_t *sih, uint ticks); -extern void si_watchdog_ms(si_t *sih, uint32 ms); -extern void *si_gpiosetcore(si_t *sih); -extern uint32 si_gpiocontrol(si_t *sih, uint32 mask, uint32 val, uint8 priority); -extern uint32 si_gpioouten(si_t *sih, uint32 mask, uint32 val, uint8 priority); -extern uint32 si_gpioout(si_t *sih, uint32 mask, uint32 val, uint8 priority); -extern uint32 si_gpioin(si_t *sih); -extern uint32 si_gpiointpolarity(si_t *sih, uint32 mask, uint32 val, uint8 priority); -extern uint32 si_gpiointmask(si_t *sih, uint32 mask, uint32 val, uint8 priority); -extern uint32 si_gpioled(si_t *sih, uint32 mask, uint32 val); -extern uint32 si_gpioreserve(si_t *sih, uint32 gpio_num, uint8 priority); -extern uint32 si_gpiorelease(si_t *sih, uint32 gpio_num, uint8 priority); -extern uint32 si_gpiopull(si_t *sih, bool updown, uint32 mask, uint32 val); -extern uint32 si_gpioevent(si_t *sih, uint regtype, uint32 mask, uint32 val); -extern uint32 si_gpio_int_enable(si_t *sih, bool enable); - - -extern void *si_gpio_handler_register(si_t *sih, uint32 e, bool lev, gpio_handler_t cb, void *arg); -extern void si_gpio_handler_unregister(si_t *sih, void* gpioh); -extern void si_gpio_handler_process(si_t *sih); - - -extern bool si_pci_pmecap(si_t *sih); -struct osl_info; -extern bool si_pci_fastpmecap(struct osl_info *osh); -extern bool si_pci_pmeclr(si_t *sih); -extern void si_pci_pmeen(si_t *sih); -extern uint si_pcie_readreg(void *sih, uint addrtype, uint offset); - -extern void si_sdio_init(si_t *sih); - -extern uint16 si_d11_devid(si_t *sih); -extern int si_corepciid(si_t *sih, uint func, uint16 *pcivendor, uint16 *pcidevice, - uint8 *pciclass, uint8 *pcisubclass, uint8 *pciprogif, uint8 *pciheader); - -#define si_eci_init(sih) (0) -#define si_eci_notify_bt(sih, type, val, interrupt) (0) - - - -extern int si_devpath(si_t *sih, char *path, int size); - -extern char *si_getdevpathvar(si_t *sih, const char *name); -extern int si_getdevpathintvar(si_t *sih, const char *name); - - -extern uint8 si_pcieclkreq(si_t *sih, uint32 mask, uint32 val); -extern void si_war42780_clkreq(si_t *sih, bool clkreq); -extern void si_pci_sleep(si_t *sih); -extern void si_pci_down(si_t *sih); -extern void si_pci_up(si_t *sih); -extern void si_pcie_war_ovr_disable(si_t *sih); -extern void si_pcie_extendL1timer(si_t *sih, bool extend); -extern int si_pci_fixcfg(si_t *sih); - - - - - - - -#endif diff --git a/drivers/net/wireless/bcm4319/include/spid.h b/drivers/net/wireless/bcm4319/include/spid.h deleted file mode 100644 index c740296de9af..000000000000 --- a/drivers/net/wireless/bcm4319/include/spid.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * SPI device spec header file - * - * Copyright (C) 2010, Broadcom Corporation - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; - * the contents of this file may not be disclosed to third parties, copied - * or duplicated in any form, in whole or in part, without the prior - * written permission of Broadcom Corporation. - * - * $Id: spid.h,v 1.7.10.1.16.3 2009/04/09 19:23:14 Exp $ - */ - -#ifndef _SPI_H -#define _SPI_H - -/* - * Brcm SPI Device Register Map. - * - */ - -typedef volatile struct { - uint8 config; /* 0x00, len, endian, clock, speed, polarity, wakeup */ - uint8 response_delay; /* 0x01, read response delay in bytes (corerev < 3) */ - uint8 status_enable; /* 0x02, status-enable, intr with status, response_delay - * function selection, command/data error check - */ - uint8 reset_bp; /* 0x03, reset on wlan/bt backplane reset (corerev >= 1) */ - uint16 intr_reg; /* 0x04, Intr status register */ - uint16 intr_en_reg; /* 0x06, Intr mask register */ - uint32 status_reg; /* 0x08, RO, Status bits of last spi transfer */ - uint16 f1_info_reg; /* 0x0c, RO, enabled, ready for data transfer, blocksize */ - uint16 f2_info_reg; /* 0x0e, RO, enabled, ready for data transfer, blocksize */ - uint16 f3_info_reg; /* 0x10, RO, enabled, ready for data transfer, blocksize */ - uint32 test_read; /* 0x14, RO 0xfeedbead signature */ - uint32 test_rw; /* 0x18, RW */ - uint8 resp_delay_f0; /* 0x1c, read resp delay bytes for F0 (corerev >= 3) */ - uint8 resp_delay_f1; /* 0x1d, read resp delay bytes for F1 (corerev >= 3) */ - uint8 resp_delay_f2; /* 0x1e, read resp delay bytes for F2 (corerev >= 3) */ - uint8 resp_delay_f3; /* 0x1f, read resp delay bytes for F3 (corerev >= 3) */ -} spi_regs_t; - -/* SPI device register offsets */ -#define SPID_CONFIG 0x00 -#define SPID_RESPONSE_DELAY 0x01 -#define SPID_STATUS_ENABLE 0x02 -#define SPID_RESET_BP 0x03 /* (corerev >= 1) */ -#define SPID_INTR_REG 0x04 /* 16 bits - Interrupt status */ -#define SPID_INTR_EN_REG 0x06 /* 16 bits - Interrupt mask */ -#define SPID_STATUS_REG 0x08 /* 32 bits */ -#define SPID_F1_INFO_REG 0x0C /* 16 bits */ -#define SPID_F2_INFO_REG 0x0E /* 16 bits */ -#define SPID_F3_INFO_REG 0x10 /* 16 bits */ -#define SPID_TEST_READ 0x14 /* 32 bits */ -#define SPID_TEST_RW 0x18 /* 32 bits */ -#define SPID_RESP_DELAY_F0 0x1c /* 8 bits (corerev >= 3) */ -#define SPID_RESP_DELAY_F1 0x1d /* 8 bits (corerev >= 3) */ -#define SPID_RESP_DELAY_F2 0x1e /* 8 bits (corerev >= 3) */ -#define SPID_RESP_DELAY_F3 0x1f /* 8 bits (corerev >= 3) */ - -/* Bit masks for SPID_CONFIG device register */ -#define WORD_LENGTH_32 0x1 /* 0/1 16/32 bit word length */ -#define ENDIAN_BIG 0x2 /* 0/1 Little/Big Endian */ -#define CLOCK_PHASE 0x4 /* 0/1 clock phase delay */ -#define CLOCK_POLARITY 0x8 /* 0/1 Idle state clock polarity is low/high */ -#define HIGH_SPEED_MODE 0x10 /* 1/0 High Speed mode / Normal mode */ -#define INTR_POLARITY 0x20 /* 1/0 Interrupt active polarity is high/low */ -#define WAKE_UP 0x80 /* 0/1 Wake-up command from Host to WLAN */ - -/* Bit mask for SPID_RESPONSE_DELAY device register */ -#define RESPONSE_DELAY_MASK 0xFF /* Configurable rd response delay in multiples of 8 bits */ - -/* Bit mask for SPID_STATUS_ENABLE device register */ -#define STATUS_ENABLE 0x1 /* 1/0 Status sent/not sent to host after read/write */ -#define INTR_WITH_STATUS 0x2 /* 0/1 Do-not / do-interrupt if status is sent */ -#define RESP_DELAY_ALL 0x4 /* Applicability of resp delay to F1 or all func's read */ -#define DWORD_PKT_LEN_EN 0x8 /* Packet len denoted in dwords instead of bytes */ -#define CMD_ERR_CHK_EN 0x20 /* Command error check enable */ -#define DATA_ERR_CHK_EN 0x40 /* Data error check enable */ - -/* Bit mask for SPID_RESET_BP device register */ -#define RESET_ON_WLAN_BP_RESET 0x4 /* enable reset for WLAN backplane */ -#define RESET_ON_BT_BP_RESET 0x8 /* enable reset for BT backplane */ -#define RESET_SPI 0x80 /* reset the above enabled logic */ - -/* Bit mask for SPID_INTR_REG device register */ -#define DATA_UNAVAILABLE 0x0001 /* Requested data not available; Clear by writing a "1" */ -#define F2_F3_FIFO_RD_UNDERFLOW 0x0002 -#define F2_F3_FIFO_WR_OVERFLOW 0x0004 -#define COMMAND_ERROR 0x0008 /* Cleared by writing 1 */ -#define DATA_ERROR 0x0010 /* Cleared by writing 1 */ -#define F2_PACKET_AVAILABLE 0x0020 -#define F3_PACKET_AVAILABLE 0x0040 -#define F1_OVERFLOW 0x0080 /* Due to last write. Bkplane has pending write requests */ -#define MISC_INTR0 0x0100 -#define MISC_INTR1 0x0200 -#define MISC_INTR2 0x0400 -#define MISC_INTR3 0x0800 -#define MISC_INTR4 0x1000 -#define F1_INTR 0x2000 -#define F2_INTR 0x4000 -#define F3_INTR 0x8000 - -/* Bit mask for 32bit SPID_STATUS_REG device register */ -#define STATUS_DATA_NOT_AVAILABLE 0x00000001 -#define STATUS_UNDERFLOW 0x00000002 -#define STATUS_OVERFLOW 0x00000004 -#define STATUS_F2_INTR 0x00000008 -#define STATUS_F3_INTR 0x00000010 -#define STATUS_F2_RX_READY 0x00000020 -#define STATUS_F3_RX_READY 0x00000040 -#define STATUS_HOST_CMD_DATA_ERR 0x00000080 -#define STATUS_F2_PKT_AVAILABLE 0x00000100 -#define STATUS_F2_PKT_LEN_MASK 0x000FFE00 -#define STATUS_F2_PKT_LEN_SHIFT 9 -#define STATUS_F3_PKT_AVAILABLE 0x00100000 -#define STATUS_F3_PKT_LEN_MASK 0xFFE00000 -#define STATUS_F3_PKT_LEN_SHIFT 21 - -/* Bit mask for 16 bits SPID_F1_INFO_REG device register */ -#define F1_ENABLED 0x0001 -#define F1_RDY_FOR_DATA_TRANSFER 0x0002 -#define F1_MAX_PKT_SIZE 0x01FC - -/* Bit mask for 16 bits SPID_F2_INFO_REG device register */ -#define F2_ENABLED 0x0001 -#define F2_RDY_FOR_DATA_TRANSFER 0x0002 -#define F2_MAX_PKT_SIZE 0x3FFC - -/* Bit mask for 16 bits SPID_F3_INFO_REG device register */ -#define F3_ENABLED 0x0001 -#define F3_RDY_FOR_DATA_TRANSFER 0x0002 -#define F3_MAX_PKT_SIZE 0x3FFC - -/* Bit mask for 32 bits SPID_TEST_READ device register read in 16bit LE mode */ -#define TEST_RO_DATA_32BIT_LE 0xFEEDBEAD - -/* Maximum number of I/O funcs */ -#define SPI_MAX_IOFUNCS 4 - -#define SPI_MAX_PKT_LEN (2048*4) - -/* Misc defines */ -#define SPI_FUNC_0 0 -#define SPI_FUNC_1 1 -#define SPI_FUNC_2 2 -#define SPI_FUNC_3 3 - -#define WAIT_F2RXFIFORDY 100 -#define WAIT_F2RXFIFORDY_DELAY 20 - -#endif /* _SPI_H */ diff --git a/drivers/net/wireless/bcm4319/include/trxhdr.h b/drivers/net/wireless/bcm4319/include/trxhdr.h deleted file mode 100644 index 8f5eed9410eb..000000000000 --- a/drivers/net/wireless/bcm4319/include/trxhdr.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * TRX image file header format. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: trxhdr.h,v 13.11.310.1 2008/08/17 12:58:58 Exp $ - */ - -#include - -#define TRX_MAGIC 0x30524448 /* "HDR0" */ -#define TRX_VERSION 1 /* Version 1 */ -#define TRX_MAX_LEN 0x3A0000 /* Max length */ -#define TRX_NO_HEADER 1 /* Do not write TRX header */ -#define TRX_GZ_FILES 0x2 /* Contains up to TRX_MAX_OFFSET individual gzip files */ -#define TRX_MAX_OFFSET 3 /* Max number of individual files */ -#define TRX_UNCOMP_IMAGE 0x20 /* Trx contains uncompressed rtecdc.bin image */ - -struct trx_header { - uint32 magic; /* "HDR0" */ - uint32 len; /* Length of file including header */ - uint32 crc32; /* 32-bit CRC from flag_version to end of file */ - uint32 flag_version; /* 0:15 flags, 16:31 version */ - uint32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions from start of header */ -}; - -/* Compatibility */ -typedef struct trx_header TRXHDR, *PTRXHDR; diff --git a/drivers/net/wireless/bcm4319/include/typedefs.h b/drivers/net/wireless/bcm4319/include/typedefs.h deleted file mode 100644 index 4d9dd761ed64..000000000000 --- a/drivers/net/wireless/bcm4319/include/typedefs.h +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * $Id: typedefs.h,v 1.85.34.1.2.5 2009/01/27 04:09:40 Exp $ - */ - - -#ifndef _TYPEDEFS_H_ -#define _TYPEDEFS_H_ - -#ifdef SITE_TYPEDEFS - - - -#include "site_typedefs.h" - -#else - - - -#ifdef __cplusplus - -#define TYPEDEF_BOOL -#ifndef FALSE -#define FALSE false -#endif -#ifndef TRUE -#define TRUE true -#endif - -#else - - -#endif - -#if defined(__x86_64__) -#define TYPEDEF_UINTPTR -typedef unsigned long long int uintptr; -#endif - - - - -#if defined(TARGETOS_nucleus) - -#include - - -#define TYPEDEF_FLOAT_T -#endif - -#if defined(_NEED_SIZE_T_) -typedef long unsigned int size_t; -#endif - -#ifdef __DJGPP__ -typedef long unsigned int size_t; -#endif - - - - - -#define TYPEDEF_UINT -#ifndef TARGETENV_android -#define TYPEDEF_USHORT -#define TYPEDEF_ULONG -#endif -#ifdef __KERNEL__ -#include -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) -#define TYPEDEF_BOOL -#endif -#endif - - - - - -#if defined(__GNUC__) && defined(__STRICT_ANSI__) -#define TYPEDEF_INT64 -#define TYPEDEF_UINT64 -#endif - - -#if defined(__ICL) - -#define TYPEDEF_INT64 - -#if defined(__STDC__) -#define TYPEDEF_UINT64 -#endif - -#endif - -#if !defined(__DJGPP__) && !defined(TARGETOS_nucleus) - - -#if defined(__KERNEL__) - -#include - -#else - - -#include - -#endif - -#endif - - - - -#define USE_TYPEDEF_DEFAULTS - -#endif - - - - -#ifdef USE_TYPEDEF_DEFAULTS -#undef USE_TYPEDEF_DEFAULTS - -#ifndef TYPEDEF_BOOL -typedef unsigned char bool; -#endif - - - -#ifndef TYPEDEF_UCHAR -typedef unsigned char uchar; -#endif - -#ifndef TYPEDEF_USHORT -typedef unsigned short ushort; -#endif - -#ifndef TYPEDEF_UINT -typedef unsigned int uint; -#endif - -#ifndef TYPEDEF_ULONG -typedef unsigned long ulong; -#endif - - - -#ifndef TYPEDEF_UINT8 -typedef unsigned char uint8; -#endif - -#ifndef TYPEDEF_UINT16 -typedef unsigned short uint16; -#endif - -#ifndef TYPEDEF_UINT32 -typedef unsigned int uint32; -#endif - -#ifndef TYPEDEF_UINT64 -typedef unsigned long long uint64; -#endif - -#ifndef TYPEDEF_UINTPTR -typedef unsigned int uintptr; -#endif - -#ifndef TYPEDEF_INT8 -typedef signed char int8; -#endif - -#ifndef TYPEDEF_INT16 -typedef signed short int16; -#endif - -#ifndef TYPEDEF_INT32 -typedef signed int int32; -#endif - -#ifndef TYPEDEF_INT64 -typedef signed long long int64; -#endif - - - -#ifndef TYPEDEF_FLOAT32 -typedef float float32; -#endif - -#ifndef TYPEDEF_FLOAT64 -typedef double float64; -#endif - - - -#ifndef TYPEDEF_FLOAT_T - -#if defined(FLOAT32) -typedef float32 float_t; -#else -typedef float64 float_t; -#endif - -#endif - - - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef NULL -#define NULL 0 -#endif - -#ifndef OFF -#define OFF 0 -#endif - -#ifndef ON -#define ON 1 -#endif - -#define AUTO (-1) - - - -#ifndef PTRSZ -#define PTRSZ sizeof(char*) -#endif - - - -#if defined(__GNUC__) - #define BWL_COMPILER_GNU -#elif defined(__CC_ARM) - #define BWL_COMPILER_ARMCC -#else - #error "Unknown compiler!" -#endif - - -#ifndef INLINE - #if defined(BWL_COMPILER_MICROSOFT) - #define INLINE __inline - #elif defined(BWL_COMPILER_GNU) - #define INLINE __inline__ - #elif defined(BWL_COMPILER_ARMCC) - #define INLINE __inline - #else - #define INLINE - #endif -#endif - -#undef TYPEDEF_BOOL -#undef TYPEDEF_UCHAR -#undef TYPEDEF_USHORT -#undef TYPEDEF_UINT -#undef TYPEDEF_ULONG -#undef TYPEDEF_UINT8 -#undef TYPEDEF_UINT16 -#undef TYPEDEF_UINT32 -#undef TYPEDEF_UINT64 -#undef TYPEDEF_UINTPTR -#undef TYPEDEF_INT8 -#undef TYPEDEF_INT16 -#undef TYPEDEF_INT32 -#undef TYPEDEF_INT64 -#undef TYPEDEF_FLOAT32 -#undef TYPEDEF_FLOAT64 -#undef TYPEDEF_FLOAT_T - -#endif - - -#define UNUSED_PARAMETER(x) (void)(x) - - -#include - -#endif diff --git a/drivers/net/wireless/bcm4319/include/wifi_version.h b/drivers/net/wireless/bcm4319/include/wifi_version.h deleted file mode 100644 index b3ccd7249dcc..000000000000 --- a/drivers/net/wireless/bcm4319/include/wifi_version.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WIFI_VERSION_H -#define WIFI_VERSION_H - -/* - * Broadcom BCM4319 driver version. - */ -#define BCM4319_DRV_VERSION "2.00" - -#endif /* WIFI_BCM4319_VERSION_H */ diff --git a/drivers/net/wireless/bcm4319/include/wlioctl.h b/drivers/net/wireless/bcm4319/include/wlioctl.h deleted file mode 100644 index cd7725a70db4..000000000000 --- a/drivers/net/wireless/bcm4319/include/wlioctl.h +++ /dev/null @@ -1,1664 +0,0 @@ -/* - * Custom OID/ioctl definitions for - * Broadcom 802.11abg Networking Device Driver - * - * Definitions subject to change without notice. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: wlioctl.h,v 1.601.4.15.2.14.2.62.4.1 2010/11/17 03:09:28 Exp $ - */ - - -#ifndef _wlioctl_h_ -#define _wlioctl_h_ - -#include -#include -#include -#include -#include -#include - - - -#define ACTION_FRAME_SIZE 1040 - -typedef struct wl_action_frame { - struct ether_addr da; - uint16 len; - uint32 packetId; - uint8 data[ACTION_FRAME_SIZE]; -} wl_action_frame_t; - -#define WL_WIFI_ACTION_FRAME_SIZE sizeof(struct wl_action_frame) - - -#define BWL_DEFAULT_PACKING -#include - -#define RWL_ACTION_WIFI_CATEGORY 127 -#define RWL_WIFI_OUI_BYTE1 0x90 -#define RWL_WIFI_OUI_BYTE2 0x4C -#define RWL_WIFI_OUI_BYTE3 0x0F -#define RWL_WIFI_ACTION_FRAME_SIZE sizeof(struct dot11_action_wifi_vendor_specific) -#define RWL_WIFI_DEFAULT 0x00 -#define RWL_WIFI_FIND_MY_PEER 0x09 -#define RWL_WIFI_FOUND_PEER 0x0A -#define RWL_ACTION_WIFI_FRAG_TYPE 0x55 - -typedef struct ssid_info -{ - uint8 ssid_len; - uint8 ssid[32]; -} ssid_info_t; - -typedef struct cnt_rx -{ - uint32 cnt_rxundec; - uint32 cnt_rxframe; -} cnt_rx_t; - - - -#define RWL_REF_MAC_ADDRESS_OFFSET 17 -#define RWL_DUT_MAC_ADDRESS_OFFSET 23 -#define RWL_WIFI_CLIENT_CHANNEL_OFFSET 50 -#define RWL_WIFI_SERVER_CHANNEL_OFFSET 51 - - - - - -#define WL_BSS_INFO_VERSION 108 - - -typedef struct wl_bss_info { - uint32 version; - uint32 length; - struct ether_addr BSSID; - uint16 beacon_period; - uint16 capability; - uint8 SSID_len; - uint8 SSID[32]; - struct { - uint count; - uint8 rates[16]; - } rateset; - chanspec_t chanspec; - uint16 atim_window; - uint8 dtim_period; - int16 RSSI; - int8 phy_noise; - - uint8 n_cap; - uint32 nbss_cap; - uint8 ctl_ch; - uint32 reserved32[1]; - uint8 flags; - uint8 reserved[3]; - uint8 basic_mcs[MCSSET_LEN]; - - uint16 ie_offset; - uint32 ie_length; - - -} wl_bss_info_t; - -typedef struct wlc_ssid { - uint32 SSID_len; - uchar SSID[32]; -} wlc_ssid_t; - - -#define WL_BSSTYPE_INFRA 1 -#define WL_BSSTYPE_INDEP 0 -#define WL_BSSTYPE_ANY 2 - - -#define WL_SCANFLAGS_PASSIVE 0x01 -#define WL_SCANFLAGS_PROHIBITED 0x04 - -typedef struct wl_scan_params { - wlc_ssid_t ssid; - struct ether_addr bssid; - int8 bss_type; - int8 scan_type; - int32 nprobes; - int32 active_time; - int32 passive_time; - int32 home_time; - int32 channel_num; - uint16 channel_list[1]; -} wl_scan_params_t; - -#define WL_SCAN_PARAMS_FIXED_SIZE 64 - - -#define WL_SCAN_PARAMS_COUNT_MASK 0x0000ffff -#define WL_SCAN_PARAMS_NSSID_SHIFT 16 - -#define WL_SCAN_ACTION_START 1 -#define WL_SCAN_ACTION_CONTINUE 2 -#define WL_SCAN_ACTION_ABORT 3 - -#define ISCAN_REQ_VERSION 1 - - -typedef struct wl_iscan_params { - uint32 version; - uint16 action; - uint16 scan_duration; - wl_scan_params_t params; -} wl_iscan_params_t; - -#define WL_ISCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_iscan_params_t, params) + sizeof(wlc_ssid_t)) - -typedef struct wl_scan_results { - uint32 buflen; - uint32 version; - uint32 count; - wl_bss_info_t bss_info[1]; -} wl_scan_results_t; - -#define WL_SCAN_RESULTS_FIXED_SIZE 12 - - -#define WL_SCAN_RESULTS_SUCCESS 0 -#define WL_SCAN_RESULTS_PARTIAL 1 -#define WL_SCAN_RESULTS_PENDING 2 -#define WL_SCAN_RESULTS_ABORTED 3 -#define WL_SCAN_RESULTS_NO_MEM 4 - -#define ESCAN_REQ_VERSION 1 - -typedef struct wl_escan_params { - uint32 version; - uint16 action; - uint16 sync_id; - wl_scan_params_t params; -} wl_escan_params_t; - -#define WL_ESCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_escan_params_t, params) + sizeof(wlc_ssid_t)) - -typedef struct wl_escan_result { - uint32 buflen; - uint32 version; - uint16 sync_id; - uint16 bss_count; - wl_bss_info_t bss_info[1]; -} wl_escan_result_t; - -#define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(wl_escan_result_t) - sizeof(wl_bss_info_t)) - - -typedef struct wl_iscan_results { - uint32 status; - wl_scan_results_t results; -} wl_iscan_results_t; - -#define WL_ISCAN_RESULTS_FIXED_SIZE \ - (WL_SCAN_RESULTS_FIXED_SIZE + OFFSETOF(wl_iscan_results_t, results)) - -#define WL_NUMRATES 16 -typedef struct wl_rateset { - uint32 count; - uint8 rates[WL_NUMRATES]; -} wl_rateset_t; - - -typedef struct wl_uint32_list { - - uint32 count; - - uint32 element[1]; -} wl_uint32_list_t; - - -typedef struct wl_assoc_params { - struct ether_addr bssid; - uint16 bssid_cnt; - int32 chanspec_num; - chanspec_t chanspec_list[1]; -} wl_assoc_params_t; -#define WL_ASSOC_PARAMS_FIXED_SIZE (sizeof(wl_assoc_params_t) - sizeof(chanspec_t)) - - -typedef wl_assoc_params_t wl_reassoc_params_t; -#define WL_REASSOC_PARAMS_FIXED_SIZE WL_ASSOC_PARAMS_FIXED_SIZE - - -typedef struct wl_join_params { - wlc_ssid_t ssid; - wl_assoc_params_t params; -} wl_join_params_t; -#define WL_JOIN_PARAMS_FIXED_SIZE (sizeof(wl_join_params_t) - sizeof(chanspec_t)) - -#define WLC_CNTRY_BUF_SZ 4 - - -typedef enum sup_auth_status { - - WLC_SUP_DISCONNECTED = 0, - WLC_SUP_CONNECTING, - WLC_SUP_IDREQUIRED, - WLC_SUP_AUTHENTICATING, - WLC_SUP_AUTHENTICATED, - WLC_SUP_KEYXCHANGE, - WLC_SUP_KEYED, - WLC_SUP_TIMEOUT, - WLC_SUP_LAST_BASIC_STATE, - - - WLC_SUP_KEYXCHANGE_WAIT_M1 = WLC_SUP_AUTHENTICATED, - - WLC_SUP_KEYXCHANGE_PREP_M2 = WLC_SUP_KEYXCHANGE, - - WLC_SUP_KEYXCHANGE_WAIT_M3 = WLC_SUP_LAST_BASIC_STATE, - - WLC_SUP_KEYXCHANGE_PREP_M4, - WLC_SUP_KEYXCHANGE_WAIT_G1, - WLC_SUP_KEYXCHANGE_PREP_G2 -} sup_auth_status_t; - - -#define CRYPTO_ALGO_OFF 0 -#define CRYPTO_ALGO_WEP1 1 -#define CRYPTO_ALGO_TKIP 2 -#define CRYPTO_ALGO_WEP128 3 -#define CRYPTO_ALGO_AES_CCM 4 -#define CRYPTO_ALGO_AES_OCB_MSDU 5 -#define CRYPTO_ALGO_AES_OCB_MPDU 6 -#define CRYPTO_ALGO_NALG 7 -#define CRYPTO_ALGO_SMS4 11 - -#define WSEC_GEN_MIC_ERROR 0x0001 -#define WSEC_GEN_REPLAY 0x0002 -#define WSEC_GEN_ICV_ERROR 0x0004 - -#define WL_SOFT_KEY (1 << 0) -#define WL_PRIMARY_KEY (1 << 1) -#define WL_KF_RES_4 (1 << 4) -#define WL_KF_RES_5 (1 << 5) -#define WL_IBSS_PEER_GROUP_KEY (1 << 6) - -typedef struct wl_wsec_key { - uint32 index; - uint32 len; - uint8 data[DOT11_MAX_KEY_SIZE]; - uint32 pad_1[18]; - uint32 algo; - uint32 flags; - uint32 pad_2[2]; - int pad_3; - int iv_initialized; - int pad_4; - - struct { - uint32 hi; - uint16 lo; - } rxiv; - uint32 pad_5[2]; - struct ether_addr ea; -} wl_wsec_key_t; - -#define WSEC_MIN_PSK_LEN 8 -#define WSEC_MAX_PSK_LEN 64 - - -#define WSEC_PASSPHRASE (1<<0) - - -typedef struct { - ushort key_len; - ushort flags; - uint8 key[WSEC_MAX_PSK_LEN]; -} wsec_pmk_t; - - -#define WEP_ENABLED 0x0001 -#define TKIP_ENABLED 0x0002 -#define AES_ENABLED 0x0004 -#define WSEC_SWFLAG 0x0008 -#define SES_OW_ENABLED 0x0040 -#define SMS4_ENABLED 0x0100 - - -#define WPA_AUTH_DISABLED 0x0000 -#define WPA_AUTH_NONE 0x0001 -#define WPA_AUTH_UNSPECIFIED 0x0002 -#define WPA_AUTH_PSK 0x0004 - -#define WPA2_AUTH_UNSPECIFIED 0x0040 -#define WPA2_AUTH_PSK 0x0080 -#define BRCM_AUTH_PSK 0x0100 -#define BRCM_AUTH_DPT 0x0200 -#define WPA_AUTH_WAPI 0x0400 - -#define WPA_AUTH_PFN_ANY 0xffffffff - - -#define MAXPMKID 16 - -typedef struct _pmkid { - struct ether_addr BSSID; - uint8 PMKID[WPA2_PMKID_LEN]; -} pmkid_t; - -typedef struct _pmkid_list { - uint32 npmkid; - pmkid_t pmkid[1]; -} pmkid_list_t; - -typedef struct _pmkid_cand { - struct ether_addr BSSID; - uint8 preauth; -} pmkid_cand_t; - -typedef struct _pmkid_cand_list { - uint32 npmkid_cand; - pmkid_cand_t pmkid_cand[1]; -} pmkid_cand_list_t; - - - - -typedef struct { - uint32 val; - struct ether_addr ea; -} scb_val_t; - - - -typedef struct channel_info { - int hw_channel; - int target_channel; - int scan_channel; -} channel_info_t; - - -struct maclist { - uint count; - struct ether_addr ea[1]; -}; - - -typedef struct get_pktcnt { - uint rx_good_pkt; - uint rx_bad_pkt; - uint tx_good_pkt; - uint tx_bad_pkt; - uint rx_ocast_good_pkt; -} get_pktcnt_t; - - -typedef struct wl_ioctl { - uint cmd; - void *buf; - uint len; - uint8 set; - uint used; - uint needed; -} wl_ioctl_t; - - - -#define WLC_IOCTL_MAGIC 0x14e46c77 - - -#define WLC_IOCTL_VERSION 1 - -#define WLC_IOCTL_MAXLEN 8192 -#define WLC_IOCTL_SMLEN 256 -#define WLC_IOCTL_MEDLEN 1536 - - - -#define WLC_GET_MAGIC 0 -#define WLC_GET_VERSION 1 -#define WLC_UP 2 -#define WLC_DOWN 3 -#define WLC_GET_LOOP 4 -#define WLC_SET_LOOP 5 -#define WLC_DUMP 6 -#define WLC_GET_MSGLEVEL 7 -#define WLC_SET_MSGLEVEL 8 -#define WLC_GET_PROMISC 9 -#define WLC_SET_PROMISC 10 - -#define WLC_GET_RATE 12 - -#define WLC_GET_INSTANCE 14 - - - - -#define WLC_GET_INFRA 19 -#define WLC_SET_INFRA 20 -#define WLC_GET_AUTH 21 -#define WLC_SET_AUTH 22 -#define WLC_GET_BSSID 23 -#define WLC_SET_BSSID 24 -#define WLC_GET_SSID 25 -#define WLC_SET_SSID 26 -#define WLC_RESTART 27 - -#define WLC_GET_CHANNEL 29 -#define WLC_SET_CHANNEL 30 -#define WLC_GET_SRL 31 -#define WLC_SET_SRL 32 -#define WLC_GET_LRL 33 -#define WLC_SET_LRL 34 -#define WLC_GET_PLCPHDR 35 -#define WLC_SET_PLCPHDR 36 -#define WLC_GET_RADIO 37 -#define WLC_SET_RADIO 38 -#define WLC_GET_PHYTYPE 39 -#define WLC_DUMP_RATE 40 -#define WLC_SET_RATE_PARAMS 41 - - -#define WLC_GET_KEY 44 -#define WLC_SET_KEY 45 -#define WLC_GET_REGULATORY 46 -#define WLC_SET_REGULATORY 47 -#define WLC_GET_PASSIVE_SCAN 48 -#define WLC_SET_PASSIVE_SCAN 49 -#define WLC_SCAN 50 -#define WLC_SCAN_RESULTS 51 -#define WLC_DISASSOC 52 -#define WLC_REASSOC 53 -#define WLC_GET_ROAM_TRIGGER 54 -#define WLC_SET_ROAM_TRIGGER 55 -#define WLC_GET_ROAM_DELTA 56 -#define WLC_SET_ROAM_DELTA 57 -#define WLC_GET_ROAM_SCAN_PERIOD 58 -#define WLC_SET_ROAM_SCAN_PERIOD 59 -#define WLC_EVM 60 -#define WLC_GET_TXANT 61 -#define WLC_SET_TXANT 62 -#define WLC_GET_ANTDIV 63 -#define WLC_SET_ANTDIV 64 - - -#define WLC_GET_CLOSED 67 -#define WLC_SET_CLOSED 68 -#define WLC_GET_MACLIST 69 -#define WLC_SET_MACLIST 70 -#define WLC_GET_RATESET 71 -#define WLC_SET_RATESET 72 - -#define WLC_LONGTRAIN 74 -#define WLC_GET_BCNPRD 75 -#define WLC_SET_BCNPRD 76 -#define WLC_GET_DTIMPRD 77 -#define WLC_SET_DTIMPRD 78 -#define WLC_GET_SROM 79 -#define WLC_SET_SROM 80 -#define WLC_GET_WEP_RESTRICT 81 -#define WLC_SET_WEP_RESTRICT 82 -#define WLC_GET_COUNTRY 83 -#define WLC_SET_COUNTRY 84 -#define WLC_GET_PM 85 -#define WLC_SET_PM 86 -#define WLC_GET_WAKE 87 -#define WLC_SET_WAKE 88 - -#define WLC_GET_FORCELINK 90 -#define WLC_SET_FORCELINK 91 -#define WLC_FREQ_ACCURACY 92 -#define WLC_CARRIER_SUPPRESS 93 -#define WLC_GET_PHYREG 94 -#define WLC_SET_PHYREG 95 -#define WLC_GET_RADIOREG 96 -#define WLC_SET_RADIOREG 97 -#define WLC_GET_REVINFO 98 -#define WLC_GET_UCANTDIV 99 -#define WLC_SET_UCANTDIV 100 -#define WLC_R_REG 101 -#define WLC_W_REG 102 - - -#define WLC_GET_MACMODE 105 -#define WLC_SET_MACMODE 106 -#define WLC_GET_MONITOR 107 -#define WLC_SET_MONITOR 108 -#define WLC_GET_GMODE 109 -#define WLC_SET_GMODE 110 -#define WLC_GET_LEGACY_ERP 111 -#define WLC_SET_LEGACY_ERP 112 -#define WLC_GET_RX_ANT 113 -#define WLC_GET_CURR_RATESET 114 -#define WLC_GET_SCANSUPPRESS 115 -#define WLC_SET_SCANSUPPRESS 116 -#define WLC_GET_AP 117 -#define WLC_SET_AP 118 -#define WLC_GET_EAP_RESTRICT 119 -#define WLC_SET_EAP_RESTRICT 120 -#define WLC_SCB_AUTHORIZE 121 -#define WLC_SCB_DEAUTHORIZE 122 -#define WLC_GET_WDSLIST 123 -#define WLC_SET_WDSLIST 124 -#define WLC_GET_ATIM 125 -#define WLC_SET_ATIM 126 -#define WLC_GET_RSSI 127 -#define WLC_GET_PHYANTDIV 128 -#define WLC_SET_PHYANTDIV 129 -#define WLC_AP_RX_ONLY 130 -#define WLC_GET_TX_PATH_PWR 131 -#define WLC_SET_TX_PATH_PWR 132 -#define WLC_GET_WSEC 133 -#define WLC_SET_WSEC 134 -#define WLC_GET_PHY_NOISE 135 -#define WLC_GET_BSS_INFO 136 -#define WLC_GET_PKTCNTS 137 -#define WLC_GET_LAZYWDS 138 -#define WLC_SET_LAZYWDS 139 -#define WLC_GET_BANDLIST 140 -#define WLC_GET_BAND 141 -#define WLC_SET_BAND 142 -#define WLC_SCB_DEAUTHENTICATE 143 -#define WLC_GET_SHORTSLOT 144 -#define WLC_GET_SHORTSLOT_OVERRIDE 145 -#define WLC_SET_SHORTSLOT_OVERRIDE 146 -#define WLC_GET_SHORTSLOT_RESTRICT 147 -#define WLC_SET_SHORTSLOT_RESTRICT 148 -#define WLC_GET_GMODE_PROTECTION 149 -#define WLC_GET_GMODE_PROTECTION_OVERRIDE 150 -#define WLC_SET_GMODE_PROTECTION_OVERRIDE 151 -#define WLC_UPGRADE 152 - - -#define WLC_GET_IGNORE_BCNS 155 -#define WLC_SET_IGNORE_BCNS 156 -#define WLC_GET_SCB_TIMEOUT 157 -#define WLC_SET_SCB_TIMEOUT 158 -#define WLC_GET_ASSOCLIST 159 -#define WLC_GET_CLK 160 -#define WLC_SET_CLK 161 -#define WLC_GET_UP 162 -#define WLC_OUT 163 -#define WLC_GET_WPA_AUTH 164 -#define WLC_SET_WPA_AUTH 165 -#define WLC_GET_UCFLAGS 166 -#define WLC_SET_UCFLAGS 167 -#define WLC_GET_PWRIDX 168 -#define WLC_SET_PWRIDX 169 -#define WLC_GET_TSSI 170 -#define WLC_GET_SUP_RATESET_OVERRIDE 171 -#define WLC_SET_SUP_RATESET_OVERRIDE 172 - - - - - -#define WLC_GET_PROTECTION_CONTROL 178 -#define WLC_SET_PROTECTION_CONTROL 179 -#define WLC_GET_PHYLIST 180 -#define WLC_ENCRYPT_STRENGTH 181 -#define WLC_DECRYPT_STATUS 182 -#define WLC_GET_KEY_SEQ 183 -#define WLC_GET_SCAN_CHANNEL_TIME 184 -#define WLC_SET_SCAN_CHANNEL_TIME 185 -#define WLC_GET_SCAN_UNASSOC_TIME 186 -#define WLC_SET_SCAN_UNASSOC_TIME 187 -#define WLC_GET_SCAN_HOME_TIME 188 -#define WLC_SET_SCAN_HOME_TIME 189 -#define WLC_GET_SCAN_NPROBES 190 -#define WLC_SET_SCAN_NPROBES 191 -#define WLC_GET_PRB_RESP_TIMEOUT 192 -#define WLC_SET_PRB_RESP_TIMEOUT 193 -#define WLC_GET_ATTEN 194 -#define WLC_SET_ATTEN 195 -#define WLC_GET_SHMEM 196 -#define WLC_SET_SHMEM 197 - - -#define WLC_SET_WSEC_TEST 200 -#define WLC_SCB_DEAUTHENTICATE_FOR_REASON 201 -#define WLC_TKIP_COUNTERMEASURES 202 -#define WLC_GET_PIOMODE 203 -#define WLC_SET_PIOMODE 204 -#define WLC_SET_ASSOC_PREFER 205 -#define WLC_GET_ASSOC_PREFER 206 -#define WLC_SET_ROAM_PREFER 207 -#define WLC_GET_ROAM_PREFER 208 -#define WLC_SET_LED 209 -#define WLC_GET_LED 210 -#define WLC_GET_INTERFERENCE_MODE 211 -#define WLC_SET_INTERFERENCE_MODE 212 -#define WLC_GET_CHANNEL_QA 213 -#define WLC_START_CHANNEL_QA 214 -#define WLC_GET_CHANNEL_SEL 215 -#define WLC_START_CHANNEL_SEL 216 -#define WLC_GET_VALID_CHANNELS 217 -#define WLC_GET_FAKEFRAG 218 -#define WLC_SET_FAKEFRAG 219 -#define WLC_GET_PWROUT_PERCENTAGE 220 -#define WLC_SET_PWROUT_PERCENTAGE 221 -#define WLC_SET_BAD_FRAME_PREEMPT 222 -#define WLC_GET_BAD_FRAME_PREEMPT 223 -#define WLC_SET_LEAP_LIST 224 -#define WLC_GET_LEAP_LIST 225 -#define WLC_GET_CWMIN 226 -#define WLC_SET_CWMIN 227 -#define WLC_GET_CWMAX 228 -#define WLC_SET_CWMAX 229 -#define WLC_GET_WET 230 -#define WLC_SET_WET 231 -#define WLC_GET_PUB 232 - - -#define WLC_GET_KEY_PRIMARY 235 -#define WLC_SET_KEY_PRIMARY 236 - -#define WLC_GET_ACI_ARGS 238 -#define WLC_SET_ACI_ARGS 239 -#define WLC_UNSET_CALLBACK 240 -#define WLC_SET_CALLBACK 241 -#define WLC_GET_RADAR 242 -#define WLC_SET_RADAR 243 -#define WLC_SET_SPECT_MANAGMENT 244 -#define WLC_GET_SPECT_MANAGMENT 245 -#define WLC_WDS_GET_REMOTE_HWADDR 246 -#define WLC_WDS_GET_WPA_SUP 247 -#define WLC_SET_CS_SCAN_TIMER 248 -#define WLC_GET_CS_SCAN_TIMER 249 -#define WLC_MEASURE_REQUEST 250 -#define WLC_INIT 251 -#define WLC_SEND_QUIET 252 -#define WLC_KEEPALIVE 253 -#define WLC_SEND_PWR_CONSTRAINT 254 -#define WLC_UPGRADE_STATUS 255 -#define WLC_CURRENT_PWR 256 -#define WLC_GET_SCAN_PASSIVE_TIME 257 -#define WLC_SET_SCAN_PASSIVE_TIME 258 -#define WLC_LEGACY_LINK_BEHAVIOR 259 -#define WLC_GET_CHANNELS_IN_COUNTRY 260 -#define WLC_GET_COUNTRY_LIST 261 -#define WLC_GET_VAR 262 -#define WLC_SET_VAR 263 -#define WLC_NVRAM_GET 264 -#define WLC_NVRAM_SET 265 -#define WLC_NVRAM_DUMP 266 -#define WLC_REBOOT 267 -#define WLC_SET_WSEC_PMK 268 -#define WLC_GET_AUTH_MODE 269 -#define WLC_SET_AUTH_MODE 270 -#define WLC_GET_WAKEENTRY 271 -#define WLC_SET_WAKEENTRY 272 -#define WLC_NDCONFIG_ITEM 273 -#define WLC_NVOTPW 274 -#define WLC_OTPW 275 -#define WLC_IOV_BLOCK_GET 276 -#define WLC_IOV_MODULES_GET 277 -#define WLC_SOFT_RESET 278 -#define WLC_GET_ALLOW_MODE 279 -#define WLC_SET_ALLOW_MODE 280 -#define WLC_GET_DESIRED_BSSID 281 -#define WLC_SET_DESIRED_BSSID 282 -#define WLC_DISASSOC_MYAP 283 -#define WLC_GET_NBANDS 284 -#define WLC_GET_BANDSTATES 285 -#define WLC_GET_WLC_BSS_INFO 286 -#define WLC_GET_ASSOC_INFO 287 -#define WLC_GET_OID_PHY 288 -#define WLC_SET_OID_PHY 289 -#define WLC_SET_ASSOC_TIME 290 -#define WLC_GET_DESIRED_SSID 291 -#define WLC_GET_CHANSPEC 292 -#define WLC_GET_ASSOC_STATE 293 -#define WLC_SET_PHY_STATE 294 -#define WLC_GET_SCAN_PENDING 295 -#define WLC_GET_SCANREQ_PENDING 296 -#define WLC_GET_PREV_ROAM_REASON 297 -#define WLC_SET_PREV_ROAM_REASON 298 -#define WLC_GET_BANDSTATES_PI 299 -#define WLC_GET_PHY_STATE 300 -#define WLC_GET_BSS_WPA_RSN 301 -#define WLC_GET_BSS_WPA2_RSN 302 -#define WLC_GET_BSS_BCN_TS 303 -#define WLC_GET_INT_DISASSOC 304 -#define WLC_SET_NUM_PEERS 305 -#define WLC_GET_NUM_BSS 306 -#define WLC_LAST 307 - - - -#define WL_RADIO_SW_DISABLE (1<<0) -#define WL_RADIO_HW_DISABLE (1<<1) -#define WL_RADIO_MPC_DISABLE (1<<2) -#define WL_RADIO_COUNTRY_DISABLE (1<<3) - - -#define WL_TXPWR_OVERRIDE (1U<<31) - -#define WL_PHY_PAVARS_LEN 6 - - -#define WL_DIAG_INTERRUPT 1 -#define WL_DIAG_LOOPBACK 2 -#define WL_DIAG_MEMORY 3 -#define WL_DIAG_LED 4 -#define WL_DIAG_REG 5 -#define WL_DIAG_SROM 6 -#define WL_DIAG_DMA 7 - -#define WL_DIAGERR_SUCCESS 0 -#define WL_DIAGERR_FAIL_TO_RUN 1 -#define WL_DIAGERR_NOT_SUPPORTED 2 -#define WL_DIAGERR_INTERRUPT_FAIL 3 -#define WL_DIAGERR_LOOPBACK_FAIL 4 -#define WL_DIAGERR_SROM_FAIL 5 -#define WL_DIAGERR_SROM_BADCRC 6 -#define WL_DIAGERR_REG_FAIL 7 -#define WL_DIAGERR_MEMORY_FAIL 8 -#define WL_DIAGERR_NOMEM 9 -#define WL_DIAGERR_DMA_FAIL 10 - -#define WL_DIAGERR_MEMORY_TIMEOUT 11 -#define WL_DIAGERR_MEMORY_BADPATTERN 12 - - -#define WLC_BAND_AUTO 0 -#define WLC_BAND_5G 1 -#define WLC_BAND_2G 2 -#define WLC_BAND_ALL 3 - - -#define WL_CHAN_FREQ_RANGE_2G 0 -#define WL_CHAN_FREQ_RANGE_5GL 1 -#define WL_CHAN_FREQ_RANGE_5GM 2 -#define WL_CHAN_FREQ_RANGE_5GH 3 - - -#define WLC_PHY_TYPE_A 0 -#define WLC_PHY_TYPE_B 1 -#define WLC_PHY_TYPE_G 2 -#define WLC_PHY_TYPE_N 4 -#define WLC_PHY_TYPE_LP 5 -#define WLC_PHY_TYPE_SSN 6 -#define WLC_PHY_TYPE_NULL 0xf - - -#define WLC_MACMODE_DISABLED 0 -#define WLC_MACMODE_DENY 1 -#define WLC_MACMODE_ALLOW 2 - - -#define GMODE_LEGACY_B 0 -#define GMODE_AUTO 1 -#define GMODE_ONLY 2 -#define GMODE_B_DEFERRED 3 -#define GMODE_PERFORMANCE 4 -#define GMODE_LRS 5 -#define GMODE_MAX 6 - - -#define WLC_PLCP_AUTO -1 -#define WLC_PLCP_SHORT 0 -#define WLC_PLCP_LONG 1 - - -#define WLC_PROTECTION_AUTO -1 -#define WLC_PROTECTION_OFF 0 -#define WLC_PROTECTION_ON 1 -#define WLC_PROTECTION_MMHDR_ONLY 2 -#define WLC_PROTECTION_CTS_ONLY 3 - - -#define WLC_PROTECTION_CTL_OFF 0 -#define WLC_PROTECTION_CTL_LOCAL 1 -#define WLC_PROTECTION_CTL_OVERLAP 2 - - -#define WLC_N_PROTECTION_OFF 0 -#define WLC_N_PROTECTION_OPTIONAL 1 -#define WLC_N_PROTECTION_20IN40 2 -#define WLC_N_PROTECTION_MIXEDMODE 3 - - -#define WLC_N_PREAMBLE_MIXEDMODE 0 -#define WLC_N_PREAMBLE_GF 1 - - -#define WLC_N_BW_20ALL 0 -#define WLC_N_BW_40ALL 1 -#define WLC_N_BW_20IN2G_40IN5G 2 - - -#define WLC_N_TXRX_CHAIN0 0 -#define WLC_N_TXRX_CHAIN1 1 - - -#define WLC_N_SGI_20 0x01 -#define WLC_N_SGI_40 0x02 - - -#define PM_OFF 0 -#define PM_MAX 1 -#define PM_FAST 2 - -#define LISTEN_INTERVAL 20 - -#define INTERFERE_NONE 0 -#define NON_WLAN 1 -#define WLAN_MANUAL 2 -#define WLAN_AUTO 3 -#define AUTO_ACTIVE (1 << 7) - -typedef struct wl_aci_args { - int enter_aci_thresh; - int exit_aci_thresh; - int usec_spin; - int glitch_delay; - uint16 nphy_adcpwr_enter_thresh; - uint16 nphy_adcpwr_exit_thresh; - uint16 nphy_repeat_ctr; - uint16 nphy_num_samples; - uint16 nphy_undetect_window_sz; - uint16 nphy_b_energy_lo_aci; - uint16 nphy_b_energy_md_aci; - uint16 nphy_b_energy_hi_aci; -} wl_aci_args_t; - -#define WL_ACI_ARGS_LEGACY_LENGTH 16 - - - -#define WL_ERROR_VAL 0x00000001 -#define WL_TRACE_VAL 0x00000002 -#define WL_PRHDRS_VAL 0x00000004 -#define WL_PRPKT_VAL 0x00000008 -#define WL_INFORM_VAL 0x00000010 -#define WL_TMP_VAL 0x00000020 -#define WL_OID_VAL 0x00000040 -#define WL_RATE_VAL 0x00000080 -#define WL_ASSOC_VAL 0x00000100 -#define WL_PRUSR_VAL 0x00000200 -#define WL_PS_VAL 0x00000400 -#define WL_TXPWR_VAL 0x00000800 -#define WL_PORT_VAL 0x00001000 -#define WL_DUAL_VAL 0x00002000 -#define WL_WSEC_VAL 0x00004000 -#define WL_WSEC_DUMP_VAL 0x00008000 -#define WL_LOG_VAL 0x00010000 -#define WL_NRSSI_VAL 0x00020000 -#define WL_LOFT_VAL 0x00040000 -#define WL_REGULATORY_VAL 0x00080000 -#define WL_PHYCAL_VAL 0x00100000 -#define WL_RADAR_VAL 0x00200000 -#define WL_MPC_VAL 0x00400000 -#define WL_APSTA_VAL 0x00800000 -#define WL_DFS_VAL 0x01000000 -#define WL_BA_VAL 0x02000000 -#define WL_MBSS_VAL 0x04000000 -#define WL_CAC_VAL 0x08000000 -#define WL_AMSDU_VAL 0x10000000 -#define WL_AMPDU_VAL 0x20000000 -#define WL_FFPLD_VAL 0x40000000 - - -#define WL_DPT_VAL 0x00000001 -#define WL_SCAN_VAL 0x00000002 -#define WL_WOWL_VAL 0x00000004 -#define WL_COEX_VAL 0x00000008 -#define WL_RTDC_VAL 0x00000010 -#define WL_BTA_VAL 0x00000040 - - -#define WL_LED_NUMGPIO 16 - - -#define WL_LED_OFF 0 -#define WL_LED_ON 1 -#define WL_LED_ACTIVITY 2 -#define WL_LED_RADIO 3 -#define WL_LED_ARADIO 4 -#define WL_LED_BRADIO 5 -#define WL_LED_BGMODE 6 -#define WL_LED_WI1 7 -#define WL_LED_WI2 8 -#define WL_LED_WI3 9 -#define WL_LED_ASSOC 10 -#define WL_LED_INACTIVE 11 -#define WL_LED_ASSOCACT 12 -#define WL_LED_NUMBEHAVIOR 13 - - -#define WL_LED_BEH_MASK 0x7f -#define WL_LED_AL_MASK 0x80 - - -#define WL_NUMCHANNELS 64 -#define WL_NUMCHANSPECS 100 - - -#define WL_WDS_WPA_ROLE_AUTH 0 -#define WL_WDS_WPA_ROLE_SUP 1 -#define WL_WDS_WPA_ROLE_AUTO 255 - - -#define WL_EVENTING_MASK_LEN 16 - - -#define VNDR_IE_CMD_LEN 4 - - -#define VNDR_IE_BEACON_FLAG 0x1 -#define VNDR_IE_PRBRSP_FLAG 0x2 -#define VNDR_IE_ASSOCRSP_FLAG 0x4 -#define VNDR_IE_AUTHRSP_FLAG 0x8 -#define VNDR_IE_PRBREQ_FLAG 0x10 -#define VNDR_IE_ASSOCREQ_FLAG 0x20 -#define VNDR_IE_CUSTOM_FLAG 0x100 - -#define VNDR_IE_INFO_HDR_LEN (sizeof(uint32)) - -typedef struct { - uint32 pktflag; - vndr_ie_t vndr_ie_data; -} vndr_ie_info_t; - -typedef struct { - int iecount; - vndr_ie_info_t vndr_ie_list[1]; -} vndr_ie_buf_t; - -typedef struct { - char cmd[VNDR_IE_CMD_LEN]; - vndr_ie_buf_t vndr_ie_buffer; -} vndr_ie_setbuf_t; - - - - -#define WL_JOIN_PREF_RSSI 1 -#define WL_JOIN_PREF_WPA 2 -#define WL_JOIN_PREF_BAND 3 - - -#define WLJP_BAND_ASSOC_PREF 255 - - -#define WL_WPA_ACP_MCS_ANY "\x00\x00\x00\x00" - -struct tsinfo_arg { - uint8 octets[3]; -}; - - -#define NFIFO 6 - -#define WL_CNT_T_VERSION 5 -#define WL_CNT_EXT_T_VERSION 1 - -typedef struct { - uint16 version; - uint16 length; - - - uint32 txframe; - uint32 txbyte; - uint32 txretrans; - uint32 txerror; - uint32 txctl; - uint32 txprshort; - uint32 txserr; - uint32 txnobuf; - uint32 txnoassoc; - uint32 txrunt; - uint32 txchit; - uint32 txcmiss; - - - uint32 txuflo; - uint32 txphyerr; - uint32 txphycrs; - - - uint32 rxframe; - uint32 rxbyte; - uint32 rxerror; - uint32 rxctl; - uint32 rxnobuf; - uint32 rxnondata; - uint32 rxbadds; - uint32 rxbadcm; - uint32 rxfragerr; - uint32 rxrunt; - uint32 rxgiant; - uint32 rxnoscb; - uint32 rxbadproto; - uint32 rxbadsrcmac; - uint32 rxbadda; - uint32 rxfilter; - - - uint32 rxoflo; - uint32 rxuflo[NFIFO]; - - uint32 d11cnt_txrts_off; - uint32 d11cnt_rxcrc_off; - uint32 d11cnt_txnocts_off; - - - uint32 dmade; - uint32 dmada; - uint32 dmape; - uint32 reset; - uint32 tbtt; - uint32 txdmawar; - uint32 pkt_callback_reg_fail; - - - uint32 txallfrm; - uint32 txrtsfrm; - uint32 txctsfrm; - uint32 txackfrm; - uint32 txdnlfrm; - uint32 txbcnfrm; - uint32 txfunfl[8]; - uint32 txtplunfl; - uint32 txphyerror; - uint32 rxfrmtoolong; - uint32 rxfrmtooshrt; - uint32 rxinvmachdr; - uint32 rxbadfcs; - uint32 rxbadplcp; - uint32 rxcrsglitch; - uint32 rxstrt; - uint32 rxdfrmucastmbss; - uint32 rxmfrmucastmbss; - uint32 rxcfrmucast; - uint32 rxrtsucast; - uint32 rxctsucast; - uint32 rxackucast; - uint32 rxdfrmocast; - uint32 rxmfrmocast; - uint32 rxcfrmocast; - uint32 rxrtsocast; - uint32 rxctsocast; - uint32 rxdfrmmcast; - uint32 rxmfrmmcast; - uint32 rxcfrmmcast; - uint32 rxbeaconmbss; - uint32 rxdfrmucastobss; - uint32 rxbeaconobss; - uint32 rxrsptmout; - uint32 bcntxcancl; - uint32 rxf0ovfl; - uint32 rxf1ovfl; - uint32 rxf2ovfl; - uint32 txsfovfl; - uint32 pmqovfl; - uint32 rxcgprqfrm; - uint32 rxcgprsqovfl; - uint32 txcgprsfail; - uint32 txcgprssuc; - uint32 prs_timeout; - uint32 rxnack; - uint32 frmscons; - uint32 txnack; - uint32 txglitch_nack; - uint32 txburst; - - - uint32 txfrag; - uint32 txmulti; - uint32 txfail; - uint32 txretry; - uint32 txretrie; - uint32 rxdup; - uint32 txrts; - uint32 txnocts; - uint32 txnoack; - uint32 rxfrag; - uint32 rxmulti; - uint32 rxcrc; - uint32 txfrmsnt; - uint32 rxundec; - - - uint32 tkipmicfaill; - uint32 tkipcntrmsr; - uint32 tkipreplay; - uint32 ccmpfmterr; - uint32 ccmpreplay; - uint32 ccmpundec; - uint32 fourwayfail; - uint32 wepundec; - uint32 wepicverr; - uint32 decsuccess; - uint32 tkipicverr; - uint32 wepexcluded; - - uint32 txchanrej; - uint32 psmwds; - uint32 phywatchdog; - - - uint32 prq_entries_handled; - uint32 prq_undirected_entries; - uint32 prq_bad_entries; - uint32 atim_suppress_count; - uint32 bcn_template_not_ready; - uint32 bcn_template_not_ready_done; - uint32 late_tbtt_dpc; - - - uint32 rx1mbps; - uint32 rx2mbps; - uint32 rx5mbps5; - uint32 rx6mbps; - uint32 rx9mbps; - uint32 rx11mbps; - uint32 rx12mbps; - uint32 rx18mbps; - uint32 rx24mbps; - uint32 rx36mbps; - uint32 rx48mbps; - uint32 rx54mbps; - uint32 rx108mbps; - uint32 rx162mbps; - uint32 rx216mbps; - uint32 rx270mbps; - uint32 rx324mbps; - uint32 rx378mbps; - uint32 rx432mbps; - uint32 rx486mbps; - uint32 rx540mbps; - - uint32 pktengrxducast; - uint32 pktengrxdmcast; -} wl_cnt_t; - -typedef struct { - uint16 version; - uint16 length; - - uint32 rxampdu_sgi; - uint32 rxampdu_stbc; - uint32 rxmpdu_sgi; - uint32 rxmpdu_stbc; - uint32 rxmcs0_40M; - uint32 rxmcs1_40M; - uint32 rxmcs2_40M; - uint32 rxmcs3_40M; - uint32 rxmcs4_40M; - uint32 rxmcs5_40M; - uint32 rxmcs6_40M; - uint32 rxmcs7_40M; - uint32 rxmcs32_40M; - - uint32 txfrmsnt_20Mlo; - uint32 txfrmsnt_20Mup; - uint32 txfrmsnt_40M; - - uint32 rx_20ul; -} wl_cnt_ext_t; - -#define WL_RXDIV_STATS_T_VERSION 1 -typedef struct { - uint16 version; - uint16 length; - - uint32 rxant[4]; -} wl_rxdiv_stats_t; - -#define WL_DELTA_STATS_T_VERSION 1 - -typedef struct { - uint16 version; - uint16 length; - - - uint32 txframe; - uint32 txbyte; - uint32 txretrans; - uint32 txfail; - - - uint32 rxframe; - uint32 rxbyte; - - - uint32 rx1mbps; - uint32 rx2mbps; - uint32 rx5mbps5; - uint32 rx6mbps; - uint32 rx9mbps; - uint32 rx11mbps; - uint32 rx12mbps; - uint32 rx18mbps; - uint32 rx24mbps; - uint32 rx36mbps; - uint32 rx48mbps; - uint32 rx54mbps; - uint32 rx108mbps; - uint32 rx162mbps; - uint32 rx216mbps; - uint32 rx270mbps; - uint32 rx324mbps; - uint32 rx378mbps; - uint32 rx432mbps; - uint32 rx486mbps; - uint32 rx540mbps; -} wl_delta_stats_t; - -#define WL_WME_CNT_VERSION 1 - -typedef struct { - uint32 packets; - uint32 bytes; -} wl_traffic_stats_t; - -typedef struct { - uint16 version; - uint16 length; - - wl_traffic_stats_t tx[AC_COUNT]; - wl_traffic_stats_t tx_failed[AC_COUNT]; - wl_traffic_stats_t rx[AC_COUNT]; - wl_traffic_stats_t rx_failed[AC_COUNT]; - - wl_traffic_stats_t forward[AC_COUNT]; - - wl_traffic_stats_t tx_expired[AC_COUNT]; - -} wl_wme_cnt_t; - - - -#define WLC_ROAM_TRIGGER_DEFAULT 0 -#define WLC_ROAM_TRIGGER_BANDWIDTH 1 -#define WLC_ROAM_TRIGGER_DISTANCE 2 -#define WLC_ROAM_TRIGGER_MAX_VALUE 2 - - -enum { - PFN_LIST_ORDER, - PFN_RSSI -}; - -enum { - DISABLE, - ENABLE -}; - -#define SORT_CRITERIA_BIT 0 -#define AUTO_NET_SWITCH_BIT 1 -#define ENABLE_BKGRD_SCAN_BIT 2 -#define IMMEDIATE_SCAN_BIT 3 -#define AUTO_CONNECT_BIT 4 - -#define SORT_CRITERIA_MASK 0x01 -#define AUTO_NET_SWITCH_MASK 0x02 -#define ENABLE_BKGRD_SCAN_MASK 0x04 -#define IMMEDIATE_SCAN_MASK 0x08 -#define AUTO_CONNECT_MASK 0x10 - -#define PFN_VERSION 1 - -#define MAX_PFN_LIST_COUNT 16 - - -typedef struct wl_pfn_param { - int32 version; - int32 scan_freq; - int32 lost_network_timeout; - int16 flags; - int16 rssi_margin; -} wl_pfn_param_t; - -typedef struct wl_pfn { - wlc_ssid_t ssid; - int32 bss_type; - int32 infra; - int32 auth; - uint32 wpa_auth; - int32 wsec; -#ifdef WLPFN_AUTO_CONNECT - union { - wl_wsec_key_t sec_key; - wsec_pmk_t wpa_sec_key; - } pfn_security; -#endif -} wl_pfn_t; - - -#define TOE_TX_CSUM_OL 0x00000001 -#define TOE_RX_CSUM_OL 0x00000002 - - -#define TOE_ERRTEST_TX_CSUM 0x00000001 -#define TOE_ERRTEST_RX_CSUM 0x00000002 -#define TOE_ERRTEST_RX_CSUM2 0x00000004 - -struct toe_ol_stats_t { - - uint32 tx_summed; - - - uint32 tx_iph_fill; - uint32 tx_tcp_fill; - uint32 tx_udp_fill; - uint32 tx_icmp_fill; - - - uint32 rx_iph_good; - uint32 rx_iph_bad; - uint32 rx_tcp_good; - uint32 rx_tcp_bad; - uint32 rx_udp_good; - uint32 rx_udp_bad; - uint32 rx_icmp_good; - uint32 rx_icmp_bad; - - - uint32 tx_tcp_errinj; - uint32 tx_udp_errinj; - uint32 tx_icmp_errinj; - - - uint32 rx_tcp_errinj; - uint32 rx_udp_errinj; - uint32 rx_icmp_errinj; -}; - - -#define ARP_OL_AGENT 0x00000001 -#define ARP_OL_SNOOP 0x00000002 -#define ARP_OL_HOST_AUTO_REPLY 0x00000004 -#define ARP_OL_PEER_AUTO_REPLY 0x00000008 - - -#define ARP_ERRTEST_REPLY_PEER 0x1 -#define ARP_ERRTEST_REPLY_HOST 0x2 - -#define ARP_MULTIHOMING_MAX 8 - - -struct arp_ol_stats_t { - uint32 host_ip_entries; - uint32 host_ip_overflow; - - uint32 arp_table_entries; - uint32 arp_table_overflow; - - uint32 host_request; - uint32 host_reply; - uint32 host_service; - - uint32 peer_request; - uint32 peer_request_drop; - uint32 peer_reply; - uint32 peer_reply_drop; - uint32 peer_service; -}; - - - - - -typedef struct wl_keep_alive_pkt { - uint32 period_msec; - uint16 len_bytes; - uint8 data[1]; -} wl_keep_alive_pkt_t; - -#define WL_KEEP_ALIVE_FIXED_LEN OFFSETOF(wl_keep_alive_pkt_t, data) - - - - - -typedef enum wl_pkt_filter_type { - WL_PKT_FILTER_TYPE_PATTERN_MATCH -} wl_pkt_filter_type_t; - -#define WL_PKT_FILTER_TYPE wl_pkt_filter_type_t - - -typedef struct wl_pkt_filter_pattern { - uint32 offset; - uint32 size_bytes; - uint8 mask_and_pattern[1]; -} wl_pkt_filter_pattern_t; - - -typedef struct wl_pkt_filter { - uint32 id; - uint32 type; - uint32 negate_match; - union { - wl_pkt_filter_pattern_t pattern; - } u; -} wl_pkt_filter_t; - -#define WL_PKT_FILTER_FIXED_LEN OFFSETOF(wl_pkt_filter_t, u) -#define WL_PKT_FILTER_PATTERN_FIXED_LEN OFFSETOF(wl_pkt_filter_pattern_t, mask_and_pattern) - - -typedef struct wl_pkt_filter_enable { - uint32 id; - uint32 enable; -} wl_pkt_filter_enable_t; - - -typedef struct wl_pkt_filter_list { - uint32 num; - wl_pkt_filter_t filter[1]; -} wl_pkt_filter_list_t; - -#define WL_PKT_FILTER_LIST_FIXED_LEN OFFSETOF(wl_pkt_filter_list_t, filter) - - -typedef struct wl_pkt_filter_stats { - uint32 num_pkts_matched; - uint32 num_pkts_forwarded; - uint32 num_pkts_discarded; -} wl_pkt_filter_stats_t; - - -typedef struct wl_seq_cmd_ioctl { - uint32 cmd; - uint32 len; -} wl_seq_cmd_ioctl_t; - -#define WL_SEQ_CMD_ALIGN_BYTES 4 - - -#define WL_SEQ_CMDS_GET_IOCTL_FILTER(cmd) \ - (((cmd) == WLC_GET_MAGIC) || \ - ((cmd) == WLC_GET_VERSION) || \ - ((cmd) == WLC_GET_AP) || \ - ((cmd) == WLC_GET_INSTANCE)) - - - -#define WL_PKTENG_PER_TX_START 0x01 -#define WL_PKTENG_PER_TX_STOP 0x02 -#define WL_PKTENG_PER_RX_START 0x04 -#define WL_PKTENG_PER_RX_WITH_ACK_START 0x05 -#define WL_PKTENG_PER_TX_WITH_ACK_START 0x06 -#define WL_PKTENG_PER_RX_STOP 0x08 -#define WL_PKTENG_PER_MASK 0xff - -#define WL_PKTENG_SYNCHRONOUS 0x100 - -typedef struct wl_pkteng { - uint32 flags; - uint32 delay; - uint32 nframes; - uint32 length; - uint8 seqno; - struct ether_addr dest; - struct ether_addr src; -} wl_pkteng_t; - -#define NUM_80211b_RATES 4 -#define NUM_80211ag_RATES 8 -#define NUM_80211n_RATES 32 -#define NUM_80211_RATES (NUM_80211b_RATES+NUM_80211ag_RATES+NUM_80211n_RATES) -typedef struct wl_pkteng_stats { - uint32 lostfrmcnt; - int32 rssi; - int32 snr; - uint16 rxpktcnt[NUM_80211_RATES+1]; -} wl_pkteng_stats_t; - -#define WL_WOWL_MAGIC (1 << 0) -#define WL_WOWL_NET (1 << 1) -#define WL_WOWL_DIS (1 << 2) -#define WL_WOWL_RETR (1 << 3) -#define WL_WOWL_BCN (1 << 4) -#define WL_WOWL_TST (1 << 5) -#define WL_WOWL_BCAST (1 << 15) - -#define MAGIC_PKT_MINLEN 102 - -typedef struct { - uint masksize; - uint offset; - uint patternoffset; - uint patternsize; - - -} wl_wowl_pattern_t; - -typedef struct { - uint count; - wl_wowl_pattern_t pattern[1]; -} wl_wowl_pattern_list_t; - -typedef struct { - uint8 pci_wakeind; - uint16 ucode_wakeind; -} wl_wowl_wakeind_t; - - -typedef struct wl_txrate_class { - uint8 init_rate; - uint8 min_rate; - uint8 max_rate; -} wl_txrate_class_t; - - - - -#define WLC_OBSS_SCAN_PASSIVE_DWELL_DEFAULT 100 -#define WLC_OBSS_SCAN_PASSIVE_DWELL_MIN 5 -#define WLC_OBSS_SCAN_PASSIVE_DWELL_MAX 1000 -#define WLC_OBSS_SCAN_ACTIVE_DWELL_DEFAULT 20 -#define WLC_OBSS_SCAN_ACTIVE_DWELL_MIN 10 -#define WLC_OBSS_SCAN_ACTIVE_DWELL_MAX 1000 -#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_DEFAULT 300 -#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_MIN 10 -#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_MAX 900 -#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_DEFAULT 5 -#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_MIN 5 -#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_MAX 100 -#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_DEFAULT 200 -#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_MIN 200 -#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_MAX 10000 -#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_DEFAULT 20 -#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_MIN 20 -#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_MAX 10000 -#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_DEFAULT 25 -#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_MIN 0 -#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_MAX 100 - - -typedef struct wl_obss_scan_arg { - int16 passive_dwell; - int16 active_dwell; - int16 bss_widthscan_interval; - int16 passive_total; - int16 active_total; - int16 chanwidth_transition_delay; - int16 activity_threshold; -} wl_obss_scan_arg_t; -#define WL_OBSS_SCAN_PARAM_LEN sizeof(wl_obss_scan_arg_t) -#define WL_MIN_NUM_OBSS_SCAN_ARG 7 - -#define WL_COEX_INFO_MASK 0x07 -#define WL_COEX_INFO_REQ 0x01 -#define WL_COEX_40MHZ_INTOLERANT 0x02 -#define WL_COEX_WIDTH20 0x04 - -typedef struct wl_action_obss_coex_req { - uint8 info; - uint8 num; - uint8 ch_list[1]; -} wl_action_obss_coex_req_t; - - -#define MAX_RSSI_LEVELS 8 - - -typedef struct wl_rssi_event { - - uint32 rate_limit_msec; - - uint8 num_rssi_levels; - - int8 rssi_levels[MAX_RSSI_LEVELS]; -} wl_rssi_event_t; - - - -#define WLFEATURE_DISABLE_11N 0x00000001 -#define WLFEATURE_DISABLE_11N_STBC_TX 0x00000002 -#define WLFEATURE_DISABLE_11N_STBC_RX 0x00000004 -#define WLFEATURE_DISABLE_11N_SGI_TX 0x00000008 -#define WLFEATURE_DISABLE_11N_SGI_RX 0x00000010 -#define WLFEATURE_DISABLE_11N_AMPDU_TX 0x00000020 -#define WLFEATURE_DISABLE_11N_AMPDU_RX 0x00000040 -#define WLFEATURE_DISABLE_11N_GF 0x00000080 - - - -#include - - -#include - - -typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_hdr { - struct ether_addr staAddr; - uint16 ieLen; -} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_hdr_t; - -typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_data { - sta_prbreq_wps_ie_hdr_t hdr; - uint8 ieData[1]; -} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_data_t; - -typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_list { - uint32 totLen; - uint8 ieDataList[1]; -} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_list_t; - - -#include - -#endif diff --git a/drivers/net/wireless/bcm4319/linux_osl.c b/drivers/net/wireless/bcm4319/linux_osl.c deleted file mode 100644 index 980416baf918..000000000000 --- a/drivers/net/wireless/bcm4319/linux_osl.c +++ /dev/null @@ -1,623 +0,0 @@ -/* - * Linux OS Independent Layer - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: linux_osl.c,v 1.125.12.3.8.7 2010/05/04 21:10:04 Exp $ - */ - - -#define LINUX_OSL - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define PCI_CFG_RETRY 10 - -#define OS_HANDLE_MAGIC 0x1234abcd -#define BCM_MEM_FILENAME_LEN 24 - -#ifdef DHD_USE_STATIC_BUF -#define MAX_STATIC_BUF_NUM 16 -#define STATIC_BUF_SIZE (PAGE_SIZE*2) -#define STATIC_BUF_TOTAL_LEN (MAX_STATIC_BUF_NUM*STATIC_BUF_SIZE) -typedef struct bcm_static_buf { - struct mutex static_sem; - unsigned char *buf_ptr; - unsigned char buf_use[MAX_STATIC_BUF_NUM]; -} bcm_static_buf_t; - -static bcm_static_buf_t *bcm_static_buf = 0; - -#define MAX_STATIC_PKT_NUM 8 -typedef struct bcm_static_pkt { - struct sk_buff *skb_4k[MAX_STATIC_PKT_NUM]; - struct sk_buff *skb_8k[MAX_STATIC_PKT_NUM]; - struct mutex osl_pkt_sem; - unsigned char pkt_use[MAX_STATIC_PKT_NUM*2]; -} bcm_static_pkt_t; -static bcm_static_pkt_t *bcm_static_skb = 0; - -#endif -typedef struct bcm_mem_link { - struct bcm_mem_link *prev; - struct bcm_mem_link *next; - uint size; - int line; - char file[BCM_MEM_FILENAME_LEN]; -} bcm_mem_link_t; - -struct osl_info { - osl_pubinfo_t pub; - uint magic; - void *pdev; - uint malloced; - uint failed; - uint bustype; - bcm_mem_link_t *dbgmem_list; -}; - -static int16 linuxbcmerrormap[] = -{ 0, - -EINVAL, - -EINVAL, - -EINVAL, - -EINVAL, - -EINVAL, - -EINVAL, - -EINVAL, - -EINVAL, - -EINVAL, - -EINVAL, - -EINVAL, - -EINVAL, - -EINVAL, - -E2BIG, - -E2BIG, - -EBUSY, - -EINVAL, - -EINVAL, - -EINVAL, - -EINVAL, - -EFAULT, - -ENOMEM, - -EOPNOTSUPP, - -EMSGSIZE, - -EINVAL, - -EPERM, - -ENOMEM, - -EINVAL, - -ERANGE, - -EINVAL, - -EINVAL, - -EINVAL, - -EINVAL, - -EINVAL, - -EIO, - -ENODEV, - -EINVAL, - -EIO, - -EIO, - -EINVAL, - -EINVAL, - - - -#if BCME_LAST != -41 -#error "You need to add a OS error translation in the linuxbcmerrormap \ - for new error code defined in bcmutils.h" -#endif -}; - - -int -osl_error(int bcmerror) -{ - if (bcmerror > 0) - bcmerror = 0; - else if (bcmerror < BCME_LAST) - bcmerror = BCME_ERROR; - - - return linuxbcmerrormap[-bcmerror]; -} - -void * dhd_os_prealloc(int section, unsigned long size); -osl_t * -osl_attach(void *pdev, uint bustype, bool pkttag) -{ - osl_t *osh; - gfp_t flags; - - flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL; - osh = kmalloc(sizeof(osl_t), flags); - ASSERT(osh); - - bzero(osh, sizeof(osl_t)); - - - ASSERT(ABS(BCME_LAST) == (ARRAYSIZE(linuxbcmerrormap) - 1)); - - osh->magic = OS_HANDLE_MAGIC; - osh->malloced = 0; - osh->failed = 0; - osh->dbgmem_list = NULL; - osh->pdev = pdev; - osh->pub.pkttag = pkttag; - osh->bustype = bustype; - - switch (bustype) { - case PCI_BUS: - case SI_BUS: - case PCMCIA_BUS: - osh->pub.mmbus = TRUE; - break; - case JTAG_BUS: - case SDIO_BUS: - case USB_BUS: - case SPI_BUS: - osh->pub.mmbus = FALSE; - break; - default: - ASSERT(FALSE); - break; - } - -#ifdef DHD_USE_STATIC_BUF - - - if (!bcm_static_buf) { - if (!(bcm_static_buf = (bcm_static_buf_t *)dhd_os_prealloc(3, STATIC_BUF_SIZE+ - STATIC_BUF_TOTAL_LEN))) { - printk("can not alloc static buf!\n"); - } - else { - /* printk("alloc static buf at %x!\n", (unsigned int)bcm_static_buf); */ - } - - mutex_init(&bcm_static_buf->static_sem); - - - bcm_static_buf->buf_ptr = (unsigned char *)bcm_static_buf + STATIC_BUF_SIZE; - - } - - if (!bcm_static_skb) - { - int i; - void *skb_buff_ptr = 0; - bcm_static_skb = (bcm_static_pkt_t *)((char *)bcm_static_buf + 2048); - skb_buff_ptr = dhd_os_prealloc(4, 0); - - bcopy(skb_buff_ptr, bcm_static_skb, sizeof(struct sk_buff *)*16); - for (i = 0; i < MAX_STATIC_PKT_NUM*2; i++) - bcm_static_skb->pkt_use[i] = 0; - - mutex_init(&bcm_static_skb->osl_pkt_sem); - } -#endif - return osh; -} - -void -osl_detach(osl_t *osh) -{ - if (osh == NULL) - return; - -#ifdef DHD_USE_STATIC_BUF - if (bcm_static_buf) { - bcm_static_buf = 0; - } - if (bcm_static_skb) { - bcm_static_skb = 0; - } -#endif - ASSERT(osh->magic == OS_HANDLE_MAGIC); - kfree(osh); -} - - -void* -osl_pktget(osl_t *osh, uint len) -{ - struct sk_buff *skb; - - if ((skb = dev_alloc_skb(len))) { - skb_put(skb, len); - skb->priority = 0; - - - osh->pub.pktalloced++; - } - - return ((void*) skb); -} - - -void -osl_pktfree(osl_t *osh, void *p, bool send) -{ - struct sk_buff *skb, *nskb; - - skb = (struct sk_buff*) p; - - if (send && osh->pub.tx_fn) - osh->pub.tx_fn(osh->pub.tx_ctx, p, 0); - - - while (skb) { - nskb = skb->next; - skb->next = NULL; - - - if (skb->destructor) { - - dev_kfree_skb_any(skb); - } else { - - dev_kfree_skb(skb); - } - - osh->pub.pktalloced--; - - skb = nskb; - } -} - -#ifdef DHD_USE_STATIC_BUF -void* -osl_pktget_static(osl_t *osh, uint len) -{ - int i = 0; - struct sk_buff *skb; - - - if (len > (PAGE_SIZE*2)) - { - printk("Do we really need this big skb??\n"); - return osl_pktget(osh, len); - } - - - mutex_lock(&bcm_static_skb->osl_pkt_sem); - if (len <= PAGE_SIZE) - { - - for (i = 0; i < MAX_STATIC_PKT_NUM; i++) - { - if (bcm_static_skb->pkt_use[i] == 0) - break; - } - - if (i != MAX_STATIC_PKT_NUM) - { - bcm_static_skb->pkt_use[i] = 1; - mutex_unlock(&bcm_static_skb->osl_pkt_sem); - - skb = bcm_static_skb->skb_4k[i]; - skb->tail = skb->data + len; - skb->len = len; - - return skb; - } - } - - - for (i = 0; i < MAX_STATIC_PKT_NUM; i++) - { - if (bcm_static_skb->pkt_use[i+MAX_STATIC_PKT_NUM] == 0) - break; - } - - if (i != MAX_STATIC_PKT_NUM) - { - bcm_static_skb->pkt_use[i+MAX_STATIC_PKT_NUM] = 1; - mutex_unlock(&bcm_static_skb->osl_pkt_sem); - skb = bcm_static_skb->skb_8k[i]; - skb->tail = skb->data + len; - skb->len = len; - - return skb; - } - - - - mutex_unlock(&bcm_static_skb->osl_pkt_sem); - printk("all static pkt in use!\n"); - return osl_pktget(osh, len); -} - - -void -osl_pktfree_static(osl_t *osh, void *p, bool send) -{ - int i; - - for (i = 0; i < MAX_STATIC_PKT_NUM*2; i++) - { - if (p == bcm_static_skb->skb_4k[i]) - { - mutex_lock(&bcm_static_skb->osl_pkt_sem); - bcm_static_skb->pkt_use[i] = 0; - mutex_unlock(&bcm_static_skb->osl_pkt_sem); - - - return; - } - } - return osl_pktfree(osh, p, send); -} -#endif -uint32 -osl_pci_read_config(osl_t *osh, uint offset, uint size) -{ - uint val = 0; - uint retry = PCI_CFG_RETRY; - - ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC))); - - - ASSERT(size == 4); - - do { - pci_read_config_dword(osh->pdev, offset, &val); - if (val != 0xffffffff) - break; - } while (retry--); - - - return (val); -} - -void -osl_pci_write_config(osl_t *osh, uint offset, uint size, uint val) -{ - uint retry = PCI_CFG_RETRY; - - ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC))); - - - ASSERT(size == 4); - - do { - pci_write_config_dword(osh->pdev, offset, val); - if (offset != PCI_BAR0_WIN) - break; - if (osl_pci_read_config(osh, offset, size) == val) - break; - } while (retry--); - -} - - -uint -osl_pci_bus(osl_t *osh) -{ - ASSERT(osh && (osh->magic == OS_HANDLE_MAGIC) && osh->pdev); - - return ((struct pci_dev *)osh->pdev)->bus->number; -} - - -uint -osl_pci_slot(osl_t *osh) -{ - ASSERT(osh && (osh->magic == OS_HANDLE_MAGIC) && osh->pdev); - - return PCI_SLOT(((struct pci_dev *)osh->pdev)->devfn); -} - -static void -osl_pcmcia_attr(osl_t *osh, uint offset, char *buf, int size, bool write) -{ -} - -void -osl_pcmcia_read_attr(osl_t *osh, uint offset, void *buf, int size) -{ - osl_pcmcia_attr(osh, offset, (char *) buf, size, FALSE); -} - -void -osl_pcmcia_write_attr(osl_t *osh, uint offset, void *buf, int size) -{ - osl_pcmcia_attr(osh, offset, (char *) buf, size, TRUE); -} - - - -void* -osl_malloc(osl_t *osh, uint size) -{ - void *addr; - gfp_t flags; - - if (osh) - ASSERT(osh->magic == OS_HANDLE_MAGIC); - -#ifdef DHD_USE_STATIC_BUF - if (bcm_static_buf) - { - int i = 0; - if ((size >= PAGE_SIZE)&&(size <= STATIC_BUF_SIZE)) - { - mutex_lock(&bcm_static_buf->static_sem); - - for (i = 0; i < MAX_STATIC_BUF_NUM; i++) - { - if (bcm_static_buf->buf_use[i] == 0) - break; - } - - if (i == MAX_STATIC_BUF_NUM) - { - mutex_unlock(&bcm_static_buf->static_sem); - printk("all static buff in use!\n"); - goto original; - } - - bcm_static_buf->buf_use[i] = 1; - mutex_unlock(&bcm_static_buf->static_sem); - - bzero(bcm_static_buf->buf_ptr+STATIC_BUF_SIZE*i, size); - if (osh) - osh->malloced += size; - - return ((void *)(bcm_static_buf->buf_ptr+STATIC_BUF_SIZE*i)); - } - } -original: -#endif - flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL; - if ((addr = kmalloc(size, flags)) == NULL) { - if (osh) - osh->failed++; - return (NULL); - } - if (osh) - osh->malloced += size; - - return (addr); -} - -void -osl_mfree(osl_t *osh, void *addr, uint size) -{ -#ifdef DHD_USE_STATIC_BUF - if (bcm_static_buf) - { - if ((addr > (void *)bcm_static_buf) && ((unsigned char *)addr - <= ((unsigned char *)bcm_static_buf + STATIC_BUF_TOTAL_LEN))) - { - int buf_idx = 0; - - buf_idx = ((unsigned char *)addr - bcm_static_buf->buf_ptr)/STATIC_BUF_SIZE; - - mutex_lock(&bcm_static_buf->static_sem); - bcm_static_buf->buf_use[buf_idx] = 0; - mutex_unlock(&bcm_static_buf->static_sem); - - if (osh) { - ASSERT(osh->magic == OS_HANDLE_MAGIC); - osh->malloced -= size; - } - return; - } - } -#endif - if (osh) { - ASSERT(osh->magic == OS_HANDLE_MAGIC); - osh->malloced -= size; - } - kfree(addr); -} - -uint -osl_malloced(osl_t *osh) -{ - ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC))); - return (osh->malloced); -} - -uint -osl_malloc_failed(osl_t *osh) -{ - ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC))); - return (osh->failed); -} - -void* -osl_dma_alloc_consistent(osl_t *osh, uint size, ulong *pap) -{ - ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC))); - - return (pci_alloc_consistent(osh->pdev, size, (dma_addr_t*)pap)); -} - -void -osl_dma_free_consistent(osl_t *osh, void *va, uint size, ulong pa) -{ - ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC))); - - pci_free_consistent(osh->pdev, size, va, (dma_addr_t)pa); -} - -uint -osl_dma_map(osl_t *osh, void *va, uint size, int direction) -{ - int dir; - - ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC))); - dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE; - return (pci_map_single(osh->pdev, va, size, dir)); -} - -void -osl_dma_unmap(osl_t *osh, uint pa, uint size, int direction) -{ - int dir; - - ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC))); - dir = (direction == DMA_TX)? PCI_DMA_TODEVICE: PCI_DMA_FROMDEVICE; - pci_unmap_single(osh->pdev, (uint32)pa, size, dir); -} - - -void -osl_delay(uint usec) -{ - uint d; - - while (usec > 0) { - d = MIN(usec, 1000); - udelay(d); - usec -= d; - } -} - - - -void * -osl_pktdup(osl_t *osh, void *skb) -{ - void * p; - gfp_t flags; - - flags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL; - if ((p = skb_clone((struct sk_buff*)skb, flags)) == NULL) - return NULL; - - - if (osh->pub.pkttag) - bzero((void*)((struct sk_buff *)p)->cb, OSL_PKTTAG_SZ); - - - osh->pub.pktalloced++; - return (p); -} diff --git a/drivers/net/wireless/bcm4319/miniopt.c b/drivers/net/wireless/bcm4319/miniopt.c deleted file mode 100644 index 6a184a75f06b..000000000000 --- a/drivers/net/wireless/bcm4319/miniopt.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Description. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * $Id: miniopt.c,v 1.1.6.4 2009/09/25 00:32:01 Exp $ - */ - -/* ---- Include Files ---------------------------------------------------- */ - -#include -#include -#include -#include -#include "miniopt.h" - - -/* ---- Public Variables ------------------------------------------------- */ -/* ---- Private Constants and Types -------------------------------------- */ - - - -/* ---- Private Variables ------------------------------------------------ */ -/* ---- Private Function Prototypes -------------------------------------- */ -/* ---- Functions -------------------------------------------------------- */ - -/* ----------------------------------------------------------------------- */ -void -miniopt_init(miniopt_t *t, const char* name, const char* flags, bool longflags) -{ - static const char *null_flags = ""; - - memset(t, 0, sizeof(miniopt_t)); - t->name = name; - if (flags == NULL) - t->flags = null_flags; - else - t->flags = flags; - t->longflags = longflags; -} - - -/* ----------------------------------------------------------------------- */ -int -miniopt(miniopt_t *t, char **argv) -{ - int keylen; - char *p, *eq, *valstr, *endptr = NULL; - int err = 0; - - t->consumed = 0; - t->positional = FALSE; - memset(t->key, 0, MINIOPT_MAXKEY); - t->opt = '\0'; - t->valstr = NULL; - t->good_int = FALSE; - valstr = NULL; - - if (*argv == NULL) { - err = -1; - goto exit; - } - - p = *argv++; - t->consumed++; - - if (!t->opt_end && !strcmp(p, "--")) { - t->opt_end = TRUE; - if (*argv == NULL) { - err = -1; - goto exit; - } - p = *argv++; - t->consumed++; - } - - if (t->opt_end) { - t->positional = TRUE; - valstr = p; - } - else if (!strncmp(p, "--", 2)) { - eq = strchr(p, '='); - if (eq == NULL && !t->longflags) { - fprintf(stderr, - "%s: missing \" = \" in long param \"%s\"\n", t->name, p); - err = 1; - goto exit; - } - keylen = eq ? (eq - (p + 2)) : (int)strlen(p) - 2; - if (keylen > 63) keylen = 63; - memcpy(t->key, p + 2, keylen); - - if (eq) { - valstr = eq + 1; - if (*valstr == '\0') { - fprintf(stderr, - "%s: missing value after \" = \" in long param \"%s\"\n", - t->name, p); - err = 1; - goto exit; - } - } - } - else if (!strncmp(p, "-", 1)) { - t->opt = p[1]; - if (strlen(p) > 2) { - fprintf(stderr, - "%s: only single char options, error on param \"%s\"\n", - t->name, p); - err = 1; - goto exit; - } - if (strchr(t->flags, t->opt)) { - /* this is a flag option, no value expected */ - valstr = NULL; - } else { - if (*argv == NULL) { - fprintf(stderr, - "%s: missing value parameter after \"%s\"\n", t->name, p); - err = 1; - goto exit; - } - valstr = *argv; - argv++; - t->consumed++; - } - } else { - t->positional = TRUE; - valstr = p; - } - - /* parse valstr as int just in case */ - if (valstr) { - t->uval = (uint)strtoul(valstr, &endptr, 0); - t->val = (int)t->uval; - t->good_int = (*endptr == '\0'); - } - - t->valstr = valstr; - -exit: - if (err == 1) - t->opt = '?'; - - return err; -} diff --git a/drivers/net/wireless/bcm4319/sbutils.c b/drivers/net/wireless/bcm4319/sbutils.c deleted file mode 100644 index 46cd51010b78..000000000000 --- a/drivers/net/wireless/bcm4319/sbutils.c +++ /dev/null @@ -1,1004 +0,0 @@ -/* - * Misc utility routines for accessing chip-specific features - * of the SiliconBackplane-based Broadcom chips. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: sbutils.c,v 1.662.4.10.2.7.4.2 2010/04/19 05:48:48 Exp $ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "siutils_priv.h" - -/* local prototypes */ -static uint _sb_coreidx(si_info_t *sii, uint32 sba); -static uint _sb_scan(si_info_t *sii, uint32 sba, void *regs, uint bus, uint32 sbba, - uint ncores); -static uint32 _sb_coresba(si_info_t *sii); -static void *_sb_setcoreidx(si_info_t *sii, uint coreidx); - -#define SET_SBREG(sii, r, mask, val) \ - W_SBREG((sii), (r), ((R_SBREG((sii), (r)) & ~(mask)) | (val))) -#define REGS2SB(va) (sbconfig_t*) ((int8*)(va) + SBCONFIGOFF) - -/* sonicsrev */ -#define SONICS_2_2 (SBIDL_RV_2_2 >> SBIDL_RV_SHIFT) -#define SONICS_2_3 (SBIDL_RV_2_3 >> SBIDL_RV_SHIFT) - -#define R_SBREG(sii, sbr) sb_read_sbreg((sii), (sbr)) -#define W_SBREG(sii, sbr, v) sb_write_sbreg((sii), (sbr), (v)) -#define AND_SBREG(sii, sbr, v) W_SBREG((sii), (sbr), (R_SBREG((sii), (sbr)) & (v))) -#define OR_SBREG(sii, sbr, v) W_SBREG((sii), (sbr), (R_SBREG((sii), (sbr)) | (v))) - -static uint32 -sb_read_sbreg(si_info_t *sii, volatile uint32 *sbr) -{ - uint8 tmp; - uint32 val, intr_val = 0; - - - /* - * compact flash only has 11 bits address, while we needs 12 bits address. - * MEM_SEG will be OR'd with other 11 bits address in hardware, - * so we program MEM_SEG with 12th bit when necessary(access sb regsiters). - * For normal PCMCIA bus(CFTable_regwinsz > 2k), do nothing special - */ - if (PCMCIA(sii)) { - INTR_OFF(sii, intr_val); - tmp = 1; - OSL_PCMCIA_WRITE_ATTR(sii->osh, MEM_SEG, &tmp, 1); - sbr = (volatile uint32 *)((uintptr)sbr & ~(1 << 11)); /* mask out bit 11 */ - } - - val = R_REG(sii->osh, sbr); - - if (PCMCIA(sii)) { - tmp = 0; - OSL_PCMCIA_WRITE_ATTR(sii->osh, MEM_SEG, &tmp, 1); - INTR_RESTORE(sii, intr_val); - } - - return (val); -} - -static void -sb_write_sbreg(si_info_t *sii, volatile uint32 *sbr, uint32 v) -{ - uint8 tmp; - volatile uint32 dummy; - uint32 intr_val = 0; - - - /* - * compact flash only has 11 bits address, while we needs 12 bits address. - * MEM_SEG will be OR'd with other 11 bits address in hardware, - * so we program MEM_SEG with 12th bit when necessary(access sb regsiters). - * For normal PCMCIA bus(CFTable_regwinsz > 2k), do nothing special - */ - if (PCMCIA(sii)) { - INTR_OFF(sii, intr_val); - tmp = 1; - OSL_PCMCIA_WRITE_ATTR(sii->osh, MEM_SEG, &tmp, 1); - sbr = (volatile uint32 *)((uintptr)sbr & ~(1 << 11)); /* mask out bit 11 */ - } - - if (BUSTYPE(sii->pub.bustype) == PCMCIA_BUS) { -#ifdef IL_BIGENDIAN - dummy = R_REG(sii->osh, sbr); - W_REG(sii->osh, ((volatile uint16 *)sbr + 1), (uint16)((v >> 16) & 0xffff)); - dummy = R_REG(sii->osh, sbr); - W_REG(sii->osh, (volatile uint16 *)sbr, (uint16)(v & 0xffff)); -#else - dummy = R_REG(sii->osh, sbr); - W_REG(sii->osh, (volatile uint16 *)sbr, (uint16)(v & 0xffff)); - dummy = R_REG(sii->osh, sbr); - W_REG(sii->osh, ((volatile uint16 *)sbr + 1), (uint16)((v >> 16) & 0xffff)); -#endif /* IL_BIGENDIAN */ - } else - W_REG(sii->osh, sbr, v); - - if (PCMCIA(sii)) { - tmp = 0; - OSL_PCMCIA_WRITE_ATTR(sii->osh, MEM_SEG, &tmp, 1); - INTR_RESTORE(sii, intr_val); - } -} - -uint -sb_coreid(si_t *sih) -{ - si_info_t *sii; - sbconfig_t *sb; - - sii = SI_INFO(sih); - sb = REGS2SB(sii->curmap); - - return ((R_SBREG(sii, &sb->sbidhigh) & SBIDH_CC_MASK) >> SBIDH_CC_SHIFT); -} - -uint -sb_flag(si_t *sih) -{ - si_info_t *sii; - sbconfig_t *sb; - - sii = SI_INFO(sih); - sb = REGS2SB(sii->curmap); - - return R_SBREG(sii, &sb->sbtpsflag) & SBTPS_NUM0_MASK; -} - -void -sb_setint(si_t *sih, int siflag) -{ - si_info_t *sii; - sbconfig_t *sb; - uint32 vec; - - sii = SI_INFO(sih); - sb = REGS2SB(sii->curmap); - - if (siflag == -1) - vec = 0; - else - vec = 1 << siflag; - W_SBREG(sii, &sb->sbintvec, vec); -} - -/* return core index of the core with address 'sba' */ -static uint -_sb_coreidx(si_info_t *sii, uint32 sba) -{ - uint i; - - for (i = 0; i < sii->numcores; i ++) - if (sba == sii->common_info->coresba[i]) - return i; - return BADIDX; -} - -/* return core address of the current core */ -static uint32 -_sb_coresba(si_info_t *sii) -{ - uint32 sbaddr; - - - switch (BUSTYPE(sii->pub.bustype)) { - case SI_BUS: { - sbconfig_t *sb = REGS2SB(sii->curmap); - sbaddr = sb_base(R_SBREG(sii, &sb->sbadmatch0)); - break; - } - - case PCI_BUS: - sbaddr = OSL_PCI_READ_CONFIG(sii->osh, PCI_BAR0_WIN, sizeof(uint32)); - break; - - case PCMCIA_BUS: { - uint8 tmp = 0; - OSL_PCMCIA_READ_ATTR(sii->osh, PCMCIA_ADDR0, &tmp, 1); - sbaddr = (uint32)tmp << 12; - OSL_PCMCIA_READ_ATTR(sii->osh, PCMCIA_ADDR1, &tmp, 1); - sbaddr |= (uint32)tmp << 16; - OSL_PCMCIA_READ_ATTR(sii->osh, PCMCIA_ADDR2, &tmp, 1); - sbaddr |= (uint32)tmp << 24; - break; - } - - case SPI_BUS: - case SDIO_BUS: - sbaddr = (uint32)(uintptr)sii->curmap; - break; - - - default: - sbaddr = BADCOREADDR; - break; - } - - return sbaddr; -} - -uint -sb_corevendor(si_t *sih) -{ - si_info_t *sii; - sbconfig_t *sb; - - sii = SI_INFO(sih); - sb = REGS2SB(sii->curmap); - - return ((R_SBREG(sii, &sb->sbidhigh) & SBIDH_VC_MASK) >> SBIDH_VC_SHIFT); -} - -uint -sb_corerev(si_t *sih) -{ - si_info_t *sii; - sbconfig_t *sb; - uint sbidh; - - sii = SI_INFO(sih); - sb = REGS2SB(sii->curmap); - sbidh = R_SBREG(sii, &sb->sbidhigh); - - return (SBCOREREV(sbidh)); -} - -/* set core-specific control flags */ -void -sb_core_cflags_wo(si_t *sih, uint32 mask, uint32 val) -{ - si_info_t *sii; - sbconfig_t *sb; - uint32 w; - - sii = SI_INFO(sih); - sb = REGS2SB(sii->curmap); - - ASSERT((val & ~mask) == 0); - - /* mask and set */ - w = (R_SBREG(sii, &sb->sbtmstatelow) & ~(mask << SBTML_SICF_SHIFT)) | - (val << SBTML_SICF_SHIFT); - W_SBREG(sii, &sb->sbtmstatelow, w); -} - -/* set/clear core-specific control flags */ -uint32 -sb_core_cflags(si_t *sih, uint32 mask, uint32 val) -{ - si_info_t *sii; - sbconfig_t *sb; - uint32 w; - - sii = SI_INFO(sih); - sb = REGS2SB(sii->curmap); - - ASSERT((val & ~mask) == 0); - - /* mask and set */ - if (mask || val) { - w = (R_SBREG(sii, &sb->sbtmstatelow) & ~(mask << SBTML_SICF_SHIFT)) | - (val << SBTML_SICF_SHIFT); - W_SBREG(sii, &sb->sbtmstatelow, w); - } - - /* return the new value - * for write operation, the following readback ensures the completion of write opration. - */ - return (R_SBREG(sii, &sb->sbtmstatelow) >> SBTML_SICF_SHIFT); -} - -/* set/clear core-specific status flags */ -uint32 -sb_core_sflags(si_t *sih, uint32 mask, uint32 val) -{ - si_info_t *sii; - sbconfig_t *sb; - uint32 w; - - sii = SI_INFO(sih); - sb = REGS2SB(sii->curmap); - - ASSERT((val & ~mask) == 0); - ASSERT((mask & ~SISF_CORE_BITS) == 0); - - /* mask and set */ - if (mask || val) { - w = (R_SBREG(sii, &sb->sbtmstatehigh) & ~(mask << SBTMH_SISF_SHIFT)) | - (val << SBTMH_SISF_SHIFT); - W_SBREG(sii, &sb->sbtmstatehigh, w); - } - - /* return the new value */ - return (R_SBREG(sii, &sb->sbtmstatehigh) >> SBTMH_SISF_SHIFT); -} - -bool -sb_iscoreup(si_t *sih) -{ - si_info_t *sii; - sbconfig_t *sb; - - sii = SI_INFO(sih); - sb = REGS2SB(sii->curmap); - - return ((R_SBREG(sii, &sb->sbtmstatelow) & - (SBTML_RESET | SBTML_REJ_MASK | (SICF_CLOCK_EN << SBTML_SICF_SHIFT))) == - (SICF_CLOCK_EN << SBTML_SICF_SHIFT)); -} - -/* - * Switch to 'coreidx', issue a single arbitrary 32bit register mask&set operation, - * switch back to the original core, and return the new value. - * - * When using the silicon backplane, no fidleing with interrupts or core switches are needed. - * - * Also, when using pci/pcie, we can optimize away the core switching for pci registers - * and (on newer pci cores) chipcommon registers. - */ -uint -sb_corereg(si_t *sih, uint coreidx, uint regoff, uint mask, uint val) -{ - uint origidx = 0; - uint32 *r = NULL; - uint w; - uint intr_val = 0; - bool fast = FALSE; - si_info_t *sii; - - sii = SI_INFO(sih); - - ASSERT(GOODIDX(coreidx)); - ASSERT(regoff < SI_CORE_SIZE); - ASSERT((val & ~mask) == 0); - - if (coreidx >= SI_MAXCORES) - return 0; - - if (BUSTYPE(sii->pub.bustype) == SI_BUS) { - /* If internal bus, we can always get at everything */ - fast = TRUE; - /* map if does not exist */ - if (!sii->common_info->regs[coreidx]) { - sii->common_info->regs[coreidx] = - REG_MAP(sii->common_info->coresba[coreidx], SI_CORE_SIZE); - ASSERT(GOODREGS(sii->common_info->regs[coreidx])); - } - r = (uint32 *)((uchar *)sii->common_info->regs[coreidx] + regoff); - } else if (BUSTYPE(sii->pub.bustype) == PCI_BUS) { - /* If pci/pcie, we can get at pci/pcie regs and on newer cores to chipc */ - - if ((sii->common_info->coreid[coreidx] == CC_CORE_ID) && SI_FAST(sii)) { - /* Chipc registers are mapped at 12KB */ - - fast = TRUE; - r = (uint32 *)((char *)sii->curmap + PCI_16KB0_CCREGS_OFFSET + regoff); - } else if (sii->pub.buscoreidx == coreidx) { - /* pci registers are at either in the last 2KB of an 8KB window - * or, in pcie and pci rev 13 at 8KB - */ - fast = TRUE; - if (SI_FAST(sii)) - r = (uint32 *)((char *)sii->curmap + - PCI_16KB0_PCIREGS_OFFSET + regoff); - else - r = (uint32 *)((char *)sii->curmap + - ((regoff >= SBCONFIGOFF) ? - PCI_BAR0_PCISBR_OFFSET : PCI_BAR0_PCIREGS_OFFSET) + - regoff); - } - } - - if (!fast) { - INTR_OFF(sii, intr_val); - - /* save current core index */ - origidx = si_coreidx(&sii->pub); - - /* switch core */ - r = (uint32*) ((uchar*)sb_setcoreidx(&sii->pub, coreidx) + regoff); - } - ASSERT(r != NULL); - - /* mask and set */ - if (mask || val) { - if (regoff >= SBCONFIGOFF) { - w = (R_SBREG(sii, r) & ~mask) | val; - W_SBREG(sii, r, w); - } else { - w = (R_REG(sii->osh, r) & ~mask) | val; - W_REG(sii->osh, r, w); - } - } - - /* readback */ - if (regoff >= SBCONFIGOFF) - w = R_SBREG(sii, r); - else { - if ((CHIPID(sii->pub.chip) == BCM5354_CHIP_ID) && - (coreidx == SI_CC_IDX) && - (regoff == OFFSETOF(chipcregs_t, watchdog))) { - w = val; - } else - w = R_REG(sii->osh, r); - } - - if (!fast) { - /* restore core index */ - if (origidx != coreidx) - sb_setcoreidx(&sii->pub, origidx); - - INTR_RESTORE(sii, intr_val); - } - - return (w); -} - -/* Scan the enumeration space to find all cores starting from the given - * bus 'sbba'. Append coreid and other info to the lists in 'si'. 'sba' - * is the default core address at chip POR time and 'regs' is the virtual - * address that the default core is mapped at. 'ncores' is the number of - * cores expected on bus 'sbba'. It returns the total number of cores - * starting from bus 'sbba', inclusive. - */ -#define SB_MAXBUSES 2 -static uint -_sb_scan(si_info_t *sii, uint32 sba, void *regs, uint bus, uint32 sbba, uint numcores) -{ - uint next; - uint ncc = 0; - uint i; - - if (bus >= SB_MAXBUSES) { - SI_ERROR(("_sb_scan: bus 0x%08x at level %d is too deep to scan\n", sbba, bus)); - return 0; - } - SI_MSG(("_sb_scan: scan bus 0x%08x assume %u cores\n", sbba, numcores)); - - /* Scan all cores on the bus starting from core 0. - * Core addresses must be contiguous on each bus. - */ - for (i = 0, next = sii->numcores; i < numcores && next < SB_BUS_MAXCORES; i++, next++) { - sii->common_info->coresba[next] = sbba + (i * SI_CORE_SIZE); - - /* keep and reuse the initial register mapping */ - if ((BUSTYPE(sii->pub.bustype) == SI_BUS) && - (sii->common_info->coresba[next] == sba)) { - SI_MSG(("_sb_scan: reuse mapped regs %p for core %u\n", regs, next)); - sii->common_info->regs[next] = regs; - } - - /* change core to 'next' and read its coreid */ - sii->curmap = _sb_setcoreidx(sii, next); - sii->curidx = next; - - sii->common_info->coreid[next] = sb_coreid(&sii->pub); - - /* core specific processing... */ - /* chipc provides # cores */ - if (sii->common_info->coreid[next] == CC_CORE_ID) { - chipcregs_t *cc = (chipcregs_t *)sii->curmap; - uint32 ccrev = sb_corerev(&sii->pub); - - /* determine numcores - this is the total # cores in the chip */ - if (((ccrev == 4) || (ccrev >= 6))) - numcores = (R_REG(sii->osh, &cc->chipid) & CID_CC_MASK) >> - CID_CC_SHIFT; - else { - /* Older chips */ - uint chip = sii->pub.chip; - - if (chip == BCM4306_CHIP_ID) /* < 4306c0 */ - numcores = 6; - else if (chip == BCM4704_CHIP_ID) - numcores = 9; - else if (chip == BCM5365_CHIP_ID) - numcores = 7; - else { - SI_ERROR(("sb_chip2numcores: unsupported chip 0x%x\n", - chip)); - ASSERT(0); - numcores = 1; - } - } - SI_MSG(("_sb_scan: there are %u cores in the chip %s\n", numcores, - sii->pub.issim ? "QT" : "")); - } - /* scan bridged SB(s) and add results to the end of the list */ - else if (sii->common_info->coreid[next] == OCP_CORE_ID) { - sbconfig_t *sb = REGS2SB(sii->curmap); - uint32 nsbba = R_SBREG(sii, &sb->sbadmatch1); - uint nsbcc; - - sii->numcores = next + 1; - - if ((nsbba & 0xfff00000) != SI_ENUM_BASE) - continue; - nsbba &= 0xfffff000; - if (_sb_coreidx(sii, nsbba) != BADIDX) - continue; - - nsbcc = (R_SBREG(sii, &sb->sbtmstatehigh) & 0x000f0000) >> 16; - nsbcc = _sb_scan(sii, sba, regs, bus + 1, nsbba, nsbcc); - if (sbba == SI_ENUM_BASE) - numcores -= nsbcc; - ncc += nsbcc; - } - } - - SI_MSG(("_sb_scan: found %u cores on bus 0x%08x\n", i, sbba)); - - sii->numcores = i + ncc; - return sii->numcores; -} - -/* scan the sb enumerated space to identify all cores */ -void -sb_scan(si_t *sih, void *regs, uint devid) -{ - si_info_t *sii; - uint32 origsba; - - sii = SI_INFO(sih); - - /* Save the current core info and validate it later till we know - * for sure what is good and what is bad. - */ - origsba = _sb_coresba(sii); - - /* scan all SB(s) starting from SI_ENUM_BASE */ - sii->numcores = _sb_scan(sii, origsba, regs, 0, SI_ENUM_BASE, 1); -} - -/* - * This function changes logical "focus" to the indicated core; - * must be called with interrupts off. - * Moreover, callers should keep interrupts off during switching out of and back to d11 core - */ -void * -sb_setcoreidx(si_t *sih, uint coreidx) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - - if (coreidx >= sii->numcores) - return (NULL); - - /* - * If the user has provided an interrupt mask enabled function, - * then assert interrupts are disabled before switching the core. - */ - ASSERT((sii->intrsenabled_fn == NULL) || !(*(sii)->intrsenabled_fn)((sii)->intr_arg)); - - sii->curmap = _sb_setcoreidx(sii, coreidx); - sii->curidx = coreidx; - - return (sii->curmap); -} - -/* This function changes the logical "focus" to the indicated core. - * Return the current core's virtual address. - */ -static void * -_sb_setcoreidx(si_info_t *sii, uint coreidx) -{ - uint32 sbaddr = sii->common_info->coresba[coreidx]; - void *regs; - - switch (BUSTYPE(sii->pub.bustype)) { - case SI_BUS: - /* map new one */ - if (!sii->common_info->regs[coreidx]) { - sii->common_info->regs[coreidx] = REG_MAP(sbaddr, SI_CORE_SIZE); - ASSERT(GOODREGS(sii->common_info->regs[coreidx])); - } - regs = sii->common_info->regs[coreidx]; - break; - - case PCI_BUS: - /* point bar0 window */ - OSL_PCI_WRITE_CONFIG(sii->osh, PCI_BAR0_WIN, 4, sbaddr); - regs = sii->curmap; - break; - - case PCMCIA_BUS: { - uint8 tmp = (sbaddr >> 12) & 0x0f; - OSL_PCMCIA_WRITE_ATTR(sii->osh, PCMCIA_ADDR0, &tmp, 1); - tmp = (sbaddr >> 16) & 0xff; - OSL_PCMCIA_WRITE_ATTR(sii->osh, PCMCIA_ADDR1, &tmp, 1); - tmp = (sbaddr >> 24) & 0xff; - OSL_PCMCIA_WRITE_ATTR(sii->osh, PCMCIA_ADDR2, &tmp, 1); - regs = sii->curmap; - break; - } - case SPI_BUS: - case SDIO_BUS: - /* map new one */ - if (!sii->common_info->regs[coreidx]) { - sii->common_info->regs[coreidx] = (void *)(uintptr)sbaddr; - ASSERT(GOODREGS(sii->common_info->regs[coreidx])); - } - regs = sii->common_info->regs[coreidx]; - break; - - - default: - ASSERT(0); - regs = NULL; - break; - } - - return regs; -} - -/* Return the address of sbadmatch0/1/2/3 register */ -static volatile uint32 * -sb_admatch(si_info_t *sii, uint asidx) -{ - sbconfig_t *sb; - volatile uint32 *addrm; - - sb = REGS2SB(sii->curmap); - - switch (asidx) { - case 0: - addrm = &sb->sbadmatch0; - break; - - case 1: - addrm = &sb->sbadmatch1; - break; - - case 2: - addrm = &sb->sbadmatch2; - break; - - case 3: - addrm = &sb->sbadmatch3; - break; - - default: - SI_ERROR(("%s: Address space index (%d) out of range\n", __FUNCTION__, asidx)); - return 0; - } - - return (addrm); -} - -/* Return the number of address spaces in current core */ -int -sb_numaddrspaces(si_t *sih) -{ - si_info_t *sii; - sbconfig_t *sb; - - sii = SI_INFO(sih); - sb = REGS2SB(sii->curmap); - - /* + 1 because of enumeration space */ - return ((R_SBREG(sii, &sb->sbidlow) & SBIDL_AR_MASK) >> SBIDL_AR_SHIFT) + 1; -} - -/* Return the address of the nth address space in the current core */ -uint32 -sb_addrspace(si_t *sih, uint asidx) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - - return (sb_base(R_SBREG(sii, sb_admatch(sii, asidx)))); -} - -/* Return the size of the nth address space in the current core */ -uint32 -sb_addrspacesize(si_t *sih, uint asidx) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - - return (sb_size(R_SBREG(sii, sb_admatch(sii, asidx)))); -} - - -/* do buffered registers update */ -void -sb_commit(si_t *sih) -{ - si_info_t *sii; - uint origidx; - uint intr_val = 0; - - sii = SI_INFO(sih); - - origidx = sii->curidx; - ASSERT(GOODIDX(origidx)); - - INTR_OFF(sii, intr_val); - - /* switch over to chipcommon core if there is one, else use pci */ - if (sii->pub.ccrev != NOREV) { - chipcregs_t *ccregs = (chipcregs_t *)si_setcore(sih, CC_CORE_ID, 0); - - /* do the buffer registers update */ - W_REG(sii->osh, &ccregs->broadcastaddress, SB_COMMIT); - W_REG(sii->osh, &ccregs->broadcastdata, 0x0); - } else - ASSERT(0); - - /* restore core index */ - sb_setcoreidx(sih, origidx); - INTR_RESTORE(sii, intr_val); -} - -void -sb_core_disable(si_t *sih, uint32 bits) -{ - si_info_t *sii; - volatile uint32 dummy; - sbconfig_t *sb; - - sii = SI_INFO(sih); - - ASSERT(GOODREGS(sii->curmap)); - sb = REGS2SB(sii->curmap); - - /* if core is already in reset, just return */ - if (R_SBREG(sii, &sb->sbtmstatelow) & SBTML_RESET) - return; - - /* if clocks are not enabled, put into reset and return */ - if ((R_SBREG(sii, &sb->sbtmstatelow) & (SICF_CLOCK_EN << SBTML_SICF_SHIFT)) == 0) - goto disable; - - /* set target reject and spin until busy is clear (preserve core-specific bits) */ - OR_SBREG(sii, &sb->sbtmstatelow, SBTML_REJ); - dummy = R_SBREG(sii, &sb->sbtmstatelow); - OSL_DELAY(1); - SPINWAIT((R_SBREG(sii, &sb->sbtmstatehigh) & SBTMH_BUSY), 100000); - if (R_SBREG(sii, &sb->sbtmstatehigh) & SBTMH_BUSY) - SI_ERROR(("%s: target state still busy\n", __FUNCTION__)); - - if (R_SBREG(sii, &sb->sbidlow) & SBIDL_INIT) { - OR_SBREG(sii, &sb->sbimstate, SBIM_RJ); - dummy = R_SBREG(sii, &sb->sbimstate); - OSL_DELAY(1); - SPINWAIT((R_SBREG(sii, &sb->sbimstate) & SBIM_BY), 100000); - } - - /* set reset and reject while enabling the clocks */ - W_SBREG(sii, &sb->sbtmstatelow, - (((bits | SICF_FGC | SICF_CLOCK_EN) << SBTML_SICF_SHIFT) | - SBTML_REJ | SBTML_RESET)); - dummy = R_SBREG(sii, &sb->sbtmstatelow); - OSL_DELAY(10); - - /* don't forget to clear the initiator reject bit */ - if (R_SBREG(sii, &sb->sbidlow) & SBIDL_INIT) - AND_SBREG(sii, &sb->sbimstate, ~SBIM_RJ); - -disable: - /* leave reset and reject asserted */ - W_SBREG(sii, &sb->sbtmstatelow, ((bits << SBTML_SICF_SHIFT) | SBTML_REJ | SBTML_RESET)); - OSL_DELAY(1); -} - -/* reset and re-enable a core - * inputs: - * bits - core specific bits that are set during and after reset sequence - * resetbits - core specific bits that are set only during reset sequence - */ -void -sb_core_reset(si_t *sih, uint32 bits, uint32 resetbits) -{ - si_info_t *sii; - sbconfig_t *sb; - volatile uint32 dummy; - - sii = SI_INFO(sih); - ASSERT(GOODREGS(sii->curmap)); - sb = REGS2SB(sii->curmap); - - /* - * Must do the disable sequence first to work for arbitrary current core state. - */ - sb_core_disable(sih, (bits | resetbits)); - - /* - * Now do the initialization sequence. - */ - - /* set reset while enabling the clock and forcing them on throughout the core */ - W_SBREG(sii, &sb->sbtmstatelow, - (((bits | resetbits | SICF_FGC | SICF_CLOCK_EN) << SBTML_SICF_SHIFT) | - SBTML_RESET)); - dummy = R_SBREG(sii, &sb->sbtmstatelow); - OSL_DELAY(1); - - if (R_SBREG(sii, &sb->sbtmstatehigh) & SBTMH_SERR) { - W_SBREG(sii, &sb->sbtmstatehigh, 0); - } - if ((dummy = R_SBREG(sii, &sb->sbimstate)) & (SBIM_IBE | SBIM_TO)) { - AND_SBREG(sii, &sb->sbimstate, ~(SBIM_IBE | SBIM_TO)); - } - - /* clear reset and allow it to propagate throughout the core */ - W_SBREG(sii, &sb->sbtmstatelow, - ((bits | resetbits | SICF_FGC | SICF_CLOCK_EN) << SBTML_SICF_SHIFT)); - dummy = R_SBREG(sii, &sb->sbtmstatelow); - OSL_DELAY(1); - - /* leave clock enabled */ - W_SBREG(sii, &sb->sbtmstatelow, ((bits | SICF_CLOCK_EN) << SBTML_SICF_SHIFT)); - dummy = R_SBREG(sii, &sb->sbtmstatelow); - OSL_DELAY(1); -} - -void -sb_core_tofixup(si_t *sih) -{ - si_info_t *sii; - sbconfig_t *sb; - - sii = SI_INFO(sih); - - if ((BUSTYPE(sii->pub.bustype) != PCI_BUS) || PCIE(sii) || - (PCI(sii) && (sii->pub.buscorerev >= 5))) - return; - - ASSERT(GOODREGS(sii->curmap)); - sb = REGS2SB(sii->curmap); - - if (BUSTYPE(sii->pub.bustype) == SI_BUS) { - SET_SBREG(sii, &sb->sbimconfiglow, - SBIMCL_RTO_MASK | SBIMCL_STO_MASK, - (0x5 << SBIMCL_RTO_SHIFT) | 0x3); - } else { - if (sb_coreid(sih) == PCI_CORE_ID) { - SET_SBREG(sii, &sb->sbimconfiglow, - SBIMCL_RTO_MASK | SBIMCL_STO_MASK, - (0x3 << SBIMCL_RTO_SHIFT) | 0x2); - } else { - SET_SBREG(sii, &sb->sbimconfiglow, (SBIMCL_RTO_MASK | SBIMCL_STO_MASK), 0); - } - } - - sb_commit(sih); -} - -/* - * Set the initiator timeout for the "master core". - * The master core is defined to be the core in control - * of the chip and so it issues accesses to non-memory - * locations (Because of dma *any* core can access memeory). - * - * The routine uses the bus to decide who is the master: - * SI_BUS => mips - * JTAG_BUS => chipc - * PCI_BUS => pci or pcie - * PCMCIA_BUS => pcmcia - * SDIO_BUS => pcmcia - * - * This routine exists so callers can disable initiator - * timeouts so accesses to very slow devices like otp - * won't cause an abort. The routine allows arbitrary - * settings of the service and request timeouts, though. - * - * Returns the timeout state before changing it or -1 - * on error. - */ - -#define TO_MASK (SBIMCL_RTO_MASK | SBIMCL_STO_MASK) - -uint32 -sb_set_initiator_to(si_t *sih, uint32 to, uint idx) -{ - si_info_t *sii; - uint origidx; - uint intr_val = 0; - uint32 tmp, ret = 0xffffffff; - sbconfig_t *sb; - - sii = SI_INFO(sih); - - if ((to & ~TO_MASK) != 0) - return ret; - - /* Figure out the master core */ - if (idx == BADIDX) { - switch (BUSTYPE(sii->pub.bustype)) { - case PCI_BUS: - idx = sii->pub.buscoreidx; - break; - case JTAG_BUS: - idx = SI_CC_IDX; - break; - case PCMCIA_BUS: - case SDIO_BUS: - idx = si_findcoreidx(sih, PCMCIA_CORE_ID, 0); - break; - case SI_BUS: - idx = si_findcoreidx(sih, MIPS33_CORE_ID, 0); - break; - default: - ASSERT(0); - } - if (idx == BADIDX) - return ret; - } - - INTR_OFF(sii, intr_val); - origidx = si_coreidx(sih); - - sb = REGS2SB(sb_setcoreidx(sih, idx)); - - tmp = R_SBREG(sii, &sb->sbimconfiglow); - ret = tmp & TO_MASK; - W_SBREG(sii, &sb->sbimconfiglow, (tmp & ~TO_MASK) | to); - - sb_commit(sih); - sb_setcoreidx(sih, origidx); - INTR_RESTORE(sii, intr_val); - return ret; -} - -uint32 -sb_base(uint32 admatch) -{ - uint32 base; - uint type; - - type = admatch & SBAM_TYPE_MASK; - ASSERT(type < 3); - - base = 0; - - if (type == 0) { - base = admatch & SBAM_BASE0_MASK; - } else if (type == 1) { - ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */ - base = admatch & SBAM_BASE1_MASK; - } else if (type == 2) { - ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */ - base = admatch & SBAM_BASE2_MASK; - } - - return (base); -} - -uint32 -sb_size(uint32 admatch) -{ - uint32 size; - uint type; - - type = admatch & SBAM_TYPE_MASK; - ASSERT(type < 3); - - size = 0; - - if (type == 0) { - size = 1 << (((admatch & SBAM_ADINT0_MASK) >> SBAM_ADINT0_SHIFT) + 1); - } else if (type == 1) { - ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */ - size = 1 << (((admatch & SBAM_ADINT1_MASK) >> SBAM_ADINT1_SHIFT) + 1); - } else if (type == 2) { - ASSERT(!(admatch & SBAM_ADNEG)); /* neg not supported */ - size = 1 << (((admatch & SBAM_ADINT2_MASK) >> SBAM_ADINT2_SHIFT) + 1); - } - - return (size); -} diff --git a/drivers/net/wireless/bcm4319/siutils.c b/drivers/net/wireless/bcm4319/siutils.c deleted file mode 100644 index 1814db0f9dd6..000000000000 --- a/drivers/net/wireless/bcm4319/siutils.c +++ /dev/null @@ -1,1527 +0,0 @@ -/* - * Misc utility routines for accessing chip-specific features - * of the SiliconBackplane-based Broadcom chips. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: siutils.c,v 1.662.4.4.4.16.4.28 2010/06/23 21:37:54 Exp $ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "siutils_priv.h" - -/* local prototypes */ -static si_info_t *si_doattach(si_info_t *sii, uint devid, osl_t *osh, void *regs, - uint bustype, void *sdh, char **vars, uint *varsz); -static bool si_buscore_prep(si_info_t *sii, uint bustype, uint devid, void *sdh); -static bool si_buscore_setup(si_info_t *sii, chipcregs_t *cc, uint bustype, uint32 savewin, - uint *origidx, void *regs); - - -/* global variable to indicate reservation/release of gpio's */ -static uint32 si_gpioreservation = 0; -static void *common_info_alloced = NULL; - -/* global flag to prevent shared resources from being initialized multiple times in si_attach() */ - -/* - * Allocate a si handle. - * devid - pci device id (used to determine chip#) - * osh - opaque OS handle - * regs - virtual address of initial core registers - * bustype - pci/pcmcia/sb/sdio/etc - * vars - pointer to a pointer area for "environment" variables - * varsz - pointer to int to return the size of the vars - */ -si_t * -si_attach(uint devid, osl_t *osh, void *regs, - uint bustype, void *sdh, char **vars, uint *varsz) -{ - si_info_t *sii; - - /* alloc si_info_t */ - if ((sii = MALLOC(osh, sizeof (si_info_t))) == NULL) { - SI_ERROR(("si_attach: malloc failed! malloced %d bytes\n", MALLOCED(osh))); - return (NULL); - } - - if (si_doattach(sii, devid, osh, regs, bustype, sdh, vars, varsz) == NULL) { - if (NULL != sii->common_info) - MFREE(osh, sii->common_info, sizeof(si_common_info_t)); - MFREE(osh, sii, sizeof(si_info_t)); - return (NULL); - } - sii->vars = vars ? *vars : NULL; - sii->varsz = varsz ? *varsz : 0; - - return (si_t *)sii; -} - -/* global kernel resource */ -static si_info_t ksii; - -static uint32 wd_msticks; /* watchdog timer ticks normalized to ms */ - -/* generic kernel variant of si_attach() */ -si_t * -si_kattach(osl_t *osh) -{ - static bool ksii_attached = FALSE; - - if (!ksii_attached) { - void *regs = REG_MAP(SI_ENUM_BASE, SI_CORE_SIZE); - - if (si_doattach(&ksii, BCM4710_DEVICE_ID, osh, regs, - SI_BUS, NULL, - osh != SI_OSH ? &ksii.vars : NULL, - osh != SI_OSH ? &ksii.varsz : NULL) == NULL) { - if (NULL != ksii.common_info) - MFREE(osh, ksii.common_info, sizeof(si_common_info_t)); - SI_ERROR(("si_kattach: si_doattach failed\n")); - REG_UNMAP(regs); - return NULL; - } - REG_UNMAP(regs); - - /* save ticks normalized to ms for si_watchdog_ms() */ - if (PMUCTL_ENAB(&ksii.pub)) { - /* based on 32KHz ILP clock */ - wd_msticks = 32; - } else { - wd_msticks = ALP_CLOCK / 1000; - } - - ksii_attached = TRUE; - SI_MSG(("si_kattach done. ccrev = %d, wd_msticks = %d\n", - ksii.pub.ccrev, wd_msticks)); - } - - return &ksii.pub; -} - - -static bool -si_buscore_prep(si_info_t *sii, uint bustype, uint devid, void *sdh) -{ - /* need to set memseg flag for CF card first before any sb registers access */ - if (BUSTYPE(bustype) == PCMCIA_BUS) - sii->memseg = TRUE; - - - if (BUSTYPE(bustype) == SDIO_BUS) { - int err; - uint8 clkset; - - /* Try forcing SDIO core to do ALPAvail request only */ - clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ; - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err); - if (!err) { - uint8 clkval; - - /* If register supported, wait for ALPAvail and then force ALP */ - clkval = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, NULL); - if ((clkval & ~SBSDIO_AVBITS) == clkset) { - SPINWAIT(((clkval = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, - SBSDIO_FUNC1_CHIPCLKCSR, NULL)), !SBSDIO_ALPAV(clkval)), - PMU_MAX_TRANSITION_DLY); - if (!SBSDIO_ALPAV(clkval)) { - SI_ERROR(("timeout on ALPAV wait, clkval 0x%02x\n", - clkval)); - return FALSE; - } - clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_FORCE_ALP; - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, - clkset, &err); - OSL_DELAY(65); - } - } - - /* Also, disable the extra SDIO pull-ups */ - bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SDIOPULLUP, 0, NULL); - } - - - return TRUE; -} - -static bool -si_buscore_setup(si_info_t *sii, chipcregs_t *cc, uint bustype, uint32 savewin, - uint *origidx, void *regs) -{ - bool pci, pcie; - uint i; - uint pciidx, pcieidx, pcirev, pcierev; - - cc = si_setcoreidx(&sii->pub, SI_CC_IDX); - ASSERT((uintptr)cc); - - /* get chipcommon rev */ - sii->pub.ccrev = (int)si_corerev(&sii->pub); - - /* get chipcommon chipstatus */ - if (sii->pub.ccrev >= 11) - sii->pub.chipst = R_REG(sii->osh, &cc->chipstatus); - - /* get chipcommon capabilites */ - sii->pub.cccaps = R_REG(sii->osh, &cc->capabilities); - - /* get pmu rev and caps */ - if (sii->pub.cccaps & CC_CAP_PMU) { - sii->pub.pmucaps = R_REG(sii->osh, &cc->pmucapabilities); - sii->pub.pmurev = sii->pub.pmucaps & PCAP_REV_MASK; - } - - SI_MSG(("Chipc: rev %d, caps 0x%x, chipst 0x%x pmurev %d, pmucaps 0x%x\n", - sii->pub.ccrev, sii->pub.cccaps, sii->pub.chipst, sii->pub.pmurev, - sii->pub.pmucaps)); - - /* figure out bus/orignal core idx */ - sii->pub.buscoretype = NODEV_CORE_ID; - sii->pub.buscorerev = NOREV; - sii->pub.buscoreidx = BADIDX; - - pci = pcie = FALSE; - pcirev = pcierev = NOREV; - pciidx = pcieidx = BADIDX; - - for (i = 0; i < sii->numcores; i++) { - uint cid, crev; - - si_setcoreidx(&sii->pub, i); - cid = si_coreid(&sii->pub); - crev = si_corerev(&sii->pub); - - /* Display cores found */ - SI_MSG(("CORE[%d]: id 0x%x rev %d base 0x%x regs 0x%p\n", - i, cid, crev, sii->common_info->coresba[i], sii->common_info->regs[i])); - - if (BUSTYPE(bustype) == PCI_BUS) { - if (cid == PCI_CORE_ID) { - pciidx = i; - pcirev = crev; - pci = TRUE; - } else if (cid == PCIE_CORE_ID) { - pcieidx = i; - pcierev = crev; - pcie = TRUE; - } - } else if ((BUSTYPE(bustype) == PCMCIA_BUS) && - (cid == PCMCIA_CORE_ID)) { - sii->pub.buscorerev = crev; - sii->pub.buscoretype = cid; - sii->pub.buscoreidx = i; - } - else if (((BUSTYPE(bustype) == SDIO_BUS) || - (BUSTYPE(bustype) == SPI_BUS)) && - ((cid == PCMCIA_CORE_ID) || - (cid == SDIOD_CORE_ID))) { - sii->pub.buscorerev = crev; - sii->pub.buscoretype = cid; - sii->pub.buscoreidx = i; - } - - /* find the core idx before entering this func. */ - if ((savewin && (savewin == sii->common_info->coresba[i])) || - (regs == sii->common_info->regs[i])) - *origidx = i; - } - - - SI_MSG(("Buscore id/type/rev %d/0x%x/%d\n", sii->pub.buscoreidx, sii->pub.buscoretype, - sii->pub.buscorerev)); - - if (BUSTYPE(sii->pub.bustype) == SI_BUS && (CHIPID(sii->pub.chip) == BCM4712_CHIP_ID) && - (sii->pub.chippkg != BCM4712LARGE_PKG_ID) && (sii->pub.chiprev <= 3)) - OR_REG(sii->osh, &cc->slow_clk_ctl, SCC_SS_XTAL); - - - /* Make sure any on-chip ARM is off (in case strapping is wrong), or downloaded code was - * already running. - */ - if ((BUSTYPE(bustype) == SDIO_BUS) || (BUSTYPE(bustype) == SPI_BUS)) { - if (si_setcore(&sii->pub, ARM7S_CORE_ID, 0) || - si_setcore(&sii->pub, ARMCM3_CORE_ID, 0)) - si_core_disable(&sii->pub, 0); - } - - /* return to the original core */ - si_setcoreidx(&sii->pub, *origidx); - - return TRUE; -} - - - -static si_info_t * -si_doattach(si_info_t *sii, uint devid, osl_t *osh, void *regs, - uint bustype, void *sdh, char **vars, uint *varsz) -{ - struct si_pub *sih = &sii->pub; - uint32 w, savewin; - chipcregs_t *cc; - char *pvars = NULL; - uint origidx; - - ASSERT(GOODREGS(regs)); - - bzero((uchar*)sii, sizeof(si_info_t)); - - - { - if (NULL == (common_info_alloced = (void *)MALLOC(osh, sizeof(si_common_info_t)))) { - SI_ERROR(("si_doattach: malloc failed! malloced %dbytes\n", MALLOCED(osh))); - return (NULL); - } - bzero((uchar*)(common_info_alloced), sizeof(si_common_info_t)); - } - sii->common_info = (si_common_info_t *)common_info_alloced; - sii->common_info->attach_count++; - - savewin = 0; - - sih->buscoreidx = BADIDX; - - sii->curmap = regs; - sii->sdh = sdh; - sii->osh = osh; - - - /* find Chipcommon address */ - if (bustype == PCI_BUS) { - savewin = OSL_PCI_READ_CONFIG(sii->osh, PCI_BAR0_WIN, sizeof(uint32)); - if (!GOODCOREADDR(savewin, SI_ENUM_BASE)) - savewin = SI_ENUM_BASE; - OSL_PCI_WRITE_CONFIG(sii->osh, PCI_BAR0_WIN, 4, SI_ENUM_BASE); - cc = (chipcregs_t *)regs; - } else - if ((bustype == SDIO_BUS) || (bustype == SPI_BUS)) { - cc = (chipcregs_t *)sii->curmap; - } else { - cc = (chipcregs_t *)REG_MAP(SI_ENUM_BASE, SI_CORE_SIZE); - } - - sih->bustype = bustype; - if (bustype != BUSTYPE(bustype)) { - SI_ERROR(("si_doattach: bus type %d does not match configured bus type %d\n", - bustype, BUSTYPE(bustype))); - return NULL; - } - - /* bus/core/clk setup for register access */ - if (!si_buscore_prep(sii, bustype, devid, sdh)) { - SI_ERROR(("si_doattach: si_core_clk_prep failed %d\n", bustype)); - return NULL; - } - - /* ChipID recognition. - * We assume we can read chipid at offset 0 from the regs arg. - * If we add other chiptypes (or if we need to support old sdio hosts w/o chipcommon), - * some way of recognizing them needs to be added here. - */ - w = R_REG(osh, &cc->chipid); - sih->socitype = (w & CID_TYPE_MASK) >> CID_TYPE_SHIFT; - /* Might as wll fill in chip id rev & pkg */ - sih->chip = w & CID_ID_MASK; - sih->chiprev = (w & CID_REV_MASK) >> CID_REV_SHIFT; - sih->chippkg = (w & CID_PKG_MASK) >> CID_PKG_SHIFT; - if ((CHIPID(sih->chip) == BCM4329_CHIP_ID) && (sih->chippkg != BCM4329_289PIN_PKG_ID)) - sih->chippkg = BCM4329_182PIN_PKG_ID; - sih->issim = IS_SIM(sih->chippkg); - - /* scan for cores */ - if (CHIPTYPE(sii->pub.socitype) == SOCI_SB) { - SI_MSG(("Found chip type SB (0x%08x)\n", w)); - sb_scan(&sii->pub, regs, devid); - } else if (CHIPTYPE(sii->pub.socitype) == SOCI_AI) { - SI_MSG(("Found chip type AI (0x%08x)\n", w)); - /* pass chipc address instead of original core base */ - ai_scan(&sii->pub, (void *)cc, devid); - } else { - SI_ERROR(("Found chip of unkown type (0x%08x)\n", w)); - return NULL; - } - /* no cores found, bail out */ - if (sii->numcores == 0) { - SI_ERROR(("si_doattach: could not find any cores\n")); - return NULL; - } - /* bus/core/clk setup */ - origidx = SI_CC_IDX; - if (!si_buscore_setup(sii, cc, bustype, savewin, &origidx, regs)) { - SI_ERROR(("si_doattach: si_buscore_setup failed\n")); - return NULL; - } - - pvars = NULL; - - - - if (sii->pub.ccrev >= 20) { - cc = (chipcregs_t *)si_setcore(sih, CC_CORE_ID, 0); - W_REG(osh, &cc->gpiopullup, 0); - W_REG(osh, &cc->gpiopulldown, 0); - si_setcoreidx(sih, origidx); - } - - /* Skip PMU initialization from the Dongle Host. - * Firmware will take care of it when it comes up. - */ - - - - return (sii); -} - -/* may be called with core in reset */ -void -si_detach(si_t *sih) -{ - si_info_t *sii; - uint idx; - - sii = SI_INFO(sih); - - if (sii == NULL) - return; - - if (BUSTYPE(sih->bustype) == SI_BUS) - for (idx = 0; idx < SI_MAXCORES; idx++) - if (sii->common_info->regs[idx]) { - REG_UNMAP(sii->common_info->regs[idx]); - sii->common_info->regs[idx] = NULL; - } - - - if (1 == sii->common_info->attach_count--) { - MFREE(sii->osh, sii->common_info, sizeof(si_common_info_t)); - common_info_alloced = NULL; - } - -#if !defined(BCMBUSTYPE) || (BCMBUSTYPE == SI_BUS) - if (sii != &ksii) -#endif /* !BCMBUSTYPE || (BCMBUSTYPE == SI_BUS) */ - MFREE(sii->osh, sii, sizeof(si_info_t)); -} - -void * -si_osh(si_t *sih) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - return sii->osh; -} - -void -si_setosh(si_t *sih, osl_t *osh) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - if (sii->osh != NULL) { - SI_ERROR(("osh is already set....\n")); - ASSERT(!sii->osh); - } - sii->osh = osh; -} - -/* register driver interrupt disabling and restoring callback functions */ -void -si_register_intr_callback(si_t *sih, void *intrsoff_fn, void *intrsrestore_fn, - void *intrsenabled_fn, void *intr_arg) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - sii->intr_arg = intr_arg; - sii->intrsoff_fn = (si_intrsoff_t)intrsoff_fn; - sii->intrsrestore_fn = (si_intrsrestore_t)intrsrestore_fn; - sii->intrsenabled_fn = (si_intrsenabled_t)intrsenabled_fn; - /* save current core id. when this function called, the current core - * must be the core which provides driver functions(il, et, wl, etc.) - */ - sii->dev_coreid = sii->common_info->coreid[sii->curidx]; -} - -void -si_deregister_intr_callback(si_t *sih) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - sii->intrsoff_fn = NULL; -} - -uint -si_intflag(si_t *sih) -{ - si_info_t *sii = SI_INFO(sih); - if (CHIPTYPE(sih->socitype) == SOCI_SB) { - sbconfig_t *ccsbr = (sbconfig_t *)((uintptr)((ulong) - (sii->common_info->coresba[SI_CC_IDX]) + SBCONFIGOFF)); - return R_REG(sii->osh, &ccsbr->sbflagst); - } else if (CHIPTYPE(sih->socitype) == SOCI_AI) - return R_REG(sii->osh, ((uint32 *)(uintptr) - (sii->common_info->oob_router + OOB_STATUSA))); - else { - ASSERT(0); - return 0; - } -} - -uint -si_flag(si_t *sih) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - return sb_flag(sih); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - return ai_flag(sih); - else { - ASSERT(0); - return 0; - } -} - -void -si_setint(si_t *sih, int siflag) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - sb_setint(sih, siflag); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - ai_setint(sih, siflag); - else - ASSERT(0); -} - -uint -si_coreid(si_t *sih) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - return sii->common_info->coreid[sii->curidx]; -} - -uint -si_coreidx(si_t *sih) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - return sii->curidx; -} - -/* return the core-type instantiation # of the current core */ -uint -si_coreunit(si_t *sih) -{ - si_info_t *sii; - uint idx; - uint coreid; - uint coreunit; - uint i; - - sii = SI_INFO(sih); - coreunit = 0; - - idx = sii->curidx; - - ASSERT(GOODREGS(sii->curmap)); - coreid = si_coreid(sih); - - /* count the cores of our type */ - for (i = 0; i < idx; i++) - if (sii->common_info->coreid[i] == coreid) - coreunit++; - - return (coreunit); -} - -uint -si_corevendor(si_t *sih) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - return sb_corevendor(sih); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - return ai_corevendor(sih); - else { - ASSERT(0); - return 0; - } -} - -bool -si_backplane64(si_t *sih) -{ - return ((sih->cccaps & CC_CAP_BKPLN64) != 0); -} - -uint -si_corerev(si_t *sih) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - return sb_corerev(sih); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - return ai_corerev(sih); - else { - ASSERT(0); - return 0; - } -} - -/* return index of coreid or BADIDX if not found */ -uint -si_findcoreidx(si_t *sih, uint coreid, uint coreunit) -{ - si_info_t *sii; - uint found; - uint i; - - sii = SI_INFO(sih); - - found = 0; - - for (i = 0; i < sii->numcores; i++) - if (sii->common_info->coreid[i] == coreid) { - if (found == coreunit) - return (i); - found++; - } - - return (BADIDX); -} - -/* return list of found cores */ -uint -si_corelist(si_t *sih, uint coreid[]) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - - bcopy((uchar*)sii->common_info->coreid, (uchar*)coreid, (sii->numcores * sizeof(uint))); - return (sii->numcores); -} - -/* return current register mapping */ -void * -si_coreregs(si_t *sih) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - ASSERT(GOODREGS(sii->curmap)); - - return (sii->curmap); -} - -/* - * This function changes logical "focus" to the indicated core; - * must be called with interrupts off. - * Moreover, callers should keep interrupts off during switching out of and back to d11 core - */ -void * -si_setcore(si_t *sih, uint coreid, uint coreunit) -{ - uint idx; - - idx = si_findcoreidx(sih, coreid, coreunit); - if (!GOODIDX(idx)) - return (NULL); - - if (CHIPTYPE(sih->socitype) == SOCI_SB) - return sb_setcoreidx(sih, idx); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - return ai_setcoreidx(sih, idx); - else { - ASSERT(0); - return NULL; - } -} - -void * -si_setcoreidx(si_t *sih, uint coreidx) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - return sb_setcoreidx(sih, coreidx); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - return ai_setcoreidx(sih, coreidx); - else { - ASSERT(0); - return NULL; - } -} - -/* Turn off interrupt as required by sb_setcore, before switch core */ -void *si_switch_core(si_t *sih, uint coreid, uint *origidx, uint *intr_val) -{ - void *cc; - si_info_t *sii; - - sii = SI_INFO(sih); - - INTR_OFF(sii, *intr_val); - *origidx = sii->curidx; - cc = si_setcore(sih, coreid, 0); - ASSERT(cc != NULL); - - return cc; -} - -/* restore coreidx and restore interrupt */ -void si_restore_core(si_t *sih, uint coreid, uint intr_val) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - - si_setcoreidx(sih, coreid); - INTR_RESTORE(sii, intr_val); -} - -int -si_numaddrspaces(si_t *sih) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - return sb_numaddrspaces(sih); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - return ai_numaddrspaces(sih); - else { - ASSERT(0); - return 0; - } -} - -uint32 -si_addrspace(si_t *sih, uint asidx) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - return sb_addrspace(sih, asidx); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - return ai_addrspace(sih, asidx); - else { - ASSERT(0); - return 0; - } -} - -uint32 -si_addrspacesize(si_t *sih, uint asidx) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - return sb_addrspacesize(sih, asidx); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - return ai_addrspacesize(sih, asidx); - else { - ASSERT(0); - return 0; - } -} - -uint32 -si_core_cflags(si_t *sih, uint32 mask, uint32 val) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - return sb_core_cflags(sih, mask, val); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - return ai_core_cflags(sih, mask, val); - else { - ASSERT(0); - return 0; - } -} - -void -si_core_cflags_wo(si_t *sih, uint32 mask, uint32 val) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - sb_core_cflags_wo(sih, mask, val); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - ai_core_cflags_wo(sih, mask, val); - else - ASSERT(0); -} - -uint32 -si_core_sflags(si_t *sih, uint32 mask, uint32 val) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - return sb_core_sflags(sih, mask, val); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - return ai_core_sflags(sih, mask, val); - else { - ASSERT(0); - return 0; - } -} - -bool -si_iscoreup(si_t *sih) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - return sb_iscoreup(sih); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - return ai_iscoreup(sih); - else { - ASSERT(0); - return FALSE; - } -} - -void -si_write_wrapperreg(si_t *sih, uint32 offset, uint32 val) -{ - /* only for 4319, no requirement for SOCI_SB */ - if (CHIPTYPE(sih->socitype) == SOCI_AI) { - ai_write_wrap_reg(sih, offset, val); - } - else - return; - - return; -} - -uint -si_corereg(si_t *sih, uint coreidx, uint regoff, uint mask, uint val) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - return sb_corereg(sih, coreidx, regoff, mask, val); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - return ai_corereg(sih, coreidx, regoff, mask, val); - else { - ASSERT(0); - return 0; - } -} - -void -si_core_disable(si_t *sih, uint32 bits) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - sb_core_disable(sih, bits); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - ai_core_disable(sih, bits); -} - -void -si_core_reset(si_t *sih, uint32 bits, uint32 resetbits) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - sb_core_reset(sih, bits, resetbits); - else if (CHIPTYPE(sih->socitype) == SOCI_AI) - ai_core_reset(sih, bits, resetbits); -} - -void -si_core_tofixup(si_t *sih) -{ - if (CHIPTYPE(sih->socitype) == SOCI_SB) - sb_core_tofixup(sih); -} - -/* Run bist on current core. Caller needs to take care of core-specific bist hazards */ -int -si_corebist(si_t *sih) -{ - uint32 cflags; - int result = 0; - - /* Read core control flags */ - cflags = si_core_cflags(sih, 0, 0); - - /* Set bist & fgc */ - si_core_cflags(sih, 0, (SICF_BIST_EN | SICF_FGC)); - - /* Wait for bist done */ - SPINWAIT(((si_core_sflags(sih, 0, 0) & SISF_BIST_DONE) == 0), 100000); - - if (si_core_sflags(sih, 0, 0) & SISF_BIST_ERROR) - result = BCME_ERROR; - - /* Reset core control flags */ - si_core_cflags(sih, 0xffff, cflags); - - return result; -} - -static uint32 -factor6(uint32 x) -{ - switch (x) { - case CC_F6_2: return 2; - case CC_F6_3: return 3; - case CC_F6_4: return 4; - case CC_F6_5: return 5; - case CC_F6_6: return 6; - case CC_F6_7: return 7; - default: return 0; - } -} - -/* calculate the speed the SI would run at given a set of clockcontrol values */ -uint32 -si_clock_rate(uint32 pll_type, uint32 n, uint32 m) -{ - uint32 n1, n2, clock, m1, m2, m3, mc; - - n1 = n & CN_N1_MASK; - n2 = (n & CN_N2_MASK) >> CN_N2_SHIFT; - - if (pll_type == PLL_TYPE6) { - if (m & CC_T6_MMASK) - return CC_T6_M1; - else - return CC_T6_M0; - } else if ((pll_type == PLL_TYPE1) || - (pll_type == PLL_TYPE3) || - (pll_type == PLL_TYPE4) || - (pll_type == PLL_TYPE7)) { - n1 = factor6(n1); - n2 += CC_F5_BIAS; - } else if (pll_type == PLL_TYPE2) { - n1 += CC_T2_BIAS; - n2 += CC_T2_BIAS; - ASSERT((n1 >= 2) && (n1 <= 7)); - ASSERT((n2 >= 5) && (n2 <= 23)); - } else if (pll_type == PLL_TYPE5) { - return (100000000); - } else - ASSERT(0); - /* PLL types 3 and 7 use BASE2 (25Mhz) */ - if ((pll_type == PLL_TYPE3) || - (pll_type == PLL_TYPE7)) { - clock = CC_CLOCK_BASE2 * n1 * n2; - } else - clock = CC_CLOCK_BASE1 * n1 * n2; - - if (clock == 0) - return 0; - - m1 = m & CC_M1_MASK; - m2 = (m & CC_M2_MASK) >> CC_M2_SHIFT; - m3 = (m & CC_M3_MASK) >> CC_M3_SHIFT; - mc = (m & CC_MC_MASK) >> CC_MC_SHIFT; - - if ((pll_type == PLL_TYPE1) || - (pll_type == PLL_TYPE3) || - (pll_type == PLL_TYPE4) || - (pll_type == PLL_TYPE7)) { - m1 = factor6(m1); - if ((pll_type == PLL_TYPE1) || (pll_type == PLL_TYPE3)) - m2 += CC_F5_BIAS; - else - m2 = factor6(m2); - m3 = factor6(m3); - - switch (mc) { - case CC_MC_BYPASS: return (clock); - case CC_MC_M1: return (clock / m1); - case CC_MC_M1M2: return (clock / (m1 * m2)); - case CC_MC_M1M2M3: return (clock / (m1 * m2 * m3)); - case CC_MC_M1M3: return (clock / (m1 * m3)); - default: return (0); - } - } else { - ASSERT(pll_type == PLL_TYPE2); - - m1 += CC_T2_BIAS; - m2 += CC_T2M2_BIAS; - m3 += CC_T2_BIAS; - ASSERT((m1 >= 2) && (m1 <= 7)); - ASSERT((m2 >= 3) && (m2 <= 10)); - ASSERT((m3 >= 2) && (m3 <= 7)); - - if ((mc & CC_T2MC_M1BYP) == 0) - clock /= m1; - if ((mc & CC_T2MC_M2BYP) == 0) - clock /= m2; - if ((mc & CC_T2MC_M3BYP) == 0) - clock /= m3; - - return (clock); - } -} - - -/* set chip watchdog reset timer to fire in 'ticks' */ -void -si_watchdog(si_t *sih, uint ticks) -{ - if (PMUCTL_ENAB(sih)) { - - if ((sih->chip == BCM4319_CHIP_ID) && (sih->chiprev == 0) && (ticks != 0)) { - si_corereg(sih, SI_CC_IDX, OFFSETOF(chipcregs_t, clk_ctl_st), ~0, 0x2); - si_setcore(sih, USB20D_CORE_ID, 0); - si_core_disable(sih, 1); - si_setcore(sih, CC_CORE_ID, 0); - } - - if (ticks == 1) - ticks = 2; - si_corereg(sih, SI_CC_IDX, OFFSETOF(chipcregs_t, pmuwatchdog), ~0, ticks); - } else { - /* instant NMI */ - si_corereg(sih, SI_CC_IDX, OFFSETOF(chipcregs_t, watchdog), ~0, ticks); - } -} - -#if !defined(BCMBUSTYPE) || (BCMBUSTYPE == SI_BUS) -/* trigger watchdog reset after ms milliseconds */ -void -si_watchdog_ms(si_t *sih, uint32 ms) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - - si_watchdog(sih, wd_msticks * ms); -} -#endif - - - -/* initialize the sdio core */ -void -si_sdio_init(si_t *sih) -{ - si_info_t *sii = SI_INFO(sih); - - if (((sih->buscoretype == PCMCIA_CORE_ID) && (sih->buscorerev >= 8)) || - (sih->buscoretype == SDIOD_CORE_ID)) { - uint idx; - sdpcmd_regs_t *sdpregs; - - /* get the current core index */ - idx = sii->curidx; - ASSERT(idx == si_findcoreidx(sih, D11_CORE_ID, 0)); - - /* switch to sdio core */ - if (!(sdpregs = (sdpcmd_regs_t *)si_setcore(sih, PCMCIA_CORE_ID, 0))) - sdpregs = (sdpcmd_regs_t *)si_setcore(sih, SDIOD_CORE_ID, 0); - ASSERT(sdpregs); - - SI_MSG(("si_sdio_init: For PCMCIA/SDIO Corerev %d, enable ints from core %d " - "through SD core %d (%p)\n", - sih->buscorerev, idx, sii->curidx, sdpregs)); - - /* enable backplane error and core interrupts */ - W_REG(sii->osh, &sdpregs->hostintmask, I_SBINT); - W_REG(sii->osh, &sdpregs->sbintmask, (I_SB_SERR | I_SB_RESPERR | (1 << idx))); - - /* switch back to previous core */ - si_setcoreidx(sih, idx); - } - - /* enable interrupts */ - bcmsdh_intr_enable(sii->sdh); - -} - - -/* change logical "focus" to the gpio core for optimized access */ -void * -si_gpiosetcore(si_t *sih) -{ - return (si_setcoreidx(sih, SI_CC_IDX)); -} - -/* mask&set gpiocontrol bits */ -uint32 -si_gpiocontrol(si_t *sih, uint32 mask, uint32 val, uint8 priority) -{ - uint regoff; - - regoff = 0; - - /* gpios could be shared on router platforms - * ignore reservation if it's high priority (e.g., test apps) - */ - if ((priority != GPIO_HI_PRIORITY) && - (BUSTYPE(sih->bustype) == SI_BUS) && (val || mask)) { - mask = priority ? (si_gpioreservation & mask) : - ((si_gpioreservation | mask) & ~(si_gpioreservation)); - val &= mask; - } - - regoff = OFFSETOF(chipcregs_t, gpiocontrol); - return (si_corereg(sih, SI_CC_IDX, regoff, mask, val)); -} - -/* mask&set gpio output enable bits */ -uint32 -si_gpioouten(si_t *sih, uint32 mask, uint32 val, uint8 priority) -{ - uint regoff; - - regoff = 0; - - /* gpios could be shared on router platforms - * ignore reservation if it's high priority (e.g., test apps) - */ - if ((priority != GPIO_HI_PRIORITY) && - (BUSTYPE(sih->bustype) == SI_BUS) && (val || mask)) { - mask = priority ? (si_gpioreservation & mask) : - ((si_gpioreservation | mask) & ~(si_gpioreservation)); - val &= mask; - } - - regoff = OFFSETOF(chipcregs_t, gpioouten); - return (si_corereg(sih, SI_CC_IDX, regoff, mask, val)); -} - -/* mask&set gpio output bits */ -uint32 -si_gpioout(si_t *sih, uint32 mask, uint32 val, uint8 priority) -{ - uint regoff; - - regoff = 0; - - /* gpios could be shared on router platforms - * ignore reservation if it's high priority (e.g., test apps) - */ - if ((priority != GPIO_HI_PRIORITY) && - (BUSTYPE(sih->bustype) == SI_BUS) && (val || mask)) { - mask = priority ? (si_gpioreservation & mask) : - ((si_gpioreservation | mask) & ~(si_gpioreservation)); - val &= mask; - } - - regoff = OFFSETOF(chipcregs_t, gpioout); - return (si_corereg(sih, SI_CC_IDX, regoff, mask, val)); -} - -/* reserve one gpio */ -uint32 -si_gpioreserve(si_t *sih, uint32 gpio_bitmask, uint8 priority) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - - /* only cores on SI_BUS share GPIO's and only applcation users need to - * reserve/release GPIO - */ - if ((BUSTYPE(sih->bustype) != SI_BUS) || (!priority)) { - ASSERT((BUSTYPE(sih->bustype) == SI_BUS) && (priority)); - return -1; - } - /* make sure only one bit is set */ - if ((!gpio_bitmask) || ((gpio_bitmask) & (gpio_bitmask - 1))) { - ASSERT((gpio_bitmask) && !((gpio_bitmask) & (gpio_bitmask - 1))); - return -1; - } - - /* already reserved */ - if (si_gpioreservation & gpio_bitmask) - return -1; - /* set reservation */ - si_gpioreservation |= gpio_bitmask; - - return si_gpioreservation; -} - -/* release one gpio */ -/* - * releasing the gpio doesn't change the current value on the GPIO last write value - * persists till some one overwrites it - */ - -uint32 -si_gpiorelease(si_t *sih, uint32 gpio_bitmask, uint8 priority) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - - /* only cores on SI_BUS share GPIO's and only applcation users need to - * reserve/release GPIO - */ - if ((BUSTYPE(sih->bustype) != SI_BUS) || (!priority)) { - ASSERT((BUSTYPE(sih->bustype) == SI_BUS) && (priority)); - return -1; - } - /* make sure only one bit is set */ - if ((!gpio_bitmask) || ((gpio_bitmask) & (gpio_bitmask - 1))) { - ASSERT((gpio_bitmask) && !((gpio_bitmask) & (gpio_bitmask - 1))); - return -1; - } - - /* already released */ - if (!(si_gpioreservation & gpio_bitmask)) - return -1; - - /* clear reservation */ - si_gpioreservation &= ~gpio_bitmask; - - return si_gpioreservation; -} - -/* return the current gpioin register value */ -uint32 -si_gpioin(si_t *sih) -{ - si_info_t *sii; - uint regoff; - - sii = SI_INFO(sih); - regoff = 0; - - regoff = OFFSETOF(chipcregs_t, gpioin); - return (si_corereg(sih, SI_CC_IDX, regoff, 0, 0)); -} - -/* mask&set gpio interrupt polarity bits */ -uint32 -si_gpiointpolarity(si_t *sih, uint32 mask, uint32 val, uint8 priority) -{ - si_info_t *sii; - uint regoff; - - sii = SI_INFO(sih); - regoff = 0; - - /* gpios could be shared on router platforms */ - if ((BUSTYPE(sih->bustype) == SI_BUS) && (val || mask)) { - mask = priority ? (si_gpioreservation & mask) : - ((si_gpioreservation | mask) & ~(si_gpioreservation)); - val &= mask; - } - - regoff = OFFSETOF(chipcregs_t, gpiointpolarity); - return (si_corereg(sih, SI_CC_IDX, regoff, mask, val)); -} - -/* mask&set gpio interrupt mask bits */ -uint32 -si_gpiointmask(si_t *sih, uint32 mask, uint32 val, uint8 priority) -{ - si_info_t *sii; - uint regoff; - - sii = SI_INFO(sih); - regoff = 0; - - /* gpios could be shared on router platforms */ - if ((BUSTYPE(sih->bustype) == SI_BUS) && (val || mask)) { - mask = priority ? (si_gpioreservation & mask) : - ((si_gpioreservation | mask) & ~(si_gpioreservation)); - val &= mask; - } - - regoff = OFFSETOF(chipcregs_t, gpiointmask); - return (si_corereg(sih, SI_CC_IDX, regoff, mask, val)); -} - -/* assign the gpio to an led */ -uint32 -si_gpioled(si_t *sih, uint32 mask, uint32 val) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - if (sih->ccrev < 16) - return -1; - - /* gpio led powersave reg */ - return (si_corereg(sih, SI_CC_IDX, OFFSETOF(chipcregs_t, gpiotimeroutmask), mask, val)); -} - -/* mask&set gpio timer val */ -uint32 -si_gpiotimerval(si_t *sih, uint32 mask, uint32 gpiotimerval) -{ - si_info_t *sii; - - sii = SI_INFO(sih); - - if (sih->ccrev < 16) - return -1; - - return (si_corereg(sih, SI_CC_IDX, - OFFSETOF(chipcregs_t, gpiotimerval), mask, gpiotimerval)); -} - -uint32 -si_gpiopull(si_t *sih, bool updown, uint32 mask, uint32 val) -{ - si_info_t *sii; - uint offs; - - sii = SI_INFO(sih); - if (sih->ccrev < 20) - return -1; - - offs = (updown ? OFFSETOF(chipcregs_t, gpiopulldown) : OFFSETOF(chipcregs_t, gpiopullup)); - return (si_corereg(sih, SI_CC_IDX, offs, mask, val)); -} - -uint32 -si_gpioevent(si_t *sih, uint regtype, uint32 mask, uint32 val) -{ - si_info_t *sii; - uint offs; - - sii = SI_INFO(sih); - if (sih->ccrev < 11) - return -1; - - if (regtype == GPIO_REGEVT) - offs = OFFSETOF(chipcregs_t, gpioevent); - else if (regtype == GPIO_REGEVT_INTMSK) - offs = OFFSETOF(chipcregs_t, gpioeventintmask); - else if (regtype == GPIO_REGEVT_INTPOL) - offs = OFFSETOF(chipcregs_t, gpioeventintpolarity); - else - return -1; - - return (si_corereg(sih, SI_CC_IDX, offs, mask, val)); -} - -void * -si_gpio_handler_register(si_t *sih, uint32 event, - bool level, gpio_handler_t cb, void *arg) -{ - si_info_t *sii; - gpioh_item_t *gi; - - ASSERT(event); - ASSERT(cb != NULL); - - sii = SI_INFO(sih); - if (sih->ccrev < 11) - return NULL; - - if ((gi = MALLOC(sii->osh, sizeof(gpioh_item_t))) == NULL) - return NULL; - - bzero(gi, sizeof(gpioh_item_t)); - gi->event = event; - gi->handler = cb; - gi->arg = arg; - gi->level = level; - - gi->next = sii->gpioh_head; - sii->gpioh_head = gi; - - return (void *)(gi); -} - -void -si_gpio_handler_unregister(si_t *sih, void *gpioh) -{ - si_info_t *sii; - gpioh_item_t *p, *n; - - sii = SI_INFO(sih); - if (sih->ccrev < 11) - return; - - ASSERT(sii->gpioh_head != NULL); - if ((void*)sii->gpioh_head == gpioh) { - sii->gpioh_head = sii->gpioh_head->next; - MFREE(sii->osh, gpioh, sizeof(gpioh_item_t)); - return; - } else { - p = sii->gpioh_head; - n = p->next; - while (n) { - if ((void*)n == gpioh) { - p->next = n->next; - MFREE(sii->osh, gpioh, sizeof(gpioh_item_t)); - return; - } - p = n; - n = n->next; - } - } - - ASSERT(0); /* Not found in list */ -} - -void -si_gpio_handler_process(si_t *sih) -{ - si_info_t *sii; - gpioh_item_t *h; - uint32 status; - uint32 level = si_gpioin(sih); - uint32 edge = si_gpioevent(sih, GPIO_REGEVT, 0, 0); - - sii = SI_INFO(sih); - for (h = sii->gpioh_head; h != NULL; h = h->next) { - if (h->handler) { - status = (h->level ? level : edge); - - if (status & h->event) - h->handler(status, h->arg); - } - } - - si_gpioevent(sih, GPIO_REGEVT, edge, edge); /* clear edge-trigger status */ -} - -uint32 -si_gpio_int_enable(si_t *sih, bool enable) -{ - si_info_t *sii; - uint offs; - - sii = SI_INFO(sih); - if (sih->ccrev < 11) - return -1; - - offs = OFFSETOF(chipcregs_t, intmask); - return (si_corereg(sih, SI_CC_IDX, offs, CI_GPIO, (enable ? CI_GPIO : 0))); -} - - -/* Return the RAM size of the SOCRAM core */ -uint32 -si_socram_size(si_t *sih) -{ - si_info_t *sii; - uint origidx; - uint intr_val = 0; - - sbsocramregs_t *regs; - bool wasup; - uint corerev; - uint32 coreinfo; - uint memsize = 0; - - sii = SI_INFO(sih); - - /* Block ints and save current core */ - INTR_OFF(sii, intr_val); - origidx = si_coreidx(sih); - - /* Switch to SOCRAM core */ - if (!(regs = si_setcore(sih, SOCRAM_CORE_ID, 0))) - goto done; - - /* Get info for determining size */ - if (!(wasup = si_iscoreup(sih))) - si_core_reset(sih, 0, 0); - corerev = si_corerev(sih); - coreinfo = R_REG(sii->osh, ®s->coreinfo); - - /* Calculate size from coreinfo based on rev */ - if (corerev == 0) - memsize = 1 << (16 + (coreinfo & SRCI_MS0_MASK)); - else if (corerev < 3) { - memsize = 1 << (SR_BSZ_BASE + (coreinfo & SRCI_SRBSZ_MASK)); - memsize *= (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT; - } else { - uint nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT; - uint bsz = (coreinfo & SRCI_SRBSZ_MASK); - uint lss = (coreinfo & SRCI_LSS_MASK) >> SRCI_LSS_SHIFT; - if (lss != 0) - nb --; - memsize = nb * (1 << (bsz + SR_BSZ_BASE)); - if (lss != 0) - memsize += (1 << ((lss - 1) + SR_BSZ_BASE)); - } - - /* Return to previous state and core */ - if (!wasup) - si_core_disable(sih, 0); - si_setcoreidx(sih, origidx); - -done: - INTR_RESTORE(sii, intr_val); - - return memsize; -} - - -void -si_btcgpiowar(si_t *sih) -{ - si_info_t *sii; - uint origidx; - uint intr_val = 0; - chipcregs_t *cc; - - sii = SI_INFO(sih); - - /* Make sure that there is ChipCommon core present && - * UART_TX is strapped to 1 - */ - if (!(sih->cccaps & CC_CAP_UARTGPIO)) - return; - - /* si_corereg cannot be used as we have to guarantee 8-bit read/writes */ - INTR_OFF(sii, intr_val); - - origidx = si_coreidx(sih); - - cc = (chipcregs_t *)si_setcore(sih, CC_CORE_ID, 0); - ASSERT(cc != NULL); - - W_REG(sii->osh, &cc->uart0mcr, R_REG(sii->osh, &cc->uart0mcr) | 0x04); - - /* restore the original index */ - si_setcoreidx(sih, origidx); - - INTR_RESTORE(sii, intr_val); -} - -/* check if the device is removed */ -bool -si_deviceremoved(si_t *sih) -{ - uint32 w; - si_info_t *sii; - - sii = SI_INFO(sih); - - switch (BUSTYPE(sih->bustype)) { - case PCI_BUS: - ASSERT(sii->osh != NULL); - w = OSL_PCI_READ_CONFIG(sii->osh, PCI_CFG_VID, sizeof(uint32)); - if ((w & 0xFFFF) != VENDOR_BROADCOM) - return TRUE; - else - return FALSE; - default: - return FALSE; - } - return FALSE; -} diff --git a/drivers/net/wireless/bcm4319/siutils_priv.h b/drivers/net/wireless/bcm4319/siutils_priv.h deleted file mode 100644 index e8ad7e50958a..000000000000 --- a/drivers/net/wireless/bcm4319/siutils_priv.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Include file private to the SOC Interconnect support files. - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: siutils_priv.h,v 1.3.10.5.4.2 2009/09/22 13:28:16 Exp $ - */ - -#ifndef _siutils_priv_h_ -#define _siutils_priv_h_ - -/* debug/trace */ -#define SI_ERROR(args) - -#define SI_MSG(args) - -#define IS_SIM(chippkg) ((chippkg == HDLSIM_PKG_ID) || (chippkg == HWSIM_PKG_ID)) - -typedef uint32 (*si_intrsoff_t)(void *intr_arg); -typedef void (*si_intrsrestore_t)(void *intr_arg, uint32 arg); -typedef bool (*si_intrsenabled_t)(void *intr_arg); - -typedef struct gpioh_item { - void *arg; - bool level; - gpio_handler_t handler; - uint32 event; - struct gpioh_item *next; -} gpioh_item_t; - -/* misc si info needed by some of the routines */ -typedef struct si_common_info { - void *regs[SI_MAXCORES]; /* other regs va */ - void *regs2[SI_MAXCORES]; /* va of each core second register set (usbh20) */ - uint coreid[SI_MAXCORES]; /* id of each core */ - uint32 cia[SI_MAXCORES]; /* erom cia entry for each core */ - uint32 cib[SI_MAXCORES]; /* erom cia entry for each core */ - uint32 coresba_size[SI_MAXCORES]; /* backplane address space size */ - uint32 coresba2_size[SI_MAXCORES]; /* second address space size */ - uint32 coresba[SI_MAXCORES]; /* backplane address of each core */ - uint32 coresba2[SI_MAXCORES]; /* address of each core second register set (usbh20) */ - void *wrappers[SI_MAXCORES]; /* other cores wrapper va */ - uint32 wrapba[SI_MAXCORES]; /* address of controlling wrapper */ - uint32 oob_router; /* oob router registers for axi */ - uint8 attach_count; -} si_common_info_t; - -typedef struct si_info { - struct si_pub pub; /* back plane public state (must be first field) */ - - void *osh; /* osl os handle */ - void *sdh; /* bcmsdh handle */ - void *pch; /* PCI/E core handle */ - uint dev_coreid; /* the core provides driver functions */ - void *intr_arg; /* interrupt callback function arg */ - si_intrsoff_t intrsoff_fn; /* turns chip interrupts off */ - si_intrsrestore_t intrsrestore_fn; /* restore chip interrupts */ - si_intrsenabled_t intrsenabled_fn; /* check if interrupts are enabled */ - - - gpioh_item_t *gpioh_head; /* GPIO event handlers list */ - - bool memseg; /* flag to toggle MEM_SEG register */ - - char *vars; - uint varsz; - - void *curmap; /* current regs va */ - - uint curidx; /* current core index */ - uint numcores; /* # discovered cores */ - void *curwrap; /* current wrapper va */ - si_common_info_t *common_info; /* Common information for all the cores in a chip */ -} si_info_t; - -#define SI_INFO(sih) (si_info_t *)(uintptr)sih - -#define GOODCOREADDR(x, b) (((x) >= (b)) && ((x) < ((b) + SI_MAXCORES * SI_CORE_SIZE)) && \ - ISALIGNED((x), SI_CORE_SIZE)) -#define GOODREGS(regs) ((regs) != NULL && ISALIGNED((uintptr)(regs), SI_CORE_SIZE)) -#define BADCOREADDR 0 -#define GOODIDX(idx) (((uint)idx) < SI_MAXCORES) -#define BADIDX (SI_MAXCORES + 1) -#define NOREV -1 /* Invalid rev */ - -#define PCI(si) ((BUSTYPE((si)->pub.bustype) == PCI_BUS) && \ - ((si)->pub.buscoretype == PCI_CORE_ID)) -#define PCIE(si) ((BUSTYPE((si)->pub.bustype) == PCI_BUS) && \ - ((si)->pub.buscoretype == PCIE_CORE_ID)) -#define PCMCIA(si) ((BUSTYPE((si)->pub.bustype) == PCMCIA_BUS) && ((si)->memseg == TRUE)) - -/* Newer chips can access PCI/PCIE and CC core without requiring to change - * PCI BAR0 WIN - */ -#define SI_FAST(si) (((si)->pub.buscoretype == PCIE_CORE_ID) || \ - (((si)->pub.buscoretype == PCI_CORE_ID) && (si)->pub.buscorerev >= 13)) - -#define PCIEREGS(si) (((char *)((si)->curmap) + PCI_16KB0_PCIREGS_OFFSET)) -#define CCREGS_FAST(si) (((char *)((si)->curmap) + PCI_16KB0_CCREGS_OFFSET)) - -/* - * Macros to disable/restore function core(D11, ENET, ILINE20, etc) interrupts before/ - * after core switching to avoid invalid register accesss inside ISR. - */ -#define INTR_OFF(si, intr_val) \ - if ((si)->intrsoff_fn && (si)->common_info->coreid[(si)->curidx] == (si)->dev_coreid) { \ - intr_val = (*(si)->intrsoff_fn)((si)->intr_arg); } -#define INTR_RESTORE(si, intr_val) \ - if ((si)->intrsrestore_fn && (si)->common_info->coreid[(si)->curidx] == (si)->dev_coreid) {\ - (*(si)->intrsrestore_fn)((si)->intr_arg, intr_val); } - -/* dynamic clock control defines */ -#define LPOMINFREQ 25000 /* low power oscillator min */ -#define LPOMAXFREQ 43000 /* low power oscillator max */ -#define XTALMINFREQ 19800000 /* 20 MHz - 1% */ -#define XTALMAXFREQ 20200000 /* 20 MHz + 1% */ -#define PCIMINFREQ 25000000 /* 25 MHz */ -#define PCIMAXFREQ 34000000 /* 33 MHz + fudge */ - -#define ILP_DIV_5MHZ 0 /* ILP = 5 MHz */ -#define ILP_DIV_1MHZ 4 /* ILP = 1 MHz */ - -#define PCI_FORCEHT(si) \ - (((PCIE(si)) && (si->pub.chip == BCM4311_CHIP_ID) && ((si->pub.chiprev <= 1))) || \ - ((PCI(si) || PCIE(si)) && (si->pub.chip == BCM4321_CHIP_ID))) - -/* GPIO Based LED powersave defines */ -#define DEFAULT_GPIO_ONTIME 10 /* Default: 10% on */ -#define DEFAULT_GPIO_OFFTIME 90 /* Default: 10% on */ - -#ifndef DEFAULT_GPIOTIMERVAL -#define DEFAULT_GPIOTIMERVAL ((DEFAULT_GPIO_ONTIME << GPIO_ONTIME_SHIFT) | DEFAULT_GPIO_OFFTIME) -#endif - -/* Silicon Backplane externs */ -extern void sb_scan(si_t *sih, void *regs, uint devid); -extern uint sb_coreid(si_t *sih); -extern uint sb_flag(si_t *sih); -extern void sb_setint(si_t *sih, int siflag); -extern uint sb_corevendor(si_t *sih); -extern uint sb_corerev(si_t *sih); -extern uint sb_corereg(si_t *sih, uint coreidx, uint regoff, uint mask, uint val); -extern bool sb_iscoreup(si_t *sih); -extern void *sb_setcoreidx(si_t *sih, uint coreidx); -extern uint32 sb_core_cflags(si_t *sih, uint32 mask, uint32 val); -extern void sb_core_cflags_wo(si_t *sih, uint32 mask, uint32 val); -extern uint32 sb_core_sflags(si_t *sih, uint32 mask, uint32 val); -extern void sb_commit(si_t *sih); -extern uint32 sb_base(uint32 admatch); -extern uint32 sb_size(uint32 admatch); -extern void sb_core_reset(si_t *sih, uint32 bits, uint32 resetbits); -extern void sb_core_tofixup(si_t *sih); -extern void sb_core_disable(si_t *sih, uint32 bits); -extern uint32 sb_addrspace(si_t *sih, uint asidx); -extern uint32 sb_addrspacesize(si_t *sih, uint asidx); -extern int sb_numaddrspaces(si_t *sih); - -extern uint32 sb_set_initiator_to(si_t *sih, uint32 to, uint idx); - - - -/* Wake-on-wireless-LAN (WOWL) */ -extern bool sb_pci_pmecap(si_t *sih); -struct osl_info; -extern bool sb_pci_fastpmecap(struct osl_info *osh); -extern bool sb_pci_pmeclr(si_t *sih); -extern void sb_pci_pmeen(si_t *sih); -extern uint sb_pcie_readreg(void *sih, uint addrtype, uint offset); - -/* AMBA Interconnect exported externs */ -extern si_t *ai_attach(uint pcidev, osl_t *osh, void *regs, uint bustype, - void *sdh, char **vars, uint *varsz); -extern si_t *ai_kattach(osl_t *osh); -extern void ai_scan(si_t *sih, void *regs, uint devid); - -extern uint ai_flag(si_t *sih); -extern void ai_setint(si_t *sih, int siflag); -extern uint ai_coreidx(si_t *sih); -extern uint ai_corevendor(si_t *sih); -extern uint ai_corerev(si_t *sih); -extern bool ai_iscoreup(si_t *sih); -extern void *ai_setcoreidx(si_t *sih, uint coreidx); -extern uint32 ai_core_cflags(si_t *sih, uint32 mask, uint32 val); -extern void ai_core_cflags_wo(si_t *sih, uint32 mask, uint32 val); -extern uint32 ai_core_sflags(si_t *sih, uint32 mask, uint32 val); -extern uint ai_corereg(si_t *sih, uint coreidx, uint regoff, uint mask, uint val); -extern void ai_core_reset(si_t *sih, uint32 bits, uint32 resetbits); -extern void ai_core_disable(si_t *sih, uint32 bits); -extern int ai_numaddrspaces(si_t *sih); -extern uint32 ai_addrspace(si_t *sih, uint asidx); -extern uint32 ai_addrspacesize(si_t *sih, uint asidx); -extern void ai_write_wrap_reg(si_t *sih, uint32 offset, uint32 val); - - -#endif /* _siutils_priv_h_ */ diff --git a/drivers/net/wireless/bcm4319/wl_cfg80211.c b/drivers/net/wireless/bcm4319/wl_cfg80211.c deleted file mode 100644 index 81491cb97746..000000000000 --- a/drivers/net/wireless/bcm4319/wl_cfg80211.c +++ /dev/null @@ -1,4491 +0,0 @@ -/* - * Linux Cfg80211 support - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: wl_cfg80211.c,v 1.1.2.28 2010/05/04 21:43:38 Exp $ - */ - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -static struct sdio_func *cfg80211_sdio_func = NULL; -static struct wl_dev *wl_cfg80211_dev = NULL; - -#ifdef WL_CFG80211_BACKTRACE -uint32 wl_dbg_level = WL_DBG_ERR | WL_DBG_INFO | WL_DBG_DBG; -#else -uint32 wl_dbg_level = WL_DBG_ERR | WL_DBG_INFO; -#endif - -#define WL_4329_FW_FILE "brcm/fw_4329.bin" -#define WL_4329_NVRAM_FILE "brcm/nvram_4329.txt" - -/* -** cfg80211_ops api/callback list -*/ -static int32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, - enum nl80211_iftype type, uint32 *flags, struct vif_params *params); -static int32 __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_scan_request *request, struct cfg80211_ssid *this_ssid); -static int32 wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_scan_request *request); -static int32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, uint32 changed); -static int32 wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ibss_params *params); -static int32 wl_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev); -static int32 wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, - uint8 *mac, struct station_info *sinfo); -static int32 wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, - struct net_device *dev, bool enabled, int32 timeout); -static int32 wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, - struct net_device *dev, const uint8 *addr, - const struct cfg80211_bitrate_mask *mask); -static int wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_connect_params *sme); -static int32 wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, - uint16 reason_code); -static int32 wl_cfg80211_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type, int32 dbm); -static int32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, int32 *dbm); -static int32 wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx); -static int32 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr, struct key_params *params); -static int32 wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr); -static int32 wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr, void *cookie, - void (*callback)(void *cookie, struct key_params *params)); -static int32 wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, - struct net_device *dev, uint8 key_idx); -static int32 wl_cfg80211_resume(struct wiphy *wiphy); -static int32 wl_cfg80211_suspend(struct wiphy *wiphy); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) -static int32 wl_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_pmksa *pmksa); -static int32 wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_pmksa *pmksa); -static int32 wl_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev); -#endif -/* -** event & event Q handlers for cfg80211 interfaces -*/ -static int32 wl_create_event_handler(struct wl_priv *wl); -static void wl_destroy_event_handler(struct wl_priv *wl); -static int32 wl_event_handler(void *data); -static void wl_init_eq(struct wl_priv *wl); -static void wl_flush_eq(struct wl_priv *wl); -static void wl_lock_eq(struct wl_priv *wl); -static void wl_unlock_eq(struct wl_priv *wl); -static void wl_init_eq_lock(struct wl_priv *wl); -static void wl_init_eloop_handler(struct wl_event_loop *el); -static struct wl_event_q *wl_deq_event(struct wl_priv *wl); -static int32 wl_enq_event(struct wl_priv *wl, uint32 type, const wl_event_msg_t *msg, void *data); -static void wl_put_event(struct wl_event_q *e); -static void wl_wakeup_event(struct wl_priv *wl); -static int32 wl_notify_connect_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data); -static int32 wl_notify_roaming_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data); -static int32 wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data); -static int32 wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data); -static int32 wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data); -static int32 wl_notify_mic_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data); - -/* -** register/deregister sdio function -*/ -static struct sdio_func *wl_sdio_func(void); -static void wl_clear_sdio_func(void); - -/* -** ioctl utilites -*/ -static int32 wl_dev_bufvar_get(struct net_device *dev, int8 *name, int8 *buf, int32 buf_len); -static __used int32 wl_dev_bufvar_set(struct net_device *dev, int8 *name, int8 *buf, int32 len); -static int32 wl_dev_intvar_set(struct net_device *dev, int8 *name, int32 val); -static int32 wl_dev_intvar_get(struct net_device *dev, int8 *name, int32 *retval); -static int32 wl_dev_ioctl(struct net_device *dev, uint32 cmd, void *arg, uint32 len); - - -/* -** cfg80211 set_wiphy_params utilities -*/ -static int32 wl_set_frag(struct net_device *dev, uint32 frag_threshold); -static int32 wl_set_rts(struct net_device *dev, uint32 frag_threshold); -static int32 wl_set_retry(struct net_device *dev, uint32 retry, bool l); - -/* -** wl profile utilities -*/ -static int32 wl_update_prof(struct wl_priv *wl, const wl_event_msg_t *e, void *data, int32 item); -static void * wl_read_prof(struct wl_priv *wl, int32 item); -static void wl_init_prof(struct wl_profile *prof); - - -/* -** cfg80211 connect utilites -*/ -static int32 wl_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme); -static int32 wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme); -static int32 wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme); -static int32 wl_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme); -static int32 wl_set_set_sharedkey(struct net_device *dev, struct cfg80211_connect_params *sme); -static int32 wl_get_assoc_ies(struct wl_priv *wl); - - -/* -** information element utilities -*/ -static void wl_rst_ie(struct wl_priv *wl); -static int32 wl_add_ie(struct wl_priv *wl, uint8 t, uint8 l, uint8 *v); -static int32 wl_mrg_ie(struct wl_priv *wl, uint8 *ie_stream, uint16 ie_size); -static int32 wl_cp_ie(struct wl_priv *wl, uint8 *dst, uint16 dst_size); -static uint32 wl_get_ielen(struct wl_priv *wl); - - -static int32 wl_mode_to_nl80211_iftype(int32 mode); - -static struct wireless_dev *wl_alloc_wdev(int32 sizeof_iface, struct device *dev); -static void wl_free_wdev(struct wl_priv *wl); - -static int32 wl_inform_bss(struct wl_priv *wl); -static int32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi); -static int32 wl_update_bss_info(struct wl_priv *wl); - -static int32 wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr, struct key_params *params); - - -/* -** key indianess swap utilities -*/ -static void swap_key_from_BE(struct wl_wsec_key *key); -static void swap_key_to_BE(struct wl_wsec_key *key); - - -/* -** wl_priv memory init/deinit utilities -*/ -static int32 wl_init_priv_mem(struct wl_priv *wl); -static void wl_deinit_priv_mem(struct wl_priv *wl); - -static void wl_delay(uint32 ms); - -/* -** store/restore cfg80211 instance data -*/ -static void wl_set_drvdata(struct wl_dev *dev, void *data); -static void *wl_get_drvdata(struct wl_dev *dev); - -/* -** ibss mode utilities -*/ -static bool wl_is_ibssmode(struct wl_priv *wl); -static bool wl_is_ibssstarter(struct wl_priv *wl); - -/* -** dongle up/down , default configuration utilities -*/ -static bool wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e); -static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e); -static void wl_link_up(struct wl_priv *wl); -static void wl_link_down(struct wl_priv *wl); -static int32 wl_dongle_mode(struct net_device *ndev, int32 iftype); -static int32 __wl_cfg80211_up(struct wl_priv *wl); -static int32 __wl_cfg80211_down(struct wl_priv *wl); -static int32 wl_dongle_probecap(struct wl_priv *wl); -static void wl_init_conf(struct wl_conf *conf); - -/* -** dongle configuration utilities -*/ -#ifndef EMBEDDED_PLATFORM -static int32 wl_dongle_mode(struct net_device *ndev, int32 iftype); -static int32 wl_dongle_country(struct net_device *ndev, uint8 ccode); -static int32 wl_dongle_up(struct net_device *ndev, uint32 up); -static int32 wl_dongle_power(struct net_device *ndev, uint32 power_mode); -static int32 wl_dongle_glom(struct net_device *ndev, uint32 glom, uint32 dongle_align); -static int32 wl_dongle_roam(struct net_device *ndev, uint32 roamvar, uint32 bcn_timeout); -static int32 wl_dongle_eventmsg(struct net_device *ndev); -static int32 wl_dongle_scantime(struct net_device *ndev, int32 scan_assoc_time, - int32 scan_unassoc_time); -static int32 wl_dongle_offload(struct net_device *ndev, int32 arpoe, int32 arp_ol); -static int32 wl_pattern_atoh(int8 *src, int8 *dst); -static int32 wl_dongle_filter(struct net_device *ndev, uint32 filter_mode); -static int32 wl_update_wiphybands(struct wl_priv *wl); -#endif /* !EMBEDDED_PLATFORM */ -static int32 wl_config_dongle(struct wl_priv *wl, bool need_lock); - -/* -** iscan handler -*/ -static void wl_iscan_timer(ulong data); -static void wl_term_iscan(struct wl_priv *wl); -static int32 wl_init_iscan(struct wl_priv *wl); -static int32 wl_iscan_thread(void *data); -static int32 wl_dev_iovar_setbuf(struct net_device *dev, int8 *iovar, void *param, - int32 paramlen, void *bufptr, int32 buflen); -static int32 wl_dev_iovar_getbuf(struct net_device *dev, int8 *iovar, void *param, - int32 paramlen, void *bufptr, int32 buflen); -static int32 wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid, uint16 action); -static int32 wl_do_iscan(struct wl_priv *wl); -static int32 wl_wakeup_iscan(struct wl_iscan_ctrl *iscan); -static int32 wl_invoke_iscan(struct wl_priv *wl); -static int32 wl_get_iscan_results(struct wl_iscan_ctrl *iscan, uint32 *status, - struct wl_scan_results **bss_list); -static void wl_notify_iscan_complete(struct wl_iscan_ctrl *iscan, bool aborted); -static void wl_init_iscan_eloop(struct wl_iscan_eloop *el); -static int32 wl_iscan_done(struct wl_priv *wl); -static int32 wl_iscan_pending(struct wl_priv *wl); -static int32 wl_iscan_inprogress(struct wl_priv *wl); -static int32 wl_iscan_aborted(struct wl_priv *wl); - -/* -** fw/nvram downloading handler -*/ -static void wl_init_fw(struct wl_fw_ctrl *fw); - -/* -* find most significant bit set -*/ -static __used uint32 wl_find_msb(uint16 bit16); - -/* -* update pmklist to dongle -*/ -static __used int32 wl_update_pmklist(struct net_device *dev, struct wl_pmk_list *pmk_list, - int32 err); - - -#define WL_PRIV_GET() \ - ({ \ - struct wl_iface *ci; \ - if (unlikely(!(wl_cfg80211_dev && (ci = wl_get_drvdata(wl_cfg80211_dev))))) { \ - WL_ERR(("wl_cfg80211_dev is unavailable\n")); \ - BUG(); \ - } \ - ci_to_wl(ci); \ - }) - -#define CHECK_SYS_UP() \ - do { \ - struct wl_priv *wl = wiphy_to_wl(wiphy); \ - if (unlikely(!test_bit(WL_STATUS_READY, &wl->status))) { \ - WL_INFO(("device is not ready : status (%d)\n", (int)wl->status)); \ - return -EIO; \ - } \ - } while (0) - - -extern int dhd_wait_pend8021x(struct net_device *dev); - -#if (WL_DBG_LEVEL > 0) -#define WL_DBG_ESTR_MAX 32 -static int8 wl_dbg_estr[][WL_DBG_ESTR_MAX] = { -"SET_SSID", "JOIN", "START", "AUTH", "AUTH_IND", -"DEAUTH", "DEAUTH_IND", "ASSOC", "ASSOC_IND", "REASSOC", -"REASSOC_IND", "DISASSOC", "DISASSOC_IND", "QUIET_START", "QUIET_END", -"BEACON_RX", "LINK", "MIC_ERROR", "NDIS_LINK", "ROAM", -"TXFAIL", "PMKID_CACHE", "RETROGRADE_TSF", "PRUNE", "AUTOAUTH", -"EAPOL_MSG", "SCAN_COMPLETE", "ADDTS_IND", "DELTS_IND", "BCNSENT_IND", -"BCNRX_MSG", "BCNLOST_MSG", "ROAM_PREP", "PFN_NET_FOUND", "PFN_NET_LOST", -"RESET_COMPLETE", "JOIN_START", "ROAM_START", "ASSOC_START", "IBSS_ASSOC", -"RADIO", "PSM_WATCHDOG", -"PROBREQ_MSG", -"SCAN_CONFIRM_IND", "PSK_SUP", "COUNTRY_CODE_CHANGED", "EXCEEDED_MEDIUM_TIME", "ICV_ERROR", -"UNICAST_DECODE_ERROR", "MULTICAST_DECODE_ERROR", "TRACE", -"IF", -"RSSI", "PFN_SCAN_COMPLETE", "ACTION_FRAME", "ACTION_FRAME_COMPLETE", -}; -#endif /* WL_DBG_LEVEL */ - -#define CHAN2G(_channel, _freq, _flags) { \ - .band = IEEE80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -#define CHAN5G(_channel, _flags) { \ - .band = IEEE80211_BAND_5GHZ, \ - .center_freq = 5000 + (5 * (_channel)), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -#define RATE_TO_BASE100KBPS(rate) (((rate) * 10) / 2) -#define RATETAB_ENT(_rateid, _flags) \ - { \ - .bitrate = RATE_TO_BASE100KBPS(_rateid), \ - .hw_value = (_rateid), \ - .flags = (_flags), \ - } - -static struct ieee80211_rate __wl_rates[] = { - RATETAB_ENT(WLC_RATE_1M, 0), - RATETAB_ENT(WLC_RATE_2M, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(WLC_RATE_5M5, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(WLC_RATE_11M, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(WLC_RATE_6M, 0), - RATETAB_ENT(WLC_RATE_9M, 0), - RATETAB_ENT(WLC_RATE_12M, 0), - RATETAB_ENT(WLC_RATE_18M, 0), - RATETAB_ENT(WLC_RATE_24M, 0), - RATETAB_ENT(WLC_RATE_36M, 0), - RATETAB_ENT(WLC_RATE_48M, 0), - RATETAB_ENT(WLC_RATE_54M, 0), -}; - -#define wl_a_rates (__wl_rates + 4) -#define wl_a_rates_size 8 -#define wl_g_rates (__wl_rates + 0) -#define wl_g_rates_size 12 - -static struct ieee80211_channel __wl_2ghz_channels[] = { - CHAN2G(1, 2412, 0), - CHAN2G(2, 2417, 0), - CHAN2G(3, 2422, 0), - CHAN2G(4, 2427, 0), - CHAN2G(5, 2432, 0), - CHAN2G(6, 2437, 0), - CHAN2G(7, 2442, 0), - CHAN2G(8, 2447, 0), - CHAN2G(9, 2452, 0), - CHAN2G(10, 2457, 0), - CHAN2G(11, 2462, 0), - CHAN2G(12, 2467, 0), - CHAN2G(13, 2472, 0), - CHAN2G(14, 2484, 0), -}; - -static struct ieee80211_channel __wl_5ghz_a_channels[] = { - CHAN5G(34, 0), CHAN5G(36, 0), - CHAN5G(38, 0), CHAN5G(40, 0), - CHAN5G(42, 0), CHAN5G(44, 0), - CHAN5G(46, 0), CHAN5G(48, 0), - CHAN5G(52, 0), CHAN5G(56, 0), - CHAN5G(60, 0), CHAN5G(64, 0), - CHAN5G(100, 0), CHAN5G(104, 0), - CHAN5G(108, 0), CHAN5G(112, 0), - CHAN5G(116, 0), CHAN5G(120, 0), - CHAN5G(124, 0), CHAN5G(128, 0), - CHAN5G(132, 0), CHAN5G(136, 0), - CHAN5G(140, 0), CHAN5G(149, 0), - CHAN5G(153, 0), CHAN5G(157, 0), - CHAN5G(161, 0), CHAN5G(165, 0), - CHAN5G(184, 0), CHAN5G(188, 0), - CHAN5G(192, 0), CHAN5G(196, 0), - CHAN5G(200, 0), CHAN5G(204, 0), - CHAN5G(208, 0), CHAN5G(212, 0), - CHAN5G(216, 0), -}; - -static struct ieee80211_channel __wl_5ghz_n_channels[] = { - CHAN5G(32, 0), CHAN5G(34, 0), - CHAN5G(36, 0), CHAN5G(38, 0), - CHAN5G(40, 0), CHAN5G(42, 0), - CHAN5G(44, 0), CHAN5G(46, 0), - CHAN5G(48, 0), CHAN5G(50, 0), - CHAN5G(52, 0), CHAN5G(54, 0), - CHAN5G(56, 0), CHAN5G(58, 0), - CHAN5G(60, 0), CHAN5G(62, 0), - CHAN5G(64, 0), CHAN5G(66, 0), - CHAN5G(68, 0), CHAN5G(70, 0), - CHAN5G(72, 0), CHAN5G(74, 0), - CHAN5G(76, 0), CHAN5G(78, 0), - CHAN5G(80, 0), CHAN5G(82, 0), - CHAN5G(84, 0), CHAN5G(86, 0), - CHAN5G(88, 0), CHAN5G(90, 0), - CHAN5G(92, 0), CHAN5G(94, 0), - CHAN5G(96, 0), CHAN5G(98, 0), - CHAN5G(100, 0), CHAN5G(102, 0), - CHAN5G(104, 0), CHAN5G(106, 0), - CHAN5G(108, 0), CHAN5G(110, 0), - CHAN5G(112, 0), CHAN5G(114, 0), - CHAN5G(116, 0), CHAN5G(118, 0), - CHAN5G(120, 0), CHAN5G(122, 0), - CHAN5G(124, 0), CHAN5G(126, 0), - CHAN5G(128, 0), CHAN5G(130, 0), - CHAN5G(132, 0), CHAN5G(134, 0), - CHAN5G(136, 0), CHAN5G(138, 0), - CHAN5G(140, 0), CHAN5G(142, 0), - CHAN5G(144, 0), CHAN5G(145, 0), - CHAN5G(146, 0), CHAN5G(147, 0), - CHAN5G(148, 0), CHAN5G(149, 0), - CHAN5G(150, 0), CHAN5G(151, 0), - CHAN5G(152, 0), CHAN5G(153, 0), - CHAN5G(154, 0), CHAN5G(155, 0), - CHAN5G(156, 0), CHAN5G(157, 0), - CHAN5G(158, 0), CHAN5G(159, 0), - CHAN5G(160, 0), CHAN5G(161, 0), - CHAN5G(162, 0), CHAN5G(163, 0), - CHAN5G(164, 0), CHAN5G(165, 0), - CHAN5G(166, 0), CHAN5G(168, 0), - CHAN5G(170, 0), CHAN5G(172, 0), - CHAN5G(174, 0), CHAN5G(176, 0), - CHAN5G(178, 0), CHAN5G(180, 0), - CHAN5G(182, 0), CHAN5G(184, 0), - CHAN5G(186, 0), CHAN5G(188, 0), - CHAN5G(190, 0), CHAN5G(192, 0), - CHAN5G(194, 0), CHAN5G(196, 0), - CHAN5G(198, 0), CHAN5G(200, 0), - CHAN5G(202, 0), CHAN5G(204, 0), - CHAN5G(206, 0), CHAN5G(208, 0), - CHAN5G(210, 0), CHAN5G(212, 0), - CHAN5G(214, 0), CHAN5G(216, 0), - CHAN5G(218, 0), CHAN5G(220, 0), - CHAN5G(222, 0), CHAN5G(224, 0), - CHAN5G(226, 0), CHAN5G(228, 0), -}; - -static struct ieee80211_supported_band __wl_band_2ghz = { - .band = IEEE80211_BAND_2GHZ, - .channels = __wl_2ghz_channels, - .n_channels = ARRAY_SIZE(__wl_2ghz_channels), - .bitrates = wl_g_rates, - .n_bitrates = wl_g_rates_size, -}; - -static struct ieee80211_supported_band __wl_band_5ghz_a = { - .band = IEEE80211_BAND_5GHZ, - .channels = __wl_5ghz_a_channels, - .n_channels = ARRAY_SIZE(__wl_5ghz_a_channels), - .bitrates = wl_a_rates, - .n_bitrates = wl_a_rates_size, -}; - -static struct ieee80211_supported_band __wl_band_5ghz_n = { - .band = IEEE80211_BAND_5GHZ, - .channels = __wl_5ghz_n_channels, - .n_channels = ARRAY_SIZE(__wl_5ghz_n_channels), - .bitrates = wl_a_rates, - .n_bitrates = wl_a_rates_size, -}; - -static const uint32 __wl_cipher_suites[] = { - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, - WLAN_CIPHER_SUITE_AES_CMAC, -}; - -static void -swap_key_from_BE(struct wl_wsec_key *key) -{ - key->index = htod32(key->index); - key->len = htod32(key->len); - key->algo = htod32(key->algo); - key->flags = htod32(key->flags); - key->rxiv.hi = htod32(key->rxiv.hi); - key->rxiv.lo = htod16(key->rxiv.lo); - key->iv_initialized = htod32(key->iv_initialized); -} - -static void -swap_key_to_BE(struct wl_wsec_key *key) -{ - key->index = dtoh32(key->index); - key->len = dtoh32(key->len); - key->algo = dtoh32(key->algo); - key->flags = dtoh32(key->flags); - key->rxiv.hi = dtoh32(key->rxiv.hi); - key->rxiv.lo = dtoh16(key->rxiv.lo); - key->iv_initialized = dtoh32(key->iv_initialized); -} - -static int32 -wl_dev_ioctl(struct net_device *dev, uint32 cmd, void *arg, uint32 len) -{ - struct ifreq ifr; - struct wl_ioctl ioc; - mm_segment_t fs; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In : cmd (%d)\n", cmd)); -#endif - memset(&ioc, 0, sizeof(ioc)); - ioc.cmd = cmd; - ioc.buf = arg; - ioc.len = len; - strcpy(ifr.ifr_name, dev->name); - ifr.ifr_data = (caddr_t) &ioc; - - - fs = get_fs(); - set_fs(get_ds()); - err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE); - set_fs(fs); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, - enum nl80211_iftype type, uint32 *flags, struct vif_params *params) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - struct wireless_dev *wdev; - int32 infra = 0; - int32 ap = 0; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - switch (type) { - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_WDS: - WL_ERR(("type (%d) : currently we do not support this type\n", type)); - return -EOPNOTSUPP; - case NL80211_IFTYPE_ADHOC: - wl->conf->mode = WL_MODE_IBSS; - break; - case NL80211_IFTYPE_STATION: - wl->conf->mode = WL_MODE_BSS; - infra = 1; - break; - default: - return -EINVAL; - } - infra = htod32(infra); - ap = htod32(ap); - wdev = ndev->ieee80211_ptr; - wdev->iftype = type; - WL_DBG(("%s : ap (%d), infra (%d)\n", ndev->name, ap, infra)); - if (unlikely((err = wl_dev_ioctl(ndev, WLC_SET_INFRA, &infra, sizeof(infra)))) || - unlikely((err = wl_dev_ioctl(ndev, WLC_SET_AP, &ap, sizeof(ap))))) { - WL_ERR(("Error (%d)\n", err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - /* -EINPROGRESS: Call commit handler */ - return -EINPROGRESS; -} - -static void -wl_iscan_prep(struct wl_scan_params *params, struct wlc_ssid *ssid) -{ - memcpy(¶ms->bssid, ðer_bcast, ETHER_ADDR_LEN); - params->bss_type = DOT11_BSSTYPE_ANY; - params->scan_type = 0; - params->nprobes = -1; - params->active_time = -1; - params->passive_time = -1; - params->home_time = -1; - params->channel_num = 0; - - params->nprobes = htod32(params->nprobes); - params->active_time = htod32(params->active_time); - params->passive_time = htod32(params->passive_time); - params->home_time = htod32(params->home_time); - if (ssid && ssid->SSID_len) - memcpy(¶ms->ssid, ssid, sizeof(wlc_ssid_t)); - -} - -static int32 -wl_dev_iovar_setbuf(struct net_device *dev, int8 *iovar, void *param, - int32 paramlen, void *bufptr, int32 buflen) -{ - int32 iolen; - - iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen); - BUG_ON(unlikely(!iolen)); - - return wl_dev_ioctl(dev, WLC_SET_VAR, bufptr, iolen); -} - -static int32 -wl_dev_iovar_getbuf(struct net_device *dev, int8 *iovar, void *param, - int32 paramlen, void *bufptr, int32 buflen) -{ - int32 iolen; - - iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen); - BUG_ON(unlikely(!iolen)); - - return wl_dev_ioctl(dev, WLC_GET_VAR, bufptr, buflen); -} - -static int32 -wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid, uint16 action) -{ - int32 params_size = (WL_SCAN_PARAMS_FIXED_SIZE + OFFSETOF(wl_iscan_params_t, params)); - struct wl_iscan_params *params; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (ssid && ssid->SSID_len) - params_size += sizeof(struct wlc_ssid); - params = (struct wl_iscan_params *)kzalloc(params_size, GFP_KERNEL); - if (unlikely(!params)) - return -ENOMEM; - memset(params, 0, params_size); - BUG_ON(unlikely(params_size >= WLC_IOCTL_SMLEN)); - - wl_iscan_prep(¶ms->params, ssid); - - params->version = htod32(ISCAN_REQ_VERSION); - params->action = htod16(action); - params->scan_duration = htod16(0); - - /* params_size += OFFSETOF(wl_iscan_params_t, params); */ - if (unlikely((err = wl_dev_iovar_setbuf(iscan->dev, "iscan", params, params_size, - iscan->ioctl_buf, WLC_IOCTL_SMLEN)))) { - if (err == -EBUSY) { - WL_INFO(("system busy : iscan canceled\n")); - } else { - WL_ERR(("error (%d)\n", err)); - } - } - kfree(params); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - - -static int32 -wl_do_iscan(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl_to_iscan(wl); - struct wlc_ssid ssid; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - /* Broadcast scan by default */ - memset(&ssid, 0, sizeof(ssid)); - - iscan->state = WL_ISCAN_STATE_SCANING; - - if (wl->active_scan) { - int32 passive_scan = 0; - /* make it active scan */ - if (unlikely((err = wl_dev_ioctl(wl_to_ndev(wl), WLC_SET_PASSIVE_SCAN, - &passive_scan, sizeof(passive_scan))))) { - WL_DBG(("error (%d)\n", err)); - return err; - } - } - wl->iscan_kickstart = TRUE; - wl_run_iscan(iscan, &ssid, WL_SCAN_ACTION_START); - mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000); - iscan->timer_on = 1; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - - -static int32 -__wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_scan_request *request, struct cfg80211_ssid *this_ssid) -{ - struct wl_priv *wl = ndev_to_wl(ndev); - struct cfg80211_ssid *ssids; - struct wl_scan_req *sr = wl_to_sr(wl); - uint32 n_ssids; - bool iscan_req; - bool spec_scan; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely(test_bit(WL_STATUS_SCANNING, &wl->status))) { - WL_ERR(("Scanning already : status (%d)\n", (int)wl->status)); - return -EAGAIN; - } - if (unlikely(test_bit(WL_STATUS_SCAN_ABORTING, &wl->status))) { - WL_ERR(("Scanning being aborted : status (%d)\n", (int)wl->status)); - return -EAGAIN; - } - - iscan_req = FALSE; - spec_scan = FALSE; - if (request) { /* scan bss */ - ssids = request->ssids; - n_ssids = min(request->n_ssids, WL_NUM_SCAN_MAX); - if (wl->iscan_on && n_ssids && !ssids->ssid_len) { /* for specific scan, - * ssids->ssid_len has - * non-zero(ssid string) length. - * Otherwise this is 0. - * we do not iscan for - * specific scan request - */ - iscan_req = TRUE; - } - } else { /* scan in ibss */ - /* we don't do iscan in ibss */ - ssids = this_ssid; - n_ssids = 1; - } - wl->scan_request = request; - set_bit(WL_STATUS_SCANNING, &wl->status); - if (iscan_req) { - if (likely(!(err = wl_do_iscan(wl)))) - return err; - else - goto scan_out; - } else { - WL_DBG(("n_ssid (%d), ssid \"%s\", ssid_len (%d)\n", - n_ssids, ssids->ssid, ssids->ssid_len)); - memset(&sr->ssid, 0, sizeof(sr->ssid)); - if (n_ssids) { - sr->ssid.SSID_len = MIN(sizeof(sr->ssid.SSID), ssids->ssid_len); - if (sr->ssid.SSID_len) { - memcpy(sr->ssid.SSID, ssids->ssid, sr->ssid.SSID_len); - sr->ssid.SSID_len = htod32(sr->ssid.SSID_len); - WL_DBG(("Specific scan ssid=\"%s\" len=%d\n", sr->ssid.SSID, - sr->ssid.SSID_len)); - spec_scan = TRUE; - } else { - WL_DBG(("Broadcast scan\n")); - } - } else { - /* broadcast scan */ - WL_DBG(("Broadcast scan\n")); - } - WL_DBG(("sr->ssid.SSID_len (%d)\n", sr->ssid.SSID_len)); - if (wl->active_scan) { - int32 pssive_scan = 0; - /* make it active scan */ - if (unlikely((err = wl_dev_ioctl(ndev, WLC_SET_PASSIVE_SCAN, - &pssive_scan, sizeof(pssive_scan))))) { - WL_ERR(("WLC_SET_PASSIVE_SCAN error (%d)\n", err)); - goto scan_out; - } - } - if ((err = wl_dev_ioctl(ndev, WLC_SCAN, &sr->ssid, sizeof(sr->ssid)))) { - if (err == -EBUSY) { - WL_INFO(("system busy : scan for \"%s\" canceled\n", - sr->ssid.SSID)); - } else { - WL_ERR(("WLC_SCAN error (%d)\n", err)); - } - goto scan_out; - } - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return 0; - -scan_out: - clear_bit(WL_STATUS_SCANNING, &wl->status); - wl->scan_request = NULL; - return err; -} - - -static int32 -wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_scan_request *request) -{ - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - if (unlikely((err = __wl_cfg80211_scan(wiphy, ndev, request, NULL)))) { - WL_DBG(("scan error (%d)\n", err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_dev_intvar_set(struct net_device *dev, int8 *name, int32 val) -{ - int8 buf[WLC_IOCTL_SMLEN]; - uint32 len; - int32 err = 0; - - val = htod32(val); - len = bcm_mkiovar(name, (char *)(&val), sizeof(val), buf, sizeof(buf)); - BUG_ON(unlikely(!len)); - - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_VAR, buf, len)))) { - WL_ERR(("error (%d)\n", err)); - } - - return err; -} - -static int32 -wl_dev_intvar_get(struct net_device *dev, int8 *name, int32 *retval) -{ - union { - int8 buf[WLC_IOCTL_SMLEN]; - int32 val; - } var; - uint32 len; - uint32 data_null; - int32 err = 0; - - len = bcm_mkiovar(name, (char *)(&data_null), 0, (char *)(&var), sizeof(var.buf)); - BUG_ON(unlikely(!len)); - if (unlikely((err = wl_dev_ioctl(dev, WLC_GET_VAR, &var, len)))) { - WL_ERR(("error (%d)\n", err)); - } - *retval = dtoh32(var.val); - - return err; -} - -static int32 -wl_set_rts(struct net_device *dev, uint32 rts_threshold) -{ - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely((err = wl_dev_intvar_set(dev, "rtsthresh", rts_threshold)))) { - WL_ERR(("Error (%d)\n", err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_set_frag(struct net_device *dev, uint32 frag_threshold) -{ - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely((err = wl_dev_intvar_set(dev, "fragthresh", frag_threshold)))) { - WL_ERR(("Error (%d)\n", err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_set_retry(struct net_device *dev, uint32 retry, bool l) -{ - int32 err = 0; - uint32 cmd = (l ? WLC_SET_LRL : WLC_SET_SRL); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - retry = htod32(retry); - if (unlikely((err = wl_dev_ioctl(dev, cmd, &retry, sizeof(retry))))) { - WL_ERR(("cmd (%d) , error (%d)\n", cmd, err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, uint32 changed) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - struct net_device *ndev = wl_to_ndev(wl); - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - if (changed & WIPHY_PARAM_RTS_THRESHOLD && - (wl->conf->rts_threshold != wiphy->rts_threshold)) { - wl->conf->rts_threshold = wiphy->rts_threshold; - if (!(err = wl_set_rts(ndev, wl->conf->rts_threshold))) { - return err; - } - } - if (changed & WIPHY_PARAM_FRAG_THRESHOLD && - (wl->conf->frag_threshold != wiphy->frag_threshold)) { - wl->conf->frag_threshold = wiphy->frag_threshold; - if (!(err = wl_set_frag(ndev, wl->conf->frag_threshold))) { - return err; - } - } - if (changed & WIPHY_PARAM_RETRY_LONG && (wl->conf->retry_long != wiphy->retry_long)) { - wl->conf->retry_long = wiphy->retry_long; - if (!(err = wl_set_retry(ndev, wl->conf->retry_long, TRUE))) { - return err; - } - } - if (changed & WIPHY_PARAM_RETRY_SHORT && (wl->conf->retry_short != wiphy->retry_short)) { - wl->conf->retry_short = wiphy->retry_short; - if (!(err = wl_set_retry(ndev, wl->conf->retry_short, FALSE))) { - return err; - } - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ibss_params *params) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - struct cfg80211_bss *bss; - struct ieee80211_channel *chan; - struct wl_join_params join_params; - struct cfg80211_ssid ssid; - int32 scan_retry = 0; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In \n")); -#endif - CHECK_SYS_UP(); - if (params->bssid) { - WL_ERR(("Invalid bssid\n")); - return -EOPNOTSUPP; - } - bss = cfg80211_get_ibss(wiphy, NULL, params->ssid, params->ssid_len); - if (!bss) { - memcpy(ssid.ssid, params->ssid, params->ssid_len); - ssid.ssid_len = params->ssid_len; - do { - if (unlikely(__wl_cfg80211_scan(wiphy, dev, NULL, &ssid) == -EBUSY)) { - wl_delay(150); - } else { - break; - } - } while (++scan_retry < WL_SCAN_RETRY_MAX); - rtnl_unlock(); /* to allow scan_inform to paropagate to cfg80211 plane */ - schedule_timeout_interruptible(4 * HZ); /* wait 4 secons till scan done.... */ - rtnl_lock(); - bss = cfg80211_get_ibss(wiphy, NULL, - params->ssid, params->ssid_len); - } - if (bss) { - wl->ibss_starter = FALSE; - WL_DBG(("Found IBSS\n")); - } else { - wl->ibss_starter = TRUE; - } - if ((chan = params->channel)) { - wl->channel = ieee80211_frequency_to_channel(chan->center_freq); - } - /* - ** Join with specific BSSID and cached SSID - ** If SSID is zero join based on BSSID only - */ - memset(&join_params, 0, sizeof(join_params)); - memcpy((void *)join_params.ssid.SSID, (void *)params->ssid, params->ssid_len); - join_params.ssid.SSID_len = htod32(params->ssid_len); - if (params->bssid) - memcpy(&join_params.params.bssid, params->bssid, ETHER_ADDR_LEN); - else - memset(&join_params.params.bssid, 0, ETHER_ADDR_LEN); - - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, sizeof(join_params))))) { - WL_ERR(("Error (%d)\n", err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - wl_link_down(wl); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme) -{ - struct wl_priv *wl = ndev_to_wl(dev); - struct wl_security *sec; - int32 val = 0; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) - val = WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED; - else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) - val = WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED; - else - val = WPA_AUTH_DISABLED; - WL_DBG(("setting wpa_auth to 0x%0x\n", val)); - if (unlikely((err = wl_dev_intvar_set(dev, "wpa_auth", val)))) { - WL_ERR(("set wpa_auth failed (%d)\n", err)); - return err; - } - sec = wl_read_prof(wl, WL_PROF_SEC); - sec->wpa_versions = sme->crypto.wpa_versions; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme) -{ - struct wl_priv *wl = ndev_to_wl(dev); - struct wl_security *sec; - int32 val = 0; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - switch (sme->auth_type) { - case NL80211_AUTHTYPE_OPEN_SYSTEM: - val = 0; - WL_DBG(("open system\n")); - break; - case NL80211_AUTHTYPE_SHARED_KEY: - val = 1; - WL_DBG(("shared key\n")); - break; - case NL80211_AUTHTYPE_AUTOMATIC: - val = 2; - WL_DBG(("automatic\n")); - break; - case NL80211_AUTHTYPE_NETWORK_EAP: - WL_DBG(("network eap\n")); - default : - val = 2; - WL_ERR(("invalid auth type (%d)\n", sme->auth_type)); - break; - } - - if (unlikely((err = wl_dev_intvar_set(dev, "auth", val)))) { - WL_ERR(("set auth failed (%d)\n", err)); - return err; - } - sec = wl_read_prof(wl, WL_PROF_SEC); - sec->auth_type = sme->auth_type; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - - -static int32 -wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme) -{ - struct wl_priv *wl = ndev_to_wl(dev); - struct wl_security *sec; - int32 pval = 0; - int32 gval = 0; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (sme->crypto.n_ciphers_pairwise) { - switch (sme->crypto.ciphers_pairwise[0]) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - pval = WEP_ENABLED; - break; - case WLAN_CIPHER_SUITE_TKIP: - pval = TKIP_ENABLED; - break; - case WLAN_CIPHER_SUITE_CCMP: - pval = AES_ENABLED; - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - pval = AES_ENABLED; - break; - default: - WL_ERR(("invalid cipher pairwise (%d)\n", - sme->crypto.ciphers_pairwise[0])); - return -EINVAL; - } - } - if (sme->crypto.cipher_group) { - switch (sme->crypto.cipher_group) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - gval = WEP_ENABLED; - break; - case WLAN_CIPHER_SUITE_TKIP: - gval = TKIP_ENABLED; - break; - case WLAN_CIPHER_SUITE_CCMP: - gval = AES_ENABLED; - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - gval = AES_ENABLED; - break; - default: - WL_ERR(("invalid cipher group (%d)\n", sme->crypto.cipher_group)); - return -EINVAL; - } - } - - WL_DBG(("pval (%d) gval (%d)\n", pval, gval)); - if (unlikely((err = wl_dev_intvar_set(dev, "wsec", pval|gval)))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - - sec = wl_read_prof(wl, WL_PROF_SEC); - sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0]; - sec->cipher_group = sme->crypto.cipher_group; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme) -{ - struct wl_priv *wl = ndev_to_wl(dev); - struct wl_security *sec; - int32 val = 0; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - - if (sme->crypto.n_akm_suites) { - if (unlikely((err = wl_dev_intvar_get(dev, "wpa_auth", &val)))) { - WL_ERR(("could not get wpa_auth (%d)\n", err)); - return err; - } - if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) { - switch (sme->crypto.akm_suites[0]) { - case WLAN_AKM_SUITE_8021X: - val = WPA_AUTH_UNSPECIFIED; - break; - case WLAN_AKM_SUITE_PSK: - val = WPA_AUTH_PSK; - break; - default : - WL_ERR(("invalid cipher group (%d)\n", - sme->crypto.cipher_group)); - return -EINVAL; - } - } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) { - switch (sme->crypto.akm_suites[0]) { - case WLAN_AKM_SUITE_8021X: - val = WPA2_AUTH_UNSPECIFIED; - break; - case WLAN_AKM_SUITE_PSK: - val = WPA2_AUTH_PSK; - break; - default : - WL_ERR(("invalid cipher group (%d)\n", - sme->crypto.cipher_group)); - return -EINVAL; - } - } - - WL_DBG(("setting wpa_auth to %d\n", val)); - if (unlikely((err = wl_dev_intvar_set(dev, "wpa_auth", val)))) { - WL_ERR(("could not set wpa_auth (%d)\n", err)); - return err; - } - } - sec = wl_read_prof(wl, WL_PROF_SEC); - sec->wpa_auth = sme->crypto.akm_suites[0]; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_set_set_sharedkey(struct net_device *dev, struct cfg80211_connect_params *sme) -{ - struct wl_priv *wl = ndev_to_wl(dev); - struct wl_security *sec; - struct wl_wsec_key key; - int32 val; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - WL_DBG(("key len (%d)\n", sme->key_len)); - if (sme->key_len) { - sec = wl_read_prof(wl, WL_PROF_SEC); - WL_DBG(("wpa_versions 0x%x cipher_pairwise 0x%x\n", sec->wpa_versions, - sec->cipher_pairwise)); - if (!(sec->wpa_versions & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2)) && - (sec->cipher_pairwise & (WLAN_CIPHER_SUITE_WEP40 | - WLAN_CIPHER_SUITE_WEP104))) { - memset(&key, 0, sizeof(key)); - key.len = (uint32)sme->key_len; - key.index = (uint32)sme->key_idx; - if (unlikely(key.len > sizeof(key.data))) { - WL_ERR(("Too long key length (%u)\n", key.len)); - return -EINVAL; - } - memcpy(key.data, sme->key, key.len); - key.flags = WL_PRIMARY_KEY; - switch (sec->cipher_pairwise) { - case WLAN_CIPHER_SUITE_WEP40: - key.algo = CRYPTO_ALGO_WEP1; - break; - case WLAN_CIPHER_SUITE_WEP104: - key.algo = CRYPTO_ALGO_WEP128; - break; - default : - WL_ERR(("Invalid algorithm (%d)\n", - sme->crypto.ciphers_pairwise[0])); - return -EINVAL; - } - /* Set the new key/index */ - WL_DBG(("key length (%d) key index (%d) algo (%d)\n", key.len, - key.index, key.algo)); - WL_DBG(("key \"%s\"\n", key.data)); - swap_key_from_BE(&key); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key))))) { - WL_ERR(("WLC_SET_KEY error (%d)\n", err)); - return err; - } - if (sec->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) { - WL_DBG(("set auth_type to shared key\n")); - val = 1; /* shared key */ - if (unlikely((err = wl_dev_intvar_set(dev, "auth", val)))) { - WL_ERR(("set auth failed (%d)\n", err)); - return err; - } - } - } - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_connect_params *sme) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - struct ieee80211_channel *chan = sme->channel; - struct wlc_ssid ssid; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In \n")); -#endif - CHECK_SYS_UP(); - if (unlikely(!sme->ssid)) { - WL_ERR(("Invalid ssid\n")); - return -EOPNOTSUPP; - } - if (chan) { - wl->channel = ieee80211_frequency_to_channel(chan->center_freq); - WL_DBG(("channel (%d), center_req (%d) \n", wl->channel, chan->center_freq)); - } - WL_DBG(("ie (%p), ie_len (%d)\n", sme->ie, sme->ie_len)); - if (unlikely((err = wl_set_wpa_version(dev, sme)))) { - return err; - } - if (unlikely((err = wl_set_auth_type(dev, sme)))) { - return err; - } - if (unlikely((err = wl_set_set_cipher(dev, sme)))) { - return err; - } - if (unlikely((err = wl_set_key_mgmt(dev, sme)))) { - return err; - } - if (unlikely((err = wl_set_set_sharedkey(dev, sme)))) { - return err; - } - wl_update_prof(wl, NULL, sme->bssid, WL_PROF_BSSID); - /* - ** Join with specific BSSID and cached SSID - ** If SSID is zero join based on BSSID only - */ - memset(&ssid, 0, sizeof(ssid)); - ssid.SSID_len = MIN(sizeof(ssid.SSID), sme->ssid_len); - memcpy(ssid.SSID, sme->ssid, ssid.SSID_len); - ssid.SSID_len = htod32(ssid.SSID_len); - wl_update_prof(wl, NULL, &ssid, WL_PROF_SSID); - if (ssid.SSID_len < IEEE80211_MAX_SSID_LEN) { - WL_DBG(("ssid \"%s\", len (%d)\n", ssid.SSID, ssid.SSID_len)); - } - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_SSID, &ssid, sizeof(ssid))))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - set_bit(WL_STATUS_CONNECTING, &wl->status); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, - uint16 reason_code) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - scb_val_t scbval; - bool act = FALSE; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - WL_DBG(("Reason %d\n", reason_code)); - CHECK_SYS_UP(); - if (likely((act = *(bool *)wl_read_prof(wl, WL_PROF_ACT)))) { - scbval.val = reason_code; - memcpy(&scbval.ea, &wl->bssid, ETHER_ADDR_LEN); - scbval.val = htod32(scbval.val); - if (unlikely((err = wl_dev_ioctl(dev, WLC_DISASSOC, &scbval, - sizeof(scb_val_t))))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type, int32 dbm) -{ - - struct wl_priv *wl = wiphy_to_wl(wiphy); - struct net_device *ndev = wl_to_ndev(wl); - uint16 txpwrmw; - int32 err = 0; - int32 disable = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - switch (type) { - case TX_POWER_AUTOMATIC: - break; - case TX_POWER_LIMITED: - if (dbm < 0) { - WL_ERR(("TX_POWER_LIMITTED - dbm is negative\n")); - return -EINVAL; - } - break; - case TX_POWER_FIXED: - if (dbm < 0) { - WL_ERR(("TX_POWER_FIXED - dbm is negative..\n")); - return -EINVAL; - } - break; - } - /* Make sure radio is off or on as far as software is concerned */ - disable = WL_RADIO_SW_DISABLE << 16; - disable = htod32(disable); - if (unlikely((err = wl_dev_ioctl(ndev, WLC_SET_RADIO, &disable, sizeof(disable))))) { - WL_ERR(("WLC_SET_RADIO error (%d)\n", err)); - return err; - } - - if (dbm > 0xffff) - txpwrmw = 0xffff; - else - txpwrmw = (uint16)dbm; - if (unlikely((err = wl_dev_intvar_set(ndev, "qtxpower", - (int32)(bcm_mw_to_qdbm(txpwrmw)))))) { - WL_ERR(("qtxpower error (%d)\n", err)); - return err; - } - wl->conf->tx_power = dbm; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_get_tx_power(struct wiphy *wiphy, int32 *dbm) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - struct net_device *ndev = wl_to_ndev(wl); - int32 txpwrdbm; - uint8 result; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - if (unlikely((err = wl_dev_intvar_get(ndev, "qtxpower", &txpwrdbm)))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - result = (uint8)(txpwrdbm & ~WL_TXPWR_OVERRIDE); - *dbm = (int32)bcm_qdbm_to_mw(result); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, uint8 key_idx) -{ - uint32 index; - int32 wsec; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - WL_DBG(("key index (%d)\n", key_idx)); - CHECK_SYS_UP(); - - if (unlikely(err = wl_dev_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec)))) { - WL_ERR(("WLC_GET_WSEC error (%d)\n", err)); - return err; - } - wsec = dtoh32(wsec); - if (wsec & WEP_ENABLED) { - /* Just select a new current key */ - index = (uint32)key_idx; - index = htod32(index); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_KEY_PRIMARY, - &index, sizeof(index))))) { - WL_ERR(("error (%d)\n", err)); - } - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr, struct key_params *params) -{ - struct wl_wsec_key key; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - memset(&key, 0, sizeof(key)); - key.index = (uint32)key_idx; - /* Instead of bcast for ea address for default wep keys, driver needs it to be Null */ - if (!ETHER_ISMULTI(mac_addr)) - memcpy((char *)&key.ea, (void *)mac_addr, ETHER_ADDR_LEN); - key.len = (uint32)params->key_len; - /* check for key index change */ - if (key.len == 0) { - /* key delete */ - swap_key_from_BE(&key); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key))))) { - WL_ERR(("key delete error (%d)\n", err)); - return err; - } - } else { - if (key.len > sizeof(key.data)) { - WL_ERR(("Invalid key length (%d)\n", key.len)); - return -EINVAL; - } - - WL_DBG(("Setting the key index %d\n", key.index)); - memcpy(key.data, params->key, key.len); - - if (params->cipher == WLAN_CIPHER_SUITE_TKIP) { - uint8 keybuf[8]; - memcpy(keybuf, &key.data[24], sizeof(keybuf)); - memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); - memcpy(&key.data[16], keybuf, sizeof(keybuf)); - } - - /* if IW_ENCODE_EXT_RX_SEQ_VALID set */ - if (params->seq && params->seq_len == 6) { - /* rx iv */ - uint8 *ivptr; - ivptr = (uint8 *)params->seq; - key.rxiv.hi = (ivptr[5] << 24) | (ivptr[4] << 16) | - (ivptr[3] << 8) | ivptr[2]; - key.rxiv.lo = (ivptr[1] << 8) | ivptr[0]; - key.iv_initialized = TRUE; - } - - switch (params->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - key.algo = CRYPTO_ALGO_WEP1; - WL_DBG(("WLAN_CIPHER_SUITE_WEP40\n")); - break; - case WLAN_CIPHER_SUITE_WEP104: - key.algo = CRYPTO_ALGO_WEP128; - WL_DBG(("WLAN_CIPHER_SUITE_WEP104\n")); - break; - case WLAN_CIPHER_SUITE_TKIP: - key.algo = CRYPTO_ALGO_TKIP; - WL_DBG(("WLAN_CIPHER_SUITE_TKIP\n")); - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - key.algo = CRYPTO_ALGO_AES_CCM; - WL_DBG(("WLAN_CIPHER_SUITE_AES_CMAC\n")); - break; - case WLAN_CIPHER_SUITE_CCMP: - key.algo = CRYPTO_ALGO_AES_CCM; - WL_DBG(("WLAN_CIPHER_SUITE_CCMP\n")); - break; - default: - WL_ERR(("Invalid cipher (0x%x)\n", params->cipher)); - return -EINVAL; - } - swap_key_from_BE(&key); - - dhd_wait_pend8021x(dev); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key))))) { - WL_ERR(("WLC_SET_KEY error (%d)\n", err)); - return err; - } - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr, struct key_params *params) -{ - struct wl_wsec_key key; - int32 val; - int32 wsec; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - WL_DBG(("key index (%d)\n", key_idx)); - CHECK_SYS_UP(); - - if (mac_addr) - return wl_add_keyext(wiphy, dev, key_idx, mac_addr, params); - memset(&key, 0, sizeof(key)); - - key.len = (uint32)params->key_len; - key.index = (uint32)key_idx; - - if (unlikely(key.len > sizeof(key.data))) { - WL_ERR(("Too long key length (%u)\n", key.len)); - return -EINVAL; - } - memcpy(key.data, params->key, key.len); - - key.flags = WL_PRIMARY_KEY; - switch (params->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - key.algo = CRYPTO_ALGO_WEP1; - WL_DBG(("WLAN_CIPHER_SUITE_WEP40\n")); - break; - case WLAN_CIPHER_SUITE_WEP104: - key.algo = CRYPTO_ALGO_WEP128; - WL_DBG(("WLAN_CIPHER_SUITE_WEP104\n")); - break; - case WLAN_CIPHER_SUITE_TKIP: - key.algo = CRYPTO_ALGO_TKIP; - WL_DBG(("WLAN_CIPHER_SUITE_TKIP\n")); - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - key.algo = CRYPTO_ALGO_AES_CCM; - WL_DBG(("WLAN_CIPHER_SUITE_AES_CMAC\n")); - break; - case WLAN_CIPHER_SUITE_CCMP: - key.algo = CRYPTO_ALGO_AES_CCM; - WL_DBG(("WLAN_CIPHER_SUITE_CCMP\n")); - break; - default: - WL_ERR(("Invalid cipher (0x%x)\n", params->cipher)); - return -EINVAL; - } - - /* Set the new key/index */ - swap_key_from_BE(&key); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key))))) { - WL_ERR(("WLC_SET_KEY error (%d)\n", err)); - return err; - } - - val = WEP_ENABLED; - if (unlikely((err = wl_dev_intvar_get(dev, "wsec", &wsec)))) { - WL_ERR(("get wsec error (%d)\n", err)); - return err; - } - wsec &= ~(WEP_ENABLED); - wsec |= val; - if (unlikely((err = wl_dev_intvar_set(dev, "wsec", wsec)))) { - WL_ERR(("set wsec error (%d)\n", err)); - return err; - } - - val = 1; /* assume shared key. otherwise 0 */ - val = htod32(val); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val))))) { - WL_ERR(("WLC_SET_AUTH error (%d)\n", err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr) -{ - struct wl_wsec_key key; - int32 err = 0; - int32 val; - int32 wsec; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - memset(&key, 0, sizeof(key)); - - key.index = (uint32)key_idx; - key.flags = WL_PRIMARY_KEY; - key.algo = CRYPTO_ALGO_OFF; - - WL_DBG(("key index (%d)\n", key_idx)); - /* Set the new key/index */ - swap_key_from_BE(&key); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key))))) { - if (err == -EINVAL) { - if (key.index >= DOT11_MAX_DEFAULT_KEYS) { - /* we ignore this key index in this case */ - WL_DBG(("invalid key index (%d)\n", key_idx)); - } - } else { - WL_ERR(("WLC_SET_KEY error (%d)\n", err)); - } - return err; - } - - val = 0; - if (unlikely((err = wl_dev_intvar_get(dev, "wsec", &wsec)))) { - WL_ERR(("get wsec error (%d)\n", err)); - return err; - } - wsec &= ~(WEP_ENABLED); - wsec |= val; - if (unlikely((err = wl_dev_intvar_set(dev, "wsec", wsec)))) { - WL_ERR(("set wsec error (%d)\n", err)); - return err; - } - - val = 0; /* assume open key. otherwise 1 */ - val = htod32(val); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val))))) { - WL_ERR(("WLC_SET_AUTH error (%d)\n", err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr, void *cookie, - void (*callback)(void *cookie, struct key_params *params)) -{ - struct key_params params; - struct wl_wsec_key key; - struct wl_priv *wl = wiphy_to_wl(wiphy); - struct wl_security *sec; - int32 wsec; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - WL_DBG(("key index (%d)\n", key_idx)); - CHECK_SYS_UP(); - - memset(&key, 0, sizeof(key)); - key.index = key_idx; - swap_key_to_BE(&key); - memset(¶ms, 0, sizeof(params)); - params.key_len = (uint8)MIN(DOT11_MAX_KEY_SIZE, key.len); - memcpy(params.key, key.data, params.key_len); - - if (unlikely(err = wl_dev_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec)))) { - WL_ERR(("WLC_GET_WSEC error (%d)\n", err)); - return err; - } - wsec = dtoh32(wsec); - switch (wsec) { - case WEP_ENABLED: - sec = wl_read_prof(wl, WL_PROF_SEC); - if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { - params.cipher = WLAN_CIPHER_SUITE_WEP40; - WL_DBG(("WLAN_CIPHER_SUITE_WEP40\n")); - } else if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP104) { - params.cipher = WLAN_CIPHER_SUITE_WEP104; - WL_DBG(("WLAN_CIPHER_SUITE_WEP104\n")); - } - break; - case TKIP_ENABLED: - params.cipher = WLAN_CIPHER_SUITE_TKIP; - WL_DBG(("WLAN_CIPHER_SUITE_TKIP\n")); - break; - case AES_ENABLED: - params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; - WL_DBG(("WLAN_CIPHER_SUITE_AES_CMAC\n")); - break; - default: - WL_ERR(("Invalid algo (0x%x)\n", wsec)); - return -EINVAL; - } - - callback(cookie, ¶ms); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, - struct net_device *dev, uint8 key_idx) -{ - WL_INFO(("Not supported\n")); - CHECK_SYS_UP(); - return -EOPNOTSUPP; -} - -static int32 -wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, - uint8 *mac, struct station_info *sinfo) - -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - scb_val_t scb_val; - int rssi; - int32 rate; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - if (unlikely(memcmp(mac, wl_read_prof(wl, WL_PROF_BSSID), ETHER_ADDR_LEN))) { - WL_ERR(("Wrong Mac address\n")); - return -ENOENT; - } - - /* Report the current tx rate */ - if ((err = wl_dev_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate)))) { - WL_ERR(("Could not get rate (%d)\n", err)); - } else { - rate = dtoh32(rate); - sinfo->filled |= STATION_INFO_TX_BITRATE; - sinfo->txrate.legacy = rate * 5; - WL_DBG(("Rate %d Mbps\n", (rate/2))); - } - - if (test_bit(WL_STATUS_CONNECTED, &wl->status)) { - scb_val.val = 0; - if (unlikely(err = wl_dev_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t)))) { - WL_ERR(("Could not get rssi (%d)\n", err)); - return err; - } - rssi = dtoh32(scb_val.val); - sinfo->filled |= STATION_INFO_SIGNAL; - sinfo->signal = rssi; - WL_DBG(("RSSI %d dBm\n", rssi)); - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, - bool enabled, int32 timeout) -{ - int32 pm; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - pm = enabled ? PM_FAST : PM_OFF; - pm = htod32(pm); - WL_DBG(("power save %s\n", (pm ? "enabled" : "disabled"))); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm))))) { - if (err == -ENODEV) { - WL_DBG(("net_device is not ready yet\n")); - } else { - WL_ERR(("error (%d)\n", err)); - } - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static __used uint32 -wl_find_msb(uint16 bit16) -{ - uint32 ret = 0; - - if (bit16 & 0xff00) { - ret += 8; - bit16 >>= 8; - } - - if (bit16 & 0xf0) { - ret += 4; - bit16 >>= 4; - } - - if (bit16 & 0xc) { - ret += 2; - bit16 >>= 2; - } - - if (bit16 & 2) - ret += bit16 & 2; - else if (bit16) - ret += bit16; - - return ret; -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) -static int32 -wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, - const uint8 *addr, const struct cfg80211_bitrate_mask *mask) -{ - struct wl_rateset rateset; - int32 rate; - int32 val; - int32 err_bg; - int32 err_a; - uint32 legacy; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - /* addr param is always NULL. ignore it */ - /* Get current rateset */ - if (unlikely((err = wl_dev_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, - sizeof(rateset))))) { - WL_ERR(("could not get current rateset (%d)\n", err)); - return err; - } - - rateset.count = dtoh32(rateset.count); - - if (!(legacy = wl_find_msb(mask->control[IEEE80211_BAND_2GHZ].legacy))) - legacy = wl_find_msb(mask->control[IEEE80211_BAND_5GHZ].legacy); - - val = wl_g_rates[legacy-1].bitrate * 100000; - - if (val < rateset.count) { - /* Select rate by rateset index */ - rate = rateset.rates[val] & 0x7f; - } else { - /* Specified rate in bps */ - rate = val / 500000; - } - - WL_DBG(("rate %d mbps\n", (rate/2))); - - /* - * - * Set rate override, - * Since the is a/b/g-blind, both a/bg_rate are enforced. - */ - err_bg = wl_dev_intvar_set(dev, "bg_rate", rate); - err_a = wl_dev_intvar_set(dev, "a_rate", rate); - if (unlikely(err_bg && err_a)) { - WL_ERR(("could not set fixed rate (%d) (%d)\n", err_bg, err_a)); - return (err_bg | err_a); - } - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} -#else -static int32 -wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, - const uint8 *addr, const struct cfg80211_bitrate_mask *mask) -{ - struct wl_rateset rateset; - int32 rate; - int32 val; - int32 err_bg; - int32 err_a; - int32 err = 0; - int i; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - /* addr param is always NULL. ignore it */ - /* Get current rateset */ - if (unlikely((err = wl_dev_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, - sizeof(rateset))))) { - WL_ERR(("could not get current rateset (%d)\n", err)); - return err; - } - - rateset.count = dtoh32(rateset.count); - - if (mask->fixed || mask->maxrate) { - val = mask->fixed ? (mask->fixed * 1000) : (mask->maxrate * 1000); - if (val < rateset.count) { - /* Select rate by rateset index */ - rate = rateset.rates[val] & 0x7f; - } else { - /* Specified rate in bps */ - rate = val / 500000; - } - } else { - /* Select maximum rate */ - rate = rateset.rates[rateset.count - 1] & 0x7f; - } - - if (mask->fixed) { - /* - Set rate override, - Since the is a/b/g-blind, both a/bg_rate are enforced. - */ - err_bg = wl_dev_intvar_set(dev, "bg_rate", rate); - err_a = wl_dev_intvar_set(dev, "a_rate", rate); - if (unlikely(err_bg && err_a)) { - WL_ERR(("could not set fixed rate (%d) (%d)\n", err_bg, err_a)); - return (err_bg | err_a); - } - } else { - /* - clear rate override - Since the is a/b/g-blind, both a/bg_rate are enforced. - */ - /* 0 is for clearing rate override */ - err_bg = wl_dev_intvar_set(dev, "bg_rate", 0); - /* 0 is for clearing rate override */ - err_a = wl_dev_intvar_set(dev, "a_rate", 0); - - if (unlikely(err_bg && err_a)) { - WL_ERR(("could not set max rate (%d) (%d)\n", err_bg, err_a)); - return (err_bg | err_a); - } - - /* Remove rates above selected rate */ - for (i = 0; i < rateset.count; i++) - if ((rateset.rates[i] & 0x7f) > rate) - break; - rateset.count = htod32(i); - - /* Set current rateset */ - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_RATESET, &rateset, - sizeof(rateset))))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) */ - -static int32 -wl_cfg80211_resume(struct wiphy *wiphy) -{ - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - wl_invoke_iscan(wiphy_to_wl(wiphy)); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_suspend(struct wiphy *wiphy) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - - set_bit(WL_STATUS_SCAN_ABORTING, &wl->status); - wl_term_iscan(wl); - if (wl->scan_request) { - cfg80211_scan_done(wl->scan_request, TRUE); /* TRUE means abort */ - wl->scan_request = NULL; - } - clear_bit(WL_STATUS_SCANNING, &wl->status); - clear_bit(WL_STATUS_SCAN_ABORTING, &wl->status); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static __used int32 -wl_update_pmklist(struct net_device *dev, struct wl_pmk_list *pmk_list, int32 err) -{ - int8 eabuf[ETHER_ADDR_STR_LEN]; - int i, j; - - memset(eabuf, 0, ETHER_ADDR_STR_LEN); - - WL_DBG(("No of elements %d\n", pmk_list->pmkids.npmkid)); - for (i = 0; i < pmk_list->pmkids.npmkid; i++) { - WL_DBG(("PMKID[%d]: %s =\n", i, - bcm_ether_ntoa(&pmk_list->pmkids.pmkid[i].BSSID, - eabuf))); - for (j = 0; j < WPA2_PMKID_LEN; j++) { - WL_DBG(("%02x\n", pmk_list->pmkids.pmkid[i].PMKID[j])); - } - } - if (likely(!err)) { - err = wl_dev_bufvar_set(dev, "pmkid_info", (char *)pmk_list, - sizeof(*pmk_list)); - } - - return err; -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) -static int32 -wl_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_pmksa *pmksa) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - int8 eabuf[ETHER_ADDR_STR_LEN]; - int32 err = 0; - int i; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - - CHECK_SYS_UP(); - memset(eabuf, 0, ETHER_ADDR_STR_LEN); - for (i = 0; i < wl->pmk_list->pmkids.npmkid; i++) - if (!memcmp(pmksa->bssid, &wl->pmk_list->pmkids.pmkid[i].BSSID, - ETHER_ADDR_LEN)) - break; - if (i < WL_NUM_PMKIDS_MAX) { - memcpy(&wl->pmk_list->pmkids.pmkid[i].BSSID, pmksa->bssid, ETHER_ADDR_LEN); - memcpy(&wl->pmk_list->pmkids.pmkid[i].PMKID, pmksa->pmkid, WPA2_PMKID_LEN); - if (i == wl->pmk_list->pmkids.npmkid) - wl->pmk_list->pmkids.npmkid++; - } else { - err = -EINVAL; - } - WL_DBG(("set_pmksa,IW_PMKSA_ADD - PMKID: %s =\n", - bcm_ether_ntoa(&wl->pmk_list->pmkids.pmkid[wl->pmk_list->pmkids.npmkid].BSSID, - eabuf))); - for (i = 0; i < WPA2_PMKID_LEN; i++) { - WL_DBG(("%02x\n", - wl->pmk_list->pmkids.pmkid[wl->pmk_list->pmkids.npmkid].PMKID[i])); - } - - err = wl_update_pmklist(dev, wl->pmk_list, err); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_pmksa *pmksa) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - int8 eabuf[ETHER_ADDR_STR_LEN]; - struct _pmkid_list pmkid; - int32 err = 0; - int i; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - - CHECK_SYS_UP(); - memset(eabuf, 0, ETHER_ADDR_STR_LEN); - memcpy(&pmkid.pmkid[0].BSSID, pmksa->bssid, ETHER_ADDR_LEN); - memcpy(&pmkid.pmkid[0].PMKID, pmksa->pmkid, WPA2_PMKID_LEN); - - WL_DBG(("del_pmksa,IW_PMKSA_REMOVE - PMKID: %s =\n", - bcm_ether_ntoa(&pmkid.pmkid[0].BSSID, eabuf))); - for (i = 0; i < WPA2_PMKID_LEN; i++) { - WL_DBG(("%02x\n", pmkid.pmkid[0].PMKID[i])); - } - - for (i = 0; i < wl->pmk_list->pmkids.npmkid; i++) - if (!memcmp(pmksa->bssid, &wl->pmk_list->pmkids.pmkid[i].BSSID, ETHER_ADDR_LEN)) - break; - - if ((wl->pmk_list->pmkids.npmkid > 0) && (i < wl->pmk_list->pmkids.npmkid)) { - memset(&wl->pmk_list->pmkids.pmkid[i], 0, sizeof(pmkid_t)); - for (; i < (wl->pmk_list->pmkids.npmkid - 1); i++) { - memcpy(&wl->pmk_list->pmkids.pmkid[i].BSSID, - &wl->pmk_list->pmkids.pmkid[i+1].BSSID, ETHER_ADDR_LEN); - memcpy(&wl->pmk_list->pmkids.pmkid[i].PMKID, - &wl->pmk_list->pmkids.pmkid[i+1].PMKID, WPA2_PMKID_LEN); - } - wl->pmk_list->pmkids.npmkid--; - } - else { - err = -EINVAL; - } - - err = wl_update_pmklist(dev, wl->pmk_list, err); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; - -} - -static int32 -wl_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - memset(wl->pmk_list, 0, sizeof(*wl->pmk_list)); - err = wl_update_pmklist(dev, wl->pmk_list, err); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; - -} -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) */ - -static struct cfg80211_ops wl_cfg80211_ops = { - .change_virtual_intf = wl_cfg80211_change_iface, - .scan = wl_cfg80211_scan, - .set_wiphy_params = wl_cfg80211_set_wiphy_params, - .join_ibss = wl_cfg80211_join_ibss, - .leave_ibss = wl_cfg80211_leave_ibss, - .get_station = wl_cfg80211_get_station, - .set_tx_power = wl_cfg80211_set_tx_power, - .get_tx_power = wl_cfg80211_get_tx_power, - .add_key = wl_cfg80211_add_key, - .del_key = wl_cfg80211_del_key, - .get_key = wl_cfg80211_get_key, - .set_default_key = wl_cfg80211_config_default_key, - .set_default_mgmt_key = wl_cfg80211_config_default_mgmt_key, - .set_power_mgmt = wl_cfg80211_set_power_mgmt, - .set_bitrate_mask = wl_cfg80211_set_bitrate_mask, - .connect = wl_cfg80211_connect, - .disconnect = wl_cfg80211_disconnect, - .suspend = wl_cfg80211_suspend, - .resume = wl_cfg80211_resume, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) - .set_pmksa = wl_cfg80211_set_pmksa, - .del_pmksa = wl_cfg80211_del_pmksa, - .flush_pmksa = wl_cfg80211_flush_pmksa -#endif -}; - -static int32 -wl_mode_to_nl80211_iftype(int32 mode) -{ - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - switch (mode) { - case WL_MODE_BSS: - return NL80211_IFTYPE_STATION; - case WL_MODE_IBSS: - return NL80211_IFTYPE_ADHOC; - default: - return NL80211_IFTYPE_UNSPECIFIED; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static struct wireless_dev * -wl_alloc_wdev(int32 sizeof_iface, struct device *dev) -{ - struct wireless_dev *wdev; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wdev = kzalloc(sizeof(*wdev), GFP_KERNEL); - if (unlikely(!wdev)) { - WL_ERR(("Could not allocate wireless device\n")); - return ERR_PTR(-ENOMEM); - } - wdev->wiphy = wiphy_new(&wl_cfg80211_ops, sizeof(struct wl_priv) + sizeof_iface); - if (unlikely(!wdev->wiphy)) { - WL_ERR(("Couldn not allocate wiphy device\n")); - err = -ENOMEM; - goto wiphy_new_out; - } - set_wiphy_dev(wdev->wiphy, dev); - wdev->wiphy->max_scan_ssids = WL_NUM_SCAN_MAX; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) - wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX; -#endif - wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION)| BIT(NL80211_IFTYPE_ADHOC); - wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; - wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_a; /* Set it as 11a by default. - ** This will be updated with - ** 11n phy tables in "ifconfig up" - ** if phy has 11n capability - */ - wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - wdev->wiphy->cipher_suites = __wl_cipher_suites; - wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites); -#ifndef WL_POWERSAVE_DISABLED -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) - wdev->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; /* enable power - * save mode by default - */ -#else - wdev->wiphy->ps_default = TRUE; /* enable power save mode by default */ -#endif -#else -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) - wdev->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; -#else - wdev->wiphy->ps_default = FALSE; -#endif -#endif /* !WL_POWERSAVE_DISABLED */ - if (unlikely(((err = wiphy_register(wdev->wiphy)) < 0))) { - WL_ERR(("Couldn not register wiphy device (%d)\n", err)); - goto wiphy_register_out; - } - return wdev; - -wiphy_register_out: - wiphy_free(wdev->wiphy); - -wiphy_new_out: - kfree(wdev); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return ERR_PTR(err); -} - -static void -wl_free_wdev(struct wl_priv *wl) -{ - struct wireless_dev *wdev = wl_to_wdev(wl); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely(!wdev)) { - WL_ERR(("wdev is invalid\n")); - return; - } - wiphy_unregister(wdev->wiphy); - wiphy_free(wdev->wiphy); - kfree(wdev); - wl_to_wdev(wl) = NULL; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif -} - -static int32 -wl_inform_bss(struct wl_priv *wl) -{ - struct wl_scan_results *bss_list; - struct wl_bss_info *bi = NULL; /* must be initialized */ - int32 err = 0; - int i; - - - bss_list = wl->bss_list; - if (unlikely(bss_list->version != WL_BSS_INFO_VERSION)) { - WL_ERR(("Version %d != WL_BSS_INFO_VERSION\n", bss_list->version)); - return -EOPNOTSUPP; - } - WL_DBG(("scanned AP count (%d)\n", bss_list->count)); - bi = next_bss(bss_list, bi); - for_each_bss(bss_list, bi, i) { - if (unlikely(err = wl_inform_single_bss(wl, bi))) - break; - } - return err; -} - -static int32 -wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi) -{ - struct wiphy *wiphy = wl_to_wiphy(wl); - struct ieee80211_mgmt *mgmt; - struct ieee80211_channel *channel; - struct ieee80211_supported_band *band; - struct wl_cfg80211_bss_info *notif_bss_info; - struct wl_scan_req *sr = wl_to_sr(wl); - uint32 signal; - uint32 freq; - int32 err = 0; - - if (unlikely(dtoh32(bi->length) > WL_BSS_INFO_MAX)) { - WL_DBG(("Beacon size is larger than allocated buffer. Discard it!!\n")); - return err; - } - notif_bss_info = kzalloc(sizeof(*notif_bss_info) + sizeof(*mgmt) - sizeof(uint8) + - WL_BSS_INFO_MAX, GFP_KERNEL); - if (unlikely(!notif_bss_info)) { - WL_ERR(("notif_bss_info alloc failed\n")); - return -ENOMEM; - } - mgmt = (struct ieee80211_mgmt *)notif_bss_info->frame_buf; - notif_bss_info->channel = CHSPEC_CHANNEL(bi->chanspec); - if (notif_bss_info->channel <= CH_MAX_2G_CHANNEL) - band = wiphy->bands[IEEE80211_BAND_2GHZ]; - else - band = wiphy->bands[IEEE80211_BAND_5GHZ]; - notif_bss_info->rssi = bi->RSSI; - memcpy(mgmt->bssid, &bi->BSSID, ETHER_ADDR_LEN); - if (!memcmp(bi->SSID, sr->ssid.SSID, bi->SSID_len)) { - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_PROBE_RESP); - } - mgmt->u.probe_resp.timestamp = 0; - mgmt->u.probe_resp.beacon_int = cpu_to_le16(bi->beacon_period); - mgmt->u.probe_resp.capab_info = cpu_to_le16(bi->capability); - wl_rst_ie(wl); - wl_add_ie(wl, WLAN_EID_SSID, bi->SSID_len, bi->SSID); - wl_add_ie(wl, WLAN_EID_SUPP_RATES, bi->rateset.count, bi->rateset.rates); - wl_mrg_ie(wl, ((uint8 *)bi) + bi->ie_offset, bi->ie_length); - wl_cp_ie(wl, mgmt->u.probe_resp.variable, WL_BSS_INFO_MAX - - offsetof(struct wl_cfg80211_bss_info, frame_buf)); - notif_bss_info->frame_len = offsetof(struct ieee80211_mgmt, u.probe_resp.variable) + - wl_get_ielen(wl); - freq = ieee80211_channel_to_frequency(notif_bss_info->channel); - channel = ieee80211_get_channel(wiphy, freq); - - WL_DBG(("SSID : \"%s\", rssi (%d), capability : 0x04%x\n", bi->SSID, notif_bss_info->rssi, - mgmt->u.probe_resp.capab_info)); - - signal = notif_bss_info->rssi * 100; - if (unlikely(!cfg80211_inform_bss_frame(wiphy, channel, mgmt, - le16_to_cpu(notif_bss_info->frame_len), signal, GFP_KERNEL))) { - WL_ERR(("cfg80211_inform_bss_frame error\n")); - kfree(notif_bss_info); - return -EINVAL; - } - kfree(notif_bss_info); - - return err; -} - -static bool -wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e) -{ - uint32 event = ntoh32(e->event_type); - uint16 flags = ntoh16(e->flags); - - if (event == WLC_E_JOIN || event == WLC_E_ASSOC_IND || event == WLC_E_REASSOC_IND) { - return TRUE; - } else if (event == WLC_E_LINK) { - if (flags & WLC_EVENT_MSG_LINK) { - if (wl_is_ibssmode(wl)) { - if (wl_is_ibssstarter(wl)) { - } - } else { - - } - } - } - - return FALSE; -} - -static bool -wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e) -{ - uint32 event = ntoh32(e->event_type); - uint16 flags = ntoh16(e->flags); - - if (event == WLC_E_DEAUTH_IND || event == WLC_E_DISASSOC_IND) { - return TRUE; - } else if (event == WLC_E_LINK) { - if (!(flags & WLC_EVENT_MSG_LINK)) { - return TRUE; - } - } - - return FALSE; -} - -static int32 -wl_notify_connect_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data) -{ - bool act; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (wl_is_linkup(wl, e)) { - wl_link_up(wl); - if (wl_is_ibssmode(wl)) { - cfg80211_ibss_joined(ndev, (int8 *)&e->addr, GFP_KERNEL); - WL_DBG(("joined in IBSS network\n")); - } else { - wl_bss_connect_done(wl, ndev, e, data); - WL_DBG(("joined in BSS network \"%s\"\n", - ((struct wlc_ssid *)wl_read_prof(wl, WL_PROF_SSID))->SSID)); - } - act = TRUE; - wl_update_prof(wl, e, &act, WL_PROF_ACT); - } else if (wl_is_linkdown(wl, e)) { - cfg80211_disconnected(ndev, 0, NULL, 0, GFP_KERNEL); - clear_bit(WL_STATUS_CONNECTED, &wl->status); - wl_link_down(wl); - wl_init_prof(wl->profile); - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_notify_roaming_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data) -{ - bool act; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl_bss_roaming_done(wl, ndev, e, data); - act = TRUE; - wl_update_prof(wl, e, &act, WL_PROF_ACT); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static __used int32 -wl_dev_bufvar_set(struct net_device *dev, int8 *name, int8 *buf, int32 len) -{ - struct wl_priv *wl = ndev_to_wl(dev); - uint32 buflen; - - buflen = bcm_mkiovar(name, buf, len, wl->ioctl_buf, WL_IOCTL_LEN_MAX); - BUG_ON(unlikely(!buflen)); - - return (wl_dev_ioctl(dev, WLC_SET_VAR, wl->ioctl_buf, buflen)); -} - -static int32 -wl_dev_bufvar_get(struct net_device *dev, int8 *name, int8 *buf, int32 buf_len) -{ - struct wl_priv *wl = ndev_to_wl(dev); - uint32 len; - int32 err = 0; - - len = bcm_mkiovar(name, NULL, 0, wl->ioctl_buf, WL_IOCTL_LEN_MAX); - BUG_ON(unlikely(!len)); - if (unlikely((err = wl_dev_ioctl(dev, WLC_GET_VAR, (void *)wl->ioctl_buf, - WL_IOCTL_LEN_MAX)))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - memcpy(buf, wl->ioctl_buf, buf_len); - - return err; -} - -static int32 -wl_get_assoc_ies(struct wl_priv *wl) -{ - struct net_device *ndev = wl_to_ndev(wl); - struct wl_assoc_ielen *assoc_info; - struct wl_connect_info *conn_info = wl_to_conn(wl); - uint32 req_len; - uint32 resp_len; - int32 err = 0; - - if (unlikely(err = wl_dev_bufvar_get(ndev, "assoc_info", wl->extra_buf, - WL_ASSOC_INFO_MAX))) { - WL_ERR(("could not get assoc info (%d)\n", err)); - return err; - } - assoc_info = (struct wl_assoc_ielen *)wl->extra_buf; - req_len = assoc_info->req_len; - resp_len = assoc_info->resp_len; - if (req_len) { - if (unlikely(err = wl_dev_bufvar_get(ndev, "assoc_req_ies", wl->extra_buf, - WL_ASSOC_INFO_MAX))) { - WL_ERR(("could not get assoc req (%d)\n", err)); - return err; - } - conn_info->req_ie_len = req_len; - conn_info->req_ie = kmemdup(wl->extra_buf, conn_info->req_ie_len, GFP_KERNEL); - } else { - conn_info->req_ie_len = 0; - conn_info->req_ie = NULL; - } - if (resp_len) { - if (unlikely(err = wl_dev_bufvar_get(ndev, "assoc_resp_ies", wl->extra_buf, - WL_ASSOC_INFO_MAX))) { - WL_ERR(("could not get assoc resp (%d)\n", err)); - return err; - } - conn_info->resp_ie_len = resp_len; - conn_info->resp_ie = kmemdup(wl->extra_buf, conn_info->resp_ie_len, GFP_KERNEL); - } else { - conn_info->resp_ie_len = 0; - conn_info->resp_ie = NULL; - } - WL_DBG(("req len (%d) resp len (%d)\n", conn_info->req_ie_len, conn_info->resp_ie_len)); - - return err; -} - -static int32 -wl_update_bss_info(struct wl_priv *wl) -{ - struct cfg80211_bss *bss; - struct wl_bss_info *bi; - struct wlc_ssid *ssid; - int32 err = 0; - - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (wl_is_ibssmode(wl)) - return err; - - ssid = (struct wlc_ssid *)wl_read_prof(wl, WL_PROF_SSID); - bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (int8 *)&wl->bssid, ssid->SSID, - ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); - - rtnl_lock(); - if (unlikely(!bss)) { - WL_DBG(("Could not find the AP\n")); - *(uint32*)wl->extra_buf = htod32(WL_EXTRA_BUF_MAX); - if (unlikely(err = wl_dev_ioctl(wl_to_ndev(wl), WLC_GET_BSS_INFO, wl->extra_buf, - WL_EXTRA_BUF_MAX))) { - WL_ERR(("Could not get bss info %d\n", err)); - goto update_bss_info_out; - } - bi = (struct wl_bss_info *)(wl->extra_buf + 4); - if (unlikely(memcmp(&bi->BSSID, &wl->bssid, ETHER_ADDR_LEN))) { - err = -EIO; - goto update_bss_info_out; - } - if (unlikely((err = wl_inform_single_bss(wl, bi)))) - goto update_bss_info_out; - } else { - WL_DBG(("Found the AP in the list - BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", - bss->bssid[0], bss->bssid[1], bss->bssid[2], bss->bssid[3], - bss->bssid[4], bss->bssid[5])); - cfg80211_put_bss(bss); - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - -update_bss_info_out: - rtnl_unlock(); - return err; -} - -static int32 -wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data) -{ - struct wl_connect_info *conn_info = wl_to_conn(wl); - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl_get_assoc_ies(wl); - memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN); - wl_update_bss_info(wl); - cfg80211_roamed(ndev, - (uint8 *)&wl->bssid, - conn_info->req_ie, conn_info->req_ie_len, - conn_info->resp_ie, conn_info->resp_ie_len, - GFP_KERNEL); - WL_DBG(("Report roaming result\n")); - - set_bit(WL_STATUS_CONNECTED, &wl->status); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data) -{ - struct wl_connect_info *conn_info = wl_to_conn(wl); - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl_get_assoc_ies(wl); - memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN); - wl_update_bss_info(wl); - if (test_and_clear_bit(WL_STATUS_CONNECTING, &wl->status)) { - cfg80211_connect_result(ndev, - (uint8 *)&wl->bssid, - conn_info->req_ie, conn_info->req_ie_len, - conn_info->resp_ie, conn_info->resp_ie_len, - WLAN_STATUS_SUCCESS, - GFP_KERNEL); - WL_DBG(("Report connect result\n")); - } else { - cfg80211_roamed(ndev, - (uint8 *)&wl->bssid, - conn_info->req_ie, conn_info->req_ie_len, - conn_info->resp_ie, conn_info->resp_ie_len, - GFP_KERNEL); - WL_DBG(("Report roaming result\n")); - } - set_bit(WL_STATUS_CONNECTED, &wl->status); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_notify_mic_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data) -{ - uint16 flags = ntoh16(e->flags); - enum nl80211_key_type key_type; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - - rtnl_lock(); - if (flags & WLC_EVENT_MSG_GROUP) - key_type = NL80211_KEYTYPE_GROUP; - else - key_type = NL80211_KEYTYPE_PAIRWISE; - - cfg80211_michael_mic_failure(ndev, (uint8 *)&e->addr, key_type, -1, NULL, GFP_KERNEL); - rtnl_unlock(); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return 0; -} - -static int32 -wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data) -{ - struct channel_info channel_inform; - struct wl_scan_results *bss_list; - uint32 len = WL_SCAN_BUF_MAX; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - - if (wl->iscan_on && wl->iscan_kickstart) - return wl_wakeup_iscan(wl_to_iscan(wl)); - - if (unlikely(!test_and_clear_bit(WL_STATUS_SCANNING, &wl->status))) { - WL_ERR(("Scan complete while device not scanning\n")); - return -EINVAL; - } - if (unlikely(!wl->scan_request)) { - } - rtnl_lock(); - if (unlikely((err = wl_dev_ioctl(ndev, WLC_GET_CHANNEL, &channel_inform, - sizeof(channel_inform))))) { - WL_ERR(("scan busy (%d)\n", err)); - goto scan_done_out; - } - channel_inform.scan_channel = dtoh32(channel_inform.scan_channel); - if (unlikely(channel_inform.scan_channel)) { - - WL_DBG(("channel_inform.scan_channel (%d)\n", channel_inform.scan_channel)); - } - wl->bss_list = wl->scan_results; - bss_list = wl->bss_list; - memset(bss_list, 0, len); - bss_list->buflen = htod32(len); - if (unlikely((err = wl_dev_ioctl(ndev, WLC_SCAN_RESULTS, bss_list, len)))) { - WL_ERR(("%s Scan_results error (%d)\n", ndev->name, err)); - err = -EINVAL; - goto scan_done_out; - } - bss_list->buflen = dtoh32(bss_list->buflen); - bss_list->version = dtoh32(bss_list->version); - bss_list->count = dtoh32(bss_list->count); - - if ((err = wl_inform_bss(wl))) { - goto scan_done_out; - } - -scan_done_out : - if (wl->scan_request) { - cfg80211_scan_done(wl->scan_request, FALSE); - wl->scan_request = NULL; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - rtnl_unlock(); - return err; -} - -static void -wl_init_conf(struct wl_conf *conf) -{ - conf->mode = (uint32)-1; - conf->frag_threshold = (uint32)-1; - conf->rts_threshold = (uint32)-1; - conf->retry_short = (uint32)-1; - conf->retry_long = (uint32)-1; - conf->tx_power = -1; -} - -static void -wl_init_prof(struct wl_profile *prof) -{ - memset(prof, 0, sizeof(*prof)); -} - -static void -wl_init_eloop_handler(struct wl_event_loop *el) -{ - memset(el, 0, sizeof(*el)); - el->handler[WLC_E_SCAN_COMPLETE] = wl_notify_scan_status; - el->handler[WLC_E_JOIN] = wl_notify_connect_status; - el->handler[WLC_E_LINK] = wl_notify_connect_status; - el->handler[WLC_E_DEAUTH_IND] = wl_notify_connect_status; - el->handler[WLC_E_DISASSOC_IND] = wl_notify_connect_status; - el->handler[WLC_E_ASSOC_IND] = wl_notify_connect_status; - el->handler[WLC_E_REASSOC_IND] = wl_notify_connect_status; - el->handler[WLC_E_ROAM] = wl_notify_roaming_status; - el->handler[WLC_E_MIC_ERROR] = wl_notify_mic_status; -} - -static int32 -wl_init_priv_mem(struct wl_priv *wl) -{ - wl->scan_results = (void *)kzalloc(WL_SCAN_BUF_MAX, GFP_KERNEL); - if (unlikely(!wl->scan_results)) { - WL_ERR(("Scan results alloc failed\n")); - goto init_priv_mem_out; - } - wl->conf = (void *)kzalloc(sizeof(*wl->conf), GFP_KERNEL); - if (unlikely(!wl->conf)) { - WL_ERR(("wl_conf alloc failed\n")); - goto init_priv_mem_out; - } - wl->profile = (void *)kzalloc(sizeof(*wl->profile), GFP_KERNEL); - if (unlikely(!wl->profile)) { - WL_ERR(("wl_profile alloc failed\n")); - goto init_priv_mem_out; - } - wl->bss_info = (void *)kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); - if (unlikely(!wl->bss_info)) { - WL_ERR(("Bss information alloc failed\n")); - goto init_priv_mem_out; - } - wl->scan_req_int = (void *)kzalloc(sizeof(*wl->scan_req_int), GFP_KERNEL); - if (unlikely(!wl->scan_req_int)) { - WL_ERR(("Scan req alloc failed\n")); - goto init_priv_mem_out; - } - wl->ioctl_buf = (void *)kzalloc(WL_IOCTL_LEN_MAX, GFP_KERNEL); - if (unlikely(!wl->ioctl_buf)) { - WL_ERR(("Ioctl buf alloc failed\n")); - goto init_priv_mem_out; - } - wl->extra_buf = (void *)kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); - if (unlikely(!wl->extra_buf)) { - WL_ERR(("Extra buf alloc failed\n")); - goto init_priv_mem_out; - } - wl->iscan = (void *)kzalloc(sizeof(*wl->iscan), GFP_KERNEL); - if (unlikely(!wl->iscan)) { - WL_ERR(("Iscan buf alloc failed\n")); - goto init_priv_mem_out; - } - wl->fw = (void *)kzalloc(sizeof(*wl->fw), GFP_KERNEL); - if (unlikely(!wl->fw)) { - WL_ERR(("fw object alloc failed\n")); - goto init_priv_mem_out; - } - wl->pmk_list = (void *)kzalloc(sizeof(*wl->pmk_list), GFP_KERNEL); - if (unlikely(!wl->pmk_list)) { - WL_ERR(("pmk list alloc failed\n")); - goto init_priv_mem_out; - } - - return 0; - -init_priv_mem_out: - wl_deinit_priv_mem(wl); - - return -ENOMEM; -} - -static void -wl_deinit_priv_mem(struct wl_priv *wl) -{ - if (wl->scan_results) { - kfree(wl->scan_results); - wl->scan_results = NULL; - } - if (wl->bss_info) { - kfree(wl->bss_info); - wl->bss_info = NULL; - } - if (wl->conf) { - kfree(wl->conf); - wl->conf = NULL; - } - if (wl->profile) { - kfree(wl->profile); - wl->profile = NULL; - } - if (wl->scan_req_int) { - kfree(wl->scan_req_int); - wl->scan_req_int = NULL; - } - if (wl->ioctl_buf) { - kfree(wl->ioctl_buf); - wl->ioctl_buf = NULL; - } - if (wl->extra_buf) { - kfree(wl->extra_buf); - wl->extra_buf = NULL; - } - if (wl->iscan) { - kfree(wl->iscan); - wl->iscan = NULL; - } - if (wl->fw) { - kfree(wl->fw); - wl->fw = NULL; - } - if (wl->pmk_list) { - kfree(wl->pmk_list); - wl->pmk_list = NULL; - } -} - - -static int32 -wl_create_event_handler(struct wl_priv *wl) -{ - sema_init(&wl->event_sync, 0); - init_completion(&wl->event_exit); - if (unlikely(((wl->event_pid = kernel_thread(wl_event_handler, wl, 0)) < 0))) { - WL_ERR(("failed to create event thread\n")); - return -ENOMEM; - } - WL_DBG(("pid %d\n", wl->event_pid)); - return 0; -} - -static void -wl_destroy_event_handler(struct wl_priv *wl) -{ - if (wl->event_pid >= 0) { - KILL_PROC(wl->event_pid, SIGTERM); - wait_for_completion(&wl->event_exit); - } -} - -static void -wl_term_iscan(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl_to_iscan(wl); - - if (wl->iscan_on && iscan->pid >= 0) { - iscan->state = WL_ISCAN_STATE_IDLE; - KILL_PROC(iscan->pid, SIGTERM); - wait_for_completion(&iscan->exited); - iscan->pid = -1; - } -} - -static void -wl_notify_iscan_complete(struct wl_iscan_ctrl *iscan, bool aborted) -{ - struct wl_priv *wl = iscan_to_wl(iscan); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely(!test_and_clear_bit(WL_STATUS_SCANNING, &wl->status))) { - WL_ERR(("Scan complete while device not scanning\n")); - return; - } - if (likely(wl->scan_request)) { - cfg80211_scan_done(wl->scan_request, aborted); - wl->scan_request = NULL; - } - wl->iscan_kickstart = FALSE; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif -} - -static int32 -wl_wakeup_iscan(struct wl_iscan_ctrl *iscan) -{ - if (likely(iscan->state != WL_ISCAN_STATE_IDLE)) { - WL_DBG(("wake up iscan\n")); - up(&iscan->sync); - return 0; - } - - return -EIO; -} - -static int32 -wl_get_iscan_results(struct wl_iscan_ctrl *iscan, uint32 *status, struct wl_scan_results **bss_list) -{ - struct wl_iscan_results list; - struct wl_scan_results *results; - struct wl_iscan_results *list_buf; - int32 err = 0; - - memset(iscan->scan_buf, 0, WL_ISCAN_BUF_MAX); - list_buf = (struct wl_iscan_results *)iscan->scan_buf; - results = &list_buf->results; - results->buflen = WL_ISCAN_RESULTS_FIXED_SIZE; - results->version = 0; - results->count = 0; - - memset(&list, 0, sizeof(list)); - list.results.buflen = htod32(WL_ISCAN_BUF_MAX); - if (unlikely((err = wl_dev_iovar_getbuf( - iscan->dev, - "iscanresults", - &list, - WL_ISCAN_RESULTS_FIXED_SIZE, - iscan->scan_buf, - WL_ISCAN_BUF_MAX)))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - results->buflen = dtoh32(results->buflen); - results->version = dtoh32(results->version); - results->count = dtoh32(results->count); - WL_DBG(("results->count = %d\n", results->count)); - WL_DBG(("results->buflen = %d\n", results->buflen)); - *status = dtoh32(list_buf->status); - *bss_list = results; - - return err; -} - -static int32 -wl_iscan_done(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl->iscan; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - iscan->state = WL_ISCAN_STATE_IDLE; - rtnl_lock(); - wl_inform_bss(wl); - wl_notify_iscan_complete(iscan, FALSE); - rtnl_unlock(); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_iscan_pending(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl->iscan; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - /* Reschedule the timer */ - mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000); - iscan->timer_on = 1; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_iscan_inprogress(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl->iscan; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - rtnl_lock(); - wl_inform_bss(wl); - wl_run_iscan(iscan, NULL, WL_SCAN_ACTION_CONTINUE); - rtnl_unlock(); - /* Reschedule the timer */ - mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000); - iscan->timer_on = 1; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_iscan_aborted(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl->iscan; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - iscan->state = WL_ISCAN_STATE_IDLE; - rtnl_lock(); - wl_notify_iscan_complete(iscan, TRUE); - rtnl_unlock(); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_iscan_thread(void *data) -{ - struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; - struct wl_iscan_ctrl *iscan = (struct wl_iscan_ctrl *)data; - struct wl_priv *wl = iscan_to_wl(iscan); - struct wl_iscan_eloop *el = &iscan->el; - uint32 status; - int err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - sched_setscheduler(current, SCHED_FIFO, ¶m); - status = WL_SCAN_RESULTS_PARTIAL; - while (likely(!down_interruptible(&iscan->sync))) { - if (iscan->timer_on) { - del_timer_sync(&iscan->timer); - iscan->timer_on = 0; - } - rtnl_lock(); - if (unlikely((err = wl_get_iscan_results(iscan, &status, &wl->bss_list)))) { - status = WL_SCAN_RESULTS_ABORTED; - WL_ERR(("Abort iscan\n")); - } - rtnl_unlock(); - el->handler[status](wl); - } - if (iscan->timer_on) { - del_timer_sync(&iscan->timer); - iscan->timer_on = 0; - } - complete_and_exit(&iscan->exited, 0); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return 0; -} - -static void -wl_iscan_timer(ulong data) -{ - struct wl_iscan_ctrl *iscan = (struct wl_iscan_ctrl *)data; - - if (iscan) { - iscan->timer_on = 0; - WL_DBG(("timer expired\n")); - wl_wakeup_iscan(iscan); - } -} - -static int32 -wl_invoke_iscan(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl_to_iscan(wl); - int err = 0; - - if (wl->iscan_on && iscan->pid < 0) { - iscan->state = WL_ISCAN_STATE_IDLE; - sema_init(&iscan->sync, 0); - init_completion(&iscan->exited); - iscan->pid = kernel_thread(wl_iscan_thread, iscan, 0); - if (unlikely(iscan->pid < 0)) { - WL_ERR(("Could not create iscan thread\n")); - return -ENOMEM; - } - } - - return err; -} - -static void -wl_init_iscan_eloop(struct wl_iscan_eloop *el) -{ - memset(el, 0, sizeof(*el)); - el->handler[WL_SCAN_RESULTS_SUCCESS] = wl_iscan_done; - el->handler[WL_SCAN_RESULTS_PARTIAL] = wl_iscan_inprogress; - el->handler[WL_SCAN_RESULTS_PENDING] = wl_iscan_pending; - el->handler[WL_SCAN_RESULTS_ABORTED] = wl_iscan_aborted; - el->handler[WL_SCAN_RESULTS_NO_MEM] = wl_iscan_aborted; -} - -static int32 -wl_init_iscan(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl_to_iscan(wl); - int err = 0; - - if (wl->iscan_on) { - iscan->dev = wl_to_ndev(wl); - iscan->state = WL_ISCAN_STATE_IDLE; - wl_init_iscan_eloop(&iscan->el); - iscan->timer_ms = WL_ISCAN_TIMER_INTERVAL_MS; - init_timer(&iscan->timer); - iscan->timer.data = (ulong)iscan; - iscan->timer.function = wl_iscan_timer; - sema_init(&iscan->sync, 0); - init_completion(&iscan->exited); - iscan->pid = kernel_thread(wl_iscan_thread, iscan, 0); - if (unlikely(iscan->pid < 0)) { - WL_ERR(("Could not create iscan thread\n")); - return -ENOMEM; - } - iscan->data = wl; - } - - return err; -} - -static void -wl_init_fw(struct wl_fw_ctrl *fw) -{ - fw->status = 0; /* init fw loading status. 0 means nothing was loaded yet */ -} - -static int32 -wl_init_priv(struct wl_priv *wl) -{ - struct wiphy *wiphy = wl_to_wiphy(wl); - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl->scan_request = NULL; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) - wl->pwr_save = !!(wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT); -#else - wl->pwr_save = wiphy->ps_default; -#endif -#ifndef WL_ISCAN_DISABLED - wl->iscan_on = TRUE; /* iscan on & off switch. we enable iscan per default */ -#else - wl->iscan_on = FALSE; -#endif /* WL_ISCAN_DISABLED */ -#ifndef WL_ROAM_DISABLED - wl->roam_on = TRUE; /* roam on & off switch. we enable roam per default */ -#else - wl->roam_on = FALSE; -#endif /* WL_ROAM_DISABLED */ - - wl->iscan_kickstart = FALSE; - wl->active_scan = TRUE; /* we do active scan for specific scan per default */ - wl->dongle_up = FALSE; /* dongle is not up yet */ - wl_init_eq(wl); - if (unlikely((err = wl_init_priv_mem(wl)))) - return err; - if (unlikely(wl_create_event_handler(wl))) - return -ENOMEM; - wl_init_eloop_handler(&wl->el); - mutex_init(&wl->usr_sync); - if (unlikely((err = wl_init_iscan(wl)))) - return err; - wl_init_fw(wl->fw); - wl_init_conf(wl->conf); - wl_init_prof(wl->profile); - wl_link_down(wl); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static void -wl_deinit_priv(struct wl_priv *wl) -{ -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl_destroy_event_handler(wl); - wl->dongle_up = FALSE; /* dongle down */ - wl_flush_eq(wl); - wl_link_down(wl); - wl_term_iscan(wl); - wl_deinit_priv_mem(wl); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif -} - -int32 -wl_cfg80211_attach(struct net_device *ndev, void *data) -{ - struct wireless_dev *wdev; - struct wl_priv *wl; - struct wl_iface *ci; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely(!ndev)) { - WL_ERR(("ndev is invaild\n")); - return -ENODEV; - } - wl_cfg80211_dev = kzalloc(sizeof(struct wl_dev), GFP_KERNEL); - if (unlikely(!wl_cfg80211_dev)) { - WL_ERR(("wl_cfg80211_dev is invalid\n")); - return -ENOMEM; - } - WL_DBG(("func %p\n", wl_sdio_func())); -#ifndef WL_CFG80211_LOCALTEST - wdev = wl_alloc_wdev(sizeof(struct wl_iface), &wl_sdio_func()->dev); -#else - wdev = wl_alloc_wdev(sizeof(struct wl_iface), NULL); -#endif - if (unlikely(IS_ERR(wdev))) - return -ENOMEM; - - wdev->iftype = wl_mode_to_nl80211_iftype(WL_MODE_BSS); - wl = wdev_to_wl(wdev); - wl->wdev = wdev; - wl->pub = data; - ci = (struct wl_iface *)wl_to_ci(wl); - ci->wl = wl; - ndev->ieee80211_ptr = wdev; - SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); - wdev->netdev = ndev; - if (unlikely((err = wl_init_priv(wl)))) { - WL_ERR(("Failed to init iwm_priv (%d)\n", err)); - goto cfg80211_attach_out; - } - wl_set_drvdata(wl_cfg80211_dev, ci); - set_bit(WL_STATUS_READY, &wl->status); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; - -cfg80211_attach_out: - wl_free_wdev(wl); - return err; -} - -void -wl_cfg80211_detach(void) -{ - struct wl_priv *wl; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl = WL_PRIV_GET(); - - wl_deinit_priv(wl); - wl_free_wdev(wl); - wl_set_drvdata(wl_cfg80211_dev, NULL); - kfree(wl_cfg80211_dev); - wl_cfg80211_dev = NULL; - wl_clear_sdio_func(); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif -} - -static void -wl_wakeup_event(struct wl_priv *wl) -{ - up(&wl->event_sync); -} - -static int32 -wl_event_handler(void *data) -{ - struct wl_priv *wl = (struct wl_priv *)data; - struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; - struct wl_event_q *e; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - sched_setscheduler(current, SCHED_FIFO, ¶m); - while (likely(!down_interruptible(&wl->event_sync))) { - if (unlikely(!(e = wl_deq_event(wl)))) { - WL_ERR(("eqeue empty..\n")); - BUG(); - } - WL_DBG(("event type (%d)\n", e->etype)); - if (wl->el.handler[e->etype]) { - wl->el.handler[e->etype](wl, wl_to_ndev(wl), &e->emsg, e->edata); - } else { - WL_DBG(("Unknown Event (%d): ignoring\n", e->etype)); - } - wl_put_event(e); - } - complete_and_exit(&wl->event_exit, 0); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif -} - -void -wl_cfg80211_event(struct net_device *ndev, const wl_event_msg_t *e, void* data) -{ - uint32 event_type = ntoh32(e->event_type); - struct wl_priv *wl = ndev_to_wl(ndev); -#if (WL_DBG_LEVEL > 0) - int8 *estr = (event_type <= sizeof(wl_dbg_estr)/WL_DBG_ESTR_MAX-1) ? - wl_dbg_estr[event_type] : (int8 *)"Unknown"; -#endif /* (WL_DBG_LEVEL > 0) */ - WL_DBG(("event_type (%d):""WLC_E_""%s\n", event_type, estr)); - if (likely(!wl_enq_event(wl, event_type, e, data))) - wl_wakeup_event(wl); -} - -static void -wl_init_eq(struct wl_priv *wl) -{ - wl_init_eq_lock(wl); - INIT_LIST_HEAD(&wl->eq_list); -} - -static void -wl_flush_eq(struct wl_priv *wl) -{ - struct wl_event_q *e; - - wl_lock_eq(wl); - while (!list_empty(&wl->eq_list)) { - e = list_first_entry(&wl->eq_list, struct wl_event_q, eq_list); - list_del(&e->eq_list); - kfree(e); - } - wl_unlock_eq(wl); -} - -/* -* retrieve first queued event from head -*/ - -static struct wl_event_q * -wl_deq_event(struct wl_priv *wl) -{ - struct wl_event_q *e = NULL; - - wl_lock_eq(wl); - if (likely(!list_empty(&wl->eq_list))) { - e = list_first_entry(&wl->eq_list, struct wl_event_q, eq_list); - list_del(&e->eq_list); - } - wl_unlock_eq(wl); - - return e; -} - -/* -** push event to tail of the queue -*/ - -static int32 -wl_enq_event(struct wl_priv *wl, uint32 event, const wl_event_msg_t *msg, void *data) -{ - struct wl_event_q *e; - int32 err = 0; - - if (unlikely(!(e = kzalloc(sizeof(struct wl_event_q), GFP_KERNEL)))) { - WL_ERR(("event alloc failed\n")); - return -ENOMEM; - } - - e->etype = event; - memcpy(&e->emsg, msg, sizeof(wl_event_msg_t)); - if (data) { - } - wl_lock_eq(wl); - list_add_tail(&e->eq_list, &wl->eq_list); - wl_unlock_eq(wl); - - return err; -} - -static void -wl_put_event(struct wl_event_q *e) -{ - kfree(e); -} - -void -wl_cfg80211_sdio_func(void *func) -{ - cfg80211_sdio_func = (struct sdio_func *)func; -} - -static void -wl_clear_sdio_func(void) -{ - cfg80211_sdio_func = NULL; -} - - -static struct sdio_func * -wl_sdio_func(void) -{ - return cfg80211_sdio_func; -} - -static int32 -wl_dongle_mode(struct net_device *ndev, int32 iftype) -{ - int32 infra = 0; - int32 ap = 0; - int32 err = 0; - - switch (iftype) { - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_WDS: - WL_ERR(("type (%d) : currently we do not support this mode\n", iftype)); - err = -EINVAL; - return err; - case NL80211_IFTYPE_ADHOC: - break; - case NL80211_IFTYPE_STATION: - infra = 1; - break; - default: - err = -EINVAL; - WL_ERR(("invalid type (%d)\n", iftype)); - return err; - } - infra = htod32(infra); - ap = htod32(ap); - WL_DBG(("%s ap (%d), infra (%d)\n", ndev->name, ap, infra)); - if (unlikely(err = wl_dev_ioctl(ndev, WLC_SET_INFRA, &infra, sizeof(infra))) || - unlikely(err = wl_dev_ioctl(ndev, WLC_SET_AP, &ap, sizeof(ap)))) { - WL_ERR(("WLC_SET_INFRA error (%d)\n", err)); - return err; - } - - return -EINPROGRESS; -} - -#ifndef EMBEDDED_PLATFORM -static int32 -wl_dongle_country(struct net_device *ndev, uint8 ccode) -{ - - int32 err = 0; - - - return err; -} - -static int32 -wl_dongle_up(struct net_device *ndev, uint32 up) -{ - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely(err = wl_dev_ioctl(ndev, WLC_UP, &up, sizeof(up)))) { - WL_ERR(("WLC_UP error (%d)\n", err)); - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_dongle_power(struct net_device *ndev, uint32 power_mode) -{ - int32 err = 0; - - if (unlikely(err = wl_dev_ioctl(ndev, WLC_SET_PM, &power_mode, sizeof(power_mode)))) { - WL_ERR(("WLC_SET_PM error (%d)\n", err)); - } - return err; -} - -static int32 -wl_dongle_glom(struct net_device *ndev, uint32 glom, uint32 dongle_align) -{ - int8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ - int32 err = 0; - - /* Match Host and Dongle rx alignment */ - bcm_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf, sizeof(iovbuf)); - if (unlikely(err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - WL_ERR(("txglomalign error (%d)\n", err)); - goto dongle_glom_out; - } - /* disable glom option per default */ - bcm_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf)); - if (unlikely(err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - WL_ERR(("txglom error (%d)\n", err)); - goto dongle_glom_out; - } -dongle_glom_out : - return err; -} - -static int32 -wl_dongle_roam(struct net_device *ndev, uint32 roamvar, uint32 bcn_timeout) -{ - int8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ - int32 err = 0; - - /* Setup timeout if Beacons are lost and roam is off to report link down */ - if (roamvar) { - bcm_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, sizeof(iovbuf)); - if (unlikely(err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - WL_ERR(("bcn_timeout error (%d)\n", err)); - goto dongle_rom_out; - } - } - /* Enable/Disable built-in roaming to allow supplicant to take care of roaming */ - bcm_mkiovar("roam_off", (char *)&roamvar, 4, iovbuf, sizeof(iovbuf)); - if (unlikely(err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - WL_ERR(("roam_off error (%d)\n", err)); - goto dongle_rom_out; - } -dongle_rom_out : - return err; -} - -static int32 -wl_dongle_eventmsg(struct net_device *ndev) -{ - - int8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ - int8 eventmask[WL_EVENTING_MASK_LEN]; - int32 err = 0; - - /* Setup event_msgs */ - bcm_mkiovar("event_msgs", eventmask, WL_EVENTING_MASK_LEN, iovbuf, sizeof(iovbuf)); - if (unlikely(err = wl_dev_ioctl(ndev, WLC_GET_VAR, iovbuf, sizeof(iovbuf)))) { - WL_ERR(("Get event_msgs error (%d)\n", err)); - goto dongle_eventmsg_out; - } - memcpy(eventmask, iovbuf, WL_EVENTING_MASK_LEN); - - setbit(eventmask, WLC_E_SET_SSID); - setbit(eventmask, WLC_E_PRUNE); - setbit(eventmask, WLC_E_AUTH); - setbit(eventmask, WLC_E_REASSOC); - setbit(eventmask, WLC_E_REASSOC_IND); - setbit(eventmask, WLC_E_DEAUTH_IND); - setbit(eventmask, WLC_E_DISASSOC_IND); - setbit(eventmask, WLC_E_DISASSOC); - setbit(eventmask, WLC_E_JOIN); - setbit(eventmask, WLC_E_ASSOC_IND); - setbit(eventmask, WLC_E_PSK_SUP); - setbit(eventmask, WLC_E_LINK); - setbit(eventmask, WLC_E_NDIS_LINK); - setbit(eventmask, WLC_E_MIC_ERROR); - setbit(eventmask, WLC_E_PMKID_CACHE); - setbit(eventmask, WLC_E_TXFAIL); - setbit(eventmask, WLC_E_JOIN_START); - setbit(eventmask, WLC_E_SCAN_COMPLETE); - - bcm_mkiovar("event_msgs", eventmask, WL_EVENTING_MASK_LEN, iovbuf, sizeof(iovbuf)); - if (unlikely(err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - WL_ERR(("Set event_msgs error (%d)\n", err)); - goto dongle_eventmsg_out; - } - -dongle_eventmsg_out : - return err; -} - -static int32 -wl_dongle_scantime(struct net_device *ndev, int32 scan_assoc_time, int32 scan_unassoc_time) -{ - int32 err = 0; - - if ((err = wl_dev_ioctl(ndev, WLC_SET_SCAN_CHANNEL_TIME, &scan_assoc_time, - sizeof(scan_assoc_time)))) { - if (err == -EOPNOTSUPP) { - WL_INFO(("Scan assoc time is not supported\n")); - } else { - WL_ERR(("Scan assoc time error (%d)\n", err)); - } - goto dongle_scantime_out; - } - if ((err = wl_dev_ioctl(ndev, WLC_SET_SCAN_UNASSOC_TIME, &scan_unassoc_time, - sizeof(scan_unassoc_time)))) { - if (err == -EOPNOTSUPP) { - WL_INFO(("Scan unassoc time is not supported\n")); - } else { - WL_ERR(("Scan unassoc time error (%d)\n", err)); - } - goto dongle_scantime_out; - } - -dongle_scantime_out : - return err; -} - -static int32 -wl_dongle_offload(struct net_device *ndev, int32 arpoe, int32 arp_ol) -{ - int8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ - int32 err = 0; - - /* Set ARP offload */ - bcm_mkiovar("arpoe", (char *)&arpoe, 4, iovbuf, sizeof(iovbuf)); - if ((err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - if (err == -EOPNOTSUPP) { - WL_INFO(("arpoe is not supported\n")); - } else { - WL_ERR(("arpoe error (%d)\n", err)); - } - goto dongle_offload_out; - } - bcm_mkiovar("arp_ol", (char *)&arp_ol, 4, iovbuf, sizeof(iovbuf)); - if ((err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - if (err == -EOPNOTSUPP) { - WL_INFO(("arp_ol is not supported\n")); - } else { - WL_ERR(("arp_ol error (%d)\n", err)); - } - goto dongle_offload_out; - } - -dongle_offload_out : - return err; -} - -static int32 -wl_pattern_atoh(int8 *src, int8 *dst) -{ -#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base)) - int i; - if (strncmp(src, "0x", 2) != 0 && - strncmp(src, "0X", 2) != 0) { - WL_ERR(("Mask invalid format. Needs to start with 0x\n")); - return -1; - } - src = src + 2; /* Skip past 0x */ - if (strlen(src) % 2 != 0) { - WL_ERR(("Mask invalid format. Needs to be of even length\n")); - return -1; - } - for (i = 0; *src != '\0'; i++) { - char num[3]; - strncpy(num, src, 2); - num[2] = '\0'; - dst[i] = (uint8)strtoul(num, NULL, 16); - src += 2; - } - return i; -} - -static int32 -wl_dongle_filter(struct net_device *ndev, uint32 filter_mode) -{ - int8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ - const int8 *str; - struct wl_pkt_filter pkt_filter; - struct wl_pkt_filter *pkt_filterp; - int32 buf_len; - int32 str_len; - uint32 mask_size; - uint32 pattern_size; - int8 buf[256]; - int32 err = 0; - -/* add a default packet filter pattern */ - str = "pkt_filter_add"; - str_len = strlen(str); - strncpy(buf, str, str_len); - buf[ str_len ] = '\0'; - buf_len = str_len + 1; - - pkt_filterp = (struct wl_pkt_filter *) (buf + str_len + 1); - - /* Parse packet filter id. */ - pkt_filter.id = htod32(100); - - /* Parse filter polarity. */ - pkt_filter.negate_match = htod32(0); - - /* Parse filter type. */ - pkt_filter.type = htod32(0); - - /* Parse pattern filter offset. */ - pkt_filter.u.pattern.offset = htod32(0); - - /* Parse pattern filter mask. */ - mask_size = htod32(wl_pattern_atoh("0xff", - (char *) pkt_filterp->u.pattern.mask_and_pattern)); - - /* Parse pattern filter pattern. */ - pattern_size = htod32(wl_pattern_atoh("0x00", - (char *) &pkt_filterp->u.pattern.mask_and_pattern[mask_size])); - - if (mask_size != pattern_size) { - WL_ERR(("Mask and pattern not the same size\n")); - err = -EINVAL; - goto dongle_filter_out; - } - - pkt_filter.u.pattern.size_bytes = mask_size; - buf_len += WL_PKT_FILTER_FIXED_LEN; - buf_len += (WL_PKT_FILTER_PATTERN_FIXED_LEN + 2 * mask_size); - - /* Keep-alive attributes are set in local variable (keep_alive_pkt), and - ** then memcpy'ed into buffer (keep_alive_pktp) since there is no - ** guarantee that the buffer is properly aligned. - */ - memcpy((char *)pkt_filterp, &pkt_filter, - WL_PKT_FILTER_FIXED_LEN + WL_PKT_FILTER_PATTERN_FIXED_LEN); - - if ((err = wl_dev_ioctl(ndev, WLC_SET_VAR, buf, buf_len))) { - if (err == -EOPNOTSUPP) { - WL_INFO(("filter not supported\n")); - } else { - WL_ERR(("filter (%d)\n", err)); - } - goto dongle_filter_out; - } - - /* set mode to allow pattern */ - bcm_mkiovar("pkt_filter_mode", (char *)&filter_mode, 4, iovbuf, sizeof(iovbuf)); - if ((err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - if (err == -EOPNOTSUPP) { - WL_INFO(("filter_mode not supported\n")); - } else { - WL_ERR(("filter_mode (%d)\n", err)); - } - goto dongle_filter_out; - } - -dongle_filter_out : - return err; -} -#endif /* !EMBEDDED_PLATFORM */ - -int32 -wl_config_dongle(struct wl_priv *wl, bool need_lock) -{ -#ifndef DHD_SDALIGN -#define DHD_SDALIGN 32 -#endif - struct net_device *ndev; - struct wireless_dev *wdev; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (wl->dongle_up) - return err; - - - ndev = wl_to_ndev(wl); - wdev = ndev->ieee80211_ptr; - if (need_lock) - rtnl_lock(); - -#ifndef EMBEDDED_PLATFORM - if (unlikely((err = wl_dongle_up(ndev, 0)))) - goto default_conf_out; - if (unlikely((err = wl_dongle_country(ndev, 0)))) - goto default_conf_out; - if (unlikely((err = wl_dongle_power(ndev, PM_FAST)))) - goto default_conf_out; - if (unlikely((err = wl_dongle_glom(ndev, 0, DHD_SDALIGN)))) - goto default_conf_out; - if (unlikely((err = wl_dongle_roam(ndev, (wl->roam_on ? 0 : 1), 3)))) - goto default_conf_out; - if (unlikely((err = wl_dongle_eventmsg(ndev)))) - goto default_conf_out; - - wl_dongle_scantime(ndev, 40, 80); - wl_dongle_offload(ndev, 1, 0xf); - wl_dongle_filter(ndev, 1); -#endif /* !EMBEDDED_PLATFORM */ - - err = wl_dongle_mode(ndev, wdev->iftype); - if (unlikely(err && err != -EINPROGRESS)) - goto default_conf_out; - if (unlikely((err = wl_dongle_probecap(wl)))) - goto default_conf_out; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - /* -EINPROGRESS: Call commit handler */ - -default_conf_out : - if (need_lock) - rtnl_unlock(); - - wl->dongle_up = TRUE; - - return err; - -} - -static int32 -wl_update_wiphybands(struct wl_priv *wl) -{ - struct wiphy *wiphy; - int32 phy_list; - int8 phy; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely(err = wl_dev_ioctl(wl_to_ndev(wl), WLC_GET_PHYLIST, &phy_list, - sizeof(phy_list)))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - - phy = ((char *)&phy_list)[1]; - WL_DBG(("%c phy\n", phy)); - if (phy == 'n' || phy == 'a') { - wiphy = wl_to_wiphy(wl); - wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -__wl_cfg80211_up(struct wl_priv *wl) -{ - int32 err = 0; - - if (unlikely(err = wl_config_dongle(wl, FALSE))) - return err; - - wl_invoke_iscan(wl); - set_bit(WL_STATUS_READY, &wl->status); - return err; -} - -static int32 -__wl_cfg80211_down(struct wl_priv *wl) -{ - int32 err = 0; - - /* Check if cfg80211 interface is already down */ - if (!test_bit(WL_STATUS_READY, &wl->status)) - return err; /* it is even not ready */ - - set_bit(WL_STATUS_SCAN_ABORTING, &wl->status); - wl_term_iscan(wl); - if (wl->scan_request) { - cfg80211_scan_done(wl->scan_request, TRUE); /* TRUE means abort */ - wl->scan_request = NULL; - } - clear_bit(WL_STATUS_READY, &wl->status); - clear_bit(WL_STATUS_SCANNING, &wl->status); - clear_bit(WL_STATUS_SCAN_ABORTING, &wl->status); - clear_bit(WL_STATUS_CONNECTED, &wl->status); - - return err; -} - -int32 -wl_cfg80211_up(void) -{ - struct wl_priv *wl; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl = WL_PRIV_GET(); - mutex_lock(&wl->usr_sync); - err = __wl_cfg80211_up(wl); - mutex_unlock(&wl->usr_sync); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -int32 -wl_cfg80211_down(void) -{ - struct wl_priv *wl; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl = WL_PRIV_GET(); - mutex_lock(&wl->usr_sync); - err = __wl_cfg80211_down(wl); - mutex_unlock(&wl->usr_sync); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_dongle_probecap(struct wl_priv *wl) -{ - int32 err = 0; - - if (unlikely((err = wl_update_wiphybands(wl)))) - return err; - - return err; -} - -static void * -wl_read_prof(struct wl_priv *wl, int32 item) -{ - switch (item) { - case WL_PROF_SEC: - return &wl->profile->sec; - case WL_PROF_ACT: - return &wl->profile->active; - case WL_PROF_BSSID: - return &wl->profile->bssid; - case WL_PROF_SSID: - return &wl->profile->ssid; - } - WL_ERR(("invalid item (%d)\n", item)); - return NULL; -} - -static int32 -wl_update_prof(struct wl_priv *wl, const wl_event_msg_t *e, void *data, int32 item) -{ - int32 err = 0; - struct wlc_ssid *ssid; - - switch (item) { - case WL_PROF_SSID: - ssid = (wlc_ssid_t *)data; - memset(wl->profile->ssid.SSID, 0, sizeof(wl->profile->ssid.SSID)); - memcpy(wl->profile->ssid.SSID, ssid->SSID, ssid->SSID_len); - wl->profile->ssid.SSID_len = ssid->SSID_len; - break; - case WL_PROF_BSSID: - if (data) - memcpy(wl->profile->bssid, data, ETHER_ADDR_LEN); - else - memset(wl->profile->bssid, 0, ETHER_ADDR_LEN); - break; - case WL_PROF_SEC: - memcpy(&wl->profile->sec, data, sizeof(wl->profile->sec)); - break; - case WL_PROF_ACT: - wl->profile->active = *(bool *)data; - break; - default : - WL_ERR(("unsupported item (%d)\n", item)); - err = -EOPNOTSUPP; - break; - } - - return err; -} - -void -wl_cfg80211_dbg_level(uint32 level) -{ - wl_dbg_level = level; -} - -static bool -wl_is_ibssmode(struct wl_priv *wl) -{ - return (wl->conf->mode == WL_MODE_IBSS); -} - -static bool -wl_is_ibssstarter(struct wl_priv *wl) -{ - return wl->ibss_starter; -} - -static void -wl_rst_ie(struct wl_priv *wl) -{ - struct wl_ie *ie = wl_to_ie(wl); - - ie->offset = 0; -} - -static int32 -wl_add_ie(struct wl_priv *wl, uint8 t, uint8 l, uint8 *v) -{ - struct wl_ie *ie = wl_to_ie(wl); - int32 err = 0; - - if (unlikely(ie->offset + l + 2 > WL_TLV_INFO_MAX)) { - WL_ERR(("ei crosses buffer boundary\n")); - return -ENOSPC; - } - ie->buf[ie->offset] = t; - ie->buf[ie->offset+1] = l; - memcpy(&ie->buf[ie->offset+2], v, l); - ie->offset += l+2; - - return err; -} - -static int32 -wl_mrg_ie(struct wl_priv *wl, uint8 *ie_stream, uint16 ie_size) -{ - struct wl_ie *ie = wl_to_ie(wl); - int32 err = 0; - - if (unlikely(ie->offset + ie_size > WL_TLV_INFO_MAX)) { - WL_ERR(("ei_stream crosses buffer boundary\n")); - return -ENOSPC; - } - memcpy(&ie->buf[ie->offset], ie_stream, ie_size); - ie->offset += ie_size; - - return err; -} - -static int32 -wl_cp_ie(struct wl_priv *wl, uint8 *dst, uint16 dst_size) -{ - struct wl_ie *ie = wl_to_ie(wl); - int32 err = 0; - - if (unlikely(ie->offset > dst_size)) { - WL_ERR(("dst_size is not enough\n")); - return -ENOSPC; - } - memcpy(dst, &ie->buf[0], ie->offset); - - return err; -} - -static uint32 -wl_get_ielen(struct wl_priv *wl) -{ - struct wl_ie *ie = wl_to_ie(wl); - - return ie->offset; -} - -static void -wl_link_up(struct wl_priv *wl) -{ - wl->link_up = TRUE; -} - -static void -wl_link_down(struct wl_priv *wl) -{ - struct wl_connect_info *conn_info = wl_to_conn(wl); - - wl->link_up = FALSE; - if (conn_info->req_ie) { - kfree(conn_info->req_ie); - conn_info->req_ie = NULL; - } - conn_info->req_ie_len = 0; - if (conn_info->resp_ie) { - kfree(conn_info->resp_ie); - conn_info->resp_ie = NULL; - } - conn_info->resp_ie_len = 0; -} - -static void -wl_lock_eq(struct wl_priv *wl) -{ - spin_lock_irq(&wl->eq_lock); -} - -static void -wl_unlock_eq(struct wl_priv *wl) -{ - spin_unlock_irq(&wl->eq_lock); -} - -static void -wl_init_eq_lock(struct wl_priv *wl) -{ - spin_lock_init(&wl->eq_lock); -} - -static void -wl_delay(uint32 ms) -{ - if (ms < 1000 / HZ) { - cond_resched(); - mdelay(ms); - } else { - msleep(ms); - } -} - -static void -wl_set_drvdata(struct wl_dev *dev, void *data) -{ - dev->driver_data = data; -} - -static void * -wl_get_drvdata(struct wl_dev *dev) -{ - return dev->driver_data; -} - -int32 -wl_cfg80211_read_fw(int8 *buf, uint32 size) -{ - const struct firmware *fw_entry; - struct wl_priv *wl; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In : size (%d)\n", size)); -#endif - wl = WL_PRIV_GET(); - - fw_entry = wl->fw->fw_entry; - - if (fw_entry->size < wl->fw->ptr + size) { - size = fw_entry->size - wl->fw->ptr; - } - memcpy(buf, &fw_entry->data[wl->fw->ptr], size); - wl->fw->ptr += size; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out : size (%d)\n", size)); -#endif - return size; -} - -void -wl_cfg80211_release_fw(void) -{ - struct wl_priv *wl; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl = WL_PRIV_GET(); - release_firmware(wl->fw->fw_entry); - wl->fw->ptr = 0; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif -} - -void * -wl_cfg80211_request_fw(int8 *file_name) -{ - struct wl_priv *wl; - const struct firmware *fw_entry = NULL; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - WL_DBG(("file name : \"%s\"\n", file_name)); - wl = WL_PRIV_GET(); - - if (!test_bit(WL_FW_LOADING_DONE, &wl->fw->status)) { - if (unlikely(err = request_firmware(&wl->fw->fw_entry, file_name, - &wl_sdio_func()->dev))) { - WL_ERR(("Could not download fw (%d)\n", err)); - goto req_fw_out; - } - set_bit(WL_FW_LOADING_DONE, &wl->fw->status); - fw_entry = wl->fw->fw_entry; - if (fw_entry) { - WL_DBG(("fw size (%d), data (%p)\n", fw_entry->size, fw_entry->data)); - } - } else if (!test_bit(WL_NVRAM_LOADING_DONE, &wl->fw->status)) { - if (unlikely(err = request_firmware(&wl->fw->fw_entry, file_name, - &wl_sdio_func()->dev))) { - WL_ERR(("Could not download nvram (%d)\n", err)); - goto req_fw_out; - } - set_bit(WL_NVRAM_LOADING_DONE, &wl->fw->status); - fw_entry = wl->fw->fw_entry; - if (fw_entry) { - WL_DBG(("nvram size (%d), data (%p)\n", fw_entry->size, fw_entry->data)); - } - } else { - WL_DBG(("Downloading already done. Nothing to do more\n")); - err = -EPERM; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - -req_fw_out: - if (unlikely(err)) { - return NULL; - } - wl->fw->ptr = 0; - return (void *)fw_entry->data; -} - -int8 * -wl_cfg80211_get_fwname(void) -{ - struct wl_priv *wl; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl = WL_PRIV_GET(); - strcpy(wl->fw->fw_name, WL_4329_FW_FILE); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return wl->fw->fw_name; -} - -int8 * -wl_cfg80211_get_nvramname(void) -{ - struct wl_priv *wl; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl = WL_PRIV_GET(); - strcpy(wl->fw->nvram_name, WL_4329_NVRAM_FILE); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return wl->fw->nvram_name; -} diff --git a/drivers/net/wireless/bcm4319/wl_cfg80211.h b/drivers/net/wireless/bcm4319/wl_cfg80211.h deleted file mode 100644 index 27226992796d..000000000000 --- a/drivers/net/wireless/bcm4319/wl_cfg80211.h +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Linux Cfg80211 support - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: wl_cfg80211.h,v 1.1.2.19 2010/05/04 21:21:00 Exp $ - */ - -#ifndef _wl_cfg80211_h_ -#define _wl_cfg80211_h_ - -#include -#include -#include -#include -#include -#include - -struct wl_conf; -struct wl_iface; -struct wl_priv; -struct wl_security; -struct wl_ibss; - -#if defined(IL_BIGENDIAN) -#include -#define htod32(i) (bcmswap32(i)) -#define htod16(i) (bcmswap16(i)) -#define dtoh32(i) (bcmswap32(i)) -#define dtoh16(i) (bcmswap16(i)) -#define htodchanspec(i) htod16(i) -#define dtohchanspec(i) dtoh16(i) -#else -#define htod32(i) i -#define htod16(i) i -#define dtoh32(i) i -#define dtoh16(i) i -#define htodchanspec(i) i -#define dtohchanspec(i) i -#endif - -#define WL_DBG_NONE 0 -#define WL_DBG_DBG (1 << 2) -#define WL_DBG_INFO (1 << 1) -#define WL_DBG_ERR (1 << 0) -#define WL_DBG_MASK ((WL_DBG_DBG | WL_DBG_INFO | WL_DBG_ERR) << 1) - -#define WL_DBG_LEVEL 1 /* 0 invalidates all debug messages. default is 1 */ -#define WL_ERR(args) \ - do { \ - if (wl_dbg_level & WL_DBG_ERR) { \ - if (net_ratelimit()) { \ - printk("ERROR @%s : ", __FUNCTION__); \ - printk args; \ - } \ - } \ - } while (0) -#define WL_INFO(args) \ - do { \ - if (wl_dbg_level & WL_DBG_INFO) { \ - if (net_ratelimit()) { \ - printk("INFO @%s : ", __FUNCTION__); \ - printk args; \ - } \ - } \ - } while (0) -#if (WL_DBG_LEVEL > 0) -#define WL_DBG(args) \ - do { \ - if (wl_dbg_level & WL_DBG_DBG) { \ - printk("DEBUG @%s :", __FUNCTION__); \ - printk args; \ - } \ - } while (0) -#else /* !(WL_DBG_LEVEL > 0) */ -#define WL_DBG(args) -#endif /* (WL_DBG_LEVEL > 0) */ - -#define WL_SCAN_RETRY_MAX 3 /* used for ibss scan */ -#define WL_NUM_SCAN_MAX 1 -#define WL_NUM_PMKIDS_MAX MAXPMKID /* will be used for 2.6.33 kernel - * or later - */ -#define WL_SCAN_BUF_MAX (1024 * 8) -#define WL_TLV_INFO_MAX 1024 -#define WL_BSS_INFO_MAX 2048 -#define WL_ASSOC_INFO_MAX 512 /* - * needs to grab assoc info from dongle to - * report it to cfg80211 through "connect" - * event - */ -#define WL_IOCTL_LEN_MAX 1024 -#define WL_EXTRA_BUF_MAX 2048 -#define WL_ISCAN_BUF_MAX 2048 /* the buf lengh can be WLC_IOCTL_MAXLEN (8K) - * to reduce iteration - */ -#define WL_ISCAN_TIMER_INTERVAL_MS 3000 -#define WL_SCAN_ERSULTS_LAST (WL_SCAN_RESULTS_NO_MEM+1) -#define WL_AP_MAX 256 /* virtually unlimitted as long - * as kernel memory allows - */ -#define WL_FILE_NAME_MAX 256 - -/* dongle status */ -enum wl_status { - WL_STATUS_READY, - WL_STATUS_SCANNING, - WL_STATUS_SCAN_ABORTING, - WL_STATUS_CONNECTING, - WL_STATUS_CONNECTED -}; - -/* wi-fi mode */ -enum wl_mode { - WL_MODE_BSS, - WL_MODE_IBSS, - WL_MODE_AP -}; - -/* dongle profile list */ -enum wl_prof_list { - WL_PROF_MODE, - WL_PROF_SSID, - WL_PROF_SEC, - WL_PROF_IBSS, - WL_PROF_BAND, - WL_PROF_BSSID, - WL_PROF_ACT -}; - -/* dongle iscan state */ -enum wl_iscan_state { - WL_ISCAN_STATE_IDLE, - WL_ISCAN_STATE_SCANING -}; - -/* fw downloading status */ -enum wl_fw_status { - WL_FW_LOADING_DONE, - WL_NVRAM_LOADING_DONE -}; - -/* dongle configuration */ -struct wl_conf { - uint32 mode; /* adhoc , infrastructure or ap */ - uint32 frag_threshold; - uint32 rts_threshold; - uint32 retry_short; - uint32 retry_long; - int32 tx_power; - struct ieee80211_channel channel; -}; - -/* cfg80211 main event loop */ -struct wl_event_loop { - int32 (*handler[WLC_E_LAST])(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void *data); -}; - -/* representing interface of cfg80211 plane */ -struct wl_iface { - struct wl_priv *wl; -}; - -struct wl_dev { - void *driver_data; /* to store cfg80211 object information */ -}; - -/* bss inform structure for cfg80211 interface */ -struct wl_cfg80211_bss_info { - uint16 band; - uint16 channel; - int16 rssi; - uint16 frame_len; - uint8 frame_buf[1]; -}; - -/* basic structure of scan request */ -struct wl_scan_req { - struct wlc_ssid ssid; -}; - -/* basic structure of information element */ -struct wl_ie { - uint16 offset; - uint8 buf[WL_TLV_INFO_MAX]; -}; - -/* event queue for cfg80211 main event */ -struct wl_event_q { - struct list_head eq_list; - uint32 etype; - wl_event_msg_t emsg; - int8 edata[1]; -}; - -/* security information with currently associated ap */ -struct wl_security { - uint32 wpa_versions; - uint32 auth_type; - uint32 cipher_pairwise; - uint32 cipher_group; - uint32 wpa_auth; -}; - -/* ibss information for currently joined ibss network */ -struct wl_ibss { - uint8 beacon_interval; /* in millisecond */ - uint8 atim; /* in millisecond */ - int8 join_only; - uint8 band; - uint8 channel; -}; - -/* dongle profile */ -struct wl_profile { - uint32 mode; - struct wlc_ssid ssid; - uint8 bssid[ETHER_ADDR_LEN]; - struct wl_security sec; - struct wl_ibss ibss; - int32 band; - bool active; -}; - -/* dongle iscan event loop */ -struct wl_iscan_eloop { - int32 (*handler[WL_SCAN_ERSULTS_LAST])(struct wl_priv *wl); -}; - -/* dongle iscan controller */ -struct wl_iscan_ctrl { - struct net_device *dev; - struct timer_list timer; - uint32 timer_ms; - uint32 timer_on; - int32 state; - int32 pid; - struct semaphore sync; - struct completion exited; - struct wl_iscan_eloop el; - void *data; - int8 ioctl_buf[WLC_IOCTL_SMLEN]; - int8 scan_buf[WL_ISCAN_BUF_MAX]; -}; - -/* association inform */ -struct wl_connect_info { - uint8 *req_ie; - int32 req_ie_len; - uint8 *resp_ie; - int32 resp_ie_len; -}; - -/* firmware /nvram downloading controller */ -struct wl_fw_ctrl { - const struct firmware *fw_entry; - ulong status; - uint32 ptr; - int8 fw_name[WL_FILE_NAME_MAX]; - int8 nvram_name[WL_FILE_NAME_MAX]; -}; - -/* assoc ie length */ -struct wl_assoc_ielen { - uint32 req_len; - uint32 resp_len; -}; - -/* wpa2 pmk list */ -struct wl_pmk_list { - pmkid_list_t pmkids; - pmkid_t foo[MAXPMKID-1]; -}; - - -/* dongle private data of cfg80211 interface */ -struct wl_priv { - struct wireless_dev *wdev; /* representing wl cfg80211 device */ - struct wl_conf *conf; /* dongle configuration */ - struct cfg80211_scan_request *scan_request; /* scan request object */ - struct wl_event_loop el; /* main event loop */ - struct list_head eq_list; /* used for event queue */ - spinlock_t eq_lock; /* for event queue synchronization */ - struct mutex usr_sync; /* maily for dongle up/down synchronization */ - struct wl_scan_results *bss_list; /* bss_list holding scanned ap information */ - struct wl_scan_results *scan_results; - struct wl_scan_req *scan_req_int; /* scan request object for internal purpose */ - struct wl_cfg80211_bss_info *bss_info; /* bss information for cfg80211 layer */ - struct wl_ie ie; /* information element object for internal purpose */ - struct ether_addr bssid; /* bssid of currently engaged network */ - struct semaphore event_sync; /* for synchronization of main event thread */ - struct completion event_exit; - struct wl_profile *profile; /* holding dongle profile */ - struct wl_iscan_ctrl *iscan; /* iscan controller */ - struct wl_connect_info conn_info; /* association information container */ - struct wl_fw_ctrl *fw; /* control firwmare / nvram paramter downloading */ - struct wl_pmk_list *pmk_list; /* wpa2 pmk list */ - int32 event_pid; /* pid of main event handler thread */ - ulong status; /* current dongle status */ - void * pub; - uint32 channel; /* current channel */ - bool iscan_on; /* iscan on/off switch */ - bool iscan_kickstart; /* indicate iscan already started */ - bool active_scan; /* current scan mode */ - bool ibss_starter; /* indicates this sta is ibss starter */ - bool link_up; /* link/connection up flag */ - bool pwr_save; /* indicate whether dongle to support power save mode */ - bool dongle_up; /* indicate whether dongle up or not */ - bool roam_on; /* on/off switch for dongle self-roaming */ - bool scan_tried; /* indicates if first scan attempted */ - uint8 *ioctl_buf; /* ioctl buffer */ - uint8 *extra_buf; /* maily to grab assoc information */ - uint8 ci[0] __attribute__((__aligned__(NETDEV_ALIGN))); -}; - -#define wl_to_dev(w) (wiphy_dev(wl->wdev->wiphy)) -#define wl_to_wiphy(w) (w->wdev->wiphy) -#define wiphy_to_wl(w) ((struct wl_priv *)(wiphy_priv(w))) -#define wl_to_wdev(w) (w->wdev) -#define wdev_to_wl(w) ((struct wl_priv *)(wdev_priv(w))) -#define wl_to_ndev(w) (w->wdev->netdev) -#define ndev_to_wl(n) (wdev_to_wl(n->ieee80211_ptr)) -#define ci_to_wl(c) (ci->wl) -#define wl_to_ci(w) (&w->ci) -#define wl_to_sr(w) (w->scan_req_int) -#define wl_to_ie(w) (&w->ie) -#define iscan_to_wl(i) ((struct wl_priv *)(i->data)) -#define wl_to_iscan(w) (w->iscan) -#define wl_to_conn(w) (&w->conn_info) - -inline static struct wl_bss_info * next_bss(struct wl_scan_results *list, - struct wl_bss_info *bss) { - return (bss = bss ? - (struct wl_bss_info *)((uintptr)bss + dtoh32(bss->length)) : list->bss_info); -} -#define for_each_bss(list, bss, __i) \ - for (__i = 0; __i < list->count && __i < WL_AP_MAX; __i++, bss = next_bss(list, bss)) - -extern int32 wl_cfg80211_attach(struct net_device *ndev, void *data); -extern void wl_cfg80211_detach(void); -/* event handler from dongle */ -extern void wl_cfg80211_event(struct net_device *ndev, const wl_event_msg_t *e, void* data); -extern void wl_cfg80211_sdio_func(void *func); /* set sdio function info */ -extern int32 wl_cfg80211_up(void); /* dongle up */ -extern int32 wl_cfg80211_down(void); /* dongle down */ -extern void wl_cfg80211_dbg_level(uint32 level); /* set dongle debugging level */ -extern void * wl_cfg80211_request_fw(int8 *file_name); /* request fw /nvram downloading */ -extern int32 wl_cfg80211_read_fw(int8 *buf, uint32 size); /* read fw image */ -extern void wl_cfg80211_release_fw(void); /* release fw */ -extern int8 * wl_cfg80211_get_fwname(void); /* get firmware name for the dongle */ -extern int8 * wl_cfg80211_get_nvramname(void); /* get nvram name for the dongle */ - -#endif /* _wl_cfg80211_h_ */ diff --git a/drivers/net/wireless/bcm4319/wl_iw.c b/drivers/net/wireless/bcm4319/wl_iw.c deleted file mode 100644 index 2966a58a036a..000000000000 --- a/drivers/net/wireless/bcm4319/wl_iw.c +++ /dev/null @@ -1,8391 +0,0 @@ -/* - * Linux Wireless Extensions support - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: wl_iw.c,v 1.51.4.9.2.6.4.142.4.69 2010/12/21 03:00:08 Exp $ - */ - - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include - -typedef void wlc_info_t; -typedef void wl_info_t; -typedef const struct si_pub si_t; -#include - -#include -#include -#include -#define WL_ERROR(x) printf x -#define WL_TRACE(x) -#define WL_ASSOC(x) -#define WL_INFORM(x) -#define WL_WSEC(x) -#define WL_SCAN(x) -#define WL_TRACE_COEX(x) - -#include -#include - - -#ifndef IW_ENCODE_ALG_SM4 -#define IW_ENCODE_ALG_SM4 0x20 -#endif - -#ifndef IW_AUTH_WAPI_ENABLED -#define IW_AUTH_WAPI_ENABLED 0x20 -#endif - -#ifndef IW_AUTH_WAPI_VERSION_1 -#define IW_AUTH_WAPI_VERSION_1 0x00000008 -#endif - -#ifndef IW_AUTH_CIPHER_SMS4 -#define IW_AUTH_CIPHER_SMS4 0x00000020 -#endif - -#ifndef IW_AUTH_KEY_MGMT_WAPI_PSK -#define IW_AUTH_KEY_MGMT_WAPI_PSK 4 -#endif - -#ifndef IW_AUTH_KEY_MGMT_WAPI_CERT -#define IW_AUTH_KEY_MGMT_WAPI_CERT 8 -#endif - - -#define IW_WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED | SMS4_ENABLED)) - -#include -#include - -#define WL_IW_USE_ISCAN 1 -#define ENABLE_ACTIVE_PASSIVE_SCAN_SUPPRESS 1 - -#if defined(SOFTAP) -#define WL_SOFTAP(x) printk x -static struct net_device *priv_dev; -static bool ap_cfg_running = FALSE; -bool ap_fw_loaded = FALSE; -static long ap_cfg_pid = -1; -struct net_device *ap_net_dev = NULL; -struct semaphore ap_eth_sema; -static struct completion ap_cfg_exited; -static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap); -static int wl_iw_softap_deassoc_stations(struct net_device *dev, u8 *mac); -#endif - -#define WL_IW_IOCTL_CALL(func_call) \ - do { \ - func_call; \ - } while (0) - -static int g_onoff = G_WLAN_SET_ON; -wl_iw_extra_params_t g_wl_iw_params; -static struct mutex wl_cache_lock; - -#ifdef CONFIG_US_NON_DFS_CHANNELS_ONLY -static bool use_non_dfs_channels = true; -#endif - -extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status, - uint32 reason, char* stringBuf, uint buflen); -#include -extern void dhd_customer_gpio_wlan_ctrl(int onoff); -extern uint dhd_dev_reset(struct net_device *dev, uint8 flag); -extern void dhd_dev_init_ioctl(struct net_device *dev); -int dev_iw_write_cfg1_bss_var(struct net_device *dev, int val); - -uint wl_msg_level = WL_ERROR_VAL; - -#define MAX_WLIW_IOCTL_LEN 1024 - - -#if defined(IL_BIGENDIAN) -#include -#define htod32(i) (bcmswap32(i)) -#define htod16(i) (bcmswap16(i)) -#define dtoh32(i) (bcmswap32(i)) -#define dtoh16(i) (bcmswap16(i)) -#define htodchanspec(i) htod16(i) -#define dtohchanspec(i) dtoh16(i) -#else -#define htod32(i) i -#define htod16(i) i -#define dtoh32(i) i -#define dtoh16(i) i -#define htodchanspec(i) i -#define dtohchanspec(i) i -#endif - -#ifdef CONFIG_WIRELESS_EXT - -extern struct iw_statistics *dhd_get_wireless_stats(struct net_device *dev); -extern int dhd_wait_pend8021x(struct net_device *dev); -#endif - -#if WIRELESS_EXT < 19 -#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST) -#define IW_EVENT_IDX(cmd) ((cmd) - IWEVFIRST) -#endif - -static void *g_scan = NULL; -static volatile uint g_scan_specified_ssid; -static wlc_ssid_t g_specific_ssid; - -static wlc_ssid_t g_ssid; - -static wl_iw_ss_cache_ctrl_t g_ss_cache_ctrl; -#if defined(CONFIG_FIRST_SCAN) -static volatile uint g_first_broadcast_scan; -static volatile uint g_first_counter_scans; -#define MAX_ALLOWED_BLOCK_SCAN_FROM_FIRST_SCAN 3 -#endif - - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) -#define DAEMONIZE(a) daemonize(a); \ - allow_signal(SIGKILL); \ - allow_signal(SIGTERM); -#else -#define RAISE_RX_SOFTIRQ() \ - cpu_raise_softirq(smp_processor_id(), NET_RX_SOFTIRQ) -#define DAEMONIZE(a) daemonize(); \ - do { if (a) \ - strncpy(current->comm, a, MIN(sizeof(current->comm), (strlen(a) + 1))); \ - } while (0); -#endif - -#if defined(WL_IW_USE_ISCAN) -#if !defined(CSCAN) -static void wl_iw_free_ss_cache(void); -static int wl_iw_run_ss_cache_timer(int kick_off); -#endif -#if defined(CONFIG_FIRST_SCAN) -int wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag); -#endif -static int dev_wlc_bufvar_set(struct net_device *dev, char *name, char *buf, int len); -#define ISCAN_STATE_IDLE 0 -#define ISCAN_STATE_SCANING 1 - -#define WLC_IW_ISCAN_MAXLEN 2048 -typedef struct iscan_buf { - struct iscan_buf * next; - char iscan_buf[WLC_IW_ISCAN_MAXLEN]; -} iscan_buf_t; - -typedef struct iscan_info { - struct net_device *dev; - struct timer_list timer; - uint32 timer_ms; - uint32 timer_on; - int iscan_state; - iscan_buf_t * list_hdr; - iscan_buf_t * list_cur; - - - long sysioc_pid; - struct semaphore sysioc_sem; - struct completion sysioc_exited; - - uint32 scan_flag; -#if defined CSCAN - char ioctlbuf[WLC_IOCTL_MEDLEN]; -#else - char ioctlbuf[WLC_IOCTL_SMLEN]; -#endif - wl_iscan_params_t *iscan_ex_params_p; - int iscan_ex_param_size; -} iscan_info_t; -#define COEX_DHCP 1 - -#define BT_DHCP_eSCO_FIX -#define BT_DHCP_USE_FLAGS -#define BT_DHCP_OPPORTUNITY_WINDOW_TIME 2500 -#define BT_DHCP_FLAG_FORCE_TIME 5500 -static void wl_iw_bt_flag_set(struct net_device *dev, bool set); -static void wl_iw_bt_release(void); - -typedef enum bt_coex_status { - BT_DHCP_IDLE = 0, - BT_DHCP_START, - BT_DHCP_OPPORTUNITY_WINDOW, - BT_DHCP_FLAG_FORCE_TIMEOUT -} coex_status_t; - -typedef struct bt_info { - struct net_device *dev; - struct timer_list timer; - uint32 timer_ms; - uint32 timer_on; - bool dhcp_done; - int bt_state; - - long bt_pid; - struct semaphore bt_sem; - struct completion bt_exited; -} bt_info_t; - -bt_info_t *g_bt = NULL; -static void wl_iw_bt_timerfunc(ulong data); -iscan_info_t *g_iscan = NULL; -static void wl_iw_timerfunc(ulong data); -static void wl_iw_set_event_mask(struct net_device *dev); -static int -wl_iw_iscan(iscan_info_t *iscan, wlc_ssid_t *ssid, uint16 action); -#endif -static int -wl_iw_set_scan( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -); - -#ifndef CSCAN -static int -wl_iw_get_scan( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -); - -static uint -wl_iw_get_scan_prep( - wl_scan_results_t *list, - struct iw_request_info *info, - char *extra, - short max_size -); -#endif - -static void swap_key_from_BE( - wl_wsec_key_t *key -) -{ - key->index = htod32(key->index); - key->len = htod32(key->len); - key->algo = htod32(key->algo); - key->flags = htod32(key->flags); - key->rxiv.hi = htod32(key->rxiv.hi); - key->rxiv.lo = htod16(key->rxiv.lo); - key->iv_initialized = htod32(key->iv_initialized); -} - -static void swap_key_to_BE( - wl_wsec_key_t *key -) -{ - key->index = dtoh32(key->index); - key->len = dtoh32(key->len); - key->algo = dtoh32(key->algo); - key->flags = dtoh32(key->flags); - key->rxiv.hi = dtoh32(key->rxiv.hi); - key->rxiv.lo = dtoh16(key->rxiv.lo); - key->iv_initialized = dtoh32(key->iv_initialized); -} - -void reset_g_onoff(void) -{ - if(g_onoff == G_WLAN_SET_OFF) { - printk("g_onoff = G_WLAN_SET_OFF, need to reset to G_WLAN_SET_ON\n"); - g_onoff = G_WLAN_SET_ON; - } -} - -static int -dev_wlc_ioctl( - struct net_device *dev, - int cmd, - void *arg, - int len -) -{ - struct ifreq ifr; - wl_ioctl_t ioc; - mm_segment_t fs; - int ret = -EINVAL; - - if (!dev) { - WL_ERROR(("%s: dev is null\n", __FUNCTION__)); - return ret; - } - - net_os_wake_lock(dev); - - WL_INFORM(("\n%s, PID:%x: send Local IOCTL -> dhd: cmd:0x%x, buf:%p, len:%d ,\n", - __FUNCTION__, current->pid, cmd, arg, len)); - - if (g_onoff == G_WLAN_SET_ON) { - memset(&ioc, 0, sizeof(ioc)); - ioc.cmd = cmd; - ioc.buf = arg; - ioc.len = len; - - strcpy(ifr.ifr_name, dev->name); - ifr.ifr_data = (caddr_t) &ioc; - - ret = dev_open(dev); - if (ret) { - WL_ERROR(("%s: Error dev_open: %d\n", __func__, ret)); - net_os_wake_unlock(dev); - return ret; - } - - fs = get_fs(); - set_fs(get_ds()); -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31)) - ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE); -#else - ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE); -#endif - set_fs(fs); - } - else { - WL_TRACE(("%s: call after driver stop : ignored\n", __FUNCTION__)); - } - - net_os_wake_unlock(dev); - - return ret; -} - - -static int -dev_wlc_intvar_get_reg( - struct net_device *dev, - char *name, - uint reg, - int *retval) -{ - union { - char buf[WLC_IOCTL_SMLEN]; - int val; - } var; - int error; - - uint len; - len = bcm_mkiovar(name, (char *)(®), sizeof(reg), (char *)(&var), sizeof(var.buf)); - ASSERT(len); - error = dev_wlc_ioctl(dev, WLC_GET_VAR, (void *)&var, len); - - *retval = dtoh32(var.val); - return (error); -} - - -static int -dev_wlc_intvar_set_reg( - struct net_device *dev, - char *name, - char *addr, - char * val) -{ - char reg_addr[8]; - - memset(reg_addr, 0, sizeof(reg_addr)); - memcpy((char *)®_addr[0], (char *)addr, 4); - memcpy((char *)®_addr[4], (char *)val, 4); - - return (dev_wlc_bufvar_set(dev, name, (char *)®_addr[0], sizeof(reg_addr))); -} - - -static int -dev_wlc_intvar_set( - struct net_device *dev, - char *name, - int val) -{ - char buf[WLC_IOCTL_SMLEN]; - uint len; - - val = htod32(val); - len = bcm_mkiovar(name, (char *)(&val), sizeof(val), buf, sizeof(buf)); - ASSERT(len); - - return (dev_wlc_ioctl(dev, WLC_SET_VAR, buf, len)); -} - -#if defined(WL_IW_USE_ISCAN) -static int -dev_iw_iovar_setbuf( - struct net_device *dev, - char *iovar, - void *param, - int paramlen, - void *bufptr, - int buflen) -{ - int iolen; - - iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen); - ASSERT(iolen); - - if (iolen == 0) - return 0; - - return (dev_wlc_ioctl(dev, WLC_SET_VAR, bufptr, iolen)); -} - -static int -dev_iw_iovar_getbuf( - struct net_device *dev, - char *iovar, - void *param, - int paramlen, - void *bufptr, - int buflen) -{ - int iolen; - - iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen); - ASSERT(iolen); - - return (dev_wlc_ioctl(dev, WLC_GET_VAR, bufptr, buflen)); -} -#endif - - -#if WIRELESS_EXT > 17 -static int -dev_wlc_bufvar_set( - struct net_device *dev, - char *name, - char *buf, int len) -{ - static char ioctlbuf[MAX_WLIW_IOCTL_LEN]; - uint buflen; - - buflen = bcm_mkiovar(name, buf, len, ioctlbuf, sizeof(ioctlbuf)); - ASSERT(buflen); - - return (dev_wlc_ioctl(dev, WLC_SET_VAR, ioctlbuf, buflen)); -} -#endif - - -static int -dev_wlc_bufvar_get( - struct net_device *dev, - char *name, - char *buf, int buflen) -{ - static char ioctlbuf[MAX_WLIW_IOCTL_LEN]; - int error; - uint len; - - len = bcm_mkiovar(name, NULL, 0, ioctlbuf, sizeof(ioctlbuf)); - ASSERT(len); - error = dev_wlc_ioctl(dev, WLC_GET_VAR, (void *)ioctlbuf, MAX_WLIW_IOCTL_LEN); - if (!error) - bcopy(ioctlbuf, buf, buflen); - - return (error); -} - - - -static int -dev_wlc_intvar_get( - struct net_device *dev, - char *name, - int *retval) -{ - union { - char buf[WLC_IOCTL_SMLEN]; - int val; - } var; - int error; - - uint len; - uint data_null; - - len = bcm_mkiovar(name, (char *)(&data_null), 0, (char *)(&var), sizeof(var.buf)); - ASSERT(len); - error = dev_wlc_ioctl(dev, WLC_GET_VAR, (void *)&var, len); - - *retval = dtoh32(var.val); - - return (error); -} - - -#if WIRELESS_EXT > 12 -static int -wl_iw_set_active_scan( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int as = 0; - int error = 0; - char *p = extra; - -#if defined(WL_IW_USE_ISCAN) - if (g_iscan->iscan_state == ISCAN_STATE_IDLE) -#endif - error = dev_wlc_ioctl(dev, WLC_SET_PASSIVE_SCAN, &as, sizeof(as)); -#if defined(WL_IW_USE_ISCAN) - else - g_iscan->scan_flag = as; -#endif - p += snprintf(p, MAX_WX_STRING, "OK"); - - wrqu->data.length = p - extra + 1; - return error; -} - -static int -wl_iw_set_passive_scan( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int ps = 1; - int error = 0; - char *p = extra; - -#if defined(WL_IW_USE_ISCAN) - if (g_iscan->iscan_state == ISCAN_STATE_IDLE) { -#endif - - - if (g_scan_specified_ssid == 0) { - error = dev_wlc_ioctl(dev, WLC_SET_PASSIVE_SCAN, &ps, sizeof(ps)); - } -#if defined(WL_IW_USE_ISCAN) - } - else - g_iscan->scan_flag = ps; -#endif - - p += snprintf(p, MAX_WX_STRING, "OK"); - - wrqu->data.length = p - extra + 1; - return error; -} - -static int -wl_iw_get_macaddr( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int error; - char buf[128]; - struct ether_addr *id; - char *p = extra; - - - strcpy(buf, "cur_etheraddr"); - error = dev_wlc_ioctl(dev, WLC_GET_VAR, buf, sizeof(buf)); - id = (struct ether_addr *) buf; - p += snprintf(p, MAX_WX_STRING, "Macaddr = %02X:%02X:%02X:%02X:%02X:%02X\n", - id->octet[0], id->octet[1], id->octet[2], - id->octet[3], id->octet[4], id->octet[5]); - wrqu->data.length = p - extra + 1; - - return error; -} - -static int -wl_iw_set_country_code(struct net_device *dev, char *ccode) -{ - char country_code[WLC_CNTRY_BUF_SZ]; - int ret = -1; - - WL_TRACE(("%s\n", __FUNCTION__)); - if (!ccode) - ccode = dhd_bus_country_get(dev); - strncpy(country_code, ccode, sizeof(country_code)); - if (ccode && (country_code[0] != 0)) { -#ifdef CONFIG_US_NON_DFS_CHANNELS_ONLY - if (use_non_dfs_channels && !strncmp(country_code, "US", 2)) - strncpy(country_code, "Q2", WLC_CNTRY_BUF_SZ); - if (!use_non_dfs_channels && !strncmp(country_code, "Q2", 2)) - strncpy(country_code, "US", WLC_CNTRY_BUF_SZ); -#endif - ret = dev_wlc_ioctl(dev, WLC_SET_COUNTRY, &country_code, sizeof(country_code)); - if (ret >= 0) { - WL_TRACE(("%s: set country %s OK\n", __FUNCTION__, country_code)); - dhd_bus_country_set(dev, &country_code[0]); - } - } - return ret; -} - -static int -wl_iw_set_country( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - char country_code[WLC_CNTRY_BUF_SZ]; - int error = 0; - char *p = extra; - int country_offset; - int country_code_size; - - WL_TRACE(("%s\n", __FUNCTION__)); - memset(country_code, 0, sizeof(country_code)); - - country_offset = strcspn(extra, " "); - country_code_size = strlen(extra) - country_offset; - - if (country_offset != 0) { - strncpy(country_code, extra + country_offset + 1, - MIN(country_code_size, sizeof(country_code))); - error = wl_iw_set_country_code(dev, country_code); - if (error >= 0) { - p += snprintf(p, MAX_WX_STRING, "OK"); - WL_TRACE(("%s: set country %s OK\n", __FUNCTION__, country_code)); - goto exit; - } - } - - WL_ERROR(("%s: set country %s failed code %d\n", __FUNCTION__, country_code, error)); - p += snprintf(p, MAX_WX_STRING, "FAIL"); - -exit: - wrqu->data.length = p - extra + 1; - return error; -} - -static int -wl_iw_get_country( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - char *ccode; - int current_channels; - - WL_TRACE(("%s\n", __FUNCTION__)); - - ccode = dhd_bus_country_get(dev); - if(ccode){ - if(0 == strcmp(ccode, "Q2")) - current_channels = 11; - else if(0 == strcmp(ccode, "EU")) - current_channels = 13; - else if(0 == strcmp(ccode, "JP")) - current_channels = 14; - } - sprintf(extra, "Scan-Channels = %d", current_channels); - printk("Get Channels return %d,(country code = %s)\n",current_channels, ccode); - return 0; -} - -#ifdef CUSTOMER_HW2 -static int -wl_iw_set_power_mode( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int error = 0; - char *p = extra; - static int pm = PM_FAST; - int pm_local = PM_OFF; - char powermode_val = 0; - - WL_TRACE_COEX(("%s: DHCP session cmd:%s\n", __FUNCTION__, extra)); - - strncpy((char *)&powermode_val, extra + strlen("POWERMODE") + 1, 1); - - if (strnicmp((char *)&powermode_val, "1", strlen("1")) == 0) { - - dev_wlc_ioctl(dev, WLC_GET_PM, &pm, sizeof(pm)); - dev_wlc_ioctl(dev, WLC_SET_PM, &pm_local, sizeof(pm_local)); - - /* Disable packet filtering if necessary */ - net_os_set_packet_filter(dev, 0); - - g_bt->dhcp_done = false; - WL_TRACE_COEX(("%s: DHCP start, pm:%d changed to pm:%d\n", - __FUNCTION__, pm, pm_local)); - - } else if (strnicmp((char *)&powermode_val, "0", strlen("0")) == 0) { - - dev_wlc_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm)); - - /* Enable packet filtering if was turned off */ - net_os_set_packet_filter(dev, 1); - - g_bt->dhcp_done = true; - - } else { - WL_ERROR(("%s Unkwown yet power setting, ignored\n", - __FUNCTION__)); - } - - p += snprintf(p, MAX_WX_STRING, "OK"); - - wrqu->data.length = p - extra + 1; - - return error; -} -#endif - - -static bool btcoex_is_sco_active(struct net_device *dev) -{ - int ioc_res = 0; - bool res = false; - int temp = 0; - - ioc_res = dev_wlc_intvar_get_reg(dev, "btc_params", 4, &temp); - - if (ioc_res == 0) { - WL_TRACE_COEX(("%s: read btc_params[4] = %x\n", __FUNCTION__, temp)); - - if ((temp > 0xea0) && (temp < 0xed8)) { - WL_TRACE_COEX(("%s: BT SCO/eSCO is ACTIVE\n", __FUNCTION__)); - res = true; - } else { - WL_TRACE_COEX(("%s: BT SCO/eSCO is NOT detected\n", __FUNCTION__)); - } - } else { - WL_ERROR(("%s ioc read btc params error\n", __FUNCTION__)); - } - return res; -} - -#if defined(BT_DHCP_eSCO_FIX) - -static int set_btc_esco_params(struct net_device *dev, bool trump_sco) -{ - static bool saved_status = false; - - char buf_reg50va_dhcp_on[8] = { 50, 00, 00, 00, 0x22, 0x80, 0x00, 0x00 }; - char buf_reg51va_dhcp_on[8] = { 51, 00, 00, 00, 0x00, 0x00, 0x00, 0x00 }; - char buf_reg64va_dhcp_on[8] = { 64, 00, 00, 00, 0x00, 0x00, 0x00, 0x00 }; - char buf_reg65va_dhcp_on[8] = { 65, 00, 00, 00, 0x00, 0x00, 0x00, 0x00 }; - char buf_reg71va_dhcp_on[8] = { 71, 00, 00, 00, 0x00, 0x00, 0x00, 0x00 }; - - uint32 regaddr; - static uint32 saved_reg50; - static uint32 saved_reg51; - static uint32 saved_reg64; - static uint32 saved_reg65; - static uint32 saved_reg71; - - if (trump_sco) { - - WL_TRACE_COEX(("Do new SCO/eSCO coex algo {save & override} \n")); - - if ((!dev_wlc_intvar_get_reg(dev, "btc_params", 50, &saved_reg50)) && - (!dev_wlc_intvar_get_reg(dev, "btc_params", 51, &saved_reg51)) && - (!dev_wlc_intvar_get_reg(dev, "btc_params", 64, &saved_reg64)) && - (!dev_wlc_intvar_get_reg(dev, "btc_params", 65, &saved_reg65)) && - (!dev_wlc_intvar_get_reg(dev, "btc_params", 71, &saved_reg71))) { - - saved_status = TRUE; - WL_TRACE_COEX(("%s saved bt_params[50,51,64,65,71]:" - " 0x%x 0x%x 0x%x 0x%x 0x%x\n", - __FUNCTION__, saved_reg50, saved_reg51, - saved_reg64, saved_reg65, saved_reg71)); - - } else { - WL_ERROR((":%s: save btc_params failed\n", - __FUNCTION__)); - saved_status = false; - return -1; - } - - WL_TRACE_COEX(("override with [50,51,64,65,71]:" - " 0x%x 0x%x 0x%x 0x%x 0x%x\n", - *(u32 *)(buf_reg50va_dhcp_on+4), - *(u32 *)(buf_reg51va_dhcp_on+4), - *(u32 *)(buf_reg64va_dhcp_on+4), - *(u32 *)(buf_reg65va_dhcp_on+4), - *(u32 *)(buf_reg71va_dhcp_on+4))); - - dev_wlc_bufvar_set(dev, "btc_params", (char *)&buf_reg50va_dhcp_on[0], 8); - dev_wlc_bufvar_set(dev, "btc_params", (char *)&buf_reg51va_dhcp_on[0], 8); - dev_wlc_bufvar_set(dev, "btc_params", (char *)&buf_reg64va_dhcp_on[0], 8); - dev_wlc_bufvar_set(dev, "btc_params", (char *)&buf_reg65va_dhcp_on[0], 8); - dev_wlc_bufvar_set(dev, "btc_params", (char *)&buf_reg71va_dhcp_on[0], 8); - - saved_status = true; - - } else if (saved_status) { - - WL_TRACE_COEX(("Do new SCO/eSCO coex algo {save & override} \n")); - - regaddr = 50; - dev_wlc_intvar_set_reg(dev, "btc_params", - (char *)®addr, (char *)&saved_reg50); - regaddr = 51; - dev_wlc_intvar_set_reg(dev, "btc_params", - (char *)®addr, (char *)&saved_reg51); - regaddr = 64; - dev_wlc_intvar_set_reg(dev, "btc_params", - (char *)®addr, (char *)&saved_reg64); - regaddr = 65; - dev_wlc_intvar_set_reg(dev, "btc_params", - (char *)®addr, (char *)&saved_reg65); - regaddr = 71; - dev_wlc_intvar_set_reg(dev, "btc_params", - (char *)®addr, (char *)&saved_reg71); - - WL_TRACE_COEX(("restore bt_params[50,51,64,65,71]: 0x%x 0x%x 0x%x 0x%x 0x%x\n", - saved_reg50, saved_reg51, saved_reg64, - saved_reg65, saved_reg71)); - - saved_status = false; - } else { - WL_ERROR((":%s att to restore not saved BTCOEX params\n", - __FUNCTION__)); - return -1; - } - return 0; -} -#endif - -static int -wl_iw_get_power_mode( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int error; - char *p = extra; - int pm_local = PM_FAST; - - error = dev_wlc_ioctl(dev, WLC_GET_PM, &pm_local, sizeof(pm_local)); - if (!error) { - WL_TRACE(("%s: Powermode = %d\n", __func__, pm_local)); - if (pm_local == PM_OFF) - pm_local = 1; /* Active */ - else - pm_local = 0; /* Auto */ - p += snprintf(p, MAX_WX_STRING, "powermode = %d", pm_local); - } - else { - WL_TRACE(("%s: Error = %d\n", __func__, error)); - p += snprintf(p, MAX_WX_STRING, "FAIL"); - } - wrqu->data.length = p - extra + 1; - return error; -} - -static int -wl_iw_set_btcoex_dhcp( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int error = 0; - char *p = extra; -#ifndef CUSTOMER_HW2 - static int pm = PM_FAST; - int pm_local = PM_OFF; -#endif - char powermode_val = 0; - char buf_reg66va_dhcp_on[8] = { 66, 00, 00, 00, 0x10, 0x27, 0x00, 0x00 }; - char buf_reg41va_dhcp_on[8] = { 41, 00, 00, 00, 0x33, 0x00, 0x00, 0x00 }; - char buf_reg68va_dhcp_on[8] = { 68, 00, 00, 00, 0x90, 0x01, 0x00, 0x00 }; - - uint32 regaddr; - static uint32 saved_reg66; - static uint32 saved_reg41; - static uint32 saved_reg68; - static bool saved_status = FALSE; - - char buf_flag7_default[8] = { 7, 00, 00, 00, 0x0, 0x00, 0x00, 0x00}; - -#ifdef CUSTOMER_HW2 - strncpy((char *)&powermode_val, extra + strlen("BTCOEXMODE") + 1, 1); -#else - strncpy((char *)&powermode_val, extra + strlen("POWERMODE") + 1, 1); -#endif - - if (strnicmp((char *)&powermode_val, "1", strlen("1")) == 0) { - - WL_TRACE_COEX(("%s: DHCP session start, cmd:%s\n", __FUNCTION__, extra)); - - if ((saved_status == FALSE) && -#ifndef CUSTOMER_HW2 - (!dev_wlc_ioctl(dev, WLC_GET_PM, &pm, sizeof(pm))) && -#endif - (!dev_wlc_intvar_get_reg(dev, "btc_params", 66, &saved_reg66)) && - (!dev_wlc_intvar_get_reg(dev, "btc_params", 41, &saved_reg41)) && - (!dev_wlc_intvar_get_reg(dev, "btc_params", 68, &saved_reg68))) { - WL_TRACE_COEX(("save regs {66,41,68} ->: 0x%x 0x%x 0x%x\n", \ - saved_reg66, saved_reg41, saved_reg68)); - -#ifndef CUSTOMER_HW2 - dev_wlc_ioctl(dev, WLC_SET_PM, &pm_local, sizeof(pm_local)); -#endif - - if (btcoex_is_sco_active(dev)) { - - dev_wlc_bufvar_set(dev, "btc_params", \ - (char *)&buf_reg66va_dhcp_on[0], \ - sizeof(buf_reg66va_dhcp_on)); - - dev_wlc_bufvar_set(dev, "btc_params", \ - (char *)&buf_reg41va_dhcp_on[0], \ - sizeof(buf_reg41va_dhcp_on)); - - dev_wlc_bufvar_set(dev, "btc_params", \ - (char *)&buf_reg68va_dhcp_on[0], \ - sizeof(buf_reg68va_dhcp_on)); - saved_status = TRUE; - - g_bt->bt_state = BT_DHCP_START; - g_bt->timer_on = 1; - mod_timer(&g_bt->timer, g_bt->timer.expires); - WL_TRACE_COEX(("%s enable BT DHCP Timer\n", \ - __FUNCTION__)); - } - } - else if (saved_status == TRUE) { - WL_ERROR(("%s was called w/o DHCP OFF. Continue\n", __FUNCTION__)); - } - } -#ifdef CUSTOMER_HW2 - else if (strnicmp((char *)&powermode_val, "2", strlen("2")) == 0) { -#else - else if (strnicmp((char *)&powermode_val, "0", strlen("0")) == 0) { -#endif - -#ifndef CUSTOMER_HW2 - dev_wlc_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm)); -#endif - - WL_TRACE_COEX(("%s disable BT DHCP Timer\n", __FUNCTION__)); - if (g_bt->timer_on) { - g_bt->timer_on = 0; - del_timer_sync(&g_bt->timer); - - if (g_bt->bt_state != BT_DHCP_IDLE) { - WL_TRACE_COEX(("%s bt->bt_state:%d\n", - __FUNCTION__, g_bt->bt_state)); - - up(&g_bt->bt_sem); - } - } - - if (saved_status == TRUE) { - dev_wlc_bufvar_set(dev, "btc_flags", \ - (char *)&buf_flag7_default[0], sizeof(buf_flag7_default)); - - regaddr = 66; - dev_wlc_intvar_set_reg(dev, "btc_params", \ - (char *)®addr, (char *)&saved_reg66); - regaddr = 41; - dev_wlc_intvar_set_reg(dev, "btc_params", \ - (char *)®addr, (char *)&saved_reg41); - regaddr = 68; - dev_wlc_intvar_set_reg(dev, "btc_params", \ - (char *)®addr, (char *)&saved_reg68); - - WL_TRACE_COEX(("restore regs {66,41,68} <- 0x%x 0x%x 0x%x\n", \ - saved_reg66, saved_reg41, saved_reg68)); - } - saved_status = FALSE; - } - else { - WL_ERROR(("%s Unkwown yet power setting, ignored\n", - __FUNCTION__)); - } - - p += snprintf(p, MAX_WX_STRING, "OK"); - - wrqu->data.length = p - extra + 1; - - return error; -} - -static int -wl_iw_set_suspend( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int suspend_flag; - int ret_now; - int ret = 0; - - suspend_flag = *(extra + strlen(SETSUSPEND_CMD) + 1) - '0'; - - if (suspend_flag != 0) - suspend_flag = 1; - - ret_now = net_os_set_suspend_disable(dev, suspend_flag); - - if (ret_now != suspend_flag) { - if (!(ret = net_os_set_suspend(dev, ret_now))) - WL_ERROR(("%s: Suspend Flag %d -> %d\n", \ - __FUNCTION__, ret_now, suspend_flag)); - else - WL_ERROR(("%s: failed %d\n", __FUNCTION__, ret)); - } - - return ret; -} - -#ifdef CONFIG_US_NON_DFS_CHANNELS_ONLY -static int -wl_iw_set_dfs_channels( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - use_non_dfs_channels = *(extra + strlen(SETDFSCHANNELS_CMD) + 1) - '0'; - use_non_dfs_channels = (use_non_dfs_channels != 0) ? false : true; - wl_iw_set_country_code(dev, NULL); - return 0; -} -#endif - -int -wl_format_ssid(char* ssid_buf, uint8* ssid, int ssid_len) -{ - int i, c; - char *p = ssid_buf; - - if (ssid_len > 32) ssid_len = 32; - - for (i = 0; i < ssid_len; i++) { - c = (int)ssid[i]; - if (c == '\\') { - *p++ = '\\'; - *p++ = '\\'; - } else if (isprint((uchar)c)) { - *p++ = (char)c; - } else { - p += sprintf(p, "\\x%02X", c); - } - } - *p = '\0'; - - return p - ssid_buf; -} - -static int -wl_iw_get_link_speed( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int error = 0; - char *p = extra; - static int link_speed; - - net_os_wake_lock(dev); - if (g_onoff == G_WLAN_SET_ON) { - error = dev_wlc_ioctl(dev, WLC_GET_RATE, &link_speed, sizeof(link_speed)); - link_speed *= 500000; - } - - p += snprintf(p, MAX_WX_STRING, "LinkSpeed %d", link_speed/1000000); - - wrqu->data.length = p - extra + 1; - - net_os_wake_unlock(dev); - return error; -} - - -static int -wl_iw_get_dtim_skip( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int error = -1; - char *p = extra; - char iovbuf[32]; - - net_os_wake_lock(dev); - if (g_onoff == G_WLAN_SET_ON) { - - memset(iovbuf, 0, sizeof(iovbuf)); - strcpy(iovbuf, "bcn_li_dtim"); - - if ((error = dev_wlc_ioctl(dev, WLC_GET_VAR, - &iovbuf, sizeof(iovbuf))) >= 0) { - - p += snprintf(p, MAX_WX_STRING, "Dtim_skip %d", iovbuf[0]); - WL_TRACE(("%s: get dtim_skip = %d\n", __FUNCTION__, iovbuf[0])); - wrqu->data.length = p - extra + 1; - } - else - WL_ERROR(("%s: get dtim_skip failed code %d\n", \ - __FUNCTION__, error)); - } - net_os_wake_unlock(dev); - return error; -} - - -static int -wl_iw_set_dtim_skip( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int error = -1; - char *p = extra; - int bcn_li_dtim; - char iovbuf[32]; - - net_os_wake_lock(dev); - if (g_onoff == G_WLAN_SET_ON) { - - bcn_li_dtim = htod32((uint)*(extra + strlen(DTIM_SKIP_SET_CMD) + 1) - '0'); - - if ((bcn_li_dtim >= 0) || ((bcn_li_dtim <= 5))) { - - memset(iovbuf, 0, sizeof(iovbuf)); - bcm_mkiovar("bcn_li_dtim", (char *)&bcn_li_dtim, - 4, iovbuf, sizeof(iovbuf)); - - if ((error = dev_wlc_ioctl(dev, WLC_SET_VAR, - &iovbuf, sizeof(iovbuf))) >= 0) { - p += snprintf(p, MAX_WX_STRING, "OK"); - - net_os_set_dtim_skip(dev, bcn_li_dtim); - - WL_TRACE(("%s: set dtim_skip %d OK\n", __FUNCTION__, \ - bcn_li_dtim)); - goto exit; - } - else WL_ERROR(("%s: set dtim_skip %d failed code %d\n", \ - __FUNCTION__, bcn_li_dtim, error)); - } - else WL_ERROR(("%s Incorrect dtim_skip setting %d, ignored\n", \ - __FUNCTION__, bcn_li_dtim)); - } - - p += snprintf(p, MAX_WX_STRING, "FAIL"); - -exit: - wrqu->data.length = p - extra + 1; - net_os_wake_unlock(dev); - return error; -} - - -static int -wl_iw_get_band( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int error = -1; - char *p = extra; - static int band; - - net_os_wake_lock(dev); - - if (g_onoff == G_WLAN_SET_ON) { - error = dev_wlc_ioctl(dev, WLC_GET_BAND, &band, sizeof(band)); - - p += snprintf(p, MAX_WX_STRING, "Band %d", band); - - wrqu->data.length = p - extra + 1; - } - - net_os_wake_unlock(dev); - return error; -} - - -static int -wl_iw_set_band( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int error = -1; - char *p = extra; - uint band; - - net_os_wake_lock(dev); - - if (g_onoff == G_WLAN_SET_ON) { - - band = htod32((uint)*(extra + strlen(BAND_SET_CMD) + 1) - '0'); - - if ((band == WLC_BAND_AUTO) || (band == WLC_BAND_5G) || (band == WLC_BAND_2G)) { - - if ((error = dev_wlc_ioctl(dev, WLC_SET_BAND, - &band, sizeof(band))) >= 0) { - p += snprintf(p, MAX_WX_STRING, "OK"); - WL_TRACE(("%s: set band %d OK\n", __FUNCTION__, band)); - goto exit; - } - else WL_ERROR(("%s: set band %d failed code %d\n", __FUNCTION__, \ - band, error)); - } - else WL_ERROR(("%s Incorrect band setting %d, ignored\n", __FUNCTION__, band)); - } - - p += snprintf(p, MAX_WX_STRING, "FAIL"); - -exit: - wrqu->data.length = p - extra + 1; - net_os_wake_unlock(dev); - return error; -} - -#ifdef PNO_SUPPORT - -static int -wl_iw_set_pno_reset( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int error = -1; - char *p = extra; - - net_os_wake_lock(dev); - if ((g_onoff == G_WLAN_SET_ON) && (dev != NULL)) { - - if ((error = dhd_dev_pno_reset(dev)) >= 0) { - p += snprintf(p, MAX_WX_STRING, "OK"); - WL_TRACE(("%s: set OK\n", __FUNCTION__)); - goto exit; - } - else WL_ERROR(("%s: failed code %d\n", __FUNCTION__, error)); - } - - p += snprintf(p, MAX_WX_STRING, "FAIL"); - -exit: - wrqu->data.length = p - extra + 1; - net_os_wake_unlock(dev); - return error; -} - - - -static int -wl_iw_set_pno_enable( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int error = -1; - char *p = extra; - int pfn_enabled; - - net_os_wake_lock(dev); - pfn_enabled = htod32((uint)*(extra + strlen(PNOENABLE_SET_CMD) + 1) - '0'); - - if ((g_onoff == G_WLAN_SET_ON) && (dev != NULL)) { - - if ((error = dhd_dev_pno_enable(dev, pfn_enabled)) >= 0) { - p += snprintf(p, MAX_WX_STRING, "OK"); - WL_TRACE(("%s: set OK\n", __FUNCTION__)); - goto exit; - } - else WL_ERROR(("%s: failed code %d\n", __FUNCTION__, error)); - } - - p += snprintf(p, MAX_WX_STRING, "FAIL"); - -exit: - wrqu->data.length = p - extra + 1; - net_os_wake_unlock(dev); - return error; -} - - - -static int -wl_iw_set_pno_set( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int res = -1; - wlc_ssid_t ssids_local[MAX_PFN_LIST_COUNT]; - int nssid = 0; - cmd_tlv_t *cmd_tlv_temp; - char *str_ptr; - char *str_ptr_end; - int tlv_size_left; - int pno_time; - -#ifdef PNO_SET_DEBUG - int i; - char pno_in_example[] = {'P', 'N', 'O', 'S', 'E', 'T', 'U', 'P', ' ', \ - 'S', '1', '2', '0', - 'S', - 0x04, - 'B', 'R', 'C', 'M', - 'S', - 0x04, - 'G', 'O', 'O', 'G', - 'T', - '1','E', - 0x00 - }; -#endif - - net_os_wake_lock(dev); - WL_ERROR(("\n### %s: info->cmd:%x, info->flags:%x, u.data=0x%p, u.len=%d\n", - __FUNCTION__, info->cmd, info->flags, - wrqu->data.pointer, wrqu->data.length)); - - if (g_onoff == G_WLAN_SET_OFF) { - WL_TRACE(("%s: driver is not up yet after START\n", __FUNCTION__)); - goto exit_proc; - } - - if (wrqu->data.length < (strlen(PNOSETUP_SET_CMD) + sizeof(cmd_tlv_t))) { - WL_ERROR(("%s aggument=%d less %d\n", __FUNCTION__, \ - wrqu->data.length, strlen(PNOSETUP_SET_CMD) + sizeof(cmd_tlv_t))); - goto exit_proc; - } - -#ifdef PNO_SET_DEBUG - if (!(extra = kmalloc(sizeof(pno_in_example) +100, GFP_KERNEL))) { - res = -ENOMEM; - goto exit_proc; - } - memcpy(extra, pno_in_example, sizeof(pno_in_example)); - wrqu->data.length = sizeof(pno_in_example); - for (i = 0; i < wrqu->data.length; i++) - printf("%02X ", extra[i]); - printf("\n"); -#endif - - str_ptr = extra; -#ifdef PNO_SET_DEBUG - str_ptr += strlen("PNOSETUP "); - tlv_size_left = wrqu->data.length - strlen("PNOSETUP "); -#else - str_ptr += strlen(PNOSETUP_SET_CMD); - tlv_size_left = wrqu->data.length - strlen(PNOSETUP_SET_CMD); -#endif - - cmd_tlv_temp = (cmd_tlv_t *)str_ptr; - memset(ssids_local, 0, sizeof(ssids_local)); - - if ((cmd_tlv_temp->prefix == PNO_TLV_PREFIX) && \ - (cmd_tlv_temp->version == PNO_TLV_VERSION) && \ - (cmd_tlv_temp->subver == PNO_TLV_SUBVERSION)) - { - str_ptr += sizeof(cmd_tlv_t); - tlv_size_left -= sizeof(cmd_tlv_t); - - if ((nssid = wl_iw_parse_ssid_list_tlv(&str_ptr, ssids_local, \ - MAX_PFN_LIST_COUNT, &tlv_size_left)) <= 0) { - WL_ERROR(("SSID is not presented or corrupted ret=%d\n", nssid)); - goto exit_proc; - } - else { - if ((str_ptr[0] != PNO_TLV_TYPE_TIME) || (tlv_size_left <= 1)) { - WL_ERROR(("%s scan duration corrupted field size %d\n", \ - __FUNCTION__, tlv_size_left)); - goto exit_proc; - } - str_ptr++; - pno_time = simple_strtoul(str_ptr, &str_ptr_end, 16); - WL_ERROR((" got %d bytes left pno_time %d or %#x\n", \ - tlv_size_left, pno_time, pno_time)); - } - } - else { - WL_ERROR(("%s get wrong TLV command\n", __FUNCTION__)); - goto exit_proc; - } - - res = dhd_dev_pno_set(dev, ssids_local, nssid, pno_time); - -exit_proc: - net_os_wake_unlock(dev); - return res; -} -#endif - -static int -wl_iw_get_rssi( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - static int rssi = 0; - static wlc_ssid_t ssid = {0}; - int error = 0; - char *p = extra; - static char ssidbuf[SSID_FMT_BUF_LEN]; - scb_val_t scb_val; - - net_os_wake_lock(dev); - - bzero(&scb_val, sizeof(scb_val_t)); - - if (g_onoff == G_WLAN_SET_ON) { - error = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t)); - if (error) { - WL_ERROR(("%s: Fails %d\n", __FUNCTION__, error)); - } else { - rssi = dtoh32(scb_val.val); - - error = dev_wlc_ioctl(dev, WLC_GET_SSID, &ssid, sizeof(ssid)); - if (!error) { - ssid.SSID_len = dtoh32(ssid.SSID_len); - wl_format_ssid(ssidbuf, ssid.SSID, dtoh32(ssid.SSID_len)); - } - } - } - - WL_ASSOC(("%s ssid_len:%d, rssi:%d\n", __FUNCTION__, ssid.SSID_len, rssi)); - - if (error || (ssid.SSID_len == 0)) { - p += snprintf(p, MAX_WX_STRING, "FAIL"); - } else { - p += snprintf(p, MAX_WX_STRING, "%s rssi %d ", ssidbuf, rssi); - } - wrqu->data.length = p - extra + 1; - - net_os_wake_unlock(dev); - return error; -} - -int -wl_iw_send_priv_event( - struct net_device *dev, - char *flag -) -{ - union iwreq_data wrqu; - char extra[IW_CUSTOM_MAX + 1]; - int cmd; - - cmd = IWEVCUSTOM; - memset(&wrqu, 0, sizeof(wrqu)); - if (strlen(flag) > sizeof(extra)) - return -1; - - strcpy(extra, flag); - wrqu.data.length = strlen(extra); - wireless_send_event(dev, cmd, &wrqu, extra); - net_os_wake_lock_timeout_enable(dev); - WL_TRACE(("Send IWEVCUSTOM Event as %s\n", extra)); - - return 0; -} - - -int -wl_control_wl_start(struct net_device *dev) -{ - int ret = 0; - wl_iw_t *iw; - - WL_TRACE(("Enter %s \n", __FUNCTION__)); - - if (!dev) { - WL_ERROR(("%s: dev is null\n", __FUNCTION__)); - return -1; - } - - iw = *(wl_iw_t **)netdev_priv(dev); - - if (!iw) { - WL_ERROR(("%s: wl is null\n", __FUNCTION__)); - return -1; - } - dhd_os_start_lock(iw->pub); - - if (g_onoff == G_WLAN_SET_OFF) { - dhd_customer_gpio_wlan_ctrl(WLAN_RESET_ON); - -#if defined(BCMLXSDMMC) - sdioh_start(NULL, 0); -#endif - - ret = dhd_dev_reset(dev, 0); - - if (ret == BCME_OK) { -#if defined(BCMLXSDMMC) - sdioh_start(NULL, 1); -#endif - dhd_dev_init_ioctl(dev); - g_onoff = G_WLAN_SET_ON; - } - } - WL_TRACE(("Exited %s \n", __FUNCTION__)); - - dhd_os_start_unlock(iw->pub); - return ret; -} - - -static int -wl_iw_control_wl_off( - struct net_device *dev, - struct iw_request_info *info -) -{ - int ret = 0; - wl_iw_t *iw; - - WL_TRACE(("Enter %s\n", __FUNCTION__)); - - if (!dev) { - WL_ERROR(("%s: dev is null\n", __FUNCTION__)); - return -1; - } - - iw = *(wl_iw_t **)netdev_priv(dev); - if (!iw) { - WL_ERROR(("%s: dev is null\n", __FUNCTION__)); - return -1; - } - dhd_os_start_lock(iw->pub); - -#ifdef SOFTAP - ap_cfg_running = FALSE; -#endif - - if (g_onoff == G_WLAN_SET_ON) { - g_onoff = G_WLAN_SET_OFF; -#if defined(WL_IW_USE_ISCAN) - g_iscan->iscan_state = ISCAN_STATE_IDLE; -#endif - - dhd_dev_reset(dev, 1); - -#if defined(WL_IW_USE_ISCAN) -#if !defined(CSCAN) - wl_iw_free_ss_cache(); - wl_iw_run_ss_cache_timer(0); - - g_ss_cache_ctrl.m_link_down = 1; -#endif - memset(g_scan, 0, G_SCAN_RESULTS); - g_scan_specified_ssid = 0; -#if defined(CONFIG_FIRST_SCAN) - g_first_broadcast_scan = BROADCAST_SCAN_FIRST_IDLE; - g_first_counter_scans = 0; -#endif -#endif - -#if defined(BCMLXSDMMC) - sdioh_stop(NULL); -#endif - - net_os_set_dtim_skip(dev, 0); - - dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF); - - wl_iw_send_priv_event(dev, "STOP"); - } - - dhd_os_start_unlock(iw->pub); - - WL_TRACE(("Exited %s\n", __FUNCTION__)); - - return ret; -} - -static int -wl_iw_control_wl_on( - struct net_device *dev, - struct iw_request_info *info -) -{ - int ret = 0; - - WL_TRACE(("Enter %s \n", __FUNCTION__)); - - if ((ret = wl_control_wl_start(dev)) != BCME_OK) { - WL_ERROR(("%s failed first attemp\n", __FUNCTION__)); - dhd_customer_gpio_wlan_ctrl(WLAN_RESET_OFF); - if ((ret = wl_control_wl_start(dev)) != BCME_OK) { - WL_ERROR(("%s failed second attemp\n", __FUNCTION__)); - net_os_send_hang_message(dev); - return ret; - } - } - - wl_iw_send_priv_event(dev, "START"); - -#ifdef SOFTAP - if (!ap_fw_loaded) { - wl_iw_iscan_set_scan_broadcast_prep(dev, 0); - } -#else - wl_iw_iscan_set_scan_broadcast_prep(dev, 0); -#endif - - WL_TRACE(("Exited %s \n", __FUNCTION__)); - - return ret; -} - -#ifdef SOFTAP -static struct ap_profile my_ap; -static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap); -static int get_assoc_sta_list(struct net_device *dev, char *buf, int len); -static int set_ap_mac_list(struct net_device *dev, void *buf); - -#define PTYPE_STRING 0 -#define PTYPE_INTDEC 1 -#define PTYPE_INTHEX 2 -#define PTYPE_STR_HEX 3 -int get_parmeter_from_string( - char **str_ptr, const char *token, int param_type, void *dst, int param_max_len); - -#endif - -int hex2num(char c) -{ - if (c >= '0' && c <= '9') - return c - '0'; - if (c >= 'a' && c <= 'f') - return c - 'a' + 10; - if (c >= 'A' && c <= 'F') - return c - 'A' + 10; - return -1; -} - -int hex2byte(const char *hex) -{ - int a, b; - a = hex2num(*hex++); - if (a < 0) - return -1; - b = hex2num(*hex++); - if (b < 0) - return -1; - return (a << 4) | b; -} - - - -int hstr_2_buf(const char *txt, u8 *buf, int len) -{ - int i; - - for (i = 0; i < len; i++) { - int a, b; - - a = hex2num(*txt++); - if (a < 0) - return -1; - b = hex2num(*txt++); - if (b < 0) - return -1; - *buf++ = (a << 4) | b; - } - - return 0; -} - -#ifdef SOFTAP -int init_ap_profile_from_string(char *param_str, struct ap_profile *ap_cfg) -{ - char *str_ptr = param_str; - char sub_cmd[16]; - int ret = 0; - - memset(sub_cmd, 0, sizeof(sub_cmd)); - memset(ap_cfg, 0, sizeof(struct ap_profile)); - - if (get_parmeter_from_string(&str_ptr, "ASCII_CMD=", - PTYPE_STRING, sub_cmd, SSID_LEN) != 0) { - return -1; - } - if (strncmp(sub_cmd, "AP_CFG", 6)) { - WL_ERROR(("ERROR: sub_cmd:%s != 'AP_CFG'!\n", sub_cmd)); - return -1; - } - - ret = get_parmeter_from_string(&str_ptr, "SSID=", PTYPE_STRING, ap_cfg->ssid, SSID_LEN); - - ret |= get_parmeter_from_string(&str_ptr, "SEC=", PTYPE_STRING, ap_cfg->sec, SEC_LEN); - - ret |= get_parmeter_from_string(&str_ptr, "KEY=", PTYPE_STRING, ap_cfg->key, KEY_LEN); - - ret |= get_parmeter_from_string(&str_ptr, "CHANNEL=", PTYPE_INTDEC, &ap_cfg->channel, 5); - - get_parmeter_from_string(&str_ptr, "PREAMBLE=", PTYPE_INTDEC, &ap_cfg->preamble, 5); - - get_parmeter_from_string(&str_ptr, "MAX_SCB=", PTYPE_INTDEC, &ap_cfg->max_scb, 5); - - get_parmeter_from_string(&str_ptr, "HIDDEN=", PTYPE_INTDEC, &ap_cfg->closednet, 5); - - get_parmeter_from_string(&str_ptr, "COUNTRY=", PTYPE_STRING, &ap_cfg->country_code, 3); - - return ret; -} -#endif - - -#ifdef SOFTAP -static int iwpriv_set_ap_config(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *ext) -{ - int res = 0; - char *extra = NULL; - struct ap_profile *ap_cfg = &my_ap; - - WL_TRACE(("%s: info->cmd:%x, info->flags:%x, u.data:%p, u.len:%d\n", - __FUNCTION__, - info->cmd, info->flags, - wrqu->data.pointer, wrqu->data.length)); - - if (wrqu->data.length != 0) { - - char *str_ptr; - - if (!(extra = kmalloc(wrqu->data.length+1, GFP_KERNEL))) - return -ENOMEM; - - if (copy_from_user(extra, wrqu->data.pointer, wrqu->data.length)) { - kfree(extra); - return -EFAULT; - } - - extra[wrqu->data.length] = 0; - WL_SOFTAP((" Got str param in iw_point:\n %s\n", extra)); - - memset(ap_cfg, 0, sizeof(struct ap_profile)); - - str_ptr = extra; - - if ((res = init_ap_profile_from_string(extra, ap_cfg)) < 0) { - WL_ERROR(("%s failed to parse %d\n", __FUNCTION__, res)); - kfree(extra); - return -1; - } - - } else { - WL_ERROR(("IWPRIV argument len = 0 \n")); - return -1; - } - - if ((res = set_ap_cfg(dev, ap_cfg)) < 0) - WL_ERROR(("%s failed to set_ap_cfg %d\n", __FUNCTION__, res)); - - kfree(extra); - - return res; -} -#endif - - -#ifdef SOFTAP -static int iwpriv_get_assoc_list(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *p_iwrq, - char *extra) -{ - int i, ret = 0; - char mac_buf[256]; - struct maclist *sta_maclist = (struct maclist *)mac_buf; - - char mac_lst[384]; - char *p_mac_str; - char *p_mac_str_end; - - if ((!dev) || (!extra)) { - return -EINVAL; - } - - net_os_wake_lock(dev); - - WL_TRACE(("\n %s: IWPRIV IOCTL: cmd:%hx, flags:%hx, extra:%p, iwp.len:%d, \ - iwp.len:%p, iwp.flags:%x \n", __FUNCTION__, info->cmd, info->flags, \ - extra, p_iwrq->data.length, p_iwrq->data.pointer, p_iwrq->data.flags)); - - memset(sta_maclist, 0, sizeof(mac_buf)); - - sta_maclist->count = 8; - - WL_SOFTAP(("%s: net device:%s, buf_sz:%d\n", - __FUNCTION__, dev->name, sizeof(mac_buf))); - - if ((ret = get_assoc_sta_list(dev, mac_buf, sizeof(mac_buf))) < 0) { - WL_ERROR(("%s: sta list ioctl error:%d\n", - __FUNCTION__, ret)); - goto func_exit; - } - - WL_SOFTAP(("%s: got %d stations\n", __FUNCTION__, - sta_maclist->count)); - - memset(mac_lst, 0, sizeof(mac_lst)); - p_mac_str = mac_lst; - p_mac_str_end = &mac_lst[sizeof(mac_lst)-1]; - - for (i = 0; i < 8; i++) { - struct ether_addr *id = &sta_maclist->ea[i]; - if (!ETHER_ISNULLADDR(id->octet)) { - scb_val_t scb_val; - int rssi = 0; - - bzero(&scb_val, sizeof(scb_val_t)); - - if ((p_mac_str_end - p_mac_str) <= 36) { - WL_ERROR(("%s: mac list buf is < 36 for item[%i] item\n", - __FUNCTION__, i)); - break; - } - - p_mac_str += snprintf(p_mac_str, MAX_WX_STRING, - "\nMac[%d]=%02X:%02X:%02X:%02X:%02X:%02X,", i, - id->octet[0], id->octet[1], id->octet[2], - id->octet[3], id->octet[4], id->octet[5]); - - bcopy(id->octet, &scb_val.ea, 6); - ret = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t)); - if (ret < 0) { - snprintf(p_mac_str, MAX_WX_STRING, "RSSI:ERR"); - WL_ERROR(("%s: RSSI ioctl error:%d\n", - __FUNCTION__, ret)); - break; - } - - rssi = dtoh32(scb_val.val); - p_mac_str += snprintf(p_mac_str, MAX_WX_STRING, - "RSSI:%d", rssi); - } - } - - p_iwrq->data.length = strlen(mac_lst) + 1; - - WL_SOFTAP(("%s: data to user:\n%s\n usr_ptr:%p\n", __FUNCTION__, - mac_lst, p_iwrq->data.pointer)); - - if (p_iwrq->data.length) { - bcopy(mac_lst, extra, p_iwrq->data.length); - } - -func_exit: - net_os_wake_unlock(dev); - - WL_TRACE(("Exited %s \n", __FUNCTION__)); - return ret; -} -#endif - - -#ifdef SOFTAP -#define MAC_FILT_MAX 8 -static int iwpriv_set_mac_filters(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *ext) -{ - int i, ret = -1; - char * extra = NULL; - int mac_cnt = 0; - int mac_mode = 0; - struct ether_addr *p_ea; - struct mac_list_set mflist_set; - - WL_SOFTAP((">>> Got IWPRIV SET_MAC_FILTER IOCTL: info->cmd:%x, \ - info->flags:%x, u.data:%p, u.len:%d\n", - info->cmd, info->flags, - wrqu->data.pointer, wrqu->data.length)); - - if (wrqu->data.length != 0) { - - char *str_ptr; - - if (!(extra = kmalloc(wrqu->data.length+1, GFP_KERNEL))) - return -ENOMEM; - - if (copy_from_user(extra, wrqu->data.pointer, wrqu->data.length)) { - kfree(extra); - return -EFAULT; - } - - extra[wrqu->data.length] = 0; - WL_SOFTAP((" Got parameter string in iw_point:\n %s \n", extra)); - - memset(&mflist_set, 0, sizeof(mflist_set)); - - str_ptr = extra; - - if (get_parmeter_from_string(&str_ptr, "MAC_MODE=", - PTYPE_INTDEC, &mac_mode, 4) != 0) { - WL_ERROR(("ERROR: 'MAC_MODE=' token is missing\n")); - goto exit_proc; - } - - p_ea = &mflist_set.mac_list.ea[0]; - - if (get_parmeter_from_string(&str_ptr, "MAC_CNT=", - PTYPE_INTDEC, &mac_cnt, 4) != 0) { - WL_ERROR(("ERROR: 'MAC_CNT=' token param is missing \n")); - goto exit_proc; - } - - if (mac_cnt > MAC_FILT_MAX) { - WL_ERROR(("ERROR: number of MAC filters > MAX\n")); - goto exit_proc; - } - - for (i=0; i < mac_cnt; i++) - if (get_parmeter_from_string(&str_ptr, "MAC=", - PTYPE_STR_HEX, &p_ea[i], 12) != 0) { - WL_ERROR(("ERROR: MAC_filter[%d] is missing !\n", i)); - goto exit_proc; - } - - WL_SOFTAP(("MAC_MODE=:%d, MAC_CNT=%d, MACs:..\n", mac_mode, mac_cnt)); - for (i = 0; i < mac_cnt; i++) { - WL_SOFTAP(("mac_filt[%d]:", i)); - print_buf(&p_ea[i], 6, 0); - } - - mflist_set.mode = mac_mode; - mflist_set.mac_list.count = mac_cnt; - set_ap_mac_list(dev, &mflist_set); - - wrqu->data.pointer = NULL; - wrqu->data.length = 0; - ret = 0; - - } else { - WL_ERROR(("IWPRIV argument len is 0\n")); - return -1; - } - - exit_proc: - kfree(extra); - return ret; -} -#endif - - -#ifdef SOFTAP -static int iwpriv_set_ap_sta_disassoc(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *ext) -{ - int res = 0; - char sta_mac[6] = {0, 0, 0, 0, 0, 0}; - char cmd_buf[256]; - char *str_ptr = cmd_buf; - - WL_SOFTAP((">>%s called\n args: info->cmd:%x," - " info->flags:%x, u.data.p:%p, u.data.len:%d\n", - __FUNCTION__, info->cmd, info->flags, - wrqu->data.pointer, wrqu->data.length)); - - if (wrqu->data.length != 0) { - - if (copy_from_user(cmd_buf, wrqu->data.pointer, wrqu->data.length)) { - return -EFAULT; - } - - if (get_parmeter_from_string(&str_ptr, - "MAC=", PTYPE_STR_HEX, sta_mac, 12) == 0) { - res = wl_iw_softap_deassoc_stations(dev, sta_mac); - } else { - WL_ERROR(("ERROR: STA_MAC= token not found\n")); - } - } - - return res; -} -#endif - -#endif - - -#if WIRELESS_EXT < 13 -struct iw_request_info -{ - __u16 cmd; - __u16 flags; -}; - -typedef int (*iw_handler)(struct net_device *dev, - struct iw_request_info *info, - void *wrqu, - char *extra); -#endif - -static int -wl_iw_config_commit( - struct net_device *dev, - struct iw_request_info *info, - void *zwrq, - char *extra -) -{ - wlc_ssid_t ssid; - int error; - struct sockaddr bssid; - - WL_TRACE(("%s: SIOCSIWCOMMIT\n", dev->name)); - - if ((error = dev_wlc_ioctl(dev, WLC_GET_SSID, &ssid, sizeof(ssid)))) - return error; - - ssid.SSID_len = dtoh32(ssid.SSID_len); - - if (!ssid.SSID_len) - return 0; - - bzero(&bssid, sizeof(struct sockaddr)); - if ((error = dev_wlc_ioctl(dev, WLC_REASSOC, &bssid, ETHER_ADDR_LEN))) { - WL_ERROR(("%s: WLC_REASSOC to %s failed \n", __FUNCTION__, ssid.SSID)); - return error; - } - - return 0; -} - -static int -wl_iw_get_name( - struct net_device *dev, - struct iw_request_info *info, - char *cwrq, - char *extra -) -{ - WL_TRACE(("%s: SIOCGIWNAME\n", dev->name)); - - strcpy(cwrq, "IEEE 802.11-DS"); - - return 0; -} - -static int -wl_iw_set_freq( - struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *fwrq, - char *extra -) -{ - int error, chan; - uint sf = 0; - - WL_TRACE(("%s %s: SIOCSIWFREQ\n", __FUNCTION__, dev->name)); - -#if defined(SOFTAP) - if (ap_cfg_running) { - WL_TRACE(("%s:>> not executed, 'SOFT_AP is active' \n", __FUNCTION__)); - return 0; - } -#endif - - - if (fwrq->e == 0 && fwrq->m < MAXCHANNEL) { - chan = fwrq->m; - } - - - else { - - if (fwrq->e >= 6) { - fwrq->e -= 6; - while (fwrq->e--) - fwrq->m *= 10; - } else if (fwrq->e < 6) { - while (fwrq->e++ < 6) - fwrq->m /= 10; - } - - if (fwrq->m > 4000 && fwrq->m < 5000) - sf = WF_CHAN_FACTOR_4_G; - - chan = wf_mhz2channel(fwrq->m, sf); - } - chan = htod32(chan); - if ((error = dev_wlc_ioctl(dev, WLC_SET_CHANNEL, &chan, sizeof(chan)))) - return error; - - g_wl_iw_params.target_channel = chan; - - return -EINPROGRESS; -} - -static int -wl_iw_get_freq( - struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *fwrq, - char *extra -) -{ - channel_info_t ci; - int error; - - WL_TRACE(("%s: SIOCGIWFREQ\n", dev->name)); - - if ((error = dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci)))) - return error; - - fwrq->m = dtoh32(ci.hw_channel); - fwrq->e = dtoh32(0); - return 0; -} - -static int -wl_iw_set_mode( - struct net_device *dev, - struct iw_request_info *info, - __u32 *uwrq, - char *extra -) -{ - int infra = 0, ap = 0, error = 0; - - WL_TRACE(("%s: SIOCSIWMODE\n", dev->name)); - - switch (*uwrq) { - case IW_MODE_MASTER: - infra = ap = 1; - break; - case IW_MODE_ADHOC: - case IW_MODE_AUTO: - break; - case IW_MODE_INFRA: - infra = 1; - break; - default: - return -EINVAL; - } - infra = htod32(infra); - ap = htod32(ap); - - if ((error = dev_wlc_ioctl(dev, WLC_SET_INFRA, &infra, sizeof(infra))) || - (error = dev_wlc_ioctl(dev, WLC_SET_AP, &ap, sizeof(ap)))) - return error; - - - return -EINPROGRESS; -} - -static int -wl_iw_get_mode( - struct net_device *dev, - struct iw_request_info *info, - __u32 *uwrq, - char *extra -) -{ - int error, infra = 0, ap = 0; - - WL_TRACE(("%s: SIOCGIWMODE\n", dev->name)); - - if ((error = dev_wlc_ioctl(dev, WLC_GET_INFRA, &infra, sizeof(infra))) || - (error = dev_wlc_ioctl(dev, WLC_GET_AP, &ap, sizeof(ap)))) - return error; - - infra = dtoh32(infra); - ap = dtoh32(ap); - *uwrq = infra ? ap ? IW_MODE_MASTER : IW_MODE_INFRA : IW_MODE_ADHOC; - - return 0; -} - -static int -wl_iw_get_range( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -) -{ - struct iw_range *range = (struct iw_range *) extra; - wl_uint32_list_t *list; - wl_rateset_t rateset; - int8 *channels; - int error, i, k; - uint sf, ch; - - int phytype; - int bw_cap = 0, sgi_tx = 0, nmode = 0; - channel_info_t ci; - uint8 nrate_list2copy = 0; - uint16 nrate_list[4][8] = { {13, 26, 39, 52, 78, 104, 117, 130}, - {14, 29, 43, 58, 87, 116, 130, 144}, - {27, 54, 81, 108, 162, 216, 243, 270}, - {30, 60, 90, 120, 180, 240, 270, 300}}; - - WL_TRACE(("%s: SIOCGIWRANGE\n", dev->name)); - - if (!extra) - return -EINVAL; - - channels = kmalloc((MAXCHANNEL+1)*4, GFP_KERNEL); - if (!channels) { - WL_ERROR(("Could not alloc channels\n")); - return -ENOMEM; - } - list = (wl_uint32_list_t *)channels; - - dwrq->length = sizeof(struct iw_range); - memset(range, 0, sizeof(range)); - - range->min_nwid = range->max_nwid = 0; - - list->count = htod32(MAXCHANNEL); - if ((error = dev_wlc_ioctl(dev, WLC_GET_VALID_CHANNELS, channels, (MAXCHANNEL+1)*4))) { - kfree(channels); - return error; - } - for (i = 0; i < dtoh32(list->count) && i < IW_MAX_FREQUENCIES; i++) { - range->freq[i].i = dtoh32(list->element[i]); - - ch = dtoh32(list->element[i]); - if (ch <= CH_MAX_2G_CHANNEL) - sf = WF_CHAN_FACTOR_2_4_G; - else - sf = WF_CHAN_FACTOR_5_G; - - range->freq[i].m = wf_channel2mhz(ch, sf); - range->freq[i].e = 6; - } - range->num_frequency = range->num_channels = i; - - range->max_qual.qual = 5; - - range->max_qual.level = 0x100 - 200; - - range->max_qual.noise = 0x100 - 200; - - range->sensitivity = 65535; - -#if WIRELESS_EXT > 11 - - range->avg_qual.qual = 3; - - range->avg_qual.level = 0x100 + WL_IW_RSSI_GOOD; - - range->avg_qual.noise = 0x100 - 75; -#endif - - if ((error = dev_wlc_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, sizeof(rateset)))) { - kfree(channels); - return error; - } - rateset.count = dtoh32(rateset.count); - range->num_bitrates = rateset.count; - for (i = 0; i < rateset.count && i < IW_MAX_BITRATES; i++) - range->bitrate[i] = (rateset.rates[i]& 0x7f) * 500000; - dev_wlc_intvar_get(dev, "nmode", &nmode); - dev_wlc_ioctl(dev, WLC_GET_PHYTYPE, &phytype, sizeof(phytype)); - - if (nmode == 1 && phytype == WLC_PHY_TYPE_SSN) { - dev_wlc_intvar_get(dev, "mimo_bw_cap", &bw_cap); - dev_wlc_intvar_get(dev, "sgi_tx", &sgi_tx); - dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(channel_info_t)); - ci.hw_channel = dtoh32(ci.hw_channel); - - if (bw_cap == 0 || - (bw_cap == 2 && ci.hw_channel <= 14)) { - if (sgi_tx == 0) - nrate_list2copy = 0; - else - nrate_list2copy = 1; - } - if (bw_cap == 1 || - (bw_cap == 2 && ci.hw_channel >= 36)) { - if (sgi_tx == 0) - nrate_list2copy = 2; - else - nrate_list2copy = 3; - } - range->num_bitrates += 8; - for (k = 0; i < range->num_bitrates; k++, i++) { - - range->bitrate[i] = (nrate_list[nrate_list2copy][k]) * 500000; - } - } - - if ((error = dev_wlc_ioctl(dev, WLC_GET_PHYTYPE, &i, sizeof(i)))) { - kfree(channels); - return error; - } - i = dtoh32(i); - if (i == WLC_PHY_TYPE_A) - range->throughput = 24000000; - else - range->throughput = 1500000; - - range->min_rts = 0; - range->max_rts = 2347; - range->min_frag = 256; - range->max_frag = 2346; - - range->max_encoding_tokens = DOT11_MAX_DEFAULT_KEYS; - range->num_encoding_sizes = 4; - range->encoding_size[0] = WEP1_KEY_SIZE; - range->encoding_size[1] = WEP128_KEY_SIZE; -#if WIRELESS_EXT > 17 - range->encoding_size[2] = TKIP_KEY_SIZE; -#else - range->encoding_size[2] = 0; -#endif - range->encoding_size[3] = AES_KEY_SIZE; - - range->min_pmp = 0; - range->max_pmp = 0; - range->min_pmt = 0; - range->max_pmt = 0; - range->pmp_flags = 0; - range->pm_capa = 0; - - range->num_txpower = 2; - range->txpower[0] = 1; - range->txpower[1] = 255; - range->txpower_capa = IW_TXPOW_MWATT; - -#if WIRELESS_EXT > 10 - range->we_version_compiled = WIRELESS_EXT; - range->we_version_source = 19; - - range->retry_capa = IW_RETRY_LIMIT; - range->retry_flags = IW_RETRY_LIMIT; - range->r_time_flags = 0; - - range->min_retry = 1; - range->max_retry = 255; - - range->min_r_time = 0; - range->max_r_time = 0; -#endif - -#if WIRELESS_EXT > 17 - range->enc_capa = IW_ENC_CAPA_WPA; - range->enc_capa |= IW_ENC_CAPA_CIPHER_TKIP; - range->enc_capa |= IW_ENC_CAPA_CIPHER_CCMP; -#ifdef BCMWPA2 - range->enc_capa |= IW_ENC_CAPA_WPA2; -#endif - - IW_EVENT_CAPA_SET_KERNEL(range->event_capa); - - IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); - IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN); - IW_EVENT_CAPA_SET(range->event_capa, IWEVTXDROP); - IW_EVENT_CAPA_SET(range->event_capa, IWEVMICHAELMICFAILURE); -#ifdef BCMWPA2 - IW_EVENT_CAPA_SET(range->event_capa, IWEVPMKIDCAND); -#endif -#endif - - kfree(channels); - - return 0; -} - -static int -rssi_to_qual(int rssi) -{ - if (rssi <= WL_IW_RSSI_NO_SIGNAL) - return 0; - else if (rssi <= WL_IW_RSSI_VERY_LOW) - return 1; - else if (rssi <= WL_IW_RSSI_LOW) - return 2; - else if (rssi <= WL_IW_RSSI_GOOD) - return 3; - else if (rssi <= WL_IW_RSSI_VERY_GOOD) - return 4; - else - return 5; -} - -static int -wl_iw_set_spy( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -) -{ - wl_iw_t *iw = *(wl_iw_t **)netdev_priv(dev); - struct sockaddr *addr = (struct sockaddr *) extra; - int i; - - WL_TRACE(("%s: SIOCSIWSPY\n", dev->name)); - - if (!extra) - return -EINVAL; - - iw->spy_num = MIN(ARRAYSIZE(iw->spy_addr), dwrq->length); - for (i = 0; i < iw->spy_num; i++) - memcpy(&iw->spy_addr[i], addr[i].sa_data, ETHER_ADDR_LEN); - memset(iw->spy_qual, 0, sizeof(iw->spy_qual)); - - return 0; -} - -static int -wl_iw_get_spy( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -) -{ - wl_iw_t *iw = *(wl_iw_t **)netdev_priv(dev); - struct sockaddr *addr = (struct sockaddr *) extra; - struct iw_quality *qual = (struct iw_quality *) &addr[iw->spy_num]; - int i; - - WL_TRACE(("%s: SIOCGIWSPY\n", dev->name)); - - if (!extra) - return -EINVAL; - - dwrq->length = iw->spy_num; - for (i = 0; i < iw->spy_num; i++) { - memcpy(addr[i].sa_data, &iw->spy_addr[i], ETHER_ADDR_LEN); - addr[i].sa_family = AF_UNIX; - memcpy(&qual[i], &iw->spy_qual[i], sizeof(struct iw_quality)); - iw->spy_qual[i].updated = 0; - } - - return 0; -} - - -static int -wl_iw_ch_to_chanspec(int ch, wl_join_params_t *join_params, int *join_params_size) -{ - chanspec_t chanspec = 0; - - if (ch != 0) { - - join_params->params.chanspec_num = 1; - join_params->params.chanspec_list[0] = ch; - - if (join_params->params.chanspec_list[0]) - chanspec |= WL_CHANSPEC_BAND_2G; - else - chanspec |= WL_CHANSPEC_BAND_5G; - - chanspec |= WL_CHANSPEC_BW_20; - chanspec |= WL_CHANSPEC_CTL_SB_NONE; - - *join_params_size += WL_ASSOC_PARAMS_FIXED_SIZE + - join_params->params.chanspec_num * sizeof(chanspec_t); - - join_params->params.chanspec_list[0] &= WL_CHANSPEC_CHAN_MASK; - join_params->params.chanspec_list[0] |= chanspec; - join_params->params.chanspec_list[0] = - htodchanspec(join_params->params.chanspec_list[0]); - - join_params->params.chanspec_num = htod32(join_params->params.chanspec_num); - - WL_TRACE(("%s join_params->params.chanspec_list[0]= %X\n", \ - __FUNCTION__, join_params->params.chanspec_list[0])); - } - return 1; -} - -static int -wl_iw_set_wap( - struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *awrq, - char *extra -) -{ - int error = -EINVAL; - wl_join_params_t join_params; - int join_params_size; - - WL_TRACE(("%s: SIOCSIWAP\n", dev->name)); - - if (awrq->sa_family != ARPHRD_ETHER) { - WL_ERROR(("Invalid Header...sa_family\n")); - return -EINVAL; - } - - - if (ETHER_ISBCAST(awrq->sa_data) || ETHER_ISNULLADDR(awrq->sa_data)) { - scb_val_t scbval; - - bzero(&scbval, sizeof(scb_val_t)); - - (void) dev_wlc_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t)); - return 0; - } - - - - memset(&join_params, 0, sizeof(join_params)); - join_params_size = sizeof(join_params.ssid); - - memcpy(join_params.ssid.SSID, g_ssid.SSID, g_ssid.SSID_len); - join_params.ssid.SSID_len = htod32(g_ssid.SSID_len); - memcpy(&join_params.params.bssid, awrq->sa_data, ETHER_ADDR_LEN); - - WL_ASSOC(("%s target_channel=%d\n", __FUNCTION__, g_wl_iw_params.target_channel)); - wl_iw_ch_to_chanspec(g_wl_iw_params.target_channel, &join_params, &join_params_size); - - if ((error = dev_wlc_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size))) { - WL_ERROR(("%s Invalid ioctl data=%d\n", __FUNCTION__, error)); - return error; - } - - if (g_ssid.SSID_len) { - WL_ASSOC(("%s: join SSID=%s BSSID="MACSTR" ch=%d\n", __FUNCTION__, \ - g_ssid.SSID, MAC2STR((u8 *)awrq->sa_data), \ - g_wl_iw_params.target_channel)); - } - - - memset(&g_ssid, 0, sizeof(g_ssid)); - return 0; -} - -static int -wl_iw_get_wap( - struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *awrq, - char *extra -) -{ - WL_TRACE(("%s: SIOCGIWAP\n", dev->name)); - - awrq->sa_family = ARPHRD_ETHER; - memset(awrq->sa_data, 0, ETHER_ADDR_LEN); - - - (void) dev_wlc_ioctl(dev, WLC_GET_BSSID, awrq->sa_data, ETHER_ADDR_LEN); - - return 0; -} - -#if WIRELESS_EXT > 17 -static int -wl_iw_mlme( - struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *awrq, - char *extra -) -{ - struct iw_mlme *mlme; - scb_val_t scbval; - int error = -EINVAL; - - WL_TRACE(("%s: SIOCSIWMLME DISASSOC/DEAUTH\n", dev->name)); - - mlme = (struct iw_mlme *)extra; - if (mlme == NULL) { - WL_ERROR(("Invalid ioctl data.\n")); - return error; - } - - scbval.val = mlme->reason_code; - bcopy(&mlme->addr.sa_data, &scbval.ea, ETHER_ADDR_LEN); - - if (mlme->cmd == IW_MLME_DISASSOC) { - scbval.val = htod32(scbval.val); - error = dev_wlc_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t)); - } - else if (mlme->cmd == IW_MLME_DEAUTH) { - scbval.val = htod32(scbval.val); - error = dev_wlc_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, &scbval, - sizeof(scb_val_t)); - } - else { - WL_ERROR(("Invalid ioctl data.\n")); - return error; - } - - return error; -} -#endif - -#ifndef WL_IW_USE_ISCAN -static int -wl_iw_get_aplist( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -) -{ - wl_scan_results_t *list; - struct sockaddr *addr = (struct sockaddr *) extra; - struct iw_quality qual[IW_MAX_AP]; - wl_bss_info_t *bi = NULL; - int error, i; - uint buflen = dwrq->length; - - WL_TRACE(("%s: SIOCGIWAPLIST\n", dev->name)); - - if (!extra) - return -EINVAL; - - list = kmalloc(buflen, GFP_KERNEL); - if (!list) - return -ENOMEM; - memset(list, 0, buflen); - list->buflen = htod32(buflen); - if ((error = dev_wlc_ioctl(dev, WLC_SCAN_RESULTS, list, buflen))) { - WL_ERROR(("%d: Scan results error %d\n", __LINE__, error)); - kfree(list); - return error; - } - list->buflen = dtoh32(list->buflen); - list->version = dtoh32(list->version); - list->count = dtoh32(list->count); - if (list->version != WL_BSS_INFO_VERSION) { - WL_ERROR(("%s: list->version %d != WL_BSS_INFO_VERSION\n", \ - __FUNCTION__, list->version)); - kfree(list); - return -EINVAL; - } - - for (i = 0, dwrq->length = 0; i < list->count && dwrq->length < IW_MAX_AP; i++) { - bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : list->bss_info; - - if ((dtoh32(bi->length) > buflen) || - (((uintptr)bi + dtoh32(bi->length)) > ((uintptr)list + buflen))) { - WL_ERROR(("%s: Scan results out of bounds: %u\n",__FUNCTION__,dtoh32(bi->length))); - kfree(list); - return -E2BIG; - } - - if (!(dtoh16(bi->capability) & DOT11_CAP_ESS)) - continue; - - memcpy(addr[dwrq->length].sa_data, &bi->BSSID, ETHER_ADDR_LEN); - addr[dwrq->length].sa_family = ARPHRD_ETHER; - qual[dwrq->length].qual = rssi_to_qual(dtoh16(bi->RSSI)); - qual[dwrq->length].level = 0x100 + dtoh16(bi->RSSI); - qual[dwrq->length].noise = 0x100 + bi->phy_noise; - -#if WIRELESS_EXT > 18 - qual[dwrq->length].updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; -#else - qual[dwrq->length].updated = 7; -#endif - - dwrq->length++; - } - - kfree(list); - - if (dwrq->length) { - memcpy(&addr[dwrq->length], qual, sizeof(struct iw_quality) * dwrq->length); - - dwrq->flags = 1; - } - return 0; -} -#endif - -#ifdef WL_IW_USE_ISCAN -static int -wl_iw_iscan_get_aplist( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -) -{ - wl_scan_results_t *list; - iscan_buf_t * buf; - iscan_info_t *iscan = g_iscan; - - struct sockaddr *addr = (struct sockaddr *) extra; - struct iw_quality qual[IW_MAX_AP]; - wl_bss_info_t *bi = NULL; - int i; - - WL_TRACE(("%s: SIOCGIWAPLIST\n", dev->name)); - - if (!extra) - return -EINVAL; - - if ((!iscan) || (iscan->sysioc_pid < 0)) { - WL_ERROR(("%s error\n", __FUNCTION__)); - return 0; - } - - buf = iscan->list_hdr; - - while (buf) { - list = &((wl_iscan_results_t*)buf->iscan_buf)->results; - if (list->version != WL_BSS_INFO_VERSION) { - WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", \ - __FUNCTION__, list->version)); - return -EINVAL; - } - - bi = NULL; - for (i = 0, dwrq->length = 0; i < list->count && dwrq->length < IW_MAX_AP; i++) { - bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) - : list->bss_info; - - if ((dtoh32(bi->length) > WLC_IW_ISCAN_MAXLEN) || - (((uintptr)bi + dtoh32(bi->length)) > ((uintptr)list + WLC_IW_ISCAN_MAXLEN))) { - WL_ERROR(("%s: Scan results out of bounds: %u\n",__FUNCTION__,dtoh32(bi->length))); - return -E2BIG; - } - - if (!(dtoh16(bi->capability) & DOT11_CAP_ESS)) - continue; - - memcpy(addr[dwrq->length].sa_data, &bi->BSSID, ETHER_ADDR_LEN); - addr[dwrq->length].sa_family = ARPHRD_ETHER; - qual[dwrq->length].qual = rssi_to_qual(dtoh16(bi->RSSI)); - qual[dwrq->length].level = 0x100 + dtoh16(bi->RSSI); - qual[dwrq->length].noise = 0x100 + bi->phy_noise; - -#if WIRELESS_EXT > 18 - qual[dwrq->length].updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; -#else - qual[dwrq->length].updated = 7; -#endif - - dwrq->length++; - } - buf = buf->next; - } - if (dwrq->length) { - memcpy(&addr[dwrq->length], qual, sizeof(struct iw_quality) * dwrq->length); - - dwrq->flags = 1; - } - return 0; -} - -static int -wl_iw_iscan_prep(wl_scan_params_t *params, wlc_ssid_t *ssid) -{ - int err = 0; - - memcpy(¶ms->bssid, ðer_bcast, ETHER_ADDR_LEN); - params->bss_type = DOT11_BSSTYPE_ANY; - params->scan_type = 0; - params->nprobes = -1; - params->active_time = -1; - params->passive_time = -1; - params->home_time = -1; - params->channel_num = 0; -#if defined(CONFIG_FIRST_SCAN) - if (g_first_broadcast_scan == BROADCAST_SCAN_FIRST_STARTED) - params->passive_time = 30; -#endif - params->nprobes = htod32(params->nprobes); - params->active_time = htod32(params->active_time); - params->passive_time = htod32(params->passive_time); - params->home_time = htod32(params->home_time); - if (ssid && ssid->SSID_len) - memcpy(¶ms->ssid, ssid, sizeof(wlc_ssid_t)); - - return err; -} - -static int -wl_iw_iscan(iscan_info_t *iscan, wlc_ssid_t *ssid, uint16 action) -{ - int err = 0; - - iscan->iscan_ex_params_p->version = htod32(ISCAN_REQ_VERSION); - iscan->iscan_ex_params_p->action = htod16(action); - iscan->iscan_ex_params_p->scan_duration = htod16(0); - - WL_SCAN(("%s : nprobes=%d\n", __FUNCTION__, iscan->iscan_ex_params_p->params.nprobes)); - WL_SCAN(("active_time=%d\n", iscan->iscan_ex_params_p->params.active_time)); - WL_SCAN(("passive_time=%d\n", iscan->iscan_ex_params_p->params.passive_time)); - WL_SCAN(("home_time=%d\n", iscan->iscan_ex_params_p->params.home_time)); - WL_SCAN(("scan_type=%d\n", iscan->iscan_ex_params_p->params.scan_type)); - WL_SCAN(("bss_type=%d\n", iscan->iscan_ex_params_p->params.bss_type)); - - if ((err = dev_iw_iovar_setbuf(iscan->dev, "iscan", iscan->iscan_ex_params_p, \ - iscan->iscan_ex_param_size, iscan->ioctlbuf, sizeof(iscan->ioctlbuf)))) { - WL_ERROR(("Set ISCAN for %s failed with %d\n", __FUNCTION__, err)); - err = -1; - } - - return err; -} - -static void -wl_iw_timerfunc(ulong data) -{ - iscan_info_t *iscan = (iscan_info_t *)data; - if (iscan) { - iscan->timer_on = 0; - if (iscan->iscan_state != ISCAN_STATE_IDLE) { - WL_SCAN(("timer trigger\n")); - up(&iscan->sysioc_sem); - } - } -} -static void wl_iw_set_event_mask(struct net_device *dev) -{ - char eventmask[WL_EVENTING_MASK_LEN]; - char iovbuf[WL_EVENTING_MASK_LEN + 12]; - - dev_iw_iovar_getbuf(dev, "event_msgs", "", 0, iovbuf, sizeof(iovbuf)); - bcopy(iovbuf, eventmask, WL_EVENTING_MASK_LEN); - setbit(eventmask, WLC_E_SCAN_COMPLETE); - dev_iw_iovar_setbuf(dev, "event_msgs", eventmask, WL_EVENTING_MASK_LEN, - iovbuf, sizeof(iovbuf)); -} - -static uint32 -wl_iw_iscan_get(iscan_info_t *iscan) -{ - iscan_buf_t * buf; - iscan_buf_t * ptr; - wl_iscan_results_t * list_buf; - wl_iscan_results_t list; - wl_scan_results_t *results; - uint32 status; - int res; - - mutex_lock(&wl_cache_lock); - if (iscan->list_cur) { - buf = iscan->list_cur; - iscan->list_cur = buf->next; - } - else { - buf = kmalloc(sizeof(iscan_buf_t), GFP_KERNEL); - if (!buf) { - WL_ERROR(("%s can't alloc iscan_buf_t : going to abort currect iscan\n", \ - __FUNCTION__)); - mutex_unlock(&wl_cache_lock); - return WL_SCAN_RESULTS_NO_MEM; - } - buf->next = NULL; - if (!iscan->list_hdr) - iscan->list_hdr = buf; - else { - ptr = iscan->list_hdr; - while (ptr->next) { - ptr = ptr->next; - } - ptr->next = buf; - } - } - memset(buf->iscan_buf, 0, WLC_IW_ISCAN_MAXLEN); - list_buf = (wl_iscan_results_t*)buf->iscan_buf; - results = &list_buf->results; - results->buflen = WL_ISCAN_RESULTS_FIXED_SIZE; - results->version = 0; - results->count = 0; - - memset(&list, 0, sizeof(list)); - list.results.buflen = htod32(WLC_IW_ISCAN_MAXLEN); - res = dev_iw_iovar_getbuf( - iscan->dev, - "iscanresults", - &list, - WL_ISCAN_RESULTS_FIXED_SIZE, - buf->iscan_buf, - WLC_IW_ISCAN_MAXLEN); - if (res == 0) { - results->buflen = dtoh32(results->buflen); - results->version = dtoh32(results->version); - results->count = dtoh32(results->count); - WL_SCAN(("results->count = %d\n", results->count)); - - WL_SCAN(("results->buflen = %d\n", results->buflen)); - status = dtoh32(list_buf->status); - } else { - WL_ERROR(("%s returns error %d\n", __FUNCTION__, res)); - status = WL_SCAN_RESULTS_NO_MEM; - } - mutex_unlock(&wl_cache_lock); - return status; -} - -static void wl_iw_force_specific_scan(iscan_info_t *iscan) -{ - WL_SCAN(("%s force Specific SCAN for %s\n", __FUNCTION__, g_specific_ssid.SSID)); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) - rtnl_lock(); -#endif - (void) dev_wlc_ioctl(iscan->dev, WLC_SCAN, &g_specific_ssid, sizeof(g_specific_ssid)); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) - rtnl_unlock(); -#endif -} - -static void wl_iw_send_scan_complete(iscan_info_t *iscan) -{ -#ifndef SANDGATE2G - union iwreq_data wrqu; - - memset(&wrqu, 0, sizeof(wrqu)); - - wireless_send_event(iscan->dev, SIOCGIWSCAN, &wrqu, NULL); -#if defined(CONFIG_FIRST_SCAN) - if (g_first_broadcast_scan == BROADCAST_SCAN_FIRST_STARTED) - g_first_broadcast_scan = BROADCAST_SCAN_FIRST_RESULT_READY; -#endif - WL_SCAN(("Send Event ISCAN complete\n")); -#endif -} - -static int -_iscan_sysioc_thread(void *data) -{ - uint32 status; - iscan_info_t *iscan = (iscan_info_t *)data; - static bool iscan_pass_abort = FALSE; - - DAEMONIZE("iscan_sysioc"); - - status = WL_SCAN_RESULTS_PARTIAL; - while (down_interruptible(&iscan->sysioc_sem) == 0) { - - net_os_wake_lock(iscan->dev); - -#if defined(SOFTAP) - if (ap_cfg_running) { - WL_SCAN(("%s skipping SCAN ops in AP mode !!!\n", __FUNCTION__)); - net_os_wake_unlock(iscan->dev); - continue; - } -#endif - - if (iscan->timer_on) { - iscan->timer_on = 0; - del_timer_sync(&iscan->timer); - } - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) - rtnl_lock(); -#endif - status = wl_iw_iscan_get(iscan); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) - rtnl_unlock(); -#endif - - if (g_scan_specified_ssid && (iscan_pass_abort == TRUE)) { - WL_SCAN(("%s Get results from specific scan status=%d\n", __FUNCTION__, status)); - wl_iw_send_scan_complete(iscan); - iscan_pass_abort = FALSE; - status = -1; - } - - switch (status) { - case WL_SCAN_RESULTS_PARTIAL: - WL_SCAN(("iscanresults incomplete\n")); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) - rtnl_lock(); -#endif - - wl_iw_iscan(iscan, NULL, WL_SCAN_ACTION_CONTINUE); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) - rtnl_unlock(); -#endif - - mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000); - iscan->timer_on = 1; - break; - case WL_SCAN_RESULTS_SUCCESS: - WL_SCAN(("iscanresults complete\n")); - iscan->iscan_state = ISCAN_STATE_IDLE; - wl_iw_send_scan_complete(iscan); - break; - case WL_SCAN_RESULTS_PENDING: - WL_SCAN(("iscanresults pending\n")); - - mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000); - iscan->timer_on = 1; - break; - case WL_SCAN_RESULTS_ABORTED: - WL_SCAN(("iscanresults aborted\n")); - iscan->iscan_state = ISCAN_STATE_IDLE; - if (g_scan_specified_ssid == 0) - wl_iw_send_scan_complete(iscan); - else { - iscan_pass_abort = TRUE; - wl_iw_force_specific_scan(iscan); - } - break; - case WL_SCAN_RESULTS_NO_MEM: - WL_SCAN(("iscanresults can't alloc memory: skip\n")); - iscan->iscan_state = ISCAN_STATE_IDLE; - break; - default: - WL_SCAN(("iscanresults returned unknown status %d\n", status)); - break; - } - - net_os_wake_unlock(iscan->dev); - } - - if (iscan->timer_on) { - iscan->timer_on = 0; - del_timer_sync(&iscan->timer); - } - - complete_and_exit(&iscan->sysioc_exited, 0); -} -#endif - -#if !defined(CSCAN) - -static void -wl_iw_set_ss_cache_timer_flag(void) -{ - g_ss_cache_ctrl.m_timer_expired = 1; - WL_TRACE(("%s called\n", __FUNCTION__)); -} - -static int -wl_iw_init_ss_cache_ctrl(void) -{ - WL_TRACE(("%s :\n", __FUNCTION__)); - g_ss_cache_ctrl.m_prev_scan_mode = 0; - g_ss_cache_ctrl.m_cons_br_scan_cnt = 0; - g_ss_cache_ctrl.m_cache_head = NULL; - g_ss_cache_ctrl.m_link_down = 0; - g_ss_cache_ctrl.m_timer_expired = 0; - memset(g_ss_cache_ctrl.m_active_bssid, 0, ETHER_ADDR_LEN); - - g_ss_cache_ctrl.m_timer = kmalloc(sizeof(struct timer_list), GFP_KERNEL); - if (!g_ss_cache_ctrl.m_timer) { - return -ENOMEM; - } - g_ss_cache_ctrl.m_timer->function = (void *)wl_iw_set_ss_cache_timer_flag; - init_timer(g_ss_cache_ctrl.m_timer); - - return 0; -} - - - -static void -wl_iw_free_ss_cache(void) -{ - wl_iw_ss_cache_t *node, *cur; - wl_iw_ss_cache_t **spec_scan_head; - - WL_TRACE(("%s called\n", __FUNCTION__)); - - mutex_lock(&wl_cache_lock); - spec_scan_head = &g_ss_cache_ctrl.m_cache_head; - node = *spec_scan_head; - - for (;node;) { - WL_TRACE(("%s : SSID - %s\n", __FUNCTION__, node->bss_info->SSID)); - cur = node; - node = cur->next; - kfree(cur); - } - *spec_scan_head = NULL; - mutex_unlock(&wl_cache_lock); -} - - - -static int -wl_iw_run_ss_cache_timer(int kick_off) -{ - struct timer_list **timer; - - timer = &g_ss_cache_ctrl.m_timer; - - if (*timer) { - if (kick_off) { - (*timer)->expires = jiffies + 30000 * HZ / 1000; - add_timer(*timer); - WL_TRACE(("%s : timer starts \n", __FUNCTION__)); - } else { - del_timer_sync(*timer); - WL_TRACE(("%s : timer stops \n", __FUNCTION__)); - } - } - - return 0; -} - - -void -wl_iw_release_ss_cache_ctrl(void) -{ - WL_TRACE(("%s :\n", __FUNCTION__)); - wl_iw_free_ss_cache(); - wl_iw_run_ss_cache_timer(0); - if (g_ss_cache_ctrl.m_timer) { - kfree(g_ss_cache_ctrl.m_timer); - } -} - - - -static void -wl_iw_reset_ss_cache(void) -{ - wl_iw_ss_cache_t *node, *prev, *cur; - wl_iw_ss_cache_t **spec_scan_head; - - mutex_lock(&wl_cache_lock); - spec_scan_head = &g_ss_cache_ctrl.m_cache_head; - node = *spec_scan_head; - prev = node; - - for (;node;) { - WL_TRACE(("%s : node SSID %s \n", __FUNCTION__, node->bss_info->SSID)); - if (!node->dirty) { - cur = node; - if (cur == *spec_scan_head) { - *spec_scan_head = cur->next; - prev = *spec_scan_head; - } - else { - prev->next = cur->next; - } - node = cur->next; - - WL_TRACE(("%s : Del node : SSID %s\n", __FUNCTION__, cur->bss_info->SSID)); - kfree(cur); - continue; - } - - node->dirty = 0; - prev = node; - node = node->next; - } - mutex_unlock(&wl_cache_lock); -} - - -static int -wl_iw_add_bss_to_ss_cache(wl_scan_results_t *ss_list) -{ - - wl_iw_ss_cache_t *node, *prev, *leaf; - wl_iw_ss_cache_t **spec_scan_head; - wl_bss_info_t *bi = NULL; - int i; - - if (!ss_list->count) { - return 0; - } - - mutex_lock(&wl_cache_lock); - spec_scan_head = &g_ss_cache_ctrl.m_cache_head; - - for (i = 0; i < ss_list->count; i++) { - - node = *spec_scan_head; - prev = node; - - bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : ss_list->bss_info; - - WL_TRACE(("%s : find %d with specific SSID %s\n", __FUNCTION__, i, bi->SSID)); - for (;node;) { - if (!memcmp(&node->bss_info->BSSID, &bi->BSSID, ETHER_ADDR_LEN)) { - - WL_TRACE(("dirty marked : SSID %s\n", bi->SSID)); - node->dirty = 1; - break; - } - prev = node; - node = node->next; - } - - if (node) { - continue; - } - leaf = kmalloc(bi->length + WLC_IW_SS_CACHE_CTRL_FIELD_MAXLEN, GFP_KERNEL); - if (!leaf) { - WL_ERROR(("Memory alloc failure %d\n", \ - bi->length + WLC_IW_SS_CACHE_CTRL_FIELD_MAXLEN)); - mutex_unlock(&wl_cache_lock); - return -ENOMEM; - } - - memcpy(leaf->bss_info, bi, bi->length); - leaf->next = NULL; - leaf->dirty = 1; - leaf->count = 1; - leaf->version = ss_list->version; - - if (!prev) { - *spec_scan_head = leaf; - } - else { - prev->next = leaf; - } - } - mutex_unlock(&wl_cache_lock); - return 0; -} - - -static int -wl_iw_merge_scan_cache(struct iw_request_info *info, char *extra, uint buflen_from_user, -__u16 *merged_len) -{ - wl_iw_ss_cache_t *node; - wl_scan_results_t *list_merge; - - mutex_lock(&wl_cache_lock); - node = g_ss_cache_ctrl.m_cache_head; - for (;node;) { - list_merge = (wl_scan_results_t *)&node->buflen; - WL_TRACE(("%s: Cached Specific APs list=%d\n", __FUNCTION__, list_merge->count)); - if (buflen_from_user - *merged_len > 0) { - *merged_len += (__u16) wl_iw_get_scan_prep(list_merge, info, - extra + *merged_len, buflen_from_user - *merged_len); - } - else { - WL_TRACE(("%s: exit with break\n", __FUNCTION__)); - break; - } - node = node->next; - } - mutex_unlock(&wl_cache_lock); - return 0; -} - - -static int -wl_iw_delete_bss_from_ss_cache(void *addr) -{ - - wl_iw_ss_cache_t *node, *prev; - wl_iw_ss_cache_t **spec_scan_head; - - mutex_lock(&wl_cache_lock); - spec_scan_head = &g_ss_cache_ctrl.m_cache_head; - node = *spec_scan_head; - prev = node; - for (;node;) { - if (!memcmp(&node->bss_info->BSSID, addr, ETHER_ADDR_LEN)) { - if (node == *spec_scan_head) { - *spec_scan_head = node->next; - } - else { - prev->next = node->next; - } - - WL_TRACE(("%s : Del node : %s\n", __FUNCTION__, node->bss_info->SSID)); - kfree(node); - break; - } - - prev = node; - node = node->next; - } - - memset(addr, 0, ETHER_ADDR_LEN); - mutex_unlock(&wl_cache_lock); - return 0; -} - -#endif - - -static int -wl_iw_set_scan( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int error; - WL_TRACE(("%s dev:%s: SIOCSIWSCAN : SCAN\n", __FUNCTION__, dev->name)); - -#if defined(CSCAN) - WL_ERROR(("%s: Scan from SIOCGIWSCAN not supported\n", __FUNCTION__)); - return -EINVAL; -#endif - -#if defined(SOFTAP) - if (ap_cfg_running) { - WL_TRACE(("\n>%s: Not executed, reason -'SOFTAP is active'\n", __FUNCTION__)); - return 0; - } -#endif - - if (g_onoff == G_WLAN_SET_OFF) - return 0; - - memset(&g_specific_ssid, 0, sizeof(g_specific_ssid)); -#ifndef WL_IW_USE_ISCAN - g_scan_specified_ssid = 0; -#endif - -#if WIRELESS_EXT > 17 - - if (wrqu->data.length == sizeof(struct iw_scan_req)) { - if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { - struct iw_scan_req *req = (struct iw_scan_req *)extra; -#if defined(CONFIG_FIRST_SCAN) - if (g_first_broadcast_scan != BROADCAST_SCAN_FIRST_RESULT_CONSUMED) { - WL_ERROR(("%s Ignoring SC %s first BC is not done = %d\n", \ - __FUNCTION__, req->essid, \ - g_first_broadcast_scan)); - return -EBUSY; - } -#endif - if (g_scan_specified_ssid) { - WL_SCAN(("%s Specific SCAN is not done ignore scan for = %s \n", \ - __FUNCTION__, req->essid)); - return -EBUSY; - } - else { - g_specific_ssid.SSID_len = MIN(sizeof(g_specific_ssid.SSID), \ - req->essid_len); - memcpy(g_specific_ssid.SSID, req->essid, g_specific_ssid.SSID_len); - g_specific_ssid.SSID_len = htod32(g_specific_ssid.SSID_len); - g_scan_specified_ssid = 1; - WL_TRACE(("### Specific scan ssid=%s len=%d\n", \ - g_specific_ssid.SSID, g_specific_ssid.SSID_len)); - } - } - } -#endif - - if ((error = dev_wlc_ioctl(dev, WLC_SCAN, &g_specific_ssid, sizeof(g_specific_ssid)))) { - WL_SCAN(("Set SCAN for %s failed with %d\n", g_specific_ssid.SSID, error)); - g_scan_specified_ssid = 0; - return -EBUSY; - } - - return 0; -} - -#ifdef WL_IW_USE_ISCAN -int -wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag) -{ - wlc_ssid_t ssid; - iscan_info_t *iscan = g_iscan; - -#if defined(CONFIG_FIRST_SCAN) - if (g_first_broadcast_scan == BROADCAST_SCAN_FIRST_IDLE) { - g_first_broadcast_scan = BROADCAST_SCAN_FIRST_STARTED; - WL_SCAN(("%s: First Brodcast scan was forced\n", __FUNCTION__)); - } - else if (g_first_broadcast_scan == BROADCAST_SCAN_FIRST_STARTED) { - WL_SCAN(("%s: ignore ISCAN request first BS is not done yet\n", __FUNCTION__)); - return 0; - } -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) - if (flag) - rtnl_lock(); -#endif - - dev_wlc_ioctl(dev, WLC_SET_PASSIVE_SCAN, &iscan->scan_flag, sizeof(iscan->scan_flag)); - wl_iw_set_event_mask(dev); - - WL_SCAN(("+++: Set Broadcast ISCAN\n")); - - memset(&ssid, 0, sizeof(ssid)); - - iscan->list_cur = iscan->list_hdr; - iscan->iscan_state = ISCAN_STATE_SCANING; - - memset(&iscan->iscan_ex_params_p->params, 0, iscan->iscan_ex_param_size); - wl_iw_iscan_prep(&iscan->iscan_ex_params_p->params, &ssid); - wl_iw_iscan(iscan, &ssid, WL_SCAN_ACTION_START); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) - if (flag) - rtnl_unlock(); -#endif - - mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000); - - iscan->timer_on = 1; - - return 0; -} - -static int -wl_iw_iscan_set_scan( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - wlc_ssid_t ssid; - iscan_info_t *iscan = g_iscan; - int ret = 0; - - WL_SCAN(("%s: SIOCSIWSCAN : ISCAN\n", dev->name)); - -#if defined(CSCAN) - WL_ERROR(("%s: Scan from SIOCGIWSCAN not supported\n", __FUNCTION__)); - return -EINVAL; -#endif - - net_os_wake_lock(dev); - -#if defined(SOFTAP) - if (ap_cfg_running) { - WL_SCAN(("\n>%s: Not executed, reason -'SOFTAP is active'\n", __FUNCTION__)); - goto set_scan_end; - } -#endif - - if (g_onoff == G_WLAN_SET_OFF) { - WL_SCAN(("%s: driver is not up yet after START\n", __FUNCTION__)); - goto set_scan_end; - } - -#ifdef PNO_SUPPORT - if (dhd_dev_get_pno_status(dev)) { - WL_SCAN(("%s: Scan called when PNO is active\n", __FUNCTION__)); - } -#endif - - if ((!iscan) || (iscan->sysioc_pid < 0)) { - WL_ERROR(("%s error\n", __FUNCTION__)); - goto set_scan_end; - } - - if (g_scan_specified_ssid) { - WL_SCAN(("%s Specific SCAN already running ignoring BC scan\n", \ - __FUNCTION__)); - ret = EBUSY; - goto set_scan_end; - } - - memset(&ssid, 0, sizeof(ssid)); - -#if WIRELESS_EXT > 17 - - if (wrqu->data.length == sizeof(struct iw_scan_req)) { - if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { - int as = 0; - struct iw_scan_req *req = (struct iw_scan_req *)extra; - ssid.SSID_len = MIN(sizeof(ssid.SSID), req->essid_len); - memcpy(ssid.SSID, req->essid, ssid.SSID_len); - ssid.SSID_len = htod32(ssid.SSID_len); - dev_wlc_ioctl(dev, WLC_SET_PASSIVE_SCAN, &as, sizeof(as)); - wl_iw_set_event_mask(dev); - ret = wl_iw_set_scan(dev, info, wrqu, extra); - goto set_scan_end; - } - else { - g_scan_specified_ssid = 0; - - if (iscan->iscan_state == ISCAN_STATE_SCANING) { - WL_SCAN(("%s ISCAN already in progress \n", __FUNCTION__)); - goto set_scan_end; - } - } - } -#endif - -#if defined(CONFIG_FIRST_SCAN) && !defined(CSCAN) - if (g_first_broadcast_scan < BROADCAST_SCAN_FIRST_RESULT_CONSUMED) { - if (++g_first_counter_scans == MAX_ALLOWED_BLOCK_SCAN_FROM_FIRST_SCAN) { - - WL_ERROR(("%s Clean up First scan flag which is %d\n", \ - __FUNCTION__, g_first_broadcast_scan)); - g_first_broadcast_scan = BROADCAST_SCAN_FIRST_RESULT_CONSUMED; - } - else { - WL_ERROR(("%s Ignoring Broadcast Scan:First Scan is not done yet %d\n", \ - __FUNCTION__, g_first_counter_scans)); - ret = -EBUSY; - goto set_scan_end; - } - } -#endif - - wl_iw_iscan_set_scan_broadcast_prep(dev, 0); - -set_scan_end: - net_os_wake_unlock(dev); - return ret; -} -#endif - -#if WIRELESS_EXT > 17 -static bool -ie_is_wpa_ie(uint8 **wpaie, uint8 **tlvs, int *tlvs_len) -{ - uint8 *ie = *wpaie; - - if ((ie[1] >= 6) && - !bcmp((const void *)&ie[2], (const void *)(WPA_OUI "\x01"), 4)) { - return TRUE; - } - - ie += ie[1] + 2; - - *tlvs_len -= (int)(ie - *tlvs); - - *tlvs = ie; - return FALSE; -} - -static bool -ie_is_wps_ie(uint8 **wpsie, uint8 **tlvs, int *tlvs_len) -{ - uint8 *ie = *wpsie; - - if ((ie[1] >= 4) && - !bcmp((const void *)&ie[2], (const void *)(WPA_OUI "\x04"), 4)) { - return TRUE; - } - - ie += ie[1] + 2; - - *tlvs_len -= (int)(ie - *tlvs); - - *tlvs = ie; - return FALSE; -} -#endif - -static inline int _wpa_snprintf_hex(char *buf, size_t buf_size, const u8 *data, - size_t len, int uppercase) -{ - size_t i; - char *pos = buf, *end = buf + buf_size; - int ret; - if (buf_size == 0) - return 0; - for (i = 0; i < len; i++) { - ret = snprintf(pos, end - pos, uppercase ? "%02X" : "%02x", - data[i]); - if (ret < 0 || ret >= end - pos) { - end[-1] = '\0'; - return pos - buf; - } - pos += ret; - } - end[-1] = '\0'; - return pos - buf; -} - - -int wpa_snprintf_hex(char *buf, size_t buf_size, const u8 *data, size_t len) -{ - return _wpa_snprintf_hex(buf, buf_size, data, len, 0); -} - -static int -wl_iw_handle_scanresults_ies(char **event_p, char *end, - struct iw_request_info *info, wl_bss_info_t *bi) -{ -#if WIRELESS_EXT > 17 - struct iw_event iwe; - char *event; - char *buf; - int custom_event_len; - - event = *event_p; - if (bi->ie_length) { - - bcm_tlv_t *ie; - uint8 *ptr = ((uint8 *)bi) + sizeof(wl_bss_info_t); - int ptr_len = bi->ie_length; - -#ifdef BCMWPA2 - if ((ie = bcm_parse_tlvs(ptr, ptr_len, DOT11_MNG_RSN_ID))) { - iwe.cmd = IWEVGENIE; - iwe.u.data.length = ie->len + 2; - event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)ie); - } - ptr = ((uint8 *)bi) + sizeof(wl_bss_info_t); -#endif - - while ((ie = bcm_parse_tlvs(ptr, ptr_len, DOT11_MNG_WPA_ID))) { - - if (ie_is_wps_ie(((uint8 **)&ie), &ptr, &ptr_len)) { - iwe.cmd = IWEVGENIE; - iwe.u.data.length = ie->len + 2; - event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)ie); - break; - } - } - - ptr = ((uint8 *)bi) + sizeof(wl_bss_info_t); - ptr_len = bi->ie_length; - while ((ie = bcm_parse_tlvs(ptr, ptr_len, DOT11_MNG_WPA_ID))) { - if (ie_is_wpa_ie(((uint8 **)&ie), &ptr, &ptr_len)) { - iwe.cmd = IWEVGENIE; - iwe.u.data.length = ie->len + 2; - event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)ie); - break; - } - } - - ptr = ((uint8 *)bi) + sizeof(wl_bss_info_t); - ptr_len = bi->ie_length; - - while ((ie = bcm_parse_tlvs(ptr, ptr_len, DOT11_MNG_WAPI_ID))) { - WL_TRACE(("%s: found a WAPI IE...\n", __FUNCTION__)); -#ifdef WAPI_IE_USE_GENIE - iwe.cmd = IWEVGENIE; - iwe.u.data.length = ie->len + 2; - event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)ie); -#else - iwe.cmd = IWEVCUSTOM; - custom_event_len = strlen("wapi_ie=") + 2*(ie->len + 2); - iwe.u.data.length = custom_event_len; - - buf = kmalloc(custom_event_len+1, GFP_KERNEL); - if (buf == NULL) - { - WL_ERROR(("malloc(%d) returned NULL...\n", custom_event_len)); - break; - } - - memcpy(buf, "wapi_ie=", 8); - wpa_snprintf_hex(buf + 8, 2+1, &(ie->id), 1); - wpa_snprintf_hex(buf + 10, 2+1, &(ie->len), 1); - wpa_snprintf_hex(buf + 12, 2*ie->len+1, ie->data, ie->len); - event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, buf); -#endif - break; - } - *event_p = event; - } -#endif - - return 0; -} - -#ifndef CSCAN -static uint -wl_iw_get_scan_prep( - wl_scan_results_t *list, - struct iw_request_info *info, - char *extra, - short max_size) -{ - int i, j; - struct iw_event iwe; - wl_bss_info_t *bi = NULL; - char *event = extra, *end = extra + max_size - WE_ADD_EVENT_FIX, *value; - int ret = 0; - int channel; - - if (!list) { - WL_ERROR(("%s: Null list pointer",__FUNCTION__)); - return ret; - } - - for (i = 0; i < list->count && i < IW_MAX_AP; i++) - { - if (list->version != WL_BSS_INFO_VERSION) { - WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", \ - __FUNCTION__, list->version)); - return ret; - } - - bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : list->bss_info; - - WL_TRACE(("%s : %s\n", __FUNCTION__, bi->SSID)); - - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, &bi->BSSID, ETHER_ADDR_LEN); - event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_ADDR_LEN); - - iwe.u.data.length = dtoh32(bi->SSID_len); - iwe.cmd = SIOCGIWESSID; - iwe.u.data.flags = 1; - event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, bi->SSID); - - if (dtoh16(bi->capability) & (DOT11_CAP_ESS | DOT11_CAP_IBSS)) { - iwe.cmd = SIOCGIWMODE; - if (dtoh16(bi->capability) & DOT11_CAP_ESS) - iwe.u.mode = IW_MODE_INFRA; - else - iwe.u.mode = IW_MODE_ADHOC; - event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_UINT_LEN); - } - - iwe.cmd = SIOCGIWFREQ; - channel = (bi->ctl_ch == 0) ? CHSPEC_CHANNEL(bi->chanspec) : bi->ctl_ch; - iwe.u.freq.m = wf_channel2mhz(channel, - channel <= CH_MAX_2G_CHANNEL ? - WF_CHAN_FACTOR_2_4_G : WF_CHAN_FACTOR_5_G); - iwe.u.freq.e = 6; - event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_FREQ_LEN); - - iwe.cmd = IWEVQUAL; - iwe.u.qual.qual = rssi_to_qual(dtoh16(bi->RSSI)); - iwe.u.qual.level = 0x100 + dtoh16(bi->RSSI); - iwe.u.qual.noise = 0x100 + bi->phy_noise; - event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_QUAL_LEN); - - wl_iw_handle_scanresults_ies(&event, end, info, bi); - - iwe.cmd = SIOCGIWENCODE; - if (dtoh16(bi->capability) & DOT11_CAP_PRIVACY) - iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - else - iwe.u.data.flags = IW_ENCODE_DISABLED; - iwe.u.data.length = 0; - event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)event); - - if (bi->rateset.count) { - if (((event -extra) + IW_EV_LCP_LEN) <= (uintptr)end) { - value = event + IW_EV_LCP_LEN; - iwe.cmd = SIOCGIWRATE; - - iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; - for (j = 0; j < bi->rateset.count && j < IW_MAX_BITRATES; j++) { - iwe.u.bitrate.value = (bi->rateset.rates[j] & 0x7f) * 500000; - value = IWE_STREAM_ADD_VALUE(info, event, value, end, &iwe, - IW_EV_PARAM_LEN); - } - event = value; - } - } - } - - if ((ret = (event - extra)) < 0) { - WL_ERROR(("==> Wrong size\n")); - ret = 0; - } - WL_TRACE(("%s: size=%d bytes prepared \n", __FUNCTION__, (unsigned int)(event - extra))); - return (uint)ret; -} - -static int -wl_iw_get_scan( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -) -{ - channel_info_t ci; - wl_scan_results_t *list_merge; - wl_scan_results_t *list = (wl_scan_results_t *) g_scan; - int error; - uint buflen_from_user = dwrq->length; - uint len = G_SCAN_RESULTS; - __u16 len_ret = 0; -#if !defined(CSCAN) - __u16 merged_len = 0; -#endif -#if defined(WL_IW_USE_ISCAN) - iscan_info_t *iscan = g_iscan; - iscan_buf_t * p_buf; -#if !defined(CSCAN) - uint32 counter = 0; -#endif -#endif - WL_TRACE(("%s: buflen_from_user %d: \n", dev->name, buflen_from_user)); - - if (!extra) { - WL_TRACE(("%s: wl_iw_get_scan return -EINVAL\n", dev->name)); - return -EINVAL; - } - - if ((error = dev_wlc_ioctl(dev, WLC_GET_CHANNEL, &ci, sizeof(ci)))) - return error; - ci.scan_channel = dtoh32(ci.scan_channel); - if (ci.scan_channel) - return -EAGAIN; - -#if !defined(CSCAN) - if (g_ss_cache_ctrl.m_timer_expired) { - wl_iw_free_ss_cache(); - g_ss_cache_ctrl.m_timer_expired ^= 1; - } - if ((!g_scan_specified_ssid && g_ss_cache_ctrl.m_prev_scan_mode) || - g_ss_cache_ctrl.m_cons_br_scan_cnt > 4) { - g_ss_cache_ctrl.m_cons_br_scan_cnt = 0; - - wl_iw_reset_ss_cache(); - } - g_ss_cache_ctrl.m_prev_scan_mode = g_scan_specified_ssid; - if (g_scan_specified_ssid) { - g_ss_cache_ctrl.m_cons_br_scan_cnt = 0; - } - else { - g_ss_cache_ctrl.m_cons_br_scan_cnt++; - } -#endif - - if (g_scan_specified_ssid) { - - list = kmalloc(len, GFP_KERNEL); - if (!list) { - WL_TRACE(("%s: wl_iw_get_scan return -ENOMEM\n", dev->name)); - g_scan_specified_ssid = 0; - return -ENOMEM; - } - } - - memset(list, 0, len); - list->buflen = htod32(len); - if ((error = dev_wlc_ioctl(dev, WLC_SCAN_RESULTS, list, len))) { - WL_ERROR(("%s: %s : Scan_results ERROR %d\n", dev->name, __FUNCTION__, error)); - dwrq->length = len; - if (g_scan_specified_ssid) { - g_scan_specified_ssid = 0; - kfree(list); - } - return 0; - } - list->buflen = dtoh32(list->buflen); - list->version = dtoh32(list->version); - list->count = dtoh32(list->count); - - if (list->version != WL_BSS_INFO_VERSION) { - WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", - __FUNCTION__, list->version)); - if (g_scan_specified_ssid) { - g_scan_specified_ssid = 0; - kfree(list); - } - return -EINVAL; - } - -#if !defined(CSCAN) - if (g_scan_specified_ssid) { - - wl_iw_add_bss_to_ss_cache(list); - kfree(list); - } - - mutex_lock(&wl_cache_lock); -#if defined(WL_IW_USE_ISCAN) - if (g_scan_specified_ssid) - WL_TRACE(("%s: Specified scan APs from scan=%d\n", __FUNCTION__, list->count)); - p_buf = iscan->list_hdr; - - while (p_buf != iscan->list_cur) { - list_merge = &((wl_iscan_results_t*)p_buf->iscan_buf)->results; - WL_TRACE(("%s: Bcast APs list=%d\n", __FUNCTION__, list_merge->count)); - counter += list_merge->count; - if (list_merge->count > 0) - len_ret += (__u16) wl_iw_get_scan_prep(list_merge, info, - extra+len_ret, buflen_from_user -len_ret); - p_buf = p_buf->next; - } - WL_TRACE(("%s merged with total Bcast APs=%d\n", __FUNCTION__, counter)); -#else - list_merge = (wl_scan_results_t *) g_scan; - len_ret = (__u16) wl_iw_get_scan_prep(list_merge, info, extra, buflen_from_user); -#endif - mutex_unlock(&wl_cache_lock); - if (g_ss_cache_ctrl.m_link_down) { - wl_iw_delete_bss_from_ss_cache(g_ss_cache_ctrl.m_active_bssid); - } - - wl_iw_merge_scan_cache(info, extra+len_ret, buflen_from_user-len_ret, &merged_len); - len_ret += merged_len; - wl_iw_run_ss_cache_timer(0); - wl_iw_run_ss_cache_timer(1); -#else - - if (g_scan_specified_ssid) { - WL_TRACE(("%s: Specified scan APs in the list =%d\n", __FUNCTION__, list->count)); - len_ret = (__u16) wl_iw_get_scan_prep(list, info, extra, buflen_from_user); - kfree(list); - -#if defined(WL_IW_USE_ISCAN) - p_buf = iscan->list_hdr; - - while (p_buf != iscan->list_cur) { - list_merge = &((wl_iscan_results_t*)p_buf->iscan_buf)->results; - WL_TRACE(("%s: Bcast APs list=%d\n", __FUNCTION__, list_merge->count)); - if (list_merge->count > 0) - len_ret += (__u16) wl_iw_get_scan_prep(list_merge, info, - extra+len_ret, buflen_from_user -len_ret); - p_buf = p_buf->next; - } -#else - list_merge = (wl_scan_results_t *) g_scan; - WL_TRACE(("%s: Bcast APs list=%d\n", __FUNCTION__, list_merge->count)); - if (list_merge->count > 0) - len_ret += (__u16) wl_iw_get_scan_prep(list_merge, info, extra+len_ret, - buflen_from_user -len_ret); -#endif - } - else { - list = (wl_scan_results_t *) g_scan; - len_ret = (__u16) wl_iw_get_scan_prep(list, info, extra, buflen_from_user); - } -#endif - -#if defined(WL_IW_USE_ISCAN) - - g_scan_specified_ssid = 0; -#endif - - if ((len_ret + WE_ADD_EVENT_FIX) < buflen_from_user) - len = len_ret; - - dwrq->length = len; - dwrq->flags = 0; - - WL_TRACE(("%s return to WE %d bytes APs=%d\n", __FUNCTION__, dwrq->length, list->count)); - return 0; -} -#endif - -#if defined(WL_IW_USE_ISCAN) -static int -wl_iw_iscan_get_scan( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -) -{ - wl_scan_results_t *list; - struct iw_event iwe; - wl_bss_info_t *bi = NULL; - int ii, j; - int apcnt; - char *event = extra, *end = extra + dwrq->length, *value; - iscan_info_t *iscan = g_iscan; - iscan_buf_t * p_buf; - uint32 counter = 0; - uint8 channel; -#if !defined(CSCAN) - __u16 merged_len = 0; - uint buflen_from_user = dwrq->length; -#endif - - WL_SCAN(("%s %s buflen_from_user %d:\n", dev->name, __FUNCTION__, dwrq->length)); - -#if defined(SOFTAP) - if (ap_cfg_running) { - WL_TRACE(("%s: Not executed, reason -'SOFTAP is active'\n", __FUNCTION__)); - return -EINVAL; - } -#endif - - if (!extra) { - WL_TRACE(("%s: INVALID SIOCGIWSCAN GET bad parameter\n", dev->name)); - return -EINVAL; - } - -#if defined(CONFIG_FIRST_SCAN) - if (g_first_broadcast_scan < BROADCAST_SCAN_FIRST_RESULT_READY) { - WL_TRACE(("%s %s: first ISCAN results are NOT ready yet \n", \ - dev->name, __FUNCTION__)); - return -EAGAIN; - } -#endif - - if ((!iscan) || (iscan->sysioc_pid < 0)) { - WL_ERROR(("%ssysioc_pid\n", __FUNCTION__)); - return -EAGAIN; - } - -#if !defined(CSCAN) - if (g_ss_cache_ctrl.m_timer_expired) { - wl_iw_free_ss_cache(); - g_ss_cache_ctrl.m_timer_expired ^= 1; - } - if (g_scan_specified_ssid) { - return wl_iw_get_scan(dev, info, dwrq, extra); - } - else { - if (g_ss_cache_ctrl.m_link_down) { - wl_iw_delete_bss_from_ss_cache(g_ss_cache_ctrl.m_active_bssid); - } - if (g_ss_cache_ctrl.m_prev_scan_mode || g_ss_cache_ctrl.m_cons_br_scan_cnt > 4) { - g_ss_cache_ctrl.m_cons_br_scan_cnt = 0; - - wl_iw_reset_ss_cache(); - } - g_ss_cache_ctrl.m_prev_scan_mode = g_scan_specified_ssid; - g_ss_cache_ctrl.m_cons_br_scan_cnt++; - } -#endif - - WL_TRACE(("%s: SIOCGIWSCAN GET broadcast results\n", dev->name)); - apcnt = 0; - p_buf = iscan->list_hdr; - - while (p_buf != iscan->list_cur) { - list = &((wl_iscan_results_t*)p_buf->iscan_buf)->results; - - counter += list->count; - - if (list->version != WL_BSS_INFO_VERSION) { - WL_ERROR(("%s : list->version %d != WL_BSS_INFO_VERSION\n", - __FUNCTION__, list->version)); - return -EINVAL; - } - - bi = NULL; - for (ii = 0; ii < list->count && apcnt < IW_MAX_AP; apcnt++, ii++) { - bi = bi ? (wl_bss_info_t *)((uintptr)bi + dtoh32(bi->length)) : list->bss_info; - - if ((dtoh32(bi->length) > WLC_IW_ISCAN_MAXLEN) || - (((uintptr)bi + dtoh32(bi->length)) > ((uintptr)list + WLC_IW_ISCAN_MAXLEN))) { - WL_ERROR(("%s: Scan results out of bounds: %u\n",__FUNCTION__,dtoh32(bi->length))); - return -E2BIG; - } - - if (event + ETHER_ADDR_LEN + bi->SSID_len + IW_EV_UINT_LEN + IW_EV_FREQ_LEN + - IW_EV_QUAL_LEN >= end) - return -E2BIG; - - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, &bi->BSSID, ETHER_ADDR_LEN); - event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_ADDR_LEN); - - iwe.u.data.length = dtoh32(bi->SSID_len); - iwe.cmd = SIOCGIWESSID; - iwe.u.data.flags = 1; - event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, bi->SSID); - - if (dtoh16(bi->capability) & (DOT11_CAP_ESS | DOT11_CAP_IBSS)) { - iwe.cmd = SIOCGIWMODE; - if (dtoh16(bi->capability) & DOT11_CAP_ESS) - iwe.u.mode = IW_MODE_INFRA; - else - iwe.u.mode = IW_MODE_ADHOC; - event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_UINT_LEN); - } - - iwe.cmd = SIOCGIWFREQ; - channel = (bi->ctl_ch == 0) ? CHSPEC_CHANNEL(bi->chanspec) : bi->ctl_ch; - iwe.u.freq.m = wf_channel2mhz(channel, - channel <= CH_MAX_2G_CHANNEL ? - WF_CHAN_FACTOR_2_4_G : WF_CHAN_FACTOR_5_G); - iwe.u.freq.e = 6; - event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_FREQ_LEN); - - iwe.cmd = IWEVQUAL; - iwe.u.qual.qual = rssi_to_qual(dtoh16(bi->RSSI)); - iwe.u.qual.level = 0x100 + dtoh16(bi->RSSI); - iwe.u.qual.noise = 0x100 + bi->phy_noise; - event = IWE_STREAM_ADD_EVENT(info, event, end, &iwe, IW_EV_QUAL_LEN); - - wl_iw_handle_scanresults_ies(&event, end, info, bi); - - iwe.cmd = SIOCGIWENCODE; - if (dtoh16(bi->capability) & DOT11_CAP_PRIVACY) - iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - else - iwe.u.data.flags = IW_ENCODE_DISABLED; - iwe.u.data.length = 0; - event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)event); - - if (bi->rateset.count) { - if (event + IW_MAX_BITRATES*IW_EV_PARAM_LEN >= end) - return -E2BIG; - - value = event + IW_EV_LCP_LEN; - iwe.cmd = SIOCGIWRATE; - - iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; - for (j = 0; j < bi->rateset.count && j < IW_MAX_BITRATES; j++) { - iwe.u.bitrate.value = (bi->rateset.rates[j] & 0x7f) * 500000; - value = IWE_STREAM_ADD_VALUE(info, event, value, end, &iwe, - IW_EV_PARAM_LEN); - } - event = value; - } - } - p_buf = p_buf->next; - } - - dwrq->length = event - extra; - dwrq->flags = 0; - -#if !defined(CSCAN) - wl_iw_merge_scan_cache(info, event, buflen_from_user - dwrq->length, &merged_len); - dwrq->length += merged_len; - wl_iw_run_ss_cache_timer(0); - wl_iw_run_ss_cache_timer(1); -#endif /* CSCAN */ -#if defined(CONFIG_FIRST_SCAN) - g_first_broadcast_scan = BROADCAST_SCAN_FIRST_RESULT_CONSUMED; -#endif - - WL_TRACE(("%s return to WE %d bytes APs=%d\n", __FUNCTION__, dwrq->length, counter)); - - return 0; -} -#endif - -static int -wl_iw_set_essid( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -) -{ - int error; - wl_join_params_t join_params; - int join_params_size; - - WL_TRACE(("%s: SIOCSIWESSID\n", dev->name)); - - - memset(&g_ssid, 0, sizeof(g_ssid)); - - CHECK_EXTRA_FOR_NULL(extra); - - if (dwrq->length && extra) { -#if WIRELESS_EXT > 20 - g_ssid.SSID_len = MIN(sizeof(g_ssid.SSID), dwrq->length); -#else - g_ssid.SSID_len = MIN(sizeof(g_ssid.SSID), dwrq->length-1); -#endif - memcpy(g_ssid.SSID, extra, g_ssid.SSID_len); - } else { - - g_ssid.SSID_len = 0; - } - g_ssid.SSID_len = htod32(g_ssid.SSID_len); - - memset(&join_params, 0, sizeof(join_params)); - join_params_size = sizeof(join_params.ssid); - - memcpy(&join_params.ssid.SSID, g_ssid.SSID, g_ssid.SSID_len); - join_params.ssid.SSID_len = htod32(g_ssid.SSID_len); - memcpy(&join_params.params.bssid, ðer_bcast, ETHER_ADDR_LEN); - - wl_iw_ch_to_chanspec(g_wl_iw_params.target_channel, &join_params, &join_params_size); - - if ((error = dev_wlc_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size))) { - WL_ERROR(("Invalid ioctl data=%d\n", error)); - return error; - } - - if (g_ssid.SSID_len) { - WL_TRACE(("%s: join SSID=%s ch=%d\n", __FUNCTION__, \ - g_ssid.SSID, g_wl_iw_params.target_channel)); - } - return 0; -} - -static int -wl_iw_get_essid( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -) -{ - wlc_ssid_t ssid; - int error; - - WL_TRACE(("%s: SIOCGIWESSID\n", dev->name)); - - if (!extra) - return -EINVAL; - - if ((error = dev_wlc_ioctl(dev, WLC_GET_SSID, &ssid, sizeof(ssid)))) { - WL_ERROR(("Error getting the SSID\n")); - return error; - } - - ssid.SSID_len = dtoh32(ssid.SSID_len); - - memcpy(extra, ssid.SSID, ssid.SSID_len); - - dwrq->length = ssid.SSID_len; - - dwrq->flags = 1; - - return 0; -} - -static int -wl_iw_set_nick( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -) -{ - wl_iw_t *iw = *(wl_iw_t **)netdev_priv(dev); - - WL_TRACE(("%s: SIOCSIWNICKN\n", dev->name)); - - if (!extra) - return -EINVAL; - - if (dwrq->length > sizeof(iw->nickname)) - return -E2BIG; - - memcpy(iw->nickname, extra, dwrq->length); - iw->nickname[dwrq->length - 1] = '\0'; - - return 0; -} - -static int -wl_iw_get_nick( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -) -{ - wl_iw_t *iw = *(wl_iw_t **)netdev_priv(dev); - - WL_TRACE(("%s: SIOCGIWNICKN\n", dev->name)); - - if (!extra) - return -EINVAL; - - strcpy(extra, iw->nickname); - dwrq->length = strlen(extra) + 1; - - return 0; -} - -static int wl_iw_set_rate( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - wl_rateset_t rateset; - int error, rate, i, error_bg, error_a; - - WL_TRACE(("%s: SIOCSIWRATE\n", dev->name)); - - - if ((error = dev_wlc_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, sizeof(rateset)))) - return error; - - rateset.count = dtoh32(rateset.count); - - if (vwrq->value < 0) { - - rate = rateset.rates[rateset.count - 1] & 0x7f; - } else if (vwrq->value < rateset.count) { - - rate = rateset.rates[vwrq->value] & 0x7f; - } else { - - rate = vwrq->value / 500000; - } - - if (vwrq->fixed) { - - error_bg = dev_wlc_intvar_set(dev, "bg_rate", rate); - error_a = dev_wlc_intvar_set(dev, "a_rate", rate); - - if (error_bg && error_a) - return (error_bg | error_a); - } else { - - - error_bg = dev_wlc_intvar_set(dev, "bg_rate", 0); - - error_a = dev_wlc_intvar_set(dev, "a_rate", 0); - - if (error_bg && error_a) - return (error_bg | error_a); - - - for (i = 0; i < rateset.count; i++) - if ((rateset.rates[i] & 0x7f) > rate) - break; - rateset.count = htod32(i); - - - if ((error = dev_wlc_ioctl(dev, WLC_SET_RATESET, &rateset, sizeof(rateset)))) - return error; - } - - return 0; -} - -static int wl_iw_get_rate( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - int error, rate; - - WL_TRACE(("%s: SIOCGIWRATE\n", dev->name)); - - - if ((error = dev_wlc_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate)))) - return error; - rate = dtoh32(rate); - vwrq->value = rate * 500000; - - return 0; -} - -static int -wl_iw_set_rts( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - int error, rts; - - WL_TRACE(("%s: SIOCSIWRTS\n", dev->name)); - - if (vwrq->disabled) - rts = DOT11_DEFAULT_RTS_LEN; - else if (vwrq->value < 0 || vwrq->value > DOT11_DEFAULT_RTS_LEN) - return -EINVAL; - else - rts = vwrq->value; - - if ((error = dev_wlc_intvar_set(dev, "rtsthresh", rts))) - return error; - - return 0; -} - -static int -wl_iw_get_rts( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - int error, rts; - - WL_TRACE(("%s: SIOCGIWRTS\n", dev->name)); - - if ((error = dev_wlc_intvar_get(dev, "rtsthresh", &rts))) - return error; - - vwrq->value = rts; - vwrq->disabled = (rts >= DOT11_DEFAULT_RTS_LEN); - vwrq->fixed = 1; - - return 0; -} - -static int -wl_iw_set_frag( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - int error, frag; - - WL_TRACE(("%s: SIOCSIWFRAG\n", dev->name)); - - if (vwrq->disabled) - frag = DOT11_DEFAULT_FRAG_LEN; - else if (vwrq->value < 0 || vwrq->value > DOT11_DEFAULT_FRAG_LEN) - return -EINVAL; - else - frag = vwrq->value; - - if ((error = dev_wlc_intvar_set(dev, "fragthresh", frag))) - return error; - - return 0; -} - -static int -wl_iw_get_frag( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - int error, fragthreshold; - - WL_TRACE(("%s: SIOCGIWFRAG\n", dev->name)); - - if ((error = dev_wlc_intvar_get(dev, "fragthresh", &fragthreshold))) - return error; - - vwrq->value = fragthreshold; - vwrq->disabled = (fragthreshold >= DOT11_DEFAULT_FRAG_LEN); - vwrq->fixed = 1; - - return 0; -} - -static int -wl_iw_set_txpow( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - int error, disable; - uint16 txpwrmw; - WL_TRACE(("%s: SIOCSIWTXPOW\n", dev->name)); - - - disable = vwrq->disabled ? WL_RADIO_SW_DISABLE : 0; - disable += WL_RADIO_SW_DISABLE << 16; - - disable = htod32(disable); - if ((error = dev_wlc_ioctl(dev, WLC_SET_RADIO, &disable, sizeof(disable)))) - return error; - - - if (disable & WL_RADIO_SW_DISABLE) - return 0; - - - if (!(vwrq->flags & IW_TXPOW_MWATT)) - return -EINVAL; - - - if (vwrq->value < 0) - return 0; - - if (vwrq->value > 0xffff) txpwrmw = 0xffff; - else txpwrmw = (uint16)vwrq->value; - - - error = dev_wlc_intvar_set(dev, "qtxpower", (int)(bcm_mw_to_qdbm(txpwrmw))); - return error; -} - -static int -wl_iw_get_txpow( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - int error, disable, txpwrdbm; - uint8 result; - - WL_TRACE(("%s: SIOCGIWTXPOW\n", dev->name)); - - if ((error = dev_wlc_ioctl(dev, WLC_GET_RADIO, &disable, sizeof(disable))) || - (error = dev_wlc_intvar_get(dev, "qtxpower", &txpwrdbm))) - return error; - - disable = dtoh32(disable); - result = (uint8)(txpwrdbm & ~WL_TXPWR_OVERRIDE); - vwrq->value = (int32)bcm_qdbm_to_mw(result); - vwrq->fixed = 0; - vwrq->disabled = (disable & (WL_RADIO_SW_DISABLE | WL_RADIO_HW_DISABLE)) ? 1 : 0; - vwrq->flags = IW_TXPOW_MWATT; - - return 0; -} - -#if WIRELESS_EXT > 10 -static int -wl_iw_set_retry( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - int error, lrl, srl; - - WL_TRACE(("%s: SIOCSIWRETRY\n", dev->name)); - - - if (vwrq->disabled || (vwrq->flags & IW_RETRY_LIFETIME)) - return -EINVAL; - - - if (vwrq->flags & IW_RETRY_LIMIT) { - - -#if WIRELESS_EXT > 20 - if ((vwrq->flags & IW_RETRY_LONG) ||(vwrq->flags & IW_RETRY_MAX) || - !((vwrq->flags & IW_RETRY_SHORT) || (vwrq->flags & IW_RETRY_MIN))) { -#else - if ((vwrq->flags & IW_RETRY_MAX) || !(vwrq->flags & IW_RETRY_MIN)) { -#endif - lrl = htod32(vwrq->value); - if ((error = dev_wlc_ioctl(dev, WLC_SET_LRL, &lrl, sizeof(lrl)))) - return error; - } - - -#if WIRELESS_EXT > 20 - if ((vwrq->flags & IW_RETRY_SHORT) ||(vwrq->flags & IW_RETRY_MIN) || - !((vwrq->flags & IW_RETRY_LONG) || (vwrq->flags & IW_RETRY_MAX))) { -#else - if ((vwrq->flags & IW_RETRY_MIN) || !(vwrq->flags & IW_RETRY_MAX)) { -#endif - srl = htod32(vwrq->value); - if ((error = dev_wlc_ioctl(dev, WLC_SET_SRL, &srl, sizeof(srl)))) - return error; - } - } - return 0; -} - -static int -wl_iw_get_retry( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - int error, lrl, srl; - - WL_TRACE(("%s: SIOCGIWRETRY\n", dev->name)); - - vwrq->disabled = 0; - - - if ((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) - return -EINVAL; - - - if ((error = dev_wlc_ioctl(dev, WLC_GET_LRL, &lrl, sizeof(lrl))) || - (error = dev_wlc_ioctl(dev, WLC_GET_SRL, &srl, sizeof(srl)))) - return error; - - lrl = dtoh32(lrl); - srl = dtoh32(srl); - - - if (vwrq->flags & IW_RETRY_MAX) { - vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; - vwrq->value = lrl; - } else { - vwrq->flags = IW_RETRY_LIMIT; - vwrq->value = srl; - if (srl != lrl) - vwrq->flags |= IW_RETRY_MIN; - } - - return 0; -} -#endif - -static int -wl_iw_set_encode( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -) -{ - wl_wsec_key_t key; - int error, val, wsec; - - WL_TRACE(("%s: SIOCSIWENCODE\n", dev->name)); - - memset(&key, 0, sizeof(key)); - - if ((dwrq->flags & IW_ENCODE_INDEX) == 0) { - - for (key.index = 0; key.index < DOT11_MAX_DEFAULT_KEYS; key.index++) { - val = htod32(key.index); - if ((error = dev_wlc_ioctl(dev, WLC_GET_KEY_PRIMARY, &val, sizeof(val)))) - return error; - val = dtoh32(val); - if (val) - break; - } - - if (key.index == DOT11_MAX_DEFAULT_KEYS) - key.index = 0; - } else { - key.index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - if (key.index >= DOT11_MAX_DEFAULT_KEYS) - return -EINVAL; - } - - - if (!extra || !dwrq->length || (dwrq->flags & IW_ENCODE_NOKEY)) { - - val = htod32(key.index); - if ((error = dev_wlc_ioctl(dev, WLC_SET_KEY_PRIMARY, &val, sizeof(val)))) - return error; - } else { - key.len = dwrq->length; - - if (dwrq->length > sizeof(key.data)) - return -EINVAL; - - memcpy(key.data, extra, dwrq->length); - - key.flags = WL_PRIMARY_KEY; - switch (key.len) { - case WEP1_KEY_SIZE: - key.algo = CRYPTO_ALGO_WEP1; - break; - case WEP128_KEY_SIZE: - key.algo = CRYPTO_ALGO_WEP128; - break; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) - case TKIP_KEY_SIZE: - key.algo = CRYPTO_ALGO_TKIP; - break; -#endif - case AES_KEY_SIZE: - key.algo = CRYPTO_ALGO_AES_CCM; - break; - default: - return -EINVAL; - } - - - swap_key_from_BE(&key); - if ((error = dev_wlc_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)))) - return error; - } - - - val = (dwrq->flags & IW_ENCODE_DISABLED) ? 0 : WEP_ENABLED; - - if ((error = dev_wlc_intvar_get(dev, "wsec", &wsec))) - return error; - - wsec &= ~(WEP_ENABLED); - wsec |= val; - - if ((error = dev_wlc_intvar_set(dev, "wsec", wsec))) - return error; - - - val = (dwrq->flags & IW_ENCODE_RESTRICTED) ? 1 : 0; - val = htod32(val); - if ((error = dev_wlc_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val)))) - return error; - - return 0; -} - -static int -wl_iw_get_encode( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -) -{ - wl_wsec_key_t key; - int error, val, wsec, auth; - - WL_TRACE(("%s: SIOCGIWENCODE\n", dev->name)); - - - bzero(&key, sizeof(wl_wsec_key_t)); - - if ((dwrq->flags & IW_ENCODE_INDEX) == 0) { - - for (key.index = 0; key.index < DOT11_MAX_DEFAULT_KEYS; key.index++) { - val = key.index; - if ((error = dev_wlc_ioctl(dev, WLC_GET_KEY_PRIMARY, &val, sizeof(val)))) - return error; - val = dtoh32(val); - if (val) - break; - } - } else - key.index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - - if (key.index >= DOT11_MAX_DEFAULT_KEYS) - key.index = 0; - - - - if ((error = dev_wlc_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec))) || - (error = dev_wlc_ioctl(dev, WLC_GET_AUTH, &auth, sizeof(auth)))) - return error; - - swap_key_to_BE(&key); - - wsec = dtoh32(wsec); - auth = dtoh32(auth); - - dwrq->length = MIN(DOT11_MAX_KEY_SIZE, key.len); - - - dwrq->flags = key.index + 1; - if (!(wsec & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))) { - - dwrq->flags |= IW_ENCODE_DISABLED; - } - if (auth) { - - dwrq->flags |= IW_ENCODE_RESTRICTED; - } - - - if (dwrq->length && extra) - memcpy(extra, key.data, dwrq->length); - - return 0; -} - -static int -wl_iw_set_power( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - int error, pm; - - WL_TRACE(("%s: SIOCSIWPOWER\n", dev->name)); - - pm = vwrq->disabled ? PM_OFF : PM_MAX; - - pm = htod32(pm); - if ((error = dev_wlc_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm)))) - return error; - - return 0; -} - -static int -wl_iw_get_power( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - int error, pm; - - WL_TRACE(("%s: SIOCGIWPOWER\n", dev->name)); - - if ((error = dev_wlc_ioctl(dev, WLC_GET_PM, &pm, sizeof(pm)))) - return error; - - pm = dtoh32(pm); - vwrq->disabled = pm ? 0 : 1; - vwrq->flags = IW_POWER_ALL_R; - - return 0; -} - -#if WIRELESS_EXT > 17 -static int -wl_iw_set_wpaie( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *iwp, - char *extra -) -{ - uchar buf[WLC_IOCTL_SMLEN] = {0}; - uchar *p = buf; - int wapi_ie_size; - - WL_TRACE(("%s: SIOCSIWGENIE\n", dev->name)); - - CHECK_EXTRA_FOR_NULL(extra); - - if (extra[0] == DOT11_MNG_WAPI_ID) - { - wapi_ie_size = iwp->length; - memcpy(p, extra, iwp->length); - dev_wlc_bufvar_set(dev, "wapiie", buf, wapi_ie_size); - } - else - dev_wlc_bufvar_set(dev, "wpaie", extra, iwp->length); - - return 0; -} - -static int -wl_iw_get_wpaie( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *iwp, - char *extra -) -{ - WL_TRACE(("%s: SIOCGIWGENIE\n", dev->name)); - iwp->length = 64; - dev_wlc_bufvar_get(dev, "wpaie", extra, iwp->length); - return 0; -} - -static int -wl_iw_set_encodeext( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra -) -{ - wl_wsec_key_t key; - int error; - struct iw_encode_ext *iwe; - - WL_WSEC(("%s: SIOCSIWENCODEEXT\n", dev->name)); - - CHECK_EXTRA_FOR_NULL(extra); - - memset(&key, 0, sizeof(key)); - iwe = (struct iw_encode_ext *)extra; - - - if (dwrq->flags & IW_ENCODE_DISABLED) { - - } - - - key.index = 0; - if (dwrq->flags & IW_ENCODE_INDEX) - key.index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - - key.len = iwe->key_len; - - - if (!ETHER_ISMULTI(iwe->addr.sa_data)) - bcopy((void *)&iwe->addr.sa_data, (char *)&key.ea, ETHER_ADDR_LEN); - - - if (key.len == 0) { - if (iwe->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - WL_WSEC(("Changing the the primary Key to %d\n", key.index)); - - key.index = htod32(key.index); - error = dev_wlc_ioctl(dev, WLC_SET_KEY_PRIMARY, - &key.index, sizeof(key.index)); - if (error) - return error; - } - - else { - swap_key_from_BE(&key); - dev_wlc_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)); - } - } - else { - if (iwe->key_len > sizeof(key.data)) - return -EINVAL; - - WL_WSEC(("Setting the key index %d\n", key.index)); - if (iwe->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - WL_WSEC(("key is a Primary Key\n")); - key.flags = WL_PRIMARY_KEY; - } - - bcopy((void *)iwe->key, key.data, iwe->key_len); - - if (iwe->alg == IW_ENCODE_ALG_TKIP) { - uint8 keybuf[8]; - bcopy(&key.data[24], keybuf, sizeof(keybuf)); - bcopy(&key.data[16], &key.data[24], sizeof(keybuf)); - bcopy(keybuf, &key.data[16], sizeof(keybuf)); - } - - - if (iwe->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { - uchar *ivptr; - ivptr = (uchar *)iwe->rx_seq; - key.rxiv.hi = (ivptr[5] << 24) | (ivptr[4] << 16) | - (ivptr[3] << 8) | ivptr[2]; - key.rxiv.lo = (ivptr[1] << 8) | ivptr[0]; - key.iv_initialized = TRUE; - } - - switch (iwe->alg) { - case IW_ENCODE_ALG_NONE: - key.algo = CRYPTO_ALGO_OFF; - break; - case IW_ENCODE_ALG_WEP: - if (iwe->key_len == WEP1_KEY_SIZE) - key.algo = CRYPTO_ALGO_WEP1; - else - key.algo = CRYPTO_ALGO_WEP128; - break; - case IW_ENCODE_ALG_TKIP: - key.algo = CRYPTO_ALGO_TKIP; - break; - case IW_ENCODE_ALG_CCMP: - key.algo = CRYPTO_ALGO_AES_CCM; - break; - case IW_ENCODE_ALG_SM4: - key.algo = CRYPTO_ALGO_SMS4; - if (iwe->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - key.flags &= ~WL_PRIMARY_KEY; - } - break; - default: - break; - } - swap_key_from_BE(&key); - - dhd_wait_pend8021x(dev); - - error = dev_wlc_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)); - if (error) - return error; - } - return 0; -} - -#if WIRELESS_EXT > 17 -#ifdef BCMWPA2 -struct { - pmkid_list_t pmkids; - pmkid_t foo[MAXPMKID-1]; -} pmkid_list; - -static int -wl_iw_set_pmksa( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - struct iw_pmksa *iwpmksa; - uint i; - int ret = 0; - char eabuf[ETHER_ADDR_STR_LEN]; - - WL_WSEC(("%s: SIOCSIWPMKSA\n", dev->name)); - CHECK_EXTRA_FOR_NULL(extra); - - iwpmksa = (struct iw_pmksa *)extra; - bzero((char *)eabuf, ETHER_ADDR_STR_LEN); - - if (iwpmksa->cmd == IW_PMKSA_FLUSH) { - WL_WSEC(("wl_iw_set_pmksa - IW_PMKSA_FLUSH\n")); - bzero((char *)&pmkid_list, sizeof(pmkid_list)); - } - - else if (iwpmksa->cmd == IW_PMKSA_REMOVE) { - { - pmkid_list_t pmkid, *pmkidptr; - uint j; - pmkidptr = &pmkid; - - bcopy(&iwpmksa->bssid.sa_data[0], &pmkidptr->pmkid[0].BSSID, ETHER_ADDR_LEN); - bcopy(&iwpmksa->pmkid[0], &pmkidptr->pmkid[0].PMKID, WPA2_PMKID_LEN); - - WL_WSEC(("wl_iw_set_pmksa,IW_PMKSA_REMOVE - PMKID: %s = ", - bcm_ether_ntoa(&pmkidptr->pmkid[0].BSSID, - eabuf))); - for (j = 0; j < WPA2_PMKID_LEN; j++) - WL_WSEC(("%02x ", pmkidptr->pmkid[0].PMKID[j])); - WL_WSEC(("\n")); - } - - for (i = 0; i < pmkid_list.pmkids.npmkid; i++) - if (!bcmp(&iwpmksa->bssid.sa_data[0], &pmkid_list.pmkids.pmkid[i].BSSID, - ETHER_ADDR_LEN)) - break; - - if ((pmkid_list.pmkids.npmkid > 0) && (i < pmkid_list.pmkids.npmkid)) { - bzero(&pmkid_list.pmkids.pmkid[i], sizeof(pmkid_t)); - for (; i < (pmkid_list.pmkids.npmkid - 1); i++) { - bcopy(&pmkid_list.pmkids.pmkid[i+1].BSSID, - &pmkid_list.pmkids.pmkid[i].BSSID, - ETHER_ADDR_LEN); - bcopy(&pmkid_list.pmkids.pmkid[i+1].PMKID, - &pmkid_list.pmkids.pmkid[i].PMKID, - WPA2_PMKID_LEN); - } - pmkid_list.pmkids.npmkid--; - } - else - ret = -EINVAL; - } - - else if (iwpmksa->cmd == IW_PMKSA_ADD) { - for (i = 0; i < pmkid_list.pmkids.npmkid; i++) - if (!bcmp(&iwpmksa->bssid.sa_data[0], &pmkid_list.pmkids.pmkid[i].BSSID, - ETHER_ADDR_LEN)) - break; - if (i < MAXPMKID) { - bcopy(&iwpmksa->bssid.sa_data[0], - &pmkid_list.pmkids.pmkid[i].BSSID, - ETHER_ADDR_LEN); - bcopy(&iwpmksa->pmkid[0], &pmkid_list.pmkids.pmkid[i].PMKID, - WPA2_PMKID_LEN); - if (i == pmkid_list.pmkids.npmkid) - pmkid_list.pmkids.npmkid++; - } - else - ret = -EINVAL; - - { - uint j; - uint k; - k = pmkid_list.pmkids.npmkid; - WL_WSEC(("wl_iw_set_pmksa,IW_PMKSA_ADD - PMKID: %s = ", - bcm_ether_ntoa(&pmkid_list.pmkids.pmkid[k].BSSID, - eabuf))); - for (j = 0; j < WPA2_PMKID_LEN; j++) - WL_WSEC(("%02x ", pmkid_list.pmkids.pmkid[k].PMKID[j])); - WL_WSEC(("\n")); - } - } - WL_WSEC(("PRINTING pmkid LIST - No of elements %d, ret = %d\n", pmkid_list.pmkids.npmkid, ret)); - for (i = 0; i < pmkid_list.pmkids.npmkid; i++) { - uint j; - WL_WSEC(("PMKID[%d]: %s = ", i, - bcm_ether_ntoa(&pmkid_list.pmkids.pmkid[i].BSSID, - eabuf))); - for (j = 0; j < WPA2_PMKID_LEN; j++) - WL_WSEC(("%02x ", pmkid_list.pmkids.pmkid[i].PMKID[j])); - WL_WSEC(("\n")); - } - WL_WSEC(("\n")); - - if (!ret) - ret = dev_wlc_bufvar_set(dev, "pmkid_info", (char *)&pmkid_list, sizeof(pmkid_list)); - return ret; -} -#endif -#endif - -static int -wl_iw_get_encodeext( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - WL_WSEC(("%s: SIOCGIWENCODEEXT\n", dev->name)); - return 0; -} - -static int -wl_iw_set_wpaauth( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - int error = 0; - int paramid; - int paramval; - int val = 0; - wl_iw_t *iw = *(wl_iw_t **)netdev_priv(dev); - - WL_WSEC(("%s: SIOCSIWAUTH\n", dev->name)); - -#if defined(SOFTAP) - if (ap_cfg_running) { - WL_TRACE(("%s: Not executed, reason -'SOFTAP is active'\n", __FUNCTION__)); - return 0; - } -#endif - - paramid = vwrq->flags & IW_AUTH_INDEX; - paramval = vwrq->value; - - WL_WSEC(("%s: SIOCSIWAUTH, paramid = 0x%0x, paramval = 0x%0x\n", - dev->name, paramid, paramval)); - - switch (paramid) { - case IW_AUTH_WPA_VERSION: - - if (paramval & IW_AUTH_WPA_VERSION_DISABLED) - val = WPA_AUTH_DISABLED; - else if (paramval & (IW_AUTH_WPA_VERSION_WPA)) - val = WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED; -#ifdef BCMWPA2 - else if (paramval & IW_AUTH_WPA_VERSION_WPA2) - val = WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED; -#endif - else if (paramval & IW_AUTH_WAPI_VERSION_1) - val = WPA_AUTH_WAPI; - WL_WSEC(("%s: %d: setting wpa_auth to 0x%0x\n", __FUNCTION__, __LINE__, val)); - if ((error = dev_wlc_intvar_set(dev, "wpa_auth", val))) - return error; - break; - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - - - if (paramval & (IW_AUTH_CIPHER_WEP40 | IW_AUTH_CIPHER_WEP104)) - val = WEP_ENABLED; - if (paramval & IW_AUTH_CIPHER_TKIP) - val = TKIP_ENABLED; - if (paramval & IW_AUTH_CIPHER_CCMP) - val = AES_ENABLED; - if (paramval & IW_AUTH_CIPHER_SMS4) - val = SMS4_ENABLED; - - if (paramid == IW_AUTH_CIPHER_PAIRWISE) { - iw->pwsec = val; - val |= iw->gwsec; - } - else { - iw->gwsec = val; - val |= iw->pwsec; - } - - if (iw->privacy_invoked && !val) { - WL_WSEC(("%s: %s: 'Privacy invoked' TRUE but clearing wsec, assuming " - "we're a WPS enrollee\n", dev->name, __FUNCTION__)); - if ((error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", TRUE))) { - WL_ERROR(("Failed to set iovar is_WPS_enrollee\n")); - return error; - } - } else if (val) { - if ((error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", FALSE))) { - WL_ERROR(("Failed to clear iovar is_WPS_enrollee\n")); - return error; - } - } - - if ((error = dev_wlc_intvar_set(dev, "wsec", val))) { - WL_ERROR(("Failed to set 'wsec'iovar\n")); - return error; - } - - break; - - case IW_AUTH_KEY_MGMT: - if ((error = dev_wlc_intvar_get(dev, "wpa_auth", &val))) { - WL_ERROR(("Failed to get 'wpa_auth'iovar\n")); - return error; - } - - if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) { - if (paramval & IW_AUTH_KEY_MGMT_PSK) - val = WPA_AUTH_PSK; - else - val = WPA_AUTH_UNSPECIFIED; - } -#ifdef BCMWPA2 - else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) { - if (paramval & IW_AUTH_KEY_MGMT_PSK) - val = WPA2_AUTH_PSK; - else - val = WPA2_AUTH_UNSPECIFIED; - } -#endif - if (paramval & (IW_AUTH_KEY_MGMT_WAPI_PSK | IW_AUTH_KEY_MGMT_WAPI_CERT)) - val = WPA_AUTH_WAPI; - WL_WSEC(("%s: %d: setting wpa_auth to %d\n", __FUNCTION__, __LINE__, val)); - if ((error = dev_wlc_intvar_set(dev, "wpa_auth", val))) { - WL_ERROR(("Failed to set 'wpa_auth'iovar\n")); - return error; - } - - break; - case IW_AUTH_TKIP_COUNTERMEASURES: - if ((error = dev_wlc_bufvar_set(dev, "tkip_countermeasures", \ - (char *)¶mval, sizeof(paramval)))) - WL_WSEC(("%s: tkip_countermeasures failed %d\n", __FUNCTION__, error)); - break; - - case IW_AUTH_80211_AUTH_ALG: - - WL_WSEC(("Setting the D11auth %d\n", paramval)); - if (paramval == IW_AUTH_ALG_OPEN_SYSTEM) - val = 0; - else if (paramval == IW_AUTH_ALG_SHARED_KEY) - val = 1; - else if (paramval == (IW_AUTH_ALG_OPEN_SYSTEM | IW_AUTH_ALG_SHARED_KEY)) - val = 2; - else - error = 1; - if (!error && (error = dev_wlc_intvar_set(dev, "auth", val))) - return error; - break; - - case IW_AUTH_WPA_ENABLED: - if (paramval == 0) { - iw->pwsec = 0; - iw->gwsec = 0; - if ((error = dev_wlc_intvar_get(dev, "wsec", &val))) { - WL_ERROR(("Failed to get 'wsec'iovar\n")); - return error; - } - if (val & (TKIP_ENABLED | AES_ENABLED)) { - val &= ~(TKIP_ENABLED | AES_ENABLED); - dev_wlc_intvar_set(dev, "wsec", val); - } - val = 0; - - WL_INFORM(("%s: %d: setting wpa_auth to %d\n", - __FUNCTION__, __LINE__, val)); - error = dev_wlc_intvar_set(dev, "wpa_auth", 0); - if (error) - WL_ERROR(("Failed to set 'wpa_auth'iovar\n")); - return error; - } - - - break; - - case IW_AUTH_DROP_UNENCRYPTED: - error = dev_wlc_bufvar_set(dev, "wsec_restrict", \ - (char *)¶mval, sizeof(paramval)); - if (error) - WL_ERROR(("%s: wsec_restrict %d\n", __FUNCTION__, error)); - break; - - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - error = dev_wlc_bufvar_set(dev, "rx_unencrypted_eapol", \ - (char *)¶mval, sizeof(paramval)); - if (error) - WL_WSEC(("%s: rx_unencrypted_eapol %d\n", __FUNCTION__, error)); - break; - -#if WIRELESS_EXT > 17 - case IW_AUTH_ROAMING_CONTROL: - WL_INFORM(("%s: IW_AUTH_ROAMING_CONTROL\n", __FUNCTION__)); - - break; - case IW_AUTH_PRIVACY_INVOKED: { - int wsec; - - if (paramval == 0) { - iw->privacy_invoked = FALSE; - if ((error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", FALSE))) { - WL_WSEC(("Failed to clear iovar is_WPS_enrollee\n")); - return error; - } - } else { - iw->privacy_invoked = TRUE; - if ((error = dev_wlc_intvar_get(dev, "wsec", &wsec))) - return error; - - if (!(IW_WSEC_ENABLED(wsec))) { - - if ((error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", TRUE))) { - WL_WSEC(("Failed to set iovar is_WPS_enrollee\n")); - return error; - } - } else { - if ((error = dev_wlc_intvar_set(dev, "is_WPS_enrollee", FALSE))) { - WL_WSEC(("Failed to clear iovar is_WPS_enrollee\n")); - return error; - } - } - } - break; - } -#endif - case IW_AUTH_WAPI_ENABLED: - if ((error = dev_wlc_intvar_get(dev, "wsec", &val))) - return error; - if (paramval) { - val |= SMS4_ENABLED; - if ((error = dev_wlc_intvar_set(dev, "wsec", val))) { - WL_ERROR(("%s: setting wsec to 0x%0x returned error %d\n", - __FUNCTION__, val, error)); - return error; - } - if ((error = dev_wlc_intvar_set(dev, "wpa_auth", WPA_AUTH_WAPI))) { - WL_ERROR(("%s: setting wpa_auth(WPA_AUTH_WAPI) returned %d\n", - __FUNCTION__, error)); - return error; - } - } - - break; - default: - break; - } - return 0; -} -#ifdef BCMWPA2 -#define VAL_PSK(_val) (((_val) & WPA_AUTH_PSK) || ((_val) & WPA2_AUTH_PSK)) -#else -#define VAL_PSK(_val) (((_val) & WPA_AUTH_PSK)) -#endif - -static int -wl_iw_get_wpaauth( - struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, - char *extra -) -{ - int error; - int paramid; - int paramval = 0; - int val; - wl_iw_t *iw = *(wl_iw_t **)netdev_priv(dev); - - WL_TRACE(("%s: SIOCGIWAUTH\n", dev->name)); - - paramid = vwrq->flags & IW_AUTH_INDEX; - - switch (paramid) { - case IW_AUTH_WPA_VERSION: - - if ((error = dev_wlc_intvar_get(dev, "wpa_auth", &val))) - return error; - if (val & (WPA_AUTH_NONE | WPA_AUTH_DISABLED)) - paramval = IW_AUTH_WPA_VERSION_DISABLED; - else if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) - paramval = IW_AUTH_WPA_VERSION_WPA; -#ifdef BCMWPA2 - else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) - paramval = IW_AUTH_WPA_VERSION_WPA2; -#endif - break; - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - if (paramid == IW_AUTH_CIPHER_PAIRWISE) - val = iw->pwsec; - else - val = iw->gwsec; - - paramval = 0; - if (val) { - if (val & WEP_ENABLED) - paramval |= (IW_AUTH_CIPHER_WEP40 | IW_AUTH_CIPHER_WEP104); - if (val & TKIP_ENABLED) - paramval |= (IW_AUTH_CIPHER_TKIP); - if (val & AES_ENABLED) - paramval |= (IW_AUTH_CIPHER_CCMP); - } - else - paramval = IW_AUTH_CIPHER_NONE; - break; - case IW_AUTH_KEY_MGMT: - - if ((error = dev_wlc_intvar_get(dev, "wpa_auth", &val))) - return error; - if (VAL_PSK(val)) - paramval = IW_AUTH_KEY_MGMT_PSK; - else - paramval = IW_AUTH_KEY_MGMT_802_1X; - - break; - case IW_AUTH_TKIP_COUNTERMEASURES: - error = dev_wlc_bufvar_get(dev, "tkip_countermeasures", \ - (char *)¶mval, sizeof(paramval)); - if (error) - WL_ERROR(("%s get tkip_countermeasures %d\n", __FUNCTION__, error)); - break; - - case IW_AUTH_DROP_UNENCRYPTED: - error = dev_wlc_bufvar_get(dev, "wsec_restrict", \ - (char *)¶mval, sizeof(paramval)); - if (error) - WL_ERROR(("%s get wsec_restrict %d\n", __FUNCTION__, error)); - break; - - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - error = dev_wlc_bufvar_get(dev, "rx_unencrypted_eapol", \ - (char *)¶mval, sizeof(paramval)); - if (error) - WL_ERROR(("%s get rx_unencrypted_eapol %d\n", __FUNCTION__, error)); - break; - - case IW_AUTH_80211_AUTH_ALG: - - if ((error = dev_wlc_intvar_get(dev, "auth", &val))) - return error; - if (!val) - paramval = IW_AUTH_ALG_OPEN_SYSTEM; - else - paramval = IW_AUTH_ALG_SHARED_KEY; - break; - case IW_AUTH_WPA_ENABLED: - if ((error = dev_wlc_intvar_get(dev, "wpa_auth", &val))) - return error; - if (val) - paramval = TRUE; - else - paramval = FALSE; - break; -#if WIRELESS_EXT > 17 - case IW_AUTH_ROAMING_CONTROL: - WL_ERROR(("%s: IW_AUTH_ROAMING_CONTROL\n", __FUNCTION__)); - - break; - case IW_AUTH_PRIVACY_INVOKED: - paramval = iw->privacy_invoked; - break; -#endif - } - vwrq->value = paramval; - return 0; -} -#endif - - -#ifdef SOFTAP - -static int ap_macmode = MACLIST_MODE_DISABLED; -static struct mflist ap_black_list; -static int -wl_iw_parse_wep(char *keystr, wl_wsec_key_t *key) -{ - char hex[] = "XX"; - unsigned char *data = key->data; - - switch (strlen(keystr)) { - case 5: - case 13: - case 16: - key->len = strlen(keystr); - memcpy(data, keystr, key->len + 1); - break; - case 12: - case 28: - case 34: - case 66: - if (!strnicmp(keystr, "0x", 2)) - keystr += 2; - else - return -1; - case 10: - case 26: - case 32: - case 64: - key->len = strlen(keystr) / 2; - while (*keystr) { - strncpy(hex, keystr, 2); - *data++ = (char) bcm_strtoul(hex, NULL, 16); - keystr += 2; - } - break; - default: - return -1; - } - - switch (key->len) { - case 5: - key->algo = CRYPTO_ALGO_WEP1; - break; - case 13: - key->algo = CRYPTO_ALGO_WEP128; - break; - case 16: - key->algo = CRYPTO_ALGO_AES_CCM; - break; - case 32: - key->algo = CRYPTO_ALGO_TKIP; - break; - default: - return -1; - } - - key->flags |= WL_PRIMARY_KEY; - - return 0; -} - -#ifdef EXT_WPA_CRYPTO -#define SHA1HashSize 20 -extern void pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len, - int iterations, u8 *buf, size_t buflen); - -#else - -#define SHA1HashSize 20 -int pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len, - int iterations, u8 *buf, size_t buflen) -{ - WL_ERROR(("WARNING: %s is not implemented !!!\n", __FUNCTION__)); - return -1; -} - -#endif - - -int dev_iw_write_cfg1_bss_var(struct net_device *dev, int val) -{ - struct { - int cfg; - int val; - } bss_setbuf; - - int bss_set_res; - char smbuf[WLC_IOCTL_SMLEN]; - memset(smbuf, 0, sizeof(smbuf)); - - bss_setbuf.cfg = 1; - bss_setbuf.val = val; - - bss_set_res = dev_iw_iovar_setbuf(dev, "bss", - &bss_setbuf, sizeof(bss_setbuf), smbuf, sizeof(smbuf)); - WL_TRACE(("%s: bss_set_result:%d set with %d\n", __FUNCTION__, bss_set_res, val)); - - return bss_set_res; -} - - -int dev_iw_read_cfg1_bss_var(struct net_device *dev, int *val) -{ - int bsscfg_idx = 1; - int bss_set_res; - char smbuf[WLC_IOCTL_SMLEN]; - memset(smbuf, 0, sizeof(smbuf)); - - bss_set_res = dev_iw_iovar_getbuf(dev, "bss", \ - &bsscfg_idx, sizeof(bsscfg_idx), smbuf, sizeof(smbuf)); - *val = *(int*)smbuf; - *val = dtoh32(*val); - WL_TRACE(("%s: status=%d bss_get_result=%d\n", __FUNCTION__, bss_set_res, *val)); - return bss_set_res; -} - - -#ifndef AP_ONLY -static int wl_bssiovar_mkbuf( - const char *iovar, - int bssidx, - void *param, - int paramlen, - void *bufptr, - int buflen, - int *perr) -{ - const char *prefix = "bsscfg:"; - int8 *p; - uint prefixlen; - uint namelen; - uint iolen; - - prefixlen = strlen(prefix); - namelen = strlen(iovar) + 1; - iolen = prefixlen + namelen + sizeof(int) + paramlen; - - if (buflen < 0 || iolen > (uint)buflen) { - *perr = BCME_BUFTOOSHORT; - return 0; - } - - p = (int8 *)bufptr; - - memcpy(p, prefix, prefixlen); - p += prefixlen; - - memcpy(p, iovar, namelen); - p += namelen; - - bssidx = htod32(bssidx); - memcpy(p, &bssidx, sizeof(int32)); - p += sizeof(int32); - - if (paramlen) - memcpy(p, param, paramlen); - - *perr = 0; - return iolen; -} -#endif - - -int get_user_params(char *user_params, struct iw_point *dwrq) -{ - int ret = 0; - - if (copy_from_user(user_params, dwrq->pointer, dwrq->length)) { - WL_ERROR(("\n%s: no user params: uptr:%p, ulen:%d\n", - __FUNCTION__, dwrq->pointer, dwrq->length)); - return -EFAULT; - } - - WL_TRACE(("\n%s: iwpriv user params:%s\n", __FUNCTION__, user_params)); - - return ret; -} - - -#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base)) - -#if defined(CSCAN) - -static int -wl_iw_combined_scan_set(struct net_device *dev, wlc_ssid_t* ssids_local, int nssid, int nchan) -{ - int params_size = WL_SCAN_PARAMS_FIXED_SIZE + WL_NUMCHANNELS * sizeof(uint16); - int err = 0; - char *p; - int i; - iscan_info_t *iscan = g_iscan; - - WL_SCAN(("%s nssid=%d nchan=%d\n", __FUNCTION__, nssid, nchan)); - - if ((!dev) && (!g_iscan) && (!iscan->iscan_ex_params_p)) { - WL_ERROR(("%s error exit\n", __FUNCTION__)); - err = -1; - goto exit; - } - -#ifdef PNO_SUPPORT - if (dhd_dev_get_pno_status(dev)) { - WL_ERROR(("%s: Scan called when PNO is active\n", __FUNCTION__)); - } -#endif - - params_size += WL_SCAN_PARAMS_SSID_MAX * sizeof(wlc_ssid_t); - - if (nssid > 0) { - i = OFFSETOF(wl_scan_params_t, channel_list) + nchan * sizeof(uint16); - i = ROUNDUP(i, sizeof(uint32)); - if (i + nssid * sizeof(wlc_ssid_t) > params_size) { - printf("additional ssids exceed params_size\n"); - err = -1; - goto exit; - } - - p = ((char*)&iscan->iscan_ex_params_p->params) + i; - memcpy(p, ssids_local, nssid * sizeof(wlc_ssid_t)); - p += nssid * sizeof(wlc_ssid_t); - } else { - p = (char*)iscan->iscan_ex_params_p->params.channel_list + nchan * sizeof(uint16); - } - - iscan->iscan_ex_params_p->params.channel_num = \ - htod32((nssid << WL_SCAN_PARAMS_NSSID_SHIFT) | \ - (nchan & WL_SCAN_PARAMS_COUNT_MASK)); - - nssid = \ - (uint)((iscan->iscan_ex_params_p->params.channel_num >> WL_SCAN_PARAMS_NSSID_SHIFT) & \ - WL_SCAN_PARAMS_COUNT_MASK); - - params_size = (int) (p - (char*)iscan->iscan_ex_params_p + nssid * sizeof(wlc_ssid_t)); - iscan->iscan_ex_param_size = params_size; - - iscan->list_cur = iscan->list_hdr; - iscan->iscan_state = ISCAN_STATE_SCANING; - wl_iw_set_event_mask(dev); - mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000); - - iscan->timer_on = 1; - -#ifdef SCAN_DUMP - { - int i; - WL_SCAN(("\n### List of SSIDs to scan ###\n")); - for (i = 0; i < nssid; i++) { - if (!ssids_local[i].SSID_len) - WL_SCAN(("%d: Broadcast scan\n", i)); - else - WL_SCAN(("%d: scan for %s size =%d\n", i, \ - ssids_local[i].SSID, ssids_local[i].SSID_len)); - } - WL_SCAN(("### List of channels to scan ###\n")); - for (i = 0; i < nchan; i++) - { - WL_SCAN(("%d ", iscan->iscan_ex_params_p->params.channel_list[i])); - } - WL_SCAN(("\nnprobes=%d\n", iscan->iscan_ex_params_p->params.nprobes)); - WL_SCAN(("active_time=%d\n", iscan->iscan_ex_params_p->params.active_time)); - WL_SCAN(("passive_time=%d\n", iscan->iscan_ex_params_p->params.passive_time)); - WL_SCAN(("home_time=%d\n", iscan->iscan_ex_params_p->params.home_time)); - WL_SCAN(("scan_type=%d\n", iscan->iscan_ex_params_p->params.scan_type)); - WL_SCAN(("\n###################\n")); - } -#endif - - if (params_size > WLC_IOCTL_MEDLEN) { - WL_ERROR(("Set ISCAN for %s due to params_size=%d \n", \ - __FUNCTION__, params_size)); - err = -1; - } - - if ((err = dev_iw_iovar_setbuf(dev, "iscan", iscan->iscan_ex_params_p, \ - iscan->iscan_ex_param_size, \ - iscan->ioctlbuf, sizeof(iscan->ioctlbuf)))) { - WL_ERROR(("Set ISCAN for %s failed with %d\n", __FUNCTION__, err)); - err = -1; - } - -exit: - - return err; -} - - -static int iwpriv_set_cscan(struct net_device *dev, struct iw_request_info *info, \ - union iwreq_data *wrqu, char *ext) -{ - int res = 0; - char *extra = NULL; - iscan_info_t *iscan = g_iscan; - wlc_ssid_t ssids_local[WL_SCAN_PARAMS_SSID_MAX]; - int nssid = 0; - int nchan = 0; - - WL_TRACE(("\%s: info->cmd:%x, info->flags:%x, u.data=0x%p, u.len=%d\n", - __FUNCTION__, info->cmd, info->flags, - wrqu->data.pointer, wrqu->data.length)); - - if (g_onoff == G_WLAN_SET_OFF) { - WL_TRACE(("%s: driver is not up yet after START\n", __FUNCTION__)); - return -1; - } - - if (wrqu->data.length != 0) { - - char *str_ptr; - - if (!iscan->iscan_ex_params_p) { - return -EFAULT; - } - - if (!(extra = kmalloc(wrqu->data.length+1, GFP_KERNEL))) - return -ENOMEM; - - if (copy_from_user(extra, wrqu->data.pointer, wrqu->data.length)) { - kfree(extra); - return -EFAULT; - } - - extra[wrqu->data.length] = 0; - WL_ERROR(("Got str param in iw_point:\n %s\n", extra)); - - str_ptr = extra; - - if (strncmp(str_ptr, GET_SSID, strlen(GET_SSID))) { - WL_ERROR(("%s Error: extracting SSID='' string\n", __FUNCTION__)); - goto exit_proc; - } - str_ptr += strlen(GET_SSID); - nssid = wl_iw_parse_ssid_list(&str_ptr, ssids_local, nssid, \ - WL_SCAN_PARAMS_SSID_MAX); - if (nssid == -1) { - WL_ERROR(("%s wrong ssid list", __FUNCTION__)); - return -1; - } - - if (iscan->iscan_ex_param_size > WLC_IOCTL_MAXLEN) { - WL_ERROR(("%s wrong ex_param_size %d", \ - __FUNCTION__, iscan->iscan_ex_param_size)); - return -1; - } - memset(iscan->iscan_ex_params_p, 0, iscan->iscan_ex_param_size); - - - wl_iw_iscan_prep(&iscan->iscan_ex_params_p->params, NULL); - iscan->iscan_ex_params_p->version = htod32(ISCAN_REQ_VERSION); - iscan->iscan_ex_params_p->action = htod16(WL_SCAN_ACTION_START); - iscan->iscan_ex_params_p->scan_duration = htod16(0); - - - if ((nchan = wl_iw_parse_channel_list(&str_ptr, \ - &iscan->iscan_ex_params_p->params.channel_list[0], \ - WL_NUMCHANNELS)) == -1) { - WL_ERROR(("%s missing channel list\n", __FUNCTION__)); - return -1; - } - - - get_parmeter_from_string(&str_ptr, \ - GET_NPROBE, PTYPE_INTDEC, \ - &iscan->iscan_ex_params_p->params.nprobes, 2); - - get_parmeter_from_string(&str_ptr, GET_ACTIVE_ASSOC_DWELL, PTYPE_INTDEC, \ - &iscan->iscan_ex_params_p->params.active_time, 4); - - get_parmeter_from_string(&str_ptr, GET_PASSIVE_ASSOC_DWELL, PTYPE_INTDEC, \ - &iscan->iscan_ex_params_p->params.passive_time, 4); - - get_parmeter_from_string(&str_ptr, GET_HOME_DWELL, PTYPE_INTDEC, \ - &iscan->iscan_ex_params_p->params.home_time, 4); - - get_parmeter_from_string(&str_ptr, GET_SCAN_TYPE, PTYPE_INTDEC, \ - &iscan->iscan_ex_params_p->params.scan_type, 1); - - res = wl_iw_combined_scan_set(dev, ssids_local, nssid, nchan); - - } else { - WL_ERROR(("IWPRIV argument len = 0 \n")); - return -1; - } - -exit_proc: - - kfree(extra); - - return res; -} - - -static int -wl_iw_set_cscan( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra -) -{ - int res = -1; - iscan_info_t *iscan = g_iscan; - wlc_ssid_t ssids_local[WL_SCAN_PARAMS_SSID_MAX]; - int nssid = 0; - int nchan = 0; - cscan_tlv_t *cscan_tlv_temp; - char type; - char *str_ptr; - int tlv_size_left; -#ifdef TLV_DEBUG - int i; - char tlv_in_example[] = { 'C', 'S', 'C', 'A', 'N', ' ', \ - 0x53, 0x01, 0x00, 0x00, - 'S', - 0x00, - 'S', - 0x04, - 'B', 'R', 'C', 'M', - 'C', - 0x06, - 'P', - 0x94, - 0x11, - 'T', - 0x01 - }; -#endif - - WL_TRACE(("\n### %s: info->cmd:%x, info->flags:%x, u.data=0x%p, u.len=%d\n", - __FUNCTION__, info->cmd, info->flags, - wrqu->data.pointer, wrqu->data.length)); - - net_os_wake_lock(dev); - - if (g_onoff == G_WLAN_SET_OFF) { - WL_TRACE(("%s: driver is not up yet after START\n", __FUNCTION__)); - goto exit_proc; - } - - - if (wrqu->data.length < (strlen(CSCAN_COMMAND) + sizeof(cscan_tlv_t))) { - WL_ERROR(("%s aggument=%d less %d\n", __FUNCTION__, \ - wrqu->data.length, strlen(CSCAN_COMMAND) + sizeof(cscan_tlv_t))); - goto exit_proc; - } - -#ifdef TLV_DEBUG - memcpy(extra, tlv_in_example, sizeof(tlv_in_example)); - wrqu->data.length = sizeof(tlv_in_example); - for (i = 0; i < wrqu->data.length; i++) - printf("%02X ", extra[i]); - printf("\n"); -#endif - - str_ptr = extra; - str_ptr += strlen(CSCAN_COMMAND); - tlv_size_left = wrqu->data.length - strlen(CSCAN_COMMAND); - - cscan_tlv_temp = (cscan_tlv_t *)str_ptr; - memset(ssids_local, 0, sizeof(ssids_local)); - - if ((cscan_tlv_temp->prefix == CSCAN_TLV_PREFIX) && \ - (cscan_tlv_temp->version == CSCAN_TLV_VERSION) && \ - (cscan_tlv_temp->subver == CSCAN_TLV_SUBVERSION)) - { - str_ptr += sizeof(cscan_tlv_t); - tlv_size_left -= sizeof(cscan_tlv_t); - - - if ((nssid = wl_iw_parse_ssid_list_tlv(&str_ptr, ssids_local, \ - WL_SCAN_PARAMS_SSID_MAX, &tlv_size_left)) <= 0) { - WL_ERROR(("SSID is not presented or corrupted ret=%d\n", nssid)); - goto exit_proc; - } - else { - - memset(iscan->iscan_ex_params_p, 0, iscan->iscan_ex_param_size); - - - wl_iw_iscan_prep(&iscan->iscan_ex_params_p->params, NULL); - iscan->iscan_ex_params_p->version = htod32(ISCAN_REQ_VERSION); - iscan->iscan_ex_params_p->action = htod16(WL_SCAN_ACTION_START); - iscan->iscan_ex_params_p->scan_duration = htod16(0); - - - while (tlv_size_left > 0) - { - type = str_ptr[0]; - switch (type) { - case CSCAN_TLV_TYPE_CHANNEL_IE: - - if ((nchan = wl_iw_parse_channel_list_tlv(&str_ptr, \ - &iscan->iscan_ex_params_p->params.channel_list[0], \ - WL_NUMCHANNELS, &tlv_size_left)) == -1) { - WL_ERROR(("%s missing channel list\n", \ - __FUNCTION__)); - goto exit_proc; - } - break; - case CSCAN_TLV_TYPE_NPROBE_IE: - if ((res = wl_iw_parse_data_tlv(&str_ptr, \ - &iscan->iscan_ex_params_p->params.nprobes, \ - sizeof(iscan->iscan_ex_params_p->params.nprobes), \ - type, sizeof(char), &tlv_size_left)) == -1) { - WL_ERROR(("%s return %d\n", \ - __FUNCTION__, res)); - goto exit_proc; - } - break; - case CSCAN_TLV_TYPE_ACTIVE_IE: - if ((res = wl_iw_parse_data_tlv(&str_ptr, \ - &iscan->iscan_ex_params_p->params.active_time, \ - sizeof(iscan->iscan_ex_params_p->params.active_time), \ - type, sizeof(short), &tlv_size_left)) == -1) { - WL_ERROR(("%s return %d\n", \ - __FUNCTION__, res)); - goto exit_proc; - } - break; - case CSCAN_TLV_TYPE_PASSIVE_IE: - if ((res = wl_iw_parse_data_tlv(&str_ptr, \ - &iscan->iscan_ex_params_p->params.passive_time, \ - sizeof(iscan->iscan_ex_params_p->params.passive_time), \ - type, sizeof(short), &tlv_size_left)) == -1) { - WL_ERROR(("%s return %d\n", \ - __FUNCTION__, res)); - goto exit_proc; - } - break; - case CSCAN_TLV_TYPE_HOME_IE: - if ((res = wl_iw_parse_data_tlv(&str_ptr, \ - &iscan->iscan_ex_params_p->params.home_time, \ - sizeof(iscan->iscan_ex_params_p->params.home_time), \ - type, sizeof(short), &tlv_size_left)) == -1) { - WL_ERROR(("%s return %d\n", \ - __FUNCTION__, res)); - goto exit_proc; - } - break; - case CSCAN_TLV_TYPE_STYPE_IE: - if ((res = wl_iw_parse_data_tlv(&str_ptr, \ - &iscan->iscan_ex_params_p->params.scan_type, \ - sizeof(iscan->iscan_ex_params_p->params.scan_type), \ - type, sizeof(char), &tlv_size_left)) == -1) { - WL_ERROR(("%s return %d\n", \ - __FUNCTION__, res)); - goto exit_proc; - } - break; - - default : - WL_ERROR(("%s get unkwown type %X\n", \ - __FUNCTION__, type)); - goto exit_proc; - break; - } - } - } - } - else { - WL_ERROR(("%s get wrong TLV command\n", __FUNCTION__)); - goto exit_proc; - } - -#if defined(CONFIG_FIRST_SCAN) - if (g_first_broadcast_scan < BROADCAST_SCAN_FIRST_RESULT_CONSUMED) { - if (++g_first_counter_scans == MAX_ALLOWED_BLOCK_SCAN_FROM_FIRST_SCAN) { - - WL_ERROR(("%s Clean up First scan flag which is %d\n", \ - __FUNCTION__, g_first_broadcast_scan)); - g_first_broadcast_scan = BROADCAST_SCAN_FIRST_RESULT_CONSUMED; - } - else { - WL_ERROR(("%s Ignoring CSCAN : First Scan is not done yet %d\n", \ - __FUNCTION__, g_first_counter_scans)); - res = -EBUSY; - goto exit_proc; - } - } -#endif - - res = wl_iw_combined_scan_set(dev, ssids_local, nssid, nchan); - -exit_proc: - net_os_wake_unlock(dev); - return res; -} - -#endif - -#ifdef SOFTAP -#ifndef AP_ONLY - -static int thr_wait_for_2nd_eth_dev(void *data) -{ - struct net_device *dev = (struct net_device *)data; - wl_iw_t *iw; - int ret = 0; - unsigned long flags; - - net_os_wake_lock(dev); - - DAEMONIZE("wl0_eth_wthread"); - - WL_TRACE(("\n>%s thread started:, PID:%x\n", __FUNCTION__, current->pid)); - iw = *(wl_iw_t **)netdev_priv(dev); - if (!iw) { - WL_ERROR(("%s: dev is null\n", __FUNCTION__)); - ret = -1; - goto fail; - } - -#ifndef BCMSDIOH_STD - if (down_timeout(&ap_eth_sema, msecs_to_jiffies(5000)) != 0) { - WL_ERROR(("\n%s: sap_eth_sema timeout \n", __FUNCTION__)); - ret = -1; - goto fail; - } -#endif - - flags = dhd_os_spin_lock(iw->pub); - if (!ap_net_dev) { - WL_ERROR((" ap_net_dev is null !!!")); - ret = -1; - dhd_os_spin_unlock(iw->pub, flags); - goto fail; - } - - WL_TRACE(("\n>%s: Thread:'softap ethdev IF:%s is detected !!!'\n\n", - __FUNCTION__, ap_net_dev->name)); - - ap_cfg_running = TRUE; - - dhd_os_spin_unlock(iw->pub, flags); - - bcm_mdelay(500); - - wl_iw_send_priv_event(priv_dev, "AP_SET_CFG_OK"); - -fail: - WL_TRACE(("\n>%s, thread completed\n", __FUNCTION__)); - - net_os_wake_unlock(dev); - - complete_and_exit(&ap_cfg_exited, 0); - return ret; -} -#endif -#ifndef AP_ONLY -static int last_auto_channel = 6; -#endif -static int get_softap_auto_channel(struct net_device *dev, struct ap_profile *ap) -{ - int chosen = 0; - wl_uint32_list_t request; - int rescan = 0; - int retry = 0; - int updown = 0; - int ret = 0; - wlc_ssid_t null_ssid; - int res = 0; -#ifndef AP_ONLY - int iolen = 0; - int mkvar_err = 0; - int bsscfg_index = 1; - char buf[WLC_IOCTL_SMLEN]; -#endif - WL_SOFTAP(("Enter %s\n", __FUNCTION__)); - -#ifndef AP_ONLY - if (ap_cfg_running) { - ap->channel = last_auto_channel; - return res; - } -#endif - memset(&null_ssid, 0, sizeof(wlc_ssid_t)); - res |= dev_wlc_ioctl(dev, WLC_UP, &updown, sizeof(updown)); -#ifdef AP_ONLY - res |= dev_wlc_ioctl(dev, WLC_SET_SSID, &null_ssid, sizeof(null_ssid)); -#else - iolen = wl_bssiovar_mkbuf("ssid", bsscfg_index, (char *)(&null_ssid), \ - null_ssid.SSID_len+4, buf, sizeof(buf), &mkvar_err); - ASSERT(iolen); - res |= dev_wlc_ioctl(dev, WLC_SET_VAR, buf, iolen); -#endif - auto_channel_retry: - request.count = htod32(0); - ret = dev_wlc_ioctl(dev, WLC_START_CHANNEL_SEL, &request, sizeof(request)); - if (ret < 0) { - WL_ERROR(("can't start auto channel scan\n")); - goto fail; - } - - get_channel_retry: - bcm_mdelay(500); - - ret = dev_wlc_ioctl(dev, WLC_GET_CHANNEL_SEL, &chosen, sizeof(chosen)); - if (ret < 0 || dtoh32(chosen) == 0) { - if (retry++ < 3) - goto get_channel_retry; - else { - WL_ERROR(("can't get auto channel sel, err = %d, \ - chosen = %d\n", ret, chosen)); - goto fail; - } - } - if ((chosen == 1) && (!rescan++)) - goto auto_channel_retry; - WL_SOFTAP(("Set auto channel = %d\n", chosen)); - ap->channel = chosen; - if ((res = dev_wlc_ioctl(dev, WLC_DOWN, &updown, sizeof(updown))) < 0) { - WL_ERROR(("%s fail to set up err =%d\n", __FUNCTION__, res)); - goto fail; - } -#ifndef AP_ONLY - if (!res) - last_auto_channel = ap->channel; -#endif - -fail : - return res; -} - - -static int set_ap_cfg(struct net_device *dev, struct ap_profile *ap) -{ - int updown = 0; - int channel = 0; - - wlc_ssid_t ap_ssid; - int max_assoc = 8; - - int res = 0; - int apsta_var = 0; -#ifndef AP_ONLY - int mpc = 0; - int iolen = 0; - int mkvar_err = 0; - int bsscfg_index = 1; - char buf[WLC_IOCTL_SMLEN]; -#endif - - if (!dev) { - WL_ERROR(("%s: dev is null\n", __FUNCTION__)); - return -1; - } - - net_os_wake_lock(dev); - - WL_SOFTAP(("wl_iw: set ap profile:\n")); - WL_SOFTAP((" ssid = '%s'\n", ap->ssid)); - WL_SOFTAP((" security = '%s'\n", ap->sec)); - if (ap->key[0] != '\0') - WL_SOFTAP((" key = '%s'\n", ap->key)); - WL_SOFTAP((" channel = %d\n", ap->channel)); - WL_SOFTAP((" max scb = %d\n", ap->max_scb)); - -#ifdef AP_ONLY - if (ap_cfg_running) { - wl_iw_softap_deassoc_stations(dev, NULL); - ap_cfg_running = FALSE; - } -#endif - - if (ap_cfg_running == FALSE) { - -#ifndef AP_ONLY - sema_init(&ap_eth_sema, 0); - - mpc = 0; - if ((res = dev_wlc_intvar_set(dev, "mpc", mpc))) { - WL_ERROR(("%s fail to set mpc\n", __FUNCTION__)); - goto fail; - } -#endif - - updown = 0; - if ((res = dev_wlc_ioctl(dev, WLC_DOWN, &updown, sizeof(updown)))) { - WL_ERROR(("%s fail to set updown\n", __FUNCTION__)); - goto fail; - } - -#ifdef AP_ONLY - apsta_var = 0; - if ((res = dev_wlc_ioctl(dev, WLC_SET_AP, &apsta_var, sizeof(apsta_var)))) { - WL_ERROR(("%s fail to set apsta_var 0\n", __FUNCTION__)); - goto fail; - } - apsta_var = 1; - if ((res = dev_wlc_ioctl(dev, WLC_SET_AP, &apsta_var, sizeof(apsta_var)))) { - WL_ERROR(("%s fail to set apsta_var 1\n", __FUNCTION__)); - goto fail; - } - res = dev_wlc_ioctl(dev, WLC_GET_AP, &apsta_var, sizeof(apsta_var)); -#else - apsta_var = 1; - iolen = wl_bssiovar_mkbuf("apsta", - bsscfg_index, &apsta_var, sizeof(apsta_var)+4, - buf, sizeof(buf), &mkvar_err); - - if (iolen <= 0) - goto fail; - - if ((res = dev_wlc_ioctl(dev, WLC_SET_VAR, buf, iolen)) < 0) { - WL_ERROR(("%s fail to set apsta \n", __FUNCTION__)); - goto fail; - } - WL_TRACE(("\n>in %s: apsta set result: %d \n", __FUNCTION__, res)); -#endif - - updown = 1; - if ((res = dev_wlc_ioctl(dev, WLC_UP, &updown, sizeof(updown))) < 0) { - WL_ERROR(("%s fail to set apsta \n", __FUNCTION__)); - goto fail; - } - - } else { - - if (!ap_net_dev) { - WL_ERROR(("%s: ap_net_dev is null\n", __FUNCTION__)); - goto fail; - } - - res = wl_iw_softap_deassoc_stations(ap_net_dev, NULL); - - - if ((res = dev_iw_write_cfg1_bss_var(dev, 0)) < 0) { - WL_ERROR(("%s fail to set bss down\n", __FUNCTION__)); - goto fail; - } - } - - if (strlen(ap->country_code)) { - int error = 0; - if ((error = dev_wlc_ioctl(dev, WLC_SET_COUNTRY, - ap->country_code, sizeof(ap->country_code))) >= 0) { - WL_SOFTAP(("%s: set country %s OK\n", - __FUNCTION__, ap->country_code)); - dhd_bus_country_set(dev, &ap->country_code[0]); - } else { - WL_ERROR(("%s: ERROR:%d setting country %s\n", - __FUNCTION__, error, ap->country_code)); - } - } else { - WL_SOFTAP(("%s: Country code is not specified," - " will use Radio's default\n", - __FUNCTION__)); - } - - iolen = wl_bssiovar_mkbuf("closednet", - bsscfg_index, &ap->closednet, sizeof(ap->closednet)+4, - buf, sizeof(buf), &mkvar_err); - ASSERT(iolen); - if ((res = dev_wlc_ioctl(dev, WLC_SET_VAR, buf, iolen)) < 0) { - WL_ERROR(("%s failed to set 'closednet'for apsta \n", __FUNCTION__)); - goto fail; - } - - - if ((ap->channel == 0) && (get_softap_auto_channel(dev, ap) < 0)) { - ap->channel = 1; - WL_ERROR(("%s auto channel failed, pick up channel=%d\n", \ - __FUNCTION__, ap->channel)); - } - - channel = ap->channel; - if ((res = dev_wlc_ioctl(dev, WLC_SET_CHANNEL, &channel, sizeof(channel)))) { - WL_ERROR(("%s fail to set channel\n", __FUNCTION__)); - goto fail; - } - - if (ap_cfg_running == FALSE) { - updown = 0; - if ((res = dev_wlc_ioctl(dev, WLC_UP, &updown, sizeof(updown)))) { - WL_ERROR(("%s fail to set up\n", __FUNCTION__)); - goto fail; - } - } - - max_assoc = ap->max_scb; - if ((res = dev_wlc_intvar_set(dev, "maxassoc", max_assoc))) { - WL_ERROR(("%s fail to set maxassoc\n", __FUNCTION__)); - goto fail; - } - - ap_ssid.SSID_len = strlen(ap->ssid); - strncpy(ap_ssid.SSID, ap->ssid, ap_ssid.SSID_len); - -#ifdef AP_ONLY - if ((res = wl_iw_set_ap_security(dev, &my_ap)) != 0) { - WL_ERROR(("ERROR:%d in:%s, wl_iw_set_ap_security is skipped\n", \ - res, __FUNCTION__)); - goto fail; - } - wl_iw_send_priv_event(dev, "ASCII_CMD=AP_BSS_START"); - ap_cfg_running = TRUE; -#else - iolen = wl_bssiovar_mkbuf("ssid", bsscfg_index, (char *)(&ap_ssid), - ap_ssid.SSID_len+4, buf, sizeof(buf), &mkvar_err); - ASSERT(iolen); - if ((res = dev_wlc_ioctl(dev, WLC_SET_VAR, buf, iolen)) != 0) { - WL_ERROR(("ERROR:%d in:%s, Security & BSS reconfiguration is skipped\n", \ - res, __FUNCTION__)); - goto fail; - } - if (ap_cfg_running == FALSE) { - init_completion(&ap_cfg_exited); - ap_cfg_pid = kernel_thread(thr_wait_for_2nd_eth_dev, dev, 0); - } else { - ap_cfg_pid = -1; - if (ap_net_dev == NULL) { - WL_ERROR(("%s ERROR: ap_net_dev is NULL !!!\n", __FUNCTION__)); - goto fail; - } - - WL_ERROR(("%s: %s Configure security & restart AP bss \n", \ - __FUNCTION__, ap_net_dev->name)); - - if ((res = wl_iw_set_ap_security(ap_net_dev, &my_ap)) < 0) { - WL_ERROR(("%s fail to set security : %d\n", __FUNCTION__, res)); - goto fail; - } - - if ((res = dev_iw_write_cfg1_bss_var(dev, 1)) < 0) { - WL_ERROR(("%s fail to set bss up\n", __FUNCTION__)); - goto fail; - } - } -#endif -fail: - WL_SOFTAP(("%s exit with %d\n", __FUNCTION__, res)); - - net_os_wake_unlock(dev); - - return res; -} - - -static int wl_iw_set_ap_security(struct net_device *dev, struct ap_profile *ap) -{ - int wsec = 0; - int wpa_auth = 0; - int res = 0; - int i; - char *ptr; -#ifdef AP_ONLY - int mpc = 0; - wlc_ssid_t ap_ssid; -#endif - wl_wsec_key_t key; - - WL_SOFTAP(("\nsetting SOFTAP security mode:\n")); - WL_SOFTAP(("wl_iw: set ap profile:\n")); - WL_SOFTAP((" ssid = '%s'\n", ap->ssid)); - WL_SOFTAP((" security = '%s'\n", ap->sec)); - if (ap->key[0] != '\0') { - WL_SOFTAP((" key = '%s'\n", ap->key)); - } - WL_SOFTAP((" channel = %d\n", ap->channel)); - WL_SOFTAP((" max scb = %d\n", ap->max_scb)); - - if (strnicmp(ap->sec, "open", strlen("open")) == 0) { - wsec = 0; - res = dev_wlc_intvar_set(dev, "wsec", wsec); - wpa_auth = WPA_AUTH_DISABLED; - res |= dev_wlc_intvar_set(dev, "wpa_auth", wpa_auth); - - WL_SOFTAP(("=====================\n")); - WL_SOFTAP((" wsec & wpa_auth set 'OPEN', result:&d %d\n", res)); - WL_SOFTAP(("=====================\n")); - - } else if (strnicmp(ap->sec, "wep", strlen("wep")) == 0) { - - memset(&key, 0, sizeof(key)); - - wsec = WEP_ENABLED; - res = dev_wlc_intvar_set(dev, "wsec", wsec); - - key.index = 0; - if (wl_iw_parse_wep(ap->key, &key)) { - WL_SOFTAP(("wep key parse err!\n")); - return -1; - } - - key.index = htod32(key.index); - key.len = htod32(key.len); - key.algo = htod32(key.algo); - key.flags = htod32(key.flags); - - res |= dev_wlc_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)); - - wpa_auth = WPA_AUTH_DISABLED; - res |= dev_wlc_intvar_set(dev, "wpa_auth", wpa_auth); - - WL_SOFTAP(("=====================\n")); - WL_SOFTAP((" wsec & auth set 'WEP', result:&d %d\n", res)); - WL_SOFTAP(("=====================\n")); - - } else if (strnicmp(ap->sec, "wpa2-psk", strlen("wpa2-psk")) == 0) { - wsec_pmk_t psk; - size_t key_len; - - wsec = AES_ENABLED; - dev_wlc_intvar_set(dev, "wsec", wsec); - - key_len = strlen(ap->key); - if (key_len < WSEC_MIN_PSK_LEN || key_len > WSEC_MAX_PSK_LEN) { - WL_SOFTAP(("passphrase must be between %d and %d characters long\n", - WSEC_MIN_PSK_LEN, WSEC_MAX_PSK_LEN)); - return -1; - } - - if (key_len < WSEC_MAX_PSK_LEN) { - unsigned char output[2*SHA1HashSize]; - char key_str_buf[WSEC_MAX_PSK_LEN+1]; - - memset(output, 0, sizeof(output)); - pbkdf2_sha1(ap->key, ap->ssid, strlen(ap->ssid), 4096, output, 32); - - ptr = key_str_buf; - for (i = 0; i < (WSEC_MAX_PSK_LEN/8); i++) { - sprintf(ptr, "%02x%02x%02x%02x", (uint)output[i*4], \ - (uint)output[i*4+1], (uint)output[i*4+2], \ - (uint)output[i*4+3]); - ptr += 8; - } - WL_SOFTAP(("%s: passphase = %s\n", __FUNCTION__, key_str_buf)); - - psk.key_len = htod16((ushort)WSEC_MAX_PSK_LEN); - memcpy(psk.key, key_str_buf, psk.key_len); - } else { - psk.key_len = htod16((ushort) key_len); - memcpy(psk.key, ap->key, key_len); - } - psk.flags = htod16(WSEC_PASSPHRASE); - dev_wlc_ioctl(dev, WLC_SET_WSEC_PMK, &psk, sizeof(psk)); - - wpa_auth = WPA2_AUTH_PSK; - dev_wlc_intvar_set(dev, "wpa_auth", wpa_auth); - - } else if (strnicmp(ap->sec, "wpa-psk", strlen("wpa-psk")) == 0) { - - wsec_pmk_t psk; - size_t key_len; - - wsec = TKIP_ENABLED; - res = dev_wlc_intvar_set(dev, "wsec", wsec); - - key_len = strlen(ap->key); - if (key_len < WSEC_MIN_PSK_LEN || key_len > WSEC_MAX_PSK_LEN) { - WL_SOFTAP(("passphrase must be between %d and %d characters long\n", - WSEC_MIN_PSK_LEN, WSEC_MAX_PSK_LEN)); - return -1; - } - - if (key_len < WSEC_MAX_PSK_LEN) { - unsigned char output[2*SHA1HashSize]; - char key_str_buf[WSEC_MAX_PSK_LEN+1]; - bzero(output, 2*SHA1HashSize); - - WL_SOFTAP(("%s: do passhash...\n", __FUNCTION__)); - - pbkdf2_sha1(ap->key, ap->ssid, strlen(ap->ssid), 4096, output, 32); - - ptr = key_str_buf; - for (i = 0; i < (WSEC_MAX_PSK_LEN/8); i++) { - WL_SOFTAP(("[%02d]: %08x\n", i, *((unsigned int *)&output[i*4]))); - - sprintf(ptr, "%02x%02x%02x%02x", (uint)output[i*4], - (uint)output[i*4+1], (uint)output[i*4+2], - (uint)output[i*4+3]); - ptr += 8; - } - WL_SOFTAP(("%s: passphase = %s\n", __FUNCTION__, key_str_buf)); - - psk.key_len = htod16((ushort)WSEC_MAX_PSK_LEN); - memcpy(psk.key, key_str_buf, psk.key_len); - } else { - psk.key_len = htod16((ushort) key_len); - memcpy(psk.key, ap->key, key_len); - } - - psk.flags = htod16(WSEC_PASSPHRASE); - res |= dev_wlc_ioctl(dev, WLC_SET_WSEC_PMK, &psk, sizeof(psk)); - - wpa_auth = WPA_AUTH_PSK; - res |= dev_wlc_intvar_set(dev, "wpa_auth", wpa_auth); - - WL_SOFTAP((" wsec & auth set 'wpa-psk' (TKIP), result:&d %d\n", res)); - } - -#ifdef AP_ONLY - ap_ssid.SSID_len = strlen(ap->ssid); - strncpy(ap_ssid.SSID, ap->ssid, ap_ssid.SSID_len); - res |= dev_wlc_ioctl(dev, WLC_SET_SSID, &ap_ssid, sizeof(ap_ssid)); - mpc = 0; - res |= dev_wlc_intvar_set(dev, "mpc", mpc); - if (strnicmp(ap->sec, "wep", strlen("wep")) == 0) { - res |= dev_wlc_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)); - } -#endif - return res; -} - - - -int get_parmeter_from_string( - char **str_ptr, const char *token, - int param_type, void *dst, int param_max_len) -{ - char int_str[7] = "0"; - int parm_str_len; - char *param_str_begin; - char *param_str_end; - - if ((*str_ptr) && !strncmp(*str_ptr, token, strlen(token))) { - - strsep(str_ptr, "=,"); - param_str_begin = *str_ptr; - strsep(str_ptr, "=,"); - - if (*str_ptr == NULL) { - parm_str_len = strlen(param_str_begin); - } else { - param_str_end = *str_ptr-1; - parm_str_len = param_str_end - param_str_begin; - } - - WL_TRACE((" 'token:%s', len:%d, ", token, parm_str_len)); - - if (parm_str_len > param_max_len) { - WL_TRACE((" WARNING: extracted param len:%d is > MAX:%d\n", - parm_str_len, param_max_len)); - - parm_str_len = param_max_len; - } - - switch (param_type) { - - case PTYPE_INTDEC: { - int *pdst_int = dst; - char *eptr; - - if (parm_str_len > sizeof(int_str)) - parm_str_len = sizeof(int_str); - - memcpy(int_str, param_str_begin, parm_str_len); - - *pdst_int = simple_strtoul(int_str, &eptr, 10); - - WL_TRACE((" written as integer:%d\n", *pdst_int)); - } - break; - case PTYPE_STR_HEX: { - u8 *buf = dst; - - param_max_len = param_max_len >> 1; - hstr_2_buf(param_str_begin, buf, param_max_len); - print_buf(buf, param_max_len, 0); - } - break; - default: - memcpy(dst, param_str_begin, parm_str_len); - *((char *)dst + parm_str_len) = 0; - WL_TRACE((" written as a string:%s\n", (char *)dst)); - break; - } - - return 0; - } else { - WL_ERROR(("\n %s: No token:%s in str:%s\n", - __FUNCTION__, token, *str_ptr)); - - return -1; - } -} - -static int wl_iw_softap_deassoc_stations(struct net_device *dev, u8 *mac) -{ - int i; - int res = 0; - char mac_buf[128] = {0}; - char z_mac[6] = {0, 0, 0, 0, 0, 0}; - char *sta_mac; - struct maclist *assoc_maclist = (struct maclist *) mac_buf; - bool deauth_all = false; - - if (mac == NULL) { - deauth_all = true; - sta_mac = z_mac; - } else { - sta_mac = mac; - } - - memset(assoc_maclist, 0, sizeof(mac_buf)); - assoc_maclist->count = 8; - - res = dev_wlc_ioctl(dev, WLC_GET_ASSOCLIST, assoc_maclist, 128); - if (res != 0) { - WL_SOFTAP(("%s: Error:%d Couldn't get ASSOC List\n", __FUNCTION__, res)); - return res; - } - - if (assoc_maclist->count) { - for (i = 0; i < assoc_maclist->count; i++) { - scb_val_t scbval; - - scbval.val = htod32(1); - bcopy(&assoc_maclist->ea[i], &scbval.ea, ETHER_ADDR_LEN); - - if (deauth_all || (memcmp(&scbval.ea, sta_mac, ETHER_ADDR_LEN) == 0)) { - WL_SOFTAP(("%s, deauth STA:%d \n", __FUNCTION__, i)); - res |= dev_wlc_ioctl(dev, WLC_SCB_DEAUTHENTICATE_FOR_REASON, - &scbval, sizeof(scb_val_t)); - } - } - } else { - WL_SOFTAP((" STA ASSOC list is empty\n")); - } - - if (res != 0) { - WL_ERROR(("%s: Error:%d\n", __FUNCTION__, res)); - } else if (assoc_maclist->count) { - bcm_mdelay(200); - } - return res; -} - - -static int iwpriv_softap_stop(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *ext) -{ - int res = 0; - - WL_SOFTAP(("got iwpriv AP_BSS_STOP\n")); - - if ((!dev) && (!ap_net_dev)) { - WL_ERROR(("%s: dev is null\n", __FUNCTION__)); - return res; - } - - net_os_wake_lock(dev); - - if ((ap_cfg_running == TRUE)) { -#ifdef AP_ONLY - wl_iw_softap_deassoc_stations(dev, NULL); -#else - wl_iw_softap_deassoc_stations(ap_net_dev, NULL); - - if ((res = dev_iw_write_cfg1_bss_var(dev, 2)) < 0) - WL_ERROR(("%s failed to del BSS err = %d", __FUNCTION__, res)); -#endif - - bcm_mdelay(100); - - wrqu->data.length = 0; - ap_cfg_running = FALSE; - } - else - WL_ERROR(("%s: was called when SoftAP is OFF : move on\n", __FUNCTION__)); - - WL_SOFTAP(("%s Done with %d\n", __FUNCTION__, res)); - - net_os_wake_unlock(dev); - - return res; -} - - -static int iwpriv_fw_reload(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *ext) -{ - int ret = -1; - char extra[256]; - char *fwstr = fw_path; - - WL_SOFTAP(("current firmware_path[]=%s\n", fwstr)); - - WL_TRACE((">Got FW_RELOAD cmd:" - "info->cmd:%x, info->flags:%x, u.data:%p, u.len:%d, \ - fw_path:%p, len:%d \n", - info->cmd, info->flags, - wrqu->data.pointer, wrqu->data.length, fwstr, strlen(fwstr))); - - if ((wrqu->data.length > 4) && (wrqu->data.length < sizeof(extra))) { - - char *str_ptr; - - if (copy_from_user(extra, wrqu->data.pointer, wrqu->data.length)) { - ret = -EFAULT; - goto exit_proc; - } - - extra[wrqu->data.length] = 8; - str_ptr = extra; - - if (get_parmeter_from_string(&str_ptr, "FW_PATH=", PTYPE_STRING, fwstr, 255) != 0) { - WL_ERROR(("Error: extracting FW_PATH='' string\n")); - goto exit_proc; - } - - if (strstr(fwstr, "apsta") != NULL) { - WL_SOFTAP(("GOT APSTA FIRMWARE\n")); - ap_fw_loaded = TRUE; - } else { - WL_SOFTAP(("GOT STA FIRMWARE\n")); - ap_fw_loaded = FALSE; - } - - WL_SOFTAP(("SET firmware_path[]=%s , str_p:%p\n", fwstr, fwstr)); - ret = 0; - } else { - WL_ERROR(("Error: ivalid param len:%d\n", wrqu->data.length)); - } - -exit_proc: - return ret; -} -#endif - -#ifdef SOFTAP -static int iwpriv_wpasupp_loop_tst(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *ext) -{ - int res = 0; - char *params = NULL; - - WL_TRACE((">Got IWPRIV wp_supp loopback cmd test:" - "info->cmd:%x, info->flags:%x, u.data:%p, u.len:%d\n", - info->cmd, info->flags, - wrqu->data.pointer, wrqu->data.length)); - - if (wrqu->data.length != 0) { - - if (!(params = kmalloc(wrqu->data.length+1, GFP_KERNEL))) - return -ENOMEM; - - if (copy_from_user(params, wrqu->data.pointer, wrqu->data.length)) { - kfree(params); - return -EFAULT; - } - - params[wrqu->data.length] = 0; - WL_SOFTAP(("\n>> copied from user:\n %s\n", params)); - } else { - WL_ERROR(("ERROR param length is 0\n")); - return -EFAULT; - } - - res = wl_iw_send_priv_event(dev, params); - kfree(params); - - return res; -} -#endif - - -static int -iwpriv_en_ap_bss( - struct net_device *dev, - struct iw_request_info *info, - void *wrqu, - char *extra) -{ - int res = 0; - - if (!dev) { - WL_ERROR(("%s: dev is null\n", __FUNCTION__)); - return -1; - } - - net_os_wake_lock(dev); - - WL_SOFTAP(("%s: rcvd IWPRIV IOCTL: for dev:%s\n", __FUNCTION__, dev->name)); - -#ifndef AP_ONLY - if (ap_cfg_pid >= 0) { - wait_for_completion(&ap_cfg_exited); - ap_cfg_pid = -1; - } - - if ((res = wl_iw_set_ap_security(dev, &my_ap)) != 0) { - WL_ERROR((" %s ERROR setting SOFTAP security in :%d\n", __FUNCTION__, res)); - } - else { - if ((res = dev_iw_write_cfg1_bss_var(dev, 1)) < 0) - WL_ERROR(("%s fail to set bss up err=%d\n", __FUNCTION__, res)); - else - bcm_mdelay(100); - } - -#endif - WL_SOFTAP(("%s done with res %d \n", __FUNCTION__, res)); - - net_os_wake_unlock(dev); - - return res; -} - -static int -get_assoc_sta_list(struct net_device *dev, char *buf, int len) -{ - WL_TRACE(("%s: dev_wlc_ioctl(dev:%p, cmd:%d, buf:%p, len:%d)\n", - __FUNCTION__, dev, WLC_GET_ASSOCLIST, buf, len)); - - return dev_wlc_ioctl(dev, WLC_GET_ASSOCLIST, buf, len); - -} - - -void check_error(int res, const char *msg, const char *func, int line) -{ - if (res != 0) - WL_ERROR(("%s, %d function:%s, line:%d\n", msg, res, func, line)); -} - -static int -set_ap_mac_list(struct net_device *dev, void *buf) -{ - struct mac_list_set *mac_list_set = (struct mac_list_set *)buf; - struct maclist *maclist = (struct maclist *)&mac_list_set->mac_list; - int length; - int i; - int mac_mode = mac_list_set->mode; - int ioc_res = 0; - ap_macmode = mac_list_set->mode; - - bzero(&ap_black_list, sizeof(struct mflist)); - - if (mac_mode == MACLIST_MODE_DISABLED) { - - ioc_res = dev_wlc_ioctl(dev, WLC_SET_MACMODE, &mac_mode, sizeof(mac_mode)); - check_error(ioc_res, "ioctl ERROR:", __FUNCTION__, __LINE__); - WL_SOFTAP(("%s: MAC filtering disabled\n", __FUNCTION__)); - } else { - - scb_val_t scbval; - char mac_buf[256] = {0}; - struct maclist *assoc_maclist = (struct maclist *) mac_buf; - - bcopy(maclist, &ap_black_list, sizeof(ap_black_list)); - - ioc_res = dev_wlc_ioctl(dev, WLC_SET_MACMODE, &mac_mode, sizeof(mac_mode)); - check_error(ioc_res, "ioctl ERROR:", __FUNCTION__, __LINE__); - - length = sizeof(maclist->count) + maclist->count*ETHER_ADDR_LEN; - dev_wlc_ioctl(dev, WLC_SET_MACLIST, maclist, length); - - WL_SOFTAP(("%s: applied MAC List, mode:%d, length %d:\n", - __FUNCTION__, mac_mode, length)); - for (i = 0; i < maclist->count; i++) - WL_SOFTAP(("mac %d: %02X:%02X:%02X:%02X:%02X:%02X\n", - i, maclist->ea[i].octet[0], maclist->ea[i].octet[1], \ - maclist->ea[i].octet[2], \ - maclist->ea[i].octet[3], maclist->ea[i].octet[4], \ - maclist->ea[i].octet[5])); - - assoc_maclist->count = 8; - ioc_res = dev_wlc_ioctl(dev, WLC_GET_ASSOCLIST, assoc_maclist, 256); - check_error(ioc_res, "ioctl ERROR:", __FUNCTION__, __LINE__); - WL_SOFTAP((" Cur assoc clients:%d\n", assoc_maclist->count)); - - if (assoc_maclist->count) - for (i = 0; i < assoc_maclist->count; i++) { - int j; - bool assoc_mac_matched = false; - - WL_SOFTAP(("\n Cheking assoc STA: ")); - print_buf(&assoc_maclist->ea[i], 6, 7); - WL_SOFTAP(("with the b/w list:")); - - for (j = 0; j < maclist->count; j++) - if (!bcmp(&assoc_maclist->ea[i], &maclist->ea[j], - ETHER_ADDR_LEN)) { - - assoc_mac_matched = true; - break; - } - - if (((mac_mode == MACLIST_MODE_ALLOW) && !assoc_mac_matched) || - ((mac_mode == MACLIST_MODE_DENY) && assoc_mac_matched)) { - - WL_SOFTAP(("b-match or w-mismatch," - " do deauth/disassoc \n")); - scbval.val = htod32(1); - bcopy(&assoc_maclist->ea[i], &scbval.ea, \ - ETHER_ADDR_LEN); - ioc_res = dev_wlc_ioctl(dev, - WLC_SCB_DEAUTHENTICATE_FOR_REASON, - &scbval, sizeof(scb_val_t)); - check_error(ioc_res, - "ioctl ERROR:", - __FUNCTION__, __LINE__); - - } else { - WL_SOFTAP((" no b/w list hits, let it be\n")); - } - } else { - WL_SOFTAP(("No ASSOC CLIENTS\n")); - } - } - - WL_SOFTAP(("%s iocres:%d\n", __FUNCTION__, ioc_res)); - return ioc_res; -} -#endif - - -#ifdef SOFTAP -int set_macfilt_from_string(struct mflist *pmflist, char **param_str) -{ - return 0; -} -#endif - - -#ifdef SOFTAP -#define PARAM_OFFSET PROFILE_OFFSET - -int wl_iw_process_private_ascii_cmd( - struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *dwrq, - char *cmd_str) -{ - int ret = 0; - char *sub_cmd = cmd_str + PROFILE_OFFSET + strlen("ASCII_CMD="); - - WL_SOFTAP(("\n %s: ASCII_CMD: offs_0:%s, offset_32:\n'%s'\n", - __FUNCTION__, cmd_str, cmd_str + PROFILE_OFFSET)); - - if (strnicmp(sub_cmd, "AP_CFG", strlen("AP_CFG")) == 0) { - - WL_SOFTAP((" AP_CFG \n")); - - - if (init_ap_profile_from_string(cmd_str+PROFILE_OFFSET, &my_ap) != 0) { - WL_ERROR(("ERROR: SoftAP CFG prams !\n")); - ret = -1; - } else { - ret = set_ap_cfg(dev, &my_ap); - } - - } else if (strnicmp(sub_cmd, "AP_BSS_START", strlen("AP_BSS_START")) == 0) { - - WL_SOFTAP(("\n SOFTAP - ENABLE BSS \n")); - - WL_SOFTAP(("\n!!! got 'WL_AP_EN_BSS' from WPA supplicant, dev:%s\n", dev->name)); - -#ifndef AP_ONLY - if (ap_net_dev == NULL) { - printf("\n ERROR: SOFTAP net_dev* is NULL !!!\n"); - } else { - if ((ret = iwpriv_en_ap_bss(ap_net_dev, info, dwrq, cmd_str)) < 0) - WL_ERROR(("%s line %d fail to set bss up\n", \ - __FUNCTION__, __LINE__)); - } -#else - if ((ret = iwpriv_en_ap_bss(dev, info, dwrq, cmd_str)) < 0) - WL_ERROR(("%s line %d fail to set bss up\n", \ - __FUNCTION__, __LINE__)); -#endif - } else if (strnicmp(sub_cmd, "ASSOC_LST", strlen("ASSOC_LST")) == 0) { - /* no code yet */ - } else if (strnicmp(sub_cmd, "AP_BSS_STOP", strlen("AP_BSS_STOP")) == 0) { - WL_SOFTAP((" \n temp DOWN SOFTAP\n")); -#ifndef AP_ONLY - if ((ret = dev_iw_write_cfg1_bss_var(dev, 0)) < 0) { - WL_ERROR(("%s line %d fail to set bss down\n", \ - __FUNCTION__, __LINE__)); - } -#endif - } - - return ret; -} -#endif - -#define BCM4329_WAKELOCK_NAME "bcm4329_wifi_wakelock" - -//static struct wake_lock bcm4329_suspend_lock; - -int bcm4329_wakelock_init = 0; - -void bcm4329_power_save_init(void) -{ - //wake_lock_init(&bcm4329_suspend_lock, WAKE_LOCK_SUSPEND, BCM4329_WAKELOCK_NAME); - //wake_lock(&bcm4329_suspend_lock); - - bcm4329_wakelock_init = 2; -} - -void bcm4329_power_save_exit(void) -{ - bcm4329_wakelock_init = 0; - msleep(100); - - //if (bcm4329_wakelock_init == 2) - // wake_unlock(&bcm4329_suspend_lock); - //wake_lock_destroy(&bcm4329_suspend_lock); -} - -static int wl_iw_set_priv( - struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *ext -) -{ - int ret = 0; - char * extra; - - if (!(extra = kmalloc(dwrq->length, GFP_KERNEL))) - return -ENOMEM; - - if (copy_from_user(extra, dwrq->pointer, dwrq->length)) { - kfree(extra); - return -EFAULT; - } - - WL_TRACE(("%s: SIOCSIWPRIV request %s, info->cmd:%x, info->flags:%d\n dwrq->length:%d", - dev->name, extra, info->cmd, info->flags, dwrq->length)); - - net_os_wake_lock(dev); - - if (dwrq->length && extra) { - if (strnicmp(extra, "START", strlen("START")) == 0) { - if (bcm4329_wakelock_init == 1) - { - //wake_lock(&bcm4329_suspend_lock); - bcm4329_wakelock_init = 2; - } - wl_iw_control_wl_on(dev, info); - WL_TRACE(("%s, Received regular START command\n", __FUNCTION__)); - } - - if (g_onoff == G_WLAN_SET_OFF) { - WL_TRACE(("%s, missing START, Fail\n", __FUNCTION__)); - kfree(extra); - net_os_wake_unlock(dev); - return -EFAULT; - } - - if (strnicmp(extra, "SCAN-ACTIVE", strlen("SCAN-ACTIVE")) == 0) { -#ifdef ENABLE_ACTIVE_PASSIVE_SCAN_SUPPRESS - WL_TRACE(("%s: active scan setting suppressed\n", dev->name)); -#else - ret = wl_iw_set_active_scan(dev, info, (union iwreq_data *)dwrq, extra); -#endif - } else if (strnicmp(extra, "SCAN-PASSIVE", strlen("SCAN-PASSIVE")) == 0) -#ifdef ENABLE_ACTIVE_PASSIVE_SCAN_SUPPRESS - WL_TRACE(("%s: passive scan setting suppressed\n", dev->name)); -#else - ret = wl_iw_set_passive_scan(dev, info, (union iwreq_data *)dwrq, extra); -#endif - else if (strnicmp(extra, "RSSI", strlen("RSSI")) == 0) - ret = wl_iw_get_rssi(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, "LINKSPEED", strlen("LINKSPEED")) == 0) - ret = wl_iw_get_link_speed(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, "MACADDR", strlen("MACADDR")) == 0) - ret = wl_iw_get_macaddr(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, "COUNTRY", strlen("COUNTRY")) == 0) - ret = wl_iw_set_country(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, "SCAN-CHANNELS", strlen("SCAN-CHANNELS")) == 0) - ret = wl_iw_get_country(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, "STOP", strlen("STOP")) == 0){ - ret = wl_iw_control_wl_off(dev, info); - if (bcm4329_wakelock_init == 2) - { - //wake_unlock(&bcm4329_suspend_lock); - bcm4329_wakelock_init = 1; - } - } - else if (strnicmp(extra, BAND_GET_CMD, strlen(BAND_GET_CMD)) == 0) - ret = wl_iw_get_band(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, BAND_SET_CMD, strlen(BAND_SET_CMD)) == 0) - ret = wl_iw_set_band(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, DTIM_SKIP_GET_CMD, strlen(DTIM_SKIP_GET_CMD)) == 0) - ret = wl_iw_get_dtim_skip(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, DTIM_SKIP_SET_CMD, strlen(DTIM_SKIP_SET_CMD)) == 0) - ret = wl_iw_set_dtim_skip(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, SETSUSPEND_CMD, strlen(SETSUSPEND_CMD)) == 0) - ret = wl_iw_set_suspend(dev, info, (union iwreq_data *)dwrq, extra); -#ifdef CONFIG_US_NON_DFS_CHANNELS_ONLY - else if (strnicmp(extra, SETDFSCHANNELS_CMD, strlen(SETDFSCHANNELS_CMD)) == 0) - ret = wl_iw_set_dfs_channels(dev, info, (union iwreq_data *)dwrq, extra); -#endif -#if defined(PNO_SUPPORT) - else if (strnicmp(extra, PNOSSIDCLR_SET_CMD, strlen(PNOSSIDCLR_SET_CMD)) == 0) - ret = wl_iw_set_pno_reset(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, PNOSETUP_SET_CMD, strlen(PNOSETUP_SET_CMD)) == 0) - ret = wl_iw_set_pno_set(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, PNOENABLE_SET_CMD, strlen(PNOENABLE_SET_CMD)) == 0) - ret = wl_iw_set_pno_enable(dev, info, (union iwreq_data *)dwrq, extra); -#endif -#if defined(CSCAN) - else if (strnicmp(extra, CSCAN_COMMAND, strlen(CSCAN_COMMAND)) == 0) - ret = wl_iw_set_cscan(dev, info, (union iwreq_data *)dwrq, extra); -#endif -#ifdef CUSTOMER_HW2 - else if (strnicmp(extra, "POWERMODE", strlen("POWERMODE")) == 0) - ret = wl_iw_set_power_mode(dev, info, (union iwreq_data *)dwrq, extra); - else if (strnicmp(extra, "BTCOEXMODE", strlen("BTCOEXMODE")) == 0) - ret = wl_iw_set_btcoex_dhcp(dev, info, (union iwreq_data *)dwrq, extra); -#else - else if (strnicmp(extra, "POWERMODE", strlen("POWERMODE")) == 0) - ret = wl_iw_set_btcoex_dhcp(dev, info, (union iwreq_data *)dwrq, extra); -#endif - else if (strnicmp(extra, "GETPOWER", strlen("GETPOWER")) == 0) - ret = wl_iw_get_power_mode(dev, info, (union iwreq_data *)dwrq, extra); -#ifdef SOFTAP - else if (strnicmp(extra, "ASCII_CMD", strlen("ASCII_CMD")) == 0) { - wl_iw_process_private_ascii_cmd(dev, info, (union iwreq_data *)dwrq, extra); - } else if (strnicmp(extra, "AP_MAC_LIST_SET", strlen("AP_MAC_LIST_SET")) == 0) { - WL_SOFTAP(("penguin, set AP_MAC_LIST_SET\n")); - set_ap_mac_list(dev, (extra + PROFILE_OFFSET)); - } -#endif - else { - WL_TRACE(("Unknown PRIVATE command: %s: ignored\n", extra)); - snprintf(extra, MAX_WX_STRING, "OK"); - dwrq->length = strlen("OK") + 1; - } - } - - net_os_wake_unlock(dev); - - if (extra) { - if (copy_to_user(dwrq->pointer, extra, dwrq->length)) { - kfree(extra); - return -EFAULT; - } - - kfree(extra); - } - - return ret; -} - -static const iw_handler wl_iw_handler[] = -{ - (iw_handler) wl_iw_config_commit, - (iw_handler) wl_iw_get_name, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) wl_iw_set_freq, - (iw_handler) wl_iw_get_freq, - (iw_handler) wl_iw_set_mode, - (iw_handler) wl_iw_get_mode, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) wl_iw_get_range, - (iw_handler) wl_iw_set_priv, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) wl_iw_set_spy, - (iw_handler) wl_iw_get_spy, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) wl_iw_set_wap, - (iw_handler) wl_iw_get_wap, -#if WIRELESS_EXT > 17 - (iw_handler) wl_iw_mlme, -#else - (iw_handler) NULL, -#endif -#if defined(WL_IW_USE_ISCAN) - (iw_handler) wl_iw_iscan_get_aplist, -#else - (iw_handler) wl_iw_get_aplist, -#endif -#if WIRELESS_EXT > 13 -#if defined(WL_IW_USE_ISCAN) - (iw_handler) wl_iw_iscan_set_scan, - (iw_handler) wl_iw_iscan_get_scan, -#else - (iw_handler) wl_iw_set_scan, - (iw_handler) wl_iw_get_scan, -#endif -#else - (iw_handler) NULL, - (iw_handler) NULL, -#endif - (iw_handler) wl_iw_set_essid, - (iw_handler) wl_iw_get_essid, - (iw_handler) wl_iw_set_nick, - (iw_handler) wl_iw_get_nick, - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) wl_iw_set_rate, - (iw_handler) wl_iw_get_rate, - (iw_handler) wl_iw_set_rts, - (iw_handler) wl_iw_get_rts, - (iw_handler) wl_iw_set_frag, - (iw_handler) wl_iw_get_frag, - (iw_handler) wl_iw_set_txpow, - (iw_handler) wl_iw_get_txpow, -#if WIRELESS_EXT > 10 - (iw_handler) wl_iw_set_retry, - (iw_handler) wl_iw_get_retry, -#endif - (iw_handler) wl_iw_set_encode, - (iw_handler) wl_iw_get_encode, - (iw_handler) wl_iw_set_power, - (iw_handler) wl_iw_get_power, -#if WIRELESS_EXT > 17 - (iw_handler) NULL, - (iw_handler) NULL, - (iw_handler) wl_iw_set_wpaie, - (iw_handler) wl_iw_get_wpaie, - (iw_handler) wl_iw_set_wpaauth, - (iw_handler) wl_iw_get_wpaauth, - (iw_handler) wl_iw_set_encodeext, - (iw_handler) wl_iw_get_encodeext, -#ifdef BCMWPA2 - (iw_handler) wl_iw_set_pmksa, -#endif -#endif -}; - -#if WIRELESS_EXT > 12 -static const iw_handler wl_iw_priv_handler[] = { - NULL, - (iw_handler)wl_iw_set_active_scan, - NULL, - (iw_handler)wl_iw_get_rssi, - NULL, - (iw_handler)wl_iw_set_passive_scan, - NULL, - (iw_handler)wl_iw_get_link_speed, - NULL, - (iw_handler)wl_iw_get_macaddr, - NULL, - (iw_handler)wl_iw_control_wl_off, - NULL, - (iw_handler)wl_iw_control_wl_on, -#ifdef SOFTAP - NULL, - (iw_handler)iwpriv_set_ap_config, - - NULL, - (iw_handler)iwpriv_get_assoc_list, - - NULL, - (iw_handler)iwpriv_set_mac_filters, - - NULL, - (iw_handler)iwpriv_en_ap_bss, - - NULL, - (iw_handler)iwpriv_wpasupp_loop_tst, - - NULL, - (iw_handler)iwpriv_softap_stop, - - NULL, - (iw_handler)iwpriv_fw_reload, - - NULL, - (iw_handler)iwpriv_set_ap_sta_disassoc, -#endif -#if defined(CSCAN) - - NULL, - (iw_handler)iwpriv_set_cscan -#endif -}; - -static const struct iw_priv_args wl_iw_priv_args[] = { - { - WL_IW_SET_ACTIVE_SCAN, - 0, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, - "SCAN-ACTIVE" - }, - { - WL_IW_GET_RSSI, - 0, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, - "RSSI" - }, - { - WL_IW_SET_PASSIVE_SCAN, - 0, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, - "SCAN-PASSIVE" - }, - { - WL_IW_GET_LINK_SPEED, - 0, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, - "LINKSPEED" - }, - { - WL_IW_GET_CURR_MACADDR, - 0, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, - "Macaddr" - }, - { - WL_IW_SET_STOP, - 0, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, - "STOP" - }, - { - WL_IW_SET_START, - 0, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, - "START" - }, - -#ifdef SOFTAP - { - WL_SET_AP_CFG, - IW_PRIV_TYPE_CHAR | 256, - 0, - "AP_SET_CFG" - }, - - { - WL_AP_STA_LIST, - IW_PRIV_TYPE_CHAR | 0, - IW_PRIV_TYPE_CHAR | 1024, - "AP_GET_STA_LIST" - }, - - { - WL_AP_MAC_FLTR, - IW_PRIV_TYPE_CHAR | 256, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0, - "AP_SET_MAC_FLTR" - }, - - { - WL_AP_BSS_START, - 0, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, - "AP_BSS_START" - }, - - { - AP_LPB_CMD, - IW_PRIV_TYPE_CHAR | 256, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0, - "AP_LPB_CMD" - }, - - { - WL_AP_STOP, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0, - "AP_BSS_STOP" - }, - - { - WL_FW_RELOAD, - IW_PRIV_TYPE_CHAR | 256, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 0, - "WL_FW_RELOAD" - }, - - { - WL_AP_STA_DISASSOC, - IW_PRIV_TYPE_CHAR | 256, - IW_PRIV_TYPE_CHAR | 0, - "AP_STA_DISASSOC" - }, -#endif -#if defined(CSCAN) - { - WL_COMBO_SCAN, - IW_PRIV_TYPE_CHAR | 1024, - 0, - "CSCAN" - }, -#endif -}; - -const struct iw_handler_def wl_iw_handler_def = -{ - .num_standard = ARRAYSIZE(wl_iw_handler), - .standard = (iw_handler *) wl_iw_handler, - .num_private = ARRAYSIZE(wl_iw_priv_handler), - .num_private_args = ARRAY_SIZE(wl_iw_priv_args), - .private = (iw_handler *)wl_iw_priv_handler, - .private_args = (void *) wl_iw_priv_args, - -#if WIRELESS_EXT >= 19 - get_wireless_stats: dhd_get_wireless_stats, -#endif -}; -#endif - - -int wl_iw_ioctl( - struct net_device *dev, - struct ifreq *rq, - int cmd -) -{ - struct iwreq *wrq = (struct iwreq *) rq; - struct iw_request_info info; - iw_handler handler; - char *extra = NULL; - int token_size = 1, max_tokens = 0, ret = 0; - - net_os_wake_lock(dev); - - WL_TRACE(("%s: cmd:%x alled via dhd->do_ioctl()entry point\n", __FUNCTION__, cmd)); - if (cmd < SIOCIWFIRST || - IW_IOCTL_IDX(cmd) >= ARRAYSIZE(wl_iw_handler) || - !(handler = wl_iw_handler[IW_IOCTL_IDX(cmd)])) { - WL_ERROR(("%s: error in cmd=%x : not supported\n", __FUNCTION__, cmd)); - net_os_wake_unlock(dev); - return -EOPNOTSUPP; - } - - switch (cmd) { - - case SIOCSIWESSID: - case SIOCGIWESSID: - case SIOCSIWNICKN: - case SIOCGIWNICKN: - max_tokens = IW_ESSID_MAX_SIZE + 1; - break; - - case SIOCSIWENCODE: - case SIOCGIWENCODE: -#if WIRELESS_EXT > 17 - case SIOCSIWENCODEEXT: - case SIOCGIWENCODEEXT: -#endif - max_tokens = wrq->u.data.length; - break; - - case SIOCGIWRANGE: - max_tokens = sizeof(struct iw_range) + 500; - break; - - case SIOCGIWAPLIST: - token_size = sizeof(struct sockaddr) + sizeof(struct iw_quality); - max_tokens = IW_MAX_AP; - break; - -#if WIRELESS_EXT > 13 - case SIOCGIWSCAN: -#if defined(WL_IW_USE_ISCAN) - if (g_iscan) - max_tokens = wrq->u.data.length; - else -#endif - max_tokens = IW_SCAN_MAX_DATA; - break; -#endif - - case SIOCSIWSPY: - token_size = sizeof(struct sockaddr); - max_tokens = IW_MAX_SPY; - break; - - case SIOCGIWSPY: - token_size = sizeof(struct sockaddr) + sizeof(struct iw_quality); - max_tokens = IW_MAX_SPY; - break; - -#if WIRELESS_EXT > 17 - case SIOCSIWPMKSA: - case SIOCSIWGENIE: -#endif - case SIOCSIWPRIV: - max_tokens = wrq->u.data.length; - break; - } - - if (max_tokens && wrq->u.data.pointer) { - if (wrq->u.data.length > max_tokens) { - WL_ERROR(("%s: error in cmd=%x wrq->u.data.length=%d > max_tokens=%d\n", \ - __FUNCTION__, cmd, wrq->u.data.length, max_tokens)); - ret = -E2BIG; - goto wl_iw_ioctl_done; - } - if (!(extra = kmalloc(max_tokens * token_size, GFP_KERNEL))) { - ret = -ENOMEM; - goto wl_iw_ioctl_done; - } - - if (copy_from_user(extra, wrq->u.data.pointer, wrq->u.data.length * token_size)) { - kfree(extra); - ret = -EFAULT; - goto wl_iw_ioctl_done; - } - } - - info.cmd = cmd; - info.flags = 0; - - ret = handler(dev, &info, &wrq->u, extra); - - if (extra) { - if (copy_to_user(wrq->u.data.pointer, extra, wrq->u.data.length * token_size)) { - kfree(extra); - ret = -EFAULT; - goto wl_iw_ioctl_done; - } - - kfree(extra); - } - -wl_iw_ioctl_done: - - net_os_wake_unlock(dev); - - return ret; -} - - -bool -wl_iw_conn_status_str(uint32 event_type, uint32 status, uint32 reason, - char* stringBuf, uint buflen) -{ - typedef struct conn_fail_event_map_t { - uint32 inEvent; - uint32 inStatus; - uint32 inReason; - const char* outName; - const char* outCause; - } conn_fail_event_map_t; - - -# define WL_IW_DONT_CARE 9999 - const conn_fail_event_map_t event_map [] = { - - - {WLC_E_SET_SSID, WLC_E_STATUS_SUCCESS, WL_IW_DONT_CARE, - "Conn", "Success"}, - {WLC_E_SET_SSID, WLC_E_STATUS_NO_NETWORKS, WL_IW_DONT_CARE, - "Conn", "NoNetworks"}, - {WLC_E_SET_SSID, WLC_E_STATUS_FAIL, WL_IW_DONT_CARE, - "Conn", "ConfigMismatch"}, - {WLC_E_PRUNE, WL_IW_DONT_CARE, WLC_E_PRUNE_ENCR_MISMATCH, - "Conn", "EncrypMismatch"}, - {WLC_E_PRUNE, WL_IW_DONT_CARE, WLC_E_RSN_MISMATCH, - "Conn", "RsnMismatch"}, - {WLC_E_AUTH, WLC_E_STATUS_TIMEOUT, WL_IW_DONT_CARE, - "Conn", "AuthTimeout"}, - {WLC_E_AUTH, WLC_E_STATUS_FAIL, WL_IW_DONT_CARE, - "Conn", "AuthFail"}, - {WLC_E_AUTH, WLC_E_STATUS_NO_ACK, WL_IW_DONT_CARE, - "Conn", "AuthNoAck"}, - {WLC_E_REASSOC, WLC_E_STATUS_FAIL, WL_IW_DONT_CARE, - "Conn", "ReassocFail"}, - {WLC_E_REASSOC, WLC_E_STATUS_TIMEOUT, WL_IW_DONT_CARE, - "Conn", "ReassocTimeout"}, - {WLC_E_REASSOC, WLC_E_STATUS_ABORT, WL_IW_DONT_CARE, - "Conn", "ReassocAbort"}, - {WLC_E_PSK_SUP, WLC_SUP_KEYED, WL_IW_DONT_CARE, - "Sup", "ConnSuccess"}, - {WLC_E_PSK_SUP, WL_IW_DONT_CARE, WL_IW_DONT_CARE, - "Sup", "WpaHandshakeFail"}, - {WLC_E_DEAUTH_IND, WL_IW_DONT_CARE, WL_IW_DONT_CARE, - "Conn", "Deauth"}, - {WLC_E_DISASSOC_IND, WL_IW_DONT_CARE, WL_IW_DONT_CARE, - "Conn", "DisassocInd"}, - {WLC_E_DISASSOC, WL_IW_DONT_CARE, WL_IW_DONT_CARE, - "Conn", "Disassoc"} - }; - - const char* name = ""; - const char* cause = NULL; - int i; - - - for (i = 0; i < sizeof(event_map)/sizeof(event_map[0]); i++) { - const conn_fail_event_map_t* row = &event_map[i]; - if (row->inEvent == event_type && - (row->inStatus == status || row->inStatus == WL_IW_DONT_CARE) && - (row->inReason == reason || row->inReason == WL_IW_DONT_CARE)) { - name = row->outName; - cause = row->outCause; - break; - } - } - - - if (cause) { - memset(stringBuf, 0, buflen); - snprintf(stringBuf, buflen, "%s %s %02d %02d", - name, cause, status, reason); - WL_INFORM(("Connection status: %s\n", stringBuf)); - return TRUE; - } else { - return FALSE; - } -} - -#if WIRELESS_EXT > 14 - -static bool -wl_iw_check_conn_fail(wl_event_msg_t *e, char* stringBuf, uint buflen) -{ - uint32 event = ntoh32(e->event_type); - uint32 status = ntoh32(e->status); - uint32 reason = ntoh32(e->reason); - - if (wl_iw_conn_status_str(event, status, reason, stringBuf, buflen)) { - return TRUE; - } - else - return FALSE; -} -#endif - -#ifndef IW_CUSTOM_MAX -#define IW_CUSTOM_MAX 256 -#endif - -void -wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data) -{ -#if WIRELESS_EXT > 13 - union iwreq_data wrqu; - char extra[IW_CUSTOM_MAX + 1]; - int cmd = 0; - uint32 event_type = ntoh32(e->event_type); - uint16 flags = ntoh16(e->flags); - uint32 datalen = ntoh32(e->datalen); - uint32 status = ntoh32(e->status); - uint32 toto; - static uint32 roam_no_success = 0; - static bool roam_no_success_send = FALSE; - - memset(&wrqu, 0, sizeof(wrqu)); - memset(extra, 0, sizeof(extra)); - - if (!dev) { - WL_ERROR(("%s: dev is null\n", __FUNCTION__)); - return; - } - - net_os_wake_lock(dev); - - WL_TRACE(("%s: dev=%s event=%d \n", __FUNCTION__, dev->name, event_type)); - - switch (event_type) { - - case WLC_E_RELOAD: - WL_ERROR(("%s: Firmware ERROR %d\n", __FUNCTION__, status)); - net_os_send_hang_message(dev); - goto wl_iw_event_end; - -#if defined(SOFTAP) - case WLC_E_PRUNE: - if (ap_cfg_running) { - char *macaddr = (char *)&e->addr; - WL_SOFTAP(("PRUNE received, %02X:%02X:%02X:%02X:%02X:%02X!\n", - macaddr[0], macaddr[1], macaddr[2], macaddr[3], \ - macaddr[4], macaddr[5])); - - if (ap_macmode) { - int i; - for (i = 0; i < ap_black_list.count; i++) { - if (!bcmp(macaddr, &ap_black_list.ea[i], \ - sizeof(struct ether_addr))) { - WL_SOFTAP(("mac in black list, ignore it\n")); - break; - } - } - - if (i == ap_black_list.count) { - char mac_buf[32] = {0}; - sprintf(mac_buf, "STA_BLOCK %02X:%02X:%02X:%02X:%02X:%02X", - macaddr[0], macaddr[1], macaddr[2], - macaddr[3], macaddr[4], macaddr[5]); - wl_iw_send_priv_event(priv_dev, mac_buf); - } - } - } - break; -#endif - case WLC_E_TXFAIL: - cmd = IWEVTXDROP; - memcpy(wrqu.addr.sa_data, &e->addr, ETHER_ADDR_LEN); - wrqu.addr.sa_family = ARPHRD_ETHER; - break; -#if WIRELESS_EXT > 14 - case WLC_E_JOIN: - case WLC_E_ASSOC_IND: - case WLC_E_REASSOC_IND: -#if defined(SOFTAP) - WL_SOFTAP(("STA connect received %d\n", event_type)); - if (ap_cfg_running) { - wl_iw_send_priv_event(priv_dev, "STA_JOIN"); - goto wl_iw_event_end; - } -#endif - memcpy(wrqu.addr.sa_data, &e->addr, ETHER_ADDR_LEN); - wrqu.addr.sa_family = ARPHRD_ETHER; - cmd = IWEVREGISTERED; - break; - case WLC_E_ROAM: - if (status == WLC_E_STATUS_SUCCESS) { - memcpy(wrqu.addr.sa_data, &e->addr.octet, ETHER_ADDR_LEN); - wrqu.addr.sa_family = ARPHRD_ETHER; - cmd = SIOCGIWAP; - } - else if (status == WLC_E_STATUS_NO_NETWORKS) { - roam_no_success++; - if ((roam_no_success == 5) && (roam_no_success_send == FALSE)) { - roam_no_success_send = TRUE; - bzero(wrqu.addr.sa_data, ETHER_ADDR_LEN); - bzero(&extra, ETHER_ADDR_LEN); - cmd = SIOCGIWAP; - WL_ERROR(("%s ROAMING did not succeeded , send Link Down\n", \ - __FUNCTION__)); - } else { - WL_TRACE(("##### ROAMING did not succeeded %d\n", roam_no_success)); - goto wl_iw_event_end; - } - } - break; - case WLC_E_DEAUTH_IND: - case WLC_E_DISASSOC_IND: -#if defined(SOFTAP) - WL_SOFTAP(("STA disconnect received %d\n", event_type)); - if (ap_cfg_running) { - wl_iw_send_priv_event(priv_dev, "STA_LEAVE"); - goto wl_iw_event_end; - } -#endif - cmd = SIOCGIWAP; - bzero(wrqu.addr.sa_data, ETHER_ADDR_LEN); - wrqu.addr.sa_family = ARPHRD_ETHER; - bzero(&extra, ETHER_ADDR_LEN); - break; - case WLC_E_LINK: - case WLC_E_NDIS_LINK: - cmd = SIOCGIWAP; - if (!(flags & WLC_EVENT_MSG_LINK)) { -#ifdef SOFTAP -#ifdef AP_ONLY - if (ap_cfg_running) { -#else - if (ap_cfg_running && !strncmp(dev->name, "wl0.1", 5)) { -#endif - WL_SOFTAP(("AP DOWN %d\n", event_type)); - wl_iw_send_priv_event(priv_dev, "AP_DOWN"); - } else { - WL_TRACE(("STA_Link Down\n")); - g_ss_cache_ctrl.m_link_down = 1; - } -#else - g_ss_cache_ctrl.m_link_down = 1; -#endif - WL_TRACE(("Link Down\n")); - - bzero(wrqu.addr.sa_data, ETHER_ADDR_LEN); - bzero(&extra, ETHER_ADDR_LEN); - } - else { - memcpy(wrqu.addr.sa_data, &e->addr, ETHER_ADDR_LEN); - g_ss_cache_ctrl.m_link_down = 0; - - memcpy(g_ss_cache_ctrl.m_active_bssid, &e->addr, ETHER_ADDR_LEN); - -#ifdef SOFTAP -#ifdef AP_ONLY - if (ap_cfg_running) { -#else - if (ap_cfg_running && !strncmp(dev->name, "wl0.1", 5)) { -#endif - WL_SOFTAP(("AP UP %d\n", event_type)); - wl_iw_send_priv_event(priv_dev, "AP_UP"); - } else { - WL_TRACE(("STA_LINK_UP\n")); - roam_no_success_send = FALSE; - roam_no_success = 0; - } -#endif - WL_TRACE(("Link UP\n")); - - } - net_os_wake_lock_timeout_enable(dev); - wrqu.addr.sa_family = ARPHRD_ETHER; - break; - case WLC_E_ACTION_FRAME: - cmd = IWEVCUSTOM; - if (datalen + 1 <= sizeof(extra)) { - wrqu.data.length = datalen + 1; - extra[0] = WLC_E_ACTION_FRAME; - memcpy(&extra[1], data, datalen); - WL_TRACE(("WLC_E_ACTION_FRAME len %d \n", wrqu.data.length)); - } - break; - - case WLC_E_ACTION_FRAME_COMPLETE: - cmd = IWEVCUSTOM; - memcpy(&toto, data, 4); - if (sizeof(status) + 1 <= sizeof(extra)) { - wrqu.data.length = sizeof(status) + 1; - extra[0] = WLC_E_ACTION_FRAME_COMPLETE; - memcpy(&extra[1], &status, sizeof(status)); - printf("wl_iw_event status %d PacketId %d \n", status, toto); - printf("WLC_E_ACTION_FRAME_COMPLETE len %d \n", wrqu.data.length); - } - break; -#endif -#if WIRELESS_EXT > 17 - case WLC_E_MIC_ERROR: { - struct iw_michaelmicfailure *micerrevt = (struct iw_michaelmicfailure *)&extra; - cmd = IWEVMICHAELMICFAILURE; - wrqu.data.length = sizeof(struct iw_michaelmicfailure); - if (flags & WLC_EVENT_MSG_GROUP) - micerrevt->flags |= IW_MICFAILURE_GROUP; - else - micerrevt->flags |= IW_MICFAILURE_PAIRWISE; - memcpy(micerrevt->src_addr.sa_data, &e->addr, ETHER_ADDR_LEN); - micerrevt->src_addr.sa_family = ARPHRD_ETHER; - - break; - } -#ifdef BCMWPA2 - case WLC_E_PMKID_CACHE: { - if (data) - { - struct iw_pmkid_cand *iwpmkidcand = (struct iw_pmkid_cand *)&extra; - pmkid_cand_list_t *pmkcandlist; - pmkid_cand_t *pmkidcand; - int count; - - cmd = IWEVPMKIDCAND; - pmkcandlist = data; - count = ntoh32_ua((uint8 *)&pmkcandlist->npmkid_cand); - ASSERT(count >= 0); - wrqu.data.length = sizeof(struct iw_pmkid_cand); - pmkidcand = pmkcandlist->pmkid_cand; - while (count) { - bzero(iwpmkidcand, sizeof(struct iw_pmkid_cand)); - if (pmkidcand->preauth) - iwpmkidcand->flags |= IW_PMKID_CAND_PREAUTH; - bcopy(&pmkidcand->BSSID, &iwpmkidcand->bssid.sa_data, - ETHER_ADDR_LEN); -#ifndef SANDGATE2G - wireless_send_event(dev, cmd, &wrqu, extra); -#endif - pmkidcand++; - count--; - } - } - goto wl_iw_event_end; - } -#endif -#endif - - case WLC_E_SCAN_COMPLETE: -#if defined(WL_IW_USE_ISCAN) - if ((g_iscan) && (g_iscan->sysioc_pid >= 0) && - (g_iscan->iscan_state != ISCAN_STATE_IDLE)) - { - up(&g_iscan->sysioc_sem); - } else { - cmd = SIOCGIWSCAN; - wrqu.data.length = strlen(extra); - WL_TRACE(("Event WLC_E_SCAN_COMPLETE from specific scan %d\n", \ - g_iscan->iscan_state)); - } -#else - cmd = SIOCGIWSCAN; - wrqu.data.length = strlen(extra); - WL_TRACE(("Event WLC_E_SCAN_COMPLETE\n")); -#endif - break; - - case WLC_E_PFN_NET_FOUND: - { - wlc_ssid_t * ssid; - ssid = (wlc_ssid_t *)data; - WL_TRACE(("%s Event WLC_E_PFN_NET_FOUND, send %s up : find %s len=%d\n", \ - __FUNCTION__, PNO_EVENT_UP, ssid->SSID, ssid->SSID_len)); - net_os_wake_lock_timeout_enable(dev); - cmd = IWEVCUSTOM; - memset(&wrqu, 0, sizeof(wrqu)); - strcpy(extra, PNO_EVENT_UP); - wrqu.data.length = strlen(extra); - } - break; - - default: - - WL_TRACE(("Unknown Event %d: ignoring\n", event_type)); - break; - } -#ifndef SANDGATE2G - if (cmd) { -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31)) - if (cmd == SIOCGIWSCAN) - wireless_send_event(dev, cmd, &wrqu, NULL); - else -#endif - wireless_send_event(dev, cmd, &wrqu, extra); - } -#endif - -#if WIRELESS_EXT > 14 - - memset(extra, 0, sizeof(extra)); - if (wl_iw_check_conn_fail(e, extra, sizeof(extra))) { - cmd = IWEVCUSTOM; - wrqu.data.length = strlen(extra); -#ifndef SANDGATE2G - wireless_send_event(dev, cmd, &wrqu, extra); -#endif - } -#endif -wl_iw_event_end: - net_os_wake_unlock(dev); -#endif -} - -int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats) -{ - int res = 0; - wl_cnt_t cnt; - int phy_noise; - int rssi; - scb_val_t scb_val; - - phy_noise = 0; - if ((res = dev_wlc_ioctl(dev, WLC_GET_PHY_NOISE, &phy_noise, sizeof(phy_noise)))) - goto done; - - phy_noise = dtoh32(phy_noise); - WL_TRACE(("wl_iw_get_wireless_stats phy noise=%d\n", phy_noise)); - - bzero(&scb_val, sizeof(scb_val_t)); - if ((res = dev_wlc_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t)))) - goto done; - - rssi = dtoh32(scb_val.val); - WL_TRACE(("wl_iw_get_wireless_stats rssi=%d\n", rssi)); - if (rssi <= WL_IW_RSSI_NO_SIGNAL) - wstats->qual.qual = 0; - else if (rssi <= WL_IW_RSSI_VERY_LOW) - wstats->qual.qual = 1; - else if (rssi <= WL_IW_RSSI_LOW) - wstats->qual.qual = 2; - else if (rssi <= WL_IW_RSSI_GOOD) - wstats->qual.qual = 3; - else if (rssi <= WL_IW_RSSI_VERY_GOOD) - wstats->qual.qual = 4; - else - wstats->qual.qual = 5; - - - wstats->qual.level = 0x100 + rssi; - wstats->qual.noise = 0x100 + phy_noise; -#if WIRELESS_EXT > 18 - wstats->qual.updated |= (IW_QUAL_ALL_UPDATED | IW_QUAL_DBM); -#else - wstats->qual.updated |= 7; -#endif - -#if WIRELESS_EXT > 11 - WL_TRACE(("wl_iw_get_wireless_stats counters=%d\n", (int)sizeof(wl_cnt_t))); - - memset(&cnt, 0, sizeof(wl_cnt_t)); - res = dev_wlc_bufvar_get(dev, "counters", (char *)&cnt, sizeof(wl_cnt_t)); - if (res) - { - WL_ERROR(("wl_iw_get_wireless_stats counters failed error=%d\n", res)); - goto done; - } - - cnt.version = dtoh16(cnt.version); - if (cnt.version != WL_CNT_T_VERSION) { - WL_TRACE(("\tIncorrect version of counters struct: expected %d; got %d\n", - WL_CNT_T_VERSION, cnt.version)); - goto done; - } - - wstats->discard.nwid = 0; - wstats->discard.code = dtoh32(cnt.rxundec); - wstats->discard.fragment = dtoh32(cnt.rxfragerr); - wstats->discard.retries = dtoh32(cnt.txfail); - wstats->discard.misc = dtoh32(cnt.rxrunt) + dtoh32(cnt.rxgiant); - wstats->miss.beacon = 0; - - WL_TRACE(("wl_iw_get_wireless_stats counters txframe=%d txbyte=%d\n", - dtoh32(cnt.txframe), dtoh32(cnt.txbyte))); - WL_TRACE(("wl_iw_get_wireless_stats counters rxfrmtoolong=%d\n", dtoh32(cnt.rxfrmtoolong))); - WL_TRACE(("wl_iw_get_wireless_stats counters rxbadplcp=%d\n", dtoh32(cnt.rxbadplcp))); - WL_TRACE(("wl_iw_get_wireless_stats counters rxundec=%d\n", dtoh32(cnt.rxundec))); - WL_TRACE(("wl_iw_get_wireless_stats counters rxfragerr=%d\n", dtoh32(cnt.rxfragerr))); - WL_TRACE(("wl_iw_get_wireless_stats counters txfail=%d\n", dtoh32(cnt.txfail))); - WL_TRACE(("wl_iw_get_wireless_stats counters rxrunt=%d\n", dtoh32(cnt.rxrunt))); - WL_TRACE(("wl_iw_get_wireless_stats counters rxgiant=%d\n", dtoh32(cnt.rxgiant))); - -#endif - -done: - return res; -} -static void -wl_iw_bt_flag_set( - struct net_device *dev, - bool set) -{ -#if defined(BT_DHCP_USE_FLAGS) - char buf_flag7_dhcp_on[8] = { 7, 00, 00, 00, 0x1, 0x0, 0x00, 0x00 }; - char buf_flag7_default[8] = { 7, 00, 00, 00, 0x0, 0x00, 0x00, 0x00}; -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) - rtnl_lock(); -#endif - -#if defined(BT_DHCP_eSCO_FIX) - set_btc_esco_params(dev, set); -#endif - -#if defined(BT_DHCP_USE_FLAGS) - WL_TRACE_COEX(("WI-FI priority boost via bt flags, set:%d\n", set)); - if (set == TRUE) { - dev_wlc_bufvar_set(dev, "btc_flags", - (char *)&buf_flag7_dhcp_on[0], sizeof(buf_flag7_dhcp_on)); - } - else { - dev_wlc_bufvar_set(dev, "btc_flags", - (char *)&buf_flag7_default[0], sizeof(buf_flag7_default)); - } -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) - rtnl_unlock(); -#endif -} - -static void -wl_iw_bt_timerfunc(ulong data) -{ - bt_info_t *bt_local = (bt_info_t *)data; - bt_local->timer_on = 0; - WL_TRACE(("%s\n", __FUNCTION__)); - - up(&bt_local->bt_sem); -} - -static int -_bt_dhcp_sysioc_thread(void *data) -{ - DAEMONIZE("dhcp_sysioc"); - - while (down_interruptible(&g_bt->bt_sem) == 0) { - - net_os_wake_lock(g_bt->dev); - - if (g_bt->timer_on) { - g_bt->timer_on = 0; - del_timer_sync(&g_bt->timer); - } - - switch (g_bt->bt_state) { - case BT_DHCP_START: - WL_TRACE_COEX(("%s bt_dhcp stm: started \n", __FUNCTION__)); - g_bt->bt_state = BT_DHCP_OPPORTUNITY_WINDOW; - mod_timer(&g_bt->timer, jiffies + BT_DHCP_OPPORTUNITY_WINDOW_TIME*HZ/1000); - g_bt->timer_on = 1; - break; - - case BT_DHCP_OPPORTUNITY_WINDOW: - if (g_bt->dhcp_done) { - WL_TRACE_COEX(("%s DHCP Done before T1 expiration\n", \ - __FUNCTION__)); - g_bt->bt_state = BT_DHCP_IDLE; - g_bt->timer_on = 0; - break; - } - - WL_TRACE_COEX(("%s DHCP T1:%d expired\n", \ - __FUNCTION__, BT_DHCP_OPPORTUNITY_WINDOW_TIME)); - if (g_bt->dev) wl_iw_bt_flag_set(g_bt->dev, TRUE); - g_bt->bt_state = BT_DHCP_FLAG_FORCE_TIMEOUT; - mod_timer(&g_bt->timer, jiffies + BT_DHCP_FLAG_FORCE_TIME*HZ/1000); - g_bt->timer_on = 1; - break; - - case BT_DHCP_FLAG_FORCE_TIMEOUT: - if (g_bt->dhcp_done) { - WL_TRACE_COEX(("%s DHCP Done before T2 expiration\n", \ - __FUNCTION__)); - } else { - WL_TRACE_COEX(("%s DHCP wait interval T2:%d msec expired\n", - __FUNCTION__, BT_DHCP_FLAG_FORCE_TIME)); - } - - if (g_bt->dev) wl_iw_bt_flag_set(g_bt->dev, FALSE); - g_bt->bt_state = BT_DHCP_IDLE; - g_bt->timer_on = 0; - break; - - default: - WL_ERROR(("%s error g_status=%d !!!\n", __FUNCTION__, \ - g_bt->bt_state)); - if (g_bt->dev) wl_iw_bt_flag_set(g_bt->dev, FALSE); - g_bt->bt_state = BT_DHCP_IDLE; - g_bt->timer_on = 0; - break; - } - - net_os_wake_unlock(g_bt->dev); - } - - if (g_bt->timer_on) { - g_bt->timer_on = 0; - del_timer_sync(&g_bt->timer); - } - - complete_and_exit(&g_bt->bt_exited, 0); -} - -static void -wl_iw_bt_release(void) -{ - bt_info_t *bt_local = g_bt; - - if (!bt_local) { - return; - } - - if (bt_local->bt_pid >= 0) { - KILL_PROC(bt_local->bt_pid, SIGTERM); - wait_for_completion(&bt_local->bt_exited); - } - kfree(bt_local); - g_bt = NULL; -} - -static int -wl_iw_bt_init(struct net_device *dev) -{ - bt_info_t *bt_dhcp = NULL; - - bt_dhcp = kmalloc(sizeof(bt_info_t), GFP_KERNEL); - if (!bt_dhcp) - return -ENOMEM; - - memset(bt_dhcp, 0, sizeof(bt_info_t)); - bt_dhcp->bt_pid = -1; - g_bt = bt_dhcp; - bt_dhcp->dev = dev; - bt_dhcp->bt_state = BT_DHCP_IDLE; - - - bt_dhcp->timer_ms = 10; - init_timer(&bt_dhcp->timer); - bt_dhcp->timer.data = (ulong)bt_dhcp; - bt_dhcp->timer.function = wl_iw_bt_timerfunc; - - sema_init(&bt_dhcp->bt_sem, 0); - init_completion(&bt_dhcp->bt_exited); - bt_dhcp->bt_pid = kernel_thread(_bt_dhcp_sysioc_thread, bt_dhcp, 0); - if (bt_dhcp->bt_pid < 0) { - WL_ERROR(("Failed in %s\n", __FUNCTION__)); - return -ENOMEM; - } - - return 0; -} - -int wl_iw_attach(struct net_device *dev, void *dhdp) -{ - int params_size; - wl_iw_t *iw; -#if defined(WL_IW_USE_ISCAN) - iscan_info_t *iscan = NULL; -#endif - - mutex_init(&wl_cache_lock); - -#if defined(WL_IW_USE_ISCAN) - if (!dev) - return 0; - - memset(&g_wl_iw_params, 0, sizeof(wl_iw_extra_params_t)); - -#ifdef CSCAN - params_size = (WL_SCAN_PARAMS_FIXED_SIZE + OFFSETOF(wl_iscan_params_t, params)) + - (WL_NUMCHANNELS * sizeof(uint16)) + WL_SCAN_PARAMS_SSID_MAX * sizeof(wlc_ssid_t); -#else - params_size = (WL_SCAN_PARAMS_FIXED_SIZE + OFFSETOF(wl_iscan_params_t, params)); -#endif - iscan = kmalloc(sizeof(iscan_info_t), GFP_KERNEL); - if (!iscan) - return -ENOMEM; - memset(iscan, 0, sizeof(iscan_info_t)); - - iscan->iscan_ex_params_p = (wl_iscan_params_t*)kmalloc(params_size, GFP_KERNEL); - if (!iscan->iscan_ex_params_p) - return -ENOMEM; - iscan->iscan_ex_param_size = params_size; - iscan->sysioc_pid = -1; - - g_iscan = iscan; - iscan->dev = dev; - iscan->iscan_state = ISCAN_STATE_IDLE; -#if defined(CONFIG_FIRST_SCAN) - g_first_broadcast_scan = BROADCAST_SCAN_FIRST_IDLE; - g_first_counter_scans = 0; - g_iscan->scan_flag = 0; -#endif - - iscan->timer_ms = 8000; - init_timer(&iscan->timer); - iscan->timer.data = (ulong)iscan; - iscan->timer.function = wl_iw_timerfunc; - - sema_init(&iscan->sysioc_sem, 0); - init_completion(&iscan->sysioc_exited); - iscan->sysioc_pid = kernel_thread(_iscan_sysioc_thread, iscan, 0); - if (iscan->sysioc_pid < 0) - return -ENOMEM; -#endif - - iw = *(wl_iw_t **)netdev_priv(dev); - iw->pub = (dhd_pub_t *)dhdp; -#ifdef SOFTAP - priv_dev = dev; -#endif - g_scan = NULL; - - g_scan = (void *)kmalloc(G_SCAN_RESULTS, GFP_KERNEL); - if (!g_scan) - return -ENOMEM; - - memset(g_scan, 0, G_SCAN_RESULTS); - g_scan_specified_ssid = 0; - -#if !defined(CSCAN) - wl_iw_init_ss_cache_ctrl(); -#endif - - wl_iw_bt_init(dev); - - return 0; -} - -void wl_iw_detach(void) -{ -#if defined(WL_IW_USE_ISCAN) - iscan_buf_t *buf; - iscan_info_t *iscan = g_iscan; - - if (!iscan) - return; - if (iscan->sysioc_pid >= 0) { - KILL_PROC(iscan->sysioc_pid, SIGTERM); - wait_for_completion(&iscan->sysioc_exited); - } - mutex_lock(&wl_cache_lock); - while (iscan->list_hdr) { - buf = iscan->list_hdr->next; - kfree(iscan->list_hdr); - iscan->list_hdr = buf; - } - kfree(iscan->iscan_ex_params_p); - kfree(iscan); - g_iscan = NULL; - mutex_unlock(&wl_cache_lock); -#endif - - if (g_scan) - kfree(g_scan); - - g_scan = NULL; -#if !defined(CSCAN) - wl_iw_release_ss_cache_ctrl(); -#endif - wl_iw_bt_release(); -#ifdef SOFTAP - if (ap_cfg_running) { - WL_TRACE(("\n%s AP is going down\n", __FUNCTION__)); - wl_iw_send_priv_event(priv_dev, "AP_DOWN"); - } -#endif -} diff --git a/drivers/net/wireless/bcm4319/wl_iw.h b/drivers/net/wireless/bcm4319/wl_iw.h deleted file mode 100644 index 928291fe589a..000000000000 --- a/drivers/net/wireless/bcm4319/wl_iw.h +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Linux Wireless Extensions support - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: wl_iw.h,v 1.5.34.1.6.36.4.15 2010/11/17 03:13:51 Exp $ - */ - - -#ifndef _wl_iw_h_ -#define _wl_iw_h_ - -#include - -#include -#include -#include - -#define WL_SCAN_PARAMS_SSID_MAX 10 -#define GET_SSID "SSID=" -#define GET_CHANNEL "CH=" -#define GET_NPROBE "NPROBE=" -#define GET_ACTIVE_ASSOC_DWELL "ACTIVE=" -#define GET_PASSIVE_ASSOC_DWELL "PASSIVE=" -#define GET_HOME_DWELL "HOME=" -#define GET_SCAN_TYPE "TYPE=" - -#define BAND_GET_CMD "GETBAND" -#define BAND_SET_CMD "SETBAND" -#define DTIM_SKIP_GET_CMD "DTIMSKIPGET" -#define DTIM_SKIP_SET_CMD "DTIMSKIPSET" -#define SETSUSPEND_CMD "SETSUSPENDOPT" -#define PNOSSIDCLR_SET_CMD "PNOSSIDCLR" -#define PNOSETUP_SET_CMD "PNOSETUP " -#define PNOENABLE_SET_CMD "PNOFORCE" -#define PNODEBUG_SET_CMD "PNODEBUG" -#define SETDFSCHANNELS_CMD "SETDFSCHANNELS" - -#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] -#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" - - -typedef struct wl_iw_extra_params { - int target_channel; -} wl_iw_extra_params_t; - -#define WL_IW_RSSI_MINVAL -200 -#define WL_IW_RSSI_NO_SIGNAL -91 -#define WL_IW_RSSI_VERY_LOW -80 -#define WL_IW_RSSI_LOW -70 -#define WL_IW_RSSI_GOOD -68 -#define WL_IW_RSSI_VERY_GOOD -58 -#define WL_IW_RSSI_EXCELLENT -57 -#define WL_IW_RSSI_INVALID 0 -#define MAX_WX_STRING 80 -#define isprint(c) bcm_isprint(c) -#define WL_IW_SET_ACTIVE_SCAN (SIOCIWFIRSTPRIV+1) -#define WL_IW_GET_RSSI (SIOCIWFIRSTPRIV+3) -#define WL_IW_SET_PASSIVE_SCAN (SIOCIWFIRSTPRIV+5) -#define WL_IW_GET_LINK_SPEED (SIOCIWFIRSTPRIV+7) -#define WL_IW_GET_CURR_MACADDR (SIOCIWFIRSTPRIV+9) -#define WL_IW_SET_STOP (SIOCIWFIRSTPRIV+11) -#define WL_IW_SET_START (SIOCIWFIRSTPRIV+13) - - -#define WL_SET_AP_CFG (SIOCIWFIRSTPRIV+15) -#define WL_AP_STA_LIST (SIOCIWFIRSTPRIV+17) -#define WL_AP_MAC_FLTR (SIOCIWFIRSTPRIV+19) -#define WL_AP_BSS_START (SIOCIWFIRSTPRIV+21) -#define AP_LPB_CMD (SIOCIWFIRSTPRIV+23) -#define WL_AP_STOP (SIOCIWFIRSTPRIV+25) -#define WL_FW_RELOAD (SIOCIWFIRSTPRIV+27) -#define WL_AP_STA_DISASSOC (SIOCIWFIRSTPRIV+29) -#define WL_COMBO_SCAN (SIOCIWFIRSTPRIV+31) - -#define G_SCAN_RESULTS (8*1024) -#define WE_ADD_EVENT_FIX 0x80 -#define G_WLAN_SET_ON 0 -#define G_WLAN_SET_OFF 1 - -#define CHECK_EXTRA_FOR_NULL(extra) \ -if (!extra) { \ - WL_ERROR(("%s: error : extra is null pointer\n", __FUNCTION__)); \ - return -EINVAL; \ -} - -typedef struct wl_iw { - char nickname[IW_ESSID_MAX_SIZE]; - - struct iw_statistics wstats; - - int spy_num; - uint32 pwsec; - uint32 gwsec; - bool privacy_invoked; - - struct ether_addr spy_addr[IW_MAX_SPY]; - struct iw_quality spy_qual[IW_MAX_SPY]; - void *wlinfo; - dhd_pub_t * pub; -} wl_iw_t; - -#define WLC_IW_SS_CACHE_MAXLEN 2048 -#define WLC_IW_SS_CACHE_CTRL_FIELD_MAXLEN 32 -#define WLC_IW_BSS_INFO_MAXLEN \ - (WLC_IW_SS_CACHE_MAXLEN - WLC_IW_SS_CACHE_CTRL_FIELD_MAXLEN) - -typedef struct wl_iw_ss_cache { - struct wl_iw_ss_cache *next; - int dirty; - uint32 buflen; - uint32 version; - uint32 count; - wl_bss_info_t bss_info[1]; -} wl_iw_ss_cache_t; - -typedef struct wl_iw_ss_cache_ctrl { - wl_iw_ss_cache_t *m_cache_head; - int m_link_down; - int m_timer_expired; - char m_active_bssid[ETHER_ADDR_LEN]; - uint m_prev_scan_mode; - uint m_cons_br_scan_cnt; - struct timer_list *m_timer; -} wl_iw_ss_cache_ctrl_t; - -typedef enum broadcast_first_scan { - BROADCAST_SCAN_FIRST_IDLE = 0, - BROADCAST_SCAN_FIRST_STARTED, - BROADCAST_SCAN_FIRST_RESULT_READY, - BROADCAST_SCAN_FIRST_RESULT_CONSUMED -} broadcast_first_scan_t; -#ifdef SOFTAP -#define SSID_LEN 33 -#define SEC_LEN 16 -#define KEY_LEN 65 -#define PROFILE_OFFSET 32 -struct ap_profile { - uint8 ssid[SSID_LEN]; - uint8 sec[SEC_LEN]; - uint8 key[KEY_LEN]; - uint32 channel; - uint32 preamble; - uint32 max_scb; - uint32 closednet; - char country_code[WLC_CNTRY_BUF_SZ]; -}; - - -#define MACLIST_MODE_DISABLED 0 -#define MACLIST_MODE_DENY 1 -#define MACLIST_MODE_ALLOW 2 -struct mflist { - uint count; - struct ether_addr ea[16]; -}; - -struct mac_list_set { - uint32 mode; - struct mflist mac_list; -}; -#endif - -#if WIRELESS_EXT > 12 -#include -extern const struct iw_handler_def wl_iw_handler_def; -#endif - -extern int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -extern void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data); -extern int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats); -int wl_iw_attach(struct net_device *dev, void * dhdp); -void wl_iw_detach(void); -int wl_control_wl_start(struct net_device *dev); - -extern int net_os_wake_lock(struct net_device *dev); -extern int net_os_wake_unlock(struct net_device *dev); -extern int net_os_wake_lock_timeout(struct net_device *dev); -extern int net_os_wake_lock_timeout_enable(struct net_device *dev); -extern int net_os_set_suspend_disable(struct net_device *dev, int val); -extern int net_os_set_suspend(struct net_device *dev, int val); -extern int net_os_set_dtim_skip(struct net_device *dev, int val); -extern int net_os_set_packet_filter(struct net_device *dev, int val); -extern void dhd_bus_country_set(struct net_device *dev, char *country_code); -extern char *dhd_bus_country_get(struct net_device *dev); -extern int dhd_get_dtim_skip(dhd_pub_t *dhd); - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) -#define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \ - iwe_stream_add_event(info, stream, ends, iwe, extra) -#define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \ - iwe_stream_add_value(info, event, value, ends, iwe, event_len) -#define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \ - iwe_stream_add_point(info, stream, ends, iwe, extra) -#else -#define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \ - iwe_stream_add_event(stream, ends, iwe, extra) -#define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \ - iwe_stream_add_value(event, value, ends, iwe, event_len) -#define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \ - iwe_stream_add_point(stream, ends, iwe, extra) -#endif - -extern int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled); -extern int dhd_pno_clean(dhd_pub_t *dhd); -extern int dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, ushort scan_fr); -extern int dhd_pno_get_status(dhd_pub_t *dhd); -extern int dhd_dev_pno_reset(struct net_device *dev); -extern int dhd_dev_pno_set(struct net_device *dev, wlc_ssid_t* ssids_local, \ - int nssid, ushort scan_fr); -extern int dhd_dev_pno_enable(struct net_device *dev, int pfn_enabled); -extern int dhd_dev_get_pno_status(struct net_device *dev); - -#define PNO_TLV_PREFIX 'S' -#define PNO_TLV_VERSION '1' -#define PNO_TLV_SUBVERSION '2' -#define PNO_TLV_RESERVED '0' -#define PNO_TLV_TYPE_SSID_IE 'S' -#define PNO_TLV_TYPE_TIME 'T' -#define PNO_EVENT_UP "PNO_EVENT" -#define PNO_SCAN_MAX_FW 508 - -typedef struct cmd_tlv { - char prefix; - char version; - char subver; - char reserved; -} cmd_tlv_t; - -#if defined(CSCAN) - -typedef struct cscan_tlv { - char prefix; - char version; - char subver; - char reserved; -} cscan_tlv_t; - -#define CSCAN_COMMAND "CSCAN " -#define CSCAN_TLV_PREFIX 'S' -#define CSCAN_TLV_VERSION 1 -#define CSCAN_TLV_SUBVERSION 0 -#define CSCAN_TLV_TYPE_SSID_IE 'S' -#define CSCAN_TLV_TYPE_CHANNEL_IE 'C' -#define CSCAN_TLV_TYPE_NPROBE_IE 'N' -#define CSCAN_TLV_TYPE_ACTIVE_IE 'A' -#define CSCAN_TLV_TYPE_PASSIVE_IE 'P' -#define CSCAN_TLV_TYPE_HOME_IE 'H' -#define CSCAN_TLV_TYPE_STYPE_IE 'T' - -extern int wl_iw_parse_channel_list_tlv(char** list_str, uint16* channel_list, \ - int channel_num, int *bytes_left); - -extern int wl_iw_parse_data_tlv(char** list_str, void *dst, int dst_size, \ - const char token, int input_size, int *bytes_left); - -extern int wl_iw_parse_ssid_list_tlv(char** list_str, wlc_ssid_t* ssid, \ - int max, int *bytes_left); - -extern int wl_iw_parse_ssid_list(char** list_str, wlc_ssid_t* ssid, int idx, int max); - -extern int wl_iw_parse_channel_list(char** list_str, uint16* channel_list, int channel_num); - -#endif - -#endif diff --git a/drivers/net/wireless/bcm4329/bcmspibrcm.c b/drivers/net/wireless/bcm4329/bcmspibrcm.c deleted file mode 100644 index 0f131a40f4b8..000000000000 --- a/drivers/net/wireless/bcm4329/bcmspibrcm.c +++ /dev/null @@ -1,1726 +0,0 @@ -/* - * Broadcom BCMSDH to gSPI Protocol Conversion Layer - * - * Copyright (C) 2010, Broadcom Corporation - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; - * the contents of this file may not be disclosed to third parties, copied - * or duplicated in any form, in whole or in part, without the prior - * written permission of Broadcom Corporation. - * - * $Id: bcmspibrcm.c,v 1.11.2.10.2.9.6.11 2009/05/21 13:21:57 Exp $ - */ - -#define HSMODE - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include /* bcmsdh to/from specific controller APIs */ -#include /* ioctl/iovars */ -#include - -#include - - -#include -#include - -#define F0_RESPONSE_DELAY 16 -#define F1_RESPONSE_DELAY 16 -#define F2_RESPONSE_DELAY F0_RESPONSE_DELAY - -#define CMDLEN 4 - -#define DWORDMODE_ON (sd->chip == BCM4329_CHIP_ID) && (sd->chiprev == 2) && (sd->dwordmode == TRUE) - -/* Globals */ -uint sd_msglevel = 0; - -uint sd_hiok = FALSE; /* Use hi-speed mode if available? */ -uint sd_sdmode = SDIOH_MODE_SPI; /* Use SD4 mode by default */ -uint sd_f2_blocksize = 64; /* Default blocksize */ - - -uint sd_divisor = 2; -uint sd_power = 1; /* Default to SD Slot powered ON */ -uint sd_clock = 1; /* Default to SD Clock turned ON */ -uint sd_crc = 0; /* Default to SPI CRC Check turned OFF */ - -uint8 spi_outbuf[SPI_MAX_PKT_LEN]; -uint8 spi_inbuf[SPI_MAX_PKT_LEN]; - -/* 128bytes buffer is enough to clear data-not-available and program response-delay F0 bits - * assuming we will not exceed F0 response delay > 100 bytes at 48MHz. - */ -#define BUF2_PKT_LEN 128 -uint8 spi_outbuf2[BUF2_PKT_LEN]; -uint8 spi_inbuf2[BUF2_PKT_LEN]; - -/* Prototypes */ -static bool bcmspi_test_card(sdioh_info_t *sd); -static bool bcmspi_host_device_init_adapt(sdioh_info_t *sd); -static int bcmspi_set_highspeed_mode(sdioh_info_t *sd, bool hsmode); -static int bcmspi_cmd_issue(sdioh_info_t *sd, bool use_dma, uint32 cmd_arg, - uint32 *data, uint32 datalen); -static int bcmspi_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, - int regsize, uint32 *data); -static int bcmspi_card_regwrite(sdioh_info_t *sd, int func, uint32 regaddr, - int regsize, uint32 data); -static int bcmspi_card_bytewrite(sdioh_info_t *sd, int func, uint32 regaddr, - uint8 *data); -static int bcmspi_driver_init(sdioh_info_t *sd); -static int bcmspi_card_buf(sdioh_info_t *sd, int rw, int func, bool fifo, - uint32 addr, int nbytes, uint32 *data); -static int bcmspi_card_regread_fixedaddr(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, - uint32 *data); -static void bcmspi_cmd_getdstatus(sdioh_info_t *sd, uint32 *dstatus_buffer); -static int bcmspi_update_stats(sdioh_info_t *sd, uint32 cmd_arg); - -/* - * Public entry points & extern's - */ -extern sdioh_info_t * -sdioh_attach(osl_t *osh, void *bar0, uint irq) -{ - sdioh_info_t *sd; - - sd_trace(("%s\n", __FUNCTION__)); - if ((sd = (sdioh_info_t *)MALLOC(osh, sizeof(sdioh_info_t))) == NULL) { - sd_err(("%s: out of memory, malloced %d bytes\n", __FUNCTION__, MALLOCED(osh))); - return NULL; - } - bzero((char *)sd, sizeof(sdioh_info_t)); - sd->osh = osh; - if (spi_osinit(sd) != 0) { - sd_err(("%s: spi_osinit() failed\n", __FUNCTION__)); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return NULL; - } - - sd->bar0 = bar0; - sd->irq = irq; - sd->intr_handler = NULL; - sd->intr_handler_arg = NULL; - sd->intr_handler_valid = FALSE; - - /* Set defaults */ - sd->use_client_ints = TRUE; - sd->sd_use_dma = FALSE; /* DMA Not supported */ - - /* Spi device default is 16bit mode, change to 4 when device is changed to 32bit - * mode - */ - sd->wordlen = 2; - - if (!spi_hw_attach(sd)) { - sd_err(("%s: spi_hw_attach() failed\n", __FUNCTION__)); - spi_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return (NULL); - } - - if (bcmspi_driver_init(sd) != SUCCESS) { - sd_err(("%s: bcmspi_driver_init() failed()\n", __FUNCTION__)); - spi_hw_detach(sd); - spi_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return (NULL); - } - - if (spi_register_irq(sd, irq) != SUCCESS) { - sd_err(("%s: spi_register_irq() failed for irq = %d\n", __FUNCTION__, irq)); - spi_hw_detach(sd); - spi_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - return (NULL); - } - - sd_trace(("%s: Done\n", __FUNCTION__)); - - return sd; -} - -extern SDIOH_API_RC -sdioh_detach(osl_t *osh, sdioh_info_t *sd) -{ - sd_trace(("%s\n", __FUNCTION__)); - if (sd) { - sd_err(("%s: detaching from hardware\n", __FUNCTION__)); - spi_free_irq(sd->irq, sd); - spi_hw_detach(sd); - spi_osfree(sd); - MFREE(sd->osh, sd, sizeof(sdioh_info_t)); - } - return SDIOH_API_RC_SUCCESS; -} - -/* Configure callback to client when we recieve client interrupt */ -extern SDIOH_API_RC -sdioh_interrupt_register(sdioh_info_t *sd, sdioh_cb_fn_t fn, void *argh) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - sd->intr_handler = fn; - sd->intr_handler_arg = argh; - sd->intr_handler_valid = TRUE; - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_interrupt_deregister(sdioh_info_t *sd) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - sd->intr_handler_valid = FALSE; - sd->intr_handler = NULL; - sd->intr_handler_arg = NULL; - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_interrupt_query(sdioh_info_t *sd, bool *onoff) -{ - sd_trace(("%s: Entering\n", __FUNCTION__)); - *onoff = sd->client_intr_enabled; - return SDIOH_API_RC_SUCCESS; -} - -#if defined(DHD_DEBUG) -extern bool -sdioh_interrupt_pending(sdioh_info_t *sd) -{ - return 0; -} -#endif - -extern SDIOH_API_RC -sdioh_query_device(sdioh_info_t *sd) -{ - /* Return a BRCM ID appropriate to the dongle class */ - return (sd->num_funcs > 1) ? BCM4329_D11NDUAL_ID : BCM4318_D11G_ID; -} - -/* Provide dstatus bits of spi-transaction for dhd layers. */ -extern uint32 -sdioh_get_dstatus(sdioh_info_t *sd) -{ - return sd->card_dstatus; -} - -extern void -sdioh_chipinfo(sdioh_info_t *sd, uint32 chip, uint32 chiprev) -{ - sd->chip = chip; - sd->chiprev = chiprev; -} - -extern void -sdioh_dwordmode(sdioh_info_t *sd, bool set) -{ - uint8 reg = 0; - int status; - - if ((status = sdioh_request_byte(sd, SDIOH_READ, SPI_FUNC_0, SPID_STATUS_ENABLE, ®)) != - SUCCESS) { - sd_err(("%s: Failed to set dwordmode in gSPI\n", __FUNCTION__)); - return; - } - - if (set) { - reg |= DWORD_PKT_LEN_EN; - sd->dwordmode = TRUE; - sd->client_block_size[SPI_FUNC_2] = 4096; /* h2spi's limit is 4KB, we support 8KB */ - } else { - reg &= ~DWORD_PKT_LEN_EN; - sd->dwordmode = FALSE; - sd->client_block_size[SPI_FUNC_2] = 2048; - } - - if ((status = sdioh_request_byte(sd, SDIOH_WRITE, SPI_FUNC_0, SPID_STATUS_ENABLE, ®)) != - SUCCESS) { - sd_err(("%s: Failed to set dwordmode in gSPI\n", __FUNCTION__)); - return; - } -} - - -uint -sdioh_query_iofnum(sdioh_info_t *sd) -{ - return sd->num_funcs; -} - -/* IOVar table */ -enum { - IOV_MSGLEVEL = 1, - IOV_BLOCKMODE, - IOV_BLOCKSIZE, - IOV_DMA, - IOV_USEINTS, - IOV_NUMINTS, - IOV_NUMLOCALINTS, - IOV_HOSTREG, - IOV_DEVREG, - IOV_DIVISOR, - IOV_SDMODE, - IOV_HISPEED, - IOV_HCIREGS, - IOV_POWER, - IOV_CLOCK, - IOV_SPIERRSTATS, - IOV_RESP_DELAY_ALL -}; - -const bcm_iovar_t sdioh_iovars[] = { - {"sd_msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0 }, - {"sd_blocksize", IOV_BLOCKSIZE, 0, IOVT_UINT32, 0 }, /* ((fn << 16) | size) */ - {"sd_dma", IOV_DMA, 0, IOVT_BOOL, 0 }, - {"sd_ints", IOV_USEINTS, 0, IOVT_BOOL, 0 }, - {"sd_numints", IOV_NUMINTS, 0, IOVT_UINT32, 0 }, - {"sd_numlocalints", IOV_NUMLOCALINTS, 0, IOVT_UINT32, 0 }, - {"sd_hostreg", IOV_HOSTREG, 0, IOVT_BUFFER, sizeof(sdreg_t) }, - {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(sdreg_t) }, - {"sd_divisor", IOV_DIVISOR, 0, IOVT_UINT32, 0 }, - {"sd_power", IOV_POWER, 0, IOVT_UINT32, 0 }, - {"sd_clock", IOV_CLOCK, 0, IOVT_UINT32, 0 }, - {"sd_mode", IOV_SDMODE, 0, IOVT_UINT32, 100}, - {"sd_highspeed", IOV_HISPEED, 0, IOVT_UINT32, 0}, - {"spi_errstats", IOV_SPIERRSTATS, 0, IOVT_BUFFER, sizeof(struct spierrstats_t) }, - {"spi_respdelay", IOV_RESP_DELAY_ALL, 0, IOVT_BOOL, 0 }, - {NULL, 0, 0, 0, 0 } -}; - -int -sdioh_iovar_op(sdioh_info_t *si, const char *name, - void *params, int plen, void *arg, int len, bool set) -{ - const bcm_iovar_t *vi = NULL; - int bcmerror = 0; - int val_size; - int32 int_val = 0; - bool bool_val; - uint32 actionid; -/* - sdioh_regs_t *regs; -*/ - - ASSERT(name); - ASSERT(len >= 0); - - /* Get must have return space; Set does not take qualifiers */ - ASSERT(set || (arg && len)); - ASSERT(!set || (!params && !plen)); - - sd_trace(("%s: Enter (%s %s)\n", __FUNCTION__, (set ? "set" : "get"), name)); - - if ((vi = bcm_iovar_lookup(sdioh_iovars, name)) == NULL) { - bcmerror = BCME_UNSUPPORTED; - goto exit; - } - - if ((bcmerror = bcm_iovar_lencheck(vi, arg, len, set)) != 0) - goto exit; - - /* Set up params so get and set can share the convenience variables */ - if (params == NULL) { - params = arg; - plen = len; - } - - if (vi->type == IOVT_VOID) - val_size = 0; - else if (vi->type == IOVT_BUFFER) - val_size = len; - else - val_size = sizeof(int); - - if (plen >= (int)sizeof(int_val)) - bcopy(params, &int_val, sizeof(int_val)); - - bool_val = (int_val != 0) ? TRUE : FALSE; - - actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid); - switch (actionid) { - case IOV_GVAL(IOV_MSGLEVEL): - int_val = (int32)sd_msglevel; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_MSGLEVEL): - sd_msglevel = int_val; - break; - - case IOV_GVAL(IOV_BLOCKSIZE): - if ((uint32)int_val > si->num_funcs) { - bcmerror = BCME_BADARG; - break; - } - int_val = (int32)si->client_block_size[int_val]; - bcopy(&int_val, arg, val_size); - break; - - case IOV_GVAL(IOV_DMA): - int_val = (int32)si->sd_use_dma; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_DMA): - si->sd_use_dma = (bool)int_val; - break; - - case IOV_GVAL(IOV_USEINTS): - int_val = (int32)si->use_client_ints; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_USEINTS): - break; - - case IOV_GVAL(IOV_DIVISOR): - int_val = (uint32)sd_divisor; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_DIVISOR): - sd_divisor = int_val; - if (!spi_start_clock(si, (uint16)sd_divisor)) { - sd_err(("%s: set clock failed\n", __FUNCTION__)); - bcmerror = BCME_ERROR; - } - break; - - case IOV_GVAL(IOV_POWER): - int_val = (uint32)sd_power; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_POWER): - sd_power = int_val; - break; - - case IOV_GVAL(IOV_CLOCK): - int_val = (uint32)sd_clock; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_CLOCK): - sd_clock = int_val; - break; - - case IOV_GVAL(IOV_SDMODE): - int_val = (uint32)sd_sdmode; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_SDMODE): - sd_sdmode = int_val; - break; - - case IOV_GVAL(IOV_HISPEED): - int_val = (uint32)sd_hiok; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_HISPEED): - sd_hiok = int_val; - - if (!bcmspi_set_highspeed_mode(si, (bool)sd_hiok)) { - sd_err(("%s: Failed changing highspeed mode to %d.\n", - __FUNCTION__, sd_hiok)); - bcmerror = BCME_ERROR; - return ERROR; - } - break; - - case IOV_GVAL(IOV_NUMINTS): - int_val = (int32)si->intrcount; - bcopy(&int_val, arg, val_size); - break; - - case IOV_GVAL(IOV_NUMLOCALINTS): - int_val = (int32)si->local_intrcount; - bcopy(&int_val, arg, val_size); - break; - case IOV_GVAL(IOV_DEVREG): - { - sdreg_t *sd_ptr = (sdreg_t *)params; - uint8 data; - - if (sdioh_cfg_read(si, sd_ptr->func, sd_ptr->offset, &data)) { - bcmerror = BCME_SDIO_ERROR; - break; - } - - int_val = (int)data; - bcopy(&int_val, arg, sizeof(int_val)); - break; - } - - case IOV_SVAL(IOV_DEVREG): - { - sdreg_t *sd_ptr = (sdreg_t *)params; - uint8 data = (uint8)sd_ptr->value; - - if (sdioh_cfg_write(si, sd_ptr->func, sd_ptr->offset, &data)) { - bcmerror = BCME_SDIO_ERROR; - break; - } - break; - } - - - case IOV_GVAL(IOV_SPIERRSTATS): - { - bcopy(&si->spierrstats, arg, sizeof(struct spierrstats_t)); - break; - } - - case IOV_SVAL(IOV_SPIERRSTATS): - { - bzero(&si->spierrstats, sizeof(struct spierrstats_t)); - break; - } - - case IOV_GVAL(IOV_RESP_DELAY_ALL): - int_val = (int32)si->resp_delay_all; - bcopy(&int_val, arg, val_size); - break; - - case IOV_SVAL(IOV_RESP_DELAY_ALL): - si->resp_delay_all = (bool)int_val; - int_val = STATUS_ENABLE|INTR_WITH_STATUS; - if (si->resp_delay_all) - int_val |= RESP_DELAY_ALL; - else { - if (bcmspi_card_regwrite(si, SPI_FUNC_0, SPID_RESPONSE_DELAY, 1, - F1_RESPONSE_DELAY) != SUCCESS) { - sd_err(("%s: Unable to set response delay.\n", __FUNCTION__)); - bcmerror = BCME_SDIO_ERROR; - break; - } - } - - if (bcmspi_card_regwrite(si, SPI_FUNC_0, SPID_STATUS_ENABLE, 1, int_val) - != SUCCESS) { - sd_err(("%s: Unable to set response delay.\n", __FUNCTION__)); - bcmerror = BCME_SDIO_ERROR; - break; - } - break; - - default: - bcmerror = BCME_UNSUPPORTED; - break; - } -exit: - - return bcmerror; -} - -extern SDIOH_API_RC -sdioh_cfg_read(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data) -{ - SDIOH_API_RC status; - /* No lock needed since sdioh_request_byte does locking */ - status = sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data); - return status; -} - -extern SDIOH_API_RC -sdioh_cfg_write(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data) -{ - /* No lock needed since sdioh_request_byte does locking */ - SDIOH_API_RC status; - - if ((fnc_num == SPI_FUNC_1) && (addr == SBSDIO_FUNC1_FRAMECTRL)) { - uint8 dummy_data; - status = sdioh_cfg_read(sd, fnc_num, addr, &dummy_data); - if (status) { - sd_err(("sdioh_cfg_read() failed.\n")); - return status; - } - } - - status = sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data); - return status; -} - -extern SDIOH_API_RC -sdioh_cis_read(sdioh_info_t *sd, uint func, uint8 *cisd, uint32 length) -{ - uint32 count; - int offset; - uint32 cis_byte; - uint16 *cis = (uint16 *)cisd; - uint bar0 = SI_ENUM_BASE; - int status; - uint8 data; - - sd_trace(("%s: Func %d\n", __FUNCTION__, func)); - - spi_lock(sd); - - /* Set sb window address to 0x18000000 */ - data = (bar0 >> 8) & SBSDIO_SBADDRLOW_MASK; - status = bcmspi_card_bytewrite(sd, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW, &data); - if (status == SUCCESS) { - data = (bar0 >> 16) & SBSDIO_SBADDRMID_MASK; - status = bcmspi_card_bytewrite(sd, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRMID, &data); - } else { - sd_err(("%s: Unable to set sb-addr-windows\n", __FUNCTION__)); - spi_unlock(sd); - return (BCME_ERROR); - } - if (status == SUCCESS) { - data = (bar0 >> 24) & SBSDIO_SBADDRHIGH_MASK; - status = bcmspi_card_bytewrite(sd, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRHIGH, &data); - } else { - sd_err(("%s: Unable to set sb-addr-windows\n", __FUNCTION__)); - spi_unlock(sd); - return (BCME_ERROR); - } - - offset = CC_OTP; /* OTP offset in chipcommon. */ - for (count = 0; count < length/2; count++) { - if (bcmspi_card_regread (sd, SDIO_FUNC_1, offset, 2, &cis_byte) < 0) { - sd_err(("%s: regread failed: Can't read CIS\n", __FUNCTION__)); - spi_unlock(sd); - return (BCME_ERROR); - } - - *cis = (uint16)cis_byte; - cis++; - offset += 2; - } - - spi_unlock(sd); - - return (BCME_OK); -} - -extern SDIOH_API_RC -sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *byte) -{ - int status; - uint32 cmd_arg; - uint32 dstatus; - uint32 data = (uint32)(*byte); - - spi_lock(sd); - - cmd_arg = 0; - cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */ - cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, rw == SDIOH_READ ? 0 : 1); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, 1); - - sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg)); - sd_trace(("%s: rw=%d, func=%d, regaddr=0x%08x, data=0x%x\n", __FUNCTION__, rw, func, - regaddr, data)); - - if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, - cmd_arg, &data, 1)) != SUCCESS) { - spi_unlock(sd); - return status; - } - - if (rw == SDIOH_READ) - *byte = (uint8)data; - - bcmspi_cmd_getdstatus(sd, &dstatus); - if (dstatus) - sd_trace(("dstatus =0x%x\n", dstatus)); - - spi_unlock(sd); - return SDIOH_API_RC_SUCCESS; -} - -extern SDIOH_API_RC -sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, uint addr, - uint32 *word, uint nbytes) -{ - int status; - - spi_lock(sd); - - if (rw == SDIOH_READ) - status = bcmspi_card_regread(sd, func, addr, nbytes, word); - else - status = bcmspi_card_regwrite(sd, func, addr, nbytes, *word); - - spi_unlock(sd); - return (status == SUCCESS ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL); -} - -extern SDIOH_API_RC -sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint rw, uint func, - uint addr, uint reg_width, uint buflen_u, uint8 *buffer, void *pkt) -{ - int len; - int buflen = (int)buflen_u; - bool fifo = (fix_inc == SDIOH_DATA_FIX); - - spi_lock(sd); - - ASSERT(reg_width == 4); - ASSERT(buflen_u < (1 << 30)); - ASSERT(sd->client_block_size[func]); - - sd_data(("%s: %c len %d r_cnt %d t_cnt %d, pkt @0x%p\n", - __FUNCTION__, rw == SDIOH_READ ? 'R' : 'W', - buflen_u, sd->r_cnt, sd->t_cnt, pkt)); - - /* Break buffer down into blocksize chunks. */ - while (buflen > 0) { - len = MIN(sd->client_block_size[func], buflen); - if (bcmspi_card_buf(sd, rw, func, fifo, addr, len, (uint32 *)buffer) != SUCCESS) { - sd_err(("%s: bcmspi_card_buf %s failed\n", - __FUNCTION__, rw == SDIOH_READ ? "Read" : "Write")); - spi_unlock(sd); - return SDIOH_API_RC_FAIL; - } - buffer += len; - buflen -= len; - if (!fifo) - addr += len; - } - spi_unlock(sd); - return SDIOH_API_RC_SUCCESS; -} - -/* This function allows write to gspi bus when another rd/wr function is deep down the call stack. - * Its main aim is to have simpler spi writes rather than recursive writes. - * e.g. When there is a need to program response delay on the fly after detecting the SPI-func - * this call will allow to program the response delay. - */ -static int -bcmspi_card_byterewrite(sdioh_info_t *sd, int func, uint32 regaddr, uint8 byte) -{ - uint32 cmd_arg; - uint32 datalen = 1; - uint32 hostlen; - - cmd_arg = 0; - - cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 1); - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */ - cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, datalen); - - sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg)); - - - /* Set up and issue the SPI command. MSByte goes out on bus first. Increase datalen - * according to the wordlen mode(16/32bit) the device is in. - */ - ASSERT(sd->wordlen == 4 || sd->wordlen == 2); - datalen = ROUNDUP(datalen, sd->wordlen); - - /* Start by copying command in the spi-outbuffer */ - if (sd->wordlen == 4) { /* 32bit spid */ - *(uint32 *)spi_outbuf2 = bcmswap32(cmd_arg); - if (datalen & 0x3) - datalen += (4 - (datalen & 0x3)); - } else if (sd->wordlen == 2) { /* 16bit spid */ - *(uint16 *)spi_outbuf2 = bcmswap16(cmd_arg & 0xffff); - *(uint16 *)&spi_outbuf2[2] = bcmswap16((cmd_arg & 0xffff0000) >> 16); - if (datalen & 0x1) - datalen++; - } else { - sd_err(("%s: Host is %d bit spid, could not create SPI command.\n", - __FUNCTION__, 8 * sd->wordlen)); - return ERROR; - } - - /* for Write, put the data into the output buffer */ - if (datalen != 0) { - if (sd->wordlen == 4) { /* 32bit spid */ - *(uint32 *)&spi_outbuf2[CMDLEN] = bcmswap32(byte); - } else if (sd->wordlen == 2) { /* 16bit spid */ - *(uint16 *)&spi_outbuf2[CMDLEN] = bcmswap16(byte & 0xffff); - *(uint16 *)&spi_outbuf2[CMDLEN + 2] = - bcmswap16((byte & 0xffff0000) >> 16); - } - } - - /* +4 for cmd, +4 for dstatus */ - hostlen = datalen + 8; - hostlen += (4 - (hostlen & 0x3)); - spi_sendrecv(sd, spi_outbuf2, spi_inbuf2, hostlen); - - /* Last 4bytes are dstatus. Device is configured to return status bits. */ - if (sd->wordlen == 4) { /* 32bit spid */ - sd->card_dstatus = bcmswap32(*(uint32 *)&spi_inbuf2[datalen + CMDLEN ]); - } else if (sd->wordlen == 2) { /* 16bit spid */ - sd->card_dstatus = (bcmswap16(*(uint16 *)&spi_inbuf2[datalen + CMDLEN ]) | - (bcmswap16(*(uint16 *)&spi_inbuf2[datalen + CMDLEN + 2]) << 16)); - } else { - sd_err(("%s: Host is %d bit machine, could not read SPI dstatus.\n", - __FUNCTION__, 8 * sd->wordlen)); - return ERROR; - } - - if (sd->card_dstatus) - sd_trace(("dstatus after byte rewrite = 0x%x\n", sd->card_dstatus)); - - return (BCME_OK); -} - -/* Program the response delay corresponding to the spi function */ -static int -bcmspi_prog_resp_delay(sdioh_info_t *sd, int func, uint8 resp_delay) -{ - if (sd->resp_delay_all == FALSE) - return (BCME_OK); - - if (sd->prev_fun == func) - return (BCME_OK); - - if (F0_RESPONSE_DELAY == F1_RESPONSE_DELAY) - return (BCME_OK); - - bcmspi_card_byterewrite(sd, SPI_FUNC_0, SPID_RESPONSE_DELAY, resp_delay); - - /* Remember function for which to avoid reprogramming resp-delay in next iteration */ - sd->prev_fun = func; - - return (BCME_OK); - -} - -#define GSPI_RESYNC_PATTERN 0x0 - -/* A resync pattern is a 32bit MOSI line with all zeros. Its a special command in gSPI. - * It resets the spi-bkplane logic so that all F1 related ping-pong buffer logic is - * synchronised and all queued resuests are cancelled. - */ -static int -bcmspi_resync_f1(sdioh_info_t *sd) -{ - uint32 cmd_arg = GSPI_RESYNC_PATTERN, data = 0, datalen = 0; - - - /* Set up and issue the SPI command. MSByte goes out on bus first. Increase datalen - * according to the wordlen mode(16/32bit) the device is in. - */ - ASSERT(sd->wordlen == 4 || sd->wordlen == 2); - datalen = ROUNDUP(datalen, sd->wordlen); - - /* Start by copying command in the spi-outbuffer */ - *(uint32 *)spi_outbuf2 = cmd_arg; - - /* for Write, put the data into the output buffer */ - *(uint32 *)&spi_outbuf2[CMDLEN] = data; - - /* +4 for cmd, +4 for dstatus */ - spi_sendrecv(sd, spi_outbuf2, spi_inbuf2, datalen + 8); - - /* Last 4bytes are dstatus. Device is configured to return status bits. */ - if (sd->wordlen == 4) { /* 32bit spid */ - sd->card_dstatus = bcmswap32(*(uint32 *)&spi_inbuf2[datalen + CMDLEN ]); - } else if (sd->wordlen == 2) { /* 16bit spid */ - sd->card_dstatus = (bcmswap16(*(uint16 *)&spi_inbuf2[datalen + CMDLEN ]) | - (bcmswap16(*(uint16 *)&spi_inbuf2[datalen + CMDLEN + 2]) << 16)); - } else { - sd_err(("%s: Host is %d bit machine, could not read SPI dstatus.\n", - __FUNCTION__, 8 * sd->wordlen)); - return ERROR; - } - - if (sd->card_dstatus) - sd_trace(("dstatus after resync pattern write = 0x%x\n", sd->card_dstatus)); - - return (BCME_OK); -} - -uint32 dstatus_count = 0; - -static int -bcmspi_update_stats(sdioh_info_t *sd, uint32 cmd_arg) -{ - uint32 dstatus = sd->card_dstatus; - struct spierrstats_t *spierrstats = &sd->spierrstats; - int err = SUCCESS; - - sd_trace(("cmd = 0x%x, dstatus = 0x%x\n", cmd_arg, dstatus)); - - /* Store dstatus of last few gSPI transactions */ - spierrstats->dstatus[dstatus_count % NUM_PREV_TRANSACTIONS] = dstatus; - spierrstats->spicmd[dstatus_count % NUM_PREV_TRANSACTIONS] = cmd_arg; - dstatus_count++; - - if (sd->card_init_done == FALSE) - return err; - - if (dstatus & STATUS_DATA_NOT_AVAILABLE) { - spierrstats->dna++; - sd_trace(("Read data not available on F1 addr = 0x%x\n", - GFIELD(cmd_arg, SPI_REG_ADDR))); - /* Clear dna bit */ - bcmspi_card_byterewrite(sd, SPI_FUNC_0, SPID_INTR_REG, DATA_UNAVAILABLE); - } - - if (dstatus & STATUS_UNDERFLOW) { - spierrstats->rdunderflow++; - sd_err(("FIFO underflow happened due to current F2 read command.\n")); - } - - if (dstatus & STATUS_OVERFLOW) { - spierrstats->wroverflow++; - sd_err(("FIFO overflow happened due to current (F1/F2) write command.\n")); - if ((sd->chip == BCM4329_CHIP_ID) && (sd->chiprev == 0)) { - bcmspi_card_byterewrite(sd, SPI_FUNC_0, SPID_INTR_REG, F1_OVERFLOW); - bcmspi_resync_f1(sd); - sd_err(("Recovering from F1 FIFO overflow.\n")); - } else { - err = ERROR_OF; - } - } - - if (dstatus & STATUS_F2_INTR) { - spierrstats->f2interrupt++; - sd_trace(("Interrupt from F2. SW should clear corresponding IntStatus bits\n")); - } - - if (dstatus & STATUS_F3_INTR) { - spierrstats->f3interrupt++; - sd_err(("Interrupt from F3. SW should clear corresponding IntStatus bits\n")); - } - - if (dstatus & STATUS_HOST_CMD_DATA_ERR) { - spierrstats->hostcmddataerr++; - sd_err(("Error in CMD or Host data, detected by CRC/Checksum (optional)\n")); - } - - if (dstatus & STATUS_F2_PKT_AVAILABLE) { - spierrstats->f2pktavailable++; - sd_trace(("Packet is available/ready in F2 TX FIFO\n")); - sd_trace(("Packet length = %d\n", sd->dwordmode ? - ((dstatus & STATUS_F2_PKT_LEN_MASK) >> (STATUS_F2_PKT_LEN_SHIFT - 2)) : - ((dstatus & STATUS_F2_PKT_LEN_MASK) >> STATUS_F2_PKT_LEN_SHIFT))); - } - - if (dstatus & STATUS_F3_PKT_AVAILABLE) { - spierrstats->f3pktavailable++; - sd_err(("Packet is available/ready in F3 TX FIFO\n")); - sd_err(("Packet length = %d\n", - (dstatus & STATUS_F3_PKT_LEN_MASK) >> STATUS_F3_PKT_LEN_SHIFT)); - } - - return err; -} - -extern int -sdioh_abort(sdioh_info_t *sd, uint func) -{ - return 0; -} - -int -sdioh_start(sdioh_info_t *sd, int stage) -{ - return SUCCESS; -} - -int -sdioh_stop(sdioh_info_t *sd) -{ - return SUCCESS; -} - - - -/* - * Private/Static work routines - */ -static int -bcmspi_host_init(sdioh_info_t *sd) -{ - - /* Default power on mode */ - sd->sd_mode = SDIOH_MODE_SPI; - sd->polled_mode = TRUE; - sd->host_init_done = TRUE; - sd->card_init_done = FALSE; - sd->adapter_slot = 1; - - return (SUCCESS); -} - -static int -get_client_blocksize(sdioh_info_t *sd) -{ - uint32 regdata[2]; - int status; - - /* Find F1/F2/F3 max packet size */ - if ((status = bcmspi_card_regread(sd, 0, SPID_F1_INFO_REG, - 8, regdata)) != SUCCESS) { - return status; - } - - sd_trace(("pkt_size regdata[0] = 0x%x, regdata[1] = 0x%x\n", - regdata[0], regdata[1])); - - sd->client_block_size[1] = (regdata[0] & F1_MAX_PKT_SIZE) >> 2; - sd_trace(("Func1 blocksize = %d\n", sd->client_block_size[1])); - ASSERT(sd->client_block_size[1] == BLOCK_SIZE_F1); - - sd->client_block_size[2] = ((regdata[0] >> 16) & F2_MAX_PKT_SIZE) >> 2; - sd_trace(("Func2 blocksize = %d\n", sd->client_block_size[2])); - ASSERT(sd->client_block_size[2] == BLOCK_SIZE_F2); - - sd->client_block_size[3] = (regdata[1] & F3_MAX_PKT_SIZE) >> 2; - sd_trace(("Func3 blocksize = %d\n", sd->client_block_size[3])); - ASSERT(sd->client_block_size[3] == BLOCK_SIZE_F3); - - return 0; -} - -static int -bcmspi_client_init(sdioh_info_t *sd) -{ - uint32 status_en_reg = 0; - sd_trace(("%s: Powering up slot %d\n", __FUNCTION__, sd->adapter_slot)); - -#ifdef HSMODE - if (!spi_start_clock(sd, (uint16)sd_divisor)) { - sd_err(("spi_start_clock failed\n")); - return ERROR; - } -#else - /* Start at ~400KHz clock rate for initialization */ - if (!spi_start_clock(sd, 128)) { - sd_err(("spi_start_clock failed\n")); - return ERROR; - } -#endif /* HSMODE */ - - if (!bcmspi_host_device_init_adapt(sd)) { - sd_err(("bcmspi_host_device_init_adapt failed\n")); - return ERROR; - } - - if (!bcmspi_test_card(sd)) { - sd_err(("bcmspi_test_card failed\n")); - return ERROR; - } - - sd->num_funcs = SPI_MAX_IOFUNCS; - - get_client_blocksize(sd); - - /* Apply resync pattern cmd with all zeros to reset spi-bkplane F1 logic */ - bcmspi_resync_f1(sd); - - sd->dwordmode = FALSE; - - bcmspi_card_regread(sd, 0, SPID_STATUS_ENABLE, 1, &status_en_reg); - - sd_trace(("%s: Enabling interrupt with dstatus \n", __FUNCTION__)); - status_en_reg |= INTR_WITH_STATUS; - - - if (bcmspi_card_regwrite(sd, SPI_FUNC_0, SPID_STATUS_ENABLE, 1, - status_en_reg & 0xff) != SUCCESS) { - sd_err(("%s: Unable to set response delay for all fun's.\n", __FUNCTION__)); - return ERROR; - } - - -#ifndef HSMODE - /* After configuring for High-Speed mode, set the desired clock rate. */ - if (!spi_start_clock(sd, 4)) { - sd_err(("spi_start_clock failed\n")); - return ERROR; - } -#endif /* HSMODE */ - - sd->card_init_done = TRUE; - - - return SUCCESS; -} - -static int -bcmspi_set_highspeed_mode(sdioh_info_t *sd, bool hsmode) -{ - uint32 regdata; - int status; - - if ((status = bcmspi_card_regread(sd, 0, SPID_CONFIG, - 4, ®data)) != SUCCESS) - return status; - - sd_trace(("In %s spih-ctrl = 0x%x \n", __FUNCTION__, regdata)); - - - if (hsmode == TRUE) { - sd_trace(("Attempting to enable High-Speed mode.\n")); - - if (regdata & HIGH_SPEED_MODE) { - sd_trace(("Device is already in High-Speed mode.\n")); - return status; - } else { - regdata |= HIGH_SPEED_MODE; - sd_trace(("Writing %08x to device at %08x\n", regdata, SPID_CONFIG)); - if ((status = bcmspi_card_regwrite(sd, 0, SPID_CONFIG, - 4, regdata)) != SUCCESS) { - return status; - } - } - } else { - sd_trace(("Attempting to disable High-Speed mode.\n")); - - if (regdata & HIGH_SPEED_MODE) { - regdata &= ~HIGH_SPEED_MODE; - sd_trace(("Writing %08x to device at %08x\n", regdata, SPID_CONFIG)); - if ((status = bcmspi_card_regwrite(sd, 0, SPID_CONFIG, - 4, regdata)) != SUCCESS) - return status; - } - else { - sd_trace(("Device is already in Low-Speed mode.\n")); - return status; - } - } - - spi_controller_highspeed_mode(sd, hsmode); - - return TRUE; -} - -#define bcmspi_find_curr_mode(sd) { \ - sd->wordlen = 2; \ - status = bcmspi_card_regread_fixedaddr(sd, 0, SPID_TEST_READ, 4, ®data); \ - regdata &= 0xff; \ - if ((regdata == 0xad) || (regdata == 0x5b) || \ - (regdata == 0x5d) || (regdata == 0x5a)) \ - break; \ - sd->wordlen = 4; \ - status = bcmspi_card_regread_fixedaddr(sd, 0, SPID_TEST_READ, 4, ®data); \ - regdata &= 0xff; \ - if ((regdata == 0xad) || (regdata == 0x5b) || \ - (regdata == 0x5d) || (regdata == 0x5a)) \ - break; \ - sd_trace(("Silicon testability issue: regdata = 0x%x." \ - " Expected 0xad, 0x5a, 0x5b or 0x5d.\n", regdata)); \ - OSL_DELAY(100000); \ -} - -#define INIT_ADAPT_LOOP 100 - -/* Adapt clock-phase-speed-bitwidth between host and device */ -static bool -bcmspi_host_device_init_adapt(sdioh_info_t *sd) -{ - uint32 wrregdata, regdata = 0; - int status; - int i; - - /* Due to a silicon testability issue, the first command from the Host - * to the device will get corrupted (first bit will be lost). So the - * Host should poll the device with a safe read request. ie: The Host - * should try to read F0 addr 0x14 using the Fixed address mode - * (This will prevent a unintended write command to be detected by device) - */ - for (i = 0; i < INIT_ADAPT_LOOP; i++) { - /* If device was not power-cycled it will stay in 32bit mode with - * response-delay-all bit set. Alternate the iteration so that - * read either with or without response-delay for F0 to succeed. - */ - bcmspi_find_curr_mode(sd); - sd->resp_delay_all = (i & 0x1) ? TRUE : FALSE; - - bcmspi_find_curr_mode(sd); - sd->dwordmode = TRUE; - - bcmspi_find_curr_mode(sd); - sd->dwordmode = FALSE; - } - - /* Bail out, device not detected */ - if (i == INIT_ADAPT_LOOP) - return FALSE; - - /* Softreset the spid logic */ - if ((sd->dwordmode) || (sd->wordlen == 4)) { - bcmspi_card_regwrite(sd, 0, SPID_RESET_BP, 1, RESET_ON_WLAN_BP_RESET|RESET_SPI); - bcmspi_card_regread(sd, 0, SPID_RESET_BP, 1, ®data); - sd_trace(("reset reg read = 0x%x\n", regdata)); - sd_trace(("dwordmode = %d, wordlen = %d, resp_delay_all = %d\n", sd->dwordmode, - sd->wordlen, sd->resp_delay_all)); - /* Restore default state after softreset */ - sd->wordlen = 2; - sd->dwordmode = FALSE; - } - - if (sd->wordlen == 4) { - if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4, ®data)) != - SUCCESS) - return FALSE; - if (regdata == TEST_RO_DATA_32BIT_LE) { - sd_trace(("Spid is already in 32bit LE mode. Value read = 0x%x\n", - regdata)); - sd_trace(("Spid power was left on.\n")); - } else { - sd_err(("Spid power was left on but signature read failed." - " Value read = 0x%x\n", regdata)); - return FALSE; - } - } else { - sd->wordlen = 2; - -#define CTRL_REG_DEFAULT 0x00010430 /* according to the host m/c */ - - wrregdata = (CTRL_REG_DEFAULT); - sd->resp_delay_all = TRUE; - if (sd->resp_delay_all == TRUE) { - /* Enable response delay for all */ - wrregdata |= (RESP_DELAY_ALL << 16); - /* Program response delay value */ - wrregdata &= 0xffff00ff; - wrregdata |= (F1_RESPONSE_DELAY << 8); - sd->prev_fun = SPI_FUNC_1; - bcmspi_card_regwrite(sd, 0, SPID_CONFIG, 4, wrregdata); - } - - if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4, ®data)) != SUCCESS) - return FALSE; - sd_trace(("(we are still in 16bit mode) 32bit READ LE regdata = 0x%x\n", regdata)); - -#ifndef HSMODE - wrregdata |= (CLOCK_PHASE | CLOCK_POLARITY); - wrregdata &= ~HIGH_SPEED_MODE; - bcmspi_card_regwrite(sd, 0, SPID_CONFIG, 4, wrregdata); -#endif /* HSMODE */ - - for (i = 0; i < INIT_ADAPT_LOOP; i++) { - if ((regdata == 0xfdda7d5b) || (regdata == 0xfdda7d5a)) { - sd_trace(("0xfeedbead was leftshifted by 1-bit.\n")); - if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4, - ®data)) != SUCCESS) - return FALSE; - } - OSL_DELAY(1000); - } - - - /* Change to host controller intr-polarity of active-low */ - wrregdata &= ~INTR_POLARITY; - sd_trace(("(we are still in 16bit mode) 32bit Write LE reg-ctrl-data = 0x%x\n", - wrregdata)); - /* Change to 32bit mode */ - wrregdata |= WORD_LENGTH_32; - bcmspi_card_regwrite(sd, 0, SPID_CONFIG, 4, wrregdata); - - /* Change command/data packaging in 32bit LE mode */ - sd->wordlen = 4; - - if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4, ®data)) != SUCCESS) - return FALSE; - - if (regdata == TEST_RO_DATA_32BIT_LE) { - sd_trace(("Read spid passed. Value read = 0x%x\n", regdata)); - sd_trace(("Spid had power-on cycle OR spi was soft-resetted \n")); - } else { - sd_err(("Stale spid reg values read as it was kept powered. Value read =" - "0x%x\n", regdata)); - return FALSE; - } - } - - - return TRUE; -} - -static bool -bcmspi_test_card(sdioh_info_t *sd) -{ - uint32 regdata; - int status; - - if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_READ, 4, ®data)) != SUCCESS) - return FALSE; - - if (regdata == (TEST_RO_DATA_32BIT_LE)) - sd_trace(("32bit LE regdata = 0x%x\n", regdata)); - else { - sd_trace(("Incorrect 32bit LE regdata = 0x%x\n", regdata)); - return FALSE; - } - - -#define RW_PATTERN1 0xA0A1A2A3 -#define RW_PATTERN2 0x4B5B6B7B - - regdata = RW_PATTERN1; - if ((status = bcmspi_card_regwrite(sd, 0, SPID_TEST_RW, 4, regdata)) != SUCCESS) - return FALSE; - regdata = 0; - if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_RW, 4, ®data)) != SUCCESS) - return FALSE; - if (regdata != RW_PATTERN1) { - sd_err(("Write-Read spid failed. Value wrote = 0x%x, Value read = 0x%x\n", - RW_PATTERN1, regdata)); - return FALSE; - } else - sd_trace(("R/W spid passed. Value read = 0x%x\n", regdata)); - - regdata = RW_PATTERN2; - if ((status = bcmspi_card_regwrite(sd, 0, SPID_TEST_RW, 4, regdata)) != SUCCESS) - return FALSE; - regdata = 0; - if ((status = bcmspi_card_regread(sd, 0, SPID_TEST_RW, 4, ®data)) != SUCCESS) - return FALSE; - if (regdata != RW_PATTERN2) { - sd_err(("Write-Read spid failed. Value wrote = 0x%x, Value read = 0x%x\n", - RW_PATTERN2, regdata)); - return FALSE; - } else - sd_trace(("R/W spid passed. Value read = 0x%x\n", regdata)); - - return TRUE; -} - -static int -bcmspi_driver_init(sdioh_info_t *sd) -{ - sd_trace(("%s\n", __FUNCTION__)); - if ((bcmspi_host_init(sd)) != SUCCESS) { - return ERROR; - } - - if (bcmspi_client_init(sd) != SUCCESS) { - return ERROR; - } - - return SUCCESS; -} - -/* Read device reg */ -static int -bcmspi_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 *data) -{ - int status; - uint32 cmd_arg, dstatus; - - ASSERT(regsize); - - if (func == 2) - sd_trace(("Reg access on F2 will generate error indication in dstatus bits.\n")); - - cmd_arg = 0; - cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 0); - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */ - cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, regsize == BLOCK_SIZE_F2 ? 0 : regsize); - - sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg)); - sd_trace(("%s: rw=%d, func=%d, regaddr=0x%08x, data=0x%x\n", __FUNCTION__, 0, func, - regaddr, *data)); - - if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, cmd_arg, data, regsize)) - != SUCCESS) - return status; - - bcmspi_cmd_getdstatus(sd, &dstatus); - if (dstatus) - sd_trace(("dstatus =0x%x\n", dstatus)); - - return SUCCESS; -} - -static int -bcmspi_card_regread_fixedaddr(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 *data) -{ - - int status; - uint32 cmd_arg; - uint32 dstatus; - - ASSERT(regsize); - - if (func == 2) - sd_trace(("Reg access on F2 will generate error indication in dstatus bits.\n")); - - cmd_arg = 0; - cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 0); - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 0); /* Fixed access */ - cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, regsize); - - sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg)); - - if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, cmd_arg, data, regsize)) - != SUCCESS) - return status; - - sd_trace(("%s: rw=%d, func=%d, regaddr=0x%08x, data=0x%x\n", __FUNCTION__, 0, func, - regaddr, *data)); - - bcmspi_cmd_getdstatus(sd, &dstatus); - sd_trace(("dstatus =0x%x\n", dstatus)); - return SUCCESS; -} - -/* write a device register */ -static int -bcmspi_card_regwrite(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 data) -{ - int status; - uint32 cmd_arg, dstatus; - - ASSERT(regsize); - - cmd_arg = 0; - - cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 1); - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */ - cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, regsize == BLOCK_SIZE_F2 ? 0 : regsize); - - sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg)); - sd_trace(("%s: rw=%d, func=%d, regaddr=0x%08x, data=0x%x\n", __FUNCTION__, 1, func, - regaddr, data)); - - - if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, cmd_arg, &data, regsize)) - != SUCCESS) - return status; - - bcmspi_cmd_getdstatus(sd, &dstatus); - if (dstatus) - sd_trace(("dstatus =0x%x\n", dstatus)); - - return SUCCESS; -} - -/* write a device register - 1 byte */ -static int -bcmspi_card_bytewrite(sdioh_info_t *sd, int func, uint32 regaddr, uint8 *byte) -{ - int status; - uint32 cmd_arg; - uint32 dstatus; - uint32 data = (uint32)(*byte); - - cmd_arg = 0; - cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); /* Incremental access */ - cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, regaddr); - cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, 1); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, 1); - - sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg)); - sd_trace(("%s: func=%d, regaddr=0x%08x, data=0x%x\n", __FUNCTION__, func, - regaddr, data)); - - if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, - cmd_arg, &data, 1)) != SUCCESS) { - return status; - } - - bcmspi_cmd_getdstatus(sd, &dstatus); - if (dstatus) - sd_trace(("dstatus =0x%x\n", dstatus)); - - return SUCCESS; -} - -void -bcmspi_cmd_getdstatus(sdioh_info_t *sd, uint32 *dstatus_buffer) -{ - *dstatus_buffer = sd->card_dstatus; -} - -/* 'data' is of type uint32 whereas other buffers are of type uint8 */ -static int -bcmspi_cmd_issue(sdioh_info_t *sd, bool use_dma, uint32 cmd_arg, - uint32 *data, uint32 datalen) -{ - uint32 i, j; - uint8 resp_delay = 0; - int err = SUCCESS; - uint32 hostlen; - uint32 spilen = 0; - uint32 dstatus_idx = 0; - uint16 templen, buslen, len, *ptr = NULL; - - sd_trace(("spi cmd = 0x%x\n", cmd_arg)); - - if (DWORDMODE_ON) { - spilen = GFIELD(cmd_arg, SPI_LEN); - if ((GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_0) || - (GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_1)) - dstatus_idx = spilen * 3; - - if ((GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2) && - (GFIELD(cmd_arg, SPI_RW_FLAG) == 1)) { - spilen = spilen << 2; - dstatus_idx = (spilen % 16) ? (16 - (spilen % 16)) : 0; - /* convert len to mod16 size */ - spilen = ROUNDUP(spilen, 16); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, (spilen >> 2)); - } - } - - /* Set up and issue the SPI command. MSByte goes out on bus first. Increase datalen - * according to the wordlen mode(16/32bit) the device is in. - */ - if (sd->wordlen == 4) { /* 32bit spid */ - *(uint32 *)spi_outbuf = bcmswap32(cmd_arg); - if (datalen & 0x3) - datalen += (4 - (datalen & 0x3)); - } else if (sd->wordlen == 2) { /* 16bit spid */ - *(uint16 *)spi_outbuf = bcmswap16(cmd_arg & 0xffff); - *(uint16 *)&spi_outbuf[2] = bcmswap16((cmd_arg & 0xffff0000) >> 16); - if (datalen & 0x1) - datalen++; - if (datalen < 4) - datalen = ROUNDUP(datalen, 4); - } else { - sd_err(("Host is %d bit spid, could not create SPI command.\n", - 8 * sd->wordlen)); - return ERROR; - } - - /* for Write, put the data into the output buffer */ - if (GFIELD(cmd_arg, SPI_RW_FLAG) == 1) { - /* We send len field of hw-header always a mod16 size, both from host and dongle */ - if (DWORDMODE_ON) { - if (GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2) { - ptr = (uint16 *)&data[0]; - templen = *ptr; - /* ASSERT(*ptr == ~*(ptr + 1)); */ - templen = ROUNDUP(templen, 16); - *ptr = templen; - sd_trace(("actual tx len = %d\n", (uint16)(~*(ptr+1)))); - } - } - - if (datalen != 0) { - for (i = 0; i < datalen/4; i++) { - if (sd->wordlen == 4) { /* 32bit spid */ - *(uint32 *)&spi_outbuf[i * 4 + CMDLEN] = - bcmswap32(data[i]); - } else if (sd->wordlen == 2) { /* 16bit spid */ - *(uint16 *)&spi_outbuf[i * 4 + CMDLEN] = - bcmswap16(data[i] & 0xffff); - *(uint16 *)&spi_outbuf[i * 4 + CMDLEN + 2] = - bcmswap16((data[i] & 0xffff0000) >> 16); - } - } - } - } - - /* Append resp-delay number of bytes and clock them out for F0/1/2 reads. */ - if (GFIELD(cmd_arg, SPI_RW_FLAG) == 0) { - int func = GFIELD(cmd_arg, SPI_FUNCTION); - switch (func) { - case 0: - resp_delay = sd->resp_delay_all ? F0_RESPONSE_DELAY : 0; - break; - case 1: - resp_delay = F1_RESPONSE_DELAY; - break; - case 2: - resp_delay = sd->resp_delay_all ? F2_RESPONSE_DELAY : 0; - break; - default: - ASSERT(0); - break; - } - /* Program response delay */ - bcmspi_prog_resp_delay(sd, func, resp_delay); - } - - /* +4 for cmd and +4 for dstatus */ - hostlen = datalen + 8 + resp_delay; - hostlen += dstatus_idx; - hostlen += (4 - (hostlen & 0x3)); - spi_sendrecv(sd, spi_outbuf, spi_inbuf, hostlen); - - /* for Read, get the data into the input buffer */ - if (datalen != 0) { - if (GFIELD(cmd_arg, SPI_RW_FLAG) == 0) { /* if read cmd */ - for (j = 0; j < datalen/4; j++) { - if (sd->wordlen == 4) { /* 32bit spid */ - data[j] = bcmswap32(*(uint32 *)&spi_inbuf[j * 4 + - CMDLEN + resp_delay]); - } else if (sd->wordlen == 2) { /* 16bit spid */ - data[j] = (bcmswap16(*(uint16 *)&spi_inbuf[j * 4 + - CMDLEN + resp_delay])) | - ((bcmswap16(*(uint16 *)&spi_inbuf[j * 4 + - CMDLEN + resp_delay + 2])) << 16); - } - } - - if ((DWORDMODE_ON) && (GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2)) { - ptr = (uint16 *)&data[0]; - templen = *ptr; - buslen = len = ~(*(ptr + 1)); - buslen = ROUNDUP(buslen, 16); - /* populate actual len in hw-header */ - if (templen == buslen) - *ptr = len; - } - } - } - - /* Restore back the len field of the hw header */ - if (DWORDMODE_ON) { - if ((GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2) && - (GFIELD(cmd_arg, SPI_RW_FLAG) == 1)) { - ptr = (uint16 *)&data[0]; - *ptr = (uint16)(~*(ptr+1)); - } - } - - dstatus_idx += (datalen + CMDLEN + resp_delay); - /* Last 4bytes are dstatus. Device is configured to return status bits. */ - if (sd->wordlen == 4) { /* 32bit spid */ - sd->card_dstatus = bcmswap32(*(uint32 *)&spi_inbuf[dstatus_idx]); - } else if (sd->wordlen == 2) { /* 16bit spid */ - sd->card_dstatus = (bcmswap16(*(uint16 *)&spi_inbuf[dstatus_idx]) | - (bcmswap16(*(uint16 *)&spi_inbuf[dstatus_idx + 2]) << 16)); - } else { - sd_err(("Host is %d bit machine, could not read SPI dstatus.\n", - 8 * sd->wordlen)); - return ERROR; - } - if (sd->card_dstatus == 0xffffffff) { - sd_err(("looks like not a GSPI device or device is not powered.\n")); - } - - err = bcmspi_update_stats(sd, cmd_arg); - - return err; - -} - -static int -bcmspi_card_buf(sdioh_info_t *sd, int rw, int func, bool fifo, - uint32 addr, int nbytes, uint32 *data) -{ - int status; - uint32 cmd_arg; - bool write = rw == SDIOH_READ ? 0 : 1; - uint retries = 0; - - bool enable; - uint32 spilen; - - cmd_arg = 0; - - ASSERT(nbytes); - ASSERT(nbytes <= sd->client_block_size[func]); - - if (write) sd->t_cnt++; else sd->r_cnt++; - - if (func == 2) { - /* Frame len check limited by gSPI. */ - if ((nbytes > 2000) && write) { - sd_trace((">2KB write: F2 wr of %d bytes\n", nbytes)); - } - /* ASSERT(nbytes <= 2048); Fix bigger len gspi issue and uncomment. */ - /* If F2 fifo on device is not ready to receive data, don't do F2 transfer */ - if (write) { - uint32 dstatus; - /* check F2 ready with cached one */ - bcmspi_cmd_getdstatus(sd, &dstatus); - if ((dstatus & STATUS_F2_RX_READY) == 0) { - retries = WAIT_F2RXFIFORDY; - enable = 0; - while (retries-- && !enable) { - OSL_DELAY(WAIT_F2RXFIFORDY_DELAY * 1000); - bcmspi_card_regread(sd, SPI_FUNC_0, SPID_STATUS_REG, 4, - &dstatus); - if (dstatus & STATUS_F2_RX_READY) - enable = TRUE; - } - if (!enable) { - struct spierrstats_t *spierrstats = &sd->spierrstats; - spierrstats->f2rxnotready++; - sd_err(("F2 FIFO is not ready to receive data.\n")); - return ERROR; - } - sd_trace(("No of retries on F2 ready %d\n", - (WAIT_F2RXFIFORDY - retries))); - } - } - } - - /* F2 transfers happen on 0 addr */ - addr = (func == 2) ? 0 : addr; - - /* In pio mode buffer is read using fixed address fifo in func 1 */ - if ((func == 1) && (fifo)) - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 0); - else - cmd_arg = SFIELD(cmd_arg, SPI_ACCESS, 1); - - cmd_arg = SFIELD(cmd_arg, SPI_FUNCTION, func); - cmd_arg = SFIELD(cmd_arg, SPI_REG_ADDR, addr); - cmd_arg = SFIELD(cmd_arg, SPI_RW_FLAG, write); - spilen = sd->data_xfer_count = MIN(sd->client_block_size[func], nbytes); - if ((sd->dwordmode == TRUE) && (GFIELD(cmd_arg, SPI_FUNCTION) == SPI_FUNC_2)) { - /* convert len to mod4 size */ - spilen = spilen + ((spilen & 0x3) ? (4 - (spilen & 0x3)): 0); - cmd_arg = SFIELD(cmd_arg, SPI_LEN, (spilen >> 2)); - } else - cmd_arg = SFIELD(cmd_arg, SPI_LEN, spilen); - - if ((func == 2) && (fifo == 1)) { - sd_data(("%s: %s func %d, %s, addr 0x%x, len %d bytes, r_cnt %d t_cnt %d\n", - __FUNCTION__, write ? "Wr" : "Rd", func, "INCR", - addr, nbytes, sd->r_cnt, sd->t_cnt)); - } - - sd_trace(("%s cmd_arg = 0x%x\n", __FUNCTION__, cmd_arg)); - sd_data(("%s: %s func %d, %s, addr 0x%x, len %d bytes, r_cnt %d t_cnt %d\n", - __FUNCTION__, write ? "Wd" : "Rd", func, "INCR", - addr, nbytes, sd->r_cnt, sd->t_cnt)); - - - if ((status = bcmspi_cmd_issue(sd, sd->sd_use_dma, cmd_arg, - data, nbytes)) != SUCCESS) { - sd_err(("%s: cmd_issue failed for %s\n", __FUNCTION__, - (write ? "write" : "read"))); - return status; - } - - /* gSPI expects that hw-header-len is equal to spi-command-len */ - if ((func == 2) && (rw == SDIOH_WRITE) && (sd->dwordmode == FALSE)) { - ASSERT((uint16)sd->data_xfer_count == (uint16)(*data & 0xffff)); - ASSERT((uint16)sd->data_xfer_count == (uint16)(~((*data & 0xffff0000) >> 16))); - } - - if ((nbytes > 2000) && !write) { - sd_trace((">2KB read: F2 rd of %d bytes\n", nbytes)); - } - - return SUCCESS; -} - -/* Reset and re-initialize the device */ -int -sdioh_sdio_reset(sdioh_info_t *si) -{ - si->card_init_done = FALSE; - return bcmspi_client_init(si); -} diff --git a/drivers/net/wireless/bcm4329/include/bcmspibrcm.h b/drivers/net/wireless/bcm4329/include/bcmspibrcm.h deleted file mode 100644 index 9dce878d11e2..000000000000 --- a/drivers/net/wireless/bcm4329/include/bcmspibrcm.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * SD-SPI Protocol Conversion - BCMSDH->gSPI Translation Layer - * - * Copyright (C) 2010, Broadcom Corporation - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; - * the contents of this file may not be disclosed to third parties, copied - * or duplicated in any form, in whole or in part, without the prior - * written permission of Broadcom Corporation. - * - * $Id: bcmspibrcm.h,v 1.4.4.1.4.3.6.1 2008/09/27 17:03:25 Exp $ - */ - -/* global msglevel for debug messages - bitvals come from sdiovar.h */ - -#define sd_err(x) -#define sd_trace(x) -#define sd_info(x) -#define sd_debug(x) -#define sd_data(x) -#define sd_ctrl(x) - -#define sd_log(x) - -#define SDIOH_ASSERT(exp) \ - do { if (!(exp)) \ - printf("!!!ASSERT fail: file %s lines %d", __FILE__, __LINE__); \ - } while (0) - -#define BLOCK_SIZE_F1 64 -#define BLOCK_SIZE_F2 2048 -#define BLOCK_SIZE_F3 2048 - -/* internal return code */ -#define SUCCESS 0 -#undef ERROR -#define ERROR 1 -#define ERROR_UF 2 -#define ERROR_OF 3 - -/* private bus modes */ -#define SDIOH_MODE_SPI 0 - -#define USE_BLOCKMODE 0x2 /* Block mode can be single block or multi */ -#define USE_MULTIBLOCK 0x4 - -struct sdioh_info { - uint cfg_bar; /* pci cfg address for bar */ - uint32 caps; /* cached value of capabilities reg */ - void *bar0; /* BAR0 for PCI Device */ - osl_t *osh; /* osh handler */ - void *controller; /* Pointer to SPI Controller's private data struct */ - - uint lockcount; /* nest count of spi_lock() calls */ - bool client_intr_enabled; /* interrupt connnected flag */ - bool intr_handler_valid; /* client driver interrupt handler valid */ - sdioh_cb_fn_t intr_handler; /* registered interrupt handler */ - void *intr_handler_arg; /* argument to call interrupt handler */ - bool initialized; /* card initialized */ - uint32 target_dev; /* Target device ID */ - uint32 intmask; /* Current active interrupts */ - void *sdos_info; /* Pointer to per-OS private data */ - - uint32 controller_type; /* Host controller type */ - uint8 version; /* Host Controller Spec Compliance Version */ - uint irq; /* Client irq */ - uint32 intrcount; /* Client interrupts */ - uint32 local_intrcount; /* Controller interrupts */ - bool host_init_done; /* Controller initted */ - bool card_init_done; /* Client SDIO interface initted */ - bool polled_mode; /* polling for command completion */ - - bool sd_use_dma; /* DMA on CMD53 */ - bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */ - /* Must be on for sd_multiblock to be effective */ - bool use_client_ints; /* If this is false, make sure to restore */ - /* polling hack in wl_linux.c:wl_timer() */ - int adapter_slot; /* Maybe dealing with multiple slots/controllers */ - int sd_mode; /* SD1/SD4/SPI */ - int client_block_size[SPI_MAX_IOFUNCS]; /* Blocksize */ - uint32 data_xfer_count; /* Current transfer */ - uint16 card_rca; /* Current Address */ - uint8 num_funcs; /* Supported funcs on client */ - uint32 card_dstatus; /* 32bit device status */ - uint32 com_cis_ptr; - uint32 func_cis_ptr[SPI_MAX_IOFUNCS]; - void *dma_buf; - ulong dma_phys; - int r_cnt; /* rx count */ - int t_cnt; /* tx_count */ - uint32 wordlen; /* host processor 16/32bits */ - uint32 prev_fun; - uint32 chip; - uint32 chiprev; - bool resp_delay_all; - bool dwordmode; - - struct spierrstats_t spierrstats; -}; - -/************************************************************ - * Internal interfaces: per-port references into bcmspibrcm.c - */ - -/* Global message bits */ -extern uint sd_msglevel; - -/************************************************************** - * Internal interfaces: bcmspibrcm.c references to per-port code - */ - -/* Interrupt (de)registration routines */ -extern int spi_register_irq(sdioh_info_t *sd, uint irq); -extern void spi_free_irq(uint irq, sdioh_info_t *sd); - -/* OS-specific interrupt wrappers (atomic interrupt enable/disable) */ -extern void spi_lock(sdioh_info_t *sd); -extern void spi_unlock(sdioh_info_t *sd); - -/* Allocate/init/free per-OS private data */ -extern int spi_osinit(sdioh_info_t *sd); -extern void spi_osfree(sdioh_info_t *sd); - -#define SPI_RW_FLAG_M BITFIELD_MASK(1) /* Bit [31] - R/W Command Bit */ -#define SPI_RW_FLAG_S 31 -#define SPI_ACCESS_M BITFIELD_MASK(1) /* Bit [30] - Fixed/Incr Access */ -#define SPI_ACCESS_S 30 -#define SPI_FUNCTION_M BITFIELD_MASK(2) /* Bit [29:28] - Function Number */ -#define SPI_FUNCTION_S 28 -#define SPI_REG_ADDR_M BITFIELD_MASK(17) /* Bit [27:11] - Address */ -#define SPI_REG_ADDR_S 11 -#define SPI_LEN_M BITFIELD_MASK(11) /* Bit [10:0] - Packet length */ -#define SPI_LEN_S 0 diff --git a/drivers/net/wireless/bcm4329/include/spid.h b/drivers/net/wireless/bcm4329/include/spid.h deleted file mode 100644 index c740296de9af..000000000000 --- a/drivers/net/wireless/bcm4329/include/spid.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * SPI device spec header file - * - * Copyright (C) 2010, Broadcom Corporation - * All Rights Reserved. - * - * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; - * the contents of this file may not be disclosed to third parties, copied - * or duplicated in any form, in whole or in part, without the prior - * written permission of Broadcom Corporation. - * - * $Id: spid.h,v 1.7.10.1.16.3 2009/04/09 19:23:14 Exp $ - */ - -#ifndef _SPI_H -#define _SPI_H - -/* - * Brcm SPI Device Register Map. - * - */ - -typedef volatile struct { - uint8 config; /* 0x00, len, endian, clock, speed, polarity, wakeup */ - uint8 response_delay; /* 0x01, read response delay in bytes (corerev < 3) */ - uint8 status_enable; /* 0x02, status-enable, intr with status, response_delay - * function selection, command/data error check - */ - uint8 reset_bp; /* 0x03, reset on wlan/bt backplane reset (corerev >= 1) */ - uint16 intr_reg; /* 0x04, Intr status register */ - uint16 intr_en_reg; /* 0x06, Intr mask register */ - uint32 status_reg; /* 0x08, RO, Status bits of last spi transfer */ - uint16 f1_info_reg; /* 0x0c, RO, enabled, ready for data transfer, blocksize */ - uint16 f2_info_reg; /* 0x0e, RO, enabled, ready for data transfer, blocksize */ - uint16 f3_info_reg; /* 0x10, RO, enabled, ready for data transfer, blocksize */ - uint32 test_read; /* 0x14, RO 0xfeedbead signature */ - uint32 test_rw; /* 0x18, RW */ - uint8 resp_delay_f0; /* 0x1c, read resp delay bytes for F0 (corerev >= 3) */ - uint8 resp_delay_f1; /* 0x1d, read resp delay bytes for F1 (corerev >= 3) */ - uint8 resp_delay_f2; /* 0x1e, read resp delay bytes for F2 (corerev >= 3) */ - uint8 resp_delay_f3; /* 0x1f, read resp delay bytes for F3 (corerev >= 3) */ -} spi_regs_t; - -/* SPI device register offsets */ -#define SPID_CONFIG 0x00 -#define SPID_RESPONSE_DELAY 0x01 -#define SPID_STATUS_ENABLE 0x02 -#define SPID_RESET_BP 0x03 /* (corerev >= 1) */ -#define SPID_INTR_REG 0x04 /* 16 bits - Interrupt status */ -#define SPID_INTR_EN_REG 0x06 /* 16 bits - Interrupt mask */ -#define SPID_STATUS_REG 0x08 /* 32 bits */ -#define SPID_F1_INFO_REG 0x0C /* 16 bits */ -#define SPID_F2_INFO_REG 0x0E /* 16 bits */ -#define SPID_F3_INFO_REG 0x10 /* 16 bits */ -#define SPID_TEST_READ 0x14 /* 32 bits */ -#define SPID_TEST_RW 0x18 /* 32 bits */ -#define SPID_RESP_DELAY_F0 0x1c /* 8 bits (corerev >= 3) */ -#define SPID_RESP_DELAY_F1 0x1d /* 8 bits (corerev >= 3) */ -#define SPID_RESP_DELAY_F2 0x1e /* 8 bits (corerev >= 3) */ -#define SPID_RESP_DELAY_F3 0x1f /* 8 bits (corerev >= 3) */ - -/* Bit masks for SPID_CONFIG device register */ -#define WORD_LENGTH_32 0x1 /* 0/1 16/32 bit word length */ -#define ENDIAN_BIG 0x2 /* 0/1 Little/Big Endian */ -#define CLOCK_PHASE 0x4 /* 0/1 clock phase delay */ -#define CLOCK_POLARITY 0x8 /* 0/1 Idle state clock polarity is low/high */ -#define HIGH_SPEED_MODE 0x10 /* 1/0 High Speed mode / Normal mode */ -#define INTR_POLARITY 0x20 /* 1/0 Interrupt active polarity is high/low */ -#define WAKE_UP 0x80 /* 0/1 Wake-up command from Host to WLAN */ - -/* Bit mask for SPID_RESPONSE_DELAY device register */ -#define RESPONSE_DELAY_MASK 0xFF /* Configurable rd response delay in multiples of 8 bits */ - -/* Bit mask for SPID_STATUS_ENABLE device register */ -#define STATUS_ENABLE 0x1 /* 1/0 Status sent/not sent to host after read/write */ -#define INTR_WITH_STATUS 0x2 /* 0/1 Do-not / do-interrupt if status is sent */ -#define RESP_DELAY_ALL 0x4 /* Applicability of resp delay to F1 or all func's read */ -#define DWORD_PKT_LEN_EN 0x8 /* Packet len denoted in dwords instead of bytes */ -#define CMD_ERR_CHK_EN 0x20 /* Command error check enable */ -#define DATA_ERR_CHK_EN 0x40 /* Data error check enable */ - -/* Bit mask for SPID_RESET_BP device register */ -#define RESET_ON_WLAN_BP_RESET 0x4 /* enable reset for WLAN backplane */ -#define RESET_ON_BT_BP_RESET 0x8 /* enable reset for BT backplane */ -#define RESET_SPI 0x80 /* reset the above enabled logic */ - -/* Bit mask for SPID_INTR_REG device register */ -#define DATA_UNAVAILABLE 0x0001 /* Requested data not available; Clear by writing a "1" */ -#define F2_F3_FIFO_RD_UNDERFLOW 0x0002 -#define F2_F3_FIFO_WR_OVERFLOW 0x0004 -#define COMMAND_ERROR 0x0008 /* Cleared by writing 1 */ -#define DATA_ERROR 0x0010 /* Cleared by writing 1 */ -#define F2_PACKET_AVAILABLE 0x0020 -#define F3_PACKET_AVAILABLE 0x0040 -#define F1_OVERFLOW 0x0080 /* Due to last write. Bkplane has pending write requests */ -#define MISC_INTR0 0x0100 -#define MISC_INTR1 0x0200 -#define MISC_INTR2 0x0400 -#define MISC_INTR3 0x0800 -#define MISC_INTR4 0x1000 -#define F1_INTR 0x2000 -#define F2_INTR 0x4000 -#define F3_INTR 0x8000 - -/* Bit mask for 32bit SPID_STATUS_REG device register */ -#define STATUS_DATA_NOT_AVAILABLE 0x00000001 -#define STATUS_UNDERFLOW 0x00000002 -#define STATUS_OVERFLOW 0x00000004 -#define STATUS_F2_INTR 0x00000008 -#define STATUS_F3_INTR 0x00000010 -#define STATUS_F2_RX_READY 0x00000020 -#define STATUS_F3_RX_READY 0x00000040 -#define STATUS_HOST_CMD_DATA_ERR 0x00000080 -#define STATUS_F2_PKT_AVAILABLE 0x00000100 -#define STATUS_F2_PKT_LEN_MASK 0x000FFE00 -#define STATUS_F2_PKT_LEN_SHIFT 9 -#define STATUS_F3_PKT_AVAILABLE 0x00100000 -#define STATUS_F3_PKT_LEN_MASK 0xFFE00000 -#define STATUS_F3_PKT_LEN_SHIFT 21 - -/* Bit mask for 16 bits SPID_F1_INFO_REG device register */ -#define F1_ENABLED 0x0001 -#define F1_RDY_FOR_DATA_TRANSFER 0x0002 -#define F1_MAX_PKT_SIZE 0x01FC - -/* Bit mask for 16 bits SPID_F2_INFO_REG device register */ -#define F2_ENABLED 0x0001 -#define F2_RDY_FOR_DATA_TRANSFER 0x0002 -#define F2_MAX_PKT_SIZE 0x3FFC - -/* Bit mask for 16 bits SPID_F3_INFO_REG device register */ -#define F3_ENABLED 0x0001 -#define F3_RDY_FOR_DATA_TRANSFER 0x0002 -#define F3_MAX_PKT_SIZE 0x3FFC - -/* Bit mask for 32 bits SPID_TEST_READ device register read in 16bit LE mode */ -#define TEST_RO_DATA_32BIT_LE 0xFEEDBEAD - -/* Maximum number of I/O funcs */ -#define SPI_MAX_IOFUNCS 4 - -#define SPI_MAX_PKT_LEN (2048*4) - -/* Misc defines */ -#define SPI_FUNC_0 0 -#define SPI_FUNC_1 1 -#define SPI_FUNC_2 2 -#define SPI_FUNC_3 3 - -#define WAIT_F2RXFIFORDY 100 -#define WAIT_F2RXFIFORDY_DELAY 20 - -#endif /* _SPI_H */ diff --git a/drivers/net/wireless/bcm4329/include/wifi_version.h b/drivers/net/wireless/bcm4329/include/wifi_version.h deleted file mode 100644 index e65032641429..000000000000 --- a/drivers/net/wireless/bcm4329/include/wifi_version.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef WIFI_VERSION_H -#define WIFI_VERSION_H - -/* - * Broadcom BCM4329 driver version. - */ -#define BCM4329_DRV_VERSION "2.00" - -#endif /* WIFI_BCM4329_VERSION_H */ diff --git a/drivers/net/wireless/bcm4329/wl_cfg80211.c b/drivers/net/wireless/bcm4329/wl_cfg80211.c deleted file mode 100644 index 81491cb97746..000000000000 --- a/drivers/net/wireless/bcm4329/wl_cfg80211.c +++ /dev/null @@ -1,4491 +0,0 @@ -/* - * Linux Cfg80211 support - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: wl_cfg80211.c,v 1.1.2.28 2010/05/04 21:43:38 Exp $ - */ - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -static struct sdio_func *cfg80211_sdio_func = NULL; -static struct wl_dev *wl_cfg80211_dev = NULL; - -#ifdef WL_CFG80211_BACKTRACE -uint32 wl_dbg_level = WL_DBG_ERR | WL_DBG_INFO | WL_DBG_DBG; -#else -uint32 wl_dbg_level = WL_DBG_ERR | WL_DBG_INFO; -#endif - -#define WL_4329_FW_FILE "brcm/fw_4329.bin" -#define WL_4329_NVRAM_FILE "brcm/nvram_4329.txt" - -/* -** cfg80211_ops api/callback list -*/ -static int32 wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, - enum nl80211_iftype type, uint32 *flags, struct vif_params *params); -static int32 __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_scan_request *request, struct cfg80211_ssid *this_ssid); -static int32 wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_scan_request *request); -static int32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, uint32 changed); -static int32 wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ibss_params *params); -static int32 wl_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev); -static int32 wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, - uint8 *mac, struct station_info *sinfo); -static int32 wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, - struct net_device *dev, bool enabled, int32 timeout); -static int32 wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, - struct net_device *dev, const uint8 *addr, - const struct cfg80211_bitrate_mask *mask); -static int wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_connect_params *sme); -static int32 wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, - uint16 reason_code); -static int32 wl_cfg80211_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type, int32 dbm); -static int32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, int32 *dbm); -static int32 wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx); -static int32 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr, struct key_params *params); -static int32 wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr); -static int32 wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr, void *cookie, - void (*callback)(void *cookie, struct key_params *params)); -static int32 wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, - struct net_device *dev, uint8 key_idx); -static int32 wl_cfg80211_resume(struct wiphy *wiphy); -static int32 wl_cfg80211_suspend(struct wiphy *wiphy); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) -static int32 wl_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_pmksa *pmksa); -static int32 wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_pmksa *pmksa); -static int32 wl_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev); -#endif -/* -** event & event Q handlers for cfg80211 interfaces -*/ -static int32 wl_create_event_handler(struct wl_priv *wl); -static void wl_destroy_event_handler(struct wl_priv *wl); -static int32 wl_event_handler(void *data); -static void wl_init_eq(struct wl_priv *wl); -static void wl_flush_eq(struct wl_priv *wl); -static void wl_lock_eq(struct wl_priv *wl); -static void wl_unlock_eq(struct wl_priv *wl); -static void wl_init_eq_lock(struct wl_priv *wl); -static void wl_init_eloop_handler(struct wl_event_loop *el); -static struct wl_event_q *wl_deq_event(struct wl_priv *wl); -static int32 wl_enq_event(struct wl_priv *wl, uint32 type, const wl_event_msg_t *msg, void *data); -static void wl_put_event(struct wl_event_q *e); -static void wl_wakeup_event(struct wl_priv *wl); -static int32 wl_notify_connect_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data); -static int32 wl_notify_roaming_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data); -static int32 wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data); -static int32 wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data); -static int32 wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data); -static int32 wl_notify_mic_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data); - -/* -** register/deregister sdio function -*/ -static struct sdio_func *wl_sdio_func(void); -static void wl_clear_sdio_func(void); - -/* -** ioctl utilites -*/ -static int32 wl_dev_bufvar_get(struct net_device *dev, int8 *name, int8 *buf, int32 buf_len); -static __used int32 wl_dev_bufvar_set(struct net_device *dev, int8 *name, int8 *buf, int32 len); -static int32 wl_dev_intvar_set(struct net_device *dev, int8 *name, int32 val); -static int32 wl_dev_intvar_get(struct net_device *dev, int8 *name, int32 *retval); -static int32 wl_dev_ioctl(struct net_device *dev, uint32 cmd, void *arg, uint32 len); - - -/* -** cfg80211 set_wiphy_params utilities -*/ -static int32 wl_set_frag(struct net_device *dev, uint32 frag_threshold); -static int32 wl_set_rts(struct net_device *dev, uint32 frag_threshold); -static int32 wl_set_retry(struct net_device *dev, uint32 retry, bool l); - -/* -** wl profile utilities -*/ -static int32 wl_update_prof(struct wl_priv *wl, const wl_event_msg_t *e, void *data, int32 item); -static void * wl_read_prof(struct wl_priv *wl, int32 item); -static void wl_init_prof(struct wl_profile *prof); - - -/* -** cfg80211 connect utilites -*/ -static int32 wl_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme); -static int32 wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme); -static int32 wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme); -static int32 wl_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme); -static int32 wl_set_set_sharedkey(struct net_device *dev, struct cfg80211_connect_params *sme); -static int32 wl_get_assoc_ies(struct wl_priv *wl); - - -/* -** information element utilities -*/ -static void wl_rst_ie(struct wl_priv *wl); -static int32 wl_add_ie(struct wl_priv *wl, uint8 t, uint8 l, uint8 *v); -static int32 wl_mrg_ie(struct wl_priv *wl, uint8 *ie_stream, uint16 ie_size); -static int32 wl_cp_ie(struct wl_priv *wl, uint8 *dst, uint16 dst_size); -static uint32 wl_get_ielen(struct wl_priv *wl); - - -static int32 wl_mode_to_nl80211_iftype(int32 mode); - -static struct wireless_dev *wl_alloc_wdev(int32 sizeof_iface, struct device *dev); -static void wl_free_wdev(struct wl_priv *wl); - -static int32 wl_inform_bss(struct wl_priv *wl); -static int32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi); -static int32 wl_update_bss_info(struct wl_priv *wl); - -static int32 wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr, struct key_params *params); - - -/* -** key indianess swap utilities -*/ -static void swap_key_from_BE(struct wl_wsec_key *key); -static void swap_key_to_BE(struct wl_wsec_key *key); - - -/* -** wl_priv memory init/deinit utilities -*/ -static int32 wl_init_priv_mem(struct wl_priv *wl); -static void wl_deinit_priv_mem(struct wl_priv *wl); - -static void wl_delay(uint32 ms); - -/* -** store/restore cfg80211 instance data -*/ -static void wl_set_drvdata(struct wl_dev *dev, void *data); -static void *wl_get_drvdata(struct wl_dev *dev); - -/* -** ibss mode utilities -*/ -static bool wl_is_ibssmode(struct wl_priv *wl); -static bool wl_is_ibssstarter(struct wl_priv *wl); - -/* -** dongle up/down , default configuration utilities -*/ -static bool wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e); -static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e); -static void wl_link_up(struct wl_priv *wl); -static void wl_link_down(struct wl_priv *wl); -static int32 wl_dongle_mode(struct net_device *ndev, int32 iftype); -static int32 __wl_cfg80211_up(struct wl_priv *wl); -static int32 __wl_cfg80211_down(struct wl_priv *wl); -static int32 wl_dongle_probecap(struct wl_priv *wl); -static void wl_init_conf(struct wl_conf *conf); - -/* -** dongle configuration utilities -*/ -#ifndef EMBEDDED_PLATFORM -static int32 wl_dongle_mode(struct net_device *ndev, int32 iftype); -static int32 wl_dongle_country(struct net_device *ndev, uint8 ccode); -static int32 wl_dongle_up(struct net_device *ndev, uint32 up); -static int32 wl_dongle_power(struct net_device *ndev, uint32 power_mode); -static int32 wl_dongle_glom(struct net_device *ndev, uint32 glom, uint32 dongle_align); -static int32 wl_dongle_roam(struct net_device *ndev, uint32 roamvar, uint32 bcn_timeout); -static int32 wl_dongle_eventmsg(struct net_device *ndev); -static int32 wl_dongle_scantime(struct net_device *ndev, int32 scan_assoc_time, - int32 scan_unassoc_time); -static int32 wl_dongle_offload(struct net_device *ndev, int32 arpoe, int32 arp_ol); -static int32 wl_pattern_atoh(int8 *src, int8 *dst); -static int32 wl_dongle_filter(struct net_device *ndev, uint32 filter_mode); -static int32 wl_update_wiphybands(struct wl_priv *wl); -#endif /* !EMBEDDED_PLATFORM */ -static int32 wl_config_dongle(struct wl_priv *wl, bool need_lock); - -/* -** iscan handler -*/ -static void wl_iscan_timer(ulong data); -static void wl_term_iscan(struct wl_priv *wl); -static int32 wl_init_iscan(struct wl_priv *wl); -static int32 wl_iscan_thread(void *data); -static int32 wl_dev_iovar_setbuf(struct net_device *dev, int8 *iovar, void *param, - int32 paramlen, void *bufptr, int32 buflen); -static int32 wl_dev_iovar_getbuf(struct net_device *dev, int8 *iovar, void *param, - int32 paramlen, void *bufptr, int32 buflen); -static int32 wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid, uint16 action); -static int32 wl_do_iscan(struct wl_priv *wl); -static int32 wl_wakeup_iscan(struct wl_iscan_ctrl *iscan); -static int32 wl_invoke_iscan(struct wl_priv *wl); -static int32 wl_get_iscan_results(struct wl_iscan_ctrl *iscan, uint32 *status, - struct wl_scan_results **bss_list); -static void wl_notify_iscan_complete(struct wl_iscan_ctrl *iscan, bool aborted); -static void wl_init_iscan_eloop(struct wl_iscan_eloop *el); -static int32 wl_iscan_done(struct wl_priv *wl); -static int32 wl_iscan_pending(struct wl_priv *wl); -static int32 wl_iscan_inprogress(struct wl_priv *wl); -static int32 wl_iscan_aborted(struct wl_priv *wl); - -/* -** fw/nvram downloading handler -*/ -static void wl_init_fw(struct wl_fw_ctrl *fw); - -/* -* find most significant bit set -*/ -static __used uint32 wl_find_msb(uint16 bit16); - -/* -* update pmklist to dongle -*/ -static __used int32 wl_update_pmklist(struct net_device *dev, struct wl_pmk_list *pmk_list, - int32 err); - - -#define WL_PRIV_GET() \ - ({ \ - struct wl_iface *ci; \ - if (unlikely(!(wl_cfg80211_dev && (ci = wl_get_drvdata(wl_cfg80211_dev))))) { \ - WL_ERR(("wl_cfg80211_dev is unavailable\n")); \ - BUG(); \ - } \ - ci_to_wl(ci); \ - }) - -#define CHECK_SYS_UP() \ - do { \ - struct wl_priv *wl = wiphy_to_wl(wiphy); \ - if (unlikely(!test_bit(WL_STATUS_READY, &wl->status))) { \ - WL_INFO(("device is not ready : status (%d)\n", (int)wl->status)); \ - return -EIO; \ - } \ - } while (0) - - -extern int dhd_wait_pend8021x(struct net_device *dev); - -#if (WL_DBG_LEVEL > 0) -#define WL_DBG_ESTR_MAX 32 -static int8 wl_dbg_estr[][WL_DBG_ESTR_MAX] = { -"SET_SSID", "JOIN", "START", "AUTH", "AUTH_IND", -"DEAUTH", "DEAUTH_IND", "ASSOC", "ASSOC_IND", "REASSOC", -"REASSOC_IND", "DISASSOC", "DISASSOC_IND", "QUIET_START", "QUIET_END", -"BEACON_RX", "LINK", "MIC_ERROR", "NDIS_LINK", "ROAM", -"TXFAIL", "PMKID_CACHE", "RETROGRADE_TSF", "PRUNE", "AUTOAUTH", -"EAPOL_MSG", "SCAN_COMPLETE", "ADDTS_IND", "DELTS_IND", "BCNSENT_IND", -"BCNRX_MSG", "BCNLOST_MSG", "ROAM_PREP", "PFN_NET_FOUND", "PFN_NET_LOST", -"RESET_COMPLETE", "JOIN_START", "ROAM_START", "ASSOC_START", "IBSS_ASSOC", -"RADIO", "PSM_WATCHDOG", -"PROBREQ_MSG", -"SCAN_CONFIRM_IND", "PSK_SUP", "COUNTRY_CODE_CHANGED", "EXCEEDED_MEDIUM_TIME", "ICV_ERROR", -"UNICAST_DECODE_ERROR", "MULTICAST_DECODE_ERROR", "TRACE", -"IF", -"RSSI", "PFN_SCAN_COMPLETE", "ACTION_FRAME", "ACTION_FRAME_COMPLETE", -}; -#endif /* WL_DBG_LEVEL */ - -#define CHAN2G(_channel, _freq, _flags) { \ - .band = IEEE80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -#define CHAN5G(_channel, _flags) { \ - .band = IEEE80211_BAND_5GHZ, \ - .center_freq = 5000 + (5 * (_channel)), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -#define RATE_TO_BASE100KBPS(rate) (((rate) * 10) / 2) -#define RATETAB_ENT(_rateid, _flags) \ - { \ - .bitrate = RATE_TO_BASE100KBPS(_rateid), \ - .hw_value = (_rateid), \ - .flags = (_flags), \ - } - -static struct ieee80211_rate __wl_rates[] = { - RATETAB_ENT(WLC_RATE_1M, 0), - RATETAB_ENT(WLC_RATE_2M, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(WLC_RATE_5M5, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(WLC_RATE_11M, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(WLC_RATE_6M, 0), - RATETAB_ENT(WLC_RATE_9M, 0), - RATETAB_ENT(WLC_RATE_12M, 0), - RATETAB_ENT(WLC_RATE_18M, 0), - RATETAB_ENT(WLC_RATE_24M, 0), - RATETAB_ENT(WLC_RATE_36M, 0), - RATETAB_ENT(WLC_RATE_48M, 0), - RATETAB_ENT(WLC_RATE_54M, 0), -}; - -#define wl_a_rates (__wl_rates + 4) -#define wl_a_rates_size 8 -#define wl_g_rates (__wl_rates + 0) -#define wl_g_rates_size 12 - -static struct ieee80211_channel __wl_2ghz_channels[] = { - CHAN2G(1, 2412, 0), - CHAN2G(2, 2417, 0), - CHAN2G(3, 2422, 0), - CHAN2G(4, 2427, 0), - CHAN2G(5, 2432, 0), - CHAN2G(6, 2437, 0), - CHAN2G(7, 2442, 0), - CHAN2G(8, 2447, 0), - CHAN2G(9, 2452, 0), - CHAN2G(10, 2457, 0), - CHAN2G(11, 2462, 0), - CHAN2G(12, 2467, 0), - CHAN2G(13, 2472, 0), - CHAN2G(14, 2484, 0), -}; - -static struct ieee80211_channel __wl_5ghz_a_channels[] = { - CHAN5G(34, 0), CHAN5G(36, 0), - CHAN5G(38, 0), CHAN5G(40, 0), - CHAN5G(42, 0), CHAN5G(44, 0), - CHAN5G(46, 0), CHAN5G(48, 0), - CHAN5G(52, 0), CHAN5G(56, 0), - CHAN5G(60, 0), CHAN5G(64, 0), - CHAN5G(100, 0), CHAN5G(104, 0), - CHAN5G(108, 0), CHAN5G(112, 0), - CHAN5G(116, 0), CHAN5G(120, 0), - CHAN5G(124, 0), CHAN5G(128, 0), - CHAN5G(132, 0), CHAN5G(136, 0), - CHAN5G(140, 0), CHAN5G(149, 0), - CHAN5G(153, 0), CHAN5G(157, 0), - CHAN5G(161, 0), CHAN5G(165, 0), - CHAN5G(184, 0), CHAN5G(188, 0), - CHAN5G(192, 0), CHAN5G(196, 0), - CHAN5G(200, 0), CHAN5G(204, 0), - CHAN5G(208, 0), CHAN5G(212, 0), - CHAN5G(216, 0), -}; - -static struct ieee80211_channel __wl_5ghz_n_channels[] = { - CHAN5G(32, 0), CHAN5G(34, 0), - CHAN5G(36, 0), CHAN5G(38, 0), - CHAN5G(40, 0), CHAN5G(42, 0), - CHAN5G(44, 0), CHAN5G(46, 0), - CHAN5G(48, 0), CHAN5G(50, 0), - CHAN5G(52, 0), CHAN5G(54, 0), - CHAN5G(56, 0), CHAN5G(58, 0), - CHAN5G(60, 0), CHAN5G(62, 0), - CHAN5G(64, 0), CHAN5G(66, 0), - CHAN5G(68, 0), CHAN5G(70, 0), - CHAN5G(72, 0), CHAN5G(74, 0), - CHAN5G(76, 0), CHAN5G(78, 0), - CHAN5G(80, 0), CHAN5G(82, 0), - CHAN5G(84, 0), CHAN5G(86, 0), - CHAN5G(88, 0), CHAN5G(90, 0), - CHAN5G(92, 0), CHAN5G(94, 0), - CHAN5G(96, 0), CHAN5G(98, 0), - CHAN5G(100, 0), CHAN5G(102, 0), - CHAN5G(104, 0), CHAN5G(106, 0), - CHAN5G(108, 0), CHAN5G(110, 0), - CHAN5G(112, 0), CHAN5G(114, 0), - CHAN5G(116, 0), CHAN5G(118, 0), - CHAN5G(120, 0), CHAN5G(122, 0), - CHAN5G(124, 0), CHAN5G(126, 0), - CHAN5G(128, 0), CHAN5G(130, 0), - CHAN5G(132, 0), CHAN5G(134, 0), - CHAN5G(136, 0), CHAN5G(138, 0), - CHAN5G(140, 0), CHAN5G(142, 0), - CHAN5G(144, 0), CHAN5G(145, 0), - CHAN5G(146, 0), CHAN5G(147, 0), - CHAN5G(148, 0), CHAN5G(149, 0), - CHAN5G(150, 0), CHAN5G(151, 0), - CHAN5G(152, 0), CHAN5G(153, 0), - CHAN5G(154, 0), CHAN5G(155, 0), - CHAN5G(156, 0), CHAN5G(157, 0), - CHAN5G(158, 0), CHAN5G(159, 0), - CHAN5G(160, 0), CHAN5G(161, 0), - CHAN5G(162, 0), CHAN5G(163, 0), - CHAN5G(164, 0), CHAN5G(165, 0), - CHAN5G(166, 0), CHAN5G(168, 0), - CHAN5G(170, 0), CHAN5G(172, 0), - CHAN5G(174, 0), CHAN5G(176, 0), - CHAN5G(178, 0), CHAN5G(180, 0), - CHAN5G(182, 0), CHAN5G(184, 0), - CHAN5G(186, 0), CHAN5G(188, 0), - CHAN5G(190, 0), CHAN5G(192, 0), - CHAN5G(194, 0), CHAN5G(196, 0), - CHAN5G(198, 0), CHAN5G(200, 0), - CHAN5G(202, 0), CHAN5G(204, 0), - CHAN5G(206, 0), CHAN5G(208, 0), - CHAN5G(210, 0), CHAN5G(212, 0), - CHAN5G(214, 0), CHAN5G(216, 0), - CHAN5G(218, 0), CHAN5G(220, 0), - CHAN5G(222, 0), CHAN5G(224, 0), - CHAN5G(226, 0), CHAN5G(228, 0), -}; - -static struct ieee80211_supported_band __wl_band_2ghz = { - .band = IEEE80211_BAND_2GHZ, - .channels = __wl_2ghz_channels, - .n_channels = ARRAY_SIZE(__wl_2ghz_channels), - .bitrates = wl_g_rates, - .n_bitrates = wl_g_rates_size, -}; - -static struct ieee80211_supported_band __wl_band_5ghz_a = { - .band = IEEE80211_BAND_5GHZ, - .channels = __wl_5ghz_a_channels, - .n_channels = ARRAY_SIZE(__wl_5ghz_a_channels), - .bitrates = wl_a_rates, - .n_bitrates = wl_a_rates_size, -}; - -static struct ieee80211_supported_band __wl_band_5ghz_n = { - .band = IEEE80211_BAND_5GHZ, - .channels = __wl_5ghz_n_channels, - .n_channels = ARRAY_SIZE(__wl_5ghz_n_channels), - .bitrates = wl_a_rates, - .n_bitrates = wl_a_rates_size, -}; - -static const uint32 __wl_cipher_suites[] = { - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, - WLAN_CIPHER_SUITE_AES_CMAC, -}; - -static void -swap_key_from_BE(struct wl_wsec_key *key) -{ - key->index = htod32(key->index); - key->len = htod32(key->len); - key->algo = htod32(key->algo); - key->flags = htod32(key->flags); - key->rxiv.hi = htod32(key->rxiv.hi); - key->rxiv.lo = htod16(key->rxiv.lo); - key->iv_initialized = htod32(key->iv_initialized); -} - -static void -swap_key_to_BE(struct wl_wsec_key *key) -{ - key->index = dtoh32(key->index); - key->len = dtoh32(key->len); - key->algo = dtoh32(key->algo); - key->flags = dtoh32(key->flags); - key->rxiv.hi = dtoh32(key->rxiv.hi); - key->rxiv.lo = dtoh16(key->rxiv.lo); - key->iv_initialized = dtoh32(key->iv_initialized); -} - -static int32 -wl_dev_ioctl(struct net_device *dev, uint32 cmd, void *arg, uint32 len) -{ - struct ifreq ifr; - struct wl_ioctl ioc; - mm_segment_t fs; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In : cmd (%d)\n", cmd)); -#endif - memset(&ioc, 0, sizeof(ioc)); - ioc.cmd = cmd; - ioc.buf = arg; - ioc.len = len; - strcpy(ifr.ifr_name, dev->name); - ifr.ifr_data = (caddr_t) &ioc; - - - fs = get_fs(); - set_fs(get_ds()); - err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE); - set_fs(fs); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, - enum nl80211_iftype type, uint32 *flags, struct vif_params *params) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - struct wireless_dev *wdev; - int32 infra = 0; - int32 ap = 0; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - switch (type) { - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_WDS: - WL_ERR(("type (%d) : currently we do not support this type\n", type)); - return -EOPNOTSUPP; - case NL80211_IFTYPE_ADHOC: - wl->conf->mode = WL_MODE_IBSS; - break; - case NL80211_IFTYPE_STATION: - wl->conf->mode = WL_MODE_BSS; - infra = 1; - break; - default: - return -EINVAL; - } - infra = htod32(infra); - ap = htod32(ap); - wdev = ndev->ieee80211_ptr; - wdev->iftype = type; - WL_DBG(("%s : ap (%d), infra (%d)\n", ndev->name, ap, infra)); - if (unlikely((err = wl_dev_ioctl(ndev, WLC_SET_INFRA, &infra, sizeof(infra)))) || - unlikely((err = wl_dev_ioctl(ndev, WLC_SET_AP, &ap, sizeof(ap))))) { - WL_ERR(("Error (%d)\n", err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - /* -EINPROGRESS: Call commit handler */ - return -EINPROGRESS; -} - -static void -wl_iscan_prep(struct wl_scan_params *params, struct wlc_ssid *ssid) -{ - memcpy(¶ms->bssid, ðer_bcast, ETHER_ADDR_LEN); - params->bss_type = DOT11_BSSTYPE_ANY; - params->scan_type = 0; - params->nprobes = -1; - params->active_time = -1; - params->passive_time = -1; - params->home_time = -1; - params->channel_num = 0; - - params->nprobes = htod32(params->nprobes); - params->active_time = htod32(params->active_time); - params->passive_time = htod32(params->passive_time); - params->home_time = htod32(params->home_time); - if (ssid && ssid->SSID_len) - memcpy(¶ms->ssid, ssid, sizeof(wlc_ssid_t)); - -} - -static int32 -wl_dev_iovar_setbuf(struct net_device *dev, int8 *iovar, void *param, - int32 paramlen, void *bufptr, int32 buflen) -{ - int32 iolen; - - iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen); - BUG_ON(unlikely(!iolen)); - - return wl_dev_ioctl(dev, WLC_SET_VAR, bufptr, iolen); -} - -static int32 -wl_dev_iovar_getbuf(struct net_device *dev, int8 *iovar, void *param, - int32 paramlen, void *bufptr, int32 buflen) -{ - int32 iolen; - - iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen); - BUG_ON(unlikely(!iolen)); - - return wl_dev_ioctl(dev, WLC_GET_VAR, bufptr, buflen); -} - -static int32 -wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid, uint16 action) -{ - int32 params_size = (WL_SCAN_PARAMS_FIXED_SIZE + OFFSETOF(wl_iscan_params_t, params)); - struct wl_iscan_params *params; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (ssid && ssid->SSID_len) - params_size += sizeof(struct wlc_ssid); - params = (struct wl_iscan_params *)kzalloc(params_size, GFP_KERNEL); - if (unlikely(!params)) - return -ENOMEM; - memset(params, 0, params_size); - BUG_ON(unlikely(params_size >= WLC_IOCTL_SMLEN)); - - wl_iscan_prep(¶ms->params, ssid); - - params->version = htod32(ISCAN_REQ_VERSION); - params->action = htod16(action); - params->scan_duration = htod16(0); - - /* params_size += OFFSETOF(wl_iscan_params_t, params); */ - if (unlikely((err = wl_dev_iovar_setbuf(iscan->dev, "iscan", params, params_size, - iscan->ioctl_buf, WLC_IOCTL_SMLEN)))) { - if (err == -EBUSY) { - WL_INFO(("system busy : iscan canceled\n")); - } else { - WL_ERR(("error (%d)\n", err)); - } - } - kfree(params); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - - -static int32 -wl_do_iscan(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl_to_iscan(wl); - struct wlc_ssid ssid; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - /* Broadcast scan by default */ - memset(&ssid, 0, sizeof(ssid)); - - iscan->state = WL_ISCAN_STATE_SCANING; - - if (wl->active_scan) { - int32 passive_scan = 0; - /* make it active scan */ - if (unlikely((err = wl_dev_ioctl(wl_to_ndev(wl), WLC_SET_PASSIVE_SCAN, - &passive_scan, sizeof(passive_scan))))) { - WL_DBG(("error (%d)\n", err)); - return err; - } - } - wl->iscan_kickstart = TRUE; - wl_run_iscan(iscan, &ssid, WL_SCAN_ACTION_START); - mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000); - iscan->timer_on = 1; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - - -static int32 -__wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_scan_request *request, struct cfg80211_ssid *this_ssid) -{ - struct wl_priv *wl = ndev_to_wl(ndev); - struct cfg80211_ssid *ssids; - struct wl_scan_req *sr = wl_to_sr(wl); - uint32 n_ssids; - bool iscan_req; - bool spec_scan; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely(test_bit(WL_STATUS_SCANNING, &wl->status))) { - WL_ERR(("Scanning already : status (%d)\n", (int)wl->status)); - return -EAGAIN; - } - if (unlikely(test_bit(WL_STATUS_SCAN_ABORTING, &wl->status))) { - WL_ERR(("Scanning being aborted : status (%d)\n", (int)wl->status)); - return -EAGAIN; - } - - iscan_req = FALSE; - spec_scan = FALSE; - if (request) { /* scan bss */ - ssids = request->ssids; - n_ssids = min(request->n_ssids, WL_NUM_SCAN_MAX); - if (wl->iscan_on && n_ssids && !ssids->ssid_len) { /* for specific scan, - * ssids->ssid_len has - * non-zero(ssid string) length. - * Otherwise this is 0. - * we do not iscan for - * specific scan request - */ - iscan_req = TRUE; - } - } else { /* scan in ibss */ - /* we don't do iscan in ibss */ - ssids = this_ssid; - n_ssids = 1; - } - wl->scan_request = request; - set_bit(WL_STATUS_SCANNING, &wl->status); - if (iscan_req) { - if (likely(!(err = wl_do_iscan(wl)))) - return err; - else - goto scan_out; - } else { - WL_DBG(("n_ssid (%d), ssid \"%s\", ssid_len (%d)\n", - n_ssids, ssids->ssid, ssids->ssid_len)); - memset(&sr->ssid, 0, sizeof(sr->ssid)); - if (n_ssids) { - sr->ssid.SSID_len = MIN(sizeof(sr->ssid.SSID), ssids->ssid_len); - if (sr->ssid.SSID_len) { - memcpy(sr->ssid.SSID, ssids->ssid, sr->ssid.SSID_len); - sr->ssid.SSID_len = htod32(sr->ssid.SSID_len); - WL_DBG(("Specific scan ssid=\"%s\" len=%d\n", sr->ssid.SSID, - sr->ssid.SSID_len)); - spec_scan = TRUE; - } else { - WL_DBG(("Broadcast scan\n")); - } - } else { - /* broadcast scan */ - WL_DBG(("Broadcast scan\n")); - } - WL_DBG(("sr->ssid.SSID_len (%d)\n", sr->ssid.SSID_len)); - if (wl->active_scan) { - int32 pssive_scan = 0; - /* make it active scan */ - if (unlikely((err = wl_dev_ioctl(ndev, WLC_SET_PASSIVE_SCAN, - &pssive_scan, sizeof(pssive_scan))))) { - WL_ERR(("WLC_SET_PASSIVE_SCAN error (%d)\n", err)); - goto scan_out; - } - } - if ((err = wl_dev_ioctl(ndev, WLC_SCAN, &sr->ssid, sizeof(sr->ssid)))) { - if (err == -EBUSY) { - WL_INFO(("system busy : scan for \"%s\" canceled\n", - sr->ssid.SSID)); - } else { - WL_ERR(("WLC_SCAN error (%d)\n", err)); - } - goto scan_out; - } - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return 0; - -scan_out: - clear_bit(WL_STATUS_SCANNING, &wl->status); - wl->scan_request = NULL; - return err; -} - - -static int32 -wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_scan_request *request) -{ - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - if (unlikely((err = __wl_cfg80211_scan(wiphy, ndev, request, NULL)))) { - WL_DBG(("scan error (%d)\n", err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_dev_intvar_set(struct net_device *dev, int8 *name, int32 val) -{ - int8 buf[WLC_IOCTL_SMLEN]; - uint32 len; - int32 err = 0; - - val = htod32(val); - len = bcm_mkiovar(name, (char *)(&val), sizeof(val), buf, sizeof(buf)); - BUG_ON(unlikely(!len)); - - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_VAR, buf, len)))) { - WL_ERR(("error (%d)\n", err)); - } - - return err; -} - -static int32 -wl_dev_intvar_get(struct net_device *dev, int8 *name, int32 *retval) -{ - union { - int8 buf[WLC_IOCTL_SMLEN]; - int32 val; - } var; - uint32 len; - uint32 data_null; - int32 err = 0; - - len = bcm_mkiovar(name, (char *)(&data_null), 0, (char *)(&var), sizeof(var.buf)); - BUG_ON(unlikely(!len)); - if (unlikely((err = wl_dev_ioctl(dev, WLC_GET_VAR, &var, len)))) { - WL_ERR(("error (%d)\n", err)); - } - *retval = dtoh32(var.val); - - return err; -} - -static int32 -wl_set_rts(struct net_device *dev, uint32 rts_threshold) -{ - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely((err = wl_dev_intvar_set(dev, "rtsthresh", rts_threshold)))) { - WL_ERR(("Error (%d)\n", err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_set_frag(struct net_device *dev, uint32 frag_threshold) -{ - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely((err = wl_dev_intvar_set(dev, "fragthresh", frag_threshold)))) { - WL_ERR(("Error (%d)\n", err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_set_retry(struct net_device *dev, uint32 retry, bool l) -{ - int32 err = 0; - uint32 cmd = (l ? WLC_SET_LRL : WLC_SET_SRL); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - retry = htod32(retry); - if (unlikely((err = wl_dev_ioctl(dev, cmd, &retry, sizeof(retry))))) { - WL_ERR(("cmd (%d) , error (%d)\n", cmd, err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, uint32 changed) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - struct net_device *ndev = wl_to_ndev(wl); - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - if (changed & WIPHY_PARAM_RTS_THRESHOLD && - (wl->conf->rts_threshold != wiphy->rts_threshold)) { - wl->conf->rts_threshold = wiphy->rts_threshold; - if (!(err = wl_set_rts(ndev, wl->conf->rts_threshold))) { - return err; - } - } - if (changed & WIPHY_PARAM_FRAG_THRESHOLD && - (wl->conf->frag_threshold != wiphy->frag_threshold)) { - wl->conf->frag_threshold = wiphy->frag_threshold; - if (!(err = wl_set_frag(ndev, wl->conf->frag_threshold))) { - return err; - } - } - if (changed & WIPHY_PARAM_RETRY_LONG && (wl->conf->retry_long != wiphy->retry_long)) { - wl->conf->retry_long = wiphy->retry_long; - if (!(err = wl_set_retry(ndev, wl->conf->retry_long, TRUE))) { - return err; - } - } - if (changed & WIPHY_PARAM_RETRY_SHORT && (wl->conf->retry_short != wiphy->retry_short)) { - wl->conf->retry_short = wiphy->retry_short; - if (!(err = wl_set_retry(ndev, wl->conf->retry_short, FALSE))) { - return err; - } - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ibss_params *params) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - struct cfg80211_bss *bss; - struct ieee80211_channel *chan; - struct wl_join_params join_params; - struct cfg80211_ssid ssid; - int32 scan_retry = 0; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In \n")); -#endif - CHECK_SYS_UP(); - if (params->bssid) { - WL_ERR(("Invalid bssid\n")); - return -EOPNOTSUPP; - } - bss = cfg80211_get_ibss(wiphy, NULL, params->ssid, params->ssid_len); - if (!bss) { - memcpy(ssid.ssid, params->ssid, params->ssid_len); - ssid.ssid_len = params->ssid_len; - do { - if (unlikely(__wl_cfg80211_scan(wiphy, dev, NULL, &ssid) == -EBUSY)) { - wl_delay(150); - } else { - break; - } - } while (++scan_retry < WL_SCAN_RETRY_MAX); - rtnl_unlock(); /* to allow scan_inform to paropagate to cfg80211 plane */ - schedule_timeout_interruptible(4 * HZ); /* wait 4 secons till scan done.... */ - rtnl_lock(); - bss = cfg80211_get_ibss(wiphy, NULL, - params->ssid, params->ssid_len); - } - if (bss) { - wl->ibss_starter = FALSE; - WL_DBG(("Found IBSS\n")); - } else { - wl->ibss_starter = TRUE; - } - if ((chan = params->channel)) { - wl->channel = ieee80211_frequency_to_channel(chan->center_freq); - } - /* - ** Join with specific BSSID and cached SSID - ** If SSID is zero join based on BSSID only - */ - memset(&join_params, 0, sizeof(join_params)); - memcpy((void *)join_params.ssid.SSID, (void *)params->ssid, params->ssid_len); - join_params.ssid.SSID_len = htod32(params->ssid_len); - if (params->bssid) - memcpy(&join_params.params.bssid, params->bssid, ETHER_ADDR_LEN); - else - memset(&join_params.params.bssid, 0, ETHER_ADDR_LEN); - - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, sizeof(join_params))))) { - WL_ERR(("Error (%d)\n", err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - wl_link_down(wl); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme) -{ - struct wl_priv *wl = ndev_to_wl(dev); - struct wl_security *sec; - int32 val = 0; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) - val = WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED; - else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) - val = WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED; - else - val = WPA_AUTH_DISABLED; - WL_DBG(("setting wpa_auth to 0x%0x\n", val)); - if (unlikely((err = wl_dev_intvar_set(dev, "wpa_auth", val)))) { - WL_ERR(("set wpa_auth failed (%d)\n", err)); - return err; - } - sec = wl_read_prof(wl, WL_PROF_SEC); - sec->wpa_versions = sme->crypto.wpa_versions; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme) -{ - struct wl_priv *wl = ndev_to_wl(dev); - struct wl_security *sec; - int32 val = 0; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - switch (sme->auth_type) { - case NL80211_AUTHTYPE_OPEN_SYSTEM: - val = 0; - WL_DBG(("open system\n")); - break; - case NL80211_AUTHTYPE_SHARED_KEY: - val = 1; - WL_DBG(("shared key\n")); - break; - case NL80211_AUTHTYPE_AUTOMATIC: - val = 2; - WL_DBG(("automatic\n")); - break; - case NL80211_AUTHTYPE_NETWORK_EAP: - WL_DBG(("network eap\n")); - default : - val = 2; - WL_ERR(("invalid auth type (%d)\n", sme->auth_type)); - break; - } - - if (unlikely((err = wl_dev_intvar_set(dev, "auth", val)))) { - WL_ERR(("set auth failed (%d)\n", err)); - return err; - } - sec = wl_read_prof(wl, WL_PROF_SEC); - sec->auth_type = sme->auth_type; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - - -static int32 -wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme) -{ - struct wl_priv *wl = ndev_to_wl(dev); - struct wl_security *sec; - int32 pval = 0; - int32 gval = 0; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (sme->crypto.n_ciphers_pairwise) { - switch (sme->crypto.ciphers_pairwise[0]) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - pval = WEP_ENABLED; - break; - case WLAN_CIPHER_SUITE_TKIP: - pval = TKIP_ENABLED; - break; - case WLAN_CIPHER_SUITE_CCMP: - pval = AES_ENABLED; - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - pval = AES_ENABLED; - break; - default: - WL_ERR(("invalid cipher pairwise (%d)\n", - sme->crypto.ciphers_pairwise[0])); - return -EINVAL; - } - } - if (sme->crypto.cipher_group) { - switch (sme->crypto.cipher_group) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - gval = WEP_ENABLED; - break; - case WLAN_CIPHER_SUITE_TKIP: - gval = TKIP_ENABLED; - break; - case WLAN_CIPHER_SUITE_CCMP: - gval = AES_ENABLED; - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - gval = AES_ENABLED; - break; - default: - WL_ERR(("invalid cipher group (%d)\n", sme->crypto.cipher_group)); - return -EINVAL; - } - } - - WL_DBG(("pval (%d) gval (%d)\n", pval, gval)); - if (unlikely((err = wl_dev_intvar_set(dev, "wsec", pval|gval)))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - - sec = wl_read_prof(wl, WL_PROF_SEC); - sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0]; - sec->cipher_group = sme->crypto.cipher_group; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme) -{ - struct wl_priv *wl = ndev_to_wl(dev); - struct wl_security *sec; - int32 val = 0; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - - if (sme->crypto.n_akm_suites) { - if (unlikely((err = wl_dev_intvar_get(dev, "wpa_auth", &val)))) { - WL_ERR(("could not get wpa_auth (%d)\n", err)); - return err; - } - if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) { - switch (sme->crypto.akm_suites[0]) { - case WLAN_AKM_SUITE_8021X: - val = WPA_AUTH_UNSPECIFIED; - break; - case WLAN_AKM_SUITE_PSK: - val = WPA_AUTH_PSK; - break; - default : - WL_ERR(("invalid cipher group (%d)\n", - sme->crypto.cipher_group)); - return -EINVAL; - } - } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) { - switch (sme->crypto.akm_suites[0]) { - case WLAN_AKM_SUITE_8021X: - val = WPA2_AUTH_UNSPECIFIED; - break; - case WLAN_AKM_SUITE_PSK: - val = WPA2_AUTH_PSK; - break; - default : - WL_ERR(("invalid cipher group (%d)\n", - sme->crypto.cipher_group)); - return -EINVAL; - } - } - - WL_DBG(("setting wpa_auth to %d\n", val)); - if (unlikely((err = wl_dev_intvar_set(dev, "wpa_auth", val)))) { - WL_ERR(("could not set wpa_auth (%d)\n", err)); - return err; - } - } - sec = wl_read_prof(wl, WL_PROF_SEC); - sec->wpa_auth = sme->crypto.akm_suites[0]; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_set_set_sharedkey(struct net_device *dev, struct cfg80211_connect_params *sme) -{ - struct wl_priv *wl = ndev_to_wl(dev); - struct wl_security *sec; - struct wl_wsec_key key; - int32 val; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - WL_DBG(("key len (%d)\n", sme->key_len)); - if (sme->key_len) { - sec = wl_read_prof(wl, WL_PROF_SEC); - WL_DBG(("wpa_versions 0x%x cipher_pairwise 0x%x\n", sec->wpa_versions, - sec->cipher_pairwise)); - if (!(sec->wpa_versions & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2)) && - (sec->cipher_pairwise & (WLAN_CIPHER_SUITE_WEP40 | - WLAN_CIPHER_SUITE_WEP104))) { - memset(&key, 0, sizeof(key)); - key.len = (uint32)sme->key_len; - key.index = (uint32)sme->key_idx; - if (unlikely(key.len > sizeof(key.data))) { - WL_ERR(("Too long key length (%u)\n", key.len)); - return -EINVAL; - } - memcpy(key.data, sme->key, key.len); - key.flags = WL_PRIMARY_KEY; - switch (sec->cipher_pairwise) { - case WLAN_CIPHER_SUITE_WEP40: - key.algo = CRYPTO_ALGO_WEP1; - break; - case WLAN_CIPHER_SUITE_WEP104: - key.algo = CRYPTO_ALGO_WEP128; - break; - default : - WL_ERR(("Invalid algorithm (%d)\n", - sme->crypto.ciphers_pairwise[0])); - return -EINVAL; - } - /* Set the new key/index */ - WL_DBG(("key length (%d) key index (%d) algo (%d)\n", key.len, - key.index, key.algo)); - WL_DBG(("key \"%s\"\n", key.data)); - swap_key_from_BE(&key); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key))))) { - WL_ERR(("WLC_SET_KEY error (%d)\n", err)); - return err; - } - if (sec->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) { - WL_DBG(("set auth_type to shared key\n")); - val = 1; /* shared key */ - if (unlikely((err = wl_dev_intvar_set(dev, "auth", val)))) { - WL_ERR(("set auth failed (%d)\n", err)); - return err; - } - } - } - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_connect_params *sme) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - struct ieee80211_channel *chan = sme->channel; - struct wlc_ssid ssid; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In \n")); -#endif - CHECK_SYS_UP(); - if (unlikely(!sme->ssid)) { - WL_ERR(("Invalid ssid\n")); - return -EOPNOTSUPP; - } - if (chan) { - wl->channel = ieee80211_frequency_to_channel(chan->center_freq); - WL_DBG(("channel (%d), center_req (%d) \n", wl->channel, chan->center_freq)); - } - WL_DBG(("ie (%p), ie_len (%d)\n", sme->ie, sme->ie_len)); - if (unlikely((err = wl_set_wpa_version(dev, sme)))) { - return err; - } - if (unlikely((err = wl_set_auth_type(dev, sme)))) { - return err; - } - if (unlikely((err = wl_set_set_cipher(dev, sme)))) { - return err; - } - if (unlikely((err = wl_set_key_mgmt(dev, sme)))) { - return err; - } - if (unlikely((err = wl_set_set_sharedkey(dev, sme)))) { - return err; - } - wl_update_prof(wl, NULL, sme->bssid, WL_PROF_BSSID); - /* - ** Join with specific BSSID and cached SSID - ** If SSID is zero join based on BSSID only - */ - memset(&ssid, 0, sizeof(ssid)); - ssid.SSID_len = MIN(sizeof(ssid.SSID), sme->ssid_len); - memcpy(ssid.SSID, sme->ssid, ssid.SSID_len); - ssid.SSID_len = htod32(ssid.SSID_len); - wl_update_prof(wl, NULL, &ssid, WL_PROF_SSID); - if (ssid.SSID_len < IEEE80211_MAX_SSID_LEN) { - WL_DBG(("ssid \"%s\", len (%d)\n", ssid.SSID, ssid.SSID_len)); - } - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_SSID, &ssid, sizeof(ssid))))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - set_bit(WL_STATUS_CONNECTING, &wl->status); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, - uint16 reason_code) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - scb_val_t scbval; - bool act = FALSE; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - WL_DBG(("Reason %d\n", reason_code)); - CHECK_SYS_UP(); - if (likely((act = *(bool *)wl_read_prof(wl, WL_PROF_ACT)))) { - scbval.val = reason_code; - memcpy(&scbval.ea, &wl->bssid, ETHER_ADDR_LEN); - scbval.val = htod32(scbval.val); - if (unlikely((err = wl_dev_ioctl(dev, WLC_DISASSOC, &scbval, - sizeof(scb_val_t))))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type, int32 dbm) -{ - - struct wl_priv *wl = wiphy_to_wl(wiphy); - struct net_device *ndev = wl_to_ndev(wl); - uint16 txpwrmw; - int32 err = 0; - int32 disable = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - switch (type) { - case TX_POWER_AUTOMATIC: - break; - case TX_POWER_LIMITED: - if (dbm < 0) { - WL_ERR(("TX_POWER_LIMITTED - dbm is negative\n")); - return -EINVAL; - } - break; - case TX_POWER_FIXED: - if (dbm < 0) { - WL_ERR(("TX_POWER_FIXED - dbm is negative..\n")); - return -EINVAL; - } - break; - } - /* Make sure radio is off or on as far as software is concerned */ - disable = WL_RADIO_SW_DISABLE << 16; - disable = htod32(disable); - if (unlikely((err = wl_dev_ioctl(ndev, WLC_SET_RADIO, &disable, sizeof(disable))))) { - WL_ERR(("WLC_SET_RADIO error (%d)\n", err)); - return err; - } - - if (dbm > 0xffff) - txpwrmw = 0xffff; - else - txpwrmw = (uint16)dbm; - if (unlikely((err = wl_dev_intvar_set(ndev, "qtxpower", - (int32)(bcm_mw_to_qdbm(txpwrmw)))))) { - WL_ERR(("qtxpower error (%d)\n", err)); - return err; - } - wl->conf->tx_power = dbm; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_get_tx_power(struct wiphy *wiphy, int32 *dbm) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - struct net_device *ndev = wl_to_ndev(wl); - int32 txpwrdbm; - uint8 result; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - if (unlikely((err = wl_dev_intvar_get(ndev, "qtxpower", &txpwrdbm)))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - result = (uint8)(txpwrdbm & ~WL_TXPWR_OVERRIDE); - *dbm = (int32)bcm_qdbm_to_mw(result); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, uint8 key_idx) -{ - uint32 index; - int32 wsec; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - WL_DBG(("key index (%d)\n", key_idx)); - CHECK_SYS_UP(); - - if (unlikely(err = wl_dev_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec)))) { - WL_ERR(("WLC_GET_WSEC error (%d)\n", err)); - return err; - } - wsec = dtoh32(wsec); - if (wsec & WEP_ENABLED) { - /* Just select a new current key */ - index = (uint32)key_idx; - index = htod32(index); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_KEY_PRIMARY, - &index, sizeof(index))))) { - WL_ERR(("error (%d)\n", err)); - } - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr, struct key_params *params) -{ - struct wl_wsec_key key; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - memset(&key, 0, sizeof(key)); - key.index = (uint32)key_idx; - /* Instead of bcast for ea address for default wep keys, driver needs it to be Null */ - if (!ETHER_ISMULTI(mac_addr)) - memcpy((char *)&key.ea, (void *)mac_addr, ETHER_ADDR_LEN); - key.len = (uint32)params->key_len; - /* check for key index change */ - if (key.len == 0) { - /* key delete */ - swap_key_from_BE(&key); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key))))) { - WL_ERR(("key delete error (%d)\n", err)); - return err; - } - } else { - if (key.len > sizeof(key.data)) { - WL_ERR(("Invalid key length (%d)\n", key.len)); - return -EINVAL; - } - - WL_DBG(("Setting the key index %d\n", key.index)); - memcpy(key.data, params->key, key.len); - - if (params->cipher == WLAN_CIPHER_SUITE_TKIP) { - uint8 keybuf[8]; - memcpy(keybuf, &key.data[24], sizeof(keybuf)); - memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); - memcpy(&key.data[16], keybuf, sizeof(keybuf)); - } - - /* if IW_ENCODE_EXT_RX_SEQ_VALID set */ - if (params->seq && params->seq_len == 6) { - /* rx iv */ - uint8 *ivptr; - ivptr = (uint8 *)params->seq; - key.rxiv.hi = (ivptr[5] << 24) | (ivptr[4] << 16) | - (ivptr[3] << 8) | ivptr[2]; - key.rxiv.lo = (ivptr[1] << 8) | ivptr[0]; - key.iv_initialized = TRUE; - } - - switch (params->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - key.algo = CRYPTO_ALGO_WEP1; - WL_DBG(("WLAN_CIPHER_SUITE_WEP40\n")); - break; - case WLAN_CIPHER_SUITE_WEP104: - key.algo = CRYPTO_ALGO_WEP128; - WL_DBG(("WLAN_CIPHER_SUITE_WEP104\n")); - break; - case WLAN_CIPHER_SUITE_TKIP: - key.algo = CRYPTO_ALGO_TKIP; - WL_DBG(("WLAN_CIPHER_SUITE_TKIP\n")); - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - key.algo = CRYPTO_ALGO_AES_CCM; - WL_DBG(("WLAN_CIPHER_SUITE_AES_CMAC\n")); - break; - case WLAN_CIPHER_SUITE_CCMP: - key.algo = CRYPTO_ALGO_AES_CCM; - WL_DBG(("WLAN_CIPHER_SUITE_CCMP\n")); - break; - default: - WL_ERR(("Invalid cipher (0x%x)\n", params->cipher)); - return -EINVAL; - } - swap_key_from_BE(&key); - - dhd_wait_pend8021x(dev); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key))))) { - WL_ERR(("WLC_SET_KEY error (%d)\n", err)); - return err; - } - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr, struct key_params *params) -{ - struct wl_wsec_key key; - int32 val; - int32 wsec; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - WL_DBG(("key index (%d)\n", key_idx)); - CHECK_SYS_UP(); - - if (mac_addr) - return wl_add_keyext(wiphy, dev, key_idx, mac_addr, params); - memset(&key, 0, sizeof(key)); - - key.len = (uint32)params->key_len; - key.index = (uint32)key_idx; - - if (unlikely(key.len > sizeof(key.data))) { - WL_ERR(("Too long key length (%u)\n", key.len)); - return -EINVAL; - } - memcpy(key.data, params->key, key.len); - - key.flags = WL_PRIMARY_KEY; - switch (params->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - key.algo = CRYPTO_ALGO_WEP1; - WL_DBG(("WLAN_CIPHER_SUITE_WEP40\n")); - break; - case WLAN_CIPHER_SUITE_WEP104: - key.algo = CRYPTO_ALGO_WEP128; - WL_DBG(("WLAN_CIPHER_SUITE_WEP104\n")); - break; - case WLAN_CIPHER_SUITE_TKIP: - key.algo = CRYPTO_ALGO_TKIP; - WL_DBG(("WLAN_CIPHER_SUITE_TKIP\n")); - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - key.algo = CRYPTO_ALGO_AES_CCM; - WL_DBG(("WLAN_CIPHER_SUITE_AES_CMAC\n")); - break; - case WLAN_CIPHER_SUITE_CCMP: - key.algo = CRYPTO_ALGO_AES_CCM; - WL_DBG(("WLAN_CIPHER_SUITE_CCMP\n")); - break; - default: - WL_ERR(("Invalid cipher (0x%x)\n", params->cipher)); - return -EINVAL; - } - - /* Set the new key/index */ - swap_key_from_BE(&key); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key))))) { - WL_ERR(("WLC_SET_KEY error (%d)\n", err)); - return err; - } - - val = WEP_ENABLED; - if (unlikely((err = wl_dev_intvar_get(dev, "wsec", &wsec)))) { - WL_ERR(("get wsec error (%d)\n", err)); - return err; - } - wsec &= ~(WEP_ENABLED); - wsec |= val; - if (unlikely((err = wl_dev_intvar_set(dev, "wsec", wsec)))) { - WL_ERR(("set wsec error (%d)\n", err)); - return err; - } - - val = 1; /* assume shared key. otherwise 0 */ - val = htod32(val); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val))))) { - WL_ERR(("WLC_SET_AUTH error (%d)\n", err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr) -{ - struct wl_wsec_key key; - int32 err = 0; - int32 val; - int32 wsec; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - memset(&key, 0, sizeof(key)); - - key.index = (uint32)key_idx; - key.flags = WL_PRIMARY_KEY; - key.algo = CRYPTO_ALGO_OFF; - - WL_DBG(("key index (%d)\n", key_idx)); - /* Set the new key/index */ - swap_key_from_BE(&key); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key))))) { - if (err == -EINVAL) { - if (key.index >= DOT11_MAX_DEFAULT_KEYS) { - /* we ignore this key index in this case */ - WL_DBG(("invalid key index (%d)\n", key_idx)); - } - } else { - WL_ERR(("WLC_SET_KEY error (%d)\n", err)); - } - return err; - } - - val = 0; - if (unlikely((err = wl_dev_intvar_get(dev, "wsec", &wsec)))) { - WL_ERR(("get wsec error (%d)\n", err)); - return err; - } - wsec &= ~(WEP_ENABLED); - wsec |= val; - if (unlikely((err = wl_dev_intvar_set(dev, "wsec", wsec)))) { - WL_ERR(("set wsec error (%d)\n", err)); - return err; - } - - val = 0; /* assume open key. otherwise 1 */ - val = htod32(val); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val))))) { - WL_ERR(("WLC_SET_AUTH error (%d)\n", err)); - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, - uint8 key_idx, const uint8 *mac_addr, void *cookie, - void (*callback)(void *cookie, struct key_params *params)) -{ - struct key_params params; - struct wl_wsec_key key; - struct wl_priv *wl = wiphy_to_wl(wiphy); - struct wl_security *sec; - int32 wsec; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - WL_DBG(("key index (%d)\n", key_idx)); - CHECK_SYS_UP(); - - memset(&key, 0, sizeof(key)); - key.index = key_idx; - swap_key_to_BE(&key); - memset(¶ms, 0, sizeof(params)); - params.key_len = (uint8)MIN(DOT11_MAX_KEY_SIZE, key.len); - memcpy(params.key, key.data, params.key_len); - - if (unlikely(err = wl_dev_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec)))) { - WL_ERR(("WLC_GET_WSEC error (%d)\n", err)); - return err; - } - wsec = dtoh32(wsec); - switch (wsec) { - case WEP_ENABLED: - sec = wl_read_prof(wl, WL_PROF_SEC); - if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { - params.cipher = WLAN_CIPHER_SUITE_WEP40; - WL_DBG(("WLAN_CIPHER_SUITE_WEP40\n")); - } else if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP104) { - params.cipher = WLAN_CIPHER_SUITE_WEP104; - WL_DBG(("WLAN_CIPHER_SUITE_WEP104\n")); - } - break; - case TKIP_ENABLED: - params.cipher = WLAN_CIPHER_SUITE_TKIP; - WL_DBG(("WLAN_CIPHER_SUITE_TKIP\n")); - break; - case AES_ENABLED: - params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; - WL_DBG(("WLAN_CIPHER_SUITE_AES_CMAC\n")); - break; - default: - WL_ERR(("Invalid algo (0x%x)\n", wsec)); - return -EINVAL; - } - - callback(cookie, ¶ms); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, - struct net_device *dev, uint8 key_idx) -{ - WL_INFO(("Not supported\n")); - CHECK_SYS_UP(); - return -EOPNOTSUPP; -} - -static int32 -wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, - uint8 *mac, struct station_info *sinfo) - -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - scb_val_t scb_val; - int rssi; - int32 rate; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - if (unlikely(memcmp(mac, wl_read_prof(wl, WL_PROF_BSSID), ETHER_ADDR_LEN))) { - WL_ERR(("Wrong Mac address\n")); - return -ENOENT; - } - - /* Report the current tx rate */ - if ((err = wl_dev_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate)))) { - WL_ERR(("Could not get rate (%d)\n", err)); - } else { - rate = dtoh32(rate); - sinfo->filled |= STATION_INFO_TX_BITRATE; - sinfo->txrate.legacy = rate * 5; - WL_DBG(("Rate %d Mbps\n", (rate/2))); - } - - if (test_bit(WL_STATUS_CONNECTED, &wl->status)) { - scb_val.val = 0; - if (unlikely(err = wl_dev_ioctl(dev, WLC_GET_RSSI, &scb_val, sizeof(scb_val_t)))) { - WL_ERR(("Could not get rssi (%d)\n", err)); - return err; - } - rssi = dtoh32(scb_val.val); - sinfo->filled |= STATION_INFO_SIGNAL; - sinfo->signal = rssi; - WL_DBG(("RSSI %d dBm\n", rssi)); - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, - bool enabled, int32 timeout) -{ - int32 pm; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - pm = enabled ? PM_FAST : PM_OFF; - pm = htod32(pm); - WL_DBG(("power save %s\n", (pm ? "enabled" : "disabled"))); - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm))))) { - if (err == -ENODEV) { - WL_DBG(("net_device is not ready yet\n")); - } else { - WL_ERR(("error (%d)\n", err)); - } - return err; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static __used uint32 -wl_find_msb(uint16 bit16) -{ - uint32 ret = 0; - - if (bit16 & 0xff00) { - ret += 8; - bit16 >>= 8; - } - - if (bit16 & 0xf0) { - ret += 4; - bit16 >>= 4; - } - - if (bit16 & 0xc) { - ret += 2; - bit16 >>= 2; - } - - if (bit16 & 2) - ret += bit16 & 2; - else if (bit16) - ret += bit16; - - return ret; -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) -static int32 -wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, - const uint8 *addr, const struct cfg80211_bitrate_mask *mask) -{ - struct wl_rateset rateset; - int32 rate; - int32 val; - int32 err_bg; - int32 err_a; - uint32 legacy; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - /* addr param is always NULL. ignore it */ - /* Get current rateset */ - if (unlikely((err = wl_dev_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, - sizeof(rateset))))) { - WL_ERR(("could not get current rateset (%d)\n", err)); - return err; - } - - rateset.count = dtoh32(rateset.count); - - if (!(legacy = wl_find_msb(mask->control[IEEE80211_BAND_2GHZ].legacy))) - legacy = wl_find_msb(mask->control[IEEE80211_BAND_5GHZ].legacy); - - val = wl_g_rates[legacy-1].bitrate * 100000; - - if (val < rateset.count) { - /* Select rate by rateset index */ - rate = rateset.rates[val] & 0x7f; - } else { - /* Specified rate in bps */ - rate = val / 500000; - } - - WL_DBG(("rate %d mbps\n", (rate/2))); - - /* - * - * Set rate override, - * Since the is a/b/g-blind, both a/bg_rate are enforced. - */ - err_bg = wl_dev_intvar_set(dev, "bg_rate", rate); - err_a = wl_dev_intvar_set(dev, "a_rate", rate); - if (unlikely(err_bg && err_a)) { - WL_ERR(("could not set fixed rate (%d) (%d)\n", err_bg, err_a)); - return (err_bg | err_a); - } - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} -#else -static int32 -wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, - const uint8 *addr, const struct cfg80211_bitrate_mask *mask) -{ - struct wl_rateset rateset; - int32 rate; - int32 val; - int32 err_bg; - int32 err_a; - int32 err = 0; - int i; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - /* addr param is always NULL. ignore it */ - /* Get current rateset */ - if (unlikely((err = wl_dev_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, - sizeof(rateset))))) { - WL_ERR(("could not get current rateset (%d)\n", err)); - return err; - } - - rateset.count = dtoh32(rateset.count); - - if (mask->fixed || mask->maxrate) { - val = mask->fixed ? (mask->fixed * 1000) : (mask->maxrate * 1000); - if (val < rateset.count) { - /* Select rate by rateset index */ - rate = rateset.rates[val] & 0x7f; - } else { - /* Specified rate in bps */ - rate = val / 500000; - } - } else { - /* Select maximum rate */ - rate = rateset.rates[rateset.count - 1] & 0x7f; - } - - if (mask->fixed) { - /* - Set rate override, - Since the is a/b/g-blind, both a/bg_rate are enforced. - */ - err_bg = wl_dev_intvar_set(dev, "bg_rate", rate); - err_a = wl_dev_intvar_set(dev, "a_rate", rate); - if (unlikely(err_bg && err_a)) { - WL_ERR(("could not set fixed rate (%d) (%d)\n", err_bg, err_a)); - return (err_bg | err_a); - } - } else { - /* - clear rate override - Since the is a/b/g-blind, both a/bg_rate are enforced. - */ - /* 0 is for clearing rate override */ - err_bg = wl_dev_intvar_set(dev, "bg_rate", 0); - /* 0 is for clearing rate override */ - err_a = wl_dev_intvar_set(dev, "a_rate", 0); - - if (unlikely(err_bg && err_a)) { - WL_ERR(("could not set max rate (%d) (%d)\n", err_bg, err_a)); - return (err_bg | err_a); - } - - /* Remove rates above selected rate */ - for (i = 0; i < rateset.count; i++) - if ((rateset.rates[i] & 0x7f) > rate) - break; - rateset.count = htod32(i); - - /* Set current rateset */ - if (unlikely((err = wl_dev_ioctl(dev, WLC_SET_RATESET, &rateset, - sizeof(rateset))))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) */ - -static int32 -wl_cfg80211_resume(struct wiphy *wiphy) -{ - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - wl_invoke_iscan(wiphy_to_wl(wiphy)); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_suspend(struct wiphy *wiphy) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - - set_bit(WL_STATUS_SCAN_ABORTING, &wl->status); - wl_term_iscan(wl); - if (wl->scan_request) { - cfg80211_scan_done(wl->scan_request, TRUE); /* TRUE means abort */ - wl->scan_request = NULL; - } - clear_bit(WL_STATUS_SCANNING, &wl->status); - clear_bit(WL_STATUS_SCAN_ABORTING, &wl->status); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static __used int32 -wl_update_pmklist(struct net_device *dev, struct wl_pmk_list *pmk_list, int32 err) -{ - int8 eabuf[ETHER_ADDR_STR_LEN]; - int i, j; - - memset(eabuf, 0, ETHER_ADDR_STR_LEN); - - WL_DBG(("No of elements %d\n", pmk_list->pmkids.npmkid)); - for (i = 0; i < pmk_list->pmkids.npmkid; i++) { - WL_DBG(("PMKID[%d]: %s =\n", i, - bcm_ether_ntoa(&pmk_list->pmkids.pmkid[i].BSSID, - eabuf))); - for (j = 0; j < WPA2_PMKID_LEN; j++) { - WL_DBG(("%02x\n", pmk_list->pmkids.pmkid[i].PMKID[j])); - } - } - if (likely(!err)) { - err = wl_dev_bufvar_set(dev, "pmkid_info", (char *)pmk_list, - sizeof(*pmk_list)); - } - - return err; -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) -static int32 -wl_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_pmksa *pmksa) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - int8 eabuf[ETHER_ADDR_STR_LEN]; - int32 err = 0; - int i; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - - CHECK_SYS_UP(); - memset(eabuf, 0, ETHER_ADDR_STR_LEN); - for (i = 0; i < wl->pmk_list->pmkids.npmkid; i++) - if (!memcmp(pmksa->bssid, &wl->pmk_list->pmkids.pmkid[i].BSSID, - ETHER_ADDR_LEN)) - break; - if (i < WL_NUM_PMKIDS_MAX) { - memcpy(&wl->pmk_list->pmkids.pmkid[i].BSSID, pmksa->bssid, ETHER_ADDR_LEN); - memcpy(&wl->pmk_list->pmkids.pmkid[i].PMKID, pmksa->pmkid, WPA2_PMKID_LEN); - if (i == wl->pmk_list->pmkids.npmkid) - wl->pmk_list->pmkids.npmkid++; - } else { - err = -EINVAL; - } - WL_DBG(("set_pmksa,IW_PMKSA_ADD - PMKID: %s =\n", - bcm_ether_ntoa(&wl->pmk_list->pmkids.pmkid[wl->pmk_list->pmkids.npmkid].BSSID, - eabuf))); - for (i = 0; i < WPA2_PMKID_LEN; i++) { - WL_DBG(("%02x\n", - wl->pmk_list->pmkids.pmkid[wl->pmk_list->pmkids.npmkid].PMKID[i])); - } - - err = wl_update_pmklist(dev, wl->pmk_list, err); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_pmksa *pmksa) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - int8 eabuf[ETHER_ADDR_STR_LEN]; - struct _pmkid_list pmkid; - int32 err = 0; - int i; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - - CHECK_SYS_UP(); - memset(eabuf, 0, ETHER_ADDR_STR_LEN); - memcpy(&pmkid.pmkid[0].BSSID, pmksa->bssid, ETHER_ADDR_LEN); - memcpy(&pmkid.pmkid[0].PMKID, pmksa->pmkid, WPA2_PMKID_LEN); - - WL_DBG(("del_pmksa,IW_PMKSA_REMOVE - PMKID: %s =\n", - bcm_ether_ntoa(&pmkid.pmkid[0].BSSID, eabuf))); - for (i = 0; i < WPA2_PMKID_LEN; i++) { - WL_DBG(("%02x\n", pmkid.pmkid[0].PMKID[i])); - } - - for (i = 0; i < wl->pmk_list->pmkids.npmkid; i++) - if (!memcmp(pmksa->bssid, &wl->pmk_list->pmkids.pmkid[i].BSSID, ETHER_ADDR_LEN)) - break; - - if ((wl->pmk_list->pmkids.npmkid > 0) && (i < wl->pmk_list->pmkids.npmkid)) { - memset(&wl->pmk_list->pmkids.pmkid[i], 0, sizeof(pmkid_t)); - for (; i < (wl->pmk_list->pmkids.npmkid - 1); i++) { - memcpy(&wl->pmk_list->pmkids.pmkid[i].BSSID, - &wl->pmk_list->pmkids.pmkid[i+1].BSSID, ETHER_ADDR_LEN); - memcpy(&wl->pmk_list->pmkids.pmkid[i].PMKID, - &wl->pmk_list->pmkids.pmkid[i+1].PMKID, WPA2_PMKID_LEN); - } - wl->pmk_list->pmkids.npmkid--; - } - else { - err = -EINVAL; - } - - err = wl_update_pmklist(dev, wl->pmk_list, err); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; - -} - -static int32 -wl_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) -{ - struct wl_priv *wl = wiphy_to_wl(wiphy); - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - CHECK_SYS_UP(); - memset(wl->pmk_list, 0, sizeof(*wl->pmk_list)); - err = wl_update_pmklist(dev, wl->pmk_list, err); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; - -} -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) */ - -static struct cfg80211_ops wl_cfg80211_ops = { - .change_virtual_intf = wl_cfg80211_change_iface, - .scan = wl_cfg80211_scan, - .set_wiphy_params = wl_cfg80211_set_wiphy_params, - .join_ibss = wl_cfg80211_join_ibss, - .leave_ibss = wl_cfg80211_leave_ibss, - .get_station = wl_cfg80211_get_station, - .set_tx_power = wl_cfg80211_set_tx_power, - .get_tx_power = wl_cfg80211_get_tx_power, - .add_key = wl_cfg80211_add_key, - .del_key = wl_cfg80211_del_key, - .get_key = wl_cfg80211_get_key, - .set_default_key = wl_cfg80211_config_default_key, - .set_default_mgmt_key = wl_cfg80211_config_default_mgmt_key, - .set_power_mgmt = wl_cfg80211_set_power_mgmt, - .set_bitrate_mask = wl_cfg80211_set_bitrate_mask, - .connect = wl_cfg80211_connect, - .disconnect = wl_cfg80211_disconnect, - .suspend = wl_cfg80211_suspend, - .resume = wl_cfg80211_resume, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) - .set_pmksa = wl_cfg80211_set_pmksa, - .del_pmksa = wl_cfg80211_del_pmksa, - .flush_pmksa = wl_cfg80211_flush_pmksa -#endif -}; - -static int32 -wl_mode_to_nl80211_iftype(int32 mode) -{ - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - switch (mode) { - case WL_MODE_BSS: - return NL80211_IFTYPE_STATION; - case WL_MODE_IBSS: - return NL80211_IFTYPE_ADHOC; - default: - return NL80211_IFTYPE_UNSPECIFIED; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static struct wireless_dev * -wl_alloc_wdev(int32 sizeof_iface, struct device *dev) -{ - struct wireless_dev *wdev; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wdev = kzalloc(sizeof(*wdev), GFP_KERNEL); - if (unlikely(!wdev)) { - WL_ERR(("Could not allocate wireless device\n")); - return ERR_PTR(-ENOMEM); - } - wdev->wiphy = wiphy_new(&wl_cfg80211_ops, sizeof(struct wl_priv) + sizeof_iface); - if (unlikely(!wdev->wiphy)) { - WL_ERR(("Couldn not allocate wiphy device\n")); - err = -ENOMEM; - goto wiphy_new_out; - } - set_wiphy_dev(wdev->wiphy, dev); - wdev->wiphy->max_scan_ssids = WL_NUM_SCAN_MAX; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) - wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX; -#endif - wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION)| BIT(NL80211_IFTYPE_ADHOC); - wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; - wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_a; /* Set it as 11a by default. - ** This will be updated with - ** 11n phy tables in "ifconfig up" - ** if phy has 11n capability - */ - wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - wdev->wiphy->cipher_suites = __wl_cipher_suites; - wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites); -#ifndef WL_POWERSAVE_DISABLED -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) - wdev->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; /* enable power - * save mode by default - */ -#else - wdev->wiphy->ps_default = TRUE; /* enable power save mode by default */ -#endif -#else -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) - wdev->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; -#else - wdev->wiphy->ps_default = FALSE; -#endif -#endif /* !WL_POWERSAVE_DISABLED */ - if (unlikely(((err = wiphy_register(wdev->wiphy)) < 0))) { - WL_ERR(("Couldn not register wiphy device (%d)\n", err)); - goto wiphy_register_out; - } - return wdev; - -wiphy_register_out: - wiphy_free(wdev->wiphy); - -wiphy_new_out: - kfree(wdev); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return ERR_PTR(err); -} - -static void -wl_free_wdev(struct wl_priv *wl) -{ - struct wireless_dev *wdev = wl_to_wdev(wl); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely(!wdev)) { - WL_ERR(("wdev is invalid\n")); - return; - } - wiphy_unregister(wdev->wiphy); - wiphy_free(wdev->wiphy); - kfree(wdev); - wl_to_wdev(wl) = NULL; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif -} - -static int32 -wl_inform_bss(struct wl_priv *wl) -{ - struct wl_scan_results *bss_list; - struct wl_bss_info *bi = NULL; /* must be initialized */ - int32 err = 0; - int i; - - - bss_list = wl->bss_list; - if (unlikely(bss_list->version != WL_BSS_INFO_VERSION)) { - WL_ERR(("Version %d != WL_BSS_INFO_VERSION\n", bss_list->version)); - return -EOPNOTSUPP; - } - WL_DBG(("scanned AP count (%d)\n", bss_list->count)); - bi = next_bss(bss_list, bi); - for_each_bss(bss_list, bi, i) { - if (unlikely(err = wl_inform_single_bss(wl, bi))) - break; - } - return err; -} - -static int32 -wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi) -{ - struct wiphy *wiphy = wl_to_wiphy(wl); - struct ieee80211_mgmt *mgmt; - struct ieee80211_channel *channel; - struct ieee80211_supported_band *band; - struct wl_cfg80211_bss_info *notif_bss_info; - struct wl_scan_req *sr = wl_to_sr(wl); - uint32 signal; - uint32 freq; - int32 err = 0; - - if (unlikely(dtoh32(bi->length) > WL_BSS_INFO_MAX)) { - WL_DBG(("Beacon size is larger than allocated buffer. Discard it!!\n")); - return err; - } - notif_bss_info = kzalloc(sizeof(*notif_bss_info) + sizeof(*mgmt) - sizeof(uint8) + - WL_BSS_INFO_MAX, GFP_KERNEL); - if (unlikely(!notif_bss_info)) { - WL_ERR(("notif_bss_info alloc failed\n")); - return -ENOMEM; - } - mgmt = (struct ieee80211_mgmt *)notif_bss_info->frame_buf; - notif_bss_info->channel = CHSPEC_CHANNEL(bi->chanspec); - if (notif_bss_info->channel <= CH_MAX_2G_CHANNEL) - band = wiphy->bands[IEEE80211_BAND_2GHZ]; - else - band = wiphy->bands[IEEE80211_BAND_5GHZ]; - notif_bss_info->rssi = bi->RSSI; - memcpy(mgmt->bssid, &bi->BSSID, ETHER_ADDR_LEN); - if (!memcmp(bi->SSID, sr->ssid.SSID, bi->SSID_len)) { - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_PROBE_RESP); - } - mgmt->u.probe_resp.timestamp = 0; - mgmt->u.probe_resp.beacon_int = cpu_to_le16(bi->beacon_period); - mgmt->u.probe_resp.capab_info = cpu_to_le16(bi->capability); - wl_rst_ie(wl); - wl_add_ie(wl, WLAN_EID_SSID, bi->SSID_len, bi->SSID); - wl_add_ie(wl, WLAN_EID_SUPP_RATES, bi->rateset.count, bi->rateset.rates); - wl_mrg_ie(wl, ((uint8 *)bi) + bi->ie_offset, bi->ie_length); - wl_cp_ie(wl, mgmt->u.probe_resp.variable, WL_BSS_INFO_MAX - - offsetof(struct wl_cfg80211_bss_info, frame_buf)); - notif_bss_info->frame_len = offsetof(struct ieee80211_mgmt, u.probe_resp.variable) + - wl_get_ielen(wl); - freq = ieee80211_channel_to_frequency(notif_bss_info->channel); - channel = ieee80211_get_channel(wiphy, freq); - - WL_DBG(("SSID : \"%s\", rssi (%d), capability : 0x04%x\n", bi->SSID, notif_bss_info->rssi, - mgmt->u.probe_resp.capab_info)); - - signal = notif_bss_info->rssi * 100; - if (unlikely(!cfg80211_inform_bss_frame(wiphy, channel, mgmt, - le16_to_cpu(notif_bss_info->frame_len), signal, GFP_KERNEL))) { - WL_ERR(("cfg80211_inform_bss_frame error\n")); - kfree(notif_bss_info); - return -EINVAL; - } - kfree(notif_bss_info); - - return err; -} - -static bool -wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e) -{ - uint32 event = ntoh32(e->event_type); - uint16 flags = ntoh16(e->flags); - - if (event == WLC_E_JOIN || event == WLC_E_ASSOC_IND || event == WLC_E_REASSOC_IND) { - return TRUE; - } else if (event == WLC_E_LINK) { - if (flags & WLC_EVENT_MSG_LINK) { - if (wl_is_ibssmode(wl)) { - if (wl_is_ibssstarter(wl)) { - } - } else { - - } - } - } - - return FALSE; -} - -static bool -wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e) -{ - uint32 event = ntoh32(e->event_type); - uint16 flags = ntoh16(e->flags); - - if (event == WLC_E_DEAUTH_IND || event == WLC_E_DISASSOC_IND) { - return TRUE; - } else if (event == WLC_E_LINK) { - if (!(flags & WLC_EVENT_MSG_LINK)) { - return TRUE; - } - } - - return FALSE; -} - -static int32 -wl_notify_connect_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data) -{ - bool act; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (wl_is_linkup(wl, e)) { - wl_link_up(wl); - if (wl_is_ibssmode(wl)) { - cfg80211_ibss_joined(ndev, (int8 *)&e->addr, GFP_KERNEL); - WL_DBG(("joined in IBSS network\n")); - } else { - wl_bss_connect_done(wl, ndev, e, data); - WL_DBG(("joined in BSS network \"%s\"\n", - ((struct wlc_ssid *)wl_read_prof(wl, WL_PROF_SSID))->SSID)); - } - act = TRUE; - wl_update_prof(wl, e, &act, WL_PROF_ACT); - } else if (wl_is_linkdown(wl, e)) { - cfg80211_disconnected(ndev, 0, NULL, 0, GFP_KERNEL); - clear_bit(WL_STATUS_CONNECTED, &wl->status); - wl_link_down(wl); - wl_init_prof(wl->profile); - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_notify_roaming_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data) -{ - bool act; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl_bss_roaming_done(wl, ndev, e, data); - act = TRUE; - wl_update_prof(wl, e, &act, WL_PROF_ACT); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static __used int32 -wl_dev_bufvar_set(struct net_device *dev, int8 *name, int8 *buf, int32 len) -{ - struct wl_priv *wl = ndev_to_wl(dev); - uint32 buflen; - - buflen = bcm_mkiovar(name, buf, len, wl->ioctl_buf, WL_IOCTL_LEN_MAX); - BUG_ON(unlikely(!buflen)); - - return (wl_dev_ioctl(dev, WLC_SET_VAR, wl->ioctl_buf, buflen)); -} - -static int32 -wl_dev_bufvar_get(struct net_device *dev, int8 *name, int8 *buf, int32 buf_len) -{ - struct wl_priv *wl = ndev_to_wl(dev); - uint32 len; - int32 err = 0; - - len = bcm_mkiovar(name, NULL, 0, wl->ioctl_buf, WL_IOCTL_LEN_MAX); - BUG_ON(unlikely(!len)); - if (unlikely((err = wl_dev_ioctl(dev, WLC_GET_VAR, (void *)wl->ioctl_buf, - WL_IOCTL_LEN_MAX)))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - memcpy(buf, wl->ioctl_buf, buf_len); - - return err; -} - -static int32 -wl_get_assoc_ies(struct wl_priv *wl) -{ - struct net_device *ndev = wl_to_ndev(wl); - struct wl_assoc_ielen *assoc_info; - struct wl_connect_info *conn_info = wl_to_conn(wl); - uint32 req_len; - uint32 resp_len; - int32 err = 0; - - if (unlikely(err = wl_dev_bufvar_get(ndev, "assoc_info", wl->extra_buf, - WL_ASSOC_INFO_MAX))) { - WL_ERR(("could not get assoc info (%d)\n", err)); - return err; - } - assoc_info = (struct wl_assoc_ielen *)wl->extra_buf; - req_len = assoc_info->req_len; - resp_len = assoc_info->resp_len; - if (req_len) { - if (unlikely(err = wl_dev_bufvar_get(ndev, "assoc_req_ies", wl->extra_buf, - WL_ASSOC_INFO_MAX))) { - WL_ERR(("could not get assoc req (%d)\n", err)); - return err; - } - conn_info->req_ie_len = req_len; - conn_info->req_ie = kmemdup(wl->extra_buf, conn_info->req_ie_len, GFP_KERNEL); - } else { - conn_info->req_ie_len = 0; - conn_info->req_ie = NULL; - } - if (resp_len) { - if (unlikely(err = wl_dev_bufvar_get(ndev, "assoc_resp_ies", wl->extra_buf, - WL_ASSOC_INFO_MAX))) { - WL_ERR(("could not get assoc resp (%d)\n", err)); - return err; - } - conn_info->resp_ie_len = resp_len; - conn_info->resp_ie = kmemdup(wl->extra_buf, conn_info->resp_ie_len, GFP_KERNEL); - } else { - conn_info->resp_ie_len = 0; - conn_info->resp_ie = NULL; - } - WL_DBG(("req len (%d) resp len (%d)\n", conn_info->req_ie_len, conn_info->resp_ie_len)); - - return err; -} - -static int32 -wl_update_bss_info(struct wl_priv *wl) -{ - struct cfg80211_bss *bss; - struct wl_bss_info *bi; - struct wlc_ssid *ssid; - int32 err = 0; - - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (wl_is_ibssmode(wl)) - return err; - - ssid = (struct wlc_ssid *)wl_read_prof(wl, WL_PROF_SSID); - bss = cfg80211_get_bss(wl_to_wiphy(wl), NULL, (int8 *)&wl->bssid, ssid->SSID, - ssid->SSID_len, WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); - - rtnl_lock(); - if (unlikely(!bss)) { - WL_DBG(("Could not find the AP\n")); - *(uint32*)wl->extra_buf = htod32(WL_EXTRA_BUF_MAX); - if (unlikely(err = wl_dev_ioctl(wl_to_ndev(wl), WLC_GET_BSS_INFO, wl->extra_buf, - WL_EXTRA_BUF_MAX))) { - WL_ERR(("Could not get bss info %d\n", err)); - goto update_bss_info_out; - } - bi = (struct wl_bss_info *)(wl->extra_buf + 4); - if (unlikely(memcmp(&bi->BSSID, &wl->bssid, ETHER_ADDR_LEN))) { - err = -EIO; - goto update_bss_info_out; - } - if (unlikely((err = wl_inform_single_bss(wl, bi)))) - goto update_bss_info_out; - } else { - WL_DBG(("Found the AP in the list - BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", - bss->bssid[0], bss->bssid[1], bss->bssid[2], bss->bssid[3], - bss->bssid[4], bss->bssid[5])); - cfg80211_put_bss(bss); - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - -update_bss_info_out: - rtnl_unlock(); - return err; -} - -static int32 -wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data) -{ - struct wl_connect_info *conn_info = wl_to_conn(wl); - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl_get_assoc_ies(wl); - memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN); - wl_update_bss_info(wl); - cfg80211_roamed(ndev, - (uint8 *)&wl->bssid, - conn_info->req_ie, conn_info->req_ie_len, - conn_info->resp_ie, conn_info->resp_ie_len, - GFP_KERNEL); - WL_DBG(("Report roaming result\n")); - - set_bit(WL_STATUS_CONNECTED, &wl->status); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data) -{ - struct wl_connect_info *conn_info = wl_to_conn(wl); - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl_get_assoc_ies(wl); - memcpy(&wl->bssid, &e->addr, ETHER_ADDR_LEN); - wl_update_bss_info(wl); - if (test_and_clear_bit(WL_STATUS_CONNECTING, &wl->status)) { - cfg80211_connect_result(ndev, - (uint8 *)&wl->bssid, - conn_info->req_ie, conn_info->req_ie_len, - conn_info->resp_ie, conn_info->resp_ie_len, - WLAN_STATUS_SUCCESS, - GFP_KERNEL); - WL_DBG(("Report connect result\n")); - } else { - cfg80211_roamed(ndev, - (uint8 *)&wl->bssid, - conn_info->req_ie, conn_info->req_ie_len, - conn_info->resp_ie, conn_info->resp_ie_len, - GFP_KERNEL); - WL_DBG(("Report roaming result\n")); - } - set_bit(WL_STATUS_CONNECTED, &wl->status); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_notify_mic_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data) -{ - uint16 flags = ntoh16(e->flags); - enum nl80211_key_type key_type; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - - rtnl_lock(); - if (flags & WLC_EVENT_MSG_GROUP) - key_type = NL80211_KEYTYPE_GROUP; - else - key_type = NL80211_KEYTYPE_PAIRWISE; - - cfg80211_michael_mic_failure(ndev, (uint8 *)&e->addr, key_type, -1, NULL, GFP_KERNEL); - rtnl_unlock(); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return 0; -} - -static int32 -wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void* data) -{ - struct channel_info channel_inform; - struct wl_scan_results *bss_list; - uint32 len = WL_SCAN_BUF_MAX; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - - if (wl->iscan_on && wl->iscan_kickstart) - return wl_wakeup_iscan(wl_to_iscan(wl)); - - if (unlikely(!test_and_clear_bit(WL_STATUS_SCANNING, &wl->status))) { - WL_ERR(("Scan complete while device not scanning\n")); - return -EINVAL; - } - if (unlikely(!wl->scan_request)) { - } - rtnl_lock(); - if (unlikely((err = wl_dev_ioctl(ndev, WLC_GET_CHANNEL, &channel_inform, - sizeof(channel_inform))))) { - WL_ERR(("scan busy (%d)\n", err)); - goto scan_done_out; - } - channel_inform.scan_channel = dtoh32(channel_inform.scan_channel); - if (unlikely(channel_inform.scan_channel)) { - - WL_DBG(("channel_inform.scan_channel (%d)\n", channel_inform.scan_channel)); - } - wl->bss_list = wl->scan_results; - bss_list = wl->bss_list; - memset(bss_list, 0, len); - bss_list->buflen = htod32(len); - if (unlikely((err = wl_dev_ioctl(ndev, WLC_SCAN_RESULTS, bss_list, len)))) { - WL_ERR(("%s Scan_results error (%d)\n", ndev->name, err)); - err = -EINVAL; - goto scan_done_out; - } - bss_list->buflen = dtoh32(bss_list->buflen); - bss_list->version = dtoh32(bss_list->version); - bss_list->count = dtoh32(bss_list->count); - - if ((err = wl_inform_bss(wl))) { - goto scan_done_out; - } - -scan_done_out : - if (wl->scan_request) { - cfg80211_scan_done(wl->scan_request, FALSE); - wl->scan_request = NULL; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - rtnl_unlock(); - return err; -} - -static void -wl_init_conf(struct wl_conf *conf) -{ - conf->mode = (uint32)-1; - conf->frag_threshold = (uint32)-1; - conf->rts_threshold = (uint32)-1; - conf->retry_short = (uint32)-1; - conf->retry_long = (uint32)-1; - conf->tx_power = -1; -} - -static void -wl_init_prof(struct wl_profile *prof) -{ - memset(prof, 0, sizeof(*prof)); -} - -static void -wl_init_eloop_handler(struct wl_event_loop *el) -{ - memset(el, 0, sizeof(*el)); - el->handler[WLC_E_SCAN_COMPLETE] = wl_notify_scan_status; - el->handler[WLC_E_JOIN] = wl_notify_connect_status; - el->handler[WLC_E_LINK] = wl_notify_connect_status; - el->handler[WLC_E_DEAUTH_IND] = wl_notify_connect_status; - el->handler[WLC_E_DISASSOC_IND] = wl_notify_connect_status; - el->handler[WLC_E_ASSOC_IND] = wl_notify_connect_status; - el->handler[WLC_E_REASSOC_IND] = wl_notify_connect_status; - el->handler[WLC_E_ROAM] = wl_notify_roaming_status; - el->handler[WLC_E_MIC_ERROR] = wl_notify_mic_status; -} - -static int32 -wl_init_priv_mem(struct wl_priv *wl) -{ - wl->scan_results = (void *)kzalloc(WL_SCAN_BUF_MAX, GFP_KERNEL); - if (unlikely(!wl->scan_results)) { - WL_ERR(("Scan results alloc failed\n")); - goto init_priv_mem_out; - } - wl->conf = (void *)kzalloc(sizeof(*wl->conf), GFP_KERNEL); - if (unlikely(!wl->conf)) { - WL_ERR(("wl_conf alloc failed\n")); - goto init_priv_mem_out; - } - wl->profile = (void *)kzalloc(sizeof(*wl->profile), GFP_KERNEL); - if (unlikely(!wl->profile)) { - WL_ERR(("wl_profile alloc failed\n")); - goto init_priv_mem_out; - } - wl->bss_info = (void *)kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); - if (unlikely(!wl->bss_info)) { - WL_ERR(("Bss information alloc failed\n")); - goto init_priv_mem_out; - } - wl->scan_req_int = (void *)kzalloc(sizeof(*wl->scan_req_int), GFP_KERNEL); - if (unlikely(!wl->scan_req_int)) { - WL_ERR(("Scan req alloc failed\n")); - goto init_priv_mem_out; - } - wl->ioctl_buf = (void *)kzalloc(WL_IOCTL_LEN_MAX, GFP_KERNEL); - if (unlikely(!wl->ioctl_buf)) { - WL_ERR(("Ioctl buf alloc failed\n")); - goto init_priv_mem_out; - } - wl->extra_buf = (void *)kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); - if (unlikely(!wl->extra_buf)) { - WL_ERR(("Extra buf alloc failed\n")); - goto init_priv_mem_out; - } - wl->iscan = (void *)kzalloc(sizeof(*wl->iscan), GFP_KERNEL); - if (unlikely(!wl->iscan)) { - WL_ERR(("Iscan buf alloc failed\n")); - goto init_priv_mem_out; - } - wl->fw = (void *)kzalloc(sizeof(*wl->fw), GFP_KERNEL); - if (unlikely(!wl->fw)) { - WL_ERR(("fw object alloc failed\n")); - goto init_priv_mem_out; - } - wl->pmk_list = (void *)kzalloc(sizeof(*wl->pmk_list), GFP_KERNEL); - if (unlikely(!wl->pmk_list)) { - WL_ERR(("pmk list alloc failed\n")); - goto init_priv_mem_out; - } - - return 0; - -init_priv_mem_out: - wl_deinit_priv_mem(wl); - - return -ENOMEM; -} - -static void -wl_deinit_priv_mem(struct wl_priv *wl) -{ - if (wl->scan_results) { - kfree(wl->scan_results); - wl->scan_results = NULL; - } - if (wl->bss_info) { - kfree(wl->bss_info); - wl->bss_info = NULL; - } - if (wl->conf) { - kfree(wl->conf); - wl->conf = NULL; - } - if (wl->profile) { - kfree(wl->profile); - wl->profile = NULL; - } - if (wl->scan_req_int) { - kfree(wl->scan_req_int); - wl->scan_req_int = NULL; - } - if (wl->ioctl_buf) { - kfree(wl->ioctl_buf); - wl->ioctl_buf = NULL; - } - if (wl->extra_buf) { - kfree(wl->extra_buf); - wl->extra_buf = NULL; - } - if (wl->iscan) { - kfree(wl->iscan); - wl->iscan = NULL; - } - if (wl->fw) { - kfree(wl->fw); - wl->fw = NULL; - } - if (wl->pmk_list) { - kfree(wl->pmk_list); - wl->pmk_list = NULL; - } -} - - -static int32 -wl_create_event_handler(struct wl_priv *wl) -{ - sema_init(&wl->event_sync, 0); - init_completion(&wl->event_exit); - if (unlikely(((wl->event_pid = kernel_thread(wl_event_handler, wl, 0)) < 0))) { - WL_ERR(("failed to create event thread\n")); - return -ENOMEM; - } - WL_DBG(("pid %d\n", wl->event_pid)); - return 0; -} - -static void -wl_destroy_event_handler(struct wl_priv *wl) -{ - if (wl->event_pid >= 0) { - KILL_PROC(wl->event_pid, SIGTERM); - wait_for_completion(&wl->event_exit); - } -} - -static void -wl_term_iscan(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl_to_iscan(wl); - - if (wl->iscan_on && iscan->pid >= 0) { - iscan->state = WL_ISCAN_STATE_IDLE; - KILL_PROC(iscan->pid, SIGTERM); - wait_for_completion(&iscan->exited); - iscan->pid = -1; - } -} - -static void -wl_notify_iscan_complete(struct wl_iscan_ctrl *iscan, bool aborted) -{ - struct wl_priv *wl = iscan_to_wl(iscan); - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely(!test_and_clear_bit(WL_STATUS_SCANNING, &wl->status))) { - WL_ERR(("Scan complete while device not scanning\n")); - return; - } - if (likely(wl->scan_request)) { - cfg80211_scan_done(wl->scan_request, aborted); - wl->scan_request = NULL; - } - wl->iscan_kickstart = FALSE; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif -} - -static int32 -wl_wakeup_iscan(struct wl_iscan_ctrl *iscan) -{ - if (likely(iscan->state != WL_ISCAN_STATE_IDLE)) { - WL_DBG(("wake up iscan\n")); - up(&iscan->sync); - return 0; - } - - return -EIO; -} - -static int32 -wl_get_iscan_results(struct wl_iscan_ctrl *iscan, uint32 *status, struct wl_scan_results **bss_list) -{ - struct wl_iscan_results list; - struct wl_scan_results *results; - struct wl_iscan_results *list_buf; - int32 err = 0; - - memset(iscan->scan_buf, 0, WL_ISCAN_BUF_MAX); - list_buf = (struct wl_iscan_results *)iscan->scan_buf; - results = &list_buf->results; - results->buflen = WL_ISCAN_RESULTS_FIXED_SIZE; - results->version = 0; - results->count = 0; - - memset(&list, 0, sizeof(list)); - list.results.buflen = htod32(WL_ISCAN_BUF_MAX); - if (unlikely((err = wl_dev_iovar_getbuf( - iscan->dev, - "iscanresults", - &list, - WL_ISCAN_RESULTS_FIXED_SIZE, - iscan->scan_buf, - WL_ISCAN_BUF_MAX)))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - results->buflen = dtoh32(results->buflen); - results->version = dtoh32(results->version); - results->count = dtoh32(results->count); - WL_DBG(("results->count = %d\n", results->count)); - WL_DBG(("results->buflen = %d\n", results->buflen)); - *status = dtoh32(list_buf->status); - *bss_list = results; - - return err; -} - -static int32 -wl_iscan_done(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl->iscan; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - iscan->state = WL_ISCAN_STATE_IDLE; - rtnl_lock(); - wl_inform_bss(wl); - wl_notify_iscan_complete(iscan, FALSE); - rtnl_unlock(); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_iscan_pending(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl->iscan; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - /* Reschedule the timer */ - mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000); - iscan->timer_on = 1; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_iscan_inprogress(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl->iscan; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - rtnl_lock(); - wl_inform_bss(wl); - wl_run_iscan(iscan, NULL, WL_SCAN_ACTION_CONTINUE); - rtnl_unlock(); - /* Reschedule the timer */ - mod_timer(&iscan->timer, jiffies + iscan->timer_ms*HZ/1000); - iscan->timer_on = 1; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_iscan_aborted(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl->iscan; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - iscan->state = WL_ISCAN_STATE_IDLE; - rtnl_lock(); - wl_notify_iscan_complete(iscan, TRUE); - rtnl_unlock(); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_iscan_thread(void *data) -{ - struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; - struct wl_iscan_ctrl *iscan = (struct wl_iscan_ctrl *)data; - struct wl_priv *wl = iscan_to_wl(iscan); - struct wl_iscan_eloop *el = &iscan->el; - uint32 status; - int err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - sched_setscheduler(current, SCHED_FIFO, ¶m); - status = WL_SCAN_RESULTS_PARTIAL; - while (likely(!down_interruptible(&iscan->sync))) { - if (iscan->timer_on) { - del_timer_sync(&iscan->timer); - iscan->timer_on = 0; - } - rtnl_lock(); - if (unlikely((err = wl_get_iscan_results(iscan, &status, &wl->bss_list)))) { - status = WL_SCAN_RESULTS_ABORTED; - WL_ERR(("Abort iscan\n")); - } - rtnl_unlock(); - el->handler[status](wl); - } - if (iscan->timer_on) { - del_timer_sync(&iscan->timer); - iscan->timer_on = 0; - } - complete_and_exit(&iscan->exited, 0); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return 0; -} - -static void -wl_iscan_timer(ulong data) -{ - struct wl_iscan_ctrl *iscan = (struct wl_iscan_ctrl *)data; - - if (iscan) { - iscan->timer_on = 0; - WL_DBG(("timer expired\n")); - wl_wakeup_iscan(iscan); - } -} - -static int32 -wl_invoke_iscan(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl_to_iscan(wl); - int err = 0; - - if (wl->iscan_on && iscan->pid < 0) { - iscan->state = WL_ISCAN_STATE_IDLE; - sema_init(&iscan->sync, 0); - init_completion(&iscan->exited); - iscan->pid = kernel_thread(wl_iscan_thread, iscan, 0); - if (unlikely(iscan->pid < 0)) { - WL_ERR(("Could not create iscan thread\n")); - return -ENOMEM; - } - } - - return err; -} - -static void -wl_init_iscan_eloop(struct wl_iscan_eloop *el) -{ - memset(el, 0, sizeof(*el)); - el->handler[WL_SCAN_RESULTS_SUCCESS] = wl_iscan_done; - el->handler[WL_SCAN_RESULTS_PARTIAL] = wl_iscan_inprogress; - el->handler[WL_SCAN_RESULTS_PENDING] = wl_iscan_pending; - el->handler[WL_SCAN_RESULTS_ABORTED] = wl_iscan_aborted; - el->handler[WL_SCAN_RESULTS_NO_MEM] = wl_iscan_aborted; -} - -static int32 -wl_init_iscan(struct wl_priv *wl) -{ - struct wl_iscan_ctrl *iscan = wl_to_iscan(wl); - int err = 0; - - if (wl->iscan_on) { - iscan->dev = wl_to_ndev(wl); - iscan->state = WL_ISCAN_STATE_IDLE; - wl_init_iscan_eloop(&iscan->el); - iscan->timer_ms = WL_ISCAN_TIMER_INTERVAL_MS; - init_timer(&iscan->timer); - iscan->timer.data = (ulong)iscan; - iscan->timer.function = wl_iscan_timer; - sema_init(&iscan->sync, 0); - init_completion(&iscan->exited); - iscan->pid = kernel_thread(wl_iscan_thread, iscan, 0); - if (unlikely(iscan->pid < 0)) { - WL_ERR(("Could not create iscan thread\n")); - return -ENOMEM; - } - iscan->data = wl; - } - - return err; -} - -static void -wl_init_fw(struct wl_fw_ctrl *fw) -{ - fw->status = 0; /* init fw loading status. 0 means nothing was loaded yet */ -} - -static int32 -wl_init_priv(struct wl_priv *wl) -{ - struct wiphy *wiphy = wl_to_wiphy(wl); - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl->scan_request = NULL; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)) || \ - defined(CHROMIUMOS_COMPAT_WIRELESS) - wl->pwr_save = !!(wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT); -#else - wl->pwr_save = wiphy->ps_default; -#endif -#ifndef WL_ISCAN_DISABLED - wl->iscan_on = TRUE; /* iscan on & off switch. we enable iscan per default */ -#else - wl->iscan_on = FALSE; -#endif /* WL_ISCAN_DISABLED */ -#ifndef WL_ROAM_DISABLED - wl->roam_on = TRUE; /* roam on & off switch. we enable roam per default */ -#else - wl->roam_on = FALSE; -#endif /* WL_ROAM_DISABLED */ - - wl->iscan_kickstart = FALSE; - wl->active_scan = TRUE; /* we do active scan for specific scan per default */ - wl->dongle_up = FALSE; /* dongle is not up yet */ - wl_init_eq(wl); - if (unlikely((err = wl_init_priv_mem(wl)))) - return err; - if (unlikely(wl_create_event_handler(wl))) - return -ENOMEM; - wl_init_eloop_handler(&wl->el); - mutex_init(&wl->usr_sync); - if (unlikely((err = wl_init_iscan(wl)))) - return err; - wl_init_fw(wl->fw); - wl_init_conf(wl->conf); - wl_init_prof(wl->profile); - wl_link_down(wl); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static void -wl_deinit_priv(struct wl_priv *wl) -{ -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl_destroy_event_handler(wl); - wl->dongle_up = FALSE; /* dongle down */ - wl_flush_eq(wl); - wl_link_down(wl); - wl_term_iscan(wl); - wl_deinit_priv_mem(wl); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif -} - -int32 -wl_cfg80211_attach(struct net_device *ndev, void *data) -{ - struct wireless_dev *wdev; - struct wl_priv *wl; - struct wl_iface *ci; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely(!ndev)) { - WL_ERR(("ndev is invaild\n")); - return -ENODEV; - } - wl_cfg80211_dev = kzalloc(sizeof(struct wl_dev), GFP_KERNEL); - if (unlikely(!wl_cfg80211_dev)) { - WL_ERR(("wl_cfg80211_dev is invalid\n")); - return -ENOMEM; - } - WL_DBG(("func %p\n", wl_sdio_func())); -#ifndef WL_CFG80211_LOCALTEST - wdev = wl_alloc_wdev(sizeof(struct wl_iface), &wl_sdio_func()->dev); -#else - wdev = wl_alloc_wdev(sizeof(struct wl_iface), NULL); -#endif - if (unlikely(IS_ERR(wdev))) - return -ENOMEM; - - wdev->iftype = wl_mode_to_nl80211_iftype(WL_MODE_BSS); - wl = wdev_to_wl(wdev); - wl->wdev = wdev; - wl->pub = data; - ci = (struct wl_iface *)wl_to_ci(wl); - ci->wl = wl; - ndev->ieee80211_ptr = wdev; - SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); - wdev->netdev = ndev; - if (unlikely((err = wl_init_priv(wl)))) { - WL_ERR(("Failed to init iwm_priv (%d)\n", err)); - goto cfg80211_attach_out; - } - wl_set_drvdata(wl_cfg80211_dev, ci); - set_bit(WL_STATUS_READY, &wl->status); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; - -cfg80211_attach_out: - wl_free_wdev(wl); - return err; -} - -void -wl_cfg80211_detach(void) -{ - struct wl_priv *wl; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl = WL_PRIV_GET(); - - wl_deinit_priv(wl); - wl_free_wdev(wl); - wl_set_drvdata(wl_cfg80211_dev, NULL); - kfree(wl_cfg80211_dev); - wl_cfg80211_dev = NULL; - wl_clear_sdio_func(); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif -} - -static void -wl_wakeup_event(struct wl_priv *wl) -{ - up(&wl->event_sync); -} - -static int32 -wl_event_handler(void *data) -{ - struct wl_priv *wl = (struct wl_priv *)data; - struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; - struct wl_event_q *e; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - sched_setscheduler(current, SCHED_FIFO, ¶m); - while (likely(!down_interruptible(&wl->event_sync))) { - if (unlikely(!(e = wl_deq_event(wl)))) { - WL_ERR(("eqeue empty..\n")); - BUG(); - } - WL_DBG(("event type (%d)\n", e->etype)); - if (wl->el.handler[e->etype]) { - wl->el.handler[e->etype](wl, wl_to_ndev(wl), &e->emsg, e->edata); - } else { - WL_DBG(("Unknown Event (%d): ignoring\n", e->etype)); - } - wl_put_event(e); - } - complete_and_exit(&wl->event_exit, 0); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif -} - -void -wl_cfg80211_event(struct net_device *ndev, const wl_event_msg_t *e, void* data) -{ - uint32 event_type = ntoh32(e->event_type); - struct wl_priv *wl = ndev_to_wl(ndev); -#if (WL_DBG_LEVEL > 0) - int8 *estr = (event_type <= sizeof(wl_dbg_estr)/WL_DBG_ESTR_MAX-1) ? - wl_dbg_estr[event_type] : (int8 *)"Unknown"; -#endif /* (WL_DBG_LEVEL > 0) */ - WL_DBG(("event_type (%d):""WLC_E_""%s\n", event_type, estr)); - if (likely(!wl_enq_event(wl, event_type, e, data))) - wl_wakeup_event(wl); -} - -static void -wl_init_eq(struct wl_priv *wl) -{ - wl_init_eq_lock(wl); - INIT_LIST_HEAD(&wl->eq_list); -} - -static void -wl_flush_eq(struct wl_priv *wl) -{ - struct wl_event_q *e; - - wl_lock_eq(wl); - while (!list_empty(&wl->eq_list)) { - e = list_first_entry(&wl->eq_list, struct wl_event_q, eq_list); - list_del(&e->eq_list); - kfree(e); - } - wl_unlock_eq(wl); -} - -/* -* retrieve first queued event from head -*/ - -static struct wl_event_q * -wl_deq_event(struct wl_priv *wl) -{ - struct wl_event_q *e = NULL; - - wl_lock_eq(wl); - if (likely(!list_empty(&wl->eq_list))) { - e = list_first_entry(&wl->eq_list, struct wl_event_q, eq_list); - list_del(&e->eq_list); - } - wl_unlock_eq(wl); - - return e; -} - -/* -** push event to tail of the queue -*/ - -static int32 -wl_enq_event(struct wl_priv *wl, uint32 event, const wl_event_msg_t *msg, void *data) -{ - struct wl_event_q *e; - int32 err = 0; - - if (unlikely(!(e = kzalloc(sizeof(struct wl_event_q), GFP_KERNEL)))) { - WL_ERR(("event alloc failed\n")); - return -ENOMEM; - } - - e->etype = event; - memcpy(&e->emsg, msg, sizeof(wl_event_msg_t)); - if (data) { - } - wl_lock_eq(wl); - list_add_tail(&e->eq_list, &wl->eq_list); - wl_unlock_eq(wl); - - return err; -} - -static void -wl_put_event(struct wl_event_q *e) -{ - kfree(e); -} - -void -wl_cfg80211_sdio_func(void *func) -{ - cfg80211_sdio_func = (struct sdio_func *)func; -} - -static void -wl_clear_sdio_func(void) -{ - cfg80211_sdio_func = NULL; -} - - -static struct sdio_func * -wl_sdio_func(void) -{ - return cfg80211_sdio_func; -} - -static int32 -wl_dongle_mode(struct net_device *ndev, int32 iftype) -{ - int32 infra = 0; - int32 ap = 0; - int32 err = 0; - - switch (iftype) { - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_WDS: - WL_ERR(("type (%d) : currently we do not support this mode\n", iftype)); - err = -EINVAL; - return err; - case NL80211_IFTYPE_ADHOC: - break; - case NL80211_IFTYPE_STATION: - infra = 1; - break; - default: - err = -EINVAL; - WL_ERR(("invalid type (%d)\n", iftype)); - return err; - } - infra = htod32(infra); - ap = htod32(ap); - WL_DBG(("%s ap (%d), infra (%d)\n", ndev->name, ap, infra)); - if (unlikely(err = wl_dev_ioctl(ndev, WLC_SET_INFRA, &infra, sizeof(infra))) || - unlikely(err = wl_dev_ioctl(ndev, WLC_SET_AP, &ap, sizeof(ap)))) { - WL_ERR(("WLC_SET_INFRA error (%d)\n", err)); - return err; - } - - return -EINPROGRESS; -} - -#ifndef EMBEDDED_PLATFORM -static int32 -wl_dongle_country(struct net_device *ndev, uint8 ccode) -{ - - int32 err = 0; - - - return err; -} - -static int32 -wl_dongle_up(struct net_device *ndev, uint32 up) -{ - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely(err = wl_dev_ioctl(ndev, WLC_UP, &up, sizeof(up)))) { - WL_ERR(("WLC_UP error (%d)\n", err)); - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return err; -} - -static int32 -wl_dongle_power(struct net_device *ndev, uint32 power_mode) -{ - int32 err = 0; - - if (unlikely(err = wl_dev_ioctl(ndev, WLC_SET_PM, &power_mode, sizeof(power_mode)))) { - WL_ERR(("WLC_SET_PM error (%d)\n", err)); - } - return err; -} - -static int32 -wl_dongle_glom(struct net_device *ndev, uint32 glom, uint32 dongle_align) -{ - int8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ - int32 err = 0; - - /* Match Host and Dongle rx alignment */ - bcm_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf, sizeof(iovbuf)); - if (unlikely(err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - WL_ERR(("txglomalign error (%d)\n", err)); - goto dongle_glom_out; - } - /* disable glom option per default */ - bcm_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf)); - if (unlikely(err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - WL_ERR(("txglom error (%d)\n", err)); - goto dongle_glom_out; - } -dongle_glom_out : - return err; -} - -static int32 -wl_dongle_roam(struct net_device *ndev, uint32 roamvar, uint32 bcn_timeout) -{ - int8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ - int32 err = 0; - - /* Setup timeout if Beacons are lost and roam is off to report link down */ - if (roamvar) { - bcm_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, sizeof(iovbuf)); - if (unlikely(err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - WL_ERR(("bcn_timeout error (%d)\n", err)); - goto dongle_rom_out; - } - } - /* Enable/Disable built-in roaming to allow supplicant to take care of roaming */ - bcm_mkiovar("roam_off", (char *)&roamvar, 4, iovbuf, sizeof(iovbuf)); - if (unlikely(err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - WL_ERR(("roam_off error (%d)\n", err)); - goto dongle_rom_out; - } -dongle_rom_out : - return err; -} - -static int32 -wl_dongle_eventmsg(struct net_device *ndev) -{ - - int8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ - int8 eventmask[WL_EVENTING_MASK_LEN]; - int32 err = 0; - - /* Setup event_msgs */ - bcm_mkiovar("event_msgs", eventmask, WL_EVENTING_MASK_LEN, iovbuf, sizeof(iovbuf)); - if (unlikely(err = wl_dev_ioctl(ndev, WLC_GET_VAR, iovbuf, sizeof(iovbuf)))) { - WL_ERR(("Get event_msgs error (%d)\n", err)); - goto dongle_eventmsg_out; - } - memcpy(eventmask, iovbuf, WL_EVENTING_MASK_LEN); - - setbit(eventmask, WLC_E_SET_SSID); - setbit(eventmask, WLC_E_PRUNE); - setbit(eventmask, WLC_E_AUTH); - setbit(eventmask, WLC_E_REASSOC); - setbit(eventmask, WLC_E_REASSOC_IND); - setbit(eventmask, WLC_E_DEAUTH_IND); - setbit(eventmask, WLC_E_DISASSOC_IND); - setbit(eventmask, WLC_E_DISASSOC); - setbit(eventmask, WLC_E_JOIN); - setbit(eventmask, WLC_E_ASSOC_IND); - setbit(eventmask, WLC_E_PSK_SUP); - setbit(eventmask, WLC_E_LINK); - setbit(eventmask, WLC_E_NDIS_LINK); - setbit(eventmask, WLC_E_MIC_ERROR); - setbit(eventmask, WLC_E_PMKID_CACHE); - setbit(eventmask, WLC_E_TXFAIL); - setbit(eventmask, WLC_E_JOIN_START); - setbit(eventmask, WLC_E_SCAN_COMPLETE); - - bcm_mkiovar("event_msgs", eventmask, WL_EVENTING_MASK_LEN, iovbuf, sizeof(iovbuf)); - if (unlikely(err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - WL_ERR(("Set event_msgs error (%d)\n", err)); - goto dongle_eventmsg_out; - } - -dongle_eventmsg_out : - return err; -} - -static int32 -wl_dongle_scantime(struct net_device *ndev, int32 scan_assoc_time, int32 scan_unassoc_time) -{ - int32 err = 0; - - if ((err = wl_dev_ioctl(ndev, WLC_SET_SCAN_CHANNEL_TIME, &scan_assoc_time, - sizeof(scan_assoc_time)))) { - if (err == -EOPNOTSUPP) { - WL_INFO(("Scan assoc time is not supported\n")); - } else { - WL_ERR(("Scan assoc time error (%d)\n", err)); - } - goto dongle_scantime_out; - } - if ((err = wl_dev_ioctl(ndev, WLC_SET_SCAN_UNASSOC_TIME, &scan_unassoc_time, - sizeof(scan_unassoc_time)))) { - if (err == -EOPNOTSUPP) { - WL_INFO(("Scan unassoc time is not supported\n")); - } else { - WL_ERR(("Scan unassoc time error (%d)\n", err)); - } - goto dongle_scantime_out; - } - -dongle_scantime_out : - return err; -} - -static int32 -wl_dongle_offload(struct net_device *ndev, int32 arpoe, int32 arp_ol) -{ - int8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ - int32 err = 0; - - /* Set ARP offload */ - bcm_mkiovar("arpoe", (char *)&arpoe, 4, iovbuf, sizeof(iovbuf)); - if ((err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - if (err == -EOPNOTSUPP) { - WL_INFO(("arpoe is not supported\n")); - } else { - WL_ERR(("arpoe error (%d)\n", err)); - } - goto dongle_offload_out; - } - bcm_mkiovar("arp_ol", (char *)&arp_ol, 4, iovbuf, sizeof(iovbuf)); - if ((err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - if (err == -EOPNOTSUPP) { - WL_INFO(("arp_ol is not supported\n")); - } else { - WL_ERR(("arp_ol error (%d)\n", err)); - } - goto dongle_offload_out; - } - -dongle_offload_out : - return err; -} - -static int32 -wl_pattern_atoh(int8 *src, int8 *dst) -{ -#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base)) - int i; - if (strncmp(src, "0x", 2) != 0 && - strncmp(src, "0X", 2) != 0) { - WL_ERR(("Mask invalid format. Needs to start with 0x\n")); - return -1; - } - src = src + 2; /* Skip past 0x */ - if (strlen(src) % 2 != 0) { - WL_ERR(("Mask invalid format. Needs to be of even length\n")); - return -1; - } - for (i = 0; *src != '\0'; i++) { - char num[3]; - strncpy(num, src, 2); - num[2] = '\0'; - dst[i] = (uint8)strtoul(num, NULL, 16); - src += 2; - } - return i; -} - -static int32 -wl_dongle_filter(struct net_device *ndev, uint32 filter_mode) -{ - int8 iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + '\0' + bitvec */ - const int8 *str; - struct wl_pkt_filter pkt_filter; - struct wl_pkt_filter *pkt_filterp; - int32 buf_len; - int32 str_len; - uint32 mask_size; - uint32 pattern_size; - int8 buf[256]; - int32 err = 0; - -/* add a default packet filter pattern */ - str = "pkt_filter_add"; - str_len = strlen(str); - strncpy(buf, str, str_len); - buf[ str_len ] = '\0'; - buf_len = str_len + 1; - - pkt_filterp = (struct wl_pkt_filter *) (buf + str_len + 1); - - /* Parse packet filter id. */ - pkt_filter.id = htod32(100); - - /* Parse filter polarity. */ - pkt_filter.negate_match = htod32(0); - - /* Parse filter type. */ - pkt_filter.type = htod32(0); - - /* Parse pattern filter offset. */ - pkt_filter.u.pattern.offset = htod32(0); - - /* Parse pattern filter mask. */ - mask_size = htod32(wl_pattern_atoh("0xff", - (char *) pkt_filterp->u.pattern.mask_and_pattern)); - - /* Parse pattern filter pattern. */ - pattern_size = htod32(wl_pattern_atoh("0x00", - (char *) &pkt_filterp->u.pattern.mask_and_pattern[mask_size])); - - if (mask_size != pattern_size) { - WL_ERR(("Mask and pattern not the same size\n")); - err = -EINVAL; - goto dongle_filter_out; - } - - pkt_filter.u.pattern.size_bytes = mask_size; - buf_len += WL_PKT_FILTER_FIXED_LEN; - buf_len += (WL_PKT_FILTER_PATTERN_FIXED_LEN + 2 * mask_size); - - /* Keep-alive attributes are set in local variable (keep_alive_pkt), and - ** then memcpy'ed into buffer (keep_alive_pktp) since there is no - ** guarantee that the buffer is properly aligned. - */ - memcpy((char *)pkt_filterp, &pkt_filter, - WL_PKT_FILTER_FIXED_LEN + WL_PKT_FILTER_PATTERN_FIXED_LEN); - - if ((err = wl_dev_ioctl(ndev, WLC_SET_VAR, buf, buf_len))) { - if (err == -EOPNOTSUPP) { - WL_INFO(("filter not supported\n")); - } else { - WL_ERR(("filter (%d)\n", err)); - } - goto dongle_filter_out; - } - - /* set mode to allow pattern */ - bcm_mkiovar("pkt_filter_mode", (char *)&filter_mode, 4, iovbuf, sizeof(iovbuf)); - if ((err = wl_dev_ioctl(ndev, WLC_SET_VAR, iovbuf, sizeof(iovbuf)))) { - if (err == -EOPNOTSUPP) { - WL_INFO(("filter_mode not supported\n")); - } else { - WL_ERR(("filter_mode (%d)\n", err)); - } - goto dongle_filter_out; - } - -dongle_filter_out : - return err; -} -#endif /* !EMBEDDED_PLATFORM */ - -int32 -wl_config_dongle(struct wl_priv *wl, bool need_lock) -{ -#ifndef DHD_SDALIGN -#define DHD_SDALIGN 32 -#endif - struct net_device *ndev; - struct wireless_dev *wdev; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (wl->dongle_up) - return err; - - - ndev = wl_to_ndev(wl); - wdev = ndev->ieee80211_ptr; - if (need_lock) - rtnl_lock(); - -#ifndef EMBEDDED_PLATFORM - if (unlikely((err = wl_dongle_up(ndev, 0)))) - goto default_conf_out; - if (unlikely((err = wl_dongle_country(ndev, 0)))) - goto default_conf_out; - if (unlikely((err = wl_dongle_power(ndev, PM_FAST)))) - goto default_conf_out; - if (unlikely((err = wl_dongle_glom(ndev, 0, DHD_SDALIGN)))) - goto default_conf_out; - if (unlikely((err = wl_dongle_roam(ndev, (wl->roam_on ? 0 : 1), 3)))) - goto default_conf_out; - if (unlikely((err = wl_dongle_eventmsg(ndev)))) - goto default_conf_out; - - wl_dongle_scantime(ndev, 40, 80); - wl_dongle_offload(ndev, 1, 0xf); - wl_dongle_filter(ndev, 1); -#endif /* !EMBEDDED_PLATFORM */ - - err = wl_dongle_mode(ndev, wdev->iftype); - if (unlikely(err && err != -EINPROGRESS)) - goto default_conf_out; - if (unlikely((err = wl_dongle_probecap(wl)))) - goto default_conf_out; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - /* -EINPROGRESS: Call commit handler */ - -default_conf_out : - if (need_lock) - rtnl_unlock(); - - wl->dongle_up = TRUE; - - return err; - -} - -static int32 -wl_update_wiphybands(struct wl_priv *wl) -{ - struct wiphy *wiphy; - int32 phy_list; - int8 phy; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - if (unlikely(err = wl_dev_ioctl(wl_to_ndev(wl), WLC_GET_PHYLIST, &phy_list, - sizeof(phy_list)))) { - WL_ERR(("error (%d)\n", err)); - return err; - } - - phy = ((char *)&phy_list)[1]; - WL_DBG(("%c phy\n", phy)); - if (phy == 'n' || phy == 'a') { - wiphy = wl_to_wiphy(wl); - wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -__wl_cfg80211_up(struct wl_priv *wl) -{ - int32 err = 0; - - if (unlikely(err = wl_config_dongle(wl, FALSE))) - return err; - - wl_invoke_iscan(wl); - set_bit(WL_STATUS_READY, &wl->status); - return err; -} - -static int32 -__wl_cfg80211_down(struct wl_priv *wl) -{ - int32 err = 0; - - /* Check if cfg80211 interface is already down */ - if (!test_bit(WL_STATUS_READY, &wl->status)) - return err; /* it is even not ready */ - - set_bit(WL_STATUS_SCAN_ABORTING, &wl->status); - wl_term_iscan(wl); - if (wl->scan_request) { - cfg80211_scan_done(wl->scan_request, TRUE); /* TRUE means abort */ - wl->scan_request = NULL; - } - clear_bit(WL_STATUS_READY, &wl->status); - clear_bit(WL_STATUS_SCANNING, &wl->status); - clear_bit(WL_STATUS_SCAN_ABORTING, &wl->status); - clear_bit(WL_STATUS_CONNECTED, &wl->status); - - return err; -} - -int32 -wl_cfg80211_up(void) -{ - struct wl_priv *wl; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl = WL_PRIV_GET(); - mutex_lock(&wl->usr_sync); - err = __wl_cfg80211_up(wl); - mutex_unlock(&wl->usr_sync); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -int32 -wl_cfg80211_down(void) -{ - struct wl_priv *wl; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl = WL_PRIV_GET(); - mutex_lock(&wl->usr_sync); - err = __wl_cfg80211_down(wl); - mutex_unlock(&wl->usr_sync); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - - return err; -} - -static int32 -wl_dongle_probecap(struct wl_priv *wl) -{ - int32 err = 0; - - if (unlikely((err = wl_update_wiphybands(wl)))) - return err; - - return err; -} - -static void * -wl_read_prof(struct wl_priv *wl, int32 item) -{ - switch (item) { - case WL_PROF_SEC: - return &wl->profile->sec; - case WL_PROF_ACT: - return &wl->profile->active; - case WL_PROF_BSSID: - return &wl->profile->bssid; - case WL_PROF_SSID: - return &wl->profile->ssid; - } - WL_ERR(("invalid item (%d)\n", item)); - return NULL; -} - -static int32 -wl_update_prof(struct wl_priv *wl, const wl_event_msg_t *e, void *data, int32 item) -{ - int32 err = 0; - struct wlc_ssid *ssid; - - switch (item) { - case WL_PROF_SSID: - ssid = (wlc_ssid_t *)data; - memset(wl->profile->ssid.SSID, 0, sizeof(wl->profile->ssid.SSID)); - memcpy(wl->profile->ssid.SSID, ssid->SSID, ssid->SSID_len); - wl->profile->ssid.SSID_len = ssid->SSID_len; - break; - case WL_PROF_BSSID: - if (data) - memcpy(wl->profile->bssid, data, ETHER_ADDR_LEN); - else - memset(wl->profile->bssid, 0, ETHER_ADDR_LEN); - break; - case WL_PROF_SEC: - memcpy(&wl->profile->sec, data, sizeof(wl->profile->sec)); - break; - case WL_PROF_ACT: - wl->profile->active = *(bool *)data; - break; - default : - WL_ERR(("unsupported item (%d)\n", item)); - err = -EOPNOTSUPP; - break; - } - - return err; -} - -void -wl_cfg80211_dbg_level(uint32 level) -{ - wl_dbg_level = level; -} - -static bool -wl_is_ibssmode(struct wl_priv *wl) -{ - return (wl->conf->mode == WL_MODE_IBSS); -} - -static bool -wl_is_ibssstarter(struct wl_priv *wl) -{ - return wl->ibss_starter; -} - -static void -wl_rst_ie(struct wl_priv *wl) -{ - struct wl_ie *ie = wl_to_ie(wl); - - ie->offset = 0; -} - -static int32 -wl_add_ie(struct wl_priv *wl, uint8 t, uint8 l, uint8 *v) -{ - struct wl_ie *ie = wl_to_ie(wl); - int32 err = 0; - - if (unlikely(ie->offset + l + 2 > WL_TLV_INFO_MAX)) { - WL_ERR(("ei crosses buffer boundary\n")); - return -ENOSPC; - } - ie->buf[ie->offset] = t; - ie->buf[ie->offset+1] = l; - memcpy(&ie->buf[ie->offset+2], v, l); - ie->offset += l+2; - - return err; -} - -static int32 -wl_mrg_ie(struct wl_priv *wl, uint8 *ie_stream, uint16 ie_size) -{ - struct wl_ie *ie = wl_to_ie(wl); - int32 err = 0; - - if (unlikely(ie->offset + ie_size > WL_TLV_INFO_MAX)) { - WL_ERR(("ei_stream crosses buffer boundary\n")); - return -ENOSPC; - } - memcpy(&ie->buf[ie->offset], ie_stream, ie_size); - ie->offset += ie_size; - - return err; -} - -static int32 -wl_cp_ie(struct wl_priv *wl, uint8 *dst, uint16 dst_size) -{ - struct wl_ie *ie = wl_to_ie(wl); - int32 err = 0; - - if (unlikely(ie->offset > dst_size)) { - WL_ERR(("dst_size is not enough\n")); - return -ENOSPC; - } - memcpy(dst, &ie->buf[0], ie->offset); - - return err; -} - -static uint32 -wl_get_ielen(struct wl_priv *wl) -{ - struct wl_ie *ie = wl_to_ie(wl); - - return ie->offset; -} - -static void -wl_link_up(struct wl_priv *wl) -{ - wl->link_up = TRUE; -} - -static void -wl_link_down(struct wl_priv *wl) -{ - struct wl_connect_info *conn_info = wl_to_conn(wl); - - wl->link_up = FALSE; - if (conn_info->req_ie) { - kfree(conn_info->req_ie); - conn_info->req_ie = NULL; - } - conn_info->req_ie_len = 0; - if (conn_info->resp_ie) { - kfree(conn_info->resp_ie); - conn_info->resp_ie = NULL; - } - conn_info->resp_ie_len = 0; -} - -static void -wl_lock_eq(struct wl_priv *wl) -{ - spin_lock_irq(&wl->eq_lock); -} - -static void -wl_unlock_eq(struct wl_priv *wl) -{ - spin_unlock_irq(&wl->eq_lock); -} - -static void -wl_init_eq_lock(struct wl_priv *wl) -{ - spin_lock_init(&wl->eq_lock); -} - -static void -wl_delay(uint32 ms) -{ - if (ms < 1000 / HZ) { - cond_resched(); - mdelay(ms); - } else { - msleep(ms); - } -} - -static void -wl_set_drvdata(struct wl_dev *dev, void *data) -{ - dev->driver_data = data; -} - -static void * -wl_get_drvdata(struct wl_dev *dev) -{ - return dev->driver_data; -} - -int32 -wl_cfg80211_read_fw(int8 *buf, uint32 size) -{ - const struct firmware *fw_entry; - struct wl_priv *wl; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In : size (%d)\n", size)); -#endif - wl = WL_PRIV_GET(); - - fw_entry = wl->fw->fw_entry; - - if (fw_entry->size < wl->fw->ptr + size) { - size = fw_entry->size - wl->fw->ptr; - } - memcpy(buf, &fw_entry->data[wl->fw->ptr], size); - wl->fw->ptr += size; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out : size (%d)\n", size)); -#endif - return size; -} - -void -wl_cfg80211_release_fw(void) -{ - struct wl_priv *wl; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl = WL_PRIV_GET(); - release_firmware(wl->fw->fw_entry); - wl->fw->ptr = 0; -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif -} - -void * -wl_cfg80211_request_fw(int8 *file_name) -{ - struct wl_priv *wl; - const struct firmware *fw_entry = NULL; - int32 err = 0; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - WL_DBG(("file name : \"%s\"\n", file_name)); - wl = WL_PRIV_GET(); - - if (!test_bit(WL_FW_LOADING_DONE, &wl->fw->status)) { - if (unlikely(err = request_firmware(&wl->fw->fw_entry, file_name, - &wl_sdio_func()->dev))) { - WL_ERR(("Could not download fw (%d)\n", err)); - goto req_fw_out; - } - set_bit(WL_FW_LOADING_DONE, &wl->fw->status); - fw_entry = wl->fw->fw_entry; - if (fw_entry) { - WL_DBG(("fw size (%d), data (%p)\n", fw_entry->size, fw_entry->data)); - } - } else if (!test_bit(WL_NVRAM_LOADING_DONE, &wl->fw->status)) { - if (unlikely(err = request_firmware(&wl->fw->fw_entry, file_name, - &wl_sdio_func()->dev))) { - WL_ERR(("Could not download nvram (%d)\n", err)); - goto req_fw_out; - } - set_bit(WL_NVRAM_LOADING_DONE, &wl->fw->status); - fw_entry = wl->fw->fw_entry; - if (fw_entry) { - WL_DBG(("nvram size (%d), data (%p)\n", fw_entry->size, fw_entry->data)); - } - } else { - WL_DBG(("Downloading already done. Nothing to do more\n")); - err = -EPERM; - } -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - -req_fw_out: - if (unlikely(err)) { - return NULL; - } - wl->fw->ptr = 0; - return (void *)fw_entry->data; -} - -int8 * -wl_cfg80211_get_fwname(void) -{ - struct wl_priv *wl; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl = WL_PRIV_GET(); - strcpy(wl->fw->fw_name, WL_4329_FW_FILE); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return wl->fw->fw_name; -} - -int8 * -wl_cfg80211_get_nvramname(void) -{ - struct wl_priv *wl; - -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("In\n")); -#endif - wl = WL_PRIV_GET(); - strcpy(wl->fw->nvram_name, WL_4329_NVRAM_FILE); -#ifdef WL_CFG80211_BACKTRACE - WL_DBG(("Out\n")); -#endif - return wl->fw->nvram_name; -} diff --git a/drivers/net/wireless/bcm4329/wl_cfg80211.h b/drivers/net/wireless/bcm4329/wl_cfg80211.h deleted file mode 100644 index 27226992796d..000000000000 --- a/drivers/net/wireless/bcm4329/wl_cfg80211.h +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Linux Cfg80211 support - * - * Copyright (C) 1999-2010, Broadcom Corporation - * - * Unless you and Broadcom execute a separate written software license - * agreement governing use of this software, this software is licensed to you - * under the terms of the GNU General Public License version 2 (the "GPL"), - * available at http://www.broadcom.com/licenses/GPLv2.php, with the - * following added to such license: - * - * As a special exception, the copyright holders of this software give you - * permission to link this software with independent modules, and to copy and - * distribute the resulting executable under terms of your choice, provided that - * you also meet, for each linked independent module, the terms and conditions of - * the license of that module. An independent module is a module which is not - * derived from this software. The special exception does not apply to any - * modifications of the software. - * - * Notwithstanding the above, under no circumstances may you combine this - * software in any way with any other Broadcom software provided under a license - * other than the GPL, without Broadcom's express prior written consent. - * - * $Id: wl_cfg80211.h,v 1.1.2.19 2010/05/04 21:21:00 Exp $ - */ - -#ifndef _wl_cfg80211_h_ -#define _wl_cfg80211_h_ - -#include -#include -#include -#include -#include -#include - -struct wl_conf; -struct wl_iface; -struct wl_priv; -struct wl_security; -struct wl_ibss; - -#if defined(IL_BIGENDIAN) -#include -#define htod32(i) (bcmswap32(i)) -#define htod16(i) (bcmswap16(i)) -#define dtoh32(i) (bcmswap32(i)) -#define dtoh16(i) (bcmswap16(i)) -#define htodchanspec(i) htod16(i) -#define dtohchanspec(i) dtoh16(i) -#else -#define htod32(i) i -#define htod16(i) i -#define dtoh32(i) i -#define dtoh16(i) i -#define htodchanspec(i) i -#define dtohchanspec(i) i -#endif - -#define WL_DBG_NONE 0 -#define WL_DBG_DBG (1 << 2) -#define WL_DBG_INFO (1 << 1) -#define WL_DBG_ERR (1 << 0) -#define WL_DBG_MASK ((WL_DBG_DBG | WL_DBG_INFO | WL_DBG_ERR) << 1) - -#define WL_DBG_LEVEL 1 /* 0 invalidates all debug messages. default is 1 */ -#define WL_ERR(args) \ - do { \ - if (wl_dbg_level & WL_DBG_ERR) { \ - if (net_ratelimit()) { \ - printk("ERROR @%s : ", __FUNCTION__); \ - printk args; \ - } \ - } \ - } while (0) -#define WL_INFO(args) \ - do { \ - if (wl_dbg_level & WL_DBG_INFO) { \ - if (net_ratelimit()) { \ - printk("INFO @%s : ", __FUNCTION__); \ - printk args; \ - } \ - } \ - } while (0) -#if (WL_DBG_LEVEL > 0) -#define WL_DBG(args) \ - do { \ - if (wl_dbg_level & WL_DBG_DBG) { \ - printk("DEBUG @%s :", __FUNCTION__); \ - printk args; \ - } \ - } while (0) -#else /* !(WL_DBG_LEVEL > 0) */ -#define WL_DBG(args) -#endif /* (WL_DBG_LEVEL > 0) */ - -#define WL_SCAN_RETRY_MAX 3 /* used for ibss scan */ -#define WL_NUM_SCAN_MAX 1 -#define WL_NUM_PMKIDS_MAX MAXPMKID /* will be used for 2.6.33 kernel - * or later - */ -#define WL_SCAN_BUF_MAX (1024 * 8) -#define WL_TLV_INFO_MAX 1024 -#define WL_BSS_INFO_MAX 2048 -#define WL_ASSOC_INFO_MAX 512 /* - * needs to grab assoc info from dongle to - * report it to cfg80211 through "connect" - * event - */ -#define WL_IOCTL_LEN_MAX 1024 -#define WL_EXTRA_BUF_MAX 2048 -#define WL_ISCAN_BUF_MAX 2048 /* the buf lengh can be WLC_IOCTL_MAXLEN (8K) - * to reduce iteration - */ -#define WL_ISCAN_TIMER_INTERVAL_MS 3000 -#define WL_SCAN_ERSULTS_LAST (WL_SCAN_RESULTS_NO_MEM+1) -#define WL_AP_MAX 256 /* virtually unlimitted as long - * as kernel memory allows - */ -#define WL_FILE_NAME_MAX 256 - -/* dongle status */ -enum wl_status { - WL_STATUS_READY, - WL_STATUS_SCANNING, - WL_STATUS_SCAN_ABORTING, - WL_STATUS_CONNECTING, - WL_STATUS_CONNECTED -}; - -/* wi-fi mode */ -enum wl_mode { - WL_MODE_BSS, - WL_MODE_IBSS, - WL_MODE_AP -}; - -/* dongle profile list */ -enum wl_prof_list { - WL_PROF_MODE, - WL_PROF_SSID, - WL_PROF_SEC, - WL_PROF_IBSS, - WL_PROF_BAND, - WL_PROF_BSSID, - WL_PROF_ACT -}; - -/* dongle iscan state */ -enum wl_iscan_state { - WL_ISCAN_STATE_IDLE, - WL_ISCAN_STATE_SCANING -}; - -/* fw downloading status */ -enum wl_fw_status { - WL_FW_LOADING_DONE, - WL_NVRAM_LOADING_DONE -}; - -/* dongle configuration */ -struct wl_conf { - uint32 mode; /* adhoc , infrastructure or ap */ - uint32 frag_threshold; - uint32 rts_threshold; - uint32 retry_short; - uint32 retry_long; - int32 tx_power; - struct ieee80211_channel channel; -}; - -/* cfg80211 main event loop */ -struct wl_event_loop { - int32 (*handler[WLC_E_LAST])(struct wl_priv *wl, struct net_device *ndev, - const wl_event_msg_t *e, void *data); -}; - -/* representing interface of cfg80211 plane */ -struct wl_iface { - struct wl_priv *wl; -}; - -struct wl_dev { - void *driver_data; /* to store cfg80211 object information */ -}; - -/* bss inform structure for cfg80211 interface */ -struct wl_cfg80211_bss_info { - uint16 band; - uint16 channel; - int16 rssi; - uint16 frame_len; - uint8 frame_buf[1]; -}; - -/* basic structure of scan request */ -struct wl_scan_req { - struct wlc_ssid ssid; -}; - -/* basic structure of information element */ -struct wl_ie { - uint16 offset; - uint8 buf[WL_TLV_INFO_MAX]; -}; - -/* event queue for cfg80211 main event */ -struct wl_event_q { - struct list_head eq_list; - uint32 etype; - wl_event_msg_t emsg; - int8 edata[1]; -}; - -/* security information with currently associated ap */ -struct wl_security { - uint32 wpa_versions; - uint32 auth_type; - uint32 cipher_pairwise; - uint32 cipher_group; - uint32 wpa_auth; -}; - -/* ibss information for currently joined ibss network */ -struct wl_ibss { - uint8 beacon_interval; /* in millisecond */ - uint8 atim; /* in millisecond */ - int8 join_only; - uint8 band; - uint8 channel; -}; - -/* dongle profile */ -struct wl_profile { - uint32 mode; - struct wlc_ssid ssid; - uint8 bssid[ETHER_ADDR_LEN]; - struct wl_security sec; - struct wl_ibss ibss; - int32 band; - bool active; -}; - -/* dongle iscan event loop */ -struct wl_iscan_eloop { - int32 (*handler[WL_SCAN_ERSULTS_LAST])(struct wl_priv *wl); -}; - -/* dongle iscan controller */ -struct wl_iscan_ctrl { - struct net_device *dev; - struct timer_list timer; - uint32 timer_ms; - uint32 timer_on; - int32 state; - int32 pid; - struct semaphore sync; - struct completion exited; - struct wl_iscan_eloop el; - void *data; - int8 ioctl_buf[WLC_IOCTL_SMLEN]; - int8 scan_buf[WL_ISCAN_BUF_MAX]; -}; - -/* association inform */ -struct wl_connect_info { - uint8 *req_ie; - int32 req_ie_len; - uint8 *resp_ie; - int32 resp_ie_len; -}; - -/* firmware /nvram downloading controller */ -struct wl_fw_ctrl { - const struct firmware *fw_entry; - ulong status; - uint32 ptr; - int8 fw_name[WL_FILE_NAME_MAX]; - int8 nvram_name[WL_FILE_NAME_MAX]; -}; - -/* assoc ie length */ -struct wl_assoc_ielen { - uint32 req_len; - uint32 resp_len; -}; - -/* wpa2 pmk list */ -struct wl_pmk_list { - pmkid_list_t pmkids; - pmkid_t foo[MAXPMKID-1]; -}; - - -/* dongle private data of cfg80211 interface */ -struct wl_priv { - struct wireless_dev *wdev; /* representing wl cfg80211 device */ - struct wl_conf *conf; /* dongle configuration */ - struct cfg80211_scan_request *scan_request; /* scan request object */ - struct wl_event_loop el; /* main event loop */ - struct list_head eq_list; /* used for event queue */ - spinlock_t eq_lock; /* for event queue synchronization */ - struct mutex usr_sync; /* maily for dongle up/down synchronization */ - struct wl_scan_results *bss_list; /* bss_list holding scanned ap information */ - struct wl_scan_results *scan_results; - struct wl_scan_req *scan_req_int; /* scan request object for internal purpose */ - struct wl_cfg80211_bss_info *bss_info; /* bss information for cfg80211 layer */ - struct wl_ie ie; /* information element object for internal purpose */ - struct ether_addr bssid; /* bssid of currently engaged network */ - struct semaphore event_sync; /* for synchronization of main event thread */ - struct completion event_exit; - struct wl_profile *profile; /* holding dongle profile */ - struct wl_iscan_ctrl *iscan; /* iscan controller */ - struct wl_connect_info conn_info; /* association information container */ - struct wl_fw_ctrl *fw; /* control firwmare / nvram paramter downloading */ - struct wl_pmk_list *pmk_list; /* wpa2 pmk list */ - int32 event_pid; /* pid of main event handler thread */ - ulong status; /* current dongle status */ - void * pub; - uint32 channel; /* current channel */ - bool iscan_on; /* iscan on/off switch */ - bool iscan_kickstart; /* indicate iscan already started */ - bool active_scan; /* current scan mode */ - bool ibss_starter; /* indicates this sta is ibss starter */ - bool link_up; /* link/connection up flag */ - bool pwr_save; /* indicate whether dongle to support power save mode */ - bool dongle_up; /* indicate whether dongle up or not */ - bool roam_on; /* on/off switch for dongle self-roaming */ - bool scan_tried; /* indicates if first scan attempted */ - uint8 *ioctl_buf; /* ioctl buffer */ - uint8 *extra_buf; /* maily to grab assoc information */ - uint8 ci[0] __attribute__((__aligned__(NETDEV_ALIGN))); -}; - -#define wl_to_dev(w) (wiphy_dev(wl->wdev->wiphy)) -#define wl_to_wiphy(w) (w->wdev->wiphy) -#define wiphy_to_wl(w) ((struct wl_priv *)(wiphy_priv(w))) -#define wl_to_wdev(w) (w->wdev) -#define wdev_to_wl(w) ((struct wl_priv *)(wdev_priv(w))) -#define wl_to_ndev(w) (w->wdev->netdev) -#define ndev_to_wl(n) (wdev_to_wl(n->ieee80211_ptr)) -#define ci_to_wl(c) (ci->wl) -#define wl_to_ci(w) (&w->ci) -#define wl_to_sr(w) (w->scan_req_int) -#define wl_to_ie(w) (&w->ie) -#define iscan_to_wl(i) ((struct wl_priv *)(i->data)) -#define wl_to_iscan(w) (w->iscan) -#define wl_to_conn(w) (&w->conn_info) - -inline static struct wl_bss_info * next_bss(struct wl_scan_results *list, - struct wl_bss_info *bss) { - return (bss = bss ? - (struct wl_bss_info *)((uintptr)bss + dtoh32(bss->length)) : list->bss_info); -} -#define for_each_bss(list, bss, __i) \ - for (__i = 0; __i < list->count && __i < WL_AP_MAX; __i++, bss = next_bss(list, bss)) - -extern int32 wl_cfg80211_attach(struct net_device *ndev, void *data); -extern void wl_cfg80211_detach(void); -/* event handler from dongle */ -extern void wl_cfg80211_event(struct net_device *ndev, const wl_event_msg_t *e, void* data); -extern void wl_cfg80211_sdio_func(void *func); /* set sdio function info */ -extern int32 wl_cfg80211_up(void); /* dongle up */ -extern int32 wl_cfg80211_down(void); /* dongle down */ -extern void wl_cfg80211_dbg_level(uint32 level); /* set dongle debugging level */ -extern void * wl_cfg80211_request_fw(int8 *file_name); /* request fw /nvram downloading */ -extern int32 wl_cfg80211_read_fw(int8 *buf, uint32 size); /* read fw image */ -extern void wl_cfg80211_release_fw(void); /* release fw */ -extern int8 * wl_cfg80211_get_fwname(void); /* get firmware name for the dongle */ -extern int8 * wl_cfg80211_get_nvramname(void); /* get nvram name for the dongle */ - -#endif /* _wl_cfg80211_h_ */ diff --git a/drivers/net/wireless/brcm80211/Kconfig b/drivers/net/wireless/brcm80211/Kconfig deleted file mode 100644 index fc8a0fa6d3b2..000000000000 --- a/drivers/net/wireless/brcm80211/Kconfig +++ /dev/null @@ -1,65 +0,0 @@ -config BRCMUTIL - tristate - -config BRCMSMAC - tristate "Broadcom IEEE802.11n PCIe SoftMAC WLAN driver" - depends on MAC80211 - depends on BCMA - select BRCMUTIL - select FW_LOADER - select CRC_CCITT - select CRC8 - select CORDIC - ---help--- - This module adds support for PCIe wireless adapters based on Broadcom - IEEE802.11n SoftMAC chipsets. It also has WLAN led support, which will - be available if you select BCMA_DRIVER_GPIO. If you choose to build a - module, the driver will be called brcmsmac.ko. - -config BRCMFMAC - tristate "Broadcom IEEE802.11n embedded FullMAC WLAN driver" - depends on CFG80211 - select BRCMUTIL - ---help--- - This module adds support for embedded wireless adapters based on - Broadcom IEEE802.11n FullMAC chipsets. It has to work with at least - one of the bus interface support. If you choose to build a module, - it'll be called brcmfmac.ko. - -config BRCMFMAC_SDIO - bool "SDIO bus interface support for FullMAC driver" - depends on MMC - depends on BRCMFMAC - select FW_LOADER - default y - ---help--- - This option enables the SDIO bus interface support for Broadcom - IEEE802.11n embedded FullMAC WLAN driver. Say Y if you want to - use the driver for a SDIO wireless card. - -config BRCMFMAC_USB - bool "USB bus interface support for FullMAC driver" - depends on USB - depends on BRCMFMAC - select FW_LOADER - ---help--- - This option enables the USB bus interface support for Broadcom - IEEE802.11n embedded FullMAC WLAN driver. Say Y if you want to - use the driver for an USB wireless card. - -config BRCM_TRACING - bool "Broadcom device tracing" - depends on BRCMSMAC || BRCMFMAC - ---help--- - If you say Y here, the Broadcom wireless drivers will register - with ftrace to dump event information into the trace ringbuffer. - Tracing can be enabled at runtime to aid in debugging wireless - issues. This option adds a small amount of overhead when tracing - is disabled. If unsure, say Y to allow developers to better help - you when wireless problems occur. - -config BRCMDBG - bool "Broadcom driver debug functions" - depends on BRCMSMAC || BRCMFMAC - ---help--- - Selecting this enables additional code for debug purposes. diff --git a/drivers/net/wireless/brcm80211/Makefile b/drivers/net/wireless/brcm80211/Makefile deleted file mode 100644 index b987920e982e..000000000000 --- a/drivers/net/wireless/brcm80211/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# -# Makefile fragment for Broadcom 802.11n Networking Device Driver -# -# Copyright (c) 2010 Broadcom Corporation -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION -# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN -# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -# common flags -subdir-ccflags-$(CONFIG_BRCMDBG) += -DDEBUG - -obj-$(CONFIG_BRCMUTIL) += brcmutil/ -obj-$(CONFIG_BRCMFMAC) += brcmfmac/ -obj-$(CONFIG_BRCMSMAC) += brcmsmac/ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/Makefile b/drivers/net/wireless/brcm80211/brcmfmac/Makefile deleted file mode 100644 index 8e9b1221b32c..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# Makefile fragment for Broadcom 802.11n Networking Device Driver -# -# Copyright (c) 2010 Broadcom Corporation -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION -# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN -# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -ccflags-y += \ - -Idrivers/net/wireless/brcm80211/brcmfmac \ - -Idrivers/net/wireless/brcm80211/include - -ccflags-y += -D__CHECK_ENDIAN__ - -obj-$(CONFIG_BRCMFMAC) += brcmfmac.o -brcmfmac-objs += \ - wl_cfg80211.o \ - fwil.o \ - fweh.o \ - fwsignal.o \ - p2p.o \ - dhd_cdc.o \ - dhd_common.o \ - dhd_linux.o \ - btcoex.o -brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \ - dhd_sdio.o \ - bcmsdh.o \ - bcmsdh_sdmmc.o \ - sdio_chip.o -brcmfmac-$(CONFIG_BRCMFMAC_USB) += \ - usb.o -brcmfmac-$(CONFIG_BRCMDBG) += \ - dhd_dbg.o -brcmfmac-$(CONFIG_BRCM_TRACING) += \ - tracepoint.o diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c deleted file mode 100644 index 4891e3df2058..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +++ /dev/null @@ -1,600 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* ****************** SDIO CARD Interface Functions **************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include "dhd_bus.h" -#include "dhd_dbg.h" -#include "sdio_host.h" - -#define SDIOH_API_ACCESS_RETRY_LIMIT 2 - - -static irqreturn_t brcmf_sdio_oob_irqhandler(int irq, void *dev_id) -{ - struct brcmf_bus *bus_if = dev_get_drvdata(dev_id); - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; - - brcmf_dbg(INTR, "OOB intr triggered\n"); - - /* out-of-band interrupt is level-triggered which won't - * be cleared until dpc - */ - if (sdiodev->irq_en) { - disable_irq_nosync(irq); - sdiodev->irq_en = false; - } - - brcmf_sdbrcm_isr(sdiodev->bus); - - return IRQ_HANDLED; -} - -static void brcmf_sdio_ib_irqhandler(struct sdio_func *func) -{ - struct brcmf_bus *bus_if = dev_get_drvdata(&func->dev); - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; - - brcmf_dbg(INTR, "IB intr triggered\n"); - - brcmf_sdbrcm_isr(sdiodev->bus); -} - -/* dummy handler for SDIO function 2 interrupt */ -static void brcmf_sdio_dummy_irqhandler(struct sdio_func *func) -{ -} - -int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev) -{ - int ret = 0; - u8 data; - unsigned long flags; - - if ((sdiodev->pdata) && (sdiodev->pdata->oob_irq_supported)) { - brcmf_dbg(SDIO, "Enter, register OOB IRQ %d\n", - sdiodev->pdata->oob_irq_nr); - ret = request_irq(sdiodev->pdata->oob_irq_nr, - brcmf_sdio_oob_irqhandler, - sdiodev->pdata->oob_irq_flags, - "brcmf_oob_intr", - &sdiodev->func[1]->dev); - if (ret != 0) { - brcmf_err("request_irq failed %d\n", ret); - return ret; - } - sdiodev->oob_irq_requested = true; - spin_lock_init(&sdiodev->irq_en_lock); - spin_lock_irqsave(&sdiodev->irq_en_lock, flags); - sdiodev->irq_en = true; - spin_unlock_irqrestore(&sdiodev->irq_en_lock, flags); - - ret = enable_irq_wake(sdiodev->pdata->oob_irq_nr); - if (ret != 0) { - brcmf_err("enable_irq_wake failed %d\n", ret); - return ret; - } - sdiodev->irq_wake = true; - - sdio_claim_host(sdiodev->func[1]); - - /* must configure SDIO_CCCR_IENx to enable irq */ - data = brcmf_sdio_regrb(sdiodev, SDIO_CCCR_IENx, &ret); - data |= 1 << SDIO_FUNC_1 | 1 << SDIO_FUNC_2 | 1; - brcmf_sdio_regwb(sdiodev, SDIO_CCCR_IENx, data, &ret); - - /* redirect, configure and enable io for interrupt signal */ - data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE; - if (sdiodev->pdata->oob_irq_flags & IRQF_TRIGGER_HIGH) - data |= SDIO_SEPINT_ACT_HI; - brcmf_sdio_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, data, &ret); - - sdio_release_host(sdiodev->func[1]); - } else { - brcmf_dbg(SDIO, "Entering\n"); - sdio_claim_host(sdiodev->func[1]); - sdio_claim_irq(sdiodev->func[1], brcmf_sdio_ib_irqhandler); - sdio_claim_irq(sdiodev->func[2], brcmf_sdio_dummy_irqhandler); - sdio_release_host(sdiodev->func[1]); - } - - return 0; -} - -int brcmf_sdio_intr_unregister(struct brcmf_sdio_dev *sdiodev) -{ - brcmf_dbg(SDIO, "Entering\n"); - - if ((sdiodev->pdata) && (sdiodev->pdata->oob_irq_supported)) { - sdio_claim_host(sdiodev->func[1]); - brcmf_sdio_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, 0, NULL); - brcmf_sdio_regwb(sdiodev, SDIO_CCCR_IENx, 0, NULL); - sdio_release_host(sdiodev->func[1]); - - if (sdiodev->oob_irq_requested) { - sdiodev->oob_irq_requested = false; - if (sdiodev->irq_wake) { - disable_irq_wake(sdiodev->pdata->oob_irq_nr); - sdiodev->irq_wake = false; - } - free_irq(sdiodev->pdata->oob_irq_nr, - &sdiodev->func[1]->dev); - sdiodev->irq_en = false; - } - } else { - sdio_claim_host(sdiodev->func[1]); - sdio_release_irq(sdiodev->func[2]); - sdio_release_irq(sdiodev->func[1]); - sdio_release_host(sdiodev->func[1]); - } - - return 0; -} - -int -brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address) -{ - int err = 0, i; - u8 addr[3]; - s32 retry; - - addr[0] = (address >> 8) & SBSDIO_SBADDRLOW_MASK; - addr[1] = (address >> 16) & SBSDIO_SBADDRMID_MASK; - addr[2] = (address >> 24) & SBSDIO_SBADDRHIGH_MASK; - - for (i = 0; i < 3; i++) { - retry = 0; - do { - if (retry) - usleep_range(1000, 2000); - err = brcmf_sdioh_request_byte(sdiodev, SDIOH_WRITE, - SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW + i, - &addr[i]); - } while (err != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT); - - if (err) { - brcmf_err("failed at addr:0x%0x\n", - SBSDIO_FUNC1_SBADDRLOW + i); - break; - } - } - - return err; -} - -int -brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr, - void *data, bool write) -{ - u8 func_num, reg_size; - u32 bar; - s32 retry = 0; - int ret; - - /* - * figure out how to read the register based on address range - * 0x00 ~ 0x7FF: function 0 CCCR and FBR - * 0x10000 ~ 0x1FFFF: function 1 miscellaneous registers - * The rest: function 1 silicon backplane core registers - */ - if ((addr & ~REG_F0_REG_MASK) == 0) { - func_num = SDIO_FUNC_0; - reg_size = 1; - } else if ((addr & ~REG_F1_MISC_MASK) == 0) { - func_num = SDIO_FUNC_1; - reg_size = 1; - } else { - func_num = SDIO_FUNC_1; - reg_size = 4; - - /* Set the window for SB core register */ - bar = addr & ~SBSDIO_SB_OFT_ADDR_MASK; - if (bar != sdiodev->sbwad) { - ret = brcmf_sdcard_set_sbaddr_window(sdiodev, bar); - if (ret != 0) { - memset(data, 0xFF, reg_size); - return ret; - } - sdiodev->sbwad = bar; - } - addr &= SBSDIO_SB_OFT_ADDR_MASK; - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - } - - do { - if (!write) - memset(data, 0, reg_size); - if (retry) /* wait for 1 ms till bus get settled down */ - usleep_range(1000, 2000); - if (reg_size == 1) - ret = brcmf_sdioh_request_byte(sdiodev, write, - func_num, addr, data); - else - ret = brcmf_sdioh_request_word(sdiodev, write, - func_num, addr, data, 4); - } while (ret != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT); - - if (ret != 0) - brcmf_err("failed with %d\n", ret); - - return ret; -} - -u8 brcmf_sdio_regrb(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret) -{ - u8 data; - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x\n", addr); - retval = brcmf_sdio_regrw_helper(sdiodev, addr, &data, false); - brcmf_dbg(SDIO, "data:0x%02x\n", data); - - if (ret) - *ret = retval; - - return data; -} - -u32 brcmf_sdio_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret) -{ - u32 data; - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x\n", addr); - retval = brcmf_sdio_regrw_helper(sdiodev, addr, &data, false); - brcmf_dbg(SDIO, "data:0x%08x\n", data); - - if (ret) - *ret = retval; - - return data; -} - -void brcmf_sdio_regwb(struct brcmf_sdio_dev *sdiodev, u32 addr, - u8 data, int *ret) -{ - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x, data:0x%02x\n", addr, data); - retval = brcmf_sdio_regrw_helper(sdiodev, addr, &data, true); - - if (ret) - *ret = retval; -} - -void brcmf_sdio_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, - u32 data, int *ret) -{ - int retval; - - brcmf_dbg(SDIO, "addr:0x%08x, data:0x%08x\n", addr, data); - retval = brcmf_sdio_regrw_helper(sdiodev, addr, &data, true); - - if (ret) - *ret = retval; -} - -static int brcmf_sdcard_recv_prepare(struct brcmf_sdio_dev *sdiodev, uint fn, - uint flags, uint width, u32 *addr) -{ - uint bar0 = *addr & ~SBSDIO_SB_OFT_ADDR_MASK; - int err = 0; - - /* Async not implemented yet */ - if (flags & SDIO_REQ_ASYNC) - return -ENOTSUPP; - - if (bar0 != sdiodev->sbwad) { - err = brcmf_sdcard_set_sbaddr_window(sdiodev, bar0); - if (err) - return err; - - sdiodev->sbwad = bar0; - } - - *addr &= SBSDIO_SB_OFT_ADDR_MASK; - - if (width == 4) - *addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - return 0; -} - -int -brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, - uint flags, u8 *buf, uint nbytes) -{ - struct sk_buff *mypkt; - int err; - - mypkt = brcmu_pkt_buf_get_skb(nbytes); - if (!mypkt) { - brcmf_err("brcmu_pkt_buf_get_skb failed: len %d\n", - nbytes); - return -EIO; - } - - err = brcmf_sdcard_recv_pkt(sdiodev, addr, fn, flags, mypkt); - if (!err) - memcpy(buf, mypkt->data, nbytes); - - brcmu_pkt_buf_free_skb(mypkt); - return err; -} - -int -brcmf_sdcard_recv_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, - uint flags, struct sk_buff *pkt) -{ - uint incr_fix; - uint width; - int err = 0; - - brcmf_dbg(SDIO, "fun = %d, addr = 0x%x, size = %d\n", - fn, addr, pkt->len); - - width = (flags & SDIO_REQ_4BYTE) ? 4 : 2; - err = brcmf_sdcard_recv_prepare(sdiodev, fn, flags, width, &addr); - if (err) - goto done; - - incr_fix = (flags & SDIO_REQ_FIXED) ? SDIOH_DATA_FIX : SDIOH_DATA_INC; - err = brcmf_sdioh_request_buffer(sdiodev, incr_fix, SDIOH_READ, - fn, addr, pkt); - -done: - return err; -} - -int brcmf_sdcard_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, - uint flags, struct sk_buff_head *pktq) -{ - uint incr_fix; - uint width; - int err = 0; - - brcmf_dbg(SDIO, "fun = %d, addr = 0x%x, size = %d\n", - fn, addr, pktq->qlen); - - width = (flags & SDIO_REQ_4BYTE) ? 4 : 2; - err = brcmf_sdcard_recv_prepare(sdiodev, fn, flags, width, &addr); - if (err) - goto done; - - incr_fix = (flags & SDIO_REQ_FIXED) ? SDIOH_DATA_FIX : SDIOH_DATA_INC; - err = brcmf_sdioh_request_chain(sdiodev, incr_fix, SDIOH_READ, fn, addr, - pktq); - -done: - return err; -} - -int -brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, - uint flags, u8 *buf, uint nbytes) -{ - struct sk_buff *mypkt; - int err; - - mypkt = brcmu_pkt_buf_get_skb(nbytes); - if (!mypkt) { - brcmf_err("brcmu_pkt_buf_get_skb failed: len %d\n", - nbytes); - return -EIO; - } - - memcpy(mypkt->data, buf, nbytes); - err = brcmf_sdcard_send_pkt(sdiodev, addr, fn, flags, mypkt); - - brcmu_pkt_buf_free_skb(mypkt); - return err; - -} - -int -brcmf_sdcard_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, - uint flags, struct sk_buff *pkt) -{ - uint incr_fix; - uint width; - uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK; - int err = 0; - - brcmf_dbg(SDIO, "fun = %d, addr = 0x%x, size = %d\n", - fn, addr, pkt->len); - - /* Async not implemented yet */ - if (flags & SDIO_REQ_ASYNC) - return -ENOTSUPP; - - if (bar0 != sdiodev->sbwad) { - err = brcmf_sdcard_set_sbaddr_window(sdiodev, bar0); - if (err) - goto done; - - sdiodev->sbwad = bar0; - } - - addr &= SBSDIO_SB_OFT_ADDR_MASK; - - incr_fix = (flags & SDIO_REQ_FIXED) ? SDIOH_DATA_FIX : SDIOH_DATA_INC; - width = (flags & SDIO_REQ_4BYTE) ? 4 : 2; - if (width == 4) - addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - err = brcmf_sdioh_request_buffer(sdiodev, incr_fix, SDIOH_WRITE, fn, - addr, pkt); - -done: - return err; -} - -int -brcmf_sdio_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, u32 address, - u8 *data, uint size) -{ - int bcmerror = 0; - struct sk_buff *pkt; - u32 sdaddr; - uint dsize; - - dsize = min_t(uint, SBSDIO_SB_OFT_ADDR_LIMIT, size); - pkt = dev_alloc_skb(dsize); - if (!pkt) { - brcmf_err("dev_alloc_skb failed: len %d\n", dsize); - return -EIO; - } - pkt->priority = 0; - - /* Determine initial transfer parameters */ - sdaddr = address & SBSDIO_SB_OFT_ADDR_MASK; - if ((sdaddr + size) & SBSDIO_SBWINDOW_MASK) - dsize = (SBSDIO_SB_OFT_ADDR_LIMIT - sdaddr); - else - dsize = size; - - sdio_claim_host(sdiodev->func[1]); - - /* Do the transfer(s) */ - while (size) { - /* Set the backplane window to include the start address */ - bcmerror = brcmf_sdcard_set_sbaddr_window(sdiodev, address); - if (bcmerror) - break; - - brcmf_dbg(SDIO, "%s %d bytes at offset 0x%08x in window 0x%08x\n", - write ? "write" : "read", dsize, - sdaddr, address & SBSDIO_SBWINDOW_MASK); - - sdaddr &= SBSDIO_SB_OFT_ADDR_MASK; - sdaddr |= SBSDIO_SB_ACCESS_2_4B_FLAG; - - skb_put(pkt, dsize); - if (write) - memcpy(pkt->data, data, dsize); - bcmerror = brcmf_sdioh_request_buffer(sdiodev, SDIOH_DATA_INC, - write, SDIO_FUNC_1, - sdaddr, pkt); - if (bcmerror) { - brcmf_err("membytes transfer failed\n"); - break; - } - if (!write) - memcpy(data, pkt->data, dsize); - skb_trim(pkt, dsize); - - /* Adjust for next transfer (if any) */ - size -= dsize; - if (size) { - data += dsize; - address += dsize; - sdaddr = 0; - dsize = min_t(uint, SBSDIO_SB_OFT_ADDR_LIMIT, size); - } - } - - dev_kfree_skb(pkt); - - /* Return the window to backplane enumeration space for core access */ - if (brcmf_sdcard_set_sbaddr_window(sdiodev, sdiodev->sbwad)) - brcmf_err("FAILED to set window back to 0x%x\n", - sdiodev->sbwad); - - sdio_release_host(sdiodev->func[1]); - - return bcmerror; -} - -int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn) -{ - char t_func = (char)fn; - brcmf_dbg(SDIO, "Enter\n"); - - /* issue abort cmd52 command through F0 */ - brcmf_sdioh_request_byte(sdiodev, SDIOH_WRITE, SDIO_FUNC_0, - SDIO_CCCR_ABORT, &t_func); - - brcmf_dbg(SDIO, "Exit\n"); - return 0; -} - -int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) -{ - u32 regs = 0; - int ret = 0; - - ret = brcmf_sdioh_attach(sdiodev); - if (ret) - goto out; - - regs = SI_ENUM_BASE; - - /* try to attach to the target device */ - sdiodev->bus = brcmf_sdbrcm_probe(regs, sdiodev); - if (!sdiodev->bus) { - brcmf_err("device attach failed\n"); - ret = -ENODEV; - goto out; - } - -out: - if (ret) - brcmf_sdio_remove(sdiodev); - - return ret; -} -EXPORT_SYMBOL(brcmf_sdio_probe); - -int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev) -{ - sdiodev->bus_if->state = BRCMF_BUS_DOWN; - - if (sdiodev->bus) { - brcmf_sdbrcm_disconnect(sdiodev->bus); - sdiodev->bus = NULL; - } - - brcmf_sdioh_detach(sdiodev); - - sdiodev->sbwad = 0; - - return 0; -} -EXPORT_SYMBOL(brcmf_sdio_remove); - -void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev, bool enable) -{ - if (enable) - brcmf_sdbrcm_wd_timer(sdiodev->bus, BRCMF_WD_POLL_MS); - else - brcmf_sdbrcm_wd_timer(sdiodev->bus, 0); -} diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c deleted file mode 100644 index 0f6eb2b6d381..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ /dev/null @@ -1,635 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* request_irq() */ -#include -#include -#include -#include - -#include -#include -#include -#include -#include "sdio_host.h" -#include "dhd_dbg.h" -#include "dhd_bus.h" - -#define SDIO_VENDOR_ID_BROADCOM 0x02d0 - -#define DMA_ALIGN_MASK 0x03 - -#define SDIO_DEVICE_ID_BROADCOM_43143 43143 -#define SDIO_DEVICE_ID_BROADCOM_43241 0x4324 -#define SDIO_DEVICE_ID_BROADCOM_4329 0x4329 -#define SDIO_DEVICE_ID_BROADCOM_4330 0x4330 -#define SDIO_DEVICE_ID_BROADCOM_4334 0x4334 -#define SDIO_DEVICE_ID_BROADCOM_4335 0x4335 - -#define SDIO_FUNC1_BLOCKSIZE 64 -#define SDIO_FUNC2_BLOCKSIZE 512 - -/* devices we support, null terminated */ -static const struct sdio_device_id brcmf_sdmmc_ids[] = { - {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_43143)}, - {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_43241)}, - {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4329)}, - {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4330)}, - {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4334)}, - {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4335)}, - { /* end: all zeroes */ }, -}; -MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids); - -static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata; - - -static bool -brcmf_pm_resume_error(struct brcmf_sdio_dev *sdiodev) -{ - bool is_err = false; -#ifdef CONFIG_PM_SLEEP - is_err = atomic_read(&sdiodev->suspend); -#endif - return is_err; -} - -static void -brcmf_pm_resume_wait(struct brcmf_sdio_dev *sdiodev, wait_queue_head_t *wq) -{ -#ifdef CONFIG_PM_SLEEP - int retry = 0; - while (atomic_read(&sdiodev->suspend) && retry++ != 30) - wait_event_timeout(*wq, false, HZ/100); -#endif -} - -static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev, - uint regaddr, u8 *byte) -{ - struct sdio_func *sdfunc = sdiodev->func[0]; - int err_ret; - - /* - * Can only directly write to some F0 registers. - * Handle F2 enable/disable and Abort command - * as a special case. - */ - if (regaddr == SDIO_CCCR_IOEx) { - sdfunc = sdiodev->func[2]; - if (sdfunc) { - if (*byte & SDIO_FUNC_ENABLE_2) { - /* Enable Function 2 */ - err_ret = sdio_enable_func(sdfunc); - if (err_ret) - brcmf_err("enable F2 failed:%d\n", - err_ret); - } else { - /* Disable Function 2 */ - err_ret = sdio_disable_func(sdfunc); - if (err_ret) - brcmf_err("Disable F2 failed:%d\n", - err_ret); - } - } - } else if ((regaddr == SDIO_CCCR_ABORT) || - (regaddr == SDIO_CCCR_IENx)) { - sdfunc = kmemdup(sdiodev->func[0], sizeof(struct sdio_func), - GFP_KERNEL); - if (!sdfunc) - return -ENOMEM; - sdfunc->num = 0; - sdio_writeb(sdfunc, *byte, regaddr, &err_ret); - kfree(sdfunc); - } else if (regaddr < 0xF0) { - brcmf_err("F0 Wr:0x%02x: write disallowed\n", regaddr); - err_ret = -EPERM; - } else { - sdio_f0_writeb(sdfunc, *byte, regaddr, &err_ret); - } - - return err_ret; -} - -int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func, - uint regaddr, u8 *byte) -{ - int err_ret; - - brcmf_dbg(SDIO, "rw=%d, func=%d, addr=0x%05x\n", rw, func, regaddr); - - brcmf_pm_resume_wait(sdiodev, &sdiodev->request_byte_wait); - if (brcmf_pm_resume_error(sdiodev)) - return -EIO; - - if (rw && func == 0) { - /* handle F0 separately */ - err_ret = brcmf_sdioh_f0_write_byte(sdiodev, regaddr, byte); - } else { - if (rw) /* CMD52 Write */ - sdio_writeb(sdiodev->func[func], *byte, regaddr, - &err_ret); - else if (func == 0) { - *byte = sdio_f0_readb(sdiodev->func[func], regaddr, - &err_ret); - } else { - *byte = sdio_readb(sdiodev->func[func], regaddr, - &err_ret); - } - } - - if (err_ret) - brcmf_err("Failed to %s byte F%d:@0x%05x=%02x, Err: %d\n", - rw ? "write" : "read", func, regaddr, *byte, err_ret); - - return err_ret; -} - -int brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, - uint rw, uint func, uint addr, u32 *word, - uint nbytes) -{ - int err_ret = -EIO; - - if (func == 0) { - brcmf_err("Only CMD52 allowed to F0\n"); - return -EINVAL; - } - - brcmf_dbg(SDIO, "rw=%d, func=%d, addr=0x%05x, nbytes=%d\n", - rw, func, addr, nbytes); - - brcmf_pm_resume_wait(sdiodev, &sdiodev->request_word_wait); - if (brcmf_pm_resume_error(sdiodev)) - return -EIO; - - if (rw) { /* CMD52 Write */ - if (nbytes == 4) - sdio_writel(sdiodev->func[func], *word, addr, - &err_ret); - else if (nbytes == 2) - sdio_writew(sdiodev->func[func], (*word & 0xFFFF), - addr, &err_ret); - else - brcmf_err("Invalid nbytes: %d\n", nbytes); - } else { /* CMD52 Read */ - if (nbytes == 4) - *word = sdio_readl(sdiodev->func[func], addr, &err_ret); - else if (nbytes == 2) - *word = sdio_readw(sdiodev->func[func], addr, - &err_ret) & 0xFFFF; - else - brcmf_err("Invalid nbytes: %d\n", nbytes); - } - - if (err_ret) - brcmf_err("Failed to %s word, Err: 0x%08x\n", - rw ? "write" : "read", err_ret); - - return err_ret; -} - -/* precondition: host controller is claimed */ -static int -brcmf_sdioh_request_data(struct brcmf_sdio_dev *sdiodev, uint write, bool fifo, - uint func, uint addr, struct sk_buff *pkt, uint pktlen) -{ - int err_ret = 0; - - if ((write) && (!fifo)) { - err_ret = sdio_memcpy_toio(sdiodev->func[func], addr, - ((u8 *) (pkt->data)), pktlen); - } else if (write) { - err_ret = sdio_memcpy_toio(sdiodev->func[func], addr, - ((u8 *) (pkt->data)), pktlen); - } else if (fifo) { - err_ret = sdio_readsb(sdiodev->func[func], - ((u8 *) (pkt->data)), addr, pktlen); - } else { - err_ret = sdio_memcpy_fromio(sdiodev->func[func], - ((u8 *) (pkt->data)), - addr, pktlen); - } - - return err_ret; -} - -/* - * This function takes a queue of packets. The packets on the queue - * are assumed to be properly aligned by the caller. - */ -int -brcmf_sdioh_request_chain(struct brcmf_sdio_dev *sdiodev, uint fix_inc, - uint write, uint func, uint addr, - struct sk_buff_head *pktq) -{ - bool fifo = (fix_inc == SDIOH_DATA_FIX); - u32 SGCount = 0; - int err_ret = 0; - - struct sk_buff *pkt; - - brcmf_dbg(SDIO, "Enter\n"); - - brcmf_pm_resume_wait(sdiodev, &sdiodev->request_chain_wait); - if (brcmf_pm_resume_error(sdiodev)) - return -EIO; - - skb_queue_walk(pktq, pkt) { - uint pkt_len = pkt->len; - pkt_len += 3; - pkt_len &= 0xFFFFFFFC; - - err_ret = brcmf_sdioh_request_data(sdiodev, write, fifo, func, - addr, pkt, pkt_len); - if (err_ret) { - brcmf_err("%s FAILED %p[%d], addr=0x%05x, pkt_len=%d, ERR=0x%08x\n", - write ? "TX" : "RX", pkt, SGCount, addr, - pkt_len, err_ret); - } else { - brcmf_dbg(SDIO, "%s xfr'd %p[%d], addr=0x%05x, len=%d\n", - write ? "TX" : "RX", pkt, SGCount, addr, - pkt_len); - } - if (!fifo) - addr += pkt_len; - - SGCount++; - } - - brcmf_dbg(SDIO, "Exit\n"); - return err_ret; -} - -/* - * This function takes a single DMA-able packet. - */ -int brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev, - uint fix_inc, uint write, uint func, uint addr, - struct sk_buff *pkt) -{ - int status; - uint pkt_len; - bool fifo = (fix_inc == SDIOH_DATA_FIX); - - brcmf_dbg(SDIO, "Enter\n"); - - if (pkt == NULL) - return -EINVAL; - pkt_len = pkt->len; - - brcmf_pm_resume_wait(sdiodev, &sdiodev->request_buffer_wait); - if (brcmf_pm_resume_error(sdiodev)) - return -EIO; - - pkt_len += 3; - pkt_len &= (uint)~3; - - status = brcmf_sdioh_request_data(sdiodev, write, fifo, func, - addr, pkt, pkt_len); - if (status) { - brcmf_err("%s FAILED %p, addr=0x%05x, pkt_len=%d, ERR=0x%08x\n", - write ? "TX" : "RX", pkt, addr, pkt_len, status); - } else { - brcmf_dbg(SDIO, "%s xfr'd %p, addr=0x%05x, len=%d\n", - write ? "TX" : "RX", pkt, addr, pkt_len); - } - - return status; -} - -static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr) -{ - /* read 24 bits and return valid 17 bit addr */ - int i, ret; - u32 scratch, regdata; - __le32 scratch_le; - u8 *ptr = (u8 *)&scratch_le; - - for (i = 0; i < 3; i++) { - regdata = brcmf_sdio_regrl(sdiodev, regaddr, &ret); - if (ret != 0) - brcmf_err("Can't read!\n"); - - *ptr++ = (u8) regdata; - regaddr++; - } - - /* Only the lower 17-bits are valid */ - scratch = le32_to_cpu(scratch_le); - scratch &= 0x0001FFFF; - return scratch; -} - -static int brcmf_sdioh_enablefuncs(struct brcmf_sdio_dev *sdiodev) -{ - int err_ret; - u32 fbraddr; - u8 func; - - brcmf_dbg(SDIO, "\n"); - - /* Get the Card's common CIS address */ - sdiodev->func_cis_ptr[0] = brcmf_sdioh_get_cisaddr(sdiodev, - SDIO_CCCR_CIS); - brcmf_dbg(SDIO, "Card's Common CIS Ptr = 0x%x\n", - sdiodev->func_cis_ptr[0]); - - /* Get the Card's function CIS (for each function) */ - for (fbraddr = SDIO_FBR_BASE(1), func = 1; - func <= sdiodev->num_funcs; func++, fbraddr += SDIOD_FBR_SIZE) { - sdiodev->func_cis_ptr[func] = - brcmf_sdioh_get_cisaddr(sdiodev, SDIO_FBR_CIS + fbraddr); - brcmf_dbg(SDIO, "Function %d CIS Ptr = 0x%x\n", - func, sdiodev->func_cis_ptr[func]); - } - - /* Enable Function 1 */ - err_ret = sdio_enable_func(sdiodev->func[1]); - if (err_ret) - brcmf_err("Failed to enable F1 Err: 0x%08x\n", err_ret); - - return false; -} - -/* - * Public entry points & extern's - */ -int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev) -{ - int err_ret = 0; - - brcmf_dbg(SDIO, "\n"); - - sdiodev->num_funcs = 2; - - sdio_claim_host(sdiodev->func[1]); - - err_ret = sdio_set_block_size(sdiodev->func[1], SDIO_FUNC1_BLOCKSIZE); - if (err_ret) { - brcmf_err("Failed to set F1 blocksize\n"); - goto out; - } - - err_ret = sdio_set_block_size(sdiodev->func[2], SDIO_FUNC2_BLOCKSIZE); - if (err_ret) { - brcmf_err("Failed to set F2 blocksize\n"); - goto out; - } - - brcmf_sdioh_enablefuncs(sdiodev); - -out: - sdio_release_host(sdiodev->func[1]); - brcmf_dbg(SDIO, "Done\n"); - return err_ret; -} - -void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev) -{ - brcmf_dbg(SDIO, "\n"); - - /* Disable Function 2 */ - sdio_claim_host(sdiodev->func[2]); - sdio_disable_func(sdiodev->func[2]); - sdio_release_host(sdiodev->func[2]); - - /* Disable Function 1 */ - sdio_claim_host(sdiodev->func[1]); - sdio_disable_func(sdiodev->func[1]); - sdio_release_host(sdiodev->func[1]); - -} - -static int brcmf_ops_sdio_probe(struct sdio_func *func, - const struct sdio_device_id *id) -{ - int err; - struct brcmf_sdio_dev *sdiodev; - struct brcmf_bus *bus_if; - - brcmf_dbg(SDIO, "Enter\n"); - brcmf_dbg(SDIO, "Class=%x\n", func->class); - brcmf_dbg(SDIO, "sdio vendor ID: 0x%04x\n", func->vendor); - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device); - brcmf_dbg(SDIO, "Function#: %d\n", func->num); - - /* Consume func num 1 but dont do anything with it. */ - if (func->num == 1) - return 0; - - /* Ignore anything but func 2 */ - if (func->num != 2) - return -ENODEV; - - bus_if = kzalloc(sizeof(struct brcmf_bus), GFP_KERNEL); - if (!bus_if) - return -ENOMEM; - sdiodev = kzalloc(sizeof(struct brcmf_sdio_dev), GFP_KERNEL); - if (!sdiodev) { - kfree(bus_if); - return -ENOMEM; - } - - sdiodev->func[0] = func->card->sdio_func[0]; - sdiodev->func[1] = func->card->sdio_func[0]; - sdiodev->func[2] = func; - - sdiodev->bus_if = bus_if; - bus_if->bus_priv.sdio = sdiodev; - bus_if->align = BRCMF_SDALIGN; - dev_set_drvdata(&func->dev, bus_if); - dev_set_drvdata(&sdiodev->func[1]->dev, bus_if); - sdiodev->dev = &sdiodev->func[1]->dev; - sdiodev->pdata = brcmfmac_sdio_pdata; - - atomic_set(&sdiodev->suspend, false); - init_waitqueue_head(&sdiodev->request_byte_wait); - init_waitqueue_head(&sdiodev->request_word_wait); - init_waitqueue_head(&sdiodev->request_chain_wait); - init_waitqueue_head(&sdiodev->request_buffer_wait); - - brcmf_dbg(SDIO, "F2 found, calling brcmf_sdio_probe...\n"); - err = brcmf_sdio_probe(sdiodev); - if (err) { - brcmf_err("F2 error, probe failed %d...\n", err); - goto fail; - } - brcmf_dbg(SDIO, "F2 init completed...\n"); - return 0; - -fail: - dev_set_drvdata(&func->dev, NULL); - dev_set_drvdata(&sdiodev->func[1]->dev, NULL); - kfree(sdiodev); - kfree(bus_if); - return err; -} - -static void brcmf_ops_sdio_remove(struct sdio_func *func) -{ - struct brcmf_bus *bus_if; - struct brcmf_sdio_dev *sdiodev; - - brcmf_dbg(SDIO, "Enter\n"); - brcmf_dbg(SDIO, "sdio vendor ID: 0x%04x\n", func->vendor); - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device); - brcmf_dbg(SDIO, "Function: %d\n", func->num); - - if (func->num != 1 && func->num != 2) - return; - - bus_if = dev_get_drvdata(&func->dev); - if (bus_if) { - sdiodev = bus_if->bus_priv.sdio; - brcmf_sdio_remove(sdiodev); - - dev_set_drvdata(&sdiodev->func[1]->dev, NULL); - dev_set_drvdata(&sdiodev->func[2]->dev, NULL); - - kfree(bus_if); - kfree(sdiodev); - } - - brcmf_dbg(SDIO, "Exit\n"); -} - -#ifdef CONFIG_PM_SLEEP -static int brcmf_sdio_suspend(struct device *dev) -{ - mmc_pm_flag_t sdio_flags; - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; - int ret = 0; - - brcmf_dbg(SDIO, "\n"); - - atomic_set(&sdiodev->suspend, true); - - sdio_flags = sdio_get_host_pm_caps(sdiodev->func[1]); - if (!(sdio_flags & MMC_PM_KEEP_POWER)) { - brcmf_err("Host can't keep power while suspended\n"); - return -EINVAL; - } - - ret = sdio_set_host_pm_flags(sdiodev->func[1], MMC_PM_KEEP_POWER); - if (ret) { - brcmf_err("Failed to set pm_flags\n"); - return ret; - } - - brcmf_sdio_wdtmr_enable(sdiodev, false); - - return ret; -} - -static int brcmf_sdio_resume(struct device *dev) -{ - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; - - brcmf_sdio_wdtmr_enable(sdiodev, true); - atomic_set(&sdiodev->suspend, false); - return 0; -} - -static const struct dev_pm_ops brcmf_sdio_pm_ops = { - .suspend = brcmf_sdio_suspend, - .resume = brcmf_sdio_resume, -}; -#endif /* CONFIG_PM_SLEEP */ - -static struct sdio_driver brcmf_sdmmc_driver = { - .probe = brcmf_ops_sdio_probe, - .remove = brcmf_ops_sdio_remove, - .name = BRCMFMAC_SDIO_PDATA_NAME, - .id_table = brcmf_sdmmc_ids, -#ifdef CONFIG_PM_SLEEP - .drv = { - .pm = &brcmf_sdio_pm_ops, - }, -#endif /* CONFIG_PM_SLEEP */ -}; - -static int brcmf_sdio_pd_probe(struct platform_device *pdev) -{ - brcmf_dbg(SDIO, "Enter\n"); - - brcmfmac_sdio_pdata = pdev->dev.platform_data; - - if (brcmfmac_sdio_pdata->power_on) - brcmfmac_sdio_pdata->power_on(); - - return 0; -} - -static int brcmf_sdio_pd_remove(struct platform_device *pdev) -{ - brcmf_dbg(SDIO, "Enter\n"); - - if (brcmfmac_sdio_pdata->power_off) - brcmfmac_sdio_pdata->power_off(); - - sdio_unregister_driver(&brcmf_sdmmc_driver); - - return 0; -} - -static struct platform_driver brcmf_sdio_pd = { - .remove = brcmf_sdio_pd_remove, - .driver = { - .name = BRCMFMAC_SDIO_PDATA_NAME - } -}; - -void brcmf_sdio_register(void) -{ - int ret; - - ret = sdio_register_driver(&brcmf_sdmmc_driver); - if (ret) - brcmf_err("sdio_register_driver failed: %d\n", ret); -} - -void brcmf_sdio_exit(void) -{ - brcmf_dbg(SDIO, "Enter\n"); - - if (brcmfmac_sdio_pdata) - platform_driver_unregister(&brcmf_sdio_pd); - else - sdio_unregister_driver(&brcmf_sdmmc_driver); -} - -void __init brcmf_sdio_init(void) -{ - int ret; - - brcmf_dbg(SDIO, "Enter\n"); - - ret = platform_driver_probe(&brcmf_sdio_pd, brcmf_sdio_pd_probe); - if (ret == -ENODEV) - brcmf_dbg(SDIO, "No platform data available.\n"); -} diff --git a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c deleted file mode 100644 index 0cb591b050b3..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c +++ /dev/null @@ -1,497 +0,0 @@ -/* - * Copyright (c) 2013 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#include -#include -#include - -#include -#include -#include -#include -#include -#include "fwil.h" -#include "fwil_types.h" -#include "btcoex.h" -#include "p2p.h" -#include "wl_cfg80211.h" - -/* T1 start SCO/eSCO priority suppression */ -#define BRCMF_BTCOEX_OPPR_WIN_TIME 2000 - -/* BT registers values during DHCP */ -#define BRCMF_BT_DHCP_REG50 0x8022 -#define BRCMF_BT_DHCP_REG51 0 -#define BRCMF_BT_DHCP_REG64 0 -#define BRCMF_BT_DHCP_REG65 0 -#define BRCMF_BT_DHCP_REG71 0 -#define BRCMF_BT_DHCP_REG66 0x2710 -#define BRCMF_BT_DHCP_REG41 0x33 -#define BRCMF_BT_DHCP_REG68 0x190 - -/* number of samples for SCO detection */ -#define BRCMF_BT_SCO_SAMPLES 12 - -/** -* enum brcmf_btcoex_state - BT coex DHCP state machine states -* @BRCMF_BT_DHCP_IDLE: DCHP is idle -* @BRCMF_BT_DHCP_START: DHCP started, wait before -* boosting wifi priority -* @BRCMF_BT_DHCP_OPPR_WIN: graceful DHCP opportunity ended, -* boost wifi priority -* @BRCMF_BT_DHCP_FLAG_FORCE_TIMEOUT: wifi priority boost end, -* restore defaults -*/ -enum brcmf_btcoex_state { - BRCMF_BT_DHCP_IDLE, - BRCMF_BT_DHCP_START, - BRCMF_BT_DHCP_OPPR_WIN, - BRCMF_BT_DHCP_FLAG_FORCE_TIMEOUT -}; - -/** - * struct brcmf_btcoex_info - BT coex related information - * @vif: interface for which request was done. - * @timer: timer for DHCP state machine - * @timeout: configured timeout. - * @timer_on: DHCP timer active - * @dhcp_done: DHCP finished before T1/T2 timer expiration - * @bt_state: DHCP state machine state - * @work: DHCP state machine work - * @cfg: driver private data for cfg80211 interface - * @reg66: saved value of btc_params 66 - * @reg41: saved value of btc_params 41 - * @reg68: saved value of btc_params 68 - * @saved_regs_part1: flag indicating regs 66,41,68 - * have been saved - * @reg51: saved value of btc_params 51 - * @reg64: saved value of btc_params 64 - * @reg65: saved value of btc_params 65 - * @reg71: saved value of btc_params 71 - * @saved_regs_part1: flag indicating regs 50,51,64,65,71 - * have been saved - */ -struct brcmf_btcoex_info { - struct brcmf_cfg80211_vif *vif; - struct timer_list timer; - u16 timeout; - bool timer_on; - bool dhcp_done; - enum brcmf_btcoex_state bt_state; - struct work_struct work; - struct brcmf_cfg80211_info *cfg; - u32 reg66; - u32 reg41; - u32 reg68; - bool saved_regs_part1; - u32 reg50; - u32 reg51; - u32 reg64; - u32 reg65; - u32 reg71; - bool saved_regs_part2; -}; - -/** - * brcmf_btcoex_params_write() - write btc_params firmware variable - * @ifp: interface - * @addr: btc_params register number - * @data: data to write - */ -static s32 brcmf_btcoex_params_write(struct brcmf_if *ifp, u32 addr, u32 data) -{ - struct { - __le32 addr; - __le32 data; - } reg_write; - - reg_write.addr = cpu_to_le32(addr); - reg_write.data = cpu_to_le32(data); - return brcmf_fil_iovar_data_set(ifp, "btc_params", - ®_write, sizeof(reg_write)); -} - -/** - * brcmf_btcoex_params_read() - read btc_params firmware variable - * @ifp: interface - * @addr: btc_params register number - * @data: read data - */ -static s32 brcmf_btcoex_params_read(struct brcmf_if *ifp, u32 addr, u32 *data) -{ - *data = addr; - - return brcmf_fil_iovar_int_get(ifp, "btc_params", data); -} - -/** - * brcmf_btcoex_boost_wifi() - control BT SCO/eSCO parameters - * @btci: BT coex info - * @trump_sco: - * true - set SCO/eSCO parameters for compatibility - * during DHCP window - * false - restore saved parameter values - * - * Enhanced BT COEX settings for eSCO compatibility during DHCP window - */ -static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci, - bool trump_sco) -{ - struct brcmf_if *ifp = btci->cfg->pub->iflist[0]; - - if (trump_sco && !btci->saved_regs_part2) { - /* this should reduce eSCO agressive - * retransmit w/o breaking it - */ - - /* save current */ - brcmf_dbg(TRACE, "new SCO/eSCO coex algo {save & override}\n"); - brcmf_btcoex_params_read(ifp, 50, &btci->reg50); - brcmf_btcoex_params_read(ifp, 51, &btci->reg51); - brcmf_btcoex_params_read(ifp, 64, &btci->reg64); - brcmf_btcoex_params_read(ifp, 65, &btci->reg65); - brcmf_btcoex_params_read(ifp, 71, &btci->reg71); - - btci->saved_regs_part2 = true; - brcmf_dbg(TRACE, - "saved bt_params[50,51,64,65,71]: 0x%x 0x%x 0x%x 0x%x 0x%x\n", - btci->reg50, btci->reg51, btci->reg64, - btci->reg65, btci->reg71); - - /* pacify the eSco */ - brcmf_btcoex_params_write(ifp, 50, BRCMF_BT_DHCP_REG50); - brcmf_btcoex_params_write(ifp, 51, BRCMF_BT_DHCP_REG51); - brcmf_btcoex_params_write(ifp, 64, BRCMF_BT_DHCP_REG64); - brcmf_btcoex_params_write(ifp, 65, BRCMF_BT_DHCP_REG65); - brcmf_btcoex_params_write(ifp, 71, BRCMF_BT_DHCP_REG71); - - } else if (btci->saved_regs_part2) { - /* restore previously saved bt params */ - brcmf_dbg(TRACE, "Do new SCO/eSCO coex algo {restore}\n"); - brcmf_btcoex_params_write(ifp, 50, btci->reg50); - brcmf_btcoex_params_write(ifp, 51, btci->reg51); - brcmf_btcoex_params_write(ifp, 64, btci->reg64); - brcmf_btcoex_params_write(ifp, 65, btci->reg65); - brcmf_btcoex_params_write(ifp, 71, btci->reg71); - - brcmf_dbg(TRACE, - "restored bt_params[50,51,64,65,71]: 0x%x 0x%x 0x%x 0x%x 0x%x\n", - btci->reg50, btci->reg51, btci->reg64, - btci->reg65, btci->reg71); - - btci->saved_regs_part2 = false; - } else { - brcmf_err("attempted to restore not saved BTCOEX params\n"); - } -} - -/** - * brcmf_btcoex_is_sco_active() - check if SCO/eSCO is active - * @ifp: interface - * - * return: true if SCO/eSCO session is active - */ -static bool brcmf_btcoex_is_sco_active(struct brcmf_if *ifp) -{ - int ioc_res = 0; - bool res = false; - int sco_id_cnt = 0; - u32 param27; - int i; - - for (i = 0; i < BRCMF_BT_SCO_SAMPLES; i++) { - ioc_res = brcmf_btcoex_params_read(ifp, 27, ¶m27); - - if (ioc_res < 0) { - brcmf_err("ioc read btc params error\n"); - break; - } - - brcmf_dbg(TRACE, "sample[%d], btc_params 27:%x\n", i, param27); - - if ((param27 & 0x6) == 2) { /* count both sco & esco */ - sco_id_cnt++; - } - - if (sco_id_cnt > 2) { - brcmf_dbg(TRACE, - "sco/esco detected, pkt id_cnt:%d samples:%d\n", - sco_id_cnt, i); - res = true; - break; - } - } - brcmf_dbg(TRACE, "exit: result=%d\n", res); - return res; -} - -/** - * btcmf_btcoex_save_part1() - save first step parameters. - */ -static void btcmf_btcoex_save_part1(struct brcmf_btcoex_info *btci) -{ - struct brcmf_if *ifp = btci->vif->ifp; - - if (!btci->saved_regs_part1) { - /* Retrieve and save original reg value */ - brcmf_btcoex_params_read(ifp, 66, &btci->reg66); - brcmf_btcoex_params_read(ifp, 41, &btci->reg41); - brcmf_btcoex_params_read(ifp, 68, &btci->reg68); - btci->saved_regs_part1 = true; - brcmf_dbg(TRACE, - "saved btc_params regs (66,41,68) 0x%x 0x%x 0x%x\n", - btci->reg66, btci->reg41, - btci->reg68); - } -} - -/** - * brcmf_btcoex_restore_part1() - restore first step parameters. - */ -static void brcmf_btcoex_restore_part1(struct brcmf_btcoex_info *btci) -{ - struct brcmf_if *ifp; - - if (btci->saved_regs_part1) { - btci->saved_regs_part1 = false; - ifp = btci->vif->ifp; - brcmf_btcoex_params_write(ifp, 66, btci->reg66); - brcmf_btcoex_params_write(ifp, 41, btci->reg41); - brcmf_btcoex_params_write(ifp, 68, btci->reg68); - brcmf_dbg(TRACE, - "restored btc_params regs {66,41,68} 0x%x 0x%x 0x%x\n", - btci->reg66, btci->reg41, - btci->reg68); - } -} - -/** - * brcmf_btcoex_timerfunc() - BT coex timer callback - */ -static void brcmf_btcoex_timerfunc(ulong data) -{ - struct brcmf_btcoex_info *bt_local = (struct brcmf_btcoex_info *)data; - brcmf_dbg(TRACE, "enter\n"); - - bt_local->timer_on = false; - schedule_work(&bt_local->work); -} - -/** - * brcmf_btcoex_handler() - BT coex state machine work handler - * @work: work - */ -static void brcmf_btcoex_handler(struct work_struct *work) -{ - struct brcmf_btcoex_info *btci; - btci = container_of(work, struct brcmf_btcoex_info, work); - if (btci->timer_on) { - btci->timer_on = false; - del_timer_sync(&btci->timer); - } - - switch (btci->bt_state) { - case BRCMF_BT_DHCP_START: - /* DHCP started provide OPPORTUNITY window - to get DHCP address - */ - brcmf_dbg(TRACE, "DHCP started\n"); - btci->bt_state = BRCMF_BT_DHCP_OPPR_WIN; - if (btci->timeout < BRCMF_BTCOEX_OPPR_WIN_TIME) { - mod_timer(&btci->timer, btci->timer.expires); - } else { - btci->timeout -= BRCMF_BTCOEX_OPPR_WIN_TIME; - mod_timer(&btci->timer, - jiffies + - msecs_to_jiffies(BRCMF_BTCOEX_OPPR_WIN_TIME)); - } - btci->timer_on = true; - break; - - case BRCMF_BT_DHCP_OPPR_WIN: - if (btci->dhcp_done) { - brcmf_dbg(TRACE, "DHCP done before T1 expiration\n"); - goto idle; - } - - /* DHCP is not over yet, start lowering BT priority */ - brcmf_dbg(TRACE, "DHCP T1:%d expired\n", - BRCMF_BTCOEX_OPPR_WIN_TIME); - brcmf_btcoex_boost_wifi(btci, true); - - btci->bt_state = BRCMF_BT_DHCP_FLAG_FORCE_TIMEOUT; - mod_timer(&btci->timer, - jiffies + msecs_to_jiffies(btci->timeout)); - btci->timer_on = true; - break; - - case BRCMF_BT_DHCP_FLAG_FORCE_TIMEOUT: - if (btci->dhcp_done) - brcmf_dbg(TRACE, "DHCP done before T2 expiration\n"); - else - brcmf_dbg(TRACE, "DHCP T2:%d expired\n", - BRCMF_BT_DHCP_FLAG_FORCE_TIMEOUT); - - goto idle; - - default: - brcmf_err("invalid state=%d !!!\n", btci->bt_state); - goto idle; - } - - return; - -idle: - btci->bt_state = BRCMF_BT_DHCP_IDLE; - btci->timer_on = false; - brcmf_btcoex_boost_wifi(btci, false); - cfg80211_crit_proto_stopped(&btci->vif->wdev, GFP_KERNEL); - brcmf_btcoex_restore_part1(btci); - btci->vif = NULL; -} - -/** - * brcmf_btcoex_attach() - initialize BT coex data - * @cfg: driver private cfg80211 data - * - * return: 0 on success - */ -int brcmf_btcoex_attach(struct brcmf_cfg80211_info *cfg) -{ - struct brcmf_btcoex_info *btci = NULL; - brcmf_dbg(TRACE, "enter\n"); - - btci = kmalloc(sizeof(struct brcmf_btcoex_info), GFP_KERNEL); - if (!btci) - return -ENOMEM; - - btci->bt_state = BRCMF_BT_DHCP_IDLE; - - /* Set up timer for BT */ - btci->timer_on = false; - btci->timeout = BRCMF_BTCOEX_OPPR_WIN_TIME; - init_timer(&btci->timer); - btci->timer.data = (ulong)btci; - btci->timer.function = brcmf_btcoex_timerfunc; - btci->cfg = cfg; - btci->saved_regs_part1 = false; - btci->saved_regs_part2 = false; - - INIT_WORK(&btci->work, brcmf_btcoex_handler); - - cfg->btcoex = btci; - return 0; -} - -/** - * brcmf_btcoex_detach - clean BT coex data - * @cfg: driver private cfg80211 data - */ -void brcmf_btcoex_detach(struct brcmf_cfg80211_info *cfg) -{ - brcmf_dbg(TRACE, "enter\n"); - - if (!cfg->btcoex) - return; - - if (cfg->btcoex->timer_on) { - cfg->btcoex->timer_on = false; - del_timer_sync(&cfg->btcoex->timer); - } - - cancel_work_sync(&cfg->btcoex->work); - - brcmf_btcoex_boost_wifi(cfg->btcoex, false); - brcmf_btcoex_restore_part1(cfg->btcoex); - - kfree(cfg->btcoex); - cfg->btcoex = NULL; -} - -static void brcmf_btcoex_dhcp_start(struct brcmf_btcoex_info *btci) -{ - struct brcmf_if *ifp = btci->vif->ifp; - - btcmf_btcoex_save_part1(btci); - /* set new regs values */ - brcmf_btcoex_params_write(ifp, 66, BRCMF_BT_DHCP_REG66); - brcmf_btcoex_params_write(ifp, 41, BRCMF_BT_DHCP_REG41); - brcmf_btcoex_params_write(ifp, 68, BRCMF_BT_DHCP_REG68); - btci->dhcp_done = false; - btci->bt_state = BRCMF_BT_DHCP_START; - schedule_work(&btci->work); - brcmf_dbg(TRACE, "enable BT DHCP Timer\n"); -} - -static void brcmf_btcoex_dhcp_end(struct brcmf_btcoex_info *btci) -{ - /* Stop any bt timer because DHCP session is done */ - btci->dhcp_done = true; - if (btci->timer_on) { - brcmf_dbg(TRACE, "disable BT DHCP Timer\n"); - btci->timer_on = false; - del_timer_sync(&btci->timer); - - /* schedule worker if transition to IDLE is needed */ - if (btci->bt_state != BRCMF_BT_DHCP_IDLE) { - brcmf_dbg(TRACE, "bt_state:%d\n", - btci->bt_state); - schedule_work(&btci->work); - } - } else { - /* Restore original values */ - brcmf_btcoex_restore_part1(btci); - } -} - -/** - * brcmf_btcoex_set_mode - set BT coex mode - * @cfg: driver private cfg80211 data - * @mode: Wifi-Bluetooth coexistence mode - * - * return: 0 on success - */ -int brcmf_btcoex_set_mode(struct brcmf_cfg80211_vif *vif, - enum brcmf_btcoex_mode mode, u16 duration) -{ - struct brcmf_cfg80211_info *cfg = wiphy_priv(vif->wdev.wiphy); - struct brcmf_btcoex_info *btci = cfg->btcoex; - struct brcmf_if *ifp = cfg->pub->iflist[0]; - - switch (mode) { - case BRCMF_BTCOEX_DISABLED: - brcmf_dbg(TRACE, "DHCP session starts\n"); - if (btci->bt_state != BRCMF_BT_DHCP_IDLE) - return -EBUSY; - /* Start BT timer only for SCO connection */ - if (brcmf_btcoex_is_sco_active(ifp)) { - btci->timeout = duration; - btci->vif = vif; - brcmf_btcoex_dhcp_start(btci); - } - break; - - case BRCMF_BTCOEX_ENABLED: - brcmf_dbg(TRACE, "DHCP session ends\n"); - if (btci->bt_state != BRCMF_BT_DHCP_IDLE && - vif == btci->vif) { - brcmf_btcoex_dhcp_end(btci); - } - break; - default: - brcmf_dbg(TRACE, "Unknown mode, ignored\n"); - } - return 0; -} diff --git a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.h b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.h deleted file mode 100644 index 19647c68aa9e..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2013 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef WL_BTCOEX_H_ -#define WL_BTCOEX_H_ - -enum brcmf_btcoex_mode { - BRCMF_BTCOEX_DISABLED, - BRCMF_BTCOEX_ENABLED -}; - -int brcmf_btcoex_attach(struct brcmf_cfg80211_info *cfg); -void brcmf_btcoex_detach(struct brcmf_cfg80211_info *cfg); -int brcmf_btcoex_set_mode(struct brcmf_cfg80211_vif *vif, - enum brcmf_btcoex_mode mode, u16 duration); - -#endif /* WL_BTCOEX_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h deleted file mode 100644 index 28db9cf39672..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h +++ /dev/null @@ -1,631 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/**************** - * Common types * - */ - -#ifndef _BRCMF_H_ -#define _BRCMF_H_ - -#define BRCMF_VERSION_STR "4.218.248.5" - -#include "fweh.h" - -/******************************************************************************* - * IO codes that are interpreted by dongle firmware - ******************************************************************************/ -#define BRCMF_C_GET_VERSION 1 -#define BRCMF_C_UP 2 -#define BRCMF_C_DOWN 3 -#define BRCMF_C_SET_PROMISC 10 -#define BRCMF_C_GET_RATE 12 -#define BRCMF_C_GET_INFRA 19 -#define BRCMF_C_SET_INFRA 20 -#define BRCMF_C_GET_AUTH 21 -#define BRCMF_C_SET_AUTH 22 -#define BRCMF_C_GET_BSSID 23 -#define BRCMF_C_GET_SSID 25 -#define BRCMF_C_SET_SSID 26 -#define BRCMF_C_TERMINATED 28 -#define BRCMF_C_GET_CHANNEL 29 -#define BRCMF_C_SET_CHANNEL 30 -#define BRCMF_C_GET_SRL 31 -#define BRCMF_C_SET_SRL 32 -#define BRCMF_C_GET_LRL 33 -#define BRCMF_C_SET_LRL 34 -#define BRCMF_C_GET_RADIO 37 -#define BRCMF_C_SET_RADIO 38 -#define BRCMF_C_GET_PHYTYPE 39 -#define BRCMF_C_SET_KEY 45 -#define BRCMF_C_SET_PASSIVE_SCAN 49 -#define BRCMF_C_SCAN 50 -#define BRCMF_C_SCAN_RESULTS 51 -#define BRCMF_C_DISASSOC 52 -#define BRCMF_C_REASSOC 53 -#define BRCMF_C_SET_ROAM_TRIGGER 55 -#define BRCMF_C_SET_ROAM_DELTA 57 -#define BRCMF_C_GET_BCNPRD 75 -#define BRCMF_C_SET_BCNPRD 76 -#define BRCMF_C_GET_DTIMPRD 77 -#define BRCMF_C_SET_DTIMPRD 78 -#define BRCMF_C_SET_COUNTRY 84 -#define BRCMF_C_GET_PM 85 -#define BRCMF_C_SET_PM 86 -#define BRCMF_C_GET_CURR_RATESET 114 -#define BRCMF_C_GET_AP 117 -#define BRCMF_C_SET_AP 118 -#define BRCMF_C_GET_RSSI 127 -#define BRCMF_C_GET_WSEC 133 -#define BRCMF_C_SET_WSEC 134 -#define BRCMF_C_GET_PHY_NOISE 135 -#define BRCMF_C_GET_BSS_INFO 136 -#define BRCMF_C_GET_BANDLIST 140 -#define BRCMF_C_SET_SCB_TIMEOUT 158 -#define BRCMF_C_GET_PHYLIST 180 -#define BRCMF_C_SET_SCAN_CHANNEL_TIME 185 -#define BRCMF_C_SET_SCAN_UNASSOC_TIME 187 -#define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201 -#define BRCMF_C_GET_VALID_CHANNELS 217 -#define BRCMF_C_GET_KEY_PRIMARY 235 -#define BRCMF_C_SET_KEY_PRIMARY 236 -#define BRCMF_C_SET_SCAN_PASSIVE_TIME 258 -#define BRCMF_C_GET_VAR 262 -#define BRCMF_C_SET_VAR 263 - -/* phy types (returned by WLC_GET_PHYTPE) */ -#define WLC_PHY_TYPE_A 0 -#define WLC_PHY_TYPE_B 1 -#define WLC_PHY_TYPE_G 2 -#define WLC_PHY_TYPE_N 4 -#define WLC_PHY_TYPE_LP 5 -#define WLC_PHY_TYPE_SSN 6 -#define WLC_PHY_TYPE_HT 7 -#define WLC_PHY_TYPE_LCN 8 -#define WLC_PHY_TYPE_NULL 0xf - -#define BRCMF_EVENTING_MASK_LEN 16 - -#define TOE_TX_CSUM_OL 0x00000001 -#define TOE_RX_CSUM_OL 0x00000002 - -#define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */ - -/* size of brcmf_scan_params not including variable length array */ -#define BRCMF_SCAN_PARAMS_FIXED_SIZE 64 - -/* masks for channel and ssid count */ -#define BRCMF_SCAN_PARAMS_COUNT_MASK 0x0000ffff -#define BRCMF_SCAN_PARAMS_NSSID_SHIFT 16 - -/* primary (ie tx) key */ -#define BRCMF_PRIMARY_KEY (1 << 1) - -/* For supporting multiple interfaces */ -#define BRCMF_MAX_IFS 16 - -#define DOT11_BSSTYPE_ANY 2 -#define DOT11_MAX_DEFAULT_KEYS 4 - -#define BRCMF_ESCAN_REQ_VERSION 1 - -#define WLC_BSS_RSSI_ON_CHANNEL 0x0002 - -#define BRCMF_MAXRATES_IN_SET 16 /* max # of rates in rateset */ -#define BRCMF_STA_ASSOC 0x10 /* Associated */ - -#define BRCMF_E_STATUS_SUCCESS 0 -#define BRCMF_E_STATUS_FAIL 1 -#define BRCMF_E_STATUS_TIMEOUT 2 -#define BRCMF_E_STATUS_NO_NETWORKS 3 -#define BRCMF_E_STATUS_ABORT 4 -#define BRCMF_E_STATUS_NO_ACK 5 -#define BRCMF_E_STATUS_UNSOLICITED 6 -#define BRCMF_E_STATUS_ATTEMPT 7 -#define BRCMF_E_STATUS_PARTIAL 8 -#define BRCMF_E_STATUS_NEWSCAN 9 -#define BRCMF_E_STATUS_NEWASSOC 10 -#define BRCMF_E_STATUS_11HQUIET 11 -#define BRCMF_E_STATUS_SUPPRESS 12 -#define BRCMF_E_STATUS_NOCHANS 13 -#define BRCMF_E_STATUS_CS_ABORT 15 -#define BRCMF_E_STATUS_ERROR 16 - -#define BRCMF_E_REASON_INITIAL_ASSOC 0 -#define BRCMF_E_REASON_LOW_RSSI 1 -#define BRCMF_E_REASON_DEAUTH 2 -#define BRCMF_E_REASON_DISASSOC 3 -#define BRCMF_E_REASON_BCNS_LOST 4 -#define BRCMF_E_REASON_MINTXRATE 9 -#define BRCMF_E_REASON_TXFAIL 10 - -#define BRCMF_E_REASON_LINK_BSSCFG_DIS 4 -#define BRCMF_E_REASON_FAST_ROAM_FAILED 5 -#define BRCMF_E_REASON_DIRECTED_ROAM 6 -#define BRCMF_E_REASON_TSPEC_REJECTED 7 -#define BRCMF_E_REASON_BETTER_AP 8 - -#define BRCMF_E_PRUNE_ENCR_MISMATCH 1 -#define BRCMF_E_PRUNE_BCAST_BSSID 2 -#define BRCMF_E_PRUNE_MAC_DENY 3 -#define BRCMF_E_PRUNE_MAC_NA 4 -#define BRCMF_E_PRUNE_REG_PASSV 5 -#define BRCMF_E_PRUNE_SPCT_MGMT 6 -#define BRCMF_E_PRUNE_RADAR 7 -#define BRCMF_E_RSN_MISMATCH 8 -#define BRCMF_E_PRUNE_NO_COMMON_RATES 9 -#define BRCMF_E_PRUNE_BASIC_RATES 10 -#define BRCMF_E_PRUNE_CIPHER_NA 12 -#define BRCMF_E_PRUNE_KNOWN_STA 13 -#define BRCMF_E_PRUNE_WDS_PEER 15 -#define BRCMF_E_PRUNE_QBSS_LOAD 16 -#define BRCMF_E_PRUNE_HOME_AP 17 - -#define BRCMF_E_SUP_OTHER 0 -#define BRCMF_E_SUP_DECRYPT_KEY_DATA 1 -#define BRCMF_E_SUP_BAD_UCAST_WEP128 2 -#define BRCMF_E_SUP_BAD_UCAST_WEP40 3 -#define BRCMF_E_SUP_UNSUP_KEY_LEN 4 -#define BRCMF_E_SUP_PW_KEY_CIPHER 5 -#define BRCMF_E_SUP_MSG3_TOO_MANY_IE 6 -#define BRCMF_E_SUP_MSG3_IE_MISMATCH 7 -#define BRCMF_E_SUP_NO_INSTALL_FLAG 8 -#define BRCMF_E_SUP_MSG3_NO_GTK 9 -#define BRCMF_E_SUP_GRP_KEY_CIPHER 10 -#define BRCMF_E_SUP_GRP_MSG1_NO_GTK 11 -#define BRCMF_E_SUP_GTK_DECRYPT_FAIL 12 -#define BRCMF_E_SUP_SEND_FAIL 13 -#define BRCMF_E_SUP_DEAUTH 14 - -#define BRCMF_E_IF_ADD 1 -#define BRCMF_E_IF_DEL 2 -#define BRCMF_E_IF_CHANGE 3 - -#define BRCMF_E_IF_ROLE_STA 0 -#define BRCMF_E_IF_ROLE_AP 1 -#define BRCMF_E_IF_ROLE_WDS 2 - -#define BRCMF_E_LINK_BCN_LOSS 1 -#define BRCMF_E_LINK_DISASSOC 2 -#define BRCMF_E_LINK_ASSOC_REC 3 -#define BRCMF_E_LINK_BSSCFG_DIS 4 - -/* Small, medium and maximum buffer size for dcmd - */ -#define BRCMF_DCMD_SMLEN 256 -#define BRCMF_DCMD_MEDLEN 1536 -#define BRCMF_DCMD_MAXLEN 8192 - -/* Pattern matching filter. Specifies an offset within received packets to - * start matching, the pattern to match, the size of the pattern, and a bitmask - * that indicates which bits within the pattern should be matched. - */ -struct brcmf_pkt_filter_pattern_le { - /* - * Offset within received packet to start pattern matching. - * Offset '0' is the first byte of the ethernet header. - */ - __le32 offset; - /* Size of the pattern. Bitmask must be the same size.*/ - __le32 size_bytes; - /* - * Variable length mask and pattern data. mask starts at offset 0. - * Pattern immediately follows mask. - */ - u8 mask_and_pattern[1]; -}; - -/* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */ -struct brcmf_pkt_filter_le { - __le32 id; /* Unique filter id, specified by app. */ - __le32 type; /* Filter type (WL_PKT_FILTER_TYPE_xxx). */ - __le32 negate_match; /* Negate the result of filter matches */ - union { /* Filter definitions */ - struct brcmf_pkt_filter_pattern_le pattern; /* Filter pattern */ - } u; -}; - -/* IOVAR "pkt_filter_enable" parameter. */ -struct brcmf_pkt_filter_enable_le { - __le32 id; /* Unique filter id */ - __le32 enable; /* Enable/disable bool */ -}; - -/* BSS info structure - * Applications MUST CHECK ie_offset field and length field to access IEs and - * next bss_info structure in a vector (in struct brcmf_scan_results) - */ -struct brcmf_bss_info_le { - __le32 version; /* version field */ - __le32 length; /* byte length of data in this record, - * starting at version and including IEs - */ - u8 BSSID[ETH_ALEN]; - __le16 beacon_period; /* units are Kusec */ - __le16 capability; /* Capability information */ - u8 SSID_len; - u8 SSID[32]; - struct { - __le32 count; /* # rates in this set */ - u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */ - } rateset; /* supported rates */ - __le16 chanspec; /* chanspec for bss */ - __le16 atim_window; /* units are Kusec */ - u8 dtim_period; /* DTIM period */ - __le16 RSSI; /* receive signal strength (in dBm) */ - s8 phy_noise; /* noise (in dBm) */ - - u8 n_cap; /* BSS is 802.11N Capable */ - /* 802.11N BSS Capabilities (based on HT_CAP_*): */ - __le32 nbss_cap; - u8 ctl_ch; /* 802.11N BSS control channel number */ - __le32 reserved32[1]; /* Reserved for expansion of BSS properties */ - u8 flags; /* flags */ - u8 reserved[3]; /* Reserved for expansion of BSS properties */ - u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */ - - __le16 ie_offset; /* offset at which IEs start, from beginning */ - __le32 ie_length; /* byte length of Information Elements */ - __le16 SNR; /* average SNR of during frame reception */ - /* Add new fields here */ - /* variable length Information Elements */ -}; - -struct brcm_rateset_le { - /* # rates in this set */ - __le32 count; - /* rates in 500kbps units w/hi bit set if basic */ - u8 rates[BRCMF_MAXRATES_IN_SET]; -}; - -struct brcmf_ssid { - u32 SSID_len; - unsigned char SSID[32]; -}; - -struct brcmf_ssid_le { - __le32 SSID_len; - unsigned char SSID[32]; -}; - -struct brcmf_scan_params_le { - struct brcmf_ssid_le ssid_le; /* default: {0, ""} */ - u8 bssid[ETH_ALEN]; /* default: bcast */ - s8 bss_type; /* default: any, - * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT - */ - u8 scan_type; /* flags, 0 use default */ - __le32 nprobes; /* -1 use default, number of probes per channel */ - __le32 active_time; /* -1 use default, dwell time per channel for - * active scanning - */ - __le32 passive_time; /* -1 use default, dwell time per channel - * for passive scanning - */ - __le32 home_time; /* -1 use default, dwell time for the - * home channel between channel scans - */ - __le32 channel_num; /* count of channels and ssids that follow - * - * low half is count of channels in - * channel_list, 0 means default (use all - * available channels) - * - * high half is entries in struct brcmf_ssid - * array that follows channel_list, aligned for - * s32 (4 bytes) meaning an odd channel count - * implies a 2-byte pad between end of - * channel_list and first ssid - * - * if ssid count is zero, single ssid in the - * fixed parameter portion is assumed, otherwise - * ssid in the fixed portion is ignored - */ - __le16 channel_list[1]; /* list of chanspecs */ -}; - -struct brcmf_scan_results { - u32 buflen; - u32 version; - u32 count; - struct brcmf_bss_info_le bss_info_le[]; -}; - -struct brcmf_escan_params_le { - __le32 version; - __le16 action; - __le16 sync_id; - struct brcmf_scan_params_le params_le; -}; - -struct brcmf_escan_result_le { - __le32 buflen; - __le32 version; - __le16 sync_id; - __le16 bss_count; - struct brcmf_bss_info_le bss_info_le; -}; - -#define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(struct brcmf_escan_result_le) - \ - sizeof(struct brcmf_bss_info_le)) - -/* used for association with a specific BSSID and chanspec list */ -struct brcmf_assoc_params_le { - /* 00:00:00:00:00:00: broadcast scan */ - u8 bssid[ETH_ALEN]; - /* 0: all available channels, otherwise count of chanspecs in - * chanspec_list */ - __le32 chanspec_num; - /* list of chanspecs */ - __le16 chanspec_list[1]; -}; - -/* used for join with or without a specific bssid and channel list */ -struct brcmf_join_params { - struct brcmf_ssid_le ssid_le; - struct brcmf_assoc_params_le params_le; -}; - -/* scan params for extended join */ -struct brcmf_join_scan_params_le { - u8 scan_type; /* 0 use default, active or passive scan */ - __le32 nprobes; /* -1 use default, nr of probes per channel */ - __le32 active_time; /* -1 use default, dwell time per channel for - * active scanning - */ - __le32 passive_time; /* -1 use default, dwell time per channel - * for passive scanning - */ - __le32 home_time; /* -1 use default, dwell time for the home - * channel between channel scans - */ -}; - -/* extended join params */ -struct brcmf_ext_join_params_le { - struct brcmf_ssid_le ssid_le; /* {0, ""}: wildcard scan */ - struct brcmf_join_scan_params_le scan_le; - struct brcmf_assoc_params_le assoc_le; -}; - -struct brcmf_wsec_key { - u32 index; /* key index */ - u32 len; /* key length */ - u8 data[WLAN_MAX_KEY_LEN]; /* key data */ - u32 pad_1[18]; - u32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ - u32 flags; /* misc flags */ - u32 pad_2[3]; - u32 iv_initialized; /* has IV been initialized already? */ - u32 pad_3; - /* Rx IV */ - struct { - u32 hi; /* upper 32 bits of IV */ - u16 lo; /* lower 16 bits of IV */ - } rxiv; - u32 pad_4[2]; - u8 ea[ETH_ALEN]; /* per station */ -}; - -/* - * dongle requires same struct as above but with fields in little endian order - */ -struct brcmf_wsec_key_le { - __le32 index; /* key index */ - __le32 len; /* key length */ - u8 data[WLAN_MAX_KEY_LEN]; /* key data */ - __le32 pad_1[18]; - __le32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ - __le32 flags; /* misc flags */ - __le32 pad_2[3]; - __le32 iv_initialized; /* has IV been initialized already? */ - __le32 pad_3; - /* Rx IV */ - struct { - __le32 hi; /* upper 32 bits of IV */ - __le16 lo; /* lower 16 bits of IV */ - } rxiv; - __le32 pad_4[2]; - u8 ea[ETH_ALEN]; /* per station */ -}; - -/* Used to get specific STA parameters */ -struct brcmf_scb_val_le { - __le32 val; - u8 ea[ETH_ALEN]; -}; - -/* channel encoding */ -struct brcmf_channel_info_le { - __le32 hw_channel; - __le32 target_channel; - __le32 scan_channel; -}; - -struct brcmf_sta_info_le { - __le16 ver; /* version of this struct */ - __le16 len; /* length in bytes of this structure */ - __le16 cap; /* sta's advertised capabilities */ - __le32 flags; /* flags defined below */ - __le32 idle; /* time since data pkt rx'd from sta */ - u8 ea[ETH_ALEN]; /* Station address */ - __le32 count; /* # rates in this set */ - u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */ - /* w/hi bit set if basic */ - __le32 in; /* seconds elapsed since associated */ - __le32 listen_interval_inms; /* Min Listen interval in ms for STA */ - __le32 tx_pkts; /* # of packets transmitted */ - __le32 tx_failures; /* # of packets failed */ - __le32 rx_ucast_pkts; /* # of unicast packets received */ - __le32 rx_mcast_pkts; /* # of multicast packets received */ - __le32 tx_rate; /* Rate of last successful tx frame */ - __le32 rx_rate; /* Rate of last successful rx frame */ - __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */ - __le32 rx_decrypt_failures; /* # of packet decrypted failed */ -}; - -struct brcmf_chanspec_list { - __le32 count; /* # of entries */ - __le32 element[1]; /* variable length uint32 list */ -}; - -/* - * WLC_E_PROBRESP_MSG - * WLC_E_P2P_PROBREQ_MSG - * WLC_E_ACTION_FRAME_RX - */ -struct brcmf_rx_mgmt_data { - __be16 version; - __be16 chanspec; - __be32 rssi; - __be32 mactime; - __be32 rate; -}; - -/* Bus independent dongle command */ -struct brcmf_dcmd { - uint cmd; /* common dongle cmd definition */ - void *buf; /* pointer to user buffer */ - uint len; /* length of user buffer */ - u8 set; /* get or set request (optional) */ - uint used; /* bytes read or written (optional) */ - uint needed; /* bytes needed (optional) */ -}; - -/* Forward decls for struct brcmf_pub (see below) */ -struct brcmf_proto; /* device communication protocol info */ -struct brcmf_cfg80211_dev; /* cfg80211 device info */ -struct brcmf_fws_info; /* firmware signalling info */ - -/* Common structure for module and instance linkage */ -struct brcmf_pub { - /* Linkage ponters */ - struct brcmf_bus *bus_if; - struct brcmf_proto *prot; - struct brcmf_cfg80211_info *config; - - /* Internal brcmf items */ - uint hdrlen; /* Total BRCMF header length (proto + bus) */ - uint rxsz; /* Rx buffer size bus module should use */ - u8 wme_dp; /* wme discard priority */ - - /* Dongle media info */ - unsigned long drv_version; /* Version of dongle-resident driver */ - u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */ - - /* Multicast data packets sent to dongle */ - unsigned long tx_multicast; - - struct brcmf_if *iflist[BRCMF_MAX_IFS]; - - struct mutex proto_block; - unsigned char proto_buf[BRCMF_DCMD_MAXLEN]; - - struct brcmf_fweh_info fweh; - - bool fw_signals; - struct brcmf_fws_info *fws; - spinlock_t fws_spinlock; -#ifdef DEBUG - struct dentry *dbgfs_dir; -#endif -}; - -struct brcmf_if_event { - u8 ifidx; - u8 action; - u8 flags; - u8 bssidx; - u8 role; -}; - -/* forward declarations */ -struct brcmf_cfg80211_vif; -struct brcmf_fws_mac_descriptor; - -/** - * enum brcmf_netif_stop_reason - reason for stopping netif queue. - * - * @BRCMF_NETIF_STOP_REASON_FWS_FC: - * netif stopped due to firmware signalling flow control. - * @BRCMF_NETIF_STOP_REASON_BLOCK_BUS: - * netif stopped due to bus blocking. - */ -enum brcmf_netif_stop_reason { - BRCMF_NETIF_STOP_REASON_FWS_FC = 1, - BRCMF_NETIF_STOP_REASON_BLOCK_BUS = 2 -}; - -/** - * struct brcmf_if - interface control information. - * - * @drvr: points to device related information. - * @vif: points to cfg80211 specific interface information. - * @ndev: associated network device. - * @stats: interface specific network statistics. - * @setmacaddr_work: worker object for setting mac address. - * @multicast_work: worker object for multicast provisioning. - * @fws_desc: interface specific firmware-signalling descriptor. - * @ifidx: interface index in device firmware. - * @bssidx: index of bss associated with this interface. - * @mac_addr: assigned mac address. - * @netif_stop: bitmap indicates reason why netif queues are stopped. - * @pend_8021x_cnt: tracks outstanding number of 802.1x frames. - * @pend_8021x_wait: used for signalling change in count. - */ -struct brcmf_if { - struct brcmf_pub *drvr; - struct brcmf_cfg80211_vif *vif; - struct net_device *ndev; - struct net_device_stats stats; - struct work_struct setmacaddr_work; - struct work_struct multicast_work; - struct brcmf_fws_mac_descriptor *fws_desc; - int ifidx; - s32 bssidx; - u8 mac_addr[ETH_ALEN]; - u8 netif_stop; - atomic_t pend_8021x_cnt; - wait_queue_head_t pend_8021x_wait; -}; - - -extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev); - -/* Return pointer to interface name */ -extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx); - -/* Query dongle */ -extern int brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, - uint cmd, void *buf, uint len); -extern int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, - void *buf, uint len); - -/* Remove any protocol-specific data header. */ -extern int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx, - struct sk_buff *rxp); - -extern int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked); -extern struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, - s32 ifidx, char *name, u8 *mac_addr); -extern void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx); -void brcmf_txflowblock_if(struct brcmf_if *ifp, - enum brcmf_netif_stop_reason reason, bool state); -extern u32 brcmf_get_chip_info(struct brcmf_if *ifp); -extern void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, - bool success); - -#endif /* _BRCMF_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h deleted file mode 100644 index e715d3396c2c..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCMF_BUS_H_ -#define _BRCMF_BUS_H_ - -/* The level of bus communication with the dongle */ -enum brcmf_bus_state { - BRCMF_BUS_DOWN, /* Not ready for frame transfers */ - BRCMF_BUS_LOAD, /* Download access only (CPU reset) */ - BRCMF_BUS_DATA /* Ready for frame transfers */ -}; - -struct brcmf_bus_dcmd { - char *name; - char *param; - int param_len; - struct list_head list; -}; - -/** - * struct brcmf_bus_ops - bus callback operations. - * - * @init: prepare for communication with dongle. - * @stop: clear pending frames, disable data flow. - * @txdata: send a data frame to the dongle (callee disposes skb). - * @txctl: transmit a control request message to dongle. - * @rxctl: receive a control response message from dongle. - * @gettxq: obtain a reference of bus transmit queue (optional). - * - * This structure provides an abstract interface towards the - * bus specific driver. For control messages to common driver - * will assure there is only one active transaction. Unless - * indicated otherwise these callbacks are mandatory. - */ -struct brcmf_bus_ops { - int (*init)(struct device *dev); - void (*stop)(struct device *dev); - int (*txdata)(struct device *dev, struct sk_buff *skb); - int (*txctl)(struct device *dev, unsigned char *msg, uint len); - int (*rxctl)(struct device *dev, unsigned char *msg, uint len); - struct pktq * (*gettxq)(struct device *dev); -}; - -/** - * struct brcmf_bus - interface structure between common and bus layer - * - * @bus_priv: pointer to private bus device. - * @dev: device pointer of bus device. - * @drvr: public driver information. - * @state: operational state of the bus interface. - * @maxctl: maximum size for rxctl request message. - * @tx_realloc: number of tx packets realloced for headroom. - * @dstats: dongle-based statistical data. - * @align: alignment requirement for the bus. - * @dcmd_list: bus/device specific dongle initialization commands. - * @chip: device identifier of the dongle chip. - * @chiprev: revision of the dongle chip. - */ -struct brcmf_bus { - union { - struct brcmf_sdio_dev *sdio; - struct brcmf_usbdev *usb; - } bus_priv; - struct device *dev; - struct brcmf_pub *drvr; - enum brcmf_bus_state state; - uint maxctl; - unsigned long tx_realloc; - u8 align; - u32 chip; - u32 chiprev; - struct list_head dcmd_list; - - struct brcmf_bus_ops *ops; -}; - -/* - * callback wrappers - */ -static inline int brcmf_bus_init(struct brcmf_bus *bus) -{ - return bus->ops->init(bus->dev); -} - -static inline void brcmf_bus_stop(struct brcmf_bus *bus) -{ - bus->ops->stop(bus->dev); -} - -static inline int brcmf_bus_txdata(struct brcmf_bus *bus, struct sk_buff *skb) -{ - return bus->ops->txdata(bus->dev, skb); -} - -static inline -int brcmf_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint len) -{ - return bus->ops->txctl(bus->dev, msg, len); -} - -static inline -int brcmf_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint len) -{ - return bus->ops->rxctl(bus->dev, msg, len); -} - -static inline -struct pktq *brcmf_bus_gettxq(struct brcmf_bus *bus) -{ - if (!bus->ops->gettxq) - return ERR_PTR(-ENOENT); - - return bus->ops->gettxq(bus->dev); -} -/* - * interface functions from common layer - */ - -extern bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, - struct sk_buff *pkt, int prec); - -/* Receive frame for delivery to OS. Callee disposes of rxp. */ -extern void brcmf_rx_frames(struct device *dev, struct sk_buff_head *rxlist); - -/* Indication from bus module regarding presence/insertion of dongle. */ -extern int brcmf_attach(uint bus_hdrlen, struct device *dev); -/* Indication from bus module regarding removal/absence of dongle */ -extern void brcmf_detach(struct device *dev); -/* Indication from bus module that dongle should be reset */ -extern void brcmf_dev_reset(struct device *dev); -/* Indication from bus module to change flow-control state */ -extern void brcmf_txflowblock(struct device *dev, bool state); - -/* Notify the bus has transferred the tx packet to firmware */ -extern void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, - bool success); - -extern int brcmf_bus_start(struct device *dev); - -#ifdef CONFIG_BRCMFMAC_SDIO -extern void brcmf_sdio_exit(void); -extern void brcmf_sdio_init(void); -extern void brcmf_sdio_register(void); -#endif -#ifdef CONFIG_BRCMFMAC_USB -extern void brcmf_usb_exit(void); -extern void brcmf_usb_register(void); -#endif - -#endif /* _BRCMF_BUS_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c deleted file mode 100644 index 59c77aa3b959..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/******************************************************************************* - * Communicates with the dongle by using dcmd codes. - * For certain dcmd codes, the dongle interprets string data from the host. - ******************************************************************************/ - -#include -#include - -#include -#include - -#include "dhd.h" -#include "dhd_proto.h" -#include "dhd_bus.h" -#include "fwsignal.h" -#include "dhd_dbg.h" - -struct brcmf_proto_cdc_dcmd { - __le32 cmd; /* dongle command value */ - __le32 len; /* lower 16: output buflen; - * upper 16: input buflen (excludes header) */ - __le32 flags; /* flag defns given below */ - __le32 status; /* status code returned from the device */ -}; - -/* Max valid buffer size that can be sent to the dongle */ -#define CDC_MAX_MSG_SIZE (ETH_FRAME_LEN+ETH_FCS_LEN) - -/* CDC flag definitions */ -#define CDC_DCMD_ERROR 0x01 /* 1=cmd failed */ -#define CDC_DCMD_SET 0x02 /* 0=get, 1=set cmd */ -#define CDC_DCMD_IF_MASK 0xF000 /* I/F index */ -#define CDC_DCMD_IF_SHIFT 12 -#define CDC_DCMD_ID_MASK 0xFFFF0000 /* id an cmd pairing */ -#define CDC_DCMD_ID_SHIFT 16 /* ID Mask shift bits */ -#define CDC_DCMD_ID(flags) \ - (((flags) & CDC_DCMD_ID_MASK) >> CDC_DCMD_ID_SHIFT) - -/* - * BDC header - Broadcom specific extension of CDC. - * Used on data packets to convey priority across USB. - */ -#define BDC_HEADER_LEN 4 -#define BDC_PROTO_VER 2 /* Protocol version */ -#define BDC_FLAG_VER_MASK 0xf0 /* Protocol version mask */ -#define BDC_FLAG_VER_SHIFT 4 /* Protocol version shift */ -#define BDC_FLAG_SUM_GOOD 0x04 /* Good RX checksums */ -#define BDC_FLAG_SUM_NEEDED 0x08 /* Dongle needs to do TX checksums */ -#define BDC_PRIORITY_MASK 0x7 -#define BDC_FLAG2_IF_MASK 0x0f /* packet rx interface in APSTA */ -#define BDC_FLAG2_IF_SHIFT 0 - -#define BDC_GET_IF_IDX(hdr) \ - ((int)((((hdr)->flags2) & BDC_FLAG2_IF_MASK) >> BDC_FLAG2_IF_SHIFT)) -#define BDC_SET_IF_IDX(hdr, idx) \ - ((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_IF_MASK) | \ - ((idx) << BDC_FLAG2_IF_SHIFT))) - -/** - * struct brcmf_proto_bdc_header - BDC header format - * - * @flags: flags contain protocol and checksum info. - * @priority: 802.1d priority and USB flow control info (bit 4:7). - * @flags2: additional flags containing dongle interface index. - * @data_offset: start of packet data. header is following by firmware signals. - */ -struct brcmf_proto_bdc_header { - u8 flags; - u8 priority; - u8 flags2; - u8 data_offset; -}; - -/* - * maximum length of firmware signal data between - * the BDC header and packet data in the tx path. - */ -#define BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES 12 - -#define RETRIES 2 /* # of retries to retrieve matching dcmd response */ -#define BUS_HEADER_LEN (16+64) /* Must be atleast SDPCM_RESERVE - * (amount of header tha might be added) - * plus any space that might be needed - * for bus alignment padding. - */ -#define ROUND_UP_MARGIN 2048 /* Biggest bus block size possible for - * round off at the end of buffer - * Currently is SDIO - */ - -struct brcmf_proto { - u16 reqid; - u8 bus_header[BUS_HEADER_LEN]; - struct brcmf_proto_cdc_dcmd msg; - unsigned char buf[BRCMF_DCMD_MAXLEN + ROUND_UP_MARGIN]; -}; - -static int brcmf_proto_cdc_msg(struct brcmf_pub *drvr) -{ - struct brcmf_proto *prot = drvr->prot; - int len = le32_to_cpu(prot->msg.len) + - sizeof(struct brcmf_proto_cdc_dcmd); - - brcmf_dbg(CDC, "Enter\n"); - - /* NOTE : cdc->msg.len holds the desired length of the buffer to be - * returned. Only up to CDC_MAX_MSG_SIZE of this buffer area - * is actually sent to the dongle - */ - if (len > CDC_MAX_MSG_SIZE) - len = CDC_MAX_MSG_SIZE; - - /* Send request */ - return brcmf_bus_txctl(drvr->bus_if, (unsigned char *)&prot->msg, len); -} - -static int brcmf_proto_cdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len) -{ - int ret; - struct brcmf_proto *prot = drvr->prot; - - brcmf_dbg(CDC, "Enter\n"); - len += sizeof(struct brcmf_proto_cdc_dcmd); - do { - ret = brcmf_bus_rxctl(drvr->bus_if, (unsigned char *)&prot->msg, - len); - if (ret < 0) - break; - } while (CDC_DCMD_ID(le32_to_cpu(prot->msg.flags)) != id); - - return ret; -} - -int -brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, - void *buf, uint len) -{ - struct brcmf_proto *prot = drvr->prot; - struct brcmf_proto_cdc_dcmd *msg = &prot->msg; - void *info; - int ret = 0, retries = 0; - u32 id, flags; - - brcmf_dbg(CDC, "Enter, cmd %d len %d\n", cmd, len); - - memset(msg, 0, sizeof(struct brcmf_proto_cdc_dcmd)); - - msg->cmd = cpu_to_le32(cmd); - msg->len = cpu_to_le32(len); - flags = (++prot->reqid << CDC_DCMD_ID_SHIFT); - flags = (flags & ~CDC_DCMD_IF_MASK) | - (ifidx << CDC_DCMD_IF_SHIFT); - msg->flags = cpu_to_le32(flags); - - if (buf) - memcpy(prot->buf, buf, len); - - ret = brcmf_proto_cdc_msg(drvr); - if (ret < 0) { - brcmf_err("brcmf_proto_cdc_msg failed w/status %d\n", - ret); - goto done; - } - -retry: - /* wait for interrupt and get first fragment */ - ret = brcmf_proto_cdc_cmplt(drvr, prot->reqid, len); - if (ret < 0) - goto done; - - flags = le32_to_cpu(msg->flags); - id = (flags & CDC_DCMD_ID_MASK) >> CDC_DCMD_ID_SHIFT; - - if ((id < prot->reqid) && (++retries < RETRIES)) - goto retry; - if (id != prot->reqid) { - brcmf_err("%s: unexpected request id %d (expected %d)\n", - brcmf_ifname(drvr, ifidx), id, prot->reqid); - ret = -EINVAL; - goto done; - } - - /* Check info buffer */ - info = (void *)&msg[1]; - - /* Copy info buffer */ - if (buf) { - if (ret < (int)len) - len = ret; - memcpy(buf, info, len); - } - - /* Check the ERROR flag */ - if (flags & CDC_DCMD_ERROR) - ret = le32_to_cpu(msg->status); - -done: - return ret; -} - -int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, - void *buf, uint len) -{ - struct brcmf_proto *prot = drvr->prot; - struct brcmf_proto_cdc_dcmd *msg = &prot->msg; - int ret = 0; - u32 flags, id; - - brcmf_dbg(CDC, "Enter, cmd %d len %d\n", cmd, len); - - memset(msg, 0, sizeof(struct brcmf_proto_cdc_dcmd)); - - msg->cmd = cpu_to_le32(cmd); - msg->len = cpu_to_le32(len); - flags = (++prot->reqid << CDC_DCMD_ID_SHIFT) | CDC_DCMD_SET; - flags = (flags & ~CDC_DCMD_IF_MASK) | - (ifidx << CDC_DCMD_IF_SHIFT); - msg->flags = cpu_to_le32(flags); - - if (buf) - memcpy(prot->buf, buf, len); - - ret = brcmf_proto_cdc_msg(drvr); - if (ret < 0) - goto done; - - ret = brcmf_proto_cdc_cmplt(drvr, prot->reqid, len); - if (ret < 0) - goto done; - - flags = le32_to_cpu(msg->flags); - id = (flags & CDC_DCMD_ID_MASK) >> CDC_DCMD_ID_SHIFT; - - if (id != prot->reqid) { - brcmf_err("%s: unexpected request id %d (expected %d)\n", - brcmf_ifname(drvr, ifidx), id, prot->reqid); - ret = -EINVAL; - goto done; - } - - /* Check the ERROR flag */ - if (flags & CDC_DCMD_ERROR) - ret = le32_to_cpu(msg->status); - -done: - return ret; -} - -static bool pkt_sum_needed(struct sk_buff *skb) -{ - return skb->ip_summed == CHECKSUM_PARTIAL; -} - -static void pkt_set_sum_good(struct sk_buff *skb, bool x) -{ - skb->ip_summed = (x ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE); -} - -void brcmf_proto_hdrpush(struct brcmf_pub *drvr, int ifidx, u8 offset, - struct sk_buff *pktbuf) -{ - struct brcmf_proto_bdc_header *h; - - brcmf_dbg(CDC, "Enter\n"); - - /* Push BDC header used to convey priority for buses that don't */ - skb_push(pktbuf, BDC_HEADER_LEN); - - h = (struct brcmf_proto_bdc_header *)(pktbuf->data); - - h->flags = (BDC_PROTO_VER << BDC_FLAG_VER_SHIFT); - if (pkt_sum_needed(pktbuf)) - h->flags |= BDC_FLAG_SUM_NEEDED; - - h->priority = (pktbuf->priority & BDC_PRIORITY_MASK); - h->flags2 = 0; - h->data_offset = offset; - BDC_SET_IF_IDX(h, ifidx); -} - -int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx, - struct sk_buff *pktbuf) -{ - struct brcmf_proto_bdc_header *h; - - brcmf_dbg(CDC, "Enter\n"); - - /* Pop BDC header used to convey priority for buses that don't */ - - if (pktbuf->len <= BDC_HEADER_LEN) { - brcmf_dbg(INFO, "rx data too short (%d <= %d)\n", - pktbuf->len, BDC_HEADER_LEN); - return -EBADE; - } - - h = (struct brcmf_proto_bdc_header *)(pktbuf->data); - - *ifidx = BDC_GET_IF_IDX(h); - if (*ifidx >= BRCMF_MAX_IFS) { - brcmf_err("rx data ifnum out of range (%d)\n", *ifidx); - return -EBADE; - } - /* The ifidx is the idx to map to matching netdev/ifp. When receiving - * events this is easy because it contains the bssidx which maps - * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd. - * bssidx 1 is used for p2p0 and no data can be received or - * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0 - */ - if (*ifidx) - (*ifidx)++; - - if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) != - BDC_PROTO_VER) { - brcmf_err("%s: non-BDC packet received, flags 0x%x\n", - brcmf_ifname(drvr, *ifidx), h->flags); - return -EBADE; - } - - if (h->flags & BDC_FLAG_SUM_GOOD) { - brcmf_dbg(CDC, "%s: BDC rcv, good checksum, flags 0x%x\n", - brcmf_ifname(drvr, *ifidx), h->flags); - pkt_set_sum_good(pktbuf, true); - } - - pktbuf->priority = h->priority & BDC_PRIORITY_MASK; - - skb_pull(pktbuf, BDC_HEADER_LEN); - if (do_fws) - brcmf_fws_hdrpull(drvr, *ifidx, h->data_offset << 2, pktbuf); - else - skb_pull(pktbuf, h->data_offset << 2); - - if (pktbuf->len == 0) - return -ENODATA; - return 0; -} - -int brcmf_proto_attach(struct brcmf_pub *drvr) -{ - struct brcmf_proto *cdc; - - cdc = kzalloc(sizeof(struct brcmf_proto), GFP_ATOMIC); - if (!cdc) - goto fail; - - /* ensure that the msg buf directly follows the cdc msg struct */ - if ((unsigned long)(&cdc->msg + 1) != (unsigned long)cdc->buf) { - brcmf_err("struct brcmf_proto is not correctly defined\n"); - goto fail; - } - - drvr->prot = cdc; - drvr->hdrlen += BDC_HEADER_LEN + BRCMF_PROT_FW_SIGNAL_MAX_TXBYTES; - drvr->bus_if->maxctl = BRCMF_DCMD_MAXLEN + - sizeof(struct brcmf_proto_cdc_dcmd) + ROUND_UP_MARGIN; - return 0; - -fail: - kfree(cdc); - return -ENOMEM; -} - -/* ~NOTE~ What if another thread is waiting on the semaphore? Holding it? */ -void brcmf_proto_detach(struct brcmf_pub *drvr) -{ - kfree(drvr->prot); - drvr->prot = NULL; -} - -void brcmf_proto_stop(struct brcmf_pub *drvr) -{ - /* Nothing to do for CDC */ -} diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c deleted file mode 100644 index 9431af2465f3..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include "dhd.h" -#include "dhd_bus.h" -#include "dhd_proto.h" -#include "dhd_dbg.h" -#include "fwil.h" -#include "tracepoint.h" - -#define PKTFILTER_BUF_SIZE 128 -#define BRCMF_DEFAULT_BCN_TIMEOUT 3 -#define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40 -#define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40 -#define BRCMF_DEFAULT_PACKET_FILTER "100 0 0 0 0x01 0x00" - -#ifdef DEBUG -static const char brcmf_version[] = - "Dongle Host Driver, version " BRCMF_VERSION_STR "\nCompiled on " - __DATE__ " at " __TIME__; -#else -static const char brcmf_version[] = - "Dongle Host Driver, version " BRCMF_VERSION_STR; -#endif - - -bool brcmf_c_prec_enq(struct device *dev, struct pktq *q, - struct sk_buff *pkt, int prec) -{ - struct sk_buff *p; - int eprec = -1; /* precedence to evict from */ - bool discard_oldest; - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_pub *drvr = bus_if->drvr; - - /* Fast case, precedence queue is not full and we are also not - * exceeding total queue length - */ - if (!pktq_pfull(q, prec) && !pktq_full(q)) { - brcmu_pktq_penq(q, prec, pkt); - return true; - } - - /* Determine precedence from which to evict packet, if any */ - if (pktq_pfull(q, prec)) - eprec = prec; - else if (pktq_full(q)) { - p = brcmu_pktq_peek_tail(q, &eprec); - if (eprec > prec) - return false; - } - - /* Evict if needed */ - if (eprec >= 0) { - /* Detect queueing to unconfigured precedence */ - discard_oldest = ac_bitmap_tst(drvr->wme_dp, eprec); - if (eprec == prec && !discard_oldest) - return false; /* refuse newer (incoming) packet */ - /* Evict packet according to discard policy */ - p = discard_oldest ? brcmu_pktq_pdeq(q, eprec) : - brcmu_pktq_pdeq_tail(q, eprec); - if (p == NULL) - brcmf_err("brcmu_pktq_penq() failed, oldest %d\n", - discard_oldest); - - brcmu_pkt_buf_free_skb(p); - } - - /* Enqueue */ - p = brcmu_pktq_penq(q, prec, pkt); - if (p == NULL) - brcmf_err("brcmu_pktq_penq() failed\n"); - - return p != NULL; -} - -/* Convert user's input in hex pattern to byte-size mask */ -static int brcmf_c_pattern_atoh(char *src, char *dst) -{ - int i; - if (strncmp(src, "0x", 2) != 0 && strncmp(src, "0X", 2) != 0) { - brcmf_err("Mask invalid format. Needs to start with 0x\n"); - return -EINVAL; - } - src = src + 2; /* Skip past 0x */ - if (strlen(src) % 2 != 0) { - brcmf_err("Mask invalid format. Length must be even.\n"); - return -EINVAL; - } - for (i = 0; *src != '\0'; i++) { - unsigned long res; - char num[3]; - strncpy(num, src, 2); - num[2] = '\0'; - if (kstrtoul(num, 16, &res)) - return -EINVAL; - dst[i] = (u8)res; - src += 2; - } - return i; -} - -static void -brcmf_c_pktfilter_offload_enable(struct brcmf_if *ifp, char *arg, int enable, - int master_mode) -{ - unsigned long res; - char *argv; - char *arg_save = NULL, *arg_org = NULL; - s32 err; - struct brcmf_pkt_filter_enable_le enable_parm; - - arg_save = kstrdup(arg, GFP_ATOMIC); - if (!arg_save) - goto fail; - - arg_org = arg_save; - - argv = strsep(&arg_save, " "); - - if (argv == NULL) { - brcmf_err("No args provided\n"); - goto fail; - } - - /* Parse packet filter id. */ - enable_parm.id = 0; - if (!kstrtoul(argv, 0, &res)) - enable_parm.id = cpu_to_le32((u32)res); - - /* Enable/disable the specified filter. */ - enable_parm.enable = cpu_to_le32(enable); - - err = brcmf_fil_iovar_data_set(ifp, "pkt_filter_enable", &enable_parm, - sizeof(enable_parm)); - if (err) - brcmf_err("Set pkt_filter_enable error (%d)\n", err); - - /* Control the master mode */ - err = brcmf_fil_iovar_int_set(ifp, "pkt_filter_mode", master_mode); - if (err) - brcmf_err("Set pkt_filter_mode error (%d)\n", err); - -fail: - kfree(arg_org); -} - -static void brcmf_c_pktfilter_offload_set(struct brcmf_if *ifp, char *arg) -{ - struct brcmf_pkt_filter_le *pkt_filter; - unsigned long res; - int buf_len; - s32 err; - u32 mask_size; - u32 pattern_size; - char *argv[8], *buf = NULL; - int i = 0; - char *arg_save = NULL, *arg_org = NULL; - - arg_save = kstrdup(arg, GFP_ATOMIC); - if (!arg_save) - goto fail; - - arg_org = arg_save; - - buf = kmalloc(PKTFILTER_BUF_SIZE, GFP_ATOMIC); - if (!buf) - goto fail; - - argv[i] = strsep(&arg_save, " "); - while (argv[i]) { - i++; - if (i >= 8) { - brcmf_err("Too many parameters\n"); - goto fail; - } - argv[i] = strsep(&arg_save, " "); - } - - if (i != 6) { - brcmf_err("Not enough args provided %d\n", i); - goto fail; - } - - pkt_filter = (struct brcmf_pkt_filter_le *)buf; - - /* Parse packet filter id. */ - pkt_filter->id = 0; - if (!kstrtoul(argv[0], 0, &res)) - pkt_filter->id = cpu_to_le32((u32)res); - - /* Parse filter polarity. */ - pkt_filter->negate_match = 0; - if (!kstrtoul(argv[1], 0, &res)) - pkt_filter->negate_match = cpu_to_le32((u32)res); - - /* Parse filter type. */ - pkt_filter->type = 0; - if (!kstrtoul(argv[2], 0, &res)) - pkt_filter->type = cpu_to_le32((u32)res); - - /* Parse pattern filter offset. */ - pkt_filter->u.pattern.offset = 0; - if (!kstrtoul(argv[3], 0, &res)) - pkt_filter->u.pattern.offset = cpu_to_le32((u32)res); - - /* Parse pattern filter mask. */ - mask_size = brcmf_c_pattern_atoh(argv[4], - (char *)pkt_filter->u.pattern.mask_and_pattern); - - /* Parse pattern filter pattern. */ - pattern_size = brcmf_c_pattern_atoh(argv[5], - (char *)&pkt_filter->u.pattern.mask_and_pattern[mask_size]); - - if (mask_size != pattern_size) { - brcmf_err("Mask and pattern not the same size\n"); - goto fail; - } - - pkt_filter->u.pattern.size_bytes = cpu_to_le32(mask_size); - buf_len = offsetof(struct brcmf_pkt_filter_le, - u.pattern.mask_and_pattern); - buf_len += mask_size + pattern_size; - - err = brcmf_fil_iovar_data_set(ifp, "pkt_filter_add", pkt_filter, - buf_len); - if (err) - brcmf_err("Set pkt_filter_add error (%d)\n", err); - -fail: - kfree(arg_org); - - kfree(buf); -} - -int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) -{ - s8 eventmask[BRCMF_EVENTING_MASK_LEN]; - u8 buf[BRCMF_DCMD_SMLEN]; - char *ptr; - s32 err; - struct brcmf_bus_dcmd *cmdlst; - struct list_head *cur, *q; - - /* retreive mac address */ - err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, - sizeof(ifp->mac_addr)); - if (err < 0) { - brcmf_err("Retreiving cur_etheraddr failed, %d\n", - err); - goto done; - } - memcpy(ifp->drvr->mac, ifp->mac_addr, sizeof(ifp->drvr->mac)); - - /* query for 'ver' to get version info from firmware */ - memset(buf, 0, sizeof(buf)); - strcpy(buf, "ver"); - err = brcmf_fil_iovar_data_get(ifp, "ver", buf, sizeof(buf)); - if (err < 0) { - brcmf_err("Retreiving version information failed, %d\n", - err); - goto done; - } - ptr = (char *)buf; - strsep(&ptr, "\n"); - /* Print fw version info */ - brcmf_err("Firmware version = %s\n", buf); - - /* - * Setup timeout if Beacons are lost and roam is off to report - * link down - */ - err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", - BRCMF_DEFAULT_BCN_TIMEOUT); - if (err) { - brcmf_err("bcn_timeout error (%d)\n", err); - goto done; - } - - /* Enable/Disable build-in roaming to allowed ext supplicant to take - * of romaing - */ - err = brcmf_fil_iovar_int_set(ifp, "roam_off", 1); - if (err) { - brcmf_err("roam_off error (%d)\n", err); - goto done; - } - - /* Setup event_msgs, enable E_IF */ - err = brcmf_fil_iovar_data_get(ifp, "event_msgs", eventmask, - BRCMF_EVENTING_MASK_LEN); - if (err) { - brcmf_err("Get event_msgs error (%d)\n", err); - goto done; - } - setbit(eventmask, BRCMF_E_IF); - err = brcmf_fil_iovar_data_set(ifp, "event_msgs", eventmask, - BRCMF_EVENTING_MASK_LEN); - if (err) { - brcmf_err("Set event_msgs error (%d)\n", err); - goto done; - } - - /* Setup default scan channel time */ - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME, - BRCMF_DEFAULT_SCAN_CHANNEL_TIME); - if (err) { - brcmf_err("BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n", - err); - goto done; - } - - /* Setup default scan unassoc time */ - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, - BRCMF_DEFAULT_SCAN_UNASSOC_TIME); - if (err) { - brcmf_err("BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n", - err); - goto done; - } - - /* Setup packet filter */ - brcmf_c_pktfilter_offload_set(ifp, BRCMF_DEFAULT_PACKET_FILTER); - brcmf_c_pktfilter_offload_enable(ifp, BRCMF_DEFAULT_PACKET_FILTER, - 0, true); - - /* set bus specific command if there is any */ - list_for_each_safe(cur, q, &ifp->drvr->bus_if->dcmd_list) { - cmdlst = list_entry(cur, struct brcmf_bus_dcmd, list); - if (cmdlst->name && cmdlst->param && cmdlst->param_len) { - brcmf_fil_iovar_data_set(ifp, cmdlst->name, - cmdlst->param, - cmdlst->param_len); - } - list_del(cur); - kfree(cmdlst); - } -done: - return err; -} - -#ifdef CONFIG_BRCM_TRACING -void __brcmf_err(const char *func, const char *fmt, ...) -{ - struct va_format vaf = { - .fmt = fmt, - }; - va_list args; - - va_start(args, fmt); - vaf.va = &args; - pr_err("%s: %pV", func, &vaf); - trace_brcmf_err(func, &vaf); - va_end(args); -} -#endif -#if defined(CONFIG_BRCM_TRACING) || defined(CONFIG_BRCMDBG) -void __brcmf_dbg(u32 level, const char *func, const char *fmt, ...) -{ - struct va_format vaf = { - .fmt = fmt, - }; - va_list args; - - va_start(args, fmt); - vaf.va = &args; - if (brcmf_msg_level & level) - pr_debug("%s %pV", func, &vaf); - trace_brcmf_dbg(level, func, &vaf); - va_end(args); -} -#endif diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c deleted file mode 100644 index 202869cd0932..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2012 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#include -#include -#include - -#include -#include -#include "dhd.h" -#include "dhd_bus.h" -#include "dhd_dbg.h" -#include "tracepoint.h" - -static struct dentry *root_folder; - -void brcmf_debugfs_init(void) -{ - root_folder = debugfs_create_dir(KBUILD_MODNAME, NULL); - if (IS_ERR(root_folder)) - root_folder = NULL; -} - -void brcmf_debugfs_exit(void) -{ - if (!root_folder) - return; - - debugfs_remove_recursive(root_folder); - root_folder = NULL; -} - -int brcmf_debugfs_attach(struct brcmf_pub *drvr) -{ - struct device *dev = drvr->bus_if->dev; - - if (!root_folder) - return -ENODEV; - - drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder); - return PTR_RET(drvr->dbgfs_dir); -} - -void brcmf_debugfs_detach(struct brcmf_pub *drvr) -{ - if (!IS_ERR_OR_NULL(drvr->dbgfs_dir)) - debugfs_remove_recursive(drvr->dbgfs_dir); -} - -struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr) -{ - return drvr->dbgfs_dir; -} - -static -ssize_t brcmf_debugfs_sdio_counter_read(struct file *f, char __user *data, - size_t count, loff_t *ppos) -{ - struct brcmf_sdio_count *sdcnt = f->private_data; - char buf[750]; - int res; - - /* only allow read from start */ - if (*ppos > 0) - return 0; - - res = scnprintf(buf, sizeof(buf), - "intrcount: %u\nlastintrs: %u\n" - "pollcnt: %u\nregfails: %u\n" - "tx_sderrs: %u\nfcqueued: %u\n" - "rxrtx: %u\nrx_toolong: %u\n" - "rxc_errors: %u\nrx_hdrfail: %u\n" - "rx_badhdr: %u\nrx_badseq: %u\n" - "fc_rcvd: %u\nfc_xoff: %u\n" - "fc_xon: %u\nrxglomfail: %u\n" - "rxglomframes: %u\nrxglompkts: %u\n" - "f2rxhdrs: %u\nf2rxdata: %u\n" - "f2txdata: %u\nf1regdata: %u\n" - "tickcnt: %u\ntx_ctlerrs: %lu\n" - "tx_ctlpkts: %lu\nrx_ctlerrs: %lu\n" - "rx_ctlpkts: %lu\nrx_readahead: %lu\n", - sdcnt->intrcount, sdcnt->lastintrs, - sdcnt->pollcnt, sdcnt->regfails, - sdcnt->tx_sderrs, sdcnt->fcqueued, - sdcnt->rxrtx, sdcnt->rx_toolong, - sdcnt->rxc_errors, sdcnt->rx_hdrfail, - sdcnt->rx_badhdr, sdcnt->rx_badseq, - sdcnt->fc_rcvd, sdcnt->fc_xoff, - sdcnt->fc_xon, sdcnt->rxglomfail, - sdcnt->rxglomframes, sdcnt->rxglompkts, - sdcnt->f2rxhdrs, sdcnt->f2rxdata, - sdcnt->f2txdata, sdcnt->f1regdata, - sdcnt->tickcnt, sdcnt->tx_ctlerrs, - sdcnt->tx_ctlpkts, sdcnt->rx_ctlerrs, - sdcnt->rx_ctlpkts, sdcnt->rx_readahead_cnt); - - return simple_read_from_buffer(data, count, ppos, buf, res); -} - -static const struct file_operations brcmf_debugfs_sdio_counter_ops = { - .owner = THIS_MODULE, - .open = simple_open, - .read = brcmf_debugfs_sdio_counter_read -}; - -void brcmf_debugfs_create_sdio_count(struct brcmf_pub *drvr, - struct brcmf_sdio_count *sdcnt) -{ - struct dentry *dentry = drvr->dbgfs_dir; - - if (!IS_ERR_OR_NULL(dentry)) - debugfs_create_file("counters", S_IRUGO, dentry, - sdcnt, &brcmf_debugfs_sdio_counter_ops); -} - -static -ssize_t brcmf_debugfs_fws_stats_read(struct file *f, char __user *data, - size_t count, loff_t *ppos) -{ - struct brcmf_fws_stats *fwstats = f->private_data; - char buf[650]; - int res; - - /* only allow read from start */ - if (*ppos > 0) - return 0; - - res = scnprintf(buf, sizeof(buf), - "header_pulls: %u\n" - "header_only_pkt: %u\n" - "tlv_parse_failed: %u\n" - "tlv_invalid_type: %u\n" - "mac_update_fails: %u\n" - "ps_update_fails: %u\n" - "if_update_fails: %u\n" - "pkt2bus: %u\n" - "generic_error: %u\n" - "rollback_success: %u\n" - "rollback_failed: %u\n" - "delayq_full: %u\n" - "supprq_full: %u\n" - "txs_indicate: %u\n" - "txs_discard: %u\n" - "txs_suppr_core: %u\n" - "txs_suppr_ps: %u\n" - "txs_tossed: %u\n" - "send_pkts: BK:%u BE:%u VO:%u VI:%u BCMC:%u\n" - "fifo_credits_sent: BK:%u BE:%u VO:%u VI:%u BCMC:%u\n", - fwstats->header_pulls, - fwstats->header_only_pkt, - fwstats->tlv_parse_failed, - fwstats->tlv_invalid_type, - fwstats->mac_update_failed, - fwstats->mac_ps_update_failed, - fwstats->if_update_failed, - fwstats->pkt2bus, - fwstats->generic_error, - fwstats->rollback_success, - fwstats->rollback_failed, - fwstats->delayq_full_error, - fwstats->supprq_full_error, - fwstats->txs_indicate, - fwstats->txs_discard, - fwstats->txs_supp_core, - fwstats->txs_supp_ps, - fwstats->txs_tossed, - fwstats->send_pkts[0], fwstats->send_pkts[1], - fwstats->send_pkts[2], fwstats->send_pkts[3], - fwstats->send_pkts[4], - fwstats->fifo_credits_sent[0], - fwstats->fifo_credits_sent[1], - fwstats->fifo_credits_sent[2], - fwstats->fifo_credits_sent[3], - fwstats->fifo_credits_sent[4]); - - return simple_read_from_buffer(data, count, ppos, buf, res); -} - -static const struct file_operations brcmf_debugfs_fws_stats_ops = { - .owner = THIS_MODULE, - .open = simple_open, - .read = brcmf_debugfs_fws_stats_read -}; - -void brcmf_debugfs_create_fws_stats(struct brcmf_pub *drvr, - struct brcmf_fws_stats *stats) -{ - struct dentry *dentry = drvr->dbgfs_dir; - - if (!IS_ERR_OR_NULL(dentry)) - debugfs_create_file("fws_stats", S_IRUGO, dentry, - stats, &brcmf_debugfs_fws_stats_ops); -} diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h deleted file mode 100644 index 009c87bfd9ae..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCMF_DBG_H_ -#define _BRCMF_DBG_H_ - -/* message levels */ -#define BRCMF_TRACE_VAL 0x00000002 -#define BRCMF_INFO_VAL 0x00000004 -#define BRCMF_DATA_VAL 0x00000008 -#define BRCMF_CTL_VAL 0x00000010 -#define BRCMF_TIMER_VAL 0x00000020 -#define BRCMF_HDRS_VAL 0x00000040 -#define BRCMF_BYTES_VAL 0x00000080 -#define BRCMF_INTR_VAL 0x00000100 -#define BRCMF_GLOM_VAL 0x00000200 -#define BRCMF_EVENT_VAL 0x00000400 -#define BRCMF_BTA_VAL 0x00000800 -#define BRCMF_FIL_VAL 0x00001000 -#define BRCMF_USB_VAL 0x00002000 -#define BRCMF_SCAN_VAL 0x00004000 -#define BRCMF_CONN_VAL 0x00008000 -#define BRCMF_CDC_VAL 0x00010000 -#define BRCMF_SDIO_VAL 0x00020000 - -/* set default print format */ -#undef pr_fmt -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -/* Macro for error messages. net_ratelimit() is used when driver - * debugging is not selected. When debugging the driver error - * messages are as important as other tracing or even more so. - */ -#ifndef CONFIG_BRCM_TRACING -#ifdef CONFIG_BRCMDBG -#define brcmf_err(fmt, ...) pr_err("%s: " fmt, __func__, ##__VA_ARGS__) -#else -#define brcmf_err(fmt, ...) \ - do { \ - if (net_ratelimit()) \ - pr_err("%s: " fmt, __func__, ##__VA_ARGS__); \ - } while (0) -#endif -#else -__printf(2, 3) -void __brcmf_err(const char *func, const char *fmt, ...); -#define brcmf_err(fmt, ...) \ - __brcmf_err(__func__, fmt, ##__VA_ARGS__) -#endif - -#if defined(DEBUG) || defined(CONFIG_BRCM_TRACING) -__printf(3, 4) -void __brcmf_dbg(u32 level, const char *func, const char *fmt, ...); -#define brcmf_dbg(level, fmt, ...) \ -do { \ - __brcmf_dbg(BRCMF_##level##_VAL, __func__, \ - fmt, ##__VA_ARGS__); \ -} while (0) -#define BRCMF_DATA_ON() (brcmf_msg_level & BRCMF_DATA_VAL) -#define BRCMF_CTL_ON() (brcmf_msg_level & BRCMF_CTL_VAL) -#define BRCMF_HDRS_ON() (brcmf_msg_level & BRCMF_HDRS_VAL) -#define BRCMF_BYTES_ON() (brcmf_msg_level & BRCMF_BYTES_VAL) -#define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL) -#define BRCMF_EVENT_ON() (brcmf_msg_level & BRCMF_EVENT_VAL) -#define BRCMF_FIL_ON() (brcmf_msg_level & BRCMF_FIL_VAL) - -#else /* defined(DEBUG) || defined(CONFIG_BRCM_TRACING) */ - -#define brcmf_dbg(level, fmt, ...) no_printk(fmt, ##__VA_ARGS__) - -#define BRCMF_DATA_ON() 0 -#define BRCMF_CTL_ON() 0 -#define BRCMF_HDRS_ON() 0 -#define BRCMF_BYTES_ON() 0 -#define BRCMF_GLOM_ON() 0 -#define BRCMF_EVENT_ON() 0 -#define BRCMF_FIL_ON() 0 - -#endif /* defined(DEBUG) || defined(CONFIG_BRCM_TRACING) */ - -#define brcmf_dbg_hex_dump(test, data, len, fmt, ...) \ -do { \ - trace_brcmf_hexdump((void *)data, len); \ - if (test) \ - brcmu_dbg_hex_dump(data, len, fmt, ##__VA_ARGS__); \ -} while (0) - -extern int brcmf_msg_level; - -/* - * hold counter variables used in brcmfmac sdio driver. - */ -struct brcmf_sdio_count { - uint intrcount; /* Count of device interrupt callbacks */ - uint lastintrs; /* Count as of last watchdog timer */ - uint pollcnt; /* Count of active polls */ - uint regfails; /* Count of R_REG failures */ - uint tx_sderrs; /* Count of tx attempts with sd errors */ - uint fcqueued; /* Tx packets that got queued */ - uint rxrtx; /* Count of rtx requests (NAK to dongle) */ - uint rx_toolong; /* Receive frames too long to receive */ - uint rxc_errors; /* SDIO errors when reading control frames */ - uint rx_hdrfail; /* SDIO errors on header reads */ - uint rx_badhdr; /* Bad received headers (roosync?) */ - uint rx_badseq; /* Mismatched rx sequence number */ - uint fc_rcvd; /* Number of flow-control events received */ - uint fc_xoff; /* Number which turned on flow-control */ - uint fc_xon; /* Number which turned off flow-control */ - uint rxglomfail; /* Failed deglom attempts */ - uint rxglomframes; /* Number of glom frames (superframes) */ - uint rxglompkts; /* Number of packets from glom frames */ - uint f2rxhdrs; /* Number of header reads */ - uint f2rxdata; /* Number of frame data reads */ - uint f2txdata; /* Number of f2 frame writes */ - uint f1regdata; /* Number of f1 register accesses */ - uint tickcnt; /* Number of watchdog been schedule */ - ulong tx_ctlerrs; /* Err of sending ctrl frames */ - ulong tx_ctlpkts; /* Ctrl frames sent to dongle */ - ulong rx_ctlerrs; /* Err of processing rx ctrl frames */ - ulong rx_ctlpkts; /* Ctrl frames processed from dongle */ - ulong rx_readahead_cnt; /* packets where header read-ahead was used */ -}; - -struct brcmf_fws_stats { - u32 tlv_parse_failed; - u32 tlv_invalid_type; - u32 header_only_pkt; - u32 header_pulls; - u32 pkt2bus; - u32 send_pkts[5]; - u32 fifo_credits_sent[5]; - u32 fifo_credits_back[6]; - u32 generic_error; - u32 mac_update_failed; - u32 mac_ps_update_failed; - u32 if_update_failed; - u32 packet_request_failed; - u32 credit_request_failed; - u32 rollback_success; - u32 rollback_failed; - u32 delayq_full_error; - u32 supprq_full_error; - u32 txs_indicate; - u32 txs_discard; - u32 txs_supp_core; - u32 txs_supp_ps; - u32 txs_tossed; -}; - -struct brcmf_pub; -#ifdef DEBUG -void brcmf_debugfs_init(void); -void brcmf_debugfs_exit(void); -int brcmf_debugfs_attach(struct brcmf_pub *drvr); -void brcmf_debugfs_detach(struct brcmf_pub *drvr); -struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr); -void brcmf_debugfs_create_sdio_count(struct brcmf_pub *drvr, - struct brcmf_sdio_count *sdcnt); -void brcmf_debugfs_create_fws_stats(struct brcmf_pub *drvr, - struct brcmf_fws_stats *stats); -#else -static inline void brcmf_debugfs_init(void) -{ -} -static inline void brcmf_debugfs_exit(void) -{ -} -static inline int brcmf_debugfs_attach(struct brcmf_pub *drvr) -{ - return 0; -} -static inline void brcmf_debugfs_detach(struct brcmf_pub *drvr) -{ -} -static inline void brcmf_debugfs_create_fws_stats(struct brcmf_pub *drvr, - struct brcmf_fws_stats *stats) -{ -} -#endif - -#endif /* _BRCMF_DBG_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c deleted file mode 100644 index 95d709959e16..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ /dev/null @@ -1,1074 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "dhd.h" -#include "dhd_bus.h" -#include "dhd_proto.h" -#include "dhd_dbg.h" -#include "fwil_types.h" -#include "p2p.h" -#include "wl_cfg80211.h" -#include "fwil.h" -#include "fwsignal.h" - -MODULE_AUTHOR("Broadcom Corporation"); -MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver."); -MODULE_LICENSE("Dual BSD/GPL"); - -#define MAX_WAIT_FOR_8021X_TX 50 /* msecs */ - -/* Error bits */ -int brcmf_msg_level; -module_param_named(debug, brcmf_msg_level, int, S_IRUSR | S_IWUSR); -MODULE_PARM_DESC(debug, "level of debug output"); - -/* P2P0 enable */ -static int brcmf_p2p_enable; -#ifdef CONFIG_BRCMDBG -module_param_named(p2pon, brcmf_p2p_enable, int, 0); -MODULE_PARM_DESC(p2pon, "enable p2p management functionality"); -#endif - -char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx) -{ - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) { - brcmf_err("ifidx %d out of range\n", ifidx); - return ""; - } - - if (drvr->iflist[ifidx] == NULL) { - brcmf_err("null i/f %d\n", ifidx); - return ""; - } - - if (drvr->iflist[ifidx]->ndev) - return drvr->iflist[ifidx]->ndev->name; - - return ""; -} - -static void _brcmf_set_multicast_list(struct work_struct *work) -{ - struct brcmf_if *ifp; - struct net_device *ndev; - struct netdev_hw_addr *ha; - u32 cmd_value, cnt; - __le32 cnt_le; - char *buf, *bufp; - u32 buflen; - s32 err; - - ifp = container_of(work, struct brcmf_if, multicast_work); - - brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx); - - ndev = ifp->ndev; - - /* Determine initial value of allmulti flag */ - cmd_value = (ndev->flags & IFF_ALLMULTI) ? true : false; - - /* Send down the multicast list first. */ - cnt = netdev_mc_count(ndev); - buflen = sizeof(cnt) + (cnt * ETH_ALEN); - buf = kmalloc(buflen, GFP_ATOMIC); - if (!buf) - return; - bufp = buf; - - cnt_le = cpu_to_le32(cnt); - memcpy(bufp, &cnt_le, sizeof(cnt_le)); - bufp += sizeof(cnt_le); - - netdev_for_each_mc_addr(ha, ndev) { - if (!cnt) - break; - memcpy(bufp, ha->addr, ETH_ALEN); - bufp += ETH_ALEN; - cnt--; - } - - err = brcmf_fil_iovar_data_set(ifp, "mcast_list", buf, buflen); - if (err < 0) { - brcmf_err("Setting mcast_list failed, %d\n", err); - cmd_value = cnt ? true : cmd_value; - } - - kfree(buf); - - /* - * Now send the allmulti setting. This is based on the setting in the - * net_device flags, but might be modified above to be turned on if we - * were trying to set some addresses and dongle rejected it... - */ - err = brcmf_fil_iovar_int_set(ifp, "allmulti", cmd_value); - if (err < 0) - brcmf_err("Setting allmulti failed, %d\n", err); - - /*Finally, pick up the PROMISC flag */ - cmd_value = (ndev->flags & IFF_PROMISC) ? true : false; - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PROMISC, cmd_value); - if (err < 0) - brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n", - err); -} - -static void -_brcmf_set_mac_address(struct work_struct *work) -{ - struct brcmf_if *ifp; - s32 err; - - ifp = container_of(work, struct brcmf_if, setmacaddr_work); - - brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx); - - err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr, - ETH_ALEN); - if (err < 0) { - brcmf_err("Setting cur_etheraddr failed, %d\n", err); - } else { - brcmf_dbg(TRACE, "MAC address updated to %pM\n", - ifp->mac_addr); - memcpy(ifp->ndev->dev_addr, ifp->mac_addr, ETH_ALEN); - } -} - -static int brcmf_netdev_set_mac_address(struct net_device *ndev, void *addr) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - struct sockaddr *sa = (struct sockaddr *)addr; - - memcpy(&ifp->mac_addr, sa->sa_data, ETH_ALEN); - schedule_work(&ifp->setmacaddr_work); - return 0; -} - -static void brcmf_netdev_set_multicast_list(struct net_device *ndev) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - - schedule_work(&ifp->multicast_work); -} - -static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, - struct net_device *ndev) -{ - int ret; - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_pub *drvr = ifp->drvr; - struct ethhdr *eh; - - brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx); - - /* Can the device send data? */ - if (drvr->bus_if->state != BRCMF_BUS_DATA) { - brcmf_err("xmit rejected state=%d\n", drvr->bus_if->state); - netif_stop_queue(ndev); - dev_kfree_skb(skb); - ret = -ENODEV; - goto done; - } - - if (!drvr->iflist[ifp->bssidx]) { - brcmf_err("bad ifidx %d\n", ifp->bssidx); - netif_stop_queue(ndev); - dev_kfree_skb(skb); - ret = -ENODEV; - goto done; - } - - /* Make sure there's enough room for any header */ - if (skb_headroom(skb) < drvr->hdrlen) { - struct sk_buff *skb2; - - brcmf_dbg(INFO, "%s: insufficient headroom\n", - brcmf_ifname(drvr, ifp->bssidx)); - drvr->bus_if->tx_realloc++; - skb2 = skb_realloc_headroom(skb, drvr->hdrlen); - dev_kfree_skb(skb); - skb = skb2; - if (skb == NULL) { - brcmf_err("%s: skb_realloc_headroom failed\n", - brcmf_ifname(drvr, ifp->bssidx)); - ret = -ENOMEM; - goto done; - } - } - - /* validate length for ether packet */ - if (skb->len < sizeof(*eh)) { - ret = -EINVAL; - dev_kfree_skb(skb); - goto done; - } - - ret = brcmf_fws_process_skb(ifp, skb); - -done: - if (ret) { - ifp->stats.tx_dropped++; - } else { - ifp->stats.tx_packets++; - ifp->stats.tx_bytes += skb->len; - } - - /* Return ok: we always eat the packet */ - return NETDEV_TX_OK; -} - -void brcmf_txflowblock_if(struct brcmf_if *ifp, - enum brcmf_netif_stop_reason reason, bool state) -{ - if (!ifp) - return; - - brcmf_dbg(TRACE, "enter: idx=%d stop=0x%X reason=%d state=%d\n", - ifp->bssidx, ifp->netif_stop, reason, state); - if (state) { - if (!ifp->netif_stop) - netif_stop_queue(ifp->ndev); - ifp->netif_stop |= reason; - } else { - ifp->netif_stop &= ~reason; - if (!ifp->netif_stop) - netif_wake_queue(ifp->ndev); - } -} - -void brcmf_txflowblock(struct device *dev, bool state) -{ - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_pub *drvr = bus_if->drvr; - int i; - - brcmf_dbg(TRACE, "Enter\n"); - - for (i = 0; i < BRCMF_MAX_IFS; i++) - brcmf_txflowblock_if(drvr->iflist[i], - BRCMF_NETIF_STOP_REASON_BLOCK_BUS, state); -} - -void brcmf_rx_frames(struct device *dev, struct sk_buff_head *skb_list) -{ - unsigned char *eth; - uint len; - struct sk_buff *skb, *pnext; - struct brcmf_if *ifp; - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_pub *drvr = bus_if->drvr; - u8 ifidx; - int ret; - - brcmf_dbg(TRACE, "Enter\n"); - - skb_queue_walk_safe(skb_list, skb, pnext) { - skb_unlink(skb, skb_list); - - /* process and remove protocol-specific header */ - ret = brcmf_proto_hdrpull(drvr, drvr->fw_signals, &ifidx, skb); - ifp = drvr->iflist[ifidx]; - - if (ret || !ifp || !ifp->ndev) { - if ((ret != -ENODATA) && ifp) - ifp->stats.rx_errors++; - brcmu_pkt_buf_free_skb(skb); - continue; - } - - /* Get the protocol, maintain skb around eth_type_trans() - * The main reason for this hack is for the limitation of - * Linux 2.4 where 'eth_type_trans' uses the - * 'net->hard_header_len' - * to perform skb_pull inside vs ETH_HLEN. Since to avoid - * coping of the packet coming from the network stack to add - * BDC, Hardware header etc, during network interface - * registration - * we set the 'net->hard_header_len' to ETH_HLEN + extra space - * required - * for BDC, Hardware header etc. and not just the ETH_HLEN - */ - eth = skb->data; - len = skb->len; - - skb->dev = ifp->ndev; - skb->protocol = eth_type_trans(skb, skb->dev); - - if (skb->pkt_type == PACKET_MULTICAST) - ifp->stats.multicast++; - - skb->data = eth; - skb->len = len; - - /* Strip header, count, deliver upward */ - skb_pull(skb, ETH_HLEN); - - /* Process special event packets */ - brcmf_fweh_process_skb(drvr, skb); - - if (!(ifp->ndev->flags & IFF_UP)) { - brcmu_pkt_buf_free_skb(skb); - continue; - } - - ifp->stats.rx_bytes += skb->len; - ifp->stats.rx_packets++; - - if (in_interrupt()) - netif_rx(skb); - else - /* If the receive is not processed inside an ISR, - * the softirqd must be woken explicitly to service - * the NET_RX_SOFTIRQ. In 2.6 kernels, this is handled - * by netif_rx_ni(), but in earlier kernels, we need - * to do it manually. - */ - netif_rx_ni(skb); - } -} - -void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, - bool success) -{ - struct brcmf_if *ifp; - struct ethhdr *eh; - u8 ifidx; - u16 type; - int res; - - res = brcmf_proto_hdrpull(drvr, false, &ifidx, txp); - - ifp = drvr->iflist[ifidx]; - if (!ifp) - goto done; - - if (res == 0) { - eh = (struct ethhdr *)(txp->data); - type = ntohs(eh->h_proto); - - if (type == ETH_P_PAE) { - atomic_dec(&ifp->pend_8021x_cnt); - if (waitqueue_active(&ifp->pend_8021x_wait)) - wake_up(&ifp->pend_8021x_wait); - } - } - if (!success) - ifp->stats.tx_errors++; -done: - brcmu_pkt_buf_free_skb(txp); -} - -void brcmf_txcomplete(struct device *dev, struct sk_buff *txp, bool success) -{ - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_pub *drvr = bus_if->drvr; - - /* await txstatus signal for firmware if active */ - if (brcmf_fws_fc_active(drvr->fws)) { - if (!success) - brcmf_fws_bustxfail(drvr->fws, txp); - } else { - brcmf_txfinalize(drvr, txp, success); - } -} - -static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *ndev) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - - brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx); - - return &ifp->stats; -} - -/* - * Set current toe component enables in toe_ol iovar, - * and set toe global enable iovar - */ -static int brcmf_toe_set(struct brcmf_if *ifp, u32 toe_ol) -{ - s32 err; - - err = brcmf_fil_iovar_int_set(ifp, "toe_ol", toe_ol); - if (err < 0) { - brcmf_err("Setting toe_ol failed, %d\n", err); - return err; - } - - err = brcmf_fil_iovar_int_set(ifp, "toe", (toe_ol != 0)); - if (err < 0) - brcmf_err("Setting toe failed, %d\n", err); - - return err; - -} - -static void brcmf_ethtool_get_drvinfo(struct net_device *ndev, - struct ethtool_drvinfo *info) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_pub *drvr = ifp->drvr; - - strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); - snprintf(info->version, sizeof(info->version), "%lu", - drvr->drv_version); - strlcpy(info->bus_info, dev_name(drvr->bus_if->dev), - sizeof(info->bus_info)); -} - -static const struct ethtool_ops brcmf_ethtool_ops = { - .get_drvinfo = brcmf_ethtool_get_drvinfo, -}; - -static int brcmf_ethtool(struct brcmf_if *ifp, void __user *uaddr) -{ - struct brcmf_pub *drvr = ifp->drvr; - struct ethtool_drvinfo info; - char drvname[sizeof(info.driver)]; - u32 cmd; - struct ethtool_value edata; - u32 toe_cmpnt, csum_dir; - int ret; - - brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx); - - /* all ethtool calls start with a cmd word */ - if (copy_from_user(&cmd, uaddr, sizeof(u32))) - return -EFAULT; - - switch (cmd) { - case ETHTOOL_GDRVINFO: - /* Copy out any request driver name */ - if (copy_from_user(&info, uaddr, sizeof(info))) - return -EFAULT; - strncpy(drvname, info.driver, sizeof(info.driver)); - drvname[sizeof(info.driver) - 1] = '\0'; - - /* clear struct for return */ - memset(&info, 0, sizeof(info)); - info.cmd = cmd; - - /* if requested, identify ourselves */ - if (strcmp(drvname, "?dhd") == 0) { - sprintf(info.driver, "dhd"); - strcpy(info.version, BRCMF_VERSION_STR); - } - /* report dongle driver type */ - else - sprintf(info.driver, "wl"); - - sprintf(info.version, "%lu", drvr->drv_version); - if (copy_to_user(uaddr, &info, sizeof(info))) - return -EFAULT; - brcmf_dbg(TRACE, "given %*s, returning %s\n", - (int)sizeof(drvname), drvname, info.driver); - break; - - /* Get toe offload components from dongle */ - case ETHTOOL_GRXCSUM: - case ETHTOOL_GTXCSUM: - ret = brcmf_fil_iovar_int_get(ifp, "toe_ol", &toe_cmpnt); - if (ret < 0) - return ret; - - csum_dir = - (cmd == ETHTOOL_GTXCSUM) ? TOE_TX_CSUM_OL : TOE_RX_CSUM_OL; - - edata.cmd = cmd; - edata.data = (toe_cmpnt & csum_dir) ? 1 : 0; - - if (copy_to_user(uaddr, &edata, sizeof(edata))) - return -EFAULT; - break; - - /* Set toe offload components in dongle */ - case ETHTOOL_SRXCSUM: - case ETHTOOL_STXCSUM: - if (copy_from_user(&edata, uaddr, sizeof(edata))) - return -EFAULT; - - /* Read the current settings, update and write back */ - ret = brcmf_fil_iovar_int_get(ifp, "toe_ol", &toe_cmpnt); - if (ret < 0) - return ret; - - csum_dir = - (cmd == ETHTOOL_STXCSUM) ? TOE_TX_CSUM_OL : TOE_RX_CSUM_OL; - - if (edata.data != 0) - toe_cmpnt |= csum_dir; - else - toe_cmpnt &= ~csum_dir; - - ret = brcmf_toe_set(ifp, toe_cmpnt); - if (ret < 0) - return ret; - - /* If setting TX checksum mode, tell Linux the new mode */ - if (cmd == ETHTOOL_STXCSUM) { - if (edata.data) - ifp->ndev->features |= NETIF_F_IP_CSUM; - else - ifp->ndev->features &= ~NETIF_F_IP_CSUM; - } - - break; - - default: - return -EOPNOTSUPP; - } - - return 0; -} - -static int brcmf_netdev_ioctl_entry(struct net_device *ndev, struct ifreq *ifr, - int cmd) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_pub *drvr = ifp->drvr; - - brcmf_dbg(TRACE, "Enter, idx=%d, cmd=0x%04x\n", ifp->bssidx, cmd); - - if (!drvr->iflist[ifp->bssidx]) - return -1; - - if (cmd == SIOCETHTOOL) - return brcmf_ethtool(ifp, ifr->ifr_data); - - return -EOPNOTSUPP; -} - -static int brcmf_netdev_stop(struct net_device *ndev) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - - brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx); - - brcmf_cfg80211_down(ndev); - - /* Set state and stop OS transmissions */ - netif_stop_queue(ndev); - - return 0; -} - -static int brcmf_netdev_open(struct net_device *ndev) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_pub *drvr = ifp->drvr; - struct brcmf_bus *bus_if = drvr->bus_if; - u32 toe_ol; - s32 ret = 0; - - brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx); - - /* If bus is not ready, can't continue */ - if (bus_if->state != BRCMF_BUS_DATA) { - brcmf_err("failed bus is not ready\n"); - return -EAGAIN; - } - - atomic_set(&ifp->pend_8021x_cnt, 0); - - /* Get current TOE mode from dongle */ - if (brcmf_fil_iovar_int_get(ifp, "toe_ol", &toe_ol) >= 0 - && (toe_ol & TOE_TX_CSUM_OL) != 0) - ndev->features |= NETIF_F_IP_CSUM; - else - ndev->features &= ~NETIF_F_IP_CSUM; - - /* Allow transmit calls */ - netif_start_queue(ndev); - if (brcmf_cfg80211_up(ndev)) { - brcmf_err("failed to bring up cfg80211\n"); - return -1; - } - - return ret; -} - -static const struct net_device_ops brcmf_netdev_ops_pri = { - .ndo_open = brcmf_netdev_open, - .ndo_stop = brcmf_netdev_stop, - .ndo_get_stats = brcmf_netdev_get_stats, - .ndo_do_ioctl = brcmf_netdev_ioctl_entry, - .ndo_start_xmit = brcmf_netdev_start_xmit, - .ndo_set_mac_address = brcmf_netdev_set_mac_address, - .ndo_set_rx_mode = brcmf_netdev_set_multicast_list -}; - -int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked) -{ - struct brcmf_pub *drvr = ifp->drvr; - struct net_device *ndev; - s32 err; - - brcmf_dbg(TRACE, "Enter, idx=%d mac=%pM\n", ifp->bssidx, - ifp->mac_addr); - ndev = ifp->ndev; - - /* set appropriate operations */ - ndev->netdev_ops = &brcmf_netdev_ops_pri; - - ndev->hard_header_len = ETH_HLEN + drvr->hdrlen; - ndev->ethtool_ops = &brcmf_ethtool_ops; - - drvr->rxsz = ndev->mtu + ndev->hard_header_len + - drvr->hdrlen; - - /* set the mac address */ - memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN); - - INIT_WORK(&ifp->setmacaddr_work, _brcmf_set_mac_address); - INIT_WORK(&ifp->multicast_work, _brcmf_set_multicast_list); - - if (rtnl_locked) - err = register_netdevice(ndev); - else - err = register_netdev(ndev); - if (err != 0) { - brcmf_err("couldn't register the net device\n"); - goto fail; - } - - brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name); - - ndev->destructor = free_netdev; - return 0; - -fail: - drvr->iflist[ifp->bssidx] = NULL; - ndev->netdev_ops = NULL; - free_netdev(ndev); - return -EBADE; -} - -static int brcmf_net_p2p_open(struct net_device *ndev) -{ - brcmf_dbg(TRACE, "Enter\n"); - - return brcmf_cfg80211_up(ndev); -} - -static int brcmf_net_p2p_stop(struct net_device *ndev) -{ - brcmf_dbg(TRACE, "Enter\n"); - - return brcmf_cfg80211_down(ndev); -} - -static int brcmf_net_p2p_do_ioctl(struct net_device *ndev, - struct ifreq *ifr, int cmd) -{ - brcmf_dbg(TRACE, "Enter\n"); - return 0; -} - -static netdev_tx_t brcmf_net_p2p_start_xmit(struct sk_buff *skb, - struct net_device *ndev) -{ - if (skb) - dev_kfree_skb_any(skb); - - return NETDEV_TX_OK; -} - -static const struct net_device_ops brcmf_netdev_ops_p2p = { - .ndo_open = brcmf_net_p2p_open, - .ndo_stop = brcmf_net_p2p_stop, - .ndo_do_ioctl = brcmf_net_p2p_do_ioctl, - .ndo_start_xmit = brcmf_net_p2p_start_xmit -}; - -static int brcmf_net_p2p_attach(struct brcmf_if *ifp) -{ - struct net_device *ndev; - - brcmf_dbg(TRACE, "Enter, idx=%d mac=%pM\n", ifp->bssidx, - ifp->mac_addr); - ndev = ifp->ndev; - - ndev->netdev_ops = &brcmf_netdev_ops_p2p; - - /* set the mac address */ - memcpy(ndev->dev_addr, ifp->mac_addr, ETH_ALEN); - - if (register_netdev(ndev) != 0) { - brcmf_err("couldn't register the p2p net device\n"); - goto fail; - } - - brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name); - - return 0; - -fail: - ifp->drvr->iflist[ifp->bssidx] = NULL; - ndev->netdev_ops = NULL; - free_netdev(ndev); - return -EBADE; -} - -struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx, - char *name, u8 *mac_addr) -{ - struct brcmf_if *ifp; - struct net_device *ndev; - - brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifidx); - - ifp = drvr->iflist[bssidx]; - /* - * Delete the existing interface before overwriting it - * in case we missed the BRCMF_E_IF_DEL event. - */ - if (ifp) { - brcmf_err("ERROR: netdev:%s already exists\n", - ifp->ndev->name); - if (ifidx) { - netif_stop_queue(ifp->ndev); - unregister_netdev(ifp->ndev); - free_netdev(ifp->ndev); - drvr->iflist[bssidx] = NULL; - } else { - brcmf_err("ignore IF event\n"); - return ERR_PTR(-EINVAL); - } - } - - if (!brcmf_p2p_enable && bssidx == 1) { - /* this is P2P_DEVICE interface */ - brcmf_dbg(INFO, "allocate non-netdev interface\n"); - ifp = kzalloc(sizeof(*ifp), GFP_KERNEL); - if (!ifp) - return ERR_PTR(-ENOMEM); - } else { - brcmf_dbg(INFO, "allocate netdev interface\n"); - /* Allocate netdev, including space for private structure */ - ndev = alloc_netdev(sizeof(*ifp), name, ether_setup); - if (!ndev) - return ERR_PTR(-ENOMEM); - - ifp = netdev_priv(ndev); - ifp->ndev = ndev; - } - - ifp->drvr = drvr; - drvr->iflist[bssidx] = ifp; - ifp->ifidx = ifidx; - ifp->bssidx = bssidx; - - init_waitqueue_head(&ifp->pend_8021x_wait); - - if (mac_addr != NULL) - memcpy(ifp->mac_addr, mac_addr, ETH_ALEN); - - brcmf_dbg(TRACE, " ==== pid:%x, if:%s (%pM) created ===\n", - current->pid, name, ifp->mac_addr); - - return ifp; -} - -void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx) -{ - struct brcmf_if *ifp; - - ifp = drvr->iflist[bssidx]; - drvr->iflist[bssidx] = NULL; - if (!ifp) { - brcmf_err("Null interface, idx=%d\n", bssidx); - return; - } - brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx); - if (ifp->ndev) { - if (bssidx == 0) { - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) { - rtnl_lock(); - brcmf_netdev_stop(ifp->ndev); - rtnl_unlock(); - } - } else { - netif_stop_queue(ifp->ndev); - } - - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) { - cancel_work_sync(&ifp->setmacaddr_work); - cancel_work_sync(&ifp->multicast_work); - } - /* unregister will take care of freeing it */ - unregister_netdev(ifp->ndev); - if (bssidx == 0) - brcmf_cfg80211_detach(drvr->config); - } else { - kfree(ifp); - } -} - -int brcmf_attach(uint bus_hdrlen, struct device *dev) -{ - struct brcmf_pub *drvr = NULL; - int ret = 0; - - brcmf_dbg(TRACE, "Enter\n"); - - /* Allocate primary brcmf_info */ - drvr = kzalloc(sizeof(struct brcmf_pub), GFP_ATOMIC); - if (!drvr) - return -ENOMEM; - - mutex_init(&drvr->proto_block); - - /* Link to bus module */ - drvr->hdrlen = bus_hdrlen; - drvr->bus_if = dev_get_drvdata(dev); - drvr->bus_if->drvr = drvr; - - /* create device debugfs folder */ - brcmf_debugfs_attach(drvr); - - /* Attach and link in the protocol */ - ret = brcmf_proto_attach(drvr); - if (ret != 0) { - brcmf_err("brcmf_prot_attach failed\n"); - goto fail; - } - - /* attach firmware event handler */ - brcmf_fweh_attach(drvr); - - INIT_LIST_HEAD(&drvr->bus_if->dcmd_list); - - return ret; - -fail: - brcmf_detach(dev); - - return ret; -} - -int brcmf_bus_start(struct device *dev) -{ - int ret = -1; - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_pub *drvr = bus_if->drvr; - struct brcmf_if *ifp; - struct brcmf_if *p2p_ifp; - - brcmf_dbg(TRACE, "\n"); - - /* Bring up the bus */ - ret = brcmf_bus_init(bus_if); - if (ret != 0) { - brcmf_err("brcmf_sdbrcm_bus_init failed %d\n", ret); - return ret; - } - - /* add primary networking interface */ - ifp = brcmf_add_if(drvr, 0, 0, "wlan%d", NULL); - if (IS_ERR(ifp)) - return PTR_ERR(ifp); - - if (brcmf_p2p_enable) - p2p_ifp = brcmf_add_if(drvr, 1, 0, "p2p%d", NULL); - else - p2p_ifp = NULL; - if (IS_ERR(p2p_ifp)) - p2p_ifp = NULL; - - /* signal bus ready */ - bus_if->state = BRCMF_BUS_DATA; - - /* Bus is ready, do any initialization */ - ret = brcmf_c_preinit_dcmds(ifp); - if (ret < 0) - goto fail; - - drvr->fw_signals = true; - ret = brcmf_fws_init(drvr); - if (ret < 0) - goto fail; - - brcmf_fws_add_interface(ifp); - - drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev); - if (drvr->config == NULL) { - ret = -ENOMEM; - goto fail; - } - - ret = brcmf_fweh_activate_events(ifp); - if (ret < 0) - goto fail; - - ret = brcmf_net_attach(ifp, false); -fail: - if (ret < 0) { - brcmf_err("failed: %d\n", ret); - if (drvr->config) - brcmf_cfg80211_detach(drvr->config); - if (drvr->fws) { - brcmf_fws_del_interface(ifp); - brcmf_fws_deinit(drvr); - } - if (drvr->iflist[0]) { - free_netdev(ifp->ndev); - drvr->iflist[0] = NULL; - } - if (p2p_ifp) { - free_netdev(p2p_ifp->ndev); - drvr->iflist[1] = NULL; - } - return ret; - } - if ((brcmf_p2p_enable) && (p2p_ifp)) - if (brcmf_net_p2p_attach(p2p_ifp) < 0) - brcmf_p2p_enable = 0; - - return 0; -} - -static void brcmf_bus_detach(struct brcmf_pub *drvr) -{ - brcmf_dbg(TRACE, "Enter\n"); - - if (drvr) { - /* Stop the protocol module */ - brcmf_proto_stop(drvr); - - /* Stop the bus module */ - brcmf_bus_stop(drvr->bus_if); - } -} - -void brcmf_dev_reset(struct device *dev) -{ - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_pub *drvr = bus_if->drvr; - - if (drvr == NULL) - return; - - if (drvr->iflist[0]) - brcmf_fil_cmd_int_set(drvr->iflist[0], BRCMF_C_TERMINATED, 1); -} - -void brcmf_detach(struct device *dev) -{ - s32 i; - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_pub *drvr = bus_if->drvr; - - brcmf_dbg(TRACE, "Enter\n"); - - if (drvr == NULL) - return; - - /* stop firmware event handling */ - brcmf_fweh_detach(drvr); - - /* make sure primary interface removed last */ - for (i = BRCMF_MAX_IFS-1; i > -1; i--) - if (drvr->iflist[i]) { - brcmf_fws_del_interface(drvr->iflist[i]); - brcmf_del_if(drvr, i); - } - - brcmf_bus_detach(drvr); - - if (drvr->prot) - brcmf_proto_detach(drvr); - - brcmf_fws_deinit(drvr); - - brcmf_debugfs_detach(drvr); - bus_if->drvr = NULL; - kfree(drvr); -} - -static int brcmf_get_pend_8021x_cnt(struct brcmf_if *ifp) -{ - return atomic_read(&ifp->pend_8021x_cnt); -} - -int brcmf_netdev_wait_pend8021x(struct net_device *ndev) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - int err; - - err = wait_event_timeout(ifp->pend_8021x_wait, - !brcmf_get_pend_8021x_cnt(ifp), - msecs_to_jiffies(MAX_WAIT_FOR_8021X_TX)); - - WARN_ON(!err); - - return !err; -} - -/* - * return chip id and rev of the device encoded in u32. - */ -u32 brcmf_get_chip_info(struct brcmf_if *ifp) -{ - struct brcmf_bus *bus = ifp->drvr->bus_if; - - return bus->chip << 4 | bus->chiprev; -} - -static void brcmf_driver_register(struct work_struct *work) -{ -#ifdef CONFIG_BRCMFMAC_SDIO - brcmf_sdio_register(); -#endif -#ifdef CONFIG_BRCMFMAC_USB - brcmf_usb_register(); -#endif -} -static DECLARE_WORK(brcmf_driver_work, brcmf_driver_register); - -static int __init brcmfmac_module_init(void) -{ - brcmf_debugfs_init(); -#ifdef CONFIG_BRCMFMAC_SDIO - brcmf_sdio_init(); -#endif - if (!schedule_work(&brcmf_driver_work)) - return -EBUSY; - - return 0; -} - -static void __exit brcmfmac_module_exit(void) -{ - cancel_work_sync(&brcmf_driver_work); - -#ifdef CONFIG_BRCMFMAC_SDIO - brcmf_sdio_exit(); -#endif -#ifdef CONFIG_BRCMFMAC_USB - brcmf_usb_exit(); -#endif - brcmf_debugfs_exit(); -} - -module_init(brcmfmac_module_init); -module_exit(brcmfmac_module_exit); diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_proto.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_proto.h deleted file mode 100644 index ef9179883748..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_proto.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCMF_PROTO_H_ -#define _BRCMF_PROTO_H_ - -/* - * Exported from the brcmf protocol module (brcmf_cdc) - */ - -/* Linkage, sets prot link and updates hdrlen in pub */ -extern int brcmf_proto_attach(struct brcmf_pub *drvr); - -/* Unlink, frees allocated protocol memory (including brcmf_proto) */ -extern void brcmf_proto_detach(struct brcmf_pub *drvr); - -/* Stop protocol: sync w/dongle state. */ -extern void brcmf_proto_stop(struct brcmf_pub *drvr); - -/* Add any protocol-specific data header. - * Caller must reserve prot_hdrlen prepend space. - */ -extern void brcmf_proto_hdrpush(struct brcmf_pub *, int ifidx, u8 offset, - struct sk_buff *txp); - -/* Sets dongle media info (drv_version, mac address). */ -extern int brcmf_c_preinit_dcmds(struct brcmf_if *ifp); - -#endif /* _BRCMF_PROTO_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c deleted file mode 100644 index d2487518bd2a..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ /dev/null @@ -1,4043 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "sdio_host.h" -#include "sdio_chip.h" - -#define DCMD_RESP_TIMEOUT 2000 /* In milli second */ - -#ifdef DEBUG - -#define BRCMF_TRAP_INFO_SIZE 80 - -#define CBUF_LEN (128) - -/* Device console log buffer state */ -#define CONSOLE_BUFFER_MAX 2024 - -struct rte_log_le { - __le32 buf; /* Can't be pointer on (64-bit) hosts */ - __le32 buf_size; - __le32 idx; - char *_buf_compat; /* Redundant pointer for backward compat. */ -}; - -struct rte_console { - /* Virtual UART - * When there is no UART (e.g. Quickturn), - * the host should write a complete - * input line directly into cbuf and then write - * the length into vcons_in. - * This may also be used when there is a real UART - * (at risk of conflicting with - * the real UART). vcons_out is currently unused. - */ - uint vcons_in; - uint vcons_out; - - /* Output (logging) buffer - * Console output is written to a ring buffer log_buf at index log_idx. - * The host may read the output when it sees log_idx advance. - * Output will be lost if the output wraps around faster than the host - * polls. - */ - struct rte_log_le log_le; - - /* Console input line buffer - * Characters are read one at a time into cbuf - * until is received, then - * the buffer is processed as a command line. - * Also used for virtual UART. - */ - uint cbuf_idx; - char cbuf[CBUF_LEN]; -}; - -#endif /* DEBUG */ -#include - -#include "dhd_bus.h" -#include "dhd_dbg.h" -#include "tracepoint.h" - -#define TXQLEN 2048 /* bulk tx queue length */ -#define TXHI (TXQLEN - 256) /* turn on flow control above TXHI */ -#define TXLOW (TXHI - 256) /* turn off flow control below TXLOW */ -#define PRIOMASK 7 - -#define TXRETRIES 2 /* # of retries for tx frames */ - -#define BRCMF_RXBOUND 50 /* Default for max rx frames in - one scheduling */ - -#define BRCMF_TXBOUND 20 /* Default for max tx frames in - one scheduling */ - -#define BRCMF_TXMINMAX 1 /* Max tx frames if rx still pending */ - -#define MEMBLOCK 2048 /* Block size used for downloading - of dongle image */ -#define MAX_DATA_BUF (32 * 1024) /* Must be large enough to hold - biggest possible glom */ - -#define BRCMF_FIRSTREAD (1 << 6) - - -/* SBSDIO_DEVICE_CTL */ - -/* 1: device will assert busy signal when receiving CMD53 */ -#define SBSDIO_DEVCTL_SETBUSY 0x01 -/* 1: assertion of sdio interrupt is synchronous to the sdio clock */ -#define SBSDIO_DEVCTL_SPI_INTR_SYNC 0x02 -/* 1: mask all interrupts to host except the chipActive (rev 8) */ -#define SBSDIO_DEVCTL_CA_INT_ONLY 0x04 -/* 1: isolate internal sdio signals, put external pads in tri-state; requires - * sdio bus power cycle to clear (rev 9) */ -#define SBSDIO_DEVCTL_PADS_ISO 0x08 -/* Force SD->SB reset mapping (rev 11) */ -#define SBSDIO_DEVCTL_SB_RST_CTL 0x30 -/* Determined by CoreControl bit */ -#define SBSDIO_DEVCTL_RST_CORECTL 0x00 -/* Force backplane reset */ -#define SBSDIO_DEVCTL_RST_BPRESET 0x10 -/* Force no backplane reset */ -#define SBSDIO_DEVCTL_RST_NOBPRESET 0x20 - -/* direct(mapped) cis space */ - -/* MAPPED common CIS address */ -#define SBSDIO_CIS_BASE_COMMON 0x1000 -/* maximum bytes in one CIS */ -#define SBSDIO_CIS_SIZE_LIMIT 0x200 -/* cis offset addr is < 17 bits */ -#define SBSDIO_CIS_OFT_ADDR_MASK 0x1FFFF - -/* manfid tuple length, include tuple, link bytes */ -#define SBSDIO_CIS_MANFID_TUPLE_LEN 6 - -/* intstatus */ -#define I_SMB_SW0 (1 << 0) /* To SB Mail S/W interrupt 0 */ -#define I_SMB_SW1 (1 << 1) /* To SB Mail S/W interrupt 1 */ -#define I_SMB_SW2 (1 << 2) /* To SB Mail S/W interrupt 2 */ -#define I_SMB_SW3 (1 << 3) /* To SB Mail S/W interrupt 3 */ -#define I_SMB_SW_MASK 0x0000000f /* To SB Mail S/W interrupts mask */ -#define I_SMB_SW_SHIFT 0 /* To SB Mail S/W interrupts shift */ -#define I_HMB_SW0 (1 << 4) /* To Host Mail S/W interrupt 0 */ -#define I_HMB_SW1 (1 << 5) /* To Host Mail S/W interrupt 1 */ -#define I_HMB_SW2 (1 << 6) /* To Host Mail S/W interrupt 2 */ -#define I_HMB_SW3 (1 << 7) /* To Host Mail S/W interrupt 3 */ -#define I_HMB_SW_MASK 0x000000f0 /* To Host Mail S/W interrupts mask */ -#define I_HMB_SW_SHIFT 4 /* To Host Mail S/W interrupts shift */ -#define I_WR_OOSYNC (1 << 8) /* Write Frame Out Of Sync */ -#define I_RD_OOSYNC (1 << 9) /* Read Frame Out Of Sync */ -#define I_PC (1 << 10) /* descriptor error */ -#define I_PD (1 << 11) /* data error */ -#define I_DE (1 << 12) /* Descriptor protocol Error */ -#define I_RU (1 << 13) /* Receive descriptor Underflow */ -#define I_RO (1 << 14) /* Receive fifo Overflow */ -#define I_XU (1 << 15) /* Transmit fifo Underflow */ -#define I_RI (1 << 16) /* Receive Interrupt */ -#define I_BUSPWR (1 << 17) /* SDIO Bus Power Change (rev 9) */ -#define I_XMTDATA_AVAIL (1 << 23) /* bits in fifo */ -#define I_XI (1 << 24) /* Transmit Interrupt */ -#define I_RF_TERM (1 << 25) /* Read Frame Terminate */ -#define I_WF_TERM (1 << 26) /* Write Frame Terminate */ -#define I_PCMCIA_XU (1 << 27) /* PCMCIA Transmit FIFO Underflow */ -#define I_SBINT (1 << 28) /* sbintstatus Interrupt */ -#define I_CHIPACTIVE (1 << 29) /* chip from doze to active state */ -#define I_SRESET (1 << 30) /* CCCR RES interrupt */ -#define I_IOE2 (1U << 31) /* CCCR IOE2 Bit Changed */ -#define I_ERRORS (I_PC | I_PD | I_DE | I_RU | I_RO | I_XU) -#define I_DMA (I_RI | I_XI | I_ERRORS) - -/* corecontrol */ -#define CC_CISRDY (1 << 0) /* CIS Ready */ -#define CC_BPRESEN (1 << 1) /* CCCR RES signal */ -#define CC_F2RDY (1 << 2) /* set CCCR IOR2 bit */ -#define CC_CLRPADSISO (1 << 3) /* clear SDIO pads isolation */ -#define CC_XMTDATAAVAIL_MODE (1 << 4) -#define CC_XMTDATAAVAIL_CTRL (1 << 5) - -/* SDA_FRAMECTRL */ -#define SFC_RF_TERM (1 << 0) /* Read Frame Terminate */ -#define SFC_WF_TERM (1 << 1) /* Write Frame Terminate */ -#define SFC_CRC4WOOS (1 << 2) /* CRC error for write out of sync */ -#define SFC_ABORTALL (1 << 3) /* Abort all in-progress frames */ - -/* HW frame tag */ -#define SDPCM_FRAMETAG_LEN 4 /* 2 bytes len, 2 bytes check val */ - -/* Total length of frame header for dongle protocol */ -#define SDPCM_HDRLEN (SDPCM_FRAMETAG_LEN + SDPCM_SWHEADER_LEN) -#define SDPCM_RESERVE (SDPCM_HDRLEN + BRCMF_SDALIGN) - -/* - * Software allocation of To SB Mailbox resources - */ - -/* tosbmailbox bits corresponding to intstatus bits */ -#define SMB_NAK (1 << 0) /* Frame NAK */ -#define SMB_INT_ACK (1 << 1) /* Host Interrupt ACK */ -#define SMB_USE_OOB (1 << 2) /* Use OOB Wakeup */ -#define SMB_DEV_INT (1 << 3) /* Miscellaneous Interrupt */ - -/* tosbmailboxdata */ -#define SMB_DATA_VERSION_SHIFT 16 /* host protocol version */ - -/* - * Software allocation of To Host Mailbox resources - */ - -/* intstatus bits */ -#define I_HMB_FC_STATE I_HMB_SW0 /* Flow Control State */ -#define I_HMB_FC_CHANGE I_HMB_SW1 /* Flow Control State Changed */ -#define I_HMB_FRAME_IND I_HMB_SW2 /* Frame Indication */ -#define I_HMB_HOST_INT I_HMB_SW3 /* Miscellaneous Interrupt */ - -/* tohostmailboxdata */ -#define HMB_DATA_NAKHANDLED 1 /* retransmit NAK'd frame */ -#define HMB_DATA_DEVREADY 2 /* talk to host after enable */ -#define HMB_DATA_FC 4 /* per prio flowcontrol update flag */ -#define HMB_DATA_FWREADY 8 /* fw ready for protocol activity */ - -#define HMB_DATA_FCDATA_MASK 0xff000000 -#define HMB_DATA_FCDATA_SHIFT 24 - -#define HMB_DATA_VERSION_MASK 0x00ff0000 -#define HMB_DATA_VERSION_SHIFT 16 - -/* - * Software-defined protocol header - */ - -/* Current protocol version */ -#define SDPCM_PROT_VERSION 4 - -/* SW frame header */ -#define SDPCM_PACKET_SEQUENCE(p) (((u8 *)p)[0] & 0xff) - -#define SDPCM_CHANNEL_MASK 0x00000f00 -#define SDPCM_CHANNEL_SHIFT 8 -#define SDPCM_PACKET_CHANNEL(p) (((u8 *)p)[1] & 0x0f) - -#define SDPCM_NEXTLEN_OFFSET 2 - -/* Data Offset from SOF (HW Tag, SW Tag, Pad) */ -#define SDPCM_DOFFSET_OFFSET 3 /* Data Offset */ -#define SDPCM_DOFFSET_VALUE(p) (((u8 *)p)[SDPCM_DOFFSET_OFFSET] & 0xff) -#define SDPCM_DOFFSET_MASK 0xff000000 -#define SDPCM_DOFFSET_SHIFT 24 -#define SDPCM_FCMASK_OFFSET 4 /* Flow control */ -#define SDPCM_FCMASK_VALUE(p) (((u8 *)p)[SDPCM_FCMASK_OFFSET] & 0xff) -#define SDPCM_WINDOW_OFFSET 5 /* Credit based fc */ -#define SDPCM_WINDOW_VALUE(p) (((u8 *)p)[SDPCM_WINDOW_OFFSET] & 0xff) - -#define SDPCM_SWHEADER_LEN 8 /* SW header is 64 bits */ - -/* logical channel numbers */ -#define SDPCM_CONTROL_CHANNEL 0 /* Control channel Id */ -#define SDPCM_EVENT_CHANNEL 1 /* Asyc Event Indication Channel Id */ -#define SDPCM_DATA_CHANNEL 2 /* Data Xmit/Recv Channel Id */ -#define SDPCM_GLOM_CHANNEL 3 /* For coalesced packets */ -#define SDPCM_TEST_CHANNEL 15 /* Reserved for test/debug packets */ - -#define SDPCM_SEQUENCE_WRAP 256 /* wrap-around val for 8bit frame seq */ - -#define SDPCM_GLOMDESC(p) (((u8 *)p)[1] & 0x80) - -/* - * Shared structure between dongle and the host. - * The structure contains pointers to trap or assert information. - */ -#define SDPCM_SHARED_VERSION 0x0003 -#define SDPCM_SHARED_VERSION_MASK 0x00FF -#define SDPCM_SHARED_ASSERT_BUILT 0x0100 -#define SDPCM_SHARED_ASSERT 0x0200 -#define SDPCM_SHARED_TRAP 0x0400 - -/* Space for header read, limit for data packets */ -#define MAX_HDR_READ (1 << 6) -#define MAX_RX_DATASZ 2048 - -/* Maximum milliseconds to wait for F2 to come up */ -#define BRCMF_WAIT_F2RDY 3000 - -/* Bump up limit on waiting for HT to account for first startup; - * if the image is doing a CRC calculation before programming the PMU - * for HT availability, it could take a couple hundred ms more, so - * max out at a 1 second (1000000us). - */ -#undef PMU_MAX_TRANSITION_DLY -#define PMU_MAX_TRANSITION_DLY 1000000 - -/* Value for ChipClockCSR during initial setup */ -#define BRCMF_INIT_CLKCTL1 (SBSDIO_FORCE_HW_CLKREQ_OFF | \ - SBSDIO_ALP_AVAIL_REQ) - -/* Flags for SDH calls */ -#define F2SYNC (SDIO_REQ_4BYTE | SDIO_REQ_FIXED) - -#define BRCMF_SDIO_FW_NAME "brcm/brcmfmac-sdio.bin" -#define BRCMF_SDIO_NV_NAME "brcm/brcmfmac-sdio.txt" -MODULE_FIRMWARE(BRCMF_SDIO_FW_NAME); -MODULE_FIRMWARE(BRCMF_SDIO_NV_NAME); - -#define BRCMF_IDLE_IMMEDIATE (-1) /* Enter idle immediately */ -#define BRCMF_IDLE_ACTIVE 0 /* Do not request any SD clock change - * when idle - */ -#define BRCMF_IDLE_INTERVAL 1 - -#define KSO_WAIT_US 50 -#define MAX_KSO_ATTEMPTS (PMU_MAX_TRANSITION_DLY/KSO_WAIT_US) - -/* - * Conversion of 802.1D priority to precedence level - */ -static uint prio2prec(u32 prio) -{ - return (prio == PRIO_8021D_NONE || prio == PRIO_8021D_BE) ? - (prio^2) : prio; -} - -#ifdef DEBUG -/* Device console log buffer state */ -struct brcmf_console { - uint count; /* Poll interval msec counter */ - uint log_addr; /* Log struct address (fixed) */ - struct rte_log_le log_le; /* Log struct (host copy) */ - uint bufsize; /* Size of log buffer */ - u8 *buf; /* Log buffer (host copy) */ - uint last; /* Last buffer read index */ -}; - -struct brcmf_trap_info { - __le32 type; - __le32 epc; - __le32 cpsr; - __le32 spsr; - __le32 r0; /* a1 */ - __le32 r1; /* a2 */ - __le32 r2; /* a3 */ - __le32 r3; /* a4 */ - __le32 r4; /* v1 */ - __le32 r5; /* v2 */ - __le32 r6; /* v3 */ - __le32 r7; /* v4 */ - __le32 r8; /* v5 */ - __le32 r9; /* sb/v6 */ - __le32 r10; /* sl/v7 */ - __le32 r11; /* fp/v8 */ - __le32 r12; /* ip */ - __le32 r13; /* sp */ - __le32 r14; /* lr */ - __le32 pc; /* r15 */ -}; -#endif /* DEBUG */ - -struct sdpcm_shared { - u32 flags; - u32 trap_addr; - u32 assert_exp_addr; - u32 assert_file_addr; - u32 assert_line; - u32 console_addr; /* Address of struct rte_console */ - u32 msgtrace_addr; - u8 tag[32]; - u32 brpt_addr; -}; - -struct sdpcm_shared_le { - __le32 flags; - __le32 trap_addr; - __le32 assert_exp_addr; - __le32 assert_file_addr; - __le32 assert_line; - __le32 console_addr; /* Address of struct rte_console */ - __le32 msgtrace_addr; - u8 tag[32]; - __le32 brpt_addr; -}; - -/* SDIO read frame info */ -struct brcmf_sdio_read { - u8 seq_num; - u8 channel; - u16 len; - u16 len_left; - u16 len_nxtfrm; - u8 dat_offset; -}; - -/* misc chip info needed by some of the routines */ -/* Private data for SDIO bus interaction */ -struct brcmf_sdio { - struct brcmf_sdio_dev *sdiodev; /* sdio device handler */ - struct chip_info *ci; /* Chip info struct */ - char *vars; /* Variables (from CIS and/or other) */ - uint varsz; /* Size of variables buffer */ - - u32 ramsize; /* Size of RAM in SOCRAM (bytes) */ - - u32 hostintmask; /* Copy of Host Interrupt Mask */ - atomic_t intstatus; /* Intstatus bits (events) pending */ - atomic_t fcstate; /* State of dongle flow-control */ - - uint blocksize; /* Block size of SDIO transfers */ - uint roundup; /* Max roundup limit */ - - struct pktq txq; /* Queue length used for flow-control */ - u8 flowcontrol; /* per prio flow control bitmask */ - u8 tx_seq; /* Transmit sequence number (next) */ - u8 tx_max; /* Maximum transmit sequence allowed */ - - u8 hdrbuf[MAX_HDR_READ + BRCMF_SDALIGN]; - u8 *rxhdr; /* Header of current rx frame (in hdrbuf) */ - u8 rx_seq; /* Receive sequence number (expected) */ - struct brcmf_sdio_read cur_read; - /* info of current read frame */ - bool rxskip; /* Skip receive (awaiting NAK ACK) */ - bool rxpending; /* Data frame pending in dongle */ - - uint rxbound; /* Rx frames to read before resched */ - uint txbound; /* Tx frames to send before resched */ - uint txminmax; - - struct sk_buff *glomd; /* Packet containing glomming descriptor */ - struct sk_buff_head glom; /* Packet list for glommed superframe */ - uint glomerr; /* Glom packet read errors */ - - u8 *rxbuf; /* Buffer for receiving control packets */ - uint rxblen; /* Allocated length of rxbuf */ - u8 *rxctl; /* Aligned pointer into rxbuf */ - u8 *rxctl_orig; /* pointer for freeing rxctl */ - u8 *databuf; /* Buffer for receiving big glom packet */ - u8 *dataptr; /* Aligned pointer into databuf */ - uint rxlen; /* Length of valid data in buffer */ - spinlock_t rxctl_lock; /* protection lock for ctrl frame resources */ - - u8 sdpcm_ver; /* Bus protocol reported by dongle */ - - bool intr; /* Use interrupts */ - bool poll; /* Use polling */ - atomic_t ipend; /* Device interrupt is pending */ - uint spurious; /* Count of spurious interrupts */ - uint pollrate; /* Ticks between device polls */ - uint polltick; /* Tick counter */ - -#ifdef DEBUG - uint console_interval; - struct brcmf_console console; /* Console output polling support */ - uint console_addr; /* Console address from shared struct */ -#endif /* DEBUG */ - - uint clkstate; /* State of sd and backplane clock(s) */ - bool activity; /* Activity flag for clock down */ - s32 idletime; /* Control for activity timeout */ - s32 idlecount; /* Activity timeout counter */ - s32 idleclock; /* How to set bus driver when idle */ - s32 sd_rxchain; - bool use_rxchain; /* If brcmf should use PKT chains */ - bool rxflow_mode; /* Rx flow control mode */ - bool rxflow; /* Is rx flow control on */ - bool alp_only; /* Don't use HT clock (ALP only) */ - - u8 *ctrl_frame_buf; - u32 ctrl_frame_len; - bool ctrl_frame_stat; - - spinlock_t txqlock; - wait_queue_head_t ctrl_wait; - wait_queue_head_t dcmd_resp_wait; - - struct timer_list timer; - struct completion watchdog_wait; - struct task_struct *watchdog_tsk; - bool wd_timer_valid; - uint save_ms; - - struct workqueue_struct *brcmf_wq; - struct work_struct datawork; - struct list_head dpc_tsklst; - spinlock_t dpc_tl_lock; - - const struct firmware *firmware; - u32 fw_ptr; - - bool txoff; /* Transmit flow-controlled */ - struct brcmf_sdio_count sdcnt; - bool sr_enabled; /* SaveRestore enabled */ - bool sleeping; /* SDIO bus sleeping */ -}; - -/* clkstate */ -#define CLK_NONE 0 -#define CLK_SDONLY 1 -#define CLK_PENDING 2 -#define CLK_AVAIL 3 - -#ifdef DEBUG -static int qcount[NUMPRIO]; -static int tx_packets[NUMPRIO]; -#endif /* DEBUG */ - -#define DEFAULT_SDIO_DRIVE_STRENGTH 6 /* in milliamps */ - -#define RETRYCHAN(chan) ((chan) == SDPCM_EVENT_CHANNEL) - -/* Retry count for register access failures */ -static const uint retry_limit = 2; - -/* Limit on rounding up frames */ -static const uint max_roundup = 512; - -#define ALIGNMENT 4 - -enum brcmf_sdio_frmtype { - BRCMF_SDIO_FT_NORMAL, - BRCMF_SDIO_FT_SUPER, - BRCMF_SDIO_FT_SUB, -}; - -static void pkt_align(struct sk_buff *p, int len, int align) -{ - uint datalign; - datalign = (unsigned long)(p->data); - datalign = roundup(datalign, (align)) - datalign; - if (datalign) - skb_pull(p, datalign); - __skb_trim(p, len); -} - -/* To check if there's window offered */ -static bool data_ok(struct brcmf_sdio *bus) -{ - return (u8)(bus->tx_max - bus->tx_seq) != 0 && - ((u8)(bus->tx_max - bus->tx_seq) & 0x80) == 0; -} - -/* - * Reads a register in the SDIO hardware block. This block occupies a series of - * adresses on the 32 bit backplane bus. - */ -static int -r_sdreg32(struct brcmf_sdio *bus, u32 *regvar, u32 offset) -{ - u8 idx = brcmf_sdio_chip_getinfidx(bus->ci, BCMA_CORE_SDIO_DEV); - int ret; - - *regvar = brcmf_sdio_regrl(bus->sdiodev, - bus->ci->c_inf[idx].base + offset, &ret); - - return ret; -} - -static int -w_sdreg32(struct brcmf_sdio *bus, u32 regval, u32 reg_offset) -{ - u8 idx = brcmf_sdio_chip_getinfidx(bus->ci, BCMA_CORE_SDIO_DEV); - int ret; - - brcmf_sdio_regwl(bus->sdiodev, - bus->ci->c_inf[idx].base + reg_offset, - regval, &ret); - - return ret; -} - -static int -brcmf_sdbrcm_kso_control(struct brcmf_sdio *bus, bool on) -{ - u8 wr_val = 0, rd_val, cmp_val, bmask; - int err = 0; - int try_cnt = 0; - - brcmf_dbg(TRACE, "Enter\n"); - - wr_val = (on << SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT); - /* 1st KSO write goes to AOS wake up core if device is asleep */ - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, - wr_val, &err); - if (err) { - brcmf_err("SDIO_AOS KSO write error: %d\n", err); - return err; - } - - if (on) { - /* device WAKEUP through KSO: - * write bit 0 & read back until - * both bits 0 (kso bit) & 1 (dev on status) are set - */ - cmp_val = SBSDIO_FUNC1_SLEEPCSR_KSO_MASK | - SBSDIO_FUNC1_SLEEPCSR_DEVON_MASK; - bmask = cmp_val; - usleep_range(2000, 3000); - } else { - /* Put device to sleep, turn off KSO */ - cmp_val = 0; - /* only check for bit0, bit1(dev on status) may not - * get cleared right away - */ - bmask = SBSDIO_FUNC1_SLEEPCSR_KSO_MASK; - } - - do { - /* reliable KSO bit set/clr: - * the sdiod sleep write access is synced to PMU 32khz clk - * just one write attempt may fail, - * read it back until it matches written value - */ - rd_val = brcmf_sdio_regrb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, - &err); - if (((rd_val & bmask) == cmp_val) && !err) - break; - brcmf_dbg(SDIO, "KSO wr/rd retry:%d (max: %d) ERR:%x\n", - try_cnt, MAX_KSO_ATTEMPTS, err); - udelay(KSO_WAIT_US); - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, - wr_val, &err); - } while (try_cnt++ < MAX_KSO_ATTEMPTS); - - return err; -} - -#define PKT_AVAILABLE() (intstatus & I_HMB_FRAME_IND) - -#define HOSTINTMASK (I_HMB_SW_MASK | I_CHIPACTIVE) - -/* Turn backplane clock on or off */ -static int brcmf_sdbrcm_htclk(struct brcmf_sdio *bus, bool on, bool pendok) -{ - int err; - u8 clkctl, clkreq, devctl; - unsigned long timeout; - - brcmf_dbg(SDIO, "Enter\n"); - - clkctl = 0; - - if (bus->sr_enabled) { - bus->clkstate = (on ? CLK_AVAIL : CLK_SDONLY); - return 0; - } - - if (on) { - /* Request HT Avail */ - clkreq = - bus->alp_only ? SBSDIO_ALP_AVAIL_REQ : SBSDIO_HT_AVAIL_REQ; - - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, - clkreq, &err); - if (err) { - brcmf_err("HT Avail request error: %d\n", err); - return -EBADE; - } - - /* Check current status */ - clkctl = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_FUNC1_CHIPCLKCSR, &err); - if (err) { - brcmf_err("HT Avail read error: %d\n", err); - return -EBADE; - } - - /* Go to pending and await interrupt if appropriate */ - if (!SBSDIO_CLKAV(clkctl, bus->alp_only) && pendok) { - /* Allow only clock-available interrupt */ - devctl = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_DEVICE_CTL, &err); - if (err) { - brcmf_err("Devctl error setting CA: %d\n", - err); - return -EBADE; - } - - devctl |= SBSDIO_DEVCTL_CA_INT_ONLY; - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL, - devctl, &err); - brcmf_dbg(SDIO, "CLKCTL: set PENDING\n"); - bus->clkstate = CLK_PENDING; - - return 0; - } else if (bus->clkstate == CLK_PENDING) { - /* Cancel CA-only interrupt filter */ - devctl = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_DEVICE_CTL, &err); - devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL, - devctl, &err); - } - - /* Otherwise, wait here (polling) for HT Avail */ - timeout = jiffies + - msecs_to_jiffies(PMU_MAX_TRANSITION_DLY/1000); - while (!SBSDIO_CLKAV(clkctl, bus->alp_only)) { - clkctl = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_FUNC1_CHIPCLKCSR, - &err); - if (time_after(jiffies, timeout)) - break; - else - usleep_range(5000, 10000); - } - if (err) { - brcmf_err("HT Avail request error: %d\n", err); - return -EBADE; - } - if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) { - brcmf_err("HT Avail timeout (%d): clkctl 0x%02x\n", - PMU_MAX_TRANSITION_DLY, clkctl); - return -EBADE; - } - - /* Mark clock available */ - bus->clkstate = CLK_AVAIL; - brcmf_dbg(SDIO, "CLKCTL: turned ON\n"); - -#if defined(DEBUG) - if (!bus->alp_only) { - if (SBSDIO_ALPONLY(clkctl)) - brcmf_err("HT Clock should be on\n"); - } -#endif /* defined (DEBUG) */ - - bus->activity = true; - } else { - clkreq = 0; - - if (bus->clkstate == CLK_PENDING) { - /* Cancel CA-only interrupt filter */ - devctl = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_DEVICE_CTL, &err); - devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL, - devctl, &err); - } - - bus->clkstate = CLK_SDONLY; - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, - clkreq, &err); - brcmf_dbg(SDIO, "CLKCTL: turned OFF\n"); - if (err) { - brcmf_err("Failed access turning clock off: %d\n", - err); - return -EBADE; - } - } - return 0; -} - -/* Change idle/active SD state */ -static int brcmf_sdbrcm_sdclk(struct brcmf_sdio *bus, bool on) -{ - brcmf_dbg(SDIO, "Enter\n"); - - if (on) - bus->clkstate = CLK_SDONLY; - else - bus->clkstate = CLK_NONE; - - return 0; -} - -/* Transition SD and backplane clock readiness */ -static int brcmf_sdbrcm_clkctl(struct brcmf_sdio *bus, uint target, bool pendok) -{ -#ifdef DEBUG - uint oldstate = bus->clkstate; -#endif /* DEBUG */ - - brcmf_dbg(SDIO, "Enter\n"); - - /* Early exit if we're already there */ - if (bus->clkstate == target) { - if (target == CLK_AVAIL) { - brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS); - bus->activity = true; - } - return 0; - } - - switch (target) { - case CLK_AVAIL: - /* Make sure SD clock is available */ - if (bus->clkstate == CLK_NONE) - brcmf_sdbrcm_sdclk(bus, true); - /* Now request HT Avail on the backplane */ - brcmf_sdbrcm_htclk(bus, true, pendok); - brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS); - bus->activity = true; - break; - - case CLK_SDONLY: - /* Remove HT request, or bring up SD clock */ - if (bus->clkstate == CLK_NONE) - brcmf_sdbrcm_sdclk(bus, true); - else if (bus->clkstate == CLK_AVAIL) - brcmf_sdbrcm_htclk(bus, false, false); - else - brcmf_err("request for %d -> %d\n", - bus->clkstate, target); - brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS); - break; - - case CLK_NONE: - /* Make sure to remove HT request */ - if (bus->clkstate == CLK_AVAIL) - brcmf_sdbrcm_htclk(bus, false, false); - /* Now remove the SD clock */ - brcmf_sdbrcm_sdclk(bus, false); - brcmf_sdbrcm_wd_timer(bus, 0); - break; - } -#ifdef DEBUG - brcmf_dbg(SDIO, "%d -> %d\n", oldstate, bus->clkstate); -#endif /* DEBUG */ - - return 0; -} - -static int -brcmf_sdbrcm_bus_sleep(struct brcmf_sdio *bus, bool sleep, bool pendok) -{ - int err = 0; - brcmf_dbg(TRACE, "Enter\n"); - brcmf_dbg(SDIO, "request %s currently %s\n", - (sleep ? "SLEEP" : "WAKE"), - (bus->sleeping ? "SLEEP" : "WAKE")); - - /* If SR is enabled control bus state with KSO */ - if (bus->sr_enabled) { - /* Done if we're already in the requested state */ - if (sleep == bus->sleeping) - goto end; - - /* Going to sleep */ - if (sleep) { - /* Don't sleep if something is pending */ - if (atomic_read(&bus->intstatus) || - atomic_read(&bus->ipend) > 0 || - (!atomic_read(&bus->fcstate) && - brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) && - data_ok(bus))) - return -EBUSY; - err = brcmf_sdbrcm_kso_control(bus, false); - /* disable watchdog */ - if (!err) - brcmf_sdbrcm_wd_timer(bus, 0); - } else { - bus->idlecount = 0; - err = brcmf_sdbrcm_kso_control(bus, true); - } - if (!err) { - /* Change state */ - bus->sleeping = sleep; - brcmf_dbg(SDIO, "new state %s\n", - (sleep ? "SLEEP" : "WAKE")); - } else { - brcmf_err("error while changing bus sleep state %d\n", - err); - return err; - } - } - -end: - /* control clocks */ - if (sleep) { - if (!bus->sr_enabled) - brcmf_sdbrcm_clkctl(bus, CLK_NONE, pendok); - } else { - brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, pendok); - } - - return err; - -} - -static u32 brcmf_sdbrcm_hostmail(struct brcmf_sdio *bus) -{ - u32 intstatus = 0; - u32 hmb_data; - u8 fcbits; - int ret; - - brcmf_dbg(SDIO, "Enter\n"); - - /* Read mailbox data and ack that we did so */ - ret = r_sdreg32(bus, &hmb_data, - offsetof(struct sdpcmd_regs, tohostmailboxdata)); - - if (ret == 0) - w_sdreg32(bus, SMB_INT_ACK, - offsetof(struct sdpcmd_regs, tosbmailbox)); - bus->sdcnt.f1regdata += 2; - - /* Dongle recomposed rx frames, accept them again */ - if (hmb_data & HMB_DATA_NAKHANDLED) { - brcmf_dbg(SDIO, "Dongle reports NAK handled, expect rtx of %d\n", - bus->rx_seq); - if (!bus->rxskip) - brcmf_err("unexpected NAKHANDLED!\n"); - - bus->rxskip = false; - intstatus |= I_HMB_FRAME_IND; - } - - /* - * DEVREADY does not occur with gSPI. - */ - if (hmb_data & (HMB_DATA_DEVREADY | HMB_DATA_FWREADY)) { - bus->sdpcm_ver = - (hmb_data & HMB_DATA_VERSION_MASK) >> - HMB_DATA_VERSION_SHIFT; - if (bus->sdpcm_ver != SDPCM_PROT_VERSION) - brcmf_err("Version mismatch, dongle reports %d, " - "expecting %d\n", - bus->sdpcm_ver, SDPCM_PROT_VERSION); - else - brcmf_dbg(SDIO, "Dongle ready, protocol version %d\n", - bus->sdpcm_ver); - } - - /* - * Flow Control has been moved into the RX headers and this out of band - * method isn't used any more. - * remaining backward compatible with older dongles. - */ - if (hmb_data & HMB_DATA_FC) { - fcbits = (hmb_data & HMB_DATA_FCDATA_MASK) >> - HMB_DATA_FCDATA_SHIFT; - - if (fcbits & ~bus->flowcontrol) - bus->sdcnt.fc_xoff++; - - if (bus->flowcontrol & ~fcbits) - bus->sdcnt.fc_xon++; - - bus->sdcnt.fc_rcvd++; - bus->flowcontrol = fcbits; - } - - /* Shouldn't be any others */ - if (hmb_data & ~(HMB_DATA_DEVREADY | - HMB_DATA_NAKHANDLED | - HMB_DATA_FC | - HMB_DATA_FWREADY | - HMB_DATA_FCDATA_MASK | HMB_DATA_VERSION_MASK)) - brcmf_err("Unknown mailbox data content: 0x%02x\n", - hmb_data); - - return intstatus; -} - -static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx) -{ - uint retries = 0; - u16 lastrbc; - u8 hi, lo; - int err; - - brcmf_err("%sterminate frame%s\n", - abort ? "abort command, " : "", - rtx ? ", send NAK" : ""); - - if (abort) - brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2); - - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL, - SFC_RF_TERM, &err); - bus->sdcnt.f1regdata++; - - /* Wait until the packet has been flushed (device/FIFO stable) */ - for (lastrbc = retries = 0xffff; retries > 0; retries--) { - hi = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_FUNC1_RFRAMEBCHI, &err); - lo = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_FUNC1_RFRAMEBCLO, &err); - bus->sdcnt.f1regdata += 2; - - if ((hi == 0) && (lo == 0)) - break; - - if ((hi > (lastrbc >> 8)) && (lo > (lastrbc & 0x00ff))) { - brcmf_err("count growing: last 0x%04x now 0x%04x\n", - lastrbc, (hi << 8) + lo); - } - lastrbc = (hi << 8) + lo; - } - - if (!retries) - brcmf_err("count never zeroed: last 0x%04x\n", lastrbc); - else - brcmf_dbg(SDIO, "flush took %d iterations\n", 0xffff - retries); - - if (rtx) { - bus->sdcnt.rxrtx++; - err = w_sdreg32(bus, SMB_NAK, - offsetof(struct sdpcmd_regs, tosbmailbox)); - - bus->sdcnt.f1regdata++; - if (err == 0) - bus->rxskip = true; - } - - /* Clear partial in any case */ - bus->cur_read.len = 0; - - /* If we can't reach the device, signal failure */ - if (err) - bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; -} - -/* copy a buffer into a pkt buffer chain */ -static uint brcmf_sdbrcm_glom_from_buf(struct brcmf_sdio *bus, uint len) -{ - uint n, ret = 0; - struct sk_buff *p; - u8 *buf; - - buf = bus->dataptr; - - /* copy the data */ - skb_queue_walk(&bus->glom, p) { - n = min_t(uint, p->len, len); - memcpy(p->data, buf, n); - buf += n; - len -= n; - ret += n; - if (!len) - break; - } - - return ret; -} - -/* return total length of buffer chain */ -static uint brcmf_sdbrcm_glom_len(struct brcmf_sdio *bus) -{ - struct sk_buff *p; - uint total; - - total = 0; - skb_queue_walk(&bus->glom, p) - total += p->len; - return total; -} - -static void brcmf_sdbrcm_free_glom(struct brcmf_sdio *bus) -{ - struct sk_buff *cur, *next; - - skb_queue_walk_safe(&bus->glom, cur, next) { - skb_unlink(cur, &bus->glom); - brcmu_pkt_buf_free_skb(cur); - } -} - -static int brcmf_sdio_hdparser(struct brcmf_sdio *bus, u8 *header, - struct brcmf_sdio_read *rd, - enum brcmf_sdio_frmtype type) -{ - u16 len, checksum; - u8 rx_seq, fc, tx_seq_max; - - /* - * 4 bytes hardware header (frame tag) - * Byte 0~1: Frame length - * Byte 2~3: Checksum, bit-wise inverse of frame length - */ - len = get_unaligned_le16(header); - checksum = get_unaligned_le16(header + sizeof(u16)); - /* All zero means no more to read */ - if (!(len | checksum)) { - bus->rxpending = false; - return -ENODATA; - } - if ((u16)(~(len ^ checksum))) { - brcmf_err("HW header checksum error\n"); - bus->sdcnt.rx_badhdr++; - brcmf_sdbrcm_rxfail(bus, false, false); - return -EIO; - } - if (len < SDPCM_HDRLEN) { - brcmf_err("HW header length error\n"); - return -EPROTO; - } - if (type == BRCMF_SDIO_FT_SUPER && - (roundup(len, bus->blocksize) != rd->len)) { - brcmf_err("HW superframe header length error\n"); - return -EPROTO; - } - if (type == BRCMF_SDIO_FT_SUB && len > rd->len) { - brcmf_err("HW subframe header length error\n"); - return -EPROTO; - } - rd->len = len; - - /* - * 8 bytes hardware header - * Byte 0: Rx sequence number - * Byte 1: 4 MSB Channel number, 4 LSB arbitrary flag - * Byte 2: Length of next data frame - * Byte 3: Data offset - * Byte 4: Flow control bits - * Byte 5: Maximum Sequence number allow for Tx - * Byte 6~7: Reserved - */ - if (type == BRCMF_SDIO_FT_SUPER && - SDPCM_GLOMDESC(&header[SDPCM_FRAMETAG_LEN])) { - brcmf_err("Glom descriptor found in superframe head\n"); - rd->len = 0; - return -EINVAL; - } - rx_seq = SDPCM_PACKET_SEQUENCE(&header[SDPCM_FRAMETAG_LEN]); - rd->channel = SDPCM_PACKET_CHANNEL(&header[SDPCM_FRAMETAG_LEN]); - if (len > MAX_RX_DATASZ && rd->channel != SDPCM_CONTROL_CHANNEL && - type != BRCMF_SDIO_FT_SUPER) { - brcmf_err("HW header length too long\n"); - bus->sdcnt.rx_toolong++; - brcmf_sdbrcm_rxfail(bus, false, false); - rd->len = 0; - return -EPROTO; - } - if (type == BRCMF_SDIO_FT_SUPER && rd->channel != SDPCM_GLOM_CHANNEL) { - brcmf_err("Wrong channel for superframe\n"); - rd->len = 0; - return -EINVAL; - } - if (type == BRCMF_SDIO_FT_SUB && rd->channel != SDPCM_DATA_CHANNEL && - rd->channel != SDPCM_EVENT_CHANNEL) { - brcmf_err("Wrong channel for subframe\n"); - rd->len = 0; - return -EINVAL; - } - rd->dat_offset = SDPCM_DOFFSET_VALUE(&header[SDPCM_FRAMETAG_LEN]); - if (rd->dat_offset < SDPCM_HDRLEN || rd->dat_offset > rd->len) { - brcmf_err("seq %d: bad data offset\n", rx_seq); - bus->sdcnt.rx_badhdr++; - brcmf_sdbrcm_rxfail(bus, false, false); - rd->len = 0; - return -ENXIO; - } - if (rd->seq_num != rx_seq) { - brcmf_err("seq %d: sequence number error, expect %d\n", - rx_seq, rd->seq_num); - bus->sdcnt.rx_badseq++; - rd->seq_num = rx_seq; - } - /* no need to check the reset for subframe */ - if (type == BRCMF_SDIO_FT_SUB) - return 0; - rd->len_nxtfrm = header[SDPCM_FRAMETAG_LEN + SDPCM_NEXTLEN_OFFSET]; - if (rd->len_nxtfrm << 4 > MAX_RX_DATASZ) { - /* only warm for NON glom packet */ - if (rd->channel != SDPCM_GLOM_CHANNEL) - brcmf_err("seq %d: next length error\n", rx_seq); - rd->len_nxtfrm = 0; - } - fc = SDPCM_FCMASK_VALUE(&header[SDPCM_FRAMETAG_LEN]); - if (bus->flowcontrol != fc) { - if (~bus->flowcontrol & fc) - bus->sdcnt.fc_xoff++; - if (bus->flowcontrol & ~fc) - bus->sdcnt.fc_xon++; - bus->sdcnt.fc_rcvd++; - bus->flowcontrol = fc; - } - tx_seq_max = SDPCM_WINDOW_VALUE(&header[SDPCM_FRAMETAG_LEN]); - if ((u8)(tx_seq_max - bus->tx_seq) > 0x40) { - brcmf_err("seq %d: max tx seq number error\n", rx_seq); - tx_seq_max = bus->tx_seq + 2; - } - bus->tx_max = tx_seq_max; - - return 0; -} - -static u8 brcmf_sdbrcm_rxglom(struct brcmf_sdio *bus, u8 rxseq) -{ - u16 dlen, totlen; - u8 *dptr, num = 0; - - u16 sublen; - struct sk_buff *pfirst, *pnext; - - int errcode; - u8 doff, sfdoff; - - bool usechain = bus->use_rxchain; - - struct brcmf_sdio_read rd_new; - - /* If packets, issue read(s) and send up packet chain */ - /* Return sequence numbers consumed? */ - - brcmf_dbg(SDIO, "start: glomd %p glom %p\n", - bus->glomd, skb_peek(&bus->glom)); - - /* If there's a descriptor, generate the packet chain */ - if (bus->glomd) { - pfirst = pnext = NULL; - dlen = (u16) (bus->glomd->len); - dptr = bus->glomd->data; - if (!dlen || (dlen & 1)) { - brcmf_err("bad glomd len(%d), ignore descriptor\n", - dlen); - dlen = 0; - } - - for (totlen = num = 0; dlen; num++) { - /* Get (and move past) next length */ - sublen = get_unaligned_le16(dptr); - dlen -= sizeof(u16); - dptr += sizeof(u16); - if ((sublen < SDPCM_HDRLEN) || - ((num == 0) && (sublen < (2 * SDPCM_HDRLEN)))) { - brcmf_err("descriptor len %d bad: %d\n", - num, sublen); - pnext = NULL; - break; - } - if (sublen % BRCMF_SDALIGN) { - brcmf_err("sublen %d not multiple of %d\n", - sublen, BRCMF_SDALIGN); - usechain = false; - } - totlen += sublen; - - /* For last frame, adjust read len so total - is a block multiple */ - if (!dlen) { - sublen += - (roundup(totlen, bus->blocksize) - totlen); - totlen = roundup(totlen, bus->blocksize); - } - - /* Allocate/chain packet for next subframe */ - pnext = brcmu_pkt_buf_get_skb(sublen + BRCMF_SDALIGN); - if (pnext == NULL) { - brcmf_err("bcm_pkt_buf_get_skb failed, num %d len %d\n", - num, sublen); - break; - } - skb_queue_tail(&bus->glom, pnext); - - /* Adhere to start alignment requirements */ - pkt_align(pnext, sublen, BRCMF_SDALIGN); - } - - /* If all allocations succeeded, save packet chain - in bus structure */ - if (pnext) { - brcmf_dbg(GLOM, "allocated %d-byte packet chain for %d subframes\n", - totlen, num); - if (BRCMF_GLOM_ON() && bus->cur_read.len && - totlen != bus->cur_read.len) { - brcmf_dbg(GLOM, "glomdesc mismatch: nextlen %d glomdesc %d rxseq %d\n", - bus->cur_read.len, totlen, rxseq); - } - pfirst = pnext = NULL; - } else { - brcmf_sdbrcm_free_glom(bus); - num = 0; - } - - /* Done with descriptor packet */ - brcmu_pkt_buf_free_skb(bus->glomd); - bus->glomd = NULL; - bus->cur_read.len = 0; - } - - /* Ok -- either we just generated a packet chain, - or had one from before */ - if (!skb_queue_empty(&bus->glom)) { - if (BRCMF_GLOM_ON()) { - brcmf_dbg(GLOM, "try superframe read, packet chain:\n"); - skb_queue_walk(&bus->glom, pnext) { - brcmf_dbg(GLOM, " %p: %p len 0x%04x (%d)\n", - pnext, (u8 *) (pnext->data), - pnext->len, pnext->len); - } - } - - pfirst = skb_peek(&bus->glom); - dlen = (u16) brcmf_sdbrcm_glom_len(bus); - - /* Do an SDIO read for the superframe. Configurable iovar to - * read directly into the chained packet, or allocate a large - * packet and and copy into the chain. - */ - sdio_claim_host(bus->sdiodev->func[1]); - if (usechain) { - errcode = brcmf_sdcard_recv_chain(bus->sdiodev, - bus->sdiodev->sbwad, - SDIO_FUNC_2, F2SYNC, &bus->glom); - } else if (bus->dataptr) { - errcode = brcmf_sdcard_recv_buf(bus->sdiodev, - bus->sdiodev->sbwad, - SDIO_FUNC_2, F2SYNC, - bus->dataptr, dlen); - sublen = (u16) brcmf_sdbrcm_glom_from_buf(bus, dlen); - if (sublen != dlen) { - brcmf_err("FAILED TO COPY, dlen %d sublen %d\n", - dlen, sublen); - errcode = -1; - } - pnext = NULL; - } else { - brcmf_err("COULDN'T ALLOC %d-BYTE GLOM, FORCE FAILURE\n", - dlen); - errcode = -1; - } - sdio_release_host(bus->sdiodev->func[1]); - bus->sdcnt.f2rxdata++; - - /* On failure, kill the superframe, allow a couple retries */ - if (errcode < 0) { - brcmf_err("glom read of %d bytes failed: %d\n", - dlen, errcode); - - sdio_claim_host(bus->sdiodev->func[1]); - if (bus->glomerr++ < 3) { - brcmf_sdbrcm_rxfail(bus, true, true); - } else { - bus->glomerr = 0; - brcmf_sdbrcm_rxfail(bus, true, false); - bus->sdcnt.rxglomfail++; - brcmf_sdbrcm_free_glom(bus); - } - sdio_release_host(bus->sdiodev->func[1]); - return 0; - } - - brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), - pfirst->data, min_t(int, pfirst->len, 48), - "SUPERFRAME:\n"); - - rd_new.seq_num = rxseq; - rd_new.len = dlen; - sdio_claim_host(bus->sdiodev->func[1]); - errcode = brcmf_sdio_hdparser(bus, pfirst->data, &rd_new, - BRCMF_SDIO_FT_SUPER); - sdio_release_host(bus->sdiodev->func[1]); - bus->cur_read.len = rd_new.len_nxtfrm << 4; - - /* Remove superframe header, remember offset */ - skb_pull(pfirst, rd_new.dat_offset); - sfdoff = rd_new.dat_offset; - num = 0; - - /* Validate all the subframe headers */ - skb_queue_walk(&bus->glom, pnext) { - /* leave when invalid subframe is found */ - if (errcode) - break; - - rd_new.len = pnext->len; - rd_new.seq_num = rxseq++; - sdio_claim_host(bus->sdiodev->func[1]); - errcode = brcmf_sdio_hdparser(bus, pnext->data, &rd_new, - BRCMF_SDIO_FT_SUB); - sdio_release_host(bus->sdiodev->func[1]); - brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), - pnext->data, 32, "subframe:\n"); - - num++; - } - - if (errcode) { - /* Terminate frame on error, request - a couple retries */ - sdio_claim_host(bus->sdiodev->func[1]); - if (bus->glomerr++ < 3) { - /* Restore superframe header space */ - skb_push(pfirst, sfdoff); - brcmf_sdbrcm_rxfail(bus, true, true); - } else { - bus->glomerr = 0; - brcmf_sdbrcm_rxfail(bus, true, false); - bus->sdcnt.rxglomfail++; - brcmf_sdbrcm_free_glom(bus); - } - sdio_release_host(bus->sdiodev->func[1]); - bus->cur_read.len = 0; - return 0; - } - - /* Basic SD framing looks ok - process each packet (header) */ - - skb_queue_walk_safe(&bus->glom, pfirst, pnext) { - dptr = (u8 *) (pfirst->data); - sublen = get_unaligned_le16(dptr); - doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]); - - brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_DATA_ON(), - dptr, pfirst->len, - "Rx Subframe Data:\n"); - - __skb_trim(pfirst, sublen); - skb_pull(pfirst, doff); - - if (pfirst->len == 0) { - skb_unlink(pfirst, &bus->glom); - brcmu_pkt_buf_free_skb(pfirst); - continue; - } - - brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), - pfirst->data, - min_t(int, pfirst->len, 32), - "subframe %d to stack, %p (%p/%d) nxt/lnk %p/%p\n", - bus->glom.qlen, pfirst, pfirst->data, - pfirst->len, pfirst->next, - pfirst->prev); - } - /* sent any remaining packets up */ - if (bus->glom.qlen) - brcmf_rx_frames(bus->sdiodev->dev, &bus->glom); - - bus->sdcnt.rxglomframes++; - bus->sdcnt.rxglompkts += bus->glom.qlen; - } - return num; -} - -static int brcmf_sdbrcm_dcmd_resp_wait(struct brcmf_sdio *bus, uint *condition, - bool *pending) -{ - DECLARE_WAITQUEUE(wait, current); - int timeout = msecs_to_jiffies(DCMD_RESP_TIMEOUT); - - /* Wait until control frame is available */ - add_wait_queue(&bus->dcmd_resp_wait, &wait); - set_current_state(TASK_INTERRUPTIBLE); - - while (!(*condition) && (!signal_pending(current) && timeout)) - timeout = schedule_timeout(timeout); - - if (signal_pending(current)) - *pending = true; - - set_current_state(TASK_RUNNING); - remove_wait_queue(&bus->dcmd_resp_wait, &wait); - - return timeout; -} - -static int brcmf_sdbrcm_dcmd_resp_wake(struct brcmf_sdio *bus) -{ - if (waitqueue_active(&bus->dcmd_resp_wait)) - wake_up_interruptible(&bus->dcmd_resp_wait); - - return 0; -} -static void -brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff) -{ - uint rdlen, pad; - u8 *buf = NULL, *rbuf; - int sdret; - - brcmf_dbg(TRACE, "Enter\n"); - - if (bus->rxblen) - buf = vzalloc(bus->rxblen); - if (!buf) - goto done; - - rbuf = bus->rxbuf; - pad = ((unsigned long)rbuf % BRCMF_SDALIGN); - if (pad) - rbuf += (BRCMF_SDALIGN - pad); - - /* Copy the already-read portion over */ - memcpy(buf, hdr, BRCMF_FIRSTREAD); - if (len <= BRCMF_FIRSTREAD) - goto gotpkt; - - /* Raise rdlen to next SDIO block to avoid tail command */ - rdlen = len - BRCMF_FIRSTREAD; - if (bus->roundup && bus->blocksize && (rdlen > bus->blocksize)) { - pad = bus->blocksize - (rdlen % bus->blocksize); - if ((pad <= bus->roundup) && (pad < bus->blocksize) && - ((len + pad) < bus->sdiodev->bus_if->maxctl)) - rdlen += pad; - } else if (rdlen % BRCMF_SDALIGN) { - rdlen += BRCMF_SDALIGN - (rdlen % BRCMF_SDALIGN); - } - - /* Satisfy length-alignment requirements */ - if (rdlen & (ALIGNMENT - 1)) - rdlen = roundup(rdlen, ALIGNMENT); - - /* Drop if the read is too big or it exceeds our maximum */ - if ((rdlen + BRCMF_FIRSTREAD) > bus->sdiodev->bus_if->maxctl) { - brcmf_err("%d-byte control read exceeds %d-byte buffer\n", - rdlen, bus->sdiodev->bus_if->maxctl); - brcmf_sdbrcm_rxfail(bus, false, false); - goto done; - } - - if ((len - doff) > bus->sdiodev->bus_if->maxctl) { - brcmf_err("%d-byte ctl frame (%d-byte ctl data) exceeds %d-byte limit\n", - len, len - doff, bus->sdiodev->bus_if->maxctl); - bus->sdcnt.rx_toolong++; - brcmf_sdbrcm_rxfail(bus, false, false); - goto done; - } - - /* Read remain of frame body */ - sdret = brcmf_sdcard_recv_buf(bus->sdiodev, - bus->sdiodev->sbwad, - SDIO_FUNC_2, - F2SYNC, rbuf, rdlen); - bus->sdcnt.f2rxdata++; - - /* Control frame failures need retransmission */ - if (sdret < 0) { - brcmf_err("read %d control bytes failed: %d\n", - rdlen, sdret); - bus->sdcnt.rxc_errors++; - brcmf_sdbrcm_rxfail(bus, true, true); - goto done; - } else - memcpy(buf + BRCMF_FIRSTREAD, rbuf, rdlen); - -gotpkt: - - brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_CTL_ON(), - buf, len, "RxCtrl:\n"); - - /* Point to valid data and indicate its length */ - spin_lock_bh(&bus->rxctl_lock); - if (bus->rxctl) { - brcmf_err("last control frame is being processed.\n"); - spin_unlock_bh(&bus->rxctl_lock); - vfree(buf); - goto done; - } - bus->rxctl = buf + doff; - bus->rxctl_orig = buf; - bus->rxlen = len - doff; - spin_unlock_bh(&bus->rxctl_lock); - -done: - /* Awake any waiters */ - brcmf_sdbrcm_dcmd_resp_wake(bus); -} - -/* Pad read to blocksize for efficiency */ -static void brcmf_pad(struct brcmf_sdio *bus, u16 *pad, u16 *rdlen) -{ - if (bus->roundup && bus->blocksize && *rdlen > bus->blocksize) { - *pad = bus->blocksize - (*rdlen % bus->blocksize); - if (*pad <= bus->roundup && *pad < bus->blocksize && - *rdlen + *pad + BRCMF_FIRSTREAD < MAX_RX_DATASZ) - *rdlen += *pad; - } else if (*rdlen % BRCMF_SDALIGN) { - *rdlen += BRCMF_SDALIGN - (*rdlen % BRCMF_SDALIGN); - } -} - -static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) -{ - struct sk_buff *pkt; /* Packet for event or data frames */ - struct sk_buff_head pktlist; /* needed for bus interface */ - u16 pad; /* Number of pad bytes to read */ - uint rxleft = 0; /* Remaining number of frames allowed */ - int ret; /* Return code from calls */ - uint rxcount = 0; /* Total frames read */ - struct brcmf_sdio_read *rd = &bus->cur_read, rd_new; - u8 head_read = 0; - - brcmf_dbg(TRACE, "Enter\n"); - - /* Not finished unless we encounter no more frames indication */ - bus->rxpending = true; - - for (rd->seq_num = bus->rx_seq, rxleft = maxframes; - !bus->rxskip && rxleft && - bus->sdiodev->bus_if->state != BRCMF_BUS_DOWN; - rd->seq_num++, rxleft--) { - - /* Handle glomming separately */ - if (bus->glomd || !skb_queue_empty(&bus->glom)) { - u8 cnt; - brcmf_dbg(GLOM, "calling rxglom: glomd %p, glom %p\n", - bus->glomd, skb_peek(&bus->glom)); - cnt = brcmf_sdbrcm_rxglom(bus, rd->seq_num); - brcmf_dbg(GLOM, "rxglom returned %d\n", cnt); - rd->seq_num += cnt - 1; - rxleft = (rxleft > cnt) ? (rxleft - cnt) : 1; - continue; - } - - rd->len_left = rd->len; - /* read header first for unknow frame length */ - sdio_claim_host(bus->sdiodev->func[1]); - if (!rd->len) { - ret = brcmf_sdcard_recv_buf(bus->sdiodev, - bus->sdiodev->sbwad, - SDIO_FUNC_2, F2SYNC, - bus->rxhdr, - BRCMF_FIRSTREAD); - bus->sdcnt.f2rxhdrs++; - if (ret < 0) { - brcmf_err("RXHEADER FAILED: %d\n", - ret); - bus->sdcnt.rx_hdrfail++; - brcmf_sdbrcm_rxfail(bus, true, true); - sdio_release_host(bus->sdiodev->func[1]); - continue; - } - - brcmf_dbg_hex_dump(BRCMF_BYTES_ON() || BRCMF_HDRS_ON(), - bus->rxhdr, SDPCM_HDRLEN, - "RxHdr:\n"); - - if (brcmf_sdio_hdparser(bus, bus->rxhdr, rd, - BRCMF_SDIO_FT_NORMAL)) { - sdio_release_host(bus->sdiodev->func[1]); - if (!bus->rxpending) - break; - else - continue; - } - - if (rd->channel == SDPCM_CONTROL_CHANNEL) { - brcmf_sdbrcm_read_control(bus, bus->rxhdr, - rd->len, - rd->dat_offset); - /* prepare the descriptor for the next read */ - rd->len = rd->len_nxtfrm << 4; - rd->len_nxtfrm = 0; - /* treat all packet as event if we don't know */ - rd->channel = SDPCM_EVENT_CHANNEL; - sdio_release_host(bus->sdiodev->func[1]); - continue; - } - rd->len_left = rd->len > BRCMF_FIRSTREAD ? - rd->len - BRCMF_FIRSTREAD : 0; - head_read = BRCMF_FIRSTREAD; - } - - brcmf_pad(bus, &pad, &rd->len_left); - - pkt = brcmu_pkt_buf_get_skb(rd->len_left + head_read + - BRCMF_SDALIGN); - if (!pkt) { - /* Give up on data, request rtx of events */ - brcmf_err("brcmu_pkt_buf_get_skb failed\n"); - brcmf_sdbrcm_rxfail(bus, false, - RETRYCHAN(rd->channel)); - sdio_release_host(bus->sdiodev->func[1]); - continue; - } - skb_pull(pkt, head_read); - pkt_align(pkt, rd->len_left, BRCMF_SDALIGN); - - ret = brcmf_sdcard_recv_pkt(bus->sdiodev, bus->sdiodev->sbwad, - SDIO_FUNC_2, F2SYNC, pkt); - bus->sdcnt.f2rxdata++; - sdio_release_host(bus->sdiodev->func[1]); - - if (ret < 0) { - brcmf_err("read %d bytes from channel %d failed: %d\n", - rd->len, rd->channel, ret); - brcmu_pkt_buf_free_skb(pkt); - sdio_claim_host(bus->sdiodev->func[1]); - brcmf_sdbrcm_rxfail(bus, true, - RETRYCHAN(rd->channel)); - sdio_release_host(bus->sdiodev->func[1]); - continue; - } - - if (head_read) { - skb_push(pkt, head_read); - memcpy(pkt->data, bus->rxhdr, head_read); - head_read = 0; - } else { - memcpy(bus->rxhdr, pkt->data, SDPCM_HDRLEN); - rd_new.seq_num = rd->seq_num; - sdio_claim_host(bus->sdiodev->func[1]); - if (brcmf_sdio_hdparser(bus, bus->rxhdr, &rd_new, - BRCMF_SDIO_FT_NORMAL)) { - rd->len = 0; - brcmu_pkt_buf_free_skb(pkt); - } - bus->sdcnt.rx_readahead_cnt++; - if (rd->len != roundup(rd_new.len, 16)) { - brcmf_err("frame length mismatch:read %d, should be %d\n", - rd->len, - roundup(rd_new.len, 16) >> 4); - rd->len = 0; - brcmf_sdbrcm_rxfail(bus, true, true); - sdio_release_host(bus->sdiodev->func[1]); - brcmu_pkt_buf_free_skb(pkt); - continue; - } - sdio_release_host(bus->sdiodev->func[1]); - rd->len_nxtfrm = rd_new.len_nxtfrm; - rd->channel = rd_new.channel; - rd->dat_offset = rd_new.dat_offset; - - brcmf_dbg_hex_dump(!(BRCMF_BYTES_ON() && - BRCMF_DATA_ON()) && - BRCMF_HDRS_ON(), - bus->rxhdr, SDPCM_HDRLEN, - "RxHdr:\n"); - - if (rd_new.channel == SDPCM_CONTROL_CHANNEL) { - brcmf_err("readahead on control packet %d?\n", - rd_new.seq_num); - /* Force retry w/normal header read */ - rd->len = 0; - sdio_claim_host(bus->sdiodev->func[1]); - brcmf_sdbrcm_rxfail(bus, false, true); - sdio_release_host(bus->sdiodev->func[1]); - brcmu_pkt_buf_free_skb(pkt); - continue; - } - } - - brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_DATA_ON(), - pkt->data, rd->len, "Rx Data:\n"); - - /* Save superframe descriptor and allocate packet frame */ - if (rd->channel == SDPCM_GLOM_CHANNEL) { - if (SDPCM_GLOMDESC(&bus->rxhdr[SDPCM_FRAMETAG_LEN])) { - brcmf_dbg(GLOM, "glom descriptor, %d bytes:\n", - rd->len); - brcmf_dbg_hex_dump(BRCMF_GLOM_ON(), - pkt->data, rd->len, - "Glom Data:\n"); - __skb_trim(pkt, rd->len); - skb_pull(pkt, SDPCM_HDRLEN); - bus->glomd = pkt; - } else { - brcmf_err("%s: glom superframe w/o " - "descriptor!\n", __func__); - sdio_claim_host(bus->sdiodev->func[1]); - brcmf_sdbrcm_rxfail(bus, false, false); - sdio_release_host(bus->sdiodev->func[1]); - } - /* prepare the descriptor for the next read */ - rd->len = rd->len_nxtfrm << 4; - rd->len_nxtfrm = 0; - /* treat all packet as event if we don't know */ - rd->channel = SDPCM_EVENT_CHANNEL; - continue; - } - - /* Fill in packet len and prio, deliver upward */ - __skb_trim(pkt, rd->len); - skb_pull(pkt, rd->dat_offset); - - /* prepare the descriptor for the next read */ - rd->len = rd->len_nxtfrm << 4; - rd->len_nxtfrm = 0; - /* treat all packet as event if we don't know */ - rd->channel = SDPCM_EVENT_CHANNEL; - - if (pkt->len == 0) { - brcmu_pkt_buf_free_skb(pkt); - continue; - } - - skb_queue_head_init(&pktlist); - skb_queue_tail(&pktlist, pkt); - brcmf_rx_frames(bus->sdiodev->dev, &pktlist); - } - - rxcount = maxframes - rxleft; - /* Message if we hit the limit */ - if (!rxleft) - brcmf_dbg(DATA, "hit rx limit of %d frames\n", maxframes); - else - brcmf_dbg(DATA, "processed %d frames\n", rxcount); - /* Back off rxseq if awaiting rtx, update rx_seq */ - if (bus->rxskip) - rd->seq_num--; - bus->rx_seq = rd->seq_num; - - return rxcount; -} - -static void -brcmf_sdbrcm_wait_event_wakeup(struct brcmf_sdio *bus) -{ - if (waitqueue_active(&bus->ctrl_wait)) - wake_up_interruptible(&bus->ctrl_wait); - return; -} - -/* Writes a HW/SW header into the packet and sends it. */ -/* Assumes: (a) header space already there, (b) caller holds lock */ -static int brcmf_sdbrcm_txpkt(struct brcmf_sdio *bus, struct sk_buff *pkt, - uint chan) -{ - int ret; - u8 *frame; - u16 len, pad = 0; - u32 swheader; - int i; - - brcmf_dbg(TRACE, "Enter\n"); - - frame = (u8 *) (pkt->data); - - /* Add alignment padding, allocate new packet if needed */ - pad = ((unsigned long)frame % BRCMF_SDALIGN); - if (pad) { - if (skb_headroom(pkt) < pad) { - brcmf_dbg(INFO, "insufficient headroom %d for %d pad\n", - skb_headroom(pkt), pad); - bus->sdiodev->bus_if->tx_realloc++; - ret = skb_cow(pkt, BRCMF_SDALIGN); - if (ret) - goto done; - pad = ((unsigned long)frame % BRCMF_SDALIGN); - } - skb_push(pkt, pad); - frame = (u8 *) (pkt->data); - memset(frame, 0, pad + SDPCM_HDRLEN); - } - /* precondition: pad < BRCMF_SDALIGN */ - - /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ - len = (u16) (pkt->len); - *(__le16 *) frame = cpu_to_le16(len); - *(((__le16 *) frame) + 1) = cpu_to_le16(~len); - - /* Software tag: channel, sequence number, data offset */ - swheader = - ((chan << SDPCM_CHANNEL_SHIFT) & SDPCM_CHANNEL_MASK) | bus->tx_seq | - (((pad + - SDPCM_HDRLEN) << SDPCM_DOFFSET_SHIFT) & SDPCM_DOFFSET_MASK); - - *(((__le32 *) frame) + 1) = cpu_to_le32(swheader); - *(((__le32 *) frame) + 2) = 0; - -#ifdef DEBUG - tx_packets[pkt->priority]++; -#endif - - brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && - ((BRCMF_CTL_ON() && chan == SDPCM_CONTROL_CHANNEL) || - (BRCMF_DATA_ON() && chan != SDPCM_CONTROL_CHANNEL)), - frame, len, "Tx Frame:\n"); - brcmf_dbg_hex_dump(!(BRCMF_BYTES_ON() && - ((BRCMF_CTL_ON() && - chan == SDPCM_CONTROL_CHANNEL) || - (BRCMF_DATA_ON() && - chan != SDPCM_CONTROL_CHANNEL))) && - BRCMF_HDRS_ON(), - frame, min_t(u16, len, 16), "TxHdr:\n"); - - /* Raise len to next SDIO block to eliminate tail command */ - if (bus->roundup && bus->blocksize && (len > bus->blocksize)) { - u16 pad = bus->blocksize - (len % bus->blocksize); - if ((pad <= bus->roundup) && (pad < bus->blocksize)) - len += pad; - } else if (len % BRCMF_SDALIGN) { - len += BRCMF_SDALIGN - (len % BRCMF_SDALIGN); - } - - /* Some controllers have trouble with odd bytes -- round to even */ - if (len & (ALIGNMENT - 1)) - len = roundup(len, ALIGNMENT); - - sdio_claim_host(bus->sdiodev->func[1]); - ret = brcmf_sdcard_send_pkt(bus->sdiodev, bus->sdiodev->sbwad, - SDIO_FUNC_2, F2SYNC, pkt); - bus->sdcnt.f2txdata++; - - if (ret < 0) { - /* On failure, abort the command and terminate the frame */ - brcmf_dbg(INFO, "sdio error %d, abort command and terminate frame\n", - ret); - bus->sdcnt.tx_sderrs++; - - brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2); - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL, - SFC_WF_TERM, NULL); - bus->sdcnt.f1regdata++; - - for (i = 0; i < 3; i++) { - u8 hi, lo; - hi = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_FUNC1_WFRAMEBCHI, NULL); - lo = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_FUNC1_WFRAMEBCLO, NULL); - bus->sdcnt.f1regdata += 2; - if ((hi == 0) && (lo == 0)) - break; - } - - } - sdio_release_host(bus->sdiodev->func[1]); - if (ret == 0) - bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP; - -done: - /* restore pkt buffer pointer before calling tx complete routine */ - skb_pull(pkt, SDPCM_HDRLEN + pad); - brcmf_txcomplete(bus->sdiodev->dev, pkt, ret == 0); - return ret; -} - -static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes) -{ - struct sk_buff *pkt; - u32 intstatus = 0; - int ret = 0, prec_out; - uint cnt = 0; - uint datalen; - u8 tx_prec_map; - - brcmf_dbg(TRACE, "Enter\n"); - - tx_prec_map = ~bus->flowcontrol; - - /* Send frames until the limit or some other event */ - for (cnt = 0; (cnt < maxframes) && data_ok(bus); cnt++) { - spin_lock_bh(&bus->txqlock); - pkt = brcmu_pktq_mdeq(&bus->txq, tx_prec_map, &prec_out); - if (pkt == NULL) { - spin_unlock_bh(&bus->txqlock); - break; - } - spin_unlock_bh(&bus->txqlock); - datalen = pkt->len - SDPCM_HDRLEN; - - ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL); - - /* In poll mode, need to check for other events */ - if (!bus->intr && cnt) { - /* Check device status, signal pending interrupt */ - sdio_claim_host(bus->sdiodev->func[1]); - ret = r_sdreg32(bus, &intstatus, - offsetof(struct sdpcmd_regs, - intstatus)); - sdio_release_host(bus->sdiodev->func[1]); - bus->sdcnt.f2txdata++; - if (ret != 0) - break; - if (intstatus & bus->hostintmask) - atomic_set(&bus->ipend, 1); - } - } - - /* Deflow-control stack if needed */ - if ((bus->sdiodev->bus_if->state == BRCMF_BUS_DATA) && - bus->txoff && (pktq_len(&bus->txq) < TXLOW)) { - bus->txoff = false; - brcmf_txflowblock(bus->sdiodev->dev, false); - } - - return cnt; -} - -static void brcmf_sdbrcm_bus_stop(struct device *dev) -{ - u32 local_hostintmask; - u8 saveclk; - int err; - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; - struct brcmf_sdio *bus = sdiodev->bus; - - brcmf_dbg(TRACE, "Enter\n"); - - if (bus->watchdog_tsk) { - send_sig(SIGTERM, bus->watchdog_tsk, 1); - kthread_stop(bus->watchdog_tsk); - bus->watchdog_tsk = NULL; - } - - sdio_claim_host(bus->sdiodev->func[1]); - - /* Enable clock for device interrupts */ - brcmf_sdbrcm_bus_sleep(bus, false, false); - - /* Disable and clear interrupts at the chip level also */ - w_sdreg32(bus, 0, offsetof(struct sdpcmd_regs, hostintmask)); - local_hostintmask = bus->hostintmask; - bus->hostintmask = 0; - - /* Change our idea of bus state */ - bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; - - /* Force clocks on backplane to be sure F2 interrupt propagates */ - saveclk = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_FUNC1_CHIPCLKCSR, &err); - if (!err) { - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, - (saveclk | SBSDIO_FORCE_HT), &err); - } - if (err) - brcmf_err("Failed to force clock for F2: err %d\n", err); - - /* Turn off the bus (F2), free any pending packets */ - brcmf_dbg(INTR, "disable SDIO interrupts\n"); - brcmf_sdio_regwb(bus->sdiodev, SDIO_CCCR_IOEx, SDIO_FUNC_ENABLE_1, - NULL); - - /* Clear any pending interrupts now that F2 is disabled */ - w_sdreg32(bus, local_hostintmask, - offsetof(struct sdpcmd_regs, intstatus)); - - /* Turn off the backplane clock (only) */ - brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false); - sdio_release_host(bus->sdiodev->func[1]); - - /* Clear the data packet queues */ - brcmu_pktq_flush(&bus->txq, true, NULL, NULL); - - /* Clear any held glomming stuff */ - if (bus->glomd) - brcmu_pkt_buf_free_skb(bus->glomd); - brcmf_sdbrcm_free_glom(bus); - - /* Clear rx control and wake any waiters */ - spin_lock_bh(&bus->rxctl_lock); - bus->rxlen = 0; - spin_unlock_bh(&bus->rxctl_lock); - brcmf_sdbrcm_dcmd_resp_wake(bus); - - /* Reset some F2 state stuff */ - bus->rxskip = false; - bus->tx_seq = bus->rx_seq = 0; -} - -static inline void brcmf_sdbrcm_clrintr(struct brcmf_sdio *bus) -{ - unsigned long flags; - - if (bus->sdiodev->oob_irq_requested) { - spin_lock_irqsave(&bus->sdiodev->irq_en_lock, flags); - if (!bus->sdiodev->irq_en && !atomic_read(&bus->ipend)) { - enable_irq(bus->sdiodev->pdata->oob_irq_nr); - bus->sdiodev->irq_en = true; - } - spin_unlock_irqrestore(&bus->sdiodev->irq_en_lock, flags); - } -} - -static inline void brcmf_sdbrcm_adddpctsk(struct brcmf_sdio *bus) -{ - struct list_head *new_hd; - unsigned long flags; - - if (in_interrupt()) - new_hd = kzalloc(sizeof(struct list_head), GFP_ATOMIC); - else - new_hd = kzalloc(sizeof(struct list_head), GFP_KERNEL); - if (new_hd == NULL) - return; - - spin_lock_irqsave(&bus->dpc_tl_lock, flags); - list_add_tail(new_hd, &bus->dpc_tsklst); - spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); -} - -static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus) -{ - u8 idx; - u32 addr; - unsigned long val; - int n, ret; - - idx = brcmf_sdio_chip_getinfidx(bus->ci, BCMA_CORE_SDIO_DEV); - addr = bus->ci->c_inf[idx].base + - offsetof(struct sdpcmd_regs, intstatus); - - ret = brcmf_sdio_regrw_helper(bus->sdiodev, addr, &val, false); - bus->sdcnt.f1regdata++; - if (ret != 0) - val = 0; - - val &= bus->hostintmask; - atomic_set(&bus->fcstate, !!(val & I_HMB_FC_STATE)); - - /* Clear interrupts */ - if (val) { - ret = brcmf_sdio_regrw_helper(bus->sdiodev, addr, &val, true); - bus->sdcnt.f1regdata++; - } - - if (ret) { - atomic_set(&bus->intstatus, 0); - } else if (val) { - for_each_set_bit(n, &val, 32) - set_bit(n, (unsigned long *)&bus->intstatus.counter); - } - - return ret; -} - -static void brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) -{ - u32 newstatus = 0; - unsigned long intstatus; - uint rxlimit = bus->rxbound; /* Rx frames to read before resched */ - uint txlimit = bus->txbound; /* Tx frames to send before resched */ - uint framecnt = 0; /* Temporary counter of tx/rx frames */ - int err = 0, n; - - brcmf_dbg(TRACE, "Enter\n"); - - sdio_claim_host(bus->sdiodev->func[1]); - - /* If waiting for HTAVAIL, check status */ - if (!bus->sr_enabled && bus->clkstate == CLK_PENDING) { - u8 clkctl, devctl = 0; - -#ifdef DEBUG - /* Check for inconsistent device control */ - devctl = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_DEVICE_CTL, &err); - if (err) { - brcmf_err("error reading DEVCTL: %d\n", err); - bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; - } -#endif /* DEBUG */ - - /* Read CSR, if clock on switch to AVAIL, else ignore */ - clkctl = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_FUNC1_CHIPCLKCSR, &err); - if (err) { - brcmf_err("error reading CSR: %d\n", - err); - bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; - } - - brcmf_dbg(SDIO, "DPC: PENDING, devctl 0x%02x clkctl 0x%02x\n", - devctl, clkctl); - - if (SBSDIO_HTAV(clkctl)) { - devctl = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_DEVICE_CTL, &err); - if (err) { - brcmf_err("error reading DEVCTL: %d\n", - err); - bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; - } - devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL, - devctl, &err); - if (err) { - brcmf_err("error writing DEVCTL: %d\n", - err); - bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; - } - bus->clkstate = CLK_AVAIL; - } - } - - /* Make sure backplane clock is on */ - brcmf_sdbrcm_bus_sleep(bus, false, true); - - /* Pending interrupt indicates new device status */ - if (atomic_read(&bus->ipend) > 0) { - atomic_set(&bus->ipend, 0); - err = brcmf_sdio_intr_rstatus(bus); - } - - /* Start with leftover status bits */ - intstatus = atomic_xchg(&bus->intstatus, 0); - - /* Handle flow-control change: read new state in case our ack - * crossed another change interrupt. If change still set, assume - * FC ON for safety, let next loop through do the debounce. - */ - if (intstatus & I_HMB_FC_CHANGE) { - intstatus &= ~I_HMB_FC_CHANGE; - err = w_sdreg32(bus, I_HMB_FC_CHANGE, - offsetof(struct sdpcmd_regs, intstatus)); - - err = r_sdreg32(bus, &newstatus, - offsetof(struct sdpcmd_regs, intstatus)); - bus->sdcnt.f1regdata += 2; - atomic_set(&bus->fcstate, - !!(newstatus & (I_HMB_FC_STATE | I_HMB_FC_CHANGE))); - intstatus |= (newstatus & bus->hostintmask); - } - - /* Handle host mailbox indication */ - if (intstatus & I_HMB_HOST_INT) { - intstatus &= ~I_HMB_HOST_INT; - intstatus |= brcmf_sdbrcm_hostmail(bus); - } - - sdio_release_host(bus->sdiodev->func[1]); - - /* Generally don't ask for these, can get CRC errors... */ - if (intstatus & I_WR_OOSYNC) { - brcmf_err("Dongle reports WR_OOSYNC\n"); - intstatus &= ~I_WR_OOSYNC; - } - - if (intstatus & I_RD_OOSYNC) { - brcmf_err("Dongle reports RD_OOSYNC\n"); - intstatus &= ~I_RD_OOSYNC; - } - - if (intstatus & I_SBINT) { - brcmf_err("Dongle reports SBINT\n"); - intstatus &= ~I_SBINT; - } - - /* Would be active due to wake-wlan in gSPI */ - if (intstatus & I_CHIPACTIVE) { - brcmf_dbg(INFO, "Dongle reports CHIPACTIVE\n"); - intstatus &= ~I_CHIPACTIVE; - } - - /* Ignore frame indications if rxskip is set */ - if (bus->rxskip) - intstatus &= ~I_HMB_FRAME_IND; - - /* On frame indication, read available frames */ - if (PKT_AVAILABLE() && bus->clkstate == CLK_AVAIL) { - framecnt = brcmf_sdio_readframes(bus, rxlimit); - if (!bus->rxpending) - intstatus &= ~I_HMB_FRAME_IND; - rxlimit -= min(framecnt, rxlimit); - } - - /* Keep still-pending events for next scheduling */ - if (intstatus) { - for_each_set_bit(n, &intstatus, 32) - set_bit(n, (unsigned long *)&bus->intstatus.counter); - } - - brcmf_sdbrcm_clrintr(bus); - - if (data_ok(bus) && bus->ctrl_frame_stat && - (bus->clkstate == CLK_AVAIL)) { - int i; - - sdio_claim_host(bus->sdiodev->func[1]); - err = brcmf_sdcard_send_buf(bus->sdiodev, bus->sdiodev->sbwad, - SDIO_FUNC_2, F2SYNC, bus->ctrl_frame_buf, - (u32) bus->ctrl_frame_len); - - if (err < 0) { - /* On failure, abort the command and - terminate the frame */ - brcmf_dbg(INFO, "sdio error %d, abort command and terminate frame\n", - err); - bus->sdcnt.tx_sderrs++; - - brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2); - - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL, - SFC_WF_TERM, &err); - bus->sdcnt.f1regdata++; - - for (i = 0; i < 3; i++) { - u8 hi, lo; - hi = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_FUNC1_WFRAMEBCHI, - &err); - lo = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_FUNC1_WFRAMEBCLO, - &err); - bus->sdcnt.f1regdata += 2; - if ((hi == 0) && (lo == 0)) - break; - } - - } else { - bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP; - } - sdio_release_host(bus->sdiodev->func[1]); - bus->ctrl_frame_stat = false; - brcmf_sdbrcm_wait_event_wakeup(bus); - } - /* Send queued frames (limit 1 if rx may still be pending) */ - else if ((bus->clkstate == CLK_AVAIL) && !atomic_read(&bus->fcstate) && - brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) && txlimit - && data_ok(bus)) { - framecnt = bus->rxpending ? min(txlimit, bus->txminmax) : - txlimit; - framecnt = brcmf_sdbrcm_sendfromq(bus, framecnt); - txlimit -= framecnt; - } - - if ((bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) || (err != 0)) { - brcmf_err("failed backplane access over SDIO, halting operation\n"); - bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; - atomic_set(&bus->intstatus, 0); - } else if (atomic_read(&bus->intstatus) || - atomic_read(&bus->ipend) > 0 || - (!atomic_read(&bus->fcstate) && - brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) && - data_ok(bus)) || PKT_AVAILABLE()) { - brcmf_sdbrcm_adddpctsk(bus); - } - - /* If we're done for now, turn off clock request. */ - if ((bus->clkstate != CLK_PENDING) - && bus->idletime == BRCMF_IDLE_IMMEDIATE) { - bus->activity = false; - brcmf_dbg(SDIO, "idle state\n"); - sdio_claim_host(bus->sdiodev->func[1]); - brcmf_sdbrcm_bus_sleep(bus, true, false); - sdio_release_host(bus->sdiodev->func[1]); - } -} - -static struct pktq *brcmf_sdbrcm_bus_gettxq(struct device *dev) -{ - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; - struct brcmf_sdio *bus = sdiodev->bus; - - return &bus->txq; -} - -static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt) -{ - int ret = -EBADE; - uint datalen, prec; - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; - struct brcmf_sdio *bus = sdiodev->bus; - unsigned long flags; - - brcmf_dbg(TRACE, "Enter\n"); - - datalen = pkt->len; - - /* Add space for the header */ - skb_push(pkt, SDPCM_HDRLEN); - /* precondition: IS_ALIGNED((unsigned long)(pkt->data), 2) */ - - prec = prio2prec((pkt->priority & PRIOMASK)); - - /* Check for existing queue, current flow-control, - pending event, or pending clock */ - brcmf_dbg(TRACE, "deferring pktq len %d\n", pktq_len(&bus->txq)); - bus->sdcnt.fcqueued++; - - /* Priority based enq */ - spin_lock_bh(&bus->txqlock); - if (!brcmf_c_prec_enq(bus->sdiodev->dev, &bus->txq, pkt, prec)) { - skb_pull(pkt, SDPCM_HDRLEN); - brcmf_txcomplete(bus->sdiodev->dev, pkt, false); - brcmf_err("out of bus->txq !!!\n"); - ret = -ENOSR; - } else { - ret = 0; - } - spin_unlock_bh(&bus->txqlock); - - if (pktq_len(&bus->txq) >= TXHI) { - bus->txoff = true; - brcmf_txflowblock(bus->sdiodev->dev, true); - } - -#ifdef DEBUG - if (pktq_plen(&bus->txq, prec) > qcount[prec]) - qcount[prec] = pktq_plen(&bus->txq, prec); -#endif - - spin_lock_irqsave(&bus->dpc_tl_lock, flags); - if (list_empty(&bus->dpc_tsklst)) { - spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); - - brcmf_sdbrcm_adddpctsk(bus); - queue_work(bus->brcmf_wq, &bus->datawork); - } else { - spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); - } - - return ret; -} - -#ifdef DEBUG -#define CONSOLE_LINE_MAX 192 - -static int brcmf_sdbrcm_readconsole(struct brcmf_sdio *bus) -{ - struct brcmf_console *c = &bus->console; - u8 line[CONSOLE_LINE_MAX], ch; - u32 n, idx, addr; - int rv; - - /* Don't do anything until FWREADY updates console address */ - if (bus->console_addr == 0) - return 0; - - /* Read console log struct */ - addr = bus->console_addr + offsetof(struct rte_console, log_le); - rv = brcmf_sdio_ramrw(bus->sdiodev, false, addr, (u8 *)&c->log_le, - sizeof(c->log_le)); - if (rv < 0) - return rv; - - /* Allocate console buffer (one time only) */ - if (c->buf == NULL) { - c->bufsize = le32_to_cpu(c->log_le.buf_size); - c->buf = kmalloc(c->bufsize, GFP_ATOMIC); - if (c->buf == NULL) - return -ENOMEM; - } - - idx = le32_to_cpu(c->log_le.idx); - - /* Protect against corrupt value */ - if (idx > c->bufsize) - return -EBADE; - - /* Skip reading the console buffer if the index pointer - has not moved */ - if (idx == c->last) - return 0; - - /* Read the console buffer */ - addr = le32_to_cpu(c->log_le.buf); - rv = brcmf_sdio_ramrw(bus->sdiodev, false, addr, c->buf, c->bufsize); - if (rv < 0) - return rv; - - while (c->last != idx) { - for (n = 0; n < CONSOLE_LINE_MAX - 2; n++) { - if (c->last == idx) { - /* This would output a partial line. - * Instead, back up - * the buffer pointer and output this - * line next time around. - */ - if (c->last >= n) - c->last -= n; - else - c->last = c->bufsize - n; - goto break2; - } - ch = c->buf[c->last]; - c->last = (c->last + 1) % c->bufsize; - if (ch == '\n') - break; - line[n] = ch; - } - - if (n > 0) { - if (line[n - 1] == '\r') - n--; - line[n] = 0; - pr_debug("CONSOLE: %s\n", line); - } - } -break2: - - return 0; -} -#endif /* DEBUG */ - -static int brcmf_tx_frame(struct brcmf_sdio *bus, u8 *frame, u16 len) -{ - int i; - int ret; - - bus->ctrl_frame_stat = false; - ret = brcmf_sdcard_send_buf(bus->sdiodev, bus->sdiodev->sbwad, - SDIO_FUNC_2, F2SYNC, frame, len); - - if (ret < 0) { - /* On failure, abort the command and terminate the frame */ - brcmf_dbg(INFO, "sdio error %d, abort command and terminate frame\n", - ret); - bus->sdcnt.tx_sderrs++; - - brcmf_sdcard_abort(bus->sdiodev, SDIO_FUNC_2); - - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL, - SFC_WF_TERM, NULL); - bus->sdcnt.f1regdata++; - - for (i = 0; i < 3; i++) { - u8 hi, lo; - hi = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_FUNC1_WFRAMEBCHI, NULL); - lo = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_FUNC1_WFRAMEBCLO, NULL); - bus->sdcnt.f1regdata += 2; - if (hi == 0 && lo == 0) - break; - } - return ret; - } - - bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQUENCE_WRAP; - - return ret; -} - -static int -brcmf_sdbrcm_bus_txctl(struct device *dev, unsigned char *msg, uint msglen) -{ - u8 *frame; - u16 len; - u32 swheader; - uint retries = 0; - u8 doff = 0; - int ret = -1; - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; - struct brcmf_sdio *bus = sdiodev->bus; - unsigned long flags; - - brcmf_dbg(TRACE, "Enter\n"); - - /* Back the pointer to make a room for bus header */ - frame = msg - SDPCM_HDRLEN; - len = (msglen += SDPCM_HDRLEN); - - /* Add alignment padding (optional for ctl frames) */ - doff = ((unsigned long)frame % BRCMF_SDALIGN); - if (doff) { - frame -= doff; - len += doff; - msglen += doff; - memset(frame, 0, doff + SDPCM_HDRLEN); - } - /* precondition: doff < BRCMF_SDALIGN */ - doff += SDPCM_HDRLEN; - - /* Round send length to next SDIO block */ - if (bus->roundup && bus->blocksize && (len > bus->blocksize)) { - u16 pad = bus->blocksize - (len % bus->blocksize); - if ((pad <= bus->roundup) && (pad < bus->blocksize)) - len += pad; - } else if (len % BRCMF_SDALIGN) { - len += BRCMF_SDALIGN - (len % BRCMF_SDALIGN); - } - - /* Satisfy length-alignment requirements */ - if (len & (ALIGNMENT - 1)) - len = roundup(len, ALIGNMENT); - - /* precondition: IS_ALIGNED((unsigned long)frame, 2) */ - - /* Make sure backplane clock is on */ - sdio_claim_host(bus->sdiodev->func[1]); - brcmf_sdbrcm_bus_sleep(bus, false, false); - sdio_release_host(bus->sdiodev->func[1]); - - /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ - *(__le16 *) frame = cpu_to_le16((u16) msglen); - *(((__le16 *) frame) + 1) = cpu_to_le16(~msglen); - - /* Software tag: channel, sequence number, data offset */ - swheader = - ((SDPCM_CONTROL_CHANNEL << SDPCM_CHANNEL_SHIFT) & - SDPCM_CHANNEL_MASK) - | bus->tx_seq | ((doff << SDPCM_DOFFSET_SHIFT) & - SDPCM_DOFFSET_MASK); - put_unaligned_le32(swheader, frame + SDPCM_FRAMETAG_LEN); - put_unaligned_le32(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader)); - - if (!data_ok(bus)) { - brcmf_dbg(INFO, "No bus credit bus->tx_max %d, bus->tx_seq %d\n", - bus->tx_max, bus->tx_seq); - bus->ctrl_frame_stat = true; - /* Send from dpc */ - bus->ctrl_frame_buf = frame; - bus->ctrl_frame_len = len; - - wait_event_interruptible_timeout(bus->ctrl_wait, - !bus->ctrl_frame_stat, - msecs_to_jiffies(2000)); - - if (!bus->ctrl_frame_stat) { - brcmf_dbg(SDIO, "ctrl_frame_stat == false\n"); - ret = 0; - } else { - brcmf_dbg(SDIO, "ctrl_frame_stat == true\n"); - ret = -1; - } - } - - if (ret == -1) { - brcmf_dbg_hex_dump(BRCMF_BYTES_ON() && BRCMF_CTL_ON(), - frame, len, "Tx Frame:\n"); - brcmf_dbg_hex_dump(!(BRCMF_BYTES_ON() && BRCMF_CTL_ON()) && - BRCMF_HDRS_ON(), - frame, min_t(u16, len, 16), "TxHdr:\n"); - - do { - sdio_claim_host(bus->sdiodev->func[1]); - ret = brcmf_tx_frame(bus, frame, len); - sdio_release_host(bus->sdiodev->func[1]); - } while (ret < 0 && retries++ < TXRETRIES); - } - - spin_lock_irqsave(&bus->dpc_tl_lock, flags); - if ((bus->idletime == BRCMF_IDLE_IMMEDIATE) && - list_empty(&bus->dpc_tsklst)) { - spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); - - bus->activity = false; - sdio_claim_host(bus->sdiodev->func[1]); - brcmf_dbg(INFO, "idle\n"); - brcmf_sdbrcm_clkctl(bus, CLK_NONE, true); - sdio_release_host(bus->sdiodev->func[1]); - } else { - spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); - } - - if (ret) - bus->sdcnt.tx_ctlerrs++; - else - bus->sdcnt.tx_ctlpkts++; - - return ret ? -EIO : 0; -} - -#ifdef DEBUG -static inline bool brcmf_sdio_valid_shared_address(u32 addr) -{ - return !(addr == 0 || ((~addr >> 16) & 0xffff) == (addr & 0xffff)); -} - -static int brcmf_sdio_readshared(struct brcmf_sdio *bus, - struct sdpcm_shared *sh) -{ - u32 addr; - int rv; - u32 shaddr = 0; - struct sdpcm_shared_le sh_le; - __le32 addr_le; - - shaddr = bus->ci->rambase + bus->ramsize - 4; - - /* - * Read last word in socram to determine - * address of sdpcm_shared structure - */ - sdio_claim_host(bus->sdiodev->func[1]); - brcmf_sdbrcm_bus_sleep(bus, false, false); - rv = brcmf_sdio_ramrw(bus->sdiodev, false, shaddr, (u8 *)&addr_le, 4); - sdio_release_host(bus->sdiodev->func[1]); - if (rv < 0) - return rv; - - addr = le32_to_cpu(addr_le); - - brcmf_dbg(SDIO, "sdpcm_shared address 0x%08X\n", addr); - - /* - * Check if addr is valid. - * NVRAM length at the end of memory should have been overwritten. - */ - if (!brcmf_sdio_valid_shared_address(addr)) { - brcmf_err("invalid sdpcm_shared address 0x%08X\n", - addr); - return -EINVAL; - } - - /* Read hndrte_shared structure */ - rv = brcmf_sdio_ramrw(bus->sdiodev, false, addr, (u8 *)&sh_le, - sizeof(struct sdpcm_shared_le)); - if (rv < 0) - return rv; - - /* Endianness */ - sh->flags = le32_to_cpu(sh_le.flags); - sh->trap_addr = le32_to_cpu(sh_le.trap_addr); - sh->assert_exp_addr = le32_to_cpu(sh_le.assert_exp_addr); - sh->assert_file_addr = le32_to_cpu(sh_le.assert_file_addr); - sh->assert_line = le32_to_cpu(sh_le.assert_line); - sh->console_addr = le32_to_cpu(sh_le.console_addr); - sh->msgtrace_addr = le32_to_cpu(sh_le.msgtrace_addr); - - if ((sh->flags & SDPCM_SHARED_VERSION_MASK) > SDPCM_SHARED_VERSION) { - brcmf_err("sdpcm shared version unsupported: dhd %d dongle %d\n", - SDPCM_SHARED_VERSION, - sh->flags & SDPCM_SHARED_VERSION_MASK); - return -EPROTO; - } - - return 0; -} - -static int brcmf_sdio_dump_console(struct brcmf_sdio *bus, - struct sdpcm_shared *sh, char __user *data, - size_t count) -{ - u32 addr, console_ptr, console_size, console_index; - char *conbuf = NULL; - __le32 sh_val; - int rv; - loff_t pos = 0; - int nbytes = 0; - - /* obtain console information from device memory */ - addr = sh->console_addr + offsetof(struct rte_console, log_le); - rv = brcmf_sdio_ramrw(bus->sdiodev, false, addr, - (u8 *)&sh_val, sizeof(u32)); - if (rv < 0) - return rv; - console_ptr = le32_to_cpu(sh_val); - - addr = sh->console_addr + offsetof(struct rte_console, log_le.buf_size); - rv = brcmf_sdio_ramrw(bus->sdiodev, false, addr, - (u8 *)&sh_val, sizeof(u32)); - if (rv < 0) - return rv; - console_size = le32_to_cpu(sh_val); - - addr = sh->console_addr + offsetof(struct rte_console, log_le.idx); - rv = brcmf_sdio_ramrw(bus->sdiodev, false, addr, - (u8 *)&sh_val, sizeof(u32)); - if (rv < 0) - return rv; - console_index = le32_to_cpu(sh_val); - - /* allocate buffer for console data */ - if (console_size <= CONSOLE_BUFFER_MAX) - conbuf = vzalloc(console_size+1); - - if (!conbuf) - return -ENOMEM; - - /* obtain the console data from device */ - conbuf[console_size] = '\0'; - rv = brcmf_sdio_ramrw(bus->sdiodev, false, console_ptr, (u8 *)conbuf, - console_size); - if (rv < 0) - goto done; - - rv = simple_read_from_buffer(data, count, &pos, - conbuf + console_index, - console_size - console_index); - if (rv < 0) - goto done; - - nbytes = rv; - if (console_index > 0) { - pos = 0; - rv = simple_read_from_buffer(data+nbytes, count, &pos, - conbuf, console_index - 1); - if (rv < 0) - goto done; - rv += nbytes; - } -done: - vfree(conbuf); - return rv; -} - -static int brcmf_sdio_trap_info(struct brcmf_sdio *bus, struct sdpcm_shared *sh, - char __user *data, size_t count) -{ - int error, res; - char buf[350]; - struct brcmf_trap_info tr; - loff_t pos = 0; - - if ((sh->flags & SDPCM_SHARED_TRAP) == 0) { - brcmf_dbg(INFO, "no trap in firmware\n"); - return 0; - } - - error = brcmf_sdio_ramrw(bus->sdiodev, false, sh->trap_addr, (u8 *)&tr, - sizeof(struct brcmf_trap_info)); - if (error < 0) - return error; - - res = scnprintf(buf, sizeof(buf), - "dongle trap info: type 0x%x @ epc 0x%08x\n" - " cpsr 0x%08x spsr 0x%08x sp 0x%08x\n" - " lr 0x%08x pc 0x%08x offset 0x%x\n" - " r0 0x%08x r1 0x%08x r2 0x%08x r3 0x%08x\n" - " r4 0x%08x r5 0x%08x r6 0x%08x r7 0x%08x\n", - le32_to_cpu(tr.type), le32_to_cpu(tr.epc), - le32_to_cpu(tr.cpsr), le32_to_cpu(tr.spsr), - le32_to_cpu(tr.r13), le32_to_cpu(tr.r14), - le32_to_cpu(tr.pc), sh->trap_addr, - le32_to_cpu(tr.r0), le32_to_cpu(tr.r1), - le32_to_cpu(tr.r2), le32_to_cpu(tr.r3), - le32_to_cpu(tr.r4), le32_to_cpu(tr.r5), - le32_to_cpu(tr.r6), le32_to_cpu(tr.r7)); - - return simple_read_from_buffer(data, count, &pos, buf, res); -} - -static int brcmf_sdio_assert_info(struct brcmf_sdio *bus, - struct sdpcm_shared *sh, char __user *data, - size_t count) -{ - int error = 0; - char buf[200]; - char file[80] = "?"; - char expr[80] = ""; - int res; - loff_t pos = 0; - - if ((sh->flags & SDPCM_SHARED_ASSERT_BUILT) == 0) { - brcmf_dbg(INFO, "firmware not built with -assert\n"); - return 0; - } else if ((sh->flags & SDPCM_SHARED_ASSERT) == 0) { - brcmf_dbg(INFO, "no assert in dongle\n"); - return 0; - } - - sdio_claim_host(bus->sdiodev->func[1]); - if (sh->assert_file_addr != 0) { - error = brcmf_sdio_ramrw(bus->sdiodev, false, - sh->assert_file_addr, (u8 *)file, 80); - if (error < 0) - return error; - } - if (sh->assert_exp_addr != 0) { - error = brcmf_sdio_ramrw(bus->sdiodev, false, - sh->assert_exp_addr, (u8 *)expr, 80); - if (error < 0) - return error; - } - sdio_release_host(bus->sdiodev->func[1]); - - res = scnprintf(buf, sizeof(buf), - "dongle assert: %s:%d: assert(%s)\n", - file, sh->assert_line, expr); - return simple_read_from_buffer(data, count, &pos, buf, res); -} - -static int brcmf_sdbrcm_checkdied(struct brcmf_sdio *bus) -{ - int error; - struct sdpcm_shared sh; - - error = brcmf_sdio_readshared(bus, &sh); - - if (error < 0) - return error; - - if ((sh.flags & SDPCM_SHARED_ASSERT_BUILT) == 0) - brcmf_dbg(INFO, "firmware not built with -assert\n"); - else if (sh.flags & SDPCM_SHARED_ASSERT) - brcmf_err("assertion in dongle\n"); - - if (sh.flags & SDPCM_SHARED_TRAP) - brcmf_err("firmware trap in dongle\n"); - - return 0; -} - -static int brcmf_sdbrcm_died_dump(struct brcmf_sdio *bus, char __user *data, - size_t count, loff_t *ppos) -{ - int error = 0; - struct sdpcm_shared sh; - int nbytes = 0; - loff_t pos = *ppos; - - if (pos != 0) - return 0; - - error = brcmf_sdio_readshared(bus, &sh); - if (error < 0) - goto done; - - error = brcmf_sdio_assert_info(bus, &sh, data, count); - if (error < 0) - goto done; - nbytes = error; - - error = brcmf_sdio_trap_info(bus, &sh, data+nbytes, count); - if (error < 0) - goto done; - nbytes += error; - - error = brcmf_sdio_dump_console(bus, &sh, data+nbytes, count); - if (error < 0) - goto done; - nbytes += error; - - error = nbytes; - *ppos += nbytes; -done: - return error; -} - -static ssize_t brcmf_sdio_forensic_read(struct file *f, char __user *data, - size_t count, loff_t *ppos) -{ - struct brcmf_sdio *bus = f->private_data; - int res; - - res = brcmf_sdbrcm_died_dump(bus, data, count, ppos); - if (res > 0) - *ppos += res; - return (ssize_t)res; -} - -static const struct file_operations brcmf_sdio_forensic_ops = { - .owner = THIS_MODULE, - .open = simple_open, - .read = brcmf_sdio_forensic_read -}; - -static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) -{ - struct brcmf_pub *drvr = bus->sdiodev->bus_if->drvr; - struct dentry *dentry = brcmf_debugfs_get_devdir(drvr); - - if (IS_ERR_OR_NULL(dentry)) - return; - - debugfs_create_file("forensics", S_IRUGO, dentry, bus, - &brcmf_sdio_forensic_ops); - brcmf_debugfs_create_sdio_count(drvr, &bus->sdcnt); -} -#else -static int brcmf_sdbrcm_checkdied(struct brcmf_sdio *bus) -{ - return 0; -} - -static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) -{ -} -#endif /* DEBUG */ - -static int -brcmf_sdbrcm_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen) -{ - int timeleft; - uint rxlen = 0; - bool pending; - u8 *buf; - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; - struct brcmf_sdio *bus = sdiodev->bus; - - brcmf_dbg(TRACE, "Enter\n"); - - /* Wait until control frame is available */ - timeleft = brcmf_sdbrcm_dcmd_resp_wait(bus, &bus->rxlen, &pending); - - spin_lock_bh(&bus->rxctl_lock); - rxlen = bus->rxlen; - memcpy(msg, bus->rxctl, min(msglen, rxlen)); - bus->rxctl = NULL; - buf = bus->rxctl_orig; - bus->rxctl_orig = NULL; - bus->rxlen = 0; - spin_unlock_bh(&bus->rxctl_lock); - vfree(buf); - - if (rxlen) { - brcmf_dbg(CTL, "resumed on rxctl frame, got %d expected %d\n", - rxlen, msglen); - } else if (timeleft == 0) { - brcmf_err("resumed on timeout\n"); - brcmf_sdbrcm_checkdied(bus); - } else if (pending) { - brcmf_dbg(CTL, "cancelled\n"); - return -ERESTARTSYS; - } else { - brcmf_dbg(CTL, "resumed for unknown reason?\n"); - brcmf_sdbrcm_checkdied(bus); - } - - if (rxlen) - bus->sdcnt.rx_ctlpkts++; - else - bus->sdcnt.rx_ctlerrs++; - - return rxlen ? (int)rxlen : -ETIMEDOUT; -} - -static bool brcmf_sdbrcm_download_state(struct brcmf_sdio *bus, bool enter) -{ - struct chip_info *ci = bus->ci; - - /* To enter download state, disable ARM and reset SOCRAM. - * To exit download state, simply reset ARM (default is RAM boot). - */ - if (enter) { - bus->alp_only = true; - - brcmf_sdio_chip_enter_download(bus->sdiodev, ci); - } else { - if (!brcmf_sdio_chip_exit_download(bus->sdiodev, ci, bus->vars, - bus->varsz)) - return false; - - /* Allow HT Clock now that the ARM is running. */ - bus->alp_only = false; - - bus->sdiodev->bus_if->state = BRCMF_BUS_LOAD; - } - - return true; -} - -static int brcmf_sdbrcm_get_image(char *buf, int len, struct brcmf_sdio *bus) -{ - if (bus->firmware->size < bus->fw_ptr + len) - len = bus->firmware->size - bus->fw_ptr; - - memcpy(buf, &bus->firmware->data[bus->fw_ptr], len); - bus->fw_ptr += len; - return len; -} - -static int brcmf_sdbrcm_download_code_file(struct brcmf_sdio *bus) -{ - int offset; - uint len; - u8 *memblock = NULL, *memptr; - int ret; - u8 idx; - - brcmf_dbg(INFO, "Enter\n"); - - ret = request_firmware(&bus->firmware, BRCMF_SDIO_FW_NAME, - &bus->sdiodev->func[2]->dev); - if (ret) { - brcmf_err("Fail to request firmware %d\n", ret); - return ret; - } - bus->fw_ptr = 0; - - memptr = memblock = kmalloc(MEMBLOCK + BRCMF_SDALIGN, GFP_ATOMIC); - if (memblock == NULL) { - ret = -ENOMEM; - goto err; - } - if ((u32)(unsigned long)memblock % BRCMF_SDALIGN) - memptr += (BRCMF_SDALIGN - - ((u32)(unsigned long)memblock % BRCMF_SDALIGN)); - - offset = bus->ci->rambase; - - /* Download image */ - len = brcmf_sdbrcm_get_image((char *)memptr, MEMBLOCK, bus); - idx = brcmf_sdio_chip_getinfidx(bus->ci, BCMA_CORE_ARM_CR4); - if (BRCMF_MAX_CORENUM != idx) - memcpy(&bus->ci->rst_vec, memptr, sizeof(bus->ci->rst_vec)); - while (len) { - ret = brcmf_sdio_ramrw(bus->sdiodev, true, offset, memptr, len); - if (ret) { - brcmf_err("error %d on writing %d membytes at 0x%08x\n", - ret, MEMBLOCK, offset); - goto err; - } - - offset += MEMBLOCK; - len = brcmf_sdbrcm_get_image((char *)memptr, MEMBLOCK, bus); - } - -err: - kfree(memblock); - - release_firmware(bus->firmware); - bus->fw_ptr = 0; - - return ret; -} - -/* - * ProcessVars:Takes a buffer of "=\n" lines read from a file - * and ending in a NUL. - * Removes carriage returns, empty lines, comment lines, and converts - * newlines to NULs. - * Shortens buffer as needed and pads with NULs. End of buffer is marked - * by two NULs. -*/ - -static int brcmf_process_nvram_vars(struct brcmf_sdio *bus) -{ - char *varbuf; - char *dp; - bool findNewline; - int column; - int ret = 0; - uint buf_len, n, len; - - len = bus->firmware->size; - varbuf = vmalloc(len); - if (!varbuf) - return -ENOMEM; - - memcpy(varbuf, bus->firmware->data, len); - dp = varbuf; - - findNewline = false; - column = 0; - - for (n = 0; n < len; n++) { - if (varbuf[n] == 0) - break; - if (varbuf[n] == '\r') - continue; - if (findNewline && varbuf[n] != '\n') - continue; - findNewline = false; - if (varbuf[n] == '#') { - findNewline = true; - continue; - } - if (varbuf[n] == '\n') { - if (column == 0) - continue; - *dp++ = 0; - column = 0; - continue; - } - *dp++ = varbuf[n]; - column++; - } - buf_len = dp - varbuf; - while (dp < varbuf + n) - *dp++ = 0; - - kfree(bus->vars); - /* roundup needed for download to device */ - bus->varsz = roundup(buf_len + 1, 4); - bus->vars = kmalloc(bus->varsz, GFP_KERNEL); - if (bus->vars == NULL) { - bus->varsz = 0; - ret = -ENOMEM; - goto err; - } - - /* copy the processed variables and add null termination */ - memcpy(bus->vars, varbuf, buf_len); - bus->vars[buf_len] = 0; -err: - vfree(varbuf); - return ret; -} - -static int brcmf_sdbrcm_download_nvram(struct brcmf_sdio *bus) -{ - int ret; - - ret = request_firmware(&bus->firmware, BRCMF_SDIO_NV_NAME, - &bus->sdiodev->func[2]->dev); - if (ret) { - brcmf_err("Fail to request nvram %d\n", ret); - return ret; - } - - ret = brcmf_process_nvram_vars(bus); - - release_firmware(bus->firmware); - - return ret; -} - -static int _brcmf_sdbrcm_download_firmware(struct brcmf_sdio *bus) -{ - int bcmerror = -1; - - /* Keep arm in reset */ - if (!brcmf_sdbrcm_download_state(bus, true)) { - brcmf_err("error placing ARM core in reset\n"); - goto err; - } - - if (brcmf_sdbrcm_download_code_file(bus)) { - brcmf_err("dongle image file download failed\n"); - goto err; - } - - if (brcmf_sdbrcm_download_nvram(bus)) { - brcmf_err("dongle nvram file download failed\n"); - goto err; - } - - /* Take arm out of reset */ - if (!brcmf_sdbrcm_download_state(bus, false)) { - brcmf_err("error getting out of ARM core reset\n"); - goto err; - } - - bcmerror = 0; - -err: - return bcmerror; -} - -static bool brcmf_sdbrcm_sr_capable(struct brcmf_sdio *bus) -{ - u32 addr, reg; - - brcmf_dbg(TRACE, "Enter\n"); - - /* old chips with PMU version less than 17 don't support save restore */ - if (bus->ci->pmurev < 17) - return false; - - /* read PMU chipcontrol register 3*/ - addr = CORE_CC_REG(bus->ci->c_inf[0].base, chipcontrol_addr); - brcmf_sdio_regwl(bus->sdiodev, addr, 3, NULL); - addr = CORE_CC_REG(bus->ci->c_inf[0].base, chipcontrol_data); - reg = brcmf_sdio_regrl(bus->sdiodev, addr, NULL); - - return (bool)reg; -} - -static void brcmf_sdbrcm_sr_init(struct brcmf_sdio *bus) -{ - int err = 0; - u8 val; - - brcmf_dbg(TRACE, "Enter\n"); - - val = brcmf_sdio_regrb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, - &err); - if (err) { - brcmf_err("error reading SBSDIO_FUNC1_WAKEUPCTRL\n"); - return; - } - - val |= 1 << SBSDIO_FUNC1_WCTRL_HTWAIT_SHIFT; - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, - val, &err); - if (err) { - brcmf_err("error writing SBSDIO_FUNC1_WAKEUPCTRL\n"); - return; - } - - /* Add CMD14 Support */ - brcmf_sdio_regwb(bus->sdiodev, SDIO_CCCR_BRCM_CARDCAP, - (SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT | - SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT), - &err); - if (err) { - brcmf_err("error writing SDIO_CCCR_BRCM_CARDCAP\n"); - return; - } - - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, - SBSDIO_FORCE_HT, &err); - if (err) { - brcmf_err("error writing SBSDIO_FUNC1_CHIPCLKCSR\n"); - return; - } - - /* set flag */ - bus->sr_enabled = true; - brcmf_dbg(INFO, "SR enabled\n"); -} - -/* enable KSO bit */ -static int brcmf_sdbrcm_kso_init(struct brcmf_sdio *bus) -{ - u8 val; - int err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - - /* KSO bit added in SDIO core rev 12 */ - if (bus->ci->c_inf[1].rev < 12) - return 0; - - val = brcmf_sdio_regrb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, - &err); - if (err) { - brcmf_err("error reading SBSDIO_FUNC1_SLEEPCSR\n"); - return err; - } - - if (!(val & SBSDIO_FUNC1_SLEEPCSR_KSO_MASK)) { - val |= (SBSDIO_FUNC1_SLEEPCSR_KSO_EN << - SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT); - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, - val, &err); - if (err) { - brcmf_err("error writing SBSDIO_FUNC1_SLEEPCSR\n"); - return err; - } - } - - return 0; -} - - -static bool -brcmf_sdbrcm_download_firmware(struct brcmf_sdio *bus) -{ - bool ret; - - sdio_claim_host(bus->sdiodev->func[1]); - - brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); - - ret = _brcmf_sdbrcm_download_firmware(bus) == 0; - - brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false); - - sdio_release_host(bus->sdiodev->func[1]); - - return ret; -} - -static int brcmf_sdbrcm_bus_init(struct device *dev) -{ - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; - struct brcmf_sdio *bus = sdiodev->bus; - unsigned long timeout; - u8 ready, enable; - int err, ret = 0; - u8 saveclk; - - brcmf_dbg(TRACE, "Enter\n"); - - /* try to download image and nvram to the dongle */ - if (bus_if->state == BRCMF_BUS_DOWN) { - if (!(brcmf_sdbrcm_download_firmware(bus))) - return -1; - } - - if (!bus->sdiodev->bus_if->drvr) - return 0; - - /* Start the watchdog timer */ - bus->sdcnt.tickcnt = 0; - brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS); - - sdio_claim_host(bus->sdiodev->func[1]); - - /* Make sure backplane clock is on, needed to generate F2 interrupt */ - brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); - if (bus->clkstate != CLK_AVAIL) - goto exit; - - /* Force clocks on backplane to be sure F2 interrupt propagates */ - saveclk = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_FUNC1_CHIPCLKCSR, &err); - if (!err) { - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, - (saveclk | SBSDIO_FORCE_HT), &err); - } - if (err) { - brcmf_err("Failed to force clock for F2: err %d\n", err); - goto exit; - } - - /* Enable function 2 (frame transfers) */ - w_sdreg32(bus, SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT, - offsetof(struct sdpcmd_regs, tosbmailboxdata)); - enable = (SDIO_FUNC_ENABLE_1 | SDIO_FUNC_ENABLE_2); - - brcmf_sdio_regwb(bus->sdiodev, SDIO_CCCR_IOEx, enable, NULL); - - timeout = jiffies + msecs_to_jiffies(BRCMF_WAIT_F2RDY); - ready = 0; - while (enable != ready) { - ready = brcmf_sdio_regrb(bus->sdiodev, - SDIO_CCCR_IORx, NULL); - if (time_after(jiffies, timeout)) - break; - else if (time_after(jiffies, timeout - BRCMF_WAIT_F2RDY + 50)) - /* prevent busy waiting if it takes too long */ - msleep_interruptible(20); - } - - brcmf_dbg(INFO, "enable 0x%02x, ready 0x%02x\n", enable, ready); - - /* If F2 successfully enabled, set core and enable interrupts */ - if (ready == enable) { - /* Set up the interrupt mask and enable interrupts */ - bus->hostintmask = HOSTINTMASK; - w_sdreg32(bus, bus->hostintmask, - offsetof(struct sdpcmd_regs, hostintmask)); - - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_WATERMARK, 8, &err); - } else { - /* Disable F2 again */ - enable = SDIO_FUNC_ENABLE_1; - brcmf_sdio_regwb(bus->sdiodev, SDIO_CCCR_IOEx, enable, NULL); - ret = -ENODEV; - } - - if (brcmf_sdbrcm_sr_capable(bus)) { - brcmf_sdbrcm_sr_init(bus); - } else { - /* Restore previous clock setting */ - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, - saveclk, &err); - } - - if (ret == 0) { - ret = brcmf_sdio_intr_register(bus->sdiodev); - if (ret != 0) - brcmf_err("intr register failed:%d\n", ret); - } - - /* If we didn't come up, turn off backplane clock */ - if (bus_if->state != BRCMF_BUS_DATA) - brcmf_sdbrcm_clkctl(bus, CLK_NONE, false); - -exit: - sdio_release_host(bus->sdiodev->func[1]); - - return ret; -} - -void brcmf_sdbrcm_isr(void *arg) -{ - struct brcmf_sdio *bus = (struct brcmf_sdio *) arg; - - brcmf_dbg(TRACE, "Enter\n"); - - if (!bus) { - brcmf_err("bus is null pointer, exiting\n"); - return; - } - - if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) { - brcmf_err("bus is down. we have nothing to do\n"); - return; - } - /* Count the interrupt call */ - bus->sdcnt.intrcount++; - if (in_interrupt()) - atomic_set(&bus->ipend, 1); - else - if (brcmf_sdio_intr_rstatus(bus)) { - brcmf_err("failed backplane access\n"); - bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; - } - - /* Disable additional interrupts (is this needed now)? */ - if (!bus->intr) - brcmf_err("isr w/o interrupt configured!\n"); - - brcmf_sdbrcm_adddpctsk(bus); - queue_work(bus->brcmf_wq, &bus->datawork); -} - -static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) -{ -#ifdef DEBUG - struct brcmf_bus *bus_if = dev_get_drvdata(bus->sdiodev->dev); -#endif /* DEBUG */ - unsigned long flags; - - brcmf_dbg(TIMER, "Enter\n"); - - /* Poll period: check device if appropriate. */ - if (!bus->sr_enabled && - bus->poll && (++bus->polltick >= bus->pollrate)) { - u32 intstatus = 0; - - /* Reset poll tick */ - bus->polltick = 0; - - /* Check device if no interrupts */ - if (!bus->intr || - (bus->sdcnt.intrcount == bus->sdcnt.lastintrs)) { - - spin_lock_irqsave(&bus->dpc_tl_lock, flags); - if (list_empty(&bus->dpc_tsklst)) { - u8 devpend; - spin_unlock_irqrestore(&bus->dpc_tl_lock, - flags); - sdio_claim_host(bus->sdiodev->func[1]); - devpend = brcmf_sdio_regrb(bus->sdiodev, - SDIO_CCCR_INTx, - NULL); - sdio_release_host(bus->sdiodev->func[1]); - intstatus = - devpend & (INTR_STATUS_FUNC1 | - INTR_STATUS_FUNC2); - } else { - spin_unlock_irqrestore(&bus->dpc_tl_lock, - flags); - } - - /* If there is something, make like the ISR and - schedule the DPC */ - if (intstatus) { - bus->sdcnt.pollcnt++; - atomic_set(&bus->ipend, 1); - - brcmf_sdbrcm_adddpctsk(bus); - queue_work(bus->brcmf_wq, &bus->datawork); - } - } - - /* Update interrupt tracking */ - bus->sdcnt.lastintrs = bus->sdcnt.intrcount; - } -#ifdef DEBUG - /* Poll for console output periodically */ - if (bus_if && bus_if->state == BRCMF_BUS_DATA && - bus->console_interval != 0) { - bus->console.count += BRCMF_WD_POLL_MS; - if (bus->console.count >= bus->console_interval) { - bus->console.count -= bus->console_interval; - sdio_claim_host(bus->sdiodev->func[1]); - /* Make sure backplane clock is on */ - brcmf_sdbrcm_bus_sleep(bus, false, false); - if (brcmf_sdbrcm_readconsole(bus) < 0) - /* stop on error */ - bus->console_interval = 0; - sdio_release_host(bus->sdiodev->func[1]); - } - } -#endif /* DEBUG */ - - /* On idle timeout clear activity flag and/or turn off clock */ - if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) { - if (++bus->idlecount >= bus->idletime) { - bus->idlecount = 0; - if (bus->activity) { - bus->activity = false; - brcmf_sdbrcm_wd_timer(bus, BRCMF_WD_POLL_MS); - } else { - brcmf_dbg(SDIO, "idle\n"); - sdio_claim_host(bus->sdiodev->func[1]); - brcmf_sdbrcm_bus_sleep(bus, true, false); - sdio_release_host(bus->sdiodev->func[1]); - } - } - } - - return (atomic_read(&bus->ipend) > 0); -} - -static bool brcmf_sdbrcm_chipmatch(u16 chipid) -{ - if (chipid == BCM43143_CHIP_ID) - return true; - if (chipid == BCM43241_CHIP_ID) - return true; - if (chipid == BCM4329_CHIP_ID) - return true; - if (chipid == BCM4330_CHIP_ID) - return true; - if (chipid == BCM4334_CHIP_ID) - return true; - if (chipid == BCM4335_CHIP_ID) - return true; - return false; -} - -static void brcmf_sdio_dataworker(struct work_struct *work) -{ - struct brcmf_sdio *bus = container_of(work, struct brcmf_sdio, - datawork); - struct list_head *cur_hd, *tmp_hd; - unsigned long flags; - - spin_lock_irqsave(&bus->dpc_tl_lock, flags); - list_for_each_safe(cur_hd, tmp_hd, &bus->dpc_tsklst) { - spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); - - brcmf_sdbrcm_dpc(bus); - - spin_lock_irqsave(&bus->dpc_tl_lock, flags); - list_del(cur_hd); - kfree(cur_hd); - } - spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); -} - -static void brcmf_sdbrcm_release_malloc(struct brcmf_sdio *bus) -{ - brcmf_dbg(TRACE, "Enter\n"); - - kfree(bus->rxbuf); - bus->rxctl = bus->rxbuf = NULL; - bus->rxlen = 0; - - kfree(bus->databuf); - bus->databuf = NULL; -} - -static bool brcmf_sdbrcm_probe_malloc(struct brcmf_sdio *bus) -{ - brcmf_dbg(TRACE, "Enter\n"); - - if (bus->sdiodev->bus_if->maxctl) { - bus->rxblen = - roundup((bus->sdiodev->bus_if->maxctl + SDPCM_HDRLEN), - ALIGNMENT) + BRCMF_SDALIGN; - bus->rxbuf = kmalloc(bus->rxblen, GFP_ATOMIC); - if (!(bus->rxbuf)) - goto fail; - } - - /* Allocate buffer to receive glomed packet */ - bus->databuf = kmalloc(MAX_DATA_BUF, GFP_ATOMIC); - if (!(bus->databuf)) { - /* release rxbuf which was already located as above */ - if (!bus->rxblen) - kfree(bus->rxbuf); - goto fail; - } - - /* Align the buffer */ - if ((unsigned long)bus->databuf % BRCMF_SDALIGN) - bus->dataptr = bus->databuf + (BRCMF_SDALIGN - - ((unsigned long)bus->databuf % BRCMF_SDALIGN)); - else - bus->dataptr = bus->databuf; - - return true; - -fail: - return false; -} - -static bool -brcmf_sdbrcm_probe_attach(struct brcmf_sdio *bus, u32 regsva) -{ - u8 clkctl = 0; - int err = 0; - int reg_addr; - u32 reg_val; - u32 drivestrength; - - bus->alp_only = true; - - sdio_claim_host(bus->sdiodev->func[1]); - - pr_debug("F1 signature read @0x18000000=0x%4x\n", - brcmf_sdio_regrl(bus->sdiodev, SI_ENUM_BASE, NULL)); - - /* - * Force PLL off until brcmf_sdio_chip_attach() - * programs PLL control regs - */ - - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, - BRCMF_INIT_CLKCTL1, &err); - if (!err) - clkctl = brcmf_sdio_regrb(bus->sdiodev, - SBSDIO_FUNC1_CHIPCLKCSR, &err); - - if (err || ((clkctl & ~SBSDIO_AVBITS) != BRCMF_INIT_CLKCTL1)) { - brcmf_err("ChipClkCSR access: err %d wrote 0x%02x read 0x%02x\n", - err, BRCMF_INIT_CLKCTL1, clkctl); - goto fail; - } - - if (brcmf_sdio_chip_attach(bus->sdiodev, &bus->ci, regsva)) { - brcmf_err("brcmf_sdio_chip_attach failed!\n"); - goto fail; - } - - if (!brcmf_sdbrcm_chipmatch((u16) bus->ci->chip)) { - brcmf_err("unsupported chip: 0x%04x\n", bus->ci->chip); - goto fail; - } - - if (brcmf_sdbrcm_kso_init(bus)) { - brcmf_err("error enabling KSO\n"); - goto fail; - } - - if ((bus->sdiodev->pdata) && (bus->sdiodev->pdata->drive_strength)) - drivestrength = bus->sdiodev->pdata->drive_strength; - else - drivestrength = DEFAULT_SDIO_DRIVE_STRENGTH; - brcmf_sdio_chip_drivestrengthinit(bus->sdiodev, bus->ci, drivestrength); - - /* Get info on the SOCRAM cores... */ - bus->ramsize = bus->ci->ramsize; - if (!(bus->ramsize)) { - brcmf_err("failed to find SOCRAM memory!\n"); - goto fail; - } - - /* Set card control so an SDIO card reset does a WLAN backplane reset */ - reg_val = brcmf_sdio_regrb(bus->sdiodev, - SDIO_CCCR_BRCM_CARDCTRL, &err); - if (err) - goto fail; - - reg_val |= SDIO_CCCR_BRCM_CARDCTRL_WLANRESET; - - brcmf_sdio_regwb(bus->sdiodev, - SDIO_CCCR_BRCM_CARDCTRL, reg_val, &err); - if (err) - goto fail; - - /* set PMUControl so a backplane reset does PMU state reload */ - reg_addr = CORE_CC_REG(bus->ci->c_inf[0].base, - pmucontrol); - reg_val = brcmf_sdio_regrl(bus->sdiodev, - reg_addr, - &err); - if (err) - goto fail; - - reg_val |= (BCMA_CC_PMU_CTL_RES_RELOAD << BCMA_CC_PMU_CTL_RES_SHIFT); - - brcmf_sdio_regwl(bus->sdiodev, - reg_addr, - reg_val, - &err); - if (err) - goto fail; - - - sdio_release_host(bus->sdiodev->func[1]); - - brcmu_pktq_init(&bus->txq, (PRIOMASK + 1), TXQLEN); - - /* Locate an appropriately-aligned portion of hdrbuf */ - bus->rxhdr = (u8 *) roundup((unsigned long)&bus->hdrbuf[0], - BRCMF_SDALIGN); - - /* Set the poll and/or interrupt flags */ - bus->intr = true; - bus->poll = false; - if (bus->poll) - bus->pollrate = 1; - - return true; - -fail: - sdio_release_host(bus->sdiodev->func[1]); - return false; -} - -static bool brcmf_sdbrcm_probe_init(struct brcmf_sdio *bus) -{ - brcmf_dbg(TRACE, "Enter\n"); - - sdio_claim_host(bus->sdiodev->func[1]); - - /* Disable F2 to clear any intermediate frame state on the dongle */ - brcmf_sdio_regwb(bus->sdiodev, SDIO_CCCR_IOEx, - SDIO_FUNC_ENABLE_1, NULL); - - bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; - bus->rxflow = false; - - /* Done with backplane-dependent accesses, can drop clock... */ - brcmf_sdio_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL); - - sdio_release_host(bus->sdiodev->func[1]); - - /* ...and initialize clock/power states */ - bus->clkstate = CLK_SDONLY; - bus->idletime = BRCMF_IDLE_INTERVAL; - bus->idleclock = BRCMF_IDLE_ACTIVE; - - /* Query the F2 block size, set roundup accordingly */ - bus->blocksize = bus->sdiodev->func[2]->cur_blksize; - bus->roundup = min(max_roundup, bus->blocksize); - - /* bus module does not support packet chaining */ - bus->use_rxchain = false; - bus->sd_rxchain = false; - - /* SR state */ - bus->sleeping = false; - bus->sr_enabled = false; - - return true; -} - -static int -brcmf_sdbrcm_watchdog_thread(void *data) -{ - struct brcmf_sdio *bus = (struct brcmf_sdio *)data; - - allow_signal(SIGTERM); - /* Run until signal received */ - while (1) { - if (kthread_should_stop()) - break; - if (!wait_for_completion_interruptible(&bus->watchdog_wait)) { - brcmf_sdbrcm_bus_watchdog(bus); - /* Count the tick for reference */ - bus->sdcnt.tickcnt++; - } else - break; - } - return 0; -} - -static void -brcmf_sdbrcm_watchdog(unsigned long data) -{ - struct brcmf_sdio *bus = (struct brcmf_sdio *)data; - - if (bus->watchdog_tsk) { - complete(&bus->watchdog_wait); - /* Reschedule the watchdog */ - if (bus->wd_timer_valid) - mod_timer(&bus->timer, - jiffies + BRCMF_WD_POLL_MS * HZ / 1000); - } -} - -static void brcmf_sdbrcm_release_dongle(struct brcmf_sdio *bus) -{ - brcmf_dbg(TRACE, "Enter\n"); - - if (bus->ci) { - sdio_claim_host(bus->sdiodev->func[1]); - brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); - brcmf_sdbrcm_clkctl(bus, CLK_NONE, false); - sdio_release_host(bus->sdiodev->func[1]); - brcmf_sdio_chip_detach(&bus->ci); - if (bus->vars && bus->varsz) - kfree(bus->vars); - bus->vars = NULL; - } - - brcmf_dbg(TRACE, "Disconnected\n"); -} - -/* Detach and free everything */ -static void brcmf_sdbrcm_release(struct brcmf_sdio *bus) -{ - brcmf_dbg(TRACE, "Enter\n"); - - if (bus) { - /* De-register interrupt handler */ - brcmf_sdio_intr_unregister(bus->sdiodev); - - cancel_work_sync(&bus->datawork); - if (bus->brcmf_wq) - destroy_workqueue(bus->brcmf_wq); - - if (bus->sdiodev->bus_if->drvr) { - brcmf_detach(bus->sdiodev->dev); - brcmf_sdbrcm_release_dongle(bus); - } - - brcmf_sdbrcm_release_malloc(bus); - - kfree(bus); - } - - brcmf_dbg(TRACE, "Disconnected\n"); -} - -static struct brcmf_bus_ops brcmf_sdio_bus_ops = { - .stop = brcmf_sdbrcm_bus_stop, - .init = brcmf_sdbrcm_bus_init, - .txdata = brcmf_sdbrcm_bus_txdata, - .txctl = brcmf_sdbrcm_bus_txctl, - .rxctl = brcmf_sdbrcm_bus_rxctl, - .gettxq = brcmf_sdbrcm_bus_gettxq, -}; - -void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) -{ - int ret; - struct brcmf_sdio *bus; - struct brcmf_bus_dcmd *dlst; - u32 dngl_txglom; - u32 dngl_txglomalign; - u8 idx; - - brcmf_dbg(TRACE, "Enter\n"); - - /* We make an assumption about address window mappings: - * regsva == SI_ENUM_BASE*/ - - /* Allocate private bus interface state */ - bus = kzalloc(sizeof(struct brcmf_sdio), GFP_ATOMIC); - if (!bus) - goto fail; - - bus->sdiodev = sdiodev; - sdiodev->bus = bus; - skb_queue_head_init(&bus->glom); - bus->txbound = BRCMF_TXBOUND; - bus->rxbound = BRCMF_RXBOUND; - bus->txminmax = BRCMF_TXMINMAX; - bus->tx_seq = SDPCM_SEQUENCE_WRAP - 1; - - INIT_WORK(&bus->datawork, brcmf_sdio_dataworker); - bus->brcmf_wq = create_singlethread_workqueue("brcmf_wq"); - if (bus->brcmf_wq == NULL) { - brcmf_err("insufficient memory to create txworkqueue\n"); - goto fail; - } - - /* attempt to attach to the dongle */ - if (!(brcmf_sdbrcm_probe_attach(bus, regsva))) { - brcmf_err("brcmf_sdbrcm_probe_attach failed\n"); - goto fail; - } - - spin_lock_init(&bus->rxctl_lock); - spin_lock_init(&bus->txqlock); - init_waitqueue_head(&bus->ctrl_wait); - init_waitqueue_head(&bus->dcmd_resp_wait); - - /* Set up the watchdog timer */ - init_timer(&bus->timer); - bus->timer.data = (unsigned long)bus; - bus->timer.function = brcmf_sdbrcm_watchdog; - - /* Initialize watchdog thread */ - init_completion(&bus->watchdog_wait); - bus->watchdog_tsk = kthread_run(brcmf_sdbrcm_watchdog_thread, - bus, "brcmf_watchdog"); - if (IS_ERR(bus->watchdog_tsk)) { - pr_warn("brcmf_watchdog thread failed to start\n"); - bus->watchdog_tsk = NULL; - } - /* Initialize DPC thread */ - INIT_LIST_HEAD(&bus->dpc_tsklst); - spin_lock_init(&bus->dpc_tl_lock); - - /* Assign bus interface call back */ - bus->sdiodev->bus_if->dev = bus->sdiodev->dev; - bus->sdiodev->bus_if->ops = &brcmf_sdio_bus_ops; - bus->sdiodev->bus_if->chip = bus->ci->chip; - bus->sdiodev->bus_if->chiprev = bus->ci->chiprev; - - /* Attach to the brcmf/OS/network interface */ - ret = brcmf_attach(SDPCM_RESERVE, bus->sdiodev->dev); - if (ret != 0) { - brcmf_err("brcmf_attach failed\n"); - goto fail; - } - - /* Allocate buffers */ - if (!(brcmf_sdbrcm_probe_malloc(bus))) { - brcmf_err("brcmf_sdbrcm_probe_malloc failed\n"); - goto fail; - } - - if (!(brcmf_sdbrcm_probe_init(bus))) { - brcmf_err("brcmf_sdbrcm_probe_init failed\n"); - goto fail; - } - - brcmf_sdio_debugfs_create(bus); - brcmf_dbg(INFO, "completed!!\n"); - - /* sdio bus core specific dcmd */ - idx = brcmf_sdio_chip_getinfidx(bus->ci, BCMA_CORE_SDIO_DEV); - dlst = kzalloc(sizeof(struct brcmf_bus_dcmd), GFP_KERNEL); - if (dlst) { - if (bus->ci->c_inf[idx].rev < 12) { - /* for sdio core rev < 12, disable txgloming */ - dngl_txglom = 0; - dlst->name = "bus:txglom"; - dlst->param = (char *)&dngl_txglom; - dlst->param_len = sizeof(u32); - } else { - /* otherwise, set txglomalign */ - dngl_txglomalign = bus->sdiodev->bus_if->align; - dlst->name = "bus:txglomalign"; - dlst->param = (char *)&dngl_txglomalign; - dlst->param_len = sizeof(u32); - } - list_add(&dlst->list, &bus->sdiodev->bus_if->dcmd_list); - } - - /* if firmware path present try to download and bring up bus */ - ret = brcmf_bus_start(bus->sdiodev->dev); - if (ret != 0) { - brcmf_err("dongle is not responding\n"); - goto fail; - } - - return bus; - -fail: - brcmf_sdbrcm_release(bus); - return NULL; -} - -void brcmf_sdbrcm_disconnect(void *ptr) -{ - struct brcmf_sdio *bus = (struct brcmf_sdio *)ptr; - - brcmf_dbg(TRACE, "Enter\n"); - - if (bus) - brcmf_sdbrcm_release(bus); - - brcmf_dbg(TRACE, "Disconnected\n"); -} - -void -brcmf_sdbrcm_wd_timer(struct brcmf_sdio *bus, uint wdtick) -{ - /* Totally stop the timer */ - if (!wdtick && bus->wd_timer_valid) { - del_timer_sync(&bus->timer); - bus->wd_timer_valid = false; - bus->save_ms = wdtick; - return; - } - - /* don't start the wd until fw is loaded */ - if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) - return; - - if (wdtick) { - if (bus->save_ms != BRCMF_WD_POLL_MS) { - if (bus->wd_timer_valid) - /* Stop timer and restart at new value */ - del_timer_sync(&bus->timer); - - /* Create timer again when watchdog period is - dynamically changed or in the first instance - */ - bus->timer.expires = - jiffies + BRCMF_WD_POLL_MS * HZ / 1000; - add_timer(&bus->timer); - - } else { - /* Re arm the timer, at last watchdog period */ - mod_timer(&bus->timer, - jiffies + BRCMF_WD_POLL_MS * HZ / 1000); - } - - bus->wd_timer_valid = true; - bus->save_ms = wdtick; - } -} diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c deleted file mode 100644 index 83ee53a7c76e..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Copyright (c) 2012 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#include - -#include "brcmu_wifi.h" -#include "brcmu_utils.h" - -#include "dhd.h" -#include "dhd_dbg.h" -#include "tracepoint.h" -#include "fwsignal.h" -#include "fweh.h" -#include "fwil.h" - -/** - * struct brcm_ethhdr - broadcom specific ether header. - * - * @subtype: subtype for this packet. - * @length: TODO: length of appended data. - * @version: version indication. - * @oui: OUI of this packet. - * @usr_subtype: subtype for this OUI. - */ -struct brcm_ethhdr { - __be16 subtype; - __be16 length; - u8 version; - u8 oui[3]; - __be16 usr_subtype; -} __packed; - -struct brcmf_event_msg_be { - __be16 version; - __be16 flags; - __be32 event_type; - __be32 status; - __be32 reason; - __be32 auth_type; - __be32 datalen; - u8 addr[ETH_ALEN]; - char ifname[IFNAMSIZ]; - u8 ifidx; - u8 bsscfgidx; -} __packed; - -/** - * struct brcmf_event - contents of broadcom event packet. - * - * @eth: standard ether header. - * @hdr: broadcom specific ether header. - * @msg: common part of the actual event message. - */ -struct brcmf_event { - struct ethhdr eth; - struct brcm_ethhdr hdr; - struct brcmf_event_msg_be msg; -} __packed; - -/** - * struct brcmf_fweh_queue_item - event item on event queue. - * - * @q: list element for queuing. - * @code: event code. - * @ifidx: interface index related to this event. - * @ifaddr: ethernet address for interface. - * @emsg: common parameters of the firmware event message. - * @data: event specific data part of the firmware event. - */ -struct brcmf_fweh_queue_item { - struct list_head q; - enum brcmf_fweh_event_code code; - u8 ifidx; - u8 ifaddr[ETH_ALEN]; - struct brcmf_event_msg_be emsg; - u8 data[0]; -}; - -/** - * struct brcmf_fweh_event_name - code, name mapping entry. - */ -struct brcmf_fweh_event_name { - enum brcmf_fweh_event_code code; - const char *name; -}; - -#ifdef DEBUG -#define BRCMF_ENUM_DEF(id, val) \ - { val, #id }, - -/* array for mapping code to event name */ -static struct brcmf_fweh_event_name fweh_event_names[] = { - BRCMF_FWEH_EVENT_ENUM_DEFLIST -}; -#undef BRCMF_ENUM_DEF - -/** - * brcmf_fweh_event_name() - returns name for given event code. - * - * @code: code to lookup. - */ -static const char *brcmf_fweh_event_name(enum brcmf_fweh_event_code code) -{ - int i; - for (i = 0; i < ARRAY_SIZE(fweh_event_names); i++) { - if (fweh_event_names[i].code == code) - return fweh_event_names[i].name; - } - return "unknown"; -} -#else -static const char *brcmf_fweh_event_name(enum brcmf_fweh_event_code code) -{ - return "nodebug"; -} -#endif - -/** - * brcmf_fweh_queue_event() - create and queue event. - * - * @fweh: firmware event handling info. - * @event: event queue entry. - */ -static void brcmf_fweh_queue_event(struct brcmf_fweh_info *fweh, - struct brcmf_fweh_queue_item *event) -{ - ulong flags; - - spin_lock_irqsave(&fweh->evt_q_lock, flags); - list_add_tail(&event->q, &fweh->event_q); - spin_unlock_irqrestore(&fweh->evt_q_lock, flags); - schedule_work(&fweh->event_work); -} - -static int brcmf_fweh_call_event_handler(struct brcmf_if *ifp, - enum brcmf_fweh_event_code code, - struct brcmf_event_msg *emsg, - void *data) -{ - struct brcmf_fweh_info *fweh; - int err = -EINVAL; - - if (ifp) { - fweh = &ifp->drvr->fweh; - - /* handle the event if valid interface and handler */ - if (fweh->evt_handler[code]) - err = fweh->evt_handler[code](ifp, emsg, data); - else - brcmf_err("unhandled event %d ignored\n", code); - } else { - brcmf_err("no interface object\n"); - } - return err; -} - -/** - * brcmf_fweh_handle_if_event() - handle IF event. - * - * @drvr: driver information object. - * @item: queue entry. - * @ifpp: interface object (may change upon ADD action). - */ -static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, - struct brcmf_event_msg *emsg, - void *data) -{ - struct brcmf_if_event *ifevent = data; - struct brcmf_if *ifp; - int err = 0; - - brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n", - ifevent->action, ifevent->ifidx, ifevent->bssidx, - ifevent->flags, ifevent->role); - - if (ifevent->ifidx >= BRCMF_MAX_IFS) { - brcmf_err("invalid interface index: %u\n", - ifevent->ifidx); - return; - } - - ifp = drvr->iflist[ifevent->bssidx]; - - if (ifevent->action == BRCMF_E_IF_ADD) { - brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname, - emsg->addr); - ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx, - emsg->ifname, emsg->addr); - if (IS_ERR(ifp)) - return; - brcmf_fws_add_interface(ifp); - if (!drvr->fweh.evt_handler[BRCMF_E_IF]) - if (brcmf_net_attach(ifp, false) < 0) - return; - } - - if (ifevent->action == BRCMF_E_IF_CHANGE) - brcmf_fws_reset_interface(ifp); - - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); - - if (ifevent->action == BRCMF_E_IF_DEL) { - brcmf_fws_del_interface(ifp); - brcmf_del_if(drvr, ifevent->bssidx); - } -} - -/** - * brcmf_fweh_dequeue_event() - get event from the queue. - * - * @fweh: firmware event handling info. - */ -static struct brcmf_fweh_queue_item * -brcmf_fweh_dequeue_event(struct brcmf_fweh_info *fweh) -{ - struct brcmf_fweh_queue_item *event = NULL; - ulong flags; - - spin_lock_irqsave(&fweh->evt_q_lock, flags); - if (!list_empty(&fweh->event_q)) { - event = list_first_entry(&fweh->event_q, - struct brcmf_fweh_queue_item, q); - list_del(&event->q); - } - spin_unlock_irqrestore(&fweh->evt_q_lock, flags); - - return event; -} - -/** - * brcmf_fweh_event_worker() - firmware event worker. - * - * @work: worker object. - */ -static void brcmf_fweh_event_worker(struct work_struct *work) -{ - struct brcmf_pub *drvr; - struct brcmf_if *ifp; - struct brcmf_fweh_info *fweh; - struct brcmf_fweh_queue_item *event; - int err = 0; - struct brcmf_event_msg_be *emsg_be; - struct brcmf_event_msg emsg; - - fweh = container_of(work, struct brcmf_fweh_info, event_work); - drvr = container_of(fweh, struct brcmf_pub, fweh); - - while ((event = brcmf_fweh_dequeue_event(fweh))) { - brcmf_dbg(EVENT, "event %s (%u) ifidx %u bsscfg %u addr %pM\n", - brcmf_fweh_event_name(event->code), event->code, - event->emsg.ifidx, event->emsg.bsscfgidx, - event->emsg.addr); - - /* convert event message */ - emsg_be = &event->emsg; - emsg.version = be16_to_cpu(emsg_be->version); - emsg.flags = be16_to_cpu(emsg_be->flags); - emsg.event_code = event->code; - emsg.status = be32_to_cpu(emsg_be->status); - emsg.reason = be32_to_cpu(emsg_be->reason); - emsg.auth_type = be32_to_cpu(emsg_be->auth_type); - emsg.datalen = be32_to_cpu(emsg_be->datalen); - memcpy(emsg.addr, emsg_be->addr, ETH_ALEN); - memcpy(emsg.ifname, emsg_be->ifname, sizeof(emsg.ifname)); - emsg.ifidx = emsg_be->ifidx; - emsg.bsscfgidx = emsg_be->bsscfgidx; - - brcmf_dbg(EVENT, " version %u flags %u status %u reason %u\n", - emsg.version, emsg.flags, emsg.status, emsg.reason); - brcmf_dbg_hex_dump(BRCMF_EVENT_ON(), event->data, - min_t(u32, emsg.datalen, 64), - "event payload, len=%d\n", emsg.datalen); - - /* special handling of interface event */ - if (event->code == BRCMF_E_IF) { - brcmf_fweh_handle_if_event(drvr, &emsg, event->data); - goto event_free; - } - - ifp = drvr->iflist[emsg.bsscfgidx]; - err = brcmf_fweh_call_event_handler(ifp, event->code, &emsg, - event->data); - if (err) { - brcmf_err("event handler failed (%d)\n", - event->code); - err = 0; - } -event_free: - kfree(event); - } -} - -/** - * brcmf_fweh_attach() - initialize firmware event handling. - * - * @drvr: driver information object. - */ -void brcmf_fweh_attach(struct brcmf_pub *drvr) -{ - struct brcmf_fweh_info *fweh = &drvr->fweh; - INIT_WORK(&fweh->event_work, brcmf_fweh_event_worker); - spin_lock_init(&fweh->evt_q_lock); - INIT_LIST_HEAD(&fweh->event_q); -} - -/** - * brcmf_fweh_detach() - cleanup firmware event handling. - * - * @drvr: driver information object. - */ -void brcmf_fweh_detach(struct brcmf_pub *drvr) -{ - struct brcmf_fweh_info *fweh = &drvr->fweh; - struct brcmf_if *ifp = drvr->iflist[0]; - s8 eventmask[BRCMF_EVENTING_MASK_LEN]; - - if (ifp) { - /* clear all events */ - memset(eventmask, 0, BRCMF_EVENTING_MASK_LEN); - (void)brcmf_fil_iovar_data_set(ifp, "event_msgs", - eventmask, - BRCMF_EVENTING_MASK_LEN); - } - /* cancel the worker */ - cancel_work_sync(&fweh->event_work); - WARN_ON(!list_empty(&fweh->event_q)); - memset(fweh->evt_handler, 0, sizeof(fweh->evt_handler)); -} - -/** - * brcmf_fweh_register() - register handler for given event code. - * - * @drvr: driver information object. - * @code: event code. - * @handler: handler for the given event code. - */ -int brcmf_fweh_register(struct brcmf_pub *drvr, enum brcmf_fweh_event_code code, - brcmf_fweh_handler_t handler) -{ - if (drvr->fweh.evt_handler[code]) { - brcmf_err("event code %d already registered\n", code); - return -ENOSPC; - } - drvr->fweh.evt_handler[code] = handler; - brcmf_dbg(TRACE, "event handler registered for %s\n", - brcmf_fweh_event_name(code)); - return 0; -} - -/** - * brcmf_fweh_unregister() - remove handler for given code. - * - * @drvr: driver information object. - * @code: event code. - */ -void brcmf_fweh_unregister(struct brcmf_pub *drvr, - enum brcmf_fweh_event_code code) -{ - brcmf_dbg(TRACE, "event handler cleared for %s\n", - brcmf_fweh_event_name(code)); - drvr->fweh.evt_handler[code] = NULL; -} - -/** - * brcmf_fweh_activate_events() - enables firmware events registered. - * - * @ifp: primary interface object. - */ -int brcmf_fweh_activate_events(struct brcmf_if *ifp) -{ - int i, err; - s8 eventmask[BRCMF_EVENTING_MASK_LEN]; - - for (i = 0; i < BRCMF_E_LAST; i++) { - if (ifp->drvr->fweh.evt_handler[i]) { - brcmf_dbg(EVENT, "enable event %s\n", - brcmf_fweh_event_name(i)); - setbit(eventmask, i); - } - } - - /* want to handle IF event as well */ - brcmf_dbg(EVENT, "enable event IF\n"); - setbit(eventmask, BRCMF_E_IF); - - err = brcmf_fil_iovar_data_set(ifp, "event_msgs", - eventmask, BRCMF_EVENTING_MASK_LEN); - if (err) - brcmf_err("Set event_msgs error (%d)\n", err); - - return err; -} - -/** - * brcmf_fweh_process_event() - process skb as firmware event. - * - * @drvr: driver information object. - * @event_packet: event packet to process. - * - * If the packet buffer contains a firmware event message it will - * dispatch the event to a registered handler (using worker). - */ -void brcmf_fweh_process_event(struct brcmf_pub *drvr, - struct brcmf_event *event_packet) -{ - enum brcmf_fweh_event_code code; - struct brcmf_fweh_info *fweh = &drvr->fweh; - struct brcmf_fweh_queue_item *event; - gfp_t alloc_flag = GFP_KERNEL; - void *data; - u32 datalen; - - /* get event info */ - code = get_unaligned_be32(&event_packet->msg.event_type); - datalen = get_unaligned_be32(&event_packet->msg.datalen); - data = &event_packet[1]; - - if (code >= BRCMF_E_LAST) - return; - - if (code != BRCMF_E_IF && !fweh->evt_handler[code]) - return; - - if (in_interrupt()) - alloc_flag = GFP_ATOMIC; - - event = kzalloc(sizeof(*event) + datalen, alloc_flag); - if (!event) - return; - - event->code = code; - event->ifidx = event_packet->msg.ifidx; - - /* use memcpy to get aligned event message */ - memcpy(&event->emsg, &event_packet->msg, sizeof(event->emsg)); - memcpy(event->data, data, datalen); - memcpy(event->ifaddr, event_packet->eth.h_dest, ETH_ALEN); - - brcmf_fweh_queue_event(fweh, event); -} diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h deleted file mode 100644 index 6ec5db9c60a5..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2012 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -#ifndef FWEH_H_ -#define FWEH_H_ - -#include -#include -#include -#include - -/* formward declarations */ -struct brcmf_pub; -struct brcmf_if; -struct brcmf_cfg80211_info; -struct brcmf_event; - -/* list of firmware events */ -#define BRCMF_FWEH_EVENT_ENUM_DEFLIST \ - BRCMF_ENUM_DEF(SET_SSID, 0) \ - BRCMF_ENUM_DEF(JOIN, 1) \ - BRCMF_ENUM_DEF(START, 2) \ - BRCMF_ENUM_DEF(AUTH, 3) \ - BRCMF_ENUM_DEF(AUTH_IND, 4) \ - BRCMF_ENUM_DEF(DEAUTH, 5) \ - BRCMF_ENUM_DEF(DEAUTH_IND, 6) \ - BRCMF_ENUM_DEF(ASSOC, 7) \ - BRCMF_ENUM_DEF(ASSOC_IND, 8) \ - BRCMF_ENUM_DEF(REASSOC, 9) \ - BRCMF_ENUM_DEF(REASSOC_IND, 10) \ - BRCMF_ENUM_DEF(DISASSOC, 11) \ - BRCMF_ENUM_DEF(DISASSOC_IND, 12) \ - BRCMF_ENUM_DEF(QUIET_START, 13) \ - BRCMF_ENUM_DEF(QUIET_END, 14) \ - BRCMF_ENUM_DEF(BEACON_RX, 15) \ - BRCMF_ENUM_DEF(LINK, 16) \ - BRCMF_ENUM_DEF(MIC_ERROR, 17) \ - BRCMF_ENUM_DEF(NDIS_LINK, 18) \ - BRCMF_ENUM_DEF(ROAM, 19) \ - BRCMF_ENUM_DEF(TXFAIL, 20) \ - BRCMF_ENUM_DEF(PMKID_CACHE, 21) \ - BRCMF_ENUM_DEF(RETROGRADE_TSF, 22) \ - BRCMF_ENUM_DEF(PRUNE, 23) \ - BRCMF_ENUM_DEF(AUTOAUTH, 24) \ - BRCMF_ENUM_DEF(EAPOL_MSG, 25) \ - BRCMF_ENUM_DEF(SCAN_COMPLETE, 26) \ - BRCMF_ENUM_DEF(ADDTS_IND, 27) \ - BRCMF_ENUM_DEF(DELTS_IND, 28) \ - BRCMF_ENUM_DEF(BCNSENT_IND, 29) \ - BRCMF_ENUM_DEF(BCNRX_MSG, 30) \ - BRCMF_ENUM_DEF(BCNLOST_MSG, 31) \ - BRCMF_ENUM_DEF(ROAM_PREP, 32) \ - BRCMF_ENUM_DEF(PFN_NET_FOUND, 33) \ - BRCMF_ENUM_DEF(PFN_NET_LOST, 34) \ - BRCMF_ENUM_DEF(RESET_COMPLETE, 35) \ - BRCMF_ENUM_DEF(JOIN_START, 36) \ - BRCMF_ENUM_DEF(ROAM_START, 37) \ - BRCMF_ENUM_DEF(ASSOC_START, 38) \ - BRCMF_ENUM_DEF(IBSS_ASSOC, 39) \ - BRCMF_ENUM_DEF(RADIO, 40) \ - BRCMF_ENUM_DEF(PSM_WATCHDOG, 41) \ - BRCMF_ENUM_DEF(PROBREQ_MSG, 44) \ - BRCMF_ENUM_DEF(SCAN_CONFIRM_IND, 45) \ - BRCMF_ENUM_DEF(PSK_SUP, 46) \ - BRCMF_ENUM_DEF(COUNTRY_CODE_CHANGED, 47) \ - BRCMF_ENUM_DEF(EXCEEDED_MEDIUM_TIME, 48) \ - BRCMF_ENUM_DEF(ICV_ERROR, 49) \ - BRCMF_ENUM_DEF(UNICAST_DECODE_ERROR, 50) \ - BRCMF_ENUM_DEF(MULTICAST_DECODE_ERROR, 51) \ - BRCMF_ENUM_DEF(TRACE, 52) \ - BRCMF_ENUM_DEF(IF, 54) \ - BRCMF_ENUM_DEF(P2P_DISC_LISTEN_COMPLETE, 55) \ - BRCMF_ENUM_DEF(RSSI, 56) \ - BRCMF_ENUM_DEF(PFN_SCAN_COMPLETE, 57) \ - BRCMF_ENUM_DEF(EXTLOG_MSG, 58) \ - BRCMF_ENUM_DEF(ACTION_FRAME, 59) \ - BRCMF_ENUM_DEF(ACTION_FRAME_COMPLETE, 60) \ - BRCMF_ENUM_DEF(PRE_ASSOC_IND, 61) \ - BRCMF_ENUM_DEF(PRE_REASSOC_IND, 62) \ - BRCMF_ENUM_DEF(CHANNEL_ADOPTED, 63) \ - BRCMF_ENUM_DEF(AP_STARTED, 64) \ - BRCMF_ENUM_DEF(DFS_AP_STOP, 65) \ - BRCMF_ENUM_DEF(DFS_AP_RESUME, 66) \ - BRCMF_ENUM_DEF(ESCAN_RESULT, 69) \ - BRCMF_ENUM_DEF(ACTION_FRAME_OFF_CHAN_COMPLETE, 70) \ - BRCMF_ENUM_DEF(PROBERESP_MSG, 71) \ - BRCMF_ENUM_DEF(P2P_PROBEREQ_MSG, 72) \ - BRCMF_ENUM_DEF(DCS_REQUEST, 73) \ - BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \ - BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) - -#define BRCMF_ENUM_DEF(id, val) \ - BRCMF_E_##id = (val), - -/* firmware event codes sent by the dongle */ -enum brcmf_fweh_event_code { - BRCMF_FWEH_EVENT_ENUM_DEFLIST - BRCMF_E_LAST -}; -#undef BRCMF_ENUM_DEF - -/* flags field values in struct brcmf_event_msg */ -#define BRCMF_EVENT_MSG_LINK 0x01 -#define BRCMF_EVENT_MSG_FLUSHTXQ 0x02 -#define BRCMF_EVENT_MSG_GROUP 0x04 - -/** - * definitions for event packet validation. - */ -#define BRCMF_EVENT_OUI_OFFSET 19 -#define BRCM_OUI "\x00\x10\x18" -#define DOT11_OUI_LEN 3 -#define BCMILCP_BCM_SUBTYPE_EVENT 1 - - -/** - * struct brcmf_event_msg - firmware event message. - * - * @version: version information. - * @flags: event flags. - * @event_code: firmware event code. - * @status: status information. - * @reason: reason code. - * @auth_type: authentication type. - * @datalen: lenght of event data buffer. - * @addr: ether address. - * @ifname: interface name. - * @ifidx: interface index. - * @bsscfgidx: bsscfg index. - */ -struct brcmf_event_msg { - u16 version; - u16 flags; - u32 event_code; - u32 status; - u32 reason; - s32 auth_type; - u32 datalen; - u8 addr[ETH_ALEN]; - char ifname[IFNAMSIZ]; - u8 ifidx; - u8 bsscfgidx; -}; - -typedef int (*brcmf_fweh_handler_t)(struct brcmf_if *ifp, - const struct brcmf_event_msg *evtmsg, - void *data); - -/** - * struct brcmf_fweh_info - firmware event handling information. - * - * @event_work: event worker. - * @evt_q_lock: lock for event queue protection. - * @event_q: event queue. - * @evt_handler: registered event handlers. - */ -struct brcmf_fweh_info { - struct work_struct event_work; - spinlock_t evt_q_lock; - struct list_head event_q; - int (*evt_handler[BRCMF_E_LAST])(struct brcmf_if *ifp, - const struct brcmf_event_msg *evtmsg, - void *data); -}; - -void brcmf_fweh_attach(struct brcmf_pub *drvr); -void brcmf_fweh_detach(struct brcmf_pub *drvr); -int brcmf_fweh_register(struct brcmf_pub *drvr, enum brcmf_fweh_event_code code, - int (*handler)(struct brcmf_if *ifp, - const struct brcmf_event_msg *evtmsg, - void *data)); -void brcmf_fweh_unregister(struct brcmf_pub *drvr, - enum brcmf_fweh_event_code code); -int brcmf_fweh_activate_events(struct brcmf_if *ifp); -void brcmf_fweh_process_event(struct brcmf_pub *drvr, - struct brcmf_event *event_packet); - -static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr, - struct sk_buff *skb) -{ - struct brcmf_event *event_packet; - u8 *data; - u16 usr_stype; - - /* only process events when protocol matches */ - if (skb->protocol != cpu_to_be16(ETH_P_LINK_CTL)) - return; - - /* check for BRCM oui match */ - event_packet = (struct brcmf_event *)skb_mac_header(skb); - data = (u8 *)event_packet; - data += BRCMF_EVENT_OUI_OFFSET; - if (memcmp(BRCM_OUI, data, DOT11_OUI_LEN)) - return; - - /* final match on usr_subtype */ - data += DOT11_OUI_LEN; - usr_stype = get_unaligned_be16(data); - if (usr_stype != BCMILCP_BCM_SUBTYPE_EVENT) - return; - - brcmf_fweh_process_event(drvr, event_packet); -} - -#endif /* FWEH_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c deleted file mode 100644 index 04f395930d86..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Copyright (c) 2012 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* FWIL is the Firmware Interface Layer. In this module the support functions - * are located to set and get variables to and from the firmware. - */ - -#include -#include -#include -#include -#include "dhd.h" -#include "dhd_bus.h" -#include "dhd_dbg.h" -#include "tracepoint.h" -#include "fwil.h" - - -#define MAX_HEX_DUMP_LEN 64 - - -static s32 -brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set) -{ - struct brcmf_pub *drvr = ifp->drvr; - s32 err; - - if (drvr->bus_if->state != BRCMF_BUS_DATA) { - brcmf_err("bus is down. we have nothing to do.\n"); - return -EIO; - } - - if (data != NULL) - len = min_t(uint, len, BRCMF_DCMD_MAXLEN); - if (set) - err = brcmf_proto_cdc_set_dcmd(drvr, ifp->ifidx, cmd, data, - len); - else - err = brcmf_proto_cdc_query_dcmd(drvr, ifp->ifidx, cmd, data, - len); - - if (err >= 0) - err = 0; - else - brcmf_err("Failed err=%d\n", err); - - return err; -} - -s32 -brcmf_fil_cmd_data_set(struct brcmf_if *ifp, u32 cmd, void *data, u32 len) -{ - s32 err; - - mutex_lock(&ifp->drvr->proto_block); - - brcmf_dbg(FIL, "cmd=%d, len=%d\n", cmd, len); - brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data, - min_t(uint, len, MAX_HEX_DUMP_LEN), "data"); - - err = brcmf_fil_cmd_data(ifp, cmd, data, len, true); - mutex_unlock(&ifp->drvr->proto_block); - - return err; -} - -s32 -brcmf_fil_cmd_data_get(struct brcmf_if *ifp, u32 cmd, void *data, u32 len) -{ - s32 err; - - mutex_lock(&ifp->drvr->proto_block); - err = brcmf_fil_cmd_data(ifp, cmd, data, len, false); - - brcmf_dbg(FIL, "cmd=%d, len=%d\n", cmd, len); - brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data, - min_t(uint, len, MAX_HEX_DUMP_LEN), "data"); - - mutex_unlock(&ifp->drvr->proto_block); - - return err; -} - - -s32 -brcmf_fil_cmd_int_set(struct brcmf_if *ifp, u32 cmd, u32 data) -{ - s32 err; - __le32 data_le = cpu_to_le32(data); - - mutex_lock(&ifp->drvr->proto_block); - brcmf_dbg(FIL, "cmd=%d, value=%d\n", cmd, data); - err = brcmf_fil_cmd_data(ifp, cmd, &data_le, sizeof(data_le), true); - mutex_unlock(&ifp->drvr->proto_block); - - return err; -} - -s32 -brcmf_fil_cmd_int_get(struct brcmf_if *ifp, u32 cmd, u32 *data) -{ - s32 err; - __le32 data_le = cpu_to_le32(*data); - - mutex_lock(&ifp->drvr->proto_block); - err = brcmf_fil_cmd_data(ifp, cmd, &data_le, sizeof(data_le), false); - mutex_unlock(&ifp->drvr->proto_block); - *data = le32_to_cpu(data_le); - brcmf_dbg(FIL, "cmd=%d, value=%d\n", cmd, *data); - - return err; -} - -static u32 -brcmf_create_iovar(char *name, char *data, u32 datalen, char *buf, u32 buflen) -{ - u32 len; - - len = strlen(name) + 1; - - if ((len + datalen) > buflen) - return 0; - - memcpy(buf, name, len); - - /* append data onto the end of the name string */ - if (data && datalen) - memcpy(&buf[len], data, datalen); - - return len + datalen; -} - - -s32 -brcmf_fil_iovar_data_set(struct brcmf_if *ifp, char *name, void *data, - u32 len) -{ - struct brcmf_pub *drvr = ifp->drvr; - s32 err; - u32 buflen; - - mutex_lock(&drvr->proto_block); - - brcmf_dbg(FIL, "name=%s, len=%d\n", name, len); - brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data, - min_t(uint, len, MAX_HEX_DUMP_LEN), "data"); - - buflen = brcmf_create_iovar(name, data, len, drvr->proto_buf, - sizeof(drvr->proto_buf)); - if (buflen) { - err = brcmf_fil_cmd_data(ifp, BRCMF_C_SET_VAR, drvr->proto_buf, - buflen, true); - } else { - err = -EPERM; - brcmf_err("Creating iovar failed\n"); - } - - mutex_unlock(&drvr->proto_block); - return err; -} - -s32 -brcmf_fil_iovar_data_get(struct brcmf_if *ifp, char *name, void *data, - u32 len) -{ - struct brcmf_pub *drvr = ifp->drvr; - s32 err; - u32 buflen; - - mutex_lock(&drvr->proto_block); - - buflen = brcmf_create_iovar(name, data, len, drvr->proto_buf, - sizeof(drvr->proto_buf)); - if (buflen) { - err = brcmf_fil_cmd_data(ifp, BRCMF_C_GET_VAR, drvr->proto_buf, - buflen, false); - if (err == 0) - memcpy(data, drvr->proto_buf, len); - } else { - err = -EPERM; - brcmf_err("Creating iovar failed\n"); - } - - brcmf_dbg(FIL, "name=%s, len=%d\n", name, len); - brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data, - min_t(uint, len, MAX_HEX_DUMP_LEN), "data"); - - mutex_unlock(&drvr->proto_block); - return err; -} - -s32 -brcmf_fil_iovar_int_set(struct brcmf_if *ifp, char *name, u32 data) -{ - __le32 data_le = cpu_to_le32(data); - - return brcmf_fil_iovar_data_set(ifp, name, &data_le, sizeof(data_le)); -} - -s32 -brcmf_fil_iovar_int_get(struct brcmf_if *ifp, char *name, u32 *data) -{ - __le32 data_le = cpu_to_le32(*data); - s32 err; - - err = brcmf_fil_iovar_data_get(ifp, name, &data_le, sizeof(data_le)); - if (err == 0) - *data = le32_to_cpu(data_le); - return err; -} - -static u32 -brcmf_create_bsscfg(s32 bssidx, char *name, char *data, u32 datalen, char *buf, - u32 buflen) -{ - const s8 *prefix = "bsscfg:"; - s8 *p; - u32 prefixlen; - u32 namelen; - u32 iolen; - __le32 bssidx_le; - - if (bssidx == 0) - return brcmf_create_iovar(name, data, datalen, buf, buflen); - - prefixlen = strlen(prefix); - namelen = strlen(name) + 1; /* lengh of iovar name + null */ - iolen = prefixlen + namelen + sizeof(bssidx_le) + datalen; - - if (buflen < iolen) { - brcmf_err("buffer is too short\n"); - return 0; - } - - p = buf; - - /* copy prefix, no null */ - memcpy(p, prefix, prefixlen); - p += prefixlen; - - /* copy iovar name including null */ - memcpy(p, name, namelen); - p += namelen; - - /* bss config index as first data */ - bssidx_le = cpu_to_le32(bssidx); - memcpy(p, &bssidx_le, sizeof(bssidx_le)); - p += sizeof(bssidx_le); - - /* parameter buffer follows */ - if (datalen) - memcpy(p, data, datalen); - - return iolen; -} - -s32 -brcmf_fil_bsscfg_data_set(struct brcmf_if *ifp, char *name, - void *data, u32 len) -{ - struct brcmf_pub *drvr = ifp->drvr; - s32 err; - u32 buflen; - - mutex_lock(&drvr->proto_block); - - brcmf_dbg(FIL, "bssidx=%d, name=%s, len=%d\n", ifp->bssidx, name, len); - brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data, - min_t(uint, len, MAX_HEX_DUMP_LEN), "data"); - - buflen = brcmf_create_bsscfg(ifp->bssidx, name, data, len, - drvr->proto_buf, sizeof(drvr->proto_buf)); - if (buflen) { - err = brcmf_fil_cmd_data(ifp, BRCMF_C_SET_VAR, drvr->proto_buf, - buflen, true); - } else { - err = -EPERM; - brcmf_err("Creating bsscfg failed\n"); - } - - mutex_unlock(&drvr->proto_block); - return err; -} - -s32 -brcmf_fil_bsscfg_data_get(struct brcmf_if *ifp, char *name, - void *data, u32 len) -{ - struct brcmf_pub *drvr = ifp->drvr; - s32 err; - u32 buflen; - - mutex_lock(&drvr->proto_block); - - buflen = brcmf_create_bsscfg(ifp->bssidx, name, data, len, - drvr->proto_buf, sizeof(drvr->proto_buf)); - if (buflen) { - err = brcmf_fil_cmd_data(ifp, BRCMF_C_GET_VAR, drvr->proto_buf, - buflen, false); - if (err == 0) - memcpy(data, drvr->proto_buf, len); - } else { - err = -EPERM; - brcmf_err("Creating bsscfg failed\n"); - } - brcmf_dbg(FIL, "bssidx=%d, name=%s, len=%d\n", ifp->bssidx, name, len); - brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data, - min_t(uint, len, MAX_HEX_DUMP_LEN), "data"); - - mutex_unlock(&drvr->proto_block); - return err; - -} - -s32 -brcmf_fil_bsscfg_int_set(struct brcmf_if *ifp, char *name, u32 data) -{ - __le32 data_le = cpu_to_le32(data); - - return brcmf_fil_bsscfg_data_set(ifp, name, &data_le, - sizeof(data_le)); -} - -s32 -brcmf_fil_bsscfg_int_get(struct brcmf_if *ifp, char *name, u32 *data) -{ - __le32 data_le = cpu_to_le32(*data); - s32 err; - - err = brcmf_fil_bsscfg_data_get(ifp, name, &data_le, - sizeof(data_le)); - if (err == 0) - *data = le32_to_cpu(data_le); - return err; -} diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil.h b/drivers/net/wireless/brcm80211/brcmfmac/fwil.h deleted file mode 100644 index 16eb8202fb1e..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2012 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _fwil_h_ -#define _fwil_h_ - -s32 brcmf_fil_cmd_data_set(struct brcmf_if *ifp, u32 cmd, void *data, u32 len); -s32 brcmf_fil_cmd_data_get(struct brcmf_if *ifp, u32 cmd, void *data, u32 len); -s32 brcmf_fil_cmd_int_set(struct brcmf_if *ifp, u32 cmd, u32 data); -s32 brcmf_fil_cmd_int_get(struct brcmf_if *ifp, u32 cmd, u32 *data); - -s32 brcmf_fil_iovar_data_set(struct brcmf_if *ifp, char *name, void *data, - u32 len); -s32 brcmf_fil_iovar_data_get(struct brcmf_if *ifp, char *name, void *data, - u32 len); -s32 brcmf_fil_iovar_int_set(struct brcmf_if *ifp, char *name, u32 data); -s32 brcmf_fil_iovar_int_get(struct brcmf_if *ifp, char *name, u32 *data); - -s32 brcmf_fil_bsscfg_data_set(struct brcmf_if *ifp, char *name, void *data, - u32 len); -s32 brcmf_fil_bsscfg_data_get(struct brcmf_if *ifp, char *name, void *data, - u32 len); -s32 brcmf_fil_bsscfg_int_set(struct brcmf_if *ifp, char *name, u32 data); -s32 brcmf_fil_bsscfg_int_get(struct brcmf_if *ifp, char *name, u32 *data); - -#endif /* _fwil_h_ */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h deleted file mode 100644 index 665ef69e974b..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2012 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -#ifndef FWIL_TYPES_H_ -#define FWIL_TYPES_H_ - -#include - - -#define BRCMF_FIL_ACTION_FRAME_SIZE 1800 - -/* ARP Offload feature flags for arp_ol iovar */ -#define BRCMF_ARP_OL_AGENT 0x00000001 -#define BRCMF_ARP_OL_SNOOP 0x00000002 -#define BRCMF_ARP_OL_HOST_AUTO_REPLY 0x00000004 -#define BRCMF_ARP_OL_PEER_AUTO_REPLY 0x00000008 - - -enum brcmf_fil_p2p_if_types { - BRCMF_FIL_P2P_IF_CLIENT, - BRCMF_FIL_P2P_IF_GO, - BRCMF_FIL_P2P_IF_DYNBCN_GO, - BRCMF_FIL_P2P_IF_DEV, -}; - -struct brcmf_fil_p2p_if_le { - u8 addr[ETH_ALEN]; - __le16 type; - __le16 chspec; -}; - -struct brcmf_fil_chan_info_le { - __le32 hw_channel; - __le32 target_channel; - __le32 scan_channel; -}; - -struct brcmf_fil_action_frame_le { - u8 da[ETH_ALEN]; - __le16 len; - __le32 packet_id; - u8 data[BRCMF_FIL_ACTION_FRAME_SIZE]; -}; - -struct brcmf_fil_af_params_le { - __le32 channel; - __le32 dwell_time; - u8 bssid[ETH_ALEN]; - u8 pad[2]; - struct brcmf_fil_action_frame_le action_frame; -}; - -struct brcmf_fil_bss_enable_le { - __le32 bsscfg_idx; - __le32 enable; -}; - -#endif /* FWIL_TYPES_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c deleted file mode 100644 index 5352dc1fdf3c..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c +++ /dev/null @@ -1,2067 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "dhd.h" -#include "dhd_proto.h" -#include "dhd_dbg.h" -#include "dhd_bus.h" -#include "fwil.h" -#include "fwil_types.h" -#include "fweh.h" -#include "fwsignal.h" -#include "p2p.h" -#include "wl_cfg80211.h" - -/** - * DOC: Firmware Signalling - * - * Firmware can send signals to host and vice versa, which are passed in the - * data packets using TLV based header. This signalling layer is on top of the - * BDC bus protocol layer. - */ - -/* - * single definition for firmware-driver flow control tlv's. - * - * each tlv is specified by BRCMF_FWS_TLV_DEF(name, ID, length). - * A length value 0 indicates variable length tlv. - */ -#define BRCMF_FWS_TLV_DEFLIST \ - BRCMF_FWS_TLV_DEF(MAC_OPEN, 1, 1) \ - BRCMF_FWS_TLV_DEF(MAC_CLOSE, 2, 1) \ - BRCMF_FWS_TLV_DEF(MAC_REQUEST_CREDIT, 3, 2) \ - BRCMF_FWS_TLV_DEF(TXSTATUS, 4, 4) \ - BRCMF_FWS_TLV_DEF(PKTTAG, 5, 4) \ - BRCMF_FWS_TLV_DEF(MACDESC_ADD, 6, 8) \ - BRCMF_FWS_TLV_DEF(MACDESC_DEL, 7, 8) \ - BRCMF_FWS_TLV_DEF(RSSI, 8, 1) \ - BRCMF_FWS_TLV_DEF(INTERFACE_OPEN, 9, 1) \ - BRCMF_FWS_TLV_DEF(INTERFACE_CLOSE, 10, 1) \ - BRCMF_FWS_TLV_DEF(FIFO_CREDITBACK, 11, 6) \ - BRCMF_FWS_TLV_DEF(PENDING_TRAFFIC_BMP, 12, 2) \ - BRCMF_FWS_TLV_DEF(MAC_REQUEST_PACKET, 13, 3) \ - BRCMF_FWS_TLV_DEF(HOST_REORDER_RXPKTS, 14, 10) \ - BRCMF_FWS_TLV_DEF(TRANS_ID, 18, 6) \ - BRCMF_FWS_TLV_DEF(COMP_TXSTATUS, 19, 1) \ - BRCMF_FWS_TLV_DEF(FILLER, 255, 0) - -/* - * enum brcmf_fws_tlv_type - definition of tlv identifiers. - */ -#define BRCMF_FWS_TLV_DEF(name, id, len) \ - BRCMF_FWS_TYPE_ ## name = id, -enum brcmf_fws_tlv_type { - BRCMF_FWS_TLV_DEFLIST - BRCMF_FWS_TYPE_INVALID -}; -#undef BRCMF_FWS_TLV_DEF - -/* - * enum brcmf_fws_tlv_len - definition of tlv lengths. - */ -#define BRCMF_FWS_TLV_DEF(name, id, len) \ - BRCMF_FWS_TYPE_ ## name ## _LEN = (len), -enum brcmf_fws_tlv_len { - BRCMF_FWS_TLV_DEFLIST -}; -#undef BRCMF_FWS_TLV_DEF - -#ifdef DEBUG -/* - * brcmf_fws_tlv_names - array of tlv names. - */ -#define BRCMF_FWS_TLV_DEF(name, id, len) \ - { id, #name }, -static struct { - enum brcmf_fws_tlv_type id; - const char *name; -} brcmf_fws_tlv_names[] = { - BRCMF_FWS_TLV_DEFLIST -}; -#undef BRCMF_FWS_TLV_DEF - -static const char *brcmf_fws_get_tlv_name(enum brcmf_fws_tlv_type id) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(brcmf_fws_tlv_names); i++) - if (brcmf_fws_tlv_names[i].id == id) - return brcmf_fws_tlv_names[i].name; - - return "INVALID"; -} -#else -static const char *brcmf_fws_get_tlv_name(enum brcmf_fws_tlv_type id) -{ - return "NODEBUG"; -} -#endif /* DEBUG */ - -/* - * flags used to enable tlv signalling from firmware. - */ -#define BRCMF_FWS_FLAGS_RSSI_SIGNALS 0x0001 -#define BRCMF_FWS_FLAGS_XONXOFF_SIGNALS 0x0002 -#define BRCMF_FWS_FLAGS_CREDIT_STATUS_SIGNALS 0x0004 -#define BRCMF_FWS_FLAGS_HOST_PROPTXSTATUS_ACTIVE 0x0008 -#define BRCMF_FWS_FLAGS_PSQ_GENERATIONFSM_ENABLE 0x0010 -#define BRCMF_FWS_FLAGS_PSQ_ZERO_BUFFER_ENABLE 0x0020 -#define BRCMF_FWS_FLAGS_HOST_RXREORDER_ACTIVE 0x0040 - -#define BRCMF_FWS_MAC_DESC_TABLE_SIZE 32 -#define BRCMF_FWS_MAC_DESC_ID_INVALID 0xff - -#define BRCMF_FWS_HOSTIF_FLOWSTATE_OFF 0 -#define BRCMF_FWS_HOSTIF_FLOWSTATE_ON 1 -#define BRCMF_FWS_FLOWCONTROL_HIWATER 128 -#define BRCMF_FWS_FLOWCONTROL_LOWATER 64 - -#define BRCMF_FWS_PSQ_PREC_COUNT ((NL80211_NUM_ACS + 1) * 2) -#define BRCMF_FWS_PSQ_LEN 256 - -#define BRCMF_FWS_HTOD_FLAG_PKTFROMHOST 0x01 -#define BRCMF_FWS_HTOD_FLAG_PKT_REQUESTED 0x02 - -#define BRCMF_FWS_RET_OK_NOSCHEDULE 0 -#define BRCMF_FWS_RET_OK_SCHEDULE 1 - -/** - * enum brcmf_fws_skb_state - indicates processing state of skb. - * - * @BRCMF_FWS_SKBSTATE_NEW: sk_buff is newly arrived in the driver. - * @BRCMF_FWS_SKBSTATE_DELAYED: sk_buff had to wait on queue. - * @BRCMF_FWS_SKBSTATE_SUPPRESSED: sk_buff has been suppressed by firmware. - */ -enum brcmf_fws_skb_state { - BRCMF_FWS_SKBSTATE_NEW, - BRCMF_FWS_SKBSTATE_DELAYED, - BRCMF_FWS_SKBSTATE_SUPPRESSED -}; - -/** - * struct brcmf_skbuff_cb - control buffer associated with skbuff. - * - * @if_flags: holds interface index and packet related flags. - * @htod: host to device packet identifier (used in PKTTAG tlv). - * @state: transmit state of the packet. - * @mac: descriptor related to destination for this packet. - * - * This information is stored in control buffer struct sk_buff::cb, which - * provides 48 bytes of storage so this structure should not exceed that. - */ -struct brcmf_skbuff_cb { - u16 if_flags; - u32 htod; - enum brcmf_fws_skb_state state; - struct brcmf_fws_mac_descriptor *mac; -}; - -/* - * macro casting skbuff control buffer to struct brcmf_skbuff_cb. - */ -#define brcmf_skbcb(skb) ((struct brcmf_skbuff_cb *)((skb)->cb)) - -/* - * sk_buff control if flags - * - * b[11] - packet sent upon firmware request. - * b[10] - packet only contains signalling data. - * b[9] - packet is a tx packet. - * b[8] - packet uses FIFO credit (non-pspoll). - * b[7] - interface in AP mode. - * b[6:4] - AC FIFO number. - * b[3:0] - interface index. - */ -#define BRCMF_SKB_IF_FLAGS_REQUESTED_MASK 0x0800 -#define BRCMF_SKB_IF_FLAGS_REQUESTED_SHIFT 11 -#define BRCMF_SKB_IF_FLAGS_SIGNAL_ONLY_MASK 0x0400 -#define BRCMF_SKB_IF_FLAGS_SIGNAL_ONLY_SHIFT 10 -#define BRCMF_SKB_IF_FLAGS_TRANSMIT_MASK 0x0200 -#define BRCMF_SKB_IF_FLAGS_TRANSMIT_SHIFT 9 -#define BRCMF_SKB_IF_FLAGS_CREDITCHECK_MASK 0x0100 -#define BRCMF_SKB_IF_FLAGS_CREDITCHECK_SHIFT 8 -#define BRCMF_SKB_IF_FLAGS_IF_AP_MASK 0x0080 -#define BRCMF_SKB_IF_FLAGS_IF_AP_SHIFT 7 -#define BRCMF_SKB_IF_FLAGS_FIFO_MASK 0x0070 -#define BRCMF_SKB_IF_FLAGS_FIFO_SHIFT 4 -#define BRCMF_SKB_IF_FLAGS_INDEX_MASK 0x000f -#define BRCMF_SKB_IF_FLAGS_INDEX_SHIFT 0 - -#define brcmf_skb_if_flags_set_field(skb, field, value) \ - brcmu_maskset16(&(brcmf_skbcb(skb)->if_flags), \ - BRCMF_SKB_IF_FLAGS_ ## field ## _MASK, \ - BRCMF_SKB_IF_FLAGS_ ## field ## _SHIFT, (value)) -#define brcmf_skb_if_flags_get_field(skb, field) \ - brcmu_maskget16(brcmf_skbcb(skb)->if_flags, \ - BRCMF_SKB_IF_FLAGS_ ## field ## _MASK, \ - BRCMF_SKB_IF_FLAGS_ ## field ## _SHIFT) - -/* - * sk_buff control packet identifier - * - * 32-bit packet identifier used in PKTTAG tlv from host to dongle. - * - * - Generated at the host (e.g. dhd) - * - Seen as a generic sequence number by firmware except for the flags field. - * - * Generation : b[31] => generation number for this packet [host->fw] - * OR, current generation number [fw->host] - * Flags : b[30:27] => command, status flags - * FIFO-AC : b[26:24] => AC-FIFO id - * h-slot : b[23:8] => hanger-slot - * freerun : b[7:0] => A free running counter - */ -#define BRCMF_SKB_HTOD_TAG_GENERATION_MASK 0x80000000 -#define BRCMF_SKB_HTOD_TAG_GENERATION_SHIFT 31 -#define BRCMF_SKB_HTOD_TAG_FLAGS_MASK 0x78000000 -#define BRCMF_SKB_HTOD_TAG_FLAGS_SHIFT 27 -#define BRCMF_SKB_HTOD_TAG_FIFO_MASK 0x07000000 -#define BRCMF_SKB_HTOD_TAG_FIFO_SHIFT 24 -#define BRCMF_SKB_HTOD_TAG_HSLOT_MASK 0x00ffff00 -#define BRCMF_SKB_HTOD_TAG_HSLOT_SHIFT 8 -#define BRCMF_SKB_HTOD_TAG_FREERUN_MASK 0x000000ff -#define BRCMF_SKB_HTOD_TAG_FREERUN_SHIFT 0 - -#define brcmf_skb_htod_tag_set_field(skb, field, value) \ - brcmu_maskset32(&(brcmf_skbcb(skb)->htod), \ - BRCMF_SKB_HTOD_TAG_ ## field ## _MASK, \ - BRCMF_SKB_HTOD_TAG_ ## field ## _SHIFT, (value)) -#define brcmf_skb_htod_tag_get_field(skb, field) \ - brcmu_maskget32(brcmf_skbcb(skb)->htod, \ - BRCMF_SKB_HTOD_TAG_ ## field ## _MASK, \ - BRCMF_SKB_HTOD_TAG_ ## field ## _SHIFT) - -#define BRCMF_FWS_TXSTAT_GENERATION_MASK 0x80000000 -#define BRCMF_FWS_TXSTAT_GENERATION_SHIFT 31 -#define BRCMF_FWS_TXSTAT_FLAGS_MASK 0x78000000 -#define BRCMF_FWS_TXSTAT_FLAGS_SHIFT 27 -#define BRCMF_FWS_TXSTAT_FIFO_MASK 0x07000000 -#define BRCMF_FWS_TXSTAT_FIFO_SHIFT 24 -#define BRCMF_FWS_TXSTAT_HSLOT_MASK 0x00FFFF00 -#define BRCMF_FWS_TXSTAT_HSLOT_SHIFT 8 -#define BRCMF_FWS_TXSTAT_PKTID_MASK 0x00FFFFFF -#define BRCMF_FWS_TXSTAT_PKTID_SHIFT 0 - -#define brcmf_txstatus_get_field(txs, field) \ - brcmu_maskget32(txs, BRCMF_FWS_TXSTAT_ ## field ## _MASK, \ - BRCMF_FWS_TXSTAT_ ## field ## _SHIFT) - -/* How long to defer borrowing in jiffies */ -#define BRCMF_FWS_BORROW_DEFER_PERIOD (HZ / 10) - -/** - * enum brcmf_fws_fifo - fifo indices used by dongle firmware. - * - * @BRCMF_FWS_FIFO_AC_BK: fifo for background traffic. - * @BRCMF_FWS_FIFO_AC_BE: fifo for best-effort traffic. - * @BRCMF_FWS_FIFO_AC_VI: fifo for video traffic. - * @BRCMF_FWS_FIFO_AC_VO: fifo for voice traffic. - * @BRCMF_FWS_FIFO_BCMC: fifo for broadcast/multicast (AP only). - * @BRCMF_FWS_FIFO_ATIM: fifo for ATIM (AP only). - * @BRCMF_FWS_FIFO_COUNT: number of fifos. - */ -enum brcmf_fws_fifo { - BRCMF_FWS_FIFO_AC_BK, - BRCMF_FWS_FIFO_AC_BE, - BRCMF_FWS_FIFO_AC_VI, - BRCMF_FWS_FIFO_AC_VO, - BRCMF_FWS_FIFO_BCMC, - BRCMF_FWS_FIFO_ATIM, - BRCMF_FWS_FIFO_COUNT -}; - -/** - * enum brcmf_fws_txstatus - txstatus flag values. - * - * @BRCMF_FWS_TXSTATUS_DISCARD: - * host is free to discard the packet. - * @BRCMF_FWS_TXSTATUS_CORE_SUPPRESS: - * 802.11 core suppressed the packet. - * @BRCMF_FWS_TXSTATUS_FW_PS_SUPPRESS: - * firmware suppress the packet as device is already in PS mode. - * @BRCMF_FWS_TXSTATUS_FW_TOSSED: - * firmware tossed the packet. - */ -enum brcmf_fws_txstatus { - BRCMF_FWS_TXSTATUS_DISCARD, - BRCMF_FWS_TXSTATUS_CORE_SUPPRESS, - BRCMF_FWS_TXSTATUS_FW_PS_SUPPRESS, - BRCMF_FWS_TXSTATUS_FW_TOSSED -}; - -enum brcmf_fws_fcmode { - BRCMF_FWS_FCMODE_NONE, - BRCMF_FWS_FCMODE_IMPLIED_CREDIT, - BRCMF_FWS_FCMODE_EXPLICIT_CREDIT -}; - -enum brcmf_fws_mac_desc_state { - BRCMF_FWS_STATE_OPEN = 1, - BRCMF_FWS_STATE_CLOSE -}; - -/** - * struct brcmf_fws_mac_descriptor - firmware signalling data per node/interface - * - * @occupied: slot is in use. - * @mac_handle: handle for mac entry determined by firmware. - * @interface_id: interface index. - * @state: current state. - * @suppressed: mac entry is suppressed. - * @generation: generation bit. - * @ac_bitmap: ac queue bitmap. - * @requested_credit: credits requested by firmware. - * @ea: ethernet address. - * @seq: per-node free-running sequence. - * @psq: power-save queue. - * @transit_count: packet in transit to firmware. - */ -struct brcmf_fws_mac_descriptor { - u8 occupied; - u8 mac_handle; - u8 interface_id; - u8 state; - bool suppressed; - u8 generation; - u8 ac_bitmap; - u8 requested_credit; - u8 requested_packet; - u8 ea[ETH_ALEN]; - u8 seq[BRCMF_FWS_FIFO_COUNT]; - struct pktq psq; - int transit_count; - int suppress_count; - int suppr_transit_count; - bool send_tim_signal; - u8 traffic_pending_bmp; - u8 traffic_lastreported_bmp; -}; - -#define BRCMF_FWS_HANGER_MAXITEMS 1024 - -/** - * enum brcmf_fws_hanger_item_state - state of hanger item. - * - * @BRCMF_FWS_HANGER_ITEM_STATE_FREE: item is free for use. - * @BRCMF_FWS_HANGER_ITEM_STATE_INUSE: item is in use. - * @BRCMF_FWS_HANGER_ITEM_STATE_INUSE_SUPPRESSED: item was suppressed. - */ -enum brcmf_fws_hanger_item_state { - BRCMF_FWS_HANGER_ITEM_STATE_FREE = 1, - BRCMF_FWS_HANGER_ITEM_STATE_INUSE, - BRCMF_FWS_HANGER_ITEM_STATE_INUSE_SUPPRESSED -}; - - -/** - * struct brcmf_fws_hanger_item - single entry for tx pending packet. - * - * @state: entry is either free or occupied. - * @gen: generation. - * @pkt: packet itself. - */ -struct brcmf_fws_hanger_item { - enum brcmf_fws_hanger_item_state state; - u8 gen; - struct sk_buff *pkt; -}; - -/** - * struct brcmf_fws_hanger - holds packets awaiting firmware txstatus. - * - * @pushed: packets pushed to await txstatus. - * @popped: packets popped upon handling txstatus. - * @failed_to_push: packets that could not be pushed. - * @failed_to_pop: packets that could not be popped. - * @failed_slotfind: packets for which failed to find an entry. - * @slot_pos: last returned item index for a free entry. - * @items: array of hanger items. - */ -struct brcmf_fws_hanger { - u32 pushed; - u32 popped; - u32 failed_to_push; - u32 failed_to_pop; - u32 failed_slotfind; - u32 slot_pos; - struct brcmf_fws_hanger_item items[BRCMF_FWS_HANGER_MAXITEMS]; -}; - -struct brcmf_fws_macdesc_table { - struct brcmf_fws_mac_descriptor nodes[BRCMF_FWS_MAC_DESC_TABLE_SIZE]; - struct brcmf_fws_mac_descriptor iface[BRCMF_MAX_IFS]; - struct brcmf_fws_mac_descriptor other; -}; - -struct brcmf_fws_info { - struct brcmf_pub *drvr; - struct brcmf_fws_stats stats; - struct brcmf_fws_hanger hanger; - enum brcmf_fws_fcmode fcmode; - struct brcmf_fws_macdesc_table desc; - struct workqueue_struct *fws_wq; - struct work_struct fws_dequeue_work; - u32 fifo_enqpkt[BRCMF_FWS_FIFO_COUNT]; - int fifo_credit[BRCMF_FWS_FIFO_COUNT]; - int credits_borrowed[BRCMF_FWS_FIFO_AC_VO + 1]; - int deq_node_pos[BRCMF_FWS_FIFO_COUNT]; - u32 fifo_credit_map; - u32 fifo_delay_map; - unsigned long borrow_defer_timestamp; -}; - -/* - * brcmf_fws_prio2fifo - mapping from 802.1d priority to firmware fifo index. - */ -static const int brcmf_fws_prio2fifo[] = { - BRCMF_FWS_FIFO_AC_BE, - BRCMF_FWS_FIFO_AC_BK, - BRCMF_FWS_FIFO_AC_BK, - BRCMF_FWS_FIFO_AC_BE, - BRCMF_FWS_FIFO_AC_VI, - BRCMF_FWS_FIFO_AC_VI, - BRCMF_FWS_FIFO_AC_VO, - BRCMF_FWS_FIFO_AC_VO -}; - -static int fcmode; -module_param(fcmode, int, S_IRUSR); -MODULE_PARM_DESC(fcmode, "mode of firmware signalled flow control"); - -#define BRCMF_FWS_TLV_DEF(name, id, len) \ - case BRCMF_FWS_TYPE_ ## name: \ - return len; - -/** - * brcmf_fws_get_tlv_len() - returns defined length for given tlv id. - * - * @fws: firmware-signalling information. - * @id: identifier of the TLV. - * - * Return: the specified length for the given TLV; Otherwise -EINVAL. - */ -static int brcmf_fws_get_tlv_len(struct brcmf_fws_info *fws, - enum brcmf_fws_tlv_type id) -{ - switch (id) { - BRCMF_FWS_TLV_DEFLIST - default: - fws->stats.tlv_invalid_type++; - break; - } - return -EINVAL; -} -#undef BRCMF_FWS_TLV_DEF - -static bool brcmf_fws_ifidx_match(struct sk_buff *skb, void *arg) -{ - u32 ifidx = brcmf_skb_if_flags_get_field(skb, INDEX); - return ifidx == *(int *)arg; -} - -static void brcmf_fws_psq_flush(struct brcmf_fws_info *fws, struct pktq *q, - int ifidx) -{ - bool (*matchfn)(struct sk_buff *, void *) = NULL; - struct sk_buff *skb; - int prec; - - if (ifidx != -1) - matchfn = brcmf_fws_ifidx_match; - for (prec = 0; prec < q->num_prec; prec++) { - skb = brcmu_pktq_pdeq_match(q, prec, matchfn, &ifidx); - while (skb) { - brcmu_pkt_buf_free_skb(skb); - skb = brcmu_pktq_pdeq_match(q, prec, matchfn, &ifidx); - } - } -} - -static void brcmf_fws_hanger_init(struct brcmf_fws_hanger *hanger) -{ - int i; - - brcmf_dbg(TRACE, "enter\n"); - memset(hanger, 0, sizeof(*hanger)); - for (i = 0; i < ARRAY_SIZE(hanger->items); i++) - hanger->items[i].state = BRCMF_FWS_HANGER_ITEM_STATE_FREE; -} - -static u32 brcmf_fws_hanger_get_free_slot(struct brcmf_fws_hanger *h) -{ - u32 i; - - brcmf_dbg(TRACE, "enter\n"); - i = (h->slot_pos + 1) % BRCMF_FWS_HANGER_MAXITEMS; - - while (i != h->slot_pos) { - if (h->items[i].state == BRCMF_FWS_HANGER_ITEM_STATE_FREE) { - h->slot_pos = i; - goto done; - } - i++; - if (i == BRCMF_FWS_HANGER_MAXITEMS) - i = 0; - } - brcmf_err("all slots occupied\n"); - h->failed_slotfind++; - i = BRCMF_FWS_HANGER_MAXITEMS; -done: - brcmf_dbg(TRACE, "exit: %d\n", i); - return i; -} - -static int brcmf_fws_hanger_pushpkt(struct brcmf_fws_hanger *h, - struct sk_buff *pkt, u32 slot_id) -{ - brcmf_dbg(TRACE, "enter\n"); - if (slot_id >= BRCMF_FWS_HANGER_MAXITEMS) - return -ENOENT; - - if (h->items[slot_id].state != BRCMF_FWS_HANGER_ITEM_STATE_FREE) { - brcmf_err("slot is not free\n"); - h->failed_to_push++; - return -EINVAL; - } - - h->items[slot_id].state = BRCMF_FWS_HANGER_ITEM_STATE_INUSE; - h->items[slot_id].pkt = pkt; - h->pushed++; - return 0; -} - -static int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h, - u32 slot_id, struct sk_buff **pktout, - bool remove_item) -{ - brcmf_dbg(TRACE, "enter\n"); - if (slot_id >= BRCMF_FWS_HANGER_MAXITEMS) - return -ENOENT; - - if (h->items[slot_id].state == BRCMF_FWS_HANGER_ITEM_STATE_FREE) { - brcmf_err("entry not in use\n"); - h->failed_to_pop++; - return -EINVAL; - } - - *pktout = h->items[slot_id].pkt; - if (remove_item) { - h->items[slot_id].state = BRCMF_FWS_HANGER_ITEM_STATE_FREE; - h->items[slot_id].pkt = NULL; - h->items[slot_id].gen = 0xff; - h->popped++; - } - return 0; -} - -static int brcmf_fws_hanger_mark_suppressed(struct brcmf_fws_hanger *h, - u32 slot_id, u8 gen) -{ - brcmf_dbg(TRACE, "enter\n"); - - if (slot_id >= BRCMF_FWS_HANGER_MAXITEMS) - return -ENOENT; - - h->items[slot_id].gen = gen; - - if (h->items[slot_id].state != BRCMF_FWS_HANGER_ITEM_STATE_INUSE) { - brcmf_err("entry not in use\n"); - return -EINVAL; - } - - h->items[slot_id].state = BRCMF_FWS_HANGER_ITEM_STATE_INUSE_SUPPRESSED; - return 0; -} - -static int brcmf_fws_hanger_get_genbit(struct brcmf_fws_hanger *hanger, - struct sk_buff *pkt, u32 slot_id, - int *gen) -{ - brcmf_dbg(TRACE, "enter\n"); - *gen = 0xff; - - if (slot_id >= BRCMF_FWS_HANGER_MAXITEMS) - return -ENOENT; - - if (hanger->items[slot_id].state == BRCMF_FWS_HANGER_ITEM_STATE_FREE) { - brcmf_err("slot not in use\n"); - return -EINVAL; - } - - *gen = hanger->items[slot_id].gen; - return 0; -} - -static void brcmf_fws_hanger_cleanup(struct brcmf_fws_info *fws, - bool (*fn)(struct sk_buff *, void *), - int ifidx) -{ - struct brcmf_fws_hanger *h = &fws->hanger; - struct sk_buff *skb; - int i; - enum brcmf_fws_hanger_item_state s; - - brcmf_dbg(TRACE, "enter: ifidx=%d\n", ifidx); - for (i = 0; i < ARRAY_SIZE(h->items); i++) { - s = h->items[i].state; - if (s == BRCMF_FWS_HANGER_ITEM_STATE_INUSE || - s == BRCMF_FWS_HANGER_ITEM_STATE_INUSE_SUPPRESSED) { - skb = h->items[i].pkt; - if (fn == NULL || fn(skb, &ifidx)) { - /* suppress packets freed from psq */ - if (s == BRCMF_FWS_HANGER_ITEM_STATE_INUSE) - brcmu_pkt_buf_free_skb(skb); - h->items[i].state = - BRCMF_FWS_HANGER_ITEM_STATE_FREE; - } - } - } -} - -static void brcmf_fws_init_mac_descriptor(struct brcmf_fws_mac_descriptor *desc, - u8 *addr, u8 ifidx) -{ - brcmf_dbg(TRACE, - "enter: desc %p ea=%pM, ifidx=%u\n", desc, addr, ifidx); - desc->occupied = 1; - desc->state = BRCMF_FWS_STATE_OPEN; - desc->requested_credit = 0; - /* depending on use may need ifp->bssidx instead */ - desc->interface_id = ifidx; - desc->ac_bitmap = 0xff; /* update this when handling APSD */ - if (addr) - memcpy(&desc->ea[0], addr, ETH_ALEN); -} - -static -void brcmf_fws_clear_mac_descriptor(struct brcmf_fws_mac_descriptor *desc) -{ - brcmf_dbg(TRACE, - "enter: ea=%pM, ifidx=%u\n", desc->ea, desc->interface_id); - desc->occupied = 0; - desc->state = BRCMF_FWS_STATE_CLOSE; - desc->requested_credit = 0; -} - -static struct brcmf_fws_mac_descriptor * -brcmf_fws_mac_descriptor_lookup(struct brcmf_fws_info *fws, u8 *ea) -{ - struct brcmf_fws_mac_descriptor *entry; - int i; - - brcmf_dbg(TRACE, "enter: ea=%pM\n", ea); - if (ea == NULL) - return ERR_PTR(-EINVAL); - - entry = &fws->desc.nodes[0]; - for (i = 0; i < ARRAY_SIZE(fws->desc.nodes); i++) { - if (entry->occupied && !memcmp(entry->ea, ea, ETH_ALEN)) - return entry; - entry++; - } - - return ERR_PTR(-ENOENT); -} - -static struct brcmf_fws_mac_descriptor* -brcmf_fws_find_mac_desc(struct brcmf_fws_info *fws, struct brcmf_if *ifp, - u8 *da) -{ - struct brcmf_fws_mac_descriptor *entry = &fws->desc.other; - bool multicast; - enum nl80211_iftype iftype; - - brcmf_dbg(TRACE, "enter: idx=%d\n", ifp->bssidx); - - multicast = is_multicast_ether_addr(da); - iftype = brcmf_cfg80211_get_iftype(ifp); - - /* Multicast destination and P2P clients get the interface entry. - * STA gets the interface entry if there is no exact match. For - * example, TDLS destinations have their own entry. - */ - entry = NULL; - if ((multicast || iftype == NL80211_IFTYPE_STATION || - iftype == NL80211_IFTYPE_P2P_CLIENT) && ifp->fws_desc) - entry = ifp->fws_desc; - - if (entry != NULL && iftype != NL80211_IFTYPE_STATION) - goto done; - - entry = brcmf_fws_mac_descriptor_lookup(fws, da); - if (IS_ERR(entry)) - entry = &fws->desc.other; - -done: - brcmf_dbg(TRACE, "exit: entry=%p\n", entry); - return entry; -} - -static bool brcmf_fws_mac_desc_closed(struct brcmf_fws_info *fws, - struct brcmf_fws_mac_descriptor *entry, - int fifo) -{ - struct brcmf_fws_mac_descriptor *if_entry; - bool closed; - - /* for unique destination entries the related interface - * may be closed. - */ - if (entry->mac_handle) { - if_entry = &fws->desc.iface[entry->interface_id]; - if (if_entry->state == BRCMF_FWS_STATE_CLOSE) - return true; - } - /* an entry is closed when the state is closed and - * the firmware did not request anything. - */ - closed = entry->state == BRCMF_FWS_STATE_CLOSE && - !entry->requested_credit && !entry->requested_packet; - - /* Or firmware does not allow traffic for given fifo */ - return closed || !(entry->ac_bitmap & BIT(fifo)); -} - -static void brcmf_fws_mac_desc_cleanup(struct brcmf_fws_info *fws, - struct brcmf_fws_mac_descriptor *entry, - int ifidx) -{ - brcmf_dbg(TRACE, "enter: entry=(ea=%pM, ifid=%d), ifidx=%d\n", - entry->ea, entry->interface_id, ifidx); - if (entry->occupied && (ifidx == -1 || ifidx == entry->interface_id)) { - brcmf_dbg(TRACE, "flush psq: ifidx=%d, qlen=%d\n", - ifidx, entry->psq.len); - brcmf_fws_psq_flush(fws, &entry->psq, ifidx); - entry->occupied = !!(entry->psq.len); - } -} - -static void brcmf_fws_bus_txq_cleanup(struct brcmf_fws_info *fws, - bool (*fn)(struct sk_buff *, void *), - int ifidx) -{ - struct brcmf_fws_hanger_item *hi; - struct pktq *txq; - struct sk_buff *skb; - int prec; - u32 hslot; - - brcmf_dbg(TRACE, "enter: ifidx=%d\n", ifidx); - txq = brcmf_bus_gettxq(fws->drvr->bus_if); - if (IS_ERR(txq)) { - brcmf_dbg(TRACE, "no txq to clean up\n"); - return; - } - - for (prec = 0; prec < txq->num_prec; prec++) { - skb = brcmu_pktq_pdeq_match(txq, prec, fn, &ifidx); - while (skb) { - hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); - hi = &fws->hanger.items[hslot]; - WARN_ON(skb != hi->pkt); - hi->state = BRCMF_FWS_HANGER_ITEM_STATE_FREE; - brcmu_pkt_buf_free_skb(skb); - skb = brcmu_pktq_pdeq_match(txq, prec, fn, &ifidx); - } - } -} - -static void brcmf_fws_cleanup(struct brcmf_fws_info *fws, int ifidx) -{ - int i; - struct brcmf_fws_mac_descriptor *table; - bool (*matchfn)(struct sk_buff *, void *) = NULL; - - brcmf_dbg(TRACE, "enter: ifidx=%d\n", ifidx); - if (fws == NULL) - return; - - if (ifidx != -1) - matchfn = brcmf_fws_ifidx_match; - - /* cleanup individual nodes */ - table = &fws->desc.nodes[0]; - for (i = 0; i < ARRAY_SIZE(fws->desc.nodes); i++) - brcmf_fws_mac_desc_cleanup(fws, &table[i], ifidx); - - brcmf_fws_mac_desc_cleanup(fws, &fws->desc.other, ifidx); - brcmf_fws_bus_txq_cleanup(fws, matchfn, ifidx); - brcmf_fws_hanger_cleanup(fws, matchfn, ifidx); -} - -static void brcmf_fws_tim_update(struct brcmf_fws_info *ctx, - struct brcmf_fws_mac_descriptor *entry, - int prec) -{ - brcmf_dbg(TRACE, "enter: ea=%pM\n", entry->ea); - if (entry->state == BRCMF_FWS_STATE_CLOSE) { - /* check delayedQ and suppressQ in one call using bitmap */ - if (brcmu_pktq_mlen(&entry->psq, 3 << (prec * 2)) == 0) - entry->traffic_pending_bmp = - entry->traffic_pending_bmp & ~NBITVAL(prec); - else - entry->traffic_pending_bmp = - entry->traffic_pending_bmp | NBITVAL(prec); - } - /* request a TIM update to firmware at the next piggyback opportunity */ - if (entry->traffic_lastreported_bmp != entry->traffic_pending_bmp) - entry->send_tim_signal = true; -} - -static void -brcmf_fws_flow_control_check(struct brcmf_fws_info *fws, struct pktq *pq, - u8 if_id) -{ - struct brcmf_if *ifp = fws->drvr->iflist[if_id]; - - if (WARN_ON(!ifp)) - return; - - brcmf_dbg(TRACE, - "enter: bssidx=%d, ifidx=%d\n", ifp->bssidx, ifp->ifidx); - - if ((ifp->netif_stop & BRCMF_NETIF_STOP_REASON_FWS_FC) && - pq->len <= BRCMF_FWS_FLOWCONTROL_LOWATER) - brcmf_txflowblock_if(ifp, - BRCMF_NETIF_STOP_REASON_FWS_FC, false); - if (!(ifp->netif_stop & BRCMF_NETIF_STOP_REASON_FWS_FC) && - pq->len >= BRCMF_FWS_FLOWCONTROL_HIWATER) - brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FWS_FC, true); - return; -} - -static int brcmf_fws_rssi_indicate(struct brcmf_fws_info *fws, s8 rssi) -{ - brcmf_dbg(CTL, "rssi %d\n", rssi); - return 0; -} - -static -int brcmf_fws_macdesc_indicate(struct brcmf_fws_info *fws, u8 type, u8 *data) -{ - struct brcmf_fws_mac_descriptor *entry, *existing; - u8 mac_handle; - u8 ifidx; - u8 *addr; - - mac_handle = *data++; - ifidx = *data++; - addr = data; - - entry = &fws->desc.nodes[mac_handle & 0x1F]; - if (type == BRCMF_FWS_TYPE_MACDESC_DEL) { - brcmf_dbg(TRACE, "deleting mac %pM idx %d\n", addr, ifidx); - if (entry->occupied) { - brcmf_fws_mac_desc_cleanup(fws, entry, -1); - brcmf_fws_clear_mac_descriptor(entry); - } else - fws->stats.mac_update_failed++; - return 0; - } - - brcmf_dbg(TRACE, - "add mac %pM handle %u idx %d\n", addr, mac_handle, ifidx); - existing = brcmf_fws_mac_descriptor_lookup(fws, addr); - if (IS_ERR(existing)) { - if (!entry->occupied) { - entry->mac_handle = mac_handle; - brcmf_fws_init_mac_descriptor(entry, addr, ifidx); - brcmu_pktq_init(&entry->psq, BRCMF_FWS_PSQ_PREC_COUNT, - BRCMF_FWS_PSQ_LEN); - } else { - fws->stats.mac_update_failed++; - } - } else { - if (entry != existing) { - brcmf_dbg(TRACE, "relocate mac\n"); - memcpy(entry, existing, - offsetof(struct brcmf_fws_mac_descriptor, psq)); - entry->mac_handle = mac_handle; - brcmf_fws_clear_mac_descriptor(existing); - } else { - brcmf_dbg(TRACE, "use existing\n"); - WARN_ON(entry->mac_handle != mac_handle); - /* TODO: what should we do here: continue, reinit, .. */ - } - } - return 0; -} - -static int brcmf_fws_macdesc_state_indicate(struct brcmf_fws_info *fws, - u8 type, u8 *data) -{ - struct brcmf_fws_mac_descriptor *entry; - u8 mac_handle; - int i; - - mac_handle = data[0]; - entry = &fws->desc.nodes[mac_handle & 0x1F]; - if (!entry->occupied) { - fws->stats.mac_ps_update_failed++; - return -ESRCH; - } - - /* a state update should wipe old credits? */ - entry->requested_credit = 0; - if (type == BRCMF_FWS_TYPE_MAC_OPEN) { - entry->state = BRCMF_FWS_STATE_OPEN; - return BRCMF_FWS_RET_OK_SCHEDULE; - } else { - entry->state = BRCMF_FWS_STATE_CLOSE; - for (i = BRCMF_FWS_FIFO_AC_BE; i < NL80211_NUM_ACS; i++) - brcmf_fws_tim_update(fws, entry, i); - } - return BRCMF_FWS_RET_OK_NOSCHEDULE; -} - -static int brcmf_fws_interface_state_indicate(struct brcmf_fws_info *fws, - u8 type, u8 *data) -{ - struct brcmf_fws_mac_descriptor *entry; - u8 ifidx; - int ret; - - ifidx = data[0]; - - brcmf_dbg(TRACE, "enter: ifidx=%d\n", ifidx); - if (ifidx >= BRCMF_MAX_IFS) { - ret = -ERANGE; - goto fail; - } - - entry = &fws->desc.iface[ifidx]; - if (!entry->occupied) { - ret = -ESRCH; - goto fail; - } - - switch (type) { - case BRCMF_FWS_TYPE_INTERFACE_OPEN: - entry->state = BRCMF_FWS_STATE_OPEN; - return BRCMF_FWS_RET_OK_SCHEDULE; - case BRCMF_FWS_TYPE_INTERFACE_CLOSE: - entry->state = BRCMF_FWS_STATE_CLOSE; - return BRCMF_FWS_RET_OK_NOSCHEDULE; - default: - ret = -EINVAL; - break; - } -fail: - fws->stats.if_update_failed++; - return ret; -} - -static int brcmf_fws_request_indicate(struct brcmf_fws_info *fws, u8 type, - u8 *data) -{ - struct brcmf_fws_mac_descriptor *entry; - - entry = &fws->desc.nodes[data[1] & 0x1F]; - if (!entry->occupied) { - if (type == BRCMF_FWS_TYPE_MAC_REQUEST_CREDIT) - fws->stats.credit_request_failed++; - else - fws->stats.packet_request_failed++; - return -ESRCH; - } - - if (type == BRCMF_FWS_TYPE_MAC_REQUEST_CREDIT) - entry->requested_credit = data[0]; - else - entry->requested_packet = data[0]; - - entry->ac_bitmap = data[2]; - return BRCMF_FWS_RET_OK_SCHEDULE; -} - -static void brcmf_fws_return_credits(struct brcmf_fws_info *fws, - u8 fifo, u8 credits) -{ - int lender_ac; - int *borrowed; - int *fifo_credit; - - if (!credits) - return; - - if ((fifo == BRCMF_FWS_FIFO_AC_BE) && - (fws->credits_borrowed[0])) { - for (lender_ac = BRCMF_FWS_FIFO_AC_VO; lender_ac >= 0; - lender_ac--) { - borrowed = &fws->credits_borrowed[lender_ac]; - if (*borrowed) { - fws->fifo_credit_map |= (1 << lender_ac); - fifo_credit = &fws->fifo_credit[lender_ac]; - if (*borrowed >= credits) { - *borrowed -= credits; - *fifo_credit += credits; - return; - } else { - credits -= *borrowed; - *fifo_credit += *borrowed; - *borrowed = 0; - } - } - } - } - - fws->fifo_credit_map |= 1 << fifo; - fws->fifo_credit[fifo] += credits; -} - -static void brcmf_fws_schedule_deq(struct brcmf_fws_info *fws) -{ - /* only schedule dequeue when there are credits for delayed traffic */ - if (fws->fifo_credit_map & fws->fifo_delay_map) - queue_work(fws->fws_wq, &fws->fws_dequeue_work); -} - -static void brcmf_skb_pick_up_credit(struct brcmf_fws_info *fws, int fifo, - struct sk_buff *p) -{ - struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(p)->mac; - - if (brcmf_skbcb(p)->if_flags & BRCMF_SKB_IF_FLAGS_CREDITCHECK_MASK) { - if (fws->fcmode != BRCMF_FWS_FCMODE_IMPLIED_CREDIT) - return; - brcmf_fws_return_credits(fws, fifo, 1); - } else { - /* - * if this packet did not count against FIFO credit, it - * must have taken a requested_credit from the destination - * entry (for pspoll etc.) - */ - if (!brcmf_skb_if_flags_get_field(p, REQUESTED)) - entry->requested_credit++; - } - brcmf_fws_schedule_deq(fws); -} - -static int brcmf_fws_enq(struct brcmf_fws_info *fws, - enum brcmf_fws_skb_state state, int fifo, - struct sk_buff *p) -{ - int prec = 2 * fifo; - u32 *qfull_stat = &fws->stats.delayq_full_error; - - struct brcmf_fws_mac_descriptor *entry; - - entry = brcmf_skbcb(p)->mac; - if (entry == NULL) { - brcmf_err("no mac descriptor found for skb %p\n", p); - return -ENOENT; - } - - brcmf_dbg(TRACE, "enter: ea=%pM, qlen=%d\n", entry->ea, entry->psq.len); - if (state == BRCMF_FWS_SKBSTATE_SUPPRESSED) { - prec += 1; - qfull_stat = &fws->stats.supprq_full_error; - } - - if (brcmu_pktq_penq(&entry->psq, prec, p) == NULL) { - *qfull_stat += 1; - return -ENFILE; - } - - /* increment total enqueued packet count */ - fws->fifo_delay_map |= 1 << fifo; - fws->fifo_enqpkt[fifo]++; - - /* update the sk_buff state */ - brcmf_skbcb(p)->state = state; - if (state == BRCMF_FWS_SKBSTATE_SUPPRESSED) - entry->suppress_count++; - - /* - * A packet has been pushed so update traffic - * availability bitmap, if applicable - */ - brcmf_fws_tim_update(fws, entry, fifo); - brcmf_fws_flow_control_check(fws, &entry->psq, - brcmf_skb_if_flags_get_field(p, INDEX)); - return 0; -} - -static struct sk_buff *brcmf_fws_deq(struct brcmf_fws_info *fws, int fifo) -{ - struct brcmf_fws_mac_descriptor *table; - struct brcmf_fws_mac_descriptor *entry; - struct sk_buff *p; - int use_credit = 1; - int num_nodes; - int node_pos; - int prec_out; - int pmsk; - int i; - - table = (struct brcmf_fws_mac_descriptor *)&fws->desc; - num_nodes = sizeof(fws->desc) / sizeof(struct brcmf_fws_mac_descriptor); - node_pos = fws->deq_node_pos[fifo]; - - for (i = 0; i < num_nodes; i++) { - entry = &table[(node_pos + i) % num_nodes]; - if (!entry->occupied || - brcmf_fws_mac_desc_closed(fws, entry, fifo)) - continue; - - if (entry->suppressed) - pmsk = 2; - else - pmsk = 3; - p = brcmu_pktq_mdeq(&entry->psq, pmsk << (fifo * 2), &prec_out); - if (p == NULL) { - if (entry->suppressed) { - if (entry->suppr_transit_count > - entry->suppress_count) - return NULL; - entry->suppressed = false; - p = brcmu_pktq_mdeq(&entry->psq, - 1 << (fifo * 2), &prec_out); - } - } - if (p == NULL) - continue; - - /* did the packet come from suppress sub-queue? */ - if (entry->requested_credit > 0) { - entry->requested_credit--; - /* - * if the packet was pulled out while destination is in - * closed state but had a non-zero packets requested, - * then this should not count against the FIFO credit. - * That is due to the fact that the firmware will - * most likely hold onto this packet until a suitable - * time later to push it to the appropriate AC FIFO. - */ - if (entry->state == BRCMF_FWS_STATE_CLOSE) - use_credit = 0; - } else if (entry->requested_packet > 0) { - entry->requested_packet--; - brcmf_skb_if_flags_set_field(p, REQUESTED, 1); - if (entry->state == BRCMF_FWS_STATE_CLOSE) - use_credit = 0; - } - brcmf_skb_if_flags_set_field(p, CREDITCHECK, use_credit); - - /* move dequeue position to ensure fair round-robin */ - fws->deq_node_pos[fifo] = (node_pos + i + 1) % num_nodes; - brcmf_fws_flow_control_check(fws, &entry->psq, - brcmf_skb_if_flags_get_field(p, - INDEX) - ); - /* - * A packet has been picked up, update traffic - * availability bitmap, if applicable - */ - brcmf_fws_tim_update(fws, entry, fifo); - - /* - * decrement total enqueued fifo packets and - * clear delay bitmap if done. - */ - fws->fifo_enqpkt[fifo]--; - if (fws->fifo_enqpkt[fifo] == 0) - fws->fifo_delay_map &= ~(1 << fifo); - goto done; - } - p = NULL; -done: - brcmf_dbg(TRACE, "exit: fifo %d skb %p\n", fifo, p); - return p; -} - -static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo, - struct sk_buff *skb, u32 genbit) -{ - struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac; - u32 hslot; - int ret; - - hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); - - /* this packet was suppressed */ - if (!entry->suppressed || entry->generation != genbit) { - entry->suppressed = true; - entry->suppress_count = brcmu_pktq_mlen(&entry->psq, - 1 << (fifo * 2 + 1)); - entry->suppr_transit_count = entry->transit_count; - } - - entry->generation = genbit; - - ret = brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_SUPPRESSED, fifo, skb); - if (ret != 0) { - /* suppress q is full, drop this packet */ - brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, - true); - } else { - /* - * Mark suppressed to avoid a double free during - * wlfc cleanup - */ - brcmf_fws_hanger_mark_suppressed(&fws->hanger, hslot, - genbit); - entry->suppress_count++; - } - - return ret; -} - -static int -brcmf_fws_txstatus_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot, - u32 genbit) -{ - u32 fifo; - int ret; - bool remove_from_hanger = true; - struct sk_buff *skb; - struct brcmf_fws_mac_descriptor *entry = NULL; - - brcmf_dbg(TRACE, "status: flags=0x%X, hslot=%d\n", - flags, hslot); - - if (flags == BRCMF_FWS_TXSTATUS_DISCARD) - fws->stats.txs_discard++; - else if (flags == BRCMF_FWS_TXSTATUS_CORE_SUPPRESS) { - fws->stats.txs_supp_core++; - remove_from_hanger = false; - } else if (flags == BRCMF_FWS_TXSTATUS_FW_PS_SUPPRESS) { - fws->stats.txs_supp_ps++; - remove_from_hanger = false; - } else if (flags == BRCMF_FWS_TXSTATUS_FW_TOSSED) - fws->stats.txs_tossed++; - else - brcmf_err("unexpected txstatus\n"); - - ret = brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, - remove_from_hanger); - if (ret != 0) { - brcmf_err("no packet in hanger slot: hslot=%d\n", hslot); - return ret; - } - - entry = brcmf_skbcb(skb)->mac; - if (WARN_ON(!entry)) { - brcmu_pkt_buf_free_skb(skb); - return -EINVAL; - } - - /* pick up the implicit credit from this packet */ - fifo = brcmf_skb_htod_tag_get_field(skb, FIFO); - brcmf_skb_pick_up_credit(fws, fifo, skb); - - if (!remove_from_hanger) - ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, genbit); - - if (remove_from_hanger || ret) { - entry->transit_count--; - if (entry->suppressed) - entry->suppr_transit_count--; - - brcmf_txfinalize(fws->drvr, skb, true); - } - return 0; -} - -static int brcmf_fws_fifocreditback_indicate(struct brcmf_fws_info *fws, - u8 *data) -{ - int i; - - if (fws->fcmode != BRCMF_FWS_FCMODE_EXPLICIT_CREDIT) { - brcmf_dbg(INFO, "ignored\n"); - return BRCMF_FWS_RET_OK_NOSCHEDULE; - } - - brcmf_dbg(TRACE, "enter: data %pM\n", data); - for (i = 0; i < BRCMF_FWS_FIFO_COUNT; i++) - brcmf_fws_return_credits(fws, i, data[i]); - - brcmf_dbg(INFO, "map: credit %x delay %x\n", fws->fifo_credit_map, - fws->fifo_delay_map); - return BRCMF_FWS_RET_OK_SCHEDULE; -} - -static int brcmf_fws_txstatus_indicate(struct brcmf_fws_info *fws, u8 *data) -{ - __le32 status_le; - u32 status; - u32 hslot; - u32 genbit; - u8 flags; - - fws->stats.txs_indicate++; - memcpy(&status_le, data, sizeof(status_le)); - status = le32_to_cpu(status_le); - flags = brcmf_txstatus_get_field(status, FLAGS); - hslot = brcmf_txstatus_get_field(status, HSLOT); - genbit = brcmf_txstatus_get_field(status, GENERATION); - - return brcmf_fws_txstatus_process(fws, flags, hslot, genbit); -} - -static int brcmf_fws_dbg_seqnum_check(struct brcmf_fws_info *fws, u8 *data) -{ - __le32 timestamp; - - memcpy(×tamp, &data[2], sizeof(timestamp)); - brcmf_dbg(INFO, "received: seq %d, timestamp %d\n", data[1], - le32_to_cpu(timestamp)); - return 0; -} - -/* using macro so sparse checking does not complain - * about locking imbalance. - */ -#define brcmf_fws_lock(drvr, flags) \ -do { \ - flags = 0; \ - spin_lock_irqsave(&((drvr)->fws_spinlock), (flags)); \ -} while (0) - -/* using macro so sparse checking does not complain - * about locking imbalance. - */ -#define brcmf_fws_unlock(drvr, flags) \ - spin_unlock_irqrestore(&((drvr)->fws_spinlock), (flags)) - -static int brcmf_fws_notify_credit_map(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, - void *data) -{ - struct brcmf_fws_info *fws = ifp->drvr->fws; - int i; - ulong flags; - u8 *credits = data; - - if (e->datalen < BRCMF_FWS_FIFO_COUNT) { - brcmf_err("event payload too small (%d)\n", e->datalen); - return -EINVAL; - } - - brcmf_dbg(TRACE, "enter: credits %pM\n", credits); - brcmf_fws_lock(ifp->drvr, flags); - for (i = 0; i < ARRAY_SIZE(fws->fifo_credit); i++) { - if (*credits) - fws->fifo_credit_map |= 1 << i; - else - fws->fifo_credit_map &= ~(1 << i); - fws->fifo_credit[i] = *credits++; - } - brcmf_fws_schedule_deq(fws); - brcmf_fws_unlock(ifp->drvr, flags); - return 0; -} - -int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len, - struct sk_buff *skb) -{ - struct brcmf_fws_info *fws = drvr->fws; - ulong flags; - u8 *signal_data; - s16 data_len; - u8 type; - u8 len; - u8 *data; - s32 status; - s32 err; - - brcmf_dbg(TRACE, "enter: ifidx %d, skblen %u, sig %d\n", - ifidx, skb->len, signal_len); - - WARN_ON(signal_len > skb->len); - - /* if flow control disabled, skip to packet data and leave */ - if (!signal_len || !drvr->fw_signals) { - skb_pull(skb, signal_len); - return 0; - } - - /* lock during tlv parsing */ - brcmf_fws_lock(drvr, flags); - - fws->stats.header_pulls++; - data_len = signal_len; - signal_data = skb->data; - - status = BRCMF_FWS_RET_OK_NOSCHEDULE; - while (data_len > 0) { - /* extract tlv info */ - type = signal_data[0]; - - /* FILLER type is actually not a TLV, but - * a single byte that can be skipped. - */ - if (type == BRCMF_FWS_TYPE_FILLER) { - signal_data += 1; - data_len -= 1; - continue; - } - len = signal_data[1]; - data = signal_data + 2; - - brcmf_dbg(INFO, "tlv type=%d (%s), len=%d, data[0]=%d\n", type, - brcmf_fws_get_tlv_name(type), len, *data); - - /* abort parsing when length invalid */ - if (data_len < len + 2) - break; - - if (len != brcmf_fws_get_tlv_len(fws, type)) - break; - - err = BRCMF_FWS_RET_OK_NOSCHEDULE; - switch (type) { - case BRCMF_FWS_TYPE_HOST_REORDER_RXPKTS: - case BRCMF_FWS_TYPE_COMP_TXSTATUS: - break; - case BRCMF_FWS_TYPE_MACDESC_ADD: - case BRCMF_FWS_TYPE_MACDESC_DEL: - brcmf_fws_macdesc_indicate(fws, type, data); - break; - case BRCMF_FWS_TYPE_MAC_OPEN: - case BRCMF_FWS_TYPE_MAC_CLOSE: - err = brcmf_fws_macdesc_state_indicate(fws, type, data); - break; - case BRCMF_FWS_TYPE_INTERFACE_OPEN: - case BRCMF_FWS_TYPE_INTERFACE_CLOSE: - err = brcmf_fws_interface_state_indicate(fws, type, - data); - break; - case BRCMF_FWS_TYPE_MAC_REQUEST_CREDIT: - case BRCMF_FWS_TYPE_MAC_REQUEST_PACKET: - err = brcmf_fws_request_indicate(fws, type, data); - break; - case BRCMF_FWS_TYPE_TXSTATUS: - brcmf_fws_txstatus_indicate(fws, data); - break; - case BRCMF_FWS_TYPE_FIFO_CREDITBACK: - err = brcmf_fws_fifocreditback_indicate(fws, data); - break; - case BRCMF_FWS_TYPE_RSSI: - brcmf_fws_rssi_indicate(fws, *data); - break; - case BRCMF_FWS_TYPE_TRANS_ID: - brcmf_fws_dbg_seqnum_check(fws, data); - break; - case BRCMF_FWS_TYPE_PKTTAG: - case BRCMF_FWS_TYPE_PENDING_TRAFFIC_BMP: - default: - fws->stats.tlv_invalid_type++; - break; - } - if (err == BRCMF_FWS_RET_OK_SCHEDULE) - status = BRCMF_FWS_RET_OK_SCHEDULE; - signal_data += len + 2; - data_len -= len + 2; - } - - if (data_len != 0) - fws->stats.tlv_parse_failed++; - - if (status == BRCMF_FWS_RET_OK_SCHEDULE) - brcmf_fws_schedule_deq(fws); - - /* signalling processing result does - * not affect the actual ethernet packet. - */ - skb_pull(skb, signal_len); - - /* this may be a signal-only packet - */ - if (skb->len == 0) - fws->stats.header_only_pkt++; - - brcmf_fws_unlock(drvr, flags); - return 0; -} - -static int brcmf_fws_hdrpush(struct brcmf_fws_info *fws, struct sk_buff *skb) -{ - struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac; - u8 *wlh; - u16 data_offset = 0; - u8 fillers; - __le32 pkttag = cpu_to_le32(brcmf_skbcb(skb)->htod); - - brcmf_dbg(TRACE, "enter: ea=%pM, ifidx=%u, pkttag=0x%08X\n", - entry->ea, entry->interface_id, le32_to_cpu(pkttag)); - if (entry->send_tim_signal) - data_offset += 2 + BRCMF_FWS_TYPE_PENDING_TRAFFIC_BMP_LEN; - - /* +2 is for Type[1] and Len[1] in TLV, plus TIM signal */ - data_offset += 2 + BRCMF_FWS_TYPE_PKTTAG_LEN; - fillers = round_up(data_offset, 4) - data_offset; - data_offset += fillers; - - skb_push(skb, data_offset); - wlh = skb->data; - - wlh[0] = BRCMF_FWS_TYPE_PKTTAG; - wlh[1] = BRCMF_FWS_TYPE_PKTTAG_LEN; - memcpy(&wlh[2], &pkttag, sizeof(pkttag)); - wlh += BRCMF_FWS_TYPE_PKTTAG_LEN + 2; - - if (entry->send_tim_signal) { - entry->send_tim_signal = 0; - wlh[0] = BRCMF_FWS_TYPE_PENDING_TRAFFIC_BMP; - wlh[1] = BRCMF_FWS_TYPE_PENDING_TRAFFIC_BMP_LEN; - wlh[2] = entry->mac_handle; - wlh[3] = entry->traffic_pending_bmp; - wlh += BRCMF_FWS_TYPE_PENDING_TRAFFIC_BMP_LEN + 2; - entry->traffic_lastreported_bmp = entry->traffic_pending_bmp; - } - if (fillers) - memset(wlh, BRCMF_FWS_TYPE_FILLER, fillers); - - brcmf_proto_hdrpush(fws->drvr, brcmf_skb_if_flags_get_field(skb, INDEX), - data_offset >> 2, skb); - return 0; -} - -static int brcmf_fws_precommit_skb(struct brcmf_fws_info *fws, int fifo, - struct sk_buff *p) -{ - struct brcmf_skbuff_cb *skcb = brcmf_skbcb(p); - struct brcmf_fws_mac_descriptor *entry = skcb->mac; - int rc = 0; - bool header_needed; - int hslot = BRCMF_FWS_HANGER_MAXITEMS; - u8 free_ctr; - u8 ifidx; - u8 flags; - - header_needed = skcb->state != BRCMF_FWS_SKBSTATE_SUPPRESSED; - - if (header_needed) { - /* obtaining free slot may fail, but that will be caught - * by the hanger push. This assures the packet has a BDC - * header upon return. - */ - hslot = brcmf_fws_hanger_get_free_slot(&fws->hanger); - free_ctr = entry->seq[fifo]; - brcmf_skb_htod_tag_set_field(p, HSLOT, hslot); - brcmf_skb_htod_tag_set_field(p, FREERUN, free_ctr); - brcmf_skb_htod_tag_set_field(p, GENERATION, 1); - entry->transit_count++; - } - brcmf_skb_if_flags_set_field(p, TRANSMIT, 1); - brcmf_skb_htod_tag_set_field(p, FIFO, fifo); - - flags = BRCMF_FWS_HTOD_FLAG_PKTFROMHOST; - if (!(skcb->if_flags & BRCMF_SKB_IF_FLAGS_CREDITCHECK_MASK)) { - /* - Indicate that this packet is being sent in response to an - explicit request from the firmware side. - */ - flags |= BRCMF_FWS_HTOD_FLAG_PKT_REQUESTED; - } - brcmf_skb_htod_tag_set_field(p, FLAGS, flags); - if (header_needed) { - brcmf_fws_hdrpush(fws, p); - rc = brcmf_fws_hanger_pushpkt(&fws->hanger, p, hslot); - if (rc) - brcmf_err("hanger push failed: rc=%d\n", rc); - } else { - int gen; - - /* remove old header */ - rc = brcmf_proto_hdrpull(fws->drvr, false, &ifidx, p); - if (rc == 0) { - hslot = brcmf_skb_htod_tag_get_field(p, HSLOT); - brcmf_fws_hanger_get_genbit(&fws->hanger, p, - hslot, &gen); - brcmf_skb_htod_tag_set_field(p, GENERATION, gen); - - /* push new header */ - brcmf_fws_hdrpush(fws, p); - } - } - - return rc; -} - -static void -brcmf_fws_rollback_toq(struct brcmf_fws_info *fws, struct sk_buff *skb) -{ - /* - put the packet back to the head of queue - - - suppressed packet goes back to suppress sub-queue - - pull out the header, if new or delayed packet - - Note: hslot is used only when header removal is done. - */ - struct brcmf_fws_mac_descriptor *entry; - enum brcmf_fws_skb_state state; - struct sk_buff *pktout; - int rc = 0; - int fifo; - int hslot; - u8 ifidx; - - fifo = brcmf_skb_if_flags_get_field(skb, FIFO); - state = brcmf_skbcb(skb)->state; - entry = brcmf_skbcb(skb)->mac; - - if (entry != NULL) { - if (state == BRCMF_FWS_SKBSTATE_SUPPRESSED) { - /* wl-header is saved for suppressed packets */ - pktout = brcmu_pktq_penq_head(&entry->psq, 2 * fifo + 1, - skb); - if (pktout == NULL) { - brcmf_err("suppress queue full\n"); - rc = -ENOSPC; - } - } else { - hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); - - /* remove header first */ - rc = brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb); - if (rc) { - brcmf_err("header removal failed\n"); - /* free the hanger slot */ - brcmf_fws_hanger_poppkt(&fws->hanger, hslot, - &pktout, true); - rc = -EINVAL; - goto fail; - } - - /* delay-q packets are going to delay-q */ - pktout = brcmu_pktq_penq_head(&entry->psq, - 2 * fifo, skb); - if (pktout == NULL) { - brcmf_err("delay queue full\n"); - rc = -ENOSPC; - } - - /* free the hanger slot */ - brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &pktout, - true); - - /* decrement sequence count */ - entry->seq[fifo]--; - } - /* - if this packet did not count against FIFO credit, it must have - taken a requested_credit from the firmware (for pspoll etc.) - */ - if (!(brcmf_skbcb(skb)->if_flags & - BRCMF_SKB_IF_FLAGS_CREDITCHECK_MASK)) - entry->requested_credit++; - } else { - brcmf_err("no mac entry linked\n"); - rc = -ENOENT; - } - - -fail: - if (rc) { - brcmf_txfinalize(fws->drvr, skb, false); - fws->stats.rollback_failed++; - } else - fws->stats.rollback_success++; -} - -static int brcmf_fws_borrow_credit(struct brcmf_fws_info *fws) -{ - int lender_ac; - - if (time_after(fws->borrow_defer_timestamp, jiffies)) - return -ENAVAIL; - - for (lender_ac = 0; lender_ac <= BRCMF_FWS_FIFO_AC_VO; lender_ac++) { - if (fws->fifo_credit[lender_ac]) { - fws->credits_borrowed[lender_ac]++; - fws->fifo_credit[lender_ac]--; - if (fws->fifo_credit[lender_ac] == 0) - fws->fifo_credit_map &= ~(1 << lender_ac); - brcmf_dbg(TRACE, "borrow credit from: %d\n", lender_ac); - return 0; - } - } - return -ENAVAIL; -} - -static int brcmf_fws_consume_credit(struct brcmf_fws_info *fws, int fifo, - struct sk_buff *skb) -{ - struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac; - int *credit = &fws->fifo_credit[fifo]; - int use_credit = 1; - - brcmf_dbg(TRACE, "enter: ac=%d, credits=%d\n", fifo, *credit); - - if (entry->requested_credit > 0) { - /* - * if the packet was pulled out while destination is in - * closed state but had a non-zero packets requested, - * then this should not count against the FIFO credit. - * That is due to the fact that the firmware will - * most likely hold onto this packet until a suitable - * time later to push it to the appropriate AC FIFO. - */ - entry->requested_credit--; - if (entry->state == BRCMF_FWS_STATE_CLOSE) - use_credit = 0; - } else if (entry->requested_packet > 0) { - entry->requested_packet--; - brcmf_skb_if_flags_set_field(skb, REQUESTED, 1); - if (entry->state == BRCMF_FWS_STATE_CLOSE) - use_credit = 0; - } - brcmf_skb_if_flags_set_field(skb, CREDITCHECK, use_credit); - if (!use_credit) { - brcmf_dbg(TRACE, "exit: no creditcheck set\n"); - return 0; - } - - if (fifo != BRCMF_FWS_FIFO_AC_BE) - fws->borrow_defer_timestamp = jiffies + - BRCMF_FWS_BORROW_DEFER_PERIOD; - - if (!(*credit)) { - /* Try to borrow a credit from other queue */ - if (fifo == BRCMF_FWS_FIFO_AC_BE && - brcmf_fws_borrow_credit(fws) == 0) - return 0; - - brcmf_dbg(TRACE, "exit: ac=%d, credits depleted\n", fifo); - return -ENAVAIL; - } - (*credit)--; - if (!(*credit)) - fws->fifo_credit_map &= ~(1 << fifo); - brcmf_dbg(TRACE, "exit: ac=%d, credits=%d\n", fifo, *credit); - return 0; -} - -static int brcmf_fws_commit_skb(struct brcmf_fws_info *fws, int fifo, - struct sk_buff *skb) -{ - struct brcmf_skbuff_cb *skcb = brcmf_skbcb(skb); - struct brcmf_fws_mac_descriptor *entry; - struct brcmf_bus *bus = fws->drvr->bus_if; - int rc; - - entry = skcb->mac; - if (IS_ERR(entry)) - return PTR_ERR(entry); - - rc = brcmf_fws_precommit_skb(fws, fifo, skb); - if (rc < 0) { - fws->stats.generic_error++; - goto rollback; - } - - rc = brcmf_bus_txdata(bus, skb); - if (rc < 0) - goto rollback; - - entry->seq[fifo]++; - fws->stats.pkt2bus++; - if (brcmf_skbcb(skb)->if_flags & BRCMF_SKB_IF_FLAGS_CREDITCHECK_MASK) { - fws->stats.send_pkts[fifo]++; - fws->stats.fifo_credits_sent[fifo]++; - } - - return rc; - -rollback: - brcmf_fws_rollback_toq(fws, skb); - return rc; -} - -int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) -{ - struct brcmf_pub *drvr = ifp->drvr; - struct brcmf_fws_info *fws = drvr->fws; - struct brcmf_skbuff_cb *skcb = brcmf_skbcb(skb); - struct ethhdr *eh = (struct ethhdr *)(skb->data); - ulong flags; - int fifo = BRCMF_FWS_FIFO_BCMC; - bool multicast = is_multicast_ether_addr(eh->h_dest); - - /* determine the priority */ - if (!skb->priority) - skb->priority = cfg80211_classify8021d(skb); - - drvr->tx_multicast += !!multicast; - if (ntohs(eh->h_proto) == ETH_P_PAE) - atomic_inc(&ifp->pend_8021x_cnt); - - if (!brcmf_fws_fc_active(fws)) { - /* If the protocol uses a data header, apply it */ - brcmf_proto_hdrpush(drvr, ifp->ifidx, 0, skb); - - /* Use bus module to send data frame */ - return brcmf_bus_txdata(drvr->bus_if, skb); - } - - /* set control buffer information */ - skcb->if_flags = 0; - skcb->mac = brcmf_fws_find_mac_desc(fws, ifp, eh->h_dest); - skcb->state = BRCMF_FWS_SKBSTATE_NEW; - brcmf_skb_if_flags_set_field(skb, INDEX, ifp->ifidx); - if (!multicast) - fifo = brcmf_fws_prio2fifo[skb->priority]; - brcmf_skb_if_flags_set_field(skb, FIFO, fifo); - - brcmf_dbg(TRACE, "ea=%pM, multi=%d, fifo=%d\n", eh->h_dest, - multicast, fifo); - - brcmf_fws_lock(drvr, flags); - if (skcb->mac->suppressed || - brcmf_fws_mac_desc_closed(fws, skcb->mac, fifo) || - brcmu_pktq_mlen(&skcb->mac->psq, 3 << (fifo * 2)) || - (!multicast && - brcmf_fws_consume_credit(fws, fifo, skb) < 0)) { - /* enqueue the packet in delayQ */ - drvr->fws->fifo_delay_map |= 1 << fifo; - brcmf_fws_enq(fws, BRCMF_FWS_SKBSTATE_DELAYED, fifo, skb); - } else { - if (brcmf_fws_commit_skb(fws, fifo, skb)) - if (!multicast) - brcmf_skb_pick_up_credit(fws, fifo, skb); - } - brcmf_fws_unlock(drvr, flags); - return 0; -} - -void brcmf_fws_reset_interface(struct brcmf_if *ifp) -{ - struct brcmf_fws_mac_descriptor *entry = ifp->fws_desc; - - brcmf_dbg(TRACE, "enter: idx=%d\n", ifp->bssidx); - if (!entry) - return; - - brcmf_fws_init_mac_descriptor(entry, ifp->mac_addr, ifp->ifidx); -} - -void brcmf_fws_add_interface(struct brcmf_if *ifp) -{ - struct brcmf_fws_info *fws = ifp->drvr->fws; - struct brcmf_fws_mac_descriptor *entry; - - brcmf_dbg(TRACE, "enter: idx=%d, mac=%pM\n", - ifp->bssidx, ifp->mac_addr); - if (!ifp->ndev || !ifp->drvr->fw_signals) - return; - - entry = &fws->desc.iface[ifp->ifidx]; - ifp->fws_desc = entry; - brcmf_fws_init_mac_descriptor(entry, ifp->mac_addr, ifp->ifidx); - brcmu_pktq_init(&entry->psq, BRCMF_FWS_PSQ_PREC_COUNT, - BRCMF_FWS_PSQ_LEN); -} - -void brcmf_fws_del_interface(struct brcmf_if *ifp) -{ - struct brcmf_fws_mac_descriptor *entry = ifp->fws_desc; - ulong flags; - - brcmf_dbg(TRACE, "enter: idx=%d\n", ifp->bssidx); - if (!entry) - return; - - brcmf_fws_lock(ifp->drvr, flags); - ifp->fws_desc = NULL; - brcmf_fws_clear_mac_descriptor(entry); - brcmf_fws_cleanup(ifp->drvr->fws, ifp->ifidx); - brcmf_fws_unlock(ifp->drvr, flags); -} - -static void brcmf_fws_dequeue_worker(struct work_struct *worker) -{ - struct brcmf_fws_info *fws; - struct sk_buff *skb; - ulong flags; - int fifo; - int credit; - - fws = container_of(worker, struct brcmf_fws_info, fws_dequeue_work); - - brcmf_dbg(TRACE, "enter: fws=%p\n", fws); - brcmf_fws_lock(fws->drvr, flags); - for (fifo = NL80211_NUM_ACS; fifo >= 0; fifo--) { - brcmf_dbg(TRACE, "fifo %d credit %d\n", fifo, - fws->fifo_credit[fifo]); - for (credit = 0; credit < fws->fifo_credit[fifo]; /* nop */) { - skb = brcmf_fws_deq(fws, fifo); - if (!skb || brcmf_fws_commit_skb(fws, fifo, skb)) - break; - if (brcmf_skbcb(skb)->if_flags & - BRCMF_SKB_IF_FLAGS_CREDITCHECK_MASK) - credit++; - } - if ((fifo == BRCMF_FWS_FIFO_AC_BE) && - (credit == fws->fifo_credit[fifo])) { - fws->fifo_credit[fifo] -= credit; - while (brcmf_fws_borrow_credit(fws) == 0) { - skb = brcmf_fws_deq(fws, fifo); - if (!skb) { - brcmf_fws_return_credits(fws, fifo, 1); - break; - } - if (brcmf_fws_commit_skb(fws, fifo, skb)) { - brcmf_fws_return_credits(fws, fifo, 1); - break; - } - } - } else { - fws->fifo_credit[fifo] -= credit; - } - } - brcmf_fws_unlock(fws->drvr, flags); -} - -int brcmf_fws_init(struct brcmf_pub *drvr) -{ - u32 tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS; - int rc; - - if (!drvr->fw_signals) - return 0; - - spin_lock_init(&drvr->fws_spinlock); - - drvr->fws = kzalloc(sizeof(*(drvr->fws)), GFP_KERNEL); - if (!drvr->fws) { - rc = -ENOMEM; - goto fail; - } - - /* set linkage back */ - drvr->fws->drvr = drvr; - drvr->fws->fcmode = fcmode; - - drvr->fws->fws_wq = create_singlethread_workqueue("brcmf_fws_wq"); - if (drvr->fws->fws_wq == NULL) { - brcmf_err("workqueue creation failed\n"); - rc = -EBADF; - goto fail; - } - INIT_WORK(&drvr->fws->fws_dequeue_work, brcmf_fws_dequeue_worker); - - /* enable firmware signalling if fcmode active */ - if (drvr->fws->fcmode != BRCMF_FWS_FCMODE_NONE) - tlv |= BRCMF_FWS_FLAGS_XONXOFF_SIGNALS | - BRCMF_FWS_FLAGS_CREDIT_STATUS_SIGNALS | - BRCMF_FWS_FLAGS_HOST_PROPTXSTATUS_ACTIVE; - - rc = brcmf_fweh_register(drvr, BRCMF_E_FIFO_CREDIT_MAP, - brcmf_fws_notify_credit_map); - if (rc < 0) { - brcmf_err("register credit map handler failed\n"); - goto fail; - } - - /* setting the iovar may fail if feature is unsupported - * so leave the rc as is so driver initialization can - * continue. - */ - if (brcmf_fil_iovar_int_set(drvr->iflist[0], "tlv", tlv)) { - brcmf_err("failed to set bdcv2 tlv signaling\n"); - goto fail_event; - } - - brcmf_fws_hanger_init(&drvr->fws->hanger); - brcmf_fws_init_mac_descriptor(&drvr->fws->desc.other, NULL, 0); - brcmu_pktq_init(&drvr->fws->desc.other.psq, BRCMF_FWS_PSQ_PREC_COUNT, - BRCMF_FWS_PSQ_LEN); - - /* create debugfs file for statistics */ - brcmf_debugfs_create_fws_stats(drvr, &drvr->fws->stats); - - /* TODO: remove upon feature delivery */ - brcmf_err("%s bdcv2 tlv signaling [%x]\n", - drvr->fw_signals ? "enabled" : "disabled", tlv); - return 0; - -fail_event: - brcmf_fweh_unregister(drvr, BRCMF_E_FIFO_CREDIT_MAP); -fail: - brcmf_fws_deinit(drvr); - return rc; -} - -void brcmf_fws_deinit(struct brcmf_pub *drvr) -{ - struct brcmf_fws_info *fws = drvr->fws; - ulong flags; - - if (!fws) - return; - - /* disable firmware signalling entirely - * to avoid using the workqueue. - */ - drvr->fw_signals = false; - - if (drvr->fws->fws_wq) - destroy_workqueue(drvr->fws->fws_wq); - - /* cleanup */ - brcmf_fws_lock(drvr, flags); - brcmf_fws_cleanup(fws, -1); - drvr->fws = NULL; - brcmf_fws_unlock(drvr, flags); - - /* free top structure */ - kfree(fws); -} - -bool brcmf_fws_fc_active(struct brcmf_fws_info *fws) -{ - if (!fws) - return false; - - brcmf_dbg(TRACE, "enter: mode=%d\n", fws->fcmode); - return fws->fcmode != BRCMF_FWS_FCMODE_NONE; -} - -void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb) -{ - ulong flags; - - brcmf_fws_lock(fws->drvr, flags); - brcmf_fws_txstatus_process(fws, BRCMF_FWS_TXSTATUS_FW_TOSSED, - brcmf_skb_htod_tag_get_field(skb, HSLOT), 0); - /* the packet never reached firmware so reclaim credit */ - if (fws->fcmode == BRCMF_FWS_FCMODE_EXPLICIT_CREDIT && - brcmf_skbcb(skb)->if_flags & BRCMF_SKB_IF_FLAGS_CREDITCHECK_MASK) { - brcmf_fws_return_credits(fws, - brcmf_skb_htod_tag_get_field(skb, - FIFO), - 1); - brcmf_fws_schedule_deq(fws); - } - brcmf_fws_unlock(fws->drvr, flags); -} diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h deleted file mode 100644 index fbe483d23752..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2012 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -#ifndef FWSIGNAL_H_ -#define FWSIGNAL_H_ - -int brcmf_fws_init(struct brcmf_pub *drvr); -void brcmf_fws_deinit(struct brcmf_pub *drvr); -bool brcmf_fws_fc_active(struct brcmf_fws_info *fws); -int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len, - struct sk_buff *skb); -int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb); - -void brcmf_fws_reset_interface(struct brcmf_if *ifp); -void brcmf_fws_add_interface(struct brcmf_if *ifp); -void brcmf_fws_del_interface(struct brcmf_if *ifp); -void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb); - -#endif /* FWSIGNAL_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c deleted file mode 100644 index 79555f006d53..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c +++ /dev/null @@ -1,2449 +0,0 @@ -/* - * Copyright (c) 2012 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include "fwil.h" -#include "fwil_types.h" -#include "p2p.h" -#include "wl_cfg80211.h" - -/* parameters used for p2p escan */ -#define P2PAPI_SCAN_NPROBES 1 -#define P2PAPI_SCAN_DWELL_TIME_MS 80 -#define P2PAPI_SCAN_SOCIAL_DWELL_TIME_MS 40 -#define P2PAPI_SCAN_HOME_TIME_MS 60 -#define P2PAPI_SCAN_NPROBS_TIME_MS 30 -#define P2PAPI_SCAN_AF_SEARCH_DWELL_TIME_MS 100 -#define WL_SCAN_CONNECT_DWELL_TIME_MS 200 -#define WL_SCAN_JOIN_PROBE_INTERVAL_MS 20 - -#define BRCMF_P2P_WILDCARD_SSID "DIRECT-" -#define BRCMF_P2P_WILDCARD_SSID_LEN (sizeof(BRCMF_P2P_WILDCARD_SSID) - 1) - -#define SOCIAL_CHAN_1 1 -#define SOCIAL_CHAN_2 6 -#define SOCIAL_CHAN_3 11 -#define IS_P2P_SOCIAL_CHANNEL(channel) ((channel == SOCIAL_CHAN_1) || \ - (channel == SOCIAL_CHAN_2) || \ - (channel == SOCIAL_CHAN_3)) -#define BRCMF_P2P_TEMP_CHAN SOCIAL_CHAN_3 -#define SOCIAL_CHAN_CNT 3 -#define AF_PEER_SEARCH_CNT 2 - -#define BRCMF_SCB_TIMEOUT_VALUE 20 - -#define P2P_VER 9 /* P2P version: 9=WiFi P2P v1.0 */ -#define P2P_PUB_AF_CATEGORY 0x04 -#define P2P_PUB_AF_ACTION 0x09 -#define P2P_AF_CATEGORY 0x7f -#define P2P_OUI "\x50\x6F\x9A" /* P2P OUI */ -#define P2P_OUI_LEN 3 /* P2P OUI length */ - -/* Action Frame Constants */ -#define DOT11_ACTION_HDR_LEN 2 /* action frame category + action */ -#define DOT11_ACTION_CAT_OFF 0 /* category offset */ -#define DOT11_ACTION_ACT_OFF 1 /* action offset */ - -#define P2P_AF_DWELL_TIME 200 -#define P2P_AF_MIN_DWELL_TIME 100 -#define P2P_AF_MED_DWELL_TIME 400 -#define P2P_AF_LONG_DWELL_TIME 1000 -#define P2P_AF_TX_MAX_RETRY 1 -#define P2P_AF_MAX_WAIT_TIME 2000 -#define P2P_INVALID_CHANNEL -1 -#define P2P_CHANNEL_SYNC_RETRY 5 -#define P2P_AF_FRM_SCAN_MAX_WAIT 1500 -#define P2P_DEFAULT_SLEEP_TIME_VSDB 200 - -/* WiFi P2P Public Action Frame OUI Subtypes */ -#define P2P_PAF_GON_REQ 0 /* Group Owner Negotiation Req */ -#define P2P_PAF_GON_RSP 1 /* Group Owner Negotiation Rsp */ -#define P2P_PAF_GON_CONF 2 /* Group Owner Negotiation Confirm */ -#define P2P_PAF_INVITE_REQ 3 /* P2P Invitation Request */ -#define P2P_PAF_INVITE_RSP 4 /* P2P Invitation Response */ -#define P2P_PAF_DEVDIS_REQ 5 /* Device Discoverability Request */ -#define P2P_PAF_DEVDIS_RSP 6 /* Device Discoverability Response */ -#define P2P_PAF_PROVDIS_REQ 7 /* Provision Discovery Request */ -#define P2P_PAF_PROVDIS_RSP 8 /* Provision Discovery Response */ -#define P2P_PAF_SUBTYPE_INVALID 255 /* Invalid Subtype */ - -/* WiFi P2P Action Frame OUI Subtypes */ -#define P2P_AF_NOTICE_OF_ABSENCE 0 /* Notice of Absence */ -#define P2P_AF_PRESENCE_REQ 1 /* P2P Presence Request */ -#define P2P_AF_PRESENCE_RSP 2 /* P2P Presence Response */ -#define P2P_AF_GO_DISC_REQ 3 /* GO Discoverability Request */ - -/* P2P Service Discovery related */ -#define P2PSD_ACTION_CATEGORY 0x04 /* Public action frame */ -#define P2PSD_ACTION_ID_GAS_IREQ 0x0a /* GAS Initial Request AF */ -#define P2PSD_ACTION_ID_GAS_IRESP 0x0b /* GAS Initial Response AF */ -#define P2PSD_ACTION_ID_GAS_CREQ 0x0c /* GAS Comback Request AF */ -#define P2PSD_ACTION_ID_GAS_CRESP 0x0d /* GAS Comback Response AF */ - -/** - * struct brcmf_p2p_disc_st_le - set discovery state in firmware. - * - * @state: requested discovery state (see enum brcmf_p2p_disc_state). - * @chspec: channel parameter for %WL_P2P_DISC_ST_LISTEN state. - * @dwell: dwell time in ms for %WL_P2P_DISC_ST_LISTEN state. - */ -struct brcmf_p2p_disc_st_le { - u8 state; - __le16 chspec; - __le16 dwell; -}; - -/** - * enum brcmf_p2p_disc_state - P2P discovery state values - * - * @WL_P2P_DISC_ST_SCAN: P2P discovery with wildcard SSID and P2P IE. - * @WL_P2P_DISC_ST_LISTEN: P2P discovery off-channel for specified time. - * @WL_P2P_DISC_ST_SEARCH: P2P discovery with P2P wildcard SSID and P2P IE. - */ -enum brcmf_p2p_disc_state { - WL_P2P_DISC_ST_SCAN, - WL_P2P_DISC_ST_LISTEN, - WL_P2P_DISC_ST_SEARCH -}; - -/** - * struct brcmf_p2p_scan_le - P2P specific scan request. - * - * @type: type of scan method requested (values: 'E' or 'S'). - * @reserved: reserved (ignored). - * @eparams: parameters used for type 'E'. - * @sparams: parameters used for type 'S'. - */ -struct brcmf_p2p_scan_le { - u8 type; - u8 reserved[3]; - union { - struct brcmf_escan_params_le eparams; - struct brcmf_scan_params_le sparams; - }; -}; - -/** - * struct brcmf_p2p_pub_act_frame - WiFi P2P Public Action Frame - * - * @category: P2P_PUB_AF_CATEGORY - * @action: P2P_PUB_AF_ACTION - * @oui[3]: P2P_OUI - * @oui_type: OUI type - P2P_VER - * @subtype: OUI subtype - P2P_TYPE_* - * @dialog_token: nonzero, identifies req/rsp transaction - * @elts[1]: Variable length information elements. - */ -struct brcmf_p2p_pub_act_frame { - u8 category; - u8 action; - u8 oui[3]; - u8 oui_type; - u8 subtype; - u8 dialog_token; - u8 elts[1]; -}; - -/** - * struct brcmf_p2p_action_frame - WiFi P2P Action Frame - * - * @category: P2P_AF_CATEGORY - * @OUI[3]: OUI - P2P_OUI - * @type: OUI Type - P2P_VER - * @subtype: OUI Subtype - P2P_AF_* - * @dialog_token: nonzero, identifies req/resp tranaction - * @elts[1]: Variable length information elements. - */ -struct brcmf_p2p_action_frame { - u8 category; - u8 oui[3]; - u8 type; - u8 subtype; - u8 dialog_token; - u8 elts[1]; -}; - -/** - * struct brcmf_p2psd_gas_pub_act_frame - Wi-Fi GAS Public Action Frame - * - * @category: 0x04 Public Action Frame - * @action: 0x6c Advertisement Protocol - * @dialog_token: nonzero, identifies req/rsp transaction - * @query_data[1]: Query Data. SD gas ireq SD gas iresp - */ -struct brcmf_p2psd_gas_pub_act_frame { - u8 category; - u8 action; - u8 dialog_token; - u8 query_data[1]; -}; - -/** - * struct brcmf_config_af_params - Action Frame Parameters for tx. - * - * @mpc_onoff: To make sure to send successfully action frame, we have to - * turn off mpc 0: off, 1: on, (-1): do nothing - * @search_channel: 1: search peer's channel to send af - * extra_listen: keep the dwell time to get af response frame. - */ -struct brcmf_config_af_params { - s32 mpc_onoff; - bool search_channel; - bool extra_listen; -}; - -/** - * brcmf_p2p_is_pub_action() - true if p2p public type frame. - * - * @frame: action frame data. - * @frame_len: length of action frame data. - * - * Determine if action frame is p2p public action type - */ -static bool brcmf_p2p_is_pub_action(void *frame, u32 frame_len) -{ - struct brcmf_p2p_pub_act_frame *pact_frm; - - if (frame == NULL) - return false; - - pact_frm = (struct brcmf_p2p_pub_act_frame *)frame; - if (frame_len < sizeof(struct brcmf_p2p_pub_act_frame) - 1) - return false; - - if (pact_frm->category == P2P_PUB_AF_CATEGORY && - pact_frm->action == P2P_PUB_AF_ACTION && - pact_frm->oui_type == P2P_VER && - memcmp(pact_frm->oui, P2P_OUI, P2P_OUI_LEN) == 0) - return true; - - return false; -} - -/** - * brcmf_p2p_is_p2p_action() - true if p2p action type frame. - * - * @frame: action frame data. - * @frame_len: length of action frame data. - * - * Determine if action frame is p2p action type - */ -static bool brcmf_p2p_is_p2p_action(void *frame, u32 frame_len) -{ - struct brcmf_p2p_action_frame *act_frm; - - if (frame == NULL) - return false; - - act_frm = (struct brcmf_p2p_action_frame *)frame; - if (frame_len < sizeof(struct brcmf_p2p_action_frame) - 1) - return false; - - if (act_frm->category == P2P_AF_CATEGORY && - act_frm->type == P2P_VER && - memcmp(act_frm->oui, P2P_OUI, P2P_OUI_LEN) == 0) - return true; - - return false; -} - -/** - * brcmf_p2p_is_gas_action() - true if p2p gas action type frame. - * - * @frame: action frame data. - * @frame_len: length of action frame data. - * - * Determine if action frame is p2p gas action type - */ -static bool brcmf_p2p_is_gas_action(void *frame, u32 frame_len) -{ - struct brcmf_p2psd_gas_pub_act_frame *sd_act_frm; - - if (frame == NULL) - return false; - - sd_act_frm = (struct brcmf_p2psd_gas_pub_act_frame *)frame; - if (frame_len < sizeof(struct brcmf_p2psd_gas_pub_act_frame) - 1) - return false; - - if (sd_act_frm->category != P2PSD_ACTION_CATEGORY) - return false; - - if (sd_act_frm->action == P2PSD_ACTION_ID_GAS_IREQ || - sd_act_frm->action == P2PSD_ACTION_ID_GAS_IRESP || - sd_act_frm->action == P2PSD_ACTION_ID_GAS_CREQ || - sd_act_frm->action == P2PSD_ACTION_ID_GAS_CRESP) - return true; - - return false; -} - -/** - * brcmf_p2p_print_actframe() - debug print routine. - * - * @tx: Received or to be transmitted - * @frame: action frame data. - * @frame_len: length of action frame data. - * - * Print information about the p2p action frame - */ - -#ifdef DEBUG - -static void brcmf_p2p_print_actframe(bool tx, void *frame, u32 frame_len) -{ - struct brcmf_p2p_pub_act_frame *pact_frm; - struct brcmf_p2p_action_frame *act_frm; - struct brcmf_p2psd_gas_pub_act_frame *sd_act_frm; - - if (!frame || frame_len <= 2) - return; - - if (brcmf_p2p_is_pub_action(frame, frame_len)) { - pact_frm = (struct brcmf_p2p_pub_act_frame *)frame; - switch (pact_frm->subtype) { - case P2P_PAF_GON_REQ: - brcmf_dbg(TRACE, "%s P2P Group Owner Negotiation Req Frame\n", - (tx) ? "TX" : "RX"); - break; - case P2P_PAF_GON_RSP: - brcmf_dbg(TRACE, "%s P2P Group Owner Negotiation Rsp Frame\n", - (tx) ? "TX" : "RX"); - break; - case P2P_PAF_GON_CONF: - brcmf_dbg(TRACE, "%s P2P Group Owner Negotiation Confirm Frame\n", - (tx) ? "TX" : "RX"); - break; - case P2P_PAF_INVITE_REQ: - brcmf_dbg(TRACE, "%s P2P Invitation Request Frame\n", - (tx) ? "TX" : "RX"); - break; - case P2P_PAF_INVITE_RSP: - brcmf_dbg(TRACE, "%s P2P Invitation Response Frame\n", - (tx) ? "TX" : "RX"); - break; - case P2P_PAF_DEVDIS_REQ: - brcmf_dbg(TRACE, "%s P2P Device Discoverability Request Frame\n", - (tx) ? "TX" : "RX"); - break; - case P2P_PAF_DEVDIS_RSP: - brcmf_dbg(TRACE, "%s P2P Device Discoverability Response Frame\n", - (tx) ? "TX" : "RX"); - break; - case P2P_PAF_PROVDIS_REQ: - brcmf_dbg(TRACE, "%s P2P Provision Discovery Request Frame\n", - (tx) ? "TX" : "RX"); - break; - case P2P_PAF_PROVDIS_RSP: - brcmf_dbg(TRACE, "%s P2P Provision Discovery Response Frame\n", - (tx) ? "TX" : "RX"); - break; - default: - brcmf_dbg(TRACE, "%s Unknown P2P Public Action Frame\n", - (tx) ? "TX" : "RX"); - break; - } - } else if (brcmf_p2p_is_p2p_action(frame, frame_len)) { - act_frm = (struct brcmf_p2p_action_frame *)frame; - switch (act_frm->subtype) { - case P2P_AF_NOTICE_OF_ABSENCE: - brcmf_dbg(TRACE, "%s P2P Notice of Absence Frame\n", - (tx) ? "TX" : "RX"); - break; - case P2P_AF_PRESENCE_REQ: - brcmf_dbg(TRACE, "%s P2P Presence Request Frame\n", - (tx) ? "TX" : "RX"); - break; - case P2P_AF_PRESENCE_RSP: - brcmf_dbg(TRACE, "%s P2P Presence Response Frame\n", - (tx) ? "TX" : "RX"); - break; - case P2P_AF_GO_DISC_REQ: - brcmf_dbg(TRACE, "%s P2P Discoverability Request Frame\n", - (tx) ? "TX" : "RX"); - break; - default: - brcmf_dbg(TRACE, "%s Unknown P2P Action Frame\n", - (tx) ? "TX" : "RX"); - } - - } else if (brcmf_p2p_is_gas_action(frame, frame_len)) { - sd_act_frm = (struct brcmf_p2psd_gas_pub_act_frame *)frame; - switch (sd_act_frm->action) { - case P2PSD_ACTION_ID_GAS_IREQ: - brcmf_dbg(TRACE, "%s P2P GAS Initial Request\n", - (tx) ? "TX" : "RX"); - break; - case P2PSD_ACTION_ID_GAS_IRESP: - brcmf_dbg(TRACE, "%s P2P GAS Initial Response\n", - (tx) ? "TX" : "RX"); - break; - case P2PSD_ACTION_ID_GAS_CREQ: - brcmf_dbg(TRACE, "%s P2P GAS Comback Request\n", - (tx) ? "TX" : "RX"); - break; - case P2PSD_ACTION_ID_GAS_CRESP: - brcmf_dbg(TRACE, "%s P2P GAS Comback Response\n", - (tx) ? "TX" : "RX"); - break; - default: - brcmf_dbg(TRACE, "%s Unknown P2P GAS Frame\n", - (tx) ? "TX" : "RX"); - break; - } - } -} - -#else - -static void brcmf_p2p_print_actframe(bool tx, void *frame, u32 frame_len) -{ -} - -#endif - - -/** - * brcmf_p2p_set_firmware() - prepare firmware for peer-to-peer operation. - * - * @ifp: ifp to use for iovars (primary). - * @p2p_mac: mac address to configure for p2p_da_override - */ -static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac) -{ - s32 ret = 0; - - brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); - brcmf_fil_iovar_int_set(ifp, "apsta", 1); - brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); - - /* In case of COB type, firmware has default mac address - * After Initializing firmware, we have to set current mac address to - * firmware for P2P device address - */ - ret = brcmf_fil_iovar_data_set(ifp, "p2p_da_override", p2p_mac, - ETH_ALEN); - if (ret) - brcmf_err("failed to update device address ret %d\n", ret); - - return ret; -} - -/** - * brcmf_p2p_generate_bss_mac() - derive mac addresses for P2P. - * - * @p2p: P2P specific data. - * @dev_addr: optional device address. - * - * P2P needs mac addresses for P2P device and interface. If no device - * address it specified, these are derived from the primary net device, ie. - * the permanent ethernet address of the device. - */ -static void brcmf_p2p_generate_bss_mac(struct brcmf_p2p_info *p2p, u8 *dev_addr) -{ - struct brcmf_if *pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; - bool local_admin = false; - - if (!dev_addr || is_zero_ether_addr(dev_addr)) { - dev_addr = pri_ifp->mac_addr; - local_admin = true; - } - - /* Generate the P2P Device Address. This consists of the device's - * primary MAC address with the locally administered bit set. - */ - memcpy(p2p->dev_addr, dev_addr, ETH_ALEN); - if (local_admin) - p2p->dev_addr[0] |= 0x02; - - /* Generate the P2P Interface Address. If the discovery and connection - * BSSCFGs need to simultaneously co-exist, then this address must be - * different from the P2P Device Address, but also locally administered. - */ - memcpy(p2p->int_addr, p2p->dev_addr, ETH_ALEN); - p2p->int_addr[0] |= 0x02; - p2p->int_addr[4] ^= 0x80; -} - -/** - * brcmf_p2p_scan_is_p2p_request() - is cfg80211 scan request a P2P scan. - * - * @request: the scan request as received from cfg80211. - * - * returns true if one of the ssids in the request matches the - * P2P wildcard ssid; otherwise returns false. - */ -static bool brcmf_p2p_scan_is_p2p_request(struct cfg80211_scan_request *request) -{ - struct cfg80211_ssid *ssids = request->ssids; - int i; - - for (i = 0; i < request->n_ssids; i++) { - if (ssids[i].ssid_len != BRCMF_P2P_WILDCARD_SSID_LEN) - continue; - - brcmf_dbg(INFO, "comparing ssid \"%s\"", ssids[i].ssid); - if (!memcmp(BRCMF_P2P_WILDCARD_SSID, ssids[i].ssid, - BRCMF_P2P_WILDCARD_SSID_LEN)) - return true; - } - return false; -} - -/** - * brcmf_p2p_set_discover_state - set discover state in firmware. - * - * @ifp: low-level interface object. - * @state: discover state to set. - * @chanspec: channel parameters (for state @WL_P2P_DISC_ST_LISTEN only). - * @listen_ms: duration to listen (for state @WL_P2P_DISC_ST_LISTEN only). - */ -static s32 brcmf_p2p_set_discover_state(struct brcmf_if *ifp, u8 state, - u16 chanspec, u16 listen_ms) -{ - struct brcmf_p2p_disc_st_le discover_state; - s32 ret = 0; - brcmf_dbg(TRACE, "enter\n"); - - discover_state.state = state; - discover_state.chspec = cpu_to_le16(chanspec); - discover_state.dwell = cpu_to_le16(listen_ms); - ret = brcmf_fil_bsscfg_data_set(ifp, "p2p_state", &discover_state, - sizeof(discover_state)); - return ret; -} - -/** - * brcmf_p2p_deinit_discovery() - disable P2P device discovery. - * - * @p2p: P2P specific data. - * - * Resets the discovery state and disables it in firmware. - */ -static s32 brcmf_p2p_deinit_discovery(struct brcmf_p2p_info *p2p) -{ - struct brcmf_cfg80211_vif *vif; - - brcmf_dbg(TRACE, "enter\n"); - - /* Set the discovery state to SCAN */ - vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; - (void)brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_SCAN, 0, 0); - - /* Disable P2P discovery in the firmware */ - vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; - (void)brcmf_fil_iovar_int_set(vif->ifp, "p2p_disc", 0); - - return 0; -} - -/** - * brcmf_p2p_enable_discovery() - initialize and configure discovery. - * - * @p2p: P2P specific data. - * - * Initializes the discovery device and configure the virtual interface. - */ -static int brcmf_p2p_enable_discovery(struct brcmf_p2p_info *p2p) -{ - struct brcmf_cfg80211_vif *vif; - s32 ret = 0; - - brcmf_dbg(TRACE, "enter\n"); - vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; - if (!vif) { - brcmf_err("P2P config device not available\n"); - ret = -EPERM; - goto exit; - } - - if (test_bit(BRCMF_P2P_STATUS_ENABLED, &p2p->status)) { - brcmf_dbg(INFO, "P2P config device already configured\n"); - goto exit; - } - - /* Re-initialize P2P Discovery in the firmware */ - vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; - ret = brcmf_fil_iovar_int_set(vif->ifp, "p2p_disc", 1); - if (ret < 0) { - brcmf_err("set p2p_disc error\n"); - goto exit; - } - vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; - ret = brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_SCAN, 0, 0); - if (ret < 0) { - brcmf_err("unable to set WL_P2P_DISC_ST_SCAN\n"); - goto exit; - } - - /* - * Set wsec to any non-zero value in the discovery bsscfg - * to ensure our P2P probe responses have the privacy bit - * set in the 802.11 WPA IE. Some peer devices may not - * initiate WPS with us if this bit is not set. - */ - ret = brcmf_fil_bsscfg_int_set(vif->ifp, "wsec", AES_ENABLED); - if (ret < 0) { - brcmf_err("wsec error %d\n", ret); - goto exit; - } - - set_bit(BRCMF_P2P_STATUS_ENABLED, &p2p->status); -exit: - return ret; -} - -/** - * brcmf_p2p_escan() - initiate a P2P scan. - * - * @p2p: P2P specific data. - * @num_chans: number of channels to scan. - * @chanspecs: channel parameters for @num_chans channels. - * @search_state: P2P discover state to use. - * @action: scan action to pass to firmware. - * @bss_type: type of P2P bss. - */ -static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans, - u16 chanspecs[], s32 search_state, u16 action, - enum p2p_bss_type bss_type) -{ - s32 ret = 0; - s32 memsize = offsetof(struct brcmf_p2p_scan_le, - eparams.params_le.channel_list); - s32 nprobes; - s32 active; - u32 i; - u8 *memblk; - struct brcmf_cfg80211_vif *vif; - struct brcmf_p2p_scan_le *p2p_params; - struct brcmf_scan_params_le *sparams; - struct brcmf_ssid ssid; - - memsize += num_chans * sizeof(__le16); - memblk = kzalloc(memsize, GFP_KERNEL); - if (!memblk) - return -ENOMEM; - - vif = p2p->bss_idx[bss_type].vif; - if (vif == NULL) { - brcmf_err("no vif for bss type %d\n", bss_type); - ret = -EINVAL; - goto exit; - } - - switch (search_state) { - case WL_P2P_DISC_ST_SEARCH: - /* - * If we in SEARCH STATE, we don't need to set SSID explictly - * because dongle use P2P WILDCARD internally by default - */ - /* use null ssid */ - ssid.SSID_len = 0; - memset(ssid.SSID, 0, sizeof(ssid.SSID)); - break; - case WL_P2P_DISC_ST_SCAN: - /* - * wpa_supplicant has p2p_find command with type social or - * progressive. For progressive, we need to set the ssid to - * P2P WILDCARD because we just do broadcast scan unless - * setting SSID. - */ - ssid.SSID_len = BRCMF_P2P_WILDCARD_SSID_LEN; - memcpy(ssid.SSID, BRCMF_P2P_WILDCARD_SSID, ssid.SSID_len); - break; - default: - brcmf_err(" invalid search state %d\n", search_state); - ret = -EINVAL; - goto exit; - } - - brcmf_p2p_set_discover_state(vif->ifp, search_state, 0, 0); - - /* - * set p2p scan parameters. - */ - p2p_params = (struct brcmf_p2p_scan_le *)memblk; - p2p_params->type = 'E'; - - /* determine the scan engine parameters */ - sparams = &p2p_params->eparams.params_le; - sparams->bss_type = DOT11_BSSTYPE_ANY; - if (p2p->cfg->active_scan) - sparams->scan_type = 0; - else - sparams->scan_type = 1; - - memset(&sparams->bssid, 0xFF, ETH_ALEN); - if (ssid.SSID_len) - memcpy(sparams->ssid_le.SSID, ssid.SSID, ssid.SSID_len); - sparams->ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len); - sparams->home_time = cpu_to_le32(P2PAPI_SCAN_HOME_TIME_MS); - - /* - * SOCIAL_CHAN_CNT + 1 takes care of the Progressive scan - * supported by the supplicant. - */ - if (num_chans == SOCIAL_CHAN_CNT || num_chans == (SOCIAL_CHAN_CNT + 1)) - active = P2PAPI_SCAN_SOCIAL_DWELL_TIME_MS; - else if (num_chans == AF_PEER_SEARCH_CNT) - active = P2PAPI_SCAN_AF_SEARCH_DWELL_TIME_MS; - else if (wl_get_vif_state_all(p2p->cfg, BRCMF_VIF_STATUS_CONNECTED)) - active = -1; - else - active = P2PAPI_SCAN_DWELL_TIME_MS; - - /* Override scan params to find a peer for a connection */ - if (num_chans == 1) { - active = WL_SCAN_CONNECT_DWELL_TIME_MS; - /* WAR to sync with presence period of VSDB GO. - * send probe request more frequently - */ - nprobes = active / WL_SCAN_JOIN_PROBE_INTERVAL_MS; - } else { - nprobes = active / P2PAPI_SCAN_NPROBS_TIME_MS; - } - - if (nprobes <= 0) - nprobes = 1; - - brcmf_dbg(INFO, "nprobes # %d, active_time %d\n", nprobes, active); - sparams->active_time = cpu_to_le32(active); - sparams->nprobes = cpu_to_le32(nprobes); - sparams->passive_time = cpu_to_le32(-1); - sparams->channel_num = cpu_to_le32(num_chans & - BRCMF_SCAN_PARAMS_COUNT_MASK); - for (i = 0; i < num_chans; i++) - sparams->channel_list[i] = cpu_to_le16(chanspecs[i]); - - /* set the escan specific parameters */ - p2p_params->eparams.version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION); - p2p_params->eparams.action = cpu_to_le16(action); - p2p_params->eparams.sync_id = cpu_to_le16(0x1234); - /* perform p2p scan on primary device */ - ret = brcmf_fil_bsscfg_data_set(vif->ifp, "p2p_scan", memblk, memsize); - if (!ret) - set_bit(BRCMF_SCAN_STATUS_BUSY, &p2p->cfg->scan_status); -exit: - kfree(memblk); - return ret; -} - -/** - * brcmf_p2p_run_escan() - escan callback for peer-to-peer. - * - * @cfg: driver private data for cfg80211 interface. - * @ndev: net device for which scan is requested. - * @request: scan request from cfg80211. - * @action: scan action. - * - * Determines the P2P discovery state based to scan request parameters and - * validates the channels in the request. - */ -static s32 brcmf_p2p_run_escan(struct brcmf_cfg80211_info *cfg, - struct brcmf_if *ifp, - struct cfg80211_scan_request *request, - u16 action) -{ - struct brcmf_p2p_info *p2p = &cfg->p2p; - s32 err = 0; - s32 search_state = WL_P2P_DISC_ST_SCAN; - struct brcmf_cfg80211_vif *vif; - struct net_device *dev = NULL; - int i, num_nodfs = 0; - u16 *chanspecs; - - brcmf_dbg(TRACE, "enter\n"); - - if (!request) { - err = -EINVAL; - goto exit; - } - - if (request->n_channels) { - chanspecs = kcalloc(request->n_channels, sizeof(*chanspecs), - GFP_KERNEL); - if (!chanspecs) { - err = -ENOMEM; - goto exit; - } - vif = p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif; - if (vif) - dev = vif->wdev.netdev; - if (request->n_channels == 3 && - request->channels[0]->hw_value == SOCIAL_CHAN_1 && - request->channels[1]->hw_value == SOCIAL_CHAN_2 && - request->channels[2]->hw_value == SOCIAL_CHAN_3) { - /* SOCIAL CHANNELS 1, 6, 11 */ - search_state = WL_P2P_DISC_ST_SEARCH; - brcmf_dbg(INFO, "P2P SEARCH PHASE START\n"); - } else if (dev != NULL && vif->mode == WL_MODE_AP) { - /* If you are already a GO, then do SEARCH only */ - brcmf_dbg(INFO, "Already a GO. Do SEARCH Only\n"); - search_state = WL_P2P_DISC_ST_SEARCH; - } else { - brcmf_dbg(INFO, "P2P SCAN STATE START\n"); - } - - /* - * no P2P scanning on passive or DFS channels. - */ - for (i = 0; i < request->n_channels; i++) { - struct ieee80211_channel *chan = request->channels[i]; - - if (chan->flags & (IEEE80211_CHAN_RADAR | - IEEE80211_CHAN_PASSIVE_SCAN)) - continue; - - chanspecs[i] = channel_to_chanspec(&p2p->cfg->d11inf, - chan); - brcmf_dbg(INFO, "%d: chan=%d, channel spec=%x\n", - num_nodfs, chan->hw_value, chanspecs[i]); - num_nodfs++; - } - err = brcmf_p2p_escan(p2p, num_nodfs, chanspecs, search_state, - action, P2PAPI_BSSCFG_DEVICE); - } -exit: - if (err) - brcmf_err("error (%d)\n", err); - return err; -} - - -/** - * brcmf_p2p_find_listen_channel() - find listen channel in ie string. - * - * @ie: string of information elements. - * @ie_len: length of string. - * - * Scan ie for p2p ie and look for attribute 6 channel. If available determine - * channel and return it. - */ -static s32 brcmf_p2p_find_listen_channel(const u8 *ie, u32 ie_len) -{ - u8 channel_ie[5]; - s32 listen_channel; - s32 err; - - err = cfg80211_get_p2p_attr(ie, ie_len, - IEEE80211_P2P_ATTR_LISTEN_CHANNEL, - channel_ie, sizeof(channel_ie)); - if (err < 0) - return err; - - /* listen channel subel length format: */ - /* 3(country) + 1(op. class) + 1(chan num) */ - listen_channel = (s32)channel_ie[3 + 1]; - - if (listen_channel == SOCIAL_CHAN_1 || - listen_channel == SOCIAL_CHAN_2 || - listen_channel == SOCIAL_CHAN_3) { - brcmf_dbg(INFO, "Found my Listen Channel %d\n", listen_channel); - return listen_channel; - } - - return -EPERM; -} - - -/** - * brcmf_p2p_scan_prep() - prepare scan based on request. - * - * @wiphy: wiphy device. - * @request: scan request from cfg80211. - * @vif: vif on which scan request is to be executed. - * - * Prepare the scan appropriately for type of scan requested. Overrides the - * escan .run() callback for peer-to-peer scanning. - */ -int brcmf_p2p_scan_prep(struct wiphy *wiphy, - struct cfg80211_scan_request *request, - struct brcmf_cfg80211_vif *vif) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_p2p_info *p2p = &cfg->p2p; - int err = 0; - - if (brcmf_p2p_scan_is_p2p_request(request)) { - /* find my listen channel */ - err = brcmf_p2p_find_listen_channel(request->ie, - request->ie_len); - if (err < 0) - return err; - - p2p->afx_hdl.my_listen_chan = err; - - clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); - brcmf_dbg(INFO, "P2P: GO_NEG_PHASE status cleared\n"); - - err = brcmf_p2p_enable_discovery(p2p); - if (err) - return err; - - vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; - - /* override .run_escan() callback. */ - cfg->escan_info.run = brcmf_p2p_run_escan; - } - err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_PRBREQ_FLAG, - request->ie, request->ie_len); - return err; -} - - -/** - * brcmf_p2p_discover_listen() - set firmware to discover listen state. - * - * @p2p: p2p device. - * @channel: channel nr for discover listen. - * @duration: time in ms to stay on channel. - * - */ -static s32 -brcmf_p2p_discover_listen(struct brcmf_p2p_info *p2p, u16 channel, u32 duration) -{ - struct brcmf_cfg80211_vif *vif; - struct brcmu_chan ch; - s32 err = 0; - - vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; - if (!vif) { - brcmf_err("Discovery is not set, so we have nothing to do\n"); - err = -EPERM; - goto exit; - } - - if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status)) { - brcmf_err("Previous LISTEN is not completed yet\n"); - /* WAR: prevent cookie mismatch in wpa_supplicant return OK */ - goto exit; - } - - ch.chnum = channel; - ch.bw = BRCMU_CHAN_BW_20; - p2p->cfg->d11inf.encchspec(&ch); - err = brcmf_p2p_set_discover_state(vif->ifp, WL_P2P_DISC_ST_LISTEN, - ch.chspec, (u16)duration); - if (!err) { - set_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status); - p2p->remain_on_channel_cookie++; - } -exit: - return err; -} - - -/** - * brcmf_p2p_remain_on_channel() - put device on channel and stay there. - * - * @wiphy: wiphy device. - * @channel: channel to stay on. - * @duration: time in ms to remain on channel. - * - */ -int brcmf_p2p_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev, - struct ieee80211_channel *channel, - unsigned int duration, u64 *cookie) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_p2p_info *p2p = &cfg->p2p; - s32 err; - u16 channel_nr; - - channel_nr = ieee80211_frequency_to_channel(channel->center_freq); - brcmf_dbg(TRACE, "Enter, channel: %d, duration ms (%d)\n", channel_nr, - duration); - - err = brcmf_p2p_enable_discovery(p2p); - if (err) - goto exit; - err = brcmf_p2p_discover_listen(p2p, channel_nr, duration); - if (err) - goto exit; - - memcpy(&p2p->remain_on_channel, channel, sizeof(*channel)); - *cookie = p2p->remain_on_channel_cookie; - cfg80211_ready_on_channel(wdev, *cookie, channel, duration, GFP_KERNEL); - -exit: - return err; -} - - -/** - * brcmf_p2p_notify_listen_complete() - p2p listen has completed. - * - * @ifp: interfac control. - * @e: event message. Not used, to make it usable for fweh event dispatcher. - * @data: payload of message. Not used. - * - */ -int brcmf_p2p_notify_listen_complete(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, - void *data) -{ - struct brcmf_cfg80211_info *cfg = ifp->drvr->config; - struct brcmf_p2p_info *p2p = &cfg->p2p; - - brcmf_dbg(TRACE, "Enter\n"); - if (test_and_clear_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, - &p2p->status)) { - if (test_and_clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN, - &p2p->status)) { - clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, - &p2p->status); - brcmf_dbg(INFO, "Listen DONE, wake up wait_next_af\n"); - complete(&p2p->wait_next_af); - } - - cfg80211_remain_on_channel_expired(&ifp->vif->wdev, - p2p->remain_on_channel_cookie, - &p2p->remain_on_channel, - GFP_KERNEL); - } - return 0; -} - - -/** - * brcmf_p2p_cancel_remain_on_channel() - cancel p2p listen state. - * - * @ifp: interfac control. - * - */ -void brcmf_p2p_cancel_remain_on_channel(struct brcmf_if *ifp) -{ - if (!ifp) - return; - brcmf_p2p_set_discover_state(ifp, WL_P2P_DISC_ST_SCAN, 0, 0); - brcmf_p2p_notify_listen_complete(ifp, NULL, NULL); -} - - -/** - * brcmf_p2p_act_frm_search() - search function for action frame. - * - * @p2p: p2p device. - * channel: channel on which action frame is to be trasmitted. - * - * search function to reach at common channel to send action frame. When - * channel is 0 then all social channels will be used to send af - */ -static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel) -{ - s32 err; - u32 channel_cnt; - u16 *default_chan_list; - u32 i; - struct brcmu_chan ch; - - brcmf_dbg(TRACE, "Enter\n"); - - if (channel) - channel_cnt = AF_PEER_SEARCH_CNT; - else - channel_cnt = SOCIAL_CHAN_CNT; - default_chan_list = kzalloc(channel_cnt * sizeof(*default_chan_list), - GFP_KERNEL); - if (default_chan_list == NULL) { - brcmf_err("channel list allocation failed\n"); - err = -ENOMEM; - goto exit; - } - ch.bw = BRCMU_CHAN_BW_20; - if (channel) { - ch.chnum = channel; - p2p->cfg->d11inf.encchspec(&ch); - /* insert same channel to the chan_list */ - for (i = 0; i < channel_cnt; i++) - default_chan_list[i] = ch.chspec; - } else { - ch.chnum = SOCIAL_CHAN_1; - p2p->cfg->d11inf.encchspec(&ch); - default_chan_list[0] = ch.chspec; - ch.chnum = SOCIAL_CHAN_2; - p2p->cfg->d11inf.encchspec(&ch); - default_chan_list[1] = ch.chspec; - ch.chnum = SOCIAL_CHAN_3; - p2p->cfg->d11inf.encchspec(&ch); - default_chan_list[2] = ch.chspec; - } - err = brcmf_p2p_escan(p2p, channel_cnt, default_chan_list, - WL_P2P_DISC_ST_SEARCH, WL_ESCAN_ACTION_START, - P2PAPI_BSSCFG_DEVICE); - kfree(default_chan_list); -exit: - return err; -} - - -/** - * brcmf_p2p_afx_handler() - afx worker thread. - * - * @work: - * - */ -static void brcmf_p2p_afx_handler(struct work_struct *work) -{ - struct afx_hdl *afx_hdl = container_of(work, struct afx_hdl, afx_work); - struct brcmf_p2p_info *p2p = container_of(afx_hdl, - struct brcmf_p2p_info, - afx_hdl); - s32 err; - - if (!afx_hdl->is_active) - return; - - if (afx_hdl->is_listen && afx_hdl->my_listen_chan) - /* 100ms ~ 300ms */ - err = brcmf_p2p_discover_listen(p2p, afx_hdl->my_listen_chan, - 100 * (1 + prandom_u32() % 3)); - else - err = brcmf_p2p_act_frm_search(p2p, afx_hdl->peer_listen_chan); - - if (err) { - brcmf_err("ERROR occurred! value is (%d)\n", err); - if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, - &p2p->status)) - complete(&afx_hdl->act_frm_scan); - } -} - - -/** - * brcmf_p2p_af_searching_channel() - search channel. - * - * @p2p: p2p device info struct. - * - */ -static s32 brcmf_p2p_af_searching_channel(struct brcmf_p2p_info *p2p) -{ - struct afx_hdl *afx_hdl = &p2p->afx_hdl; - struct brcmf_cfg80211_vif *pri_vif; - unsigned long duration; - s32 retry; - - brcmf_dbg(TRACE, "Enter\n"); - - pri_vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; - - INIT_COMPLETION(afx_hdl->act_frm_scan); - set_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status); - afx_hdl->is_active = true; - afx_hdl->peer_chan = P2P_INVALID_CHANNEL; - - /* Loop to wait until we find a peer's channel or the - * pending action frame tx is cancelled. - */ - retry = 0; - duration = msecs_to_jiffies(P2P_AF_FRM_SCAN_MAX_WAIT); - while ((retry < P2P_CHANNEL_SYNC_RETRY) && - (afx_hdl->peer_chan == P2P_INVALID_CHANNEL)) { - afx_hdl->is_listen = false; - brcmf_dbg(TRACE, "Scheduling action frame for sending.. (%d)\n", - retry); - /* search peer on peer's listen channel */ - schedule_work(&afx_hdl->afx_work); - wait_for_completion_timeout(&afx_hdl->act_frm_scan, duration); - if ((afx_hdl->peer_chan != P2P_INVALID_CHANNEL) || - (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, - &p2p->status))) - break; - - if (afx_hdl->my_listen_chan) { - brcmf_dbg(TRACE, "Scheduling listen peer, channel=%d\n", - afx_hdl->my_listen_chan); - /* listen on my listen channel */ - afx_hdl->is_listen = true; - schedule_work(&afx_hdl->afx_work); - wait_for_completion_timeout(&afx_hdl->act_frm_scan, - duration); - } - if ((afx_hdl->peer_chan != P2P_INVALID_CHANNEL) || - (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, - &p2p->status))) - break; - retry++; - - /* if sta is connected or connecting, sleep for a while before - * retry af tx or finding a peer - */ - if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &pri_vif->sme_state) || - test_bit(BRCMF_VIF_STATUS_CONNECTING, &pri_vif->sme_state)) - msleep(P2P_DEFAULT_SLEEP_TIME_VSDB); - } - - brcmf_dbg(TRACE, "Completed search/listen peer_chan=%d\n", - afx_hdl->peer_chan); - afx_hdl->is_active = false; - - clear_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status); - - return afx_hdl->peer_chan; -} - - -/** - * brcmf_p2p_scan_finding_common_channel() - was escan used for finding channel - * - * @cfg: common configuration struct. - * @bi: bss info struct, result from scan. - * - */ -bool brcmf_p2p_scan_finding_common_channel(struct brcmf_cfg80211_info *cfg, - struct brcmf_bss_info_le *bi) - -{ - struct brcmf_p2p_info *p2p = &cfg->p2p; - struct afx_hdl *afx_hdl = &p2p->afx_hdl; - struct brcmu_chan ch; - u8 *ie; - s32 err; - u8 p2p_dev_addr[ETH_ALEN]; - - if (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status)) - return false; - - if (bi == NULL) { - brcmf_dbg(TRACE, "ACTION FRAME SCAN Done\n"); - if (afx_hdl->peer_chan == P2P_INVALID_CHANNEL) - complete(&afx_hdl->act_frm_scan); - return true; - } - - ie = ((u8 *)bi) + le16_to_cpu(bi->ie_offset); - memset(p2p_dev_addr, 0, sizeof(p2p_dev_addr)); - err = cfg80211_get_p2p_attr(ie, le32_to_cpu(bi->ie_length), - IEEE80211_P2P_ATTR_DEVICE_INFO, - p2p_dev_addr, sizeof(p2p_dev_addr)); - if (err < 0) - err = cfg80211_get_p2p_attr(ie, le32_to_cpu(bi->ie_length), - IEEE80211_P2P_ATTR_DEVICE_ID, - p2p_dev_addr, sizeof(p2p_dev_addr)); - if ((err >= 0) && - (!memcmp(p2p_dev_addr, afx_hdl->tx_dst_addr, ETH_ALEN))) { - if (!bi->ctl_ch) { - ch.chspec = le16_to_cpu(bi->chanspec); - cfg->d11inf.decchspec(&ch); - bi->ctl_ch = ch.chnum; - } - afx_hdl->peer_chan = bi->ctl_ch; - brcmf_dbg(TRACE, "ACTION FRAME SCAN : Peer %pM found, channel : %d\n", - afx_hdl->tx_dst_addr, afx_hdl->peer_chan); - complete(&afx_hdl->act_frm_scan); - } - return true; -} - -/** - * brcmf_p2p_stop_wait_next_action_frame() - finish scan if af tx complete. - * - * @cfg: common configuration struct. - * - */ -static void -brcmf_p2p_stop_wait_next_action_frame(struct brcmf_cfg80211_info *cfg) -{ - struct brcmf_p2p_info *p2p = &cfg->p2p; - struct brcmf_if *ifp = cfg->escan_info.ifp; - - if (test_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status) && - (test_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status) || - test_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status))) { - brcmf_dbg(TRACE, "*** Wake UP ** abort actframe iovar\n"); - /* if channel is not zero, "actfame" uses off channel scan. - * So abort scan for off channel completion. - */ - if (p2p->af_sent_channel) - brcmf_notify_escan_complete(cfg, ifp, true, true); - } else if (test_bit(BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN, - &p2p->status)) { - brcmf_dbg(TRACE, "*** Wake UP ** abort listen for next af frame\n"); - /* So abort scan to cancel listen */ - brcmf_notify_escan_complete(cfg, ifp, true, true); - } -} - - -/** - * brcmf_p2p_gon_req_collision() - Check if go negotiaton collission - * - * @p2p: p2p device info struct. - * - * return true if recevied action frame is to be dropped. - */ -static bool -brcmf_p2p_gon_req_collision(struct brcmf_p2p_info *p2p, u8 *mac) -{ - struct brcmf_cfg80211_info *cfg = p2p->cfg; - struct brcmf_if *ifp; - - brcmf_dbg(TRACE, "Enter\n"); - - if (!test_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status) || - !p2p->gon_req_action) - return false; - - brcmf_dbg(TRACE, "GO Negotiation Request COLLISION !!!\n"); - /* if sa(peer) addr is less than da(my) addr, then this device - * process peer's gon request and block to send gon req. - * if not (sa addr > da addr), - * this device will process gon request and drop gon req of peer. - */ - ifp = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif->ifp; - if (memcmp(mac, ifp->mac_addr, ETH_ALEN) < 0) { - brcmf_dbg(INFO, "Block transmit gon req !!!\n"); - p2p->block_gon_req_tx = true; - /* if we are finding a common channel for sending af, - * do not scan more to block to send current gon req - */ - if (test_and_clear_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, - &p2p->status)) - complete(&p2p->afx_hdl.act_frm_scan); - if (test_and_clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, - &p2p->status)) - brcmf_p2p_stop_wait_next_action_frame(cfg); - return false; - } - - /* drop gon request of peer to process gon request by this device. */ - brcmf_dbg(INFO, "Drop received gon req !!!\n"); - - return true; -} - - -/** - * brcmf_p2p_notify_action_frame_rx() - received action frame. - * - * @ifp: interfac control. - * @e: event message. Not used, to make it usable for fweh event dispatcher. - * @data: payload of message, containing action frame data. - * - */ -int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, - void *data) -{ - struct brcmf_cfg80211_info *cfg = ifp->drvr->config; - struct brcmf_p2p_info *p2p = &cfg->p2p; - struct afx_hdl *afx_hdl = &p2p->afx_hdl; - struct wireless_dev *wdev; - u32 mgmt_frame_len = e->datalen - sizeof(struct brcmf_rx_mgmt_data); - struct brcmf_rx_mgmt_data *rxframe = (struct brcmf_rx_mgmt_data *)data; - u8 *frame = (u8 *)(rxframe + 1); - struct brcmf_p2p_pub_act_frame *act_frm; - struct brcmf_p2psd_gas_pub_act_frame *sd_act_frm; - struct brcmu_chan ch; - struct ieee80211_mgmt *mgmt_frame; - s32 freq; - u16 mgmt_type; - u8 action; - - ch.chspec = be16_to_cpu(rxframe->chanspec); - cfg->d11inf.decchspec(&ch); - /* Check if wpa_supplicant has registered for this frame */ - brcmf_dbg(INFO, "ifp->vif->mgmt_rx_reg %04x\n", ifp->vif->mgmt_rx_reg); - mgmt_type = (IEEE80211_STYPE_ACTION & IEEE80211_FCTL_STYPE) >> 4; - if ((ifp->vif->mgmt_rx_reg & BIT(mgmt_type)) == 0) - return 0; - - brcmf_p2p_print_actframe(false, frame, mgmt_frame_len); - - action = P2P_PAF_SUBTYPE_INVALID; - if (brcmf_p2p_is_pub_action(frame, mgmt_frame_len)) { - act_frm = (struct brcmf_p2p_pub_act_frame *)frame; - action = act_frm->subtype; - if ((action == P2P_PAF_GON_REQ) && - (brcmf_p2p_gon_req_collision(p2p, (u8 *)e->addr))) { - if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, - &p2p->status) && - (memcmp(afx_hdl->tx_dst_addr, e->addr, - ETH_ALEN) == 0)) { - afx_hdl->peer_chan = ch.chnum; - brcmf_dbg(INFO, "GON request: Peer found, channel=%d\n", - afx_hdl->peer_chan); - complete(&afx_hdl->act_frm_scan); - } - return 0; - } - /* After complete GO Negotiation, roll back to mpc mode */ - if ((action == P2P_PAF_GON_CONF) || - (action == P2P_PAF_PROVDIS_RSP)) - brcmf_set_mpc(ifp, 1); - if (action == P2P_PAF_GON_CONF) { - brcmf_dbg(TRACE, "P2P: GO_NEG_PHASE status cleared\n"); - clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); - } - } else if (brcmf_p2p_is_gas_action(frame, mgmt_frame_len)) { - sd_act_frm = (struct brcmf_p2psd_gas_pub_act_frame *)frame; - action = sd_act_frm->action; - } - - if (test_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status) && - (p2p->next_af_subtype == action)) { - brcmf_dbg(TRACE, "We got a right next frame! (%d)\n", action); - clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, - &p2p->status); - /* Stop waiting for next AF. */ - brcmf_p2p_stop_wait_next_action_frame(cfg); - } - - mgmt_frame = kzalloc(offsetof(struct ieee80211_mgmt, u) + - mgmt_frame_len, GFP_KERNEL); - if (!mgmt_frame) { - brcmf_err("No memory available for action frame\n"); - return -ENOMEM; - } - memcpy(mgmt_frame->da, ifp->mac_addr, ETH_ALEN); - brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSSID, mgmt_frame->bssid, - ETH_ALEN); - memcpy(mgmt_frame->sa, e->addr, ETH_ALEN); - mgmt_frame->frame_control = cpu_to_le16(IEEE80211_STYPE_ACTION); - memcpy(&mgmt_frame->u, frame, mgmt_frame_len); - mgmt_frame_len += offsetof(struct ieee80211_mgmt, u); - - freq = ieee80211_channel_to_frequency(ch.chnum, - ch.band == BRCMU_CHAN_BAND_2G ? - IEEE80211_BAND_2GHZ : - IEEE80211_BAND_5GHZ); - - wdev = &ifp->vif->wdev; - cfg80211_rx_mgmt(wdev, freq, 0, (u8 *)mgmt_frame, mgmt_frame_len, - GFP_ATOMIC); - - kfree(mgmt_frame); - return 0; -} - - -/** - * brcmf_p2p_notify_action_tx_complete() - transmit action frame complete - * - * @ifp: interfac control. - * @e: event message. Not used, to make it usable for fweh event dispatcher. - * @data: not used. - * - */ -int brcmf_p2p_notify_action_tx_complete(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, - void *data) -{ - struct brcmf_cfg80211_info *cfg = ifp->drvr->config; - struct brcmf_p2p_info *p2p = &cfg->p2p; - - brcmf_dbg(INFO, "Enter: event %s, status=%d\n", - e->event_code == BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE ? - "ACTION_FRAME_OFF_CHAN_COMPLETE" : "ACTION_FRAME_COMPLETE", - e->status); - - if (!test_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status)) - return 0; - - if (e->event_code == BRCMF_E_ACTION_FRAME_COMPLETE) { - if (e->status == BRCMF_E_STATUS_SUCCESS) - set_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, - &p2p->status); - else { - set_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status); - /* If there is no ack, we don't need to wait for - * WLC_E_ACTION_FRAME_OFFCHAN_COMPLETE event - */ - brcmf_p2p_stop_wait_next_action_frame(cfg); - } - - } else { - complete(&p2p->send_af_done); - } - return 0; -} - - -/** - * brcmf_p2p_tx_action_frame() - send action frame over fil. - * - * @p2p: p2p info struct for vif. - * @af_params: action frame data/info. - * - * Send an action frame immediately without doing channel synchronization. - * - * This function waits for a completion event before returning. - * The WLC_E_ACTION_FRAME_COMPLETE event will be received when the action - * frame is transmitted. - */ -static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p, - struct brcmf_fil_af_params_le *af_params) -{ - struct brcmf_cfg80211_vif *vif; - s32 err = 0; - s32 timeout = 0; - - brcmf_dbg(TRACE, "Enter\n"); - - INIT_COMPLETION(p2p->send_af_done); - clear_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status); - clear_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status); - - vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; - err = brcmf_fil_bsscfg_data_set(vif->ifp, "actframe", af_params, - sizeof(*af_params)); - if (err) { - brcmf_err(" sending action frame has failed\n"); - goto exit; - } - - p2p->af_sent_channel = le32_to_cpu(af_params->channel); - p2p->af_tx_sent_jiffies = jiffies; - - timeout = wait_for_completion_timeout(&p2p->send_af_done, - msecs_to_jiffies(P2P_AF_MAX_WAIT_TIME)); - - if (test_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status)) { - brcmf_dbg(TRACE, "TX action frame operation is success\n"); - } else { - err = -EIO; - brcmf_dbg(TRACE, "TX action frame operation has failed\n"); - } - /* clear status bit for action tx */ - clear_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, &p2p->status); - clear_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status); - -exit: - return err; -} - - -/** - * brcmf_p2p_pub_af_tx() - public action frame tx routine. - * - * @cfg: driver private data for cfg80211 interface. - * @af_params: action frame data/info. - * @config_af_params: configuration data for action frame. - * - * routine which transmits ation frame public type. - */ -static s32 brcmf_p2p_pub_af_tx(struct brcmf_cfg80211_info *cfg, - struct brcmf_fil_af_params_le *af_params, - struct brcmf_config_af_params *config_af_params) -{ - struct brcmf_p2p_info *p2p = &cfg->p2p; - struct brcmf_fil_action_frame_le *action_frame; - struct brcmf_p2p_pub_act_frame *act_frm; - s32 err = 0; - u16 ie_len; - - action_frame = &af_params->action_frame; - act_frm = (struct brcmf_p2p_pub_act_frame *)(action_frame->data); - - config_af_params->extra_listen = true; - - switch (act_frm->subtype) { - case P2P_PAF_GON_REQ: - brcmf_dbg(TRACE, "P2P: GO_NEG_PHASE status set\n"); - set_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); - config_af_params->mpc_onoff = 0; - config_af_params->search_channel = true; - p2p->next_af_subtype = act_frm->subtype + 1; - p2p->gon_req_action = true; - /* increase dwell time to wait for RESP frame */ - af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME); - break; - case P2P_PAF_GON_RSP: - p2p->next_af_subtype = act_frm->subtype + 1; - /* increase dwell time to wait for CONF frame */ - af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME); - break; - case P2P_PAF_GON_CONF: - /* If we reached till GO Neg confirmation reset the filter */ - brcmf_dbg(TRACE, "P2P: GO_NEG_PHASE status cleared\n"); - clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); - /* turn on mpc again if go nego is done */ - config_af_params->mpc_onoff = 1; - /* minimize dwell time */ - af_params->dwell_time = cpu_to_le32(P2P_AF_MIN_DWELL_TIME); - config_af_params->extra_listen = false; - break; - case P2P_PAF_INVITE_REQ: - config_af_params->search_channel = true; - p2p->next_af_subtype = act_frm->subtype + 1; - /* increase dwell time */ - af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME); - break; - case P2P_PAF_INVITE_RSP: - /* minimize dwell time */ - af_params->dwell_time = cpu_to_le32(P2P_AF_MIN_DWELL_TIME); - config_af_params->extra_listen = false; - break; - case P2P_PAF_DEVDIS_REQ: - config_af_params->search_channel = true; - p2p->next_af_subtype = act_frm->subtype + 1; - /* maximize dwell time to wait for RESP frame */ - af_params->dwell_time = cpu_to_le32(P2P_AF_LONG_DWELL_TIME); - break; - case P2P_PAF_DEVDIS_RSP: - /* minimize dwell time */ - af_params->dwell_time = cpu_to_le32(P2P_AF_MIN_DWELL_TIME); - config_af_params->extra_listen = false; - break; - case P2P_PAF_PROVDIS_REQ: - ie_len = le16_to_cpu(action_frame->len) - - offsetof(struct brcmf_p2p_pub_act_frame, elts); - if (cfg80211_get_p2p_attr(&act_frm->elts[0], ie_len, - IEEE80211_P2P_ATTR_GROUP_ID, - NULL, 0) < 0) - config_af_params->search_channel = true; - config_af_params->mpc_onoff = 0; - p2p->next_af_subtype = act_frm->subtype + 1; - /* increase dwell time to wait for RESP frame */ - af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME); - break; - case P2P_PAF_PROVDIS_RSP: - /* wpa_supplicant send go nego req right after prov disc */ - p2p->next_af_subtype = P2P_PAF_GON_REQ; - /* increase dwell time to MED level */ - af_params->dwell_time = cpu_to_le32(P2P_AF_MED_DWELL_TIME); - config_af_params->extra_listen = false; - break; - default: - brcmf_err("Unknown p2p pub act frame subtype: %d\n", - act_frm->subtype); - err = -EINVAL; - } - return err; -} - -/** - * brcmf_p2p_send_action_frame() - send action frame . - * - * @cfg: driver private data for cfg80211 interface. - * @ndev: net device to transmit on. - * @af_params: configuration data for action frame. - */ -bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg, - struct net_device *ndev, - struct brcmf_fil_af_params_le *af_params) -{ - struct brcmf_p2p_info *p2p = &cfg->p2p; - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_fil_action_frame_le *action_frame; - struct brcmf_config_af_params config_af_params; - struct afx_hdl *afx_hdl = &p2p->afx_hdl; - u16 action_frame_len; - bool ack = false; - u8 category; - u8 action; - s32 tx_retry; - s32 extra_listen_time; - uint delta_ms; - - action_frame = &af_params->action_frame; - action_frame_len = le16_to_cpu(action_frame->len); - - brcmf_p2p_print_actframe(true, action_frame->data, action_frame_len); - - /* Add the default dwell time. Dwell time to stay off-channel */ - /* to wait for a response action frame after transmitting an */ - /* GO Negotiation action frame */ - af_params->dwell_time = cpu_to_le32(P2P_AF_DWELL_TIME); - - category = action_frame->data[DOT11_ACTION_CAT_OFF]; - action = action_frame->data[DOT11_ACTION_ACT_OFF]; - - /* initialize variables */ - p2p->next_af_subtype = P2P_PAF_SUBTYPE_INVALID; - p2p->gon_req_action = false; - - /* config parameters */ - config_af_params.mpc_onoff = -1; - config_af_params.search_channel = false; - config_af_params.extra_listen = false; - - if (brcmf_p2p_is_pub_action(action_frame->data, action_frame_len)) { - /* p2p public action frame process */ - if (brcmf_p2p_pub_af_tx(cfg, af_params, &config_af_params)) { - /* Just send unknown subtype frame with */ - /* default parameters. */ - brcmf_err("P2P Public action frame, unknown subtype.\n"); - } - } else if (brcmf_p2p_is_gas_action(action_frame->data, - action_frame_len)) { - /* service discovery process */ - if (action == P2PSD_ACTION_ID_GAS_IREQ || - action == P2PSD_ACTION_ID_GAS_CREQ) { - /* configure service discovery query frame */ - config_af_params.search_channel = true; - - /* save next af suptype to cancel */ - /* remaining dwell time */ - p2p->next_af_subtype = action + 1; - - af_params->dwell_time = - cpu_to_le32(P2P_AF_MED_DWELL_TIME); - } else if (action == P2PSD_ACTION_ID_GAS_IRESP || - action == P2PSD_ACTION_ID_GAS_CRESP) { - /* configure service discovery response frame */ - af_params->dwell_time = - cpu_to_le32(P2P_AF_MIN_DWELL_TIME); - } else { - brcmf_err("Unknown action type: %d\n", action); - goto exit; - } - } else if (brcmf_p2p_is_p2p_action(action_frame->data, - action_frame_len)) { - /* do not configure anything. it will be */ - /* sent with a default configuration */ - } else { - brcmf_err("Unknown Frame: category 0x%x, action 0x%x\n", - category, action); - return false; - } - - /* if connecting on primary iface, sleep for a while before sending - * af tx for VSDB - */ - if (test_bit(BRCMF_VIF_STATUS_CONNECTING, - &p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->sme_state)) - msleep(50); - - /* if scan is ongoing, abort current scan. */ - if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) - brcmf_abort_scanning(cfg); - - memcpy(afx_hdl->tx_dst_addr, action_frame->da, ETH_ALEN); - - /* To make sure to send successfully action frame, turn off mpc */ - if (config_af_params.mpc_onoff == 0) - brcmf_set_mpc(ifp, 0); - - /* set status and destination address before sending af */ - if (p2p->next_af_subtype != P2P_PAF_SUBTYPE_INVALID) { - /* set status to cancel the remained dwell time in rx process */ - set_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status); - } - - p2p->af_sent_channel = 0; - set_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status); - /* validate channel and p2p ies */ - if (config_af_params.search_channel && - IS_P2P_SOCIAL_CHANNEL(le32_to_cpu(af_params->channel)) && - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif->saved_ie.probe_req_ie_len) { - afx_hdl = &p2p->afx_hdl; - afx_hdl->peer_listen_chan = le32_to_cpu(af_params->channel); - - if (brcmf_p2p_af_searching_channel(p2p) == - P2P_INVALID_CHANNEL) { - brcmf_err("Couldn't find peer's channel.\n"); - goto exit; - } - - /* Abort scan even for VSDB scenarios. Scan gets aborted in - * firmware but after the check of piggyback algorithm. To take - * care of current piggback algo, lets abort the scan here - * itself. - */ - brcmf_notify_escan_complete(cfg, ifp, true, true); - - /* update channel */ - af_params->channel = cpu_to_le32(afx_hdl->peer_chan); - } - - tx_retry = 0; - while (!p2p->block_gon_req_tx && - (ack == false) && (tx_retry < P2P_AF_TX_MAX_RETRY)) { - ack = !brcmf_p2p_tx_action_frame(p2p, af_params); - tx_retry++; - } - if (ack == false) { - brcmf_err("Failed to send Action Frame(retry %d)\n", tx_retry); - clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); - } - -exit: - clear_bit(BRCMF_P2P_STATUS_SENDING_ACT_FRAME, &p2p->status); - - /* WAR: sometimes dongle does not keep the dwell time of 'actframe'. - * if we coundn't get the next action response frame and dongle does - * not keep the dwell time, go to listen state again to get next action - * response frame. - */ - if (ack && config_af_params.extra_listen && !p2p->block_gon_req_tx && - test_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status) && - p2p->af_sent_channel == afx_hdl->my_listen_chan) { - delta_ms = jiffies_to_msecs(jiffies - p2p->af_tx_sent_jiffies); - if (le32_to_cpu(af_params->dwell_time) > delta_ms) - extra_listen_time = le32_to_cpu(af_params->dwell_time) - - delta_ms; - else - extra_listen_time = 0; - if (extra_listen_time > 50) { - set_bit(BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN, - &p2p->status); - brcmf_dbg(INFO, "Wait more time! actual af time:%d, calculated extra listen:%d\n", - le32_to_cpu(af_params->dwell_time), - extra_listen_time); - extra_listen_time += 100; - if (!brcmf_p2p_discover_listen(p2p, - p2p->af_sent_channel, - extra_listen_time)) { - unsigned long duration; - - extra_listen_time += 100; - duration = msecs_to_jiffies(extra_listen_time); - wait_for_completion_timeout(&p2p->wait_next_af, - duration); - } - clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN, - &p2p->status); - } - } - - if (p2p->block_gon_req_tx) { - /* if ack is true, supplicant will wait more time(100ms). - * so we will return it as a success to get more time . - */ - p2p->block_gon_req_tx = false; - ack = true; - } - - clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status); - /* if all done, turn mpc on again */ - if (config_af_params.mpc_onoff == 1) - brcmf_set_mpc(ifp, 1); - - return ack; -} - -/** - * brcmf_p2p_notify_rx_mgmt_p2p_probereq() - Event handler for p2p probe req. - * - * @ifp: interface pointer for which event was received. - * @e: even message. - * @data: payload of event message (probe request). - */ -s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, - void *data) -{ - struct brcmf_cfg80211_info *cfg = ifp->drvr->config; - struct brcmf_p2p_info *p2p = &cfg->p2p; - struct afx_hdl *afx_hdl = &p2p->afx_hdl; - struct brcmf_cfg80211_vif *vif = ifp->vif; - struct brcmf_rx_mgmt_data *rxframe = (struct brcmf_rx_mgmt_data *)data; - u16 chanspec = be16_to_cpu(rxframe->chanspec); - struct brcmu_chan ch; - u8 *mgmt_frame; - u32 mgmt_frame_len; - s32 freq; - u16 mgmt_type; - - brcmf_dbg(INFO, "Enter: event %d reason %d\n", e->event_code, - e->reason); - - ch.chspec = be16_to_cpu(rxframe->chanspec); - cfg->d11inf.decchspec(&ch); - - if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status) && - (memcmp(afx_hdl->tx_dst_addr, e->addr, ETH_ALEN) == 0)) { - afx_hdl->peer_chan = ch.chnum; - brcmf_dbg(INFO, "PROBE REQUEST: Peer found, channel=%d\n", - afx_hdl->peer_chan); - complete(&afx_hdl->act_frm_scan); - } - - /* Firmware sends us two proberesponses for each idx one. At the */ - /* moment anything but bsscfgidx 0 is passed up to supplicant */ - if (e->bsscfgidx == 0) - return 0; - - /* Filter any P2P probe reqs arriving during the GO-NEG Phase */ - if (test_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status)) { - brcmf_dbg(INFO, "Filtering P2P probe_req in GO-NEG phase\n"); - return 0; - } - - /* Check if wpa_supplicant has registered for this frame */ - brcmf_dbg(INFO, "vif->mgmt_rx_reg %04x\n", vif->mgmt_rx_reg); - mgmt_type = (IEEE80211_STYPE_PROBE_REQ & IEEE80211_FCTL_STYPE) >> 4; - if ((vif->mgmt_rx_reg & BIT(mgmt_type)) == 0) - return 0; - - mgmt_frame = (u8 *)(rxframe + 1); - mgmt_frame_len = e->datalen - sizeof(*rxframe); - freq = ieee80211_channel_to_frequency(ch.chnum, - ch.band == BRCMU_CHAN_BAND_2G ? - IEEE80211_BAND_2GHZ : - IEEE80211_BAND_5GHZ); - - cfg80211_rx_mgmt(&vif->wdev, freq, 0, mgmt_frame, mgmt_frame_len, - GFP_ATOMIC); - - brcmf_dbg(INFO, "mgmt_frame_len (%d) , e->datalen (%d), chanspec (%04x), freq (%d)\n", - mgmt_frame_len, e->datalen, chanspec, freq); - - return 0; -} - - -/** - * brcmf_p2p_attach() - attach for P2P. - * - * @cfg: driver private data for cfg80211 interface. - */ -s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg) -{ - struct brcmf_if *pri_ifp; - struct brcmf_if *p2p_ifp; - struct brcmf_cfg80211_vif *p2p_vif; - struct brcmf_p2p_info *p2p; - struct brcmf_pub *drvr; - s32 bssidx; - s32 err = 0; - - p2p = &cfg->p2p; - p2p->cfg = cfg; - - drvr = cfg->pub; - - pri_ifp = drvr->iflist[0]; - p2p_ifp = drvr->iflist[1]; - - p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif; - - if (p2p_ifp) { - p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE, - false); - if (IS_ERR(p2p_vif)) { - brcmf_err("could not create discovery vif\n"); - err = -ENOMEM; - goto exit; - } - - p2p_vif->ifp = p2p_ifp; - p2p_ifp->vif = p2p_vif; - p2p_vif->wdev.netdev = p2p_ifp->ndev; - p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev; - SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy)); - - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif; - - brcmf_p2p_generate_bss_mac(p2p, NULL); - memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN); - brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr); - - /* Initialize P2P Discovery in the firmware */ - err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1); - if (err < 0) { - brcmf_err("set p2p_disc error\n"); - brcmf_free_vif(cfg, p2p_vif); - goto exit; - } - /* obtain bsscfg index for P2P discovery */ - err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx); - if (err < 0) { - brcmf_err("retrieving discover bsscfg index failed\n"); - brcmf_free_vif(cfg, p2p_vif); - goto exit; - } - /* Verify that firmware uses same bssidx as driver !! */ - if (p2p_ifp->bssidx != bssidx) { - brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n", - bssidx, p2p_ifp->bssidx); - brcmf_free_vif(cfg, p2p_vif); - goto exit; - } - - init_completion(&p2p->send_af_done); - INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler); - init_completion(&p2p->afx_hdl.act_frm_scan); - init_completion(&p2p->wait_next_af); - } -exit: - return err; -} - - -/** - * brcmf_p2p_detach() - detach P2P. - * - * @p2p: P2P specific data. - */ -void brcmf_p2p_detach(struct brcmf_p2p_info *p2p) -{ - struct brcmf_cfg80211_vif *vif; - - vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif; - if (vif != NULL) { - brcmf_p2p_cancel_remain_on_channel(vif->ifp); - brcmf_p2p_deinit_discovery(p2p); - /* remove discovery interface */ - brcmf_free_vif(p2p->cfg, vif); - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; - } - /* just set it all to zero */ - memset(p2p, 0, sizeof(*p2p)); -} - -/** - * brcmf_p2p_get_current_chanspec() - Get current operation channel. - * - * @p2p: P2P specific data. - * @chanspec: chanspec to be returned. - */ -static void brcmf_p2p_get_current_chanspec(struct brcmf_p2p_info *p2p, - u16 *chanspec) -{ - struct brcmf_if *ifp; - u8 mac_addr[ETH_ALEN]; - struct brcmu_chan ch; - struct brcmf_bss_info_le *bi; - u8 *buf; - - ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; - - if (brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSSID, mac_addr, - ETH_ALEN) == 0) { - buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); - if (buf != NULL) { - *(__le32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX); - if (brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, - buf, WL_BSS_INFO_MAX) == 0) { - bi = (struct brcmf_bss_info_le *)(buf + 4); - *chanspec = le16_to_cpu(bi->chanspec); - kfree(buf); - return; - } - kfree(buf); - } - } - /* Use default channel for P2P */ - ch.chnum = BRCMF_P2P_TEMP_CHAN; - ch.bw = BRCMU_CHAN_BW_20; - p2p->cfg->d11inf.encchspec(&ch); - *chanspec = ch.chspec; -} - -/** - * Change a P2P Role. - * Parameters: - * @mac: MAC address of the BSS to change a role - * Returns 0 if success. - */ -int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg, - enum brcmf_fil_p2p_if_types if_type) -{ - struct brcmf_p2p_info *p2p = &cfg->p2p; - struct brcmf_cfg80211_vif *vif; - struct brcmf_fil_p2p_if_le if_request; - s32 err; - u16 chanspec; - - brcmf_dbg(TRACE, "Enter\n"); - - vif = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; - if (!vif) { - brcmf_err("vif for P2PAPI_BSSCFG_PRIMARY does not exist\n"); - return -EPERM; - } - brcmf_notify_escan_complete(cfg, vif->ifp, true, true); - vif = p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif; - if (!vif) { - brcmf_err("vif for P2PAPI_BSSCFG_CONNECTION does not exist\n"); - return -EPERM; - } - brcmf_set_mpc(vif->ifp, 0); - - /* In concurrency case, STA may be already associated in a particular */ - /* channel. so retrieve the current channel of primary interface and */ - /* then start the virtual interface on that. */ - brcmf_p2p_get_current_chanspec(p2p, &chanspec); - - if_request.type = cpu_to_le16((u16)if_type); - if_request.chspec = cpu_to_le16(chanspec); - memcpy(if_request.addr, p2p->int_addr, sizeof(if_request.addr)); - - brcmf_cfg80211_arm_vif_event(cfg, vif); - err = brcmf_fil_iovar_data_set(vif->ifp, "p2p_ifupd", &if_request, - sizeof(if_request)); - if (err) { - brcmf_err("p2p_ifupd FAILED, err=%d\n", err); - brcmf_cfg80211_arm_vif_event(cfg, NULL); - return err; - } - err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_CHANGE, - msecs_to_jiffies(1500)); - brcmf_cfg80211_arm_vif_event(cfg, NULL); - if (!err) { - brcmf_err("No BRCMF_E_IF_CHANGE event received\n"); - return -EIO; - } - - err = brcmf_fil_cmd_int_set(vif->ifp, BRCMF_C_SET_SCB_TIMEOUT, - BRCMF_SCB_TIMEOUT_VALUE); - - return err; -} - -static int brcmf_p2p_request_p2p_if(struct brcmf_p2p_info *p2p, - struct brcmf_if *ifp, u8 ea[ETH_ALEN], - enum brcmf_fil_p2p_if_types iftype) -{ - struct brcmf_fil_p2p_if_le if_request; - int err; - u16 chanspec; - - /* we need a default channel */ - brcmf_p2p_get_current_chanspec(p2p, &chanspec); - - /* fill the firmware request */ - memcpy(if_request.addr, ea, ETH_ALEN); - if_request.type = cpu_to_le16((u16)iftype); - if_request.chspec = cpu_to_le16(chanspec); - - err = brcmf_fil_iovar_data_set(ifp, "p2p_ifadd", &if_request, - sizeof(if_request)); - if (err) - return err; - - return err; -} - -static int brcmf_p2p_disable_p2p_if(struct brcmf_cfg80211_vif *vif) -{ - struct brcmf_cfg80211_info *cfg = wdev_to_cfg(&vif->wdev); - struct net_device *pri_ndev = cfg_to_ndev(cfg); - struct brcmf_if *ifp = netdev_priv(pri_ndev); - u8 *addr = vif->wdev.netdev->dev_addr; - - return brcmf_fil_iovar_data_set(ifp, "p2p_ifdis", addr, ETH_ALEN); -} - -static int brcmf_p2p_release_p2p_if(struct brcmf_cfg80211_vif *vif) -{ - struct brcmf_cfg80211_info *cfg = wdev_to_cfg(&vif->wdev); - struct net_device *pri_ndev = cfg_to_ndev(cfg); - struct brcmf_if *ifp = netdev_priv(pri_ndev); - u8 *addr = vif->wdev.netdev->dev_addr; - - return brcmf_fil_iovar_data_set(ifp, "p2p_ifdel", addr, ETH_ALEN); -} - -/** - * brcmf_p2p_create_p2pdev() - create a P2P_DEVICE virtual interface. - * - * @p2p: P2P specific data. - * @wiphy: wiphy device of new interface. - * @addr: mac address for this new interface. - */ -static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p, - struct wiphy *wiphy, - u8 *addr) -{ - struct brcmf_cfg80211_vif *p2p_vif; - struct brcmf_if *p2p_ifp; - struct brcmf_if *pri_ifp; - int err; - u32 bssidx; - - if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif) - return ERR_PTR(-ENOSPC); - - p2p_vif = brcmf_alloc_vif(p2p->cfg, NL80211_IFTYPE_P2P_DEVICE, - false); - if (IS_ERR(p2p_vif)) { - brcmf_err("could not create discovery vif\n"); - return (struct wireless_dev *)p2p_vif; - } - - pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; - brcmf_p2p_generate_bss_mac(p2p, addr); - brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr); - - brcmf_cfg80211_arm_vif_event(p2p->cfg, p2p_vif); - - /* Initialize P2P Discovery in the firmware */ - err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1); - if (err < 0) { - brcmf_err("set p2p_disc error\n"); - brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL); - goto fail; - } - - /* wait for firmware event */ - err = brcmf_cfg80211_wait_vif_event_timeout(p2p->cfg, BRCMF_E_IF_ADD, - msecs_to_jiffies(1500)); - brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL); - if (!err) { - brcmf_err("timeout occurred\n"); - err = -EIO; - goto fail; - } - - /* discovery interface created */ - p2p_ifp = p2p_vif->ifp; - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif; - memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN); - memcpy(&p2p_vif->wdev.address, p2p->dev_addr, sizeof(p2p->dev_addr)); - - /* verify bsscfg index for P2P discovery */ - err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx); - if (err < 0) { - brcmf_err("retrieving discover bsscfg index failed\n"); - goto fail; - } - - WARN_ON(p2p_ifp->bssidx != bssidx); - - init_completion(&p2p->send_af_done); - INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler); - init_completion(&p2p->afx_hdl.act_frm_scan); - init_completion(&p2p->wait_next_af); - - return &p2p_vif->wdev; - -fail: - brcmf_free_vif(p2p->cfg, p2p_vif); - return ERR_PTR(err); -} - -/** - * brcmf_p2p_delete_p2pdev() - delete P2P_DEVICE virtual interface. - * - * @vif: virtual interface object to delete. - */ -static void brcmf_p2p_delete_p2pdev(struct brcmf_cfg80211_info *cfg, - struct brcmf_cfg80211_vif *vif) -{ - cfg80211_unregister_wdev(&vif->wdev); - cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; - brcmf_free_vif(cfg, vif); -} - -/** - * brcmf_p2p_free_p2p_if() - free up net device related data. - * - * @ndev: net device that needs to be freed. - */ -static void brcmf_p2p_free_p2p_if(struct net_device *ndev) -{ - struct brcmf_cfg80211_info *cfg; - struct brcmf_cfg80211_vif *vif; - struct brcmf_if *ifp; - - ifp = netdev_priv(ndev); - cfg = ifp->drvr->config; - vif = ifp->vif; - - brcmf_free_vif(cfg, vif); - free_netdev(ifp->ndev); -} - -/** - * brcmf_p2p_add_vif() - create a new P2P virtual interface. - * - * @wiphy: wiphy device of new interface. - * @name: name of the new interface. - * @type: nl80211 interface type. - * @flags: not used. - * @params: contains mac address for P2P device. - */ -struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); - struct brcmf_cfg80211_vif *vif; - enum brcmf_fil_p2p_if_types iftype; - enum wl_mode mode; - int err; - - if (brcmf_cfg80211_vif_event_armed(cfg)) - return ERR_PTR(-EBUSY); - - brcmf_dbg(INFO, "adding vif \"%s\" (type=%d)\n", name, type); - - switch (type) { - case NL80211_IFTYPE_P2P_CLIENT: - iftype = BRCMF_FIL_P2P_IF_CLIENT; - mode = WL_MODE_BSS; - break; - case NL80211_IFTYPE_P2P_GO: - iftype = BRCMF_FIL_P2P_IF_GO; - mode = WL_MODE_AP; - break; - case NL80211_IFTYPE_P2P_DEVICE: - return brcmf_p2p_create_p2pdev(&cfg->p2p, wiphy, - params->macaddr); - default: - return ERR_PTR(-EOPNOTSUPP); - } - - vif = brcmf_alloc_vif(cfg, type, false); - if (IS_ERR(vif)) - return (struct wireless_dev *)vif; - brcmf_cfg80211_arm_vif_event(cfg, vif); - - err = brcmf_p2p_request_p2p_if(&cfg->p2p, ifp, cfg->p2p.int_addr, - iftype); - if (err) { - brcmf_cfg80211_arm_vif_event(cfg, NULL); - goto fail; - } - - /* wait for firmware event */ - err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_ADD, - msecs_to_jiffies(1500)); - brcmf_cfg80211_arm_vif_event(cfg, NULL); - if (!err) { - brcmf_err("timeout occurred\n"); - err = -EIO; - goto fail; - } - - /* interface created in firmware */ - ifp = vif->ifp; - if (!ifp) { - brcmf_err("no if pointer provided\n"); - err = -ENOENT; - goto fail; - } - - strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1); - err = brcmf_net_attach(ifp, true); - if (err) { - brcmf_err("Registering netdevice failed\n"); - goto fail; - } - /* override destructor */ - ifp->ndev->destructor = brcmf_p2p_free_p2p_if; - - cfg->p2p.bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = vif; - /* Disable firmware roaming for P2P interface */ - brcmf_fil_iovar_int_set(ifp, "roam_off", 1); - if (iftype == BRCMF_FIL_P2P_IF_GO) { - /* set station timeout for p2p */ - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCB_TIMEOUT, - BRCMF_SCB_TIMEOUT_VALUE); - } - return &ifp->vif->wdev; - -fail: - brcmf_free_vif(cfg, vif); - return ERR_PTR(err); -} - -/** - * brcmf_p2p_del_vif() - delete a P2P virtual interface. - * - * @wiphy: wiphy device of interface. - * @wdev: wireless device of interface. - * - * TODO: not yet supported. - */ -int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) -{ - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); - struct brcmf_p2p_info *p2p = &cfg->p2p; - struct brcmf_cfg80211_vif *vif; - unsigned long jiffie_timeout = msecs_to_jiffies(1500); - bool wait_for_disable = false; - int err; - - brcmf_dbg(TRACE, "delete P2P vif\n"); - vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev); - - switch (vif->wdev.iftype) { - case NL80211_IFTYPE_P2P_CLIENT: - if (test_bit(BRCMF_VIF_STATUS_DISCONNECTING, &vif->sme_state)) - wait_for_disable = true; - break; - - case NL80211_IFTYPE_P2P_GO: - if (!brcmf_p2p_disable_p2p_if(vif)) - wait_for_disable = true; - break; - - case NL80211_IFTYPE_P2P_DEVICE: - brcmf_p2p_delete_p2pdev(cfg, vif); - return 0; - default: - return -ENOTSUPP; - break; - } - - clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); - brcmf_dbg(INFO, "P2P: GO_NEG_PHASE status cleared\n"); - - if (wait_for_disable) - wait_for_completion_timeout(&cfg->vif_disabled, - msecs_to_jiffies(500)); - - brcmf_vif_clear_mgmt_ies(vif); - - brcmf_cfg80211_arm_vif_event(cfg, vif); - err = brcmf_p2p_release_p2p_if(vif); - if (!err) { - /* wait for firmware event */ - err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_DEL, - jiffie_timeout); - if (!err) - err = -EIO; - else - err = 0; - } - brcmf_cfg80211_arm_vif_event(cfg, NULL); - p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL; - - return err; -} - -int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_p2p_info *p2p = &cfg->p2p; - struct brcmf_cfg80211_vif *vif; - int err; - - vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev); - mutex_lock(&cfg->usr_sync); - err = brcmf_p2p_enable_discovery(p2p); - if (!err) - set_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state); - mutex_unlock(&cfg->usr_sync); - return err; -} - -void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_p2p_info *p2p = &cfg->p2p; - struct brcmf_cfg80211_vif *vif; - - vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev); - mutex_lock(&cfg->usr_sync); - (void)brcmf_p2p_deinit_discovery(p2p); - brcmf_abort_scanning(cfg); - clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state); - mutex_unlock(&cfg->usr_sync); -} diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h deleted file mode 100644 index 6821b26224be..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2012 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef WL_CFGP2P_H_ -#define WL_CFGP2P_H_ - -#include - -struct brcmf_cfg80211_info; - -/** - * enum p2p_bss_type - different type of BSS configurations. - * - * @P2PAPI_BSSCFG_PRIMARY: maps to driver's primary bsscfg. - * @P2PAPI_BSSCFG_DEVICE: maps to driver's P2P device discovery bsscfg. - * @P2PAPI_BSSCFG_CONNECTION: maps to driver's P2P connection bsscfg. - * @P2PAPI_BSSCFG_MAX: used for range checking. - */ -enum p2p_bss_type { - P2PAPI_BSSCFG_PRIMARY, /* maps to driver's primary bsscfg */ - P2PAPI_BSSCFG_DEVICE, /* maps to driver's P2P device discovery bsscfg */ - P2PAPI_BSSCFG_CONNECTION, /* maps to driver's P2P connection bsscfg */ - P2PAPI_BSSCFG_MAX -}; - -/** - * struct p2p_bss - peer-to-peer bss related information. - * - * @vif: virtual interface of this P2P bss. - * @private_data: TBD - */ -struct p2p_bss { - struct brcmf_cfg80211_vif *vif; - void *private_data; -}; - -/** - * enum brcmf_p2p_status - P2P specific dongle status. - * - * @BRCMF_P2P_STATUS_IF_ADD: peer-to-peer vif add sent to dongle. - * @BRCMF_P2P_STATUS_IF_DEL: NOT-USED? - * @BRCMF_P2P_STATUS_IF_DELETING: peer-to-peer vif delete sent to dongle. - * @BRCMF_P2P_STATUS_IF_CHANGING: peer-to-peer vif change sent to dongle. - * @BRCMF_P2P_STATUS_IF_CHANGED: peer-to-peer vif change completed on dongle. - * @BRCMF_P2P_STATUS_ACTION_TX_COMPLETED: action frame tx completed. - * @BRCMF_P2P_STATUS_ACTION_TX_NOACK: action frame tx not acked. - * @BRCMF_P2P_STATUS_GO_NEG_PHASE: P2P GO negotiation ongoing. - * @BRCMF_P2P_STATUS_DISCOVER_LISTEN: P2P listen, remaining on channel. - * @BRCMF_P2P_STATUS_SENDING_ACT_FRAME: In the process of sending action frame. - * @BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN: extra listen time for af tx. - * @BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME: waiting for action frame response. - * @BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL: search channel for AF active. - */ -enum brcmf_p2p_status { - BRCMF_P2P_STATUS_ENABLED, - BRCMF_P2P_STATUS_IF_ADD, - BRCMF_P2P_STATUS_IF_DEL, - BRCMF_P2P_STATUS_IF_DELETING, - BRCMF_P2P_STATUS_IF_CHANGING, - BRCMF_P2P_STATUS_IF_CHANGED, - BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, - BRCMF_P2P_STATUS_ACTION_TX_NOACK, - BRCMF_P2P_STATUS_GO_NEG_PHASE, - BRCMF_P2P_STATUS_DISCOVER_LISTEN, - BRCMF_P2P_STATUS_SENDING_ACT_FRAME, - BRCMF_P2P_STATUS_WAITING_NEXT_AF_LISTEN, - BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, - BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL -}; - -/** - * struct afx_hdl - action frame off channel storage. - * - * @afx_work: worker thread for searching channel - * @act_frm_scan: thread synchronizing struct. - * @is_active: channel searching active. - * @peer_chan: current channel. - * @is_listen: sets mode for afx worker. - * @my_listen_chan: this peers listen channel. - * @peer_listen_chan: remote peers listen channel. - * @tx_dst_addr: mac address where tx af should be sent to. - */ -struct afx_hdl { - struct work_struct afx_work; - struct completion act_frm_scan; - bool is_active; - s32 peer_chan; - bool is_listen; - u16 my_listen_chan; - u16 peer_listen_chan; - u8 tx_dst_addr[ETH_ALEN]; -}; - -/** - * struct brcmf_p2p_info - p2p specific driver information. - * - * @cfg: driver private data for cfg80211 interface. - * @status: status of P2P (see enum brcmf_p2p_status). - * @dev_addr: P2P device address. - * @int_addr: P2P interface address. - * @bss_idx: informate for P2P bss types. - * @listen_timer: timer for @WL_P2P_DISC_ST_LISTEN discover state. - * @ssid: ssid for P2P GO. - * @listen_channel: channel for @WL_P2P_DISC_ST_LISTEN discover state. - * @remain_on_channel: contains copy of struct used by cfg80211. - * @remain_on_channel_cookie: cookie counter for remain on channel cmd - * @next_af_subtype: expected action frame subtype. - * @send_af_done: indication that action frame tx is complete. - * @afx_hdl: action frame search handler info. - * @af_sent_channel: channel action frame is sent. - * @af_tx_sent_jiffies: jiffies time when af tx was transmitted. - * @wait_next_af: thread synchronizing struct. - * @gon_req_action: about to send go negotiation requets frame. - * @block_gon_req_tx: drop tx go negotiation requets frame. - */ -struct brcmf_p2p_info { - struct brcmf_cfg80211_info *cfg; - unsigned long status; - u8 dev_addr[ETH_ALEN]; - u8 int_addr[ETH_ALEN]; - struct p2p_bss bss_idx[P2PAPI_BSSCFG_MAX]; - struct timer_list listen_timer; - struct brcmf_ssid ssid; - u8 listen_channel; - struct ieee80211_channel remain_on_channel; - u32 remain_on_channel_cookie; - u8 next_af_subtype; - struct completion send_af_done; - struct afx_hdl afx_hdl; - u32 af_sent_channel; - unsigned long af_tx_sent_jiffies; - struct completion wait_next_af; - bool gon_req_action; - bool block_gon_req_tx; -}; - -s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg); -void brcmf_p2p_detach(struct brcmf_p2p_info *p2p); -struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params); -int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev); -int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg, - enum brcmf_fil_p2p_if_types if_type); -int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev); -void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev); -int brcmf_p2p_scan_prep(struct wiphy *wiphy, - struct cfg80211_scan_request *request, - struct brcmf_cfg80211_vif *vif); -int brcmf_p2p_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev, - struct ieee80211_channel *channel, - unsigned int duration, u64 *cookie); -int brcmf_p2p_notify_listen_complete(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, - void *data); -void brcmf_p2p_cancel_remain_on_channel(struct brcmf_if *ifp); -int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, - void *data); -int brcmf_p2p_notify_action_tx_complete(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, - void *data); -bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg, - struct net_device *ndev, - struct brcmf_fil_af_params_le *af_params); -bool brcmf_p2p_scan_finding_common_channel(struct brcmf_cfg80211_info *cfg, - struct brcmf_bss_info_le *bi); -s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, - void *data); -#endif /* WL_CFGP2P_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c deleted file mode 100644 index ca72177388b9..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.c +++ /dev/null @@ -1,955 +0,0 @@ -/* - * Copyright (c) 2011 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* ***** SDIO interface chip backplane handle functions ***** */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include "dhd_dbg.h" -#include "sdio_host.h" -#include "sdio_chip.h" - -/* chip core base & ramsize */ -/* bcm4329 */ -/* SDIO device core, ID 0x829 */ -#define BCM4329_CORE_BUS_BASE 0x18011000 -/* internal memory core, ID 0x80e */ -#define BCM4329_CORE_SOCRAM_BASE 0x18003000 -/* ARM Cortex M3 core, ID 0x82a */ -#define BCM4329_CORE_ARM_BASE 0x18002000 -#define BCM4329_RAMSIZE 0x48000 - -/* bcm43143 */ -/* SDIO device core */ -#define BCM43143_CORE_BUS_BASE 0x18002000 -/* internal memory core */ -#define BCM43143_CORE_SOCRAM_BASE 0x18004000 -/* ARM Cortex M3 core, ID 0x82a */ -#define BCM43143_CORE_ARM_BASE 0x18003000 -#define BCM43143_RAMSIZE 0x70000 - -#define SBCOREREV(sbidh) \ - ((((sbidh) & SSB_IDHIGH_RCHI) >> SSB_IDHIGH_RCHI_SHIFT) | \ - ((sbidh) & SSB_IDHIGH_RCLO)) - -/* SOC Interconnect types (aka chip types) */ -#define SOCI_SB 0 -#define SOCI_AI 1 - -/* EROM CompIdentB */ -#define CIB_REV_MASK 0xff000000 -#define CIB_REV_SHIFT 24 - -/* ARM CR4 core specific control flag bits */ -#define ARMCR4_BCMA_IOCTL_CPUHALT 0x0020 - -#define SDIOD_DRVSTR_KEY(chip, pmu) (((chip) << 16) | (pmu)) -/* SDIO Pad drive strength to select value mappings */ -struct sdiod_drive_str { - u8 strength; /* Pad Drive Strength in mA */ - u8 sel; /* Chip-specific select value */ -}; -/* SDIO Drive Strength to sel value table for PMU Rev 11 (1.8V) */ -static const struct sdiod_drive_str sdiod_drvstr_tab1_1v8[] = { - {32, 0x6}, - {26, 0x7}, - {22, 0x4}, - {16, 0x5}, - {12, 0x2}, - {8, 0x3}, - {4, 0x0}, - {0, 0x1} -}; - -/* SDIO Drive Strength to sel value table for 43143 PMU Rev 17 (3.3V) */ -static const struct sdiod_drive_str sdiod_drvstr_tab2_3v3[] = { - {16, 0x7}, - {12, 0x5}, - {8, 0x3}, - {4, 0x1} -}; - -u8 -brcmf_sdio_chip_getinfidx(struct chip_info *ci, u16 coreid) -{ - u8 idx; - - for (idx = 0; idx < BRCMF_MAX_CORENUM; idx++) - if (coreid == ci->c_inf[idx].id) - return idx; - - return BRCMF_MAX_CORENUM; -} - -static u32 -brcmf_sdio_sb_corerev(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, u16 coreid) -{ - u32 regdata; - u8 idx; - - idx = brcmf_sdio_chip_getinfidx(ci, coreid); - - regdata = brcmf_sdio_regrl(sdiodev, - CORE_SB(ci->c_inf[idx].base, sbidhigh), - NULL); - return SBCOREREV(regdata); -} - -static u32 -brcmf_sdio_ai_corerev(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, u16 coreid) -{ - u8 idx; - - idx = brcmf_sdio_chip_getinfidx(ci, coreid); - - return (ci->c_inf[idx].cib & CIB_REV_MASK) >> CIB_REV_SHIFT; -} - -static bool -brcmf_sdio_sb_iscoreup(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, u16 coreid) -{ - u32 regdata; - u8 idx; - - idx = brcmf_sdio_chip_getinfidx(ci, coreid); - - regdata = brcmf_sdio_regrl(sdiodev, - CORE_SB(ci->c_inf[idx].base, sbtmstatelow), - NULL); - regdata &= (SSB_TMSLOW_RESET | SSB_TMSLOW_REJECT | - SSB_IMSTATE_REJECT | SSB_TMSLOW_CLOCK); - return (SSB_TMSLOW_CLOCK == regdata); -} - -static bool -brcmf_sdio_ai_iscoreup(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, u16 coreid) -{ - u32 regdata; - u8 idx; - bool ret; - - idx = brcmf_sdio_chip_getinfidx(ci, coreid); - - regdata = brcmf_sdio_regrl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL, - NULL); - ret = (regdata & (BCMA_IOCTL_FGC | BCMA_IOCTL_CLK)) == BCMA_IOCTL_CLK; - - regdata = brcmf_sdio_regrl(sdiodev, - ci->c_inf[idx].wrapbase+BCMA_RESET_CTL, - NULL); - ret = ret && ((regdata & BCMA_RESET_CTL_RESET) == 0); - - return ret; -} - -static void -brcmf_sdio_sb_coredisable(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, u16 coreid, u32 core_bits) -{ - u32 regdata, base; - u8 idx; - - idx = brcmf_sdio_chip_getinfidx(ci, coreid); - base = ci->c_inf[idx].base; - - regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbtmstatelow), NULL); - if (regdata & SSB_TMSLOW_RESET) - return; - - regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbtmstatelow), NULL); - if ((regdata & SSB_TMSLOW_CLOCK) != 0) { - /* - * set target reject and spin until busy is clear - * (preserve core-specific bits) - */ - regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbtmstatelow), - NULL); - brcmf_sdio_regwl(sdiodev, CORE_SB(base, sbtmstatelow), - regdata | SSB_TMSLOW_REJECT, NULL); - - regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbtmstatelow), - NULL); - udelay(1); - SPINWAIT((brcmf_sdio_regrl(sdiodev, - CORE_SB(base, sbtmstatehigh), - NULL) & - SSB_TMSHIGH_BUSY), 100000); - - regdata = brcmf_sdio_regrl(sdiodev, - CORE_SB(base, sbtmstatehigh), - NULL); - if (regdata & SSB_TMSHIGH_BUSY) - brcmf_err("core state still busy\n"); - - regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbidlow), - NULL); - if (regdata & SSB_IDLOW_INITIATOR) { - regdata = brcmf_sdio_regrl(sdiodev, - CORE_SB(base, sbimstate), - NULL); - regdata |= SSB_IMSTATE_REJECT; - brcmf_sdio_regwl(sdiodev, CORE_SB(base, sbimstate), - regdata, NULL); - regdata = brcmf_sdio_regrl(sdiodev, - CORE_SB(base, sbimstate), - NULL); - udelay(1); - SPINWAIT((brcmf_sdio_regrl(sdiodev, - CORE_SB(base, sbimstate), - NULL) & - SSB_IMSTATE_BUSY), 100000); - } - - /* set reset and reject while enabling the clocks */ - regdata = SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK | - SSB_TMSLOW_REJECT | SSB_TMSLOW_RESET; - brcmf_sdio_regwl(sdiodev, CORE_SB(base, sbtmstatelow), - regdata, NULL); - regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbtmstatelow), - NULL); - udelay(10); - - /* clear the initiator reject bit */ - regdata = brcmf_sdio_regrl(sdiodev, CORE_SB(base, sbidlow), - NULL); - if (regdata & SSB_IDLOW_INITIATOR) { - regdata = brcmf_sdio_regrl(sdiodev, - CORE_SB(base, sbimstate), - NULL); - regdata &= ~SSB_IMSTATE_REJECT; - brcmf_sdio_regwl(sdiodev, CORE_SB(base, sbimstate), - regdata, NULL); - } - } - - /* leave reset and reject asserted */ - brcmf_sdio_regwl(sdiodev, CORE_SB(base, sbtmstatelow), - (SSB_TMSLOW_REJECT | SSB_TMSLOW_RESET), NULL); - udelay(1); -} - -static void -brcmf_sdio_ai_coredisable(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, u16 coreid, u32 core_bits) -{ - u8 idx; - u32 regdata; - - idx = brcmf_sdio_chip_getinfidx(ci, coreid); - - /* if core is already in reset, just return */ - regdata = brcmf_sdio_regrl(sdiodev, - ci->c_inf[idx].wrapbase+BCMA_RESET_CTL, - NULL); - if ((regdata & BCMA_RESET_CTL_RESET) != 0) - return; - - /* ensure no pending backplane operation - * 300uc should be sufficient for backplane ops to be finish - * extra 10ms is taken into account for firmware load stage - * after 10300us carry on disabling the core anyway - */ - SPINWAIT(brcmf_sdio_regrl(sdiodev, - ci->c_inf[idx].wrapbase+BCMA_RESET_ST, - NULL), 10300); - regdata = brcmf_sdio_regrl(sdiodev, - ci->c_inf[idx].wrapbase+BCMA_RESET_ST, - NULL); - if (regdata) - brcmf_err("disabling core 0x%x with reset status %x\n", - coreid, regdata); - - brcmf_sdio_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_RESET_CTL, - BCMA_RESET_CTL_RESET, NULL); - udelay(1); - - brcmf_sdio_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL, - core_bits, NULL); - regdata = brcmf_sdio_regrl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL, - NULL); - usleep_range(10, 20); - -} - -static void -brcmf_sdio_sb_resetcore(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, u16 coreid, u32 core_bits) -{ - u32 regdata; - u8 idx; - - idx = brcmf_sdio_chip_getinfidx(ci, coreid); - - /* - * Must do the disable sequence first to work for - * arbitrary current core state. - */ - brcmf_sdio_sb_coredisable(sdiodev, ci, coreid, 0); - - /* - * Now do the initialization sequence. - * set reset while enabling the clock and - * forcing them on throughout the core - */ - brcmf_sdio_regwl(sdiodev, - CORE_SB(ci->c_inf[idx].base, sbtmstatelow), - SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK | SSB_TMSLOW_RESET, - NULL); - regdata = brcmf_sdio_regrl(sdiodev, - CORE_SB(ci->c_inf[idx].base, sbtmstatelow), - NULL); - udelay(1); - - /* clear any serror */ - regdata = brcmf_sdio_regrl(sdiodev, - CORE_SB(ci->c_inf[idx].base, sbtmstatehigh), - NULL); - if (regdata & SSB_TMSHIGH_SERR) - brcmf_sdio_regwl(sdiodev, - CORE_SB(ci->c_inf[idx].base, sbtmstatehigh), - 0, NULL); - - regdata = brcmf_sdio_regrl(sdiodev, - CORE_SB(ci->c_inf[idx].base, sbimstate), - NULL); - if (regdata & (SSB_IMSTATE_IBE | SSB_IMSTATE_TO)) - brcmf_sdio_regwl(sdiodev, - CORE_SB(ci->c_inf[idx].base, sbimstate), - regdata & ~(SSB_IMSTATE_IBE | SSB_IMSTATE_TO), - NULL); - - /* clear reset and allow it to propagate throughout the core */ - brcmf_sdio_regwl(sdiodev, CORE_SB(ci->c_inf[idx].base, sbtmstatelow), - SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK, NULL); - regdata = brcmf_sdio_regrl(sdiodev, - CORE_SB(ci->c_inf[idx].base, sbtmstatelow), - NULL); - udelay(1); - - /* leave clock enabled */ - brcmf_sdio_regwl(sdiodev, CORE_SB(ci->c_inf[idx].base, sbtmstatelow), - SSB_TMSLOW_CLOCK, NULL); - regdata = brcmf_sdio_regrl(sdiodev, - CORE_SB(ci->c_inf[idx].base, sbtmstatelow), - NULL); - udelay(1); -} - -static void -brcmf_sdio_ai_resetcore(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, u16 coreid, u32 core_bits) -{ - u8 idx; - u32 regdata; - - idx = brcmf_sdio_chip_getinfidx(ci, coreid); - - /* must disable first to work for arbitrary current core state */ - brcmf_sdio_ai_coredisable(sdiodev, ci, coreid, core_bits); - - /* now do initialization sequence */ - brcmf_sdio_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL, - core_bits | BCMA_IOCTL_FGC | BCMA_IOCTL_CLK, NULL); - regdata = brcmf_sdio_regrl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL, - NULL); - brcmf_sdio_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_RESET_CTL, - 0, NULL); - regdata = brcmf_sdio_regrl(sdiodev, - ci->c_inf[idx].wrapbase+BCMA_RESET_CTL, - NULL); - udelay(1); - - brcmf_sdio_regwl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL, - core_bits | BCMA_IOCTL_CLK, NULL); - regdata = brcmf_sdio_regrl(sdiodev, ci->c_inf[idx].wrapbase+BCMA_IOCTL, - NULL); - udelay(1); -} - -#ifdef DEBUG -/* safety check for chipinfo */ -static int brcmf_sdio_chip_cichk(struct chip_info *ci) -{ - u8 core_idx; - - /* check RAM core presence for ARM CM3 core */ - core_idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_ARM_CM3); - if (BRCMF_MAX_CORENUM != core_idx) { - core_idx = brcmf_sdio_chip_getinfidx(ci, - BCMA_CORE_INTERNAL_MEM); - if (BRCMF_MAX_CORENUM == core_idx) { - brcmf_err("RAM core not provided with ARM CM3 core\n"); - return -ENODEV; - } - } - - /* check RAM base for ARM CR4 core */ - core_idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_ARM_CR4); - if (BRCMF_MAX_CORENUM != core_idx) { - if (ci->rambase == 0) { - brcmf_err("RAM base not provided with ARM CR4 core\n"); - return -ENOMEM; - } - } - - return 0; -} -#else /* DEBUG */ -static inline int brcmf_sdio_chip_cichk(struct chip_info *ci) -{ - return 0; -} -#endif - -static int brcmf_sdio_chip_recognition(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, u32 regs) -{ - u32 regdata; - int ret; - - /* Get CC core rev - * Chipid is assume to be at offset 0 from regs arg - * For different chiptypes or old sdio hosts w/o chipcommon, - * other ways of recognition should be added here. - */ - ci->c_inf[0].id = BCMA_CORE_CHIPCOMMON; - ci->c_inf[0].base = regs; - regdata = brcmf_sdio_regrl(sdiodev, - CORE_CC_REG(ci->c_inf[0].base, chipid), - NULL); - ci->chip = regdata & CID_ID_MASK; - ci->chiprev = (regdata & CID_REV_MASK) >> CID_REV_SHIFT; - ci->socitype = (regdata & CID_TYPE_MASK) >> CID_TYPE_SHIFT; - - brcmf_dbg(INFO, "chipid=0x%x chiprev=%d\n", ci->chip, ci->chiprev); - - /* Address of cores for new chips should be added here */ - switch (ci->chip) { - case BCM43143_CHIP_ID: - ci->c_inf[0].wrapbase = ci->c_inf[0].base + 0x00100000; - ci->c_inf[0].cib = 0x2b000000; - ci->c_inf[1].id = BCMA_CORE_SDIO_DEV; - ci->c_inf[1].base = BCM43143_CORE_BUS_BASE; - ci->c_inf[1].wrapbase = ci->c_inf[1].base + 0x00100000; - ci->c_inf[1].cib = 0x18000000; - ci->c_inf[2].id = BCMA_CORE_INTERNAL_MEM; - ci->c_inf[2].base = BCM43143_CORE_SOCRAM_BASE; - ci->c_inf[2].wrapbase = ci->c_inf[2].base + 0x00100000; - ci->c_inf[2].cib = 0x14000000; - ci->c_inf[3].id = BCMA_CORE_ARM_CM3; - ci->c_inf[3].base = BCM43143_CORE_ARM_BASE; - ci->c_inf[3].wrapbase = ci->c_inf[3].base + 0x00100000; - ci->c_inf[3].cib = 0x07000000; - ci->ramsize = BCM43143_RAMSIZE; - break; - case BCM43241_CHIP_ID: - ci->c_inf[0].wrapbase = 0x18100000; - ci->c_inf[0].cib = 0x2a084411; - ci->c_inf[1].id = BCMA_CORE_SDIO_DEV; - ci->c_inf[1].base = 0x18002000; - ci->c_inf[1].wrapbase = 0x18102000; - ci->c_inf[1].cib = 0x0e004211; - ci->c_inf[2].id = BCMA_CORE_INTERNAL_MEM; - ci->c_inf[2].base = 0x18004000; - ci->c_inf[2].wrapbase = 0x18104000; - ci->c_inf[2].cib = 0x14080401; - ci->c_inf[3].id = BCMA_CORE_ARM_CM3; - ci->c_inf[3].base = 0x18003000; - ci->c_inf[3].wrapbase = 0x18103000; - ci->c_inf[3].cib = 0x07004211; - ci->ramsize = 0x90000; - break; - case BCM4329_CHIP_ID: - ci->c_inf[1].id = BCMA_CORE_SDIO_DEV; - ci->c_inf[1].base = BCM4329_CORE_BUS_BASE; - ci->c_inf[2].id = BCMA_CORE_INTERNAL_MEM; - ci->c_inf[2].base = BCM4329_CORE_SOCRAM_BASE; - ci->c_inf[3].id = BCMA_CORE_ARM_CM3; - ci->c_inf[3].base = BCM4329_CORE_ARM_BASE; - ci->ramsize = BCM4329_RAMSIZE; - break; - case BCM4330_CHIP_ID: - ci->c_inf[0].wrapbase = 0x18100000; - ci->c_inf[0].cib = 0x27004211; - ci->c_inf[1].id = BCMA_CORE_SDIO_DEV; - ci->c_inf[1].base = 0x18002000; - ci->c_inf[1].wrapbase = 0x18102000; - ci->c_inf[1].cib = 0x07004211; - ci->c_inf[2].id = BCMA_CORE_INTERNAL_MEM; - ci->c_inf[2].base = 0x18004000; - ci->c_inf[2].wrapbase = 0x18104000; - ci->c_inf[2].cib = 0x0d080401; - ci->c_inf[3].id = BCMA_CORE_ARM_CM3; - ci->c_inf[3].base = 0x18003000; - ci->c_inf[3].wrapbase = 0x18103000; - ci->c_inf[3].cib = 0x03004211; - ci->ramsize = 0x48000; - break; - case BCM4334_CHIP_ID: - ci->c_inf[0].wrapbase = 0x18100000; - ci->c_inf[0].cib = 0x29004211; - ci->c_inf[1].id = BCMA_CORE_SDIO_DEV; - ci->c_inf[1].base = 0x18002000; - ci->c_inf[1].wrapbase = 0x18102000; - ci->c_inf[1].cib = 0x0d004211; - ci->c_inf[2].id = BCMA_CORE_INTERNAL_MEM; - ci->c_inf[2].base = 0x18004000; - ci->c_inf[2].wrapbase = 0x18104000; - ci->c_inf[2].cib = 0x13080401; - ci->c_inf[3].id = BCMA_CORE_ARM_CM3; - ci->c_inf[3].base = 0x18003000; - ci->c_inf[3].wrapbase = 0x18103000; - ci->c_inf[3].cib = 0x07004211; - ci->ramsize = 0x80000; - break; - case BCM4335_CHIP_ID: - ci->c_inf[0].wrapbase = 0x18100000; - ci->c_inf[0].cib = 0x2b084411; - ci->c_inf[1].id = BCMA_CORE_SDIO_DEV; - ci->c_inf[1].base = 0x18005000; - ci->c_inf[1].wrapbase = 0x18105000; - ci->c_inf[1].cib = 0x0f004211; - ci->c_inf[2].id = BCMA_CORE_ARM_CR4; - ci->c_inf[2].base = 0x18002000; - ci->c_inf[2].wrapbase = 0x18102000; - ci->c_inf[2].cib = 0x01084411; - ci->ramsize = 0xc0000; - ci->rambase = 0x180000; - break; - default: - brcmf_err("chipid 0x%x is not supported\n", ci->chip); - return -ENODEV; - } - - ret = brcmf_sdio_chip_cichk(ci); - if (ret) - return ret; - - switch (ci->socitype) { - case SOCI_SB: - ci->iscoreup = brcmf_sdio_sb_iscoreup; - ci->corerev = brcmf_sdio_sb_corerev; - ci->coredisable = brcmf_sdio_sb_coredisable; - ci->resetcore = brcmf_sdio_sb_resetcore; - break; - case SOCI_AI: - ci->iscoreup = brcmf_sdio_ai_iscoreup; - ci->corerev = brcmf_sdio_ai_corerev; - ci->coredisable = brcmf_sdio_ai_coredisable; - ci->resetcore = brcmf_sdio_ai_resetcore; - break; - default: - brcmf_err("socitype %u not supported\n", ci->socitype); - return -ENODEV; - } - - return 0; -} - -static int -brcmf_sdio_chip_buscoreprep(struct brcmf_sdio_dev *sdiodev) -{ - int err = 0; - u8 clkval, clkset; - - /* Try forcing SDIO core to do ALPAvail request only */ - clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_ALP_AVAIL_REQ; - brcmf_sdio_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err); - if (err) { - brcmf_err("error writing for HT off\n"); - return err; - } - - /* If register supported, wait for ALPAvail and then force ALP */ - /* This may take up to 15 milliseconds */ - clkval = brcmf_sdio_regrb(sdiodev, - SBSDIO_FUNC1_CHIPCLKCSR, NULL); - - if ((clkval & ~SBSDIO_AVBITS) != clkset) { - brcmf_err("ChipClkCSR access: wrote 0x%02x read 0x%02x\n", - clkset, clkval); - return -EACCES; - } - - SPINWAIT(((clkval = brcmf_sdio_regrb(sdiodev, - SBSDIO_FUNC1_CHIPCLKCSR, NULL)), - !SBSDIO_ALPAV(clkval)), - PMU_MAX_TRANSITION_DLY); - if (!SBSDIO_ALPAV(clkval)) { - brcmf_err("timeout on ALPAV wait, clkval 0x%02x\n", - clkval); - return -EBUSY; - } - - clkset = SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_FORCE_ALP; - brcmf_sdio_regwb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, clkset, &err); - udelay(65); - - /* Also, disable the extra SDIO pull-ups */ - brcmf_sdio_regwb(sdiodev, SBSDIO_FUNC1_SDIOPULLUP, 0, NULL); - - return 0; -} - -static void -brcmf_sdio_chip_buscoresetup(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci) -{ - u32 base = ci->c_inf[0].base; - - /* get chipcommon rev */ - ci->c_inf[0].rev = ci->corerev(sdiodev, ci, ci->c_inf[0].id); - - /* get chipcommon capabilites */ - ci->c_inf[0].caps = brcmf_sdio_regrl(sdiodev, - CORE_CC_REG(base, capabilities), - NULL); - - /* get pmu caps & rev */ - if (ci->c_inf[0].caps & CC_CAP_PMU) { - ci->pmucaps = - brcmf_sdio_regrl(sdiodev, - CORE_CC_REG(base, pmucapabilities), - NULL); - ci->pmurev = ci->pmucaps & PCAP_REV_MASK; - } - - ci->c_inf[1].rev = ci->corerev(sdiodev, ci, ci->c_inf[1].id); - - brcmf_dbg(INFO, "ccrev=%d, pmurev=%d, buscore rev/type=%d/0x%x\n", - ci->c_inf[0].rev, ci->pmurev, - ci->c_inf[1].rev, ci->c_inf[1].id); - - /* - * Make sure any on-chip ARM is off (in case strapping is wrong), - * or downloaded code was already running. - */ - ci->coredisable(sdiodev, ci, BCMA_CORE_ARM_CM3, 0); -} - -int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev, - struct chip_info **ci_ptr, u32 regs) -{ - int ret; - struct chip_info *ci; - - brcmf_dbg(TRACE, "Enter\n"); - - /* alloc chip_info_t */ - ci = kzalloc(sizeof(struct chip_info), GFP_ATOMIC); - if (!ci) - return -ENOMEM; - - ret = brcmf_sdio_chip_buscoreprep(sdiodev); - if (ret != 0) - goto err; - - ret = brcmf_sdio_chip_recognition(sdiodev, ci, regs); - if (ret != 0) - goto err; - - brcmf_sdio_chip_buscoresetup(sdiodev, ci); - - brcmf_sdio_regwl(sdiodev, CORE_CC_REG(ci->c_inf[0].base, gpiopullup), - 0, NULL); - brcmf_sdio_regwl(sdiodev, CORE_CC_REG(ci->c_inf[0].base, gpiopulldown), - 0, NULL); - - *ci_ptr = ci; - return 0; - -err: - kfree(ci); - return ret; -} - -void -brcmf_sdio_chip_detach(struct chip_info **ci_ptr) -{ - brcmf_dbg(TRACE, "Enter\n"); - - kfree(*ci_ptr); - *ci_ptr = NULL; -} - -static char *brcmf_sdio_chip_name(uint chipid, char *buf, uint len) -{ - const char *fmt; - - fmt = ((chipid > 0xa000) || (chipid < 0x4000)) ? "%d" : "%x"; - snprintf(buf, len, fmt, chipid); - return buf; -} - -void -brcmf_sdio_chip_drivestrengthinit(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, u32 drivestrength) -{ - const struct sdiod_drive_str *str_tab = NULL; - u32 str_mask; - u32 str_shift; - char chn[8]; - u32 base = ci->c_inf[0].base; - u32 i; - u32 drivestrength_sel = 0; - u32 cc_data_temp; - u32 addr; - - if (!(ci->c_inf[0].caps & CC_CAP_PMU)) - return; - - switch (SDIOD_DRVSTR_KEY(ci->chip, ci->pmurev)) { - case SDIOD_DRVSTR_KEY(BCM4330_CHIP_ID, 12): - str_tab = sdiod_drvstr_tab1_1v8; - str_mask = 0x00003800; - str_shift = 11; - break; - case SDIOD_DRVSTR_KEY(BCM43143_CHIP_ID, 17): - /* note: 43143 does not support tristate */ - i = ARRAY_SIZE(sdiod_drvstr_tab2_3v3) - 1; - if (drivestrength >= sdiod_drvstr_tab2_3v3[i].strength) { - str_tab = sdiod_drvstr_tab2_3v3; - str_mask = 0x00000007; - str_shift = 0; - } else - brcmf_err("Invalid SDIO Drive strength for chip %s, strength=%d\n", - brcmf_sdio_chip_name(ci->chip, chn, 8), - drivestrength); - break; - default: - brcmf_err("No SDIO Drive strength init done for chip %s rev %d pmurev %d\n", - brcmf_sdio_chip_name(ci->chip, chn, 8), - ci->chiprev, ci->pmurev); - break; - } - - if (str_tab != NULL) { - for (i = 0; str_tab[i].strength != 0; i++) { - if (drivestrength >= str_tab[i].strength) { - drivestrength_sel = str_tab[i].sel; - break; - } - } - addr = CORE_CC_REG(base, chipcontrol_addr); - brcmf_sdio_regwl(sdiodev, addr, 1, NULL); - cc_data_temp = brcmf_sdio_regrl(sdiodev, addr, NULL); - cc_data_temp &= ~str_mask; - drivestrength_sel <<= str_shift; - cc_data_temp |= drivestrength_sel; - brcmf_sdio_regwl(sdiodev, addr, cc_data_temp, NULL); - - brcmf_dbg(INFO, "SDIO: %d mA (req=%d mA) drive strength selected, set to 0x%08x\n", - str_tab[i].strength, drivestrength, cc_data_temp); - } -} - -#ifdef DEBUG -static bool -brcmf_sdio_chip_verifynvram(struct brcmf_sdio_dev *sdiodev, u32 nvram_addr, - char *nvram_dat, uint nvram_sz) -{ - char *nvram_ularray; - int err; - bool ret = true; - - /* read back and verify */ - brcmf_dbg(INFO, "Compare NVRAM dl & ul; size=%d\n", nvram_sz); - nvram_ularray = kmalloc(nvram_sz, GFP_KERNEL); - /* do not proceed while no memory but */ - if (!nvram_ularray) - return true; - - /* Upload image to verify downloaded contents. */ - memset(nvram_ularray, 0xaa, nvram_sz); - - /* Read the vars list to temp buffer for comparison */ - err = brcmf_sdio_ramrw(sdiodev, false, nvram_addr, nvram_ularray, - nvram_sz); - if (err) { - brcmf_err("error %d on reading %d nvram bytes at 0x%08x\n", - err, nvram_sz, nvram_addr); - } else if (memcmp(nvram_dat, nvram_ularray, nvram_sz)) { - brcmf_err("Downloaded NVRAM image is corrupted\n"); - ret = false; - } - kfree(nvram_ularray); - - return ret; -} -#else /* DEBUG */ -static inline bool -brcmf_sdio_chip_verifynvram(struct brcmf_sdio_dev *sdiodev, u32 nvram_addr, - char *nvram_dat, uint nvram_sz) -{ - return true; -} -#endif /* DEBUG */ - -static bool brcmf_sdio_chip_writenvram(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, - char *nvram_dat, uint nvram_sz) -{ - int err; - u32 nvram_addr; - u32 token; - __le32 token_le; - - nvram_addr = (ci->ramsize - 4) - nvram_sz + ci->rambase; - - /* Write the vars list */ - err = brcmf_sdio_ramrw(sdiodev, true, nvram_addr, nvram_dat, nvram_sz); - if (err) { - brcmf_err("error %d on writing %d nvram bytes at 0x%08x\n", - err, nvram_sz, nvram_addr); - return false; - } - - if (!brcmf_sdio_chip_verifynvram(sdiodev, nvram_addr, - nvram_dat, nvram_sz)) - return false; - - /* generate token: - * nvram size, converted to words, in lower 16-bits, checksum - * in upper 16-bits. - */ - token = nvram_sz / 4; - token = (~token << 16) | (token & 0x0000FFFF); - token_le = cpu_to_le32(token); - - brcmf_dbg(INFO, "RAM size: %d\n", ci->ramsize); - brcmf_dbg(INFO, "nvram is placed at %d, size %d, token=0x%08x\n", - nvram_addr, nvram_sz, token); - - /* Write the length token to the last word */ - if (brcmf_sdio_ramrw(sdiodev, true, (ci->ramsize - 4 + ci->rambase), - (u8 *)&token_le, 4)) - return false; - - return true; -} - -static void -brcmf_sdio_chip_cm3_enterdl(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci) -{ - u32 zeros = 0; - - ci->coredisable(sdiodev, ci, BCMA_CORE_ARM_CM3, 0); - ci->resetcore(sdiodev, ci, BCMA_CORE_INTERNAL_MEM, 0); - - /* clear length token */ - brcmf_sdio_ramrw(sdiodev, true, ci->ramsize - 4, (u8 *)&zeros, 4); -} - -static bool -brcmf_sdio_chip_cm3_exitdl(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci, - char *nvram_dat, uint nvram_sz) -{ - u8 core_idx; - u32 reg_addr; - - if (!ci->iscoreup(sdiodev, ci, BCMA_CORE_INTERNAL_MEM)) { - brcmf_err("SOCRAM core is down after reset?\n"); - return false; - } - - if (!brcmf_sdio_chip_writenvram(sdiodev, ci, nvram_dat, nvram_sz)) - return false; - - /* clear all interrupts */ - core_idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_SDIO_DEV); - reg_addr = ci->c_inf[core_idx].base; - reg_addr += offsetof(struct sdpcmd_regs, intstatus); - brcmf_sdio_regwl(sdiodev, reg_addr, 0xFFFFFFFF, NULL); - - ci->resetcore(sdiodev, ci, BCMA_CORE_ARM_CM3, 0); - - return true; -} - -static inline void -brcmf_sdio_chip_cr4_enterdl(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci) -{ - ci->resetcore(sdiodev, ci, BCMA_CORE_ARM_CR4, - ARMCR4_BCMA_IOCTL_CPUHALT); -} - -static bool -brcmf_sdio_chip_cr4_exitdl(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci, - char *nvram_dat, uint nvram_sz) -{ - u8 core_idx; - u32 reg_addr; - - if (!brcmf_sdio_chip_writenvram(sdiodev, ci, nvram_dat, nvram_sz)) - return false; - - /* clear all interrupts */ - core_idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_SDIO_DEV); - reg_addr = ci->c_inf[core_idx].base; - reg_addr += offsetof(struct sdpcmd_regs, intstatus); - brcmf_sdio_regwl(sdiodev, reg_addr, 0xFFFFFFFF, NULL); - - /* Write reset vector to address 0 */ - brcmf_sdio_ramrw(sdiodev, true, 0, (void *)&ci->rst_vec, - sizeof(ci->rst_vec)); - - /* restore ARM */ - ci->resetcore(sdiodev, ci, BCMA_CORE_ARM_CR4, 0); - - return true; -} - -void brcmf_sdio_chip_enter_download(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci) -{ - u8 arm_core_idx; - - arm_core_idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_ARM_CM3); - if (BRCMF_MAX_CORENUM != arm_core_idx) { - brcmf_sdio_chip_cm3_enterdl(sdiodev, ci); - return; - } - - brcmf_sdio_chip_cr4_enterdl(sdiodev, ci); -} - -bool brcmf_sdio_chip_exit_download(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, char *nvram_dat, - uint nvram_sz) -{ - u8 arm_core_idx; - - arm_core_idx = brcmf_sdio_chip_getinfidx(ci, BCMA_CORE_ARM_CM3); - if (BRCMF_MAX_CORENUM != arm_core_idx) - return brcmf_sdio_chip_cm3_exitdl(sdiodev, ci, nvram_dat, - nvram_sz); - - return brcmf_sdio_chip_cr4_exitdl(sdiodev, ci, nvram_dat, nvram_sz); -} diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h b/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h deleted file mode 100644 index 83c041f1bf4a..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_chip.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2011 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCMFMAC_SDIO_CHIP_H_ -#define _BRCMFMAC_SDIO_CHIP_H_ - -/* - * Core reg address translation. - * Both macro's returns a 32 bits byte address on the backplane bus. - */ -#define CORE_CC_REG(base, field) \ - (base + offsetof(struct chipcregs, field)) -#define CORE_BUS_REG(base, field) \ - (base + offsetof(struct sdpcmd_regs, field)) -#define CORE_SB(base, field) \ - (base + SBCONFIGOFF + offsetof(struct sbconfig, field)) - -/* SDIO function 1 register CHIPCLKCSR */ -/* Force ALP request to backplane */ -#define SBSDIO_FORCE_ALP 0x01 -/* Force HT request to backplane */ -#define SBSDIO_FORCE_HT 0x02 -/* Force ILP request to backplane */ -#define SBSDIO_FORCE_ILP 0x04 -/* Make ALP ready (power up xtal) */ -#define SBSDIO_ALP_AVAIL_REQ 0x08 -/* Make HT ready (power up PLL) */ -#define SBSDIO_HT_AVAIL_REQ 0x10 -/* Squelch clock requests from HW */ -#define SBSDIO_FORCE_HW_CLKREQ_OFF 0x20 -/* Status: ALP is ready */ -#define SBSDIO_ALP_AVAIL 0x40 -/* Status: HT is ready */ -#define SBSDIO_HT_AVAIL 0x80 -#define SBSDIO_AVBITS (SBSDIO_HT_AVAIL | SBSDIO_ALP_AVAIL) -#define SBSDIO_ALPAV(regval) ((regval) & SBSDIO_AVBITS) -#define SBSDIO_HTAV(regval) (((regval) & SBSDIO_AVBITS) == SBSDIO_AVBITS) -#define SBSDIO_ALPONLY(regval) (SBSDIO_ALPAV(regval) && !SBSDIO_HTAV(regval)) -#define SBSDIO_CLKAV(regval, alponly) \ - (SBSDIO_ALPAV(regval) && (alponly ? 1 : SBSDIO_HTAV(regval))) - -#define BRCMF_MAX_CORENUM 6 - -struct chip_core_info { - u16 id; - u16 rev; - u32 base; - u32 wrapbase; - u32 caps; - u32 cib; -}; - -struct chip_info { - u32 chip; - u32 chiprev; - u32 socitype; - /* core info */ - /* always put chipcommon core at 0, bus core at 1 */ - struct chip_core_info c_inf[BRCMF_MAX_CORENUM]; - u32 pmurev; - u32 pmucaps; - u32 ramsize; - u32 rambase; - u32 rst_vec; /* reset vertor for ARM CR4 core */ - - bool (*iscoreup)(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci, - u16 coreid); - u32 (*corerev)(struct brcmf_sdio_dev *sdiodev, struct chip_info *ci, - u16 coreid); - void (*coredisable)(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, u16 coreid, u32 core_bits); - void (*resetcore)(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, u16 coreid, u32 core_bits); -}; - -struct sbconfig { - u32 PAD[2]; - u32 sbipsflag; /* initiator port ocp slave flag */ - u32 PAD[3]; - u32 sbtpsflag; /* target port ocp slave flag */ - u32 PAD[11]; - u32 sbtmerrloga; /* (sonics >= 2.3) */ - u32 PAD; - u32 sbtmerrlog; /* (sonics >= 2.3) */ - u32 PAD[3]; - u32 sbadmatch3; /* address match3 */ - u32 PAD; - u32 sbadmatch2; /* address match2 */ - u32 PAD; - u32 sbadmatch1; /* address match1 */ - u32 PAD[7]; - u32 sbimstate; /* initiator agent state */ - u32 sbintvec; /* interrupt mask */ - u32 sbtmstatelow; /* target state */ - u32 sbtmstatehigh; /* target state */ - u32 sbbwa0; /* bandwidth allocation table0 */ - u32 PAD; - u32 sbimconfiglow; /* initiator configuration */ - u32 sbimconfighigh; /* initiator configuration */ - u32 sbadmatch0; /* address match0 */ - u32 PAD; - u32 sbtmconfiglow; /* target configuration */ - u32 sbtmconfighigh; /* target configuration */ - u32 sbbconfig; /* broadcast configuration */ - u32 PAD; - u32 sbbstate; /* broadcast state */ - u32 PAD[3]; - u32 sbactcnfg; /* activate configuration */ - u32 PAD[3]; - u32 sbflagst; /* current sbflags */ - u32 PAD[3]; - u32 sbidlow; /* identification */ - u32 sbidhigh; /* identification */ -}; - -/* sdio core registers */ -struct sdpcmd_regs { - u32 corecontrol; /* 0x00, rev8 */ - u32 corestatus; /* rev8 */ - u32 PAD[1]; - u32 biststatus; /* rev8 */ - - /* PCMCIA access */ - u16 pcmciamesportaladdr; /* 0x010, rev8 */ - u16 PAD[1]; - u16 pcmciamesportalmask; /* rev8 */ - u16 PAD[1]; - u16 pcmciawrframebc; /* rev8 */ - u16 PAD[1]; - u16 pcmciaunderflowtimer; /* rev8 */ - u16 PAD[1]; - - /* interrupt */ - u32 intstatus; /* 0x020, rev8 */ - u32 hostintmask; /* rev8 */ - u32 intmask; /* rev8 */ - u32 sbintstatus; /* rev8 */ - u32 sbintmask; /* rev8 */ - u32 funcintmask; /* rev4 */ - u32 PAD[2]; - u32 tosbmailbox; /* 0x040, rev8 */ - u32 tohostmailbox; /* rev8 */ - u32 tosbmailboxdata; /* rev8 */ - u32 tohostmailboxdata; /* rev8 */ - - /* synchronized access to registers in SDIO clock domain */ - u32 sdioaccess; /* 0x050, rev8 */ - u32 PAD[3]; - - /* PCMCIA frame control */ - u8 pcmciaframectrl; /* 0x060, rev8 */ - u8 PAD[3]; - u8 pcmciawatermark; /* rev8 */ - u8 PAD[155]; - - /* interrupt batching control */ - u32 intrcvlazy; /* 0x100, rev8 */ - u32 PAD[3]; - - /* counters */ - u32 cmd52rd; /* 0x110, rev8 */ - u32 cmd52wr; /* rev8 */ - u32 cmd53rd; /* rev8 */ - u32 cmd53wr; /* rev8 */ - u32 abort; /* rev8 */ - u32 datacrcerror; /* rev8 */ - u32 rdoutofsync; /* rev8 */ - u32 wroutofsync; /* rev8 */ - u32 writebusy; /* rev8 */ - u32 readwait; /* rev8 */ - u32 readterm; /* rev8 */ - u32 writeterm; /* rev8 */ - u32 PAD[40]; - u32 clockctlstatus; /* rev8 */ - u32 PAD[7]; - - u32 PAD[128]; /* DMA engines */ - - /* SDIO/PCMCIA CIS region */ - char cis[512]; /* 0x400-0x5ff, rev6 */ - - /* PCMCIA function control registers */ - char pcmciafcr[256]; /* 0x600-6ff, rev6 */ - u16 PAD[55]; - - /* PCMCIA backplane access */ - u16 backplanecsr; /* 0x76E, rev6 */ - u16 backplaneaddr0; /* rev6 */ - u16 backplaneaddr1; /* rev6 */ - u16 backplaneaddr2; /* rev6 */ - u16 backplaneaddr3; /* rev6 */ - u16 backplanedata0; /* rev6 */ - u16 backplanedata1; /* rev6 */ - u16 backplanedata2; /* rev6 */ - u16 backplanedata3; /* rev6 */ - u16 PAD[31]; - - /* sprom "size" & "blank" info */ - u16 spromstatus; /* 0x7BE, rev2 */ - u32 PAD[464]; - - u16 PAD[0x80]; -}; - -extern int brcmf_sdio_chip_attach(struct brcmf_sdio_dev *sdiodev, - struct chip_info **ci_ptr, u32 regs); -extern void brcmf_sdio_chip_detach(struct chip_info **ci_ptr); -extern void brcmf_sdio_chip_drivestrengthinit(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, - u32 drivestrength); -extern u8 brcmf_sdio_chip_getinfidx(struct chip_info *ci, u16 coreid); -extern void brcmf_sdio_chip_enter_download(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci); -extern bool brcmf_sdio_chip_exit_download(struct brcmf_sdio_dev *sdiodev, - struct chip_info *ci, char *nvram_dat, - uint nvram_sz); - -#endif /* _BRCMFMAC_SDIO_CHIP_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h b/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h deleted file mode 100644 index 7c1b6332747e..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_SDH_H_ -#define _BRCM_SDH_H_ - -#include - -#define SDIO_FUNC_0 0 -#define SDIO_FUNC_1 1 -#define SDIO_FUNC_2 2 - -#define SDIOD_FBR_SIZE 0x100 - -/* io_en */ -#define SDIO_FUNC_ENABLE_1 0x02 -#define SDIO_FUNC_ENABLE_2 0x04 - -/* io_rdys */ -#define SDIO_FUNC_READY_1 0x02 -#define SDIO_FUNC_READY_2 0x04 - -/* intr_status */ -#define INTR_STATUS_FUNC1 0x2 -#define INTR_STATUS_FUNC2 0x4 - -/* Maximum number of I/O funcs */ -#define SDIOD_MAX_IOFUNCS 7 - -/* mask of register map */ -#define REG_F0_REG_MASK 0x7FF -#define REG_F1_MISC_MASK 0x1FFFF - -/* as of sdiod rev 0, supports 3 functions */ -#define SBSDIO_NUM_FUNCTION 3 - -/* function 0 vendor specific CCCR registers */ -#define SDIO_CCCR_BRCM_CARDCAP 0xf0 -#define SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT 0x02 -#define SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT 0x04 -#define SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC 0x08 -#define SDIO_CCCR_BRCM_CARDCTRL 0xf1 -#define SDIO_CCCR_BRCM_CARDCTRL_WLANRESET 0x02 -#define SDIO_CCCR_BRCM_SEPINT 0xf2 - -#define SDIO_SEPINT_MASK 0x01 -#define SDIO_SEPINT_OE 0x02 -#define SDIO_SEPINT_ACT_HI 0x04 - -/* function 1 miscellaneous registers */ - -/* sprom command and status */ -#define SBSDIO_SPROM_CS 0x10000 -/* sprom info register */ -#define SBSDIO_SPROM_INFO 0x10001 -/* sprom indirect access data byte 0 */ -#define SBSDIO_SPROM_DATA_LOW 0x10002 -/* sprom indirect access data byte 1 */ -#define SBSDIO_SPROM_DATA_HIGH 0x10003 -/* sprom indirect access addr byte 0 */ -#define SBSDIO_SPROM_ADDR_LOW 0x10004 -/* sprom indirect access addr byte 0 */ -#define SBSDIO_SPROM_ADDR_HIGH 0x10005 -/* xtal_pu (gpio) output */ -#define SBSDIO_CHIP_CTRL_DATA 0x10006 -/* xtal_pu (gpio) enable */ -#define SBSDIO_CHIP_CTRL_EN 0x10007 -/* rev < 7, watermark for sdio device */ -#define SBSDIO_WATERMARK 0x10008 -/* control busy signal generation */ -#define SBSDIO_DEVICE_CTL 0x10009 - -/* SB Address Window Low (b15) */ -#define SBSDIO_FUNC1_SBADDRLOW 0x1000A -/* SB Address Window Mid (b23:b16) */ -#define SBSDIO_FUNC1_SBADDRMID 0x1000B -/* SB Address Window High (b31:b24) */ -#define SBSDIO_FUNC1_SBADDRHIGH 0x1000C -/* Frame Control (frame term/abort) */ -#define SBSDIO_FUNC1_FRAMECTRL 0x1000D -/* ChipClockCSR (ALP/HT ctl/status) */ -#define SBSDIO_FUNC1_CHIPCLKCSR 0x1000E -/* SdioPullUp (on cmd, d0-d2) */ -#define SBSDIO_FUNC1_SDIOPULLUP 0x1000F -/* Write Frame Byte Count Low */ -#define SBSDIO_FUNC1_WFRAMEBCLO 0x10019 -/* Write Frame Byte Count High */ -#define SBSDIO_FUNC1_WFRAMEBCHI 0x1001A -/* Read Frame Byte Count Low */ -#define SBSDIO_FUNC1_RFRAMEBCLO 0x1001B -/* Read Frame Byte Count High */ -#define SBSDIO_FUNC1_RFRAMEBCHI 0x1001C -/* MesBusyCtl (rev 11) */ -#define SBSDIO_FUNC1_MESBUSYCTRL 0x1001D -/* Sdio Core Rev 12 */ -#define SBSDIO_FUNC1_WAKEUPCTRL 0x1001E -#define SBSDIO_FUNC1_WCTRL_ALPWAIT_MASK 0x1 -#define SBSDIO_FUNC1_WCTRL_ALPWAIT_SHIFT 0 -#define SBSDIO_FUNC1_WCTRL_HTWAIT_MASK 0x2 -#define SBSDIO_FUNC1_WCTRL_HTWAIT_SHIFT 1 -#define SBSDIO_FUNC1_SLEEPCSR 0x1001F -#define SBSDIO_FUNC1_SLEEPCSR_KSO_MASK 0x1 -#define SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT 0 -#define SBSDIO_FUNC1_SLEEPCSR_KSO_EN 1 -#define SBSDIO_FUNC1_SLEEPCSR_DEVON_MASK 0x2 -#define SBSDIO_FUNC1_SLEEPCSR_DEVON_SHIFT 1 - -#define SBSDIO_FUNC1_MISC_REG_START 0x10000 /* f1 misc register start */ -#define SBSDIO_FUNC1_MISC_REG_LIMIT 0x1001F /* f1 misc register end */ - -/* function 1 OCP space */ - -/* sb offset addr is <= 15 bits, 32k */ -#define SBSDIO_SB_OFT_ADDR_MASK 0x07FFF -#define SBSDIO_SB_OFT_ADDR_LIMIT 0x08000 -/* with b15, maps to 32-bit SB access */ -#define SBSDIO_SB_ACCESS_2_4B_FLAG 0x08000 - -/* valid bits in SBSDIO_FUNC1_SBADDRxxx regs */ - -#define SBSDIO_SBADDRLOW_MASK 0x80 /* Valid bits in SBADDRLOW */ -#define SBSDIO_SBADDRMID_MASK 0xff /* Valid bits in SBADDRMID */ -#define SBSDIO_SBADDRHIGH_MASK 0xffU /* Valid bits in SBADDRHIGH */ -/* Address bits from SBADDR regs */ -#define SBSDIO_SBWINDOW_MASK 0xffff8000 - -#define SDIOH_READ 0 /* Read request */ -#define SDIOH_WRITE 1 /* Write request */ - -#define SDIOH_DATA_FIX 0 /* Fixed addressing */ -#define SDIOH_DATA_INC 1 /* Incremental addressing */ - -/* internal return code */ -#define SUCCESS 0 -#define ERROR 1 - -/* Packet alignment for most efficient SDIO (can change based on platform) */ -#define BRCMF_SDALIGN (1 << 6) - -/* watchdog polling interval in ms */ -#define BRCMF_WD_POLL_MS 10 - -struct brcmf_sdreg { - int func; - int offset; - int value; -}; - -struct brcmf_sdio; - -struct brcmf_sdio_dev { - struct sdio_func *func[SDIO_MAX_FUNCS]; - u8 num_funcs; /* Supported funcs on client */ - u32 func_cis_ptr[SDIOD_MAX_IOFUNCS]; - u32 sbwad; /* Save backplane window address */ - void *bus; - atomic_t suspend; /* suspend flag */ - wait_queue_head_t request_byte_wait; - wait_queue_head_t request_word_wait; - wait_queue_head_t request_chain_wait; - wait_queue_head_t request_buffer_wait; - struct device *dev; - struct brcmf_bus *bus_if; - struct brcmfmac_sdio_platform_data *pdata; - bool oob_irq_requested; - bool irq_en; /* irq enable flags */ - spinlock_t irq_en_lock; - bool irq_wake; /* irq wake enable flags */ -}; - -/* Register/deregister interrupt handler. */ -extern int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev); -extern int brcmf_sdio_intr_unregister(struct brcmf_sdio_dev *sdiodev); - -/* sdio device register access interface */ -extern u8 brcmf_sdio_regrb(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret); -extern u32 brcmf_sdio_regrl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret); -extern void brcmf_sdio_regwb(struct brcmf_sdio_dev *sdiodev, u32 addr, - u8 data, int *ret); -extern void brcmf_sdio_regwl(struct brcmf_sdio_dev *sdiodev, u32 addr, - u32 data, int *ret); -extern int brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr, - void *data, bool write); - -/* Buffer transfer to/from device (client) core via cmd53. - * fn: function number - * addr: backplane address (i.e. >= regsva from attach) - * flags: backplane width, address increment, sync/async - * buf: pointer to memory data buffer - * nbytes: number of bytes to transfer to/from buf - * pkt: pointer to packet associated with buf (if any) - * complete: callback function for command completion (async only) - * handle: handle for completion callback (first arg in callback) - * Returns 0 or error code. - * NOTE: Async operation is not currently supported. - */ -extern int -brcmf_sdcard_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, - uint flags, struct sk_buff *pkt); -extern int -brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, - uint flags, u8 *buf, uint nbytes); - -extern int -brcmf_sdcard_recv_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, - uint flags, struct sk_buff *pkt); -extern int -brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, - uint flags, u8 *buf, uint nbytes); -extern int -brcmf_sdcard_recv_chain(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, - uint flags, struct sk_buff_head *pktq); - -/* Flags bits */ - -/* Four-byte target (backplane) width (vs. two-byte) */ -#define SDIO_REQ_4BYTE 0x1 -/* Fixed address (FIFO) (vs. incrementing address) */ -#define SDIO_REQ_FIXED 0x2 -/* Async request (vs. sync request) */ -#define SDIO_REQ_ASYNC 0x4 - -/* Read/write to memory block (F1, no FIFO) via CMD53 (sync only). - * rw: read or write (0/1) - * addr: direct SDIO address - * buf: pointer to memory data buffer - * nbytes: number of bytes to transfer to/from buf - * Returns 0 or error code. - */ -extern int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw, - u32 addr, u8 *buf, uint nbytes); -extern int brcmf_sdio_ramrw(struct brcmf_sdio_dev *sdiodev, bool write, - u32 address, u8 *data, uint size); - -/* Issue an abort to the specified function */ -extern int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn); - -/* platform specific/high level functions */ -extern int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev); -extern int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev); - -extern int brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, - u32 address); - -/* attach, return handler on success, NULL if failed. - * The handler shall be provided by all subsequent calls. No local cache - * cfghdl points to the starting address of pci device mapped memory - */ -extern int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev); -extern void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev); - -/* read or write one byte using cmd52 */ -extern int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, - uint fnc, uint addr, u8 *byte); - -/* read or write 2/4 bytes using cmd53 */ -extern int -brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, - uint rw, uint fnc, uint addr, - u32 *word, uint nbyte); - -/* read or write any buffer using cmd53 */ -extern int -brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev, - uint fix_inc, uint rw, uint fnc_num, u32 addr, - struct sk_buff *pkt); -extern int -brcmf_sdioh_request_chain(struct brcmf_sdio_dev *sdiodev, uint fix_inc, - uint write, uint func, uint addr, - struct sk_buff_head *pktq); - -/* Watchdog timer interface for pm ops */ -extern void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev, - bool enable); - -extern void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev); -extern void brcmf_sdbrcm_disconnect(void *ptr); -extern void brcmf_sdbrcm_isr(void *arg); - -extern void brcmf_sdbrcm_wd_timer(struct brcmf_sdio *bus, uint wdtick); -#endif /* _BRCM_SDH_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/tracepoint.c b/drivers/net/wireless/brcm80211/brcmfmac/tracepoint.c deleted file mode 100644 index b505db48c60d..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/tracepoint.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2012 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include /* bug in tracepoint.h, it should include this */ - -#ifndef __CHECKER__ -#define CREATE_TRACE_POINTS -#include "tracepoint.h" -#endif diff --git a/drivers/net/wireless/brcm80211/brcmfmac/tracepoint.h b/drivers/net/wireless/brcm80211/brcmfmac/tracepoint.h deleted file mode 100644 index 9df1f7a681e0..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/tracepoint.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2013 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#if !defined(BRCMF_TRACEPOINT_H_) || defined(TRACE_HEADER_MULTI_READ) -#define BRCMF_TRACEPOINT_H_ - -#include -#include - -#ifndef CONFIG_BRCM_TRACING - -#undef TRACE_EVENT -#define TRACE_EVENT(name, proto, ...) \ -static inline void trace_ ## name(proto) {} - -#undef DECLARE_EVENT_CLASS -#define DECLARE_EVENT_CLASS(...) - -#undef DEFINE_EVENT -#define DEFINE_EVENT(evt_class, name, proto, ...) \ -static inline void trace_ ## name(proto) {} - -#endif /* CONFIG_BRCM_TRACING */ - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM brcmfmac - -#define MAX_MSG_LEN 100 - -TRACE_EVENT(brcmf_err, - TP_PROTO(const char *func, struct va_format *vaf), - TP_ARGS(func, vaf), - TP_STRUCT__entry( - __string(func, func) - __dynamic_array(char, msg, MAX_MSG_LEN) - ), - TP_fast_assign( - __assign_str(func, func); - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), - MAX_MSG_LEN, vaf->fmt, - *vaf->va) >= MAX_MSG_LEN); - ), - TP_printk("%s: %s", __get_str(func), __get_str(msg)) -); - -TRACE_EVENT(brcmf_dbg, - TP_PROTO(u32 level, const char *func, struct va_format *vaf), - TP_ARGS(level, func, vaf), - TP_STRUCT__entry( - __field(u32, level) - __string(func, func) - __dynamic_array(char, msg, MAX_MSG_LEN) - ), - TP_fast_assign( - __entry->level = level; - __assign_str(func, func); - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), - MAX_MSG_LEN, vaf->fmt, - *vaf->va) >= MAX_MSG_LEN); - ), - TP_printk("%s: %s", __get_str(func), __get_str(msg)) -); - -TRACE_EVENT(brcmf_hexdump, - TP_PROTO(void *data, size_t len), - TP_ARGS(data, len), - TP_STRUCT__entry( - __field(unsigned long, len) - __dynamic_array(u8, hdata, len) - ), - TP_fast_assign( - __entry->len = len; - memcpy(__get_dynamic_array(hdata), data, len); - ), - TP_printk("hexdump [length=%lu]", __entry->len) -); - -#ifdef CONFIG_BRCM_TRACING - -#undef TRACE_INCLUDE_PATH -#define TRACE_INCLUDE_PATH . -#undef TRACE_INCLUDE_FILE -#define TRACE_INCLUDE_FILE tracepoint - -#include - -#endif /* CONFIG_BRCM_TRACING */ - -#endif /* BRCMF_TRACEPOINT_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c deleted file mode 100644 index b0ab98b0a226..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ /dev/null @@ -1,1540 +0,0 @@ -/* - * Copyright (c) 2011 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "usb_rdl.h" -#include "usb.h" - -#define IOCTL_RESP_TIMEOUT 2000 - -#define BRCMF_USB_RESET_GETVER_SPINWAIT 100 /* in unit of ms */ -#define BRCMF_USB_RESET_GETVER_LOOP_CNT 10 - -#define BRCMF_POSTBOOT_ID 0xA123 /* ID to detect if dongle - has boot up */ -#define BRCMF_USB_NRXQ 50 -#define BRCMF_USB_NTXQ 50 - -#define CONFIGDESC(usb) (&((usb)->actconfig)->desc) -#define IFPTR(usb, idx) ((usb)->actconfig->interface[(idx)]) -#define IFALTS(usb, idx) (IFPTR((usb), (idx))->altsetting[0]) -#define IFDESC(usb, idx) IFALTS((usb), (idx)).desc -#define IFEPDESC(usb, idx, ep) (IFALTS((usb), (idx)).endpoint[(ep)]).desc - -#define CONTROL_IF 0 -#define BULK_IF 0 - -#define BRCMF_USB_CBCTL_WRITE 0 -#define BRCMF_USB_CBCTL_READ 1 -#define BRCMF_USB_MAX_PKT_SIZE 1600 - -#define BRCMF_USB_43143_FW_NAME "brcm/brcmfmac43143.bin" -#define BRCMF_USB_43236_FW_NAME "brcm/brcmfmac43236b.bin" -#define BRCMF_USB_43242_FW_NAME "brcm/brcmfmac43242a.bin" - -struct brcmf_usb_image { - struct list_head list; - s8 *fwname; - u8 *image; - int image_len; -}; -static struct list_head fw_image_list; - -struct intr_transfer_buf { - u32 notification; - u32 reserved; -}; - -struct brcmf_usbdev_info { - struct brcmf_usbdev bus_pub; /* MUST BE FIRST */ - spinlock_t qlock; - struct list_head rx_freeq; - struct list_head rx_postq; - struct list_head tx_freeq; - struct list_head tx_postq; - uint rx_pipe, tx_pipe, intr_pipe, rx_pipe2; - - int rx_low_watermark; - int tx_low_watermark; - int tx_high_watermark; - int tx_freecount; - bool tx_flowblock; - - struct brcmf_usbreq *tx_reqs; - struct brcmf_usbreq *rx_reqs; - - u8 *image; /* buffer for combine fw and nvram */ - int image_len; - - struct usb_device *usbdev; - struct device *dev; - - int ctl_in_pipe, ctl_out_pipe; - struct urb *ctl_urb; /* URB for control endpoint */ - struct usb_ctrlrequest ctl_write; - struct usb_ctrlrequest ctl_read; - u32 ctl_urb_actual_length; - int ctl_urb_status; - int ctl_completed; - wait_queue_head_t ioctl_resp_wait; - ulong ctl_op; - - struct urb *bulk_urb; /* used for FW download */ - struct urb *intr_urb; /* URB for interrupt endpoint */ - int intr_size; /* Size of interrupt message */ - int interval; /* Interrupt polling interval */ - struct intr_transfer_buf intr; /* Data buffer for interrupt endpoint */ -}; - -static void brcmf_usb_rx_refill(struct brcmf_usbdev_info *devinfo, - struct brcmf_usbreq *req); - -static struct brcmf_usbdev *brcmf_usb_get_buspub(struct device *dev) -{ - struct brcmf_bus *bus_if = dev_get_drvdata(dev); - return bus_if->bus_priv.usb; -} - -static struct brcmf_usbdev_info *brcmf_usb_get_businfo(struct device *dev) -{ - return brcmf_usb_get_buspub(dev)->devinfo; -} - -static int brcmf_usb_ioctl_resp_wait(struct brcmf_usbdev_info *devinfo) -{ - return wait_event_timeout(devinfo->ioctl_resp_wait, - devinfo->ctl_completed, - msecs_to_jiffies(IOCTL_RESP_TIMEOUT)); -} - -static void brcmf_usb_ioctl_resp_wake(struct brcmf_usbdev_info *devinfo) -{ - if (waitqueue_active(&devinfo->ioctl_resp_wait)) - wake_up(&devinfo->ioctl_resp_wait); -} - -static void -brcmf_usb_ctl_complete(struct brcmf_usbdev_info *devinfo, int type, int status) -{ - brcmf_dbg(USB, "Enter, status=%d\n", status); - - if (unlikely(devinfo == NULL)) - return; - - if (type == BRCMF_USB_CBCTL_READ) { - if (status == 0) - devinfo->bus_pub.stats.rx_ctlpkts++; - else - devinfo->bus_pub.stats.rx_ctlerrs++; - } else if (type == BRCMF_USB_CBCTL_WRITE) { - if (status == 0) - devinfo->bus_pub.stats.tx_ctlpkts++; - else - devinfo->bus_pub.stats.tx_ctlerrs++; - } - - devinfo->ctl_urb_status = status; - devinfo->ctl_completed = true; - brcmf_usb_ioctl_resp_wake(devinfo); -} - -static void -brcmf_usb_ctlread_complete(struct urb *urb) -{ - struct brcmf_usbdev_info *devinfo = - (struct brcmf_usbdev_info *)urb->context; - - brcmf_dbg(USB, "Enter\n"); - devinfo->ctl_urb_actual_length = urb->actual_length; - brcmf_usb_ctl_complete(devinfo, BRCMF_USB_CBCTL_READ, - urb->status); -} - -static void -brcmf_usb_ctlwrite_complete(struct urb *urb) -{ - struct brcmf_usbdev_info *devinfo = - (struct brcmf_usbdev_info *)urb->context; - - brcmf_dbg(USB, "Enter\n"); - brcmf_usb_ctl_complete(devinfo, BRCMF_USB_CBCTL_WRITE, - urb->status); -} - -static int -brcmf_usb_send_ctl(struct brcmf_usbdev_info *devinfo, u8 *buf, int len) -{ - int ret; - u16 size; - - brcmf_dbg(USB, "Enter\n"); - if (devinfo == NULL || buf == NULL || - len == 0 || devinfo->ctl_urb == NULL) - return -EINVAL; - - size = len; - devinfo->ctl_write.wLength = cpu_to_le16p(&size); - devinfo->ctl_urb->transfer_buffer_length = size; - devinfo->ctl_urb_status = 0; - devinfo->ctl_urb_actual_length = 0; - - usb_fill_control_urb(devinfo->ctl_urb, - devinfo->usbdev, - devinfo->ctl_out_pipe, - (unsigned char *) &devinfo->ctl_write, - buf, size, - (usb_complete_t)brcmf_usb_ctlwrite_complete, - devinfo); - - ret = usb_submit_urb(devinfo->ctl_urb, GFP_ATOMIC); - if (ret < 0) - brcmf_err("usb_submit_urb failed %d\n", ret); - - return ret; -} - -static int -brcmf_usb_recv_ctl(struct brcmf_usbdev_info *devinfo, u8 *buf, int len) -{ - int ret; - u16 size; - - brcmf_dbg(USB, "Enter\n"); - if ((devinfo == NULL) || (buf == NULL) || (len == 0) - || (devinfo->ctl_urb == NULL)) - return -EINVAL; - - size = len; - devinfo->ctl_read.wLength = cpu_to_le16p(&size); - devinfo->ctl_urb->transfer_buffer_length = size; - - devinfo->ctl_read.bRequestType = USB_DIR_IN - | USB_TYPE_CLASS | USB_RECIP_INTERFACE; - devinfo->ctl_read.bRequest = 1; - - usb_fill_control_urb(devinfo->ctl_urb, - devinfo->usbdev, - devinfo->ctl_in_pipe, - (unsigned char *) &devinfo->ctl_read, - buf, size, - (usb_complete_t)brcmf_usb_ctlread_complete, - devinfo); - - ret = usb_submit_urb(devinfo->ctl_urb, GFP_ATOMIC); - if (ret < 0) - brcmf_err("usb_submit_urb failed %d\n", ret); - - return ret; -} - -static int brcmf_usb_tx_ctlpkt(struct device *dev, u8 *buf, u32 len) -{ - int err = 0; - int timeout = 0; - struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); - - brcmf_dbg(USB, "Enter\n"); - if (devinfo->bus_pub.state != BRCMFMAC_USB_STATE_UP) - return -EIO; - - if (test_and_set_bit(0, &devinfo->ctl_op)) - return -EIO; - - devinfo->ctl_completed = false; - err = brcmf_usb_send_ctl(devinfo, buf, len); - if (err) { - brcmf_err("fail %d bytes: %d\n", err, len); - clear_bit(0, &devinfo->ctl_op); - return err; - } - timeout = brcmf_usb_ioctl_resp_wait(devinfo); - clear_bit(0, &devinfo->ctl_op); - if (!timeout) { - brcmf_err("Txctl wait timed out\n"); - err = -EIO; - } - return err; -} - -static int brcmf_usb_rx_ctlpkt(struct device *dev, u8 *buf, u32 len) -{ - int err = 0; - int timeout = 0; - struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); - - brcmf_dbg(USB, "Enter\n"); - if (devinfo->bus_pub.state != BRCMFMAC_USB_STATE_UP) - return -EIO; - - if (test_and_set_bit(0, &devinfo->ctl_op)) - return -EIO; - - devinfo->ctl_completed = false; - err = brcmf_usb_recv_ctl(devinfo, buf, len); - if (err) { - brcmf_err("fail %d bytes: %d\n", err, len); - clear_bit(0, &devinfo->ctl_op); - return err; - } - timeout = brcmf_usb_ioctl_resp_wait(devinfo); - err = devinfo->ctl_urb_status; - clear_bit(0, &devinfo->ctl_op); - if (!timeout) { - brcmf_err("rxctl wait timed out\n"); - err = -EIO; - } - if (!err) - return devinfo->ctl_urb_actual_length; - else - return err; -} - -static struct brcmf_usbreq *brcmf_usb_deq(struct brcmf_usbdev_info *devinfo, - struct list_head *q, int *counter) -{ - unsigned long flags; - struct brcmf_usbreq *req; - spin_lock_irqsave(&devinfo->qlock, flags); - if (list_empty(q)) { - spin_unlock_irqrestore(&devinfo->qlock, flags); - return NULL; - } - req = list_entry(q->next, struct brcmf_usbreq, list); - list_del_init(q->next); - if (counter) - (*counter)--; - spin_unlock_irqrestore(&devinfo->qlock, flags); - return req; - -} - -static void brcmf_usb_enq(struct brcmf_usbdev_info *devinfo, - struct list_head *q, struct brcmf_usbreq *req, - int *counter) -{ - unsigned long flags; - spin_lock_irqsave(&devinfo->qlock, flags); - list_add_tail(&req->list, q); - if (counter) - (*counter)++; - spin_unlock_irqrestore(&devinfo->qlock, flags); -} - -static struct brcmf_usbreq * -brcmf_usbdev_qinit(struct list_head *q, int qsize) -{ - int i; - struct brcmf_usbreq *req, *reqs; - - reqs = kcalloc(qsize, sizeof(struct brcmf_usbreq), GFP_ATOMIC); - if (reqs == NULL) - return NULL; - - req = reqs; - - for (i = 0; i < qsize; i++) { - req->urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!req->urb) - goto fail; - - INIT_LIST_HEAD(&req->list); - list_add_tail(&req->list, q); - req++; - } - return reqs; -fail: - brcmf_err("fail!\n"); - while (!list_empty(q)) { - req = list_entry(q->next, struct brcmf_usbreq, list); - if (req && req->urb) - usb_free_urb(req->urb); - list_del(q->next); - } - return NULL; - -} - -static void brcmf_usb_free_q(struct list_head *q, bool pending) -{ - struct brcmf_usbreq *req, *next; - int i = 0; - list_for_each_entry_safe(req, next, q, list) { - if (!req->urb) { - brcmf_err("bad req\n"); - break; - } - i++; - if (pending) { - usb_kill_urb(req->urb); - } else { - usb_free_urb(req->urb); - list_del_init(&req->list); - } - } -} - -static void brcmf_usb_del_fromq(struct brcmf_usbdev_info *devinfo, - struct brcmf_usbreq *req) -{ - unsigned long flags; - - spin_lock_irqsave(&devinfo->qlock, flags); - list_del_init(&req->list); - spin_unlock_irqrestore(&devinfo->qlock, flags); -} - - -static void brcmf_usb_tx_complete(struct urb *urb) -{ - struct brcmf_usbreq *req = (struct brcmf_usbreq *)urb->context; - struct brcmf_usbdev_info *devinfo = req->devinfo; - - brcmf_dbg(USB, "Enter, urb->status=%d, skb=%p\n", urb->status, - req->skb); - brcmf_usb_del_fromq(devinfo, req); - - brcmf_txcomplete(devinfo->dev, req->skb, urb->status == 0); - req->skb = NULL; - brcmf_usb_enq(devinfo, &devinfo->tx_freeq, req, &devinfo->tx_freecount); - if (devinfo->tx_freecount > devinfo->tx_high_watermark && - devinfo->tx_flowblock) { - brcmf_txflowblock(devinfo->dev, false); - devinfo->tx_flowblock = false; - } -} - -static void brcmf_usb_rx_complete(struct urb *urb) -{ - struct brcmf_usbreq *req = (struct brcmf_usbreq *)urb->context; - struct brcmf_usbdev_info *devinfo = req->devinfo; - struct sk_buff *skb; - struct sk_buff_head skbq; - - brcmf_dbg(USB, "Enter, urb->status=%d\n", urb->status); - brcmf_usb_del_fromq(devinfo, req); - skb = req->skb; - req->skb = NULL; - - /* zero lenght packets indicate usb "failure". Do not refill */ - if (urb->status != 0 || !urb->actual_length) { - brcmu_pkt_buf_free_skb(skb); - brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL); - return; - } - - if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) { - skb_queue_head_init(&skbq); - skb_queue_tail(&skbq, skb); - skb_put(skb, urb->actual_length); - brcmf_rx_frames(devinfo->dev, &skbq); - brcmf_usb_rx_refill(devinfo, req); - } else { - brcmu_pkt_buf_free_skb(skb); - brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL); - } - return; - -} - -static void brcmf_usb_rx_refill(struct brcmf_usbdev_info *devinfo, - struct brcmf_usbreq *req) -{ - struct sk_buff *skb; - int ret; - - if (!req || !devinfo) - return; - - skb = dev_alloc_skb(devinfo->bus_pub.bus_mtu); - if (!skb) { - brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL); - return; - } - req->skb = skb; - - usb_fill_bulk_urb(req->urb, devinfo->usbdev, devinfo->rx_pipe, - skb->data, skb_tailroom(skb), brcmf_usb_rx_complete, - req); - req->devinfo = devinfo; - brcmf_usb_enq(devinfo, &devinfo->rx_postq, req, NULL); - - ret = usb_submit_urb(req->urb, GFP_ATOMIC); - if (ret) { - brcmf_usb_del_fromq(devinfo, req); - brcmu_pkt_buf_free_skb(req->skb); - req->skb = NULL; - brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req, NULL); - } - return; -} - -static void brcmf_usb_rx_fill_all(struct brcmf_usbdev_info *devinfo) -{ - struct brcmf_usbreq *req; - - if (devinfo->bus_pub.state != BRCMFMAC_USB_STATE_UP) { - brcmf_err("bus is not up=%d\n", devinfo->bus_pub.state); - return; - } - while ((req = brcmf_usb_deq(devinfo, &devinfo->rx_freeq, NULL)) != NULL) - brcmf_usb_rx_refill(devinfo, req); -} - -static void -brcmf_usb_state_change(struct brcmf_usbdev_info *devinfo, int state) -{ - struct brcmf_bus *bcmf_bus = devinfo->bus_pub.bus; - int old_state; - - brcmf_dbg(USB, "Enter, current state=%d, new state=%d\n", - devinfo->bus_pub.state, state); - - if (devinfo->bus_pub.state == state) - return; - - old_state = devinfo->bus_pub.state; - devinfo->bus_pub.state = state; - - /* update state of upper layer */ - if (state == BRCMFMAC_USB_STATE_DOWN) { - brcmf_dbg(USB, "DBUS is down\n"); - bcmf_bus->state = BRCMF_BUS_DOWN; - } else if (state == BRCMFMAC_USB_STATE_UP) { - brcmf_dbg(USB, "DBUS is up\n"); - bcmf_bus->state = BRCMF_BUS_DATA; - } else { - brcmf_dbg(USB, "DBUS current state=%d\n", state); - } -} - -static void -brcmf_usb_intr_complete(struct urb *urb) -{ - struct brcmf_usbdev_info *devinfo = - (struct brcmf_usbdev_info *)urb->context; - int err; - - brcmf_dbg(USB, "Enter, urb->status=%d\n", urb->status); - - if (devinfo == NULL) - return; - - if (unlikely(urb->status)) { - if (urb->status == -ENOENT || - urb->status == -ESHUTDOWN || - urb->status == -ENODEV) { - brcmf_usb_state_change(devinfo, - BRCMFMAC_USB_STATE_DOWN); - } - } - - if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_DOWN) { - brcmf_err("intr cb when DBUS down, ignoring\n"); - return; - } - - if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) { - err = usb_submit_urb(devinfo->intr_urb, GFP_ATOMIC); - if (err) - brcmf_err("usb_submit_urb, err=%d\n", err); - } -} - -static int brcmf_usb_tx(struct device *dev, struct sk_buff *skb) -{ - struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); - struct brcmf_usbreq *req; - int ret; - - brcmf_dbg(USB, "Enter, skb=%p\n", skb); - if (devinfo->bus_pub.state != BRCMFMAC_USB_STATE_UP) { - ret = -EIO; - goto fail; - } - - req = brcmf_usb_deq(devinfo, &devinfo->tx_freeq, - &devinfo->tx_freecount); - if (!req) { - brcmf_err("no req to send\n"); - ret = -ENOMEM; - goto fail; - } - - req->skb = skb; - req->devinfo = devinfo; - usb_fill_bulk_urb(req->urb, devinfo->usbdev, devinfo->tx_pipe, - skb->data, skb->len, brcmf_usb_tx_complete, req); - req->urb->transfer_flags |= URB_ZERO_PACKET; - brcmf_usb_enq(devinfo, &devinfo->tx_postq, req, NULL); - ret = usb_submit_urb(req->urb, GFP_ATOMIC); - if (ret) { - brcmf_err("brcmf_usb_tx usb_submit_urb FAILED\n"); - brcmf_usb_del_fromq(devinfo, req); - req->skb = NULL; - brcmf_usb_enq(devinfo, &devinfo->tx_freeq, req, - &devinfo->tx_freecount); - goto fail; - } - - if (devinfo->tx_freecount < devinfo->tx_low_watermark && - !devinfo->tx_flowblock) { - brcmf_txflowblock(dev, true); - devinfo->tx_flowblock = true; - } - return 0; - -fail: - brcmf_txcomplete(dev, skb, false); - return ret; -} - - -static int brcmf_usb_up(struct device *dev) -{ - struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); - u16 ifnum; - int ret; - - brcmf_dbg(USB, "Enter\n"); - if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) - return 0; - - /* Success, indicate devinfo is fully up */ - brcmf_usb_state_change(devinfo, BRCMFMAC_USB_STATE_UP); - - if (devinfo->intr_urb) { - usb_fill_int_urb(devinfo->intr_urb, devinfo->usbdev, - devinfo->intr_pipe, - &devinfo->intr, - devinfo->intr_size, - (usb_complete_t)brcmf_usb_intr_complete, - devinfo, - devinfo->interval); - - ret = usb_submit_urb(devinfo->intr_urb, GFP_ATOMIC); - if (ret) { - brcmf_err("USB_SUBMIT_URB failed with status %d\n", - ret); - return -EINVAL; - } - } - - if (devinfo->ctl_urb) { - devinfo->ctl_in_pipe = usb_rcvctrlpipe(devinfo->usbdev, 0); - devinfo->ctl_out_pipe = usb_sndctrlpipe(devinfo->usbdev, 0); - - ifnum = IFDESC(devinfo->usbdev, CONTROL_IF).bInterfaceNumber; - - /* CTL Write */ - devinfo->ctl_write.bRequestType = - USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE; - devinfo->ctl_write.bRequest = 0; - devinfo->ctl_write.wValue = cpu_to_le16(0); - devinfo->ctl_write.wIndex = cpu_to_le16p(&ifnum); - - /* CTL Read */ - devinfo->ctl_read.bRequestType = - USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE; - devinfo->ctl_read.bRequest = 1; - devinfo->ctl_read.wValue = cpu_to_le16(0); - devinfo->ctl_read.wIndex = cpu_to_le16p(&ifnum); - } - brcmf_usb_rx_fill_all(devinfo); - return 0; -} - -static void brcmf_usb_down(struct device *dev) -{ - struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); - - brcmf_dbg(USB, "Enter\n"); - if (devinfo == NULL) - return; - - if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_DOWN) - return; - - brcmf_usb_state_change(devinfo, BRCMFMAC_USB_STATE_DOWN); - if (devinfo->intr_urb) - usb_kill_urb(devinfo->intr_urb); - - if (devinfo->ctl_urb) - usb_kill_urb(devinfo->ctl_urb); - - if (devinfo->bulk_urb) - usb_kill_urb(devinfo->bulk_urb); - brcmf_usb_free_q(&devinfo->tx_postq, true); - - brcmf_usb_free_q(&devinfo->rx_postq, true); -} - -static void -brcmf_usb_sync_complete(struct urb *urb) -{ - struct brcmf_usbdev_info *devinfo = - (struct brcmf_usbdev_info *)urb->context; - - devinfo->ctl_completed = true; - brcmf_usb_ioctl_resp_wake(devinfo); -} - -static bool brcmf_usb_dl_cmd(struct brcmf_usbdev_info *devinfo, u8 cmd, - void *buffer, int buflen) -{ - int ret = 0; - char *tmpbuf; - u16 size; - - if ((!devinfo) || (devinfo->ctl_urb == NULL)) - return false; - - tmpbuf = kmalloc(buflen, GFP_ATOMIC); - if (!tmpbuf) - return false; - - size = buflen; - devinfo->ctl_urb->transfer_buffer_length = size; - - devinfo->ctl_read.wLength = cpu_to_le16p(&size); - devinfo->ctl_read.bRequestType = USB_DIR_IN | USB_TYPE_VENDOR | - USB_RECIP_INTERFACE; - devinfo->ctl_read.bRequest = cmd; - - usb_fill_control_urb(devinfo->ctl_urb, - devinfo->usbdev, - usb_rcvctrlpipe(devinfo->usbdev, 0), - (unsigned char *) &devinfo->ctl_read, - (void *) tmpbuf, size, - (usb_complete_t)brcmf_usb_sync_complete, devinfo); - - devinfo->ctl_completed = false; - ret = usb_submit_urb(devinfo->ctl_urb, GFP_ATOMIC); - if (ret < 0) { - brcmf_err("usb_submit_urb failed %d\n", ret); - kfree(tmpbuf); - return false; - } - - ret = brcmf_usb_ioctl_resp_wait(devinfo); - memcpy(buffer, tmpbuf, buflen); - kfree(tmpbuf); - - return ret; -} - -static bool -brcmf_usb_dlneeded(struct brcmf_usbdev_info *devinfo) -{ - struct bootrom_id_le id; - u32 chipid, chiprev; - - brcmf_dbg(USB, "Enter\n"); - - if (devinfo == NULL) - return false; - - /* Check if firmware downloaded already by querying runtime ID */ - id.chip = cpu_to_le32(0xDEAD); - brcmf_usb_dl_cmd(devinfo, DL_GETVER, &id, sizeof(id)); - - chipid = le32_to_cpu(id.chip); - chiprev = le32_to_cpu(id.chiprev); - - if ((chipid & 0x4300) == 0x4300) - brcmf_dbg(USB, "chip %x rev 0x%x\n", chipid, chiprev); - else - brcmf_dbg(USB, "chip %d rev 0x%x\n", chipid, chiprev); - if (chipid == BRCMF_POSTBOOT_ID) { - brcmf_dbg(USB, "firmware already downloaded\n"); - brcmf_usb_dl_cmd(devinfo, DL_RESETCFG, &id, sizeof(id)); - return false; - } else { - devinfo->bus_pub.devid = chipid; - devinfo->bus_pub.chiprev = chiprev; - } - return true; -} - -static int -brcmf_usb_resetcfg(struct brcmf_usbdev_info *devinfo) -{ - struct bootrom_id_le id; - u32 loop_cnt; - - brcmf_dbg(USB, "Enter\n"); - - loop_cnt = 0; - do { - mdelay(BRCMF_USB_RESET_GETVER_SPINWAIT); - loop_cnt++; - id.chip = cpu_to_le32(0xDEAD); /* Get the ID */ - brcmf_usb_dl_cmd(devinfo, DL_GETVER, &id, sizeof(id)); - if (id.chip == cpu_to_le32(BRCMF_POSTBOOT_ID)) - break; - } while (loop_cnt < BRCMF_USB_RESET_GETVER_LOOP_CNT); - - if (id.chip == cpu_to_le32(BRCMF_POSTBOOT_ID)) { - brcmf_dbg(USB, "postboot chip 0x%x/rev 0x%x\n", - le32_to_cpu(id.chip), le32_to_cpu(id.chiprev)); - - brcmf_usb_dl_cmd(devinfo, DL_RESETCFG, &id, sizeof(id)); - return 0; - } else { - brcmf_err("Cannot talk to Dongle. Firmware is not UP, %d ms\n", - BRCMF_USB_RESET_GETVER_SPINWAIT * loop_cnt); - return -EINVAL; - } -} - - -static int -brcmf_usb_dl_send_bulk(struct brcmf_usbdev_info *devinfo, void *buffer, int len) -{ - int ret; - - if ((devinfo == NULL) || (devinfo->bulk_urb == NULL)) - return -EINVAL; - - /* Prepare the URB */ - usb_fill_bulk_urb(devinfo->bulk_urb, devinfo->usbdev, - devinfo->tx_pipe, buffer, len, - (usb_complete_t)brcmf_usb_sync_complete, devinfo); - - devinfo->bulk_urb->transfer_flags |= URB_ZERO_PACKET; - - devinfo->ctl_completed = false; - ret = usb_submit_urb(devinfo->bulk_urb, GFP_ATOMIC); - if (ret) { - brcmf_err("usb_submit_urb failed %d\n", ret); - return ret; - } - ret = brcmf_usb_ioctl_resp_wait(devinfo); - return (ret == 0); -} - -static int -brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, u8 *fw, int fwlen) -{ - unsigned int sendlen, sent, dllen; - char *bulkchunk = NULL, *dlpos; - struct rdl_state_le state; - u32 rdlstate, rdlbytes; - int err = 0; - - brcmf_dbg(USB, "Enter, fw %p, len %d\n", fw, fwlen); - - bulkchunk = kmalloc(RDL_CHUNK, GFP_ATOMIC); - if (bulkchunk == NULL) { - err = -ENOMEM; - goto fail; - } - - /* 1) Prepare USB boot loader for runtime image */ - brcmf_usb_dl_cmd(devinfo, DL_START, &state, - sizeof(struct rdl_state_le)); - - rdlstate = le32_to_cpu(state.state); - rdlbytes = le32_to_cpu(state.bytes); - - /* 2) Check we are in the Waiting state */ - if (rdlstate != DL_WAITING) { - brcmf_err("Failed to DL_START\n"); - err = -EINVAL; - goto fail; - } - sent = 0; - dlpos = fw; - dllen = fwlen; - - /* Get chip id and rev */ - while (rdlbytes != dllen) { - /* Wait until the usb device reports it received all - * the bytes we sent */ - if ((rdlbytes == sent) && (rdlbytes != dllen)) { - if ((dllen-sent) < RDL_CHUNK) - sendlen = dllen-sent; - else - sendlen = RDL_CHUNK; - - /* simply avoid having to send a ZLP by ensuring we - * never have an even - * multiple of 64 - */ - if (!(sendlen % 64)) - sendlen -= 4; - - /* send data */ - memcpy(bulkchunk, dlpos, sendlen); - if (brcmf_usb_dl_send_bulk(devinfo, bulkchunk, - sendlen)) { - brcmf_err("send_bulk failed\n"); - err = -EINVAL; - goto fail; - } - - dlpos += sendlen; - sent += sendlen; - } - if (!brcmf_usb_dl_cmd(devinfo, DL_GETSTATE, &state, - sizeof(struct rdl_state_le))) { - brcmf_err("DL_GETSTATE Failed xxxx\n"); - err = -EINVAL; - goto fail; - } - - rdlstate = le32_to_cpu(state.state); - rdlbytes = le32_to_cpu(state.bytes); - - /* restart if an error is reported */ - if (rdlstate == DL_BAD_HDR || rdlstate == DL_BAD_CRC) { - brcmf_err("Bad Hdr or Bad CRC state %d\n", - rdlstate); - err = -EINVAL; - goto fail; - } - } - -fail: - kfree(bulkchunk); - brcmf_dbg(USB, "Exit, err=%d\n", err); - return err; -} - -static int brcmf_usb_dlstart(struct brcmf_usbdev_info *devinfo, u8 *fw, int len) -{ - int err; - - brcmf_dbg(USB, "Enter\n"); - - if (devinfo == NULL) - return -EINVAL; - - if (devinfo->bus_pub.devid == 0xDEAD) - return -EINVAL; - - err = brcmf_usb_dl_writeimage(devinfo, fw, len); - if (err == 0) - devinfo->bus_pub.state = BRCMFMAC_USB_STATE_DL_DONE; - else - devinfo->bus_pub.state = BRCMFMAC_USB_STATE_DL_FAIL; - brcmf_dbg(USB, "Exit, err=%d\n", err); - - return err; -} - -static int brcmf_usb_dlrun(struct brcmf_usbdev_info *devinfo) -{ - struct rdl_state_le state; - - brcmf_dbg(USB, "Enter\n"); - if (!devinfo) - return -EINVAL; - - if (devinfo->bus_pub.devid == 0xDEAD) - return -EINVAL; - - /* Check we are runnable */ - brcmf_usb_dl_cmd(devinfo, DL_GETSTATE, &state, - sizeof(struct rdl_state_le)); - - /* Start the image */ - if (state.state == cpu_to_le32(DL_RUNNABLE)) { - if (!brcmf_usb_dl_cmd(devinfo, DL_GO, &state, - sizeof(struct rdl_state_le))) - return -ENODEV; - if (brcmf_usb_resetcfg(devinfo)) - return -ENODEV; - /* The Dongle may go for re-enumeration. */ - } else { - brcmf_err("Dongle not runnable\n"); - return -EINVAL; - } - brcmf_dbg(USB, "Exit\n"); - return 0; -} - -static bool brcmf_usb_chip_support(int chipid, int chiprev) -{ - switch(chipid) { - case 43143: - return true; - case 43235: - case 43236: - case 43238: - return (chiprev == 3); - case 43242: - return true; - default: - break; - } - return false; -} - -static int -brcmf_usb_fw_download(struct brcmf_usbdev_info *devinfo) -{ - int devid, chiprev; - int err; - - brcmf_dbg(USB, "Enter\n"); - if (devinfo == NULL) - return -ENODEV; - - devid = devinfo->bus_pub.devid; - chiprev = devinfo->bus_pub.chiprev; - - if (!brcmf_usb_chip_support(devid, chiprev)) { - brcmf_err("unsupported chip %d rev %d\n", - devid, chiprev); - return -EINVAL; - } - - if (!devinfo->image) { - brcmf_err("No firmware!\n"); - return -ENOENT; - } - - err = brcmf_usb_dlstart(devinfo, - devinfo->image, devinfo->image_len); - if (err == 0) - err = brcmf_usb_dlrun(devinfo); - return err; -} - - -static void brcmf_usb_detach(struct brcmf_usbdev_info *devinfo) -{ - brcmf_dbg(USB, "Enter, devinfo %p\n", devinfo); - - /* free the URBS */ - brcmf_usb_free_q(&devinfo->rx_freeq, false); - brcmf_usb_free_q(&devinfo->tx_freeq, false); - - usb_free_urb(devinfo->intr_urb); - usb_free_urb(devinfo->ctl_urb); - usb_free_urb(devinfo->bulk_urb); - - kfree(devinfo->tx_reqs); - kfree(devinfo->rx_reqs); -} - -#define TRX_MAGIC 0x30524448 /* "HDR0" */ -#define TRX_VERSION 1 /* Version 1 */ -#define TRX_MAX_LEN 0x3B0000 /* Max length */ -#define TRX_NO_HEADER 1 /* Do not write TRX header */ -#define TRX_MAX_OFFSET 3 /* Max number of individual files */ -#define TRX_UNCOMP_IMAGE 0x20 /* Trx contains uncompressed image */ - -struct trx_header_le { - __le32 magic; /* "HDR0" */ - __le32 len; /* Length of file including header */ - __le32 crc32; /* CRC from flag_version to end of file */ - __le32 flag_version; /* 0:15 flags, 16:31 version */ - __le32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions from start of - * header */ -}; - -static int check_file(const u8 *headers) -{ - struct trx_header_le *trx; - int actual_len = -1; - - brcmf_dbg(USB, "Enter\n"); - /* Extract trx header */ - trx = (struct trx_header_le *) headers; - if (trx->magic != cpu_to_le32(TRX_MAGIC)) - return -1; - - headers += sizeof(struct trx_header_le); - - if (le32_to_cpu(trx->flag_version) & TRX_UNCOMP_IMAGE) { - actual_len = le32_to_cpu(trx->offsets[TRX_OFFSETS_DLFWLEN_IDX]); - return actual_len + sizeof(struct trx_header_le); - } - return -1; -} - -static int brcmf_usb_get_fw(struct brcmf_usbdev_info *devinfo) -{ - s8 *fwname; - const struct firmware *fw; - struct brcmf_usb_image *fw_image; - int err; - - brcmf_dbg(USB, "Enter\n"); - switch (devinfo->bus_pub.devid) { - case 43143: - fwname = BRCMF_USB_43143_FW_NAME; - break; - case 43235: - case 43236: - case 43238: - fwname = BRCMF_USB_43236_FW_NAME; - break; - case 43242: - fwname = BRCMF_USB_43242_FW_NAME; - break; - default: - return -EINVAL; - break; - } - brcmf_dbg(USB, "Loading FW %s\n", fwname); - list_for_each_entry(fw_image, &fw_image_list, list) { - if (fw_image->fwname == fwname) { - devinfo->image = fw_image->image; - devinfo->image_len = fw_image->image_len; - return 0; - } - } - /* fw image not yet loaded. Load it now and add to list */ - err = request_firmware(&fw, fwname, devinfo->dev); - if (!fw) { - brcmf_err("fail to request firmware %s\n", fwname); - return err; - } - if (check_file(fw->data) < 0) { - brcmf_err("invalid firmware %s\n", fwname); - return -EINVAL; - } - - fw_image = kzalloc(sizeof(*fw_image), GFP_ATOMIC); - if (!fw_image) - return -ENOMEM; - INIT_LIST_HEAD(&fw_image->list); - list_add_tail(&fw_image->list, &fw_image_list); - fw_image->fwname = fwname; - fw_image->image = vmalloc(fw->size); - if (!fw_image->image) - return -ENOMEM; - - memcpy(fw_image->image, fw->data, fw->size); - fw_image->image_len = fw->size; - - release_firmware(fw); - - devinfo->image = fw_image->image; - devinfo->image_len = fw_image->image_len; - - return 0; -} - - -static -struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo, - int nrxq, int ntxq) -{ - brcmf_dbg(USB, "Enter\n"); - - devinfo->bus_pub.nrxq = nrxq; - devinfo->rx_low_watermark = nrxq / 2; - devinfo->bus_pub.devinfo = devinfo; - devinfo->bus_pub.ntxq = ntxq; - devinfo->bus_pub.state = BRCMFMAC_USB_STATE_DOWN; - - /* flow control when too many tx urbs posted */ - devinfo->tx_low_watermark = ntxq / 4; - devinfo->tx_high_watermark = devinfo->tx_low_watermark * 3; - devinfo->bus_pub.bus_mtu = BRCMF_USB_MAX_PKT_SIZE; - - /* Initialize other structure content */ - init_waitqueue_head(&devinfo->ioctl_resp_wait); - - /* Initialize the spinlocks */ - spin_lock_init(&devinfo->qlock); - - INIT_LIST_HEAD(&devinfo->rx_freeq); - INIT_LIST_HEAD(&devinfo->rx_postq); - - INIT_LIST_HEAD(&devinfo->tx_freeq); - INIT_LIST_HEAD(&devinfo->tx_postq); - - devinfo->tx_flowblock = false; - - devinfo->rx_reqs = brcmf_usbdev_qinit(&devinfo->rx_freeq, nrxq); - if (!devinfo->rx_reqs) - goto error; - - devinfo->tx_reqs = brcmf_usbdev_qinit(&devinfo->tx_freeq, ntxq); - if (!devinfo->tx_reqs) - goto error; - devinfo->tx_freecount = ntxq; - - devinfo->intr_urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!devinfo->intr_urb) { - brcmf_err("usb_alloc_urb (intr) failed\n"); - goto error; - } - devinfo->ctl_urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!devinfo->ctl_urb) { - brcmf_err("usb_alloc_urb (ctl) failed\n"); - goto error; - } - devinfo->bulk_urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!devinfo->bulk_urb) { - brcmf_err("usb_alloc_urb (bulk) failed\n"); - goto error; - } - - if (!brcmf_usb_dlneeded(devinfo)) - return &devinfo->bus_pub; - - brcmf_dbg(USB, "Start fw downloading\n"); - if (brcmf_usb_get_fw(devinfo)) - goto error; - - if (brcmf_usb_fw_download(devinfo)) - goto error; - - return &devinfo->bus_pub; - -error: - brcmf_err("failed!\n"); - brcmf_usb_detach(devinfo); - return NULL; -} - -static struct brcmf_bus_ops brcmf_usb_bus_ops = { - .txdata = brcmf_usb_tx, - .init = brcmf_usb_up, - .stop = brcmf_usb_down, - .txctl = brcmf_usb_tx_ctlpkt, - .rxctl = brcmf_usb_rx_ctlpkt, -}; - -static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) -{ - struct brcmf_bus *bus = NULL; - struct brcmf_usbdev *bus_pub = NULL; - int ret; - struct device *dev = devinfo->dev; - - brcmf_dbg(USB, "Enter\n"); - bus_pub = brcmf_usb_attach(devinfo, BRCMF_USB_NRXQ, BRCMF_USB_NTXQ); - if (!bus_pub) - return -ENODEV; - - bus = kzalloc(sizeof(struct brcmf_bus), GFP_ATOMIC); - if (!bus) { - ret = -ENOMEM; - goto fail; - } - - bus->dev = dev; - bus_pub->bus = bus; - bus->bus_priv.usb = bus_pub; - dev_set_drvdata(dev, bus); - bus->ops = &brcmf_usb_bus_ops; - bus->chip = bus_pub->devid; - bus->chiprev = bus_pub->chiprev; - - /* Attach to the common driver interface */ - ret = brcmf_attach(0, dev); - if (ret) { - brcmf_err("brcmf_attach failed\n"); - goto fail; - } - - ret = brcmf_bus_start(dev); - if (ret) { - brcmf_err("dongle is not responding\n"); - brcmf_detach(dev); - goto fail; - } - - return 0; -fail: - /* Release resources in reverse order */ - kfree(bus); - brcmf_usb_detach(devinfo); - return ret; -} - -static void -brcmf_usb_disconnect_cb(struct brcmf_usbdev_info *devinfo) -{ - if (!devinfo) - return; - brcmf_dbg(USB, "Enter, bus_pub %p\n", devinfo); - - brcmf_detach(devinfo->dev); - kfree(devinfo->bus_pub.bus); - brcmf_usb_detach(devinfo); -} - -static int -brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) -{ - int ep; - struct usb_endpoint_descriptor *endpoint; - int ret = 0; - struct usb_device *usb = interface_to_usbdev(intf); - int num_of_eps; - u8 endpoint_num; - struct brcmf_usbdev_info *devinfo; - - brcmf_dbg(USB, "Enter\n"); - - devinfo = kzalloc(sizeof(*devinfo), GFP_ATOMIC); - if (devinfo == NULL) - return -ENOMEM; - - devinfo->usbdev = usb; - devinfo->dev = &usb->dev; - - usb_set_intfdata(intf, devinfo); - - /* Check that the device supports only one configuration */ - if (usb->descriptor.bNumConfigurations != 1) { - ret = -1; - goto fail; - } - - if (usb->descriptor.bDeviceClass != USB_CLASS_VENDOR_SPEC) { - ret = -1; - goto fail; - } - - /* - * Only the BDC interface configuration is supported: - * Device class: USB_CLASS_VENDOR_SPEC - * if0 class: USB_CLASS_VENDOR_SPEC - * if0/ep0: control - * if0/ep1: bulk in - * if0/ep2: bulk out (ok if swapped with bulk in) - */ - if (CONFIGDESC(usb)->bNumInterfaces != 1) { - ret = -1; - goto fail; - } - - /* Check interface */ - if (IFDESC(usb, CONTROL_IF).bInterfaceClass != USB_CLASS_VENDOR_SPEC || - IFDESC(usb, CONTROL_IF).bInterfaceSubClass != 2 || - IFDESC(usb, CONTROL_IF).bInterfaceProtocol != 0xff) { - brcmf_err("invalid control interface: class %d, subclass %d, proto %d\n", - IFDESC(usb, CONTROL_IF).bInterfaceClass, - IFDESC(usb, CONTROL_IF).bInterfaceSubClass, - IFDESC(usb, CONTROL_IF).bInterfaceProtocol); - ret = -1; - goto fail; - } - - /* Check control endpoint */ - endpoint = &IFEPDESC(usb, CONTROL_IF, 0); - if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) - != USB_ENDPOINT_XFER_INT) { - brcmf_err("invalid control endpoint %d\n", - endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK); - ret = -1; - goto fail; - } - - endpoint_num = endpoint->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; - devinfo->intr_pipe = usb_rcvintpipe(usb, endpoint_num); - - devinfo->rx_pipe = 0; - devinfo->rx_pipe2 = 0; - devinfo->tx_pipe = 0; - num_of_eps = IFDESC(usb, BULK_IF).bNumEndpoints - 1; - - /* Check data endpoints and get pipes */ - for (ep = 1; ep <= num_of_eps; ep++) { - endpoint = &IFEPDESC(usb, BULK_IF, ep); - if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != - USB_ENDPOINT_XFER_BULK) { - brcmf_err("invalid data endpoint %d\n", ep); - ret = -1; - goto fail; - } - - endpoint_num = endpoint->bEndpointAddress & - USB_ENDPOINT_NUMBER_MASK; - if ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) - == USB_DIR_IN) { - if (!devinfo->rx_pipe) { - devinfo->rx_pipe = - usb_rcvbulkpipe(usb, endpoint_num); - } else { - devinfo->rx_pipe2 = - usb_rcvbulkpipe(usb, endpoint_num); - } - } else { - devinfo->tx_pipe = usb_sndbulkpipe(usb, endpoint_num); - } - } - - /* Allocate interrupt URB and data buffer */ - /* RNDIS says 8-byte intr, our old drivers used 4-byte */ - if (IFEPDESC(usb, CONTROL_IF, 0).wMaxPacketSize == cpu_to_le16(16)) - devinfo->intr_size = 8; - else - devinfo->intr_size = 4; - - devinfo->interval = IFEPDESC(usb, CONTROL_IF, 0).bInterval; - - if (usb->speed == USB_SPEED_HIGH) - brcmf_dbg(USB, "Broadcom high speed USB wireless device detected\n"); - else - brcmf_dbg(USB, "Broadcom full speed USB wireless device detected\n"); - - ret = brcmf_usb_probe_cb(devinfo); - if (ret) - goto fail; - - /* Success */ - return 0; - -fail: - brcmf_err("failed with errno %d\n", ret); - kfree(devinfo); - usb_set_intfdata(intf, NULL); - return ret; - -} - -static void -brcmf_usb_disconnect(struct usb_interface *intf) -{ - struct brcmf_usbdev_info *devinfo; - - brcmf_dbg(USB, "Enter\n"); - devinfo = (struct brcmf_usbdev_info *)usb_get_intfdata(intf); - brcmf_usb_disconnect_cb(devinfo); - kfree(devinfo); - brcmf_dbg(USB, "Exit\n"); -} - -/* - * only need to signal the bus being down and update the state. - */ -static int brcmf_usb_suspend(struct usb_interface *intf, pm_message_t state) -{ - struct usb_device *usb = interface_to_usbdev(intf); - struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(&usb->dev); - - brcmf_dbg(USB, "Enter\n"); - devinfo->bus_pub.state = BRCMFMAC_USB_STATE_SLEEP; - brcmf_detach(&usb->dev); - return 0; -} - -/* - * (re-) start the bus. - */ -static int brcmf_usb_resume(struct usb_interface *intf) -{ - struct usb_device *usb = interface_to_usbdev(intf); - struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(&usb->dev); - - brcmf_dbg(USB, "Enter\n"); - if (!brcmf_attach(0, devinfo->dev)) - return brcmf_bus_start(&usb->dev); - - return 0; -} - -static int brcmf_usb_reset_resume(struct usb_interface *intf) -{ - struct usb_device *usb = interface_to_usbdev(intf); - struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(&usb->dev); - - brcmf_dbg(USB, "Enter\n"); - - if (!brcmf_usb_fw_download(devinfo)) - return brcmf_usb_resume(intf); - - return -EIO; -} - -#define BRCMF_USB_VENDOR_ID_BROADCOM 0x0a5c -#define BRCMF_USB_DEVICE_ID_43143 0xbd1e -#define BRCMF_USB_DEVICE_ID_43236 0xbd17 -#define BRCMF_USB_DEVICE_ID_43242 0xbd1f -#define BRCMF_USB_DEVICE_ID_BCMFW 0x0bdc - -static struct usb_device_id brcmf_usb_devid_table[] = { - { USB_DEVICE(BRCMF_USB_VENDOR_ID_BROADCOM, BRCMF_USB_DEVICE_ID_43143) }, - { USB_DEVICE(BRCMF_USB_VENDOR_ID_BROADCOM, BRCMF_USB_DEVICE_ID_43236) }, - { USB_DEVICE(BRCMF_USB_VENDOR_ID_BROADCOM, BRCMF_USB_DEVICE_ID_43242) }, - /* special entry for device with firmware loaded and running */ - { USB_DEVICE(BRCMF_USB_VENDOR_ID_BROADCOM, BRCMF_USB_DEVICE_ID_BCMFW) }, - { } -}; - -MODULE_DEVICE_TABLE(usb, brcmf_usb_devid_table); -MODULE_FIRMWARE(BRCMF_USB_43143_FW_NAME); -MODULE_FIRMWARE(BRCMF_USB_43236_FW_NAME); -MODULE_FIRMWARE(BRCMF_USB_43242_FW_NAME); - -static struct usb_driver brcmf_usbdrvr = { - .name = KBUILD_MODNAME, - .probe = brcmf_usb_probe, - .disconnect = brcmf_usb_disconnect, - .id_table = brcmf_usb_devid_table, - .suspend = brcmf_usb_suspend, - .resume = brcmf_usb_resume, - .reset_resume = brcmf_usb_reset_resume, - .supports_autosuspend = 1, - .disable_hub_initiated_lpm = 1, -}; - -static void brcmf_release_fw(struct list_head *q) -{ - struct brcmf_usb_image *fw_image, *next; - - list_for_each_entry_safe(fw_image, next, q, list) { - vfree(fw_image->image); - list_del_init(&fw_image->list); - } -} - -static int brcmf_usb_reset_device(struct device *dev, void *notused) -{ - /* device past is the usb interface so we - * need to use parent here. - */ - brcmf_dev_reset(dev->parent); - return 0; -} - -void brcmf_usb_exit(void) -{ - struct device_driver *drv = &brcmf_usbdrvr.drvwrap.driver; - int ret; - - brcmf_dbg(USB, "Enter\n"); - ret = driver_for_each_device(drv, NULL, NULL, - brcmf_usb_reset_device); - usb_deregister(&brcmf_usbdrvr); - brcmf_release_fw(&fw_image_list); -} - -void brcmf_usb_register(void) -{ - brcmf_dbg(USB, "Enter\n"); - INIT_LIST_HEAD(&fw_image_list); - usb_register(&brcmf_usbdrvr); -} diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.h b/drivers/net/wireless/brcm80211/brcmfmac/usb.h deleted file mode 100644 index f483a8c9945b..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2011 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef BRCMFMAC_USB_H -#define BRCMFMAC_USB_H - -enum brcmf_usb_state { - BRCMFMAC_USB_STATE_DOWN, - BRCMFMAC_USB_STATE_DL_FAIL, - BRCMFMAC_USB_STATE_DL_DONE, - BRCMFMAC_USB_STATE_UP, - BRCMFMAC_USB_STATE_SLEEP -}; - -struct brcmf_stats { - u32 tx_ctlpkts; - u32 tx_ctlerrs; - u32 rx_ctlpkts; - u32 rx_ctlerrs; -}; - -struct brcmf_usbdev { - struct brcmf_bus *bus; - struct brcmf_usbdev_info *devinfo; - enum brcmf_usb_state state; - struct brcmf_stats stats; - int ntxq, nrxq, rxsize; - u32 bus_mtu; - int devid; - int chiprev; /* chip revsion number */ -}; - -/* IO Request Block (IRB) */ -struct brcmf_usbreq { - struct list_head list; - struct brcmf_usbdev_info *devinfo; - struct urb *urb; - struct sk_buff *skb; -}; - -#endif /* BRCMFMAC_USB_H */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb_rdl.h b/drivers/net/wireless/brcm80211/brcmfmac/usb_rdl.h deleted file mode 100644 index 0a35c51c3da2..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb_rdl.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2011 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _USB_RDL_H -#define _USB_RDL_H - -/* Control messages: bRequest values */ -#define DL_GETSTATE 0 /* returns the rdl_state_t struct */ -#define DL_CHECK_CRC 1 /* currently unused */ -#define DL_GO 2 /* execute downloaded image */ -#define DL_START 3 /* initialize dl state */ -#define DL_REBOOT 4 /* reboot the device in 2 seconds */ -#define DL_GETVER 5 /* returns the bootrom_id_t struct */ -#define DL_GO_PROTECTED 6 /* execute the downloaded code and set reset - * event to occur in 2 seconds. It is the - * responsibility of the downloaded code to - * clear this event - */ -#define DL_EXEC 7 /* jump to a supplied address */ -#define DL_RESETCFG 8 /* To support single enum on dongle - * - Not used by bootloader - */ -#define DL_DEFER_RESP_OK 9 /* Potentially defer the response to setup - * if resp unavailable - */ - -/* states */ -#define DL_WAITING 0 /* waiting to rx first pkt */ -#define DL_READY 1 /* hdr was good, waiting for more of the - * compressed image */ -#define DL_BAD_HDR 2 /* hdr was corrupted */ -#define DL_BAD_CRC 3 /* compressed image was corrupted */ -#define DL_RUNNABLE 4 /* download was successful,waiting for go cmd */ -#define DL_START_FAIL 5 /* failed to initialize correctly */ -#define DL_NVRAM_TOOBIG 6 /* host specified nvram data exceeds DL_NVRAM - * value */ -#define DL_IMAGE_TOOBIG 7 /* download image too big (exceeds DATA_START - * for rdl) */ - -struct rdl_state_le { - __le32 state; - __le32 bytes; -}; - -struct bootrom_id_le { - __le32 chip; /* Chip id */ - __le32 chiprev; /* Chip rev */ - __le32 ramsize; /* Size of RAM */ - __le32 remapbase; /* Current remap base address */ - __le32 boardtype; /* Type of board */ - __le32 boardrev; /* Board revision */ -}; - -#define RDL_CHUNK 1500 /* size of each dl transfer */ - -#define TRX_OFFSETS_DLFWLEN_IDX 0 -#define TRX_OFFSETS_JUMPTO_IDX 1 -#define TRX_OFFSETS_NVM_LEN_IDX 2 - -#define TRX_OFFSETS_DLBASE_IDX 0 - -#endif /* _USB_RDL_H */ diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c deleted file mode 100644 index 301e572e8923..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ /dev/null @@ -1,5417 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* Toplevel file. Relies on dhd_linux.c to send commands to the dongle. */ - -#include -#include -#include -#include - -#include -#include -#include -#include "dhd.h" -#include "dhd_dbg.h" -#include "tracepoint.h" -#include "fwil_types.h" -#include "p2p.h" -#include "btcoex.h" -#include "wl_cfg80211.h" -#include "fwil.h" - -#define BRCMF_SCAN_IE_LEN_MAX 2048 -#define BRCMF_PNO_VERSION 2 -#define BRCMF_PNO_TIME 30 -#define BRCMF_PNO_REPEAT 4 -#define BRCMF_PNO_FREQ_EXPO_MAX 3 -#define BRCMF_PNO_MAX_PFN_COUNT 16 -#define BRCMF_PNO_ENABLE_ADAPTSCAN_BIT 6 -#define BRCMF_PNO_HIDDEN_BIT 2 -#define BRCMF_PNO_WPA_AUTH_ANY 0xFFFFFFFF -#define BRCMF_PNO_SCAN_COMPLETE 1 -#define BRCMF_PNO_SCAN_INCOMPLETE 0 - -#define BRCMF_IFACE_MAX_CNT 3 - -#define WPA_OUI "\x00\x50\xF2" /* WPA OUI */ -#define WPA_OUI_TYPE 1 -#define RSN_OUI "\x00\x0F\xAC" /* RSN OUI */ -#define WME_OUI_TYPE 2 -#define WPS_OUI_TYPE 4 - -#define VS_IE_FIXED_HDR_LEN 6 -#define WPA_IE_VERSION_LEN 2 -#define WPA_IE_MIN_OUI_LEN 4 -#define WPA_IE_SUITE_COUNT_LEN 2 - -#define WPA_CIPHER_NONE 0 /* None */ -#define WPA_CIPHER_WEP_40 1 /* WEP (40-bit) */ -#define WPA_CIPHER_TKIP 2 /* TKIP: default for WPA */ -#define WPA_CIPHER_AES_CCM 4 /* AES (CCM) */ -#define WPA_CIPHER_WEP_104 5 /* WEP (104-bit) */ - -#define RSN_AKM_NONE 0 /* None (IBSS) */ -#define RSN_AKM_UNSPECIFIED 1 /* Over 802.1x */ -#define RSN_AKM_PSK 2 /* Pre-shared Key */ -#define RSN_CAP_LEN 2 /* Length of RSN capabilities */ -#define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C - -#define VNDR_IE_CMD_LEN 4 /* length of the set command - * string :"add", "del" (+ NUL) - */ -#define VNDR_IE_COUNT_OFFSET 4 -#define VNDR_IE_PKTFLAG_OFFSET 8 -#define VNDR_IE_VSIE_OFFSET 12 -#define VNDR_IE_HDR_SIZE 12 -#define VNDR_IE_PARSE_LIMIT 5 - -#define DOT11_MGMT_HDR_LEN 24 /* d11 management header len */ -#define DOT11_BCN_PRB_FIXED_LEN 12 /* beacon/probe fixed length */ - -#define BRCMF_SCAN_JOIN_ACTIVE_DWELL_TIME_MS 320 -#define BRCMF_SCAN_JOIN_PASSIVE_DWELL_TIME_MS 400 -#define BRCMF_SCAN_JOIN_PROBE_INTERVAL_MS 20 - -#define BRCMF_ASSOC_PARAMS_FIXED_SIZE \ - (sizeof(struct brcmf_assoc_params_le) - sizeof(u16)) - -static bool check_vif_up(struct brcmf_cfg80211_vif *vif) -{ - if (!test_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state)) { - brcmf_dbg(INFO, "device is not ready : status (%lu)\n", - vif->sme_state); - return false; - } - return true; -} - -#define CHAN2G(_channel, _freq, _flags) { \ - .band = IEEE80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -#define CHAN5G(_channel, _flags) { \ - .band = IEEE80211_BAND_5GHZ, \ - .center_freq = 5000 + (5 * (_channel)), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -#define RATE_TO_BASE100KBPS(rate) (((rate) * 10) / 2) -#define RATETAB_ENT(_rateid, _flags) \ - { \ - .bitrate = RATE_TO_BASE100KBPS(_rateid), \ - .hw_value = (_rateid), \ - .flags = (_flags), \ - } - -static struct ieee80211_rate __wl_rates[] = { - RATETAB_ENT(BRCM_RATE_1M, 0), - RATETAB_ENT(BRCM_RATE_2M, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(BRCM_RATE_5M5, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(BRCM_RATE_11M, IEEE80211_RATE_SHORT_PREAMBLE), - RATETAB_ENT(BRCM_RATE_6M, 0), - RATETAB_ENT(BRCM_RATE_9M, 0), - RATETAB_ENT(BRCM_RATE_12M, 0), - RATETAB_ENT(BRCM_RATE_18M, 0), - RATETAB_ENT(BRCM_RATE_24M, 0), - RATETAB_ENT(BRCM_RATE_36M, 0), - RATETAB_ENT(BRCM_RATE_48M, 0), - RATETAB_ENT(BRCM_RATE_54M, 0), -}; - -#define wl_a_rates (__wl_rates + 4) -#define wl_a_rates_size 8 -#define wl_g_rates (__wl_rates + 0) -#define wl_g_rates_size 12 - -static struct ieee80211_channel __wl_2ghz_channels[] = { - CHAN2G(1, 2412, 0), - CHAN2G(2, 2417, 0), - CHAN2G(3, 2422, 0), - CHAN2G(4, 2427, 0), - CHAN2G(5, 2432, 0), - CHAN2G(6, 2437, 0), - CHAN2G(7, 2442, 0), - CHAN2G(8, 2447, 0), - CHAN2G(9, 2452, 0), - CHAN2G(10, 2457, 0), - CHAN2G(11, 2462, 0), - CHAN2G(12, 2467, 0), - CHAN2G(13, 2472, 0), - CHAN2G(14, 2484, 0), -}; - -static struct ieee80211_channel __wl_5ghz_a_channels[] = { - CHAN5G(34, 0), CHAN5G(36, 0), - CHAN5G(38, 0), CHAN5G(40, 0), - CHAN5G(42, 0), CHAN5G(44, 0), - CHAN5G(46, 0), CHAN5G(48, 0), - CHAN5G(52, 0), CHAN5G(56, 0), - CHAN5G(60, 0), CHAN5G(64, 0), - CHAN5G(100, 0), CHAN5G(104, 0), - CHAN5G(108, 0), CHAN5G(112, 0), - CHAN5G(116, 0), CHAN5G(120, 0), - CHAN5G(124, 0), CHAN5G(128, 0), - CHAN5G(132, 0), CHAN5G(136, 0), - CHAN5G(140, 0), CHAN5G(149, 0), - CHAN5G(153, 0), CHAN5G(157, 0), - CHAN5G(161, 0), CHAN5G(165, 0), - CHAN5G(184, 0), CHAN5G(188, 0), - CHAN5G(192, 0), CHAN5G(196, 0), - CHAN5G(200, 0), CHAN5G(204, 0), - CHAN5G(208, 0), CHAN5G(212, 0), - CHAN5G(216, 0), -}; - -static struct ieee80211_supported_band __wl_band_2ghz = { - .band = IEEE80211_BAND_2GHZ, - .channels = __wl_2ghz_channels, - .n_channels = ARRAY_SIZE(__wl_2ghz_channels), - .bitrates = wl_g_rates, - .n_bitrates = wl_g_rates_size, -}; - -static struct ieee80211_supported_band __wl_band_5ghz_a = { - .band = IEEE80211_BAND_5GHZ, - .channels = __wl_5ghz_a_channels, - .n_channels = ARRAY_SIZE(__wl_5ghz_a_channels), - .bitrates = wl_a_rates, - .n_bitrates = wl_a_rates_size, -}; - -/* This is to override regulatory domains defined in cfg80211 module (reg.c) - * By default world regulatory domain defined in reg.c puts the flags - * NL80211_RRF_PASSIVE_SCAN and NL80211_RRF_NO_IBSS for 5GHz channels (for - * 36..48 and 149..165). With respect to these flags, wpa_supplicant doesn't - * start p2p operations on 5GHz channels. All the changes in world regulatory - * domain are to be done here. - */ -static const struct ieee80211_regdomain brcmf_regdom = { - .n_reg_rules = 4, - .alpha2 = "99", - .reg_rules = { - /* IEEE 802.11b/g, channels 1..11 */ - REG_RULE(2412-10, 2472+10, 40, 6, 20, 0), - /* If any */ - /* IEEE 802.11 channel 14 - Only JP enables - * this and for 802.11b only - */ - REG_RULE(2484-10, 2484+10, 20, 6, 20, 0), - /* IEEE 802.11a, channel 36..64 */ - REG_RULE(5150-10, 5350+10, 40, 6, 20, 0), - /* IEEE 802.11a, channel 100..165 */ - REG_RULE(5470-10, 5850+10, 40, 6, 20, 0), } -}; - -static const u32 __wl_cipher_suites[] = { - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, - WLAN_CIPHER_SUITE_AES_CMAC, -}; - -/* Vendor specific ie. id = 221, oui and type defines exact ie */ -struct brcmf_vs_tlv { - u8 id; - u8 len; - u8 oui[3]; - u8 oui_type; -}; - -struct parsed_vndr_ie_info { - u8 *ie_ptr; - u32 ie_len; /* total length including id & length field */ - struct brcmf_vs_tlv vndrie; -}; - -struct parsed_vndr_ies { - u32 count; - struct parsed_vndr_ie_info ie_info[VNDR_IE_PARSE_LIMIT]; -}; - -/* Quarter dBm units to mW - * Table starts at QDBM_OFFSET, so the first entry is mW for qdBm=153 - * Table is offset so the last entry is largest mW value that fits in - * a u16. - */ - -#define QDBM_OFFSET 153 /* Offset for first entry */ -#define QDBM_TABLE_LEN 40 /* Table size */ - -/* Smallest mW value that will round up to the first table entry, QDBM_OFFSET. - * Value is ( mW(QDBM_OFFSET - 1) + mW(QDBM_OFFSET) ) / 2 - */ -#define QDBM_TABLE_LOW_BOUND 6493 /* Low bound */ - -/* Largest mW value that will round down to the last table entry, - * QDBM_OFFSET + QDBM_TABLE_LEN-1. - * Value is ( mW(QDBM_OFFSET + QDBM_TABLE_LEN - 1) + - * mW(QDBM_OFFSET + QDBM_TABLE_LEN) ) / 2. - */ -#define QDBM_TABLE_HIGH_BOUND 64938 /* High bound */ - -static const u16 nqdBm_to_mW_map[QDBM_TABLE_LEN] = { -/* qdBm: +0 +1 +2 +3 +4 +5 +6 +7 */ -/* 153: */ 6683, 7079, 7499, 7943, 8414, 8913, 9441, 10000, -/* 161: */ 10593, 11220, 11885, 12589, 13335, 14125, 14962, 15849, -/* 169: */ 16788, 17783, 18836, 19953, 21135, 22387, 23714, 25119, -/* 177: */ 26607, 28184, 29854, 31623, 33497, 35481, 37584, 39811, -/* 185: */ 42170, 44668, 47315, 50119, 53088, 56234, 59566, 63096 -}; - -static u16 brcmf_qdbm_to_mw(u8 qdbm) -{ - uint factor = 1; - int idx = qdbm - QDBM_OFFSET; - - if (idx >= QDBM_TABLE_LEN) - /* clamp to max u16 mW value */ - return 0xFFFF; - - /* scale the qdBm index up to the range of the table 0-40 - * where an offset of 40 qdBm equals a factor of 10 mW. - */ - while (idx < 0) { - idx += 40; - factor *= 10; - } - - /* return the mW value scaled down to the correct factor of 10, - * adding in factor/2 to get proper rounding. - */ - return (nqdBm_to_mW_map[idx] + factor / 2) / factor; -} - -static u8 brcmf_mw_to_qdbm(u16 mw) -{ - u8 qdbm; - int offset; - uint mw_uint = mw; - uint boundary; - - /* handle boundary case */ - if (mw_uint <= 1) - return 0; - - offset = QDBM_OFFSET; - - /* move mw into the range of the table */ - while (mw_uint < QDBM_TABLE_LOW_BOUND) { - mw_uint *= 10; - offset -= 40; - } - - for (qdbm = 0; qdbm < QDBM_TABLE_LEN - 1; qdbm++) { - boundary = nqdBm_to_mW_map[qdbm] + (nqdBm_to_mW_map[qdbm + 1] - - nqdBm_to_mW_map[qdbm]) / 2; - if (mw_uint < boundary) - break; - } - - qdbm += (u8) offset; - - return qdbm; -} - -u16 channel_to_chanspec(struct brcmu_d11inf *d11inf, - struct ieee80211_channel *ch) -{ - struct brcmu_chan ch_inf; - - ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq); - ch_inf.bw = BRCMU_CHAN_BW_20; - d11inf->encchspec(&ch_inf); - - return ch_inf.chspec; -} - -/* Traverse a string of 1-byte tag/1-byte length/variable-length value - * triples, returning a pointer to the substring whose first element - * matches tag - */ -struct brcmf_tlv *brcmf_parse_tlvs(void *buf, int buflen, uint key) -{ - struct brcmf_tlv *elt; - int totlen; - - elt = (struct brcmf_tlv *)buf; - totlen = buflen; - - /* find tagged parameter */ - while (totlen >= TLV_HDR_LEN) { - int len = elt->len; - - /* validate remaining totlen */ - if ((elt->id == key) && (totlen >= (len + TLV_HDR_LEN))) - return elt; - - elt = (struct brcmf_tlv *)((u8 *)elt + (len + TLV_HDR_LEN)); - totlen -= (len + TLV_HDR_LEN); - } - - return NULL; -} - -/* Is any of the tlvs the expected entry? If - * not update the tlvs buffer pointer/length. - */ -static bool -brcmf_tlv_has_ie(u8 *ie, u8 **tlvs, u32 *tlvs_len, - u8 *oui, u32 oui_len, u8 type) -{ - /* If the contents match the OUI and the type */ - if (ie[TLV_LEN_OFF] >= oui_len + 1 && - !memcmp(&ie[TLV_BODY_OFF], oui, oui_len) && - type == ie[TLV_BODY_OFF + oui_len]) { - return true; - } - - if (tlvs == NULL) - return false; - /* point to the next ie */ - ie += ie[TLV_LEN_OFF] + TLV_HDR_LEN; - /* calculate the length of the rest of the buffer */ - *tlvs_len -= (int)(ie - *tlvs); - /* update the pointer to the start of the buffer */ - *tlvs = ie; - - return false; -} - -static struct brcmf_vs_tlv * -brcmf_find_wpaie(u8 *parse, u32 len) -{ - struct brcmf_tlv *ie; - - while ((ie = brcmf_parse_tlvs(parse, len, WLAN_EID_VENDOR_SPECIFIC))) { - if (brcmf_tlv_has_ie((u8 *)ie, &parse, &len, - WPA_OUI, TLV_OUI_LEN, WPA_OUI_TYPE)) - return (struct brcmf_vs_tlv *)ie; - } - return NULL; -} - -static struct brcmf_vs_tlv * -brcmf_find_wpsie(u8 *parse, u32 len) -{ - struct brcmf_tlv *ie; - - while ((ie = brcmf_parse_tlvs(parse, len, WLAN_EID_VENDOR_SPECIFIC))) { - if (brcmf_tlv_has_ie((u8 *)ie, &parse, &len, - WPA_OUI, TLV_OUI_LEN, WPS_OUI_TYPE)) - return (struct brcmf_vs_tlv *)ie; - } - return NULL; -} - - -static void convert_key_from_CPU(struct brcmf_wsec_key *key, - struct brcmf_wsec_key_le *key_le) -{ - key_le->index = cpu_to_le32(key->index); - key_le->len = cpu_to_le32(key->len); - key_le->algo = cpu_to_le32(key->algo); - key_le->flags = cpu_to_le32(key->flags); - key_le->rxiv.hi = cpu_to_le32(key->rxiv.hi); - key_le->rxiv.lo = cpu_to_le16(key->rxiv.lo); - key_le->iv_initialized = cpu_to_le32(key->iv_initialized); - memcpy(key_le->data, key->data, sizeof(key->data)); - memcpy(key_le->ea, key->ea, sizeof(key->ea)); -} - -static int -send_key_to_dongle(struct net_device *ndev, struct brcmf_wsec_key *key) -{ - int err; - struct brcmf_wsec_key_le key_le; - - convert_key_from_CPU(key, &key_le); - - brcmf_netdev_wait_pend8021x(ndev); - - err = brcmf_fil_bsscfg_data_set(netdev_priv(ndev), "wsec_key", &key_le, - sizeof(key_le)); - - if (err) - brcmf_err("wsec_key error (%d)\n", err); - return err; -} - -static s32 -brcmf_configure_arp_offload(struct brcmf_if *ifp, bool enable) -{ - s32 err; - u32 mode; - - if (enable) - mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY; - else - mode = 0; - - /* Try to set and enable ARP offload feature, this may fail, then it */ - /* is simply not supported and err 0 will be returned */ - err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode); - if (err) { - brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n", - mode, err); - err = 0; - } else { - err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable); - if (err) { - brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n", - enable, err); - err = 0; - } else - brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n", - enable, mode); - } - - return err; -} - -static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy, - const char *name, - enum nl80211_iftype type, - u32 *flags, - struct vif_params *params) -{ - brcmf_dbg(TRACE, "enter: %s type %d\n", name, type); - switch (type) { - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_WDS: - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_MESH_POINT: - return ERR_PTR(-EOPNOTSUPP); - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_P2P_GO: - case NL80211_IFTYPE_P2P_DEVICE: - return brcmf_p2p_add_vif(wiphy, name, type, flags, params); - case NL80211_IFTYPE_UNSPECIFIED: - default: - return ERR_PTR(-EINVAL); - } -} - -void brcmf_set_mpc(struct brcmf_if *ifp, int mpc) -{ - s32 err = 0; - - if (check_vif_up(ifp->vif)) { - err = brcmf_fil_iovar_int_set(ifp, "mpc", mpc); - if (err) { - brcmf_err("fail to set mpc\n"); - return; - } - brcmf_dbg(INFO, "MPC : %d\n", mpc); - } -} - -s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, - struct brcmf_if *ifp, bool aborted, - bool fw_abort) -{ - struct brcmf_scan_params_le params_le; - struct cfg80211_scan_request *scan_request; - s32 err = 0; - - brcmf_dbg(SCAN, "Enter\n"); - - /* clear scan request, because the FW abort can cause a second call */ - /* to this functon and might cause a double cfg80211_scan_done */ - scan_request = cfg->scan_request; - cfg->scan_request = NULL; - - if (timer_pending(&cfg->escan_timeout)) - del_timer_sync(&cfg->escan_timeout); - - if (fw_abort) { - /* Do a scan abort to stop the driver's scan engine */ - brcmf_dbg(SCAN, "ABORT scan in firmware\n"); - memset(¶ms_le, 0, sizeof(params_le)); - memset(params_le.bssid, 0xFF, ETH_ALEN); - params_le.bss_type = DOT11_BSSTYPE_ANY; - params_le.scan_type = 0; - params_le.channel_num = cpu_to_le32(1); - params_le.nprobes = cpu_to_le32(1); - params_le.active_time = cpu_to_le32(-1); - params_le.passive_time = cpu_to_le32(-1); - params_le.home_time = cpu_to_le32(-1); - /* Scan is aborted by setting channel_list[0] to -1 */ - params_le.channel_list[0] = cpu_to_le16(-1); - /* E-Scan (or anyother type) can be aborted by SCAN */ - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN, - ¶ms_le, sizeof(params_le)); - if (err) - brcmf_err("Scan abort failed\n"); - } - /* - * e-scan can be initiated by scheduled scan - * which takes precedence. - */ - if (cfg->sched_escan) { - brcmf_dbg(SCAN, "scheduled scan completed\n"); - cfg->sched_escan = false; - if (!aborted) - cfg80211_sched_scan_results(cfg_to_wiphy(cfg)); - brcmf_set_mpc(ifp, 1); - } else if (scan_request) { - brcmf_dbg(SCAN, "ESCAN Completed scan: %s\n", - aborted ? "Aborted" : "Done"); - cfg80211_scan_done(scan_request, aborted); - brcmf_set_mpc(ifp, 1); - } - if (!test_and_clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) - brcmf_dbg(SCAN, "Scan complete, probably P2P scan\n"); - - return err; -} - -static -int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev) -{ - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); - struct net_device *ndev = wdev->netdev; - - /* vif event pending in firmware */ - if (brcmf_cfg80211_vif_event_armed(cfg)) - return -EBUSY; - - if (ndev) { - if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status) && - cfg->escan_info.ifp == netdev_priv(ndev)) - brcmf_notify_escan_complete(cfg, netdev_priv(ndev), - true, true); - - brcmf_fil_iovar_int_set(netdev_priv(ndev), "mpc", 1); - } - - switch (wdev->iftype) { - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_WDS: - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_MESH_POINT: - return -EOPNOTSUPP; - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_P2P_GO: - case NL80211_IFTYPE_P2P_DEVICE: - return brcmf_p2p_del_vif(wiphy, wdev); - case NL80211_IFTYPE_UNSPECIFIED: - default: - return -EINVAL; - } - return -EOPNOTSUPP; -} - -static s32 -brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -{ - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_cfg80211_vif *vif = ifp->vif; - s32 infra = 0; - s32 ap = 0; - s32 err = 0; - - brcmf_dbg(TRACE, "Enter, ndev=%p, type=%d\n", ndev, type); - - switch (type) { - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_WDS: - brcmf_err("type (%d) : currently we do not support this type\n", - type); - return -EOPNOTSUPP; - case NL80211_IFTYPE_ADHOC: - vif->mode = WL_MODE_IBSS; - infra = 0; - break; - case NL80211_IFTYPE_STATION: - /* Ignore change for p2p IF. Unclear why supplicant does this */ - if ((vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) || - (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO)) { - brcmf_dbg(TRACE, "Ignoring cmd for p2p if\n"); - /* WAR: It is unexpected to get a change of VIF for P2P - * IF, but it happens. The request can not be handled - * but returning EPERM causes a crash. Returning 0 - * without setting ieee80211_ptr->iftype causes trace - * (WARN_ON) but it works with wpa_supplicant - */ - return 0; - } - vif->mode = WL_MODE_BSS; - infra = 1; - break; - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_P2P_GO: - vif->mode = WL_MODE_AP; - ap = 1; - break; - default: - err = -EINVAL; - goto done; - } - - if (ap) { - if (type == NL80211_IFTYPE_P2P_GO) { - brcmf_dbg(INFO, "IF Type = P2P GO\n"); - err = brcmf_p2p_ifchange(cfg, BRCMF_FIL_P2P_IF_GO); - } - if (!err) { - set_bit(BRCMF_VIF_STATUS_AP_CREATING, &vif->sme_state); - brcmf_dbg(INFO, "IF Type = AP\n"); - } - } else { - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra); - if (err) { - brcmf_err("WLC_SET_INFRA error (%d)\n", err); - err = -EAGAIN; - goto done; - } - brcmf_dbg(INFO, "IF Type = %s\n", (vif->mode == WL_MODE_IBSS) ? - "Adhoc" : "Infra"); - } - ndev->ieee80211_ptr->iftype = type; - -done: - brcmf_dbg(TRACE, "Exit\n"); - - return err; -} - -static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg, - struct brcmf_scan_params_le *params_le, - struct cfg80211_scan_request *request) -{ - u32 n_ssids; - u32 n_channels; - s32 i; - s32 offset; - u16 chanspec; - char *ptr; - struct brcmf_ssid_le ssid_le; - - memset(params_le->bssid, 0xFF, ETH_ALEN); - params_le->bss_type = DOT11_BSSTYPE_ANY; - params_le->scan_type = 0; - params_le->channel_num = 0; - params_le->nprobes = cpu_to_le32(-1); - params_le->active_time = cpu_to_le32(-1); - params_le->passive_time = cpu_to_le32(-1); - params_le->home_time = cpu_to_le32(-1); - memset(¶ms_le->ssid_le, 0, sizeof(params_le->ssid_le)); - - /* if request is null exit so it will be all channel broadcast scan */ - if (!request) - return; - - n_ssids = request->n_ssids; - n_channels = request->n_channels; - /* Copy channel array if applicable */ - brcmf_dbg(SCAN, "### List of channelspecs to scan ### %d\n", - n_channels); - if (n_channels > 0) { - for (i = 0; i < n_channels; i++) { - chanspec = channel_to_chanspec(&cfg->d11inf, - request->channels[i]); - brcmf_dbg(SCAN, "Chan : %d, Channel spec: %x\n", - request->channels[i]->hw_value, chanspec); - params_le->channel_list[i] = cpu_to_le16(chanspec); - } - } else { - brcmf_dbg(SCAN, "Scanning all channels\n"); - } - /* Copy ssid array if applicable */ - brcmf_dbg(SCAN, "### List of SSIDs to scan ### %d\n", n_ssids); - if (n_ssids > 0) { - offset = offsetof(struct brcmf_scan_params_le, channel_list) + - n_channels * sizeof(u16); - offset = roundup(offset, sizeof(u32)); - ptr = (char *)params_le + offset; - for (i = 0; i < n_ssids; i++) { - memset(&ssid_le, 0, sizeof(ssid_le)); - ssid_le.SSID_len = - cpu_to_le32(request->ssids[i].ssid_len); - memcpy(ssid_le.SSID, request->ssids[i].ssid, - request->ssids[i].ssid_len); - if (!ssid_le.SSID_len) - brcmf_dbg(SCAN, "%d: Broadcast scan\n", i); - else - brcmf_dbg(SCAN, "%d: scan for %s size =%d\n", - i, ssid_le.SSID, ssid_le.SSID_len); - memcpy(ptr, &ssid_le, sizeof(ssid_le)); - ptr += sizeof(ssid_le); - } - } else { - brcmf_dbg(SCAN, "Broadcast scan %p\n", request->ssids); - if ((request->ssids) && request->ssids->ssid_len) { - brcmf_dbg(SCAN, "SSID %s len=%d\n", - params_le->ssid_le.SSID, - request->ssids->ssid_len); - params_le->ssid_le.SSID_len = - cpu_to_le32(request->ssids->ssid_len); - memcpy(¶ms_le->ssid_le.SSID, request->ssids->ssid, - request->ssids->ssid_len); - } - } - /* Adding mask to channel numbers */ - params_le->channel_num = - cpu_to_le32((n_ssids << BRCMF_SCAN_PARAMS_NSSID_SHIFT) | - (n_channels & BRCMF_SCAN_PARAMS_COUNT_MASK)); -} - -static s32 -brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, - struct cfg80211_scan_request *request, u16 action) -{ - s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE + - offsetof(struct brcmf_escan_params_le, params_le); - struct brcmf_escan_params_le *params; - s32 err = 0; - - brcmf_dbg(SCAN, "E-SCAN START\n"); - - if (request != NULL) { - /* Allocate space for populating ssids in struct */ - params_size += sizeof(u32) * ((request->n_channels + 1) / 2); - - /* Allocate space for populating ssids in struct */ - params_size += sizeof(struct brcmf_ssid) * request->n_ssids; - } - - params = kzalloc(params_size, GFP_KERNEL); - if (!params) { - err = -ENOMEM; - goto exit; - } - BUG_ON(params_size + sizeof("escan") >= BRCMF_DCMD_MEDLEN); - brcmf_escan_prep(cfg, ¶ms->params_le, request); - params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION); - params->action = cpu_to_le16(action); - params->sync_id = cpu_to_le16(0x1234); - - err = brcmf_fil_iovar_data_set(ifp, "escan", params, params_size); - if (err) { - if (err == -EBUSY) - brcmf_dbg(INFO, "system busy : escan canceled\n"); - else - brcmf_err("error (%d)\n", err); - } - - kfree(params); -exit: - return err; -} - -static s32 -brcmf_do_escan(struct brcmf_cfg80211_info *cfg, struct wiphy *wiphy, - struct brcmf_if *ifp, struct cfg80211_scan_request *request) -{ - s32 err; - u32 passive_scan; - struct brcmf_scan_results *results; - struct escan_info *escan = &cfg->escan_info; - - brcmf_dbg(SCAN, "Enter\n"); - escan->ifp = ifp; - escan->wiphy = wiphy; - escan->escan_state = WL_ESCAN_STATE_SCANNING; - passive_scan = cfg->active_scan ? 0 : 1; - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PASSIVE_SCAN, - passive_scan); - if (err) { - brcmf_err("error (%d)\n", err); - return err; - } - brcmf_set_mpc(ifp, 0); - results = (struct brcmf_scan_results *)cfg->escan_info.escan_buf; - results->version = 0; - results->count = 0; - results->buflen = WL_ESCAN_RESULTS_FIXED_SIZE; - - err = escan->run(cfg, ifp, request, WL_ESCAN_ACTION_START); - if (err) - brcmf_set_mpc(ifp, 1); - return err; -} - -static s32 -brcmf_cfg80211_escan(struct wiphy *wiphy, struct brcmf_cfg80211_vif *vif, - struct cfg80211_scan_request *request, - struct cfg80211_ssid *this_ssid) -{ - struct brcmf_if *ifp = vif->ifp; - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct cfg80211_ssid *ssids; - struct brcmf_cfg80211_scan_req *sr = &cfg->scan_req_int; - u32 passive_scan; - bool escan_req; - bool spec_scan; - s32 err; - u32 SSID_len; - - brcmf_dbg(SCAN, "START ESCAN\n"); - - if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { - brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status); - return -EAGAIN; - } - if (test_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status)) { - brcmf_err("Scanning being aborted: status (%lu)\n", - cfg->scan_status); - return -EAGAIN; - } - if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) { - brcmf_err("Scanning suppressed: status (%lu)\n", - cfg->scan_status); - return -EAGAIN; - } - if (test_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)) { - brcmf_err("Connecting: status (%lu)\n", ifp->vif->sme_state); - return -EAGAIN; - } - - /* If scan req comes for p2p0, send it over primary I/F */ - if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif) - vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; - - /* Arm scan timeout timer */ - mod_timer(&cfg->escan_timeout, jiffies + - WL_ESCAN_TIMER_INTERVAL_MS * HZ / 1000); - - escan_req = false; - if (request) { - /* scan bss */ - ssids = request->ssids; - escan_req = true; - } else { - /* scan in ibss */ - /* we don't do escan in ibss */ - ssids = this_ssid; - } - - cfg->scan_request = request; - set_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); - if (escan_req) { - cfg->escan_info.run = brcmf_run_escan; - err = brcmf_p2p_scan_prep(wiphy, request, vif); - if (err) - goto scan_out; - - err = brcmf_do_escan(cfg, wiphy, vif->ifp, request); - if (err) - goto scan_out; - } else { - brcmf_dbg(SCAN, "ssid \"%s\", ssid_len (%d)\n", - ssids->ssid, ssids->ssid_len); - memset(&sr->ssid_le, 0, sizeof(sr->ssid_le)); - SSID_len = min_t(u8, sizeof(sr->ssid_le.SSID), ssids->ssid_len); - sr->ssid_le.SSID_len = cpu_to_le32(0); - spec_scan = false; - if (SSID_len) { - memcpy(sr->ssid_le.SSID, ssids->ssid, SSID_len); - sr->ssid_le.SSID_len = cpu_to_le32(SSID_len); - spec_scan = true; - } else - brcmf_dbg(SCAN, "Broadcast scan\n"); - - passive_scan = cfg->active_scan ? 0 : 1; - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PASSIVE_SCAN, - passive_scan); - if (err) { - brcmf_err("WLC_SET_PASSIVE_SCAN error (%d)\n", err); - goto scan_out; - } - brcmf_set_mpc(ifp, 0); - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN, - &sr->ssid_le, sizeof(sr->ssid_le)); - if (err) { - if (err == -EBUSY) - brcmf_dbg(INFO, "BUSY: scan for \"%s\" canceled\n", - sr->ssid_le.SSID); - else - brcmf_err("WLC_SCAN error (%d)\n", err); - - brcmf_set_mpc(ifp, 1); - goto scan_out; - } - } - - return 0; - -scan_out: - clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); - if (timer_pending(&cfg->escan_timeout)) - del_timer_sync(&cfg->escan_timeout); - cfg->scan_request = NULL; - return err; -} - -static s32 -brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) -{ - struct brcmf_cfg80211_vif *vif; - s32 err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - vif = container_of(request->wdev, struct brcmf_cfg80211_vif, wdev); - if (!check_vif_up(vif)) - return -EIO; - - err = brcmf_cfg80211_escan(wiphy, vif, request, NULL); - - if (err) - brcmf_err("scan error (%d)\n", err); - - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 brcmf_set_rts(struct net_device *ndev, u32 rts_threshold) -{ - s32 err = 0; - - err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "rtsthresh", - rts_threshold); - if (err) - brcmf_err("Error (%d)\n", err); - - return err; -} - -static s32 brcmf_set_frag(struct net_device *ndev, u32 frag_threshold) -{ - s32 err = 0; - - err = brcmf_fil_iovar_int_set(netdev_priv(ndev), "fragthresh", - frag_threshold); - if (err) - brcmf_err("Error (%d)\n", err); - - return err; -} - -static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l) -{ - s32 err = 0; - u32 cmd = (l ? BRCMF_C_SET_LRL : BRCMF_C_SET_SRL); - - err = brcmf_fil_cmd_int_set(netdev_priv(ndev), cmd, retry); - if (err) { - brcmf_err("cmd (%d) , error (%d)\n", cmd, err); - return err; - } - return err; -} - -static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct net_device *ndev = cfg_to_ndev(cfg); - struct brcmf_if *ifp = netdev_priv(ndev); - s32 err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - if (!check_vif_up(ifp->vif)) - return -EIO; - - if (changed & WIPHY_PARAM_RTS_THRESHOLD && - (cfg->conf->rts_threshold != wiphy->rts_threshold)) { - cfg->conf->rts_threshold = wiphy->rts_threshold; - err = brcmf_set_rts(ndev, cfg->conf->rts_threshold); - if (!err) - goto done; - } - if (changed & WIPHY_PARAM_FRAG_THRESHOLD && - (cfg->conf->frag_threshold != wiphy->frag_threshold)) { - cfg->conf->frag_threshold = wiphy->frag_threshold; - err = brcmf_set_frag(ndev, cfg->conf->frag_threshold); - if (!err) - goto done; - } - if (changed & WIPHY_PARAM_RETRY_LONG - && (cfg->conf->retry_long != wiphy->retry_long)) { - cfg->conf->retry_long = wiphy->retry_long; - err = brcmf_set_retry(ndev, cfg->conf->retry_long, true); - if (!err) - goto done; - } - if (changed & WIPHY_PARAM_RETRY_SHORT - && (cfg->conf->retry_short != wiphy->retry_short)) { - cfg->conf->retry_short = wiphy->retry_short; - err = brcmf_set_retry(ndev, cfg->conf->retry_short, false); - if (!err) - goto done; - } - -done: - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static void brcmf_init_prof(struct brcmf_cfg80211_profile *prof) -{ - memset(prof, 0, sizeof(*prof)); -} - -static void brcmf_link_down(struct brcmf_cfg80211_vif *vif) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy); - s32 err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - - if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state)) { - brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n "); - err = brcmf_fil_cmd_data_set(vif->ifp, - BRCMF_C_DISASSOC, NULL, 0); - if (err) - brcmf_err("WLC_DISASSOC failed (%d)\n", err); - clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state); - } - clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state); - clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status); - brcmf_btcoex_set_mode(vif, BRCMF_BTCOEX_ENABLED, 0); - brcmf_dbg(TRACE, "Exit\n"); -} - -static s32 -brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_ibss_params *params) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; - struct brcmf_join_params join_params; - size_t join_params_size = 0; - s32 err = 0; - s32 wsec = 0; - s32 bcnprd; - u16 chanspec; - - brcmf_dbg(TRACE, "Enter\n"); - if (!check_vif_up(ifp->vif)) - return -EIO; - - if (params->ssid) - brcmf_dbg(CONN, "SSID: %s\n", params->ssid); - else { - brcmf_dbg(CONN, "SSID: NULL, Not supported\n"); - return -EOPNOTSUPP; - } - - set_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); - - if (params->bssid) - brcmf_dbg(CONN, "BSSID: %pM\n", params->bssid); - else - brcmf_dbg(CONN, "No BSSID specified\n"); - - if (params->chandef.chan) - brcmf_dbg(CONN, "channel: %d\n", - params->chandef.chan->center_freq); - else - brcmf_dbg(CONN, "no channel specified\n"); - - if (params->channel_fixed) - brcmf_dbg(CONN, "fixed channel required\n"); - else - brcmf_dbg(CONN, "no fixed channel required\n"); - - if (params->ie && params->ie_len) - brcmf_dbg(CONN, "ie len: %d\n", params->ie_len); - else - brcmf_dbg(CONN, "no ie specified\n"); - - if (params->beacon_interval) - brcmf_dbg(CONN, "beacon interval: %d\n", - params->beacon_interval); - else - brcmf_dbg(CONN, "no beacon interval specified\n"); - - if (params->basic_rates) - brcmf_dbg(CONN, "basic rates: %08X\n", params->basic_rates); - else - brcmf_dbg(CONN, "no basic rates specified\n"); - - if (params->privacy) - brcmf_dbg(CONN, "privacy required\n"); - else - brcmf_dbg(CONN, "no privacy required\n"); - - /* Configure Privacy for starter */ - if (params->privacy) - wsec |= WEP_ENABLED; - - err = brcmf_fil_iovar_int_set(ifp, "wsec", wsec); - if (err) { - brcmf_err("wsec failed (%d)\n", err); - goto done; - } - - /* Configure Beacon Interval for starter */ - if (params->beacon_interval) - bcnprd = params->beacon_interval; - else - bcnprd = 100; - - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, bcnprd); - if (err) { - brcmf_err("WLC_SET_BCNPRD failed (%d)\n", err); - goto done; - } - - /* Configure required join parameter */ - memset(&join_params, 0, sizeof(struct brcmf_join_params)); - - /* SSID */ - profile->ssid.SSID_len = min_t(u32, params->ssid_len, 32); - memcpy(profile->ssid.SSID, params->ssid, profile->ssid.SSID_len); - memcpy(join_params.ssid_le.SSID, params->ssid, profile->ssid.SSID_len); - join_params.ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len); - join_params_size = sizeof(join_params.ssid_le); - - /* BSSID */ - if (params->bssid) { - memcpy(join_params.params_le.bssid, params->bssid, ETH_ALEN); - join_params_size = sizeof(join_params.ssid_le) + - BRCMF_ASSOC_PARAMS_FIXED_SIZE; - memcpy(profile->bssid, params->bssid, ETH_ALEN); - } else { - memset(join_params.params_le.bssid, 0xFF, ETH_ALEN); - memset(profile->bssid, 0, ETH_ALEN); - } - - /* Channel */ - if (params->chandef.chan) { - u32 target_channel; - - cfg->channel = - ieee80211_frequency_to_channel( - params->chandef.chan->center_freq); - if (params->channel_fixed) { - /* adding chanspec */ - chanspec = channel_to_chanspec(&cfg->d11inf, - params->chandef.chan); - join_params.params_le.chanspec_list[0] = - cpu_to_le16(chanspec); - join_params.params_le.chanspec_num = cpu_to_le32(1); - join_params_size += sizeof(join_params.params_le); - } - - /* set channel for starter */ - target_channel = cfg->channel; - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_CHANNEL, - target_channel); - if (err) { - brcmf_err("WLC_SET_CHANNEL failed (%d)\n", err); - goto done; - } - } else - cfg->channel = 0; - - cfg->ibss_starter = false; - - - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, - &join_params, join_params_size); - if (err) { - brcmf_err("WLC_SET_SSID failed (%d)\n", err); - goto done; - } - -done: - if (err) - clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 -brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - s32 err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - if (!check_vif_up(ifp->vif)) - return -EIO; - - brcmf_link_down(ifp->vif); - - brcmf_dbg(TRACE, "Exit\n"); - - return err; -} - -static s32 brcmf_set_wpa_version(struct net_device *ndev, - struct cfg80211_connect_params *sme) -{ - struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); - struct brcmf_cfg80211_security *sec; - s32 val = 0; - s32 err = 0; - - if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) - val = WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED; - else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) - val = WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED; - else - val = WPA_AUTH_DISABLED; - brcmf_dbg(CONN, "setting wpa_auth to 0x%0x\n", val); - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wpa_auth", val); - if (err) { - brcmf_err("set wpa_auth failed (%d)\n", err); - return err; - } - sec = &profile->sec; - sec->wpa_versions = sme->crypto.wpa_versions; - return err; -} - -static s32 brcmf_set_auth_type(struct net_device *ndev, - struct cfg80211_connect_params *sme) -{ - struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); - struct brcmf_cfg80211_security *sec; - s32 val = 0; - s32 err = 0; - - switch (sme->auth_type) { - case NL80211_AUTHTYPE_OPEN_SYSTEM: - val = 0; - brcmf_dbg(CONN, "open system\n"); - break; - case NL80211_AUTHTYPE_SHARED_KEY: - val = 1; - brcmf_dbg(CONN, "shared key\n"); - break; - case NL80211_AUTHTYPE_AUTOMATIC: - val = 2; - brcmf_dbg(CONN, "automatic\n"); - break; - case NL80211_AUTHTYPE_NETWORK_EAP: - brcmf_dbg(CONN, "network eap\n"); - default: - val = 2; - brcmf_err("invalid auth type (%d)\n", sme->auth_type); - break; - } - - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val); - if (err) { - brcmf_err("set auth failed (%d)\n", err); - return err; - } - sec = &profile->sec; - sec->auth_type = sme->auth_type; - return err; -} - -static s32 -brcmf_set_set_cipher(struct net_device *ndev, - struct cfg80211_connect_params *sme) -{ - struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); - struct brcmf_cfg80211_security *sec; - s32 pval = 0; - s32 gval = 0; - s32 err = 0; - - if (sme->crypto.n_ciphers_pairwise) { - switch (sme->crypto.ciphers_pairwise[0]) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - pval = WEP_ENABLED; - break; - case WLAN_CIPHER_SUITE_TKIP: - pval = TKIP_ENABLED; - break; - case WLAN_CIPHER_SUITE_CCMP: - pval = AES_ENABLED; - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - pval = AES_ENABLED; - break; - default: - brcmf_err("invalid cipher pairwise (%d)\n", - sme->crypto.ciphers_pairwise[0]); - return -EINVAL; - } - } - if (sme->crypto.cipher_group) { - switch (sme->crypto.cipher_group) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - gval = WEP_ENABLED; - break; - case WLAN_CIPHER_SUITE_TKIP: - gval = TKIP_ENABLED; - break; - case WLAN_CIPHER_SUITE_CCMP: - gval = AES_ENABLED; - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - gval = AES_ENABLED; - break; - default: - brcmf_err("invalid cipher group (%d)\n", - sme->crypto.cipher_group); - return -EINVAL; - } - } - - brcmf_dbg(CONN, "pval (%d) gval (%d)\n", pval, gval); - /* In case of privacy, but no security and WPS then simulate */ - /* setting AES. WPS-2.0 allows no security */ - if (brcmf_find_wpsie(sme->ie, sme->ie_len) && !pval && !gval && - sme->privacy) - pval = AES_ENABLED; - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "wsec", pval | gval); - if (err) { - brcmf_err("error (%d)\n", err); - return err; - } - - sec = &profile->sec; - sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0]; - sec->cipher_group = sme->crypto.cipher_group; - - return err; -} - -static s32 -brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme) -{ - struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); - struct brcmf_cfg80211_security *sec; - s32 val = 0; - s32 err = 0; - - if (sme->crypto.n_akm_suites) { - err = brcmf_fil_bsscfg_int_get(netdev_priv(ndev), - "wpa_auth", &val); - if (err) { - brcmf_err("could not get wpa_auth (%d)\n", err); - return err; - } - if (val & (WPA_AUTH_PSK | WPA_AUTH_UNSPECIFIED)) { - switch (sme->crypto.akm_suites[0]) { - case WLAN_AKM_SUITE_8021X: - val = WPA_AUTH_UNSPECIFIED; - break; - case WLAN_AKM_SUITE_PSK: - val = WPA_AUTH_PSK; - break; - default: - brcmf_err("invalid cipher group (%d)\n", - sme->crypto.cipher_group); - return -EINVAL; - } - } else if (val & (WPA2_AUTH_PSK | WPA2_AUTH_UNSPECIFIED)) { - switch (sme->crypto.akm_suites[0]) { - case WLAN_AKM_SUITE_8021X: - val = WPA2_AUTH_UNSPECIFIED; - break; - case WLAN_AKM_SUITE_PSK: - val = WPA2_AUTH_PSK; - break; - default: - brcmf_err("invalid cipher group (%d)\n", - sme->crypto.cipher_group); - return -EINVAL; - } - } - - brcmf_dbg(CONN, "setting wpa_auth to %d\n", val); - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), - "wpa_auth", val); - if (err) { - brcmf_err("could not set wpa_auth (%d)\n", err); - return err; - } - } - sec = &profile->sec; - sec->wpa_auth = sme->crypto.akm_suites[0]; - - return err; -} - -static s32 -brcmf_set_sharedkey(struct net_device *ndev, - struct cfg80211_connect_params *sme) -{ - struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); - struct brcmf_cfg80211_security *sec; - struct brcmf_wsec_key key; - s32 val; - s32 err = 0; - - brcmf_dbg(CONN, "key len (%d)\n", sme->key_len); - - if (sme->key_len == 0) - return 0; - - sec = &profile->sec; - brcmf_dbg(CONN, "wpa_versions 0x%x cipher_pairwise 0x%x\n", - sec->wpa_versions, sec->cipher_pairwise); - - if (sec->wpa_versions & (NL80211_WPA_VERSION_1 | NL80211_WPA_VERSION_2)) - return 0; - - if (!(sec->cipher_pairwise & - (WLAN_CIPHER_SUITE_WEP40 | WLAN_CIPHER_SUITE_WEP104))) - return 0; - - memset(&key, 0, sizeof(key)); - key.len = (u32) sme->key_len; - key.index = (u32) sme->key_idx; - if (key.len > sizeof(key.data)) { - brcmf_err("Too long key length (%u)\n", key.len); - return -EINVAL; - } - memcpy(key.data, sme->key, key.len); - key.flags = BRCMF_PRIMARY_KEY; - switch (sec->cipher_pairwise) { - case WLAN_CIPHER_SUITE_WEP40: - key.algo = CRYPTO_ALGO_WEP1; - break; - case WLAN_CIPHER_SUITE_WEP104: - key.algo = CRYPTO_ALGO_WEP128; - break; - default: - brcmf_err("Invalid algorithm (%d)\n", - sme->crypto.ciphers_pairwise[0]); - return -EINVAL; - } - /* Set the new key/index */ - brcmf_dbg(CONN, "key length (%d) key index (%d) algo (%d)\n", - key.len, key.index, key.algo); - brcmf_dbg(CONN, "key \"%s\"\n", key.data); - err = send_key_to_dongle(ndev, &key); - if (err) - return err; - - if (sec->auth_type == NL80211_AUTHTYPE_SHARED_KEY) { - brcmf_dbg(CONN, "set auth_type to shared key\n"); - val = WL_AUTH_SHARED_KEY; /* shared key */ - err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), "auth", val); - if (err) - brcmf_err("set auth failed (%d)\n", err); - } - return err; -} - -static -enum nl80211_auth_type brcmf_war_auth_type(struct brcmf_if *ifp, - enum nl80211_auth_type type) -{ - u32 ci; - if (type == NL80211_AUTHTYPE_AUTOMATIC) { - /* shift to ignore chip revision */ - ci = brcmf_get_chip_info(ifp) >> 4; - switch (ci) { - case 43236: - brcmf_dbg(CONN, "43236 WAR: use OPEN instead of AUTO\n"); - return NL80211_AUTHTYPE_OPEN_SYSTEM; - default: - break; - } - } - return type; -} - -static s32 -brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_connect_params *sme) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; - struct ieee80211_channel *chan = sme->channel; - struct brcmf_join_params join_params; - size_t join_params_size; - struct brcmf_tlv *rsn_ie; - struct brcmf_vs_tlv *wpa_ie; - void *ie; - u32 ie_len; - struct brcmf_ext_join_params_le *ext_join_params; - u16 chanspec; - - s32 err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - if (!check_vif_up(ifp->vif)) - return -EIO; - - if (!sme->ssid) { - brcmf_err("Invalid ssid\n"); - return -EOPNOTSUPP; - } - - if (ifp->vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif) { - /* A normal (non P2P) connection request setup. */ - ie = NULL; - ie_len = 0; - /* find the WPA_IE */ - wpa_ie = brcmf_find_wpaie((u8 *)sme->ie, sme->ie_len); - if (wpa_ie) { - ie = wpa_ie; - ie_len = wpa_ie->len + TLV_HDR_LEN; - } else { - /* find the RSN_IE */ - rsn_ie = brcmf_parse_tlvs((u8 *)sme->ie, sme->ie_len, - WLAN_EID_RSN); - if (rsn_ie) { - ie = rsn_ie; - ie_len = rsn_ie->len + TLV_HDR_LEN; - } - } - brcmf_fil_iovar_data_set(ifp, "wpaie", ie, ie_len); - } - - err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG, - sme->ie, sme->ie_len); - if (err) - brcmf_err("Set Assoc REQ IE Failed\n"); - else - brcmf_dbg(TRACE, "Applied Vndr IEs for Assoc request\n"); - - set_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); - - if (chan) { - cfg->channel = - ieee80211_frequency_to_channel(chan->center_freq); - chanspec = channel_to_chanspec(&cfg->d11inf, chan); - brcmf_dbg(CONN, "channel=%d, center_req=%d, chanspec=0x%04x\n", - cfg->channel, chan->center_freq, chanspec); - } else { - cfg->channel = 0; - chanspec = 0; - } - - brcmf_dbg(INFO, "ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len); - - err = brcmf_set_wpa_version(ndev, sme); - if (err) { - brcmf_err("wl_set_wpa_version failed (%d)\n", err); - goto done; - } - - sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type); - err = brcmf_set_auth_type(ndev, sme); - if (err) { - brcmf_err("wl_set_auth_type failed (%d)\n", err); - goto done; - } - - err = brcmf_set_set_cipher(ndev, sme); - if (err) { - brcmf_err("wl_set_set_cipher failed (%d)\n", err); - goto done; - } - - err = brcmf_set_key_mgmt(ndev, sme); - if (err) { - brcmf_err("wl_set_key_mgmt failed (%d)\n", err); - goto done; - } - - err = brcmf_set_sharedkey(ndev, sme); - if (err) { - brcmf_err("brcmf_set_sharedkey failed (%d)\n", err); - goto done; - } - - profile->ssid.SSID_len = min_t(u32, (u32)sizeof(profile->ssid.SSID), - (u32)sme->ssid_len); - memcpy(&profile->ssid.SSID, sme->ssid, profile->ssid.SSID_len); - if (profile->ssid.SSID_len < IEEE80211_MAX_SSID_LEN) { - profile->ssid.SSID[profile->ssid.SSID_len] = 0; - brcmf_dbg(CONN, "SSID \"%s\", len (%d)\n", profile->ssid.SSID, - profile->ssid.SSID_len); - } - - /* Join with specific BSSID and cached SSID - * If SSID is zero join based on BSSID only - */ - join_params_size = offsetof(struct brcmf_ext_join_params_le, assoc_le) + - offsetof(struct brcmf_assoc_params_le, chanspec_list); - if (cfg->channel) - join_params_size += sizeof(u16); - ext_join_params = kzalloc(join_params_size, GFP_KERNEL); - if (ext_join_params == NULL) { - err = -ENOMEM; - goto done; - } - ext_join_params->ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len); - memcpy(&ext_join_params->ssid_le.SSID, sme->ssid, - profile->ssid.SSID_len); - /*increase dwell time to receive probe response or detect Beacon - * from target AP at a noisy air only during connect command - */ - ext_join_params->scan_le.active_time = - cpu_to_le32(BRCMF_SCAN_JOIN_ACTIVE_DWELL_TIME_MS); - ext_join_params->scan_le.passive_time = - cpu_to_le32(BRCMF_SCAN_JOIN_PASSIVE_DWELL_TIME_MS); - /* Set up join scan parameters */ - ext_join_params->scan_le.scan_type = -1; - /* to sync with presence period of VSDB GO. - * Send probe request more frequently. Probe request will be stopped - * when it gets probe response from target AP/GO. - */ - ext_join_params->scan_le.nprobes = - cpu_to_le32(BRCMF_SCAN_JOIN_ACTIVE_DWELL_TIME_MS / - BRCMF_SCAN_JOIN_PROBE_INTERVAL_MS); - ext_join_params->scan_le.home_time = cpu_to_le32(-1); - - if (sme->bssid) - memcpy(&ext_join_params->assoc_le.bssid, sme->bssid, ETH_ALEN); - else - memset(&ext_join_params->assoc_le.bssid, 0xFF, ETH_ALEN); - - if (cfg->channel) { - ext_join_params->assoc_le.chanspec_num = cpu_to_le32(1); - - ext_join_params->assoc_le.chanspec_list[0] = - cpu_to_le16(chanspec); - } - - err = brcmf_fil_bsscfg_data_set(ifp, "join", ext_join_params, - join_params_size); - kfree(ext_join_params); - if (!err) - /* This is it. join command worked, we are done */ - goto done; - - /* join command failed, fallback to set ssid */ - memset(&join_params, 0, sizeof(join_params)); - join_params_size = sizeof(join_params.ssid_le); - - memcpy(&join_params.ssid_le.SSID, sme->ssid, profile->ssid.SSID_len); - join_params.ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len); - - if (sme->bssid) - memcpy(join_params.params_le.bssid, sme->bssid, ETH_ALEN); - else - memset(join_params.params_le.bssid, 0xFF, ETH_ALEN); - - if (cfg->channel) { - join_params.params_le.chanspec_list[0] = cpu_to_le16(chanspec); - join_params.params_le.chanspec_num = cpu_to_le32(1); - join_params_size += sizeof(join_params.params_le); - } - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, - &join_params, join_params_size); - if (err) - brcmf_err("BRCMF_C_SET_SSID failed (%d)\n", err); - -done: - if (err) - clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 -brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev, - u16 reason_code) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; - struct brcmf_scb_val_le scbval; - s32 err = 0; - - brcmf_dbg(TRACE, "Enter. Reason code = %d\n", reason_code); - if (!check_vif_up(ifp->vif)) - return -EIO; - - clear_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state); - - memcpy(&scbval.ea, &profile->bssid, ETH_ALEN); - scbval.val = cpu_to_le32(reason_code); - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_DISASSOC, - &scbval, sizeof(scbval)); - if (err) - brcmf_err("error (%d)\n", err); - - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 -brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, - enum nl80211_tx_power_setting type, s32 mbm) -{ - - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct net_device *ndev = cfg_to_ndev(cfg); - struct brcmf_if *ifp = netdev_priv(ndev); - u16 txpwrmw; - s32 err = 0; - s32 disable = 0; - s32 dbm = MBM_TO_DBM(mbm); - - brcmf_dbg(TRACE, "Enter\n"); - if (!check_vif_up(ifp->vif)) - return -EIO; - - switch (type) { - case NL80211_TX_POWER_AUTOMATIC: - break; - case NL80211_TX_POWER_LIMITED: - case NL80211_TX_POWER_FIXED: - if (dbm < 0) { - brcmf_err("TX_POWER_FIXED - dbm is negative\n"); - err = -EINVAL; - goto done; - } - break; - } - /* Make sure radio is off or on as far as software is concerned */ - disable = WL_RADIO_SW_DISABLE << 16; - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_RADIO, disable); - if (err) - brcmf_err("WLC_SET_RADIO error (%d)\n", err); - - if (dbm > 0xffff) - txpwrmw = 0xffff; - else - txpwrmw = (u16) dbm; - err = brcmf_fil_iovar_int_set(ifp, "qtxpower", - (s32)brcmf_mw_to_qdbm(txpwrmw)); - if (err) - brcmf_err("qtxpower error (%d)\n", err); - cfg->conf->tx_power = dbm; - -done: - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, - struct wireless_dev *wdev, - s32 *dbm) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); - s32 txpwrdbm; - u8 result; - s32 err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - if (!check_vif_up(ifp->vif)) - return -EIO; - - err = brcmf_fil_iovar_int_get(ifp, "qtxpower", &txpwrdbm); - if (err) { - brcmf_err("error (%d)\n", err); - goto done; - } - - result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE); - *dbm = (s32) brcmf_qdbm_to_mw(result); - -done: - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 -brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev, - u8 key_idx, bool unicast, bool multicast) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - u32 index; - u32 wsec; - s32 err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - brcmf_dbg(CONN, "key index (%d)\n", key_idx); - if (!check_vif_up(ifp->vif)) - return -EIO; - - err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); - if (err) { - brcmf_err("WLC_GET_WSEC error (%d)\n", err); - goto done; - } - - if (wsec & WEP_ENABLED) { - /* Just select a new current key */ - index = key_idx; - err = brcmf_fil_cmd_int_set(ifp, - BRCMF_C_SET_KEY_PRIMARY, index); - if (err) - brcmf_err("error (%d)\n", err); - } -done: - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 -brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev, - u8 key_idx, const u8 *mac_addr, struct key_params *params) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_wsec_key key; - s32 err = 0; - u8 keybuf[8]; - - memset(&key, 0, sizeof(key)); - key.index = (u32) key_idx; - /* Instead of bcast for ea address for default wep keys, - driver needs it to be Null */ - if (!is_multicast_ether_addr(mac_addr)) - memcpy((char *)&key.ea, (void *)mac_addr, ETH_ALEN); - key.len = (u32) params->key_len; - /* check for key index change */ - if (key.len == 0) { - /* key delete */ - err = send_key_to_dongle(ndev, &key); - if (err) - brcmf_err("key delete error (%d)\n", err); - } else { - if (key.len > sizeof(key.data)) { - brcmf_err("Invalid key length (%d)\n", key.len); - return -EINVAL; - } - - brcmf_dbg(CONN, "Setting the key index %d\n", key.index); - memcpy(key.data, params->key, key.len); - - if ((ifp->vif->mode != WL_MODE_AP) && - (params->cipher == WLAN_CIPHER_SUITE_TKIP)) { - brcmf_dbg(CONN, "Swapping RX/TX MIC key\n"); - memcpy(keybuf, &key.data[24], sizeof(keybuf)); - memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); - memcpy(&key.data[16], keybuf, sizeof(keybuf)); - } - - /* if IW_ENCODE_EXT_RX_SEQ_VALID set */ - if (params->seq && params->seq_len == 6) { - /* rx iv */ - u8 *ivptr; - ivptr = (u8 *) params->seq; - key.rxiv.hi = (ivptr[5] << 24) | (ivptr[4] << 16) | - (ivptr[3] << 8) | ivptr[2]; - key.rxiv.lo = (ivptr[1] << 8) | ivptr[0]; - key.iv_initialized = true; - } - - switch (params->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - key.algo = CRYPTO_ALGO_WEP1; - brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP40\n"); - break; - case WLAN_CIPHER_SUITE_WEP104: - key.algo = CRYPTO_ALGO_WEP128; - brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n"); - break; - case WLAN_CIPHER_SUITE_TKIP: - key.algo = CRYPTO_ALGO_TKIP; - brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n"); - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - key.algo = CRYPTO_ALGO_AES_CCM; - brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); - break; - case WLAN_CIPHER_SUITE_CCMP: - key.algo = CRYPTO_ALGO_AES_CCM; - brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n"); - break; - default: - brcmf_err("Invalid cipher (0x%x)\n", params->cipher); - return -EINVAL; - } - err = send_key_to_dongle(ndev, &key); - if (err) - brcmf_err("wsec_key error (%d)\n", err); - } - return err; -} - -static s32 -brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, - u8 key_idx, bool pairwise, const u8 *mac_addr, - struct key_params *params) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_wsec_key key; - s32 val; - s32 wsec; - s32 err = 0; - u8 keybuf[8]; - - brcmf_dbg(TRACE, "Enter\n"); - brcmf_dbg(CONN, "key index (%d)\n", key_idx); - if (!check_vif_up(ifp->vif)) - return -EIO; - - if (mac_addr) { - brcmf_dbg(TRACE, "Exit"); - return brcmf_add_keyext(wiphy, ndev, key_idx, mac_addr, params); - } - memset(&key, 0, sizeof(key)); - - key.len = (u32) params->key_len; - key.index = (u32) key_idx; - - if (key.len > sizeof(key.data)) { - brcmf_err("Too long key length (%u)\n", key.len); - err = -EINVAL; - goto done; - } - memcpy(key.data, params->key, key.len); - - key.flags = BRCMF_PRIMARY_KEY; - switch (params->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - key.algo = CRYPTO_ALGO_WEP1; - val = WEP_ENABLED; - brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP40\n"); - break; - case WLAN_CIPHER_SUITE_WEP104: - key.algo = CRYPTO_ALGO_WEP128; - val = WEP_ENABLED; - brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n"); - break; - case WLAN_CIPHER_SUITE_TKIP: - if (ifp->vif->mode != WL_MODE_AP) { - brcmf_dbg(CONN, "Swapping RX/TX MIC key\n"); - memcpy(keybuf, &key.data[24], sizeof(keybuf)); - memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); - memcpy(&key.data[16], keybuf, sizeof(keybuf)); - } - key.algo = CRYPTO_ALGO_TKIP; - val = TKIP_ENABLED; - brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n"); - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - key.algo = CRYPTO_ALGO_AES_CCM; - val = AES_ENABLED; - brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); - break; - case WLAN_CIPHER_SUITE_CCMP: - key.algo = CRYPTO_ALGO_AES_CCM; - val = AES_ENABLED; - brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_CCMP\n"); - break; - default: - brcmf_err("Invalid cipher (0x%x)\n", params->cipher); - err = -EINVAL; - goto done; - } - - err = send_key_to_dongle(ndev, &key); - if (err) - goto done; - - err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); - if (err) { - brcmf_err("get wsec error (%d)\n", err); - goto done; - } - wsec |= val; - err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); - if (err) { - brcmf_err("set wsec error (%d)\n", err); - goto done; - } - -done: - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 -brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, - u8 key_idx, bool pairwise, const u8 *mac_addr) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_wsec_key key; - s32 err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - if (!check_vif_up(ifp->vif)) - return -EIO; - - if (key_idx >= DOT11_MAX_DEFAULT_KEYS) { - /* we ignore this key index in this case */ - brcmf_err("invalid key index (%d)\n", key_idx); - return -EINVAL; - } - - memset(&key, 0, sizeof(key)); - - key.index = (u32) key_idx; - key.flags = BRCMF_PRIMARY_KEY; - key.algo = CRYPTO_ALGO_OFF; - - brcmf_dbg(CONN, "key index (%d)\n", key_idx); - - /* Set the new key/index */ - err = send_key_to_dongle(ndev, &key); - - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 -brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, - u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie, - void (*callback) (void *cookie, struct key_params * params)) -{ - struct key_params params; - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; - struct brcmf_cfg80211_security *sec; - s32 wsec; - s32 err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - brcmf_dbg(CONN, "key index (%d)\n", key_idx); - if (!check_vif_up(ifp->vif)) - return -EIO; - - memset(¶ms, 0, sizeof(params)); - - err = brcmf_fil_bsscfg_int_get(ifp, "wsec", &wsec); - if (err) { - brcmf_err("WLC_GET_WSEC error (%d)\n", err); - /* Ignore this error, may happen during DISASSOC */ - err = -EAGAIN; - goto done; - } - if (wsec & WEP_ENABLED) { - sec = &profile->sec; - if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { - params.cipher = WLAN_CIPHER_SUITE_WEP40; - brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP40\n"); - } else if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP104) { - params.cipher = WLAN_CIPHER_SUITE_WEP104; - brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_WEP104\n"); - } - } else if (wsec & TKIP_ENABLED) { - params.cipher = WLAN_CIPHER_SUITE_TKIP; - brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_TKIP\n"); - } else if (wsec & AES_ENABLED) { - params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; - brcmf_dbg(CONN, "WLAN_CIPHER_SUITE_AES_CMAC\n"); - } else { - brcmf_err("Invalid algo (0x%x)\n", wsec); - err = -EINVAL; - goto done; - } - callback(cookie, ¶ms); - -done: - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 -brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, - struct net_device *ndev, u8 key_idx) -{ - brcmf_dbg(INFO, "Not supported\n"); - - return -EOPNOTSUPP; -} - -static s32 -brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, - u8 *mac, struct station_info *sinfo) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; - struct brcmf_scb_val_le scb_val; - int rssi; - s32 rate; - s32 err = 0; - u8 *bssid = profile->bssid; - struct brcmf_sta_info_le sta_info_le; - - brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac); - if (!check_vif_up(ifp->vif)) - return -EIO; - - if (ifp->vif->mode == WL_MODE_AP) { - memcpy(&sta_info_le, mac, ETH_ALEN); - err = brcmf_fil_iovar_data_get(ifp, "sta_info", - &sta_info_le, - sizeof(sta_info_le)); - if (err < 0) { - brcmf_err("GET STA INFO failed, %d\n", err); - goto done; - } - sinfo->filled = STATION_INFO_INACTIVE_TIME; - sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000; - if (le32_to_cpu(sta_info_le.flags) & BRCMF_STA_ASSOC) { - sinfo->filled |= STATION_INFO_CONNECTED_TIME; - sinfo->connected_time = le32_to_cpu(sta_info_le.in); - } - brcmf_dbg(TRACE, "STA idle time : %d ms, connected time :%d sec\n", - sinfo->inactive_time, sinfo->connected_time); - } else if (ifp->vif->mode == WL_MODE_BSS) { - if (memcmp(mac, bssid, ETH_ALEN)) { - brcmf_err("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n", - mac, bssid); - err = -ENOENT; - goto done; - } - /* Report the current tx rate */ - err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate); - if (err) { - brcmf_err("Could not get rate (%d)\n", err); - goto done; - } else { - sinfo->filled |= STATION_INFO_TX_BITRATE; - sinfo->txrate.legacy = rate * 5; - brcmf_dbg(CONN, "Rate %d Mbps\n", rate / 2); - } - - if (test_bit(BRCMF_VIF_STATUS_CONNECTED, - &ifp->vif->sme_state)) { - memset(&scb_val, 0, sizeof(scb_val)); - err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI, - &scb_val, sizeof(scb_val)); - if (err) { - brcmf_err("Could not get rssi (%d)\n", err); - goto done; - } else { - rssi = le32_to_cpu(scb_val.val); - sinfo->filled |= STATION_INFO_SIGNAL; - sinfo->signal = rssi; - brcmf_dbg(CONN, "RSSI %d dBm\n", rssi); - } - } - } else - err = -EPERM; -done: - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 -brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, - bool enabled, s32 timeout) -{ - s32 pm; - s32 err = 0; - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_if *ifp = netdev_priv(ndev); - - brcmf_dbg(TRACE, "Enter\n"); - - /* - * Powersave enable/disable request is coming from the - * cfg80211 even before the interface is up. In that - * scenario, driver will be storing the power save - * preference in cfg struct to apply this to - * FW later while initializing the dongle - */ - cfg->pwr_save = enabled; - if (!check_vif_up(ifp->vif)) { - - brcmf_dbg(INFO, "Device is not ready, storing the value in cfg_info struct\n"); - goto done; - } - - pm = enabled ? PM_FAST : PM_OFF; - /* Do not enable the power save after assoc if it is a p2p interface */ - if (ifp->vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) { - brcmf_dbg(INFO, "Do not enable power save for P2P clients\n"); - pm = PM_OFF; - } - brcmf_dbg(INFO, "power save %s\n", (pm ? "enabled" : "disabled")); - - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, pm); - if (err) { - if (err == -ENODEV) - brcmf_err("net_device is not ready yet\n"); - else - brcmf_err("error (%d)\n", err); - } -done: - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg, - struct brcmf_bss_info_le *bi) -{ - struct wiphy *wiphy = cfg_to_wiphy(cfg); - struct ieee80211_channel *notify_channel; - struct cfg80211_bss *bss; - struct ieee80211_supported_band *band; - struct brcmu_chan ch; - s32 err = 0; - u16 channel; - u32 freq; - u16 notify_capability; - u16 notify_interval; - u8 *notify_ie; - size_t notify_ielen; - s32 notify_signal; - - if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { - brcmf_err("Bss info is larger than buffer. Discarding\n"); - return 0; - } - - if (!bi->ctl_ch) { - ch.chspec = le16_to_cpu(bi->chanspec); - cfg->d11inf.decchspec(&ch); - bi->ctl_ch = ch.chnum; - } - channel = bi->ctl_ch; - - if (channel <= CH_MAX_2G_CHANNEL) - band = wiphy->bands[IEEE80211_BAND_2GHZ]; - else - band = wiphy->bands[IEEE80211_BAND_5GHZ]; - - freq = ieee80211_channel_to_frequency(channel, band->band); - notify_channel = ieee80211_get_channel(wiphy, freq); - - notify_capability = le16_to_cpu(bi->capability); - notify_interval = le16_to_cpu(bi->beacon_period); - notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); - notify_ielen = le32_to_cpu(bi->ie_length); - notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100; - - brcmf_dbg(CONN, "bssid: %pM\n", bi->BSSID); - brcmf_dbg(CONN, "Channel: %d(%d)\n", channel, freq); - brcmf_dbg(CONN, "Capability: %X\n", notify_capability); - brcmf_dbg(CONN, "Beacon interval: %d\n", notify_interval); - brcmf_dbg(CONN, "Signal: %d\n", notify_signal); - - bss = cfg80211_inform_bss(wiphy, notify_channel, (const u8 *)bi->BSSID, - 0, notify_capability, notify_interval, notify_ie, - notify_ielen, notify_signal, GFP_KERNEL); - - if (!bss) - return -ENOMEM; - - cfg80211_put_bss(wiphy, bss); - - return err; -} - -static struct brcmf_bss_info_le * -next_bss_le(struct brcmf_scan_results *list, struct brcmf_bss_info_le *bss) -{ - if (bss == NULL) - return list->bss_info_le; - return (struct brcmf_bss_info_le *)((unsigned long)bss + - le32_to_cpu(bss->length)); -} - -static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg) -{ - struct brcmf_scan_results *bss_list; - struct brcmf_bss_info_le *bi = NULL; /* must be initialized */ - s32 err = 0; - int i; - - bss_list = cfg->bss_list; - if (bss_list->count != 0 && - bss_list->version != BRCMF_BSS_INFO_VERSION) { - brcmf_err("Version %d != WL_BSS_INFO_VERSION\n", - bss_list->version); - return -EOPNOTSUPP; - } - brcmf_dbg(SCAN, "scanned AP count (%d)\n", bss_list->count); - for (i = 0; i < bss_list->count; i++) { - bi = next_bss_le(bss_list, bi); - err = brcmf_inform_single_bss(cfg, bi); - if (err) - break; - } - return err; -} - -static s32 wl_inform_ibss(struct brcmf_cfg80211_info *cfg, - struct net_device *ndev, const u8 *bssid) -{ - struct wiphy *wiphy = cfg_to_wiphy(cfg); - struct ieee80211_channel *notify_channel; - struct brcmf_bss_info_le *bi = NULL; - struct ieee80211_supported_band *band; - struct cfg80211_bss *bss; - struct brcmu_chan ch; - u8 *buf = NULL; - s32 err = 0; - u32 freq; - u16 notify_capability; - u16 notify_interval; - u8 *notify_ie; - size_t notify_ielen; - s32 notify_signal; - - brcmf_dbg(TRACE, "Enter\n"); - - buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); - if (buf == NULL) { - err = -ENOMEM; - goto CleanUp; - } - - *(__le32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX); - - err = brcmf_fil_cmd_data_get(netdev_priv(ndev), BRCMF_C_GET_BSS_INFO, - buf, WL_BSS_INFO_MAX); - if (err) { - brcmf_err("WLC_GET_BSS_INFO failed: %d\n", err); - goto CleanUp; - } - - bi = (struct brcmf_bss_info_le *)(buf + 4); - - ch.chspec = le16_to_cpu(bi->chanspec); - cfg->d11inf.decchspec(&ch); - - if (ch.band == BRCMU_CHAN_BAND_2G) - band = wiphy->bands[IEEE80211_BAND_2GHZ]; - else - band = wiphy->bands[IEEE80211_BAND_5GHZ]; - - freq = ieee80211_channel_to_frequency(ch.chnum, band->band); - notify_channel = ieee80211_get_channel(wiphy, freq); - - notify_capability = le16_to_cpu(bi->capability); - notify_interval = le16_to_cpu(bi->beacon_period); - notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset); - notify_ielen = le32_to_cpu(bi->ie_length); - notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100; - - brcmf_dbg(CONN, "channel: %d(%d)\n", ch.chnum, freq); - brcmf_dbg(CONN, "capability: %X\n", notify_capability); - brcmf_dbg(CONN, "beacon interval: %d\n", notify_interval); - brcmf_dbg(CONN, "signal: %d\n", notify_signal); - - bss = cfg80211_inform_bss(wiphy, notify_channel, bssid, - 0, notify_capability, notify_interval, - notify_ie, notify_ielen, notify_signal, GFP_KERNEL); - - if (!bss) { - err = -ENOMEM; - goto CleanUp; - } - - cfg80211_put_bss(wiphy, bss); - -CleanUp: - - kfree(buf); - - brcmf_dbg(TRACE, "Exit\n"); - - return err; -} - -static bool brcmf_is_ibssmode(struct brcmf_cfg80211_vif *vif) -{ - return vif->mode == WL_MODE_IBSS; -} - -static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg, - struct brcmf_if *ifp) -{ - struct brcmf_cfg80211_profile *profile = ndev_to_prof(ifp->ndev); - struct brcmf_bss_info_le *bi; - struct brcmf_ssid *ssid; - struct brcmf_tlv *tim; - u16 beacon_interval; - u8 dtim_period; - size_t ie_len; - u8 *ie; - s32 err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - if (brcmf_is_ibssmode(ifp->vif)) - return err; - - ssid = &profile->ssid; - - *(__le32 *)cfg->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX); - err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, - cfg->extra_buf, WL_EXTRA_BUF_MAX); - if (err) { - brcmf_err("Could not get bss info %d\n", err); - goto update_bss_info_out; - } - - bi = (struct brcmf_bss_info_le *)(cfg->extra_buf + 4); - err = brcmf_inform_single_bss(cfg, bi); - if (err) - goto update_bss_info_out; - - ie = ((u8 *)bi) + le16_to_cpu(bi->ie_offset); - ie_len = le32_to_cpu(bi->ie_length); - beacon_interval = le16_to_cpu(bi->beacon_period); - - tim = brcmf_parse_tlvs(ie, ie_len, WLAN_EID_TIM); - if (tim) - dtim_period = tim->data[1]; - else { - /* - * active scan was done so we could not get dtim - * information out of probe response. - * so we speficially query dtim information to dongle. - */ - u32 var; - err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", &var); - if (err) { - brcmf_err("wl dtim_assoc failed (%d)\n", err); - goto update_bss_info_out; - } - dtim_period = (u8)var; - } - -update_bss_info_out: - brcmf_dbg(TRACE, "Exit"); - return err; -} - -void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg) -{ - struct escan_info *escan = &cfg->escan_info; - - set_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status); - if (cfg->scan_request) { - escan->escan_state = WL_ESCAN_STATE_IDLE; - brcmf_notify_escan_complete(cfg, escan->ifp, true, true); - } - clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); - clear_bit(BRCMF_SCAN_STATUS_ABORT, &cfg->scan_status); -} - -static void brcmf_cfg80211_escan_timeout_worker(struct work_struct *work) -{ - struct brcmf_cfg80211_info *cfg = - container_of(work, struct brcmf_cfg80211_info, - escan_timeout_work); - - brcmf_notify_escan_complete(cfg, cfg->escan_info.ifp, true, true); -} - -static void brcmf_escan_timeout(unsigned long data) -{ - struct brcmf_cfg80211_info *cfg = - (struct brcmf_cfg80211_info *)data; - - if (cfg->scan_request) { - brcmf_err("timer expired\n"); - schedule_work(&cfg->escan_timeout_work); - } -} - -static s32 -brcmf_compare_update_same_bss(struct brcmf_cfg80211_info *cfg, - struct brcmf_bss_info_le *bss, - struct brcmf_bss_info_le *bss_info_le) -{ - struct brcmu_chan ch_bss, ch_bss_info_le; - - ch_bss.chspec = le16_to_cpu(bss->chanspec); - cfg->d11inf.decchspec(&ch_bss); - ch_bss_info_le.chspec = le16_to_cpu(bss_info_le->chanspec); - cfg->d11inf.decchspec(&ch_bss_info_le); - - if (!memcmp(&bss_info_le->BSSID, &bss->BSSID, ETH_ALEN) && - ch_bss.band == ch_bss_info_le.band && - bss_info_le->SSID_len == bss->SSID_len && - !memcmp(bss_info_le->SSID, bss->SSID, bss_info_le->SSID_len)) { - if ((bss->flags & WLC_BSS_RSSI_ON_CHANNEL) == - (bss_info_le->flags & WLC_BSS_RSSI_ON_CHANNEL)) { - s16 bss_rssi = le16_to_cpu(bss->RSSI); - s16 bss_info_rssi = le16_to_cpu(bss_info_le->RSSI); - - /* preserve max RSSI if the measurements are - * both on-channel or both off-channel - */ - if (bss_info_rssi > bss_rssi) - bss->RSSI = bss_info_le->RSSI; - } else if ((bss->flags & WLC_BSS_RSSI_ON_CHANNEL) && - (bss_info_le->flags & WLC_BSS_RSSI_ON_CHANNEL) == 0) { - /* preserve the on-channel rssi measurement - * if the new measurement is off channel - */ - bss->RSSI = bss_info_le->RSSI; - bss->flags |= WLC_BSS_RSSI_ON_CHANNEL; - } - return 1; - } - return 0; -} - -static s32 -brcmf_cfg80211_escan_handler(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, void *data) -{ - struct brcmf_cfg80211_info *cfg = ifp->drvr->config; - s32 status; - s32 err = 0; - struct brcmf_escan_result_le *escan_result_le; - struct brcmf_bss_info_le *bss_info_le; - struct brcmf_bss_info_le *bss = NULL; - u32 bi_length; - struct brcmf_scan_results *list; - u32 i; - bool aborted; - - status = e->status; - - if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { - brcmf_err("scan not ready, bssidx=%d\n", ifp->bssidx); - return -EPERM; - } - - if (status == BRCMF_E_STATUS_PARTIAL) { - brcmf_dbg(SCAN, "ESCAN Partial result\n"); - escan_result_le = (struct brcmf_escan_result_le *) data; - if (!escan_result_le) { - brcmf_err("Invalid escan result (NULL pointer)\n"); - goto exit; - } - if (le16_to_cpu(escan_result_le->bss_count) != 1) { - brcmf_err("Invalid bss_count %d: ignoring\n", - escan_result_le->bss_count); - goto exit; - } - bss_info_le = &escan_result_le->bss_info_le; - - if (brcmf_p2p_scan_finding_common_channel(cfg, bss_info_le)) - goto exit; - - if (!cfg->scan_request) { - brcmf_dbg(SCAN, "result without cfg80211 request\n"); - goto exit; - } - - bi_length = le32_to_cpu(bss_info_le->length); - if (bi_length != (le32_to_cpu(escan_result_le->buflen) - - WL_ESCAN_RESULTS_FIXED_SIZE)) { - brcmf_err("Invalid bss_info length %d: ignoring\n", - bi_length); - goto exit; - } - - if (!(cfg_to_wiphy(cfg)->interface_modes & - BIT(NL80211_IFTYPE_ADHOC))) { - if (le16_to_cpu(bss_info_le->capability) & - WLAN_CAPABILITY_IBSS) { - brcmf_err("Ignoring IBSS result\n"); - goto exit; - } - } - - list = (struct brcmf_scan_results *) - cfg->escan_info.escan_buf; - if (bi_length > WL_ESCAN_BUF_SIZE - list->buflen) { - brcmf_err("Buffer is too small: ignoring\n"); - goto exit; - } - - for (i = 0; i < list->count; i++) { - bss = bss ? (struct brcmf_bss_info_le *) - ((unsigned char *)bss + - le32_to_cpu(bss->length)) : list->bss_info_le; - if (brcmf_compare_update_same_bss(cfg, bss, - bss_info_le)) - goto exit; - } - memcpy(&(cfg->escan_info.escan_buf[list->buflen]), - bss_info_le, bi_length); - list->version = le32_to_cpu(bss_info_le->version); - list->buflen += bi_length; - list->count++; - } else { - cfg->escan_info.escan_state = WL_ESCAN_STATE_IDLE; - if (brcmf_p2p_scan_finding_common_channel(cfg, NULL)) - goto exit; - if (cfg->scan_request) { - cfg->bss_list = (struct brcmf_scan_results *) - cfg->escan_info.escan_buf; - brcmf_inform_bss(cfg); - aborted = status != BRCMF_E_STATUS_SUCCESS; - brcmf_notify_escan_complete(cfg, ifp, aborted, - false); - } else - brcmf_dbg(SCAN, "Ignored scan complete result 0x%x\n", - status); - } -exit: - return err; -} - -static void brcmf_init_escan(struct brcmf_cfg80211_info *cfg) -{ - brcmf_fweh_register(cfg->pub, BRCMF_E_ESCAN_RESULT, - brcmf_cfg80211_escan_handler); - cfg->escan_info.escan_state = WL_ESCAN_STATE_IDLE; - /* Init scan_timeout timer */ - init_timer(&cfg->escan_timeout); - cfg->escan_timeout.data = (unsigned long) cfg; - cfg->escan_timeout.function = brcmf_escan_timeout; - INIT_WORK(&cfg->escan_timeout_work, - brcmf_cfg80211_escan_timeout_worker); -} - -static __always_inline void brcmf_delay(u32 ms) -{ - if (ms < 1000 / HZ) { - cond_resched(); - mdelay(ms); - } else { - msleep(ms); - } -} - -static s32 brcmf_cfg80211_resume(struct wiphy *wiphy) -{ - brcmf_dbg(TRACE, "Enter\n"); - - return 0; -} - -static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, - struct cfg80211_wowlan *wow) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct net_device *ndev = cfg_to_ndev(cfg); - struct brcmf_cfg80211_vif *vif; - - brcmf_dbg(TRACE, "Enter\n"); - - /* - * if the primary net_device is not READY there is nothing - * we can do but pray resume goes smoothly. - */ - vif = ((struct brcmf_if *)netdev_priv(ndev))->vif; - if (!check_vif_up(vif)) - goto exit; - - list_for_each_entry(vif, &cfg->vif_list, list) { - if (!test_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state)) - continue; - /* - * While going to suspend if associated with AP disassociate - * from AP to save power while system is in suspended state - */ - brcmf_link_down(vif); - - /* Make sure WPA_Supplicant receives all the event - * generated due to DISASSOC call to the fw to keep - * the state fw and WPA_Supplicant state consistent - */ - brcmf_delay(500); - } - - /* end any scanning */ - if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) - brcmf_abort_scanning(cfg); - - /* Turn off watchdog timer */ - brcmf_set_mpc(netdev_priv(ndev), 1); - -exit: - brcmf_dbg(TRACE, "Exit\n"); - /* clear any scanning activity */ - cfg->scan_status = 0; - return 0; -} - -static __used s32 -brcmf_update_pmklist(struct net_device *ndev, - struct brcmf_cfg80211_pmk_list *pmk_list, s32 err) -{ - int i, j; - int pmkid_len; - - pmkid_len = le32_to_cpu(pmk_list->pmkids.npmkid); - - brcmf_dbg(CONN, "No of elements %d\n", pmkid_len); - for (i = 0; i < pmkid_len; i++) { - brcmf_dbg(CONN, "PMKID[%d]: %pM =\n", i, - &pmk_list->pmkids.pmkid[i].BSSID); - for (j = 0; j < WLAN_PMKID_LEN; j++) - brcmf_dbg(CONN, "%02x\n", - pmk_list->pmkids.pmkid[i].PMKID[j]); - } - - if (!err) - brcmf_fil_iovar_data_set(netdev_priv(ndev), "pmkid_info", - (char *)pmk_list, sizeof(*pmk_list)); - - return err; -} - -static s32 -brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_pmksa *pmksa) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_if *ifp = netdev_priv(ndev); - struct pmkid_list *pmkids = &cfg->pmk_list->pmkids; - s32 err = 0; - int i; - int pmkid_len; - - brcmf_dbg(TRACE, "Enter\n"); - if (!check_vif_up(ifp->vif)) - return -EIO; - - pmkid_len = le32_to_cpu(pmkids->npmkid); - for (i = 0; i < pmkid_len; i++) - if (!memcmp(pmksa->bssid, pmkids->pmkid[i].BSSID, ETH_ALEN)) - break; - if (i < WL_NUM_PMKIDS_MAX) { - memcpy(pmkids->pmkid[i].BSSID, pmksa->bssid, ETH_ALEN); - memcpy(pmkids->pmkid[i].PMKID, pmksa->pmkid, WLAN_PMKID_LEN); - if (i == pmkid_len) { - pmkid_len++; - pmkids->npmkid = cpu_to_le32(pmkid_len); - } - } else - err = -EINVAL; - - brcmf_dbg(CONN, "set_pmksa,IW_PMKSA_ADD - PMKID: %pM =\n", - pmkids->pmkid[pmkid_len].BSSID); - for (i = 0; i < WLAN_PMKID_LEN; i++) - brcmf_dbg(CONN, "%02x\n", pmkids->pmkid[pmkid_len].PMKID[i]); - - err = brcmf_update_pmklist(ndev, cfg->pmk_list, err); - - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 -brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_pmksa *pmksa) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_if *ifp = netdev_priv(ndev); - struct pmkid_list pmkid; - s32 err = 0; - int i, pmkid_len; - - brcmf_dbg(TRACE, "Enter\n"); - if (!check_vif_up(ifp->vif)) - return -EIO; - - memcpy(&pmkid.pmkid[0].BSSID, pmksa->bssid, ETH_ALEN); - memcpy(&pmkid.pmkid[0].PMKID, pmksa->pmkid, WLAN_PMKID_LEN); - - brcmf_dbg(CONN, "del_pmksa,IW_PMKSA_REMOVE - PMKID: %pM =\n", - &pmkid.pmkid[0].BSSID); - for (i = 0; i < WLAN_PMKID_LEN; i++) - brcmf_dbg(CONN, "%02x\n", pmkid.pmkid[0].PMKID[i]); - - pmkid_len = le32_to_cpu(cfg->pmk_list->pmkids.npmkid); - for (i = 0; i < pmkid_len; i++) - if (!memcmp - (pmksa->bssid, &cfg->pmk_list->pmkids.pmkid[i].BSSID, - ETH_ALEN)) - break; - - if ((pmkid_len > 0) - && (i < pmkid_len)) { - memset(&cfg->pmk_list->pmkids.pmkid[i], 0, - sizeof(struct pmkid)); - for (; i < (pmkid_len - 1); i++) { - memcpy(&cfg->pmk_list->pmkids.pmkid[i].BSSID, - &cfg->pmk_list->pmkids.pmkid[i + 1].BSSID, - ETH_ALEN); - memcpy(&cfg->pmk_list->pmkids.pmkid[i].PMKID, - &cfg->pmk_list->pmkids.pmkid[i + 1].PMKID, - WLAN_PMKID_LEN); - } - cfg->pmk_list->pmkids.npmkid = cpu_to_le32(pmkid_len - 1); - } else - err = -EINVAL; - - err = brcmf_update_pmklist(ndev, cfg->pmk_list, err); - - brcmf_dbg(TRACE, "Exit\n"); - return err; - -} - -static s32 -brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *ndev) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_if *ifp = netdev_priv(ndev); - s32 err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - if (!check_vif_up(ifp->vif)) - return -EIO; - - memset(cfg->pmk_list, 0, sizeof(*cfg->pmk_list)); - err = brcmf_update_pmklist(ndev, cfg->pmk_list, err); - - brcmf_dbg(TRACE, "Exit\n"); - return err; - -} - -/* - * PFN result doesn't have all the info which are - * required by the supplicant - * (For e.g IEs) Do a target Escan so that sched scan results are reported - * via wl_inform_single_bss in the required format. Escan does require the - * scan request in the form of cfg80211_scan_request. For timebeing, create - * cfg80211_scan_request one out of the received PNO event. - */ -static s32 -brcmf_notify_sched_scan_results(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, void *data) -{ - struct brcmf_cfg80211_info *cfg = ifp->drvr->config; - struct brcmf_pno_net_info_le *netinfo, *netinfo_start; - struct cfg80211_scan_request *request = NULL; - struct cfg80211_ssid *ssid = NULL; - struct ieee80211_channel *channel = NULL; - struct wiphy *wiphy = cfg_to_wiphy(cfg); - int err = 0; - int channel_req = 0; - int band = 0; - struct brcmf_pno_scanresults_le *pfn_result; - u32 result_count; - u32 status; - - brcmf_dbg(SCAN, "Enter\n"); - - if (e->event_code == BRCMF_E_PFN_NET_LOST) { - brcmf_dbg(SCAN, "PFN NET LOST event. Do Nothing\n"); - return 0; - } - - pfn_result = (struct brcmf_pno_scanresults_le *)data; - result_count = le32_to_cpu(pfn_result->count); - status = le32_to_cpu(pfn_result->status); - - /* - * PFN event is limited to fit 512 bytes so we may get - * multiple NET_FOUND events. For now place a warning here. - */ - WARN_ON(status != BRCMF_PNO_SCAN_COMPLETE); - brcmf_dbg(SCAN, "PFN NET FOUND event. count: %d\n", result_count); - if (result_count > 0) { - int i; - - request = kzalloc(sizeof(*request), GFP_KERNEL); - ssid = kcalloc(result_count, sizeof(*ssid), GFP_KERNEL); - channel = kcalloc(result_count, sizeof(*channel), GFP_KERNEL); - if (!request || !ssid || !channel) { - err = -ENOMEM; - goto out_err; - } - - request->wiphy = wiphy; - data += sizeof(struct brcmf_pno_scanresults_le); - netinfo_start = (struct brcmf_pno_net_info_le *)data; - - for (i = 0; i < result_count; i++) { - netinfo = &netinfo_start[i]; - if (!netinfo) { - brcmf_err("Invalid netinfo ptr. index: %d\n", - i); - err = -EINVAL; - goto out_err; - } - - brcmf_dbg(SCAN, "SSID:%s Channel:%d\n", - netinfo->SSID, netinfo->channel); - memcpy(ssid[i].ssid, netinfo->SSID, netinfo->SSID_len); - ssid[i].ssid_len = netinfo->SSID_len; - request->n_ssids++; - - channel_req = netinfo->channel; - if (channel_req <= CH_MAX_2G_CHANNEL) - band = NL80211_BAND_2GHZ; - else - band = NL80211_BAND_5GHZ; - channel[i].center_freq = - ieee80211_channel_to_frequency(channel_req, - band); - channel[i].band = band; - channel[i].flags |= IEEE80211_CHAN_NO_HT40; - request->channels[i] = &channel[i]; - request->n_channels++; - } - - /* assign parsed ssid array */ - if (request->n_ssids) - request->ssids = &ssid[0]; - - if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { - /* Abort any on-going scan */ - brcmf_abort_scanning(cfg); - } - - set_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); - err = brcmf_do_escan(cfg, wiphy, ifp, request); - if (err) { - clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); - goto out_err; - } - cfg->sched_escan = true; - cfg->scan_request = request; - } else { - brcmf_err("FALSE PNO Event. (pfn_count == 0)\n"); - goto out_err; - } - - kfree(ssid); - kfree(channel); - kfree(request); - return 0; - -out_err: - kfree(ssid); - kfree(channel); - kfree(request); - cfg80211_sched_scan_stopped(wiphy); - return err; -} - -static int brcmf_dev_pno_clean(struct net_device *ndev) -{ - int ret; - - /* Disable pfn */ - ret = brcmf_fil_iovar_int_set(netdev_priv(ndev), "pfn", 0); - if (ret == 0) { - /* clear pfn */ - ret = brcmf_fil_iovar_data_set(netdev_priv(ndev), "pfnclear", - NULL, 0); - } - if (ret < 0) - brcmf_err("failed code %d\n", ret); - - return ret; -} - -static int brcmf_dev_pno_config(struct net_device *ndev) -{ - struct brcmf_pno_param_le pfn_param; - - memset(&pfn_param, 0, sizeof(pfn_param)); - pfn_param.version = cpu_to_le32(BRCMF_PNO_VERSION); - - /* set extra pno params */ - pfn_param.flags = cpu_to_le16(1 << BRCMF_PNO_ENABLE_ADAPTSCAN_BIT); - pfn_param.repeat = BRCMF_PNO_REPEAT; - pfn_param.exp = BRCMF_PNO_FREQ_EXPO_MAX; - - /* set up pno scan fr */ - pfn_param.scan_freq = cpu_to_le32(BRCMF_PNO_TIME); - - return brcmf_fil_iovar_data_set(netdev_priv(ndev), "pfn_set", - &pfn_param, sizeof(pfn_param)); -} - -static int -brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_sched_scan_request *request) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); - struct brcmf_pno_net_param_le pfn; - int i; - int ret = 0; - - brcmf_dbg(SCAN, "Enter n_match_sets:%d n_ssids:%d\n", - request->n_match_sets, request->n_ssids); - if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) { - brcmf_err("Scanning already: status (%lu)\n", cfg->scan_status); - return -EAGAIN; - } - if (test_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status)) { - brcmf_err("Scanning suppressed: status (%lu)\n", - cfg->scan_status); - return -EAGAIN; - } - - if (!request->n_ssids || !request->n_match_sets) { - brcmf_err("Invalid sched scan req!! n_ssids:%d\n", - request->n_ssids); - return -EINVAL; - } - - if (request->n_ssids > 0) { - for (i = 0; i < request->n_ssids; i++) { - /* Active scan req for ssids */ - brcmf_dbg(SCAN, ">>> Active scan req for ssid (%s)\n", - request->ssids[i].ssid); - - /* - * match_set ssids is a supert set of n_ssid list, - * so we need not add these set seperately. - */ - } - } - - if (request->n_match_sets > 0) { - /* clean up everything */ - ret = brcmf_dev_pno_clean(ndev); - if (ret < 0) { - brcmf_err("failed error=%d\n", ret); - return ret; - } - - /* configure pno */ - ret = brcmf_dev_pno_config(ndev); - if (ret < 0) { - brcmf_err("PNO setup failed!! ret=%d\n", ret); - return -EINVAL; - } - - /* configure each match set */ - for (i = 0; i < request->n_match_sets; i++) { - struct cfg80211_ssid *ssid; - u32 ssid_len; - - ssid = &request->match_sets[i].ssid; - ssid_len = ssid->ssid_len; - - if (!ssid_len) { - brcmf_err("skip broadcast ssid\n"); - continue; - } - pfn.auth = cpu_to_le32(WLAN_AUTH_OPEN); - pfn.wpa_auth = cpu_to_le32(BRCMF_PNO_WPA_AUTH_ANY); - pfn.wsec = cpu_to_le32(0); - pfn.infra = cpu_to_le32(1); - pfn.flags = cpu_to_le32(1 << BRCMF_PNO_HIDDEN_BIT); - pfn.ssid.SSID_len = cpu_to_le32(ssid_len); - memcpy(pfn.ssid.SSID, ssid->ssid, ssid_len); - ret = brcmf_fil_iovar_data_set(ifp, "pfn_add", &pfn, - sizeof(pfn)); - brcmf_dbg(SCAN, ">>> PNO filter %s for ssid (%s)\n", - ret == 0 ? "set" : "failed", ssid->ssid); - } - /* Enable the PNO */ - if (brcmf_fil_iovar_int_set(ifp, "pfn", 1) < 0) { - brcmf_err("PNO enable failed!! ret=%d\n", ret); - return -EINVAL; - } - } else { - return -EINVAL; - } - - return 0; -} - -static int brcmf_cfg80211_sched_scan_stop(struct wiphy *wiphy, - struct net_device *ndev) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - - brcmf_dbg(SCAN, "enter\n"); - brcmf_dev_pno_clean(ndev); - if (cfg->sched_escan) - brcmf_notify_escan_complete(cfg, netdev_priv(ndev), true, true); - return 0; -} - -#ifdef CONFIG_NL80211_TESTMODE -static int brcmf_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct net_device *ndev = cfg_to_ndev(cfg); - struct brcmf_dcmd *dcmd = data; - struct sk_buff *reply; - int ret; - - brcmf_dbg(TRACE, "cmd %x set %d buf %p len %d\n", dcmd->cmd, dcmd->set, - dcmd->buf, dcmd->len); - - if (dcmd->set) - ret = brcmf_fil_cmd_data_set(netdev_priv(ndev), dcmd->cmd, - dcmd->buf, dcmd->len); - else - ret = brcmf_fil_cmd_data_get(netdev_priv(ndev), dcmd->cmd, - dcmd->buf, dcmd->len); - if (ret == 0) { - reply = cfg80211_testmode_alloc_reply_skb(wiphy, sizeof(*dcmd)); - nla_put(reply, NL80211_ATTR_TESTDATA, sizeof(*dcmd), dcmd); - ret = cfg80211_testmode_reply(reply); - } - return ret; -} -#endif - -static s32 brcmf_configure_opensecurity(struct brcmf_if *ifp) -{ - s32 err; - - /* set auth */ - err = brcmf_fil_bsscfg_int_set(ifp, "auth", 0); - if (err < 0) { - brcmf_err("auth error %d\n", err); - return err; - } - /* set wsec */ - err = brcmf_fil_bsscfg_int_set(ifp, "wsec", 0); - if (err < 0) { - brcmf_err("wsec error %d\n", err); - return err; - } - /* set upper-layer auth */ - err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", WPA_AUTH_NONE); - if (err < 0) { - brcmf_err("wpa_auth error %d\n", err); - return err; - } - - return 0; -} - -static bool brcmf_valid_wpa_oui(u8 *oui, bool is_rsn_ie) -{ - if (is_rsn_ie) - return (memcmp(oui, RSN_OUI, TLV_OUI_LEN) == 0); - - return (memcmp(oui, WPA_OUI, TLV_OUI_LEN) == 0); -} - -static s32 -brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie, - bool is_rsn_ie) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - u32 auth = 0; /* d11 open authentication */ - u16 count; - s32 err = 0; - s32 len = 0; - u32 i; - u32 wsec; - u32 pval = 0; - u32 gval = 0; - u32 wpa_auth = 0; - u32 offset; - u8 *data; - u16 rsn_cap; - u32 wme_bss_disable; - - brcmf_dbg(TRACE, "Enter\n"); - if (wpa_ie == NULL) - goto exit; - - len = wpa_ie->len + TLV_HDR_LEN; - data = (u8 *)wpa_ie; - offset = TLV_HDR_LEN; - if (!is_rsn_ie) - offset += VS_IE_FIXED_HDR_LEN; - else - offset += WPA_IE_VERSION_LEN; - - /* check for multicast cipher suite */ - if (offset + WPA_IE_MIN_OUI_LEN > len) { - err = -EINVAL; - brcmf_err("no multicast cipher suite\n"); - goto exit; - } - - if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { - err = -EINVAL; - brcmf_err("ivalid OUI\n"); - goto exit; - } - offset += TLV_OUI_LEN; - - /* pick up multicast cipher */ - switch (data[offset]) { - case WPA_CIPHER_NONE: - gval = 0; - break; - case WPA_CIPHER_WEP_40: - case WPA_CIPHER_WEP_104: - gval = WEP_ENABLED; - break; - case WPA_CIPHER_TKIP: - gval = TKIP_ENABLED; - break; - case WPA_CIPHER_AES_CCM: - gval = AES_ENABLED; - break; - default: - err = -EINVAL; - brcmf_err("Invalid multi cast cipher info\n"); - goto exit; - } - - offset++; - /* walk thru unicast cipher list and pick up what we recognize */ - count = data[offset] + (data[offset + 1] << 8); - offset += WPA_IE_SUITE_COUNT_LEN; - /* Check for unicast suite(s) */ - if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) { - err = -EINVAL; - brcmf_err("no unicast cipher suite\n"); - goto exit; - } - for (i = 0; i < count; i++) { - if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { - err = -EINVAL; - brcmf_err("ivalid OUI\n"); - goto exit; - } - offset += TLV_OUI_LEN; - switch (data[offset]) { - case WPA_CIPHER_NONE: - break; - case WPA_CIPHER_WEP_40: - case WPA_CIPHER_WEP_104: - pval |= WEP_ENABLED; - break; - case WPA_CIPHER_TKIP: - pval |= TKIP_ENABLED; - break; - case WPA_CIPHER_AES_CCM: - pval |= AES_ENABLED; - break; - default: - brcmf_err("Ivalid unicast security info\n"); - } - offset++; - } - /* walk thru auth management suite list and pick up what we recognize */ - count = data[offset] + (data[offset + 1] << 8); - offset += WPA_IE_SUITE_COUNT_LEN; - /* Check for auth key management suite(s) */ - if (offset + (WPA_IE_MIN_OUI_LEN * count) > len) { - err = -EINVAL; - brcmf_err("no auth key mgmt suite\n"); - goto exit; - } - for (i = 0; i < count; i++) { - if (!brcmf_valid_wpa_oui(&data[offset], is_rsn_ie)) { - err = -EINVAL; - brcmf_err("ivalid OUI\n"); - goto exit; - } - offset += TLV_OUI_LEN; - switch (data[offset]) { - case RSN_AKM_NONE: - brcmf_dbg(TRACE, "RSN_AKM_NONE\n"); - wpa_auth |= WPA_AUTH_NONE; - break; - case RSN_AKM_UNSPECIFIED: - brcmf_dbg(TRACE, "RSN_AKM_UNSPECIFIED\n"); - is_rsn_ie ? (wpa_auth |= WPA2_AUTH_UNSPECIFIED) : - (wpa_auth |= WPA_AUTH_UNSPECIFIED); - break; - case RSN_AKM_PSK: - brcmf_dbg(TRACE, "RSN_AKM_PSK\n"); - is_rsn_ie ? (wpa_auth |= WPA2_AUTH_PSK) : - (wpa_auth |= WPA_AUTH_PSK); - break; - default: - brcmf_err("Ivalid key mgmt info\n"); - } - offset++; - } - - if (is_rsn_ie) { - wme_bss_disable = 1; - if ((offset + RSN_CAP_LEN) <= len) { - rsn_cap = data[offset] + (data[offset + 1] << 8); - if (rsn_cap & RSN_CAP_PTK_REPLAY_CNTR_MASK) - wme_bss_disable = 0; - } - /* set wme_bss_disable to sync RSN Capabilities */ - err = brcmf_fil_bsscfg_int_set(ifp, "wme_bss_disable", - wme_bss_disable); - if (err < 0) { - brcmf_err("wme_bss_disable error %d\n", err); - goto exit; - } - } - /* FOR WPS , set SES_OW_ENABLED */ - wsec = (pval | gval | SES_OW_ENABLED); - - /* set auth */ - err = brcmf_fil_bsscfg_int_set(ifp, "auth", auth); - if (err < 0) { - brcmf_err("auth error %d\n", err); - goto exit; - } - /* set wsec */ - err = brcmf_fil_bsscfg_int_set(ifp, "wsec", wsec); - if (err < 0) { - brcmf_err("wsec error %d\n", err); - goto exit; - } - /* set upper-layer auth */ - err = brcmf_fil_bsscfg_int_set(ifp, "wpa_auth", wpa_auth); - if (err < 0) { - brcmf_err("wpa_auth error %d\n", err); - goto exit; - } - -exit: - return err; -} - -static s32 -brcmf_parse_vndr_ies(const u8 *vndr_ie_buf, u32 vndr_ie_len, - struct parsed_vndr_ies *vndr_ies) -{ - s32 err = 0; - struct brcmf_vs_tlv *vndrie; - struct brcmf_tlv *ie; - struct parsed_vndr_ie_info *parsed_info; - s32 remaining_len; - - remaining_len = (s32)vndr_ie_len; - memset(vndr_ies, 0, sizeof(*vndr_ies)); - - ie = (struct brcmf_tlv *)vndr_ie_buf; - while (ie) { - if (ie->id != WLAN_EID_VENDOR_SPECIFIC) - goto next; - vndrie = (struct brcmf_vs_tlv *)ie; - /* len should be bigger than OUI length + one */ - if (vndrie->len < (VS_IE_FIXED_HDR_LEN - TLV_HDR_LEN + 1)) { - brcmf_err("invalid vndr ie. length is too small %d\n", - vndrie->len); - goto next; - } - /* if wpa or wme ie, do not add ie */ - if (!memcmp(vndrie->oui, (u8 *)WPA_OUI, TLV_OUI_LEN) && - ((vndrie->oui_type == WPA_OUI_TYPE) || - (vndrie->oui_type == WME_OUI_TYPE))) { - brcmf_dbg(TRACE, "Found WPA/WME oui. Do not add it\n"); - goto next; - } - - parsed_info = &vndr_ies->ie_info[vndr_ies->count]; - - /* save vndr ie information */ - parsed_info->ie_ptr = (char *)vndrie; - parsed_info->ie_len = vndrie->len + TLV_HDR_LEN; - memcpy(&parsed_info->vndrie, vndrie, sizeof(*vndrie)); - - vndr_ies->count++; - - brcmf_dbg(TRACE, "** OUI %02x %02x %02x, type 0x%02x\n", - parsed_info->vndrie.oui[0], - parsed_info->vndrie.oui[1], - parsed_info->vndrie.oui[2], - parsed_info->vndrie.oui_type); - - if (vndr_ies->count >= VNDR_IE_PARSE_LIMIT) - break; -next: - remaining_len -= (ie->len + TLV_HDR_LEN); - if (remaining_len <= TLV_HDR_LEN) - ie = NULL; - else - ie = (struct brcmf_tlv *)(((u8 *)ie) + ie->len + - TLV_HDR_LEN); - } - return err; -} - -static u32 -brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8 *ie_ptr, u32 ie_len, s8 *add_del_cmd) -{ - - __le32 iecount_le; - __le32 pktflag_le; - - strncpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN - 1); - iebuf[VNDR_IE_CMD_LEN - 1] = '\0'; - - iecount_le = cpu_to_le32(1); - memcpy(&iebuf[VNDR_IE_COUNT_OFFSET], &iecount_le, sizeof(iecount_le)); - - pktflag_le = cpu_to_le32(pktflag); - memcpy(&iebuf[VNDR_IE_PKTFLAG_OFFSET], &pktflag_le, sizeof(pktflag_le)); - - memcpy(&iebuf[VNDR_IE_VSIE_OFFSET], ie_ptr, ie_len); - - return ie_len + VNDR_IE_HDR_SIZE; -} - -s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, - const u8 *vndr_ie_buf, u32 vndr_ie_len) -{ - struct brcmf_if *ifp; - struct vif_saved_ie *saved_ie; - s32 err = 0; - u8 *iovar_ie_buf; - u8 *curr_ie_buf; - u8 *mgmt_ie_buf = NULL; - int mgmt_ie_buf_len; - u32 *mgmt_ie_len; - u32 del_add_ie_buf_len = 0; - u32 total_ie_buf_len = 0; - u32 parsed_ie_buf_len = 0; - struct parsed_vndr_ies old_vndr_ies; - struct parsed_vndr_ies new_vndr_ies; - struct parsed_vndr_ie_info *vndrie_info; - s32 i; - u8 *ptr; - int remained_buf_len; - - if (!vif) - return -ENODEV; - ifp = vif->ifp; - saved_ie = &vif->saved_ie; - - brcmf_dbg(TRACE, "bssidx %d, pktflag : 0x%02X\n", ifp->bssidx, pktflag); - iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); - if (!iovar_ie_buf) - return -ENOMEM; - curr_ie_buf = iovar_ie_buf; - switch (pktflag) { - case BRCMF_VNDR_IE_PRBREQ_FLAG: - mgmt_ie_buf = saved_ie->probe_req_ie; - mgmt_ie_len = &saved_ie->probe_req_ie_len; - mgmt_ie_buf_len = sizeof(saved_ie->probe_req_ie); - break; - case BRCMF_VNDR_IE_PRBRSP_FLAG: - mgmt_ie_buf = saved_ie->probe_res_ie; - mgmt_ie_len = &saved_ie->probe_res_ie_len; - mgmt_ie_buf_len = sizeof(saved_ie->probe_res_ie); - break; - case BRCMF_VNDR_IE_BEACON_FLAG: - mgmt_ie_buf = saved_ie->beacon_ie; - mgmt_ie_len = &saved_ie->beacon_ie_len; - mgmt_ie_buf_len = sizeof(saved_ie->beacon_ie); - break; - case BRCMF_VNDR_IE_ASSOCREQ_FLAG: - mgmt_ie_buf = saved_ie->assoc_req_ie; - mgmt_ie_len = &saved_ie->assoc_req_ie_len; - mgmt_ie_buf_len = sizeof(saved_ie->assoc_req_ie); - break; - default: - err = -EPERM; - brcmf_err("not suitable type\n"); - goto exit; - } - - if (vndr_ie_len > mgmt_ie_buf_len) { - err = -ENOMEM; - brcmf_err("extra IE size too big\n"); - goto exit; - } - - /* parse and save new vndr_ie in curr_ie_buff before comparing it */ - if (vndr_ie_buf && vndr_ie_len && curr_ie_buf) { - ptr = curr_ie_buf; - brcmf_parse_vndr_ies(vndr_ie_buf, vndr_ie_len, &new_vndr_ies); - for (i = 0; i < new_vndr_ies.count; i++) { - vndrie_info = &new_vndr_ies.ie_info[i]; - memcpy(ptr + parsed_ie_buf_len, vndrie_info->ie_ptr, - vndrie_info->ie_len); - parsed_ie_buf_len += vndrie_info->ie_len; - } - } - - if (mgmt_ie_buf && *mgmt_ie_len) { - if (parsed_ie_buf_len && (parsed_ie_buf_len == *mgmt_ie_len) && - (memcmp(mgmt_ie_buf, curr_ie_buf, - parsed_ie_buf_len) == 0)) { - brcmf_dbg(TRACE, "Previous mgmt IE equals to current IE\n"); - goto exit; - } - - /* parse old vndr_ie */ - brcmf_parse_vndr_ies(mgmt_ie_buf, *mgmt_ie_len, &old_vndr_ies); - - /* make a command to delete old ie */ - for (i = 0; i < old_vndr_ies.count; i++) { - vndrie_info = &old_vndr_ies.ie_info[i]; - - brcmf_dbg(TRACE, "DEL ID : %d, Len: %d , OUI:%02x:%02x:%02x\n", - vndrie_info->vndrie.id, - vndrie_info->vndrie.len, - vndrie_info->vndrie.oui[0], - vndrie_info->vndrie.oui[1], - vndrie_info->vndrie.oui[2]); - - del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag, - vndrie_info->ie_ptr, - vndrie_info->ie_len, - "del"); - curr_ie_buf += del_add_ie_buf_len; - total_ie_buf_len += del_add_ie_buf_len; - } - } - - *mgmt_ie_len = 0; - /* Add if there is any extra IE */ - if (mgmt_ie_buf && parsed_ie_buf_len) { - ptr = mgmt_ie_buf; - - remained_buf_len = mgmt_ie_buf_len; - - /* make a command to add new ie */ - for (i = 0; i < new_vndr_ies.count; i++) { - vndrie_info = &new_vndr_ies.ie_info[i]; - - /* verify remained buf size before copy data */ - if (remained_buf_len < (vndrie_info->vndrie.len + - VNDR_IE_VSIE_OFFSET)) { - brcmf_err("no space in mgmt_ie_buf: len left %d", - remained_buf_len); - break; - } - remained_buf_len -= (vndrie_info->ie_len + - VNDR_IE_VSIE_OFFSET); - - brcmf_dbg(TRACE, "ADDED ID : %d, Len: %d, OUI:%02x:%02x:%02x\n", - vndrie_info->vndrie.id, - vndrie_info->vndrie.len, - vndrie_info->vndrie.oui[0], - vndrie_info->vndrie.oui[1], - vndrie_info->vndrie.oui[2]); - - del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag, - vndrie_info->ie_ptr, - vndrie_info->ie_len, - "add"); - - /* save the parsed IE in wl struct */ - memcpy(ptr + (*mgmt_ie_len), vndrie_info->ie_ptr, - vndrie_info->ie_len); - *mgmt_ie_len += vndrie_info->ie_len; - - curr_ie_buf += del_add_ie_buf_len; - total_ie_buf_len += del_add_ie_buf_len; - } - } - if (total_ie_buf_len) { - err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf, - total_ie_buf_len); - if (err) - brcmf_err("vndr ie set error : %d\n", err); - } - -exit: - kfree(iovar_ie_buf); - return err; -} - -s32 brcmf_vif_clear_mgmt_ies(struct brcmf_cfg80211_vif *vif) -{ - s32 pktflags[] = { - BRCMF_VNDR_IE_PRBREQ_FLAG, - BRCMF_VNDR_IE_PRBRSP_FLAG, - BRCMF_VNDR_IE_BEACON_FLAG - }; - int i; - - for (i = 0; i < ARRAY_SIZE(pktflags); i++) - brcmf_vif_set_mgmt_ie(vif, pktflags[i], NULL, 0); - - memset(&vif->saved_ie, 0, sizeof(vif->saved_ie)); - return 0; -} - -static s32 -brcmf_config_ap_mgmt_ie(struct brcmf_cfg80211_vif *vif, - struct cfg80211_beacon_data *beacon) -{ - s32 err; - - /* Set Beacon IEs to FW */ - err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_BEACON_FLAG, - beacon->tail, beacon->tail_len); - if (err) { - brcmf_err("Set Beacon IE Failed\n"); - return err; - } - brcmf_dbg(TRACE, "Applied Vndr IEs for Beacon\n"); - - /* Set Probe Response IEs to FW */ - err = brcmf_vif_set_mgmt_ie(vif, BRCMF_VNDR_IE_PRBRSP_FLAG, - beacon->proberesp_ies, - beacon->proberesp_ies_len); - if (err) - brcmf_err("Set Probe Resp IE Failed\n"); - else - brcmf_dbg(TRACE, "Applied Vndr IEs for Probe Resp\n"); - - return err; -} - -static s32 -brcmf_cfg80211_set_channel(struct brcmf_cfg80211_info *cfg, - struct brcmf_if *ifp, - struct ieee80211_channel *channel) -{ - u16 chanspec; - s32 err; - - brcmf_dbg(TRACE, "band=%d, center_freq=%d\n", channel->band, - channel->center_freq); - - chanspec = channel_to_chanspec(&cfg->d11inf, channel); - err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); - - return err; -} - -static s32 -brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_ap_settings *settings) -{ - s32 ie_offset; - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_tlv *ssid_ie; - struct brcmf_ssid_le ssid_le; - s32 err = -EPERM; - struct brcmf_tlv *rsn_ie; - struct brcmf_vs_tlv *wpa_ie; - struct brcmf_join_params join_params; - enum nl80211_iftype dev_role; - struct brcmf_fil_bss_enable_le bss_enable; - - brcmf_dbg(TRACE, "channel_type=%d, beacon_interval=%d, dtim_period=%d,\n", - cfg80211_get_chandef_type(&settings->chandef), - settings->beacon_interval, - settings->dtim_period); - brcmf_dbg(TRACE, "ssid=%s(%zu), auth_type=%d, inactivity_timeout=%d\n", - settings->ssid, settings->ssid_len, settings->auth_type, - settings->inactivity_timeout); - - dev_role = ifp->vif->wdev.iftype; - - memset(&ssid_le, 0, sizeof(ssid_le)); - if (settings->ssid == NULL || settings->ssid_len == 0) { - ie_offset = DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_FIXED_LEN; - ssid_ie = brcmf_parse_tlvs( - (u8 *)&settings->beacon.head[ie_offset], - settings->beacon.head_len - ie_offset, - WLAN_EID_SSID); - if (!ssid_ie) - return -EINVAL; - - memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len); - ssid_le.SSID_len = cpu_to_le32(ssid_ie->len); - brcmf_dbg(TRACE, "SSID is (%s) in Head\n", ssid_le.SSID); - } else { - memcpy(ssid_le.SSID, settings->ssid, settings->ssid_len); - ssid_le.SSID_len = cpu_to_le32((u32)settings->ssid_len); - } - - brcmf_set_mpc(ifp, 0); - brcmf_configure_arp_offload(ifp, false); - - /* find the RSN_IE */ - rsn_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, - settings->beacon.tail_len, WLAN_EID_RSN); - - /* find the WPA_IE */ - wpa_ie = brcmf_find_wpaie((u8 *)settings->beacon.tail, - settings->beacon.tail_len); - - if ((wpa_ie != NULL || rsn_ie != NULL)) { - brcmf_dbg(TRACE, "WPA(2) IE is found\n"); - if (wpa_ie != NULL) { - /* WPA IE */ - err = brcmf_configure_wpaie(ndev, wpa_ie, false); - if (err < 0) - goto exit; - } else { - /* RSN IE */ - err = brcmf_configure_wpaie(ndev, - (struct brcmf_vs_tlv *)rsn_ie, true); - if (err < 0) - goto exit; - } - } else { - brcmf_dbg(TRACE, "No WPA(2) IEs found\n"); - brcmf_configure_opensecurity(ifp); - } - - brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); - - err = brcmf_cfg80211_set_channel(cfg, ifp, settings->chandef.chan); - if (err < 0) { - brcmf_err("Set Channel failed, %d\n", err); - goto exit; - } - - if (settings->beacon_interval) { - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, - settings->beacon_interval); - if (err < 0) { - brcmf_err("Beacon Interval Set Error, %d\n", err); - goto exit; - } - } - if (settings->dtim_period) { - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD, - settings->dtim_period); - if (err < 0) { - brcmf_err("DTIM Interval Set Error, %d\n", err); - goto exit; - } - } - - if (dev_role == NL80211_IFTYPE_AP) { - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); - if (err < 0) { - brcmf_err("BRCMF_C_DOWN error %d\n", err); - goto exit; - } - brcmf_fil_iovar_int_set(ifp, "apsta", 0); - } - - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1); - if (err < 0) { - brcmf_err("SET INFRA error %d\n", err); - goto exit; - } - if (dev_role == NL80211_IFTYPE_AP) { - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1); - if (err < 0) { - brcmf_err("setting AP mode failed %d\n", err); - goto exit; - } - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); - if (err < 0) { - brcmf_err("BRCMF_C_UP error (%d)\n", err); - goto exit; - } - - memset(&join_params, 0, sizeof(join_params)); - /* join parameters starts with ssid */ - memcpy(&join_params.ssid_le, &ssid_le, sizeof(ssid_le)); - /* create softap */ - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, - &join_params, sizeof(join_params)); - if (err < 0) { - brcmf_err("SET SSID error (%d)\n", err); - goto exit; - } - brcmf_dbg(TRACE, "AP mode configuration complete\n"); - } else { - err = brcmf_fil_bsscfg_data_set(ifp, "ssid", &ssid_le, - sizeof(ssid_le)); - if (err < 0) { - brcmf_err("setting ssid failed %d\n", err); - goto exit; - } - bss_enable.bsscfg_idx = cpu_to_le32(ifp->bssidx); - bss_enable.enable = cpu_to_le32(1); - err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable, - sizeof(bss_enable)); - if (err < 0) { - brcmf_err("bss_enable config failed %d\n", err); - goto exit; - } - - brcmf_dbg(TRACE, "GO mode configuration complete\n"); - } - clear_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); - set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); - -exit: - if (err) { - brcmf_set_mpc(ifp, 1); - brcmf_configure_arp_offload(ifp, true); - } - return err; -} - -static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - s32 err; - struct brcmf_fil_bss_enable_le bss_enable; - struct brcmf_join_params join_params; - - brcmf_dbg(TRACE, "Enter\n"); - - if (ifp->vif->wdev.iftype == NL80211_IFTYPE_AP) { - /* Due to most likely deauths outstanding we sleep */ - /* first to make sure they get processed by fw. */ - msleep(400); - - memset(&join_params, 0, sizeof(join_params)); - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, - &join_params, sizeof(join_params)); - if (err < 0) - brcmf_err("SET SSID error (%d)\n", err); - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 0); - if (err < 0) - brcmf_err("BRCMF_C_UP error %d\n", err); - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); - if (err < 0) - brcmf_err("setting AP mode failed %d\n", err); - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 0); - if (err < 0) - brcmf_err("setting INFRA mode failed %d\n", err); - } else { - bss_enable.bsscfg_idx = cpu_to_le32(ifp->bssidx); - bss_enable.enable = cpu_to_le32(0); - err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable, - sizeof(bss_enable)); - if (err < 0) - brcmf_err("bss_enable config failed %d\n", err); - } - brcmf_set_mpc(ifp, 1); - brcmf_configure_arp_offload(ifp, true); - set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); - clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); - - return err; -} - -static s32 -brcmf_cfg80211_change_beacon(struct wiphy *wiphy, struct net_device *ndev, - struct cfg80211_beacon_data *info) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - s32 err; - - brcmf_dbg(TRACE, "Enter\n"); - - err = brcmf_config_ap_mgmt_ie(ifp->vif, info); - - return err; -} - -static int -brcmf_cfg80211_del_station(struct wiphy *wiphy, struct net_device *ndev, - u8 *mac) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_scb_val_le scbval; - struct brcmf_if *ifp = netdev_priv(ndev); - s32 err; - - if (!mac) - return -EFAULT; - - brcmf_dbg(TRACE, "Enter %pM\n", mac); - - if (ifp->vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif) - ifp = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp; - if (!check_vif_up(ifp->vif)) - return -EIO; - - memcpy(&scbval.ea, mac, ETH_ALEN); - scbval.val = cpu_to_le32(WLAN_REASON_DEAUTH_LEAVING); - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON, - &scbval, sizeof(scbval)); - if (err) - brcmf_err("SCB_DEAUTHENTICATE_FOR_REASON failed %d\n", err); - - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - - -static void -brcmf_cfg80211_mgmt_frame_register(struct wiphy *wiphy, - struct wireless_dev *wdev, - u16 frame_type, bool reg) -{ - struct brcmf_cfg80211_vif *vif; - u16 mgmt_type; - - brcmf_dbg(TRACE, "Enter, frame_type %04x, reg=%d\n", frame_type, reg); - - mgmt_type = (frame_type & IEEE80211_FCTL_STYPE) >> 4; - vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev); - if (reg) - vif->mgmt_rx_reg |= BIT(mgmt_type); - else - vif->mgmt_rx_reg &= ~BIT(mgmt_type); -} - - -static int -brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, - struct ieee80211_channel *chan, bool offchan, - unsigned int wait, const u8 *buf, size_t len, - bool no_cck, bool dont_wait_for_ack, u64 *cookie) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - const struct ieee80211_mgmt *mgmt; - struct brcmf_cfg80211_vif *vif; - s32 err = 0; - s32 ie_offset; - s32 ie_len; - struct brcmf_fil_action_frame_le *action_frame; - struct brcmf_fil_af_params_le *af_params; - bool ack; - s32 chan_nr; - - brcmf_dbg(TRACE, "Enter\n"); - - *cookie = 0; - - mgmt = (const struct ieee80211_mgmt *)buf; - - if (!ieee80211_is_mgmt(mgmt->frame_control)) { - brcmf_err("Driver only allows MGMT packet type\n"); - return -EPERM; - } - - if (ieee80211_is_probe_resp(mgmt->frame_control)) { - /* Right now the only reason to get a probe response */ - /* is for p2p listen response or for p2p GO from */ - /* wpa_supplicant. Unfortunately the probe is send */ - /* on primary ndev, while dongle wants it on the p2p */ - /* vif. Since this is only reason for a probe */ - /* response to be sent, the vif is taken from cfg. */ - /* If ever desired to send proberesp for non p2p */ - /* response then data should be checked for */ - /* "DIRECT-". Note in future supplicant will take */ - /* dedicated p2p wdev to do this and then this 'hack'*/ - /* is not needed anymore. */ - ie_offset = DOT11_MGMT_HDR_LEN + - DOT11_BCN_PRB_FIXED_LEN; - ie_len = len - ie_offset; - vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev); - if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif) - vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif; - err = brcmf_vif_set_mgmt_ie(vif, - BRCMF_VNDR_IE_PRBRSP_FLAG, - &buf[ie_offset], - ie_len); - cfg80211_mgmt_tx_status(wdev, *cookie, buf, len, true, - GFP_KERNEL); - } else if (ieee80211_is_action(mgmt->frame_control)) { - af_params = kzalloc(sizeof(*af_params), GFP_KERNEL); - if (af_params == NULL) { - brcmf_err("unable to allocate frame\n"); - err = -ENOMEM; - goto exit; - } - action_frame = &af_params->action_frame; - /* Add the packet Id */ - action_frame->packet_id = cpu_to_le32(*cookie); - /* Add BSSID */ - memcpy(&action_frame->da[0], &mgmt->da[0], ETH_ALEN); - memcpy(&af_params->bssid[0], &mgmt->bssid[0], ETH_ALEN); - /* Add the length exepted for 802.11 header */ - action_frame->len = cpu_to_le16(len - DOT11_MGMT_HDR_LEN); - /* Add the channel */ - chan_nr = ieee80211_frequency_to_channel(chan->center_freq); - af_params->channel = cpu_to_le32(chan_nr); - - memcpy(action_frame->data, &buf[DOT11_MGMT_HDR_LEN], - le16_to_cpu(action_frame->len)); - - brcmf_dbg(TRACE, "Action frame, cookie=%lld, len=%d, freq=%d\n", - *cookie, le16_to_cpu(action_frame->len), - chan->center_freq); - - ack = brcmf_p2p_send_action_frame(cfg, cfg_to_ndev(cfg), - af_params); - - cfg80211_mgmt_tx_status(wdev, *cookie, buf, len, ack, - GFP_KERNEL); - kfree(af_params); - } else { - brcmf_dbg(TRACE, "Unhandled, fc=%04x!!\n", mgmt->frame_control); - brcmf_dbg_hex_dump(true, buf, len, "payload, len=%Zu\n", len); - } - -exit: - return err; -} - - -static int -brcmf_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, - struct wireless_dev *wdev, - u64 cookie) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_cfg80211_vif *vif; - int err = 0; - - brcmf_dbg(TRACE, "Enter p2p listen cancel\n"); - - vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif; - if (vif == NULL) { - brcmf_err("No p2p device available for probe response\n"); - err = -ENODEV; - goto exit; - } - brcmf_p2p_cancel_remain_on_channel(vif->ifp); -exit: - return err; -} - -static int brcmf_cfg80211_crit_proto_start(struct wiphy *wiphy, - struct wireless_dev *wdev, - enum nl80211_crit_proto_id proto, - u16 duration) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_cfg80211_vif *vif; - - vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev); - - /* only DHCP support for now */ - if (proto != NL80211_CRIT_PROTO_DHCP) - return -EINVAL; - - /* suppress and abort scanning */ - set_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status); - brcmf_abort_scanning(cfg); - - return brcmf_btcoex_set_mode(vif, BRCMF_BTCOEX_DISABLED, duration); -} - -static void brcmf_cfg80211_crit_proto_stop(struct wiphy *wiphy, - struct wireless_dev *wdev) -{ - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); - struct brcmf_cfg80211_vif *vif; - - vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev); - - brcmf_btcoex_set_mode(vif, BRCMF_BTCOEX_ENABLED, 0); - clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status); -} - -static struct cfg80211_ops wl_cfg80211_ops = { - .add_virtual_intf = brcmf_cfg80211_add_iface, - .del_virtual_intf = brcmf_cfg80211_del_iface, - .change_virtual_intf = brcmf_cfg80211_change_iface, - .scan = brcmf_cfg80211_scan, - .set_wiphy_params = brcmf_cfg80211_set_wiphy_params, - .join_ibss = brcmf_cfg80211_join_ibss, - .leave_ibss = brcmf_cfg80211_leave_ibss, - .get_station = brcmf_cfg80211_get_station, - .set_tx_power = brcmf_cfg80211_set_tx_power, - .get_tx_power = brcmf_cfg80211_get_tx_power, - .add_key = brcmf_cfg80211_add_key, - .del_key = brcmf_cfg80211_del_key, - .get_key = brcmf_cfg80211_get_key, - .set_default_key = brcmf_cfg80211_config_default_key, - .set_default_mgmt_key = brcmf_cfg80211_config_default_mgmt_key, - .set_power_mgmt = brcmf_cfg80211_set_power_mgmt, - .connect = brcmf_cfg80211_connect, - .disconnect = brcmf_cfg80211_disconnect, - .suspend = brcmf_cfg80211_suspend, - .resume = brcmf_cfg80211_resume, - .set_pmksa = brcmf_cfg80211_set_pmksa, - .del_pmksa = brcmf_cfg80211_del_pmksa, - .flush_pmksa = brcmf_cfg80211_flush_pmksa, - .start_ap = brcmf_cfg80211_start_ap, - .stop_ap = brcmf_cfg80211_stop_ap, - .change_beacon = brcmf_cfg80211_change_beacon, - .del_station = brcmf_cfg80211_del_station, - .sched_scan_start = brcmf_cfg80211_sched_scan_start, - .sched_scan_stop = brcmf_cfg80211_sched_scan_stop, - .mgmt_frame_register = brcmf_cfg80211_mgmt_frame_register, - .mgmt_tx = brcmf_cfg80211_mgmt_tx, - .remain_on_channel = brcmf_p2p_remain_on_channel, - .cancel_remain_on_channel = brcmf_cfg80211_cancel_remain_on_channel, - .start_p2p_device = brcmf_p2p_start_device, - .stop_p2p_device = brcmf_p2p_stop_device, - .crit_proto_start = brcmf_cfg80211_crit_proto_start, - .crit_proto_stop = brcmf_cfg80211_crit_proto_stop, -#ifdef CONFIG_NL80211_TESTMODE - .testmode_cmd = brcmf_cfg80211_testmode -#endif -}; - -static s32 brcmf_nl80211_iftype_to_mode(enum nl80211_iftype type) -{ - switch (type) { - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_WDS: - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_MESH_POINT: - return -ENOTSUPP; - case NL80211_IFTYPE_ADHOC: - return WL_MODE_IBSS; - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_P2P_CLIENT: - return WL_MODE_BSS; - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_P2P_GO: - return WL_MODE_AP; - case NL80211_IFTYPE_P2P_DEVICE: - return WL_MODE_P2P; - case NL80211_IFTYPE_UNSPECIFIED: - default: - break; - } - - return -EINVAL; -} - -static void brcmf_wiphy_pno_params(struct wiphy *wiphy) -{ - /* scheduled scan settings */ - wiphy->max_sched_scan_ssids = BRCMF_PNO_MAX_PFN_COUNT; - wiphy->max_match_sets = BRCMF_PNO_MAX_PFN_COUNT; - wiphy->max_sched_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX; - wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; -} - -static const struct ieee80211_iface_limit brcmf_iface_limits[] = { - { - .max = 2, - .types = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_AP) - }, - { - .max = 1, - .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_P2P_GO) - }, - { - .max = 1, - .types = BIT(NL80211_IFTYPE_P2P_DEVICE) - } -}; -static const struct ieee80211_iface_combination brcmf_iface_combos[] = { - { - .max_interfaces = BRCMF_IFACE_MAX_CNT, - .num_different_channels = 2, - .n_limits = ARRAY_SIZE(brcmf_iface_limits), - .limits = brcmf_iface_limits - } -}; - -static const struct ieee80211_txrx_stypes -brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = { - [NL80211_IFTYPE_STATION] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_P2P_CLIENT] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_P2P_GO] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | - BIT(IEEE80211_STYPE_DISASSOC >> 4) | - BIT(IEEE80211_STYPE_AUTH >> 4) | - BIT(IEEE80211_STYPE_DEAUTH >> 4) | - BIT(IEEE80211_STYPE_ACTION >> 4) - }, - [NL80211_IFTYPE_P2P_DEVICE] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - } -}; - -static struct wiphy *brcmf_setup_wiphy(struct device *phydev) -{ - struct wiphy *wiphy; - s32 err = 0; - - wiphy = wiphy_new(&wl_cfg80211_ops, sizeof(struct brcmf_cfg80211_info)); - if (!wiphy) { - brcmf_err("Could not allocate wiphy device\n"); - return ERR_PTR(-ENOMEM); - } - set_wiphy_dev(wiphy, phydev); - wiphy->max_scan_ssids = WL_NUM_SCAN_MAX; - wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX; - wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX; - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_P2P_GO) | - BIT(NL80211_IFTYPE_P2P_DEVICE); - wiphy->iface_combinations = brcmf_iface_combos; - wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos); - wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - wiphy->cipher_suites = __wl_cipher_suites; - wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites); - wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT | - WIPHY_FLAG_OFFCHAN_TX | - WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; - wiphy->mgmt_stypes = brcmf_txrx_stypes; - wiphy->max_remain_on_channel_duration = 5000; - brcmf_wiphy_pno_params(wiphy); - brcmf_dbg(INFO, "Registering custom regulatory\n"); - wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; - wiphy_apply_custom_regulatory(wiphy, &brcmf_regdom); - err = wiphy_register(wiphy); - if (err < 0) { - brcmf_err("Could not register wiphy device (%d)\n", err); - wiphy_free(wiphy); - return ERR_PTR(err); - } - return wiphy; -} - -struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, - enum nl80211_iftype type, - bool pm_block) -{ - struct brcmf_cfg80211_vif *vif; - - if (cfg->vif_cnt == BRCMF_IFACE_MAX_CNT) - return ERR_PTR(-ENOSPC); - - brcmf_dbg(TRACE, "allocating virtual interface (size=%zu)\n", - sizeof(*vif)); - vif = kzalloc(sizeof(*vif), GFP_KERNEL); - if (!vif) - return ERR_PTR(-ENOMEM); - - vif->wdev.wiphy = cfg->wiphy; - vif->wdev.iftype = type; - - vif->mode = brcmf_nl80211_iftype_to_mode(type); - vif->pm_block = pm_block; - vif->roam_off = -1; - - brcmf_init_prof(&vif->profile); - - list_add_tail(&vif->list, &cfg->vif_list); - cfg->vif_cnt++; - return vif; -} - -void brcmf_free_vif(struct brcmf_cfg80211_info *cfg, - struct brcmf_cfg80211_vif *vif) -{ - list_del(&vif->list); - cfg->vif_cnt--; - - kfree(vif); - if (!cfg->vif_cnt) { - wiphy_unregister(cfg->wiphy); - wiphy_free(cfg->wiphy); - } -} - -static bool brcmf_is_linkup(const struct brcmf_event_msg *e) -{ - u32 event = e->event_code; - u32 status = e->status; - - if (event == BRCMF_E_SET_SSID && status == BRCMF_E_STATUS_SUCCESS) { - brcmf_dbg(CONN, "Processing set ssid\n"); - return true; - } - - return false; -} - -static bool brcmf_is_linkdown(const struct brcmf_event_msg *e) -{ - u32 event = e->event_code; - u16 flags = e->flags; - - if (event == BRCMF_E_LINK && (!(flags & BRCMF_EVENT_MSG_LINK))) { - brcmf_dbg(CONN, "Processing link down\n"); - return true; - } - return false; -} - -static bool brcmf_is_nonetwork(struct brcmf_cfg80211_info *cfg, - const struct brcmf_event_msg *e) -{ - u32 event = e->event_code; - u32 status = e->status; - - if (event == BRCMF_E_LINK && status == BRCMF_E_STATUS_NO_NETWORKS) { - brcmf_dbg(CONN, "Processing Link %s & no network found\n", - e->flags & BRCMF_EVENT_MSG_LINK ? "up" : "down"); - return true; - } - - if (event == BRCMF_E_SET_SSID && status != BRCMF_E_STATUS_SUCCESS) { - brcmf_dbg(CONN, "Processing connecting & no network found\n"); - return true; - } - - return false; -} - -static void brcmf_clear_assoc_ies(struct brcmf_cfg80211_info *cfg) -{ - struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); - - kfree(conn_info->req_ie); - conn_info->req_ie = NULL; - conn_info->req_ie_len = 0; - kfree(conn_info->resp_ie); - conn_info->resp_ie = NULL; - conn_info->resp_ie_len = 0; -} - -static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, - struct brcmf_if *ifp) -{ - struct brcmf_cfg80211_assoc_ielen_le *assoc_info; - struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); - u32 req_len; - u32 resp_len; - s32 err = 0; - - brcmf_clear_assoc_ies(cfg); - - err = brcmf_fil_iovar_data_get(ifp, "assoc_info", - cfg->extra_buf, WL_ASSOC_INFO_MAX); - if (err) { - brcmf_err("could not get assoc info (%d)\n", err); - return err; - } - assoc_info = - (struct brcmf_cfg80211_assoc_ielen_le *)cfg->extra_buf; - req_len = le32_to_cpu(assoc_info->req_len); - resp_len = le32_to_cpu(assoc_info->resp_len); - if (req_len) { - err = brcmf_fil_iovar_data_get(ifp, "assoc_req_ies", - cfg->extra_buf, - WL_ASSOC_INFO_MAX); - if (err) { - brcmf_err("could not get assoc req (%d)\n", err); - return err; - } - conn_info->req_ie_len = req_len; - conn_info->req_ie = - kmemdup(cfg->extra_buf, conn_info->req_ie_len, - GFP_KERNEL); - } else { - conn_info->req_ie_len = 0; - conn_info->req_ie = NULL; - } - if (resp_len) { - err = brcmf_fil_iovar_data_get(ifp, "assoc_resp_ies", - cfg->extra_buf, - WL_ASSOC_INFO_MAX); - if (err) { - brcmf_err("could not get assoc resp (%d)\n", err); - return err; - } - conn_info->resp_ie_len = resp_len; - conn_info->resp_ie = - kmemdup(cfg->extra_buf, conn_info->resp_ie_len, - GFP_KERNEL); - } else { - conn_info->resp_ie_len = 0; - conn_info->resp_ie = NULL; - } - brcmf_dbg(CONN, "req len (%d) resp len (%d)\n", - conn_info->req_ie_len, conn_info->resp_ie_len); - - return err; -} - -static s32 -brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg, - struct net_device *ndev, - const struct brcmf_event_msg *e) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; - struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); - struct wiphy *wiphy = cfg_to_wiphy(cfg); - struct ieee80211_channel *notify_channel = NULL; - struct ieee80211_supported_band *band; - struct brcmf_bss_info_le *bi; - struct brcmu_chan ch; - u32 freq; - s32 err = 0; - u8 *buf; - - brcmf_dbg(TRACE, "Enter\n"); - - brcmf_get_assoc_ies(cfg, ifp); - memcpy(profile->bssid, e->addr, ETH_ALEN); - brcmf_update_bss_info(cfg, ifp); - - buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); - if (buf == NULL) { - err = -ENOMEM; - goto done; - } - - /* data sent to dongle has to be little endian */ - *(__le32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX); - err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, - buf, WL_BSS_INFO_MAX); - - if (err) - goto done; - - bi = (struct brcmf_bss_info_le *)(buf + 4); - ch.chspec = le16_to_cpu(bi->chanspec); - cfg->d11inf.decchspec(&ch); - - if (ch.band == BRCMU_CHAN_BAND_2G) - band = wiphy->bands[IEEE80211_BAND_2GHZ]; - else - band = wiphy->bands[IEEE80211_BAND_5GHZ]; - - freq = ieee80211_channel_to_frequency(ch.chnum, band->band); - notify_channel = ieee80211_get_channel(wiphy, freq); - -done: - kfree(buf); - cfg80211_roamed(ndev, notify_channel, (u8 *)profile->bssid, - conn_info->req_ie, conn_info->req_ie_len, - conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); - brcmf_dbg(CONN, "Report roaming result\n"); - - set_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state); - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 -brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg, - struct net_device *ndev, const struct brcmf_event_msg *e, - bool completed) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; - struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); - s32 err = 0; - - brcmf_dbg(TRACE, "Enter\n"); - - if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTING, - &ifp->vif->sme_state)) { - if (completed) { - brcmf_get_assoc_ies(cfg, ifp); - memcpy(profile->bssid, e->addr, ETH_ALEN); - brcmf_update_bss_info(cfg, ifp); - set_bit(BRCMF_VIF_STATUS_CONNECTED, - &ifp->vif->sme_state); - } - cfg80211_connect_result(ndev, - (u8 *)profile->bssid, - conn_info->req_ie, - conn_info->req_ie_len, - conn_info->resp_ie, - conn_info->resp_ie_len, - completed ? WLAN_STATUS_SUCCESS : - WLAN_STATUS_AUTH_TIMEOUT, - GFP_KERNEL); - brcmf_dbg(CONN, "Report connect result - connection %s\n", - completed ? "succeeded" : "failed"); - } - brcmf_dbg(TRACE, "Exit\n"); - return err; -} - -static s32 -brcmf_notify_connect_status_ap(struct brcmf_cfg80211_info *cfg, - struct net_device *ndev, - const struct brcmf_event_msg *e, void *data) -{ - static int generation; - u32 event = e->event_code; - u32 reason = e->reason; - struct station_info sinfo; - - brcmf_dbg(CONN, "event %d, reason %d\n", event, reason); - if (event == BRCMF_E_LINK && reason == BRCMF_E_REASON_LINK_BSSCFG_DIS && - ndev != cfg_to_ndev(cfg)) { - brcmf_dbg(CONN, "AP mode link down\n"); - complete(&cfg->vif_disabled); - return 0; - } - - if (((event == BRCMF_E_ASSOC_IND) || (event == BRCMF_E_REASSOC_IND)) && - (reason == BRCMF_E_STATUS_SUCCESS)) { - memset(&sinfo, 0, sizeof(sinfo)); - sinfo.filled = STATION_INFO_ASSOC_REQ_IES; - if (!data) { - brcmf_err("No IEs present in ASSOC/REASSOC_IND"); - return -EINVAL; - } - sinfo.assoc_req_ies = data; - sinfo.assoc_req_ies_len = e->datalen; - generation++; - sinfo.generation = generation; - cfg80211_new_sta(ndev, e->addr, &sinfo, GFP_KERNEL); - } else if ((event == BRCMF_E_DISASSOC_IND) || - (event == BRCMF_E_DEAUTH_IND) || - (event == BRCMF_E_DEAUTH)) { - cfg80211_del_sta(ndev, e->addr, GFP_KERNEL); - } - return 0; -} - -static s32 -brcmf_notify_connect_status(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, void *data) -{ - struct brcmf_cfg80211_info *cfg = ifp->drvr->config; - struct net_device *ndev = ifp->ndev; - struct brcmf_cfg80211_profile *profile = &ifp->vif->profile; - s32 err = 0; - - if (ifp->vif->mode == WL_MODE_AP) { - err = brcmf_notify_connect_status_ap(cfg, ndev, e, data); - } else if (brcmf_is_linkup(e)) { - brcmf_dbg(CONN, "Linkup\n"); - if (brcmf_is_ibssmode(ifp->vif)) { - memcpy(profile->bssid, e->addr, ETH_ALEN); - wl_inform_ibss(cfg, ndev, e->addr); - cfg80211_ibss_joined(ndev, e->addr, GFP_KERNEL); - clear_bit(BRCMF_VIF_STATUS_CONNECTING, - &ifp->vif->sme_state); - set_bit(BRCMF_VIF_STATUS_CONNECTED, - &ifp->vif->sme_state); - } else - brcmf_bss_connect_done(cfg, ndev, e, true); - } else if (brcmf_is_linkdown(e)) { - brcmf_dbg(CONN, "Linkdown\n"); - if (!brcmf_is_ibssmode(ifp->vif)) { - brcmf_bss_connect_done(cfg, ndev, e, false); - if (test_and_clear_bit(BRCMF_VIF_STATUS_CONNECTED, - &ifp->vif->sme_state)) - cfg80211_disconnected(ndev, 0, NULL, 0, - GFP_KERNEL); - } - brcmf_link_down(ifp->vif); - brcmf_init_prof(ndev_to_prof(ndev)); - if (ndev != cfg_to_ndev(cfg)) - complete(&cfg->vif_disabled); - } else if (brcmf_is_nonetwork(cfg, e)) { - if (brcmf_is_ibssmode(ifp->vif)) - clear_bit(BRCMF_VIF_STATUS_CONNECTING, - &ifp->vif->sme_state); - else - brcmf_bss_connect_done(cfg, ndev, e, false); - } - - return err; -} - -static s32 -brcmf_notify_roaming_status(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, void *data) -{ - struct brcmf_cfg80211_info *cfg = ifp->drvr->config; - s32 err = 0; - u32 event = e->event_code; - u32 status = e->status; - - if (event == BRCMF_E_ROAM && status == BRCMF_E_STATUS_SUCCESS) { - if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state)) - brcmf_bss_roaming_done(cfg, ifp->ndev, e); - else - brcmf_bss_connect_done(cfg, ifp->ndev, e, true); - } - - return err; -} - -static s32 -brcmf_notify_mic_status(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, void *data) -{ - u16 flags = e->flags; - enum nl80211_key_type key_type; - - if (flags & BRCMF_EVENT_MSG_GROUP) - key_type = NL80211_KEYTYPE_GROUP; - else - key_type = NL80211_KEYTYPE_PAIRWISE; - - cfg80211_michael_mic_failure(ifp->ndev, (u8 *)&e->addr, key_type, -1, - NULL, GFP_KERNEL); - - return 0; -} - -static s32 brcmf_notify_vif_event(struct brcmf_if *ifp, - const struct brcmf_event_msg *e, void *data) -{ - struct brcmf_cfg80211_info *cfg = ifp->drvr->config; - struct brcmf_if_event *ifevent = (struct brcmf_if_event *)data; - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; - struct brcmf_cfg80211_vif *vif; - - brcmf_dbg(TRACE, "Enter: action %u flags %u ifidx %u bsscfg %u\n", - ifevent->action, ifevent->flags, ifevent->ifidx, - ifevent->bssidx); - - mutex_lock(&event->vif_event_lock); - event->action = ifevent->action; - vif = event->vif; - - switch (ifevent->action) { - case BRCMF_E_IF_ADD: - /* waiting process may have timed out */ - if (!cfg->vif_event.vif) { - mutex_unlock(&event->vif_event_lock); - return -EBADF; - } - - ifp->vif = vif; - vif->ifp = ifp; - if (ifp->ndev) { - vif->wdev.netdev = ifp->ndev; - ifp->ndev->ieee80211_ptr = &vif->wdev; - SET_NETDEV_DEV(ifp->ndev, wiphy_dev(cfg->wiphy)); - } - mutex_unlock(&event->vif_event_lock); - wake_up(&event->vif_wq); - return 0; - - case BRCMF_E_IF_DEL: - mutex_unlock(&event->vif_event_lock); - /* event may not be upon user request */ - if (brcmf_cfg80211_vif_event_armed(cfg)) - wake_up(&event->vif_wq); - return 0; - - case BRCMF_E_IF_CHANGE: - mutex_unlock(&event->vif_event_lock); - wake_up(&event->vif_wq); - return 0; - - default: - mutex_unlock(&event->vif_event_lock); - break; - } - return -EINVAL; -} - -static void brcmf_init_conf(struct brcmf_cfg80211_conf *conf) -{ - conf->frag_threshold = (u32)-1; - conf->rts_threshold = (u32)-1; - conf->retry_short = (u32)-1; - conf->retry_long = (u32)-1; - conf->tx_power = -1; -} - -static void brcmf_register_event_handlers(struct brcmf_cfg80211_info *cfg) -{ - brcmf_fweh_register(cfg->pub, BRCMF_E_LINK, - brcmf_notify_connect_status); - brcmf_fweh_register(cfg->pub, BRCMF_E_DEAUTH_IND, - brcmf_notify_connect_status); - brcmf_fweh_register(cfg->pub, BRCMF_E_DEAUTH, - brcmf_notify_connect_status); - brcmf_fweh_register(cfg->pub, BRCMF_E_DISASSOC_IND, - brcmf_notify_connect_status); - brcmf_fweh_register(cfg->pub, BRCMF_E_ASSOC_IND, - brcmf_notify_connect_status); - brcmf_fweh_register(cfg->pub, BRCMF_E_REASSOC_IND, - brcmf_notify_connect_status); - brcmf_fweh_register(cfg->pub, BRCMF_E_ROAM, - brcmf_notify_roaming_status); - brcmf_fweh_register(cfg->pub, BRCMF_E_MIC_ERROR, - brcmf_notify_mic_status); - brcmf_fweh_register(cfg->pub, BRCMF_E_SET_SSID, - brcmf_notify_connect_status); - brcmf_fweh_register(cfg->pub, BRCMF_E_PFN_NET_FOUND, - brcmf_notify_sched_scan_results); - brcmf_fweh_register(cfg->pub, BRCMF_E_IF, - brcmf_notify_vif_event); - brcmf_fweh_register(cfg->pub, BRCMF_E_P2P_PROBEREQ_MSG, - brcmf_p2p_notify_rx_mgmt_p2p_probereq); - brcmf_fweh_register(cfg->pub, BRCMF_E_P2P_DISC_LISTEN_COMPLETE, - brcmf_p2p_notify_listen_complete); - brcmf_fweh_register(cfg->pub, BRCMF_E_ACTION_FRAME_RX, - brcmf_p2p_notify_action_frame_rx); - brcmf_fweh_register(cfg->pub, BRCMF_E_ACTION_FRAME_COMPLETE, - brcmf_p2p_notify_action_tx_complete); - brcmf_fweh_register(cfg->pub, BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE, - brcmf_p2p_notify_action_tx_complete); -} - -static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_info *cfg) -{ - kfree(cfg->conf); - cfg->conf = NULL; - kfree(cfg->escan_ioctl_buf); - cfg->escan_ioctl_buf = NULL; - kfree(cfg->extra_buf); - cfg->extra_buf = NULL; - kfree(cfg->pmk_list); - cfg->pmk_list = NULL; -} - -static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_info *cfg) -{ - cfg->conf = kzalloc(sizeof(*cfg->conf), GFP_KERNEL); - if (!cfg->conf) - goto init_priv_mem_out; - cfg->escan_ioctl_buf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL); - if (!cfg->escan_ioctl_buf) - goto init_priv_mem_out; - cfg->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); - if (!cfg->extra_buf) - goto init_priv_mem_out; - cfg->pmk_list = kzalloc(sizeof(*cfg->pmk_list), GFP_KERNEL); - if (!cfg->pmk_list) - goto init_priv_mem_out; - - return 0; - -init_priv_mem_out: - brcmf_deinit_priv_mem(cfg); - - return -ENOMEM; -} - -static s32 wl_init_priv(struct brcmf_cfg80211_info *cfg) -{ - s32 err = 0; - - cfg->scan_request = NULL; - cfg->pwr_save = true; - cfg->roam_on = true; /* roam on & off switch. - we enable roam per default */ - cfg->active_scan = true; /* we do active scan for - specific scan per default */ - cfg->dongle_up = false; /* dongle is not up yet */ - err = brcmf_init_priv_mem(cfg); - if (err) - return err; - brcmf_register_event_handlers(cfg); - mutex_init(&cfg->usr_sync); - brcmf_init_escan(cfg); - brcmf_init_conf(cfg->conf); - init_completion(&cfg->vif_disabled); - return err; -} - -static void wl_deinit_priv(struct brcmf_cfg80211_info *cfg) -{ - cfg->dongle_up = false; /* dongle down */ - brcmf_abort_scanning(cfg); - brcmf_deinit_priv_mem(cfg); -} - -static void init_vif_event(struct brcmf_cfg80211_vif_event *event) -{ - init_waitqueue_head(&event->vif_wq); - mutex_init(&event->vif_event_lock); -} - -struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, - struct device *busdev) -{ - struct net_device *ndev = drvr->iflist[0]->ndev; - struct brcmf_cfg80211_info *cfg; - struct wiphy *wiphy; - struct brcmf_cfg80211_vif *vif; - struct brcmf_if *ifp; - s32 err = 0; - s32 io_type; - - if (!ndev) { - brcmf_err("ndev is invalid\n"); - return NULL; - } - - ifp = netdev_priv(ndev); - wiphy = brcmf_setup_wiphy(busdev); - if (IS_ERR(wiphy)) - return NULL; - - cfg = wiphy_priv(wiphy); - cfg->wiphy = wiphy; - cfg->pub = drvr; - init_vif_event(&cfg->vif_event); - INIT_LIST_HEAD(&cfg->vif_list); - - vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_STATION, false); - if (IS_ERR(vif)) { - wiphy_free(wiphy); - return NULL; - } - - vif->ifp = ifp; - vif->wdev.netdev = ndev; - ndev->ieee80211_ptr = &vif->wdev; - SET_NETDEV_DEV(ndev, wiphy_dev(cfg->wiphy)); - - err = wl_init_priv(cfg); - if (err) { - brcmf_err("Failed to init iwm_priv (%d)\n", err); - goto cfg80211_attach_out; - } - ifp->vif = vif; - - err = brcmf_p2p_attach(cfg); - if (err) { - brcmf_err("P2P initilisation failed (%d)\n", err); - goto cfg80211_p2p_attach_out; - } - err = brcmf_btcoex_attach(cfg); - if (err) { - brcmf_err("BT-coex initialisation failed (%d)\n", err); - brcmf_p2p_detach(&cfg->p2p); - goto cfg80211_p2p_attach_out; - } - - err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_VERSION, - &io_type); - if (err) { - brcmf_err("Failed to get D11 version (%d)\n", err); - goto cfg80211_p2p_attach_out; - } - cfg->d11inf.io_type = (u8)io_type; - brcmu_d11_attach(&cfg->d11inf); - - return cfg; - -cfg80211_p2p_attach_out: - wl_deinit_priv(cfg); - -cfg80211_attach_out: - brcmf_free_vif(cfg, vif); - return NULL; -} - -void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg) -{ - struct brcmf_cfg80211_vif *vif; - struct brcmf_cfg80211_vif *tmp; - - wl_deinit_priv(cfg); - brcmf_btcoex_detach(cfg); - list_for_each_entry_safe(vif, tmp, &cfg->vif_list, list) { - brcmf_free_vif(cfg, vif); - } -} - -static s32 -brcmf_dongle_roam(struct brcmf_if *ifp, u32 roamvar, u32 bcn_timeout) -{ - s32 err = 0; - __le32 roamtrigger[2]; - __le32 roam_delta[2]; - - /* - * Setup timeout if Beacons are lost and roam is - * off to report link down - */ - if (roamvar) { - err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout); - if (err) { - brcmf_err("bcn_timeout error (%d)\n", err); - goto dongle_rom_out; - } - } - - /* - * Enable/Disable built-in roaming to allow supplicant - * to take care of roaming - */ - brcmf_dbg(INFO, "Internal Roaming = %s\n", roamvar ? "Off" : "On"); - err = brcmf_fil_iovar_int_set(ifp, "roam_off", roamvar); - if (err) { - brcmf_err("roam_off error (%d)\n", err); - goto dongle_rom_out; - } - - roamtrigger[0] = cpu_to_le32(WL_ROAM_TRIGGER_LEVEL); - roamtrigger[1] = cpu_to_le32(BRCM_BAND_ALL); - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_TRIGGER, - (void *)roamtrigger, sizeof(roamtrigger)); - if (err) { - brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err); - goto dongle_rom_out; - } - - roam_delta[0] = cpu_to_le32(WL_ROAM_DELTA); - roam_delta[1] = cpu_to_le32(BRCM_BAND_ALL); - err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_ROAM_DELTA, - (void *)roam_delta, sizeof(roam_delta)); - if (err) { - brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err); - goto dongle_rom_out; - } - -dongle_rom_out: - return err; -} - -static s32 -brcmf_dongle_scantime(struct brcmf_if *ifp, s32 scan_assoc_time, - s32 scan_unassoc_time, s32 scan_passive_time) -{ - s32 err = 0; - - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_CHANNEL_TIME, - scan_assoc_time); - if (err) { - if (err == -EOPNOTSUPP) - brcmf_dbg(INFO, "Scan assoc time is not supported\n"); - else - brcmf_err("Scan assoc time error (%d)\n", err); - goto dongle_scantime_out; - } - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_UNASSOC_TIME, - scan_unassoc_time); - if (err) { - if (err == -EOPNOTSUPP) - brcmf_dbg(INFO, "Scan unassoc time is not supported\n"); - else - brcmf_err("Scan unassoc time error (%d)\n", err); - goto dongle_scantime_out; - } - - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_SCAN_PASSIVE_TIME, - scan_passive_time); - if (err) { - if (err == -EOPNOTSUPP) - brcmf_dbg(INFO, "Scan passive time is not supported\n"); - else - brcmf_err("Scan passive time error (%d)\n", err); - goto dongle_scantime_out; - } - -dongle_scantime_out: - return err; -} - - -static s32 brcmf_construct_reginfo(struct brcmf_cfg80211_info *cfg, u32 bw_cap) -{ - struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); - struct ieee80211_channel *band_chan_arr; - struct brcmf_chanspec_list *list; - struct brcmu_chan ch; - s32 err; - u8 *pbuf; - u32 i, j; - u32 total; - enum ieee80211_band band; - u32 channel; - u32 *n_cnt; - bool ht40_allowed; - u32 index; - u32 ht40_flag; - bool update; - u32 array_size; - - pbuf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL); - - if (pbuf == NULL) - return -ENOMEM; - - list = (struct brcmf_chanspec_list *)pbuf; - - err = brcmf_fil_iovar_data_get(ifp, "chanspecs", pbuf, - BRCMF_DCMD_MEDLEN); - if (err) { - brcmf_err("get chanspecs error (%d)\n", err); - goto exit; - } - - __wl_band_2ghz.n_channels = 0; - __wl_band_5ghz_a.n_channels = 0; - - total = le32_to_cpu(list->count); - for (i = 0; i < total; i++) { - ch.chspec = (u16)le32_to_cpu(list->element[i]); - cfg->d11inf.decchspec(&ch); - - if (ch.band == BRCMU_CHAN_BAND_2G) { - band_chan_arr = __wl_2ghz_channels; - array_size = ARRAY_SIZE(__wl_2ghz_channels); - n_cnt = &__wl_band_2ghz.n_channels; - band = IEEE80211_BAND_2GHZ; - ht40_allowed = (bw_cap == WLC_N_BW_40ALL); - } else if (ch.band == BRCMU_CHAN_BAND_5G) { - band_chan_arr = __wl_5ghz_a_channels; - array_size = ARRAY_SIZE(__wl_5ghz_a_channels); - n_cnt = &__wl_band_5ghz_a.n_channels; - band = IEEE80211_BAND_5GHZ; - ht40_allowed = !(bw_cap == WLC_N_BW_20ALL); - } else { - brcmf_err("Invalid channel Sepc. 0x%x.\n", ch.chspec); - continue; - } - if (!ht40_allowed && ch.bw == BRCMU_CHAN_BW_40) - continue; - update = false; - for (j = 0; (j < *n_cnt && (*n_cnt < array_size)); j++) { - if (band_chan_arr[j].hw_value == ch.chnum) { - update = true; - break; - } - } - if (update) - index = j; - else - index = *n_cnt; - if (index < array_size) { - band_chan_arr[index].center_freq = - ieee80211_channel_to_frequency(ch.chnum, band); - band_chan_arr[index].hw_value = ch.chnum; - - if (ch.bw == BRCMU_CHAN_BW_40 && ht40_allowed) { - /* assuming the order is HT20, HT40 Upper, - * HT40 lower from chanspecs - */ - ht40_flag = band_chan_arr[index].flags & - IEEE80211_CHAN_NO_HT40; - if (ch.sb == BRCMU_CHAN_SB_U) { - if (ht40_flag == IEEE80211_CHAN_NO_HT40) - band_chan_arr[index].flags &= - ~IEEE80211_CHAN_NO_HT40; - band_chan_arr[index].flags |= - IEEE80211_CHAN_NO_HT40PLUS; - } else { - /* It should be one of - * IEEE80211_CHAN_NO_HT40 or - * IEEE80211_CHAN_NO_HT40PLUS - */ - band_chan_arr[index].flags &= - ~IEEE80211_CHAN_NO_HT40; - if (ht40_flag == IEEE80211_CHAN_NO_HT40) - band_chan_arr[index].flags |= - IEEE80211_CHAN_NO_HT40MINUS; - } - } else { - band_chan_arr[index].flags = - IEEE80211_CHAN_NO_HT40; - ch.bw = BRCMU_CHAN_BW_20; - cfg->d11inf.encchspec(&ch); - channel = ch.chspec; - err = brcmf_fil_bsscfg_int_get(ifp, - "per_chan_info", - &channel); - if (!err) { - if (channel & WL_CHAN_RADAR) - band_chan_arr[index].flags |= - (IEEE80211_CHAN_RADAR | - IEEE80211_CHAN_NO_IBSS); - if (channel & WL_CHAN_PASSIVE) - band_chan_arr[index].flags |= - IEEE80211_CHAN_PASSIVE_SCAN; - } - } - if (!update) - (*n_cnt)++; - } - } -exit: - kfree(pbuf); - return err; -} - - -static s32 brcmf_update_wiphybands(struct brcmf_cfg80211_info *cfg) -{ - struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); - struct wiphy *wiphy; - s32 phy_list; - u32 band_list[3]; - u32 nmode; - u32 bw_cap = 0; - s8 phy; - s32 err; - u32 nband; - s32 i; - struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; - s32 index; - - err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_PHYLIST, - &phy_list, sizeof(phy_list)); - if (err) { - brcmf_err("BRCMF_C_GET_PHYLIST error (%d)\n", err); - return err; - } - - phy = ((char *)&phy_list)[0]; - brcmf_dbg(INFO, "BRCMF_C_GET_PHYLIST reported: %c phy\n", phy); - - - err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, - &band_list, sizeof(band_list)); - if (err) { - brcmf_err("BRCMF_C_GET_BANDLIST error (%d)\n", err); - return err; - } - brcmf_dbg(INFO, "BRCMF_C_GET_BANDLIST reported: 0x%08x 0x%08x 0x%08x phy\n", - band_list[0], band_list[1], band_list[2]); - - err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode); - if (err) { - brcmf_err("nmode error (%d)\n", err); - } else { - err = brcmf_fil_iovar_int_get(ifp, "mimo_bw_cap", &bw_cap); - if (err) - brcmf_err("mimo_bw_cap error (%d)\n", err); - } - brcmf_dbg(INFO, "nmode=%d, mimo_bw_cap=%d\n", nmode, bw_cap); - - err = brcmf_construct_reginfo(cfg, bw_cap); - if (err) { - brcmf_err("brcmf_construct_reginfo failed (%d)\n", err); - return err; - } - - nband = band_list[0]; - memset(bands, 0, sizeof(bands)); - - for (i = 1; i <= nband && i < ARRAY_SIZE(band_list); i++) { - index = -1; - if ((band_list[i] == WLC_BAND_5G) && - (__wl_band_5ghz_a.n_channels > 0)) { - index = IEEE80211_BAND_5GHZ; - bands[index] = &__wl_band_5ghz_a; - if ((bw_cap == WLC_N_BW_40ALL) || - (bw_cap == WLC_N_BW_20IN2G_40IN5G)) - bands[index]->ht_cap.cap |= - IEEE80211_HT_CAP_SGI_40; - } else if ((band_list[i] == WLC_BAND_2G) && - (__wl_band_2ghz.n_channels > 0)) { - index = IEEE80211_BAND_2GHZ; - bands[index] = &__wl_band_2ghz; - if (bw_cap == WLC_N_BW_40ALL) - bands[index]->ht_cap.cap |= - IEEE80211_HT_CAP_SGI_40; - } - - if ((index >= 0) && nmode) { - bands[index]->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20; - bands[index]->ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40; - bands[index]->ht_cap.ht_supported = true; - bands[index]->ht_cap.ampdu_factor = - IEEE80211_HT_MAX_AMPDU_64K; - bands[index]->ht_cap.ampdu_density = - IEEE80211_HT_MPDU_DENSITY_16; - /* An HT shall support all EQM rates for one spatial - * stream - */ - bands[index]->ht_cap.mcs.rx_mask[0] = 0xff; - } - } - - wiphy = cfg_to_wiphy(cfg); - wiphy->bands[IEEE80211_BAND_2GHZ] = bands[IEEE80211_BAND_2GHZ]; - wiphy->bands[IEEE80211_BAND_5GHZ] = bands[IEEE80211_BAND_5GHZ]; - wiphy_apply_custom_regulatory(wiphy, &brcmf_regdom); - - return err; -} - - -static s32 brcmf_dongle_probecap(struct brcmf_cfg80211_info *cfg) -{ - return brcmf_update_wiphybands(cfg); -} - -static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg) -{ - struct net_device *ndev; - struct wireless_dev *wdev; - struct brcmf_if *ifp; - s32 power_mode; - s32 err = 0; - - if (cfg->dongle_up) - return err; - - ndev = cfg_to_ndev(cfg); - wdev = ndev->ieee80211_ptr; - ifp = netdev_priv(ndev); - - /* make sure RF is ready for work */ - brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 0); - - brcmf_dongle_scantime(ifp, WL_SCAN_CHANNEL_TIME, - WL_SCAN_UNASSOC_TIME, WL_SCAN_PASSIVE_TIME); - - power_mode = cfg->pwr_save ? PM_FAST : PM_OFF; - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM, power_mode); - if (err) - goto default_conf_out; - brcmf_dbg(INFO, "power save set to %s\n", - (power_mode ? "enabled" : "disabled")); - - err = brcmf_dongle_roam(ifp, (cfg->roam_on ? 0 : 1), WL_BEACON_TIMEOUT); - if (err) - goto default_conf_out; - err = brcmf_cfg80211_change_iface(wdev->wiphy, ndev, wdev->iftype, - NULL, NULL); - if (err) - goto default_conf_out; - err = brcmf_dongle_probecap(cfg); - if (err) - goto default_conf_out; - - brcmf_configure_arp_offload(ifp, true); - - cfg->dongle_up = true; -default_conf_out: - - return err; - -} - -static s32 __brcmf_cfg80211_up(struct brcmf_if *ifp) -{ - set_bit(BRCMF_VIF_STATUS_READY, &ifp->vif->sme_state); - - return brcmf_config_dongle(ifp->drvr->config); -} - -static s32 __brcmf_cfg80211_down(struct brcmf_if *ifp) -{ - struct brcmf_cfg80211_info *cfg = ifp->drvr->config; - - /* - * While going down, if associated with AP disassociate - * from AP to save power - */ - if (check_vif_up(ifp->vif)) { - brcmf_link_down(ifp->vif); - - /* Make sure WPA_Supplicant receives all the event - generated due to DISASSOC call to the fw to keep - the state fw and WPA_Supplicant state consistent - */ - brcmf_delay(500); - } - - brcmf_abort_scanning(cfg); - clear_bit(BRCMF_VIF_STATUS_READY, &ifp->vif->sme_state); - - return 0; -} - -s32 brcmf_cfg80211_up(struct net_device *ndev) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_cfg80211_info *cfg = ifp->drvr->config; - s32 err = 0; - - mutex_lock(&cfg->usr_sync); - err = __brcmf_cfg80211_up(ifp); - mutex_unlock(&cfg->usr_sync); - - return err; -} - -s32 brcmf_cfg80211_down(struct net_device *ndev) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - struct brcmf_cfg80211_info *cfg = ifp->drvr->config; - s32 err = 0; - - mutex_lock(&cfg->usr_sync); - err = __brcmf_cfg80211_down(ifp); - mutex_unlock(&cfg->usr_sync); - - return err; -} - -enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp) -{ - struct wireless_dev *wdev = &ifp->vif->wdev; - - return wdev->iftype; -} - -u32 wl_get_vif_state_all(struct brcmf_cfg80211_info *cfg, unsigned long state) -{ - struct brcmf_cfg80211_vif *vif; - bool result = 0; - - list_for_each_entry(vif, &cfg->vif_list, list) { - if (test_bit(state, &vif->sme_state)) - result++; - } - return result; -} - -static inline bool vif_event_equals(struct brcmf_cfg80211_vif_event *event, - u8 action) -{ - u8 evt_action; - - mutex_lock(&event->vif_event_lock); - evt_action = event->action; - mutex_unlock(&event->vif_event_lock); - return evt_action == action; -} - -void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg, - struct brcmf_cfg80211_vif *vif) -{ - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; - - mutex_lock(&event->vif_event_lock); - event->vif = vif; - event->action = 0; - mutex_unlock(&event->vif_event_lock); -} - -bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg) -{ - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; - bool armed; - - mutex_lock(&event->vif_event_lock); - armed = event->vif != NULL; - mutex_unlock(&event->vif_event_lock); - - return armed; -} -int brcmf_cfg80211_wait_vif_event_timeout(struct brcmf_cfg80211_info *cfg, - u8 action, ulong timeout) -{ - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; - - return wait_event_timeout(event->vif_wq, - vif_event_equals(event, action), timeout); -} - diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h deleted file mode 100644 index d9bdaf9a72d0..000000000000 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h +++ /dev/null @@ -1,511 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _wl_cfg80211_h_ -#define _wl_cfg80211_h_ - -/* for brcmu_d11inf */ -#include - -#define WL_NUM_SCAN_MAX 10 -#define WL_NUM_PMKIDS_MAX MAXPMKID -#define WL_TLV_INFO_MAX 1024 -#define WL_BSS_INFO_MAX 2048 -#define WL_ASSOC_INFO_MAX 512 /* assoc related fil max buf */ -#define WL_EXTRA_BUF_MAX 2048 -#define WL_ROAM_TRIGGER_LEVEL -75 -#define WL_ROAM_DELTA 20 -#define WL_BEACON_TIMEOUT 3 - -#define WL_SCAN_CHANNEL_TIME 40 -#define WL_SCAN_UNASSOC_TIME 40 -#define WL_SCAN_PASSIVE_TIME 120 - -#define WL_ESCAN_BUF_SIZE (1024 * 64) -#define WL_ESCAN_TIMER_INTERVAL_MS 8000 /* E-Scan timeout */ - -#define WL_ESCAN_ACTION_START 1 -#define WL_ESCAN_ACTION_CONTINUE 2 -#define WL_ESCAN_ACTION_ABORT 3 - -#define WL_AUTH_SHARED_KEY 1 /* d11 shared authentication */ -#define IE_MAX_LEN 512 - -/* IE TLV processing */ -#define TLV_LEN_OFF 1 /* length offset */ -#define TLV_HDR_LEN 2 /* header length */ -#define TLV_BODY_OFF 2 /* body offset */ -#define TLV_OUI_LEN 3 /* oui id length */ - -/* 802.11 Mgmt Packet flags */ -#define BRCMF_VNDR_IE_BEACON_FLAG 0x1 -#define BRCMF_VNDR_IE_PRBRSP_FLAG 0x2 -#define BRCMF_VNDR_IE_ASSOCRSP_FLAG 0x4 -#define BRCMF_VNDR_IE_AUTHRSP_FLAG 0x8 -#define BRCMF_VNDR_IE_PRBREQ_FLAG 0x10 -#define BRCMF_VNDR_IE_ASSOCREQ_FLAG 0x20 -/* vendor IE in IW advertisement protocol ID field */ -#define BRCMF_VNDR_IE_IWAPID_FLAG 0x40 -/* allow custom IE id */ -#define BRCMF_VNDR_IE_CUSTOM_FLAG 0x100 - -/* P2P Action Frames flags (spec ordered) */ -#define BRCMF_VNDR_IE_GONREQ_FLAG 0x001000 -#define BRCMF_VNDR_IE_GONRSP_FLAG 0x002000 -#define BRCMF_VNDR_IE_GONCFM_FLAG 0x004000 -#define BRCMF_VNDR_IE_INVREQ_FLAG 0x008000 -#define BRCMF_VNDR_IE_INVRSP_FLAG 0x010000 -#define BRCMF_VNDR_IE_DISREQ_FLAG 0x020000 -#define BRCMF_VNDR_IE_DISRSP_FLAG 0x040000 -#define BRCMF_VNDR_IE_PRDREQ_FLAG 0x080000 -#define BRCMF_VNDR_IE_PRDRSP_FLAG 0x100000 - -#define BRCMF_VNDR_IE_P2PAF_SHIFT 12 - - -/** - * enum brcmf_scan_status - scan engine status - * - * @BRCMF_SCAN_STATUS_BUSY: scanning in progress on dongle. - * @BRCMF_SCAN_STATUS_ABORT: scan being aborted on dongle. - * @BRCMF_SCAN_STATUS_SUPPRESS: scanning is suppressed in driver. - */ -enum brcmf_scan_status { - BRCMF_SCAN_STATUS_BUSY, - BRCMF_SCAN_STATUS_ABORT, - BRCMF_SCAN_STATUS_SUPPRESS, -}; - -/** - * enum wl_mode - driver mode of virtual interface. - * - * @WL_MODE_BSS: connects to BSS. - * @WL_MODE_IBSS: operate as ad-hoc. - * @WL_MODE_AP: operate as access-point. - * @WL_MODE_P2P: provide P2P discovery. - */ -enum wl_mode { - WL_MODE_BSS, - WL_MODE_IBSS, - WL_MODE_AP, - WL_MODE_P2P -}; - -/* dongle configuration */ -struct brcmf_cfg80211_conf { - u32 frag_threshold; - u32 rts_threshold; - u32 retry_short; - u32 retry_long; - s32 tx_power; - struct ieee80211_channel channel; -}; - -/* basic structure of scan request */ -struct brcmf_cfg80211_scan_req { - struct brcmf_ssid_le ssid_le; -}; - -/* basic structure of information element */ -struct brcmf_cfg80211_ie { - u16 offset; - u8 buf[WL_TLV_INFO_MAX]; -}; - -/* security information with currently associated ap */ -struct brcmf_cfg80211_security { - u32 wpa_versions; - u32 auth_type; - u32 cipher_pairwise; - u32 cipher_group; - u32 wpa_auth; -}; - -/** - * struct brcmf_cfg80211_profile - profile information. - * - * @ssid: ssid of associated/associating ap. - * @bssid: bssid of joined/joining ibss. - * @sec: security information. - */ -struct brcmf_cfg80211_profile { - struct brcmf_ssid ssid; - u8 bssid[ETH_ALEN]; - struct brcmf_cfg80211_security sec; -}; - -/** - * enum brcmf_vif_status - bit indices for vif status. - * - * @BRCMF_VIF_STATUS_READY: ready for operation. - * @BRCMF_VIF_STATUS_CONNECTING: connect/join in progress. - * @BRCMF_VIF_STATUS_CONNECTED: connected/joined succesfully. - * @BRCMF_VIF_STATUS_DISCONNECTING: disconnect/disable in progress. - * @BRCMF_VIF_STATUS_AP_CREATING: interface configured for AP operation. - * @BRCMF_VIF_STATUS_AP_CREATED: AP operation started. - */ -enum brcmf_vif_status { - BRCMF_VIF_STATUS_READY, - BRCMF_VIF_STATUS_CONNECTING, - BRCMF_VIF_STATUS_CONNECTED, - BRCMF_VIF_STATUS_DISCONNECTING, - BRCMF_VIF_STATUS_AP_CREATING, - BRCMF_VIF_STATUS_AP_CREATED -}; - -/** - * struct vif_saved_ie - holds saved IEs for a virtual interface. - * - * @probe_req_ie: IE info for probe request. - * @probe_res_ie: IE info for probe response. - * @beacon_ie: IE info for beacon frame. - * @probe_req_ie_len: IE info length for probe request. - * @probe_res_ie_len: IE info length for probe response. - * @beacon_ie_len: IE info length for beacon frame. - */ -struct vif_saved_ie { - u8 probe_req_ie[IE_MAX_LEN]; - u8 probe_res_ie[IE_MAX_LEN]; - u8 beacon_ie[IE_MAX_LEN]; - u8 assoc_req_ie[IE_MAX_LEN]; - u32 probe_req_ie_len; - u32 probe_res_ie_len; - u32 beacon_ie_len; - u32 assoc_req_ie_len; -}; - -/** - * struct brcmf_cfg80211_vif - virtual interface specific information. - * - * @ifp: lower layer interface pointer - * @wdev: wireless device. - * @profile: profile information. - * @mode: operating mode. - * @roam_off: roaming state. - * @sme_state: SME state using enum brcmf_vif_status bits. - * @pm_block: power-management blocked. - * @list: linked list. - * @mgmt_rx_reg: registered rx mgmt frame types. - */ -struct brcmf_cfg80211_vif { - struct brcmf_if *ifp; - struct wireless_dev wdev; - struct brcmf_cfg80211_profile profile; - s32 mode; - s32 roam_off; - unsigned long sme_state; - bool pm_block; - struct vif_saved_ie saved_ie; - struct list_head list; - u16 mgmt_rx_reg; -}; - -/* association inform */ -struct brcmf_cfg80211_connect_info { - u8 *req_ie; - s32 req_ie_len; - u8 *resp_ie; - s32 resp_ie_len; -}; - -/* assoc ie length */ -struct brcmf_cfg80211_assoc_ielen_le { - __le32 req_len; - __le32 resp_len; -}; - -/* wpa2 pmk list */ -struct brcmf_cfg80211_pmk_list { - struct pmkid_list pmkids; - struct pmkid foo[MAXPMKID - 1]; -}; - -/* dongle escan state */ -enum wl_escan_state { - WL_ESCAN_STATE_IDLE, - WL_ESCAN_STATE_SCANNING -}; - -struct escan_info { - u32 escan_state; - u8 escan_buf[WL_ESCAN_BUF_SIZE]; - struct wiphy *wiphy; - struct brcmf_if *ifp; - s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, - struct cfg80211_scan_request *request, u16 action); -}; - -/** - * struct brcmf_pno_param_le - PNO scan configuration parameters - * - * @version: PNO parameters version. - * @scan_freq: scan frequency. - * @lost_network_timeout: #sec. to declare discovered network as lost. - * @flags: Bit field to control features of PFN such as sort criteria auto - * enable switch and background scan. - * @rssi_margin: Margin to avoid jitter for choosing a PFN based on RSSI sort - * criteria. - * @bestn: number of best networks in each scan. - * @mscan: number of scans recorded. - * @repeat: minimum number of scan intervals before scan frequency changes - * in adaptive scan. - * @exp: exponent of 2 for maximum scan interval. - * @slow_freq: slow scan period. - */ -struct brcmf_pno_param_le { - __le32 version; - __le32 scan_freq; - __le32 lost_network_timeout; - __le16 flags; - __le16 rssi_margin; - u8 bestn; - u8 mscan; - u8 repeat; - u8 exp; - __le32 slow_freq; -}; - -/** - * struct brcmf_pno_net_param_le - scan parameters per preferred network. - * - * @ssid: ssid name and its length. - * @flags: bit2: hidden. - * @infra: BSS vs IBSS. - * @auth: Open vs Closed. - * @wpa_auth: WPA type. - * @wsec: wsec value. - */ -struct brcmf_pno_net_param_le { - struct brcmf_ssid_le ssid; - __le32 flags; - __le32 infra; - __le32 auth; - __le32 wpa_auth; - __le32 wsec; -}; - -/** - * struct brcmf_pno_net_info_le - information per found network. - * - * @bssid: BSS network identifier. - * @channel: channel number only. - * @SSID_len: length of ssid. - * @SSID: ssid characters. - * @RSSI: receive signal strength (in dBm). - * @timestamp: age in seconds. - */ -struct brcmf_pno_net_info_le { - u8 bssid[ETH_ALEN]; - u8 channel; - u8 SSID_len; - u8 SSID[32]; - __le16 RSSI; - __le16 timestamp; -}; - -/** - * struct brcmf_pno_scanresults_le - result returned in PNO NET FOUND event. - * - * @version: PNO version identifier. - * @status: indicates completion status of PNO scan. - * @count: amount of brcmf_pno_net_info_le entries appended. - */ -struct brcmf_pno_scanresults_le { - __le32 version; - __le32 status; - __le32 count; -}; - -/** - * struct brcmf_cfg80211_vif_event - virtual interface event information. - * - * @vif_wq: waitqueue awaiting interface event from firmware. - * @vif_event_lock: protects other members in this structure. - * @vif_complete: completion for net attach. - * @action: either add, change, or delete. - * @vif: virtual interface object related to the event. - */ -struct brcmf_cfg80211_vif_event { - wait_queue_head_t vif_wq; - struct mutex vif_event_lock; - u8 action; - struct brcmf_cfg80211_vif *vif; -}; - -/** - * struct brcmf_cfg80211_info - dongle private data of cfg80211 interface - * - * @wiphy: wiphy object for cfg80211 interface. - * @conf: dongle configuration. - * @p2p: peer-to-peer specific information. - * @btcoex: Bluetooth coexistence information. - * @scan_request: cfg80211 scan request object. - * @usr_sync: mainly for dongle up/down synchronization. - * @bss_list: bss_list holding scanned ap information. - * @scan_req_int: internal scan request object. - * @bss_info: bss information for cfg80211 layer. - * @ie: information element object for internal purpose. - * @conn_info: association info. - * @pmk_list: wpa2 pmk list. - * @scan_status: scan activity on the dongle. - * @pub: common driver information. - * @channel: current channel. - * @active_scan: current scan mode. - * @sched_escan: e-scan for scheduled scan support running. - * @ibss_starter: indicates this sta is ibss starter. - * @pwr_save: indicate whether dongle to support power save mode. - * @dongle_up: indicate whether dongle up or not. - * @roam_on: on/off switch for dongle self-roaming. - * @scan_tried: indicates if first scan attempted. - * @dcmd_buf: dcmd buffer. - * @extra_buf: mainly to grab assoc information. - * @debugfsdir: debugfs folder for this device. - * @escan_info: escan information. - * @escan_timeout: Timer for catch scan timeout. - * @escan_timeout_work: scan timeout worker. - * @escan_ioctl_buf: dongle command buffer for escan commands. - * @vif_list: linked list of vif instances. - * @vif_cnt: number of vif instances. - * @vif_event: vif event signalling. - */ -struct brcmf_cfg80211_info { - struct wiphy *wiphy; - struct brcmf_cfg80211_conf *conf; - struct brcmf_p2p_info p2p; - struct brcmf_btcoex_info *btcoex; - struct cfg80211_scan_request *scan_request; - struct mutex usr_sync; - struct brcmf_scan_results *bss_list; - struct brcmf_cfg80211_scan_req scan_req_int; - struct wl_cfg80211_bss_info *bss_info; - struct brcmf_cfg80211_ie ie; - struct brcmf_cfg80211_connect_info conn_info; - struct brcmf_cfg80211_pmk_list *pmk_list; - unsigned long scan_status; - struct brcmf_pub *pub; - u32 channel; - bool active_scan; - bool sched_escan; - bool ibss_starter; - bool pwr_save; - bool dongle_up; - bool roam_on; - bool scan_tried; - u8 *dcmd_buf; - u8 *extra_buf; - struct dentry *debugfsdir; - struct escan_info escan_info; - struct timer_list escan_timeout; - struct work_struct escan_timeout_work; - u8 *escan_ioctl_buf; - struct list_head vif_list; - u8 vif_cnt; - struct brcmf_cfg80211_vif_event vif_event; - struct completion vif_disabled; - struct brcmu_d11inf d11inf; -}; - -/** - * struct brcmf_tlv - tag_ID/length/value_buffer tuple. - * - * @id: tag identifier. - * @len: number of bytes in value buffer. - * @data: value buffer. - */ -struct brcmf_tlv { - u8 id; - u8 len; - u8 data[1]; -}; - -static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_info *cfg) -{ - return cfg->wiphy; -} - -static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w) -{ - return (struct brcmf_cfg80211_info *)(wiphy_priv(w)); -} - -static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd) -{ - return (struct brcmf_cfg80211_info *)(wdev_priv(wd)); -} - -static inline -struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg) -{ - struct brcmf_cfg80211_vif *vif; - vif = list_first_entry(&cfg->vif_list, struct brcmf_cfg80211_vif, list); - return vif->wdev.netdev; -} - -static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev) -{ - return wdev_to_cfg(ndev->ieee80211_ptr); -} - -static inline struct brcmf_cfg80211_profile *ndev_to_prof(struct net_device *nd) -{ - struct brcmf_if *ifp = netdev_priv(nd); - return &ifp->vif->profile; -} - -static inline struct brcmf_cfg80211_vif *ndev_to_vif(struct net_device *ndev) -{ - struct brcmf_if *ifp = netdev_priv(ndev); - return ifp->vif; -} - -static inline struct -brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg) -{ - return &cfg->conn_info; -} - -struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, - struct device *busdev); -void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg); -s32 brcmf_cfg80211_up(struct net_device *ndev); -s32 brcmf_cfg80211_down(struct net_device *ndev); -enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp); - -struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, - enum nl80211_iftype type, - bool pm_block); -void brcmf_free_vif(struct brcmf_cfg80211_info *cfg, - struct brcmf_cfg80211_vif *vif); - -s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, - const u8 *vndr_ie_buf, u32 vndr_ie_len); -s32 brcmf_vif_clear_mgmt_ies(struct brcmf_cfg80211_vif *vif); -struct brcmf_tlv *brcmf_parse_tlvs(void *buf, int buflen, uint key); -u16 channel_to_chanspec(struct brcmu_d11inf *d11inf, - struct ieee80211_channel *ch); -u32 wl_get_vif_state_all(struct brcmf_cfg80211_info *cfg, unsigned long state); -void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg, - struct brcmf_cfg80211_vif *vif); -bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg); -int brcmf_cfg80211_wait_vif_event_timeout(struct brcmf_cfg80211_info *cfg, - u8 action, ulong timeout); -s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, - struct brcmf_if *ifp, bool aborted, - bool fw_abort); -void brcmf_set_mpc(struct brcmf_if *ndev, int mpc); -void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg); - -#endif /* _wl_cfg80211_h_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/Makefile b/drivers/net/wireless/brcm80211/brcmsmac/Makefile deleted file mode 100644 index 32464acccd90..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# -# Makefile fragment for Broadcom 802.11n Networking Device Driver -# -# Copyright (c) 2010 Broadcom Corporation -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION -# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN -# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -ccflags-y := \ - -D__CHECK_ENDIAN__ \ - -Idrivers/net/wireless/brcm80211/brcmsmac \ - -Idrivers/net/wireless/brcm80211/brcmsmac/phy \ - -Idrivers/net/wireless/brcm80211/include - -brcmsmac-y := \ - mac80211_if.o \ - ucode_loader.o \ - ampdu.o \ - antsel.o \ - channel.o \ - main.o \ - phy_shim.o \ - pmu.o \ - rate.o \ - stf.o \ - aiutils.o \ - phy/phy_cmn.o \ - phy/phy_lcn.o \ - phy/phy_n.o \ - phy/phytbl_lcn.o \ - phy/phytbl_n.o \ - phy/phy_qmath.o \ - dma.o \ - brcms_trace_events.o \ - debug.o - -brcmsmac-$(CONFIG_BCMA_DRIVER_GPIO) += led.o - -obj-$(CONFIG_BRCMSMAC) += brcmsmac.o diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c deleted file mode 100644 index e4fd1ee3d690..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +++ /dev/null @@ -1,731 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * File contents: support functions for PCI/PCIe - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include - -#include -#include -#include -#include -#include -#include "types.h" -#include "pub.h" -#include "pmu.h" -#include "aiutils.h" - -/* slow_clk_ctl */ - /* slow clock source mask */ -#define SCC_SS_MASK 0x00000007 - /* source of slow clock is LPO */ -#define SCC_SS_LPO 0x00000000 - /* source of slow clock is crystal */ -#define SCC_SS_XTAL 0x00000001 - /* source of slow clock is PCI */ -#define SCC_SS_PCI 0x00000002 - /* LPOFreqSel, 1: 160Khz, 0: 32KHz */ -#define SCC_LF 0x00000200 - /* LPOPowerDown, 1: LPO is disabled, 0: LPO is enabled */ -#define SCC_LP 0x00000400 - /* ForceSlowClk, 1: sb/cores running on slow clock, 0: power logic control */ -#define SCC_FS 0x00000800 - /* IgnorePllOffReq, 1/0: - * power logic ignores/honors PLL clock disable requests from core - */ -#define SCC_IP 0x00001000 - /* XtalControlEn, 1/0: - * power logic does/doesn't disable crystal when appropriate - */ -#define SCC_XC 0x00002000 - /* XtalPU (RO), 1/0: crystal running/disabled */ -#define SCC_XP 0x00004000 - /* ClockDivider (SlowClk = 1/(4+divisor)) */ -#define SCC_CD_MASK 0xffff0000 -#define SCC_CD_SHIFT 16 - -/* system_clk_ctl */ - /* ILPen: Enable Idle Low Power */ -#define SYCC_IE 0x00000001 - /* ALPen: Enable Active Low Power */ -#define SYCC_AE 0x00000002 - /* ForcePLLOn */ -#define SYCC_FP 0x00000004 - /* Force ALP (or HT if ALPen is not set */ -#define SYCC_AR 0x00000008 - /* Force HT */ -#define SYCC_HR 0x00000010 - /* ClkDiv (ILP = 1/(4 * (divisor + 1)) */ -#define SYCC_CD_MASK 0xffff0000 -#define SYCC_CD_SHIFT 16 - -#define CST4329_SPROM_OTP_SEL_MASK 0x00000003 - /* OTP is powered up, use def. CIS, no SPROM */ -#define CST4329_DEFCIS_SEL 0 - /* OTP is powered up, SPROM is present */ -#define CST4329_SPROM_SEL 1 - /* OTP is powered up, no SPROM */ -#define CST4329_OTP_SEL 2 - /* OTP is powered down, SPROM is present */ -#define CST4329_OTP_PWRDN 3 - -#define CST4329_SPI_SDIO_MODE_MASK 0x00000004 -#define CST4329_SPI_SDIO_MODE_SHIFT 2 - -/* 43224 chip-specific ChipControl register bits */ -#define CCTRL43224_GPIO_TOGGLE 0x8000 - /* 12 mA drive strength */ -#define CCTRL_43224A0_12MA_LED_DRIVE 0x00F000F0 - /* 12 mA drive strength for later 43224s */ -#define CCTRL_43224B0_12MA_LED_DRIVE 0xF0 - -/* 43236 Chip specific ChipStatus register bits */ -#define CST43236_SFLASH_MASK 0x00000040 -#define CST43236_OTP_MASK 0x00000080 -#define CST43236_HSIC_MASK 0x00000100 /* USB/HSIC */ -#define CST43236_BP_CLK 0x00000200 /* 120/96Mbps */ -#define CST43236_BOOT_MASK 0x00001800 -#define CST43236_BOOT_SHIFT 11 -#define CST43236_BOOT_FROM_SRAM 0 /* boot from SRAM, ARM in reset */ -#define CST43236_BOOT_FROM_ROM 1 /* boot from ROM */ -#define CST43236_BOOT_FROM_FLASH 2 /* boot from FLASH */ -#define CST43236_BOOT_FROM_INVALID 3 - -/* 4331 chip-specific ChipControl register bits */ - /* 0 disable */ -#define CCTRL4331_BT_COEXIST (1<<0) - /* 0 SECI is disabled (JTAG functional) */ -#define CCTRL4331_SECI (1<<1) - /* 0 disable */ -#define CCTRL4331_EXT_LNA (1<<2) - /* sprom/gpio13-15 mux */ -#define CCTRL4331_SPROM_GPIO13_15 (1<<3) - /* 0 ext pa disable, 1 ext pa enabled */ -#define CCTRL4331_EXTPA_EN (1<<4) - /* set drive out GPIO_CLK on sprom_cs pin */ -#define CCTRL4331_GPIOCLK_ON_SPROMCS (1<<5) - /* use sprom_cs pin as PCIE mdio interface */ -#define CCTRL4331_PCIE_MDIO_ON_SPROMCS (1<<6) - /* aband extpa will be at gpio2/5 and sprom_dout */ -#define CCTRL4331_EXTPA_ON_GPIO2_5 (1<<7) - /* override core control on pipe_AuxClkEnable */ -#define CCTRL4331_OVR_PIPEAUXCLKEN (1<<8) - /* override core control on pipe_AuxPowerDown */ -#define CCTRL4331_OVR_PIPEAUXPWRDOWN (1<<9) - /* pcie_auxclkenable */ -#define CCTRL4331_PCIE_AUXCLKEN (1<<10) - /* pcie_pipe_pllpowerdown */ -#define CCTRL4331_PCIE_PIPE_PLLDOWN (1<<11) - /* enable bt_shd0 at gpio4 */ -#define CCTRL4331_BT_SHD0_ON_GPIO4 (1<<16) - /* enable bt_shd1 at gpio5 */ -#define CCTRL4331_BT_SHD1_ON_GPIO5 (1<<17) - -/* 4331 Chip specific ChipStatus register bits */ - /* crystal frequency 20/40Mhz */ -#define CST4331_XTAL_FREQ 0x00000001 -#define CST4331_SPROM_PRESENT 0x00000002 -#define CST4331_OTP_PRESENT 0x00000004 -#define CST4331_LDO_RF 0x00000008 -#define CST4331_LDO_PAR 0x00000010 - -/* 4319 chip-specific ChipStatus register bits */ -#define CST4319_SPI_CPULESSUSB 0x00000001 -#define CST4319_SPI_CLK_POL 0x00000002 -#define CST4319_SPI_CLK_PH 0x00000008 - /* gpio [7:6], SDIO CIS selection */ -#define CST4319_SPROM_OTP_SEL_MASK 0x000000c0 -#define CST4319_SPROM_OTP_SEL_SHIFT 6 - /* use default CIS, OTP is powered up */ -#define CST4319_DEFCIS_SEL 0x00000000 - /* use SPROM, OTP is powered up */ -#define CST4319_SPROM_SEL 0x00000040 - /* use OTP, OTP is powered up */ -#define CST4319_OTP_SEL 0x00000080 - /* use SPROM, OTP is powered down */ -#define CST4319_OTP_PWRDN 0x000000c0 - /* gpio [8], sdio/usb mode */ -#define CST4319_SDIO_USB_MODE 0x00000100 -#define CST4319_REMAP_SEL_MASK 0x00000600 -#define CST4319_ILPDIV_EN 0x00000800 -#define CST4319_XTAL_PD_POL 0x00001000 -#define CST4319_LPO_SEL 0x00002000 -#define CST4319_RES_INIT_MODE 0x0000c000 - /* PALDO is configured with external PNP */ -#define CST4319_PALDO_EXTPNP 0x00010000 -#define CST4319_CBUCK_MODE_MASK 0x00060000 -#define CST4319_CBUCK_MODE_BURST 0x00020000 -#define CST4319_CBUCK_MODE_LPBURST 0x00060000 -#define CST4319_RCAL_VALID 0x01000000 -#define CST4319_RCAL_VALUE_MASK 0x3e000000 -#define CST4319_RCAL_VALUE_SHIFT 25 - -/* 4336 chip-specific ChipStatus register bits */ -#define CST4336_SPI_MODE_MASK 0x00000001 -#define CST4336_SPROM_PRESENT 0x00000002 -#define CST4336_OTP_PRESENT 0x00000004 -#define CST4336_ARMREMAP_0 0x00000008 -#define CST4336_ILPDIV_EN_MASK 0x00000010 -#define CST4336_ILPDIV_EN_SHIFT 4 -#define CST4336_XTAL_PD_POL_MASK 0x00000020 -#define CST4336_XTAL_PD_POL_SHIFT 5 -#define CST4336_LPO_SEL_MASK 0x00000040 -#define CST4336_LPO_SEL_SHIFT 6 -#define CST4336_RES_INIT_MODE_MASK 0x00000180 -#define CST4336_RES_INIT_MODE_SHIFT 7 -#define CST4336_CBUCK_MODE_MASK 0x00000600 -#define CST4336_CBUCK_MODE_SHIFT 9 - -/* 4313 chip-specific ChipStatus register bits */ -#define CST4313_SPROM_PRESENT 1 -#define CST4313_OTP_PRESENT 2 -#define CST4313_SPROM_OTP_SEL_MASK 0x00000002 -#define CST4313_SPROM_OTP_SEL_SHIFT 0 - -/* 4313 Chip specific ChipControl register bits */ - /* 12 mA drive strengh for later 4313 */ -#define CCTRL_4313_12MA_LED_DRIVE 0x00000007 - -/* Manufacturer Ids */ -#define MFGID_ARM 0x43b -#define MFGID_BRCM 0x4bf -#define MFGID_MIPS 0x4a7 - -/* Enumeration ROM registers */ -#define ER_EROMENTRY 0x000 -#define ER_REMAPCONTROL 0xe00 -#define ER_REMAPSELECT 0xe04 -#define ER_MASTERSELECT 0xe10 -#define ER_ITCR 0xf00 -#define ER_ITIP 0xf04 - -/* Erom entries */ -#define ER_TAG 0xe -#define ER_TAG1 0x6 -#define ER_VALID 1 -#define ER_CI 0 -#define ER_MP 2 -#define ER_ADD 4 -#define ER_END 0xe -#define ER_BAD 0xffffffff - -/* EROM CompIdentA */ -#define CIA_MFG_MASK 0xfff00000 -#define CIA_MFG_SHIFT 20 -#define CIA_CID_MASK 0x000fff00 -#define CIA_CID_SHIFT 8 -#define CIA_CCL_MASK 0x000000f0 -#define CIA_CCL_SHIFT 4 - -/* EROM CompIdentB */ -#define CIB_REV_MASK 0xff000000 -#define CIB_REV_SHIFT 24 -#define CIB_NSW_MASK 0x00f80000 -#define CIB_NSW_SHIFT 19 -#define CIB_NMW_MASK 0x0007c000 -#define CIB_NMW_SHIFT 14 -#define CIB_NSP_MASK 0x00003e00 -#define CIB_NSP_SHIFT 9 -#define CIB_NMP_MASK 0x000001f0 -#define CIB_NMP_SHIFT 4 - -/* EROM AddrDesc */ -#define AD_ADDR_MASK 0xfffff000 -#define AD_SP_MASK 0x00000f00 -#define AD_SP_SHIFT 8 -#define AD_ST_MASK 0x000000c0 -#define AD_ST_SHIFT 6 -#define AD_ST_SLAVE 0x00000000 -#define AD_ST_BRIDGE 0x00000040 -#define AD_ST_SWRAP 0x00000080 -#define AD_ST_MWRAP 0x000000c0 -#define AD_SZ_MASK 0x00000030 -#define AD_SZ_SHIFT 4 -#define AD_SZ_4K 0x00000000 -#define AD_SZ_8K 0x00000010 -#define AD_SZ_16K 0x00000020 -#define AD_SZ_SZD 0x00000030 -#define AD_AG32 0x00000008 -#define AD_ADDR_ALIGN 0x00000fff -#define AD_SZ_BASE 0x00001000 /* 4KB */ - -/* EROM SizeDesc */ -#define SD_SZ_MASK 0xfffff000 -#define SD_SG32 0x00000008 -#define SD_SZ_ALIGN 0x00000fff - -/* PCI config space bit 4 for 4306c0 slow clock source */ -#define PCI_CFG_GPIO_SCS 0x10 -/* PCI config space GPIO 14 for Xtal power-up */ -#define PCI_CFG_GPIO_XTAL 0x40 -/* PCI config space GPIO 15 for PLL power-down */ -#define PCI_CFG_GPIO_PLL 0x80 - -/* power control defines */ -#define PLL_DELAY 150 /* us pll on delay */ -#define FREF_DELAY 200 /* us fref change delay */ -#define XTAL_ON_DELAY 1000 /* us crystal power-on delay */ - -/* resetctrl */ -#define AIRC_RESET 1 - -#define NOREV -1 /* Invalid rev */ - -/* GPIO Based LED powersave defines */ -#define DEFAULT_GPIO_ONTIME 10 /* Default: 10% on */ -#define DEFAULT_GPIO_OFFTIME 90 /* Default: 10% on */ - -/* When Srom support present, fields in sromcontrol */ -#define SRC_START 0x80000000 -#define SRC_BUSY 0x80000000 -#define SRC_OPCODE 0x60000000 -#define SRC_OP_READ 0x00000000 -#define SRC_OP_WRITE 0x20000000 -#define SRC_OP_WRDIS 0x40000000 -#define SRC_OP_WREN 0x60000000 -#define SRC_OTPSEL 0x00000010 -#define SRC_LOCK 0x00000008 -#define SRC_SIZE_MASK 0x00000006 -#define SRC_SIZE_1K 0x00000000 -#define SRC_SIZE_4K 0x00000002 -#define SRC_SIZE_16K 0x00000004 -#define SRC_SIZE_SHIFT 1 -#define SRC_PRESENT 0x00000001 - -/* External PA enable mask */ -#define GPIO_CTRL_EPA_EN_MASK 0x40 - -#define DEFAULT_GPIOTIMERVAL \ - ((DEFAULT_GPIO_ONTIME << GPIO_ONTIME_SHIFT) | DEFAULT_GPIO_OFFTIME) - -#define BADIDX (SI_MAXCORES + 1) - -#define IS_SIM(chippkg) \ - ((chippkg == HDLSIM_PKG_ID) || (chippkg == HWSIM_PKG_ID)) - -#define GOODCOREADDR(x, b) \ - (((x) >= (b)) && ((x) < ((b) + SI_MAXCORES * SI_CORE_SIZE)) && \ - IS_ALIGNED((x), SI_CORE_SIZE)) - -struct aidmp { - u32 oobselina30; /* 0x000 */ - u32 oobselina74; /* 0x004 */ - u32 PAD[6]; - u32 oobselinb30; /* 0x020 */ - u32 oobselinb74; /* 0x024 */ - u32 PAD[6]; - u32 oobselinc30; /* 0x040 */ - u32 oobselinc74; /* 0x044 */ - u32 PAD[6]; - u32 oobselind30; /* 0x060 */ - u32 oobselind74; /* 0x064 */ - u32 PAD[38]; - u32 oobselouta30; /* 0x100 */ - u32 oobselouta74; /* 0x104 */ - u32 PAD[6]; - u32 oobseloutb30; /* 0x120 */ - u32 oobseloutb74; /* 0x124 */ - u32 PAD[6]; - u32 oobseloutc30; /* 0x140 */ - u32 oobseloutc74; /* 0x144 */ - u32 PAD[6]; - u32 oobseloutd30; /* 0x160 */ - u32 oobseloutd74; /* 0x164 */ - u32 PAD[38]; - u32 oobsynca; /* 0x200 */ - u32 oobseloutaen; /* 0x204 */ - u32 PAD[6]; - u32 oobsyncb; /* 0x220 */ - u32 oobseloutben; /* 0x224 */ - u32 PAD[6]; - u32 oobsyncc; /* 0x240 */ - u32 oobseloutcen; /* 0x244 */ - u32 PAD[6]; - u32 oobsyncd; /* 0x260 */ - u32 oobseloutden; /* 0x264 */ - u32 PAD[38]; - u32 oobaextwidth; /* 0x300 */ - u32 oobainwidth; /* 0x304 */ - u32 oobaoutwidth; /* 0x308 */ - u32 PAD[5]; - u32 oobbextwidth; /* 0x320 */ - u32 oobbinwidth; /* 0x324 */ - u32 oobboutwidth; /* 0x328 */ - u32 PAD[5]; - u32 oobcextwidth; /* 0x340 */ - u32 oobcinwidth; /* 0x344 */ - u32 oobcoutwidth; /* 0x348 */ - u32 PAD[5]; - u32 oobdextwidth; /* 0x360 */ - u32 oobdinwidth; /* 0x364 */ - u32 oobdoutwidth; /* 0x368 */ - u32 PAD[37]; - u32 ioctrlset; /* 0x400 */ - u32 ioctrlclear; /* 0x404 */ - u32 ioctrl; /* 0x408 */ - u32 PAD[61]; - u32 iostatus; /* 0x500 */ - u32 PAD[127]; - u32 ioctrlwidth; /* 0x700 */ - u32 iostatuswidth; /* 0x704 */ - u32 PAD[62]; - u32 resetctrl; /* 0x800 */ - u32 resetstatus; /* 0x804 */ - u32 resetreadid; /* 0x808 */ - u32 resetwriteid; /* 0x80c */ - u32 PAD[60]; - u32 errlogctrl; /* 0x900 */ - u32 errlogdone; /* 0x904 */ - u32 errlogstatus; /* 0x908 */ - u32 errlogaddrlo; /* 0x90c */ - u32 errlogaddrhi; /* 0x910 */ - u32 errlogid; /* 0x914 */ - u32 errloguser; /* 0x918 */ - u32 errlogflags; /* 0x91c */ - u32 PAD[56]; - u32 intstatus; /* 0xa00 */ - u32 PAD[127]; - u32 config; /* 0xe00 */ - u32 PAD[63]; - u32 itcr; /* 0xf00 */ - u32 PAD[3]; - u32 itipooba; /* 0xf10 */ - u32 itipoobb; /* 0xf14 */ - u32 itipoobc; /* 0xf18 */ - u32 itipoobd; /* 0xf1c */ - u32 PAD[4]; - u32 itipoobaout; /* 0xf30 */ - u32 itipoobbout; /* 0xf34 */ - u32 itipoobcout; /* 0xf38 */ - u32 itipoobdout; /* 0xf3c */ - u32 PAD[4]; - u32 itopooba; /* 0xf50 */ - u32 itopoobb; /* 0xf54 */ - u32 itopoobc; /* 0xf58 */ - u32 itopoobd; /* 0xf5c */ - u32 PAD[4]; - u32 itopoobain; /* 0xf70 */ - u32 itopoobbin; /* 0xf74 */ - u32 itopoobcin; /* 0xf78 */ - u32 itopoobdin; /* 0xf7c */ - u32 PAD[4]; - u32 itopreset; /* 0xf90 */ - u32 PAD[15]; - u32 peripherialid4; /* 0xfd0 */ - u32 peripherialid5; /* 0xfd4 */ - u32 peripherialid6; /* 0xfd8 */ - u32 peripherialid7; /* 0xfdc */ - u32 peripherialid0; /* 0xfe0 */ - u32 peripherialid1; /* 0xfe4 */ - u32 peripherialid2; /* 0xfe8 */ - u32 peripherialid3; /* 0xfec */ - u32 componentid0; /* 0xff0 */ - u32 componentid1; /* 0xff4 */ - u32 componentid2; /* 0xff8 */ - u32 componentid3; /* 0xffc */ -}; - -static bool -ai_buscore_setup(struct si_info *sii, struct bcma_device *cc) -{ - /* no cores found, bail out */ - if (cc->bus->nr_cores == 0) - return false; - - /* get chipcommon rev */ - sii->pub.ccrev = cc->id.rev; - - /* get chipcommon chipstatus */ - sii->chipst = bcma_read32(cc, CHIPCREGOFFS(chipstatus)); - - /* get chipcommon capabilites */ - sii->pub.cccaps = bcma_read32(cc, CHIPCREGOFFS(capabilities)); - - /* get pmu rev and caps */ - if (ai_get_cccaps(&sii->pub) & CC_CAP_PMU) { - sii->pub.pmucaps = bcma_read32(cc, - CHIPCREGOFFS(pmucapabilities)); - sii->pub.pmurev = sii->pub.pmucaps & PCAP_REV_MASK; - } - - return true; -} - -static struct si_info *ai_doattach(struct si_info *sii, - struct bcma_bus *pbus) -{ - struct si_pub *sih = &sii->pub; - struct bcma_device *cc; - - sii->icbus = pbus; - sii->pcibus = pbus->host_pci; - - /* switch to Chipcommon core */ - cc = pbus->drv_cc.core; - - sih->chip = pbus->chipinfo.id; - sih->chiprev = pbus->chipinfo.rev; - sih->chippkg = pbus->chipinfo.pkg; - sih->boardvendor = pbus->boardinfo.vendor; - sih->boardtype = pbus->boardinfo.type; - - if (!ai_buscore_setup(sii, cc)) - goto exit; - - /* === NVRAM, clock is ready === */ - bcma_write32(cc, CHIPCREGOFFS(gpiopullup), 0); - bcma_write32(cc, CHIPCREGOFFS(gpiopulldown), 0); - - /* PMU specific initializations */ - if (ai_get_cccaps(sih) & CC_CAP_PMU) { - (void)si_pmu_measure_alpclk(sih); - } - - return sii; - - exit: - - return NULL; -} - -/* - * Allocate a si handle and do the attach. - */ -struct si_pub * -ai_attach(struct bcma_bus *pbus) -{ - struct si_info *sii; - - /* alloc struct si_info */ - sii = kzalloc(sizeof(struct si_info), GFP_ATOMIC); - if (sii == NULL) - return NULL; - - if (ai_doattach(sii, pbus) == NULL) { - kfree(sii); - return NULL; - } - - return (struct si_pub *) sii; -} - -/* may be called with core in reset */ -void ai_detach(struct si_pub *sih) -{ - struct si_info *sii; - - sii = container_of(sih, struct si_info, pub); - - if (sii == NULL) - return; - - kfree(sii); -} - -/* - * read/modify chipcommon core register. - */ -uint ai_cc_reg(struct si_pub *sih, uint regoff, u32 mask, u32 val) -{ - struct bcma_device *cc; - u32 w; - struct si_info *sii; - - sii = container_of(sih, struct si_info, pub); - cc = sii->icbus->drv_cc.core; - - /* mask and set */ - if (mask || val) - bcma_maskset32(cc, regoff, ~mask, val); - - /* readback */ - w = bcma_read32(cc, regoff); - - return w; -} - -/* return the slow clock source - LPO, XTAL, or PCI */ -static uint ai_slowclk_src(struct si_pub *sih, struct bcma_device *cc) -{ - return SCC_SS_XTAL; -} - -/* -* return the ILP (slowclock) min or max frequency -* precondition: we've established the chip has dynamic clk control -*/ -static uint ai_slowclk_freq(struct si_pub *sih, bool max_freq, - struct bcma_device *cc) -{ - uint div; - - /* Chipc rev 10 is InstaClock */ - div = bcma_read32(cc, CHIPCREGOFFS(system_clk_ctl)); - div = 4 * ((div >> SYCC_CD_SHIFT) + 1); - return max_freq ? XTALMAXFREQ : (XTALMINFREQ / div); -} - -static void -ai_clkctl_setdelay(struct si_pub *sih, struct bcma_device *cc) -{ - uint slowmaxfreq, pll_delay, slowclk; - uint pll_on_delay, fref_sel_delay; - - pll_delay = PLL_DELAY; - - /* - * If the slow clock is not sourced by the xtal then - * add the xtal_on_delay since the xtal will also be - * powered down by dynamic clk control logic. - */ - - slowclk = ai_slowclk_src(sih, cc); - if (slowclk != SCC_SS_XTAL) - pll_delay += XTAL_ON_DELAY; - - /* Starting with 4318 it is ILP that is used for the delays */ - slowmaxfreq = - ai_slowclk_freq(sih, false, cc); - - pll_on_delay = ((slowmaxfreq * pll_delay) + 999999) / 1000000; - fref_sel_delay = ((slowmaxfreq * FREF_DELAY) + 999999) / 1000000; - - bcma_write32(cc, CHIPCREGOFFS(pll_on_delay), pll_on_delay); - bcma_write32(cc, CHIPCREGOFFS(fref_sel_delay), fref_sel_delay); -} - -/* initialize power control delay registers */ -void ai_clkctl_init(struct si_pub *sih) -{ - struct si_info *sii = container_of(sih, struct si_info, pub); - struct bcma_device *cc; - - if (!(ai_get_cccaps(sih) & CC_CAP_PWR_CTL)) - return; - - cc = sii->icbus->drv_cc.core; - if (cc == NULL) - return; - - /* set all Instaclk chip ILP to 1 MHz */ - bcma_maskset32(cc, CHIPCREGOFFS(system_clk_ctl), SYCC_CD_MASK, - (ILP_DIV_1MHZ << SYCC_CD_SHIFT)); - - ai_clkctl_setdelay(sih, cc); -} - -/* - * return the value suitable for writing to the - * dot11 core FAST_PWRUP_DELAY register - */ -u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih) -{ - struct si_info *sii; - struct bcma_device *cc; - uint slowminfreq; - u16 fpdelay; - - sii = container_of(sih, struct si_info, pub); - if (ai_get_cccaps(sih) & CC_CAP_PMU) { - fpdelay = si_pmu_fast_pwrup_delay(sih); - return fpdelay; - } - - if (!(ai_get_cccaps(sih) & CC_CAP_PWR_CTL)) - return 0; - - fpdelay = 0; - cc = sii->icbus->drv_cc.core; - if (cc) { - slowminfreq = ai_slowclk_freq(sih, false, cc); - fpdelay = (((bcma_read32(cc, CHIPCREGOFFS(pll_on_delay)) + 2) - * 1000000) + (slowminfreq - 1)) / slowminfreq; - } - return fpdelay; -} - -/* - * clock control policy function throught chipcommon - * - * set dynamic clk control mode (forceslow, forcefast, dynamic) - * returns true if we are forcing fast clock - * this is a wrapper over the next internal function - * to allow flexible policy settings for outside caller - */ -bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode) -{ - struct si_info *sii; - struct bcma_device *cc; - - sii = container_of(sih, struct si_info, pub); - - cc = sii->icbus->drv_cc.core; - bcma_core_set_clockmode(cc, mode); - return mode == BCMA_CLKMODE_FAST; -} - -void ai_pci_up(struct si_pub *sih) -{ - struct si_info *sii; - - sii = container_of(sih, struct si_info, pub); - - if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) - bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci[0], true); -} - -/* Unconfigure and/or apply various WARs when going down */ -void ai_pci_down(struct si_pub *sih) -{ - struct si_info *sii; - - sii = container_of(sih, struct si_info, pub); - - if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) - bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci[0], false); -} - -/* Enable BT-COEX & Ex-PA for 4313 */ -void ai_epa_4313war(struct si_pub *sih) -{ - struct si_info *sii = container_of(sih, struct si_info, pub); - struct bcma_device *cc; - - cc = sii->icbus->drv_cc.core; - - /* EPA Fix */ - bcma_set32(cc, CHIPCREGOFFS(gpiocontrol), GPIO_CTRL_EPA_EN_MASK); -} - -/* check if the device is removed */ -bool ai_deviceremoved(struct si_pub *sih) -{ - u32 w = 0; - struct si_info *sii; - - sii = container_of(sih, struct si_info, pub); - - if (sii->icbus->hosttype != BCMA_HOSTTYPE_PCI) - return false; - - pci_read_config_dword(sii->pcibus, PCI_VENDOR_ID, &w); - if ((w & 0xFFFF) != PCI_VENDOR_ID_BROADCOM) - return true; - - return false; -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h deleted file mode 100644 index 89562c1fbf49..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2011 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_AIUTILS_H_ -#define _BRCM_AIUTILS_H_ - -#include - -#include "types.h" - -/* - * SOC Interconnect Address Map. - * All regions may not exist on all chips. - */ -/* each core gets 4Kbytes for registers */ -#define SI_CORE_SIZE 0x1000 -/* - * Max cores (this is arbitrary, for software - * convenience and could be changed if we - * make any larger chips - */ -#define SI_MAXCORES 16 - -/* Client Mode sb2pcitranslation2 size in bytes */ -#define SI_PCI_DMA_SZ 0x40000000 - -/* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), high 32 bits */ -#define SI_PCIE_DMA_H32 0x80000000 - -/* chipcommon being the first core: */ -#define SI_CC_IDX 0 - -/* SOC Interconnect types (aka chip types) */ -#define SOCI_AI 1 - -/* A register that is common to all cores to - * communicate w/PMU regarding clock control. - */ -#define SI_CLK_CTL_ST 0x1e0 /* clock control and status */ - -/* clk_ctl_st register */ -#define CCS_FORCEALP 0x00000001 /* force ALP request */ -#define CCS_FORCEHT 0x00000002 /* force HT request */ -#define CCS_FORCEILP 0x00000004 /* force ILP request */ -#define CCS_ALPAREQ 0x00000008 /* ALP Avail Request */ -#define CCS_HTAREQ 0x00000010 /* HT Avail Request */ -#define CCS_FORCEHWREQOFF 0x00000020 /* Force HW Clock Request Off */ -#define CCS_ERSRC_REQ_MASK 0x00000700 /* external resource requests */ -#define CCS_ERSRC_REQ_SHIFT 8 -#define CCS_ALPAVAIL 0x00010000 /* ALP is available */ -#define CCS_HTAVAIL 0x00020000 /* HT is available */ -#define CCS_BP_ON_APL 0x00040000 /* RO: running on ALP clock */ -#define CCS_BP_ON_HT 0x00080000 /* RO: running on HT clock */ -#define CCS_ERSRC_STS_MASK 0x07000000 /* external resource status */ -#define CCS_ERSRC_STS_SHIFT 24 - -/* HT avail in chipc and pcmcia on 4328a0 */ -#define CCS0_HTAVAIL 0x00010000 -/* ALP avail in chipc and pcmcia on 4328a0 */ -#define CCS0_ALPAVAIL 0x00020000 - -/* Not really related to SOC Interconnect, but a couple of software - * conventions for the use the flash space: - */ - -/* Minumum amount of flash we support */ -#define FLASH_MIN 0x00020000 /* Minimum flash size */ - -#define CC_SROM_OTP 0x800 /* SROM/OTP address space */ - -/* gpiotimerval */ -#define GPIO_ONTIME_SHIFT 16 - -/* Fields in clkdiv */ -#define CLKD_OTP 0x000f0000 -#define CLKD_OTP_SHIFT 16 - -/* dynamic clock control defines */ -#define LPOMINFREQ 25000 /* low power oscillator min */ -#define LPOMAXFREQ 43000 /* low power oscillator max */ -#define XTALMINFREQ 19800000 /* 20 MHz - 1% */ -#define XTALMAXFREQ 20200000 /* 20 MHz + 1% */ -#define PCIMINFREQ 25000000 /* 25 MHz */ -#define PCIMAXFREQ 34000000 /* 33 MHz + fudge */ - -#define ILP_DIV_5MHZ 0 /* ILP = 5 MHz */ -#define ILP_DIV_1MHZ 4 /* ILP = 1 MHz */ - -/* clkctl xtal what flags */ -#define XTAL 0x1 /* primary crystal oscillator (2050) */ -#define PLL 0x2 /* main chip pll */ - -/* GPIO usage priorities */ -#define GPIO_DRV_PRIORITY 0 /* Driver */ -#define GPIO_APP_PRIORITY 1 /* Application */ -#define GPIO_HI_PRIORITY 2 /* Highest priority. Ignore GPIO - * reservation - */ - -/* GPIO pull up/down */ -#define GPIO_PULLUP 0 -#define GPIO_PULLDN 1 - -/* GPIO event regtype */ -#define GPIO_REGEVT 0 /* GPIO register event */ -#define GPIO_REGEVT_INTMSK 1 /* GPIO register event int mask */ -#define GPIO_REGEVT_INTPOL 2 /* GPIO register event int polarity */ - -/* device path */ -#define SI_DEVPATH_BUFSZ 16 /* min buffer size in bytes */ - -/* SI routine enumeration: to be used by update function with multiple hooks */ -#define SI_DOATTACH 1 -#define SI_PCIDOWN 2 -#define SI_PCIUP 3 - -/* - * Data structure to export all chip specific common variables - * public (read-only) portion of aiutils handle returned by si_attach() - */ -struct si_pub { - int ccrev; /* chip common core rev */ - u32 cccaps; /* chip common capabilities */ - int pmurev; /* pmu core rev */ - u32 pmucaps; /* pmu capabilities */ - uint boardtype; /* board type */ - uint boardvendor; /* board vendor */ - uint chip; /* chip number */ - uint chiprev; /* chip revision */ - uint chippkg; /* chip package option */ -}; - -struct pci_dev; - -struct gpioh_item { - void *arg; - bool level; - void (*handler) (u32 stat, void *arg); - u32 event; - struct gpioh_item *next; -}; - -/* misc si info needed by some of the routines */ -struct si_info { - struct si_pub pub; /* back plane public state (must be first) */ - struct bcma_bus *icbus; /* handle to soc interconnect bus */ - struct pci_dev *pcibus; /* handle to pci bus */ - - u32 chipst; /* chip status */ -}; - -/* - * Many of the routines below take an 'sih' handle as their first arg. - * Allocate this by calling si_attach(). Free it by calling si_detach(). - * At any one time, the sih is logically focused on one particular si core - * (the "current core"). - * Use si_setcore() or si_setcoreidx() to change the association to another core - */ - - -/* AMBA Interconnect exported externs */ -extern u32 ai_core_cflags(struct bcma_device *core, u32 mask, u32 val); - -/* === exported functions === */ -extern struct si_pub *ai_attach(struct bcma_bus *pbus); -extern void ai_detach(struct si_pub *sih); -extern uint ai_cc_reg(struct si_pub *sih, uint regoff, u32 mask, u32 val); -extern void ai_clkctl_init(struct si_pub *sih); -extern u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih); -extern bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode); -extern bool ai_deviceremoved(struct si_pub *sih); - -extern void ai_pci_down(struct si_pub *sih); -extern void ai_pci_up(struct si_pub *sih); - -/* Enable Ex-PA for 4313 */ -extern void ai_epa_4313war(struct si_pub *sih); - -static inline u32 ai_get_cccaps(struct si_pub *sih) -{ - return sih->cccaps; -} - -static inline int ai_get_pmurev(struct si_pub *sih) -{ - return sih->pmurev; -} - -static inline u32 ai_get_pmucaps(struct si_pub *sih) -{ - return sih->pmucaps; -} - -static inline uint ai_get_boardtype(struct si_pub *sih) -{ - return sih->boardtype; -} - -static inline uint ai_get_boardvendor(struct si_pub *sih) -{ - return sih->boardvendor; -} - -static inline uint ai_get_chip_id(struct si_pub *sih) -{ - return sih->chip; -} - -static inline uint ai_get_chiprev(struct si_pub *sih) -{ - return sih->chiprev; -} - -static inline uint ai_get_chippkg(struct si_pub *sih) -{ - return sih->chippkg; -} - -#endif /* _BRCM_AIUTILS_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c deleted file mode 100644 index 1585cc5bf866..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c +++ /dev/null @@ -1,1144 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#include - -#include "rate.h" -#include "scb.h" -#include "phy/phy_hal.h" -#include "antsel.h" -#include "main.h" -#include "ampdu.h" -#include "debug.h" -#include "brcms_trace_events.h" - -/* max number of mpdus in an ampdu */ -#define AMPDU_MAX_MPDU 32 -/* max number of mpdus in an ampdu to a legacy */ -#define AMPDU_NUM_MPDU_LEGACY 16 -/* max Tx ba window size (in pdu) */ -#define AMPDU_TX_BA_MAX_WSIZE 64 -/* default Tx ba window size (in pdu) */ -#define AMPDU_TX_BA_DEF_WSIZE 64 -/* default Rx ba window size (in pdu) */ -#define AMPDU_RX_BA_DEF_WSIZE 64 -/* max Rx ba window size (in pdu) */ -#define AMPDU_RX_BA_MAX_WSIZE 64 -/* max dur of tx ampdu (in msec) */ -#define AMPDU_MAX_DUR 5 -/* default tx retry limit */ -#define AMPDU_DEF_RETRY_LIMIT 5 -/* default tx retry limit at reg rate */ -#define AMPDU_DEF_RR_RETRY_LIMIT 2 -/* default ffpld reserved bytes */ -#define AMPDU_DEF_FFPLD_RSVD 2048 -/* # of inis to be freed on detach */ -#define AMPDU_INI_FREE 10 -/* max # of mpdus released at a time */ -#define AMPDU_SCB_MAX_RELEASE 20 - -#define NUM_FFPLD_FIFO 4 /* number of fifo concerned by pre-loading */ -#define FFPLD_TX_MAX_UNFL 200 /* default value of the average number of ampdu - * without underflows - */ -#define FFPLD_MPDU_SIZE 1800 /* estimate of maximum mpdu size */ -#define FFPLD_MAX_MCS 23 /* we don't deal with mcs 32 */ -#define FFPLD_PLD_INCR 1000 /* increments in bytes */ -#define FFPLD_MAX_AMPDU_CNT 5000 /* maximum number of ampdu we - * accumulate between resets. - */ - -#define AMPDU_DELIMITER_LEN 4 - -/* max allowed number of mpdus in an ampdu (2 streams) */ -#define AMPDU_NUM_MPDU 16 - -#define TX_SEQ_TO_INDEX(seq) ((seq) % AMPDU_TX_BA_MAX_WSIZE) - -/* max possible overhead per mpdu in the ampdu; 3 is for roundup if needed */ -#define AMPDU_MAX_MPDU_OVERHEAD (FCS_LEN + DOT11_ICV_AES_LEN +\ - AMPDU_DELIMITER_LEN + 3\ - + DOT11_A4_HDR_LEN + DOT11_QOS_LEN + DOT11_IV_MAX_LEN) - -/* modulo add/sub, bound = 2^k */ -#define MODADD_POW2(x, y, bound) (((x) + (y)) & ((bound) - 1)) -#define MODSUB_POW2(x, y, bound) (((x) - (y)) & ((bound) - 1)) - -/* structure to hold tx fifo information and pre-loading state - * counters specific to tx underflows of ampdus - * some counters might be redundant with the ones in wlc or ampdu structures. - * This allows to maintain a specific state independently of - * how often and/or when the wlc counters are updated. - * - * ampdu_pld_size: number of bytes to be pre-loaded - * mcs2ampdu_table: per-mcs max # of mpdus in an ampdu - * prev_txfunfl: num of underflows last read from the HW macstats counter - * accum_txfunfl: num of underflows since we modified pld params - * accum_txampdu: num of tx ampdu since we modified pld params - * prev_txampdu: previous reading of tx ampdu - * dmaxferrate: estimated dma avg xfer rate in kbits/sec - */ -struct brcms_fifo_info { - u16 ampdu_pld_size; - u8 mcs2ampdu_table[FFPLD_MAX_MCS + 1]; - u16 prev_txfunfl; - u32 accum_txfunfl; - u32 accum_txampdu; - u32 prev_txampdu; - u32 dmaxferrate; -}; - -/* AMPDU module specific state - * - * wlc: pointer to main wlc structure - * scb_handle: scb cubby handle to retrieve data from scb - * ini_enable: per-tid initiator enable/disable of ampdu - * ba_tx_wsize: Tx ba window size (in pdu) - * ba_rx_wsize: Rx ba window size (in pdu) - * retry_limit: mpdu transmit retry limit - * rr_retry_limit: mpdu transmit retry limit at regular rate - * retry_limit_tid: per-tid mpdu transmit retry limit - * rr_retry_limit_tid: per-tid mpdu transmit retry limit at regular rate - * mpdu_density: min mpdu spacing (0-7) ==> 2^(x-1)/8 usec - * max_pdu: max pdus allowed in ampdu - * dur: max duration of an ampdu (in msec) - * rx_factor: maximum rx ampdu factor (0-3) ==> 2^(13+x) bytes - * ffpld_rsvd: number of bytes to reserve for preload - * max_txlen: max size of ampdu per mcs, bw and sgi - * mfbr: enable multiple fallback rate - * tx_max_funl: underflows should be kept such that - * (tx_max_funfl*underflows) < tx frames - * fifo_tb: table of fifo infos - */ -struct ampdu_info { - struct brcms_c_info *wlc; - int scb_handle; - u8 ini_enable[AMPDU_MAX_SCB_TID]; - u8 ba_tx_wsize; - u8 ba_rx_wsize; - u8 retry_limit; - u8 rr_retry_limit; - u8 retry_limit_tid[AMPDU_MAX_SCB_TID]; - u8 rr_retry_limit_tid[AMPDU_MAX_SCB_TID]; - u8 mpdu_density; - s8 max_pdu; - u8 dur; - u8 rx_factor; - u32 ffpld_rsvd; - u32 max_txlen[MCS_TABLE_SIZE][2][2]; - bool mfbr; - u32 tx_max_funl; - struct brcms_fifo_info fifo_tb[NUM_FFPLD_FIFO]; -}; - -/* used for flushing ampdu packets */ -struct cb_del_ampdu_pars { - struct ieee80211_sta *sta; - u16 tid; -}; - -static void brcms_c_scb_ampdu_update_max_txlen(struct ampdu_info *ampdu, u8 dur) -{ - u32 rate, mcs; - - for (mcs = 0; mcs < MCS_TABLE_SIZE; mcs++) { - /* rate is in Kbps; dur is in msec ==> len = (rate * dur) / 8 */ - /* 20MHz, No SGI */ - rate = mcs_2_rate(mcs, false, false); - ampdu->max_txlen[mcs][0][0] = (rate * dur) >> 3; - /* 40 MHz, No SGI */ - rate = mcs_2_rate(mcs, true, false); - ampdu->max_txlen[mcs][1][0] = (rate * dur) >> 3; - /* 20MHz, SGI */ - rate = mcs_2_rate(mcs, false, true); - ampdu->max_txlen[mcs][0][1] = (rate * dur) >> 3; - /* 40 MHz, SGI */ - rate = mcs_2_rate(mcs, true, true); - ampdu->max_txlen[mcs][1][1] = (rate * dur) >> 3; - } -} - -static bool brcms_c_ampdu_cap(struct ampdu_info *ampdu) -{ - if (BRCMS_PHY_11N_CAP(ampdu->wlc->band)) - return true; - else - return false; -} - -static int brcms_c_ampdu_set(struct ampdu_info *ampdu, bool on) -{ - struct brcms_c_info *wlc = ampdu->wlc; - struct bcma_device *core = wlc->hw->d11core; - - wlc->pub->_ampdu = false; - - if (on) { - if (!(wlc->pub->_n_enab & SUPPORT_11N)) { - brcms_err(core, "wl%d: driver not nmode enabled\n", - wlc->pub->unit); - return -ENOTSUPP; - } - if (!brcms_c_ampdu_cap(ampdu)) { - brcms_err(core, "wl%d: device not ampdu capable\n", - wlc->pub->unit); - return -ENOTSUPP; - } - wlc->pub->_ampdu = on; - } - - return 0; -} - -static void brcms_c_ffpld_init(struct ampdu_info *ampdu) -{ - int i, j; - struct brcms_fifo_info *fifo; - - for (j = 0; j < NUM_FFPLD_FIFO; j++) { - fifo = (ampdu->fifo_tb + j); - fifo->ampdu_pld_size = 0; - for (i = 0; i <= FFPLD_MAX_MCS; i++) - fifo->mcs2ampdu_table[i] = 255; - fifo->dmaxferrate = 0; - fifo->accum_txampdu = 0; - fifo->prev_txfunfl = 0; - fifo->accum_txfunfl = 0; - - } -} - -struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc) -{ - struct ampdu_info *ampdu; - int i; - - ampdu = kzalloc(sizeof(struct ampdu_info), GFP_ATOMIC); - if (!ampdu) - return NULL; - - ampdu->wlc = wlc; - - for (i = 0; i < AMPDU_MAX_SCB_TID; i++) - ampdu->ini_enable[i] = true; - /* Disable ampdu for VO by default */ - ampdu->ini_enable[PRIO_8021D_VO] = false; - ampdu->ini_enable[PRIO_8021D_NC] = false; - - /* Disable ampdu for BK by default since not enough fifo space */ - ampdu->ini_enable[PRIO_8021D_NONE] = false; - ampdu->ini_enable[PRIO_8021D_BK] = false; - - ampdu->ba_tx_wsize = AMPDU_TX_BA_DEF_WSIZE; - ampdu->ba_rx_wsize = AMPDU_RX_BA_DEF_WSIZE; - ampdu->mpdu_density = AMPDU_DEF_MPDU_DENSITY; - ampdu->max_pdu = AUTO; - ampdu->dur = AMPDU_MAX_DUR; - - ampdu->ffpld_rsvd = AMPDU_DEF_FFPLD_RSVD; - /* - * bump max ampdu rcv size to 64k for all 11n - * devices except 4321A0 and 4321A1 - */ - if (BRCMS_ISNPHY(wlc->band) && NREV_LT(wlc->band->phyrev, 2)) - ampdu->rx_factor = IEEE80211_HT_MAX_AMPDU_32K; - else - ampdu->rx_factor = IEEE80211_HT_MAX_AMPDU_64K; - ampdu->retry_limit = AMPDU_DEF_RETRY_LIMIT; - ampdu->rr_retry_limit = AMPDU_DEF_RR_RETRY_LIMIT; - - for (i = 0; i < AMPDU_MAX_SCB_TID; i++) { - ampdu->retry_limit_tid[i] = ampdu->retry_limit; - ampdu->rr_retry_limit_tid[i] = ampdu->rr_retry_limit; - } - - brcms_c_scb_ampdu_update_max_txlen(ampdu, ampdu->dur); - ampdu->mfbr = false; - /* try to set ampdu to the default value */ - brcms_c_ampdu_set(ampdu, wlc->pub->_ampdu); - - ampdu->tx_max_funl = FFPLD_TX_MAX_UNFL; - brcms_c_ffpld_init(ampdu); - - return ampdu; -} - -void brcms_c_ampdu_detach(struct ampdu_info *ampdu) -{ - kfree(ampdu); -} - -static void brcms_c_scb_ampdu_update_config(struct ampdu_info *ampdu, - struct scb *scb) -{ - struct scb_ampdu *scb_ampdu = &scb->scb_ampdu; - int i; - - scb_ampdu->max_pdu = AMPDU_NUM_MPDU; - - /* go back to legacy size if some preloading is occurring */ - for (i = 0; i < NUM_FFPLD_FIFO; i++) { - if (ampdu->fifo_tb[i].ampdu_pld_size > FFPLD_PLD_INCR) - scb_ampdu->max_pdu = AMPDU_NUM_MPDU_LEGACY; - } - - /* apply user override */ - if (ampdu->max_pdu != AUTO) - scb_ampdu->max_pdu = (u8) ampdu->max_pdu; - - scb_ampdu->release = min_t(u8, scb_ampdu->max_pdu, - AMPDU_SCB_MAX_RELEASE); - - if (scb_ampdu->max_rx_ampdu_bytes) - scb_ampdu->release = min_t(u8, scb_ampdu->release, - scb_ampdu->max_rx_ampdu_bytes / 1600); - - scb_ampdu->release = min(scb_ampdu->release, - ampdu->fifo_tb[TX_AC_BE_FIFO]. - mcs2ampdu_table[FFPLD_MAX_MCS]); -} - -static void brcms_c_scb_ampdu_update_config_all(struct ampdu_info *ampdu) -{ - brcms_c_scb_ampdu_update_config(ampdu, &du->wlc->pri_scb); -} - -static void brcms_c_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f) -{ - int i; - u32 phy_rate, dma_rate, tmp; - u8 max_mpdu; - struct brcms_fifo_info *fifo = (ampdu->fifo_tb + f); - - /* recompute the dma rate */ - /* note : we divide/multiply by 100 to avoid integer overflows */ - max_mpdu = min_t(u8, fifo->mcs2ampdu_table[FFPLD_MAX_MCS], - AMPDU_NUM_MPDU_LEGACY); - phy_rate = mcs_2_rate(FFPLD_MAX_MCS, true, false); - dma_rate = - (((phy_rate / 100) * - (max_mpdu * FFPLD_MPDU_SIZE - fifo->ampdu_pld_size)) - / (max_mpdu * FFPLD_MPDU_SIZE)) * 100; - fifo->dmaxferrate = dma_rate; - - /* fill up the mcs2ampdu table; do not recalc the last mcs */ - dma_rate = dma_rate >> 7; - for (i = 0; i < FFPLD_MAX_MCS; i++) { - /* shifting to keep it within integer range */ - phy_rate = mcs_2_rate(i, true, false) >> 7; - if (phy_rate > dma_rate) { - tmp = ((fifo->ampdu_pld_size * phy_rate) / - ((phy_rate - dma_rate) * FFPLD_MPDU_SIZE)) + 1; - tmp = min_t(u32, tmp, 255); - fifo->mcs2ampdu_table[i] = (u8) tmp; - } - } -} - -/* evaluate the dma transfer rate using the tx underflows as feedback. - * If necessary, increase tx fifo preloading. If not enough, - * decrease maximum ampdu size for each mcs till underflows stop - * Return 1 if pre-loading not active, -1 if not an underflow event, - * 0 if pre-loading module took care of the event. - */ -static int brcms_c_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid) -{ - struct ampdu_info *ampdu = wlc->ampdu; - u32 phy_rate = mcs_2_rate(FFPLD_MAX_MCS, true, false); - u32 txunfl_ratio; - u8 max_mpdu; - u32 current_ampdu_cnt = 0; - u16 max_pld_size; - u32 new_txunfl; - struct brcms_fifo_info *fifo = (ampdu->fifo_tb + fid); - uint xmtfifo_sz; - u16 cur_txunfl; - - /* return if we got here for a different reason than underflows */ - cur_txunfl = brcms_b_read_shm(wlc->hw, - M_UCODE_MACSTAT + - offsetof(struct macstat, txfunfl[fid])); - new_txunfl = (u16) (cur_txunfl - fifo->prev_txfunfl); - if (new_txunfl == 0) { - brcms_dbg_ht(wlc->hw->d11core, - "TX status FRAG set but no tx underflows\n"); - return -1; - } - fifo->prev_txfunfl = cur_txunfl; - - if (!ampdu->tx_max_funl) - return 1; - - /* check if fifo is big enough */ - if (brcms_b_xmtfifo_sz_get(wlc->hw, fid, &xmtfifo_sz)) - return -1; - - if ((TXFIFO_SIZE_UNIT * (u32) xmtfifo_sz) <= ampdu->ffpld_rsvd) - return 1; - - max_pld_size = TXFIFO_SIZE_UNIT * xmtfifo_sz - ampdu->ffpld_rsvd; - fifo->accum_txfunfl += new_txunfl; - - /* we need to wait for at least 10 underflows */ - if (fifo->accum_txfunfl < 10) - return 0; - - brcms_dbg_ht(wlc->hw->d11core, "ampdu_count %d tx_underflows %d\n", - current_ampdu_cnt, fifo->accum_txfunfl); - - /* - compute the current ratio of tx unfl per ampdu. - When the current ampdu count becomes too - big while the ratio remains small, we reset - the current count in order to not - introduce too big of a latency in detecting a - large amount of tx underflows later. - */ - - txunfl_ratio = current_ampdu_cnt / fifo->accum_txfunfl; - - if (txunfl_ratio > ampdu->tx_max_funl) { - if (current_ampdu_cnt >= FFPLD_MAX_AMPDU_CNT) - fifo->accum_txfunfl = 0; - - return 0; - } - max_mpdu = min_t(u8, fifo->mcs2ampdu_table[FFPLD_MAX_MCS], - AMPDU_NUM_MPDU_LEGACY); - - /* In case max value max_pdu is already lower than - the fifo depth, there is nothing more we can do. - */ - - if (fifo->ampdu_pld_size >= max_mpdu * FFPLD_MPDU_SIZE) { - fifo->accum_txfunfl = 0; - return 0; - } - - if (fifo->ampdu_pld_size < max_pld_size) { - - /* increment by TX_FIFO_PLD_INC bytes */ - fifo->ampdu_pld_size += FFPLD_PLD_INCR; - if (fifo->ampdu_pld_size > max_pld_size) - fifo->ampdu_pld_size = max_pld_size; - - /* update scb release size */ - brcms_c_scb_ampdu_update_config_all(ampdu); - - /* - * compute a new dma xfer rate for max_mpdu @ max mcs. - * This is the minimum dma rate that can achieve no - * underflow condition for the current mpdu size. - * - * note : we divide/multiply by 100 to avoid integer overflows - */ - fifo->dmaxferrate = - (((phy_rate / 100) * - (max_mpdu * FFPLD_MPDU_SIZE - fifo->ampdu_pld_size)) - / (max_mpdu * FFPLD_MPDU_SIZE)) * 100; - - brcms_dbg_ht(wlc->hw->d11core, - "DMA estimated transfer rate %d; " - "pre-load size %d\n", - fifo->dmaxferrate, fifo->ampdu_pld_size); - } else { - - /* decrease ampdu size */ - if (fifo->mcs2ampdu_table[FFPLD_MAX_MCS] > 1) { - if (fifo->mcs2ampdu_table[FFPLD_MAX_MCS] == 255) - fifo->mcs2ampdu_table[FFPLD_MAX_MCS] = - AMPDU_NUM_MPDU_LEGACY - 1; - else - fifo->mcs2ampdu_table[FFPLD_MAX_MCS] -= 1; - - /* recompute the table */ - brcms_c_ffpld_calc_mcs2ampdu_table(ampdu, fid); - - /* update scb release size */ - brcms_c_scb_ampdu_update_config_all(ampdu); - } - } - fifo->accum_txfunfl = 0; - return 0; -} - -void -brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid, - u8 ba_wsize, /* negotiated ba window size (in pdu) */ - uint max_rx_ampdu_bytes) /* from ht_cap in beacon */ -{ - struct scb_ampdu *scb_ampdu; - struct scb_ampdu_tid_ini *ini; - struct ampdu_info *ampdu = wlc->ampdu; - struct scb *scb = &wlc->pri_scb; - scb_ampdu = &scb->scb_ampdu; - - if (!ampdu->ini_enable[tid]) { - brcms_err(wlc->hw->d11core, "%s: Rejecting tid %d\n", - __func__, tid); - return; - } - - ini = &scb_ampdu->ini[tid]; - ini->tid = tid; - ini->scb = scb_ampdu->scb; - ini->ba_wsize = ba_wsize; - scb_ampdu->max_rx_ampdu_bytes = max_rx_ampdu_bytes; -} - -void brcms_c_ampdu_reset_session(struct brcms_ampdu_session *session, - struct brcms_c_info *wlc) -{ - session->wlc = wlc; - skb_queue_head_init(&session->skb_list); - session->max_ampdu_len = 0; /* determined from first MPDU */ - session->max_ampdu_frames = 0; /* determined from first MPDU */ - session->ampdu_len = 0; - session->dma_len = 0; -} - -/* - * Preps the given packet for AMPDU based on the session data. If the - * frame cannot be accomodated in the current session, -ENOSPC is - * returned. - */ -int brcms_c_ampdu_add_frame(struct brcms_ampdu_session *session, - struct sk_buff *p) -{ - struct brcms_c_info *wlc = session->wlc; - struct ampdu_info *ampdu = wlc->ampdu; - struct scb *scb = &wlc->pri_scb; - struct scb_ampdu *scb_ampdu = &scb->scb_ampdu; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(p); - struct ieee80211_tx_rate *txrate = tx_info->status.rates; - struct d11txh *txh = (struct d11txh *)p->data; - unsigned ampdu_frames; - u8 ndelim, tid; - u8 *plcp; - uint len; - u16 mcl; - bool fbr_iscck; - bool rr; - - ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM]; - plcp = (u8 *)(txh + 1); - fbr_iscck = !(le16_to_cpu(txh->XtraFrameTypes) & 0x03); - len = fbr_iscck ? BRCMS_GET_CCK_PLCP_LEN(txh->FragPLCPFallback) : - BRCMS_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback); - len = roundup(len, 4) + (ndelim + 1) * AMPDU_DELIMITER_LEN; - - ampdu_frames = skb_queue_len(&session->skb_list); - if (ampdu_frames != 0) { - struct sk_buff *first; - - if (ampdu_frames + 1 > session->max_ampdu_frames || - session->ampdu_len + len > session->max_ampdu_len) - return -ENOSPC; - - /* - * We aren't really out of space if the new frame is of - * a different priority, but we want the same behaviour - * so return -ENOSPC anyway. - * - * XXX: The old AMPDU code did this, but is it really - * necessary? - */ - first = skb_peek(&session->skb_list); - if (p->priority != first->priority) - return -ENOSPC; - } - - /* - * Now that we're sure this frame can be accomodated, update the - * session information. - */ - session->ampdu_len += len; - session->dma_len += p->len; - - tid = (u8)p->priority; - - /* Handle retry limits */ - if (txrate[0].count <= ampdu->rr_retry_limit_tid[tid]) { - txrate[0].count++; - rr = true; - } else { - txrate[1].count++; - rr = false; - } - - if (ampdu_frames == 0) { - u8 plcp0, plcp3, is40, sgi, mcs; - uint fifo = le16_to_cpu(txh->TxFrameID) & TXFID_QUEUE_MASK; - struct brcms_fifo_info *f = &du->fifo_tb[fifo]; - - if (rr) { - plcp0 = plcp[0]; - plcp3 = plcp[3]; - } else { - plcp0 = txh->FragPLCPFallback[0]; - plcp3 = txh->FragPLCPFallback[3]; - - } - - /* Limit AMPDU size based on MCS */ - is40 = (plcp0 & MIMO_PLCP_40MHZ) ? 1 : 0; - sgi = plcp3_issgi(plcp3) ? 1 : 0; - mcs = plcp0 & ~MIMO_PLCP_40MHZ; - session->max_ampdu_len = min(scb_ampdu->max_rx_ampdu_bytes, - ampdu->max_txlen[mcs][is40][sgi]); - - session->max_ampdu_frames = scb_ampdu->max_pdu; - if (mcs_2_rate(mcs, true, false) >= f->dmaxferrate) { - session->max_ampdu_frames = - min_t(u16, f->mcs2ampdu_table[mcs], - session->max_ampdu_frames); - } - } - - /* - * Treat all frames as "middle" frames of AMPDU here. First and - * last frames must be fixed up after all MPDUs have been prepped. - */ - mcl = le16_to_cpu(txh->MacTxControlLow); - mcl &= ~TXC_AMPDU_MASK; - mcl |= (TXC_AMPDU_MIDDLE << TXC_AMPDU_SHIFT); - mcl &= ~(TXC_STARTMSDU | TXC_SENDRTS | TXC_SENDCTS); - txh->MacTxControlLow = cpu_to_le16(mcl); - txh->PreloadSize = 0; /* always default to 0 */ - - skb_queue_tail(&session->skb_list, p); - - return 0; -} - -void brcms_c_ampdu_finalize(struct brcms_ampdu_session *session) -{ - struct brcms_c_info *wlc = session->wlc; - struct ampdu_info *ampdu = wlc->ampdu; - struct sk_buff *first, *last; - struct d11txh *txh; - struct ieee80211_tx_info *tx_info; - struct ieee80211_tx_rate *txrate; - u8 ndelim; - u8 *plcp; - uint len; - uint fifo; - struct brcms_fifo_info *f; - u16 mcl; - bool fbr; - bool fbr_iscck; - struct ieee80211_rts *rts; - bool use_rts = false, use_cts = false; - u16 dma_len = session->dma_len; - u16 mimo_ctlchbw = PHY_TXC1_BW_20MHZ; - u32 rspec = 0, rspec_fallback = 0; - u32 rts_rspec = 0, rts_rspec_fallback = 0; - u8 plcp0, plcp3, is40, sgi, mcs; - u16 mch; - u8 preamble_type = BRCMS_GF_PREAMBLE; - u8 fbr_preamble_type = BRCMS_GF_PREAMBLE; - u8 rts_preamble_type = BRCMS_LONG_PREAMBLE; - u8 rts_fbr_preamble_type = BRCMS_LONG_PREAMBLE; - - if (skb_queue_empty(&session->skb_list)) - return; - - first = skb_peek(&session->skb_list); - last = skb_peek_tail(&session->skb_list); - - /* Need to fix up last MPDU first to adjust AMPDU length */ - txh = (struct d11txh *)last->data; - fifo = le16_to_cpu(txh->TxFrameID) & TXFID_QUEUE_MASK; - f = &du->fifo_tb[fifo]; - - mcl = le16_to_cpu(txh->MacTxControlLow); - mcl &= ~TXC_AMPDU_MASK; - mcl |= (TXC_AMPDU_LAST << TXC_AMPDU_SHIFT); - txh->MacTxControlLow = cpu_to_le16(mcl); - - /* remove the null delimiter after last mpdu */ - ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM]; - txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM] = 0; - session->ampdu_len -= ndelim * AMPDU_DELIMITER_LEN; - - /* remove the pad len from last mpdu */ - fbr_iscck = ((le16_to_cpu(txh->XtraFrameTypes) & 0x3) == 0); - len = fbr_iscck ? BRCMS_GET_CCK_PLCP_LEN(txh->FragPLCPFallback) : - BRCMS_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback); - session->ampdu_len -= roundup(len, 4) - len; - - /* Now fix up the first MPDU */ - tx_info = IEEE80211_SKB_CB(first); - txrate = tx_info->status.rates; - txh = (struct d11txh *)first->data; - plcp = (u8 *)(txh + 1); - rts = (struct ieee80211_rts *)&txh->rts_frame; - - mcl = le16_to_cpu(txh->MacTxControlLow); - /* If only one MPDU leave it marked as last */ - if (first != last) { - mcl &= ~TXC_AMPDU_MASK; - mcl |= (TXC_AMPDU_FIRST << TXC_AMPDU_SHIFT); - } - mcl |= TXC_STARTMSDU; - if (ieee80211_is_rts(rts->frame_control)) { - mcl |= TXC_SENDRTS; - use_rts = true; - } - if (ieee80211_is_cts(rts->frame_control)) { - mcl |= TXC_SENDCTS; - use_cts = true; - } - txh->MacTxControlLow = cpu_to_le16(mcl); - - fbr = txrate[1].count > 0; - if (!fbr) { - plcp0 = plcp[0]; - plcp3 = plcp[3]; - } else { - plcp0 = txh->FragPLCPFallback[0]; - plcp3 = txh->FragPLCPFallback[3]; - } - is40 = (plcp0 & MIMO_PLCP_40MHZ) ? 1 : 0; - sgi = plcp3_issgi(plcp3) ? 1 : 0; - mcs = plcp0 & ~MIMO_PLCP_40MHZ; - - if (is40) { - if (CHSPEC_SB_UPPER(wlc_phy_chanspec_get(wlc->band->pi))) - mimo_ctlchbw = PHY_TXC1_BW_20MHZ_UP; - else - mimo_ctlchbw = PHY_TXC1_BW_20MHZ; - } - - /* rebuild the rspec and rspec_fallback */ - rspec = RSPEC_MIMORATE; - rspec |= plcp[0] & ~MIMO_PLCP_40MHZ; - if (plcp[0] & MIMO_PLCP_40MHZ) - rspec |= (PHY_TXC1_BW_40MHZ << RSPEC_BW_SHIFT); - - fbr_iscck = !(le16_to_cpu(txh->XtraFrameTypes) & 0x03); - if (fbr_iscck) { - rspec_fallback = - cck_rspec(cck_phy2mac_rate(txh->FragPLCPFallback[0])); - } else { - rspec_fallback = RSPEC_MIMORATE; - rspec_fallback |= txh->FragPLCPFallback[0] & ~MIMO_PLCP_40MHZ; - if (txh->FragPLCPFallback[0] & MIMO_PLCP_40MHZ) - rspec_fallback |= PHY_TXC1_BW_40MHZ << RSPEC_BW_SHIFT; - } - - if (use_rts || use_cts) { - rts_rspec = - brcms_c_rspec_to_rts_rspec(wlc, rspec, - false, mimo_ctlchbw); - rts_rspec_fallback = - brcms_c_rspec_to_rts_rspec(wlc, rspec_fallback, - false, mimo_ctlchbw); - } - - BRCMS_SET_MIMO_PLCP_LEN(plcp, session->ampdu_len); - /* mark plcp to indicate ampdu */ - BRCMS_SET_MIMO_PLCP_AMPDU(plcp); - - /* reset the mixed mode header durations */ - if (txh->MModeLen) { - u16 mmodelen = brcms_c_calc_lsig_len(wlc, rspec, - session->ampdu_len); - txh->MModeLen = cpu_to_le16(mmodelen); - preamble_type = BRCMS_MM_PREAMBLE; - } - if (txh->MModeFbrLen) { - u16 mmfbrlen = brcms_c_calc_lsig_len(wlc, rspec_fallback, - session->ampdu_len); - txh->MModeFbrLen = cpu_to_le16(mmfbrlen); - fbr_preamble_type = BRCMS_MM_PREAMBLE; - } - - /* set the preload length */ - if (mcs_2_rate(mcs, true, false) >= f->dmaxferrate) { - dma_len = min(dma_len, f->ampdu_pld_size); - txh->PreloadSize = cpu_to_le16(dma_len); - } else { - txh->PreloadSize = 0; - } - - mch = le16_to_cpu(txh->MacTxControlHigh); - - /* update RTS dur fields */ - if (use_rts || use_cts) { - u16 durid; - if ((mch & TXC_PREAMBLE_RTS_MAIN_SHORT) == - TXC_PREAMBLE_RTS_MAIN_SHORT) - rts_preamble_type = BRCMS_SHORT_PREAMBLE; - - if ((mch & TXC_PREAMBLE_RTS_FB_SHORT) == - TXC_PREAMBLE_RTS_FB_SHORT) - rts_fbr_preamble_type = BRCMS_SHORT_PREAMBLE; - - durid = brcms_c_compute_rtscts_dur(wlc, use_cts, rts_rspec, - rspec, rts_preamble_type, - preamble_type, - session->ampdu_len, true); - rts->duration = cpu_to_le16(durid); - durid = brcms_c_compute_rtscts_dur(wlc, use_cts, - rts_rspec_fallback, - rspec_fallback, - rts_fbr_preamble_type, - fbr_preamble_type, - session->ampdu_len, true); - txh->RTSDurFallback = cpu_to_le16(durid); - /* set TxFesTimeNormal */ - txh->TxFesTimeNormal = rts->duration; - /* set fallback rate version of TxFesTimeNormal */ - txh->TxFesTimeFallback = txh->RTSDurFallback; - } - - /* set flag and plcp for fallback rate */ - if (fbr) { - mch |= TXC_AMPDU_FBR; - txh->MacTxControlHigh = cpu_to_le16(mch); - BRCMS_SET_MIMO_PLCP_AMPDU(plcp); - BRCMS_SET_MIMO_PLCP_AMPDU(txh->FragPLCPFallback); - } - - brcms_dbg_ht(wlc->hw->d11core, "wl%d: count %d ampdu_len %d\n", - wlc->pub->unit, skb_queue_len(&session->skb_list), - session->ampdu_len); -} - -static void -brcms_c_ampdu_rate_status(struct brcms_c_info *wlc, - struct ieee80211_tx_info *tx_info, - struct tx_status *txs, u8 mcs) -{ - struct ieee80211_tx_rate *txrate = tx_info->status.rates; - int i; - - /* clear the rest of the rates */ - for (i = 2; i < IEEE80211_TX_MAX_RATES; i++) { - txrate[i].idx = -1; - txrate[i].count = 0; - } -} - -static void -brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, - struct sk_buff *p, struct tx_status *txs, - u32 s1, u32 s2) -{ - struct scb_ampdu *scb_ampdu; - struct brcms_c_info *wlc = ampdu->wlc; - struct scb_ampdu_tid_ini *ini; - u8 bitmap[8], queue, tid; - struct d11txh *txh; - u8 *plcp; - struct ieee80211_hdr *h; - u16 seq, start_seq = 0, bindex, index, mcl; - u8 mcs = 0; - bool ba_recd = false, ack_recd = false; - u8 suc_mpdu = 0, tot_mpdu = 0; - uint supr_status; - bool update_rate = true, retry = true, tx_error = false; - u16 mimoantsel = 0; - u8 antselid = 0; - u8 retry_limit, rr_retry_limit; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(p); - -#ifdef DEBUG - u8 hole[AMPDU_MAX_MPDU]; - memset(hole, 0, sizeof(hole)); -#endif - - scb_ampdu = &scb->scb_ampdu; - tid = (u8) (p->priority); - - ini = &scb_ampdu->ini[tid]; - retry_limit = ampdu->retry_limit_tid[tid]; - rr_retry_limit = ampdu->rr_retry_limit_tid[tid]; - memset(bitmap, 0, sizeof(bitmap)); - queue = txs->frameid & TXFID_QUEUE_MASK; - supr_status = txs->status & TX_STATUS_SUPR_MASK; - - if (txs->status & TX_STATUS_ACK_RCV) { - if (TX_STATUS_SUPR_UF == supr_status) - update_rate = false; - - WARN_ON(!(txs->status & TX_STATUS_INTERMEDIATE)); - start_seq = txs->sequence >> SEQNUM_SHIFT; - bitmap[0] = (txs->status & TX_STATUS_BA_BMAP03_MASK) >> - TX_STATUS_BA_BMAP03_SHIFT; - - WARN_ON(s1 & TX_STATUS_INTERMEDIATE); - WARN_ON(!(s1 & TX_STATUS_AMPDU)); - - bitmap[0] |= - (s1 & TX_STATUS_BA_BMAP47_MASK) << - TX_STATUS_BA_BMAP47_SHIFT; - bitmap[1] = (s1 >> 8) & 0xff; - bitmap[2] = (s1 >> 16) & 0xff; - bitmap[3] = (s1 >> 24) & 0xff; - - bitmap[4] = s2 & 0xff; - bitmap[5] = (s2 >> 8) & 0xff; - bitmap[6] = (s2 >> 16) & 0xff; - bitmap[7] = (s2 >> 24) & 0xff; - - ba_recd = true; - } else { - if (supr_status) { - update_rate = false; - if (supr_status == TX_STATUS_SUPR_BADCH) { - brcms_err(wlc->hw->d11core, - "%s: Pkt tx suppressed, illegal channel possibly %d\n", - __func__, CHSPEC_CHANNEL( - wlc->default_bss->chanspec)); - } else { - if (supr_status != TX_STATUS_SUPR_FRAG) - brcms_err(wlc->hw->d11core, - "%s: supr_status 0x%x\n", - __func__, supr_status); - } - /* no need to retry for badch; will fail again */ - if (supr_status == TX_STATUS_SUPR_BADCH || - supr_status == TX_STATUS_SUPR_EXPTIME) { - retry = false; - } else if (supr_status == TX_STATUS_SUPR_EXPTIME) { - /* TX underflow: - * try tuning pre-loading or ampdu size - */ - } else if (supr_status == TX_STATUS_SUPR_FRAG) { - /* - * if there were underflows, but pre-loading - * is not active, notify rate adaptation. - */ - if (brcms_c_ffpld_check_txfunfl(wlc, queue) > 0) - tx_error = true; - } - } else if (txs->phyerr) { - update_rate = false; - brcms_err(wlc->hw->d11core, - "%s: ampdu tx phy error (0x%x)\n", - __func__, txs->phyerr); - } - } - - /* loop through all pkts and retry if not acked */ - while (p) { - tx_info = IEEE80211_SKB_CB(p); - txh = (struct d11txh *) p->data; - mcl = le16_to_cpu(txh->MacTxControlLow); - plcp = (u8 *) (txh + 1); - h = (struct ieee80211_hdr *)(plcp + D11_PHY_HDR_LEN); - seq = le16_to_cpu(h->seq_ctrl) >> SEQNUM_SHIFT; - - trace_brcms_txdesc(&wlc->hw->d11core->dev, txh, sizeof(*txh)); - - if (tot_mpdu == 0) { - mcs = plcp[0] & MIMO_PLCP_MCS_MASK; - mimoantsel = le16_to_cpu(txh->ABI_MimoAntSel); - } - - index = TX_SEQ_TO_INDEX(seq); - ack_recd = false; - if (ba_recd) { - bindex = MODSUB_POW2(seq, start_seq, SEQNUM_MAX); - brcms_dbg_ht(wlc->hw->d11core, - "tid %d seq %d, start_seq %d, bindex %d set %d, index %d\n", - tid, seq, start_seq, bindex, - isset(bitmap, bindex), index); - /* if acked then clear bit and free packet */ - if ((bindex < AMPDU_TX_BA_MAX_WSIZE) - && isset(bitmap, bindex)) { - ini->txretry[index] = 0; - - /* - * ampdu_ack_len: - * number of acked aggregated frames - */ - /* ampdu_len: number of aggregated frames */ - brcms_c_ampdu_rate_status(wlc, tx_info, txs, - mcs); - tx_info->flags |= IEEE80211_TX_STAT_ACK; - tx_info->flags |= IEEE80211_TX_STAT_AMPDU; - tx_info->status.ampdu_ack_len = - tx_info->status.ampdu_len = 1; - - skb_pull(p, D11_PHY_HDR_LEN); - skb_pull(p, D11_TXH_LEN); - - ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, - p); - ack_recd = true; - suc_mpdu++; - } - } - /* either retransmit or send bar if ack not recd */ - if (!ack_recd) { - if (retry && (ini->txretry[index] < (int)retry_limit)) { - int ret; - ini->txretry[index]++; - ret = brcms_c_txfifo(wlc, queue, p); - /* - * We shouldn't be out of space in the DMA - * ring here since we're reinserting a frame - * that was just pulled out. - */ - WARN_ONCE(ret, "queue %d out of txds\n", queue); - } else { - /* Retry timeout */ - ieee80211_tx_info_clear_status(tx_info); - tx_info->status.ampdu_ack_len = 0; - tx_info->status.ampdu_len = 1; - tx_info->flags |= - IEEE80211_TX_STAT_AMPDU_NO_BACK; - skb_pull(p, D11_PHY_HDR_LEN); - skb_pull(p, D11_TXH_LEN); - brcms_dbg_ht(wlc->hw->d11core, - "BA Timeout, seq %d\n", - seq); - ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, - p); - } - } - tot_mpdu++; - - /* break out if last packet of ampdu */ - if (((mcl & TXC_AMPDU_MASK) >> TXC_AMPDU_SHIFT) == - TXC_AMPDU_LAST) - break; - - p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED); - } - - /* update rate state */ - antselid = brcms_c_antsel_antsel2id(wlc->asi, mimoantsel); -} - -void -brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, - struct sk_buff *p, struct tx_status *txs) -{ - struct scb_ampdu *scb_ampdu; - struct brcms_c_info *wlc = ampdu->wlc; - struct scb_ampdu_tid_ini *ini; - u32 s1 = 0, s2 = 0; - struct ieee80211_tx_info *tx_info; - - tx_info = IEEE80211_SKB_CB(p); - - /* BMAC_NOTE: For the split driver, second level txstatus comes later - * So if the ACK was received then wait for the second level else just - * call the first one - */ - if (txs->status & TX_STATUS_ACK_RCV) { - u8 status_delay = 0; - - /* wait till the next 8 bytes of txstatus is available */ - s1 = bcma_read32(wlc->hw->d11core, D11REGOFFS(frmtxstatus)); - while ((s1 & TXS_V) == 0) { - udelay(1); - status_delay++; - if (status_delay > 10) - return; /* error condition */ - s1 = bcma_read32(wlc->hw->d11core, - D11REGOFFS(frmtxstatus)); - } - - s2 = bcma_read32(wlc->hw->d11core, D11REGOFFS(frmtxstatus2)); - } - - if (scb) { - scb_ampdu = &scb->scb_ampdu; - ini = &scb_ampdu->ini[p->priority]; - brcms_c_ampdu_dotxstatus_complete(ampdu, scb, p, txs, s1, s2); - } else { - /* loop through all pkts and free */ - u8 queue = txs->frameid & TXFID_QUEUE_MASK; - struct d11txh *txh; - u16 mcl; - while (p) { - tx_info = IEEE80211_SKB_CB(p); - txh = (struct d11txh *) p->data; - trace_brcms_txdesc(&wlc->hw->d11core->dev, txh, - sizeof(*txh)); - mcl = le16_to_cpu(txh->MacTxControlLow); - brcmu_pkt_buf_free_skb(p); - /* break out if last packet of ampdu */ - if (((mcl & TXC_AMPDU_MASK) >> TXC_AMPDU_SHIFT) == - TXC_AMPDU_LAST) - break; - p = dma_getnexttxp(wlc->hw->di[queue], - DMA_RANGE_TRANSMITTED); - } - } -} - -void brcms_c_ampdu_macaddr_upd(struct brcms_c_info *wlc) -{ - char template[T_RAM_ACCESS_SZ * 2]; - - /* driver needs to write the ta in the template; ta is at offset 16 */ - memset(template, 0, sizeof(template)); - memcpy(template, wlc->pub->cur_etheraddr, ETH_ALEN); - brcms_b_write_template_ram(wlc->hw, (T_BA_TPL_BASE + 16), - (T_RAM_ACCESS_SZ * 2), - template); -} - -bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid) -{ - return wlc->ampdu->ini_enable[tid]; -} - -void brcms_c_ampdu_shm_upd(struct ampdu_info *ampdu) -{ - struct brcms_c_info *wlc = ampdu->wlc; - - /* - * Extend ucode internal watchdog timer to - * match larger received frames - */ - if ((ampdu->rx_factor & IEEE80211_HT_AMPDU_PARM_FACTOR) == - IEEE80211_HT_MAX_AMPDU_64K) { - brcms_b_write_shm(wlc->hw, M_MIMO_MAXSYM, MIMO_MAXSYM_MAX); - brcms_b_write_shm(wlc->hw, M_WATCHDOG_8TU, WATCHDOG_8TU_MAX); - } else { - brcms_b_write_shm(wlc->hw, M_MIMO_MAXSYM, MIMO_MAXSYM_DEF); - brcms_b_write_shm(wlc->hw, M_WATCHDOG_8TU, WATCHDOG_8TU_DEF); - } -} - -/* - * callback function that helps invalidating ampdu packets in a DMA queue - */ -static void dma_cb_fn_ampdu(void *txi, void *arg_a) -{ - struct ieee80211_sta *sta = arg_a; - struct ieee80211_tx_info *tx_info = (struct ieee80211_tx_info *)txi; - - if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && - (tx_info->rate_driver_data[0] == sta || sta == NULL)) - tx_info->rate_driver_data[0] = NULL; -} - -/* - * When a remote party is no longer available for ampdu communication, any - * pending tx ampdu packets in the driver have to be flushed. - */ -void brcms_c_ampdu_flush(struct brcms_c_info *wlc, - struct ieee80211_sta *sta, u16 tid) -{ - brcms_c_inval_dma_pkts(wlc->hw, sta, dma_cb_fn_ampdu); -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h deleted file mode 100644 index 73d01e586109..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_AMPDU_H_ -#define _BRCM_AMPDU_H_ - -/* - * Data structure representing an in-progress session for accumulating - * frames for AMPDU. - * - * wlc: pointer to common driver data - * skb_list: queue of skb's for AMPDU - * max_ampdu_len: maximum length for this AMPDU - * max_ampdu_frames: maximum number of frames for this AMPDU - * ampdu_len: total number of bytes accumulated for this AMPDU - * dma_len: DMA length of this AMPDU - */ -struct brcms_ampdu_session { - struct brcms_c_info *wlc; - struct sk_buff_head skb_list; - unsigned max_ampdu_len; - u16 max_ampdu_frames; - u16 ampdu_len; - u16 dma_len; -}; - -extern void brcms_c_ampdu_reset_session(struct brcms_ampdu_session *session, - struct brcms_c_info *wlc); -extern int brcms_c_ampdu_add_frame(struct brcms_ampdu_session *session, - struct sk_buff *p); -extern void brcms_c_ampdu_finalize(struct brcms_ampdu_session *session); - -extern struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc); -extern void brcms_c_ampdu_detach(struct ampdu_info *ampdu); -extern void brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb, - struct sk_buff *p, struct tx_status *txs); -extern void brcms_c_ampdu_macaddr_upd(struct brcms_c_info *wlc); -extern void brcms_c_ampdu_shm_upd(struct ampdu_info *ampdu); - -#endif /* _BRCM_AMPDU_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/antsel.c b/drivers/net/wireless/brcm80211/brcmsmac/antsel.c deleted file mode 100644 index 54c616919590..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/antsel.c +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -#include "types.h" -#include "main.h" -#include "phy_shim.h" -#include "antsel.h" -#include "debug.h" - -#define ANT_SELCFG_AUTO 0x80 /* bit indicates antenna sel AUTO */ -#define ANT_SELCFG_MASK 0x33 /* antenna configuration mask */ -#define ANT_SELCFG_TX_UNICAST 0 /* unicast tx antenna configuration */ -#define ANT_SELCFG_RX_UNICAST 1 /* unicast rx antenna configuration */ -#define ANT_SELCFG_TX_DEF 2 /* default tx antenna configuration */ -#define ANT_SELCFG_RX_DEF 3 /* default rx antenna configuration */ - -/* useful macros */ -#define BRCMS_ANTSEL_11N_0(ant) ((((ant) & ANT_SELCFG_MASK) >> 4) & 0xf) -#define BRCMS_ANTSEL_11N_1(ant) (((ant) & ANT_SELCFG_MASK) & 0xf) -#define BRCMS_ANTIDX_11N(ant) (((BRCMS_ANTSEL_11N_0(ant)) << 2) +\ - (BRCMS_ANTSEL_11N_1(ant))) -#define BRCMS_ANT_ISAUTO_11N(ant) (((ant) & ANT_SELCFG_AUTO) == ANT_SELCFG_AUTO) -#define BRCMS_ANTSEL_11N(ant) ((ant) & ANT_SELCFG_MASK) - -/* antenna switch */ -/* defines for no boardlevel antenna diversity */ -#define ANT_SELCFG_DEF_2x2 0x01 /* default antenna configuration */ - -/* 2x3 antdiv defines and tables for GPIO communication */ -#define ANT_SELCFG_NUM_2x3 3 -#define ANT_SELCFG_DEF_2x3 0x01 /* default antenna configuration */ - -/* 2x4 antdiv rev4 defines and tables for GPIO communication */ -#define ANT_SELCFG_NUM_2x4 4 -#define ANT_SELCFG_DEF_2x4 0x02 /* default antenna configuration */ - -static const u16 mimo_2x4_div_antselpat_tbl[] = { - 0, 0, 0x9, 0xa, /* ant0: 0 ant1: 2,3 */ - 0, 0, 0x5, 0x6, /* ant0: 1 ant1: 2,3 */ - 0, 0, 0, 0, /* n.a. */ - 0, 0, 0, 0 /* n.a. */ -}; - -static const u8 mimo_2x4_div_antselid_tbl[16] = { - 0, 0, 0, 0, 0, 2, 3, 0, - 0, 0, 1, 0, 0, 0, 0, 0 /* pat to antselid */ -}; - -static const u16 mimo_2x3_div_antselpat_tbl[] = { - 16, 0, 1, 16, /* ant0: 0 ant1: 1,2 */ - 16, 16, 16, 16, /* n.a. */ - 16, 2, 16, 16, /* ant0: 2 ant1: 1 */ - 16, 16, 16, 16 /* n.a. */ -}; - -static const u8 mimo_2x3_div_antselid_tbl[16] = { - 0, 1, 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 /* pat to antselid */ -}; - -/* boardlevel antenna selection: init antenna selection structure */ -static void -brcms_c_antsel_init_cfg(struct antsel_info *asi, struct brcms_antselcfg *antsel, - bool auto_sel) -{ - if (asi->antsel_type == ANTSEL_2x3) { - u8 antcfg_def = ANT_SELCFG_DEF_2x3 | - ((asi->antsel_avail && auto_sel) ? ANT_SELCFG_AUTO : 0); - antsel->ant_config[ANT_SELCFG_TX_DEF] = antcfg_def; - antsel->ant_config[ANT_SELCFG_TX_UNICAST] = antcfg_def; - antsel->ant_config[ANT_SELCFG_RX_DEF] = antcfg_def; - antsel->ant_config[ANT_SELCFG_RX_UNICAST] = antcfg_def; - antsel->num_antcfg = ANT_SELCFG_NUM_2x3; - - } else if (asi->antsel_type == ANTSEL_2x4) { - - antsel->ant_config[ANT_SELCFG_TX_DEF] = ANT_SELCFG_DEF_2x4; - antsel->ant_config[ANT_SELCFG_TX_UNICAST] = ANT_SELCFG_DEF_2x4; - antsel->ant_config[ANT_SELCFG_RX_DEF] = ANT_SELCFG_DEF_2x4; - antsel->ant_config[ANT_SELCFG_RX_UNICAST] = ANT_SELCFG_DEF_2x4; - antsel->num_antcfg = ANT_SELCFG_NUM_2x4; - - } else { /* no antenna selection available */ - - antsel->ant_config[ANT_SELCFG_TX_DEF] = ANT_SELCFG_DEF_2x2; - antsel->ant_config[ANT_SELCFG_TX_UNICAST] = ANT_SELCFG_DEF_2x2; - antsel->ant_config[ANT_SELCFG_RX_DEF] = ANT_SELCFG_DEF_2x2; - antsel->ant_config[ANT_SELCFG_RX_UNICAST] = ANT_SELCFG_DEF_2x2; - antsel->num_antcfg = 0; - } -} - -struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc) -{ - struct antsel_info *asi; - struct ssb_sprom *sprom = &wlc->hw->d11core->bus->sprom; - - asi = kzalloc(sizeof(struct antsel_info), GFP_ATOMIC); - if (!asi) - return NULL; - - asi->wlc = wlc; - asi->pub = wlc->pub; - asi->antsel_type = ANTSEL_NA; - asi->antsel_avail = false; - asi->antsel_antswitch = sprom->antswitch; - - if ((asi->pub->sromrev >= 4) && (asi->antsel_antswitch != 0)) { - switch (asi->antsel_antswitch) { - case ANTSWITCH_TYPE_1: - case ANTSWITCH_TYPE_2: - case ANTSWITCH_TYPE_3: - /* 4321/2 board with 2x3 switch logic */ - asi->antsel_type = ANTSEL_2x3; - /* Antenna selection availability */ - if ((sprom->ant_available_bg == 7) || - (sprom->ant_available_a == 7)) { - asi->antsel_avail = true; - } else if ( - sprom->ant_available_bg == 3 || - sprom->ant_available_a == 3) { - asi->antsel_avail = false; - } else { - asi->antsel_avail = false; - brcms_err(wlc->hw->d11core, - "antsel_attach: 2o3 " - "board cfg invalid\n"); - } - - break; - default: - break; - } - } else if ((asi->pub->sromrev == 4) && - (sprom->ant_available_bg == 7) && - (sprom->ant_available_a == 0)) { - /* hack to match old 4321CB2 cards with 2of3 antenna switch */ - asi->antsel_type = ANTSEL_2x3; - asi->antsel_avail = true; - } else if (asi->pub->boardflags2 & BFL2_2X4_DIV) { - asi->antsel_type = ANTSEL_2x4; - asi->antsel_avail = true; - } - - /* Set the antenna selection type for the low driver */ - brcms_b_antsel_type_set(wlc->hw, asi->antsel_type); - - /* Init (auto/manual) antenna selection */ - brcms_c_antsel_init_cfg(asi, &asi->antcfg_11n, true); - brcms_c_antsel_init_cfg(asi, &asi->antcfg_cur, true); - - return asi; -} - -void brcms_c_antsel_detach(struct antsel_info *asi) -{ - kfree(asi); -} - -/* - * boardlevel antenna selection: - * convert ant_cfg to mimo_antsel (ucode interface) - */ -static u16 brcms_c_antsel_antcfg2antsel(struct antsel_info *asi, u8 ant_cfg) -{ - u8 idx = BRCMS_ANTIDX_11N(BRCMS_ANTSEL_11N(ant_cfg)); - u16 mimo_antsel = 0; - - if (asi->antsel_type == ANTSEL_2x4) { - /* 2x4 antenna diversity board, 4 cfgs: 0-2 0-3 1-2 1-3 */ - mimo_antsel = (mimo_2x4_div_antselpat_tbl[idx] & 0xf); - return mimo_antsel; - - } else if (asi->antsel_type == ANTSEL_2x3) { - /* 2x3 antenna selection, 3 cfgs: 0-1 0-2 2-1 */ - mimo_antsel = (mimo_2x3_div_antselpat_tbl[idx] & 0xf); - return mimo_antsel; - } - - return mimo_antsel; -} - -/* boardlevel antenna selection: ucode interface control */ -static int brcms_c_antsel_cfgupd(struct antsel_info *asi, - struct brcms_antselcfg *antsel) -{ - struct brcms_c_info *wlc = asi->wlc; - u8 ant_cfg; - u16 mimo_antsel; - - /* 1) Update TX antconfig for all frames that are not unicast data - * (aka default TX) - */ - ant_cfg = antsel->ant_config[ANT_SELCFG_TX_DEF]; - mimo_antsel = brcms_c_antsel_antcfg2antsel(asi, ant_cfg); - brcms_b_write_shm(wlc->hw, M_MIMO_ANTSEL_TXDFLT, mimo_antsel); - /* - * Update driver stats for currently selected - * default tx/rx antenna config - */ - asi->antcfg_cur.ant_config[ANT_SELCFG_TX_DEF] = ant_cfg; - - /* 2) Update RX antconfig for all frames that are not unicast data - * (aka default RX) - */ - ant_cfg = antsel->ant_config[ANT_SELCFG_RX_DEF]; - mimo_antsel = brcms_c_antsel_antcfg2antsel(asi, ant_cfg); - brcms_b_write_shm(wlc->hw, M_MIMO_ANTSEL_RXDFLT, mimo_antsel); - /* - * Update driver stats for currently selected - * default tx/rx antenna config - */ - asi->antcfg_cur.ant_config[ANT_SELCFG_RX_DEF] = ant_cfg; - - return 0; -} - -void brcms_c_antsel_init(struct antsel_info *asi) -{ - if ((asi->antsel_type == ANTSEL_2x3) || - (asi->antsel_type == ANTSEL_2x4)) - brcms_c_antsel_cfgupd(asi, &asi->antcfg_11n); -} - -/* boardlevel antenna selection: convert id to ant_cfg */ -static u8 brcms_c_antsel_id2antcfg(struct antsel_info *asi, u8 id) -{ - u8 antcfg = ANT_SELCFG_DEF_2x2; - - if (asi->antsel_type == ANTSEL_2x4) { - /* 2x4 antenna diversity board, 4 cfgs: 0-2 0-3 1-2 1-3 */ - antcfg = (((id & 0x2) << 3) | ((id & 0x1) + 2)); - return antcfg; - - } else if (asi->antsel_type == ANTSEL_2x3) { - /* 2x3 antenna selection, 3 cfgs: 0-1 0-2 2-1 */ - antcfg = (((id & 0x02) << 4) | ((id & 0x1) + 1)); - return antcfg; - } - - return antcfg; -} - -void -brcms_c_antsel_antcfg_get(struct antsel_info *asi, bool usedef, bool sel, - u8 antselid, u8 fbantselid, u8 *antcfg, - u8 *fbantcfg) -{ - u8 ant; - - /* if use default, assign it and return */ - if (usedef) { - *antcfg = asi->antcfg_11n.ant_config[ANT_SELCFG_TX_DEF]; - *fbantcfg = *antcfg; - return; - } - - if (!sel) { - *antcfg = asi->antcfg_11n.ant_config[ANT_SELCFG_TX_UNICAST]; - *fbantcfg = *antcfg; - - } else { - ant = asi->antcfg_11n.ant_config[ANT_SELCFG_TX_UNICAST]; - if ((ant & ANT_SELCFG_AUTO) == ANT_SELCFG_AUTO) { - *antcfg = brcms_c_antsel_id2antcfg(asi, antselid); - *fbantcfg = brcms_c_antsel_id2antcfg(asi, fbantselid); - } else { - *antcfg = - asi->antcfg_11n.ant_config[ANT_SELCFG_TX_UNICAST]; - *fbantcfg = *antcfg; - } - } - return; -} - -/* boardlevel antenna selection: convert mimo_antsel (ucode interface) to id */ -u8 brcms_c_antsel_antsel2id(struct antsel_info *asi, u16 antsel) -{ - u8 antselid = 0; - - if (asi->antsel_type == ANTSEL_2x4) { - /* 2x4 antenna diversity board, 4 cfgs: 0-2 0-3 1-2 1-3 */ - antselid = mimo_2x4_div_antselid_tbl[(antsel & 0xf)]; - return antselid; - - } else if (asi->antsel_type == ANTSEL_2x3) { - /* 2x3 antenna selection, 3 cfgs: 0-1 0-2 2-1 */ - antselid = mimo_2x3_div_antselid_tbl[(antsel & 0xf)]; - return antselid; - } - - return antselid; -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/antsel.h b/drivers/net/wireless/brcm80211/brcmsmac/antsel.h deleted file mode 100644 index 97ea3881a8ec..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/antsel.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_ANTSEL_H_ -#define _BRCM_ANTSEL_H_ - -extern struct antsel_info *brcms_c_antsel_attach(struct brcms_c_info *wlc); -extern void brcms_c_antsel_detach(struct antsel_info *asi); -extern void brcms_c_antsel_init(struct antsel_info *asi); -extern void brcms_c_antsel_antcfg_get(struct antsel_info *asi, bool usedef, - bool sel, - u8 id, u8 fbid, u8 *antcfg, - u8 *fbantcfg); -extern u8 brcms_c_antsel_antsel2id(struct antsel_info *asi, u16 antsel); - -#endif /* _BRCM_ANTSEL_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_events.c b/drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_events.c deleted file mode 100644 index 52fc9eeb5fa5..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_events.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2011 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include /* bug in tracepoint.h, it should include this */ - -#ifndef __CHECKER__ -#include "mac80211_if.h" -#define CREATE_TRACE_POINTS -#include "brcms_trace_events.h" -#endif diff --git a/drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_events.h b/drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_events.h deleted file mode 100644 index 871781e6a713..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/brcms_trace_events.h +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (c) 2011 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#if !defined(__TRACE_BRCMSMAC_H) || defined(TRACE_HEADER_MULTI_READ) - -#define __TRACE_BRCMSMAC_H - -#include -#include -#include -#include "mac80211_if.h" - -#ifndef CONFIG_BRCM_TRACING -#undef TRACE_EVENT -#define TRACE_EVENT(name, proto, ...) \ -static inline void trace_ ## name(proto) {} -#undef DECLARE_EVENT_CLASS -#define DECLARE_EVENT_CLASS(...) -#undef DEFINE_EVENT -#define DEFINE_EVENT(evt_class, name, proto, ...) \ -static inline void trace_ ## name(proto) {} -#endif - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM brcmsmac - -/* - * We define a tracepoint, its arguments, its printk format and its - * 'fast binary record' layout. - */ -TRACE_EVENT(brcms_timer, - /* TPPROTO is the prototype of the function called by this tracepoint */ - TP_PROTO(struct brcms_timer *t), - /* - * TPARGS(firstarg, p) are the parameters names, same as found in the - * prototype. - */ - TP_ARGS(t), - /* - * Fast binary tracing: define the trace record via TP_STRUCT__entry(). - * You can think about it like a regular C structure local variable - * definition. - */ - TP_STRUCT__entry( - __field(uint, ms) - __field(uint, set) - __field(uint, periodic) - ), - TP_fast_assign( - __entry->ms = t->ms; - __entry->set = t->set; - __entry->periodic = t->periodic; - ), - TP_printk( - "ms=%u set=%u periodic=%u", - __entry->ms, __entry->set, __entry->periodic - ) -); - -TRACE_EVENT(brcms_dpc, - TP_PROTO(unsigned long data), - TP_ARGS(data), - TP_STRUCT__entry( - __field(unsigned long, data) - ), - TP_fast_assign( - __entry->data = data; - ), - TP_printk( - "data=%p", - (void *)__entry->data - ) -); - -TRACE_EVENT(brcms_macintstatus, - TP_PROTO(const struct device *dev, int in_isr, u32 macintstatus, - u32 mask), - TP_ARGS(dev, in_isr, macintstatus, mask), - TP_STRUCT__entry( - __string(dev, dev_name(dev)) - __field(int, in_isr) - __field(u32, macintstatus) - __field(u32, mask) - ), - TP_fast_assign( - __assign_str(dev, dev_name(dev)); - __entry->in_isr = in_isr; - __entry->macintstatus = macintstatus; - __entry->mask = mask; - ), - TP_printk("[%s] in_isr=%d macintstatus=%#x mask=%#x", __get_str(dev), - __entry->in_isr, __entry->macintstatus, __entry->mask) -); - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM brcmsmac_tx - -TRACE_EVENT(brcms_txdesc, - TP_PROTO(const struct device *dev, - void *txh, size_t txh_len), - TP_ARGS(dev, txh, txh_len), - TP_STRUCT__entry( - __string(dev, dev_name(dev)) - __dynamic_array(u8, txh, txh_len) - ), - TP_fast_assign( - __assign_str(dev, dev_name(dev)); - memcpy(__get_dynamic_array(txh), txh, txh_len); - ), - TP_printk("[%s] txdesc", __get_str(dev)) -); - -TRACE_EVENT(brcms_txstatus, - TP_PROTO(const struct device *dev, u16 framelen, u16 frameid, - u16 status, u16 lasttxtime, u16 sequence, u16 phyerr, - u16 ackphyrxsh), - TP_ARGS(dev, framelen, frameid, status, lasttxtime, sequence, phyerr, - ackphyrxsh), - TP_STRUCT__entry( - __string(dev, dev_name(dev)) - __field(u16, framelen) - __field(u16, frameid) - __field(u16, status) - __field(u16, lasttxtime) - __field(u16, sequence) - __field(u16, phyerr) - __field(u16, ackphyrxsh) - ), - TP_fast_assign( - __assign_str(dev, dev_name(dev)); - __entry->framelen = framelen; - __entry->frameid = frameid; - __entry->status = status; - __entry->lasttxtime = lasttxtime; - __entry->sequence = sequence; - __entry->phyerr = phyerr; - __entry->ackphyrxsh = ackphyrxsh; - ), - TP_printk("[%s] FrameId %#04x TxStatus %#04x LastTxTime %#04x " - "Seq %#04x PHYTxStatus %#04x RxAck %#04x", - __get_str(dev), __entry->frameid, __entry->status, - __entry->lasttxtime, __entry->sequence, __entry->phyerr, - __entry->ackphyrxsh) -); - -TRACE_EVENT(brcms_ampdu_session, - TP_PROTO(const struct device *dev, unsigned max_ampdu_len, - u16 max_ampdu_frames, u16 ampdu_len, u16 ampdu_frames, - u16 dma_len), - TP_ARGS(dev, max_ampdu_len, max_ampdu_frames, ampdu_len, ampdu_frames, - dma_len), - TP_STRUCT__entry( - __string(dev, dev_name(dev)) - __field(unsigned, max_ampdu_len) - __field(u16, max_ampdu_frames) - __field(u16, ampdu_len) - __field(u16, ampdu_frames) - __field(u16, dma_len) - ), - TP_fast_assign( - __assign_str(dev, dev_name(dev)); - __entry->max_ampdu_len = max_ampdu_len; - __entry->max_ampdu_frames = max_ampdu_frames; - __entry->ampdu_len = ampdu_len; - __entry->ampdu_frames = ampdu_frames; - __entry->dma_len = dma_len; - ), - TP_printk("[%s] ampdu session max_len=%u max_frames=%u len=%u frames=%u dma_len=%u", - __get_str(dev), __entry->max_ampdu_len, - __entry->max_ampdu_frames, __entry->ampdu_len, - __entry->ampdu_frames, __entry->dma_len) -); - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM brcmsmac_msg - -#define MAX_MSG_LEN 100 - -DECLARE_EVENT_CLASS(brcms_msg_event, - TP_PROTO(struct va_format *vaf), - TP_ARGS(vaf), - TP_STRUCT__entry( - __dynamic_array(char, msg, MAX_MSG_LEN) - ), - TP_fast_assign( - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), - MAX_MSG_LEN, vaf->fmt, - *vaf->va) >= MAX_MSG_LEN); - ), - TP_printk("%s", __get_str(msg)) -); - -DEFINE_EVENT(brcms_msg_event, brcms_info, - TP_PROTO(struct va_format *vaf), - TP_ARGS(vaf) -); - -DEFINE_EVENT(brcms_msg_event, brcms_warn, - TP_PROTO(struct va_format *vaf), - TP_ARGS(vaf) -); - -DEFINE_EVENT(brcms_msg_event, brcms_err, - TP_PROTO(struct va_format *vaf), - TP_ARGS(vaf) -); - -DEFINE_EVENT(brcms_msg_event, brcms_crit, - TP_PROTO(struct va_format *vaf), - TP_ARGS(vaf) -); - -TRACE_EVENT(brcms_dbg, - TP_PROTO(u32 level, const char *func, struct va_format *vaf), - TP_ARGS(level, func, vaf), - TP_STRUCT__entry( - __field(u32, level) - __string(func, func) - __dynamic_array(char, msg, MAX_MSG_LEN) - ), - TP_fast_assign( - __entry->level = level; - __assign_str(func, func); - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), - MAX_MSG_LEN, vaf->fmt, - *vaf->va) >= MAX_MSG_LEN); - ), - TP_printk("%s: %s", __get_str(func), __get_str(msg)) -); - -#endif /* __TRACE_BRCMSMAC_H */ - -#ifdef CONFIG_BRCM_TRACING - -#undef TRACE_INCLUDE_PATH -#define TRACE_INCLUDE_PATH . -#undef TRACE_INCLUDE_FILE -#define TRACE_INCLUDE_FILE brcms_trace_events - -#include - -#endif /* CONFIG_BRCM_TRACING */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.c b/drivers/net/wireless/brcm80211/brcmsmac/channel.c deleted file mode 100644 index cc87926f5055..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c +++ /dev/null @@ -1,782 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - -#include -#include "pub.h" -#include "phy/phy_hal.h" -#include "main.h" -#include "stf.h" -#include "channel.h" -#include "mac80211_if.h" -#include "debug.h" - -/* QDB() macro takes a dB value and converts to a quarter dB value */ -#define QDB(n) ((n) * BRCMS_TXPWR_DB_FACTOR) - -#define LOCALE_MIMO_IDX_bn 0 -#define LOCALE_MIMO_IDX_11n 0 - -/* max of BAND_5G_PWR_LVLS and 14 for 2.4 GHz */ -#define BRCMS_MAXPWR_MIMO_TBL_SIZE 14 - -/* maxpwr mapping to 5GHz band channels: - * maxpwr[0] - channels [34-48] - * maxpwr[1] - channels [52-60] - * maxpwr[2] - channels [62-64] - * maxpwr[3] - channels [100-140] - * maxpwr[4] - channels [149-165] - */ -#define BAND_5G_PWR_LVLS 5 /* 5 power levels for 5G */ - -#define LC(id) LOCALE_MIMO_IDX_ ## id - -#define LOCALES(mimo2, mimo5) \ - {LC(mimo2), LC(mimo5)} - -/* macro to get 5 GHz channel group index for tx power */ -#define CHANNEL_POWER_IDX_5G(c) (((c) < 52) ? 0 : \ - (((c) < 62) ? 1 : \ - (((c) < 100) ? 2 : \ - (((c) < 149) ? 3 : 4)))) - -#define BRCM_2GHZ_2412_2462 REG_RULE(2412-10, 2462+10, 40, 0, 19, 0) -#define BRCM_2GHZ_2467_2472 REG_RULE(2467-10, 2472+10, 20, 0, 19, \ - NL80211_RRF_PASSIVE_SCAN | \ - NL80211_RRF_NO_IBSS) - -#define BRCM_5GHZ_5180_5240 REG_RULE(5180-10, 5240+10, 40, 0, 21, \ - NL80211_RRF_PASSIVE_SCAN | \ - NL80211_RRF_NO_IBSS) -#define BRCM_5GHZ_5260_5320 REG_RULE(5260-10, 5320+10, 40, 0, 21, \ - NL80211_RRF_PASSIVE_SCAN | \ - NL80211_RRF_DFS | \ - NL80211_RRF_NO_IBSS) -#define BRCM_5GHZ_5500_5700 REG_RULE(5500-10, 5700+10, 40, 0, 21, \ - NL80211_RRF_PASSIVE_SCAN | \ - NL80211_RRF_DFS | \ - NL80211_RRF_NO_IBSS) -#define BRCM_5GHZ_5745_5825 REG_RULE(5745-10, 5825+10, 40, 0, 21, \ - NL80211_RRF_PASSIVE_SCAN | \ - NL80211_RRF_NO_IBSS) - -static const struct ieee80211_regdomain brcms_regdom_x2 = { - .n_reg_rules = 6, - .alpha2 = "X2", - .reg_rules = { - BRCM_2GHZ_2412_2462, - BRCM_2GHZ_2467_2472, - BRCM_5GHZ_5180_5240, - BRCM_5GHZ_5260_5320, - BRCM_5GHZ_5500_5700, - BRCM_5GHZ_5745_5825, - } -}; - - /* locale per-channel tx power limits for MIMO frames - * maxpwr arrays are index by channel for 2.4 GHz limits, and - * by sub-band for 5 GHz limits using CHANNEL_POWER_IDX_5G(channel) - */ -struct locale_mimo_info { - /* tx 20 MHz power limits, qdBm units */ - s8 maxpwr20[BRCMS_MAXPWR_MIMO_TBL_SIZE]; - /* tx 40 MHz power limits, qdBm units */ - s8 maxpwr40[BRCMS_MAXPWR_MIMO_TBL_SIZE]; -}; - -/* Country names and abbreviations with locale defined from ISO 3166 */ -struct country_info { - const u8 locale_mimo_2G; /* 2.4G mimo info */ - const u8 locale_mimo_5G; /* 5G mimo info */ -}; - -struct brcms_regd { - struct country_info country; - const struct ieee80211_regdomain *regdomain; -}; - -struct brcms_cm_info { - struct brcms_pub *pub; - struct brcms_c_info *wlc; - const struct brcms_regd *world_regd; -}; - -/* - * MIMO Locale Definitions - 2.4 GHz - */ -static const struct locale_mimo_info locale_bn = { - {QDB(13), QDB(13), QDB(13), QDB(13), QDB(13), - QDB(13), QDB(13), QDB(13), QDB(13), QDB(13), - QDB(13), QDB(13), QDB(13)}, - {0, 0, QDB(13), QDB(13), QDB(13), - QDB(13), QDB(13), QDB(13), QDB(13), QDB(13), - QDB(13), 0, 0}, -}; - -static const struct locale_mimo_info *g_mimo_2g_table[] = { - &locale_bn -}; - -/* - * MIMO Locale Definitions - 5 GHz - */ -static const struct locale_mimo_info locale_11n = { - { /* 12.5 dBm */ 50, 50, 50, QDB(15), QDB(15)}, - {QDB(14), QDB(15), QDB(15), QDB(15), QDB(15)}, -}; - -static const struct locale_mimo_info *g_mimo_5g_table[] = { - &locale_11n -}; - -static const struct brcms_regd cntry_locales[] = { - /* Worldwide RoW 2, must always be at index 0 */ - { - .country = LOCALES(bn, 11n), - .regdomain = &brcms_regdom_x2, - }, -}; - -static const struct locale_mimo_info *brcms_c_get_mimo_2g(u8 locale_idx) -{ - if (locale_idx >= ARRAY_SIZE(g_mimo_2g_table)) - return NULL; - - return g_mimo_2g_table[locale_idx]; -} - -static const struct locale_mimo_info *brcms_c_get_mimo_5g(u8 locale_idx) -{ - if (locale_idx >= ARRAY_SIZE(g_mimo_5g_table)) - return NULL; - - return g_mimo_5g_table[locale_idx]; -} - -/* - * Indicates whether the country provided is valid to pass - * to cfg80211 or not. - * - * returns true if valid; false if not. - */ -static bool brcms_c_country_valid(const char *ccode) -{ - /* - * only allow ascii alpha uppercase for the first 2 - * chars. - */ - if (!((0x80 & ccode[0]) == 0 && ccode[0] >= 0x41 && ccode[0] <= 0x5A && - (0x80 & ccode[1]) == 0 && ccode[1] >= 0x41 && ccode[1] <= 0x5A)) - return false; - - /* - * do not match ISO 3166-1 user assigned country codes - * that may be in the driver table - */ - if (!strcmp("AA", ccode) || /* AA */ - !strcmp("ZZ", ccode) || /* ZZ */ - ccode[0] == 'X' || /* XA - XZ */ - (ccode[0] == 'Q' && /* QM - QZ */ - (ccode[1] >= 'M' && ccode[1] <= 'Z'))) - return false; - - if (!strcmp("NA", ccode)) - return false; - - return true; -} - -static const struct brcms_regd *brcms_world_regd(const char *regdom, int len) -{ - const struct brcms_regd *regd = NULL; - int i; - - for (i = 0; i < ARRAY_SIZE(cntry_locales); i++) { - if (!strncmp(regdom, cntry_locales[i].regdomain->alpha2, len)) { - regd = &cntry_locales[i]; - break; - } - } - - return regd; -} - -static const struct brcms_regd *brcms_default_world_regd(void) -{ - return &cntry_locales[0]; -} - -/* JP, J1 - J10 are Japan ccodes */ -static bool brcms_c_japan_ccode(const char *ccode) -{ - return (ccode[0] == 'J' && - (ccode[1] == 'P' || (ccode[1] >= '1' && ccode[1] <= '9'))); -} - -static void -brcms_c_channel_min_txpower_limits_with_local_constraint( - struct brcms_cm_info *wlc_cm, struct txpwr_limits *txpwr, - u8 local_constraint_qdbm) -{ - int j; - - /* CCK Rates */ - for (j = 0; j < WL_TX_POWER_CCK_NUM; j++) - txpwr->cck[j] = min(txpwr->cck[j], local_constraint_qdbm); - - /* 20 MHz Legacy OFDM SISO */ - for (j = 0; j < WL_TX_POWER_OFDM_NUM; j++) - txpwr->ofdm[j] = min(txpwr->ofdm[j], local_constraint_qdbm); - - /* 20 MHz Legacy OFDM CDD */ - for (j = 0; j < BRCMS_NUM_RATES_OFDM; j++) - txpwr->ofdm_cdd[j] = - min(txpwr->ofdm_cdd[j], local_constraint_qdbm); - - /* 40 MHz Legacy OFDM SISO */ - for (j = 0; j < BRCMS_NUM_RATES_OFDM; j++) - txpwr->ofdm_40_siso[j] = - min(txpwr->ofdm_40_siso[j], local_constraint_qdbm); - - /* 40 MHz Legacy OFDM CDD */ - for (j = 0; j < BRCMS_NUM_RATES_OFDM; j++) - txpwr->ofdm_40_cdd[j] = - min(txpwr->ofdm_40_cdd[j], local_constraint_qdbm); - - /* 20MHz MCS 0-7 SISO */ - for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) - txpwr->mcs_20_siso[j] = - min(txpwr->mcs_20_siso[j], local_constraint_qdbm); - - /* 20MHz MCS 0-7 CDD */ - for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) - txpwr->mcs_20_cdd[j] = - min(txpwr->mcs_20_cdd[j], local_constraint_qdbm); - - /* 20MHz MCS 0-7 STBC */ - for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) - txpwr->mcs_20_stbc[j] = - min(txpwr->mcs_20_stbc[j], local_constraint_qdbm); - - /* 20MHz MCS 8-15 MIMO */ - for (j = 0; j < BRCMS_NUM_RATES_MCS_2_STREAM; j++) - txpwr->mcs_20_mimo[j] = - min(txpwr->mcs_20_mimo[j], local_constraint_qdbm); - - /* 40MHz MCS 0-7 SISO */ - for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) - txpwr->mcs_40_siso[j] = - min(txpwr->mcs_40_siso[j], local_constraint_qdbm); - - /* 40MHz MCS 0-7 CDD */ - for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) - txpwr->mcs_40_cdd[j] = - min(txpwr->mcs_40_cdd[j], local_constraint_qdbm); - - /* 40MHz MCS 0-7 STBC */ - for (j = 0; j < BRCMS_NUM_RATES_MCS_1_STREAM; j++) - txpwr->mcs_40_stbc[j] = - min(txpwr->mcs_40_stbc[j], local_constraint_qdbm); - - /* 40MHz MCS 8-15 MIMO */ - for (j = 0; j < BRCMS_NUM_RATES_MCS_2_STREAM; j++) - txpwr->mcs_40_mimo[j] = - min(txpwr->mcs_40_mimo[j], local_constraint_qdbm); - - /* 40MHz MCS 32 */ - txpwr->mcs32 = min(txpwr->mcs32, local_constraint_qdbm); - -} - -/* - * set the driver's current country and regulatory information - * using a country code as the source. Look up built in country - * information found with the country code. - */ -static void -brcms_c_set_country(struct brcms_cm_info *wlc_cm, - const struct brcms_regd *regd) -{ - struct brcms_c_info *wlc = wlc_cm->wlc; - - if ((wlc->pub->_n_enab & SUPPORT_11N) != - wlc->protection->nmode_user) - brcms_c_set_nmode(wlc); - - brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); - brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); - - brcms_c_set_gmode(wlc, wlc->protection->gmode_user, false); - - return; -} - -struct brcms_cm_info *brcms_c_channel_mgr_attach(struct brcms_c_info *wlc) -{ - struct brcms_cm_info *wlc_cm; - struct brcms_pub *pub = wlc->pub; - struct ssb_sprom *sprom = &wlc->hw->d11core->bus->sprom; - const char *ccode = sprom->alpha2; - int ccode_len = sizeof(sprom->alpha2); - - wlc_cm = kzalloc(sizeof(struct brcms_cm_info), GFP_ATOMIC); - if (wlc_cm == NULL) - return NULL; - wlc_cm->pub = pub; - wlc_cm->wlc = wlc; - wlc->cmi = wlc_cm; - - /* store the country code for passing up as a regulatory hint */ - wlc_cm->world_regd = brcms_world_regd(ccode, ccode_len); - if (brcms_c_country_valid(ccode)) - strncpy(wlc->pub->srom_ccode, ccode, ccode_len); - - /* - * If no custom world domain is found in the SROM, use the - * default "X2" domain. - */ - if (!wlc_cm->world_regd) { - wlc_cm->world_regd = brcms_default_world_regd(); - ccode = wlc_cm->world_regd->regdomain->alpha2; - ccode_len = BRCM_CNTRY_BUF_SZ - 1; - } - - /* save default country for exiting 11d regulatory mode */ - strncpy(wlc->country_default, ccode, ccode_len); - - /* initialize autocountry_default to driver default */ - strncpy(wlc->autocountry_default, ccode, ccode_len); - - brcms_c_set_country(wlc_cm, wlc_cm->world_regd); - - return wlc_cm; -} - -void brcms_c_channel_mgr_detach(struct brcms_cm_info *wlc_cm) -{ - kfree(wlc_cm); -} - -void -brcms_c_channel_set_chanspec(struct brcms_cm_info *wlc_cm, u16 chanspec, - u8 local_constraint_qdbm) -{ - struct brcms_c_info *wlc = wlc_cm->wlc; - struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.chandef.chan; - struct txpwr_limits txpwr; - - brcms_c_channel_reg_limits(wlc_cm, chanspec, &txpwr); - - brcms_c_channel_min_txpower_limits_with_local_constraint( - wlc_cm, &txpwr, local_constraint_qdbm - ); - - /* set or restore gmode as required by regulatory */ - if (ch->flags & IEEE80211_CHAN_NO_OFDM) - brcms_c_set_gmode(wlc, GMODE_LEGACY_B, false); - else - brcms_c_set_gmode(wlc, wlc->protection->gmode_user, false); - - brcms_b_set_chanspec(wlc->hw, chanspec, - !!(ch->flags & IEEE80211_CHAN_PASSIVE_SCAN), - &txpwr); -} - -void -brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec, - struct txpwr_limits *txpwr) -{ - struct brcms_c_info *wlc = wlc_cm->wlc; - struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.chandef.chan; - uint i; - uint chan; - int maxpwr; - int delta; - const struct country_info *country; - struct brcms_band *band; - int conducted_max = BRCMS_TXPWR_MAX; - const struct locale_mimo_info *li_mimo; - int maxpwr20, maxpwr40; - int maxpwr_idx; - uint j; - - memset(txpwr, 0, sizeof(struct txpwr_limits)); - - if (WARN_ON(!ch)) - return; - - country = &wlc_cm->world_regd->country; - - chan = CHSPEC_CHANNEL(chanspec); - band = wlc->bandstate[chspec_bandunit(chanspec)]; - li_mimo = (band->bandtype == BRCM_BAND_5G) ? - brcms_c_get_mimo_5g(country->locale_mimo_5G) : - brcms_c_get_mimo_2g(country->locale_mimo_2G); - - delta = band->antgain; - - if (band->bandtype == BRCM_BAND_2G) - conducted_max = QDB(22); - - maxpwr = QDB(ch->max_power) - delta; - maxpwr = max(maxpwr, 0); - maxpwr = min(maxpwr, conducted_max); - - /* CCK txpwr limits for 2.4G band */ - if (band->bandtype == BRCM_BAND_2G) { - for (i = 0; i < BRCMS_NUM_RATES_CCK; i++) - txpwr->cck[i] = (u8) maxpwr; - } - - for (i = 0; i < BRCMS_NUM_RATES_OFDM; i++) { - txpwr->ofdm[i] = (u8) maxpwr; - - /* - * OFDM 40 MHz SISO has the same power as the corresponding - * MCS0-7 rate unless overriden by the locale specific code. - * We set this value to 0 as a flag (presumably 0 dBm isn't - * a possibility) and then copy the MCS0-7 value to the 40 MHz - * value if it wasn't explicitly set. - */ - txpwr->ofdm_40_siso[i] = 0; - - txpwr->ofdm_cdd[i] = (u8) maxpwr; - - txpwr->ofdm_40_cdd[i] = 0; - } - - delta = 0; - if (band->antgain > QDB(6)) - delta = band->antgain - QDB(6); /* Excess over 6 dB */ - - if (band->bandtype == BRCM_BAND_2G) - maxpwr_idx = (chan - 1); - else - maxpwr_idx = CHANNEL_POWER_IDX_5G(chan); - - maxpwr20 = li_mimo->maxpwr20[maxpwr_idx]; - maxpwr40 = li_mimo->maxpwr40[maxpwr_idx]; - - maxpwr20 = maxpwr20 - delta; - maxpwr20 = max(maxpwr20, 0); - maxpwr40 = maxpwr40 - delta; - maxpwr40 = max(maxpwr40, 0); - - /* Fill in the MCS 0-7 (SISO) rates */ - for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) { - - /* - * 20 MHz has the same power as the corresponding OFDM rate - * unless overriden by the locale specific code. - */ - txpwr->mcs_20_siso[i] = txpwr->ofdm[i]; - txpwr->mcs_40_siso[i] = 0; - } - - /* Fill in the MCS 0-7 CDD rates */ - for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) { - txpwr->mcs_20_cdd[i] = (u8) maxpwr20; - txpwr->mcs_40_cdd[i] = (u8) maxpwr40; - } - - /* - * These locales have SISO expressed in the - * table and override CDD later - */ - if (li_mimo == &locale_bn) { - if (li_mimo == &locale_bn) { - maxpwr20 = QDB(16); - maxpwr40 = 0; - - if (chan >= 3 && chan <= 11) - maxpwr40 = QDB(16); - } - - for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) { - txpwr->mcs_20_siso[i] = (u8) maxpwr20; - txpwr->mcs_40_siso[i] = (u8) maxpwr40; - } - } - - /* Fill in the MCS 0-7 STBC rates */ - for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) { - txpwr->mcs_20_stbc[i] = 0; - txpwr->mcs_40_stbc[i] = 0; - } - - /* Fill in the MCS 8-15 SDM rates */ - for (i = 0; i < BRCMS_NUM_RATES_MCS_2_STREAM; i++) { - txpwr->mcs_20_mimo[i] = (u8) maxpwr20; - txpwr->mcs_40_mimo[i] = (u8) maxpwr40; - } - - /* Fill in MCS32 */ - txpwr->mcs32 = (u8) maxpwr40; - - for (i = 0, j = 0; i < BRCMS_NUM_RATES_OFDM; i++, j++) { - if (txpwr->ofdm_40_cdd[i] == 0) - txpwr->ofdm_40_cdd[i] = txpwr->mcs_40_cdd[j]; - if (i == 0) { - i = i + 1; - if (txpwr->ofdm_40_cdd[i] == 0) - txpwr->ofdm_40_cdd[i] = txpwr->mcs_40_cdd[j]; - } - } - - /* - * Copy the 40 MHZ MCS 0-7 CDD value to the 40 MHZ MCS 0-7 SISO - * value if it wasn't provided explicitly. - */ - for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) { - if (txpwr->mcs_40_siso[i] == 0) - txpwr->mcs_40_siso[i] = txpwr->mcs_40_cdd[i]; - } - - for (i = 0, j = 0; i < BRCMS_NUM_RATES_OFDM; i++, j++) { - if (txpwr->ofdm_40_siso[i] == 0) - txpwr->ofdm_40_siso[i] = txpwr->mcs_40_siso[j]; - if (i == 0) { - i = i + 1; - if (txpwr->ofdm_40_siso[i] == 0) - txpwr->ofdm_40_siso[i] = txpwr->mcs_40_siso[j]; - } - } - - /* - * Copy the 20 and 40 MHz MCS0-7 CDD values to the corresponding - * STBC values if they weren't provided explicitly. - */ - for (i = 0; i < BRCMS_NUM_RATES_MCS_1_STREAM; i++) { - if (txpwr->mcs_20_stbc[i] == 0) - txpwr->mcs_20_stbc[i] = txpwr->mcs_20_cdd[i]; - - if (txpwr->mcs_40_stbc[i] == 0) - txpwr->mcs_40_stbc[i] = txpwr->mcs_40_cdd[i]; - } - - return; -} - -/* - * Verify the chanspec is using a legal set of parameters, i.e. that the - * chanspec specified a band, bw, ctl_sb and channel and that the - * combination could be legal given any set of circumstances. - * RETURNS: true is the chanspec is malformed, false if it looks good. - */ -static bool brcms_c_chspec_malformed(u16 chanspec) -{ - /* must be 2G or 5G band */ - if (!CHSPEC_IS5G(chanspec) && !CHSPEC_IS2G(chanspec)) - return true; - /* must be 20 or 40 bandwidth */ - if (!CHSPEC_IS40(chanspec) && !CHSPEC_IS20(chanspec)) - return true; - - /* 20MHZ b/w must have no ctl sb, 40 must have a ctl sb */ - if (CHSPEC_IS20(chanspec)) { - if (!CHSPEC_SB_NONE(chanspec)) - return true; - } else if (!CHSPEC_SB_UPPER(chanspec) && !CHSPEC_SB_LOWER(chanspec)) { - return true; - } - - return false; -} - -/* - * Validate the chanspec for this locale, for 40MHZ we need to also - * check that the sidebands are valid 20MZH channels in this locale - * and they are also a legal HT combination - */ -static bool -brcms_c_valid_chanspec_ext(struct brcms_cm_info *wlc_cm, u16 chspec) -{ - struct brcms_c_info *wlc = wlc_cm->wlc; - u8 channel = CHSPEC_CHANNEL(chspec); - - /* check the chanspec */ - if (brcms_c_chspec_malformed(chspec)) { - brcms_err(wlc->hw->d11core, "wl%d: malformed chanspec 0x%x\n", - wlc->pub->unit, chspec); - return false; - } - - if (CHANNEL_BANDUNIT(wlc_cm->wlc, channel) != - chspec_bandunit(chspec)) - return false; - - return true; -} - -bool brcms_c_valid_chanspec_db(struct brcms_cm_info *wlc_cm, u16 chspec) -{ - return brcms_c_valid_chanspec_ext(wlc_cm, chspec); -} - -static bool brcms_is_radar_freq(u16 center_freq) -{ - return center_freq >= 5260 && center_freq <= 5700; -} - -static void brcms_reg_apply_radar_flags(struct wiphy *wiphy) -{ - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch; - int i; - - sband = wiphy->bands[IEEE80211_BAND_5GHZ]; - if (!sband) - return; - - for (i = 0; i < sband->n_channels; i++) { - ch = &sband->channels[i]; - - if (!brcms_is_radar_freq(ch->center_freq)) - continue; - - /* - * All channels in this range should be passive and have - * DFS enabled. - */ - if (!(ch->flags & IEEE80211_CHAN_DISABLED)) - ch->flags |= IEEE80211_CHAN_RADAR | - IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN; - } -} - -static void -brcms_reg_apply_beaconing_flags(struct wiphy *wiphy, - enum nl80211_reg_initiator initiator) -{ - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch; - const struct ieee80211_reg_rule *rule; - int band, i; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - sband = wiphy->bands[band]; - if (!sband) - continue; - - for (i = 0; i < sband->n_channels; i++) { - ch = &sband->channels[i]; - - if (ch->flags & - (IEEE80211_CHAN_DISABLED | IEEE80211_CHAN_RADAR)) - continue; - - if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) { - rule = freq_reg_info(wiphy, ch->center_freq); - if (IS_ERR(rule)) - continue; - - if (!(rule->flags & NL80211_RRF_NO_IBSS)) - ch->flags &= ~IEEE80211_CHAN_NO_IBSS; - if (!(rule->flags & NL80211_RRF_PASSIVE_SCAN)) - ch->flags &= - ~IEEE80211_CHAN_PASSIVE_SCAN; - } else if (ch->beacon_found) { - ch->flags &= ~(IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN); - } - } - } -} - -static void brcms_reg_notifier(struct wiphy *wiphy, - struct regulatory_request *request) -{ - struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); - struct brcms_info *wl = hw->priv; - struct brcms_c_info *wlc = wl->wlc; - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch; - int band, i; - bool ch_found = false; - - brcms_reg_apply_radar_flags(wiphy); - - if (request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) - brcms_reg_apply_beaconing_flags(wiphy, request->initiator); - - /* Disable radio if all channels disallowed by regulatory */ - for (band = 0; !ch_found && band < IEEE80211_NUM_BANDS; band++) { - sband = wiphy->bands[band]; - if (!sband) - continue; - - for (i = 0; !ch_found && i < sband->n_channels; i++) { - ch = &sband->channels[i]; - - if (!(ch->flags & IEEE80211_CHAN_DISABLED)) - ch_found = true; - } - } - - if (ch_found) { - mboolclr(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); - } else { - mboolset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); - brcms_err(wlc->hw->d11core, - "wl%d: %s: no valid channel for \"%s\"\n", - wlc->pub->unit, __func__, request->alpha2); - } - - if (wlc->pub->_nbands > 1 || wlc->band->bandtype == BRCM_BAND_2G) - wlc_phy_chanspec_ch14_widefilter_set(wlc->band->pi, - brcms_c_japan_ccode(request->alpha2)); -} - -void brcms_c_regd_init(struct brcms_c_info *wlc) -{ - struct wiphy *wiphy = wlc->wiphy; - const struct brcms_regd *regd = wlc->cmi->world_regd; - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch; - struct brcms_chanvec sup_chan; - struct brcms_band *band; - int band_idx, i; - - /* Disable any channels not supported by the phy */ - for (band_idx = 0; band_idx < wlc->pub->_nbands; band_idx++) { - band = wlc->bandstate[band_idx]; - - wlc_phy_chanspec_band_validch(band->pi, band->bandtype, - &sup_chan); - - if (band_idx == BAND_2G_INDEX) - sband = wiphy->bands[IEEE80211_BAND_2GHZ]; - else - sband = wiphy->bands[IEEE80211_BAND_5GHZ]; - - for (i = 0; i < sband->n_channels; i++) { - ch = &sband->channels[i]; - if (!isset(sup_chan.vec, ch->hw_value)) - ch->flags |= IEEE80211_CHAN_DISABLED; - } - } - - wlc->wiphy->reg_notifier = brcms_reg_notifier; - wlc->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | - WIPHY_FLAG_STRICT_REGULATORY; - wiphy_apply_custom_regulatory(wlc->wiphy, regd->regdomain); - brcms_reg_apply_beaconing_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER); -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.h b/drivers/net/wireless/brcm80211/brcmsmac/channel.h deleted file mode 100644 index 006483a0abe6..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/channel.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_CHANNEL_H_ -#define _BRCM_CHANNEL_H_ - -/* conversion for phy txpwr calculations that use .25 dB units */ -#define BRCMS_TXPWR_DB_FACTOR 4 - -/* bits for locale_info flags */ -#define BRCMS_PEAK_CONDUCTED 0x00 /* Peak for locals */ -#define BRCMS_EIRP 0x01 /* Flag for EIRP */ -#define BRCMS_DFS_TPC 0x02 /* Flag for DFS TPC */ -#define BRCMS_NO_OFDM 0x04 /* Flag for No OFDM */ -#define BRCMS_NO_40MHZ 0x08 /* Flag for No MIMO 40MHz */ -#define BRCMS_NO_MIMO 0x10 /* Flag for No MIMO, 20 or 40 MHz */ -#define BRCMS_RADAR_TYPE_EU 0x20 /* Flag for EU */ -#define BRCMS_DFS_FCC BRCMS_DFS_TPC /* Flag for DFS FCC */ - -#define BRCMS_DFS_EU (BRCMS_DFS_TPC | BRCMS_RADAR_TYPE_EU) /* Flag for DFS EU */ - -extern struct brcms_cm_info * -brcms_c_channel_mgr_attach(struct brcms_c_info *wlc); - -extern void brcms_c_channel_mgr_detach(struct brcms_cm_info *wlc_cm); - -extern bool brcms_c_valid_chanspec_db(struct brcms_cm_info *wlc_cm, - u16 chspec); - -extern void brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, - u16 chanspec, - struct txpwr_limits *txpwr); -extern void brcms_c_channel_set_chanspec(struct brcms_cm_info *wlc_cm, - u16 chanspec, - u8 local_constraint_qdbm); -extern void brcms_c_regd_init(struct brcms_c_info *wlc); - -#endif /* _WLC_CHANNEL_H */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/d11.h b/drivers/net/wireless/brcm80211/brcmsmac/d11.h deleted file mode 100644 index 9035cc4d6ff3..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/d11.h +++ /dev/null @@ -1,1902 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_D11_H_ -#define _BRCM_D11_H_ - -#include - -#include -#include "pub.h" -#include "dma.h" - -/* RX FIFO numbers */ -#define RX_FIFO 0 /* data and ctl frames */ -#define RX_TXSTATUS_FIFO 3 /* RX fifo for tx status packages */ - -/* TX FIFO numbers using WME Access Category */ -#define TX_AC_BK_FIFO 0 /* Background TX FIFO */ -#define TX_AC_BE_FIFO 1 /* Best-Effort TX FIFO */ -#define TX_AC_VI_FIFO 2 /* Video TX FIFO */ -#define TX_AC_VO_FIFO 3 /* Voice TX FIFO */ -#define TX_BCMC_FIFO 4 /* Broadcast/Multicast TX FIFO */ -#define TX_ATIM_FIFO 5 /* TX fifo for ATIM window info */ - -/* Addr is byte address used by SW; offset is word offset used by uCode */ - -/* Per AC TX limit settings */ -#define M_AC_TXLMT_BASE_ADDR (0x180 * 2) -#define M_AC_TXLMT_ADDR(_ac) (M_AC_TXLMT_BASE_ADDR + (2 * (_ac))) - -/* Legacy TX FIFO numbers */ -#define TX_DATA_FIFO TX_AC_BE_FIFO -#define TX_CTL_FIFO TX_AC_VO_FIFO - -#define WL_RSSI_ANT_MAX 4 /* max possible rx antennas */ - -struct intctrlregs { - u32 intstatus; - u32 intmask; -}; - -/* PIO structure, - * support two PIO format: 2 bytes access and 4 bytes access - * basic FIFO register set is per channel(transmit or receive) - * a pair of channels is defined for convenience - */ -/* 2byte-wide pio register set per channel(xmt or rcv) */ -struct pio2regs { - u16 fifocontrol; - u16 fifodata; - u16 fifofree; /* only valid in xmt channel, not in rcv channel */ - u16 PAD; -}; - -/* a pair of pio channels(tx and rx) */ -struct pio2regp { - struct pio2regs tx; - struct pio2regs rx; -}; - -/* 4byte-wide pio register set per channel(xmt or rcv) */ -struct pio4regs { - u32 fifocontrol; - u32 fifodata; -}; - -/* a pair of pio channels(tx and rx) */ -struct pio4regp { - struct pio4regs tx; - struct pio4regs rx; -}; - -/* read: 32-bit register that can be read as 32-bit or as 2 16-bit - * write: only low 16b-it half can be written - */ -union pmqreg { - u32 pmqhostdata; /* read only! */ - struct { - u16 pmqctrlstatus; /* read/write */ - u16 PAD; - } w; -}; - -struct fifo64 { - struct dma64regs dmaxmt; /* dma tx */ - struct pio4regs piotx; /* pio tx */ - struct dma64regs dmarcv; /* dma rx */ - struct pio4regs piorx; /* pio rx */ -}; - -/* - * Host Interface Registers - */ -struct d11regs { - /* Device Control ("semi-standard host registers") */ - u32 PAD[3]; /* 0x0 - 0x8 */ - u32 biststatus; /* 0xC */ - u32 biststatus2; /* 0x10 */ - u32 PAD; /* 0x14 */ - u32 gptimer; /* 0x18 */ - u32 usectimer; /* 0x1c *//* for corerev >= 26 */ - - /* Interrupt Control *//* 0x20 */ - struct intctrlregs intctrlregs[8]; - - u32 PAD[40]; /* 0x60 - 0xFC */ - - u32 intrcvlazy[4]; /* 0x100 - 0x10C */ - - u32 PAD[4]; /* 0x110 - 0x11c */ - - u32 maccontrol; /* 0x120 */ - u32 maccommand; /* 0x124 */ - u32 macintstatus; /* 0x128 */ - u32 macintmask; /* 0x12C */ - - /* Transmit Template Access */ - u32 tplatewrptr; /* 0x130 */ - u32 tplatewrdata; /* 0x134 */ - u32 PAD[2]; /* 0x138 - 0x13C */ - - /* PMQ registers */ - union pmqreg pmqreg; /* 0x140 */ - u32 pmqpatl; /* 0x144 */ - u32 pmqpath; /* 0x148 */ - u32 PAD; /* 0x14C */ - - u32 chnstatus; /* 0x150 */ - u32 psmdebug; /* 0x154 */ - u32 phydebug; /* 0x158 */ - u32 machwcap; /* 0x15C */ - - /* Extended Internal Objects */ - u32 objaddr; /* 0x160 */ - u32 objdata; /* 0x164 */ - u32 PAD[2]; /* 0x168 - 0x16c */ - - u32 frmtxstatus; /* 0x170 */ - u32 frmtxstatus2; /* 0x174 */ - u32 PAD[2]; /* 0x178 - 0x17c */ - - /* TSF host access */ - u32 tsf_timerlow; /* 0x180 */ - u32 tsf_timerhigh; /* 0x184 */ - u32 tsf_cfprep; /* 0x188 */ - u32 tsf_cfpstart; /* 0x18c */ - u32 tsf_cfpmaxdur32; /* 0x190 */ - u32 PAD[3]; /* 0x194 - 0x19c */ - - u32 maccontrol1; /* 0x1a0 */ - u32 machwcap1; /* 0x1a4 */ - u32 PAD[14]; /* 0x1a8 - 0x1dc */ - - /* Clock control and hardware workarounds*/ - u32 clk_ctl_st; /* 0x1e0 */ - u32 hw_war; - u32 d11_phypllctl; /* the phypll request/avail bits are - * moved to clk_ctl_st - */ - u32 PAD[5]; /* 0x1ec - 0x1fc */ - - /* 0x200-0x37F dma/pio registers */ - struct fifo64 fifo64regs[6]; - - /* FIFO diagnostic port access */ - struct dma32diag dmafifo; /* 0x380 - 0x38C */ - - u32 aggfifocnt; /* 0x390 */ - u32 aggfifodata; /* 0x394 */ - u32 PAD[16]; /* 0x398 - 0x3d4 */ - u16 radioregaddr; /* 0x3d8 */ - u16 radioregdata; /* 0x3da */ - - /* - * time delay between the change on rf disable input and - * radio shutdown - */ - u32 rfdisabledly; /* 0x3DC */ - - /* PHY register access */ - u16 phyversion; /* 0x3e0 - 0x0 */ - u16 phybbconfig; /* 0x3e2 - 0x1 */ - u16 phyadcbias; /* 0x3e4 - 0x2 Bphy only */ - u16 phyanacore; /* 0x3e6 - 0x3 pwwrdwn on aphy */ - u16 phyrxstatus0; /* 0x3e8 - 0x4 */ - u16 phyrxstatus1; /* 0x3ea - 0x5 */ - u16 phycrsth; /* 0x3ec - 0x6 */ - u16 phytxerror; /* 0x3ee - 0x7 */ - u16 phychannel; /* 0x3f0 - 0x8 */ - u16 PAD[1]; /* 0x3f2 - 0x9 */ - u16 phytest; /* 0x3f4 - 0xa */ - u16 phy4waddr; /* 0x3f6 - 0xb */ - u16 phy4wdatahi; /* 0x3f8 - 0xc */ - u16 phy4wdatalo; /* 0x3fa - 0xd */ - u16 phyregaddr; /* 0x3fc - 0xe */ - u16 phyregdata; /* 0x3fe - 0xf */ - - /* IHR *//* 0x400 - 0x7FE */ - - /* RXE Block */ - u16 PAD[3]; /* 0x400 - 0x406 */ - u16 rcv_fifo_ctl; /* 0x406 */ - u16 PAD; /* 0x408 - 0x40a */ - u16 rcv_frm_cnt; /* 0x40a */ - u16 PAD[4]; /* 0x40a - 0x414 */ - u16 rssi; /* 0x414 */ - u16 PAD[5]; /* 0x414 - 0x420 */ - u16 rcm_ctl; /* 0x420 */ - u16 rcm_mat_data; /* 0x422 */ - u16 rcm_mat_mask; /* 0x424 */ - u16 rcm_mat_dly; /* 0x426 */ - u16 rcm_cond_mask_l; /* 0x428 */ - u16 rcm_cond_mask_h; /* 0x42A */ - u16 rcm_cond_dly; /* 0x42C */ - u16 PAD[1]; /* 0x42E */ - u16 ext_ihr_addr; /* 0x430 */ - u16 ext_ihr_data; /* 0x432 */ - u16 rxe_phyrs_2; /* 0x434 */ - u16 rxe_phyrs_3; /* 0x436 */ - u16 phy_mode; /* 0x438 */ - u16 rcmta_ctl; /* 0x43a */ - u16 rcmta_size; /* 0x43c */ - u16 rcmta_addr0; /* 0x43e */ - u16 rcmta_addr1; /* 0x440 */ - u16 rcmta_addr2; /* 0x442 */ - u16 PAD[30]; /* 0x444 - 0x480 */ - - /* PSM Block *//* 0x480 - 0x500 */ - - u16 PAD; /* 0x480 */ - u16 psm_maccontrol_h; /* 0x482 */ - u16 psm_macintstatus_l; /* 0x484 */ - u16 psm_macintstatus_h; /* 0x486 */ - u16 psm_macintmask_l; /* 0x488 */ - u16 psm_macintmask_h; /* 0x48A */ - u16 PAD; /* 0x48C */ - u16 psm_maccommand; /* 0x48E */ - u16 psm_brc; /* 0x490 */ - u16 psm_phy_hdr_param; /* 0x492 */ - u16 psm_postcard; /* 0x494 */ - u16 psm_pcard_loc_l; /* 0x496 */ - u16 psm_pcard_loc_h; /* 0x498 */ - u16 psm_gpio_in; /* 0x49A */ - u16 psm_gpio_out; /* 0x49C */ - u16 psm_gpio_oe; /* 0x49E */ - - u16 psm_bred_0; /* 0x4A0 */ - u16 psm_bred_1; /* 0x4A2 */ - u16 psm_bred_2; /* 0x4A4 */ - u16 psm_bred_3; /* 0x4A6 */ - u16 psm_brcl_0; /* 0x4A8 */ - u16 psm_brcl_1; /* 0x4AA */ - u16 psm_brcl_2; /* 0x4AC */ - u16 psm_brcl_3; /* 0x4AE */ - u16 psm_brpo_0; /* 0x4B0 */ - u16 psm_brpo_1; /* 0x4B2 */ - u16 psm_brpo_2; /* 0x4B4 */ - u16 psm_brpo_3; /* 0x4B6 */ - u16 psm_brwk_0; /* 0x4B8 */ - u16 psm_brwk_1; /* 0x4BA */ - u16 psm_brwk_2; /* 0x4BC */ - u16 psm_brwk_3; /* 0x4BE */ - - u16 psm_base_0; /* 0x4C0 */ - u16 psm_base_1; /* 0x4C2 */ - u16 psm_base_2; /* 0x4C4 */ - u16 psm_base_3; /* 0x4C6 */ - u16 psm_base_4; /* 0x4C8 */ - u16 psm_base_5; /* 0x4CA */ - u16 psm_base_6; /* 0x4CC */ - u16 psm_pc_reg_0; /* 0x4CE */ - u16 psm_pc_reg_1; /* 0x4D0 */ - u16 psm_pc_reg_2; /* 0x4D2 */ - u16 psm_pc_reg_3; /* 0x4D4 */ - u16 PAD[0xD]; /* 0x4D6 - 0x4DE */ - u16 psm_corectlsts; /* 0x4f0 *//* Corerev >= 13 */ - u16 PAD[0x7]; /* 0x4f2 - 0x4fE */ - - /* TXE0 Block *//* 0x500 - 0x580 */ - u16 txe_ctl; /* 0x500 */ - u16 txe_aux; /* 0x502 */ - u16 txe_ts_loc; /* 0x504 */ - u16 txe_time_out; /* 0x506 */ - u16 txe_wm_0; /* 0x508 */ - u16 txe_wm_1; /* 0x50A */ - u16 txe_phyctl; /* 0x50C */ - u16 txe_status; /* 0x50E */ - u16 txe_mmplcp0; /* 0x510 */ - u16 txe_mmplcp1; /* 0x512 */ - u16 txe_phyctl1; /* 0x514 */ - - u16 PAD[0x05]; /* 0x510 - 0x51E */ - - /* Transmit control */ - u16 xmtfifodef; /* 0x520 */ - u16 xmtfifo_frame_cnt; /* 0x522 *//* Corerev >= 16 */ - u16 xmtfifo_byte_cnt; /* 0x524 *//* Corerev >= 16 */ - u16 xmtfifo_head; /* 0x526 *//* Corerev >= 16 */ - u16 xmtfifo_rd_ptr; /* 0x528 *//* Corerev >= 16 */ - u16 xmtfifo_wr_ptr; /* 0x52A *//* Corerev >= 16 */ - u16 xmtfifodef1; /* 0x52C *//* Corerev >= 16 */ - - u16 PAD[0x09]; /* 0x52E - 0x53E */ - - u16 xmtfifocmd; /* 0x540 */ - u16 xmtfifoflush; /* 0x542 */ - u16 xmtfifothresh; /* 0x544 */ - u16 xmtfifordy; /* 0x546 */ - u16 xmtfifoprirdy; /* 0x548 */ - u16 xmtfiforqpri; /* 0x54A */ - u16 xmttplatetxptr; /* 0x54C */ - u16 PAD; /* 0x54E */ - u16 xmttplateptr; /* 0x550 */ - u16 smpl_clct_strptr; /* 0x552 *//* Corerev >= 22 */ - u16 smpl_clct_stpptr; /* 0x554 *//* Corerev >= 22 */ - u16 smpl_clct_curptr; /* 0x556 *//* Corerev >= 22 */ - u16 PAD[0x04]; /* 0x558 - 0x55E */ - u16 xmttplatedatalo; /* 0x560 */ - u16 xmttplatedatahi; /* 0x562 */ - - u16 PAD[2]; /* 0x564 - 0x566 */ - - u16 xmtsel; /* 0x568 */ - u16 xmttxcnt; /* 0x56A */ - u16 xmttxshmaddr; /* 0x56C */ - - u16 PAD[0x09]; /* 0x56E - 0x57E */ - - /* TXE1 Block */ - u16 PAD[0x40]; /* 0x580 - 0x5FE */ - - /* TSF Block */ - u16 PAD[0X02]; /* 0x600 - 0x602 */ - u16 tsf_cfpstrt_l; /* 0x604 */ - u16 tsf_cfpstrt_h; /* 0x606 */ - u16 PAD[0X05]; /* 0x608 - 0x610 */ - u16 tsf_cfppretbtt; /* 0x612 */ - u16 PAD[0XD]; /* 0x614 - 0x62C */ - u16 tsf_clk_frac_l; /* 0x62E */ - u16 tsf_clk_frac_h; /* 0x630 */ - u16 PAD[0X14]; /* 0x632 - 0x658 */ - u16 tsf_random; /* 0x65A */ - u16 PAD[0x05]; /* 0x65C - 0x664 */ - /* GPTimer 2 registers */ - u16 tsf_gpt2_stat; /* 0x666 */ - u16 tsf_gpt2_ctr_l; /* 0x668 */ - u16 tsf_gpt2_ctr_h; /* 0x66A */ - u16 tsf_gpt2_val_l; /* 0x66C */ - u16 tsf_gpt2_val_h; /* 0x66E */ - u16 tsf_gptall_stat; /* 0x670 */ - u16 PAD[0x07]; /* 0x672 - 0x67E */ - - /* IFS Block */ - u16 ifs_sifs_rx_tx_tx; /* 0x680 */ - u16 ifs_sifs_nav_tx; /* 0x682 */ - u16 ifs_slot; /* 0x684 */ - u16 PAD; /* 0x686 */ - u16 ifs_ctl; /* 0x688 */ - u16 PAD[0x3]; /* 0x68a - 0x68F */ - u16 ifsstat; /* 0x690 */ - u16 ifsmedbusyctl; /* 0x692 */ - u16 iftxdur; /* 0x694 */ - u16 PAD[0x3]; /* 0x696 - 0x69b */ - /* EDCF support in dot11macs */ - u16 ifs_aifsn; /* 0x69c */ - u16 ifs_ctl1; /* 0x69e */ - - /* slow clock registers */ - u16 scc_ctl; /* 0x6a0 */ - u16 scc_timer_l; /* 0x6a2 */ - u16 scc_timer_h; /* 0x6a4 */ - u16 scc_frac; /* 0x6a6 */ - u16 scc_fastpwrup_dly; /* 0x6a8 */ - u16 scc_per; /* 0x6aa */ - u16 scc_per_frac; /* 0x6ac */ - u16 scc_cal_timer_l; /* 0x6ae */ - u16 scc_cal_timer_h; /* 0x6b0 */ - u16 PAD; /* 0x6b2 */ - - u16 PAD[0x26]; - - /* NAV Block */ - u16 nav_ctl; /* 0x700 */ - u16 navstat; /* 0x702 */ - u16 PAD[0x3e]; /* 0x702 - 0x77E */ - - /* WEP/PMQ Block *//* 0x780 - 0x7FE */ - u16 PAD[0x20]; /* 0x780 - 0x7BE */ - - u16 wepctl; /* 0x7C0 */ - u16 wepivloc; /* 0x7C2 */ - u16 wepivkey; /* 0x7C4 */ - u16 wepwkey; /* 0x7C6 */ - - u16 PAD[4]; /* 0x7C8 - 0x7CE */ - u16 pcmctl; /* 0X7D0 */ - u16 pcmstat; /* 0X7D2 */ - u16 PAD[6]; /* 0x7D4 - 0x7DE */ - - u16 pmqctl; /* 0x7E0 */ - u16 pmqstatus; /* 0x7E2 */ - u16 pmqpat0; /* 0x7E4 */ - u16 pmqpat1; /* 0x7E6 */ - u16 pmqpat2; /* 0x7E8 */ - - u16 pmqdat; /* 0x7EA */ - u16 pmqdator; /* 0x7EC */ - u16 pmqhst; /* 0x7EE */ - u16 pmqpath0; /* 0x7F0 */ - u16 pmqpath1; /* 0x7F2 */ - u16 pmqpath2; /* 0x7F4 */ - u16 pmqdath; /* 0x7F6 */ - - u16 PAD[0x04]; /* 0x7F8 - 0x7FE */ - - /* SHM *//* 0x800 - 0xEFE */ - u16 PAD[0x380]; /* 0x800 - 0xEFE */ -}; - -/* d11 register field offset */ -#define D11REGOFFS(field) offsetof(struct d11regs, field) - -#define PIHR_BASE 0x0400 /* byte address of packed IHR region */ - -/* biststatus */ -#define BT_DONE (1U << 31) /* bist done */ -#define BT_B2S (1 << 30) /* bist2 ram summary bit */ - -/* intstatus and intmask */ -#define I_PC (1 << 10) /* pci descriptor error */ -#define I_PD (1 << 11) /* pci data error */ -#define I_DE (1 << 12) /* descriptor protocol error */ -#define I_RU (1 << 13) /* receive descriptor underflow */ -#define I_RO (1 << 14) /* receive fifo overflow */ -#define I_XU (1 << 15) /* transmit fifo underflow */ -#define I_RI (1 << 16) /* receive interrupt */ -#define I_XI (1 << 24) /* transmit interrupt */ - -/* interrupt receive lazy */ -#define IRL_TO_MASK 0x00ffffff /* timeout */ -#define IRL_FC_MASK 0xff000000 /* frame count */ -#define IRL_FC_SHIFT 24 /* frame count */ - -/*== maccontrol register ==*/ -#define MCTL_GMODE (1U << 31) -#define MCTL_DISCARD_PMQ (1 << 30) -#define MCTL_TBTTHOLD (1 << 28) -#define MCTL_WAKE (1 << 26) -#define MCTL_HPS (1 << 25) -#define MCTL_PROMISC (1 << 24) -#define MCTL_KEEPBADFCS (1 << 23) -#define MCTL_KEEPCONTROL (1 << 22) -#define MCTL_PHYLOCK (1 << 21) -#define MCTL_BCNS_PROMISC (1 << 20) -#define MCTL_LOCK_RADIO (1 << 19) -#define MCTL_AP (1 << 18) -#define MCTL_INFRA (1 << 17) -#define MCTL_BIGEND (1 << 16) -#define MCTL_GPOUT_SEL_MASK (3 << 14) -#define MCTL_GPOUT_SEL_SHIFT 14 -#define MCTL_EN_PSMDBG (1 << 13) -#define MCTL_IHR_EN (1 << 10) -#define MCTL_SHM_UPPER (1 << 9) -#define MCTL_SHM_EN (1 << 8) -#define MCTL_PSM_JMP_0 (1 << 2) -#define MCTL_PSM_RUN (1 << 1) -#define MCTL_EN_MAC (1 << 0) - -/*== maccommand register ==*/ -#define MCMD_BCN0VLD (1 << 0) -#define MCMD_BCN1VLD (1 << 1) -#define MCMD_DIRFRMQVAL (1 << 2) -#define MCMD_CCA (1 << 3) -#define MCMD_BG_NOISE (1 << 4) -#define MCMD_SKIP_SHMINIT (1 << 5) /* only used for simulation */ -#define MCMD_SAMPLECOLL MCMD_SKIP_SHMINIT /* reuse for sample collect */ - -/*== macintstatus/macintmask ==*/ -/* gracefully suspended */ -#define MI_MACSSPNDD (1 << 0) -/* beacon template available */ -#define MI_BCNTPL (1 << 1) -/* TBTT indication */ -#define MI_TBTT (1 << 2) -/* beacon successfully tx'd */ -#define MI_BCNSUCCESS (1 << 3) -/* beacon canceled (IBSS) */ -#define MI_BCNCANCLD (1 << 4) -/* end of ATIM-window (IBSS) */ -#define MI_ATIMWINEND (1 << 5) -/* PMQ entries available */ -#define MI_PMQ (1 << 6) -/* non-specific gen-stat bits that are set by PSM */ -#define MI_NSPECGEN_0 (1 << 7) -/* non-specific gen-stat bits that are set by PSM */ -#define MI_NSPECGEN_1 (1 << 8) -/* MAC level Tx error */ -#define MI_MACTXERR (1 << 9) -/* non-specific gen-stat bits that are set by PSM */ -#define MI_NSPECGEN_3 (1 << 10) -/* PHY Tx error */ -#define MI_PHYTXERR (1 << 11) -/* Power Management Event */ -#define MI_PME (1 << 12) -/* General-purpose timer0 */ -#define MI_GP0 (1 << 13) -/* General-purpose timer1 */ -#define MI_GP1 (1 << 14) -/* (ORed) DMA-interrupts */ -#define MI_DMAINT (1 << 15) -/* MAC has completed a TX FIFO Suspend/Flush */ -#define MI_TXSTOP (1 << 16) -/* MAC has completed a CCA measurement */ -#define MI_CCA (1 << 17) -/* MAC has collected background noise samples */ -#define MI_BG_NOISE (1 << 18) -/* MBSS DTIM TBTT indication */ -#define MI_DTIM_TBTT (1 << 19) -/* Probe response queue needs attention */ -#define MI_PRQ (1 << 20) -/* Radio/PHY has been powered back up. */ -#define MI_PWRUP (1 << 21) -#define MI_RESERVED3 (1 << 22) -#define MI_RESERVED2 (1 << 23) -#define MI_RESERVED1 (1 << 25) -/* MAC detected change on RF Disable input*/ -#define MI_RFDISABLE (1 << 28) -/* MAC has completed a TX */ -#define MI_TFS (1 << 29) -/* A phy status change wrt G mode */ -#define MI_PHYCHANGED (1 << 30) -/* general purpose timeout */ -#define MI_TO (1U << 31) - -/* Mac capabilities registers */ -/*== machwcap ==*/ -#define MCAP_TKIPMIC 0x80000000 /* TKIP MIC hardware present */ - -/*== pmqhost data ==*/ -/* data entry of head pmq entry */ -#define PMQH_DATA_MASK 0xffff0000 -/* PM entry for BSS config */ -#define PMQH_BSSCFG 0x00100000 -/* PM Mode OFF: power save off */ -#define PMQH_PMOFF 0x00010000 -/* PM Mode ON: power save on */ -#define PMQH_PMON 0x00020000 -/* Dis-associated or De-authenticated */ -#define PMQH_DASAT 0x00040000 -/* ATIM not acknowledged */ -#define PMQH_ATIMFAIL 0x00080000 -/* delete head entry */ -#define PMQH_DEL_ENTRY 0x00000001 -/* delete head entry to cur read pointer -1 */ -#define PMQH_DEL_MULT 0x00000002 -/* pmq overflow indication */ -#define PMQH_OFLO 0x00000004 -/* entries are present in pmq */ -#define PMQH_NOT_EMPTY 0x00000008 - -/*== phydebug ==*/ -/* phy is asserting carrier sense */ -#define PDBG_CRS (1 << 0) -/* phy is taking xmit byte from mac this cycle */ -#define PDBG_TXA (1 << 1) -/* mac is instructing the phy to transmit a frame */ -#define PDBG_TXF (1 << 2) -/* phy is signalling a transmit Error to the mac */ -#define PDBG_TXE (1 << 3) -/* phy detected the end of a valid frame preamble */ -#define PDBG_RXF (1 << 4) -/* phy detected the end of a valid PLCP header */ -#define PDBG_RXS (1 << 5) -/* rx start not asserted */ -#define PDBG_RXFRG (1 << 6) -/* mac is taking receive byte from phy this cycle */ -#define PDBG_RXV (1 << 7) -/* RF portion of the radio is disabled */ -#define PDBG_RFD (1 << 16) - -/*== objaddr register ==*/ -#define OBJADDR_SEL_MASK 0x000F0000 -#define OBJADDR_UCM_SEL 0x00000000 -#define OBJADDR_SHM_SEL 0x00010000 -#define OBJADDR_SCR_SEL 0x00020000 -#define OBJADDR_IHR_SEL 0x00030000 -#define OBJADDR_RCMTA_SEL 0x00040000 -#define OBJADDR_SRCHM_SEL 0x00060000 -#define OBJADDR_WINC 0x01000000 -#define OBJADDR_RINC 0x02000000 -#define OBJADDR_AUTO_INC 0x03000000 - -#define WEP_PCMADDR 0x07d4 -#define WEP_PCMDATA 0x07d6 - -/*== frmtxstatus ==*/ -#define TXS_V (1 << 0) /* valid bit */ -#define TXS_STATUS_MASK 0xffff -#define TXS_FID_MASK 0xffff0000 -#define TXS_FID_SHIFT 16 - -/*== frmtxstatus2 ==*/ -#define TXS_SEQ_MASK 0xffff -#define TXS_PTX_MASK 0xff0000 -#define TXS_PTX_SHIFT 16 -#define TXS_MU_MASK 0x01000000 -#define TXS_MU_SHIFT 24 - -/*== clk_ctl_st ==*/ -#define CCS_ERSRC_REQ_D11PLL 0x00000100 /* d11 core pll request */ -#define CCS_ERSRC_REQ_PHYPLL 0x00000200 /* PHY pll request */ -#define CCS_ERSRC_AVAIL_D11PLL 0x01000000 /* d11 core pll available */ -#define CCS_ERSRC_AVAIL_PHYPLL 0x02000000 /* PHY pll available */ - -/* HT Cloclk Ctrl and Clock Avail for 4313 */ -#define CCS_ERSRC_REQ_HT 0x00000010 /* HT avail request */ -#define CCS_ERSRC_AVAIL_HT 0x00020000 /* HT clock available */ - -/* tsf_cfprep register */ -#define CFPREP_CBI_MASK 0xffffffc0 -#define CFPREP_CBI_SHIFT 6 -#define CFPREP_CFPP 0x00000001 - -/* tx fifo sizes values are in terms of 256 byte blocks */ -#define TXFIFOCMD_RESET_MASK (1 << 15) /* reset */ -#define TXFIFOCMD_FIFOSEL_SHIFT 8 /* fifo */ -#define TXFIFO_FIFOTOP_SHIFT 8 /* fifo start */ - -#define TXFIFO_START_BLK16 65 /* Base address + 32 * 512 B/P */ -#define TXFIFO_START_BLK 6 /* Base address + 6 * 256 B */ -#define TXFIFO_SIZE_UNIT 256 /* one unit corresponds to 256 bytes */ -#define MBSS16_TEMPLMEM_MINBLKS 65 /* one unit corresponds to 256 bytes */ - -/*== phy versions (PhyVersion:Revision field) ==*/ -/* analog block version */ -#define PV_AV_MASK 0xf000 -/* analog block version bitfield offset */ -#define PV_AV_SHIFT 12 -/* phy type */ -#define PV_PT_MASK 0x0f00 -/* phy type bitfield offset */ -#define PV_PT_SHIFT 8 -/* phy version */ -#define PV_PV_MASK 0x000f -#define PHY_TYPE(v) ((v & PV_PT_MASK) >> PV_PT_SHIFT) - -/*== phy types (PhyVersion:PhyType field) ==*/ -#define PHY_TYPE_N 4 /* N-Phy value */ -#define PHY_TYPE_SSN 6 /* SSLPN-Phy value */ -#define PHY_TYPE_LCN 8 /* LCN-Phy value */ -#define PHY_TYPE_LCNXN 9 /* LCNXN-Phy value */ -#define PHY_TYPE_NULL 0xf /* Invalid Phy value */ - -/*== analog types (PhyVersion:AnalogType field) ==*/ -#define ANA_11N_013 5 - -/* 802.11a PLCP header def */ -struct ofdm_phy_hdr { - u8 rlpt[3]; /* rate, length, parity, tail */ - u16 service; - u8 pad; -} __packed; - -#define D11A_PHY_HDR_GRATE(phdr) ((phdr)->rlpt[0] & 0x0f) -#define D11A_PHY_HDR_GRES(phdr) (((phdr)->rlpt[0] >> 4) & 0x01) -#define D11A_PHY_HDR_GLENGTH(phdr) (((u32 *)((phdr)->rlpt) >> 5) & 0x0fff) -#define D11A_PHY_HDR_GPARITY(phdr) (((phdr)->rlpt[3] >> 1) & 0x01) -#define D11A_PHY_HDR_GTAIL(phdr) (((phdr)->rlpt[3] >> 2) & 0x3f) - -/* rate encoded per 802.11a-1999 sec 17.3.4.1 */ -#define D11A_PHY_HDR_SRATE(phdr, rate) \ - ((phdr)->rlpt[0] = ((phdr)->rlpt[0] & 0xf0) | ((rate) & 0xf)) -/* set reserved field to zero */ -#define D11A_PHY_HDR_SRES(phdr) ((phdr)->rlpt[0] &= 0xef) -/* length is number of octets in PSDU */ -#define D11A_PHY_HDR_SLENGTH(phdr, length) \ - (*(u32 *)((phdr)->rlpt) = *(u32 *)((phdr)->rlpt) | \ - (((length) & 0x0fff) << 5)) -/* set the tail to all zeros */ -#define D11A_PHY_HDR_STAIL(phdr) ((phdr)->rlpt[3] &= 0x03) - -#define D11A_PHY_HDR_LEN_L 3 /* low-rate part of PLCP header */ -#define D11A_PHY_HDR_LEN_R 2 /* high-rate part of PLCP header */ - -#define D11A_PHY_TX_DELAY (2) /* 2.1 usec */ - -#define D11A_PHY_HDR_TIME (4) /* low-rate part of PLCP header */ -#define D11A_PHY_PRE_TIME (16) -#define D11A_PHY_PREHDR_TIME (D11A_PHY_PRE_TIME + D11A_PHY_HDR_TIME) - -/* 802.11b PLCP header def */ -struct cck_phy_hdr { - u8 signal; - u8 service; - u16 length; - u16 crc; -} __packed; - -#define D11B_PHY_HDR_LEN 6 - -#define D11B_PHY_TX_DELAY (3) /* 3.4 usec */ - -#define D11B_PHY_LHDR_TIME (D11B_PHY_HDR_LEN << 3) -#define D11B_PHY_LPRE_TIME (144) -#define D11B_PHY_LPREHDR_TIME (D11B_PHY_LPRE_TIME + D11B_PHY_LHDR_TIME) - -#define D11B_PHY_SHDR_TIME (D11B_PHY_LHDR_TIME >> 1) -#define D11B_PHY_SPRE_TIME (D11B_PHY_LPRE_TIME >> 1) -#define D11B_PHY_SPREHDR_TIME (D11B_PHY_SPRE_TIME + D11B_PHY_SHDR_TIME) - -#define D11B_PLCP_SIGNAL_LOCKED (1 << 2) -#define D11B_PLCP_SIGNAL_LE (1 << 7) - -#define MIMO_PLCP_MCS_MASK 0x7f /* mcs index */ -#define MIMO_PLCP_40MHZ 0x80 /* 40 Hz frame */ -#define MIMO_PLCP_AMPDU 0x08 /* ampdu */ - -#define BRCMS_GET_CCK_PLCP_LEN(plcp) (plcp[4] + (plcp[5] << 8)) -#define BRCMS_GET_MIMO_PLCP_LEN(plcp) (plcp[1] + (plcp[2] << 8)) -#define BRCMS_SET_MIMO_PLCP_LEN(plcp, len) \ - do { \ - plcp[1] = len & 0xff; \ - plcp[2] = ((len >> 8) & 0xff); \ - } while (0) - -#define BRCMS_SET_MIMO_PLCP_AMPDU(plcp) (plcp[3] |= MIMO_PLCP_AMPDU) -#define BRCMS_CLR_MIMO_PLCP_AMPDU(plcp) (plcp[3] &= ~MIMO_PLCP_AMPDU) -#define BRCMS_IS_MIMO_PLCP_AMPDU(plcp) (plcp[3] & MIMO_PLCP_AMPDU) - -/* - * The dot11a PLCP header is 5 bytes. To simplify the software (so that we - * don't need e.g. different tx DMA headers for 11a and 11b), the PLCP header - * has padding added in the ucode. - */ -#define D11_PHY_HDR_LEN 6 - -/* TX DMA buffer header */ -struct d11txh { - __le16 MacTxControlLow; /* 0x0 */ - __le16 MacTxControlHigh; /* 0x1 */ - __le16 MacFrameControl; /* 0x2 */ - __le16 TxFesTimeNormal; /* 0x3 */ - __le16 PhyTxControlWord; /* 0x4 */ - __le16 PhyTxControlWord_1; /* 0x5 */ - __le16 PhyTxControlWord_1_Fbr; /* 0x6 */ - __le16 PhyTxControlWord_1_Rts; /* 0x7 */ - __le16 PhyTxControlWord_1_FbrRts; /* 0x8 */ - __le16 MainRates; /* 0x9 */ - __le16 XtraFrameTypes; /* 0xa */ - u8 IV[16]; /* 0x0b - 0x12 */ - u8 TxFrameRA[6]; /* 0x13 - 0x15 */ - __le16 TxFesTimeFallback; /* 0x16 */ - u8 RTSPLCPFallback[6]; /* 0x17 - 0x19 */ - __le16 RTSDurFallback; /* 0x1a */ - u8 FragPLCPFallback[6]; /* 0x1b - 1d */ - __le16 FragDurFallback; /* 0x1e */ - __le16 MModeLen; /* 0x1f */ - __le16 MModeFbrLen; /* 0x20 */ - __le16 TstampLow; /* 0x21 */ - __le16 TstampHigh; /* 0x22 */ - __le16 ABI_MimoAntSel; /* 0x23 */ - __le16 PreloadSize; /* 0x24 */ - __le16 AmpduSeqCtl; /* 0x25 */ - __le16 TxFrameID; /* 0x26 */ - __le16 TxStatus; /* 0x27 */ - __le16 MaxNMpdus; /* 0x28 */ - __le16 MaxABytes_MRT; /* 0x29 */ - __le16 MaxABytes_FBR; /* 0x2a */ - __le16 MinMBytes; /* 0x2b */ - u8 RTSPhyHeader[D11_PHY_HDR_LEN]; /* 0x2c - 0x2e */ - struct ieee80211_rts rts_frame; /* 0x2f - 0x36 */ - u16 PAD; /* 0x37 */ -} __packed; - -#define D11_TXH_LEN 112 /* bytes */ - -/* Frame Types */ -#define FT_CCK 0 -#define FT_OFDM 1 -#define FT_HT 2 -#define FT_N 3 - -/* - * Position of MPDU inside A-MPDU; indicated with bits 10:9 - * of MacTxControlLow - */ -#define TXC_AMPDU_SHIFT 9 /* shift for ampdu settings */ -#define TXC_AMPDU_NONE 0 /* Regular MPDU, not an A-MPDU */ -#define TXC_AMPDU_FIRST 1 /* first MPDU of an A-MPDU */ -#define TXC_AMPDU_MIDDLE 2 /* intermediate MPDU of an A-MPDU */ -#define TXC_AMPDU_LAST 3 /* last (or single) MPDU of an A-MPDU */ - -/*== MacTxControlLow ==*/ -#define TXC_AMIC 0x8000 -#define TXC_SENDCTS 0x0800 -#define TXC_AMPDU_MASK 0x0600 -#define TXC_BW_40 0x0100 -#define TXC_FREQBAND_5G 0x0080 -#define TXC_DFCS 0x0040 -#define TXC_IGNOREPMQ 0x0020 -#define TXC_HWSEQ 0x0010 -#define TXC_STARTMSDU 0x0008 -#define TXC_SENDRTS 0x0004 -#define TXC_LONGFRAME 0x0002 -#define TXC_IMMEDACK 0x0001 - -/*== MacTxControlHigh ==*/ -/* RTS fallback preamble type 1 = SHORT 0 = LONG */ -#define TXC_PREAMBLE_RTS_FB_SHORT 0x8000 -/* RTS main rate preamble type 1 = SHORT 0 = LONG */ -#define TXC_PREAMBLE_RTS_MAIN_SHORT 0x4000 -/* - * Main fallback rate preamble type - * 1 = SHORT for OFDM/GF for MIMO - * 0 = LONG for CCK/MM for MIMO - */ -#define TXC_PREAMBLE_DATA_FB_SHORT 0x2000 - -/* TXC_PREAMBLE_DATA_MAIN is in PhyTxControl bit 5 */ -/* use fallback rate for this AMPDU */ -#define TXC_AMPDU_FBR 0x1000 -#define TXC_SECKEY_MASK 0x0FF0 -#define TXC_SECKEY_SHIFT 4 -/* Use alternate txpwr defined at loc. M_ALT_TXPWR_IDX */ -#define TXC_ALT_TXPWR 0x0008 -#define TXC_SECTYPE_MASK 0x0007 -#define TXC_SECTYPE_SHIFT 0 - -/* Null delimiter for Fallback rate */ -#define AMPDU_FBR_NULL_DELIM 5 /* Location of Null delimiter count for AMPDU */ - -/* PhyTxControl for Mimophy */ -#define PHY_TXC_PWR_MASK 0xFC00 -#define PHY_TXC_PWR_SHIFT 10 -#define PHY_TXC_ANT_MASK 0x03C0 /* bit 6, 7, 8, 9 */ -#define PHY_TXC_ANT_SHIFT 6 -#define PHY_TXC_ANT_0_1 0x00C0 /* auto, last rx */ -#define PHY_TXC_LCNPHY_ANT_LAST 0x0000 -#define PHY_TXC_ANT_3 0x0200 /* virtual antenna 3 */ -#define PHY_TXC_ANT_2 0x0100 /* virtual antenna 2 */ -#define PHY_TXC_ANT_1 0x0080 /* virtual antenna 1 */ -#define PHY_TXC_ANT_0 0x0040 /* virtual antenna 0 */ -#define PHY_TXC_SHORT_HDR 0x0010 - -#define PHY_TXC_OLD_ANT_0 0x0000 -#define PHY_TXC_OLD_ANT_1 0x0100 -#define PHY_TXC_OLD_ANT_LAST 0x0300 - -/* PhyTxControl_1 for Mimophy */ -#define PHY_TXC1_BW_MASK 0x0007 -#define PHY_TXC1_BW_10MHZ 0 -#define PHY_TXC1_BW_10MHZ_UP 1 -#define PHY_TXC1_BW_20MHZ 2 -#define PHY_TXC1_BW_20MHZ_UP 3 -#define PHY_TXC1_BW_40MHZ 4 -#define PHY_TXC1_BW_40MHZ_DUP 5 -#define PHY_TXC1_MODE_SHIFT 3 -#define PHY_TXC1_MODE_MASK 0x0038 -#define PHY_TXC1_MODE_SISO 0 -#define PHY_TXC1_MODE_CDD 1 -#define PHY_TXC1_MODE_STBC 2 -#define PHY_TXC1_MODE_SDM 3 - -/* PhyTxControl for HTphy that are different from Mimophy */ -#define PHY_TXC_HTANT_MASK 0x3fC0 /* bits 6-13 */ - -/* XtraFrameTypes */ -#define XFTS_RTS_FT_SHIFT 2 -#define XFTS_FBRRTS_FT_SHIFT 4 -#define XFTS_CHANNEL_SHIFT 8 - -/* Antenna diversity bit in ant_wr_settle */ -#define PHY_AWS_ANTDIV 0x2000 - -/* IFS ctl */ -#define IFS_USEEDCF (1 << 2) - -/* IFS ctl1 */ -#define IFS_CTL1_EDCRS (1 << 3) -#define IFS_CTL1_EDCRS_20L (1 << 4) -#define IFS_CTL1_EDCRS_40 (1 << 5) - -/* ABI_MimoAntSel */ -#define ABI_MAS_ADDR_BMP_IDX_MASK 0x0f00 -#define ABI_MAS_ADDR_BMP_IDX_SHIFT 8 -#define ABI_MAS_FBR_ANT_PTN_MASK 0x00f0 -#define ABI_MAS_FBR_ANT_PTN_SHIFT 4 -#define ABI_MAS_MRT_ANT_PTN_MASK 0x000f - -/* tx status packet */ -struct tx_status { - u16 framelen; - u16 PAD; - u16 frameid; - u16 status; - u16 lasttxtime; - u16 sequence; - u16 phyerr; - u16 ackphyrxsh; -} __packed; - -#define TXSTATUS_LEN 16 - -/* status field bit definitions */ -#define TX_STATUS_FRM_RTX_MASK 0xF000 -#define TX_STATUS_FRM_RTX_SHIFT 12 -#define TX_STATUS_RTS_RTX_MASK 0x0F00 -#define TX_STATUS_RTS_RTX_SHIFT 8 -#define TX_STATUS_MASK 0x00FE -#define TX_STATUS_PMINDCTD (1 << 7) /* PM mode indicated to AP */ -#define TX_STATUS_INTERMEDIATE (1 << 6) /* intermediate or 1st ampdu pkg */ -#define TX_STATUS_AMPDU (1 << 5) /* AMPDU status */ -#define TX_STATUS_SUPR_MASK 0x1C /* suppress status bits (4:2) */ -#define TX_STATUS_SUPR_SHIFT 2 -#define TX_STATUS_ACK_RCV (1 << 1) /* ACK received */ -#define TX_STATUS_VALID (1 << 0) /* Tx status valid */ -#define TX_STATUS_NO_ACK 0 - -/* suppress status reason codes */ -#define TX_STATUS_SUPR_PMQ (1 << 2) /* PMQ entry */ -#define TX_STATUS_SUPR_FLUSH (2 << 2) /* flush request */ -#define TX_STATUS_SUPR_FRAG (3 << 2) /* previous frag failure */ -#define TX_STATUS_SUPR_TBTT (3 << 2) /* SHARED: Probe resp supr for TBTT */ -#define TX_STATUS_SUPR_BADCH (4 << 2) /* channel mismatch */ -#define TX_STATUS_SUPR_EXPTIME (5 << 2) /* lifetime expiry */ -#define TX_STATUS_SUPR_UF (6 << 2) /* underflow */ - -/* Unexpected tx status for rate update */ -#define TX_STATUS_UNEXP(status) \ - ((((status) & TX_STATUS_INTERMEDIATE) != 0) && \ - TX_STATUS_UNEXP_AMPDU(status)) - -/* Unexpected tx status for A-MPDU rate update */ -#define TX_STATUS_UNEXP_AMPDU(status) \ - ((((status) & TX_STATUS_SUPR_MASK) != 0) && \ - (((status) & TX_STATUS_SUPR_MASK) != TX_STATUS_SUPR_EXPTIME)) - -#define TX_STATUS_BA_BMAP03_MASK 0xF000 /* ba bitmap 0:3 in 1st pkg */ -#define TX_STATUS_BA_BMAP03_SHIFT 12 /* ba bitmap 0:3 in 1st pkg */ -#define TX_STATUS_BA_BMAP47_MASK 0x001E /* ba bitmap 4:7 in 2nd pkg */ -#define TX_STATUS_BA_BMAP47_SHIFT 3 /* ba bitmap 4:7 in 2nd pkg */ - -/* RXE (Receive Engine) */ - -/* RCM_CTL */ -#define RCM_INC_MASK_H 0x0080 -#define RCM_INC_MASK_L 0x0040 -#define RCM_INC_DATA 0x0020 -#define RCM_INDEX_MASK 0x001F -#define RCM_SIZE 15 - -#define RCM_MAC_OFFSET 0 /* current MAC address */ -#define RCM_BSSID_OFFSET 3 /* current BSSID address */ -#define RCM_F_BSSID_0_OFFSET 6 /* foreign BSS CFP tracking */ -#define RCM_F_BSSID_1_OFFSET 9 /* foreign BSS CFP tracking */ -#define RCM_F_BSSID_2_OFFSET 12 /* foreign BSS CFP tracking */ - -#define RCM_WEP_TA0_OFFSET 16 -#define RCM_WEP_TA1_OFFSET 19 -#define RCM_WEP_TA2_OFFSET 22 -#define RCM_WEP_TA3_OFFSET 25 - -/* PSM Block */ - -/* psm_phy_hdr_param bits */ -#define MAC_PHY_RESET 1 -#define MAC_PHY_CLOCK_EN 2 -#define MAC_PHY_FORCE_CLK 4 - -/* WEP Block */ - -/* WEP_WKEY */ -#define WKEY_START (1 << 8) -#define WKEY_SEL_MASK 0x1F - -/* WEP data formats */ - -/* the number of RCMTA entries */ -#define RCMTA_SIZE 50 - -#define M_ADDR_BMP_BLK (0x37e * 2) -#define M_ADDR_BMP_BLK_SZ 12 - -#define ADDR_BMP_RA (1 << 0) /* Receiver Address (RA) */ -#define ADDR_BMP_TA (1 << 1) /* Transmitter Address (TA) */ -#define ADDR_BMP_BSSID (1 << 2) /* BSSID */ -#define ADDR_BMP_AP (1 << 3) /* Infra-BSS Access Point */ -#define ADDR_BMP_STA (1 << 4) /* Infra-BSS Station */ -#define ADDR_BMP_RESERVED1 (1 << 5) -#define ADDR_BMP_RESERVED2 (1 << 6) -#define ADDR_BMP_RESERVED3 (1 << 7) -#define ADDR_BMP_BSS_IDX_MASK (3 << 8) /* BSS control block index */ -#define ADDR_BMP_BSS_IDX_SHIFT 8 - -#define WSEC_MAX_RCMTA_KEYS 54 - -/* max keys in M_TKMICKEYS_BLK */ -#define WSEC_MAX_TKMIC_ENGINE_KEYS 12 /* 8 + 4 default */ - -/* max RXE match registers */ -#define WSEC_MAX_RXE_KEYS 4 - -/* SECKINDXALGO (Security Key Index & Algorithm Block) word format */ -/* SKL (Security Key Lookup) */ -#define SKL_ALGO_MASK 0x0007 -#define SKL_ALGO_SHIFT 0 -#define SKL_KEYID_MASK 0x0008 -#define SKL_KEYID_SHIFT 3 -#define SKL_INDEX_MASK 0x03F0 -#define SKL_INDEX_SHIFT 4 -#define SKL_GRP_ALGO_MASK 0x1c00 -#define SKL_GRP_ALGO_SHIFT 10 - -/* additional bits defined for IBSS group key support */ -#define SKL_IBSS_INDEX_MASK 0x01F0 -#define SKL_IBSS_INDEX_SHIFT 4 -#define SKL_IBSS_KEYID1_MASK 0x0600 -#define SKL_IBSS_KEYID1_SHIFT 9 -#define SKL_IBSS_KEYID2_MASK 0x1800 -#define SKL_IBSS_KEYID2_SHIFT 11 -#define SKL_IBSS_KEYALGO_MASK 0xE000 -#define SKL_IBSS_KEYALGO_SHIFT 13 - -#define WSEC_MODE_OFF 0 -#define WSEC_MODE_HW 1 -#define WSEC_MODE_SW 2 - -#define WSEC_ALGO_OFF 0 -#define WSEC_ALGO_WEP1 1 -#define WSEC_ALGO_TKIP 2 -#define WSEC_ALGO_AES 3 -#define WSEC_ALGO_WEP128 4 -#define WSEC_ALGO_AES_LEGACY 5 -#define WSEC_ALGO_NALG 6 - -#define AES_MODE_NONE 0 -#define AES_MODE_CCM 1 - -/* WEP_CTL (Rev 0) */ -#define WECR0_KEYREG_SHIFT 0 -#define WECR0_KEYREG_MASK 0x7 -#define WECR0_DECRYPT (1 << 3) -#define WECR0_IVINLINE (1 << 4) -#define WECR0_WEPALG_SHIFT 5 -#define WECR0_WEPALG_MASK (0x7 << 5) -#define WECR0_WKEYSEL_SHIFT 8 -#define WECR0_WKEYSEL_MASK (0x7 << 8) -#define WECR0_WKEYSTART (1 << 11) -#define WECR0_WEPINIT (1 << 14) -#define WECR0_ICVERR (1 << 15) - -/* Frame template map byte offsets */ -#define T_ACTS_TPL_BASE (0) -#define T_NULL_TPL_BASE (0xc * 2) -#define T_QNULL_TPL_BASE (0x1c * 2) -#define T_RR_TPL_BASE (0x2c * 2) -#define T_BCN0_TPL_BASE (0x34 * 2) -#define T_PRS_TPL_BASE (0x134 * 2) -#define T_BCN1_TPL_BASE (0x234 * 2) -#define T_TX_FIFO_TXRAM_BASE (T_ACTS_TPL_BASE + \ - (TXFIFO_START_BLK * TXFIFO_SIZE_UNIT)) - -#define T_BA_TPL_BASE T_QNULL_TPL_BASE /* template area for BA */ - -#define T_RAM_ACCESS_SZ 4 /* template ram is 4 byte access only */ - -/* Shared Mem byte offsets */ - -/* Location where the ucode expects the corerev */ -#define M_MACHW_VER (0x00b * 2) - -/* Location where the ucode expects the MAC capabilities */ -#define M_MACHW_CAP_L (0x060 * 2) -#define M_MACHW_CAP_H (0x061 * 2) - -/* WME shared memory */ -#define M_EDCF_STATUS_OFF (0x007 * 2) -#define M_TXF_CUR_INDEX (0x018 * 2) -#define M_EDCF_QINFO (0x120 * 2) - -/* PS-mode related parameters */ -#define M_DOT11_SLOT (0x008 * 2) -#define M_DOT11_DTIMPERIOD (0x009 * 2) -#define M_NOSLPZNATDTIM (0x026 * 2) - -/* Beacon-related parameters */ -#define M_BCN0_FRM_BYTESZ (0x00c * 2) /* Bcn 0 template length */ -#define M_BCN1_FRM_BYTESZ (0x00d * 2) /* Bcn 1 template length */ -#define M_BCN_TXTSF_OFFSET (0x00e * 2) -#define M_TIMBPOS_INBEACON (0x00f * 2) -#define M_SFRMTXCNTFBRTHSD (0x022 * 2) -#define M_LFRMTXCNTFBRTHSD (0x023 * 2) -#define M_BCN_PCTLWD (0x02a * 2) -#define M_BCN_LI (0x05b * 2) /* beacon listen interval */ - -/* MAX Rx Frame len */ -#define M_MAXRXFRM_LEN (0x010 * 2) - -/* ACK/CTS related params */ -#define M_RSP_PCTLWD (0x011 * 2) - -/* Hardware Power Control */ -#define M_TXPWR_N (0x012 * 2) -#define M_TXPWR_TARGET (0x013 * 2) -#define M_TXPWR_MAX (0x014 * 2) -#define M_TXPWR_CUR (0x019 * 2) - -/* Rx-related parameters */ -#define M_RX_PAD_DATA_OFFSET (0x01a * 2) - -/* WEP Shared mem data */ -#define M_SEC_DEFIVLOC (0x01e * 2) -#define M_SEC_VALNUMSOFTMCHTA (0x01f * 2) -#define M_PHYVER (0x028 * 2) -#define M_PHYTYPE (0x029 * 2) -#define M_SECRXKEYS_PTR (0x02b * 2) -#define M_TKMICKEYS_PTR (0x059 * 2) -#define M_SECKINDXALGO_BLK (0x2ea * 2) -#define M_SECKINDXALGO_BLK_SZ 54 -#define M_SECPSMRXTAMCH_BLK (0x2fa * 2) -#define M_TKIP_TSC_TTAK (0x18c * 2) -#define D11_MAX_KEY_SIZE 16 - -#define M_MAX_ANTCNT (0x02e * 2) /* antenna swap threshold */ - -/* Probe response related parameters */ -#define M_SSIDLEN (0x024 * 2) -#define M_PRB_RESP_FRM_LEN (0x025 * 2) -#define M_PRS_MAXTIME (0x03a * 2) -#define M_SSID (0xb0 * 2) -#define M_CTXPRS_BLK (0xc0 * 2) -#define C_CTX_PCTLWD_POS (0x4 * 2) - -/* Delta between OFDM and CCK power in CCK power boost mode */ -#define M_OFDM_OFFSET (0x027 * 2) - -/* TSSI for last 4 11b/g CCK packets transmitted */ -#define M_B_TSSI_0 (0x02c * 2) -#define M_B_TSSI_1 (0x02d * 2) - -/* Host flags to turn on ucode options */ -#define M_HOST_FLAGS1 (0x02f * 2) -#define M_HOST_FLAGS2 (0x030 * 2) -#define M_HOST_FLAGS3 (0x031 * 2) -#define M_HOST_FLAGS4 (0x03c * 2) -#define M_HOST_FLAGS5 (0x06a * 2) -#define M_HOST_FLAGS_SZ 16 - -#define M_RADAR_REG (0x033 * 2) - -/* TSSI for last 4 11a OFDM packets transmitted */ -#define M_A_TSSI_0 (0x034 * 2) -#define M_A_TSSI_1 (0x035 * 2) - -/* noise interference measurement */ -#define M_NOISE_IF_COUNT (0x034 * 2) -#define M_NOISE_IF_TIMEOUT (0x035 * 2) - -#define M_RF_RX_SP_REG1 (0x036 * 2) - -/* TSSI for last 4 11g OFDM packets transmitted */ -#define M_G_TSSI_0 (0x038 * 2) -#define M_G_TSSI_1 (0x039 * 2) - -/* Background noise measure */ -#define M_JSSI_0 (0x44 * 2) -#define M_JSSI_1 (0x45 * 2) -#define M_JSSI_AUX (0x46 * 2) - -#define M_CUR_2050_RADIOCODE (0x47 * 2) - -/* TX fifo sizes */ -#define M_FIFOSIZE0 (0x4c * 2) -#define M_FIFOSIZE1 (0x4d * 2) -#define M_FIFOSIZE2 (0x4e * 2) -#define M_FIFOSIZE3 (0x4f * 2) -#define D11_MAX_TX_FRMS 32 /* max frames allowed in tx fifo */ - -/* Current channel number plus upper bits */ -#define M_CURCHANNEL (0x50 * 2) -#define D11_CURCHANNEL_5G 0x0100; -#define D11_CURCHANNEL_40 0x0200; -#define D11_CURCHANNEL_MAX 0x00FF; - -/* last posted frameid on the bcmc fifo */ -#define M_BCMC_FID (0x54 * 2) -#define INVALIDFID 0xffff - -/* extended beacon phyctl bytes for 11N */ -#define M_BCN_PCTL1WD (0x058 * 2) - -/* idle busy ratio to duty_cycle requirement */ -#define M_TX_IDLE_BUSY_RATIO_X_16_CCK (0x52 * 2) -#define M_TX_IDLE_BUSY_RATIO_X_16_OFDM (0x5A * 2) - -/* CW RSSI for LCNPHY */ -#define M_LCN_RSSI_0 0x1332 -#define M_LCN_RSSI_1 0x1338 -#define M_LCN_RSSI_2 0x133e -#define M_LCN_RSSI_3 0x1344 - -/* SNR for LCNPHY */ -#define M_LCN_SNR_A_0 0x1334 -#define M_LCN_SNR_B_0 0x1336 - -#define M_LCN_SNR_A_1 0x133a -#define M_LCN_SNR_B_1 0x133c - -#define M_LCN_SNR_A_2 0x1340 -#define M_LCN_SNR_B_2 0x1342 - -#define M_LCN_SNR_A_3 0x1346 -#define M_LCN_SNR_B_3 0x1348 - -#define M_LCN_LAST_RESET (81*2) -#define M_LCN_LAST_LOC (63*2) -#define M_LCNPHY_RESET_STATUS (4902) -#define M_LCNPHY_DSC_TIME (0x98d*2) -#define M_LCNPHY_RESET_CNT_DSC (0x98b*2) -#define M_LCNPHY_RESET_CNT (0x98c*2) - -/* Rate table offsets */ -#define M_RT_DIRMAP_A (0xe0 * 2) -#define M_RT_BBRSMAP_A (0xf0 * 2) -#define M_RT_DIRMAP_B (0x100 * 2) -#define M_RT_BBRSMAP_B (0x110 * 2) - -/* Rate table entry offsets */ -#define M_RT_PRS_PLCP_POS 10 -#define M_RT_PRS_DUR_POS 16 -#define M_RT_OFDM_PCTL1_POS 18 - -#define M_20IN40_IQ (0x380 * 2) - -/* SHM locations where ucode stores the current power index */ -#define M_CURR_IDX1 (0x384 * 2) -#define M_CURR_IDX2 (0x387 * 2) - -#define M_BSCALE_ANT0 (0x5e * 2) -#define M_BSCALE_ANT1 (0x5f * 2) - -/* Antenna Diversity Testing */ -#define M_MIMO_ANTSEL_RXDFLT (0x63 * 2) -#define M_ANTSEL_CLKDIV (0x61 * 2) -#define M_MIMO_ANTSEL_TXDFLT (0x64 * 2) - -#define M_MIMO_MAXSYM (0x5d * 2) -#define MIMO_MAXSYM_DEF 0x8000 /* 32k */ -#define MIMO_MAXSYM_MAX 0xffff /* 64k */ - -#define M_WATCHDOG_8TU (0x1e * 2) -#define WATCHDOG_8TU_DEF 5 -#define WATCHDOG_8TU_MAX 10 - -/* Manufacturing Test Variables */ -/* PER test mode */ -#define M_PKTENG_CTRL (0x6c * 2) -/* IFS for TX mode */ -#define M_PKTENG_IFS (0x6d * 2) -/* Lower word of tx frmcnt/rx lostcnt */ -#define M_PKTENG_FRMCNT_LO (0x6e * 2) -/* Upper word of tx frmcnt/rx lostcnt */ -#define M_PKTENG_FRMCNT_HI (0x6f * 2) - -/* Index variation in vbat ripple */ -#define M_LCN_PWR_IDX_MAX (0x67 * 2) /* highest index read by ucode */ -#define M_LCN_PWR_IDX_MIN (0x66 * 2) /* lowest index read by ucode */ - -/* M_PKTENG_CTRL bit definitions */ -#define M_PKTENG_MODE_TX 0x0001 -#define M_PKTENG_MODE_TX_RIFS 0x0004 -#define M_PKTENG_MODE_TX_CTS 0x0008 -#define M_PKTENG_MODE_RX 0x0002 -#define M_PKTENG_MODE_RX_WITH_ACK 0x0402 -#define M_PKTENG_MODE_MASK 0x0003 -/* TX frames indicated in the frmcnt reg */ -#define M_PKTENG_FRMCNT_VLD 0x0100 - -/* Sample Collect parameters (bitmap and type) */ -/* Trigger bitmap for sample collect */ -#define M_SMPL_COL_BMP (0x37d * 2) -/* Sample collect type */ -#define M_SMPL_COL_CTL (0x3b2 * 2) - -#define ANTSEL_CLKDIV_4MHZ 6 -#define MIMO_ANTSEL_BUSY 0x4000 /* bit 14 (busy) */ -#define MIMO_ANTSEL_SEL 0x8000 /* bit 15 write the value */ -#define MIMO_ANTSEL_WAIT 50 /* 50us wait */ -#define MIMO_ANTSEL_OVERRIDE 0x8000 /* flag */ - -struct shm_acparams { - u16 txop; - u16 cwmin; - u16 cwmax; - u16 cwcur; - u16 aifs; - u16 bslots; - u16 reggap; - u16 status; - u16 rsvd[8]; -} __packed; -#define M_EDCF_QLEN (16 * 2) - -#define WME_STATUS_NEWAC (1 << 8) - -/* M_HOST_FLAGS */ -#define MHFMAX 5 /* Number of valid hostflag half-word (u16) */ -#define MHF1 0 /* Hostflag 1 index */ -#define MHF2 1 /* Hostflag 2 index */ -#define MHF3 2 /* Hostflag 3 index */ -#define MHF4 3 /* Hostflag 4 index */ -#define MHF5 4 /* Hostflag 5 index */ - -/* Flags in M_HOST_FLAGS */ -/* Enable ucode antenna diversity help */ -#define MHF1_ANTDIV 0x0001 -/* Enable EDCF access control */ -#define MHF1_EDCF 0x0100 -#define MHF1_IQSWAP_WAR 0x0200 -/* Disable Slow clock request, for corerev < 11 */ -#define MHF1_FORCEFASTCLK 0x0400 - -/* Flags in M_HOST_FLAGS2 */ - -/* Flush BCMC FIFO immediately */ -#define MHF2_TXBCMC_NOW 0x0040 -/* Enable ucode/hw power control */ -#define MHF2_HWPWRCTL 0x0080 -#define MHF2_NPHY40MHZ_WAR 0x0800 - -/* Flags in M_HOST_FLAGS3 */ -/* enabled mimo antenna selection */ -#define MHF3_ANTSEL_EN 0x0001 -/* antenna selection mode: 0: 2x3, 1: 2x4 */ -#define MHF3_ANTSEL_MODE 0x0002 -#define MHF3_RESERVED1 0x0004 -#define MHF3_RESERVED2 0x0008 -#define MHF3_NPHY_MLADV_WAR 0x0010 - -/* Flags in M_HOST_FLAGS4 */ -/* force bphy Tx on core 0 (board level WAR) */ -#define MHF4_BPHY_TXCORE0 0x0080 -/* for 4313A0 FEM boards */ -#define MHF4_EXTPA_ENABLE 0x4000 - -/* Flags in M_HOST_FLAGS5 */ -#define MHF5_4313_GPIOCTRL 0x0001 -#define MHF5_RESERVED1 0x0002 -#define MHF5_RESERVED2 0x0004 -/* Radio power setting for ucode */ -#define M_RADIO_PWR (0x32 * 2) - -/* phy noise recorded by ucode right after tx */ -#define M_PHY_NOISE (0x037 * 2) -#define PHY_NOISE_MASK 0x00ff - -/* - * Receive Frame Data Header for 802.11b DCF-only frames - * - * RxFrameSize: Actual byte length of the frame data received - * PAD: padding (not used) - * PhyRxStatus_0: PhyRxStatus 15:0 - * PhyRxStatus_1: PhyRxStatus 31:16 - * PhyRxStatus_2: PhyRxStatus 47:32 - * PhyRxStatus_3: PhyRxStatus 63:48 - * PhyRxStatus_4: PhyRxStatus 79:64 - * PhyRxStatus_5: PhyRxStatus 95:80 - * RxStatus1: MAC Rx Status - * RxStatus2: extended MAC Rx status - * RxTSFTime: RxTSFTime time of first MAC symbol + M_PHY_PLCPRX_DLY - * RxChan: gain code, channel radio code, and phy type - */ -struct d11rxhdr_le { - __le16 RxFrameSize; - u16 PAD; - __le16 PhyRxStatus_0; - __le16 PhyRxStatus_1; - __le16 PhyRxStatus_2; - __le16 PhyRxStatus_3; - __le16 PhyRxStatus_4; - __le16 PhyRxStatus_5; - __le16 RxStatus1; - __le16 RxStatus2; - __le16 RxTSFTime; - __le16 RxChan; -} __packed; - -struct d11rxhdr { - u16 RxFrameSize; - u16 PAD; - u16 PhyRxStatus_0; - u16 PhyRxStatus_1; - u16 PhyRxStatus_2; - u16 PhyRxStatus_3; - u16 PhyRxStatus_4; - u16 PhyRxStatus_5; - u16 RxStatus1; - u16 RxStatus2; - u16 RxTSFTime; - u16 RxChan; -} __packed; - -/* PhyRxStatus_0: */ -/* NPHY only: CCK, OFDM, preN, N */ -#define PRXS0_FT_MASK 0x0003 -/* NPHY only: clip count adjustment steps by AGC */ -#define PRXS0_CLIP_MASK 0x000C -#define PRXS0_CLIP_SHIFT 2 -/* PHY received a frame with unsupported rate */ -#define PRXS0_UNSRATE 0x0010 -/* GPHY: rx ant, NPHY: upper sideband */ -#define PRXS0_RXANT_UPSUBBAND 0x0020 -/* CCK frame only: lost crs during cck frame reception */ -#define PRXS0_LCRS 0x0040 -/* Short Preamble */ -#define PRXS0_SHORTH 0x0080 -/* PLCP violation */ -#define PRXS0_PLCPFV 0x0100 -/* PLCP header integrity check failed */ -#define PRXS0_PLCPHCF 0x0200 -/* legacy PHY gain control */ -#define PRXS0_GAIN_CTL 0x4000 -/* NPHY: Antennas used for received frame, bitmask */ -#define PRXS0_ANTSEL_MASK 0xF000 -#define PRXS0_ANTSEL_SHIFT 0x12 - -/* subfield PRXS0_FT_MASK */ -#define PRXS0_CCK 0x0000 -/* valid only for G phy, use rxh->RxChan for A phy */ -#define PRXS0_OFDM 0x0001 -#define PRXS0_PREN 0x0002 -#define PRXS0_STDN 0x0003 - -/* subfield PRXS0_ANTSEL_MASK */ -#define PRXS0_ANTSEL_0 0x0 /* antenna 0 is used */ -#define PRXS0_ANTSEL_1 0x2 /* antenna 1 is used */ -#define PRXS0_ANTSEL_2 0x4 /* antenna 2 is used */ -#define PRXS0_ANTSEL_3 0x8 /* antenna 3 is used */ - -/* PhyRxStatus_1: */ -#define PRXS1_JSSI_MASK 0x00FF -#define PRXS1_JSSI_SHIFT 0 -#define PRXS1_SQ_MASK 0xFF00 -#define PRXS1_SQ_SHIFT 8 - -/* nphy PhyRxStatus_1: */ -#define PRXS1_nphy_PWR0_MASK 0x00FF -#define PRXS1_nphy_PWR1_MASK 0xFF00 - -/* HTPHY Rx Status defines */ -/* htphy PhyRxStatus_0: those bit are overlapped with PhyRxStatus_0 */ -#define PRXS0_BAND 0x0400 /* 0 = 2.4G, 1 = 5G */ -#define PRXS0_RSVD 0x0800 /* reserved; set to 0 */ -#define PRXS0_UNUSED 0xF000 /* unused and not defined; set to 0 */ - -/* htphy PhyRxStatus_1: */ -/* core enables for {3..0}, 0=disabled, 1=enabled */ -#define PRXS1_HTPHY_CORE_MASK 0x000F -/* antenna configation */ -#define PRXS1_HTPHY_ANTCFG_MASK 0x00F0 -/* Mixmode PLCP Length low byte mask */ -#define PRXS1_HTPHY_MMPLCPLenL_MASK 0xFF00 - -/* htphy PhyRxStatus_2: */ -/* Mixmode PLCP Length high byte maskw */ -#define PRXS2_HTPHY_MMPLCPLenH_MASK 0x000F -/* Mixmode PLCP rate mask */ -#define PRXS2_HTPHY_MMPLCH_RATE_MASK 0x00F0 -/* Rx power on core 0 */ -#define PRXS2_HTPHY_RXPWR_ANT0 0xFF00 - -/* htphy PhyRxStatus_3: */ -/* Rx power on core 1 */ -#define PRXS3_HTPHY_RXPWR_ANT1 0x00FF -/* Rx power on core 2 */ -#define PRXS3_HTPHY_RXPWR_ANT2 0xFF00 - -/* htphy PhyRxStatus_4: */ -/* Rx power on core 3 */ -#define PRXS4_HTPHY_RXPWR_ANT3 0x00FF -/* Coarse frequency offset */ -#define PRXS4_HTPHY_CFO 0xFF00 - -/* htphy PhyRxStatus_5: */ -/* Fine frequency offset */ -#define PRXS5_HTPHY_FFO 0x00FF -/* Advance Retard */ -#define PRXS5_HTPHY_AR 0xFF00 - -#define HTPHY_MMPLCPLen(rxs) \ - ((((rxs)->PhyRxStatus_1 & PRXS1_HTPHY_MMPLCPLenL_MASK) >> 8) | \ - (((rxs)->PhyRxStatus_2 & PRXS2_HTPHY_MMPLCPLenH_MASK) << 8)) -/* Get Rx power on core 0 */ -#define HTPHY_RXPWR_ANT0(rxs) \ - ((((rxs)->PhyRxStatus_2) & PRXS2_HTPHY_RXPWR_ANT0) >> 8) -/* Get Rx power on core 1 */ -#define HTPHY_RXPWR_ANT1(rxs) \ - (((rxs)->PhyRxStatus_3) & PRXS3_HTPHY_RXPWR_ANT1) -/* Get Rx power on core 2 */ -#define HTPHY_RXPWR_ANT2(rxs) \ - ((((rxs)->PhyRxStatus_3) & PRXS3_HTPHY_RXPWR_ANT2) >> 8) - -/* ucode RxStatus1: */ -#define RXS_BCNSENT 0x8000 -#define RXS_SECKINDX_MASK 0x07e0 -#define RXS_SECKINDX_SHIFT 5 -#define RXS_DECERR (1 << 4) -#define RXS_DECATMPT (1 << 3) -/* PAD bytes to make IP data 4 bytes aligned */ -#define RXS_PBPRES (1 << 2) -#define RXS_RESPFRAMETX (1 << 1) -#define RXS_FCSERR (1 << 0) - -/* ucode RxStatus2: */ -#define RXS_AMSDU_MASK 1 -#define RXS_AGGTYPE_MASK 0x6 -#define RXS_AGGTYPE_SHIFT 1 -#define RXS_PHYRXST_VALID (1 << 8) -#define RXS_RXANT_MASK 0x3 -#define RXS_RXANT_SHIFT 12 - -/* RxChan */ -#define RXS_CHAN_40 0x1000 -#define RXS_CHAN_5G 0x0800 -#define RXS_CHAN_ID_MASK 0x07f8 -#define RXS_CHAN_ID_SHIFT 3 -#define RXS_CHAN_PHYTYPE_MASK 0x0007 -#define RXS_CHAN_PHYTYPE_SHIFT 0 - -/* Index of attenuations used during ucode power control. */ -#define M_PWRIND_BLKS (0x184 * 2) -#define M_PWRIND_MAP0 (M_PWRIND_BLKS + 0x0) -#define M_PWRIND_MAP1 (M_PWRIND_BLKS + 0x2) -#define M_PWRIND_MAP2 (M_PWRIND_BLKS + 0x4) -#define M_PWRIND_MAP3 (M_PWRIND_BLKS + 0x6) -/* M_PWRIND_MAP(core) macro */ -#define M_PWRIND_MAP(core) (M_PWRIND_BLKS + ((core)<<1)) - -/* PSM SHM variable offsets */ -#define M_PSM_SOFT_REGS 0x0 -#define M_BOM_REV_MAJOR (M_PSM_SOFT_REGS + 0x0) -#define M_BOM_REV_MINOR (M_PSM_SOFT_REGS + 0x2) -#define M_UCODE_DBGST (M_PSM_SOFT_REGS + 0x40) /* ucode debug status code */ -#define M_UCODE_MACSTAT (M_PSM_SOFT_REGS + 0xE0) /* macstat counters */ - -#define M_AGING_THRSH (0x3e * 2) /* max time waiting for medium before tx */ -#define M_MBURST_SIZE (0x40 * 2) /* max frames in a frameburst */ -#define M_MBURST_TXOP (0x41 * 2) /* max frameburst TXOP in unit of us */ -#define M_SYNTHPU_DLY (0x4a * 2) /* pre-wakeup for synthpu, default: 500 */ -#define M_PRETBTT (0x4b * 2) - -/* offset to the target txpwr */ -#define M_ALT_TXPWR_IDX (M_PSM_SOFT_REGS + (0x3b * 2)) -#define M_PHY_TX_FLT_PTR (M_PSM_SOFT_REGS + (0x3d * 2)) -#define M_CTS_DURATION (M_PSM_SOFT_REGS + (0x5c * 2)) -#define M_LP_RCCAL_OVR (M_PSM_SOFT_REGS + (0x6b * 2)) - -/* PKTENG Rx Stats Block */ -#define M_RXSTATS_BLK_PTR (M_PSM_SOFT_REGS + (0x65 * 2)) - -/* ucode debug status codes */ -/* not valid really */ -#define DBGST_INACTIVE 0 -/* after zeroing SHM, before suspending at init */ -#define DBGST_INIT 1 -/* "normal" state */ -#define DBGST_ACTIVE 2 -/* suspended */ -#define DBGST_SUSPENDED 3 -/* asleep (PS mode) */ -#define DBGST_ASLEEP 4 - -/* Scratch Reg defs */ -enum _ePsmScratchPadRegDefinitions { - S_RSV0 = 0, - S_RSV1, - S_RSV2, - - /* offset 0x03: scratch registers for Dot11-contants */ - S_DOT11_CWMIN, /* CW-minimum */ - S_DOT11_CWMAX, /* CW-maximum */ - S_DOT11_CWCUR, /* CW-current */ - S_DOT11_SRC_LMT, /* short retry count limit */ - S_DOT11_LRC_LMT, /* long retry count limit */ - S_DOT11_DTIMCOUNT, /* DTIM-count */ - - /* offset 0x09: Tx-side scratch registers */ - S_SEQ_NUM, /* hardware sequence number reg */ - S_SEQ_NUM_FRAG, /* seq num for frags (at the start of MSDU) */ - S_FRMRETX_CNT, /* frame retx count */ - S_SSRC, /* Station short retry count */ - S_SLRC, /* Station long retry count */ - S_EXP_RSP, /* Expected response frame */ - S_OLD_BREM, /* Remaining backoff ctr */ - S_OLD_CWWIN, /* saved-off CW-cur */ - S_TXECTL, /* TXE-Ctl word constructed in scr-pad */ - S_CTXTST, /* frm type-subtype as read from Tx-descr */ - - /* offset 0x13: Rx-side scratch registers */ - S_RXTST, /* Type and subtype in Rxframe */ - - /* Global state register */ - S_STREG, /* state storage actual bit maps below */ - - S_TXPWR_SUM, /* Tx power control: accumulator */ - S_TXPWR_ITER, /* Tx power control: iteration */ - S_RX_FRMTYPE, /* Rate and PHY type for frames */ - S_THIS_AGG, /* Size of this AGG (A-MSDU) */ - - S_KEYINDX, - S_RXFRMLEN, /* Receive MPDU length in bytes */ - - /* offset 0x1B: Receive TSF time stored in SCR */ - S_RXTSFTMRVAL_WD3, /* TSF value at the start of rx */ - S_RXTSFTMRVAL_WD2, /* TSF value at the start of rx */ - S_RXTSFTMRVAL_WD1, /* TSF value at the start of rx */ - S_RXTSFTMRVAL_WD0, /* TSF value at the start of rx */ - S_RXSSN, /* Received start seq number for A-MPDU BA */ - S_RXQOSFLD, /* Rx-QoS field (if present) */ - - /* offset 0x21: Scratch pad regs used in microcode as temp storage */ - S_TMP0, /* stmp0 */ - S_TMP1, /* stmp1 */ - S_TMP2, /* stmp2 */ - S_TMP3, /* stmp3 */ - S_TMP4, /* stmp4 */ - S_TMP5, /* stmp5 */ - S_PRQPENALTY_CTR, /* Probe response queue penalty counter */ - S_ANTCNT, /* unsuccessful attempts on current ant. */ - S_SYMBOL, /* flag for possible symbol ctl frames */ - S_RXTP, /* rx frame type */ - S_STREG2, /* extra state storage */ - S_STREG3, /* even more extra state storage */ - S_STREG4, /* ... */ - S_STREG5, /* remember to initialize it to zero */ - - S_ADJPWR_IDX, - S_CUR_PTR, /* Temp pointer for A-MPDU re-Tx SHM table */ - S_REVID4, /* 0x33 */ - S_INDX, /* 0x34 */ - S_ADDR0, /* 0x35 */ - S_ADDR1, /* 0x36 */ - S_ADDR2, /* 0x37 */ - S_ADDR3, /* 0x38 */ - S_ADDR4, /* 0x39 */ - S_ADDR5, /* 0x3A */ - S_TMP6, /* 0x3B */ - S_KEYINDX_BU, /* Backup for Key index */ - S_MFGTEST_TMP0, /* Temp regs used for RX test calculations */ - S_RXESN, /* Received end sequence number for A-MPDU BA */ - S_STREG6, /* 0x3F */ -}; - -#define S_BEACON_INDX S_OLD_BREM -#define S_PRS_INDX S_OLD_CWWIN -#define S_PHYTYPE S_SSRC -#define S_PHYVER S_SLRC - -/* IHR SLOW_CTRL values */ -#define SLOW_CTRL_PDE (1 << 0) -#define SLOW_CTRL_FD (1 << 8) - -/* ucode mac statistic counters in shared memory */ -struct macstat { - u16 txallfrm; /* 0x80 */ - u16 txrtsfrm; /* 0x82 */ - u16 txctsfrm; /* 0x84 */ - u16 txackfrm; /* 0x86 */ - u16 txdnlfrm; /* 0x88 */ - u16 txbcnfrm; /* 0x8a */ - u16 txfunfl[8]; /* 0x8c - 0x9b */ - u16 txtplunfl; /* 0x9c */ - u16 txphyerr; /* 0x9e */ - u16 pktengrxducast; /* 0xa0 */ - u16 pktengrxdmcast; /* 0xa2 */ - u16 rxfrmtoolong; /* 0xa4 */ - u16 rxfrmtooshrt; /* 0xa6 */ - u16 rxinvmachdr; /* 0xa8 */ - u16 rxbadfcs; /* 0xaa */ - u16 rxbadplcp; /* 0xac */ - u16 rxcrsglitch; /* 0xae */ - u16 rxstrt; /* 0xb0 */ - u16 rxdfrmucastmbss; /* 0xb2 */ - u16 rxmfrmucastmbss; /* 0xb4 */ - u16 rxcfrmucast; /* 0xb6 */ - u16 rxrtsucast; /* 0xb8 */ - u16 rxctsucast; /* 0xba */ - u16 rxackucast; /* 0xbc */ - u16 rxdfrmocast; /* 0xbe */ - u16 rxmfrmocast; /* 0xc0 */ - u16 rxcfrmocast; /* 0xc2 */ - u16 rxrtsocast; /* 0xc4 */ - u16 rxctsocast; /* 0xc6 */ - u16 rxdfrmmcast; /* 0xc8 */ - u16 rxmfrmmcast; /* 0xca */ - u16 rxcfrmmcast; /* 0xcc */ - u16 rxbeaconmbss; /* 0xce */ - u16 rxdfrmucastobss; /* 0xd0 */ - u16 rxbeaconobss; /* 0xd2 */ - u16 rxrsptmout; /* 0xd4 */ - u16 bcntxcancl; /* 0xd6 */ - u16 PAD; - u16 rxf0ovfl; /* 0xda */ - u16 rxf1ovfl; /* 0xdc */ - u16 rxf2ovfl; /* 0xde */ - u16 txsfovfl; /* 0xe0 */ - u16 pmqovfl; /* 0xe2 */ - u16 rxcgprqfrm; /* 0xe4 */ - u16 rxcgprsqovfl; /* 0xe6 */ - u16 txcgprsfail; /* 0xe8 */ - u16 txcgprssuc; /* 0xea */ - u16 prs_timeout; /* 0xec */ - u16 rxnack; - u16 frmscons; - u16 txnack; - u16 txglitch_nack; - u16 txburst; /* 0xf6 # tx bursts */ - u16 bphy_rxcrsglitch; /* bphy rx crs glitch */ - u16 phywatchdog; /* 0xfa # of phy watchdog events */ - u16 PAD; - u16 bphy_badplcp; /* bphy bad plcp */ -}; - -/* dot11 core-specific control flags */ -#define SICF_PCLKE 0x0004 /* PHY clock enable */ -#define SICF_PRST 0x0008 /* PHY reset */ -#define SICF_MPCLKE 0x0010 /* MAC PHY clockcontrol enable */ -#define SICF_FREF 0x0020 /* PLL FreqRefSelect */ -/* NOTE: the following bw bits only apply when the core is attached - * to a NPHY - */ -#define SICF_BWMASK 0x00c0 /* phy clock mask (b6 & b7) */ -#define SICF_BW40 0x0080 /* 40MHz BW (160MHz phyclk) */ -#define SICF_BW20 0x0040 /* 20MHz BW (80MHz phyclk) */ -#define SICF_BW10 0x0000 /* 10MHz BW (40MHz phyclk) */ -#define SICF_GMODE 0x2000 /* gmode enable */ - -/* dot11 core-specific status flags */ -#define SISF_2G_PHY 0x0001 /* 2.4G capable phy */ -#define SISF_5G_PHY 0x0002 /* 5G capable phy */ -#define SISF_FCLKA 0x0004 /* FastClkAvailable */ -#define SISF_DB_PHY 0x0008 /* Dualband phy */ - -/* === End of MAC reg, Beginning of PHY(b/a/g/n) reg === */ -/* radio and LPPHY regs are separated */ - -#define BPHY_REG_OFT_BASE 0x0 -/* offsets for indirect access to bphy registers */ -#define BPHY_BB_CONFIG 0x01 -#define BPHY_ADCBIAS 0x02 -#define BPHY_ANACORE 0x03 -#define BPHY_PHYCRSTH 0x06 -#define BPHY_TEST 0x0a -#define BPHY_PA_TX_TO 0x10 -#define BPHY_SYNTH_DC_TO 0x11 -#define BPHY_PA_TX_TIME_UP 0x12 -#define BPHY_RX_FLTR_TIME_UP 0x13 -#define BPHY_TX_POWER_OVERRIDE 0x14 -#define BPHY_RF_OVERRIDE 0x15 -#define BPHY_RF_TR_LOOKUP1 0x16 -#define BPHY_RF_TR_LOOKUP2 0x17 -#define BPHY_COEFFS 0x18 -#define BPHY_PLL_OUT 0x19 -#define BPHY_REFRESH_MAIN 0x1a -#define BPHY_REFRESH_TO0 0x1b -#define BPHY_REFRESH_TO1 0x1c -#define BPHY_RSSI_TRESH 0x20 -#define BPHY_IQ_TRESH_HH 0x21 -#define BPHY_IQ_TRESH_H 0x22 -#define BPHY_IQ_TRESH_L 0x23 -#define BPHY_IQ_TRESH_LL 0x24 -#define BPHY_GAIN 0x25 -#define BPHY_LNA_GAIN_RANGE 0x26 -#define BPHY_JSSI 0x27 -#define BPHY_TSSI_CTL 0x28 -#define BPHY_TSSI 0x29 -#define BPHY_TR_LOSS_CTL 0x2a -#define BPHY_LO_LEAKAGE 0x2b -#define BPHY_LO_RSSI_ACC 0x2c -#define BPHY_LO_IQMAG_ACC 0x2d -#define BPHY_TX_DC_OFF1 0x2e -#define BPHY_TX_DC_OFF2 0x2f -#define BPHY_PEAK_CNT_THRESH 0x30 -#define BPHY_FREQ_OFFSET 0x31 -#define BPHY_DIVERSITY_CTL 0x32 -#define BPHY_PEAK_ENERGY_LO 0x33 -#define BPHY_PEAK_ENERGY_HI 0x34 -#define BPHY_SYNC_CTL 0x35 -#define BPHY_TX_PWR_CTRL 0x36 -#define BPHY_TX_EST_PWR 0x37 -#define BPHY_STEP 0x38 -#define BPHY_WARMUP 0x39 -#define BPHY_LMS_CFF_READ 0x3a -#define BPHY_LMS_COEFF_I 0x3b -#define BPHY_LMS_COEFF_Q 0x3c -#define BPHY_SIG_POW 0x3d -#define BPHY_RFDC_CANCEL_CTL 0x3e -#define BPHY_HDR_TYPE 0x40 -#define BPHY_SFD_TO 0x41 -#define BPHY_SFD_CTL 0x42 -#define BPHY_DEBUG 0x43 -#define BPHY_RX_DELAY_COMP 0x44 -#define BPHY_CRS_DROP_TO 0x45 -#define BPHY_SHORT_SFD_NZEROS 0x46 -#define BPHY_DSSS_COEFF1 0x48 -#define BPHY_DSSS_COEFF2 0x49 -#define BPHY_CCK_COEFF1 0x4a -#define BPHY_CCK_COEFF2 0x4b -#define BPHY_TR_CORR 0x4c -#define BPHY_ANGLE_SCALE 0x4d -#define BPHY_TX_PWR_BASE_IDX 0x4e -#define BPHY_OPTIONAL_MODES2 0x4f -#define BPHY_CCK_LMS_STEP 0x50 -#define BPHY_BYPASS 0x51 -#define BPHY_CCK_DELAY_LONG 0x52 -#define BPHY_CCK_DELAY_SHORT 0x53 -#define BPHY_PPROC_CHAN_DELAY 0x54 -#define BPHY_DDFS_ENABLE 0x58 -#define BPHY_PHASE_SCALE 0x59 -#define BPHY_FREQ_CONTROL 0x5a -#define BPHY_LNA_GAIN_RANGE_10 0x5b -#define BPHY_LNA_GAIN_RANGE_32 0x5c -#define BPHY_OPTIONAL_MODES 0x5d -#define BPHY_RX_STATUS2 0x5e -#define BPHY_RX_STATUS3 0x5f -#define BPHY_DAC_CONTROL 0x60 -#define BPHY_ANA11G_FILT_CTRL 0x62 -#define BPHY_REFRESH_CTRL 0x64 -#define BPHY_RF_OVERRIDE2 0x65 -#define BPHY_SPUR_CANCEL_CTRL 0x66 -#define BPHY_FINE_DIGIGAIN_CTRL 0x67 -#define BPHY_RSSI_LUT 0x88 -#define BPHY_RSSI_LUT_END 0xa7 -#define BPHY_TSSI_LUT 0xa8 -#define BPHY_TSSI_LUT_END 0xc7 -#define BPHY_TSSI2PWR_LUT 0x380 -#define BPHY_TSSI2PWR_LUT_END 0x39f -#define BPHY_LOCOMP_LUT 0x3a0 -#define BPHY_LOCOMP_LUT_END 0x3bf -#define BPHY_TXGAIN_LUT 0x3c0 -#define BPHY_TXGAIN_LUT_END 0x3ff - -/* Bits in BB_CONFIG: */ -#define PHY_BBC_ANT_MASK 0x0180 -#define PHY_BBC_ANT_SHIFT 7 -#define BB_DARWIN 0x1000 -#define BBCFG_RESETCCA 0x4000 -#define BBCFG_RESETRX 0x8000 - -/* Bits in phytest(0x0a): */ -#define TST_DDFS 0x2000 -#define TST_TXFILT1 0x0800 -#define TST_UNSCRAM 0x0400 -#define TST_CARR_SUPP 0x0200 -#define TST_DC_COMP_LOOP 0x0100 -#define TST_LOOPBACK 0x0080 -#define TST_TXFILT0 0x0040 -#define TST_TXTEST_ENABLE 0x0020 -#define TST_TXTEST_RATE 0x0018 -#define TST_TXTEST_PHASE 0x0007 - -/* phytest txTestRate values */ -#define TST_TXTEST_RATE_1MBPS 0 -#define TST_TXTEST_RATE_2MBPS 1 -#define TST_TXTEST_RATE_5_5MBPS 2 -#define TST_TXTEST_RATE_11MBPS 3 -#define TST_TXTEST_RATE_SHIFT 3 - -#define SHM_BYT_CNT 0x2 /* IHR location */ -#define MAX_BYT_CNT 0x600 /* Maximum frame len */ - -struct d11cnt { - u32 txfrag; - u32 txmulti; - u32 txfail; - u32 txretry; - u32 txretrie; - u32 rxdup; - u32 txrts; - u32 txnocts; - u32 txnoack; - u32 rxfrag; - u32 rxmulti; - u32 rxcrc; - u32 txfrmsnt; - u32 rxundec; -}; - -#endif /* _BRCM_D11_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/debug.c b/drivers/net/wireless/brcm80211/brcmsmac/debug.c deleted file mode 100644 index 9761deb46204..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/debug.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2012 Broadcom Corporation - * Copyright (c) 2012 Canonical Ltd. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include "types.h" -#include "main.h" -#include "debug.h" -#include "brcms_trace_events.h" - -static struct dentry *root_folder; - -void brcms_debugfs_init(void) -{ - root_folder = debugfs_create_dir(KBUILD_MODNAME, NULL); - if (IS_ERR(root_folder)) - root_folder = NULL; -} - -void brcms_debugfs_exit(void) -{ - if (!root_folder) - return; - - debugfs_remove_recursive(root_folder); - root_folder = NULL; -} - -int brcms_debugfs_attach(struct brcms_pub *drvr) -{ - if (!root_folder) - return -ENODEV; - - drvr->dbgfs_dir = debugfs_create_dir( - dev_name(&drvr->wlc->hw->d11core->dev), root_folder); - return PTR_RET(drvr->dbgfs_dir); -} - -void brcms_debugfs_detach(struct brcms_pub *drvr) -{ - if (!IS_ERR_OR_NULL(drvr->dbgfs_dir)) - debugfs_remove_recursive(drvr->dbgfs_dir); -} - -struct dentry *brcms_debugfs_get_devdir(struct brcms_pub *drvr) -{ - return drvr->dbgfs_dir; -} - -static -ssize_t brcms_debugfs_hardware_read(struct file *f, char __user *data, - size_t count, loff_t *ppos) -{ - char buf[128]; - int res; - struct brcms_pub *drvr = f->private_data; - - /* only allow read from start */ - if (*ppos > 0) - return 0; - - res = scnprintf(buf, sizeof(buf), - "board vendor: %x\n" - "board type: %x\n" - "board revision: %x\n" - "board flags: %x\n" - "board flags2: %x\n" - "firmware revision: %x\n", - drvr->wlc->hw->d11core->bus->boardinfo.vendor, - drvr->wlc->hw->d11core->bus->boardinfo.type, - drvr->wlc->hw->boardrev, - drvr->wlc->hw->boardflags, - drvr->wlc->hw->boardflags2, - drvr->wlc->ucode_rev - ); - - return simple_read_from_buffer(data, count, ppos, buf, res); -} - -static const struct file_operations brcms_debugfs_hardware_ops = { - .owner = THIS_MODULE, - .open = simple_open, - .read = brcms_debugfs_hardware_read -}; - -void brcms_debugfs_create_files(struct brcms_pub *drvr) -{ - struct dentry *dentry = drvr->dbgfs_dir; - - if (!IS_ERR_OR_NULL(dentry)) - debugfs_create_file("hardware", S_IRUGO, dentry, - drvr, &brcms_debugfs_hardware_ops); -} - -#define __brcms_fn(fn) \ -void __brcms_ ##fn(struct device *dev, const char *fmt, ...) \ -{ \ - struct va_format vaf = { \ - .fmt = fmt, \ - }; \ - va_list args; \ - \ - va_start(args, fmt); \ - vaf.va = &args; \ - dev_ ##fn(dev, "%pV", &vaf); \ - trace_brcms_ ##fn(&vaf); \ - va_end(args); \ -} - -__brcms_fn(info) -__brcms_fn(warn) -__brcms_fn(err) -__brcms_fn(crit) - -#if defined(CONFIG_BRCMDBG) || defined(CONFIG_BRCM_TRACING) -void __brcms_dbg(struct device *dev, u32 level, const char *func, - const char *fmt, ...) -{ - struct va_format vaf = { - .fmt = fmt, - }; - va_list args; - - va_start(args, fmt); - vaf.va = &args; -#ifdef CONFIG_BRCMDBG - if ((brcm_msg_level & level) && net_ratelimit()) - dev_err(dev, "%s %pV", func, &vaf); -#endif - trace_brcms_dbg(level, func, &vaf); - va_end(args); -} -#endif diff --git a/drivers/net/wireless/brcm80211/brcmsmac/debug.h b/drivers/net/wireless/brcm80211/brcmsmac/debug.h deleted file mode 100644 index 822781cf15d4..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/debug.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2012 Broadcom Corporation - * Copyright (c) 2012 Canonical Ltd. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef _BRCMS_DEBUG_H_ -#define _BRCMS_DEBUG_H_ - -#include -#include -#include -#include -#include "main.h" -#include "mac80211_if.h" - -__printf(2, 3) -void __brcms_info(struct device *dev, const char *fmt, ...); -__printf(2, 3) -void __brcms_warn(struct device *dev, const char *fmt, ...); -__printf(2, 3) -void __brcms_err(struct device *dev, const char *fmt, ...); -__printf(2, 3) -void __brcms_crit(struct device *dev, const char *fmt, ...); - -#if defined(CONFIG_BRCMDBG) || defined(CONFIG_BRCM_TRACING) -__printf(4, 5) -void __brcms_dbg(struct device *dev, u32 level, const char *func, - const char *fmt, ...); -#else -static inline __printf(4, 5) -void __brcms_dbg(struct device *dev, u32 level, const char *func, - const char *fmt, ...) -{ -} -#endif - -/* - * Debug macros cannot be used when wlc is uninitialized. Generally - * this means any code that could run before brcms_c_attach() has - * returned successfully probably shouldn't use the following macros. - */ - -#define brcms_dbg(core, l, f, a...) __brcms_dbg(&(core)->dev, l, __func__, f, ##a) -#define brcms_info(core, f, a...) __brcms_info(&(core)->dev, f, ##a) -#define brcms_warn(core, f, a...) __brcms_warn(&(core)->dev, f, ##a) -#define brcms_err(core, f, a...) __brcms_err(&(core)->dev, f, ##a) -#define brcms_crit(core, f, a...) __brcms_crit(&(core)->dev, f, ##a) - -#define brcms_dbg_info(core, f, a...) brcms_dbg(core, BRCM_DL_INFO, f, ##a) -#define brcms_dbg_mac80211(core, f, a...) brcms_dbg(core, BRCM_DL_MAC80211, f, ##a) -#define brcms_dbg_rx(core, f, a...) brcms_dbg(core, BRCM_DL_RX, f, ##a) -#define brcms_dbg_tx(core, f, a...) brcms_dbg(core, BRCM_DL_TX, f, ##a) -#define brcms_dbg_int(core, f, a...) brcms_dbg(core, BRCM_DL_INT, f, ##a) -#define brcms_dbg_dma(core, f, a...) brcms_dbg(core, BRCM_DL_DMA, f, ##a) -#define brcms_dbg_ht(core, f, a...) brcms_dbg(core, BRCM_DL_HT, f, ##a) - -struct brcms_pub; -void brcms_debugfs_init(void); -void brcms_debugfs_exit(void); -int brcms_debugfs_attach(struct brcms_pub *drvr); -void brcms_debugfs_detach(struct brcms_pub *drvr); -struct dentry *brcms_debugfs_get_devdir(struct brcms_pub *drvr); -void brcms_debugfs_create_files(struct brcms_pub *drvr); - -#endif /* _BRCMS_DEBUG_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c deleted file mode 100644 index 4fb9635d3919..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c +++ /dev/null @@ -1,1564 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include - -#include -#include -#include "types.h" -#include "main.h" -#include "dma.h" -#include "soc.h" -#include "scb.h" -#include "ampdu.h" -#include "debug.h" -#include "brcms_trace_events.h" - -/* - * dma register field offset calculation - */ -#define DMA64REGOFFS(field) offsetof(struct dma64regs, field) -#define DMA64TXREGOFFS(di, field) (di->d64txregbase + DMA64REGOFFS(field)) -#define DMA64RXREGOFFS(di, field) (di->d64rxregbase + DMA64REGOFFS(field)) - -/* - * DMA hardware requires each descriptor ring to be 8kB aligned, and fit within - * a contiguous 8kB physical address. - */ -#define D64RINGALIGN_BITS 13 -#define D64MAXRINGSZ (1 << D64RINGALIGN_BITS) -#define D64RINGALIGN (1 << D64RINGALIGN_BITS) - -#define D64MAXDD (D64MAXRINGSZ / sizeof(struct dma64desc)) - -/* transmit channel control */ -#define D64_XC_XE 0x00000001 /* transmit enable */ -#define D64_XC_SE 0x00000002 /* transmit suspend request */ -#define D64_XC_LE 0x00000004 /* loopback enable */ -#define D64_XC_FL 0x00000010 /* flush request */ -#define D64_XC_PD 0x00000800 /* parity check disable */ -#define D64_XC_AE 0x00030000 /* address extension bits */ -#define D64_XC_AE_SHIFT 16 - -/* transmit descriptor table pointer */ -#define D64_XP_LD_MASK 0x00000fff /* last valid descriptor */ - -/* transmit channel status */ -#define D64_XS0_CD_MASK 0x00001fff /* current descriptor pointer */ -#define D64_XS0_XS_MASK 0xf0000000 /* transmit state */ -#define D64_XS0_XS_SHIFT 28 -#define D64_XS0_XS_DISABLED 0x00000000 /* disabled */ -#define D64_XS0_XS_ACTIVE 0x10000000 /* active */ -#define D64_XS0_XS_IDLE 0x20000000 /* idle wait */ -#define D64_XS0_XS_STOPPED 0x30000000 /* stopped */ -#define D64_XS0_XS_SUSP 0x40000000 /* suspend pending */ - -#define D64_XS1_AD_MASK 0x00001fff /* active descriptor */ -#define D64_XS1_XE_MASK 0xf0000000 /* transmit errors */ -#define D64_XS1_XE_SHIFT 28 -#define D64_XS1_XE_NOERR 0x00000000 /* no error */ -#define D64_XS1_XE_DPE 0x10000000 /* descriptor protocol error */ -#define D64_XS1_XE_DFU 0x20000000 /* data fifo underrun */ -#define D64_XS1_XE_DTE 0x30000000 /* data transfer error */ -#define D64_XS1_XE_DESRE 0x40000000 /* descriptor read error */ -#define D64_XS1_XE_COREE 0x50000000 /* core error */ - -/* receive channel control */ -/* receive enable */ -#define D64_RC_RE 0x00000001 -/* receive frame offset */ -#define D64_RC_RO_MASK 0x000000fe -#define D64_RC_RO_SHIFT 1 -/* direct fifo receive (pio) mode */ -#define D64_RC_FM 0x00000100 -/* separate rx header descriptor enable */ -#define D64_RC_SH 0x00000200 -/* overflow continue */ -#define D64_RC_OC 0x00000400 -/* parity check disable */ -#define D64_RC_PD 0x00000800 -/* address extension bits */ -#define D64_RC_AE 0x00030000 -#define D64_RC_AE_SHIFT 16 - -/* flags for dma controller */ -/* partity enable */ -#define DMA_CTRL_PEN (1 << 0) -/* rx overflow continue */ -#define DMA_CTRL_ROC (1 << 1) -/* allow rx scatter to multiple descriptors */ -#define DMA_CTRL_RXMULTI (1 << 2) -/* Unframed Rx/Tx data */ -#define DMA_CTRL_UNFRAMED (1 << 3) - -/* receive descriptor table pointer */ -#define D64_RP_LD_MASK 0x00000fff /* last valid descriptor */ - -/* receive channel status */ -#define D64_RS0_CD_MASK 0x00001fff /* current descriptor pointer */ -#define D64_RS0_RS_MASK 0xf0000000 /* receive state */ -#define D64_RS0_RS_SHIFT 28 -#define D64_RS0_RS_DISABLED 0x00000000 /* disabled */ -#define D64_RS0_RS_ACTIVE 0x10000000 /* active */ -#define D64_RS0_RS_IDLE 0x20000000 /* idle wait */ -#define D64_RS0_RS_STOPPED 0x30000000 /* stopped */ -#define D64_RS0_RS_SUSP 0x40000000 /* suspend pending */ - -#define D64_RS1_AD_MASK 0x0001ffff /* active descriptor */ -#define D64_RS1_RE_MASK 0xf0000000 /* receive errors */ -#define D64_RS1_RE_SHIFT 28 -#define D64_RS1_RE_NOERR 0x00000000 /* no error */ -#define D64_RS1_RE_DPO 0x10000000 /* descriptor protocol error */ -#define D64_RS1_RE_DFU 0x20000000 /* data fifo overflow */ -#define D64_RS1_RE_DTE 0x30000000 /* data transfer error */ -#define D64_RS1_RE_DESRE 0x40000000 /* descriptor read error */ -#define D64_RS1_RE_COREE 0x50000000 /* core error */ - -/* fifoaddr */ -#define D64_FA_OFF_MASK 0xffff /* offset */ -#define D64_FA_SEL_MASK 0xf0000 /* select */ -#define D64_FA_SEL_SHIFT 16 -#define D64_FA_SEL_XDD 0x00000 /* transmit dma data */ -#define D64_FA_SEL_XDP 0x10000 /* transmit dma pointers */ -#define D64_FA_SEL_RDD 0x40000 /* receive dma data */ -#define D64_FA_SEL_RDP 0x50000 /* receive dma pointers */ -#define D64_FA_SEL_XFD 0x80000 /* transmit fifo data */ -#define D64_FA_SEL_XFP 0x90000 /* transmit fifo pointers */ -#define D64_FA_SEL_RFD 0xc0000 /* receive fifo data */ -#define D64_FA_SEL_RFP 0xd0000 /* receive fifo pointers */ -#define D64_FA_SEL_RSD 0xe0000 /* receive frame status data */ -#define D64_FA_SEL_RSP 0xf0000 /* receive frame status pointers */ - -/* descriptor control flags 1 */ -#define D64_CTRL_COREFLAGS 0x0ff00000 /* core specific flags */ -#define D64_CTRL1_EOT ((u32)1 << 28) /* end of descriptor table */ -#define D64_CTRL1_IOC ((u32)1 << 29) /* interrupt on completion */ -#define D64_CTRL1_EOF ((u32)1 << 30) /* end of frame */ -#define D64_CTRL1_SOF ((u32)1 << 31) /* start of frame */ - -/* descriptor control flags 2 */ -/* buffer byte count. real data len must <= 16KB */ -#define D64_CTRL2_BC_MASK 0x00007fff -/* address extension bits */ -#define D64_CTRL2_AE 0x00030000 -#define D64_CTRL2_AE_SHIFT 16 -/* parity bit */ -#define D64_CTRL2_PARITY 0x00040000 - -/* control flags in the range [27:20] are core-specific and not defined here */ -#define D64_CTRL_CORE_MASK 0x0ff00000 - -#define D64_RX_FRM_STS_LEN 0x0000ffff /* frame length mask */ -#define D64_RX_FRM_STS_OVFL 0x00800000 /* RxOverFlow */ -#define D64_RX_FRM_STS_DSCRCNT 0x0f000000 /* no. of descriptors used - 1 */ -#define D64_RX_FRM_STS_DATATYPE 0xf0000000 /* core-dependent data type */ - -/* - * packet headroom necessary to accommodate the largest header - * in the system, (i.e TXOFF). By doing, we avoid the need to - * allocate an extra buffer for the header when bridging to WL. - * There is a compile time check in wlc.c which ensure that this - * value is at least as big as TXOFF. This value is used in - * dma_rxfill(). - */ - -#define BCMEXTRAHDROOM 172 - -#define MAXNAMEL 8 /* 8 char names */ - -/* macros to convert between byte offsets and indexes */ -#define B2I(bytes, type) ((bytes) / sizeof(type)) -#define I2B(index, type) ((index) * sizeof(type)) - -#define PCI32ADDR_HIGH 0xc0000000 /* address[31:30] */ -#define PCI32ADDR_HIGH_SHIFT 30 /* address[31:30] */ - -#define PCI64ADDR_HIGH 0x80000000 /* address[63] */ -#define PCI64ADDR_HIGH_SHIFT 31 /* address[63] */ - -/* - * DMA Descriptor - * Descriptors are only read by the hardware, never written back. - */ -struct dma64desc { - __le32 ctrl1; /* misc control bits & bufcount */ - __le32 ctrl2; /* buffer count and address extension */ - __le32 addrlow; /* memory address of the date buffer, bits 31:0 */ - __le32 addrhigh; /* memory address of the date buffer, bits 63:32 */ -}; - -/* dma engine software state */ -struct dma_info { - struct dma_pub dma; /* exported structure */ - char name[MAXNAMEL]; /* callers name for diag msgs */ - - struct bcma_device *core; - struct device *dmadev; - - /* session information for AMPDU */ - struct brcms_ampdu_session ampdu_session; - - bool dma64; /* this dma engine is operating in 64-bit mode */ - bool addrext; /* this dma engine supports DmaExtendedAddrChanges */ - - /* 64-bit dma tx engine registers */ - uint d64txregbase; - /* 64-bit dma rx engine registers */ - uint d64rxregbase; - /* pointer to dma64 tx descriptor ring */ - struct dma64desc *txd64; - /* pointer to dma64 rx descriptor ring */ - struct dma64desc *rxd64; - - u16 dmadesc_align; /* alignment requirement for dma descriptors */ - - u16 ntxd; /* # tx descriptors tunable */ - u16 txin; /* index of next descriptor to reclaim */ - u16 txout; /* index of next descriptor to post */ - /* pointer to parallel array of pointers to packets */ - struct sk_buff **txp; - /* Aligned physical address of descriptor ring */ - dma_addr_t txdpa; - /* Original physical address of descriptor ring */ - dma_addr_t txdpaorig; - u16 txdalign; /* #bytes added to alloc'd mem to align txd */ - u32 txdalloc; /* #bytes allocated for the ring */ - u32 xmtptrbase; /* When using unaligned descriptors, the ptr register - * is not just an index, it needs all 13 bits to be - * an offset from the addr register. - */ - - u16 nrxd; /* # rx descriptors tunable */ - u16 rxin; /* index of next descriptor to reclaim */ - u16 rxout; /* index of next descriptor to post */ - /* pointer to parallel array of pointers to packets */ - struct sk_buff **rxp; - /* Aligned physical address of descriptor ring */ - dma_addr_t rxdpa; - /* Original physical address of descriptor ring */ - dma_addr_t rxdpaorig; - u16 rxdalign; /* #bytes added to alloc'd mem to align rxd */ - u32 rxdalloc; /* #bytes allocated for the ring */ - u32 rcvptrbase; /* Base for ptr reg when using unaligned descriptors */ - - /* tunables */ - unsigned int rxbufsize; /* rx buffer size in bytes, not including - * the extra headroom - */ - uint rxextrahdrroom; /* extra rx headroom, reverseved to assist upper - * stack, e.g. some rx pkt buffers will be - * bridged to tx side without byte copying. - * The extra headroom needs to be large enough - * to fit txheader needs. Some dongle driver may - * not need it. - */ - uint nrxpost; /* # rx buffers to keep posted */ - unsigned int rxoffset; /* rxcontrol offset */ - /* add to get dma address of descriptor ring, low 32 bits */ - uint ddoffsetlow; - /* high 32 bits */ - uint ddoffsethigh; - /* add to get dma address of data buffer, low 32 bits */ - uint dataoffsetlow; - /* high 32 bits */ - uint dataoffsethigh; - /* descriptor base need to be aligned or not */ - bool aligndesc_4k; -}; - -/* Check for odd number of 1's */ -static u32 parity32(__le32 data) -{ - /* no swap needed for counting 1's */ - u32 par_data = *(u32 *)&data; - - par_data ^= par_data >> 16; - par_data ^= par_data >> 8; - par_data ^= par_data >> 4; - par_data ^= par_data >> 2; - par_data ^= par_data >> 1; - - return par_data & 1; -} - -static bool dma64_dd_parity(struct dma64desc *dd) -{ - return parity32(dd->addrlow ^ dd->addrhigh ^ dd->ctrl1 ^ dd->ctrl2); -} - -/* descriptor bumping functions */ - -static uint xxd(uint x, uint n) -{ - return x & (n - 1); /* faster than %, but n must be power of 2 */ -} - -static uint txd(struct dma_info *di, uint x) -{ - return xxd(x, di->ntxd); -} - -static uint rxd(struct dma_info *di, uint x) -{ - return xxd(x, di->nrxd); -} - -static uint nexttxd(struct dma_info *di, uint i) -{ - return txd(di, i + 1); -} - -static uint prevtxd(struct dma_info *di, uint i) -{ - return txd(di, i - 1); -} - -static uint nextrxd(struct dma_info *di, uint i) -{ - return rxd(di, i + 1); -} - -static uint ntxdactive(struct dma_info *di, uint h, uint t) -{ - return txd(di, t-h); -} - -static uint nrxdactive(struct dma_info *di, uint h, uint t) -{ - return rxd(di, t-h); -} - -static uint _dma_ctrlflags(struct dma_info *di, uint mask, uint flags) -{ - uint dmactrlflags; - - if (di == NULL) - return 0; - - dmactrlflags = di->dma.dmactrlflags; - dmactrlflags &= ~mask; - dmactrlflags |= flags; - - /* If trying to enable parity, check if parity is actually supported */ - if (dmactrlflags & DMA_CTRL_PEN) { - u32 control; - - control = bcma_read32(di->core, DMA64TXREGOFFS(di, control)); - bcma_write32(di->core, DMA64TXREGOFFS(di, control), - control | D64_XC_PD); - if (bcma_read32(di->core, DMA64TXREGOFFS(di, control)) & - D64_XC_PD) - /* We *can* disable it so it is supported, - * restore control register - */ - bcma_write32(di->core, DMA64TXREGOFFS(di, control), - control); - else - /* Not supported, don't allow it to be enabled */ - dmactrlflags &= ~DMA_CTRL_PEN; - } - - di->dma.dmactrlflags = dmactrlflags; - - return dmactrlflags; -} - -static bool _dma64_addrext(struct dma_info *di, uint ctrl_offset) -{ - u32 w; - bcma_set32(di->core, ctrl_offset, D64_XC_AE); - w = bcma_read32(di->core, ctrl_offset); - bcma_mask32(di->core, ctrl_offset, ~D64_XC_AE); - return (w & D64_XC_AE) == D64_XC_AE; -} - -/* - * return true if this dma engine supports DmaExtendedAddrChanges, - * otherwise false - */ -static bool _dma_isaddrext(struct dma_info *di) -{ - /* DMA64 supports full 32- or 64-bit operation. AE is always valid */ - - /* not all tx or rx channel are available */ - if (di->d64txregbase != 0) { - if (!_dma64_addrext(di, DMA64TXREGOFFS(di, control))) - brcms_dbg_dma(di->core, - "%s: DMA64 tx doesn't have AE set\n", - di->name); - return true; - } else if (di->d64rxregbase != 0) { - if (!_dma64_addrext(di, DMA64RXREGOFFS(di, control))) - brcms_dbg_dma(di->core, - "%s: DMA64 rx doesn't have AE set\n", - di->name); - return true; - } - - return false; -} - -static bool _dma_descriptor_align(struct dma_info *di) -{ - u32 addrl; - - /* Check to see if the descriptors need to be aligned on 4K/8K or not */ - if (di->d64txregbase != 0) { - bcma_write32(di->core, DMA64TXREGOFFS(di, addrlow), 0xff0); - addrl = bcma_read32(di->core, DMA64TXREGOFFS(di, addrlow)); - if (addrl != 0) - return false; - } else if (di->d64rxregbase != 0) { - bcma_write32(di->core, DMA64RXREGOFFS(di, addrlow), 0xff0); - addrl = bcma_read32(di->core, DMA64RXREGOFFS(di, addrlow)); - if (addrl != 0) - return false; - } - return true; -} - -/* - * Descriptor table must start at the DMA hardware dictated alignment, so - * allocated memory must be large enough to support this requirement. - */ -static void *dma_alloc_consistent(struct dma_info *di, uint size, - u16 align_bits, uint *alloced, - dma_addr_t *pap) -{ - if (align_bits) { - u16 align = (1 << align_bits); - if (!IS_ALIGNED(PAGE_SIZE, align)) - size += align; - *alloced = size; - } - return dma_alloc_coherent(di->dmadev, size, pap, GFP_ATOMIC); -} - -static -u8 dma_align_sizetobits(uint size) -{ - u8 bitpos = 0; - while (size >>= 1) - bitpos++; - return bitpos; -} - -/* This function ensures that the DMA descriptor ring will not get allocated - * across Page boundary. If the allocation is done across the page boundary - * at the first time, then it is freed and the allocation is done at - * descriptor ring size aligned location. This will ensure that the ring will - * not cross page boundary - */ -static void *dma_ringalloc(struct dma_info *di, u32 boundary, uint size, - u16 *alignbits, uint *alloced, - dma_addr_t *descpa) -{ - void *va; - u32 desc_strtaddr; - u32 alignbytes = 1 << *alignbits; - - va = dma_alloc_consistent(di, size, *alignbits, alloced, descpa); - - if (NULL == va) - return NULL; - - desc_strtaddr = (u32) roundup((unsigned long)va, alignbytes); - if (((desc_strtaddr + size - 1) & boundary) != (desc_strtaddr - & boundary)) { - *alignbits = dma_align_sizetobits(size); - dma_free_coherent(di->dmadev, size, va, *descpa); - va = dma_alloc_consistent(di, size, *alignbits, - alloced, descpa); - } - return va; -} - -static bool dma64_alloc(struct dma_info *di, uint direction) -{ - u16 size; - uint ddlen; - void *va; - uint alloced = 0; - u16 align; - u16 align_bits; - - ddlen = sizeof(struct dma64desc); - - size = (direction == DMA_TX) ? (di->ntxd * ddlen) : (di->nrxd * ddlen); - align_bits = di->dmadesc_align; - align = (1 << align_bits); - - if (direction == DMA_TX) { - va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits, - &alloced, &di->txdpaorig); - if (va == NULL) { - brcms_dbg_dma(di->core, - "%s: DMA_ALLOC_CONSISTENT(ntxd) failed\n", - di->name); - return false; - } - align = (1 << align_bits); - di->txd64 = (struct dma64desc *) - roundup((unsigned long)va, align); - di->txdalign = (uint) ((s8 *)di->txd64 - (s8 *) va); - di->txdpa = di->txdpaorig + di->txdalign; - di->txdalloc = alloced; - } else { - va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits, - &alloced, &di->rxdpaorig); - if (va == NULL) { - brcms_dbg_dma(di->core, - "%s: DMA_ALLOC_CONSISTENT(nrxd) failed\n", - di->name); - return false; - } - align = (1 << align_bits); - di->rxd64 = (struct dma64desc *) - roundup((unsigned long)va, align); - di->rxdalign = (uint) ((s8 *)di->rxd64 - (s8 *) va); - di->rxdpa = di->rxdpaorig + di->rxdalign; - di->rxdalloc = alloced; - } - - return true; -} - -static bool _dma_alloc(struct dma_info *di, uint direction) -{ - return dma64_alloc(di, direction); -} - -struct dma_pub *dma_attach(char *name, struct brcms_c_info *wlc, - uint txregbase, uint rxregbase, uint ntxd, uint nrxd, - uint rxbufsize, int rxextheadroom, - uint nrxpost, uint rxoffset) -{ - struct si_pub *sih = wlc->hw->sih; - struct bcma_device *core = wlc->hw->d11core; - struct dma_info *di; - u8 rev = core->id.rev; - uint size; - struct si_info *sii = container_of(sih, struct si_info, pub); - - /* allocate private info structure */ - di = kzalloc(sizeof(struct dma_info), GFP_ATOMIC); - if (di == NULL) - return NULL; - - di->dma64 = - ((bcma_aread32(core, BCMA_IOST) & SISF_DMA64) == SISF_DMA64); - - /* init dma reg info */ - di->core = core; - di->d64txregbase = txregbase; - di->d64rxregbase = rxregbase; - - /* - * Default flags (which can be changed by the driver calling - * dma_ctrlflags before enable): For backwards compatibility - * both Rx Overflow Continue and Parity are DISABLED. - */ - _dma_ctrlflags(di, DMA_CTRL_ROC | DMA_CTRL_PEN, 0); - - brcms_dbg_dma(di->core, "%s: %s flags 0x%x ntxd %d nrxd %d " - "rxbufsize %d rxextheadroom %d nrxpost %d rxoffset %d " - "txregbase %u rxregbase %u\n", name, "DMA64", - di->dma.dmactrlflags, ntxd, nrxd, rxbufsize, - rxextheadroom, nrxpost, rxoffset, txregbase, rxregbase); - - /* make a private copy of our callers name */ - strncpy(di->name, name, MAXNAMEL); - di->name[MAXNAMEL - 1] = '\0'; - - di->dmadev = core->dma_dev; - - /* save tunables */ - di->ntxd = (u16) ntxd; - di->nrxd = (u16) nrxd; - - /* the actual dma size doesn't include the extra headroom */ - di->rxextrahdrroom = - (rxextheadroom == -1) ? BCMEXTRAHDROOM : rxextheadroom; - if (rxbufsize > BCMEXTRAHDROOM) - di->rxbufsize = (u16) (rxbufsize - di->rxextrahdrroom); - else - di->rxbufsize = (u16) rxbufsize; - - di->nrxpost = (u16) nrxpost; - di->rxoffset = (u8) rxoffset; - - /* - * figure out the DMA physical address offset for dd and data - * PCI/PCIE: they map silicon backplace address to zero - * based memory, need offset - * Other bus: use zero SI_BUS BIGENDIAN kludge: use sdram - * swapped region for data buffer, not descriptor - */ - di->ddoffsetlow = 0; - di->dataoffsetlow = 0; - /* for pci bus, add offset */ - if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) { - /* add offset for pcie with DMA64 bus */ - di->ddoffsetlow = 0; - di->ddoffsethigh = SI_PCIE_DMA_H32; - } - di->dataoffsetlow = di->ddoffsetlow; - di->dataoffsethigh = di->ddoffsethigh; - - /* WAR64450 : DMACtl.Addr ext fields are not supported in SDIOD core. */ - if ((core->id.id == BCMA_CORE_SDIO_DEV) - && ((rev > 0) && (rev <= 2))) - di->addrext = false; - else if ((core->id.id == BCMA_CORE_I2S) && - ((rev == 0) || (rev == 1))) - di->addrext = false; - else - di->addrext = _dma_isaddrext(di); - - /* does the descriptor need to be aligned and if yes, on 4K/8K or not */ - di->aligndesc_4k = _dma_descriptor_align(di); - if (di->aligndesc_4k) { - di->dmadesc_align = D64RINGALIGN_BITS; - if ((ntxd < D64MAXDD / 2) && (nrxd < D64MAXDD / 2)) - /* for smaller dd table, HW relax alignment reqmnt */ - di->dmadesc_align = D64RINGALIGN_BITS - 1; - } else { - di->dmadesc_align = 4; /* 16 byte alignment */ - } - - brcms_dbg_dma(di->core, "DMA descriptor align_needed %d, align %d\n", - di->aligndesc_4k, di->dmadesc_align); - - /* allocate tx packet pointer vector */ - if (ntxd) { - size = ntxd * sizeof(void *); - di->txp = kzalloc(size, GFP_ATOMIC); - if (di->txp == NULL) - goto fail; - } - - /* allocate rx packet pointer vector */ - if (nrxd) { - size = nrxd * sizeof(void *); - di->rxp = kzalloc(size, GFP_ATOMIC); - if (di->rxp == NULL) - goto fail; - } - - /* - * allocate transmit descriptor ring, only need ntxd descriptors - * but it must be aligned - */ - if (ntxd) { - if (!_dma_alloc(di, DMA_TX)) - goto fail; - } - - /* - * allocate receive descriptor ring, only need nrxd descriptors - * but it must be aligned - */ - if (nrxd) { - if (!_dma_alloc(di, DMA_RX)) - goto fail; - } - - if ((di->ddoffsetlow != 0) && !di->addrext) { - if (di->txdpa > SI_PCI_DMA_SZ) { - brcms_dbg_dma(di->core, - "%s: txdpa 0x%x: addrext not supported\n", - di->name, (u32)di->txdpa); - goto fail; - } - if (di->rxdpa > SI_PCI_DMA_SZ) { - brcms_dbg_dma(di->core, - "%s: rxdpa 0x%x: addrext not supported\n", - di->name, (u32)di->rxdpa); - goto fail; - } - } - - /* Initialize AMPDU session */ - brcms_c_ampdu_reset_session(&di->ampdu_session, wlc); - - brcms_dbg_dma(di->core, - "ddoffsetlow 0x%x ddoffsethigh 0x%x dataoffsetlow 0x%x dataoffsethigh 0x%x addrext %d\n", - di->ddoffsetlow, di->ddoffsethigh, - di->dataoffsetlow, di->dataoffsethigh, - di->addrext); - - return (struct dma_pub *) di; - - fail: - dma_detach((struct dma_pub *)di); - return NULL; -} - -static inline void -dma64_dd_upd(struct dma_info *di, struct dma64desc *ddring, - dma_addr_t pa, uint outidx, u32 *flags, u32 bufcount) -{ - u32 ctrl2 = bufcount & D64_CTRL2_BC_MASK; - - /* PCI bus with big(>1G) physical address, use address extension */ - if ((di->dataoffsetlow == 0) || !(pa & PCI32ADDR_HIGH)) { - ddring[outidx].addrlow = cpu_to_le32(pa + di->dataoffsetlow); - ddring[outidx].addrhigh = cpu_to_le32(di->dataoffsethigh); - ddring[outidx].ctrl1 = cpu_to_le32(*flags); - ddring[outidx].ctrl2 = cpu_to_le32(ctrl2); - } else { - /* address extension for 32-bit PCI */ - u32 ae; - - ae = (pa & PCI32ADDR_HIGH) >> PCI32ADDR_HIGH_SHIFT; - pa &= ~PCI32ADDR_HIGH; - - ctrl2 |= (ae << D64_CTRL2_AE_SHIFT) & D64_CTRL2_AE; - ddring[outidx].addrlow = cpu_to_le32(pa + di->dataoffsetlow); - ddring[outidx].addrhigh = cpu_to_le32(di->dataoffsethigh); - ddring[outidx].ctrl1 = cpu_to_le32(*flags); - ddring[outidx].ctrl2 = cpu_to_le32(ctrl2); - } - if (di->dma.dmactrlflags & DMA_CTRL_PEN) { - if (dma64_dd_parity(&ddring[outidx])) - ddring[outidx].ctrl2 = - cpu_to_le32(ctrl2 | D64_CTRL2_PARITY); - } -} - -/* !! may be called with core in reset */ -void dma_detach(struct dma_pub *pub) -{ - struct dma_info *di = (struct dma_info *)pub; - - brcms_dbg_dma(di->core, "%s:\n", di->name); - - /* free dma descriptor rings */ - if (di->txd64) - dma_free_coherent(di->dmadev, di->txdalloc, - ((s8 *)di->txd64 - di->txdalign), - (di->txdpaorig)); - if (di->rxd64) - dma_free_coherent(di->dmadev, di->rxdalloc, - ((s8 *)di->rxd64 - di->rxdalign), - (di->rxdpaorig)); - - /* free packet pointer vectors */ - kfree(di->txp); - kfree(di->rxp); - - /* free our private info structure */ - kfree(di); - -} - -/* initialize descriptor table base address */ -static void -_dma_ddtable_init(struct dma_info *di, uint direction, dma_addr_t pa) -{ - if (!di->aligndesc_4k) { - if (direction == DMA_TX) - di->xmtptrbase = pa; - else - di->rcvptrbase = pa; - } - - if ((di->ddoffsetlow == 0) - || !(pa & PCI32ADDR_HIGH)) { - if (direction == DMA_TX) { - bcma_write32(di->core, DMA64TXREGOFFS(di, addrlow), - pa + di->ddoffsetlow); - bcma_write32(di->core, DMA64TXREGOFFS(di, addrhigh), - di->ddoffsethigh); - } else { - bcma_write32(di->core, DMA64RXREGOFFS(di, addrlow), - pa + di->ddoffsetlow); - bcma_write32(di->core, DMA64RXREGOFFS(di, addrhigh), - di->ddoffsethigh); - } - } else { - /* DMA64 32bits address extension */ - u32 ae; - - /* shift the high bit(s) from pa to ae */ - ae = (pa & PCI32ADDR_HIGH) >> PCI32ADDR_HIGH_SHIFT; - pa &= ~PCI32ADDR_HIGH; - - if (direction == DMA_TX) { - bcma_write32(di->core, DMA64TXREGOFFS(di, addrlow), - pa + di->ddoffsetlow); - bcma_write32(di->core, DMA64TXREGOFFS(di, addrhigh), - di->ddoffsethigh); - bcma_maskset32(di->core, DMA64TXREGOFFS(di, control), - D64_XC_AE, (ae << D64_XC_AE_SHIFT)); - } else { - bcma_write32(di->core, DMA64RXREGOFFS(di, addrlow), - pa + di->ddoffsetlow); - bcma_write32(di->core, DMA64RXREGOFFS(di, addrhigh), - di->ddoffsethigh); - bcma_maskset32(di->core, DMA64RXREGOFFS(di, control), - D64_RC_AE, (ae << D64_RC_AE_SHIFT)); - } - } -} - -static void _dma_rxenable(struct dma_info *di) -{ - uint dmactrlflags = di->dma.dmactrlflags; - u32 control; - - brcms_dbg_dma(di->core, "%s:\n", di->name); - - control = D64_RC_RE | (bcma_read32(di->core, - DMA64RXREGOFFS(di, control)) & - D64_RC_AE); - - if ((dmactrlflags & DMA_CTRL_PEN) == 0) - control |= D64_RC_PD; - - if (dmactrlflags & DMA_CTRL_ROC) - control |= D64_RC_OC; - - bcma_write32(di->core, DMA64RXREGOFFS(di, control), - ((di->rxoffset << D64_RC_RO_SHIFT) | control)); -} - -void dma_rxinit(struct dma_pub *pub) -{ - struct dma_info *di = (struct dma_info *)pub; - - brcms_dbg_dma(di->core, "%s:\n", di->name); - - if (di->nrxd == 0) - return; - - di->rxin = di->rxout = 0; - - /* clear rx descriptor ring */ - memset(di->rxd64, '\0', di->nrxd * sizeof(struct dma64desc)); - - /* DMA engine with out alignment requirement requires table to be inited - * before enabling the engine - */ - if (!di->aligndesc_4k) - _dma_ddtable_init(di, DMA_RX, di->rxdpa); - - _dma_rxenable(di); - - if (di->aligndesc_4k) - _dma_ddtable_init(di, DMA_RX, di->rxdpa); -} - -static struct sk_buff *dma64_getnextrxp(struct dma_info *di, bool forceall) -{ - uint i, curr; - struct sk_buff *rxp; - dma_addr_t pa; - - i = di->rxin; - - /* return if no packets posted */ - if (i == di->rxout) - return NULL; - - curr = - B2I(((bcma_read32(di->core, - DMA64RXREGOFFS(di, status0)) & D64_RS0_CD_MASK) - - di->rcvptrbase) & D64_RS0_CD_MASK, struct dma64desc); - - /* ignore curr if forceall */ - if (!forceall && (i == curr)) - return NULL; - - /* get the packet pointer that corresponds to the rx descriptor */ - rxp = di->rxp[i]; - di->rxp[i] = NULL; - - pa = le32_to_cpu(di->rxd64[i].addrlow) - di->dataoffsetlow; - - /* clear this packet from the descriptor ring */ - dma_unmap_single(di->dmadev, pa, di->rxbufsize, DMA_FROM_DEVICE); - - di->rxd64[i].addrlow = cpu_to_le32(0xdeadbeef); - di->rxd64[i].addrhigh = cpu_to_le32(0xdeadbeef); - - di->rxin = nextrxd(di, i); - - return rxp; -} - -static struct sk_buff *_dma_getnextrxp(struct dma_info *di, bool forceall) -{ - if (di->nrxd == 0) - return NULL; - - return dma64_getnextrxp(di, forceall); -} - -/* - * !! rx entry routine - * returns the number packages in the next frame, or 0 if there are no more - * if DMA_CTRL_RXMULTI is defined, DMA scattering(multiple buffers) is - * supported with pkts chain - * otherwise, it's treated as giant pkt and will be tossed. - * The DMA scattering starts with normal DMA header, followed by first - * buffer data. After it reaches the max size of buffer, the data continues - * in next DMA descriptor buffer WITHOUT DMA header - */ -int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list) -{ - struct dma_info *di = (struct dma_info *)pub; - struct sk_buff_head dma_frames; - struct sk_buff *p, *next; - uint len; - uint pkt_len; - int resid = 0; - int pktcnt = 1; - - skb_queue_head_init(&dma_frames); - next_frame: - p = _dma_getnextrxp(di, false); - if (p == NULL) - return 0; - - len = le16_to_cpu(*(__le16 *) (p->data)); - brcms_dbg_dma(di->core, "%s: dma_rx len %d\n", di->name, len); - dma_spin_for_len(len, p); - - /* set actual length */ - pkt_len = min((di->rxoffset + len), di->rxbufsize); - __skb_trim(p, pkt_len); - skb_queue_tail(&dma_frames, p); - resid = len - (di->rxbufsize - di->rxoffset); - - /* check for single or multi-buffer rx */ - if (resid > 0) { - while ((resid > 0) && (p = _dma_getnextrxp(di, false))) { - pkt_len = min_t(uint, resid, di->rxbufsize); - __skb_trim(p, pkt_len); - skb_queue_tail(&dma_frames, p); - resid -= di->rxbufsize; - pktcnt++; - } - -#ifdef DEBUG - if (resid > 0) { - uint cur; - cur = - B2I(((bcma_read32(di->core, - DMA64RXREGOFFS(di, status0)) & - D64_RS0_CD_MASK) - di->rcvptrbase) & - D64_RS0_CD_MASK, struct dma64desc); - brcms_dbg_dma(di->core, - "rxin %d rxout %d, hw_curr %d\n", - di->rxin, di->rxout, cur); - } -#endif /* DEBUG */ - - if ((di->dma.dmactrlflags & DMA_CTRL_RXMULTI) == 0) { - brcms_dbg_dma(di->core, "%s: bad frame length (%d)\n", - di->name, len); - skb_queue_walk_safe(&dma_frames, p, next) { - skb_unlink(p, &dma_frames); - brcmu_pkt_buf_free_skb(p); - } - di->dma.rxgiants++; - pktcnt = 1; - goto next_frame; - } - } - - skb_queue_splice_tail(&dma_frames, skb_list); - return pktcnt; -} - -static bool dma64_rxidle(struct dma_info *di) -{ - brcms_dbg_dma(di->core, "%s:\n", di->name); - - if (di->nrxd == 0) - return true; - - return ((bcma_read32(di->core, - DMA64RXREGOFFS(di, status0)) & D64_RS0_CD_MASK) == - (bcma_read32(di->core, DMA64RXREGOFFS(di, ptr)) & - D64_RS0_CD_MASK)); -} - -static bool dma64_txidle(struct dma_info *di) -{ - if (di->ntxd == 0) - return true; - - return ((bcma_read32(di->core, - DMA64TXREGOFFS(di, status0)) & D64_XS0_CD_MASK) == - (bcma_read32(di->core, DMA64TXREGOFFS(di, ptr)) & - D64_XS0_CD_MASK)); -} - -/* - * post receive buffers - * Return false if refill failed completely or dma mapping failed. The ring - * is empty, which will stall the rx dma and user might want to call rxfill - * again asap. This is unlikely to happen on a memory-rich NIC, but often on - * memory-constrained dongle. - */ -bool dma_rxfill(struct dma_pub *pub) -{ - struct dma_info *di = (struct dma_info *)pub; - struct sk_buff *p; - u16 rxin, rxout; - u32 flags = 0; - uint n; - uint i; - dma_addr_t pa; - uint extra_offset = 0; - bool ring_empty; - - ring_empty = false; - - /* - * Determine how many receive buffers we're lacking - * from the full complement, allocate, initialize, - * and post them, then update the chip rx lastdscr. - */ - - rxin = di->rxin; - rxout = di->rxout; - - n = di->nrxpost - nrxdactive(di, rxin, rxout); - - brcms_dbg_dma(di->core, "%s: post %d\n", di->name, n); - - if (di->rxbufsize > BCMEXTRAHDROOM) - extra_offset = di->rxextrahdrroom; - - for (i = 0; i < n; i++) { - /* - * the di->rxbufsize doesn't include the extra headroom, - * we need to add it to the size to be allocated - */ - p = brcmu_pkt_buf_get_skb(di->rxbufsize + extra_offset); - - if (p == NULL) { - brcms_dbg_dma(di->core, "%s: out of rxbufs\n", - di->name); - if (i == 0 && dma64_rxidle(di)) { - brcms_dbg_dma(di->core, "%s: ring is empty !\n", - di->name); - ring_empty = true; - } - di->dma.rxnobuf++; - break; - } - /* reserve an extra headroom, if applicable */ - if (extra_offset) - skb_pull(p, extra_offset); - - /* Do a cached write instead of uncached write since DMA_MAP - * will flush the cache. - */ - *(u32 *) (p->data) = 0; - - pa = dma_map_single(di->dmadev, p->data, di->rxbufsize, - DMA_FROM_DEVICE); - if (dma_mapping_error(di->dmadev, pa)) - return false; - - /* save the free packet pointer */ - di->rxp[rxout] = p; - - /* reset flags for each descriptor */ - flags = 0; - if (rxout == (di->nrxd - 1)) - flags = D64_CTRL1_EOT; - - dma64_dd_upd(di, di->rxd64, pa, rxout, &flags, - di->rxbufsize); - rxout = nextrxd(di, rxout); - } - - di->rxout = rxout; - - /* update the chip lastdscr pointer */ - bcma_write32(di->core, DMA64RXREGOFFS(di, ptr), - di->rcvptrbase + I2B(rxout, struct dma64desc)); - - return ring_empty; -} - -void dma_rxreclaim(struct dma_pub *pub) -{ - struct dma_info *di = (struct dma_info *)pub; - struct sk_buff *p; - - brcms_dbg_dma(di->core, "%s:\n", di->name); - - while ((p = _dma_getnextrxp(di, true))) - brcmu_pkt_buf_free_skb(p); -} - -void dma_counterreset(struct dma_pub *pub) -{ - /* reset all software counters */ - pub->rxgiants = 0; - pub->rxnobuf = 0; - pub->txnobuf = 0; -} - -/* get the address of the var in order to change later */ -unsigned long dma_getvar(struct dma_pub *pub, const char *name) -{ - struct dma_info *di = (struct dma_info *)pub; - - if (!strcmp(name, "&txavail")) - return (unsigned long)&(di->dma.txavail); - return 0; -} - -/* 64-bit DMA functions */ - -void dma_txinit(struct dma_pub *pub) -{ - struct dma_info *di = (struct dma_info *)pub; - u32 control = D64_XC_XE; - - brcms_dbg_dma(di->core, "%s:\n", di->name); - - if (di->ntxd == 0) - return; - - di->txin = di->txout = 0; - di->dma.txavail = di->ntxd - 1; - - /* clear tx descriptor ring */ - memset(di->txd64, '\0', (di->ntxd * sizeof(struct dma64desc))); - - /* DMA engine with out alignment requirement requires table to be inited - * before enabling the engine - */ - if (!di->aligndesc_4k) - _dma_ddtable_init(di, DMA_TX, di->txdpa); - - if ((di->dma.dmactrlflags & DMA_CTRL_PEN) == 0) - control |= D64_XC_PD; - bcma_set32(di->core, DMA64TXREGOFFS(di, control), control); - - /* DMA engine with alignment requirement requires table to be inited - * before enabling the engine - */ - if (di->aligndesc_4k) - _dma_ddtable_init(di, DMA_TX, di->txdpa); -} - -void dma_txsuspend(struct dma_pub *pub) -{ - struct dma_info *di = (struct dma_info *)pub; - - brcms_dbg_dma(di->core, "%s:\n", di->name); - - if (di->ntxd == 0) - return; - - bcma_set32(di->core, DMA64TXREGOFFS(di, control), D64_XC_SE); -} - -void dma_txresume(struct dma_pub *pub) -{ - struct dma_info *di = (struct dma_info *)pub; - - brcms_dbg_dma(di->core, "%s:\n", di->name); - - if (di->ntxd == 0) - return; - - bcma_mask32(di->core, DMA64TXREGOFFS(di, control), ~D64_XC_SE); -} - -bool dma_txsuspended(struct dma_pub *pub) -{ - struct dma_info *di = (struct dma_info *)pub; - - return (di->ntxd == 0) || - ((bcma_read32(di->core, - DMA64TXREGOFFS(di, control)) & D64_XC_SE) == - D64_XC_SE); -} - -void dma_txreclaim(struct dma_pub *pub, enum txd_range range) -{ - struct dma_info *di = (struct dma_info *)pub; - struct sk_buff *p; - - brcms_dbg_dma(di->core, "%s: %s\n", - di->name, - range == DMA_RANGE_ALL ? "all" : - range == DMA_RANGE_TRANSMITTED ? "transmitted" : - "transferred"); - - if (di->txin == di->txout) - return; - - while ((p = dma_getnexttxp(pub, range))) { - /* For unframed data, we don't have any packets to free */ - if (!(di->dma.dmactrlflags & DMA_CTRL_UNFRAMED)) - brcmu_pkt_buf_free_skb(p); - } -} - -bool dma_txreset(struct dma_pub *pub) -{ - struct dma_info *di = (struct dma_info *)pub; - u32 status; - - if (di->ntxd == 0) - return true; - - /* suspend tx DMA first */ - bcma_write32(di->core, DMA64TXREGOFFS(di, control), D64_XC_SE); - SPINWAIT(((status = - (bcma_read32(di->core, DMA64TXREGOFFS(di, status0)) & - D64_XS0_XS_MASK)) != D64_XS0_XS_DISABLED) && - (status != D64_XS0_XS_IDLE) && (status != D64_XS0_XS_STOPPED), - 10000); - - bcma_write32(di->core, DMA64TXREGOFFS(di, control), 0); - SPINWAIT(((status = - (bcma_read32(di->core, DMA64TXREGOFFS(di, status0)) & - D64_XS0_XS_MASK)) != D64_XS0_XS_DISABLED), 10000); - - /* wait for the last transaction to complete */ - udelay(300); - - return status == D64_XS0_XS_DISABLED; -} - -bool dma_rxreset(struct dma_pub *pub) -{ - struct dma_info *di = (struct dma_info *)pub; - u32 status; - - if (di->nrxd == 0) - return true; - - bcma_write32(di->core, DMA64RXREGOFFS(di, control), 0); - SPINWAIT(((status = - (bcma_read32(di->core, DMA64RXREGOFFS(di, status0)) & - D64_RS0_RS_MASK)) != D64_RS0_RS_DISABLED), 10000); - - return status == D64_RS0_RS_DISABLED; -} - -static void dma_txenq(struct dma_info *di, struct sk_buff *p) -{ - unsigned char *data; - uint len; - u16 txout; - u32 flags = 0; - dma_addr_t pa; - - txout = di->txout; - - if (WARN_ON(nexttxd(di, txout) == di->txin)) - return; - - /* - * obtain and initialize transmit descriptor entry. - */ - data = p->data; - len = p->len; - - /* get physical address of buffer start */ - pa = dma_map_single(di->dmadev, data, len, DMA_TO_DEVICE); - /* if mapping failed, free skb */ - if (dma_mapping_error(di->dmadev, pa)) { - brcmu_pkt_buf_free_skb(p); - return; - } - /* With a DMA segment list, Descriptor table is filled - * using the segment list instead of looping over - * buffers in multi-chain DMA. Therefore, EOF for SGLIST - * is when end of segment list is reached. - */ - flags = D64_CTRL1_SOF | D64_CTRL1_IOC | D64_CTRL1_EOF; - if (txout == (di->ntxd - 1)) - flags |= D64_CTRL1_EOT; - - dma64_dd_upd(di, di->txd64, pa, txout, &flags, len); - - txout = nexttxd(di, txout); - - /* save the packet */ - di->txp[prevtxd(di, txout)] = p; - - /* bump the tx descriptor index */ - di->txout = txout; -} - -static void ampdu_finalize(struct dma_info *di) -{ - struct brcms_ampdu_session *session = &di->ampdu_session; - struct sk_buff *p; - - trace_brcms_ampdu_session(&session->wlc->hw->d11core->dev, - session->max_ampdu_len, - session->max_ampdu_frames, - session->ampdu_len, - skb_queue_len(&session->skb_list), - session->dma_len); - - if (WARN_ON(skb_queue_empty(&session->skb_list))) - return; - - brcms_c_ampdu_finalize(session); - - while (!skb_queue_empty(&session->skb_list)) { - p = skb_dequeue(&session->skb_list); - dma_txenq(di, p); - } - - bcma_write32(di->core, DMA64TXREGOFFS(di, ptr), - di->xmtptrbase + I2B(di->txout, struct dma64desc)); - brcms_c_ampdu_reset_session(session, session->wlc); -} - -static void prep_ampdu_frame(struct dma_info *di, struct sk_buff *p) -{ - struct brcms_ampdu_session *session = &di->ampdu_session; - int ret; - - ret = brcms_c_ampdu_add_frame(session, p); - if (ret == -ENOSPC) { - /* - * AMPDU cannot accomodate this frame. Close out the in- - * progress AMPDU session and start a new one. - */ - ampdu_finalize(di); - ret = brcms_c_ampdu_add_frame(session, p); - } - - WARN_ON(ret); -} - -/* Update count of available tx descriptors based on current DMA state */ -static void dma_update_txavail(struct dma_info *di) -{ - /* - * Available space is number of descriptors less the number of - * active descriptors and the number of queued AMPDU frames. - */ - di->dma.txavail = di->ntxd - ntxdactive(di, di->txin, di->txout) - - skb_queue_len(&di->ampdu_session.skb_list) - 1; -} - -/* - * !! tx entry routine - * WARNING: call must check the return value for error. - * the error(toss frames) could be fatal and cause many subsequent hard - * to debug problems - */ -int dma_txfast(struct brcms_c_info *wlc, struct dma_pub *pub, - struct sk_buff *p) -{ - struct dma_info *di = (struct dma_info *)pub; - struct brcms_ampdu_session *session = &di->ampdu_session; - struct ieee80211_tx_info *tx_info; - bool is_ampdu; - - /* no use to transmit a zero length packet */ - if (p->len == 0) - return 0; - - /* return nonzero if out of tx descriptors */ - if (di->dma.txavail == 0 || nexttxd(di, di->txout) == di->txin) - goto outoftxd; - - tx_info = IEEE80211_SKB_CB(p); - is_ampdu = tx_info->flags & IEEE80211_TX_CTL_AMPDU; - if (is_ampdu) - prep_ampdu_frame(di, p); - else - dma_txenq(di, p); - - /* tx flow control */ - dma_update_txavail(di); - - /* kick the chip */ - if (is_ampdu) { - /* - * Start sending data if we've got a full AMPDU, there's - * no more space in the DMA ring, or the ring isn't - * currently transmitting. - */ - if (skb_queue_len(&session->skb_list) == session->max_ampdu_frames || - di->dma.txavail == 0 || dma64_txidle(di)) - ampdu_finalize(di); - } else { - bcma_write32(di->core, DMA64TXREGOFFS(di, ptr), - di->xmtptrbase + I2B(di->txout, struct dma64desc)); - } - - return 0; - - outoftxd: - brcms_dbg_dma(di->core, "%s: out of txds !!!\n", di->name); - brcmu_pkt_buf_free_skb(p); - di->dma.txavail = 0; - di->dma.txnobuf++; - return -ENOSPC; -} - -void dma_txflush(struct dma_pub *pub) -{ - struct dma_info *di = (struct dma_info *)pub; - struct brcms_ampdu_session *session = &di->ampdu_session; - - if (!skb_queue_empty(&session->skb_list)) - ampdu_finalize(di); -} - -int dma_txpending(struct dma_pub *pub) -{ - struct dma_info *di = (struct dma_info *)pub; - return ntxdactive(di, di->txin, di->txout); -} - -/* - * If we have an active AMPDU session and are not transmitting, - * this function will force tx to start. - */ -void dma_kick_tx(struct dma_pub *pub) -{ - struct dma_info *di = (struct dma_info *)pub; - struct brcms_ampdu_session *session = &di->ampdu_session; - - if (!skb_queue_empty(&session->skb_list) && dma64_txidle(di)) - ampdu_finalize(di); -} - -/* - * Reclaim next completed txd (txds if using chained buffers) in the range - * specified and return associated packet. - * If range is DMA_RANGE_TRANSMITTED, reclaim descriptors that have be - * transmitted as noted by the hardware "CurrDescr" pointer. - * If range is DMA_RANGE_TRANSFERED, reclaim descriptors that have be - * transferred by the DMA as noted by the hardware "ActiveDescr" pointer. - * If range is DMA_RANGE_ALL, reclaim all txd(s) posted to the ring and - * return associated packet regardless of the value of hardware pointers. - */ -struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range) -{ - struct dma_info *di = (struct dma_info *)pub; - u16 start, end, i; - u16 active_desc; - struct sk_buff *txp; - - brcms_dbg_dma(di->core, "%s: %s\n", - di->name, - range == DMA_RANGE_ALL ? "all" : - range == DMA_RANGE_TRANSMITTED ? "transmitted" : - "transferred"); - - if (di->ntxd == 0) - return NULL; - - txp = NULL; - - start = di->txin; - if (range == DMA_RANGE_ALL) - end = di->txout; - else { - end = (u16) (B2I(((bcma_read32(di->core, - DMA64TXREGOFFS(di, status0)) & - D64_XS0_CD_MASK) - di->xmtptrbase) & - D64_XS0_CD_MASK, struct dma64desc)); - - if (range == DMA_RANGE_TRANSFERED) { - active_desc = - (u16)(bcma_read32(di->core, - DMA64TXREGOFFS(di, status1)) & - D64_XS1_AD_MASK); - active_desc = - (active_desc - di->xmtptrbase) & D64_XS0_CD_MASK; - active_desc = B2I(active_desc, struct dma64desc); - if (end != active_desc) - end = prevtxd(di, active_desc); - } - } - - if ((start == 0) && (end > di->txout)) - goto bogus; - - for (i = start; i != end && !txp; i = nexttxd(di, i)) { - dma_addr_t pa; - uint size; - - pa = le32_to_cpu(di->txd64[i].addrlow) - di->dataoffsetlow; - - size = - (le32_to_cpu(di->txd64[i].ctrl2) & - D64_CTRL2_BC_MASK); - - di->txd64[i].addrlow = cpu_to_le32(0xdeadbeef); - di->txd64[i].addrhigh = cpu_to_le32(0xdeadbeef); - - txp = di->txp[i]; - di->txp[i] = NULL; - - dma_unmap_single(di->dmadev, pa, size, DMA_TO_DEVICE); - } - - di->txin = i; - - /* tx flow control */ - dma_update_txavail(di); - - return txp; - - bogus: - brcms_dbg_dma(di->core, "bogus curr: start %d end %d txout %d\n", - start, end, di->txout); - return NULL; -} - -/* - * Mac80211 initiated actions sometimes require packets in the DMA queue to be - * modified. The modified portion of the packet is not under control of the DMA - * engine. This function calls a caller-supplied function for each packet in - * the caller specified dma chain. - */ -void dma_walk_packets(struct dma_pub *dmah, void (*callback_fnc) - (void *pkt, void *arg_a), void *arg_a) -{ - struct dma_info *di = (struct dma_info *) dmah; - uint i = di->txin; - uint end = di->txout; - struct sk_buff *skb; - struct ieee80211_tx_info *tx_info; - - while (i != end) { - skb = di->txp[i]; - if (skb != NULL) { - tx_info = (struct ieee80211_tx_info *)skb->cb; - (callback_fnc)(tx_info, arg_a); - } - i = nexttxd(di, i); - } -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.h b/drivers/net/wireless/brcm80211/brcmsmac/dma.h deleted file mode 100644 index ff5b80b09046..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/dma.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_DMA_H_ -#define _BRCM_DMA_H_ - -#include -#include -#include "types.h" /* forward structure declarations */ - -/* map/unmap direction */ -#define DMA_TX 1 /* TX direction for DMA */ -#define DMA_RX 2 /* RX direction for DMA */ - -/* DMA structure: - * support two DMA engines: 32 bits address or 64 bit addressing - * basic DMA register set is per channel(transmit or receive) - * a pair of channels is defined for convenience - */ - -/* 32 bits addressing */ - -struct dma32diag { /* diag access */ - u32 fifoaddr; /* diag address */ - u32 fifodatalow; /* low 32bits of data */ - u32 fifodatahigh; /* high 32bits of data */ - u32 pad; /* reserved */ -}; - -/* 64 bits addressing */ - -/* dma registers per channel(xmt or rcv) */ -struct dma64regs { - u32 control; /* enable, et al */ - u32 ptr; /* last descriptor posted to chip */ - u32 addrlow; /* desc ring base address low 32-bits (8K aligned) */ - u32 addrhigh; /* desc ring base address bits 63:32 (8K aligned) */ - u32 status0; /* current descriptor, xmt state */ - u32 status1; /* active descriptor, xmt error */ -}; - -/* range param for dma_getnexttxp() and dma_txreclaim */ -enum txd_range { - DMA_RANGE_ALL = 1, - DMA_RANGE_TRANSMITTED, - DMA_RANGE_TRANSFERED -}; - -/* - * Exported data structure (read-only) - */ -/* export structure */ -struct dma_pub { - uint txavail; /* # free tx descriptors */ - uint dmactrlflags; /* dma control flags */ - - /* rx error counters */ - uint rxgiants; /* rx giant frames */ - uint rxnobuf; /* rx out of dma descriptors */ - /* tx error counters */ - uint txnobuf; /* tx out of dma descriptors */ -}; - -extern struct dma_pub *dma_attach(char *name, struct brcms_c_info *wlc, - uint txregbase, uint rxregbase, - uint ntxd, uint nrxd, - uint rxbufsize, int rxextheadroom, - uint nrxpost, uint rxoffset); - -void dma_rxinit(struct dma_pub *pub); -int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list); -bool dma_rxfill(struct dma_pub *pub); -bool dma_rxreset(struct dma_pub *pub); -bool dma_txreset(struct dma_pub *pub); -void dma_txinit(struct dma_pub *pub); -int dma_txfast(struct brcms_c_info *wlc, struct dma_pub *pub, - struct sk_buff *p0); -void dma_txflush(struct dma_pub *pub); -int dma_txpending(struct dma_pub *pub); -void dma_kick_tx(struct dma_pub *pub); -void dma_txsuspend(struct dma_pub *pub); -bool dma_txsuspended(struct dma_pub *pub); -void dma_txresume(struct dma_pub *pub); -void dma_txreclaim(struct dma_pub *pub, enum txd_range range); -void dma_rxreclaim(struct dma_pub *pub); -void dma_detach(struct dma_pub *pub); -unsigned long dma_getvar(struct dma_pub *pub, const char *name); -struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range); -void dma_counterreset(struct dma_pub *pub); - -void dma_walk_packets(struct dma_pub *dmah, void (*callback_fnc) - (void *pkt, void *arg_a), void *arg_a); - -/* - * DMA(Bug) on bcm47xx chips seems to declare that the packet is ready, but - * the packet length is not updated yet (by DMA) on the expected time. - * Workaround is to hold processor till DMA updates the length, and stay off - * the bus to allow DMA update the length in buffer - */ -static inline void dma_spin_for_len(uint len, struct sk_buff *head) -{ -#if defined(CONFIG_BCM47XX) - if (!len) { - while (!(len = *(u16 *) KSEG1ADDR(head->data))) - udelay(1); - - *(u16 *) (head->data) = cpu_to_le16((u16) len); - } -#endif /* defined(CONFIG_BCM47XX) */ -} - -#endif /* _BRCM_DMA_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/led.c b/drivers/net/wireless/brcm80211/brcmsmac/led.c deleted file mode 100644 index 74b17cecb189..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/led.c +++ /dev/null @@ -1,126 +0,0 @@ -#include -#include -#include - -#include "mac80211_if.h" -#include "pub.h" -#include "main.h" -#include "led.h" - - /* number of leds */ -#define BRCMS_LED_NO 4 - /* behavior mask */ -#define BRCMS_LED_BEH_MASK 0x7f - /* activelow (polarity) bit */ -#define BRCMS_LED_AL_MASK 0x80 - /* radio enabled */ -#define BRCMS_LED_RADIO 3 - -static void brcms_radio_led_ctrl(struct brcms_info *wl, bool state) -{ - if (wl->radio_led.gpio == -1) - return; - - if (wl->radio_led.active_low) - state = !state; - - if (state) - gpio_set_value(wl->radio_led.gpio, 1); - else - gpio_set_value(wl->radio_led.gpio, 0); -} - - -/* Callback from the LED subsystem. */ -static void brcms_led_brightness_set(struct led_classdev *led_dev, - enum led_brightness brightness) -{ - struct brcms_info *wl = container_of(led_dev, - struct brcms_info, led_dev); - brcms_radio_led_ctrl(wl, brightness); -} - -void brcms_led_unregister(struct brcms_info *wl) -{ - if (wl->led_dev.dev) - led_classdev_unregister(&wl->led_dev); - if (wl->radio_led.gpio != -1) - gpio_free(wl->radio_led.gpio); -} - -int brcms_led_register(struct brcms_info *wl) -{ - int i, err; - struct brcms_led *radio_led = &wl->radio_led; - /* get CC core */ - struct bcma_drv_cc *cc_drv = &wl->wlc->hw->d11core->bus->drv_cc; - struct gpio_chip *bcma_gpio = &cc_drv->gpio; - struct ssb_sprom *sprom = &wl->wlc->hw->d11core->bus->sprom; - u8 *leds[] = { &sprom->gpio0, - &sprom->gpio1, - &sprom->gpio2, - &sprom->gpio3 }; - unsigned gpio = -1; - bool active_low = false; - - /* none by default */ - radio_led->gpio = -1; - radio_led->active_low = false; - - if (!bcma_gpio || !gpio_is_valid(bcma_gpio->base)) - return -ENODEV; - - /* find radio enabled LED */ - for (i = 0; i < BRCMS_LED_NO; i++) { - u8 led = *leds[i]; - if ((led & BRCMS_LED_BEH_MASK) == BRCMS_LED_RADIO) { - gpio = bcma_gpio->base + i; - if (led & BRCMS_LED_AL_MASK) - active_low = true; - break; - } - } - - if (gpio == -1 || !gpio_is_valid(gpio)) - return -ENODEV; - - /* request and configure LED gpio */ - err = gpio_request_one(gpio, - active_low ? GPIOF_OUT_INIT_HIGH - : GPIOF_OUT_INIT_LOW, - "radio on"); - if (err) { - wiphy_err(wl->wiphy, "requesting led gpio %d failed (err: %d)\n", - gpio, err); - return err; - } - err = gpio_direction_output(gpio, 1); - if (err) { - wiphy_err(wl->wiphy, "cannot set led gpio %d to output (err: %d)\n", - gpio, err); - return err; - } - - snprintf(wl->radio_led.name, sizeof(wl->radio_led.name), - "brcmsmac-%s:radio", wiphy_name(wl->wiphy)); - - wl->led_dev.name = wl->radio_led.name; - wl->led_dev.default_trigger = - ieee80211_get_radio_led_name(wl->pub->ieee_hw); - wl->led_dev.brightness_set = brcms_led_brightness_set; - err = led_classdev_register(wiphy_dev(wl->wiphy), &wl->led_dev); - - if (err) { - wiphy_err(wl->wiphy, "cannot register led device: %s (err: %d)\n", - wl->radio_led.name, err); - return err; - } - - wiphy_info(wl->wiphy, "registered radio enabled led device: %s gpio: %d\n", - wl->radio_led.name, - gpio); - radio_led->gpio = gpio; - radio_led->active_low = active_low; - - return 0; -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/led.h b/drivers/net/wireless/brcm80211/brcmsmac/led.h deleted file mode 100644 index 17a0b1f5dbcf..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/led.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2012 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_LED_H_ -#define _BRCM_LED_H_ -struct brcms_led { - char name[32]; - unsigned gpio; - bool active_low; -}; - -#ifdef CONFIG_BCMA_DRIVER_GPIO -void brcms_led_unregister(struct brcms_info *wl); -int brcms_led_register(struct brcms_info *wl); -#else -static inline void brcms_led_unregister(struct brcms_info *wl) {}; -static inline int brcms_led_register(struct brcms_info *wl) -{ - return -ENOTSUPP; -}; -#endif - -#endif /* _BRCM_LED_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c deleted file mode 100644 index 3a6544710c8a..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +++ /dev/null @@ -1,1707 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * Copyright (c) 2013 Hauke Mehrtens - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define __UNDEF_NO_VERSION__ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include "phy/phy_int.h" -#include "d11.h" -#include "channel.h" -#include "scb.h" -#include "pub.h" -#include "ucode_loader.h" -#include "mac80211_if.h" -#include "main.h" -#include "debug.h" -#include "led.h" - -#define N_TX_QUEUES 4 /* #tx queues on mac80211<->driver interface */ -#define BRCMS_FLUSH_TIMEOUT 500 /* msec */ - -/* Flags we support */ -#define MAC_FILTERS (FIF_PROMISC_IN_BSS | \ - FIF_ALLMULTI | \ - FIF_FCSFAIL | \ - FIF_CONTROL | \ - FIF_OTHER_BSS | \ - FIF_BCN_PRBRESP_PROMISC | \ - FIF_PSPOLL) - -#define CHAN2GHZ(channel, freqency, chflags) { \ - .band = IEEE80211_BAND_2GHZ, \ - .center_freq = (freqency), \ - .hw_value = (channel), \ - .flags = chflags, \ - .max_antenna_gain = 0, \ - .max_power = 19, \ -} - -#define CHAN5GHZ(channel, chflags) { \ - .band = IEEE80211_BAND_5GHZ, \ - .center_freq = 5000 + 5*(channel), \ - .hw_value = (channel), \ - .flags = chflags, \ - .max_antenna_gain = 0, \ - .max_power = 21, \ -} - -#define RATE(rate100m, _flags) { \ - .bitrate = (rate100m), \ - .flags = (_flags), \ - .hw_value = (rate100m / 5), \ -} - -struct firmware_hdr { - __le32 offset; - __le32 len; - __le32 idx; -}; - -static const char * const brcms_firmwares[MAX_FW_IMAGES] = { - "brcm/bcm43xx", - NULL -}; - -static int n_adapters_found; - -MODULE_AUTHOR("Broadcom Corporation"); -MODULE_DESCRIPTION("Broadcom 802.11n wireless LAN driver."); -MODULE_SUPPORTED_DEVICE("Broadcom 802.11n WLAN cards"); -MODULE_LICENSE("Dual BSD/GPL"); -/* This needs to be adjusted when brcms_firmwares changes */ -MODULE_FIRMWARE("brcm/bcm43xx-0.fw"); -MODULE_FIRMWARE("brcm/bcm43xx_hdr-0.fw"); - -/* recognized BCMA Core IDs */ -static struct bcma_device_id brcms_coreid_table[] = { - BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 17, BCMA_ANY_CLASS), - BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 23, BCMA_ANY_CLASS), - BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 24, BCMA_ANY_CLASS), - BCMA_CORETABLE_END -}; -MODULE_DEVICE_TABLE(bcma, brcms_coreid_table); - -#if defined(CONFIG_BRCMDBG) -/* - * Module parameter for setting the debug message level. Available - * flags are specified by the BRCM_DL_* macros in - * drivers/net/wireless/brcm80211/include/defs.h. - */ -module_param_named(debug, brcm_msg_level, uint, S_IRUGO | S_IWUSR); -#endif - -static struct ieee80211_channel brcms_2ghz_chantable[] = { - CHAN2GHZ(1, 2412, IEEE80211_CHAN_NO_HT40MINUS), - CHAN2GHZ(2, 2417, IEEE80211_CHAN_NO_HT40MINUS), - CHAN2GHZ(3, 2422, IEEE80211_CHAN_NO_HT40MINUS), - CHAN2GHZ(4, 2427, IEEE80211_CHAN_NO_HT40MINUS), - CHAN2GHZ(5, 2432, 0), - CHAN2GHZ(6, 2437, 0), - CHAN2GHZ(7, 2442, 0), - CHAN2GHZ(8, 2447, IEEE80211_CHAN_NO_HT40PLUS), - CHAN2GHZ(9, 2452, IEEE80211_CHAN_NO_HT40PLUS), - CHAN2GHZ(10, 2457, IEEE80211_CHAN_NO_HT40PLUS), - CHAN2GHZ(11, 2462, IEEE80211_CHAN_NO_HT40PLUS), - CHAN2GHZ(12, 2467, - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_NO_HT40PLUS), - CHAN2GHZ(13, 2472, - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_NO_HT40PLUS), - CHAN2GHZ(14, 2484, - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS | - IEEE80211_CHAN_NO_OFDM) -}; - -static struct ieee80211_channel brcms_5ghz_nphy_chantable[] = { - /* UNII-1 */ - CHAN5GHZ(36, IEEE80211_CHAN_NO_HT40MINUS), - CHAN5GHZ(40, IEEE80211_CHAN_NO_HT40PLUS), - CHAN5GHZ(44, IEEE80211_CHAN_NO_HT40MINUS), - CHAN5GHZ(48, IEEE80211_CHAN_NO_HT40PLUS), - /* UNII-2 */ - CHAN5GHZ(52, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40MINUS), - CHAN5GHZ(56, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40PLUS), - CHAN5GHZ(60, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40MINUS), - CHAN5GHZ(64, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40PLUS), - /* MID */ - CHAN5GHZ(100, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40MINUS), - CHAN5GHZ(104, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40PLUS), - CHAN5GHZ(108, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40MINUS), - CHAN5GHZ(112, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40PLUS), - CHAN5GHZ(116, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40MINUS), - CHAN5GHZ(120, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40PLUS), - CHAN5GHZ(124, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40MINUS), - CHAN5GHZ(128, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40PLUS), - CHAN5GHZ(132, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40MINUS), - CHAN5GHZ(136, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40PLUS), - CHAN5GHZ(140, - IEEE80211_CHAN_RADAR | IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_HT40PLUS | - IEEE80211_CHAN_NO_HT40MINUS), - /* UNII-3 */ - CHAN5GHZ(149, IEEE80211_CHAN_NO_HT40MINUS), - CHAN5GHZ(153, IEEE80211_CHAN_NO_HT40PLUS), - CHAN5GHZ(157, IEEE80211_CHAN_NO_HT40MINUS), - CHAN5GHZ(161, IEEE80211_CHAN_NO_HT40PLUS), - CHAN5GHZ(165, IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) -}; - -/* - * The rate table is used for both 2.4G and 5G rates. The - * latter being a subset as it does not support CCK rates. - */ -static struct ieee80211_rate legacy_ratetable[] = { - RATE(10, 0), - RATE(20, IEEE80211_RATE_SHORT_PREAMBLE), - RATE(55, IEEE80211_RATE_SHORT_PREAMBLE), - RATE(110, IEEE80211_RATE_SHORT_PREAMBLE), - RATE(60, 0), - RATE(90, 0), - RATE(120, 0), - RATE(180, 0), - RATE(240, 0), - RATE(360, 0), - RATE(480, 0), - RATE(540, 0), -}; - -static const struct ieee80211_supported_band brcms_band_2GHz_nphy_template = { - .band = IEEE80211_BAND_2GHZ, - .channels = brcms_2ghz_chantable, - .n_channels = ARRAY_SIZE(brcms_2ghz_chantable), - .bitrates = legacy_ratetable, - .n_bitrates = ARRAY_SIZE(legacy_ratetable), - .ht_cap = { - /* from include/linux/ieee80211.h */ - .cap = IEEE80211_HT_CAP_GRN_FLD | - IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40, - .ht_supported = true, - .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, - .ampdu_density = AMPDU_DEF_MPDU_DENSITY, - .mcs = { - /* placeholders for now */ - .rx_mask = {0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0}, - .rx_highest = cpu_to_le16(500), - .tx_params = IEEE80211_HT_MCS_TX_DEFINED} - } -}; - -static const struct ieee80211_supported_band brcms_band_5GHz_nphy_template = { - .band = IEEE80211_BAND_5GHZ, - .channels = brcms_5ghz_nphy_chantable, - .n_channels = ARRAY_SIZE(brcms_5ghz_nphy_chantable), - .bitrates = legacy_ratetable + BRCMS_LEGACY_5G_RATE_OFFSET, - .n_bitrates = ARRAY_SIZE(legacy_ratetable) - - BRCMS_LEGACY_5G_RATE_OFFSET, - .ht_cap = { - .cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 | - IEEE80211_HT_CAP_SGI_40, - .ht_supported = true, - .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, - .ampdu_density = AMPDU_DEF_MPDU_DENSITY, - .mcs = { - /* placeholders for now */ - .rx_mask = {0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0}, - .rx_highest = cpu_to_le16(500), - .tx_params = IEEE80211_HT_MCS_TX_DEFINED} - } -}; - -/* flags the given rate in rateset as requested */ -static void brcms_set_basic_rate(struct brcm_rateset *rs, u16 rate, bool is_br) -{ - u32 i; - - for (i = 0; i < rs->count; i++) { - if (rate != (rs->rates[i] & 0x7f)) - continue; - - if (is_br) - rs->rates[i] |= BRCMS_RATE_FLAG; - else - rs->rates[i] &= BRCMS_RATE_MASK; - return; - } -} - -/** - * This function frees the WL per-device resources. - * - * This function frees resources owned by the WL device pointed to - * by the wl parameter. - * - * precondition: can both be called locked and unlocked - * - */ -static void brcms_free(struct brcms_info *wl) -{ - struct brcms_timer *t, *next; - - /* free ucode data */ - if (wl->fw.fw_cnt) - brcms_ucode_data_free(&wl->ucode); - if (wl->irq) - free_irq(wl->irq, wl); - - /* kill dpc */ - tasklet_kill(&wl->tasklet); - - if (wl->pub) { - brcms_debugfs_detach(wl->pub); - brcms_c_module_unregister(wl->pub, "linux", wl); - } - - /* free common resources */ - if (wl->wlc) { - brcms_c_detach(wl->wlc); - wl->wlc = NULL; - wl->pub = NULL; - } - - /* virtual interface deletion is deferred so we cannot spinwait */ - - /* wait for all pending callbacks to complete */ - while (atomic_read(&wl->callbacks) > 0) - schedule(); - - /* free timers */ - for (t = wl->timers; t; t = next) { - next = t->next; -#ifdef DEBUG - kfree(t->name); -#endif - kfree(t); - } -} - -/* -* called from both kernel as from this kernel module (error flow on attach) -* precondition: perimeter lock is not acquired. -*/ -static void brcms_remove(struct bcma_device *pdev) -{ - struct ieee80211_hw *hw = bcma_get_drvdata(pdev); - struct brcms_info *wl = hw->priv; - - if (wl->wlc) { - brcms_led_unregister(wl); - wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, false); - wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); - ieee80211_unregister_hw(hw); - } - - brcms_free(wl); - - bcma_set_drvdata(pdev, NULL); - ieee80211_free_hw(hw); -} - -/* - * Precondition: Since this function is called in brcms_pci_probe() context, - * no locking is required. - */ -static void brcms_release_fw(struct brcms_info *wl) -{ - int i; - for (i = 0; i < MAX_FW_IMAGES; i++) { - release_firmware(wl->fw.fw_bin[i]); - release_firmware(wl->fw.fw_hdr[i]); - } -} - -/* - * Precondition: Since this function is called in brcms_pci_probe() context, - * no locking is required. - */ -static int brcms_request_fw(struct brcms_info *wl, struct bcma_device *pdev) -{ - int status; - struct device *device = &pdev->dev; - char fw_name[100]; - int i; - - memset(&wl->fw, 0, sizeof(struct brcms_firmware)); - for (i = 0; i < MAX_FW_IMAGES; i++) { - if (brcms_firmwares[i] == NULL) - break; - sprintf(fw_name, "%s-%d.fw", brcms_firmwares[i], - UCODE_LOADER_API_VER); - status = request_firmware(&wl->fw.fw_bin[i], fw_name, device); - if (status) { - wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n", - KBUILD_MODNAME, fw_name); - return status; - } - sprintf(fw_name, "%s_hdr-%d.fw", brcms_firmwares[i], - UCODE_LOADER_API_VER); - status = request_firmware(&wl->fw.fw_hdr[i], fw_name, device); - if (status) { - wiphy_err(wl->wiphy, "%s: fail to load firmware %s\n", - KBUILD_MODNAME, fw_name); - return status; - } - wl->fw.hdr_num_entries[i] = - wl->fw.fw_hdr[i]->size / (sizeof(struct firmware_hdr)); - } - wl->fw.fw_cnt = i; - status = brcms_ucode_data_init(wl, &wl->ucode); - brcms_release_fw(wl); - return status; -} - -static void brcms_ops_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct brcms_info *wl = hw->priv; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - - spin_lock_bh(&wl->lock); - if (!wl->pub->up) { - brcms_err(wl->wlc->hw->d11core, "ops->tx called while down\n"); - kfree_skb(skb); - goto done; - } - if (brcms_c_sendpkt_mac80211(wl->wlc, skb, hw)) - tx_info->rate_driver_data[0] = control->sta; - done: - spin_unlock_bh(&wl->lock); -} - -static int brcms_ops_start(struct ieee80211_hw *hw) -{ - struct brcms_info *wl = hw->priv; - bool blocked; - int err; - - ieee80211_wake_queues(hw); - spin_lock_bh(&wl->lock); - blocked = brcms_rfkill_set_hw_state(wl); - spin_unlock_bh(&wl->lock); - if (!blocked) - wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); - - if (!wl->ucode.bcm43xx_bomminor) { - err = brcms_request_fw(wl, wl->wlc->hw->d11core); - if (err) { - brcms_remove(wl->wlc->hw->d11core); - return -ENOENT; - } - } - - spin_lock_bh(&wl->lock); - /* avoid acknowledging frames before a non-monitor device is added */ - wl->mute_tx = true; - - if (!wl->pub->up) - if (!blocked) - err = brcms_up(wl); - else - err = -ERFKILL; - else - err = -ENODEV; - spin_unlock_bh(&wl->lock); - - if (err != 0) - brcms_err(wl->wlc->hw->d11core, "%s: brcms_up() returned %d\n", - __func__, err); - return err; -} - -static void brcms_ops_stop(struct ieee80211_hw *hw) -{ - struct brcms_info *wl = hw->priv; - int status; - - ieee80211_stop_queues(hw); - - if (wl->wlc == NULL) - return; - - spin_lock_bh(&wl->lock); - status = brcms_c_chipmatch(wl->wlc->hw->d11core); - spin_unlock_bh(&wl->lock); - if (!status) { - brcms_err(wl->wlc->hw->d11core, - "wl: brcms_ops_stop: chipmatch failed\n"); - return; - } - - /* put driver in down state */ - spin_lock_bh(&wl->lock); - brcms_down(wl); - spin_unlock_bh(&wl->lock); -} - -static int -brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct brcms_info *wl = hw->priv; - - /* Just STA, AP and ADHOC for now */ - if (vif->type != NL80211_IFTYPE_STATION && - vif->type != NL80211_IFTYPE_AP && - vif->type != NL80211_IFTYPE_ADHOC) { - brcms_err(wl->wlc->hw->d11core, - "%s: Attempt to add type %d, only STA, AP and AdHoc for now\n", - __func__, vif->type); - return -EOPNOTSUPP; - } - - spin_lock_bh(&wl->lock); - wl->mute_tx = false; - brcms_c_mute(wl->wlc, false); - if (vif->type == NL80211_IFTYPE_STATION) - brcms_c_start_station(wl->wlc, vif->addr); - else if (vif->type == NL80211_IFTYPE_AP) - brcms_c_start_ap(wl->wlc, vif->addr, vif->bss_conf.bssid, - vif->bss_conf.ssid, vif->bss_conf.ssid_len); - else if (vif->type == NL80211_IFTYPE_ADHOC) - brcms_c_start_adhoc(wl->wlc, vif->addr); - spin_unlock_bh(&wl->lock); - - return 0; -} - -static void -brcms_ops_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ -} - -static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed) -{ - struct ieee80211_conf *conf = &hw->conf; - struct brcms_info *wl = hw->priv; - struct bcma_device *core = wl->wlc->hw->d11core; - int err = 0; - int new_int; - - spin_lock_bh(&wl->lock); - if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { - brcms_c_set_beacon_listen_interval(wl->wlc, - conf->listen_interval); - } - if (changed & IEEE80211_CONF_CHANGE_MONITOR) - brcms_dbg_info(core, "%s: change monitor mode: %s\n", - __func__, conf->flags & IEEE80211_CONF_MONITOR ? - "true" : "false"); - if (changed & IEEE80211_CONF_CHANGE_PS) - brcms_err(core, "%s: change power-save mode: %s (implement)\n", - __func__, conf->flags & IEEE80211_CONF_PS ? - "true" : "false"); - - if (changed & IEEE80211_CONF_CHANGE_POWER) { - err = brcms_c_set_tx_power(wl->wlc, conf->power_level); - if (err < 0) { - brcms_err(core, "%s: Error setting power_level\n", - __func__); - goto config_out; - } - new_int = brcms_c_get_tx_power(wl->wlc); - if (new_int != conf->power_level) - brcms_err(core, - "%s: Power level req != actual, %d %d\n", - __func__, conf->power_level, - new_int); - } - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { - if (conf->chandef.width == NL80211_CHAN_WIDTH_20 || - conf->chandef.width == NL80211_CHAN_WIDTH_20_NOHT) - err = brcms_c_set_channel(wl->wlc, - conf->chandef.chan->hw_value); - else - err = -ENOTSUPP; - } - if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) - err = brcms_c_set_rate_limit(wl->wlc, - conf->short_frame_max_tx_count, - conf->long_frame_max_tx_count); - - config_out: - spin_unlock_bh(&wl->lock); - return err; -} - -static void -brcms_ops_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *info, u32 changed) -{ - struct brcms_info *wl = hw->priv; - struct bcma_device *core = wl->wlc->hw->d11core; - - if (changed & BSS_CHANGED_ASSOC) { - /* association status changed (associated/disassociated) - * also implies a change in the AID. - */ - brcms_err(core, "%s: %s: %sassociated\n", KBUILD_MODNAME, - __func__, info->assoc ? "" : "dis"); - spin_lock_bh(&wl->lock); - brcms_c_associate_upd(wl->wlc, info->assoc); - spin_unlock_bh(&wl->lock); - } - if (changed & BSS_CHANGED_ERP_SLOT) { - s8 val; - - /* slot timing changed */ - if (info->use_short_slot) - val = 1; - else - val = 0; - spin_lock_bh(&wl->lock); - brcms_c_set_shortslot_override(wl->wlc, val); - spin_unlock_bh(&wl->lock); - } - - if (changed & BSS_CHANGED_HT) { - /* 802.11n parameters changed */ - u16 mode = info->ht_operation_mode; - - spin_lock_bh(&wl->lock); - brcms_c_protection_upd(wl->wlc, BRCMS_PROT_N_CFG, - mode & IEEE80211_HT_OP_MODE_PROTECTION); - brcms_c_protection_upd(wl->wlc, BRCMS_PROT_N_NONGF, - mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); - brcms_c_protection_upd(wl->wlc, BRCMS_PROT_N_OBSS, - mode & IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT); - spin_unlock_bh(&wl->lock); - } - if (changed & BSS_CHANGED_BASIC_RATES) { - struct ieee80211_supported_band *bi; - u32 br_mask, i; - u16 rate; - struct brcm_rateset rs; - int error; - - /* retrieve the current rates */ - spin_lock_bh(&wl->lock); - brcms_c_get_current_rateset(wl->wlc, &rs); - spin_unlock_bh(&wl->lock); - - br_mask = info->basic_rates; - bi = hw->wiphy->bands[brcms_c_get_curband(wl->wlc)]; - for (i = 0; i < bi->n_bitrates; i++) { - /* convert to internal rate value */ - rate = (bi->bitrates[i].bitrate << 1) / 10; - - /* set/clear basic rate flag */ - brcms_set_basic_rate(&rs, rate, br_mask & 1); - br_mask >>= 1; - } - - /* update the rate set */ - spin_lock_bh(&wl->lock); - error = brcms_c_set_rateset(wl->wlc, &rs); - spin_unlock_bh(&wl->lock); - if (error) - brcms_err(core, "changing basic rates failed: %d\n", - error); - } - if (changed & BSS_CHANGED_BEACON_INT) { - /* Beacon interval changed */ - spin_lock_bh(&wl->lock); - brcms_c_set_beacon_period(wl->wlc, info->beacon_int); - spin_unlock_bh(&wl->lock); - } - if (changed & BSS_CHANGED_BSSID) { - /* BSSID changed, for whatever reason (IBSS and managed mode) */ - spin_lock_bh(&wl->lock); - brcms_c_set_addrmatch(wl->wlc, RCM_BSSID_OFFSET, info->bssid); - spin_unlock_bh(&wl->lock); - } - if (changed & BSS_CHANGED_SSID) { - /* BSSID changed, for whatever reason (IBSS and managed mode) */ - spin_lock_bh(&wl->lock); - brcms_c_set_ssid(wl->wlc, info->ssid, info->ssid_len); - spin_unlock_bh(&wl->lock); - } - if (changed & BSS_CHANGED_BEACON) { - /* Beacon data changed, retrieve new beacon (beaconing modes) */ - struct sk_buff *beacon; - u16 tim_offset = 0; - - spin_lock_bh(&wl->lock); - beacon = ieee80211_beacon_get_tim(hw, vif, &tim_offset, NULL); - brcms_c_set_new_beacon(wl->wlc, beacon, tim_offset, - info->dtim_period); - spin_unlock_bh(&wl->lock); - } - - if (changed & BSS_CHANGED_AP_PROBE_RESP) { - struct sk_buff *probe_resp; - - spin_lock_bh(&wl->lock); - probe_resp = ieee80211_proberesp_get(hw, vif); - brcms_c_set_new_probe_resp(wl->wlc, probe_resp); - spin_unlock_bh(&wl->lock); - } - - if (changed & BSS_CHANGED_BEACON_ENABLED) { - /* Beaconing should be enabled/disabled (beaconing modes) */ - brcms_err(core, "%s: Beacon enabled: %s\n", __func__, - info->enable_beacon ? "true" : "false"); - if (info->enable_beacon && - hw->wiphy->flags & WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD) { - brcms_c_enable_probe_resp(wl->wlc, true); - } else { - brcms_c_enable_probe_resp(wl->wlc, false); - } - } - - if (changed & BSS_CHANGED_CQM) { - /* Connection quality monitor config changed */ - brcms_err(core, "%s: cqm change: threshold %d, hys %d " - " (implement)\n", __func__, info->cqm_rssi_thold, - info->cqm_rssi_hyst); - } - - if (changed & BSS_CHANGED_IBSS) { - /* IBSS join status changed */ - brcms_err(core, "%s: IBSS joined: %s (implement)\n", - __func__, info->ibss_joined ? "true" : "false"); - } - - if (changed & BSS_CHANGED_ARP_FILTER) { - /* Hardware ARP filter address list or state changed */ - brcms_err(core, "%s: arp filtering: %d addresses" - " (implement)\n", __func__, info->arp_addr_cnt); - } - - if (changed & BSS_CHANGED_QOS) { - /* - * QoS for this association was enabled/disabled. - * Note that it is only ever disabled for station mode. - */ - brcms_err(core, "%s: qos enabled: %s (implement)\n", - __func__, info->qos ? "true" : "false"); - } - return; -} - -static void -brcms_ops_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *total_flags, u64 multicast) -{ - struct brcms_info *wl = hw->priv; - struct bcma_device *core = wl->wlc->hw->d11core; - - changed_flags &= MAC_FILTERS; - *total_flags &= MAC_FILTERS; - - if (changed_flags & FIF_PROMISC_IN_BSS) - brcms_dbg_info(core, "FIF_PROMISC_IN_BSS\n"); - if (changed_flags & FIF_ALLMULTI) - brcms_dbg_info(core, "FIF_ALLMULTI\n"); - if (changed_flags & FIF_FCSFAIL) - brcms_dbg_info(core, "FIF_FCSFAIL\n"); - if (changed_flags & FIF_CONTROL) - brcms_dbg_info(core, "FIF_CONTROL\n"); - if (changed_flags & FIF_OTHER_BSS) - brcms_dbg_info(core, "FIF_OTHER_BSS\n"); - if (changed_flags & FIF_PSPOLL) - brcms_dbg_info(core, "FIF_PSPOLL\n"); - if (changed_flags & FIF_BCN_PRBRESP_PROMISC) - brcms_dbg_info(core, "FIF_BCN_PRBRESP_PROMISC\n"); - - spin_lock_bh(&wl->lock); - brcms_c_mac_promisc(wl->wlc, *total_flags); - spin_unlock_bh(&wl->lock); - return; -} - -static void brcms_ops_sw_scan_start(struct ieee80211_hw *hw) -{ - struct brcms_info *wl = hw->priv; - spin_lock_bh(&wl->lock); - brcms_c_scan_start(wl->wlc); - spin_unlock_bh(&wl->lock); - return; -} - -static void brcms_ops_sw_scan_complete(struct ieee80211_hw *hw) -{ - struct brcms_info *wl = hw->priv; - spin_lock_bh(&wl->lock); - brcms_c_scan_stop(wl->wlc); - spin_unlock_bh(&wl->lock); - return; -} - -static int -brcms_ops_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - struct brcms_info *wl = hw->priv; - - spin_lock_bh(&wl->lock); - brcms_c_wme_setparams(wl->wlc, queue, params, true); - spin_unlock_bh(&wl->lock); - - return 0; -} - -static int -brcms_ops_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct brcms_info *wl = hw->priv; - struct scb *scb = &wl->wlc->pri_scb; - - brcms_c_init_scb(scb); - - wl->pub->global_ampdu = &(scb->scb_ampdu); - wl->pub->global_ampdu->scb = scb; - wl->pub->global_ampdu->max_pdu = 16; - - /* - * minstrel_ht initiates addBA on our behalf by calling - * ieee80211_start_tx_ba_session() - */ - return 0; -} - -static int -brcms_ops_ampdu_action(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, u16 tid, u16 *ssn, - u8 buf_size) -{ - struct brcms_info *wl = hw->priv; - struct scb *scb = &wl->wlc->pri_scb; - int status; - - if (WARN_ON(scb->magic != SCB_MAGIC)) - return -EIDRM; - switch (action) { - case IEEE80211_AMPDU_RX_START: - break; - case IEEE80211_AMPDU_RX_STOP: - break; - case IEEE80211_AMPDU_TX_START: - spin_lock_bh(&wl->lock); - status = brcms_c_aggregatable(wl->wlc, tid); - spin_unlock_bh(&wl->lock); - if (!status) { - brcms_err(wl->wlc->hw->d11core, - "START: tid %d is not agg\'able\n", tid); - return -EINVAL; - } - ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); - break; - - case IEEE80211_AMPDU_TX_STOP_CONT: - case IEEE80211_AMPDU_TX_STOP_FLUSH: - case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: - spin_lock_bh(&wl->lock); - brcms_c_ampdu_flush(wl->wlc, sta, tid); - spin_unlock_bh(&wl->lock); - ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); - break; - case IEEE80211_AMPDU_TX_OPERATIONAL: - /* - * BA window size from ADDBA response ('buf_size') defines how - * many outstanding MPDUs are allowed for the BA stream by - * recipient and traffic class. 'ampdu_factor' gives maximum - * AMPDU size. - */ - spin_lock_bh(&wl->lock); - brcms_c_ampdu_tx_operational(wl->wlc, tid, buf_size, - (1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + - sta->ht_cap.ampdu_factor)) - 1); - spin_unlock_bh(&wl->lock); - /* Power save wakeup */ - break; - default: - brcms_err(wl->wlc->hw->d11core, - "%s: Invalid command, ignoring\n", __func__); - } - - return 0; -} - -static void brcms_ops_rfkill_poll(struct ieee80211_hw *hw) -{ - struct brcms_info *wl = hw->priv; - bool blocked; - - spin_lock_bh(&wl->lock); - blocked = brcms_c_check_radio_disabled(wl->wlc); - spin_unlock_bh(&wl->lock); - - wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, blocked); -} - -static bool brcms_tx_flush_completed(struct brcms_info *wl) -{ - bool result; - - spin_lock_bh(&wl->lock); - result = brcms_c_tx_flush_completed(wl->wlc); - spin_unlock_bh(&wl->lock); - return result; -} - -static void brcms_ops_flush(struct ieee80211_hw *hw, u32 queues, bool drop) -{ - struct brcms_info *wl = hw->priv; - int ret; - - no_printk("%s: drop = %s\n", __func__, drop ? "true" : "false"); - - ret = wait_event_timeout(wl->tx_flush_wq, - brcms_tx_flush_completed(wl), - msecs_to_jiffies(BRCMS_FLUSH_TIMEOUT)); - - brcms_dbg_mac80211(wl->wlc->hw->d11core, - "ret=%d\n", jiffies_to_msecs(ret)); -} - -static u64 brcms_ops_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct brcms_info *wl = hw->priv; - u64 tsf; - - spin_lock_bh(&wl->lock); - tsf = brcms_c_tsf_get(wl->wlc); - spin_unlock_bh(&wl->lock); - - return tsf; -} - -static void brcms_ops_set_tsf(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u64 tsf) -{ - struct brcms_info *wl = hw->priv; - - spin_lock_bh(&wl->lock); - brcms_c_tsf_set(wl->wlc, tsf); - spin_unlock_bh(&wl->lock); -} - -static const struct ieee80211_ops brcms_ops = { - .tx = brcms_ops_tx, - .start = brcms_ops_start, - .stop = brcms_ops_stop, - .add_interface = brcms_ops_add_interface, - .remove_interface = brcms_ops_remove_interface, - .config = brcms_ops_config, - .bss_info_changed = brcms_ops_bss_info_changed, - .configure_filter = brcms_ops_configure_filter, - .sw_scan_start = brcms_ops_sw_scan_start, - .sw_scan_complete = brcms_ops_sw_scan_complete, - .conf_tx = brcms_ops_conf_tx, - .sta_add = brcms_ops_sta_add, - .ampdu_action = brcms_ops_ampdu_action, - .rfkill_poll = brcms_ops_rfkill_poll, - .flush = brcms_ops_flush, - .get_tsf = brcms_ops_get_tsf, - .set_tsf = brcms_ops_set_tsf, -}; - -void brcms_dpc(unsigned long data) -{ - struct brcms_info *wl; - - wl = (struct brcms_info *) data; - - spin_lock_bh(&wl->lock); - - /* call the common second level interrupt handler */ - if (wl->pub->up) { - if (wl->resched) { - unsigned long flags; - - spin_lock_irqsave(&wl->isr_lock, flags); - brcms_c_intrsupd(wl->wlc); - spin_unlock_irqrestore(&wl->isr_lock, flags); - } - - wl->resched = brcms_c_dpc(wl->wlc, true); - } - - /* brcms_c_dpc() may bring the driver down */ - if (!wl->pub->up) - goto done; - - /* re-schedule dpc */ - if (wl->resched) - tasklet_schedule(&wl->tasklet); - else - /* re-enable interrupts */ - brcms_intrson(wl); - - done: - spin_unlock_bh(&wl->lock); - wake_up(&wl->tx_flush_wq); -} - -static irqreturn_t brcms_isr(int irq, void *dev_id) -{ - struct brcms_info *wl; - irqreturn_t ret = IRQ_NONE; - - wl = (struct brcms_info *) dev_id; - - spin_lock(&wl->isr_lock); - - /* call common first level interrupt handler */ - if (brcms_c_isr(wl->wlc)) { - /* schedule second level handler */ - tasklet_schedule(&wl->tasklet); - ret = IRQ_HANDLED; - } - - spin_unlock(&wl->isr_lock); - - return ret; -} - -/* - * is called in brcms_pci_probe() context, therefore no locking required. - */ -static int ieee_hw_rate_init(struct ieee80211_hw *hw) -{ - struct brcms_info *wl = hw->priv; - struct brcms_c_info *wlc = wl->wlc; - struct ieee80211_supported_band *band; - int has_5g = 0; - u16 phy_type; - - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = NULL; - hw->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL; - - phy_type = brcms_c_get_phy_type(wl->wlc, 0); - if (phy_type == PHY_TYPE_N || phy_type == PHY_TYPE_LCN) { - band = &wlc->bandstate[BAND_2G_INDEX]->band; - *band = brcms_band_2GHz_nphy_template; - if (phy_type == PHY_TYPE_LCN) { - /* Single stream */ - band->ht_cap.mcs.rx_mask[1] = 0; - band->ht_cap.mcs.rx_highest = cpu_to_le16(72); - } - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = band; - } else { - return -EPERM; - } - - /* Assume all bands use the same phy. True for 11n devices. */ - if (wl->pub->_nbands > 1) { - has_5g++; - if (phy_type == PHY_TYPE_N || phy_type == PHY_TYPE_LCN) { - band = &wlc->bandstate[BAND_5G_INDEX]->band; - *band = brcms_band_5GHz_nphy_template; - hw->wiphy->bands[IEEE80211_BAND_5GHZ] = band; - } else { - return -EPERM; - } - } - return 0; -} - -/* - * is called in brcms_pci_probe() context, therefore no locking required. - */ -static int ieee_hw_init(struct ieee80211_hw *hw) -{ - hw->flags = IEEE80211_HW_SIGNAL_DBM - /* | IEEE80211_HW_CONNECTION_MONITOR What is this? */ - | IEEE80211_HW_REPORTS_TX_ACK_STATUS - | IEEE80211_HW_AMPDU_AGGREGATION; - - hw->extra_tx_headroom = brcms_c_get_header_len(); - hw->queues = N_TX_QUEUES; - hw->max_rates = 2; /* Primary rate and 1 fallback rate */ - - /* channel change time is dependent on chip and band */ - hw->channel_change_time = 7 * 1000; - hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_ADHOC); - - /* - * deactivate sending probe responses by ucude, because this will - * cause problems when WPS is used. - * - * hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD; - */ - - hw->rate_control_algorithm = "minstrel_ht"; - - hw->sta_data_size = 0; - return ieee_hw_rate_init(hw); -} - -/** - * attach to the WL device. - * - * Attach to the WL device identified by vendor and device parameters. - * regs is a host accessible memory address pointing to WL device registers. - * - * brcms_attach is not defined as static because in the case where no bus - * is defined, wl_attach will never be called, and thus, gcc will issue - * a warning that this function is defined but not used if we declare - * it as static. - * - * - * is called in brcms_bcma_probe() context, therefore no locking required. - */ -static struct brcms_info *brcms_attach(struct bcma_device *pdev) -{ - struct brcms_info *wl = NULL; - int unit, err; - struct ieee80211_hw *hw; - u8 perm[ETH_ALEN]; - - unit = n_adapters_found; - err = 0; - - if (unit < 0) - return NULL; - - /* allocate private info */ - hw = bcma_get_drvdata(pdev); - if (hw != NULL) - wl = hw->priv; - if (WARN_ON(hw == NULL) || WARN_ON(wl == NULL)) - return NULL; - wl->wiphy = hw->wiphy; - - atomic_set(&wl->callbacks, 0); - - init_waitqueue_head(&wl->tx_flush_wq); - - /* setup the bottom half handler */ - tasklet_init(&wl->tasklet, brcms_dpc, (unsigned long) wl); - - spin_lock_init(&wl->lock); - spin_lock_init(&wl->isr_lock); - - /* common load-time initialization */ - wl->wlc = brcms_c_attach((void *)wl, pdev, unit, false, &err); - if (!wl->wlc) { - wiphy_err(wl->wiphy, "%s: attach() failed with code %d\n", - KBUILD_MODNAME, err); - goto fail; - } - wl->pub = brcms_c_pub(wl->wlc); - - wl->pub->ieee_hw = hw; - - /* register our interrupt handler */ - if (request_irq(pdev->irq, brcms_isr, - IRQF_SHARED, KBUILD_MODNAME, wl)) { - wiphy_err(wl->wiphy, "wl%d: request_irq() failed\n", unit); - goto fail; - } - wl->irq = pdev->irq; - - /* register module */ - brcms_c_module_register(wl->pub, "linux", wl, NULL); - - if (ieee_hw_init(hw)) { - wiphy_err(wl->wiphy, "wl%d: %s: ieee_hw_init failed!\n", unit, - __func__); - goto fail; - } - - brcms_c_regd_init(wl->wlc); - - memcpy(perm, &wl->pub->cur_etheraddr, ETH_ALEN); - if (WARN_ON(!is_valid_ether_addr(perm))) - goto fail; - SET_IEEE80211_PERM_ADDR(hw, perm); - - err = ieee80211_register_hw(hw); - if (err) - wiphy_err(wl->wiphy, "%s: ieee80211_register_hw failed, status" - "%d\n", __func__, err); - - if (wl->pub->srom_ccode[0] && - regulatory_hint(wl->wiphy, wl->pub->srom_ccode)) - wiphy_err(wl->wiphy, "%s: regulatory hint failed\n", __func__); - - brcms_debugfs_attach(wl->pub); - brcms_debugfs_create_files(wl->pub); - n_adapters_found++; - return wl; - -fail: - brcms_free(wl); - return NULL; -} - - - -/** - * determines if a device is a WL device, and if so, attaches it. - * - * This function determines if a device pointed to by pdev is a WL device, - * and if so, performs a brcms_attach() on it. - * - * Perimeter lock is initialized in the course of this function. - */ -static int brcms_bcma_probe(struct bcma_device *pdev) -{ - struct brcms_info *wl; - struct ieee80211_hw *hw; - - dev_info(&pdev->dev, "mfg %x core %x rev %d class %d irq %d\n", - pdev->id.manuf, pdev->id.id, pdev->id.rev, pdev->id.class, - pdev->irq); - - if ((pdev->id.manuf != BCMA_MANUF_BCM) || - (pdev->id.id != BCMA_CORE_80211)) - return -ENODEV; - - hw = ieee80211_alloc_hw(sizeof(struct brcms_info), &brcms_ops); - if (!hw) { - pr_err("%s: ieee80211_alloc_hw failed\n", __func__); - return -ENOMEM; - } - - SET_IEEE80211_DEV(hw, &pdev->dev); - - bcma_set_drvdata(pdev, hw); - - memset(hw->priv, 0, sizeof(*wl)); - - wl = brcms_attach(pdev); - if (!wl) { - pr_err("%s: brcms_attach failed!\n", __func__); - return -ENODEV; - } - brcms_led_register(wl); - - return 0; -} - -static int brcms_suspend(struct bcma_device *pdev) -{ - struct brcms_info *wl; - struct ieee80211_hw *hw; - - hw = bcma_get_drvdata(pdev); - wl = hw->priv; - if (!wl) { - pr_err("%s: %s: no driver private struct!\n", KBUILD_MODNAME, - __func__); - return -ENODEV; - } - - /* only need to flag hw is down for proper resume */ - spin_lock_bh(&wl->lock); - wl->pub->hw_up = false; - spin_unlock_bh(&wl->lock); - - brcms_dbg_info(wl->wlc->hw->d11core, "brcms_suspend ok\n"); - - return 0; -} - -static int brcms_resume(struct bcma_device *pdev) -{ - return 0; -} - -static struct bcma_driver brcms_bcma_driver = { - .name = KBUILD_MODNAME, - .probe = brcms_bcma_probe, - .suspend = brcms_suspend, - .resume = brcms_resume, - .remove = brcms_remove, - .id_table = brcms_coreid_table, -}; - -/** - * This is the main entry point for the brcmsmac driver. - * - * This function is scheduled upon module initialization and - * does the driver registration, which result in brcms_bcma_probe() - * call resulting in the driver bringup. - */ -static void brcms_driver_init(struct work_struct *work) -{ - int error; - - error = bcma_driver_register(&brcms_bcma_driver); - if (error) - pr_err("%s: register returned %d\n", __func__, error); -} - -static DECLARE_WORK(brcms_driver_work, brcms_driver_init); - -static int __init brcms_module_init(void) -{ - brcms_debugfs_init(); - if (!schedule_work(&brcms_driver_work)) - return -EBUSY; - - return 0; -} - -/** - * This function unloads the brcmsmac driver from the system. - * - * This function unconditionally unloads the brcmsmac driver module from the - * system. - * - */ -static void __exit brcms_module_exit(void) -{ - cancel_work_sync(&brcms_driver_work); - bcma_driver_unregister(&brcms_bcma_driver); - brcms_debugfs_exit(); -} - -module_init(brcms_module_init); -module_exit(brcms_module_exit); - -/* - * precondition: perimeter lock has been acquired - */ -void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif, - bool state, int prio) -{ - brcms_err(wl->wlc->hw->d11core, "Shouldn't be here %s\n", __func__); -} - -/* - * precondition: perimeter lock has been acquired - */ -void brcms_init(struct brcms_info *wl) -{ - brcms_dbg_info(wl->wlc->hw->d11core, "Initializing wl%d\n", - wl->pub->unit); - brcms_reset(wl); - brcms_c_init(wl->wlc, wl->mute_tx); -} - -/* - * precondition: perimeter lock has been acquired - */ -uint brcms_reset(struct brcms_info *wl) -{ - brcms_dbg_info(wl->wlc->hw->d11core, "Resetting wl%d\n", wl->pub->unit); - brcms_c_reset(wl->wlc); - - /* dpc will not be rescheduled */ - wl->resched = false; - - /* inform publicly that interface is down */ - wl->pub->up = false; - - return 0; -} - -void brcms_fatal_error(struct brcms_info *wl) -{ - brcms_err(wl->wlc->hw->d11core, "wl%d: fatal error, reinitializing\n", - wl->wlc->pub->unit); - brcms_reset(wl); - ieee80211_restart_hw(wl->pub->ieee_hw); -} - -/* - * These are interrupt on/off entry points. Disable interrupts - * during interrupt state transition. - */ -void brcms_intrson(struct brcms_info *wl) -{ - unsigned long flags; - - spin_lock_irqsave(&wl->isr_lock, flags); - brcms_c_intrson(wl->wlc); - spin_unlock_irqrestore(&wl->isr_lock, flags); -} - -u32 brcms_intrsoff(struct brcms_info *wl) -{ - unsigned long flags; - u32 status; - - spin_lock_irqsave(&wl->isr_lock, flags); - status = brcms_c_intrsoff(wl->wlc); - spin_unlock_irqrestore(&wl->isr_lock, flags); - return status; -} - -void brcms_intrsrestore(struct brcms_info *wl, u32 macintmask) -{ - unsigned long flags; - - spin_lock_irqsave(&wl->isr_lock, flags); - brcms_c_intrsrestore(wl->wlc, macintmask); - spin_unlock_irqrestore(&wl->isr_lock, flags); -} - -/* - * precondition: perimeter lock has been acquired - */ -int brcms_up(struct brcms_info *wl) -{ - int error = 0; - - if (wl->pub->up) - return 0; - - error = brcms_c_up(wl->wlc); - - return error; -} - -/* - * precondition: perimeter lock has been acquired - */ -void brcms_down(struct brcms_info *wl) -{ - uint callbacks, ret_val = 0; - - /* call common down function */ - ret_val = brcms_c_down(wl->wlc); - callbacks = atomic_read(&wl->callbacks) - ret_val; - - /* wait for down callbacks to complete */ - spin_unlock_bh(&wl->lock); - - /* For HIGH_only driver, it's important to actually schedule other work, - * not just spin wait since everything runs at schedule level - */ - SPINWAIT((atomic_read(&wl->callbacks) > callbacks), 100 * 1000); - - spin_lock_bh(&wl->lock); -} - -/* -* precondition: perimeter lock is not acquired - */ -static void _brcms_timer(struct work_struct *work) -{ - struct brcms_timer *t = container_of(work, struct brcms_timer, - dly_wrk.work); - - spin_lock_bh(&t->wl->lock); - - if (t->set) { - if (t->periodic) { - atomic_inc(&t->wl->callbacks); - ieee80211_queue_delayed_work(t->wl->pub->ieee_hw, - &t->dly_wrk, - msecs_to_jiffies(t->ms)); - } else { - t->set = false; - } - - t->fn(t->arg); - } - - atomic_dec(&t->wl->callbacks); - - spin_unlock_bh(&t->wl->lock); -} - -/* - * Adds a timer to the list. Caller supplies a timer function. - * Is called from wlc. - * - * precondition: perimeter lock has been acquired - */ -struct brcms_timer *brcms_init_timer(struct brcms_info *wl, - void (*fn) (void *arg), - void *arg, const char *name) -{ - struct brcms_timer *t; - - t = kzalloc(sizeof(struct brcms_timer), GFP_ATOMIC); - if (!t) - return NULL; - - INIT_DELAYED_WORK(&t->dly_wrk, _brcms_timer); - t->wl = wl; - t->fn = fn; - t->arg = arg; - t->next = wl->timers; - wl->timers = t; - -#ifdef DEBUG - t->name = kmalloc(strlen(name) + 1, GFP_ATOMIC); - if (t->name) - strcpy(t->name, name); -#endif - - return t; -} - -/* - * adds only the kernel timer since it's going to be more accurate - * as well as it's easier to make it periodic - * - * precondition: perimeter lock has been acquired - */ -void brcms_add_timer(struct brcms_timer *t, uint ms, int periodic) -{ - struct ieee80211_hw *hw = t->wl->pub->ieee_hw; - -#ifdef DEBUG - if (t->set) - brcms_dbg_info(t->wl->wlc->hw->d11core, - "%s: Already set. Name: %s, per %d\n", - __func__, t->name, periodic); -#endif - t->ms = ms; - t->periodic = (bool) periodic; - if (!t->set) { - t->set = true; - atomic_inc(&t->wl->callbacks); - } - - ieee80211_queue_delayed_work(hw, &t->dly_wrk, msecs_to_jiffies(ms)); -} - -/* - * return true if timer successfully deleted, false if still pending - * - * precondition: perimeter lock has been acquired - */ -bool brcms_del_timer(struct brcms_timer *t) -{ - if (t->set) { - t->set = false; - if (!cancel_delayed_work(&t->dly_wrk)) - return false; - - atomic_dec(&t->wl->callbacks); - } - - return true; -} - -/* - * precondition: perimeter lock has been acquired - */ -void brcms_free_timer(struct brcms_timer *t) -{ - struct brcms_info *wl = t->wl; - struct brcms_timer *tmp; - - /* delete the timer in case it is active */ - brcms_del_timer(t); - - if (wl->timers == t) { - wl->timers = wl->timers->next; -#ifdef DEBUG - kfree(t->name); -#endif - kfree(t); - return; - - } - - tmp = wl->timers; - while (tmp) { - if (tmp->next == t) { - tmp->next = t->next; -#ifdef DEBUG - kfree(t->name); -#endif - kfree(t); - return; - } - tmp = tmp->next; - } - -} - -/* - * precondition: perimeter lock has been acquired - */ -int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, u32 idx) -{ - int i, entry; - const u8 *pdata; - struct firmware_hdr *hdr; - for (i = 0; i < wl->fw.fw_cnt; i++) { - hdr = (struct firmware_hdr *)wl->fw.fw_hdr[i]->data; - for (entry = 0; entry < wl->fw.hdr_num_entries[i]; - entry++, hdr++) { - u32 len = le32_to_cpu(hdr->len); - if (le32_to_cpu(hdr->idx) == idx) { - pdata = wl->fw.fw_bin[i]->data + - le32_to_cpu(hdr->offset); - *pbuf = kmemdup(pdata, len, GFP_ATOMIC); - if (*pbuf == NULL) - goto fail; - - return 0; - } - } - } - brcms_err(wl->wlc->hw->d11core, - "ERROR: ucode buf tag:%d can not be found!\n", idx); - *pbuf = NULL; -fail: - return -ENODATA; -} - -/* - * Precondition: Since this function is called in brcms_bcma_probe() context, - * no locking is required. - */ -int brcms_ucode_init_uint(struct brcms_info *wl, size_t *n_bytes, u32 idx) -{ - int i, entry; - const u8 *pdata; - struct firmware_hdr *hdr; - for (i = 0; i < wl->fw.fw_cnt; i++) { - hdr = (struct firmware_hdr *)wl->fw.fw_hdr[i]->data; - for (entry = 0; entry < wl->fw.hdr_num_entries[i]; - entry++, hdr++) { - if (le32_to_cpu(hdr->idx) == idx) { - pdata = wl->fw.fw_bin[i]->data + - le32_to_cpu(hdr->offset); - if (le32_to_cpu(hdr->len) != 4) { - brcms_err(wl->wlc->hw->d11core, - "ERROR: fw hdr len\n"); - return -ENOMSG; - } - *n_bytes = le32_to_cpu(*((__le32 *) pdata)); - return 0; - } - } - } - brcms_err(wl->wlc->hw->d11core, - "ERROR: ucode tag:%d can not be found!\n", idx); - return -ENOMSG; -} - -/* - * precondition: can both be called locked and unlocked - */ -void brcms_ucode_free_buf(void *p) -{ - kfree(p); -} - -/* - * checks validity of all firmware images loaded from user space - * - * Precondition: Since this function is called in brcms_bcma_probe() context, - * no locking is required. - */ -int brcms_check_firmwares(struct brcms_info *wl) -{ - int i; - int entry; - int rc = 0; - const struct firmware *fw; - const struct firmware *fw_hdr; - struct firmware_hdr *ucode_hdr; - for (i = 0; i < MAX_FW_IMAGES && rc == 0; i++) { - fw = wl->fw.fw_bin[i]; - fw_hdr = wl->fw.fw_hdr[i]; - if (fw == NULL && fw_hdr == NULL) { - break; - } else if (fw == NULL || fw_hdr == NULL) { - wiphy_err(wl->wiphy, "%s: invalid bin/hdr fw\n", - __func__); - rc = -EBADF; - } else if (fw_hdr->size % sizeof(struct firmware_hdr)) { - wiphy_err(wl->wiphy, "%s: non integral fw hdr file " - "size %zu/%zu\n", __func__, fw_hdr->size, - sizeof(struct firmware_hdr)); - rc = -EBADF; - } else if (fw->size < MIN_FW_SIZE || fw->size > MAX_FW_SIZE) { - wiphy_err(wl->wiphy, "%s: out of bounds fw file size %zu\n", - __func__, fw->size); - rc = -EBADF; - } else { - /* check if ucode section overruns firmware image */ - ucode_hdr = (struct firmware_hdr *)fw_hdr->data; - for (entry = 0; entry < wl->fw.hdr_num_entries[i] && - !rc; entry++, ucode_hdr++) { - if (le32_to_cpu(ucode_hdr->offset) + - le32_to_cpu(ucode_hdr->len) > - fw->size) { - wiphy_err(wl->wiphy, - "%s: conflicting bin/hdr\n", - __func__); - rc = -EBADF; - } - } - } - } - if (rc == 0 && wl->fw.fw_cnt != i) { - wiphy_err(wl->wiphy, "%s: invalid fw_cnt=%d\n", __func__, - wl->fw.fw_cnt); - rc = -EBADF; - } - return rc; -} - -/* - * precondition: perimeter lock has been acquired - */ -bool brcms_rfkill_set_hw_state(struct brcms_info *wl) -{ - bool blocked = brcms_c_check_radio_disabled(wl->wlc); - - spin_unlock_bh(&wl->lock); - wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, blocked); - if (blocked) - wiphy_rfkill_start_polling(wl->pub->ieee_hw->wiphy); - spin_lock_bh(&wl->lock); - return blocked; -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h deleted file mode 100644 index 4090032e81a2..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_MAC80211_IF_H_ -#define _BRCM_MAC80211_IF_H_ - -#include -#include -#include -#include - -#include "ucode_loader.h" -#include "led.h" -/* - * Starting index for 5G rates in the - * legacy rate table. - */ -#define BRCMS_LEGACY_5G_RATE_OFFSET 4 - -/* softmac ioctl definitions */ -#define BRCMS_SET_SHORTSLOT_OVERRIDE 146 - -struct brcms_timer { - struct delayed_work dly_wrk; - struct brcms_info *wl; - void (*fn) (void *); /* function called upon expiration */ - void *arg; /* fixed argument provided to called function */ - uint ms; - bool periodic; - bool set; /* indicates if timer is active */ - struct brcms_timer *next; /* for freeing on unload */ -#ifdef DEBUG - char *name; /* Description of the timer */ -#endif -}; - -struct brcms_if { - uint subunit; /* WDS/BSS unit */ - struct pci_dev *pci_dev; -}; - -#define MAX_FW_IMAGES 4 -struct brcms_firmware { - u32 fw_cnt; - const struct firmware *fw_bin[MAX_FW_IMAGES]; - const struct firmware *fw_hdr[MAX_FW_IMAGES]; - u32 hdr_num_entries[MAX_FW_IMAGES]; -}; - -struct brcms_info { - struct brcms_pub *pub; /* pointer to public wlc state */ - struct brcms_c_info *wlc; /* pointer to private common data */ - u32 magic; - - int irq; - - spinlock_t lock; /* per-device perimeter lock */ - spinlock_t isr_lock; /* per-device ISR synchronization lock */ - - /* tx flush */ - wait_queue_head_t tx_flush_wq; - - /* timer related fields */ - atomic_t callbacks; /* # outstanding callback functions */ - struct brcms_timer *timers; /* timer cleanup queue */ - - struct tasklet_struct tasklet; /* dpc tasklet */ - bool resched; /* dpc needs to be and is rescheduled */ - struct brcms_firmware fw; - struct wiphy *wiphy; - struct brcms_ucode ucode; - bool mute_tx; - struct brcms_led radio_led; - struct led_classdev led_dev; -}; - -/* misc callbacks */ -extern void brcms_init(struct brcms_info *wl); -extern uint brcms_reset(struct brcms_info *wl); -extern void brcms_intrson(struct brcms_info *wl); -extern u32 brcms_intrsoff(struct brcms_info *wl); -extern void brcms_intrsrestore(struct brcms_info *wl, u32 macintmask); -extern int brcms_up(struct brcms_info *wl); -extern void brcms_down(struct brcms_info *wl); -extern void brcms_txflowcontrol(struct brcms_info *wl, struct brcms_if *wlif, - bool state, int prio); -extern bool brcms_rfkill_set_hw_state(struct brcms_info *wl); - -/* timer functions */ -extern struct brcms_timer *brcms_init_timer(struct brcms_info *wl, - void (*fn) (void *arg), void *arg, - const char *name); -extern void brcms_free_timer(struct brcms_timer *timer); -extern void brcms_add_timer(struct brcms_timer *timer, uint ms, int periodic); -extern bool brcms_del_timer(struct brcms_timer *timer); -extern void brcms_dpc(unsigned long data); -extern void brcms_timer(struct brcms_timer *t); -extern void brcms_fatal_error(struct brcms_info *wl); - -#endif /* _BRCM_MAC80211_IF_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c deleted file mode 100644 index 9fd6f2fef11b..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c +++ /dev/null @@ -1,8182 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * Copyright (c) 2013 Hauke Mehrtens - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include -#include "rate.h" -#include "scb.h" -#include "phy/phy_hal.h" -#include "channel.h" -#include "antsel.h" -#include "stf.h" -#include "ampdu.h" -#include "mac80211_if.h" -#include "ucode_loader.h" -#include "main.h" -#include "soc.h" -#include "dma.h" -#include "debug.h" -#include "brcms_trace_events.h" - -/* watchdog timer, in unit of ms */ -#define TIMER_INTERVAL_WATCHDOG 1000 -/* radio monitor timer, in unit of ms */ -#define TIMER_INTERVAL_RADIOCHK 800 - -/* beacon interval, in unit of 1024TU */ -#define BEACON_INTERVAL_DEFAULT 100 - -/* n-mode support capability */ -/* 2x2 includes both 1x1 & 2x2 devices - * reserved #define 2 for future when we want to separate 1x1 & 2x2 and - * control it independently - */ -#define WL_11N_2x2 1 -#define WL_11N_3x3 3 -#define WL_11N_4x4 4 - -#define EDCF_ACI_MASK 0x60 -#define EDCF_ACI_SHIFT 5 -#define EDCF_ECWMIN_MASK 0x0f -#define EDCF_ECWMAX_SHIFT 4 -#define EDCF_AIFSN_MASK 0x0f -#define EDCF_AIFSN_MAX 15 -#define EDCF_ECWMAX_MASK 0xf0 - -#define EDCF_AC_BE_TXOP_STA 0x0000 -#define EDCF_AC_BK_TXOP_STA 0x0000 -#define EDCF_AC_VO_ACI_STA 0x62 -#define EDCF_AC_VO_ECW_STA 0x32 -#define EDCF_AC_VI_ACI_STA 0x42 -#define EDCF_AC_VI_ECW_STA 0x43 -#define EDCF_AC_BK_ECW_STA 0xA4 -#define EDCF_AC_VI_TXOP_STA 0x005e -#define EDCF_AC_VO_TXOP_STA 0x002f -#define EDCF_AC_BE_ACI_STA 0x03 -#define EDCF_AC_BE_ECW_STA 0xA4 -#define EDCF_AC_BK_ACI_STA 0x27 -#define EDCF_AC_VO_TXOP_AP 0x002f - -#define EDCF_TXOP2USEC(txop) ((txop) << 5) -#define EDCF_ECW2CW(exp) ((1 << (exp)) - 1) - -#define APHY_SYMBOL_TIME 4 -#define APHY_PREAMBLE_TIME 16 -#define APHY_SIGNAL_TIME 4 -#define APHY_SIFS_TIME 16 -#define APHY_SERVICE_NBITS 16 -#define APHY_TAIL_NBITS 6 -#define BPHY_SIFS_TIME 10 -#define BPHY_PLCP_SHORT_TIME 96 - -#define PREN_PREAMBLE 24 -#define PREN_MM_EXT 12 -#define PREN_PREAMBLE_EXT 4 - -#define DOT11_MAC_HDR_LEN 24 -#define DOT11_ACK_LEN 10 -#define DOT11_BA_LEN 4 -#define DOT11_OFDM_SIGNAL_EXTENSION 6 -#define DOT11_MIN_FRAG_LEN 256 -#define DOT11_RTS_LEN 16 -#define DOT11_CTS_LEN 10 -#define DOT11_BA_BITMAP_LEN 128 -#define DOT11_MAXNUMFRAGS 16 -#define DOT11_MAX_FRAG_LEN 2346 - -#define BPHY_PLCP_TIME 192 -#define RIFS_11N_TIME 2 - -/* length of the BCN template area */ -#define BCN_TMPL_LEN 512 - -/* brcms_bss_info flag bit values */ -#define BRCMS_BSS_HT 0x0020 /* BSS is HT (MIMO) capable */ - -/* chip rx buffer offset */ -#define BRCMS_HWRXOFF 38 - -/* rfdisable delay timer 500 ms, runs of ALP clock */ -#define RFDISABLE_DEFAULT 10000000 - -#define BRCMS_TEMPSENSE_PERIOD 10 /* 10 second timeout */ - -/* synthpu_dly times in us */ -#define SYNTHPU_DLY_APHY_US 3700 -#define SYNTHPU_DLY_BPHY_US 1050 -#define SYNTHPU_DLY_NPHY_US 2048 -#define SYNTHPU_DLY_LPPHY_US 300 - -#define ANTCNT 10 /* vanilla M_MAX_ANTCNT val */ - -/* Per-AC retry limit register definitions; uses defs.h bitfield macros */ -#define EDCF_SHORT_S 0 -#define EDCF_SFB_S 4 -#define EDCF_LONG_S 8 -#define EDCF_LFB_S 12 -#define EDCF_SHORT_M BITFIELD_MASK(4) -#define EDCF_SFB_M BITFIELD_MASK(4) -#define EDCF_LONG_M BITFIELD_MASK(4) -#define EDCF_LFB_M BITFIELD_MASK(4) - -#define RETRY_SHORT_DEF 7 /* Default Short retry Limit */ -#define RETRY_SHORT_MAX 255 /* Maximum Short retry Limit */ -#define RETRY_LONG_DEF 4 /* Default Long retry count */ -#define RETRY_SHORT_FB 3 /* Short count for fb rate */ -#define RETRY_LONG_FB 2 /* Long count for fb rate */ - -#define APHY_CWMIN 15 -#define PHY_CWMAX 1023 - -#define EDCF_AIFSN_MIN 1 - -#define FRAGNUM_MASK 0xF - -#define APHY_SLOT_TIME 9 -#define BPHY_SLOT_TIME 20 - -#define WL_SPURAVOID_OFF 0 -#define WL_SPURAVOID_ON1 1 -#define WL_SPURAVOID_ON2 2 - -/* invalid core flags, use the saved coreflags */ -#define BRCMS_USE_COREFLAGS 0xffffffff - -/* values for PLCPHdr_override */ -#define BRCMS_PLCP_AUTO -1 -#define BRCMS_PLCP_SHORT 0 -#define BRCMS_PLCP_LONG 1 - -/* values for g_protection_override and n_protection_override */ -#define BRCMS_PROTECTION_AUTO -1 -#define BRCMS_PROTECTION_OFF 0 -#define BRCMS_PROTECTION_ON 1 -#define BRCMS_PROTECTION_MMHDR_ONLY 2 -#define BRCMS_PROTECTION_CTS_ONLY 3 - -/* values for g_protection_control and n_protection_control */ -#define BRCMS_PROTECTION_CTL_OFF 0 -#define BRCMS_PROTECTION_CTL_LOCAL 1 -#define BRCMS_PROTECTION_CTL_OVERLAP 2 - -/* values for n_protection */ -#define BRCMS_N_PROTECTION_OFF 0 -#define BRCMS_N_PROTECTION_OPTIONAL 1 -#define BRCMS_N_PROTECTION_20IN40 2 -#define BRCMS_N_PROTECTION_MIXEDMODE 3 - -/* values for band specific 40MHz capabilities */ -#define BRCMS_N_BW_20ALL 0 -#define BRCMS_N_BW_40ALL 1 -#define BRCMS_N_BW_20IN2G_40IN5G 2 - -/* bitflags for SGI support (sgi_rx iovar) */ -#define BRCMS_N_SGI_20 0x01 -#define BRCMS_N_SGI_40 0x02 - -/* defines used by the nrate iovar */ -/* MSC in use,indicates b0-6 holds an mcs */ -#define NRATE_MCS_INUSE 0x00000080 -/* rate/mcs value */ -#define NRATE_RATE_MASK 0x0000007f -/* stf mode mask: siso, cdd, stbc, sdm */ -#define NRATE_STF_MASK 0x0000ff00 -/* stf mode shift */ -#define NRATE_STF_SHIFT 8 -/* bit indicate to override mcs only */ -#define NRATE_OVERRIDE_MCS_ONLY 0x40000000 -#define NRATE_SGI_MASK 0x00800000 /* sgi mode */ -#define NRATE_SGI_SHIFT 23 /* sgi mode */ -#define NRATE_LDPC_CODING 0x00400000 /* adv coding in use */ -#define NRATE_LDPC_SHIFT 22 /* ldpc shift */ - -#define NRATE_STF_SISO 0 /* stf mode SISO */ -#define NRATE_STF_CDD 1 /* stf mode CDD */ -#define NRATE_STF_STBC 2 /* stf mode STBC */ -#define NRATE_STF_SDM 3 /* stf mode SDM */ - -#define MAX_DMA_SEGS 4 - -/* # of entries in Tx FIFO */ -#define NTXD 64 -/* Max # of entries in Rx FIFO based on 4kb page size */ -#define NRXD 256 - -/* Amount of headroom to leave in Tx FIFO */ -#define TX_HEADROOM 4 - -/* try to keep this # rbufs posted to the chip */ -#define NRXBUFPOST 32 - -/* max # frames to process in brcms_c_recv() */ -#define RXBND 8 -/* max # tx status to process in wlc_txstatus() */ -#define TXSBND 8 - -/* brcmu_format_flags() bit description structure */ -struct brcms_c_bit_desc { - u32 bit; - const char *name; -}; - -/* - * The following table lists the buffer memory allocated to xmt fifos in HW. - * the size is in units of 256bytes(one block), total size is HW dependent - * ucode has default fifo partition, sw can overwrite if necessary - * - * This is documented in twiki under the topic UcodeTxFifo. Please ensure - * the twiki is updated before making changes. - */ - -/* Starting corerev for the fifo size table */ -#define XMTFIFOTBL_STARTREV 17 - -struct d11init { - __le16 addr; - __le16 size; - __le32 value; -}; - -struct edcf_acparam { - u8 ACI; - u8 ECW; - u16 TXOP; -} __packed; - -/* debug/trace */ -uint brcm_msg_level; - -/* TX FIFO number to WME/802.1E Access Category */ -static const u8 wme_fifo2ac[] = { - IEEE80211_AC_BK, - IEEE80211_AC_BE, - IEEE80211_AC_VI, - IEEE80211_AC_VO, - IEEE80211_AC_BE, - IEEE80211_AC_BE -}; - -/* ieee80211 Access Category to TX FIFO number */ -static const u8 wme_ac2fifo[] = { - TX_AC_VO_FIFO, - TX_AC_VI_FIFO, - TX_AC_BE_FIFO, - TX_AC_BK_FIFO -}; - -static const u16 xmtfifo_sz[][NFIFO] = { - /* corerev 17: 5120, 49152, 49152, 5376, 4352, 1280 */ - {20, 192, 192, 21, 17, 5}, - /* corerev 18: */ - {0, 0, 0, 0, 0, 0}, - /* corerev 19: */ - {0, 0, 0, 0, 0, 0}, - /* corerev 20: 5120, 49152, 49152, 5376, 4352, 1280 */ - {20, 192, 192, 21, 17, 5}, - /* corerev 21: 2304, 14848, 5632, 3584, 3584, 1280 */ - {9, 58, 22, 14, 14, 5}, - /* corerev 22: 5120, 49152, 49152, 5376, 4352, 1280 */ - {20, 192, 192, 21, 17, 5}, - /* corerev 23: 5120, 49152, 49152, 5376, 4352, 1280 */ - {20, 192, 192, 21, 17, 5}, - /* corerev 24: 2304, 14848, 5632, 3584, 3584, 1280 */ - {9, 58, 22, 14, 14, 5}, - /* corerev 25: */ - {0, 0, 0, 0, 0, 0}, - /* corerev 26: */ - {0, 0, 0, 0, 0, 0}, - /* corerev 27: */ - {0, 0, 0, 0, 0, 0}, - /* corerev 28: 2304, 14848, 5632, 3584, 3584, 1280 */ - {9, 58, 22, 14, 14, 5}, -}; - -#ifdef DEBUG -static const char * const fifo_names[] = { - "AC_BK", "AC_BE", "AC_VI", "AC_VO", "BCMC", "ATIM" }; -#else -static const char fifo_names[6][0]; -#endif - -#ifdef DEBUG -/* pointer to most recently allocated wl/wlc */ -static struct brcms_c_info *wlc_info_dbg = (struct brcms_c_info *) (NULL); -#endif - -/* Mapping of ieee80211 AC numbers to tx fifos */ -static const u8 ac_to_fifo_mapping[IEEE80211_NUM_ACS] = { - [IEEE80211_AC_VO] = TX_AC_VO_FIFO, - [IEEE80211_AC_VI] = TX_AC_VI_FIFO, - [IEEE80211_AC_BE] = TX_AC_BE_FIFO, - [IEEE80211_AC_BK] = TX_AC_BK_FIFO, -}; - -/* Mapping of tx fifos to ieee80211 AC numbers */ -static const u8 fifo_to_ac_mapping[IEEE80211_NUM_ACS] = { - [TX_AC_BK_FIFO] = IEEE80211_AC_BK, - [TX_AC_BE_FIFO] = IEEE80211_AC_BE, - [TX_AC_VI_FIFO] = IEEE80211_AC_VI, - [TX_AC_VO_FIFO] = IEEE80211_AC_VO, -}; - -static u8 brcms_ac_to_fifo(u8 ac) -{ - if (ac >= ARRAY_SIZE(ac_to_fifo_mapping)) - return TX_AC_BE_FIFO; - return ac_to_fifo_mapping[ac]; -} - -static u8 brcms_fifo_to_ac(u8 fifo) -{ - if (fifo >= ARRAY_SIZE(fifo_to_ac_mapping)) - return IEEE80211_AC_BE; - return fifo_to_ac_mapping[fifo]; -} - -/* Find basic rate for a given rate */ -static u8 brcms_basic_rate(struct brcms_c_info *wlc, u32 rspec) -{ - if (is_mcs_rate(rspec)) - return wlc->band->basic_rate[mcs_table[rspec & RSPEC_RATE_MASK] - .leg_ofdm]; - return wlc->band->basic_rate[rspec & RSPEC_RATE_MASK]; -} - -static u16 frametype(u32 rspec, u8 mimoframe) -{ - if (is_mcs_rate(rspec)) - return mimoframe; - return is_cck_rate(rspec) ? FT_CCK : FT_OFDM; -} - -/* currently the best mechanism for determining SIFS is the band in use */ -static u16 get_sifs(struct brcms_band *band) -{ - return band->bandtype == BRCM_BAND_5G ? APHY_SIFS_TIME : - BPHY_SIFS_TIME; -} - -/* - * Detect Card removed. - * Even checking an sbconfig register read will not false trigger when the core - * is in reset it breaks CF address mechanism. Accessing gphy phyversion will - * cause SB error if aphy is in reset on 4306B0-DB. Need a simple accessible - * reg with fixed 0/1 pattern (some platforms return all 0). - * If clocks are present, call the sb routine which will figure out if the - * device is removed. - */ -static bool brcms_deviceremoved(struct brcms_c_info *wlc) -{ - u32 macctrl; - - if (!wlc->hw->clk) - return ai_deviceremoved(wlc->hw->sih); - macctrl = bcma_read32(wlc->hw->d11core, - D11REGOFFS(maccontrol)); - return (macctrl & (MCTL_PSM_JMP_0 | MCTL_IHR_EN)) != MCTL_IHR_EN; -} - -/* sum the individual fifo tx pending packet counts */ -static int brcms_txpktpendtot(struct brcms_c_info *wlc) -{ - int i; - int pending = 0; - - for (i = 0; i < ARRAY_SIZE(wlc->hw->di); i++) - if (wlc->hw->di[i]) - pending += dma_txpending(wlc->hw->di[i]); - return pending; -} - -static bool brcms_is_mband_unlocked(struct brcms_c_info *wlc) -{ - return wlc->pub->_nbands > 1 && !wlc->bandlocked; -} - -static int brcms_chspec_bw(u16 chanspec) -{ - if (CHSPEC_IS40(chanspec)) - return BRCMS_40_MHZ; - if (CHSPEC_IS20(chanspec)) - return BRCMS_20_MHZ; - - return BRCMS_10_MHZ; -} - -static void brcms_c_bsscfg_mfree(struct brcms_bss_cfg *cfg) -{ - if (cfg == NULL) - return; - - kfree(cfg->current_bss); - kfree(cfg); -} - -static void brcms_c_detach_mfree(struct brcms_c_info *wlc) -{ - if (wlc == NULL) - return; - - brcms_c_bsscfg_mfree(wlc->bsscfg); - kfree(wlc->pub); - kfree(wlc->modulecb); - kfree(wlc->default_bss); - kfree(wlc->protection); - kfree(wlc->stf); - kfree(wlc->bandstate[0]); - kfree(wlc->corestate->macstat_snapshot); - kfree(wlc->corestate); - kfree(wlc->hw->bandstate[0]); - kfree(wlc->hw); - if (wlc->beacon) - dev_kfree_skb_any(wlc->beacon); - if (wlc->probe_resp) - dev_kfree_skb_any(wlc->probe_resp); - - /* free the wlc */ - kfree(wlc); - wlc = NULL; -} - -static struct brcms_bss_cfg *brcms_c_bsscfg_malloc(uint unit) -{ - struct brcms_bss_cfg *cfg; - - cfg = kzalloc(sizeof(struct brcms_bss_cfg), GFP_ATOMIC); - if (cfg == NULL) - goto fail; - - cfg->current_bss = kzalloc(sizeof(struct brcms_bss_info), GFP_ATOMIC); - if (cfg->current_bss == NULL) - goto fail; - - return cfg; - - fail: - brcms_c_bsscfg_mfree(cfg); - return NULL; -} - -static struct brcms_c_info * -brcms_c_attach_malloc(uint unit, uint *err, uint devid) -{ - struct brcms_c_info *wlc; - - wlc = kzalloc(sizeof(struct brcms_c_info), GFP_ATOMIC); - if (wlc == NULL) { - *err = 1002; - goto fail; - } - - /* allocate struct brcms_c_pub state structure */ - wlc->pub = kzalloc(sizeof(struct brcms_pub), GFP_ATOMIC); - if (wlc->pub == NULL) { - *err = 1003; - goto fail; - } - wlc->pub->wlc = wlc; - - /* allocate struct brcms_hardware state structure */ - - wlc->hw = kzalloc(sizeof(struct brcms_hardware), GFP_ATOMIC); - if (wlc->hw == NULL) { - *err = 1005; - goto fail; - } - wlc->hw->wlc = wlc; - - wlc->hw->bandstate[0] = - kzalloc(sizeof(struct brcms_hw_band) * MAXBANDS, GFP_ATOMIC); - if (wlc->hw->bandstate[0] == NULL) { - *err = 1006; - goto fail; - } else { - int i; - - for (i = 1; i < MAXBANDS; i++) - wlc->hw->bandstate[i] = (struct brcms_hw_band *) - ((unsigned long)wlc->hw->bandstate[0] + - (sizeof(struct brcms_hw_band) * i)); - } - - wlc->modulecb = - kzalloc(sizeof(struct modulecb) * BRCMS_MAXMODULES, GFP_ATOMIC); - if (wlc->modulecb == NULL) { - *err = 1009; - goto fail; - } - - wlc->default_bss = kzalloc(sizeof(struct brcms_bss_info), GFP_ATOMIC); - if (wlc->default_bss == NULL) { - *err = 1010; - goto fail; - } - - wlc->bsscfg = brcms_c_bsscfg_malloc(unit); - if (wlc->bsscfg == NULL) { - *err = 1011; - goto fail; - } - - wlc->protection = kzalloc(sizeof(struct brcms_protection), - GFP_ATOMIC); - if (wlc->protection == NULL) { - *err = 1016; - goto fail; - } - - wlc->stf = kzalloc(sizeof(struct brcms_stf), GFP_ATOMIC); - if (wlc->stf == NULL) { - *err = 1017; - goto fail; - } - - wlc->bandstate[0] = - kzalloc(sizeof(struct brcms_band)*MAXBANDS, GFP_ATOMIC); - if (wlc->bandstate[0] == NULL) { - *err = 1025; - goto fail; - } else { - int i; - - for (i = 1; i < MAXBANDS; i++) - wlc->bandstate[i] = (struct brcms_band *) - ((unsigned long)wlc->bandstate[0] - + (sizeof(struct brcms_band)*i)); - } - - wlc->corestate = kzalloc(sizeof(struct brcms_core), GFP_ATOMIC); - if (wlc->corestate == NULL) { - *err = 1026; - goto fail; - } - - wlc->corestate->macstat_snapshot = - kzalloc(sizeof(struct macstat), GFP_ATOMIC); - if (wlc->corestate->macstat_snapshot == NULL) { - *err = 1027; - goto fail; - } - - return wlc; - - fail: - brcms_c_detach_mfree(wlc); - return NULL; -} - -/* - * Update the slot timing for standard 11b/g (20us slots) - * or shortslot 11g (9us slots) - * The PSM needs to be suspended for this call. - */ -static void brcms_b_update_slot_timing(struct brcms_hardware *wlc_hw, - bool shortslot) -{ - struct bcma_device *core = wlc_hw->d11core; - - if (shortslot) { - /* 11g short slot: 11a timing */ - bcma_write16(core, D11REGOFFS(ifs_slot), 0x0207); - brcms_b_write_shm(wlc_hw, M_DOT11_SLOT, APHY_SLOT_TIME); - } else { - /* 11g long slot: 11b timing */ - bcma_write16(core, D11REGOFFS(ifs_slot), 0x0212); - brcms_b_write_shm(wlc_hw, M_DOT11_SLOT, BPHY_SLOT_TIME); - } -} - -/* - * calculate frame duration of a given rate and length, return - * time in usec unit - */ -static uint brcms_c_calc_frame_time(struct brcms_c_info *wlc, u32 ratespec, - u8 preamble_type, uint mac_len) -{ - uint nsyms, dur = 0, Ndps, kNdps; - uint rate = rspec2rate(ratespec); - - if (rate == 0) { - brcms_err(wlc->hw->d11core, "wl%d: WAR: using rate of 1 mbps\n", - wlc->pub->unit); - rate = BRCM_RATE_1M; - } - - if (is_mcs_rate(ratespec)) { - uint mcs = ratespec & RSPEC_RATE_MASK; - int tot_streams = mcs_2_txstreams(mcs) + rspec_stc(ratespec); - - dur = PREN_PREAMBLE + (tot_streams * PREN_PREAMBLE_EXT); - if (preamble_type == BRCMS_MM_PREAMBLE) - dur += PREN_MM_EXT; - /* 1000Ndbps = kbps * 4 */ - kNdps = mcs_2_rate(mcs, rspec_is40mhz(ratespec), - rspec_issgi(ratespec)) * 4; - - if (rspec_stc(ratespec) == 0) - nsyms = - CEIL((APHY_SERVICE_NBITS + 8 * mac_len + - APHY_TAIL_NBITS) * 1000, kNdps); - else - /* STBC needs to have even number of symbols */ - nsyms = - 2 * - CEIL((APHY_SERVICE_NBITS + 8 * mac_len + - APHY_TAIL_NBITS) * 1000, 2 * kNdps); - - dur += APHY_SYMBOL_TIME * nsyms; - if (wlc->band->bandtype == BRCM_BAND_2G) - dur += DOT11_OFDM_SIGNAL_EXTENSION; - } else if (is_ofdm_rate(rate)) { - dur = APHY_PREAMBLE_TIME; - dur += APHY_SIGNAL_TIME; - /* Ndbps = Mbps * 4 = rate(500Kbps) * 2 */ - Ndps = rate * 2; - /* NSyms = CEILING((SERVICE + 8*NBytes + TAIL) / Ndbps) */ - nsyms = - CEIL((APHY_SERVICE_NBITS + 8 * mac_len + APHY_TAIL_NBITS), - Ndps); - dur += APHY_SYMBOL_TIME * nsyms; - if (wlc->band->bandtype == BRCM_BAND_2G) - dur += DOT11_OFDM_SIGNAL_EXTENSION; - } else { - /* - * calc # bits * 2 so factor of 2 in rate (1/2 mbps) - * will divide out - */ - mac_len = mac_len * 8 * 2; - /* calc ceiling of bits/rate = microseconds of air time */ - dur = (mac_len + rate - 1) / rate; - if (preamble_type & BRCMS_SHORT_PREAMBLE) - dur += BPHY_PLCP_SHORT_TIME; - else - dur += BPHY_PLCP_TIME; - } - return dur; -} - -static void brcms_c_write_inits(struct brcms_hardware *wlc_hw, - const struct d11init *inits) -{ - struct bcma_device *core = wlc_hw->d11core; - int i; - uint offset; - u16 size; - u32 value; - - brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); - - for (i = 0; inits[i].addr != cpu_to_le16(0xffff); i++) { - size = le16_to_cpu(inits[i].size); - offset = le16_to_cpu(inits[i].addr); - value = le32_to_cpu(inits[i].value); - if (size == 2) - bcma_write16(core, offset, value); - else if (size == 4) - bcma_write32(core, offset, value); - else - break; - } -} - -static void brcms_c_write_mhf(struct brcms_hardware *wlc_hw, u16 *mhfs) -{ - u8 idx; - u16 addr[] = { - M_HOST_FLAGS1, M_HOST_FLAGS2, M_HOST_FLAGS3, M_HOST_FLAGS4, - M_HOST_FLAGS5 - }; - - for (idx = 0; idx < MHFMAX; idx++) - brcms_b_write_shm(wlc_hw, addr[idx], mhfs[idx]); -} - -static void brcms_c_ucode_bsinit(struct brcms_hardware *wlc_hw) -{ - struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; - - /* init microcode host flags */ - brcms_c_write_mhf(wlc_hw, wlc_hw->band->mhfs); - - /* do band-specific ucode IHR, SHM, and SCR inits */ - if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { - if (BRCMS_ISNPHY(wlc_hw->band)) - brcms_c_write_inits(wlc_hw, ucode->d11n0bsinitvals16); - else - brcms_err(wlc_hw->d11core, - "%s: wl%d: unsupported phy in corerev %d\n", - __func__, wlc_hw->unit, - wlc_hw->corerev); - } else { - if (D11REV_IS(wlc_hw->corerev, 24)) { - if (BRCMS_ISLCNPHY(wlc_hw->band)) - brcms_c_write_inits(wlc_hw, - ucode->d11lcn0bsinitvals24); - else - brcms_err(wlc_hw->d11core, - "%s: wl%d: unsupported phy in core rev %d\n", - __func__, wlc_hw->unit, - wlc_hw->corerev); - } else { - brcms_err(wlc_hw->d11core, - "%s: wl%d: unsupported corerev %d\n", - __func__, wlc_hw->unit, wlc_hw->corerev); - } - } -} - -static void brcms_b_core_ioctl(struct brcms_hardware *wlc_hw, u32 m, u32 v) -{ - struct bcma_device *core = wlc_hw->d11core; - u32 ioctl = bcma_aread32(core, BCMA_IOCTL) & ~m; - - bcma_awrite32(core, BCMA_IOCTL, ioctl | v); -} - -static void brcms_b_core_phy_clk(struct brcms_hardware *wlc_hw, bool clk) -{ - brcms_dbg_info(wlc_hw->d11core, "wl%d: clk %d\n", wlc_hw->unit, clk); - - wlc_hw->phyclk = clk; - - if (OFF == clk) { /* clear gmode bit, put phy into reset */ - - brcms_b_core_ioctl(wlc_hw, (SICF_PRST | SICF_FGC | SICF_GMODE), - (SICF_PRST | SICF_FGC)); - udelay(1); - brcms_b_core_ioctl(wlc_hw, (SICF_PRST | SICF_FGC), SICF_PRST); - udelay(1); - - } else { /* take phy out of reset */ - - brcms_b_core_ioctl(wlc_hw, (SICF_PRST | SICF_FGC), SICF_FGC); - udelay(1); - brcms_b_core_ioctl(wlc_hw, SICF_FGC, 0); - udelay(1); - - } -} - -/* low-level band switch utility routine */ -static void brcms_c_setxband(struct brcms_hardware *wlc_hw, uint bandunit) -{ - brcms_dbg_mac80211(wlc_hw->d11core, "wl%d: bandunit %d\n", wlc_hw->unit, - bandunit); - - wlc_hw->band = wlc_hw->bandstate[bandunit]; - - /* - * BMAC_NOTE: - * until we eliminate need for wlc->band refs in low level code - */ - wlc_hw->wlc->band = wlc_hw->wlc->bandstate[bandunit]; - - /* set gmode core flag */ - if (wlc_hw->sbclk && !wlc_hw->noreset) { - u32 gmode = 0; - - if (bandunit == 0) - gmode = SICF_GMODE; - - brcms_b_core_ioctl(wlc_hw, SICF_GMODE, gmode); - } -} - -/* switch to new band but leave it inactive */ -static u32 brcms_c_setband_inact(struct brcms_c_info *wlc, uint bandunit) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - u32 macintmask; - u32 macctrl; - - brcms_dbg_mac80211(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); - macctrl = bcma_read32(wlc_hw->d11core, - D11REGOFFS(maccontrol)); - WARN_ON((macctrl & MCTL_EN_MAC) != 0); - - /* disable interrupts */ - macintmask = brcms_intrsoff(wlc->wl); - - /* radio off */ - wlc_phy_switch_radio(wlc_hw->band->pi, OFF); - - brcms_b_core_phy_clk(wlc_hw, OFF); - - brcms_c_setxband(wlc_hw, bandunit); - - return macintmask; -} - -/* process an individual struct tx_status */ -static bool -brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) -{ - struct sk_buff *p = NULL; - uint queue = NFIFO; - struct dma_pub *dma = NULL; - struct d11txh *txh = NULL; - struct scb *scb = NULL; - bool free_pdu; - int tx_rts, tx_frame_count, tx_rts_count; - uint totlen, supr_status; - bool lastframe; - struct ieee80211_hdr *h; - u16 mcl; - struct ieee80211_tx_info *tx_info; - struct ieee80211_tx_rate *txrate; - int i; - bool fatal = true; - - trace_brcms_txstatus(&wlc->hw->d11core->dev, txs->framelen, - txs->frameid, txs->status, txs->lasttxtime, - txs->sequence, txs->phyerr, txs->ackphyrxsh); - - /* discard intermediate indications for ucode with one legitimate case: - * e.g. if "useRTS" is set. ucode did a successful rts/cts exchange, - * but the subsequent tx of DATA failed. so it will start rts/cts - * from the beginning (resetting the rts transmission count) - */ - if (!(txs->status & TX_STATUS_AMPDU) - && (txs->status & TX_STATUS_INTERMEDIATE)) { - brcms_dbg_tx(wlc->hw->d11core, "INTERMEDIATE but not AMPDU\n"); - fatal = false; - goto out; - } - - queue = txs->frameid & TXFID_QUEUE_MASK; - if (queue >= NFIFO) { - brcms_err(wlc->hw->d11core, "queue %u >= NFIFO\n", queue); - goto out; - } - - dma = wlc->hw->di[queue]; - - p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED); - if (p == NULL) { - brcms_err(wlc->hw->d11core, "dma_getnexttxp returned null!\n"); - goto out; - } - - txh = (struct d11txh *) (p->data); - mcl = le16_to_cpu(txh->MacTxControlLow); - - if (txs->phyerr) - brcms_err(wlc->hw->d11core, "phyerr 0x%x, rate 0x%x\n", - txs->phyerr, txh->MainRates); - - if (txs->frameid != le16_to_cpu(txh->TxFrameID)) { - brcms_err(wlc->hw->d11core, "frameid != txh->TxFrameID\n"); - goto out; - } - tx_info = IEEE80211_SKB_CB(p); - h = (struct ieee80211_hdr *)((u8 *) (txh + 1) + D11_PHY_HDR_LEN); - - if (tx_info->rate_driver_data[0]) - scb = &wlc->pri_scb; - - if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { - brcms_c_ampdu_dotxstatus(wlc->ampdu, scb, p, txs); - fatal = false; - goto out; - } - - /* - * brcms_c_ampdu_dotxstatus() will trace tx descriptors for AMPDU - * frames; this traces them for the rest. - */ - trace_brcms_txdesc(&wlc->hw->d11core->dev, txh, sizeof(*txh)); - - supr_status = txs->status & TX_STATUS_SUPR_MASK; - if (supr_status == TX_STATUS_SUPR_BADCH) { - unsigned xfts = le16_to_cpu(txh->XtraFrameTypes); - brcms_dbg_tx(wlc->hw->d11core, - "Pkt tx suppressed, dest chan %u, current %d\n", - (xfts >> XFTS_CHANNEL_SHIFT) & 0xff, - CHSPEC_CHANNEL(wlc->default_bss->chanspec)); - } - - tx_rts = le16_to_cpu(txh->MacTxControlLow) & TXC_SENDRTS; - tx_frame_count = - (txs->status & TX_STATUS_FRM_RTX_MASK) >> TX_STATUS_FRM_RTX_SHIFT; - tx_rts_count = - (txs->status & TX_STATUS_RTS_RTX_MASK) >> TX_STATUS_RTS_RTX_SHIFT; - - lastframe = !ieee80211_has_morefrags(h->frame_control); - - if (!lastframe) { - brcms_err(wlc->hw->d11core, "Not last frame!\n"); - } else { - /* - * Set information to be consumed by Minstrel ht. - * - * The "fallback limit" is the number of tx attempts a given - * MPDU is sent at the "primary" rate. Tx attempts beyond that - * limit are sent at the "secondary" rate. - * A 'short frame' does not exceed RTS treshold. - */ - u16 sfbl, /* Short Frame Rate Fallback Limit */ - lfbl, /* Long Frame Rate Fallback Limit */ - fbl; - - if (queue < IEEE80211_NUM_ACS) { - sfbl = GFIELD(wlc->wme_retries[wme_fifo2ac[queue]], - EDCF_SFB); - lfbl = GFIELD(wlc->wme_retries[wme_fifo2ac[queue]], - EDCF_LFB); - } else { - sfbl = wlc->SFBL; - lfbl = wlc->LFBL; - } - - txrate = tx_info->status.rates; - if (txrate[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) - fbl = lfbl; - else - fbl = sfbl; - - ieee80211_tx_info_clear_status(tx_info); - - if ((tx_frame_count > fbl) && (txrate[1].idx >= 0)) { - /* - * rate selection requested a fallback rate - * and we used it - */ - txrate[0].count = fbl; - txrate[1].count = tx_frame_count - fbl; - } else { - /* - * rate selection did not request fallback rate, or - * we didn't need it - */ - txrate[0].count = tx_frame_count; - /* - * rc80211_minstrel.c:minstrel_tx_status() expects - * unused rates to be marked with idx = -1 - */ - txrate[1].idx = -1; - txrate[1].count = 0; - } - - /* clear the rest of the rates */ - for (i = 2; i < IEEE80211_TX_MAX_RATES; i++) { - txrate[i].idx = -1; - txrate[i].count = 0; - } - - if (txs->status & TX_STATUS_ACK_RCV) - tx_info->flags |= IEEE80211_TX_STAT_ACK; - } - - totlen = p->len; - free_pdu = true; - - if (lastframe) { - /* remove PLCP & Broadcom tx descriptor header */ - skb_pull(p, D11_PHY_HDR_LEN); - skb_pull(p, D11_TXH_LEN); - ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw, p); - } else { - brcms_err(wlc->hw->d11core, - "%s: Not last frame => not calling tx_status\n", - __func__); - } - - fatal = false; - - out: - if (fatal) { - if (txh) - trace_brcms_txdesc(&wlc->hw->d11core->dev, txh, - sizeof(*txh)); - if (p) - brcmu_pkt_buf_free_skb(p); - } - - if (dma && queue < NFIFO) { - u16 ac_queue = brcms_fifo_to_ac(queue); - if (dma->txavail > TX_HEADROOM && queue < TX_BCMC_FIFO && - ieee80211_queue_stopped(wlc->pub->ieee_hw, ac_queue)) - ieee80211_wake_queue(wlc->pub->ieee_hw, ac_queue); - dma_kick_tx(dma); - } - - return fatal; -} - -/* process tx completion events in BMAC - * Return true if more tx status need to be processed. false otherwise. - */ -static bool -brcms_b_txstatus(struct brcms_hardware *wlc_hw, bool bound, bool *fatal) -{ - struct bcma_device *core; - struct tx_status txstatus, *txs; - u32 s1, s2; - uint n = 0; - /* - * Param 'max_tx_num' indicates max. # tx status to process before - * break out. - */ - uint max_tx_num = bound ? TXSBND : -1; - - txs = &txstatus; - core = wlc_hw->d11core; - *fatal = false; - - while (n < max_tx_num) { - s1 = bcma_read32(core, D11REGOFFS(frmtxstatus)); - if (s1 == 0xffffffff) { - brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, - __func__); - *fatal = true; - return false; - } - /* only process when valid */ - if (!(s1 & TXS_V)) - break; - - s2 = bcma_read32(core, D11REGOFFS(frmtxstatus2)); - txs->status = s1 & TXS_STATUS_MASK; - txs->frameid = (s1 & TXS_FID_MASK) >> TXS_FID_SHIFT; - txs->sequence = s2 & TXS_SEQ_MASK; - txs->phyerr = (s2 & TXS_PTX_MASK) >> TXS_PTX_SHIFT; - txs->lasttxtime = 0; - - *fatal = brcms_c_dotxstatus(wlc_hw->wlc, txs); - if (*fatal == true) - return false; - n++; - } - - return n >= max_tx_num; -} - -static void brcms_c_tbtt(struct brcms_c_info *wlc) -{ - if (wlc->bsscfg->type == BRCMS_TYPE_ADHOC) - /* - * DirFrmQ is now valid...defer setting until end - * of ATIM window - */ - wlc->qvalid |= MCMD_DIRFRMQVAL; -} - -/* set initial host flags value */ -static void -brcms_c_mhfdef(struct brcms_c_info *wlc, u16 *mhfs, u16 mhf2_init) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - - memset(mhfs, 0, MHFMAX * sizeof(u16)); - - mhfs[MHF2] |= mhf2_init; - - /* prohibit use of slowclock on multifunction boards */ - if (wlc_hw->boardflags & BFL_NOPLLDOWN) - mhfs[MHF1] |= MHF1_FORCEFASTCLK; - - if (BRCMS_ISNPHY(wlc_hw->band) && NREV_LT(wlc_hw->band->phyrev, 2)) { - mhfs[MHF2] |= MHF2_NPHY40MHZ_WAR; - mhfs[MHF1] |= MHF1_IQSWAP_WAR; - } -} - -static uint -dmareg(uint direction, uint fifonum) -{ - if (direction == DMA_TX) - return offsetof(struct d11regs, fifo64regs[fifonum].dmaxmt); - return offsetof(struct d11regs, fifo64regs[fifonum].dmarcv); -} - -static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme) -{ - uint i; - char name[8]; - /* - * ucode host flag 2 needed for pio mode, independent of band and fifo - */ - u16 pio_mhf2 = 0; - struct brcms_hardware *wlc_hw = wlc->hw; - uint unit = wlc_hw->unit; - - /* name and offsets for dma_attach */ - snprintf(name, sizeof(name), "wl%d", unit); - - if (wlc_hw->di[0] == NULL) { /* Init FIFOs */ - int dma_attach_err = 0; - - /* - * FIFO 0 - * TX: TX_AC_BK_FIFO (TX AC Background data packets) - * RX: RX_FIFO (RX data packets) - */ - wlc_hw->di[0] = dma_attach(name, wlc, - (wme ? dmareg(DMA_TX, 0) : 0), - dmareg(DMA_RX, 0), - (wme ? NTXD : 0), NRXD, - RXBUFSZ, -1, NRXBUFPOST, - BRCMS_HWRXOFF); - dma_attach_err |= (NULL == wlc_hw->di[0]); - - /* - * FIFO 1 - * TX: TX_AC_BE_FIFO (TX AC Best-Effort data packets) - * (legacy) TX_DATA_FIFO (TX data packets) - * RX: UNUSED - */ - wlc_hw->di[1] = dma_attach(name, wlc, - dmareg(DMA_TX, 1), 0, - NTXD, 0, 0, -1, 0, 0); - dma_attach_err |= (NULL == wlc_hw->di[1]); - - /* - * FIFO 2 - * TX: TX_AC_VI_FIFO (TX AC Video data packets) - * RX: UNUSED - */ - wlc_hw->di[2] = dma_attach(name, wlc, - dmareg(DMA_TX, 2), 0, - NTXD, 0, 0, -1, 0, 0); - dma_attach_err |= (NULL == wlc_hw->di[2]); - /* - * FIFO 3 - * TX: TX_AC_VO_FIFO (TX AC Voice data packets) - * (legacy) TX_CTL_FIFO (TX control & mgmt packets) - */ - wlc_hw->di[3] = dma_attach(name, wlc, - dmareg(DMA_TX, 3), - 0, NTXD, 0, 0, -1, - 0, 0); - dma_attach_err |= (NULL == wlc_hw->di[3]); -/* Cleaner to leave this as if with AP defined */ - - if (dma_attach_err) { - brcms_err(wlc_hw->d11core, - "wl%d: wlc_attach: dma_attach failed\n", - unit); - return false; - } - - /* get pointer to dma engine tx flow control variable */ - for (i = 0; i < NFIFO; i++) - if (wlc_hw->di[i]) - wlc_hw->txavail[i] = - (uint *) dma_getvar(wlc_hw->di[i], - "&txavail"); - } - - /* initial ucode host flags */ - brcms_c_mhfdef(wlc, wlc_hw->band->mhfs, pio_mhf2); - - return true; -} - -static void brcms_b_detach_dmapio(struct brcms_hardware *wlc_hw) -{ - uint j; - - for (j = 0; j < NFIFO; j++) { - if (wlc_hw->di[j]) { - dma_detach(wlc_hw->di[j]); - wlc_hw->di[j] = NULL; - } - } -} - -/* - * Initialize brcms_c_info default values ... - * may get overrides later in this function - * BMAC_NOTES, move low out and resolve the dangling ones - */ -static void brcms_b_info_init(struct brcms_hardware *wlc_hw) -{ - struct brcms_c_info *wlc = wlc_hw->wlc; - - /* set default sw macintmask value */ - wlc->defmacintmask = DEF_MACINTMASK; - - /* various 802.11g modes */ - wlc_hw->shortslot = false; - - wlc_hw->SFBL = RETRY_SHORT_FB; - wlc_hw->LFBL = RETRY_LONG_FB; - - /* default mac retry limits */ - wlc_hw->SRL = RETRY_SHORT_DEF; - wlc_hw->LRL = RETRY_LONG_DEF; - wlc_hw->chanspec = ch20mhz_chspec(1); -} - -static void brcms_b_wait_for_wake(struct brcms_hardware *wlc_hw) -{ - /* delay before first read of ucode state */ - udelay(40); - - /* wait until ucode is no longer asleep */ - SPINWAIT((brcms_b_read_shm(wlc_hw, M_UCODE_DBGST) == - DBGST_ASLEEP), wlc_hw->wlc->fastpwrup_dly); -} - -/* control chip clock to save power, enable dynamic clock or force fast clock */ -static void brcms_b_clkctl_clk(struct brcms_hardware *wlc_hw, enum bcma_clkmode mode) -{ - if (ai_get_cccaps(wlc_hw->sih) & CC_CAP_PMU) { - /* new chips with PMU, CCS_FORCEHT will distribute the HT clock - * on backplane, but mac core will still run on ALP(not HT) when - * it enters powersave mode, which means the FCA bit may not be - * set. Should wakeup mac if driver wants it to run on HT. - */ - - if (wlc_hw->clk) { - if (mode == BCMA_CLKMODE_FAST) { - bcma_set32(wlc_hw->d11core, - D11REGOFFS(clk_ctl_st), - CCS_FORCEHT); - - udelay(64); - - SPINWAIT( - ((bcma_read32(wlc_hw->d11core, - D11REGOFFS(clk_ctl_st)) & - CCS_HTAVAIL) == 0), - PMU_MAX_TRANSITION_DLY); - WARN_ON(!(bcma_read32(wlc_hw->d11core, - D11REGOFFS(clk_ctl_st)) & - CCS_HTAVAIL)); - } else { - if ((ai_get_pmurev(wlc_hw->sih) == 0) && - (bcma_read32(wlc_hw->d11core, - D11REGOFFS(clk_ctl_st)) & - (CCS_FORCEHT | CCS_HTAREQ))) - SPINWAIT( - ((bcma_read32(wlc_hw->d11core, - offsetof(struct d11regs, - clk_ctl_st)) & - CCS_HTAVAIL) == 0), - PMU_MAX_TRANSITION_DLY); - bcma_mask32(wlc_hw->d11core, - D11REGOFFS(clk_ctl_st), - ~CCS_FORCEHT); - } - } - wlc_hw->forcefastclk = (mode == BCMA_CLKMODE_FAST); - } else { - - /* old chips w/o PMU, force HT through cc, - * then use FCA to verify mac is running fast clock - */ - - wlc_hw->forcefastclk = ai_clkctl_cc(wlc_hw->sih, mode); - - /* check fast clock is available (if core is not in reset) */ - if (wlc_hw->forcefastclk && wlc_hw->clk) - WARN_ON(!(bcma_aread32(wlc_hw->d11core, BCMA_IOST) & - SISF_FCLKA)); - - /* - * keep the ucode wake bit on if forcefastclk is on since we - * do not want ucode to put us back to slow clock when it dozes - * for PM mode. Code below matches the wake override bit with - * current forcefastclk state. Only setting bit in wake_override - * instead of waking ucode immediately since old code had this - * behavior. Older code set wlc->forcefastclk but only had the - * wake happen if the wakup_ucode work (protected by an up - * check) was executed just below. - */ - if (wlc_hw->forcefastclk) - mboolset(wlc_hw->wake_override, - BRCMS_WAKE_OVERRIDE_FORCEFAST); - else - mboolclr(wlc_hw->wake_override, - BRCMS_WAKE_OVERRIDE_FORCEFAST); - } -} - -/* set or clear ucode host flag bits - * it has an optimization for no-change write - * it only writes through shared memory when the core has clock; - * pre-CLK changes should use wlc_write_mhf to get around the optimization - * - * - * bands values are: BRCM_BAND_AUTO <--- Current band only - * BRCM_BAND_5G <--- 5G band only - * BRCM_BAND_2G <--- 2G band only - * BRCM_BAND_ALL <--- All bands - */ -void -brcms_b_mhf(struct brcms_hardware *wlc_hw, u8 idx, u16 mask, u16 val, - int bands) -{ - u16 save; - u16 addr[MHFMAX] = { - M_HOST_FLAGS1, M_HOST_FLAGS2, M_HOST_FLAGS3, M_HOST_FLAGS4, - M_HOST_FLAGS5 - }; - struct brcms_hw_band *band; - - if ((val & ~mask) || idx >= MHFMAX) - return; /* error condition */ - - switch (bands) { - /* Current band only or all bands, - * then set the band to current band - */ - case BRCM_BAND_AUTO: - case BRCM_BAND_ALL: - band = wlc_hw->band; - break; - case BRCM_BAND_5G: - band = wlc_hw->bandstate[BAND_5G_INDEX]; - break; - case BRCM_BAND_2G: - band = wlc_hw->bandstate[BAND_2G_INDEX]; - break; - default: - band = NULL; /* error condition */ - } - - if (band) { - save = band->mhfs[idx]; - band->mhfs[idx] = (band->mhfs[idx] & ~mask) | val; - - /* optimization: only write through if changed, and - * changed band is the current band - */ - if (wlc_hw->clk && (band->mhfs[idx] != save) - && (band == wlc_hw->band)) - brcms_b_write_shm(wlc_hw, addr[idx], - (u16) band->mhfs[idx]); - } - - if (bands == BRCM_BAND_ALL) { - wlc_hw->bandstate[0]->mhfs[idx] = - (wlc_hw->bandstate[0]->mhfs[idx] & ~mask) | val; - wlc_hw->bandstate[1]->mhfs[idx] = - (wlc_hw->bandstate[1]->mhfs[idx] & ~mask) | val; - } -} - -/* set the maccontrol register to desired reset state and - * initialize the sw cache of the register - */ -static void brcms_c_mctrl_reset(struct brcms_hardware *wlc_hw) -{ - /* IHR accesses are always enabled, PSM disabled, HPS off and WAKE on */ - wlc_hw->maccontrol = 0; - wlc_hw->suspended_fifos = 0; - wlc_hw->wake_override = 0; - wlc_hw->mute_override = 0; - brcms_b_mctrl(wlc_hw, ~0, MCTL_IHR_EN | MCTL_WAKE); -} - -/* - * write the software state of maccontrol and - * overrides to the maccontrol register - */ -static void brcms_c_mctrl_write(struct brcms_hardware *wlc_hw) -{ - u32 maccontrol = wlc_hw->maccontrol; - - /* OR in the wake bit if overridden */ - if (wlc_hw->wake_override) - maccontrol |= MCTL_WAKE; - - /* set AP and INFRA bits for mute if needed */ - if (wlc_hw->mute_override) { - maccontrol &= ~(MCTL_AP); - maccontrol |= MCTL_INFRA; - } - - bcma_write32(wlc_hw->d11core, D11REGOFFS(maccontrol), - maccontrol); -} - -/* set or clear maccontrol bits */ -void brcms_b_mctrl(struct brcms_hardware *wlc_hw, u32 mask, u32 val) -{ - u32 maccontrol; - u32 new_maccontrol; - - if (val & ~mask) - return; /* error condition */ - maccontrol = wlc_hw->maccontrol; - new_maccontrol = (maccontrol & ~mask) | val; - - /* if the new maccontrol value is the same as the old, nothing to do */ - if (new_maccontrol == maccontrol) - return; - - /* something changed, cache the new value */ - wlc_hw->maccontrol = new_maccontrol; - - /* write the new values with overrides applied */ - brcms_c_mctrl_write(wlc_hw); -} - -void brcms_c_ucode_wake_override_set(struct brcms_hardware *wlc_hw, - u32 override_bit) -{ - if (wlc_hw->wake_override || (wlc_hw->maccontrol & MCTL_WAKE)) { - mboolset(wlc_hw->wake_override, override_bit); - return; - } - - mboolset(wlc_hw->wake_override, override_bit); - - brcms_c_mctrl_write(wlc_hw); - brcms_b_wait_for_wake(wlc_hw); -} - -void brcms_c_ucode_wake_override_clear(struct brcms_hardware *wlc_hw, - u32 override_bit) -{ - mboolclr(wlc_hw->wake_override, override_bit); - - if (wlc_hw->wake_override || (wlc_hw->maccontrol & MCTL_WAKE)) - return; - - brcms_c_mctrl_write(wlc_hw); -} - -/* When driver needs ucode to stop beaconing, it has to make sure that - * MCTL_AP is clear and MCTL_INFRA is set - * Mode MCTL_AP MCTL_INFRA - * AP 1 1 - * STA 0 1 <--- This will ensure no beacons - * IBSS 0 0 - */ -static void brcms_c_ucode_mute_override_set(struct brcms_hardware *wlc_hw) -{ - wlc_hw->mute_override = 1; - - /* if maccontrol already has AP == 0 and INFRA == 1 without this - * override, then there is no change to write - */ - if ((wlc_hw->maccontrol & (MCTL_AP | MCTL_INFRA)) == MCTL_INFRA) - return; - - brcms_c_mctrl_write(wlc_hw); -} - -/* Clear the override on AP and INFRA bits */ -static void brcms_c_ucode_mute_override_clear(struct brcms_hardware *wlc_hw) -{ - if (wlc_hw->mute_override == 0) - return; - - wlc_hw->mute_override = 0; - - /* if maccontrol already has AP == 0 and INFRA == 1 without this - * override, then there is no change to write - */ - if ((wlc_hw->maccontrol & (MCTL_AP | MCTL_INFRA)) == MCTL_INFRA) - return; - - brcms_c_mctrl_write(wlc_hw); -} - -/* - * Write a MAC address to the given match reg offset in the RXE match engine. - */ -static void -brcms_b_set_addrmatch(struct brcms_hardware *wlc_hw, int match_reg_offset, - const u8 *addr) -{ - struct bcma_device *core = wlc_hw->d11core; - u16 mac_l; - u16 mac_m; - u16 mac_h; - - brcms_dbg_rx(core, "wl%d: brcms_b_set_addrmatch\n", wlc_hw->unit); - - mac_l = addr[0] | (addr[1] << 8); - mac_m = addr[2] | (addr[3] << 8); - mac_h = addr[4] | (addr[5] << 8); - - /* enter the MAC addr into the RXE match registers */ - bcma_write16(core, D11REGOFFS(rcm_ctl), - RCM_INC_DATA | match_reg_offset); - bcma_write16(core, D11REGOFFS(rcm_mat_data), mac_l); - bcma_write16(core, D11REGOFFS(rcm_mat_data), mac_m); - bcma_write16(core, D11REGOFFS(rcm_mat_data), mac_h); -} - -void -brcms_b_write_template_ram(struct brcms_hardware *wlc_hw, int offset, int len, - void *buf) -{ - struct bcma_device *core = wlc_hw->d11core; - u32 word; - __le32 word_le; - __be32 word_be; - bool be_bit; - brcms_dbg_info(core, "wl%d\n", wlc_hw->unit); - - bcma_write32(core, D11REGOFFS(tplatewrptr), offset); - - /* if MCTL_BIGEND bit set in mac control register, - * the chip swaps data in fifo, as well as data in - * template ram - */ - be_bit = (bcma_read32(core, D11REGOFFS(maccontrol)) & MCTL_BIGEND) != 0; - - while (len > 0) { - memcpy(&word, buf, sizeof(u32)); - - if (be_bit) { - word_be = cpu_to_be32(word); - word = *(u32 *)&word_be; - } else { - word_le = cpu_to_le32(word); - word = *(u32 *)&word_le; - } - - bcma_write32(core, D11REGOFFS(tplatewrdata), word); - - buf = (u8 *) buf + sizeof(u32); - len -= sizeof(u32); - } -} - -static void brcms_b_set_cwmin(struct brcms_hardware *wlc_hw, u16 newmin) -{ - wlc_hw->band->CWmin = newmin; - - bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), - OBJADDR_SCR_SEL | S_DOT11_CWMIN); - (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); - bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), newmin); -} - -static void brcms_b_set_cwmax(struct brcms_hardware *wlc_hw, u16 newmax) -{ - wlc_hw->band->CWmax = newmax; - - bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), - OBJADDR_SCR_SEL | S_DOT11_CWMAX); - (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); - bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), newmax); -} - -void brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw) -{ - bool fastclk; - - /* request FAST clock if not on */ - fastclk = wlc_hw->forcefastclk; - if (!fastclk) - brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); - - wlc_phy_bw_state_set(wlc_hw->band->pi, bw); - - brcms_b_phy_reset(wlc_hw); - wlc_phy_init(wlc_hw->band->pi, wlc_phy_chanspec_get(wlc_hw->band->pi)); - - /* restore the clk */ - if (!fastclk) - brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); -} - -static void brcms_b_upd_synthpu(struct brcms_hardware *wlc_hw) -{ - u16 v; - struct brcms_c_info *wlc = wlc_hw->wlc; - /* update SYNTHPU_DLY */ - - if (BRCMS_ISLCNPHY(wlc->band)) - v = SYNTHPU_DLY_LPPHY_US; - else if (BRCMS_ISNPHY(wlc->band) && (NREV_GE(wlc->band->phyrev, 3))) - v = SYNTHPU_DLY_NPHY_US; - else - v = SYNTHPU_DLY_BPHY_US; - - brcms_b_write_shm(wlc_hw, M_SYNTHPU_DLY, v); -} - -static void brcms_c_ucode_txant_set(struct brcms_hardware *wlc_hw) -{ - u16 phyctl; - u16 phytxant = wlc_hw->bmac_phytxant; - u16 mask = PHY_TXC_ANT_MASK; - - /* set the Probe Response frame phy control word */ - phyctl = brcms_b_read_shm(wlc_hw, M_CTXPRS_BLK + C_CTX_PCTLWD_POS); - phyctl = (phyctl & ~mask) | phytxant; - brcms_b_write_shm(wlc_hw, M_CTXPRS_BLK + C_CTX_PCTLWD_POS, phyctl); - - /* set the Response (ACK/CTS) frame phy control word */ - phyctl = brcms_b_read_shm(wlc_hw, M_RSP_PCTLWD); - phyctl = (phyctl & ~mask) | phytxant; - brcms_b_write_shm(wlc_hw, M_RSP_PCTLWD, phyctl); -} - -static u16 brcms_b_ofdm_ratetable_offset(struct brcms_hardware *wlc_hw, - u8 rate) -{ - uint i; - u8 plcp_rate = 0; - struct plcp_signal_rate_lookup { - u8 rate; - u8 signal_rate; - }; - /* OFDM RATE sub-field of PLCP SIGNAL field, per 802.11 sec 17.3.4.1 */ - const struct plcp_signal_rate_lookup rate_lookup[] = { - {BRCM_RATE_6M, 0xB}, - {BRCM_RATE_9M, 0xF}, - {BRCM_RATE_12M, 0xA}, - {BRCM_RATE_18M, 0xE}, - {BRCM_RATE_24M, 0x9}, - {BRCM_RATE_36M, 0xD}, - {BRCM_RATE_48M, 0x8}, - {BRCM_RATE_54M, 0xC} - }; - - for (i = 0; i < ARRAY_SIZE(rate_lookup); i++) { - if (rate == rate_lookup[i].rate) { - plcp_rate = rate_lookup[i].signal_rate; - break; - } - } - - /* Find the SHM pointer to the rate table entry by looking in the - * Direct-map Table - */ - return 2 * brcms_b_read_shm(wlc_hw, M_RT_DIRMAP_A + (plcp_rate * 2)); -} - -static void brcms_upd_ofdm_pctl1_table(struct brcms_hardware *wlc_hw) -{ - u8 rate; - u8 rates[8] = { - BRCM_RATE_6M, BRCM_RATE_9M, BRCM_RATE_12M, BRCM_RATE_18M, - BRCM_RATE_24M, BRCM_RATE_36M, BRCM_RATE_48M, BRCM_RATE_54M - }; - u16 entry_ptr; - u16 pctl1; - uint i; - - if (!BRCMS_PHY_11N_CAP(wlc_hw->band)) - return; - - /* walk the phy rate table and update the entries */ - for (i = 0; i < ARRAY_SIZE(rates); i++) { - rate = rates[i]; - - entry_ptr = brcms_b_ofdm_ratetable_offset(wlc_hw, rate); - - /* read the SHM Rate Table entry OFDM PCTL1 values */ - pctl1 = - brcms_b_read_shm(wlc_hw, entry_ptr + M_RT_OFDM_PCTL1_POS); - - /* modify the value */ - pctl1 &= ~PHY_TXC1_MODE_MASK; - pctl1 |= (wlc_hw->hw_stf_ss_opmode << PHY_TXC1_MODE_SHIFT); - - /* Update the SHM Rate Table entry OFDM PCTL1 values */ - brcms_b_write_shm(wlc_hw, entry_ptr + M_RT_OFDM_PCTL1_POS, - pctl1); - } -} - -/* band-specific init */ -static void brcms_b_bsinit(struct brcms_c_info *wlc, u16 chanspec) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - - brcms_dbg_mac80211(wlc_hw->d11core, "wl%d: bandunit %d\n", wlc_hw->unit, - wlc_hw->band->bandunit); - - brcms_c_ucode_bsinit(wlc_hw); - - wlc_phy_init(wlc_hw->band->pi, chanspec); - - brcms_c_ucode_txant_set(wlc_hw); - - /* - * cwmin is band-specific, update hardware - * with value for current band - */ - brcms_b_set_cwmin(wlc_hw, wlc_hw->band->CWmin); - brcms_b_set_cwmax(wlc_hw, wlc_hw->band->CWmax); - - brcms_b_update_slot_timing(wlc_hw, - wlc_hw->band->bandtype == BRCM_BAND_5G ? - true : wlc_hw->shortslot); - - /* write phytype and phyvers */ - brcms_b_write_shm(wlc_hw, M_PHYTYPE, (u16) wlc_hw->band->phytype); - brcms_b_write_shm(wlc_hw, M_PHYVER, (u16) wlc_hw->band->phyrev); - - /* - * initialize the txphyctl1 rate table since - * shmem is shared between bands - */ - brcms_upd_ofdm_pctl1_table(wlc_hw); - - brcms_b_upd_synthpu(wlc_hw); -} - -/* Perform a soft reset of the PHY PLL */ -void brcms_b_core_phypll_reset(struct brcms_hardware *wlc_hw) -{ - ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_addr), - ~0, 0); - udelay(1); - ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_data), - 0x4, 0); - udelay(1); - ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_data), - 0x4, 4); - udelay(1); - ai_cc_reg(wlc_hw->sih, offsetof(struct chipcregs, chipcontrol_data), - 0x4, 0); - udelay(1); -} - -/* light way to turn on phy clock without reset for NPHY only - * refer to brcms_b_core_phy_clk for full version - */ -void brcms_b_phyclk_fgc(struct brcms_hardware *wlc_hw, bool clk) -{ - /* support(necessary for NPHY and HYPHY) only */ - if (!BRCMS_ISNPHY(wlc_hw->band)) - return; - - if (ON == clk) - brcms_b_core_ioctl(wlc_hw, SICF_FGC, SICF_FGC); - else - brcms_b_core_ioctl(wlc_hw, SICF_FGC, 0); - -} - -void brcms_b_macphyclk_set(struct brcms_hardware *wlc_hw, bool clk) -{ - if (ON == clk) - brcms_b_core_ioctl(wlc_hw, SICF_MPCLKE, SICF_MPCLKE); - else - brcms_b_core_ioctl(wlc_hw, SICF_MPCLKE, 0); -} - -void brcms_b_phy_reset(struct brcms_hardware *wlc_hw) -{ - struct brcms_phy_pub *pih = wlc_hw->band->pi; - u32 phy_bw_clkbits; - bool phy_in_reset = false; - - brcms_dbg_info(wlc_hw->d11core, "wl%d: reset phy\n", wlc_hw->unit); - - if (pih == NULL) - return; - - phy_bw_clkbits = wlc_phy_clk_bwbits(wlc_hw->band->pi); - - /* Specific reset sequence required for NPHY rev 3 and 4 */ - if (BRCMS_ISNPHY(wlc_hw->band) && NREV_GE(wlc_hw->band->phyrev, 3) && - NREV_LE(wlc_hw->band->phyrev, 4)) { - /* Set the PHY bandwidth */ - brcms_b_core_ioctl(wlc_hw, SICF_BWMASK, phy_bw_clkbits); - - udelay(1); - - /* Perform a soft reset of the PHY PLL */ - brcms_b_core_phypll_reset(wlc_hw); - - /* reset the PHY */ - brcms_b_core_ioctl(wlc_hw, (SICF_PRST | SICF_PCLKE), - (SICF_PRST | SICF_PCLKE)); - phy_in_reset = true; - } else { - brcms_b_core_ioctl(wlc_hw, - (SICF_PRST | SICF_PCLKE | SICF_BWMASK), - (SICF_PRST | SICF_PCLKE | phy_bw_clkbits)); - } - - udelay(2); - brcms_b_core_phy_clk(wlc_hw, ON); - - if (pih) - wlc_phy_anacore(pih, ON); -} - -/* switch to and initialize new band */ -static void brcms_b_setband(struct brcms_hardware *wlc_hw, uint bandunit, - u16 chanspec) { - struct brcms_c_info *wlc = wlc_hw->wlc; - u32 macintmask; - - /* Enable the d11 core before accessing it */ - if (!bcma_core_is_enabled(wlc_hw->d11core)) { - bcma_core_enable(wlc_hw->d11core, 0); - brcms_c_mctrl_reset(wlc_hw); - } - - macintmask = brcms_c_setband_inact(wlc, bandunit); - - if (!wlc_hw->up) - return; - - brcms_b_core_phy_clk(wlc_hw, ON); - - /* band-specific initializations */ - brcms_b_bsinit(wlc, chanspec); - - /* - * If there are any pending software interrupt bits, - * then replace these with a harmless nonzero value - * so brcms_c_dpc() will re-enable interrupts when done. - */ - if (wlc->macintstatus) - wlc->macintstatus = MI_DMAINT; - - /* restore macintmask */ - brcms_intrsrestore(wlc->wl, macintmask); - - /* ucode should still be suspended.. */ - WARN_ON((bcma_read32(wlc_hw->d11core, D11REGOFFS(maccontrol)) & - MCTL_EN_MAC) != 0); -} - -static bool brcms_c_isgoodchip(struct brcms_hardware *wlc_hw) -{ - - /* reject unsupported corerev */ - if (!CONF_HAS(D11CONF, wlc_hw->corerev)) { - wiphy_err(wlc_hw->wlc->wiphy, "unsupported core rev %d\n", - wlc_hw->corerev); - return false; - } - - return true; -} - -/* Validate some board info parameters */ -static bool brcms_c_validboardtype(struct brcms_hardware *wlc_hw) -{ - uint boardrev = wlc_hw->boardrev; - - /* 4 bits each for board type, major, minor, and tiny version */ - uint brt = (boardrev & 0xf000) >> 12; - uint b0 = (boardrev & 0xf00) >> 8; - uint b1 = (boardrev & 0xf0) >> 4; - uint b2 = boardrev & 0xf; - - /* voards from other vendors are always considered valid */ - if (ai_get_boardvendor(wlc_hw->sih) != PCI_VENDOR_ID_BROADCOM) - return true; - - /* do some boardrev sanity checks when boardvendor is Broadcom */ - if (boardrev == 0) - return false; - - if (boardrev <= 0xff) - return true; - - if ((brt > 2) || (brt == 0) || (b0 > 9) || (b0 == 0) || (b1 > 9) - || (b2 > 9)) - return false; - - return true; -} - -static void brcms_c_get_macaddr(struct brcms_hardware *wlc_hw, u8 etheraddr[ETH_ALEN]) -{ - struct ssb_sprom *sprom = &wlc_hw->d11core->bus->sprom; - - /* If macaddr exists, use it (Sromrev4, CIS, ...). */ - if (!is_zero_ether_addr(sprom->il0mac)) { - memcpy(etheraddr, sprom->il0mac, 6); - return; - } - - if (wlc_hw->_nbands > 1) - memcpy(etheraddr, sprom->et1mac, 6); - else - memcpy(etheraddr, sprom->il0mac, 6); -} - -/* power both the pll and external oscillator on/off */ -static void brcms_b_xtal(struct brcms_hardware *wlc_hw, bool want) -{ - brcms_dbg_info(wlc_hw->d11core, "wl%d: want %d\n", wlc_hw->unit, want); - - /* - * dont power down if plldown is false or - * we must poll hw radio disable - */ - if (!want && wlc_hw->pllreq) - return; - - wlc_hw->sbclk = want; - if (!wlc_hw->sbclk) { - wlc_hw->clk = false; - if (wlc_hw->band && wlc_hw->band->pi) - wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, false); - } -} - -/* - * Return true if radio is disabled, otherwise false. - * hw radio disable signal is an external pin, users activate it asynchronously - * this function could be called when driver is down and w/o clock - * it operates on different registers depending on corerev and boardflag. - */ -static bool brcms_b_radio_read_hwdisabled(struct brcms_hardware *wlc_hw) -{ - bool v, clk, xtal; - u32 flags = 0; - - xtal = wlc_hw->sbclk; - if (!xtal) - brcms_b_xtal(wlc_hw, ON); - - /* may need to take core out of reset first */ - clk = wlc_hw->clk; - if (!clk) { - /* - * mac no longer enables phyclk automatically when driver - * accesses phyreg throughput mac. This can be skipped since - * only mac reg is accessed below - */ - if (D11REV_GE(wlc_hw->corerev, 18)) - flags |= SICF_PCLKE; - - /* - * TODO: test suspend/resume - * - * AI chip doesn't restore bar0win2 on - * hibernation/resume, need sw fixup - */ - - bcma_core_enable(wlc_hw->d11core, flags); - brcms_c_mctrl_reset(wlc_hw); - } - - v = ((bcma_read32(wlc_hw->d11core, - D11REGOFFS(phydebug)) & PDBG_RFD) != 0); - - /* put core back into reset */ - if (!clk) - bcma_core_disable(wlc_hw->d11core, 0); - - if (!xtal) - brcms_b_xtal(wlc_hw, OFF); - - return v; -} - -static bool wlc_dma_rxreset(struct brcms_hardware *wlc_hw, uint fifo) -{ - struct dma_pub *di = wlc_hw->di[fifo]; - return dma_rxreset(di); -} - -/* d11 core reset - * ensure fask clock during reset - * reset dma - * reset d11(out of reset) - * reset phy(out of reset) - * clear software macintstatus for fresh new start - * one testing hack wlc_hw->noreset will bypass the d11/phy reset - */ -void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags) -{ - uint i; - bool fastclk; - - if (flags == BRCMS_USE_COREFLAGS) - flags = (wlc_hw->band->pi ? wlc_hw->band->core_flags : 0); - - brcms_dbg_info(wlc_hw->d11core, "wl%d: core reset\n", wlc_hw->unit); - - /* request FAST clock if not on */ - fastclk = wlc_hw->forcefastclk; - if (!fastclk) - brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); - - /* reset the dma engines except first time thru */ - if (bcma_core_is_enabled(wlc_hw->d11core)) { - for (i = 0; i < NFIFO; i++) - if ((wlc_hw->di[i]) && (!dma_txreset(wlc_hw->di[i]))) - brcms_err(wlc_hw->d11core, "wl%d: %s: " - "dma_txreset[%d]: cannot stop dma\n", - wlc_hw->unit, __func__, i); - - if ((wlc_hw->di[RX_FIFO]) - && (!wlc_dma_rxreset(wlc_hw, RX_FIFO))) - brcms_err(wlc_hw->d11core, "wl%d: %s: dma_rxreset" - "[%d]: cannot stop dma\n", - wlc_hw->unit, __func__, RX_FIFO); - } - /* if noreset, just stop the psm and return */ - if (wlc_hw->noreset) { - wlc_hw->wlc->macintstatus = 0; /* skip wl_dpc after down */ - brcms_b_mctrl(wlc_hw, MCTL_PSM_RUN | MCTL_EN_MAC, 0); - return; - } - - /* - * mac no longer enables phyclk automatically when driver accesses - * phyreg throughput mac, AND phy_reset is skipped at early stage when - * band->pi is invalid. need to enable PHY CLK - */ - if (D11REV_GE(wlc_hw->corerev, 18)) - flags |= SICF_PCLKE; - - /* - * reset the core - * In chips with PMU, the fastclk request goes through d11 core - * reg 0x1e0, which is cleared by the core_reset. have to re-request it. - * - * This adds some delay and we can optimize it by also requesting - * fastclk through chipcommon during this period if necessary. But - * that has to work coordinate with other driver like mips/arm since - * they may touch chipcommon as well. - */ - wlc_hw->clk = false; - bcma_core_enable(wlc_hw->d11core, flags); - wlc_hw->clk = true; - if (wlc_hw->band && wlc_hw->band->pi) - wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, true); - - brcms_c_mctrl_reset(wlc_hw); - - if (ai_get_cccaps(wlc_hw->sih) & CC_CAP_PMU) - brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); - - brcms_b_phy_reset(wlc_hw); - - /* turn on PHY_PLL */ - brcms_b_core_phypll_ctl(wlc_hw, true); - - /* clear sw intstatus */ - wlc_hw->wlc->macintstatus = 0; - - /* restore the clk setting */ - if (!fastclk) - brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); -} - -/* txfifo sizes needs to be modified(increased) since the newer cores - * have more memory. - */ -static void brcms_b_corerev_fifofixup(struct brcms_hardware *wlc_hw) -{ - struct bcma_device *core = wlc_hw->d11core; - u16 fifo_nu; - u16 txfifo_startblk = TXFIFO_START_BLK, txfifo_endblk; - u16 txfifo_def, txfifo_def1; - u16 txfifo_cmd; - - /* tx fifos start at TXFIFO_START_BLK from the Base address */ - txfifo_startblk = TXFIFO_START_BLK; - - /* sequence of operations: reset fifo, set fifo size, reset fifo */ - for (fifo_nu = 0; fifo_nu < NFIFO; fifo_nu++) { - - txfifo_endblk = txfifo_startblk + wlc_hw->xmtfifo_sz[fifo_nu]; - txfifo_def = (txfifo_startblk & 0xff) | - (((txfifo_endblk - 1) & 0xff) << TXFIFO_FIFOTOP_SHIFT); - txfifo_def1 = ((txfifo_startblk >> 8) & 0x1) | - ((((txfifo_endblk - - 1) >> 8) & 0x1) << TXFIFO_FIFOTOP_SHIFT); - txfifo_cmd = - TXFIFOCMD_RESET_MASK | (fifo_nu << TXFIFOCMD_FIFOSEL_SHIFT); - - bcma_write16(core, D11REGOFFS(xmtfifocmd), txfifo_cmd); - bcma_write16(core, D11REGOFFS(xmtfifodef), txfifo_def); - bcma_write16(core, D11REGOFFS(xmtfifodef1), txfifo_def1); - - bcma_write16(core, D11REGOFFS(xmtfifocmd), txfifo_cmd); - - txfifo_startblk += wlc_hw->xmtfifo_sz[fifo_nu]; - } - /* - * need to propagate to shm location to be in sync since ucode/hw won't - * do this - */ - brcms_b_write_shm(wlc_hw, M_FIFOSIZE0, - wlc_hw->xmtfifo_sz[TX_AC_BE_FIFO]); - brcms_b_write_shm(wlc_hw, M_FIFOSIZE1, - wlc_hw->xmtfifo_sz[TX_AC_VI_FIFO]); - brcms_b_write_shm(wlc_hw, M_FIFOSIZE2, - ((wlc_hw->xmtfifo_sz[TX_AC_VO_FIFO] << 8) | wlc_hw-> - xmtfifo_sz[TX_AC_BK_FIFO])); - brcms_b_write_shm(wlc_hw, M_FIFOSIZE3, - ((wlc_hw->xmtfifo_sz[TX_ATIM_FIFO] << 8) | wlc_hw-> - xmtfifo_sz[TX_BCMC_FIFO])); -} - -/* This function is used for changing the tsf frac register - * If spur avoidance mode is off, the mac freq will be 80/120/160Mhz - * If spur avoidance mode is on1, the mac freq will be 82/123/164Mhz - * If spur avoidance mode is on2, the mac freq will be 84/126/168Mhz - * HTPHY Formula is 2^26/freq(MHz) e.g. - * For spuron2 - 126MHz -> 2^26/126 = 532610.0 - * - 532610 = 0x82082 => tsf_clk_frac_h = 0x8, tsf_clk_frac_l = 0x2082 - * For spuron: 123MHz -> 2^26/123 = 545600.5 - * - 545601 = 0x85341 => tsf_clk_frac_h = 0x8, tsf_clk_frac_l = 0x5341 - * For spur off: 120MHz -> 2^26/120 = 559240.5 - * - 559241 = 0x88889 => tsf_clk_frac_h = 0x8, tsf_clk_frac_l = 0x8889 - */ - -void brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode) -{ - struct bcma_device *core = wlc_hw->d11core; - - if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43224) || - (ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43225)) { - if (spurmode == WL_SPURAVOID_ON2) { /* 126Mhz */ - bcma_write16(core, D11REGOFFS(tsf_clk_frac_l), 0x2082); - bcma_write16(core, D11REGOFFS(tsf_clk_frac_h), 0x8); - } else if (spurmode == WL_SPURAVOID_ON1) { /* 123Mhz */ - bcma_write16(core, D11REGOFFS(tsf_clk_frac_l), 0x5341); - bcma_write16(core, D11REGOFFS(tsf_clk_frac_h), 0x8); - } else { /* 120Mhz */ - bcma_write16(core, D11REGOFFS(tsf_clk_frac_l), 0x8889); - bcma_write16(core, D11REGOFFS(tsf_clk_frac_h), 0x8); - } - } else if (BRCMS_ISLCNPHY(wlc_hw->band)) { - if (spurmode == WL_SPURAVOID_ON1) { /* 82Mhz */ - bcma_write16(core, D11REGOFFS(tsf_clk_frac_l), 0x7CE0); - bcma_write16(core, D11REGOFFS(tsf_clk_frac_h), 0xC); - } else { /* 80Mhz */ - bcma_write16(core, D11REGOFFS(tsf_clk_frac_l), 0xCCCD); - bcma_write16(core, D11REGOFFS(tsf_clk_frac_h), 0xC); - } - } -} - -void brcms_c_start_station(struct brcms_c_info *wlc, u8 *addr) -{ - memcpy(wlc->pub->cur_etheraddr, addr, sizeof(wlc->pub->cur_etheraddr)); - wlc->bsscfg->type = BRCMS_TYPE_STATION; -} - -void brcms_c_start_ap(struct brcms_c_info *wlc, u8 *addr, const u8 *bssid, - u8 *ssid, size_t ssid_len) -{ - brcms_c_set_ssid(wlc, ssid, ssid_len); - - memcpy(wlc->pub->cur_etheraddr, addr, sizeof(wlc->pub->cur_etheraddr)); - memcpy(wlc->bsscfg->BSSID, bssid, sizeof(wlc->bsscfg->BSSID)); - wlc->bsscfg->type = BRCMS_TYPE_AP; - - brcms_b_mctrl(wlc->hw, MCTL_AP | MCTL_INFRA, MCTL_AP | MCTL_INFRA); -} - -void brcms_c_start_adhoc(struct brcms_c_info *wlc, u8 *addr) -{ - memcpy(wlc->pub->cur_etheraddr, addr, sizeof(wlc->pub->cur_etheraddr)); - wlc->bsscfg->type = BRCMS_TYPE_ADHOC; - - brcms_b_mctrl(wlc->hw, MCTL_AP | MCTL_INFRA, 0); -} - -/* Initialize GPIOs that are controlled by D11 core */ -static void brcms_c_gpio_init(struct brcms_c_info *wlc) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - u32 gc, gm; - - /* use GPIO select 0 to get all gpio signals from the gpio out reg */ - brcms_b_mctrl(wlc_hw, MCTL_GPOUT_SEL_MASK, 0); - - /* - * Common GPIO setup: - * G0 = LED 0 = WLAN Activity - * G1 = LED 1 = WLAN 2.4 GHz Radio State - * G2 = LED 2 = WLAN 5 GHz Radio State - * G4 = radio disable input (HI enabled, LO disabled) - */ - - gc = gm = 0; - - /* Allocate GPIOs for mimo antenna diversity feature */ - if (wlc_hw->antsel_type == ANTSEL_2x3) { - /* Enable antenna diversity, use 2x3 mode */ - brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_EN, - MHF3_ANTSEL_EN, BRCM_BAND_ALL); - brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_MODE, - MHF3_ANTSEL_MODE, BRCM_BAND_ALL); - - /* init superswitch control */ - wlc_phy_antsel_init(wlc_hw->band->pi, false); - - } else if (wlc_hw->antsel_type == ANTSEL_2x4) { - gm |= gc |= (BOARD_GPIO_12 | BOARD_GPIO_13); - /* - * The board itself is powered by these GPIOs - * (when not sending pattern) so set them high - */ - bcma_set16(wlc_hw->d11core, D11REGOFFS(psm_gpio_oe), - (BOARD_GPIO_12 | BOARD_GPIO_13)); - bcma_set16(wlc_hw->d11core, D11REGOFFS(psm_gpio_out), - (BOARD_GPIO_12 | BOARD_GPIO_13)); - - /* Enable antenna diversity, use 2x4 mode */ - brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_EN, - MHF3_ANTSEL_EN, BRCM_BAND_ALL); - brcms_b_mhf(wlc_hw, MHF3, MHF3_ANTSEL_MODE, 0, - BRCM_BAND_ALL); - - /* Configure the desired clock to be 4Mhz */ - brcms_b_write_shm(wlc_hw, M_ANTSEL_CLKDIV, - ANTSEL_CLKDIV_4MHZ); - } - - /* - * gpio 9 controls the PA. ucode is responsible - * for wiggling out and oe - */ - if (wlc_hw->boardflags & BFL_PACTRL) - gm |= gc |= BOARD_GPIO_PACTRL; - - /* apply to gpiocontrol register */ - bcma_chipco_gpio_control(&wlc_hw->d11core->bus->drv_cc, gm, gc); -} - -static void brcms_ucode_write(struct brcms_hardware *wlc_hw, - const __le32 ucode[], const size_t nbytes) -{ - struct bcma_device *core = wlc_hw->d11core; - uint i; - uint count; - - brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); - - count = (nbytes / sizeof(u32)); - - bcma_write32(core, D11REGOFFS(objaddr), - OBJADDR_AUTO_INC | OBJADDR_UCM_SEL); - (void)bcma_read32(core, D11REGOFFS(objaddr)); - for (i = 0; i < count; i++) - bcma_write32(core, D11REGOFFS(objdata), le32_to_cpu(ucode[i])); - -} - -static void brcms_ucode_download(struct brcms_hardware *wlc_hw) -{ - struct brcms_c_info *wlc; - struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; - - wlc = wlc_hw->wlc; - - if (wlc_hw->ucode_loaded) - return; - - if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { - if (BRCMS_ISNPHY(wlc_hw->band)) { - brcms_ucode_write(wlc_hw, ucode->bcm43xx_16_mimo, - ucode->bcm43xx_16_mimosz); - wlc_hw->ucode_loaded = true; - } else - brcms_err(wlc_hw->d11core, - "%s: wl%d: unsupported phy in corerev %d\n", - __func__, wlc_hw->unit, wlc_hw->corerev); - } else if (D11REV_IS(wlc_hw->corerev, 24)) { - if (BRCMS_ISLCNPHY(wlc_hw->band)) { - brcms_ucode_write(wlc_hw, ucode->bcm43xx_24_lcn, - ucode->bcm43xx_24_lcnsz); - wlc_hw->ucode_loaded = true; - } else { - brcms_err(wlc_hw->d11core, - "%s: wl%d: unsupported phy in corerev %d\n", - __func__, wlc_hw->unit, wlc_hw->corerev); - } - } -} - -void brcms_b_txant_set(struct brcms_hardware *wlc_hw, u16 phytxant) -{ - /* update sw state */ - wlc_hw->bmac_phytxant = phytxant; - - /* push to ucode if up */ - if (!wlc_hw->up) - return; - brcms_c_ucode_txant_set(wlc_hw); - -} - -u16 brcms_b_get_txant(struct brcms_hardware *wlc_hw) -{ - return (u16) wlc_hw->wlc->stf->txant; -} - -void brcms_b_antsel_type_set(struct brcms_hardware *wlc_hw, u8 antsel_type) -{ - wlc_hw->antsel_type = antsel_type; - - /* Update the antsel type for phy module to use */ - wlc_phy_antsel_type_set(wlc_hw->band->pi, antsel_type); -} - -static void brcms_b_fifoerrors(struct brcms_hardware *wlc_hw) -{ - bool fatal = false; - uint unit; - uint intstatus, idx; - struct bcma_device *core = wlc_hw->d11core; - - unit = wlc_hw->unit; - - for (idx = 0; idx < NFIFO; idx++) { - /* read intstatus register and ignore any non-error bits */ - intstatus = - bcma_read32(core, - D11REGOFFS(intctrlregs[idx].intstatus)) & - I_ERRORS; - if (!intstatus) - continue; - - brcms_dbg_int(core, "wl%d: intstatus%d 0x%x\n", - unit, idx, intstatus); - - if (intstatus & I_RO) { - brcms_err(core, "wl%d: fifo %d: receive fifo " - "overflow\n", unit, idx); - fatal = true; - } - - if (intstatus & I_PC) { - brcms_err(core, "wl%d: fifo %d: descriptor error\n", - unit, idx); - fatal = true; - } - - if (intstatus & I_PD) { - brcms_err(core, "wl%d: fifo %d: data error\n", unit, - idx); - fatal = true; - } - - if (intstatus & I_DE) { - brcms_err(core, "wl%d: fifo %d: descriptor protocol " - "error\n", unit, idx); - fatal = true; - } - - if (intstatus & I_RU) - brcms_err(core, "wl%d: fifo %d: receive descriptor " - "underflow\n", idx, unit); - - if (intstatus & I_XU) { - brcms_err(core, "wl%d: fifo %d: transmit fifo " - "underflow\n", idx, unit); - fatal = true; - } - - if (fatal) { - brcms_fatal_error(wlc_hw->wlc->wl); /* big hammer */ - break; - } else - bcma_write32(core, - D11REGOFFS(intctrlregs[idx].intstatus), - intstatus); - } -} - -void brcms_c_intrson(struct brcms_c_info *wlc) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - wlc->macintmask = wlc->defmacintmask; - bcma_write32(wlc_hw->d11core, D11REGOFFS(macintmask), wlc->macintmask); -} - -u32 brcms_c_intrsoff(struct brcms_c_info *wlc) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - u32 macintmask; - - if (!wlc_hw->clk) - return 0; - - macintmask = wlc->macintmask; /* isr can still happen */ - - bcma_write32(wlc_hw->d11core, D11REGOFFS(macintmask), 0); - (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(macintmask)); - udelay(1); /* ensure int line is no longer driven */ - wlc->macintmask = 0; - - /* return previous macintmask; resolve race between us and our isr */ - return wlc->macintstatus ? 0 : macintmask; -} - -void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - if (!wlc_hw->clk) - return; - - wlc->macintmask = macintmask; - bcma_write32(wlc_hw->d11core, D11REGOFFS(macintmask), wlc->macintmask); -} - -/* assumes that the d11 MAC is enabled */ -static void brcms_b_tx_fifo_suspend(struct brcms_hardware *wlc_hw, - uint tx_fifo) -{ - u8 fifo = 1 << tx_fifo; - - /* Two clients of this code, 11h Quiet period and scanning. */ - - /* only suspend if not already suspended */ - if ((wlc_hw->suspended_fifos & fifo) == fifo) - return; - - /* force the core awake only if not already */ - if (wlc_hw->suspended_fifos == 0) - brcms_c_ucode_wake_override_set(wlc_hw, - BRCMS_WAKE_OVERRIDE_TXFIFO); - - wlc_hw->suspended_fifos |= fifo; - - if (wlc_hw->di[tx_fifo]) { - /* - * Suspending AMPDU transmissions in the middle can cause - * underflow which may result in mismatch between ucode and - * driver so suspend the mac before suspending the FIFO - */ - if (BRCMS_PHY_11N_CAP(wlc_hw->band)) - brcms_c_suspend_mac_and_wait(wlc_hw->wlc); - - dma_txsuspend(wlc_hw->di[tx_fifo]); - - if (BRCMS_PHY_11N_CAP(wlc_hw->band)) - brcms_c_enable_mac(wlc_hw->wlc); - } -} - -static void brcms_b_tx_fifo_resume(struct brcms_hardware *wlc_hw, - uint tx_fifo) -{ - /* BMAC_NOTE: BRCMS_TX_FIFO_ENAB is done in brcms_c_dpc() for DMA case - * but need to be done here for PIO otherwise the watchdog will catch - * the inconsistency and fire - */ - /* Two clients of this code, 11h Quiet period and scanning. */ - if (wlc_hw->di[tx_fifo]) - dma_txresume(wlc_hw->di[tx_fifo]); - - /* allow core to sleep again */ - if (wlc_hw->suspended_fifos == 0) - return; - else { - wlc_hw->suspended_fifos &= ~(1 << tx_fifo); - if (wlc_hw->suspended_fifos == 0) - brcms_c_ucode_wake_override_clear(wlc_hw, - BRCMS_WAKE_OVERRIDE_TXFIFO); - } -} - -/* precondition: requires the mac core to be enabled */ -static void brcms_b_mute(struct brcms_hardware *wlc_hw, bool mute_tx) -{ - static const u8 null_ether_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0}; - u8 *ethaddr = wlc_hw->wlc->pub->cur_etheraddr; - - if (mute_tx) { - /* suspend tx fifos */ - brcms_b_tx_fifo_suspend(wlc_hw, TX_DATA_FIFO); - brcms_b_tx_fifo_suspend(wlc_hw, TX_CTL_FIFO); - brcms_b_tx_fifo_suspend(wlc_hw, TX_AC_BK_FIFO); - brcms_b_tx_fifo_suspend(wlc_hw, TX_AC_VI_FIFO); - - /* zero the address match register so we do not send ACKs */ - brcms_b_set_addrmatch(wlc_hw, RCM_MAC_OFFSET, null_ether_addr); - } else { - /* resume tx fifos */ - brcms_b_tx_fifo_resume(wlc_hw, TX_DATA_FIFO); - brcms_b_tx_fifo_resume(wlc_hw, TX_CTL_FIFO); - brcms_b_tx_fifo_resume(wlc_hw, TX_AC_BK_FIFO); - brcms_b_tx_fifo_resume(wlc_hw, TX_AC_VI_FIFO); - - /* Restore address */ - brcms_b_set_addrmatch(wlc_hw, RCM_MAC_OFFSET, ethaddr); - } - - wlc_phy_mute_upd(wlc_hw->band->pi, mute_tx, 0); - - if (mute_tx) - brcms_c_ucode_mute_override_set(wlc_hw); - else - brcms_c_ucode_mute_override_clear(wlc_hw); -} - -void -brcms_c_mute(struct brcms_c_info *wlc, bool mute_tx) -{ - brcms_b_mute(wlc->hw, mute_tx); -} - -/* - * Read and clear macintmask and macintstatus and intstatus registers. - * This routine should be called with interrupts off - * Return: - * -1 if brcms_deviceremoved(wlc) evaluates to true; - * 0 if the interrupt is not for us, or we are in some special cases; - * device interrupt status bits otherwise. - */ -static inline u32 wlc_intstatus(struct brcms_c_info *wlc, bool in_isr) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - struct bcma_device *core = wlc_hw->d11core; - u32 macintstatus, mask; - - /* macintstatus includes a DMA interrupt summary bit */ - macintstatus = bcma_read32(core, D11REGOFFS(macintstatus)); - mask = in_isr ? wlc->macintmask : wlc->defmacintmask; - - trace_brcms_macintstatus(&core->dev, in_isr, macintstatus, mask); - - /* detect cardbus removed, in power down(suspend) and in reset */ - if (brcms_deviceremoved(wlc)) - return -1; - - /* brcms_deviceremoved() succeeds even when the core is still resetting, - * handle that case here. - */ - if (macintstatus == 0xffffffff) - return 0; - - /* defer unsolicited interrupts */ - macintstatus &= mask; - - /* if not for us */ - if (macintstatus == 0) - return 0; - - /* turn off the interrupts */ - bcma_write32(core, D11REGOFFS(macintmask), 0); - (void)bcma_read32(core, D11REGOFFS(macintmask)); - wlc->macintmask = 0; - - /* clear device interrupts */ - bcma_write32(core, D11REGOFFS(macintstatus), macintstatus); - - /* MI_DMAINT is indication of non-zero intstatus */ - if (macintstatus & MI_DMAINT) - /* - * only fifo interrupt enabled is I_RI in - * RX_FIFO. If MI_DMAINT is set, assume it - * is set and clear the interrupt. - */ - bcma_write32(core, D11REGOFFS(intctrlregs[RX_FIFO].intstatus), - DEF_RXINTMASK); - - return macintstatus; -} - -/* Update wlc->macintstatus and wlc->intstatus[]. */ -/* Return true if they are updated successfully. false otherwise */ -bool brcms_c_intrsupd(struct brcms_c_info *wlc) -{ - u32 macintstatus; - - /* read and clear macintstatus and intstatus registers */ - macintstatus = wlc_intstatus(wlc, false); - - /* device is removed */ - if (macintstatus == 0xffffffff) - return false; - - /* update interrupt status in software */ - wlc->macintstatus |= macintstatus; - - return true; -} - -/* - * First-level interrupt processing. - * Return true if this was our interrupt - * and if further brcms_c_dpc() processing is required, - * false otherwise. - */ -bool brcms_c_isr(struct brcms_c_info *wlc) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - u32 macintstatus; - - if (!wlc_hw->up || !wlc->macintmask) - return false; - - /* read and clear macintstatus and intstatus registers */ - macintstatus = wlc_intstatus(wlc, true); - - if (macintstatus == 0xffffffff) { - brcms_err(wlc_hw->d11core, - "DEVICEREMOVED detected in the ISR code path\n"); - return false; - } - - /* it is not for us */ - if (macintstatus == 0) - return false; - - /* save interrupt status bits */ - wlc->macintstatus = macintstatus; - - return true; - -} - -void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - struct bcma_device *core = wlc_hw->d11core; - u32 mc, mi; - - brcms_dbg_mac80211(core, "wl%d: bandunit %d\n", wlc_hw->unit, - wlc_hw->band->bandunit); - - /* - * Track overlapping suspend requests - */ - wlc_hw->mac_suspend_depth++; - if (wlc_hw->mac_suspend_depth > 1) - return; - - /* force the core awake */ - brcms_c_ucode_wake_override_set(wlc_hw, BRCMS_WAKE_OVERRIDE_MACSUSPEND); - - mc = bcma_read32(core, D11REGOFFS(maccontrol)); - - if (mc == 0xffffffff) { - brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, - __func__); - brcms_down(wlc->wl); - return; - } - WARN_ON(mc & MCTL_PSM_JMP_0); - WARN_ON(!(mc & MCTL_PSM_RUN)); - WARN_ON(!(mc & MCTL_EN_MAC)); - - mi = bcma_read32(core, D11REGOFFS(macintstatus)); - if (mi == 0xffffffff) { - brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, - __func__); - brcms_down(wlc->wl); - return; - } - WARN_ON(mi & MI_MACSSPNDD); - - brcms_b_mctrl(wlc_hw, MCTL_EN_MAC, 0); - - SPINWAIT(!(bcma_read32(core, D11REGOFFS(macintstatus)) & MI_MACSSPNDD), - BRCMS_MAX_MAC_SUSPEND); - - if (!(bcma_read32(core, D11REGOFFS(macintstatus)) & MI_MACSSPNDD)) { - brcms_err(core, "wl%d: wlc_suspend_mac_and_wait: waited %d uS" - " and MI_MACSSPNDD is still not on.\n", - wlc_hw->unit, BRCMS_MAX_MAC_SUSPEND); - brcms_err(core, "wl%d: psmdebug 0x%08x, phydebug 0x%08x, " - "psm_brc 0x%04x\n", wlc_hw->unit, - bcma_read32(core, D11REGOFFS(psmdebug)), - bcma_read32(core, D11REGOFFS(phydebug)), - bcma_read16(core, D11REGOFFS(psm_brc))); - } - - mc = bcma_read32(core, D11REGOFFS(maccontrol)); - if (mc == 0xffffffff) { - brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, - __func__); - brcms_down(wlc->wl); - return; - } - WARN_ON(mc & MCTL_PSM_JMP_0); - WARN_ON(!(mc & MCTL_PSM_RUN)); - WARN_ON(mc & MCTL_EN_MAC); -} - -void brcms_c_enable_mac(struct brcms_c_info *wlc) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - struct bcma_device *core = wlc_hw->d11core; - u32 mc, mi; - - brcms_dbg_mac80211(core, "wl%d: bandunit %d\n", wlc_hw->unit, - wlc->band->bandunit); - - /* - * Track overlapping suspend requests - */ - wlc_hw->mac_suspend_depth--; - if (wlc_hw->mac_suspend_depth > 0) - return; - - mc = bcma_read32(core, D11REGOFFS(maccontrol)); - WARN_ON(mc & MCTL_PSM_JMP_0); - WARN_ON(mc & MCTL_EN_MAC); - WARN_ON(!(mc & MCTL_PSM_RUN)); - - brcms_b_mctrl(wlc_hw, MCTL_EN_MAC, MCTL_EN_MAC); - bcma_write32(core, D11REGOFFS(macintstatus), MI_MACSSPNDD); - - mc = bcma_read32(core, D11REGOFFS(maccontrol)); - WARN_ON(mc & MCTL_PSM_JMP_0); - WARN_ON(!(mc & MCTL_EN_MAC)); - WARN_ON(!(mc & MCTL_PSM_RUN)); - - mi = bcma_read32(core, D11REGOFFS(macintstatus)); - WARN_ON(mi & MI_MACSSPNDD); - - brcms_c_ucode_wake_override_clear(wlc_hw, - BRCMS_WAKE_OVERRIDE_MACSUSPEND); -} - -void brcms_b_band_stf_ss_set(struct brcms_hardware *wlc_hw, u8 stf_mode) -{ - wlc_hw->hw_stf_ss_opmode = stf_mode; - - if (wlc_hw->clk) - brcms_upd_ofdm_pctl1_table(wlc_hw); -} - -static bool brcms_b_validate_chip_access(struct brcms_hardware *wlc_hw) -{ - struct bcma_device *core = wlc_hw->d11core; - u32 w, val; - struct wiphy *wiphy = wlc_hw->wlc->wiphy; - - /* Validate dchip register access */ - - bcma_write32(core, D11REGOFFS(objaddr), OBJADDR_SHM_SEL | 0); - (void)bcma_read32(core, D11REGOFFS(objaddr)); - w = bcma_read32(core, D11REGOFFS(objdata)); - - /* Can we write and read back a 32bit register? */ - bcma_write32(core, D11REGOFFS(objaddr), OBJADDR_SHM_SEL | 0); - (void)bcma_read32(core, D11REGOFFS(objaddr)); - bcma_write32(core, D11REGOFFS(objdata), (u32) 0xaa5555aa); - - bcma_write32(core, D11REGOFFS(objaddr), OBJADDR_SHM_SEL | 0); - (void)bcma_read32(core, D11REGOFFS(objaddr)); - val = bcma_read32(core, D11REGOFFS(objdata)); - if (val != (u32) 0xaa5555aa) { - wiphy_err(wiphy, "wl%d: validate_chip_access: SHM = 0x%x, " - "expected 0xaa5555aa\n", wlc_hw->unit, val); - return false; - } - - bcma_write32(core, D11REGOFFS(objaddr), OBJADDR_SHM_SEL | 0); - (void)bcma_read32(core, D11REGOFFS(objaddr)); - bcma_write32(core, D11REGOFFS(objdata), (u32) 0x55aaaa55); - - bcma_write32(core, D11REGOFFS(objaddr), OBJADDR_SHM_SEL | 0); - (void)bcma_read32(core, D11REGOFFS(objaddr)); - val = bcma_read32(core, D11REGOFFS(objdata)); - if (val != (u32) 0x55aaaa55) { - wiphy_err(wiphy, "wl%d: validate_chip_access: SHM = 0x%x, " - "expected 0x55aaaa55\n", wlc_hw->unit, val); - return false; - } - - bcma_write32(core, D11REGOFFS(objaddr), OBJADDR_SHM_SEL | 0); - (void)bcma_read32(core, D11REGOFFS(objaddr)); - bcma_write32(core, D11REGOFFS(objdata), w); - - /* clear CFPStart */ - bcma_write32(core, D11REGOFFS(tsf_cfpstart), 0); - - w = bcma_read32(core, D11REGOFFS(maccontrol)); - if ((w != (MCTL_IHR_EN | MCTL_WAKE)) && - (w != (MCTL_IHR_EN | MCTL_GMODE | MCTL_WAKE))) { - wiphy_err(wiphy, "wl%d: validate_chip_access: maccontrol = " - "0x%x, expected 0x%x or 0x%x\n", wlc_hw->unit, w, - (MCTL_IHR_EN | MCTL_WAKE), - (MCTL_IHR_EN | MCTL_GMODE | MCTL_WAKE)); - return false; - } - - return true; -} - -#define PHYPLL_WAIT_US 100000 - -void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on) -{ - struct bcma_device *core = wlc_hw->d11core; - u32 tmp; - - brcms_dbg_info(core, "wl%d\n", wlc_hw->unit); - - tmp = 0; - - if (on) { - if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM4313)) { - bcma_set32(core, D11REGOFFS(clk_ctl_st), - CCS_ERSRC_REQ_HT | - CCS_ERSRC_REQ_D11PLL | - CCS_ERSRC_REQ_PHYPLL); - SPINWAIT((bcma_read32(core, D11REGOFFS(clk_ctl_st)) & - CCS_ERSRC_AVAIL_HT) != CCS_ERSRC_AVAIL_HT, - PHYPLL_WAIT_US); - - tmp = bcma_read32(core, D11REGOFFS(clk_ctl_st)); - if ((tmp & CCS_ERSRC_AVAIL_HT) != CCS_ERSRC_AVAIL_HT) - brcms_err(core, "%s: turn on PHY PLL failed\n", - __func__); - } else { - bcma_set32(core, D11REGOFFS(clk_ctl_st), - tmp | CCS_ERSRC_REQ_D11PLL | - CCS_ERSRC_REQ_PHYPLL); - SPINWAIT((bcma_read32(core, D11REGOFFS(clk_ctl_st)) & - (CCS_ERSRC_AVAIL_D11PLL | - CCS_ERSRC_AVAIL_PHYPLL)) != - (CCS_ERSRC_AVAIL_D11PLL | - CCS_ERSRC_AVAIL_PHYPLL), PHYPLL_WAIT_US); - - tmp = bcma_read32(core, D11REGOFFS(clk_ctl_st)); - if ((tmp & - (CCS_ERSRC_AVAIL_D11PLL | CCS_ERSRC_AVAIL_PHYPLL)) - != - (CCS_ERSRC_AVAIL_D11PLL | CCS_ERSRC_AVAIL_PHYPLL)) - brcms_err(core, "%s: turn on PHY PLL failed\n", - __func__); - } - } else { - /* - * Since the PLL may be shared, other cores can still - * be requesting it; so we'll deassert the request but - * not wait for status to comply. - */ - bcma_mask32(core, D11REGOFFS(clk_ctl_st), - ~CCS_ERSRC_REQ_PHYPLL); - (void)bcma_read32(core, D11REGOFFS(clk_ctl_st)); - } -} - -static void brcms_c_coredisable(struct brcms_hardware *wlc_hw) -{ - bool dev_gone; - - brcms_dbg_info(wlc_hw->d11core, "wl%d: disable core\n", wlc_hw->unit); - - dev_gone = brcms_deviceremoved(wlc_hw->wlc); - - if (dev_gone) - return; - - if (wlc_hw->noreset) - return; - - /* radio off */ - wlc_phy_switch_radio(wlc_hw->band->pi, OFF); - - /* turn off analog core */ - wlc_phy_anacore(wlc_hw->band->pi, OFF); - - /* turn off PHYPLL to save power */ - brcms_b_core_phypll_ctl(wlc_hw, false); - - wlc_hw->clk = false; - bcma_core_disable(wlc_hw->d11core, 0); - wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, false); -} - -static void brcms_c_flushqueues(struct brcms_c_info *wlc) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - uint i; - - /* free any posted tx packets */ - for (i = 0; i < NFIFO; i++) { - if (wlc_hw->di[i]) { - dma_txreclaim(wlc_hw->di[i], DMA_RANGE_ALL); - if (i < TX_BCMC_FIFO) - ieee80211_wake_queue(wlc->pub->ieee_hw, - brcms_fifo_to_ac(i)); - } - } - - /* free any posted rx packets */ - dma_rxreclaim(wlc_hw->di[RX_FIFO]); -} - -static u16 -brcms_b_read_objmem(struct brcms_hardware *wlc_hw, uint offset, u32 sel) -{ - struct bcma_device *core = wlc_hw->d11core; - u16 objoff = D11REGOFFS(objdata); - - bcma_write32(core, D11REGOFFS(objaddr), sel | (offset >> 2)); - (void)bcma_read32(core, D11REGOFFS(objaddr)); - if (offset & 2) - objoff += 2; - - return bcma_read16(core, objoff); -} - -static void -brcms_b_write_objmem(struct brcms_hardware *wlc_hw, uint offset, u16 v, - u32 sel) -{ - struct bcma_device *core = wlc_hw->d11core; - u16 objoff = D11REGOFFS(objdata); - - bcma_write32(core, D11REGOFFS(objaddr), sel | (offset >> 2)); - (void)bcma_read32(core, D11REGOFFS(objaddr)); - if (offset & 2) - objoff += 2; - - bcma_wflush16(core, objoff, v); -} - -/* - * Read a single u16 from shared memory. - * SHM 'offset' needs to be an even address - */ -u16 brcms_b_read_shm(struct brcms_hardware *wlc_hw, uint offset) -{ - return brcms_b_read_objmem(wlc_hw, offset, OBJADDR_SHM_SEL); -} - -/* - * Write a single u16 to shared memory. - * SHM 'offset' needs to be an even address - */ -void brcms_b_write_shm(struct brcms_hardware *wlc_hw, uint offset, u16 v) -{ - brcms_b_write_objmem(wlc_hw, offset, v, OBJADDR_SHM_SEL); -} - -/* - * Copy a buffer to shared memory of specified type . - * SHM 'offset' needs to be an even address and - * Buffer length 'len' must be an even number of bytes - * 'sel' selects the type of memory - */ -void -brcms_b_copyto_objmem(struct brcms_hardware *wlc_hw, uint offset, - const void *buf, int len, u32 sel) -{ - u16 v; - const u8 *p = (const u8 *)buf; - int i; - - if (len <= 0 || (offset & 1) || (len & 1)) - return; - - for (i = 0; i < len; i += 2) { - v = p[i] | (p[i + 1] << 8); - brcms_b_write_objmem(wlc_hw, offset + i, v, sel); - } -} - -/* - * Copy a piece of shared memory of specified type to a buffer . - * SHM 'offset' needs to be an even address and - * Buffer length 'len' must be an even number of bytes - * 'sel' selects the type of memory - */ -void -brcms_b_copyfrom_objmem(struct brcms_hardware *wlc_hw, uint offset, void *buf, - int len, u32 sel) -{ - u16 v; - u8 *p = (u8 *) buf; - int i; - - if (len <= 0 || (offset & 1) || (len & 1)) - return; - - for (i = 0; i < len; i += 2) { - v = brcms_b_read_objmem(wlc_hw, offset + i, sel); - p[i] = v & 0xFF; - p[i + 1] = (v >> 8) & 0xFF; - } -} - -/* Copy a buffer to shared memory. - * SHM 'offset' needs to be an even address and - * Buffer length 'len' must be an even number of bytes - */ -static void brcms_c_copyto_shm(struct brcms_c_info *wlc, uint offset, - const void *buf, int len) -{ - brcms_b_copyto_objmem(wlc->hw, offset, buf, len, OBJADDR_SHM_SEL); -} - -static void brcms_b_retrylimit_upd(struct brcms_hardware *wlc_hw, - u16 SRL, u16 LRL) -{ - wlc_hw->SRL = SRL; - wlc_hw->LRL = LRL; - - /* write retry limit to SCR, shouldn't need to suspend */ - if (wlc_hw->up) { - bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), - OBJADDR_SCR_SEL | S_DOT11_SRC_LMT); - (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); - bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), wlc_hw->SRL); - bcma_write32(wlc_hw->d11core, D11REGOFFS(objaddr), - OBJADDR_SCR_SEL | S_DOT11_LRC_LMT); - (void)bcma_read32(wlc_hw->d11core, D11REGOFFS(objaddr)); - bcma_write32(wlc_hw->d11core, D11REGOFFS(objdata), wlc_hw->LRL); - } -} - -static void brcms_b_pllreq(struct brcms_hardware *wlc_hw, bool set, u32 req_bit) -{ - if (set) { - if (mboolisset(wlc_hw->pllreq, req_bit)) - return; - - mboolset(wlc_hw->pllreq, req_bit); - - if (mboolisset(wlc_hw->pllreq, BRCMS_PLLREQ_FLIP)) { - if (!wlc_hw->sbclk) - brcms_b_xtal(wlc_hw, ON); - } - } else { - if (!mboolisset(wlc_hw->pllreq, req_bit)) - return; - - mboolclr(wlc_hw->pllreq, req_bit); - - if (mboolisset(wlc_hw->pllreq, BRCMS_PLLREQ_FLIP)) { - if (wlc_hw->sbclk) - brcms_b_xtal(wlc_hw, OFF); - } - } -} - -static void brcms_b_antsel_set(struct brcms_hardware *wlc_hw, u32 antsel_avail) -{ - wlc_hw->antsel_avail = antsel_avail; -} - -/* - * conditions under which the PM bit should be set in outgoing frames - * and STAY_AWAKE is meaningful - */ -static bool brcms_c_ps_allowed(struct brcms_c_info *wlc) -{ - /* not supporting PS so always return false for now */ - return false; -} - -static void brcms_c_statsupd(struct brcms_c_info *wlc) -{ - int i; - struct macstat macstats; -#ifdef DEBUG - u16 delta; - u16 rxf0ovfl; - u16 txfunfl[NFIFO]; -#endif /* DEBUG */ - - /* if driver down, make no sense to update stats */ - if (!wlc->pub->up) - return; - -#ifdef DEBUG - /* save last rx fifo 0 overflow count */ - rxf0ovfl = wlc->core->macstat_snapshot->rxf0ovfl; - - /* save last tx fifo underflow count */ - for (i = 0; i < NFIFO; i++) - txfunfl[i] = wlc->core->macstat_snapshot->txfunfl[i]; -#endif /* DEBUG */ - - /* Read mac stats from contiguous shared memory */ - brcms_b_copyfrom_objmem(wlc->hw, M_UCODE_MACSTAT, &macstats, - sizeof(struct macstat), OBJADDR_SHM_SEL); - -#ifdef DEBUG - /* check for rx fifo 0 overflow */ - delta = (u16) (wlc->core->macstat_snapshot->rxf0ovfl - rxf0ovfl); - if (delta) - brcms_err(wlc->hw->d11core, "wl%d: %u rx fifo 0 overflows!\n", - wlc->pub->unit, delta); - - /* check for tx fifo underflows */ - for (i = 0; i < NFIFO; i++) { - delta = - (u16) (wlc->core->macstat_snapshot->txfunfl[i] - - txfunfl[i]); - if (delta) - brcms_err(wlc->hw->d11core, - "wl%d: %u tx fifo %d underflows!\n", - wlc->pub->unit, delta, i); - } -#endif /* DEBUG */ - - /* merge counters from dma module */ - for (i = 0; i < NFIFO; i++) { - if (wlc->hw->di[i]) - dma_counterreset(wlc->hw->di[i]); - } -} - -static void brcms_b_reset(struct brcms_hardware *wlc_hw) -{ - /* reset the core */ - if (!brcms_deviceremoved(wlc_hw->wlc)) - brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); - - /* purge the dma rings */ - brcms_c_flushqueues(wlc_hw->wlc); -} - -void brcms_c_reset(struct brcms_c_info *wlc) -{ - brcms_dbg_info(wlc->hw->d11core, "wl%d\n", wlc->pub->unit); - - /* slurp up hw mac counters before core reset */ - brcms_c_statsupd(wlc); - - /* reset our snapshot of macstat counters */ - memset(wlc->core->macstat_snapshot, 0, sizeof(struct macstat)); - - brcms_b_reset(wlc->hw); -} - -void brcms_c_init_scb(struct scb *scb) -{ - int i; - - memset(scb, 0, sizeof(struct scb)); - scb->flags = SCB_WMECAP | SCB_HTCAP; - for (i = 0; i < NUMPRIO; i++) { - scb->seqnum[i] = 0; - scb->seqctl[i] = 0xFFFF; - } - - scb->seqctl_nonqos = 0xFFFF; - scb->magic = SCB_MAGIC; -} - -/* d11 core init - * reset PSM - * download ucode/PCM - * let ucode run to suspended - * download ucode inits - * config other core registers - * init dma - */ -static void brcms_b_coreinit(struct brcms_c_info *wlc) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - struct bcma_device *core = wlc_hw->d11core; - u32 sflags; - u32 bcnint_us; - uint i = 0; - bool fifosz_fixup = false; - int err = 0; - u16 buf[NFIFO]; - struct brcms_ucode *ucode = &wlc_hw->wlc->wl->ucode; - - brcms_dbg_info(core, "wl%d: core init\n", wlc_hw->unit); - - /* reset PSM */ - brcms_b_mctrl(wlc_hw, ~0, (MCTL_IHR_EN | MCTL_PSM_JMP_0 | MCTL_WAKE)); - - brcms_ucode_download(wlc_hw); - /* - * FIFOSZ fixup. driver wants to controls the fifo allocation. - */ - fifosz_fixup = true; - - /* let the PSM run to the suspended state, set mode to BSS STA */ - bcma_write32(core, D11REGOFFS(macintstatus), -1); - brcms_b_mctrl(wlc_hw, ~0, - (MCTL_IHR_EN | MCTL_INFRA | MCTL_PSM_RUN | MCTL_WAKE)); - - /* wait for ucode to self-suspend after auto-init */ - SPINWAIT(((bcma_read32(core, D11REGOFFS(macintstatus)) & - MI_MACSSPNDD) == 0), 1000 * 1000); - if ((bcma_read32(core, D11REGOFFS(macintstatus)) & MI_MACSSPNDD) == 0) - brcms_err(core, "wl%d: wlc_coreinit: ucode did not self-" - "suspend!\n", wlc_hw->unit); - - brcms_c_gpio_init(wlc); - - sflags = bcma_aread32(core, BCMA_IOST); - - if (D11REV_IS(wlc_hw->corerev, 17) || D11REV_IS(wlc_hw->corerev, 23)) { - if (BRCMS_ISNPHY(wlc_hw->band)) - brcms_c_write_inits(wlc_hw, ucode->d11n0initvals16); - else - brcms_err(core, "%s: wl%d: unsupported phy in corerev" - " %d\n", __func__, wlc_hw->unit, - wlc_hw->corerev); - } else if (D11REV_IS(wlc_hw->corerev, 24)) { - if (BRCMS_ISLCNPHY(wlc_hw->band)) - brcms_c_write_inits(wlc_hw, ucode->d11lcn0initvals24); - else - brcms_err(core, "%s: wl%d: unsupported phy in corerev" - " %d\n", __func__, wlc_hw->unit, - wlc_hw->corerev); - } else { - brcms_err(core, "%s: wl%d: unsupported corerev %d\n", - __func__, wlc_hw->unit, wlc_hw->corerev); - } - - /* For old ucode, txfifo sizes needs to be modified(increased) */ - if (fifosz_fixup) - brcms_b_corerev_fifofixup(wlc_hw); - - /* check txfifo allocations match between ucode and driver */ - buf[TX_AC_BE_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE0); - if (buf[TX_AC_BE_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_BE_FIFO]) { - i = TX_AC_BE_FIFO; - err = -1; - } - buf[TX_AC_VI_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE1); - if (buf[TX_AC_VI_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_VI_FIFO]) { - i = TX_AC_VI_FIFO; - err = -1; - } - buf[TX_AC_BK_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE2); - buf[TX_AC_VO_FIFO] = (buf[TX_AC_BK_FIFO] >> 8) & 0xff; - buf[TX_AC_BK_FIFO] &= 0xff; - if (buf[TX_AC_BK_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_BK_FIFO]) { - i = TX_AC_BK_FIFO; - err = -1; - } - if (buf[TX_AC_VO_FIFO] != wlc_hw->xmtfifo_sz[TX_AC_VO_FIFO]) { - i = TX_AC_VO_FIFO; - err = -1; - } - buf[TX_BCMC_FIFO] = brcms_b_read_shm(wlc_hw, M_FIFOSIZE3); - buf[TX_ATIM_FIFO] = (buf[TX_BCMC_FIFO] >> 8) & 0xff; - buf[TX_BCMC_FIFO] &= 0xff; - if (buf[TX_BCMC_FIFO] != wlc_hw->xmtfifo_sz[TX_BCMC_FIFO]) { - i = TX_BCMC_FIFO; - err = -1; - } - if (buf[TX_ATIM_FIFO] != wlc_hw->xmtfifo_sz[TX_ATIM_FIFO]) { - i = TX_ATIM_FIFO; - err = -1; - } - if (err != 0) - brcms_err(core, "wlc_coreinit: txfifo mismatch: ucode size %d" - " driver size %d index %d\n", buf[i], - wlc_hw->xmtfifo_sz[i], i); - - /* make sure we can still talk to the mac */ - WARN_ON(bcma_read32(core, D11REGOFFS(maccontrol)) == 0xffffffff); - - /* band-specific inits done by wlc_bsinit() */ - - /* Set up frame burst size and antenna swap threshold init values */ - brcms_b_write_shm(wlc_hw, M_MBURST_SIZE, MAXTXFRAMEBURST); - brcms_b_write_shm(wlc_hw, M_MAX_ANTCNT, ANTCNT); - - /* enable one rx interrupt per received frame */ - bcma_write32(core, D11REGOFFS(intrcvlazy[0]), (1 << IRL_FC_SHIFT)); - - /* set the station mode (BSS STA) */ - brcms_b_mctrl(wlc_hw, - (MCTL_INFRA | MCTL_DISCARD_PMQ | MCTL_AP), - (MCTL_INFRA | MCTL_DISCARD_PMQ)); - - /* set up Beacon interval */ - bcnint_us = 0x8000 << 10; - bcma_write32(core, D11REGOFFS(tsf_cfprep), - (bcnint_us << CFPREP_CBI_SHIFT)); - bcma_write32(core, D11REGOFFS(tsf_cfpstart), bcnint_us); - bcma_write32(core, D11REGOFFS(macintstatus), MI_GP1); - - /* write interrupt mask */ - bcma_write32(core, D11REGOFFS(intctrlregs[RX_FIFO].intmask), - DEF_RXINTMASK); - - /* allow the MAC to control the PHY clock (dynamic on/off) */ - brcms_b_macphyclk_set(wlc_hw, ON); - - /* program dynamic clock control fast powerup delay register */ - wlc->fastpwrup_dly = ai_clkctl_fast_pwrup_delay(wlc_hw->sih); - bcma_write16(core, D11REGOFFS(scc_fastpwrup_dly), wlc->fastpwrup_dly); - - /* tell the ucode the corerev */ - brcms_b_write_shm(wlc_hw, M_MACHW_VER, (u16) wlc_hw->corerev); - - /* tell the ucode MAC capabilities */ - brcms_b_write_shm(wlc_hw, M_MACHW_CAP_L, - (u16) (wlc_hw->machwcap & 0xffff)); - brcms_b_write_shm(wlc_hw, M_MACHW_CAP_H, - (u16) ((wlc_hw-> - machwcap >> 16) & 0xffff)); - - /* write retry limits to SCR, this done after PSM init */ - bcma_write32(core, D11REGOFFS(objaddr), - OBJADDR_SCR_SEL | S_DOT11_SRC_LMT); - (void)bcma_read32(core, D11REGOFFS(objaddr)); - bcma_write32(core, D11REGOFFS(objdata), wlc_hw->SRL); - bcma_write32(core, D11REGOFFS(objaddr), - OBJADDR_SCR_SEL | S_DOT11_LRC_LMT); - (void)bcma_read32(core, D11REGOFFS(objaddr)); - bcma_write32(core, D11REGOFFS(objdata), wlc_hw->LRL); - - /* write rate fallback retry limits */ - brcms_b_write_shm(wlc_hw, M_SFRMTXCNTFBRTHSD, wlc_hw->SFBL); - brcms_b_write_shm(wlc_hw, M_LFRMTXCNTFBRTHSD, wlc_hw->LFBL); - - bcma_mask16(core, D11REGOFFS(ifs_ctl), 0x0FFF); - bcma_write16(core, D11REGOFFS(ifs_aifsn), EDCF_AIFSN_MIN); - - /* init the tx dma engines */ - for (i = 0; i < NFIFO; i++) { - if (wlc_hw->di[i]) - dma_txinit(wlc_hw->di[i]); - } - - /* init the rx dma engine(s) and post receive buffers */ - dma_rxinit(wlc_hw->di[RX_FIFO]); - dma_rxfill(wlc_hw->di[RX_FIFO]); -} - -void -static brcms_b_init(struct brcms_hardware *wlc_hw, u16 chanspec) { - u32 macintmask; - bool fastclk; - struct brcms_c_info *wlc = wlc_hw->wlc; - - /* request FAST clock if not on */ - fastclk = wlc_hw->forcefastclk; - if (!fastclk) - brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); - - /* disable interrupts */ - macintmask = brcms_intrsoff(wlc->wl); - - /* set up the specified band and chanspec */ - brcms_c_setxband(wlc_hw, chspec_bandunit(chanspec)); - wlc_phy_chanspec_radio_set(wlc_hw->band->pi, chanspec); - - /* do one-time phy inits and calibration */ - wlc_phy_cal_init(wlc_hw->band->pi); - - /* core-specific initialization */ - brcms_b_coreinit(wlc); - - /* band-specific inits */ - brcms_b_bsinit(wlc, chanspec); - - /* restore macintmask */ - brcms_intrsrestore(wlc->wl, macintmask); - - /* seed wake_override with BRCMS_WAKE_OVERRIDE_MACSUSPEND since the mac - * is suspended and brcms_c_enable_mac() will clear this override bit. - */ - mboolset(wlc_hw->wake_override, BRCMS_WAKE_OVERRIDE_MACSUSPEND); - - /* - * initialize mac_suspend_depth to 1 to match ucode - * initial suspended state - */ - wlc_hw->mac_suspend_depth = 1; - - /* restore the clk */ - if (!fastclk) - brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); -} - -static void brcms_c_set_phy_chanspec(struct brcms_c_info *wlc, - u16 chanspec) -{ - /* Save our copy of the chanspec */ - wlc->chanspec = chanspec; - - /* Set the chanspec and power limits for this locale */ - brcms_c_channel_set_chanspec(wlc->cmi, chanspec, BRCMS_TXPWR_MAX); - - if (wlc->stf->ss_algosel_auto) - brcms_c_stf_ss_algo_channel_get(wlc, &wlc->stf->ss_algo_channel, - chanspec); - - brcms_c_stf_ss_update(wlc, wlc->band); -} - -static void -brcms_default_rateset(struct brcms_c_info *wlc, struct brcms_c_rateset *rs) -{ - brcms_c_rateset_default(rs, NULL, wlc->band->phytype, - wlc->band->bandtype, false, BRCMS_RATE_MASK_FULL, - (bool) (wlc->pub->_n_enab & SUPPORT_11N), - brcms_chspec_bw(wlc->default_bss->chanspec), - wlc->stf->txstreams); -} - -/* derive wlc->band->basic_rate[] table from 'rateset' */ -static void brcms_c_rate_lookup_init(struct brcms_c_info *wlc, - struct brcms_c_rateset *rateset) -{ - u8 rate; - u8 mandatory; - u8 cck_basic = 0; - u8 ofdm_basic = 0; - u8 *br = wlc->band->basic_rate; - uint i; - - /* incoming rates are in 500kbps units as in 802.11 Supported Rates */ - memset(br, 0, BRCM_MAXRATE + 1); - - /* For each basic rate in the rates list, make an entry in the - * best basic lookup. - */ - for (i = 0; i < rateset->count; i++) { - /* only make an entry for a basic rate */ - if (!(rateset->rates[i] & BRCMS_RATE_FLAG)) - continue; - - /* mask off basic bit */ - rate = (rateset->rates[i] & BRCMS_RATE_MASK); - - if (rate > BRCM_MAXRATE) { - brcms_err(wlc->hw->d11core, "brcms_c_rate_lookup_init: " - "invalid rate 0x%X in rate set\n", - rateset->rates[i]); - continue; - } - - br[rate] = rate; - } - - /* The rate lookup table now has non-zero entries for each - * basic rate, equal to the basic rate: br[basicN] = basicN - * - * To look up the best basic rate corresponding to any - * particular rate, code can use the basic_rate table - * like this - * - * basic_rate = wlc->band->basic_rate[tx_rate] - * - * Make sure there is a best basic rate entry for - * every rate by walking up the table from low rates - * to high, filling in holes in the lookup table - */ - - for (i = 0; i < wlc->band->hw_rateset.count; i++) { - rate = wlc->band->hw_rateset.rates[i]; - - if (br[rate] != 0) { - /* This rate is a basic rate. - * Keep track of the best basic rate so far by - * modulation type. - */ - if (is_ofdm_rate(rate)) - ofdm_basic = rate; - else - cck_basic = rate; - - continue; - } - - /* This rate is not a basic rate so figure out the - * best basic rate less than this rate and fill in - * the hole in the table - */ - - br[rate] = is_ofdm_rate(rate) ? ofdm_basic : cck_basic; - - if (br[rate] != 0) - continue; - - if (is_ofdm_rate(rate)) { - /* - * In 11g and 11a, the OFDM mandatory rates - * are 6, 12, and 24 Mbps - */ - if (rate >= BRCM_RATE_24M) - mandatory = BRCM_RATE_24M; - else if (rate >= BRCM_RATE_12M) - mandatory = BRCM_RATE_12M; - else - mandatory = BRCM_RATE_6M; - } else { - /* In 11b, all CCK rates are mandatory 1 - 11 Mbps */ - mandatory = rate; - } - - br[rate] = mandatory; - } -} - -static void brcms_c_bandinit_ordered(struct brcms_c_info *wlc, - u16 chanspec) -{ - struct brcms_c_rateset default_rateset; - uint parkband; - uint i, band_order[2]; - - /* - * We might have been bandlocked during down and the chip - * power-cycled (hibernate). Figure out the right band to park on - */ - if (wlc->bandlocked || wlc->pub->_nbands == 1) { - /* updated in brcms_c_bandlock() */ - parkband = wlc->band->bandunit; - band_order[0] = band_order[1] = parkband; - } else { - /* park on the band of the specified chanspec */ - parkband = chspec_bandunit(chanspec); - - /* order so that parkband initialize last */ - band_order[0] = parkband ^ 1; - band_order[1] = parkband; - } - - /* make each band operational, software state init */ - for (i = 0; i < wlc->pub->_nbands; i++) { - uint j = band_order[i]; - - wlc->band = wlc->bandstate[j]; - - brcms_default_rateset(wlc, &default_rateset); - - /* fill in hw_rate */ - brcms_c_rateset_filter(&default_rateset, &wlc->band->hw_rateset, - false, BRCMS_RATES_CCK_OFDM, BRCMS_RATE_MASK, - (bool) (wlc->pub->_n_enab & SUPPORT_11N)); - - /* init basic rate lookup */ - brcms_c_rate_lookup_init(wlc, &default_rateset); - } - - /* sync up phy/radio chanspec */ - brcms_c_set_phy_chanspec(wlc, chanspec); -} - -/* - * Set or clear filtering related maccontrol bits based on - * specified filter flags - */ -void brcms_c_mac_promisc(struct brcms_c_info *wlc, uint filter_flags) -{ - u32 promisc_bits = 0; - - wlc->filter_flags = filter_flags; - - if (filter_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) - promisc_bits |= MCTL_PROMISC; - - if (filter_flags & FIF_BCN_PRBRESP_PROMISC) - promisc_bits |= MCTL_BCNS_PROMISC; - - if (filter_flags & FIF_FCSFAIL) - promisc_bits |= MCTL_KEEPBADFCS; - - if (filter_flags & (FIF_CONTROL | FIF_PSPOLL)) - promisc_bits |= MCTL_KEEPCONTROL; - - brcms_b_mctrl(wlc->hw, - MCTL_PROMISC | MCTL_BCNS_PROMISC | - MCTL_KEEPCONTROL | MCTL_KEEPBADFCS, - promisc_bits); -} - -/* - * ucode, hwmac update - * Channel dependent updates for ucode and hw - */ -static void brcms_c_ucode_mac_upd(struct brcms_c_info *wlc) -{ - /* enable or disable any active IBSSs depending on whether or not - * we are on the home channel - */ - if (wlc->home_chanspec == wlc_phy_chanspec_get(wlc->band->pi)) { - if (wlc->pub->associated) { - /* - * BMAC_NOTE: This is something that should be fixed - * in ucode inits. I think that the ucode inits set - * up the bcn templates and shm values with a bogus - * beacon. This should not be done in the inits. If - * ucode needs to set up a beacon for testing, the - * test routines should write it down, not expect the - * inits to populate a bogus beacon. - */ - if (BRCMS_PHY_11N_CAP(wlc->band)) - brcms_b_write_shm(wlc->hw, - M_BCN_TXTSF_OFFSET, 0); - } - } else { - /* disable an active IBSS if we are not on the home channel */ - } -} - -static void brcms_c_write_rate_shm(struct brcms_c_info *wlc, u8 rate, - u8 basic_rate) -{ - u8 phy_rate, index; - u8 basic_phy_rate, basic_index; - u16 dir_table, basic_table; - u16 basic_ptr; - - /* Shared memory address for the table we are reading */ - dir_table = is_ofdm_rate(basic_rate) ? M_RT_DIRMAP_A : M_RT_DIRMAP_B; - - /* Shared memory address for the table we are writing */ - basic_table = is_ofdm_rate(rate) ? M_RT_BBRSMAP_A : M_RT_BBRSMAP_B; - - /* - * for a given rate, the LS-nibble of the PLCP SIGNAL field is - * the index into the rate table. - */ - phy_rate = rate_info[rate] & BRCMS_RATE_MASK; - basic_phy_rate = rate_info[basic_rate] & BRCMS_RATE_MASK; - index = phy_rate & 0xf; - basic_index = basic_phy_rate & 0xf; - - /* Find the SHM pointer to the ACK rate entry by looking in the - * Direct-map Table - */ - basic_ptr = brcms_b_read_shm(wlc->hw, (dir_table + basic_index * 2)); - - /* Update the SHM BSS-basic-rate-set mapping table with the pointer - * to the correct basic rate for the given incoming rate - */ - brcms_b_write_shm(wlc->hw, (basic_table + index * 2), basic_ptr); -} - -static const struct brcms_c_rateset * -brcms_c_rateset_get_hwrs(struct brcms_c_info *wlc) -{ - const struct brcms_c_rateset *rs_dflt; - - if (BRCMS_PHY_11N_CAP(wlc->band)) { - if (wlc->band->bandtype == BRCM_BAND_5G) - rs_dflt = &ofdm_mimo_rates; - else - rs_dflt = &cck_ofdm_mimo_rates; - } else if (wlc->band->gmode) - rs_dflt = &cck_ofdm_rates; - else - rs_dflt = &cck_rates; - - return rs_dflt; -} - -static void brcms_c_set_ratetable(struct brcms_c_info *wlc) -{ - const struct brcms_c_rateset *rs_dflt; - struct brcms_c_rateset rs; - u8 rate, basic_rate; - uint i; - - rs_dflt = brcms_c_rateset_get_hwrs(wlc); - - brcms_c_rateset_copy(rs_dflt, &rs); - brcms_c_rateset_mcs_upd(&rs, wlc->stf->txstreams); - - /* walk the phy rate table and update SHM basic rate lookup table */ - for (i = 0; i < rs.count; i++) { - rate = rs.rates[i] & BRCMS_RATE_MASK; - - /* for a given rate brcms_basic_rate returns the rate at - * which a response ACK/CTS should be sent. - */ - basic_rate = brcms_basic_rate(wlc, rate); - if (basic_rate == 0) - /* This should only happen if we are using a - * restricted rateset. - */ - basic_rate = rs.rates[0] & BRCMS_RATE_MASK; - - brcms_c_write_rate_shm(wlc, rate, basic_rate); - } -} - -/* band-specific init */ -static void brcms_c_bsinit(struct brcms_c_info *wlc) -{ - brcms_dbg_info(wlc->hw->d11core, "wl%d: bandunit %d\n", - wlc->pub->unit, wlc->band->bandunit); - - /* write ucode ACK/CTS rate table */ - brcms_c_set_ratetable(wlc); - - /* update some band specific mac configuration */ - brcms_c_ucode_mac_upd(wlc); - - /* init antenna selection */ - brcms_c_antsel_init(wlc->asi); - -} - -/* formula: IDLE_BUSY_RATIO_X_16 = (100-duty_cycle)/duty_cycle*16 */ -static int -brcms_c_duty_cycle_set(struct brcms_c_info *wlc, int duty_cycle, bool isOFDM, - bool writeToShm) -{ - int idle_busy_ratio_x_16 = 0; - uint offset = - isOFDM ? M_TX_IDLE_BUSY_RATIO_X_16_OFDM : - M_TX_IDLE_BUSY_RATIO_X_16_CCK; - if (duty_cycle > 100 || duty_cycle < 0) { - brcms_err(wlc->hw->d11core, - "wl%d: duty cycle value off limit\n", - wlc->pub->unit); - return -EINVAL; - } - if (duty_cycle) - idle_busy_ratio_x_16 = (100 - duty_cycle) * 16 / duty_cycle; - /* Only write to shared memory when wl is up */ - if (writeToShm) - brcms_b_write_shm(wlc->hw, offset, (u16) idle_busy_ratio_x_16); - - if (isOFDM) - wlc->tx_duty_cycle_ofdm = (u16) duty_cycle; - else - wlc->tx_duty_cycle_cck = (u16) duty_cycle; - - return 0; -} - -/* push sw hps and wake state through hardware */ -static void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc) -{ - u32 v1, v2; - bool hps; - bool awake_before; - - hps = brcms_c_ps_allowed(wlc); - - brcms_dbg_mac80211(wlc->hw->d11core, "wl%d: hps %d\n", wlc->pub->unit, - hps); - - v1 = bcma_read32(wlc->hw->d11core, D11REGOFFS(maccontrol)); - v2 = MCTL_WAKE; - if (hps) - v2 |= MCTL_HPS; - - brcms_b_mctrl(wlc->hw, MCTL_WAKE | MCTL_HPS, v2); - - awake_before = ((v1 & MCTL_WAKE) || ((v1 & MCTL_HPS) == 0)); - - if (!awake_before) - brcms_b_wait_for_wake(wlc->hw); -} - -/* - * Write this BSS config's MAC address to core. - * Updates RXE match engine. - */ -static int brcms_c_set_mac(struct brcms_bss_cfg *bsscfg) -{ - int err = 0; - struct brcms_c_info *wlc = bsscfg->wlc; - - /* enter the MAC addr into the RXE match registers */ - brcms_c_set_addrmatch(wlc, RCM_MAC_OFFSET, wlc->pub->cur_etheraddr); - - brcms_c_ampdu_macaddr_upd(wlc); - - return err; -} - -/* Write the BSS config's BSSID address to core (set_bssid in d11procs.tcl). - * Updates RXE match engine. - */ -static void brcms_c_set_bssid(struct brcms_bss_cfg *bsscfg) -{ - /* we need to update BSSID in RXE match registers */ - brcms_c_set_addrmatch(bsscfg->wlc, RCM_BSSID_OFFSET, bsscfg->BSSID); -} - -void brcms_c_set_ssid(struct brcms_c_info *wlc, u8 *ssid, size_t ssid_len) -{ - u8 len = min_t(u8, sizeof(wlc->bsscfg->SSID), ssid_len); - memset(wlc->bsscfg->SSID, 0, sizeof(wlc->bsscfg->SSID)); - - memcpy(wlc->bsscfg->SSID, ssid, len); - wlc->bsscfg->SSID_len = len; -} - -static void brcms_b_set_shortslot(struct brcms_hardware *wlc_hw, bool shortslot) -{ - wlc_hw->shortslot = shortslot; - - if (wlc_hw->band->bandtype == BRCM_BAND_2G && wlc_hw->up) { - brcms_c_suspend_mac_and_wait(wlc_hw->wlc); - brcms_b_update_slot_timing(wlc_hw, shortslot); - brcms_c_enable_mac(wlc_hw->wlc); - } -} - -/* - * Suspend the the MAC and update the slot timing - * for standard 11b/g (20us slots) or shortslot 11g (9us slots). - */ -static void brcms_c_switch_shortslot(struct brcms_c_info *wlc, bool shortslot) -{ - /* use the override if it is set */ - if (wlc->shortslot_override != BRCMS_SHORTSLOT_AUTO) - shortslot = (wlc->shortslot_override == BRCMS_SHORTSLOT_ON); - - if (wlc->shortslot == shortslot) - return; - - wlc->shortslot = shortslot; - - brcms_b_set_shortslot(wlc->hw, shortslot); -} - -static void brcms_c_set_home_chanspec(struct brcms_c_info *wlc, u16 chanspec) -{ - if (wlc->home_chanspec != chanspec) { - wlc->home_chanspec = chanspec; - - if (wlc->pub->associated) - wlc->bsscfg->current_bss->chanspec = chanspec; - } -} - -void -brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, u16 chanspec, - bool mute_tx, struct txpwr_limits *txpwr) -{ - uint bandunit; - - brcms_dbg_mac80211(wlc_hw->d11core, "wl%d: 0x%x\n", wlc_hw->unit, - chanspec); - - wlc_hw->chanspec = chanspec; - - /* Switch bands if necessary */ - if (wlc_hw->_nbands > 1) { - bandunit = chspec_bandunit(chanspec); - if (wlc_hw->band->bandunit != bandunit) { - /* brcms_b_setband disables other bandunit, - * use light band switch if not up yet - */ - if (wlc_hw->up) { - wlc_phy_chanspec_radio_set(wlc_hw-> - bandstate[bandunit]-> - pi, chanspec); - brcms_b_setband(wlc_hw, bandunit, chanspec); - } else { - brcms_c_setxband(wlc_hw, bandunit); - } - } - } - - wlc_phy_initcal_enable(wlc_hw->band->pi, !mute_tx); - - if (!wlc_hw->up) { - if (wlc_hw->clk) - wlc_phy_txpower_limit_set(wlc_hw->band->pi, txpwr, - chanspec); - wlc_phy_chanspec_radio_set(wlc_hw->band->pi, chanspec); - } else { - wlc_phy_chanspec_set(wlc_hw->band->pi, chanspec); - wlc_phy_txpower_limit_set(wlc_hw->band->pi, txpwr, chanspec); - - /* Update muting of the channel */ - brcms_b_mute(wlc_hw, mute_tx); - } -} - -/* switch to and initialize new band */ -static void brcms_c_setband(struct brcms_c_info *wlc, - uint bandunit) -{ - wlc->band = wlc->bandstate[bandunit]; - - if (!wlc->pub->up) - return; - - /* wait for at least one beacon before entering sleeping state */ - brcms_c_set_ps_ctrl(wlc); - - /* band-specific initializations */ - brcms_c_bsinit(wlc); -} - -static void brcms_c_set_chanspec(struct brcms_c_info *wlc, u16 chanspec) -{ - uint bandunit; - bool switchband = false; - u16 old_chanspec = wlc->chanspec; - - if (!brcms_c_valid_chanspec_db(wlc->cmi, chanspec)) { - brcms_err(wlc->hw->d11core, "wl%d: %s: Bad channel %d\n", - wlc->pub->unit, __func__, CHSPEC_CHANNEL(chanspec)); - return; - } - - /* Switch bands if necessary */ - if (wlc->pub->_nbands > 1) { - bandunit = chspec_bandunit(chanspec); - if (wlc->band->bandunit != bandunit || wlc->bandinit_pending) { - switchband = true; - if (wlc->bandlocked) { - brcms_err(wlc->hw->d11core, - "wl%d: %s: chspec %d band is locked!\n", - wlc->pub->unit, __func__, - CHSPEC_CHANNEL(chanspec)); - return; - } - /* - * should the setband call come after the - * brcms_b_chanspec() ? if the setband updates - * (brcms_c_bsinit) use low level calls to inspect and - * set state, the state inspected may be from the wrong - * band, or the following brcms_b_set_chanspec() may - * undo the work. - */ - brcms_c_setband(wlc, bandunit); - } - } - - /* sync up phy/radio chanspec */ - brcms_c_set_phy_chanspec(wlc, chanspec); - - /* init antenna selection */ - if (brcms_chspec_bw(old_chanspec) != brcms_chspec_bw(chanspec)) { - brcms_c_antsel_init(wlc->asi); - - /* Fix the hardware rateset based on bw. - * Mainly add MCS32 for 40Mhz, remove MCS 32 for 20Mhz - */ - brcms_c_rateset_bw_mcs_filter(&wlc->band->hw_rateset, - wlc->band->mimo_cap_40 ? brcms_chspec_bw(chanspec) : 0); - } - - /* update some mac configuration since chanspec changed */ - brcms_c_ucode_mac_upd(wlc); -} - -/* - * This function changes the phytxctl for beacon based on current - * beacon ratespec AND txant setting as per this table: - * ratespec CCK ant = wlc->stf->txant - * OFDM ant = 3 - */ -void brcms_c_beacon_phytxctl_txant_upd(struct brcms_c_info *wlc, - u32 bcn_rspec) -{ - u16 phyctl; - u16 phytxant = wlc->stf->phytxant; - u16 mask = PHY_TXC_ANT_MASK; - - /* for non-siso rates or default setting, use the available chains */ - if (BRCMS_PHY_11N_CAP(wlc->band)) - phytxant = brcms_c_stf_phytxchain_sel(wlc, bcn_rspec); - - phyctl = brcms_b_read_shm(wlc->hw, M_BCN_PCTLWD); - phyctl = (phyctl & ~mask) | phytxant; - brcms_b_write_shm(wlc->hw, M_BCN_PCTLWD, phyctl); -} - -/* - * centralized protection config change function to simplify debugging, no - * consistency checking this should be called only on changes to avoid overhead - * in periodic function - */ -void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx, int val) -{ - /* - * Cannot use brcms_dbg_* here because this function is called - * before wlc is sufficiently initialized. - */ - BCMMSG(wlc->wiphy, "idx %d, val %d\n", idx, val); - - switch (idx) { - case BRCMS_PROT_G_SPEC: - wlc->protection->_g = (bool) val; - break; - case BRCMS_PROT_G_OVR: - wlc->protection->g_override = (s8) val; - break; - case BRCMS_PROT_G_USER: - wlc->protection->gmode_user = (u8) val; - break; - case BRCMS_PROT_OVERLAP: - wlc->protection->overlap = (s8) val; - break; - case BRCMS_PROT_N_USER: - wlc->protection->nmode_user = (s8) val; - break; - case BRCMS_PROT_N_CFG: - wlc->protection->n_cfg = (s8) val; - break; - case BRCMS_PROT_N_CFG_OVR: - wlc->protection->n_cfg_override = (s8) val; - break; - case BRCMS_PROT_N_NONGF: - wlc->protection->nongf = (bool) val; - break; - case BRCMS_PROT_N_NONGF_OVR: - wlc->protection->nongf_override = (s8) val; - break; - case BRCMS_PROT_N_PAM_OVR: - wlc->protection->n_pam_override = (s8) val; - break; - case BRCMS_PROT_N_OBSS: - wlc->protection->n_obss = (bool) val; - break; - - default: - break; - } - -} - -static void brcms_c_ht_update_sgi_rx(struct brcms_c_info *wlc, int val) -{ - if (wlc->pub->up) { - brcms_c_update_beacon(wlc); - brcms_c_update_probe_resp(wlc, true); - } -} - -static void brcms_c_ht_update_ldpc(struct brcms_c_info *wlc, s8 val) -{ - wlc->stf->ldpc = val; - - if (wlc->pub->up) { - brcms_c_update_beacon(wlc); - brcms_c_update_probe_resp(wlc, true); - wlc_phy_ldpc_override_set(wlc->band->pi, (val ? true : false)); - } -} - -void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci, - const struct ieee80211_tx_queue_params *params, - bool suspend) -{ - int i; - struct shm_acparams acp_shm; - u16 *shm_entry; - - /* Only apply params if the core is out of reset and has clocks */ - if (!wlc->clk) { - brcms_err(wlc->hw->d11core, "wl%d: %s : no-clock\n", - wlc->pub->unit, __func__); - return; - } - - memset(&acp_shm, 0, sizeof(struct shm_acparams)); - /* fill in shm ac params struct */ - acp_shm.txop = params->txop; - /* convert from units of 32us to us for ucode */ - wlc->edcf_txop[aci & 0x3] = acp_shm.txop = - EDCF_TXOP2USEC(acp_shm.txop); - acp_shm.aifs = (params->aifs & EDCF_AIFSN_MASK); - - if (aci == IEEE80211_AC_VI && acp_shm.txop == 0 - && acp_shm.aifs < EDCF_AIFSN_MAX) - acp_shm.aifs++; - - if (acp_shm.aifs < EDCF_AIFSN_MIN - || acp_shm.aifs > EDCF_AIFSN_MAX) { - brcms_err(wlc->hw->d11core, "wl%d: edcf_setparams: bad " - "aifs %d\n", wlc->pub->unit, acp_shm.aifs); - } else { - acp_shm.cwmin = params->cw_min; - acp_shm.cwmax = params->cw_max; - acp_shm.cwcur = acp_shm.cwmin; - acp_shm.bslots = - bcma_read16(wlc->hw->d11core, D11REGOFFS(tsf_random)) & - acp_shm.cwcur; - acp_shm.reggap = acp_shm.bslots + acp_shm.aifs; - /* Indicate the new params to the ucode */ - acp_shm.status = brcms_b_read_shm(wlc->hw, (M_EDCF_QINFO + - wme_ac2fifo[aci] * - M_EDCF_QLEN + - M_EDCF_STATUS_OFF)); - acp_shm.status |= WME_STATUS_NEWAC; - - /* Fill in shm acparam table */ - shm_entry = (u16 *) &acp_shm; - for (i = 0; i < (int)sizeof(struct shm_acparams); i += 2) - brcms_b_write_shm(wlc->hw, - M_EDCF_QINFO + - wme_ac2fifo[aci] * M_EDCF_QLEN + i, - *shm_entry++); - } - - if (suspend) - brcms_c_suspend_mac_and_wait(wlc); - - brcms_c_update_beacon(wlc); - brcms_c_update_probe_resp(wlc, false); - - if (suspend) - brcms_c_enable_mac(wlc); -} - -static void brcms_c_edcf_setparams(struct brcms_c_info *wlc, bool suspend) -{ - u16 aci; - int i_ac; - struct ieee80211_tx_queue_params txq_pars; - static const struct edcf_acparam default_edcf_acparams[] = { - {EDCF_AC_BE_ACI_STA, EDCF_AC_BE_ECW_STA, EDCF_AC_BE_TXOP_STA}, - {EDCF_AC_BK_ACI_STA, EDCF_AC_BK_ECW_STA, EDCF_AC_BK_TXOP_STA}, - {EDCF_AC_VI_ACI_STA, EDCF_AC_VI_ECW_STA, EDCF_AC_VI_TXOP_STA}, - {EDCF_AC_VO_ACI_STA, EDCF_AC_VO_ECW_STA, EDCF_AC_VO_TXOP_STA} - }; /* ucode needs these parameters during its initialization */ - const struct edcf_acparam *edcf_acp = &default_edcf_acparams[0]; - - for (i_ac = 0; i_ac < IEEE80211_NUM_ACS; i_ac++, edcf_acp++) { - /* find out which ac this set of params applies to */ - aci = (edcf_acp->ACI & EDCF_ACI_MASK) >> EDCF_ACI_SHIFT; - - /* fill in shm ac params struct */ - txq_pars.txop = edcf_acp->TXOP; - txq_pars.aifs = edcf_acp->ACI; - - /* CWmin = 2^(ECWmin) - 1 */ - txq_pars.cw_min = EDCF_ECW2CW(edcf_acp->ECW & EDCF_ECWMIN_MASK); - /* CWmax = 2^(ECWmax) - 1 */ - txq_pars.cw_max = EDCF_ECW2CW((edcf_acp->ECW & EDCF_ECWMAX_MASK) - >> EDCF_ECWMAX_SHIFT); - brcms_c_wme_setparams(wlc, aci, &txq_pars, suspend); - } - - if (suspend) { - brcms_c_suspend_mac_and_wait(wlc); - brcms_c_enable_mac(wlc); - } -} - -static void brcms_c_radio_monitor_start(struct brcms_c_info *wlc) -{ - /* Don't start the timer if HWRADIO feature is disabled */ - if (wlc->radio_monitor) - return; - - wlc->radio_monitor = true; - brcms_b_pllreq(wlc->hw, true, BRCMS_PLLREQ_RADIO_MON); - brcms_add_timer(wlc->radio_timer, TIMER_INTERVAL_RADIOCHK, true); -} - -static bool brcms_c_radio_monitor_stop(struct brcms_c_info *wlc) -{ - if (!wlc->radio_monitor) - return true; - - wlc->radio_monitor = false; - brcms_b_pllreq(wlc->hw, false, BRCMS_PLLREQ_RADIO_MON); - return brcms_del_timer(wlc->radio_timer); -} - -/* read hwdisable state and propagate to wlc flag */ -static void brcms_c_radio_hwdisable_upd(struct brcms_c_info *wlc) -{ - if (wlc->pub->hw_off) - return; - - if (brcms_b_radio_read_hwdisabled(wlc->hw)) - mboolset(wlc->pub->radio_disabled, WL_RADIO_HW_DISABLE); - else - mboolclr(wlc->pub->radio_disabled, WL_RADIO_HW_DISABLE); -} - -/* update hwradio status and return it */ -bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc) -{ - brcms_c_radio_hwdisable_upd(wlc); - - return mboolisset(wlc->pub->radio_disabled, WL_RADIO_HW_DISABLE) ? - true : false; -} - -/* periodical query hw radio button while driver is "down" */ -static void brcms_c_radio_timer(void *arg) -{ - struct brcms_c_info *wlc = (struct brcms_c_info *) arg; - - if (brcms_deviceremoved(wlc)) { - brcms_err(wlc->hw->d11core, "wl%d: %s: dead chip\n", - wlc->pub->unit, __func__); - brcms_down(wlc->wl); - return; - } - - brcms_c_radio_hwdisable_upd(wlc); -} - -/* common low-level watchdog code */ -static void brcms_b_watchdog(struct brcms_c_info *wlc) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - - if (!wlc_hw->up) - return; - - /* increment second count */ - wlc_hw->now++; - - /* Check for FIFO error interrupts */ - brcms_b_fifoerrors(wlc_hw); - - /* make sure RX dma has buffers */ - dma_rxfill(wlc->hw->di[RX_FIFO]); - - wlc_phy_watchdog(wlc_hw->band->pi); -} - -/* common watchdog code */ -static void brcms_c_watchdog(struct brcms_c_info *wlc) -{ - brcms_dbg_info(wlc->hw->d11core, "wl%d\n", wlc->pub->unit); - - if (!wlc->pub->up) - return; - - if (brcms_deviceremoved(wlc)) { - brcms_err(wlc->hw->d11core, "wl%d: %s: dead chip\n", - wlc->pub->unit, __func__); - brcms_down(wlc->wl); - return; - } - - /* increment second count */ - wlc->pub->now++; - - brcms_c_radio_hwdisable_upd(wlc); - /* if radio is disable, driver may be down, quit here */ - if (wlc->pub->radio_disabled) - return; - - brcms_b_watchdog(wlc); - - /* - * occasionally sample mac stat counters to - * detect 16-bit counter wrap - */ - if ((wlc->pub->now % SW_TIMER_MAC_STAT_UPD) == 0) - brcms_c_statsupd(wlc); - - if (BRCMS_ISNPHY(wlc->band) && - ((wlc->pub->now - wlc->tempsense_lasttime) >= - BRCMS_TEMPSENSE_PERIOD)) { - wlc->tempsense_lasttime = wlc->pub->now; - brcms_c_tempsense_upd(wlc); - } -} - -static void brcms_c_watchdog_by_timer(void *arg) -{ - struct brcms_c_info *wlc = (struct brcms_c_info *) arg; - - brcms_c_watchdog(wlc); -} - -static bool brcms_c_timers_init(struct brcms_c_info *wlc, int unit) -{ - wlc->wdtimer = brcms_init_timer(wlc->wl, brcms_c_watchdog_by_timer, - wlc, "watchdog"); - if (!wlc->wdtimer) { - wiphy_err(wlc->wiphy, "wl%d: wl_init_timer for wdtimer " - "failed\n", unit); - goto fail; - } - - wlc->radio_timer = brcms_init_timer(wlc->wl, brcms_c_radio_timer, - wlc, "radio"); - if (!wlc->radio_timer) { - wiphy_err(wlc->wiphy, "wl%d: wl_init_timer for radio_timer " - "failed\n", unit); - goto fail; - } - - return true; - - fail: - return false; -} - -/* - * Initialize brcms_c_info default values ... - * may get overrides later in this function - */ -static void brcms_c_info_init(struct brcms_c_info *wlc, int unit) -{ - int i; - - /* Save our copy of the chanspec */ - wlc->chanspec = ch20mhz_chspec(1); - - /* various 802.11g modes */ - wlc->shortslot = false; - wlc->shortslot_override = BRCMS_SHORTSLOT_AUTO; - - brcms_c_protection_upd(wlc, BRCMS_PROT_G_OVR, BRCMS_PROTECTION_AUTO); - brcms_c_protection_upd(wlc, BRCMS_PROT_G_SPEC, false); - - brcms_c_protection_upd(wlc, BRCMS_PROT_N_CFG_OVR, - BRCMS_PROTECTION_AUTO); - brcms_c_protection_upd(wlc, BRCMS_PROT_N_CFG, BRCMS_N_PROTECTION_OFF); - brcms_c_protection_upd(wlc, BRCMS_PROT_N_NONGF_OVR, - BRCMS_PROTECTION_AUTO); - brcms_c_protection_upd(wlc, BRCMS_PROT_N_NONGF, false); - brcms_c_protection_upd(wlc, BRCMS_PROT_N_PAM_OVR, AUTO); - - brcms_c_protection_upd(wlc, BRCMS_PROT_OVERLAP, - BRCMS_PROTECTION_CTL_OVERLAP); - - /* 802.11g draft 4.0 NonERP elt advertisement */ - wlc->include_legacy_erp = true; - - wlc->stf->ant_rx_ovr = ANT_RX_DIV_DEF; - wlc->stf->txant = ANT_TX_DEF; - - wlc->prb_resp_timeout = BRCMS_PRB_RESP_TIMEOUT; - - wlc->usr_fragthresh = DOT11_DEFAULT_FRAG_LEN; - for (i = 0; i < NFIFO; i++) - wlc->fragthresh[i] = DOT11_DEFAULT_FRAG_LEN; - wlc->RTSThresh = DOT11_DEFAULT_RTS_LEN; - - /* default rate fallback retry limits */ - wlc->SFBL = RETRY_SHORT_FB; - wlc->LFBL = RETRY_LONG_FB; - - /* default mac retry limits */ - wlc->SRL = RETRY_SHORT_DEF; - wlc->LRL = RETRY_LONG_DEF; - - /* WME QoS mode is Auto by default */ - wlc->pub->_ampdu = AMPDU_AGG_HOST; -} - -static uint brcms_c_attach_module(struct brcms_c_info *wlc) -{ - uint err = 0; - uint unit; - unit = wlc->pub->unit; - - wlc->asi = brcms_c_antsel_attach(wlc); - if (wlc->asi == NULL) { - wiphy_err(wlc->wiphy, "wl%d: attach: antsel_attach " - "failed\n", unit); - err = 44; - goto fail; - } - - wlc->ampdu = brcms_c_ampdu_attach(wlc); - if (wlc->ampdu == NULL) { - wiphy_err(wlc->wiphy, "wl%d: attach: ampdu_attach " - "failed\n", unit); - err = 50; - goto fail; - } - - if ((brcms_c_stf_attach(wlc) != 0)) { - wiphy_err(wlc->wiphy, "wl%d: attach: stf_attach " - "failed\n", unit); - err = 68; - goto fail; - } - fail: - return err; -} - -struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc) -{ - return wlc->pub; -} - -/* low level attach - * run backplane attach, init nvram - * run phy attach - * initialize software state for each core and band - * put the whole chip in reset(driver down state), no clock - */ -static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core, - uint unit, bool piomode) -{ - struct brcms_hardware *wlc_hw; - uint err = 0; - uint j; - bool wme = false; - struct shared_phy_params sha_params; - struct wiphy *wiphy = wlc->wiphy; - struct pci_dev *pcidev = core->bus->host_pci; - struct ssb_sprom *sprom = &core->bus->sprom; - - if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) - brcms_dbg_info(core, "wl%d: vendor 0x%x device 0x%x\n", unit, - pcidev->vendor, - pcidev->device); - else - brcms_dbg_info(core, "wl%d: vendor 0x%x device 0x%x\n", unit, - core->bus->boardinfo.vendor, - core->bus->boardinfo.type); - - wme = true; - - wlc_hw = wlc->hw; - wlc_hw->wlc = wlc; - wlc_hw->unit = unit; - wlc_hw->band = wlc_hw->bandstate[0]; - wlc_hw->_piomode = piomode; - - /* populate struct brcms_hardware with default values */ - brcms_b_info_init(wlc_hw); - - /* - * Do the hardware portion of the attach. Also initialize software - * state that depends on the particular hardware we are running. - */ - wlc_hw->sih = ai_attach(core->bus); - if (wlc_hw->sih == NULL) { - wiphy_err(wiphy, "wl%d: brcms_b_attach: si_attach failed\n", - unit); - err = 11; - goto fail; - } - - /* verify again the device is supported */ - if (!brcms_c_chipmatch(core)) { - wiphy_err(wiphy, "wl%d: brcms_b_attach: Unsupported device\n", - unit); - err = 12; - goto fail; - } - - if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) { - wlc_hw->vendorid = pcidev->vendor; - wlc_hw->deviceid = pcidev->device; - } else { - wlc_hw->vendorid = core->bus->boardinfo.vendor; - wlc_hw->deviceid = core->bus->boardinfo.type; - } - - wlc_hw->d11core = core; - wlc_hw->corerev = core->id.rev; - - /* validate chip, chiprev and corerev */ - if (!brcms_c_isgoodchip(wlc_hw)) { - err = 13; - goto fail; - } - - /* initialize power control registers */ - ai_clkctl_init(wlc_hw->sih); - - /* request fastclock and force fastclock for the rest of attach - * bring the d11 core out of reset. - * For PMU chips, the first wlc_clkctl_clk is no-op since core-clk - * is still false; But it will be called again inside wlc_corereset, - * after d11 is out of reset. - */ - brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); - brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); - - if (!brcms_b_validate_chip_access(wlc_hw)) { - wiphy_err(wiphy, "wl%d: brcms_b_attach: validate_chip_access " - "failed\n", unit); - err = 14; - goto fail; - } - - /* get the board rev, used just below */ - j = sprom->board_rev; - /* promote srom boardrev of 0xFF to 1 */ - if (j == BOARDREV_PROMOTABLE) - j = BOARDREV_PROMOTED; - wlc_hw->boardrev = (u16) j; - if (!brcms_c_validboardtype(wlc_hw)) { - wiphy_err(wiphy, "wl%d: brcms_b_attach: Unsupported Broadcom " - "board type (0x%x)" " or revision level (0x%x)\n", - unit, ai_get_boardtype(wlc_hw->sih), - wlc_hw->boardrev); - err = 15; - goto fail; - } - wlc_hw->sromrev = sprom->revision; - wlc_hw->boardflags = sprom->boardflags_lo + (sprom->boardflags_hi << 16); - wlc_hw->boardflags2 = sprom->boardflags2_lo + (sprom->boardflags2_hi << 16); - - if (wlc_hw->boardflags & BFL_NOPLLDOWN) - brcms_b_pllreq(wlc_hw, true, BRCMS_PLLREQ_SHARED); - - /* check device id(srom, nvram etc.) to set bands */ - if (wlc_hw->deviceid == BCM43224_D11N_ID || - wlc_hw->deviceid == BCM43224_D11N_ID_VEN1 || - wlc_hw->deviceid == BCM43224_CHIP_ID) - /* Dualband boards */ - wlc_hw->_nbands = 2; - else - wlc_hw->_nbands = 1; - - if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43225)) - wlc_hw->_nbands = 1; - - /* BMAC_NOTE: remove init of pub values when brcms_c_attach() - * unconditionally does the init of these values - */ - wlc->vendorid = wlc_hw->vendorid; - wlc->deviceid = wlc_hw->deviceid; - wlc->pub->sih = wlc_hw->sih; - wlc->pub->corerev = wlc_hw->corerev; - wlc->pub->sromrev = wlc_hw->sromrev; - wlc->pub->boardrev = wlc_hw->boardrev; - wlc->pub->boardflags = wlc_hw->boardflags; - wlc->pub->boardflags2 = wlc_hw->boardflags2; - wlc->pub->_nbands = wlc_hw->_nbands; - - wlc_hw->physhim = wlc_phy_shim_attach(wlc_hw, wlc->wl, wlc); - - if (wlc_hw->physhim == NULL) { - wiphy_err(wiphy, "wl%d: brcms_b_attach: wlc_phy_shim_attach " - "failed\n", unit); - err = 25; - goto fail; - } - - /* pass all the parameters to wlc_phy_shared_attach in one struct */ - sha_params.sih = wlc_hw->sih; - sha_params.physhim = wlc_hw->physhim; - sha_params.unit = unit; - sha_params.corerev = wlc_hw->corerev; - sha_params.vid = wlc_hw->vendorid; - sha_params.did = wlc_hw->deviceid; - sha_params.chip = ai_get_chip_id(wlc_hw->sih); - sha_params.chiprev = ai_get_chiprev(wlc_hw->sih); - sha_params.chippkg = ai_get_chippkg(wlc_hw->sih); - sha_params.sromrev = wlc_hw->sromrev; - sha_params.boardtype = ai_get_boardtype(wlc_hw->sih); - sha_params.boardrev = wlc_hw->boardrev; - sha_params.boardflags = wlc_hw->boardflags; - sha_params.boardflags2 = wlc_hw->boardflags2; - - /* alloc and save pointer to shared phy state area */ - wlc_hw->phy_sh = wlc_phy_shared_attach(&sha_params); - if (!wlc_hw->phy_sh) { - err = 16; - goto fail; - } - - /* initialize software state for each core and band */ - for (j = 0; j < wlc_hw->_nbands; j++) { - /* - * band0 is always 2.4Ghz - * band1, if present, is 5Ghz - */ - - brcms_c_setxband(wlc_hw, j); - - wlc_hw->band->bandunit = j; - wlc_hw->band->bandtype = j ? BRCM_BAND_5G : BRCM_BAND_2G; - wlc->band->bandunit = j; - wlc->band->bandtype = j ? BRCM_BAND_5G : BRCM_BAND_2G; - wlc->core->coreidx = core->core_index; - - wlc_hw->machwcap = bcma_read32(core, D11REGOFFS(machwcap)); - wlc_hw->machwcap_backup = wlc_hw->machwcap; - - /* init tx fifo size */ - WARN_ON((wlc_hw->corerev - XMTFIFOTBL_STARTREV) < 0 || - (wlc_hw->corerev - XMTFIFOTBL_STARTREV) > - ARRAY_SIZE(xmtfifo_sz)); - wlc_hw->xmtfifo_sz = - xmtfifo_sz[(wlc_hw->corerev - XMTFIFOTBL_STARTREV)]; - WARN_ON(!wlc_hw->xmtfifo_sz[0]); - - /* Get a phy for this band */ - wlc_hw->band->pi = - wlc_phy_attach(wlc_hw->phy_sh, core, - wlc_hw->band->bandtype, - wlc->wiphy); - if (wlc_hw->band->pi == NULL) { - wiphy_err(wiphy, "wl%d: brcms_b_attach: wlc_phy_" - "attach failed\n", unit); - err = 17; - goto fail; - } - - wlc_phy_machwcap_set(wlc_hw->band->pi, wlc_hw->machwcap); - - wlc_phy_get_phyversion(wlc_hw->band->pi, &wlc_hw->band->phytype, - &wlc_hw->band->phyrev, - &wlc_hw->band->radioid, - &wlc_hw->band->radiorev); - wlc_hw->band->abgphy_encore = - wlc_phy_get_encore(wlc_hw->band->pi); - wlc->band->abgphy_encore = wlc_phy_get_encore(wlc_hw->band->pi); - wlc_hw->band->core_flags = - wlc_phy_get_coreflags(wlc_hw->band->pi); - - /* verify good phy_type & supported phy revision */ - if (BRCMS_ISNPHY(wlc_hw->band)) { - if (NCONF_HAS(wlc_hw->band->phyrev)) - goto good_phy; - else - goto bad_phy; - } else if (BRCMS_ISLCNPHY(wlc_hw->band)) { - if (LCNCONF_HAS(wlc_hw->band->phyrev)) - goto good_phy; - else - goto bad_phy; - } else { - bad_phy: - wiphy_err(wiphy, "wl%d: brcms_b_attach: unsupported " - "phy type/rev (%d/%d)\n", unit, - wlc_hw->band->phytype, wlc_hw->band->phyrev); - err = 18; - goto fail; - } - - good_phy: - /* - * BMAC_NOTE: wlc->band->pi should not be set below and should - * be done in the high level attach. However we can not make - * that change until all low level access is changed to - * wlc_hw->band->pi. Instead do the wlc->band->pi init below, - * keeping wlc_hw->band->pi as well for incremental update of - * low level fns, and cut over low only init when all fns - * updated. - */ - wlc->band->pi = wlc_hw->band->pi; - wlc->band->phytype = wlc_hw->band->phytype; - wlc->band->phyrev = wlc_hw->band->phyrev; - wlc->band->radioid = wlc_hw->band->radioid; - wlc->band->radiorev = wlc_hw->band->radiorev; - - /* default contention windows size limits */ - wlc_hw->band->CWmin = APHY_CWMIN; - wlc_hw->band->CWmax = PHY_CWMAX; - - if (!brcms_b_attach_dmapio(wlc, j, wme)) { - err = 19; - goto fail; - } - } - - /* disable core to match driver "down" state */ - brcms_c_coredisable(wlc_hw); - - /* Match driver "down" state */ - ai_pci_down(wlc_hw->sih); - - /* turn off pll and xtal to match driver "down" state */ - brcms_b_xtal(wlc_hw, OFF); - - /* ******************************************************************* - * The hardware is in the DOWN state at this point. D11 core - * or cores are in reset with clocks off, and the board PLLs - * are off if possible. - * - * Beyond this point, wlc->sbclk == false and chip registers - * should not be touched. - ********************************************************************* - */ - - /* init etheraddr state variables */ - brcms_c_get_macaddr(wlc_hw, wlc_hw->etheraddr); - - if (is_broadcast_ether_addr(wlc_hw->etheraddr) || - is_zero_ether_addr(wlc_hw->etheraddr)) { - wiphy_err(wiphy, "wl%d: brcms_b_attach: bad macaddr\n", - unit); - err = 22; - goto fail; - } - - brcms_dbg_info(wlc_hw->d11core, "deviceid 0x%x nbands %d board 0x%x\n", - wlc_hw->deviceid, wlc_hw->_nbands, - ai_get_boardtype(wlc_hw->sih)); - - return err; - - fail: - wiphy_err(wiphy, "wl%d: brcms_b_attach: failed with err %d\n", unit, - err); - return err; -} - -static void brcms_c_attach_antgain_init(struct brcms_c_info *wlc) -{ - uint unit; - unit = wlc->pub->unit; - - if ((wlc->band->antgain == -1) && (wlc->pub->sromrev == 1)) { - /* default antenna gain for srom rev 1 is 2 dBm (8 qdbm) */ - wlc->band->antgain = 8; - } else if (wlc->band->antgain == -1) { - wiphy_err(wlc->wiphy, "wl%d: %s: Invalid antennas available in" - " srom, using 2dB\n", unit, __func__); - wlc->band->antgain = 8; - } else { - s8 gain, fract; - /* Older sroms specified gain in whole dbm only. In order - * be able to specify qdbm granularity and remain backward - * compatible the whole dbms are now encoded in only - * low 6 bits and remaining qdbms are encoded in the hi 2 bits. - * 6 bit signed number ranges from -32 - 31. - * - * Examples: - * 0x1 = 1 db, - * 0xc1 = 1.75 db (1 + 3 quarters), - * 0x3f = -1 (-1 + 0 quarters), - * 0x7f = -.75 (-1 + 1 quarters) = -3 qdbm. - * 0xbf = -.50 (-1 + 2 quarters) = -2 qdbm. - */ - gain = wlc->band->antgain & 0x3f; - gain <<= 2; /* Sign extend */ - gain >>= 2; - fract = (wlc->band->antgain & 0xc0) >> 6; - wlc->band->antgain = 4 * gain + fract; - } -} - -static bool brcms_c_attach_stf_ant_init(struct brcms_c_info *wlc) -{ - int aa; - uint unit; - int bandtype; - struct ssb_sprom *sprom = &wlc->hw->d11core->bus->sprom; - - unit = wlc->pub->unit; - bandtype = wlc->band->bandtype; - - /* get antennas available */ - if (bandtype == BRCM_BAND_5G) - aa = sprom->ant_available_a; - else - aa = sprom->ant_available_bg; - - if ((aa < 1) || (aa > 15)) { - wiphy_err(wlc->wiphy, "wl%d: %s: Invalid antennas available in" - " srom (0x%x), using 3\n", unit, __func__, aa); - aa = 3; - } - - /* reset the defaults if we have a single antenna */ - if (aa == 1) { - wlc->stf->ant_rx_ovr = ANT_RX_DIV_FORCE_0; - wlc->stf->txant = ANT_TX_FORCE_0; - } else if (aa == 2) { - wlc->stf->ant_rx_ovr = ANT_RX_DIV_FORCE_1; - wlc->stf->txant = ANT_TX_FORCE_1; - } else { - } - - /* Compute Antenna Gain */ - if (bandtype == BRCM_BAND_5G) - wlc->band->antgain = sprom->antenna_gain.a1; - else - wlc->band->antgain = sprom->antenna_gain.a0; - - brcms_c_attach_antgain_init(wlc); - - return true; -} - -static void brcms_c_bss_default_init(struct brcms_c_info *wlc) -{ - u16 chanspec; - struct brcms_band *band; - struct brcms_bss_info *bi = wlc->default_bss; - - /* init default and target BSS with some sane initial values */ - memset(bi, 0, sizeof(*bi)); - bi->beacon_period = BEACON_INTERVAL_DEFAULT; - - /* fill the default channel as the first valid channel - * starting from the 2G channels - */ - chanspec = ch20mhz_chspec(1); - wlc->home_chanspec = bi->chanspec = chanspec; - - /* find the band of our default channel */ - band = wlc->band; - if (wlc->pub->_nbands > 1 && - band->bandunit != chspec_bandunit(chanspec)) - band = wlc->bandstate[OTHERBANDUNIT(wlc)]; - - /* init bss rates to the band specific default rate set */ - brcms_c_rateset_default(&bi->rateset, NULL, band->phytype, - band->bandtype, false, BRCMS_RATE_MASK_FULL, - (bool) (wlc->pub->_n_enab & SUPPORT_11N), - brcms_chspec_bw(chanspec), wlc->stf->txstreams); - - if (wlc->pub->_n_enab & SUPPORT_11N) - bi->flags |= BRCMS_BSS_HT; -} - -static void brcms_c_update_mimo_band_bwcap(struct brcms_c_info *wlc, u8 bwcap) -{ - uint i; - struct brcms_band *band; - - for (i = 0; i < wlc->pub->_nbands; i++) { - band = wlc->bandstate[i]; - if (band->bandtype == BRCM_BAND_5G) { - if ((bwcap == BRCMS_N_BW_40ALL) - || (bwcap == BRCMS_N_BW_20IN2G_40IN5G)) - band->mimo_cap_40 = true; - else - band->mimo_cap_40 = false; - } else { - if (bwcap == BRCMS_N_BW_40ALL) - band->mimo_cap_40 = true; - else - band->mimo_cap_40 = false; - } - } -} - -static void brcms_c_timers_deinit(struct brcms_c_info *wlc) -{ - /* free timer state */ - if (wlc->wdtimer) { - brcms_free_timer(wlc->wdtimer); - wlc->wdtimer = NULL; - } - if (wlc->radio_timer) { - brcms_free_timer(wlc->radio_timer); - wlc->radio_timer = NULL; - } -} - -static void brcms_c_detach_module(struct brcms_c_info *wlc) -{ - if (wlc->asi) { - brcms_c_antsel_detach(wlc->asi); - wlc->asi = NULL; - } - - if (wlc->ampdu) { - brcms_c_ampdu_detach(wlc->ampdu); - wlc->ampdu = NULL; - } - - brcms_c_stf_detach(wlc); -} - -/* - * low level detach - */ -static int brcms_b_detach(struct brcms_c_info *wlc) -{ - uint i; - struct brcms_hw_band *band; - struct brcms_hardware *wlc_hw = wlc->hw; - int callbacks; - - callbacks = 0; - - brcms_b_detach_dmapio(wlc_hw); - - band = wlc_hw->band; - for (i = 0; i < wlc_hw->_nbands; i++) { - if (band->pi) { - /* Detach this band's phy */ - wlc_phy_detach(band->pi); - band->pi = NULL; - } - band = wlc_hw->bandstate[OTHERBANDUNIT(wlc)]; - } - - /* Free shared phy state */ - kfree(wlc_hw->phy_sh); - - wlc_phy_shim_detach(wlc_hw->physhim); - - if (wlc_hw->sih) { - ai_detach(wlc_hw->sih); - wlc_hw->sih = NULL; - } - - return callbacks; - -} - -/* - * Return a count of the number of driver callbacks still pending. - * - * General policy is that brcms_c_detach can only dealloc/free software states. - * It can NOT touch hardware registers since the d11core may be in reset and - * clock may not be available. - * One exception is sb register access, which is possible if crystal is turned - * on after "down" state, driver should avoid software timer with the exception - * of radio_monitor. - */ -uint brcms_c_detach(struct brcms_c_info *wlc) -{ - uint callbacks = 0; - - if (wlc == NULL) - return 0; - - callbacks += brcms_b_detach(wlc); - - /* delete software timers */ - if (!brcms_c_radio_monitor_stop(wlc)) - callbacks++; - - brcms_c_channel_mgr_detach(wlc->cmi); - - brcms_c_timers_deinit(wlc); - - brcms_c_detach_module(wlc); - - brcms_c_detach_mfree(wlc); - return callbacks; -} - -/* update state that depends on the current value of "ap" */ -static void brcms_c_ap_upd(struct brcms_c_info *wlc) -{ - /* STA-BSS; short capable */ - wlc->PLCPHdr_override = BRCMS_PLCP_SHORT; -} - -/* Initialize just the hardware when coming out of POR or S3/S5 system states */ -static void brcms_b_hw_up(struct brcms_hardware *wlc_hw) -{ - if (wlc_hw->wlc->pub->hw_up) - return; - - brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); - - /* - * Enable pll and xtal, initialize the power control registers, - * and force fastclock for the remainder of brcms_c_up(). - */ - brcms_b_xtal(wlc_hw, ON); - ai_clkctl_init(wlc_hw->sih); - brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); - - /* - * TODO: test suspend/resume - * - * AI chip doesn't restore bar0win2 on - * hibernation/resume, need sw fixup - */ - - /* - * Inform phy that a POR reset has occurred so - * it does a complete phy init - */ - wlc_phy_por_inform(wlc_hw->band->pi); - - wlc_hw->ucode_loaded = false; - wlc_hw->wlc->pub->hw_up = true; - - if ((wlc_hw->boardflags & BFL_FEM) - && (ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM4313)) { - if (! - (wlc_hw->boardrev >= 0x1250 - && (wlc_hw->boardflags & BFL_FEM_BT))) - ai_epa_4313war(wlc_hw->sih); - } -} - -static int brcms_b_up_prep(struct brcms_hardware *wlc_hw) -{ - brcms_dbg_info(wlc_hw->d11core, "wl%d\n", wlc_hw->unit); - - /* - * Enable pll and xtal, initialize the power control registers, - * and force fastclock for the remainder of brcms_c_up(). - */ - brcms_b_xtal(wlc_hw, ON); - ai_clkctl_init(wlc_hw->sih); - brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); - - /* - * Configure pci/pcmcia here instead of in brcms_c_attach() - * to allow mfg hotswap: down, hotswap (chip power cycle), up. - */ - bcma_core_pci_irq_ctl(&wlc_hw->d11core->bus->drv_pci[0], wlc_hw->d11core, - true); - - /* - * Need to read the hwradio status here to cover the case where the - * system is loaded with the hw radio disabled. We do not want to - * bring the driver up in this case. - */ - if (brcms_b_radio_read_hwdisabled(wlc_hw)) { - /* put SB PCI in down state again */ - ai_pci_down(wlc_hw->sih); - brcms_b_xtal(wlc_hw, OFF); - return -ENOMEDIUM; - } - - ai_pci_up(wlc_hw->sih); - - /* reset the d11 core */ - brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); - - return 0; -} - -static int brcms_b_up_finish(struct brcms_hardware *wlc_hw) -{ - wlc_hw->up = true; - wlc_phy_hw_state_upd(wlc_hw->band->pi, true); - - /* FULLY enable dynamic power control and d11 core interrupt */ - brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_DYNAMIC); - brcms_intrson(wlc_hw->wlc->wl); - return 0; -} - -/* - * Write WME tunable parameters for retransmit/max rate - * from wlc struct to ucode - */ -static void brcms_c_wme_retries_write(struct brcms_c_info *wlc) -{ - int ac; - - /* Need clock to do this */ - if (!wlc->clk) - return; - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) - brcms_b_write_shm(wlc->hw, M_AC_TXLMT_ADDR(ac), - wlc->wme_retries[ac]); -} - -/* make interface operational */ -int brcms_c_up(struct brcms_c_info *wlc) -{ - struct ieee80211_channel *ch; - - brcms_dbg_info(wlc->hw->d11core, "wl%d\n", wlc->pub->unit); - - /* HW is turned off so don't try to access it */ - if (wlc->pub->hw_off || brcms_deviceremoved(wlc)) - return -ENOMEDIUM; - - if (!wlc->pub->hw_up) { - brcms_b_hw_up(wlc->hw); - wlc->pub->hw_up = true; - } - - if ((wlc->pub->boardflags & BFL_FEM) - && (ai_get_chip_id(wlc->hw->sih) == BCMA_CHIP_ID_BCM4313)) { - if (wlc->pub->boardrev >= 0x1250 - && (wlc->pub->boardflags & BFL_FEM_BT)) - brcms_b_mhf(wlc->hw, MHF5, MHF5_4313_GPIOCTRL, - MHF5_4313_GPIOCTRL, BRCM_BAND_ALL); - else - brcms_b_mhf(wlc->hw, MHF4, MHF4_EXTPA_ENABLE, - MHF4_EXTPA_ENABLE, BRCM_BAND_ALL); - } - - /* - * Need to read the hwradio status here to cover the case where the - * system is loaded with the hw radio disabled. We do not want to bring - * the driver up in this case. If radio is disabled, abort up, lower - * power, start radio timer and return 0(for NDIS) don't call - * radio_update to avoid looping brcms_c_up. - * - * brcms_b_up_prep() returns either 0 or -BCME_RADIOOFF only - */ - if (!wlc->pub->radio_disabled) { - int status = brcms_b_up_prep(wlc->hw); - if (status == -ENOMEDIUM) { - if (!mboolisset - (wlc->pub->radio_disabled, WL_RADIO_HW_DISABLE)) { - struct brcms_bss_cfg *bsscfg = wlc->bsscfg; - mboolset(wlc->pub->radio_disabled, - WL_RADIO_HW_DISABLE); - if (bsscfg->type == BRCMS_TYPE_STATION || - bsscfg->type == BRCMS_TYPE_ADHOC) - brcms_err(wlc->hw->d11core, - "wl%d: up: rfdisable -> " - "bsscfg_disable()\n", - wlc->pub->unit); - } - } - } - - if (wlc->pub->radio_disabled) { - brcms_c_radio_monitor_start(wlc); - return 0; - } - - /* brcms_b_up_prep has done brcms_c_corereset(). so clk is on, set it */ - wlc->clk = true; - - brcms_c_radio_monitor_stop(wlc); - - /* Set EDCF hostflags */ - brcms_b_mhf(wlc->hw, MHF1, MHF1_EDCF, MHF1_EDCF, BRCM_BAND_ALL); - - brcms_init(wlc->wl); - wlc->pub->up = true; - - if (wlc->bandinit_pending) { - ch = wlc->pub->ieee_hw->conf.chandef.chan; - brcms_c_suspend_mac_and_wait(wlc); - brcms_c_set_chanspec(wlc, ch20mhz_chspec(ch->hw_value)); - wlc->bandinit_pending = false; - brcms_c_enable_mac(wlc); - } - - brcms_b_up_finish(wlc->hw); - - /* Program the TX wme params with the current settings */ - brcms_c_wme_retries_write(wlc); - - /* start one second watchdog timer */ - brcms_add_timer(wlc->wdtimer, TIMER_INTERVAL_WATCHDOG, true); - wlc->WDarmed = true; - - /* ensure antenna config is up to date */ - brcms_c_stf_phy_txant_upd(wlc); - /* ensure LDPC config is in sync */ - brcms_c_ht_update_ldpc(wlc, wlc->stf->ldpc); - - return 0; -} - -static uint brcms_c_down_del_timer(struct brcms_c_info *wlc) -{ - uint callbacks = 0; - - return callbacks; -} - -static int brcms_b_bmac_down_prep(struct brcms_hardware *wlc_hw) -{ - bool dev_gone; - uint callbacks = 0; - - if (!wlc_hw->up) - return callbacks; - - dev_gone = brcms_deviceremoved(wlc_hw->wlc); - - /* disable interrupts */ - if (dev_gone) - wlc_hw->wlc->macintmask = 0; - else { - /* now disable interrupts */ - brcms_intrsoff(wlc_hw->wlc->wl); - - /* ensure we're running on the pll clock again */ - brcms_b_clkctl_clk(wlc_hw, BCMA_CLKMODE_FAST); - } - /* down phy at the last of this stage */ - callbacks += wlc_phy_down(wlc_hw->band->pi); - - return callbacks; -} - -static int brcms_b_down_finish(struct brcms_hardware *wlc_hw) -{ - uint callbacks = 0; - bool dev_gone; - - if (!wlc_hw->up) - return callbacks; - - wlc_hw->up = false; - wlc_phy_hw_state_upd(wlc_hw->band->pi, false); - - dev_gone = brcms_deviceremoved(wlc_hw->wlc); - - if (dev_gone) { - wlc_hw->sbclk = false; - wlc_hw->clk = false; - wlc_phy_hw_clk_state_upd(wlc_hw->band->pi, false); - - /* reclaim any posted packets */ - brcms_c_flushqueues(wlc_hw->wlc); - } else { - - /* Reset and disable the core */ - if (bcma_core_is_enabled(wlc_hw->d11core)) { - if (bcma_read32(wlc_hw->d11core, - D11REGOFFS(maccontrol)) & MCTL_EN_MAC) - brcms_c_suspend_mac_and_wait(wlc_hw->wlc); - callbacks += brcms_reset(wlc_hw->wlc->wl); - brcms_c_coredisable(wlc_hw); - } - - /* turn off primary xtal and pll */ - if (!wlc_hw->noreset) { - ai_pci_down(wlc_hw->sih); - brcms_b_xtal(wlc_hw, OFF); - } - } - - return callbacks; -} - -/* - * Mark the interface nonoperational, stop the software mechanisms, - * disable the hardware, free any transient buffer state. - * Return a count of the number of driver callbacks still pending. - */ -uint brcms_c_down(struct brcms_c_info *wlc) -{ - - uint callbacks = 0; - int i; - bool dev_gone = false; - - brcms_dbg_info(wlc->hw->d11core, "wl%d\n", wlc->pub->unit); - - /* check if we are already in the going down path */ - if (wlc->going_down) { - brcms_err(wlc->hw->d11core, - "wl%d: %s: Driver going down so return\n", - wlc->pub->unit, __func__); - return 0; - } - if (!wlc->pub->up) - return callbacks; - - wlc->going_down = true; - - callbacks += brcms_b_bmac_down_prep(wlc->hw); - - dev_gone = brcms_deviceremoved(wlc); - - /* Call any registered down handlers */ - for (i = 0; i < BRCMS_MAXMODULES; i++) { - if (wlc->modulecb[i].down_fn) - callbacks += - wlc->modulecb[i].down_fn(wlc->modulecb[i].hdl); - } - - /* cancel the watchdog timer */ - if (wlc->WDarmed) { - if (!brcms_del_timer(wlc->wdtimer)) - callbacks++; - wlc->WDarmed = false; - } - /* cancel all other timers */ - callbacks += brcms_c_down_del_timer(wlc); - - wlc->pub->up = false; - - wlc_phy_mute_upd(wlc->band->pi, false, PHY_MUTE_ALL); - - callbacks += brcms_b_down_finish(wlc->hw); - - /* brcms_b_down_finish has done brcms_c_coredisable(). so clk is off */ - wlc->clk = false; - - wlc->going_down = false; - return callbacks; -} - -/* Set the current gmode configuration */ -int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config) -{ - int ret = 0; - uint i; - struct brcms_c_rateset rs; - /* Default to 54g Auto */ - /* Advertise and use shortslot (-1/0/1 Auto/Off/On) */ - s8 shortslot = BRCMS_SHORTSLOT_AUTO; - bool shortslot_restrict = false; /* Restrict association to stations - * that support shortslot - */ - bool ofdm_basic = false; /* Make 6, 12, and 24 basic rates */ - /* Advertise and use short preambles (-1/0/1 Auto/Off/On) */ - int preamble = BRCMS_PLCP_LONG; - bool preamble_restrict = false; /* Restrict association to stations - * that support short preambles - */ - struct brcms_band *band; - - /* if N-support is enabled, allow Gmode set as long as requested - * Gmode is not GMODE_LEGACY_B - */ - if ((wlc->pub->_n_enab & SUPPORT_11N) && gmode == GMODE_LEGACY_B) - return -ENOTSUPP; - - /* verify that we are dealing with 2G band and grab the band pointer */ - if (wlc->band->bandtype == BRCM_BAND_2G) - band = wlc->band; - else if ((wlc->pub->_nbands > 1) && - (wlc->bandstate[OTHERBANDUNIT(wlc)]->bandtype == BRCM_BAND_2G)) - band = wlc->bandstate[OTHERBANDUNIT(wlc)]; - else - return -EINVAL; - - /* update configuration value */ - if (config) - brcms_c_protection_upd(wlc, BRCMS_PROT_G_USER, gmode); - - /* Clear rateset override */ - memset(&rs, 0, sizeof(rs)); - - switch (gmode) { - case GMODE_LEGACY_B: - shortslot = BRCMS_SHORTSLOT_OFF; - brcms_c_rateset_copy(&gphy_legacy_rates, &rs); - - break; - - case GMODE_LRS: - break; - - case GMODE_AUTO: - /* Accept defaults */ - break; - - case GMODE_ONLY: - ofdm_basic = true; - preamble = BRCMS_PLCP_SHORT; - preamble_restrict = true; - break; - - case GMODE_PERFORMANCE: - shortslot = BRCMS_SHORTSLOT_ON; - shortslot_restrict = true; - ofdm_basic = true; - preamble = BRCMS_PLCP_SHORT; - preamble_restrict = true; - break; - - default: - /* Error */ - brcms_err(wlc->hw->d11core, "wl%d: %s: invalid gmode %d\n", - wlc->pub->unit, __func__, gmode); - return -ENOTSUPP; - } - - band->gmode = gmode; - - wlc->shortslot_override = shortslot; - - /* Use the default 11g rateset */ - if (!rs.count) - brcms_c_rateset_copy(&cck_ofdm_rates, &rs); - - if (ofdm_basic) { - for (i = 0; i < rs.count; i++) { - if (rs.rates[i] == BRCM_RATE_6M - || rs.rates[i] == BRCM_RATE_12M - || rs.rates[i] == BRCM_RATE_24M) - rs.rates[i] |= BRCMS_RATE_FLAG; - } - } - - /* Set default bss rateset */ - wlc->default_bss->rateset.count = rs.count; - memcpy(wlc->default_bss->rateset.rates, rs.rates, - sizeof(wlc->default_bss->rateset.rates)); - - return ret; -} - -int brcms_c_set_nmode(struct brcms_c_info *wlc) -{ - uint i; - s32 nmode = AUTO; - - if (wlc->stf->txstreams == WL_11N_3x3) - nmode = WL_11N_3x3; - else - nmode = WL_11N_2x2; - - /* force GMODE_AUTO if NMODE is ON */ - brcms_c_set_gmode(wlc, GMODE_AUTO, true); - if (nmode == WL_11N_3x3) - wlc->pub->_n_enab = SUPPORT_HT; - else - wlc->pub->_n_enab = SUPPORT_11N; - wlc->default_bss->flags |= BRCMS_BSS_HT; - /* add the mcs rates to the default and hw ratesets */ - brcms_c_rateset_mcs_build(&wlc->default_bss->rateset, - wlc->stf->txstreams); - for (i = 0; i < wlc->pub->_nbands; i++) - memcpy(wlc->bandstate[i]->hw_rateset.mcs, - wlc->default_bss->rateset.mcs, MCSSET_LEN); - - return 0; -} - -static int -brcms_c_set_internal_rateset(struct brcms_c_info *wlc, - struct brcms_c_rateset *rs_arg) -{ - struct brcms_c_rateset rs, new; - uint bandunit; - - memcpy(&rs, rs_arg, sizeof(struct brcms_c_rateset)); - - /* check for bad count value */ - if ((rs.count == 0) || (rs.count > BRCMS_NUMRATES)) - return -EINVAL; - - /* try the current band */ - bandunit = wlc->band->bandunit; - memcpy(&new, &rs, sizeof(struct brcms_c_rateset)); - if (brcms_c_rate_hwrs_filter_sort_validate - (&new, &wlc->bandstate[bandunit]->hw_rateset, true, - wlc->stf->txstreams)) - goto good; - - /* try the other band */ - if (brcms_is_mband_unlocked(wlc)) { - bandunit = OTHERBANDUNIT(wlc); - memcpy(&new, &rs, sizeof(struct brcms_c_rateset)); - if (brcms_c_rate_hwrs_filter_sort_validate(&new, - &wlc-> - bandstate[bandunit]-> - hw_rateset, true, - wlc->stf->txstreams)) - goto good; - } - - return -EBADE; - - good: - /* apply new rateset */ - memcpy(&wlc->default_bss->rateset, &new, - sizeof(struct brcms_c_rateset)); - memcpy(&wlc->bandstate[bandunit]->defrateset, &new, - sizeof(struct brcms_c_rateset)); - return 0; -} - -static void brcms_c_ofdm_rateset_war(struct brcms_c_info *wlc) -{ - u8 r; - bool war = false; - - if (wlc->pub->associated) - r = wlc->bsscfg->current_bss->rateset.rates[0]; - else - r = wlc->default_bss->rateset.rates[0]; - - wlc_phy_ofdm_rateset_war(wlc->band->pi, war); -} - -int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel) -{ - u16 chspec = ch20mhz_chspec(channel); - - if (channel < 0 || channel > MAXCHANNEL) - return -EINVAL; - - if (!brcms_c_valid_chanspec_db(wlc->cmi, chspec)) - return -EINVAL; - - - if (!wlc->pub->up && brcms_is_mband_unlocked(wlc)) { - if (wlc->band->bandunit != chspec_bandunit(chspec)) - wlc->bandinit_pending = true; - else - wlc->bandinit_pending = false; - } - - wlc->default_bss->chanspec = chspec; - /* brcms_c_BSSinit() will sanitize the rateset before - * using it.. */ - if (wlc->pub->up && (wlc_phy_chanspec_get(wlc->band->pi) != chspec)) { - brcms_c_set_home_chanspec(wlc, chspec); - brcms_c_suspend_mac_and_wait(wlc); - brcms_c_set_chanspec(wlc, chspec); - brcms_c_enable_mac(wlc); - } - return 0; -} - -int brcms_c_set_rate_limit(struct brcms_c_info *wlc, u16 srl, u16 lrl) -{ - int ac; - - if (srl < 1 || srl > RETRY_SHORT_MAX || - lrl < 1 || lrl > RETRY_SHORT_MAX) - return -EINVAL; - - wlc->SRL = srl; - wlc->LRL = lrl; - - brcms_b_retrylimit_upd(wlc->hw, wlc->SRL, wlc->LRL); - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { - wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], - EDCF_SHORT, wlc->SRL); - wlc->wme_retries[ac] = SFIELD(wlc->wme_retries[ac], - EDCF_LONG, wlc->LRL); - } - brcms_c_wme_retries_write(wlc); - - return 0; -} - -void brcms_c_get_current_rateset(struct brcms_c_info *wlc, - struct brcm_rateset *currs) -{ - struct brcms_c_rateset *rs; - - if (wlc->pub->associated) - rs = &wlc->bsscfg->current_bss->rateset; - else - rs = &wlc->default_bss->rateset; - - /* Copy only legacy rateset section */ - currs->count = rs->count; - memcpy(&currs->rates, &rs->rates, rs->count); -} - -int brcms_c_set_rateset(struct brcms_c_info *wlc, struct brcm_rateset *rs) -{ - struct brcms_c_rateset internal_rs; - int bcmerror; - - if (rs->count > BRCMS_NUMRATES) - return -ENOBUFS; - - memset(&internal_rs, 0, sizeof(internal_rs)); - - /* Copy only legacy rateset section */ - internal_rs.count = rs->count; - memcpy(&internal_rs.rates, &rs->rates, internal_rs.count); - - /* merge rateset coming in with the current mcsset */ - if (wlc->pub->_n_enab & SUPPORT_11N) { - struct brcms_bss_info *mcsset_bss; - if (wlc->pub->associated) - mcsset_bss = wlc->bsscfg->current_bss; - else - mcsset_bss = wlc->default_bss; - memcpy(internal_rs.mcs, &mcsset_bss->rateset.mcs[0], - MCSSET_LEN); - } - - bcmerror = brcms_c_set_internal_rateset(wlc, &internal_rs); - if (!bcmerror) - brcms_c_ofdm_rateset_war(wlc); - - return bcmerror; -} - -static void brcms_c_time_lock(struct brcms_c_info *wlc) -{ - bcma_set32(wlc->hw->d11core, D11REGOFFS(maccontrol), MCTL_TBTTHOLD); - /* Commit the write */ - bcma_read32(wlc->hw->d11core, D11REGOFFS(maccontrol)); -} - -static void brcms_c_time_unlock(struct brcms_c_info *wlc) -{ - bcma_mask32(wlc->hw->d11core, D11REGOFFS(maccontrol), ~MCTL_TBTTHOLD); - /* Commit the write */ - bcma_read32(wlc->hw->d11core, D11REGOFFS(maccontrol)); -} - -int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period) -{ - u32 bcnint_us; - - if (period == 0) - return -EINVAL; - - wlc->default_bss->beacon_period = period; - - bcnint_us = period << 10; - brcms_c_time_lock(wlc); - bcma_write32(wlc->hw->d11core, D11REGOFFS(tsf_cfprep), - (bcnint_us << CFPREP_CBI_SHIFT)); - bcma_write32(wlc->hw->d11core, D11REGOFFS(tsf_cfpstart), bcnint_us); - brcms_c_time_unlock(wlc); - - return 0; -} - -u16 brcms_c_get_phy_type(struct brcms_c_info *wlc, int phyidx) -{ - return wlc->band->phytype; -} - -void brcms_c_set_shortslot_override(struct brcms_c_info *wlc, s8 sslot_override) -{ - wlc->shortslot_override = sslot_override; - - /* - * shortslot is an 11g feature, so no more work if we are - * currently on the 5G band - */ - if (wlc->band->bandtype == BRCM_BAND_5G) - return; - - if (wlc->pub->up && wlc->pub->associated) { - /* let watchdog or beacon processing update shortslot */ - } else if (wlc->pub->up) { - /* unassociated shortslot is off */ - brcms_c_switch_shortslot(wlc, false); - } else { - /* driver is down, so just update the brcms_c_info - * value */ - if (wlc->shortslot_override == BRCMS_SHORTSLOT_AUTO) - wlc->shortslot = false; - else - wlc->shortslot = - (wlc->shortslot_override == - BRCMS_SHORTSLOT_ON); - } -} - -/* - * register watchdog and down handlers. - */ -int brcms_c_module_register(struct brcms_pub *pub, - const char *name, struct brcms_info *hdl, - int (*d_fn)(void *handle)) -{ - struct brcms_c_info *wlc = (struct brcms_c_info *) pub->wlc; - int i; - - /* find an empty entry and just add, no duplication check! */ - for (i = 0; i < BRCMS_MAXMODULES; i++) { - if (wlc->modulecb[i].name[0] == '\0') { - strncpy(wlc->modulecb[i].name, name, - sizeof(wlc->modulecb[i].name) - 1); - wlc->modulecb[i].hdl = hdl; - wlc->modulecb[i].down_fn = d_fn; - return 0; - } - } - - return -ENOSR; -} - -/* unregister module callbacks */ -int brcms_c_module_unregister(struct brcms_pub *pub, const char *name, - struct brcms_info *hdl) -{ - struct brcms_c_info *wlc = (struct brcms_c_info *) pub->wlc; - int i; - - if (wlc == NULL) - return -ENODATA; - - for (i = 0; i < BRCMS_MAXMODULES; i++) { - if (!strcmp(wlc->modulecb[i].name, name) && - (wlc->modulecb[i].hdl == hdl)) { - memset(&wlc->modulecb[i], 0, sizeof(wlc->modulecb[i])); - return 0; - } - } - - /* table not found! */ - return -ENODATA; -} - -static bool brcms_c_chipmatch_pci(struct bcma_device *core) -{ - struct pci_dev *pcidev = core->bus->host_pci; - u16 vendor = pcidev->vendor; - u16 device = pcidev->device; - - if (vendor != PCI_VENDOR_ID_BROADCOM) { - pr_err("unknown vendor id %04x\n", vendor); - return false; - } - - if (device == BCM43224_D11N_ID_VEN1 || device == BCM43224_CHIP_ID) - return true; - if ((device == BCM43224_D11N_ID) || (device == BCM43225_D11N2G_ID)) - return true; - if (device == BCM4313_D11N2G_ID) - return true; - if ((device == BCM43236_D11N_ID) || (device == BCM43236_D11N2G_ID)) - return true; - - pr_err("unknown device id %04x\n", device); - return false; -} - -static bool brcms_c_chipmatch_soc(struct bcma_device *core) -{ - struct bcma_chipinfo *chipinfo = &core->bus->chipinfo; - - if (chipinfo->id == BCMA_CHIP_ID_BCM4716) - return true; - - pr_err("unknown chip id %04x\n", chipinfo->id); - return false; -} - -bool brcms_c_chipmatch(struct bcma_device *core) -{ - switch (core->bus->hosttype) { - case BCMA_HOSTTYPE_PCI: - return brcms_c_chipmatch_pci(core); - case BCMA_HOSTTYPE_SOC: - return brcms_c_chipmatch_soc(core); - default: - pr_err("unknown host type: %i\n", core->bus->hosttype); - return false; - } -} - -u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate) -{ - u16 table_ptr; - u8 phy_rate, index; - - /* get the phy specific rate encoding for the PLCP SIGNAL field */ - if (is_ofdm_rate(rate)) - table_ptr = M_RT_DIRMAP_A; - else - table_ptr = M_RT_DIRMAP_B; - - /* for a given rate, the LS-nibble of the PLCP SIGNAL field is - * the index into the rate table. - */ - phy_rate = rate_info[rate] & BRCMS_RATE_MASK; - index = phy_rate & 0xf; - - /* Find the SHM pointer to the rate table entry by looking in the - * Direct-map Table - */ - return 2 * brcms_b_read_shm(wlc_hw, table_ptr + (index * 2)); -} - -/* - * bcmc_fid_generate: - * Generate frame ID for a BCMC packet. The frag field is not used - * for MC frames so is used as part of the sequence number. - */ -static inline u16 -bcmc_fid_generate(struct brcms_c_info *wlc, struct brcms_bss_cfg *bsscfg, - struct d11txh *txh) -{ - u16 frameid; - - frameid = le16_to_cpu(txh->TxFrameID) & ~(TXFID_SEQ_MASK | - TXFID_QUEUE_MASK); - frameid |= - (((wlc-> - mc_fid_counter++) << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) | - TX_BCMC_FIFO; - - return frameid; -} - -static uint -brcms_c_calc_ack_time(struct brcms_c_info *wlc, u32 rspec, - u8 preamble_type) -{ - uint dur = 0; - - /* - * Spec 9.6: ack rate is the highest rate in BSSBasicRateSet that - * is less than or equal to the rate of the immediately previous - * frame in the FES - */ - rspec = brcms_basic_rate(wlc, rspec); - /* ACK frame len == 14 == 2(fc) + 2(dur) + 6(ra) + 4(fcs) */ - dur = - brcms_c_calc_frame_time(wlc, rspec, preamble_type, - (DOT11_ACK_LEN + FCS_LEN)); - return dur; -} - -static uint -brcms_c_calc_cts_time(struct brcms_c_info *wlc, u32 rspec, - u8 preamble_type) -{ - return brcms_c_calc_ack_time(wlc, rspec, preamble_type); -} - -static uint -brcms_c_calc_ba_time(struct brcms_c_info *wlc, u32 rspec, - u8 preamble_type) -{ - /* - * Spec 9.6: ack rate is the highest rate in BSSBasicRateSet that - * is less than or equal to the rate of the immediately previous - * frame in the FES - */ - rspec = brcms_basic_rate(wlc, rspec); - /* BA len == 32 == 16(ctl hdr) + 4(ba len) + 8(bitmap) + 4(fcs) */ - return brcms_c_calc_frame_time(wlc, rspec, preamble_type, - (DOT11_BA_LEN + DOT11_BA_BITMAP_LEN + - FCS_LEN)); -} - -/* brcms_c_compute_frame_dur() - * - * Calculate the 802.11 MAC header DUR field for MPDU - * DUR for a single frame = 1 SIFS + 1 ACK - * DUR for a frame with following frags = 3 SIFS + 2 ACK + next frag time - * - * rate MPDU rate in unit of 500kbps - * next_frag_len next MPDU length in bytes - * preamble_type use short/GF or long/MM PLCP header - */ -static u16 -brcms_c_compute_frame_dur(struct brcms_c_info *wlc, u32 rate, - u8 preamble_type, uint next_frag_len) -{ - u16 dur, sifs; - - sifs = get_sifs(wlc->band); - - dur = sifs; - dur += (u16) brcms_c_calc_ack_time(wlc, rate, preamble_type); - - if (next_frag_len) { - /* Double the current DUR to get 2 SIFS + 2 ACKs */ - dur *= 2; - /* add another SIFS and the frag time */ - dur += sifs; - dur += - (u16) brcms_c_calc_frame_time(wlc, rate, preamble_type, - next_frag_len); - } - return dur; -} - -/* The opposite of brcms_c_calc_frame_time */ -static uint -brcms_c_calc_frame_len(struct brcms_c_info *wlc, u32 ratespec, - u8 preamble_type, uint dur) -{ - uint nsyms, mac_len, Ndps, kNdps; - uint rate = rspec2rate(ratespec); - - if (is_mcs_rate(ratespec)) { - uint mcs = ratespec & RSPEC_RATE_MASK; - int tot_streams = mcs_2_txstreams(mcs) + rspec_stc(ratespec); - dur -= PREN_PREAMBLE + (tot_streams * PREN_PREAMBLE_EXT); - /* payload calculation matches that of regular ofdm */ - if (wlc->band->bandtype == BRCM_BAND_2G) - dur -= DOT11_OFDM_SIGNAL_EXTENSION; - /* kNdbps = kbps * 4 */ - kNdps = mcs_2_rate(mcs, rspec_is40mhz(ratespec), - rspec_issgi(ratespec)) * 4; - nsyms = dur / APHY_SYMBOL_TIME; - mac_len = - ((nsyms * kNdps) - - ((APHY_SERVICE_NBITS + APHY_TAIL_NBITS) * 1000)) / 8000; - } else if (is_ofdm_rate(ratespec)) { - dur -= APHY_PREAMBLE_TIME; - dur -= APHY_SIGNAL_TIME; - /* Ndbps = Mbps * 4 = rate(500Kbps) * 2 */ - Ndps = rate * 2; - nsyms = dur / APHY_SYMBOL_TIME; - mac_len = - ((nsyms * Ndps) - - (APHY_SERVICE_NBITS + APHY_TAIL_NBITS)) / 8; - } else { - if (preamble_type & BRCMS_SHORT_PREAMBLE) - dur -= BPHY_PLCP_SHORT_TIME; - else - dur -= BPHY_PLCP_TIME; - mac_len = dur * rate; - /* divide out factor of 2 in rate (1/2 mbps) */ - mac_len = mac_len / 8 / 2; - } - return mac_len; -} - -/* - * Return true if the specified rate is supported by the specified band. - * BRCM_BAND_AUTO indicates the current band. - */ -static bool brcms_c_valid_rate(struct brcms_c_info *wlc, u32 rspec, int band, - bool verbose) -{ - struct brcms_c_rateset *hw_rateset; - uint i; - - if ((band == BRCM_BAND_AUTO) || (band == wlc->band->bandtype)) - hw_rateset = &wlc->band->hw_rateset; - else if (wlc->pub->_nbands > 1) - hw_rateset = &wlc->bandstate[OTHERBANDUNIT(wlc)]->hw_rateset; - else - /* other band specified and we are a single band device */ - return false; - - /* check if this is a mimo rate */ - if (is_mcs_rate(rspec)) { - if ((rspec & RSPEC_RATE_MASK) >= MCS_TABLE_SIZE) - goto error; - - return isset(hw_rateset->mcs, (rspec & RSPEC_RATE_MASK)); - } - - for (i = 0; i < hw_rateset->count; i++) - if (hw_rateset->rates[i] == rspec2rate(rspec)) - return true; - error: - if (verbose) - brcms_err(wlc->hw->d11core, "wl%d: valid_rate: rate spec 0x%x " - "not in hw_rateset\n", wlc->pub->unit, rspec); - - return false; -} - -static u32 -mac80211_wlc_set_nrate(struct brcms_c_info *wlc, struct brcms_band *cur_band, - u32 int_val) -{ - struct bcma_device *core = wlc->hw->d11core; - u8 stf = (int_val & NRATE_STF_MASK) >> NRATE_STF_SHIFT; - u8 rate = int_val & NRATE_RATE_MASK; - u32 rspec; - bool ismcs = ((int_val & NRATE_MCS_INUSE) == NRATE_MCS_INUSE); - bool issgi = ((int_val & NRATE_SGI_MASK) >> NRATE_SGI_SHIFT); - bool override_mcs_only = ((int_val & NRATE_OVERRIDE_MCS_ONLY) - == NRATE_OVERRIDE_MCS_ONLY); - int bcmerror = 0; - - if (!ismcs) - return (u32) rate; - - /* validate the combination of rate/mcs/stf is allowed */ - if ((wlc->pub->_n_enab & SUPPORT_11N) && ismcs) { - /* mcs only allowed when nmode */ - if (stf > PHY_TXC1_MODE_SDM) { - brcms_err(core, "wl%d: %s: Invalid stf\n", - wlc->pub->unit, __func__); - bcmerror = -EINVAL; - goto done; - } - - /* mcs 32 is a special case, DUP mode 40 only */ - if (rate == 32) { - if (!CHSPEC_IS40(wlc->home_chanspec) || - ((stf != PHY_TXC1_MODE_SISO) - && (stf != PHY_TXC1_MODE_CDD))) { - brcms_err(core, "wl%d: %s: Invalid mcs 32\n", - wlc->pub->unit, __func__); - bcmerror = -EINVAL; - goto done; - } - /* mcs > 7 must use stf SDM */ - } else if (rate > HIGHEST_SINGLE_STREAM_MCS) { - /* mcs > 7 must use stf SDM */ - if (stf != PHY_TXC1_MODE_SDM) { - brcms_dbg_mac80211(core, "wl%d: enabling " - "SDM mode for mcs %d\n", - wlc->pub->unit, rate); - stf = PHY_TXC1_MODE_SDM; - } - } else { - /* - * MCS 0-7 may use SISO, CDD, and for - * phy_rev >= 3 STBC - */ - if ((stf > PHY_TXC1_MODE_STBC) || - (!BRCMS_STBC_CAP_PHY(wlc) - && (stf == PHY_TXC1_MODE_STBC))) { - brcms_err(core, "wl%d: %s: Invalid STBC\n", - wlc->pub->unit, __func__); - bcmerror = -EINVAL; - goto done; - } - } - } else if (is_ofdm_rate(rate)) { - if ((stf != PHY_TXC1_MODE_CDD) && (stf != PHY_TXC1_MODE_SISO)) { - brcms_err(core, "wl%d: %s: Invalid OFDM\n", - wlc->pub->unit, __func__); - bcmerror = -EINVAL; - goto done; - } - } else if (is_cck_rate(rate)) { - if ((cur_band->bandtype != BRCM_BAND_2G) - || (stf != PHY_TXC1_MODE_SISO)) { - brcms_err(core, "wl%d: %s: Invalid CCK\n", - wlc->pub->unit, __func__); - bcmerror = -EINVAL; - goto done; - } - } else { - brcms_err(core, "wl%d: %s: Unknown rate type\n", - wlc->pub->unit, __func__); - bcmerror = -EINVAL; - goto done; - } - /* make sure multiple antennae are available for non-siso rates */ - if ((stf != PHY_TXC1_MODE_SISO) && (wlc->stf->txstreams == 1)) { - brcms_err(core, "wl%d: %s: SISO antenna but !SISO " - "request\n", wlc->pub->unit, __func__); - bcmerror = -EINVAL; - goto done; - } - - rspec = rate; - if (ismcs) { - rspec |= RSPEC_MIMORATE; - /* For STBC populate the STC field of the ratespec */ - if (stf == PHY_TXC1_MODE_STBC) { - u8 stc; - stc = 1; /* Nss for single stream is always 1 */ - rspec |= (stc << RSPEC_STC_SHIFT); - } - } - - rspec |= (stf << RSPEC_STF_SHIFT); - - if (override_mcs_only) - rspec |= RSPEC_OVERRIDE_MCS_ONLY; - - if (issgi) - rspec |= RSPEC_SHORT_GI; - - if ((rate != 0) - && !brcms_c_valid_rate(wlc, rspec, cur_band->bandtype, true)) - return rate; - - return rspec; -done: - return rate; -} - -/* - * Compute PLCP, but only requires actual rate and length of pkt. - * Rate is given in the driver standard multiple of 500 kbps. - * le is set for 11 Mbps rate if necessary. - * Broken out for PRQ. - */ - -static void brcms_c_cck_plcp_set(struct brcms_c_info *wlc, int rate_500, - uint length, u8 *plcp) -{ - u16 usec = 0; - u8 le = 0; - - switch (rate_500) { - case BRCM_RATE_1M: - usec = length << 3; - break; - case BRCM_RATE_2M: - usec = length << 2; - break; - case BRCM_RATE_5M5: - usec = (length << 4) / 11; - if ((length << 4) - (usec * 11) > 0) - usec++; - break; - case BRCM_RATE_11M: - usec = (length << 3) / 11; - if ((length << 3) - (usec * 11) > 0) { - usec++; - if ((usec * 11) - (length << 3) >= 8) - le = D11B_PLCP_SIGNAL_LE; - } - break; - - default: - brcms_err(wlc->hw->d11core, - "brcms_c_cck_plcp_set: unsupported rate %d\n", - rate_500); - rate_500 = BRCM_RATE_1M; - usec = length << 3; - break; - } - /* PLCP signal byte */ - plcp[0] = rate_500 * 5; /* r (500kbps) * 5 == r (100kbps) */ - /* PLCP service byte */ - plcp[1] = (u8) (le | D11B_PLCP_SIGNAL_LOCKED); - /* PLCP length u16, little endian */ - plcp[2] = usec & 0xff; - plcp[3] = (usec >> 8) & 0xff; - /* PLCP CRC16 */ - plcp[4] = 0; - plcp[5] = 0; -} - -/* Rate: 802.11 rate code, length: PSDU length in octets */ -static void brcms_c_compute_mimo_plcp(u32 rspec, uint length, u8 *plcp) -{ - u8 mcs = (u8) (rspec & RSPEC_RATE_MASK); - plcp[0] = mcs; - if (rspec_is40mhz(rspec) || (mcs == 32)) - plcp[0] |= MIMO_PLCP_40MHZ; - BRCMS_SET_MIMO_PLCP_LEN(plcp, length); - plcp[3] = rspec_mimoplcp3(rspec); /* rspec already holds this byte */ - plcp[3] |= 0x7; /* set smoothing, not sounding ppdu & reserved */ - plcp[4] = 0; /* number of extension spatial streams bit 0 & 1 */ - plcp[5] = 0; -} - -/* Rate: 802.11 rate code, length: PSDU length in octets */ -static void -brcms_c_compute_ofdm_plcp(u32 rspec, u32 length, u8 *plcp) -{ - u8 rate_signal; - u32 tmp = 0; - int rate = rspec2rate(rspec); - - /* - * encode rate per 802.11a-1999 sec 17.3.4.1, with lsb - * transmitted first - */ - rate_signal = rate_info[rate] & BRCMS_RATE_MASK; - memset(plcp, 0, D11_PHY_HDR_LEN); - D11A_PHY_HDR_SRATE((struct ofdm_phy_hdr *) plcp, rate_signal); - - tmp = (length & 0xfff) << 5; - plcp[2] |= (tmp >> 16) & 0xff; - plcp[1] |= (tmp >> 8) & 0xff; - plcp[0] |= tmp & 0xff; -} - -/* Rate: 802.11 rate code, length: PSDU length in octets */ -static void brcms_c_compute_cck_plcp(struct brcms_c_info *wlc, u32 rspec, - uint length, u8 *plcp) -{ - int rate = rspec2rate(rspec); - - brcms_c_cck_plcp_set(wlc, rate, length, plcp); -} - -static void -brcms_c_compute_plcp(struct brcms_c_info *wlc, u32 rspec, - uint length, u8 *plcp) -{ - if (is_mcs_rate(rspec)) - brcms_c_compute_mimo_plcp(rspec, length, plcp); - else if (is_ofdm_rate(rspec)) - brcms_c_compute_ofdm_plcp(rspec, length, plcp); - else - brcms_c_compute_cck_plcp(wlc, rspec, length, plcp); -} - -/* brcms_c_compute_rtscts_dur() - * - * Calculate the 802.11 MAC header DUR field for an RTS or CTS frame - * DUR for normal RTS/CTS w/ frame = 3 SIFS + 1 CTS + next frame time + 1 ACK - * DUR for CTS-TO-SELF w/ frame = 2 SIFS + next frame time + 1 ACK - * - * cts cts-to-self or rts/cts - * rts_rate rts or cts rate in unit of 500kbps - * rate next MPDU rate in unit of 500kbps - * frame_len next MPDU frame length in bytes - */ -u16 -brcms_c_compute_rtscts_dur(struct brcms_c_info *wlc, bool cts_only, - u32 rts_rate, - u32 frame_rate, u8 rts_preamble_type, - u8 frame_preamble_type, uint frame_len, bool ba) -{ - u16 dur, sifs; - - sifs = get_sifs(wlc->band); - - if (!cts_only) { - /* RTS/CTS */ - dur = 3 * sifs; - dur += - (u16) brcms_c_calc_cts_time(wlc, rts_rate, - rts_preamble_type); - } else { - /* CTS-TO-SELF */ - dur = 2 * sifs; - } - - dur += - (u16) brcms_c_calc_frame_time(wlc, frame_rate, frame_preamble_type, - frame_len); - if (ba) - dur += - (u16) brcms_c_calc_ba_time(wlc, frame_rate, - BRCMS_SHORT_PREAMBLE); - else - dur += - (u16) brcms_c_calc_ack_time(wlc, frame_rate, - frame_preamble_type); - return dur; -} - -static u16 brcms_c_phytxctl1_calc(struct brcms_c_info *wlc, u32 rspec) -{ - u16 phyctl1 = 0; - u16 bw; - - if (BRCMS_ISLCNPHY(wlc->band)) { - bw = PHY_TXC1_BW_20MHZ; - } else { - bw = rspec_get_bw(rspec); - /* 10Mhz is not supported yet */ - if (bw < PHY_TXC1_BW_20MHZ) { - brcms_err(wlc->hw->d11core, "phytxctl1_calc: bw %d is " - "not supported yet, set to 20L\n", bw); - bw = PHY_TXC1_BW_20MHZ; - } - } - - if (is_mcs_rate(rspec)) { - uint mcs = rspec & RSPEC_RATE_MASK; - - /* bw, stf, coding-type is part of rspec_phytxbyte2 returns */ - phyctl1 = rspec_phytxbyte2(rspec); - /* set the upper byte of phyctl1 */ - phyctl1 |= (mcs_table[mcs].tx_phy_ctl3 << 8); - } else if (is_cck_rate(rspec) && !BRCMS_ISLCNPHY(wlc->band) - && !BRCMS_ISSSLPNPHY(wlc->band)) { - /* - * In CCK mode LPPHY overloads OFDM Modulation bits with CCK - * Data Rate. Eventually MIMOPHY would also be converted to - * this format - */ - /* 0 = 1Mbps; 1 = 2Mbps; 2 = 5.5Mbps; 3 = 11Mbps */ - phyctl1 = (bw | (rspec_stf(rspec) << PHY_TXC1_MODE_SHIFT)); - } else { /* legacy OFDM/CCK */ - s16 phycfg; - /* get the phyctl byte from rate phycfg table */ - phycfg = brcms_c_rate_legacy_phyctl(rspec2rate(rspec)); - if (phycfg == -1) { - brcms_err(wlc->hw->d11core, "phytxctl1_calc: wrong " - "legacy OFDM/CCK rate\n"); - phycfg = 0; - } - /* set the upper byte of phyctl1 */ - phyctl1 = - (bw | (phycfg << 8) | - (rspec_stf(rspec) << PHY_TXC1_MODE_SHIFT)); - } - return phyctl1; -} - -/* - * Add struct d11txh, struct cck_phy_hdr. - * - * 'p' data must start with 802.11 MAC header - * 'p' must allow enough bytes of local headers to be "pushed" onto the packet - * - * headroom == D11_PHY_HDR_LEN + D11_TXH_LEN (D11_TXH_LEN is now 104 bytes) - * - */ -static u16 -brcms_c_d11hdrs_mac80211(struct brcms_c_info *wlc, struct ieee80211_hw *hw, - struct sk_buff *p, struct scb *scb, uint frag, - uint nfrags, uint queue, uint next_frag_len) -{ - struct ieee80211_hdr *h; - struct d11txh *txh; - u8 *plcp, plcp_fallback[D11_PHY_HDR_LEN]; - int len, phylen, rts_phylen; - u16 mch, phyctl, xfts, mainrates; - u16 seq = 0, mcl = 0, status = 0, frameid = 0; - u32 rspec[2] = { BRCM_RATE_1M, BRCM_RATE_1M }; - u32 rts_rspec[2] = { BRCM_RATE_1M, BRCM_RATE_1M }; - bool use_rts = false; - bool use_cts = false; - bool use_rifs = false; - bool short_preamble[2] = { false, false }; - u8 preamble_type[2] = { BRCMS_LONG_PREAMBLE, BRCMS_LONG_PREAMBLE }; - u8 rts_preamble_type[2] = { BRCMS_LONG_PREAMBLE, BRCMS_LONG_PREAMBLE }; - u8 *rts_plcp, rts_plcp_fallback[D11_PHY_HDR_LEN]; - struct ieee80211_rts *rts = NULL; - bool qos; - uint ac; - bool hwtkmic = false; - u16 mimo_ctlchbw = PHY_TXC1_BW_20MHZ; -#define ANTCFG_NONE 0xFF - u8 antcfg = ANTCFG_NONE; - u8 fbantcfg = ANTCFG_NONE; - uint phyctl1_stf = 0; - u16 durid = 0; - struct ieee80211_tx_rate *txrate[2]; - int k; - struct ieee80211_tx_info *tx_info; - bool is_mcs; - u16 mimo_txbw; - u8 mimo_preamble_type; - - /* locate 802.11 MAC header */ - h = (struct ieee80211_hdr *)(p->data); - qos = ieee80211_is_data_qos(h->frame_control); - - /* compute length of frame in bytes for use in PLCP computations */ - len = p->len; - phylen = len + FCS_LEN; - - /* Get tx_info */ - tx_info = IEEE80211_SKB_CB(p); - - /* add PLCP */ - plcp = skb_push(p, D11_PHY_HDR_LEN); - - /* add Broadcom tx descriptor header */ - txh = (struct d11txh *) skb_push(p, D11_TXH_LEN); - memset(txh, 0, D11_TXH_LEN); - - /* setup frameid */ - if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { - /* non-AP STA should never use BCMC queue */ - if (queue == TX_BCMC_FIFO) { - brcms_err(wlc->hw->d11core, - "wl%d: %s: ASSERT queue == TX_BCMC!\n", - wlc->pub->unit, __func__); - frameid = bcmc_fid_generate(wlc, NULL, txh); - } else { - /* Increment the counter for first fragment */ - if (tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) - scb->seqnum[p->priority]++; - - /* extract fragment number from frame first */ - seq = le16_to_cpu(h->seq_ctrl) & FRAGNUM_MASK; - seq |= (scb->seqnum[p->priority] << SEQNUM_SHIFT); - h->seq_ctrl = cpu_to_le16(seq); - - frameid = ((seq << TXFID_SEQ_SHIFT) & TXFID_SEQ_MASK) | - (queue & TXFID_QUEUE_MASK); - } - } - frameid |= queue & TXFID_QUEUE_MASK; - - /* set the ignpmq bit for all pkts tx'd in PS mode and for beacons */ - if (ieee80211_is_beacon(h->frame_control)) - mcl |= TXC_IGNOREPMQ; - - txrate[0] = tx_info->control.rates; - txrate[1] = txrate[0] + 1; - - /* - * if rate control algorithm didn't give us a fallback - * rate, use the primary rate - */ - if (txrate[1]->idx < 0) - txrate[1] = txrate[0]; - - for (k = 0; k < hw->max_rates; k++) { - is_mcs = txrate[k]->flags & IEEE80211_TX_RC_MCS ? true : false; - if (!is_mcs) { - if ((txrate[k]->idx >= 0) - && (txrate[k]->idx < - hw->wiphy->bands[tx_info->band]->n_bitrates)) { - rspec[k] = - hw->wiphy->bands[tx_info->band]-> - bitrates[txrate[k]->idx].hw_value; - short_preamble[k] = - txrate[k]-> - flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE ? - true : false; - } else { - rspec[k] = BRCM_RATE_1M; - } - } else { - rspec[k] = mac80211_wlc_set_nrate(wlc, wlc->band, - NRATE_MCS_INUSE | txrate[k]->idx); - } - - /* - * Currently only support same setting for primay and - * fallback rates. Unify flags for each rate into a - * single value for the frame - */ - use_rts |= - txrate[k]-> - flags & IEEE80211_TX_RC_USE_RTS_CTS ? true : false; - use_cts |= - txrate[k]-> - flags & IEEE80211_TX_RC_USE_CTS_PROTECT ? true : false; - - - /* - * (1) RATE: - * determine and validate primary rate - * and fallback rates - */ - if (!rspec_active(rspec[k])) { - rspec[k] = BRCM_RATE_1M; - } else { - if (!is_multicast_ether_addr(h->addr1)) { - /* set tx antenna config */ - brcms_c_antsel_antcfg_get(wlc->asi, false, - false, 0, 0, &antcfg, &fbantcfg); - } - } - } - - phyctl1_stf = wlc->stf->ss_opmode; - - if (wlc->pub->_n_enab & SUPPORT_11N) { - for (k = 0; k < hw->max_rates; k++) { - /* - * apply siso/cdd to single stream mcs's or ofdm - * if rspec is auto selected - */ - if (((is_mcs_rate(rspec[k]) && - is_single_stream(rspec[k] & RSPEC_RATE_MASK)) || - is_ofdm_rate(rspec[k])) - && ((rspec[k] & RSPEC_OVERRIDE_MCS_ONLY) - || !(rspec[k] & RSPEC_OVERRIDE))) { - rspec[k] &= ~(RSPEC_STF_MASK | RSPEC_STC_MASK); - - /* For SISO MCS use STBC if possible */ - if (is_mcs_rate(rspec[k]) - && BRCMS_STF_SS_STBC_TX(wlc, scb)) { - u8 stc; - - /* Nss for single stream is always 1 */ - stc = 1; - rspec[k] |= (PHY_TXC1_MODE_STBC << - RSPEC_STF_SHIFT) | - (stc << RSPEC_STC_SHIFT); - } else - rspec[k] |= - (phyctl1_stf << RSPEC_STF_SHIFT); - } - - /* - * Is the phy configured to use 40MHZ frames? If - * so then pick the desired txbw - */ - if (brcms_chspec_bw(wlc->chanspec) == BRCMS_40_MHZ) { - /* default txbw is 20in40 SB */ - mimo_ctlchbw = mimo_txbw = - CHSPEC_SB_UPPER(wlc_phy_chanspec_get( - wlc->band->pi)) - ? PHY_TXC1_BW_20MHZ_UP : PHY_TXC1_BW_20MHZ; - - if (is_mcs_rate(rspec[k])) { - /* mcs 32 must be 40b/w DUP */ - if ((rspec[k] & RSPEC_RATE_MASK) - == 32) { - mimo_txbw = - PHY_TXC1_BW_40MHZ_DUP; - /* use override */ - } else if (wlc->mimo_40txbw != AUTO) - mimo_txbw = wlc->mimo_40txbw; - /* else check if dst is using 40 Mhz */ - else if (scb->flags & SCB_IS40) - mimo_txbw = PHY_TXC1_BW_40MHZ; - } else if (is_ofdm_rate(rspec[k])) { - if (wlc->ofdm_40txbw != AUTO) - mimo_txbw = wlc->ofdm_40txbw; - } else if (wlc->cck_40txbw != AUTO) { - mimo_txbw = wlc->cck_40txbw; - } - } else { - /* - * mcs32 is 40 b/w only. - * This is possible for probe packets on - * a STA during SCAN - */ - if ((rspec[k] & RSPEC_RATE_MASK) == 32) - /* mcs 0 */ - rspec[k] = RSPEC_MIMORATE; - - mimo_txbw = PHY_TXC1_BW_20MHZ; - } - - /* Set channel width */ - rspec[k] &= ~RSPEC_BW_MASK; - if ((k == 0) || ((k > 0) && is_mcs_rate(rspec[k]))) - rspec[k] |= (mimo_txbw << RSPEC_BW_SHIFT); - else - rspec[k] |= (mimo_ctlchbw << RSPEC_BW_SHIFT); - - /* Disable short GI, not supported yet */ - rspec[k] &= ~RSPEC_SHORT_GI; - - mimo_preamble_type = BRCMS_MM_PREAMBLE; - if (txrate[k]->flags & IEEE80211_TX_RC_GREEN_FIELD) - mimo_preamble_type = BRCMS_GF_PREAMBLE; - - if ((txrate[k]->flags & IEEE80211_TX_RC_MCS) - && (!is_mcs_rate(rspec[k]))) { - brcms_warn(wlc->hw->d11core, - "wl%d: %s: IEEE80211_TX_RC_MCS != is_mcs_rate(rspec)\n", - wlc->pub->unit, __func__); - } - - if (is_mcs_rate(rspec[k])) { - preamble_type[k] = mimo_preamble_type; - - /* - * if SGI is selected, then forced mm - * for single stream - */ - if ((rspec[k] & RSPEC_SHORT_GI) - && is_single_stream(rspec[k] & - RSPEC_RATE_MASK)) - preamble_type[k] = BRCMS_MM_PREAMBLE; - } - - /* should be better conditionalized */ - if (!is_mcs_rate(rspec[0]) - && (tx_info->control.rates[0]. - flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)) - preamble_type[k] = BRCMS_SHORT_PREAMBLE; - } - } else { - for (k = 0; k < hw->max_rates; k++) { - /* Set ctrlchbw as 20Mhz */ - rspec[k] &= ~RSPEC_BW_MASK; - rspec[k] |= (PHY_TXC1_BW_20MHZ << RSPEC_BW_SHIFT); - - /* for nphy, stf of ofdm frames must follow policies */ - if (BRCMS_ISNPHY(wlc->band) && is_ofdm_rate(rspec[k])) { - rspec[k] &= ~RSPEC_STF_MASK; - rspec[k] |= phyctl1_stf << RSPEC_STF_SHIFT; - } - } - } - - /* Reset these for use with AMPDU's */ - txrate[0]->count = 0; - txrate[1]->count = 0; - - /* (2) PROTECTION, may change rspec */ - if ((ieee80211_is_data(h->frame_control) || - ieee80211_is_mgmt(h->frame_control)) && - (phylen > wlc->RTSThresh) && !is_multicast_ether_addr(h->addr1)) - use_rts = true; - - /* (3) PLCP: determine PLCP header and MAC duration, - * fill struct d11txh */ - brcms_c_compute_plcp(wlc, rspec[0], phylen, plcp); - brcms_c_compute_plcp(wlc, rspec[1], phylen, plcp_fallback); - memcpy(&txh->FragPLCPFallback, - plcp_fallback, sizeof(txh->FragPLCPFallback)); - - /* Length field now put in CCK FBR CRC field */ - if (is_cck_rate(rspec[1])) { - txh->FragPLCPFallback[4] = phylen & 0xff; - txh->FragPLCPFallback[5] = (phylen & 0xff00) >> 8; - } - - /* MIMO-RATE: need validation ?? */ - mainrates = is_ofdm_rate(rspec[0]) ? - D11A_PHY_HDR_GRATE((struct ofdm_phy_hdr *) plcp) : - plcp[0]; - - /* DUR field for main rate */ - if (!ieee80211_is_pspoll(h->frame_control) && - !is_multicast_ether_addr(h->addr1) && !use_rifs) { - durid = - brcms_c_compute_frame_dur(wlc, rspec[0], preamble_type[0], - next_frag_len); - h->duration_id = cpu_to_le16(durid); - } else if (use_rifs) { - /* NAV protect to end of next max packet size */ - durid = - (u16) brcms_c_calc_frame_time(wlc, rspec[0], - preamble_type[0], - DOT11_MAX_FRAG_LEN); - durid += RIFS_11N_TIME; - h->duration_id = cpu_to_le16(durid); - } - - /* DUR field for fallback rate */ - if (ieee80211_is_pspoll(h->frame_control)) - txh->FragDurFallback = h->duration_id; - else if (is_multicast_ether_addr(h->addr1) || use_rifs) - txh->FragDurFallback = 0; - else { - durid = brcms_c_compute_frame_dur(wlc, rspec[1], - preamble_type[1], next_frag_len); - txh->FragDurFallback = cpu_to_le16(durid); - } - - /* (4) MAC-HDR: MacTxControlLow */ - if (frag == 0) - mcl |= TXC_STARTMSDU; - - if (!is_multicast_ether_addr(h->addr1)) - mcl |= TXC_IMMEDACK; - - if (wlc->band->bandtype == BRCM_BAND_5G) - mcl |= TXC_FREQBAND_5G; - - if (CHSPEC_IS40(wlc_phy_chanspec_get(wlc->band->pi))) - mcl |= TXC_BW_40; - - /* set AMIC bit if using hardware TKIP MIC */ - if (hwtkmic) - mcl |= TXC_AMIC; - - txh->MacTxControlLow = cpu_to_le16(mcl); - - /* MacTxControlHigh */ - mch = 0; - - /* Set fallback rate preamble type */ - if ((preamble_type[1] == BRCMS_SHORT_PREAMBLE) || - (preamble_type[1] == BRCMS_GF_PREAMBLE)) { - if (rspec2rate(rspec[1]) != BRCM_RATE_1M) - mch |= TXC_PREAMBLE_DATA_FB_SHORT; - } - - /* MacFrameControl */ - memcpy(&txh->MacFrameControl, &h->frame_control, sizeof(u16)); - txh->TxFesTimeNormal = cpu_to_le16(0); - - txh->TxFesTimeFallback = cpu_to_le16(0); - - /* TxFrameRA */ - memcpy(&txh->TxFrameRA, &h->addr1, ETH_ALEN); - - /* TxFrameID */ - txh->TxFrameID = cpu_to_le16(frameid); - - /* - * TxStatus, Note the case of recreating the first frag of a suppressed - * frame then we may need to reset the retry cnt's via the status reg - */ - txh->TxStatus = cpu_to_le16(status); - - /* - * extra fields for ucode AMPDU aggregation, the new fields are added to - * the END of previous structure so that it's compatible in driver. - */ - txh->MaxNMpdus = cpu_to_le16(0); - txh->MaxABytes_MRT = cpu_to_le16(0); - txh->MaxABytes_FBR = cpu_to_le16(0); - txh->MinMBytes = cpu_to_le16(0); - - /* (5) RTS/CTS: determine RTS/CTS PLCP header and MAC duration, - * furnish struct d11txh */ - /* RTS PLCP header and RTS frame */ - if (use_rts || use_cts) { - if (use_rts && use_cts) - use_cts = false; - - for (k = 0; k < 2; k++) { - rts_rspec[k] = brcms_c_rspec_to_rts_rspec(wlc, rspec[k], - false, - mimo_ctlchbw); - } - - if (!is_ofdm_rate(rts_rspec[0]) && - !((rspec2rate(rts_rspec[0]) == BRCM_RATE_1M) || - (wlc->PLCPHdr_override == BRCMS_PLCP_LONG))) { - rts_preamble_type[0] = BRCMS_SHORT_PREAMBLE; - mch |= TXC_PREAMBLE_RTS_MAIN_SHORT; - } - - if (!is_ofdm_rate(rts_rspec[1]) && - !((rspec2rate(rts_rspec[1]) == BRCM_RATE_1M) || - (wlc->PLCPHdr_override == BRCMS_PLCP_LONG))) { - rts_preamble_type[1] = BRCMS_SHORT_PREAMBLE; - mch |= TXC_PREAMBLE_RTS_FB_SHORT; - } - - /* RTS/CTS additions to MacTxControlLow */ - if (use_cts) { - txh->MacTxControlLow |= cpu_to_le16(TXC_SENDCTS); - } else { - txh->MacTxControlLow |= cpu_to_le16(TXC_SENDRTS); - txh->MacTxControlLow |= cpu_to_le16(TXC_LONGFRAME); - } - - /* RTS PLCP header */ - rts_plcp = txh->RTSPhyHeader; - if (use_cts) - rts_phylen = DOT11_CTS_LEN + FCS_LEN; - else - rts_phylen = DOT11_RTS_LEN + FCS_LEN; - - brcms_c_compute_plcp(wlc, rts_rspec[0], rts_phylen, rts_plcp); - - /* fallback rate version of RTS PLCP header */ - brcms_c_compute_plcp(wlc, rts_rspec[1], rts_phylen, - rts_plcp_fallback); - memcpy(&txh->RTSPLCPFallback, rts_plcp_fallback, - sizeof(txh->RTSPLCPFallback)); - - /* RTS frame fields... */ - rts = (struct ieee80211_rts *)&txh->rts_frame; - - durid = brcms_c_compute_rtscts_dur(wlc, use_cts, rts_rspec[0], - rspec[0], rts_preamble_type[0], - preamble_type[0], phylen, false); - rts->duration = cpu_to_le16(durid); - /* fallback rate version of RTS DUR field */ - durid = brcms_c_compute_rtscts_dur(wlc, use_cts, - rts_rspec[1], rspec[1], - rts_preamble_type[1], - preamble_type[1], phylen, false); - txh->RTSDurFallback = cpu_to_le16(durid); - - if (use_cts) { - rts->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | - IEEE80211_STYPE_CTS); - - memcpy(&rts->ra, &h->addr2, ETH_ALEN); - } else { - rts->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | - IEEE80211_STYPE_RTS); - - memcpy(&rts->ra, &h->addr1, 2 * ETH_ALEN); - } - - /* mainrate - * low 8 bits: main frag rate/mcs, - * high 8 bits: rts/cts rate/mcs - */ - mainrates |= (is_ofdm_rate(rts_rspec[0]) ? - D11A_PHY_HDR_GRATE( - (struct ofdm_phy_hdr *) rts_plcp) : - rts_plcp[0]) << 8; - } else { - memset(txh->RTSPhyHeader, 0, D11_PHY_HDR_LEN); - memset(&txh->rts_frame, 0, sizeof(struct ieee80211_rts)); - memset(txh->RTSPLCPFallback, 0, sizeof(txh->RTSPLCPFallback)); - txh->RTSDurFallback = 0; - } - -#ifdef SUPPORT_40MHZ - /* add null delimiter count */ - if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && is_mcs_rate(rspec)) - txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM] = - brcm_c_ampdu_null_delim_cnt(wlc->ampdu, scb, rspec, phylen); - -#endif - - /* - * Now that RTS/RTS FB preamble types are updated, write - * the final value - */ - txh->MacTxControlHigh = cpu_to_le16(mch); - - /* - * MainRates (both the rts and frag plcp rates have - * been calculated now) - */ - txh->MainRates = cpu_to_le16(mainrates); - - /* XtraFrameTypes */ - xfts = frametype(rspec[1], wlc->mimoft); - xfts |= (frametype(rts_rspec[0], wlc->mimoft) << XFTS_RTS_FT_SHIFT); - xfts |= (frametype(rts_rspec[1], wlc->mimoft) << XFTS_FBRRTS_FT_SHIFT); - xfts |= CHSPEC_CHANNEL(wlc_phy_chanspec_get(wlc->band->pi)) << - XFTS_CHANNEL_SHIFT; - txh->XtraFrameTypes = cpu_to_le16(xfts); - - /* PhyTxControlWord */ - phyctl = frametype(rspec[0], wlc->mimoft); - if ((preamble_type[0] == BRCMS_SHORT_PREAMBLE) || - (preamble_type[0] == BRCMS_GF_PREAMBLE)) { - if (rspec2rate(rspec[0]) != BRCM_RATE_1M) - phyctl |= PHY_TXC_SHORT_HDR; - } - - /* phytxant is properly bit shifted */ - phyctl |= brcms_c_stf_d11hdrs_phyctl_txant(wlc, rspec[0]); - txh->PhyTxControlWord = cpu_to_le16(phyctl); - - /* PhyTxControlWord_1 */ - if (BRCMS_PHY_11N_CAP(wlc->band)) { - u16 phyctl1 = 0; - - phyctl1 = brcms_c_phytxctl1_calc(wlc, rspec[0]); - txh->PhyTxControlWord_1 = cpu_to_le16(phyctl1); - phyctl1 = brcms_c_phytxctl1_calc(wlc, rspec[1]); - txh->PhyTxControlWord_1_Fbr = cpu_to_le16(phyctl1); - - if (use_rts || use_cts) { - phyctl1 = brcms_c_phytxctl1_calc(wlc, rts_rspec[0]); - txh->PhyTxControlWord_1_Rts = cpu_to_le16(phyctl1); - phyctl1 = brcms_c_phytxctl1_calc(wlc, rts_rspec[1]); - txh->PhyTxControlWord_1_FbrRts = cpu_to_le16(phyctl1); - } - - /* - * For mcs frames, if mixedmode(overloaded with long preamble) - * is going to be set, fill in non-zero MModeLen and/or - * MModeFbrLen it will be unnecessary if they are separated - */ - if (is_mcs_rate(rspec[0]) && - (preamble_type[0] == BRCMS_MM_PREAMBLE)) { - u16 mmodelen = - brcms_c_calc_lsig_len(wlc, rspec[0], phylen); - txh->MModeLen = cpu_to_le16(mmodelen); - } - - if (is_mcs_rate(rspec[1]) && - (preamble_type[1] == BRCMS_MM_PREAMBLE)) { - u16 mmodefbrlen = - brcms_c_calc_lsig_len(wlc, rspec[1], phylen); - txh->MModeFbrLen = cpu_to_le16(mmodefbrlen); - } - } - - ac = skb_get_queue_mapping(p); - if ((scb->flags & SCB_WMECAP) && qos && wlc->edcf_txop[ac]) { - uint frag_dur, dur, dur_fallback; - - /* WME: Update TXOP threshold */ - if (!(tx_info->flags & IEEE80211_TX_CTL_AMPDU) && frag == 0) { - frag_dur = - brcms_c_calc_frame_time(wlc, rspec[0], - preamble_type[0], phylen); - - if (rts) { - /* 1 RTS or CTS-to-self frame */ - dur = - brcms_c_calc_cts_time(wlc, rts_rspec[0], - rts_preamble_type[0]); - dur_fallback = - brcms_c_calc_cts_time(wlc, rts_rspec[1], - rts_preamble_type[1]); - /* (SIFS + CTS) + SIFS + frame + SIFS + ACK */ - dur += le16_to_cpu(rts->duration); - dur_fallback += - le16_to_cpu(txh->RTSDurFallback); - } else if (use_rifs) { - dur = frag_dur; - dur_fallback = 0; - } else { - /* frame + SIFS + ACK */ - dur = frag_dur; - dur += - brcms_c_compute_frame_dur(wlc, rspec[0], - preamble_type[0], 0); - - dur_fallback = - brcms_c_calc_frame_time(wlc, rspec[1], - preamble_type[1], - phylen); - dur_fallback += - brcms_c_compute_frame_dur(wlc, rspec[1], - preamble_type[1], 0); - } - /* NEED to set TxFesTimeNormal (hard) */ - txh->TxFesTimeNormal = cpu_to_le16((u16) dur); - /* - * NEED to set fallback rate version of - * TxFesTimeNormal (hard) - */ - txh->TxFesTimeFallback = - cpu_to_le16((u16) dur_fallback); - - /* - * update txop byte threshold (txop minus intraframe - * overhead) - */ - if (wlc->edcf_txop[ac] >= (dur - frag_dur)) { - uint newfragthresh; - - newfragthresh = - brcms_c_calc_frame_len(wlc, - rspec[0], preamble_type[0], - (wlc->edcf_txop[ac] - - (dur - frag_dur))); - /* range bound the fragthreshold */ - if (newfragthresh < DOT11_MIN_FRAG_LEN) - newfragthresh = - DOT11_MIN_FRAG_LEN; - else if (newfragthresh > - wlc->usr_fragthresh) - newfragthresh = - wlc->usr_fragthresh; - /* update the fragthresh and do txc update */ - if (wlc->fragthresh[queue] != - (u16) newfragthresh) - wlc->fragthresh[queue] = - (u16) newfragthresh; - } else { - brcms_warn(wlc->hw->d11core, - "wl%d: %s txop invalid for rate %d\n", - wlc->pub->unit, fifo_names[queue], - rspec2rate(rspec[0])); - } - - if (dur > wlc->edcf_txop[ac]) - brcms_warn(wlc->hw->d11core, - "wl%d: %s: %s txop exceeded phylen %d/%d dur %d/%d\n", - wlc->pub->unit, __func__, - fifo_names[queue], - phylen, wlc->fragthresh[queue], - dur, wlc->edcf_txop[ac]); - } - } - - return 0; -} - -static int brcms_c_tx(struct brcms_c_info *wlc, struct sk_buff *skb) -{ - struct dma_pub *dma; - int fifo, ret = -ENOSPC; - struct d11txh *txh; - u16 frameid = INVALIDFID; - - fifo = brcms_ac_to_fifo(skb_get_queue_mapping(skb)); - dma = wlc->hw->di[fifo]; - txh = (struct d11txh *)(skb->data); - - if (dma->txavail == 0) { - /* - * We sometimes get a frame from mac80211 after stopping - * the queues. This only ever seems to be a single frame - * and is seems likely to be a race. TX_HEADROOM should - * ensure that we have enough space to handle these stray - * packets, so warn if there isn't. If we're out of space - * in the tx ring and the tx queue isn't stopped then - * we've really got a bug; warn loudly if that happens. - */ - brcms_warn(wlc->hw->d11core, - "Received frame for tx with no space in DMA ring\n"); - WARN_ON(!ieee80211_queue_stopped(wlc->pub->ieee_hw, - skb_get_queue_mapping(skb))); - return -ENOSPC; - } - - /* When a BC/MC frame is being committed to the BCMC fifo - * via DMA (NOT PIO), update ucode or BSS info as appropriate. - */ - if (fifo == TX_BCMC_FIFO) - frameid = le16_to_cpu(txh->TxFrameID); - - /* Commit BCMC sequence number in the SHM frame ID location */ - if (frameid != INVALIDFID) { - /* - * To inform the ucode of the last mcast frame posted - * so that it can clear moredata bit - */ - brcms_b_write_shm(wlc->hw, M_BCMC_FID, frameid); - } - - ret = brcms_c_txfifo(wlc, fifo, skb); - /* - * The only reason for brcms_c_txfifo to fail is because - * there weren't any DMA descriptors, but we've already - * checked for that. So if it does fail yell loudly. - */ - WARN_ON_ONCE(ret); - - return ret; -} - -bool brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, struct sk_buff *sdu, - struct ieee80211_hw *hw) -{ - uint fifo; - struct scb *scb = &wlc->pri_scb; - - fifo = brcms_ac_to_fifo(skb_get_queue_mapping(sdu)); - brcms_c_d11hdrs_mac80211(wlc, hw, sdu, scb, 0, 1, fifo, 0); - if (!brcms_c_tx(wlc, sdu)) - return true; - - /* packet discarded */ - dev_kfree_skb_any(sdu); - return false; -} - -int -brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, struct sk_buff *p) -{ - struct dma_pub *dma = wlc->hw->di[fifo]; - int ret; - u16 queue; - - ret = dma_txfast(wlc, dma, p); - if (ret < 0) - wiphy_err(wlc->wiphy, "txfifo: fatal, toss frames !!!\n"); - - /* - * Stop queue if DMA ring is full. Reserve some free descriptors, - * as we sometimes receive a frame from mac80211 after the queues - * are stopped. - */ - queue = skb_get_queue_mapping(p); - if (dma->txavail <= TX_HEADROOM && fifo < TX_BCMC_FIFO && - !ieee80211_queue_stopped(wlc->pub->ieee_hw, queue)) - ieee80211_stop_queue(wlc->pub->ieee_hw, queue); - - return ret; -} - -u32 -brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, u32 rspec, - bool use_rspec, u16 mimo_ctlchbw) -{ - u32 rts_rspec = 0; - - if (use_rspec) - /* use frame rate as rts rate */ - rts_rspec = rspec; - else if (wlc->band->gmode && wlc->protection->_g && !is_cck_rate(rspec)) - /* Use 11Mbps as the g protection RTS target rate and fallback. - * Use the brcms_basic_rate() lookup to find the best basic rate - * under the target in case 11 Mbps is not Basic. - * 6 and 9 Mbps are not usually selected by rate selection, but - * even if the OFDM rate we are protecting is 6 or 9 Mbps, 11 - * is more robust. - */ - rts_rspec = brcms_basic_rate(wlc, BRCM_RATE_11M); - else - /* calculate RTS rate and fallback rate based on the frame rate - * RTS must be sent at a basic rate since it is a - * control frame, sec 9.6 of 802.11 spec - */ - rts_rspec = brcms_basic_rate(wlc, rspec); - - if (BRCMS_PHY_11N_CAP(wlc->band)) { - /* set rts txbw to correct side band */ - rts_rspec &= ~RSPEC_BW_MASK; - - /* - * if rspec/rspec_fallback is 40MHz, then send RTS on both - * 20MHz channel (DUP), otherwise send RTS on control channel - */ - if (rspec_is40mhz(rspec) && !is_cck_rate(rts_rspec)) - rts_rspec |= (PHY_TXC1_BW_40MHZ_DUP << RSPEC_BW_SHIFT); - else - rts_rspec |= (mimo_ctlchbw << RSPEC_BW_SHIFT); - - /* pick siso/cdd as default for ofdm */ - if (is_ofdm_rate(rts_rspec)) { - rts_rspec &= ~RSPEC_STF_MASK; - rts_rspec |= (wlc->stf->ss_opmode << RSPEC_STF_SHIFT); - } - } - return rts_rspec; -} - -/* Update beacon listen interval in shared memory */ -static void brcms_c_bcn_li_upd(struct brcms_c_info *wlc) -{ - /* wake up every DTIM is the default */ - if (wlc->bcn_li_dtim == 1) - brcms_b_write_shm(wlc->hw, M_BCN_LI, 0); - else - brcms_b_write_shm(wlc->hw, M_BCN_LI, - (wlc->bcn_li_dtim << 8) | wlc->bcn_li_bcn); -} - -static void -brcms_b_read_tsf(struct brcms_hardware *wlc_hw, u32 *tsf_l_ptr, - u32 *tsf_h_ptr) -{ - struct bcma_device *core = wlc_hw->d11core; - - /* read the tsf timer low, then high to get an atomic read */ - *tsf_l_ptr = bcma_read32(core, D11REGOFFS(tsf_timerlow)); - *tsf_h_ptr = bcma_read32(core, D11REGOFFS(tsf_timerhigh)); -} - -/* - * recover 64bit TSF value from the 16bit TSF value in the rx header - * given the assumption that the TSF passed in header is within 65ms - * of the current tsf. - * - * 6 5 4 4 3 2 1 - * 3.......6.......8.......0.......2.......4.......6.......8......0 - * |<---------- tsf_h ----------->||<--- tsf_l -->||<-RxTSFTime ->| - * - * The RxTSFTime are the lowest 16 bits and provided by the ucode. The - * tsf_l is filled in by brcms_b_recv, which is done earlier in the - * receive call sequence after rx interrupt. Only the higher 16 bits - * are used. Finally, the tsf_h is read from the tsf register. - */ -static u64 brcms_c_recover_tsf64(struct brcms_c_info *wlc, - struct d11rxhdr *rxh) -{ - u32 tsf_h, tsf_l; - u16 rx_tsf_0_15, rx_tsf_16_31; - - brcms_b_read_tsf(wlc->hw, &tsf_l, &tsf_h); - - rx_tsf_16_31 = (u16)(tsf_l >> 16); - rx_tsf_0_15 = rxh->RxTSFTime; - - /* - * a greater tsf time indicates the low 16 bits of - * tsf_l wrapped, so decrement the high 16 bits. - */ - if ((u16)tsf_l < rx_tsf_0_15) { - rx_tsf_16_31 -= 1; - if (rx_tsf_16_31 == 0xffff) - tsf_h -= 1; - } - - return ((u64)tsf_h << 32) | (((u32)rx_tsf_16_31 << 16) + rx_tsf_0_15); -} - -static void -prep_mac80211_status(struct brcms_c_info *wlc, struct d11rxhdr *rxh, - struct sk_buff *p, - struct ieee80211_rx_status *rx_status) -{ - int preamble; - int channel; - u32 rspec; - unsigned char *plcp; - - /* fill in TSF and flag its presence */ - rx_status->mactime = brcms_c_recover_tsf64(wlc, rxh); - rx_status->flag |= RX_FLAG_MACTIME_START; - - channel = BRCMS_CHAN_CHANNEL(rxh->RxChan); - - rx_status->band = - channel > 14 ? IEEE80211_BAND_5GHZ : IEEE80211_BAND_2GHZ; - rx_status->freq = - ieee80211_channel_to_frequency(channel, rx_status->band); - - rx_status->signal = wlc_phy_rssi_compute(wlc->hw->band->pi, rxh); - - /* noise */ - /* qual */ - rx_status->antenna = - (rxh->PhyRxStatus_0 & PRXS0_RXANT_UPSUBBAND) ? 1 : 0; - - plcp = p->data; - - rspec = brcms_c_compute_rspec(rxh, plcp); - if (is_mcs_rate(rspec)) { - rx_status->rate_idx = rspec & RSPEC_RATE_MASK; - rx_status->flag |= RX_FLAG_HT; - if (rspec_is40mhz(rspec)) - rx_status->flag |= RX_FLAG_40MHZ; - } else { - switch (rspec2rate(rspec)) { - case BRCM_RATE_1M: - rx_status->rate_idx = 0; - break; - case BRCM_RATE_2M: - rx_status->rate_idx = 1; - break; - case BRCM_RATE_5M5: - rx_status->rate_idx = 2; - break; - case BRCM_RATE_11M: - rx_status->rate_idx = 3; - break; - case BRCM_RATE_6M: - rx_status->rate_idx = 4; - break; - case BRCM_RATE_9M: - rx_status->rate_idx = 5; - break; - case BRCM_RATE_12M: - rx_status->rate_idx = 6; - break; - case BRCM_RATE_18M: - rx_status->rate_idx = 7; - break; - case BRCM_RATE_24M: - rx_status->rate_idx = 8; - break; - case BRCM_RATE_36M: - rx_status->rate_idx = 9; - break; - case BRCM_RATE_48M: - rx_status->rate_idx = 10; - break; - case BRCM_RATE_54M: - rx_status->rate_idx = 11; - break; - default: - brcms_err(wlc->hw->d11core, - "%s: Unknown rate\n", __func__); - } - - /* - * For 5GHz, we should decrease the index as it is - * a subset of the 2.4G rates. See bitrates field - * of brcms_band_5GHz_nphy (in mac80211_if.c). - */ - if (rx_status->band == IEEE80211_BAND_5GHZ) - rx_status->rate_idx -= BRCMS_LEGACY_5G_RATE_OFFSET; - - /* Determine short preamble and rate_idx */ - preamble = 0; - if (is_cck_rate(rspec)) { - if (rxh->PhyRxStatus_0 & PRXS0_SHORTH) - rx_status->flag |= RX_FLAG_SHORTPRE; - } else if (is_ofdm_rate(rspec)) { - rx_status->flag |= RX_FLAG_SHORTPRE; - } else { - brcms_err(wlc->hw->d11core, "%s: Unknown modulation\n", - __func__); - } - } - - if (plcp3_issgi(plcp[3])) - rx_status->flag |= RX_FLAG_SHORT_GI; - - if (rxh->RxStatus1 & RXS_DECERR) { - rx_status->flag |= RX_FLAG_FAILED_PLCP_CRC; - brcms_err(wlc->hw->d11core, "%s: RX_FLAG_FAILED_PLCP_CRC\n", - __func__); - } - if (rxh->RxStatus1 & RXS_FCSERR) { - rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; - brcms_err(wlc->hw->d11core, "%s: RX_FLAG_FAILED_FCS_CRC\n", - __func__); - } -} - -static void -brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh, - struct sk_buff *p) -{ - int len_mpdu; - struct ieee80211_rx_status rx_status; - struct ieee80211_hdr *hdr; - - memset(&rx_status, 0, sizeof(rx_status)); - prep_mac80211_status(wlc, rxh, p, &rx_status); - - /* mac header+body length, exclude CRC and plcp header */ - len_mpdu = p->len - D11_PHY_HDR_LEN - FCS_LEN; - skb_pull(p, D11_PHY_HDR_LEN); - __skb_trim(p, len_mpdu); - - /* unmute transmit */ - if (wlc->hw->suspended_fifos) { - hdr = (struct ieee80211_hdr *)p->data; - if (ieee80211_is_beacon(hdr->frame_control)) - brcms_b_mute(wlc->hw, false); - } - - memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status)); - ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p); -} - -/* calculate frame duration for Mixed-mode L-SIG spoofing, return - * number of bytes goes in the length field - * - * Formula given by HT PHY Spec v 1.13 - * len = 3(nsyms + nstream + 3) - 3 - */ -u16 -brcms_c_calc_lsig_len(struct brcms_c_info *wlc, u32 ratespec, - uint mac_len) -{ - uint nsyms, len = 0, kNdps; - - if (is_mcs_rate(ratespec)) { - uint mcs = ratespec & RSPEC_RATE_MASK; - int tot_streams = (mcs_2_txstreams(mcs) + 1) + - rspec_stc(ratespec); - - /* - * the payload duration calculation matches that - * of regular ofdm - */ - /* 1000Ndbps = kbps * 4 */ - kNdps = mcs_2_rate(mcs, rspec_is40mhz(ratespec), - rspec_issgi(ratespec)) * 4; - - if (rspec_stc(ratespec) == 0) - nsyms = - CEIL((APHY_SERVICE_NBITS + 8 * mac_len + - APHY_TAIL_NBITS) * 1000, kNdps); - else - /* STBC needs to have even number of symbols */ - nsyms = - 2 * - CEIL((APHY_SERVICE_NBITS + 8 * mac_len + - APHY_TAIL_NBITS) * 1000, 2 * kNdps); - - /* (+3) account for HT-SIG(2) and HT-STF(1) */ - nsyms += (tot_streams + 3); - /* - * 3 bytes/symbol @ legacy 6Mbps rate - * (-3) excluding service bits and tail bits - */ - len = (3 * nsyms) - 3; - } - - return (u16) len; -} - -static void -brcms_c_mod_prb_rsp_rate_table(struct brcms_c_info *wlc, uint frame_len) -{ - const struct brcms_c_rateset *rs_dflt; - struct brcms_c_rateset rs; - u8 rate; - u16 entry_ptr; - u8 plcp[D11_PHY_HDR_LEN]; - u16 dur, sifs; - uint i; - - sifs = get_sifs(wlc->band); - - rs_dflt = brcms_c_rateset_get_hwrs(wlc); - - brcms_c_rateset_copy(rs_dflt, &rs); - brcms_c_rateset_mcs_upd(&rs, wlc->stf->txstreams); - - /* - * walk the phy rate table and update MAC core SHM - * basic rate table entries - */ - for (i = 0; i < rs.count; i++) { - rate = rs.rates[i] & BRCMS_RATE_MASK; - - entry_ptr = brcms_b_rate_shm_offset(wlc->hw, rate); - - /* Calculate the Probe Response PLCP for the given rate */ - brcms_c_compute_plcp(wlc, rate, frame_len, plcp); - - /* - * Calculate the duration of the Probe Response - * frame plus SIFS for the MAC - */ - dur = (u16) brcms_c_calc_frame_time(wlc, rate, - BRCMS_LONG_PREAMBLE, frame_len); - dur += sifs; - - /* Update the SHM Rate Table entry Probe Response values */ - brcms_b_write_shm(wlc->hw, entry_ptr + M_RT_PRS_PLCP_POS, - (u16) (plcp[0] + (plcp[1] << 8))); - brcms_b_write_shm(wlc->hw, entry_ptr + M_RT_PRS_PLCP_POS + 2, - (u16) (plcp[2] + (plcp[3] << 8))); - brcms_b_write_shm(wlc->hw, entry_ptr + M_RT_PRS_DUR_POS, dur); - } -} - -int brcms_c_get_header_len(void) -{ - return TXOFF; -} - -static void brcms_c_beacon_write(struct brcms_c_info *wlc, - struct sk_buff *beacon, u16 tim_offset, - u16 dtim_period, bool bcn0, bool bcn1) -{ - size_t len; - struct ieee80211_tx_info *tx_info; - struct brcms_hardware *wlc_hw = wlc->hw; - struct ieee80211_hw *ieee_hw = brcms_c_pub(wlc)->ieee_hw; - - /* Get tx_info */ - tx_info = IEEE80211_SKB_CB(beacon); - - len = min_t(size_t, beacon->len, BCN_TMPL_LEN); - wlc->bcn_rspec = ieee80211_get_tx_rate(ieee_hw, tx_info)->hw_value; - - brcms_c_compute_plcp(wlc, wlc->bcn_rspec, - len + FCS_LEN - D11_PHY_HDR_LEN, beacon->data); - - /* "Regular" and 16 MBSS but not for 4 MBSS */ - /* Update the phytxctl for the beacon based on the rspec */ - brcms_c_beacon_phytxctl_txant_upd(wlc, wlc->bcn_rspec); - - if (bcn0) { - /* write the probe response into the template region */ - brcms_b_write_template_ram(wlc_hw, T_BCN0_TPL_BASE, - (len + 3) & ~3, beacon->data); - - /* write beacon length to SCR */ - brcms_b_write_shm(wlc_hw, M_BCN0_FRM_BYTESZ, (u16) len); - } - if (bcn1) { - /* write the probe response into the template region */ - brcms_b_write_template_ram(wlc_hw, T_BCN1_TPL_BASE, - (len + 3) & ~3, beacon->data); - - /* write beacon length to SCR */ - brcms_b_write_shm(wlc_hw, M_BCN1_FRM_BYTESZ, (u16) len); - } - - if (tim_offset != 0) { - brcms_b_write_shm(wlc_hw, M_TIMBPOS_INBEACON, - tim_offset + D11B_PHY_HDR_LEN); - brcms_b_write_shm(wlc_hw, M_DOT11_DTIMPERIOD, dtim_period); - } else { - brcms_b_write_shm(wlc_hw, M_TIMBPOS_INBEACON, - len + D11B_PHY_HDR_LEN); - brcms_b_write_shm(wlc_hw, M_DOT11_DTIMPERIOD, 0); - } -} - -static void brcms_c_update_beacon_hw(struct brcms_c_info *wlc, - struct sk_buff *beacon, u16 tim_offset, - u16 dtim_period) -{ - struct brcms_hardware *wlc_hw = wlc->hw; - struct bcma_device *core = wlc_hw->d11core; - - /* Hardware beaconing for this config */ - u32 both_valid = MCMD_BCN0VLD | MCMD_BCN1VLD; - - /* Check if both templates are in use, if so sched. an interrupt - * that will call back into this routine - */ - if ((bcma_read32(core, D11REGOFFS(maccommand)) & both_valid) == both_valid) - /* clear any previous status */ - bcma_write32(core, D11REGOFFS(macintstatus), MI_BCNTPL); - - if (wlc->beacon_template_virgin) { - wlc->beacon_template_virgin = false; - brcms_c_beacon_write(wlc, beacon, tim_offset, dtim_period, true, - true); - /* mark beacon0 valid */ - bcma_set32(core, D11REGOFFS(maccommand), MCMD_BCN0VLD); - return; - } - - /* Check that after scheduling the interrupt both of the - * templates are still busy. if not clear the int. & remask - */ - if ((bcma_read32(core, D11REGOFFS(maccommand)) & both_valid) == both_valid) { - wlc->defmacintmask |= MI_BCNTPL; - return; - } - - if (!(bcma_read32(core, D11REGOFFS(maccommand)) & MCMD_BCN0VLD)) { - brcms_c_beacon_write(wlc, beacon, tim_offset, dtim_period, true, - false); - /* mark beacon0 valid */ - bcma_set32(core, D11REGOFFS(maccommand), MCMD_BCN0VLD); - return; - } - if (!(bcma_read32(core, D11REGOFFS(maccommand)) & MCMD_BCN1VLD)) { - brcms_c_beacon_write(wlc, beacon, tim_offset, dtim_period, - false, true); - /* mark beacon0 valid */ - bcma_set32(core, D11REGOFFS(maccommand), MCMD_BCN1VLD); - return; - } - return; -} - -/* - * Update all beacons for the system. - */ -void brcms_c_update_beacon(struct brcms_c_info *wlc) -{ - struct brcms_bss_cfg *bsscfg = wlc->bsscfg; - - if (wlc->pub->up && (bsscfg->type == BRCMS_TYPE_AP || - bsscfg->type == BRCMS_TYPE_ADHOC)) { - /* Clear the soft intmask */ - wlc->defmacintmask &= ~MI_BCNTPL; - if (!wlc->beacon) - return; - brcms_c_update_beacon_hw(wlc, wlc->beacon, - wlc->beacon_tim_offset, - wlc->beacon_dtim_period); - } -} - -void brcms_c_set_new_beacon(struct brcms_c_info *wlc, struct sk_buff *beacon, - u16 tim_offset, u16 dtim_period) -{ - if (!beacon) - return; - if (wlc->beacon) - dev_kfree_skb_any(wlc->beacon); - wlc->beacon = beacon; - - /* add PLCP */ - skb_push(wlc->beacon, D11_PHY_HDR_LEN); - wlc->beacon_tim_offset = tim_offset; - wlc->beacon_dtim_period = dtim_period; - brcms_c_update_beacon(wlc); -} - -void brcms_c_set_new_probe_resp(struct brcms_c_info *wlc, - struct sk_buff *probe_resp) -{ - if (!probe_resp) - return; - if (wlc->probe_resp) - dev_kfree_skb_any(wlc->probe_resp); - wlc->probe_resp = probe_resp; - - /* add PLCP */ - skb_push(wlc->probe_resp, D11_PHY_HDR_LEN); - brcms_c_update_probe_resp(wlc, false); -} - -void brcms_c_enable_probe_resp(struct brcms_c_info *wlc, bool enable) -{ - /* - * prevent ucode from sending probe responses by setting the timeout - * to 1, it can not send it in that time frame. - */ - wlc->prb_resp_timeout = enable ? BRCMS_PRB_RESP_TIMEOUT : 1; - brcms_b_write_shm(wlc->hw, M_PRS_MAXTIME, wlc->prb_resp_timeout); - /* TODO: if (enable) => also deactivate receiving of probe request */ -} - -/* Write ssid into shared memory */ -static void -brcms_c_shm_ssid_upd(struct brcms_c_info *wlc, struct brcms_bss_cfg *cfg) -{ - u8 *ssidptr = cfg->SSID; - u16 base = M_SSID; - u8 ssidbuf[IEEE80211_MAX_SSID_LEN]; - - /* padding the ssid with zero and copy it into shm */ - memset(ssidbuf, 0, IEEE80211_MAX_SSID_LEN); - memcpy(ssidbuf, ssidptr, cfg->SSID_len); - - brcms_c_copyto_shm(wlc, base, ssidbuf, IEEE80211_MAX_SSID_LEN); - brcms_b_write_shm(wlc->hw, M_SSIDLEN, (u16) cfg->SSID_len); -} - -static void -brcms_c_bss_update_probe_resp(struct brcms_c_info *wlc, - struct brcms_bss_cfg *cfg, - struct sk_buff *probe_resp, - bool suspend) -{ - int len; - - len = min_t(size_t, probe_resp->len, BCN_TMPL_LEN); - - if (suspend) - brcms_c_suspend_mac_and_wait(wlc); - - /* write the probe response into the template region */ - brcms_b_write_template_ram(wlc->hw, T_PRS_TPL_BASE, - (len + 3) & ~3, probe_resp->data); - - /* write the length of the probe response frame (+PLCP/-FCS) */ - brcms_b_write_shm(wlc->hw, M_PRB_RESP_FRM_LEN, (u16) len); - - /* write the SSID and SSID length */ - brcms_c_shm_ssid_upd(wlc, cfg); - - /* - * Write PLCP headers and durations for probe response frames - * at all rates. Use the actual frame length covered by the - * PLCP header for the call to brcms_c_mod_prb_rsp_rate_table() - * by subtracting the PLCP len and adding the FCS. - */ - brcms_c_mod_prb_rsp_rate_table(wlc, - (u16)len + FCS_LEN - D11_PHY_HDR_LEN); - - if (suspend) - brcms_c_enable_mac(wlc); -} - -void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend) -{ - struct brcms_bss_cfg *bsscfg = wlc->bsscfg; - - /* update AP or IBSS probe responses */ - if (wlc->pub->up && (bsscfg->type == BRCMS_TYPE_AP || - bsscfg->type == BRCMS_TYPE_ADHOC)) { - if (!wlc->probe_resp) - return; - brcms_c_bss_update_probe_resp(wlc, bsscfg, wlc->probe_resp, - suspend); - } -} - -int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, - uint *blocks) -{ - if (fifo >= NFIFO) - return -EINVAL; - - *blocks = wlc_hw->xmtfifo_sz[fifo]; - - return 0; -} - -void -brcms_c_set_addrmatch(struct brcms_c_info *wlc, int match_reg_offset, - const u8 *addr) -{ - brcms_b_set_addrmatch(wlc->hw, match_reg_offset, addr); - if (match_reg_offset == RCM_BSSID_OFFSET) - memcpy(wlc->bsscfg->BSSID, addr, ETH_ALEN); -} - -/* - * Flag 'scan in progress' to withhold dynamic phy calibration - */ -void brcms_c_scan_start(struct brcms_c_info *wlc) -{ - wlc_phy_hold_upd(wlc->band->pi, PHY_HOLD_FOR_SCAN, true); -} - -void brcms_c_scan_stop(struct brcms_c_info *wlc) -{ - wlc_phy_hold_upd(wlc->band->pi, PHY_HOLD_FOR_SCAN, false); -} - -void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state) -{ - wlc->pub->associated = state; -} - -/* - * When a remote STA/AP is removed by Mac80211, or when it can no longer accept - * AMPDU traffic, packets pending in hardware have to be invalidated so that - * when later on hardware releases them, they can be handled appropriately. - */ -void brcms_c_inval_dma_pkts(struct brcms_hardware *hw, - struct ieee80211_sta *sta, - void (*dma_callback_fn)) -{ - struct dma_pub *dmah; - int i; - for (i = 0; i < NFIFO; i++) { - dmah = hw->di[i]; - if (dmah != NULL) - dma_walk_packets(dmah, dma_callback_fn, sta); - } -} - -int brcms_c_get_curband(struct brcms_c_info *wlc) -{ - return wlc->band->bandunit; -} - -bool brcms_c_tx_flush_completed(struct brcms_c_info *wlc) -{ - int i; - - /* Kick DMA to send any pending AMPDU */ - for (i = 0; i < ARRAY_SIZE(wlc->hw->di); i++) - if (wlc->hw->di[i]) - dma_kick_tx(wlc->hw->di[i]); - - return !brcms_txpktpendtot(wlc); -} - -void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval) -{ - wlc->bcn_li_bcn = interval; - if (wlc->pub->up) - brcms_c_bcn_li_upd(wlc); -} - -u64 brcms_c_tsf_get(struct brcms_c_info *wlc) -{ - u32 tsf_h, tsf_l; - u64 tsf; - - brcms_b_read_tsf(wlc->hw, &tsf_l, &tsf_h); - - tsf = tsf_h; - tsf <<= 32; - tsf |= tsf_l; - - return tsf; -} - -void brcms_c_tsf_set(struct brcms_c_info *wlc, u64 tsf) -{ - u32 tsf_h, tsf_l; - - brcms_c_time_lock(wlc); - - tsf_l = tsf; - tsf_h = (tsf >> 32); - - /* read the tsf timer low, then high to get an atomic read */ - bcma_write32(wlc->hw->d11core, D11REGOFFS(tsf_timerlow), tsf_l); - bcma_write32(wlc->hw->d11core, D11REGOFFS(tsf_timerhigh), tsf_h); - - brcms_c_time_unlock(wlc); -} - -int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr) -{ - uint qdbm; - - /* Remove override bit and clip to max qdbm value */ - qdbm = min_t(uint, txpwr * BRCMS_TXPWR_DB_FACTOR, 0xff); - return wlc_phy_txpower_set(wlc->band->pi, qdbm, false); -} - -int brcms_c_get_tx_power(struct brcms_c_info *wlc) -{ - uint qdbm; - bool override; - - wlc_phy_txpower_get(wlc->band->pi, &qdbm, &override); - - /* Return qdbm units */ - return (int)(qdbm / BRCMS_TXPWR_DB_FACTOR); -} - -/* Process received frames */ -/* - * Return true if more frames need to be processed. false otherwise. - * Param 'bound' indicates max. # frames to process before break out. - */ -static void brcms_c_recv(struct brcms_c_info *wlc, struct sk_buff *p) -{ - struct d11rxhdr *rxh; - struct ieee80211_hdr *h; - uint len; - bool is_amsdu; - - /* frame starts with rxhdr */ - rxh = (struct d11rxhdr *) (p->data); - - /* strip off rxhdr */ - skb_pull(p, BRCMS_HWRXOFF); - - /* MAC inserts 2 pad bytes for a4 headers or QoS or A-MSDU subframes */ - if (rxh->RxStatus1 & RXS_PBPRES) { - if (p->len < 2) { - brcms_err(wlc->hw->d11core, - "wl%d: recv: rcvd runt of len %d\n", - wlc->pub->unit, p->len); - goto toss; - } - skb_pull(p, 2); - } - - h = (struct ieee80211_hdr *)(p->data + D11_PHY_HDR_LEN); - len = p->len; - - if (rxh->RxStatus1 & RXS_FCSERR) { - if (!(wlc->filter_flags & FIF_FCSFAIL)) - goto toss; - } - - /* check received pkt has at least frame control field */ - if (len < D11_PHY_HDR_LEN + sizeof(h->frame_control)) - goto toss; - - /* not supporting A-MSDU */ - is_amsdu = rxh->RxStatus2 & RXS_AMSDU_MASK; - if (is_amsdu) - goto toss; - - brcms_c_recvctl(wlc, rxh, p); - return; - - toss: - brcmu_pkt_buf_free_skb(p); -} - -/* Process received frames */ -/* - * Return true if more frames need to be processed. false otherwise. - * Param 'bound' indicates max. # frames to process before break out. - */ -static bool -brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound) -{ - struct sk_buff *p; - struct sk_buff *next = NULL; - struct sk_buff_head recv_frames; - - uint n = 0; - uint bound_limit = bound ? RXBND : -1; - bool morepending = false; - - skb_queue_head_init(&recv_frames); - - /* gather received frames */ - do { - /* !give others some time to run! */ - if (n >= bound_limit) - break; - - morepending = dma_rx(wlc_hw->di[fifo], &recv_frames); - n++; - } while (morepending); - - /* post more rbufs */ - dma_rxfill(wlc_hw->di[fifo]); - - /* process each frame */ - skb_queue_walk_safe(&recv_frames, p, next) { - struct d11rxhdr_le *rxh_le; - struct d11rxhdr *rxh; - - skb_unlink(p, &recv_frames); - rxh_le = (struct d11rxhdr_le *)p->data; - rxh = (struct d11rxhdr *)p->data; - - /* fixup rx header endianness */ - rxh->RxFrameSize = le16_to_cpu(rxh_le->RxFrameSize); - rxh->PhyRxStatus_0 = le16_to_cpu(rxh_le->PhyRxStatus_0); - rxh->PhyRxStatus_1 = le16_to_cpu(rxh_le->PhyRxStatus_1); - rxh->PhyRxStatus_2 = le16_to_cpu(rxh_le->PhyRxStatus_2); - rxh->PhyRxStatus_3 = le16_to_cpu(rxh_le->PhyRxStatus_3); - rxh->PhyRxStatus_4 = le16_to_cpu(rxh_le->PhyRxStatus_4); - rxh->PhyRxStatus_5 = le16_to_cpu(rxh_le->PhyRxStatus_5); - rxh->RxStatus1 = le16_to_cpu(rxh_le->RxStatus1); - rxh->RxStatus2 = le16_to_cpu(rxh_le->RxStatus2); - rxh->RxTSFTime = le16_to_cpu(rxh_le->RxTSFTime); - rxh->RxChan = le16_to_cpu(rxh_le->RxChan); - - brcms_c_recv(wlc_hw->wlc, p); - } - - return morepending; -} - -/* second-level interrupt processing - * Return true if another dpc needs to be re-scheduled. false otherwise. - * Param 'bounded' indicates if applicable loops should be bounded. - */ -bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded) -{ - u32 macintstatus; - struct brcms_hardware *wlc_hw = wlc->hw; - struct bcma_device *core = wlc_hw->d11core; - - if (brcms_deviceremoved(wlc)) { - brcms_err(core, "wl%d: %s: dead chip\n", wlc_hw->unit, - __func__); - brcms_down(wlc->wl); - return false; - } - - /* grab and clear the saved software intstatus bits */ - macintstatus = wlc->macintstatus; - wlc->macintstatus = 0; - - brcms_dbg_int(core, "wl%d: macintstatus 0x%x\n", - wlc_hw->unit, macintstatus); - - WARN_ON(macintstatus & MI_PRQ); /* PRQ Interrupt in non-MBSS */ - - /* tx status */ - if (macintstatus & MI_TFS) { - bool fatal; - if (brcms_b_txstatus(wlc->hw, bounded, &fatal)) - wlc->macintstatus |= MI_TFS; - if (fatal) { - brcms_err(core, "MI_TFS: fatal\n"); - goto fatal; - } - } - - if (macintstatus & (MI_TBTT | MI_DTIM_TBTT)) - brcms_c_tbtt(wlc); - - /* ATIM window end */ - if (macintstatus & MI_ATIMWINEND) { - brcms_dbg_info(core, "end of ATIM window\n"); - bcma_set32(core, D11REGOFFS(maccommand), wlc->qvalid); - wlc->qvalid = 0; - } - - /* - * received data or control frame, MI_DMAINT is - * indication of RX_FIFO interrupt - */ - if (macintstatus & MI_DMAINT) - if (brcms_b_recv(wlc_hw, RX_FIFO, bounded)) - wlc->macintstatus |= MI_DMAINT; - - /* noise sample collected */ - if (macintstatus & MI_BG_NOISE) - wlc_phy_noise_sample_intr(wlc_hw->band->pi); - - if (macintstatus & MI_GP0) { - brcms_err(core, "wl%d: PSM microcode watchdog fired at %d " - "(seconds). Resetting.\n", wlc_hw->unit, wlc_hw->now); - - printk_once("%s : PSM Watchdog, chipid 0x%x, chiprev 0x%x\n", - __func__, ai_get_chip_id(wlc_hw->sih), - ai_get_chiprev(wlc_hw->sih)); - brcms_fatal_error(wlc_hw->wlc->wl); - } - - /* gptimer timeout */ - if (macintstatus & MI_TO) - bcma_write32(core, D11REGOFFS(gptimer), 0); - - if (macintstatus & MI_RFDISABLE) { - brcms_dbg_info(core, "wl%d: BMAC Detected a change on the" - " RF Disable Input\n", wlc_hw->unit); - brcms_rfkill_set_hw_state(wlc->wl); - } - - /* BCN template is available */ - if (macintstatus & MI_BCNTPL) - brcms_c_update_beacon(wlc); - - /* it isn't done and needs to be resched if macintstatus is non-zero */ - return wlc->macintstatus != 0; - - fatal: - brcms_fatal_error(wlc_hw->wlc->wl); - return wlc->macintstatus != 0; -} - -void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx) -{ - struct bcma_device *core = wlc->hw->d11core; - struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.chandef.chan; - u16 chanspec; - - brcms_dbg_info(core, "wl%d\n", wlc->pub->unit); - - chanspec = ch20mhz_chspec(ch->hw_value); - - brcms_b_init(wlc->hw, chanspec); - - /* update beacon listen interval */ - brcms_c_bcn_li_upd(wlc); - - /* write ethernet address to core */ - brcms_c_set_mac(wlc->bsscfg); - brcms_c_set_bssid(wlc->bsscfg); - - /* Update tsf_cfprep if associated and up */ - if (wlc->pub->associated && wlc->pub->up) { - u32 bi; - - /* get beacon period and convert to uS */ - bi = wlc->bsscfg->current_bss->beacon_period << 10; - /* - * update since init path would reset - * to default value - */ - bcma_write32(core, D11REGOFFS(tsf_cfprep), - bi << CFPREP_CBI_SHIFT); - - /* Update maccontrol PM related bits */ - brcms_c_set_ps_ctrl(wlc); - } - - brcms_c_bandinit_ordered(wlc, chanspec); - - /* init probe response timeout */ - brcms_b_write_shm(wlc->hw, M_PRS_MAXTIME, wlc->prb_resp_timeout); - - /* init max burst txop (framebursting) */ - brcms_b_write_shm(wlc->hw, M_MBURST_TXOP, - (wlc-> - _rifs ? (EDCF_AC_VO_TXOP_AP << 5) : MAXFRAMEBURST_TXOP)); - - /* initialize maximum allowed duty cycle */ - brcms_c_duty_cycle_set(wlc, wlc->tx_duty_cycle_ofdm, true, true); - brcms_c_duty_cycle_set(wlc, wlc->tx_duty_cycle_cck, false, true); - - /* - * Update some shared memory locations related to - * max AMPDU size allowed to received - */ - brcms_c_ampdu_shm_upd(wlc->ampdu); - - /* band-specific inits */ - brcms_c_bsinit(wlc); - - /* Enable EDCF mode (while the MAC is suspended) */ - bcma_set16(core, D11REGOFFS(ifs_ctl), IFS_USEEDCF); - brcms_c_edcf_setparams(wlc, false); - - /* read the ucode version if we have not yet done so */ - if (wlc->ucode_rev == 0) { - u16 rev; - u16 patch; - - rev = brcms_b_read_shm(wlc->hw, M_BOM_REV_MAJOR); - patch = brcms_b_read_shm(wlc->hw, M_BOM_REV_MINOR); - wlc->ucode_rev = (rev << NBITS(u16)) | patch; - snprintf(wlc->wiphy->fw_version, - sizeof(wlc->wiphy->fw_version), "%u.%u", rev, patch); - } - - /* ..now really unleash hell (allow the MAC out of suspend) */ - brcms_c_enable_mac(wlc); - - /* suspend the tx fifos and mute the phy for preism cac time */ - if (mute_tx) - brcms_b_mute(wlc->hw, true); - - /* enable the RF Disable Delay timer */ - bcma_write32(core, D11REGOFFS(rfdisabledly), RFDISABLE_DEFAULT); - - /* - * Initialize WME parameters; if they haven't been set by some other - * mechanism (IOVar, etc) then read them from the hardware. - */ - if (GFIELD(wlc->wme_retries[0], EDCF_SHORT) == 0) { - /* Uninitialized; read from HW */ - int ac; - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) - wlc->wme_retries[ac] = - brcms_b_read_shm(wlc->hw, M_AC_TXLMT_ADDR(ac)); - } -} - -/* - * The common driver entry routine. Error codes should be unique - */ -struct brcms_c_info * -brcms_c_attach(struct brcms_info *wl, struct bcma_device *core, uint unit, - bool piomode, uint *perr) -{ - struct brcms_c_info *wlc; - uint err = 0; - uint i, j; - struct brcms_pub *pub; - - /* allocate struct brcms_c_info state and its substructures */ - wlc = brcms_c_attach_malloc(unit, &err, 0); - if (wlc == NULL) - goto fail; - wlc->wiphy = wl->wiphy; - pub = wlc->pub; - -#if defined(DEBUG) - wlc_info_dbg = wlc; -#endif - - wlc->band = wlc->bandstate[0]; - wlc->core = wlc->corestate; - wlc->wl = wl; - pub->unit = unit; - pub->_piomode = piomode; - wlc->bandinit_pending = false; - wlc->beacon_template_virgin = true; - - /* populate struct brcms_c_info with default values */ - brcms_c_info_init(wlc, unit); - - /* update sta/ap related parameters */ - brcms_c_ap_upd(wlc); - - /* - * low level attach steps(all hw accesses go - * inside, no more in rest of the attach) - */ - err = brcms_b_attach(wlc, core, unit, piomode); - if (err) - goto fail; - - brcms_c_protection_upd(wlc, BRCMS_PROT_N_PAM_OVR, OFF); - - pub->phy_11ncapable = BRCMS_PHY_11N_CAP(wlc->band); - - /* disable allowed duty cycle */ - wlc->tx_duty_cycle_ofdm = 0; - wlc->tx_duty_cycle_cck = 0; - - brcms_c_stf_phy_chain_calc(wlc); - - /* txchain 1: txant 0, txchain 2: txant 1 */ - if (BRCMS_ISNPHY(wlc->band) && (wlc->stf->txstreams == 1)) - wlc->stf->txant = wlc->stf->hw_txchain - 1; - - /* push to BMAC driver */ - wlc_phy_stf_chain_init(wlc->band->pi, wlc->stf->hw_txchain, - wlc->stf->hw_rxchain); - - /* pull up some info resulting from the low attach */ - for (i = 0; i < NFIFO; i++) - wlc->core->txavail[i] = wlc->hw->txavail[i]; - - memcpy(&wlc->perm_etheraddr, &wlc->hw->etheraddr, ETH_ALEN); - memcpy(&pub->cur_etheraddr, &wlc->hw->etheraddr, ETH_ALEN); - - for (j = 0; j < wlc->pub->_nbands; j++) { - wlc->band = wlc->bandstate[j]; - - if (!brcms_c_attach_stf_ant_init(wlc)) { - err = 24; - goto fail; - } - - /* default contention windows size limits */ - wlc->band->CWmin = APHY_CWMIN; - wlc->band->CWmax = PHY_CWMAX; - - /* init gmode value */ - if (wlc->band->bandtype == BRCM_BAND_2G) { - wlc->band->gmode = GMODE_AUTO; - brcms_c_protection_upd(wlc, BRCMS_PROT_G_USER, - wlc->band->gmode); - } - - /* init _n_enab supported mode */ - if (BRCMS_PHY_11N_CAP(wlc->band)) { - pub->_n_enab = SUPPORT_11N; - brcms_c_protection_upd(wlc, BRCMS_PROT_N_USER, - ((pub->_n_enab == - SUPPORT_11N) ? WL_11N_2x2 : - WL_11N_3x3)); - } - - /* init per-band default rateset, depend on band->gmode */ - brcms_default_rateset(wlc, &wlc->band->defrateset); - - /* fill in hw_rateset */ - brcms_c_rateset_filter(&wlc->band->defrateset, - &wlc->band->hw_rateset, false, - BRCMS_RATES_CCK_OFDM, BRCMS_RATE_MASK, - (bool) (wlc->pub->_n_enab & SUPPORT_11N)); - } - - /* - * update antenna config due to - * wlc->stf->txant/txchain/ant_rx_ovr change - */ - brcms_c_stf_phy_txant_upd(wlc); - - /* attach each modules */ - err = brcms_c_attach_module(wlc); - if (err != 0) - goto fail; - - if (!brcms_c_timers_init(wlc, unit)) { - wiphy_err(wl->wiphy, "wl%d: %s: init_timer failed\n", unit, - __func__); - err = 32; - goto fail; - } - - /* depend on rateset, gmode */ - wlc->cmi = brcms_c_channel_mgr_attach(wlc); - if (!wlc->cmi) { - wiphy_err(wl->wiphy, "wl%d: %s: channel_mgr_attach failed" - "\n", unit, __func__); - err = 33; - goto fail; - } - - /* init default when all parameters are ready, i.e. ->rateset */ - brcms_c_bss_default_init(wlc); - - /* - * Complete the wlc default state initializations.. - */ - - wlc->bsscfg->wlc = wlc; - - wlc->mimoft = FT_HT; - wlc->mimo_40txbw = AUTO; - wlc->ofdm_40txbw = AUTO; - wlc->cck_40txbw = AUTO; - brcms_c_update_mimo_band_bwcap(wlc, BRCMS_N_BW_20IN2G_40IN5G); - - /* Set default values of SGI */ - if (BRCMS_SGI_CAP_PHY(wlc)) { - brcms_c_ht_update_sgi_rx(wlc, (BRCMS_N_SGI_20 | - BRCMS_N_SGI_40)); - } else if (BRCMS_ISSSLPNPHY(wlc->band)) { - brcms_c_ht_update_sgi_rx(wlc, (BRCMS_N_SGI_20 | - BRCMS_N_SGI_40)); - } else { - brcms_c_ht_update_sgi_rx(wlc, 0); - } - - brcms_b_antsel_set(wlc->hw, wlc->asi->antsel_avail); - - if (perr) - *perr = 0; - - return wlc; - - fail: - wiphy_err(wl->wiphy, "wl%d: %s: failed with err %d\n", - unit, __func__, err); - if (wlc) - brcms_c_detach(wlc); - - if (perr) - *perr = err; - return NULL; -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.h b/drivers/net/wireless/brcm80211/brcmsmac/main.h deleted file mode 100644 index b5d7a38b53fe..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.h +++ /dev/null @@ -1,681 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_MAIN_H_ -#define _BRCM_MAIN_H_ - -#include - -#include -#include "types.h" -#include "d11.h" -#include "scb.h" - -#define INVCHANNEL 255 /* invalid channel */ - -/* max # brcms_c_module_register() calls */ -#define BRCMS_MAXMODULES 22 - -#define SEQNUM_SHIFT 4 -#define SEQNUM_MAX 0x1000 - -#define NTXRATE 64 /* # tx MPDUs rate is reported for */ - -/* Maximum wait time for a MAC suspend */ -/* uS: 83mS is max packet time (64KB ampdu @ 6Mbps) */ -#define BRCMS_MAX_MAC_SUSPEND 83000 - -/* responses for probe requests older that this are tossed, zero to disable */ -#define BRCMS_PRB_RESP_TIMEOUT 0 /* Disable probe response timeout */ - -/* transmit buffer max headroom for protocol headers */ -#define TXOFF (D11_TXH_LEN + D11_PHY_HDR_LEN) - -/* Macros for doing definition and get/set of bitfields - * Usage example, e.g. a three-bit field (bits 4-6): - * #define _M BITFIELD_MASK(3) - * #define _S 4 - * ... - * regval = R_REG(osh, ®s->regfoo); - * field = GFIELD(regval, ); - * regval = SFIELD(regval, , 1); - * W_REG(osh, ®s->regfoo, regval); - */ -#define BITFIELD_MASK(width) \ - (((unsigned)1 << (width)) - 1) -#define GFIELD(val, field) \ - (((val) >> field ## _S) & field ## _M) -#define SFIELD(val, field, bits) \ - (((val) & (~(field ## _M << field ## _S))) | \ - ((unsigned)(bits) << field ## _S)) - -#define SW_TIMER_MAC_STAT_UPD 30 /* periodic MAC stats update */ - -/* max # supported core revisions (0 .. MAXCOREREV - 1) */ -#define MAXCOREREV 28 - -/* Double check that unsupported cores are not enabled */ -#if CONF_MSK(D11CONF, 0x4f) || CONF_GE(D11CONF, MAXCOREREV) -#error "Configuration for D11CONF includes unsupported versions." -#endif /* Bad versions */ - -/* values for shortslot_override */ -#define BRCMS_SHORTSLOT_AUTO -1 /* Driver will manage Shortslot setting */ -#define BRCMS_SHORTSLOT_OFF 0 /* Turn off short slot */ -#define BRCMS_SHORTSLOT_ON 1 /* Turn on short slot */ - -/* value for short/long and mixmode/greenfield preamble */ -#define BRCMS_LONG_PREAMBLE (0) -#define BRCMS_SHORT_PREAMBLE (1 << 0) -#define BRCMS_GF_PREAMBLE (1 << 1) -#define BRCMS_MM_PREAMBLE (1 << 2) -#define BRCMS_IS_MIMO_PREAMBLE(_pre) (((_pre) == BRCMS_GF_PREAMBLE) || \ - ((_pre) == BRCMS_MM_PREAMBLE)) - -/* TxFrameID */ -/* seq and frag bits: SEQNUM_SHIFT, FRAGNUM_MASK (802.11.h) */ -/* rate epoch bits: TXFID_RATE_SHIFT, TXFID_RATE_MASK ((wlc_rate.c) */ -#define TXFID_QUEUE_MASK 0x0007 /* Bits 0-2 */ -#define TXFID_SEQ_MASK 0x7FE0 /* Bits 5-15 */ -#define TXFID_SEQ_SHIFT 5 /* Number of bit shifts */ -#define TXFID_RATE_PROBE_MASK 0x8000 /* Bit 15 for rate probe */ -#define TXFID_RATE_MASK 0x0018 /* Mask for bits 3 and 4 */ -#define TXFID_RATE_SHIFT 3 /* Shift 3 bits for rate mask */ - -/* promote boardrev */ -#define BOARDREV_PROMOTABLE 0xFF /* from */ -#define BOARDREV_PROMOTED 1 /* to */ - -#define DATA_BLOCK_TX_SUPR (1 << 4) - -/* Ucode MCTL_WAKE override bits */ -#define BRCMS_WAKE_OVERRIDE_CLKCTL 0x01 -#define BRCMS_WAKE_OVERRIDE_PHYREG 0x02 -#define BRCMS_WAKE_OVERRIDE_MACSUSPEND 0x04 -#define BRCMS_WAKE_OVERRIDE_TXFIFO 0x08 -#define BRCMS_WAKE_OVERRIDE_FORCEFAST 0x10 - -/* stuff pulled in from wlc.c */ - -/* Interrupt bit error summary. Don't include I_RU: we refill DMA at other - * times; and if we run out, constant I_RU interrupts may cause lockup. We - * will still get error counts from rx0ovfl. - */ -#define I_ERRORS (I_PC | I_PD | I_DE | I_RO | I_XU) -/* default software intmasks */ -#define DEF_RXINTMASK (I_RI) /* enable rx int on rxfifo only */ -#define DEF_MACINTMASK (MI_TXSTOP | MI_TBTT | MI_ATIMWINEND | MI_PMQ | \ - MI_PHYTXERR | MI_DMAINT | MI_TFS | MI_BG_NOISE | \ - MI_CCA | MI_TO | MI_GP0 | MI_RFDISABLE | MI_PWRUP) - -#define MAXTXPKTS 6 /* max # pkts pending */ - -/* frameburst */ -#define MAXTXFRAMEBURST 8 /* vanilla xpress mode: max frames/burst */ -#define MAXFRAMEBURST_TXOP 10000 /* Frameburst TXOP in usec */ - -#define NFIFO 6 /* # tx/rx fifopairs */ - -/* PLL requests */ - -/* pll is shared on old chips */ -#define BRCMS_PLLREQ_SHARED 0x1 -/* hold pll for radio monitor register checking */ -#define BRCMS_PLLREQ_RADIO_MON 0x2 -/* hold/release pll for some short operation */ -#define BRCMS_PLLREQ_FLIP 0x4 - -#define CHANNEL_BANDUNIT(wlc, ch) \ - (((ch) <= CH_MAX_2G_CHANNEL) ? BAND_2G_INDEX : BAND_5G_INDEX) - -#define OTHERBANDUNIT(wlc) \ - ((uint)((wlc)->band->bandunit ? BAND_2G_INDEX : BAND_5G_INDEX)) - -/* - * 802.11 protection information - * - * _g: use g spec protection, driver internal. - * g_override: override for use of g spec protection. - * gmode_user: user config gmode, operating band->gmode is different. - * overlap: Overlap BSS/IBSS protection for both 11g and 11n. - * nmode_user: user config nmode, operating pub->nmode is different. - * n_cfg: use OFDM protection on MIMO frames. - * n_cfg_override: override for use of N protection. - * nongf: non-GF present protection. - * nongf_override: override for use of GF protection. - * n_pam_override: override for preamble: MM or GF. - * n_obss: indicated OBSS Non-HT STA present. -*/ -struct brcms_protection { - bool _g; - s8 g_override; - u8 gmode_user; - s8 overlap; - s8 nmode_user; - s8 n_cfg; - s8 n_cfg_override; - bool nongf; - s8 nongf_override; - s8 n_pam_override; - bool n_obss; -}; - -/* - * anything affecting the single/dual streams/antenna operation - * - * hw_txchain: HW txchain bitmap cfg. - * txchain: txchain bitmap being used. - * txstreams: number of txchains being used. - * hw_rxchain: HW rxchain bitmap cfg. - * rxchain: rxchain bitmap being used. - * rxstreams: number of rxchains being used. - * ant_rx_ovr: rx antenna override. - * txant: userTx antenna setting. - * phytxant: phyTx antenna setting in txheader. - * ss_opmode: singlestream Operational mode, 0:siso; 1:cdd. - * ss_algosel_auto: if true, use wlc->stf->ss_algo_channel; - * else use wlc->band->stf->ss_mode_band. - * ss_algo_channel: ss based on per-channel algo: 0: SISO, 1: CDD 2: STBC. - * rxchain_restore_delay: delay time to restore default rxchain. - * ldpc: AUTO/ON/OFF ldpc cap supported. - * txcore[MAX_STREAMS_SUPPORTED + 1]: bitmap of selected core for each Nsts. - * spatial_policy: - */ -struct brcms_stf { - u8 hw_txchain; - u8 txchain; - u8 txstreams; - u8 hw_rxchain; - u8 rxchain; - u8 rxstreams; - u8 ant_rx_ovr; - s8 txant; - u16 phytxant; - u8 ss_opmode; - bool ss_algosel_auto; - u16 ss_algo_channel; - u8 rxchain_restore_delay; - s8 ldpc; - u8 txcore[MAX_STREAMS_SUPPORTED + 1]; - s8 spatial_policy; -}; - -#define BRCMS_STF_SS_STBC_TX(wlc, scb) \ - (((wlc)->stf->txstreams > 1) && (((wlc)->band->band_stf_stbc_tx == ON) \ - || (((scb)->flags & SCB_STBCCAP) && \ - (wlc)->band->band_stf_stbc_tx == AUTO && \ - isset(&((wlc)->stf->ss_algo_channel), PHY_TXC1_MODE_STBC)))) - -#define BRCMS_STBC_CAP_PHY(wlc) (BRCMS_ISNPHY(wlc->band) && \ - NREV_GE(wlc->band->phyrev, 3)) - -#define BRCMS_SGI_CAP_PHY(wlc) ((BRCMS_ISNPHY(wlc->band) && \ - NREV_GE(wlc->band->phyrev, 3)) || \ - BRCMS_ISLCNPHY(wlc->band)) - -#define BRCMS_CHAN_PHYTYPE(x) (((x) & RXS_CHAN_PHYTYPE_MASK) \ - >> RXS_CHAN_PHYTYPE_SHIFT) -#define BRCMS_CHAN_CHANNEL(x) (((x) & RXS_CHAN_ID_MASK) \ - >> RXS_CHAN_ID_SHIFT) - -/* - * core state (mac) - */ -struct brcms_core { - uint coreidx; /* # sb enumerated core */ - - /* fifo */ - uint *txavail[NFIFO]; /* # tx descriptors available */ - - struct macstat *macstat_snapshot; /* mac hw prev read values */ -}; - -/* - * band state (phy+ana+radio) - */ -struct brcms_band { - int bandtype; /* BRCM_BAND_2G, BRCM_BAND_5G */ - uint bandunit; /* bandstate[] index */ - - u16 phytype; /* phytype */ - u16 phyrev; - u16 radioid; - u16 radiorev; - struct brcms_phy_pub *pi; /* pointer to phy specific information */ - bool abgphy_encore; - - u8 gmode; /* currently active gmode */ - - struct scb *hwrs_scb; /* permanent scb for hw rateset */ - - /* band-specific copy of default_bss.rateset */ - struct brcms_c_rateset defrateset; - - u8 band_stf_ss_mode; /* Configured STF type, 0:siso; 1:cdd */ - s8 band_stf_stbc_tx; /* STBC TX 0:off; 1:force on; -1:auto */ - /* rates supported by chip (phy-specific) */ - struct brcms_c_rateset hw_rateset; - u8 basic_rate[BRCM_MAXRATE + 1]; /* basic rates indexed by rate */ - bool mimo_cap_40; /* 40 MHz cap enabled on this band */ - s8 antgain; /* antenna gain from srom */ - - u16 CWmin; /* minimum size of contention window, in unit of aSlotTime */ - u16 CWmax; /* maximum size of contention window, in unit of aSlotTime */ - struct ieee80211_supported_band band; -}; - -/* module control blocks */ -struct modulecb { - /* module name : NULL indicates empty array member */ - char name[32]; - /* handle passed when handler 'doiovar' is called */ - struct brcms_info *hdl; - - int (*down_fn)(void *handle); /* down handler. Note: the int returned - * by the down function is a count of the - * number of timers that could not be - * freed. - */ - -}; - -struct brcms_hw_band { - int bandtype; /* BRCM_BAND_2G, BRCM_BAND_5G */ - uint bandunit; /* bandstate[] index */ - u16 mhfs[MHFMAX]; /* MHF array shadow */ - u8 bandhw_stf_ss_mode; /* HW configured STF type, 0:siso; 1:cdd */ - u16 CWmin; - u16 CWmax; - u32 core_flags; - - u16 phytype; /* phytype */ - u16 phyrev; - u16 radioid; - u16 radiorev; - struct brcms_phy_pub *pi; /* pointer to phy specific information */ - bool abgphy_encore; -}; - -struct brcms_hardware { - bool _piomode; /* true if pio mode */ - struct brcms_c_info *wlc; - - /* fifo */ - struct dma_pub *di[NFIFO]; /* dma handles, per fifo */ - - uint unit; /* device instance number */ - - /* version info */ - u16 vendorid; /* PCI vendor id */ - u16 deviceid; /* PCI device id */ - uint corerev; /* core revision */ - u8 sromrev; /* version # of the srom */ - u16 boardrev; /* version # of particular board */ - u32 boardflags; /* Board specific flags from srom */ - u32 boardflags2; /* More board flags if sromrev >= 4 */ - u32 machwcap; /* MAC capabilities */ - u32 machwcap_backup; /* backup of machwcap */ - - struct si_pub *sih; /* SI handle (cookie for siutils calls) */ - struct bcma_device *d11core; /* pointer to 802.11 core */ - struct phy_shim_info *physhim; /* phy shim layer handler */ - struct shared_phy *phy_sh; /* pointer to shared phy state */ - struct brcms_hw_band *band;/* pointer to active per-band state */ - /* band state per phy/radio */ - struct brcms_hw_band *bandstate[MAXBANDS]; - u16 bmac_phytxant; /* cache of high phytxant state */ - bool shortslot; /* currently using 11g ShortSlot timing */ - u16 SRL; /* 802.11 dot11ShortRetryLimit */ - u16 LRL; /* 802.11 dot11LongRetryLimit */ - u16 SFBL; /* Short Frame Rate Fallback Limit */ - u16 LFBL; /* Long Frame Rate Fallback Limit */ - - bool up; /* d11 hardware up and running */ - uint now; /* # elapsed seconds */ - uint _nbands; /* # bands supported */ - u16 chanspec; /* bmac chanspec shadow */ - - uint *txavail[NFIFO]; /* # tx descriptors available */ - const u16 *xmtfifo_sz; /* fifo size in 256B for each xmt fifo */ - - u32 pllreq; /* pll requests to keep PLL on */ - - u8 suspended_fifos; /* Which TX fifo to remain awake for */ - u32 maccontrol; /* Cached value of maccontrol */ - uint mac_suspend_depth; /* current depth of mac_suspend levels */ - u32 wake_override; /* bit flags to force MAC to WAKE mode */ - u32 mute_override; /* Prevent ucode from sending beacons */ - u8 etheraddr[ETH_ALEN]; /* currently configured ethernet address */ - bool noreset; /* true= do not reset hw, used by WLC_OUT */ - bool forcefastclk; /* true if h/w is forcing to use fast clk */ - bool clk; /* core is out of reset and has clock */ - bool sbclk; /* sb has clock */ - bool phyclk; /* phy is out of reset and has clock */ - - bool ucode_loaded; /* true after ucode downloaded */ - - - u8 hw_stf_ss_opmode; /* STF single stream operation mode */ - u8 antsel_type; /* Type of boardlevel mimo antenna switch-logic - * 0 = N/A, 1 = 2x4 board, 2 = 2x3 CB2 board - */ - u32 antsel_avail; /* - * put struct antsel_info here if more info is - * needed - */ -}; - -/* - * Principal common driver data structure. - * - * pub: pointer to driver public state. - * wl: pointer to specific private state. - * hw: HW related state. - * clkreq_override: setting for clkreq for PCIE : Auto, 0, 1. - * fastpwrup_dly: time in us needed to bring up d11 fast clock. - * macintstatus: bit channel between isr and dpc. - * macintmask: sw runtime master macintmask value. - * defmacintmask: default "on" macintmask value. - * clk: core is out of reset and has clock. - * core: pointer to active io core. - * band: pointer to active per-band state. - * corestate: per-core state (one per hw core). - * bandstate: per-band state (one per phy/radio). - * qvalid: DirFrmQValid and BcMcFrmQValid. - * ampdu: ampdu module handler. - * asi: antsel module handler. - * cmi: channel manager module handler. - * vendorid: PCI vendor id. - * deviceid: PCI device id. - * ucode_rev: microcode revision. - * machwcap: MAC capabilities, BMAC shadow. - * perm_etheraddr: original sprom local ethernet address. - * bandlocked: disable auto multi-band switching. - * bandinit_pending: track band init in auto band. - * radio_monitor: radio timer is running. - * going_down: down path intermediate variable. - * wdtimer: timer for watchdog routine. - * radio_timer: timer for hw radio button monitor routine. - * monitor: monitor (MPDU sniffing) mode. - * bcnmisc_monitor: bcns promisc mode override for monitor. - * _rifs: enable per-packet rifs. - * bcn_li_bcn: beacon listen interval in # beacons. - * bcn_li_dtim: beacon listen interval in # dtims. - * WDarmed: watchdog timer is armed. - * WDlast: last time wlc_watchdog() was called. - * edcf_txop[IEEE80211_NUM_ACS]: current txop for each ac. - * wme_retries: per-AC retry limits. - * bsscfg: set of BSS configurations, idx 0 is default and always valid. - * cfg: the primary bsscfg (can be AP or STA). - * modulecb: - * mimoft: SIGN or 11N. - * cck_40txbw: 11N, cck tx b/w override when in 40MHZ mode. - * ofdm_40txbw: 11N, ofdm tx b/w override when in 40MHZ mode. - * mimo_40txbw: 11N, mimo tx b/w override when in 40MHZ mode. - * default_bss: configured BSS parameters. - * mc_fid_counter: BC/MC FIFO frame ID counter. - * country_default: saved country for leaving 802.11d auto-country mode. - * autocountry_default: initial country for 802.11d auto-country mode. - * prb_resp_timeout: do not send prb resp if request older - * than this, 0 = disable. - * home_chanspec: shared home chanspec. - * chanspec: target operational channel. - * usr_fragthresh: user configured fragmentation threshold. - * fragthresh[NFIFO]: per-fifo fragmentation thresholds. - * RTSThresh: 802.11 dot11RTSThreshold. - * SRL: 802.11 dot11ShortRetryLimit. - * LRL: 802.11 dot11LongRetryLimit. - * SFBL: Short Frame Rate Fallback Limit. - * LFBL: Long Frame Rate Fallback Limit. - * shortslot: currently using 11g ShortSlot timing. - * shortslot_override: 11g ShortSlot override. - * include_legacy_erp: include Legacy ERP info elt ID 47 as well as g ID 42. - * PLCPHdr_override: 802.11b Preamble Type override. - * stf: - * bcn_rspec: save bcn ratespec purpose. - * tempsense_lasttime; - * tx_duty_cycle_ofdm: maximum allowed duty cycle for OFDM. - * tx_duty_cycle_cck: maximum allowed duty cycle for CCK. - * wiphy: - * pri_scb: primary Station Control Block - */ -struct brcms_c_info { - struct brcms_pub *pub; - struct brcms_info *wl; - struct brcms_hardware *hw; - - /* clock */ - u16 fastpwrup_dly; - - /* interrupt */ - u32 macintstatus; - u32 macintmask; - u32 defmacintmask; - - bool clk; - - /* multiband */ - struct brcms_core *core; - struct brcms_band *band; - struct brcms_core *corestate; - struct brcms_band *bandstate[MAXBANDS]; - - /* packet queue */ - uint qvalid; - - struct ampdu_info *ampdu; - struct antsel_info *asi; - struct brcms_cm_info *cmi; - - u16 vendorid; - u16 deviceid; - uint ucode_rev; - - u8 perm_etheraddr[ETH_ALEN]; - - bool bandlocked; - bool bandinit_pending; - - bool radio_monitor; - bool going_down; - - bool beacon_template_virgin; - - struct brcms_timer *wdtimer; - struct brcms_timer *radio_timer; - - /* promiscuous */ - uint filter_flags; - - /* driver feature */ - bool _rifs; - - /* AP-STA synchronization, power save */ - u8 bcn_li_bcn; - u8 bcn_li_dtim; - - bool WDarmed; - u32 WDlast; - - /* WME */ - u16 edcf_txop[IEEE80211_NUM_ACS]; - - u16 wme_retries[IEEE80211_NUM_ACS]; - - struct brcms_bss_cfg *bsscfg; - - struct modulecb *modulecb; - - u8 mimoft; - s8 cck_40txbw; - s8 ofdm_40txbw; - s8 mimo_40txbw; - - struct brcms_bss_info *default_bss; - - u16 mc_fid_counter; - - char country_default[BRCM_CNTRY_BUF_SZ]; - char autocountry_default[BRCM_CNTRY_BUF_SZ]; - u16 prb_resp_timeout; - - u16 home_chanspec; - - /* PHY parameters */ - u16 chanspec; - u16 usr_fragthresh; - u16 fragthresh[NFIFO]; - u16 RTSThresh; - u16 SRL; - u16 LRL; - u16 SFBL; - u16 LFBL; - - /* network config */ - bool shortslot; - s8 shortslot_override; - bool include_legacy_erp; - - struct brcms_protection *protection; - s8 PLCPHdr_override; - - struct brcms_stf *stf; - - u32 bcn_rspec; - - uint tempsense_lasttime; - - u16 tx_duty_cycle_ofdm; - u16 tx_duty_cycle_cck; - - struct wiphy *wiphy; - struct scb pri_scb; - - struct sk_buff *beacon; - u16 beacon_tim_offset; - u16 beacon_dtim_period; - struct sk_buff *probe_resp; -}; - -/* antsel module specific state */ -struct antsel_info { - struct brcms_c_info *wlc; /* pointer to main wlc structure */ - struct brcms_pub *pub; /* pointer to public fn */ - u8 antsel_type; /* Type of boardlevel mimo antenna switch-logic - * 0 = N/A, 1 = 2x4 board, 2 = 2x3 CB2 board - */ - u8 antsel_antswitch; /* board level antenna switch type */ - bool antsel_avail; /* Ant selection availability (SROM based) */ - struct brcms_antselcfg antcfg_11n; /* antenna configuration */ - struct brcms_antselcfg antcfg_cur; /* current antenna config (auto) */ -}; - -enum brcms_bss_type { - BRCMS_TYPE_STATION, - BRCMS_TYPE_AP, - BRCMS_TYPE_ADHOC, -}; - -/* - * BSS configuration state - * - * wlc: wlc to which this bsscfg belongs to. - * type: interface type - * SSID_len: the length of SSID - * SSID: SSID string - * - * - * BSSID: BSSID (associated) - * cur_etheraddr: h/w address - * flags: BSSCFG flags; see below - * - * current_bss: BSS parms in ASSOCIATED state - * - * - * ID: 'unique' ID of this bsscfg, assigned at bsscfg allocation - */ -struct brcms_bss_cfg { - struct brcms_c_info *wlc; - enum brcms_bss_type type; - u8 SSID_len; - u8 SSID[IEEE80211_MAX_SSID_LEN]; - u8 BSSID[ETH_ALEN]; - struct brcms_bss_info *current_bss; -}; - -extern int brcms_c_txfifo(struct brcms_c_info *wlc, uint fifo, - struct sk_buff *p); -extern int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo, - uint *blocks); - -extern int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config); -extern void brcms_c_mac_promisc(struct brcms_c_info *wlc, uint filter_flags); -extern u16 brcms_c_calc_lsig_len(struct brcms_c_info *wlc, u32 ratespec, - uint mac_len); -extern u32 brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, - u32 rspec, - bool use_rspec, u16 mimo_ctlchbw); -extern u16 brcms_c_compute_rtscts_dur(struct brcms_c_info *wlc, bool cts_only, - u32 rts_rate, - u32 frame_rate, - u8 rts_preamble_type, - u8 frame_preamble_type, uint frame_len, - bool ba); -extern void brcms_c_inval_dma_pkts(struct brcms_hardware *hw, - struct ieee80211_sta *sta, - void (*dma_callback_fn)); -extern void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend); -extern int brcms_c_set_nmode(struct brcms_c_info *wlc); -extern void brcms_c_beacon_phytxctl_txant_upd(struct brcms_c_info *wlc, - u32 bcn_rate); -extern void brcms_b_antsel_type_set(struct brcms_hardware *wlc_hw, - u8 antsel_type); -extern void brcms_b_set_chanspec(struct brcms_hardware *wlc_hw, - u16 chanspec, - bool mute, struct txpwr_limits *txpwr); -extern void brcms_b_write_shm(struct brcms_hardware *wlc_hw, uint offset, - u16 v); -extern u16 brcms_b_read_shm(struct brcms_hardware *wlc_hw, uint offset); -extern void brcms_b_mhf(struct brcms_hardware *wlc_hw, u8 idx, u16 mask, - u16 val, int bands); -extern void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags); -extern void brcms_b_mctrl(struct brcms_hardware *wlc_hw, u32 mask, u32 val); -extern void brcms_b_phy_reset(struct brcms_hardware *wlc_hw); -extern void brcms_b_bw_set(struct brcms_hardware *wlc_hw, u16 bw); -extern void brcms_b_core_phypll_reset(struct brcms_hardware *wlc_hw); -extern void brcms_c_ucode_wake_override_set(struct brcms_hardware *wlc_hw, - u32 override_bit); -extern void brcms_c_ucode_wake_override_clear(struct brcms_hardware *wlc_hw, - u32 override_bit); -extern void brcms_b_write_template_ram(struct brcms_hardware *wlc_hw, - int offset, int len, void *buf); -extern u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate); -extern void brcms_b_copyto_objmem(struct brcms_hardware *wlc_hw, - uint offset, const void *buf, int len, - u32 sel); -extern void brcms_b_copyfrom_objmem(struct brcms_hardware *wlc_hw, uint offset, - void *buf, int len, u32 sel); -extern void brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode); -extern u16 brcms_b_get_txant(struct brcms_hardware *wlc_hw); -extern void brcms_b_phyclk_fgc(struct brcms_hardware *wlc_hw, bool clk); -extern void brcms_b_macphyclk_set(struct brcms_hardware *wlc_hw, bool clk); -extern void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on); -extern void brcms_b_txant_set(struct brcms_hardware *wlc_hw, u16 phytxant); -extern void brcms_b_band_stf_ss_set(struct brcms_hardware *wlc_hw, - u8 stf_mode); -extern void brcms_c_init_scb(struct scb *scb); - -#endif /* _BRCM_MAIN_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c deleted file mode 100644 index b0fd807f2b2b..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c +++ /dev/null @@ -1,2957 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#include -#include -#include - -#include -#include -#include -#include -#include -#include "phy_hal.h" -#include "phy_int.h" -#include "phy_radio.h" -#include "phy_lcn.h" -#include "phyreg_n.h" - -#define VALID_N_RADIO(radioid) ((radioid == BCM2055_ID) || \ - (radioid == BCM2056_ID) || \ - (radioid == BCM2057_ID)) - -#define VALID_LCN_RADIO(radioid) (radioid == BCM2064_ID) - -#define VALID_RADIO(pi, radioid) ( \ - (ISNPHY(pi) ? VALID_N_RADIO(radioid) : false) || \ - (ISLCNPHY(pi) ? VALID_LCN_RADIO(radioid) : false)) - -/* basic mux operation - can be optimized on several architectures */ -#define MUX(pred, true, false) ((pred) ? (true) : (false)) - -/* modulo inc/dec - assumes x E [0, bound - 1] */ -#define MODINC(x, bound) MUX((x) == (bound) - 1, 0, (x) + 1) - -/* modulo inc/dec, bound = 2^k */ -#define MODDEC_POW2(x, bound) (((x) - 1) & ((bound) - 1)) -#define MODINC_POW2(x, bound) (((x) + 1) & ((bound) - 1)) - -struct chan_info_basic { - u16 chan; - u16 freq; -}; - -static const struct chan_info_basic chan_info_all[] = { - {1, 2412}, - {2, 2417}, - {3, 2422}, - {4, 2427}, - {5, 2432}, - {6, 2437}, - {7, 2442}, - {8, 2447}, - {9, 2452}, - {10, 2457}, - {11, 2462}, - {12, 2467}, - {13, 2472}, - {14, 2484}, - - {34, 5170}, - {38, 5190}, - {42, 5210}, - {46, 5230}, - - {36, 5180}, - {40, 5200}, - {44, 5220}, - {48, 5240}, - {52, 5260}, - {56, 5280}, - {60, 5300}, - {64, 5320}, - - {100, 5500}, - {104, 5520}, - {108, 5540}, - {112, 5560}, - {116, 5580}, - {120, 5600}, - {124, 5620}, - {128, 5640}, - {132, 5660}, - {136, 5680}, - {140, 5700}, - - {149, 5745}, - {153, 5765}, - {157, 5785}, - {161, 5805}, - {165, 5825}, - - {184, 4920}, - {188, 4940}, - {192, 4960}, - {196, 4980}, - {200, 5000}, - {204, 5020}, - {208, 5040}, - {212, 5060}, - {216, 5080} -}; - -static const u8 ofdm_rate_lookup[] = { - - BRCM_RATE_48M, - BRCM_RATE_24M, - BRCM_RATE_12M, - BRCM_RATE_6M, - BRCM_RATE_54M, - BRCM_RATE_36M, - BRCM_RATE_18M, - BRCM_RATE_9M -}; - -#define PHY_WREG_LIMIT 24 - -void wlc_phyreg_enter(struct brcms_phy_pub *pih) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - wlapi_bmac_ucode_wake_override_phyreg_set(pi->sh->physhim); -} - -void wlc_phyreg_exit(struct brcms_phy_pub *pih) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - wlapi_bmac_ucode_wake_override_phyreg_clear(pi->sh->physhim); -} - -void wlc_radioreg_enter(struct brcms_phy_pub *pih) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - wlapi_bmac_mctrl(pi->sh->physhim, MCTL_LOCK_RADIO, MCTL_LOCK_RADIO); - - udelay(10); -} - -void wlc_radioreg_exit(struct brcms_phy_pub *pih) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - (void)bcma_read16(pi->d11core, D11REGOFFS(phyversion)); - pi->phy_wreg = 0; - wlapi_bmac_mctrl(pi->sh->physhim, MCTL_LOCK_RADIO, 0); -} - -u16 read_radio_reg(struct brcms_phy *pi, u16 addr) -{ - u16 data; - - if ((addr == RADIO_IDCODE)) - return 0xffff; - - switch (pi->pubpi.phy_type) { - case PHY_TYPE_N: - if (!CONF_HAS(PHYTYPE, PHY_TYPE_N)) - break; - if (NREV_GE(pi->pubpi.phy_rev, 7)) - addr |= RADIO_2057_READ_OFF; - else - addr |= RADIO_2055_READ_OFF; - break; - - case PHY_TYPE_LCN: - if (!CONF_HAS(PHYTYPE, PHY_TYPE_LCN)) - break; - addr |= RADIO_2064_READ_OFF; - break; - - default: - break; - } - - if ((D11REV_GE(pi->sh->corerev, 24)) || - (D11REV_IS(pi->sh->corerev, 22) - && (pi->pubpi.phy_type != PHY_TYPE_SSN))) { - bcma_wflush16(pi->d11core, D11REGOFFS(radioregaddr), addr); - data = bcma_read16(pi->d11core, D11REGOFFS(radioregdata)); - } else { - bcma_wflush16(pi->d11core, D11REGOFFS(phy4waddr), addr); - data = bcma_read16(pi->d11core, D11REGOFFS(phy4wdatalo)); - } - pi->phy_wreg = 0; - - return data; -} - -void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val) -{ - if ((D11REV_GE(pi->sh->corerev, 24)) || - (D11REV_IS(pi->sh->corerev, 22) - && (pi->pubpi.phy_type != PHY_TYPE_SSN))) { - - bcma_wflush16(pi->d11core, D11REGOFFS(radioregaddr), addr); - bcma_write16(pi->d11core, D11REGOFFS(radioregdata), val); - } else { - bcma_wflush16(pi->d11core, D11REGOFFS(phy4waddr), addr); - bcma_write16(pi->d11core, D11REGOFFS(phy4wdatalo), val); - } - - if ((pi->d11core->bus->hosttype == BCMA_HOSTTYPE_PCI) && - (++pi->phy_wreg >= pi->phy_wreg_limit)) { - (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol)); - pi->phy_wreg = 0; - } -} - -static u32 read_radio_id(struct brcms_phy *pi) -{ - u32 id; - - if (D11REV_GE(pi->sh->corerev, 24)) { - u32 b0, b1, b2; - - bcma_wflush16(pi->d11core, D11REGOFFS(radioregaddr), 0); - b0 = (u32) bcma_read16(pi->d11core, D11REGOFFS(radioregdata)); - bcma_wflush16(pi->d11core, D11REGOFFS(radioregaddr), 1); - b1 = (u32) bcma_read16(pi->d11core, D11REGOFFS(radioregdata)); - bcma_wflush16(pi->d11core, D11REGOFFS(radioregaddr), 2); - b2 = (u32) bcma_read16(pi->d11core, D11REGOFFS(radioregdata)); - - id = ((b0 & 0xf) << 28) | (((b2 << 8) | b1) << 12) | ((b0 >> 4) - & 0xf); - } else { - bcma_wflush16(pi->d11core, D11REGOFFS(phy4waddr), RADIO_IDCODE); - id = (u32) bcma_read16(pi->d11core, D11REGOFFS(phy4wdatalo)); - id |= (u32) bcma_read16(pi->d11core, - D11REGOFFS(phy4wdatahi)) << 16; - } - pi->phy_wreg = 0; - return id; -} - -void and_radio_reg(struct brcms_phy *pi, u16 addr, u16 val) -{ - u16 rval; - - rval = read_radio_reg(pi, addr); - write_radio_reg(pi, addr, (rval & val)); -} - -void or_radio_reg(struct brcms_phy *pi, u16 addr, u16 val) -{ - u16 rval; - - rval = read_radio_reg(pi, addr); - write_radio_reg(pi, addr, (rval | val)); -} - -void xor_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask) -{ - u16 rval; - - rval = read_radio_reg(pi, addr); - write_radio_reg(pi, addr, (rval ^ mask)); -} - -void mod_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask, u16 val) -{ - u16 rval; - - rval = read_radio_reg(pi, addr); - write_radio_reg(pi, addr, (rval & ~mask) | (val & mask)); -} - -void write_phy_channel_reg(struct brcms_phy *pi, uint val) -{ - bcma_write16(pi->d11core, D11REGOFFS(phychannel), val); -} - -u16 read_phy_reg(struct brcms_phy *pi, u16 addr) -{ - bcma_wflush16(pi->d11core, D11REGOFFS(phyregaddr), addr); - - pi->phy_wreg = 0; - return bcma_read16(pi->d11core, D11REGOFFS(phyregdata)); -} - -void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val) -{ -#ifdef CONFIG_BCM47XX - bcma_wflush16(pi->d11core, D11REGOFFS(phyregaddr), addr); - bcma_write16(pi->d11core, D11REGOFFS(phyregdata), val); - if (addr == 0x72) - (void)bcma_read16(pi->d11core, D11REGOFFS(phyregdata)); -#else - bcma_write32(pi->d11core, D11REGOFFS(phyregaddr), addr | (val << 16)); - if ((pi->d11core->bus->hosttype == BCMA_HOSTTYPE_PCI) && - (++pi->phy_wreg >= pi->phy_wreg_limit)) { - pi->phy_wreg = 0; - (void)bcma_read16(pi->d11core, D11REGOFFS(phyversion)); - } -#endif -} - -void and_phy_reg(struct brcms_phy *pi, u16 addr, u16 val) -{ - bcma_wflush16(pi->d11core, D11REGOFFS(phyregaddr), addr); - bcma_mask16(pi->d11core, D11REGOFFS(phyregdata), val); - pi->phy_wreg = 0; -} - -void or_phy_reg(struct brcms_phy *pi, u16 addr, u16 val) -{ - bcma_wflush16(pi->d11core, D11REGOFFS(phyregaddr), addr); - bcma_set16(pi->d11core, D11REGOFFS(phyregdata), val); - pi->phy_wreg = 0; -} - -void mod_phy_reg(struct brcms_phy *pi, u16 addr, u16 mask, u16 val) -{ - val &= mask; - bcma_wflush16(pi->d11core, D11REGOFFS(phyregaddr), addr); - bcma_maskset16(pi->d11core, D11REGOFFS(phyregdata), ~mask, val); - pi->phy_wreg = 0; -} - -static void wlc_set_phy_uninitted(struct brcms_phy *pi) -{ - int i, j; - - pi->initialized = false; - - pi->tx_vos = 0xffff; - pi->nrssi_table_delta = 0x7fffffff; - pi->rc_cal = 0xffff; - pi->mintxbias = 0xffff; - pi->txpwridx = -1; - if (ISNPHY(pi)) { - pi->phy_spuravoid = SPURAVOID_DISABLE; - - if (NREV_GE(pi->pubpi.phy_rev, 3) - && NREV_LT(pi->pubpi.phy_rev, 7)) - pi->phy_spuravoid = SPURAVOID_AUTO; - - pi->nphy_papd_skip = 0; - pi->nphy_papd_epsilon_offset[0] = 0xf588; - pi->nphy_papd_epsilon_offset[1] = 0xf588; - pi->nphy_txpwr_idx[0] = 128; - pi->nphy_txpwr_idx[1] = 128; - pi->nphy_txpwrindex[0].index_internal = 40; - pi->nphy_txpwrindex[1].index_internal = 40; - pi->phy_pabias = 0; - } else { - pi->phy_spuravoid = SPURAVOID_AUTO; - } - pi->radiopwr = 0xffff; - for (i = 0; i < STATIC_NUM_RF; i++) { - for (j = 0; j < STATIC_NUM_BB; j++) - pi->stats_11b_txpower[i][j] = -1; - } -} - -struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp) -{ - struct shared_phy *sh; - - sh = kzalloc(sizeof(struct shared_phy), GFP_ATOMIC); - if (sh == NULL) - return NULL; - - sh->physhim = shp->physhim; - sh->unit = shp->unit; - sh->corerev = shp->corerev; - - sh->vid = shp->vid; - sh->did = shp->did; - sh->chip = shp->chip; - sh->chiprev = shp->chiprev; - sh->chippkg = shp->chippkg; - sh->sromrev = shp->sromrev; - sh->boardtype = shp->boardtype; - sh->boardrev = shp->boardrev; - sh->boardflags = shp->boardflags; - sh->boardflags2 = shp->boardflags2; - - sh->fast_timer = PHY_SW_TIMER_FAST; - sh->slow_timer = PHY_SW_TIMER_SLOW; - sh->glacial_timer = PHY_SW_TIMER_GLACIAL; - - sh->rssi_mode = RSSI_ANT_MERGE_MAX; - - return sh; -} - -static void wlc_phy_timercb_phycal(struct brcms_phy *pi) -{ - uint delay = 5; - - if (PHY_PERICAL_MPHASE_PENDING(pi)) { - if (!pi->sh->up) { - wlc_phy_cal_perical_mphase_reset(pi); - return; - } - - if (SCAN_RM_IN_PROGRESS(pi) || PLT_INPROG_PHY(pi)) { - - delay = 1000; - wlc_phy_cal_perical_mphase_restart(pi); - } else - wlc_phy_cal_perical_nphy_run(pi, PHY_PERICAL_AUTO); - wlapi_add_timer(pi->phycal_timer, delay, 0); - return; - } - -} - -static u32 wlc_phy_get_radio_ver(struct brcms_phy *pi) -{ - u32 ver; - - ver = read_radio_id(pi); - - return ver; -} - -struct brcms_phy_pub * -wlc_phy_attach(struct shared_phy *sh, struct bcma_device *d11core, - int bandtype, struct wiphy *wiphy) -{ - struct brcms_phy *pi; - u32 sflags = 0; - uint phyversion; - u32 idcode; - int i; - - if (D11REV_IS(sh->corerev, 4)) - sflags = SISF_2G_PHY | SISF_5G_PHY; - else - sflags = bcma_aread32(d11core, BCMA_IOST); - - if (bandtype == BRCM_BAND_5G) { - if ((sflags & (SISF_5G_PHY | SISF_DB_PHY)) == 0) - return NULL; - } - - pi = sh->phy_head; - if ((sflags & SISF_DB_PHY) && pi) { - wlapi_bmac_corereset(pi->sh->physhim, pi->pubpi.coreflags); - pi->refcnt++; - return &pi->pubpi_ro; - } - - pi = kzalloc(sizeof(struct brcms_phy), GFP_ATOMIC); - if (pi == NULL) - return NULL; - pi->wiphy = wiphy; - pi->d11core = d11core; - pi->sh = sh; - pi->phy_init_por = true; - pi->phy_wreg_limit = PHY_WREG_LIMIT; - - pi->txpwr_percent = 100; - - pi->do_initcal = true; - - pi->phycal_tempdelta = 0; - - if (bandtype == BRCM_BAND_2G && (sflags & SISF_2G_PHY)) - pi->pubpi.coreflags = SICF_GMODE; - - wlapi_bmac_corereset(pi->sh->physhim, pi->pubpi.coreflags); - phyversion = bcma_read16(pi->d11core, D11REGOFFS(phyversion)); - - pi->pubpi.phy_type = PHY_TYPE(phyversion); - pi->pubpi.phy_rev = phyversion & PV_PV_MASK; - - if (pi->pubpi.phy_type == PHY_TYPE_LCNXN) { - pi->pubpi.phy_type = PHY_TYPE_N; - pi->pubpi.phy_rev += LCNXN_BASEREV; - } - pi->pubpi.phy_corenum = PHY_CORE_NUM_2; - pi->pubpi.ana_rev = (phyversion & PV_AV_MASK) >> PV_AV_SHIFT; - - if (pi->pubpi.phy_type != PHY_TYPE_N && - pi->pubpi.phy_type != PHY_TYPE_LCN) - goto err; - - if (bandtype == BRCM_BAND_5G) { - if (!ISNPHY(pi)) - goto err; - } else if (!ISNPHY(pi) && !ISLCNPHY(pi)) { - goto err; - } - - wlc_phy_anacore((struct brcms_phy_pub *) pi, ON); - - idcode = wlc_phy_get_radio_ver(pi); - pi->pubpi.radioid = - (idcode & IDCODE_ID_MASK) >> IDCODE_ID_SHIFT; - pi->pubpi.radiorev = - (idcode & IDCODE_REV_MASK) >> IDCODE_REV_SHIFT; - pi->pubpi.radiover = - (idcode & IDCODE_VER_MASK) >> IDCODE_VER_SHIFT; - if (!VALID_RADIO(pi, pi->pubpi.radioid)) - goto err; - - wlc_phy_switch_radio((struct brcms_phy_pub *) pi, OFF); - - wlc_set_phy_uninitted(pi); - - pi->bw = WL_CHANSPEC_BW_20; - pi->radio_chanspec = (bandtype == BRCM_BAND_2G) ? - ch20mhz_chspec(1) : ch20mhz_chspec(36); - - pi->rxiq_samps = PHY_NOISE_SAMPLE_LOG_NUM_NPHY; - pi->rxiq_antsel = ANT_RX_DIV_DEF; - - pi->watchdog_override = true; - - pi->cal_type_override = PHY_PERICAL_AUTO; - - pi->nphy_saved_noisevars.bufcount = 0; - - if (ISNPHY(pi)) - pi->min_txpower = PHY_TXPWR_MIN_NPHY; - else - pi->min_txpower = PHY_TXPWR_MIN; - - pi->sh->phyrxchain = 0x3; - - pi->rx2tx_biasentry = -1; - - pi->phy_txcore_disable_temp = PHY_CHAIN_TX_DISABLE_TEMP; - pi->phy_txcore_enable_temp = - PHY_CHAIN_TX_DISABLE_TEMP - PHY_HYSTERESIS_DELTATEMP; - pi->phy_tempsense_offset = 0; - pi->phy_txcore_heatedup = false; - - pi->nphy_lastcal_temp = -50; - - pi->phynoise_polling = true; - if (ISNPHY(pi) || ISLCNPHY(pi)) - pi->phynoise_polling = false; - - for (i = 0; i < TXP_NUM_RATES; i++) { - pi->txpwr_limit[i] = BRCMS_TXPWR_MAX; - pi->txpwr_env_limit[i] = BRCMS_TXPWR_MAX; - pi->tx_user_target[i] = BRCMS_TXPWR_MAX; - } - - pi->radiopwr_override = RADIOPWR_OVERRIDE_DEF; - - pi->user_txpwr_at_rfport = false; - - if (ISNPHY(pi)) { - - pi->phycal_timer = wlapi_init_timer(pi->sh->physhim, - wlc_phy_timercb_phycal, - pi, "phycal"); - if (!pi->phycal_timer) - goto err; - - if (!wlc_phy_attach_nphy(pi)) - goto err; - - } else if (ISLCNPHY(pi)) { - if (!wlc_phy_attach_lcnphy(pi)) - goto err; - - } - - pi->refcnt++; - pi->next = pi->sh->phy_head; - sh->phy_head = pi; - - memcpy(&pi->pubpi_ro, &pi->pubpi, sizeof(struct brcms_phy_pub)); - - return &pi->pubpi_ro; - -err: - kfree(pi); - return NULL; -} - -void wlc_phy_detach(struct brcms_phy_pub *pih) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - if (pih) { - if (--pi->refcnt) - return; - - if (pi->phycal_timer) { - wlapi_free_timer(pi->phycal_timer); - pi->phycal_timer = NULL; - } - - if (pi->sh->phy_head == pi) - pi->sh->phy_head = pi->next; - else if (pi->sh->phy_head->next == pi) - pi->sh->phy_head->next = NULL; - - if (pi->pi_fptr.detach) - (pi->pi_fptr.detach)(pi); - - kfree(pi); - } -} - -bool -wlc_phy_get_phyversion(struct brcms_phy_pub *pih, u16 *phytype, u16 *phyrev, - u16 *radioid, u16 *radiover) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - *phytype = (u16) pi->pubpi.phy_type; - *phyrev = (u16) pi->pubpi.phy_rev; - *radioid = pi->pubpi.radioid; - *radiover = pi->pubpi.radiorev; - - return true; -} - -bool wlc_phy_get_encore(struct brcms_phy_pub *pih) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - return pi->pubpi.abgphy_encore; -} - -u32 wlc_phy_get_coreflags(struct brcms_phy_pub *pih) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - return pi->pubpi.coreflags; -} - -void wlc_phy_anacore(struct brcms_phy_pub *pih, bool on) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - if (ISNPHY(pi)) { - if (on) { - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - write_phy_reg(pi, 0xa6, 0x0d); - write_phy_reg(pi, 0x8f, 0x0); - write_phy_reg(pi, 0xa7, 0x0d); - write_phy_reg(pi, 0xa5, 0x0); - } else { - write_phy_reg(pi, 0xa5, 0x0); - } - } else { - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - write_phy_reg(pi, 0x8f, 0x07ff); - write_phy_reg(pi, 0xa6, 0x0fd); - write_phy_reg(pi, 0xa5, 0x07ff); - write_phy_reg(pi, 0xa7, 0x0fd); - } else { - write_phy_reg(pi, 0xa5, 0x7fff); - } - } - } else if (ISLCNPHY(pi)) { - if (on) { - and_phy_reg(pi, 0x43b, - ~((0x1 << 0) | (0x1 << 1) | (0x1 << 2))); - } else { - or_phy_reg(pi, 0x43c, - (0x1 << 0) | (0x1 << 1) | (0x1 << 2)); - or_phy_reg(pi, 0x43b, - (0x1 << 0) | (0x1 << 1) | (0x1 << 2)); - } - } -} - -u32 wlc_phy_clk_bwbits(struct brcms_phy_pub *pih) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - u32 phy_bw_clkbits = 0; - - if (pi && (ISNPHY(pi) || ISLCNPHY(pi))) { - switch (pi->bw) { - case WL_CHANSPEC_BW_10: - phy_bw_clkbits = SICF_BW10; - break; - case WL_CHANSPEC_BW_20: - phy_bw_clkbits = SICF_BW20; - break; - case WL_CHANSPEC_BW_40: - phy_bw_clkbits = SICF_BW40; - break; - default: - break; - } - } - - return phy_bw_clkbits; -} - -void wlc_phy_por_inform(struct brcms_phy_pub *ppi) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - pi->phy_init_por = true; -} - -void wlc_phy_edcrs_lock(struct brcms_phy_pub *pih, bool lock) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - pi->edcrs_threshold_lock = lock; - - write_phy_reg(pi, 0x22c, 0x46b); - write_phy_reg(pi, 0x22d, 0x46b); - write_phy_reg(pi, 0x22e, 0x3c0); - write_phy_reg(pi, 0x22f, 0x3c0); -} - -void wlc_phy_initcal_enable(struct brcms_phy_pub *pih, bool initcal) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - pi->do_initcal = initcal; -} - -void wlc_phy_hw_clk_state_upd(struct brcms_phy_pub *pih, bool newstate) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - if (!pi || !pi->sh) - return; - - pi->sh->clk = newstate; -} - -void wlc_phy_hw_state_upd(struct brcms_phy_pub *pih, bool newstate) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - if (!pi || !pi->sh) - return; - - pi->sh->up = newstate; -} - -void wlc_phy_init(struct brcms_phy_pub *pih, u16 chanspec) -{ - u32 mc; - void (*phy_init)(struct brcms_phy *) = NULL; - struct brcms_phy *pi = (struct brcms_phy *) pih; - - if (pi->init_in_progress) - return; - - pi->init_in_progress = true; - - pi->radio_chanspec = chanspec; - - mc = bcma_read32(pi->d11core, D11REGOFFS(maccontrol)); - if (WARN(mc & MCTL_EN_MAC, "HW error MAC running on init")) - return; - - if (!(pi->measure_hold & PHY_HOLD_FOR_SCAN)) - pi->measure_hold |= PHY_HOLD_FOR_NOT_ASSOC; - - if (WARN(!(bcma_aread32(pi->d11core, BCMA_IOST) & SISF_FCLKA), - "HW error SISF_FCLKA\n")) - return; - - phy_init = pi->pi_fptr.init; - - if (phy_init == NULL) - return; - - wlc_phy_anacore(pih, ON); - - if (CHSPEC_BW(pi->radio_chanspec) != pi->bw) - wlapi_bmac_bw_set(pi->sh->physhim, - CHSPEC_BW(pi->radio_chanspec)); - - pi->nphy_gain_boost = true; - - wlc_phy_switch_radio((struct brcms_phy_pub *) pi, ON); - - (*phy_init)(pi); - - pi->phy_init_por = false; - - if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12)) - wlc_phy_do_dummy_tx(pi, true, OFF); - - if (!(ISNPHY(pi))) - wlc_phy_txpower_update_shm(pi); - - wlc_phy_ant_rxdiv_set((struct brcms_phy_pub *) pi, pi->sh->rx_antdiv); - - pi->init_in_progress = false; -} - -void wlc_phy_cal_init(struct brcms_phy_pub *pih) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - void (*cal_init)(struct brcms_phy *) = NULL; - - if (WARN((bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & - MCTL_EN_MAC) != 0, "HW error: MAC enabled during phy cal\n")) - return; - - if (!pi->initialized) { - cal_init = pi->pi_fptr.calinit; - if (cal_init) - (*cal_init)(pi); - - pi->initialized = true; - } -} - -int wlc_phy_down(struct brcms_phy_pub *pih) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - int callbacks = 0; - - if (pi->phycal_timer - && !wlapi_del_timer(pi->phycal_timer)) - callbacks++; - - pi->nphy_iqcal_chanspec_2G = 0; - pi->nphy_iqcal_chanspec_5G = 0; - - return callbacks; -} - -void -wlc_phy_table_addr(struct brcms_phy *pi, uint tbl_id, uint tbl_offset, - u16 tblAddr, u16 tblDataHi, u16 tblDataLo) -{ - write_phy_reg(pi, tblAddr, (tbl_id << 10) | tbl_offset); - - pi->tbl_data_hi = tblDataHi; - pi->tbl_data_lo = tblDataLo; - - if (pi->sh->chip == BCMA_CHIP_ID_BCM43224 && - pi->sh->chiprev == 1) { - pi->tbl_addr = tblAddr; - pi->tbl_save_id = tbl_id; - pi->tbl_save_offset = tbl_offset; - } -} - -void wlc_phy_table_data_write(struct brcms_phy *pi, uint width, u32 val) -{ - if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) && - (pi->sh->chiprev == 1) && - (pi->tbl_save_id == NPHY_TBL_ID_ANTSWCTRLLUT)) { - read_phy_reg(pi, pi->tbl_data_lo); - - write_phy_reg(pi, pi->tbl_addr, - (pi->tbl_save_id << 10) | pi->tbl_save_offset); - pi->tbl_save_offset++; - } - - if (width == 32) { - write_phy_reg(pi, pi->tbl_data_hi, (u16) (val >> 16)); - write_phy_reg(pi, pi->tbl_data_lo, (u16) val); - } else { - write_phy_reg(pi, pi->tbl_data_lo, (u16) val); - } -} - -void -wlc_phy_write_table(struct brcms_phy *pi, const struct phytbl_info *ptbl_info, - u16 tblAddr, u16 tblDataHi, u16 tblDataLo) -{ - uint idx; - uint tbl_id = ptbl_info->tbl_id; - uint tbl_offset = ptbl_info->tbl_offset; - uint tbl_width = ptbl_info->tbl_width; - const u8 *ptbl_8b = (const u8 *)ptbl_info->tbl_ptr; - const u16 *ptbl_16b = (const u16 *)ptbl_info->tbl_ptr; - const u32 *ptbl_32b = (const u32 *)ptbl_info->tbl_ptr; - - write_phy_reg(pi, tblAddr, (tbl_id << 10) | tbl_offset); - - for (idx = 0; idx < ptbl_info->tbl_len; idx++) { - - if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) && - (pi->sh->chiprev == 1) && - (tbl_id == NPHY_TBL_ID_ANTSWCTRLLUT)) { - read_phy_reg(pi, tblDataLo); - - write_phy_reg(pi, tblAddr, - (tbl_id << 10) | (tbl_offset + idx)); - } - - if (tbl_width == 32) { - write_phy_reg(pi, tblDataHi, - (u16) (ptbl_32b[idx] >> 16)); - write_phy_reg(pi, tblDataLo, (u16) ptbl_32b[idx]); - } else if (tbl_width == 16) { - write_phy_reg(pi, tblDataLo, ptbl_16b[idx]); - } else { - write_phy_reg(pi, tblDataLo, ptbl_8b[idx]); - } - } -} - -void -wlc_phy_read_table(struct brcms_phy *pi, const struct phytbl_info *ptbl_info, - u16 tblAddr, u16 tblDataHi, u16 tblDataLo) -{ - uint idx; - uint tbl_id = ptbl_info->tbl_id; - uint tbl_offset = ptbl_info->tbl_offset; - uint tbl_width = ptbl_info->tbl_width; - u8 *ptbl_8b = (u8 *)ptbl_info->tbl_ptr; - u16 *ptbl_16b = (u16 *)ptbl_info->tbl_ptr; - u32 *ptbl_32b = (u32 *)ptbl_info->tbl_ptr; - - write_phy_reg(pi, tblAddr, (tbl_id << 10) | tbl_offset); - - for (idx = 0; idx < ptbl_info->tbl_len; idx++) { - - if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) && - (pi->sh->chiprev == 1)) { - (void)read_phy_reg(pi, tblDataLo); - - write_phy_reg(pi, tblAddr, - (tbl_id << 10) | (tbl_offset + idx)); - } - - if (tbl_width == 32) { - ptbl_32b[idx] = read_phy_reg(pi, tblDataLo); - ptbl_32b[idx] |= (read_phy_reg(pi, tblDataHi) << 16); - } else if (tbl_width == 16) { - ptbl_16b[idx] = read_phy_reg(pi, tblDataLo); - } else { - ptbl_8b[idx] = (u8) read_phy_reg(pi, tblDataLo); - } - } -} - -uint -wlc_phy_init_radio_regs_allbands(struct brcms_phy *pi, - struct radio_20xx_regs *radioregs) -{ - uint i = 0; - - do { - if (radioregs[i].do_init) - write_radio_reg(pi, radioregs[i].address, - (u16) radioregs[i].init); - - i++; - } while (radioregs[i].address != 0xffff); - - return i; -} - -uint -wlc_phy_init_radio_regs(struct brcms_phy *pi, - const struct radio_regs *radioregs, - u16 core_offset) -{ - uint i = 0; - uint count = 0; - - do { - if (CHSPEC_IS5G(pi->radio_chanspec)) { - if (radioregs[i].do_init_a) { - write_radio_reg(pi, - radioregs[i]. - address | core_offset, - (u16) radioregs[i].init_a); - if (ISNPHY(pi) && (++count % 4 == 0)) - BRCMS_PHY_WAR_PR51571(pi); - } - } else { - if (radioregs[i].do_init_g) { - write_radio_reg(pi, - radioregs[i]. - address | core_offset, - (u16) radioregs[i].init_g); - if (ISNPHY(pi) && (++count % 4 == 0)) - BRCMS_PHY_WAR_PR51571(pi); - } - } - - i++; - } while (radioregs[i].address != 0xffff); - - return i; -} - -void wlc_phy_do_dummy_tx(struct brcms_phy *pi, bool ofdm, bool pa_on) -{ -#define DUMMY_PKT_LEN 20 - struct bcma_device *core = pi->d11core; - int i, count; - u8 ofdmpkt[DUMMY_PKT_LEN] = { - 0xcc, 0x01, 0x02, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 - }; - u8 cckpkt[DUMMY_PKT_LEN] = { - 0x6e, 0x84, 0x0b, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 - }; - u32 *dummypkt; - - dummypkt = (u32 *) (ofdm ? ofdmpkt : cckpkt); - wlapi_bmac_write_template_ram(pi->sh->physhim, 0, DUMMY_PKT_LEN, - dummypkt); - - bcma_write16(core, D11REGOFFS(xmtsel), 0); - - if (D11REV_GE(pi->sh->corerev, 11)) - bcma_write16(core, D11REGOFFS(wepctl), 0x100); - else - bcma_write16(core, D11REGOFFS(wepctl), 0); - - bcma_write16(core, D11REGOFFS(txe_phyctl), - (ofdm ? 1 : 0) | PHY_TXC_ANT_0); - if (ISNPHY(pi) || ISLCNPHY(pi)) - bcma_write16(core, D11REGOFFS(txe_phyctl1), 0x1A02); - - bcma_write16(core, D11REGOFFS(txe_wm_0), 0); - bcma_write16(core, D11REGOFFS(txe_wm_1), 0); - - bcma_write16(core, D11REGOFFS(xmttplatetxptr), 0); - bcma_write16(core, D11REGOFFS(xmttxcnt), DUMMY_PKT_LEN); - - bcma_write16(core, D11REGOFFS(xmtsel), - ((8 << 8) | (1 << 5) | (1 << 2) | 2)); - - bcma_write16(core, D11REGOFFS(txe_ctl), 0); - - if (!pa_on) { - if (ISNPHY(pi)) - wlc_phy_pa_override_nphy(pi, OFF); - } - - if (ISNPHY(pi) || ISLCNPHY(pi)) - bcma_write16(core, D11REGOFFS(txe_aux), 0xD0); - else - bcma_write16(core, D11REGOFFS(txe_aux), ((1 << 5) | (1 << 4))); - - (void)bcma_read16(core, D11REGOFFS(txe_aux)); - - i = 0; - count = ofdm ? 30 : 250; - while ((i++ < count) - && (bcma_read16(core, D11REGOFFS(txe_status)) & (1 << 7))) - udelay(10); - - i = 0; - - while ((i++ < 10) && - ((bcma_read16(core, D11REGOFFS(txe_status)) & (1 << 10)) == 0)) - udelay(10); - - i = 0; - - while ((i++ < 10) && - ((bcma_read16(core, D11REGOFFS(ifsstat)) & (1 << 8)))) - udelay(10); - - if (!pa_on) { - if (ISNPHY(pi)) - wlc_phy_pa_override_nphy(pi, ON); - } -} - -void wlc_phy_hold_upd(struct brcms_phy_pub *pih, u32 id, bool set) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - if (set) - mboolset(pi->measure_hold, id); - else - mboolclr(pi->measure_hold, id); - - return; -} - -void wlc_phy_mute_upd(struct brcms_phy_pub *pih, bool mute, u32 flags) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - if (mute) - mboolset(pi->measure_hold, PHY_HOLD_FOR_MUTE); - else - mboolclr(pi->measure_hold, PHY_HOLD_FOR_MUTE); - - if (!mute && (flags & PHY_MUTE_FOR_PREISM)) - pi->nphy_perical_last = pi->sh->now - pi->sh->glacial_timer; - return; -} - -void wlc_phy_clear_tssi(struct brcms_phy_pub *pih) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - if (ISNPHY(pi)) { - return; - } else { - wlapi_bmac_write_shm(pi->sh->physhim, M_B_TSSI_0, NULL_TSSI_W); - wlapi_bmac_write_shm(pi->sh->physhim, M_B_TSSI_1, NULL_TSSI_W); - wlapi_bmac_write_shm(pi->sh->physhim, M_G_TSSI_0, NULL_TSSI_W); - wlapi_bmac_write_shm(pi->sh->physhim, M_G_TSSI_1, NULL_TSSI_W); - } -} - -static bool wlc_phy_cal_txpower_recalc_sw(struct brcms_phy *pi) -{ - return false; -} - -void wlc_phy_switch_radio(struct brcms_phy_pub *pih, bool on) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol)); - - if (ISNPHY(pi)) { - wlc_phy_switch_radio_nphy(pi, on); - } else if (ISLCNPHY(pi)) { - if (on) { - and_phy_reg(pi, 0x44c, - ~((0x1 << 8) | - (0x1 << 9) | - (0x1 << 10) | (0x1 << 11) | (0x1 << 12))); - and_phy_reg(pi, 0x4b0, ~((0x1 << 3) | (0x1 << 11))); - and_phy_reg(pi, 0x4f9, ~(0x1 << 3)); - } else { - and_phy_reg(pi, 0x44d, - ~((0x1 << 10) | - (0x1 << 11) | - (0x1 << 12) | (0x1 << 13) | (0x1 << 14))); - or_phy_reg(pi, 0x44c, - (0x1 << 8) | - (0x1 << 9) | - (0x1 << 10) | (0x1 << 11) | (0x1 << 12)); - - and_phy_reg(pi, 0x4b7, ~((0x7f << 8))); - and_phy_reg(pi, 0x4b1, ~((0x1 << 13))); - or_phy_reg(pi, 0x4b0, (0x1 << 3) | (0x1 << 11)); - and_phy_reg(pi, 0x4fa, ~((0x1 << 3))); - or_phy_reg(pi, 0x4f9, (0x1 << 3)); - } - } -} - -u16 wlc_phy_bw_state_get(struct brcms_phy_pub *ppi) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - return pi->bw; -} - -void wlc_phy_bw_state_set(struct brcms_phy_pub *ppi, u16 bw) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - pi->bw = bw; -} - -void wlc_phy_chanspec_radio_set(struct brcms_phy_pub *ppi, u16 newch) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - pi->radio_chanspec = newch; - -} - -u16 wlc_phy_chanspec_get(struct brcms_phy_pub *ppi) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - return pi->radio_chanspec; -} - -void wlc_phy_chanspec_set(struct brcms_phy_pub *ppi, u16 chanspec) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - u16 m_cur_channel; - void (*chanspec_set)(struct brcms_phy *, u16) = NULL; - m_cur_channel = CHSPEC_CHANNEL(chanspec); - if (CHSPEC_IS5G(chanspec)) - m_cur_channel |= D11_CURCHANNEL_5G; - if (CHSPEC_IS40(chanspec)) - m_cur_channel |= D11_CURCHANNEL_40; - wlapi_bmac_write_shm(pi->sh->physhim, M_CURCHANNEL, m_cur_channel); - - chanspec_set = pi->pi_fptr.chanset; - if (chanspec_set) - (*chanspec_set)(pi, chanspec); - -} - -int wlc_phy_chanspec_freq2bandrange_lpssn(uint freq) -{ - int range = -1; - - if (freq < 2500) - range = WL_CHAN_FREQ_RANGE_2G; - else if (freq <= 5320) - range = WL_CHAN_FREQ_RANGE_5GL; - else if (freq <= 5700) - range = WL_CHAN_FREQ_RANGE_5GM; - else - range = WL_CHAN_FREQ_RANGE_5GH; - - return range; -} - -int wlc_phy_chanspec_bandrange_get(struct brcms_phy *pi, u16 chanspec) -{ - int range = -1; - uint channel = CHSPEC_CHANNEL(chanspec); - uint freq = wlc_phy_channel2freq(channel); - - if (ISNPHY(pi)) - range = wlc_phy_get_chan_freq_range_nphy(pi, channel); - else if (ISLCNPHY(pi)) - range = wlc_phy_chanspec_freq2bandrange_lpssn(freq); - - return range; -} - -void wlc_phy_chanspec_ch14_widefilter_set(struct brcms_phy_pub *ppi, - bool wide_filter) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - pi->channel_14_wide_filter = wide_filter; - -} - -int wlc_phy_channel2freq(uint channel) -{ - uint i; - - for (i = 0; i < ARRAY_SIZE(chan_info_all); i++) - if (chan_info_all[i].chan == channel) - return chan_info_all[i].freq; - return 0; -} - -void -wlc_phy_chanspec_band_validch(struct brcms_phy_pub *ppi, uint band, - struct brcms_chanvec *channels) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - uint i; - uint channel; - - memset(channels, 0, sizeof(struct brcms_chanvec)); - - for (i = 0; i < ARRAY_SIZE(chan_info_all); i++) { - channel = chan_info_all[i].chan; - - if ((pi->a_band_high_disable) && (channel >= FIRST_REF5_CHANNUM) - && (channel <= LAST_REF5_CHANNUM)) - continue; - - if ((band == BRCM_BAND_2G && channel <= CH_MAX_2G_CHANNEL) || - (band == BRCM_BAND_5G && channel > CH_MAX_2G_CHANNEL)) - setbit(channels->vec, channel); - } -} - -u16 wlc_phy_chanspec_band_firstch(struct brcms_phy_pub *ppi, uint band) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - uint i; - uint channel; - u16 chspec; - - for (i = 0; i < ARRAY_SIZE(chan_info_all); i++) { - channel = chan_info_all[i].chan; - - if (ISNPHY(pi) && pi->bw == WL_CHANSPEC_BW_40) { - uint j; - - for (j = 0; j < ARRAY_SIZE(chan_info_all); j++) { - if (chan_info_all[j].chan == - channel + CH_10MHZ_APART) - break; - } - - if (j == ARRAY_SIZE(chan_info_all)) - continue; - - channel = upper_20_sb(channel); - chspec = channel | WL_CHANSPEC_BW_40 | - WL_CHANSPEC_CTL_SB_LOWER; - if (band == BRCM_BAND_2G) - chspec |= WL_CHANSPEC_BAND_2G; - else - chspec |= WL_CHANSPEC_BAND_5G; - } else - chspec = ch20mhz_chspec(channel); - - if ((pi->a_band_high_disable) && (channel >= FIRST_REF5_CHANNUM) - && (channel <= LAST_REF5_CHANNUM)) - continue; - - if ((band == BRCM_BAND_2G && channel <= CH_MAX_2G_CHANNEL) || - (band == BRCM_BAND_5G && channel > CH_MAX_2G_CHANNEL)) - return chspec; - } - - return (u16) INVCHANSPEC; -} - -int wlc_phy_txpower_get(struct brcms_phy_pub *ppi, uint *qdbm, bool *override) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - *qdbm = pi->tx_user_target[0]; - if (override != NULL) - *override = pi->txpwroverride; - return 0; -} - -void wlc_phy_txpower_target_set(struct brcms_phy_pub *ppi, - struct txpwr_limits *txpwr) -{ - bool mac_enabled = false; - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - memcpy(&pi->tx_user_target[TXP_FIRST_CCK], - &txpwr->cck[0], BRCMS_NUM_RATES_CCK); - - memcpy(&pi->tx_user_target[TXP_FIRST_OFDM], - &txpwr->ofdm[0], BRCMS_NUM_RATES_OFDM); - memcpy(&pi->tx_user_target[TXP_FIRST_OFDM_20_CDD], - &txpwr->ofdm_cdd[0], BRCMS_NUM_RATES_OFDM); - - memcpy(&pi->tx_user_target[TXP_FIRST_OFDM_40_SISO], - &txpwr->ofdm_40_siso[0], BRCMS_NUM_RATES_OFDM); - memcpy(&pi->tx_user_target[TXP_FIRST_OFDM_40_CDD], - &txpwr->ofdm_40_cdd[0], BRCMS_NUM_RATES_OFDM); - - memcpy(&pi->tx_user_target[TXP_FIRST_MCS_20_SISO], - &txpwr->mcs_20_siso[0], BRCMS_NUM_RATES_MCS_1_STREAM); - memcpy(&pi->tx_user_target[TXP_FIRST_MCS_20_CDD], - &txpwr->mcs_20_cdd[0], BRCMS_NUM_RATES_MCS_1_STREAM); - memcpy(&pi->tx_user_target[TXP_FIRST_MCS_20_STBC], - &txpwr->mcs_20_stbc[0], BRCMS_NUM_RATES_MCS_1_STREAM); - memcpy(&pi->tx_user_target[TXP_FIRST_MCS_20_SDM], - &txpwr->mcs_20_mimo[0], BRCMS_NUM_RATES_MCS_2_STREAM); - - memcpy(&pi->tx_user_target[TXP_FIRST_MCS_40_SISO], - &txpwr->mcs_40_siso[0], BRCMS_NUM_RATES_MCS_1_STREAM); - memcpy(&pi->tx_user_target[TXP_FIRST_MCS_40_CDD], - &txpwr->mcs_40_cdd[0], BRCMS_NUM_RATES_MCS_1_STREAM); - memcpy(&pi->tx_user_target[TXP_FIRST_MCS_40_STBC], - &txpwr->mcs_40_stbc[0], BRCMS_NUM_RATES_MCS_1_STREAM); - memcpy(&pi->tx_user_target[TXP_FIRST_MCS_40_SDM], - &txpwr->mcs_40_mimo[0], BRCMS_NUM_RATES_MCS_2_STREAM); - - if (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & MCTL_EN_MAC) - mac_enabled = true; - - if (mac_enabled) - wlapi_suspend_mac_and_wait(pi->sh->physhim); - - wlc_phy_txpower_recalc_target(pi); - wlc_phy_cal_txpower_recalc_sw(pi); - - if (mac_enabled) - wlapi_enable_mac(pi->sh->physhim); -} - -int wlc_phy_txpower_set(struct brcms_phy_pub *ppi, uint qdbm, bool override) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - int i; - - if (qdbm > 127) - return -EINVAL; - - for (i = 0; i < TXP_NUM_RATES; i++) - pi->tx_user_target[i] = (u8) qdbm; - - pi->txpwroverride = false; - - if (pi->sh->up) { - if (!SCAN_INPROG_PHY(pi)) { - bool suspend; - - suspend = (0 == (bcma_read32(pi->d11core, - D11REGOFFS(maccontrol)) & - MCTL_EN_MAC)); - - if (!suspend) - wlapi_suspend_mac_and_wait(pi->sh->physhim); - - wlc_phy_txpower_recalc_target(pi); - wlc_phy_cal_txpower_recalc_sw(pi); - - if (!suspend) - wlapi_enable_mac(pi->sh->physhim); - } - } - return 0; -} - -void -wlc_phy_txpower_sromlimit(struct brcms_phy_pub *ppi, uint channel, u8 *min_pwr, - u8 *max_pwr, int txp_rate_idx) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - uint i; - - *min_pwr = pi->min_txpower * BRCMS_TXPWR_DB_FACTOR; - - if (ISNPHY(pi)) { - if (txp_rate_idx < 0) - txp_rate_idx = TXP_FIRST_CCK; - wlc_phy_txpower_sromlimit_get_nphy(pi, channel, max_pwr, - (u8) txp_rate_idx); - - } else if ((channel <= CH_MAX_2G_CHANNEL)) { - if (txp_rate_idx < 0) - txp_rate_idx = TXP_FIRST_CCK; - *max_pwr = pi->tx_srom_max_rate_2g[txp_rate_idx]; - } else { - - *max_pwr = BRCMS_TXPWR_MAX; - - if (txp_rate_idx < 0) - txp_rate_idx = TXP_FIRST_OFDM; - - for (i = 0; i < ARRAY_SIZE(chan_info_all); i++) { - if (channel == chan_info_all[i].chan) - break; - } - - if (pi->hwtxpwr) { - *max_pwr = pi->hwtxpwr[i]; - } else { - - if ((i >= FIRST_MID_5G_CHAN) && (i <= LAST_MID_5G_CHAN)) - *max_pwr = - pi->tx_srom_max_rate_5g_mid[txp_rate_idx]; - if ((i >= FIRST_HIGH_5G_CHAN) - && (i <= LAST_HIGH_5G_CHAN)) - *max_pwr = - pi->tx_srom_max_rate_5g_hi[txp_rate_idx]; - if ((i >= FIRST_LOW_5G_CHAN) && (i <= LAST_LOW_5G_CHAN)) - *max_pwr = - pi->tx_srom_max_rate_5g_low[txp_rate_idx]; - } - } -} - -void -wlc_phy_txpower_sromlimit_max_get(struct brcms_phy_pub *ppi, uint chan, - u8 *max_txpwr, u8 *min_txpwr) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - u8 tx_pwr_max = 0; - u8 tx_pwr_min = 255; - u8 max_num_rate; - u8 maxtxpwr, mintxpwr, rate, pactrl; - - pactrl = 0; - - max_num_rate = ISNPHY(pi) ? TXP_NUM_RATES : - ISLCNPHY(pi) ? (TXP_LAST_SISO_MCS_20 + - 1) : (TXP_LAST_OFDM + 1); - - for (rate = 0; rate < max_num_rate; rate++) { - - wlc_phy_txpower_sromlimit(ppi, chan, &mintxpwr, &maxtxpwr, - rate); - - maxtxpwr = (maxtxpwr > pactrl) ? (maxtxpwr - pactrl) : 0; - - maxtxpwr = (maxtxpwr > 6) ? (maxtxpwr - 6) : 0; - - tx_pwr_max = max(tx_pwr_max, maxtxpwr); - tx_pwr_min = min(tx_pwr_min, maxtxpwr); - } - *max_txpwr = tx_pwr_max; - *min_txpwr = tx_pwr_min; -} - -void -wlc_phy_txpower_boardlimit_band(struct brcms_phy_pub *ppi, uint bandunit, - s32 *max_pwr, s32 *min_pwr, u32 *step_pwr) -{ - return; -} - -u8 wlc_phy_txpower_get_target_min(struct brcms_phy_pub *ppi) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - return pi->tx_power_min; -} - -u8 wlc_phy_txpower_get_target_max(struct brcms_phy_pub *ppi) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - return pi->tx_power_max; -} - -static s8 wlc_phy_env_measure_vbat(struct brcms_phy *pi) -{ - if (ISLCNPHY(pi)) - return wlc_lcnphy_vbatsense(pi, 0); - else - return 0; -} - -static s8 wlc_phy_env_measure_temperature(struct brcms_phy *pi) -{ - if (ISLCNPHY(pi)) - return wlc_lcnphy_tempsense_degree(pi, 0); - else - return 0; -} - -static void wlc_phy_upd_env_txpwr_rate_limits(struct brcms_phy *pi, u32 band) -{ - u8 i; - s8 temp, vbat; - - for (i = 0; i < TXP_NUM_RATES; i++) - pi->txpwr_env_limit[i] = BRCMS_TXPWR_MAX; - - vbat = wlc_phy_env_measure_vbat(pi); - temp = wlc_phy_env_measure_temperature(pi); - -} - -static s8 -wlc_user_txpwr_antport_to_rfport(struct brcms_phy *pi, uint chan, u32 band, - u8 rate) -{ - s8 offset = 0; - - if (!pi->user_txpwr_at_rfport) - return offset; - return offset; -} - -void wlc_phy_txpower_recalc_target(struct brcms_phy *pi) -{ - u8 maxtxpwr, mintxpwr, rate, pactrl; - uint target_chan; - u8 tx_pwr_target[TXP_NUM_RATES]; - u8 tx_pwr_max = 0; - u8 tx_pwr_min = 255; - u8 tx_pwr_max_rate_ind = 0; - u8 max_num_rate; - u8 start_rate = 0; - u16 chspec; - u32 band = CHSPEC2BAND(pi->radio_chanspec); - void (*txpwr_recalc_fn)(struct brcms_phy *) = NULL; - - chspec = pi->radio_chanspec; - if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) - target_chan = CHSPEC_CHANNEL(chspec); - else if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) - target_chan = upper_20_sb(CHSPEC_CHANNEL(chspec)); - else - target_chan = lower_20_sb(CHSPEC_CHANNEL(chspec)); - - pactrl = 0; - if (ISLCNPHY(pi)) { - u32 offset_mcs, i; - - if (CHSPEC_IS40(pi->radio_chanspec)) { - offset_mcs = pi->mcs40_po; - for (i = TXP_FIRST_SISO_MCS_20; - i <= TXP_LAST_SISO_MCS_20; i++) { - pi->tx_srom_max_rate_2g[i - 8] = - pi->tx_srom_max_2g - - ((offset_mcs & 0xf) * 2); - offset_mcs >>= 4; - } - } else { - offset_mcs = pi->mcs20_po; - for (i = TXP_FIRST_SISO_MCS_20; - i <= TXP_LAST_SISO_MCS_20; i++) { - pi->tx_srom_max_rate_2g[i - 8] = - pi->tx_srom_max_2g - - ((offset_mcs & 0xf) * 2); - offset_mcs >>= 4; - } - } - } - - max_num_rate = ((ISNPHY(pi)) ? (TXP_NUM_RATES) : - ((ISLCNPHY(pi)) ? - (TXP_LAST_SISO_MCS_20 + 1) : (TXP_LAST_OFDM + 1))); - - wlc_phy_upd_env_txpwr_rate_limits(pi, band); - - for (rate = start_rate; rate < max_num_rate; rate++) { - - tx_pwr_target[rate] = pi->tx_user_target[rate]; - - if (pi->user_txpwr_at_rfport) - tx_pwr_target[rate] += - wlc_user_txpwr_antport_to_rfport(pi, - target_chan, - band, - rate); - - wlc_phy_txpower_sromlimit((struct brcms_phy_pub *) pi, - target_chan, - &mintxpwr, &maxtxpwr, rate); - - maxtxpwr = min(maxtxpwr, pi->txpwr_limit[rate]); - - maxtxpwr = (maxtxpwr > pactrl) ? (maxtxpwr - pactrl) : 0; - - maxtxpwr = (maxtxpwr > 6) ? (maxtxpwr - 6) : 0; - - maxtxpwr = min(maxtxpwr, tx_pwr_target[rate]); - - if (pi->txpwr_percent <= 100) - maxtxpwr = (maxtxpwr * pi->txpwr_percent) / 100; - - tx_pwr_target[rate] = max(maxtxpwr, mintxpwr); - - tx_pwr_target[rate] = - min(tx_pwr_target[rate], pi->txpwr_env_limit[rate]); - - if (tx_pwr_target[rate] > tx_pwr_max) - tx_pwr_max_rate_ind = rate; - - tx_pwr_max = max(tx_pwr_max, tx_pwr_target[rate]); - tx_pwr_min = min(tx_pwr_min, tx_pwr_target[rate]); - } - - memset(pi->tx_power_offset, 0, sizeof(pi->tx_power_offset)); - pi->tx_power_max = tx_pwr_max; - pi->tx_power_min = tx_pwr_min; - pi->tx_power_max_rate_ind = tx_pwr_max_rate_ind; - for (rate = 0; rate < max_num_rate; rate++) { - - pi->tx_power_target[rate] = tx_pwr_target[rate]; - - if (!pi->hwpwrctrl || ISNPHY(pi)) - pi->tx_power_offset[rate] = - pi->tx_power_max - pi->tx_power_target[rate]; - else - pi->tx_power_offset[rate] = - pi->tx_power_target[rate] - pi->tx_power_min; - } - - txpwr_recalc_fn = pi->pi_fptr.txpwrrecalc; - if (txpwr_recalc_fn) - (*txpwr_recalc_fn)(pi); -} - -static void -wlc_phy_txpower_reg_limit_calc(struct brcms_phy *pi, struct txpwr_limits *txpwr, - u16 chanspec) -{ - u8 tmp_txpwr_limit[2 * BRCMS_NUM_RATES_OFDM]; - u8 *txpwr_ptr1 = NULL, *txpwr_ptr2 = NULL; - int rate_start_index = 0, rate1, rate2, k; - - for (rate1 = WL_TX_POWER_CCK_FIRST, rate2 = 0; - rate2 < WL_TX_POWER_CCK_NUM; rate1++, rate2++) - pi->txpwr_limit[rate1] = txpwr->cck[rate2]; - - for (rate1 = WL_TX_POWER_OFDM_FIRST, rate2 = 0; - rate2 < WL_TX_POWER_OFDM_NUM; rate1++, rate2++) - pi->txpwr_limit[rate1] = txpwr->ofdm[rate2]; - - if (ISNPHY(pi)) { - - for (k = 0; k < 4; k++) { - switch (k) { - case 0: - - txpwr_ptr1 = txpwr->mcs_20_siso; - txpwr_ptr2 = txpwr->ofdm; - rate_start_index = WL_TX_POWER_OFDM_FIRST; - break; - case 1: - - txpwr_ptr1 = txpwr->mcs_20_cdd; - txpwr_ptr2 = txpwr->ofdm_cdd; - rate_start_index = WL_TX_POWER_OFDM20_CDD_FIRST; - break; - case 2: - - txpwr_ptr1 = txpwr->mcs_40_siso; - txpwr_ptr2 = txpwr->ofdm_40_siso; - rate_start_index = - WL_TX_POWER_OFDM40_SISO_FIRST; - break; - case 3: - - txpwr_ptr1 = txpwr->mcs_40_cdd; - txpwr_ptr2 = txpwr->ofdm_40_cdd; - rate_start_index = WL_TX_POWER_OFDM40_CDD_FIRST; - break; - } - - for (rate2 = 0; rate2 < BRCMS_NUM_RATES_OFDM; - rate2++) { - tmp_txpwr_limit[rate2] = 0; - tmp_txpwr_limit[BRCMS_NUM_RATES_OFDM + rate2] = - txpwr_ptr1[rate2]; - } - wlc_phy_mcs_to_ofdm_powers_nphy( - tmp_txpwr_limit, 0, - BRCMS_NUM_RATES_OFDM - - 1, BRCMS_NUM_RATES_OFDM); - for (rate1 = rate_start_index, rate2 = 0; - rate2 < BRCMS_NUM_RATES_OFDM; rate1++, rate2++) - pi->txpwr_limit[rate1] = - min(txpwr_ptr2[rate2], - tmp_txpwr_limit[rate2]); - } - - for (k = 0; k < 4; k++) { - switch (k) { - case 0: - - txpwr_ptr1 = txpwr->ofdm; - txpwr_ptr2 = txpwr->mcs_20_siso; - rate_start_index = WL_TX_POWER_MCS20_SISO_FIRST; - break; - case 1: - - txpwr_ptr1 = txpwr->ofdm_cdd; - txpwr_ptr2 = txpwr->mcs_20_cdd; - rate_start_index = WL_TX_POWER_MCS20_CDD_FIRST; - break; - case 2: - - txpwr_ptr1 = txpwr->ofdm_40_siso; - txpwr_ptr2 = txpwr->mcs_40_siso; - rate_start_index = WL_TX_POWER_MCS40_SISO_FIRST; - break; - case 3: - - txpwr_ptr1 = txpwr->ofdm_40_cdd; - txpwr_ptr2 = txpwr->mcs_40_cdd; - rate_start_index = WL_TX_POWER_MCS40_CDD_FIRST; - break; - } - for (rate2 = 0; rate2 < BRCMS_NUM_RATES_OFDM; - rate2++) { - tmp_txpwr_limit[rate2] = 0; - tmp_txpwr_limit[BRCMS_NUM_RATES_OFDM + rate2] = - txpwr_ptr1[rate2]; - } - wlc_phy_ofdm_to_mcs_powers_nphy( - tmp_txpwr_limit, 0, - BRCMS_NUM_RATES_OFDM - - 1, BRCMS_NUM_RATES_OFDM); - for (rate1 = rate_start_index, rate2 = 0; - rate2 < BRCMS_NUM_RATES_MCS_1_STREAM; - rate1++, rate2++) - pi->txpwr_limit[rate1] = - min(txpwr_ptr2[rate2], - tmp_txpwr_limit[rate2]); - } - - for (k = 0; k < 2; k++) { - switch (k) { - case 0: - - rate_start_index = WL_TX_POWER_MCS20_STBC_FIRST; - txpwr_ptr1 = txpwr->mcs_20_stbc; - break; - case 1: - - rate_start_index = WL_TX_POWER_MCS40_STBC_FIRST; - txpwr_ptr1 = txpwr->mcs_40_stbc; - break; - } - for (rate1 = rate_start_index, rate2 = 0; - rate2 < BRCMS_NUM_RATES_MCS_1_STREAM; - rate1++, rate2++) - pi->txpwr_limit[rate1] = txpwr_ptr1[rate2]; - } - - for (k = 0; k < 2; k++) { - switch (k) { - case 0: - - rate_start_index = WL_TX_POWER_MCS20_SDM_FIRST; - txpwr_ptr1 = txpwr->mcs_20_mimo; - break; - case 1: - - rate_start_index = WL_TX_POWER_MCS40_SDM_FIRST; - txpwr_ptr1 = txpwr->mcs_40_mimo; - break; - } - for (rate1 = rate_start_index, rate2 = 0; - rate2 < BRCMS_NUM_RATES_MCS_2_STREAM; - rate1++, rate2++) - pi->txpwr_limit[rate1] = txpwr_ptr1[rate2]; - } - - pi->txpwr_limit[WL_TX_POWER_MCS_32] = txpwr->mcs32; - - pi->txpwr_limit[WL_TX_POWER_MCS40_CDD_FIRST] = - min(pi->txpwr_limit[WL_TX_POWER_MCS40_CDD_FIRST], - pi->txpwr_limit[WL_TX_POWER_MCS_32]); - pi->txpwr_limit[WL_TX_POWER_MCS_32] = - pi->txpwr_limit[WL_TX_POWER_MCS40_CDD_FIRST]; - } -} - -void wlc_phy_txpwr_percent_set(struct brcms_phy_pub *ppi, u8 txpwr_percent) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - pi->txpwr_percent = txpwr_percent; -} - -void wlc_phy_machwcap_set(struct brcms_phy_pub *ppi, u32 machwcap) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - pi->sh->machwcap = machwcap; -} - -void wlc_phy_runbist_config(struct brcms_phy_pub *ppi, bool start_end) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - u16 rxc; - rxc = 0; - - if (start_end == ON) { - if (!ISNPHY(pi)) - return; - - if (NREV_IS(pi->pubpi.phy_rev, 3) - || NREV_IS(pi->pubpi.phy_rev, 4)) { - bcma_wflush16(pi->d11core, D11REGOFFS(phyregaddr), - 0xa0); - bcma_set16(pi->d11core, D11REGOFFS(phyregdata), - 0x1 << 15); - } - } else { - if (NREV_IS(pi->pubpi.phy_rev, 3) - || NREV_IS(pi->pubpi.phy_rev, 4)) { - bcma_wflush16(pi->d11core, D11REGOFFS(phyregaddr), - 0xa0); - bcma_write16(pi->d11core, D11REGOFFS(phyregdata), rxc); - } - - wlc_phy_por_inform(ppi); - } -} - -void -wlc_phy_txpower_limit_set(struct brcms_phy_pub *ppi, struct txpwr_limits *txpwr, - u16 chanspec) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - wlc_phy_txpower_reg_limit_calc(pi, txpwr, chanspec); - - if (ISLCNPHY(pi)) { - int i, j; - for (i = TXP_FIRST_OFDM_20_CDD, j = 0; - j < BRCMS_NUM_RATES_MCS_1_STREAM; i++, j++) { - if (txpwr->mcs_20_siso[j]) - pi->txpwr_limit[i] = txpwr->mcs_20_siso[j]; - else - pi->txpwr_limit[i] = txpwr->ofdm[j]; - } - } - - wlapi_suspend_mac_and_wait(pi->sh->physhim); - - wlc_phy_txpower_recalc_target(pi); - wlc_phy_cal_txpower_recalc_sw(pi); - wlapi_enable_mac(pi->sh->physhim); -} - -void wlc_phy_ofdm_rateset_war(struct brcms_phy_pub *pih, bool war) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - pi->ofdm_rateset_war = war; -} - -void wlc_phy_bf_preempt_enable(struct brcms_phy_pub *pih, bool bf_preempt) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - pi->bf_preempt_4306 = bf_preempt; -} - -void wlc_phy_txpower_update_shm(struct brcms_phy *pi) -{ - int j; - if (ISNPHY(pi)) - return; - - if (!pi->sh->clk) - return; - - if (pi->hwpwrctrl) { - u16 offset; - - wlapi_bmac_write_shm(pi->sh->physhim, M_TXPWR_MAX, 63); - wlapi_bmac_write_shm(pi->sh->physhim, M_TXPWR_N, - 1 << NUM_TSSI_FRAMES); - - wlapi_bmac_write_shm(pi->sh->physhim, M_TXPWR_TARGET, - pi->tx_power_min << NUM_TSSI_FRAMES); - - wlapi_bmac_write_shm(pi->sh->physhim, M_TXPWR_CUR, - pi->hwpwr_txcur); - - for (j = TXP_FIRST_OFDM; j <= TXP_LAST_OFDM; j++) { - const u8 ucode_ofdm_rates[] = { - 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c - }; - offset = wlapi_bmac_rate_shm_offset( - pi->sh->physhim, - ucode_ofdm_rates[j - TXP_FIRST_OFDM]); - wlapi_bmac_write_shm(pi->sh->physhim, offset + 6, - pi->tx_power_offset[j]); - wlapi_bmac_write_shm(pi->sh->physhim, offset + 14, - -(pi->tx_power_offset[j] / 2)); - } - - wlapi_bmac_mhf(pi->sh->physhim, MHF2, MHF2_HWPWRCTL, - MHF2_HWPWRCTL, BRCM_BAND_ALL); - } else { - int i; - - for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) - pi->tx_power_offset[i] = - (u8) roundup(pi->tx_power_offset[i], 8); - wlapi_bmac_write_shm(pi->sh->physhim, M_OFDM_OFFSET, - (u16) - ((pi->tx_power_offset[TXP_FIRST_OFDM] - + 7) >> 3)); - } -} - -bool wlc_phy_txpower_hw_ctrl_get(struct brcms_phy_pub *ppi) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - if (ISNPHY(pi)) - return pi->nphy_txpwrctrl; - else - return pi->hwpwrctrl; -} - -void wlc_phy_txpower_hw_ctrl_set(struct brcms_phy_pub *ppi, bool hwpwrctrl) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - bool suspend; - - if (!pi->hwpwrctrl_capable) - return; - - pi->hwpwrctrl = hwpwrctrl; - pi->nphy_txpwrctrl = hwpwrctrl; - pi->txpwrctrl = hwpwrctrl; - - if (ISNPHY(pi)) { - suspend = (0 == (bcma_read32(pi->d11core, - D11REGOFFS(maccontrol)) & - MCTL_EN_MAC)); - if (!suspend) - wlapi_suspend_mac_and_wait(pi->sh->physhim); - - wlc_phy_txpwrctrl_enable_nphy(pi, pi->nphy_txpwrctrl); - if (pi->nphy_txpwrctrl == PHY_TPC_HW_OFF) - wlc_phy_txpwr_fixpower_nphy(pi); - else - mod_phy_reg(pi, 0x1e7, (0x7f << 0), - pi->saved_txpwr_idx); - - if (!suspend) - wlapi_enable_mac(pi->sh->physhim); - } -} - -void wlc_phy_txpower_ipa_upd(struct brcms_phy *pi) -{ - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - pi->ipa2g_on = (pi->srom_fem2g.extpagain == 2); - pi->ipa5g_on = (pi->srom_fem5g.extpagain == 2); - } else { - pi->ipa2g_on = false; - pi->ipa5g_on = false; - } -} - -static u32 wlc_phy_txpower_est_power_nphy(struct brcms_phy *pi) -{ - s16 tx0_status, tx1_status; - u16 estPower1, estPower2; - u8 pwr0, pwr1, adj_pwr0, adj_pwr1; - u32 est_pwr; - - estPower1 = read_phy_reg(pi, 0x118); - estPower2 = read_phy_reg(pi, 0x119); - - if ((estPower1 & (0x1 << 8)) == (0x1 << 8)) - pwr0 = (u8) (estPower1 & (0xff << 0)) >> 0; - else - pwr0 = 0x80; - - if ((estPower2 & (0x1 << 8)) == (0x1 << 8)) - pwr1 = (u8) (estPower2 & (0xff << 0)) >> 0; - else - pwr1 = 0x80; - - tx0_status = read_phy_reg(pi, 0x1ed); - tx1_status = read_phy_reg(pi, 0x1ee); - - if ((tx0_status & (0x1 << 15)) == (0x1 << 15)) - adj_pwr0 = (u8) (tx0_status & (0xff << 0)) >> 0; - else - adj_pwr0 = 0x80; - if ((tx1_status & (0x1 << 15)) == (0x1 << 15)) - adj_pwr1 = (u8) (tx1_status & (0xff << 0)) >> 0; - else - adj_pwr1 = 0x80; - - est_pwr = (u32) ((pwr0 << 24) | (pwr1 << 16) | (adj_pwr0 << 8) | - adj_pwr1); - - return est_pwr; -} - -void -wlc_phy_txpower_get_current(struct brcms_phy_pub *ppi, struct tx_power *power, - uint channel) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - uint rate, num_rates; - u8 min_pwr, max_pwr; - -#if WL_TX_POWER_RATES != TXP_NUM_RATES -#error "struct tx_power out of sync with this fn" -#endif - - if (ISNPHY(pi)) { - power->rf_cores = 2; - power->flags |= (WL_TX_POWER_F_MIMO); - if (pi->nphy_txpwrctrl == PHY_TPC_HW_ON) - power->flags |= - (WL_TX_POWER_F_ENABLED | WL_TX_POWER_F_HW); - } else if (ISLCNPHY(pi)) { - power->rf_cores = 1; - power->flags |= (WL_TX_POWER_F_SISO); - if (pi->radiopwr_override == RADIOPWR_OVERRIDE_DEF) - power->flags |= WL_TX_POWER_F_ENABLED; - if (pi->hwpwrctrl) - power->flags |= WL_TX_POWER_F_HW; - } - - num_rates = ((ISNPHY(pi)) ? (TXP_NUM_RATES) : - ((ISLCNPHY(pi)) ? - (TXP_LAST_OFDM_20_CDD + 1) : (TXP_LAST_OFDM + 1))); - - for (rate = 0; rate < num_rates; rate++) { - power->user_limit[rate] = pi->tx_user_target[rate]; - wlc_phy_txpower_sromlimit(ppi, channel, &min_pwr, &max_pwr, - rate); - power->board_limit[rate] = (u8) max_pwr; - power->target[rate] = pi->tx_power_target[rate]; - } - - if (ISNPHY(pi)) { - u32 est_pout; - - wlapi_suspend_mac_and_wait(pi->sh->physhim); - wlc_phyreg_enter((struct brcms_phy_pub *) pi); - est_pout = wlc_phy_txpower_est_power_nphy(pi); - wlc_phyreg_exit((struct brcms_phy_pub *) pi); - wlapi_enable_mac(pi->sh->physhim); - - power->est_Pout[0] = (est_pout >> 8) & 0xff; - power->est_Pout[1] = est_pout & 0xff; - - power->est_Pout_act[0] = est_pout >> 24; - power->est_Pout_act[1] = (est_pout >> 16) & 0xff; - - if (power->est_Pout[0] == 0x80) - power->est_Pout[0] = 0; - if (power->est_Pout[1] == 0x80) - power->est_Pout[1] = 0; - - if (power->est_Pout_act[0] == 0x80) - power->est_Pout_act[0] = 0; - if (power->est_Pout_act[1] == 0x80) - power->est_Pout_act[1] = 0; - - power->est_Pout_cck = 0; - - power->tx_power_max[0] = pi->tx_power_max; - power->tx_power_max[1] = pi->tx_power_max; - - power->tx_power_max_rate_ind[0] = pi->tx_power_max_rate_ind; - power->tx_power_max_rate_ind[1] = pi->tx_power_max_rate_ind; - } else if (pi->hwpwrctrl && pi->sh->up) { - - wlc_phyreg_enter(ppi); - if (ISLCNPHY(pi)) { - - power->tx_power_max[0] = pi->tx_power_max; - power->tx_power_max[1] = pi->tx_power_max; - - power->tx_power_max_rate_ind[0] = - pi->tx_power_max_rate_ind; - power->tx_power_max_rate_ind[1] = - pi->tx_power_max_rate_ind; - - if (wlc_phy_tpc_isenabled_lcnphy(pi)) - power->flags |= - (WL_TX_POWER_F_HW | - WL_TX_POWER_F_ENABLED); - else - power->flags &= - ~(WL_TX_POWER_F_HW | - WL_TX_POWER_F_ENABLED); - - wlc_lcnphy_get_tssi(pi, (s8 *) &power->est_Pout[0], - (s8 *) &power->est_Pout_cck); - } - wlc_phyreg_exit(ppi); - } -} - -void wlc_phy_antsel_type_set(struct brcms_phy_pub *ppi, u8 antsel_type) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - pi->antsel_type = antsel_type; -} - -bool wlc_phy_test_ison(struct brcms_phy_pub *ppi) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - return pi->phytest_on; -} - -void wlc_phy_ant_rxdiv_set(struct brcms_phy_pub *ppi, u8 val) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - bool suspend; - - pi->sh->rx_antdiv = val; - - if (!(ISNPHY(pi) && D11REV_IS(pi->sh->corerev, 16))) { - if (val > ANT_RX_DIV_FORCE_1) - wlapi_bmac_mhf(pi->sh->physhim, MHF1, MHF1_ANTDIV, - MHF1_ANTDIV, BRCM_BAND_ALL); - else - wlapi_bmac_mhf(pi->sh->physhim, MHF1, MHF1_ANTDIV, 0, - BRCM_BAND_ALL); - } - - if (ISNPHY(pi)) - return; - - if (!pi->sh->clk) - return; - - suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & - MCTL_EN_MAC)); - if (!suspend) - wlapi_suspend_mac_and_wait(pi->sh->physhim); - - if (ISLCNPHY(pi)) { - if (val > ANT_RX_DIV_FORCE_1) { - mod_phy_reg(pi, 0x410, (0x1 << 1), 0x01 << 1); - mod_phy_reg(pi, 0x410, - (0x1 << 0), - ((ANT_RX_DIV_START_1 == val) ? 1 : 0) << 0); - } else { - mod_phy_reg(pi, 0x410, (0x1 << 1), 0x00 << 1); - mod_phy_reg(pi, 0x410, (0x1 << 0), (u16) val << 0); - } - } - - if (!suspend) - wlapi_enable_mac(pi->sh->physhim); - - return; -} - -static bool -wlc_phy_noise_calc_phy(struct brcms_phy *pi, u32 *cmplx_pwr, s8 *pwr_ant) -{ - s8 cmplx_pwr_dbm[PHY_CORE_MAX]; - u8 i; - - memset((u8 *) cmplx_pwr_dbm, 0, sizeof(cmplx_pwr_dbm)); - wlc_phy_compute_dB(cmplx_pwr, cmplx_pwr_dbm, pi->pubpi.phy_corenum); - - for (i = 0; i < pi->pubpi.phy_corenum; i++) { - if (NREV_GE(pi->pubpi.phy_rev, 3)) - cmplx_pwr_dbm[i] += (s8) PHY_NOISE_OFFSETFACT_4322; - else - - cmplx_pwr_dbm[i] += (s8) (16 - (15) * 3 - 70); - } - - for (i = 0; i < pi->pubpi.phy_corenum; i++) { - pi->nphy_noise_win[i][pi->nphy_noise_index] = cmplx_pwr_dbm[i]; - pwr_ant[i] = cmplx_pwr_dbm[i]; - } - pi->nphy_noise_index = - MODINC_POW2(pi->nphy_noise_index, PHY_NOISE_WINDOW_SZ); - return true; -} - -static void wlc_phy_noise_cb(struct brcms_phy *pi, u8 channel, s8 noise_dbm) -{ - if (!pi->phynoise_state) - return; - - if (pi->phynoise_state & PHY_NOISE_STATE_MON) { - if (pi->phynoise_chan_watchdog == channel) { - pi->sh->phy_noise_window[pi->sh->phy_noise_index] = - noise_dbm; - pi->sh->phy_noise_index = - MODINC(pi->sh->phy_noise_index, MA_WINDOW_SZ); - } - pi->phynoise_state &= ~PHY_NOISE_STATE_MON; - } - - if (pi->phynoise_state & PHY_NOISE_STATE_EXTERNAL) - pi->phynoise_state &= ~PHY_NOISE_STATE_EXTERNAL; - -} - -static s8 wlc_phy_noise_read_shmem(struct brcms_phy *pi) -{ - u32 cmplx_pwr[PHY_CORE_MAX]; - s8 noise_dbm_ant[PHY_CORE_MAX]; - u16 lo, hi; - u32 cmplx_pwr_tot = 0; - s8 noise_dbm = PHY_NOISE_FIXED_VAL_NPHY; - u8 idx, core; - - memset((u8 *) cmplx_pwr, 0, sizeof(cmplx_pwr)); - memset((u8 *) noise_dbm_ant, 0, sizeof(noise_dbm_ant)); - - for (idx = 0, core = 0; core < pi->pubpi.phy_corenum; idx += 2, - core++) { - lo = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP(idx)); - hi = wlapi_bmac_read_shm(pi->sh->physhim, - M_PWRIND_MAP(idx + 1)); - cmplx_pwr[core] = (hi << 16) + lo; - cmplx_pwr_tot += cmplx_pwr[core]; - if (cmplx_pwr[core] == 0) - noise_dbm_ant[core] = PHY_NOISE_FIXED_VAL_NPHY; - else - cmplx_pwr[core] >>= PHY_NOISE_SAMPLE_LOG_NUM_UCODE; - } - - if (cmplx_pwr_tot != 0) - wlc_phy_noise_calc_phy(pi, cmplx_pwr, noise_dbm_ant); - - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - pi->nphy_noise_win[core][pi->nphy_noise_index] = - noise_dbm_ant[core]; - - if (noise_dbm_ant[core] > noise_dbm) - noise_dbm = noise_dbm_ant[core]; - } - pi->nphy_noise_index = - MODINC_POW2(pi->nphy_noise_index, PHY_NOISE_WINDOW_SZ); - - return noise_dbm; - -} - -void wlc_phy_noise_sample_intr(struct brcms_phy_pub *pih) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - u16 jssi_aux; - u8 channel = 0; - s8 noise_dbm = PHY_NOISE_FIXED_VAL_NPHY; - - if (ISLCNPHY(pi)) { - u32 cmplx_pwr, cmplx_pwr0, cmplx_pwr1; - u16 lo, hi; - s32 pwr_offset_dB, gain_dB; - u16 status_0, status_1; - - jssi_aux = wlapi_bmac_read_shm(pi->sh->physhim, M_JSSI_AUX); - channel = jssi_aux & D11_CURCHANNEL_MAX; - - lo = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP0); - hi = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP1); - cmplx_pwr0 = (hi << 16) + lo; - - lo = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP2); - hi = wlapi_bmac_read_shm(pi->sh->physhim, M_PWRIND_MAP3); - cmplx_pwr1 = (hi << 16) + lo; - cmplx_pwr = (cmplx_pwr0 + cmplx_pwr1) >> 6; - - status_0 = 0x44; - status_1 = wlapi_bmac_read_shm(pi->sh->physhim, M_JSSI_0); - if ((cmplx_pwr > 0 && cmplx_pwr < 500) - && ((status_1 & 0xc000) == 0x4000)) { - - wlc_phy_compute_dB(&cmplx_pwr, &noise_dbm, - pi->pubpi.phy_corenum); - pwr_offset_dB = (read_phy_reg(pi, 0x434) & 0xFF); - if (pwr_offset_dB > 127) - pwr_offset_dB -= 256; - - noise_dbm += (s8) (pwr_offset_dB - 30); - - gain_dB = (status_0 & 0x1ff); - noise_dbm -= (s8) (gain_dB); - } else { - noise_dbm = PHY_NOISE_FIXED_VAL_LCNPHY; - } - } else if (ISNPHY(pi)) { - - jssi_aux = wlapi_bmac_read_shm(pi->sh->physhim, M_JSSI_AUX); - channel = jssi_aux & D11_CURCHANNEL_MAX; - - noise_dbm = wlc_phy_noise_read_shmem(pi); - } - - wlc_phy_noise_cb(pi, channel, noise_dbm); - -} - -static void -wlc_phy_noise_sample_request(struct brcms_phy_pub *pih, u8 reason, u8 ch) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - s8 noise_dbm = PHY_NOISE_FIXED_VAL_NPHY; - bool sampling_in_progress = (pi->phynoise_state != 0); - bool wait_for_intr = true; - - switch (reason) { - case PHY_NOISE_SAMPLE_MON: - pi->phynoise_chan_watchdog = ch; - pi->phynoise_state |= PHY_NOISE_STATE_MON; - break; - - case PHY_NOISE_SAMPLE_EXTERNAL: - pi->phynoise_state |= PHY_NOISE_STATE_EXTERNAL; - break; - - default: - break; - } - - if (sampling_in_progress) - return; - - pi->phynoise_now = pi->sh->now; - - if (pi->phy_fixed_noise) { - if (ISNPHY(pi)) { - pi->nphy_noise_win[WL_ANT_IDX_1][pi->nphy_noise_index] = - PHY_NOISE_FIXED_VAL_NPHY; - pi->nphy_noise_win[WL_ANT_IDX_2][pi->nphy_noise_index] = - PHY_NOISE_FIXED_VAL_NPHY; - pi->nphy_noise_index = MODINC_POW2(pi->nphy_noise_index, - PHY_NOISE_WINDOW_SZ); - noise_dbm = PHY_NOISE_FIXED_VAL_NPHY; - } else { - noise_dbm = PHY_NOISE_FIXED_VAL; - } - - wait_for_intr = false; - goto done; - } - - if (ISLCNPHY(pi)) { - if (!pi->phynoise_polling - || (reason == PHY_NOISE_SAMPLE_EXTERNAL)) { - wlapi_bmac_write_shm(pi->sh->physhim, M_JSSI_0, 0); - wlapi_bmac_write_shm(pi->sh->physhim, M_PWRIND_MAP0, 0); - wlapi_bmac_write_shm(pi->sh->physhim, M_PWRIND_MAP1, 0); - wlapi_bmac_write_shm(pi->sh->physhim, M_PWRIND_MAP2, 0); - wlapi_bmac_write_shm(pi->sh->physhim, M_PWRIND_MAP3, 0); - - bcma_set32(pi->d11core, D11REGOFFS(maccommand), - MCMD_BG_NOISE); - } else { - wlapi_suspend_mac_and_wait(pi->sh->physhim); - wlc_lcnphy_deaf_mode(pi, (bool) 0); - noise_dbm = (s8) wlc_lcnphy_rx_signal_power(pi, 20); - wlc_lcnphy_deaf_mode(pi, (bool) 1); - wlapi_enable_mac(pi->sh->physhim); - wait_for_intr = false; - } - } else if (ISNPHY(pi)) { - if (!pi->phynoise_polling - || (reason == PHY_NOISE_SAMPLE_EXTERNAL)) { - - wlapi_bmac_write_shm(pi->sh->physhim, M_PWRIND_MAP0, 0); - wlapi_bmac_write_shm(pi->sh->physhim, M_PWRIND_MAP1, 0); - wlapi_bmac_write_shm(pi->sh->physhim, M_PWRIND_MAP2, 0); - wlapi_bmac_write_shm(pi->sh->physhim, M_PWRIND_MAP3, 0); - - bcma_set32(pi->d11core, D11REGOFFS(maccommand), - MCMD_BG_NOISE); - } else { - struct phy_iq_est est[PHY_CORE_MAX]; - u32 cmplx_pwr[PHY_CORE_MAX]; - s8 noise_dbm_ant[PHY_CORE_MAX]; - u16 log_num_samps, num_samps, classif_state = 0; - u8 wait_time = 32; - u8 wait_crs = 0; - u8 i; - - memset((u8 *) est, 0, sizeof(est)); - memset((u8 *) cmplx_pwr, 0, sizeof(cmplx_pwr)); - memset((u8 *) noise_dbm_ant, 0, sizeof(noise_dbm_ant)); - - log_num_samps = PHY_NOISE_SAMPLE_LOG_NUM_NPHY; - num_samps = 1 << log_num_samps; - - wlapi_suspend_mac_and_wait(pi->sh->physhim); - classif_state = wlc_phy_classifier_nphy(pi, 0, 0); - wlc_phy_classifier_nphy(pi, 3, 0); - wlc_phy_rx_iq_est_nphy(pi, est, num_samps, wait_time, - wait_crs); - wlc_phy_classifier_nphy(pi, (0x7 << 0), classif_state); - wlapi_enable_mac(pi->sh->physhim); - - for (i = 0; i < pi->pubpi.phy_corenum; i++) - cmplx_pwr[i] = (est[i].i_pwr + est[i].q_pwr) >> - log_num_samps; - - wlc_phy_noise_calc_phy(pi, cmplx_pwr, noise_dbm_ant); - - for (i = 0; i < pi->pubpi.phy_corenum; i++) { - pi->nphy_noise_win[i][pi->nphy_noise_index] = - noise_dbm_ant[i]; - - if (noise_dbm_ant[i] > noise_dbm) - noise_dbm = noise_dbm_ant[i]; - } - pi->nphy_noise_index = MODINC_POW2(pi->nphy_noise_index, - PHY_NOISE_WINDOW_SZ); - - wait_for_intr = false; - } - } - -done: - - if (!wait_for_intr) - wlc_phy_noise_cb(pi, ch, noise_dbm); - -} - -void wlc_phy_noise_sample_request_external(struct brcms_phy_pub *pih) -{ - u8 channel; - - channel = CHSPEC_CHANNEL(wlc_phy_chanspec_get(pih)); - - wlc_phy_noise_sample_request(pih, PHY_NOISE_SAMPLE_EXTERNAL, channel); -} - -static const s8 lcnphy_gain_index_offset_for_pkt_rssi[] = { - 8, - 8, - 8, - 8, - 8, - 8, - 8, - 9, - 10, - 8, - 8, - 7, - 7, - 1, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 1, - 1, - 0, - 0, - 0, - 0 -}; - -void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_cmplx_pwr_dB, u8 core) -{ - u8 msb, secondmsb, i; - u32 tmp; - - for (i = 0; i < core; i++) { - secondmsb = 0; - tmp = cmplx_pwr[i]; - msb = fls(tmp); - if (msb) - secondmsb = (u8) ((tmp >> (--msb - 1)) & 1); - p_cmplx_pwr_dB[i] = (s8) (3 * msb + 2 * secondmsb); - } -} - -int wlc_phy_rssi_compute(struct brcms_phy_pub *pih, - struct d11rxhdr *rxh) -{ - int rssi = rxh->PhyRxStatus_1 & PRXS1_JSSI_MASK; - uint radioid = pih->radioid; - struct brcms_phy *pi = (struct brcms_phy *) pih; - - if ((pi->sh->corerev >= 11) - && !(rxh->RxStatus2 & RXS_PHYRXST_VALID)) { - rssi = BRCMS_RSSI_INVALID; - goto end; - } - - if (ISLCNPHY(pi)) { - u8 gidx = (rxh->PhyRxStatus_2 & 0xFC00) >> 10; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - if (rssi > 127) - rssi -= 256; - - rssi = rssi + lcnphy_gain_index_offset_for_pkt_rssi[gidx]; - if ((rssi > -46) && (gidx > 18)) - rssi = rssi + 7; - - rssi = rssi + pi_lcn->lcnphy_pkteng_rssi_slope; - - rssi = rssi + 2; - - } - - if (ISLCNPHY(pi)) { - if (rssi > 127) - rssi -= 256; - } else if (radioid == BCM2055_ID || radioid == BCM2056_ID - || radioid == BCM2057_ID) { - rssi = wlc_phy_rssi_compute_nphy(pi, rxh); - } - -end: - return rssi; -} - -void wlc_phy_freqtrack_start(struct brcms_phy_pub *pih) -{ - return; -} - -void wlc_phy_freqtrack_end(struct brcms_phy_pub *pih) -{ - return; -} - -void wlc_phy_set_deaf(struct brcms_phy_pub *ppi, bool user_flag) -{ - struct brcms_phy *pi; - pi = (struct brcms_phy *) ppi; - - if (ISLCNPHY(pi)) - wlc_lcnphy_deaf_mode(pi, true); - else if (ISNPHY(pi)) - wlc_nphy_deaf_mode(pi, true); -} - -void wlc_phy_watchdog(struct brcms_phy_pub *pih) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - bool delay_phy_cal = false; - pi->sh->now++; - - if (!pi->watchdog_override) - return; - - if (!(SCAN_RM_IN_PROGRESS(pi) || PLT_INPROG_PHY(pi))) - wlc_phy_noise_sample_request((struct brcms_phy_pub *) pi, - PHY_NOISE_SAMPLE_MON, - CHSPEC_CHANNEL(pi-> - radio_chanspec)); - - if (pi->phynoise_state && (pi->sh->now - pi->phynoise_now) > 5) - pi->phynoise_state = 0; - - if ((!pi->phycal_txpower) || - ((pi->sh->now - pi->phycal_txpower) >= pi->sh->fast_timer)) { - - if (!SCAN_INPROG_PHY(pi) && wlc_phy_cal_txpower_recalc_sw(pi)) - pi->phycal_txpower = pi->sh->now; - } - - if ((SCAN_RM_IN_PROGRESS(pi) || PLT_INPROG_PHY(pi) - || ASSOC_INPROG_PHY(pi))) - return; - - if (ISNPHY(pi) && !pi->disable_percal && !delay_phy_cal) { - - if ((pi->nphy_perical != PHY_PERICAL_DISABLE) && - (pi->nphy_perical != PHY_PERICAL_MANUAL) && - ((pi->sh->now - pi->nphy_perical_last) >= - pi->sh->glacial_timer)) - wlc_phy_cal_perical((struct brcms_phy_pub *) pi, - PHY_PERICAL_WATCHDOG); - - wlc_phy_txpwr_papd_cal_nphy(pi); - } - - if (ISLCNPHY(pi)) { - if (pi->phy_forcecal || - ((pi->sh->now - pi->phy_lastcal) >= - pi->sh->glacial_timer)) { - if (!(SCAN_RM_IN_PROGRESS(pi) || ASSOC_INPROG_PHY(pi))) - wlc_lcnphy_calib_modes( - pi, - LCNPHY_PERICAL_TEMPBASED_TXPWRCTRL); - if (! - (SCAN_RM_IN_PROGRESS(pi) || PLT_INPROG_PHY(pi) - || ASSOC_INPROG_PHY(pi) - || pi->carrier_suppr_disable - || pi->disable_percal)) - wlc_lcnphy_calib_modes(pi, - PHY_PERICAL_WATCHDOG); - } - } -} - -void wlc_phy_BSSinit(struct brcms_phy_pub *pih, bool bonlyap, int rssi) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - uint i; - uint k; - - for (i = 0; i < MA_WINDOW_SZ; i++) - pi->sh->phy_noise_window[i] = (s8) (rssi & 0xff); - if (ISLCNPHY(pi)) { - for (i = 0; i < MA_WINDOW_SZ; i++) - pi->sh->phy_noise_window[i] = - PHY_NOISE_FIXED_VAL_LCNPHY; - } - pi->sh->phy_noise_index = 0; - - for (i = 0; i < PHY_NOISE_WINDOW_SZ; i++) { - for (k = WL_ANT_IDX_1; k < WL_ANT_RX_MAX; k++) - pi->nphy_noise_win[k][i] = PHY_NOISE_FIXED_VAL_NPHY; - } - pi->nphy_noise_index = 0; -} - -void -wlc_phy_papd_decode_epsilon(u32 epsilon, s32 *eps_real, s32 *eps_imag) -{ - *eps_imag = (epsilon >> 13); - if (*eps_imag > 0xfff) - *eps_imag -= 0x2000; - - *eps_real = (epsilon & 0x1fff); - if (*eps_real > 0xfff) - *eps_real -= 0x2000; -} - -void wlc_phy_cal_perical_mphase_reset(struct brcms_phy *pi) -{ - wlapi_del_timer(pi->phycal_timer); - - pi->cal_type_override = PHY_PERICAL_AUTO; - pi->mphase_cal_phase_id = MPHASE_CAL_STATE_IDLE; - pi->mphase_txcal_cmdidx = 0; -} - -static void -wlc_phy_cal_perical_mphase_schedule(struct brcms_phy *pi, uint delay) -{ - - if ((pi->nphy_perical != PHY_PERICAL_MPHASE) && - (pi->nphy_perical != PHY_PERICAL_MANUAL)) - return; - - wlapi_del_timer(pi->phycal_timer); - - pi->mphase_cal_phase_id = MPHASE_CAL_STATE_INIT; - wlapi_add_timer(pi->phycal_timer, delay, 0); -} - -void wlc_phy_cal_perical(struct brcms_phy_pub *pih, u8 reason) -{ - s16 nphy_currtemp = 0; - s16 delta_temp = 0; - bool do_periodic_cal = true; - struct brcms_phy *pi = (struct brcms_phy *) pih; - - if (!ISNPHY(pi)) - return; - - if ((pi->nphy_perical == PHY_PERICAL_DISABLE) || - (pi->nphy_perical == PHY_PERICAL_MANUAL)) - return; - - switch (reason) { - case PHY_PERICAL_DRIVERUP: - break; - - case PHY_PERICAL_PHYINIT: - if (pi->nphy_perical == PHY_PERICAL_MPHASE) { - if (PHY_PERICAL_MPHASE_PENDING(pi)) - wlc_phy_cal_perical_mphase_reset(pi); - - wlc_phy_cal_perical_mphase_schedule( - pi, - PHY_PERICAL_INIT_DELAY); - } - break; - - case PHY_PERICAL_JOIN_BSS: - case PHY_PERICAL_START_IBSS: - case PHY_PERICAL_UP_BSS: - if ((pi->nphy_perical == PHY_PERICAL_MPHASE) && - PHY_PERICAL_MPHASE_PENDING(pi)) - wlc_phy_cal_perical_mphase_reset(pi); - - pi->first_cal_after_assoc = true; - - pi->cal_type_override = PHY_PERICAL_FULL; - - if (pi->phycal_tempdelta) - pi->nphy_lastcal_temp = wlc_phy_tempsense_nphy(pi); - - wlc_phy_cal_perical_nphy_run(pi, PHY_PERICAL_FULL); - break; - - case PHY_PERICAL_WATCHDOG: - if (pi->phycal_tempdelta) { - nphy_currtemp = wlc_phy_tempsense_nphy(pi); - delta_temp = - (nphy_currtemp > pi->nphy_lastcal_temp) ? - nphy_currtemp - pi->nphy_lastcal_temp : - pi->nphy_lastcal_temp - nphy_currtemp; - - if ((delta_temp < (s16) pi->phycal_tempdelta) && - (pi->nphy_txiqlocal_chanspec == - pi->radio_chanspec)) - do_periodic_cal = false; - else - pi->nphy_lastcal_temp = nphy_currtemp; - } - - if (do_periodic_cal) { - if (pi->nphy_perical == PHY_PERICAL_MPHASE) { - if (!PHY_PERICAL_MPHASE_PENDING(pi)) - wlc_phy_cal_perical_mphase_schedule( - pi, - PHY_PERICAL_WDOG_DELAY); - } else if (pi->nphy_perical == PHY_PERICAL_SPHASE) - wlc_phy_cal_perical_nphy_run(pi, - PHY_PERICAL_AUTO); - } - break; - default: - break; - } -} - -void wlc_phy_cal_perical_mphase_restart(struct brcms_phy *pi) -{ - pi->mphase_cal_phase_id = MPHASE_CAL_STATE_INIT; - pi->mphase_txcal_cmdidx = 0; -} - -u8 wlc_phy_nbits(s32 value) -{ - s32 abs_val; - u8 nbits = 0; - - abs_val = abs(value); - while ((abs_val >> nbits) > 0) - nbits++; - - return nbits; -} - -void wlc_phy_stf_chain_init(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - pi->sh->hw_phytxchain = txchain; - pi->sh->hw_phyrxchain = rxchain; - pi->sh->phytxchain = txchain; - pi->sh->phyrxchain = rxchain; - pi->pubpi.phy_corenum = (u8)hweight8(pi->sh->phyrxchain); -} - -void wlc_phy_stf_chain_set(struct brcms_phy_pub *pih, u8 txchain, u8 rxchain) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - pi->sh->phytxchain = txchain; - - if (ISNPHY(pi)) - wlc_phy_rxcore_setstate_nphy(pih, rxchain); - - pi->pubpi.phy_corenum = (u8)hweight8(pi->sh->phyrxchain); -} - -void wlc_phy_stf_chain_get(struct brcms_phy_pub *pih, u8 *txchain, u8 *rxchain) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - - *txchain = pi->sh->phytxchain; - *rxchain = pi->sh->phyrxchain; -} - -u8 wlc_phy_stf_chain_active_get(struct brcms_phy_pub *pih) -{ - s16 nphy_currtemp; - u8 active_bitmap; - struct brcms_phy *pi = (struct brcms_phy *) pih; - - active_bitmap = (pi->phy_txcore_heatedup) ? 0x31 : 0x33; - - if (!pi->watchdog_override) - return active_bitmap; - - if (NREV_GE(pi->pubpi.phy_rev, 6)) { - wlapi_suspend_mac_and_wait(pi->sh->physhim); - nphy_currtemp = wlc_phy_tempsense_nphy(pi); - wlapi_enable_mac(pi->sh->physhim); - - if (!pi->phy_txcore_heatedup) { - if (nphy_currtemp >= pi->phy_txcore_disable_temp) { - active_bitmap &= 0xFD; - pi->phy_txcore_heatedup = true; - } - } else { - if (nphy_currtemp <= pi->phy_txcore_enable_temp) { - active_bitmap |= 0x2; - pi->phy_txcore_heatedup = false; - } - } - } - - return active_bitmap; -} - -s8 wlc_phy_stf_ssmode_get(struct brcms_phy_pub *pih, u16 chanspec) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - u8 siso_mcs_id, cdd_mcs_id; - - siso_mcs_id = - (CHSPEC_IS40(chanspec)) ? TXP_FIRST_MCS_40_SISO : - TXP_FIRST_MCS_20_SISO; - cdd_mcs_id = - (CHSPEC_IS40(chanspec)) ? TXP_FIRST_MCS_40_CDD : - TXP_FIRST_MCS_20_CDD; - - if (pi->tx_power_target[siso_mcs_id] > - (pi->tx_power_target[cdd_mcs_id] + 12)) - return PHY_TXC1_MODE_SISO; - else - return PHY_TXC1_MODE_CDD; -} - -const u8 *wlc_phy_get_ofdm_rate_lookup(void) -{ - return ofdm_rate_lookup; -} - -void wlc_lcnphy_epa_switch(struct brcms_phy *pi, bool mode) -{ - if ((pi->sh->chip == BCMA_CHIP_ID_BCM4313) && - (pi->sh->boardflags & BFL_FEM)) { - if (mode) { - u16 txant = 0; - txant = wlapi_bmac_get_txant(pi->sh->physhim); - if (txant == 1) { - mod_phy_reg(pi, 0x44d, (0x1 << 2), (1) << 2); - - mod_phy_reg(pi, 0x44c, (0x1 << 2), (1) << 2); - - } - - bcma_chipco_gpio_control(&pi->d11core->bus->drv_cc, - 0x0, 0x0); - bcma_chipco_gpio_out(&pi->d11core->bus->drv_cc, - ~0x40, 0x40); - bcma_chipco_gpio_outen(&pi->d11core->bus->drv_cc, - ~0x40, 0x40); - } else { - mod_phy_reg(pi, 0x44c, (0x1 << 2), (0) << 2); - - mod_phy_reg(pi, 0x44d, (0x1 << 2), (0) << 2); - - bcma_chipco_gpio_out(&pi->d11core->bus->drv_cc, - ~0x40, 0x00); - bcma_chipco_gpio_outen(&pi->d11core->bus->drv_cc, - ~0x40, 0x00); - bcma_chipco_gpio_control(&pi->d11core->bus->drv_cc, - 0x0, 0x40); - } - } -} - -void wlc_phy_ldpc_override_set(struct brcms_phy_pub *ppi, bool ldpc) -{ - return; -} - -void -wlc_phy_get_pwrdet_offsets(struct brcms_phy *pi, s8 *cckoffset, s8 *ofdmoffset) -{ - *cckoffset = 0; - *ofdmoffset = 0; -} - -s8 wlc_phy_upd_rssi_offset(struct brcms_phy *pi, s8 rssi, u16 chanspec) -{ - - return rssi; -} - -bool wlc_phy_txpower_ipa_ison(struct brcms_phy_pub *ppi) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - if (ISNPHY(pi)) - return wlc_phy_n_txpower_ipa_ison(pi); - else - return 0; -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_hal.h b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_hal.h deleted file mode 100644 index e34a71e7d242..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_hal.h +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * phy_hal.h: functionality exported from the phy to higher layers - */ - -#ifndef _BRCM_PHY_HAL_H_ -#define _BRCM_PHY_HAL_H_ - -#include -#include -#include - -#define IDCODE_VER_MASK 0x0000000f -#define IDCODE_VER_SHIFT 0 -#define IDCODE_MFG_MASK 0x00000fff -#define IDCODE_MFG_SHIFT 0 -#define IDCODE_ID_MASK 0x0ffff000 -#define IDCODE_ID_SHIFT 12 -#define IDCODE_REV_MASK 0xf0000000 -#define IDCODE_REV_SHIFT 28 - -#define NORADIO_ID 0xe4f5 -#define NORADIO_IDCODE 0x4e4f5246 - -#define BCM2055_ID 0x2055 -#define BCM2055_IDCODE 0x02055000 -#define BCM2055A0_IDCODE 0x1205517f - -#define BCM2056_ID 0x2056 -#define BCM2056_IDCODE 0x02056000 -#define BCM2056A0_IDCODE 0x1205617f - -#define BCM2057_ID 0x2057 -#define BCM2057_IDCODE 0x02057000 -#define BCM2057A0_IDCODE 0x1205717f - -#define BCM2064_ID 0x2064 -#define BCM2064_IDCODE 0x02064000 -#define BCM2064A0_IDCODE 0x0206417f - -#define PHY_TPC_HW_OFF false -#define PHY_TPC_HW_ON true - -#define PHY_PERICAL_DRIVERUP 1 -#define PHY_PERICAL_WATCHDOG 2 -#define PHY_PERICAL_PHYINIT 3 -#define PHY_PERICAL_JOIN_BSS 4 -#define PHY_PERICAL_START_IBSS 5 -#define PHY_PERICAL_UP_BSS 6 -#define PHY_PERICAL_CHAN 7 -#define PHY_FULLCAL 8 - -#define PHY_PERICAL_DISABLE 0 -#define PHY_PERICAL_SPHASE 1 -#define PHY_PERICAL_MPHASE 2 -#define PHY_PERICAL_MANUAL 3 - -#define PHY_HOLD_FOR_ASSOC 1 -#define PHY_HOLD_FOR_SCAN 2 -#define PHY_HOLD_FOR_RM 4 -#define PHY_HOLD_FOR_PLT 8 -#define PHY_HOLD_FOR_MUTE 16 -#define PHY_HOLD_FOR_NOT_ASSOC 0x20 - -#define PHY_MUTE_FOR_PREISM 1 -#define PHY_MUTE_ALL 0xffffffff - -#define PHY_NOISE_FIXED_VAL (-95) -#define PHY_NOISE_FIXED_VAL_NPHY (-92) -#define PHY_NOISE_FIXED_VAL_LCNPHY (-92) - -#define PHY_MODE_CAL 0x0002 -#define PHY_MODE_NOISEM 0x0004 - -#define BRCMS_TXPWR_DB_FACTOR 4 - -/* a large TX Power as an init value to factor out of min() calculations, - * keep low enough to fit in an s8, units are .25 dBm - */ -#define BRCMS_TXPWR_MAX (127) /* ~32 dBm = 1,500 mW */ - -#define BRCMS_NUM_RATES_CCK 4 -#define BRCMS_NUM_RATES_OFDM 8 -#define BRCMS_NUM_RATES_MCS_1_STREAM 8 -#define BRCMS_NUM_RATES_MCS_2_STREAM 8 -#define BRCMS_NUM_RATES_MCS_3_STREAM 8 -#define BRCMS_NUM_RATES_MCS_4_STREAM 8 - -#define BRCMS_RSSI_INVALID 0 /* invalid RSSI value */ - -struct d11regs; -struct phy_shim_info; - -struct txpwr_limits { - u8 cck[BRCMS_NUM_RATES_CCK]; - u8 ofdm[BRCMS_NUM_RATES_OFDM]; - - u8 ofdm_cdd[BRCMS_NUM_RATES_OFDM]; - - u8 ofdm_40_siso[BRCMS_NUM_RATES_OFDM]; - u8 ofdm_40_cdd[BRCMS_NUM_RATES_OFDM]; - - u8 mcs_20_siso[BRCMS_NUM_RATES_MCS_1_STREAM]; - u8 mcs_20_cdd[BRCMS_NUM_RATES_MCS_1_STREAM]; - u8 mcs_20_stbc[BRCMS_NUM_RATES_MCS_1_STREAM]; - u8 mcs_20_mimo[BRCMS_NUM_RATES_MCS_2_STREAM]; - - u8 mcs_40_siso[BRCMS_NUM_RATES_MCS_1_STREAM]; - u8 mcs_40_cdd[BRCMS_NUM_RATES_MCS_1_STREAM]; - u8 mcs_40_stbc[BRCMS_NUM_RATES_MCS_1_STREAM]; - u8 mcs_40_mimo[BRCMS_NUM_RATES_MCS_2_STREAM]; - u8 mcs32; -}; - -struct tx_power { - u32 flags; - u16 chanspec; /* txpwr report for this channel */ - u16 local_chanspec; /* channel on which we are associated */ - u8 local_max; /* local max according to the AP */ - u8 local_constraint; /* local constraint according to the AP */ - s8 antgain[2]; /* Ant gain for each band - from SROM */ - u8 rf_cores; /* count of RF Cores being reported */ - u8 est_Pout[4]; /* Latest tx power out estimate per RF chain */ - u8 est_Pout_act[4]; /* Latest tx power out estimate per RF chain - * without adjustment */ - u8 est_Pout_cck; /* Latest CCK tx power out estimate */ - u8 tx_power_max[4]; /* Maximum target power among all rates */ - /* Index of the rate with the max target power */ - u8 tx_power_max_rate_ind[4]; - /* User limit */ - u8 user_limit[WL_TX_POWER_RATES]; - /* Regulatory power limit */ - u8 reg_limit[WL_TX_POWER_RATES]; - /* Max power board can support (SROM) */ - u8 board_limit[WL_TX_POWER_RATES]; - /* Latest target power */ - u8 target[WL_TX_POWER_RATES]; -}; - -struct tx_inst_power { - u8 txpwr_est_Pout[2]; /* Latest estimate for 2.4 and 5 Ghz */ - u8 txpwr_est_Pout_gofdm; /* Pwr estimate for 2.4 OFDM */ -}; - -struct brcms_chanvec { - u8 vec[MAXCHANNEL / NBBY]; -}; - -struct shared_phy_params { - struct si_pub *sih; - struct phy_shim_info *physhim; - uint unit; - uint corerev; - u16 vid; - u16 did; - uint chip; - uint chiprev; - uint chippkg; - uint sromrev; - uint boardtype; - uint boardrev; - u32 boardflags; - u32 boardflags2; -}; - - -extern struct shared_phy *wlc_phy_shared_attach(struct shared_phy_params *shp); -extern struct brcms_phy_pub *wlc_phy_attach(struct shared_phy *sh, - struct bcma_device *d11core, - int bandtype, struct wiphy *wiphy); -extern void wlc_phy_detach(struct brcms_phy_pub *ppi); - -extern bool wlc_phy_get_phyversion(struct brcms_phy_pub *pih, u16 *phytype, - u16 *phyrev, u16 *radioid, - u16 *radiover); -extern bool wlc_phy_get_encore(struct brcms_phy_pub *pih); -extern u32 wlc_phy_get_coreflags(struct brcms_phy_pub *pih); - -extern void wlc_phy_hw_clk_state_upd(struct brcms_phy_pub *ppi, bool newstate); -extern void wlc_phy_hw_state_upd(struct brcms_phy_pub *ppi, bool newstate); -extern void wlc_phy_init(struct brcms_phy_pub *ppi, u16 chanspec); -extern void wlc_phy_watchdog(struct brcms_phy_pub *ppi); -extern int wlc_phy_down(struct brcms_phy_pub *ppi); -extern u32 wlc_phy_clk_bwbits(struct brcms_phy_pub *pih); -extern void wlc_phy_cal_init(struct brcms_phy_pub *ppi); -extern void wlc_phy_antsel_init(struct brcms_phy_pub *ppi, bool lut_init); - -extern void wlc_phy_chanspec_set(struct brcms_phy_pub *ppi, - u16 chanspec); -extern u16 wlc_phy_chanspec_get(struct brcms_phy_pub *ppi); -extern void wlc_phy_chanspec_radio_set(struct brcms_phy_pub *ppi, - u16 newch); -extern u16 wlc_phy_bw_state_get(struct brcms_phy_pub *ppi); -extern void wlc_phy_bw_state_set(struct brcms_phy_pub *ppi, u16 bw); - -extern int wlc_phy_rssi_compute(struct brcms_phy_pub *pih, - struct d11rxhdr *rxh); -extern void wlc_phy_por_inform(struct brcms_phy_pub *ppi); -extern void wlc_phy_noise_sample_intr(struct brcms_phy_pub *ppi); -extern bool wlc_phy_bist_check_phy(struct brcms_phy_pub *ppi); - -extern void wlc_phy_set_deaf(struct brcms_phy_pub *ppi, bool user_flag); - -extern void wlc_phy_switch_radio(struct brcms_phy_pub *ppi, bool on); -extern void wlc_phy_anacore(struct brcms_phy_pub *ppi, bool on); - - -extern void wlc_phy_BSSinit(struct brcms_phy_pub *ppi, bool bonlyap, int rssi); - -extern void wlc_phy_chanspec_ch14_widefilter_set(struct brcms_phy_pub *ppi, - bool wide_filter); -extern void wlc_phy_chanspec_band_validch(struct brcms_phy_pub *ppi, uint band, - struct brcms_chanvec *channels); -extern u16 wlc_phy_chanspec_band_firstch(struct brcms_phy_pub *ppi, - uint band); - -extern void wlc_phy_txpower_sromlimit(struct brcms_phy_pub *ppi, uint chan, - u8 *_min_, u8 *_max_, int rate); -extern void wlc_phy_txpower_sromlimit_max_get(struct brcms_phy_pub *ppi, - uint chan, u8 *_max_, u8 *_min_); -extern void wlc_phy_txpower_boardlimit_band(struct brcms_phy_pub *ppi, - uint band, s32 *, s32 *, u32 *); -extern void wlc_phy_txpower_limit_set(struct brcms_phy_pub *ppi, - struct txpwr_limits *, - u16 chanspec); -extern int wlc_phy_txpower_get(struct brcms_phy_pub *ppi, uint *qdbm, - bool *override); -extern int wlc_phy_txpower_set(struct brcms_phy_pub *ppi, uint qdbm, - bool override); -extern void wlc_phy_txpower_target_set(struct brcms_phy_pub *ppi, - struct txpwr_limits *); -extern bool wlc_phy_txpower_hw_ctrl_get(struct brcms_phy_pub *ppi); -extern void wlc_phy_txpower_hw_ctrl_set(struct brcms_phy_pub *ppi, - bool hwpwrctrl); -extern u8 wlc_phy_txpower_get_target_min(struct brcms_phy_pub *ppi); -extern u8 wlc_phy_txpower_get_target_max(struct brcms_phy_pub *ppi); -extern bool wlc_phy_txpower_ipa_ison(struct brcms_phy_pub *pih); - -extern void wlc_phy_stf_chain_init(struct brcms_phy_pub *pih, u8 txchain, - u8 rxchain); -extern void wlc_phy_stf_chain_set(struct brcms_phy_pub *pih, u8 txchain, - u8 rxchain); -extern void wlc_phy_stf_chain_get(struct brcms_phy_pub *pih, u8 *txchain, - u8 *rxchain); -extern u8 wlc_phy_stf_chain_active_get(struct brcms_phy_pub *pih); -extern s8 wlc_phy_stf_ssmode_get(struct brcms_phy_pub *pih, - u16 chanspec); -extern void wlc_phy_ldpc_override_set(struct brcms_phy_pub *ppi, bool val); - -extern void wlc_phy_cal_perical(struct brcms_phy_pub *ppi, u8 reason); -extern void wlc_phy_noise_sample_request_external(struct brcms_phy_pub *ppi); -extern void wlc_phy_edcrs_lock(struct brcms_phy_pub *pih, bool lock); -extern void wlc_phy_cal_papd_recal(struct brcms_phy_pub *ppi); - -extern void wlc_phy_ant_rxdiv_set(struct brcms_phy_pub *ppi, u8 val); -extern void wlc_phy_clear_tssi(struct brcms_phy_pub *ppi); -extern void wlc_phy_hold_upd(struct brcms_phy_pub *ppi, u32 id, bool val); -extern void wlc_phy_mute_upd(struct brcms_phy_pub *ppi, bool val, u32 flags); - -extern void wlc_phy_antsel_type_set(struct brcms_phy_pub *ppi, u8 antsel_type); - -extern void wlc_phy_txpower_get_current(struct brcms_phy_pub *ppi, - struct tx_power *power, uint channel); - -extern void wlc_phy_initcal_enable(struct brcms_phy_pub *pih, bool initcal); -extern bool wlc_phy_test_ison(struct brcms_phy_pub *ppi); -extern void wlc_phy_txpwr_percent_set(struct brcms_phy_pub *ppi, - u8 txpwr_percent); -extern void wlc_phy_ofdm_rateset_war(struct brcms_phy_pub *pih, bool war); -extern void wlc_phy_bf_preempt_enable(struct brcms_phy_pub *pih, - bool bf_preempt); -extern void wlc_phy_machwcap_set(struct brcms_phy_pub *ppi, u32 machwcap); - -extern void wlc_phy_runbist_config(struct brcms_phy_pub *ppi, bool start_end); - -extern void wlc_phy_freqtrack_start(struct brcms_phy_pub *ppi); -extern void wlc_phy_freqtrack_end(struct brcms_phy_pub *ppi); - -extern const u8 *wlc_phy_get_ofdm_rate_lookup(void); - -extern s8 wlc_phy_get_tx_power_offset_by_mcs(struct brcms_phy_pub *ppi, - u8 mcs_offset); -extern s8 wlc_phy_get_tx_power_offset(struct brcms_phy_pub *ppi, u8 tbl_offset); -#endif /* _BRCM_PHY_HAL_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h deleted file mode 100644 index 1dc767c31653..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h +++ /dev/null @@ -1,1161 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_PHY_INT_H_ -#define _BRCM_PHY_INT_H_ - -#include -#include -#include - -#define PHY_VERSION { 1, 82, 8, 0 } - -#define LCNXN_BASEREV 16 - -struct phy_shim_info; - -struct brcms_phy_srom_fem { - /* TSSI positive slope, 1: positive, 0: negative */ - u8 tssipos; - /* Ext PA gain-type: full-gain: 0, pa-lite: 1, no_pa: 2 */ - u8 extpagain; - /* support 32 combinations of different Pdet dynamic ranges */ - u8 pdetrange; - /* TR switch isolation */ - u8 triso; - /* antswctrl lookup table configuration: 32 possible choices */ - u8 antswctrllut; -}; - -#define ISNPHY(pi) PHYTYPE_IS((pi)->pubpi.phy_type, PHY_TYPE_N) -#define ISLCNPHY(pi) PHYTYPE_IS((pi)->pubpi.phy_type, PHY_TYPE_LCN) - -#define PHY_GET_RFATTN(rfgain) ((rfgain) & 0x0f) -#define PHY_GET_PADMIX(rfgain) (((rfgain) & 0x10) >> 4) -#define PHY_GET_RFGAINID(rfattn, padmix, width) ((rfattn) + ((padmix)*(width))) -#define PHY_SAT(x, n) ((x) > ((1<<((n)-1))-1) ? ((1<<((n)-1))-1) : \ - ((x) < -(1<<((n)-1)) ? -(1<<((n)-1)) : (x))) -#define PHY_SHIFT_ROUND(x, n) ((x) >= 0 ? ((x)+(1<<((n)-1)))>>(n) : (x)>>(n)) -#define PHY_HW_ROUND(x, s) ((x >> s) + ((x >> (s-1)) & (s != 0))) - -#define CH_5G_GROUP 3 -#define A_LOW_CHANS 0 -#define A_MID_CHANS 1 -#define A_HIGH_CHANS 2 -#define CH_2G_GROUP 1 -#define G_ALL_CHANS 0 - -#define FIRST_REF5_CHANNUM 149 -#define LAST_REF5_CHANNUM 165 -#define FIRST_5G_CHAN 14 -#define LAST_5G_CHAN 50 -#define FIRST_MID_5G_CHAN 14 -#define LAST_MID_5G_CHAN 35 -#define FIRST_HIGH_5G_CHAN 36 -#define LAST_HIGH_5G_CHAN 41 -#define FIRST_LOW_5G_CHAN 42 -#define LAST_LOW_5G_CHAN 50 - -#define BASE_LOW_5G_CHAN 4900 -#define BASE_MID_5G_CHAN 5100 -#define BASE_HIGH_5G_CHAN 5500 - -#define CHAN5G_FREQ(chan) (5000 + chan*5) -#define CHAN2G_FREQ(chan) (2407 + chan*5) - -#define TXP_FIRST_CCK 0 -#define TXP_LAST_CCK 3 -#define TXP_FIRST_OFDM 4 -#define TXP_LAST_OFDM 11 -#define TXP_FIRST_OFDM_20_CDD 12 -#define TXP_LAST_OFDM_20_CDD 19 -#define TXP_FIRST_MCS_20_SISO 20 -#define TXP_LAST_MCS_20_SISO 27 -#define TXP_FIRST_MCS_20_CDD 28 -#define TXP_LAST_MCS_20_CDD 35 -#define TXP_FIRST_MCS_20_STBC 36 -#define TXP_LAST_MCS_20_STBC 43 -#define TXP_FIRST_MCS_20_SDM 44 -#define TXP_LAST_MCS_20_SDM 51 -#define TXP_FIRST_OFDM_40_SISO 52 -#define TXP_LAST_OFDM_40_SISO 59 -#define TXP_FIRST_OFDM_40_CDD 60 -#define TXP_LAST_OFDM_40_CDD 67 -#define TXP_FIRST_MCS_40_SISO 68 -#define TXP_LAST_MCS_40_SISO 75 -#define TXP_FIRST_MCS_40_CDD 76 -#define TXP_LAST_MCS_40_CDD 83 -#define TXP_FIRST_MCS_40_STBC 84 -#define TXP_LAST_MCS_40_STBC 91 -#define TXP_FIRST_MCS_40_SDM 92 -#define TXP_LAST_MCS_40_SDM 99 -#define TXP_MCS_32 100 -#define TXP_NUM_RATES 101 -#define ADJ_PWR_TBL_LEN 84 - -#define TXP_FIRST_SISO_MCS_20 20 -#define TXP_LAST_SISO_MCS_20 27 - -#define PHY_CORE_NUM_1 1 -#define PHY_CORE_NUM_2 2 -#define PHY_CORE_NUM_3 3 -#define PHY_CORE_NUM_4 4 -#define PHY_CORE_MAX PHY_CORE_NUM_4 -#define PHY_CORE_0 0 -#define PHY_CORE_1 1 -#define PHY_CORE_2 2 -#define PHY_CORE_3 3 - -#define MA_WINDOW_SZ 8 - -#define PHY_NOISE_SAMPLE_MON 1 -#define PHY_NOISE_SAMPLE_EXTERNAL 2 -#define PHY_NOISE_WINDOW_SZ 16 -#define PHY_NOISE_GLITCH_INIT_MA 10 -#define PHY_NOISE_GLITCH_INIT_MA_BADPlCP 10 -#define PHY_NOISE_STATE_MON 0x1 -#define PHY_NOISE_STATE_EXTERNAL 0x2 -#define PHY_NOISE_SAMPLE_LOG_NUM_NPHY 10 -#define PHY_NOISE_SAMPLE_LOG_NUM_UCODE 9 - -#define PHY_NOISE_OFFSETFACT_4322 (-103) -#define PHY_NOISE_MA_WINDOW_SZ 2 - -#define PHY_RSSI_TABLE_SIZE 64 -#define RSSI_ANT_MERGE_MAX 0 -#define RSSI_ANT_MERGE_MIN 1 -#define RSSI_ANT_MERGE_AVG 2 - -#define PHY_TSSI_TABLE_SIZE 64 -#define APHY_TSSI_TABLE_SIZE 256 -#define TX_GAIN_TABLE_LENGTH 64 -#define DEFAULT_11A_TXP_IDX 24 -#define NUM_TSSI_FRAMES 4 -#define NULL_TSSI 0x7f -#define NULL_TSSI_W 0x7f7f - -#define PHY_PAPD_EPS_TBL_SIZE_LCNPHY 64 - -#define LCNPHY_PERICAL_TEMPBASED_TXPWRCTRL 9 - -#define PHY_TXPWR_MIN 10 -#define PHY_TXPWR_MIN_NPHY 8 -#define RADIOPWR_OVERRIDE_DEF (-1) - -#define PWRTBL_NUM_COEFF 3 - -#define SPURAVOID_DISABLE 0 -#define SPURAVOID_AUTO 1 -#define SPURAVOID_FORCEON 2 -#define SPURAVOID_FORCEON2 3 - -#define PHY_SW_TIMER_FAST 15 -#define PHY_SW_TIMER_SLOW 60 -#define PHY_SW_TIMER_GLACIAL 120 - -#define PHY_PERICAL_AUTO 0 -#define PHY_PERICAL_FULL 1 -#define PHY_PERICAL_PARTIAL 2 - -#define PHY_PERICAL_NODELAY 0 -#define PHY_PERICAL_INIT_DELAY 5 -#define PHY_PERICAL_ASSOC_DELAY 5 -#define PHY_PERICAL_WDOG_DELAY 5 - -#define MPHASE_TXCAL_NUMCMDS 2 - -#define PHY_PERICAL_MPHASE_PENDING(pi) \ - (pi->mphase_cal_phase_id > MPHASE_CAL_STATE_IDLE) - -enum { - MPHASE_CAL_STATE_IDLE = 0, - MPHASE_CAL_STATE_INIT = 1, - MPHASE_CAL_STATE_TXPHASE0, - MPHASE_CAL_STATE_TXPHASE1, - MPHASE_CAL_STATE_TXPHASE2, - MPHASE_CAL_STATE_TXPHASE3, - MPHASE_CAL_STATE_TXPHASE4, - MPHASE_CAL_STATE_TXPHASE5, - MPHASE_CAL_STATE_PAPDCAL, - MPHASE_CAL_STATE_RXCAL, - MPHASE_CAL_STATE_RSSICAL, - MPHASE_CAL_STATE_IDLETSSI -}; - -enum phy_cal_mode { - CAL_FULL, - CAL_RECAL, - CAL_CURRECAL, - CAL_DIGCAL, - CAL_GCTRL, - CAL_SOFT, - CAL_DIGLO -}; - -#define RDR_NTIERS 1 -#define RDR_TIER_SIZE 64 -#define RDR_LIST_SIZE (512/3) -#define RDR_EPOCH_SIZE 40 -#define RDR_NANTENNAS 2 -#define RDR_NTIER_SIZE RDR_LIST_SIZE -#define RDR_LP_BUFFER_SIZE 64 -#define LP_LEN_HIS_SIZE 10 - -#define STATIC_NUM_RF 32 -#define STATIC_NUM_BB 9 - -#define BB_MULT_MASK 0x0000ffff -#define BB_MULT_VALID_MASK 0x80000000 - -#define CORDIC_AG 39797 -#define CORDIC_NI 18 -#define FIXED(X) ((s32)((X) << 16)) - -#define FLOAT(X) \ - (((X) >= 0) ? ((((X) >> 15) + 1) >> 1) : -((((-(X)) >> 15) + 1) >> 1)) - -#define PHY_CHAIN_TX_DISABLE_TEMP 115 -#define PHY_HYSTERESIS_DELTATEMP 5 - -#define SCAN_INPROG_PHY(pi) \ - (mboolisset(pi->measure_hold, PHY_HOLD_FOR_SCAN)) - -#define PLT_INPROG_PHY(pi) (mboolisset(pi->measure_hold, PHY_HOLD_FOR_PLT)) - -#define ASSOC_INPROG_PHY(pi) \ - (mboolisset(pi->measure_hold, PHY_HOLD_FOR_ASSOC)) - -#define SCAN_RM_IN_PROGRESS(pi) \ - (mboolisset(pi->measure_hold, PHY_HOLD_FOR_SCAN | PHY_HOLD_FOR_RM)) - -#define PHY_MUTED(pi) \ - (mboolisset(pi->measure_hold, PHY_HOLD_FOR_MUTE)) - -#define PUB_NOT_ASSOC(pi) \ - (mboolisset(pi->measure_hold, PHY_HOLD_FOR_NOT_ASSOC)) - -struct phy_table_info { - uint table; - int q; - uint max; -}; - -struct phytbl_info { - const void *tbl_ptr; - u32 tbl_len; - u32 tbl_id; - u32 tbl_offset; - u32 tbl_width; -}; - -struct interference_info { - u8 curr_home_channel; - u16 crsminpwrthld_40_stored; - u16 crsminpwrthld_20L_stored; - u16 crsminpwrthld_20U_stored; - u16 init_gain_code_core1_stored; - u16 init_gain_code_core2_stored; - u16 init_gain_codeb_core1_stored; - u16 init_gain_codeb_core2_stored; - u16 init_gain_table_stored[4]; - - u16 clip1_hi_gain_code_core1_stored; - u16 clip1_hi_gain_code_core2_stored; - u16 clip1_hi_gain_codeb_core1_stored; - u16 clip1_hi_gain_codeb_core2_stored; - u16 nb_clip_thresh_core1_stored; - u16 nb_clip_thresh_core2_stored; - u16 init_ofdmlna2gainchange_stored[4]; - u16 init_ccklna2gainchange_stored[4]; - u16 clip1_lo_gain_code_core1_stored; - u16 clip1_lo_gain_code_core2_stored; - u16 clip1_lo_gain_codeb_core1_stored; - u16 clip1_lo_gain_codeb_core2_stored; - u16 w1_clip_thresh_core1_stored; - u16 w1_clip_thresh_core2_stored; - u16 radio_2056_core1_rssi_gain_stored; - u16 radio_2056_core2_rssi_gain_stored; - u16 energy_drop_timeout_len_stored; - - u16 ed_crs40_assertthld0_stored; - u16 ed_crs40_assertthld1_stored; - u16 ed_crs40_deassertthld0_stored; - u16 ed_crs40_deassertthld1_stored; - u16 ed_crs20L_assertthld0_stored; - u16 ed_crs20L_assertthld1_stored; - u16 ed_crs20L_deassertthld0_stored; - u16 ed_crs20L_deassertthld1_stored; - u16 ed_crs20U_assertthld0_stored; - u16 ed_crs20U_assertthld1_stored; - u16 ed_crs20U_deassertthld0_stored; - u16 ed_crs20U_deassertthld1_stored; - - u16 badplcp_ma; - u16 badplcp_ma_previous; - u16 badplcp_ma_total; - u16 badplcp_ma_list[MA_WINDOW_SZ]; - int badplcp_ma_index; - s16 pre_badplcp_cnt; - s16 bphy_pre_badplcp_cnt; - - u16 init_gain_core1; - u16 init_gain_core2; - u16 init_gainb_core1; - u16 init_gainb_core2; - u16 init_gain_rfseq[4]; - - u16 crsminpwr0; - u16 crsminpwrl0; - u16 crsminpwru0; - - s16 crsminpwr_index; - - u16 radio_2057_core1_rssi_wb1a_gc_stored; - u16 radio_2057_core2_rssi_wb1a_gc_stored; - u16 radio_2057_core1_rssi_wb1g_gc_stored; - u16 radio_2057_core2_rssi_wb1g_gc_stored; - u16 radio_2057_core1_rssi_wb2_gc_stored; - u16 radio_2057_core2_rssi_wb2_gc_stored; - u16 radio_2057_core1_rssi_nb_gc_stored; - u16 radio_2057_core2_rssi_nb_gc_stored; -}; - -struct aci_save_gphy { - u16 rc_cal_ovr; - u16 phycrsth1; - u16 phycrsth2; - u16 init_n1p1_gain; - u16 p1_p2_gain; - u16 n1_n2_gain; - u16 n1_p1_gain; - u16 div_search_gain; - u16 div_p1_p2_gain; - u16 div_search_gn_change; - u16 table_7_2; - u16 table_7_3; - u16 cckshbits_gnref; - u16 clip_thresh; - u16 clip2_thresh; - u16 clip3_thresh; - u16 clip_p2_thresh; - u16 clip_pwdn_thresh; - u16 clip_n1p1_thresh; - u16 clip_n1_pwdn_thresh; - u16 bbconfig; - u16 cthr_sthr_shdin; - u16 energy; - u16 clip_p1_p2_thresh; - u16 threshold; - u16 reg15; - u16 reg16; - u16 reg17; - u16 div_srch_idx; - u16 div_srch_p1_p2; - u16 div_srch_gn_back; - u16 ant_dwell; - u16 ant_wr_settle; -}; - -struct lo_complex_abgphy_info { - s8 i; - s8 q; -}; - -struct nphy_iq_comp { - s16 a0; - s16 b0; - s16 a1; - s16 b1; -}; - -struct nphy_txpwrindex { - s8 index; - s8 index_internal; - s8 index_internal_save; - u16 AfectrlOverride; - u16 AfeCtrlDacGain; - u16 rad_gain; - u8 bbmult; - u16 iqcomp_a; - u16 iqcomp_b; - u16 locomp; -}; - -struct txiqcal_cache { - - u16 txcal_coeffs_2G[8]; - u16 txcal_radio_regs_2G[8]; - struct nphy_iq_comp rxcal_coeffs_2G; - - u16 txcal_coeffs_5G[8]; - u16 txcal_radio_regs_5G[8]; - struct nphy_iq_comp rxcal_coeffs_5G; -}; - -struct nphy_pwrctrl { - s8 max_pwr_2g; - s8 idle_targ_2g; - s16 pwrdet_2g_a1; - s16 pwrdet_2g_b0; - s16 pwrdet_2g_b1; - s8 max_pwr_5gm; - s8 idle_targ_5gm; - s8 max_pwr_5gh; - s8 max_pwr_5gl; - s16 pwrdet_5gm_a1; - s16 pwrdet_5gm_b0; - s16 pwrdet_5gm_b1; - s16 pwrdet_5gl_a1; - s16 pwrdet_5gl_b0; - s16 pwrdet_5gl_b1; - s16 pwrdet_5gh_a1; - s16 pwrdet_5gh_b0; - s16 pwrdet_5gh_b1; - s8 idle_targ_5gl; - s8 idle_targ_5gh; - s8 idle_tssi_2g; - s8 idle_tssi_5g; - s8 idle_tssi; - s16 a1; - s16 b0; - s16 b1; -}; - -struct nphy_txgains { - u16 txlpf[2]; - u16 txgm[2]; - u16 pga[2]; - u16 pad[2]; - u16 ipa[2]; -}; - -#define PHY_NOISEVAR_BUFSIZE 10 - -struct nphy_noisevar_buf { - int bufcount; - int tone_id[PHY_NOISEVAR_BUFSIZE]; - u32 noise_vars[PHY_NOISEVAR_BUFSIZE]; - u32 min_noise_vars[PHY_NOISEVAR_BUFSIZE]; -}; - -struct rssical_cache { - u16 rssical_radio_regs_2G[2]; - u16 rssical_phyregs_2G[12]; - - u16 rssical_radio_regs_5G[2]; - u16 rssical_phyregs_5G[12]; -}; - -struct lcnphy_cal_results { - - u16 txiqlocal_a; - u16 txiqlocal_b; - u16 txiqlocal_didq; - u8 txiqlocal_ei0; - u8 txiqlocal_eq0; - u8 txiqlocal_fi0; - u8 txiqlocal_fq0; - - u16 txiqlocal_bestcoeffs[11]; - u16 txiqlocal_bestcoeffs_valid; - - u32 papd_eps_tbl[PHY_PAPD_EPS_TBL_SIZE_LCNPHY]; - u16 analog_gain_ref; - u16 lut_begin; - u16 lut_end; - u16 lut_step; - u16 rxcompdbm; - u16 papdctrl; - u16 sslpnCalibClkEnCtrl; - - u16 rxiqcal_coeff_a0; - u16 rxiqcal_coeff_b0; -}; - -struct shared_phy { - struct brcms_phy *phy_head; - uint unit; - struct phy_shim_info *physhim; - uint corerev; - u32 machwcap; - bool up; - bool clk; - uint now; - u16 vid; - u16 did; - uint chip; - uint chiprev; - uint chippkg; - uint sromrev; - uint boardtype; - uint boardrev; - u32 boardflags; - u32 boardflags2; - uint fast_timer; - uint slow_timer; - uint glacial_timer; - u8 rx_antdiv; - s8 phy_noise_window[MA_WINDOW_SZ]; - uint phy_noise_index; - u8 hw_phytxchain; - u8 hw_phyrxchain; - u8 phytxchain; - u8 phyrxchain; - u8 rssi_mode; - bool _rifs_phy; -}; - -struct brcms_phy_pub { - uint phy_type; - uint phy_rev; - u8 phy_corenum; - u16 radioid; - u8 radiorev; - u8 radiover; - - uint coreflags; - uint ana_rev; - bool abgphy_encore; -}; - -struct phy_func_ptr { - void (*init)(struct brcms_phy *); - void (*calinit)(struct brcms_phy *); - void (*chanset)(struct brcms_phy *, u16 chanspec); - void (*txpwrrecalc)(struct brcms_phy *); - int (*longtrn)(struct brcms_phy *, int); - void (*txiqccget)(struct brcms_phy *, u16 *, u16 *); - void (*txiqccset)(struct brcms_phy *, u16, u16); - u16 (*txloccget)(struct brcms_phy *); - void (*radioloftget)(struct brcms_phy *, u8 *, u8 *, u8 *, u8 *); - void (*carrsuppr)(struct brcms_phy *); - s32 (*rxsigpwr)(struct brcms_phy *, s32); - void (*detach)(struct brcms_phy *); -}; - -struct brcms_phy { - struct brcms_phy_pub pubpi_ro; - struct shared_phy *sh; - struct phy_func_ptr pi_fptr; - - union { - struct brcms_phy_lcnphy *pi_lcnphy; - } u; - bool user_txpwr_at_rfport; - - struct bcma_device *d11core; - struct brcms_phy *next; - struct brcms_phy_pub pubpi; - - bool do_initcal; - bool phytest_on; - bool ofdm_rateset_war; - bool bf_preempt_4306; - u16 radio_chanspec; - u8 antsel_type; - u16 bw; - u8 txpwr_percent; - bool phy_init_por; - - bool init_in_progress; - bool initialized; - bool sbtml_gm; - uint refcnt; - bool watchdog_override; - u8 phynoise_state; - uint phynoise_now; - int phynoise_chan_watchdog; - bool phynoise_polling; - bool disable_percal; - u32 measure_hold; - - s16 txpa_2g[PWRTBL_NUM_COEFF]; - s16 txpa_2g_low_temp[PWRTBL_NUM_COEFF]; - s16 txpa_2g_high_temp[PWRTBL_NUM_COEFF]; - s16 txpa_5g_low[PWRTBL_NUM_COEFF]; - s16 txpa_5g_mid[PWRTBL_NUM_COEFF]; - s16 txpa_5g_hi[PWRTBL_NUM_COEFF]; - - u8 tx_srom_max_2g; - u8 tx_srom_max_5g_low; - u8 tx_srom_max_5g_mid; - u8 tx_srom_max_5g_hi; - u8 tx_srom_max_rate_2g[TXP_NUM_RATES]; - u8 tx_srom_max_rate_5g_low[TXP_NUM_RATES]; - u8 tx_srom_max_rate_5g_mid[TXP_NUM_RATES]; - u8 tx_srom_max_rate_5g_hi[TXP_NUM_RATES]; - u8 tx_user_target[TXP_NUM_RATES]; - s8 tx_power_offset[TXP_NUM_RATES]; - u8 tx_power_target[TXP_NUM_RATES]; - - struct brcms_phy_srom_fem srom_fem2g; - struct brcms_phy_srom_fem srom_fem5g; - - u8 tx_power_max; - u8 tx_power_max_rate_ind; - bool hwpwrctrl; - u8 nphy_txpwrctrl; - s8 nphy_txrx_chain; - bool phy_5g_pwrgain; - - u16 phy_wreg; - u16 phy_wreg_limit; - - s8 n_preamble_override; - u8 antswitch; - u8 aa2g, aa5g; - - s8 idle_tssi[CH_5G_GROUP]; - s8 target_idle_tssi; - s8 txpwr_est_Pout; - u8 tx_power_min; - u8 txpwr_limit[TXP_NUM_RATES]; - u8 txpwr_env_limit[TXP_NUM_RATES]; - u8 adj_pwr_tbl_nphy[ADJ_PWR_TBL_LEN]; - - bool channel_14_wide_filter; - - bool txpwroverride; - bool txpwridx_override_aphy; - s16 radiopwr_override; - u16 hwpwr_txcur; - u8 saved_txpwr_idx; - - bool edcrs_threshold_lock; - - u32 tr_R_gain_val; - u32 tr_T_gain_val; - - s16 ofdm_analog_filt_bw_override; - s16 cck_analog_filt_bw_override; - s16 ofdm_rccal_override; - s16 cck_rccal_override; - u16 extlna_type; - - uint interference_mode_crs_time; - u16 crsglitch_prev; - bool interference_mode_crs; - - u32 phy_tx_tone_freq; - uint phy_lastcal; - bool phy_forcecal; - bool phy_fixed_noise; - u32 xtalfreq; - u8 pdiv; - s8 carrier_suppr_disable; - - bool phy_bphy_evm; - bool phy_bphy_rfcs; - s8 phy_scraminit; - u8 phy_gpiosel; - - s16 phy_txcore_disable_temp; - s16 phy_txcore_enable_temp; - s8 phy_tempsense_offset; - bool phy_txcore_heatedup; - - u16 radiopwr; - u16 bb_atten; - u16 txctl1; - - u16 mintxbias; - u16 mintxmag; - struct lo_complex_abgphy_info gphy_locomp_iq - [STATIC_NUM_RF][STATIC_NUM_BB]; - s8 stats_11b_txpower[STATIC_NUM_RF][STATIC_NUM_BB]; - u16 gain_table[TX_GAIN_TABLE_LENGTH]; - bool loopback_gain; - s16 max_lpback_gain_hdB; - s16 trsw_rx_gain_hdB; - u8 power_vec[8]; - - u16 rc_cal; - int nrssi_table_delta; - int nrssi_slope_scale; - int nrssi_slope_offset; - int min_rssi; - int max_rssi; - - s8 txpwridx; - u8 min_txpower; - - u8 a_band_high_disable; - - u16 tx_vos; - u16 global_tx_bb_dc_bias_loft; - - int rf_max; - int bb_max; - int rf_list_size; - int bb_list_size; - u16 *rf_attn_list; - u16 *bb_attn_list; - u16 padmix_mask; - u16 padmix_reg; - u16 *txmag_list; - uint txmag_len; - bool txmag_enable; - - s8 *a_tssi_to_dbm; - s8 *m_tssi_to_dbm; - s8 *l_tssi_to_dbm; - s8 *h_tssi_to_dbm; - u8 *hwtxpwr; - - u16 freqtrack_saved_regs[2]; - int cur_interference_mode; - bool hwpwrctrl_capable; - bool temppwrctrl_capable; - - uint phycal_nslope; - uint phycal_noffset; - uint phycal_mlo; - uint phycal_txpower; - - u8 phy_aa2g; - - bool nphy_tableloaded; - s8 nphy_rssisel; - u32 nphy_bb_mult_save; - u16 nphy_txiqlocal_bestc[11]; - bool nphy_txiqlocal_coeffsvalid; - struct nphy_txpwrindex nphy_txpwrindex[PHY_CORE_NUM_2]; - struct nphy_pwrctrl nphy_pwrctrl_info[PHY_CORE_NUM_2]; - u16 cck2gpo; - u32 ofdm2gpo; - u32 ofdm5gpo; - u32 ofdm5glpo; - u32 ofdm5ghpo; - u8 bw402gpo; - u8 bw405gpo; - u8 bw405glpo; - u8 bw405ghpo; - u8 cdd2gpo; - u8 cdd5gpo; - u8 cdd5glpo; - u8 cdd5ghpo; - u8 stbc2gpo; - u8 stbc5gpo; - u8 stbc5glpo; - u8 stbc5ghpo; - u8 bwdup2gpo; - u8 bwdup5gpo; - u8 bwdup5glpo; - u8 bwdup5ghpo; - u16 mcs2gpo[8]; - u16 mcs5gpo[8]; - u16 mcs5glpo[8]; - u16 mcs5ghpo[8]; - u32 nphy_rxcalparams; - - u8 phy_spuravoid; - bool phy_isspuravoid; - - u8 phy_pabias; - u8 nphy_papd_skip; - u8 nphy_tssi_slope; - - s16 nphy_noise_win[PHY_CORE_MAX][PHY_NOISE_WINDOW_SZ]; - u8 nphy_noise_index; - - bool nphy_gain_boost; - bool nphy_elna_gain_config; - u16 old_bphy_test; - u16 old_bphy_testcontrol; - - bool phyhang_avoid; - - bool rssical_nphy; - u8 nphy_perical; - uint nphy_perical_last; - u8 cal_type_override; - u8 mphase_cal_phase_id; - u8 mphase_txcal_cmdidx; - u8 mphase_txcal_numcmds; - u16 mphase_txcal_bestcoeffs[11]; - u16 nphy_txiqlocal_chanspec; - u16 nphy_iqcal_chanspec_2G; - u16 nphy_iqcal_chanspec_5G; - u16 nphy_rssical_chanspec_2G; - u16 nphy_rssical_chanspec_5G; - struct wlapi_timer *phycal_timer; - bool use_int_tx_iqlo_cal_nphy; - bool internal_tx_iqlo_cal_tapoff_intpa_nphy; - s16 nphy_lastcal_temp; - - struct txiqcal_cache calibration_cache; - struct rssical_cache rssical_cache; - - u8 nphy_txpwr_idx[2]; - u8 nphy_papd_cal_type; - uint nphy_papd_last_cal; - u16 nphy_papd_tx_gain_at_last_cal[2]; - u8 nphy_papd_cal_gain_index[2]; - s16 nphy_papd_epsilon_offset[2]; - bool nphy_papd_recal_enable; - u32 nphy_papd_recal_counter; - bool nphy_force_papd_cal; - bool nphy_papdcomp; - bool ipa2g_on; - bool ipa5g_on; - - u16 classifier_state; - u16 clip_state[2]; - uint nphy_deaf_count; - u8 rxiq_samps; - u8 rxiq_antsel; - - u16 rfctrlIntc1_save; - u16 rfctrlIntc2_save; - bool first_cal_after_assoc; - u16 tx_rx_cal_radio_saveregs[22]; - u16 tx_rx_cal_phy_saveregs[15]; - - u8 nphy_cal_orig_pwr_idx[2]; - u8 nphy_txcal_pwr_idx[2]; - u8 nphy_rxcal_pwr_idx[2]; - u16 nphy_cal_orig_tx_gain[2]; - struct nphy_txgains nphy_cal_target_gain; - u16 nphy_txcal_bbmult; - u16 nphy_gmval; - - u16 nphy_saved_bbconf; - - bool nphy_gband_spurwar_en; - bool nphy_gband_spurwar2_en; - bool nphy_aband_spurwar_en; - u16 nphy_rccal_value; - u16 nphy_crsminpwr[3]; - struct nphy_noisevar_buf nphy_saved_noisevars; - bool nphy_anarxlpf_adjusted; - bool nphy_crsminpwr_adjusted; - bool nphy_noisevars_adjusted; - - bool nphy_rxcal_active; - u16 radar_percal_mask; - bool dfs_lp_buffer_nphy; - - u16 nphy_fineclockgatecontrol; - - s8 rx2tx_biasentry; - - u16 crsminpwr0; - u16 crsminpwrl0; - u16 crsminpwru0; - s16 noise_crsminpwr_index; - u16 init_gain_core1; - u16 init_gain_core2; - u16 init_gainb_core1; - u16 init_gainb_core2; - u8 aci_noise_curr_channel; - u16 init_gain_rfseq[4]; - - bool radio_is_on; - - bool nphy_sample_play_lpf_bw_ctl_ovr; - - u16 tbl_data_hi; - u16 tbl_data_lo; - u16 tbl_addr; - - uint tbl_save_id; - uint tbl_save_offset; - - u8 txpwrctrl; - s8 txpwrindex[PHY_CORE_MAX]; - - u8 phycal_tempdelta; - u32 mcs20_po; - u32 mcs40_po; - struct wiphy *wiphy; -}; - -struct cs32 { - s32 q; - s32 i; -}; - -struct radio_regs { - u16 address; - u32 init_a; - u32 init_g; - u8 do_init_a; - u8 do_init_g; -}; - -struct radio_20xx_regs { - u16 address; - u8 init; - u8 do_init; -}; - -struct lcnphy_radio_regs { - u16 address; - u8 init_a; - u8 init_g; - u8 do_init_a; - u8 do_init_g; -}; - -extern u16 read_phy_reg(struct brcms_phy *pi, u16 addr); -extern void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val); -extern void and_phy_reg(struct brcms_phy *pi, u16 addr, u16 val); -extern void or_phy_reg(struct brcms_phy *pi, u16 addr, u16 val); -extern void mod_phy_reg(struct brcms_phy *pi, u16 addr, u16 mask, u16 val); - -extern u16 read_radio_reg(struct brcms_phy *pi, u16 addr); -extern void or_radio_reg(struct brcms_phy *pi, u16 addr, u16 val); -extern void and_radio_reg(struct brcms_phy *pi, u16 addr, u16 val); -extern void mod_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask, - u16 val); -extern void xor_radio_reg(struct brcms_phy *pi, u16 addr, u16 mask); - -extern void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val); - -extern void wlc_phyreg_enter(struct brcms_phy_pub *pih); -extern void wlc_phyreg_exit(struct brcms_phy_pub *pih); -extern void wlc_radioreg_enter(struct brcms_phy_pub *pih); -extern void wlc_radioreg_exit(struct brcms_phy_pub *pih); - -extern void wlc_phy_read_table(struct brcms_phy *pi, - const struct phytbl_info *ptbl_info, - u16 tblAddr, u16 tblDataHi, - u16 tblDatalo); -extern void wlc_phy_write_table(struct brcms_phy *pi, - const struct phytbl_info *ptbl_info, - u16 tblAddr, u16 tblDataHi, u16 tblDatalo); -extern void wlc_phy_table_addr(struct brcms_phy *pi, uint tbl_id, - uint tbl_offset, u16 tblAddr, u16 tblDataHi, - u16 tblDataLo); -extern void wlc_phy_table_data_write(struct brcms_phy *pi, uint width, u32 val); - -extern void write_phy_channel_reg(struct brcms_phy *pi, uint val); -extern void wlc_phy_txpower_update_shm(struct brcms_phy *pi); - -extern u8 wlc_phy_nbits(s32 value); -extern void wlc_phy_compute_dB(u32 *cmplx_pwr, s8 *p_dB, u8 core); - -extern uint wlc_phy_init_radio_regs_allbands(struct brcms_phy *pi, - struct radio_20xx_regs *radioregs); -extern uint wlc_phy_init_radio_regs(struct brcms_phy *pi, - const struct radio_regs *radioregs, - u16 core_offset); - -extern void wlc_phy_txpower_ipa_upd(struct brcms_phy *pi); - -extern void wlc_phy_do_dummy_tx(struct brcms_phy *pi, bool ofdm, bool pa_on); -extern void wlc_phy_papd_decode_epsilon(u32 epsilon, s32 *eps_real, - s32 *eps_imag); - -extern void wlc_phy_cal_perical_mphase_reset(struct brcms_phy *pi); -extern void wlc_phy_cal_perical_mphase_restart(struct brcms_phy *pi); - -extern bool wlc_phy_attach_nphy(struct brcms_phy *pi); -extern bool wlc_phy_attach_lcnphy(struct brcms_phy *pi); - -extern void wlc_phy_detach_lcnphy(struct brcms_phy *pi); - -extern void wlc_phy_init_nphy(struct brcms_phy *pi); -extern void wlc_phy_init_lcnphy(struct brcms_phy *pi); - -extern void wlc_phy_cal_init_nphy(struct brcms_phy *pi); -extern void wlc_phy_cal_init_lcnphy(struct brcms_phy *pi); - -extern void wlc_phy_chanspec_set_nphy(struct brcms_phy *pi, - u16 chanspec); -extern void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, - u16 chanspec); -extern void wlc_phy_chanspec_set_fixup_lcnphy(struct brcms_phy *pi, - u16 chanspec); -extern int wlc_phy_channel2freq(uint channel); -extern int wlc_phy_chanspec_freq2bandrange_lpssn(uint); -extern int wlc_phy_chanspec_bandrange_get(struct brcms_phy *, u16 chanspec); - -extern void wlc_lcnphy_set_tx_pwr_ctrl(struct brcms_phy *pi, u16 mode); -extern s8 wlc_lcnphy_get_current_tx_pwr_idx(struct brcms_phy *pi); - -extern void wlc_phy_txpower_recalc_target_nphy(struct brcms_phy *pi); -extern void wlc_lcnphy_txpower_recalc_target(struct brcms_phy *pi); -extern void wlc_phy_txpower_recalc_target_lcnphy(struct brcms_phy *pi); - -extern void wlc_lcnphy_set_tx_pwr_by_index(struct brcms_phy *pi, int index); -extern void wlc_lcnphy_tx_pu(struct brcms_phy *pi, bool bEnable); -extern void wlc_lcnphy_stop_tx_tone(struct brcms_phy *pi); -extern void wlc_lcnphy_start_tx_tone(struct brcms_phy *pi, s32 f_kHz, - u16 max_val, bool iqcalmode); - -extern void wlc_phy_txpower_sromlimit_get_nphy(struct brcms_phy *pi, uint chan, - u8 *max_pwr, u8 rate_id); -extern void wlc_phy_ofdm_to_mcs_powers_nphy(u8 *power, u8 rate_mcs_start, - u8 rate_mcs_end, - u8 rate_ofdm_start); -extern void wlc_phy_mcs_to_ofdm_powers_nphy(u8 *power, - u8 rate_ofdm_start, - u8 rate_ofdm_end, - u8 rate_mcs_start); - -extern u16 wlc_lcnphy_tempsense(struct brcms_phy *pi, bool mode); -extern s16 wlc_lcnphy_tempsense_new(struct brcms_phy *pi, bool mode); -extern s8 wlc_lcnphy_tempsense_degree(struct brcms_phy *pi, bool mode); -extern s8 wlc_lcnphy_vbatsense(struct brcms_phy *pi, bool mode); -extern void wlc_phy_carrier_suppress_lcnphy(struct brcms_phy *pi); -extern void wlc_lcnphy_crsuprs(struct brcms_phy *pi, int channel); -extern void wlc_lcnphy_epa_switch(struct brcms_phy *pi, bool mode); -extern void wlc_2064_vco_cal(struct brcms_phy *pi); - -extern void wlc_phy_txpower_recalc_target(struct brcms_phy *pi); - -#define LCNPHY_TBL_ID_PAPDCOMPDELTATBL 0x18 -#define LCNPHY_TX_POWER_TABLE_SIZE 128 -#define LCNPHY_MAX_TX_POWER_INDEX (LCNPHY_TX_POWER_TABLE_SIZE - 1) -#define LCNPHY_TBL_ID_TXPWRCTL 0x07 -#define LCNPHY_TX_PWR_CTRL_OFF 0 -#define LCNPHY_TX_PWR_CTRL_SW (0x1 << 15) -#define LCNPHY_TX_PWR_CTRL_HW ((0x1 << 15) | \ - (0x1 << 14) | \ - (0x1 << 13)) - -#define LCNPHY_TX_PWR_CTRL_TEMPBASED 0xE001 - -extern void wlc_lcnphy_write_table(struct brcms_phy *pi, - const struct phytbl_info *pti); -extern void wlc_lcnphy_read_table(struct brcms_phy *pi, - struct phytbl_info *pti); -extern void wlc_lcnphy_set_tx_iqcc(struct brcms_phy *pi, u16 a, u16 b); -extern void wlc_lcnphy_set_tx_locc(struct brcms_phy *pi, u16 didq); -extern void wlc_lcnphy_get_tx_iqcc(struct brcms_phy *pi, u16 *a, u16 *b); -extern u16 wlc_lcnphy_get_tx_locc(struct brcms_phy *pi); -extern void wlc_lcnphy_get_radio_loft(struct brcms_phy *pi, u8 *ei0, - u8 *eq0, u8 *fi0, u8 *fq0); -extern void wlc_lcnphy_calib_modes(struct brcms_phy *pi, uint mode); -extern void wlc_lcnphy_deaf_mode(struct brcms_phy *pi, bool mode); -extern bool wlc_phy_tpc_isenabled_lcnphy(struct brcms_phy *pi); -extern void wlc_lcnphy_tx_pwr_update_npt(struct brcms_phy *pi); -extern s32 wlc_lcnphy_tssi2dbm(s32 tssi, s32 a1, s32 b0, s32 b1); -extern void wlc_lcnphy_get_tssi(struct brcms_phy *pi, s8 *ofdm_pwr, - s8 *cck_pwr); -extern void wlc_lcnphy_tx_power_adjustment(struct brcms_phy_pub *ppi); - -extern s32 wlc_lcnphy_rx_signal_power(struct brcms_phy *pi, s32 gain_index); - -#define NPHY_MAX_HPVGA1_INDEX 10 -#define NPHY_DEF_HPVGA1_INDEXLIMIT 7 - -struct phy_iq_est { - s32 iq_prod; - u32 i_pwr; - u32 q_pwr; -}; - -extern void wlc_phy_stay_in_carriersearch_nphy(struct brcms_phy *pi, - bool enable); -extern void wlc_nphy_deaf_mode(struct brcms_phy *pi, bool mode); - -#define wlc_phy_write_table_nphy(pi, pti) \ - wlc_phy_write_table(pi, pti, 0x72, 0x74, 0x73) - -#define wlc_phy_read_table_nphy(pi, pti) \ - wlc_phy_read_table(pi, pti, 0x72, 0x74, 0x73) - -#define wlc_nphy_table_addr(pi, id, off) \ - wlc_phy_table_addr((pi), (id), (off), 0x72, 0x74, 0x73) - -#define wlc_nphy_table_data_write(pi, w, v) \ - wlc_phy_table_data_write((pi), (w), (v)) - -extern void wlc_phy_table_read_nphy(struct brcms_phy *pi, u32, u32 l, u32 o, - u32 w, void *d); -extern void wlc_phy_table_write_nphy(struct brcms_phy *pi, u32, u32, u32, - u32, const void *); - -#define PHY_IPA(pi) \ - ((pi->ipa2g_on && CHSPEC_IS2G(pi->radio_chanspec)) || \ - (pi->ipa5g_on && CHSPEC_IS5G(pi->radio_chanspec))) - -#define BRCMS_PHY_WAR_PR51571(pi) \ - if (NREV_LT((pi)->pubpi.phy_rev, 3)) \ - (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) - -extern void wlc_phy_cal_perical_nphy_run(struct brcms_phy *pi, u8 caltype); -extern void wlc_phy_aci_reset_nphy(struct brcms_phy *pi); -extern void wlc_phy_pa_override_nphy(struct brcms_phy *pi, bool en); - -extern u8 wlc_phy_get_chan_freq_range_nphy(struct brcms_phy *pi, uint chan); -extern void wlc_phy_switch_radio_nphy(struct brcms_phy *pi, bool on); - -extern void wlc_phy_stf_chain_upd_nphy(struct brcms_phy *pi); - -extern void wlc_phy_force_rfseq_nphy(struct brcms_phy *pi, u8 cmd); -extern s16 wlc_phy_tempsense_nphy(struct brcms_phy *pi); - -extern u16 wlc_phy_classifier_nphy(struct brcms_phy *pi, u16 mask, u16 val); - -extern void wlc_phy_rx_iq_est_nphy(struct brcms_phy *pi, struct phy_iq_est *est, - u16 num_samps, u8 wait_time, - u8 wait_for_crs); - -extern void wlc_phy_rx_iq_coeffs_nphy(struct brcms_phy *pi, u8 write, - struct nphy_iq_comp *comp); -extern void wlc_phy_aci_and_noise_reduction_nphy(struct brcms_phy *pi); - -extern void wlc_phy_rxcore_setstate_nphy(struct brcms_phy_pub *pih, - u8 rxcore_bitmask); -extern u8 wlc_phy_rxcore_getstate_nphy(struct brcms_phy_pub *pih); - -extern void wlc_phy_txpwrctrl_enable_nphy(struct brcms_phy *pi, u8 ctrl_type); -extern void wlc_phy_txpwr_fixpower_nphy(struct brcms_phy *pi); -extern void wlc_phy_txpwr_apply_nphy(struct brcms_phy *pi); -extern void wlc_phy_txpwr_papd_cal_nphy(struct brcms_phy *pi); -extern u16 wlc_phy_txpwr_idx_get_nphy(struct brcms_phy *pi); - -extern struct nphy_txgains wlc_phy_get_tx_gain_nphy(struct brcms_phy *pi); -extern int wlc_phy_cal_txiqlo_nphy(struct brcms_phy *pi, - struct nphy_txgains target_gain, - bool full, bool m); -extern int wlc_phy_cal_rxiq_nphy(struct brcms_phy *pi, - struct nphy_txgains target_gain, - u8 type, bool d); -extern void wlc_phy_txpwr_index_nphy(struct brcms_phy *pi, u8 core_mask, - s8 txpwrindex, bool res); -extern void wlc_phy_rssisel_nphy(struct brcms_phy *pi, u8 core, u8 rssi_type); -extern int wlc_phy_poll_rssi_nphy(struct brcms_phy *pi, u8 rssi_type, - s32 *rssi_buf, u8 nsamps); -extern void wlc_phy_rssi_cal_nphy(struct brcms_phy *pi); -extern int wlc_phy_aci_scan_nphy(struct brcms_phy *pi); -extern void wlc_phy_cal_txgainctrl_nphy(struct brcms_phy *pi, - s32 dBm_targetpower, bool debug); -extern int wlc_phy_tx_tone_nphy(struct brcms_phy *pi, u32 f_kHz, u16 max_val, - u8 mode, u8, bool); -extern void wlc_phy_stopplayback_nphy(struct brcms_phy *pi); -extern void wlc_phy_est_tonepwr_nphy(struct brcms_phy *pi, s32 *qdBm_pwrbuf, - u8 num_samps); -extern void wlc_phy_radio205x_vcocal_nphy(struct brcms_phy *pi); - -extern int wlc_phy_rssi_compute_nphy(struct brcms_phy *pi, - struct d11rxhdr *rxh); - -#define NPHY_TESTPATTERN_BPHY_EVM 0 -#define NPHY_TESTPATTERN_BPHY_RFCS 1 - -extern void wlc_phy_nphy_tkip_rifs_war(struct brcms_phy *pi, u8 rifs); - -void wlc_phy_get_pwrdet_offsets(struct brcms_phy *pi, s8 *cckoffset, - s8 *ofdmoffset); -extern s8 wlc_phy_upd_rssi_offset(struct brcms_phy *pi, s8 rssi, - u16 chanspec); - -extern bool wlc_phy_n_txpower_ipa_ison(struct brcms_phy *pih); -#endif /* _BRCM_PHY_INT_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c deleted file mode 100644 index 3d6b16ce4687..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c +++ /dev/null @@ -1,5148 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include - -#include -#include -#include -#include "phy_qmath.h" -#include "phy_hal.h" -#include "phy_radio.h" -#include "phytbl_lcn.h" -#include "phy_lcn.h" - -#define PLL_2064_NDIV 90 -#define PLL_2064_LOW_END_VCO 3000 -#define PLL_2064_LOW_END_KVCO 27 -#define PLL_2064_HIGH_END_VCO 4200 -#define PLL_2064_HIGH_END_KVCO 68 -#define PLL_2064_LOOP_BW_DOUBLER 200 -#define PLL_2064_D30_DOUBLER 10500 -#define PLL_2064_LOOP_BW 260 -#define PLL_2064_D30 8000 -#define PLL_2064_CAL_REF_TO 8 -#define PLL_2064_MHZ 1000000 -#define PLL_2064_OPEN_LOOP_DELAY 5 - -#define TEMPSENSE 1 -#define VBATSENSE 2 - -#define NOISE_IF_UPD_CHK_INTERVAL 1 -#define NOISE_IF_UPD_RST_INTERVAL 60 -#define NOISE_IF_UPD_THRESHOLD_CNT 1 -#define NOISE_IF_UPD_TRHRESHOLD 50 -#define NOISE_IF_UPD_TIMEOUT 1000 -#define NOISE_IF_OFF 0 -#define NOISE_IF_CHK 1 -#define NOISE_IF_ON 2 - -#define PAPD_BLANKING_PROFILE 3 -#define PAPD2LUT 0 -#define PAPD_CORR_NORM 0 -#define PAPD_BLANKING_THRESHOLD 0 -#define PAPD_STOP_AFTER_LAST_UPDATE 0 - -#define LCN_TARGET_PWR 60 - -#define LCN_VBAT_OFFSET_433X 34649679 -#define LCN_VBAT_SLOPE_433X 8258032 - -#define LCN_VBAT_SCALE_NOM 53 -#define LCN_VBAT_SCALE_DEN 432 - -#define LCN_TEMPSENSE_OFFSET 80812 -#define LCN_TEMPSENSE_DEN 2647 - -#define LCN_BW_LMT 200 -#define LCN_CUR_LMT 1250 -#define LCN_MULT 1 -#define LCN_VCO_DIV 30 -#define LCN_OFFSET 680 -#define LCN_FACT 490 -#define LCN_CUR_DIV 2640 - -#define LCNPHY_txgainctrlovrval1_pagain_ovr_val1_SHIFT \ - (0 + 8) -#define LCNPHY_txgainctrlovrval1_pagain_ovr_val1_MASK \ - (0x7f << LCNPHY_txgainctrlovrval1_pagain_ovr_val1_SHIFT) - -#define LCNPHY_stxtxgainctrlovrval1_pagain_ovr_val1_SHIFT \ - (0 + 8) -#define LCNPHY_stxtxgainctrlovrval1_pagain_ovr_val1_MASK \ - (0x7f << LCNPHY_stxtxgainctrlovrval1_pagain_ovr_val1_SHIFT) - -#define wlc_lcnphy_enable_tx_gain_override(pi) \ - wlc_lcnphy_set_tx_gain_override(pi, true) -#define wlc_lcnphy_disable_tx_gain_override(pi) \ - wlc_lcnphy_set_tx_gain_override(pi, false) - -#define wlc_lcnphy_iqcal_active(pi) \ - (read_phy_reg((pi), 0x451) & \ - ((0x1 << 15) | (0x1 << 14))) - -#define txpwrctrl_off(pi) (0x7 != ((read_phy_reg(pi, 0x4a4) & 0xE000) >> 13)) -#define wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi) \ - (pi->temppwrctrl_capable) -#define wlc_lcnphy_tssi_based_pwr_ctrl_enabled(pi) \ - (pi->hwpwrctrl_capable) - -#define SWCTRL_BT_TX 0x18 -#define SWCTRL_OVR_DISABLE 0x40 - -#define AFE_CLK_INIT_MODE_TXRX2X 1 -#define AFE_CLK_INIT_MODE_PAPD 0 - -#define LCNPHY_TBL_ID_IQLOCAL 0x00 - -#define LCNPHY_TBL_ID_RFSEQ 0x08 -#define LCNPHY_TBL_ID_GAIN_IDX 0x0d -#define LCNPHY_TBL_ID_SW_CTRL 0x0f -#define LCNPHY_TBL_ID_GAIN_TBL 0x12 -#define LCNPHY_TBL_ID_SPUR 0x14 -#define LCNPHY_TBL_ID_SAMPLEPLAY 0x15 -#define LCNPHY_TBL_ID_SAMPLEPLAY1 0x16 - -#define LCNPHY_TX_PWR_CTRL_RATE_OFFSET 832 -#define LCNPHY_TX_PWR_CTRL_MAC_OFFSET 128 -#define LCNPHY_TX_PWR_CTRL_GAIN_OFFSET 192 -#define LCNPHY_TX_PWR_CTRL_IQ_OFFSET 320 -#define LCNPHY_TX_PWR_CTRL_LO_OFFSET 448 -#define LCNPHY_TX_PWR_CTRL_PWR_OFFSET 576 - -#define LCNPHY_TX_PWR_CTRL_START_INDEX_2G_4313 140 - -#define LCNPHY_TX_PWR_CTRL_START_NPT 1 -#define LCNPHY_TX_PWR_CTRL_MAX_NPT 7 - -#define LCNPHY_NOISE_SAMPLES_DEFAULT 5000 - -#define LCNPHY_ACI_DETECT_START 1 -#define LCNPHY_ACI_DETECT_PROGRESS 2 -#define LCNPHY_ACI_DETECT_STOP 3 - -#define LCNPHY_ACI_CRSHIFRMLO_TRSH 100 -#define LCNPHY_ACI_GLITCH_TRSH 2000 -#define LCNPHY_ACI_TMOUT 250 -#define LCNPHY_ACI_DETECT_TIMEOUT 2 -#define LCNPHY_ACI_START_DELAY 0 - -#define wlc_lcnphy_tx_gain_override_enabled(pi) \ - (0 != (read_phy_reg((pi), 0x43b) & (0x1 << 6))) - -#define wlc_lcnphy_total_tx_frames(pi) \ - wlapi_bmac_read_shm((pi)->sh->physhim, M_UCODE_MACSTAT + \ - offsetof(struct macstat, txallfrm)) - -struct lcnphy_txgains { - u16 gm_gain; - u16 pga_gain; - u16 pad_gain; - u16 dac_gain; -}; - -enum lcnphy_cal_mode { - LCNPHY_CAL_FULL, - LCNPHY_CAL_RECAL, - LCNPHY_CAL_CURRECAL, - LCNPHY_CAL_DIGCAL, - LCNPHY_CAL_GCTRL -}; - -struct lcnphy_rx_iqcomp { - u8 chan; - s16 a; - s16 b; -}; - -struct lcnphy_spb_tone { - s16 re; - s16 im; -}; - -struct lcnphy_unsign16_struct { - u16 re; - u16 im; -}; - -struct lcnphy_iq_est { - u32 iq_prod; - u32 i_pwr; - u32 q_pwr; -}; - -struct lcnphy_sfo_cfg { - u16 ptcentreTs20; - u16 ptcentreFactor; -}; - -enum lcnphy_papd_cal_type { - LCNPHY_PAPD_CAL_CW, - LCNPHY_PAPD_CAL_OFDM -}; - -typedef u16 iqcal_gain_params_lcnphy[9]; - -static const iqcal_gain_params_lcnphy tbl_iqcal_gainparams_lcnphy_2G[] = { - {0, 0, 0, 0, 0, 0, 0, 0, 0}, -}; - -static const iqcal_gain_params_lcnphy *tbl_iqcal_gainparams_lcnphy[1] = { - tbl_iqcal_gainparams_lcnphy_2G, -}; - -static const u16 iqcal_gainparams_numgains_lcnphy[1] = { - ARRAY_SIZE(tbl_iqcal_gainparams_lcnphy_2G), -}; - -static const struct lcnphy_sfo_cfg lcnphy_sfo_cfg[] = { - {965, 1087}, - {967, 1085}, - {969, 1082}, - {971, 1080}, - {973, 1078}, - {975, 1076}, - {977, 1073}, - {979, 1071}, - {981, 1069}, - {983, 1067}, - {985, 1065}, - {987, 1063}, - {989, 1060}, - {994, 1055} -}; - -static const -u16 lcnphy_iqcal_loft_gainladder[] = { - ((2 << 8) | 0), - ((3 << 8) | 0), - ((4 << 8) | 0), - ((6 << 8) | 0), - ((8 << 8) | 0), - ((11 << 8) | 0), - ((16 << 8) | 0), - ((16 << 8) | 1), - ((16 << 8) | 2), - ((16 << 8) | 3), - ((16 << 8) | 4), - ((16 << 8) | 5), - ((16 << 8) | 6), - ((16 << 8) | 7), - ((23 << 8) | 7), - ((32 << 8) | 7), - ((45 << 8) | 7), - ((64 << 8) | 7), - ((91 << 8) | 7), - ((128 << 8) | 7) -}; - -static const -u16 lcnphy_iqcal_ir_gainladder[] = { - ((1 << 8) | 0), - ((2 << 8) | 0), - ((4 << 8) | 0), - ((6 << 8) | 0), - ((8 << 8) | 0), - ((11 << 8) | 0), - ((16 << 8) | 0), - ((23 << 8) | 0), - ((32 << 8) | 0), - ((45 << 8) | 0), - ((64 << 8) | 0), - ((64 << 8) | 1), - ((64 << 8) | 2), - ((64 << 8) | 3), - ((64 << 8) | 4), - ((64 << 8) | 5), - ((64 << 8) | 6), - ((64 << 8) | 7), - ((91 << 8) | 7), - ((128 << 8) | 7) -}; - -static const -struct lcnphy_spb_tone lcnphy_spb_tone_3750[] = { - {88, 0}, - {73, 49}, - {34, 81}, - {-17, 86}, - {-62, 62}, - {-86, 17}, - {-81, -34}, - {-49, -73}, - {0, -88}, - {49, -73}, - {81, -34}, - {86, 17}, - {62, 62}, - {17, 86}, - {-34, 81}, - {-73, 49}, - {-88, 0}, - {-73, -49}, - {-34, -81}, - {17, -86}, - {62, -62}, - {86, -17}, - {81, 34}, - {49, 73}, - {0, 88}, - {-49, 73}, - {-81, 34}, - {-86, -17}, - {-62, -62}, - {-17, -86}, - {34, -81}, - {73, -49}, -}; - -static const -u16 iqlo_loopback_rf_regs[20] = { - RADIO_2064_REG036, - RADIO_2064_REG11A, - RADIO_2064_REG03A, - RADIO_2064_REG025, - RADIO_2064_REG028, - RADIO_2064_REG005, - RADIO_2064_REG112, - RADIO_2064_REG0FF, - RADIO_2064_REG11F, - RADIO_2064_REG00B, - RADIO_2064_REG113, - RADIO_2064_REG007, - RADIO_2064_REG0FC, - RADIO_2064_REG0FD, - RADIO_2064_REG012, - RADIO_2064_REG057, - RADIO_2064_REG059, - RADIO_2064_REG05C, - RADIO_2064_REG078, - RADIO_2064_REG092, -}; - -static const -u16 tempsense_phy_regs[14] = { - 0x503, - 0x4a4, - 0x4d0, - 0x4d9, - 0x4da, - 0x4a6, - 0x938, - 0x939, - 0x4d8, - 0x4d0, - 0x4d7, - 0x4a5, - 0x40d, - 0x4a2, -}; - -static const -u16 rxiq_cal_rf_reg[11] = { - RADIO_2064_REG098, - RADIO_2064_REG116, - RADIO_2064_REG12C, - RADIO_2064_REG06A, - RADIO_2064_REG00B, - RADIO_2064_REG01B, - RADIO_2064_REG113, - RADIO_2064_REG01D, - RADIO_2064_REG114, - RADIO_2064_REG02E, - RADIO_2064_REG12A, -}; - -static const -struct lcnphy_rx_iqcomp lcnphy_rx_iqcomp_table_rev0[] = { - {1, 0, 0}, - {2, 0, 0}, - {3, 0, 0}, - {4, 0, 0}, - {5, 0, 0}, - {6, 0, 0}, - {7, 0, 0}, - {8, 0, 0}, - {9, 0, 0}, - {10, 0, 0}, - {11, 0, 0}, - {12, 0, 0}, - {13, 0, 0}, - {14, 0, 0}, - {34, 0, 0}, - {38, 0, 0}, - {42, 0, 0}, - {46, 0, 0}, - {36, 0, 0}, - {40, 0, 0}, - {44, 0, 0}, - {48, 0, 0}, - {52, 0, 0}, - {56, 0, 0}, - {60, 0, 0}, - {64, 0, 0}, - {100, 0, 0}, - {104, 0, 0}, - {108, 0, 0}, - {112, 0, 0}, - {116, 0, 0}, - {120, 0, 0}, - {124, 0, 0}, - {128, 0, 0}, - {132, 0, 0}, - {136, 0, 0}, - {140, 0, 0}, - {149, 0, 0}, - {153, 0, 0}, - {157, 0, 0}, - {161, 0, 0}, - {165, 0, 0}, - {184, 0, 0}, - {188, 0, 0}, - {192, 0, 0}, - {196, 0, 0}, - {200, 0, 0}, - {204, 0, 0}, - {208, 0, 0}, - {212, 0, 0}, - {216, 0, 0}, -}; - -static const u32 lcnphy_23bitgaincode_table[] = { - 0x200100, - 0x200200, - 0x200004, - 0x200014, - 0x200024, - 0x200034, - 0x200134, - 0x200234, - 0x200334, - 0x200434, - 0x200037, - 0x200137, - 0x200237, - 0x200337, - 0x200437, - 0x000035, - 0x000135, - 0x000235, - 0x000037, - 0x000137, - 0x000237, - 0x000337, - 0x00013f, - 0x00023f, - 0x00033f, - 0x00034f, - 0x00044f, - 0x00144f, - 0x00244f, - 0x00254f, - 0x00354f, - 0x00454f, - 0x00464f, - 0x01464f, - 0x02464f, - 0x03464f, - 0x04464f, -}; - -static const s8 lcnphy_gain_table[] = { - -16, - -13, - 10, - 7, - 4, - 0, - 3, - 6, - 9, - 12, - 15, - 18, - 21, - 24, - 27, - 30, - 33, - 36, - 39, - 42, - 45, - 48, - 50, - 53, - 56, - 59, - 62, - 65, - 68, - 71, - 74, - 77, - 80, - 83, - 86, - 89, - 92, -}; - -static const s8 lcnphy_gain_index_offset_for_rssi[] = { - 7, - 7, - 7, - 7, - 7, - 7, - 7, - 8, - 7, - 7, - 6, - 7, - 7, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 3, - 3, - 3, - 3, - 3, - 3, - 4, - 2, - 2, - 2, - 2, - 2, - 2, - -1, - -2, - -2, - -2 -}; - -struct chan_info_2064_lcnphy { - uint chan; - uint freq; - u8 logen_buftune; - u8 logen_rccr_tx; - u8 txrf_mix_tune_ctrl; - u8 pa_input_tune_g; - u8 logen_rccr_rx; - u8 pa_rxrf_lna1_freq_tune; - u8 pa_rxrf_lna2_freq_tune; - u8 rxrf_rxrf_spare1; -}; - -static const struct chan_info_2064_lcnphy chan_info_2064_lcnphy[] = { - {1, 2412, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, - {2, 2417, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, - {3, 2422, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, - {4, 2427, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, - {5, 2432, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, - {6, 2437, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, - {7, 2442, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, - {8, 2447, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, - {9, 2452, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, - {10, 2457, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, - {11, 2462, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, - {12, 2467, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, - {13, 2472, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, - {14, 2484, 0x0B, 0x0A, 0x00, 0x07, 0x0A, 0x88, 0x88, 0x80}, -}; - -static const struct lcnphy_radio_regs lcnphy_radio_regs_2064[] = { - {0x00, 0, 0, 0, 0}, - {0x01, 0x64, 0x64, 0, 0}, - {0x02, 0x20, 0x20, 0, 0}, - {0x03, 0x66, 0x66, 0, 0}, - {0x04, 0xf8, 0xf8, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0x10, 0x10, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0x37, 0x37, 0, 0}, - {0x0B, 0x6, 0x6, 0, 0}, - {0x0C, 0x55, 0x55, 0, 0}, - {0x0D, 0x8b, 0x8b, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0x5, 0x5, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0xe, 0xe, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0xb, 0xb, 0, 0}, - {0x14, 0x2, 0x2, 0, 0}, - {0x15, 0x12, 0x12, 0, 0}, - {0x16, 0x12, 0x12, 0, 0}, - {0x17, 0xc, 0xc, 0, 0}, - {0x18, 0xc, 0xc, 0, 0}, - {0x19, 0xc, 0xc, 0, 0}, - {0x1A, 0x8, 0x8, 0, 0}, - {0x1B, 0x2, 0x2, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0x1, 0x1, 0, 0}, - {0x1E, 0x12, 0x12, 0, 0}, - {0x1F, 0x6e, 0x6e, 0, 0}, - {0x20, 0x2, 0x2, 0, 0}, - {0x21, 0x23, 0x23, 0, 0}, - {0x22, 0x8, 0x8, 0, 0}, - {0x23, 0, 0, 0, 0}, - {0x24, 0, 0, 0, 0}, - {0x25, 0xc, 0xc, 0, 0}, - {0x26, 0x33, 0x33, 0, 0}, - {0x27, 0x55, 0x55, 0, 0}, - {0x28, 0, 0, 0, 0}, - {0x29, 0x30, 0x30, 0, 0}, - {0x2A, 0xb, 0xb, 0, 0}, - {0x2B, 0x1b, 0x1b, 0, 0}, - {0x2C, 0x3, 0x3, 0, 0}, - {0x2D, 0x1b, 0x1b, 0, 0}, - {0x2E, 0, 0, 0, 0}, - {0x2F, 0x20, 0x20, 0, 0}, - {0x30, 0xa, 0xa, 0, 0}, - {0x31, 0, 0, 0, 0}, - {0x32, 0x62, 0x62, 0, 0}, - {0x33, 0x19, 0x19, 0, 0}, - {0x34, 0x33, 0x33, 0, 0}, - {0x35, 0x77, 0x77, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0x70, 0x70, 0, 0}, - {0x38, 0x3, 0x3, 0, 0}, - {0x39, 0xf, 0xf, 0, 0}, - {0x3A, 0x6, 0x6, 0, 0}, - {0x3B, 0xcf, 0xcf, 0, 0}, - {0x3C, 0x1a, 0x1a, 0, 0}, - {0x3D, 0x6, 0x6, 0, 0}, - {0x3E, 0x42, 0x42, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0xfb, 0xfb, 0, 0}, - {0x41, 0x9a, 0x9a, 0, 0}, - {0x42, 0x7a, 0x7a, 0, 0}, - {0x43, 0x29, 0x29, 0, 0}, - {0x44, 0, 0, 0, 0}, - {0x45, 0x8, 0x8, 0, 0}, - {0x46, 0xce, 0xce, 0, 0}, - {0x47, 0x27, 0x27, 0, 0}, - {0x48, 0x62, 0x62, 0, 0}, - {0x49, 0x6, 0x6, 0, 0}, - {0x4A, 0x58, 0x58, 0, 0}, - {0x4B, 0xf7, 0xf7, 0, 0}, - {0x4C, 0, 0, 0, 0}, - {0x4D, 0xb3, 0xb3, 0, 0}, - {0x4E, 0, 0, 0, 0}, - {0x4F, 0x2, 0x2, 0, 0}, - {0x50, 0, 0, 0, 0}, - {0x51, 0x9, 0x9, 0, 0}, - {0x52, 0x5, 0x5, 0, 0}, - {0x53, 0x17, 0x17, 0, 0}, - {0x54, 0x38, 0x38, 0, 0}, - {0x55, 0, 0, 0, 0}, - {0x56, 0, 0, 0, 0}, - {0x57, 0xb, 0xb, 0, 0}, - {0x58, 0, 0, 0, 0}, - {0x59, 0, 0, 0, 0}, - {0x5A, 0, 0, 0, 0}, - {0x5B, 0, 0, 0, 0}, - {0x5C, 0, 0, 0, 0}, - {0x5D, 0, 0, 0, 0}, - {0x5E, 0x88, 0x88, 0, 0}, - {0x5F, 0xcc, 0xcc, 0, 0}, - {0x60, 0x74, 0x74, 0, 0}, - {0x61, 0x74, 0x74, 0, 0}, - {0x62, 0x74, 0x74, 0, 0}, - {0x63, 0x44, 0x44, 0, 0}, - {0x64, 0x77, 0x77, 0, 0}, - {0x65, 0x44, 0x44, 0, 0}, - {0x66, 0x77, 0x77, 0, 0}, - {0x67, 0x55, 0x55, 0, 0}, - {0x68, 0x77, 0x77, 0, 0}, - {0x69, 0x77, 0x77, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0x7f, 0x7f, 0, 0}, - {0x6C, 0x8, 0x8, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0x88, 0x88, 0, 0}, - {0x6F, 0x66, 0x66, 0, 0}, - {0x70, 0x66, 0x66, 0, 0}, - {0x71, 0x28, 0x28, 0, 0}, - {0x72, 0x55, 0x55, 0, 0}, - {0x73, 0x4, 0x4, 0, 0}, - {0x74, 0, 0, 0, 0}, - {0x75, 0, 0, 0, 0}, - {0x76, 0, 0, 0, 0}, - {0x77, 0x1, 0x1, 0, 0}, - {0x78, 0xd6, 0xd6, 0, 0}, - {0x79, 0, 0, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0xb4, 0xb4, 0, 0}, - {0x84, 0x1, 0x1, 0, 0}, - {0x85, 0x20, 0x20, 0, 0}, - {0x86, 0x5, 0x5, 0, 0}, - {0x87, 0xff, 0xff, 0, 0}, - {0x88, 0x7, 0x7, 0, 0}, - {0x89, 0x77, 0x77, 0, 0}, - {0x8A, 0x77, 0x77, 0, 0}, - {0x8B, 0x77, 0x77, 0, 0}, - {0x8C, 0x77, 0x77, 0, 0}, - {0x8D, 0x8, 0x8, 0, 0}, - {0x8E, 0xa, 0xa, 0, 0}, - {0x8F, 0x8, 0x8, 0, 0}, - {0x90, 0x18, 0x18, 0, 0}, - {0x91, 0x5, 0x5, 0, 0}, - {0x92, 0x1f, 0x1f, 0, 0}, - {0x93, 0x10, 0x10, 0, 0}, - {0x94, 0x3, 0x3, 0, 0}, - {0x95, 0, 0, 0, 0}, - {0x96, 0, 0, 0, 0}, - {0x97, 0xaa, 0xaa, 0, 0}, - {0x98, 0, 0, 0, 0}, - {0x99, 0x23, 0x23, 0, 0}, - {0x9A, 0x7, 0x7, 0, 0}, - {0x9B, 0xf, 0xf, 0, 0}, - {0x9C, 0x10, 0x10, 0, 0}, - {0x9D, 0x3, 0x3, 0, 0}, - {0x9E, 0x4, 0x4, 0, 0}, - {0x9F, 0x20, 0x20, 0, 0}, - {0xA0, 0, 0, 0, 0}, - {0xA1, 0, 0, 0, 0}, - {0xA2, 0, 0, 0, 0}, - {0xA3, 0, 0, 0, 0}, - {0xA4, 0x1, 0x1, 0, 0}, - {0xA5, 0x77, 0x77, 0, 0}, - {0xA6, 0x77, 0x77, 0, 0}, - {0xA7, 0x77, 0x77, 0, 0}, - {0xA8, 0x77, 0x77, 0, 0}, - {0xA9, 0x8c, 0x8c, 0, 0}, - {0xAA, 0x88, 0x88, 0, 0}, - {0xAB, 0x78, 0x78, 0, 0}, - {0xAC, 0x57, 0x57, 0, 0}, - {0xAD, 0x88, 0x88, 0, 0}, - {0xAE, 0, 0, 0, 0}, - {0xAF, 0x8, 0x8, 0, 0}, - {0xB0, 0x88, 0x88, 0, 0}, - {0xB1, 0, 0, 0, 0}, - {0xB2, 0x1b, 0x1b, 0, 0}, - {0xB3, 0x3, 0x3, 0, 0}, - {0xB4, 0x24, 0x24, 0, 0}, - {0xB5, 0x3, 0x3, 0, 0}, - {0xB6, 0x1b, 0x1b, 0, 0}, - {0xB7, 0x24, 0x24, 0, 0}, - {0xB8, 0x3, 0x3, 0, 0}, - {0xB9, 0, 0, 0, 0}, - {0xBA, 0xaa, 0xaa, 0, 0}, - {0xBB, 0, 0, 0, 0}, - {0xBC, 0x4, 0x4, 0, 0}, - {0xBD, 0, 0, 0, 0}, - {0xBE, 0x8, 0x8, 0, 0}, - {0xBF, 0x11, 0x11, 0, 0}, - {0xC0, 0, 0, 0, 0}, - {0xC1, 0, 0, 0, 0}, - {0xC2, 0x62, 0x62, 0, 0}, - {0xC3, 0x1e, 0x1e, 0, 0}, - {0xC4, 0x33, 0x33, 0, 0}, - {0xC5, 0x37, 0x37, 0, 0}, - {0xC6, 0, 0, 0, 0}, - {0xC7, 0x70, 0x70, 0, 0}, - {0xC8, 0x1e, 0x1e, 0, 0}, - {0xC9, 0x6, 0x6, 0, 0}, - {0xCA, 0x4, 0x4, 0, 0}, - {0xCB, 0x2f, 0x2f, 0, 0}, - {0xCC, 0xf, 0xf, 0, 0}, - {0xCD, 0, 0, 0, 0}, - {0xCE, 0xff, 0xff, 0, 0}, - {0xCF, 0x8, 0x8, 0, 0}, - {0xD0, 0x3f, 0x3f, 0, 0}, - {0xD1, 0x3f, 0x3f, 0, 0}, - {0xD2, 0x3f, 0x3f, 0, 0}, - {0xD3, 0, 0, 0, 0}, - {0xD4, 0, 0, 0, 0}, - {0xD5, 0, 0, 0, 0}, - {0xD6, 0xcc, 0xcc, 0, 0}, - {0xD7, 0, 0, 0, 0}, - {0xD8, 0x8, 0x8, 0, 0}, - {0xD9, 0x8, 0x8, 0, 0}, - {0xDA, 0x8, 0x8, 0, 0}, - {0xDB, 0x11, 0x11, 0, 0}, - {0xDC, 0, 0, 0, 0}, - {0xDD, 0x87, 0x87, 0, 0}, - {0xDE, 0x88, 0x88, 0, 0}, - {0xDF, 0x8, 0x8, 0, 0}, - {0xE0, 0x8, 0x8, 0, 0}, - {0xE1, 0x8, 0x8, 0, 0}, - {0xE2, 0, 0, 0, 0}, - {0xE3, 0, 0, 0, 0}, - {0xE4, 0, 0, 0, 0}, - {0xE5, 0xf5, 0xf5, 0, 0}, - {0xE6, 0x30, 0x30, 0, 0}, - {0xE7, 0x1, 0x1, 0, 0}, - {0xE8, 0, 0, 0, 0}, - {0xE9, 0xff, 0xff, 0, 0}, - {0xEA, 0, 0, 0, 0}, - {0xEB, 0, 0, 0, 0}, - {0xEC, 0x22, 0x22, 0, 0}, - {0xED, 0, 0, 0, 0}, - {0xEE, 0, 0, 0, 0}, - {0xEF, 0, 0, 0, 0}, - {0xF0, 0x3, 0x3, 0, 0}, - {0xF1, 0x1, 0x1, 0, 0}, - {0xF2, 0, 0, 0, 0}, - {0xF3, 0, 0, 0, 0}, - {0xF4, 0, 0, 0, 0}, - {0xF5, 0, 0, 0, 0}, - {0xF6, 0, 0, 0, 0}, - {0xF7, 0x6, 0x6, 0, 0}, - {0xF8, 0, 0, 0, 0}, - {0xF9, 0, 0, 0, 0}, - {0xFA, 0x40, 0x40, 0, 0}, - {0xFB, 0, 0, 0, 0}, - {0xFC, 0x1, 0x1, 0, 0}, - {0xFD, 0x80, 0x80, 0, 0}, - {0xFE, 0x2, 0x2, 0, 0}, - {0xFF, 0x10, 0x10, 0, 0}, - {0x100, 0x2, 0x2, 0, 0}, - {0x101, 0x1e, 0x1e, 0, 0}, - {0x102, 0x1e, 0x1e, 0, 0}, - {0x103, 0, 0, 0, 0}, - {0x104, 0x1f, 0x1f, 0, 0}, - {0x105, 0, 0x8, 0, 1}, - {0x106, 0x2a, 0x2a, 0, 0}, - {0x107, 0xf, 0xf, 0, 0}, - {0x108, 0, 0, 0, 0}, - {0x109, 0, 0, 0, 0}, - {0x10A, 0, 0, 0, 0}, - {0x10B, 0, 0, 0, 0}, - {0x10C, 0, 0, 0, 0}, - {0x10D, 0, 0, 0, 0}, - {0x10E, 0, 0, 0, 0}, - {0x10F, 0, 0, 0, 0}, - {0x110, 0, 0, 0, 0}, - {0x111, 0, 0, 0, 0}, - {0x112, 0, 0, 0, 0}, - {0x113, 0, 0, 0, 0}, - {0x114, 0, 0, 0, 0}, - {0x115, 0, 0, 0, 0}, - {0x116, 0, 0, 0, 0}, - {0x117, 0, 0, 0, 0}, - {0x118, 0, 0, 0, 0}, - {0x119, 0, 0, 0, 0}, - {0x11A, 0, 0, 0, 0}, - {0x11B, 0, 0, 0, 0}, - {0x11C, 0x1, 0x1, 0, 0}, - {0x11D, 0, 0, 0, 0}, - {0x11E, 0, 0, 0, 0}, - {0x11F, 0, 0, 0, 0}, - {0x120, 0, 0, 0, 0}, - {0x121, 0, 0, 0, 0}, - {0x122, 0x80, 0x80, 0, 0}, - {0x123, 0, 0, 0, 0}, - {0x124, 0xf8, 0xf8, 0, 0}, - {0x125, 0, 0, 0, 0}, - {0x126, 0, 0, 0, 0}, - {0x127, 0, 0, 0, 0}, - {0x128, 0, 0, 0, 0}, - {0x129, 0, 0, 0, 0}, - {0x12A, 0, 0, 0, 0}, - {0x12B, 0, 0, 0, 0}, - {0x12C, 0, 0, 0, 0}, - {0x12D, 0, 0, 0, 0}, - {0x12E, 0, 0, 0, 0}, - {0x12F, 0, 0, 0, 0}, - {0x130, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0} -}; - -#define LCNPHY_NUM_DIG_FILT_COEFFS 16 -#define LCNPHY_NUM_TX_DIG_FILTERS_CCK 13 - -static const u16 LCNPHY_txdigfiltcoeffs_cck[LCNPHY_NUM_TX_DIG_FILTERS_CCK] - [LCNPHY_NUM_DIG_FILT_COEFFS + 1] = { - {0, 1, 415, 1874, 64, 128, 64, 792, 1656, 64, 128, 64, 778, 1582, 64, - 128, 64,}, - {1, 1, 402, 1847, 259, 59, 259, 671, 1794, 68, 54, 68, 608, 1863, 93, - 167, 93,}, - {2, 1, 415, 1874, 64, 128, 64, 792, 1656, 192, 384, 192, 778, 1582, 64, - 128, 64,}, - {3, 1, 302, 1841, 129, 258, 129, 658, 1720, 205, 410, 205, 754, 1760, - 170, 340, 170,}, - {20, 1, 360, 1884, 242, 1734, 242, 752, 1720, 205, 1845, 205, 767, 1760, - 256, 185, 256,}, - {21, 1, 360, 1884, 149, 1874, 149, 752, 1720, 205, 1883, 205, 767, 1760, - 256, 273, 256,}, - {22, 1, 360, 1884, 98, 1948, 98, 752, 1720, 205, 1924, 205, 767, 1760, - 256, 352, 256,}, - {23, 1, 350, 1884, 116, 1966, 116, 752, 1720, 205, 2008, 205, 767, 1760, - 128, 233, 128,}, - {24, 1, 325, 1884, 32, 40, 32, 756, 1720, 256, 471, 256, 766, 1760, 256, - 1881, 256,}, - {25, 1, 299, 1884, 51, 64, 51, 736, 1720, 256, 471, 256, 765, 1760, 256, - 1881, 256,}, - {26, 1, 277, 1943, 39, 117, 88, 637, 1838, 64, 192, 144, 614, 1864, 128, - 384, 288,}, - {27, 1, 245, 1943, 49, 147, 110, 626, 1838, 256, 768, 576, 613, 1864, - 128, 384, 288,}, - {30, 1, 302, 1841, 61, 122, 61, 658, 1720, 205, 410, 205, 754, 1760, - 170, 340, 170,}, -}; - -#define LCNPHY_NUM_TX_DIG_FILTERS_OFDM 3 -static const u16 LCNPHY_txdigfiltcoeffs_ofdm[LCNPHY_NUM_TX_DIG_FILTERS_OFDM] - [LCNPHY_NUM_DIG_FILT_COEFFS + 1] = { - {0, 0, 0xa2, 0x0, 0x100, 0x100, 0x0, 0x0, 0x0, 0x100, 0x0, 0x0, - 0x278, 0xfea0, 0x80, 0x100, 0x80,}, - {1, 0, 374, 0xFF79, 16, 32, 16, 799, 0xFE74, 50, 32, 50, - 750, 0xFE2B, 212, 0xFFCE, 212,}, - {2, 0, 375, 0xFF16, 37, 76, 37, 799, 0xFE74, 32, 20, 32, 748, - 0xFEF2, 128, 0xFFE2, 128} -}; - -#define wlc_lcnphy_set_start_tx_pwr_idx(pi, idx) \ - mod_phy_reg(pi, 0x4a4, \ - (0x1ff << 0), \ - (u16)(idx) << 0) - -#define wlc_lcnphy_set_tx_pwr_npt(pi, npt) \ - mod_phy_reg(pi, 0x4a5, \ - (0x7 << 8), \ - (u16)(npt) << 8) - -#define wlc_lcnphy_get_tx_pwr_ctrl(pi) \ - (read_phy_reg((pi), 0x4a4) & \ - ((0x1 << 15) | \ - (0x1 << 14) | \ - (0x1 << 13))) - -#define wlc_lcnphy_get_tx_pwr_npt(pi) \ - ((read_phy_reg(pi, 0x4a5) & \ - (0x7 << 8)) >> \ - 8) - -#define wlc_lcnphy_get_current_tx_pwr_idx_if_pwrctrl_on(pi) \ - (read_phy_reg(pi, 0x473) & 0x1ff) - -#define wlc_lcnphy_get_target_tx_pwr(pi) \ - ((read_phy_reg(pi, 0x4a7) & \ - (0xff << 0)) >> \ - 0) - -#define wlc_lcnphy_set_target_tx_pwr(pi, target) \ - mod_phy_reg(pi, 0x4a7, \ - (0xff << 0), \ - (u16)(target) << 0) - -#define wlc_radio_2064_rcal_done(pi) \ - (0 != (read_radio_reg(pi, RADIO_2064_REG05C) & 0x20)) - -#define tempsense_done(pi) \ - (0x8000 == (read_phy_reg(pi, 0x476) & 0x8000)) - -#define LCNPHY_IQLOCC_READ(val) \ - ((u8)(-(s8)(((val) & 0xf0) >> 4) + (s8)((val) & 0x0f))) - -#define FIXED_TXPWR 78 -#define LCNPHY_TEMPSENSE(val) ((s16)((val > 255) ? (val - 512) : val)) - -void wlc_lcnphy_write_table(struct brcms_phy *pi, const struct phytbl_info *pti) -{ - wlc_phy_write_table(pi, pti, 0x455, 0x457, 0x456); -} - -void wlc_lcnphy_read_table(struct brcms_phy *pi, struct phytbl_info *pti) -{ - wlc_phy_read_table(pi, pti, 0x455, 0x457, 0x456); -} - -static void -wlc_lcnphy_common_read_table(struct brcms_phy *pi, u32 tbl_id, - const u16 *tbl_ptr, u32 tbl_len, - u32 tbl_width, u32 tbl_offset) -{ - struct phytbl_info tab; - tab.tbl_id = tbl_id; - tab.tbl_ptr = tbl_ptr; - tab.tbl_len = tbl_len; - tab.tbl_width = tbl_width; - tab.tbl_offset = tbl_offset; - wlc_lcnphy_read_table(pi, &tab); -} - -static void -wlc_lcnphy_common_write_table(struct brcms_phy *pi, u32 tbl_id, - const u16 *tbl_ptr, u32 tbl_len, - u32 tbl_width, u32 tbl_offset) -{ - - struct phytbl_info tab; - tab.tbl_id = tbl_id; - tab.tbl_ptr = tbl_ptr; - tab.tbl_len = tbl_len; - tab.tbl_width = tbl_width; - tab.tbl_offset = tbl_offset; - wlc_lcnphy_write_table(pi, &tab); -} - -static u32 -wlc_lcnphy_qdiv_roundup(u32 dividend, u32 divisor, u8 precision) -{ - u32 quotient, remainder, roundup, rbit; - - quotient = dividend / divisor; - remainder = dividend % divisor; - rbit = divisor & 1; - roundup = (divisor >> 1) + rbit; - - while (precision--) { - quotient <<= 1; - if (remainder >= roundup) { - quotient++; - remainder = ((remainder - roundup) << 1) + rbit; - } else { - remainder <<= 1; - } - } - - if (remainder >= roundup) - quotient++; - - return quotient; -} - -static int wlc_lcnphy_calc_floor(s16 coeff_x, int type) -{ - int k; - k = 0; - if (type == 0) { - if (coeff_x < 0) - k = (coeff_x - 1) / 2; - else - k = coeff_x / 2; - } - - if (type == 1) { - if ((coeff_x + 1) < 0) - k = (coeff_x) / 2; - else - k = (coeff_x + 1) / 2; - } - return k; -} - -static void -wlc_lcnphy_get_tx_gain(struct brcms_phy *pi, struct lcnphy_txgains *gains) -{ - u16 dac_gain, rfgain0, rfgain1; - - dac_gain = read_phy_reg(pi, 0x439) >> 0; - gains->dac_gain = (dac_gain & 0x380) >> 7; - - rfgain0 = (read_phy_reg(pi, 0x4b5) & (0xffff << 0)) >> 0; - rfgain1 = (read_phy_reg(pi, 0x4fb) & (0x7fff << 0)) >> 0; - - gains->gm_gain = rfgain0 & 0xff; - gains->pga_gain = (rfgain0 >> 8) & 0xff; - gains->pad_gain = rfgain1 & 0xff; -} - - -static void wlc_lcnphy_set_dac_gain(struct brcms_phy *pi, u16 dac_gain) -{ - u16 dac_ctrl; - - dac_ctrl = (read_phy_reg(pi, 0x439) >> 0); - dac_ctrl = dac_ctrl & 0xc7f; - dac_ctrl = dac_ctrl | (dac_gain << 7); - mod_phy_reg(pi, 0x439, (0xfff << 0), (dac_ctrl) << 0); - -} - -static void wlc_lcnphy_set_tx_gain_override(struct brcms_phy *pi, bool bEnable) -{ - u16 bit = bEnable ? 1 : 0; - - mod_phy_reg(pi, 0x4b0, (0x1 << 7), bit << 7); - - mod_phy_reg(pi, 0x4b0, (0x1 << 14), bit << 14); - - mod_phy_reg(pi, 0x43b, (0x1 << 6), bit << 6); -} - -static void -wlc_lcnphy_rx_gain_override_enable(struct brcms_phy *pi, bool enable) -{ - u16 ebit = enable ? 1 : 0; - - mod_phy_reg(pi, 0x4b0, (0x1 << 8), ebit << 8); - - mod_phy_reg(pi, 0x44c, (0x1 << 0), ebit << 0); - - if (LCNREV_LT(pi->pubpi.phy_rev, 2)) { - mod_phy_reg(pi, 0x44c, (0x1 << 4), ebit << 4); - mod_phy_reg(pi, 0x44c, (0x1 << 6), ebit << 6); - mod_phy_reg(pi, 0x4b0, (0x1 << 5), ebit << 5); - mod_phy_reg(pi, 0x4b0, (0x1 << 6), ebit << 6); - } else { - mod_phy_reg(pi, 0x4b0, (0x1 << 12), ebit << 12); - mod_phy_reg(pi, 0x4b0, (0x1 << 13), ebit << 13); - mod_phy_reg(pi, 0x4b0, (0x1 << 5), ebit << 5); - } - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - mod_phy_reg(pi, 0x4b0, (0x1 << 10), ebit << 10); - mod_phy_reg(pi, 0x4e5, (0x1 << 3), ebit << 3); - } -} - -static void -wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi, - u16 trsw, - u16 ext_lna, - u16 biq2, - u16 biq1, - u16 tia, u16 lna2, u16 lna1) -{ - u16 gain0_15, gain16_19; - - gain16_19 = biq2 & 0xf; - gain0_15 = ((biq1 & 0xf) << 12) | - ((tia & 0xf) << 8) | - ((lna2 & 0x3) << 6) | - ((lna2 & - 0x3) << 4) | ((lna1 & 0x3) << 2) | ((lna1 & 0x3) << 0); - - mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0); - mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0); - mod_phy_reg(pi, 0x4b1, (0x3 << 11), lna1 << 11); - - if (LCNREV_LT(pi->pubpi.phy_rev, 2)) { - mod_phy_reg(pi, 0x4b1, (0x1 << 9), ext_lna << 9); - mod_phy_reg(pi, 0x4b1, (0x1 << 10), ext_lna << 10); - } else { - mod_phy_reg(pi, 0x4b1, (0x1 << 10), 0 << 10); - - mod_phy_reg(pi, 0x4b1, (0x1 << 15), 0 << 15); - - mod_phy_reg(pi, 0x4b1, (0x1 << 9), ext_lna << 9); - } - - mod_phy_reg(pi, 0x44d, (0x1 << 0), (!trsw) << 0); - -} - -static void wlc_lcnphy_set_trsw_override(struct brcms_phy *pi, bool tx, bool rx) -{ - - mod_phy_reg(pi, 0x44d, - (0x1 << 1) | - (0x1 << 0), (tx ? (0x1 << 1) : 0) | (rx ? (0x1 << 0) : 0)); - - or_phy_reg(pi, 0x44c, (0x1 << 1) | (0x1 << 0)); -} - -static void wlc_lcnphy_clear_trsw_override(struct brcms_phy *pi) -{ - - and_phy_reg(pi, 0x44c, (u16) ~((0x1 << 1) | (0x1 << 0))); -} - -static void wlc_lcnphy_set_rx_iq_comp(struct brcms_phy *pi, u16 a, u16 b) -{ - mod_phy_reg(pi, 0x645, (0x3ff << 0), (a) << 0); - - mod_phy_reg(pi, 0x646, (0x3ff << 0), (b) << 0); - - mod_phy_reg(pi, 0x647, (0x3ff << 0), (a) << 0); - - mod_phy_reg(pi, 0x648, (0x3ff << 0), (b) << 0); - - mod_phy_reg(pi, 0x649, (0x3ff << 0), (a) << 0); - - mod_phy_reg(pi, 0x64a, (0x3ff << 0), (b) << 0); - -} - -static bool -wlc_lcnphy_rx_iq_est(struct brcms_phy *pi, - u16 num_samps, - u8 wait_time, struct lcnphy_iq_est *iq_est) -{ - int wait_count = 0; - bool result = true; - u8 phybw40; - phybw40 = CHSPEC_IS40(pi->radio_chanspec); - - mod_phy_reg(pi, 0x6da, (0x1 << 5), (1) << 5); - - mod_phy_reg(pi, 0x410, (0x1 << 3), (0) << 3); - - mod_phy_reg(pi, 0x482, (0xffff << 0), (num_samps) << 0); - - mod_phy_reg(pi, 0x481, (0xff << 0), ((u16) wait_time) << 0); - - mod_phy_reg(pi, 0x481, (0x1 << 8), (0) << 8); - - mod_phy_reg(pi, 0x481, (0x1 << 9), (1) << 9); - - while (read_phy_reg(pi, 0x481) & (0x1 << 9)) { - - if (wait_count > (10 * 500)) { - result = false; - goto cleanup; - } - udelay(100); - wait_count++; - } - - iq_est->iq_prod = ((u32) read_phy_reg(pi, 0x483) << 16) | - (u32) read_phy_reg(pi, 0x484); - iq_est->i_pwr = ((u32) read_phy_reg(pi, 0x485) << 16) | - (u32) read_phy_reg(pi, 0x486); - iq_est->q_pwr = ((u32) read_phy_reg(pi, 0x487) << 16) | - (u32) read_phy_reg(pi, 0x488); - -cleanup: - mod_phy_reg(pi, 0x410, (0x1 << 3), (1) << 3); - - mod_phy_reg(pi, 0x6da, (0x1 << 5), (0) << 5); - - return result; -} - -static bool wlc_lcnphy_calc_rx_iq_comp(struct brcms_phy *pi, u16 num_samps) -{ -#define LCNPHY_MIN_RXIQ_PWR 2 - bool result; - u16 a0_new, b0_new; - struct lcnphy_iq_est iq_est = { 0, 0, 0 }; - s32 a, b, temp; - s16 iq_nbits, qq_nbits, arsh, brsh; - s32 iq; - u32 ii, qq; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - a0_new = ((read_phy_reg(pi, 0x645) & (0x3ff << 0)) >> 0); - b0_new = ((read_phy_reg(pi, 0x646) & (0x3ff << 0)) >> 0); - mod_phy_reg(pi, 0x6d1, (0x1 << 2), (0) << 2); - - mod_phy_reg(pi, 0x64b, (0x1 << 6), (1) << 6); - - wlc_lcnphy_set_rx_iq_comp(pi, 0, 0); - - result = wlc_lcnphy_rx_iq_est(pi, num_samps, 32, &iq_est); - if (!result) - goto cleanup; - - iq = (s32) iq_est.iq_prod; - ii = iq_est.i_pwr; - qq = iq_est.q_pwr; - - if ((ii + qq) < LCNPHY_MIN_RXIQ_PWR) { - result = false; - goto cleanup; - } - - iq_nbits = wlc_phy_nbits(iq); - qq_nbits = wlc_phy_nbits(qq); - - arsh = 10 - (30 - iq_nbits); - if (arsh >= 0) { - a = (-(iq << (30 - iq_nbits)) + (ii >> (1 + arsh))); - temp = (s32) (ii >> arsh); - if (temp == 0) - return false; - } else { - a = (-(iq << (30 - iq_nbits)) + (ii << (-1 - arsh))); - temp = (s32) (ii << -arsh); - if (temp == 0) - return false; - } - a /= temp; - brsh = qq_nbits - 31 + 20; - if (brsh >= 0) { - b = (qq << (31 - qq_nbits)); - temp = (s32) (ii >> brsh); - if (temp == 0) - return false; - } else { - b = (qq << (31 - qq_nbits)); - temp = (s32) (ii << -brsh); - if (temp == 0) - return false; - } - b /= temp; - b -= a * a; - b = (s32) int_sqrt((unsigned long) b); - b -= (1 << 10); - a0_new = (u16) (a & 0x3ff); - b0_new = (u16) (b & 0x3ff); -cleanup: - - wlc_lcnphy_set_rx_iq_comp(pi, a0_new, b0_new); - - mod_phy_reg(pi, 0x64b, (0x1 << 0), (1) << 0); - - mod_phy_reg(pi, 0x64b, (0x1 << 3), (1) << 3); - - pi_lcn->lcnphy_cal_results.rxiqcal_coeff_a0 = a0_new; - pi_lcn->lcnphy_cal_results.rxiqcal_coeff_b0 = b0_new; - - return result; -} - -static u32 wlc_lcnphy_measure_digital_power(struct brcms_phy *pi, u16 nsamples) -{ - struct lcnphy_iq_est iq_est = { 0, 0, 0 }; - - if (!wlc_lcnphy_rx_iq_est(pi, nsamples, 32, &iq_est)) - return 0; - return (iq_est.i_pwr + iq_est.q_pwr) / nsamples; -} - -static bool -wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, - const struct lcnphy_rx_iqcomp *iqcomp, - int iqcomp_sz, bool tx_switch, bool rx_switch, int module, - int tx_gain_idx) -{ - struct lcnphy_txgains old_gains; - u16 tx_pwr_ctrl; - u8 tx_gain_index_old = 0; - bool result = false, tx_gain_override_old = false; - u16 i, Core1TxControl_old, RFOverride0_old, - RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old, - rfoverride3_old, rfoverride3val_old, rfoverride4_old, - rfoverride4val_old, afectrlovr_old, afectrlovrval_old; - int tia_gain; - u32 received_power, rx_pwr_threshold; - u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl; - u16 values_to_save[11]; - s16 *ptr; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - ptr = kmalloc(sizeof(s16) * 131, GFP_ATOMIC); - if (NULL == ptr) - return false; - if (module == 2) { - while (iqcomp_sz--) { - if (iqcomp[iqcomp_sz].chan == - CHSPEC_CHANNEL(pi->radio_chanspec)) { - wlc_lcnphy_set_rx_iq_comp(pi, - (u16) - iqcomp[iqcomp_sz].a, - (u16) - iqcomp[iqcomp_sz].b); - result = true; - break; - } - } - goto cal_done; - } - - if (module == 1) { - - tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); - wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); - - for (i = 0; i < 11; i++) - values_to_save[i] = - read_radio_reg(pi, rxiq_cal_rf_reg[i]); - Core1TxControl_old = read_phy_reg(pi, 0x631); - - or_phy_reg(pi, 0x631, 0x0015); - - RFOverride0_old = read_phy_reg(pi, 0x44c); - RFOverrideVal0_old = read_phy_reg(pi, 0x44d); - rfoverride2_old = read_phy_reg(pi, 0x4b0); - rfoverride2val_old = read_phy_reg(pi, 0x4b1); - rfoverride3_old = read_phy_reg(pi, 0x4f9); - rfoverride3val_old = read_phy_reg(pi, 0x4fa); - rfoverride4_old = read_phy_reg(pi, 0x938); - rfoverride4val_old = read_phy_reg(pi, 0x939); - afectrlovr_old = read_phy_reg(pi, 0x43b); - afectrlovrval_old = read_phy_reg(pi, 0x43c); - old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); - old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db); - - tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); - if (tx_gain_override_old) { - wlc_lcnphy_get_tx_gain(pi, &old_gains); - tx_gain_index_old = pi_lcn->lcnphy_current_index; - } - - wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx); - - mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); - mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); - - mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); - mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); - - write_radio_reg(pi, RADIO_2064_REG116, 0x06); - write_radio_reg(pi, RADIO_2064_REG12C, 0x07); - write_radio_reg(pi, RADIO_2064_REG06A, 0xd3); - write_radio_reg(pi, RADIO_2064_REG098, 0x03); - write_radio_reg(pi, RADIO_2064_REG00B, 0x7); - mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4); - write_radio_reg(pi, RADIO_2064_REG01D, 0x01); - write_radio_reg(pi, RADIO_2064_REG114, 0x01); - write_radio_reg(pi, RADIO_2064_REG02E, 0x10); - write_radio_reg(pi, RADIO_2064_REG12A, 0x08); - - mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0); - mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0); - mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1); - mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1); - mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2); - mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2); - mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3); - mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3); - mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5); - mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5); - - mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); - mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); - - wlc_lcnphy_start_tx_tone(pi, 2000, 120, 0); - write_phy_reg(pi, 0x6da, 0xffff); - or_phy_reg(pi, 0x6db, 0x3); - wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); - wlc_lcnphy_rx_gain_override_enable(pi, true); - - tia_gain = 8; - rx_pwr_threshold = 950; - while (tia_gain > 0) { - tia_gain -= 1; - wlc_lcnphy_set_rx_gain_by_distribution(pi, - 0, 0, 2, 2, - (u16) - tia_gain, 1, 0); - udelay(500); - - received_power = - wlc_lcnphy_measure_digital_power(pi, 2000); - if (received_power < rx_pwr_threshold) - break; - } - result = wlc_lcnphy_calc_rx_iq_comp(pi, 0xffff); - - wlc_lcnphy_stop_tx_tone(pi); - - write_phy_reg(pi, 0x631, Core1TxControl_old); - - write_phy_reg(pi, 0x44c, RFOverrideVal0_old); - write_phy_reg(pi, 0x44d, RFOverrideVal0_old); - write_phy_reg(pi, 0x4b0, rfoverride2_old); - write_phy_reg(pi, 0x4b1, rfoverride2val_old); - write_phy_reg(pi, 0x4f9, rfoverride3_old); - write_phy_reg(pi, 0x4fa, rfoverride3val_old); - write_phy_reg(pi, 0x938, rfoverride4_old); - write_phy_reg(pi, 0x939, rfoverride4val_old); - write_phy_reg(pi, 0x43b, afectrlovr_old); - write_phy_reg(pi, 0x43c, afectrlovrval_old); - write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl); - write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl); - - wlc_lcnphy_clear_trsw_override(pi); - - mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); - - for (i = 0; i < 11; i++) - write_radio_reg(pi, rxiq_cal_rf_reg[i], - values_to_save[i]); - - if (tx_gain_override_old) - wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); - else - wlc_lcnphy_disable_tx_gain_override(pi); - - wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); - wlc_lcnphy_rx_gain_override_enable(pi, false); - } - -cal_done: - kfree(ptr); - return result; -} - -s8 wlc_lcnphy_get_current_tx_pwr_idx(struct brcms_phy *pi) -{ - s8 index; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - if (txpwrctrl_off(pi)) - index = pi_lcn->lcnphy_current_index; - else if (wlc_lcnphy_tssi_based_pwr_ctrl_enabled(pi)) - index = (s8) (wlc_lcnphy_get_current_tx_pwr_idx_if_pwrctrl_on( - pi) / 2); - else - index = pi_lcn->lcnphy_current_index; - return index; -} - -void wlc_lcnphy_crsuprs(struct brcms_phy *pi, int channel) -{ - u16 afectrlovr, afectrlovrval; - afectrlovr = read_phy_reg(pi, 0x43b); - afectrlovrval = read_phy_reg(pi, 0x43c); - if (channel != 0) { - mod_phy_reg(pi, 0x43b, (0x1 << 1), (1) << 1); - - mod_phy_reg(pi, 0x43c, (0x1 << 1), (0) << 1); - - mod_phy_reg(pi, 0x43b, (0x1 << 4), (1) << 4); - - mod_phy_reg(pi, 0x43c, (0x1 << 6), (0) << 6); - - write_phy_reg(pi, 0x44b, 0xffff); - wlc_lcnphy_tx_pu(pi, 1); - - mod_phy_reg(pi, 0x634, (0xff << 8), (0) << 8); - - or_phy_reg(pi, 0x6da, 0x0080); - - or_phy_reg(pi, 0x00a, 0x228); - } else { - and_phy_reg(pi, 0x00a, ~(0x228)); - - and_phy_reg(pi, 0x6da, 0xFF7F); - write_phy_reg(pi, 0x43b, afectrlovr); - write_phy_reg(pi, 0x43c, afectrlovrval); - } -} - -static void wlc_lcnphy_toggle_afe_pwdn(struct brcms_phy *pi) -{ - u16 save_AfeCtrlOvrVal, save_AfeCtrlOvr; - - save_AfeCtrlOvrVal = read_phy_reg(pi, 0x43c); - save_AfeCtrlOvr = read_phy_reg(pi, 0x43b); - - write_phy_reg(pi, 0x43c, save_AfeCtrlOvrVal | 0x1); - write_phy_reg(pi, 0x43b, save_AfeCtrlOvr | 0x1); - - write_phy_reg(pi, 0x43c, save_AfeCtrlOvrVal & 0xfffe); - write_phy_reg(pi, 0x43b, save_AfeCtrlOvr & 0xfffe); - - write_phy_reg(pi, 0x43c, save_AfeCtrlOvrVal); - write_phy_reg(pi, 0x43b, save_AfeCtrlOvr); -} - -static void -wlc_lcnphy_txrx_spur_avoidance_mode(struct brcms_phy *pi, bool enable) -{ - if (enable) { - write_phy_reg(pi, 0x942, 0x7); - write_phy_reg(pi, 0x93b, ((1 << 13) + 23)); - write_phy_reg(pi, 0x93c, ((1 << 13) + 1989)); - - write_phy_reg(pi, 0x44a, 0x084); - write_phy_reg(pi, 0x44a, 0x080); - write_phy_reg(pi, 0x6d3, 0x2222); - write_phy_reg(pi, 0x6d3, 0x2220); - } else { - write_phy_reg(pi, 0x942, 0x0); - write_phy_reg(pi, 0x93b, ((0 << 13) + 23)); - write_phy_reg(pi, 0x93c, ((0 << 13) + 1989)); - } - wlapi_switch_macfreq(pi->sh->physhim, enable); -} - -static void -wlc_lcnphy_set_chanspec_tweaks(struct brcms_phy *pi, u16 chanspec) -{ - u8 channel = CHSPEC_CHANNEL(chanspec); - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - if (channel == 14) - mod_phy_reg(pi, 0x448, (0x3 << 8), (2) << 8); - else - mod_phy_reg(pi, 0x448, (0x3 << 8), (1) << 8); - - pi_lcn->lcnphy_bandedge_corr = 2; - if (channel == 1) - pi_lcn->lcnphy_bandedge_corr = 4; - - if (channel == 1 || channel == 2 || channel == 3 || - channel == 4 || channel == 9 || - channel == 10 || channel == 11 || channel == 12) { - bcma_chipco_pll_write(&pi->d11core->bus->drv_cc, 0x2, - 0x03000c04); - bcma_chipco_pll_maskset(&pi->d11core->bus->drv_cc, 0x3, - ~0x00ffffff, 0x0); - bcma_chipco_pll_write(&pi->d11core->bus->drv_cc, 0x4, - 0x200005c0); - - bcma_cc_set32(&pi->d11core->bus->drv_cc, BCMA_CC_PMU_CTL, - BCMA_CC_PMU_CTL_PLL_UPD); - write_phy_reg(pi, 0x942, 0); - wlc_lcnphy_txrx_spur_avoidance_mode(pi, false); - pi_lcn->lcnphy_spurmod = false; - mod_phy_reg(pi, 0x424, (0xff << 8), (0x1b) << 8); - - write_phy_reg(pi, 0x425, 0x5907); - } else { - bcma_chipco_pll_write(&pi->d11core->bus->drv_cc, 0x2, - 0x03140c04); - bcma_chipco_pll_maskset(&pi->d11core->bus->drv_cc, 0x3, - ~0x00ffffff, 0x333333); - bcma_chipco_pll_write(&pi->d11core->bus->drv_cc, 0x4, - 0x202c2820); - - bcma_cc_set32(&pi->d11core->bus->drv_cc, BCMA_CC_PMU_CTL, - BCMA_CC_PMU_CTL_PLL_UPD); - write_phy_reg(pi, 0x942, 0); - wlc_lcnphy_txrx_spur_avoidance_mode(pi, true); - - pi_lcn->lcnphy_spurmod = false; - mod_phy_reg(pi, 0x424, (0xff << 8), (0x1f) << 8); - - write_phy_reg(pi, 0x425, 0x590a); - } - - or_phy_reg(pi, 0x44a, 0x44); - write_phy_reg(pi, 0x44a, 0x80); -} - -static void -wlc_lcnphy_radio_2064_channel_tune_4313(struct brcms_phy *pi, u8 channel) -{ - uint i; - const struct chan_info_2064_lcnphy *ci; - u8 rfpll_doubler = 0; - u8 pll_pwrup, pll_pwrup_ovr; - s32 qFxtal, qFref, qFvco, qFcal; - u8 d15, d16, f16, e44, e45; - u32 div_int, div_frac, fvco3, fpfd, fref3, fcal_div; - u16 loop_bw, d30, setCount; - - u8 h29, h28_ten, e30, h30_ten, cp_current; - u16 g30, d28; - - ci = &chan_info_2064_lcnphy[0]; - rfpll_doubler = 1; - - mod_radio_reg(pi, RADIO_2064_REG09D, 0x4, 0x1 << 2); - - write_radio_reg(pi, RADIO_2064_REG09E, 0xf); - if (!rfpll_doubler) { - loop_bw = PLL_2064_LOOP_BW; - d30 = PLL_2064_D30; - } else { - loop_bw = PLL_2064_LOOP_BW_DOUBLER; - d30 = PLL_2064_D30_DOUBLER; - } - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - for (i = 0; i < ARRAY_SIZE(chan_info_2064_lcnphy); i++) - if (chan_info_2064_lcnphy[i].chan == channel) - break; - - if (i >= ARRAY_SIZE(chan_info_2064_lcnphy)) - return; - - ci = &chan_info_2064_lcnphy[i]; - } - - write_radio_reg(pi, RADIO_2064_REG02A, ci->logen_buftune); - - mod_radio_reg(pi, RADIO_2064_REG030, 0x3, ci->logen_rccr_tx); - - mod_radio_reg(pi, RADIO_2064_REG091, 0x3, ci->txrf_mix_tune_ctrl); - - mod_radio_reg(pi, RADIO_2064_REG038, 0xf, ci->pa_input_tune_g); - - mod_radio_reg(pi, RADIO_2064_REG030, 0x3 << 2, - (ci->logen_rccr_rx) << 2); - - mod_radio_reg(pi, RADIO_2064_REG05E, 0xf, ci->pa_rxrf_lna1_freq_tune); - - mod_radio_reg(pi, RADIO_2064_REG05E, (0xf) << 4, - (ci->pa_rxrf_lna2_freq_tune) << 4); - - write_radio_reg(pi, RADIO_2064_REG06C, ci->rxrf_rxrf_spare1); - - pll_pwrup = (u8) read_radio_reg(pi, RADIO_2064_REG044); - pll_pwrup_ovr = (u8) read_radio_reg(pi, RADIO_2064_REG12B); - - or_radio_reg(pi, RADIO_2064_REG044, 0x07); - - or_radio_reg(pi, RADIO_2064_REG12B, (0x07) << 1); - e44 = 0; - e45 = 0; - - fpfd = rfpll_doubler ? (pi->xtalfreq << 1) : (pi->xtalfreq); - if (pi->xtalfreq > 26000000) - e44 = 1; - if (pi->xtalfreq > 52000000) - e45 = 1; - if (e44 == 0) - fcal_div = 1; - else if (e45 == 0) - fcal_div = 2; - else - fcal_div = 4; - fvco3 = (ci->freq * 3); - fref3 = 2 * fpfd; - - qFxtal = wlc_lcnphy_qdiv_roundup(pi->xtalfreq, PLL_2064_MHZ, 16); - qFref = wlc_lcnphy_qdiv_roundup(fpfd, PLL_2064_MHZ, 16); - qFcal = pi->xtalfreq * fcal_div / PLL_2064_MHZ; - qFvco = wlc_lcnphy_qdiv_roundup(fvco3, 2, 16); - - write_radio_reg(pi, RADIO_2064_REG04F, 0x02); - - d15 = (pi->xtalfreq * fcal_div * 4 / 5) / PLL_2064_MHZ - 1; - write_radio_reg(pi, RADIO_2064_REG052, (0x07 & (d15 >> 2))); - write_radio_reg(pi, RADIO_2064_REG053, (d15 & 0x3) << 5); - - d16 = (qFcal * 8 / (d15 + 1)) - 1; - write_radio_reg(pi, RADIO_2064_REG051, d16); - - f16 = ((d16 + 1) * (d15 + 1)) / qFcal; - setCount = f16 * 3 * (ci->freq) / 32 - 1; - mod_radio_reg(pi, RADIO_2064_REG053, (0x0f << 0), - (u8) (setCount >> 8)); - - or_radio_reg(pi, RADIO_2064_REG053, 0x10); - write_radio_reg(pi, RADIO_2064_REG054, (u8) (setCount & 0xff)); - - div_int = ((fvco3 * (PLL_2064_MHZ >> 4)) / fref3) << 4; - - div_frac = ((fvco3 * (PLL_2064_MHZ >> 4)) % fref3) << 4; - while (div_frac >= fref3) { - div_int++; - div_frac -= fref3; - } - div_frac = wlc_lcnphy_qdiv_roundup(div_frac, fref3, 20); - - mod_radio_reg(pi, RADIO_2064_REG045, (0x1f << 0), - (u8) (div_int >> 4)); - mod_radio_reg(pi, RADIO_2064_REG046, (0x1f << 4), - (u8) (div_int << 4)); - mod_radio_reg(pi, RADIO_2064_REG046, (0x0f << 0), - (u8) (div_frac >> 16)); - write_radio_reg(pi, RADIO_2064_REG047, (u8) (div_frac >> 8) & 0xff); - write_radio_reg(pi, RADIO_2064_REG048, (u8) div_frac & 0xff); - - write_radio_reg(pi, RADIO_2064_REG040, 0xfb); - - write_radio_reg(pi, RADIO_2064_REG041, 0x9A); - write_radio_reg(pi, RADIO_2064_REG042, 0xA3); - write_radio_reg(pi, RADIO_2064_REG043, 0x0C); - - h29 = LCN_BW_LMT / loop_bw; - d28 = (((PLL_2064_HIGH_END_KVCO - PLL_2064_LOW_END_KVCO) * - (fvco3 / 2 - PLL_2064_LOW_END_VCO)) / - (PLL_2064_HIGH_END_VCO - PLL_2064_LOW_END_VCO)) - + PLL_2064_LOW_END_KVCO; - h28_ten = (d28 * 10) / LCN_VCO_DIV; - e30 = (d30 - LCN_OFFSET) / LCN_FACT; - g30 = LCN_OFFSET + (e30 * LCN_FACT); - h30_ten = (g30 * 10) / LCN_CUR_DIV; - cp_current = ((LCN_CUR_LMT * h29 * LCN_MULT * 100) / h28_ten) / h30_ten; - mod_radio_reg(pi, RADIO_2064_REG03C, 0x3f, cp_current); - - if (channel >= 1 && channel <= 5) - write_radio_reg(pi, RADIO_2064_REG03C, 0x8); - else - write_radio_reg(pi, RADIO_2064_REG03C, 0x7); - write_radio_reg(pi, RADIO_2064_REG03D, 0x3); - - mod_radio_reg(pi, RADIO_2064_REG044, 0x0c, 0x0c); - udelay(1); - - wlc_2064_vco_cal(pi); - - write_radio_reg(pi, RADIO_2064_REG044, pll_pwrup); - write_radio_reg(pi, RADIO_2064_REG12B, pll_pwrup_ovr); - if (LCNREV_IS(pi->pubpi.phy_rev, 1)) { - write_radio_reg(pi, RADIO_2064_REG038, 3); - write_radio_reg(pi, RADIO_2064_REG091, 7); - } -} - -static int -wlc_lcnphy_load_tx_iir_filter(struct brcms_phy *pi, bool is_ofdm, s16 filt_type) -{ - s16 filt_index = -1; - int j; - - u16 addr[] = { - 0x910, - 0x91e, - 0x91f, - 0x924, - 0x925, - 0x926, - 0x920, - 0x921, - 0x927, - 0x928, - 0x929, - 0x922, - 0x923, - 0x930, - 0x931, - 0x932 - }; - - u16 addr_ofdm[] = { - 0x90f, - 0x900, - 0x901, - 0x906, - 0x907, - 0x908, - 0x902, - 0x903, - 0x909, - 0x90a, - 0x90b, - 0x904, - 0x905, - 0x90c, - 0x90d, - 0x90e - }; - - if (!is_ofdm) { - for (j = 0; j < LCNPHY_NUM_TX_DIG_FILTERS_CCK; j++) { - if (filt_type == LCNPHY_txdigfiltcoeffs_cck[j][0]) { - filt_index = (s16) j; - break; - } - } - - if (filt_index != -1) { - for (j = 0; j < LCNPHY_NUM_DIG_FILT_COEFFS; j++) - write_phy_reg(pi, addr[j], - LCNPHY_txdigfiltcoeffs_cck - [filt_index][j + 1]); - } - } else { - for (j = 0; j < LCNPHY_NUM_TX_DIG_FILTERS_OFDM; j++) { - if (filt_type == LCNPHY_txdigfiltcoeffs_ofdm[j][0]) { - filt_index = (s16) j; - break; - } - } - - if (filt_index != -1) { - for (j = 0; j < LCNPHY_NUM_DIG_FILT_COEFFS; j++) - write_phy_reg(pi, addr_ofdm[j], - LCNPHY_txdigfiltcoeffs_ofdm - [filt_index][j + 1]); - } - } - - return (filt_index != -1) ? 0 : -1; -} - -static u16 wlc_lcnphy_get_pa_gain(struct brcms_phy *pi) -{ - u16 pa_gain; - - pa_gain = (read_phy_reg(pi, 0x4fb) & - LCNPHY_txgainctrlovrval1_pagain_ovr_val1_MASK) >> - LCNPHY_txgainctrlovrval1_pagain_ovr_val1_SHIFT; - - return pa_gain; -} - -static void wlc_lcnphy_set_tx_gain(struct brcms_phy *pi, - struct lcnphy_txgains *target_gains) -{ - u16 pa_gain = wlc_lcnphy_get_pa_gain(pi); - - mod_phy_reg( - pi, 0x4b5, - (0xffff << 0), - ((target_gains->gm_gain) | - (target_gains->pga_gain << 8)) << - 0); - mod_phy_reg(pi, 0x4fb, - (0x7fff << 0), - ((target_gains->pad_gain) | (pa_gain << 8)) << 0); - - mod_phy_reg( - pi, 0x4fc, - (0xffff << 0), - ((target_gains->gm_gain) | - (target_gains->pga_gain << 8)) << - 0); - mod_phy_reg(pi, 0x4fd, - (0x7fff << 0), - ((target_gains->pad_gain) | (pa_gain << 8)) << 0); - - wlc_lcnphy_set_dac_gain(pi, target_gains->dac_gain); - - wlc_lcnphy_enable_tx_gain_override(pi); -} - -static u8 wlc_lcnphy_get_bbmult(struct brcms_phy *pi) -{ - u16 m0m1; - struct phytbl_info tab; - - tab.tbl_ptr = &m0m1; - tab.tbl_len = 1; - tab.tbl_id = LCNPHY_TBL_ID_IQLOCAL; - tab.tbl_offset = 87; - tab.tbl_width = 16; - wlc_lcnphy_read_table(pi, &tab); - - return (u8) ((m0m1 & 0xff00) >> 8); -} - -static void wlc_lcnphy_set_bbmult(struct brcms_phy *pi, u8 m0) -{ - u16 m0m1 = (u16) m0 << 8; - struct phytbl_info tab; - - tab.tbl_ptr = &m0m1; - tab.tbl_len = 1; - tab.tbl_id = LCNPHY_TBL_ID_IQLOCAL; - tab.tbl_offset = 87; - tab.tbl_width = 16; - wlc_lcnphy_write_table(pi, &tab); -} - -static void wlc_lcnphy_clear_tx_power_offsets(struct brcms_phy *pi) -{ - u32 data_buf[64]; - struct phytbl_info tab; - - memset(data_buf, 0, sizeof(data_buf)); - - tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; - tab.tbl_width = 32; - tab.tbl_ptr = data_buf; - - if (!wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) { - - tab.tbl_len = 30; - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_RATE_OFFSET; - wlc_lcnphy_write_table(pi, &tab); - } - - tab.tbl_len = 64; - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_MAC_OFFSET; - wlc_lcnphy_write_table(pi, &tab); -} - -enum lcnphy_tssi_mode { - LCNPHY_TSSI_PRE_PA, - LCNPHY_TSSI_POST_PA, - LCNPHY_TSSI_EXT -}; - -static void -wlc_lcnphy_set_tssi_mux(struct brcms_phy *pi, enum lcnphy_tssi_mode pos) -{ - mod_phy_reg(pi, 0x4d7, (0x1 << 0), (0x1) << 0); - - mod_phy_reg(pi, 0x4d7, (0x1 << 6), (1) << 6); - - if (LCNPHY_TSSI_POST_PA == pos) { - mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0) << 2); - - mod_phy_reg(pi, 0x4d9, (0x1 << 3), (1) << 3); - - if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { - mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); - } else { - mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1); - mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); - } - } else { - mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2); - - mod_phy_reg(pi, 0x4d9, (0x1 << 3), (0) << 3); - - if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { - mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); - } else { - mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0); - mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); - } - } - mod_phy_reg(pi, 0x637, (0x3 << 14), (0) << 14); - - if (LCNPHY_TSSI_EXT == pos) { - write_radio_reg(pi, RADIO_2064_REG07F, 1); - mod_radio_reg(pi, RADIO_2064_REG005, 0x7, 0x2); - mod_radio_reg(pi, RADIO_2064_REG112, 0x80, 0x1 << 7); - mod_radio_reg(pi, RADIO_2064_REG028, 0x1f, 0x3); - } -} - -static u16 wlc_lcnphy_rfseq_tbl_adc_pwrup(struct brcms_phy *pi) -{ - u16 N1, N2, N3, N4, N5, N6, N; - N1 = ((read_phy_reg(pi, 0x4a5) & (0xff << 0)) - >> 0); - N2 = 1 << ((read_phy_reg(pi, 0x4a5) & (0x7 << 12)) - >> 12); - N3 = ((read_phy_reg(pi, 0x40d) & (0xff << 0)) - >> 0); - N4 = 1 << ((read_phy_reg(pi, 0x40d) & (0x7 << 8)) - >> 8); - N5 = ((read_phy_reg(pi, 0x4a2) & (0xff << 0)) - >> 0); - N6 = 1 << ((read_phy_reg(pi, 0x4a2) & (0x7 << 8)) - >> 8); - N = 2 * (N1 + N2 + N3 + N4 + 2 * (N5 + N6)) + 80; - if (N < 1600) - N = 1600; - return N; -} - -static void wlc_lcnphy_pwrctrl_rssiparams(struct brcms_phy *pi) -{ - u16 auxpga_vmid, auxpga_vmid_temp, auxpga_gain_temp; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - auxpga_vmid = (2 << 8) | - (pi_lcn->lcnphy_rssi_vc << 4) | pi_lcn->lcnphy_rssi_vf; - auxpga_vmid_temp = (2 << 8) | (8 << 4) | 4; - auxpga_gain_temp = 2; - - mod_phy_reg(pi, 0x4d8, (0x1 << 0), (0) << 0); - - mod_phy_reg(pi, 0x4d8, (0x1 << 1), (0) << 1); - - mod_phy_reg(pi, 0x4d7, (0x1 << 3), (0) << 3); - - mod_phy_reg(pi, 0x4db, - (0x3ff << 0) | - (0x7 << 12), - (auxpga_vmid << 0) | (pi_lcn->lcnphy_rssi_gs << 12)); - - mod_phy_reg(pi, 0x4dc, - (0x3ff << 0) | - (0x7 << 12), - (auxpga_vmid << 0) | (pi_lcn->lcnphy_rssi_gs << 12)); - - mod_phy_reg(pi, 0x40a, - (0x3ff << 0) | - (0x7 << 12), - (auxpga_vmid << 0) | (pi_lcn->lcnphy_rssi_gs << 12)); - - mod_phy_reg(pi, 0x40b, - (0x3ff << 0) | - (0x7 << 12), - (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12)); - - mod_phy_reg(pi, 0x40c, - (0x3ff << 0) | - (0x7 << 12), - (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12)); - - mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5)); -} - -static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) -{ - struct phytbl_info tab; - u32 rfseq, ind; - - tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; - tab.tbl_width = 32; - tab.tbl_ptr = &ind; - tab.tbl_len = 1; - tab.tbl_offset = 0; - for (ind = 0; ind < 128; ind++) { - wlc_lcnphy_write_table(pi, &tab); - tab.tbl_offset++; - } - tab.tbl_offset = 704; - for (ind = 0; ind < 128; ind++) { - wlc_lcnphy_write_table(pi, &tab); - tab.tbl_offset++; - } - mod_phy_reg(pi, 0x503, (0x1 << 0), (0) << 0); - - mod_phy_reg(pi, 0x503, (0x1 << 2), (0) << 2); - - mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4); - - wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT); - mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14); - - mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15); - - mod_phy_reg(pi, 0x4d0, (0x1 << 5), (0) << 5); - - mod_phy_reg(pi, 0x4a4, (0x1ff << 0), (0) << 0); - - mod_phy_reg(pi, 0x4a5, (0xff << 0), (255) << 0); - - mod_phy_reg(pi, 0x4a5, (0x7 << 12), (5) << 12); - - mod_phy_reg(pi, 0x4a5, (0x7 << 8), (0) << 8); - - mod_phy_reg(pi, 0x40d, (0xff << 0), (64) << 0); - - mod_phy_reg(pi, 0x40d, (0x7 << 8), (4) << 8); - - mod_phy_reg(pi, 0x4a2, (0xff << 0), (64) << 0); - - mod_phy_reg(pi, 0x4a2, (0x7 << 8), (4) << 8); - - mod_phy_reg(pi, 0x4d0, (0x1ff << 6), (0) << 6); - - mod_phy_reg(pi, 0x4a8, (0xff << 0), (0x1) << 0); - - wlc_lcnphy_clear_tx_power_offsets(pi); - - mod_phy_reg(pi, 0x4a6, (0x1 << 15), (1) << 15); - - mod_phy_reg(pi, 0x4a6, (0x1ff << 0), (0xff) << 0); - - mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0); - - if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { - mod_radio_reg(pi, RADIO_2064_REG028, 0xf, 0xe); - mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); - } else { - mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1); - mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3); - } - - write_radio_reg(pi, RADIO_2064_REG025, 0xc); - - if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { - mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1); - } else { - if (CHSPEC_IS2G(pi->radio_chanspec)) - mod_radio_reg(pi, RADIO_2064_REG03A, 0x2, 1 << 1); - else - mod_radio_reg(pi, RADIO_2064_REG03A, 0x2, 0 << 1); - } - - if (LCNREV_IS(pi->pubpi.phy_rev, 2)) - mod_radio_reg(pi, RADIO_2064_REG03A, 0x2, 1 << 1); - else - mod_radio_reg(pi, RADIO_2064_REG03A, 0x4, 1 << 2); - - mod_radio_reg(pi, RADIO_2064_REG11A, 0x1, 1 << 0); - - mod_radio_reg(pi, RADIO_2064_REG005, 0x8, 1 << 3); - - if (!wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) - mod_phy_reg(pi, 0x4d7, - (0x1 << 3) | (0x7 << 12), 0 << 3 | 2 << 12); - - rfseq = wlc_lcnphy_rfseq_tbl_adc_pwrup(pi); - tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; - tab.tbl_width = 16; - tab.tbl_ptr = &rfseq; - tab.tbl_len = 1; - tab.tbl_offset = 6; - wlc_lcnphy_write_table(pi, &tab); - - mod_phy_reg(pi, 0x938, (0x1 << 2), (1) << 2); - - mod_phy_reg(pi, 0x939, (0x1 << 2), (1) << 2); - - mod_phy_reg(pi, 0x4a4, (0x1 << 12), (1) << 12); - - mod_phy_reg(pi, 0x4d7, (0x1 << 2), (1) << 2); - - mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8); - - wlc_lcnphy_pwrctrl_rssiparams(pi); -} - -void wlc_lcnphy_tx_pwr_update_npt(struct brcms_phy *pi) -{ - u16 tx_cnt, tx_total, npt; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - tx_total = wlc_lcnphy_total_tx_frames(pi); - tx_cnt = tx_total - pi_lcn->lcnphy_tssi_tx_cnt; - npt = wlc_lcnphy_get_tx_pwr_npt(pi); - - if (tx_cnt > (1 << npt)) { - - pi_lcn->lcnphy_tssi_tx_cnt = tx_total; - - pi_lcn->lcnphy_tssi_idx = wlc_lcnphy_get_current_tx_pwr_idx(pi); - pi_lcn->lcnphy_tssi_npt = npt; - - } -} - -s32 wlc_lcnphy_tssi2dbm(s32 tssi, s32 a1, s32 b0, s32 b1) -{ - s32 a, b, p; - - a = 32768 + (a1 * tssi); - b = (1024 * b0) + (64 * b1 * tssi); - p = ((2 * b) + a) / (2 * a); - - return p; -} - -static void wlc_lcnphy_txpower_reset_npt(struct brcms_phy *pi) -{ - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - if (wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) - return; - - pi_lcn->lcnphy_tssi_idx = LCNPHY_TX_PWR_CTRL_START_INDEX_2G_4313; - pi_lcn->lcnphy_tssi_npt = LCNPHY_TX_PWR_CTRL_START_NPT; -} - -void wlc_lcnphy_txpower_recalc_target(struct brcms_phy *pi) -{ - struct phytbl_info tab; - u32 rate_table[BRCMS_NUM_RATES_CCK + BRCMS_NUM_RATES_OFDM + - BRCMS_NUM_RATES_MCS_1_STREAM]; - uint i, j; - if (wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) - return; - - for (i = 0, j = 0; i < ARRAY_SIZE(rate_table); i++, j++) { - - if (i == BRCMS_NUM_RATES_CCK + BRCMS_NUM_RATES_OFDM) - j = TXP_FIRST_MCS_20_SISO; - - rate_table[i] = (u32) ((s32) (-pi->tx_power_offset[j])); - } - - tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; - tab.tbl_width = 32; - tab.tbl_len = ARRAY_SIZE(rate_table); - tab.tbl_ptr = rate_table; - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_RATE_OFFSET; - wlc_lcnphy_write_table(pi, &tab); - - if (wlc_lcnphy_get_target_tx_pwr(pi) != pi->tx_power_min) { - wlc_lcnphy_set_target_tx_pwr(pi, pi->tx_power_min); - - wlc_lcnphy_txpower_reset_npt(pi); - } -} - -static void wlc_lcnphy_set_tx_pwr_soft_ctrl(struct brcms_phy *pi, s8 index) -{ - u32 cck_offset[4] = { 22, 22, 22, 22 }; - u32 ofdm_offset, reg_offset_cck; - int i; - u16 index2; - struct phytbl_info tab; - - if (wlc_lcnphy_tssi_based_pwr_ctrl_enabled(pi)) - return; - - mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0x1) << 14); - - mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0x0) << 14); - - or_phy_reg(pi, 0x6da, 0x0040); - - reg_offset_cck = 0; - for (i = 0; i < 4; i++) - cck_offset[i] -= reg_offset_cck; - tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; - tab.tbl_width = 32; - tab.tbl_len = 4; - tab.tbl_ptr = cck_offset; - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_RATE_OFFSET; - wlc_lcnphy_write_table(pi, &tab); - ofdm_offset = 0; - tab.tbl_len = 1; - tab.tbl_ptr = &ofdm_offset; - for (i = 836; i < 862; i++) { - tab.tbl_offset = i; - wlc_lcnphy_write_table(pi, &tab); - } - - mod_phy_reg(pi, 0x4a4, (0x1 << 15), (0x1) << 15); - - mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0x1) << 14); - - mod_phy_reg(pi, 0x4a4, (0x1 << 13), (0x1) << 13); - - mod_phy_reg(pi, 0x4b0, (0x1 << 7), (0) << 7); - - mod_phy_reg(pi, 0x43b, (0x1 << 6), (0) << 6); - - mod_phy_reg(pi, 0x4a9, (0x1 << 15), (1) << 15); - - index2 = (u16) (index * 2); - mod_phy_reg(pi, 0x4a9, (0x1ff << 0), (index2) << 0); - - mod_phy_reg(pi, 0x6a3, (0x1 << 4), (0) << 4); - -} - -static s8 wlc_lcnphy_tempcompensated_txpwrctrl(struct brcms_phy *pi) -{ - s8 index, delta_brd, delta_temp, new_index, tempcorrx; - s16 manp, meas_temp, temp_diff; - bool neg = false; - u16 temp; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - if (wlc_lcnphy_tssi_based_pwr_ctrl_enabled(pi)) - return pi_lcn->lcnphy_current_index; - - index = FIXED_TXPWR; - - if (pi_lcn->lcnphy_tempsense_slope == 0) - return index; - - temp = (u16) wlc_lcnphy_tempsense(pi, 0); - meas_temp = LCNPHY_TEMPSENSE(temp); - - if (pi->tx_power_min != 0) - delta_brd = (pi_lcn->lcnphy_measPower - pi->tx_power_min); - else - delta_brd = 0; - - manp = LCNPHY_TEMPSENSE(pi_lcn->lcnphy_rawtempsense); - temp_diff = manp - meas_temp; - if (temp_diff < 0) { - neg = true; - temp_diff = -temp_diff; - } - - delta_temp = (s8) wlc_lcnphy_qdiv_roundup((u32) (temp_diff * 192), - (u32) (pi_lcn-> - lcnphy_tempsense_slope - * 10), 0); - if (neg) - delta_temp = -delta_temp; - - if (pi_lcn->lcnphy_tempsense_option == 3 - && LCNREV_IS(pi->pubpi.phy_rev, 0)) - delta_temp = 0; - if (pi_lcn->lcnphy_tempcorrx > 31) - tempcorrx = (s8) (pi_lcn->lcnphy_tempcorrx - 64); - else - tempcorrx = (s8) pi_lcn->lcnphy_tempcorrx; - if (LCNREV_IS(pi->pubpi.phy_rev, 1)) - tempcorrx = 4; - new_index = - index + delta_brd + delta_temp - pi_lcn->lcnphy_bandedge_corr; - new_index += tempcorrx; - - if (LCNREV_IS(pi->pubpi.phy_rev, 1)) - index = 127; - - if (new_index < 0 || new_index > 126) - return index; - - return new_index; -} - -static u16 wlc_lcnphy_set_tx_pwr_ctrl_mode(struct brcms_phy *pi, u16 mode) -{ - - u16 current_mode = mode; - if (wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi) && - mode == LCNPHY_TX_PWR_CTRL_HW) - current_mode = LCNPHY_TX_PWR_CTRL_TEMPBASED; - if (wlc_lcnphy_tssi_based_pwr_ctrl_enabled(pi) && - mode == LCNPHY_TX_PWR_CTRL_TEMPBASED) - current_mode = LCNPHY_TX_PWR_CTRL_HW; - return current_mode; -} - -void wlc_lcnphy_set_tx_pwr_ctrl(struct brcms_phy *pi, u16 mode) -{ - u16 old_mode = wlc_lcnphy_get_tx_pwr_ctrl(pi); - s8 index; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - mode = wlc_lcnphy_set_tx_pwr_ctrl_mode(pi, mode); - old_mode = wlc_lcnphy_set_tx_pwr_ctrl_mode(pi, old_mode); - - mod_phy_reg(pi, 0x6da, (0x1 << 6), - ((LCNPHY_TX_PWR_CTRL_HW == mode) ? 1 : 0) << 6); - - mod_phy_reg(pi, 0x6a3, (0x1 << 4), - ((LCNPHY_TX_PWR_CTRL_HW == mode) ? 0 : 1) << 4); - - if (old_mode != mode) { - if (LCNPHY_TX_PWR_CTRL_HW == old_mode) { - - wlc_lcnphy_tx_pwr_update_npt(pi); - - wlc_lcnphy_clear_tx_power_offsets(pi); - } - if (LCNPHY_TX_PWR_CTRL_HW == mode) { - - wlc_lcnphy_txpower_recalc_target(pi); - - wlc_lcnphy_set_start_tx_pwr_idx(pi, - pi_lcn-> - lcnphy_tssi_idx); - wlc_lcnphy_set_tx_pwr_npt(pi, pi_lcn->lcnphy_tssi_npt); - mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 0); - - pi_lcn->lcnphy_tssi_tx_cnt = - wlc_lcnphy_total_tx_frames(pi); - - wlc_lcnphy_disable_tx_gain_override(pi); - pi_lcn->lcnphy_tx_power_idx_override = -1; - } else - wlc_lcnphy_enable_tx_gain_override(pi); - - mod_phy_reg(pi, 0x4a4, - ((0x1 << 15) | (0x1 << 14) | (0x1 << 13)), mode); - if (mode == LCNPHY_TX_PWR_CTRL_TEMPBASED) { - index = wlc_lcnphy_tempcompensated_txpwrctrl(pi); - wlc_lcnphy_set_tx_pwr_soft_ctrl(pi, index); - pi_lcn->lcnphy_current_index = (s8) - ((read_phy_reg(pi, - 0x4a9) & - 0xFF) / 2); - } - } -} - -static void -wlc_lcnphy_tx_iqlo_loopback(struct brcms_phy *pi, u16 *values_to_save) -{ - u16 vmid; - int i; - for (i = 0; i < 20; i++) - values_to_save[i] = - read_radio_reg(pi, iqlo_loopback_rf_regs[i]); - - mod_phy_reg(pi, 0x44c, (0x1 << 12), 1 << 12); - mod_phy_reg(pi, 0x44d, (0x1 << 14), 1 << 14); - - mod_phy_reg(pi, 0x44c, (0x1 << 11), 1 << 11); - mod_phy_reg(pi, 0x44d, (0x1 << 13), 0 << 13); - - mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); - mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); - - mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); - mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); - - if (LCNREV_IS(pi->pubpi.phy_rev, 2)) - and_radio_reg(pi, RADIO_2064_REG03A, 0xFD); - else - and_radio_reg(pi, RADIO_2064_REG03A, 0xF9); - or_radio_reg(pi, RADIO_2064_REG11A, 0x1); - - or_radio_reg(pi, RADIO_2064_REG036, 0x01); - or_radio_reg(pi, RADIO_2064_REG11A, 0x18); - udelay(20); - - if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { - if (CHSPEC_IS5G(pi->radio_chanspec)) - mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0); - else - or_radio_reg(pi, RADIO_2064_REG03A, 1); - } else { - if (CHSPEC_IS5G(pi->radio_chanspec)) - mod_radio_reg(pi, RADIO_2064_REG03A, 3, 1); - else - or_radio_reg(pi, RADIO_2064_REG03A, 0x3); - } - - udelay(20); - - write_radio_reg(pi, RADIO_2064_REG025, 0xF); - if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { - if (CHSPEC_IS5G(pi->radio_chanspec)) - mod_radio_reg(pi, RADIO_2064_REG028, 0xF, 0x4); - else - mod_radio_reg(pi, RADIO_2064_REG028, 0xF, 0x6); - } else { - if (CHSPEC_IS5G(pi->radio_chanspec)) - mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, 0x4 << 1); - else - mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, 0x6 << 1); - } - - udelay(20); - - write_radio_reg(pi, RADIO_2064_REG005, 0x8); - or_radio_reg(pi, RADIO_2064_REG112, 0x80); - udelay(20); - - or_radio_reg(pi, RADIO_2064_REG0FF, 0x10); - or_radio_reg(pi, RADIO_2064_REG11F, 0x44); - udelay(20); - - or_radio_reg(pi, RADIO_2064_REG00B, 0x7); - or_radio_reg(pi, RADIO_2064_REG113, 0x10); - udelay(20); - - write_radio_reg(pi, RADIO_2064_REG007, 0x1); - udelay(20); - - vmid = 0x2A6; - mod_radio_reg(pi, RADIO_2064_REG0FC, 0x3 << 0, (vmid >> 8) & 0x3); - write_radio_reg(pi, RADIO_2064_REG0FD, (vmid & 0xff)); - or_radio_reg(pi, RADIO_2064_REG11F, 0x44); - udelay(20); - - or_radio_reg(pi, RADIO_2064_REG0FF, 0x10); - udelay(20); - write_radio_reg(pi, RADIO_2064_REG012, 0x02); - or_radio_reg(pi, RADIO_2064_REG112, 0x06); - write_radio_reg(pi, RADIO_2064_REG036, 0x11); - write_radio_reg(pi, RADIO_2064_REG059, 0xcc); - write_radio_reg(pi, RADIO_2064_REG05C, 0x2e); - write_radio_reg(pi, RADIO_2064_REG078, 0xd7); - write_radio_reg(pi, RADIO_2064_REG092, 0x15); -} - -static bool wlc_lcnphy_iqcal_wait(struct brcms_phy *pi) -{ - uint delay_count = 0; - - while (wlc_lcnphy_iqcal_active(pi)) { - udelay(100); - delay_count++; - - if (delay_count > (10 * 500)) - break; - } - - return (0 == wlc_lcnphy_iqcal_active(pi)); -} - -static void -wlc_lcnphy_tx_iqlo_loopback_cleanup(struct brcms_phy *pi, u16 *values_to_save) -{ - int i; - - and_phy_reg(pi, 0x44c, 0x0 >> 11); - - and_phy_reg(pi, 0x43b, 0xC); - - for (i = 0; i < 20; i++) - write_radio_reg(pi, iqlo_loopback_rf_regs[i], - values_to_save[i]); -} - -static void -wlc_lcnphy_tx_iqlo_cal(struct brcms_phy *pi, - struct lcnphy_txgains *target_gains, - enum lcnphy_cal_mode cal_mode, bool keep_tone) -{ - - struct lcnphy_txgains cal_gains, temp_gains; - u16 hash; - u8 band_idx; - int j; - u16 ncorr_override[5]; - u16 syst_coeffs[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}; - - u16 commands_fullcal[] = { - 0x8434, 0x8334, 0x8084, 0x8267, 0x8056, 0x8234 - }; - - u16 commands_recal[] = { - 0x8434, 0x8334, 0x8084, 0x8267, 0x8056, 0x8234 - }; - - u16 command_nums_fullcal[] = { - 0x7a97, 0x7a97, 0x7a97, 0x7a87, 0x7a87, 0x7b97 - }; - - u16 command_nums_recal[] = { - 0x7a97, 0x7a97, 0x7a97, 0x7a87, 0x7a87, 0x7b97 - }; - u16 *command_nums = command_nums_fullcal; - - u16 *start_coeffs = NULL, *cal_cmds = NULL, cal_type, diq_start; - u16 tx_pwr_ctrl_old, save_txpwrctrlrfctrl2; - u16 save_sslpnCalibClkEnCtrl, save_sslpnRxFeClkEnCtrl; - bool tx_gain_override_old; - struct lcnphy_txgains old_gains; - uint i, n_cal_cmds = 0, n_cal_start = 0; - u16 *values_to_save; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - values_to_save = kmalloc(sizeof(u16) * 20, GFP_ATOMIC); - if (NULL == values_to_save) - return; - - save_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db); - save_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); - - or_phy_reg(pi, 0x6da, 0x40); - or_phy_reg(pi, 0x6db, 0x3); - - switch (cal_mode) { - case LCNPHY_CAL_FULL: - start_coeffs = syst_coeffs; - cal_cmds = commands_fullcal; - n_cal_cmds = ARRAY_SIZE(commands_fullcal); - break; - - case LCNPHY_CAL_RECAL: - start_coeffs = syst_coeffs; - cal_cmds = commands_recal; - n_cal_cmds = ARRAY_SIZE(commands_recal); - command_nums = command_nums_recal; - break; - - default: - break; - } - - wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL, - start_coeffs, 11, 16, 64); - - write_phy_reg(pi, 0x6da, 0xffff); - mod_phy_reg(pi, 0x503, (0x1 << 3), (1) << 3); - - tx_pwr_ctrl_old = wlc_lcnphy_get_tx_pwr_ctrl(pi); - - mod_phy_reg(pi, 0x4a4, (0x1 << 12), (1) << 12); - - wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); - - save_txpwrctrlrfctrl2 = read_phy_reg(pi, 0x4db); - - mod_phy_reg(pi, 0x4db, (0x3ff << 0), (0x2a6) << 0); - - mod_phy_reg(pi, 0x4db, (0x7 << 12), (2) << 12); - - wlc_lcnphy_tx_iqlo_loopback(pi, values_to_save); - - tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); - if (tx_gain_override_old) - wlc_lcnphy_get_tx_gain(pi, &old_gains); - - if (!target_gains) { - if (!tx_gain_override_old) - wlc_lcnphy_set_tx_pwr_by_index(pi, - pi_lcn->lcnphy_tssi_idx); - wlc_lcnphy_get_tx_gain(pi, &temp_gains); - target_gains = &temp_gains; - } - - hash = (target_gains->gm_gain << 8) | - (target_gains->pga_gain << 4) | (target_gains->pad_gain); - - band_idx = (CHSPEC_IS5G(pi->radio_chanspec) ? 1 : 0); - - cal_gains = *target_gains; - memset(ncorr_override, 0, sizeof(ncorr_override)); - for (j = 0; j < iqcal_gainparams_numgains_lcnphy[band_idx]; j++) { - if (hash == tbl_iqcal_gainparams_lcnphy[band_idx][j][0]) { - cal_gains.gm_gain = - tbl_iqcal_gainparams_lcnphy[band_idx][j][1]; - cal_gains.pga_gain = - tbl_iqcal_gainparams_lcnphy[band_idx][j][2]; - cal_gains.pad_gain = - tbl_iqcal_gainparams_lcnphy[band_idx][j][3]; - memcpy(ncorr_override, - &tbl_iqcal_gainparams_lcnphy[band_idx][j][3], - sizeof(ncorr_override)); - break; - } - } - - wlc_lcnphy_set_tx_gain(pi, &cal_gains); - - write_phy_reg(pi, 0x453, 0xaa9); - write_phy_reg(pi, 0x93d, 0xc0); - - wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL, - lcnphy_iqcal_loft_gainladder, - ARRAY_SIZE(lcnphy_iqcal_loft_gainladder), - 16, 0); - - wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL, - lcnphy_iqcal_ir_gainladder, - ARRAY_SIZE( - lcnphy_iqcal_ir_gainladder), 16, - 32); - - if (pi->phy_tx_tone_freq) { - - wlc_lcnphy_stop_tx_tone(pi); - udelay(5); - wlc_lcnphy_start_tx_tone(pi, 3750, 88, 1); - } else { - wlc_lcnphy_start_tx_tone(pi, 3750, 88, 1); - } - - write_phy_reg(pi, 0x6da, 0xffff); - - for (i = n_cal_start; i < n_cal_cmds; i++) { - u16 zero_diq = 0; - u16 best_coeffs[11]; - u16 command_num; - - cal_type = (cal_cmds[i] & 0x0f00) >> 8; - - command_num = command_nums[i]; - if (ncorr_override[cal_type]) - command_num = - ncorr_override[cal_type] << 8 | (command_num & - 0xff); - - write_phy_reg(pi, 0x452, command_num); - - if ((cal_type == 3) || (cal_type == 4)) { - wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL, - &diq_start, 1, 16, 69); - - wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL, - &zero_diq, 1, 16, 69); - } - - write_phy_reg(pi, 0x451, cal_cmds[i]); - - if (!wlc_lcnphy_iqcal_wait(pi)) - goto cleanup; - - wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL, - best_coeffs, - ARRAY_SIZE(best_coeffs), 16, 96); - wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL, - best_coeffs, - ARRAY_SIZE(best_coeffs), 16, 64); - - if ((cal_type == 3) || (cal_type == 4)) - wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL, - &diq_start, 1, 16, 69); - wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL, - pi_lcn->lcnphy_cal_results. - txiqlocal_bestcoeffs, - ARRAY_SIZE(pi_lcn-> - lcnphy_cal_results. - txiqlocal_bestcoeffs), - 16, 96); - } - - wlc_lcnphy_common_read_table(pi, LCNPHY_TBL_ID_IQLOCAL, - pi_lcn->lcnphy_cal_results. - txiqlocal_bestcoeffs, - ARRAY_SIZE(pi_lcn->lcnphy_cal_results. - txiqlocal_bestcoeffs), 16, 96); - pi_lcn->lcnphy_cal_results.txiqlocal_bestcoeffs_valid = true; - - wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL, - &pi_lcn->lcnphy_cal_results. - txiqlocal_bestcoeffs[0], 4, 16, 80); - - wlc_lcnphy_common_write_table(pi, LCNPHY_TBL_ID_IQLOCAL, - &pi_lcn->lcnphy_cal_results. - txiqlocal_bestcoeffs[5], 2, 16, 85); - -cleanup: - wlc_lcnphy_tx_iqlo_loopback_cleanup(pi, values_to_save); - kfree(values_to_save); - - if (!keep_tone) - wlc_lcnphy_stop_tx_tone(pi); - - write_phy_reg(pi, 0x4db, save_txpwrctrlrfctrl2); - - write_phy_reg(pi, 0x453, 0); - - if (tx_gain_override_old) - wlc_lcnphy_set_tx_gain(pi, &old_gains); - wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl_old); - - write_phy_reg(pi, 0x6da, save_sslpnCalibClkEnCtrl); - write_phy_reg(pi, 0x6db, save_sslpnRxFeClkEnCtrl); - -} - -static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi) -{ - bool suspend, tx_gain_override_old; - struct lcnphy_txgains old_gains; - struct brcms_phy *pi = (struct brcms_phy *) ppi; - u16 idleTssi, idleTssi0_2C, idleTssi0_OB, idleTssi0_regvalue_OB, - idleTssi0_regvalue_2C; - u16 SAVE_txpwrctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); - u16 SAVE_lpfgain = read_radio_reg(pi, RADIO_2064_REG112); - u16 SAVE_jtag_bb_afe_switch = - read_radio_reg(pi, RADIO_2064_REG007) & 1; - u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10; - u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4; - idleTssi = read_phy_reg(pi, 0x4ab); - suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & - MCTL_EN_MAC)); - if (!suspend) - wlapi_suspend_mac_and_wait(pi->sh->physhim); - wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); - - tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); - wlc_lcnphy_get_tx_gain(pi, &old_gains); - - wlc_lcnphy_enable_tx_gain_override(pi); - wlc_lcnphy_set_tx_pwr_by_index(pi, 127); - write_radio_reg(pi, RADIO_2064_REG112, 0x6); - mod_radio_reg(pi, RADIO_2064_REG007, 0x1, 1); - mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4); - mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2); - wlc_lcnphy_tssi_setup(pi); - wlc_phy_do_dummy_tx(pi, true, OFF); - idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0)) - >> 0); - - idleTssi0_2C = ((read_phy_reg(pi, 0x63e) & (0x1ff << 0)) - >> 0); - - if (idleTssi0_2C >= 256) - idleTssi0_OB = idleTssi0_2C - 256; - else - idleTssi0_OB = idleTssi0_2C + 256; - - idleTssi0_regvalue_OB = idleTssi0_OB; - if (idleTssi0_regvalue_OB >= 256) - idleTssi0_regvalue_2C = idleTssi0_regvalue_OB - 256; - else - idleTssi0_regvalue_2C = idleTssi0_regvalue_OB + 256; - mod_phy_reg(pi, 0x4a6, (0x1ff << 0), (idleTssi0_regvalue_2C) << 0); - - mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12); - - wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old); - wlc_lcnphy_set_tx_gain(pi, &old_gains); - wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); - - write_radio_reg(pi, RADIO_2064_REG112, SAVE_lpfgain); - mod_radio_reg(pi, RADIO_2064_REG007, 0x1, SAVE_jtag_bb_afe_switch); - mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, SAVE_jtag_auxpga); - mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, SAVE_iqadc_aux_en); - mod_radio_reg(pi, RADIO_2064_REG112, 0x80, 1 << 7); - if (!suspend) - wlapi_enable_mac(pi->sh->physhim); -} - -static void wlc_lcnphy_vbat_temp_sense_setup(struct brcms_phy *pi, u8 mode) -{ - bool suspend; - u16 save_txpwrCtrlEn; - u8 auxpga_vmidcourse, auxpga_vmidfine, auxpga_gain; - u16 auxpga_vmid; - struct phytbl_info tab; - u32 val; - u8 save_reg007, save_reg0FF, save_reg11F, save_reg005, save_reg025, - save_reg112; - u16 values_to_save[14]; - s8 index; - int i; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - udelay(999); - - save_reg007 = (u8) read_radio_reg(pi, RADIO_2064_REG007); - save_reg0FF = (u8) read_radio_reg(pi, RADIO_2064_REG0FF); - save_reg11F = (u8) read_radio_reg(pi, RADIO_2064_REG11F); - save_reg005 = (u8) read_radio_reg(pi, RADIO_2064_REG005); - save_reg025 = (u8) read_radio_reg(pi, RADIO_2064_REG025); - save_reg112 = (u8) read_radio_reg(pi, RADIO_2064_REG112); - - for (i = 0; i < 14; i++) - values_to_save[i] = read_phy_reg(pi, tempsense_phy_regs[i]); - suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & - MCTL_EN_MAC)); - if (!suspend) - wlapi_suspend_mac_and_wait(pi->sh->physhim); - save_txpwrCtrlEn = read_radio_reg(pi, 0x4a4); - - wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); - index = pi_lcn->lcnphy_current_index; - wlc_lcnphy_set_tx_pwr_by_index(pi, 127); - mod_radio_reg(pi, RADIO_2064_REG007, 0x1, 0x1); - mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 0x1 << 4); - mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 0x1 << 2); - mod_phy_reg(pi, 0x503, (0x1 << 0), (0) << 0); - - mod_phy_reg(pi, 0x503, (0x1 << 2), (0) << 2); - - mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14); - - mod_phy_reg(pi, 0x4a4, (0x1 << 15), (0) << 15); - - mod_phy_reg(pi, 0x4d0, (0x1 << 5), (0) << 5); - - mod_phy_reg(pi, 0x4a5, (0xff << 0), (255) << 0); - - mod_phy_reg(pi, 0x4a5, (0x7 << 12), (5) << 12); - - mod_phy_reg(pi, 0x4a5, (0x7 << 8), (0) << 8); - - mod_phy_reg(pi, 0x40d, (0xff << 0), (64) << 0); - - mod_phy_reg(pi, 0x40d, (0x7 << 8), (6) << 8); - - mod_phy_reg(pi, 0x4a2, (0xff << 0), (64) << 0); - - mod_phy_reg(pi, 0x4a2, (0x7 << 8), (6) << 8); - - mod_phy_reg(pi, 0x4d9, (0x7 << 4), (2) << 4); - - mod_phy_reg(pi, 0x4d9, (0x7 << 8), (3) << 8); - - mod_phy_reg(pi, 0x4d9, (0x7 << 12), (1) << 12); - - mod_phy_reg(pi, 0x4da, (0x1 << 12), (0) << 12); - - mod_phy_reg(pi, 0x4da, (0x1 << 13), (1) << 13); - - mod_phy_reg(pi, 0x4a6, (0x1 << 15), (1) << 15); - - write_radio_reg(pi, RADIO_2064_REG025, 0xC); - - mod_radio_reg(pi, RADIO_2064_REG005, 0x8, 0x1 << 3); - - mod_phy_reg(pi, 0x938, (0x1 << 2), (1) << 2); - - mod_phy_reg(pi, 0x939, (0x1 << 2), (1) << 2); - - mod_phy_reg(pi, 0x4a4, (0x1 << 12), (1) << 12); - - val = wlc_lcnphy_rfseq_tbl_adc_pwrup(pi); - tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; - tab.tbl_width = 16; - tab.tbl_len = 1; - tab.tbl_ptr = &val; - tab.tbl_offset = 6; - wlc_lcnphy_write_table(pi, &tab); - if (mode == TEMPSENSE) { - mod_phy_reg(pi, 0x4d7, (0x1 << 3), (1) << 3); - - mod_phy_reg(pi, 0x4d7, (0x7 << 12), (1) << 12); - - auxpga_vmidcourse = 8; - auxpga_vmidfine = 0x4; - auxpga_gain = 2; - mod_radio_reg(pi, RADIO_2064_REG082, 0x20, 1 << 5); - } else { - mod_phy_reg(pi, 0x4d7, (0x1 << 3), (1) << 3); - - mod_phy_reg(pi, 0x4d7, (0x7 << 12), (3) << 12); - - auxpga_vmidcourse = 7; - auxpga_vmidfine = 0xa; - auxpga_gain = 2; - } - auxpga_vmid = - (u16) ((2 << 8) | (auxpga_vmidcourse << 4) | auxpga_vmidfine); - mod_phy_reg(pi, 0x4d8, (0x1 << 0), (1) << 0); - - mod_phy_reg(pi, 0x4d8, (0x3ff << 2), (auxpga_vmid) << 2); - - mod_phy_reg(pi, 0x4d8, (0x1 << 1), (1) << 1); - - mod_phy_reg(pi, 0x4d8, (0x7 << 12), (auxpga_gain) << 12); - - mod_phy_reg(pi, 0x4d0, (0x1 << 5), (1) << 5); - - write_radio_reg(pi, RADIO_2064_REG112, 0x6); - - wlc_phy_do_dummy_tx(pi, true, OFF); - if (!tempsense_done(pi)) - udelay(10); - - write_radio_reg(pi, RADIO_2064_REG007, (u16) save_reg007); - write_radio_reg(pi, RADIO_2064_REG0FF, (u16) save_reg0FF); - write_radio_reg(pi, RADIO_2064_REG11F, (u16) save_reg11F); - write_radio_reg(pi, RADIO_2064_REG005, (u16) save_reg005); - write_radio_reg(pi, RADIO_2064_REG025, (u16) save_reg025); - write_radio_reg(pi, RADIO_2064_REG112, (u16) save_reg112); - for (i = 0; i < 14; i++) - write_phy_reg(pi, tempsense_phy_regs[i], values_to_save[i]); - wlc_lcnphy_set_tx_pwr_by_index(pi, (int)index); - - write_radio_reg(pi, 0x4a4, save_txpwrCtrlEn); - if (!suspend) - wlapi_enable_mac(pi->sh->physhim); - udelay(999); -} - -static void wlc_lcnphy_tx_pwr_ctrl_init(struct brcms_phy_pub *ppi) -{ - struct lcnphy_txgains tx_gains; - u8 bbmult; - struct phytbl_info tab; - s32 a1, b0, b1; - s32 tssi, pwr, maxtargetpwr, mintargetpwr; - bool suspend; - struct brcms_phy *pi = (struct brcms_phy *) ppi; - - suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & - MCTL_EN_MAC)); - if (!suspend) - wlapi_suspend_mac_and_wait(pi->sh->physhim); - - if (!pi->hwpwrctrl_capable) { - if (CHSPEC_IS2G(pi->radio_chanspec)) { - tx_gains.gm_gain = 4; - tx_gains.pga_gain = 12; - tx_gains.pad_gain = 12; - tx_gains.dac_gain = 0; - - bbmult = 150; - } else { - tx_gains.gm_gain = 7; - tx_gains.pga_gain = 15; - tx_gains.pad_gain = 14; - tx_gains.dac_gain = 0; - - bbmult = 150; - } - wlc_lcnphy_set_tx_gain(pi, &tx_gains); - wlc_lcnphy_set_bbmult(pi, bbmult); - wlc_lcnphy_vbat_temp_sense_setup(pi, TEMPSENSE); - } else { - - wlc_lcnphy_idle_tssi_est(ppi); - - wlc_lcnphy_clear_tx_power_offsets(pi); - - b0 = pi->txpa_2g[0]; - b1 = pi->txpa_2g[1]; - a1 = pi->txpa_2g[2]; - maxtargetpwr = wlc_lcnphy_tssi2dbm(10, a1, b0, b1); - mintargetpwr = wlc_lcnphy_tssi2dbm(125, a1, b0, b1); - - tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; - tab.tbl_width = 32; - tab.tbl_ptr = &pwr; - tab.tbl_len = 1; - tab.tbl_offset = 0; - for (tssi = 0; tssi < 128; tssi++) { - pwr = wlc_lcnphy_tssi2dbm(tssi, a1, b0, b1); - - pwr = (pwr < mintargetpwr) ? mintargetpwr : pwr; - wlc_lcnphy_write_table(pi, &tab); - tab.tbl_offset++; - } - - mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7); - - write_phy_reg(pi, 0x4a8, 10); - - wlc_lcnphy_set_target_tx_pwr(pi, LCN_TARGET_PWR); - - wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_HW); - } - if (!suspend) - wlapi_enable_mac(pi->sh->physhim); -} - -static void wlc_lcnphy_set_pa_gain(struct brcms_phy *pi, u16 gain) -{ - mod_phy_reg(pi, 0x4fb, - LCNPHY_txgainctrlovrval1_pagain_ovr_val1_MASK, - gain << LCNPHY_txgainctrlovrval1_pagain_ovr_val1_SHIFT); - mod_phy_reg(pi, 0x4fd, - LCNPHY_stxtxgainctrlovrval1_pagain_ovr_val1_MASK, - gain << LCNPHY_stxtxgainctrlovrval1_pagain_ovr_val1_SHIFT); -} - -void -wlc_lcnphy_get_radio_loft(struct brcms_phy *pi, - u8 *ei0, u8 *eq0, u8 *fi0, u8 *fq0) -{ - *ei0 = LCNPHY_IQLOCC_READ(read_radio_reg(pi, RADIO_2064_REG089)); - *eq0 = LCNPHY_IQLOCC_READ(read_radio_reg(pi, RADIO_2064_REG08A)); - *fi0 = LCNPHY_IQLOCC_READ(read_radio_reg(pi, RADIO_2064_REG08B)); - *fq0 = LCNPHY_IQLOCC_READ(read_radio_reg(pi, RADIO_2064_REG08C)); -} - -void wlc_lcnphy_set_tx_iqcc(struct brcms_phy *pi, u16 a, u16 b) -{ - struct phytbl_info tab; - u16 iqcc[2]; - - iqcc[0] = a; - iqcc[1] = b; - - tab.tbl_id = LCNPHY_TBL_ID_IQLOCAL; - tab.tbl_width = 16; - tab.tbl_ptr = iqcc; - tab.tbl_len = 2; - tab.tbl_offset = 80; - wlc_lcnphy_write_table(pi, &tab); -} - -void wlc_lcnphy_set_tx_locc(struct brcms_phy *pi, u16 didq) -{ - struct phytbl_info tab; - - tab.tbl_id = LCNPHY_TBL_ID_IQLOCAL; - tab.tbl_width = 16; - tab.tbl_ptr = &didq; - tab.tbl_len = 1; - tab.tbl_offset = 85; - wlc_lcnphy_write_table(pi, &tab); -} - -void wlc_lcnphy_set_tx_pwr_by_index(struct brcms_phy *pi, int index) -{ - struct phytbl_info tab; - u16 a, b; - u8 bb_mult; - u32 bbmultiqcomp, txgain, locoeffs, rfpower; - struct lcnphy_txgains gains; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - pi_lcn->lcnphy_tx_power_idx_override = (s8) index; - pi_lcn->lcnphy_current_index = (u8) index; - - tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; - tab.tbl_width = 32; - tab.tbl_len = 1; - - wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); - - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_IQ_OFFSET + index; - tab.tbl_ptr = &bbmultiqcomp; - wlc_lcnphy_read_table(pi, &tab); - - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_GAIN_OFFSET + index; - tab.tbl_width = 32; - tab.tbl_ptr = &txgain; - wlc_lcnphy_read_table(pi, &tab); - - gains.gm_gain = (u16) (txgain & 0xff); - gains.pga_gain = (u16) (txgain >> 8) & 0xff; - gains.pad_gain = (u16) (txgain >> 16) & 0xff; - gains.dac_gain = (u16) (bbmultiqcomp >> 28) & 0x07; - wlc_lcnphy_set_tx_gain(pi, &gains); - wlc_lcnphy_set_pa_gain(pi, (u16) (txgain >> 24) & 0x7f); - - bb_mult = (u8) ((bbmultiqcomp >> 20) & 0xff); - wlc_lcnphy_set_bbmult(pi, bb_mult); - - wlc_lcnphy_enable_tx_gain_override(pi); - - if (!wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) { - - a = (u16) ((bbmultiqcomp >> 10) & 0x3ff); - b = (u16) (bbmultiqcomp & 0x3ff); - wlc_lcnphy_set_tx_iqcc(pi, a, b); - - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_LO_OFFSET + index; - tab.tbl_ptr = &locoeffs; - wlc_lcnphy_read_table(pi, &tab); - - wlc_lcnphy_set_tx_locc(pi, (u16) locoeffs); - - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_PWR_OFFSET + index; - tab.tbl_ptr = &rfpower; - wlc_lcnphy_read_table(pi, &tab); - mod_phy_reg(pi, 0x6a6, (0x1fff << 0), (rfpower * 8) << 0); - - } -} - -static void wlc_lcnphy_clear_papd_comptable(struct brcms_phy *pi) -{ - u32 j; - struct phytbl_info tab; - u32 temp_offset[128]; - tab.tbl_ptr = temp_offset; - tab.tbl_len = 128; - tab.tbl_id = LCNPHY_TBL_ID_PAPDCOMPDELTATBL; - tab.tbl_width = 32; - tab.tbl_offset = 0; - - memset(temp_offset, 0, sizeof(temp_offset)); - for (j = 1; j < 128; j += 2) - temp_offset[j] = 0x80000; - - wlc_lcnphy_write_table(pi, &tab); - return; -} - -void wlc_lcnphy_tx_pu(struct brcms_phy *pi, bool bEnable) -{ - if (!bEnable) { - - and_phy_reg(pi, 0x43b, ~(u16) ((0x1 << 1) | (0x1 << 4))); - - mod_phy_reg(pi, 0x43c, (0x1 << 1), 1 << 1); - - and_phy_reg(pi, 0x44c, - ~(u16) ((0x1 << 3) | - (0x1 << 5) | - (0x1 << 12) | - (0x1 << 0) | (0x1 << 1) | (0x1 << 2))); - - and_phy_reg(pi, 0x44d, - ~(u16) ((0x1 << 3) | (0x1 << 5) | (0x1 << 14))); - mod_phy_reg(pi, 0x44d, (0x1 << 2), 1 << 2); - - mod_phy_reg(pi, 0x44d, (0x1 << 1) | (0x1 << 0), (0x1 << 0)); - - and_phy_reg(pi, 0x4f9, - ~(u16) ((0x1 << 0) | (0x1 << 1) | (0x1 << 2))); - - and_phy_reg(pi, 0x4fa, - ~(u16) ((0x1 << 0) | (0x1 << 1) | (0x1 << 2))); - } else { - - mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); - mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); - - mod_phy_reg(pi, 0x43b, (0x1 << 4), 1 << 4); - mod_phy_reg(pi, 0x43c, (0x1 << 6), 0 << 6); - - mod_phy_reg(pi, 0x44c, (0x1 << 12), 1 << 12); - mod_phy_reg(pi, 0x44d, (0x1 << 14), 1 << 14); - - wlc_lcnphy_set_trsw_override(pi, true, false); - - mod_phy_reg(pi, 0x44d, (0x1 << 2), 0 << 2); - mod_phy_reg(pi, 0x44c, (0x1 << 2), 1 << 2); - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - - mod_phy_reg(pi, 0x44c, (0x1 << 3), 1 << 3); - mod_phy_reg(pi, 0x44d, (0x1 << 3), 1 << 3); - - mod_phy_reg(pi, 0x44c, (0x1 << 5), 1 << 5); - mod_phy_reg(pi, 0x44d, (0x1 << 5), 0 << 5); - - mod_phy_reg(pi, 0x4f9, (0x1 << 1), 1 << 1); - mod_phy_reg(pi, 0x4fa, (0x1 << 1), 1 << 1); - - mod_phy_reg(pi, 0x4f9, (0x1 << 2), 1 << 2); - mod_phy_reg(pi, 0x4fa, (0x1 << 2), 1 << 2); - - mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); - mod_phy_reg(pi, 0x4fa, (0x1 << 0), 1 << 0); - } else { - - mod_phy_reg(pi, 0x44c, (0x1 << 3), 1 << 3); - mod_phy_reg(pi, 0x44d, (0x1 << 3), 0 << 3); - - mod_phy_reg(pi, 0x44c, (0x1 << 5), 1 << 5); - mod_phy_reg(pi, 0x44d, (0x1 << 5), 1 << 5); - - mod_phy_reg(pi, 0x4f9, (0x1 << 1), 1 << 1); - mod_phy_reg(pi, 0x4fa, (0x1 << 1), 0 << 1); - - mod_phy_reg(pi, 0x4f9, (0x1 << 2), 1 << 2); - mod_phy_reg(pi, 0x4fa, (0x1 << 2), 0 << 2); - - mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); - mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); - } - } -} - -static void -wlc_lcnphy_run_samples(struct brcms_phy *pi, - u16 num_samps, - u16 num_loops, u16 wait, bool iqcalmode) -{ - - or_phy_reg(pi, 0x6da, 0x8080); - - mod_phy_reg(pi, 0x642, (0x7f << 0), (num_samps - 1) << 0); - if (num_loops != 0xffff) - num_loops--; - mod_phy_reg(pi, 0x640, (0xffff << 0), num_loops << 0); - - mod_phy_reg(pi, 0x641, (0xffff << 0), wait << 0); - - if (iqcalmode) { - - and_phy_reg(pi, 0x453, (u16) ~(0x1 << 15)); - or_phy_reg(pi, 0x453, (0x1 << 15)); - } else { - write_phy_reg(pi, 0x63f, 1); - wlc_lcnphy_tx_pu(pi, 1); - } - - or_radio_reg(pi, RADIO_2064_REG112, 0x6); -} - -void wlc_lcnphy_deaf_mode(struct brcms_phy *pi, bool mode) -{ - - u8 phybw40; - phybw40 = CHSPEC_IS40(pi->radio_chanspec); - - if (LCNREV_LT(pi->pubpi.phy_rev, 2)) { - mod_phy_reg(pi, 0x4b0, (0x1 << 5), (mode) << 5); - mod_phy_reg(pi, 0x4b1, (0x1 << 9), 0 << 9); - } else { - mod_phy_reg(pi, 0x4b0, (0x1 << 5), (mode) << 5); - mod_phy_reg(pi, 0x4b1, (0x1 << 9), 0 << 9); - } - - if (phybw40 == 0) { - mod_phy_reg((pi), 0x410, - (0x1 << 6) | - (0x1 << 5), - ((CHSPEC_IS2G( - pi->radio_chanspec)) ? (!mode) : 0) << - 6 | (!mode) << 5); - mod_phy_reg(pi, 0x410, (0x1 << 7), (mode) << 7); - } -} - -void -wlc_lcnphy_start_tx_tone(struct brcms_phy *pi, s32 f_kHz, u16 max_val, - bool iqcalmode) -{ - u8 phy_bw; - u16 num_samps, t, k; - u32 bw; - s32 theta = 0, rot = 0; - struct cordic_iq tone_samp; - u32 data_buf[64]; - u16 i_samp, q_samp; - struct phytbl_info tab; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - pi->phy_tx_tone_freq = f_kHz; - - wlc_lcnphy_deaf_mode(pi, true); - - phy_bw = 40; - if (pi_lcn->lcnphy_spurmod) { - write_phy_reg(pi, 0x942, 0x2); - write_phy_reg(pi, 0x93b, 0x0); - write_phy_reg(pi, 0x93c, 0x0); - wlc_lcnphy_txrx_spur_avoidance_mode(pi, false); - } - - if (f_kHz) { - k = 1; - do { - bw = phy_bw * 1000 * k; - num_samps = bw / abs(f_kHz); - k++; - } while ((num_samps * (u32) (abs(f_kHz))) != bw); - } else - num_samps = 2; - - rot = ((f_kHz * 36) / phy_bw) / 100; - theta = 0; - - for (t = 0; t < num_samps; t++) { - - tone_samp = cordic_calc_iq(theta); - - theta += rot; - - i_samp = (u16) (FLOAT(tone_samp.i * max_val) & 0x3ff); - q_samp = (u16) (FLOAT(tone_samp.q * max_val) & 0x3ff); - data_buf[t] = (i_samp << 10) | q_samp; - } - - mod_phy_reg(pi, 0x6d6, (0x3 << 0), 0 << 0); - - mod_phy_reg(pi, 0x6da, (0x1 << 3), 1 << 3); - - tab.tbl_ptr = data_buf; - tab.tbl_len = num_samps; - tab.tbl_id = LCNPHY_TBL_ID_SAMPLEPLAY; - tab.tbl_offset = 0; - tab.tbl_width = 32; - wlc_lcnphy_write_table(pi, &tab); - - wlc_lcnphy_run_samples(pi, num_samps, 0xffff, 0, iqcalmode); -} - -void wlc_lcnphy_stop_tx_tone(struct brcms_phy *pi) -{ - s16 playback_status; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - pi->phy_tx_tone_freq = 0; - if (pi_lcn->lcnphy_spurmod) { - write_phy_reg(pi, 0x942, 0x7); - write_phy_reg(pi, 0x93b, 0x2017); - write_phy_reg(pi, 0x93c, 0x27c5); - wlc_lcnphy_txrx_spur_avoidance_mode(pi, true); - } - - playback_status = read_phy_reg(pi, 0x644); - if (playback_status & (0x1 << 0)) { - wlc_lcnphy_tx_pu(pi, 0); - mod_phy_reg(pi, 0x63f, (0x1 << 1), 1 << 1); - } else if (playback_status & (0x1 << 1)) - mod_phy_reg(pi, 0x453, (0x1 << 15), 0 << 15); - - mod_phy_reg(pi, 0x6d6, (0x3 << 0), 1 << 0); - - mod_phy_reg(pi, 0x6da, (0x1 << 3), 0 << 3); - - mod_phy_reg(pi, 0x6da, (0x1 << 7), 0 << 7); - - and_radio_reg(pi, RADIO_2064_REG112, 0xFFF9); - - wlc_lcnphy_deaf_mode(pi, false); -} - -static void -wlc_lcnphy_set_cc(struct brcms_phy *pi, int cal_type, s16 coeff_x, s16 coeff_y) -{ - u16 di0dq0; - u16 x, y, data_rf; - int k; - switch (cal_type) { - case 0: - wlc_lcnphy_set_tx_iqcc(pi, coeff_x, coeff_y); - break; - case 2: - di0dq0 = (coeff_x & 0xff) << 8 | (coeff_y & 0xff); - wlc_lcnphy_set_tx_locc(pi, di0dq0); - break; - case 3: - k = wlc_lcnphy_calc_floor(coeff_x, 0); - y = 8 + k; - k = wlc_lcnphy_calc_floor(coeff_x, 1); - x = 8 - k; - data_rf = (x * 16 + y); - write_radio_reg(pi, RADIO_2064_REG089, data_rf); - k = wlc_lcnphy_calc_floor(coeff_y, 0); - y = 8 + k; - k = wlc_lcnphy_calc_floor(coeff_y, 1); - x = 8 - k; - data_rf = (x * 16 + y); - write_radio_reg(pi, RADIO_2064_REG08A, data_rf); - break; - case 4: - k = wlc_lcnphy_calc_floor(coeff_x, 0); - y = 8 + k; - k = wlc_lcnphy_calc_floor(coeff_x, 1); - x = 8 - k; - data_rf = (x * 16 + y); - write_radio_reg(pi, RADIO_2064_REG08B, data_rf); - k = wlc_lcnphy_calc_floor(coeff_y, 0); - y = 8 + k; - k = wlc_lcnphy_calc_floor(coeff_y, 1); - x = 8 - k; - data_rf = (x * 16 + y); - write_radio_reg(pi, RADIO_2064_REG08C, data_rf); - break; - } -} - -static struct lcnphy_unsign16_struct -wlc_lcnphy_get_cc(struct brcms_phy *pi, int cal_type) -{ - u16 a, b, didq; - u8 di0, dq0, ei, eq, fi, fq; - struct lcnphy_unsign16_struct cc; - cc.re = 0; - cc.im = 0; - switch (cal_type) { - case 0: - wlc_lcnphy_get_tx_iqcc(pi, &a, &b); - cc.re = a; - cc.im = b; - break; - case 2: - didq = wlc_lcnphy_get_tx_locc(pi); - di0 = (((didq & 0xff00) << 16) >> 24); - dq0 = (((didq & 0x00ff) << 24) >> 24); - cc.re = (u16) di0; - cc.im = (u16) dq0; - break; - case 3: - wlc_lcnphy_get_radio_loft(pi, &ei, &eq, &fi, &fq); - cc.re = (u16) ei; - cc.im = (u16) eq; - break; - case 4: - wlc_lcnphy_get_radio_loft(pi, &ei, &eq, &fi, &fq); - cc.re = (u16) fi; - cc.im = (u16) fq; - break; - } - return cc; -} - -static void -wlc_lcnphy_samp_cap(struct brcms_phy *pi, int clip_detect_algo, u16 thresh, - s16 *ptr, int mode) -{ - u32 curval1, curval2, stpptr, curptr, strptr, val; - u16 sslpnCalibClkEnCtrl, timer; - u16 old_sslpnCalibClkEnCtrl; - s16 imag, real; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - timer = 0; - old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); - - curval1 = bcma_read16(pi->d11core, D11REGOFFS(psm_corectlsts)); - ptr[130] = 0; - bcma_write16(pi->d11core, D11REGOFFS(psm_corectlsts), - ((1 << 6) | curval1)); - - bcma_write16(pi->d11core, D11REGOFFS(smpl_clct_strptr), 0x7E00); - bcma_write16(pi->d11core, D11REGOFFS(smpl_clct_stpptr), 0x8000); - udelay(20); - curval2 = bcma_read16(pi->d11core, D11REGOFFS(psm_phy_hdr_param)); - bcma_write16(pi->d11core, D11REGOFFS(psm_phy_hdr_param), - curval2 | 0x30); - - write_phy_reg(pi, 0x555, 0x0); - write_phy_reg(pi, 0x5a6, 0x5); - - write_phy_reg(pi, 0x5a2, (u16) (mode | mode << 6)); - write_phy_reg(pi, 0x5cf, 3); - write_phy_reg(pi, 0x5a5, 0x3); - write_phy_reg(pi, 0x583, 0x0); - write_phy_reg(pi, 0x584, 0x0); - write_phy_reg(pi, 0x585, 0x0fff); - write_phy_reg(pi, 0x586, 0x0000); - - write_phy_reg(pi, 0x580, 0x4501); - - sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); - write_phy_reg(pi, 0x6da, (u32) (sslpnCalibClkEnCtrl | 0x2008)); - stpptr = bcma_read16(pi->d11core, D11REGOFFS(smpl_clct_stpptr)); - curptr = bcma_read16(pi->d11core, D11REGOFFS(smpl_clct_curptr)); - do { - udelay(10); - curptr = bcma_read16(pi->d11core, D11REGOFFS(smpl_clct_curptr)); - timer++; - } while ((curptr != stpptr) && (timer < 500)); - - bcma_write16(pi->d11core, D11REGOFFS(psm_phy_hdr_param), 0x2); - strptr = 0x7E00; - bcma_write32(pi->d11core, D11REGOFFS(tplatewrptr), strptr); - while (strptr < 0x8000) { - val = bcma_read32(pi->d11core, D11REGOFFS(tplatewrdata)); - imag = ((val >> 16) & 0x3ff); - real = ((val) & 0x3ff); - if (imag > 511) - imag -= 1024; - - if (real > 511) - real -= 1024; - - if (pi_lcn->lcnphy_iqcal_swp_dis) - ptr[(strptr - 0x7E00) / 4] = real; - else - ptr[(strptr - 0x7E00) / 4] = imag; - - if (clip_detect_algo) { - if (imag > thresh || imag < -thresh) { - strptr = 0x8000; - ptr[130] = 1; - } - } - - strptr += 4; - } - - write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl); - bcma_write16(pi->d11core, D11REGOFFS(psm_phy_hdr_param), curval2); - bcma_write16(pi->d11core, D11REGOFFS(psm_corectlsts), curval1); -} - -static void -wlc_lcnphy_a1(struct brcms_phy *pi, int cal_type, int num_levels, - int step_size_lg2) -{ - const struct lcnphy_spb_tone *phy_c1; - struct lcnphy_spb_tone phy_c2; - struct lcnphy_unsign16_struct phy_c3; - int phy_c4, phy_c5, k, l, j, phy_c6; - u16 phy_c7, phy_c8, phy_c9; - s16 phy_c10, phy_c11, phy_c12, phy_c13, phy_c14, phy_c15, phy_c16; - s16 *ptr, phy_c17; - s32 phy_c18, phy_c19; - u32 phy_c20, phy_c21; - bool phy_c22, phy_c23, phy_c24, phy_c25; - u16 phy_c26, phy_c27; - u16 phy_c28, phy_c29, phy_c30; - u16 phy_c31; - u16 *phy_c32; - phy_c21 = 0; - phy_c10 = phy_c13 = phy_c14 = phy_c8 = 0; - ptr = kmalloc(sizeof(s16) * 131, GFP_ATOMIC); - if (NULL == ptr) - return; - - phy_c32 = kmalloc(sizeof(u16) * 20, GFP_ATOMIC); - if (NULL == phy_c32) { - kfree(ptr); - return; - } - phy_c26 = read_phy_reg(pi, 0x6da); - phy_c27 = read_phy_reg(pi, 0x6db); - phy_c31 = read_radio_reg(pi, RADIO_2064_REG026); - write_phy_reg(pi, 0x93d, 0xC0); - - wlc_lcnphy_start_tx_tone(pi, 3750, 88, 0); - write_phy_reg(pi, 0x6da, 0xffff); - or_phy_reg(pi, 0x6db, 0x3); - - wlc_lcnphy_tx_iqlo_loopback(pi, phy_c32); - udelay(500); - phy_c28 = read_phy_reg(pi, 0x938); - phy_c29 = read_phy_reg(pi, 0x4d7); - phy_c30 = read_phy_reg(pi, 0x4d8); - or_phy_reg(pi, 0x938, 0x1 << 2); - or_phy_reg(pi, 0x4d7, 0x1 << 2); - or_phy_reg(pi, 0x4d7, 0x1 << 3); - mod_phy_reg(pi, 0x4d7, (0x7 << 12), 0x2 << 12); - or_phy_reg(pi, 0x4d8, 1 << 0); - or_phy_reg(pi, 0x4d8, 1 << 1); - mod_phy_reg(pi, 0x4d8, (0x3ff << 2), 0x23A << 2); - mod_phy_reg(pi, 0x4d8, (0x7 << 12), 0x7 << 12); - phy_c1 = &lcnphy_spb_tone_3750[0]; - phy_c4 = 32; - - if (num_levels == 0) { - if (cal_type != 0) - num_levels = 4; - else - num_levels = 9; - } - if (step_size_lg2 == 0) { - if (cal_type != 0) - step_size_lg2 = 3; - else - step_size_lg2 = 8; - } - - phy_c7 = (1 << step_size_lg2); - phy_c3 = wlc_lcnphy_get_cc(pi, cal_type); - phy_c15 = (s16) phy_c3.re; - phy_c16 = (s16) phy_c3.im; - if (cal_type == 2) { - if (phy_c3.re > 127) - phy_c15 = phy_c3.re - 256; - if (phy_c3.im > 127) - phy_c16 = phy_c3.im - 256; - } - wlc_lcnphy_set_cc(pi, cal_type, phy_c15, phy_c16); - udelay(20); - for (phy_c8 = 0; phy_c7 != 0 && phy_c8 < num_levels; phy_c8++) { - phy_c23 = true; - phy_c22 = false; - switch (cal_type) { - case 0: - phy_c10 = 511; - break; - case 2: - phy_c10 = 127; - break; - case 3: - phy_c10 = 15; - break; - case 4: - phy_c10 = 15; - break; - } - - phy_c9 = read_phy_reg(pi, 0x93d); - phy_c9 = 2 * phy_c9; - phy_c24 = false; - phy_c5 = 7; - phy_c25 = true; - while (1) { - write_radio_reg(pi, RADIO_2064_REG026, - (phy_c5 & 0x7) | ((phy_c5 & 0x7) << 4)); - udelay(50); - phy_c22 = false; - ptr[130] = 0; - wlc_lcnphy_samp_cap(pi, 1, phy_c9, &ptr[0], 2); - if (ptr[130] == 1) - phy_c22 = true; - if (phy_c22) - phy_c5 -= 1; - if ((phy_c22 != phy_c24) && (!phy_c25)) - break; - if (!phy_c22) - phy_c5 += 1; - if (phy_c5 <= 0 || phy_c5 >= 7) - break; - phy_c24 = phy_c22; - phy_c25 = false; - } - - if (phy_c5 < 0) - phy_c5 = 0; - else if (phy_c5 > 7) - phy_c5 = 7; - - for (k = -phy_c7; k <= phy_c7; k += phy_c7) { - for (l = -phy_c7; l <= phy_c7; l += phy_c7) { - phy_c11 = phy_c15 + k; - phy_c12 = phy_c16 + l; - - if (phy_c11 < -phy_c10) - phy_c11 = -phy_c10; - else if (phy_c11 > phy_c10) - phy_c11 = phy_c10; - if (phy_c12 < -phy_c10) - phy_c12 = -phy_c10; - else if (phy_c12 > phy_c10) - phy_c12 = phy_c10; - wlc_lcnphy_set_cc(pi, cal_type, phy_c11, - phy_c12); - udelay(20); - wlc_lcnphy_samp_cap(pi, 0, 0, ptr, 2); - - phy_c18 = 0; - phy_c19 = 0; - for (j = 0; j < 128; j++) { - if (cal_type != 0) - phy_c6 = j % phy_c4; - else - phy_c6 = (2 * j) % phy_c4; - - phy_c2.re = phy_c1[phy_c6].re; - phy_c2.im = phy_c1[phy_c6].im; - phy_c17 = ptr[j]; - phy_c18 = phy_c18 + phy_c17 * phy_c2.re; - phy_c19 = phy_c19 + phy_c17 * phy_c2.im; - } - - phy_c18 = phy_c18 >> 10; - phy_c19 = phy_c19 >> 10; - phy_c20 = ((phy_c18 * phy_c18) + - (phy_c19 * phy_c19)); - - if (phy_c23 || phy_c20 < phy_c21) { - phy_c21 = phy_c20; - phy_c13 = phy_c11; - phy_c14 = phy_c12; - } - phy_c23 = false; - } - } - phy_c23 = true; - phy_c15 = phy_c13; - phy_c16 = phy_c14; - phy_c7 = phy_c7 >> 1; - wlc_lcnphy_set_cc(pi, cal_type, phy_c15, phy_c16); - udelay(20); - } - goto cleanup; -cleanup: - wlc_lcnphy_tx_iqlo_loopback_cleanup(pi, phy_c32); - wlc_lcnphy_stop_tx_tone(pi); - write_phy_reg(pi, 0x6da, phy_c26); - write_phy_reg(pi, 0x6db, phy_c27); - write_phy_reg(pi, 0x938, phy_c28); - write_phy_reg(pi, 0x4d7, phy_c29); - write_phy_reg(pi, 0x4d8, phy_c30); - write_radio_reg(pi, RADIO_2064_REG026, phy_c31); - - kfree(phy_c32); - kfree(ptr); -} - -void wlc_lcnphy_get_tx_iqcc(struct brcms_phy *pi, u16 *a, u16 *b) -{ - u16 iqcc[2]; - struct phytbl_info tab; - - tab.tbl_ptr = iqcc; - tab.tbl_len = 2; - tab.tbl_id = 0; - tab.tbl_offset = 80; - tab.tbl_width = 16; - wlc_lcnphy_read_table(pi, &tab); - - *a = iqcc[0]; - *b = iqcc[1]; -} - -static void wlc_lcnphy_tx_iqlo_soft_cal_full(struct brcms_phy *pi) -{ - struct lcnphy_unsign16_struct iqcc0, locc2, locc3, locc4; - - wlc_lcnphy_set_cc(pi, 0, 0, 0); - wlc_lcnphy_set_cc(pi, 2, 0, 0); - wlc_lcnphy_set_cc(pi, 3, 0, 0); - wlc_lcnphy_set_cc(pi, 4, 0, 0); - - wlc_lcnphy_a1(pi, 4, 0, 0); - wlc_lcnphy_a1(pi, 3, 0, 0); - wlc_lcnphy_a1(pi, 2, 3, 2); - wlc_lcnphy_a1(pi, 0, 5, 8); - wlc_lcnphy_a1(pi, 2, 2, 1); - wlc_lcnphy_a1(pi, 0, 4, 3); - - iqcc0 = wlc_lcnphy_get_cc(pi, 0); - locc2 = wlc_lcnphy_get_cc(pi, 2); - locc3 = wlc_lcnphy_get_cc(pi, 3); - locc4 = wlc_lcnphy_get_cc(pi, 4); -} - -u16 wlc_lcnphy_get_tx_locc(struct brcms_phy *pi) -{ - struct phytbl_info tab; - u16 didq; - - tab.tbl_id = 0; - tab.tbl_width = 16; - tab.tbl_ptr = &didq; - tab.tbl_len = 1; - tab.tbl_offset = 85; - wlc_lcnphy_read_table(pi, &tab); - - return didq; -} - -static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi) -{ - - struct lcnphy_txgains target_gains, old_gains; - u8 save_bb_mult; - u16 a, b, didq, save_pa_gain = 0; - uint idx, SAVE_txpwrindex = 0xFF; - u32 val; - u16 SAVE_txpwrctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); - struct phytbl_info tab; - u8 ei0, eq0, fi0, fq0; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - wlc_lcnphy_get_tx_gain(pi, &old_gains); - save_pa_gain = wlc_lcnphy_get_pa_gain(pi); - - save_bb_mult = wlc_lcnphy_get_bbmult(pi); - - if (SAVE_txpwrctrl == LCNPHY_TX_PWR_CTRL_OFF) - SAVE_txpwrindex = wlc_lcnphy_get_current_tx_pwr_idx(pi); - - wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); - - target_gains.gm_gain = 7; - target_gains.pga_gain = 0; - target_gains.pad_gain = 21; - target_gains.dac_gain = 0; - wlc_lcnphy_set_tx_gain(pi, &target_gains); - wlc_lcnphy_set_tx_pwr_by_index(pi, 16); - - if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) { - - wlc_lcnphy_set_tx_pwr_by_index(pi, 30); - - wlc_lcnphy_tx_iqlo_cal(pi, &target_gains, - (pi_lcn-> - lcnphy_recal ? LCNPHY_CAL_RECAL : - LCNPHY_CAL_FULL), false); - } else { - wlc_lcnphy_tx_iqlo_soft_cal_full(pi); - } - - wlc_lcnphy_get_radio_loft(pi, &ei0, &eq0, &fi0, &fq0); - if ((abs((s8) fi0) == 15) && (abs((s8) fq0) == 15)) { - if (CHSPEC_IS5G(pi->radio_chanspec)) { - target_gains.gm_gain = 255; - target_gains.pga_gain = 255; - target_gains.pad_gain = 0xf0; - target_gains.dac_gain = 0; - } else { - target_gains.gm_gain = 7; - target_gains.pga_gain = 45; - target_gains.pad_gain = 186; - target_gains.dac_gain = 0; - } - - if (LCNREV_IS(pi->pubpi.phy_rev, 1) - || pi_lcn->lcnphy_hw_iqcal_en) { - - target_gains.pga_gain = 0; - target_gains.pad_gain = 30; - wlc_lcnphy_set_tx_pwr_by_index(pi, 16); - wlc_lcnphy_tx_iqlo_cal(pi, &target_gains, - LCNPHY_CAL_FULL, false); - } else { - wlc_lcnphy_tx_iqlo_soft_cal_full(pi); - } - } - - wlc_lcnphy_get_tx_iqcc(pi, &a, &b); - - didq = wlc_lcnphy_get_tx_locc(pi); - - tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; - tab.tbl_width = 32; - tab.tbl_ptr = &val; - - tab.tbl_len = 1; - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_RATE_OFFSET; - - for (idx = 0; idx < 128; idx++) { - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_IQ_OFFSET + idx; - - wlc_lcnphy_read_table(pi, &tab); - val = (val & 0xfff00000) | - ((u32) (a & 0x3FF) << 10) | (b & 0x3ff); - wlc_lcnphy_write_table(pi, &tab); - - val = didq; - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_LO_OFFSET + idx; - wlc_lcnphy_write_table(pi, &tab); - } - - pi_lcn->lcnphy_cal_results.txiqlocal_a = a; - pi_lcn->lcnphy_cal_results.txiqlocal_b = b; - pi_lcn->lcnphy_cal_results.txiqlocal_didq = didq; - pi_lcn->lcnphy_cal_results.txiqlocal_ei0 = ei0; - pi_lcn->lcnphy_cal_results.txiqlocal_eq0 = eq0; - pi_lcn->lcnphy_cal_results.txiqlocal_fi0 = fi0; - pi_lcn->lcnphy_cal_results.txiqlocal_fq0 = fq0; - - wlc_lcnphy_set_bbmult(pi, save_bb_mult); - wlc_lcnphy_set_pa_gain(pi, save_pa_gain); - wlc_lcnphy_set_tx_gain(pi, &old_gains); - - if (SAVE_txpwrctrl != LCNPHY_TX_PWR_CTRL_OFF) - wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); - else - wlc_lcnphy_set_tx_pwr_by_index(pi, SAVE_txpwrindex); -} - -s16 wlc_lcnphy_tempsense_new(struct brcms_phy *pi, bool mode) -{ - u16 tempsenseval1, tempsenseval2; - s16 avg = 0; - bool suspend = false; - - if (mode == 1) { - suspend = (0 == (bcma_read32(pi->d11core, - D11REGOFFS(maccontrol)) & - MCTL_EN_MAC)); - if (!suspend) - wlapi_suspend_mac_and_wait(pi->sh->physhim); - wlc_lcnphy_vbat_temp_sense_setup(pi, TEMPSENSE); - } - tempsenseval1 = read_phy_reg(pi, 0x476) & 0x1FF; - tempsenseval2 = read_phy_reg(pi, 0x477) & 0x1FF; - - if (tempsenseval1 > 255) - avg = (s16) (tempsenseval1 - 512); - else - avg = (s16) tempsenseval1; - - if (tempsenseval2 > 255) - avg += (s16) (tempsenseval2 - 512); - else - avg += (s16) tempsenseval2; - - avg /= 2; - - if (mode == 1) { - - mod_phy_reg(pi, 0x448, (0x1 << 14), (1) << 14); - - udelay(100); - mod_phy_reg(pi, 0x448, (0x1 << 14), (0) << 14); - - if (!suspend) - wlapi_enable_mac(pi->sh->physhim); - } - return avg; -} - -u16 wlc_lcnphy_tempsense(struct brcms_phy *pi, bool mode) -{ - u16 tempsenseval1, tempsenseval2; - s32 avg = 0; - bool suspend = false; - u16 SAVE_txpwrctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - if (mode == 1) { - suspend = (0 == (bcma_read32(pi->d11core, - D11REGOFFS(maccontrol)) & - MCTL_EN_MAC)); - if (!suspend) - wlapi_suspend_mac_and_wait(pi->sh->physhim); - wlc_lcnphy_vbat_temp_sense_setup(pi, TEMPSENSE); - } - tempsenseval1 = read_phy_reg(pi, 0x476) & 0x1FF; - tempsenseval2 = read_phy_reg(pi, 0x477) & 0x1FF; - - if (tempsenseval1 > 255) - avg = (int)(tempsenseval1 - 512); - else - avg = (int)tempsenseval1; - - if (pi_lcn->lcnphy_tempsense_option == 1 || pi->hwpwrctrl_capable) { - if (tempsenseval2 > 255) - avg = (int)(avg - tempsenseval2 + 512); - else - avg = (int)(avg - tempsenseval2); - } else { - if (tempsenseval2 > 255) - avg = (int)(avg + tempsenseval2 - 512); - else - avg = (int)(avg + tempsenseval2); - avg = avg / 2; - } - if (avg < 0) - avg = avg + 512; - - if (pi_lcn->lcnphy_tempsense_option == 2) - avg = tempsenseval1; - - if (mode) - wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); - - if (mode == 1) { - - mod_phy_reg(pi, 0x448, (0x1 << 14), (1) << 14); - - udelay(100); - mod_phy_reg(pi, 0x448, (0x1 << 14), (0) << 14); - - if (!suspend) - wlapi_enable_mac(pi->sh->physhim); - } - return (u16) avg; -} - -s8 wlc_lcnphy_tempsense_degree(struct brcms_phy *pi, bool mode) -{ - s32 degree = wlc_lcnphy_tempsense_new(pi, mode); - degree = - ((degree << - 10) + LCN_TEMPSENSE_OFFSET + (LCN_TEMPSENSE_DEN >> 1)) - / LCN_TEMPSENSE_DEN; - return (s8) degree; -} - -s8 wlc_lcnphy_vbatsense(struct brcms_phy *pi, bool mode) -{ - u16 vbatsenseval; - s32 avg = 0; - bool suspend = false; - - if (mode == 1) { - suspend = (0 == (bcma_read32(pi->d11core, - D11REGOFFS(maccontrol)) & - MCTL_EN_MAC)); - if (!suspend) - wlapi_suspend_mac_and_wait(pi->sh->physhim); - wlc_lcnphy_vbat_temp_sense_setup(pi, VBATSENSE); - } - - vbatsenseval = read_phy_reg(pi, 0x475) & 0x1FF; - - if (vbatsenseval > 255) - avg = (s32) (vbatsenseval - 512); - else - avg = (s32) vbatsenseval; - - avg = (avg * LCN_VBAT_SCALE_NOM + - (LCN_VBAT_SCALE_DEN >> 1)) / LCN_VBAT_SCALE_DEN; - - if (mode == 1) { - if (!suspend) - wlapi_enable_mac(pi->sh->physhim); - } - return (s8) avg; -} - -static void wlc_lcnphy_afe_clk_init(struct brcms_phy *pi, u8 mode) -{ - u8 phybw40; - phybw40 = CHSPEC_IS40(pi->radio_chanspec); - - mod_phy_reg(pi, 0x6d1, (0x1 << 7), (1) << 7); - - if (((mode == AFE_CLK_INIT_MODE_PAPD) && (phybw40 == 0)) || - (mode == AFE_CLK_INIT_MODE_TXRX2X)) - write_phy_reg(pi, 0x6d0, 0x7); - - wlc_lcnphy_toggle_afe_pwdn(pi); -} - -static void wlc_lcnphy_temp_adj(struct brcms_phy *pi) -{ -} - -static void wlc_lcnphy_glacial_timer_based_cal(struct brcms_phy *pi) -{ - bool suspend; - s8 index; - u16 SAVE_pwrctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & - MCTL_EN_MAC)); - if (!suspend) - wlapi_suspend_mac_and_wait(pi->sh->physhim); - wlc_lcnphy_deaf_mode(pi, true); - pi->phy_lastcal = pi->sh->now; - pi->phy_forcecal = false; - index = pi_lcn->lcnphy_current_index; - - wlc_lcnphy_txpwrtbl_iqlo_cal(pi); - - wlc_lcnphy_set_tx_pwr_by_index(pi, index); - wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_pwrctrl); - wlc_lcnphy_deaf_mode(pi, false); - if (!suspend) - wlapi_enable_mac(pi->sh->physhim); - -} - -static void wlc_lcnphy_periodic_cal(struct brcms_phy *pi) -{ - bool suspend, full_cal; - const struct lcnphy_rx_iqcomp *rx_iqcomp; - int rx_iqcomp_sz; - u16 SAVE_pwrctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); - s8 index; - struct phytbl_info tab; - s32 a1, b0, b1; - s32 tssi, pwr, maxtargetpwr, mintargetpwr; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - pi->phy_lastcal = pi->sh->now; - pi->phy_forcecal = false; - full_cal = - (pi_lcn->lcnphy_full_cal_channel != - CHSPEC_CHANNEL(pi->radio_chanspec)); - pi_lcn->lcnphy_full_cal_channel = CHSPEC_CHANNEL(pi->radio_chanspec); - index = pi_lcn->lcnphy_current_index; - - suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & - MCTL_EN_MAC)); - if (!suspend) { - wlapi_bmac_write_shm(pi->sh->physhim, M_CTS_DURATION, 10000); - wlapi_suspend_mac_and_wait(pi->sh->physhim); - } - - wlc_lcnphy_deaf_mode(pi, true); - - wlc_lcnphy_txpwrtbl_iqlo_cal(pi); - - rx_iqcomp = lcnphy_rx_iqcomp_table_rev0; - rx_iqcomp_sz = ARRAY_SIZE(lcnphy_rx_iqcomp_table_rev0); - - if (LCNREV_IS(pi->pubpi.phy_rev, 1)) - wlc_lcnphy_rx_iq_cal(pi, NULL, 0, true, false, 1, 40); - else - wlc_lcnphy_rx_iq_cal(pi, NULL, 0, true, false, 1, 127); - - if (wlc_lcnphy_tssi_based_pwr_ctrl_enabled(pi)) { - - wlc_lcnphy_idle_tssi_est((struct brcms_phy_pub *) pi); - - b0 = pi->txpa_2g[0]; - b1 = pi->txpa_2g[1]; - a1 = pi->txpa_2g[2]; - maxtargetpwr = wlc_lcnphy_tssi2dbm(10, a1, b0, b1); - mintargetpwr = wlc_lcnphy_tssi2dbm(125, a1, b0, b1); - - tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; - tab.tbl_width = 32; - tab.tbl_ptr = &pwr; - tab.tbl_len = 1; - tab.tbl_offset = 0; - for (tssi = 0; tssi < 128; tssi++) { - pwr = wlc_lcnphy_tssi2dbm(tssi, a1, b0, b1); - pwr = (pwr < mintargetpwr) ? mintargetpwr : pwr; - wlc_lcnphy_write_table(pi, &tab); - tab.tbl_offset++; - } - } - - wlc_lcnphy_set_tx_pwr_by_index(pi, index); - wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_pwrctrl); - wlc_lcnphy_deaf_mode(pi, false); - if (!suspend) - wlapi_enable_mac(pi->sh->physhim); -} - -void wlc_lcnphy_calib_modes(struct brcms_phy *pi, uint mode) -{ - u16 temp_new; - int temp1, temp2, temp_diff; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - switch (mode) { - case PHY_PERICAL_CHAN: - break; - case PHY_FULLCAL: - wlc_lcnphy_periodic_cal(pi); - break; - case PHY_PERICAL_PHYINIT: - wlc_lcnphy_periodic_cal(pi); - break; - case PHY_PERICAL_WATCHDOG: - if (wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) { - temp_new = wlc_lcnphy_tempsense(pi, 0); - temp1 = LCNPHY_TEMPSENSE(temp_new); - temp2 = LCNPHY_TEMPSENSE(pi_lcn->lcnphy_cal_temper); - temp_diff = temp1 - temp2; - if ((pi_lcn->lcnphy_cal_counter > 90) || - (temp_diff > 60) || (temp_diff < -60)) { - wlc_lcnphy_glacial_timer_based_cal(pi); - wlc_2064_vco_cal(pi); - pi_lcn->lcnphy_cal_temper = temp_new; - pi_lcn->lcnphy_cal_counter = 0; - } else - pi_lcn->lcnphy_cal_counter++; - } - break; - case LCNPHY_PERICAL_TEMPBASED_TXPWRCTRL: - if (wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) - wlc_lcnphy_tx_power_adjustment( - (struct brcms_phy_pub *) pi); - break; - } -} - -void wlc_lcnphy_get_tssi(struct brcms_phy *pi, s8 *ofdm_pwr, s8 *cck_pwr) -{ - s8 cck_offset; - u16 status; - status = (read_phy_reg(pi, 0x4ab)); - if (wlc_lcnphy_tssi_based_pwr_ctrl_enabled(pi) && - (status & (0x1 << 15))) { - *ofdm_pwr = (s8) (((read_phy_reg(pi, 0x4ab) & (0x1ff << 0)) - >> 0) >> 1); - - if (wlc_phy_tpc_isenabled_lcnphy(pi)) - cck_offset = pi->tx_power_offset[TXP_FIRST_CCK]; - else - cck_offset = 0; - - *cck_pwr = *ofdm_pwr + cck_offset; - } else { - *cck_pwr = 0; - *ofdm_pwr = 0; - } -} - -void wlc_phy_cal_init_lcnphy(struct brcms_phy *pi) -{ - return; - -} - -void wlc_lcnphy_tx_power_adjustment(struct brcms_phy_pub *ppi) -{ - s8 index; - u16 index2; - struct brcms_phy *pi = (struct brcms_phy *) ppi; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - u16 SAVE_txpwrctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); - if (wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi) && - SAVE_txpwrctrl) { - index = wlc_lcnphy_tempcompensated_txpwrctrl(pi); - index2 = (u16) (index * 2); - mod_phy_reg(pi, 0x4a9, (0x1ff << 0), (index2) << 0); - - pi_lcn->lcnphy_current_index = - (s8)((read_phy_reg(pi, 0x4a9) & 0xFF) / 2); - } -} - -static void -wlc_lcnphy_load_tx_gain_table(struct brcms_phy *pi, - const struct lcnphy_tx_gain_tbl_entry *gain_table) -{ - u32 j; - struct phytbl_info tab; - u32 val; - u16 pa_gain; - u16 gm_gain; - - if (CHSPEC_IS5G(pi->radio_chanspec)) - pa_gain = 0x70; - else - pa_gain = 0x70; - - if (pi->sh->boardflags & BFL_FEM) - pa_gain = 0x10; - tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; - tab.tbl_width = 32; - tab.tbl_len = 1; - tab.tbl_ptr = &val; - - for (j = 0; j < 128; j++) { - gm_gain = gain_table[j].gm; - val = (((u32) pa_gain << 24) | - (gain_table[j].pad << 16) | - (gain_table[j].pga << 8) | gm_gain); - - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_GAIN_OFFSET + j; - wlc_lcnphy_write_table(pi, &tab); - - val = (gain_table[j].dac << 28) | (gain_table[j].bb_mult << 20); - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_IQ_OFFSET + j; - wlc_lcnphy_write_table(pi, &tab); - } -} - -static void wlc_lcnphy_load_rfpower(struct brcms_phy *pi) -{ - struct phytbl_info tab; - u32 val, bbmult, rfgain; - u8 index; - u8 scale_factor = 1; - s16 temp, temp1, temp2, qQ, qQ1, qQ2, shift; - - tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; - tab.tbl_width = 32; - tab.tbl_len = 1; - - for (index = 0; index < 128; index++) { - tab.tbl_ptr = &bbmult; - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_IQ_OFFSET + index; - wlc_lcnphy_read_table(pi, &tab); - bbmult = bbmult >> 20; - - tab.tbl_ptr = &rfgain; - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_GAIN_OFFSET + index; - wlc_lcnphy_read_table(pi, &tab); - - qm_log10((s32) (bbmult), 0, &temp1, &qQ1); - qm_log10((s32) (1 << 6), 0, &temp2, &qQ2); - - if (qQ1 < qQ2) { - temp2 = qm_shr16(temp2, qQ2 - qQ1); - qQ = qQ1; - } else { - temp1 = qm_shr16(temp1, qQ1 - qQ2); - qQ = qQ2; - } - temp = qm_sub16(temp1, temp2); - - if (qQ >= 4) - shift = qQ - 4; - else - shift = 4 - qQ; - - val = (((index << shift) + (5 * temp) + - (1 << (scale_factor + shift - 3))) >> (scale_factor + - shift - 2)); - - tab.tbl_ptr = &val; - tab.tbl_offset = LCNPHY_TX_PWR_CTRL_PWR_OFFSET + index; - wlc_lcnphy_write_table(pi, &tab); - } -} - -static void wlc_lcnphy_bu_tweaks(struct brcms_phy *pi) -{ - or_phy_reg(pi, 0x805, 0x1); - - mod_phy_reg(pi, 0x42f, (0x7 << 0), (0x3) << 0); - - mod_phy_reg(pi, 0x030, (0x7 << 0), (0x3) << 0); - - write_phy_reg(pi, 0x414, 0x1e10); - write_phy_reg(pi, 0x415, 0x0640); - - mod_phy_reg(pi, 0x4df, (0xff << 8), -9 << 8); - - or_phy_reg(pi, 0x44a, 0x44); - write_phy_reg(pi, 0x44a, 0x80); - mod_phy_reg(pi, 0x434, (0xff << 0), (0xFD) << 0); - - mod_phy_reg(pi, 0x420, (0xff << 0), (16) << 0); - - if (!(pi->sh->boardrev < 0x1204)) - mod_radio_reg(pi, RADIO_2064_REG09B, 0xF0, 0xF0); - - write_phy_reg(pi, 0x7d6, 0x0902); - mod_phy_reg(pi, 0x429, (0xf << 0), (0x9) << 0); - - mod_phy_reg(pi, 0x429, (0x3f << 4), (0xe) << 4); - - if (LCNREV_IS(pi->pubpi.phy_rev, 1)) { - mod_phy_reg(pi, 0x423, (0xff << 0), (0x46) << 0); - - mod_phy_reg(pi, 0x411, (0xff << 0), (1) << 0); - - mod_phy_reg(pi, 0x434, (0xff << 0), (0xFF) << 0); - - mod_phy_reg(pi, 0x656, (0xf << 0), (2) << 0); - - mod_phy_reg(pi, 0x44d, (0x1 << 2), (1) << 2); - - mod_radio_reg(pi, RADIO_2064_REG0F7, 0x4, 0x4); - mod_radio_reg(pi, RADIO_2064_REG0F1, 0x3, 0); - mod_radio_reg(pi, RADIO_2064_REG0F2, 0xF8, 0x90); - mod_radio_reg(pi, RADIO_2064_REG0F3, 0x3, 0x2); - mod_radio_reg(pi, RADIO_2064_REG0F3, 0xf0, 0xa0); - - mod_radio_reg(pi, RADIO_2064_REG11F, 0x2, 0x2); - - wlc_lcnphy_clear_tx_power_offsets(pi); - mod_phy_reg(pi, 0x4d0, (0x1ff << 6), (10) << 6); - - } -} - -static void wlc_lcnphy_rcal(struct brcms_phy *pi) -{ - u8 rcal_value; - - and_radio_reg(pi, RADIO_2064_REG05B, 0xfD); - - or_radio_reg(pi, RADIO_2064_REG004, 0x40); - or_radio_reg(pi, RADIO_2064_REG120, 0x10); - - or_radio_reg(pi, RADIO_2064_REG078, 0x80); - or_radio_reg(pi, RADIO_2064_REG129, 0x02); - - or_radio_reg(pi, RADIO_2064_REG057, 0x01); - - or_radio_reg(pi, RADIO_2064_REG05B, 0x02); - mdelay(5); - SPINWAIT(!wlc_radio_2064_rcal_done(pi), 10 * 1000 * 1000); - - if (wlc_radio_2064_rcal_done(pi)) { - rcal_value = (u8) read_radio_reg(pi, RADIO_2064_REG05C); - rcal_value = rcal_value & 0x1f; - } - - and_radio_reg(pi, RADIO_2064_REG05B, 0xfD); - - and_radio_reg(pi, RADIO_2064_REG057, 0xFE); -} - -static void wlc_lcnphy_rc_cal(struct brcms_phy *pi) -{ - u8 dflt_rc_cal_val; - u16 flt_val; - - dflt_rc_cal_val = 7; - if (LCNREV_IS(pi->pubpi.phy_rev, 1)) - dflt_rc_cal_val = 11; - flt_val = - (dflt_rc_cal_val << 10) | (dflt_rc_cal_val << 5) | - (dflt_rc_cal_val); - write_phy_reg(pi, 0x933, flt_val); - write_phy_reg(pi, 0x934, flt_val); - write_phy_reg(pi, 0x935, flt_val); - write_phy_reg(pi, 0x936, flt_val); - write_phy_reg(pi, 0x937, (flt_val & 0x1FF)); - - return; -} - -static void wlc_radio_2064_init(struct brcms_phy *pi) -{ - u32 i; - const struct lcnphy_radio_regs *lcnphyregs = NULL; - - lcnphyregs = lcnphy_radio_regs_2064; - - for (i = 0; lcnphyregs[i].address != 0xffff; i++) - if (CHSPEC_IS5G(pi->radio_chanspec) && lcnphyregs[i].do_init_a) - write_radio_reg(pi, - ((lcnphyregs[i].address & 0x3fff) | - RADIO_DEFAULT_CORE), - (u16) lcnphyregs[i].init_a); - else if (lcnphyregs[i].do_init_g) - write_radio_reg(pi, - ((lcnphyregs[i].address & 0x3fff) | - RADIO_DEFAULT_CORE), - (u16) lcnphyregs[i].init_g); - - write_radio_reg(pi, RADIO_2064_REG032, 0x62); - write_radio_reg(pi, RADIO_2064_REG033, 0x19); - - write_radio_reg(pi, RADIO_2064_REG090, 0x10); - - write_radio_reg(pi, RADIO_2064_REG010, 0x00); - - if (LCNREV_IS(pi->pubpi.phy_rev, 1)) { - - write_radio_reg(pi, RADIO_2064_REG060, 0x7f); - write_radio_reg(pi, RADIO_2064_REG061, 0x72); - write_radio_reg(pi, RADIO_2064_REG062, 0x7f); - } - - write_radio_reg(pi, RADIO_2064_REG01D, 0x02); - write_radio_reg(pi, RADIO_2064_REG01E, 0x06); - - mod_phy_reg(pi, 0x4ea, (0x7 << 0), 0 << 0); - - mod_phy_reg(pi, 0x4ea, (0x7 << 3), 1 << 3); - - mod_phy_reg(pi, 0x4ea, (0x7 << 6), 2 << 6); - - mod_phy_reg(pi, 0x4ea, (0x7 << 9), 3 << 9); - - mod_phy_reg(pi, 0x4ea, (0x7 << 12), 4 << 12); - - write_phy_reg(pi, 0x4ea, 0x4688); - - mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0); - - mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6); - - mod_phy_reg(pi, 0x46a, (0xffff << 0), 25 << 0); - - wlc_lcnphy_set_tx_locc(pi, 0); - - wlc_lcnphy_rcal(pi); - - wlc_lcnphy_rc_cal(pi); -} - -static void wlc_lcnphy_radio_init(struct brcms_phy *pi) -{ - wlc_radio_2064_init(pi); -} - -static void wlc_lcnphy_tbl_init(struct brcms_phy *pi) -{ - uint idx; - u8 phybw40; - struct phytbl_info tab; - u32 val; - - phybw40 = CHSPEC_IS40(pi->radio_chanspec); - - for (idx = 0; idx < dot11lcnphytbl_info_sz_rev0; idx++) - wlc_lcnphy_write_table(pi, &dot11lcnphytbl_info_rev0[idx]); - - if (pi->sh->boardflags & BFL_FEM_BT) { - tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; - tab.tbl_width = 16; - tab.tbl_ptr = &val; - tab.tbl_len = 1; - val = 100; - tab.tbl_offset = 4; - wlc_lcnphy_write_table(pi, &tab); - } - - tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; - tab.tbl_width = 16; - tab.tbl_ptr = &val; - tab.tbl_len = 1; - - val = 114; - tab.tbl_offset = 0; - wlc_lcnphy_write_table(pi, &tab); - - val = 130; - tab.tbl_offset = 1; - wlc_lcnphy_write_table(pi, &tab); - - val = 6; - tab.tbl_offset = 8; - wlc_lcnphy_write_table(pi, &tab); - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if (pi->sh->boardflags & BFL_FEM) - wlc_lcnphy_load_tx_gain_table( - pi, - dot11lcnphy_2GHz_extPA_gaintable_rev0); - else - wlc_lcnphy_load_tx_gain_table( - pi, - dot11lcnphy_2GHz_gaintable_rev0); - } - - if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { - const struct phytbl_info *tb; - int l; - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - l = dot11lcnphytbl_rx_gain_info_2G_rev2_sz; - if (pi->sh->boardflags & BFL_EXTLNA) - tb = dot11lcnphytbl_rx_gain_info_extlna_2G_rev2; - else - tb = dot11lcnphytbl_rx_gain_info_2G_rev2; - } else { - l = dot11lcnphytbl_rx_gain_info_5G_rev2_sz; - if (pi->sh->boardflags & BFL_EXTLNA_5GHz) - tb = dot11lcnphytbl_rx_gain_info_extlna_5G_rev2; - else - tb = dot11lcnphytbl_rx_gain_info_5G_rev2; - } - - for (idx = 0; idx < l; idx++) - wlc_lcnphy_write_table(pi, &tb[idx]); - } - - if ((pi->sh->boardflags & BFL_FEM) - && !(pi->sh->boardflags & BFL_FEM_BT)) - wlc_lcnphy_write_table(pi, &dot11lcn_sw_ctrl_tbl_info_4313_epa); - else if (pi->sh->boardflags & BFL_FEM_BT) { - if (pi->sh->boardrev < 0x1250) - wlc_lcnphy_write_table( - pi, - &dot11lcn_sw_ctrl_tbl_info_4313_bt_epa); - else - wlc_lcnphy_write_table( - pi, - &dot11lcn_sw_ctrl_tbl_info_4313_bt_epa_p250); - } else - wlc_lcnphy_write_table(pi, &dot11lcn_sw_ctrl_tbl_info_4313); - - wlc_lcnphy_load_rfpower(pi); - - wlc_lcnphy_clear_papd_comptable(pi); -} - -static void wlc_lcnphy_rev0_baseband_init(struct brcms_phy *pi) -{ - u16 afectrl1; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - write_radio_reg(pi, RADIO_2064_REG11C, 0x0); - - write_phy_reg(pi, 0x43b, 0x0); - write_phy_reg(pi, 0x43c, 0x0); - write_phy_reg(pi, 0x44c, 0x0); - write_phy_reg(pi, 0x4e6, 0x0); - write_phy_reg(pi, 0x4f9, 0x0); - write_phy_reg(pi, 0x4b0, 0x0); - write_phy_reg(pi, 0x938, 0x0); - write_phy_reg(pi, 0x4b0, 0x0); - write_phy_reg(pi, 0x44e, 0); - - or_phy_reg(pi, 0x567, 0x03); - - or_phy_reg(pi, 0x44a, 0x44); - write_phy_reg(pi, 0x44a, 0x80); - - if (!(pi->sh->boardflags & BFL_FEM)) - wlc_lcnphy_set_tx_pwr_by_index(pi, 52); - - if (0) { - afectrl1 = 0; - afectrl1 = (u16) ((pi_lcn->lcnphy_rssi_vf) | - (pi_lcn->lcnphy_rssi_vc << 4) | - (pi_lcn->lcnphy_rssi_gs << 10)); - write_phy_reg(pi, 0x43e, afectrl1); - } - - mod_phy_reg(pi, 0x634, (0xff << 0), 0xC << 0); - if (pi->sh->boardflags & BFL_FEM) { - mod_phy_reg(pi, 0x634, (0xff << 0), 0xA << 0); - - write_phy_reg(pi, 0x910, 0x1); - } - - mod_phy_reg(pi, 0x448, (0x3 << 8), 1 << 8); - mod_phy_reg(pi, 0x608, (0xff << 0), 0x17 << 0); - mod_phy_reg(pi, 0x604, (0x7ff << 0), 0x3EA << 0); - -} - -static void wlc_lcnphy_rev2_baseband_init(struct brcms_phy *pi) -{ - if (CHSPEC_IS5G(pi->radio_chanspec)) { - mod_phy_reg(pi, 0x416, (0xff << 0), 80 << 0); - mod_phy_reg(pi, 0x416, (0xff << 8), 80 << 8); - } -} - -static void wlc_lcnphy_agc_temp_init(struct brcms_phy *pi) -{ - s16 temp; - struct phytbl_info tab; - u32 tableBuffer[2]; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - temp = (s16) read_phy_reg(pi, 0x4df); - pi_lcn->lcnphy_ofdmgainidxtableoffset = (temp & (0xff << 0)) >> 0; - - if (pi_lcn->lcnphy_ofdmgainidxtableoffset > 127) - pi_lcn->lcnphy_ofdmgainidxtableoffset -= 256; - - pi_lcn->lcnphy_dsssgainidxtableoffset = (temp & (0xff << 8)) >> 8; - - if (pi_lcn->lcnphy_dsssgainidxtableoffset > 127) - pi_lcn->lcnphy_dsssgainidxtableoffset -= 256; - - tab.tbl_ptr = tableBuffer; - tab.tbl_len = 2; - tab.tbl_id = 17; - tab.tbl_offset = 59; - tab.tbl_width = 32; - wlc_lcnphy_read_table(pi, &tab); - - if (tableBuffer[0] > 63) - tableBuffer[0] -= 128; - pi_lcn->lcnphy_tr_R_gain_val = tableBuffer[0]; - - if (tableBuffer[1] > 63) - tableBuffer[1] -= 128; - pi_lcn->lcnphy_tr_T_gain_val = tableBuffer[1]; - - temp = (s16) (read_phy_reg(pi, 0x434) & (0xff << 0)); - if (temp > 127) - temp -= 256; - pi_lcn->lcnphy_input_pwr_offset_db = (s8) temp; - - pi_lcn->lcnphy_Med_Low_Gain_db = - (read_phy_reg(pi, 0x424) & (0xff << 8)) >> 8; - pi_lcn->lcnphy_Very_Low_Gain_db = - (read_phy_reg(pi, 0x425) & (0xff << 0)) >> 0; - - tab.tbl_ptr = tableBuffer; - tab.tbl_len = 2; - tab.tbl_id = LCNPHY_TBL_ID_GAIN_IDX; - tab.tbl_offset = 28; - tab.tbl_width = 32; - wlc_lcnphy_read_table(pi, &tab); - - pi_lcn->lcnphy_gain_idx_14_lowword = tableBuffer[0]; - pi_lcn->lcnphy_gain_idx_14_hiword = tableBuffer[1]; - -} - -static void wlc_lcnphy_baseband_init(struct brcms_phy *pi) -{ - - wlc_lcnphy_tbl_init(pi); - wlc_lcnphy_rev0_baseband_init(pi); - if (LCNREV_IS(pi->pubpi.phy_rev, 2)) - wlc_lcnphy_rev2_baseband_init(pi); - wlc_lcnphy_bu_tweaks(pi); -} - -void wlc_phy_init_lcnphy(struct brcms_phy *pi) -{ - u8 phybw40; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - phybw40 = CHSPEC_IS40(pi->radio_chanspec); - - pi_lcn->lcnphy_cal_counter = 0; - pi_lcn->lcnphy_cal_temper = pi_lcn->lcnphy_rawtempsense; - - or_phy_reg(pi, 0x44a, 0x80); - and_phy_reg(pi, 0x44a, 0x7f); - - wlc_lcnphy_afe_clk_init(pi, AFE_CLK_INIT_MODE_TXRX2X); - - write_phy_reg(pi, 0x60a, 160); - - write_phy_reg(pi, 0x46a, 25); - - wlc_lcnphy_baseband_init(pi); - - wlc_lcnphy_radio_init(pi); - - if (CHSPEC_IS2G(pi->radio_chanspec)) - wlc_lcnphy_tx_pwr_ctrl_init((struct brcms_phy_pub *) pi); - - wlc_phy_chanspec_set((struct brcms_phy_pub *) pi, pi->radio_chanspec); - - bcma_chipco_regctl_maskset(&pi->d11core->bus->drv_cc, 0, ~0xf, 0x9); - - bcma_chipco_chipctl_maskset(&pi->d11core->bus->drv_cc, 0, 0x0, - 0x03CDDDDD); - - if ((pi->sh->boardflags & BFL_FEM) - && wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) - wlc_lcnphy_set_tx_pwr_by_index(pi, FIXED_TXPWR); - - wlc_lcnphy_agc_temp_init(pi); - - wlc_lcnphy_temp_adj(pi); - - mod_phy_reg(pi, 0x448, (0x1 << 14), (1) << 14); - - udelay(100); - mod_phy_reg(pi, 0x448, (0x1 << 14), (0) << 14); - - wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_HW); - pi_lcn->lcnphy_noise_samples = LCNPHY_NOISE_SAMPLES_DEFAULT; - wlc_lcnphy_calib_modes(pi, PHY_PERICAL_PHYINIT); -} - -static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi) -{ - s8 txpwr = 0; - int i; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - struct ssb_sprom *sprom = &pi->d11core->bus->sprom; - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - u16 cckpo = 0; - u32 offset_ofdm, offset_mcs; - - pi_lcn->lcnphy_tr_isolation_mid = sprom->fem.ghz2.tr_iso; - - pi_lcn->lcnphy_rx_power_offset = sprom->rxpo2g; - - pi->txpa_2g[0] = sprom->pa0b0; - pi->txpa_2g[1] = sprom->pa0b1; - pi->txpa_2g[2] = sprom->pa0b2; - - pi_lcn->lcnphy_rssi_vf = sprom->rssismf2g; - pi_lcn->lcnphy_rssi_vc = sprom->rssismc2g; - pi_lcn->lcnphy_rssi_gs = sprom->rssisav2g; - - pi_lcn->lcnphy_rssi_vf_lowtemp = pi_lcn->lcnphy_rssi_vf; - pi_lcn->lcnphy_rssi_vc_lowtemp = pi_lcn->lcnphy_rssi_vc; - pi_lcn->lcnphy_rssi_gs_lowtemp = pi_lcn->lcnphy_rssi_gs; - - pi_lcn->lcnphy_rssi_vf_hightemp = pi_lcn->lcnphy_rssi_vf; - pi_lcn->lcnphy_rssi_vc_hightemp = pi_lcn->lcnphy_rssi_vc; - pi_lcn->lcnphy_rssi_gs_hightemp = pi_lcn->lcnphy_rssi_gs; - - txpwr = sprom->core_pwr_info[0].maxpwr_2g; - pi->tx_srom_max_2g = txpwr; - - for (i = 0; i < PWRTBL_NUM_COEFF; i++) { - pi->txpa_2g_low_temp[i] = pi->txpa_2g[i]; - pi->txpa_2g_high_temp[i] = pi->txpa_2g[i]; - } - - cckpo = sprom->cck2gpo; - offset_ofdm = sprom->ofdm2gpo; - if (cckpo) { - uint max_pwr_chan = txpwr; - - for (i = TXP_FIRST_CCK; i <= TXP_LAST_CCK; i++) { - pi->tx_srom_max_rate_2g[i] = - max_pwr_chan - ((cckpo & 0xf) * 2); - cckpo >>= 4; - } - - for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) { - pi->tx_srom_max_rate_2g[i] = - max_pwr_chan - - ((offset_ofdm & 0xf) * 2); - offset_ofdm >>= 4; - } - } else { - u8 opo = 0; - - opo = sprom->opo; - - for (i = TXP_FIRST_CCK; i <= TXP_LAST_CCK; i++) - pi->tx_srom_max_rate_2g[i] = txpwr; - - for (i = TXP_FIRST_OFDM; i <= TXP_LAST_OFDM; i++) { - pi->tx_srom_max_rate_2g[i] = txpwr - - ((offset_ofdm & 0xf) * 2); - offset_ofdm >>= 4; - } - offset_mcs = sprom->mcs2gpo[1] << 16; - offset_mcs |= sprom->mcs2gpo[0]; - pi_lcn->lcnphy_mcs20_po = offset_mcs; - for (i = TXP_FIRST_SISO_MCS_20; - i <= TXP_LAST_SISO_MCS_20; i++) { - pi->tx_srom_max_rate_2g[i] = - txpwr - ((offset_mcs & 0xf) * 2); - offset_mcs >>= 4; - } - } - - pi_lcn->lcnphy_rawtempsense = sprom->rawtempsense; - pi_lcn->lcnphy_measPower = sprom->measpower; - pi_lcn->lcnphy_tempsense_slope = sprom->tempsense_slope; - pi_lcn->lcnphy_hw_iqcal_en = sprom->hw_iqcal_en; - pi_lcn->lcnphy_iqcal_swp_dis = sprom->iqcal_swp_dis; - pi_lcn->lcnphy_tempcorrx = sprom->tempcorrx; - pi_lcn->lcnphy_tempsense_option = sprom->tempsense_option; - pi_lcn->lcnphy_freqoffset_corr = sprom->freqoffset_corr; - if (sprom->ant_available_bg > 1) - wlc_phy_ant_rxdiv_set((struct brcms_phy_pub *) pi, - sprom->ant_available_bg); - } - pi_lcn->lcnphy_cck_dig_filt_type = -1; - - return true; -} - -void wlc_2064_vco_cal(struct brcms_phy *pi) -{ - u8 calnrst; - - mod_radio_reg(pi, RADIO_2064_REG057, 1 << 3, 1 << 3); - calnrst = (u8) read_radio_reg(pi, RADIO_2064_REG056) & 0xf8; - write_radio_reg(pi, RADIO_2064_REG056, calnrst); - udelay(1); - write_radio_reg(pi, RADIO_2064_REG056, calnrst | 0x03); - udelay(1); - write_radio_reg(pi, RADIO_2064_REG056, calnrst | 0x07); - udelay(300); - mod_radio_reg(pi, RADIO_2064_REG057, 1 << 3, 0); -} - -bool wlc_phy_tpc_isenabled_lcnphy(struct brcms_phy *pi) -{ - if (wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) - return 0; - else - return (LCNPHY_TX_PWR_CTRL_HW == - wlc_lcnphy_get_tx_pwr_ctrl((pi))); -} - -void wlc_phy_txpower_recalc_target_lcnphy(struct brcms_phy *pi) -{ - u16 pwr_ctrl; - if (wlc_lcnphy_tempsense_based_pwr_ctrl_enabled(pi)) { - wlc_lcnphy_calib_modes(pi, LCNPHY_PERICAL_TEMPBASED_TXPWRCTRL); - } else if (wlc_lcnphy_tssi_based_pwr_ctrl_enabled(pi)) { - pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); - wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); - wlc_lcnphy_txpower_recalc_target(pi); - wlc_lcnphy_set_tx_pwr_ctrl(pi, pwr_ctrl); - } -} - -void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, u16 chanspec) -{ - u8 channel = CHSPEC_CHANNEL(chanspec); - - wlc_phy_chanspec_radio_set((struct brcms_phy_pub *)pi, chanspec); - - wlc_lcnphy_set_chanspec_tweaks(pi, pi->radio_chanspec); - - or_phy_reg(pi, 0x44a, 0x44); - write_phy_reg(pi, 0x44a, 0x80); - - wlc_lcnphy_radio_2064_channel_tune_4313(pi, channel); - udelay(1000); - - wlc_lcnphy_toggle_afe_pwdn(pi); - - write_phy_reg(pi, 0x657, lcnphy_sfo_cfg[channel - 1].ptcentreTs20); - write_phy_reg(pi, 0x658, lcnphy_sfo_cfg[channel - 1].ptcentreFactor); - - if (CHSPEC_CHANNEL(pi->radio_chanspec) == 14) { - mod_phy_reg(pi, 0x448, (0x3 << 8), (2) << 8); - - wlc_lcnphy_load_tx_iir_filter(pi, false, 3); - } else { - mod_phy_reg(pi, 0x448, (0x3 << 8), (1) << 8); - - wlc_lcnphy_load_tx_iir_filter(pi, false, 2); - } - - if (pi->sh->boardflags & BFL_FEM) - wlc_lcnphy_load_tx_iir_filter(pi, true, 0); - else - wlc_lcnphy_load_tx_iir_filter(pi, true, 3); - - mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3); -} - -void wlc_phy_detach_lcnphy(struct brcms_phy *pi) -{ - kfree(pi->u.pi_lcnphy); -} - -bool wlc_phy_attach_lcnphy(struct brcms_phy *pi) -{ - struct brcms_phy_lcnphy *pi_lcn; - - pi->u.pi_lcnphy = kzalloc(sizeof(struct brcms_phy_lcnphy), GFP_ATOMIC); - if (pi->u.pi_lcnphy == NULL) - return false; - - pi_lcn = pi->u.pi_lcnphy; - - if (0 == (pi->sh->boardflags & BFL_NOPA)) { - pi->hwpwrctrl = true; - pi->hwpwrctrl_capable = true; - } - - pi->xtalfreq = bcma_chipco_get_alp_clock(&pi->d11core->bus->drv_cc); - pi_lcn->lcnphy_papd_rxGnCtrl_init = 0; - - pi->pi_fptr.init = wlc_phy_init_lcnphy; - pi->pi_fptr.calinit = wlc_phy_cal_init_lcnphy; - pi->pi_fptr.chanset = wlc_phy_chanspec_set_lcnphy; - pi->pi_fptr.txpwrrecalc = wlc_phy_txpower_recalc_target_lcnphy; - pi->pi_fptr.txiqccget = wlc_lcnphy_get_tx_iqcc; - pi->pi_fptr.txiqccset = wlc_lcnphy_set_tx_iqcc; - pi->pi_fptr.txloccget = wlc_lcnphy_get_tx_locc; - pi->pi_fptr.radioloftget = wlc_lcnphy_get_radio_loft; - pi->pi_fptr.detach = wlc_phy_detach_lcnphy; - - if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) - return false; - - if ((pi->sh->boardflags & BFL_FEM) && - (LCNREV_IS(pi->pubpi.phy_rev, 1))) { - if (pi_lcn->lcnphy_tempsense_option == 3) { - pi->hwpwrctrl = true; - pi->hwpwrctrl_capable = true; - pi->temppwrctrl_capable = false; - } else { - pi->hwpwrctrl = false; - pi->hwpwrctrl_capable = false; - pi->temppwrctrl_capable = true; - } - } - - return true; -} - -static void wlc_lcnphy_set_rx_gain(struct brcms_phy *pi, u32 gain) -{ - u16 trsw, ext_lna, lna1, lna2, tia, biq0, biq1, gain0_15, gain16_19; - - trsw = (gain & ((u32) 1 << 28)) ? 0 : 1; - ext_lna = (u16) (gain >> 29) & 0x01; - lna1 = (u16) (gain >> 0) & 0x0f; - lna2 = (u16) (gain >> 4) & 0x0f; - tia = (u16) (gain >> 8) & 0xf; - biq0 = (u16) (gain >> 12) & 0xf; - biq1 = (u16) (gain >> 16) & 0xf; - - gain0_15 = (u16) ((lna1 & 0x3) | ((lna1 & 0x3) << 2) | - ((lna2 & 0x3) << 4) | ((lna2 & 0x3) << 6) | - ((tia & 0xf) << 8) | ((biq0 & 0xf) << 12)); - gain16_19 = biq1; - - mod_phy_reg(pi, 0x44d, (0x1 << 0), trsw << 0); - mod_phy_reg(pi, 0x4b1, (0x1 << 9), ext_lna << 9); - mod_phy_reg(pi, 0x4b1, (0x1 << 10), ext_lna << 10); - mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0); - mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0); - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - mod_phy_reg(pi, 0x4b1, (0x3 << 11), lna1 << 11); - mod_phy_reg(pi, 0x4e6, (0x3 << 3), lna1 << 3); - } - wlc_lcnphy_rx_gain_override_enable(pi, true); -} - -static u32 wlc_lcnphy_get_receive_power(struct brcms_phy *pi, s32 *gain_index) -{ - u32 received_power = 0; - s32 max_index = 0; - u32 gain_code = 0; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - max_index = 36; - if (*gain_index >= 0) - gain_code = lcnphy_23bitgaincode_table[*gain_index]; - - if (-1 == *gain_index) { - *gain_index = 0; - while ((*gain_index <= (s32) max_index) - && (received_power < 700)) { - wlc_lcnphy_set_rx_gain(pi, - lcnphy_23bitgaincode_table - [*gain_index]); - received_power = - wlc_lcnphy_measure_digital_power( - pi, - pi_lcn-> - lcnphy_noise_samples); - (*gain_index)++; - } - (*gain_index)--; - } else { - wlc_lcnphy_set_rx_gain(pi, gain_code); - received_power = - wlc_lcnphy_measure_digital_power(pi, - pi_lcn-> - lcnphy_noise_samples); - } - - return received_power; -} - -s32 wlc_lcnphy_rx_signal_power(struct brcms_phy *pi, s32 gain_index) -{ - s32 gain = 0; - s32 nominal_power_db; - s32 log_val, gain_mismatch, desired_gain, input_power_offset_db, - input_power_db; - s32 received_power, temperature; - u32 power; - u32 msb1, msb2, val1, val2, diff1, diff2; - uint freq; - struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy; - - received_power = wlc_lcnphy_get_receive_power(pi, &gain_index); - - gain = lcnphy_gain_table[gain_index]; - - nominal_power_db = read_phy_reg(pi, 0x425) >> 8; - - power = (received_power * 16); - msb1 = ffs(power) - 1; - msb2 = msb1 + 1; - val1 = 1 << msb1; - val2 = 1 << msb2; - diff1 = (power - val1); - diff2 = (val2 - power); - if (diff1 < diff2) - log_val = msb1; - else - log_val = msb2; - - log_val = log_val * 3; - - gain_mismatch = (nominal_power_db / 2) - (log_val); - - desired_gain = gain + gain_mismatch; - - input_power_offset_db = read_phy_reg(pi, 0x434) & 0xFF; - - if (input_power_offset_db > 127) - input_power_offset_db -= 256; - - input_power_db = input_power_offset_db - desired_gain; - - input_power_db = - input_power_db + lcnphy_gain_index_offset_for_rssi[gain_index]; - - freq = wlc_phy_channel2freq(CHSPEC_CHANNEL(pi->radio_chanspec)); - if ((freq > 2427) && (freq <= 2467)) - input_power_db = input_power_db - 1; - - temperature = pi_lcn->lcnphy_lastsensed_temperature; - - if ((temperature - 15) < -30) - input_power_db = - input_power_db + - (((temperature - 10 - 25) * 286) >> 12) - - 7; - else if ((temperature - 15) < 4) - input_power_db = - input_power_db + - (((temperature - 10 - 25) * 286) >> 12) - - 3; - else - input_power_db = input_power_db + - (((temperature - 10 - 25) * 286) >> 12); - - wlc_lcnphy_rx_gain_override_enable(pi, 0); - - return input_power_db; -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.h b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.h deleted file mode 100644 index f4a8ab09da43..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_PHY_LCN_H_ -#define _BRCM_PHY_LCN_H_ - -#include - -struct brcms_phy_lcnphy { - int lcnphy_txrf_sp_9_override; - u8 lcnphy_full_cal_channel; - u8 lcnphy_cal_counter; - u16 lcnphy_cal_temper; - bool lcnphy_recal; - - u8 lcnphy_rc_cap; - u32 lcnphy_mcs20_po; - - u8 lcnphy_tr_isolation_mid; - u8 lcnphy_tr_isolation_low; - u8 lcnphy_tr_isolation_hi; - - u8 lcnphy_bx_arch; - u8 lcnphy_rx_power_offset; - u8 lcnphy_rssi_vf; - u8 lcnphy_rssi_vc; - u8 lcnphy_rssi_gs; - u8 lcnphy_tssi_val; - u8 lcnphy_rssi_vf_lowtemp; - u8 lcnphy_rssi_vc_lowtemp; - u8 lcnphy_rssi_gs_lowtemp; - - u8 lcnphy_rssi_vf_hightemp; - u8 lcnphy_rssi_vc_hightemp; - u8 lcnphy_rssi_gs_hightemp; - - s16 lcnphy_pa0b0; - s16 lcnphy_pa0b1; - s16 lcnphy_pa0b2; - - u16 lcnphy_rawtempsense; - u8 lcnphy_measPower; - u8 lcnphy_tempsense_slope; - u8 lcnphy_freqoffset_corr; - u8 lcnphy_tempsense_option; - u8 lcnphy_tempcorrx; - bool lcnphy_iqcal_swp_dis; - bool lcnphy_hw_iqcal_en; - uint lcnphy_bandedge_corr; - bool lcnphy_spurmod; - u16 lcnphy_tssi_tx_cnt; - u16 lcnphy_tssi_idx; - u16 lcnphy_tssi_npt; - - u16 lcnphy_target_tx_freq; - s8 lcnphy_tx_power_idx_override; - u16 lcnphy_noise_samples; - - u32 lcnphy_papdRxGnIdx; - u32 lcnphy_papd_rxGnCtrl_init; - - u32 lcnphy_gain_idx_14_lowword; - u32 lcnphy_gain_idx_14_hiword; - u32 lcnphy_gain_idx_27_lowword; - u32 lcnphy_gain_idx_27_hiword; - s16 lcnphy_ofdmgainidxtableoffset; - s16 lcnphy_dsssgainidxtableoffset; - u32 lcnphy_tr_R_gain_val; - u32 lcnphy_tr_T_gain_val; - s8 lcnphy_input_pwr_offset_db; - u16 lcnphy_Med_Low_Gain_db; - u16 lcnphy_Very_Low_Gain_db; - s8 lcnphy_lastsensed_temperature; - s8 lcnphy_pkteng_rssi_slope; - u8 lcnphy_saved_tx_user_target[TXP_NUM_RATES]; - u8 lcnphy_volt_winner; - u8 lcnphy_volt_low; - u8 lcnphy_54_48_36_24mbps_backoff; - u8 lcnphy_11n_backoff; - u8 lcnphy_lowerofdm; - u8 lcnphy_cck; - u8 lcnphy_psat_2pt3_detected; - s32 lcnphy_lowest_Re_div_Im; - s8 lcnphy_final_papd_cal_idx; - u16 lcnphy_extstxctrl4; - u16 lcnphy_extstxctrl0; - u16 lcnphy_extstxctrl1; - s16 lcnphy_cck_dig_filt_type; - s16 lcnphy_ofdm_dig_filt_type; - struct lcnphy_cal_results lcnphy_cal_results; - - u8 lcnphy_psat_pwr; - u8 lcnphy_psat_indx; - s32 lcnphy_min_phase; - u8 lcnphy_final_idx; - u8 lcnphy_start_idx; - u8 lcnphy_current_index; - u16 lcnphy_logen_buf_1; - u16 lcnphy_local_ovr_2; - u16 lcnphy_local_oval_6; - u16 lcnphy_local_oval_5; - u16 lcnphy_logen_mixer_1; - - u8 lcnphy_aci_stat; - uint lcnphy_aci_start_time; - s8 lcnphy_tx_power_offset[TXP_NUM_RATES]; -}; -#endif /* _BRCM_PHY_LCN_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c deleted file mode 100644 index 3e9f5b25be63..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c +++ /dev/null @@ -1,28729 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include "phy_int.h" -#include "phy_hal.h" -#include "phy_radio.h" -#include "phyreg_n.h" -#include "phytbl_n.h" -#include "soc.h" - -#define READ_RADIO_REG2(pi, radio_type, jspace, core, reg_name) \ - read_radio_reg(pi, radio_type##_##jspace##_##reg_name | \ - ((core == PHY_CORE_0) ? \ - radio_type##_##jspace##0 : \ - radio_type##_##jspace##1)) - -#define WRITE_RADIO_REG2(pi, radio_type, jspace, core, reg_name, value) \ - write_radio_reg(pi, radio_type##_##jspace##_##reg_name | \ - ((core == PHY_CORE_0) ? \ - radio_type##_##jspace##0 : \ - radio_type##_##jspace##1), value) - -#define WRITE_RADIO_SYN(pi, radio_type, reg_name, value) \ - write_radio_reg(pi, radio_type##_##SYN##_##reg_name, value) - -#define READ_RADIO_REG3(pi, radio_type, jspace, core, reg_name) \ - read_radio_reg(pi, ((core == PHY_CORE_0) ? \ - radio_type##_##jspace##0##_##reg_name : \ - radio_type##_##jspace##1##_##reg_name)) - -#define WRITE_RADIO_REG3(pi, radio_type, jspace, core, reg_name, value) \ - write_radio_reg(pi, ((core == PHY_CORE_0) ? \ - radio_type##_##jspace##0##_##reg_name : \ - radio_type##_##jspace##1##_##reg_name), \ - value) - -#define READ_RADIO_REG4(pi, radio_type, jspace, core, reg_name) \ - read_radio_reg(pi, ((core == PHY_CORE_0) ? \ - radio_type##_##reg_name##_##jspace##0 : \ - radio_type##_##reg_name##_##jspace##1)) - -#define WRITE_RADIO_REG4(pi, radio_type, jspace, core, reg_name, value) \ - write_radio_reg(pi, ((core == PHY_CORE_0) ? \ - radio_type##_##reg_name##_##jspace##0 : \ - radio_type##_##reg_name##_##jspace##1), \ - value) - -#define NPHY_ACI_MAX_UNDETECT_WINDOW_SZ 40 -#define NPHY_ACI_CHANNEL_DELTA 5 -#define NPHY_ACI_CHANNEL_SKIP 4 -#define NPHY_ACI_40MHZ_CHANNEL_DELTA 6 -#define NPHY_ACI_40MHZ_CHANNEL_SKIP 5 -#define NPHY_ACI_40MHZ_CHANNEL_DELTA_GE_REV3 6 -#define NPHY_ACI_40MHZ_CHANNEL_SKIP_GE_REV3 5 -#define NPHY_ACI_CHANNEL_DELTA_GE_REV3 4 -#define NPHY_ACI_CHANNEL_SKIP_GE_REV3 3 - -#define NPHY_NOISE_NOASSOC_GLITCH_TH_UP 2 - -#define NPHY_NOISE_NOASSOC_GLITCH_TH_DN 8 - -#define NPHY_NOISE_ASSOC_GLITCH_TH_UP 2 - -#define NPHY_NOISE_ASSOC_GLITCH_TH_DN 8 - -#define NPHY_NOISE_ASSOC_ACI_GLITCH_TH_UP 2 - -#define NPHY_NOISE_ASSOC_ACI_GLITCH_TH_DN 8 - -#define NPHY_NOISE_NOASSOC_ENTER_TH 400 - -#define NPHY_NOISE_ASSOC_ENTER_TH 400 - -#define NPHY_NOISE_ASSOC_RX_GLITCH_BADPLCP_ENTER_TH 400 - -#define NPHY_NOISE_CRSMINPWR_ARRAY_MAX_INDEX 44 -#define NPHY_NOISE_CRSMINPWR_ARRAY_MAX_INDEX_REV_7 56 - -#define NPHY_NOISE_NOASSOC_CRSIDX_INCR 16 - -#define NPHY_NOISE_ASSOC_CRSIDX_INCR 8 - -#define NPHY_IS_SROM_REINTERPRET NREV_GE(pi->pubpi.phy_rev, 5) - -#define NPHY_RSSICAL_MAXREAD 31 - -#define NPHY_RSSICAL_NPOLL 8 -#define NPHY_RSSICAL_MAXD (1<<20) -#define NPHY_MIN_RXIQ_PWR 2 - -#define NPHY_RSSICAL_W1_TARGET 25 -#define NPHY_RSSICAL_W2_TARGET NPHY_RSSICAL_W1_TARGET -#define NPHY_RSSICAL_NB_TARGET 0 - -#define NPHY_RSSICAL_W1_TARGET_REV3 29 -#define NPHY_RSSICAL_W2_TARGET_REV3 NPHY_RSSICAL_W1_TARGET_REV3 - -#define NPHY_CALSANITY_RSSI_NB_MAX_POS 9 -#define NPHY_CALSANITY_RSSI_NB_MAX_NEG -9 -#define NPHY_CALSANITY_RSSI_W1_MAX_POS 12 -#define NPHY_CALSANITY_RSSI_W1_MAX_NEG (NPHY_RSSICAL_W1_TARGET - \ - NPHY_RSSICAL_MAXREAD) -#define NPHY_CALSANITY_RSSI_W2_MAX_POS NPHY_CALSANITY_RSSI_W1_MAX_POS -#define NPHY_CALSANITY_RSSI_W2_MAX_NEG (NPHY_RSSICAL_W2_TARGET - \ - NPHY_RSSICAL_MAXREAD) -#define NPHY_RSSI_SXT(x) ((s8) (-((x) & 0x20) + ((x) & 0x1f))) -#define NPHY_RSSI_NB_VIOL(x) (((x) > NPHY_CALSANITY_RSSI_NB_MAX_POS) || \ - ((x) < NPHY_CALSANITY_RSSI_NB_MAX_NEG)) -#define NPHY_RSSI_W1_VIOL(x) (((x) > NPHY_CALSANITY_RSSI_W1_MAX_POS) || \ - ((x) < NPHY_CALSANITY_RSSI_W1_MAX_NEG)) -#define NPHY_RSSI_W2_VIOL(x) (((x) > NPHY_CALSANITY_RSSI_W2_MAX_POS) || \ - ((x) < NPHY_CALSANITY_RSSI_W2_MAX_NEG)) - -#define NPHY_IQCAL_NUMGAINS 9 -#define NPHY_N_GCTL 0x66 - -#define NPHY_PAPD_EPS_TBL_SIZE 64 -#define NPHY_PAPD_SCL_TBL_SIZE 64 -#define NPHY_NUM_DIG_FILT_COEFFS 15 - -#define NPHY_PAPD_COMP_OFF 0 -#define NPHY_PAPD_COMP_ON 1 - -#define NPHY_SROM_TEMPSHIFT 32 -#define NPHY_SROM_MAXTEMPOFFSET 16 -#define NPHY_SROM_MINTEMPOFFSET -16 - -#define NPHY_CAL_MAXTEMPDELTA 64 - -#define NPHY_NOISEVAR_TBLLEN40 256 -#define NPHY_NOISEVAR_TBLLEN20 128 - -#define NPHY_ANARXLPFBW_REDUCTIONFACT 7 - -#define NPHY_ADJUSTED_MINCRSPOWER 0x1e - -/* 5357 Chip specific ChipControl register bits */ -#define CCTRL5357_EXTPA (1<<14) /* extPA in ChipControl 1, bit 14 */ -#define CCTRL5357_ANT_MUX_2o3 (1<<15) /* 2o3 in ChipControl 1, bit 15 */ - -#define NPHY_CAL_TSSISAMPS 64 -#define NPHY_TEST_TONE_FREQ_40MHz 4000 -#define NPHY_TEST_TONE_FREQ_20MHz 2500 - -#define MAX_205x_RCAL_WAITLOOPS 10000 - -#define NPHY_RXCAL_TONEAMP 181 -#define NPHY_RXCAL_TONEFREQ_40MHz 4000 -#define NPHY_RXCAL_TONEFREQ_20MHz 2000 - -#define TXFILT_SHAPING_OFDM20 0 -#define TXFILT_SHAPING_OFDM40 1 -#define TXFILT_SHAPING_CCK 2 -#define TXFILT_DEFAULT_OFDM20 3 -#define TXFILT_DEFAULT_OFDM40 4 - -struct nphy_iqcal_params { - u16 txlpf; - u16 txgm; - u16 pga; - u16 pad; - u16 ipa; - u16 cal_gain; - u16 ncorr[5]; -}; - -struct nphy_txiqcal_ladder { - u8 percent; - u8 g_env; -}; - -struct nphy_ipa_txcalgains { - struct nphy_txgains gains; - bool useindex; - u8 index; -}; - -struct nphy_papd_restore_state { - u16 fbmix[2]; - u16 vga_master[2]; - u16 intpa_master[2]; - u16 afectrl[2]; - u16 afeoverride[2]; - u16 pwrup[2]; - u16 atten[2]; - u16 mm; -}; - -struct nphy_ipa_txrxgain { - u16 hpvga; - u16 lpf_biq1; - u16 lpf_biq0; - u16 lna2; - u16 lna1; - s8 txpwrindex; -}; - -#define NPHY_IPA_RXCAL_MAXGAININDEX (6 - 1) - -static const struct nphy_ipa_txrxgain nphy_ipa_rxcal_gaintbl_5GHz[] = { - {0, 0, 0, 0, 0, 100}, - {0, 0, 0, 0, 0, 50}, - {0, 0, 0, 0, 0, -1}, - {0, 0, 0, 3, 0, -1}, - {0, 0, 3, 3, 0, -1}, - {0, 2, 3, 3, 0, -1} -}; - -static const struct nphy_ipa_txrxgain nphy_ipa_rxcal_gaintbl_2GHz[] = { - {0, 0, 0, 0, 0, 128}, - {0, 0, 0, 0, 0, 70}, - {0, 0, 0, 0, 0, 20}, - {0, 0, 0, 3, 0, 20}, - {0, 0, 3, 3, 0, 20}, - {0, 2, 3, 3, 0, 20} -}; - -static const struct nphy_ipa_txrxgain nphy_ipa_rxcal_gaintbl_5GHz_rev7[] = { - {0, 0, 0, 0, 0, 100}, - {0, 0, 0, 0, 0, 50}, - {0, 0, 0, 0, 0, -1}, - {0, 0, 0, 3, 0, -1}, - {0, 0, 3, 3, 0, -1}, - {0, 0, 5, 3, 0, -1} -}; - -static const struct nphy_ipa_txrxgain nphy_ipa_rxcal_gaintbl_2GHz_rev7[] = { - {0, 0, 0, 0, 0, 10}, - {0, 0, 0, 1, 0, 10}, - {0, 0, 1, 2, 0, 10}, - {0, 0, 1, 3, 0, 10}, - {0, 0, 4, 3, 0, 10}, - {0, 0, 6, 3, 0, 10} -}; - -enum { - NPHY_RXCAL_GAIN_INIT = 0, - NPHY_RXCAL_GAIN_UP, - NPHY_RXCAL_GAIN_DOWN -}; - -#define wlc_phy_get_papd_nphy(pi) \ - (read_phy_reg((pi), 0x1e7) & \ - ((0x1 << 15) | \ - (0x1 << 14) | \ - (0x1 << 13))) - -static const u16 NPHY_IPA_REV4_txdigi_filtcoeffs[][NPHY_NUM_DIG_FILT_COEFFS] = { - {-377, 137, -407, 208, -1527, 956, 93, 186, 93, - 230, -44, 230, 201, -191, 201}, - {-77, 20, -98, 49, -93, 60, 56, 111, 56, 26, -5, - 26, 34, -32, 34}, - {-360, 164, -376, 164, -1533, 576, 308, -314, 308, - 121, -73, 121, 91, 124, 91}, - {-295, 200, -363, 142, -1391, 826, 151, 301, 151, - 151, 301, 151, 602, -752, 602}, - {-92, 58, -96, 49, -104, 44, 17, 35, 17, - 12, 25, 12, 13, 27, 13}, - {-375, 136, -399, 209, -1479, 949, 130, 260, 130, - 230, -44, 230, 201, -191, 201}, - {0xed9, 0xc8, 0xe95, 0x8e, 0xa91, 0x33a, 0x97, 0x12d, 0x97, - 0x97, 0x12d, 0x97, 0x25a, 0xd10, 0x25a} -}; - -struct chan_info_nphy_2055 { - u16 chan; - u16 freq; - uint unknown; - u8 RF_pll_ref; - u8 RF_rf_pll_mod1; - u8 RF_rf_pll_mod0; - u8 RF_vco_cap_tail; - u8 RF_vco_cal1; - u8 RF_vco_cal2; - u8 RF_pll_lf_c1; - u8 RF_pll_lf_r1; - u8 RF_pll_lf_c2; - u8 RF_lgbuf_cen_buf; - u8 RF_lgen_tune1; - u8 RF_lgen_tune2; - u8 RF_core1_lgbuf_a_tune; - u8 RF_core1_lgbuf_g_tune; - u8 RF_core1_rxrf_reg1; - u8 RF_core1_tx_pga_pad_tn; - u8 RF_core1_tx_mx_bgtrim; - u8 RF_core2_lgbuf_a_tune; - u8 RF_core2_lgbuf_g_tune; - u8 RF_core2_rxrf_reg1; - u8 RF_core2_tx_pga_pad_tn; - u8 RF_core2_tx_mx_bgtrim; - u16 PHY_BW1a; - u16 PHY_BW2; - u16 PHY_BW3; - u16 PHY_BW4; - u16 PHY_BW5; - u16 PHY_BW6; -}; - -struct chan_info_nphy_radio205x { - u16 chan; - u16 freq; - u8 RF_SYN_pll_vcocal1; - u8 RF_SYN_pll_vcocal2; - u8 RF_SYN_pll_refdiv; - u8 RF_SYN_pll_mmd2; - u8 RF_SYN_pll_mmd1; - u8 RF_SYN_pll_loopfilter1; - u8 RF_SYN_pll_loopfilter2; - u8 RF_SYN_pll_loopfilter3; - u8 RF_SYN_pll_loopfilter4; - u8 RF_SYN_pll_loopfilter5; - u8 RF_SYN_reserved_addr27; - u8 RF_SYN_reserved_addr28; - u8 RF_SYN_reserved_addr29; - u8 RF_SYN_logen_VCOBUF1; - u8 RF_SYN_logen_MIXER2; - u8 RF_SYN_logen_BUF3; - u8 RF_SYN_logen_BUF4; - u8 RF_RX0_lnaa_tune; - u8 RF_RX0_lnag_tune; - u8 RF_TX0_intpaa_boost_tune; - u8 RF_TX0_intpag_boost_tune; - u8 RF_TX0_pada_boost_tune; - u8 RF_TX0_padg_boost_tune; - u8 RF_TX0_pgaa_boost_tune; - u8 RF_TX0_pgag_boost_tune; - u8 RF_TX0_mixa_boost_tune; - u8 RF_TX0_mixg_boost_tune; - u8 RF_RX1_lnaa_tune; - u8 RF_RX1_lnag_tune; - u8 RF_TX1_intpaa_boost_tune; - u8 RF_TX1_intpag_boost_tune; - u8 RF_TX1_pada_boost_tune; - u8 RF_TX1_padg_boost_tune; - u8 RF_TX1_pgaa_boost_tune; - u8 RF_TX1_pgag_boost_tune; - u8 RF_TX1_mixa_boost_tune; - u8 RF_TX1_mixg_boost_tune; - u16 PHY_BW1a; - u16 PHY_BW2; - u16 PHY_BW3; - u16 PHY_BW4; - u16 PHY_BW5; - u16 PHY_BW6; -}; - -struct chan_info_nphy_radio2057 { - u16 chan; - u16 freq; - u8 RF_vcocal_countval0; - u8 RF_vcocal_countval1; - u8 RF_rfpll_refmaster_sparextalsize; - u8 RF_rfpll_loopfilter_r1; - u8 RF_rfpll_loopfilter_c2; - u8 RF_rfpll_loopfilter_c1; - u8 RF_cp_kpd_idac; - u8 RF_rfpll_mmd0; - u8 RF_rfpll_mmd1; - u8 RF_vcobuf_tune; - u8 RF_logen_mx2g_tune; - u8 RF_logen_mx5g_tune; - u8 RF_logen_indbuf2g_tune; - u8 RF_logen_indbuf5g_tune; - u8 RF_txmix2g_tune_boost_pu_core0; - u8 RF_pad2g_tune_pus_core0; - u8 RF_pga_boost_tune_core0; - u8 RF_txmix5g_boost_tune_core0; - u8 RF_pad5g_tune_misc_pus_core0; - u8 RF_lna2g_tune_core0; - u8 RF_lna5g_tune_core0; - u8 RF_txmix2g_tune_boost_pu_core1; - u8 RF_pad2g_tune_pus_core1; - u8 RF_pga_boost_tune_core1; - u8 RF_txmix5g_boost_tune_core1; - u8 RF_pad5g_tune_misc_pus_core1; - u8 RF_lna2g_tune_core1; - u8 RF_lna5g_tune_core1; - u16 PHY_BW1a; - u16 PHY_BW2; - u16 PHY_BW3; - u16 PHY_BW4; - u16 PHY_BW5; - u16 PHY_BW6; -}; - -struct chan_info_nphy_radio2057_rev5 { - u16 chan; - u16 freq; - u8 RF_vcocal_countval0; - u8 RF_vcocal_countval1; - u8 RF_rfpll_refmaster_sparextalsize; - u8 RF_rfpll_loopfilter_r1; - u8 RF_rfpll_loopfilter_c2; - u8 RF_rfpll_loopfilter_c1; - u8 RF_cp_kpd_idac; - u8 RF_rfpll_mmd0; - u8 RF_rfpll_mmd1; - u8 RF_vcobuf_tune; - u8 RF_logen_mx2g_tune; - u8 RF_logen_indbuf2g_tune; - u8 RF_txmix2g_tune_boost_pu_core0; - u8 RF_pad2g_tune_pus_core0; - u8 RF_lna2g_tune_core0; - u8 RF_txmix2g_tune_boost_pu_core1; - u8 RF_pad2g_tune_pus_core1; - u8 RF_lna2g_tune_core1; - u16 PHY_BW1a; - u16 PHY_BW2; - u16 PHY_BW3; - u16 PHY_BW4; - u16 PHY_BW5; - u16 PHY_BW6; -}; - -struct nphy_sfo_cfg { - u16 PHY_BW1a; - u16 PHY_BW2; - u16 PHY_BW3; - u16 PHY_BW4; - u16 PHY_BW5; - u16 PHY_BW6; -}; - -static const struct chan_info_nphy_2055 chan_info_nphy_2055[] = { - { - 184, 4920, 3280, 0x71, 0x01, 0xEC, 0x0F, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F, - 0x0F, 0x8F, 0x7B4, 0x7B0, 0x7AC, 0x214, 0x215, 0x216}, - { - 186, 4930, 3287, 0x71, 0x01, 0xED, 0x0F, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F, - 0x0F, 0x8F, 0x7B8, 0x7B4, 0x7B0, 0x213, 0x214, 0x215}, - { - 188, 4940, 3293, 0x71, 0x01, 0xEE, 0x0F, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F, - 0x0F, 0x8F, 0x7BC, 0x7B8, 0x7B4, 0x212, 0x213, 0x214}, - { - 190, 4950, 3300, 0x71, 0x01, 0xEF, 0x0F, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F, - 0x0F, 0x8F, 0x7C0, 0x7BC, 0x7B8, 0x211, 0x212, 0x213}, - { - 192, 4960, 3307, 0x71, 0x01, 0xF0, 0x0F, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F, - 0x0F, 0x8F, 0x7C4, 0x7C0, 0x7BC, 0x20F, 0x211, 0x212}, - { - 194, 4970, 3313, 0x71, 0x01, 0xF1, 0x0F, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F, - 0x0F, 0x8F, 0x7C8, 0x7C4, 0x7C0, 0x20E, 0x20F, 0x211}, - { - 196, 4980, 3320, 0x71, 0x01, 0xF2, 0x0E, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F, - 0x0F, 0x8F, 0x7CC, 0x7C8, 0x7C4, 0x20D, 0x20E, 0x20F}, - { - 198, 4990, 3327, 0x71, 0x01, 0xF3, 0x0E, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F, - 0x0F, 0x8F, 0x7D0, 0x7CC, 0x7C8, 0x20C, 0x20D, 0x20E}, - { - 200, 5000, 3333, 0x71, 0x01, 0xF4, 0x0E, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F, - 0x0F, 0x8F, 0x7D4, 0x7D0, 0x7CC, 0x20B, 0x20C, 0x20D}, - { - 202, 5010, 3340, 0x71, 0x01, 0xF5, 0x0E, 0xFF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F, - 0x0F, 0x8F, 0x7D8, 0x7D4, 0x7D0, 0x20A, 0x20B, 0x20C}, - { - 204, 5020, 3347, 0x71, 0x01, 0xF6, 0x0E, 0xF7, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F, - 0x0F, 0x8F, 0x7DC, 0x7D8, 0x7D4, 0x209, 0x20A, 0x20B}, - { - 206, 5030, 3353, 0x71, 0x01, 0xF7, 0x0E, 0xF7, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F, - 0x0F, 0x8F, 0x7E0, 0x7DC, 0x7D8, 0x208, 0x209, 0x20A}, - { - 208, 5040, 3360, 0x71, 0x01, 0xF8, 0x0D, 0xEF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F, - 0x0F, 0x8F, 0x7E4, 0x7E0, 0x7DC, 0x207, 0x208, 0x209}, - { - 210, 5050, 3367, 0x71, 0x01, 0xF9, 0x0D, 0xEF, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, 0x8F, 0xFF, 0x00, 0x0F, - 0x0F, 0x8F, 0x7E8, 0x7E4, 0x7E0, 0x206, 0x207, 0x208}, - { - 212, 5060, 3373, 0x71, 0x01, 0xFA, 0x0D, 0xE6, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xBB, 0xBB, 0xFF, 0x00, 0x0E, 0x0F, 0x8E, 0xFF, 0x00, 0x0E, - 0x0F, 0x8E, 0x7EC, 0x7E8, 0x7E4, 0x205, 0x206, 0x207}, - { - 214, 5070, 3380, 0x71, 0x01, 0xFB, 0x0D, 0xE6, 0x01, 0x04, 0x0A, - 0x00, 0x8F, 0xBB, 0xBB, 0xFF, 0x00, 0x0E, 0x0F, 0x8E, 0xFF, 0x00, 0x0E, - 0x0F, 0x8E, 0x7F0, 0x7EC, 0x7E8, 0x204, 0x205, 0x206}, - { - 216, 5080, 3387, 0x71, 0x01, 0xFC, 0x0D, 0xDE, 0x01, 0x04, 0x0A, - 0x00, 0x8E, 0xBB, 0xBB, 0xEE, 0x00, 0x0E, 0x0F, 0x8D, 0xEE, 0x00, 0x0E, - 0x0F, 0x8D, 0x7F4, 0x7F0, 0x7EC, 0x203, 0x204, 0x205}, - { - 218, 5090, 3393, 0x71, 0x01, 0xFD, 0x0D, 0xDE, 0x01, 0x04, 0x0A, - 0x00, 0x8E, 0xBB, 0xBB, 0xEE, 0x00, 0x0E, 0x0F, 0x8D, 0xEE, 0x00, 0x0E, - 0x0F, 0x8D, 0x7F8, 0x7F4, 0x7F0, 0x202, 0x203, 0x204}, - { - 220, 5100, 3400, 0x71, 0x01, 0xFE, 0x0C, 0xD6, 0x01, 0x04, 0x0A, - 0x00, 0x8E, 0xAA, 0xAA, 0xEE, 0x00, 0x0D, 0x0F, 0x8D, 0xEE, 0x00, 0x0D, - 0x0F, 0x8D, 0x7FC, 0x7F8, 0x7F4, 0x201, 0x202, 0x203}, - { - 222, 5110, 3407, 0x71, 0x01, 0xFF, 0x0C, 0xD6, 0x01, 0x04, 0x0A, - 0x00, 0x8E, 0xAA, 0xAA, 0xEE, 0x00, 0x0D, 0x0F, 0x8D, 0xEE, 0x00, 0x0D, - 0x0F, 0x8D, 0x800, 0x7FC, 0x7F8, 0x200, 0x201, 0x202}, - { - 224, 5120, 3413, 0x71, 0x02, 0x00, 0x0C, 0xCE, 0x01, 0x04, 0x0A, - 0x00, 0x8D, 0xAA, 0xAA, 0xDD, 0x00, 0x0D, 0x0F, 0x8C, 0xDD, 0x00, 0x0D, - 0x0F, 0x8C, 0x804, 0x800, 0x7FC, 0x1FF, 0x200, 0x201}, - { - 226, 5130, 3420, 0x71, 0x02, 0x01, 0x0C, 0xCE, 0x01, 0x04, 0x0A, - 0x00, 0x8D, 0xAA, 0xAA, 0xDD, 0x00, 0x0D, 0x0F, 0x8C, 0xDD, 0x00, 0x0D, - 0x0F, 0x8C, 0x808, 0x804, 0x800, 0x1FE, 0x1FF, 0x200}, - { - 228, 5140, 3427, 0x71, 0x02, 0x02, 0x0C, 0xC6, 0x01, 0x04, 0x0A, - 0x00, 0x8D, 0x99, 0x99, 0xDD, 0x00, 0x0C, 0x0E, 0x8B, 0xDD, 0x00, 0x0C, - 0x0E, 0x8B, 0x80C, 0x808, 0x804, 0x1FD, 0x1FE, 0x1FF}, - { - 32, 5160, 3440, 0x71, 0x02, 0x04, 0x0B, 0xBE, 0x01, 0x04, 0x0A, - 0x00, 0x8C, 0x99, 0x99, 0xCC, 0x00, 0x0B, 0x0D, 0x8A, 0xCC, 0x00, 0x0B, - 0x0D, 0x8A, 0x814, 0x810, 0x80C, 0x1FB, 0x1FC, 0x1FD}, - { - 34, 5170, 3447, 0x71, 0x02, 0x05, 0x0B, 0xBE, 0x01, 0x04, 0x0A, - 0x00, 0x8C, 0x99, 0x99, 0xCC, 0x00, 0x0B, 0x0D, 0x8A, 0xCC, 0x00, 0x0B, - 0x0D, 0x8A, 0x818, 0x814, 0x810, 0x1FA, 0x1FB, 0x1FC}, - { - 36, 5180, 3453, 0x71, 0x02, 0x06, 0x0B, 0xB6, 0x01, 0x04, 0x0A, - 0x00, 0x8C, 0x88, 0x88, 0xCC, 0x00, 0x0B, 0x0C, 0x89, 0xCC, 0x00, 0x0B, - 0x0C, 0x89, 0x81C, 0x818, 0x814, 0x1F9, 0x1FA, 0x1FB}, - { - 38, 5190, 3460, 0x71, 0x02, 0x07, 0x0B, 0xB6, 0x01, 0x04, 0x0A, - 0x00, 0x8C, 0x88, 0x88, 0xCC, 0x00, 0x0B, 0x0C, 0x89, 0xCC, 0x00, 0x0B, - 0x0C, 0x89, 0x820, 0x81C, 0x818, 0x1F8, 0x1F9, 0x1FA}, - { - 40, 5200, 3467, 0x71, 0x02, 0x08, 0x0B, 0xAF, 0x01, 0x04, 0x0A, - 0x00, 0x8B, 0x88, 0x88, 0xBB, 0x00, 0x0A, 0x0B, 0x89, 0xBB, 0x00, 0x0A, - 0x0B, 0x89, 0x824, 0x820, 0x81C, 0x1F7, 0x1F8, 0x1F9}, - { - 42, 5210, 3473, 0x71, 0x02, 0x09, 0x0B, 0xAF, 0x01, 0x04, 0x0A, - 0x00, 0x8B, 0x88, 0x88, 0xBB, 0x00, 0x0A, 0x0B, 0x89, 0xBB, 0x00, 0x0A, - 0x0B, 0x89, 0x828, 0x824, 0x820, 0x1F6, 0x1F7, 0x1F8}, - { - 44, 5220, 3480, 0x71, 0x02, 0x0A, 0x0A, 0xA7, 0x01, 0x04, 0x0A, - 0x00, 0x8B, 0x77, 0x77, 0xBB, 0x00, 0x09, 0x0A, 0x88, 0xBB, 0x00, 0x09, - 0x0A, 0x88, 0x82C, 0x828, 0x824, 0x1F5, 0x1F6, 0x1F7}, - { - 46, 5230, 3487, 0x71, 0x02, 0x0B, 0x0A, 0xA7, 0x01, 0x04, 0x0A, - 0x00, 0x8B, 0x77, 0x77, 0xBB, 0x00, 0x09, 0x0A, 0x88, 0xBB, 0x00, 0x09, - 0x0A, 0x88, 0x830, 0x82C, 0x828, 0x1F4, 0x1F5, 0x1F6}, - { - 48, 5240, 3493, 0x71, 0x02, 0x0C, 0x0A, 0xA0, 0x01, 0x04, 0x0A, - 0x00, 0x8A, 0x77, 0x77, 0xAA, 0x00, 0x09, 0x0A, 0x87, 0xAA, 0x00, 0x09, - 0x0A, 0x87, 0x834, 0x830, 0x82C, 0x1F3, 0x1F4, 0x1F5}, - { - 50, 5250, 3500, 0x71, 0x02, 0x0D, 0x0A, 0xA0, 0x01, 0x04, 0x0A, - 0x00, 0x8A, 0x77, 0x77, 0xAA, 0x00, 0x09, 0x0A, 0x87, 0xAA, 0x00, 0x09, - 0x0A, 0x87, 0x838, 0x834, 0x830, 0x1F2, 0x1F3, 0x1F4}, - { - 52, 5260, 3507, 0x71, 0x02, 0x0E, 0x0A, 0x98, 0x01, 0x04, 0x0A, - 0x00, 0x8A, 0x66, 0x66, 0xAA, 0x00, 0x08, 0x09, 0x87, 0xAA, 0x00, 0x08, - 0x09, 0x87, 0x83C, 0x838, 0x834, 0x1F1, 0x1F2, 0x1F3}, - { - 54, 5270, 3513, 0x71, 0x02, 0x0F, 0x0A, 0x98, 0x01, 0x04, 0x0A, - 0x00, 0x8A, 0x66, 0x66, 0xAA, 0x00, 0x08, 0x09, 0x87, 0xAA, 0x00, 0x08, - 0x09, 0x87, 0x840, 0x83C, 0x838, 0x1F0, 0x1F1, 0x1F2}, - { - 56, 5280, 3520, 0x71, 0x02, 0x10, 0x09, 0x91, 0x01, 0x04, 0x0A, - 0x00, 0x89, 0x66, 0x66, 0x99, 0x00, 0x08, 0x08, 0x86, 0x99, 0x00, 0x08, - 0x08, 0x86, 0x844, 0x840, 0x83C, 0x1F0, 0x1F0, 0x1F1}, - { - 58, 5290, 3527, 0x71, 0x02, 0x11, 0x09, 0x91, 0x01, 0x04, 0x0A, - 0x00, 0x89, 0x66, 0x66, 0x99, 0x00, 0x08, 0x08, 0x86, 0x99, 0x00, 0x08, - 0x08, 0x86, 0x848, 0x844, 0x840, 0x1EF, 0x1F0, 0x1F0}, - { - 60, 5300, 3533, 0x71, 0x02, 0x12, 0x09, 0x8A, 0x01, 0x04, 0x0A, - 0x00, 0x89, 0x55, 0x55, 0x99, 0x00, 0x08, 0x07, 0x85, 0x99, 0x00, 0x08, - 0x07, 0x85, 0x84C, 0x848, 0x844, 0x1EE, 0x1EF, 0x1F0}, - { - 62, 5310, 3540, 0x71, 0x02, 0x13, 0x09, 0x8A, 0x01, 0x04, 0x0A, - 0x00, 0x89, 0x55, 0x55, 0x99, 0x00, 0x08, 0x07, 0x85, 0x99, 0x00, 0x08, - 0x07, 0x85, 0x850, 0x84C, 0x848, 0x1ED, 0x1EE, 0x1EF}, - { - 64, 5320, 3547, 0x71, 0x02, 0x14, 0x09, 0x83, 0x01, 0x04, 0x0A, - 0x00, 0x88, 0x55, 0x55, 0x88, 0x00, 0x07, 0x07, 0x84, 0x88, 0x00, 0x07, - 0x07, 0x84, 0x854, 0x850, 0x84C, 0x1EC, 0x1ED, 0x1EE}, - { - 66, 5330, 3553, 0x71, 0x02, 0x15, 0x09, 0x83, 0x01, 0x04, 0x0A, - 0x00, 0x88, 0x55, 0x55, 0x88, 0x00, 0x07, 0x07, 0x84, 0x88, 0x00, 0x07, - 0x07, 0x84, 0x858, 0x854, 0x850, 0x1EB, 0x1EC, 0x1ED}, - { - 68, 5340, 3560, 0x71, 0x02, 0x16, 0x08, 0x7C, 0x01, 0x04, 0x0A, - 0x00, 0x88, 0x44, 0x44, 0x88, 0x00, 0x07, 0x06, 0x84, 0x88, 0x00, 0x07, - 0x06, 0x84, 0x85C, 0x858, 0x854, 0x1EA, 0x1EB, 0x1EC}, - { - 70, 5350, 3567, 0x71, 0x02, 0x17, 0x08, 0x7C, 0x01, 0x04, 0x0A, - 0x00, 0x88, 0x44, 0x44, 0x88, 0x00, 0x07, 0x06, 0x84, 0x88, 0x00, 0x07, - 0x06, 0x84, 0x860, 0x85C, 0x858, 0x1E9, 0x1EA, 0x1EB}, - { - 72, 5360, 3573, 0x71, 0x02, 0x18, 0x08, 0x75, 0x01, 0x04, 0x0A, - 0x00, 0x87, 0x44, 0x44, 0x77, 0x00, 0x06, 0x05, 0x83, 0x77, 0x00, 0x06, - 0x05, 0x83, 0x864, 0x860, 0x85C, 0x1E8, 0x1E9, 0x1EA}, - { - 74, 5370, 3580, 0x71, 0x02, 0x19, 0x08, 0x75, 0x01, 0x04, 0x0A, - 0x00, 0x87, 0x44, 0x44, 0x77, 0x00, 0x06, 0x05, 0x83, 0x77, 0x00, 0x06, - 0x05, 0x83, 0x868, 0x864, 0x860, 0x1E7, 0x1E8, 0x1E9}, - { - 76, 5380, 3587, 0x71, 0x02, 0x1A, 0x08, 0x6E, 0x01, 0x04, 0x0A, - 0x00, 0x87, 0x33, 0x33, 0x77, 0x00, 0x06, 0x04, 0x82, 0x77, 0x00, 0x06, - 0x04, 0x82, 0x86C, 0x868, 0x864, 0x1E6, 0x1E7, 0x1E8}, - { - 78, 5390, 3593, 0x71, 0x02, 0x1B, 0x08, 0x6E, 0x01, 0x04, 0x0A, - 0x00, 0x87, 0x33, 0x33, 0x77, 0x00, 0x06, 0x04, 0x82, 0x77, 0x00, 0x06, - 0x04, 0x82, 0x870, 0x86C, 0x868, 0x1E5, 0x1E6, 0x1E7}, - { - 80, 5400, 3600, 0x71, 0x02, 0x1C, 0x07, 0x67, 0x01, 0x04, 0x0A, - 0x00, 0x86, 0x33, 0x33, 0x66, 0x00, 0x05, 0x04, 0x81, 0x66, 0x00, 0x05, - 0x04, 0x81, 0x874, 0x870, 0x86C, 0x1E5, 0x1E5, 0x1E6}, - { - 82, 5410, 3607, 0x71, 0x02, 0x1D, 0x07, 0x67, 0x01, 0x04, 0x0A, - 0x00, 0x86, 0x33, 0x33, 0x66, 0x00, 0x05, 0x04, 0x81, 0x66, 0x00, 0x05, - 0x04, 0x81, 0x878, 0x874, 0x870, 0x1E4, 0x1E5, 0x1E5}, - { - 84, 5420, 3613, 0x71, 0x02, 0x1E, 0x07, 0x61, 0x01, 0x04, 0x0A, - 0x00, 0x86, 0x22, 0x22, 0x66, 0x00, 0x05, 0x03, 0x80, 0x66, 0x00, 0x05, - 0x03, 0x80, 0x87C, 0x878, 0x874, 0x1E3, 0x1E4, 0x1E5}, - { - 86, 5430, 3620, 0x71, 0x02, 0x1F, 0x07, 0x61, 0x01, 0x04, 0x0A, - 0x00, 0x86, 0x22, 0x22, 0x66, 0x00, 0x05, 0x03, 0x80, 0x66, 0x00, 0x05, - 0x03, 0x80, 0x880, 0x87C, 0x878, 0x1E2, 0x1E3, 0x1E4}, - { - 88, 5440, 3627, 0x71, 0x02, 0x20, 0x07, 0x5A, 0x01, 0x04, 0x0A, - 0x00, 0x85, 0x22, 0x22, 0x55, 0x00, 0x04, 0x02, 0x80, 0x55, 0x00, 0x04, - 0x02, 0x80, 0x884, 0x880, 0x87C, 0x1E1, 0x1E2, 0x1E3}, - { - 90, 5450, 3633, 0x71, 0x02, 0x21, 0x07, 0x5A, 0x01, 0x04, 0x0A, - 0x00, 0x85, 0x22, 0x22, 0x55, 0x00, 0x04, 0x02, 0x80, 0x55, 0x00, 0x04, - 0x02, 0x80, 0x888, 0x884, 0x880, 0x1E0, 0x1E1, 0x1E2}, - { - 92, 5460, 3640, 0x71, 0x02, 0x22, 0x06, 0x53, 0x01, 0x04, 0x0A, - 0x00, 0x85, 0x11, 0x11, 0x55, 0x00, 0x04, 0x01, 0x80, 0x55, 0x00, 0x04, - 0x01, 0x80, 0x88C, 0x888, 0x884, 0x1DF, 0x1E0, 0x1E1}, - { - 94, 5470, 3647, 0x71, 0x02, 0x23, 0x06, 0x53, 0x01, 0x04, 0x0A, - 0x00, 0x85, 0x11, 0x11, 0x55, 0x00, 0x04, 0x01, 0x80, 0x55, 0x00, 0x04, - 0x01, 0x80, 0x890, 0x88C, 0x888, 0x1DE, 0x1DF, 0x1E0}, - { - 96, 5480, 3653, 0x71, 0x02, 0x24, 0x06, 0x4D, 0x01, 0x04, 0x0A, - 0x00, 0x84, 0x11, 0x11, 0x44, 0x00, 0x03, 0x00, 0x80, 0x44, 0x00, 0x03, - 0x00, 0x80, 0x894, 0x890, 0x88C, 0x1DD, 0x1DE, 0x1DF}, - { - 98, 5490, 3660, 0x71, 0x02, 0x25, 0x06, 0x4D, 0x01, 0x04, 0x0A, - 0x00, 0x84, 0x11, 0x11, 0x44, 0x00, 0x03, 0x00, 0x80, 0x44, 0x00, 0x03, - 0x00, 0x80, 0x898, 0x894, 0x890, 0x1DD, 0x1DD, 0x1DE}, - { - 100, 5500, 3667, 0x71, 0x02, 0x26, 0x06, 0x47, 0x01, 0x04, 0x0A, - 0x00, 0x84, 0x00, 0x00, 0x44, 0x00, 0x03, 0x00, 0x80, 0x44, 0x00, 0x03, - 0x00, 0x80, 0x89C, 0x898, 0x894, 0x1DC, 0x1DD, 0x1DD}, - { - 102, 5510, 3673, 0x71, 0x02, 0x27, 0x06, 0x47, 0x01, 0x04, 0x0A, - 0x00, 0x84, 0x00, 0x00, 0x44, 0x00, 0x03, 0x00, 0x80, 0x44, 0x00, 0x03, - 0x00, 0x80, 0x8A0, 0x89C, 0x898, 0x1DB, 0x1DC, 0x1DD}, - { - 104, 5520, 3680, 0x71, 0x02, 0x28, 0x05, 0x40, 0x01, 0x04, 0x0A, - 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, 0x80, 0x33, 0x00, 0x02, - 0x00, 0x80, 0x8A4, 0x8A0, 0x89C, 0x1DA, 0x1DB, 0x1DC}, - { - 106, 5530, 3687, 0x71, 0x02, 0x29, 0x05, 0x40, 0x01, 0x04, 0x0A, - 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, 0x80, 0x33, 0x00, 0x02, - 0x00, 0x80, 0x8A8, 0x8A4, 0x8A0, 0x1D9, 0x1DA, 0x1DB}, - { - 108, 5540, 3693, 0x71, 0x02, 0x2A, 0x05, 0x3A, 0x01, 0x04, 0x0A, - 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, 0x80, 0x33, 0x00, 0x02, - 0x00, 0x80, 0x8AC, 0x8A8, 0x8A4, 0x1D8, 0x1D9, 0x1DA}, - { - 110, 5550, 3700, 0x71, 0x02, 0x2B, 0x05, 0x3A, 0x01, 0x04, 0x0A, - 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, 0x80, 0x33, 0x00, 0x02, - 0x00, 0x80, 0x8B0, 0x8AC, 0x8A8, 0x1D7, 0x1D8, 0x1D9}, - { - 112, 5560, 3707, 0x71, 0x02, 0x2C, 0x05, 0x34, 0x01, 0x04, 0x0A, - 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 0x80, 0x22, 0x00, 0x01, - 0x00, 0x80, 0x8B4, 0x8B0, 0x8AC, 0x1D7, 0x1D7, 0x1D8}, - { - 114, 5570, 3713, 0x71, 0x02, 0x2D, 0x05, 0x34, 0x01, 0x04, 0x0A, - 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 0x80, 0x22, 0x00, 0x01, - 0x00, 0x80, 0x8B8, 0x8B4, 0x8B0, 0x1D6, 0x1D7, 0x1D7}, - { - 116, 5580, 3720, 0x71, 0x02, 0x2E, 0x04, 0x2E, 0x01, 0x04, 0x0A, - 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 0x80, 0x22, 0x00, 0x01, - 0x00, 0x80, 0x8BC, 0x8B8, 0x8B4, 0x1D5, 0x1D6, 0x1D7}, - { - 118, 5590, 3727, 0x71, 0x02, 0x2F, 0x04, 0x2E, 0x01, 0x04, 0x0A, - 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 0x80, 0x22, 0x00, 0x01, - 0x00, 0x80, 0x8C0, 0x8BC, 0x8B8, 0x1D4, 0x1D5, 0x1D6}, - { - 120, 5600, 3733, 0x71, 0x02, 0x30, 0x04, 0x28, 0x01, 0x04, 0x0A, - 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x01, 0x00, 0x80, 0x11, 0x00, 0x01, - 0x00, 0x80, 0x8C4, 0x8C0, 0x8BC, 0x1D3, 0x1D4, 0x1D5}, - { - 122, 5610, 3740, 0x71, 0x02, 0x31, 0x04, 0x28, 0x01, 0x04, 0x0A, - 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x01, 0x00, 0x80, 0x11, 0x00, 0x01, - 0x00, 0x80, 0x8C8, 0x8C4, 0x8C0, 0x1D2, 0x1D3, 0x1D4}, - { - 124, 5620, 3747, 0x71, 0x02, 0x32, 0x04, 0x21, 0x01, 0x04, 0x0A, - 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, - 0x00, 0x80, 0x8CC, 0x8C8, 0x8C4, 0x1D2, 0x1D2, 0x1D3}, - { - 126, 5630, 3753, 0x71, 0x02, 0x33, 0x04, 0x21, 0x01, 0x04, 0x0A, - 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, - 0x00, 0x80, 0x8D0, 0x8CC, 0x8C8, 0x1D1, 0x1D2, 0x1D2}, - { - 128, 5640, 3760, 0x71, 0x02, 0x34, 0x03, 0x1C, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x8D4, 0x8D0, 0x8CC, 0x1D0, 0x1D1, 0x1D2}, - { - 130, 5650, 3767, 0x71, 0x02, 0x35, 0x03, 0x1C, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x8D8, 0x8D4, 0x8D0, 0x1CF, 0x1D0, 0x1D1}, - { - 132, 5660, 3773, 0x71, 0x02, 0x36, 0x03, 0x16, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x8DC, 0x8D8, 0x8D4, 0x1CE, 0x1CF, 0x1D0}, - { - 134, 5670, 3780, 0x71, 0x02, 0x37, 0x03, 0x16, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x8E0, 0x8DC, 0x8D8, 0x1CE, 0x1CE, 0x1CF}, - { - 136, 5680, 3787, 0x71, 0x02, 0x38, 0x03, 0x10, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x8E4, 0x8E0, 0x8DC, 0x1CD, 0x1CE, 0x1CE}, - { - 138, 5690, 3793, 0x71, 0x02, 0x39, 0x03, 0x10, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x8E8, 0x8E4, 0x8E0, 0x1CC, 0x1CD, 0x1CE}, - { - 140, 5700, 3800, 0x71, 0x02, 0x3A, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x8EC, 0x8E8, 0x8E4, 0x1CB, 0x1CC, 0x1CD}, - { - 142, 5710, 3807, 0x71, 0x02, 0x3B, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x8F0, 0x8EC, 0x8E8, 0x1CA, 0x1CB, 0x1CC}, - { - 144, 5720, 3813, 0x71, 0x02, 0x3C, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x8F4, 0x8F0, 0x8EC, 0x1C9, 0x1CA, 0x1CB}, - { - 145, 5725, 3817, 0x72, 0x04, 0x79, 0x02, 0x03, 0x01, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x8F6, 0x8F2, 0x8EE, 0x1C9, 0x1CA, 0x1CB}, - { - 146, 5730, 3820, 0x71, 0x02, 0x3D, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x8F8, 0x8F4, 0x8F0, 0x1C9, 0x1C9, 0x1CA}, - { - 147, 5735, 3823, 0x72, 0x04, 0x7B, 0x02, 0x03, 0x01, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x8FA, 0x8F6, 0x8F2, 0x1C8, 0x1C9, 0x1CA}, - { - 148, 5740, 3827, 0x71, 0x02, 0x3E, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x8FC, 0x8F8, 0x8F4, 0x1C8, 0x1C9, 0x1C9}, - { - 149, 5745, 3830, 0x72, 0x04, 0x7D, 0x02, 0xFE, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x8FE, 0x8FA, 0x8F6, 0x1C8, 0x1C8, 0x1C9}, - { - 150, 5750, 3833, 0x71, 0x02, 0x3F, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x900, 0x8FC, 0x8F8, 0x1C7, 0x1C8, 0x1C9}, - { - 151, 5755, 3837, 0x72, 0x04, 0x7F, 0x02, 0xFE, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x902, 0x8FE, 0x8FA, 0x1C7, 0x1C8, 0x1C8}, - { - 152, 5760, 3840, 0x71, 0x02, 0x40, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x904, 0x900, 0x8FC, 0x1C6, 0x1C7, 0x1C8}, - { - 153, 5765, 3843, 0x72, 0x04, 0x81, 0x02, 0xF8, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x906, 0x902, 0x8FE, 0x1C6, 0x1C7, 0x1C8}, - { - 154, 5770, 3847, 0x71, 0x02, 0x41, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x908, 0x904, 0x900, 0x1C6, 0x1C6, 0x1C7}, - { - 155, 5775, 3850, 0x72, 0x04, 0x83, 0x02, 0xF8, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x90A, 0x906, 0x902, 0x1C5, 0x1C6, 0x1C7}, - { - 156, 5780, 3853, 0x71, 0x02, 0x42, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x90C, 0x908, 0x904, 0x1C5, 0x1C6, 0x1C6}, - { - 157, 5785, 3857, 0x72, 0x04, 0x85, 0x02, 0xF2, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x90E, 0x90A, 0x906, 0x1C4, 0x1C5, 0x1C6}, - { - 158, 5790, 3860, 0x71, 0x02, 0x43, 0x02, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x910, 0x90C, 0x908, 0x1C4, 0x1C5, 0x1C6}, - { - 159, 5795, 3863, 0x72, 0x04, 0x87, 0x02, 0xF2, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x912, 0x90E, 0x90A, 0x1C4, 0x1C4, 0x1C5}, - { - 160, 5800, 3867, 0x71, 0x02, 0x44, 0x01, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x914, 0x910, 0x90C, 0x1C3, 0x1C4, 0x1C5}, - { - 161, 5805, 3870, 0x72, 0x04, 0x89, 0x01, 0xED, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x916, 0x912, 0x90E, 0x1C3, 0x1C4, 0x1C4}, - { - 162, 5810, 3873, 0x71, 0x02, 0x45, 0x01, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x918, 0x914, 0x910, 0x1C2, 0x1C3, 0x1C4}, - { - 163, 5815, 3877, 0x72, 0x04, 0x8B, 0x01, 0xED, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x91A, 0x916, 0x912, 0x1C2, 0x1C3, 0x1C4}, - { - 164, 5820, 3880, 0x71, 0x02, 0x46, 0x01, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x91C, 0x918, 0x914, 0x1C2, 0x1C2, 0x1C3}, - { - 165, 5825, 3883, 0x72, 0x04, 0x8D, 0x01, 0xED, 0x00, 0x03, 0x14, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x91E, 0x91A, 0x916, 0x1C1, 0x1C2, 0x1C3}, - { - 166, 5830, 3887, 0x71, 0x02, 0x47, 0x01, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x920, 0x91C, 0x918, 0x1C1, 0x1C2, 0x1C2}, - { - 168, 5840, 3893, 0x71, 0x02, 0x48, 0x01, 0x0A, 0x01, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x924, 0x920, 0x91C, 0x1C0, 0x1C1, 0x1C2}, - { - 170, 5850, 3900, 0x71, 0x02, 0x49, 0x01, 0xE0, 0x00, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x928, 0x924, 0x920, 0x1BF, 0x1C0, 0x1C1}, - { - 172, 5860, 3907, 0x71, 0x02, 0x4A, 0x01, 0xDE, 0x00, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x92C, 0x928, 0x924, 0x1BF, 0x1BF, 0x1C0}, - { - 174, 5870, 3913, 0x71, 0x02, 0x4B, 0x00, 0xDB, 0x00, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x930, 0x92C, 0x928, 0x1BE, 0x1BF, 0x1BF}, - { - 176, 5880, 3920, 0x71, 0x02, 0x4C, 0x00, 0xD8, 0x00, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x934, 0x930, 0x92C, 0x1BD, 0x1BE, 0x1BF}, - { - 178, 5890, 3927, 0x71, 0x02, 0x4D, 0x00, 0xD6, 0x00, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x938, 0x934, 0x930, 0x1BC, 0x1BD, 0x1BE}, - { - 180, 5900, 3933, 0x71, 0x02, 0x4E, 0x00, 0xD3, 0x00, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x93C, 0x938, 0x934, 0x1BC, 0x1BC, 0x1BD}, - { - 182, 5910, 3940, 0x71, 0x02, 0x4F, 0x00, 0xD6, 0x00, 0x04, 0x0A, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x940, 0x93C, 0x938, 0x1BB, 0x1BC, 0x1BC}, - { - 1, 2412, 3216, 0x73, 0x09, 0x6C, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0D, 0x0C, 0x80, 0xFF, 0x88, 0x0D, - 0x0C, 0x80, 0x3C9, 0x3C5, 0x3C1, 0x43A, 0x43F, 0x443}, - { - 2, 2417, 3223, 0x73, 0x09, 0x71, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0B, 0x80, 0xFF, 0x88, 0x0C, - 0x0B, 0x80, 0x3CB, 0x3C7, 0x3C3, 0x438, 0x43D, 0x441}, - { - 3, 2422, 3229, 0x73, 0x09, 0x76, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0A, 0x80, 0xFF, 0x88, 0x0C, - 0x0A, 0x80, 0x3CD, 0x3C9, 0x3C5, 0x436, 0x43A, 0x43F}, - { - 4, 2427, 3236, 0x73, 0x09, 0x7B, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0A, 0x80, 0xFF, 0x88, 0x0C, - 0x0A, 0x80, 0x3CF, 0x3CB, 0x3C7, 0x434, 0x438, 0x43D}, - { - 5, 2432, 3243, 0x73, 0x09, 0x80, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x09, 0x80, 0xFF, 0x88, 0x0C, - 0x09, 0x80, 0x3D1, 0x3CD, 0x3C9, 0x431, 0x436, 0x43A}, - { - 6, 2437, 3249, 0x73, 0x09, 0x85, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0B, 0x08, 0x80, 0xFF, 0x88, 0x0B, - 0x08, 0x80, 0x3D3, 0x3CF, 0x3CB, 0x42F, 0x434, 0x438}, - { - 7, 2442, 3256, 0x73, 0x09, 0x8A, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0A, 0x07, 0x80, 0xFF, 0x88, 0x0A, - 0x07, 0x80, 0x3D5, 0x3D1, 0x3CD, 0x42D, 0x431, 0x436}, - { - 8, 2447, 3263, 0x73, 0x09, 0x8F, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0A, 0x06, 0x80, 0xFF, 0x88, 0x0A, - 0x06, 0x80, 0x3D7, 0x3D3, 0x3CF, 0x42B, 0x42F, 0x434}, - { - 9, 2452, 3269, 0x73, 0x09, 0x94, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x09, 0x06, 0x80, 0xFF, 0x88, 0x09, - 0x06, 0x80, 0x3D9, 0x3D5, 0x3D1, 0x429, 0x42D, 0x431}, - { - 10, 2457, 3276, 0x73, 0x09, 0x99, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x05, 0x80, 0xFF, 0x88, 0x08, - 0x05, 0x80, 0x3DB, 0x3D7, 0x3D3, 0x427, 0x42B, 0x42F}, - { - 11, 2462, 3283, 0x73, 0x09, 0x9E, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x04, 0x80, 0xFF, 0x88, 0x08, - 0x04, 0x80, 0x3DD, 0x3D9, 0x3D5, 0x424, 0x429, 0x42D}, - { - 12, 2467, 3289, 0x73, 0x09, 0xA3, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x03, 0x80, 0xFF, 0x88, 0x08, - 0x03, 0x80, 0x3DF, 0x3DB, 0x3D7, 0x422, 0x427, 0x42B}, - { - 13, 2472, 3296, 0x73, 0x09, 0xA8, 0x0F, 0x00, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x07, 0x03, 0x80, 0xFF, 0x88, 0x07, - 0x03, 0x80, 0x3E1, 0x3DD, 0x3D9, 0x420, 0x424, 0x429}, - { - 14, 2484, 3312, 0x73, 0x09, 0xB4, 0x0F, 0xFF, 0x01, 0x07, 0x15, - 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x07, 0x01, 0x80, 0xFF, 0x88, 0x07, - 0x01, 0x80, 0x3E6, 0x3E2, 0x3DE, 0x41B, 0x41F, 0x424} -}; - -static const struct chan_info_nphy_radio205x chan_info_nphyrev3_2056[] = { - { - 184, 4920, 0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216}, - { - 186, 4930, 0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215}, - { - 188, 4940, 0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214}, - { - 190, 4950, 0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213}, - { - 192, 4960, 0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212}, - { - 194, 4970, 0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211}, - { - 196, 4980, 0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f}, - { - 198, 4990, 0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e}, - { - 200, 5000, 0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d}, - { - 202, 5010, 0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c}, - { - 204, 5020, 0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b}, - { - 206, 5030, 0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a}, - { - 208, 5040, 0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209}, - { - 210, 5050, 0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208}, - { - 212, 5060, 0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207}, - { - 214, 5070, 0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206}, - { - 216, 5080, 0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205}, - { - 218, 5090, 0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204}, - { - 220, 5100, 0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xff, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xff, 0x00, 0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203}, - { - 222, 5110, 0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202}, - { - 224, 5120, 0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201}, - { - 226, 5130, 0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200}, - { - 228, 5140, 0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff}, - { - 32, 5160, 0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd}, - { - 34, 5170, 0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00, 0xff, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc}, - { - 36, 5180, 0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xef, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00, 0xef, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb}, - { - 38, 5190, 0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xef, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xfc, 0x00, 0xef, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xfc, 0x00, 0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa}, - { - 40, 5200, 0xaf, 0x01, 0x01, 0x02, 0x08, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xef, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00, 0xef, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9}, - { - 42, 5210, 0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xdf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00, 0xdf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8}, - { - 44, 5220, 0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xdf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00, 0xdf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7}, - { - 46, 5230, 0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xdf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00, 0xdf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6}, - { - 48, 5240, 0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xcf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5}, - { - 50, 5250, 0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xcf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4}, - { - 52, 5260, 0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xcf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3}, - { - 54, 5270, 0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, 0xff, 0xcf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2}, - { - 56, 5280, 0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, 0xff, 0xbf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00, 0xbf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1}, - { - 58, 5290, 0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, 0xff, 0xbf, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xfc, 0x00, 0xbf, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xfc, 0x00, 0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0}, - { - 60, 5300, 0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xbf, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfc, 0x00, 0xbf, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfc, 0x00, 0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0}, - { - 62, 5310, 0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xbf, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00, 0xbf, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef}, - { - 64, 5320, 0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xbf, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00, 0xbf, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee}, - { - 66, 5330, 0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xaf, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00, 0xaf, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed}, - { - 68, 5340, 0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xaf, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00, 0xaf, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec}, - { - 70, 5350, 0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0x9f, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb}, - { - 72, 5360, 0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0x9f, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea}, - { - 74, 5370, 0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0x9f, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9}, - { - 76, 5380, 0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0x9f, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8}, - { - 78, 5390, 0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0x8f, 0x00, 0x05, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xfa, 0x00, 0x8f, 0x00, 0x05, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xfa, 0x00, 0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7}, - { - 80, 5400, 0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xc8, 0x8f, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xfa, 0x00, 0x8f, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xfa, 0x00, 0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6}, - { - 82, 5410, 0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xc8, 0x8f, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xfa, 0x00, 0x8f, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xfa, 0x00, 0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5}, - { - 84, 5420, 0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xc8, 0x8e, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xfa, 0x00, 0x8e, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xfa, 0x00, 0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5}, - { - 86, 5430, 0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xc8, 0x8e, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xfa, 0x00, 0x8e, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xfa, 0x00, 0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4}, - { - 88, 5440, 0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x7e, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xfa, 0x00, 0x7e, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xfa, 0x00, 0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3}, - { - 90, 5450, 0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x7d, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xfa, 0x00, 0x7d, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xfa, 0x00, 0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2}, - { - 92, 5460, 0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x6d, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xf8, 0x00, 0x6d, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xf8, 0x00, 0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1}, - { - 94, 5470, 0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x6d, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xf8, 0x00, 0x6d, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xf8, 0x00, 0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0}, - { - 96, 5480, 0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x5d, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xf8, 0x00, 0x5d, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xf8, 0x00, 0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df}, - { - 98, 5490, 0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x5c, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x08, 0x00, 0xf8, 0x00, 0x5c, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x08, - 0x00, 0xf8, 0x00, 0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de}, - { - 100, 5500, 0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x5c, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x5c, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd}, - { - 102, 5510, 0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x4c, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x4c, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd}, - { - 104, 5520, 0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x4c, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x4c, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc}, - { - 106, 5530, 0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x3b, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x3b, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db}, - { - 108, 5540, 0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x3b, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x3b, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da}, - { - 110, 5550, 0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x3b, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x3b, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9}, - { - 112, 5560, 0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x2b, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x2b, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8}, - { - 114, 5570, 0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x2a, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x2a, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7}, - { - 116, 5580, 0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x1a, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x1a, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7}, - { - 118, 5590, 0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x1a, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x1a, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6}, - { - 120, 5600, 0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x1a, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x1a, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5}, - { - 122, 5610, 0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x19, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x19, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4}, - { - 124, 5620, 0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x19, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x19, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3}, - { - 126, 5630, 0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x09, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x09, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2}, - { - 128, 5640, 0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x09, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x09, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2}, - { - 130, 5650, 0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x08, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf8, 0x00, 0x08, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf8, 0x00, 0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1}, - { - 132, 5660, 0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x08, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf6, 0x00, 0x08, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf6, 0x00, 0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0}, - { - 134, 5670, 0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x08, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf6, 0x00, 0x08, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf6, 0x00, 0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf}, - { - 136, 5680, 0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x08, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf6, 0x00, 0x08, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf6, 0x00, 0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce}, - { - 138, 5690, 0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x07, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf6, 0x00, 0x07, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf6, 0x00, 0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce}, - { - 140, 5700, 0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x07, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf6, 0x00, 0x07, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf6, 0x00, 0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd}, - { - 142, 5710, 0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x07, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x07, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc}, - { - 144, 5720, 0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x07, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x07, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb}, - { - 145, 5725, 0x03, 0x01, 0x02, 0x04, 0x79, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x06, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x06, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb}, - { - 146, 5730, 0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x06, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x06, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca}, - { - 147, 5735, 0x03, 0x01, 0x02, 0x04, 0x7b, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x06, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x06, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca}, - { - 148, 5740, 0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x06, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x06, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9}, - { - 149, 5745, 0xfe, 0x00, 0x02, 0x04, 0x7d, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x06, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x06, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9}, - { - 150, 5750, 0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x06, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x06, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9}, - { - 151, 5755, 0xfe, 0x00, 0x02, 0x04, 0x7f, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x05, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x05, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8}, - { - 152, 5760, 0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x05, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x05, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8}, - { - 153, 5765, 0xf8, 0x00, 0x02, 0x04, 0x81, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x05, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x05, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8}, - { - 154, 5770, 0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x05, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x05, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7}, - { - 155, 5775, 0xf8, 0x00, 0x02, 0x04, 0x83, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x05, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x05, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7}, - { - 156, 5780, 0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x05, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x05, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6}, - { - 157, 5785, 0xf2, 0x00, 0x02, 0x04, 0x85, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, 0x40, 0x04, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x04, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6}, - { - 158, 5790, 0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, 0x40, 0x04, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x04, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6}, - { - 159, 5795, 0xf2, 0x00, 0x02, 0x04, 0x87, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, 0x40, 0x04, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x04, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5}, - { - 160, 5800, 0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x04, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5}, - { - 161, 5805, 0xed, 0x00, 0x02, 0x04, 0x89, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x04, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4}, - { - 162, 5810, 0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x04, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4}, - { - 163, 5815, 0xed, 0x00, 0x02, 0x04, 0x8b, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x04, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4}, - { - 164, 5820, 0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x03, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3}, - { - 165, 5825, 0xed, 0x00, 0x02, 0x04, 0x8d, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x03, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3}, - { - 166, 5830, 0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x03, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2}, - { - 168, 5840, 0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x03, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2}, - { - 170, 5850, 0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x03, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf4, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf4, 0x00, 0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1}, - { - 172, 5860, 0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x03, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf2, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf2, 0x00, 0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0}, - { - 174, 5870, 0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf2, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf2, 0x00, 0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf}, - { - 176, 5880, 0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf2, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf2, 0x00, 0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf}, - { - 178, 5890, 0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x06, 0x00, 0xf2, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x06, - 0x00, 0xf2, 0x00, 0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be}, - { - 180, 5900, 0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x87, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x05, 0x00, 0xf2, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x05, - 0x00, 0xf2, 0x00, 0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd}, - { - 182, 5910, 0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x87, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x05, 0x00, 0xf2, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x05, - 0x00, 0xf2, 0x00, 0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc}, - { - 1, 2412, 0x00, 0x01, 0x03, 0x09, 0x6c, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x04, 0x04, 0x04, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xff, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0xff, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443}, - { - 2, 2417, 0x00, 0x01, 0x03, 0x09, 0x71, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xff, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0xff, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441}, - { - 3, 2422, 0x00, 0x01, 0x03, 0x09, 0x76, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xff, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0xff, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f}, - { - 4, 2427, 0x00, 0x01, 0x03, 0x09, 0x7b, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0xfd, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d}, - { - 5, 2432, 0x00, 0x01, 0x03, 0x09, 0x80, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0xfb, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a}, - { - 6, 2437, 0x00, 0x01, 0x03, 0x09, 0x85, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0xfa, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438}, - { - 7, 2442, 0x00, 0x01, 0x03, 0x09, 0x8a, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0xf8, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436}, - { - 8, 2447, 0x00, 0x01, 0x03, 0x09, 0x8f, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0xf7, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434}, - { - 9, 2452, 0x00, 0x01, 0x03, 0x09, 0x94, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0xf6, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0f, 0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431}, - { - 10, 2457, 0x00, 0x01, 0x03, 0x09, 0x99, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0d, 0x00, 0xf5, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0d, 0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f}, - { - 11, 2462, 0x00, 0x01, 0x03, 0x09, 0x9e, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0d, 0x00, 0xf4, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0d, 0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d}, - { - 12, 2467, 0x00, 0x01, 0x03, 0x09, 0xa3, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0d, 0x00, 0xf3, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0d, 0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b}, - { - 13, 2472, 0x00, 0x01, 0x03, 0x09, 0xa8, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf2, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0d, 0x00, 0xf2, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0d, 0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429}, - { - 14, 2484, 0xff, 0x01, 0x03, 0x09, 0xb4, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x05, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0d, 0x00, 0xf0, 0x00, 0x05, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0d, 0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424} -}; - -static const struct chan_info_nphy_radio205x chan_info_nphyrev4_2056_A1[] = { - { - 184, 4920, 0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216}, - { - 186, 4930, 0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215}, - { - 188, 4940, 0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214}, - { - 190, 4950, 0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213}, - { - 192, 4960, 0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212}, - { - 194, 4970, 0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211}, - { - 196, 4980, 0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f}, - { - 198, 4990, 0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0e, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0e, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e}, - { - 200, 5000, 0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d}, - { - 202, 5010, 0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c}, - { - 204, 5020, 0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b}, - { - 206, 5030, 0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a}, - { - 208, 5040, 0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209}, - { - 210, 5050, 0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208}, - { - 212, 5060, 0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207}, - { - 214, 5070, 0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206}, - { - 216, 5080, 0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205}, - { - 218, 5090, 0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0d, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xff, 0x00, 0x0d, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xff, 0x00, 0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204}, - { - 220, 5100, 0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00, 0xff, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203}, - { - 222, 5110, 0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00, 0xff, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202}, - { - 224, 5120, 0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00, 0xff, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201}, - { - 226, 5130, 0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00, 0xff, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200}, - { - 228, 5140, 0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00, 0xff, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff}, - { - 32, 5160, 0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00, 0xff, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd}, - { - 34, 5170, 0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00, 0xff, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc}, - { - 36, 5180, 0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xef, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00, 0xef, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb}, - { - 38, 5190, 0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xef, 0x00, 0x0c, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfe, 0x00, 0xef, 0x00, 0x0c, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfe, 0x00, 0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa}, - { - 40, 5200, 0xaf, 0x01, 0x01, 0x02, 0x08, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xef, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00, 0xef, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9}, - { - 42, 5210, 0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xdf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00, 0xdf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8}, - { - 44, 5220, 0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xdf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00, 0xdf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7}, - { - 46, 5230, 0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xdf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00, 0xdf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6}, - { - 48, 5240, 0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xcf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5}, - { - 50, 5250, 0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xcf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4}, - { - 52, 5260, 0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xcf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3}, - { - 54, 5270, 0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, 0xff, 0xcf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00, 0xcf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2}, - { - 56, 5280, 0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, 0xff, 0xbf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00, 0xbf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1}, - { - 58, 5290, 0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, 0xff, 0xbf, 0x00, 0x0a, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfc, 0x00, 0xbf, 0x00, 0x0a, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfc, 0x00, 0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0}, - { - 60, 5300, 0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xbf, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00, 0xbf, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0}, - { - 62, 5310, 0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xbf, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00, 0xbf, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef}, - { - 64, 5320, 0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xbf, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00, 0xbf, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee}, - { - 66, 5330, 0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xaf, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00, 0xaf, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed}, - { - 68, 5340, 0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xaf, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00, 0xaf, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec}, - { - 70, 5350, 0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0x9f, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb}, - { - 72, 5360, 0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0x9f, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea}, - { - 74, 5370, 0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0x9f, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9}, - { - 76, 5380, 0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0x9f, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00, 0x9f, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8}, - { - 78, 5390, 0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0x8f, 0x00, 0x08, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xfa, 0x00, 0x8f, 0x00, 0x08, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xfa, 0x00, 0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7}, - { - 80, 5400, 0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xc8, 0x8f, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00, 0x8f, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6}, - { - 82, 5410, 0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xc8, 0x8f, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00, 0x8f, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5}, - { - 84, 5420, 0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xc8, 0x8e, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00, 0x8e, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5}, - { - 86, 5430, 0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xc8, 0x8e, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00, 0x8e, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4}, - { - 88, 5440, 0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x7e, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00, 0x7e, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3}, - { - 90, 5450, 0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x7d, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00, 0x7d, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2}, - { - 92, 5460, 0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x6d, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00, 0x6d, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1}, - { - 94, 5470, 0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x6d, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00, 0x6d, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0}, - { - 96, 5480, 0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x5d, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00, 0x5d, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df}, - { - 98, 5490, 0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x5c, 0x00, 0x07, 0x00, 0x7f, - 0x00, 0x0f, 0x00, 0xf8, 0x00, 0x5c, 0x00, 0x07, 0x00, 0x7f, 0x00, 0x0f, - 0x00, 0xf8, 0x00, 0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de}, - { - 100, 5500, 0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x5c, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00, 0x5c, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd}, - { - 102, 5510, 0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x4c, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00, 0x4c, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd}, - { - 104, 5520, 0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x4c, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00, 0x4c, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc}, - { - 106, 5530, 0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x3b, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00, 0x3b, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db}, - { - 108, 5540, 0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x3b, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00, 0x3b, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da}, - { - 110, 5550, 0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x3b, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00, 0x3b, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9}, - { - 112, 5560, 0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x2b, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00, 0x2b, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8}, - { - 114, 5570, 0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x2a, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00, 0x2a, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7}, - { - 116, 5580, 0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x1a, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00, 0x1a, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7}, - { - 118, 5590, 0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x1a, 0x00, 0x06, 0x00, 0x7f, - 0x00, 0x0d, 0x00, 0xf6, 0x00, 0x1a, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x0d, - 0x00, 0xf6, 0x00, 0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6}, - { - 120, 5600, 0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x1a, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00, 0x1a, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5}, - { - 122, 5610, 0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x19, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00, 0x19, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4}, - { - 124, 5620, 0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x19, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00, 0x19, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3}, - { - 126, 5630, 0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x09, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00, 0x09, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2}, - { - 128, 5640, 0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x09, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00, 0x09, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2}, - { - 130, 5650, 0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x08, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00, 0x08, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1}, - { - 132, 5660, 0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x08, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00, 0x08, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0}, - { - 134, 5670, 0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x08, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00, 0x08, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf}, - { - 136, 5680, 0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x08, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00, 0x08, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce}, - { - 138, 5690, 0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x07, 0x00, 0x04, 0x00, 0x7f, - 0x00, 0x0b, 0x00, 0xf4, 0x00, 0x07, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x0b, - 0x00, 0xf4, 0x00, 0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce}, - { - 140, 5700, 0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x07, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x07, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd}, - { - 142, 5710, 0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x07, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x07, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc}, - { - 144, 5720, 0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x07, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x07, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb}, - { - 145, 5725, 0x03, 0x01, 0x02, 0x04, 0x79, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x06, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x06, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb}, - { - 146, 5730, 0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x06, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x06, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca}, - { - 147, 5735, 0x03, 0x01, 0x02, 0x04, 0x7b, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x06, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x06, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca}, - { - 148, 5740, 0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x06, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x06, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9}, - { - 149, 5745, 0xfe, 0x00, 0x02, 0x04, 0x7d, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x06, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x06, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9}, - { - 150, 5750, 0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x06, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x06, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9}, - { - 151, 5755, 0xfe, 0x00, 0x02, 0x04, 0x7f, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x05, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8}, - { - 152, 5760, 0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x05, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8}, - { - 153, 5765, 0xf8, 0x00, 0x02, 0x04, 0x81, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x05, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8}, - { - 154, 5770, 0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x05, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7}, - { - 155, 5775, 0xf8, 0x00, 0x02, 0x04, 0x83, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x05, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7}, - { - 156, 5780, 0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x05, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6}, - { - 157, 5785, 0xf2, 0x00, 0x02, 0x04, 0x85, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, 0x40, 0x04, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x04, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6}, - { - 158, 5790, 0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, 0x40, 0x04, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x04, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6}, - { - 159, 5795, 0xf2, 0x00, 0x02, 0x04, 0x87, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, 0x40, 0x04, 0x00, 0x03, 0x00, 0x7f, - 0x00, 0x0a, 0x00, 0xf2, 0x00, 0x04, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x0a, - 0x00, 0xf2, 0x00, 0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5}, - { - 160, 5800, 0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x04, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00, 0x04, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5}, - { - 161, 5805, 0xed, 0x00, 0x02, 0x04, 0x89, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x04, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00, 0x04, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4}, - { - 162, 5810, 0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x04, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00, 0x04, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4}, - { - 163, 5815, 0xed, 0x00, 0x02, 0x04, 0x8b, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x04, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00, 0x04, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4}, - { - 164, 5820, 0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x03, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00, 0x03, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3}, - { - 165, 5825, 0xed, 0x00, 0x02, 0x04, 0x8d, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x03, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00, 0x03, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3}, - { - 166, 5830, 0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x03, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00, 0x03, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2}, - { - 168, 5840, 0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x03, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00, 0x03, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2}, - { - 170, 5850, 0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x03, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00, 0x03, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1}, - { - 172, 5860, 0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x03, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00, 0x03, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0}, - { - 174, 5870, 0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x02, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00, 0x02, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf}, - { - 176, 5880, 0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x02, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00, 0x02, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf}, - { - 178, 5890, 0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x02, 0x00, 0x02, 0x00, 0x7f, - 0x00, 0x09, 0x00, 0xf0, 0x00, 0x02, 0x00, 0x02, 0x00, 0x7f, 0x00, 0x09, - 0x00, 0xf0, 0x00, 0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be}, - { - 180, 5900, 0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x87, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf0, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf0, 0x00, 0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd}, - { - 182, 5910, 0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x87, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, - 0x00, 0x07, 0x00, 0xf0, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x07, - 0x00, 0xf0, 0x00, 0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc}, - { - 1, 2412, 0x00, 0x01, 0x03, 0x09, 0x6c, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x04, 0x04, 0x04, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xff, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0xff, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443}, - { - 2, 2417, 0x00, 0x01, 0x03, 0x09, 0x71, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xff, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0xff, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441}, - { - 3, 2422, 0x00, 0x01, 0x03, 0x09, 0x76, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xff, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0xff, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f}, - { - 4, 2427, 0x00, 0x01, 0x03, 0x09, 0x7b, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0xfd, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d}, - { - 5, 2432, 0x00, 0x01, 0x03, 0x09, 0x80, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0xfb, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a}, - { - 6, 2437, 0x00, 0x01, 0x03, 0x09, 0x85, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0xfa, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438}, - { - 7, 2442, 0x00, 0x01, 0x03, 0x09, 0x8a, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0xf8, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436}, - { - 8, 2447, 0x00, 0x01, 0x03, 0x09, 0x8f, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0xf7, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434}, - { - 9, 2452, 0x00, 0x01, 0x03, 0x09, 0x94, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0xf6, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431}, - { - 10, 2457, 0x00, 0x01, 0x03, 0x09, 0x99, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0xf5, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f}, - { - 11, 2462, 0x00, 0x01, 0x03, 0x09, 0x9e, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0xf4, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d}, - { - 12, 2467, 0x00, 0x01, 0x03, 0x09, 0xa3, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0xf3, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b}, - { - 13, 2472, 0x00, 0x01, 0x03, 0x09, 0xa8, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf2, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0xf2, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429}, - { - 14, 2484, 0xff, 0x01, 0x03, 0x09, 0xb4, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x04, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0e, 0x00, 0xf0, 0x00, 0x04, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0e, 0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424} -}; - -static const struct chan_info_nphy_radio205x chan_info_nphyrev5_2056v5[] = { - { - 184, 4920, 0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0f, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216}, - { - 186, 4930, 0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215}, - { - 188, 4940, 0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214}, - { - 190, 4950, 0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213}, - { - 192, 4960, 0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212}, - { - 194, 4970, 0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211}, - { - 196, 4980, 0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f}, - { - 198, 4990, 0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e}, - { - 200, 5000, 0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d}, - { - 202, 5010, 0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c}, - { - 204, 5020, 0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b}, - { - 206, 5030, 0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a}, - { - 208, 5040, 0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x9f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209}, - { - 210, 5050, 0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x9f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208}, - { - 212, 5060, 0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x9f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207}, - { - 214, 5070, 0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x9f, 0x00, 0xfd, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206}, - { - 216, 5080, 0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205}, - { - 218, 5090, 0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204}, - { - 220, 5100, 0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203}, - { - 222, 5110, 0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202}, - { - 224, 5120, 0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201}, - { - 226, 5130, 0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfb, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0a, 0x00, 0x9f, 0x00, 0xfb, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200}, - { - 228, 5140, 0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfb, 0x00, 0x07, 0x00, 0x70, - 0x00, 0x0a, 0x00, 0x9f, 0x00, 0xfb, 0x00, 0x07, 0x00, 0x70, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff}, - { - 32, 5160, 0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfb, 0x00, 0x07, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x9e, 0x00, 0xfb, 0x00, 0x07, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x6e, 0x00, 0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd}, - { - 34, 5170, 0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfb, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x9e, 0x00, 0xfb, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x6e, 0x00, 0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc}, - { - 36, 5180, 0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x6e, 0x00, 0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb}, - { - 38, 5190, 0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x6e, 0x00, 0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa}, - { - 40, 5200, 0xaf, 0x01, 0x01, 0x02, 0x08, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x6e, 0x00, 0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9}, - { - 42, 5210, 0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x6e, 0x00, 0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8}, - { - 44, 5220, 0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x6e, 0x00, 0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7}, - { - 46, 5230, 0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xea, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x9e, 0x00, 0xea, 0x00, 0x06, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x6e, 0x00, 0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6}, - { - 48, 5240, 0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xe9, 0x00, 0x05, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x9d, 0x00, 0xe9, 0x00, 0x05, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x6d, 0x00, 0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5}, - { - 50, 5250, 0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xe9, 0x00, 0x05, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x9d, 0x00, 0xe9, 0x00, 0x05, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x6d, 0x00, 0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4}, - { - 52, 5260, 0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xd9, 0x00, 0x05, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x9d, 0x00, 0xd9, 0x00, 0x05, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x6d, 0x00, 0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3}, - { - 54, 5270, 0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, 0xff, 0xd8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9c, 0x00, 0xd8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6c, 0x00, 0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2}, - { - 56, 5280, 0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, 0xff, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6c, 0x00, 0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1}, - { - 58, 5290, 0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0f, 0x00, 0xff, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6c, 0x00, 0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0}, - { - 60, 5300, 0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6c, 0x00, 0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0}, - { - 62, 5310, 0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6c, 0x00, 0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef}, - { - 64, 5320, 0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xb8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9c, 0x00, 0xb8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6c, 0x00, 0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee}, - { - 66, 5330, 0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xb7, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9b, 0x00, 0xb7, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6b, 0x00, 0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed}, - { - 68, 5340, 0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xb7, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9b, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6b, 0x00, 0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec}, - { - 70, 5350, 0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xa7, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x9b, 0x00, 0xa7, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x6b, 0x00, 0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb}, - { - 72, 5360, 0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xa6, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x9b, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x6b, 0x00, 0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea}, - { - 74, 5370, 0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0xa6, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x9b, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x5b, 0x00, 0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9}, - { - 76, 5380, 0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0x96, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x9a, 0x00, 0x96, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x5a, 0x00, 0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8}, - { - 78, 5390, 0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8f, 0x0e, 0x00, 0xff, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x5a, 0x00, 0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7}, - { - 80, 5400, 0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xc8, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x5a, 0x00, 0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6}, - { - 82, 5410, 0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xc8, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x5a, 0x00, 0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5}, - { - 84, 5420, 0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xc8, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x5a, 0x00, 0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5}, - { - 86, 5430, 0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xc8, 0x85, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x99, 0x00, 0x85, 0x00, 0x02, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x59, 0x00, 0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4}, - { - 88, 5440, 0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x84, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x99, 0x00, 0x84, 0x00, 0x02, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x59, 0x00, 0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3}, - { - 90, 5450, 0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x84, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x99, 0x00, 0x84, 0x00, 0x02, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x59, 0x00, 0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2}, - { - 92, 5460, 0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x84, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x99, 0x00, 0x84, 0x00, 0x02, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1}, - { - 94, 5470, 0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x74, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x99, 0x00, 0x74, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0}, - { - 96, 5480, 0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df}, - { - 98, 5490, 0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0d, 0x00, 0xc8, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de}, - { - 100, 5500, 0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x78, 0x00, 0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd}, - { - 102, 5510, 0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x78, 0x00, 0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd}, - { - 104, 5520, 0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x78, 0x00, 0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc}, - { - 106, 5530, 0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x63, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x98, 0x00, 0x63, 0x00, 0x01, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x78, 0x00, 0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db}, - { - 108, 5540, 0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x62, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x97, 0x00, 0x62, 0x00, 0x00, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x77, 0x00, 0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da}, - { - 110, 5550, 0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x62, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x97, 0x00, 0x62, 0x00, 0x00, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x77, 0x00, 0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9}, - { - 112, 5560, 0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x62, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x97, 0x00, 0x62, 0x00, 0x00, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x77, 0x00, 0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8}, - { - 114, 5570, 0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x52, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x96, 0x00, 0x52, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x76, 0x00, 0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7}, - { - 116, 5580, 0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x52, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x96, 0x00, 0x52, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x76, 0x00, 0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7}, - { - 118, 5590, 0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8d, 0x0b, 0x00, 0x84, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x76, 0x00, 0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6}, - { - 120, 5600, 0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x76, 0x00, 0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5}, - { - 122, 5610, 0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x76, 0x00, 0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4}, - { - 124, 5620, 0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x76, 0x00, 0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3}, - { - 126, 5630, 0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x76, 0x00, 0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2}, - { - 128, 5640, 0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x95, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x75, 0x00, 0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2}, - { - 130, 5650, 0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x50, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x95, 0x00, 0x50, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x75, 0x00, 0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1}, - { - 132, 5660, 0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x50, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x95, 0x00, 0x50, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x75, 0x00, 0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0}, - { - 134, 5670, 0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x74, 0x00, 0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf}, - { - 136, 5680, 0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x74, 0x00, 0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce}, - { - 138, 5690, 0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8b, 0x09, 0x00, 0x70, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x74, 0x00, 0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce}, - { - 140, 5700, 0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x74, 0x00, 0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd}, - { - 142, 5710, 0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x74, 0x00, 0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc}, - { - 144, 5720, 0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x74, 0x00, 0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb}, - { - 145, 5725, 0x03, 0x01, 0x02, 0x04, 0x79, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x74, 0x00, 0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb}, - { - 146, 5730, 0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x84, 0x00, 0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca}, - { - 147, 5735, 0x03, 0x01, 0x02, 0x04, 0x7b, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x83, 0x00, 0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca}, - { - 148, 5740, 0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x83, 0x00, 0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9}, - { - 149, 5745, 0xfe, 0x00, 0x02, 0x04, 0x7d, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x83, 0x00, 0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9}, - { - 150, 5750, 0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x83, 0x00, 0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9}, - { - 151, 5755, 0xfe, 0x00, 0x02, 0x04, 0x7f, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x83, 0x00, 0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8}, - { - 152, 5760, 0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x83, 0x00, 0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8}, - { - 153, 5765, 0xf8, 0x00, 0x02, 0x04, 0x81, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x82, 0x00, 0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8}, - { - 154, 5770, 0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x82, 0x00, 0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7}, - { - 155, 5775, 0xf8, 0x00, 0x02, 0x04, 0x83, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x82, 0x00, 0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7}, - { - 156, 5780, 0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x8a, 0x06, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x82, 0x00, 0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6}, - { - 157, 5785, 0xf2, 0x00, 0x02, 0x04, 0x85, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x82, 0x00, 0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6}, - { - 158, 5790, 0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x82, 0x00, 0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6}, - { - 159, 5795, 0xf2, 0x00, 0x02, 0x04, 0x87, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x8a, 0x06, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x82, 0x00, 0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5}, - { - 160, 5800, 0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x82, 0x00, 0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5}, - { - 161, 5805, 0xed, 0x00, 0x02, 0x04, 0x89, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x82, 0x00, 0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4}, - { - 162, 5810, 0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x82, 0x00, 0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4}, - { - 163, 5815, 0xed, 0x00, 0x02, 0x04, 0x8b, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x82, 0x00, 0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4}, - { - 164, 5820, 0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x82, 0x00, 0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3}, - { - 165, 5825, 0xed, 0x00, 0x02, 0x04, 0x8d, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x82, 0x00, 0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3}, - { - 166, 5830, 0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x72, 0x00, 0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2}, - { - 168, 5840, 0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x72, 0x00, 0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2}, - { - 170, 5850, 0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x72, 0x00, 0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1}, - { - 172, 5860, 0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x72, 0x00, 0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0}, - { - 174, 5870, 0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x71, 0x00, 0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf}, - { - 176, 5880, 0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x71, 0x00, 0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf}, - { - 178, 5890, 0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x88, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x71, 0x00, 0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be}, - { - 180, 5900, 0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x87, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x71, 0x00, 0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd}, - { - 182, 5910, 0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x87, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x71, 0x00, 0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc}, - { - 1, 2412, 0x00, 0x01, 0x03, 0x09, 0x6c, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x04, 0x04, 0x04, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x1f, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0b, 0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443}, - { - 2, 2417, 0x00, 0x01, 0x03, 0x09, 0x71, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0a, 0x00, 0x1f, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0a, 0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441}, - { - 3, 2422, 0x00, 0x01, 0x03, 0x09, 0x76, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0a, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0a, 0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f}, - { - 4, 2427, 0x00, 0x01, 0x03, 0x09, 0x7b, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a, 0x00, 0x0d, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d}, - { - 5, 2432, 0x00, 0x01, 0x03, 0x09, 0x80, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a, 0x00, 0x0c, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a}, - { - 6, 2437, 0x00, 0x01, 0x03, 0x09, 0x85, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a, 0x00, 0x0b, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438}, - { - 7, 2442, 0x00, 0x01, 0x03, 0x09, 0x8a, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x09, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436}, - { - 8, 2447, 0x00, 0x01, 0x03, 0x09, 0x8f, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x09, 0x00, 0x08, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x09, 0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434}, - { - 9, 2452, 0x00, 0x01, 0x03, 0x09, 0x94, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x07, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x09, 0x00, 0x07, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x09, 0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431}, - { - 10, 2457, 0x00, 0x01, 0x03, 0x09, 0x99, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x06, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x09, 0x00, 0x06, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x09, 0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f}, - { - 11, 2462, 0x00, 0x01, 0x03, 0x09, 0x9e, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x05, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x09, 0x00, 0x05, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x09, 0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d}, - { - 12, 2467, 0x00, 0x01, 0x03, 0x09, 0xa3, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x08, 0x00, 0x04, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x08, 0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b}, - { - 13, 2472, 0x00, 0x01, 0x03, 0x09, 0xa8, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x08, 0x00, 0x03, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x08, 0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429}, - { - 14, 2484, 0xff, 0x01, 0x03, 0x09, 0xb4, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x08, 0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424} -}; - -static const struct chan_info_nphy_radio205x chan_info_nphyrev6_2056v6[] = { - { - 184, 4920, 0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216}, - { - 186, 4930, 0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215}, - { - 188, 4940, 0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214}, - { - 190, 4950, 0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213}, - { - 192, 4960, 0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212}, - { - 194, 4970, 0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211}, - { - 196, 4980, 0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f}, - { - 198, 4990, 0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e}, - { - 200, 5000, 0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d}, - { - 202, 5010, 0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c}, - { - 204, 5020, 0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b}, - { - 206, 5030, 0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a}, - { - 208, 5040, 0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209}, - { - 210, 5050, 0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208}, - { - 212, 5060, 0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207}, - { - 214, 5070, 0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206}, - { - 216, 5080, 0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205}, - { - 218, 5090, 0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204}, - { - 220, 5100, 0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203}, - { - 222, 5110, 0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202}, - { - 224, 5120, 0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201}, - { - 226, 5130, 0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200}, - { - 228, 5140, 0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfb, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfb, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff}, - { - 32, 5160, 0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x07, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00, 0xfa, 0x00, 0x07, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd}, - { - 34, 5170, 0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x07, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00, 0xfa, 0x00, 0x07, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc}, - { - 36, 5180, 0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xf9, 0x00, 0x06, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x06, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb}, - { - 38, 5190, 0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xf9, 0x00, 0x06, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x06, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa}, - { - 40, 5200, 0xaf, 0x01, 0x01, 0x02, 0x08, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xf9, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9}, - { - 42, 5210, 0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xf9, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8}, - { - 44, 5220, 0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xfe, 0xd8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xd8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7}, - { - 46, 5230, 0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xee, 0xd8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xd8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6}, - { - 48, 5240, 0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xee, 0xc8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xc8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5}, - { - 50, 5250, 0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xed, 0xc7, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4}, - { - 52, 5260, 0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0e, 0x00, 0xed, 0xc7, 0x00, 0x04, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x04, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3}, - { - 54, 5270, 0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8e, 0x0e, 0x00, 0xed, 0xc7, 0x00, 0x04, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x04, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2}, - { - 56, 5280, 0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1}, - { - 58, 5290, 0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0}, - { - 60, 5300, 0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0}, - { - 62, 5310, 0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef}, - { - 64, 5320, 0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdb, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee}, - { - 66, 5330, 0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xcb, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed}, - { - 68, 5340, 0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xca, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec}, - { - 70, 5350, 0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 0xca, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb}, - { - 72, 5360, 0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 0xc9, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea}, - { - 74, 5370, 0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 0xc9, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9}, - { - 76, 5380, 0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb8, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8}, - { - 78, 5390, 0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb8, 0x84, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7}, - { - 80, 5400, 0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb8, 0x84, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6}, - { - 82, 5410, 0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb7, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5}, - { - 84, 5420, 0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xa7, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5}, - { - 86, 5430, 0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0b, 0x00, 0xa6, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4}, - { - 88, 5440, 0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0xa6, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3}, - { - 90, 5450, 0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0x95, 0x84, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2}, - { - 92, 5460, 0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0x95, 0x84, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1}, - { - 94, 5470, 0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0x94, 0x73, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0}, - { - 96, 5480, 0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x84, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df}, - { - 98, 5490, 0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x83, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de}, - { - 100, 5500, 0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x82, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd}, - { - 102, 5510, 0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x82, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd}, - { - 104, 5520, 0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x72, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc}, - { - 106, 5530, 0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, 0x72, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db}, - { - 108, 5540, 0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, 0x71, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da}, - { - 110, 5550, 0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9}, - { - 112, 5560, 0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8}, - { - 114, 5570, 0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 0x61, 0x62, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x62, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7}, - { - 116, 5580, 0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, 0x60, 0x62, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00, 0x62, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7}, - { - 118, 5590, 0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, 0x50, 0x61, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00, 0x61, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6}, - { - 120, 5600, 0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 0x50, 0x51, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5}, - { - 122, 5610, 0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 0x50, 0x51, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4}, - { - 124, 5620, 0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3}, - { - 126, 5630, 0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2}, - { - 128, 5640, 0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2}, - { - 130, 5650, 0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1}, - { - 132, 5660, 0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0}, - { - 134, 5670, 0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf}, - { - 136, 5680, 0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce}, - { - 138, 5690, 0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce}, - { - 140, 5700, 0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd}, - { - 142, 5710, 0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc}, - { - 144, 5720, 0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb}, - { - 145, 5725, 0x03, 0x01, 0x02, 0x04, 0x79, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb}, - { - 146, 5730, 0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca}, - { - 147, 5735, 0x03, 0x01, 0x02, 0x04, 0x7b, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca}, - { - 148, 5740, 0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9}, - { - 149, 5745, 0xfe, 0x00, 0x02, 0x04, 0x7d, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9}, - { - 150, 5750, 0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6d, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6d, 0x00, 0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9}, - { - 151, 5755, 0xfe, 0x00, 0x02, 0x04, 0x7f, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x10, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8}, - { - 152, 5760, 0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, 0x10, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8}, - { - 153, 5765, 0xf8, 0x00, 0x02, 0x04, 0x81, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8}, - { - 154, 5770, 0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7}, - { - 155, 5775, 0xf8, 0x00, 0x02, 0x04, 0x83, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7}, - { - 156, 5780, 0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6}, - { - 157, 5785, 0xf2, 0x00, 0x02, 0x04, 0x85, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6}, - { - 158, 5790, 0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6}, - { - 159, 5795, 0xf2, 0x00, 0x02, 0x04, 0x87, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5}, - { - 160, 5800, 0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5}, - { - 161, 5805, 0xed, 0x00, 0x02, 0x04, 0x89, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4}, - { - 162, 5810, 0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4}, - { - 163, 5815, 0xed, 0x00, 0x02, 0x04, 0x8b, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4}, - { - 164, 5820, 0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3}, - { - 165, 5825, 0xed, 0x00, 0x02, 0x04, 0x8d, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x69, 0x00, 0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3}, - { - 166, 5830, 0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x69, 0x00, 0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2}, - { - 168, 5840, 0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2}, - { - 170, 5850, 0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1}, - { - 172, 5860, 0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0}, - { - 174, 5870, 0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf}, - { - 176, 5880, 0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf}, - { - 178, 5890, 0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be}, - { - 180, 5900, 0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd}, - { - 182, 5910, 0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc}, - { - 1, 2412, 0x00, 0x01, 0x03, 0x09, 0x6c, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x04, 0x04, 0x04, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a, 0x00, 0x78, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443}, - { - 2, 2417, 0x00, 0x01, 0x03, 0x09, 0x71, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a, 0x00, 0x78, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441}, - { - 3, 2422, 0x00, 0x01, 0x03, 0x09, 0x76, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x67, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a, 0x00, 0x67, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f}, - { - 4, 2427, 0x00, 0x01, 0x03, 0x09, 0x7b, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x57, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x57, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d}, - { - 5, 2432, 0x00, 0x01, 0x03, 0x09, 0x80, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x56, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x56, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a}, - { - 6, 2437, 0x00, 0x01, 0x03, 0x09, 0x85, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x46, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x46, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438}, - { - 7, 2442, 0x00, 0x01, 0x03, 0x09, 0x8a, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x45, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x45, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436}, - { - 8, 2447, 0x00, 0x01, 0x03, 0x09, 0x8f, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x34, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x34, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434}, - { - 9, 2452, 0x00, 0x01, 0x03, 0x09, 0x94, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x23, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x23, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431}, - { - 10, 2457, 0x00, 0x01, 0x03, 0x09, 0x99, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x12, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x12, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f}, - { - 11, 2462, 0x00, 0x01, 0x03, 0x09, 0x9e, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09, 0x00, 0x02, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d}, - { - 12, 2467, 0x00, 0x01, 0x03, 0x09, 0xa3, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09, 0x00, 0x01, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b}, - { - 13, 2472, 0x00, 0x01, 0x03, 0x09, 0xa8, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09, 0x00, 0x01, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429}, - { - 14, 2484, 0xff, 0x01, 0x03, 0x09, 0xb4, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x07, 0x07, 0x07, 0x8f, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424} -}; - -static const struct chan_info_nphy_radio205x chan_info_nphyrev5n6_2056v7[] = { - { - 184, 4920, 0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0f, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216}, - { - 186, 4930, 0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215}, - { - 188, 4940, 0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214}, - { - 190, 4950, 0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0b, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0b, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213}, - { - 192, 4960, 0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0e, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212}, - { - 194, 4970, 0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211}, - { - 196, 4980, 0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f}, - { - 198, 4990, 0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e}, - { - 200, 5000, 0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d}, - { - 202, 5010, 0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x0a, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c}, - { - 204, 5020, 0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0d, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b}, - { - 206, 5030, 0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xff, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x9f, 0x00, 0xff, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a}, - { - 208, 5040, 0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x9f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209}, - { - 210, 5050, 0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x9f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208}, - { - 212, 5060, 0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x09, 0x00, 0x70, - 0x00, 0x0c, 0x00, 0x9f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x70, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207}, - { - 214, 5070, 0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x9f, 0x00, 0xfd, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206}, - { - 216, 5080, 0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205}, - { - 218, 5090, 0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204}, - { - 220, 5100, 0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203}, - { - 222, 5110, 0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202}, - { - 224, 5120, 0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0b, 0x00, 0x9f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201}, - { - 226, 5130, 0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfb, 0x00, 0x08, 0x00, 0x70, - 0x00, 0x0a, 0x00, 0x9f, 0x00, 0xfb, 0x00, 0x08, 0x00, 0x70, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200}, - { - 228, 5140, 0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfb, 0x00, 0x07, 0x00, 0x70, - 0x00, 0x0a, 0x00, 0x9f, 0x00, 0xfb, 0x00, 0x07, 0x00, 0x70, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff}, - { - 32, 5160, 0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfb, 0x00, 0x07, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x9e, 0x00, 0xfb, 0x00, 0x07, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x6e, 0x00, 0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd}, - { - 34, 5170, 0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfb, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x9e, 0x00, 0xfb, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x6e, 0x00, 0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc}, - { - 36, 5180, 0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x6e, 0x00, 0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb}, - { - 38, 5190, 0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x6e, 0x00, 0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa}, - { - 40, 5200, 0xaf, 0x01, 0x01, 0x02, 0x08, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x6e, 0x00, 0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9}, - { - 42, 5210, 0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x6e, 0x00, 0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8}, - { - 44, 5220, 0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xfe, 0xfa, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x09, 0x00, 0x9e, 0x00, 0xfa, 0x00, 0x06, 0x00, 0x70, 0x00, 0x09, - 0x00, 0x6e, 0x00, 0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7}, - { - 46, 5230, 0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xee, 0xea, 0x00, 0x06, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x9e, 0x00, 0xea, 0x00, 0x06, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x6e, 0x00, 0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6}, - { - 48, 5240, 0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xee, 0xe9, 0x00, 0x05, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x9d, 0x00, 0xe9, 0x00, 0x05, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x6d, 0x00, 0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5}, - { - 50, 5250, 0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xed, 0xe9, 0x00, 0x05, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x9d, 0x00, 0xe9, 0x00, 0x05, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x6d, 0x00, 0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4}, - { - 52, 5260, 0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0e, 0x00, 0xed, 0xd9, 0x00, 0x05, 0x00, 0x70, - 0x00, 0x08, 0x00, 0x9d, 0x00, 0xd9, 0x00, 0x05, 0x00, 0x70, 0x00, 0x08, - 0x00, 0x6d, 0x00, 0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3}, - { - 54, 5270, 0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8e, 0x0e, 0x00, 0xed, 0xd8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9c, 0x00, 0xd8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6c, 0x00, 0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2}, - { - 56, 5280, 0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6c, 0x00, 0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1}, - { - 58, 5290, 0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6c, 0x00, 0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0}, - { - 60, 5300, 0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6c, 0x00, 0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0}, - { - 62, 5310, 0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xc8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9c, 0x00, 0xc8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6c, 0x00, 0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef}, - { - 64, 5320, 0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdb, 0xb8, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9c, 0x00, 0xb8, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6c, 0x00, 0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee}, - { - 66, 5330, 0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xcb, 0xb7, 0x00, 0x04, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9b, 0x00, 0xb7, 0x00, 0x04, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6b, 0x00, 0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed}, - { - 68, 5340, 0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xca, 0xb7, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x07, 0x00, 0x9b, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x70, 0x00, 0x07, - 0x00, 0x6b, 0x00, 0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec}, - { - 70, 5350, 0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 0xca, 0xa7, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x9b, 0x00, 0xa7, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x6b, 0x00, 0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb}, - { - 72, 5360, 0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 0xc9, 0xa6, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x9b, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x6b, 0x00, 0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea}, - { - 74, 5370, 0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 0xc9, 0xa6, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x9b, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x7b, 0x00, 0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9}, - { - 76, 5380, 0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb8, 0x96, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x9a, 0x00, 0x96, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x7a, 0x00, 0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8}, - { - 78, 5390, 0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb8, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x7a, 0x00, 0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7}, - { - 80, 5400, 0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb8, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x06, 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x06, - 0x00, 0x7a, 0x00, 0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6}, - { - 82, 5410, 0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb7, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x7a, 0x00, 0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5}, - { - 84, 5420, 0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xa7, 0x95, 0x00, 0x03, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x9a, 0x00, 0x95, 0x00, 0x03, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x7a, 0x00, 0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5}, - { - 86, 5430, 0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0b, 0x00, 0xa6, 0x85, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x99, 0x00, 0x85, 0x00, 0x02, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x79, 0x00, 0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4}, - { - 88, 5440, 0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0xa6, 0x84, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x99, 0x00, 0x84, 0x00, 0x02, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x79, 0x00, 0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3}, - { - 90, 5450, 0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0x95, 0x84, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x05, 0x00, 0x99, 0x00, 0x84, 0x00, 0x02, 0x00, 0x70, 0x00, 0x05, - 0x00, 0x79, 0x00, 0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2}, - { - 92, 5460, 0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0x95, 0x84, 0x00, 0x02, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x99, 0x00, 0x84, 0x00, 0x02, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x79, 0x00, 0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1}, - { - 94, 5470, 0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0x94, 0x74, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x99, 0x00, 0x74, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x79, 0x00, 0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0}, - { - 96, 5480, 0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x84, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x78, 0x00, 0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df}, - { - 98, 5490, 0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x83, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x78, 0x00, 0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de}, - { - 100, 5500, 0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x82, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x78, 0x00, 0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd}, - { - 102, 5510, 0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x82, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x78, 0x00, 0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd}, - { - 104, 5520, 0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x72, 0x73, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x04, 0x00, 0x98, 0x00, 0x73, 0x00, 0x01, 0x00, 0x70, 0x00, 0x04, - 0x00, 0x78, 0x00, 0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc}, - { - 106, 5530, 0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, 0x72, 0x63, 0x00, 0x01, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x98, 0x00, 0x63, 0x00, 0x01, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x78, 0x00, 0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db}, - { - 108, 5540, 0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, 0x71, 0x62, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x97, 0x00, 0x62, 0x00, 0x00, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x77, 0x00, 0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da}, - { - 110, 5550, 0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 0x61, 0x62, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x97, 0x00, 0x62, 0x00, 0x00, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x77, 0x00, 0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9}, - { - 112, 5560, 0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 0x61, 0x62, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x03, 0x00, 0x97, 0x00, 0x62, 0x00, 0x00, 0x00, 0x70, 0x00, 0x03, - 0x00, 0x77, 0x00, 0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8}, - { - 114, 5570, 0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 0x61, 0x52, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x96, 0x00, 0x52, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x76, 0x00, 0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7}, - { - 116, 5580, 0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, 0x60, 0x52, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x96, 0x00, 0x52, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x86, 0x00, 0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7}, - { - 118, 5590, 0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, 0x50, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x86, 0x00, 0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6}, - { - 120, 5600, 0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 0x50, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x86, 0x00, 0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5}, - { - 122, 5610, 0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 0x50, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x86, 0x00, 0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4}, - { - 124, 5620, 0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 0x50, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x86, 0x00, 0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3}, - { - 126, 5630, 0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x50, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x96, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x86, 0x00, 0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2}, - { - 128, 5640, 0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x51, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x02, 0x00, 0x95, 0x00, 0x51, 0x00, 0x00, 0x00, 0x70, 0x00, 0x02, - 0x00, 0x85, 0x00, 0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2}, - { - 130, 5650, 0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x50, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x95, 0x00, 0x50, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x85, 0x00, 0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1}, - { - 132, 5660, 0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x50, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x95, 0x00, 0x50, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x85, 0x00, 0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0}, - { - 134, 5670, 0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x84, 0x00, 0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf}, - { - 136, 5680, 0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x84, 0x00, 0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce}, - { - 138, 5690, 0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce}, - { - 140, 5700, 0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd}, - { - 142, 5710, 0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc}, - { - 144, 5720, 0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb}, - { - 145, 5725, 0x03, 0x01, 0x02, 0x04, 0x79, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x40, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb}, - { - 146, 5730, 0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x01, 0x00, 0x94, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x01, - 0x00, 0x94, 0x00, 0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca}, - { - 147, 5735, 0x03, 0x01, 0x02, 0x04, 0x7b, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca}, - { - 148, 5740, 0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9}, - { - 149, 5745, 0xfe, 0x00, 0x02, 0x04, 0x7d, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9}, - { - 150, 5750, 0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9}, - { - 151, 5755, 0xfe, 0x00, 0x02, 0x04, 0x7f, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x10, 0x30, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8}, - { - 152, 5760, 0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, 0x10, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x93, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x93, 0x00, 0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8}, - { - 153, 5765, 0xf8, 0x00, 0x02, 0x04, 0x81, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, 0x10, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8}, - { - 154, 5770, 0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 0x10, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7}, - { - 155, 5775, 0xf8, 0x00, 0x02, 0x04, 0x83, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 0x10, 0x20, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7}, - { - 156, 5780, 0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6}, - { - 157, 5785, 0xf2, 0x00, 0x02, 0x04, 0x85, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6}, - { - 158, 5790, 0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6}, - { - 159, 5795, 0xf2, 0x00, 0x02, 0x04, 0x87, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5}, - { - 160, 5800, 0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5}, - { - 161, 5805, 0xed, 0x00, 0x02, 0x04, 0x89, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4}, - { - 162, 5810, 0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4}, - { - 163, 5815, 0xed, 0x00, 0x02, 0x04, 0x8b, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4}, - { - 164, 5820, 0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3}, - { - 165, 5825, 0xed, 0x00, 0x02, 0x04, 0x8d, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3}, - { - 166, 5830, 0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2}, - { - 168, 5840, 0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2}, - { - 170, 5850, 0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1}, - { - 172, 5860, 0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x92, 0x00, 0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0}, - { - 174, 5870, 0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf}, - { - 176, 5880, 0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf}, - { - 178, 5890, 0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be}, - { - 180, 5900, 0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd}, - { - 182, 5910, 0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x91, 0x00, 0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc}, - { - 1, 2412, 0x00, 0x01, 0x03, 0x09, 0x6c, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x04, 0x04, 0x04, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x89, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x89, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0b, 0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443}, - { - 2, 2417, 0x00, 0x01, 0x03, 0x09, 0x71, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x89, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0a, 0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441}, - { - 3, 2422, 0x00, 0x01, 0x03, 0x09, 0x76, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x89, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0f, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0f, 0x00, 0x0a, 0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f}, - { - 4, 2427, 0x00, 0x01, 0x03, 0x09, 0x7b, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a, 0x00, 0x78, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d}, - { - 5, 2432, 0x00, 0x01, 0x03, 0x09, 0x80, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a, 0x00, 0x77, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a}, - { - 6, 2437, 0x00, 0x01, 0x03, 0x09, 0x85, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x76, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a, 0x00, 0x76, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438}, - { - 7, 2442, 0x00, 0x01, 0x03, 0x09, 0x8a, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x66, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x0a, 0x00, 0x66, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x0a, 0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436}, - { - 8, 2447, 0x00, 0x01, 0x03, 0x09, 0x8f, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x55, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x09, 0x00, 0x55, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x09, 0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434}, - { - 9, 2452, 0x00, 0x01, 0x03, 0x09, 0x94, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x45, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0e, 0x00, 0x09, 0x00, 0x45, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0e, 0x00, 0x09, 0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431}, - { - 10, 2457, 0x00, 0x01, 0x03, 0x09, 0x99, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x34, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x09, 0x00, 0x34, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x09, 0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f}, - { - 11, 2462, 0x00, 0x01, 0x03, 0x09, 0x9e, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x09, 0x00, 0x33, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x09, 0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d}, - { - 12, 2467, 0x00, 0x01, 0x03, 0x09, 0xa3, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x22, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x08, 0x00, 0x22, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x08, 0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b}, - { - 13, 2472, 0x00, 0x01, 0x03, 0x09, 0xa8, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x08, 0x00, 0x11, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x08, 0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429}, - { - 14, 2484, 0xff, 0x01, 0x03, 0x09, 0xb4, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x07, 0x07, 0x07, 0x8f, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0d, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0d, 0x00, 0x08, 0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424} -}; - -static const struct chan_info_nphy_radio205x chan_info_nphyrev6_2056v8[] = { - { - 184, 4920, 0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216}, - { - 186, 4930, 0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215}, - { - 188, 4940, 0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214}, - { - 190, 4950, 0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213}, - { - 192, 4960, 0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212}, - { - 194, 4970, 0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211}, - { - 196, 4980, 0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f}, - { - 198, 4990, 0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e}, - { - 200, 5000, 0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d}, - { - 202, 5010, 0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c}, - { - 204, 5020, 0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b}, - { - 206, 5030, 0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a}, - { - 208, 5040, 0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209}, - { - 210, 5050, 0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208}, - { - 212, 5060, 0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207}, - { - 214, 5070, 0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206}, - { - 216, 5080, 0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205}, - { - 218, 5090, 0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204}, - { - 220, 5100, 0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203}, - { - 222, 5110, 0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202}, - { - 224, 5120, 0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201}, - { - 226, 5130, 0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200}, - { - 228, 5140, 0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfb, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfb, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff}, - { - 32, 5160, 0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x07, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00, 0xfa, 0x00, 0x07, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd}, - { - 34, 5170, 0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x07, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00, 0xfa, 0x00, 0x07, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc}, - { - 36, 5180, 0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xf9, 0x00, 0x06, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x06, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb}, - { - 38, 5190, 0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xf9, 0x00, 0x06, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x06, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa}, - { - 40, 5200, 0xaf, 0x01, 0x01, 0x02, 0x08, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xf9, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9}, - { - 42, 5210, 0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xf9, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8}, - { - 44, 5220, 0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xfe, 0xd8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xd8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7}, - { - 46, 5230, 0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xee, 0xd8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xd8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6}, - { - 48, 5240, 0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xee, 0xc8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xc8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5}, - { - 50, 5250, 0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xed, 0xc7, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4}, - { - 52, 5260, 0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0e, 0x00, 0xed, 0xc7, 0x00, 0x04, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x04, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3}, - { - 54, 5270, 0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8e, 0x0e, 0x00, 0xed, 0xc7, 0x00, 0x04, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x04, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2}, - { - 56, 5280, 0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1}, - { - 58, 5290, 0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0}, - { - 60, 5300, 0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0}, - { - 62, 5310, 0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef}, - { - 64, 5320, 0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdb, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee}, - { - 66, 5330, 0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xcb, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed}, - { - 68, 5340, 0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xca, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec}, - { - 70, 5350, 0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 0xca, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb}, - { - 72, 5360, 0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 0xc9, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea}, - { - 74, 5370, 0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 0xc9, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9}, - { - 76, 5380, 0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb8, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8}, - { - 78, 5390, 0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb8, 0x84, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7}, - { - 80, 5400, 0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb8, 0x84, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6}, - { - 82, 5410, 0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb7, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5}, - { - 84, 5420, 0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xa7, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5}, - { - 86, 5430, 0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0b, 0x00, 0xa6, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4}, - { - 88, 5440, 0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0xa6, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3}, - { - 90, 5450, 0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0x95, 0x84, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2}, - { - 92, 5460, 0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0x95, 0x84, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1}, - { - 94, 5470, 0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0x94, 0x73, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0}, - { - 96, 5480, 0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x84, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df}, - { - 98, 5490, 0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x83, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de}, - { - 100, 5500, 0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x82, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd}, - { - 102, 5510, 0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x82, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd}, - { - 104, 5520, 0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x72, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc}, - { - 106, 5530, 0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, 0x72, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db}, - { - 108, 5540, 0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, 0x71, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da}, - { - 110, 5550, 0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9}, - { - 112, 5560, 0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8}, - { - 114, 5570, 0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 0x61, 0x62, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x62, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7}, - { - 116, 5580, 0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, 0x60, 0x62, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00, 0x62, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7}, - { - 118, 5590, 0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, 0x50, 0x61, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00, 0x61, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6}, - { - 120, 5600, 0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 0x50, 0x51, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5}, - { - 122, 5610, 0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 0x50, 0x51, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4}, - { - 124, 5620, 0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3}, - { - 126, 5630, 0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2}, - { - 128, 5640, 0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2}, - { - 130, 5650, 0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1}, - { - 132, 5660, 0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0}, - { - 134, 5670, 0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf}, - { - 136, 5680, 0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce}, - { - 138, 5690, 0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce}, - { - 140, 5700, 0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd}, - { - 142, 5710, 0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc}, - { - 144, 5720, 0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb}, - { - 145, 5725, 0x03, 0x01, 0x02, 0x04, 0x79, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb}, - { - 146, 5730, 0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca}, - { - 147, 5735, 0x03, 0x01, 0x02, 0x04, 0x7b, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca}, - { - 148, 5740, 0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9}, - { - 149, 5745, 0xfe, 0x00, 0x02, 0x04, 0x7d, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9}, - { - 150, 5750, 0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6d, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6d, 0x00, 0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9}, - { - 151, 5755, 0xfe, 0x00, 0x02, 0x04, 0x7f, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x10, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8}, - { - 152, 5760, 0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, 0x10, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8}, - { - 153, 5765, 0xf8, 0x00, 0x02, 0x04, 0x81, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8}, - { - 154, 5770, 0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7}, - { - 155, 5775, 0xf8, 0x00, 0x02, 0x04, 0x83, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7}, - { - 156, 5780, 0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6}, - { - 157, 5785, 0xf2, 0x00, 0x02, 0x04, 0x85, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6}, - { - 158, 5790, 0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6}, - { - 159, 5795, 0xf2, 0x00, 0x02, 0x04, 0x87, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5}, - { - 160, 5800, 0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5}, - { - 161, 5805, 0xed, 0x00, 0x02, 0x04, 0x89, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4}, - { - 162, 5810, 0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4}, - { - 163, 5815, 0xed, 0x00, 0x02, 0x04, 0x8b, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4}, - { - 164, 5820, 0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3}, - { - 165, 5825, 0xed, 0x00, 0x02, 0x04, 0x8d, 0x07, 0x07, 0x04, 0x10, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x69, 0x00, 0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3}, - { - 166, 5830, 0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x69, 0x00, 0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2}, - { - 168, 5840, 0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2}, - { - 170, 5850, 0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1}, - { - 172, 5860, 0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0}, - { - 174, 5870, 0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf}, - { - 176, 5880, 0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf}, - { - 178, 5890, 0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be}, - { - 180, 5900, 0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd}, - { - 182, 5910, 0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x04, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc}, - { - 1, 2412, 0x00, 0x01, 0x03, 0x09, 0x6c, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x04, 0x04, 0x04, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443}, - { - 2, 2417, 0x00, 0x01, 0x03, 0x09, 0x71, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441}, - { - 3, 2422, 0x00, 0x01, 0x03, 0x09, 0x76, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x67, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f}, - { - 4, 2427, 0x00, 0x01, 0x03, 0x09, 0x7b, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x57, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x78, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d}, - { - 5, 2432, 0x00, 0x01, 0x03, 0x09, 0x80, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x56, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x77, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a}, - { - 6, 2437, 0x00, 0x01, 0x03, 0x09, 0x85, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x46, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x76, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438}, - { - 7, 2442, 0x00, 0x01, 0x03, 0x09, 0x8a, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x45, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x66, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436}, - { - 8, 2447, 0x00, 0x01, 0x03, 0x09, 0x8f, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x34, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x55, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434}, - { - 9, 2452, 0x00, 0x01, 0x03, 0x09, 0x94, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x23, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x45, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431}, - { - 10, 2457, 0x00, 0x01, 0x03, 0x09, 0x99, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x12, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x34, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f}, - { - 11, 2462, 0x00, 0x01, 0x03, 0x09, 0x9e, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09, 0x00, 0x33, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d}, - { - 12, 2467, 0x00, 0x01, 0x03, 0x09, 0xa3, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09, 0x00, 0x22, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b}, - { - 13, 2472, 0x00, 0x01, 0x03, 0x09, 0xa8, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09, 0x00, 0x11, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429}, - { - 14, 2484, 0xff, 0x01, 0x03, 0x09, 0xb4, 0x08, 0x08, 0x04, 0x16, 0x01, - 0x07, 0x07, 0x07, 0x8f, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424} -}; - -static const struct chan_info_nphy_radio205x chan_info_nphyrev6_2056v11[] = { - { - 184, 4920, 0xff, 0x01, 0x01, 0x01, 0xec, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07b4, 0x07b0, 0x07ac, 0x0214, 0x0215, 0x0216}, - { - 186, 4930, 0xff, 0x01, 0x01, 0x01, 0xed, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07b8, 0x07b4, 0x07b0, 0x0213, 0x0214, 0x0215}, - { - 188, 4940, 0xff, 0x01, 0x01, 0x01, 0xee, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07bc, 0x07b8, 0x07b4, 0x0212, 0x0213, 0x0214}, - { - 190, 4950, 0xff, 0x01, 0x01, 0x01, 0xef, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x00, 0x00, 0x00, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07c0, 0x07bc, 0x07b8, 0x0211, 0x0212, 0x0213}, - { - 192, 4960, 0xff, 0x01, 0x01, 0x01, 0xf0, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07c4, 0x07c0, 0x07bc, 0x020f, 0x0211, 0x0212}, - { - 194, 4970, 0xff, 0x01, 0x01, 0x01, 0xf1, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07c8, 0x07c4, 0x07c0, 0x020e, 0x020f, 0x0211}, - { - 196, 4980, 0xff, 0x01, 0x01, 0x01, 0xf2, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07cc, 0x07c8, 0x07c4, 0x020d, 0x020e, 0x020f}, - { - 198, 4990, 0xff, 0x01, 0x01, 0x01, 0xf3, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07d0, 0x07cc, 0x07c8, 0x020c, 0x020d, 0x020e}, - { - 200, 5000, 0xff, 0x01, 0x01, 0x01, 0xf4, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07d4, 0x07d0, 0x07cc, 0x020b, 0x020c, 0x020d}, - { - 202, 5010, 0xff, 0x01, 0x01, 0x01, 0xf5, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07d8, 0x07d4, 0x07d0, 0x020a, 0x020b, 0x020c}, - { - 204, 5020, 0xf7, 0x01, 0x01, 0x01, 0xf6, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07dc, 0x07d8, 0x07d4, 0x0209, 0x020a, 0x020b}, - { - 206, 5030, 0xf7, 0x01, 0x01, 0x01, 0xf7, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07e0, 0x07dc, 0x07d8, 0x0208, 0x0209, 0x020a}, - { - 208, 5040, 0xef, 0x01, 0x01, 0x01, 0xf8, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07e4, 0x07e0, 0x07dc, 0x0207, 0x0208, 0x0209}, - { - 210, 5050, 0xef, 0x01, 0x01, 0x01, 0xf9, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07e8, 0x07e4, 0x07e0, 0x0206, 0x0207, 0x0208}, - { - 212, 5060, 0xe6, 0x01, 0x01, 0x01, 0xfa, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfe, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfe, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07ec, 0x07e8, 0x07e4, 0x0205, 0x0206, 0x0207}, - { - 214, 5070, 0xe6, 0x01, 0x01, 0x01, 0xfb, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07f0, 0x07ec, 0x07e8, 0x0204, 0x0205, 0x0206}, - { - 216, 5080, 0xde, 0x01, 0x01, 0x01, 0xfc, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07f4, 0x07f0, 0x07ec, 0x0203, 0x0204, 0x0205}, - { - 218, 5090, 0xde, 0x01, 0x01, 0x01, 0xfd, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x01, 0x01, 0x01, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x09, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x09, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07f8, 0x07f4, 0x07f0, 0x0202, 0x0203, 0x0204}, - { - 220, 5100, 0xd6, 0x01, 0x01, 0x01, 0xfe, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfd, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfd, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x07fc, 0x07f8, 0x07f4, 0x0201, 0x0202, 0x0203}, - { - 222, 5110, 0xd6, 0x01, 0x01, 0x01, 0xff, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x0800, 0x07fc, 0x07f8, 0x0200, 0x0201, 0x0202}, - { - 224, 5120, 0xce, 0x01, 0x01, 0x02, 0x00, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x0804, 0x0800, 0x07fc, 0x01ff, 0x0200, 0x0201}, - { - 226, 5130, 0xce, 0x01, 0x01, 0x02, 0x01, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfc, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfc, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x0808, 0x0804, 0x0800, 0x01fe, 0x01ff, 0x0200}, - { - 228, 5140, 0xc6, 0x01, 0x01, 0x02, 0x02, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfb, 0x00, 0x08, 0x00, 0x77, - 0x00, 0x0f, 0x00, 0x6f, 0x00, 0xfb, 0x00, 0x08, 0x00, 0x77, 0x00, 0x0f, - 0x00, 0x6f, 0x00, 0x080c, 0x0808, 0x0804, 0x01fd, 0x01fe, 0x01ff}, - { - 32, 5160, 0xbe, 0x01, 0x01, 0x02, 0x04, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x07, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00, 0xfa, 0x00, 0x07, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x0814, 0x0810, 0x080c, 0x01fb, 0x01fc, 0x01fd}, - { - 34, 5170, 0xbe, 0x01, 0x01, 0x02, 0x05, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xfa, 0x00, 0x07, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00, 0xfa, 0x00, 0x07, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x0818, 0x0814, 0x0810, 0x01fa, 0x01fb, 0x01fc}, - { - 36, 5180, 0xb6, 0x01, 0x01, 0x02, 0x06, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xf9, 0x00, 0x06, 0x00, 0x77, - 0x00, 0x0e, 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x06, 0x00, 0x77, 0x00, 0x0e, - 0x00, 0x6f, 0x00, 0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb}, - { - 38, 5190, 0xb6, 0x01, 0x01, 0x02, 0x07, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xf9, 0x00, 0x06, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x06, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0820, 0x081c, 0x0818, 0x01f8, 0x01f9, 0x01fa}, - { - 40, 5200, 0xaf, 0x01, 0x01, 0x02, 0x08, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xf9, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9}, - { - 42, 5210, 0xaf, 0x01, 0x01, 0x02, 0x09, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8f, 0x0f, 0x00, 0xff, 0xf9, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xf9, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0828, 0x0824, 0x0820, 0x01f6, 0x01f7, 0x01f8}, - { - 44, 5220, 0xa7, 0x01, 0x01, 0x02, 0x0a, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xfe, 0xd8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xd8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7}, - { - 46, 5230, 0xa7, 0x01, 0x01, 0x02, 0x0b, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xee, 0xd8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xd8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0830, 0x082c, 0x0828, 0x01f4, 0x01f5, 0x01f6}, - { - 48, 5240, 0xa0, 0x01, 0x01, 0x02, 0x0c, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xee, 0xc8, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xc8, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5}, - { - 50, 5250, 0xa0, 0x01, 0x01, 0x02, 0x0d, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0f, 0x00, 0xed, 0xc7, 0x00, 0x05, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x05, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x0838, 0x0834, 0x0830, 0x01f2, 0x01f3, 0x01f4}, - { - 52, 5260, 0x98, 0x01, 0x01, 0x02, 0x0e, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x02, 0x02, 0x02, 0x8e, 0x0e, 0x00, 0xed, 0xc7, 0x00, 0x04, 0x00, 0x77, - 0x00, 0x0d, 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x04, 0x00, 0x77, 0x00, 0x0d, - 0x00, 0x6f, 0x00, 0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3}, - { - 54, 5270, 0x98, 0x01, 0x01, 0x02, 0x0f, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8e, 0x0e, 0x00, 0xed, 0xc7, 0x00, 0x04, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x04, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0840, 0x083c, 0x0838, 0x01f0, 0x01f1, 0x01f2}, - { - 56, 5280, 0x91, 0x01, 0x01, 0x02, 0x10, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1}, - { - 58, 5290, 0x91, 0x01, 0x01, 0x02, 0x11, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0848, 0x0844, 0x0840, 0x01ef, 0x01f0, 0x01f0}, - { - 60, 5300, 0x8a, 0x01, 0x01, 0x02, 0x12, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0}, - { - 62, 5310, 0x8a, 0x01, 0x01, 0x02, 0x13, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdc, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0850, 0x084c, 0x0848, 0x01ed, 0x01ee, 0x01ef}, - { - 64, 5320, 0x83, 0x01, 0x01, 0x02, 0x14, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0e, 0x00, 0xdb, 0xb7, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0c, 0x00, 0x6f, 0x00, 0xb7, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0c, - 0x00, 0x6f, 0x00, 0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee}, - { - 66, 5330, 0x83, 0x01, 0x01, 0x02, 0x15, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xcb, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x0858, 0x0854, 0x0850, 0x01eb, 0x01ec, 0x01ed}, - { - 68, 5340, 0x7c, 0x01, 0x01, 0x02, 0x16, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8d, 0x0d, 0x00, 0xca, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x085c, 0x0858, 0x0854, 0x01ea, 0x01eb, 0x01ec}, - { - 70, 5350, 0x7c, 0x01, 0x01, 0x02, 0x17, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 0xca, 0xa6, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0b, 0x00, 0x6f, 0x00, 0xa6, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0b, - 0x00, 0x6f, 0x00, 0x0860, 0x085c, 0x0858, 0x01e9, 0x01ea, 0x01eb}, - { - 72, 5360, 0x75, 0x01, 0x01, 0x02, 0x18, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 0xc9, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0864, 0x0860, 0x085c, 0x01e8, 0x01e9, 0x01ea}, - { - 74, 5370, 0x75, 0x01, 0x01, 0x02, 0x19, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0d, 0x00, 0xc9, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0868, 0x0864, 0x0860, 0x01e7, 0x01e8, 0x01e9}, - { - 76, 5380, 0x6e, 0x01, 0x01, 0x02, 0x1a, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb8, 0x95, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x95, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x086c, 0x0868, 0x0864, 0x01e6, 0x01e7, 0x01e8}, - { - 78, 5390, 0x6e, 0x01, 0x01, 0x02, 0x1b, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb8, 0x84, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0870, 0x086c, 0x0868, 0x01e5, 0x01e6, 0x01e7}, - { - 80, 5400, 0x67, 0x01, 0x01, 0x02, 0x1c, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb8, 0x84, 0x00, 0x03, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x03, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0874, 0x0870, 0x086c, 0x01e5, 0x01e5, 0x01e6}, - { - 82, 5410, 0x67, 0x01, 0x01, 0x02, 0x1d, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xb7, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0878, 0x0874, 0x0870, 0x01e4, 0x01e5, 0x01e5}, - { - 84, 5420, 0x61, 0x01, 0x01, 0x02, 0x1e, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0c, 0x00, 0xa7, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x087c, 0x0878, 0x0874, 0x01e3, 0x01e4, 0x01e5}, - { - 86, 5430, 0x61, 0x01, 0x01, 0x02, 0x1f, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x03, 0x03, 0x03, 0x8c, 0x0b, 0x00, 0xa6, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x0a, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x0a, - 0x00, 0x6f, 0x00, 0x0880, 0x087c, 0x0878, 0x01e2, 0x01e3, 0x01e4}, - { - 88, 5440, 0x5a, 0x01, 0x01, 0x02, 0x20, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0xa6, 0x84, 0x00, 0x02, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x02, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0884, 0x0880, 0x087c, 0x01e1, 0x01e2, 0x01e3}, - { - 90, 5450, 0x5a, 0x01, 0x01, 0x02, 0x21, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0x95, 0x84, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0888, 0x0884, 0x0880, 0x01e0, 0x01e1, 0x01e2}, - { - 92, 5460, 0x53, 0x01, 0x01, 0x02, 0x22, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0x95, 0x84, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x84, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x088c, 0x0888, 0x0884, 0x01df, 0x01e0, 0x01e1}, - { - 94, 5470, 0x53, 0x01, 0x01, 0x02, 0x23, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8b, 0x0b, 0x00, 0x94, 0x73, 0x00, 0x01, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x01, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0890, 0x088c, 0x0888, 0x01de, 0x01df, 0x01e0}, - { - 96, 5480, 0x4d, 0x01, 0x01, 0x02, 0x24, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x84, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0894, 0x0890, 0x088c, 0x01dd, 0x01de, 0x01df}, - { - 98, 5490, 0x4d, 0x01, 0x01, 0x02, 0x25, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x83, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x0898, 0x0894, 0x0890, 0x01dd, 0x01dd, 0x01de}, - { - 100, 5500, 0x47, 0x01, 0x01, 0x02, 0x26, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x82, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd}, - { - 102, 5510, 0x47, 0x01, 0x01, 0x02, 0x27, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x82, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08a0, 0x089c, 0x0898, 0x01db, 0x01dc, 0x01dd}, - { - 104, 5520, 0x40, 0x01, 0x01, 0x02, 0x28, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x0a, 0x00, 0x72, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc}, - { - 106, 5530, 0x40, 0x01, 0x01, 0x02, 0x29, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, 0x72, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08a8, 0x08a4, 0x08a0, 0x01d9, 0x01da, 0x01db}, - { - 108, 5540, 0x3a, 0x01, 0x01, 0x02, 0x2a, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x8a, 0x09, 0x00, 0x71, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da}, - { - 110, 5550, 0x3a, 0x01, 0x01, 0x02, 0x2b, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08b0, 0x08ac, 0x08a8, 0x01d7, 0x01d8, 0x01d9}, - { - 112, 5560, 0x34, 0x01, 0x01, 0x02, 0x2c, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8}, - { - 114, 5570, 0x34, 0x01, 0x01, 0x02, 0x2d, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x09, 0x00, 0x61, 0x62, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x09, 0x00, 0x6f, 0x00, 0x62, 0x00, 0x00, 0x00, 0x77, 0x00, 0x09, - 0x00, 0x6f, 0x00, 0x08b8, 0x08b4, 0x08b0, 0x01d6, 0x01d7, 0x01d7}, - { - 116, 5580, 0x2e, 0x01, 0x01, 0x02, 0x2e, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, 0x60, 0x62, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00, 0x62, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7}, - { - 118, 5590, 0x2e, 0x01, 0x01, 0x02, 0x2f, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x04, 0x04, 0x04, 0x89, 0x08, 0x00, 0x50, 0x61, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00, 0x61, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x08c0, 0x08bc, 0x08b8, 0x01d4, 0x01d5, 0x01d6}, - { - 120, 5600, 0x28, 0x01, 0x01, 0x02, 0x30, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 0x50, 0x51, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5}, - { - 122, 5610, 0x28, 0x01, 0x01, 0x02, 0x31, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 0x50, 0x51, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x08, 0x00, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0x77, 0x00, 0x08, - 0x00, 0x6f, 0x00, 0x08c8, 0x08c4, 0x08c0, 0x01d2, 0x01d3, 0x01d4}, - { - 124, 5620, 0x21, 0x01, 0x01, 0x02, 0x32, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x89, 0x08, 0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3}, - { - 126, 5630, 0x21, 0x01, 0x01, 0x02, 0x33, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x50, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x08d0, 0x08cc, 0x08c8, 0x01d1, 0x01d2, 0x01d2}, - { - 128, 5640, 0x1c, 0x01, 0x01, 0x02, 0x34, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x50, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00, 0x50, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2}, - { - 130, 5650, 0x1c, 0x01, 0x01, 0x02, 0x35, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x07, 0x00, 0x6f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x07, - 0x00, 0x6f, 0x00, 0x08d8, 0x08d4, 0x08d0, 0x01cf, 0x01d0, 0x01d1}, - { - 132, 5660, 0x16, 0x01, 0x01, 0x02, 0x36, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0}, - { - 134, 5670, 0x16, 0x01, 0x01, 0x02, 0x37, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x88, 0x07, 0x00, 0x40, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x08e0, 0x08dc, 0x08d8, 0x01ce, 0x01ce, 0x01cf}, - { - 136, 5680, 0x10, 0x01, 0x01, 0x02, 0x38, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce}, - { - 138, 5690, 0x10, 0x01, 0x01, 0x02, 0x39, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6f, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6f, 0x00, 0x08e8, 0x08e4, 0x08e0, 0x01cc, 0x01cd, 0x01ce}, - { - 140, 5700, 0x0a, 0x01, 0x01, 0x02, 0x3a, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd}, - { - 142, 5710, 0x0a, 0x01, 0x01, 0x02, 0x3b, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08f0, 0x08ec, 0x08e8, 0x01ca, 0x01cb, 0x01cc}, - { - 144, 5720, 0x0a, 0x01, 0x01, 0x02, 0x3c, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08f4, 0x08f0, 0x08ec, 0x01c9, 0x01ca, 0x01cb}, - { - 145, 5725, 0x03, 0x01, 0x02, 0x04, 0x79, 0x05, 0x05, 0x02, 0x15, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x06, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08f6, 0x08f2, 0x08ee, 0x01c9, 0x01ca, 0x01cb}, - { - 146, 5730, 0x0a, 0x01, 0x01, 0x02, 0x3d, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6e, 0x00, 0x08f8, 0x08f4, 0x08f0, 0x01c9, 0x01c9, 0x01ca}, - { - 147, 5735, 0x03, 0x01, 0x02, 0x04, 0x7b, 0x05, 0x05, 0x02, 0x15, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x08fa, 0x08f6, 0x08f2, 0x01c8, 0x01c9, 0x01ca}, - { - 148, 5740, 0x0a, 0x01, 0x01, 0x02, 0x3e, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x08fc, 0x08f8, 0x08f4, 0x01c8, 0x01c9, 0x01c9}, - { - 149, 5745, 0xfe, 0x00, 0x02, 0x04, 0x7d, 0x05, 0x05, 0x02, 0x15, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x30, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x06, 0x00, 0x6d, 0x00, 0x30, 0x00, 0x00, 0x00, 0x77, 0x00, 0x06, - 0x00, 0x6d, 0x00, 0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9}, - { - 150, 5750, 0x0a, 0x01, 0x01, 0x02, 0x3f, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6d, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6d, 0x00, 0x0900, 0x08fc, 0x08f8, 0x01c7, 0x01c8, 0x01c9}, - { - 151, 5755, 0xfe, 0x00, 0x02, 0x04, 0x7f, 0x05, 0x05, 0x02, 0x15, 0x01, - 0x05, 0x05, 0x05, 0x87, 0x05, 0x00, 0x10, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x0902, 0x08fe, 0x08fa, 0x01c7, 0x01c8, 0x01c8}, - { - 152, 5760, 0x0a, 0x01, 0x01, 0x02, 0x40, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, 0x10, 0x20, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x0904, 0x0900, 0x08fc, 0x01c6, 0x01c7, 0x01c8}, - { - 153, 5765, 0xf8, 0x00, 0x02, 0x04, 0x81, 0x05, 0x05, 0x02, 0x15, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x05, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6c, 0x00, 0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8}, - { - 154, 5770, 0x0a, 0x01, 0x01, 0x02, 0x41, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x0908, 0x0904, 0x0900, 0x01c6, 0x01c6, 0x01c7}, - { - 155, 5775, 0xf8, 0x00, 0x02, 0x04, 0x83, 0x05, 0x05, 0x02, 0x15, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x090a, 0x0906, 0x0902, 0x01c5, 0x01c6, 0x01c7}, - { - 156, 5780, 0x0a, 0x01, 0x01, 0x02, 0x42, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x05, 0x05, 0x05, 0x86, 0x04, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x090c, 0x0908, 0x0904, 0x01c5, 0x01c6, 0x01c6}, - { - 157, 5785, 0xf2, 0x00, 0x02, 0x04, 0x85, 0x05, 0x05, 0x02, 0x15, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6}, - { - 158, 5790, 0x0a, 0x01, 0x01, 0x02, 0x43, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x0910, 0x090c, 0x0908, 0x01c4, 0x01c5, 0x01c6}, - { - 159, 5795, 0xf2, 0x00, 0x02, 0x04, 0x87, 0x05, 0x05, 0x02, 0x15, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x0912, 0x090e, 0x090a, 0x01c4, 0x01c4, 0x01c5}, - { - 160, 5800, 0x0a, 0x01, 0x01, 0x02, 0x44, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6b, 0x00, 0x0914, 0x0910, 0x090c, 0x01c3, 0x01c4, 0x01c5}, - { - 161, 5805, 0xed, 0x00, 0x02, 0x04, 0x89, 0x05, 0x05, 0x02, 0x15, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4}, - { - 162, 5810, 0x0a, 0x01, 0x01, 0x02, 0x45, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x0918, 0x0914, 0x0910, 0x01c2, 0x01c3, 0x01c4}, - { - 163, 5815, 0xed, 0x00, 0x02, 0x04, 0x8b, 0x05, 0x05, 0x02, 0x15, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x091a, 0x0916, 0x0912, 0x01c2, 0x01c3, 0x01c4}, - { - 164, 5820, 0x0a, 0x01, 0x01, 0x02, 0x46, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x6a, 0x00, 0x091c, 0x0918, 0x0914, 0x01c2, 0x01c2, 0x01c3}, - { - 165, 5825, 0xed, 0x00, 0x02, 0x04, 0x8d, 0x05, 0x05, 0x02, 0x15, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x69, 0x00, 0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3}, - { - 166, 5830, 0x0a, 0x01, 0x01, 0x02, 0x47, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x05, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x05, - 0x00, 0x69, 0x00, 0x0920, 0x091c, 0x0918, 0x01c1, 0x01c2, 0x01c2}, - { - 168, 5840, 0x0a, 0x01, 0x01, 0x02, 0x48, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x86, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x0924, 0x0920, 0x091c, 0x01c0, 0x01c1, 0x01c2}, - { - 170, 5850, 0xe0, 0x00, 0x01, 0x02, 0x49, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x0928, 0x0924, 0x0920, 0x01bf, 0x01c0, 0x01c1}, - { - 172, 5860, 0xde, 0x00, 0x01, 0x02, 0x4a, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x69, 0x00, 0x092c, 0x0928, 0x0924, 0x01bf, 0x01bf, 0x01c0}, - { - 174, 5870, 0xdb, 0x00, 0x01, 0x02, 0x4b, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x0930, 0x092c, 0x0928, 0x01be, 0x01bf, 0x01bf}, - { - 176, 5880, 0xd8, 0x00, 0x01, 0x02, 0x4c, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x0934, 0x0930, 0x092c, 0x01bd, 0x01be, 0x01bf}, - { - 178, 5890, 0xd6, 0x00, 0x01, 0x02, 0x4d, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x0938, 0x0934, 0x0930, 0x01bc, 0x01bd, 0x01be}, - { - 180, 5900, 0xd3, 0x00, 0x01, 0x02, 0x4e, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x093c, 0x0938, 0x0934, 0x01bc, 0x01bc, 0x01bd}, - { - 182, 5910, 0xd6, 0x00, 0x01, 0x02, 0x4f, 0x05, 0x05, 0x02, 0x0c, 0x01, - 0x06, 0x06, 0x06, 0x85, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, - 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x04, - 0x00, 0x68, 0x00, 0x0940, 0x093c, 0x0938, 0x01bb, 0x01bc, 0x01bc}, - { - 1, 2412, 0x00, 0x01, 0x03, 0x09, 0x6c, 0x06, 0x06, 0x04, 0x2b, 0x01, - 0x04, 0x04, 0x04, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443}, - { - 2, 2417, 0x00, 0x01, 0x03, 0x09, 0x71, 0x06, 0x06, 0x04, 0x2b, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x78, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441}, - { - 3, 2422, 0x00, 0x01, 0x03, 0x09, 0x76, 0x06, 0x06, 0x04, 0x2b, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x67, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0b, 0x00, 0x0a, 0x00, 0x89, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0b, 0x00, 0x0a, 0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f}, - { - 4, 2427, 0x00, 0x01, 0x03, 0x09, 0x7b, 0x06, 0x06, 0x04, 0x2b, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x57, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x78, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d}, - { - 5, 2432, 0x00, 0x01, 0x03, 0x09, 0x80, 0x06, 0x06, 0x04, 0x2b, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x56, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x77, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a}, - { - 6, 2437, 0x00, 0x01, 0x03, 0x09, 0x85, 0x06, 0x06, 0x04, 0x2b, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x46, 0x00, 0x03, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x76, 0x00, 0x03, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438}, - { - 7, 2442, 0x00, 0x01, 0x03, 0x09, 0x8a, 0x06, 0x06, 0x04, 0x2b, 0x01, - 0x05, 0x05, 0x05, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x45, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x66, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x0a, 0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436}, - { - 8, 2447, 0x00, 0x01, 0x03, 0x09, 0x8f, 0x06, 0x06, 0x04, 0x2b, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x34, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x55, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434}, - { - 9, 2452, 0x00, 0x01, 0x03, 0x09, 0x94, 0x06, 0x06, 0x04, 0x2b, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x23, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x45, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431}, - { - 10, 2457, 0x00, 0x01, 0x03, 0x09, 0x99, 0x06, 0x06, 0x04, 0x2b, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x12, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x0a, 0x00, 0x09, 0x00, 0x34, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x0a, 0x00, 0x09, 0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f}, - { - 11, 2462, 0x00, 0x01, 0x03, 0x09, 0x9e, 0x06, 0x06, 0x04, 0x2b, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09, 0x00, 0x33, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d}, - { - 12, 2467, 0x00, 0x01, 0x03, 0x09, 0xa3, 0x06, 0x06, 0x04, 0x2b, 0x01, - 0x06, 0x06, 0x06, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09, 0x00, 0x22, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b}, - { - 13, 2472, 0x00, 0x01, 0x03, 0x09, 0xa8, 0x06, 0x06, 0x04, 0x2b, 0x01, - 0x07, 0x07, 0x07, 0x8f, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09, 0x00, 0x11, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429}, - { - 14, 2484, 0xff, 0x01, 0x03, 0x09, 0xb4, 0x06, 0x06, 0x04, 0x2b, 0x01, - 0x07, 0x07, 0x07, 0x8f, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, - 0x70, 0x00, 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x70, 0x00, - 0x09, 0x00, 0x09, 0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424} -}; - -static const struct chan_info_nphy_radio2057 chan_info_nphyrev7_2057_rev4[] = { - { - 184, 4920, 0x68, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xec, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x07b4, 0x07b0, 0x07ac, 0x0214, - 0x0215, - 0x0216, - }, - { - 186, 4930, 0x6b, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xed, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x07b8, 0x07b4, 0x07b0, 0x0213, - 0x0214, - 0x0215, - }, - { - 188, 4940, 0x6e, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xee, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x07bc, 0x07b8, 0x07b4, 0x0212, - 0x0213, - 0x0214, - }, - { - 190, 4950, 0x72, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xef, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x07c0, 0x07bc, 0x07b8, 0x0211, - 0x0212, - 0x0213, - }, - { - 192, 4960, 0x75, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf0, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x07c4, 0x07c0, 0x07bc, 0x020f, - 0x0211, - 0x0212, - }, - { - 194, 4970, 0x78, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf1, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x07c8, 0x07c4, 0x07c0, 0x020e, - 0x020f, - 0x0211, - }, - { - 196, 4980, 0x7c, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf2, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x07cc, 0x07c8, 0x07c4, 0x020d, - 0x020e, - 0x020f, - }, - { - 198, 4990, 0x7f, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf3, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x07d0, 0x07cc, 0x07c8, 0x020c, - 0x020d, - 0x020e, - }, - { - 200, 5000, 0x82, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf4, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x07d4, 0x07d0, 0x07cc, 0x020b, - 0x020c, - 0x020d, - }, - { - 202, 5010, 0x86, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf5, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x07d8, 0x07d4, 0x07d0, 0x020a, - 0x020b, - 0x020c, - }, - { - 204, 5020, 0x89, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf6, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x07dc, 0x07d8, 0x07d4, 0x0209, - 0x020a, - 0x020b, - }, - { - 206, 5030, 0x8c, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf7, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x07e0, 0x07dc, 0x07d8, 0x0208, - 0x0209, - 0x020a, - }, - { - 208, 5040, 0x90, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf8, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x07e4, 0x07e0, 0x07dc, 0x0207, - 0x0208, - 0x0209, - }, - { - 210, 5050, 0x93, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf9, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xf3, 0x00, 0xef, 0x07e8, 0x07e4, 0x07e0, 0x0206, - 0x0207, - 0x0208, - }, - { - 212, 5060, 0x96, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfa, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xe3, 0x00, 0xef, 0x00, - 0x00, 0x0f, 0x0f, 0xe3, 0x00, 0xef, 0x07ec, 0x07e8, 0x07e4, 0x0205, - 0x0206, - 0x0207, - }, - { - 214, 5070, 0x9a, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfb, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0e, 0x0f, 0xe3, 0x00, 0xef, 0x00, - 0x00, 0x0e, 0x0f, 0xe3, 0x00, 0xef, 0x07f0, 0x07ec, 0x07e8, 0x0204, - 0x0205, - 0x0206, - }, - { - 216, 5080, 0x9d, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfc, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0e, 0x0f, 0xe3, 0x00, 0xef, 0x00, - 0x00, 0x0e, 0x0f, 0xe3, 0x00, 0xef, 0x07f4, 0x07f0, 0x07ec, 0x0203, - 0x0204, - 0x0205, - }, - { - 218, 5090, 0xa0, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfd, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0e, 0x0f, 0xe3, 0x00, 0xd6, 0x00, - 0x00, 0x0e, 0x0f, 0xe3, 0x00, 0xd6, 0x07f8, 0x07f4, 0x07f0, 0x0202, - 0x0203, - 0x0204, - }, - { - 220, 5100, 0xa4, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfe, 0x01, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0e, 0x0f, 0xe3, 0x00, 0xd6, 0x00, - 0x00, 0x0e, 0x0f, 0xe3, 0x00, 0xd6, 0x07fc, 0x07f8, 0x07f4, 0x0201, - 0x0202, - 0x0203, - }, - { - 222, 5110, 0xa7, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xff, 0x01, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0e, 0x0f, 0xe3, 0x00, 0xd6, 0x00, - 0x00, 0x0e, 0x0f, 0xe3, 0x00, 0xd6, 0x0800, 0x07fc, 0x07f8, 0x0200, - 0x0201, - 0x0202, - }, - { - 224, 5120, 0xaa, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x00, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0e, 0x0f, 0xe3, 0x00, 0xd6, 0x00, - 0x00, 0x0e, 0x0f, 0xe3, 0x00, 0xd6, 0x0804, 0x0800, 0x07fc, 0x01ff, - 0x0200, - 0x0201, - }, - { - 226, 5130, 0xae, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x01, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0e, 0x0f, 0xe3, 0x00, 0xd6, 0x00, - 0x00, 0x0e, 0x0f, 0xe3, 0x00, 0xd6, 0x0808, 0x0804, 0x0800, 0x01fe, - 0x01ff, - 0x0200, - }, - { - 228, 5140, 0xb1, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x02, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0e, 0x0e, 0xe3, 0x00, 0xd6, 0x00, - 0x00, 0x0e, 0x0e, 0xe3, 0x00, 0xd6, 0x080c, 0x0808, 0x0804, 0x01fd, - 0x01fe, - 0x01ff, - }, - { - 32, 5160, 0xb8, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x04, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0d, 0x0e, 0xe3, 0x00, 0xd6, 0x00, - 0x00, 0x0d, 0x0e, 0xe3, 0x00, 0xd6, 0x0814, 0x0810, 0x080c, 0x01fb, - 0x01fc, - 0x01fd, - }, - { - 34, 5170, 0xbb, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x05, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0d, 0x0e, 0xe3, 0x00, 0xd6, 0x00, - 0x00, 0x0d, 0x0e, 0xe3, 0x00, 0xd6, 0x0818, 0x0814, 0x0810, 0x01fa, - 0x01fb, - 0x01fc, - }, - { - 36, 5180, 0xbe, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x06, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0d, 0x0e, 0xd3, 0x00, 0xd6, 0x00, - 0x00, 0x0d, 0x0e, 0xd3, 0x00, 0xd6, 0x081c, 0x0818, 0x0814, 0x01f9, - 0x01fa, - 0x01fb, - }, - { - 38, 5190, 0xc2, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x07, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0d, 0x0e, 0xd3, 0x00, 0xd6, 0x00, - 0x00, 0x0d, 0x0e, 0xd3, 0x00, 0xd6, 0x0820, 0x081c, 0x0818, 0x01f8, - 0x01f9, - 0x01fa, - }, - { - 40, 5200, 0xc5, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x08, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0d, 0x0e, 0xd3, 0x00, 0xd6, 0x00, - 0x00, 0x0d, 0x0e, 0xd3, 0x00, 0xd6, 0x0824, 0x0820, 0x081c, 0x01f7, - 0x01f8, - 0x01f9, - }, - { - 42, 5210, 0xc8, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x09, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0d, 0x0e, 0xd3, 0x00, 0xd6, 0x00, - 0x00, 0x0d, 0x0e, 0xd3, 0x00, 0xd6, 0x0828, 0x0824, 0x0820, 0x01f6, - 0x01f7, - 0x01f8, - }, - { - 44, 5220, 0xcc, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0a, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0c, 0x0e, 0xd3, 0x00, 0xd6, 0x00, - 0x00, 0x0c, 0x0e, 0xd3, 0x00, 0xd6, 0x082c, 0x0828, 0x0824, 0x01f5, - 0x01f6, - 0x01f7, - }, - { - 46, 5230, 0xcf, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0b, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0c, 0x0e, 0xd3, 0x00, 0xd6, 0x00, - 0x00, 0x0c, 0x0e, 0xd3, 0x00, 0xd6, 0x0830, 0x082c, 0x0828, 0x01f4, - 0x01f5, - 0x01f6, - }, - { - 48, 5240, 0xd2, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0c, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0c, 0x0e, 0xd3, 0x00, 0xd6, 0x00, - 0x00, 0x0c, 0x0e, 0xd3, 0x00, 0xd6, 0x0834, 0x0830, 0x082c, 0x01f3, - 0x01f4, - 0x01f5, - }, - { - 50, 5250, 0xd6, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0d, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0c, 0x0e, 0xd3, 0x00, 0xd6, 0x00, - 0x00, 0x0c, 0x0e, 0xd3, 0x00, 0xd6, 0x0838, 0x0834, 0x0830, 0x01f2, - 0x01f3, - 0x01f4, - }, - { - 52, 5260, 0xd9, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0e, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0c, 0x0d, 0xd3, 0x00, 0xd6, 0x00, - 0x00, 0x0c, 0x0d, 0xd3, 0x00, 0xd6, 0x083c, 0x0838, 0x0834, 0x01f1, - 0x01f2, - 0x01f3, - }, - { - 54, 5270, 0xdc, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0f, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0c, 0x0d, 0xd3, 0x00, 0xd6, 0x00, - 0x00, 0x0c, 0x0d, 0xd3, 0x00, 0xd6, 0x0840, 0x083c, 0x0838, 0x01f0, - 0x01f1, - 0x01f2, - }, - { - 56, 5280, 0xe0, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x10, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0c, 0x0c, 0xc3, 0x00, 0xd4, 0x00, - 0x00, 0x0c, 0x0c, 0xc3, 0x00, 0xd4, 0x0844, 0x0840, 0x083c, 0x01f0, - 0x01f0, - 0x01f1, - }, - { - 58, 5290, 0xe3, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x11, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0c, 0x0c, 0xc3, 0x00, 0xd4, 0x00, - 0x00, 0x0c, 0x0c, 0xc3, 0x00, 0xd4, 0x0848, 0x0844, 0x0840, 0x01ef, - 0x01f0, - 0x01f0, - }, - { - 60, 5300, 0xe6, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x12, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0c, 0x0c, 0xc3, 0x00, 0xd4, 0x00, - 0x00, 0x0c, 0x0c, 0xc3, 0x00, 0xd4, 0x084c, 0x0848, 0x0844, 0x01ee, - 0x01ef, - 0x01f0, - }, - { - 62, 5310, 0xea, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x13, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0b, 0x0c, 0xc3, 0x00, 0xd4, 0x00, - 0x00, 0x0b, 0x0c, 0xc3, 0x00, 0xd4, 0x0850, 0x084c, 0x0848, 0x01ed, - 0x01ee, - 0x01ef, - }, - { - 64, 5320, 0xed, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x14, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0b, 0x0c, 0xc3, 0x00, 0xd4, 0x00, - 0x00, 0x0b, 0x0c, 0xc3, 0x00, 0xd4, 0x0854, 0x0850, 0x084c, 0x01ec, - 0x01ed, - 0x01ee, - }, - { - 66, 5330, 0xf0, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x15, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0b, 0x0c, 0xc3, 0x00, 0xd4, 0x00, - 0x00, 0x0b, 0x0c, 0xc3, 0x00, 0xd4, 0x0858, 0x0854, 0x0850, 0x01eb, - 0x01ec, - 0x01ed, - }, - { - 68, 5340, 0xf4, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x16, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0a, 0x0c, 0xc3, 0x00, 0xa1, 0x00, - 0x00, 0x0a, 0x0c, 0xc3, 0x00, 0xa1, 0x085c, 0x0858, 0x0854, 0x01ea, - 0x01eb, - 0x01ec, - }, - { - 70, 5350, 0xf7, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x17, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0a, 0x0b, 0xb3, 0x00, 0xa1, 0x00, - 0x00, 0x0a, 0x0b, 0xb3, 0x00, 0xa1, 0x0860, 0x085c, 0x0858, 0x01e9, - 0x01ea, - 0x01eb, - }, - { - 72, 5360, 0xfa, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x18, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0a, 0x0b, 0xb3, 0x00, 0xa1, 0x00, - 0x00, 0x0a, 0x0b, 0xb3, 0x00, 0xa1, 0x0864, 0x0860, 0x085c, 0x01e8, - 0x01e9, - 0x01ea, - }, - { - 74, 5370, 0xfe, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x19, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0a, 0x0b, 0xb3, 0x00, 0xa1, 0x00, - 0x00, 0x0a, 0x0b, 0xb3, 0x00, 0xa1, 0x0868, 0x0864, 0x0860, 0x01e7, - 0x01e8, - 0x01e9, - }, - { - 76, 5380, 0x01, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1a, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0a, 0x0b, 0xb3, 0x00, 0xa1, 0x00, - 0x00, 0x0a, 0x0b, 0xb3, 0x00, 0xa1, 0x086c, 0x0868, 0x0864, 0x01e6, - 0x01e7, - 0x01e8, - }, - { - 78, 5390, 0x04, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1b, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0a, 0x0a, 0xa3, 0x00, 0xa1, 0x00, - 0x00, 0x0a, 0x0a, 0xa3, 0x00, 0xa1, 0x0870, 0x086c, 0x0868, 0x01e5, - 0x01e6, - 0x01e7, - }, - { - 80, 5400, 0x08, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1c, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x09, 0x0a, 0xa3, 0x00, 0x90, 0x00, - 0x00, 0x09, 0x0a, 0xa3, 0x00, 0x90, 0x0874, 0x0870, 0x086c, 0x01e5, - 0x01e5, - 0x01e6, - }, - { - 82, 5410, 0x0b, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1d, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x09, 0x0a, 0xa3, 0x00, 0x90, 0x00, - 0x00, 0x09, 0x0a, 0xa3, 0x00, 0x90, 0x0878, 0x0874, 0x0870, 0x01e4, - 0x01e5, - 0x01e5, - }, - { - 84, 5420, 0x0e, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1e, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x09, 0x09, 0xa3, 0x00, 0x90, 0x00, - 0x00, 0x09, 0x09, 0xa3, 0x00, 0x90, 0x087c, 0x0878, 0x0874, 0x01e3, - 0x01e4, - 0x01e5, - }, - { - 86, 5430, 0x12, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1f, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x09, 0x09, 0x93, 0x00, 0x90, 0x00, - 0x00, 0x09, 0x09, 0x93, 0x00, 0x90, 0x0880, 0x087c, 0x0878, 0x01e2, - 0x01e3, - 0x01e4, - }, - { - 88, 5440, 0x15, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x20, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x09, 0x09, 0x93, 0x00, 0x90, 0x00, - 0x00, 0x09, 0x09, 0x93, 0x00, 0x90, 0x0884, 0x0880, 0x087c, 0x01e1, - 0x01e2, - 0x01e3, - }, - { - 90, 5450, 0x18, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x21, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x09, 0x09, 0x93, 0x00, 0x90, 0x00, - 0x00, 0x09, 0x09, 0x93, 0x00, 0x90, 0x0888, 0x0884, 0x0880, 0x01e0, - 0x01e1, - 0x01e2, - }, - { - 92, 5460, 0x1c, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x22, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x08, 0x08, 0x93, 0x00, 0x90, 0x00, - 0x00, 0x08, 0x08, 0x93, 0x00, 0x90, 0x088c, 0x0888, 0x0884, 0x01df, - 0x01e0, - 0x01e1, - }, - { - 94, 5470, 0x1f, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x23, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x08, 0x08, 0x93, 0x00, 0x60, 0x00, - 0x00, 0x08, 0x08, 0x93, 0x00, 0x60, 0x0890, 0x088c, 0x0888, 0x01de, - 0x01df, - 0x01e0, - }, - { - 96, 5480, 0x22, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x24, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x08, 0x07, 0x93, 0x00, 0x60, 0x00, - 0x00, 0x08, 0x07, 0x93, 0x00, 0x60, 0x0894, 0x0890, 0x088c, 0x01dd, - 0x01de, - 0x01df, - }, - { - 98, 5490, 0x26, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x25, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x08, 0x07, 0x93, 0x00, 0x60, 0x00, - 0x00, 0x08, 0x07, 0x93, 0x00, 0x60, 0x0898, 0x0894, 0x0890, 0x01dd, - 0x01dd, - 0x01de, - }, - { - 100, 5500, 0x29, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x26, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x08, 0x07, 0x93, 0x00, 0x60, 0x00, - 0x00, 0x08, 0x07, 0x93, 0x00, 0x60, 0x089c, 0x0898, 0x0894, 0x01dc, - 0x01dd, - 0x01dd, - }, - { - 102, 5510, 0x2c, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x27, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x08, 0x07, 0x93, 0x00, 0x60, 0x00, - 0x00, 0x08, 0x07, 0x93, 0x00, 0x60, 0x08a0, 0x089c, 0x0898, 0x01db, - 0x01dc, - 0x01dd, - }, - { - 104, 5520, 0x30, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x28, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x08, 0x06, 0x93, 0x00, 0x60, 0x00, - 0x00, 0x08, 0x06, 0x93, 0x00, 0x60, 0x08a4, 0x08a0, 0x089c, 0x01da, - 0x01db, - 0x01dc, - }, - { - 106, 5530, 0x33, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x29, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x08, 0x06, 0x93, 0x00, 0x60, 0x00, - 0x00, 0x08, 0x06, 0x93, 0x00, 0x60, 0x08a8, 0x08a4, 0x08a0, 0x01d9, - 0x01da, - 0x01db, - }, - { - 108, 5540, 0x36, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2a, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x08, 0x06, 0x93, 0x00, 0x60, 0x00, - 0x00, 0x08, 0x06, 0x93, 0x00, 0x60, 0x08ac, 0x08a8, 0x08a4, 0x01d8, - 0x01d9, - 0x01da, - }, - { - 110, 5550, 0x3a, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2b, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x08, 0x05, 0x83, 0x00, 0x60, 0x00, - 0x00, 0x08, 0x05, 0x83, 0x00, 0x60, 0x08b0, 0x08ac, 0x08a8, 0x01d7, - 0x01d8, - 0x01d9, - }, - { - 112, 5560, 0x3d, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2c, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x08, 0x05, 0x83, 0x00, 0x60, 0x00, - 0x00, 0x08, 0x05, 0x83, 0x00, 0x60, 0x08b4, 0x08b0, 0x08ac, 0x01d7, - 0x01d7, - 0x01d8, - }, - { - 114, 5570, 0x40, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2d, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x08, 0x05, 0x83, 0x00, 0x60, 0x00, - 0x00, 0x08, 0x05, 0x83, 0x00, 0x60, 0x08b8, 0x08b4, 0x08b0, 0x01d6, - 0x01d7, - 0x01d7, - }, - { - 116, 5580, 0x44, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2e, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x07, 0x05, 0x83, 0x00, 0x60, 0x00, - 0x00, 0x07, 0x05, 0x83, 0x00, 0x60, 0x08bc, 0x08b8, 0x08b4, 0x01d5, - 0x01d6, - 0x01d7, - }, - { - 118, 5590, 0x47, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2f, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x07, 0x04, 0x83, 0x00, 0x60, 0x00, - 0x00, 0x07, 0x04, 0x83, 0x00, 0x60, 0x08c0, 0x08bc, 0x08b8, 0x01d4, - 0x01d5, - 0x01d6, - }, - { - 120, 5600, 0x4a, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x30, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x07, 0x04, 0x73, 0x00, 0x30, 0x00, - 0x00, 0x07, 0x04, 0x73, 0x00, 0x30, 0x08c4, 0x08c0, 0x08bc, 0x01d3, - 0x01d4, - 0x01d5, - }, - { - 122, 5610, 0x4e, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x31, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x06, 0x04, 0x73, 0x00, 0x30, 0x00, - 0x00, 0x06, 0x04, 0x73, 0x00, 0x30, 0x08c8, 0x08c4, 0x08c0, 0x01d2, - 0x01d3, - 0x01d4, - }, - { - 124, 5620, 0x51, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x32, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x06, 0x04, 0x73, 0x00, 0x30, 0x00, - 0x00, 0x06, 0x04, 0x73, 0x00, 0x30, 0x08cc, 0x08c8, 0x08c4, 0x01d2, - 0x01d2, - 0x01d3, - }, - { - 126, 5630, 0x54, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x33, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x06, 0x04, 0x73, 0x00, 0x30, 0x00, - 0x00, 0x06, 0x04, 0x73, 0x00, 0x30, 0x08d0, 0x08cc, 0x08c8, 0x01d1, - 0x01d2, - 0x01d2, - }, - { - 128, 5640, 0x58, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x34, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x06, 0x04, 0x73, 0x00, 0x30, 0x00, - 0x00, 0x06, 0x04, 0x73, 0x00, 0x30, 0x08d4, 0x08d0, 0x08cc, 0x01d0, - 0x01d1, - 0x01d2, - }, - { - 130, 5650, 0x5b, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x35, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x06, 0x03, 0x63, 0x00, 0x30, 0x00, - 0x00, 0x06, 0x03, 0x63, 0x00, 0x30, 0x08d8, 0x08d4, 0x08d0, 0x01cf, - 0x01d0, - 0x01d1, - }, - { - 132, 5660, 0x5e, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x36, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x06, 0x03, 0x63, 0x00, 0x30, 0x00, - 0x00, 0x06, 0x03, 0x63, 0x00, 0x30, 0x08dc, 0x08d8, 0x08d4, 0x01ce, - 0x01cf, - 0x01d0, - }, - { - 134, 5670, 0x62, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x37, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x05, 0x03, 0x63, 0x00, 0x00, 0x00, - 0x00, 0x05, 0x03, 0x63, 0x00, 0x00, 0x08e0, 0x08dc, 0x08d8, 0x01ce, - 0x01ce, - 0x01cf, - }, - { - 136, 5680, 0x65, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x38, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x05, 0x02, 0x53, 0x00, 0x00, 0x00, - 0x00, 0x05, 0x02, 0x53, 0x00, 0x00, 0x08e4, 0x08e0, 0x08dc, 0x01cd, - 0x01ce, - 0x01ce, - }, - { - 138, 5690, 0x68, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x39, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x05, 0x02, 0x53, 0x00, 0x00, 0x00, - 0x00, 0x05, 0x02, 0x53, 0x00, 0x00, 0x08e8, 0x08e4, 0x08e0, 0x01cc, - 0x01cd, - 0x01ce, - }, - { - 140, 5700, 0x6c, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3a, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x05, 0x02, 0x53, 0x00, 0x00, 0x00, - 0x00, 0x05, 0x02, 0x53, 0x00, 0x00, 0x08ec, 0x08e8, 0x08e4, 0x01cb, - 0x01cc, - 0x01cd, - }, - { - 142, 5710, 0x6f, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3b, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x05, 0x02, 0x53, 0x00, 0x00, 0x00, - 0x00, 0x05, 0x02, 0x53, 0x00, 0x00, 0x08f0, 0x08ec, 0x08e8, 0x01ca, - 0x01cb, - 0x01cc, - }, - { - 144, 5720, 0x72, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3c, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x05, 0x02, 0x53, 0x00, 0x00, 0x00, - 0x00, 0x05, 0x02, 0x53, 0x00, 0x00, 0x08f4, 0x08f0, 0x08ec, 0x01c9, - 0x01ca, - 0x01cb, - }, - { - 145, 5725, 0x74, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x79, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x05, 0x01, 0x53, 0x00, 0x00, 0x00, - 0x00, 0x05, 0x01, 0x53, 0x00, 0x00, 0x08f6, 0x08f2, 0x08ee, 0x01c9, - 0x01ca, - 0x01cb, - }, - { - 146, 5730, 0x76, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3d, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x04, 0x01, 0x53, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x01, 0x53, 0x00, 0x00, 0x08f8, 0x08f4, 0x08f0, 0x01c9, - 0x01c9, - 0x01ca, - }, - { - 147, 5735, 0x77, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x7b, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x04, 0x01, 0x53, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x01, 0x53, 0x00, 0x00, 0x08fa, 0x08f6, 0x08f2, 0x01c8, - 0x01c9, - 0x01ca, - }, - { - 148, 5740, 0x79, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3e, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x04, 0x01, 0x53, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x01, 0x53, 0x00, 0x00, 0x08fc, 0x08f8, 0x08f4, 0x01c8, - 0x01c9, - 0x01c9, - }, - { - 149, 5745, 0x7b, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x7d, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x04, 0x01, 0x53, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x01, 0x53, 0x00, 0x00, 0x08fe, 0x08fa, 0x08f6, 0x01c8, - 0x01c8, - 0x01c9, - }, - { - 150, 5750, 0x7c, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3f, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x04, 0x01, 0x53, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x01, 0x53, 0x00, 0x00, 0x0900, 0x08fc, 0x08f8, 0x01c7, - 0x01c8, - 0x01c9, - }, - { - 151, 5755, 0x7e, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x7f, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x04, 0x01, 0x53, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x01, 0x53, 0x00, 0x00, 0x0902, 0x08fe, 0x08fa, 0x01c7, - 0x01c8, - 0x01c8, - }, - { - 152, 5760, 0x80, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x40, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x04, 0x01, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x01, 0x43, 0x00, 0x00, 0x0904, 0x0900, 0x08fc, 0x01c6, - 0x01c7, - 0x01c8, - }, - { - 153, 5765, 0x81, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x81, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x04, 0x01, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x01, 0x43, 0x00, 0x00, 0x0906, 0x0902, 0x08fe, 0x01c6, - 0x01c7, - 0x01c8, - }, - { - 154, 5770, 0x83, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x41, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x04, 0x01, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x01, 0x43, 0x00, 0x00, 0x0908, 0x0904, 0x0900, 0x01c6, - 0x01c6, - 0x01c7, - }, - { - 155, 5775, 0x85, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x83, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x04, 0x01, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x01, 0x43, 0x00, 0x00, 0x090a, 0x0906, 0x0902, 0x01c5, - 0x01c6, - 0x01c7, - }, - { - 156, 5780, 0x86, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x42, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x03, 0x01, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x01, 0x43, 0x00, 0x00, 0x090c, 0x0908, 0x0904, 0x01c5, - 0x01c6, - 0x01c6, - }, - { - 157, 5785, 0x88, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x85, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x090e, 0x090a, 0x0906, 0x01c4, - 0x01c5, - 0x01c6, - }, - { - 158, 5790, 0x8a, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x43, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x0910, 0x090c, 0x0908, 0x01c4, - 0x01c5, - 0x01c6, - }, - { - 159, 5795, 0x8b, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x87, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x0912, 0x090e, 0x090a, 0x01c4, - 0x01c4, - 0x01c5, - }, - { - 160, 5800, 0x8d, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x44, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x0914, 0x0910, 0x090c, 0x01c3, - 0x01c4, - 0x01c5, - }, - { - 161, 5805, 0x8f, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x89, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x0916, 0x0912, 0x090e, 0x01c3, - 0x01c4, - 0x01c4, - }, - { - 162, 5810, 0x90, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x45, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x0918, 0x0914, 0x0910, 0x01c2, - 0x01c3, - 0x01c4, - }, - { - 163, 5815, 0x92, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x8b, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x091a, 0x0916, 0x0912, 0x01c2, - 0x01c3, - 0x01c4, - }, - { - 164, 5820, 0x94, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x46, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x091c, 0x0918, 0x0914, 0x01c2, - 0x01c2, - 0x01c3, - }, - { - 165, 5825, 0x95, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x8d, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x091e, 0x091a, 0x0916, 0x01c1, - 0x01c2, - 0x01c3, - }, - { - 166, 5830, 0x97, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x47, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x0920, 0x091c, 0x0918, 0x01c1, - 0x01c2, - 0x01c2, - }, - { - 168, 5840, 0x9a, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x48, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x0924, 0x0920, 0x091c, 0x01c0, - 0x01c1, - 0x01c2, - }, - { - 170, 5850, 0x9e, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x49, 0x02, 0x04, - 0x00, 0x04, 0x00, 0x44, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x0928, 0x0924, 0x0920, 0x01bf, - 0x01c0, - 0x01c1, - }, - { - 172, 5860, 0xa1, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4a, 0x02, 0x04, - 0x00, 0x04, 0x00, 0x44, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x092c, 0x0928, 0x0924, 0x01bf, - 0x01bf, - 0x01c0, - }, - { - 174, 5870, 0xa4, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4b, 0x02, 0x04, - 0x00, 0x04, 0x00, 0x44, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x0930, 0x092c, 0x0928, 0x01be, - 0x01bf, - 0x01bf, - }, - { - 176, 5880, 0xa8, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4c, 0x02, 0x03, - 0x00, 0x03, 0x00, 0x33, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x0934, 0x0930, 0x092c, 0x01bd, - 0x01be, - 0x01bf, - }, - { - 178, 5890, 0xab, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4d, 0x02, 0x03, - 0x00, 0x03, 0x00, 0x33, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x0938, 0x0934, 0x0930, 0x01bc, - 0x01bd, - 0x01be, - }, - { - 180, 5900, 0xae, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4e, 0x02, 0x03, - 0x00, 0x03, 0x00, 0x33, 0x00, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x093c, 0x0938, 0x0934, 0x01bc, - 0x01bc, - 0x01bd, - }, - { - 1, 2412, 0x48, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x6c, 0x09, 0x0f, - 0x0a, 0x00, 0x0a, 0x00, 0x71, 0xa3, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x71, - 0xa3, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03c9, 0x03c5, 0x03c1, 0x043a, - 0x043f, - 0x0443, - }, - { - 2, 2417, 0x4b, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x71, 0x09, 0x0f, - 0x0a, 0x00, 0x0a, 0x00, 0x71, 0xa3, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x71, - 0xa3, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03cb, 0x03c7, 0x03c3, 0x0438, - 0x043d, - 0x0441, - }, - { - 3, 2422, 0x4e, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x76, 0x09, 0x0f, - 0x09, 0x00, 0x09, 0x00, 0x71, 0x93, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x71, - 0x93, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03cd, 0x03c9, 0x03c5, 0x0436, - 0x043a, - 0x043f, - }, - { - 4, 2427, 0x52, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x7b, 0x09, 0x0f, - 0x09, 0x00, 0x09, 0x00, 0x71, 0x93, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x71, - 0x93, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03cf, 0x03cb, 0x03c7, 0x0434, - 0x0438, - 0x043d, - }, - { - 5, 2432, 0x55, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x80, 0x09, 0x0f, - 0x08, 0x00, 0x08, 0x00, 0x51, 0x83, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x51, - 0x83, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d1, 0x03cd, 0x03c9, 0x0431, - 0x0436, - 0x043a, - }, - { - 6, 2437, 0x58, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x85, 0x09, 0x0f, - 0x08, 0x00, 0x08, 0x00, 0x51, 0x83, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x51, - 0x83, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d3, 0x03cf, 0x03cb, 0x042f, - 0x0434, - 0x0438, - }, - { - 7, 2442, 0x5c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8a, 0x09, 0x0f, - 0x07, 0x00, 0x07, 0x00, 0x51, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x51, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d5, 0x03d1, 0x03cd, 0x042d, - 0x0431, - 0x0436, - }, - { - 8, 2447, 0x5f, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8f, 0x09, 0x0f, - 0x07, 0x00, 0x07, 0x00, 0x31, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x31, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d7, 0x03d3, 0x03cf, 0x042b, - 0x042f, - 0x0434, - }, - { - 9, 2452, 0x62, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x94, 0x09, 0x0f, - 0x07, 0x00, 0x07, 0x00, 0x31, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x31, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d9, 0x03d5, 0x03d1, 0x0429, - 0x042d, - 0x0431, - }, - { - 10, 2457, 0x66, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x99, 0x09, 0x0f, - 0x06, 0x00, 0x06, 0x00, 0x31, 0x63, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x31, - 0x63, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03db, 0x03d7, 0x03d3, 0x0427, - 0x042b, - 0x042f, - }, - { - 11, 2462, 0x69, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x9e, 0x09, 0x0f, - 0x06, 0x00, 0x06, 0x00, 0x31, 0x63, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x31, - 0x63, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03dd, 0x03d9, 0x03d5, 0x0424, - 0x0429, - 0x042d, - }, - { - 12, 2467, 0x6c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa3, 0x09, 0x0f, - 0x05, 0x00, 0x05, 0x00, 0x11, 0x53, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x11, - 0x53, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03df, 0x03db, 0x03d7, 0x0422, - 0x0427, - 0x042b, - }, - { - 13, 2472, 0x70, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa8, 0x09, 0x0f, - 0x05, 0x00, 0x05, 0x00, 0x11, 0x53, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x11, - 0x53, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03e1, 0x03dd, 0x03d9, 0x0420, - 0x0424, - 0x0429, - }, - { - 14, 2484, 0x78, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xb4, 0x09, 0x0f, - 0x04, 0x00, 0x04, 0x00, 0x11, 0x43, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x11, - 0x43, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x03e6, 0x03e2, 0x03de, 0x041b, - 0x041f, - 0x0424} -}; - -static const struct chan_info_nphy_radio2057_rev5 -chan_info_nphyrev8_2057_rev5[] = { - { - 1, 2412, 0x48, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x6c, 0x09, 0x0d, - 0x08, 0x0e, 0x61, 0x03, 0xff, 0x61, 0x03, 0xff, 0x03c9, 0x03c5, 0x03c1, - 0x043a, 0x043f, 0x0443}, - { - 2, 2417, 0x4b, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x71, 0x09, 0x0d, - 0x08, 0x0e, 0x61, 0x03, 0xff, 0x61, 0x03, 0xff, 0x03cb, 0x03c7, 0x03c3, - 0x0438, 0x043d, 0x0441}, - { - 3, 2422, 0x4e, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x76, 0x09, 0x0d, - 0x08, 0x0e, 0x61, 0x03, 0xef, 0x61, 0x03, 0xef, 0x03cd, 0x03c9, 0x03c5, - 0x0436, 0x043a, 0x043f}, - { - 4, 2427, 0x52, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x7b, 0x09, 0x0c, - 0x08, 0x0e, 0x61, 0x03, 0xdf, 0x61, 0x03, 0xdf, 0x03cf, 0x03cb, 0x03c7, - 0x0434, 0x0438, 0x043d}, - { - 5, 2432, 0x55, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x80, 0x09, 0x0c, - 0x07, 0x0d, 0x61, 0x03, 0xcf, 0x61, 0x03, 0xcf, 0x03d1, 0x03cd, 0x03c9, - 0x0431, 0x0436, 0x043a}, - { - 6, 2437, 0x58, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x85, 0x09, 0x0c, - 0x07, 0x0d, 0x61, 0x03, 0xbf, 0x61, 0x03, 0xbf, 0x03d3, 0x03cf, 0x03cb, - 0x042f, 0x0434, 0x0438}, - { - 7, 2442, 0x5c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8a, 0x09, 0x0b, - 0x07, 0x0d, 0x61, 0x03, 0xaf, 0x61, 0x03, 0xaf, 0x03d5, 0x03d1, 0x03cd, - 0x042d, 0x0431, 0x0436}, - { - 8, 2447, 0x5f, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8f, 0x09, 0x0b, - 0x07, 0x0d, 0x61, 0x03, 0x9f, 0x61, 0x03, 0x9f, 0x03d7, 0x03d3, 0x03cf, - 0x042b, 0x042f, 0x0434}, - { - 9, 2452, 0x62, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x94, 0x09, 0x0b, - 0x07, 0x0d, 0x61, 0x03, 0x8f, 0x61, 0x03, 0x8f, 0x03d9, 0x03d5, 0x03d1, - 0x0429, 0x042d, 0x0431}, - { - 10, 2457, 0x66, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x99, 0x09, 0x0b, - 0x07, 0x0c, 0x61, 0x03, 0x7f, 0x61, 0x03, 0x7f, 0x03db, 0x03d7, 0x03d3, - 0x0427, 0x042b, 0x042f}, - { - 11, 2462, 0x69, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x9e, 0x09, 0x0b, - 0x07, 0x0c, 0x61, 0x03, 0x6f, 0x61, 0x03, 0x6f, 0x03dd, 0x03d9, 0x03d5, - 0x0424, 0x0429, 0x042d}, - { - 12, 2467, 0x6c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa3, 0x09, 0x0b, - 0x06, 0x0c, 0x61, 0x03, 0x5f, 0x61, 0x03, 0x5f, 0x03df, 0x03db, 0x03d7, - 0x0422, 0x0427, 0x042b}, - { - 13, 2472, 0x70, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa8, 0x09, 0x0a, - 0x06, 0x0b, 0x61, 0x03, 0x4f, 0x61, 0x03, 0x4f, 0x03e1, 0x03dd, 0x03d9, - 0x0420, 0x0424, 0x0429}, - { - 14, 2484, 0x78, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xb4, 0x09, 0x0a, - 0x06, 0x0b, 0x61, 0x03, 0x3f, 0x61, 0x03, 0x3f, 0x03e6, 0x03e2, 0x03de, - 0x041b, 0x041f, 0x0424} -}; - -static const struct chan_info_nphy_radio2057_rev5 -chan_info_nphyrev9_2057_rev5v1[] = { - { - 1, 2412, 0x48, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x6c, 0x09, 0x0d, - 0x08, 0x0e, 0x61, 0x03, 0xff, 0x61, 0x03, 0xff, 0x03c9, 0x03c5, 0x03c1, - 0x043a, 0x043f, 0x0443}, - { - 2, 2417, 0x4b, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x71, 0x09, 0x0d, - 0x08, 0x0e, 0x61, 0x03, 0xff, 0x61, 0x03, 0xff, 0x03cb, 0x03c7, 0x03c3, - 0x0438, 0x043d, 0x0441}, - { - 3, 2422, 0x4e, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x76, 0x09, 0x0d, - 0x08, 0x0e, 0x61, 0x03, 0xef, 0x61, 0x03, 0xef, 0x03cd, 0x03c9, 0x03c5, - 0x0436, 0x043a, 0x043f}, - { - 4, 2427, 0x52, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x7b, 0x09, 0x0c, - 0x08, 0x0e, 0x61, 0x03, 0xdf, 0x61, 0x03, 0xdf, 0x03cf, 0x03cb, 0x03c7, - 0x0434, 0x0438, 0x043d}, - { - 5, 2432, 0x55, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x80, 0x09, 0x0c, - 0x07, 0x0d, 0x61, 0x03, 0xcf, 0x61, 0x03, 0xcf, 0x03d1, 0x03cd, 0x03c9, - 0x0431, 0x0436, 0x043a}, - { - 6, 2437, 0x58, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x85, 0x09, 0x0c, - 0x07, 0x0d, 0x61, 0x03, 0xbf, 0x61, 0x03, 0xbf, 0x03d3, 0x03cf, 0x03cb, - 0x042f, 0x0434, 0x0438}, - { - 7, 2442, 0x5c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8a, 0x09, 0x0b, - 0x07, 0x0d, 0x61, 0x03, 0xaf, 0x61, 0x03, 0xaf, 0x03d5, 0x03d1, 0x03cd, - 0x042d, 0x0431, 0x0436}, - { - 8, 2447, 0x5f, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8f, 0x09, 0x0b, - 0x07, 0x0d, 0x61, 0x03, 0x9f, 0x61, 0x03, 0x9f, 0x03d7, 0x03d3, 0x03cf, - 0x042b, 0x042f, 0x0434}, - { - 9, 2452, 0x62, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x94, 0x09, 0x0b, - 0x07, 0x0d, 0x61, 0x03, 0x8f, 0x61, 0x03, 0x8f, 0x03d9, 0x03d5, 0x03d1, - 0x0429, 0x042d, 0x0431}, - { - 10, 2457, 0x66, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x99, 0x09, 0x0b, - 0x07, 0x0c, 0x61, 0x03, 0x7f, 0x61, 0x03, 0x7f, 0x03db, 0x03d7, 0x03d3, - 0x0427, 0x042b, 0x042f}, - { - 11, 2462, 0x69, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x9e, 0x09, 0x0b, - 0x07, 0x0c, 0x61, 0x03, 0x6f, 0x61, 0x03, 0x6f, 0x03dd, 0x03d9, 0x03d5, - 0x0424, 0x0429, 0x042d}, - { - 12, 2467, 0x6c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa3, 0x09, 0x0b, - 0x06, 0x0c, 0x61, 0x03, 0x5f, 0x61, 0x03, 0x5f, 0x03df, 0x03db, 0x03d7, - 0x0422, 0x0427, 0x042b}, - { - 13, 2472, 0x70, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa8, 0x09, 0x0a, - 0x06, 0x0b, 0x61, 0x03, 0x4f, 0x61, 0x03, 0x4f, 0x03e1, 0x03dd, 0x03d9, - 0x0420, 0x0424, 0x0429}, - { - 14, 2484, 0x78, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xb4, 0x09, 0x0a, - 0x06, 0x0b, 0x61, 0x03, 0x3f, 0x61, 0x03, 0x3f, 0x03e6, 0x03e2, 0x03de, - 0x041b, 0x041f, 0x0424} -}; - -static const struct chan_info_nphy_radio2057 chan_info_nphyrev8_2057_rev7[] = { - { - 184, 4920, 0x68, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xec, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xd3, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07b4, 0x07b0, 0x07ac, 0x0214, - 0x0215, - 0x0216}, - { - 186, 4930, 0x6b, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xed, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xd3, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07b8, 0x07b4, 0x07b0, 0x0213, - 0x0214, - 0x0215}, - { - 188, 4940, 0x6e, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xee, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xd3, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07bc, 0x07b8, 0x07b4, 0x0212, - 0x0213, - 0x0214}, - { - 190, 4950, 0x72, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xef, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07c0, 0x07bc, 0x07b8, 0x0211, - 0x0212, - 0x0213}, - { - 192, 4960, 0x75, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf0, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07c4, 0x07c0, 0x07bc, 0x020f, - 0x0211, - 0x0212}, - { - 194, 4970, 0x78, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf1, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07c8, 0x07c4, 0x07c0, 0x020e, - 0x020f, - 0x0211}, - { - 196, 4980, 0x7c, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf2, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07cc, 0x07c8, 0x07c4, 0x020d, - 0x020e, - 0x020f}, - { - 198, 4990, 0x7f, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf3, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07d0, 0x07cc, 0x07c8, 0x020c, - 0x020d, - 0x020e}, - { - 200, 5000, 0x82, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf4, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07d4, 0x07d0, 0x07cc, 0x020b, - 0x020c, - 0x020d}, - { - 202, 5010, 0x86, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf5, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07d8, 0x07d4, 0x07d0, 0x020a, - 0x020b, - 0x020c}, - { - 204, 5020, 0x89, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf6, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07dc, 0x07d8, 0x07d4, 0x0209, - 0x020a, - 0x020b}, - { - 206, 5030, 0x8c, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf7, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07e0, 0x07dc, 0x07d8, 0x0208, - 0x0209, - 0x020a}, - { - 208, 5040, 0x90, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf8, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07e4, 0x07e0, 0x07dc, 0x0207, - 0x0208, - 0x0209}, - { - 210, 5050, 0x93, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf9, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07e8, 0x07e4, 0x07e0, 0x0206, - 0x0207, - 0x0208}, - { - 212, 5060, 0x96, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfa, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07ec, 0x07e8, 0x07e4, 0x0205, - 0x0206, - 0x0207}, - { - 214, 5070, 0x9a, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfb, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07f0, 0x07ec, 0x07e8, 0x0204, - 0x0205, - 0x0206}, - { - 216, 5080, 0x9d, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfc, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07f4, 0x07f0, 0x07ec, 0x0203, - 0x0204, - 0x0205}, - { - 218, 5090, 0xa0, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfd, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07f8, 0x07f4, 0x07f0, 0x0202, - 0x0203, - 0x0204}, - { - 220, 5100, 0xa4, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfe, 0x01, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x07fc, 0x07f8, 0x07f4, 0x0201, - 0x0202, - 0x0203}, - { - 222, 5110, 0xa7, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xff, 0x01, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x0800, 0x07fc, 0x07f8, 0x0200, - 0x0201, - 0x0202}, - { - 224, 5120, 0xaa, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x00, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x0804, 0x0800, 0x07fc, 0x01ff, - 0x0200, - 0x0201}, - { - 226, 5130, 0xae, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x01, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x0808, 0x0804, 0x0800, 0x01fe, - 0x01ff, - 0x0200}, - { - 228, 5140, 0xb1, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x02, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x080c, 0x0808, 0x0804, 0x01fd, - 0x01fe, - 0x01ff}, - { - 32, 5160, 0xb8, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x04, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x0814, 0x0810, 0x080c, 0x01fb, - 0x01fc, - 0x01fd}, - { - 34, 5170, 0xbb, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x05, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x0818, 0x0814, 0x0810, 0x01fa, - 0x01fb, - 0x01fc}, - { - 36, 5180, 0xbe, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x06, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x081c, 0x0818, 0x0814, 0x01f9, - 0x01fa, - 0x01fb}, - { - 38, 5190, 0xc2, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x07, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x0820, 0x081c, 0x0818, 0x01f8, - 0x01f9, - 0x01fa}, - { - 40, 5200, 0xc5, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x08, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0824, 0x0820, 0x081c, 0x01f7, - 0x01f8, - 0x01f9}, - { - 42, 5210, 0xc8, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x09, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0828, 0x0824, 0x0820, 0x01f6, - 0x01f7, - 0x01f8}, - { - 44, 5220, 0xcc, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0a, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x082c, 0x0828, 0x0824, 0x01f5, - 0x01f6, - 0x01f7}, - { - 46, 5230, 0xcf, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0b, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0830, 0x082c, 0x0828, 0x01f4, - 0x01f5, - 0x01f6}, - { - 48, 5240, 0xd2, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0c, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0834, 0x0830, 0x082c, 0x01f3, - 0x01f4, - 0x01f5}, - { - 50, 5250, 0xd6, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0d, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0838, 0x0834, 0x0830, 0x01f2, - 0x01f3, - 0x01f4}, - { - 52, 5260, 0xd9, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0e, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x083c, 0x0838, 0x0834, 0x01f1, - 0x01f2, - 0x01f3}, - { - 54, 5270, 0xdc, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0f, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0840, 0x083c, 0x0838, 0x01f0, - 0x01f1, - 0x01f2}, - { - 56, 5280, 0xe0, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x10, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0844, 0x0840, 0x083c, 0x01f0, - 0x01f0, - 0x01f1}, - { - 58, 5290, 0xe3, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x11, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0848, 0x0844, 0x0840, 0x01ef, - 0x01f0, - 0x01f0}, - { - 60, 5300, 0xe6, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x12, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x084c, 0x0848, 0x0844, 0x01ee, - 0x01ef, - 0x01f0}, - { - 62, 5310, 0xea, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x13, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x0850, 0x084c, 0x0848, 0x01ed, - 0x01ee, - 0x01ef}, - { - 64, 5320, 0xed, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x14, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x0854, 0x0850, 0x084c, 0x01ec, - 0x01ed, - 0x01ee}, - { - 66, 5330, 0xf0, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x15, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x0858, 0x0854, 0x0850, 0x01eb, - 0x01ec, - 0x01ed}, - { - 68, 5340, 0xf4, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x16, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x085c, 0x0858, 0x0854, 0x01ea, - 0x01eb, - 0x01ec}, - { - 70, 5350, 0xf7, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x17, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x0860, 0x085c, 0x0858, 0x01e9, - 0x01ea, - 0x01eb}, - { - 72, 5360, 0xfa, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x18, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x0864, 0x0860, 0x085c, 0x01e8, - 0x01e9, - 0x01ea}, - { - 74, 5370, 0xfe, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x19, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x0868, 0x0864, 0x0860, 0x01e7, - 0x01e8, - 0x01e9}, - { - 76, 5380, 0x01, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1a, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x086c, 0x0868, 0x0864, 0x01e6, - 0x01e7, - 0x01e8}, - { - 78, 5390, 0x04, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1b, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x0870, 0x086c, 0x0868, 0x01e5, - 0x01e6, - 0x01e7}, - { - 80, 5400, 0x08, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1c, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0874, 0x0870, 0x086c, 0x01e5, - 0x01e5, - 0x01e6}, - { - 82, 5410, 0x0b, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1d, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0878, 0x0874, 0x0870, 0x01e4, - 0x01e5, - 0x01e5}, - { - 84, 5420, 0x0e, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1e, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x087c, 0x0878, 0x0874, 0x01e3, - 0x01e4, - 0x01e5}, - { - 86, 5430, 0x12, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1f, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0880, 0x087c, 0x0878, 0x01e2, - 0x01e3, - 0x01e4}, - { - 88, 5440, 0x15, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x20, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0884, 0x0880, 0x087c, 0x01e1, - 0x01e2, - 0x01e3}, - { - 90, 5450, 0x18, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x21, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0888, 0x0884, 0x0880, 0x01e0, - 0x01e1, - 0x01e2}, - { - 92, 5460, 0x1c, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x22, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x088c, 0x0888, 0x0884, 0x01df, - 0x01e0, - 0x01e1}, - { - 94, 5470, 0x1f, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x23, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0890, 0x088c, 0x0888, 0x01de, - 0x01df, - 0x01e0}, - { - 96, 5480, 0x22, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x24, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0894, 0x0890, 0x088c, 0x01dd, - 0x01de, - 0x01df}, - { - 98, 5490, 0x26, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x25, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0898, 0x0894, 0x0890, 0x01dd, - 0x01dd, - 0x01de}, - { - 100, 5500, 0x29, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x26, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x089c, 0x0898, 0x0894, 0x01dc, - 0x01dd, - 0x01dd}, - { - 102, 5510, 0x2c, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x27, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08a0, 0x089c, 0x0898, 0x01db, - 0x01dc, - 0x01dd}, - { - 104, 5520, 0x30, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x28, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08a4, 0x08a0, 0x089c, 0x01da, - 0x01db, - 0x01dc}, - { - 106, 5530, 0x33, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x29, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08a8, 0x08a4, 0x08a0, 0x01d9, - 0x01da, - 0x01db}, - { - 108, 5540, 0x36, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2a, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08ac, 0x08a8, 0x08a4, 0x01d8, - 0x01d9, - 0x01da}, - { - 110, 5550, 0x3a, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2b, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08b0, 0x08ac, 0x08a8, 0x01d7, - 0x01d8, - 0x01d9}, - { - 112, 5560, 0x3d, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2c, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08b4, 0x08b0, 0x08ac, 0x01d7, - 0x01d7, - 0x01d8}, - { - 114, 5570, 0x40, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2d, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08b8, 0x08b4, 0x08b0, 0x01d6, - 0x01d7, - 0x01d7}, - { - 116, 5580, 0x44, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2e, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08bc, 0x08b8, 0x08b4, 0x01d5, - 0x01d6, - 0x01d7}, - { - 118, 5590, 0x47, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2f, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08c0, 0x08bc, 0x08b8, 0x01d4, - 0x01d5, - 0x01d6}, - { - 120, 5600, 0x4a, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x30, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x08c4, 0x08c0, 0x08bc, 0x01d3, - 0x01d4, - 0x01d5}, - { - 122, 5610, 0x4e, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x31, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x08c8, 0x08c4, 0x08c0, 0x01d2, - 0x01d3, - 0x01d4}, - { - 124, 5620, 0x51, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x32, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x08cc, 0x08c8, 0x08c4, 0x01d2, - 0x01d2, - 0x01d3}, - { - 126, 5630, 0x54, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x33, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x08d0, 0x08cc, 0x08c8, 0x01d1, - 0x01d2, - 0x01d2}, - { - 128, 5640, 0x58, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x34, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x08d4, 0x08d0, 0x08cc, 0x01d0, - 0x01d1, - 0x01d2}, - { - 130, 5650, 0x5b, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x35, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x03, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x03, 0x23, 0x00, 0x60, 0x08d8, 0x08d4, 0x08d0, 0x01cf, - 0x01d0, - 0x01d1}, - { - 132, 5660, 0x5e, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x36, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x03, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x03, 0x23, 0x00, 0x60, 0x08dc, 0x08d8, 0x08d4, 0x01ce, - 0x01cf, - 0x01d0}, - { - 134, 5670, 0x62, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x37, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x03, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x03, 0x23, 0x00, 0x60, 0x08e0, 0x08dc, 0x08d8, 0x01ce, - 0x01ce, - 0x01cf}, - { - 136, 5680, 0x65, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x38, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x02, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x02, 0x23, 0x00, 0x60, 0x08e4, 0x08e0, 0x08dc, 0x01cd, - 0x01ce, - 0x01ce}, - { - 138, 5690, 0x68, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x39, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x02, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x02, 0x23, 0x00, 0x60, 0x08e8, 0x08e4, 0x08e0, 0x01cc, - 0x01cd, - 0x01ce}, - { - 140, 5700, 0x6c, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3a, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08ec, 0x08e8, 0x08e4, 0x01cb, - 0x01cc, - 0x01cd}, - { - 142, 5710, 0x6f, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3b, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08f0, 0x08ec, 0x08e8, 0x01ca, - 0x01cb, - 0x01cc}, - { - 144, 5720, 0x72, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3c, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08f4, 0x08f0, 0x08ec, 0x01c9, - 0x01ca, - 0x01cb}, - { - 145, 5725, 0x74, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x79, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08f6, 0x08f2, 0x08ee, 0x01c9, - 0x01ca, - 0x01cb}, - { - 146, 5730, 0x76, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3d, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08f8, 0x08f4, 0x08f0, 0x01c9, - 0x01c9, - 0x01ca}, - { - 147, 5735, 0x77, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x7b, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08fa, 0x08f6, 0x08f2, 0x01c8, - 0x01c9, - 0x01ca}, - { - 148, 5740, 0x79, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3e, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08fc, 0x08f8, 0x08f4, 0x01c8, - 0x01c9, - 0x01c9}, - { - 149, 5745, 0x7b, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x7d, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08fe, 0x08fa, 0x08f6, 0x01c8, - 0x01c8, - 0x01c9}, - { - 150, 5750, 0x7c, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3f, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x0900, 0x08fc, 0x08f8, 0x01c7, - 0x01c8, - 0x01c9}, - { - 151, 5755, 0x7e, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x7f, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x0902, 0x08fe, 0x08fa, 0x01c7, - 0x01c8, - 0x01c8}, - { - 152, 5760, 0x80, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x40, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x0904, 0x0900, 0x08fc, 0x01c6, - 0x01c7, - 0x01c8}, - { - 153, 5765, 0x81, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x81, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x0906, 0x0902, 0x08fe, 0x01c6, - 0x01c7, - 0x01c8}, - { - 154, 5770, 0x83, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x41, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x0908, 0x0904, 0x0900, 0x01c6, - 0x01c6, - 0x01c7}, - { - 155, 5775, 0x85, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x83, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x090a, 0x0906, 0x0902, 0x01c5, - 0x01c6, - 0x01c7}, - { - 156, 5780, 0x86, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x42, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x090c, 0x0908, 0x0904, 0x01c5, - 0x01c6, - 0x01c6}, - { - 157, 5785, 0x88, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x85, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x090e, 0x090a, 0x0906, 0x01c4, - 0x01c5, - 0x01c6}, - { - 158, 5790, 0x8a, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x43, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x0910, 0x090c, 0x0908, 0x01c4, - 0x01c5, - 0x01c6}, - { - 159, 5795, 0x8b, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x87, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x0912, 0x090e, 0x090a, 0x01c4, - 0x01c4, - 0x01c5}, - { - 160, 5800, 0x8d, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x44, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x08, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x01, 0x03, 0x00, 0x00, 0x0914, 0x0910, 0x090c, 0x01c3, - 0x01c4, - 0x01c5}, - { - 161, 5805, 0x8f, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x89, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0916, 0x0912, 0x090e, 0x01c3, - 0x01c4, - 0x01c4}, - { - 162, 5810, 0x90, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x45, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0918, 0x0914, 0x0910, 0x01c2, - 0x01c3, - 0x01c4}, - { - 163, 5815, 0x92, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x8b, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x091a, 0x0916, 0x0912, 0x01c2, - 0x01c3, - 0x01c4}, - { - 164, 5820, 0x94, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x46, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x091c, 0x0918, 0x0914, 0x01c2, - 0x01c2, - 0x01c3}, - { - 165, 5825, 0x95, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x8d, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x091e, 0x091a, 0x0916, 0x01c1, - 0x01c2, - 0x01c3}, - { - 166, 5830, 0x97, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x47, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0920, 0x091c, 0x0918, 0x01c1, - 0x01c2, - 0x01c2}, - { - 168, 5840, 0x9a, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x48, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0924, 0x0920, 0x091c, 0x01c0, - 0x01c1, - 0x01c2}, - { - 170, 5850, 0x9e, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x49, 0x02, 0x04, - 0x00, 0x04, 0x00, 0x44, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0928, 0x0924, 0x0920, 0x01bf, - 0x01c0, - 0x01c1}, - { - 172, 5860, 0xa1, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4a, 0x02, 0x04, - 0x00, 0x04, 0x00, 0x44, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x092c, 0x0928, 0x0924, 0x01bf, - 0x01bf, - 0x01c0}, - { - 174, 5870, 0xa4, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4b, 0x02, 0x04, - 0x00, 0x04, 0x00, 0x44, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0930, 0x092c, 0x0928, 0x01be, - 0x01bf, - 0x01bf}, - { - 176, 5880, 0xa8, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4c, 0x02, 0x03, - 0x00, 0x03, 0x00, 0x33, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0934, 0x0930, 0x092c, 0x01bd, - 0x01be, - 0x01bf}, - { - 178, 5890, 0xab, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4d, 0x02, 0x03, - 0x00, 0x03, 0x00, 0x33, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0938, 0x0934, 0x0930, 0x01bc, - 0x01bd, - 0x01be}, - { - 180, 5900, 0xae, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4e, 0x02, 0x03, - 0x00, 0x03, 0x00, 0x33, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x093c, 0x0938, 0x0934, 0x01bc, - 0x01bc, - 0x01bd}, - { - 1, 2412, 0x48, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x6c, 0x09, 0x0f, - 0x0a, 0x00, 0x0a, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03c9, 0x03c5, 0x03c1, 0x043a, - 0x043f, - 0x0443}, - { - 2, 2417, 0x4b, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x71, 0x09, 0x0f, - 0x0a, 0x00, 0x0a, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03cb, 0x03c7, 0x03c3, 0x0438, - 0x043d, - 0x0441}, - { - 3, 2422, 0x4e, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x76, 0x09, 0x0f, - 0x09, 0x00, 0x09, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03cd, 0x03c9, 0x03c5, 0x0436, - 0x043a, - 0x043f}, - { - 4, 2427, 0x52, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x7b, 0x09, 0x0f, - 0x09, 0x00, 0x09, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03cf, 0x03cb, 0x03c7, 0x0434, - 0x0438, - 0x043d}, - { - 5, 2432, 0x55, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x80, 0x09, 0x0f, - 0x08, 0x00, 0x08, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d1, 0x03cd, 0x03c9, 0x0431, - 0x0436, - 0x043a}, - { - 6, 2437, 0x58, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x85, 0x09, 0x0f, - 0x08, 0x00, 0x08, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d3, 0x03cf, 0x03cb, 0x042f, - 0x0434, - 0x0438}, - { - 7, 2442, 0x5c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8a, 0x09, 0x0f, - 0x07, 0x00, 0x07, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d5, 0x03d1, 0x03cd, 0x042d, - 0x0431, - 0x0436}, - { - 8, 2447, 0x5f, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8f, 0x09, 0x0f, - 0x07, 0x00, 0x07, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d7, 0x03d3, 0x03cf, 0x042b, - 0x042f, - 0x0434}, - { - 9, 2452, 0x62, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x94, 0x09, 0x0f, - 0x07, 0x00, 0x07, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d9, 0x03d5, 0x03d1, 0x0429, - 0x042d, - 0x0431}, - { - 10, 2457, 0x66, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x99, 0x09, 0x0f, - 0x06, 0x00, 0x06, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03db, 0x03d7, 0x03d3, 0x0427, - 0x042b, - 0x042f}, - { - 11, 2462, 0x69, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x9e, 0x09, 0x0f, - 0x06, 0x00, 0x06, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03dd, 0x03d9, 0x03d5, 0x0424, - 0x0429, - 0x042d}, - { - 12, 2467, 0x6c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa3, 0x09, 0x0f, - 0x05, 0x00, 0x05, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03df, 0x03db, 0x03d7, 0x0422, - 0x0427, - 0x042b}, - { - 13, 2472, 0x70, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa8, 0x09, 0x0f, - 0x05, 0x00, 0x05, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03e1, 0x03dd, 0x03d9, 0x0420, - 0x0424, - 0x0429}, - { - 14, 2484, 0x78, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xb4, 0x09, 0x0f, - 0x04, 0x00, 0x04, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x03e6, 0x03e2, 0x03de, 0x041b, - 0x041f, - 0x0424} -}; - -static const struct chan_info_nphy_radio2057 chan_info_nphyrev8_2057_rev8[] = { - { - 186, 4930, 0x6b, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xed, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xd3, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07b8, 0x07b4, 0x07b0, 0x0213, - 0x0214, - 0x0215}, - { - 188, 4940, 0x6e, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xee, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0xd3, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07bc, 0x07b8, 0x07b4, 0x0212, - 0x0213, - 0x0214}, - { - 190, 4950, 0x72, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xef, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07c0, 0x07bc, 0x07b8, 0x0211, - 0x0212, - 0x0213}, - { - 192, 4960, 0x75, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf0, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07c4, 0x07c0, 0x07bc, 0x020f, - 0x0211, - 0x0212}, - { - 194, 4970, 0x78, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf1, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07c8, 0x07c4, 0x07c0, 0x020e, - 0x020f, - 0x0211}, - { - 196, 4980, 0x7c, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf2, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07cc, 0x07c8, 0x07c4, 0x020d, - 0x020e, - 0x020f}, - { - 198, 4990, 0x7f, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf3, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xd3, 0x00, 0xff, 0x07d0, 0x07cc, 0x07c8, 0x020c, - 0x020d, - 0x020e}, - { - 200, 5000, 0x82, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf4, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07d4, 0x07d0, 0x07cc, 0x020b, - 0x020c, - 0x020d}, - { - 202, 5010, 0x86, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf5, 0x01, 0x0f, - 0x00, 0x0f, 0x00, 0xff, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07d8, 0x07d4, 0x07d0, 0x020a, - 0x020b, - 0x020c}, - { - 204, 5020, 0x89, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf6, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07dc, 0x07d8, 0x07d4, 0x0209, - 0x020a, - 0x020b}, - { - 206, 5030, 0x8c, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf7, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07e0, 0x07dc, 0x07d8, 0x0208, - 0x0209, - 0x020a}, - { - 208, 5040, 0x90, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf8, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07e4, 0x07e0, 0x07dc, 0x0207, - 0x0208, - 0x0209}, - { - 210, 5050, 0x93, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xf9, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07e8, 0x07e4, 0x07e0, 0x0206, - 0x0207, - 0x0208}, - { - 212, 5060, 0x96, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfa, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07ec, 0x07e8, 0x07e4, 0x0205, - 0x0206, - 0x0207}, - { - 214, 5070, 0x9a, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfb, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07f0, 0x07ec, 0x07e8, 0x0204, - 0x0205, - 0x0206}, - { - 216, 5080, 0x9d, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfc, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07f4, 0x07f0, 0x07ec, 0x0203, - 0x0204, - 0x0205}, - { - 218, 5090, 0xa0, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfd, 0x01, 0x0e, - 0x00, 0x0e, 0x00, 0xee, 0x00, 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x00, - 0x00, 0x0f, 0x0f, 0xb3, 0x00, 0xff, 0x07f8, 0x07f4, 0x07f0, 0x0202, - 0x0203, - 0x0204}, - { - 220, 5100, 0xa4, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xfe, 0x01, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x07fc, 0x07f8, 0x07f4, 0x0201, - 0x0202, - 0x0203}, - { - 222, 5110, 0xa7, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0xff, 0x01, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x0800, 0x07fc, 0x07f8, 0x0200, - 0x0201, - 0x0202}, - { - 224, 5120, 0xaa, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x00, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x0804, 0x0800, 0x07fc, 0x01ff, - 0x0200, - 0x0201}, - { - 226, 5130, 0xae, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x01, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x0808, 0x0804, 0x0800, 0x01fe, - 0x01ff, - 0x0200}, - { - 228, 5140, 0xb1, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x02, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x080c, 0x0808, 0x0804, 0x01fd, - 0x01fe, - 0x01ff}, - { - 32, 5160, 0xb8, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x04, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x0814, 0x0810, 0x080c, 0x01fb, - 0x01fc, - 0x01fd}, - { - 34, 5170, 0xbb, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x05, 0x02, 0x0d, - 0x00, 0x0d, 0x00, 0xdd, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x0818, 0x0814, 0x0810, 0x01fa, - 0x01fb, - 0x01fc}, - { - 36, 5180, 0xbe, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x06, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x081c, 0x0818, 0x0814, 0x01f9, - 0x01fa, - 0x01fb}, - { - 38, 5190, 0xc2, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x07, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x00, - 0x00, 0x0f, 0x0f, 0xa3, 0x00, 0xfc, 0x0820, 0x081c, 0x0818, 0x01f8, - 0x01f9, - 0x01fa}, - { - 40, 5200, 0xc5, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x08, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0824, 0x0820, 0x081c, 0x01f7, - 0x01f8, - 0x01f9}, - { - 42, 5210, 0xc8, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x09, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0828, 0x0824, 0x0820, 0x01f6, - 0x01f7, - 0x01f8}, - { - 44, 5220, 0xcc, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0a, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x082c, 0x0828, 0x0824, 0x01f5, - 0x01f6, - 0x01f7}, - { - 46, 5230, 0xcf, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0b, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0830, 0x082c, 0x0828, 0x01f4, - 0x01f5, - 0x01f6}, - { - 48, 5240, 0xd2, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0c, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0834, 0x0830, 0x082c, 0x01f3, - 0x01f4, - 0x01f5}, - { - 50, 5250, 0xd6, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0d, 0x02, 0x0c, - 0x00, 0x0c, 0x00, 0xcc, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0838, 0x0834, 0x0830, 0x01f2, - 0x01f3, - 0x01f4}, - { - 52, 5260, 0xd9, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0e, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x083c, 0x0838, 0x0834, 0x01f1, - 0x01f2, - 0x01f3}, - { - 54, 5270, 0xdc, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x0f, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0840, 0x083c, 0x0838, 0x01f0, - 0x01f1, - 0x01f2}, - { - 56, 5280, 0xe0, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x10, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0844, 0x0840, 0x083c, 0x01f0, - 0x01f0, - 0x01f1}, - { - 58, 5290, 0xe3, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x11, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x00, - 0x00, 0x0f, 0x0f, 0x93, 0x00, 0xf8, 0x0848, 0x0844, 0x0840, 0x01ef, - 0x01f0, - 0x01f0}, - { - 60, 5300, 0xe6, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x12, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x084c, 0x0848, 0x0844, 0x01ee, - 0x01ef, - 0x01f0}, - { - 62, 5310, 0xea, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x13, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x0850, 0x084c, 0x0848, 0x01ed, - 0x01ee, - 0x01ef}, - { - 64, 5320, 0xed, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x14, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x0854, 0x0850, 0x084c, 0x01ec, - 0x01ed, - 0x01ee}, - { - 66, 5330, 0xf0, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x15, 0x02, 0x0b, - 0x00, 0x0b, 0x00, 0xbb, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x0858, 0x0854, 0x0850, 0x01eb, - 0x01ec, - 0x01ed}, - { - 68, 5340, 0xf4, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x16, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x085c, 0x0858, 0x0854, 0x01ea, - 0x01eb, - 0x01ec}, - { - 70, 5350, 0xf7, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x17, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x0860, 0x085c, 0x0858, 0x01e9, - 0x01ea, - 0x01eb}, - { - 72, 5360, 0xfa, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x18, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x0864, 0x0860, 0x085c, 0x01e8, - 0x01e9, - 0x01ea}, - { - 74, 5370, 0xfe, 0x16, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x19, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x0868, 0x0864, 0x0860, 0x01e7, - 0x01e8, - 0x01e9}, - { - 76, 5380, 0x01, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1a, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x086c, 0x0868, 0x0864, 0x01e6, - 0x01e7, - 0x01e8}, - { - 78, 5390, 0x04, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1b, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x00, - 0x00, 0x0f, 0x0c, 0x83, 0x00, 0xf5, 0x0870, 0x086c, 0x0868, 0x01e5, - 0x01e6, - 0x01e7}, - { - 80, 5400, 0x08, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1c, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0874, 0x0870, 0x086c, 0x01e5, - 0x01e5, - 0x01e6}, - { - 82, 5410, 0x0b, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1d, 0x02, 0x0a, - 0x00, 0x0a, 0x00, 0xaa, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0878, 0x0874, 0x0870, 0x01e4, - 0x01e5, - 0x01e5}, - { - 84, 5420, 0x0e, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1e, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x087c, 0x0878, 0x0874, 0x01e3, - 0x01e4, - 0x01e5}, - { - 86, 5430, 0x12, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x1f, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0880, 0x087c, 0x0878, 0x01e2, - 0x01e3, - 0x01e4}, - { - 88, 5440, 0x15, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x20, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0884, 0x0880, 0x087c, 0x01e1, - 0x01e2, - 0x01e3}, - { - 90, 5450, 0x18, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x21, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0888, 0x0884, 0x0880, 0x01e0, - 0x01e1, - 0x01e2}, - { - 92, 5460, 0x1c, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x22, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x088c, 0x0888, 0x0884, 0x01df, - 0x01e0, - 0x01e1}, - { - 94, 5470, 0x1f, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x23, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0890, 0x088c, 0x0888, 0x01de, - 0x01df, - 0x01e0}, - { - 96, 5480, 0x22, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x24, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0894, 0x0890, 0x088c, 0x01dd, - 0x01de, - 0x01df}, - { - 98, 5490, 0x26, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x25, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x00, - 0x00, 0x0d, 0x09, 0x53, 0x00, 0xb1, 0x0898, 0x0894, 0x0890, 0x01dd, - 0x01dd, - 0x01de}, - { - 100, 5500, 0x29, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x26, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x089c, 0x0898, 0x0894, 0x01dc, - 0x01dd, - 0x01dd}, - { - 102, 5510, 0x2c, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x27, 0x02, 0x09, - 0x00, 0x09, 0x00, 0x99, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08a0, 0x089c, 0x0898, 0x01db, - 0x01dc, - 0x01dd}, - { - 104, 5520, 0x30, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x28, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08a4, 0x08a0, 0x089c, 0x01da, - 0x01db, - 0x01dc}, - { - 106, 5530, 0x33, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x29, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08a8, 0x08a4, 0x08a0, 0x01d9, - 0x01da, - 0x01db}, - { - 108, 5540, 0x36, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2a, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08ac, 0x08a8, 0x08a4, 0x01d8, - 0x01d9, - 0x01da}, - { - 110, 5550, 0x3a, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2b, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08b0, 0x08ac, 0x08a8, 0x01d7, - 0x01d8, - 0x01d9}, - { - 112, 5560, 0x3d, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2c, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08b4, 0x08b0, 0x08ac, 0x01d7, - 0x01d7, - 0x01d8}, - { - 114, 5570, 0x40, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2d, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08b8, 0x08b4, 0x08b0, 0x01d6, - 0x01d7, - 0x01d7}, - { - 116, 5580, 0x44, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2e, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08bc, 0x08b8, 0x08b4, 0x01d5, - 0x01d6, - 0x01d7}, - { - 118, 5590, 0x47, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x2f, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x00, - 0x00, 0x0a, 0x06, 0x43, 0x00, 0x80, 0x08c0, 0x08bc, 0x08b8, 0x01d4, - 0x01d5, - 0x01d6}, - { - 120, 5600, 0x4a, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x30, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x08c4, 0x08c0, 0x08bc, 0x01d3, - 0x01d4, - 0x01d5}, - { - 122, 5610, 0x4e, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x31, 0x02, 0x08, - 0x00, 0x08, 0x00, 0x88, 0x00, 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x08c8, 0x08c4, 0x08c0, 0x01d2, - 0x01d3, - 0x01d4}, - { - 124, 5620, 0x51, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x32, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x08cc, 0x08c8, 0x08c4, 0x01d2, - 0x01d2, - 0x01d3}, - { - 126, 5630, 0x54, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x33, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x08d0, 0x08cc, 0x08c8, 0x01d1, - 0x01d2, - 0x01d2}, - { - 128, 5640, 0x58, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x34, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x04, 0x23, 0x00, 0x60, 0x08d4, 0x08d0, 0x08cc, 0x01d0, - 0x01d1, - 0x01d2}, - { - 130, 5650, 0x5b, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x35, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x03, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x03, 0x23, 0x00, 0x60, 0x08d8, 0x08d4, 0x08d0, 0x01cf, - 0x01d0, - 0x01d1}, - { - 132, 5660, 0x5e, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x36, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x03, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x03, 0x23, 0x00, 0x60, 0x08dc, 0x08d8, 0x08d4, 0x01ce, - 0x01cf, - 0x01d0}, - { - 134, 5670, 0x62, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x37, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x03, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x03, 0x23, 0x00, 0x60, 0x08e0, 0x08dc, 0x08d8, 0x01ce, - 0x01ce, - 0x01cf}, - { - 136, 5680, 0x65, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x38, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x02, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x02, 0x23, 0x00, 0x60, 0x08e4, 0x08e0, 0x08dc, 0x01cd, - 0x01ce, - 0x01ce}, - { - 138, 5690, 0x68, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x39, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x09, 0x02, 0x23, 0x00, 0x60, 0x00, - 0x00, 0x09, 0x02, 0x23, 0x00, 0x60, 0x08e8, 0x08e4, 0x08e0, 0x01cc, - 0x01cd, - 0x01ce}, - { - 140, 5700, 0x6c, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3a, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08ec, 0x08e8, 0x08e4, 0x01cb, - 0x01cc, - 0x01cd}, - { - 142, 5710, 0x6f, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3b, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08f0, 0x08ec, 0x08e8, 0x01ca, - 0x01cb, - 0x01cc}, - { - 144, 5720, 0x72, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3c, 0x02, 0x07, - 0x00, 0x07, 0x00, 0x77, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08f4, 0x08f0, 0x08ec, 0x01c9, - 0x01ca, - 0x01cb}, - { - 145, 5725, 0x74, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x79, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08f6, 0x08f2, 0x08ee, 0x01c9, - 0x01ca, - 0x01cb}, - { - 146, 5730, 0x76, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3d, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08f8, 0x08f4, 0x08f0, 0x01c9, - 0x01c9, - 0x01ca}, - { - 147, 5735, 0x77, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x7b, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08fa, 0x08f6, 0x08f2, 0x01c8, - 0x01c9, - 0x01ca}, - { - 148, 5740, 0x79, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3e, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08fc, 0x08f8, 0x08f4, 0x01c8, - 0x01c9, - 0x01c9}, - { - 149, 5745, 0x7b, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x7d, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x30, 0x08fe, 0x08fa, 0x08f6, 0x01c8, - 0x01c8, - 0x01c9}, - { - 150, 5750, 0x7c, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x3f, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x0900, 0x08fc, 0x08f8, 0x01c7, - 0x01c8, - 0x01c9}, - { - 151, 5755, 0x7e, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x7f, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x0902, 0x08fe, 0x08fa, 0x01c7, - 0x01c8, - 0x01c8}, - { - 152, 5760, 0x80, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x40, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x0904, 0x0900, 0x08fc, 0x01c6, - 0x01c7, - 0x01c8}, - { - 153, 5765, 0x81, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x81, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x0906, 0x0902, 0x08fe, 0x01c6, - 0x01c7, - 0x01c8}, - { - 154, 5770, 0x83, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x41, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x0908, 0x0904, 0x0900, 0x01c6, - 0x01c6, - 0x01c7}, - { - 155, 5775, 0x85, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x83, 0x04, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x090a, 0x0906, 0x0902, 0x01c5, - 0x01c6, - 0x01c7}, - { - 156, 5780, 0x86, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x42, 0x02, 0x06, - 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x090c, 0x0908, 0x0904, 0x01c5, - 0x01c6, - 0x01c6}, - { - 157, 5785, 0x88, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x85, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x090e, 0x090a, 0x0906, 0x01c4, - 0x01c5, - 0x01c6}, - { - 158, 5790, 0x8a, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x43, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x0910, 0x090c, 0x0908, 0x01c4, - 0x01c5, - 0x01c6}, - { - 159, 5795, 0x8b, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x87, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x02, 0x13, 0x00, 0x00, 0x0912, 0x090e, 0x090a, 0x01c4, - 0x01c4, - 0x01c5}, - { - 160, 5800, 0x8d, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x44, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x08, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x01, 0x03, 0x00, 0x00, 0x0914, 0x0910, 0x090c, 0x01c3, - 0x01c4, - 0x01c5}, - { - 161, 5805, 0x8f, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x89, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0916, 0x0912, 0x090e, 0x01c3, - 0x01c4, - 0x01c4}, - { - 162, 5810, 0x90, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x45, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0918, 0x0914, 0x0910, 0x01c2, - 0x01c3, - 0x01c4}, - { - 163, 5815, 0x92, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x8b, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x091a, 0x0916, 0x0912, 0x01c2, - 0x01c3, - 0x01c4}, - { - 164, 5820, 0x94, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x46, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x091c, 0x0918, 0x0914, 0x01c2, - 0x01c2, - 0x01c3}, - { - 165, 5825, 0x95, 0x17, 0x20, 0x14, 0x08, 0x08, 0x30, 0x8d, 0x04, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x091e, 0x091a, 0x0916, 0x01c1, - 0x01c2, - 0x01c3}, - { - 166, 5830, 0x97, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x47, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0920, 0x091c, 0x0918, 0x01c1, - 0x01c2, - 0x01c2}, - { - 168, 5840, 0x9a, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x48, 0x02, 0x05, - 0x00, 0x05, 0x00, 0x55, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0924, 0x0920, 0x091c, 0x01c0, - 0x01c1, - 0x01c2}, - { - 170, 5850, 0x9e, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x49, 0x02, 0x04, - 0x00, 0x04, 0x00, 0x44, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0928, 0x0924, 0x0920, 0x01bf, - 0x01c0, - 0x01c1}, - { - 172, 5860, 0xa1, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4a, 0x02, 0x04, - 0x00, 0x04, 0x00, 0x44, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x092c, 0x0928, 0x0924, 0x01bf, - 0x01bf, - 0x01c0}, - { - 174, 5870, 0xa4, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4b, 0x02, 0x04, - 0x00, 0x04, 0x00, 0x44, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0930, 0x092c, 0x0928, 0x01be, - 0x01bf, - 0x01bf}, - { - 176, 5880, 0xa8, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4c, 0x02, 0x03, - 0x00, 0x03, 0x00, 0x33, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0934, 0x0930, 0x092c, 0x01bd, - 0x01be, - 0x01bf}, - { - 178, 5890, 0xab, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4d, 0x02, 0x03, - 0x00, 0x03, 0x00, 0x33, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x0938, 0x0934, 0x0930, 0x01bc, - 0x01bd, - 0x01be}, - { - 180, 5900, 0xae, 0x17, 0x10, 0x0c, 0x0c, 0x0c, 0x30, 0x4e, 0x02, 0x03, - 0x00, 0x03, 0x00, 0x33, 0x00, 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x01, 0x03, 0x00, 0x00, 0x093c, 0x0938, 0x0934, 0x01bc, - 0x01bc, - 0x01bd}, - { - 1, 2412, 0x48, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x6c, 0x09, 0x0f, - 0x0a, 0x00, 0x0a, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03c9, 0x03c5, 0x03c1, 0x043a, - 0x043f, - 0x0443}, - { - 2, 2417, 0x4b, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x71, 0x09, 0x0f, - 0x0a, 0x00, 0x0a, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03cb, 0x03c7, 0x03c3, 0x0438, - 0x043d, - 0x0441}, - { - 3, 2422, 0x4e, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x76, 0x09, 0x0f, - 0x09, 0x00, 0x09, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03cd, 0x03c9, 0x03c5, 0x0436, - 0x043a, - 0x043f}, - { - 4, 2427, 0x52, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x7b, 0x09, 0x0f, - 0x09, 0x00, 0x09, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03cf, 0x03cb, 0x03c7, 0x0434, - 0x0438, - 0x043d}, - { - 5, 2432, 0x55, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x80, 0x09, 0x0f, - 0x08, 0x00, 0x08, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d1, 0x03cd, 0x03c9, 0x0431, - 0x0436, - 0x043a}, - { - 6, 2437, 0x58, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x85, 0x09, 0x0f, - 0x08, 0x00, 0x08, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d3, 0x03cf, 0x03cb, 0x042f, - 0x0434, - 0x0438}, - { - 7, 2442, 0x5c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8a, 0x09, 0x0f, - 0x07, 0x00, 0x07, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d5, 0x03d1, 0x03cd, 0x042d, - 0x0431, - 0x0436}, - { - 8, 2447, 0x5f, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8f, 0x09, 0x0f, - 0x07, 0x00, 0x07, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d7, 0x03d3, 0x03cf, 0x042b, - 0x042f, - 0x0434}, - { - 9, 2452, 0x62, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x94, 0x09, 0x0f, - 0x07, 0x00, 0x07, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03d9, 0x03d5, 0x03d1, 0x0429, - 0x042d, - 0x0431}, - { - 10, 2457, 0x66, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x99, 0x09, 0x0f, - 0x06, 0x00, 0x06, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03db, 0x03d7, 0x03d3, 0x0427, - 0x042b, - 0x042f}, - { - 11, 2462, 0x69, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x9e, 0x09, 0x0f, - 0x06, 0x00, 0x06, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03dd, 0x03d9, 0x03d5, 0x0424, - 0x0429, - 0x042d}, - { - 12, 2467, 0x6c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa3, 0x09, 0x0f, - 0x05, 0x00, 0x05, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03df, 0x03db, 0x03d7, 0x0422, - 0x0427, - 0x042b}, - { - 13, 2472, 0x70, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa8, 0x09, 0x0f, - 0x05, 0x00, 0x05, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x03e1, 0x03dd, 0x03d9, 0x0420, - 0x0424, - 0x0429}, - { - 14, 2484, 0x78, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xb4, 0x09, 0x0f, - 0x04, 0x00, 0x04, 0x00, 0x61, 0x73, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x61, - 0x73, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x03e6, 0x03e2, 0x03de, 0x041b, - 0x041f, - 0x0424} -}; - -static struct radio_regs regs_2055[] = { - {0x02, 0x80, 0x80, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0x27, 0x27, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0x27, 0x27, 0, 0}, - {0x07, 0x7f, 0x7f, 1, 1}, - {0x08, 0x7, 0x7, 1, 1}, - {0x09, 0x7f, 0x7f, 1, 1}, - {0x0A, 0x7, 0x7, 1, 1}, - {0x0B, 0x15, 0x15, 0, 0}, - {0x0C, 0x15, 0x15, 0, 0}, - {0x0D, 0x4f, 0x4f, 1, 1}, - {0x0E, 0x5, 0x5, 1, 1}, - {0x0F, 0x4f, 0x4f, 1, 1}, - {0x10, 0x5, 0x5, 1, 1}, - {0x11, 0xd0, 0xd0, 0, 0}, - {0x12, 0x2, 0x2, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0x40, 0x40, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0xc0, 0xc0, 0, 0}, - {0x1E, 0xff, 0xff, 0, 0}, - {0x1F, 0xc0, 0xc0, 0, 0}, - {0x20, 0xff, 0xff, 0, 0}, - {0x21, 0xc0, 0xc0, 0, 0}, - {0x22, 0, 0, 0, 0}, - {0x23, 0x2c, 0x2c, 0, 0}, - {0x24, 0, 0, 0, 0}, - {0x25, 0, 0, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0, 0, 0, 0}, - {0x28, 0, 0, 0, 0}, - {0x29, 0, 0, 0, 0}, - {0x2A, 0, 0, 0, 0}, - {0x2B, 0, 0, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0xa4, 0xa4, 0, 0}, - {0x2E, 0x38, 0x38, 0, 0}, - {0x2F, 0, 0, 0, 0}, - {0x30, 0x4, 0x4, 1, 1}, - {0x31, 0, 0, 0, 0}, - {0x32, 0xa, 0xa, 0, 0}, - {0x33, 0x87, 0x87, 0, 0}, - {0x34, 0x9, 0x9, 0, 0}, - {0x35, 0x70, 0x70, 0, 0}, - {0x36, 0x11, 0x11, 0, 0}, - {0x37, 0x18, 0x18, 1, 1}, - {0x38, 0x6, 0x6, 0, 0}, - {0x39, 0x4, 0x4, 1, 1}, - {0x3A, 0x6, 0x6, 0, 0}, - {0x3B, 0x9e, 0x9e, 0, 0}, - {0x3C, 0x9, 0x9, 0, 0}, - {0x3D, 0xc8, 0xc8, 1, 1}, - {0x3E, 0x88, 0x88, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0, 0, 0, 0}, - {0x42, 0x1, 0x1, 0, 0}, - {0x43, 0x2, 0x2, 0, 0}, - {0x44, 0x96, 0x96, 0, 0}, - {0x45, 0x3e, 0x3e, 0, 0}, - {0x46, 0x3e, 0x3e, 0, 0}, - {0x47, 0x13, 0x13, 0, 0}, - {0x48, 0x2, 0x2, 0, 0}, - {0x49, 0x15, 0x15, 0, 0}, - {0x4A, 0x7, 0x7, 0, 0}, - {0x4B, 0, 0, 0, 0}, - {0x4C, 0, 0, 0, 0}, - {0x4D, 0, 0, 0, 0}, - {0x4E, 0, 0, 0, 0}, - {0x4F, 0, 0, 0, 0}, - {0x50, 0x8, 0x8, 0, 0}, - {0x51, 0x8, 0x8, 0, 0}, - {0x52, 0x6, 0x6, 0, 0}, - {0x53, 0x84, 0x84, 1, 1}, - {0x54, 0xc3, 0xc3, 0, 0}, - {0x55, 0x8f, 0x8f, 0, 0}, - {0x56, 0xff, 0xff, 0, 0}, - {0x57, 0xff, 0xff, 0, 0}, - {0x58, 0x88, 0x88, 0, 0}, - {0x59, 0x88, 0x88, 0, 0}, - {0x5A, 0, 0, 0, 0}, - {0x5B, 0xcc, 0xcc, 0, 0}, - {0x5C, 0x6, 0x6, 0, 0}, - {0x5D, 0x80, 0x80, 0, 0}, - {0x5E, 0x80, 0x80, 0, 0}, - {0x5F, 0xf8, 0xf8, 0, 0}, - {0x60, 0x88, 0x88, 0, 0}, - {0x61, 0x88, 0x88, 0, 0}, - {0x62, 0x88, 0x8, 1, 1}, - {0x63, 0x88, 0x88, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0x1, 0x1, 1, 1}, - {0x66, 0x8a, 0x8a, 0, 0}, - {0x67, 0x8, 0x8, 0, 0}, - {0x68, 0x83, 0x83, 0, 0}, - {0x69, 0x6, 0x6, 0, 0}, - {0x6A, 0xa0, 0xa0, 0, 0}, - {0x6B, 0xa, 0xa, 0, 0}, - {0x6C, 0x87, 0x87, 1, 1}, - {0x6D, 0x2a, 0x2a, 0, 0}, - {0x6E, 0x2a, 0x2a, 0, 0}, - {0x6F, 0x2a, 0x2a, 0, 0}, - {0x70, 0x2a, 0x2a, 0, 0}, - {0x71, 0x18, 0x18, 0, 0}, - {0x72, 0x6a, 0x6a, 1, 1}, - {0x73, 0xab, 0xab, 1, 1}, - {0x74, 0x13, 0x13, 1, 1}, - {0x75, 0xc1, 0xc1, 1, 1}, - {0x76, 0xaa, 0xaa, 1, 1}, - {0x77, 0x87, 0x87, 1, 1}, - {0x78, 0, 0, 0, 0}, - {0x79, 0x6, 0x6, 0, 0}, - {0x7A, 0x7, 0x7, 0, 0}, - {0x7B, 0x7, 0x7, 0, 0}, - {0x7C, 0x15, 0x15, 0, 0}, - {0x7D, 0x55, 0x55, 0, 0}, - {0x7E, 0x97, 0x97, 1, 1}, - {0x7F, 0x8, 0x8, 0, 0}, - {0x80, 0x14, 0x14, 1, 1}, - {0x81, 0x33, 0x33, 0, 0}, - {0x82, 0x88, 0x88, 0, 0}, - {0x83, 0x6, 0x6, 0, 0}, - {0x84, 0x3, 0x3, 1, 1}, - {0x85, 0xa, 0xa, 0, 0}, - {0x86, 0x3, 0x3, 1, 1}, - {0x87, 0x2a, 0x2a, 0, 0}, - {0x88, 0xa4, 0xa4, 0, 0}, - {0x89, 0x18, 0x18, 0, 0}, - {0x8A, 0x28, 0x28, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0x4a, 0x4a, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0xf8, 0xf8, 0, 0}, - {0x8F, 0x88, 0x88, 0, 0}, - {0x90, 0x88, 0x88, 0, 0}, - {0x91, 0x88, 0x8, 1, 1}, - {0x92, 0x88, 0x88, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0x1, 0x1, 1, 1}, - {0x95, 0x8a, 0x8a, 0, 0}, - {0x96, 0x8, 0x8, 0, 0}, - {0x97, 0x83, 0x83, 0, 0}, - {0x98, 0x6, 0x6, 0, 0}, - {0x99, 0xa0, 0xa0, 0, 0}, - {0x9A, 0xa, 0xa, 0, 0}, - {0x9B, 0x87, 0x87, 1, 1}, - {0x9C, 0x2a, 0x2a, 0, 0}, - {0x9D, 0x2a, 0x2a, 0, 0}, - {0x9E, 0x2a, 0x2a, 0, 0}, - {0x9F, 0x2a, 0x2a, 0, 0}, - {0xA0, 0x18, 0x18, 0, 0}, - {0xA1, 0x6a, 0x6a, 1, 1}, - {0xA2, 0xab, 0xab, 1, 1}, - {0xA3, 0x13, 0x13, 1, 1}, - {0xA4, 0xc1, 0xc1, 1, 1}, - {0xA5, 0xaa, 0xaa, 1, 1}, - {0xA6, 0x87, 0x87, 1, 1}, - {0xA7, 0, 0, 0, 0}, - {0xA8, 0x6, 0x6, 0, 0}, - {0xA9, 0x7, 0x7, 0, 0}, - {0xAA, 0x7, 0x7, 0, 0}, - {0xAB, 0x15, 0x15, 0, 0}, - {0xAC, 0x55, 0x55, 0, 0}, - {0xAD, 0x97, 0x97, 1, 1}, - {0xAE, 0x8, 0x8, 0, 0}, - {0xAF, 0x14, 0x14, 1, 1}, - {0xB0, 0x33, 0x33, 0, 0}, - {0xB1, 0x88, 0x88, 0, 0}, - {0xB2, 0x6, 0x6, 0, 0}, - {0xB3, 0x3, 0x3, 1, 1}, - {0xB4, 0xa, 0xa, 0, 0}, - {0xB5, 0x3, 0x3, 1, 1}, - {0xB6, 0x2a, 0x2a, 0, 0}, - {0xB7, 0xa4, 0xa4, 0, 0}, - {0xB8, 0x18, 0x18, 0, 0}, - {0xB9, 0x28, 0x28, 0, 0}, - {0xBA, 0, 0, 0, 0}, - {0xBB, 0x4a, 0x4a, 0, 0}, - {0xBC, 0, 0, 0, 0}, - {0xBD, 0x71, 0x71, 0, 0}, - {0xBE, 0x72, 0x72, 0, 0}, - {0xBF, 0x73, 0x73, 0, 0}, - {0xC0, 0x74, 0x74, 0, 0}, - {0xC1, 0x75, 0x75, 0, 0}, - {0xC2, 0x76, 0x76, 0, 0}, - {0xC3, 0x77, 0x77, 0, 0}, - {0xC4, 0x78, 0x78, 0, 0}, - {0xC5, 0x79, 0x79, 0, 0}, - {0xC6, 0x7a, 0x7a, 0, 0}, - {0xC7, 0, 0, 0, 0}, - {0xC8, 0, 0, 0, 0}, - {0xC9, 0, 0, 0, 0}, - {0xCA, 0, 0, 0, 0}, - {0xCB, 0, 0, 0, 0}, - {0xCC, 0, 0, 0, 0}, - {0xCD, 0, 0, 0, 0}, - {0xCE, 0x6, 0x6, 0, 0}, - {0xCF, 0, 0, 0, 0}, - {0xD0, 0, 0, 0, 0}, - {0xD1, 0x18, 0x18, 0, 0}, - {0xD2, 0x88, 0x88, 0, 0}, - {0xD3, 0, 0, 0, 0}, - {0xD4, 0, 0, 0, 0}, - {0xD5, 0, 0, 0, 0}, - {0xD6, 0, 0, 0, 0}, - {0xD7, 0, 0, 0, 0}, - {0xD8, 0, 0, 0, 0}, - {0xD9, 0, 0, 0, 0}, - {0xDA, 0x6, 0x6, 0, 0}, - {0xDB, 0, 0, 0, 0}, - {0xDC, 0, 0, 0, 0}, - {0xDD, 0x18, 0x18, 0, 0}, - {0xDE, 0x88, 0x88, 0, 0}, - {0xDF, 0, 0, 0, 0}, - {0xE0, 0, 0, 0, 0}, - {0xE1, 0, 0, 0, 0}, - {0xE2, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0}, -}; - -static struct radio_regs regs_SYN_2056[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0x1, 0x1, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0, 0, 0, 0}, - {0x21, 0, 0, 0, 0}, - {0x22, 0x60, 0x60, 0, 0}, - {0x23, 0x6, 0x6, 0, 0}, - {0x24, 0xc, 0xc, 0, 0}, - {0x25, 0, 0, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0, 0, 0, 0}, - {0x28, 0x1, 0x1, 0, 0}, - {0x29, 0, 0, 0, 0}, - {0x2A, 0, 0, 0, 0}, - {0x2B, 0, 0, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0, 0, 0, 0}, - {0x2E, 0xd, 0xd, 0, 0}, - {0x2F, 0x1f, 0x1f, 0, 0}, - {0x30, 0x15, 0x15, 0, 0}, - {0x31, 0xf, 0xf, 0, 0}, - {0x32, 0, 0, 0, 0}, - {0x33, 0, 0, 0, 0}, - {0x34, 0, 0, 0, 0}, - {0x35, 0, 0, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0, 0, 0, 0}, - {0x38, 0, 0, 0, 0}, - {0x39, 0, 0, 0, 0}, - {0x3A, 0, 0, 0, 0}, - {0x3B, 0, 0, 0, 0}, - {0x3C, 0x13, 0x13, 0, 0}, - {0x3D, 0xf, 0xf, 0, 0}, - {0x3E, 0x18, 0x18, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0x20, 0x20, 0, 0}, - {0x42, 0x20, 0x20, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x77, 0x77, 0, 0}, - {0x45, 0x7, 0x7, 0, 0}, - {0x46, 0x1, 0x1, 0, 0}, - {0x47, 0x4, 0x4, 0, 0}, - {0x48, 0xf, 0xf, 0, 0}, - {0x49, 0x30, 0x30, 0, 0}, - {0x4A, 0x32, 0x32, 0, 0}, - {0x4B, 0xd, 0xd, 0, 0}, - {0x4C, 0xd, 0xd, 0, 0}, - {0x4D, 0x4, 0x4, 0, 0}, - {0x4E, 0x6, 0x6, 0, 0}, - {0x4F, 0x1, 0x1, 0, 0}, - {0x50, 0x1c, 0x1c, 0, 0}, - {0x51, 0x2, 0x2, 0, 0}, - {0x52, 0x2, 0x2, 0, 0}, - {0x53, 0xf7, 0xf7, 1, 1}, - {0x54, 0xb4, 0xb4, 0, 0}, - {0x55, 0xd2, 0xd2, 0, 0}, - {0x56, 0, 0, 0, 0}, - {0x57, 0, 0, 0, 0}, - {0x58, 0x4, 0x4, 0, 0}, - {0x59, 0x96, 0x96, 0, 0}, - {0x5A, 0x3e, 0x3e, 0, 0}, - {0x5B, 0x3e, 0x3e, 0, 0}, - {0x5C, 0x13, 0x13, 0, 0}, - {0x5D, 0x2, 0x2, 0, 0}, - {0x5E, 0, 0, 0, 0}, - {0x5F, 0x7, 0x7, 0, 0}, - {0x60, 0x7, 0x7, 1, 1}, - {0x61, 0x8, 0x8, 0, 0}, - {0x62, 0x3, 0x3, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 0, 0}, - {0x68, 0x40, 0x40, 0, 0}, - {0x69, 0, 0, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0, 0, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0x1, 0x1, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0x60, 0x60, 0, 0}, - {0x71, 0x66, 0x66, 0, 0}, - {0x72, 0xc, 0xc, 0, 0}, - {0x73, 0x66, 0x66, 0, 0}, - {0x74, 0x8f, 0x8f, 1, 1}, - {0x75, 0, 0, 0, 0}, - {0x76, 0xcc, 0xcc, 0, 0}, - {0x77, 0x1, 0x1, 0, 0}, - {0x78, 0x66, 0x66, 0, 0}, - {0x79, 0x66, 0x66, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0xff, 0xff, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0, 0, 0, 0}, - {0x95, 0, 0, 0, 0}, - {0x96, 0, 0, 0, 0}, - {0x97, 0, 0, 0, 0}, - {0x98, 0, 0, 0, 0}, - {0x99, 0, 0, 0, 0}, - {0x9A, 0, 0, 0, 0}, - {0x9B, 0, 0, 0, 0}, - {0x9C, 0, 0, 0, 0}, - {0x9D, 0, 0, 0, 0}, - {0x9E, 0, 0, 0, 0}, - {0x9F, 0x6, 0x6, 0, 0}, - {0xA0, 0x66, 0x66, 0, 0}, - {0xA1, 0x66, 0x66, 0, 0}, - {0xA2, 0x66, 0x66, 0, 0}, - {0xA3, 0x66, 0x66, 0, 0}, - {0xA4, 0x66, 0x66, 0, 0}, - {0xA5, 0x66, 0x66, 0, 0}, - {0xA6, 0x66, 0x66, 0, 0}, - {0xA7, 0x66, 0x66, 0, 0}, - {0xA8, 0x66, 0x66, 0, 0}, - {0xA9, 0x66, 0x66, 0, 0}, - {0xAA, 0x66, 0x66, 0, 0}, - {0xAB, 0x66, 0x66, 0, 0}, - {0xAC, 0x66, 0x66, 0, 0}, - {0xAD, 0x66, 0x66, 0, 0}, - {0xAE, 0x66, 0x66, 0, 0}, - {0xAF, 0x66, 0x66, 0, 0}, - {0xB0, 0x66, 0x66, 0, 0}, - {0xB1, 0x66, 0x66, 0, 0}, - {0xB2, 0x66, 0x66, 0, 0}, - {0xB3, 0xa, 0xa, 0, 0}, - {0xB4, 0, 0, 0, 0}, - {0xB5, 0, 0, 0, 0}, - {0xB6, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0} -}; - -static struct radio_regs regs_TX_2056[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0, 0, 0, 0}, - {0x21, 0x88, 0x88, 0, 0}, - {0x22, 0x88, 0x88, 0, 0}, - {0x23, 0x88, 0x88, 0, 0}, - {0x24, 0x88, 0x88, 0, 0}, - {0x25, 0xc, 0xc, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0x3, 0x3, 0, 0}, - {0x28, 0, 0, 0, 0}, - {0x29, 0x3, 0x3, 0, 0}, - {0x2A, 0x37, 0x37, 0, 0}, - {0x2B, 0x3, 0x3, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0, 0, 0, 0}, - {0x2E, 0x1, 0x1, 0, 0}, - {0x2F, 0x1, 0x1, 0, 0}, - {0x30, 0, 0, 0, 0}, - {0x31, 0, 0, 0, 0}, - {0x32, 0, 0, 0, 0}, - {0x33, 0x11, 0x11, 0, 0}, - {0x34, 0x11, 0x11, 0, 0}, - {0x35, 0, 0, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0x3, 0x3, 0, 0}, - {0x38, 0xf, 0xf, 0, 0}, - {0x39, 0, 0, 0, 0}, - {0x3A, 0x2d, 0x2d, 0, 0}, - {0x3B, 0, 0, 0, 0}, - {0x3C, 0x6e, 0x6e, 0, 0}, - {0x3D, 0xf0, 0xf0, 1, 1}, - {0x3E, 0, 0, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0x3, 0x3, 0, 0}, - {0x42, 0x3, 0x3, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x1e, 0x1e, 0, 0}, - {0x45, 0, 0, 0, 0}, - {0x46, 0x6e, 0x6e, 0, 0}, - {0x47, 0xf0, 0xf0, 1, 1}, - {0x48, 0, 0, 0, 0}, - {0x49, 0x2, 0x2, 0, 0}, - {0x4A, 0xff, 0xff, 1, 1}, - {0x4B, 0xc, 0xc, 0, 0}, - {0x4C, 0, 0, 0, 0}, - {0x4D, 0x38, 0x38, 0, 0}, - {0x4E, 0x70, 0x70, 1, 1}, - {0x4F, 0x2, 0x2, 0, 0}, - {0x50, 0x88, 0x88, 0, 0}, - {0x51, 0xc, 0xc, 0, 0}, - {0x52, 0, 0, 0, 0}, - {0x53, 0x8, 0x8, 0, 0}, - {0x54, 0x70, 0x70, 1, 1}, - {0x55, 0x2, 0x2, 0, 0}, - {0x56, 0xff, 0xff, 1, 1}, - {0x57, 0, 0, 0, 0}, - {0x58, 0x83, 0x83, 0, 0}, - {0x59, 0x77, 0x77, 1, 1}, - {0x5A, 0, 0, 0, 0}, - {0x5B, 0x2, 0x2, 0, 0}, - {0x5C, 0x88, 0x88, 0, 0}, - {0x5D, 0, 0, 0, 0}, - {0x5E, 0x8, 0x8, 0, 0}, - {0x5F, 0x77, 0x77, 1, 1}, - {0x60, 0x1, 0x1, 0, 0}, - {0x61, 0, 0, 0, 0}, - {0x62, 0x7, 0x7, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0x7, 0x7, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0x74, 0x74, 1, 1}, - {0x68, 0, 0, 0, 0}, - {0x69, 0xa, 0xa, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0, 0, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0, 0, 0, 0}, - {0x71, 0x2, 0x2, 0, 0}, - {0x72, 0, 0, 0, 0}, - {0x73, 0, 0, 0, 0}, - {0x74, 0xe, 0xe, 0, 0}, - {0x75, 0xe, 0xe, 0, 0}, - {0x76, 0xe, 0xe, 0, 0}, - {0x77, 0x13, 0x13, 0, 0}, - {0x78, 0x13, 0x13, 0, 0}, - {0x79, 0x1b, 0x1b, 0, 0}, - {0x7A, 0x1b, 0x1b, 0, 0}, - {0x7B, 0x55, 0x55, 0, 0}, - {0x7C, 0x5b, 0x5b, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0, 0, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0} -}; - -static struct radio_regs regs_RX_2056[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0x3, 0x3, 0, 0}, - {0x21, 0, 0, 0, 0}, - {0x22, 0, 0, 0, 0}, - {0x23, 0x90, 0x90, 0, 0}, - {0x24, 0x55, 0x55, 0, 0}, - {0x25, 0x15, 0x15, 0, 0}, - {0x26, 0x5, 0x5, 0, 0}, - {0x27, 0x15, 0x15, 0, 0}, - {0x28, 0x5, 0x5, 0, 0}, - {0x29, 0x20, 0x20, 0, 0}, - {0x2A, 0x11, 0x11, 0, 0}, - {0x2B, 0x90, 0x90, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0x88, 0x88, 0, 0}, - {0x2E, 0x32, 0x32, 0, 0}, - {0x2F, 0x77, 0x77, 0, 0}, - {0x30, 0x17, 0x17, 1, 1}, - {0x31, 0xff, 0xff, 1, 1}, - {0x32, 0x20, 0x20, 0, 0}, - {0x33, 0, 0, 0, 0}, - {0x34, 0x88, 0x88, 0, 0}, - {0x35, 0x32, 0x32, 0, 0}, - {0x36, 0x77, 0x77, 0, 0}, - {0x37, 0x17, 0x17, 1, 1}, - {0x38, 0xf0, 0xf0, 1, 1}, - {0x39, 0x20, 0x20, 0, 0}, - {0x3A, 0x8, 0x8, 0, 0}, - {0x3B, 0x99, 0x99, 0, 0}, - {0x3C, 0, 0, 0, 0}, - {0x3D, 0x44, 0x44, 1, 1}, - {0x3E, 0, 0, 0, 0}, - {0x3F, 0x44, 0x44, 0, 0}, - {0x40, 0xf, 0xf, 1, 1}, - {0x41, 0x6, 0x6, 0, 0}, - {0x42, 0x4, 0x4, 0, 0}, - {0x43, 0x50, 0x50, 1, 1}, - {0x44, 0x8, 0x8, 0, 0}, - {0x45, 0x99, 0x99, 0, 0}, - {0x46, 0, 0, 0, 0}, - {0x47, 0x11, 0x11, 0, 0}, - {0x48, 0, 0, 0, 0}, - {0x49, 0x44, 0x44, 0, 0}, - {0x4A, 0x7, 0x7, 0, 0}, - {0x4B, 0x6, 0x6, 0, 0}, - {0x4C, 0x4, 0x4, 0, 0}, - {0x4D, 0, 0, 0, 0}, - {0x4E, 0, 0, 0, 0}, - {0x4F, 0x66, 0x66, 0, 0}, - {0x50, 0x66, 0x66, 0, 0}, - {0x51, 0x57, 0x57, 0, 0}, - {0x52, 0x57, 0x57, 0, 0}, - {0x53, 0x44, 0x44, 0, 0}, - {0x54, 0, 0, 0, 0}, - {0x55, 0, 0, 0, 0}, - {0x56, 0x8, 0x8, 0, 0}, - {0x57, 0x8, 0x8, 0, 0}, - {0x58, 0x7, 0x7, 0, 0}, - {0x59, 0x22, 0x22, 0, 0}, - {0x5A, 0x22, 0x22, 0, 0}, - {0x5B, 0x2, 0x2, 0, 0}, - {0x5C, 0x23, 0x23, 0, 0}, - {0x5D, 0x7, 0x7, 0, 0}, - {0x5E, 0x55, 0x55, 0, 0}, - {0x5F, 0x23, 0x23, 0, 0}, - {0x60, 0x41, 0x41, 0, 0}, - {0x61, 0x1, 0x1, 0, 0}, - {0x62, 0xa, 0xa, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 0, 0}, - {0x68, 0, 0, 0, 0}, - {0x69, 0, 0, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0xc, 0xc, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0, 0, 0, 0}, - {0x71, 0, 0, 0, 0}, - {0x72, 0x22, 0x22, 0, 0}, - {0x73, 0x22, 0x22, 0, 0}, - {0x74, 0x2, 0x2, 0, 0}, - {0x75, 0xa, 0xa, 0, 0}, - {0x76, 0x1, 0x1, 0, 0}, - {0x77, 0x22, 0x22, 0, 0}, - {0x78, 0x30, 0x30, 0, 0}, - {0x79, 0, 0, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0, 0, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0} -}; - -static struct radio_regs regs_SYN_2056_A1[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0x1, 0x1, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0, 0, 0, 0}, - {0x21, 0, 0, 0, 0}, - {0x22, 0x60, 0x60, 0, 0}, - {0x23, 0x6, 0x6, 0, 0}, - {0x24, 0xc, 0xc, 0, 0}, - {0x25, 0, 0, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0, 0, 0, 0}, - {0x28, 0x1, 0x1, 0, 0}, - {0x29, 0, 0, 0, 0}, - {0x2A, 0, 0, 0, 0}, - {0x2B, 0, 0, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0, 0, 0, 0}, - {0x2E, 0xd, 0xd, 0, 0}, - {0x2F, 0x1f, 0x1f, 0, 0}, - {0x30, 0x15, 0x15, 0, 0}, - {0x31, 0xf, 0xf, 0, 0}, - {0x32, 0, 0, 0, 0}, - {0x33, 0, 0, 0, 0}, - {0x34, 0, 0, 0, 0}, - {0x35, 0, 0, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0, 0, 0, 0}, - {0x38, 0, 0, 0, 0}, - {0x39, 0, 0, 0, 0}, - {0x3A, 0, 0, 0, 0}, - {0x3B, 0, 0, 0, 0}, - {0x3C, 0x13, 0x13, 0, 0}, - {0x3D, 0xf, 0xf, 0, 0}, - {0x3E, 0x18, 0x18, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0x20, 0x20, 0, 0}, - {0x42, 0x20, 0x20, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x77, 0x77, 0, 0}, - {0x45, 0x7, 0x7, 0, 0}, - {0x46, 0x1, 0x1, 0, 0}, - {0x47, 0x4, 0x4, 0, 0}, - {0x48, 0xf, 0xf, 0, 0}, - {0x49, 0x30, 0x30, 0, 0}, - {0x4A, 0x32, 0x32, 0, 0}, - {0x4B, 0xd, 0xd, 0, 0}, - {0x4C, 0xd, 0xd, 0, 0}, - {0x4D, 0x4, 0x4, 0, 0}, - {0x4E, 0x6, 0x6, 0, 0}, - {0x4F, 0x1, 0x1, 0, 0}, - {0x50, 0x1c, 0x1c, 0, 0}, - {0x51, 0x2, 0x2, 0, 0}, - {0x52, 0x2, 0x2, 0, 0}, - {0x53, 0xf7, 0xf7, 1, 1}, - {0x54, 0xb4, 0xb4, 0, 0}, - {0x55, 0xd2, 0xd2, 0, 0}, - {0x56, 0, 0, 0, 0}, - {0x57, 0, 0, 0, 0}, - {0x58, 0x4, 0x4, 0, 0}, - {0x59, 0x96, 0x96, 0, 0}, - {0x5A, 0x3e, 0x3e, 0, 0}, - {0x5B, 0x3e, 0x3e, 0, 0}, - {0x5C, 0x13, 0x13, 0, 0}, - {0x5D, 0x2, 0x2, 0, 0}, - {0x5E, 0, 0, 0, 0}, - {0x5F, 0x7, 0x7, 0, 0}, - {0x60, 0x7, 0x7, 1, 1}, - {0x61, 0x8, 0x8, 0, 0}, - {0x62, 0x3, 0x3, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 0, 0}, - {0x68, 0x40, 0x40, 0, 0}, - {0x69, 0, 0, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0, 0, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0x1, 0x1, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0x60, 0x60, 0, 0}, - {0x71, 0x66, 0x66, 0, 0}, - {0x72, 0xc, 0xc, 0, 0}, - {0x73, 0x66, 0x66, 0, 0}, - {0x74, 0x8f, 0x8f, 1, 1}, - {0x75, 0, 0, 0, 0}, - {0x76, 0xcc, 0xcc, 0, 0}, - {0x77, 0x1, 0x1, 0, 0}, - {0x78, 0x66, 0x66, 0, 0}, - {0x79, 0x66, 0x66, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0xff, 0xff, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0, 0, 0, 0}, - {0x95, 0, 0, 0, 0}, - {0x96, 0, 0, 0, 0}, - {0x97, 0, 0, 0, 0}, - {0x98, 0, 0, 0, 0}, - {0x99, 0, 0, 0, 0}, - {0x9A, 0, 0, 0, 0}, - {0x9B, 0, 0, 0, 0}, - {0x9C, 0, 0, 0, 0}, - {0x9D, 0, 0, 0, 0}, - {0x9E, 0, 0, 0, 0}, - {0x9F, 0x6, 0x6, 0, 0}, - {0xA0, 0x66, 0x66, 0, 0}, - {0xA1, 0x66, 0x66, 0, 0}, - {0xA2, 0x66, 0x66, 0, 0}, - {0xA3, 0x66, 0x66, 0, 0}, - {0xA4, 0x66, 0x66, 0, 0}, - {0xA5, 0x66, 0x66, 0, 0}, - {0xA6, 0x66, 0x66, 0, 0}, - {0xA7, 0x66, 0x66, 0, 0}, - {0xA8, 0x66, 0x66, 0, 0}, - {0xA9, 0x66, 0x66, 0, 0}, - {0xAA, 0x66, 0x66, 0, 0}, - {0xAB, 0x66, 0x66, 0, 0}, - {0xAC, 0x66, 0x66, 0, 0}, - {0xAD, 0x66, 0x66, 0, 0}, - {0xAE, 0x66, 0x66, 0, 0}, - {0xAF, 0x66, 0x66, 0, 0}, - {0xB0, 0x66, 0x66, 0, 0}, - {0xB1, 0x66, 0x66, 0, 0}, - {0xB2, 0x66, 0x66, 0, 0}, - {0xB3, 0xa, 0xa, 0, 0}, - {0xB4, 0, 0, 0, 0}, - {0xB5, 0, 0, 0, 0}, - {0xB6, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0} -}; - -static struct radio_regs regs_TX_2056_A1[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0, 0, 0, 0}, - {0x21, 0x88, 0x88, 0, 0}, - {0x22, 0x88, 0x88, 0, 0}, - {0x23, 0x88, 0x88, 0, 0}, - {0x24, 0x88, 0x88, 0, 0}, - {0x25, 0xc, 0xc, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0x3, 0x3, 0, 0}, - {0x28, 0, 0, 0, 0}, - {0x29, 0x3, 0x3, 0, 0}, - {0x2A, 0x37, 0x37, 0, 0}, - {0x2B, 0x3, 0x3, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0, 0, 0, 0}, - {0x2E, 0x1, 0x1, 0, 0}, - {0x2F, 0x1, 0x1, 0, 0}, - {0x30, 0, 0, 0, 0}, - {0x31, 0, 0, 0, 0}, - {0x32, 0, 0, 0, 0}, - {0x33, 0x11, 0x11, 0, 0}, - {0x34, 0x11, 0x11, 0, 0}, - {0x35, 0, 0, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0x3, 0x3, 0, 0}, - {0x38, 0xf, 0xf, 0, 0}, - {0x39, 0, 0, 0, 0}, - {0x3A, 0x2d, 0x2d, 0, 0}, - {0x3B, 0, 0, 0, 0}, - {0x3C, 0x6e, 0x6e, 0, 0}, - {0x3D, 0xf0, 0xf0, 1, 1}, - {0x3E, 0, 0, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0x3, 0x3, 0, 0}, - {0x42, 0x3, 0x3, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x1e, 0x1e, 0, 0}, - {0x45, 0, 0, 0, 0}, - {0x46, 0x6e, 0x6e, 0, 0}, - {0x47, 0xf0, 0xf0, 1, 1}, - {0x48, 0, 0, 0, 0}, - {0x49, 0x2, 0x2, 0, 0}, - {0x4A, 0xff, 0xff, 1, 1}, - {0x4B, 0xc, 0xc, 0, 0}, - {0x4C, 0, 0, 0, 0}, - {0x4D, 0x38, 0x38, 0, 0}, - {0x4E, 0x70, 0x70, 1, 1}, - {0x4F, 0x2, 0x2, 0, 0}, - {0x50, 0x88, 0x88, 0, 0}, - {0x51, 0xc, 0xc, 0, 0}, - {0x52, 0, 0, 0, 0}, - {0x53, 0x8, 0x8, 0, 0}, - {0x54, 0x70, 0x70, 1, 1}, - {0x55, 0x2, 0x2, 0, 0}, - {0x56, 0xff, 0xff, 1, 1}, - {0x57, 0, 0, 0, 0}, - {0x58, 0x83, 0x83, 0, 0}, - {0x59, 0x77, 0x77, 1, 1}, - {0x5A, 0, 0, 0, 0}, - {0x5B, 0x2, 0x2, 0, 0}, - {0x5C, 0x88, 0x88, 0, 0}, - {0x5D, 0, 0, 0, 0}, - {0x5E, 0x8, 0x8, 0, 0}, - {0x5F, 0x77, 0x77, 1, 1}, - {0x60, 0x1, 0x1, 0, 0}, - {0x61, 0, 0, 0, 0}, - {0x62, 0x7, 0x7, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0x7, 0x7, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0x72, 0x72, 1, 1}, - {0x68, 0, 0, 0, 0}, - {0x69, 0xa, 0xa, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0, 0, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0, 0, 0, 0}, - {0x71, 0x2, 0x2, 0, 0}, - {0x72, 0, 0, 0, 0}, - {0x73, 0, 0, 0, 0}, - {0x74, 0xe, 0xe, 0, 0}, - {0x75, 0xe, 0xe, 0, 0}, - {0x76, 0xe, 0xe, 0, 0}, - {0x77, 0x13, 0x13, 0, 0}, - {0x78, 0x13, 0x13, 0, 0}, - {0x79, 0x1b, 0x1b, 0, 0}, - {0x7A, 0x1b, 0x1b, 0, 0}, - {0x7B, 0x55, 0x55, 0, 0}, - {0x7C, 0x5b, 0x5b, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0, 0, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0} -}; - -static struct radio_regs regs_RX_2056_A1[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0x3, 0x3, 0, 0}, - {0x21, 0, 0, 0, 0}, - {0x22, 0, 0, 0, 0}, - {0x23, 0x90, 0x90, 0, 0}, - {0x24, 0x55, 0x55, 0, 0}, - {0x25, 0x15, 0x15, 0, 0}, - {0x26, 0x5, 0x5, 0, 0}, - {0x27, 0x15, 0x15, 0, 0}, - {0x28, 0x5, 0x5, 0, 0}, - {0x29, 0x20, 0x20, 0, 0}, - {0x2A, 0x11, 0x11, 0, 0}, - {0x2B, 0x90, 0x90, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0x88, 0x88, 0, 0}, - {0x2E, 0x32, 0x32, 0, 0}, - {0x2F, 0x77, 0x77, 0, 0}, - {0x30, 0x17, 0x17, 1, 1}, - {0x31, 0xff, 0xff, 1, 1}, - {0x32, 0x20, 0x20, 0, 0}, - {0x33, 0, 0, 0, 0}, - {0x34, 0x88, 0x88, 0, 0}, - {0x35, 0x32, 0x32, 0, 0}, - {0x36, 0x77, 0x77, 0, 0}, - {0x37, 0x17, 0x17, 1, 1}, - {0x38, 0xf0, 0xf0, 1, 1}, - {0x39, 0x20, 0x20, 0, 0}, - {0x3A, 0x8, 0x8, 0, 0}, - {0x3B, 0x55, 0x55, 1, 1}, - {0x3C, 0, 0, 0, 0}, - {0x3D, 0x44, 0x44, 1, 1}, - {0x3E, 0, 0, 0, 0}, - {0x3F, 0x44, 0x44, 0, 0}, - {0x40, 0xf, 0xf, 1, 1}, - {0x41, 0x6, 0x6, 0, 0}, - {0x42, 0x4, 0x4, 0, 0}, - {0x43, 0x50, 0x50, 1, 1}, - {0x44, 0x8, 0x8, 0, 0}, - {0x45, 0x55, 0x55, 1, 1}, - {0x46, 0, 0, 0, 0}, - {0x47, 0x11, 0x11, 0, 0}, - {0x48, 0, 0, 0, 0}, - {0x49, 0x44, 0x44, 0, 0}, - {0x4A, 0x7, 0x7, 0, 0}, - {0x4B, 0x6, 0x6, 0, 0}, - {0x4C, 0x4, 0x4, 0, 0}, - {0x4D, 0, 0, 0, 0}, - {0x4E, 0, 0, 0, 0}, - {0x4F, 0x26, 0x26, 1, 1}, - {0x50, 0x26, 0x26, 1, 1}, - {0x51, 0xf, 0xf, 1, 1}, - {0x52, 0xf, 0xf, 1, 1}, - {0x53, 0x44, 0x44, 0, 0}, - {0x54, 0, 0, 0, 0}, - {0x55, 0, 0, 0, 0}, - {0x56, 0x8, 0x8, 0, 0}, - {0x57, 0x8, 0x8, 0, 0}, - {0x58, 0x7, 0x7, 0, 0}, - {0x59, 0x22, 0x22, 0, 0}, - {0x5A, 0x22, 0x22, 0, 0}, - {0x5B, 0x2, 0x2, 0, 0}, - {0x5C, 0x2f, 0x2f, 1, 1}, - {0x5D, 0x7, 0x7, 0, 0}, - {0x5E, 0x55, 0x55, 0, 0}, - {0x5F, 0x23, 0x23, 0, 0}, - {0x60, 0x41, 0x41, 0, 0}, - {0x61, 0x1, 0x1, 0, 0}, - {0x62, 0xa, 0xa, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 0, 0}, - {0x68, 0, 0, 0, 0}, - {0x69, 0, 0, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0xc, 0xc, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0, 0, 0, 0}, - {0x71, 0, 0, 0, 0}, - {0x72, 0x22, 0x22, 0, 0}, - {0x73, 0x22, 0x22, 0, 0}, - {0x74, 0, 0, 1, 1}, - {0x75, 0xa, 0xa, 0, 0}, - {0x76, 0x1, 0x1, 0, 0}, - {0x77, 0x22, 0x22, 0, 0}, - {0x78, 0x30, 0x30, 0, 0}, - {0x79, 0, 0, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0, 0, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0} -}; - -static struct radio_regs regs_SYN_2056_rev5[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0x1, 0x1, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0, 0, 0, 0}, - {0x21, 0, 0, 0, 0}, - {0x22, 0x60, 0x60, 0, 0}, - {0x23, 0x6, 0x6, 0, 0}, - {0x24, 0xc, 0xc, 0, 0}, - {0x25, 0, 0, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0, 0, 0, 0}, - {0x28, 0x1, 0x1, 0, 0}, - {0x29, 0, 0, 0, 0}, - {0x2A, 0, 0, 0, 0}, - {0x2B, 0, 0, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0, 0, 0, 0}, - {0x2E, 0, 0, 0, 0}, - {0x2F, 0x1f, 0x1f, 0, 0}, - {0x30, 0x15, 0x15, 0, 0}, - {0x31, 0xf, 0xf, 0, 0}, - {0x32, 0, 0, 0, 0}, - {0x33, 0, 0, 0, 0}, - {0x34, 0, 0, 0, 0}, - {0x35, 0, 0, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0, 0, 0, 0}, - {0x38, 0, 0, 0, 0}, - {0x39, 0, 0, 0, 0}, - {0x3A, 0, 0, 0, 0}, - {0x3B, 0, 0, 0, 0}, - {0x3C, 0x13, 0x13, 0, 0}, - {0x3D, 0xf, 0xf, 0, 0}, - {0x3E, 0x18, 0x18, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0x20, 0x20, 0, 0}, - {0x42, 0x20, 0x20, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x77, 0x77, 0, 0}, - {0x45, 0x7, 0x7, 0, 0}, - {0x46, 0x1, 0x1, 0, 0}, - {0x47, 0x4, 0x4, 0, 0}, - {0x48, 0xf, 0xf, 0, 0}, - {0x49, 0x30, 0x30, 0, 0}, - {0x4A, 0x32, 0x32, 0, 0}, - {0x4B, 0xd, 0xd, 0, 0}, - {0x4C, 0xd, 0xd, 0, 0}, - {0x4D, 0x4, 0x4, 0, 0}, - {0x4E, 0x6, 0x6, 0, 0}, - {0x4F, 0x1, 0x1, 0, 0}, - {0x50, 0x1c, 0x1c, 0, 0}, - {0x51, 0x2, 0x2, 0, 0}, - {0x52, 0x2, 0x2, 0, 0}, - {0x53, 0xf7, 0xf7, 1, 1}, - {0x54, 0xb4, 0xb4, 0, 0}, - {0x55, 0xd2, 0xd2, 0, 0}, - {0x56, 0, 0, 0, 0}, - {0x57, 0, 0, 0, 0}, - {0x58, 0x4, 0x4, 0, 0}, - {0x59, 0x96, 0x96, 0, 0}, - {0x5A, 0x3e, 0x3e, 0, 0}, - {0x5B, 0x3e, 0x3e, 0, 0}, - {0x5C, 0x13, 0x13, 0, 0}, - {0x5D, 0x2, 0x2, 0, 0}, - {0x5E, 0, 0, 0, 0}, - {0x5F, 0x7, 0x7, 0, 0}, - {0x60, 0x7, 0x7, 1, 1}, - {0x61, 0x8, 0x8, 0, 0}, - {0x62, 0x3, 0x3, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 0, 0}, - {0x68, 0x40, 0x40, 0, 0}, - {0x69, 0, 0, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0, 0, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0x1, 0x1, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0x60, 0x60, 0, 0}, - {0x71, 0x66, 0x66, 0, 0}, - {0x72, 0xc, 0xc, 0, 0}, - {0x73, 0x66, 0x66, 0, 0}, - {0x74, 0x8f, 0x8f, 1, 1}, - {0x75, 0, 0, 0, 0}, - {0x76, 0xcc, 0xcc, 0, 0}, - {0x77, 0x1, 0x1, 0, 0}, - {0x78, 0x66, 0x66, 0, 0}, - {0x79, 0x66, 0x66, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0xff, 0xff, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0, 0, 0, 0}, - {0x95, 0, 0, 0, 0}, - {0x96, 0, 0, 0, 0}, - {0x97, 0, 0, 0, 0}, - {0x98, 0, 0, 0, 0}, - {0x99, 0, 0, 0, 0}, - {0x9A, 0, 0, 0, 0}, - {0x9B, 0, 0, 0, 0}, - {0x9C, 0, 0, 0, 0}, - {0x9D, 0, 0, 0, 0}, - {0x9E, 0, 0, 0, 0}, - {0x9F, 0x6, 0x6, 0, 0}, - {0xA0, 0x66, 0x66, 0, 0}, - {0xA1, 0x66, 0x66, 0, 0}, - {0xA2, 0x66, 0x66, 0, 0}, - {0xA3, 0x66, 0x66, 0, 0}, - {0xA4, 0x66, 0x66, 0, 0}, - {0xA5, 0x66, 0x66, 0, 0}, - {0xA6, 0x66, 0x66, 0, 0}, - {0xA7, 0x66, 0x66, 0, 0}, - {0xA8, 0x66, 0x66, 0, 0}, - {0xA9, 0x66, 0x66, 0, 0}, - {0xAA, 0x66, 0x66, 0, 0}, - {0xAB, 0x66, 0x66, 0, 0}, - {0xAC, 0x66, 0x66, 0, 0}, - {0xAD, 0x66, 0x66, 0, 0}, - {0xAE, 0x66, 0x66, 0, 0}, - {0xAF, 0x66, 0x66, 0, 0}, - {0xB0, 0x66, 0x66, 0, 0}, - {0xB1, 0x66, 0x66, 0, 0}, - {0xB2, 0x66, 0x66, 0, 0}, - {0xB3, 0xa, 0xa, 0, 0}, - {0xB4, 0, 0, 0, 0}, - {0xB5, 0, 0, 0, 0}, - {0xB6, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0} -}; - -static struct radio_regs regs_TX_2056_rev5[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0, 0, 0, 0}, - {0x21, 0x88, 0x88, 0, 0}, - {0x22, 0x88, 0x88, 0, 0}, - {0x23, 0x88, 0x88, 0, 0}, - {0x24, 0x88, 0x88, 0, 0}, - {0x25, 0xc, 0xc, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0x3, 0x3, 0, 0}, - {0x28, 0, 0, 0, 0}, - {0x29, 0x3, 0x3, 0, 0}, - {0x2A, 0x37, 0x37, 0, 0}, - {0x2B, 0x3, 0x3, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0, 0, 0, 0}, - {0x2E, 0x1, 0x1, 0, 0}, - {0x2F, 0x1, 0x1, 0, 0}, - {0x30, 0, 0, 0, 0}, - {0x31, 0, 0, 0, 0}, - {0x32, 0, 0, 0, 0}, - {0x33, 0x11, 0x11, 0, 0}, - {0x34, 0x11, 0x11, 0, 0}, - {0x35, 0, 0, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0x3, 0x3, 0, 0}, - {0x38, 0xf, 0xf, 0, 0}, - {0x39, 0, 0, 0, 0}, - {0x3A, 0x2d, 0x2d, 0, 0}, - {0x3B, 0, 0, 0, 0}, - {0x3C, 0x6e, 0x6e, 0, 0}, - {0x3D, 0xf0, 0xf0, 1, 1}, - {0x3E, 0, 0, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0x3, 0x3, 0, 0}, - {0x42, 0x3, 0x3, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x1e, 0x1e, 0, 0}, - {0x45, 0, 0, 0, 0}, - {0x46, 0x6e, 0x6e, 0, 0}, - {0x47, 0xf0, 0xf0, 1, 1}, - {0x48, 0, 0, 0, 0}, - {0x49, 0x2, 0x2, 0, 0}, - {0x4A, 0xff, 0xff, 1, 1}, - {0x4B, 0xc, 0xc, 0, 0}, - {0x4C, 0, 0, 0, 0}, - {0x4D, 0x38, 0x38, 0, 0}, - {0x4E, 0x70, 0x70, 1, 1}, - {0x4F, 0x2, 0x2, 0, 0}, - {0x50, 0x88, 0x88, 0, 0}, - {0x51, 0xc, 0xc, 0, 0}, - {0x52, 0, 0, 0, 0}, - {0x53, 0x8, 0x8, 0, 0}, - {0x54, 0x70, 0x70, 1, 1}, - {0x55, 0x2, 0x2, 0, 0}, - {0x56, 0xff, 0xff, 1, 1}, - {0x57, 0, 0, 0, 0}, - {0x58, 0x83, 0x83, 0, 0}, - {0x59, 0x77, 0x77, 1, 1}, - {0x5A, 0, 0, 0, 0}, - {0x5B, 0x2, 0x2, 0, 0}, - {0x5C, 0x88, 0x88, 0, 0}, - {0x5D, 0, 0, 0, 0}, - {0x5E, 0x8, 0x8, 0, 0}, - {0x5F, 0x77, 0x77, 1, 1}, - {0x60, 0x1, 0x1, 0, 0}, - {0x61, 0, 0, 0, 0}, - {0x62, 0x7, 0x7, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0x7, 0x7, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 1, 1}, - {0x68, 0, 0, 0, 0}, - {0x69, 0xa, 0xa, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0, 0, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0, 0, 0, 0}, - {0x71, 0x2, 0x2, 0, 0}, - {0x72, 0, 0, 0, 0}, - {0x73, 0, 0, 0, 0}, - {0x74, 0xe, 0xe, 0, 0}, - {0x75, 0xe, 0xe, 0, 0}, - {0x76, 0xe, 0xe, 0, 0}, - {0x77, 0x13, 0x13, 0, 0}, - {0x78, 0x13, 0x13, 0, 0}, - {0x79, 0x1b, 0x1b, 0, 0}, - {0x7A, 0x1b, 0x1b, 0, 0}, - {0x7B, 0x55, 0x55, 0, 0}, - {0x7C, 0x5b, 0x5b, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0, 0, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0x70, 0x70, 0, 0}, - {0x94, 0x70, 0x70, 0, 0}, - {0x95, 0x71, 0x71, 1, 1}, - {0x96, 0x71, 0x71, 1, 1}, - {0x97, 0x72, 0x72, 1, 1}, - {0x98, 0x73, 0x73, 1, 1}, - {0x99, 0x74, 0x74, 1, 1}, - {0x9A, 0x75, 0x75, 1, 1}, - {0xFFFF, 0, 0, 0, 0} -}; - -static struct radio_regs regs_RX_2056_rev5[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0x3, 0x3, 0, 0}, - {0x21, 0, 0, 0, 0}, - {0x22, 0, 0, 0, 0}, - {0x23, 0x90, 0x90, 0, 0}, - {0x24, 0x55, 0x55, 0, 0}, - {0x25, 0x15, 0x15, 0, 0}, - {0x26, 0x5, 0x5, 0, 0}, - {0x27, 0x15, 0x15, 0, 0}, - {0x28, 0x5, 0x5, 0, 0}, - {0x29, 0x20, 0x20, 0, 0}, - {0x2A, 0x11, 0x11, 0, 0}, - {0x2B, 0x90, 0x90, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0x88, 0x88, 0, 0}, - {0x2E, 0x32, 0x32, 0, 0}, - {0x2F, 0x77, 0x77, 0, 0}, - {0x30, 0x17, 0x17, 1, 1}, - {0x31, 0xff, 0xff, 1, 1}, - {0x32, 0x20, 0x20, 0, 0}, - {0x33, 0, 0, 0, 0}, - {0x34, 0x88, 0x88, 0, 0}, - {0x35, 0x32, 0x32, 0, 0}, - {0x36, 0x77, 0x77, 0, 0}, - {0x37, 0x17, 0x17, 1, 1}, - {0x38, 0xf0, 0xf0, 1, 1}, - {0x39, 0x20, 0x20, 0, 0}, - {0x3A, 0x8, 0x8, 0, 0}, - {0x3B, 0x55, 0x55, 1, 1}, - {0x3C, 0, 0, 0, 0}, - {0x3D, 0x88, 0x88, 1, 1}, - {0x3E, 0, 0, 0, 0}, - {0x3F, 0, 0, 1, 1}, - {0x40, 0x7, 0x7, 1, 1}, - {0x41, 0x6, 0x6, 0, 0}, - {0x42, 0x4, 0x4, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x8, 0x8, 0, 0}, - {0x45, 0x55, 0x55, 1, 1}, - {0x46, 0, 0, 0, 0}, - {0x47, 0x11, 0x11, 0, 0}, - {0x48, 0, 0, 0, 0}, - {0x49, 0, 0, 1, 1}, - {0x4A, 0x7, 0x7, 0, 0}, - {0x4B, 0x6, 0x6, 0, 0}, - {0x4C, 0x4, 0x4, 0, 0}, - {0x4D, 0, 0, 0, 0}, - {0x4E, 0, 0, 0, 0}, - {0x4F, 0x26, 0x26, 1, 1}, - {0x50, 0x26, 0x26, 1, 1}, - {0x51, 0xf, 0xf, 1, 1}, - {0x52, 0xf, 0xf, 1, 1}, - {0x53, 0x44, 0x44, 0, 0}, - {0x54, 0, 0, 0, 0}, - {0x55, 0, 0, 0, 0}, - {0x56, 0x8, 0x8, 0, 0}, - {0x57, 0x8, 0x8, 0, 0}, - {0x58, 0x7, 0x7, 0, 0}, - {0x59, 0x22, 0x22, 0, 0}, - {0x5A, 0x22, 0x22, 0, 0}, - {0x5B, 0x2, 0x2, 0, 0}, - {0x5C, 0x4, 0x4, 1, 1}, - {0x5D, 0x7, 0x7, 0, 0}, - {0x5E, 0x55, 0x55, 0, 0}, - {0x5F, 0x23, 0x23, 0, 0}, - {0x60, 0x41, 0x41, 0, 0}, - {0x61, 0x1, 0x1, 0, 0}, - {0x62, 0xa, 0xa, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 0, 0}, - {0x68, 0, 0, 0, 0}, - {0x69, 0, 0, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0xc, 0xc, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0, 0, 0, 0}, - {0x71, 0, 0, 0, 0}, - {0x72, 0x22, 0x22, 0, 0}, - {0x73, 0x22, 0x22, 0, 0}, - {0x74, 0, 0, 1, 1}, - {0x75, 0xa, 0xa, 0, 0}, - {0x76, 0x1, 0x1, 0, 0}, - {0x77, 0x22, 0x22, 0, 0}, - {0x78, 0x30, 0x30, 0, 0}, - {0x79, 0, 0, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0, 0, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0} -}; - -static struct radio_regs regs_SYN_2056_rev6[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0x1, 0x1, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0, 0, 0, 0}, - {0x21, 0, 0, 0, 0}, - {0x22, 0x60, 0x60, 0, 0}, - {0x23, 0x6, 0x6, 0, 0}, - {0x24, 0xc, 0xc, 0, 0}, - {0x25, 0, 0, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0, 0, 0, 0}, - {0x28, 0x1, 0x1, 0, 0}, - {0x29, 0, 0, 0, 0}, - {0x2A, 0, 0, 0, 0}, - {0x2B, 0, 0, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0, 0, 0, 0}, - {0x2E, 0, 0, 0, 0}, - {0x2F, 0x1f, 0x1f, 0, 0}, - {0x30, 0x15, 0x15, 0, 0}, - {0x31, 0xf, 0xf, 0, 0}, - {0x32, 0, 0, 0, 0}, - {0x33, 0, 0, 0, 0}, - {0x34, 0, 0, 0, 0}, - {0x35, 0, 0, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0, 0, 0, 0}, - {0x38, 0, 0, 0, 0}, - {0x39, 0, 0, 0, 0}, - {0x3A, 0, 0, 0, 0}, - {0x3B, 0, 0, 0, 0}, - {0x3C, 0x13, 0x13, 0, 0}, - {0x3D, 0xf, 0xf, 0, 0}, - {0x3E, 0x18, 0x18, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0x20, 0x20, 0, 0}, - {0x42, 0x20, 0x20, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x77, 0x77, 0, 0}, - {0x45, 0x7, 0x7, 0, 0}, - {0x46, 0x1, 0x1, 0, 0}, - {0x47, 0x4, 0x4, 0, 0}, - {0x48, 0xf, 0xf, 0, 0}, - {0x49, 0x30, 0x30, 0, 0}, - {0x4A, 0x32, 0x32, 0, 0}, - {0x4B, 0xd, 0xd, 0, 0}, - {0x4C, 0xd, 0xd, 0, 0}, - {0x4D, 0x4, 0x4, 0, 0}, - {0x4E, 0x6, 0x6, 0, 0}, - {0x4F, 0x1, 0x1, 0, 0}, - {0x50, 0x1c, 0x1c, 0, 0}, - {0x51, 0x2, 0x2, 0, 0}, - {0x52, 0x2, 0x2, 0, 0}, - {0x53, 0xf7, 0xf7, 1, 1}, - {0x54, 0xb4, 0xb4, 0, 0}, - {0x55, 0xd2, 0xd2, 0, 0}, - {0x56, 0, 0, 0, 0}, - {0x57, 0, 0, 0, 0}, - {0x58, 0x4, 0x4, 0, 0}, - {0x59, 0x96, 0x96, 0, 0}, - {0x5A, 0x3e, 0x3e, 0, 0}, - {0x5B, 0x3e, 0x3e, 0, 0}, - {0x5C, 0x13, 0x13, 0, 0}, - {0x5D, 0x2, 0x2, 0, 0}, - {0x5E, 0, 0, 0, 0}, - {0x5F, 0x7, 0x7, 0, 0}, - {0x60, 0x7, 0x7, 1, 1}, - {0x61, 0x8, 0x8, 0, 0}, - {0x62, 0x3, 0x3, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 0, 0}, - {0x68, 0x40, 0x40, 0, 0}, - {0x69, 0, 0, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0, 0, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0x1, 0x1, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0x60, 0x60, 0, 0}, - {0x71, 0x66, 0x66, 0, 0}, - {0x72, 0xc, 0xc, 0, 0}, - {0x73, 0x66, 0x66, 0, 0}, - {0x74, 0x8f, 0x8f, 1, 1}, - {0x75, 0, 0, 0, 0}, - {0x76, 0xcc, 0xcc, 0, 0}, - {0x77, 0x1, 0x1, 0, 0}, - {0x78, 0x66, 0x66, 0, 0}, - {0x79, 0x66, 0x66, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0xff, 0xff, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0, 0, 0, 0}, - {0x95, 0, 0, 0, 0}, - {0x96, 0, 0, 0, 0}, - {0x97, 0, 0, 0, 0}, - {0x98, 0, 0, 0, 0}, - {0x99, 0, 0, 0, 0}, - {0x9A, 0, 0, 0, 0}, - {0x9B, 0, 0, 0, 0}, - {0x9C, 0, 0, 0, 0}, - {0x9D, 0, 0, 0, 0}, - {0x9E, 0, 0, 0, 0}, - {0x9F, 0x6, 0x6, 0, 0}, - {0xA0, 0x66, 0x66, 0, 0}, - {0xA1, 0x66, 0x66, 0, 0}, - {0xA2, 0x66, 0x66, 0, 0}, - {0xA3, 0x66, 0x66, 0, 0}, - {0xA4, 0x66, 0x66, 0, 0}, - {0xA5, 0x66, 0x66, 0, 0}, - {0xA6, 0x66, 0x66, 0, 0}, - {0xA7, 0x66, 0x66, 0, 0}, - {0xA8, 0x66, 0x66, 0, 0}, - {0xA9, 0x66, 0x66, 0, 0}, - {0xAA, 0x66, 0x66, 0, 0}, - {0xAB, 0x66, 0x66, 0, 0}, - {0xAC, 0x66, 0x66, 0, 0}, - {0xAD, 0x66, 0x66, 0, 0}, - {0xAE, 0x66, 0x66, 0, 0}, - {0xAF, 0x66, 0x66, 0, 0}, - {0xB0, 0x66, 0x66, 0, 0}, - {0xB1, 0x66, 0x66, 0, 0}, - {0xB2, 0x66, 0x66, 0, 0}, - {0xB3, 0xa, 0xa, 0, 0}, - {0xB4, 0, 0, 0, 0}, - {0xB5, 0, 0, 0, 0}, - {0xB6, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0} -}; - -static struct radio_regs regs_TX_2056_rev6[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0, 0, 0, 0}, - {0x21, 0x88, 0x88, 0, 0}, - {0x22, 0x88, 0x88, 0, 0}, - {0x23, 0x88, 0x88, 0, 0}, - {0x24, 0x88, 0x88, 0, 0}, - {0x25, 0xc, 0xc, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0x3, 0x3, 0, 0}, - {0x28, 0, 0, 0, 0}, - {0x29, 0x3, 0x3, 0, 0}, - {0x2A, 0x37, 0x37, 0, 0}, - {0x2B, 0x3, 0x3, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0, 0, 0, 0}, - {0x2E, 0x1, 0x1, 0, 0}, - {0x2F, 0x1, 0x1, 0, 0}, - {0x30, 0, 0, 0, 0}, - {0x31, 0, 0, 0, 0}, - {0x32, 0, 0, 0, 0}, - {0x33, 0x11, 0x11, 0, 0}, - {0x34, 0xee, 0xee, 1, 1}, - {0x35, 0, 0, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0x3, 0x3, 0, 0}, - {0x38, 0x50, 0x50, 1, 1}, - {0x39, 0, 0, 0, 0}, - {0x3A, 0x50, 0x50, 1, 1}, - {0x3B, 0, 0, 0, 0}, - {0x3C, 0x6e, 0x6e, 0, 0}, - {0x3D, 0xf0, 0xf0, 1, 1}, - {0x3E, 0, 0, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0x3, 0x3, 0, 0}, - {0x42, 0x3, 0x3, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x1e, 0x1e, 0, 0}, - {0x45, 0, 0, 0, 0}, - {0x46, 0x6e, 0x6e, 0, 0}, - {0x47, 0xf0, 0xf0, 1, 1}, - {0x48, 0, 0, 0, 0}, - {0x49, 0x2, 0x2, 0, 0}, - {0x4A, 0xff, 0xff, 1, 1}, - {0x4B, 0xc, 0xc, 0, 0}, - {0x4C, 0, 0, 0, 0}, - {0x4D, 0x38, 0x38, 0, 0}, - {0x4E, 0x70, 0x70, 1, 1}, - {0x4F, 0x2, 0x2, 0, 0}, - {0x50, 0x88, 0x88, 0, 0}, - {0x51, 0xc, 0xc, 0, 0}, - {0x52, 0, 0, 0, 0}, - {0x53, 0x8, 0x8, 0, 0}, - {0x54, 0x70, 0x70, 1, 1}, - {0x55, 0x2, 0x2, 0, 0}, - {0x56, 0xff, 0xff, 1, 1}, - {0x57, 0, 0, 0, 0}, - {0x58, 0x83, 0x83, 0, 0}, - {0x59, 0x77, 0x77, 1, 1}, - {0x5A, 0, 0, 0, 0}, - {0x5B, 0x2, 0x2, 0, 0}, - {0x5C, 0x88, 0x88, 0, 0}, - {0x5D, 0, 0, 0, 0}, - {0x5E, 0x8, 0x8, 0, 0}, - {0x5F, 0x77, 0x77, 1, 1}, - {0x60, 0x1, 0x1, 0, 0}, - {0x61, 0, 0, 0, 0}, - {0x62, 0x7, 0x7, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0x7, 0x7, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 1, 1}, - {0x68, 0, 0, 0, 0}, - {0x69, 0xa, 0xa, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0, 0, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0, 0, 0, 0}, - {0x71, 0x2, 0x2, 0, 0}, - {0x72, 0, 0, 0, 0}, - {0x73, 0, 0, 0, 0}, - {0x74, 0xe, 0xe, 0, 0}, - {0x75, 0xe, 0xe, 0, 0}, - {0x76, 0xe, 0xe, 0, 0}, - {0x77, 0x13, 0x13, 0, 0}, - {0x78, 0x13, 0x13, 0, 0}, - {0x79, 0x1b, 0x1b, 0, 0}, - {0x7A, 0x1b, 0x1b, 0, 0}, - {0x7B, 0x55, 0x55, 0, 0}, - {0x7C, 0x5b, 0x5b, 0, 0}, - {0x7D, 0x30, 0x30, 1, 1}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0, 0, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0x70, 0x70, 0, 0}, - {0x94, 0x70, 0x70, 0, 0}, - {0x95, 0x70, 0x70, 0, 0}, - {0x96, 0x70, 0x70, 0, 0}, - {0x97, 0x70, 0x70, 0, 0}, - {0x98, 0x70, 0x70, 0, 0}, - {0x99, 0x70, 0x70, 0, 0}, - {0x9A, 0x70, 0x70, 0, 0}, - {0xFFFF, 0, 0, 0, 0} -}; - -static struct radio_regs regs_RX_2056_rev6[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0x3, 0x3, 0, 0}, - {0x21, 0, 0, 0, 0}, - {0x22, 0, 0, 0, 0}, - {0x23, 0x90, 0x90, 0, 0}, - {0x24, 0x55, 0x55, 0, 0}, - {0x25, 0x15, 0x15, 0, 0}, - {0x26, 0x5, 0x5, 0, 0}, - {0x27, 0x15, 0x15, 0, 0}, - {0x28, 0x5, 0x5, 0, 0}, - {0x29, 0x20, 0x20, 0, 0}, - {0x2A, 0x11, 0x11, 0, 0}, - {0x2B, 0x90, 0x90, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0x88, 0x88, 0, 0}, - {0x2E, 0x32, 0x32, 0, 0}, - {0x2F, 0x77, 0x77, 0, 0}, - {0x30, 0x17, 0x17, 1, 1}, - {0x31, 0xff, 0xff, 1, 1}, - {0x32, 0x20, 0x20, 0, 0}, - {0x33, 0, 0, 0, 0}, - {0x34, 0x88, 0x88, 0, 0}, - {0x35, 0x32, 0x32, 0, 0}, - {0x36, 0x77, 0x77, 0, 0}, - {0x37, 0x17, 0x17, 1, 1}, - {0x38, 0xf0, 0xf0, 1, 1}, - {0x39, 0x20, 0x20, 0, 0}, - {0x3A, 0x8, 0x8, 0, 0}, - {0x3B, 0x55, 0x55, 1, 1}, - {0x3C, 0, 0, 0, 0}, - {0x3D, 0x88, 0x88, 1, 1}, - {0x3E, 0, 0, 0, 0}, - {0x3F, 0x44, 0x44, 0, 0}, - {0x40, 0x7, 0x7, 1, 1}, - {0x41, 0x6, 0x6, 0, 0}, - {0x42, 0x4, 0x4, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x8, 0x8, 0, 0}, - {0x45, 0x55, 0x55, 1, 1}, - {0x46, 0, 0, 0, 0}, - {0x47, 0x11, 0x11, 0, 0}, - {0x48, 0, 0, 0, 0}, - {0x49, 0x44, 0x44, 0, 0}, - {0x4A, 0x7, 0x7, 0, 0}, - {0x4B, 0x6, 0x6, 0, 0}, - {0x4C, 0x4, 0x4, 0, 0}, - {0x4D, 0, 0, 0, 0}, - {0x4E, 0, 0, 0, 0}, - {0x4F, 0x26, 0x26, 1, 1}, - {0x50, 0x26, 0x26, 1, 1}, - {0x51, 0xf, 0xf, 1, 1}, - {0x52, 0xf, 0xf, 1, 1}, - {0x53, 0x44, 0x44, 0, 0}, - {0x54, 0, 0, 0, 0}, - {0x55, 0, 0, 0, 0}, - {0x56, 0x8, 0x8, 0, 0}, - {0x57, 0x8, 0x8, 0, 0}, - {0x58, 0x7, 0x7, 0, 0}, - {0x59, 0x22, 0x22, 0, 0}, - {0x5A, 0x22, 0x22, 0, 0}, - {0x5B, 0x2, 0x2, 0, 0}, - {0x5C, 0x4, 0x4, 1, 1}, - {0x5D, 0x7, 0x7, 0, 0}, - {0x5E, 0x55, 0x55, 0, 0}, - {0x5F, 0x23, 0x23, 0, 0}, - {0x60, 0x41, 0x41, 0, 0}, - {0x61, 0x1, 0x1, 0, 0}, - {0x62, 0xa, 0xa, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 0, 0}, - {0x68, 0, 0, 0, 0}, - {0x69, 0, 0, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0xc, 0xc, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0, 0, 0, 0}, - {0x71, 0, 0, 0, 0}, - {0x72, 0x22, 0x22, 0, 0}, - {0x73, 0x22, 0x22, 0, 0}, - {0x74, 0, 0, 1, 1}, - {0x75, 0xa, 0xa, 0, 0}, - {0x76, 0x1, 0x1, 0, 0}, - {0x77, 0x22, 0x22, 0, 0}, - {0x78, 0x30, 0x30, 0, 0}, - {0x79, 0, 0, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0x5, 0x5, 1, 1}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0, 0, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0} -}; - -static struct radio_regs regs_SYN_2056_rev7[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0x1, 0x1, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0, 0, 0, 0}, - {0x21, 0, 0, 0, 0}, - {0x22, 0x60, 0x60, 0, 0}, - {0x23, 0x6, 0x6, 0, 0}, - {0x24, 0xc, 0xc, 0, 0}, - {0x25, 0, 0, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0, 0, 0, 0}, - {0x28, 0x1, 0x1, 0, 0}, - {0x29, 0, 0, 0, 0}, - {0x2A, 0, 0, 0, 0}, - {0x2B, 0, 0, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0, 0, 0, 0}, - {0x2E, 0, 0, 0, 0}, - {0x2F, 0x1f, 0x1f, 0, 0}, - {0x30, 0x15, 0x15, 0, 0}, - {0x31, 0xf, 0xf, 0, 0}, - {0x32, 0, 0, 0, 0}, - {0x33, 0, 0, 0, 0}, - {0x34, 0, 0, 0, 0}, - {0x35, 0, 0, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0, 0, 0, 0}, - {0x38, 0, 0, 0, 0}, - {0x39, 0, 0, 0, 0}, - {0x3A, 0, 0, 0, 0}, - {0x3B, 0, 0, 0, 0}, - {0x3C, 0x13, 0x13, 0, 0}, - {0x3D, 0xf, 0xf, 0, 0}, - {0x3E, 0x18, 0x18, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0x20, 0x20, 0, 0}, - {0x42, 0x20, 0x20, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x77, 0x77, 0, 0}, - {0x45, 0x7, 0x7, 0, 0}, - {0x46, 0x1, 0x1, 0, 0}, - {0x47, 0x4, 0x4, 0, 0}, - {0x48, 0xf, 0xf, 0, 0}, - {0x49, 0x30, 0x30, 0, 0}, - {0x4A, 0x32, 0x32, 0, 0}, - {0x4B, 0xd, 0xd, 0, 0}, - {0x4C, 0xd, 0xd, 0, 0}, - {0x4D, 0x4, 0x4, 0, 0}, - {0x4E, 0x6, 0x6, 0, 0}, - {0x4F, 0x1, 0x1, 0, 0}, - {0x50, 0x1c, 0x1c, 0, 0}, - {0x51, 0x2, 0x2, 0, 0}, - {0x52, 0x2, 0x2, 0, 0}, - {0x53, 0xf7, 0xf7, 1, 1}, - {0x54, 0xb4, 0xb4, 0, 0}, - {0x55, 0xd2, 0xd2, 0, 0}, - {0x56, 0, 0, 0, 0}, - {0x57, 0, 0, 0, 0}, - {0x58, 0x4, 0x4, 0, 0}, - {0x59, 0x96, 0x96, 0, 0}, - {0x5A, 0x3e, 0x3e, 0, 0}, - {0x5B, 0x3e, 0x3e, 0, 0}, - {0x5C, 0x13, 0x13, 0, 0}, - {0x5D, 0x2, 0x2, 0, 0}, - {0x5E, 0, 0, 0, 0}, - {0x5F, 0x7, 0x7, 0, 0}, - {0x60, 0x7, 0x7, 1, 1}, - {0x61, 0x8, 0x8, 0, 0}, - {0x62, 0x3, 0x3, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 0, 0}, - {0x68, 0x40, 0x40, 0, 0}, - {0x69, 0, 0, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0, 0, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0x1, 0x1, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0x60, 0x60, 0, 0}, - {0x71, 0x66, 0x66, 0, 0}, - {0x72, 0xc, 0xc, 0, 0}, - {0x73, 0x66, 0x66, 0, 0}, - {0x74, 0x8f, 0x8f, 1, 1}, - {0x75, 0, 0, 0, 0}, - {0x76, 0xcc, 0xcc, 0, 0}, - {0x77, 0x1, 0x1, 0, 0}, - {0x78, 0x66, 0x66, 0, 0}, - {0x79, 0x66, 0x66, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0xff, 0xff, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0, 0, 0, 0}, - {0x95, 0, 0, 0, 0}, - {0x96, 0, 0, 0, 0}, - {0x97, 0, 0, 0, 0}, - {0x98, 0, 0, 0, 0}, - {0x99, 0, 0, 0, 0}, - {0x9A, 0, 0, 0, 0}, - {0x9B, 0, 0, 0, 0}, - {0x9C, 0, 0, 0, 0}, - {0x9D, 0, 0, 0, 0}, - {0x9E, 0, 0, 0, 0}, - {0x9F, 0x6, 0x6, 0, 0}, - {0xA0, 0x66, 0x66, 0, 0}, - {0xA1, 0x66, 0x66, 0, 0}, - {0xA2, 0x66, 0x66, 0, 0}, - {0xA3, 0x66, 0x66, 0, 0}, - {0xA4, 0x66, 0x66, 0, 0}, - {0xA5, 0x66, 0x66, 0, 0}, - {0xA6, 0x66, 0x66, 0, 0}, - {0xA7, 0x66, 0x66, 0, 0}, - {0xA8, 0x66, 0x66, 0, 0}, - {0xA9, 0x66, 0x66, 0, 0}, - {0xAA, 0x66, 0x66, 0, 0}, - {0xAB, 0x66, 0x66, 0, 0}, - {0xAC, 0x66, 0x66, 0, 0}, - {0xAD, 0x66, 0x66, 0, 0}, - {0xAE, 0x66, 0x66, 0, 0}, - {0xAF, 0x66, 0x66, 0, 0}, - {0xB0, 0x66, 0x66, 0, 0}, - {0xB1, 0x66, 0x66, 0, 0}, - {0xB2, 0x66, 0x66, 0, 0}, - {0xB3, 0xa, 0xa, 0, 0}, - {0xB4, 0, 0, 0, 0}, - {0xB5, 0, 0, 0, 0}, - {0xB6, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0}, -}; - -static struct radio_regs regs_TX_2056_rev7[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0, 0, 0, 0}, - {0x21, 0x88, 0x88, 0, 0}, - {0x22, 0x88, 0x88, 0, 0}, - {0x23, 0x88, 0x88, 0, 0}, - {0x24, 0x88, 0x88, 0, 0}, - {0x25, 0xc, 0xc, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0x3, 0x3, 0, 0}, - {0x28, 0, 0, 0, 0}, - {0x29, 0x3, 0x3, 0, 0}, - {0x2A, 0x37, 0x37, 0, 0}, - {0x2B, 0x3, 0x3, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0, 0, 0, 0}, - {0x2E, 0x1, 0x1, 0, 0}, - {0x2F, 0x1, 0x1, 0, 0}, - {0x30, 0, 0, 0, 0}, - {0x31, 0, 0, 0, 0}, - {0x32, 0, 0, 0, 0}, - {0x33, 0x11, 0x11, 0, 0}, - {0x34, 0xee, 0xee, 1, 1}, - {0x35, 0, 0, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0x3, 0x3, 0, 0}, - {0x38, 0x50, 0x50, 1, 1}, - {0x39, 0, 0, 0, 0}, - {0x3A, 0x50, 0x50, 1, 1}, - {0x3B, 0, 0, 0, 0}, - {0x3C, 0x6e, 0x6e, 0, 0}, - {0x3D, 0xf0, 0xf0, 1, 1}, - {0x3E, 0, 0, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0x3, 0x3, 0, 0}, - {0x42, 0x3, 0x3, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x1e, 0x1e, 0, 0}, - {0x45, 0, 0, 0, 0}, - {0x46, 0x6e, 0x6e, 0, 0}, - {0x47, 0xf0, 0xf0, 1, 1}, - {0x48, 0, 0, 0, 0}, - {0x49, 0x2, 0x2, 0, 0}, - {0x4A, 0xff, 0xff, 1, 1}, - {0x4B, 0xc, 0xc, 0, 0}, - {0x4C, 0, 0, 0, 0}, - {0x4D, 0x38, 0x38, 0, 0}, - {0x4E, 0x70, 0x70, 1, 1}, - {0x4F, 0x2, 0x2, 0, 0}, - {0x50, 0x88, 0x88, 0, 0}, - {0x51, 0xc, 0xc, 0, 0}, - {0x52, 0, 0, 0, 0}, - {0x53, 0x8, 0x8, 0, 0}, - {0x54, 0x70, 0x70, 1, 1}, - {0x55, 0x2, 0x2, 0, 0}, - {0x56, 0xff, 0xff, 1, 1}, - {0x57, 0, 0, 0, 0}, - {0x58, 0x83, 0x83, 0, 0}, - {0x59, 0x77, 0x77, 1, 1}, - {0x5A, 0, 0, 0, 0}, - {0x5B, 0x2, 0x2, 0, 0}, - {0x5C, 0x88, 0x88, 0, 0}, - {0x5D, 0, 0, 0, 0}, - {0x5E, 0x8, 0x8, 0, 0}, - {0x5F, 0x77, 0x77, 1, 1}, - {0x60, 0x1, 0x1, 0, 0}, - {0x61, 0, 0, 0, 0}, - {0x62, 0x7, 0x7, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0x7, 0x7, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 1, 1}, - {0x68, 0, 0, 0, 0}, - {0x69, 0xa, 0xa, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0, 0, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0, 0, 0, 0}, - {0x71, 0x2, 0x2, 0, 0}, - {0x72, 0, 0, 0, 0}, - {0x73, 0, 0, 0, 0}, - {0x74, 0xe, 0xe, 0, 0}, - {0x75, 0xe, 0xe, 0, 0}, - {0x76, 0xe, 0xe, 0, 0}, - {0x77, 0x13, 0x13, 0, 0}, - {0x78, 0x13, 0x13, 0, 0}, - {0x79, 0x1b, 0x1b, 0, 0}, - {0x7A, 0x1b, 0x1b, 0, 0}, - {0x7B, 0x55, 0x55, 0, 0}, - {0x7C, 0x5b, 0x5b, 0, 0}, - {0x7D, 0x30, 0x30, 1, 1}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0, 0, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0x70, 0x70, 0, 0}, - {0x94, 0x70, 0x70, 0, 0}, - {0x95, 0x71, 0x71, 1, 1}, - {0x96, 0x71, 0x71, 1, 1}, - {0x97, 0x72, 0x72, 1, 1}, - {0x98, 0x73, 0x73, 1, 1}, - {0x99, 0x74, 0x74, 1, 1}, - {0x9A, 0x75, 0x75, 1, 1}, - {0xFFFF, 0, 0, 0, 0}, -}; - -static struct radio_regs regs_RX_2056_rev7[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0x3, 0x3, 0, 0}, - {0x21, 0, 0, 0, 0}, - {0x22, 0, 0, 0, 0}, - {0x23, 0x90, 0x90, 0, 0}, - {0x24, 0x55, 0x55, 0, 0}, - {0x25, 0x15, 0x15, 0, 0}, - {0x26, 0x5, 0x5, 0, 0}, - {0x27, 0x15, 0x15, 0, 0}, - {0x28, 0x5, 0x5, 0, 0}, - {0x29, 0x20, 0x20, 0, 0}, - {0x2A, 0x11, 0x11, 0, 0}, - {0x2B, 0x90, 0x90, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0x88, 0x88, 0, 0}, - {0x2E, 0x32, 0x32, 0, 0}, - {0x2F, 0x77, 0x77, 0, 0}, - {0x30, 0x17, 0x17, 1, 1}, - {0x31, 0xff, 0xff, 1, 1}, - {0x32, 0x20, 0x20, 0, 0}, - {0x33, 0, 0, 0, 0}, - {0x34, 0x88, 0x88, 0, 0}, - {0x35, 0x32, 0x32, 0, 0}, - {0x36, 0x77, 0x77, 0, 0}, - {0x37, 0x17, 0x17, 1, 1}, - {0x38, 0xf0, 0xf0, 1, 1}, - {0x39, 0x20, 0x20, 0, 0}, - {0x3A, 0x8, 0x8, 0, 0}, - {0x3B, 0x55, 0x55, 1, 1}, - {0x3C, 0, 0, 0, 0}, - {0x3D, 0x88, 0x88, 1, 1}, - {0x3E, 0, 0, 0, 0}, - {0x3F, 0, 0, 1, 1}, - {0x40, 0x7, 0x7, 1, 1}, - {0x41, 0x6, 0x6, 0, 0}, - {0x42, 0x4, 0x4, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x8, 0x8, 0, 0}, - {0x45, 0x55, 0x55, 1, 1}, - {0x46, 0, 0, 0, 0}, - {0x47, 0x11, 0x11, 0, 0}, - {0x48, 0, 0, 0, 0}, - {0x49, 0, 0, 1, 1}, - {0x4A, 0x7, 0x7, 0, 0}, - {0x4B, 0x6, 0x6, 0, 0}, - {0x4C, 0x4, 0x4, 0, 0}, - {0x4D, 0, 0, 0, 0}, - {0x4E, 0, 0, 0, 0}, - {0x4F, 0x26, 0x26, 1, 1}, - {0x50, 0x26, 0x26, 1, 1}, - {0x51, 0xf, 0xf, 1, 1}, - {0x52, 0xf, 0xf, 1, 1}, - {0x53, 0x44, 0x44, 0, 0}, - {0x54, 0, 0, 0, 0}, - {0x55, 0, 0, 0, 0}, - {0x56, 0x8, 0x8, 0, 0}, - {0x57, 0x8, 0x8, 0, 0}, - {0x58, 0x7, 0x7, 0, 0}, - {0x59, 0x22, 0x22, 0, 0}, - {0x5A, 0x22, 0x22, 0, 0}, - {0x5B, 0x2, 0x2, 0, 0}, - {0x5C, 0x4, 0x4, 1, 1}, - {0x5D, 0x7, 0x7, 0, 0}, - {0x5E, 0x55, 0x55, 0, 0}, - {0x5F, 0x23, 0x23, 0, 0}, - {0x60, 0x41, 0x41, 0, 0}, - {0x61, 0x1, 0x1, 0, 0}, - {0x62, 0xa, 0xa, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 0, 0}, - {0x68, 0, 0, 0, 0}, - {0x69, 0, 0, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0xc, 0xc, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0, 0, 0, 0}, - {0x71, 0, 0, 0, 0}, - {0x72, 0x22, 0x22, 0, 0}, - {0x73, 0x22, 0x22, 0, 0}, - {0x74, 0, 0, 1, 1}, - {0x75, 0xa, 0xa, 0, 0}, - {0x76, 0x1, 0x1, 0, 0}, - {0x77, 0x22, 0x22, 0, 0}, - {0x78, 0x30, 0x30, 0, 0}, - {0x79, 0, 0, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0, 0, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0}, -}; - -static struct radio_regs regs_SYN_2056_rev8[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0x1, 0x1, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0, 0, 0, 0}, - {0x21, 0, 0, 0, 0}, - {0x22, 0x60, 0x60, 0, 0}, - {0x23, 0x6, 0x6, 0, 0}, - {0x24, 0xc, 0xc, 0, 0}, - {0x25, 0, 0, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0, 0, 0, 0}, - {0x28, 0x1, 0x1, 0, 0}, - {0x29, 0, 0, 0, 0}, - {0x2A, 0, 0, 0, 0}, - {0x2B, 0, 0, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0, 0, 0, 0}, - {0x2E, 0, 0, 0, 0}, - {0x2F, 0x1f, 0x1f, 0, 0}, - {0x30, 0x15, 0x15, 0, 0}, - {0x31, 0xf, 0xf, 0, 0}, - {0x32, 0, 0, 0, 0}, - {0x33, 0, 0, 0, 0}, - {0x34, 0, 0, 0, 0}, - {0x35, 0, 0, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0, 0, 0, 0}, - {0x38, 0, 0, 0, 0}, - {0x39, 0, 0, 0, 0}, - {0x3A, 0, 0, 0, 0}, - {0x3B, 0, 0, 0, 0}, - {0x3C, 0x13, 0x13, 0, 0}, - {0x3D, 0xf, 0xf, 0, 0}, - {0x3E, 0x18, 0x18, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0x20, 0x20, 0, 0}, - {0x42, 0x20, 0x20, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x77, 0x77, 0, 0}, - {0x45, 0x7, 0x7, 0, 0}, - {0x46, 0x1, 0x1, 0, 0}, - {0x47, 0x4, 0x4, 0, 0}, - {0x48, 0xf, 0xf, 0, 0}, - {0x49, 0x30, 0x30, 0, 0}, - {0x4A, 0x32, 0x32, 0, 0}, - {0x4B, 0xd, 0xd, 0, 0}, - {0x4C, 0xd, 0xd, 0, 0}, - {0x4D, 0x4, 0x4, 0, 0}, - {0x4E, 0x6, 0x6, 0, 0}, - {0x4F, 0x1, 0x1, 0, 0}, - {0x50, 0x1c, 0x1c, 0, 0}, - {0x51, 0x2, 0x2, 0, 0}, - {0x52, 0x2, 0x2, 0, 0}, - {0x53, 0xf7, 0xf7, 1, 1}, - {0x54, 0xb4, 0xb4, 0, 0}, - {0x55, 0xd2, 0xd2, 0, 0}, - {0x56, 0, 0, 0, 0}, - {0x57, 0, 0, 0, 0}, - {0x58, 0x4, 0x4, 0, 0}, - {0x59, 0x96, 0x96, 0, 0}, - {0x5A, 0x3e, 0x3e, 0, 0}, - {0x5B, 0x3e, 0x3e, 0, 0}, - {0x5C, 0x13, 0x13, 0, 0}, - {0x5D, 0x2, 0x2, 0, 0}, - {0x5E, 0, 0, 0, 0}, - {0x5F, 0x7, 0x7, 0, 0}, - {0x60, 0x7, 0x7, 1, 1}, - {0x61, 0x8, 0x8, 0, 0}, - {0x62, 0x3, 0x3, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 0, 0}, - {0x68, 0x40, 0x40, 0, 0}, - {0x69, 0, 0, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0, 0, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0x1, 0x1, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0x60, 0x60, 0, 0}, - {0x71, 0x66, 0x66, 0, 0}, - {0x72, 0xc, 0xc, 0, 0}, - {0x73, 0x66, 0x66, 0, 0}, - {0x74, 0x8f, 0x8f, 1, 1}, - {0x75, 0, 0, 0, 0}, - {0x76, 0xcc, 0xcc, 0, 0}, - {0x77, 0x1, 0x1, 0, 0}, - {0x78, 0x66, 0x66, 0, 0}, - {0x79, 0x66, 0x66, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0xff, 0xff, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0, 0, 0, 0}, - {0x95, 0, 0, 0, 0}, - {0x96, 0, 0, 0, 0}, - {0x97, 0, 0, 0, 0}, - {0x98, 0, 0, 0, 0}, - {0x99, 0, 0, 0, 0}, - {0x9A, 0, 0, 0, 0}, - {0x9B, 0, 0, 0, 0}, - {0x9C, 0, 0, 0, 0}, - {0x9D, 0, 0, 0, 0}, - {0x9E, 0, 0, 0, 0}, - {0x9F, 0x6, 0x6, 0, 0}, - {0xA0, 0x66, 0x66, 0, 0}, - {0xA1, 0x66, 0x66, 0, 0}, - {0xA2, 0x66, 0x66, 0, 0}, - {0xA3, 0x66, 0x66, 0, 0}, - {0xA4, 0x66, 0x66, 0, 0}, - {0xA5, 0x66, 0x66, 0, 0}, - {0xA6, 0x66, 0x66, 0, 0}, - {0xA7, 0x66, 0x66, 0, 0}, - {0xA8, 0x66, 0x66, 0, 0}, - {0xA9, 0x66, 0x66, 0, 0}, - {0xAA, 0x66, 0x66, 0, 0}, - {0xAB, 0x66, 0x66, 0, 0}, - {0xAC, 0x66, 0x66, 0, 0}, - {0xAD, 0x66, 0x66, 0, 0}, - {0xAE, 0x66, 0x66, 0, 0}, - {0xAF, 0x66, 0x66, 0, 0}, - {0xB0, 0x66, 0x66, 0, 0}, - {0xB1, 0x66, 0x66, 0, 0}, - {0xB2, 0x66, 0x66, 0, 0}, - {0xB3, 0xa, 0xa, 0, 0}, - {0xB4, 0, 0, 0, 0}, - {0xB5, 0, 0, 0, 0}, - {0xB6, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0}, -}; - -static struct radio_regs regs_TX_2056_rev8[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0, 0, 0, 0}, - {0x21, 0x88, 0x88, 0, 0}, - {0x22, 0x88, 0x88, 0, 0}, - {0x23, 0x88, 0x88, 0, 0}, - {0x24, 0x88, 0x88, 0, 0}, - {0x25, 0xc, 0xc, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0x3, 0x3, 0, 0}, - {0x28, 0, 0, 0, 0}, - {0x29, 0x3, 0x3, 0, 0}, - {0x2A, 0x37, 0x37, 0, 0}, - {0x2B, 0x3, 0x3, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0, 0, 0, 0}, - {0x2E, 0x1, 0x1, 0, 0}, - {0x2F, 0x1, 0x1, 0, 0}, - {0x30, 0, 0, 0, 0}, - {0x31, 0, 0, 0, 0}, - {0x32, 0, 0, 0, 0}, - {0x33, 0x11, 0x11, 0, 0}, - {0x34, 0xee, 0xee, 1, 1}, - {0x35, 0, 0, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0x3, 0x3, 0, 0}, - {0x38, 0x50, 0x50, 1, 1}, - {0x39, 0, 0, 0, 0}, - {0x3A, 0x50, 0x50, 1, 1}, - {0x3B, 0, 0, 0, 0}, - {0x3C, 0x6e, 0x6e, 0, 0}, - {0x3D, 0xf0, 0xf0, 1, 1}, - {0x3E, 0, 0, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0x3, 0x3, 0, 0}, - {0x42, 0x3, 0x3, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x1e, 0x1e, 0, 0}, - {0x45, 0, 0, 0, 0}, - {0x46, 0x6e, 0x6e, 0, 0}, - {0x47, 0xf0, 0xf0, 1, 1}, - {0x48, 0, 0, 0, 0}, - {0x49, 0x2, 0x2, 0, 0}, - {0x4A, 0xff, 0xff, 1, 1}, - {0x4B, 0xc, 0xc, 0, 0}, - {0x4C, 0, 0, 0, 0}, - {0x4D, 0x38, 0x38, 0, 0}, - {0x4E, 0x70, 0x70, 1, 1}, - {0x4F, 0x2, 0x2, 0, 0}, - {0x50, 0x88, 0x88, 0, 0}, - {0x51, 0xc, 0xc, 0, 0}, - {0x52, 0, 0, 0, 0}, - {0x53, 0x8, 0x8, 0, 0}, - {0x54, 0x70, 0x70, 1, 1}, - {0x55, 0x2, 0x2, 0, 0}, - {0x56, 0xff, 0xff, 1, 1}, - {0x57, 0, 0, 0, 0}, - {0x58, 0x83, 0x83, 0, 0}, - {0x59, 0x77, 0x77, 1, 1}, - {0x5A, 0, 0, 0, 0}, - {0x5B, 0x2, 0x2, 0, 0}, - {0x5C, 0x88, 0x88, 0, 0}, - {0x5D, 0, 0, 0, 0}, - {0x5E, 0x8, 0x8, 0, 0}, - {0x5F, 0x77, 0x77, 1, 1}, - {0x60, 0x1, 0x1, 0, 0}, - {0x61, 0, 0, 0, 0}, - {0x62, 0x7, 0x7, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0x7, 0x7, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 1, 1}, - {0x68, 0, 0, 0, 0}, - {0x69, 0xa, 0xa, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0, 0, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0, 0, 0, 0}, - {0x71, 0x2, 0x2, 0, 0}, - {0x72, 0, 0, 0, 0}, - {0x73, 0, 0, 0, 0}, - {0x74, 0xe, 0xe, 0, 0}, - {0x75, 0xe, 0xe, 0, 0}, - {0x76, 0xe, 0xe, 0, 0}, - {0x77, 0x13, 0x13, 0, 0}, - {0x78, 0x13, 0x13, 0, 0}, - {0x79, 0x1b, 0x1b, 0, 0}, - {0x7A, 0x1b, 0x1b, 0, 0}, - {0x7B, 0x55, 0x55, 0, 0}, - {0x7C, 0x5b, 0x5b, 0, 0}, - {0x7D, 0x30, 0x30, 1, 1}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0, 0, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0x70, 0x70, 0, 0}, - {0x94, 0x70, 0x70, 0, 0}, - {0x95, 0x70, 0x70, 0, 0}, - {0x96, 0x70, 0x70, 0, 0}, - {0x97, 0x70, 0x70, 0, 0}, - {0x98, 0x70, 0x70, 0, 0}, - {0x99, 0x70, 0x70, 0, 0}, - {0x9A, 0x70, 0x70, 0, 0}, - {0xFFFF, 0, 0, 0, 0}, -}; - -static struct radio_regs regs_RX_2056_rev8[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0x3, 0x3, 0, 0}, - {0x21, 0, 0, 0, 0}, - {0x22, 0, 0, 0, 0}, - {0x23, 0x90, 0x90, 0, 0}, - {0x24, 0x55, 0x55, 0, 0}, - {0x25, 0x15, 0x15, 0, 0}, - {0x26, 0x5, 0x5, 0, 0}, - {0x27, 0x15, 0x15, 0, 0}, - {0x28, 0x5, 0x5, 0, 0}, - {0x29, 0x20, 0x20, 0, 0}, - {0x2A, 0x11, 0x11, 0, 0}, - {0x2B, 0x90, 0x90, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0x88, 0x88, 0, 0}, - {0x2E, 0x32, 0x32, 0, 0}, - {0x2F, 0x77, 0x77, 0, 0}, - {0x30, 0x17, 0x17, 1, 1}, - {0x31, 0xff, 0xff, 1, 1}, - {0x32, 0x20, 0x20, 0, 0}, - {0x33, 0, 0, 0, 0}, - {0x34, 0x88, 0x88, 0, 0}, - {0x35, 0x32, 0x32, 0, 0}, - {0x36, 0x77, 0x77, 0, 0}, - {0x37, 0x17, 0x17, 1, 1}, - {0x38, 0xf0, 0xf0, 1, 1}, - {0x39, 0x20, 0x20, 0, 0}, - {0x3A, 0x8, 0x8, 0, 0}, - {0x3B, 0x55, 0x55, 1, 1}, - {0x3C, 0, 0, 0, 0}, - {0x3D, 0x88, 0x88, 1, 1}, - {0x3E, 0, 0, 0, 0}, - {0x3F, 0x44, 0x44, 0, 0}, - {0x40, 0x7, 0x7, 1, 1}, - {0x41, 0x6, 0x6, 0, 0}, - {0x42, 0x4, 0x4, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x8, 0x8, 0, 0}, - {0x45, 0x55, 0x55, 1, 1}, - {0x46, 0, 0, 0, 0}, - {0x47, 0x11, 0x11, 0, 0}, - {0x48, 0, 0, 0, 0}, - {0x49, 0x44, 0x44, 0, 0}, - {0x4A, 0x7, 0x7, 0, 0}, - {0x4B, 0x6, 0x6, 0, 0}, - {0x4C, 0x4, 0x4, 0, 0}, - {0x4D, 0, 0, 0, 0}, - {0x4E, 0, 0, 0, 0}, - {0x4F, 0x26, 0x26, 1, 1}, - {0x50, 0x26, 0x26, 1, 1}, - {0x51, 0xf, 0xf, 1, 1}, - {0x52, 0xf, 0xf, 1, 1}, - {0x53, 0x44, 0x44, 0, 0}, - {0x54, 0, 0, 0, 0}, - {0x55, 0, 0, 0, 0}, - {0x56, 0x8, 0x8, 0, 0}, - {0x57, 0x8, 0x8, 0, 0}, - {0x58, 0x7, 0x7, 0, 0}, - {0x59, 0x22, 0x22, 0, 0}, - {0x5A, 0x22, 0x22, 0, 0}, - {0x5B, 0x2, 0x2, 0, 0}, - {0x5C, 0x4, 0x4, 1, 1}, - {0x5D, 0x7, 0x7, 0, 0}, - {0x5E, 0x55, 0x55, 0, 0}, - {0x5F, 0x23, 0x23, 0, 0}, - {0x60, 0x41, 0x41, 0, 0}, - {0x61, 0x1, 0x1, 0, 0}, - {0x62, 0xa, 0xa, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 0, 0}, - {0x68, 0, 0, 0, 0}, - {0x69, 0, 0, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0xc, 0xc, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0, 0, 0, 0}, - {0x71, 0, 0, 0, 0}, - {0x72, 0x22, 0x22, 0, 0}, - {0x73, 0x22, 0x22, 0, 0}, - {0x74, 0, 0, 1, 1}, - {0x75, 0xa, 0xa, 0, 0}, - {0x76, 0x1, 0x1, 0, 0}, - {0x77, 0x22, 0x22, 0, 0}, - {0x78, 0x30, 0x30, 0, 0}, - {0x79, 0, 0, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0x5, 0x5, 1, 1}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0, 0, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0}, -}; - -static const struct radio_regs regs_SYN_2056_rev11[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0x1, 0x1, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0, 0, 0, 0}, - {0x21, 0, 0, 0, 0}, - {0x22, 0x60, 0x60, 0, 0}, - {0x23, 0x6, 0x6, 0, 0}, - {0x24, 0xc, 0xc, 0, 0}, - {0x25, 0, 0, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0, 0, 0, 0}, - {0x28, 0x1, 0x1, 0, 0}, - {0x29, 0, 0, 0, 0}, - {0x2A, 0, 0, 0, 0}, - {0x2B, 0, 0, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0, 0, 0, 0}, - {0x2E, 0, 0, 0, 0}, - {0x2F, 0x1f, 0x1f, 0, 0}, - {0x30, 0x15, 0x15, 0, 0}, - {0x31, 0xf, 0xf, 0, 0}, - {0x32, 0, 0, 0, 0}, - {0x33, 0, 0, 0, 0}, - {0x34, 0, 0, 0, 0}, - {0x35, 0, 0, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0, 0, 0, 0}, - {0x38, 0, 0, 0, 0}, - {0x39, 0, 0, 0, 0}, - {0x3A, 0, 0, 0, 0}, - {0x3B, 0, 0, 0, 0}, - {0x3C, 0x13, 0x13, 0, 0}, - {0x3D, 0xf, 0xf, 0, 0}, - {0x3E, 0x18, 0x18, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0x20, 0x20, 0, 0}, - {0x42, 0x20, 0x20, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x77, 0x77, 0, 0}, - {0x45, 0x7, 0x7, 0, 0}, - {0x46, 0x1, 0x1, 0, 0}, - {0x47, 0x6, 0x6, 1, 1}, - {0x48, 0xf, 0xf, 0, 0}, - {0x49, 0x3f, 0x3f, 1, 1}, - {0x4A, 0x32, 0x32, 0, 0}, - {0x4B, 0x6, 0x6, 1, 1}, - {0x4C, 0x6, 0x6, 1, 1}, - {0x4D, 0x4, 0x4, 0, 0}, - {0x4E, 0x2b, 0x2b, 1, 1}, - {0x4F, 0x1, 0x1, 0, 0}, - {0x50, 0x1c, 0x1c, 0, 0}, - {0x51, 0x2, 0x2, 0, 0}, - {0x52, 0x2, 0x2, 0, 0}, - {0x53, 0xf7, 0xf7, 1, 1}, - {0x54, 0xb4, 0xb4, 0, 0}, - {0x55, 0xd2, 0xd2, 0, 0}, - {0x56, 0, 0, 0, 0}, - {0x57, 0, 0, 0, 0}, - {0x58, 0x4, 0x4, 0, 0}, - {0x59, 0x96, 0x96, 0, 0}, - {0x5A, 0x3e, 0x3e, 0, 0}, - {0x5B, 0x3e, 0x3e, 0, 0}, - {0x5C, 0x13, 0x13, 0, 0}, - {0x5D, 0x2, 0x2, 0, 0}, - {0x5E, 0, 0, 0, 0}, - {0x5F, 0x7, 0x7, 0, 0}, - {0x60, 0x7, 0x7, 1, 1}, - {0x61, 0x8, 0x8, 0, 0}, - {0x62, 0x3, 0x3, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 0, 0}, - {0x68, 0x40, 0x40, 0, 0}, - {0x69, 0, 0, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0, 0, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0x1, 0x1, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0x60, 0x60, 0, 0}, - {0x71, 0x66, 0x66, 0, 0}, - {0x72, 0xc, 0xc, 0, 0}, - {0x73, 0x66, 0x66, 0, 0}, - {0x74, 0x8f, 0x8f, 1, 1}, - {0x75, 0, 0, 0, 0}, - {0x76, 0xcc, 0xcc, 0, 0}, - {0x77, 0x1, 0x1, 0, 0}, - {0x78, 0x66, 0x66, 0, 0}, - {0x79, 0x66, 0x66, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0, 0, 0, 0}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0xff, 0xff, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0, 0, 0, 0}, - {0x95, 0, 0, 0, 0}, - {0x96, 0, 0, 0, 0}, - {0x97, 0, 0, 0, 0}, - {0x98, 0, 0, 0, 0}, - {0x99, 0, 0, 0, 0}, - {0x9A, 0, 0, 0, 0}, - {0x9B, 0, 0, 0, 0}, - {0x9C, 0, 0, 0, 0}, - {0x9D, 0, 0, 0, 0}, - {0x9E, 0, 0, 0, 0}, - {0x9F, 0x6, 0x6, 0, 0}, - {0xA0, 0x66, 0x66, 0, 0}, - {0xA1, 0x66, 0x66, 0, 0}, - {0xA2, 0x66, 0x66, 0, 0}, - {0xA3, 0x66, 0x66, 0, 0}, - {0xA4, 0x66, 0x66, 0, 0}, - {0xA5, 0x66, 0x66, 0, 0}, - {0xA6, 0x66, 0x66, 0, 0}, - {0xA7, 0x66, 0x66, 0, 0}, - {0xA8, 0x66, 0x66, 0, 0}, - {0xA9, 0x66, 0x66, 0, 0}, - {0xAA, 0x66, 0x66, 0, 0}, - {0xAB, 0x66, 0x66, 0, 0}, - {0xAC, 0x66, 0x66, 0, 0}, - {0xAD, 0x66, 0x66, 0, 0}, - {0xAE, 0x66, 0x66, 0, 0}, - {0xAF, 0x66, 0x66, 0, 0}, - {0xB0, 0x66, 0x66, 0, 0}, - {0xB1, 0x66, 0x66, 0, 0}, - {0xB2, 0x66, 0x66, 0, 0}, - {0xB3, 0xa, 0xa, 0, 0}, - {0xB4, 0, 0, 0, 0}, - {0xB5, 0, 0, 0, 0}, - {0xB6, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0}, -}; - -static const struct radio_regs regs_TX_2056_rev11[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0, 0, 0, 0}, - {0x21, 0x88, 0x88, 0, 0}, - {0x22, 0x88, 0x88, 0, 0}, - {0x23, 0x88, 0x88, 0, 0}, - {0x24, 0x88, 0x88, 0, 0}, - {0x25, 0xc, 0xc, 0, 0}, - {0x26, 0, 0, 0, 0}, - {0x27, 0x3, 0x3, 0, 0}, - {0x28, 0, 0, 0, 0}, - {0x29, 0x3, 0x3, 0, 0}, - {0x2A, 0x37, 0x37, 0, 0}, - {0x2B, 0x3, 0x3, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0, 0, 0, 0}, - {0x2E, 0x1, 0x1, 0, 0}, - {0x2F, 0x1, 0x1, 0, 0}, - {0x30, 0, 0, 0, 0}, - {0x31, 0, 0, 0, 0}, - {0x32, 0, 0, 0, 0}, - {0x33, 0x11, 0x11, 0, 0}, - {0x34, 0xee, 0xee, 1, 1}, - {0x35, 0, 0, 0, 0}, - {0x36, 0, 0, 0, 0}, - {0x37, 0x3, 0x3, 0, 0}, - {0x38, 0x50, 0x50, 1, 1}, - {0x39, 0, 0, 0, 0}, - {0x3A, 0x50, 0x50, 1, 1}, - {0x3B, 0, 0, 0, 0}, - {0x3C, 0x6e, 0x6e, 0, 0}, - {0x3D, 0xf0, 0xf0, 1, 1}, - {0x3E, 0, 0, 0, 0}, - {0x3F, 0, 0, 0, 0}, - {0x40, 0, 0, 0, 0}, - {0x41, 0x3, 0x3, 0, 0}, - {0x42, 0x3, 0x3, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x1e, 0x1e, 0, 0}, - {0x45, 0, 0, 0, 0}, - {0x46, 0x6e, 0x6e, 0, 0}, - {0x47, 0xf0, 0xf0, 1, 1}, - {0x48, 0, 0, 0, 0}, - {0x49, 0x2, 0x2, 0, 0}, - {0x4A, 0xff, 0xff, 1, 1}, - {0x4B, 0xc, 0xc, 0, 0}, - {0x4C, 0, 0, 0, 0}, - {0x4D, 0x38, 0x38, 0, 0}, - {0x4E, 0x70, 0x70, 1, 1}, - {0x4F, 0x2, 0x2, 0, 0}, - {0x50, 0x88, 0x88, 0, 0}, - {0x51, 0xc, 0xc, 0, 0}, - {0x52, 0, 0, 0, 0}, - {0x53, 0x8, 0x8, 0, 0}, - {0x54, 0x70, 0x70, 1, 1}, - {0x55, 0x2, 0x2, 0, 0}, - {0x56, 0xff, 0xff, 1, 1}, - {0x57, 0, 0, 0, 0}, - {0x58, 0x83, 0x83, 0, 0}, - {0x59, 0x77, 0x77, 1, 1}, - {0x5A, 0, 0, 0, 0}, - {0x5B, 0x2, 0x2, 0, 0}, - {0x5C, 0x88, 0x88, 0, 0}, - {0x5D, 0, 0, 0, 0}, - {0x5E, 0x8, 0x8, 0, 0}, - {0x5F, 0x77, 0x77, 1, 1}, - {0x60, 0x1, 0x1, 0, 0}, - {0x61, 0, 0, 0, 0}, - {0x62, 0x7, 0x7, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0x7, 0x7, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 1, 1}, - {0x68, 0, 0, 0, 0}, - {0x69, 0xa, 0xa, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0, 0, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0, 0, 0, 0}, - {0x71, 0x2, 0x2, 0, 0}, - {0x72, 0, 0, 0, 0}, - {0x73, 0, 0, 0, 0}, - {0x74, 0xe, 0xe, 0, 0}, - {0x75, 0xe, 0xe, 0, 0}, - {0x76, 0xe, 0xe, 0, 0}, - {0x77, 0x13, 0x13, 0, 0}, - {0x78, 0x13, 0x13, 0, 0}, - {0x79, 0x1b, 0x1b, 0, 0}, - {0x7A, 0x1b, 0x1b, 0, 0}, - {0x7B, 0x55, 0x55, 0, 0}, - {0x7C, 0x5b, 0x5b, 0, 0}, - {0x7D, 0x30, 0x30, 1, 1}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0, 0, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0x70, 0x70, 0, 0}, - {0x94, 0x70, 0x70, 0, 0}, - {0x95, 0x70, 0x70, 0, 0}, - {0x96, 0x70, 0x70, 0, 0}, - {0x97, 0x70, 0x70, 0, 0}, - {0x98, 0x70, 0x70, 0, 0}, - {0x99, 0x70, 0x70, 0, 0}, - {0x9A, 0x70, 0x70, 0, 0}, - {0xFFFF, 0, 0, 0, 0}, -}; - -static const struct radio_regs regs_RX_2056_rev11[] = { - {0x02, 0, 0, 0, 0}, - {0x03, 0, 0, 0, 0}, - {0x04, 0, 0, 0, 0}, - {0x05, 0, 0, 0, 0}, - {0x06, 0, 0, 0, 0}, - {0x07, 0, 0, 0, 0}, - {0x08, 0, 0, 0, 0}, - {0x09, 0, 0, 0, 0}, - {0x0A, 0, 0, 0, 0}, - {0x0B, 0, 0, 0, 0}, - {0x0C, 0, 0, 0, 0}, - {0x0D, 0, 0, 0, 0}, - {0x0E, 0, 0, 0, 0}, - {0x0F, 0, 0, 0, 0}, - {0x10, 0, 0, 0, 0}, - {0x11, 0, 0, 0, 0}, - {0x12, 0, 0, 0, 0}, - {0x13, 0, 0, 0, 0}, - {0x14, 0, 0, 0, 0}, - {0x15, 0, 0, 0, 0}, - {0x16, 0, 0, 0, 0}, - {0x17, 0, 0, 0, 0}, - {0x18, 0, 0, 0, 0}, - {0x19, 0, 0, 0, 0}, - {0x1A, 0, 0, 0, 0}, - {0x1B, 0, 0, 0, 0}, - {0x1C, 0, 0, 0, 0}, - {0x1D, 0, 0, 0, 0}, - {0x1E, 0, 0, 0, 0}, - {0x1F, 0, 0, 0, 0}, - {0x20, 0x3, 0x3, 0, 0}, - {0x21, 0, 0, 0, 0}, - {0x22, 0, 0, 0, 0}, - {0x23, 0x90, 0x90, 0, 0}, - {0x24, 0x55, 0x55, 0, 0}, - {0x25, 0x15, 0x15, 0, 0}, - {0x26, 0x5, 0x5, 0, 0}, - {0x27, 0x15, 0x15, 0, 0}, - {0x28, 0x5, 0x5, 0, 0}, - {0x29, 0x20, 0x20, 0, 0}, - {0x2A, 0x11, 0x11, 0, 0}, - {0x2B, 0x90, 0x90, 0, 0}, - {0x2C, 0, 0, 0, 0}, - {0x2D, 0x88, 0x88, 0, 0}, - {0x2E, 0x32, 0x32, 0, 0}, - {0x2F, 0x77, 0x77, 0, 0}, - {0x30, 0x17, 0x17, 1, 1}, - {0x31, 0xff, 0xff, 1, 1}, - {0x32, 0x20, 0x20, 0, 0}, - {0x33, 0, 0, 0, 0}, - {0x34, 0x88, 0x88, 0, 0}, - {0x35, 0x32, 0x32, 0, 0}, - {0x36, 0x77, 0x77, 0, 0}, - {0x37, 0x17, 0x17, 1, 1}, - {0x38, 0xf0, 0xf0, 1, 1}, - {0x39, 0x20, 0x20, 0, 0}, - {0x3A, 0x8, 0x8, 0, 0}, - {0x3B, 0x55, 0x55, 1, 1}, - {0x3C, 0, 0, 0, 0}, - {0x3D, 0x88, 0x88, 1, 1}, - {0x3E, 0, 0, 0, 0}, - {0x3F, 0x44, 0x44, 0, 0}, - {0x40, 0x7, 0x7, 1, 1}, - {0x41, 0x6, 0x6, 0, 0}, - {0x42, 0x4, 0x4, 0, 0}, - {0x43, 0, 0, 0, 0}, - {0x44, 0x8, 0x8, 0, 0}, - {0x45, 0x55, 0x55, 1, 1}, - {0x46, 0, 0, 0, 0}, - {0x47, 0x11, 0x11, 0, 0}, - {0x48, 0, 0, 0, 0}, - {0x49, 0x44, 0x44, 0, 0}, - {0x4A, 0x7, 0x7, 0, 0}, - {0x4B, 0x6, 0x6, 0, 0}, - {0x4C, 0x4, 0x4, 0, 0}, - {0x4D, 0, 0, 0, 0}, - {0x4E, 0, 0, 0, 0}, - {0x4F, 0x26, 0x26, 1, 1}, - {0x50, 0x26, 0x26, 1, 1}, - {0x51, 0xf, 0xf, 1, 1}, - {0x52, 0xf, 0xf, 1, 1}, - {0x53, 0x44, 0x44, 0, 0}, - {0x54, 0, 0, 0, 0}, - {0x55, 0, 0, 0, 0}, - {0x56, 0x8, 0x8, 0, 0}, - {0x57, 0x8, 0x8, 0, 0}, - {0x58, 0x7, 0x7, 0, 0}, - {0x59, 0x22, 0x22, 0, 0}, - {0x5A, 0x22, 0x22, 0, 0}, - {0x5B, 0x2, 0x2, 0, 0}, - {0x5C, 0x4, 0x4, 1, 1}, - {0x5D, 0x7, 0x7, 0, 0}, - {0x5E, 0x55, 0x55, 0, 0}, - {0x5F, 0x23, 0x23, 0, 0}, - {0x60, 0x41, 0x41, 0, 0}, - {0x61, 0x1, 0x1, 0, 0}, - {0x62, 0xa, 0xa, 0, 0}, - {0x63, 0, 0, 0, 0}, - {0x64, 0, 0, 0, 0}, - {0x65, 0, 0, 0, 0}, - {0x66, 0, 0, 0, 0}, - {0x67, 0, 0, 0, 0}, - {0x68, 0, 0, 0, 0}, - {0x69, 0, 0, 0, 0}, - {0x6A, 0, 0, 0, 0}, - {0x6B, 0xc, 0xc, 0, 0}, - {0x6C, 0, 0, 0, 0}, - {0x6D, 0, 0, 0, 0}, - {0x6E, 0, 0, 0, 0}, - {0x6F, 0, 0, 0, 0}, - {0x70, 0, 0, 0, 0}, - {0x71, 0, 0, 0, 0}, - {0x72, 0x22, 0x22, 0, 0}, - {0x73, 0x22, 0x22, 0, 0}, - {0x74, 0, 0, 1, 1}, - {0x75, 0xa, 0xa, 0, 0}, - {0x76, 0x1, 0x1, 0, 0}, - {0x77, 0x22, 0x22, 0, 0}, - {0x78, 0x30, 0x30, 0, 0}, - {0x79, 0, 0, 0, 0}, - {0x7A, 0, 0, 0, 0}, - {0x7B, 0, 0, 0, 0}, - {0x7C, 0, 0, 0, 0}, - {0x7D, 0x5, 0x5, 1, 1}, - {0x7E, 0, 0, 0, 0}, - {0x7F, 0, 0, 0, 0}, - {0x80, 0, 0, 0, 0}, - {0x81, 0, 0, 0, 0}, - {0x82, 0, 0, 0, 0}, - {0x83, 0, 0, 0, 0}, - {0x84, 0, 0, 0, 0}, - {0x85, 0, 0, 0, 0}, - {0x86, 0, 0, 0, 0}, - {0x87, 0, 0, 0, 0}, - {0x88, 0, 0, 0, 0}, - {0x89, 0, 0, 0, 0}, - {0x8A, 0, 0, 0, 0}, - {0x8B, 0, 0, 0, 0}, - {0x8C, 0, 0, 0, 0}, - {0x8D, 0, 0, 0, 0}, - {0x8E, 0, 0, 0, 0}, - {0x8F, 0, 0, 0, 0}, - {0x90, 0, 0, 0, 0}, - {0x91, 0, 0, 0, 0}, - {0x92, 0, 0, 0, 0}, - {0x93, 0, 0, 0, 0}, - {0x94, 0, 0, 0, 0}, - {0xFFFF, 0, 0, 0, 0}, -}; - -static struct radio_20xx_regs regs_2057_rev4[] = { - {0x00, 0x84, 0}, - {0x01, 0, 0}, - {0x02, 0x60, 0}, - {0x03, 0x1f, 0}, - {0x04, 0x4, 0}, - {0x05, 0x2, 0}, - {0x06, 0x1, 0}, - {0x07, 0x1, 0}, - {0x08, 0x1, 0}, - {0x09, 0x69, 0}, - {0x0A, 0x66, 0}, - {0x0B, 0x6, 0}, - {0x0C, 0x18, 0}, - {0x0D, 0x3, 0}, - {0x0E, 0x20, 1}, - {0x0F, 0x20, 0}, - {0x10, 0, 0}, - {0x11, 0x7c, 0}, - {0x12, 0x42, 0}, - {0x13, 0xbd, 0}, - {0x14, 0x7, 0}, - {0x15, 0xf7, 0}, - {0x16, 0x8, 0}, - {0x17, 0x17, 0}, - {0x18, 0x7, 0}, - {0x19, 0, 0}, - {0x1A, 0x2, 0}, - {0x1B, 0x13, 0}, - {0x1C, 0x3e, 0}, - {0x1D, 0x3e, 0}, - {0x1E, 0x96, 0}, - {0x1F, 0x4, 0}, - {0x20, 0, 0}, - {0x21, 0, 0}, - {0x22, 0x17, 0}, - {0x23, 0x4, 0}, - {0x24, 0x1, 0}, - {0x25, 0x6, 0}, - {0x26, 0x4, 0}, - {0x27, 0xd, 0}, - {0x28, 0xd, 0}, - {0x29, 0x30, 0}, - {0x2A, 0x32, 0}, - {0x2B, 0x8, 0}, - {0x2C, 0x1c, 0}, - {0x2D, 0x2, 0}, - {0x2E, 0x4, 0}, - {0x2F, 0x7f, 0}, - {0x30, 0x27, 0}, - {0x31, 0, 1}, - {0x32, 0, 1}, - {0x33, 0, 1}, - {0x34, 0, 0}, - {0x35, 0x26, 1}, - {0x36, 0x18, 0}, - {0x37, 0x7, 0}, - {0x38, 0x66, 0}, - {0x39, 0x66, 0}, - {0x3A, 0x66, 0}, - {0x3B, 0x66, 0}, - {0x3C, 0xff, 1}, - {0x3D, 0xff, 1}, - {0x3E, 0xff, 1}, - {0x3F, 0xff, 1}, - {0x40, 0x16, 0}, - {0x41, 0x7, 0}, - {0x42, 0x19, 0}, - {0x43, 0x7, 0}, - {0x44, 0x6, 0}, - {0x45, 0x3, 0}, - {0x46, 0x1, 0}, - {0x47, 0x7, 0}, - {0x48, 0x33, 0}, - {0x49, 0x5, 0}, - {0x4A, 0x77, 0}, - {0x4B, 0x66, 0}, - {0x4C, 0x66, 0}, - {0x4D, 0, 0}, - {0x4E, 0x4, 0}, - {0x4F, 0xc, 0}, - {0x50, 0, 0}, - {0x51, 0x75, 0}, - {0x56, 0x7, 0}, - {0x57, 0, 0}, - {0x58, 0, 0}, - {0x59, 0xa8, 0}, - {0x5A, 0, 0}, - {0x5B, 0x1f, 0}, - {0x5C, 0x30, 0}, - {0x5D, 0x1, 0}, - {0x5E, 0x30, 0}, - {0x5F, 0x70, 0}, - {0x60, 0, 0}, - {0x61, 0, 0}, - {0x62, 0x33, 1}, - {0x63, 0x19, 0}, - {0x64, 0x62, 0}, - {0x65, 0, 0}, - {0x66, 0x11, 0}, - {0x69, 0, 0}, - {0x6A, 0x7e, 0}, - {0x6B, 0x3f, 0}, - {0x6C, 0x7f, 0}, - {0x6D, 0x78, 0}, - {0x6E, 0xc8, 0}, - {0x6F, 0x88, 0}, - {0x70, 0x8, 0}, - {0x71, 0xf, 0}, - {0x72, 0xbc, 0}, - {0x73, 0x8, 0}, - {0x74, 0x60, 0}, - {0x75, 0x1e, 0}, - {0x76, 0x70, 0}, - {0x77, 0, 0}, - {0x78, 0, 0}, - {0x79, 0, 0}, - {0x7A, 0x33, 0}, - {0x7B, 0x1e, 0}, - {0x7C, 0x62, 0}, - {0x7D, 0x11, 0}, - {0x80, 0x3c, 0}, - {0x81, 0x9c, 0}, - {0x82, 0xa, 0}, - {0x83, 0x9d, 0}, - {0x84, 0xa, 0}, - {0x85, 0, 0}, - {0x86, 0x40, 0}, - {0x87, 0x40, 0}, - {0x88, 0x88, 0}, - {0x89, 0x10, 0}, - {0x8A, 0xf0, 1}, - {0x8B, 0x10, 1}, - {0x8C, 0xf0, 1}, - {0x8D, 0, 0}, - {0x8E, 0, 0}, - {0x8F, 0x10, 0}, - {0x90, 0x55, 0}, - {0x91, 0x3f, 1}, - {0x92, 0x36, 1}, - {0x93, 0, 0}, - {0x94, 0, 0}, - {0x95, 0, 0}, - {0x96, 0x87, 0}, - {0x97, 0x11, 0}, - {0x98, 0, 0}, - {0x99, 0x33, 0}, - {0x9A, 0x88, 0}, - {0x9B, 0, 0}, - {0x9C, 0x87, 0}, - {0x9D, 0x11, 0}, - {0x9E, 0, 0}, - {0x9F, 0x33, 0}, - {0xA0, 0x88, 0}, - {0xA1, 0xe1, 0}, - {0xA2, 0x3f, 0}, - {0xA3, 0x44, 0}, - {0xA4, 0x8c, 1}, - {0xA5, 0x6d, 0}, - {0xA6, 0x22, 0}, - {0xA7, 0xbe, 0}, - {0xA8, 0x55, 1}, - {0xA9, 0xc, 0}, - {0xAA, 0xc, 0}, - {0xAB, 0xaa, 0}, - {0xAC, 0x2, 0}, - {0xAD, 0, 0}, - {0xAE, 0x10, 0}, - {0xAF, 0x1, 1}, - {0xB0, 0, 0}, - {0xB1, 0, 0}, - {0xB2, 0x80, 0}, - {0xB3, 0x60, 0}, - {0xB4, 0x44, 0}, - {0xB5, 0x55, 0}, - {0xB6, 0x1, 0}, - {0xB7, 0x55, 0}, - {0xB8, 0x1, 0}, - {0xB9, 0x5, 0}, - {0xBA, 0x55, 0}, - {0xBB, 0x55, 0}, - {0xC1, 0, 0}, - {0xC2, 0, 0}, - {0xC3, 0, 0}, - {0xC4, 0, 0}, - {0xC5, 0, 0}, - {0xC6, 0, 0}, - {0xC7, 0, 0}, - {0xC8, 0, 0}, - {0xC9, 0, 0}, - {0xCA, 0, 0}, - {0xCB, 0, 0}, - {0xCC, 0, 0}, - {0xCD, 0, 0}, - {0xCE, 0x5e, 0}, - {0xCF, 0xc, 0}, - {0xD0, 0xc, 0}, - {0xD1, 0xc, 0}, - {0xD2, 0, 0}, - {0xD3, 0x2b, 0}, - {0xD4, 0xc, 0}, - {0xD5, 0, 0}, - {0xD6, 0x75, 0}, - {0xDB, 0x7, 0}, - {0xDC, 0, 0}, - {0xDD, 0, 0}, - {0xDE, 0xa8, 0}, - {0xDF, 0, 0}, - {0xE0, 0x1f, 0}, - {0xE1, 0x30, 0}, - {0xE2, 0x1, 0}, - {0xE3, 0x30, 0}, - {0xE4, 0x70, 0}, - {0xE5, 0, 0}, - {0xE6, 0, 0}, - {0xE7, 0x33, 0}, - {0xE8, 0x19, 0}, - {0xE9, 0x62, 0}, - {0xEA, 0, 0}, - {0xEB, 0x11, 0}, - {0xEE, 0, 0}, - {0xEF, 0x7e, 0}, - {0xF0, 0x3f, 0}, - {0xF1, 0x7f, 0}, - {0xF2, 0x78, 0}, - {0xF3, 0xc8, 0}, - {0xF4, 0x88, 0}, - {0xF5, 0x8, 0}, - {0xF6, 0xf, 0}, - {0xF7, 0xbc, 0}, - {0xF8, 0x8, 0}, - {0xF9, 0x60, 0}, - {0xFA, 0x1e, 0}, - {0xFB, 0x70, 0}, - {0xFC, 0, 0}, - {0xFD, 0, 0}, - {0xFE, 0, 0}, - {0xFF, 0x33, 0}, - {0x100, 0x1e, 0}, - {0x101, 0x62, 0}, - {0x102, 0x11, 0}, - {0x105, 0x3c, 0}, - {0x106, 0x9c, 0}, - {0x107, 0xa, 0}, - {0x108, 0x9d, 0}, - {0x109, 0xa, 0}, - {0x10A, 0, 0}, - {0x10B, 0x40, 0}, - {0x10C, 0x40, 0}, - {0x10D, 0x88, 0}, - {0x10E, 0x10, 0}, - {0x10F, 0xf0, 1}, - {0x110, 0x10, 1}, - {0x111, 0xf0, 1}, - {0x112, 0, 0}, - {0x113, 0, 0}, - {0x114, 0x10, 0}, - {0x115, 0x55, 0}, - {0x116, 0x3f, 1}, - {0x117, 0x36, 1}, - {0x118, 0, 0}, - {0x119, 0, 0}, - {0x11A, 0, 0}, - {0x11B, 0x87, 0}, - {0x11C, 0x11, 0}, - {0x11D, 0, 0}, - {0x11E, 0x33, 0}, - {0x11F, 0x88, 0}, - {0x120, 0, 0}, - {0x121, 0x87, 0}, - {0x122, 0x11, 0}, - {0x123, 0, 0}, - {0x124, 0x33, 0}, - {0x125, 0x88, 0}, - {0x126, 0xe1, 0}, - {0x127, 0x3f, 0}, - {0x128, 0x44, 0}, - {0x129, 0x8c, 1}, - {0x12A, 0x6d, 0}, - {0x12B, 0x22, 0}, - {0x12C, 0xbe, 0}, - {0x12D, 0x55, 1}, - {0x12E, 0xc, 0}, - {0x12F, 0xc, 0}, - {0x130, 0xaa, 0}, - {0x131, 0x2, 0}, - {0x132, 0, 0}, - {0x133, 0x10, 0}, - {0x134, 0x1, 1}, - {0x135, 0, 0}, - {0x136, 0, 0}, - {0x137, 0x80, 0}, - {0x138, 0x60, 0}, - {0x139, 0x44, 0}, - {0x13A, 0x55, 0}, - {0x13B, 0x1, 0}, - {0x13C, 0x55, 0}, - {0x13D, 0x1, 0}, - {0x13E, 0x5, 0}, - {0x13F, 0x55, 0}, - {0x140, 0x55, 0}, - {0x146, 0, 0}, - {0x147, 0, 0}, - {0x148, 0, 0}, - {0x149, 0, 0}, - {0x14A, 0, 0}, - {0x14B, 0, 0}, - {0x14C, 0, 0}, - {0x14D, 0, 0}, - {0x14E, 0, 0}, - {0x14F, 0, 0}, - {0x150, 0, 0}, - {0x151, 0, 0}, - {0x152, 0, 0}, - {0x153, 0, 0}, - {0x154, 0xc, 0}, - {0x155, 0xc, 0}, - {0x156, 0xc, 0}, - {0x157, 0, 0}, - {0x158, 0x2b, 0}, - {0x159, 0x84, 0}, - {0x15A, 0x15, 0}, - {0x15B, 0xf, 0}, - {0x15C, 0, 0}, - {0x15D, 0, 0}, - {0x15E, 0, 1}, - {0x15F, 0, 1}, - {0x160, 0, 1}, - {0x161, 0, 1}, - {0x162, 0, 1}, - {0x163, 0, 1}, - {0x164, 0, 0}, - {0x165, 0, 0}, - {0x166, 0, 0}, - {0x167, 0, 0}, - {0x168, 0, 0}, - {0x169, 0x2, 1}, - {0x16A, 0, 1}, - {0x16B, 0, 1}, - {0x16C, 0, 1}, - {0x16D, 0, 0}, - {0x170, 0, 0}, - {0x171, 0x77, 0}, - {0x172, 0x77, 0}, - {0x173, 0x77, 0}, - {0x174, 0x77, 0}, - {0x175, 0, 0}, - {0x176, 0x3, 0}, - {0x177, 0x37, 0}, - {0x178, 0x3, 0}, - {0x179, 0, 0}, - {0x17A, 0x21, 0}, - {0x17B, 0x21, 0}, - {0x17C, 0, 0}, - {0x17D, 0xaa, 0}, - {0x17E, 0, 0}, - {0x17F, 0xaa, 0}, - {0x180, 0, 0}, - {0x190, 0, 0}, - {0x191, 0x77, 0}, - {0x192, 0x77, 0}, - {0x193, 0x77, 0}, - {0x194, 0x77, 0}, - {0x195, 0, 0}, - {0x196, 0x3, 0}, - {0x197, 0x37, 0}, - {0x198, 0x3, 0}, - {0x199, 0, 0}, - {0x19A, 0x21, 0}, - {0x19B, 0x21, 0}, - {0x19C, 0, 0}, - {0x19D, 0xaa, 0}, - {0x19E, 0, 0}, - {0x19F, 0xaa, 0}, - {0x1A0, 0, 0}, - {0x1A1, 0x2, 0}, - {0x1A2, 0xf, 0}, - {0x1A3, 0xf, 0}, - {0x1A4, 0, 1}, - {0x1A5, 0, 1}, - {0x1A6, 0, 1}, - {0x1A7, 0x2, 0}, - {0x1A8, 0xf, 0}, - {0x1A9, 0xf, 0}, - {0x1AA, 0, 1}, - {0x1AB, 0, 1}, - {0x1AC, 0, 1}, - {0xFFFF, 0, 0}, -}; - -static struct radio_20xx_regs regs_2057_rev5[] = { - {0x00, 0, 1}, - {0x01, 0x57, 1}, - {0x02, 0x20, 1}, - {0x03, 0x1f, 0}, - {0x04, 0x4, 0}, - {0x05, 0x2, 0}, - {0x06, 0x1, 0}, - {0x07, 0x1, 0}, - {0x08, 0x1, 0}, - {0x09, 0x69, 0}, - {0x0A, 0x66, 0}, - {0x0B, 0x6, 0}, - {0x0C, 0x18, 0}, - {0x0D, 0x3, 0}, - {0x0E, 0x20, 0}, - {0x0F, 0x20, 0}, - {0x10, 0, 0}, - {0x11, 0x7c, 0}, - {0x12, 0x42, 0}, - {0x13, 0xbd, 0}, - {0x14, 0x7, 0}, - {0x15, 0x87, 0}, - {0x16, 0x8, 0}, - {0x17, 0x17, 0}, - {0x18, 0x7, 0}, - {0x19, 0, 0}, - {0x1A, 0x2, 0}, - {0x1B, 0x13, 0}, - {0x1C, 0x3e, 0}, - {0x1D, 0x3e, 0}, - {0x1E, 0x96, 0}, - {0x1F, 0x4, 0}, - {0x20, 0, 0}, - {0x21, 0, 0}, - {0x22, 0x17, 0}, - {0x23, 0x6, 1}, - {0x24, 0x1, 0}, - {0x25, 0x6, 0}, - {0x26, 0x4, 0}, - {0x27, 0xd, 0}, - {0x28, 0xd, 0}, - {0x29, 0x30, 0}, - {0x2A, 0x32, 0}, - {0x2B, 0x8, 0}, - {0x2C, 0x1c, 0}, - {0x2D, 0x2, 0}, - {0x2E, 0x4, 0}, - {0x2F, 0x7f, 0}, - {0x30, 0x27, 0}, - {0x31, 0, 1}, - {0x32, 0, 1}, - {0x33, 0, 1}, - {0x34, 0, 0}, - {0x35, 0x20, 0}, - {0x36, 0x18, 0}, - {0x37, 0x7, 0}, - {0x38, 0x66, 0}, - {0x39, 0x66, 0}, - {0x3C, 0xff, 0}, - {0x3D, 0xff, 0}, - {0x40, 0x16, 0}, - {0x41, 0x7, 0}, - {0x45, 0x3, 0}, - {0x46, 0x1, 0}, - {0x47, 0x7, 0}, - {0x4B, 0x66, 0}, - {0x4C, 0x66, 0}, - {0x4D, 0, 0}, - {0x4E, 0x4, 0}, - {0x4F, 0xc, 0}, - {0x50, 0, 0}, - {0x51, 0x70, 1}, - {0x56, 0x7, 0}, - {0x57, 0, 0}, - {0x58, 0, 0}, - {0x59, 0x88, 1}, - {0x5A, 0, 0}, - {0x5B, 0x1f, 0}, - {0x5C, 0x20, 1}, - {0x5D, 0x1, 0}, - {0x5E, 0x30, 0}, - {0x5F, 0x70, 0}, - {0x60, 0, 0}, - {0x61, 0, 0}, - {0x62, 0x33, 1}, - {0x63, 0xf, 1}, - {0x64, 0xf, 1}, - {0x65, 0, 0}, - {0x66, 0x11, 0}, - {0x80, 0x3c, 0}, - {0x81, 0x1, 1}, - {0x82, 0xa, 0}, - {0x85, 0, 0}, - {0x86, 0x40, 0}, - {0x87, 0x40, 0}, - {0x88, 0x88, 0}, - {0x89, 0x10, 0}, - {0x8A, 0xf0, 0}, - {0x8B, 0x10, 0}, - {0x8C, 0xf0, 0}, - {0x8F, 0x10, 0}, - {0x90, 0x55, 0}, - {0x91, 0x3f, 1}, - {0x92, 0x36, 1}, - {0x93, 0, 0}, - {0x94, 0, 0}, - {0x95, 0, 0}, - {0x96, 0x87, 0}, - {0x97, 0x11, 0}, - {0x98, 0, 0}, - {0x99, 0x33, 0}, - {0x9A, 0x88, 0}, - {0xA1, 0x20, 1}, - {0xA2, 0x3f, 0}, - {0xA3, 0x44, 0}, - {0xA4, 0x8c, 0}, - {0xA5, 0x6c, 0}, - {0xA6, 0x22, 0}, - {0xA7, 0xbe, 0}, - {0xA8, 0x55, 0}, - {0xAA, 0xc, 0}, - {0xAB, 0xaa, 0}, - {0xAC, 0x2, 0}, - {0xAD, 0, 0}, - {0xAE, 0x10, 0}, - {0xAF, 0x1, 0}, - {0xB0, 0, 0}, - {0xB1, 0, 0}, - {0xB2, 0x80, 0}, - {0xB3, 0x60, 0}, - {0xB4, 0x44, 0}, - {0xB5, 0x55, 0}, - {0xB6, 0x1, 0}, - {0xB7, 0x55, 0}, - {0xB8, 0x1, 0}, - {0xB9, 0x5, 0}, - {0xBA, 0x55, 0}, - {0xBB, 0x55, 0}, - {0xC3, 0, 0}, - {0xC4, 0, 0}, - {0xC5, 0, 0}, - {0xC6, 0, 0}, - {0xC7, 0, 0}, - {0xC8, 0, 0}, - {0xC9, 0, 0}, - {0xCA, 0, 0}, - {0xCB, 0, 0}, - {0xCD, 0, 0}, - {0xCE, 0x5e, 0}, - {0xCF, 0xc, 0}, - {0xD0, 0xc, 0}, - {0xD1, 0xc, 0}, - {0xD2, 0, 0}, - {0xD3, 0x2b, 0}, - {0xD4, 0xc, 0}, - {0xD5, 0, 0}, - {0xD6, 0x70, 1}, - {0xDB, 0x7, 0}, - {0xDC, 0, 0}, - {0xDD, 0, 0}, - {0xDE, 0x88, 1}, - {0xDF, 0, 0}, - {0xE0, 0x1f, 0}, - {0xE1, 0x20, 1}, - {0xE2, 0x1, 0}, - {0xE3, 0x30, 0}, - {0xE4, 0x70, 0}, - {0xE5, 0, 0}, - {0xE6, 0, 0}, - {0xE7, 0x33, 0}, - {0xE8, 0xf, 1}, - {0xE9, 0xf, 1}, - {0xEA, 0, 0}, - {0xEB, 0x11, 0}, - {0x105, 0x3c, 0}, - {0x106, 0x1, 1}, - {0x107, 0xa, 0}, - {0x10A, 0, 0}, - {0x10B, 0x40, 0}, - {0x10C, 0x40, 0}, - {0x10D, 0x88, 0}, - {0x10E, 0x10, 0}, - {0x10F, 0xf0, 0}, - {0x110, 0x10, 0}, - {0x111, 0xf0, 0}, - {0x114, 0x10, 0}, - {0x115, 0x55, 0}, - {0x116, 0x3f, 1}, - {0x117, 0x36, 1}, - {0x118, 0, 0}, - {0x119, 0, 0}, - {0x11A, 0, 0}, - {0x11B, 0x87, 0}, - {0x11C, 0x11, 0}, - {0x11D, 0, 0}, - {0x11E, 0x33, 0}, - {0x11F, 0x88, 0}, - {0x126, 0x20, 1}, - {0x127, 0x3f, 0}, - {0x128, 0x44, 0}, - {0x129, 0x8c, 0}, - {0x12A, 0x6c, 0}, - {0x12B, 0x22, 0}, - {0x12C, 0xbe, 0}, - {0x12D, 0x55, 0}, - {0x12F, 0xc, 0}, - {0x130, 0xaa, 0}, - {0x131, 0x2, 0}, - {0x132, 0, 0}, - {0x133, 0x10, 0}, - {0x134, 0x1, 0}, - {0x135, 0, 0}, - {0x136, 0, 0}, - {0x137, 0x80, 0}, - {0x138, 0x60, 0}, - {0x139, 0x44, 0}, - {0x13A, 0x55, 0}, - {0x13B, 0x1, 0}, - {0x13C, 0x55, 0}, - {0x13D, 0x1, 0}, - {0x13E, 0x5, 0}, - {0x13F, 0x55, 0}, - {0x140, 0x55, 0}, - {0x148, 0, 0}, - {0x149, 0, 0}, - {0x14A, 0, 0}, - {0x14B, 0, 0}, - {0x14C, 0, 0}, - {0x14D, 0, 0}, - {0x14E, 0, 0}, - {0x14F, 0, 0}, - {0x150, 0, 0}, - {0x154, 0xc, 0}, - {0x155, 0xc, 0}, - {0x156, 0xc, 0}, - {0x157, 0, 0}, - {0x158, 0x2b, 0}, - {0x159, 0x84, 0}, - {0x15A, 0x15, 0}, - {0x15B, 0xf, 0}, - {0x15C, 0, 0}, - {0x15D, 0, 0}, - {0x15E, 0, 1}, - {0x15F, 0, 1}, - {0x160, 0, 1}, - {0x161, 0, 1}, - {0x162, 0, 1}, - {0x163, 0, 1}, - {0x164, 0, 0}, - {0x165, 0, 0}, - {0x166, 0, 0}, - {0x167, 0, 0}, - {0x168, 0, 0}, - {0x169, 0, 0}, - {0x16A, 0, 1}, - {0x16B, 0, 1}, - {0x16C, 0, 1}, - {0x16D, 0, 0}, - {0x170, 0, 0}, - {0x171, 0x77, 0}, - {0x172, 0x77, 0}, - {0x173, 0x77, 0}, - {0x174, 0x77, 0}, - {0x175, 0, 0}, - {0x176, 0x3, 0}, - {0x177, 0x37, 0}, - {0x178, 0x3, 0}, - {0x179, 0, 0}, - {0x17B, 0x21, 0}, - {0x17C, 0, 0}, - {0x17D, 0xaa, 0}, - {0x17E, 0, 0}, - {0x190, 0, 0}, - {0x191, 0x77, 0}, - {0x192, 0x77, 0}, - {0x193, 0x77, 0}, - {0x194, 0x77, 0}, - {0x195, 0, 0}, - {0x196, 0x3, 0}, - {0x197, 0x37, 0}, - {0x198, 0x3, 0}, - {0x199, 0, 0}, - {0x19B, 0x21, 0}, - {0x19C, 0, 0}, - {0x19D, 0xaa, 0}, - {0x19E, 0, 0}, - {0x1A1, 0x2, 0}, - {0x1A2, 0xf, 0}, - {0x1A3, 0xf, 0}, - {0x1A4, 0, 1}, - {0x1A5, 0, 1}, - {0x1A6, 0, 1}, - {0x1A7, 0x2, 0}, - {0x1A8, 0xf, 0}, - {0x1A9, 0xf, 0}, - {0x1AA, 0, 1}, - {0x1AB, 0, 1}, - {0x1AC, 0, 1}, - {0x1AD, 0x84, 0}, - {0x1AE, 0x60, 0}, - {0x1AF, 0x47, 0}, - {0x1B0, 0x47, 0}, - {0x1B1, 0, 0}, - {0x1B2, 0, 0}, - {0x1B3, 0, 0}, - {0x1B4, 0, 0}, - {0x1B5, 0, 0}, - {0x1B6, 0, 0}, - {0x1B7, 0xc, 1}, - {0x1B8, 0, 0}, - {0x1B9, 0, 0}, - {0x1BA, 0, 0}, - {0x1BB, 0, 0}, - {0x1BC, 0, 0}, - {0x1BD, 0, 0}, - {0x1BE, 0, 0}, - {0x1BF, 0, 0}, - {0x1C0, 0, 0}, - {0x1C1, 0x1, 1}, - {0x1C2, 0x80, 1}, - {0x1C3, 0, 0}, - {0x1C4, 0, 0}, - {0x1C5, 0, 0}, - {0x1C6, 0, 0}, - {0x1C7, 0, 0}, - {0x1C8, 0, 0}, - {0x1C9, 0, 0}, - {0x1CA, 0, 0}, - {0xFFFF, 0, 0} -}; - -static struct radio_20xx_regs regs_2057_rev5v1[] = { - {0x00, 0x15, 1}, - {0x01, 0x57, 1}, - {0x02, 0x20, 1}, - {0x03, 0x1f, 0}, - {0x04, 0x4, 0}, - {0x05, 0x2, 0}, - {0x06, 0x1, 0}, - {0x07, 0x1, 0}, - {0x08, 0x1, 0}, - {0x09, 0x69, 0}, - {0x0A, 0x66, 0}, - {0x0B, 0x6, 0}, - {0x0C, 0x18, 0}, - {0x0D, 0x3, 0}, - {0x0E, 0x20, 0}, - {0x0F, 0x20, 0}, - {0x10, 0, 0}, - {0x11, 0x7c, 0}, - {0x12, 0x42, 0}, - {0x13, 0xbd, 0}, - {0x14, 0x7, 0}, - {0x15, 0x87, 0}, - {0x16, 0x8, 0}, - {0x17, 0x17, 0}, - {0x18, 0x7, 0}, - {0x19, 0, 0}, - {0x1A, 0x2, 0}, - {0x1B, 0x13, 0}, - {0x1C, 0x3e, 0}, - {0x1D, 0x3e, 0}, - {0x1E, 0x96, 0}, - {0x1F, 0x4, 0}, - {0x20, 0, 0}, - {0x21, 0, 0}, - {0x22, 0x17, 0}, - {0x23, 0x6, 1}, - {0x24, 0x1, 0}, - {0x25, 0x6, 0}, - {0x26, 0x4, 0}, - {0x27, 0xd, 0}, - {0x28, 0xd, 0}, - {0x29, 0x30, 0}, - {0x2A, 0x32, 0}, - {0x2B, 0x8, 0}, - {0x2C, 0x1c, 0}, - {0x2D, 0x2, 0}, - {0x2E, 0x4, 0}, - {0x2F, 0x7f, 0}, - {0x30, 0x27, 0}, - {0x31, 0, 1}, - {0x32, 0, 1}, - {0x33, 0, 1}, - {0x34, 0, 0}, - {0x35, 0x20, 0}, - {0x36, 0x18, 0}, - {0x37, 0x7, 0}, - {0x38, 0x66, 0}, - {0x39, 0x66, 0}, - {0x3C, 0xff, 0}, - {0x3D, 0xff, 0}, - {0x40, 0x16, 0}, - {0x41, 0x7, 0}, - {0x45, 0x3, 0}, - {0x46, 0x1, 0}, - {0x47, 0x7, 0}, - {0x4B, 0x66, 0}, - {0x4C, 0x66, 0}, - {0x4D, 0, 0}, - {0x4E, 0x4, 0}, - {0x4F, 0xc, 0}, - {0x50, 0, 0}, - {0x51, 0x70, 1}, - {0x56, 0x7, 0}, - {0x57, 0, 0}, - {0x58, 0, 0}, - {0x59, 0x88, 1}, - {0x5A, 0, 0}, - {0x5B, 0x1f, 0}, - {0x5C, 0x20, 1}, - {0x5D, 0x1, 0}, - {0x5E, 0x30, 0}, - {0x5F, 0x70, 0}, - {0x60, 0, 0}, - {0x61, 0, 0}, - {0x62, 0x33, 1}, - {0x63, 0xf, 1}, - {0x64, 0xf, 1}, - {0x65, 0, 0}, - {0x66, 0x11, 0}, - {0x80, 0x3c, 0}, - {0x81, 0x1, 1}, - {0x82, 0xa, 0}, - {0x85, 0, 0}, - {0x86, 0x40, 0}, - {0x87, 0x40, 0}, - {0x88, 0x88, 0}, - {0x89, 0x10, 0}, - {0x8A, 0xf0, 0}, - {0x8B, 0x10, 0}, - {0x8C, 0xf0, 0}, - {0x8F, 0x10, 0}, - {0x90, 0x55, 0}, - {0x91, 0x3f, 1}, - {0x92, 0x36, 1}, - {0x93, 0, 0}, - {0x94, 0, 0}, - {0x95, 0, 0}, - {0x96, 0x87, 0}, - {0x97, 0x11, 0}, - {0x98, 0, 0}, - {0x99, 0x33, 0}, - {0x9A, 0x88, 0}, - {0xA1, 0x20, 1}, - {0xA2, 0x3f, 0}, - {0xA3, 0x44, 0}, - {0xA4, 0x8c, 0}, - {0xA5, 0x6c, 0}, - {0xA6, 0x22, 0}, - {0xA7, 0xbe, 0}, - {0xA8, 0x55, 0}, - {0xAA, 0xc, 0}, - {0xAB, 0xaa, 0}, - {0xAC, 0x2, 0}, - {0xAD, 0, 0}, - {0xAE, 0x10, 0}, - {0xAF, 0x1, 0}, - {0xB0, 0, 0}, - {0xB1, 0, 0}, - {0xB2, 0x80, 0}, - {0xB3, 0x60, 0}, - {0xB4, 0x44, 0}, - {0xB5, 0x55, 0}, - {0xB6, 0x1, 0}, - {0xB7, 0x55, 0}, - {0xB8, 0x1, 0}, - {0xB9, 0x5, 0}, - {0xBA, 0x55, 0}, - {0xBB, 0x55, 0}, - {0xC3, 0, 0}, - {0xC4, 0, 0}, - {0xC5, 0, 0}, - {0xC6, 0, 0}, - {0xC7, 0, 0}, - {0xC8, 0, 0}, - {0xC9, 0x1, 1}, - {0xCA, 0, 0}, - {0xCB, 0, 0}, - {0xCD, 0, 0}, - {0xCE, 0x5e, 0}, - {0xCF, 0xc, 0}, - {0xD0, 0xc, 0}, - {0xD1, 0xc, 0}, - {0xD2, 0, 0}, - {0xD3, 0x2b, 0}, - {0xD4, 0xc, 0}, - {0xD5, 0, 0}, - {0xD6, 0x70, 1}, - {0xDB, 0x7, 0}, - {0xDC, 0, 0}, - {0xDD, 0, 0}, - {0xDE, 0x88, 1}, - {0xDF, 0, 0}, - {0xE0, 0x1f, 0}, - {0xE1, 0x20, 1}, - {0xE2, 0x1, 0}, - {0xE3, 0x30, 0}, - {0xE4, 0x70, 0}, - {0xE5, 0, 0}, - {0xE6, 0, 0}, - {0xE7, 0x33, 0}, - {0xE8, 0xf, 1}, - {0xE9, 0xf, 1}, - {0xEA, 0, 0}, - {0xEB, 0x11, 0}, - {0x105, 0x3c, 0}, - {0x106, 0x1, 1}, - {0x107, 0xa, 0}, - {0x10A, 0, 0}, - {0x10B, 0x40, 0}, - {0x10C, 0x40, 0}, - {0x10D, 0x88, 0}, - {0x10E, 0x10, 0}, - {0x10F, 0xf0, 0}, - {0x110, 0x10, 0}, - {0x111, 0xf0, 0}, - {0x114, 0x10, 0}, - {0x115, 0x55, 0}, - {0x116, 0x3f, 1}, - {0x117, 0x36, 1}, - {0x118, 0, 0}, - {0x119, 0, 0}, - {0x11A, 0, 0}, - {0x11B, 0x87, 0}, - {0x11C, 0x11, 0}, - {0x11D, 0, 0}, - {0x11E, 0x33, 0}, - {0x11F, 0x88, 0}, - {0x126, 0x20, 1}, - {0x127, 0x3f, 0}, - {0x128, 0x44, 0}, - {0x129, 0x8c, 0}, - {0x12A, 0x6c, 0}, - {0x12B, 0x22, 0}, - {0x12C, 0xbe, 0}, - {0x12D, 0x55, 0}, - {0x12F, 0xc, 0}, - {0x130, 0xaa, 0}, - {0x131, 0x2, 0}, - {0x132, 0, 0}, - {0x133, 0x10, 0}, - {0x134, 0x1, 0}, - {0x135, 0, 0}, - {0x136, 0, 0}, - {0x137, 0x80, 0}, - {0x138, 0x60, 0}, - {0x139, 0x44, 0}, - {0x13A, 0x55, 0}, - {0x13B, 0x1, 0}, - {0x13C, 0x55, 0}, - {0x13D, 0x1, 0}, - {0x13E, 0x5, 0}, - {0x13F, 0x55, 0}, - {0x140, 0x55, 0}, - {0x148, 0, 0}, - {0x149, 0, 0}, - {0x14A, 0, 0}, - {0x14B, 0, 0}, - {0x14C, 0, 0}, - {0x14D, 0, 0}, - {0x14E, 0x1, 1}, - {0x14F, 0, 0}, - {0x150, 0, 0}, - {0x154, 0xc, 0}, - {0x155, 0xc, 0}, - {0x156, 0xc, 0}, - {0x157, 0, 0}, - {0x158, 0x2b, 0}, - {0x159, 0x84, 0}, - {0x15A, 0x15, 0}, - {0x15B, 0xf, 0}, - {0x15C, 0, 0}, - {0x15D, 0, 0}, - {0x15E, 0, 1}, - {0x15F, 0, 1}, - {0x160, 0, 1}, - {0x161, 0, 1}, - {0x162, 0, 1}, - {0x163, 0, 1}, - {0x164, 0, 0}, - {0x165, 0, 0}, - {0x166, 0, 0}, - {0x167, 0, 0}, - {0x168, 0, 0}, - {0x169, 0, 0}, - {0x16A, 0, 1}, - {0x16B, 0, 1}, - {0x16C, 0, 1}, - {0x16D, 0, 0}, - {0x170, 0, 0}, - {0x171, 0x77, 0}, - {0x172, 0x77, 0}, - {0x173, 0x77, 0}, - {0x174, 0x77, 0}, - {0x175, 0, 0}, - {0x176, 0x3, 0}, - {0x177, 0x37, 0}, - {0x178, 0x3, 0}, - {0x179, 0, 0}, - {0x17B, 0x21, 0}, - {0x17C, 0, 0}, - {0x17D, 0xaa, 0}, - {0x17E, 0, 0}, - {0x190, 0, 0}, - {0x191, 0x77, 0}, - {0x192, 0x77, 0}, - {0x193, 0x77, 0}, - {0x194, 0x77, 0}, - {0x195, 0, 0}, - {0x196, 0x3, 0}, - {0x197, 0x37, 0}, - {0x198, 0x3, 0}, - {0x199, 0, 0}, - {0x19B, 0x21, 0}, - {0x19C, 0, 0}, - {0x19D, 0xaa, 0}, - {0x19E, 0, 0}, - {0x1A1, 0x2, 0}, - {0x1A2, 0xf, 0}, - {0x1A3, 0xf, 0}, - {0x1A4, 0, 1}, - {0x1A5, 0, 1}, - {0x1A6, 0, 1}, - {0x1A7, 0x2, 0}, - {0x1A8, 0xf, 0}, - {0x1A9, 0xf, 0}, - {0x1AA, 0, 1}, - {0x1AB, 0, 1}, - {0x1AC, 0, 1}, - {0x1AD, 0x84, 0}, - {0x1AE, 0x60, 0}, - {0x1AF, 0x47, 0}, - {0x1B0, 0x47, 0}, - {0x1B1, 0, 0}, - {0x1B2, 0, 0}, - {0x1B3, 0, 0}, - {0x1B4, 0, 0}, - {0x1B5, 0, 0}, - {0x1B6, 0, 0}, - {0x1B7, 0xc, 1}, - {0x1B8, 0, 0}, - {0x1B9, 0, 0}, - {0x1BA, 0, 0}, - {0x1BB, 0, 0}, - {0x1BC, 0, 0}, - {0x1BD, 0, 0}, - {0x1BE, 0, 0}, - {0x1BF, 0, 0}, - {0x1C0, 0, 0}, - {0x1C1, 0x1, 1}, - {0x1C2, 0x80, 1}, - {0x1C3, 0, 0}, - {0x1C4, 0, 0}, - {0x1C5, 0, 0}, - {0x1C6, 0, 0}, - {0x1C7, 0, 0}, - {0x1C8, 0, 0}, - {0x1C9, 0, 0}, - {0x1CA, 0, 0}, - {0xFFFF, 0, 0} -}; - -static struct radio_20xx_regs regs_2057_rev7[] = { - {0x00, 0, 1}, - {0x01, 0x57, 1}, - {0x02, 0x20, 1}, - {0x03, 0x1f, 0}, - {0x04, 0x4, 0}, - {0x05, 0x2, 0}, - {0x06, 0x1, 0}, - {0x07, 0x1, 0}, - {0x08, 0x1, 0}, - {0x09, 0x69, 0}, - {0x0A, 0x66, 0}, - {0x0B, 0x6, 0}, - {0x0C, 0x18, 0}, - {0x0D, 0x3, 0}, - {0x0E, 0x20, 0}, - {0x0F, 0x20, 0}, - {0x10, 0, 0}, - {0x11, 0x7c, 0}, - {0x12, 0x42, 0}, - {0x13, 0xbd, 0}, - {0x14, 0x7, 0}, - {0x15, 0x87, 0}, - {0x16, 0x8, 0}, - {0x17, 0x17, 0}, - {0x18, 0x7, 0}, - {0x19, 0, 0}, - {0x1A, 0x2, 0}, - {0x1B, 0x13, 0}, - {0x1C, 0x3e, 0}, - {0x1D, 0x3e, 0}, - {0x1E, 0x96, 0}, - {0x1F, 0x4, 0}, - {0x20, 0, 0}, - {0x21, 0, 0}, - {0x22, 0x17, 0}, - {0x23, 0x6, 0}, - {0x24, 0x1, 0}, - {0x25, 0x6, 0}, - {0x26, 0x4, 0}, - {0x27, 0xd, 0}, - {0x28, 0xd, 0}, - {0x29, 0x30, 0}, - {0x2A, 0x32, 0}, - {0x2B, 0x8, 0}, - {0x2C, 0x1c, 0}, - {0x2D, 0x2, 0}, - {0x2E, 0x4, 0}, - {0x2F, 0x7f, 0}, - {0x30, 0x27, 0}, - {0x31, 0, 1}, - {0x32, 0, 1}, - {0x33, 0, 1}, - {0x34, 0, 0}, - {0x35, 0x20, 0}, - {0x36, 0x18, 0}, - {0x37, 0x7, 0}, - {0x38, 0x66, 0}, - {0x39, 0x66, 0}, - {0x3A, 0x66, 0}, - {0x3B, 0x66, 0}, - {0x3C, 0xff, 0}, - {0x3D, 0xff, 0}, - {0x3E, 0xff, 0}, - {0x3F, 0xff, 0}, - {0x40, 0x16, 0}, - {0x41, 0x7, 0}, - {0x42, 0x19, 0}, - {0x43, 0x7, 0}, - {0x44, 0x6, 0}, - {0x45, 0x3, 0}, - {0x46, 0x1, 0}, - {0x47, 0x7, 0}, - {0x48, 0x33, 0}, - {0x49, 0x5, 0}, - {0x4A, 0x77, 0}, - {0x4B, 0x66, 0}, - {0x4C, 0x66, 0}, - {0x4D, 0, 0}, - {0x4E, 0x4, 0}, - {0x4F, 0xc, 0}, - {0x50, 0, 0}, - {0x51, 0x70, 1}, - {0x56, 0x7, 0}, - {0x57, 0, 0}, - {0x58, 0, 0}, - {0x59, 0x88, 1}, - {0x5A, 0, 0}, - {0x5B, 0x1f, 0}, - {0x5C, 0x20, 1}, - {0x5D, 0x1, 0}, - {0x5E, 0x30, 0}, - {0x5F, 0x70, 0}, - {0x60, 0, 0}, - {0x61, 0, 0}, - {0x62, 0x33, 1}, - {0x63, 0xf, 1}, - {0x64, 0x13, 1}, - {0x65, 0, 0}, - {0x66, 0xee, 1}, - {0x69, 0, 0}, - {0x6A, 0x7e, 0}, - {0x6B, 0x3f, 0}, - {0x6C, 0x7f, 0}, - {0x6D, 0x78, 0}, - {0x6E, 0x58, 1}, - {0x6F, 0x88, 0}, - {0x70, 0x8, 0}, - {0x71, 0xf, 0}, - {0x72, 0xbc, 0}, - {0x73, 0x8, 0}, - {0x74, 0x60, 0}, - {0x75, 0x13, 1}, - {0x76, 0x70, 0}, - {0x77, 0, 0}, - {0x78, 0, 0}, - {0x79, 0, 0}, - {0x7A, 0x33, 0}, - {0x7B, 0x13, 1}, - {0x7C, 0x14, 1}, - {0x7D, 0xee, 1}, - {0x80, 0x3c, 0}, - {0x81, 0x1, 1}, - {0x82, 0xa, 0}, - {0x83, 0x9d, 0}, - {0x84, 0xa, 0}, - {0x85, 0, 0}, - {0x86, 0x40, 0}, - {0x87, 0x40, 0}, - {0x88, 0x88, 0}, - {0x89, 0x10, 0}, - {0x8A, 0xf0, 0}, - {0x8B, 0x10, 0}, - {0x8C, 0xf0, 0}, - {0x8D, 0, 0}, - {0x8E, 0, 0}, - {0x8F, 0x10, 0}, - {0x90, 0x55, 0}, - {0x91, 0x3f, 1}, - {0x92, 0x36, 1}, - {0x93, 0, 0}, - {0x94, 0, 0}, - {0x95, 0, 0}, - {0x96, 0x87, 0}, - {0x97, 0x11, 0}, - {0x98, 0, 0}, - {0x99, 0x33, 0}, - {0x9A, 0x88, 0}, - {0x9B, 0, 0}, - {0x9C, 0x87, 0}, - {0x9D, 0x11, 0}, - {0x9E, 0, 0}, - {0x9F, 0x33, 0}, - {0xA0, 0x88, 0}, - {0xA1, 0x20, 1}, - {0xA2, 0x3f, 0}, - {0xA3, 0x44, 0}, - {0xA4, 0x8c, 0}, - {0xA5, 0x6c, 0}, - {0xA6, 0x22, 0}, - {0xA7, 0xbe, 0}, - {0xA8, 0x55, 0}, - {0xAA, 0xc, 0}, - {0xAB, 0xaa, 0}, - {0xAC, 0x2, 0}, - {0xAD, 0, 0}, - {0xAE, 0x10, 0}, - {0xAF, 0x1, 0}, - {0xB0, 0, 0}, - {0xB1, 0, 0}, - {0xB2, 0x80, 0}, - {0xB3, 0x60, 0}, - {0xB4, 0x44, 0}, - {0xB5, 0x55, 0}, - {0xB6, 0x1, 0}, - {0xB7, 0x55, 0}, - {0xB8, 0x1, 0}, - {0xB9, 0x5, 0}, - {0xBA, 0x55, 0}, - {0xBB, 0x55, 0}, - {0xC1, 0, 0}, - {0xC2, 0, 0}, - {0xC3, 0, 0}, - {0xC4, 0, 0}, - {0xC5, 0, 0}, - {0xC6, 0, 0}, - {0xC7, 0, 0}, - {0xC8, 0, 0}, - {0xC9, 0, 0}, - {0xCA, 0, 0}, - {0xCB, 0, 0}, - {0xCC, 0, 0}, - {0xCD, 0, 0}, - {0xCE, 0x5e, 0}, - {0xCF, 0xc, 0}, - {0xD0, 0xc, 0}, - {0xD1, 0xc, 0}, - {0xD2, 0, 0}, - {0xD3, 0x2b, 0}, - {0xD4, 0xc, 0}, - {0xD5, 0, 0}, - {0xD6, 0x70, 1}, - {0xDB, 0x7, 0}, - {0xDC, 0, 0}, - {0xDD, 0, 0}, - {0xDE, 0x88, 1}, - {0xDF, 0, 0}, - {0xE0, 0x1f, 0}, - {0xE1, 0x20, 1}, - {0xE2, 0x1, 0}, - {0xE3, 0x30, 0}, - {0xE4, 0x70, 0}, - {0xE5, 0, 0}, - {0xE6, 0, 0}, - {0xE7, 0x33, 0}, - {0xE8, 0xf, 1}, - {0xE9, 0x13, 1}, - {0xEA, 0, 0}, - {0xEB, 0xee, 1}, - {0xEE, 0, 0}, - {0xEF, 0x7e, 0}, - {0xF0, 0x3f, 0}, - {0xF1, 0x7f, 0}, - {0xF2, 0x78, 0}, - {0xF3, 0x58, 1}, - {0xF4, 0x88, 0}, - {0xF5, 0x8, 0}, - {0xF6, 0xf, 0}, - {0xF7, 0xbc, 0}, - {0xF8, 0x8, 0}, - {0xF9, 0x60, 0}, - {0xFA, 0x13, 1}, - {0xFB, 0x70, 0}, - {0xFC, 0, 0}, - {0xFD, 0, 0}, - {0xFE, 0, 0}, - {0xFF, 0x33, 0}, - {0x100, 0x13, 1}, - {0x101, 0x14, 1}, - {0x102, 0xee, 1}, - {0x105, 0x3c, 0}, - {0x106, 0x1, 1}, - {0x107, 0xa, 0}, - {0x108, 0x9d, 0}, - {0x109, 0xa, 0}, - {0x10A, 0, 0}, - {0x10B, 0x40, 0}, - {0x10C, 0x40, 0}, - {0x10D, 0x88, 0}, - {0x10E, 0x10, 0}, - {0x10F, 0xf0, 0}, - {0x110, 0x10, 0}, - {0x111, 0xf0, 0}, - {0x112, 0, 0}, - {0x113, 0, 0}, - {0x114, 0x10, 0}, - {0x115, 0x55, 0}, - {0x116, 0x3f, 1}, - {0x117, 0x36, 1}, - {0x118, 0, 0}, - {0x119, 0, 0}, - {0x11A, 0, 0}, - {0x11B, 0x87, 0}, - {0x11C, 0x11, 0}, - {0x11D, 0, 0}, - {0x11E, 0x33, 0}, - {0x11F, 0x88, 0}, - {0x120, 0, 0}, - {0x121, 0x87, 0}, - {0x122, 0x11, 0}, - {0x123, 0, 0}, - {0x124, 0x33, 0}, - {0x125, 0x88, 0}, - {0x126, 0x20, 1}, - {0x127, 0x3f, 0}, - {0x128, 0x44, 0}, - {0x129, 0x8c, 0}, - {0x12A, 0x6c, 0}, - {0x12B, 0x22, 0}, - {0x12C, 0xbe, 0}, - {0x12D, 0x55, 0}, - {0x12F, 0xc, 0}, - {0x130, 0xaa, 0}, - {0x131, 0x2, 0}, - {0x132, 0, 0}, - {0x133, 0x10, 0}, - {0x134, 0x1, 0}, - {0x135, 0, 0}, - {0x136, 0, 0}, - {0x137, 0x80, 0}, - {0x138, 0x60, 0}, - {0x139, 0x44, 0}, - {0x13A, 0x55, 0}, - {0x13B, 0x1, 0}, - {0x13C, 0x55, 0}, - {0x13D, 0x1, 0}, - {0x13E, 0x5, 0}, - {0x13F, 0x55, 0}, - {0x140, 0x55, 0}, - {0x146, 0, 0}, - {0x147, 0, 0}, - {0x148, 0, 0}, - {0x149, 0, 0}, - {0x14A, 0, 0}, - {0x14B, 0, 0}, - {0x14C, 0, 0}, - {0x14D, 0, 0}, - {0x14E, 0, 0}, - {0x14F, 0, 0}, - {0x150, 0, 0}, - {0x151, 0, 0}, - {0x154, 0xc, 0}, - {0x155, 0xc, 0}, - {0x156, 0xc, 0}, - {0x157, 0, 0}, - {0x158, 0x2b, 0}, - {0x159, 0x84, 0}, - {0x15A, 0x15, 0}, - {0x15B, 0xf, 0}, - {0x15C, 0, 0}, - {0x15D, 0, 0}, - {0x15E, 0, 1}, - {0x15F, 0, 1}, - {0x160, 0, 1}, - {0x161, 0, 1}, - {0x162, 0, 1}, - {0x163, 0, 1}, - {0x164, 0, 0}, - {0x165, 0, 0}, - {0x166, 0, 0}, - {0x167, 0, 0}, - {0x168, 0, 0}, - {0x169, 0, 0}, - {0x16A, 0, 1}, - {0x16B, 0, 1}, - {0x16C, 0, 1}, - {0x16D, 0, 0}, - {0x170, 0, 0}, - {0x171, 0x77, 0}, - {0x172, 0x77, 0}, - {0x173, 0x77, 0}, - {0x174, 0x77, 0}, - {0x175, 0, 0}, - {0x176, 0x3, 0}, - {0x177, 0x37, 0}, - {0x178, 0x3, 0}, - {0x179, 0, 0}, - {0x17A, 0x21, 0}, - {0x17B, 0x21, 0}, - {0x17C, 0, 0}, - {0x17D, 0xaa, 0}, - {0x17E, 0, 0}, - {0x17F, 0xaa, 0}, - {0x180, 0, 0}, - {0x190, 0, 0}, - {0x191, 0x77, 0}, - {0x192, 0x77, 0}, - {0x193, 0x77, 0}, - {0x194, 0x77, 0}, - {0x195, 0, 0}, - {0x196, 0x3, 0}, - {0x197, 0x37, 0}, - {0x198, 0x3, 0}, - {0x199, 0, 0}, - {0x19A, 0x21, 0}, - {0x19B, 0x21, 0}, - {0x19C, 0, 0}, - {0x19D, 0xaa, 0}, - {0x19E, 0, 0}, - {0x19F, 0xaa, 0}, - {0x1A0, 0, 0}, - {0x1A1, 0x2, 0}, - {0x1A2, 0xf, 0}, - {0x1A3, 0xf, 0}, - {0x1A4, 0, 1}, - {0x1A5, 0, 1}, - {0x1A6, 0, 1}, - {0x1A7, 0x2, 0}, - {0x1A8, 0xf, 0}, - {0x1A9, 0xf, 0}, - {0x1AA, 0, 1}, - {0x1AB, 0, 1}, - {0x1AC, 0, 1}, - {0x1AD, 0x84, 0}, - {0x1AE, 0x60, 0}, - {0x1AF, 0x47, 0}, - {0x1B0, 0x47, 0}, - {0x1B1, 0, 0}, - {0x1B2, 0, 0}, - {0x1B3, 0, 0}, - {0x1B4, 0, 0}, - {0x1B5, 0, 0}, - {0x1B6, 0, 0}, - {0x1B7, 0x5, 1}, - {0x1B8, 0, 0}, - {0x1B9, 0, 0}, - {0x1BA, 0, 0}, - {0x1BB, 0, 0}, - {0x1BC, 0, 0}, - {0x1BD, 0, 0}, - {0x1BE, 0, 0}, - {0x1BF, 0, 0}, - {0x1C0, 0, 0}, - {0x1C1, 0, 0}, - {0x1C2, 0xa0, 1}, - {0x1C3, 0, 0}, - {0x1C4, 0, 0}, - {0x1C5, 0, 0}, - {0x1C6, 0, 0}, - {0x1C7, 0, 0}, - {0x1C8, 0, 0}, - {0x1C9, 0, 0}, - {0x1CA, 0, 0}, - {0xFFFF, 0, 0} -}; - -static struct radio_20xx_regs regs_2057_rev8[] = { - {0x00, 0x8, 1}, - {0x01, 0x57, 1}, - {0x02, 0x20, 1}, - {0x03, 0x1f, 0}, - {0x04, 0x4, 0}, - {0x05, 0x2, 0}, - {0x06, 0x1, 0}, - {0x07, 0x1, 0}, - {0x08, 0x1, 0}, - {0x09, 0x69, 0}, - {0x0A, 0x66, 0}, - {0x0B, 0x6, 0}, - {0x0C, 0x18, 0}, - {0x0D, 0x3, 0}, - {0x0E, 0x20, 0}, - {0x0F, 0x20, 0}, - {0x10, 0, 0}, - {0x11, 0x7c, 0}, - {0x12, 0x42, 0}, - {0x13, 0xbd, 0}, - {0x14, 0x7, 0}, - {0x15, 0x87, 0}, - {0x16, 0x8, 0}, - {0x17, 0x17, 0}, - {0x18, 0x7, 0}, - {0x19, 0, 0}, - {0x1A, 0x2, 0}, - {0x1B, 0x13, 0}, - {0x1C, 0x3e, 0}, - {0x1D, 0x3e, 0}, - {0x1E, 0x96, 0}, - {0x1F, 0x4, 0}, - {0x20, 0, 0}, - {0x21, 0, 0}, - {0x22, 0x17, 0}, - {0x23, 0x6, 0}, - {0x24, 0x1, 0}, - {0x25, 0x6, 0}, - {0x26, 0x4, 0}, - {0x27, 0xd, 0}, - {0x28, 0xd, 0}, - {0x29, 0x30, 0}, - {0x2A, 0x32, 0}, - {0x2B, 0x8, 0}, - {0x2C, 0x1c, 0}, - {0x2D, 0x2, 0}, - {0x2E, 0x4, 0}, - {0x2F, 0x7f, 0}, - {0x30, 0x27, 0}, - {0x31, 0, 1}, - {0x32, 0, 1}, - {0x33, 0, 1}, - {0x34, 0, 0}, - {0x35, 0x20, 0}, - {0x36, 0x18, 0}, - {0x37, 0x7, 0}, - {0x38, 0x66, 0}, - {0x39, 0x66, 0}, - {0x3A, 0x66, 0}, - {0x3B, 0x66, 0}, - {0x3C, 0xff, 0}, - {0x3D, 0xff, 0}, - {0x3E, 0xff, 0}, - {0x3F, 0xff, 0}, - {0x40, 0x16, 0}, - {0x41, 0x7, 0}, - {0x42, 0x19, 0}, - {0x43, 0x7, 0}, - {0x44, 0x6, 0}, - {0x45, 0x3, 0}, - {0x46, 0x1, 0}, - {0x47, 0x7, 0}, - {0x48, 0x33, 0}, - {0x49, 0x5, 0}, - {0x4A, 0x77, 0}, - {0x4B, 0x66, 0}, - {0x4C, 0x66, 0}, - {0x4D, 0, 0}, - {0x4E, 0x4, 0}, - {0x4F, 0xc, 0}, - {0x50, 0, 0}, - {0x51, 0x70, 1}, - {0x56, 0x7, 0}, - {0x57, 0, 0}, - {0x58, 0, 0}, - {0x59, 0x88, 1}, - {0x5A, 0, 0}, - {0x5B, 0x1f, 0}, - {0x5C, 0x20, 1}, - {0x5D, 0x1, 0}, - {0x5E, 0x30, 0}, - {0x5F, 0x70, 0}, - {0x60, 0, 0}, - {0x61, 0, 0}, - {0x62, 0x33, 1}, - {0x63, 0xf, 1}, - {0x64, 0xf, 1}, - {0x65, 0, 0}, - {0x66, 0x11, 0}, - {0x69, 0, 0}, - {0x6A, 0x7e, 0}, - {0x6B, 0x3f, 0}, - {0x6C, 0x7f, 0}, - {0x6D, 0x78, 0}, - {0x6E, 0x58, 1}, - {0x6F, 0x88, 0}, - {0x70, 0x8, 0}, - {0x71, 0xf, 0}, - {0x72, 0xbc, 0}, - {0x73, 0x8, 0}, - {0x74, 0x60, 0}, - {0x75, 0x13, 1}, - {0x76, 0x70, 0}, - {0x77, 0, 0}, - {0x78, 0, 0}, - {0x79, 0, 0}, - {0x7A, 0x33, 0}, - {0x7B, 0x13, 1}, - {0x7C, 0xf, 1}, - {0x7D, 0xee, 1}, - {0x80, 0x3c, 0}, - {0x81, 0x1, 1}, - {0x82, 0xa, 0}, - {0x83, 0x9d, 0}, - {0x84, 0xa, 0}, - {0x85, 0, 0}, - {0x86, 0x40, 0}, - {0x87, 0x40, 0}, - {0x88, 0x88, 0}, - {0x89, 0x10, 0}, - {0x8A, 0xf0, 0}, - {0x8B, 0x10, 0}, - {0x8C, 0xf0, 0}, - {0x8D, 0, 0}, - {0x8E, 0, 0}, - {0x8F, 0x10, 0}, - {0x90, 0x55, 0}, - {0x91, 0x3f, 1}, - {0x92, 0x36, 1}, - {0x93, 0, 0}, - {0x94, 0, 0}, - {0x95, 0, 0}, - {0x96, 0x87, 0}, - {0x97, 0x11, 0}, - {0x98, 0, 0}, - {0x99, 0x33, 0}, - {0x9A, 0x88, 0}, - {0x9B, 0, 0}, - {0x9C, 0x87, 0}, - {0x9D, 0x11, 0}, - {0x9E, 0, 0}, - {0x9F, 0x33, 0}, - {0xA0, 0x88, 0}, - {0xA1, 0x20, 1}, - {0xA2, 0x3f, 0}, - {0xA3, 0x44, 0}, - {0xA4, 0x8c, 0}, - {0xA5, 0x6c, 0}, - {0xA6, 0x22, 0}, - {0xA7, 0xbe, 0}, - {0xA8, 0x55, 0}, - {0xAA, 0xc, 0}, - {0xAB, 0xaa, 0}, - {0xAC, 0x2, 0}, - {0xAD, 0, 0}, - {0xAE, 0x10, 0}, - {0xAF, 0x1, 0}, - {0xB0, 0, 0}, - {0xB1, 0, 0}, - {0xB2, 0x80, 0}, - {0xB3, 0x60, 0}, - {0xB4, 0x44, 0}, - {0xB5, 0x55, 0}, - {0xB6, 0x1, 0}, - {0xB7, 0x55, 0}, - {0xB8, 0x1, 0}, - {0xB9, 0x5, 0}, - {0xBA, 0x55, 0}, - {0xBB, 0x55, 0}, - {0xC1, 0, 0}, - {0xC2, 0, 0}, - {0xC3, 0, 0}, - {0xC4, 0, 0}, - {0xC5, 0, 0}, - {0xC6, 0, 0}, - {0xC7, 0, 0}, - {0xC8, 0, 0}, - {0xC9, 0x1, 1}, - {0xCA, 0, 0}, - {0xCB, 0, 0}, - {0xCC, 0, 0}, - {0xCD, 0, 0}, - {0xCE, 0x5e, 0}, - {0xCF, 0xc, 0}, - {0xD0, 0xc, 0}, - {0xD1, 0xc, 0}, - {0xD2, 0, 0}, - {0xD3, 0x2b, 0}, - {0xD4, 0xc, 0}, - {0xD5, 0, 0}, - {0xD6, 0x70, 1}, - {0xDB, 0x7, 0}, - {0xDC, 0, 0}, - {0xDD, 0, 0}, - {0xDE, 0x88, 1}, - {0xDF, 0, 0}, - {0xE0, 0x1f, 0}, - {0xE1, 0x20, 1}, - {0xE2, 0x1, 0}, - {0xE3, 0x30, 0}, - {0xE4, 0x70, 0}, - {0xE5, 0, 0}, - {0xE6, 0, 0}, - {0xE7, 0x33, 0}, - {0xE8, 0xf, 1}, - {0xE9, 0xf, 1}, - {0xEA, 0, 0}, - {0xEB, 0x11, 0}, - {0xEE, 0, 0}, - {0xEF, 0x7e, 0}, - {0xF0, 0x3f, 0}, - {0xF1, 0x7f, 0}, - {0xF2, 0x78, 0}, - {0xF3, 0x58, 1}, - {0xF4, 0x88, 0}, - {0xF5, 0x8, 0}, - {0xF6, 0xf, 0}, - {0xF7, 0xbc, 0}, - {0xF8, 0x8, 0}, - {0xF9, 0x60, 0}, - {0xFA, 0x13, 1}, - {0xFB, 0x70, 0}, - {0xFC, 0, 0}, - {0xFD, 0, 0}, - {0xFE, 0, 0}, - {0xFF, 0x33, 0}, - {0x100, 0x13, 1}, - {0x101, 0xf, 1}, - {0x102, 0xee, 1}, - {0x105, 0x3c, 0}, - {0x106, 0x1, 1}, - {0x107, 0xa, 0}, - {0x108, 0x9d, 0}, - {0x109, 0xa, 0}, - {0x10A, 0, 0}, - {0x10B, 0x40, 0}, - {0x10C, 0x40, 0}, - {0x10D, 0x88, 0}, - {0x10E, 0x10, 0}, - {0x10F, 0xf0, 0}, - {0x110, 0x10, 0}, - {0x111, 0xf0, 0}, - {0x112, 0, 0}, - {0x113, 0, 0}, - {0x114, 0x10, 0}, - {0x115, 0x55, 0}, - {0x116, 0x3f, 1}, - {0x117, 0x36, 1}, - {0x118, 0, 0}, - {0x119, 0, 0}, - {0x11A, 0, 0}, - {0x11B, 0x87, 0}, - {0x11C, 0x11, 0}, - {0x11D, 0, 0}, - {0x11E, 0x33, 0}, - {0x11F, 0x88, 0}, - {0x120, 0, 0}, - {0x121, 0x87, 0}, - {0x122, 0x11, 0}, - {0x123, 0, 0}, - {0x124, 0x33, 0}, - {0x125, 0x88, 0}, - {0x126, 0x20, 1}, - {0x127, 0x3f, 0}, - {0x128, 0x44, 0}, - {0x129, 0x8c, 0}, - {0x12A, 0x6c, 0}, - {0x12B, 0x22, 0}, - {0x12C, 0xbe, 0}, - {0x12D, 0x55, 0}, - {0x12F, 0xc, 0}, - {0x130, 0xaa, 0}, - {0x131, 0x2, 0}, - {0x132, 0, 0}, - {0x133, 0x10, 0}, - {0x134, 0x1, 0}, - {0x135, 0, 0}, - {0x136, 0, 0}, - {0x137, 0x80, 0}, - {0x138, 0x60, 0}, - {0x139, 0x44, 0}, - {0x13A, 0x55, 0}, - {0x13B, 0x1, 0}, - {0x13C, 0x55, 0}, - {0x13D, 0x1, 0}, - {0x13E, 0x5, 0}, - {0x13F, 0x55, 0}, - {0x140, 0x55, 0}, - {0x146, 0, 0}, - {0x147, 0, 0}, - {0x148, 0, 0}, - {0x149, 0, 0}, - {0x14A, 0, 0}, - {0x14B, 0, 0}, - {0x14C, 0, 0}, - {0x14D, 0, 0}, - {0x14E, 0x1, 1}, - {0x14F, 0, 0}, - {0x150, 0, 0}, - {0x151, 0, 0}, - {0x154, 0xc, 0}, - {0x155, 0xc, 0}, - {0x156, 0xc, 0}, - {0x157, 0, 0}, - {0x158, 0x2b, 0}, - {0x159, 0x84, 0}, - {0x15A, 0x15, 0}, - {0x15B, 0xf, 0}, - {0x15C, 0, 0}, - {0x15D, 0, 0}, - {0x15E, 0, 1}, - {0x15F, 0, 1}, - {0x160, 0, 1}, - {0x161, 0, 1}, - {0x162, 0, 1}, - {0x163, 0, 1}, - {0x164, 0, 0}, - {0x165, 0, 0}, - {0x166, 0, 0}, - {0x167, 0, 0}, - {0x168, 0, 0}, - {0x169, 0, 0}, - {0x16A, 0, 1}, - {0x16B, 0, 1}, - {0x16C, 0, 1}, - {0x16D, 0, 0}, - {0x170, 0, 0}, - {0x171, 0x77, 0}, - {0x172, 0x77, 0}, - {0x173, 0x77, 0}, - {0x174, 0x77, 0}, - {0x175, 0, 0}, - {0x176, 0x3, 0}, - {0x177, 0x37, 0}, - {0x178, 0x3, 0}, - {0x179, 0, 0}, - {0x17A, 0x21, 0}, - {0x17B, 0x21, 0}, - {0x17C, 0, 0}, - {0x17D, 0xaa, 0}, - {0x17E, 0, 0}, - {0x17F, 0xaa, 0}, - {0x180, 0, 0}, - {0x190, 0, 0}, - {0x191, 0x77, 0}, - {0x192, 0x77, 0}, - {0x193, 0x77, 0}, - {0x194, 0x77, 0}, - {0x195, 0, 0}, - {0x196, 0x3, 0}, - {0x197, 0x37, 0}, - {0x198, 0x3, 0}, - {0x199, 0, 0}, - {0x19A, 0x21, 0}, - {0x19B, 0x21, 0}, - {0x19C, 0, 0}, - {0x19D, 0xaa, 0}, - {0x19E, 0, 0}, - {0x19F, 0xaa, 0}, - {0x1A0, 0, 0}, - {0x1A1, 0x2, 0}, - {0x1A2, 0xf, 0}, - {0x1A3, 0xf, 0}, - {0x1A4, 0, 1}, - {0x1A5, 0, 1}, - {0x1A6, 0, 1}, - {0x1A7, 0x2, 0}, - {0x1A8, 0xf, 0}, - {0x1A9, 0xf, 0}, - {0x1AA, 0, 1}, - {0x1AB, 0, 1}, - {0x1AC, 0, 1}, - {0x1AD, 0x84, 0}, - {0x1AE, 0x60, 0}, - {0x1AF, 0x47, 0}, - {0x1B0, 0x47, 0}, - {0x1B1, 0, 0}, - {0x1B2, 0, 0}, - {0x1B3, 0, 0}, - {0x1B4, 0, 0}, - {0x1B5, 0, 0}, - {0x1B6, 0, 0}, - {0x1B7, 0x5, 1}, - {0x1B8, 0, 0}, - {0x1B9, 0, 0}, - {0x1BA, 0, 0}, - {0x1BB, 0, 0}, - {0x1BC, 0, 0}, - {0x1BD, 0, 0}, - {0x1BE, 0, 0}, - {0x1BF, 0, 0}, - {0x1C0, 0, 0}, - {0x1C1, 0, 0}, - {0x1C2, 0xa0, 1}, - {0x1C3, 0, 0}, - {0x1C4, 0, 0}, - {0x1C5, 0, 0}, - {0x1C6, 0, 0}, - {0x1C7, 0, 0}, - {0x1C8, 0, 0}, - {0x1C9, 0, 0}, - {0x1CA, 0, 0}, - {0xFFFF, 0, 0} -}; - -static s16 nphy_def_lnagains[] = { -2, 10, 19, 25 }; - -static s32 nphy_lnagain_est0[] = { -315, 40370 }; -static s32 nphy_lnagain_est1[] = { -224, 23242 }; - -static const u16 tbl_iqcal_gainparams_nphy[2][NPHY_IQCAL_NUMGAINS][8] = { - { - {0x000, 0, 0, 2, 0x69, 0x69, 0x69, 0x69}, - {0x700, 7, 0, 0, 0x69, 0x69, 0x69, 0x69}, - {0x710, 7, 1, 0, 0x68, 0x68, 0x68, 0x68}, - {0x720, 7, 2, 0, 0x67, 0x67, 0x67, 0x67}, - {0x730, 7, 3, 0, 0x66, 0x66, 0x66, 0x66}, - {0x740, 7, 4, 0, 0x65, 0x65, 0x65, 0x65}, - {0x741, 7, 4, 1, 0x65, 0x65, 0x65, 0x65}, - {0x742, 7, 4, 2, 0x65, 0x65, 0x65, 0x65}, - {0x743, 7, 4, 3, 0x65, 0x65, 0x65, 0x65} - }, - { - {0x000, 7, 0, 0, 0x79, 0x79, 0x79, 0x79}, - {0x700, 7, 0, 0, 0x79, 0x79, 0x79, 0x79}, - {0x710, 7, 1, 0, 0x79, 0x79, 0x79, 0x79}, - {0x720, 7, 2, 0, 0x78, 0x78, 0x78, 0x78}, - {0x730, 7, 3, 0, 0x78, 0x78, 0x78, 0x78}, - {0x740, 7, 4, 0, 0x78, 0x78, 0x78, 0x78}, - {0x741, 7, 4, 1, 0x78, 0x78, 0x78, 0x78}, - {0x742, 7, 4, 2, 0x78, 0x78, 0x78, 0x78}, - {0x743, 7, 4, 3, 0x78, 0x78, 0x78, 0x78} - } -}; - -static const u32 nphy_tpc_txgain[] = { - 0x03cc2b44, 0x03cc2b42, 0x03cc2a44, 0x03cc2a42, - 0x03cc2944, 0x03c82b44, 0x03c82b42, 0x03c82a44, - 0x03c82a42, 0x03c82944, 0x03c82942, 0x03c82844, - 0x03c82842, 0x03c42b44, 0x03c42b42, 0x03c42a44, - 0x03c42a42, 0x03c42944, 0x03c42942, 0x03c42844, - 0x03c42842, 0x03c42744, 0x03c42742, 0x03c42644, - 0x03c42642, 0x03c42544, 0x03c42542, 0x03c42444, - 0x03c42442, 0x03c02b44, 0x03c02b42, 0x03c02a44, - 0x03c02a42, 0x03c02944, 0x03c02942, 0x03c02844, - 0x03c02842, 0x03c02744, 0x03c02742, 0x03b02b44, - 0x03b02b42, 0x03b02a44, 0x03b02a42, 0x03b02944, - 0x03b02942, 0x03b02844, 0x03b02842, 0x03b02744, - 0x03b02742, 0x03b02644, 0x03b02642, 0x03b02544, - 0x03b02542, 0x03a02b44, 0x03a02b42, 0x03a02a44, - 0x03a02a42, 0x03a02944, 0x03a02942, 0x03a02844, - 0x03a02842, 0x03a02744, 0x03a02742, 0x03902b44, - 0x03902b42, 0x03902a44, 0x03902a42, 0x03902944, - 0x03902942, 0x03902844, 0x03902842, 0x03902744, - 0x03902742, 0x03902644, 0x03902642, 0x03902544, - 0x03902542, 0x03802b44, 0x03802b42, 0x03802a44, - 0x03802a42, 0x03802944, 0x03802942, 0x03802844, - 0x03802842, 0x03802744, 0x03802742, 0x03802644, - 0x03802642, 0x03802544, 0x03802542, 0x03802444, - 0x03802442, 0x03802344, 0x03802342, 0x03802244, - 0x03802242, 0x03802144, 0x03802142, 0x03802044, - 0x03802042, 0x03801f44, 0x03801f42, 0x03801e44, - 0x03801e42, 0x03801d44, 0x03801d42, 0x03801c44, - 0x03801c42, 0x03801b44, 0x03801b42, 0x03801a44, - 0x03801a42, 0x03801944, 0x03801942, 0x03801844, - 0x03801842, 0x03801744, 0x03801742, 0x03801644, - 0x03801642, 0x03801544, 0x03801542, 0x03801444, - 0x03801442, 0x03801344, 0x03801342, 0x00002b00 -}; - -static const u16 nphy_tpc_loscale[] = { - 256, 256, 271, 271, 287, 256, 256, 271, - 271, 287, 287, 304, 304, 256, 256, 271, - 271, 287, 287, 304, 304, 322, 322, 341, - 341, 362, 362, 383, 383, 256, 256, 271, - 271, 287, 287, 304, 304, 322, 322, 256, - 256, 271, 271, 287, 287, 304, 304, 322, - 322, 341, 341, 362, 362, 256, 256, 271, - 271, 287, 287, 304, 304, 322, 322, 256, - 256, 271, 271, 287, 287, 304, 304, 322, - 322, 341, 341, 362, 362, 256, 256, 271, - 271, 287, 287, 304, 304, 322, 322, 341, - 341, 362, 362, 383, 383, 406, 406, 430, - 430, 455, 455, 482, 482, 511, 511, 541, - 541, 573, 573, 607, 607, 643, 643, 681, - 681, 722, 722, 764, 764, 810, 810, 858, - 858, 908, 908, 962, 962, 1019, 1019, 256 -}; - -static u32 nphy_tpc_txgain_ipa[] = { - 0x5ff7002d, 0x5ff7002b, 0x5ff7002a, 0x5ff70029, - 0x5ff70028, 0x5ff70027, 0x5ff70026, 0x5ff70025, - 0x5ef7002d, 0x5ef7002b, 0x5ef7002a, 0x5ef70029, - 0x5ef70028, 0x5ef70027, 0x5ef70026, 0x5ef70025, - 0x5df7002d, 0x5df7002b, 0x5df7002a, 0x5df70029, - 0x5df70028, 0x5df70027, 0x5df70026, 0x5df70025, - 0x5cf7002d, 0x5cf7002b, 0x5cf7002a, 0x5cf70029, - 0x5cf70028, 0x5cf70027, 0x5cf70026, 0x5cf70025, - 0x5bf7002d, 0x5bf7002b, 0x5bf7002a, 0x5bf70029, - 0x5bf70028, 0x5bf70027, 0x5bf70026, 0x5bf70025, - 0x5af7002d, 0x5af7002b, 0x5af7002a, 0x5af70029, - 0x5af70028, 0x5af70027, 0x5af70026, 0x5af70025, - 0x59f7002d, 0x59f7002b, 0x59f7002a, 0x59f70029, - 0x59f70028, 0x59f70027, 0x59f70026, 0x59f70025, - 0x58f7002d, 0x58f7002b, 0x58f7002a, 0x58f70029, - 0x58f70028, 0x58f70027, 0x58f70026, 0x58f70025, - 0x57f7002d, 0x57f7002b, 0x57f7002a, 0x57f70029, - 0x57f70028, 0x57f70027, 0x57f70026, 0x57f70025, - 0x56f7002d, 0x56f7002b, 0x56f7002a, 0x56f70029, - 0x56f70028, 0x56f70027, 0x56f70026, 0x56f70025, - 0x55f7002d, 0x55f7002b, 0x55f7002a, 0x55f70029, - 0x55f70028, 0x55f70027, 0x55f70026, 0x55f70025, - 0x54f7002d, 0x54f7002b, 0x54f7002a, 0x54f70029, - 0x54f70028, 0x54f70027, 0x54f70026, 0x54f70025, - 0x53f7002d, 0x53f7002b, 0x53f7002a, 0x53f70029, - 0x53f70028, 0x53f70027, 0x53f70026, 0x53f70025, - 0x52f7002d, 0x52f7002b, 0x52f7002a, 0x52f70029, - 0x52f70028, 0x52f70027, 0x52f70026, 0x52f70025, - 0x51f7002d, 0x51f7002b, 0x51f7002a, 0x51f70029, - 0x51f70028, 0x51f70027, 0x51f70026, 0x51f70025, - 0x50f7002d, 0x50f7002b, 0x50f7002a, 0x50f70029, - 0x50f70028, 0x50f70027, 0x50f70026, 0x50f70025 -}; - -static u32 nphy_tpc_txgain_ipa_rev5[] = { - 0x1ff7002d, 0x1ff7002b, 0x1ff7002a, 0x1ff70029, - 0x1ff70028, 0x1ff70027, 0x1ff70026, 0x1ff70025, - 0x1ef7002d, 0x1ef7002b, 0x1ef7002a, 0x1ef70029, - 0x1ef70028, 0x1ef70027, 0x1ef70026, 0x1ef70025, - 0x1df7002d, 0x1df7002b, 0x1df7002a, 0x1df70029, - 0x1df70028, 0x1df70027, 0x1df70026, 0x1df70025, - 0x1cf7002d, 0x1cf7002b, 0x1cf7002a, 0x1cf70029, - 0x1cf70028, 0x1cf70027, 0x1cf70026, 0x1cf70025, - 0x1bf7002d, 0x1bf7002b, 0x1bf7002a, 0x1bf70029, - 0x1bf70028, 0x1bf70027, 0x1bf70026, 0x1bf70025, - 0x1af7002d, 0x1af7002b, 0x1af7002a, 0x1af70029, - 0x1af70028, 0x1af70027, 0x1af70026, 0x1af70025, - 0x19f7002d, 0x19f7002b, 0x19f7002a, 0x19f70029, - 0x19f70028, 0x19f70027, 0x19f70026, 0x19f70025, - 0x18f7002d, 0x18f7002b, 0x18f7002a, 0x18f70029, - 0x18f70028, 0x18f70027, 0x18f70026, 0x18f70025, - 0x17f7002d, 0x17f7002b, 0x17f7002a, 0x17f70029, - 0x17f70028, 0x17f70027, 0x17f70026, 0x17f70025, - 0x16f7002d, 0x16f7002b, 0x16f7002a, 0x16f70029, - 0x16f70028, 0x16f70027, 0x16f70026, 0x16f70025, - 0x15f7002d, 0x15f7002b, 0x15f7002a, 0x15f70029, - 0x15f70028, 0x15f70027, 0x15f70026, 0x15f70025, - 0x14f7002d, 0x14f7002b, 0x14f7002a, 0x14f70029, - 0x14f70028, 0x14f70027, 0x14f70026, 0x14f70025, - 0x13f7002d, 0x13f7002b, 0x13f7002a, 0x13f70029, - 0x13f70028, 0x13f70027, 0x13f70026, 0x13f70025, - 0x12f7002d, 0x12f7002b, 0x12f7002a, 0x12f70029, - 0x12f70028, 0x12f70027, 0x12f70026, 0x12f70025, - 0x11f7002d, 0x11f7002b, 0x11f7002a, 0x11f70029, - 0x11f70028, 0x11f70027, 0x11f70026, 0x11f70025, - 0x10f7002d, 0x10f7002b, 0x10f7002a, 0x10f70029, - 0x10f70028, 0x10f70027, 0x10f70026, 0x10f70025 -}; - -static u32 nphy_tpc_txgain_ipa_rev6[] = { - 0x0ff7002d, 0x0ff7002b, 0x0ff7002a, 0x0ff70029, - 0x0ff70028, 0x0ff70027, 0x0ff70026, 0x0ff70025, - 0x0ef7002d, 0x0ef7002b, 0x0ef7002a, 0x0ef70029, - 0x0ef70028, 0x0ef70027, 0x0ef70026, 0x0ef70025, - 0x0df7002d, 0x0df7002b, 0x0df7002a, 0x0df70029, - 0x0df70028, 0x0df70027, 0x0df70026, 0x0df70025, - 0x0cf7002d, 0x0cf7002b, 0x0cf7002a, 0x0cf70029, - 0x0cf70028, 0x0cf70027, 0x0cf70026, 0x0cf70025, - 0x0bf7002d, 0x0bf7002b, 0x0bf7002a, 0x0bf70029, - 0x0bf70028, 0x0bf70027, 0x0bf70026, 0x0bf70025, - 0x0af7002d, 0x0af7002b, 0x0af7002a, 0x0af70029, - 0x0af70028, 0x0af70027, 0x0af70026, 0x0af70025, - 0x09f7002d, 0x09f7002b, 0x09f7002a, 0x09f70029, - 0x09f70028, 0x09f70027, 0x09f70026, 0x09f70025, - 0x08f7002d, 0x08f7002b, 0x08f7002a, 0x08f70029, - 0x08f70028, 0x08f70027, 0x08f70026, 0x08f70025, - 0x07f7002d, 0x07f7002b, 0x07f7002a, 0x07f70029, - 0x07f70028, 0x07f70027, 0x07f70026, 0x07f70025, - 0x06f7002d, 0x06f7002b, 0x06f7002a, 0x06f70029, - 0x06f70028, 0x06f70027, 0x06f70026, 0x06f70025, - 0x05f7002d, 0x05f7002b, 0x05f7002a, 0x05f70029, - 0x05f70028, 0x05f70027, 0x05f70026, 0x05f70025, - 0x04f7002d, 0x04f7002b, 0x04f7002a, 0x04f70029, - 0x04f70028, 0x04f70027, 0x04f70026, 0x04f70025, - 0x03f7002d, 0x03f7002b, 0x03f7002a, 0x03f70029, - 0x03f70028, 0x03f70027, 0x03f70026, 0x03f70025, - 0x02f7002d, 0x02f7002b, 0x02f7002a, 0x02f70029, - 0x02f70028, 0x02f70027, 0x02f70026, 0x02f70025, - 0x01f7002d, 0x01f7002b, 0x01f7002a, 0x01f70029, - 0x01f70028, 0x01f70027, 0x01f70026, 0x01f70025, - 0x00f7002d, 0x00f7002b, 0x00f7002a, 0x00f70029, - 0x00f70028, 0x00f70027, 0x00f70026, 0x00f70025 -}; - -static u32 nphy_tpc_txgain_ipa_2g_2057rev3[] = { - 0x70ff0040, 0x70f7003e, 0x70ef003b, 0x70e70039, - 0x70df0037, 0x70d70036, 0x70cf0033, 0x70c70032, - 0x70bf0031, 0x70b7002f, 0x70af002e, 0x70a7002d, - 0x709f002d, 0x7097002c, 0x708f002c, 0x7087002c, - 0x707f002b, 0x7077002c, 0x706f002c, 0x7067002d, - 0x705f002e, 0x705f002b, 0x705f0029, 0x7057002a, - 0x70570028, 0x704f002a, 0x7047002c, 0x7047002a, - 0x70470028, 0x70470026, 0x70470024, 0x70470022, - 0x7047001f, 0x70370027, 0x70370024, 0x70370022, - 0x70370020, 0x7037001f, 0x7037001d, 0x7037001b, - 0x7037001a, 0x70370018, 0x70370017, 0x7027001e, - 0x7027001d, 0x7027001a, 0x701f0024, 0x701f0022, - 0x701f0020, 0x701f001f, 0x701f001d, 0x701f001b, - 0x701f001a, 0x701f0018, 0x701f0017, 0x701f0015, - 0x701f0014, 0x701f0013, 0x701f0012, 0x701f0011, - 0x70170019, 0x70170018, 0x70170016, 0x70170015, - 0x70170014, 0x70170013, 0x70170012, 0x70170010, - 0x70170010, 0x7017000f, 0x700f001d, 0x700f001b, - 0x700f001a, 0x700f0018, 0x700f0017, 0x700f0015, - 0x700f0015, 0x700f0013, 0x700f0013, 0x700f0011, - 0x700f0010, 0x700f0010, 0x700f000f, 0x700f000e, - 0x700f000d, 0x700f000c, 0x700f000b, 0x700f000b, - 0x700f000b, 0x700f000a, 0x700f0009, 0x700f0009, - 0x700f0009, 0x700f0008, 0x700f0007, 0x700f0007, - 0x700f0006, 0x700f0006, 0x700f0006, 0x700f0006, - 0x700f0005, 0x700f0005, 0x700f0005, 0x700f0004, - 0x700f0004, 0x700f0004, 0x700f0004, 0x700f0004, - 0x700f0004, 0x700f0003, 0x700f0003, 0x700f0003, - 0x700f0003, 0x700f0002, 0x700f0002, 0x700f0002, - 0x700f0002, 0x700f0002, 0x700f0002, 0x700f0001, - 0x700f0001, 0x700f0001, 0x700f0001, 0x700f0001, - 0x700f0001, 0x700f0001, 0x700f0001, 0x700f0001 -}; - -static u32 nphy_tpc_txgain_ipa_2g_2057rev4n6[] = { - 0xf0ff0040, 0xf0f7003e, 0xf0ef003b, 0xf0e70039, - 0xf0df0037, 0xf0d70036, 0xf0cf0033, 0xf0c70032, - 0xf0bf0031, 0xf0b7002f, 0xf0af002e, 0xf0a7002d, - 0xf09f002d, 0xf097002c, 0xf08f002c, 0xf087002c, - 0xf07f002b, 0xf077002c, 0xf06f002c, 0xf067002d, - 0xf05f002e, 0xf05f002b, 0xf05f0029, 0xf057002a, - 0xf0570028, 0xf04f002a, 0xf047002c, 0xf047002a, - 0xf0470028, 0xf0470026, 0xf0470024, 0xf0470022, - 0xf047001f, 0xf0370027, 0xf0370024, 0xf0370022, - 0xf0370020, 0xf037001f, 0xf037001d, 0xf037001b, - 0xf037001a, 0xf0370018, 0xf0370017, 0xf027001e, - 0xf027001d, 0xf027001a, 0xf01f0024, 0xf01f0022, - 0xf01f0020, 0xf01f001f, 0xf01f001d, 0xf01f001b, - 0xf01f001a, 0xf01f0018, 0xf01f0017, 0xf01f0015, - 0xf01f0014, 0xf01f0013, 0xf01f0012, 0xf01f0011, - 0xf0170019, 0xf0170018, 0xf0170016, 0xf0170015, - 0xf0170014, 0xf0170013, 0xf0170012, 0xf0170010, - 0xf0170010, 0xf017000f, 0xf00f001d, 0xf00f001b, - 0xf00f001a, 0xf00f0018, 0xf00f0017, 0xf00f0015, - 0xf00f0015, 0xf00f0013, 0xf00f0013, 0xf00f0011, - 0xf00f0010, 0xf00f0010, 0xf00f000f, 0xf00f000e, - 0xf00f000d, 0xf00f000c, 0xf00f000b, 0xf00f000b, - 0xf00f000b, 0xf00f000a, 0xf00f0009, 0xf00f0009, - 0xf00f0009, 0xf00f0008, 0xf00f0007, 0xf00f0007, - 0xf00f0006, 0xf00f0006, 0xf00f0006, 0xf00f0006, - 0xf00f0005, 0xf00f0005, 0xf00f0005, 0xf00f0004, - 0xf00f0004, 0xf00f0004, 0xf00f0004, 0xf00f0004, - 0xf00f0004, 0xf00f0003, 0xf00f0003, 0xf00f0003, - 0xf00f0003, 0xf00f0002, 0xf00f0002, 0xf00f0002, - 0xf00f0002, 0xf00f0002, 0xf00f0002, 0xf00f0001, - 0xf00f0001, 0xf00f0001, 0xf00f0001, 0xf00f0001, - 0xf00f0001, 0xf00f0001, 0xf00f0001, 0xf00f0001 -}; - -static u32 nphy_tpc_txgain_ipa_2g_2057rev5[] = { - 0x30ff0031, 0x30e70031, 0x30e7002e, 0x30cf002e, - 0x30bf002e, 0x30af002e, 0x309f002f, 0x307f0033, - 0x307f0031, 0x307f002e, 0x3077002e, 0x306f002e, - 0x3067002e, 0x305f002f, 0x30570030, 0x3057002d, - 0x304f002e, 0x30470031, 0x3047002e, 0x3047002c, - 0x30470029, 0x303f002c, 0x303f0029, 0x3037002d, - 0x3037002a, 0x30370028, 0x302f002c, 0x302f002a, - 0x302f0028, 0x302f0026, 0x3027002c, 0x30270029, - 0x30270027, 0x30270025, 0x30270023, 0x301f002c, - 0x301f002a, 0x301f0028, 0x301f0025, 0x301f0024, - 0x301f0022, 0x301f001f, 0x3017002d, 0x3017002b, - 0x30170028, 0x30170026, 0x30170024, 0x30170022, - 0x30170020, 0x3017001e, 0x3017001d, 0x3017001b, - 0x3017001a, 0x30170018, 0x30170017, 0x30170015, - 0x300f002c, 0x300f0029, 0x300f0027, 0x300f0024, - 0x300f0022, 0x300f0021, 0x300f001f, 0x300f001d, - 0x300f001b, 0x300f001a, 0x300f0018, 0x300f0017, - 0x300f0016, 0x300f0015, 0x300f0115, 0x300f0215, - 0x300f0315, 0x300f0415, 0x300f0515, 0x300f0615, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715 -}; - -static u32 nphy_tpc_txgain_ipa_2g_2057rev7[] = { - 0x30ff0031, 0x30e70031, 0x30e7002e, 0x30cf002e, - 0x30bf002e, 0x30af002e, 0x309f002f, 0x307f0033, - 0x307f0031, 0x307f002e, 0x3077002e, 0x306f002e, - 0x3067002e, 0x305f002f, 0x30570030, 0x3057002d, - 0x304f002e, 0x30470031, 0x3047002e, 0x3047002c, - 0x30470029, 0x303f002c, 0x303f0029, 0x3037002d, - 0x3037002a, 0x30370028, 0x302f002c, 0x302f002a, - 0x302f0028, 0x302f0026, 0x3027002c, 0x30270029, - 0x30270027, 0x30270025, 0x30270023, 0x301f002c, - 0x301f002a, 0x301f0028, 0x301f0025, 0x301f0024, - 0x301f0022, 0x301f001f, 0x3017002d, 0x3017002b, - 0x30170028, 0x30170026, 0x30170024, 0x30170022, - 0x30170020, 0x3017001e, 0x3017001d, 0x3017001b, - 0x3017001a, 0x30170018, 0x30170017, 0x30170015, - 0x300f002c, 0x300f0029, 0x300f0027, 0x300f0024, - 0x300f0022, 0x300f0021, 0x300f001f, 0x300f001d, - 0x300f001b, 0x300f001a, 0x300f0018, 0x300f0017, - 0x300f0016, 0x300f0015, 0x300f0115, 0x300f0215, - 0x300f0315, 0x300f0415, 0x300f0515, 0x300f0615, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715, - 0x300f0715, 0x300f0715, 0x300f0715, 0x300f0715 -}; - -static u32 nphy_tpc_txgain_ipa_5g[] = { - 0x7ff70035, 0x7ff70033, 0x7ff70032, 0x7ff70031, - 0x7ff7002f, 0x7ff7002e, 0x7ff7002d, 0x7ff7002b, - 0x7ff7002a, 0x7ff70029, 0x7ff70028, 0x7ff70027, - 0x7ff70026, 0x7ff70024, 0x7ff70023, 0x7ff70022, - 0x7ef70028, 0x7ef70027, 0x7ef70026, 0x7ef70025, - 0x7ef70024, 0x7ef70023, 0x7df70028, 0x7df70027, - 0x7df70026, 0x7df70025, 0x7df70024, 0x7df70023, - 0x7df70022, 0x7cf70029, 0x7cf70028, 0x7cf70027, - 0x7cf70026, 0x7cf70025, 0x7cf70023, 0x7cf70022, - 0x7bf70029, 0x7bf70028, 0x7bf70026, 0x7bf70025, - 0x7bf70024, 0x7bf70023, 0x7bf70022, 0x7bf70021, - 0x7af70029, 0x7af70028, 0x7af70027, 0x7af70026, - 0x7af70025, 0x7af70024, 0x7af70023, 0x7af70022, - 0x79f70029, 0x79f70028, 0x79f70027, 0x79f70026, - 0x79f70025, 0x79f70024, 0x79f70023, 0x79f70022, - 0x78f70029, 0x78f70028, 0x78f70027, 0x78f70026, - 0x78f70025, 0x78f70024, 0x78f70023, 0x78f70022, - 0x77f70029, 0x77f70028, 0x77f70027, 0x77f70026, - 0x77f70025, 0x77f70024, 0x77f70023, 0x77f70022, - 0x76f70029, 0x76f70028, 0x76f70027, 0x76f70026, - 0x76f70024, 0x76f70023, 0x76f70022, 0x76f70021, - 0x75f70029, 0x75f70028, 0x75f70027, 0x75f70026, - 0x75f70025, 0x75f70024, 0x75f70023, 0x74f70029, - 0x74f70028, 0x74f70026, 0x74f70025, 0x74f70024, - 0x74f70023, 0x74f70022, 0x73f70029, 0x73f70027, - 0x73f70026, 0x73f70025, 0x73f70024, 0x73f70023, - 0x73f70022, 0x72f70028, 0x72f70027, 0x72f70026, - 0x72f70025, 0x72f70024, 0x72f70023, 0x72f70022, - 0x71f70028, 0x71f70027, 0x71f70026, 0x71f70025, - 0x71f70024, 0x71f70023, 0x70f70028, 0x70f70027, - 0x70f70026, 0x70f70024, 0x70f70023, 0x70f70022, - 0x70f70021, 0x70f70020, 0x70f70020, 0x70f7001f -}; - -static u32 nphy_tpc_txgain_ipa_5g_2057[] = { - 0x7f7f0044, 0x7f7f0040, 0x7f7f003c, 0x7f7f0039, - 0x7f7f0036, 0x7e7f003c, 0x7e7f0038, 0x7e7f0035, - 0x7d7f003c, 0x7d7f0039, 0x7d7f0036, 0x7d7f0033, - 0x7c7f003b, 0x7c7f0037, 0x7c7f0034, 0x7b7f003a, - 0x7b7f0036, 0x7b7f0033, 0x7a7f003c, 0x7a7f0039, - 0x7a7f0036, 0x7a7f0033, 0x797f003b, 0x797f0038, - 0x797f0035, 0x797f0032, 0x787f003b, 0x787f0038, - 0x787f0035, 0x787f0032, 0x777f003a, 0x777f0037, - 0x777f0034, 0x777f0031, 0x767f003a, 0x767f0036, - 0x767f0033, 0x767f0031, 0x757f003a, 0x757f0037, - 0x757f0034, 0x747f003c, 0x747f0039, 0x747f0036, - 0x747f0033, 0x737f003b, 0x737f0038, 0x737f0035, - 0x737f0032, 0x727f0039, 0x727f0036, 0x727f0033, - 0x727f0030, 0x717f003a, 0x717f0037, 0x717f0034, - 0x707f003b, 0x707f0038, 0x707f0035, 0x707f0032, - 0x707f002f, 0x707f002d, 0x707f002a, 0x707f0028, - 0x707f0025, 0x707f0023, 0x707f0021, 0x707f0020, - 0x707f001e, 0x707f001c, 0x707f001b, 0x707f0019, - 0x707f0018, 0x707f0016, 0x707f0015, 0x707f0014, - 0x707f0013, 0x707f0012, 0x707f0011, 0x707f0010, - 0x707f000f, 0x707f000e, 0x707f000d, 0x707f000d, - 0x707f000c, 0x707f000b, 0x707f000b, 0x707f000a, - 0x707f0009, 0x707f0009, 0x707f0008, 0x707f0008, - 0x707f0007, 0x707f0007, 0x707f0007, 0x707f0006, - 0x707f0006, 0x707f0006, 0x707f0005, 0x707f0005, - 0x707f0005, 0x707f0004, 0x707f0004, 0x707f0004, - 0x707f0004, 0x707f0004, 0x707f0003, 0x707f0003, - 0x707f0003, 0x707f0003, 0x707f0003, 0x707f0003, - 0x707f0002, 0x707f0002, 0x707f0002, 0x707f0002, - 0x707f0002, 0x707f0002, 0x707f0002, 0x707f0002, - 0x707f0001, 0x707f0001, 0x707f0001, 0x707f0001, - 0x707f0001, 0x707f0001, 0x707f0001, 0x707f0001 -}; - -static u32 nphy_tpc_txgain_ipa_5g_2057rev7[] = { - 0x6f7f0031, 0x6f7f002e, 0x6f7f002c, 0x6f7f002a, - 0x6f7f0027, 0x6e7f002e, 0x6e7f002c, 0x6e7f002a, - 0x6d7f0030, 0x6d7f002d, 0x6d7f002a, 0x6d7f0028, - 0x6c7f0030, 0x6c7f002d, 0x6c7f002b, 0x6b7f002e, - 0x6b7f002c, 0x6b7f002a, 0x6b7f0027, 0x6a7f002e, - 0x6a7f002c, 0x6a7f002a, 0x697f0030, 0x697f002e, - 0x697f002b, 0x697f0029, 0x687f002f, 0x687f002d, - 0x687f002a, 0x687f0027, 0x677f002f, 0x677f002d, - 0x677f002a, 0x667f0031, 0x667f002e, 0x667f002c, - 0x667f002a, 0x657f0030, 0x657f002e, 0x657f002b, - 0x657f0029, 0x647f0030, 0x647f002d, 0x647f002b, - 0x647f0029, 0x637f002f, 0x637f002d, 0x637f002a, - 0x627f0030, 0x627f002d, 0x627f002b, 0x627f0029, - 0x617f0030, 0x617f002e, 0x617f002b, 0x617f0029, - 0x607f002f, 0x607f002d, 0x607f002a, 0x607f0027, - 0x607f0026, 0x607f0023, 0x607f0021, 0x607f0020, - 0x607f001e, 0x607f001c, 0x607f001a, 0x607f0019, - 0x607f0018, 0x607f0016, 0x607f0015, 0x607f0014, - 0x607f0012, 0x607f0012, 0x607f0011, 0x607f000f, - 0x607f000f, 0x607f000e, 0x607f000d, 0x607f000c, - 0x607f000c, 0x607f000b, 0x607f000b, 0x607f000a, - 0x607f0009, 0x607f0009, 0x607f0008, 0x607f0008, - 0x607f0008, 0x607f0007, 0x607f0007, 0x607f0006, - 0x607f0006, 0x607f0005, 0x607f0005, 0x607f0005, - 0x607f0005, 0x607f0005, 0x607f0004, 0x607f0004, - 0x607f0004, 0x607f0004, 0x607f0003, 0x607f0003, - 0x607f0003, 0x607f0003, 0x607f0002, 0x607f0002, - 0x607f0002, 0x607f0002, 0x607f0002, 0x607f0002, - 0x607f0002, 0x607f0002, 0x607f0002, 0x607f0002, - 0x607f0002, 0x607f0002, 0x607f0002, 0x607f0002, - 0x607f0002, 0x607f0001, 0x607f0001, 0x607f0001, - 0x607f0001, 0x607f0001, 0x607f0001, 0x607f0001 -}; - -static s8 nphy_papd_pga_gain_delta_ipa_2g[] = { - -114, -108, -98, -91, -84, -78, -70, -62, - -54, -46, -39, -31, -23, -15, -8, 0 -}; - -static s8 nphy_papd_pga_gain_delta_ipa_5g[] = { - -100, -95, -89, -83, -77, -70, -63, -56, - -48, -41, -33, -25, -19, -12, -6, 0 -}; - -static s16 nphy_papd_padgain_dlt_2g_2057rev3n4[] = { - -159, -113, -86, -72, -62, -54, -48, -43, - -39, -35, -31, -28, -25, -23, -20, -18, - -17, -15, -13, -11, -10, -8, -7, -6, - -5, -4, -3, -3, -2, -1, -1, 0 -}; - -static s16 nphy_papd_padgain_dlt_2g_2057rev5[] = { - -109, -109, -82, -68, -58, -50, -44, -39, - -35, -31, -28, -26, -23, -21, -19, -17, - -16, -14, -13, -11, -10, -9, -8, -7, - -5, -5, -4, -3, -2, -1, -1, 0 -}; - -static s16 nphy_papd_padgain_dlt_2g_2057rev7[] = { - -122, -122, -95, -80, -69, -61, -54, -49, - -43, -39, -35, -32, -28, -26, -23, -21, - -18, -16, -15, -13, -11, -10, -8, -7, - -6, -5, -4, -3, -2, -1, -1, 0 -}; - -static s8 nphy_papd_pgagain_dlt_5g_2057[] = { - -107, -101, -92, -85, -78, -71, -62, -55, - -47, -39, -32, -24, -19, -12, -6, 0 -}; - -static s8 nphy_papd_pgagain_dlt_5g_2057rev7[] = { - -110, -104, -95, -88, -81, -74, -66, -58, - -50, -44, -36, -28, -23, -15, -8, 0 -}; - -static u8 pad_gain_codes_used_2057rev5[] = { - 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, - 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 -}; - -static u8 pad_gain_codes_used_2057rev7[] = { - 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, - 5, 4, 3, 2, 1 -}; - -static u8 pad_all_gain_codes_2057[] = { - 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, - 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, - 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, - 1, 0 -}; - -static u8 pga_all_gain_codes_2057[] = { - 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 -}; - -static u32 nphy_papd_scaltbl[] = { - 0x0ae2002f, 0x0a3b0032, 0x09a70035, 0x09220038, - 0x0887003c, 0x081f003f, 0x07a20043, 0x07340047, - 0x06d2004b, 0x067a004f, 0x06170054, 0x05bf0059, - 0x0571005e, 0x051e0064, 0x04d3006a, 0x04910070, - 0x044c0077, 0x040f007e, 0x03d90085, 0x03a1008d, - 0x036f0095, 0x033d009e, 0x030b00a8, 0x02e000b2, - 0x02b900bc, 0x029200c7, 0x026d00d3, 0x024900e0, - 0x022900ed, 0x020a00fb, 0x01ec010a, 0x01d0011a, - 0x01b7012a, 0x019e013c, 0x0187014f, 0x01720162, - 0x015d0177, 0x0149018e, 0x013701a5, 0x012601be, - 0x011501d9, 0x010501f5, 0x00f70212, 0x00e90232, - 0x00dc0253, 0x00d00276, 0x00c4029c, 0x00b902c3, - 0x00af02ed, 0x00a5031a, 0x009c0349, 0x0093037a, - 0x008b03af, 0x008303e7, 0x007c0422, 0x00750461, - 0x006e04a3, 0x006804ea, 0x00620534, 0x005d0583, - 0x005805d7, 0x0053062f, 0x004e068d, 0x004a06f1 -}; - -static u32 nphy_tpc_txgain_rev3[] = { - 0x1f410044, 0x1f410042, 0x1f410040, 0x1f41003e, - 0x1f41003c, 0x1f41003b, 0x1f410039, 0x1f410037, - 0x1e410044, 0x1e410042, 0x1e410040, 0x1e41003e, - 0x1e41003c, 0x1e41003b, 0x1e410039, 0x1e410037, - 0x1d410044, 0x1d410042, 0x1d410040, 0x1d41003e, - 0x1d41003c, 0x1d41003b, 0x1d410039, 0x1d410037, - 0x1c410044, 0x1c410042, 0x1c410040, 0x1c41003e, - 0x1c41003c, 0x1c41003b, 0x1c410039, 0x1c410037, - 0x1b410044, 0x1b410042, 0x1b410040, 0x1b41003e, - 0x1b41003c, 0x1b41003b, 0x1b410039, 0x1b410037, - 0x1a410044, 0x1a410042, 0x1a410040, 0x1a41003e, - 0x1a41003c, 0x1a41003b, 0x1a410039, 0x1a410037, - 0x19410044, 0x19410042, 0x19410040, 0x1941003e, - 0x1941003c, 0x1941003b, 0x19410039, 0x19410037, - 0x18410044, 0x18410042, 0x18410040, 0x1841003e, - 0x1841003c, 0x1841003b, 0x18410039, 0x18410037, - 0x17410044, 0x17410042, 0x17410040, 0x1741003e, - 0x1741003c, 0x1741003b, 0x17410039, 0x17410037, - 0x16410044, 0x16410042, 0x16410040, 0x1641003e, - 0x1641003c, 0x1641003b, 0x16410039, 0x16410037, - 0x15410044, 0x15410042, 0x15410040, 0x1541003e, - 0x1541003c, 0x1541003b, 0x15410039, 0x15410037, - 0x14410044, 0x14410042, 0x14410040, 0x1441003e, - 0x1441003c, 0x1441003b, 0x14410039, 0x14410037, - 0x13410044, 0x13410042, 0x13410040, 0x1341003e, - 0x1341003c, 0x1341003b, 0x13410039, 0x13410037, - 0x12410044, 0x12410042, 0x12410040, 0x1241003e, - 0x1241003c, 0x1241003b, 0x12410039, 0x12410037, - 0x11410044, 0x11410042, 0x11410040, 0x1141003e, - 0x1141003c, 0x1141003b, 0x11410039, 0x11410037, - 0x10410044, 0x10410042, 0x10410040, 0x1041003e, - 0x1041003c, 0x1041003b, 0x10410039, 0x10410037 -}; - -static u32 nphy_tpc_txgain_HiPwrEPA[] = { - 0x0f410044, 0x0f410042, 0x0f410040, 0x0f41003e, - 0x0f41003c, 0x0f41003b, 0x0f410039, 0x0f410037, - 0x0e410044, 0x0e410042, 0x0e410040, 0x0e41003e, - 0x0e41003c, 0x0e41003b, 0x0e410039, 0x0e410037, - 0x0d410044, 0x0d410042, 0x0d410040, 0x0d41003e, - 0x0d41003c, 0x0d41003b, 0x0d410039, 0x0d410037, - 0x0c410044, 0x0c410042, 0x0c410040, 0x0c41003e, - 0x0c41003c, 0x0c41003b, 0x0c410039, 0x0c410037, - 0x0b410044, 0x0b410042, 0x0b410040, 0x0b41003e, - 0x0b41003c, 0x0b41003b, 0x0b410039, 0x0b410037, - 0x0a410044, 0x0a410042, 0x0a410040, 0x0a41003e, - 0x0a41003c, 0x0a41003b, 0x0a410039, 0x0a410037, - 0x09410044, 0x09410042, 0x09410040, 0x0941003e, - 0x0941003c, 0x0941003b, 0x09410039, 0x09410037, - 0x08410044, 0x08410042, 0x08410040, 0x0841003e, - 0x0841003c, 0x0841003b, 0x08410039, 0x08410037, - 0x07410044, 0x07410042, 0x07410040, 0x0741003e, - 0x0741003c, 0x0741003b, 0x07410039, 0x07410037, - 0x06410044, 0x06410042, 0x06410040, 0x0641003e, - 0x0641003c, 0x0641003b, 0x06410039, 0x06410037, - 0x05410044, 0x05410042, 0x05410040, 0x0541003e, - 0x0541003c, 0x0541003b, 0x05410039, 0x05410037, - 0x04410044, 0x04410042, 0x04410040, 0x0441003e, - 0x0441003c, 0x0441003b, 0x04410039, 0x04410037, - 0x03410044, 0x03410042, 0x03410040, 0x0341003e, - 0x0341003c, 0x0341003b, 0x03410039, 0x03410037, - 0x02410044, 0x02410042, 0x02410040, 0x0241003e, - 0x0241003c, 0x0241003b, 0x02410039, 0x02410037, - 0x01410044, 0x01410042, 0x01410040, 0x0141003e, - 0x0141003c, 0x0141003b, 0x01410039, 0x01410037, - 0x00410044, 0x00410042, 0x00410040, 0x0041003e, - 0x0041003c, 0x0041003b, 0x00410039, 0x00410037 -}; - -static u32 nphy_tpc_txgain_epa_2057rev3[] = { - 0x80f90040, 0x80e10040, 0x80e1003c, 0x80c9003d, - 0x80b9003c, 0x80a9003d, 0x80a1003c, 0x8099003b, - 0x8091003b, 0x8089003a, 0x8081003a, 0x80790039, - 0x80710039, 0x8069003a, 0x8061003b, 0x8059003d, - 0x8051003f, 0x80490042, 0x8049003e, 0x8049003b, - 0x8041003e, 0x8041003b, 0x8039003e, 0x8039003b, - 0x80390038, 0x80390035, 0x8031003a, 0x80310036, - 0x80310033, 0x8029003a, 0x80290037, 0x80290034, - 0x80290031, 0x80210039, 0x80210036, 0x80210033, - 0x80210030, 0x8019003c, 0x80190039, 0x80190036, - 0x80190033, 0x80190030, 0x8019002d, 0x8019002b, - 0x80190028, 0x8011003a, 0x80110036, 0x80110033, - 0x80110030, 0x8011002e, 0x8011002b, 0x80110029, - 0x80110027, 0x80110024, 0x80110022, 0x80110020, - 0x8011001f, 0x8011001d, 0x8009003a, 0x80090037, - 0x80090034, 0x80090031, 0x8009002e, 0x8009002c, - 0x80090029, 0x80090027, 0x80090025, 0x80090023, - 0x80090021, 0x8009001f, 0x8009001d, 0x8009011d, - 0x8009021d, 0x8009031d, 0x8009041d, 0x8009051d, - 0x8009061d, 0x8009071d, 0x8009071d, 0x8009071d, - 0x8009071d, 0x8009071d, 0x8009071d, 0x8009071d, - 0x8009071d, 0x8009071d, 0x8009071d, 0x8009071d, - 0x8009071d, 0x8009071d, 0x8009071d, 0x8009071d, - 0x8009071d, 0x8009071d, 0x8009071d, 0x8009071d, - 0x8009071d, 0x8009071d, 0x8009071d, 0x8009071d, - 0x8009071d, 0x8009071d, 0x8009071d, 0x8009071d, - 0x8009071d, 0x8009071d, 0x8009071d, 0x8009071d, - 0x8009071d, 0x8009071d, 0x8009071d, 0x8009071d, - 0x8009071d, 0x8009071d, 0x8009071d, 0x8009071d, - 0x8009071d, 0x8009071d, 0x8009071d, 0x8009071d, - 0x8009071d, 0x8009071d, 0x8009071d, 0x8009071d, - 0x8009071d, 0x8009071d, 0x8009071d, 0x8009071d -}; - -static u32 nphy_tpc_txgain_epa_2057rev5[] = { - 0x10f90040, 0x10e10040, 0x10e1003c, 0x10c9003d, - 0x10b9003c, 0x10a9003d, 0x10a1003c, 0x1099003b, - 0x1091003b, 0x1089003a, 0x1081003a, 0x10790039, - 0x10710039, 0x1069003a, 0x1061003b, 0x1059003d, - 0x1051003f, 0x10490042, 0x1049003e, 0x1049003b, - 0x1041003e, 0x1041003b, 0x1039003e, 0x1039003b, - 0x10390038, 0x10390035, 0x1031003a, 0x10310036, - 0x10310033, 0x1029003a, 0x10290037, 0x10290034, - 0x10290031, 0x10210039, 0x10210036, 0x10210033, - 0x10210030, 0x1019003c, 0x10190039, 0x10190036, - 0x10190033, 0x10190030, 0x1019002d, 0x1019002b, - 0x10190028, 0x1011003a, 0x10110036, 0x10110033, - 0x10110030, 0x1011002e, 0x1011002b, 0x10110029, - 0x10110027, 0x10110024, 0x10110022, 0x10110020, - 0x1011001f, 0x1011001d, 0x1009003a, 0x10090037, - 0x10090034, 0x10090031, 0x1009002e, 0x1009002c, - 0x10090029, 0x10090027, 0x10090025, 0x10090023, - 0x10090021, 0x1009001f, 0x1009001d, 0x1009001b, - 0x1009001a, 0x10090018, 0x10090017, 0x10090016, - 0x10090015, 0x10090013, 0x10090012, 0x10090011, - 0x10090010, 0x1009000f, 0x1009000f, 0x1009000e, - 0x1009000d, 0x1009000c, 0x1009000c, 0x1009000b, - 0x1009000a, 0x1009000a, 0x10090009, 0x10090009, - 0x10090008, 0x10090008, 0x10090007, 0x10090007, - 0x10090007, 0x10090006, 0x10090006, 0x10090005, - 0x10090005, 0x10090005, 0x10090005, 0x10090004, - 0x10090004, 0x10090004, 0x10090004, 0x10090003, - 0x10090003, 0x10090003, 0x10090003, 0x10090003, - 0x10090003, 0x10090002, 0x10090002, 0x10090002, - 0x10090002, 0x10090002, 0x10090002, 0x10090002, - 0x10090002, 0x10090002, 0x10090001, 0x10090001, - 0x10090001, 0x10090001, 0x10090001, 0x10090001 -}; - -static u32 nphy_tpc_5GHz_txgain_rev3[] = { - 0xcff70044, 0xcff70042, 0xcff70040, 0xcff7003e, - 0xcff7003c, 0xcff7003b, 0xcff70039, 0xcff70037, - 0xcef70044, 0xcef70042, 0xcef70040, 0xcef7003e, - 0xcef7003c, 0xcef7003b, 0xcef70039, 0xcef70037, - 0xcdf70044, 0xcdf70042, 0xcdf70040, 0xcdf7003e, - 0xcdf7003c, 0xcdf7003b, 0xcdf70039, 0xcdf70037, - 0xccf70044, 0xccf70042, 0xccf70040, 0xccf7003e, - 0xccf7003c, 0xccf7003b, 0xccf70039, 0xccf70037, - 0xcbf70044, 0xcbf70042, 0xcbf70040, 0xcbf7003e, - 0xcbf7003c, 0xcbf7003b, 0xcbf70039, 0xcbf70037, - 0xcaf70044, 0xcaf70042, 0xcaf70040, 0xcaf7003e, - 0xcaf7003c, 0xcaf7003b, 0xcaf70039, 0xcaf70037, - 0xc9f70044, 0xc9f70042, 0xc9f70040, 0xc9f7003e, - 0xc9f7003c, 0xc9f7003b, 0xc9f70039, 0xc9f70037, - 0xc8f70044, 0xc8f70042, 0xc8f70040, 0xc8f7003e, - 0xc8f7003c, 0xc8f7003b, 0xc8f70039, 0xc8f70037, - 0xc7f70044, 0xc7f70042, 0xc7f70040, 0xc7f7003e, - 0xc7f7003c, 0xc7f7003b, 0xc7f70039, 0xc7f70037, - 0xc6f70044, 0xc6f70042, 0xc6f70040, 0xc6f7003e, - 0xc6f7003c, 0xc6f7003b, 0xc6f70039, 0xc6f70037, - 0xc5f70044, 0xc5f70042, 0xc5f70040, 0xc5f7003e, - 0xc5f7003c, 0xc5f7003b, 0xc5f70039, 0xc5f70037, - 0xc4f70044, 0xc4f70042, 0xc4f70040, 0xc4f7003e, - 0xc4f7003c, 0xc4f7003b, 0xc4f70039, 0xc4f70037, - 0xc3f70044, 0xc3f70042, 0xc3f70040, 0xc3f7003e, - 0xc3f7003c, 0xc3f7003b, 0xc3f70039, 0xc3f70037, - 0xc2f70044, 0xc2f70042, 0xc2f70040, 0xc2f7003e, - 0xc2f7003c, 0xc2f7003b, 0xc2f70039, 0xc2f70037, - 0xc1f70044, 0xc1f70042, 0xc1f70040, 0xc1f7003e, - 0xc1f7003c, 0xc1f7003b, 0xc1f70039, 0xc1f70037, - 0xc0f70044, 0xc0f70042, 0xc0f70040, 0xc0f7003e, - 0xc0f7003c, 0xc0f7003b, 0xc0f70039, 0xc0f70037 -}; - -static u32 nphy_tpc_5GHz_txgain_rev4[] = { - 0x2ff20044, 0x2ff20042, 0x2ff20040, 0x2ff2003e, - 0x2ff2003c, 0x2ff2003b, 0x2ff20039, 0x2ff20037, - 0x2ef20044, 0x2ef20042, 0x2ef20040, 0x2ef2003e, - 0x2ef2003c, 0x2ef2003b, 0x2ef20039, 0x2ef20037, - 0x2df20044, 0x2df20042, 0x2df20040, 0x2df2003e, - 0x2df2003c, 0x2df2003b, 0x2df20039, 0x2df20037, - 0x2cf20044, 0x2cf20042, 0x2cf20040, 0x2cf2003e, - 0x2cf2003c, 0x2cf2003b, 0x2cf20039, 0x2cf20037, - 0x2bf20044, 0x2bf20042, 0x2bf20040, 0x2bf2003e, - 0x2bf2003c, 0x2bf2003b, 0x2bf20039, 0x2bf20037, - 0x2af20044, 0x2af20042, 0x2af20040, 0x2af2003e, - 0x2af2003c, 0x2af2003b, 0x2af20039, 0x2af20037, - 0x29f20044, 0x29f20042, 0x29f20040, 0x29f2003e, - 0x29f2003c, 0x29f2003b, 0x29f20039, 0x29f20037, - 0x28f20044, 0x28f20042, 0x28f20040, 0x28f2003e, - 0x28f2003c, 0x28f2003b, 0x28f20039, 0x28f20037, - 0x27f20044, 0x27f20042, 0x27f20040, 0x27f2003e, - 0x27f2003c, 0x27f2003b, 0x27f20039, 0x27f20037, - 0x26f20044, 0x26f20042, 0x26f20040, 0x26f2003e, - 0x26f2003c, 0x26f2003b, 0x26f20039, 0x26f20037, - 0x25f20044, 0x25f20042, 0x25f20040, 0x25f2003e, - 0x25f2003c, 0x25f2003b, 0x25f20039, 0x25f20037, - 0x24f20044, 0x24f20042, 0x24f20040, 0x24f2003e, - 0x24f2003c, 0x24f2003b, 0x24f20039, 0x24f20038, - 0x23f20041, 0x23f20040, 0x23f2003f, 0x23f2003e, - 0x23f2003c, 0x23f2003b, 0x23f20039, 0x23f20037, - 0x22f20044, 0x22f20042, 0x22f20040, 0x22f2003e, - 0x22f2003c, 0x22f2003b, 0x22f20039, 0x22f20037, - 0x21f20044, 0x21f20042, 0x21f20040, 0x21f2003e, - 0x21f2003c, 0x21f2003b, 0x21f20039, 0x21f20037, - 0x20d20043, 0x20d20041, 0x20d2003e, 0x20d2003c, - 0x20d2003a, 0x20d20038, 0x20d20036, 0x20d20034 -}; - -static u32 nphy_tpc_5GHz_txgain_rev5[] = { - 0x0f62004a, 0x0f620048, 0x0f620046, 0x0f620044, - 0x0f620042, 0x0f620040, 0x0f62003e, 0x0f62003c, - 0x0e620044, 0x0e620042, 0x0e620040, 0x0e62003e, - 0x0e62003c, 0x0e62003d, 0x0e62003b, 0x0e62003a, - 0x0d620043, 0x0d620041, 0x0d620040, 0x0d62003e, - 0x0d62003d, 0x0d62003c, 0x0d62003b, 0x0d62003a, - 0x0c620041, 0x0c620040, 0x0c62003f, 0x0c62003e, - 0x0c62003c, 0x0c62003b, 0x0c620039, 0x0c620037, - 0x0b620046, 0x0b620044, 0x0b620042, 0x0b620040, - 0x0b62003e, 0x0b62003c, 0x0b62003b, 0x0b62003a, - 0x0a620041, 0x0a620040, 0x0a62003e, 0x0a62003c, - 0x0a62003b, 0x0a62003a, 0x0a620039, 0x0a620038, - 0x0962003e, 0x0962003d, 0x0962003c, 0x0962003b, - 0x09620039, 0x09620037, 0x09620035, 0x09620033, - 0x08620044, 0x08620042, 0x08620040, 0x0862003e, - 0x0862003c, 0x0862003b, 0x0862003a, 0x08620039, - 0x07620043, 0x07620042, 0x07620040, 0x0762003f, - 0x0762003d, 0x0762003b, 0x0762003a, 0x07620039, - 0x0662003e, 0x0662003d, 0x0662003c, 0x0662003b, - 0x06620039, 0x06620037, 0x06620035, 0x06620033, - 0x05620046, 0x05620044, 0x05620042, 0x05620040, - 0x0562003e, 0x0562003c, 0x0562003b, 0x05620039, - 0x04620044, 0x04620042, 0x04620040, 0x0462003e, - 0x0462003c, 0x0462003b, 0x04620039, 0x04620038, - 0x0362003c, 0x0362003b, 0x0362003a, 0x03620039, - 0x03620038, 0x03620037, 0x03620035, 0x03620033, - 0x0262004c, 0x0262004a, 0x02620048, 0x02620047, - 0x02620046, 0x02620044, 0x02620043, 0x02620042, - 0x0162004a, 0x01620048, 0x01620046, 0x01620044, - 0x01620043, 0x01620042, 0x01620041, 0x01620040, - 0x00620042, 0x00620040, 0x0062003e, 0x0062003c, - 0x0062003b, 0x00620039, 0x00620037, 0x00620035 -}; - -static u32 nphy_tpc_5GHz_txgain_HiPwrEPA[] = { - 0x2ff10044, 0x2ff10042, 0x2ff10040, 0x2ff1003e, - 0x2ff1003c, 0x2ff1003b, 0x2ff10039, 0x2ff10037, - 0x2ef10044, 0x2ef10042, 0x2ef10040, 0x2ef1003e, - 0x2ef1003c, 0x2ef1003b, 0x2ef10039, 0x2ef10037, - 0x2df10044, 0x2df10042, 0x2df10040, 0x2df1003e, - 0x2df1003c, 0x2df1003b, 0x2df10039, 0x2df10037, - 0x2cf10044, 0x2cf10042, 0x2cf10040, 0x2cf1003e, - 0x2cf1003c, 0x2cf1003b, 0x2cf10039, 0x2cf10037, - 0x2bf10044, 0x2bf10042, 0x2bf10040, 0x2bf1003e, - 0x2bf1003c, 0x2bf1003b, 0x2bf10039, 0x2bf10037, - 0x2af10044, 0x2af10042, 0x2af10040, 0x2af1003e, - 0x2af1003c, 0x2af1003b, 0x2af10039, 0x2af10037, - 0x29f10044, 0x29f10042, 0x29f10040, 0x29f1003e, - 0x29f1003c, 0x29f1003b, 0x29f10039, 0x29f10037, - 0x28f10044, 0x28f10042, 0x28f10040, 0x28f1003e, - 0x28f1003c, 0x28f1003b, 0x28f10039, 0x28f10037, - 0x27f10044, 0x27f10042, 0x27f10040, 0x27f1003e, - 0x27f1003c, 0x27f1003b, 0x27f10039, 0x27f10037, - 0x26f10044, 0x26f10042, 0x26f10040, 0x26f1003e, - 0x26f1003c, 0x26f1003b, 0x26f10039, 0x26f10037, - 0x25f10044, 0x25f10042, 0x25f10040, 0x25f1003e, - 0x25f1003c, 0x25f1003b, 0x25f10039, 0x25f10037, - 0x24f10044, 0x24f10042, 0x24f10040, 0x24f1003e, - 0x24f1003c, 0x24f1003b, 0x24f10039, 0x24f10038, - 0x23f10041, 0x23f10040, 0x23f1003f, 0x23f1003e, - 0x23f1003c, 0x23f1003b, 0x23f10039, 0x23f10037, - 0x22f10044, 0x22f10042, 0x22f10040, 0x22f1003e, - 0x22f1003c, 0x22f1003b, 0x22f10039, 0x22f10037, - 0x21f10044, 0x21f10042, 0x21f10040, 0x21f1003e, - 0x21f1003c, 0x21f1003b, 0x21f10039, 0x21f10037, - 0x20d10043, 0x20d10041, 0x20d1003e, 0x20d1003c, - 0x20d1003a, 0x20d10038, 0x20d10036, 0x20d10034 -}; - -static u8 ant_sw_ctrl_tbl_rev8_2o3[] = { 0x14, 0x18 }; -static u8 ant_sw_ctrl_tbl_rev8[] = { 0x4, 0x8, 0x4, 0x8, 0x11, 0x12 }; -static u8 ant_sw_ctrl_tbl_rev8_2057v7_core0[] = { - 0x09, 0x0a, 0x15, 0x16, 0x09, 0x0a -}; -static u8 ant_sw_ctrl_tbl_rev8_2057v7_core1[] = { - 0x09, 0x0a, 0x09, 0x0a, 0x15, 0x16 -}; - -bool wlc_phy_bist_check_phy(struct brcms_phy_pub *pih) -{ - struct brcms_phy *pi = (struct brcms_phy *) pih; - u32 phybist0, phybist1, phybist2, phybist3, phybist4; - - if (NREV_GE(pi->pubpi.phy_rev, 16)) - return true; - - phybist0 = read_phy_reg(pi, 0x0e); - phybist1 = read_phy_reg(pi, 0x0f); - phybist2 = read_phy_reg(pi, 0xea); - phybist3 = read_phy_reg(pi, 0xeb); - phybist4 = read_phy_reg(pi, 0x156); - - if ((phybist0 == 0) && (phybist1 == 0x4000) && (phybist2 == 0x1fe0) && - (phybist3 == 0) && (phybist4 == 0)) - return true; - - return false; -} - -static void wlc_phy_bphy_init_nphy(struct brcms_phy *pi) -{ - u16 addr, val; - - val = 0x1e1f; - for (addr = (NPHY_TO_BPHY_OFF + BPHY_RSSI_LUT); - addr <= (NPHY_TO_BPHY_OFF + BPHY_RSSI_LUT_END); addr++) { - write_phy_reg(pi, addr, val); - if (addr == (NPHY_TO_BPHY_OFF + 0x97)) - val = 0x3e3f; - else - val -= 0x0202; - } - - write_phy_reg(pi, NPHY_TO_BPHY_OFF + BPHY_STEP, 0x668); -} - -void -wlc_phy_table_write_nphy(struct brcms_phy *pi, u32 id, u32 len, u32 offset, - u32 width, const void *data) -{ - struct phytbl_info tbl; - - tbl.tbl_id = id; - tbl.tbl_len = len; - tbl.tbl_offset = offset; - tbl.tbl_width = width; - tbl.tbl_ptr = data; - wlc_phy_write_table_nphy(pi, &tbl); -} - -void -wlc_phy_table_read_nphy(struct brcms_phy *pi, u32 id, u32 len, u32 offset, - u32 width, void *data) -{ - struct phytbl_info tbl; - - tbl.tbl_id = id; - tbl.tbl_len = len; - tbl.tbl_offset = offset; - tbl.tbl_width = width; - tbl.tbl_ptr = data; - wlc_phy_read_table_nphy(pi, &tbl); -} - -static void -wlc_phy_static_table_download_nphy(struct brcms_phy *pi) -{ - uint idx; - - if (NREV_GE(pi->pubpi.phy_rev, 16)) { - for (idx = 0; idx < mimophytbl_info_sz_rev16; idx++) - wlc_phy_write_table_nphy(pi, - &mimophytbl_info_rev16[idx]); - } else if (NREV_GE(pi->pubpi.phy_rev, 7)) { - for (idx = 0; idx < mimophytbl_info_sz_rev7; idx++) - wlc_phy_write_table_nphy(pi, - &mimophytbl_info_rev7[idx]); - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - for (idx = 0; idx < mimophytbl_info_sz_rev3; idx++) - wlc_phy_write_table_nphy(pi, - &mimophytbl_info_rev3[idx]); - } else { - for (idx = 0; idx < mimophytbl_info_sz_rev0; idx++) - wlc_phy_write_table_nphy(pi, - &mimophytbl_info_rev0[idx]); - } -} - -static void wlc_phy_tbl_init_nphy(struct brcms_phy *pi) -{ - uint idx = 0; - u8 antswctrllut; - - if (pi->phy_init_por) - wlc_phy_static_table_download_nphy(pi); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - antswctrllut = CHSPEC_IS2G(pi->radio_chanspec) ? - pi->srom_fem2g.antswctrllut : pi->srom_fem5g. - antswctrllut; - - switch (antswctrllut) { - case 0: - - break; - - case 1: - - if (pi->aa2g == 7) - wlc_phy_table_write_nphy( - pi, - NPHY_TBL_ID_ANTSWCTRLLUT, - 2, 0x21, 8, - &ant_sw_ctrl_tbl_rev8_2o3[0]); - else - wlc_phy_table_write_nphy( - pi, - NPHY_TBL_ID_ANTSWCTRLLUT, - 2, 0x21, 8, - &ant_sw_ctrl_tbl_rev8 - [0]); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 2, 0x25, 8, - &ant_sw_ctrl_tbl_rev8[2]); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 2, 0x29, 8, - &ant_sw_ctrl_tbl_rev8[4]); - break; - - case 2: - - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 2, 0x1, 8, - &ant_sw_ctrl_tbl_rev8_2057v7_core0[0]); - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 2, 0x5, 8, - &ant_sw_ctrl_tbl_rev8_2057v7_core0[2]); - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 2, 0x9, 8, - &ant_sw_ctrl_tbl_rev8_2057v7_core0[4]); - - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 2, 0x21, 8, - &ant_sw_ctrl_tbl_rev8_2057v7_core1[0]); - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 2, 0x25, 8, - &ant_sw_ctrl_tbl_rev8_2057v7_core1[2]); - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 2, 0x29, 8, - &ant_sw_ctrl_tbl_rev8_2057v7_core1[4]); - break; - - default: - break; - } - - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - for (idx = 0; idx < mimophytbl_info_sz_rev3_volatile; idx++) { - - if (idx == ANT_SWCTRL_TBL_REV3_IDX) { - antswctrllut = - CHSPEC_IS2G(pi->radio_chanspec) ? - pi->srom_fem2g.antswctrllut : - pi->srom_fem5g.antswctrllut; - switch (antswctrllut) { - case 0: - wlc_phy_write_table_nphy( - pi, - &mimophytbl_info_rev3_volatile - [idx]); - break; - case 1: - wlc_phy_write_table_nphy( - pi, - &mimophytbl_info_rev3_volatile1 - [idx]); - break; - case 2: - wlc_phy_write_table_nphy( - pi, - &mimophytbl_info_rev3_volatile2 - [idx]); - break; - case 3: - wlc_phy_write_table_nphy( - pi, - &mimophytbl_info_rev3_volatile3 - [idx]); - break; - default: - break; - } - } else { - wlc_phy_write_table_nphy( - pi, - &mimophytbl_info_rev3_volatile[idx]); - } - } - } else { - for (idx = 0; idx < mimophytbl_info_sz_rev0_volatile; idx++) - wlc_phy_write_table_nphy(pi, - &mimophytbl_info_rev0_volatile - [idx]); - } -} - -static void -wlc_phy_write_txmacreg_nphy(struct brcms_phy *pi, u16 holdoff, u16 delay) -{ - write_phy_reg(pi, 0x77, holdoff); - write_phy_reg(pi, 0xb4, delay); -} - -void wlc_phy_nphy_tkip_rifs_war(struct brcms_phy *pi, u8 rifs) -{ - u16 holdoff, delay; - - if (rifs) { - - holdoff = 0x10; - delay = 0x258; - } else { - - holdoff = 0x15; - delay = 0x320; - } - - wlc_phy_write_txmacreg_nphy(pi, holdoff, delay); - - if (pi->sh && (pi->sh->_rifs_phy != rifs)) - pi->sh->_rifs_phy = rifs; -} - -static void wlc_phy_txpwrctrl_config_nphy(struct brcms_phy *pi) -{ - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - pi->nphy_txpwrctrl = PHY_TPC_HW_ON; - pi->phy_5g_pwrgain = true; - return; - } - - pi->nphy_txpwrctrl = PHY_TPC_HW_OFF; - pi->phy_5g_pwrgain = false; - - if ((pi->sh->boardflags2 & BFL2_TXPWRCTRL_EN) && - NREV_GE(pi->pubpi.phy_rev, 2) && (pi->sh->sromrev >= 4)) - pi->nphy_txpwrctrl = PHY_TPC_HW_ON; - else if ((pi->sh->sromrev >= 4) - && (pi->sh->boardflags2 & BFL2_5G_PWRGAIN)) - pi->phy_5g_pwrgain = true; -} - -static void wlc_phy_txpwr_srom_read_ppr_nphy(struct brcms_phy *pi) -{ - u16 bw40po, cddpo, stbcpo, bwduppo; - uint band_num; - struct ssb_sprom *sprom = &pi->d11core->bus->sprom; - - if (pi->sh->sromrev >= 9) - return; - - bw40po = sprom->bw40po; - pi->bw402gpo = bw40po & 0xf; - pi->bw405gpo = (bw40po & 0xf0) >> 4; - pi->bw405glpo = (bw40po & 0xf00) >> 8; - pi->bw405ghpo = (bw40po & 0xf000) >> 12; - - cddpo = sprom->cddpo; - pi->cdd2gpo = cddpo & 0xf; - pi->cdd5gpo = (cddpo & 0xf0) >> 4; - pi->cdd5glpo = (cddpo & 0xf00) >> 8; - pi->cdd5ghpo = (cddpo & 0xf000) >> 12; - - stbcpo = sprom->stbcpo; - pi->stbc2gpo = stbcpo & 0xf; - pi->stbc5gpo = (stbcpo & 0xf0) >> 4; - pi->stbc5glpo = (stbcpo & 0xf00) >> 8; - pi->stbc5ghpo = (stbcpo & 0xf000) >> 12; - - bwduppo = sprom->bwduppo; - pi->bwdup2gpo = bwduppo & 0xf; - pi->bwdup5gpo = (bwduppo & 0xf0) >> 4; - pi->bwdup5glpo = (bwduppo & 0xf00) >> 8; - pi->bwdup5ghpo = (bwduppo & 0xf000) >> 12; - - for (band_num = 0; band_num < (CH_2G_GROUP + CH_5G_GROUP); - band_num++) { - switch (band_num) { - case 0: - pi->nphy_pwrctrl_info[PHY_CORE_0].max_pwr_2g = - sprom->core_pwr_info[0].maxpwr_2g; - pi->nphy_pwrctrl_info[PHY_CORE_1].max_pwr_2g = - sprom->core_pwr_info[1].maxpwr_2g; - pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_a1 = - sprom->core_pwr_info[0].pa_2g[0]; - pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_a1 = - sprom->core_pwr_info[1].pa_2g[0]; - pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_b0 = - sprom->core_pwr_info[0].pa_2g[1]; - pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_b0 = - sprom->core_pwr_info[1].pa_2g[1]; - pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_2g_b1 = - sprom->core_pwr_info[0].pa_2g[2]; - pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_2g_b1 = - sprom->core_pwr_info[1].pa_2g[2]; - pi->nphy_pwrctrl_info[PHY_CORE_0].idle_targ_2g = - sprom->core_pwr_info[0].itssi_2g; - pi->nphy_pwrctrl_info[PHY_CORE_1].idle_targ_2g = - sprom->core_pwr_info[1].itssi_2g; - - pi->cck2gpo = sprom->cck2gpo; - - pi->ofdm2gpo = sprom->ofdm2gpo; - - pi->mcs2gpo[0] = sprom->mcs2gpo[0]; - pi->mcs2gpo[1] = sprom->mcs2gpo[1]; - pi->mcs2gpo[2] = sprom->mcs2gpo[2]; - pi->mcs2gpo[3] = sprom->mcs2gpo[3]; - pi->mcs2gpo[4] = sprom->mcs2gpo[4]; - pi->mcs2gpo[5] = sprom->mcs2gpo[5]; - pi->mcs2gpo[6] = sprom->mcs2gpo[6]; - pi->mcs2gpo[7] = sprom->mcs2gpo[7]; - break; - case 1: - - pi->nphy_pwrctrl_info[PHY_CORE_0].max_pwr_5gm = - sprom->core_pwr_info[0].maxpwr_5g; - pi->nphy_pwrctrl_info[PHY_CORE_1].max_pwr_5gm = - sprom->core_pwr_info[1].maxpwr_5g; - pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_a1 = - sprom->core_pwr_info[0].pa_5g[0]; - pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_a1 = - sprom->core_pwr_info[1].pa_5g[0]; - pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_b0 = - sprom->core_pwr_info[0].pa_5g[1]; - pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_b0 = - sprom->core_pwr_info[1].pa_5g[1]; - pi->nphy_pwrctrl_info[PHY_CORE_0].pwrdet_5gm_b1 = - sprom->core_pwr_info[0].pa_5g[2]; - pi->nphy_pwrctrl_info[PHY_CORE_1].pwrdet_5gm_b1 = - sprom->core_pwr_info[1].pa_5g[2]; - pi->nphy_pwrctrl_info[PHY_CORE_0].idle_targ_5gm = - sprom->core_pwr_info[0].itssi_5g; - pi->nphy_pwrctrl_info[PHY_CORE_1].idle_targ_5gm = - sprom->core_pwr_info[1].itssi_5g; - - pi->ofdm5gpo = sprom->ofdm5gpo; - - pi->mcs5gpo[0] = sprom->mcs5gpo[0]; - pi->mcs5gpo[1] = sprom->mcs5gpo[1]; - pi->mcs5gpo[2] = sprom->mcs5gpo[2]; - pi->mcs5gpo[3] = sprom->mcs5gpo[3]; - pi->mcs5gpo[4] = sprom->mcs5gpo[4]; - pi->mcs5gpo[5] = sprom->mcs5gpo[5]; - pi->mcs5gpo[6] = sprom->mcs5gpo[6]; - pi->mcs5gpo[7] = sprom->mcs5gpo[7]; - break; - case 2: - - pi->nphy_pwrctrl_info[0].max_pwr_5gl = - sprom->core_pwr_info[0].maxpwr_5gl; - pi->nphy_pwrctrl_info[1].max_pwr_5gl = - sprom->core_pwr_info[1].maxpwr_5gl; - pi->nphy_pwrctrl_info[0].pwrdet_5gl_a1 = - sprom->core_pwr_info[0].pa_5gl[0]; - pi->nphy_pwrctrl_info[1].pwrdet_5gl_a1 = - sprom->core_pwr_info[1].pa_5gl[0]; - pi->nphy_pwrctrl_info[0].pwrdet_5gl_b0 = - sprom->core_pwr_info[0].pa_5gl[1]; - pi->nphy_pwrctrl_info[1].pwrdet_5gl_b0 = - sprom->core_pwr_info[1].pa_5gl[1]; - pi->nphy_pwrctrl_info[0].pwrdet_5gl_b1 = - sprom->core_pwr_info[0].pa_5gl[2]; - pi->nphy_pwrctrl_info[1].pwrdet_5gl_b1 = - sprom->core_pwr_info[1].pa_5gl[2]; - pi->nphy_pwrctrl_info[0].idle_targ_5gl = 0; - pi->nphy_pwrctrl_info[1].idle_targ_5gl = 0; - - pi->ofdm5glpo = sprom->ofdm5glpo; - - pi->mcs5glpo[0] = sprom->mcs5glpo[0]; - pi->mcs5glpo[1] = sprom->mcs5glpo[1]; - pi->mcs5glpo[2] = sprom->mcs5glpo[2]; - pi->mcs5glpo[3] = sprom->mcs5glpo[3]; - pi->mcs5glpo[4] = sprom->mcs5glpo[4]; - pi->mcs5glpo[5] = sprom->mcs5glpo[5]; - pi->mcs5glpo[6] = sprom->mcs5glpo[6]; - pi->mcs5glpo[7] = sprom->mcs5glpo[7]; - break; - case 3: - - pi->nphy_pwrctrl_info[0].max_pwr_5gh = - sprom->core_pwr_info[0].maxpwr_5gh; - pi->nphy_pwrctrl_info[1].max_pwr_5gh = - sprom->core_pwr_info[1].maxpwr_5gh; - pi->nphy_pwrctrl_info[0].pwrdet_5gh_a1 = - sprom->core_pwr_info[0].pa_5gh[0]; - pi->nphy_pwrctrl_info[1].pwrdet_5gh_a1 = - sprom->core_pwr_info[1].pa_5gh[0]; - pi->nphy_pwrctrl_info[0].pwrdet_5gh_b0 = - sprom->core_pwr_info[0].pa_5gh[1]; - pi->nphy_pwrctrl_info[1].pwrdet_5gh_b0 = - sprom->core_pwr_info[1].pa_5gh[1]; - pi->nphy_pwrctrl_info[0].pwrdet_5gh_b1 = - sprom->core_pwr_info[0].pa_5gh[2]; - pi->nphy_pwrctrl_info[1].pwrdet_5gh_b1 = - sprom->core_pwr_info[1].pa_5gh[2]; - pi->nphy_pwrctrl_info[0].idle_targ_5gh = 0; - pi->nphy_pwrctrl_info[1].idle_targ_5gh = 0; - - pi->ofdm5ghpo = sprom->ofdm5ghpo; - - pi->mcs5ghpo[0] = sprom->mcs5ghpo[0]; - pi->mcs5ghpo[1] = sprom->mcs5ghpo[1]; - pi->mcs5ghpo[2] = sprom->mcs5ghpo[2]; - pi->mcs5ghpo[3] = sprom->mcs5ghpo[3]; - pi->mcs5ghpo[4] = sprom->mcs5ghpo[4]; - pi->mcs5ghpo[5] = sprom->mcs5ghpo[5]; - pi->mcs5ghpo[6] = sprom->mcs5ghpo[6]; - pi->mcs5ghpo[7] = sprom->mcs5ghpo[7]; - break; - } - } - - wlc_phy_txpwr_apply_nphy(pi); -} - -static bool wlc_phy_txpwr_srom_read_nphy(struct brcms_phy *pi) -{ - struct ssb_sprom *sprom = &pi->d11core->bus->sprom; - - pi->antswitch = sprom->antswitch; - pi->aa2g = sprom->ant_available_bg; - pi->aa5g = sprom->ant_available_a; - - pi->srom_fem2g.tssipos = sprom->fem.ghz2.tssipos; - pi->srom_fem2g.extpagain = sprom->fem.ghz2.extpa_gain; - pi->srom_fem2g.pdetrange = sprom->fem.ghz2.pdet_range; - pi->srom_fem2g.triso = sprom->fem.ghz2.tr_iso; - pi->srom_fem2g.antswctrllut = sprom->fem.ghz2.antswlut; - - pi->srom_fem5g.tssipos = sprom->fem.ghz5.tssipos; - pi->srom_fem5g.extpagain = sprom->fem.ghz5.extpa_gain; - pi->srom_fem5g.pdetrange = sprom->fem.ghz5.pdet_range; - pi->srom_fem5g.triso = sprom->fem.ghz5.tr_iso; - if (sprom->fem.ghz5.antswlut) - pi->srom_fem5g.antswctrllut = sprom->fem.ghz5.antswlut; - else - pi->srom_fem5g.antswctrllut = sprom->fem.ghz2.antswlut; - - wlc_phy_txpower_ipa_upd(pi); - - pi->phy_txcore_disable_temp = sprom->tempthresh; - if (pi->phy_txcore_disable_temp == 0) - pi->phy_txcore_disable_temp = PHY_CHAIN_TX_DISABLE_TEMP; - - pi->phy_tempsense_offset = sprom->tempoffset; - if (pi->phy_tempsense_offset != 0) { - if (pi->phy_tempsense_offset > - (NPHY_SROM_TEMPSHIFT + NPHY_SROM_MAXTEMPOFFSET)) - pi->phy_tempsense_offset = NPHY_SROM_MAXTEMPOFFSET; - else if (pi->phy_tempsense_offset < (NPHY_SROM_TEMPSHIFT + - NPHY_SROM_MINTEMPOFFSET)) - pi->phy_tempsense_offset = NPHY_SROM_MINTEMPOFFSET; - else - pi->phy_tempsense_offset -= NPHY_SROM_TEMPSHIFT; - } - - pi->phy_txcore_enable_temp = - pi->phy_txcore_disable_temp - PHY_HYSTERESIS_DELTATEMP; - - pi->phycal_tempdelta = sprom->phycal_tempdelta; - if (pi->phycal_tempdelta > NPHY_CAL_MAXTEMPDELTA) - pi->phycal_tempdelta = 0; - - wlc_phy_txpwr_srom_read_ppr_nphy(pi); - - return true; -} - -bool wlc_phy_attach_nphy(struct brcms_phy *pi) -{ - uint i; - - if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LT(pi->pubpi.phy_rev, 6)) - pi->phyhang_avoid = true; - - if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LT(pi->pubpi.phy_rev, 7)) { - pi->nphy_gband_spurwar_en = true; - if (pi->sh->boardflags2 & BFL2_SPUR_WAR) - pi->nphy_aband_spurwar_en = true; - } - if (NREV_GE(pi->pubpi.phy_rev, 6) && NREV_LT(pi->pubpi.phy_rev, 7)) { - if (pi->sh->boardflags2 & BFL2_2G_SPUR_WAR) - pi->nphy_gband_spurwar2_en = true; - } - - pi->n_preamble_override = AUTO; - if (NREV_IS(pi->pubpi.phy_rev, 3) || NREV_IS(pi->pubpi.phy_rev, 4)) - pi->n_preamble_override = BRCMS_N_PREAMBLE_MIXEDMODE; - - pi->nphy_txrx_chain = AUTO; - pi->phy_scraminit = AUTO; - - pi->nphy_rxcalparams = 0x010100B5; - - pi->nphy_perical = PHY_PERICAL_MPHASE; - pi->mphase_cal_phase_id = MPHASE_CAL_STATE_IDLE; - pi->mphase_txcal_numcmds = MPHASE_TXCAL_NUMCMDS; - - pi->nphy_gain_boost = true; - pi->nphy_elna_gain_config = false; - pi->radio_is_on = false; - - for (i = 0; i < pi->pubpi.phy_corenum; i++) - pi->nphy_txpwrindex[i].index = AUTO; - - wlc_phy_txpwrctrl_config_nphy(pi); - if (pi->nphy_txpwrctrl == PHY_TPC_HW_ON) - pi->hwpwrctrl_capable = true; - - pi->pi_fptr.init = wlc_phy_init_nphy; - pi->pi_fptr.calinit = wlc_phy_cal_init_nphy; - pi->pi_fptr.chanset = wlc_phy_chanspec_set_nphy; - pi->pi_fptr.txpwrrecalc = wlc_phy_txpower_recalc_target_nphy; - - if (!wlc_phy_txpwr_srom_read_nphy(pi)) - return false; - - return true; -} - -static s32 get_rf_pwr_offset(struct brcms_phy *pi, s16 pga_gn, s16 pad_gn) -{ - s32 rfpwr_offset = 0; - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if ((pi->pubpi.radiorev == 3) || - (pi->pubpi.radiorev == 4) || - (pi->pubpi.radiorev == 6)) - rfpwr_offset = (s16) - nphy_papd_padgain_dlt_2g_2057rev3n4 - [pad_gn]; - else if (pi->pubpi.radiorev == 5) - rfpwr_offset = (s16) - nphy_papd_padgain_dlt_2g_2057rev5 - [pad_gn]; - else if ((pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == - 8)) - rfpwr_offset = (s16) - nphy_papd_padgain_dlt_2g_2057rev7 - [pad_gn]; - } else { - if ((pi->pubpi.radiorev == 3) || - (pi->pubpi.radiorev == 4) || - (pi->pubpi.radiorev == 6)) - rfpwr_offset = (s16) - nphy_papd_pgagain_dlt_5g_2057 - [pga_gn]; - else if ((pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == - 8)) - rfpwr_offset = (s16) - nphy_papd_pgagain_dlt_5g_2057rev7 - [pga_gn]; - } - return rfpwr_offset; -} - -static void wlc_phy_update_mimoconfig_nphy(struct brcms_phy *pi, s32 preamble) -{ - bool gf_preamble = false; - u16 val; - - if (preamble == BRCMS_N_PREAMBLE_GF) - gf_preamble = true; - - val = read_phy_reg(pi, 0xed); - - val |= RX_GF_MM_AUTO; - val &= ~RX_GF_OR_MM; - if (gf_preamble) - val |= RX_GF_OR_MM; - - write_phy_reg(pi, 0xed, val); -} - -static void wlc_phy_ipa_set_tx_digi_filts_nphy(struct brcms_phy *pi) -{ - int j, type; - u16 addr_offset[] = { 0x186, 0x195, 0x2c5}; - - for (type = 0; type < 3; type++) { - for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++) - write_phy_reg(pi, addr_offset[type] + j, - NPHY_IPA_REV4_txdigi_filtcoeffs[type][j]); - } - - if (pi->bw == WL_CHANSPEC_BW_40) { - for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++) - write_phy_reg(pi, 0x186 + j, - NPHY_IPA_REV4_txdigi_filtcoeffs[3][j]); - } else { - if (CHSPEC_IS5G(pi->radio_chanspec)) { - for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++) - write_phy_reg(pi, 0x186 + j, - NPHY_IPA_REV4_txdigi_filtcoeffs[5][j]); - } - - if (CHSPEC_CHANNEL(pi->radio_chanspec) == 14) { - for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++) - write_phy_reg(pi, 0x2c5 + j, - NPHY_IPA_REV4_txdigi_filtcoeffs[6][j]); - } - } -} - -static void wlc_phy_ipa_restore_tx_digi_filts_nphy(struct brcms_phy *pi) -{ - int j; - - if (pi->bw == WL_CHANSPEC_BW_40) { - for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++) - write_phy_reg(pi, 0x195 + j, - NPHY_IPA_REV4_txdigi_filtcoeffs[4][j]); - } else { - for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++) - write_phy_reg(pi, 0x186 + j, - NPHY_IPA_REV4_txdigi_filtcoeffs[3][j]); - } -} - -static void -wlc_phy_set_rfseq_nphy(struct brcms_phy *pi, u8 cmd, u8 *events, u8 *dlys, - u8 len) -{ - u32 t1_offset, t2_offset; - u8 ctr; - u8 end_event = - NREV_GE(pi->pubpi.phy_rev, - 3) ? NPHY_REV3_RFSEQ_CMD_END : NPHY_RFSEQ_CMD_END; - u8 end_dly = 1; - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - t1_offset = cmd << 4; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, len, t1_offset, 8, - events); - t2_offset = t1_offset + 0x080; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, len, t2_offset, 8, - dlys); - - for (ctr = len; ctr < 16; ctr++) { - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 1, - t1_offset + ctr, 8, &end_event); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 1, - t2_offset + ctr, 8, &end_dly); - } - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); -} - -static u16 wlc_phy_read_lpf_bw_ctl_nphy(struct brcms_phy *pi, u16 offset) -{ - u16 lpf_bw_ctl_val = 0; - u16 rx2tx_lpf_rc_lut_offset = 0; - - if (offset == 0) { - if (CHSPEC_IS40(pi->radio_chanspec)) - rx2tx_lpf_rc_lut_offset = 0x159; - else - rx2tx_lpf_rc_lut_offset = 0x154; - } else { - rx2tx_lpf_rc_lut_offset = offset; - } - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 1, - (u32) rx2tx_lpf_rc_lut_offset, 16, - &lpf_bw_ctl_val); - - lpf_bw_ctl_val = lpf_bw_ctl_val & 0x7; - - return lpf_bw_ctl_val; -} - -static void -wlc_phy_rfctrl_override_nphy_rev7(struct brcms_phy *pi, u16 field, u16 value, - u8 core_mask, u8 off, u8 override_id) -{ - u8 core_num; - u16 addr = 0, en_addr = 0, val_addr = 0, en_mask = 0, val_mask = 0; - u8 val_shift = 0; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - en_mask = field; - for (core_num = 0; core_num < 2; core_num++) { - if (override_id == NPHY_REV7_RFCTRLOVERRIDE_ID0) { - - switch (field) { - case (0x1 << 2): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : - 0x7d; - val_mask = (0x1 << 1); - val_shift = 1; - break; - case (0x1 << 3): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : - 0x7d; - val_mask = (0x1 << 2); - val_shift = 2; - break; - case (0x1 << 4): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : - 0x7d; - val_mask = (0x1 << 4); - val_shift = 4; - break; - case (0x1 << 5): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : - 0x7d; - val_mask = (0x1 << 5); - val_shift = 5; - break; - case (0x1 << 6): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : - 0x7d; - val_mask = (0x1 << 6); - val_shift = 6; - break; - case (0x1 << 7): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : - 0x7d; - val_mask = (0x1 << 7); - val_shift = 7; - break; - case (0x1 << 10): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0xf8 : - 0xfa; - val_mask = (0x7 << 4); - val_shift = 4; - break; - case (0x1 << 11): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7b : - 0x7e; - val_mask = (0xffff << 0); - val_shift = 0; - break; - case (0x1 << 12): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7c : - 0x7f; - val_mask = (0xffff << 0); - val_shift = 0; - break; - case (0x3 << 13): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x348 : - 0x349; - val_mask = (0xff << 0); - val_shift = 0; - break; - case (0x1 << 13): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x348 : - 0x349; - val_mask = (0xf << 0); - val_shift = 0; - break; - default: - addr = 0xffff; - break; - } - } else if (override_id == - NPHY_REV7_RFCTRLOVERRIDE_ID1) { - - switch (field) { - case (0x1 << 1): - en_addr = (core_num == 0) ? 0x342 : - 0x343; - val_addr = (core_num == 0) ? 0x340 : - 0x341; - val_mask = (0x1 << 1); - val_shift = 1; - break; - case (0x1 << 3): - en_addr = (core_num == 0) ? 0x342 : - 0x343; - val_addr = (core_num == 0) ? 0x340 : - 0x341; - val_mask = (0x1 << 3); - val_shift = 3; - break; - case (0x1 << 5): - en_addr = (core_num == 0) ? 0x342 : - 0x343; - val_addr = (core_num == 0) ? 0x340 : - 0x341; - val_mask = (0x1 << 5); - val_shift = 5; - break; - case (0x1 << 4): - en_addr = (core_num == 0) ? 0x342 : - 0x343; - val_addr = (core_num == 0) ? 0x340 : - 0x341; - val_mask = (0x1 << 4); - val_shift = 4; - break; - case (0x1 << 2): - - en_addr = (core_num == 0) ? 0x342 : - 0x343; - val_addr = (core_num == 0) ? 0x340 : - 0x341; - val_mask = (0x1 << 2); - val_shift = 2; - break; - case (0x1 << 7): - - en_addr = (core_num == 0) ? 0x342 : - 0x343; - val_addr = (core_num == 0) ? 0x340 : - 0x341; - val_mask = (0x7 << 8); - val_shift = 8; - break; - case (0x1 << 11): - en_addr = (core_num == 0) ? 0x342 : - 0x343; - val_addr = (core_num == 0) ? 0x340 : - 0x341; - val_mask = (0x1 << 14); - val_shift = 14; - break; - case (0x1 << 10): - en_addr = (core_num == 0) ? 0x342 : - 0x343; - val_addr = (core_num == 0) ? 0x340 : - 0x341; - val_mask = (0x1 << 13); - val_shift = 13; - break; - case (0x1 << 9): - en_addr = (core_num == 0) ? 0x342 : - 0x343; - val_addr = (core_num == 0) ? 0x340 : - 0x341; - val_mask = (0x1 << 12); - val_shift = 12; - break; - case (0x1 << 8): - en_addr = (core_num == 0) ? 0x342 : - 0x343; - val_addr = (core_num == 0) ? 0x340 : - 0x341; - val_mask = (0x1 << 11); - val_shift = 11; - break; - case (0x1 << 6): - en_addr = (core_num == 0) ? 0x342 : - 0x343; - val_addr = (core_num == 0) ? 0x340 : - 0x341; - val_mask = (0x1 << 6); - val_shift = 6; - break; - case (0x1 << 0): - en_addr = (core_num == 0) ? 0x342 : - 0x343; - val_addr = (core_num == 0) ? 0x340 : - 0x341; - val_mask = (0x1 << 0); - val_shift = 0; - break; - default: - addr = 0xffff; - break; - } - } else if (override_id == - NPHY_REV7_RFCTRLOVERRIDE_ID2) { - - switch (field) { - case (0x1 << 3): - en_addr = (core_num == 0) ? 0x346 : - 0x347; - val_addr = (core_num == 0) ? 0x344 : - 0x345; - val_mask = (0x1 << 3); - val_shift = 3; - break; - case (0x1 << 1): - en_addr = (core_num == 0) ? 0x346 : - 0x347; - val_addr = (core_num == 0) ? 0x344 : - 0x345; - val_mask = (0x1 << 1); - val_shift = 1; - break; - case (0x1 << 0): - en_addr = (core_num == 0) ? 0x346 : - 0x347; - val_addr = (core_num == 0) ? 0x344 : - 0x345; - val_mask = (0x1 << 0); - val_shift = 0; - break; - case (0x1 << 2): - en_addr = (core_num == 0) ? 0x346 : - 0x347; - val_addr = (core_num == 0) ? 0x344 : - 0x345; - val_mask = (0x1 << 2); - val_shift = 2; - break; - case (0x1 << 4): - en_addr = (core_num == 0) ? 0x346 : - 0x347; - val_addr = (core_num == 0) ? 0x344 : - 0x345; - val_mask = (0x1 << 4); - val_shift = 4; - break; - default: - addr = 0xffff; - break; - } - } - - if (off) { - and_phy_reg(pi, en_addr, ~en_mask); - and_phy_reg(pi, val_addr, ~val_mask); - } else { - - if ((core_mask == 0) - || (core_mask & (1 << core_num))) { - or_phy_reg(pi, en_addr, en_mask); - - if (addr != 0xffff) - mod_phy_reg(pi, val_addr, - val_mask, - (value << - val_shift)); - } - } - } - } -} - -static void wlc_phy_adjust_lnagaintbl_nphy(struct brcms_phy *pi) -{ - uint core; - int ctr; - s16 gain_delta[2]; - u8 curr_channel; - u16 minmax_gain[2]; - u16 regval[4]; - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - if (pi->nphy_gain_boost) { - if ((CHSPEC_IS2G(pi->radio_chanspec))) { - - gain_delta[0] = 6; - gain_delta[1] = 6; - } else { - - curr_channel = CHSPEC_CHANNEL(pi->radio_chanspec); - gain_delta[0] = - (s16) - PHY_HW_ROUND(((nphy_lnagain_est0[0] * - curr_channel) + - nphy_lnagain_est0[1]), 13); - gain_delta[1] = - (s16) - PHY_HW_ROUND(((nphy_lnagain_est1[0] * - curr_channel) + - nphy_lnagain_est1[1]), 13); - } - } else { - - gain_delta[0] = 0; - gain_delta[1] = 0; - } - - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - if (pi->nphy_elna_gain_config) { - - regval[0] = nphy_def_lnagains[2] + gain_delta[core]; - regval[1] = nphy_def_lnagains[3] + gain_delta[core]; - regval[2] = nphy_def_lnagains[3] + gain_delta[core]; - regval[3] = nphy_def_lnagains[3] + gain_delta[core]; - } else { - for (ctr = 0; ctr < 4; ctr++) - regval[ctr] = - nphy_def_lnagains[ctr] + - gain_delta[core]; - } - wlc_phy_table_write_nphy(pi, core, 4, 8, 16, regval); - - minmax_gain[core] = - (u16) (nphy_def_lnagains[2] + gain_delta[core] + 4); - } - - mod_phy_reg(pi, 0x1e, (0xff << 0), (minmax_gain[0] << 0)); - mod_phy_reg(pi, 0x34, (0xff << 0), (minmax_gain[1] << 0)); - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); -} - -static void -wlc_phy_war_force_trsw_to_R_cliplo_nphy(struct brcms_phy *pi, u8 core) -{ - if (core == PHY_CORE_0) { - write_phy_reg(pi, 0x38, 0x4); - if (CHSPEC_IS2G(pi->radio_chanspec)) - write_phy_reg(pi, 0x37, 0x0060); - else - write_phy_reg(pi, 0x37, 0x1080); - } else if (core == PHY_CORE_1) { - write_phy_reg(pi, 0x2ae, 0x4); - if (CHSPEC_IS2G(pi->radio_chanspec)) - write_phy_reg(pi, 0x2ad, 0x0060); - else - write_phy_reg(pi, 0x2ad, 0x1080); - } -} - -static void wlc_phy_war_txchain_upd_nphy(struct brcms_phy *pi, u8 txchain) -{ - u8 txchain0, txchain1; - - txchain0 = txchain & 0x1; - txchain1 = (txchain & 0x2) >> 1; - if (!txchain0) - wlc_phy_war_force_trsw_to_R_cliplo_nphy(pi, PHY_CORE_0); - - if (!txchain1) - wlc_phy_war_force_trsw_to_R_cliplo_nphy(pi, PHY_CORE_1); -} - -static void wlc_phy_workarounds_nphy_gainctrl_2057_rev5(struct brcms_phy *pi) -{ - s8 lna1_gain_db[] = { 8, 13, 17, 22 }; - s8 lna2_gain_db[] = { -2, 7, 11, 15 }; - s8 tia_gain_db[] = { -4, -1, 2, 5, 5, 5, 5, 5, 5, 5 }; - s8 tia_gainbits[] = { - 0x0, 0x01, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 }; - - mod_phy_reg(pi, 0x1c, (0x1 << 13), (1 << 13)); - mod_phy_reg(pi, 0x32, (0x1 << 13), (1 << 13)); - - mod_phy_reg(pi, 0x289, (0xff << 0), (0x46 << 0)); - - mod_phy_reg(pi, 0x283, (0xff << 0), (0x3c << 0)); - mod_phy_reg(pi, 0x280, (0xff << 0), (0x3c << 0)); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 4, 0x8, 8, - lna1_gain_db); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 4, 0x8, 8, - lna1_gain_db); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 4, 0x10, 8, - lna2_gain_db); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 4, 0x10, 8, - lna2_gain_db); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 10, 0x20, 8, - tia_gain_db); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 10, 0x20, 8, - tia_gain_db); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS1, 10, 0x20, 8, - tia_gainbits); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS2, 10, 0x20, 8, - tia_gainbits); - - write_phy_reg(pi, 0x37, 0x74); - write_phy_reg(pi, 0x2ad, 0x74); - write_phy_reg(pi, 0x38, 0x18); - write_phy_reg(pi, 0x2ae, 0x18); - - write_phy_reg(pi, 0x2b, 0xe8); - write_phy_reg(pi, 0x41, 0xe8); - - if (CHSPEC_IS20(pi->radio_chanspec)) { - - mod_phy_reg(pi, 0x300, (0x3f << 0), (0x12 << 0)); - mod_phy_reg(pi, 0x301, (0x3f << 0), (0x12 << 0)); - } else { - - mod_phy_reg(pi, 0x300, (0x3f << 0), (0x10 << 0)); - mod_phy_reg(pi, 0x301, (0x3f << 0), (0x10 << 0)); - } -} - -static void wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi) -{ - u16 currband; - s8 lna1G_gain_db_rev7[] = { 9, 14, 19, 24 }; - s8 *lna1_gain_db = NULL; - s8 *lna1_gain_db_2 = NULL; - s8 *lna2_gain_db = NULL; - s8 tiaA_gain_db_rev7[] = { -9, -6, -3, 0, 3, 3, 3, 3, 3, 3 }; - s8 *tia_gain_db; - s8 tiaA_gainbits_rev7[] = { 0, 1, 2, 3, 4, 4, 4, 4, 4, 4 }; - s8 *tia_gainbits; - u16 rfseqA_init_gain_rev7[] = { 0x624f, 0x624f }; - u16 *rfseq_init_gain; - u16 init_gaincode; - u16 clip1hi_gaincode; - u16 clip1md_gaincode = 0; - u16 clip1md_gaincode_B; - u16 clip1lo_gaincode; - u16 clip1lo_gaincode_B; - u8 crsminl_th = 0; - u8 crsminu_th; - u16 nbclip_th = 0; - u8 w1clip_th; - u16 freq; - s8 nvar_baseline_offset0 = 0, nvar_baseline_offset1 = 0; - u8 chg_nbclip_th = 0; - - mod_phy_reg(pi, 0x1c, (0x1 << 13), (1 << 13)); - mod_phy_reg(pi, 0x32, (0x1 << 13), (1 << 13)); - - currband = read_phy_reg(pi, 0x09) & NPHY_BandControl_currentBand; - if (currband == 0) { - - lna1_gain_db = lna1G_gain_db_rev7; - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 4, 8, 8, - lna1_gain_db); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 4, 8, 8, - lna1_gain_db); - - mod_phy_reg(pi, 0x283, (0xff << 0), (0x40 << 0)); - - if (CHSPEC_IS40(pi->radio_chanspec)) { - mod_phy_reg(pi, 0x280, (0xff << 0), (0x3e << 0)); - mod_phy_reg(pi, 0x283, (0xff << 0), (0x3e << 0)); - } - - mod_phy_reg(pi, 0x289, (0xff << 0), (0x46 << 0)); - - if (CHSPEC_IS20(pi->radio_chanspec)) { - mod_phy_reg(pi, 0x300, (0x3f << 0), (13 << 0)); - mod_phy_reg(pi, 0x301, (0x3f << 0), (13 << 0)); - } - } else { - - init_gaincode = 0x9e; - clip1hi_gaincode = 0x9e; - clip1md_gaincode_B = 0x24; - clip1lo_gaincode = 0x8a; - clip1lo_gaincode_B = 8; - rfseq_init_gain = rfseqA_init_gain_rev7; - - tia_gain_db = tiaA_gain_db_rev7; - tia_gainbits = tiaA_gainbits_rev7; - - freq = CHAN5G_FREQ(CHSPEC_CHANNEL(pi->radio_chanspec)); - if (CHSPEC_IS20(pi->radio_chanspec)) { - - w1clip_th = 25; - clip1md_gaincode = 0x82; - - if ((freq <= 5080) || (freq == 5825)) { - - s8 lna1A_gain_db_rev7[] = { 11, 16, 20, 24 }; - s8 lna1A_gain_db_2_rev7[] = { - 11, 17, 22, 25}; - s8 lna2A_gain_db_rev7[] = { -1, 6, 10, 14 }; - - crsminu_th = 0x3e; - lna1_gain_db = lna1A_gain_db_rev7; - lna1_gain_db_2 = lna1A_gain_db_2_rev7; - lna2_gain_db = lna2A_gain_db_rev7; - } else if ((freq >= 5500) && (freq <= 5700)) { - - s8 lna1A_gain_db_rev7[] = { 11, 17, 21, 25 }; - s8 lna1A_gain_db_2_rev7[] = { - 12, 18, 22, 26}; - s8 lna2A_gain_db_rev7[] = { 1, 8, 12, 16 }; - - crsminu_th = 0x45; - clip1md_gaincode_B = 0x14; - nbclip_th = 0xff; - chg_nbclip_th = 1; - lna1_gain_db = lna1A_gain_db_rev7; - lna1_gain_db_2 = lna1A_gain_db_2_rev7; - lna2_gain_db = lna2A_gain_db_rev7; - } else { - - s8 lna1A_gain_db_rev7[] = { 12, 18, 22, 26 }; - s8 lna1A_gain_db_2_rev7[] = { - 12, 18, 22, 26}; - s8 lna2A_gain_db_rev7[] = { -1, 6, 10, 14 }; - - crsminu_th = 0x41; - lna1_gain_db = lna1A_gain_db_rev7; - lna1_gain_db_2 = lna1A_gain_db_2_rev7; - lna2_gain_db = lna2A_gain_db_rev7; - } - - if (freq <= 4920) { - nvar_baseline_offset0 = 5; - nvar_baseline_offset1 = 5; - } else if ((freq > 4920) && (freq <= 5320)) { - nvar_baseline_offset0 = 3; - nvar_baseline_offset1 = 5; - } else if ((freq > 5320) && (freq <= 5700)) { - nvar_baseline_offset0 = 3; - nvar_baseline_offset1 = 2; - } else { - nvar_baseline_offset0 = 4; - nvar_baseline_offset1 = 0; - } - } else { - - crsminu_th = 0x3a; - crsminl_th = 0x3a; - w1clip_th = 20; - - if ((freq >= 4920) && (freq <= 5320)) { - nvar_baseline_offset0 = 4; - nvar_baseline_offset1 = 5; - } else if ((freq > 5320) && (freq <= 5550)) { - nvar_baseline_offset0 = 4; - nvar_baseline_offset1 = 2; - } else { - nvar_baseline_offset0 = 5; - nvar_baseline_offset1 = 3; - } - } - - write_phy_reg(pi, 0x20, init_gaincode); - write_phy_reg(pi, 0x2a7, init_gaincode); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, - pi->pubpi.phy_corenum, 0x106, 16, - rfseq_init_gain); - - write_phy_reg(pi, 0x22, clip1hi_gaincode); - write_phy_reg(pi, 0x2a9, clip1hi_gaincode); - - write_phy_reg(pi, 0x36, clip1md_gaincode_B); - write_phy_reg(pi, 0x2ac, clip1md_gaincode_B); - - write_phy_reg(pi, 0x37, clip1lo_gaincode); - write_phy_reg(pi, 0x2ad, clip1lo_gaincode); - write_phy_reg(pi, 0x38, clip1lo_gaincode_B); - write_phy_reg(pi, 0x2ae, clip1lo_gaincode_B); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 10, 0x20, 8, - tia_gain_db); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 10, 0x20, 8, - tia_gain_db); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS1, 10, 0x20, 8, - tia_gainbits); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS2, 10, 0x20, 8, - tia_gainbits); - - mod_phy_reg(pi, 0x283, (0xff << 0), (crsminu_th << 0)); - - if (chg_nbclip_th == 1) { - write_phy_reg(pi, 0x2b, nbclip_th); - write_phy_reg(pi, 0x41, nbclip_th); - } - - mod_phy_reg(pi, 0x300, (0x3f << 0), (w1clip_th << 0)); - mod_phy_reg(pi, 0x301, (0x3f << 0), (w1clip_th << 0)); - - mod_phy_reg(pi, 0x2e4, - (0x3f << 0), (nvar_baseline_offset0 << 0)); - - mod_phy_reg(pi, 0x2e4, - (0x3f << 6), (nvar_baseline_offset1 << 6)); - - if (CHSPEC_IS20(pi->radio_chanspec)) { - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 4, 8, 8, - lna1_gain_db); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 4, 8, 8, - lna1_gain_db_2); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 4, 0x10, - 8, lna2_gain_db); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 4, 0x10, - 8, lna2_gain_db); - - write_phy_reg(pi, 0x24, clip1md_gaincode); - write_phy_reg(pi, 0x2ab, clip1md_gaincode); - } else { - mod_phy_reg(pi, 0x280, (0xff << 0), (crsminl_th << 0)); - } - } -} - -static void wlc_phy_workarounds_nphy_gainctrl(struct brcms_phy *pi) -{ - u16 w1th, hpf_code, currband; - int ctr; - u8 rfseq_updategainu_events[] = { - NPHY_RFSEQ_CMD_RX_GAIN, - NPHY_RFSEQ_CMD_CLR_HIQ_DIS, - NPHY_RFSEQ_CMD_SET_HPF_BW - }; - u8 rfseq_updategainu_dlys[] = { 10, 30, 1 }; - s8 lna1G_gain_db[] = { 7, 11, 16, 23 }; - s8 lna1G_gain_db_rev4[] = { 8, 12, 17, 25 }; - s8 lna1G_gain_db_rev5[] = { 9, 13, 18, 26 }; - s8 lna1G_gain_db_rev6[] = { 8, 13, 18, 25 }; - s8 lna1G_gain_db_rev6_224B0[] = { 10, 14, 19, 27 }; - s8 lna1A_gain_db[] = { 7, 11, 17, 23 }; - s8 lna1A_gain_db_rev4[] = { 8, 12, 18, 23 }; - s8 lna1A_gain_db_rev5[] = { 6, 10, 16, 21 }; - s8 lna1A_gain_db_rev6[] = { 6, 10, 16, 21 }; - s8 *lna1_gain_db = NULL; - s8 lna2G_gain_db[] = { -5, 6, 10, 14 }; - s8 lna2G_gain_db_rev5[] = { -3, 7, 11, 16 }; - s8 lna2G_gain_db_rev6[] = { -5, 6, 10, 14 }; - s8 lna2G_gain_db_rev6_224B0[] = { -5, 6, 10, 15 }; - s8 lna2A_gain_db[] = { -6, 2, 6, 10 }; - s8 lna2A_gain_db_rev4[] = { -5, 2, 6, 10 }; - s8 lna2A_gain_db_rev5[] = { -7, 0, 4, 8 }; - s8 lna2A_gain_db_rev6[] = { -7, 0, 4, 8 }; - s8 *lna2_gain_db = NULL; - s8 tiaG_gain_db[] = { - 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A }; - s8 tiaA_gain_db[] = { - 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13 }; - s8 tiaA_gain_db_rev4[] = { - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d }; - s8 tiaA_gain_db_rev5[] = { - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d }; - s8 tiaA_gain_db_rev6[] = { - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d }; - s8 *tia_gain_db; - s8 tiaG_gainbits[] = { - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 }; - s8 tiaA_gainbits[] = { - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06 }; - s8 tiaA_gainbits_rev4[] = { - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 }; - s8 tiaA_gainbits_rev5[] = { - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 }; - s8 tiaA_gainbits_rev6[] = { - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 }; - s8 *tia_gainbits; - s8 lpf_gain_db[] = { 0x00, 0x06, 0x0c, 0x12, 0x12, 0x12 }; - s8 lpf_gainbits[] = { 0x00, 0x01, 0x02, 0x03, 0x03, 0x03 }; - u16 rfseqG_init_gain[] = { 0x613f, 0x613f, 0x613f, 0x613f }; - u16 rfseqG_init_gain_rev4[] = { 0x513f, 0x513f, 0x513f, 0x513f }; - u16 rfseqG_init_gain_rev5[] = { 0x413f, 0x413f, 0x413f, 0x413f }; - u16 rfseqG_init_gain_rev5_elna[] = { - 0x013f, 0x013f, 0x013f, 0x013f }; - u16 rfseqG_init_gain_rev6[] = { 0x513f, 0x513f }; - u16 rfseqG_init_gain_rev6_224B0[] = { 0x413f, 0x413f }; - u16 rfseqG_init_gain_rev6_elna[] = { 0x113f, 0x113f }; - u16 rfseqA_init_gain[] = { 0x516f, 0x516f, 0x516f, 0x516f }; - u16 rfseqA_init_gain_rev4[] = { 0x614f, 0x614f, 0x614f, 0x614f }; - u16 rfseqA_init_gain_rev4_elna[] = { - 0x314f, 0x314f, 0x314f, 0x314f }; - u16 rfseqA_init_gain_rev5[] = { 0x714f, 0x714f, 0x714f, 0x714f }; - u16 rfseqA_init_gain_rev6[] = { 0x714f, 0x714f }; - u16 *rfseq_init_gain; - u16 initG_gaincode = 0x627e; - u16 initG_gaincode_rev4 = 0x527e; - u16 initG_gaincode_rev5 = 0x427e; - u16 initG_gaincode_rev5_elna = 0x027e; - u16 initG_gaincode_rev6 = 0x527e; - u16 initG_gaincode_rev6_224B0 = 0x427e; - u16 initG_gaincode_rev6_elna = 0x127e; - u16 initA_gaincode = 0x52de; - u16 initA_gaincode_rev4 = 0x629e; - u16 initA_gaincode_rev4_elna = 0x329e; - u16 initA_gaincode_rev5 = 0x729e; - u16 initA_gaincode_rev6 = 0x729e; - u16 init_gaincode; - u16 clip1hiG_gaincode = 0x107e; - u16 clip1hiG_gaincode_rev4 = 0x007e; - u16 clip1hiG_gaincode_rev5 = 0x1076; - u16 clip1hiG_gaincode_rev6 = 0x007e; - u16 clip1hiA_gaincode = 0x00de; - u16 clip1hiA_gaincode_rev4 = 0x029e; - u16 clip1hiA_gaincode_rev5 = 0x029e; - u16 clip1hiA_gaincode_rev6 = 0x029e; - u16 clip1hi_gaincode; - u16 clip1mdG_gaincode = 0x0066; - u16 clip1mdA_gaincode = 0x00ca; - u16 clip1mdA_gaincode_rev4 = 0x1084; - u16 clip1mdA_gaincode_rev5 = 0x2084; - u16 clip1mdA_gaincode_rev6 = 0x2084; - u16 clip1md_gaincode = 0; - u16 clip1loG_gaincode = 0x0074; - u16 clip1loG_gaincode_rev5[] = { - 0x0062, 0x0064, 0x006a, 0x106a, 0x106c, 0x1074, 0x107c, 0x207c - }; - u16 clip1loG_gaincode_rev6[] = { - 0x106a, 0x106c, 0x1074, 0x107c, 0x007e, 0x107e, 0x207e, 0x307e - }; - u16 clip1loG_gaincode_rev6_224B0 = 0x1074; - u16 clip1loA_gaincode = 0x00cc; - u16 clip1loA_gaincode_rev4 = 0x0086; - u16 clip1loA_gaincode_rev5 = 0x2086; - u16 clip1loA_gaincode_rev6 = 0x2086; - u16 clip1lo_gaincode; - u8 crsminG_th = 0x18; - u8 crsminG_th_rev5 = 0x18; - u8 crsminG_th_rev6 = 0x18; - u8 crsminA_th = 0x1e; - u8 crsminA_th_rev4 = 0x24; - u8 crsminA_th_rev5 = 0x24; - u8 crsminA_th_rev6 = 0x24; - u8 crsmin_th; - u8 crsminlG_th = 0x18; - u8 crsminlG_th_rev5 = 0x18; - u8 crsminlG_th_rev6 = 0x18; - u8 crsminlA_th = 0x1e; - u8 crsminlA_th_rev4 = 0x24; - u8 crsminlA_th_rev5 = 0x24; - u8 crsminlA_th_rev6 = 0x24; - u8 crsminl_th = 0; - u8 crsminuG_th = 0x18; - u8 crsminuG_th_rev5 = 0x18; - u8 crsminuG_th_rev6 = 0x18; - u8 crsminuA_th = 0x1e; - u8 crsminuA_th_rev4 = 0x24; - u8 crsminuA_th_rev5 = 0x24; - u8 crsminuA_th_rev6 = 0x24; - u8 crsminuA_th_rev6_224B0 = 0x2d; - u8 crsminu_th; - u16 nbclipG_th = 0x20d; - u16 nbclipG_th_rev4 = 0x1a1; - u16 nbclipG_th_rev5 = 0x1d0; - u16 nbclipG_th_rev6 = 0x1d0; - u16 nbclipA_th = 0x1a1; - u16 nbclipA_th_rev4 = 0x107; - u16 nbclipA_th_rev5 = 0x0a9; - u16 nbclipA_th_rev6 = 0x0f0; - u16 nbclip_th = 0; - u8 w1clipG_th = 5; - u8 w1clipG_th_rev5 = 9; - u8 w1clipG_th_rev6 = 5; - u8 w1clipA_th = 25, w1clip_th; - u8 rssi_gain_default = 0x50; - u8 rssiG_gain_rev6_224B0 = 0x50; - u8 rssiA_gain_rev5 = 0x90; - u8 rssiA_gain_rev6 = 0x90; - u8 rssi_gain; - u16 regval[21]; - u8 triso; - - triso = (CHSPEC_IS5G(pi->radio_chanspec)) ? pi->srom_fem5g.triso : - pi->srom_fem2g.triso; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if (pi->pubpi.radiorev == 5) { - wlc_phy_workarounds_nphy_gainctrl_2057_rev5(pi); - } else if (pi->pubpi.radiorev == 7) { - wlc_phy_workarounds_nphy_gainctrl_2057_rev6(pi); - - mod_phy_reg(pi, 0x283, (0xff << 0), (0x44 << 0)); - mod_phy_reg(pi, 0x280, (0xff << 0), (0x44 << 0)); - - } else if ((pi->pubpi.radiorev == 3) - || (pi->pubpi.radiorev == 8)) { - wlc_phy_workarounds_nphy_gainctrl_2057_rev6(pi); - - if (pi->pubpi.radiorev == 8) { - mod_phy_reg(pi, 0x283, - (0xff << 0), (0x44 << 0)); - mod_phy_reg(pi, 0x280, - (0xff << 0), (0x44 << 0)); - } - } else { - wlc_phy_workarounds_nphy_gainctrl_2057_rev6(pi); - } - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - - mod_phy_reg(pi, 0xa0, (0x1 << 6), (1 << 6)); - - mod_phy_reg(pi, 0x1c, (0x1 << 13), (1 << 13)); - mod_phy_reg(pi, 0x32, (0x1 << 13), (1 << 13)); - - currband = - read_phy_reg(pi, 0x09) & NPHY_BandControl_currentBand; - if (currband == 0) { - if (NREV_GE(pi->pubpi.phy_rev, 6)) { - if (pi->pubpi.radiorev == 11) { - lna1_gain_db = lna1G_gain_db_rev6_224B0; - lna2_gain_db = lna2G_gain_db_rev6_224B0; - rfseq_init_gain = - rfseqG_init_gain_rev6_224B0; - init_gaincode = - initG_gaincode_rev6_224B0; - clip1hi_gaincode = - clip1hiG_gaincode_rev6; - clip1lo_gaincode = - clip1loG_gaincode_rev6_224B0; - nbclip_th = nbclipG_th_rev6; - w1clip_th = w1clipG_th_rev6; - crsmin_th = crsminG_th_rev6; - crsminl_th = crsminlG_th_rev6; - crsminu_th = crsminuG_th_rev6; - rssi_gain = rssiG_gain_rev6_224B0; - } else { - lna1_gain_db = lna1G_gain_db_rev6; - lna2_gain_db = lna2G_gain_db_rev6; - if (pi->sh->boardflags & BFL_EXTLNA) { - - rfseq_init_gain = - rfseqG_init_gain_rev6_elna; - init_gaincode = - initG_gaincode_rev6_elna; - } else { - rfseq_init_gain = - rfseqG_init_gain_rev6; - init_gaincode = - initG_gaincode_rev6; - } - clip1hi_gaincode = - clip1hiG_gaincode_rev6; - switch (triso) { - case 0: - clip1lo_gaincode = - clip1loG_gaincode_rev6 - [0]; - break; - case 1: - clip1lo_gaincode = - clip1loG_gaincode_rev6 - [1]; - break; - case 2: - clip1lo_gaincode = - clip1loG_gaincode_rev6 - [2]; - break; - case 3: - default: - - clip1lo_gaincode = - clip1loG_gaincode_rev6 - [3]; - break; - case 4: - clip1lo_gaincode = - clip1loG_gaincode_rev6 - [4]; - break; - case 5: - clip1lo_gaincode = - clip1loG_gaincode_rev6 - [5]; - break; - case 6: - clip1lo_gaincode = - clip1loG_gaincode_rev6 - [6]; - break; - case 7: - clip1lo_gaincode = - clip1loG_gaincode_rev6 - [7]; - break; - } - nbclip_th = nbclipG_th_rev6; - w1clip_th = w1clipG_th_rev6; - crsmin_th = crsminG_th_rev6; - crsminl_th = crsminlG_th_rev6; - crsminu_th = crsminuG_th_rev6; - rssi_gain = rssi_gain_default; - } - } else if (NREV_IS(pi->pubpi.phy_rev, 5)) { - lna1_gain_db = lna1G_gain_db_rev5; - lna2_gain_db = lna2G_gain_db_rev5; - if (pi->sh->boardflags & BFL_EXTLNA) { - - rfseq_init_gain = - rfseqG_init_gain_rev5_elna; - init_gaincode = - initG_gaincode_rev5_elna; - } else { - rfseq_init_gain = rfseqG_init_gain_rev5; - init_gaincode = initG_gaincode_rev5; - } - clip1hi_gaincode = clip1hiG_gaincode_rev5; - switch (triso) { - case 0: - clip1lo_gaincode = - clip1loG_gaincode_rev5[0]; - break; - case 1: - clip1lo_gaincode = - clip1loG_gaincode_rev5[1]; - break; - case 2: - clip1lo_gaincode = - clip1loG_gaincode_rev5[2]; - break; - case 3: - - clip1lo_gaincode = - clip1loG_gaincode_rev5[3]; - break; - case 4: - clip1lo_gaincode = - clip1loG_gaincode_rev5[4]; - break; - case 5: - clip1lo_gaincode = - clip1loG_gaincode_rev5[5]; - break; - case 6: - clip1lo_gaincode = - clip1loG_gaincode_rev5[6]; - break; - case 7: - clip1lo_gaincode = - clip1loG_gaincode_rev5[7]; - break; - default: - clip1lo_gaincode = - clip1loG_gaincode_rev5[3]; - break; - } - nbclip_th = nbclipG_th_rev5; - w1clip_th = w1clipG_th_rev5; - crsmin_th = crsminG_th_rev5; - crsminl_th = crsminlG_th_rev5; - crsminu_th = crsminuG_th_rev5; - rssi_gain = rssi_gain_default; - } else if (NREV_IS(pi->pubpi.phy_rev, 4)) { - lna1_gain_db = lna1G_gain_db_rev4; - lna2_gain_db = lna2G_gain_db; - rfseq_init_gain = rfseqG_init_gain_rev4; - init_gaincode = initG_gaincode_rev4; - clip1hi_gaincode = clip1hiG_gaincode_rev4; - clip1lo_gaincode = clip1loG_gaincode; - nbclip_th = nbclipG_th_rev4; - w1clip_th = w1clipG_th; - crsmin_th = crsminG_th; - crsminl_th = crsminlG_th; - crsminu_th = crsminuG_th; - rssi_gain = rssi_gain_default; - } else { - lna1_gain_db = lna1G_gain_db; - lna2_gain_db = lna2G_gain_db; - rfseq_init_gain = rfseqG_init_gain; - init_gaincode = initG_gaincode; - clip1hi_gaincode = clip1hiG_gaincode; - clip1lo_gaincode = clip1loG_gaincode; - nbclip_th = nbclipG_th; - w1clip_th = w1clipG_th; - crsmin_th = crsminG_th; - crsminl_th = crsminlG_th; - crsminu_th = crsminuG_th; - rssi_gain = rssi_gain_default; - } - tia_gain_db = tiaG_gain_db; - tia_gainbits = tiaG_gainbits; - clip1md_gaincode = clip1mdG_gaincode; - } else { - if (NREV_GE(pi->pubpi.phy_rev, 6)) { - lna1_gain_db = lna1A_gain_db_rev6; - lna2_gain_db = lna2A_gain_db_rev6; - tia_gain_db = tiaA_gain_db_rev6; - tia_gainbits = tiaA_gainbits_rev6; - rfseq_init_gain = rfseqA_init_gain_rev6; - init_gaincode = initA_gaincode_rev6; - clip1hi_gaincode = clip1hiA_gaincode_rev6; - clip1md_gaincode = clip1mdA_gaincode_rev6; - clip1lo_gaincode = clip1loA_gaincode_rev6; - crsmin_th = crsminA_th_rev6; - crsminl_th = crsminlA_th_rev6; - if ((pi->pubpi.radiorev == 11) && - (CHSPEC_IS40(pi->radio_chanspec) == 0)) - crsminu_th = crsminuA_th_rev6_224B0; - else - crsminu_th = crsminuA_th_rev6; - - nbclip_th = nbclipA_th_rev6; - rssi_gain = rssiA_gain_rev6; - } else if (NREV_IS(pi->pubpi.phy_rev, 5)) { - lna1_gain_db = lna1A_gain_db_rev5; - lna2_gain_db = lna2A_gain_db_rev5; - tia_gain_db = tiaA_gain_db_rev5; - tia_gainbits = tiaA_gainbits_rev5; - rfseq_init_gain = rfseqA_init_gain_rev5; - init_gaincode = initA_gaincode_rev5; - clip1hi_gaincode = clip1hiA_gaincode_rev5; - clip1md_gaincode = clip1mdA_gaincode_rev5; - clip1lo_gaincode = clip1loA_gaincode_rev5; - crsmin_th = crsminA_th_rev5; - crsminl_th = crsminlA_th_rev5; - crsminu_th = crsminuA_th_rev5; - nbclip_th = nbclipA_th_rev5; - rssi_gain = rssiA_gain_rev5; - } else if (NREV_IS(pi->pubpi.phy_rev, 4)) { - lna1_gain_db = lna1A_gain_db_rev4; - lna2_gain_db = lna2A_gain_db_rev4; - tia_gain_db = tiaA_gain_db_rev4; - tia_gainbits = tiaA_gainbits_rev4; - if (pi->sh->boardflags & BFL_EXTLNA_5GHz) { - - rfseq_init_gain = - rfseqA_init_gain_rev4_elna; - init_gaincode = - initA_gaincode_rev4_elna; - } else { - rfseq_init_gain = rfseqA_init_gain_rev4; - init_gaincode = initA_gaincode_rev4; - } - clip1hi_gaincode = clip1hiA_gaincode_rev4; - clip1md_gaincode = clip1mdA_gaincode_rev4; - clip1lo_gaincode = clip1loA_gaincode_rev4; - crsmin_th = crsminA_th_rev4; - crsminl_th = crsminlA_th_rev4; - crsminu_th = crsminuA_th_rev4; - nbclip_th = nbclipA_th_rev4; - rssi_gain = rssi_gain_default; - } else { - lna1_gain_db = lna1A_gain_db; - lna2_gain_db = lna2A_gain_db; - tia_gain_db = tiaA_gain_db; - tia_gainbits = tiaA_gainbits; - rfseq_init_gain = rfseqA_init_gain; - init_gaincode = initA_gaincode; - clip1hi_gaincode = clip1hiA_gaincode; - clip1md_gaincode = clip1mdA_gaincode; - clip1lo_gaincode = clip1loA_gaincode; - crsmin_th = crsminA_th; - crsminl_th = crsminlA_th; - crsminu_th = crsminuA_th; - nbclip_th = nbclipA_th; - rssi_gain = rssi_gain_default; - } - w1clip_th = w1clipA_th; - } - - write_radio_reg(pi, - (RADIO_2056_RX_BIASPOLE_LNAG1_IDAC | - RADIO_2056_RX0), 0x17); - write_radio_reg(pi, - (RADIO_2056_RX_BIASPOLE_LNAG1_IDAC | - RADIO_2056_RX1), 0x17); - - write_radio_reg(pi, (RADIO_2056_RX_LNAG2_IDAC | RADIO_2056_RX0), - 0xf0); - write_radio_reg(pi, (RADIO_2056_RX_LNAG2_IDAC | RADIO_2056_RX1), - 0xf0); - - write_radio_reg(pi, (RADIO_2056_RX_RSSI_POLE | RADIO_2056_RX0), - 0x0); - write_radio_reg(pi, (RADIO_2056_RX_RSSI_POLE | RADIO_2056_RX1), - 0x0); - - write_radio_reg(pi, (RADIO_2056_RX_RSSI_GAIN | RADIO_2056_RX0), - rssi_gain); - write_radio_reg(pi, (RADIO_2056_RX_RSSI_GAIN | RADIO_2056_RX1), - rssi_gain); - - write_radio_reg(pi, - (RADIO_2056_RX_BIASPOLE_LNAA1_IDAC | - RADIO_2056_RX0), 0x17); - write_radio_reg(pi, - (RADIO_2056_RX_BIASPOLE_LNAA1_IDAC | - RADIO_2056_RX1), 0x17); - - write_radio_reg(pi, (RADIO_2056_RX_LNAA2_IDAC | RADIO_2056_RX0), - 0xFF); - write_radio_reg(pi, (RADIO_2056_RX_LNAA2_IDAC | RADIO_2056_RX1), - 0xFF); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 4, 8, - 8, lna1_gain_db); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 4, 8, - 8, lna1_gain_db); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 4, 0x10, - 8, lna2_gain_db); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 4, 0x10, - 8, lna2_gain_db); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 10, 0x20, - 8, tia_gain_db); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 10, 0x20, - 8, tia_gain_db); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS1, 10, 0x20, - 8, tia_gainbits); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS2, 10, 0x20, - 8, tia_gainbits); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN1, 6, 0x40, - 8, &lpf_gain_db); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAIN2, 6, 0x40, - 8, &lpf_gain_db); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS1, 6, 0x40, - 8, &lpf_gainbits); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_GAINBITS2, 6, 0x40, - 8, &lpf_gainbits); - - write_phy_reg(pi, 0x20, init_gaincode); - write_phy_reg(pi, 0x2a7, init_gaincode); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, - pi->pubpi.phy_corenum, 0x106, 16, - rfseq_init_gain); - - write_phy_reg(pi, 0x22, clip1hi_gaincode); - write_phy_reg(pi, 0x2a9, clip1hi_gaincode); - - write_phy_reg(pi, 0x24, clip1md_gaincode); - write_phy_reg(pi, 0x2ab, clip1md_gaincode); - - write_phy_reg(pi, 0x37, clip1lo_gaincode); - write_phy_reg(pi, 0x2ad, clip1lo_gaincode); - - mod_phy_reg(pi, 0x27d, (0xff << 0), (crsmin_th << 0)); - mod_phy_reg(pi, 0x280, (0xff << 0), (crsminl_th << 0)); - mod_phy_reg(pi, 0x283, (0xff << 0), (crsminu_th << 0)); - - write_phy_reg(pi, 0x2b, nbclip_th); - write_phy_reg(pi, 0x41, nbclip_th); - - mod_phy_reg(pi, 0x27, (0x3f << 0), (w1clip_th << 0)); - mod_phy_reg(pi, 0x3d, (0x3f << 0), (w1clip_th << 0)); - - write_phy_reg(pi, 0x150, 0x809c); - - } else { - - mod_phy_reg(pi, 0x1c, (0x1 << 13), (1 << 13)); - mod_phy_reg(pi, 0x32, (0x1 << 13), (1 << 13)); - - write_phy_reg(pi, 0x2b, 0x84); - write_phy_reg(pi, 0x41, 0x84); - - if (CHSPEC_IS20(pi->radio_chanspec)) { - write_phy_reg(pi, 0x6b, 0x2b); - write_phy_reg(pi, 0x6c, 0x2b); - write_phy_reg(pi, 0x6d, 0x9); - write_phy_reg(pi, 0x6e, 0x9); - } - - w1th = NPHY_RSSICAL_W1_TARGET - 4; - mod_phy_reg(pi, 0x27, (0x3f << 0), (w1th << 0)); - mod_phy_reg(pi, 0x3d, (0x3f << 0), (w1th << 0)); - - if (CHSPEC_IS20(pi->radio_chanspec)) { - mod_phy_reg(pi, 0x1c, (0x1f << 0), (0x1 << 0)); - mod_phy_reg(pi, 0x32, (0x1f << 0), (0x1 << 0)); - - mod_phy_reg(pi, 0x1d, (0x1f << 0), (0x1 << 0)); - mod_phy_reg(pi, 0x33, (0x1f << 0), (0x1 << 0)); - } - - write_phy_reg(pi, 0x150, 0x809c); - - if (pi->nphy_gain_boost) - if ((CHSPEC_IS2G(pi->radio_chanspec)) && - (CHSPEC_IS40(pi->radio_chanspec))) - hpf_code = 4; - else - hpf_code = 5; - else if (CHSPEC_IS40(pi->radio_chanspec)) - hpf_code = 6; - else - hpf_code = 7; - - mod_phy_reg(pi, 0x20, (0x1f << 7), (hpf_code << 7)); - mod_phy_reg(pi, 0x36, (0x1f << 7), (hpf_code << 7)); - - for (ctr = 0; ctr < 4; ctr++) - regval[ctr] = (hpf_code << 8) | 0x7c; - wlc_phy_table_write_nphy(pi, 7, 4, 0x106, 16, regval); - - wlc_phy_adjust_lnagaintbl_nphy(pi); - - if (pi->nphy_elna_gain_config) { - regval[0] = 0; - regval[1] = 1; - regval[2] = 1; - regval[3] = 1; - wlc_phy_table_write_nphy(pi, 2, 4, 8, 16, regval); - wlc_phy_table_write_nphy(pi, 3, 4, 8, 16, regval); - - for (ctr = 0; ctr < 4; ctr++) - regval[ctr] = (hpf_code << 8) | 0x74; - wlc_phy_table_write_nphy(pi, 7, 4, 0x106, 16, regval); - } - - if (NREV_IS(pi->pubpi.phy_rev, 2)) { - for (ctr = 0; ctr < 21; ctr++) - regval[ctr] = 3 * ctr; - wlc_phy_table_write_nphy(pi, 0, 21, 32, 16, regval); - wlc_phy_table_write_nphy(pi, 1, 21, 32, 16, regval); - - for (ctr = 0; ctr < 21; ctr++) - regval[ctr] = (u16) ctr; - wlc_phy_table_write_nphy(pi, 2, 21, 32, 16, regval); - wlc_phy_table_write_nphy(pi, 3, 21, 32, 16, regval); - } - - wlc_phy_set_rfseq_nphy(pi, NPHY_RFSEQ_UPDATEGAINU, - rfseq_updategainu_events, - rfseq_updategainu_dlys, - sizeof(rfseq_updategainu_events) / - sizeof(rfseq_updategainu_events[0])); - - mod_phy_reg(pi, 0x153, (0xff << 8), (90 << 8)); - - if (CHSPEC_IS2G(pi->radio_chanspec)) - mod_phy_reg(pi, - (NPHY_TO_BPHY_OFF + BPHY_OPTIONAL_MODES), - 0x7f, 0x4); - } -} - -static void wlc_phy_workarounds_nphy(struct brcms_phy *pi) -{ - u8 rfseq_rx2tx_events[] = { - NPHY_RFSEQ_CMD_NOP, - NPHY_RFSEQ_CMD_RXG_FBW, - NPHY_RFSEQ_CMD_TR_SWITCH, - NPHY_RFSEQ_CMD_CLR_HIQ_DIS, - NPHY_RFSEQ_CMD_RXPD_TXPD, - NPHY_RFSEQ_CMD_TX_GAIN, - NPHY_RFSEQ_CMD_EXT_PA - }; - u8 rfseq_rx2tx_dlys[] = { 8, 6, 6, 2, 4, 60, 1 }; - u8 rfseq_tx2rx_events[] = { - NPHY_RFSEQ_CMD_NOP, - NPHY_RFSEQ_CMD_EXT_PA, - NPHY_RFSEQ_CMD_TX_GAIN, - NPHY_RFSEQ_CMD_RXPD_TXPD, - NPHY_RFSEQ_CMD_TR_SWITCH, - NPHY_RFSEQ_CMD_RXG_FBW, - NPHY_RFSEQ_CMD_CLR_HIQ_DIS - }; - u8 rfseq_tx2rx_dlys[] = { 8, 6, 2, 4, 4, 6, 1 }; - u8 rfseq_tx2rx_events_rev3[] = { - NPHY_REV3_RFSEQ_CMD_EXT_PA, - NPHY_REV3_RFSEQ_CMD_INT_PA_PU, - NPHY_REV3_RFSEQ_CMD_TX_GAIN, - NPHY_REV3_RFSEQ_CMD_RXPD_TXPD, - NPHY_REV3_RFSEQ_CMD_TR_SWITCH, - NPHY_REV3_RFSEQ_CMD_RXG_FBW, - NPHY_REV3_RFSEQ_CMD_CLR_HIQ_DIS, - NPHY_REV3_RFSEQ_CMD_END - }; - u8 rfseq_tx2rx_dlys_rev3[] = { 8, 4, 2, 2, 4, 4, 6, 1 }; - u8 rfseq_rx2tx_events_rev3[] = { - NPHY_REV3_RFSEQ_CMD_NOP, - NPHY_REV3_RFSEQ_CMD_RXG_FBW, - NPHY_REV3_RFSEQ_CMD_TR_SWITCH, - NPHY_REV3_RFSEQ_CMD_CLR_HIQ_DIS, - NPHY_REV3_RFSEQ_CMD_RXPD_TXPD, - NPHY_REV3_RFSEQ_CMD_TX_GAIN, - NPHY_REV3_RFSEQ_CMD_INT_PA_PU, - NPHY_REV3_RFSEQ_CMD_EXT_PA, - NPHY_REV3_RFSEQ_CMD_END - }; - u8 rfseq_rx2tx_dlys_rev3[] = { 8, 6, 6, 4, 4, 18, 42, 1, 1 }; - - u8 rfseq_rx2tx_events_rev3_ipa[] = { - NPHY_REV3_RFSEQ_CMD_NOP, - NPHY_REV3_RFSEQ_CMD_RXG_FBW, - NPHY_REV3_RFSEQ_CMD_TR_SWITCH, - NPHY_REV3_RFSEQ_CMD_CLR_HIQ_DIS, - NPHY_REV3_RFSEQ_CMD_RXPD_TXPD, - NPHY_REV3_RFSEQ_CMD_TX_GAIN, - NPHY_REV3_RFSEQ_CMD_CLR_RXRX_BIAS, - NPHY_REV3_RFSEQ_CMD_INT_PA_PU, - NPHY_REV3_RFSEQ_CMD_END - }; - u8 rfseq_rx2tx_dlys_rev3_ipa[] = { 8, 6, 6, 4, 4, 16, 43, 1, 1 }; - u16 rfseq_rx2tx_dacbufpu_rev7[] = { 0x10f, 0x10f }; - - s16 alpha0, alpha1, alpha2; - s16 beta0, beta1, beta2; - u32 leg_data_weights, ht_data_weights, nss1_data_weights, - stbc_data_weights; - u8 chan_freq_range = 0; - u16 dac_control = 0x0002; - u16 aux_adc_vmid_rev7_core0[] = { 0x8e, 0x96, 0x96, 0x96 }; - u16 aux_adc_vmid_rev7_core1[] = { 0x8f, 0x9f, 0x9f, 0x96 }; - u16 aux_adc_vmid_rev4[] = { 0xa2, 0xb4, 0xb4, 0x89 }; - u16 aux_adc_vmid_rev3[] = { 0xa2, 0xb4, 0xb4, 0x89 }; - u16 *aux_adc_vmid; - u16 aux_adc_gain_rev7[] = { 0x02, 0x02, 0x02, 0x02 }; - u16 aux_adc_gain_rev4[] = { 0x02, 0x02, 0x02, 0x00 }; - u16 aux_adc_gain_rev3[] = { 0x02, 0x02, 0x02, 0x00 }; - u16 *aux_adc_gain; - u16 sk_adc_vmid[] = { 0xb4, 0xb4, 0xb4, 0x24 }; - u16 sk_adc_gain[] = { 0x02, 0x02, 0x02, 0x02 }; - s32 min_nvar_val = 0x18d; - s32 min_nvar_offset_6mbps = 20; - u8 pdetrange; - u8 triso; - u16 regval; - u16 afectrl_adc_ctrl1_rev7 = 0x20; - u16 afectrl_adc_ctrl2_rev7 = 0x0; - u16 rfseq_rx2tx_lpf_h_hpc_rev7 = 0x77; - u16 rfseq_tx2rx_lpf_h_hpc_rev7 = 0x77; - u16 rfseq_pktgn_lpf_h_hpc_rev7 = 0x77; - u16 rfseq_htpktgn_lpf_hpc_rev7[] = { 0x77, 0x11, 0x11 }; - u16 rfseq_pktgn_lpf_hpc_rev7[] = { 0x11, 0x11 }; - u16 rfseq_cckpktgn_lpf_hpc_rev7[] = { 0x11, 0x11 }; - u16 ipalvlshift_3p3_war_en = 0; - u16 rccal_bcap_val, rccal_scap_val; - u16 rccal_tx20_11b_bcap = 0; - u16 rccal_tx20_11b_scap = 0; - u16 rccal_tx20_11n_bcap = 0; - u16 rccal_tx20_11n_scap = 0; - u16 rccal_tx40_11n_bcap = 0; - u16 rccal_tx40_11n_scap = 0; - u16 rx2tx_lpf_rc_lut_tx20_11b = 0; - u16 rx2tx_lpf_rc_lut_tx20_11n = 0; - u16 rx2tx_lpf_rc_lut_tx40_11n = 0; - u16 tx_lpf_bw_ofdm_20mhz = 0; - u16 tx_lpf_bw_ofdm_40mhz = 0; - u16 tx_lpf_bw_11b = 0; - u16 ipa2g_mainbias, ipa2g_casconv, ipa2g_biasfilt; - u16 txgm_idac_bleed = 0; - bool rccal_ovrd = false; - u16 freq; - int coreNum; - - if (CHSPEC_IS5G(pi->radio_chanspec)) - wlc_phy_classifier_nphy(pi, NPHY_ClassifierCtrl_cck_en, 0); - else - wlc_phy_classifier_nphy(pi, NPHY_ClassifierCtrl_cck_en, 1); - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - or_phy_reg(pi, 0xb1, NPHY_IQFlip_ADC1 | NPHY_IQFlip_ADC2); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - if (NREV_IS(pi->pubpi.phy_rev, 7)) { - mod_phy_reg(pi, 0x221, (0x1 << 4), (1 << 4)); - - mod_phy_reg(pi, 0x160, (0x7f << 0), (32 << 0)); - mod_phy_reg(pi, 0x160, (0x7f << 8), (39 << 8)); - mod_phy_reg(pi, 0x161, (0x7f << 0), (46 << 0)); - mod_phy_reg(pi, 0x161, (0x7f << 8), (51 << 8)); - mod_phy_reg(pi, 0x162, (0x7f << 0), (55 << 0)); - mod_phy_reg(pi, 0x162, (0x7f << 8), (58 << 8)); - mod_phy_reg(pi, 0x163, (0x7f << 0), (60 << 0)); - mod_phy_reg(pi, 0x163, (0x7f << 8), (62 << 8)); - mod_phy_reg(pi, 0x164, (0x7f << 0), (62 << 0)); - mod_phy_reg(pi, 0x164, (0x7f << 8), (63 << 8)); - mod_phy_reg(pi, 0x165, (0x7f << 0), (63 << 0)); - mod_phy_reg(pi, 0x165, (0x7f << 8), (64 << 8)); - mod_phy_reg(pi, 0x166, (0x7f << 0), (64 << 0)); - mod_phy_reg(pi, 0x166, (0x7f << 8), (64 << 8)); - mod_phy_reg(pi, 0x167, (0x7f << 0), (64 << 0)); - mod_phy_reg(pi, 0x167, (0x7f << 8), (64 << 8)); - } - - if (NREV_LE(pi->pubpi.phy_rev, 8)) { - write_phy_reg(pi, 0x23f, 0x1b0); - write_phy_reg(pi, 0x240, 0x1b0); - } - - if (NREV_GE(pi->pubpi.phy_rev, 8)) - mod_phy_reg(pi, 0xbd, (0xff << 0), (114 << 0)); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x00, 16, - &dac_control); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x10, 16, - &dac_control); - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL, - 1, 0, 32, &leg_data_weights); - leg_data_weights = leg_data_weights & 0xffffff; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL, - 1, 0, 32, &leg_data_weights); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, - 2, 0x15e, 16, - rfseq_rx2tx_dacbufpu_rev7); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x16e, 16, - rfseq_rx2tx_dacbufpu_rev7); - - if (PHY_IPA(pi)) - wlc_phy_set_rfseq_nphy(pi, NPHY_RFSEQ_RX2TX, - rfseq_rx2tx_events_rev3_ipa, - rfseq_rx2tx_dlys_rev3_ipa, - ARRAY_SIZE(rfseq_rx2tx_events_rev3_ipa)); - - mod_phy_reg(pi, 0x299, (0x3 << 14), (0x1 << 14)); - mod_phy_reg(pi, 0x29d, (0x3 << 14), (0x1 << 14)); - - tx_lpf_bw_ofdm_20mhz = wlc_phy_read_lpf_bw_ctl_nphy(pi, 0x154); - tx_lpf_bw_ofdm_40mhz = wlc_phy_read_lpf_bw_ctl_nphy(pi, 0x159); - tx_lpf_bw_11b = wlc_phy_read_lpf_bw_ctl_nphy(pi, 0x152); - - if (PHY_IPA(pi)) { - - if (((pi->pubpi.radiorev == 5) - && (CHSPEC_IS40(pi->radio_chanspec) == 1)) - || (pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == 8)) { - - rccal_bcap_val = - read_radio_reg( - pi, - RADIO_2057_RCCAL_BCAP_VAL); - rccal_scap_val = - read_radio_reg( - pi, - RADIO_2057_RCCAL_SCAP_VAL); - - rccal_tx20_11b_bcap = rccal_bcap_val; - rccal_tx20_11b_scap = rccal_scap_val; - - if ((pi->pubpi.radiorev == 5) && - (CHSPEC_IS40(pi->radio_chanspec) == 1)) { - - rccal_tx20_11n_bcap = rccal_bcap_val; - rccal_tx20_11n_scap = rccal_scap_val; - rccal_tx40_11n_bcap = 0xc; - rccal_tx40_11n_scap = 0xc; - - rccal_ovrd = true; - - } else if ((pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == 8)) { - - tx_lpf_bw_ofdm_20mhz = 4; - tx_lpf_bw_11b = 1; - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - rccal_tx20_11n_bcap = 0xc; - rccal_tx20_11n_scap = 0xc; - rccal_tx40_11n_bcap = 0xa; - rccal_tx40_11n_scap = 0xa; - } else { - rccal_tx20_11n_bcap = 0x14; - rccal_tx20_11n_scap = 0x14; - rccal_tx40_11n_bcap = 0xf; - rccal_tx40_11n_scap = 0xf; - } - - rccal_ovrd = true; - } - } - - } else { - - if (pi->pubpi.radiorev == 5) { - - tx_lpf_bw_ofdm_20mhz = 1; - tx_lpf_bw_ofdm_40mhz = 3; - - rccal_bcap_val = - read_radio_reg( - pi, - RADIO_2057_RCCAL_BCAP_VAL); - rccal_scap_val = - read_radio_reg( - pi, - RADIO_2057_RCCAL_SCAP_VAL); - - rccal_tx20_11b_bcap = rccal_bcap_val; - rccal_tx20_11b_scap = rccal_scap_val; - - rccal_tx20_11n_bcap = 0x13; - rccal_tx20_11n_scap = 0x11; - rccal_tx40_11n_bcap = 0x13; - rccal_tx40_11n_scap = 0x11; - - rccal_ovrd = true; - } - } - - if (rccal_ovrd) { - - rx2tx_lpf_rc_lut_tx20_11b = - (rccal_tx20_11b_bcap << 8) | - (rccal_tx20_11b_scap << 3) | - tx_lpf_bw_11b; - rx2tx_lpf_rc_lut_tx20_11n = - (rccal_tx20_11n_bcap << 8) | - (rccal_tx20_11n_scap << 3) | - tx_lpf_bw_ofdm_20mhz; - rx2tx_lpf_rc_lut_tx40_11n = - (rccal_tx40_11n_bcap << 8) | - (rccal_tx40_11n_scap << 3) | - tx_lpf_bw_ofdm_40mhz; - - for (coreNum = 0; coreNum <= 1; coreNum++) { - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_RFSEQ, - 1, - 0x152 + coreNum * 0x10, - 16, - &rx2tx_lpf_rc_lut_tx20_11b); - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_RFSEQ, - 1, - 0x153 + coreNum * 0x10, - 16, - &rx2tx_lpf_rc_lut_tx20_11n); - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_RFSEQ, - 1, - 0x154 + coreNum * 0x10, - 16, - &rx2tx_lpf_rc_lut_tx20_11n); - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_RFSEQ, - 1, - 0x155 + coreNum * 0x10, - 16, - &rx2tx_lpf_rc_lut_tx40_11n); - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_RFSEQ, - 1, - 0x156 + coreNum * 0x10, - 16, - &rx2tx_lpf_rc_lut_tx40_11n); - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_RFSEQ, - 1, - 0x157 + coreNum * 0x10, - 16, - &rx2tx_lpf_rc_lut_tx40_11n); - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_RFSEQ, - 1, - 0x158 + coreNum * 0x10, - 16, - &rx2tx_lpf_rc_lut_tx40_11n); - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_RFSEQ, - 1, - 0x159 + coreNum * 0x10, - 16, - &rx2tx_lpf_rc_lut_tx40_11n); - } - - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 4), - 1, 0x3, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID2); - } - - write_phy_reg(pi, 0x32f, 0x3); - - if ((pi->pubpi.radiorev == 4) || (pi->pubpi.radiorev == 6)) - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 2), - 1, 0x3, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - - if ((pi->pubpi.radiorev == 3) || (pi->pubpi.radiorev == 4) || - (pi->pubpi.radiorev == 6)) { - if ((pi->sh->sromrev >= 8) - && (pi->sh->boardflags2 & BFL2_IPALVLSHIFT_3P3)) - ipalvlshift_3p3_war_en = 1; - - if (ipalvlshift_3p3_war_en) { - write_radio_reg(pi, RADIO_2057_GPAIO_CONFIG, - 0x5); - write_radio_reg(pi, RADIO_2057_GPAIO_SEL1, - 0x30); - write_radio_reg(pi, RADIO_2057_GPAIO_SEL0, 0x0); - or_radio_reg(pi, - RADIO_2057_RXTXBIAS_CONFIG_CORE0, - 0x1); - or_radio_reg(pi, - RADIO_2057_RXTXBIAS_CONFIG_CORE1, - 0x1); - - ipa2g_mainbias = 0x1f; - - ipa2g_casconv = 0x6f; - - ipa2g_biasfilt = 0xaa; - } else { - - ipa2g_mainbias = 0x2b; - - ipa2g_casconv = 0x7f; - - ipa2g_biasfilt = 0xee; - } - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - for (coreNum = 0; coreNum <= 1; coreNum++) { - WRITE_RADIO_REG4(pi, RADIO_2057, CORE, - coreNum, IPA2G_IMAIN, - ipa2g_mainbias); - WRITE_RADIO_REG4(pi, RADIO_2057, CORE, - coreNum, IPA2G_CASCONV, - ipa2g_casconv); - WRITE_RADIO_REG4(pi, RADIO_2057, CORE, - coreNum, - IPA2G_BIAS_FILTER, - ipa2g_biasfilt); - } - } - } - - if (PHY_IPA(pi)) { - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if ((pi->pubpi.radiorev == 3) - || (pi->pubpi.radiorev == 4) - || (pi->pubpi.radiorev == 6)) - txgm_idac_bleed = 0x7f; - - for (coreNum = 0; coreNum <= 1; coreNum++) { - if (txgm_idac_bleed != 0) - WRITE_RADIO_REG4( - pi, RADIO_2057, - CORE, coreNum, - TXGM_IDAC_BLEED, - txgm_idac_bleed); - } - - if (pi->pubpi.radiorev == 5) { - - for (coreNum = 0; coreNum <= 1; - coreNum++) { - WRITE_RADIO_REG4(pi, RADIO_2057, - CORE, coreNum, - IPA2G_CASCONV, - 0x13); - WRITE_RADIO_REG4(pi, RADIO_2057, - CORE, coreNum, - IPA2G_IMAIN, - 0x1f); - WRITE_RADIO_REG4( - pi, RADIO_2057, - CORE, coreNum, - IPA2G_BIAS_FILTER, - 0xee); - WRITE_RADIO_REG4(pi, RADIO_2057, - CORE, coreNum, - PAD2G_IDACS, - 0x8a); - WRITE_RADIO_REG4( - pi, RADIO_2057, - CORE, coreNum, - PAD_BIAS_FILTER_BWS, - 0x3e); - } - - } else if ((pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == 8)) { - - if (CHSPEC_IS40(pi->radio_chanspec) == - 0) { - WRITE_RADIO_REG4(pi, RADIO_2057, - CORE, 0, - IPA2G_IMAIN, - 0x14); - WRITE_RADIO_REG4(pi, RADIO_2057, - CORE, 1, - IPA2G_IMAIN, - 0x12); - } else { - WRITE_RADIO_REG4(pi, RADIO_2057, - CORE, 0, - IPA2G_IMAIN, - 0x16); - WRITE_RADIO_REG4(pi, RADIO_2057, - CORE, 1, - IPA2G_IMAIN, - 0x16); - } - } - - } else { - freq = CHAN5G_FREQ(CHSPEC_CHANNEL( - pi->radio_chanspec)); - if (((freq >= 5180) && (freq <= 5230)) - || ((freq >= 5745) && (freq <= 5805))) { - WRITE_RADIO_REG4(pi, RADIO_2057, CORE, - 0, IPA5G_BIAS_FILTER, - 0xff); - WRITE_RADIO_REG4(pi, RADIO_2057, CORE, - 1, IPA5G_BIAS_FILTER, - 0xff); - } - } - } else { - - if (pi->pubpi.radiorev != 5) { - for (coreNum = 0; coreNum <= 1; coreNum++) { - WRITE_RADIO_REG4(pi, RADIO_2057, CORE, - coreNum, - TXMIX2G_TUNE_BOOST_PU, - 0x61); - WRITE_RADIO_REG4(pi, RADIO_2057, CORE, - coreNum, - TXGM_IDAC_BLEED, 0x70); - } - } - } - - if (pi->pubpi.radiorev == 4) { - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, - 0x05, 16, - &afectrl_adc_ctrl1_rev7); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, - 0x15, 16, - &afectrl_adc_ctrl1_rev7); - - for (coreNum = 0; coreNum <= 1; coreNum++) { - WRITE_RADIO_REG4(pi, RADIO_2057, CORE, coreNum, - AFE_VCM_CAL_MASTER, 0x0); - WRITE_RADIO_REG4(pi, RADIO_2057, CORE, coreNum, - AFE_SET_VCM_I, 0x3f); - WRITE_RADIO_REG4(pi, RADIO_2057, CORE, coreNum, - AFE_SET_VCM_Q, 0x3f); - } - } else { - mod_phy_reg(pi, 0xa6, (0x1 << 2), (0x1 << 2)); - mod_phy_reg(pi, 0x8f, (0x1 << 2), (0x1 << 2)); - mod_phy_reg(pi, 0xa7, (0x1 << 2), (0x1 << 2)); - mod_phy_reg(pi, 0xa5, (0x1 << 2), (0x1 << 2)); - - mod_phy_reg(pi, 0xa6, (0x1 << 0), 0); - mod_phy_reg(pi, 0x8f, (0x1 << 0), (0x1 << 0)); - mod_phy_reg(pi, 0xa7, (0x1 << 0), 0); - mod_phy_reg(pi, 0xa5, (0x1 << 0), (0x1 << 0)); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, - 0x05, 16, - &afectrl_adc_ctrl2_rev7); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, - 0x15, 16, - &afectrl_adc_ctrl2_rev7); - - mod_phy_reg(pi, 0xa6, (0x1 << 2), 0); - mod_phy_reg(pi, 0x8f, (0x1 << 2), 0); - mod_phy_reg(pi, 0xa7, (0x1 << 2), 0); - mod_phy_reg(pi, 0xa5, (0x1 << 2), 0); - } - - write_phy_reg(pi, 0x6a, 0x2); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, 256, 32, - &min_nvar_offset_6mbps); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x138, 16, - &rfseq_pktgn_lpf_hpc_rev7); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 1, 0x141, 16, - &rfseq_pktgn_lpf_h_hpc_rev7); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 3, 0x133, 16, - &rfseq_htpktgn_lpf_hpc_rev7); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x146, 16, - &rfseq_cckpktgn_lpf_hpc_rev7); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 1, 0x123, 16, - &rfseq_tx2rx_lpf_h_hpc_rev7); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 1, 0x12A, 16, - &rfseq_rx2tx_lpf_h_hpc_rev7); - - if (CHSPEC_IS40(pi->radio_chanspec) == 0) { - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, 3, - 32, &min_nvar_val); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, - 127, 32, &min_nvar_val); - } else { - min_nvar_val = noise_var_tbl_rev7[3]; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, 3, - 32, &min_nvar_val); - - min_nvar_val = noise_var_tbl_rev7[127]; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, - 127, 32, &min_nvar_val); - } - - wlc_phy_workarounds_nphy_gainctrl(pi); - - pdetrange = - (CHSPEC_IS5G(pi->radio_chanspec)) ? pi->srom_fem5g. - pdetrange : pi->srom_fem2g.pdetrange; - - if (pdetrange == 0) { - chan_freq_range = - wlc_phy_get_chan_freq_range_nphy(pi, 0); - if (chan_freq_range != WL_CHAN_FREQ_RANGE_2G) { - aux_adc_vmid_rev7_core0[3] = 0x70; - aux_adc_vmid_rev7_core1[3] = 0x70; - aux_adc_gain_rev7[3] = 2; - } else { - aux_adc_vmid_rev7_core0[3] = 0x80; - aux_adc_vmid_rev7_core1[3] = 0x80; - aux_adc_gain_rev7[3] = 3; - } - } else if (pdetrange == 1) { - if (chan_freq_range != WL_CHAN_FREQ_RANGE_2G) { - aux_adc_vmid_rev7_core0[3] = 0x7c; - aux_adc_vmid_rev7_core1[3] = 0x7c; - aux_adc_gain_rev7[3] = 2; - } else { - aux_adc_vmid_rev7_core0[3] = 0x8c; - aux_adc_vmid_rev7_core1[3] = 0x8c; - aux_adc_gain_rev7[3] = 1; - } - } else if (pdetrange == 2) { - if (pi->pubpi.radioid == BCM2057_ID) { - if ((pi->pubpi.radiorev == 5) - || (pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == 8)) { - if (chan_freq_range == - WL_CHAN_FREQ_RANGE_2G) { - aux_adc_vmid_rev7_core0[3] = - 0x8c; - aux_adc_vmid_rev7_core1[3] = - 0x8c; - aux_adc_gain_rev7[3] = 0; - } else { - aux_adc_vmid_rev7_core0[3] = - 0x96; - aux_adc_vmid_rev7_core1[3] = - 0x96; - aux_adc_gain_rev7[3] = 0; - } - } - } - - } else if (pdetrange == 3) { - if (chan_freq_range == WL_CHAN_FREQ_RANGE_2G) { - aux_adc_vmid_rev7_core0[3] = 0x89; - aux_adc_vmid_rev7_core1[3] = 0x89; - aux_adc_gain_rev7[3] = 0; - } - - } else if (pdetrange == 5) { - - if (chan_freq_range != WL_CHAN_FREQ_RANGE_2G) { - aux_adc_vmid_rev7_core0[3] = 0x80; - aux_adc_vmid_rev7_core1[3] = 0x80; - aux_adc_gain_rev7[3] = 3; - } else { - aux_adc_vmid_rev7_core0[3] = 0x70; - aux_adc_vmid_rev7_core1[3] = 0x70; - aux_adc_gain_rev7[3] = 2; - } - } - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, 0x08, 16, - &aux_adc_vmid_rev7_core0); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, 0x18, 16, - &aux_adc_vmid_rev7_core1); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, 0x0c, 16, - &aux_adc_gain_rev7); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, 0x1c, 16, - &aux_adc_gain_rev7); - - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - - write_phy_reg(pi, 0x23f, 0x1f8); - write_phy_reg(pi, 0x240, 0x1f8); - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL, - 1, 0, 32, &leg_data_weights); - leg_data_weights = leg_data_weights & 0xffffff; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL, - 1, 0, 32, &leg_data_weights); - - alpha0 = 293; - alpha1 = 435; - alpha2 = 261; - beta0 = 366; - beta1 = 205; - beta2 = 32; - write_phy_reg(pi, 0x145, alpha0); - write_phy_reg(pi, 0x146, alpha1); - write_phy_reg(pi, 0x147, alpha2); - write_phy_reg(pi, 0x148, beta0); - write_phy_reg(pi, 0x149, beta1); - write_phy_reg(pi, 0x14a, beta2); - - write_phy_reg(pi, 0x38, 0xC); - write_phy_reg(pi, 0x2ae, 0xC); - - wlc_phy_set_rfseq_nphy(pi, NPHY_RFSEQ_TX2RX, - rfseq_tx2rx_events_rev3, - rfseq_tx2rx_dlys_rev3, - ARRAY_SIZE(rfseq_tx2rx_events_rev3)); - - if (PHY_IPA(pi)) - wlc_phy_set_rfseq_nphy(pi, NPHY_RFSEQ_RX2TX, - rfseq_rx2tx_events_rev3_ipa, - rfseq_rx2tx_dlys_rev3_ipa, - ARRAY_SIZE(rfseq_rx2tx_events_rev3_ipa)); - - if ((pi->sh->hw_phyrxchain != 0x3) && - (pi->sh->hw_phyrxchain != pi->sh->hw_phytxchain)) { - - if (PHY_IPA(pi)) { - rfseq_rx2tx_dlys_rev3[5] = 59; - rfseq_rx2tx_dlys_rev3[6] = 1; - rfseq_rx2tx_events_rev3[7] = - NPHY_REV3_RFSEQ_CMD_END; - } - - wlc_phy_set_rfseq_nphy( - pi, NPHY_RFSEQ_RX2TX, - rfseq_rx2tx_events_rev3, - rfseq_rx2tx_dlys_rev3, - ARRAY_SIZE(rfseq_rx2tx_events_rev3)); - } - - if (CHSPEC_IS2G(pi->radio_chanspec)) - write_phy_reg(pi, 0x6a, 0x2); - else - write_phy_reg(pi, 0x6a, 0x9c40); - - mod_phy_reg(pi, 0x294, (0xf << 8), (7 << 8)); - - if (CHSPEC_IS40(pi->radio_chanspec) == 0) { - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, 3, - 32, &min_nvar_val); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, - 127, 32, &min_nvar_val); - } else { - min_nvar_val = noise_var_tbl_rev3[3]; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, 3, - 32, &min_nvar_val); - - min_nvar_val = noise_var_tbl_rev3[127]; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, - 127, 32, &min_nvar_val); - } - - wlc_phy_workarounds_nphy_gainctrl(pi); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x00, 16, - &dac_control); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x10, 16, - &dac_control); - - pdetrange = - (CHSPEC_IS5G(pi->radio_chanspec)) ? pi->srom_fem5g. - pdetrange : pi->srom_fem2g.pdetrange; - - if (pdetrange == 0) { - if (NREV_GE(pi->pubpi.phy_rev, 4)) { - aux_adc_vmid = aux_adc_vmid_rev4; - aux_adc_gain = aux_adc_gain_rev4; - } else { - aux_adc_vmid = aux_adc_vmid_rev3; - aux_adc_gain = aux_adc_gain_rev3; - } - chan_freq_range = - wlc_phy_get_chan_freq_range_nphy(pi, 0); - if (chan_freq_range != WL_CHAN_FREQ_RANGE_2G) { - switch (chan_freq_range) { - case WL_CHAN_FREQ_RANGE_5GL: - aux_adc_vmid[3] = 0x89; - aux_adc_gain[3] = 0; - break; - case WL_CHAN_FREQ_RANGE_5GM: - aux_adc_vmid[3] = 0x89; - aux_adc_gain[3] = 0; - break; - case WL_CHAN_FREQ_RANGE_5GH: - aux_adc_vmid[3] = 0x89; - aux_adc_gain[3] = 0; - break; - default: - break; - } - } - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x08, 16, aux_adc_vmid); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x18, 16, aux_adc_vmid); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x0c, 16, aux_adc_gain); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x1c, 16, aux_adc_gain); - } else if (pdetrange == 1) { - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x08, 16, sk_adc_vmid); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x18, 16, sk_adc_vmid); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x0c, 16, sk_adc_gain); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x1c, 16, sk_adc_gain); - } else if (pdetrange == 2) { - - u16 bcm_adc_vmid[] = { 0xa2, 0xb4, 0xb4, 0x74 }; - u16 bcm_adc_gain[] = { 0x02, 0x02, 0x02, 0x04 }; - - if (NREV_GE(pi->pubpi.phy_rev, 6)) { - chan_freq_range = - wlc_phy_get_chan_freq_range_nphy(pi, 0); - if (chan_freq_range != WL_CHAN_FREQ_RANGE_2G) { - bcm_adc_vmid[3] = 0x8e; - bcm_adc_gain[3] = 0x03; - } else { - bcm_adc_vmid[3] = 0x94; - bcm_adc_gain[3] = 0x03; - } - } else if (NREV_IS(pi->pubpi.phy_rev, 5)) { - bcm_adc_vmid[3] = 0x84; - bcm_adc_gain[3] = 0x02; - } - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x08, 16, bcm_adc_vmid); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x18, 16, bcm_adc_vmid); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x0c, 16, bcm_adc_gain); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x1c, 16, bcm_adc_gain); - } else if (pdetrange == 3) { - chan_freq_range = - wlc_phy_get_chan_freq_range_nphy(pi, 0); - if ((NREV_GE(pi->pubpi.phy_rev, 4)) - && (chan_freq_range == WL_CHAN_FREQ_RANGE_2G)) { - - u16 auxadc_vmid[] = { - 0xa2, 0xb4, 0xb4, 0x270 - }; - u16 auxadc_gain[] = { - 0x02, 0x02, 0x02, 0x00 - }; - - wlc_phy_table_write_nphy(pi, - NPHY_TBL_ID_AFECTRL, 4, - 0x08, 16, auxadc_vmid); - wlc_phy_table_write_nphy(pi, - NPHY_TBL_ID_AFECTRL, 4, - 0x18, 16, auxadc_vmid); - wlc_phy_table_write_nphy(pi, - NPHY_TBL_ID_AFECTRL, 4, - 0x0c, 16, auxadc_gain); - wlc_phy_table_write_nphy(pi, - NPHY_TBL_ID_AFECTRL, 4, - 0x1c, 16, auxadc_gain); - } - } else if ((pdetrange == 4) || (pdetrange == 5)) { - u16 bcm_adc_vmid[] = { 0xa2, 0xb4, 0xb4, 0x0 }; - u16 bcm_adc_gain[] = { 0x02, 0x02, 0x02, 0x0 }; - u16 Vmid[2], Av[2]; - - chan_freq_range = - wlc_phy_get_chan_freq_range_nphy(pi, 0); - if (chan_freq_range != WL_CHAN_FREQ_RANGE_2G) { - Vmid[0] = (pdetrange == 4) ? 0x8e : 0x89; - Vmid[1] = (pdetrange == 4) ? 0x96 : 0x89; - Av[0] = (pdetrange == 4) ? 2 : 0; - Av[1] = (pdetrange == 4) ? 2 : 0; - } else { - Vmid[0] = (pdetrange == 4) ? 0x89 : 0x74; - Vmid[1] = (pdetrange == 4) ? 0x8b : 0x70; - Av[0] = (pdetrange == 4) ? 2 : 0; - Av[1] = (pdetrange == 4) ? 2 : 0; - } - - bcm_adc_vmid[3] = Vmid[0]; - bcm_adc_gain[3] = Av[0]; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x08, 16, bcm_adc_vmid); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x0c, 16, bcm_adc_gain); - - bcm_adc_vmid[3] = Vmid[1]; - bcm_adc_gain[3] = Av[1]; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x18, 16, bcm_adc_vmid); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 4, - 0x1c, 16, bcm_adc_gain); - } - - write_radio_reg(pi, - (RADIO_2056_RX_MIXA_MAST_BIAS | RADIO_2056_RX0), - 0x0); - write_radio_reg(pi, - (RADIO_2056_RX_MIXA_MAST_BIAS | RADIO_2056_RX1), - 0x0); - - write_radio_reg(pi, - (RADIO_2056_RX_MIXA_BIAS_MAIN | RADIO_2056_RX0), - 0x6); - write_radio_reg(pi, - (RADIO_2056_RX_MIXA_BIAS_MAIN | RADIO_2056_RX1), - 0x6); - - write_radio_reg(pi, - (RADIO_2056_RX_MIXA_BIAS_AUX | RADIO_2056_RX0), - 0x7); - write_radio_reg(pi, - (RADIO_2056_RX_MIXA_BIAS_AUX | RADIO_2056_RX1), - 0x7); - - write_radio_reg(pi, - (RADIO_2056_RX_MIXA_LOB_BIAS | RADIO_2056_RX0), - 0x88); - write_radio_reg(pi, - (RADIO_2056_RX_MIXA_LOB_BIAS | RADIO_2056_RX1), - 0x88); - - write_radio_reg(pi, - (RADIO_2056_RX_MIXA_CMFB_IDAC | RADIO_2056_RX0), - 0x0); - write_radio_reg(pi, - (RADIO_2056_RX_MIXA_CMFB_IDAC | RADIO_2056_RX1), - 0x0); - - write_radio_reg(pi, - (RADIO_2056_RX_MIXG_CMFB_IDAC | RADIO_2056_RX0), - 0x0); - write_radio_reg(pi, - (RADIO_2056_RX_MIXG_CMFB_IDAC | RADIO_2056_RX1), - 0x0); - - triso = - (CHSPEC_IS5G(pi->radio_chanspec)) ? pi->srom_fem5g. - triso : pi->srom_fem2g.triso; - if (triso == 7) { - wlc_phy_war_force_trsw_to_R_cliplo_nphy(pi, PHY_CORE_0); - wlc_phy_war_force_trsw_to_R_cliplo_nphy(pi, PHY_CORE_1); - } - - wlc_phy_war_txchain_upd_nphy(pi, pi->sh->hw_phytxchain); - - if (((pi->sh->boardflags2 & BFL2_APLL_WAR) && - (CHSPEC_IS5G(pi->radio_chanspec))) || - (((pi->sh->boardflags2 & BFL2_GPLL_WAR) || - (pi->sh->boardflags2 & BFL2_GPLL_WAR2)) && - (CHSPEC_IS2G(pi->radio_chanspec)))) { - nss1_data_weights = 0x00088888; - ht_data_weights = 0x00088888; - stbc_data_weights = 0x00088888; - } else { - nss1_data_weights = 0x88888888; - ht_data_weights = 0x88888888; - stbc_data_weights = 0x88888888; - } - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL, - 1, 1, 32, &nss1_data_weights); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL, - 1, 2, 32, &ht_data_weights); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL, - 1, 3, 32, &stbc_data_weights); - - if (NREV_IS(pi->pubpi.phy_rev, 4)) { - if (CHSPEC_IS5G(pi->radio_chanspec)) { - write_radio_reg(pi, - RADIO_2056_TX_GMBB_IDAC | - RADIO_2056_TX0, 0x70); - write_radio_reg(pi, - RADIO_2056_TX_GMBB_IDAC | - RADIO_2056_TX1, 0x70); - } - } - - if (!pi->edcrs_threshold_lock) { - write_phy_reg(pi, 0x224, 0x3eb); - write_phy_reg(pi, 0x225, 0x3eb); - write_phy_reg(pi, 0x226, 0x341); - write_phy_reg(pi, 0x227, 0x341); - write_phy_reg(pi, 0x228, 0x42b); - write_phy_reg(pi, 0x229, 0x42b); - write_phy_reg(pi, 0x22a, 0x381); - write_phy_reg(pi, 0x22b, 0x381); - write_phy_reg(pi, 0x22c, 0x42b); - write_phy_reg(pi, 0x22d, 0x42b); - write_phy_reg(pi, 0x22e, 0x381); - write_phy_reg(pi, 0x22f, 0x381); - } - - if (NREV_GE(pi->pubpi.phy_rev, 6)) { - - if (pi->sh->boardflags2 & BFL2_SINGLEANT_CCK) - wlapi_bmac_mhf(pi->sh->physhim, MHF4, - MHF4_BPHY_TXCORE0, - MHF4_BPHY_TXCORE0, BRCM_BAND_ALL); - } - } else { - - if (pi->sh->boardflags2 & BFL2_SKWRKFEM_BRD || - (pi->sh->boardtype == 0x8b)) { - uint i; - u8 war_dlys[] = { 1, 6, 6, 2, 4, 20, 1 }; - for (i = 0; i < ARRAY_SIZE(rfseq_rx2tx_dlys); i++) - rfseq_rx2tx_dlys[i] = war_dlys[i]; - } - - if (CHSPEC_IS5G(pi->radio_chanspec) && pi->phy_5g_pwrgain) { - and_radio_reg(pi, RADIO_2055_CORE1_TX_RF_SPARE, 0xf7); - and_radio_reg(pi, RADIO_2055_CORE2_TX_RF_SPARE, 0xf7); - } else { - or_radio_reg(pi, RADIO_2055_CORE1_TX_RF_SPARE, 0x8); - or_radio_reg(pi, RADIO_2055_CORE2_TX_RF_SPARE, 0x8); - } - - regval = 0x000a; - wlc_phy_table_write_nphy(pi, 8, 1, 0, 16, ®val); - wlc_phy_table_write_nphy(pi, 8, 1, 0x10, 16, ®val); - - if (NREV_LT(pi->pubpi.phy_rev, 3)) { - regval = 0xcdaa; - wlc_phy_table_write_nphy(pi, 8, 1, 0x02, 16, ®val); - wlc_phy_table_write_nphy(pi, 8, 1, 0x12, 16, ®val); - } - - if (NREV_LT(pi->pubpi.phy_rev, 2)) { - regval = 0x0000; - wlc_phy_table_write_nphy(pi, 8, 1, 0x08, 16, ®val); - wlc_phy_table_write_nphy(pi, 8, 1, 0x18, 16, ®val); - - regval = 0x7aab; - wlc_phy_table_write_nphy(pi, 8, 1, 0x07, 16, ®val); - wlc_phy_table_write_nphy(pi, 8, 1, 0x17, 16, ®val); - - regval = 0x0800; - wlc_phy_table_write_nphy(pi, 8, 1, 0x06, 16, ®val); - wlc_phy_table_write_nphy(pi, 8, 1, 0x16, 16, ®val); - } - - write_phy_reg(pi, 0xf8, 0x02d8); - write_phy_reg(pi, 0xf9, 0x0301); - write_phy_reg(pi, 0xfa, 0x02d8); - write_phy_reg(pi, 0xfb, 0x0301); - - wlc_phy_set_rfseq_nphy(pi, NPHY_RFSEQ_RX2TX, rfseq_rx2tx_events, - rfseq_rx2tx_dlys, - ARRAY_SIZE(rfseq_rx2tx_events)); - - wlc_phy_set_rfseq_nphy(pi, NPHY_RFSEQ_TX2RX, rfseq_tx2rx_events, - rfseq_tx2rx_dlys, - ARRAY_SIZE(rfseq_tx2rx_events)); - - wlc_phy_workarounds_nphy_gainctrl(pi); - - if (NREV_LT(pi->pubpi.phy_rev, 2)) { - - if (read_phy_reg(pi, 0xa0) & NPHY_MLenable) - wlapi_bmac_mhf(pi->sh->physhim, MHF3, - MHF3_NPHY_MLADV_WAR, - MHF3_NPHY_MLADV_WAR, - BRCM_BAND_ALL); - - } else if (NREV_IS(pi->pubpi.phy_rev, 2)) { - write_phy_reg(pi, 0x1e3, 0x0); - write_phy_reg(pi, 0x1e4, 0x0); - } - - if (NREV_LT(pi->pubpi.phy_rev, 2)) - mod_phy_reg(pi, 0x90, (0x1 << 7), 0); - - alpha0 = 293; - alpha1 = 435; - alpha2 = 261; - beta0 = 366; - beta1 = 205; - beta2 = 32; - write_phy_reg(pi, 0x145, alpha0); - write_phy_reg(pi, 0x146, alpha1); - write_phy_reg(pi, 0x147, alpha2); - write_phy_reg(pi, 0x148, beta0); - write_phy_reg(pi, 0x149, beta1); - write_phy_reg(pi, 0x14a, beta2); - - if (NREV_LT(pi->pubpi.phy_rev, 3)) { - mod_phy_reg(pi, 0x142, (0xf << 12), 0); - - write_phy_reg(pi, 0x192, 0xb5); - write_phy_reg(pi, 0x193, 0xa4); - write_phy_reg(pi, 0x194, 0x0); - } - - if (NREV_IS(pi->pubpi.phy_rev, 2)) - mod_phy_reg(pi, 0x221, - NPHY_FORCESIG_DECODEGATEDCLKS, - NPHY_FORCESIG_DECODEGATEDCLKS); - } - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); -} - -static void wlc_phy_extpa_set_tx_digi_filts_nphy(struct brcms_phy *pi) -{ - int j, type = 2; - u16 addr_offset = 0x2c5; - - for (j = 0; j < NPHY_NUM_DIG_FILT_COEFFS; j++) - write_phy_reg(pi, addr_offset + j, - NPHY_IPA_REV4_txdigi_filtcoeffs[type][j]); -} - -static void wlc_phy_clip_det_nphy(struct brcms_phy *pi, u8 write, u16 *vals) -{ - - if (write == 0) { - vals[0] = read_phy_reg(pi, 0x2c); - vals[1] = read_phy_reg(pi, 0x42); - } else { - write_phy_reg(pi, 0x2c, vals[0]); - write_phy_reg(pi, 0x42, vals[1]); - } -} - -static void wlc_phy_ipa_internal_tssi_setup_nphy(struct brcms_phy *pi) -{ - u8 core; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - if (CHSPEC_IS2G(pi->radio_chanspec)) { - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TX_SSI_MASTER, 0x5); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TX_SSI_MUX, 0xe); - - if (pi->pubpi.radiorev != 5) - WRITE_RADIO_REG3(pi, RADIO_2057, TX, - core, TSSIA, 0); - - if (!NREV_IS(pi->pubpi.phy_rev, 7)) - WRITE_RADIO_REG3(pi, RADIO_2057, TX, - core, TSSIG, 0x1); - else - WRITE_RADIO_REG3(pi, RADIO_2057, TX, - core, TSSIG, 0x31); - } else { - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TX_SSI_MASTER, 0x9); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TX_SSI_MUX, 0xc); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TSSIG, 0); - - if (pi->pubpi.radiorev != 5) { - if (!NREV_IS(pi->pubpi.phy_rev, 7)) - WRITE_RADIO_REG3(pi, RADIO_2057, - TX, core, - TSSIA, 0x1); - else - WRITE_RADIO_REG3(pi, RADIO_2057, - TX, core, - TSSIA, 0x31); - } - } - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, IQCAL_VCM_HG, - 0); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, IQCAL_IDAC, - 0); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, TSSI_VCM, - 0x3); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, TSSI_MISC1, - 0x0); - } - } else { - WRITE_RADIO_SYN(pi, RADIO_2056, RESERVED_ADDR31, - (CHSPEC_IS2G(pi->radio_chanspec)) ? 0x128 : - 0x80); - WRITE_RADIO_SYN(pi, RADIO_2056, RESERVED_ADDR30, 0x0); - WRITE_RADIO_SYN(pi, RADIO_2056, GPIO_MASTER1, 0x29); - - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, IQCAL_VCM_HG, - 0x0); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, IQCAL_IDAC, - 0x0); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, TSSI_VCM, - 0x3); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, TX_AMP_DET, - 0x0); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, TSSI_MISC1, - 0x8); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, TSSI_MISC2, - 0x0); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, TSSI_MISC3, - 0x0); - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - TX_SSI_MASTER, 0x5); - - if (pi->pubpi.radiorev != 5) - WRITE_RADIO_REG2(pi, RADIO_2056, TX, - core, TSSIA, 0x0); - if (NREV_GE(pi->pubpi.phy_rev, 5)) - WRITE_RADIO_REG2(pi, RADIO_2056, TX, - core, TSSIG, 0x31); - else - WRITE_RADIO_REG2(pi, RADIO_2056, TX, - core, TSSIG, 0x11); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - TX_SSI_MUX, 0xe); - } else { - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - TX_SSI_MASTER, 0x9); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - TSSIA, 0x31); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - TSSIG, 0x0); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - TX_SSI_MUX, 0xc); - } - } - } -} - -static void -wlc_phy_rfctrl_override_nphy(struct brcms_phy *pi, u16 field, u16 value, - u8 core_mask, u8 off) -{ - u8 core_num; - u16 addr = 0, mask = 0, en_addr = 0, val_addr = 0, en_mask = - 0, val_mask = 0; - u8 shift = 0, val_shift = 0; - - if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LT(pi->pubpi.phy_rev, 7)) { - - en_mask = field; - for (core_num = 0; core_num < 2; core_num++) { - - switch (field) { - case (0x1 << 1): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : 0x7d; - val_mask = (0x1 << 0); - val_shift = 0; - break; - case (0x1 << 2): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : 0x7d; - val_mask = (0x1 << 1); - val_shift = 1; - break; - case (0x1 << 3): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : 0x7d; - val_mask = (0x1 << 2); - val_shift = 2; - break; - case (0x1 << 4): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : 0x7d; - val_mask = (0x1 << 4); - val_shift = 4; - break; - case (0x1 << 5): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : 0x7d; - val_mask = (0x1 << 5); - val_shift = 5; - break; - case (0x1 << 6): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : 0x7d; - val_mask = (0x1 << 6); - val_shift = 6; - break; - case (0x1 << 7): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : 0x7d; - val_mask = (0x1 << 7); - val_shift = 7; - break; - case (0x1 << 8): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : 0x7d; - val_mask = (0x7 << 8); - val_shift = 8; - break; - case (0x1 << 11): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7a : 0x7d; - val_mask = (0x7 << 13); - val_shift = 13; - break; - - case (0x1 << 9): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0xf8 : 0xfa; - val_mask = (0x7 << 0); - val_shift = 0; - break; - - case (0x1 << 10): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0xf8 : 0xfa; - val_mask = (0x7 << 4); - val_shift = 4; - break; - - case (0x1 << 12): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7b : 0x7e; - val_mask = (0xffff << 0); - val_shift = 0; - break; - case (0x1 << 13): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0x7c : 0x7f; - val_mask = (0xffff << 0); - val_shift = 0; - break; - case (0x1 << 14): - en_addr = (core_num == 0) ? 0xe7 : 0xec; - val_addr = (core_num == 0) ? 0xf9 : 0xfb; - val_mask = (0x3 << 6); - val_shift = 6; - break; - case (0x1 << 0): - en_addr = (core_num == 0) ? 0xe5 : 0xe6; - val_addr = (core_num == 0) ? 0xf9 : 0xfb; - val_mask = (0x1 << 15); - val_shift = 15; - break; - default: - addr = 0xffff; - break; - } - - if (off) { - and_phy_reg(pi, en_addr, ~en_mask); - and_phy_reg(pi, val_addr, ~val_mask); - } else { - - if ((core_mask == 0) - || (core_mask & (1 << core_num))) { - or_phy_reg(pi, en_addr, en_mask); - - if (addr != 0xffff) - mod_phy_reg(pi, val_addr, - val_mask, - (value << - val_shift)); - } - } - } - } else { - - if (off) { - and_phy_reg(pi, 0xec, ~field); - value = 0x0; - } else { - or_phy_reg(pi, 0xec, field); - } - - for (core_num = 0; core_num < 2; core_num++) { - - switch (field) { - case (0x1 << 1): - case (0x1 << 9): - case (0x1 << 12): - case (0x1 << 13): - case (0x1 << 14): - addr = 0x78; - - core_mask = 0x1; - break; - case (0x1 << 2): - case (0x1 << 3): - case (0x1 << 4): - case (0x1 << 5): - case (0x1 << 6): - case (0x1 << 7): - case (0x1 << 8): - addr = (core_num == 0) ? 0x7a : 0x7d; - break; - case (0x1 << 10): - addr = (core_num == 0) ? 0x7b : 0x7e; - break; - case (0x1 << 11): - addr = (core_num == 0) ? 0x7c : 0x7f; - break; - default: - addr = 0xffff; - } - - switch (field) { - case (0x1 << 1): - mask = (0x7 << 3); - shift = 3; - break; - case (0x1 << 9): - mask = (0x1 << 2); - shift = 2; - break; - case (0x1 << 12): - mask = (0x1 << 8); - shift = 8; - break; - case (0x1 << 13): - mask = (0x1 << 9); - shift = 9; - break; - case (0x1 << 14): - mask = (0xf << 12); - shift = 12; - break; - case (0x1 << 2): - mask = (0x1 << 0); - shift = 0; - break; - case (0x1 << 3): - mask = (0x1 << 1); - shift = 1; - break; - case (0x1 << 4): - mask = (0x1 << 2); - shift = 2; - break; - case (0x1 << 5): - mask = (0x3 << 4); - shift = 4; - break; - case (0x1 << 6): - mask = (0x3 << 6); - shift = 6; - break; - case (0x1 << 7): - mask = (0x1 << 8); - shift = 8; - break; - case (0x1 << 8): - mask = (0x1 << 9); - shift = 9; - break; - case (0x1 << 10): - mask = 0x1fff; - shift = 0x0; - break; - case (0x1 << 11): - mask = 0x1fff; - shift = 0x0; - break; - default: - mask = 0x0; - shift = 0x0; - break; - } - - if ((addr != 0xffff) && (core_mask & (1 << core_num))) - mod_phy_reg(pi, addr, mask, (value << shift)); - } - - or_phy_reg(pi, 0xec, (0x1 << 0)); - or_phy_reg(pi, 0x78, (0x1 << 0)); - udelay(1); - and_phy_reg(pi, 0xec, ~(0x1 << 0)); - } -} - -static void wlc_phy_txpwrctrl_idle_tssi_nphy(struct brcms_phy *pi) -{ - s32 rssi_buf[4]; - s32 int_val; - - if (SCAN_RM_IN_PROGRESS(pi) || PLT_INPROG_PHY(pi) || PHY_MUTED(pi)) - - return; - - if (PHY_IPA(pi)) - wlc_phy_ipa_internal_tssi_setup_nphy(pi); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 12), - 0, 0x3, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - else if (NREV_GE(pi->pubpi.phy_rev, 3)) - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 13), 0, 3, 0); - - wlc_phy_stopplayback_nphy(pi); - - wlc_phy_tx_tone_nphy(pi, 4000, 0, 0, 0, false); - - udelay(20); - int_val = - wlc_phy_poll_rssi_nphy(pi, (u8) NPHY_RSSI_SEL_TSSI_2G, rssi_buf, - 1); - wlc_phy_stopplayback_nphy(pi); - wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_OFF, 0); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 12), - 0, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - else if (NREV_GE(pi->pubpi.phy_rev, 3)) - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 13), 0, 3, 1); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - - pi->nphy_pwrctrl_info[PHY_CORE_0].idle_tssi_2g = - (u8) ((int_val >> 24) & 0xff); - pi->nphy_pwrctrl_info[PHY_CORE_0].idle_tssi_5g = - (u8) ((int_val >> 24) & 0xff); - - pi->nphy_pwrctrl_info[PHY_CORE_1].idle_tssi_2g = - (u8) ((int_val >> 8) & 0xff); - pi->nphy_pwrctrl_info[PHY_CORE_1].idle_tssi_5g = - (u8) ((int_val >> 8) & 0xff); - } else { - pi->nphy_pwrctrl_info[PHY_CORE_0].idle_tssi_2g = - (u8) ((int_val >> 24) & 0xff); - - pi->nphy_pwrctrl_info[PHY_CORE_1].idle_tssi_2g = - (u8) ((int_val >> 8) & 0xff); - - pi->nphy_pwrctrl_info[PHY_CORE_0].idle_tssi_5g = - (u8) ((int_val >> 16) & 0xff); - pi->nphy_pwrctrl_info[PHY_CORE_1].idle_tssi_5g = - (u8) ((int_val) & 0xff); - } - -} - -static void wlc_phy_txpwr_limit_to_tbl_nphy(struct brcms_phy *pi) -{ - u8 idx, idx2, i, delta_ind; - - for (idx = TXP_FIRST_CCK; idx <= TXP_LAST_CCK; idx++) - pi->adj_pwr_tbl_nphy[idx] = pi->tx_power_offset[idx]; - - for (i = 0; i < 4; i++) { - idx2 = 0; - - delta_ind = 0; - - switch (i) { - case 0: - - if (CHSPEC_IS40(pi->radio_chanspec) - && NPHY_IS_SROM_REINTERPRET) { - idx = TXP_FIRST_MCS_40_SISO; - } else { - idx = (CHSPEC_IS40(pi->radio_chanspec)) ? - TXP_FIRST_OFDM_40_SISO : TXP_FIRST_OFDM; - delta_ind = 1; - } - break; - - case 1: - - idx = (CHSPEC_IS40(pi->radio_chanspec)) ? - TXP_FIRST_MCS_40_CDD : TXP_FIRST_MCS_20_CDD; - break; - - case 2: - - idx = (CHSPEC_IS40(pi->radio_chanspec)) ? - TXP_FIRST_MCS_40_STBC : TXP_FIRST_MCS_20_STBC; - break; - - case 3: - - idx = (CHSPEC_IS40(pi->radio_chanspec)) ? - TXP_FIRST_MCS_40_SDM : TXP_FIRST_MCS_20_SDM; - break; - } - - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx]; - idx = idx + delta_ind; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx]; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx]; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx++]; - - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx++]; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx]; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx]; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx++]; - - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx++]; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx]; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx]; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx++]; - - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx]; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx++]; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx]; - idx = idx + 1 - delta_ind; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx]; - - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx]; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx]; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx]; - pi->adj_pwr_tbl_nphy[4 + 4 * (idx2++) + i] = - pi->tx_power_offset[idx]; - } -} - -static void wlc_phy_txpwrctrl_pwr_setup_nphy(struct brcms_phy *pi) -{ - u32 idx; - s16 a1[2], b0[2], b1[2]; - s8 target_pwr_qtrdbm[2]; - s32 num, den, pwr_est; - u8 chan_freq_range; - u8 idle_tssi[2]; - u32 tbl_id, tbl_len, tbl_offset; - u32 regval[64]; - u8 core; - - if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12)) { - wlapi_bmac_mctrl(pi->sh->physhim, MCTL_PHYLOCK, MCTL_PHYLOCK); - (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol)); - udelay(1); - } - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - or_phy_reg(pi, 0x122, (0x1 << 0)); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) - and_phy_reg(pi, 0x1e7, (u16) (~(0x1 << 15))); - else - or_phy_reg(pi, 0x1e7, (0x1 << 15)); - - if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12)) - wlapi_bmac_mctrl(pi->sh->physhim, MCTL_PHYLOCK, 0); - - if (pi->sh->sromrev < 4) { - idle_tssi[0] = pi->nphy_pwrctrl_info[0].idle_tssi_2g; - idle_tssi[1] = pi->nphy_pwrctrl_info[1].idle_tssi_2g; - a1[0] = -424; - a1[1] = -424; - b0[0] = 5612; - b0[1] = 5612; - b1[1] = -1393; - b1[0] = -1393; - } else { - - chan_freq_range = wlc_phy_get_chan_freq_range_nphy(pi, 0); - switch (chan_freq_range) { - case WL_CHAN_FREQ_RANGE_2G: - idle_tssi[0] = pi->nphy_pwrctrl_info[0].idle_tssi_2g; - idle_tssi[1] = pi->nphy_pwrctrl_info[1].idle_tssi_2g; - a1[0] = pi->nphy_pwrctrl_info[0].pwrdet_2g_a1; - a1[1] = pi->nphy_pwrctrl_info[1].pwrdet_2g_a1; - b0[0] = pi->nphy_pwrctrl_info[0].pwrdet_2g_b0; - b0[1] = pi->nphy_pwrctrl_info[1].pwrdet_2g_b0; - b1[0] = pi->nphy_pwrctrl_info[0].pwrdet_2g_b1; - b1[1] = pi->nphy_pwrctrl_info[1].pwrdet_2g_b1; - break; - case WL_CHAN_FREQ_RANGE_5GL: - idle_tssi[0] = pi->nphy_pwrctrl_info[0].idle_tssi_5g; - idle_tssi[1] = pi->nphy_pwrctrl_info[1].idle_tssi_5g; - a1[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gl_a1; - a1[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gl_a1; - b0[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gl_b0; - b0[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gl_b0; - b1[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gl_b1; - b1[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gl_b1; - break; - case WL_CHAN_FREQ_RANGE_5GM: - idle_tssi[0] = pi->nphy_pwrctrl_info[0].idle_tssi_5g; - idle_tssi[1] = pi->nphy_pwrctrl_info[1].idle_tssi_5g; - a1[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gm_a1; - a1[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gm_a1; - b0[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gm_b0; - b0[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gm_b0; - b1[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gm_b1; - b1[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gm_b1; - break; - case WL_CHAN_FREQ_RANGE_5GH: - idle_tssi[0] = pi->nphy_pwrctrl_info[0].idle_tssi_5g; - idle_tssi[1] = pi->nphy_pwrctrl_info[1].idle_tssi_5g; - a1[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gh_a1; - a1[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gh_a1; - b0[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gh_b0; - b0[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gh_b0; - b1[0] = pi->nphy_pwrctrl_info[0].pwrdet_5gh_b1; - b1[1] = pi->nphy_pwrctrl_info[1].pwrdet_5gh_b1; - break; - default: - idle_tssi[0] = pi->nphy_pwrctrl_info[0].idle_tssi_2g; - idle_tssi[1] = pi->nphy_pwrctrl_info[1].idle_tssi_2g; - a1[0] = -424; - a1[1] = -424; - b0[0] = 5612; - b0[1] = 5612; - b1[1] = -1393; - b1[0] = -1393; - break; - } - } - - /* use the provided transmit power */ - target_pwr_qtrdbm[0] = (s8) pi->tx_power_max; - target_pwr_qtrdbm[1] = (s8) pi->tx_power_max; - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - if (pi->srom_fem2g.tssipos) - or_phy_reg(pi, 0x1e9, (0x1 << 14)); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - for (core = 0; core <= 1; core++) { - if (PHY_IPA(pi)) { - if (CHSPEC_IS2G(pi->radio_chanspec)) - WRITE_RADIO_REG3(pi, RADIO_2057, - TX, core, - TX_SSI_MUX, - 0xe); - else - WRITE_RADIO_REG3(pi, RADIO_2057, - TX, core, - TX_SSI_MUX, - 0xc); - } - } - } else { - if (PHY_IPA(pi)) { - - write_radio_reg(pi, RADIO_2056_TX_TX_SSI_MUX | - RADIO_2056_TX0, - (CHSPEC_IS5G - (pi->radio_chanspec)) ? - 0xc : 0xe); - write_radio_reg(pi, - RADIO_2056_TX_TX_SSI_MUX | - RADIO_2056_TX1, - (CHSPEC_IS5G - (pi->radio_chanspec)) ? - 0xc : 0xe); - } else { - - write_radio_reg(pi, RADIO_2056_TX_TX_SSI_MUX | - RADIO_2056_TX0, 0x11); - write_radio_reg(pi, RADIO_2056_TX_TX_SSI_MUX | - RADIO_2056_TX1, 0x11); - } - } - } - - if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12)) { - wlapi_bmac_mctrl(pi->sh->physhim, MCTL_PHYLOCK, MCTL_PHYLOCK); - (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol)); - udelay(1); - } - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - mod_phy_reg(pi, 0x1e7, (0x7f << 0), - (NPHY_TxPwrCtrlCmd_pwrIndex_init_rev7 << 0)); - else - mod_phy_reg(pi, 0x1e7, (0x7f << 0), - (NPHY_TxPwrCtrlCmd_pwrIndex_init << 0)); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - mod_phy_reg(pi, 0x222, (0xff << 0), - (NPHY_TxPwrCtrlCmd_pwrIndex_init_rev7 << 0)); - else if (NREV_GT(pi->pubpi.phy_rev, 1)) - mod_phy_reg(pi, 0x222, (0xff << 0), - (NPHY_TxPwrCtrlCmd_pwrIndex_init << 0)); - - if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12)) - wlapi_bmac_mctrl(pi->sh->physhim, MCTL_PHYLOCK, 0); - - write_phy_reg(pi, 0x1e8, (0x3 << 8) | (240 << 0)); - - write_phy_reg(pi, 0x1e9, - (1 << 15) | (idle_tssi[0] << 0) | (idle_tssi[1] << 8)); - - write_phy_reg(pi, 0x1ea, - (target_pwr_qtrdbm[0] << 0) | - (target_pwr_qtrdbm[1] << 8)); - - tbl_len = 64; - tbl_offset = 0; - for (tbl_id = NPHY_TBL_ID_CORE1TXPWRCTL; - tbl_id <= NPHY_TBL_ID_CORE2TXPWRCTL; tbl_id++) { - - for (idx = 0; idx < tbl_len; idx++) { - num = 8 * - (16 * b0[tbl_id - 26] + b1[tbl_id - 26] * idx); - den = 32768 + a1[tbl_id - 26] * idx; - pwr_est = max(((4 * num + den / 2) / den), -8); - if (NREV_LT(pi->pubpi.phy_rev, 3)) { - if (idx <= - (uint) (31 - idle_tssi[tbl_id - 26] + 1)) - pwr_est = - max(pwr_est, - target_pwr_qtrdbm - [tbl_id - 26] + 1); - } - regval[idx] = (u32) pwr_est; - } - wlc_phy_table_write_nphy(pi, tbl_id, tbl_len, tbl_offset, 32, - regval); - } - - wlc_phy_txpwr_limit_to_tbl_nphy(pi); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE1TXPWRCTL, 84, 64, 8, - pi->adj_pwr_tbl_nphy); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE2TXPWRCTL, 84, 64, 8, - pi->adj_pwr_tbl_nphy); - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); -} - -static u32 *wlc_phy_get_ipa_gaintbl_nphy(struct brcms_phy *pi) -{ - u32 *tx_pwrctrl_tbl = NULL; - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if ((pi->pubpi.radiorev == 4) - || (pi->pubpi.radiorev == 6)) - tx_pwrctrl_tbl = - nphy_tpc_txgain_ipa_2g_2057rev4n6; - else if (pi->pubpi.radiorev == 3) - tx_pwrctrl_tbl = - nphy_tpc_txgain_ipa_2g_2057rev3; - else if (pi->pubpi.radiorev == 5) - tx_pwrctrl_tbl = - nphy_tpc_txgain_ipa_2g_2057rev5; - else if ((pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == 8)) - tx_pwrctrl_tbl = - nphy_tpc_txgain_ipa_2g_2057rev7; - } else if (NREV_IS(pi->pubpi.phy_rev, 6)) { - tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_rev6; - if (pi->sh->chip == BCMA_CHIP_ID_BCM47162) - tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_rev5; - } else if (NREV_IS(pi->pubpi.phy_rev, 5)) { - tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_rev5; - } else { - tx_pwrctrl_tbl = nphy_tpc_txgain_ipa; - } - } else { - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if ((pi->pubpi.radiorev == 3) || - (pi->pubpi.radiorev == 4) || - (pi->pubpi.radiorev == 6)) - tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_5g_2057; - else if ((pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == 8)) - tx_pwrctrl_tbl = - nphy_tpc_txgain_ipa_5g_2057rev7; - } else { - tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_5g; - } - } - - return tx_pwrctrl_tbl; -} - -static void wlc_phy_restore_rssical_nphy(struct brcms_phy *pi) -{ - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if (pi->nphy_rssical_chanspec_2G == 0) - return; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - mod_radio_reg(pi, RADIO_2057_NB_MASTER_CORE0, - RADIO_2057_VCM_MASK, - pi->rssical_cache. - rssical_radio_regs_2G[0]); - mod_radio_reg(pi, RADIO_2057_NB_MASTER_CORE1, - RADIO_2057_VCM_MASK, - pi->rssical_cache. - rssical_radio_regs_2G[1]); - } else { - mod_radio_reg(pi, - RADIO_2056_RX_RSSI_MISC | RADIO_2056_RX0, - RADIO_2056_VCM_MASK, - pi->rssical_cache. - rssical_radio_regs_2G[0]); - mod_radio_reg(pi, - RADIO_2056_RX_RSSI_MISC | RADIO_2056_RX1, - RADIO_2056_VCM_MASK, - pi->rssical_cache. - rssical_radio_regs_2G[1]); - } - - write_phy_reg(pi, 0x1a6, - pi->rssical_cache.rssical_phyregs_2G[0]); - write_phy_reg(pi, 0x1ac, - pi->rssical_cache.rssical_phyregs_2G[1]); - write_phy_reg(pi, 0x1b2, - pi->rssical_cache.rssical_phyregs_2G[2]); - write_phy_reg(pi, 0x1b8, - pi->rssical_cache.rssical_phyregs_2G[3]); - write_phy_reg(pi, 0x1a4, - pi->rssical_cache.rssical_phyregs_2G[4]); - write_phy_reg(pi, 0x1aa, - pi->rssical_cache.rssical_phyregs_2G[5]); - write_phy_reg(pi, 0x1b0, - pi->rssical_cache.rssical_phyregs_2G[6]); - write_phy_reg(pi, 0x1b6, - pi->rssical_cache.rssical_phyregs_2G[7]); - write_phy_reg(pi, 0x1a5, - pi->rssical_cache.rssical_phyregs_2G[8]); - write_phy_reg(pi, 0x1ab, - pi->rssical_cache.rssical_phyregs_2G[9]); - write_phy_reg(pi, 0x1b1, - pi->rssical_cache.rssical_phyregs_2G[10]); - write_phy_reg(pi, 0x1b7, - pi->rssical_cache.rssical_phyregs_2G[11]); - - } else { - if (pi->nphy_rssical_chanspec_5G == 0) - return; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - mod_radio_reg(pi, RADIO_2057_NB_MASTER_CORE0, - RADIO_2057_VCM_MASK, - pi->rssical_cache. - rssical_radio_regs_5G[0]); - mod_radio_reg(pi, RADIO_2057_NB_MASTER_CORE1, - RADIO_2057_VCM_MASK, - pi->rssical_cache. - rssical_radio_regs_5G[1]); - } else { - mod_radio_reg(pi, - RADIO_2056_RX_RSSI_MISC | RADIO_2056_RX0, - RADIO_2056_VCM_MASK, - pi->rssical_cache. - rssical_radio_regs_5G[0]); - mod_radio_reg(pi, - RADIO_2056_RX_RSSI_MISC | RADIO_2056_RX1, - RADIO_2056_VCM_MASK, - pi->rssical_cache. - rssical_radio_regs_5G[1]); - } - - write_phy_reg(pi, 0x1a6, - pi->rssical_cache.rssical_phyregs_5G[0]); - write_phy_reg(pi, 0x1ac, - pi->rssical_cache.rssical_phyregs_5G[1]); - write_phy_reg(pi, 0x1b2, - pi->rssical_cache.rssical_phyregs_5G[2]); - write_phy_reg(pi, 0x1b8, - pi->rssical_cache.rssical_phyregs_5G[3]); - write_phy_reg(pi, 0x1a4, - pi->rssical_cache.rssical_phyregs_5G[4]); - write_phy_reg(pi, 0x1aa, - pi->rssical_cache.rssical_phyregs_5G[5]); - write_phy_reg(pi, 0x1b0, - pi->rssical_cache.rssical_phyregs_5G[6]); - write_phy_reg(pi, 0x1b6, - pi->rssical_cache.rssical_phyregs_5G[7]); - write_phy_reg(pi, 0x1a5, - pi->rssical_cache.rssical_phyregs_5G[8]); - write_phy_reg(pi, 0x1ab, - pi->rssical_cache.rssical_phyregs_5G[9]); - write_phy_reg(pi, 0x1b1, - pi->rssical_cache.rssical_phyregs_5G[10]); - write_phy_reg(pi, 0x1b7, - pi->rssical_cache.rssical_phyregs_5G[11]); - } -} - -static void wlc_phy_internal_cal_txgain_nphy(struct brcms_phy *pi) -{ - u16 txcal_gain[2]; - - pi->nphy_txcal_pwr_idx[0] = pi->nphy_cal_orig_pwr_idx[0]; - pi->nphy_txcal_pwr_idx[1] = pi->nphy_cal_orig_pwr_idx[0]; - wlc_phy_txpwr_index_nphy(pi, 1, pi->nphy_cal_orig_pwr_idx[0], true); - wlc_phy_txpwr_index_nphy(pi, 2, pi->nphy_cal_orig_pwr_idx[1], true); - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, - txcal_gain); - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - txcal_gain[0] = (txcal_gain[0] & 0xF000) | 0x0F40; - txcal_gain[1] = (txcal_gain[1] & 0xF000) | 0x0F40; - } else { - txcal_gain[0] = (txcal_gain[0] & 0xF000) | 0x0F60; - txcal_gain[1] = (txcal_gain[1] & 0xF000) | 0x0F60; - } - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, - txcal_gain); -} - -static void wlc_phy_precal_txgain_nphy(struct brcms_phy *pi) -{ - bool save_bbmult = false; - u8 txcal_index_2057_rev5n7 = 0; - u8 txcal_index_2057_rev3n4n6 = 10; - - if (pi->use_int_tx_iqlo_cal_nphy) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if ((pi->pubpi.radiorev == 3) || - (pi->pubpi.radiorev == 4) || - (pi->pubpi.radiorev == 6)) { - - pi->nphy_txcal_pwr_idx[0] = - txcal_index_2057_rev3n4n6; - pi->nphy_txcal_pwr_idx[1] = - txcal_index_2057_rev3n4n6; - wlc_phy_txpwr_index_nphy( - pi, 3, - txcal_index_2057_rev3n4n6, - false); - } else { - - pi->nphy_txcal_pwr_idx[0] = - txcal_index_2057_rev5n7; - pi->nphy_txcal_pwr_idx[1] = - txcal_index_2057_rev5n7; - wlc_phy_txpwr_index_nphy( - pi, 3, - txcal_index_2057_rev5n7, - false); - } - save_bbmult = true; - - } else if (NREV_LT(pi->pubpi.phy_rev, 5)) { - wlc_phy_cal_txgainctrl_nphy(pi, 11, false); - if (pi->sh->hw_phytxchain != 3) { - pi->nphy_txcal_pwr_idx[1] = - pi->nphy_txcal_pwr_idx[0]; - wlc_phy_txpwr_index_nphy(pi, 3, - pi-> - nphy_txcal_pwr_idx[0], - true); - save_bbmult = true; - } - - } else if (NREV_IS(pi->pubpi.phy_rev, 5)) { - if (PHY_IPA(pi)) { - if (CHSPEC_IS2G(pi->radio_chanspec)) { - wlc_phy_cal_txgainctrl_nphy(pi, 12, - false); - } else { - pi->nphy_txcal_pwr_idx[0] = 80; - pi->nphy_txcal_pwr_idx[1] = 80; - wlc_phy_txpwr_index_nphy(pi, 3, 80, - false); - save_bbmult = true; - } - } else { - wlc_phy_internal_cal_txgain_nphy(pi); - save_bbmult = true; - } - - } else if (NREV_IS(pi->pubpi.phy_rev, 6)) { - if (PHY_IPA(pi)) { - if (CHSPEC_IS2G(pi->radio_chanspec)) - wlc_phy_cal_txgainctrl_nphy(pi, 12, - false); - else - wlc_phy_cal_txgainctrl_nphy(pi, 14, - false); - } else { - wlc_phy_internal_cal_txgain_nphy(pi); - save_bbmult = true; - } - } - - } else { - wlc_phy_cal_txgainctrl_nphy(pi, 10, false); - } - - if (save_bbmult) - wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, - &pi->nphy_txcal_bbmult); -} - -static void -wlc_phy_rfctrlintc_override_nphy(struct brcms_phy *pi, u8 field, u16 value, - u8 core_code) -{ - u16 mask; - u16 val; - u8 core; - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - if (core_code == RADIO_MIMO_CORESEL_CORE1 - && core == PHY_CORE_1) - continue; - else if (core_code == RADIO_MIMO_CORESEL_CORE2 - && core == PHY_CORE_0) - continue; - - if (NREV_LT(pi->pubpi.phy_rev, 7)) { - - mask = (0x1 << 10); - val = 1 << 10; - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x91 : - 0x92, mask, val); - } - - if (field == NPHY_RfctrlIntc_override_OFF) { - - write_phy_reg(pi, (core == PHY_CORE_0) ? 0x91 : - 0x92, 0); - - wlc_phy_force_rfseq_nphy(pi, - NPHY_RFSEQ_RESET2RX); - } else if (field == NPHY_RfctrlIntc_override_TRSW) { - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - mask = (0x1 << 6) | (0x1 << 7); - - val = value << 6; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 : 0x92, - mask, val); - - or_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 : 0x92, - (0x1 << 10)); - - and_phy_reg(pi, 0x2ff, (u16) - ~(0x3 << 14)); - or_phy_reg(pi, 0x2ff, (0x1 << 13)); - or_phy_reg(pi, 0x2ff, (0x1 << 0)); - } else { - - mask = (0x1 << 6) | - (0x1 << 7) | - (0x1 << 8) | (0x1 << 9); - val = value << 6; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 : 0x92, - mask, val); - - mask = (0x1 << 0); - val = 1 << 0; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0xe7 : 0xec, - mask, val); - - mask = (core == PHY_CORE_0) ? - (0x1 << 0) : (0x1 << 1); - val = 1 << ((core == PHY_CORE_0) ? - 0 : 1); - mod_phy_reg(pi, 0x78, mask, val); - - SPINWAIT(((read_phy_reg(pi, 0x78) & val) - != 0), 10000); - if (WARN(read_phy_reg(pi, 0x78) & val, - "HW error: override failed")) - return; - - mask = (0x1 << 0); - val = 0 << 0; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0xe7 : 0xec, - mask, val); - } - } else if (field == NPHY_RfctrlIntc_override_PA) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - mask = (0x1 << 4) | (0x1 << 5); - - if (CHSPEC_IS5G(pi->radio_chanspec)) - val = value << 5; - else - val = value << 4; - - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 : 0x92, - mask, val); - - or_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 : 0x92, - (0x1 << 12)); - } else { - - if (CHSPEC_IS5G(pi->radio_chanspec)) { - mask = (0x1 << 5); - val = value << 5; - } else { - mask = (0x1 << 4); - val = value << 4; - } - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 : 0x92, - mask, val); - } - } else if (field == - NPHY_RfctrlIntc_override_EXT_LNA_PU) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if (CHSPEC_IS5G(pi->radio_chanspec)) { - - mask = (0x1 << 0); - val = value << 0; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 - : 0x92, mask, val); - - mask = (0x1 << 2); - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 - : 0x92, mask, 0); - } else { - - mask = (0x1 << 2); - val = value << 2; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 - : 0x92, mask, val); - - mask = (0x1 << 0); - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 - : 0x92, mask, 0); - } - - mask = (0x1 << 11); - val = 1 << 11; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 : 0x92, - mask, val); - } else { - - if (CHSPEC_IS5G(pi->radio_chanspec)) { - mask = (0x1 << 0); - val = value << 0; - } else { - mask = (0x1 << 2); - val = value << 2; - } - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 : 0x92, - mask, val); - } - } else if (field == - NPHY_RfctrlIntc_override_EXT_LNA_GAIN) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if (CHSPEC_IS5G(pi->radio_chanspec)) { - - mask = (0x1 << 1); - val = value << 1; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 - : 0x92, mask, val); - - mask = (0x1 << 3); - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 - : 0x92, mask, 0); - } else { - - mask = (0x1 << 3); - val = value << 3; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 - : 0x92, mask, val); - - mask = (0x1 << 1); - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 - : 0x92, mask, 0); - } - - mask = (0x1 << 11); - val = 1 << 11; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 : 0x92, - mask, val); - } else { - - if (CHSPEC_IS5G(pi->radio_chanspec)) { - mask = (0x1 << 1); - val = value << 1; - } else { - mask = (0x1 << 3); - val = value << 3; - } - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x91 : 0x92, - mask, val); - } - } - } - } -} - -void -wlc_phy_cal_txgainctrl_nphy(struct brcms_phy *pi, s32 dBm_targetpower, - bool debug) -{ - int gainctrl_loopidx; - uint core; - u16 m0m1, curr_m0m1; - s32 delta_power; - s32 txpwrindex; - s32 qdBm_power[2]; - u16 orig_BBConfig; - u16 phy_saveregs[4]; - u32 freq_test; - u16 ampl_test = 250; - uint stepsize; - bool phyhang_avoid_state = false; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - stepsize = 2; - else - stepsize = 1; - - if (CHSPEC_IS40(pi->radio_chanspec)) - freq_test = 5000; - else - freq_test = 2500; - - wlc_phy_txpwr_index_nphy(pi, 1, pi->nphy_cal_orig_pwr_idx[0], true); - wlc_phy_txpwr_index_nphy(pi, 2, pi->nphy_cal_orig_pwr_idx[1], true); - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - phyhang_avoid_state = pi->phyhang_avoid; - pi->phyhang_avoid = false; - - phy_saveregs[0] = read_phy_reg(pi, 0x91); - phy_saveregs[1] = read_phy_reg(pi, 0x92); - phy_saveregs[2] = read_phy_reg(pi, 0xe7); - phy_saveregs[3] = read_phy_reg(pi, 0xec); - wlc_phy_rfctrlintc_override_nphy(pi, NPHY_RfctrlIntc_override_PA, 1, - RADIO_MIMO_CORESEL_CORE1 | - RADIO_MIMO_CORESEL_CORE2); - - if (!debug) { - wlc_phy_rfctrlintc_override_nphy(pi, - NPHY_RfctrlIntc_override_TRSW, - 0x2, RADIO_MIMO_CORESEL_CORE1); - wlc_phy_rfctrlintc_override_nphy(pi, - NPHY_RfctrlIntc_override_TRSW, - 0x8, RADIO_MIMO_CORESEL_CORE2); - } else { - wlc_phy_rfctrlintc_override_nphy(pi, - NPHY_RfctrlIntc_override_TRSW, - 0x1, RADIO_MIMO_CORESEL_CORE1); - wlc_phy_rfctrlintc_override_nphy(pi, - NPHY_RfctrlIntc_override_TRSW, - 0x7, RADIO_MIMO_CORESEL_CORE2); - } - - orig_BBConfig = read_phy_reg(pi, 0x01); - mod_phy_reg(pi, 0x01, (0x1 << 15), 0); - - wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, &m0m1); - - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - txpwrindex = (s32) pi->nphy_cal_orig_pwr_idx[core]; - - for (gainctrl_loopidx = 0; gainctrl_loopidx < 2; - gainctrl_loopidx++) { - wlc_phy_tx_tone_nphy(pi, freq_test, ampl_test, 0, 0, - false); - - if (core == PHY_CORE_0) - curr_m0m1 = m0m1 & 0xff00; - else - curr_m0m1 = m0m1 & 0x00ff; - - wlc_phy_table_write_nphy(pi, 15, 1, 87, 16, &curr_m0m1); - wlc_phy_table_write_nphy(pi, 15, 1, 95, 16, &curr_m0m1); - - udelay(50); - - wlc_phy_est_tonepwr_nphy(pi, qdBm_power, - NPHY_CAL_TSSISAMPS); - - pi->nphy_bb_mult_save = 0; - wlc_phy_stopplayback_nphy(pi); - - delta_power = (dBm_targetpower * 4) - qdBm_power[core]; - - txpwrindex -= stepsize * delta_power; - if (txpwrindex < 0) - txpwrindex = 0; - else if (txpwrindex > 127) - txpwrindex = 127; - - if (CHSPEC_IS5G(pi->radio_chanspec)) { - if (NREV_IS(pi->pubpi.phy_rev, 4) && - (pi->srom_fem5g.extpagain == 3)) { - if (txpwrindex < 30) - txpwrindex = 30; - } - } else { - if (NREV_GE(pi->pubpi.phy_rev, 5) && - (pi->srom_fem2g.extpagain == 3)) { - if (txpwrindex < 50) - txpwrindex = 50; - } - } - - wlc_phy_txpwr_index_nphy(pi, (1 << core), - (u8) txpwrindex, true); - } - - pi->nphy_txcal_pwr_idx[core] = (u8) txpwrindex; - - if (debug) { - u16 radio_gain; - u16 dbg_m0m1; - - wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, &dbg_m0m1); - - wlc_phy_tx_tone_nphy(pi, freq_test, ampl_test, 0, 0, - false); - - wlc_phy_table_write_nphy(pi, 15, 1, 87, 16, &dbg_m0m1); - wlc_phy_table_write_nphy(pi, 15, 1, 95, 16, &dbg_m0m1); - - udelay(100); - - wlc_phy_est_tonepwr_nphy(pi, qdBm_power, - NPHY_CAL_TSSISAMPS); - - wlc_phy_table_read_nphy(pi, 7, 1, (0x110 + core), 16, - &radio_gain); - - mdelay(4000); - pi->nphy_bb_mult_save = 0; - wlc_phy_stopplayback_nphy(pi); - } - } - - wlc_phy_txpwr_index_nphy(pi, 1, pi->nphy_txcal_pwr_idx[0], true); - wlc_phy_txpwr_index_nphy(pi, 2, pi->nphy_txcal_pwr_idx[1], true); - - wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, &pi->nphy_txcal_bbmult); - - write_phy_reg(pi, 0x01, orig_BBConfig); - - write_phy_reg(pi, 0x91, phy_saveregs[0]); - write_phy_reg(pi, 0x92, phy_saveregs[1]); - write_phy_reg(pi, 0xe7, phy_saveregs[2]); - write_phy_reg(pi, 0xec, phy_saveregs[3]); - - pi->phyhang_avoid = phyhang_avoid_state; - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); -} - -static void wlc_phy_savecal_nphy(struct brcms_phy *pi) -{ - void *tbl_ptr; - int coreNum; - u16 *txcal_radio_regs = NULL; - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - - wlc_phy_rx_iq_coeffs_nphy(pi, 0, - &pi->calibration_cache. - rxcal_coeffs_2G); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - txcal_radio_regs = - pi->calibration_cache.txcal_radio_regs_2G; - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - - pi->calibration_cache.txcal_radio_regs_2G[0] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_I | - RADIO_2056_TX0); - pi->calibration_cache.txcal_radio_regs_2G[1] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_Q | - RADIO_2056_TX0); - pi->calibration_cache.txcal_radio_regs_2G[2] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_I | - RADIO_2056_TX1); - pi->calibration_cache.txcal_radio_regs_2G[3] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_Q | - RADIO_2056_TX1); - - pi->calibration_cache.txcal_radio_regs_2G[4] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_I | - RADIO_2056_TX0); - pi->calibration_cache.txcal_radio_regs_2G[5] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_Q | - RADIO_2056_TX0); - pi->calibration_cache.txcal_radio_regs_2G[6] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_I | - RADIO_2056_TX1); - pi->calibration_cache.txcal_radio_regs_2G[7] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_Q | - RADIO_2056_TX1); - } else { - pi->calibration_cache.txcal_radio_regs_2G[0] = - read_radio_reg(pi, RADIO_2055_CORE1_TX_VOS_CNCL); - pi->calibration_cache.txcal_radio_regs_2G[1] = - read_radio_reg(pi, RADIO_2055_CORE2_TX_VOS_CNCL); - pi->calibration_cache.txcal_radio_regs_2G[2] = - read_radio_reg(pi, RADIO_2055_CORE1_TX_BB_MXGM); - pi->calibration_cache.txcal_radio_regs_2G[3] = - read_radio_reg(pi, RADIO_2055_CORE2_TX_BB_MXGM); - } - - pi->nphy_iqcal_chanspec_2G = pi->radio_chanspec; - tbl_ptr = pi->calibration_cache.txcal_coeffs_2G; - } else { - - wlc_phy_rx_iq_coeffs_nphy(pi, 0, - &pi->calibration_cache. - rxcal_coeffs_5G); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - txcal_radio_regs = - pi->calibration_cache.txcal_radio_regs_5G; - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - - pi->calibration_cache.txcal_radio_regs_5G[0] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_I | - RADIO_2056_TX0); - pi->calibration_cache.txcal_radio_regs_5G[1] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_Q | - RADIO_2056_TX0); - pi->calibration_cache.txcal_radio_regs_5G[2] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_I | - RADIO_2056_TX1); - pi->calibration_cache.txcal_radio_regs_5G[3] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_Q | - RADIO_2056_TX1); - - pi->calibration_cache.txcal_radio_regs_5G[4] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_I | - RADIO_2056_TX0); - pi->calibration_cache.txcal_radio_regs_5G[5] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_Q | - RADIO_2056_TX0); - pi->calibration_cache.txcal_radio_regs_5G[6] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_I | - RADIO_2056_TX1); - pi->calibration_cache.txcal_radio_regs_5G[7] = - read_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_Q | - RADIO_2056_TX1); - } else { - pi->calibration_cache.txcal_radio_regs_5G[0] = - read_radio_reg(pi, RADIO_2055_CORE1_TX_VOS_CNCL); - pi->calibration_cache.txcal_radio_regs_5G[1] = - read_radio_reg(pi, RADIO_2055_CORE2_TX_VOS_CNCL); - pi->calibration_cache.txcal_radio_regs_5G[2] = - read_radio_reg(pi, RADIO_2055_CORE1_TX_BB_MXGM); - pi->calibration_cache.txcal_radio_regs_5G[3] = - read_radio_reg(pi, RADIO_2055_CORE2_TX_BB_MXGM); - } - - pi->nphy_iqcal_chanspec_5G = pi->radio_chanspec; - tbl_ptr = pi->calibration_cache.txcal_coeffs_5G; - } - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - for (coreNum = 0; coreNum <= 1; coreNum++) { - - txcal_radio_regs[2 * coreNum] = - READ_RADIO_REG3(pi, RADIO_2057, TX, coreNum, - LOFT_FINE_I); - txcal_radio_regs[2 * coreNum + 1] = - READ_RADIO_REG3(pi, RADIO_2057, TX, coreNum, - LOFT_FINE_Q); - - txcal_radio_regs[2 * coreNum + 4] = - READ_RADIO_REG3(pi, RADIO_2057, TX, coreNum, - LOFT_COARSE_I); - txcal_radio_regs[2 * coreNum + 5] = - READ_RADIO_REG3(pi, RADIO_2057, TX, coreNum, - LOFT_COARSE_Q); - } - } - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, 8, 80, 16, tbl_ptr); - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); -} - -static void wlc_phy_tx_iq_war_nphy(struct brcms_phy *pi) -{ - struct nphy_iq_comp tx_comp; - - wlc_phy_table_read_nphy(pi, 15, 4, 0x50, 16, &tx_comp); - - wlapi_bmac_write_shm(pi->sh->physhim, M_20IN40_IQ, tx_comp.a0); - wlapi_bmac_write_shm(pi->sh->physhim, M_20IN40_IQ + 2, tx_comp.b0); - wlapi_bmac_write_shm(pi->sh->physhim, M_20IN40_IQ + 4, tx_comp.a1); - wlapi_bmac_write_shm(pi->sh->physhim, M_20IN40_IQ + 6, tx_comp.b1); -} - -static void wlc_phy_restorecal_nphy(struct brcms_phy *pi) -{ - u16 *loft_comp; - u16 txcal_coeffs_bphy[4]; - u16 *tbl_ptr; - int coreNum; - u16 *txcal_radio_regs = NULL; - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if (pi->nphy_iqcal_chanspec_2G == 0) - return; - - tbl_ptr = pi->calibration_cache.txcal_coeffs_2G; - loft_comp = &pi->calibration_cache.txcal_coeffs_2G[5]; - } else { - if (pi->nphy_iqcal_chanspec_5G == 0) - return; - - tbl_ptr = pi->calibration_cache.txcal_coeffs_5G; - loft_comp = &pi->calibration_cache.txcal_coeffs_5G[5]; - } - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 80, 16, tbl_ptr); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - txcal_coeffs_bphy[0] = tbl_ptr[0]; - txcal_coeffs_bphy[1] = tbl_ptr[1]; - txcal_coeffs_bphy[2] = tbl_ptr[2]; - txcal_coeffs_bphy[3] = tbl_ptr[3]; - } else { - txcal_coeffs_bphy[0] = 0; - txcal_coeffs_bphy[1] = 0; - txcal_coeffs_bphy[2] = 0; - txcal_coeffs_bphy[3] = 0; - } - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 88, 16, - txcal_coeffs_bphy); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 85, 16, loft_comp); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 93, 16, loft_comp); - - if (NREV_LT(pi->pubpi.phy_rev, 2)) - wlc_phy_tx_iq_war_nphy(pi); - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - txcal_radio_regs = - pi->calibration_cache.txcal_radio_regs_2G; - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - - write_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_I | - RADIO_2056_TX0, - pi->calibration_cache. - txcal_radio_regs_2G[0]); - write_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_Q | - RADIO_2056_TX0, - pi->calibration_cache. - txcal_radio_regs_2G[1]); - write_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_I | - RADIO_2056_TX1, - pi->calibration_cache. - txcal_radio_regs_2G[2]); - write_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_Q | - RADIO_2056_TX1, - pi->calibration_cache. - txcal_radio_regs_2G[3]); - - write_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_I | - RADIO_2056_TX0, - pi->calibration_cache. - txcal_radio_regs_2G[4]); - write_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_Q | - RADIO_2056_TX0, - pi->calibration_cache. - txcal_radio_regs_2G[5]); - write_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_I | - RADIO_2056_TX1, - pi->calibration_cache. - txcal_radio_regs_2G[6]); - write_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_Q | - RADIO_2056_TX1, - pi->calibration_cache. - txcal_radio_regs_2G[7]); - } else { - write_radio_reg(pi, RADIO_2055_CORE1_TX_VOS_CNCL, - pi->calibration_cache. - txcal_radio_regs_2G[0]); - write_radio_reg(pi, RADIO_2055_CORE2_TX_VOS_CNCL, - pi->calibration_cache. - txcal_radio_regs_2G[1]); - write_radio_reg(pi, RADIO_2055_CORE1_TX_BB_MXGM, - pi->calibration_cache. - txcal_radio_regs_2G[2]); - write_radio_reg(pi, RADIO_2055_CORE2_TX_BB_MXGM, - pi->calibration_cache. - txcal_radio_regs_2G[3]); - } - - wlc_phy_rx_iq_coeffs_nphy(pi, 1, - &pi->calibration_cache. - rxcal_coeffs_2G); - } else { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - txcal_radio_regs = - pi->calibration_cache.txcal_radio_regs_5G; - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - - write_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_I | - RADIO_2056_TX0, - pi->calibration_cache. - txcal_radio_regs_5G[0]); - write_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_Q | - RADIO_2056_TX0, - pi->calibration_cache. - txcal_radio_regs_5G[1]); - write_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_I | - RADIO_2056_TX1, - pi->calibration_cache. - txcal_radio_regs_5G[2]); - write_radio_reg(pi, - RADIO_2056_TX_LOFT_FINE_Q | - RADIO_2056_TX1, - pi->calibration_cache. - txcal_radio_regs_5G[3]); - - write_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_I | - RADIO_2056_TX0, - pi->calibration_cache. - txcal_radio_regs_5G[4]); - write_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_Q | - RADIO_2056_TX0, - pi->calibration_cache. - txcal_radio_regs_5G[5]); - write_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_I | - RADIO_2056_TX1, - pi->calibration_cache. - txcal_radio_regs_5G[6]); - write_radio_reg(pi, - RADIO_2056_TX_LOFT_COARSE_Q | - RADIO_2056_TX1, - pi->calibration_cache. - txcal_radio_regs_5G[7]); - } else { - write_radio_reg(pi, RADIO_2055_CORE1_TX_VOS_CNCL, - pi->calibration_cache. - txcal_radio_regs_5G[0]); - write_radio_reg(pi, RADIO_2055_CORE2_TX_VOS_CNCL, - pi->calibration_cache. - txcal_radio_regs_5G[1]); - write_radio_reg(pi, RADIO_2055_CORE1_TX_BB_MXGM, - pi->calibration_cache. - txcal_radio_regs_5G[2]); - write_radio_reg(pi, RADIO_2055_CORE2_TX_BB_MXGM, - pi->calibration_cache. - txcal_radio_regs_5G[3]); - } - - wlc_phy_rx_iq_coeffs_nphy(pi, 1, - &pi->calibration_cache. - rxcal_coeffs_5G); - } - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - for (coreNum = 0; coreNum <= 1; coreNum++) { - - WRITE_RADIO_REG3(pi, RADIO_2057, TX, coreNum, - LOFT_FINE_I, - txcal_radio_regs[2 * coreNum]); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, coreNum, - LOFT_FINE_Q, - txcal_radio_regs[2 * coreNum + 1]); - - WRITE_RADIO_REG3(pi, RADIO_2057, TX, coreNum, - LOFT_COARSE_I, - txcal_radio_regs[2 * coreNum + 4]); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, coreNum, - LOFT_COARSE_Q, - txcal_radio_regs[2 * coreNum + 5]); - } - } -} - -static void wlc_phy_txpwrctrl_coeff_setup_nphy(struct brcms_phy *pi) -{ - u32 idx; - u16 iqloCalbuf[7]; - u32 iqcomp, locomp, curr_locomp; - s8 locomp_i, locomp_q; - s8 curr_locomp_i, curr_locomp_q; - u32 tbl_id, tbl_len, tbl_offset; - u32 regval[128]; - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - wlc_phy_table_read_nphy(pi, 15, 7, 80, 16, iqloCalbuf); - - tbl_len = 128; - tbl_offset = 320; - for (tbl_id = NPHY_TBL_ID_CORE1TXPWRCTL; - tbl_id <= NPHY_TBL_ID_CORE2TXPWRCTL; tbl_id++) { - iqcomp = - (tbl_id == - 26) ? (((u32) (iqloCalbuf[0] & 0x3ff)) << 10) | - (iqloCalbuf[1] & 0x3ff) - : (((u32) (iqloCalbuf[2] & 0x3ff)) << 10) | - (iqloCalbuf[3] & 0x3ff); - - for (idx = 0; idx < tbl_len; idx++) - regval[idx] = iqcomp; - wlc_phy_table_write_nphy(pi, tbl_id, tbl_len, tbl_offset, 32, - regval); - } - - tbl_offset = 448; - for (tbl_id = NPHY_TBL_ID_CORE1TXPWRCTL; - tbl_id <= NPHY_TBL_ID_CORE2TXPWRCTL; tbl_id++) { - - locomp = - (u32) ((tbl_id == 26) ? iqloCalbuf[5] : iqloCalbuf[6]); - locomp_i = (s8) ((locomp >> 8) & 0xff); - locomp_q = (s8) ((locomp) & 0xff); - for (idx = 0; idx < tbl_len; idx++) { - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - curr_locomp_i = locomp_i; - curr_locomp_q = locomp_q; - } else { - curr_locomp_i = (s8) ((locomp_i * - nphy_tpc_loscale[idx] + - 128) >> 8); - curr_locomp_q = - (s8) ((locomp_q * - nphy_tpc_loscale[idx] + - 128) >> 8); - } - curr_locomp = (u32) ((curr_locomp_i & 0xff) << 8); - curr_locomp |= (u32) (curr_locomp_q & 0xff); - regval[idx] = curr_locomp; - } - wlc_phy_table_write_nphy(pi, tbl_id, tbl_len, tbl_offset, 32, - regval); - } - - if (NREV_LT(pi->pubpi.phy_rev, 2)) { - - wlapi_bmac_write_shm(pi->sh->physhim, M_CURR_IDX1, 0xFFFF); - wlapi_bmac_write_shm(pi->sh->physhim, M_CURR_IDX2, 0xFFFF); - } - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); -} - -static void wlc_phy_txlpfbw_nphy(struct brcms_phy *pi) -{ - u8 tx_lpf_bw = 0; - - if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LT(pi->pubpi.phy_rev, 7)) { - if (CHSPEC_IS40(pi->radio_chanspec)) - tx_lpf_bw = 3; - else - tx_lpf_bw = 1; - - if (PHY_IPA(pi)) { - if (CHSPEC_IS40(pi->radio_chanspec)) - tx_lpf_bw = 5; - else - tx_lpf_bw = 4; - } - - write_phy_reg(pi, 0xe8, - (tx_lpf_bw << 0) | - (tx_lpf_bw << 3) | - (tx_lpf_bw << 6) | (tx_lpf_bw << 9)); - - if (PHY_IPA(pi)) { - - if (CHSPEC_IS40(pi->radio_chanspec)) - tx_lpf_bw = 4; - else - tx_lpf_bw = 1; - - write_phy_reg(pi, 0xe9, - (tx_lpf_bw << 0) | - (tx_lpf_bw << 3) | - (tx_lpf_bw << 6) | (tx_lpf_bw << 9)); - } - } -} - -static void -wlc_phy_adjust_rx_analpfbw_nphy(struct brcms_phy *pi, u16 reduction_factr) -{ - if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LT(pi->pubpi.phy_rev, 7)) { - if ((CHSPEC_CHANNEL(pi->radio_chanspec) == 11) && - CHSPEC_IS40(pi->radio_chanspec)) { - if (!pi->nphy_anarxlpf_adjusted) { - write_radio_reg(pi, - (RADIO_2056_RX_RXLPF_RCCAL_LPC | - RADIO_2056_RX0), - ((pi->nphy_rccal_value + - reduction_factr) | 0x80)); - - pi->nphy_anarxlpf_adjusted = true; - } - } else { - if (pi->nphy_anarxlpf_adjusted) { - write_radio_reg(pi, - (RADIO_2056_RX_RXLPF_RCCAL_LPC | - RADIO_2056_RX0), - (pi->nphy_rccal_value | 0x80)); - - pi->nphy_anarxlpf_adjusted = false; - } - } - } -} - -static void -wlc_phy_adjust_min_noisevar_nphy(struct brcms_phy *pi, int ntones, - int *tone_id_buf, u32 *noise_var_buf) -{ - int i; - u32 offset; - int tone_id; - int tbllen = - CHSPEC_IS40(pi->radio_chanspec) ? - NPHY_NOISEVAR_TBLLEN40 : NPHY_NOISEVAR_TBLLEN20; - - if (pi->nphy_noisevars_adjusted) { - for (i = 0; i < pi->nphy_saved_noisevars.bufcount; i++) { - tone_id = pi->nphy_saved_noisevars.tone_id[i]; - offset = (tone_id >= 0) ? - ((tone_id * - 2) + 1) : (tbllen + (tone_id * 2) + 1); - wlc_phy_table_write_nphy( - pi, NPHY_TBL_ID_NOISEVAR, 1, - offset, 32, - &pi->nphy_saved_noisevars.min_noise_vars[i]); - } - - pi->nphy_saved_noisevars.bufcount = 0; - pi->nphy_noisevars_adjusted = false; - } - - if ((noise_var_buf != NULL) && (tone_id_buf != NULL)) { - pi->nphy_saved_noisevars.bufcount = 0; - - for (i = 0; i < ntones; i++) { - tone_id = tone_id_buf[i]; - offset = (tone_id >= 0) ? - ((tone_id * 2) + 1) : - (tbllen + (tone_id * 2) + 1); - pi->nphy_saved_noisevars.tone_id[i] = tone_id; - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, - offset, 32, - &pi->nphy_saved_noisevars. - min_noise_vars[i]); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_NOISEVAR, 1, - offset, 32, &noise_var_buf[i]); - pi->nphy_saved_noisevars.bufcount++; - } - - pi->nphy_noisevars_adjusted = true; - } -} - -static void wlc_phy_adjust_crsminpwr_nphy(struct brcms_phy *pi, u8 minpwr) -{ - u16 regval; - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - if ((CHSPEC_CHANNEL(pi->radio_chanspec) == 11) && - CHSPEC_IS40(pi->radio_chanspec)) { - if (!pi->nphy_crsminpwr_adjusted) { - regval = read_phy_reg(pi, 0x27d); - pi->nphy_crsminpwr[0] = regval & 0xff; - regval &= 0xff00; - regval |= (u16) minpwr; - write_phy_reg(pi, 0x27d, regval); - - regval = read_phy_reg(pi, 0x280); - pi->nphy_crsminpwr[1] = regval & 0xff; - regval &= 0xff00; - regval |= (u16) minpwr; - write_phy_reg(pi, 0x280, regval); - - regval = read_phy_reg(pi, 0x283); - pi->nphy_crsminpwr[2] = regval & 0xff; - regval &= 0xff00; - regval |= (u16) minpwr; - write_phy_reg(pi, 0x283, regval); - - pi->nphy_crsminpwr_adjusted = true; - } - } else { - if (pi->nphy_crsminpwr_adjusted) { - regval = read_phy_reg(pi, 0x27d); - regval &= 0xff00; - regval |= pi->nphy_crsminpwr[0]; - write_phy_reg(pi, 0x27d, regval); - - regval = read_phy_reg(pi, 0x280); - regval &= 0xff00; - regval |= pi->nphy_crsminpwr[1]; - write_phy_reg(pi, 0x280, regval); - - regval = read_phy_reg(pi, 0x283); - regval &= 0xff00; - regval |= pi->nphy_crsminpwr[2]; - write_phy_reg(pi, 0x283, regval); - - pi->nphy_crsminpwr_adjusted = false; - } - } - } -} - -static void wlc_phy_spurwar_nphy(struct brcms_phy *pi) -{ - u16 cur_channel = 0; - int nphy_adj_tone_id_buf[] = { 57, 58 }; - u32 nphy_adj_noise_var_buf[] = { 0x3ff, 0x3ff }; - bool isAdjustNoiseVar = false; - uint numTonesAdjust = 0; - u32 tempval = 0; - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - cur_channel = CHSPEC_CHANNEL(pi->radio_chanspec); - - if (pi->nphy_gband_spurwar_en) { - - wlc_phy_adjust_rx_analpfbw_nphy( - pi, - NPHY_ANARXLPFBW_REDUCTIONFACT); - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if ((cur_channel == 11) - && CHSPEC_IS40(pi->radio_chanspec)) - wlc_phy_adjust_min_noisevar_nphy( - pi, 2, - nphy_adj_tone_id_buf, - nphy_adj_noise_var_buf); - else - wlc_phy_adjust_min_noisevar_nphy(pi, 0, - NULL, - NULL); - } - - wlc_phy_adjust_crsminpwr_nphy(pi, - NPHY_ADJUSTED_MINCRSPOWER); - } - - if ((pi->nphy_gband_spurwar2_en) - && CHSPEC_IS2G(pi->radio_chanspec)) { - - if (CHSPEC_IS40(pi->radio_chanspec)) { - switch (cur_channel) { - case 3: - nphy_adj_tone_id_buf[0] = 57; - nphy_adj_tone_id_buf[1] = 58; - nphy_adj_noise_var_buf[0] = 0x22f; - nphy_adj_noise_var_buf[1] = 0x25f; - isAdjustNoiseVar = true; - break; - case 4: - nphy_adj_tone_id_buf[0] = 41; - nphy_adj_tone_id_buf[1] = 42; - nphy_adj_noise_var_buf[0] = 0x22f; - nphy_adj_noise_var_buf[1] = 0x25f; - isAdjustNoiseVar = true; - break; - case 5: - nphy_adj_tone_id_buf[0] = 25; - nphy_adj_tone_id_buf[1] = 26; - nphy_adj_noise_var_buf[0] = 0x24f; - nphy_adj_noise_var_buf[1] = 0x25f; - isAdjustNoiseVar = true; - break; - case 6: - nphy_adj_tone_id_buf[0] = 9; - nphy_adj_tone_id_buf[1] = 10; - nphy_adj_noise_var_buf[0] = 0x22f; - nphy_adj_noise_var_buf[1] = 0x24f; - isAdjustNoiseVar = true; - break; - case 7: - nphy_adj_tone_id_buf[0] = 121; - nphy_adj_tone_id_buf[1] = 122; - nphy_adj_noise_var_buf[0] = 0x18f; - nphy_adj_noise_var_buf[1] = 0x24f; - isAdjustNoiseVar = true; - break; - case 8: - nphy_adj_tone_id_buf[0] = 105; - nphy_adj_tone_id_buf[1] = 106; - nphy_adj_noise_var_buf[0] = 0x22f; - nphy_adj_noise_var_buf[1] = 0x25f; - isAdjustNoiseVar = true; - break; - case 9: - nphy_adj_tone_id_buf[0] = 89; - nphy_adj_tone_id_buf[1] = 90; - nphy_adj_noise_var_buf[0] = 0x22f; - nphy_adj_noise_var_buf[1] = 0x24f; - isAdjustNoiseVar = true; - break; - case 10: - nphy_adj_tone_id_buf[0] = 73; - nphy_adj_tone_id_buf[1] = 74; - nphy_adj_noise_var_buf[0] = 0x22f; - nphy_adj_noise_var_buf[1] = 0x24f; - isAdjustNoiseVar = true; - break; - default: - isAdjustNoiseVar = false; - break; - } - } - - if (isAdjustNoiseVar) { - numTonesAdjust = ARRAY_SIZE(nphy_adj_tone_id_buf); - - wlc_phy_adjust_min_noisevar_nphy( - pi, - numTonesAdjust, - nphy_adj_tone_id_buf, - nphy_adj_noise_var_buf); - - tempval = 0; - - } else { - wlc_phy_adjust_min_noisevar_nphy(pi, 0, NULL, - NULL); - } - } - - if ((pi->nphy_aband_spurwar_en) && - (CHSPEC_IS5G(pi->radio_chanspec))) { - switch (cur_channel) { - case 54: - nphy_adj_tone_id_buf[0] = 32; - nphy_adj_noise_var_buf[0] = 0x25f; - break; - case 38: - case 102: - case 118: - if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) && - (pi->sh->chippkg == BCMA_PKG_ID_BCM4717)) { - nphy_adj_tone_id_buf[0] = 32; - nphy_adj_noise_var_buf[0] = 0x21f; - } else { - nphy_adj_tone_id_buf[0] = 0; - nphy_adj_noise_var_buf[0] = 0x0; - } - break; - case 134: - nphy_adj_tone_id_buf[0] = 32; - nphy_adj_noise_var_buf[0] = 0x21f; - break; - case 151: - nphy_adj_tone_id_buf[0] = 16; - nphy_adj_noise_var_buf[0] = 0x23f; - break; - case 153: - case 161: - nphy_adj_tone_id_buf[0] = 48; - nphy_adj_noise_var_buf[0] = 0x23f; - break; - default: - nphy_adj_tone_id_buf[0] = 0; - nphy_adj_noise_var_buf[0] = 0x0; - break; - } - - if (nphy_adj_tone_id_buf[0] - && nphy_adj_noise_var_buf[0]) - wlc_phy_adjust_min_noisevar_nphy( - pi, 1, - nphy_adj_tone_id_buf, - nphy_adj_noise_var_buf); - else - wlc_phy_adjust_min_noisevar_nphy(pi, 0, NULL, - NULL); - } - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); - } -} - -void wlc_phy_init_nphy(struct brcms_phy *pi) -{ - u16 val; - u16 clip1_ths[2]; - struct nphy_txgains target_gain; - u8 tx_pwr_ctrl_state; - bool do_nphy_cal = false; - uint core; - u32 d11_clk_ctl_st; - bool do_rssi_cal = false; - - core = 0; - - if (!(pi->measure_hold & PHY_HOLD_FOR_SCAN)) - pi->measure_hold |= PHY_HOLD_FOR_NOT_ASSOC; - - if ((ISNPHY(pi)) && (NREV_GE(pi->pubpi.phy_rev, 5)) && - ((pi->sh->chippkg == BCMA_PKG_ID_BCM4717) || - (pi->sh->chippkg == BCMA_PKG_ID_BCM4718))) { - if ((pi->sh->boardflags & BFL_EXTLNA) && - (CHSPEC_IS2G(pi->radio_chanspec))) - bcma_cc_set32(&pi->d11core->bus->drv_cc, - BCMA_CC_CHIPCTL, 0x40); - } - - if ((!PHY_IPA(pi)) && (pi->sh->chip == BCMA_CHIP_ID_BCM5357)) - bcma_chipco_chipctl_maskset(&pi->d11core->bus->drv_cc, 1, - ~CCTRL5357_EXTPA, CCTRL5357_EXTPA); - - if ((pi->nphy_gband_spurwar2_en) && CHSPEC_IS2G(pi->radio_chanspec) && - CHSPEC_IS40(pi->radio_chanspec)) { - - d11_clk_ctl_st = bcma_read32(pi->d11core, - D11REGOFFS(clk_ctl_st)); - bcma_mask32(pi->d11core, D11REGOFFS(clk_ctl_st), - ~(CCS_FORCEHT | CCS_HTAREQ)); - - bcma_write32(pi->d11core, D11REGOFFS(clk_ctl_st), - d11_clk_ctl_st); - } - - pi->use_int_tx_iqlo_cal_nphy = - (PHY_IPA(pi) || - (NREV_GE(pi->pubpi.phy_rev, 7) || - (NREV_GE(pi->pubpi.phy_rev, 5) - && pi->sh->boardflags2 & BFL2_INTERNDET_TXIQCAL))); - - pi->internal_tx_iqlo_cal_tapoff_intpa_nphy = false; - - pi->nphy_deaf_count = 0; - - wlc_phy_tbl_init_nphy(pi); - - pi->nphy_crsminpwr_adjusted = false; - pi->nphy_noisevars_adjusted = false; - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - write_phy_reg(pi, 0xe7, 0); - write_phy_reg(pi, 0xec, 0); - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - write_phy_reg(pi, 0x342, 0); - write_phy_reg(pi, 0x343, 0); - write_phy_reg(pi, 0x346, 0); - write_phy_reg(pi, 0x347, 0); - } - write_phy_reg(pi, 0xe5, 0); - write_phy_reg(pi, 0xe6, 0); - } else { - write_phy_reg(pi, 0xec, 0); - } - - write_phy_reg(pi, 0x91, 0); - write_phy_reg(pi, 0x92, 0); - if (NREV_LT(pi->pubpi.phy_rev, 6)) { - write_phy_reg(pi, 0x93, 0); - write_phy_reg(pi, 0x94, 0); - } - - and_phy_reg(pi, 0xa1, ~3); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - write_phy_reg(pi, 0x8f, 0); - write_phy_reg(pi, 0xa5, 0); - } else { - write_phy_reg(pi, 0xa5, 0); - } - - if (NREV_IS(pi->pubpi.phy_rev, 2)) - mod_phy_reg(pi, 0xdc, 0x00ff, 0x3b); - else if (NREV_LT(pi->pubpi.phy_rev, 2)) - mod_phy_reg(pi, 0xdc, 0x00ff, 0x40); - - write_phy_reg(pi, 0x203, 32); - write_phy_reg(pi, 0x201, 32); - - if (pi->sh->boardflags2 & BFL2_SKWRKFEM_BRD) - write_phy_reg(pi, 0x20d, 160); - else - write_phy_reg(pi, 0x20d, 184); - - write_phy_reg(pi, 0x13a, 200); - - write_phy_reg(pi, 0x70, 80); - - write_phy_reg(pi, 0x1ff, 48); - - if (NREV_LT(pi->pubpi.phy_rev, 8)) - wlc_phy_update_mimoconfig_nphy(pi, pi->n_preamble_override); - - wlc_phy_stf_chain_upd_nphy(pi); - - if (NREV_LT(pi->pubpi.phy_rev, 2)) { - write_phy_reg(pi, 0x180, 0xaa8); - write_phy_reg(pi, 0x181, 0x9a4); - } - - if (PHY_IPA(pi)) { - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (1) << 0); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x298 : - 0x29c, (0x1ff << 7), - (pi->nphy_papd_epsilon_offset[core]) << 7); - - } - - wlc_phy_ipa_set_tx_digi_filts_nphy(pi); - } else if (NREV_GE(pi->pubpi.phy_rev, 5)) { - wlc_phy_extpa_set_tx_digi_filts_nphy(pi); - } - - wlc_phy_workarounds_nphy(pi); - - wlapi_bmac_phyclk_fgc(pi->sh->physhim, ON); - - val = read_phy_reg(pi, 0x01); - write_phy_reg(pi, 0x01, val | BBCFG_RESETCCA); - write_phy_reg(pi, 0x01, val & (~BBCFG_RESETCCA)); - wlapi_bmac_phyclk_fgc(pi->sh->physhim, OFF); - - wlapi_bmac_macphyclk_set(pi->sh->physhim, ON); - - wlc_phy_pa_override_nphy(pi, OFF); - wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RX2TX); - wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); - wlc_phy_pa_override_nphy(pi, ON); - - wlc_phy_classifier_nphy(pi, 0, 0); - wlc_phy_clip_det_nphy(pi, 0, clip1_ths); - - if (CHSPEC_IS2G(pi->radio_chanspec)) - wlc_phy_bphy_init_nphy(pi); - - tx_pwr_ctrl_state = pi->nphy_txpwrctrl; - wlc_phy_txpwrctrl_enable_nphy(pi, PHY_TPC_HW_OFF); - - wlc_phy_txpwr_fixpower_nphy(pi); - - wlc_phy_txpwrctrl_idle_tssi_nphy(pi); - - wlc_phy_txpwrctrl_pwr_setup_nphy(pi); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - u32 *tx_pwrctrl_tbl = NULL; - u16 idx; - s16 pga_gn = 0; - s16 pad_gn = 0; - s32 rfpwr_offset; - - if (PHY_IPA(pi)) { - tx_pwrctrl_tbl = wlc_phy_get_ipa_gaintbl_nphy(pi); - } else { - if (CHSPEC_IS5G(pi->radio_chanspec)) { - if (NREV_IS(pi->pubpi.phy_rev, 3)) - tx_pwrctrl_tbl = - nphy_tpc_5GHz_txgain_rev3; - else if (NREV_IS(pi->pubpi.phy_rev, 4)) - tx_pwrctrl_tbl = - (pi->srom_fem5g.extpagain == - 3) ? - nphy_tpc_5GHz_txgain_HiPwrEPA : - nphy_tpc_5GHz_txgain_rev4; - else - tx_pwrctrl_tbl = - nphy_tpc_5GHz_txgain_rev5; - } else { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if (pi->pubpi.radiorev == 5) - tx_pwrctrl_tbl = - nphy_tpc_txgain_epa_2057rev5; - else if (pi->pubpi.radiorev == 3) - tx_pwrctrl_tbl = - nphy_tpc_txgain_epa_2057rev3; - } else { - if (NREV_GE(pi->pubpi.phy_rev, 5) && - (pi->srom_fem2g.extpagain == 3)) - tx_pwrctrl_tbl = - nphy_tpc_txgain_HiPwrEPA; - else - tx_pwrctrl_tbl = - nphy_tpc_txgain_rev3; - } - } - } - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE1TXPWRCTL, 128, - 192, 32, tx_pwrctrl_tbl); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE2TXPWRCTL, 128, - 192, 32, tx_pwrctrl_tbl); - - pi->nphy_gmval = (u16) ((*tx_pwrctrl_tbl >> 16) & 0x7000); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - for (idx = 0; idx < 128; idx++) { - pga_gn = (tx_pwrctrl_tbl[idx] >> 24) & 0xf; - pad_gn = (tx_pwrctrl_tbl[idx] >> 19) & 0x1f; - rfpwr_offset = get_rf_pwr_offset(pi, pga_gn, - pad_gn); - wlc_phy_table_write_nphy( - pi, - NPHY_TBL_ID_CORE1TXPWRCTL, - 1, 576 + idx, 32, - &rfpwr_offset); - wlc_phy_table_write_nphy( - pi, - NPHY_TBL_ID_CORE2TXPWRCTL, - 1, 576 + idx, 32, - &rfpwr_offset); - } - } else { - - for (idx = 0; idx < 128; idx++) { - pga_gn = (tx_pwrctrl_tbl[idx] >> 24) & 0xf; - if (CHSPEC_IS2G(pi->radio_chanspec)) - rfpwr_offset = (s16) - nphy_papd_pga_gain_delta_ipa_2g - [pga_gn]; - else - rfpwr_offset = (s16) - nphy_papd_pga_gain_delta_ipa_5g - [pga_gn]; - - wlc_phy_table_write_nphy( - pi, - NPHY_TBL_ID_CORE1TXPWRCTL, - 1, 576 + idx, 32, - &rfpwr_offset); - wlc_phy_table_write_nphy( - pi, - NPHY_TBL_ID_CORE2TXPWRCTL, - 1, 576 + idx, 32, - &rfpwr_offset); - } - - } - } else { - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE1TXPWRCTL, 128, - 192, 32, nphy_tpc_txgain); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE2TXPWRCTL, 128, - 192, 32, nphy_tpc_txgain); - } - - if (pi->sh->phyrxchain != 0x3) - wlc_phy_rxcore_setstate_nphy((struct brcms_phy_pub *) pi, - pi->sh->phyrxchain); - - if (PHY_PERICAL_MPHASE_PENDING(pi)) - wlc_phy_cal_perical_mphase_restart(pi); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - do_rssi_cal = (CHSPEC_IS2G(pi->radio_chanspec)) ? - (pi->nphy_rssical_chanspec_2G == 0) : - (pi->nphy_rssical_chanspec_5G == 0); - - if (do_rssi_cal) - wlc_phy_rssi_cal_nphy(pi); - else - wlc_phy_restore_rssical_nphy(pi); - } else { - wlc_phy_rssi_cal_nphy(pi); - } - - if (!SCAN_RM_IN_PROGRESS(pi)) - do_nphy_cal = (CHSPEC_IS2G(pi->radio_chanspec)) ? - (pi->nphy_iqcal_chanspec_2G == 0) : - (pi->nphy_iqcal_chanspec_5G == 0); - - if (!pi->do_initcal) - do_nphy_cal = false; - - if (do_nphy_cal) { - - target_gain = wlc_phy_get_tx_gain_nphy(pi); - - if (pi->antsel_type == ANTSEL_2x3) - wlc_phy_antsel_init((struct brcms_phy_pub *) pi, - true); - - if (pi->nphy_perical != PHY_PERICAL_MPHASE) { - wlc_phy_rssi_cal_nphy(pi); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - pi->nphy_cal_orig_pwr_idx[0] = - pi->nphy_txpwrindex[PHY_CORE_0] - . - index_internal; - pi->nphy_cal_orig_pwr_idx[1] = - pi->nphy_txpwrindex[PHY_CORE_1] - . - index_internal; - - wlc_phy_precal_txgain_nphy(pi); - target_gain = - wlc_phy_get_tx_gain_nphy(pi); - } - - if (wlc_phy_cal_txiqlo_nphy - (pi, target_gain, true, - false) == 0) { - if (wlc_phy_cal_rxiq_nphy - (pi, target_gain, 2, - false) == 0) - wlc_phy_savecal_nphy(pi); - - } - } else if (pi->mphase_cal_phase_id == - MPHASE_CAL_STATE_IDLE) { - wlc_phy_cal_perical((struct brcms_phy_pub *) pi, - PHY_PERICAL_PHYINIT); - } - } else { - wlc_phy_restorecal_nphy(pi); - } - - wlc_phy_txpwrctrl_coeff_setup_nphy(pi); - - wlc_phy_txpwrctrl_enable_nphy(pi, tx_pwr_ctrl_state); - - wlc_phy_nphy_tkip_rifs_war(pi, pi->sh->_rifs_phy); - - if (NREV_GE(pi->pubpi.phy_rev, 3) && NREV_LE(pi->pubpi.phy_rev, 6)) - - write_phy_reg(pi, 0x70, 50); - - wlc_phy_txlpfbw_nphy(pi); - - wlc_phy_spurwar_nphy(pi); - -} - -static void wlc_phy_resetcca_nphy(struct brcms_phy *pi) -{ - u16 val; - - wlapi_bmac_phyclk_fgc(pi->sh->physhim, ON); - - val = read_phy_reg(pi, 0x01); - write_phy_reg(pi, 0x01, val | BBCFG_RESETCCA); - udelay(1); - write_phy_reg(pi, 0x01, val & (~BBCFG_RESETCCA)); - - wlapi_bmac_phyclk_fgc(pi->sh->physhim, OFF); - - wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); -} - -void wlc_phy_pa_override_nphy(struct brcms_phy *pi, bool en) -{ - u16 rfctrlintc_override_val; - - if (!en) { - - pi->rfctrlIntc1_save = read_phy_reg(pi, 0x91); - pi->rfctrlIntc2_save = read_phy_reg(pi, 0x92); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - rfctrlintc_override_val = 0x1480; - else if (NREV_GE(pi->pubpi.phy_rev, 3)) - rfctrlintc_override_val = - CHSPEC_IS5G(pi->radio_chanspec) ? 0x600 : 0x480; - else - rfctrlintc_override_val = - CHSPEC_IS5G(pi->radio_chanspec) ? 0x180 : 0x120; - - write_phy_reg(pi, 0x91, rfctrlintc_override_val); - write_phy_reg(pi, 0x92, rfctrlintc_override_val); - } else { - write_phy_reg(pi, 0x91, pi->rfctrlIntc1_save); - write_phy_reg(pi, 0x92, pi->rfctrlIntc2_save); - } - -} - -void wlc_phy_stf_chain_upd_nphy(struct brcms_phy *pi) -{ - - u16 txrx_chain = - (NPHY_RfseqCoreActv_TxRxChain0 | NPHY_RfseqCoreActv_TxRxChain1); - bool CoreActv_override = false; - - if (pi->nphy_txrx_chain == BRCMS_N_TXRX_CHAIN0) { - txrx_chain = NPHY_RfseqCoreActv_TxRxChain0; - CoreActv_override = true; - - if (NREV_LE(pi->pubpi.phy_rev, 2)) - and_phy_reg(pi, 0xa0, ~0x20); - } else if (pi->nphy_txrx_chain == BRCMS_N_TXRX_CHAIN1) { - txrx_chain = NPHY_RfseqCoreActv_TxRxChain1; - CoreActv_override = true; - - if (NREV_LE(pi->pubpi.phy_rev, 2)) - or_phy_reg(pi, 0xa0, 0x20); - } - - mod_phy_reg(pi, 0xa2, ((0xf << 0) | (0xf << 4)), txrx_chain); - - if (CoreActv_override) { - pi->nphy_perical = PHY_PERICAL_DISABLE; - or_phy_reg(pi, 0xa1, NPHY_RfseqMode_CoreActv_override); - } else { - pi->nphy_perical = PHY_PERICAL_MPHASE; - and_phy_reg(pi, 0xa1, ~NPHY_RfseqMode_CoreActv_override); - } -} - -void wlc_phy_rxcore_setstate_nphy(struct brcms_phy_pub *pih, u8 rxcore_bitmask) -{ - u16 regval; - u16 tbl_buf[16]; - uint i; - struct brcms_phy *pi = (struct brcms_phy *) pih; - u16 tbl_opcode; - bool suspend; - - pi->sh->phyrxchain = rxcore_bitmask; - - if (!pi->sh->clk) - return; - - suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & - MCTL_EN_MAC)); - if (!suspend) - wlapi_suspend_mac_and_wait(pi->sh->physhim); - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - regval = read_phy_reg(pi, 0xa2); - regval &= ~(0xf << 4); - regval |= ((u16) (rxcore_bitmask & 0x3)) << 4; - write_phy_reg(pi, 0xa2, regval); - - if ((rxcore_bitmask & 0x3) != 0x3) { - - write_phy_reg(pi, 0x20e, 1); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - if (pi->rx2tx_biasentry == -1) { - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, - ARRAY_SIZE(tbl_buf), 80, - 16, tbl_buf); - - for (i = 0; i < ARRAY_SIZE(tbl_buf); i++) { - if (tbl_buf[i] == - NPHY_REV3_RFSEQ_CMD_CLR_RXRX_BIAS) { - pi->rx2tx_biasentry = (u8) i; - tbl_opcode = - NPHY_REV3_RFSEQ_CMD_NOP; - wlc_phy_table_write_nphy( - pi, - NPHY_TBL_ID_RFSEQ, - 1, i, - 16, - &tbl_opcode); - break; - } else if (tbl_buf[i] == - NPHY_REV3_RFSEQ_CMD_END) - break; - } - } - } - } else { - - write_phy_reg(pi, 0x20e, 30); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - if (pi->rx2tx_biasentry != -1) { - tbl_opcode = NPHY_REV3_RFSEQ_CMD_CLR_RXRX_BIAS; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, - 1, pi->rx2tx_biasentry, - 16, &tbl_opcode); - pi->rx2tx_biasentry = -1; - } - } - } - - wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); - - if (!suspend) - wlapi_enable_mac(pi->sh->physhim); -} - -u8 wlc_phy_rxcore_getstate_nphy(struct brcms_phy_pub *pih) -{ - u16 regval, rxen_bits; - struct brcms_phy *pi = (struct brcms_phy *) pih; - - regval = read_phy_reg(pi, 0xa2); - rxen_bits = (regval >> 4) & 0xf; - - return (u8) rxen_bits; -} - -bool wlc_phy_n_txpower_ipa_ison(struct brcms_phy *pi) -{ - return PHY_IPA(pi); -} - -void wlc_phy_cal_init_nphy(struct brcms_phy *pi) -{ -} - -static void wlc_phy_radio_preinit_205x(struct brcms_phy *pi) -{ - - and_phy_reg(pi, 0x78, ~RFCC_CHIP0_PU); - and_phy_reg(pi, 0x78, RFCC_OE_POR_FORCE); - - or_phy_reg(pi, 0x78, ~RFCC_OE_POR_FORCE); - or_phy_reg(pi, 0x78, RFCC_CHIP0_PU); - -} - -static void wlc_phy_radio_init_2057(struct brcms_phy *pi) -{ - struct radio_20xx_regs *regs_2057_ptr = NULL; - - if (NREV_IS(pi->pubpi.phy_rev, 7)) { - regs_2057_ptr = regs_2057_rev4; - } else if (NREV_IS(pi->pubpi.phy_rev, 8) - || NREV_IS(pi->pubpi.phy_rev, 9)) { - switch (pi->pubpi.radiorev) { - case 5: - - if (NREV_IS(pi->pubpi.phy_rev, 8)) - regs_2057_ptr = regs_2057_rev5; - else if (NREV_IS(pi->pubpi.phy_rev, 9)) - regs_2057_ptr = regs_2057_rev5v1; - break; - - case 7: - - regs_2057_ptr = regs_2057_rev7; - break; - - case 8: - - regs_2057_ptr = regs_2057_rev8; - break; - - default: - break; - } - } - - wlc_phy_init_radio_regs_allbands(pi, regs_2057_ptr); -} - -static u16 wlc_phy_radio205x_rcal(struct brcms_phy *pi) -{ - u16 rcal_reg = 0; - int i; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - if (pi->pubpi.radiorev == 5) { - - and_phy_reg(pi, 0x342, ~(0x1 << 1)); - - udelay(10); - - mod_radio_reg(pi, RADIO_2057_IQTEST_SEL_PU, 0x1, 0x1); - mod_radio_reg(pi, RADIO_2057v7_IQTEST_SEL_PU2, 0x2, - 0x1); - } - mod_radio_reg(pi, RADIO_2057_RCAL_CONFIG, 0x1, 0x1); - - udelay(10); - - mod_radio_reg(pi, RADIO_2057_RCAL_CONFIG, 0x3, 0x3); - - for (i = 0; i < MAX_205x_RCAL_WAITLOOPS; i++) { - rcal_reg = read_radio_reg(pi, RADIO_2057_RCAL_STATUS); - if (rcal_reg & 0x1) - break; - - udelay(100); - } - - if (WARN(i == MAX_205x_RCAL_WAITLOOPS, - "HW error: radio calib2")) - return 0; - - mod_radio_reg(pi, RADIO_2057_RCAL_CONFIG, 0x2, 0x0); - - rcal_reg = read_radio_reg(pi, RADIO_2057_RCAL_STATUS) & 0x3e; - - mod_radio_reg(pi, RADIO_2057_RCAL_CONFIG, 0x1, 0x0); - if (pi->pubpi.radiorev == 5) { - - mod_radio_reg(pi, RADIO_2057_IQTEST_SEL_PU, 0x1, 0x0); - mod_radio_reg(pi, RADIO_2057v7_IQTEST_SEL_PU2, 0x2, - 0x0); - } - - if ((pi->pubpi.radiorev <= 4) || (pi->pubpi.radiorev == 6)) { - - mod_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG, 0x3c, - rcal_reg); - mod_radio_reg(pi, RADIO_2057_BANDGAP_RCAL_TRIM, 0xf0, - rcal_reg << 2); - } - - } else if (NREV_IS(pi->pubpi.phy_rev, 3)) { - u16 savereg; - - savereg = - read_radio_reg( - pi, - RADIO_2056_SYN_PLL_MAST2 | - RADIO_2056_SYN); - write_radio_reg(pi, RADIO_2056_SYN_PLL_MAST2 | RADIO_2056_SYN, - savereg | 0x7); - udelay(10); - - write_radio_reg(pi, RADIO_2056_SYN_RCAL_MASTER | RADIO_2056_SYN, - 0x1); - udelay(10); - - write_radio_reg(pi, RADIO_2056_SYN_RCAL_MASTER | RADIO_2056_SYN, - 0x9); - - for (i = 0; i < MAX_205x_RCAL_WAITLOOPS; i++) { - rcal_reg = read_radio_reg( - pi, - RADIO_2056_SYN_RCAL_CODE_OUT | - RADIO_2056_SYN); - if (rcal_reg & 0x80) - break; - - udelay(100); - } - - if (WARN(i == MAX_205x_RCAL_WAITLOOPS, - "HW error: radio calib3")) - return 0; - - write_radio_reg(pi, RADIO_2056_SYN_RCAL_MASTER | RADIO_2056_SYN, - 0x1); - - rcal_reg = - read_radio_reg(pi, - RADIO_2056_SYN_RCAL_CODE_OUT | - RADIO_2056_SYN); - - write_radio_reg(pi, RADIO_2056_SYN_RCAL_MASTER | RADIO_2056_SYN, - 0x0); - - write_radio_reg(pi, RADIO_2056_SYN_PLL_MAST2 | RADIO_2056_SYN, - savereg); - - return rcal_reg & 0x1f; - } - return rcal_reg & 0x3e; -} - -static u16 wlc_phy_radio2057_rccal(struct brcms_phy *pi) -{ - u16 rccal_valid; - int i; - bool chip43226_6362A0; - - chip43226_6362A0 = ((pi->pubpi.radiorev == 3) - || (pi->pubpi.radiorev == 4) - || (pi->pubpi.radiorev == 6)); - - rccal_valid = 0; - if (chip43226_6362A0) { - write_radio_reg(pi, RADIO_2057_RCCAL_MASTER, 0x61); - write_radio_reg(pi, RADIO_2057_RCCAL_TRC0, 0xc0); - } else { - write_radio_reg(pi, RADIO_2057v7_RCCAL_MASTER, 0x61); - - write_radio_reg(pi, RADIO_2057_RCCAL_TRC0, 0xe9); - } - write_radio_reg(pi, RADIO_2057_RCCAL_X1, 0x6e); - write_radio_reg(pi, RADIO_2057_RCCAL_START_R1_Q1_P1, 0x55); - - for (i = 0; i < MAX_205x_RCAL_WAITLOOPS; i++) { - rccal_valid = read_radio_reg(pi, RADIO_2057_RCCAL_DONE_OSCCAP); - if (rccal_valid & 0x2) - break; - - udelay(500); - } - - write_radio_reg(pi, RADIO_2057_RCCAL_START_R1_Q1_P1, 0x15); - - rccal_valid = 0; - if (chip43226_6362A0) { - write_radio_reg(pi, RADIO_2057_RCCAL_MASTER, 0x69); - write_radio_reg(pi, RADIO_2057_RCCAL_TRC0, 0xb0); - } else { - write_radio_reg(pi, RADIO_2057v7_RCCAL_MASTER, 0x69); - - write_radio_reg(pi, RADIO_2057_RCCAL_TRC0, 0xd5); - } - write_radio_reg(pi, RADIO_2057_RCCAL_X1, 0x6e); - write_radio_reg(pi, RADIO_2057_RCCAL_START_R1_Q1_P1, 0x55); - - for (i = 0; i < MAX_205x_RCAL_WAITLOOPS; i++) { - rccal_valid = read_radio_reg(pi, RADIO_2057_RCCAL_DONE_OSCCAP); - if (rccal_valid & 0x2) - break; - - udelay(500); - } - - write_radio_reg(pi, RADIO_2057_RCCAL_START_R1_Q1_P1, 0x15); - - rccal_valid = 0; - if (chip43226_6362A0) { - write_radio_reg(pi, RADIO_2057_RCCAL_MASTER, 0x73); - - write_radio_reg(pi, RADIO_2057_RCCAL_X1, 0x28); - write_radio_reg(pi, RADIO_2057_RCCAL_TRC0, 0xb0); - } else { - write_radio_reg(pi, RADIO_2057v7_RCCAL_MASTER, 0x73); - write_radio_reg(pi, RADIO_2057_RCCAL_X1, 0x6e); - write_radio_reg(pi, RADIO_2057_RCCAL_TRC0, 0x99); - } - write_radio_reg(pi, RADIO_2057_RCCAL_START_R1_Q1_P1, 0x55); - - for (i = 0; i < MAX_205x_RCAL_WAITLOOPS; i++) { - rccal_valid = read_radio_reg(pi, RADIO_2057_RCCAL_DONE_OSCCAP); - if (rccal_valid & 0x2) - break; - - udelay(500); - } - - if (WARN(!(rccal_valid & 0x2), "HW error: radio calib4")) - return 0; - - write_radio_reg(pi, RADIO_2057_RCCAL_START_R1_Q1_P1, 0x15); - - return rccal_valid; -} - -static void wlc_phy_radio_postinit_2057(struct brcms_phy *pi) -{ - - mod_radio_reg(pi, RADIO_2057_XTALPUOVR_PINCTRL, 0x1, 0x1); - - mod_radio_reg(pi, RADIO_2057_RFPLL_MISC_CAL_RESETN, 0x78, 0x78); - mod_radio_reg(pi, RADIO_2057_XTAL_CONFIG2, 0x80, 0x80); - mdelay(2); - mod_radio_reg(pi, RADIO_2057_RFPLL_MISC_CAL_RESETN, 0x78, 0x0); - mod_radio_reg(pi, RADIO_2057_XTAL_CONFIG2, 0x80, 0x0); - - if (pi->phy_init_por) { - wlc_phy_radio205x_rcal(pi); - wlc_phy_radio2057_rccal(pi); - } - - mod_radio_reg(pi, RADIO_2057_RFPLL_MASTER, 0x8, 0x0); -} - -static void wlc_phy_radio_init_2056(struct brcms_phy *pi) -{ - const struct radio_regs *regs_SYN_2056_ptr = NULL; - const struct radio_regs *regs_TX_2056_ptr = NULL; - const struct radio_regs *regs_RX_2056_ptr = NULL; - - if (NREV_IS(pi->pubpi.phy_rev, 3)) { - regs_SYN_2056_ptr = regs_SYN_2056; - regs_TX_2056_ptr = regs_TX_2056; - regs_RX_2056_ptr = regs_RX_2056; - } else if (NREV_IS(pi->pubpi.phy_rev, 4)) { - regs_SYN_2056_ptr = regs_SYN_2056_A1; - regs_TX_2056_ptr = regs_TX_2056_A1; - regs_RX_2056_ptr = regs_RX_2056_A1; - } else { - switch (pi->pubpi.radiorev) { - case 5: - regs_SYN_2056_ptr = regs_SYN_2056_rev5; - regs_TX_2056_ptr = regs_TX_2056_rev5; - regs_RX_2056_ptr = regs_RX_2056_rev5; - break; - - case 6: - regs_SYN_2056_ptr = regs_SYN_2056_rev6; - regs_TX_2056_ptr = regs_TX_2056_rev6; - regs_RX_2056_ptr = regs_RX_2056_rev6; - break; - - case 7: - case 9: - regs_SYN_2056_ptr = regs_SYN_2056_rev7; - regs_TX_2056_ptr = regs_TX_2056_rev7; - regs_RX_2056_ptr = regs_RX_2056_rev7; - break; - - case 8: - regs_SYN_2056_ptr = regs_SYN_2056_rev8; - regs_TX_2056_ptr = regs_TX_2056_rev8; - regs_RX_2056_ptr = regs_RX_2056_rev8; - break; - - case 11: - regs_SYN_2056_ptr = regs_SYN_2056_rev11; - regs_TX_2056_ptr = regs_TX_2056_rev11; - regs_RX_2056_ptr = regs_RX_2056_rev11; - break; - - default: - break; - } - } - - wlc_phy_init_radio_regs(pi, regs_SYN_2056_ptr, (u16) RADIO_2056_SYN); - - wlc_phy_init_radio_regs(pi, regs_TX_2056_ptr, (u16) RADIO_2056_TX0); - - wlc_phy_init_radio_regs(pi, regs_TX_2056_ptr, (u16) RADIO_2056_TX1); - - wlc_phy_init_radio_regs(pi, regs_RX_2056_ptr, (u16) RADIO_2056_RX0); - - wlc_phy_init_radio_regs(pi, regs_RX_2056_ptr, (u16) RADIO_2056_RX1); -} - -static void wlc_phy_radio_postinit_2056(struct brcms_phy *pi) -{ - mod_radio_reg(pi, RADIO_2056_SYN_COM_CTRL, 0xb, 0xb); - - mod_radio_reg(pi, RADIO_2056_SYN_COM_PU, 0x2, 0x2); - mod_radio_reg(pi, RADIO_2056_SYN_COM_RESET, 0x2, 0x2); - udelay(1000); - mod_radio_reg(pi, RADIO_2056_SYN_COM_RESET, 0x2, 0x0); - - if ((pi->sh->boardflags2 & BFL2_LEGACY) - || (pi->sh->boardflags2 & BFL2_XTALBUFOUTEN)) - mod_radio_reg(pi, RADIO_2056_SYN_PLL_MAST2, 0xf4, 0x0); - else - mod_radio_reg(pi, RADIO_2056_SYN_PLL_MAST2, 0xfc, 0x0); - - mod_radio_reg(pi, RADIO_2056_SYN_RCCAL_CTRL0, 0x1, 0x0); - - if (pi->phy_init_por) - wlc_phy_radio205x_rcal(pi); -} - -static void wlc_phy_radio_preinit_2055(struct brcms_phy *pi) -{ - - and_phy_reg(pi, 0x78, ~RFCC_POR_FORCE); - or_phy_reg(pi, 0x78, RFCC_CHIP0_PU | RFCC_OE_POR_FORCE); - - or_phy_reg(pi, 0x78, RFCC_POR_FORCE); -} - -static void wlc_phy_radio_init_2055(struct brcms_phy *pi) -{ - wlc_phy_init_radio_regs(pi, regs_2055, RADIO_DEFAULT_CORE); -} - -static void wlc_phy_radio_postinit_2055(struct brcms_phy *pi) -{ - - and_radio_reg(pi, RADIO_2055_MASTER_CNTRL1, - ~(RADIO_2055_JTAGCTRL_MASK | RADIO_2055_JTAGSYNC_MASK)); - - if (((pi->sh->sromrev >= 4) - && !(pi->sh->boardflags2 & BFL2_RXBB_INT_REG_DIS)) - || ((pi->sh->sromrev < 4))) { - and_radio_reg(pi, RADIO_2055_CORE1_RXBB_REGULATOR, 0x7F); - and_radio_reg(pi, RADIO_2055_CORE2_RXBB_REGULATOR, 0x7F); - } - - mod_radio_reg(pi, RADIO_2055_RRCCAL_N_OPT_SEL, 0x3F, 0x2C); - write_radio_reg(pi, RADIO_2055_CAL_MISC, 0x3C); - - and_radio_reg(pi, RADIO_2055_CAL_MISC, - ~(RADIO_2055_RRCAL_START | RADIO_2055_RRCAL_RST_N)); - - or_radio_reg(pi, RADIO_2055_CAL_LPO_CNTRL, RADIO_2055_CAL_LPO_ENABLE); - - or_radio_reg(pi, RADIO_2055_CAL_MISC, RADIO_2055_RRCAL_RST_N); - - udelay(1000); - - or_radio_reg(pi, RADIO_2055_CAL_MISC, RADIO_2055_RRCAL_START); - - SPINWAIT(((read_radio_reg(pi, RADIO_2055_CAL_COUNTER_OUT2) & - RADIO_2055_RCAL_DONE) != RADIO_2055_RCAL_DONE), 2000); - - if (WARN((read_radio_reg(pi, RADIO_2055_CAL_COUNTER_OUT2) & - RADIO_2055_RCAL_DONE) != RADIO_2055_RCAL_DONE, - "HW error: radio calibration1\n")) - return; - - and_radio_reg(pi, RADIO_2055_CAL_LPO_CNTRL, - ~(RADIO_2055_CAL_LPO_ENABLE)); - - wlc_phy_chanspec_set((struct brcms_phy_pub *) pi, pi->radio_chanspec); - - write_radio_reg(pi, RADIO_2055_CORE1_RXBB_LPF, 9); - write_radio_reg(pi, RADIO_2055_CORE2_RXBB_LPF, 9); - - write_radio_reg(pi, RADIO_2055_CORE1_RXBB_MIDAC_HIPAS, 0x83); - write_radio_reg(pi, RADIO_2055_CORE2_RXBB_MIDAC_HIPAS, 0x83); - - mod_radio_reg(pi, RADIO_2055_CORE1_LNA_GAINBST, - RADIO_2055_GAINBST_VAL_MASK, RADIO_2055_GAINBST_CODE); - mod_radio_reg(pi, RADIO_2055_CORE2_LNA_GAINBST, - RADIO_2055_GAINBST_VAL_MASK, RADIO_2055_GAINBST_CODE); - if (pi->nphy_gain_boost) { - and_radio_reg(pi, RADIO_2055_CORE1_RXRF_SPC1, - ~(RADIO_2055_GAINBST_DISABLE)); - and_radio_reg(pi, RADIO_2055_CORE2_RXRF_SPC1, - ~(RADIO_2055_GAINBST_DISABLE)); - } else { - or_radio_reg(pi, RADIO_2055_CORE1_RXRF_SPC1, - RADIO_2055_GAINBST_DISABLE); - or_radio_reg(pi, RADIO_2055_CORE2_RXRF_SPC1, - RADIO_2055_GAINBST_DISABLE); - } - - udelay(2); -} - -void wlc_phy_switch_radio_nphy(struct brcms_phy *pi, bool on) -{ - if (on) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if (!pi->radio_is_on) { - wlc_phy_radio_preinit_205x(pi); - wlc_phy_radio_init_2057(pi); - wlc_phy_radio_postinit_2057(pi); - } - - wlc_phy_chanspec_set((struct brcms_phy_pub *) pi, - pi->radio_chanspec); - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - wlc_phy_radio_preinit_205x(pi); - wlc_phy_radio_init_2056(pi); - wlc_phy_radio_postinit_2056(pi); - - wlc_phy_chanspec_set((struct brcms_phy_pub *) pi, - pi->radio_chanspec); - } else { - wlc_phy_radio_preinit_2055(pi); - wlc_phy_radio_init_2055(pi); - wlc_phy_radio_postinit_2055(pi); - } - - pi->radio_is_on = true; - - } else { - - if (NREV_GE(pi->pubpi.phy_rev, 3) - && NREV_LT(pi->pubpi.phy_rev, 7)) { - and_phy_reg(pi, 0x78, ~RFCC_CHIP0_PU); - mod_radio_reg(pi, RADIO_2056_SYN_COM_PU, 0x2, 0x0); - - write_radio_reg(pi, - RADIO_2056_TX_PADA_BOOST_TUNE | - RADIO_2056_TX0, 0); - write_radio_reg(pi, - RADIO_2056_TX_PADG_BOOST_TUNE | - RADIO_2056_TX0, 0); - write_radio_reg(pi, - RADIO_2056_TX_PGAA_BOOST_TUNE | - RADIO_2056_TX0, 0); - write_radio_reg(pi, - RADIO_2056_TX_PGAG_BOOST_TUNE | - RADIO_2056_TX0, 0); - mod_radio_reg(pi, - RADIO_2056_TX_MIXA_BOOST_TUNE | - RADIO_2056_TX0, 0xf0, 0); - write_radio_reg(pi, - RADIO_2056_TX_MIXG_BOOST_TUNE | - RADIO_2056_TX0, 0); - - write_radio_reg(pi, - RADIO_2056_TX_PADA_BOOST_TUNE | - RADIO_2056_TX1, 0); - write_radio_reg(pi, - RADIO_2056_TX_PADG_BOOST_TUNE | - RADIO_2056_TX1, 0); - write_radio_reg(pi, - RADIO_2056_TX_PGAA_BOOST_TUNE | - RADIO_2056_TX1, 0); - write_radio_reg(pi, - RADIO_2056_TX_PGAG_BOOST_TUNE | - RADIO_2056_TX1, 0); - mod_radio_reg(pi, - RADIO_2056_TX_MIXA_BOOST_TUNE | - RADIO_2056_TX1, 0xf0, 0); - write_radio_reg(pi, - RADIO_2056_TX_MIXG_BOOST_TUNE | - RADIO_2056_TX1, 0); - - pi->radio_is_on = false; - } - - if (NREV_GE(pi->pubpi.phy_rev, 8)) { - and_phy_reg(pi, 0x78, ~RFCC_CHIP0_PU); - pi->radio_is_on = false; - } - - } -} - -static bool -wlc_phy_chan2freq_nphy(struct brcms_phy *pi, uint channel, int *f, - const struct chan_info_nphy_radio2057 **t0, - const struct chan_info_nphy_radio205x **t1, - const struct chan_info_nphy_radio2057_rev5 **t2, - const struct chan_info_nphy_2055 **t3) -{ - uint i; - const struct chan_info_nphy_radio2057 *chan_info_tbl_p_0 = NULL; - const struct chan_info_nphy_radio205x *chan_info_tbl_p_1 = NULL; - const struct chan_info_nphy_radio2057_rev5 *chan_info_tbl_p_2 = NULL; - u32 tbl_len = 0; - - int freq = 0; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - if (NREV_IS(pi->pubpi.phy_rev, 7)) { - - chan_info_tbl_p_0 = chan_info_nphyrev7_2057_rev4; - tbl_len = ARRAY_SIZE(chan_info_nphyrev7_2057_rev4); - - } else if (NREV_IS(pi->pubpi.phy_rev, 8) - || NREV_IS(pi->pubpi.phy_rev, 9)) { - switch (pi->pubpi.radiorev) { - - case 5: - - if (pi->pubpi.radiover == 0x0) { - - chan_info_tbl_p_2 = - chan_info_nphyrev8_2057_rev5; - tbl_len = ARRAY_SIZE( - chan_info_nphyrev8_2057_rev5); - - } else if (pi->pubpi.radiover == 0x1) { - - chan_info_tbl_p_2 = - chan_info_nphyrev9_2057_rev5v1; - tbl_len = ARRAY_SIZE( - chan_info_nphyrev9_2057_rev5v1); - - } - break; - - case 7: - chan_info_tbl_p_0 = - chan_info_nphyrev8_2057_rev7; - tbl_len = ARRAY_SIZE( - chan_info_nphyrev8_2057_rev7); - break; - - case 8: - chan_info_tbl_p_0 = - chan_info_nphyrev8_2057_rev8; - tbl_len = ARRAY_SIZE( - chan_info_nphyrev8_2057_rev8); - break; - - default: - break; - } - } else if (NREV_IS(pi->pubpi.phy_rev, 16)) { - - chan_info_tbl_p_0 = chan_info_nphyrev8_2057_rev8; - tbl_len = ARRAY_SIZE(chan_info_nphyrev8_2057_rev8); - } else { - goto fail; - } - - for (i = 0; i < tbl_len; i++) { - if (pi->pubpi.radiorev == 5) { - - if (chan_info_tbl_p_2[i].chan == channel) - break; - } else { - - if (chan_info_tbl_p_0[i].chan == channel) - break; - } - } - - if (i >= tbl_len) - goto fail; - - if (pi->pubpi.radiorev == 5) { - *t2 = &chan_info_tbl_p_2[i]; - freq = chan_info_tbl_p_2[i].freq; - } else { - *t0 = &chan_info_tbl_p_0[i]; - freq = chan_info_tbl_p_0[i].freq; - } - - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - if (NREV_IS(pi->pubpi.phy_rev, 3)) { - chan_info_tbl_p_1 = chan_info_nphyrev3_2056; - tbl_len = ARRAY_SIZE(chan_info_nphyrev3_2056); - } else if (NREV_IS(pi->pubpi.phy_rev, 4)) { - chan_info_tbl_p_1 = chan_info_nphyrev4_2056_A1; - tbl_len = ARRAY_SIZE(chan_info_nphyrev4_2056_A1); - } else if (NREV_IS(pi->pubpi.phy_rev, 5) - || NREV_IS(pi->pubpi.phy_rev, 6)) { - switch (pi->pubpi.radiorev) { - case 5: - chan_info_tbl_p_1 = chan_info_nphyrev5_2056v5; - tbl_len = ARRAY_SIZE(chan_info_nphyrev5_2056v5); - break; - case 6: - chan_info_tbl_p_1 = chan_info_nphyrev6_2056v6; - tbl_len = ARRAY_SIZE(chan_info_nphyrev6_2056v6); - break; - case 7: - case 9: - chan_info_tbl_p_1 = chan_info_nphyrev5n6_2056v7; - tbl_len = - ARRAY_SIZE(chan_info_nphyrev5n6_2056v7); - break; - case 8: - chan_info_tbl_p_1 = chan_info_nphyrev6_2056v8; - tbl_len = ARRAY_SIZE(chan_info_nphyrev6_2056v8); - break; - case 11: - chan_info_tbl_p_1 = chan_info_nphyrev6_2056v11; - tbl_len = ARRAY_SIZE( - chan_info_nphyrev6_2056v11); - break; - default: - break; - } - } - - for (i = 0; i < tbl_len; i++) { - if (chan_info_tbl_p_1[i].chan == channel) - break; - } - - if (i >= tbl_len) - goto fail; - - *t1 = &chan_info_tbl_p_1[i]; - freq = chan_info_tbl_p_1[i].freq; - - } else { - for (i = 0; i < ARRAY_SIZE(chan_info_nphy_2055); i++) - if (chan_info_nphy_2055[i].chan == channel) - break; - - if (i >= ARRAY_SIZE(chan_info_nphy_2055)) - goto fail; - - *t3 = &chan_info_nphy_2055[i]; - freq = chan_info_nphy_2055[i].freq; - } - - *f = freq; - return true; - -fail: - *f = WL_CHAN_FREQ_RANGE_2G; - return false; -} - -u8 wlc_phy_get_chan_freq_range_nphy(struct brcms_phy *pi, uint channel) -{ - int freq; - const struct chan_info_nphy_radio2057 *t0 = NULL; - const struct chan_info_nphy_radio205x *t1 = NULL; - const struct chan_info_nphy_radio2057_rev5 *t2 = NULL; - const struct chan_info_nphy_2055 *t3 = NULL; - - if (channel == 0) - channel = CHSPEC_CHANNEL(pi->radio_chanspec); - - wlc_phy_chan2freq_nphy(pi, channel, &freq, &t0, &t1, &t2, &t3); - - if (CHSPEC_IS2G(pi->radio_chanspec)) - return WL_CHAN_FREQ_RANGE_2G; - - if ((freq >= BASE_LOW_5G_CHAN) && (freq < BASE_MID_5G_CHAN)) - return WL_CHAN_FREQ_RANGE_5GL; - else if ((freq >= BASE_MID_5G_CHAN) && (freq < BASE_HIGH_5G_CHAN)) - return WL_CHAN_FREQ_RANGE_5GM; - else - return WL_CHAN_FREQ_RANGE_5GH; -} - -static void -wlc_phy_chanspec_radio2055_setup(struct brcms_phy *pi, - const struct chan_info_nphy_2055 *ci) -{ - - write_radio_reg(pi, RADIO_2055_PLL_REF, ci->RF_pll_ref); - write_radio_reg(pi, RADIO_2055_RF_PLL_MOD0, ci->RF_rf_pll_mod0); - write_radio_reg(pi, RADIO_2055_RF_PLL_MOD1, ci->RF_rf_pll_mod1); - write_radio_reg(pi, RADIO_2055_VCO_CAP_TAIL, ci->RF_vco_cap_tail); - - BRCMS_PHY_WAR_PR51571(pi); - - write_radio_reg(pi, RADIO_2055_VCO_CAL1, ci->RF_vco_cal1); - write_radio_reg(pi, RADIO_2055_VCO_CAL2, ci->RF_vco_cal2); - write_radio_reg(pi, RADIO_2055_PLL_LF_C1, ci->RF_pll_lf_c1); - write_radio_reg(pi, RADIO_2055_PLL_LF_R1, ci->RF_pll_lf_r1); - - BRCMS_PHY_WAR_PR51571(pi); - - write_radio_reg(pi, RADIO_2055_PLL_LF_C2, ci->RF_pll_lf_c2); - write_radio_reg(pi, RADIO_2055_LGBUF_CEN_BUF, ci->RF_lgbuf_cen_buf); - write_radio_reg(pi, RADIO_2055_LGEN_TUNE1, ci->RF_lgen_tune1); - write_radio_reg(pi, RADIO_2055_LGEN_TUNE2, ci->RF_lgen_tune2); - - BRCMS_PHY_WAR_PR51571(pi); - - write_radio_reg(pi, RADIO_2055_CORE1_LGBUF_A_TUNE, - ci->RF_core1_lgbuf_a_tune); - write_radio_reg(pi, RADIO_2055_CORE1_LGBUF_G_TUNE, - ci->RF_core1_lgbuf_g_tune); - write_radio_reg(pi, RADIO_2055_CORE1_RXRF_REG1, ci->RF_core1_rxrf_reg1); - write_radio_reg(pi, RADIO_2055_CORE1_TX_PGA_PAD_TN, - ci->RF_core1_tx_pga_pad_tn); - - BRCMS_PHY_WAR_PR51571(pi); - - write_radio_reg(pi, RADIO_2055_CORE1_TX_MX_BGTRIM, - ci->RF_core1_tx_mx_bgtrim); - write_radio_reg(pi, RADIO_2055_CORE2_LGBUF_A_TUNE, - ci->RF_core2_lgbuf_a_tune); - write_radio_reg(pi, RADIO_2055_CORE2_LGBUF_G_TUNE, - ci->RF_core2_lgbuf_g_tune); - write_radio_reg(pi, RADIO_2055_CORE2_RXRF_REG1, ci->RF_core2_rxrf_reg1); - - BRCMS_PHY_WAR_PR51571(pi); - - write_radio_reg(pi, RADIO_2055_CORE2_TX_PGA_PAD_TN, - ci->RF_core2_tx_pga_pad_tn); - write_radio_reg(pi, RADIO_2055_CORE2_TX_MX_BGTRIM, - ci->RF_core2_tx_mx_bgtrim); - - udelay(50); - - write_radio_reg(pi, RADIO_2055_VCO_CAL10, 0x05); - write_radio_reg(pi, RADIO_2055_VCO_CAL10, 0x45); - - BRCMS_PHY_WAR_PR51571(pi); - - write_radio_reg(pi, RADIO_2055_VCO_CAL10, 0x65); - - udelay(300); -} - -static void -wlc_phy_chanspec_radio2056_setup(struct brcms_phy *pi, - const struct chan_info_nphy_radio205x *ci) -{ - const struct radio_regs *regs_SYN_2056_ptr = NULL; - - write_radio_reg(pi, - RADIO_2056_SYN_PLL_VCOCAL1 | RADIO_2056_SYN, - ci->RF_SYN_pll_vcocal1); - write_radio_reg(pi, RADIO_2056_SYN_PLL_VCOCAL2 | RADIO_2056_SYN, - ci->RF_SYN_pll_vcocal2); - write_radio_reg(pi, RADIO_2056_SYN_PLL_REFDIV | RADIO_2056_SYN, - ci->RF_SYN_pll_refdiv); - write_radio_reg(pi, RADIO_2056_SYN_PLL_MMD2 | RADIO_2056_SYN, - ci->RF_SYN_pll_mmd2); - write_radio_reg(pi, RADIO_2056_SYN_PLL_MMD1 | RADIO_2056_SYN, - ci->RF_SYN_pll_mmd1); - write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER1 | RADIO_2056_SYN, - ci->RF_SYN_pll_loopfilter1); - write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER2 | RADIO_2056_SYN, - ci->RF_SYN_pll_loopfilter2); - write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER3 | RADIO_2056_SYN, - ci->RF_SYN_pll_loopfilter3); - write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER4 | RADIO_2056_SYN, - ci->RF_SYN_pll_loopfilter4); - write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER5 | RADIO_2056_SYN, - ci->RF_SYN_pll_loopfilter5); - write_radio_reg(pi, RADIO_2056_SYN_RESERVED_ADDR27 | RADIO_2056_SYN, - ci->RF_SYN_reserved_addr27); - write_radio_reg(pi, RADIO_2056_SYN_RESERVED_ADDR28 | RADIO_2056_SYN, - ci->RF_SYN_reserved_addr28); - write_radio_reg(pi, RADIO_2056_SYN_RESERVED_ADDR29 | RADIO_2056_SYN, - ci->RF_SYN_reserved_addr29); - write_radio_reg(pi, RADIO_2056_SYN_LOGEN_VCOBUF1 | RADIO_2056_SYN, - ci->RF_SYN_logen_VCOBUF1); - write_radio_reg(pi, RADIO_2056_SYN_LOGEN_MIXER2 | RADIO_2056_SYN, - ci->RF_SYN_logen_MIXER2); - write_radio_reg(pi, RADIO_2056_SYN_LOGEN_BUF3 | RADIO_2056_SYN, - ci->RF_SYN_logen_BUF3); - write_radio_reg(pi, RADIO_2056_SYN_LOGEN_BUF4 | RADIO_2056_SYN, - ci->RF_SYN_logen_BUF4); - - write_radio_reg(pi, - RADIO_2056_RX_LNAA_TUNE | RADIO_2056_RX0, - ci->RF_RX0_lnaa_tune); - write_radio_reg(pi, RADIO_2056_RX_LNAG_TUNE | RADIO_2056_RX0, - ci->RF_RX0_lnag_tune); - write_radio_reg(pi, RADIO_2056_TX_INTPAA_BOOST_TUNE | RADIO_2056_TX0, - ci->RF_TX0_intpaa_boost_tune); - write_radio_reg(pi, RADIO_2056_TX_INTPAG_BOOST_TUNE | RADIO_2056_TX0, - ci->RF_TX0_intpag_boost_tune); - write_radio_reg(pi, RADIO_2056_TX_PADA_BOOST_TUNE | RADIO_2056_TX0, - ci->RF_TX0_pada_boost_tune); - write_radio_reg(pi, RADIO_2056_TX_PADG_BOOST_TUNE | RADIO_2056_TX0, - ci->RF_TX0_padg_boost_tune); - write_radio_reg(pi, RADIO_2056_TX_PGAA_BOOST_TUNE | RADIO_2056_TX0, - ci->RF_TX0_pgaa_boost_tune); - write_radio_reg(pi, RADIO_2056_TX_PGAG_BOOST_TUNE | RADIO_2056_TX0, - ci->RF_TX0_pgag_boost_tune); - write_radio_reg(pi, RADIO_2056_TX_MIXA_BOOST_TUNE | RADIO_2056_TX0, - ci->RF_TX0_mixa_boost_tune); - write_radio_reg(pi, RADIO_2056_TX_MIXG_BOOST_TUNE | RADIO_2056_TX0, - ci->RF_TX0_mixg_boost_tune); - - write_radio_reg(pi, - RADIO_2056_RX_LNAA_TUNE | RADIO_2056_RX1, - ci->RF_RX1_lnaa_tune); - write_radio_reg(pi, RADIO_2056_RX_LNAG_TUNE | RADIO_2056_RX1, - ci->RF_RX1_lnag_tune); - write_radio_reg(pi, RADIO_2056_TX_INTPAA_BOOST_TUNE | RADIO_2056_TX1, - ci->RF_TX1_intpaa_boost_tune); - write_radio_reg(pi, RADIO_2056_TX_INTPAG_BOOST_TUNE | RADIO_2056_TX1, - ci->RF_TX1_intpag_boost_tune); - write_radio_reg(pi, RADIO_2056_TX_PADA_BOOST_TUNE | RADIO_2056_TX1, - ci->RF_TX1_pada_boost_tune); - write_radio_reg(pi, RADIO_2056_TX_PADG_BOOST_TUNE | RADIO_2056_TX1, - ci->RF_TX1_padg_boost_tune); - write_radio_reg(pi, RADIO_2056_TX_PGAA_BOOST_TUNE | RADIO_2056_TX1, - ci->RF_TX1_pgaa_boost_tune); - write_radio_reg(pi, RADIO_2056_TX_PGAG_BOOST_TUNE | RADIO_2056_TX1, - ci->RF_TX1_pgag_boost_tune); - write_radio_reg(pi, RADIO_2056_TX_MIXA_BOOST_TUNE | RADIO_2056_TX1, - ci->RF_TX1_mixa_boost_tune); - write_radio_reg(pi, RADIO_2056_TX_MIXG_BOOST_TUNE | RADIO_2056_TX1, - ci->RF_TX1_mixg_boost_tune); - - if (NREV_IS(pi->pubpi.phy_rev, 3)) - regs_SYN_2056_ptr = regs_SYN_2056; - else if (NREV_IS(pi->pubpi.phy_rev, 4)) - regs_SYN_2056_ptr = regs_SYN_2056_A1; - else { - switch (pi->pubpi.radiorev) { - case 5: - regs_SYN_2056_ptr = regs_SYN_2056_rev5; - break; - case 6: - regs_SYN_2056_ptr = regs_SYN_2056_rev6; - break; - case 7: - case 9: - regs_SYN_2056_ptr = regs_SYN_2056_rev7; - break; - case 8: - regs_SYN_2056_ptr = regs_SYN_2056_rev8; - break; - case 11: - regs_SYN_2056_ptr = regs_SYN_2056_rev11; - break; - } - } - if (CHSPEC_IS2G(pi->radio_chanspec)) - write_radio_reg(pi, RADIO_2056_SYN_PLL_CP2 | - RADIO_2056_SYN, - (u16) regs_SYN_2056_ptr[0x49 - 2].init_g); - else - write_radio_reg(pi, RADIO_2056_SYN_PLL_CP2 | - RADIO_2056_SYN, - (u16) regs_SYN_2056_ptr[0x49 - 2].init_a); - - if (pi->sh->boardflags2 & BFL2_GPLL_WAR) { - if (CHSPEC_IS2G(pi->radio_chanspec)) { - write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER1 | - RADIO_2056_SYN, 0x1f); - write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER2 | - RADIO_2056_SYN, 0x1f); - - if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) || - (pi->sh->chip == BCMA_CHIP_ID_BCM47162)) { - write_radio_reg(pi, - RADIO_2056_SYN_PLL_LOOPFILTER4 | - RADIO_2056_SYN, 0x14); - write_radio_reg(pi, - RADIO_2056_SYN_PLL_CP2 | - RADIO_2056_SYN, 0x00); - } else { - write_radio_reg(pi, - RADIO_2056_SYN_PLL_LOOPFILTER4 | - RADIO_2056_SYN, 0xb); - write_radio_reg(pi, - RADIO_2056_SYN_PLL_CP2 | - RADIO_2056_SYN, 0x14); - } - } - } - - if ((pi->sh->boardflags2 & BFL2_GPLL_WAR2) && - (CHSPEC_IS2G(pi->radio_chanspec))) { - write_radio_reg(pi, - RADIO_2056_SYN_PLL_LOOPFILTER1 | RADIO_2056_SYN, - 0x1f); - write_radio_reg(pi, - RADIO_2056_SYN_PLL_LOOPFILTER2 | RADIO_2056_SYN, - 0x1f); - write_radio_reg(pi, - RADIO_2056_SYN_PLL_LOOPFILTER4 | RADIO_2056_SYN, - 0xb); - write_radio_reg(pi, RADIO_2056_SYN_PLL_CP2 | RADIO_2056_SYN, - 0x20); - } - - if (pi->sh->boardflags2 & BFL2_APLL_WAR) { - if (CHSPEC_IS5G(pi->radio_chanspec)) { - write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER1 | - RADIO_2056_SYN, 0x1f); - write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER2 | - RADIO_2056_SYN, 0x1f); - write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER4 | - RADIO_2056_SYN, 0x5); - write_radio_reg(pi, RADIO_2056_SYN_PLL_CP2 | - RADIO_2056_SYN, 0xc); - } - } - - if (PHY_IPA(pi) && CHSPEC_IS2G(pi->radio_chanspec)) { - u16 pag_boost_tune; - u16 padg_boost_tune; - u16 pgag_boost_tune; - u16 mixg_boost_tune; - u16 bias, cascbias; - uint core; - - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - - if (NREV_GE(pi->pubpi.phy_rev, 5)) { - - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - PADG_IDAC, 0xcc); - - if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) || - (pi->sh->chip == BCMA_CHIP_ID_BCM47162)) { - bias = 0x40; - cascbias = 0x45; - pag_boost_tune = 0x5; - pgag_boost_tune = 0x33; - padg_boost_tune = 0x77; - mixg_boost_tune = 0x55; - } else { - bias = 0x25; - cascbias = 0x20; - - if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224 || - pi->sh->chip == BCMA_CHIP_ID_BCM43225) && - pi->sh->chippkg == BCMA_PKG_ID_BCM43224_FAB_SMIC) { - bias = 0x2a; - cascbias = 0x38; - } - - pag_boost_tune = 0x4; - pgag_boost_tune = 0x03; - padg_boost_tune = 0x77; - mixg_boost_tune = 0x65; - } - - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAG_IMAIN_STAT, bias); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAG_IAUX_STAT, bias); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAG_CASCBIAS, cascbias); - - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAG_BOOST_TUNE, - pag_boost_tune); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - PGAG_BOOST_TUNE, - pgag_boost_tune); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - PADG_BOOST_TUNE, - padg_boost_tune); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - MIXG_BOOST_TUNE, - mixg_boost_tune); - } else { - - bias = (pi->bw == WL_CHANSPEC_BW_40) ? - 0x40 : 0x20; - - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAG_IMAIN_STAT, bias); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAG_IAUX_STAT, bias); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAG_CASCBIAS, 0x30); - } - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, PA_SPARE1, - 0xee); - } - } - - if (PHY_IPA(pi) && NREV_IS(pi->pubpi.phy_rev, 6) - && CHSPEC_IS5G(pi->radio_chanspec)) { - u16 paa_boost_tune; - u16 pada_boost_tune; - u16 pgaa_boost_tune; - u16 mixa_boost_tune; - u16 freq, pabias, cascbias; - uint core; - - freq = CHAN5G_FREQ(CHSPEC_CHANNEL(pi->radio_chanspec)); - - if (freq < 5150) { - - paa_boost_tune = 0xa; - pada_boost_tune = 0x77; - pgaa_boost_tune = 0xf; - mixa_boost_tune = 0xf; - } else if (freq < 5340) { - - paa_boost_tune = 0x8; - pada_boost_tune = 0x77; - pgaa_boost_tune = 0xfb; - mixa_boost_tune = 0xf; - } else if (freq < 5650) { - - paa_boost_tune = 0x0; - pada_boost_tune = 0x77; - pgaa_boost_tune = 0xb; - mixa_boost_tune = 0xf; - } else { - - paa_boost_tune = 0x0; - pada_boost_tune = 0x77; - if (freq != 5825) - pgaa_boost_tune = -(int)(freq - 18) / 36 + 168; - else - pgaa_boost_tune = 6; - - mixa_boost_tune = 0xf; - } - - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAA_BOOST_TUNE, paa_boost_tune); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - PADA_BOOST_TUNE, pada_boost_tune); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - PGAA_BOOST_TUNE, pgaa_boost_tune); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - MIXA_BOOST_TUNE, mixa_boost_tune); - - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - TXSPARE1, 0x30); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - PA_SPARE2, 0xee); - - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - PADA_CASCBIAS, 0x3); - - cascbias = 0x30; - - if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224 || - pi->sh->chip == BCMA_CHIP_ID_BCM43225) && - pi->sh->chippkg == BCMA_PKG_ID_BCM43224_FAB_SMIC) - cascbias = 0x35; - - pabias = (pi->phy_pabias == 0) ? 0x30 : pi->phy_pabias; - - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAA_IAUX_STAT, pabias); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAA_IMAIN_STAT, pabias); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAA_CASCBIAS, cascbias); - } - } - - udelay(50); - - wlc_phy_radio205x_vcocal_nphy(pi); -} - -void wlc_phy_radio205x_vcocal_nphy(struct brcms_phy *pi) -{ - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - mod_radio_reg(pi, RADIO_2057_RFPLL_MISC_EN, 0x01, 0x0); - mod_radio_reg(pi, RADIO_2057_RFPLL_MISC_CAL_RESETN, 0x04, 0x0); - mod_radio_reg(pi, RADIO_2057_RFPLL_MISC_CAL_RESETN, 0x04, - (1 << 2)); - mod_radio_reg(pi, RADIO_2057_RFPLL_MISC_EN, 0x01, 0x01); - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - write_radio_reg(pi, RADIO_2056_SYN_PLL_VCOCAL12, 0x0); - write_radio_reg(pi, RADIO_2056_SYN_PLL_MAST3, 0x38); - write_radio_reg(pi, RADIO_2056_SYN_PLL_MAST3, 0x18); - write_radio_reg(pi, RADIO_2056_SYN_PLL_MAST3, 0x38); - write_radio_reg(pi, RADIO_2056_SYN_PLL_MAST3, 0x39); - } - - udelay(300); -} - -static void -wlc_phy_chanspec_radio2057_setup( - struct brcms_phy *pi, - const struct chan_info_nphy_radio2057 *ci, - const struct chan_info_nphy_radio2057_rev5 * - ci2) -{ - int coreNum; - u16 txmix2g_tune_boost_pu = 0; - u16 pad2g_tune_pus = 0; - - if (pi->pubpi.radiorev == 5) { - - write_radio_reg(pi, - RADIO_2057_VCOCAL_COUNTVAL0, - ci2->RF_vcocal_countval0); - write_radio_reg(pi, RADIO_2057_VCOCAL_COUNTVAL1, - ci2->RF_vcocal_countval1); - write_radio_reg(pi, RADIO_2057_RFPLL_REFMASTER_SPAREXTALSIZE, - ci2->RF_rfpll_refmaster_sparextalsize); - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_R1, - ci2->RF_rfpll_loopfilter_r1); - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C2, - ci2->RF_rfpll_loopfilter_c2); - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C1, - ci2->RF_rfpll_loopfilter_c1); - write_radio_reg(pi, RADIO_2057_CP_KPD_IDAC, - ci2->RF_cp_kpd_idac); - write_radio_reg(pi, RADIO_2057_RFPLL_MMD0, ci2->RF_rfpll_mmd0); - write_radio_reg(pi, RADIO_2057_RFPLL_MMD1, ci2->RF_rfpll_mmd1); - write_radio_reg(pi, - RADIO_2057_VCOBUF_TUNE, ci2->RF_vcobuf_tune); - write_radio_reg(pi, - RADIO_2057_LOGEN_MX2G_TUNE, - ci2->RF_logen_mx2g_tune); - write_radio_reg(pi, RADIO_2057_LOGEN_INDBUF2G_TUNE, - ci2->RF_logen_indbuf2g_tune); - - write_radio_reg(pi, - RADIO_2057_TXMIX2G_TUNE_BOOST_PU_CORE0, - ci2->RF_txmix2g_tune_boost_pu_core0); - write_radio_reg(pi, - RADIO_2057_PAD2G_TUNE_PUS_CORE0, - ci2->RF_pad2g_tune_pus_core0); - write_radio_reg(pi, RADIO_2057_LNA2G_TUNE_CORE0, - ci2->RF_lna2g_tune_core0); - - write_radio_reg(pi, - RADIO_2057_TXMIX2G_TUNE_BOOST_PU_CORE1, - ci2->RF_txmix2g_tune_boost_pu_core1); - write_radio_reg(pi, - RADIO_2057_PAD2G_TUNE_PUS_CORE1, - ci2->RF_pad2g_tune_pus_core1); - write_radio_reg(pi, RADIO_2057_LNA2G_TUNE_CORE1, - ci2->RF_lna2g_tune_core1); - - } else { - - write_radio_reg(pi, - RADIO_2057_VCOCAL_COUNTVAL0, - ci->RF_vcocal_countval0); - write_radio_reg(pi, RADIO_2057_VCOCAL_COUNTVAL1, - ci->RF_vcocal_countval1); - write_radio_reg(pi, RADIO_2057_RFPLL_REFMASTER_SPAREXTALSIZE, - ci->RF_rfpll_refmaster_sparextalsize); - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_R1, - ci->RF_rfpll_loopfilter_r1); - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C2, - ci->RF_rfpll_loopfilter_c2); - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C1, - ci->RF_rfpll_loopfilter_c1); - write_radio_reg(pi, RADIO_2057_CP_KPD_IDAC, ci->RF_cp_kpd_idac); - write_radio_reg(pi, RADIO_2057_RFPLL_MMD0, ci->RF_rfpll_mmd0); - write_radio_reg(pi, RADIO_2057_RFPLL_MMD1, ci->RF_rfpll_mmd1); - write_radio_reg(pi, RADIO_2057_VCOBUF_TUNE, ci->RF_vcobuf_tune); - write_radio_reg(pi, - RADIO_2057_LOGEN_MX2G_TUNE, - ci->RF_logen_mx2g_tune); - write_radio_reg(pi, RADIO_2057_LOGEN_MX5G_TUNE, - ci->RF_logen_mx5g_tune); - write_radio_reg(pi, RADIO_2057_LOGEN_INDBUF2G_TUNE, - ci->RF_logen_indbuf2g_tune); - write_radio_reg(pi, RADIO_2057_LOGEN_INDBUF5G_TUNE, - ci->RF_logen_indbuf5g_tune); - - write_radio_reg(pi, - RADIO_2057_TXMIX2G_TUNE_BOOST_PU_CORE0, - ci->RF_txmix2g_tune_boost_pu_core0); - write_radio_reg(pi, - RADIO_2057_PAD2G_TUNE_PUS_CORE0, - ci->RF_pad2g_tune_pus_core0); - write_radio_reg(pi, RADIO_2057_PGA_BOOST_TUNE_CORE0, - ci->RF_pga_boost_tune_core0); - write_radio_reg(pi, RADIO_2057_TXMIX5G_BOOST_TUNE_CORE0, - ci->RF_txmix5g_boost_tune_core0); - write_radio_reg(pi, RADIO_2057_PAD5G_TUNE_MISC_PUS_CORE0, - ci->RF_pad5g_tune_misc_pus_core0); - write_radio_reg(pi, RADIO_2057_LNA2G_TUNE_CORE0, - ci->RF_lna2g_tune_core0); - write_radio_reg(pi, RADIO_2057_LNA5G_TUNE_CORE0, - ci->RF_lna5g_tune_core0); - - write_radio_reg(pi, - RADIO_2057_TXMIX2G_TUNE_BOOST_PU_CORE1, - ci->RF_txmix2g_tune_boost_pu_core1); - write_radio_reg(pi, - RADIO_2057_PAD2G_TUNE_PUS_CORE1, - ci->RF_pad2g_tune_pus_core1); - write_radio_reg(pi, RADIO_2057_PGA_BOOST_TUNE_CORE1, - ci->RF_pga_boost_tune_core1); - write_radio_reg(pi, RADIO_2057_TXMIX5G_BOOST_TUNE_CORE1, - ci->RF_txmix5g_boost_tune_core1); - write_radio_reg(pi, RADIO_2057_PAD5G_TUNE_MISC_PUS_CORE1, - ci->RF_pad5g_tune_misc_pus_core1); - write_radio_reg(pi, RADIO_2057_LNA2G_TUNE_CORE1, - ci->RF_lna2g_tune_core1); - write_radio_reg(pi, RADIO_2057_LNA5G_TUNE_CORE1, - ci->RF_lna5g_tune_core1); - } - - if ((pi->pubpi.radiorev <= 4) || (pi->pubpi.radiorev == 6)) { - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_R1, - 0x3f); - write_radio_reg(pi, RADIO_2057_CP_KPD_IDAC, 0x3f); - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C1, - 0x8); - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C2, - 0x8); - } else { - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_R1, - 0x1f); - write_radio_reg(pi, RADIO_2057_CP_KPD_IDAC, 0x3f); - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C1, - 0x8); - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C2, - 0x8); - } - } else if ((pi->pubpi.radiorev == 5) || (pi->pubpi.radiorev == 7) || - (pi->pubpi.radiorev == 8)) { - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_R1, - 0x1b); - write_radio_reg(pi, RADIO_2057_CP_KPD_IDAC, 0x30); - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C1, - 0xa); - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C2, - 0xa); - } else { - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_R1, - 0x1f); - write_radio_reg(pi, RADIO_2057_CP_KPD_IDAC, 0x3f); - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C1, - 0x8); - write_radio_reg(pi, RADIO_2057_RFPLL_LOOPFILTER_C2, - 0x8); - } - - } - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if (PHY_IPA(pi)) { - if (pi->pubpi.radiorev == 3) - txmix2g_tune_boost_pu = 0x6b; - - if (pi->pubpi.radiorev == 5) - pad2g_tune_pus = 0x73; - - } else { - if (pi->pubpi.radiorev != 5) { - pad2g_tune_pus = 0x3; - - txmix2g_tune_boost_pu = 0x61; - } - } - - for (coreNum = 0; coreNum <= 1; coreNum++) { - - if (txmix2g_tune_boost_pu != 0) - WRITE_RADIO_REG4(pi, RADIO_2057, CORE, coreNum, - TXMIX2G_TUNE_BOOST_PU, - txmix2g_tune_boost_pu); - - if (pad2g_tune_pus != 0) - WRITE_RADIO_REG4(pi, RADIO_2057, CORE, coreNum, - PAD2G_TUNE_PUS, - pad2g_tune_pus); - } - } - - udelay(50); - - wlc_phy_radio205x_vcocal_nphy(pi); -} - -static void -wlc_phy_chanspec_nphy_setup(struct brcms_phy *pi, u16 chanspec, - const struct nphy_sfo_cfg *ci) -{ - u16 val; - - val = read_phy_reg(pi, 0x09) & NPHY_BandControl_currentBand; - if (CHSPEC_IS5G(chanspec) && !val) { - - val = bcma_read16(pi->d11core, D11REGOFFS(psm_phy_hdr_param)); - bcma_write16(pi->d11core, D11REGOFFS(psm_phy_hdr_param), - (val | MAC_PHY_FORCE_CLK)); - - or_phy_reg(pi, (NPHY_TO_BPHY_OFF + BPHY_BB_CONFIG), - (BBCFG_RESETCCA | BBCFG_RESETRX)); - - bcma_write16(pi->d11core, D11REGOFFS(psm_phy_hdr_param), val); - - or_phy_reg(pi, 0x09, NPHY_BandControl_currentBand); - } else if (!CHSPEC_IS5G(chanspec) && val) { - - and_phy_reg(pi, 0x09, ~NPHY_BandControl_currentBand); - - val = bcma_read16(pi->d11core, D11REGOFFS(psm_phy_hdr_param)); - bcma_write16(pi->d11core, D11REGOFFS(psm_phy_hdr_param), - (val | MAC_PHY_FORCE_CLK)); - - and_phy_reg(pi, (NPHY_TO_BPHY_OFF + BPHY_BB_CONFIG), - (u16) (~(BBCFG_RESETCCA | BBCFG_RESETRX))); - - bcma_write16(pi->d11core, D11REGOFFS(psm_phy_hdr_param), val); - } - - write_phy_reg(pi, 0x1ce, ci->PHY_BW1a); - write_phy_reg(pi, 0x1cf, ci->PHY_BW2); - write_phy_reg(pi, 0x1d0, ci->PHY_BW3); - - write_phy_reg(pi, 0x1d1, ci->PHY_BW4); - write_phy_reg(pi, 0x1d2, ci->PHY_BW5); - write_phy_reg(pi, 0x1d3, ci->PHY_BW6); - - if (CHSPEC_CHANNEL(pi->radio_chanspec) == 14) { - wlc_phy_classifier_nphy(pi, NPHY_ClassifierCtrl_ofdm_en, 0); - - or_phy_reg(pi, NPHY_TO_BPHY_OFF + BPHY_TEST, 0x800); - } else { - wlc_phy_classifier_nphy(pi, NPHY_ClassifierCtrl_ofdm_en, - NPHY_ClassifierCtrl_ofdm_en); - - if (CHSPEC_IS2G(chanspec)) - and_phy_reg(pi, NPHY_TO_BPHY_OFF + BPHY_TEST, ~0x840); - } - - if (pi->nphy_txpwrctrl == PHY_TPC_HW_OFF) - wlc_phy_txpwr_fixpower_nphy(pi); - - if (NREV_LT(pi->pubpi.phy_rev, 3)) - wlc_phy_adjust_lnagaintbl_nphy(pi); - - wlc_phy_txlpfbw_nphy(pi); - - if (NREV_GE(pi->pubpi.phy_rev, 3) - && (pi->phy_spuravoid != SPURAVOID_DISABLE)) { - u8 spuravoid = 0; - - val = CHSPEC_CHANNEL(chanspec); - if (!CHSPEC_IS40(pi->radio_chanspec)) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if ((val == 13) || (val == 14) || (val == 153)) - spuravoid = 1; - } else if (((val >= 5) && (val <= 8)) || (val == 13) - || (val == 14)) { - spuravoid = 1; - } - } else if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if (val == 54) - spuravoid = 1; - } else if (pi->nphy_aband_spurwar_en && - ((val == 38) || (val == 102) || (val == 118))) { - if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) - && (pi->sh->chippkg == BCMA_PKG_ID_BCM4717)) { - spuravoid = 0; - } else { - spuravoid = 1; - } - } - - if (pi->phy_spuravoid == SPURAVOID_FORCEON) - spuravoid = 1; - - if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) || - (pi->sh->chip == BCMA_CHIP_ID_BCM43225)) { - bcma_pmu_spuravoid_pllupdate(&pi->d11core->bus->drv_cc, - spuravoid); - } else { - wlapi_bmac_core_phypll_ctl(pi->sh->physhim, false); - bcma_pmu_spuravoid_pllupdate(&pi->d11core->bus->drv_cc, - spuravoid); - wlapi_bmac_core_phypll_ctl(pi->sh->physhim, true); - } - - if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) || - (pi->sh->chip == BCMA_CHIP_ID_BCM43225)) { - if (spuravoid == 1) { - bcma_write16(pi->d11core, - D11REGOFFS(tsf_clk_frac_l), - 0x5341); - bcma_write16(pi->d11core, - D11REGOFFS(tsf_clk_frac_h), 0x8); - } else { - bcma_write16(pi->d11core, - D11REGOFFS(tsf_clk_frac_l), - 0x8889); - bcma_write16(pi->d11core, - D11REGOFFS(tsf_clk_frac_h), 0x8); - } - } - - if (!((pi->sh->chip == BCMA_CHIP_ID_BCM4716) || - (pi->sh->chip == BCMA_CHIP_ID_BCM47162))) - wlapi_bmac_core_phypll_reset(pi->sh->physhim); - - mod_phy_reg(pi, 0x01, (0x1 << 15), - ((spuravoid > 0) ? (0x1 << 15) : 0)); - - wlc_phy_resetcca_nphy(pi); - - pi->phy_isspuravoid = (spuravoid > 0); - } - - if (NREV_LT(pi->pubpi.phy_rev, 7)) - write_phy_reg(pi, 0x17e, 0x3830); - - wlc_phy_spurwar_nphy(pi); -} - -void wlc_phy_chanspec_set_nphy(struct brcms_phy *pi, u16 chanspec) -{ - int freq; - const struct chan_info_nphy_radio2057 *t0 = NULL; - const struct chan_info_nphy_radio205x *t1 = NULL; - const struct chan_info_nphy_radio2057_rev5 *t2 = NULL; - const struct chan_info_nphy_2055 *t3 = NULL; - - if (!wlc_phy_chan2freq_nphy - (pi, CHSPEC_CHANNEL(chanspec), &freq, &t0, &t1, &t2, &t3)) - return; - - wlc_phy_chanspec_radio_set((struct brcms_phy_pub *) pi, chanspec); - - if (CHSPEC_BW(chanspec) != pi->bw) - wlapi_bmac_bw_set(pi->sh->physhim, CHSPEC_BW(chanspec)); - - if (CHSPEC_IS40(chanspec)) { - if (CHSPEC_SB_UPPER(chanspec)) { - or_phy_reg(pi, 0xa0, BPHY_BAND_SEL_UP20); - if (NREV_GE(pi->pubpi.phy_rev, 7)) - or_phy_reg(pi, 0x310, PRIM_SEL_UP20); - } else { - and_phy_reg(pi, 0xa0, ~BPHY_BAND_SEL_UP20); - if (NREV_GE(pi->pubpi.phy_rev, 7)) - and_phy_reg(pi, 0x310, - (~PRIM_SEL_UP20 & 0xffff)); - } - } - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - if ((pi->pubpi.radiorev <= 4) - || (pi->pubpi.radiorev == 6)) { - mod_radio_reg(pi, RADIO_2057_TIA_CONFIG_CORE0, - 0x2, - (CHSPEC_IS5G(chanspec) ? (1 << 1) - : 0)); - mod_radio_reg(pi, RADIO_2057_TIA_CONFIG_CORE1, - 0x2, - (CHSPEC_IS5G(chanspec) ? (1 << 1) - : 0)); - } - - wlc_phy_chanspec_radio2057_setup(pi, t0, t2); - wlc_phy_chanspec_nphy_setup(pi, chanspec, - (pi->pubpi.radiorev == 5) ? - (const struct nphy_sfo_cfg *)&(t2->PHY_BW1a) : - (const struct nphy_sfo_cfg *)&(t0->PHY_BW1a)); - - } else { - - mod_radio_reg(pi, - RADIO_2056_SYN_COM_CTRL | RADIO_2056_SYN, - 0x4, - (CHSPEC_IS5G(chanspec) ? (0x1 << 2) : 0)); - wlc_phy_chanspec_radio2056_setup(pi, t1); - - wlc_phy_chanspec_nphy_setup(pi, chanspec, - (const struct nphy_sfo_cfg *) &(t1->PHY_BW1a)); - } - - } else { - - mod_radio_reg(pi, RADIO_2055_MASTER_CNTRL1, 0x70, - (CHSPEC_IS5G(chanspec) ? (0x02 << 4) - : (0x05 << 4))); - - wlc_phy_chanspec_radio2055_setup(pi, t3); - wlc_phy_chanspec_nphy_setup(pi, chanspec, - (const struct nphy_sfo_cfg *) - &(t3->PHY_BW1a)); - } - -} - -void wlc_phy_antsel_init(struct brcms_phy_pub *ppi, bool lut_init) -{ - struct brcms_phy *pi = (struct brcms_phy *) ppi; - u16 mask = 0xfc00; - u32 mc = 0; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - return; - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - u16 v0 = 0x211, v1 = 0x222, v2 = 0x144, v3 = 0x188; - - if (!lut_init) - return; - - if (pi->srom_fem2g.antswctrllut == 0) { - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 1, 0x02, 16, &v0); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 1, 0x03, 16, &v1); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 1, 0x08, 16, &v2); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 1, 0x0C, 16, &v3); - } - - if (pi->srom_fem5g.antswctrllut == 0) { - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 1, 0x12, 16, &v0); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 1, 0x13, 16, &v1); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 1, 0x18, 16, &v2); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_ANTSWCTRLLUT, - 1, 0x1C, 16, &v3); - } - } else { - - write_phy_reg(pi, 0xc8, 0x0); - write_phy_reg(pi, 0xc9, 0x0); - - bcma_chipco_gpio_control(&pi->d11core->bus->drv_cc, mask, mask); - - mc = bcma_read32(pi->d11core, D11REGOFFS(maccontrol)); - mc &= ~MCTL_GPOUT_SEL_MASK; - bcma_write32(pi->d11core, D11REGOFFS(maccontrol), mc); - - bcma_set16(pi->d11core, D11REGOFFS(psm_gpio_oe), mask); - - bcma_mask16(pi->d11core, D11REGOFFS(psm_gpio_out), ~mask); - - if (lut_init) { - write_phy_reg(pi, 0xf8, 0x02d8); - write_phy_reg(pi, 0xf9, 0x0301); - write_phy_reg(pi, 0xfa, 0x02d8); - write_phy_reg(pi, 0xfb, 0x0301); - } - } -} - -u16 wlc_phy_classifier_nphy(struct brcms_phy *pi, u16 mask, u16 val) -{ - u16 curr_ctl, new_ctl; - bool suspended = false; - - if (D11REV_IS(pi->sh->corerev, 16)) { - suspended = (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & - MCTL_EN_MAC) ? false : true; - if (!suspended) - wlapi_suspend_mac_and_wait(pi->sh->physhim); - } - - curr_ctl = read_phy_reg(pi, 0xb0) & (0x7 << 0); - - new_ctl = (curr_ctl & (~mask)) | (val & mask); - - mod_phy_reg(pi, 0xb0, (0x7 << 0), new_ctl); - - if (D11REV_IS(pi->sh->corerev, 16) && !suspended) - wlapi_enable_mac(pi->sh->physhim); - - return new_ctl; -} - -void wlc_phy_force_rfseq_nphy(struct brcms_phy *pi, u8 cmd) -{ - u16 trigger_mask, status_mask; - u16 orig_RfseqCoreActv; - - switch (cmd) { - case NPHY_RFSEQ_RX2TX: - trigger_mask = NPHY_RfseqTrigger_rx2tx; - status_mask = NPHY_RfseqStatus_rx2tx; - break; - case NPHY_RFSEQ_TX2RX: - trigger_mask = NPHY_RfseqTrigger_tx2rx; - status_mask = NPHY_RfseqStatus_tx2rx; - break; - case NPHY_RFSEQ_RESET2RX: - trigger_mask = NPHY_RfseqTrigger_reset2rx; - status_mask = NPHY_RfseqStatus_reset2rx; - break; - case NPHY_RFSEQ_UPDATEGAINH: - trigger_mask = NPHY_RfseqTrigger_updategainh; - status_mask = NPHY_RfseqStatus_updategainh; - break; - case NPHY_RFSEQ_UPDATEGAINL: - trigger_mask = NPHY_RfseqTrigger_updategainl; - status_mask = NPHY_RfseqStatus_updategainl; - break; - case NPHY_RFSEQ_UPDATEGAINU: - trigger_mask = NPHY_RfseqTrigger_updategainu; - status_mask = NPHY_RfseqStatus_updategainu; - break; - default: - return; - } - - orig_RfseqCoreActv = read_phy_reg(pi, 0xa1); - or_phy_reg(pi, 0xa1, - (NPHY_RfseqMode_CoreActv_override | - NPHY_RfseqMode_Trigger_override)); - or_phy_reg(pi, 0xa3, trigger_mask); - SPINWAIT((read_phy_reg(pi, 0xa4) & status_mask), 200000); - write_phy_reg(pi, 0xa1, orig_RfseqCoreActv); - WARN(read_phy_reg(pi, 0xa4) & status_mask, "HW error in rf"); -} - -static void -wlc_phy_rfctrl_override_1tomany_nphy(struct brcms_phy *pi, u16 cmd, u16 value, - u8 core_mask, u8 off) -{ - u16 rfmxgain = 0, lpfgain = 0; - u16 tgain = 0; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - switch (cmd) { - case NPHY_REV7_RfctrlOverride_cmd_rxrf_pu: - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 5), - value, core_mask, off, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 4), value, - core_mask, off, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 3), value, - core_mask, off, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - break; - case NPHY_REV7_RfctrlOverride_cmd_rx_pu: - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 2), - value, core_mask, off, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 1), value, - core_mask, off, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 0), value, - core_mask, off, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 1), value, - core_mask, off, - NPHY_REV7_RFCTRLOVERRIDE_ID2); - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 11), 0, - core_mask, off, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - break; - case NPHY_REV7_RfctrlOverride_cmd_tx_pu: - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 2), - value, core_mask, off, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 1), value, - core_mask, off, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 0), value, - core_mask, off, - NPHY_REV7_RFCTRLOVERRIDE_ID2); - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 2), value, - core_mask, off, - NPHY_REV7_RFCTRLOVERRIDE_ID2); - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 11), 1, - core_mask, off, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - break; - case NPHY_REV7_RfctrlOverride_cmd_rxgain: - rfmxgain = value & 0x000ff; - lpfgain = value & 0x0ff00; - lpfgain = lpfgain >> 8; - - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 11), - rfmxgain, core_mask, - off, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x3 << 13), - lpfgain, core_mask, - off, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - break; - case NPHY_REV7_RfctrlOverride_cmd_txgain: - tgain = value & 0x7fff; - lpfgain = value & 0x8000; - lpfgain = lpfgain >> 14; - - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 12), - tgain, core_mask, off, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 13), - lpfgain, core_mask, - off, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - break; - } - } -} - -static void -wlc_phy_scale_offset_rssi_nphy(struct brcms_phy *pi, u16 scale, s8 offset, - u8 coresel, u8 rail, u8 rssi_type) -{ - u16 valuetostuff; - - offset = (offset > NPHY_RSSICAL_MAXREAD) ? - NPHY_RSSICAL_MAXREAD : offset; - offset = (offset < (-NPHY_RSSICAL_MAXREAD - 1)) ? - -NPHY_RSSICAL_MAXREAD - 1 : offset; - - valuetostuff = ((scale & 0x3f) << 8) | (offset & 0x3f); - - if (((coresel == RADIO_MIMO_CORESEL_CORE1) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_NB)) - write_phy_reg(pi, 0x1a6, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE1) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_NB)) - write_phy_reg(pi, 0x1ac, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE2) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_NB)) - write_phy_reg(pi, 0x1b2, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE2) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_NB)) - write_phy_reg(pi, 0x1b8, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE1) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_W1)) - write_phy_reg(pi, 0x1a4, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE1) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_W1)) - write_phy_reg(pi, 0x1aa, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE2) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_W1)) - write_phy_reg(pi, 0x1b0, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE2) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_W1)) - write_phy_reg(pi, 0x1b6, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE1) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_W2)) - write_phy_reg(pi, 0x1a5, valuetostuff); - if (((coresel == RADIO_MIMO_CORESEL_CORE1) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_W2)) - write_phy_reg(pi, 0x1ab, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE2) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_W2)) - write_phy_reg(pi, 0x1b1, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE2) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_W2)) - write_phy_reg(pi, 0x1b7, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE1) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_TBD)) - write_phy_reg(pi, 0x1a7, valuetostuff); - if (((coresel == RADIO_MIMO_CORESEL_CORE1) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_TBD)) - write_phy_reg(pi, 0x1ad, valuetostuff); - if (((coresel == RADIO_MIMO_CORESEL_CORE2) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_TBD)) - write_phy_reg(pi, 0x1b3, valuetostuff); - if (((coresel == RADIO_MIMO_CORESEL_CORE2) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_TBD)) - write_phy_reg(pi, 0x1b9, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE1) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_IQ)) - write_phy_reg(pi, 0x1a8, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE1) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_IQ)) - write_phy_reg(pi, 0x1ae, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE2) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_I) && (rssi_type == NPHY_RSSI_SEL_IQ)) - write_phy_reg(pi, 0x1b4, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE2) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rail == NPHY_RAIL_Q) && (rssi_type == NPHY_RSSI_SEL_IQ)) - write_phy_reg(pi, 0x1ba, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE1) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rssi_type == NPHY_RSSI_SEL_TSSI_2G)) - write_phy_reg(pi, 0x1a9, valuetostuff); - if (((coresel == RADIO_MIMO_CORESEL_CORE2) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rssi_type == NPHY_RSSI_SEL_TSSI_2G)) - write_phy_reg(pi, 0x1b5, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE1) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rssi_type == NPHY_RSSI_SEL_TSSI_5G)) - write_phy_reg(pi, 0x1af, valuetostuff); - - if (((coresel == RADIO_MIMO_CORESEL_CORE2) || - (coresel == RADIO_MIMO_CORESEL_ALLRX)) && - (rssi_type == NPHY_RSSI_SEL_TSSI_5G)) - write_phy_reg(pi, 0x1bb, valuetostuff); -} - -static void brcms_phy_wr_tx_mux(struct brcms_phy *pi, u8 core) -{ - if (PHY_IPA(pi)) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) - write_radio_reg(pi, - ((core == PHY_CORE_0) ? - RADIO_2057_TX0_TX_SSI_MUX : - RADIO_2057_TX1_TX_SSI_MUX), - (CHSPEC_IS5G(pi->radio_chanspec) ? - 0xc : 0xe)); - else - write_radio_reg(pi, - RADIO_2056_TX_TX_SSI_MUX | - ((core == PHY_CORE_0) ? - RADIO_2056_TX0 : RADIO_2056_TX1), - (CHSPEC_IS5G(pi->radio_chanspec) ? - 0xc : 0xe)); - } else { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - write_radio_reg(pi, - ((core == PHY_CORE_0) ? - RADIO_2057_TX0_TX_SSI_MUX : - RADIO_2057_TX1_TX_SSI_MUX), - 0x11); - - if (pi->pubpi.radioid == BCM2057_ID) - write_radio_reg(pi, - RADIO_2057_IQTEST_SEL_PU, 0x1); - - } else { - write_radio_reg(pi, - RADIO_2056_TX_TX_SSI_MUX | - ((core == PHY_CORE_0) ? - RADIO_2056_TX0 : RADIO_2056_TX1), - 0x11); - } - } -} - -void wlc_phy_rssisel_nphy(struct brcms_phy *pi, u8 core_code, u8 rssi_type) -{ - u16 mask, val; - u16 afectrlovr_rssi_val, rfctrlcmd_rxen_val, rfctrlcmd_coresel_val, - startseq; - u16 rfctrlovr_rssi_val, rfctrlovr_rxen_val, rfctrlovr_coresel_val, - rfctrlovr_trigger_val; - u16 afectrlovr_rssi_mask, rfctrlcmd_mask, rfctrlovr_mask; - u16 rfctrlcmd_val, rfctrlovr_val; - u8 core; - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - if (core_code == RADIO_MIMO_CORESEL_OFF) { - mod_phy_reg(pi, 0x8f, (0x1 << 9), 0); - mod_phy_reg(pi, 0xa5, (0x1 << 9), 0); - - mod_phy_reg(pi, 0xa6, (0x3 << 8), 0); - mod_phy_reg(pi, 0xa7, (0x3 << 8), 0); - - mod_phy_reg(pi, 0xe5, (0x1 << 5), 0); - mod_phy_reg(pi, 0xe6, (0x1 << 5), 0); - - mask = (0x1 << 2) | - (0x1 << 3) | (0x1 << 4) | (0x1 << 5); - mod_phy_reg(pi, 0xf9, mask, 0); - mod_phy_reg(pi, 0xfb, mask, 0); - - } else { - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - if (core_code == RADIO_MIMO_CORESEL_CORE1 - && core == PHY_CORE_1) - continue; - else if (core_code == RADIO_MIMO_CORESEL_CORE2 - && core == PHY_CORE_0) - continue; - - mod_phy_reg(pi, (core == PHY_CORE_0) ? - 0x8f : 0xa5, (0x1 << 9), 1 << 9); - - if (rssi_type == NPHY_RSSI_SEL_W1 || - rssi_type == NPHY_RSSI_SEL_W2 || - rssi_type == NPHY_RSSI_SEL_NB) { - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0xa6 : 0xa7, - (0x3 << 8), 0); - - mask = (0x1 << 2) | - (0x1 << 3) | - (0x1 << 4) | (0x1 << 5); - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0xf9 : 0xfb, - mask, 0); - - if (rssi_type == NPHY_RSSI_SEL_W1) { - if (CHSPEC_IS5G( - pi->radio_chanspec)) { - mask = (0x1 << 2); - val = 1 << 2; - } else { - mask = (0x1 << 3); - val = 1 << 3; - } - } else if (rssi_type == - NPHY_RSSI_SEL_W2) { - mask = (0x1 << 4); - val = 1 << 4; - } else { - mask = (0x1 << 5); - val = 1 << 5; - } - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0xf9 : 0xfb, - mask, val); - - mask = (0x1 << 5); - val = 1 << 5; - mod_phy_reg(pi, (core == PHY_CORE_0) ? - 0xe5 : 0xe6, mask, val); - } else { - if (rssi_type == NPHY_RSSI_SEL_TBD) { - mask = (0x3 << 8); - val = 1 << 8; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0xa6 - : 0xa7, mask, val); - mask = (0x3 << 10); - val = 1 << 10; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0xa6 - : 0xa7, mask, val); - } else if (rssi_type == - NPHY_RSSI_SEL_IQ) { - mask = (0x3 << 8); - val = 2 << 8; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0xa6 - : 0xa7, mask, val); - mask = (0x3 << 10); - val = 2 << 10; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0xa6 - : 0xa7, mask, val); - } else { - mask = (0x3 << 8); - val = 3 << 8; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0xa6 - : 0xa7, mask, val); - mask = (0x3 << 10); - val = 3 << 10; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0xa6 - : 0xa7, mask, val); - brcms_phy_wr_tx_mux(pi, core); - afectrlovr_rssi_val = 1 << 9; - mod_phy_reg(pi, - (core == - PHY_CORE_0) ? 0x8f - : 0xa5, (0x1 << 9), - afectrlovr_rssi_val); - } - } - } - } - } else { - - if ((rssi_type == NPHY_RSSI_SEL_W1) || - (rssi_type == NPHY_RSSI_SEL_W2) || - (rssi_type == NPHY_RSSI_SEL_NB)) - val = 0x0; - else if (rssi_type == NPHY_RSSI_SEL_TBD) - val = 0x1; - else if (rssi_type == NPHY_RSSI_SEL_IQ) - val = 0x2; - else - val = 0x3; - - mask = ((0x3 << 12) | (0x3 << 14)); - val = (val << 12) | (val << 14); - mod_phy_reg(pi, 0xa6, mask, val); - mod_phy_reg(pi, 0xa7, mask, val); - - if ((rssi_type == NPHY_RSSI_SEL_W1) || - (rssi_type == NPHY_RSSI_SEL_W2) || - (rssi_type == NPHY_RSSI_SEL_NB)) { - if (rssi_type == NPHY_RSSI_SEL_W1) - val = 0x1; - if (rssi_type == NPHY_RSSI_SEL_W2) - val = 0x2; - if (rssi_type == NPHY_RSSI_SEL_NB) - val = 0x3; - - mask = (0x3 << 4); - val = (val << 4); - mod_phy_reg(pi, 0x7a, mask, val); - mod_phy_reg(pi, 0x7d, mask, val); - } - - if (core_code == RADIO_MIMO_CORESEL_OFF) { - afectrlovr_rssi_val = 0; - rfctrlcmd_rxen_val = 0; - rfctrlcmd_coresel_val = 0; - rfctrlovr_rssi_val = 0; - rfctrlovr_rxen_val = 0; - rfctrlovr_coresel_val = 0; - rfctrlovr_trigger_val = 0; - startseq = 0; - } else { - afectrlovr_rssi_val = 1; - rfctrlcmd_rxen_val = 1; - rfctrlcmd_coresel_val = core_code; - rfctrlovr_rssi_val = 1; - rfctrlovr_rxen_val = 1; - rfctrlovr_coresel_val = 1; - rfctrlovr_trigger_val = 1; - startseq = 1; - } - - afectrlovr_rssi_mask = ((0x1 << 12) | (0x1 << 13)); - afectrlovr_rssi_val = (afectrlovr_rssi_val << - 12) | (afectrlovr_rssi_val << 13); - mod_phy_reg(pi, 0xa5, afectrlovr_rssi_mask, - afectrlovr_rssi_val); - - if ((rssi_type == NPHY_RSSI_SEL_W1) || - (rssi_type == NPHY_RSSI_SEL_W2) || - (rssi_type == NPHY_RSSI_SEL_NB)) { - rfctrlcmd_mask = ((0x1 << 8) | (0x7 << 3)); - rfctrlcmd_val = (rfctrlcmd_rxen_val << 8) | - (rfctrlcmd_coresel_val << 3); - - rfctrlovr_mask = ((0x1 << 5) | - (0x1 << 12) | - (0x1 << 1) | (0x1 << 0)); - rfctrlovr_val = (rfctrlovr_rssi_val << - 5) | - (rfctrlovr_rxen_val << 12) | - (rfctrlovr_coresel_val << 1) | - (rfctrlovr_trigger_val << 0); - - mod_phy_reg(pi, 0x78, rfctrlcmd_mask, rfctrlcmd_val); - mod_phy_reg(pi, 0xec, rfctrlovr_mask, rfctrlovr_val); - - mod_phy_reg(pi, 0x78, (0x1 << 0), (startseq << 0)); - udelay(20); - - mod_phy_reg(pi, 0xec, (0x1 << 0), 0); - } - } -} - -int -wlc_phy_poll_rssi_nphy(struct brcms_phy *pi, u8 rssi_type, s32 *rssi_buf, - u8 nsamps) -{ - s16 rssi0, rssi1; - u16 afectrlCore1_save = 0; - u16 afectrlCore2_save = 0; - u16 afectrlOverride1_save = 0; - u16 afectrlOverride2_save = 0; - u16 rfctrlOverrideAux0_save = 0; - u16 rfctrlOverrideAux1_save = 0; - u16 rfctrlMiscReg1_save = 0; - u16 rfctrlMiscReg2_save = 0; - u16 rfctrlcmd_save = 0; - u16 rfctrloverride_save = 0; - u16 rfctrlrssiothers1_save = 0; - u16 rfctrlrssiothers2_save = 0; - s8 tmp_buf[4]; - u8 ctr = 0, samp = 0; - s32 rssi_out_val; - u16 gpiosel_orig; - - afectrlCore1_save = read_phy_reg(pi, 0xa6); - afectrlCore2_save = read_phy_reg(pi, 0xa7); - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - rfctrlMiscReg1_save = read_phy_reg(pi, 0xf9); - rfctrlMiscReg2_save = read_phy_reg(pi, 0xfb); - afectrlOverride1_save = read_phy_reg(pi, 0x8f); - afectrlOverride2_save = read_phy_reg(pi, 0xa5); - rfctrlOverrideAux0_save = read_phy_reg(pi, 0xe5); - rfctrlOverrideAux1_save = read_phy_reg(pi, 0xe6); - } else { - afectrlOverride1_save = read_phy_reg(pi, 0xa5); - rfctrlcmd_save = read_phy_reg(pi, 0x78); - rfctrloverride_save = read_phy_reg(pi, 0xec); - rfctrlrssiothers1_save = read_phy_reg(pi, 0x7a); - rfctrlrssiothers2_save = read_phy_reg(pi, 0x7d); - } - - wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_ALLRX, rssi_type); - - gpiosel_orig = read_phy_reg(pi, 0xca); - if (NREV_LT(pi->pubpi.phy_rev, 2)) - write_phy_reg(pi, 0xca, 5); - - for (ctr = 0; ctr < 4; ctr++) - rssi_buf[ctr] = 0; - - for (samp = 0; samp < nsamps; samp++) { - if (NREV_LT(pi->pubpi.phy_rev, 2)) { - rssi0 = read_phy_reg(pi, 0x1c9); - rssi1 = read_phy_reg(pi, 0x1ca); - } else { - rssi0 = read_phy_reg(pi, 0x219); - rssi1 = read_phy_reg(pi, 0x21a); - } - - ctr = 0; - tmp_buf[ctr++] = ((s8) ((rssi0 & 0x3f) << 2)) >> 2; - tmp_buf[ctr++] = ((s8) (((rssi0 >> 8) & 0x3f) << 2)) >> 2; - tmp_buf[ctr++] = ((s8) ((rssi1 & 0x3f) << 2)) >> 2; - tmp_buf[ctr++] = ((s8) (((rssi1 >> 8) & 0x3f) << 2)) >> 2; - - for (ctr = 0; ctr < 4; ctr++) - rssi_buf[ctr] += tmp_buf[ctr]; - - } - - rssi_out_val = rssi_buf[3] & 0xff; - rssi_out_val |= (rssi_buf[2] & 0xff) << 8; - rssi_out_val |= (rssi_buf[1] & 0xff) << 16; - rssi_out_val |= (rssi_buf[0] & 0xff) << 24; - - if (NREV_LT(pi->pubpi.phy_rev, 2)) - write_phy_reg(pi, 0xca, gpiosel_orig); - - write_phy_reg(pi, 0xa6, afectrlCore1_save); - write_phy_reg(pi, 0xa7, afectrlCore2_save); - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - write_phy_reg(pi, 0xf9, rfctrlMiscReg1_save); - write_phy_reg(pi, 0xfb, rfctrlMiscReg2_save); - write_phy_reg(pi, 0x8f, afectrlOverride1_save); - write_phy_reg(pi, 0xa5, afectrlOverride2_save); - write_phy_reg(pi, 0xe5, rfctrlOverrideAux0_save); - write_phy_reg(pi, 0xe6, rfctrlOverrideAux1_save); - } else { - write_phy_reg(pi, 0xa5, afectrlOverride1_save); - write_phy_reg(pi, 0x78, rfctrlcmd_save); - write_phy_reg(pi, 0xec, rfctrloverride_save); - write_phy_reg(pi, 0x7a, rfctrlrssiothers1_save); - write_phy_reg(pi, 0x7d, rfctrlrssiothers2_save); - } - - return rssi_out_val; -} - -s16 wlc_phy_tempsense_nphy(struct brcms_phy *pi) -{ - u16 core1_txrf_iqcal1_save, core1_txrf_iqcal2_save; - u16 core2_txrf_iqcal1_save, core2_txrf_iqcal2_save; - u16 pwrdet_rxtx_core1_save; - u16 pwrdet_rxtx_core2_save; - u16 afectrlCore1_save; - u16 afectrlCore2_save; - u16 afectrlOverride_save; - u16 afectrlOverride2_save; - u16 pd_pll_ts_save; - u16 gpioSel_save; - s32 radio_temp[4]; - s32 radio_temp2[4]; - u16 syn_tempprocsense_save; - s16 offset = 0; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - u16 auxADC_Vmid, auxADC_Av, auxADC_Vmid_save, auxADC_Av_save; - u16 auxADC_rssi_ctrlL_save, auxADC_rssi_ctrlH_save; - u16 auxADC_rssi_ctrlL, auxADC_rssi_ctrlH; - s32 auxADC_Vl; - u16 RfctrlOverride5_save, RfctrlOverride6_save; - u16 RfctrlMiscReg5_save, RfctrlMiscReg6_save; - u16 RSSIMultCoef0QPowerDet_save; - u16 tempsense_Rcal; - - syn_tempprocsense_save = - read_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG); - - afectrlCore1_save = read_phy_reg(pi, 0xa6); - afectrlCore2_save = read_phy_reg(pi, 0xa7); - afectrlOverride_save = read_phy_reg(pi, 0x8f); - afectrlOverride2_save = read_phy_reg(pi, 0xa5); - RSSIMultCoef0QPowerDet_save = read_phy_reg(pi, 0x1ae); - RfctrlOverride5_save = read_phy_reg(pi, 0x346); - RfctrlOverride6_save = read_phy_reg(pi, 0x347); - RfctrlMiscReg5_save = read_phy_reg(pi, 0x344); - RfctrlMiscReg6_save = read_phy_reg(pi, 0x345); - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0A, 16, - &auxADC_Vmid_save); - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0E, 16, - &auxADC_Av_save); - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x02, 16, - &auxADC_rssi_ctrlL_save); - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x03, 16, - &auxADC_rssi_ctrlH_save); - - write_phy_reg(pi, 0x1ae, 0x0); - - auxADC_rssi_ctrlL = 0x0; - auxADC_rssi_ctrlH = 0x20; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x02, 16, - &auxADC_rssi_ctrlL); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x03, 16, - &auxADC_rssi_ctrlH); - - tempsense_Rcal = syn_tempprocsense_save & 0x1c; - - write_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG, - tempsense_Rcal | 0x01); - - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 1), - 1, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID2); - mod_phy_reg(pi, 0xa6, (0x1 << 7), 0); - mod_phy_reg(pi, 0xa7, (0x1 << 7), 0); - mod_phy_reg(pi, 0x8f, (0x1 << 7), (0x1 << 7)); - mod_phy_reg(pi, 0xa5, (0x1 << 7), (0x1 << 7)); - - mod_phy_reg(pi, 0xa6, (0x1 << 2), (0x1 << 2)); - mod_phy_reg(pi, 0xa7, (0x1 << 2), (0x1 << 2)); - mod_phy_reg(pi, 0x8f, (0x1 << 2), (0x1 << 2)); - mod_phy_reg(pi, 0xa5, (0x1 << 2), (0x1 << 2)); - udelay(5); - mod_phy_reg(pi, 0xa6, (0x1 << 2), 0); - mod_phy_reg(pi, 0xa7, (0x1 << 2), 0); - mod_phy_reg(pi, 0xa6, (0x1 << 3), 0); - mod_phy_reg(pi, 0xa7, (0x1 << 3), 0); - mod_phy_reg(pi, 0x8f, (0x1 << 3), (0x1 << 3)); - mod_phy_reg(pi, 0xa5, (0x1 << 3), (0x1 << 3)); - mod_phy_reg(pi, 0xa6, (0x1 << 6), 0); - mod_phy_reg(pi, 0xa7, (0x1 << 6), 0); - mod_phy_reg(pi, 0x8f, (0x1 << 6), (0x1 << 6)); - mod_phy_reg(pi, 0xa5, (0x1 << 6), (0x1 << 6)); - - auxADC_Vmid = 0xA3; - auxADC_Av = 0x0; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0A, 16, - &auxADC_Vmid); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0E, 16, - &auxADC_Av); - - udelay(3); - - wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp, 1); - write_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG, - tempsense_Rcal | 0x03); - - udelay(5); - wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp2, 1); - - auxADC_Av = 0x7; - if (radio_temp[1] + radio_temp2[1] < -30) { - auxADC_Vmid = 0x45; - auxADC_Vl = 263; - } else if (radio_temp[1] + radio_temp2[1] < -9) { - auxADC_Vmid = 0x200; - auxADC_Vl = 467; - } else if (radio_temp[1] + radio_temp2[1] < 11) { - auxADC_Vmid = 0x266; - auxADC_Vl = 634; - } else { - auxADC_Vmid = 0x2D5; - auxADC_Vl = 816; - } - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0A, 16, - &auxADC_Vmid); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0E, 16, - &auxADC_Av); - - udelay(3); - - wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp2, 1); - write_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG, - tempsense_Rcal | 0x01); - - udelay(5); - wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp, 1); - - write_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG, - syn_tempprocsense_save); - - write_phy_reg(pi, 0xa6, afectrlCore1_save); - write_phy_reg(pi, 0xa7, afectrlCore2_save); - write_phy_reg(pi, 0x8f, afectrlOverride_save); - write_phy_reg(pi, 0xa5, afectrlOverride2_save); - write_phy_reg(pi, 0x1ae, RSSIMultCoef0QPowerDet_save); - write_phy_reg(pi, 0x346, RfctrlOverride5_save); - write_phy_reg(pi, 0x347, RfctrlOverride6_save); - write_phy_reg(pi, 0x344, RfctrlMiscReg5_save); - write_phy_reg(pi, 0x345, RfctrlMiscReg5_save); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0A, 16, - &auxADC_Vmid_save); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x0E, 16, - &auxADC_Av_save); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x02, 16, - &auxADC_rssi_ctrlL_save); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x03, 16, - &auxADC_rssi_ctrlH_save); - - if (pi->sh->chip == BCMA_CHIP_ID_BCM5357) { - radio_temp[0] = (193 * (radio_temp[1] + radio_temp2[1]) - + 88 * (auxADC_Vl) - 27111 + - 128) / 256; - } else { - radio_temp[0] = (179 * (radio_temp[1] + radio_temp2[1]) - + 82 * (auxADC_Vl) - 28861 + - 128) / 256; - } - - offset = (s16) pi->phy_tempsense_offset; - - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - syn_tempprocsense_save = - read_radio_reg(pi, RADIO_2056_SYN_TEMPPROCSENSE); - - afectrlCore1_save = read_phy_reg(pi, 0xa6); - afectrlCore2_save = read_phy_reg(pi, 0xa7); - afectrlOverride_save = read_phy_reg(pi, 0x8f); - afectrlOverride2_save = read_phy_reg(pi, 0xa5); - gpioSel_save = read_phy_reg(pi, 0xca); - - write_radio_reg(pi, RADIO_2056_SYN_TEMPPROCSENSE, 0x01); - - wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp, 1); - if (NREV_LT(pi->pubpi.phy_rev, 7)) - write_radio_reg(pi, RADIO_2056_SYN_TEMPPROCSENSE, 0x05); - - wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp2, 1); - if (NREV_GE(pi->pubpi.phy_rev, 7)) - write_radio_reg(pi, RADIO_2057_TEMPSENSE_CONFIG, 0x01); - else - write_radio_reg(pi, RADIO_2056_SYN_TEMPPROCSENSE, 0x01); - - radio_temp[0] = - (126 * (radio_temp[1] + radio_temp2[1]) + 3987) / 64; - - write_radio_reg(pi, RADIO_2056_SYN_TEMPPROCSENSE, - syn_tempprocsense_save); - - write_phy_reg(pi, 0xca, gpioSel_save); - write_phy_reg(pi, 0xa6, afectrlCore1_save); - write_phy_reg(pi, 0xa7, afectrlCore2_save); - write_phy_reg(pi, 0x8f, afectrlOverride_save); - write_phy_reg(pi, 0xa5, afectrlOverride2_save); - - offset = (s16) pi->phy_tempsense_offset; - } else { - - pwrdet_rxtx_core1_save = - read_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE1); - pwrdet_rxtx_core2_save = - read_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE2); - core1_txrf_iqcal1_save = - read_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL1); - core1_txrf_iqcal2_save = - read_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL2); - core2_txrf_iqcal1_save = - read_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL1); - core2_txrf_iqcal2_save = - read_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL2); - pd_pll_ts_save = read_radio_reg(pi, RADIO_2055_PD_PLL_TS); - - afectrlCore1_save = read_phy_reg(pi, 0xa6); - afectrlCore2_save = read_phy_reg(pi, 0xa7); - afectrlOverride_save = read_phy_reg(pi, 0xa5); - gpioSel_save = read_phy_reg(pi, 0xca); - - write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL1, 0x01); - write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL1, 0x01); - write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL2, 0x08); - write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL2, 0x08); - write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE1, 0x04); - write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE2, 0x04); - write_radio_reg(pi, RADIO_2055_PD_PLL_TS, 0x00); - - wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp, 1); - xor_radio_reg(pi, RADIO_2055_CAL_TS, 0x80); - - wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp, 1); - xor_radio_reg(pi, RADIO_2055_CAL_TS, 0x80); - - wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_IQ, radio_temp2, 1); - xor_radio_reg(pi, RADIO_2055_CAL_TS, 0x80); - - radio_temp[0] = (radio_temp[0] + radio_temp2[0]); - radio_temp[1] = (radio_temp[1] + radio_temp2[1]); - radio_temp[2] = (radio_temp[2] + radio_temp2[2]); - radio_temp[3] = (radio_temp[3] + radio_temp2[3]); - - radio_temp[0] = - (radio_temp[0] + radio_temp[1] + radio_temp[2] + - radio_temp[3]); - - radio_temp[0] = - (radio_temp[0] + - (8 * 32)) * (950 - 350) / 63 + (350 * 8); - - radio_temp[0] = (radio_temp[0] - (8 * 420)) / 38; - - write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE1, - pwrdet_rxtx_core1_save); - write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE2, - pwrdet_rxtx_core2_save); - write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL1, - core1_txrf_iqcal1_save); - write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL1, - core2_txrf_iqcal1_save); - write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL2, - core1_txrf_iqcal2_save); - write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL2, - core2_txrf_iqcal2_save); - write_radio_reg(pi, RADIO_2055_PD_PLL_TS, pd_pll_ts_save); - - write_phy_reg(pi, 0xca, gpioSel_save); - write_phy_reg(pi, 0xa6, afectrlCore1_save); - write_phy_reg(pi, 0xa7, afectrlCore2_save); - write_phy_reg(pi, 0xa5, afectrlOverride_save); - } - - return (s16) radio_temp[0] + offset; -} - -static void -wlc_phy_set_rssi_2055_vcm(struct brcms_phy *pi, u8 rssi_type, u8 *vcm_buf) -{ - u8 core; - - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - if (rssi_type == NPHY_RSSI_SEL_NB) { - if (core == PHY_CORE_0) { - mod_radio_reg(pi, - RADIO_2055_CORE1_B0_NBRSSI_VCM, - RADIO_2055_NBRSSI_VCM_I_MASK, - vcm_buf[2 * - core] << - RADIO_2055_NBRSSI_VCM_I_SHIFT); - mod_radio_reg(pi, - RADIO_2055_CORE1_RXBB_RSSI_CTRL5, - RADIO_2055_NBRSSI_VCM_Q_MASK, - vcm_buf[2 * core + - 1] << - RADIO_2055_NBRSSI_VCM_Q_SHIFT); - } else { - mod_radio_reg(pi, - RADIO_2055_CORE2_B0_NBRSSI_VCM, - RADIO_2055_NBRSSI_VCM_I_MASK, - vcm_buf[2 * - core] << - RADIO_2055_NBRSSI_VCM_I_SHIFT); - mod_radio_reg(pi, - RADIO_2055_CORE2_RXBB_RSSI_CTRL5, - RADIO_2055_NBRSSI_VCM_Q_MASK, - vcm_buf[2 * core + - 1] << - RADIO_2055_NBRSSI_VCM_Q_SHIFT); - } - } else { - if (core == PHY_CORE_0) - mod_radio_reg(pi, - RADIO_2055_CORE1_RXBB_RSSI_CTRL5, - RADIO_2055_WBRSSI_VCM_IQ_MASK, - vcm_buf[2 * - core] << - RADIO_2055_WBRSSI_VCM_IQ_SHIFT); - else - mod_radio_reg(pi, - RADIO_2055_CORE2_RXBB_RSSI_CTRL5, - RADIO_2055_WBRSSI_VCM_IQ_MASK, - vcm_buf[2 * - core] << - RADIO_2055_WBRSSI_VCM_IQ_SHIFT); - } - } -} - -static void wlc_phy_rssi_cal_nphy_rev3(struct brcms_phy *pi) -{ - u16 classif_state; - u16 clip_state[2]; - u16 clip_off[] = { 0xffff, 0xffff }; - s32 target_code; - u8 vcm, min_vcm; - u8 vcm_final = 0; - u8 result_idx; - s32 poll_results[8][4] = { - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0} - }; - s32 poll_result_core[4] = { 0, 0, 0, 0 }; - s32 min_d = NPHY_RSSICAL_MAXD, curr_d; - s32 fine_digital_offset[4]; - s32 poll_results_min[4] = { 0, 0, 0, 0 }; - s32 min_poll; - u8 vcm_level_max; - u8 core; - u8 wb_cnt; - u8 rssi_type; - u16 NPHY_Rfctrlintc1_save, NPHY_Rfctrlintc2_save; - u16 NPHY_AfectrlOverride1_save, NPHY_AfectrlOverride2_save; - u16 NPHY_AfectrlCore1_save, NPHY_AfectrlCore2_save; - u16 NPHY_RfctrlOverride0_save, NPHY_RfctrlOverride1_save; - u16 NPHY_RfctrlOverrideAux0_save, NPHY_RfctrlOverrideAux1_save; - u16 NPHY_RfctrlCmd_save; - u16 NPHY_RfctrlMiscReg1_save, NPHY_RfctrlMiscReg2_save; - u16 NPHY_RfctrlRSSIOTHERS1_save, NPHY_RfctrlRSSIOTHERS2_save; - u8 rxcore_state; - u16 NPHY_REV7_RfctrlOverride3_save, NPHY_REV7_RfctrlOverride4_save; - u16 NPHY_REV7_RfctrlOverride5_save, NPHY_REV7_RfctrlOverride6_save; - u16 NPHY_REV7_RfctrlMiscReg3_save, NPHY_REV7_RfctrlMiscReg4_save; - u16 NPHY_REV7_RfctrlMiscReg5_save, NPHY_REV7_RfctrlMiscReg6_save; - - NPHY_REV7_RfctrlOverride3_save = - NPHY_REV7_RfctrlOverride4_save = - NPHY_REV7_RfctrlOverride5_save = - NPHY_REV7_RfctrlOverride6_save = - NPHY_REV7_RfctrlMiscReg3_save = - NPHY_REV7_RfctrlMiscReg4_save = - NPHY_REV7_RfctrlMiscReg5_save = - NPHY_REV7_RfctrlMiscReg6_save = 0; - - classif_state = wlc_phy_classifier_nphy(pi, 0, 0); - wlc_phy_classifier_nphy(pi, (0x7 << 0), 4); - wlc_phy_clip_det_nphy(pi, 0, clip_state); - wlc_phy_clip_det_nphy(pi, 1, clip_off); - - NPHY_Rfctrlintc1_save = read_phy_reg(pi, 0x91); - NPHY_Rfctrlintc2_save = read_phy_reg(pi, 0x92); - NPHY_AfectrlOverride1_save = read_phy_reg(pi, 0x8f); - NPHY_AfectrlOverride2_save = read_phy_reg(pi, 0xa5); - NPHY_AfectrlCore1_save = read_phy_reg(pi, 0xa6); - NPHY_AfectrlCore2_save = read_phy_reg(pi, 0xa7); - NPHY_RfctrlOverride0_save = read_phy_reg(pi, 0xe7); - NPHY_RfctrlOverride1_save = read_phy_reg(pi, 0xec); - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - NPHY_REV7_RfctrlOverride3_save = read_phy_reg(pi, 0x342); - NPHY_REV7_RfctrlOverride4_save = read_phy_reg(pi, 0x343); - NPHY_REV7_RfctrlOverride5_save = read_phy_reg(pi, 0x346); - NPHY_REV7_RfctrlOverride6_save = read_phy_reg(pi, 0x347); - } - NPHY_RfctrlOverrideAux0_save = read_phy_reg(pi, 0xe5); - NPHY_RfctrlOverrideAux1_save = read_phy_reg(pi, 0xe6); - NPHY_RfctrlCmd_save = read_phy_reg(pi, 0x78); - NPHY_RfctrlMiscReg1_save = read_phy_reg(pi, 0xf9); - NPHY_RfctrlMiscReg2_save = read_phy_reg(pi, 0xfb); - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - NPHY_REV7_RfctrlMiscReg3_save = read_phy_reg(pi, 0x340); - NPHY_REV7_RfctrlMiscReg4_save = read_phy_reg(pi, 0x341); - NPHY_REV7_RfctrlMiscReg5_save = read_phy_reg(pi, 0x344); - NPHY_REV7_RfctrlMiscReg6_save = read_phy_reg(pi, 0x345); - } - NPHY_RfctrlRSSIOTHERS1_save = read_phy_reg(pi, 0x7a); - NPHY_RfctrlRSSIOTHERS2_save = read_phy_reg(pi, 0x7d); - - wlc_phy_rfctrlintc_override_nphy(pi, NPHY_RfctrlIntc_override_OFF, 0, - RADIO_MIMO_CORESEL_ALLRXTX); - wlc_phy_rfctrlintc_override_nphy(pi, NPHY_RfctrlIntc_override_TRSW, 1, - RADIO_MIMO_CORESEL_ALLRXTX); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - wlc_phy_rfctrl_override_1tomany_nphy( - pi, - NPHY_REV7_RfctrlOverride_cmd_rxrf_pu, - 0, 0, 0); - else - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 0), 0, 0, 0); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - wlc_phy_rfctrl_override_1tomany_nphy( - pi, - NPHY_REV7_RfctrlOverride_cmd_rx_pu, - 1, 0, 0); - else - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 1), 1, 0, 0); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 7), - 1, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 6), 1, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - } else { - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 7), 1, 0, 0); - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 6), 1, 0, 0); - } - - if (CHSPEC_IS5G(pi->radio_chanspec)) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 5), - 0, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 4), 1, 0, - 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - } else { - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 5), 0, 0, 0); - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 4), 1, 0, 0); - } - - } else { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 4), - 0, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 5), 1, 0, - 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - } else { - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 4), 0, 0, 0); - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 5), 1, 0, 0); - } - } - - rxcore_state = wlc_phy_rxcore_getstate_nphy( - (struct brcms_phy_pub *) pi); - - vcm_level_max = 8; - - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - - if ((rxcore_state & (1 << core)) == 0) - continue; - - wlc_phy_scale_offset_rssi_nphy(pi, 0x0, 0x0, - core == - PHY_CORE_0 ? - RADIO_MIMO_CORESEL_CORE1 : - RADIO_MIMO_CORESEL_CORE2, - NPHY_RAIL_I, NPHY_RSSI_SEL_NB); - wlc_phy_scale_offset_rssi_nphy(pi, 0x0, 0x0, - core == - PHY_CORE_0 ? - RADIO_MIMO_CORESEL_CORE1 : - RADIO_MIMO_CORESEL_CORE2, - NPHY_RAIL_Q, NPHY_RSSI_SEL_NB); - - for (vcm = 0; vcm < vcm_level_max; vcm++) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) - mod_radio_reg(pi, (core == PHY_CORE_0) ? - RADIO_2057_NB_MASTER_CORE0 : - RADIO_2057_NB_MASTER_CORE1, - RADIO_2057_VCM_MASK, vcm); - else - mod_radio_reg(pi, RADIO_2056_RX_RSSI_MISC | - ((core == - PHY_CORE_0) ? RADIO_2056_RX0 : - RADIO_2056_RX1), - RADIO_2056_VCM_MASK, - vcm << RADIO_2056_RSSI_VCM_SHIFT); - - wlc_phy_poll_rssi_nphy(pi, NPHY_RSSI_SEL_NB, - &poll_results[vcm][0], - NPHY_RSSICAL_NPOLL); - } - - for (result_idx = 0; result_idx < 4; result_idx++) { - if ((core == result_idx / 2) && - (result_idx % 2 == 0)) { - - min_d = NPHY_RSSICAL_MAXD; - min_vcm = 0; - min_poll = - NPHY_RSSICAL_MAXREAD * - NPHY_RSSICAL_NPOLL + 1; - for (vcm = 0; vcm < vcm_level_max; vcm++) { - curr_d = - poll_results[vcm][result_idx] * - poll_results[vcm][result_idx] + - poll_results[vcm][result_idx + - 1] * - poll_results[vcm][result_idx + - 1]; - if (curr_d < min_d) { - min_d = curr_d; - min_vcm = vcm; - } - if (poll_results[vcm][result_idx] < - min_poll) - min_poll = - poll_results[vcm] - [result_idx]; - } - vcm_final = min_vcm; - poll_results_min[result_idx] = min_poll; - } - } - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - mod_radio_reg(pi, (core == PHY_CORE_0) ? - RADIO_2057_NB_MASTER_CORE0 : - RADIO_2057_NB_MASTER_CORE1, - RADIO_2057_VCM_MASK, vcm_final); - else - mod_radio_reg(pi, RADIO_2056_RX_RSSI_MISC | - ((core == - PHY_CORE_0) ? RADIO_2056_RX0 : - RADIO_2056_RX1), RADIO_2056_VCM_MASK, - vcm_final << RADIO_2056_RSSI_VCM_SHIFT); - - for (result_idx = 0; result_idx < 4; result_idx++) { - if (core == result_idx / 2) { - fine_digital_offset[result_idx] = - (NPHY_RSSICAL_NB_TARGET * - NPHY_RSSICAL_NPOLL) - - poll_results[vcm_final][result_idx]; - if (fine_digital_offset[result_idx] < 0) { - fine_digital_offset[result_idx] = - abs(fine_digital_offset - [result_idx]); - fine_digital_offset[result_idx] += - (NPHY_RSSICAL_NPOLL / 2); - fine_digital_offset[result_idx] /= - NPHY_RSSICAL_NPOLL; - fine_digital_offset[result_idx] = - -fine_digital_offset[ - result_idx]; - } else { - fine_digital_offset[result_idx] += - (NPHY_RSSICAL_NPOLL / 2); - fine_digital_offset[result_idx] /= - NPHY_RSSICAL_NPOLL; - } - - if (poll_results_min[result_idx] == - NPHY_RSSICAL_MAXREAD * NPHY_RSSICAL_NPOLL) - fine_digital_offset[result_idx] = - (NPHY_RSSICAL_NB_TARGET - - NPHY_RSSICAL_MAXREAD - 1); - - wlc_phy_scale_offset_rssi_nphy( - pi, 0x0, - (s8) - fine_digital_offset - [result_idx], - (result_idx / 2 == 0) ? - RADIO_MIMO_CORESEL_CORE1 : - RADIO_MIMO_CORESEL_CORE2, - (result_idx % 2 == 0) ? - NPHY_RAIL_I : NPHY_RAIL_Q, - NPHY_RSSI_SEL_NB); - } - } - - } - - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - - if ((rxcore_state & (1 << core)) == 0) - continue; - - for (wb_cnt = 0; wb_cnt < 2; wb_cnt++) { - if (wb_cnt == 0) { - rssi_type = NPHY_RSSI_SEL_W1; - target_code = NPHY_RSSICAL_W1_TARGET_REV3; - } else { - rssi_type = NPHY_RSSI_SEL_W2; - target_code = NPHY_RSSICAL_W2_TARGET_REV3; - } - - wlc_phy_scale_offset_rssi_nphy(pi, 0x0, 0x0, - core == - PHY_CORE_0 ? - RADIO_MIMO_CORESEL_CORE1 - : - RADIO_MIMO_CORESEL_CORE2, - NPHY_RAIL_I, rssi_type); - wlc_phy_scale_offset_rssi_nphy(pi, 0x0, 0x0, - core == - PHY_CORE_0 ? - RADIO_MIMO_CORESEL_CORE1 - : - RADIO_MIMO_CORESEL_CORE2, - NPHY_RAIL_Q, rssi_type); - - wlc_phy_poll_rssi_nphy(pi, rssi_type, poll_result_core, - NPHY_RSSICAL_NPOLL); - - for (result_idx = 0; result_idx < 4; result_idx++) { - if (core == result_idx / 2) { - fine_digital_offset[result_idx] = - (target_code * - NPHY_RSSICAL_NPOLL) - - poll_result_core[result_idx]; - if (fine_digital_offset[result_idx] < - 0) { - fine_digital_offset[result_idx] - = abs( - fine_digital_offset - [result_idx]); - fine_digital_offset[result_idx] - += (NPHY_RSSICAL_NPOLL - / 2); - fine_digital_offset[result_idx] - /= NPHY_RSSICAL_NPOLL; - fine_digital_offset[result_idx] - = -fine_digital_offset - [result_idx]; - } else { - fine_digital_offset[result_idx] - += (NPHY_RSSICAL_NPOLL - / 2); - fine_digital_offset[result_idx] - /= NPHY_RSSICAL_NPOLL; - } - - wlc_phy_scale_offset_rssi_nphy( - pi, 0x0, - (s8) - fine_digital_offset - [core * - 2], - (core == PHY_CORE_0) ? - RADIO_MIMO_CORESEL_CORE1 : - RADIO_MIMO_CORESEL_CORE2, - (result_idx % 2 == 0) ? - NPHY_RAIL_I : - NPHY_RAIL_Q, - rssi_type); - } - } - - } - } - - write_phy_reg(pi, 0x91, NPHY_Rfctrlintc1_save); - write_phy_reg(pi, 0x92, NPHY_Rfctrlintc2_save); - - wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); - - mod_phy_reg(pi, 0xe7, (0x1 << 0), 1 << 0); - mod_phy_reg(pi, 0x78, (0x1 << 0), 1 << 0); - mod_phy_reg(pi, 0xe7, (0x1 << 0), 0); - - mod_phy_reg(pi, 0xec, (0x1 << 0), 1 << 0); - mod_phy_reg(pi, 0x78, (0x1 << 1), 1 << 1); - mod_phy_reg(pi, 0xec, (0x1 << 0), 0); - - write_phy_reg(pi, 0x8f, NPHY_AfectrlOverride1_save); - write_phy_reg(pi, 0xa5, NPHY_AfectrlOverride2_save); - write_phy_reg(pi, 0xa6, NPHY_AfectrlCore1_save); - write_phy_reg(pi, 0xa7, NPHY_AfectrlCore2_save); - write_phy_reg(pi, 0xe7, NPHY_RfctrlOverride0_save); - write_phy_reg(pi, 0xec, NPHY_RfctrlOverride1_save); - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - write_phy_reg(pi, 0x342, NPHY_REV7_RfctrlOverride3_save); - write_phy_reg(pi, 0x343, NPHY_REV7_RfctrlOverride4_save); - write_phy_reg(pi, 0x346, NPHY_REV7_RfctrlOverride5_save); - write_phy_reg(pi, 0x347, NPHY_REV7_RfctrlOverride6_save); - } - write_phy_reg(pi, 0xe5, NPHY_RfctrlOverrideAux0_save); - write_phy_reg(pi, 0xe6, NPHY_RfctrlOverrideAux1_save); - write_phy_reg(pi, 0x78, NPHY_RfctrlCmd_save); - write_phy_reg(pi, 0xf9, NPHY_RfctrlMiscReg1_save); - write_phy_reg(pi, 0xfb, NPHY_RfctrlMiscReg2_save); - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - write_phy_reg(pi, 0x340, NPHY_REV7_RfctrlMiscReg3_save); - write_phy_reg(pi, 0x341, NPHY_REV7_RfctrlMiscReg4_save); - write_phy_reg(pi, 0x344, NPHY_REV7_RfctrlMiscReg5_save); - write_phy_reg(pi, 0x345, NPHY_REV7_RfctrlMiscReg6_save); - } - write_phy_reg(pi, 0x7a, NPHY_RfctrlRSSIOTHERS1_save); - write_phy_reg(pi, 0x7d, NPHY_RfctrlRSSIOTHERS2_save); - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - pi->rssical_cache.rssical_radio_regs_2G[0] = - read_radio_reg(pi, RADIO_2057_NB_MASTER_CORE0); - pi->rssical_cache.rssical_radio_regs_2G[1] = - read_radio_reg(pi, RADIO_2057_NB_MASTER_CORE1); - } else { - pi->rssical_cache.rssical_radio_regs_2G[0] = - read_radio_reg(pi, - RADIO_2056_RX_RSSI_MISC | - RADIO_2056_RX0); - pi->rssical_cache.rssical_radio_regs_2G[1] = - read_radio_reg(pi, - RADIO_2056_RX_RSSI_MISC | - RADIO_2056_RX1); - } - - pi->rssical_cache.rssical_phyregs_2G[0] = - read_phy_reg(pi, 0x1a6); - pi->rssical_cache.rssical_phyregs_2G[1] = - read_phy_reg(pi, 0x1ac); - pi->rssical_cache.rssical_phyregs_2G[2] = - read_phy_reg(pi, 0x1b2); - pi->rssical_cache.rssical_phyregs_2G[3] = - read_phy_reg(pi, 0x1b8); - pi->rssical_cache.rssical_phyregs_2G[4] = - read_phy_reg(pi, 0x1a4); - pi->rssical_cache.rssical_phyregs_2G[5] = - read_phy_reg(pi, 0x1aa); - pi->rssical_cache.rssical_phyregs_2G[6] = - read_phy_reg(pi, 0x1b0); - pi->rssical_cache.rssical_phyregs_2G[7] = - read_phy_reg(pi, 0x1b6); - pi->rssical_cache.rssical_phyregs_2G[8] = - read_phy_reg(pi, 0x1a5); - pi->rssical_cache.rssical_phyregs_2G[9] = - read_phy_reg(pi, 0x1ab); - pi->rssical_cache.rssical_phyregs_2G[10] = - read_phy_reg(pi, 0x1b1); - pi->rssical_cache.rssical_phyregs_2G[11] = - read_phy_reg(pi, 0x1b7); - - pi->nphy_rssical_chanspec_2G = pi->radio_chanspec; - } else { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - pi->rssical_cache.rssical_radio_regs_5G[0] = - read_radio_reg(pi, RADIO_2057_NB_MASTER_CORE0); - pi->rssical_cache.rssical_radio_regs_5G[1] = - read_radio_reg(pi, RADIO_2057_NB_MASTER_CORE1); - } else { - pi->rssical_cache.rssical_radio_regs_5G[0] = - read_radio_reg(pi, - RADIO_2056_RX_RSSI_MISC | - RADIO_2056_RX0); - pi->rssical_cache.rssical_radio_regs_5G[1] = - read_radio_reg(pi, - RADIO_2056_RX_RSSI_MISC | - RADIO_2056_RX1); - } - - pi->rssical_cache.rssical_phyregs_5G[0] = - read_phy_reg(pi, 0x1a6); - pi->rssical_cache.rssical_phyregs_5G[1] = - read_phy_reg(pi, 0x1ac); - pi->rssical_cache.rssical_phyregs_5G[2] = - read_phy_reg(pi, 0x1b2); - pi->rssical_cache.rssical_phyregs_5G[3] = - read_phy_reg(pi, 0x1b8); - pi->rssical_cache.rssical_phyregs_5G[4] = - read_phy_reg(pi, 0x1a4); - pi->rssical_cache.rssical_phyregs_5G[5] = - read_phy_reg(pi, 0x1aa); - pi->rssical_cache.rssical_phyregs_5G[6] = - read_phy_reg(pi, 0x1b0); - pi->rssical_cache.rssical_phyregs_5G[7] = - read_phy_reg(pi, 0x1b6); - pi->rssical_cache.rssical_phyregs_5G[8] = - read_phy_reg(pi, 0x1a5); - pi->rssical_cache.rssical_phyregs_5G[9] = - read_phy_reg(pi, 0x1ab); - pi->rssical_cache.rssical_phyregs_5G[10] = - read_phy_reg(pi, 0x1b1); - pi->rssical_cache.rssical_phyregs_5G[11] = - read_phy_reg(pi, 0x1b7); - - pi->nphy_rssical_chanspec_5G = pi->radio_chanspec; - } - - wlc_phy_classifier_nphy(pi, (0x7 << 0), classif_state); - wlc_phy_clip_det_nphy(pi, 1, clip_state); -} - -static void wlc_phy_rssi_cal_nphy_rev2(struct brcms_phy *pi, u8 rssi_type) -{ - s32 target_code; - u16 classif_state; - u16 clip_state[2]; - u16 rssi_ctrl_state[2], pd_state[2]; - u16 rfctrlintc_state[2], rfpdcorerxtx_state[2]; - u16 rfctrlintc_override_val; - u16 clip_off[] = { 0xffff, 0xffff }; - u16 rf_pd_val, pd_mask, rssi_ctrl_mask; - u8 vcm, min_vcm, vcm_tmp[4]; - u8 vcm_final[4] = { 0, 0, 0, 0 }; - u8 result_idx, ctr; - s32 poll_results[4][4] = { - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0}, - {0, 0, 0, 0} - }; - s32 poll_miniq[4][2] = { - {0, 0}, - {0, 0}, - {0, 0}, - {0, 0} - }; - s32 min_d, curr_d; - s32 fine_digital_offset[4]; - s32 poll_results_min[4] = { 0, 0, 0, 0 }; - s32 min_poll; - - switch (rssi_type) { - case NPHY_RSSI_SEL_NB: - target_code = NPHY_RSSICAL_NB_TARGET; - break; - case NPHY_RSSI_SEL_W1: - target_code = NPHY_RSSICAL_W1_TARGET; - break; - case NPHY_RSSI_SEL_W2: - target_code = NPHY_RSSICAL_W2_TARGET; - break; - default: - return; - break; - } - - classif_state = wlc_phy_classifier_nphy(pi, 0, 0); - wlc_phy_classifier_nphy(pi, (0x7 << 0), 4); - wlc_phy_clip_det_nphy(pi, 0, clip_state); - wlc_phy_clip_det_nphy(pi, 1, clip_off); - - rf_pd_val = (rssi_type == NPHY_RSSI_SEL_NB) ? 0x6 : 0x4; - rfctrlintc_override_val = - CHSPEC_IS5G(pi->radio_chanspec) ? 0x140 : 0x110; - - rfctrlintc_state[0] = read_phy_reg(pi, 0x91); - rfpdcorerxtx_state[0] = read_radio_reg(pi, RADIO_2055_PD_CORE1_RXTX); - write_phy_reg(pi, 0x91, rfctrlintc_override_val); - write_radio_reg(pi, RADIO_2055_PD_CORE1_RXTX, rf_pd_val); - - rfctrlintc_state[1] = read_phy_reg(pi, 0x92); - rfpdcorerxtx_state[1] = read_radio_reg(pi, RADIO_2055_PD_CORE2_RXTX); - write_phy_reg(pi, 0x92, rfctrlintc_override_val); - write_radio_reg(pi, RADIO_2055_PD_CORE2_RXTX, rf_pd_val); - - pd_mask = RADIO_2055_NBRSSI_PD | RADIO_2055_WBRSSI_G1_PD | - RADIO_2055_WBRSSI_G2_PD; - pd_state[0] = - read_radio_reg(pi, RADIO_2055_PD_CORE1_RSSI_MISC) & pd_mask; - pd_state[1] = - read_radio_reg(pi, RADIO_2055_PD_CORE2_RSSI_MISC) & pd_mask; - mod_radio_reg(pi, RADIO_2055_PD_CORE1_RSSI_MISC, pd_mask, 0); - mod_radio_reg(pi, RADIO_2055_PD_CORE2_RSSI_MISC, pd_mask, 0); - rssi_ctrl_mask = RADIO_2055_NBRSSI_SEL | RADIO_2055_WBRSSI_G1_SEL | - RADIO_2055_WBRSSI_G2_SEL; - rssi_ctrl_state[0] = - read_radio_reg(pi, RADIO_2055_SP_RSSI_CORE1) & rssi_ctrl_mask; - rssi_ctrl_state[1] = - read_radio_reg(pi, RADIO_2055_SP_RSSI_CORE2) & rssi_ctrl_mask; - wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_ALLRX, rssi_type); - - wlc_phy_scale_offset_rssi_nphy(pi, 0x0, 0x0, RADIO_MIMO_CORESEL_ALLRX, - NPHY_RAIL_I, rssi_type); - wlc_phy_scale_offset_rssi_nphy(pi, 0x0, 0x0, RADIO_MIMO_CORESEL_ALLRX, - NPHY_RAIL_Q, rssi_type); - - for (vcm = 0; vcm < 4; vcm++) { - - vcm_tmp[0] = vcm_tmp[1] = vcm_tmp[2] = vcm_tmp[3] = vcm; - if (rssi_type != NPHY_RSSI_SEL_W2) - wlc_phy_set_rssi_2055_vcm(pi, rssi_type, vcm_tmp); - - wlc_phy_poll_rssi_nphy(pi, rssi_type, &poll_results[vcm][0], - NPHY_RSSICAL_NPOLL); - - if ((rssi_type == NPHY_RSSI_SEL_W1) - || (rssi_type == NPHY_RSSI_SEL_W2)) { - for (ctr = 0; ctr < 2; ctr++) - poll_miniq[vcm][ctr] = - min(poll_results[vcm][ctr * 2 + 0], - poll_results[vcm][ctr * 2 + 1]); - } - } - - for (result_idx = 0; result_idx < 4; result_idx++) { - min_d = NPHY_RSSICAL_MAXD; - min_vcm = 0; - min_poll = NPHY_RSSICAL_MAXREAD * NPHY_RSSICAL_NPOLL + 1; - for (vcm = 0; vcm < 4; vcm++) { - curr_d = abs(((rssi_type == NPHY_RSSI_SEL_NB) ? - poll_results[vcm][result_idx] : - poll_miniq[vcm][result_idx / 2]) - - (target_code * NPHY_RSSICAL_NPOLL)); - if (curr_d < min_d) { - min_d = curr_d; - min_vcm = vcm; - } - if (poll_results[vcm][result_idx] < min_poll) - min_poll = poll_results[vcm][result_idx]; - } - vcm_final[result_idx] = min_vcm; - poll_results_min[result_idx] = min_poll; - } - - if (rssi_type != NPHY_RSSI_SEL_W2) - wlc_phy_set_rssi_2055_vcm(pi, rssi_type, vcm_final); - - for (result_idx = 0; result_idx < 4; result_idx++) { - fine_digital_offset[result_idx] = - (target_code * NPHY_RSSICAL_NPOLL) - - poll_results[vcm_final[result_idx]][result_idx]; - if (fine_digital_offset[result_idx] < 0) { - fine_digital_offset[result_idx] = - abs(fine_digital_offset[result_idx]); - fine_digital_offset[result_idx] += - (NPHY_RSSICAL_NPOLL / 2); - fine_digital_offset[result_idx] /= NPHY_RSSICAL_NPOLL; - fine_digital_offset[result_idx] = - -fine_digital_offset[result_idx]; - } else { - fine_digital_offset[result_idx] += - (NPHY_RSSICAL_NPOLL / 2); - fine_digital_offset[result_idx] /= NPHY_RSSICAL_NPOLL; - } - - if (poll_results_min[result_idx] == - NPHY_RSSICAL_MAXREAD * NPHY_RSSICAL_NPOLL) - fine_digital_offset[result_idx] = - (target_code - NPHY_RSSICAL_MAXREAD - 1); - - wlc_phy_scale_offset_rssi_nphy(pi, 0x0, - (s8) - fine_digital_offset[result_idx], - (result_idx / 2 == - 0) ? RADIO_MIMO_CORESEL_CORE1 : - RADIO_MIMO_CORESEL_CORE2, - (result_idx % 2 == - 0) ? NPHY_RAIL_I : NPHY_RAIL_Q, - rssi_type); - } - - mod_radio_reg(pi, RADIO_2055_PD_CORE1_RSSI_MISC, pd_mask, pd_state[0]); - mod_radio_reg(pi, RADIO_2055_PD_CORE2_RSSI_MISC, pd_mask, pd_state[1]); - if (rssi_ctrl_state[0] == RADIO_2055_NBRSSI_SEL) - wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE1, - NPHY_RSSI_SEL_NB); - else if (rssi_ctrl_state[0] == RADIO_2055_WBRSSI_G1_SEL) - wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE1, - NPHY_RSSI_SEL_W1); - else if (rssi_ctrl_state[0] == RADIO_2055_WBRSSI_G2_SEL) - wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE1, - NPHY_RSSI_SEL_W2); - else - wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE1, - NPHY_RSSI_SEL_W2); - if (rssi_ctrl_state[1] == RADIO_2055_NBRSSI_SEL) - wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE2, - NPHY_RSSI_SEL_NB); - else if (rssi_ctrl_state[1] == RADIO_2055_WBRSSI_G1_SEL) - wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE2, - NPHY_RSSI_SEL_W1); - else if (rssi_ctrl_state[1] == RADIO_2055_WBRSSI_G2_SEL) - wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE2, - NPHY_RSSI_SEL_W2); - else - wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_CORE2, - NPHY_RSSI_SEL_W2); - - wlc_phy_rssisel_nphy(pi, RADIO_MIMO_CORESEL_OFF, rssi_type); - - write_phy_reg(pi, 0x91, rfctrlintc_state[0]); - write_radio_reg(pi, RADIO_2055_PD_CORE1_RXTX, rfpdcorerxtx_state[0]); - write_phy_reg(pi, 0x92, rfctrlintc_state[1]); - write_radio_reg(pi, RADIO_2055_PD_CORE2_RXTX, rfpdcorerxtx_state[1]); - - wlc_phy_classifier_nphy(pi, (0x7 << 0), classif_state); - wlc_phy_clip_det_nphy(pi, 1, clip_state); - - wlc_phy_resetcca_nphy(pi); -} - -void wlc_phy_rssi_cal_nphy(struct brcms_phy *pi) -{ - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - wlc_phy_rssi_cal_nphy_rev3(pi); - } else { - wlc_phy_rssi_cal_nphy_rev2(pi, NPHY_RSSI_SEL_NB); - wlc_phy_rssi_cal_nphy_rev2(pi, NPHY_RSSI_SEL_W1); - wlc_phy_rssi_cal_nphy_rev2(pi, NPHY_RSSI_SEL_W2); - } -} - -int -wlc_phy_rssi_compute_nphy(struct brcms_phy *pi, struct d11rxhdr *rxh) -{ - s16 rxpwr, rxpwr0, rxpwr1; - s16 phyRx0_l, phyRx2_l; - - rxpwr = 0; - rxpwr0 = rxh->PhyRxStatus_1 & PRXS1_nphy_PWR0_MASK; - rxpwr1 = (rxh->PhyRxStatus_1 & PRXS1_nphy_PWR1_MASK) >> 8; - - if (rxpwr0 > 127) - rxpwr0 -= 256; - if (rxpwr1 > 127) - rxpwr1 -= 256; - - phyRx0_l = rxh->PhyRxStatus_0 & 0x00ff; - phyRx2_l = rxh->PhyRxStatus_2 & 0x00ff; - if (phyRx2_l > 127) - phyRx2_l -= 256; - - if (((rxpwr0 == 16) || (rxpwr0 == 32))) { - rxpwr0 = rxpwr1; - rxpwr1 = phyRx2_l; - } - - if (pi->sh->rssi_mode == RSSI_ANT_MERGE_MAX) - rxpwr = (rxpwr0 > rxpwr1) ? rxpwr0 : rxpwr1; - else if (pi->sh->rssi_mode == RSSI_ANT_MERGE_MIN) - rxpwr = (rxpwr0 < rxpwr1) ? rxpwr0 : rxpwr1; - else if (pi->sh->rssi_mode == RSSI_ANT_MERGE_AVG) - rxpwr = (rxpwr0 + rxpwr1) >> 1; - - return rxpwr; -} - -static void -wlc_phy_loadsampletable_nphy(struct brcms_phy *pi, struct cordic_iq *tone_buf, - u16 num_samps) -{ - u16 t; - u32 *data_buf = NULL; - - data_buf = kmalloc(sizeof(u32) * num_samps, GFP_ATOMIC); - if (data_buf == NULL) - return; - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - for (t = 0; t < num_samps; t++) - data_buf[t] = ((((unsigned int)tone_buf[t].i) & 0x3ff) << 10) | - (((unsigned int)tone_buf[t].q) & 0x3ff); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_SAMPLEPLAY, num_samps, 0, 32, - data_buf); - - kfree(data_buf); - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); -} - -static u16 -wlc_phy_gen_load_samples_nphy(struct brcms_phy *pi, u32 f_kHz, u16 max_val, - u8 dac_test_mode) -{ - u8 phy_bw, is_phybw40; - u16 num_samps, t, spur; - s32 theta = 0, rot = 0; - u32 tbl_len; - struct cordic_iq *tone_buf = NULL; - - is_phybw40 = CHSPEC_IS40(pi->radio_chanspec); - phy_bw = (is_phybw40 == 1) ? 40 : 20; - tbl_len = (phy_bw << 3); - - if (dac_test_mode == 1) { - spur = read_phy_reg(pi, 0x01); - spur = (spur >> 15) & 1; - phy_bw = (spur == 1) ? 82 : 80; - phy_bw = (is_phybw40 == 1) ? (phy_bw << 1) : phy_bw; - - tbl_len = (phy_bw << 1); - } - - tone_buf = kmalloc(sizeof(struct cordic_iq) * tbl_len, GFP_ATOMIC); - if (tone_buf == NULL) - return 0; - - num_samps = (u16) tbl_len; - rot = ((f_kHz * 36) / phy_bw) / 100; - theta = 0; - - for (t = 0; t < num_samps; t++) { - - tone_buf[t] = cordic_calc_iq(theta); - - theta += rot; - - tone_buf[t].q = (s32) FLOAT(tone_buf[t].q * max_val); - tone_buf[t].i = (s32) FLOAT(tone_buf[t].i * max_val); - } - - wlc_phy_loadsampletable_nphy(pi, tone_buf, num_samps); - - kfree(tone_buf); - - return num_samps; -} - -static void -wlc_phy_runsamples_nphy(struct brcms_phy *pi, u16 num_samps, u16 loops, - u16 wait, u8 iqmode, u8 dac_test_mode, - bool modify_bbmult) -{ - u16 bb_mult; - u8 phy_bw, sample_cmd; - u16 orig_RfseqCoreActv; - u16 lpf_bw_ctl_override3, lpf_bw_ctl_override4, lpf_bw_ctl_miscreg3, - lpf_bw_ctl_miscreg4; - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - phy_bw = 20; - if (CHSPEC_IS40(pi->radio_chanspec)) - phy_bw = 40; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - lpf_bw_ctl_override3 = read_phy_reg(pi, 0x342) & (0x1 << 7); - lpf_bw_ctl_override4 = read_phy_reg(pi, 0x343) & (0x1 << 7); - if (lpf_bw_ctl_override3 | lpf_bw_ctl_override4) { - lpf_bw_ctl_miscreg3 = read_phy_reg(pi, 0x340) & - (0x7 << 8); - lpf_bw_ctl_miscreg4 = read_phy_reg(pi, 0x341) & - (0x7 << 8); - } else { - wlc_phy_rfctrl_override_nphy_rev7( - pi, - (0x1 << 7), - wlc_phy_read_lpf_bw_ctl_nphy - (pi, - 0), 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - - pi->nphy_sample_play_lpf_bw_ctl_ovr = true; - - lpf_bw_ctl_miscreg3 = read_phy_reg(pi, 0x340) & - (0x7 << 8); - lpf_bw_ctl_miscreg4 = read_phy_reg(pi, 0x341) & - (0x7 << 8); - } - } - - if ((pi->nphy_bb_mult_save & BB_MULT_VALID_MASK) == 0) { - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, 1, 87, 16, - &bb_mult); - pi->nphy_bb_mult_save = - BB_MULT_VALID_MASK | (bb_mult & BB_MULT_MASK); - } - - if (modify_bbmult) { - bb_mult = (phy_bw == 20) ? 100 : 71; - bb_mult = (bb_mult << 8) + bb_mult; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 1, 87, 16, - &bb_mult); - } - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); - - write_phy_reg(pi, 0xc6, num_samps - 1); - - if (loops != 0xffff) - write_phy_reg(pi, 0xc4, loops - 1); - else - write_phy_reg(pi, 0xc4, loops); - - write_phy_reg(pi, 0xc5, wait); - - orig_RfseqCoreActv = read_phy_reg(pi, 0xa1); - or_phy_reg(pi, 0xa1, NPHY_RfseqMode_CoreActv_override); - if (iqmode) { - - and_phy_reg(pi, 0xc2, 0x7FFF); - - or_phy_reg(pi, 0xc2, 0x8000); - } else { - - sample_cmd = (dac_test_mode == 1) ? 0x5 : 0x1; - write_phy_reg(pi, 0xc3, sample_cmd); - } - - SPINWAIT(((read_phy_reg(pi, 0xa4) & 0x1) == 1), 1000); - - write_phy_reg(pi, 0xa1, orig_RfseqCoreActv); -} - -int -wlc_phy_tx_tone_nphy(struct brcms_phy *pi, u32 f_kHz, u16 max_val, - u8 iqmode, u8 dac_test_mode, bool modify_bbmult) -{ - u16 num_samps; - u16 loops = 0xffff; - u16 wait = 0; - - num_samps = wlc_phy_gen_load_samples_nphy(pi, f_kHz, max_val, - dac_test_mode); - if (num_samps == 0) - return -EBADE; - - wlc_phy_runsamples_nphy(pi, num_samps, loops, wait, iqmode, - dac_test_mode, modify_bbmult); - - return 0; -} - -void wlc_phy_stopplayback_nphy(struct brcms_phy *pi) -{ - u16 playback_status; - u16 bb_mult; - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - playback_status = read_phy_reg(pi, 0xc7); - if (playback_status & 0x1) - or_phy_reg(pi, 0xc3, NPHY_sampleCmd_STOP); - else if (playback_status & 0x2) - and_phy_reg(pi, 0xc2, - (u16) ~NPHY_iqloCalCmdGctl_IQLO_CAL_EN); - - and_phy_reg(pi, 0xc3, (u16) ~(0x1 << 2)); - - if ((pi->nphy_bb_mult_save & BB_MULT_VALID_MASK) != 0) { - - bb_mult = pi->nphy_bb_mult_save & BB_MULT_MASK; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 1, 87, 16, - &bb_mult); - - pi->nphy_bb_mult_save = 0; - } - - if (NREV_IS(pi->pubpi.phy_rev, 7) || NREV_GE(pi->pubpi.phy_rev, 8)) { - if (pi->nphy_sample_play_lpf_bw_ctl_ovr) { - wlc_phy_rfctrl_override_nphy_rev7( - pi, - (0x1 << 7), - 0, 0, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - pi->nphy_sample_play_lpf_bw_ctl_ovr = false; - } - } - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); -} - -static u32 *brcms_phy_get_tx_pwrctrl_tbl(struct brcms_phy *pi) -{ - u32 *tx_pwrctrl_tbl = NULL; - uint phyrev = pi->pubpi.phy_rev; - - if (PHY_IPA(pi)) { - tx_pwrctrl_tbl = - wlc_phy_get_ipa_gaintbl_nphy(pi); - } else { - if (CHSPEC_IS5G(pi->radio_chanspec)) { - if (NREV_IS(phyrev, 3)) - tx_pwrctrl_tbl = nphy_tpc_5GHz_txgain_rev3; - else if (NREV_IS(phyrev, 4)) - tx_pwrctrl_tbl = - (pi->srom_fem5g.extpagain == 3) ? - nphy_tpc_5GHz_txgain_HiPwrEPA : - nphy_tpc_5GHz_txgain_rev4; - else - tx_pwrctrl_tbl = nphy_tpc_5GHz_txgain_rev5; - } else { - if (NREV_GE(phyrev, 7)) { - if (pi->pubpi.radiorev == 3) - tx_pwrctrl_tbl = - nphy_tpc_txgain_epa_2057rev3; - else if (pi->pubpi.radiorev == 5) - tx_pwrctrl_tbl = - nphy_tpc_txgain_epa_2057rev5; - } else { - if (NREV_GE(phyrev, 5) && - (pi->srom_fem2g.extpagain == 3)) - tx_pwrctrl_tbl = - nphy_tpc_txgain_HiPwrEPA; - else - tx_pwrctrl_tbl = - nphy_tpc_txgain_rev3; - } - } - } - return tx_pwrctrl_tbl; -} - -struct nphy_txgains wlc_phy_get_tx_gain_nphy(struct brcms_phy *pi) -{ - u16 base_idx[2], curr_gain[2]; - u8 core_no; - struct nphy_txgains target_gain; - u32 *tx_pwrctrl_tbl = NULL; - - if (pi->nphy_txpwrctrl == PHY_TPC_HW_OFF) { - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, - curr_gain); - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); - - for (core_no = 0; core_no < 2; core_no++) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - target_gain.ipa[core_no] = - curr_gain[core_no] & 0x0007; - target_gain.pad[core_no] = - ((curr_gain[core_no] & 0x00F8) >> 3); - target_gain.pga[core_no] = - ((curr_gain[core_no] & 0x0F00) >> 8); - target_gain.txgm[core_no] = - ((curr_gain[core_no] & 0x7000) >> 12); - target_gain.txlpf[core_no] = - ((curr_gain[core_no] & 0x8000) >> 15); - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - target_gain.ipa[core_no] = - curr_gain[core_no] & 0x000F; - target_gain.pad[core_no] = - ((curr_gain[core_no] & 0x00F0) >> 4); - target_gain.pga[core_no] = - ((curr_gain[core_no] & 0x0F00) >> 8); - target_gain.txgm[core_no] = - ((curr_gain[core_no] & 0x7000) >> 12); - } else { - target_gain.ipa[core_no] = - curr_gain[core_no] & 0x0003; - target_gain.pad[core_no] = - ((curr_gain[core_no] & 0x000C) >> 2); - target_gain.pga[core_no] = - ((curr_gain[core_no] & 0x0070) >> 4); - target_gain.txgm[core_no] = - ((curr_gain[core_no] & 0x0380) >> 7); - } - } - } else { - uint phyrev = pi->pubpi.phy_rev; - - base_idx[0] = (read_phy_reg(pi, 0x1ed) >> 8) & 0x7f; - base_idx[1] = (read_phy_reg(pi, 0x1ee) >> 8) & 0x7f; - for (core_no = 0; core_no < 2; core_no++) { - if (NREV_GE(phyrev, 3)) { - tx_pwrctrl_tbl = - brcms_phy_get_tx_pwrctrl_tbl(pi); - if (NREV_GE(phyrev, 7)) { - target_gain.ipa[core_no] = - (tx_pwrctrl_tbl - [base_idx[core_no]] - >> 16) & 0x7; - target_gain.pad[core_no] = - (tx_pwrctrl_tbl - [base_idx[core_no]] - >> 19) & 0x1f; - target_gain.pga[core_no] = - (tx_pwrctrl_tbl - [base_idx[core_no]] - >> 24) & 0xf; - target_gain.txgm[core_no] = - (tx_pwrctrl_tbl - [base_idx[core_no]] - >> 28) & 0x7; - target_gain.txlpf[core_no] = - (tx_pwrctrl_tbl - [base_idx[core_no]] - >> 31) & 0x1; - } else { - target_gain.ipa[core_no] = - (tx_pwrctrl_tbl - [base_idx[core_no]] - >> 16) & 0xf; - target_gain.pad[core_no] = - (tx_pwrctrl_tbl - [base_idx[core_no]] - >> 20) & 0xf; - target_gain.pga[core_no] = - (tx_pwrctrl_tbl - [base_idx[core_no]] - >> 24) & 0xf; - target_gain.txgm[core_no] = - (tx_pwrctrl_tbl - [base_idx[core_no]] - >> 28) & 0x7; - } - } else { - target_gain.ipa[core_no] = - (nphy_tpc_txgain[base_idx[core_no]] >> - 16) & 0x3; - target_gain.pad[core_no] = - (nphy_tpc_txgain[base_idx[core_no]] >> - 18) & 0x3; - target_gain.pga[core_no] = - (nphy_tpc_txgain[base_idx[core_no]] >> - 20) & 0x7; - target_gain.txgm[core_no] = - (nphy_tpc_txgain[base_idx[core_no]] >> - 23) & 0x7; - } - } - } - - return target_gain; -} - -static void -wlc_phy_iqcal_gainparams_nphy(struct brcms_phy *pi, u16 core_no, - struct nphy_txgains target_gain, - struct nphy_iqcal_params *params) -{ - u8 k; - int idx; - u16 gain_index; - u8 band_idx = (CHSPEC_IS5G(pi->radio_chanspec) ? 1 : 0); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) - params->txlpf = target_gain.txlpf[core_no]; - - params->txgm = target_gain.txgm[core_no]; - params->pga = target_gain.pga[core_no]; - params->pad = target_gain.pad[core_no]; - params->ipa = target_gain.ipa[core_no]; - if (NREV_GE(pi->pubpi.phy_rev, 7)) - params->cal_gain = - ((params->txlpf << 15) | (params->txgm << 12) | - (params->pga << 8) | - (params->pad << 3) | (params->ipa)); - else - params->cal_gain = - ((params->txgm << 12) | (params->pga << 8) | - (params->pad << 4) | (params->ipa)); - - params->ncorr[0] = 0x79; - params->ncorr[1] = 0x79; - params->ncorr[2] = 0x79; - params->ncorr[3] = 0x79; - params->ncorr[4] = 0x79; - } else { - - gain_index = ((target_gain.pad[core_no] << 0) | - (target_gain.pga[core_no] << 4) | - (target_gain.txgm[core_no] << 8)); - - idx = -1; - for (k = 0; k < NPHY_IQCAL_NUMGAINS; k++) { - if (tbl_iqcal_gainparams_nphy[band_idx][k][0] == - gain_index) { - idx = k; - break; - } - } - - params->txgm = tbl_iqcal_gainparams_nphy[band_idx][k][1]; - params->pga = tbl_iqcal_gainparams_nphy[band_idx][k][2]; - params->pad = tbl_iqcal_gainparams_nphy[band_idx][k][3]; - params->cal_gain = ((params->txgm << 7) | (params->pga << 4) | - (params->pad << 2)); - params->ncorr[0] = tbl_iqcal_gainparams_nphy[band_idx][k][4]; - params->ncorr[1] = tbl_iqcal_gainparams_nphy[band_idx][k][5]; - params->ncorr[2] = tbl_iqcal_gainparams_nphy[band_idx][k][6]; - params->ncorr[3] = tbl_iqcal_gainparams_nphy[band_idx][k][7]; - } -} - -static void wlc_phy_txcal_radio_setup_nphy(struct brcms_phy *pi) -{ - u16 jtag_core, core; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - for (core = 0; core <= 1; core++) { - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 0] = - READ_RADIO_REG3(pi, RADIO_2057, TX, core, - TX_SSI_MASTER); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 1] = - READ_RADIO_REG3(pi, RADIO_2057, TX, core, - IQCAL_VCM_HG); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 2] = - READ_RADIO_REG3(pi, RADIO_2057, TX, core, - IQCAL_IDAC); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 3] = - READ_RADIO_REG3(pi, RADIO_2057, TX, core, - TSSI_VCM); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 4] = 0; - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 5] = - READ_RADIO_REG3(pi, RADIO_2057, TX, core, - TX_SSI_MUX); - - if (pi->pubpi.radiorev != 5) - pi->tx_rx_cal_radio_saveregs[(core * 11) + 6] = - READ_RADIO_REG3(pi, RADIO_2057, TX, - core, - TSSIA); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 7] = - READ_RADIO_REG3(pi, RADIO_2057, TX, core, TSSIG); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 8] = - READ_RADIO_REG3(pi, RADIO_2057, TX, core, - TSSI_MISC1); - - if (CHSPEC_IS5G(pi->radio_chanspec)) { - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TX_SSI_MASTER, 0x0a); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - IQCAL_VCM_HG, 0x43); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - IQCAL_IDAC, 0x55); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TSSI_VCM, 0x00); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TSSIG, 0x00); - if (pi->use_int_tx_iqlo_cal_nphy) { - WRITE_RADIO_REG3(pi, RADIO_2057, TX, - core, TX_SSI_MUX, 0x4); - if (!(pi-> - internal_tx_iqlo_cal_tapoff_intpa_nphy)) - WRITE_RADIO_REG3(pi, RADIO_2057, - TX, core, - TSSIA, 0x31); - else - WRITE_RADIO_REG3(pi, RADIO_2057, - TX, core, - TSSIA, 0x21); - } - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TSSI_MISC1, 0x00); - } else { - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TX_SSI_MASTER, 0x06); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - IQCAL_VCM_HG, 0x43); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - IQCAL_IDAC, 0x55); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TSSI_VCM, 0x00); - - if (pi->pubpi.radiorev != 5) - WRITE_RADIO_REG3(pi, RADIO_2057, TX, - core, TSSIA, 0x00); - if (pi->use_int_tx_iqlo_cal_nphy) { - WRITE_RADIO_REG3(pi, RADIO_2057, TX, - core, TX_SSI_MUX, - 0x06); - if (!(pi-> - internal_tx_iqlo_cal_tapoff_intpa_nphy)) - WRITE_RADIO_REG3(pi, RADIO_2057, - TX, core, - TSSIG, 0x31); - else - WRITE_RADIO_REG3(pi, RADIO_2057, - TX, core, - TSSIG, 0x21); - } - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TSSI_MISC1, 0x00); - } - } - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - - for (core = 0; core <= 1; core++) { - jtag_core = - (core == - PHY_CORE_0) ? RADIO_2056_TX0 : RADIO_2056_TX1; - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 0] = - read_radio_reg(pi, - RADIO_2056_TX_TX_SSI_MASTER | - jtag_core); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 1] = - read_radio_reg(pi, - RADIO_2056_TX_IQCAL_VCM_HG | - jtag_core); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 2] = - read_radio_reg(pi, - RADIO_2056_TX_IQCAL_IDAC | - jtag_core); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 3] = - read_radio_reg( - pi, - RADIO_2056_TX_TSSI_VCM | - jtag_core); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 4] = - read_radio_reg(pi, - RADIO_2056_TX_TX_AMP_DET | - jtag_core); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 5] = - read_radio_reg(pi, - RADIO_2056_TX_TX_SSI_MUX | - jtag_core); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 6] = - read_radio_reg(pi, - RADIO_2056_TX_TSSIA | jtag_core); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 7] = - read_radio_reg(pi, - RADIO_2056_TX_TSSIG | jtag_core); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 8] = - read_radio_reg(pi, - RADIO_2056_TX_TSSI_MISC1 | - jtag_core); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 9] = - read_radio_reg(pi, - RADIO_2056_TX_TSSI_MISC2 | - jtag_core); - - pi->tx_rx_cal_radio_saveregs[(core * 11) + 10] = - read_radio_reg(pi, - RADIO_2056_TX_TSSI_MISC3 | - jtag_core); - - if (CHSPEC_IS5G(pi->radio_chanspec)) { - write_radio_reg(pi, - RADIO_2056_TX_TX_SSI_MASTER | - jtag_core, 0x0a); - write_radio_reg(pi, - RADIO_2056_TX_IQCAL_VCM_HG | - jtag_core, 0x40); - write_radio_reg(pi, - RADIO_2056_TX_IQCAL_IDAC | - jtag_core, 0x55); - write_radio_reg(pi, - RADIO_2056_TX_TSSI_VCM | - jtag_core, 0x00); - write_radio_reg(pi, - RADIO_2056_TX_TX_AMP_DET | - jtag_core, 0x00); - - if (PHY_IPA(pi)) { - write_radio_reg( - pi, - RADIO_2056_TX_TX_SSI_MUX - | jtag_core, 0x4); - write_radio_reg(pi, - RADIO_2056_TX_TSSIA | - jtag_core, 0x1); - } else { - write_radio_reg( - pi, - RADIO_2056_TX_TX_SSI_MUX - | jtag_core, 0x00); - write_radio_reg(pi, - RADIO_2056_TX_TSSIA | - jtag_core, 0x2f); - } - write_radio_reg(pi, - RADIO_2056_TX_TSSIG | jtag_core, - 0x00); - write_radio_reg(pi, - RADIO_2056_TX_TSSI_MISC1 | - jtag_core, 0x00); - - write_radio_reg(pi, - RADIO_2056_TX_TSSI_MISC2 | - jtag_core, 0x00); - write_radio_reg(pi, - RADIO_2056_TX_TSSI_MISC3 | - jtag_core, 0x00); - } else { - write_radio_reg(pi, - RADIO_2056_TX_TX_SSI_MASTER | - jtag_core, 0x06); - write_radio_reg(pi, - RADIO_2056_TX_IQCAL_VCM_HG | - jtag_core, 0x40); - write_radio_reg(pi, - RADIO_2056_TX_IQCAL_IDAC | - jtag_core, 0x55); - write_radio_reg(pi, - RADIO_2056_TX_TSSI_VCM | - jtag_core, 0x00); - write_radio_reg(pi, - RADIO_2056_TX_TX_AMP_DET | - jtag_core, 0x00); - write_radio_reg(pi, - RADIO_2056_TX_TSSIA | jtag_core, - 0x00); - - if (PHY_IPA(pi)) { - - write_radio_reg( - pi, - RADIO_2056_TX_TX_SSI_MUX - | jtag_core, 0x06); - if (NREV_LT(pi->pubpi.phy_rev, 5)) - write_radio_reg( - pi, - RADIO_2056_TX_TSSIG - | jtag_core, - 0x11); - else - write_radio_reg( - pi, - RADIO_2056_TX_TSSIG - | jtag_core, - 0x1); - } else { - write_radio_reg( - pi, - RADIO_2056_TX_TX_SSI_MUX - | jtag_core, 0x00); - write_radio_reg(pi, - RADIO_2056_TX_TSSIG | - jtag_core, 0x20); - } - - write_radio_reg(pi, - RADIO_2056_TX_TSSI_MISC1 | - jtag_core, 0x00); - write_radio_reg(pi, - RADIO_2056_TX_TSSI_MISC2 | - jtag_core, 0x00); - write_radio_reg(pi, - RADIO_2056_TX_TSSI_MISC3 | - jtag_core, 0x00); - } - } - } else { - - pi->tx_rx_cal_radio_saveregs[0] = - read_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL1); - write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL1, 0x29); - pi->tx_rx_cal_radio_saveregs[1] = - read_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL2); - write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL2, 0x54); - - pi->tx_rx_cal_radio_saveregs[2] = - read_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL1); - write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL1, 0x29); - pi->tx_rx_cal_radio_saveregs[3] = - read_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL2); - write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL2, 0x54); - - pi->tx_rx_cal_radio_saveregs[4] = - read_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE1); - pi->tx_rx_cal_radio_saveregs[5] = - read_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE2); - - if ((read_phy_reg(pi, 0x09) & NPHY_BandControl_currentBand) == - 0) { - - write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE1, 0x04); - write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE2, 0x04); - } else { - - write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE1, 0x20); - write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE2, 0x20); - } - - if (NREV_LT(pi->pubpi.phy_rev, 2)) { - - or_radio_reg(pi, RADIO_2055_CORE1_TX_BB_MXGM, 0x20); - or_radio_reg(pi, RADIO_2055_CORE2_TX_BB_MXGM, 0x20); - } else { - - and_radio_reg(pi, RADIO_2055_CORE1_TX_BB_MXGM, 0xdf); - and_radio_reg(pi, RADIO_2055_CORE2_TX_BB_MXGM, 0xdf); - } - } -} - -static void wlc_phy_txcal_radio_cleanup_nphy(struct brcms_phy *pi) -{ - u16 jtag_core, core; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - for (core = 0; core <= 1; core++) { - - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TX_SSI_MASTER, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 0]); - - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, IQCAL_VCM_HG, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 1]); - - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, IQCAL_IDAC, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 2]); - - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, TSSI_VCM, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 3]); - - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, TX_SSI_MUX, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 5]); - - if (pi->pubpi.radiorev != 5) - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TSSIA, - pi->tx_rx_cal_radio_saveregs - [(core * 11) + 6]); - - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, TSSIG, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 7]); - - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, TSSI_MISC1, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 8]); - } - } else if (NREV_GE(pi->pubpi.phy_rev, 3)) { - for (core = 0; core <= 1; core++) { - jtag_core = (core == PHY_CORE_0) ? - RADIO_2056_TX0 : RADIO_2056_TX1; - - write_radio_reg(pi, - RADIO_2056_TX_TX_SSI_MASTER | jtag_core, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 0]); - - write_radio_reg(pi, - RADIO_2056_TX_IQCAL_VCM_HG | jtag_core, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 1]); - - write_radio_reg(pi, - RADIO_2056_TX_IQCAL_IDAC | jtag_core, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 2]); - - write_radio_reg(pi, RADIO_2056_TX_TSSI_VCM | jtag_core, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 3]); - - write_radio_reg(pi, - RADIO_2056_TX_TX_AMP_DET | jtag_core, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 4]); - - write_radio_reg(pi, - RADIO_2056_TX_TX_SSI_MUX | jtag_core, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 5]); - - write_radio_reg(pi, RADIO_2056_TX_TSSIA | jtag_core, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 6]); - - write_radio_reg(pi, RADIO_2056_TX_TSSIG | jtag_core, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 7]); - - write_radio_reg(pi, - RADIO_2056_TX_TSSI_MISC1 | jtag_core, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 8]); - - write_radio_reg(pi, - RADIO_2056_TX_TSSI_MISC2 | jtag_core, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 9]); - - write_radio_reg(pi, - RADIO_2056_TX_TSSI_MISC3 | jtag_core, - pi-> - tx_rx_cal_radio_saveregs[(core * 11) + - 10]); - } - } else { - - write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL1, - pi->tx_rx_cal_radio_saveregs[0]); - write_radio_reg(pi, RADIO_2055_CORE1_TXRF_IQCAL2, - pi->tx_rx_cal_radio_saveregs[1]); - write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL1, - pi->tx_rx_cal_radio_saveregs[2]); - write_radio_reg(pi, RADIO_2055_CORE2_TXRF_IQCAL2, - pi->tx_rx_cal_radio_saveregs[3]); - write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE1, - pi->tx_rx_cal_radio_saveregs[4]); - write_radio_reg(pi, RADIO_2055_PWRDET_RXTX_CORE2, - pi->tx_rx_cal_radio_saveregs[5]); - } -} - -static void wlc_phy_txcal_physetup_nphy(struct brcms_phy *pi) -{ - u16 val, mask; - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - pi->tx_rx_cal_phy_saveregs[0] = read_phy_reg(pi, 0xa6); - pi->tx_rx_cal_phy_saveregs[1] = read_phy_reg(pi, 0xa7); - - mask = ((0x3 << 8) | (0x3 << 10)); - val = (0x2 << 8); - val |= (0x2 << 10); - mod_phy_reg(pi, 0xa6, mask, val); - mod_phy_reg(pi, 0xa7, mask, val); - - val = read_phy_reg(pi, 0x8f); - pi->tx_rx_cal_phy_saveregs[2] = val; - val |= ((0x1 << 9) | (0x1 << 10)); - write_phy_reg(pi, 0x8f, val); - - val = read_phy_reg(pi, 0xa5); - pi->tx_rx_cal_phy_saveregs[3] = val; - val |= ((0x1 << 9) | (0x1 << 10)); - write_phy_reg(pi, 0xa5, val); - - pi->tx_rx_cal_phy_saveregs[4] = read_phy_reg(pi, 0x01); - mod_phy_reg(pi, 0x01, (0x1 << 15), 0); - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 3, 16, - &val); - pi->tx_rx_cal_phy_saveregs[5] = val; - val = 0; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 3, 16, - &val); - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 19, 16, - &val); - pi->tx_rx_cal_phy_saveregs[6] = val; - val = 0; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 19, 16, - &val); - - pi->tx_rx_cal_phy_saveregs[7] = read_phy_reg(pi, 0x91); - pi->tx_rx_cal_phy_saveregs[8] = read_phy_reg(pi, 0x92); - - if (!(pi->use_int_tx_iqlo_cal_nphy)) - wlc_phy_rfctrlintc_override_nphy( - pi, - NPHY_RfctrlIntc_override_PA, - 1, - RADIO_MIMO_CORESEL_CORE1 - | - RADIO_MIMO_CORESEL_CORE2); - else - wlc_phy_rfctrlintc_override_nphy( - pi, - NPHY_RfctrlIntc_override_PA, - 0, - RADIO_MIMO_CORESEL_CORE1 - | - RADIO_MIMO_CORESEL_CORE2); - - wlc_phy_rfctrlintc_override_nphy(pi, - NPHY_RfctrlIntc_override_TRSW, - 0x2, RADIO_MIMO_CORESEL_CORE1); - wlc_phy_rfctrlintc_override_nphy(pi, - NPHY_RfctrlIntc_override_TRSW, - 0x8, RADIO_MIMO_CORESEL_CORE2); - - pi->tx_rx_cal_phy_saveregs[9] = read_phy_reg(pi, 0x297); - pi->tx_rx_cal_phy_saveregs[10] = read_phy_reg(pi, 0x29b); - mod_phy_reg(pi, (0 == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (0) << 0); - - mod_phy_reg(pi, (1 == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (0) << 0); - - if (NREV_IS(pi->pubpi.phy_rev, 7) - || NREV_GE(pi->pubpi.phy_rev, 8)) - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 7), - wlc_phy_read_lpf_bw_ctl_nphy - (pi, - 0), 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - - if (pi->use_int_tx_iqlo_cal_nphy - && !(pi->internal_tx_iqlo_cal_tapoff_intpa_nphy)) { - - if (NREV_IS(pi->pubpi.phy_rev, 7)) { - - mod_radio_reg(pi, RADIO_2057_OVR_REG0, 1 << 4, - 1 << 4); - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - mod_radio_reg( - pi, - RADIO_2057_PAD2G_TUNE_PUS_CORE0, - 1, 0); - mod_radio_reg( - pi, - RADIO_2057_PAD2G_TUNE_PUS_CORE1, - 1, 0); - } else { - mod_radio_reg( - pi, - RADIO_2057_IPA5G_CASCOFFV_PU_CORE0, - 1, 0); - mod_radio_reg( - pi, - RADIO_2057_IPA5G_CASCOFFV_PU_CORE1, - 1, 0); - } - } else if (NREV_GE(pi->pubpi.phy_rev, 8)) { - wlc_phy_rfctrl_override_nphy_rev7( - pi, - (0x1 << 3), 0, - 0x3, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - } - } - } else { - pi->tx_rx_cal_phy_saveregs[0] = read_phy_reg(pi, 0xa6); - pi->tx_rx_cal_phy_saveregs[1] = read_phy_reg(pi, 0xa7); - - mask = ((0x3 << 12) | (0x3 << 14)); - val = (0x2 << 12); - val |= (0x2 << 14); - mod_phy_reg(pi, 0xa6, mask, val); - mod_phy_reg(pi, 0xa7, mask, val); - - val = read_phy_reg(pi, 0xa5); - pi->tx_rx_cal_phy_saveregs[2] = val; - val |= ((0x1 << 12) | (0x1 << 13)); - write_phy_reg(pi, 0xa5, val); - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 2, 16, - &val); - pi->tx_rx_cal_phy_saveregs[3] = val; - val |= 0x2000; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 2, 16, - &val); - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 18, 16, - &val); - pi->tx_rx_cal_phy_saveregs[4] = val; - val |= 0x2000; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 18, 16, - &val); - - pi->tx_rx_cal_phy_saveregs[5] = read_phy_reg(pi, 0x91); - pi->tx_rx_cal_phy_saveregs[6] = read_phy_reg(pi, 0x92); - val = CHSPEC_IS5G(pi->radio_chanspec) ? 0x180 : 0x120; - write_phy_reg(pi, 0x91, val); - write_phy_reg(pi, 0x92, val); - } -} - -static void wlc_phy_txcal_phycleanup_nphy(struct brcms_phy *pi) -{ - u16 mask; - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - write_phy_reg(pi, 0xa6, pi->tx_rx_cal_phy_saveregs[0]); - write_phy_reg(pi, 0xa7, pi->tx_rx_cal_phy_saveregs[1]); - write_phy_reg(pi, 0x8f, pi->tx_rx_cal_phy_saveregs[2]); - write_phy_reg(pi, 0xa5, pi->tx_rx_cal_phy_saveregs[3]); - write_phy_reg(pi, 0x01, pi->tx_rx_cal_phy_saveregs[4]); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 3, 16, - &pi->tx_rx_cal_phy_saveregs[5]); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 19, 16, - &pi->tx_rx_cal_phy_saveregs[6]); - - write_phy_reg(pi, 0x91, pi->tx_rx_cal_phy_saveregs[7]); - write_phy_reg(pi, 0x92, pi->tx_rx_cal_phy_saveregs[8]); - - write_phy_reg(pi, 0x297, pi->tx_rx_cal_phy_saveregs[9]); - write_phy_reg(pi, 0x29b, pi->tx_rx_cal_phy_saveregs[10]); - - if (NREV_IS(pi->pubpi.phy_rev, 7) - || NREV_GE(pi->pubpi.phy_rev, 8)) - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 7), 0, 0, - 1, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - - wlc_phy_resetcca_nphy(pi); - - if (pi->use_int_tx_iqlo_cal_nphy - && !(pi->internal_tx_iqlo_cal_tapoff_intpa_nphy)) { - - if (NREV_IS(pi->pubpi.phy_rev, 7)) { - if (CHSPEC_IS2G(pi->radio_chanspec)) { - mod_radio_reg( - pi, - RADIO_2057_PAD2G_TUNE_PUS_CORE0, - 1, 1); - mod_radio_reg( - pi, - RADIO_2057_PAD2G_TUNE_PUS_CORE1, - 1, 1); - } else { - mod_radio_reg( - pi, - RADIO_2057_IPA5G_CASCOFFV_PU_CORE0, - 1, 1); - mod_radio_reg( - pi, - RADIO_2057_IPA5G_CASCOFFV_PU_CORE1, - 1, 1); - } - - mod_radio_reg(pi, RADIO_2057_OVR_REG0, 1 << 4, - 0); - } else if (NREV_GE(pi->pubpi.phy_rev, 8)) { - wlc_phy_rfctrl_override_nphy_rev7( - pi, - (0x1 << 3), 0, - 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - } - } - } else { - mask = ((0x3 << 12) | (0x3 << 14)); - mod_phy_reg(pi, 0xa6, mask, pi->tx_rx_cal_phy_saveregs[0]); - mod_phy_reg(pi, 0xa7, mask, pi->tx_rx_cal_phy_saveregs[1]); - write_phy_reg(pi, 0xa5, pi->tx_rx_cal_phy_saveregs[2]); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 2, 16, - &pi->tx_rx_cal_phy_saveregs[3]); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 18, 16, - &pi->tx_rx_cal_phy_saveregs[4]); - - write_phy_reg(pi, 0x91, pi->tx_rx_cal_phy_saveregs[5]); - write_phy_reg(pi, 0x92, pi->tx_rx_cal_phy_saveregs[6]); - } -} - -void -wlc_phy_est_tonepwr_nphy(struct brcms_phy *pi, s32 *qdBm_pwrbuf, u8 num_samps) -{ - u16 tssi_reg; - s32 temp, pwrindex[2]; - s32 idle_tssi[2]; - s32 rssi_buf[4]; - s32 tssival[2]; - u8 tssi_type; - - tssi_reg = read_phy_reg(pi, 0x1e9); - - temp = (s32) (tssi_reg & 0x3f); - idle_tssi[0] = (temp <= 31) ? temp : (temp - 64); - - temp = (s32) ((tssi_reg >> 8) & 0x3f); - idle_tssi[1] = (temp <= 31) ? temp : (temp - 64); - - tssi_type = - CHSPEC_IS5G(pi->radio_chanspec) ? - (u8)NPHY_RSSI_SEL_TSSI_5G : (u8)NPHY_RSSI_SEL_TSSI_2G; - - wlc_phy_poll_rssi_nphy(pi, tssi_type, rssi_buf, num_samps); - - tssival[0] = rssi_buf[0] / ((s32) num_samps); - tssival[1] = rssi_buf[2] / ((s32) num_samps); - - pwrindex[0] = idle_tssi[0] - tssival[0] + 64; - pwrindex[1] = idle_tssi[1] - tssival[1] + 64; - - if (pwrindex[0] < 0) - pwrindex[0] = 0; - else if (pwrindex[0] > 63) - pwrindex[0] = 63; - - if (pwrindex[1] < 0) - pwrindex[1] = 0; - else if (pwrindex[1] > 63) - pwrindex[1] = 63; - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_CORE1TXPWRCTL, 1, - (u32) pwrindex[0], 32, &qdBm_pwrbuf[0]); - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_CORE2TXPWRCTL, 1, - (u32) pwrindex[1], 32, &qdBm_pwrbuf[1]); -} - -static void wlc_phy_update_txcal_ladder_nphy(struct brcms_phy *pi, u16 core) -{ - int index; - u32 bbmult_scale; - u16 bbmult; - u16 tblentry; - - struct nphy_txiqcal_ladder ladder_lo[] = { - {3, 0}, {4, 0}, {6, 0}, {9, 0}, {13, 0}, {18, 0}, - {25, 0}, {25, 1}, {25, 2}, {25, 3}, {25, 4}, {25, 5}, - {25, 6}, {25, 7}, {35, 7}, {50, 7}, {71, 7}, {100, 7} - }; - - struct nphy_txiqcal_ladder ladder_iq[] = { - {3, 0}, {4, 0}, {6, 0}, {9, 0}, {13, 0}, {18, 0}, - {25, 0}, {35, 0}, {50, 0}, {71, 0}, {100, 0}, {100, 1}, - {100, 2}, {100, 3}, {100, 4}, {100, 5}, {100, 6}, {100, 7} - }; - - bbmult = (core == PHY_CORE_0) ? - ((pi->nphy_txcal_bbmult >> 8) & 0xff) : - (pi->nphy_txcal_bbmult & 0xff); - - for (index = 0; index < 18; index++) { - bbmult_scale = ladder_lo[index].percent * bbmult; - bbmult_scale /= 100; - - tblentry = - ((bbmult_scale & 0xff) << 8) | ladder_lo[index].g_env; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 1, index, 16, - &tblentry); - - bbmult_scale = ladder_iq[index].percent * bbmult; - bbmult_scale /= 100; - - tblentry = - ((bbmult_scale & 0xff) << 8) | ladder_iq[index].g_env; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 1, index + 32, - 16, &tblentry); - } -} - -static u8 wlc_phy_txpwr_idx_cur_get_nphy(struct brcms_phy *pi, u8 core) -{ - u16 tmp; - tmp = read_phy_reg(pi, ((core == PHY_CORE_0) ? 0x1ed : 0x1ee)); - - tmp = (tmp & (0x7f << 8)) >> 8; - return (u8) tmp; -} - -static void -wlc_phy_txpwr_idx_cur_set_nphy(struct brcms_phy *pi, u8 idx0, u8 idx1) -{ - mod_phy_reg(pi, 0x1e7, (0x7f << 0), idx0); - - if (NREV_GT(pi->pubpi.phy_rev, 1)) - mod_phy_reg(pi, 0x222, (0xff << 0), idx1); -} - -static u16 wlc_phy_ipa_get_bbmult_nphy(struct brcms_phy *pi) -{ - u16 m0m1; - - wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, &m0m1); - - return m0m1; -} - -static void wlc_phy_ipa_set_bbmult_nphy(struct brcms_phy *pi, u8 m0, u8 m1) -{ - u16 m0m1 = (u16) ((m0 << 8) | m1); - - wlc_phy_table_write_nphy(pi, 15, 1, 87, 16, &m0m1); - wlc_phy_table_write_nphy(pi, 15, 1, 95, 16, &m0m1); -} - -static void -wlc_phy_papd_cal_setup_nphy(struct brcms_phy *pi, - struct nphy_papd_restore_state *state, u8 core) -{ - s32 tone_freq; - u8 off_core; - u16 mixgain = 0; - - off_core = core ^ 0x1; - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - if (NREV_IS(pi->pubpi.phy_rev, 7) - || NREV_GE(pi->pubpi.phy_rev, 8)) - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 7), - wlc_phy_read_lpf_bw_ctl_nphy - (pi, - 0), 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if (pi->pubpi.radiorev == 5) - mixgain = (core == 0) ? 0x20 : 0x00; - else if ((pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == 8)) - mixgain = 0x00; - else if ((pi->pubpi.radiorev <= 4) - || (pi->pubpi.radiorev == 6)) - mixgain = 0x00; - } else { - if ((pi->pubpi.radiorev == 4) || - (pi->pubpi.radiorev == 6)) - mixgain = 0x50; - else if ((pi->pubpi.radiorev == 3) - || (pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == 8)) - mixgain = 0x0; - } - - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 11), - mixgain, (1 << core), 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - - wlc_phy_rfctrl_override_1tomany_nphy( - pi, - NPHY_REV7_RfctrlOverride_cmd_tx_pu, - 1, (1 << core), 0); - wlc_phy_rfctrl_override_1tomany_nphy( - pi, - NPHY_REV7_RfctrlOverride_cmd_tx_pu, - 0, (1 << off_core), 0); - - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), - 0, 0x3, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 2), 1, - (1 << core), 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 0), 0, - (1 << core), 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 1), 1, - (1 << core), 0, - NPHY_REV7_RFCTRLOVERRIDE_ID2); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 8), 0, - (1 << core), 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 9), 1, - (1 << core), 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 10), 0, - (1 << core), 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), 1, - (1 << core), 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 5), - 0, (1 << core), 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 4), 0, - (1 << core), 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - - state->afectrl[core] = read_phy_reg(pi, (core == PHY_CORE_0) ? - 0xa6 : 0xa7); - state->afeoverride[core] = - read_phy_reg(pi, (core == PHY_CORE_0) ? 0x8f : 0xa5); - state->afectrl[off_core] = - read_phy_reg(pi, (core == PHY_CORE_0) ? 0xa7 : 0xa6); - state->afeoverride[off_core] = - read_phy_reg(pi, (core == PHY_CORE_0) ? 0xa5 : 0x8f); - - mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0xa6 : 0xa7), - (0x1 << 2), 0); - mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0x8f : - 0xa5), (0x1 << 2), (0x1 << 2)); - - mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0xa7 : 0xa6), - (0x1 << 2), (0x1 << 2)); - mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0xa5 : - 0x8f), (0x1 << 2), (0x1 << 2)); - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - state->pwrup[core] = - READ_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_2G_PWRUP); - state->atten[core] = - READ_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_2G_ATTEN); - state->pwrup[off_core] = - READ_RADIO_REG3(pi, RADIO_2057, TX, off_core, - TXRXCOUPLE_2G_PWRUP); - state->atten[off_core] = - READ_RADIO_REG3(pi, RADIO_2057, TX, off_core, - TXRXCOUPLE_2G_ATTEN); - - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_2G_PWRUP, 0xc); - - if ((pi->pubpi.radiorev == 3) || - (pi->pubpi.radiorev == 4) || - (pi->pubpi.radiorev == 6)) - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_2G_ATTEN, 0xf0); - else if (pi->pubpi.radiorev == 5) - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_2G_ATTEN, - (core == 0) ? 0xf7 : 0xf2); - else if ((pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == 8)) - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_2G_ATTEN, 0xf0); - - WRITE_RADIO_REG3(pi, RADIO_2057, TX, off_core, - TXRXCOUPLE_2G_PWRUP, 0x0); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, off_core, - TXRXCOUPLE_2G_ATTEN, 0xff); - } else { - state->pwrup[core] = - READ_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_5G_PWRUP); - state->atten[core] = - READ_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_5G_ATTEN); - state->pwrup[off_core] = - READ_RADIO_REG3(pi, RADIO_2057, TX, off_core, - TXRXCOUPLE_5G_PWRUP); - state->atten[off_core] = - READ_RADIO_REG3(pi, RADIO_2057, TX, off_core, - TXRXCOUPLE_5G_ATTEN); - - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_5G_PWRUP, 0xc); - - if ((pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == 8)) - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_5G_ATTEN, 0xf4); - - else - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_5G_ATTEN, 0xf0); - - WRITE_RADIO_REG3(pi, RADIO_2057, TX, off_core, - TXRXCOUPLE_5G_PWRUP, 0x0); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, off_core, - TXRXCOUPLE_5G_ATTEN, 0xff); - } - - tone_freq = 4000; - - wlc_phy_tx_tone_nphy(pi, tone_freq, 181, 0, 0, false); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (NPHY_PAPD_COMP_ON) << 0); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x1 << 13), (1) << 13); - - mod_phy_reg(pi, (off_core == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (NPHY_PAPD_COMP_OFF) << 0); - - mod_phy_reg(pi, (off_core == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x1 << 13), (0) << 13); - - } else { - - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12), 0, 0x3, 0); - - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 3), 1, 0, 0); - - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 0), 0, 0x3, 0); - - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 2), 1, 0x3, 0); - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 1), 1, 0x3, 0); - - state->afectrl[core] = read_phy_reg(pi, (core == PHY_CORE_0) ? - 0xa6 : 0xa7); - state->afeoverride[core] = - read_phy_reg(pi, (core == PHY_CORE_0) ? 0x8f : 0xa5); - - mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0xa6 : 0xa7), - (0x1 << 0) | (0x1 << 1) | (0x1 << 2), 0); - mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0x8f : - 0xa5), - (0x1 << 0) | - (0x1 << 1) | - (0x1 << 2), (0x1 << 0) | (0x1 << 1) | (0x1 << 2)); - - state->vga_master[core] = - READ_RADIO_REG2(pi, RADIO_2056, RX, core, VGA_MASTER); - WRITE_RADIO_REG2(pi, RADIO_2056, RX, core, VGA_MASTER, 0x2b); - if (CHSPEC_IS2G(pi->radio_chanspec)) { - state->fbmix[core] = - READ_RADIO_REG2(pi, RADIO_2056, RX, core, - TXFBMIX_G); - state->intpa_master[core] = - READ_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAG_MASTER); - - WRITE_RADIO_REG2(pi, RADIO_2056, RX, core, TXFBMIX_G, - 0x03); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAG_MASTER, 0x04); - } else { - state->fbmix[core] = - READ_RADIO_REG2(pi, RADIO_2056, RX, core, - TXFBMIX_A); - state->intpa_master[core] = - READ_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAA_MASTER); - - WRITE_RADIO_REG2(pi, RADIO_2056, RX, core, TXFBMIX_A, - 0x03); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAA_MASTER, 0x04); - - } - - tone_freq = 4000; - - wlc_phy_tx_tone_nphy(pi, tone_freq, 181, 0, 0, false); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (1) << 0); - - mod_phy_reg(pi, (off_core == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (0) << 0); - - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 3), 0, 0x3, 0); - } -} - -static void -wlc_phy_papd_cal_cleanup_nphy(struct brcms_phy *pi, - struct nphy_papd_restore_state *state) -{ - u8 core; - - wlc_phy_stopplayback_nphy(pi); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_2G_PWRUP, 0); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_2G_ATTEN, - state->atten[core]); - } else { - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_5G_PWRUP, 0); - WRITE_RADIO_REG3(pi, RADIO_2057, TX, core, - TXRXCOUPLE_5G_ATTEN, - state->atten[core]); - } - } - - if ((pi->pubpi.radiorev == 4) || (pi->pubpi.radiorev == 6)) - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 2), - 1, 0x3, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - else - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 2), - 0, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 1), - 0, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 0), 0, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID2); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 2), 0, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID2); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 11), 1, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), 0, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 11), 0, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 12), 0, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 2), 1, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 0), 0, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 1), 1, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID2); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 8), 0, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 9), 1, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 10), 0, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), 1, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 5), 0, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 4), 0, 0x3, 1, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - - write_phy_reg(pi, (core == PHY_CORE_0) ? - 0xa6 : 0xa7, state->afectrl[core]); - write_phy_reg(pi, (core == PHY_CORE_0) ? 0x8f : - 0xa5, state->afeoverride[core]); - } - - wlc_phy_ipa_set_bbmult_nphy(pi, (state->mm >> 8) & 0xff, - (state->mm & 0xff)); - - if (NREV_IS(pi->pubpi.phy_rev, 7) - || NREV_GE(pi->pubpi.phy_rev, 8)) - wlc_phy_rfctrl_override_nphy_rev7( - pi, (0x1 << 7), 0, 0, - 1, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - } else { - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12), 0, 0x3, 1); - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 13), 0, 0x3, 1); - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 0), 0, 0x3, 1); - - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 2), 0, 0x3, 1); - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 1), 0, 0x3, 1); - - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - - WRITE_RADIO_REG2(pi, RADIO_2056, RX, core, VGA_MASTER, - state->vga_master[core]); - if (CHSPEC_IS2G(pi->radio_chanspec)) { - WRITE_RADIO_REG2(pi, RADIO_2056, RX, core, - TXFBMIX_G, state->fbmix[core]); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAG_MASTER, - state->intpa_master[core]); - } else { - WRITE_RADIO_REG2(pi, RADIO_2056, RX, core, - TXFBMIX_A, state->fbmix[core]); - WRITE_RADIO_REG2(pi, RADIO_2056, TX, core, - INTPAA_MASTER, - state->intpa_master[core]); - } - - write_phy_reg(pi, (core == PHY_CORE_0) ? - 0xa6 : 0xa7, state->afectrl[core]); - write_phy_reg(pi, (core == PHY_CORE_0) ? 0x8f : - 0xa5, state->afeoverride[core]); - } - - wlc_phy_ipa_set_bbmult_nphy(pi, (state->mm >> 8) & 0xff, - (state->mm & 0xff)); - - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 3), 0, 0x3, 1); - } -} - -static void -wlc_phy_a1_nphy(struct brcms_phy *pi, u8 core, u32 winsz, u32 start, - u32 end) -{ - u32 *buf, *src, *dst, sz; - - sz = end - start + 1; - - buf = kmalloc(2 * sizeof(u32) * NPHY_PAPD_EPS_TBL_SIZE, GFP_ATOMIC); - if (NULL == buf) - return; - - src = buf; - dst = buf + NPHY_PAPD_EPS_TBL_SIZE; - - wlc_phy_table_read_nphy(pi, - (core == - PHY_CORE_0 ? NPHY_TBL_ID_EPSILONTBL0 : - NPHY_TBL_ID_EPSILONTBL1), - NPHY_PAPD_EPS_TBL_SIZE, 0, 32, src); - - do { - u32 phy_a1, phy_a2; - s32 phy_a3, phy_a4, phy_a5, phy_a6, phy_a7; - - phy_a1 = end - min(end, (winsz >> 1)); - phy_a2 = min_t(u32, NPHY_PAPD_EPS_TBL_SIZE - 1, - end + (winsz >> 1)); - phy_a3 = phy_a2 - phy_a1 + 1; - phy_a6 = 0; - phy_a7 = 0; - - do { - wlc_phy_papd_decode_epsilon(src[phy_a2], &phy_a4, - &phy_a5); - phy_a6 += phy_a4; - phy_a7 += phy_a5; - } while (phy_a2-- != phy_a1); - - phy_a6 /= phy_a3; - phy_a7 /= phy_a3; - dst[end] = ((u32) phy_a7 << 13) | ((u32) phy_a6 & 0x1fff); - } while (end-- != start); - - wlc_phy_table_write_nphy(pi, - (core == - PHY_CORE_0) ? NPHY_TBL_ID_EPSILONTBL0 : - NPHY_TBL_ID_EPSILONTBL1, sz, start, 32, dst); - - kfree(buf); -} - -static void -wlc_phy_a2_nphy(struct brcms_phy *pi, struct nphy_ipa_txcalgains *txgains, - enum phy_cal_mode cal_mode, u8 core) -{ - u16 phy_a1, phy_a2, phy_a3; - u16 phy_a4, phy_a5; - bool phy_a6; - u8 phy_a7, m[2]; - u32 phy_a8 = 0; - struct nphy_txgains phy_a9; - - if (NREV_LT(pi->pubpi.phy_rev, 3)) - return; - - phy_a7 = (core == PHY_CORE_0) ? 1 : 0; - - phy_a6 = ((cal_mode == CAL_GCTRL) - || (cal_mode == CAL_SOFT)) ? true : false; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - phy_a9 = wlc_phy_get_tx_gain_nphy(pi); - - if (CHSPEC_IS2G(pi->radio_chanspec)) - phy_a5 = ((phy_a9.txlpf[core] << 15) | - (phy_a9.txgm[core] << 12) | - (phy_a9.pga[core] << 8) | - (txgains->gains.pad[core] << 3) | - (phy_a9.ipa[core])); - else - phy_a5 = ((phy_a9.txlpf[core] << 15) | - (phy_a9.txgm[core] << 12) | - (txgains->gains.pga[core] << 8) | - (phy_a9.pad[core] << 3) | (phy_a9.ipa[core])); - - wlc_phy_rfctrl_override_1tomany_nphy( - pi, - NPHY_REV7_RfctrlOverride_cmd_txgain, - phy_a5, (1 << core), 0); - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if ((pi->pubpi.radiorev <= 4) - || (pi->pubpi.radiorev == 6)) - m[core] = (pi->bw == WL_CHANSPEC_BW_40) ? - 60 : 79; - else - m[core] = (pi->bw == WL_CHANSPEC_BW_40) ? - 45 : 64; - } else { - m[core] = (pi->bw == WL_CHANSPEC_BW_40) ? 75 : 107; - } - - m[phy_a7] = 0; - wlc_phy_ipa_set_bbmult_nphy(pi, m[0], m[1]); - - phy_a2 = 63; - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if ((pi->pubpi.radiorev == 4) - || (pi->pubpi.radiorev == 6)) { - phy_a1 = 30; - phy_a3 = 30; - } else { - phy_a1 = 25; - phy_a3 = 25; - } - } else { - if ((pi->pubpi.radiorev == 5) - || (pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == 8)) { - phy_a1 = 25; - phy_a3 = 25; - } else { - phy_a1 = 35; - phy_a3 = 35; - } - } - - if (cal_mode == CAL_GCTRL) { - if ((pi->pubpi.radiorev == 5) - && (CHSPEC_IS2G(pi->radio_chanspec))) - phy_a1 = 55; - else if (((pi->pubpi.radiorev == 7) && - (CHSPEC_IS2G(pi->radio_chanspec))) || - ((pi->pubpi.radiorev == 8) && - (CHSPEC_IS2G(pi->radio_chanspec)))) - phy_a1 = 60; - else - phy_a1 = 63; - - } else if ((cal_mode != CAL_FULL) && (cal_mode != CAL_SOFT)) { - - phy_a1 = 35; - phy_a3 = 35; - } - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (1) << 0); - - mod_phy_reg(pi, (phy_a7 == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (0) << 0); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x1 << 13), (1) << 13); - - mod_phy_reg(pi, (phy_a7 == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x1 << 13), (0) << 13); - - write_phy_reg(pi, 0x2a1, 0x80); - write_phy_reg(pi, 0x2a2, 0x100); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x7 << 4), (11) << 4); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x7 << 8), (11) << 8); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x7 << 0), (0x3) << 0); - - write_phy_reg(pi, 0x2e5, 0x20); - - mod_phy_reg(pi, 0x2a0, (0x3f << 0), (phy_a3) << 0); - - mod_phy_reg(pi, 0x29f, (0x3f << 0), (phy_a1) << 0); - - mod_phy_reg(pi, 0x29f, (0x3f << 8), (phy_a2) << 8); - - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), - 1, ((core == 0) ? 1 : 2), 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), - 0, ((core == 0) ? 2 : 1), 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - - write_phy_reg(pi, 0x2be, 1); - SPINWAIT(read_phy_reg(pi, 0x2be), 10 * 1000 * 1000); - - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), - 0, 0x3, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - - wlc_phy_table_write_nphy(pi, - (core == - PHY_CORE_0) ? NPHY_TBL_ID_EPSILONTBL0 - : NPHY_TBL_ID_EPSILONTBL1, 1, phy_a3, - 32, &phy_a8); - - if (cal_mode != CAL_GCTRL) { - if (CHSPEC_IS5G(pi->radio_chanspec)) - wlc_phy_a1_nphy(pi, core, 5, 0, 35); - } - - wlc_phy_rfctrl_override_1tomany_nphy( - pi, - NPHY_REV7_RfctrlOverride_cmd_txgain, - phy_a5, (1 << core), 1); - - } else { - - if (txgains) { - if (txgains->useindex) { - phy_a4 = 15 - ((txgains->index) >> 3); - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if (NREV_GE(pi->pubpi.phy_rev, 6) && - pi->sh->chip == BCMA_CHIP_ID_BCM47162) { - phy_a5 = 0x10f7 | (phy_a4 << 8); - } else if (NREV_GE(pi->pubpi.phy_rev, 6)) { - phy_a5 = 0x00f7 | (phy_a4 << 8); - } else if (NREV_IS(pi->pubpi.phy_rev, 5)) { - phy_a5 = 0x10f7 | (phy_a4 << 8); - } else { - phy_a5 = 0x50f7 | (phy_a4 << 8); - } - } else { - phy_a5 = 0x70f7 | (phy_a4 << 8); - } - wlc_phy_rfctrl_override_nphy(pi, - (0x1 << 13), - phy_a5, - (1 << core), 0); - } else { - wlc_phy_rfctrl_override_nphy(pi, - (0x1 << 13), - 0x5bf7, - (1 << core), 0); - } - } - - if (CHSPEC_IS2G(pi->radio_chanspec)) - m[core] = (pi->bw == WL_CHANSPEC_BW_40) ? 45 : 64; - else - m[core] = (pi->bw == WL_CHANSPEC_BW_40) ? 75 : 107; - - m[phy_a7] = 0; - wlc_phy_ipa_set_bbmult_nphy(pi, m[0], m[1]); - - phy_a2 = 63; - - if (cal_mode == CAL_FULL) { - phy_a1 = 25; - phy_a3 = 25; - } else if (cal_mode == CAL_SOFT) { - phy_a1 = 25; - phy_a3 = 25; - } else if (cal_mode == CAL_GCTRL) { - phy_a1 = 63; - phy_a3 = 25; - } else { - - phy_a1 = 25; - phy_a3 = 25; - } - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (1) << 0); - - mod_phy_reg(pi, (phy_a7 == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (0) << 0); - - if (NREV_GE(pi->pubpi.phy_rev, 6)) { - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x1 << 13), (1) << 13); - - mod_phy_reg(pi, (phy_a7 == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x1 << 13), (0) << 13); - - write_phy_reg(pi, 0x2a1, 0x20); - write_phy_reg(pi, 0x2a2, 0x60); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0xf << 4), (9) << 4); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0xf << 8), (9) << 8); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0xf << 0), (0x2) << 0); - - write_phy_reg(pi, 0x2e5, 0x20); - } else { - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x1 << 11), (1) << 11); - - mod_phy_reg(pi, (phy_a7 == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x1 << 11), (0) << 11); - - write_phy_reg(pi, 0x2a1, 0x80); - write_phy_reg(pi, 0x2a2, 0x600); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x7 << 4), (0) << 4); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x7 << 8), (0) << 8); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x7 << 0), (0x3) << 0); - - mod_phy_reg(pi, 0x2a0, (0x3f << 8), (0x20) << 8); - - } - - mod_phy_reg(pi, 0x2a0, (0x3f << 0), (phy_a3) << 0); - - mod_phy_reg(pi, 0x29f, (0x3f << 0), (phy_a1) << 0); - - mod_phy_reg(pi, 0x29f, (0x3f << 8), (phy_a2) << 8); - - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 3), 1, 0x3, 0); - - write_phy_reg(pi, 0x2be, 1); - SPINWAIT(read_phy_reg(pi, 0x2be), 10 * 1000 * 1000); - - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 3), 0, 0x3, 0); - - wlc_phy_table_write_nphy(pi, - (core == - PHY_CORE_0) ? NPHY_TBL_ID_EPSILONTBL0 - : NPHY_TBL_ID_EPSILONTBL1, 1, phy_a3, - 32, &phy_a8); - - if (cal_mode != CAL_GCTRL) - wlc_phy_a1_nphy(pi, core, 5, 0, 40); - } -} - -static u8 wlc_phy_a3_nphy(struct brcms_phy *pi, u8 start_gain, u8 core) -{ - int phy_a1; - int phy_a2; - bool phy_a3; - struct nphy_ipa_txcalgains phy_a4; - bool phy_a5 = false; - bool phy_a6 = true; - s32 phy_a7, phy_a8; - u32 phy_a9; - int phy_a10; - bool phy_a11 = false; - int phy_a12; - u8 phy_a13 = 0; - u8 phy_a14; - u8 *phy_a15 = NULL; - - phy_a4.useindex = true; - phy_a12 = start_gain; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - phy_a2 = 20; - phy_a1 = 1; - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if (pi->pubpi.radiorev == 5) { - - phy_a15 = pad_gain_codes_used_2057rev5; - phy_a13 = - ARRAY_SIZE(pad_gain_codes_used_2057rev5) - 1; - - } else if ((pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == 8)) { - - phy_a15 = pad_gain_codes_used_2057rev7; - phy_a13 = - ARRAY_SIZE(pad_gain_codes_used_2057rev7) - 1; - - } else { - - phy_a15 = pad_all_gain_codes_2057; - phy_a13 = ARRAY_SIZE(pad_all_gain_codes_2057) - - 1; - } - - } else { - - phy_a15 = pga_all_gain_codes_2057; - phy_a13 = ARRAY_SIZE(pga_all_gain_codes_2057) - 1; - } - - phy_a14 = 0; - - for (phy_a10 = 0; phy_a10 < phy_a2; phy_a10++) { - if (CHSPEC_IS2G(pi->radio_chanspec)) - phy_a4.gains.pad[core] = - (u16) phy_a15[phy_a12]; - else - phy_a4.gains.pga[core] = - (u16) phy_a15[phy_a12]; - - wlc_phy_a2_nphy(pi, &phy_a4, CAL_GCTRL, core); - - wlc_phy_table_read_nphy(pi, - (core == - PHY_CORE_0 ? - NPHY_TBL_ID_EPSILONTBL0 : - NPHY_TBL_ID_EPSILONTBL1), 1, - 63, 32, &phy_a9); - - wlc_phy_papd_decode_epsilon(phy_a9, &phy_a7, &phy_a8); - - phy_a3 = ((phy_a7 == 4095) || (phy_a7 == -4096) || - (phy_a8 == 4095) || (phy_a8 == -4096)); - - if (!phy_a6 && (phy_a3 != phy_a5)) { - if (!phy_a3) - phy_a12 -= (u8) phy_a1; - - phy_a11 = true; - break; - } - - if (phy_a3) - phy_a12 += (u8) phy_a1; - else - phy_a12 -= (u8) phy_a1; - - if ((phy_a12 < phy_a14) || (phy_a12 > phy_a13)) { - if (phy_a12 < phy_a14) - phy_a12 = phy_a14; - else - phy_a12 = phy_a13; - - phy_a11 = true; - break; - } - - phy_a6 = false; - phy_a5 = phy_a3; - } - - } else { - phy_a2 = 10; - phy_a1 = 8; - for (phy_a10 = 0; phy_a10 < phy_a2; phy_a10++) { - phy_a4.index = (u8) phy_a12; - wlc_phy_a2_nphy(pi, &phy_a4, CAL_GCTRL, core); - - wlc_phy_table_read_nphy(pi, - (core == - PHY_CORE_0 ? - NPHY_TBL_ID_EPSILONTBL0 : - NPHY_TBL_ID_EPSILONTBL1), 1, - 63, 32, &phy_a9); - - wlc_phy_papd_decode_epsilon(phy_a9, &phy_a7, &phy_a8); - - phy_a3 = ((phy_a7 == 4095) || (phy_a7 == -4096) || - (phy_a8 == 4095) || (phy_a8 == -4096)); - - if (!phy_a6 && (phy_a3 != phy_a5)) { - if (!phy_a3) - phy_a12 -= (u8) phy_a1; - - phy_a11 = true; - break; - } - - if (phy_a3) - phy_a12 += (u8) phy_a1; - else - phy_a12 -= (u8) phy_a1; - - if ((phy_a12 < 0) || (phy_a12 > 127)) { - if (phy_a12 < 0) - phy_a12 = 0; - else - phy_a12 = 127; - - phy_a11 = true; - break; - } - - phy_a6 = false; - phy_a5 = phy_a3; - } - - } - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - return (u8) phy_a15[phy_a12]; - else - return (u8) phy_a12; - -} - -static void wlc_phy_a4(struct brcms_phy *pi, bool full_cal) -{ - struct nphy_ipa_txcalgains phy_b1[2]; - struct nphy_papd_restore_state phy_b2; - bool phy_b3; - u8 phy_b4; - u8 phy_b5; - s16 phy_b6, phy_b7, phy_b8; - u16 phy_b9; - s16 phy_b10, phy_b11, phy_b12; - - phy_b11 = 0; - phy_b12 = 0; - phy_b7 = 0; - phy_b8 = 0; - phy_b6 = 0; - - if (pi->nphy_papd_skip == 1) - return; - - phy_b3 = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & - MCTL_EN_MAC)); - if (!phy_b3) - wlapi_suspend_mac_and_wait(pi->sh->physhim); - - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - pi->nphy_force_papd_cal = false; - - for (phy_b5 = 0; phy_b5 < pi->pubpi.phy_corenum; phy_b5++) - pi->nphy_papd_tx_gain_at_last_cal[phy_b5] = - wlc_phy_txpwr_idx_cur_get_nphy(pi, phy_b5); - - pi->nphy_papd_last_cal = pi->sh->now; - pi->nphy_papd_recal_counter++; - - phy_b4 = pi->nphy_txpwrctrl; - wlc_phy_txpwrctrl_enable_nphy(pi, PHY_TPC_HW_OFF); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_SCALARTBL0, 64, 0, 32, - nphy_papd_scaltbl); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_SCALARTBL1, 64, 0, 32, - nphy_papd_scaltbl); - - phy_b9 = read_phy_reg(pi, 0x01); - mod_phy_reg(pi, 0x01, (0x1 << 15), 0); - - for (phy_b5 = 0; phy_b5 < pi->pubpi.phy_corenum; phy_b5++) { - s32 i, val = 0; - for (i = 0; i < 64; i++) - wlc_phy_table_write_nphy(pi, - ((phy_b5 == - PHY_CORE_0) ? - NPHY_TBL_ID_EPSILONTBL0 : - NPHY_TBL_ID_EPSILONTBL1), 1, - i, 32, &val); - } - - wlc_phy_ipa_restore_tx_digi_filts_nphy(pi); - - phy_b2.mm = wlc_phy_ipa_get_bbmult_nphy(pi); - for (phy_b5 = 0; phy_b5 < pi->pubpi.phy_corenum; phy_b5++) { - wlc_phy_papd_cal_setup_nphy(pi, &phy_b2, phy_b5); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if ((pi->pubpi.radiorev == 3) - || (pi->pubpi.radiorev == 4) - || (pi->pubpi.radiorev == 6)) { - pi->nphy_papd_cal_gain_index[phy_b5] = - 23; - } else if (pi->pubpi.radiorev == 5) { - pi->nphy_papd_cal_gain_index[phy_b5] = - 0; - pi->nphy_papd_cal_gain_index[phy_b5] = - wlc_phy_a3_nphy( - pi, - pi-> - nphy_papd_cal_gain_index - [phy_b5], - phy_b5); - - } else if ((pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == 8)) { - - pi->nphy_papd_cal_gain_index[phy_b5] = - 0; - pi->nphy_papd_cal_gain_index[phy_b5] = - wlc_phy_a3_nphy( - pi, - pi-> - nphy_papd_cal_gain_index - [phy_b5], - phy_b5); - - } - - phy_b1[phy_b5].gains.pad[phy_b5] = - pi->nphy_papd_cal_gain_index[phy_b5]; - - } else { - pi->nphy_papd_cal_gain_index[phy_b5] = 0; - pi->nphy_papd_cal_gain_index[phy_b5] = - wlc_phy_a3_nphy( - pi, - pi-> - nphy_papd_cal_gain_index - [phy_b5], phy_b5); - phy_b1[phy_b5].gains.pga[phy_b5] = - pi->nphy_papd_cal_gain_index[phy_b5]; - } - } else { - phy_b1[phy_b5].useindex = true; - phy_b1[phy_b5].index = 16; - phy_b1[phy_b5].index = - wlc_phy_a3_nphy(pi, phy_b1[phy_b5].index, - phy_b5); - - pi->nphy_papd_cal_gain_index[phy_b5] = - 15 - ((phy_b1[phy_b5].index) >> 3); - } - - switch (pi->nphy_papd_cal_type) { - case 0: - wlc_phy_a2_nphy(pi, &phy_b1[phy_b5], CAL_FULL, phy_b5); - break; - case 1: - wlc_phy_a2_nphy(pi, &phy_b1[phy_b5], CAL_SOFT, phy_b5); - break; - } - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - wlc_phy_papd_cal_cleanup_nphy(pi, &phy_b2); - } - - if (NREV_LT(pi->pubpi.phy_rev, 7)) - wlc_phy_papd_cal_cleanup_nphy(pi, &phy_b2); - - for (phy_b5 = 0; phy_b5 < pi->pubpi.phy_corenum; phy_b5++) { - int eps_offset = 0; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if (CHSPEC_IS2G(pi->radio_chanspec)) { - if (pi->pubpi.radiorev == 3) - eps_offset = -2; - else if (pi->pubpi.radiorev == 5) - eps_offset = 3; - else - eps_offset = -1; - } else { - eps_offset = 2; - } - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - phy_b8 = phy_b1[phy_b5].gains.pad[phy_b5]; - phy_b10 = 0; - if ((pi->pubpi.radiorev == 3) || - (pi->pubpi.radiorev == 4) || - (pi->pubpi.radiorev == 6)) { - phy_b12 = -( - nphy_papd_padgain_dlt_2g_2057rev3n4 - [phy_b8] + 1) / 2; - phy_b10 = -1; - } else if (pi->pubpi.radiorev == 5) { - phy_b12 = -( - nphy_papd_padgain_dlt_2g_2057rev5 - [phy_b8] + 1) / 2; - } else if ((pi->pubpi.radiorev == 7) || - (pi->pubpi.radiorev == 8)) { - phy_b12 = -( - nphy_papd_padgain_dlt_2g_2057rev7 - [phy_b8] + 1) / 2; - } - } else { - phy_b7 = phy_b1[phy_b5].gains.pga[phy_b5]; - if ((pi->pubpi.radiorev == 3) || - (pi->pubpi.radiorev == 4) || - (pi->pubpi.radiorev == 6)) - phy_b11 = - -(nphy_papd_pgagain_dlt_5g_2057 - [phy_b7] - + 1) / 2; - else if ((pi->pubpi.radiorev == 7) - || (pi->pubpi.radiorev == 8)) - phy_b11 = -( - nphy_papd_pgagain_dlt_5g_2057rev7 - [phy_b7] + 1) / 2; - - phy_b10 = -9; - } - - if (CHSPEC_IS2G(pi->radio_chanspec)) - phy_b6 = - -60 + 27 + eps_offset + phy_b12 + - phy_b10; - else - phy_b6 = - -60 + 27 + eps_offset + phy_b11 + - phy_b10; - - mod_phy_reg(pi, (phy_b5 == PHY_CORE_0) ? 0x298 : - 0x29c, (0x1ff << 7), (phy_b6) << 7); - - pi->nphy_papd_epsilon_offset[phy_b5] = phy_b6; - } else { - if (NREV_LT(pi->pubpi.phy_rev, 5)) - eps_offset = 4; - else - eps_offset = 2; - - phy_b7 = 15 - ((phy_b1[phy_b5].index) >> 3); - - if (CHSPEC_IS2G(pi->radio_chanspec)) { - phy_b11 = - -(nphy_papd_pga_gain_delta_ipa_2g[ - phy_b7] + - 1) / 2; - phy_b10 = 0; - } else { - phy_b11 = - -(nphy_papd_pga_gain_delta_ipa_5g[ - phy_b7] + - 1) / 2; - phy_b10 = -9; - } - - phy_b6 = -60 + 27 + eps_offset + phy_b11 + phy_b10; - - mod_phy_reg(pi, (phy_b5 == PHY_CORE_0) ? 0x298 : - 0x29c, (0x1ff << 7), (phy_b6) << 7); - - pi->nphy_papd_epsilon_offset[phy_b5] = phy_b6; - } - } - - mod_phy_reg(pi, (0 == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (NPHY_PAPD_COMP_ON) << 0); - - mod_phy_reg(pi, (1 == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (NPHY_PAPD_COMP_ON) << 0); - - if (NREV_GE(pi->pubpi.phy_rev, 6)) { - mod_phy_reg(pi, (0 == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x1 << 13), (0) << 13); - - mod_phy_reg(pi, (1 == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x1 << 13), (0) << 13); - - } else { - mod_phy_reg(pi, (0 == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x1 << 11), (0) << 11); - - mod_phy_reg(pi, (1 == PHY_CORE_0) ? 0x2a3 : - 0x2a4, (0x1 << 11), (0) << 11); - - } - pi->nphy_papdcomp = NPHY_PAPD_COMP_ON; - - write_phy_reg(pi, 0x01, phy_b9); - - wlc_phy_ipa_set_tx_digi_filts_nphy(pi); - - wlc_phy_txpwrctrl_enable_nphy(pi, phy_b4); - if (phy_b4 == PHY_TPC_HW_OFF) { - wlc_phy_txpwr_index_nphy(pi, (1 << 0), - (s8) (pi->nphy_txpwrindex[0]. - index_internal), false); - wlc_phy_txpwr_index_nphy(pi, (1 << 1), - (s8) (pi->nphy_txpwrindex[1]. - index_internal), false); - } - - wlc_phy_stay_in_carriersearch_nphy(pi, false); - - if (!phy_b3) - wlapi_enable_mac(pi->sh->physhim); -} - -void wlc_phy_cal_perical_nphy_run(struct brcms_phy *pi, u8 caltype) -{ - struct nphy_txgains target_gain; - u8 tx_pwr_ctrl_state; - bool fullcal = true; - bool restore_tx_gain = false; - bool mphase; - - if (PHY_MUTED(pi)) - return; - - if (caltype == PHY_PERICAL_AUTO) - fullcal = (pi->radio_chanspec != pi->nphy_txiqlocal_chanspec); - else if (caltype == PHY_PERICAL_PARTIAL) - fullcal = false; - - if (pi->cal_type_override != PHY_PERICAL_AUTO) - fullcal = - (pi->cal_type_override == - PHY_PERICAL_FULL) ? true : false; - - if ((pi->mphase_cal_phase_id > MPHASE_CAL_STATE_INIT)) { - if (pi->nphy_txiqlocal_chanspec != pi->radio_chanspec) - wlc_phy_cal_perical_mphase_restart(pi); - } - - if ((pi->mphase_cal_phase_id == MPHASE_CAL_STATE_RXCAL)) - wlapi_bmac_write_shm(pi->sh->physhim, M_CTS_DURATION, 10000); - - wlapi_suspend_mac_and_wait(pi->sh->physhim); - - wlc_phyreg_enter((struct brcms_phy_pub *) pi); - - if ((pi->mphase_cal_phase_id == MPHASE_CAL_STATE_IDLE) || - (pi->mphase_cal_phase_id == MPHASE_CAL_STATE_INIT)) { - pi->nphy_cal_orig_pwr_idx[0] = - (u8) ((read_phy_reg(pi, 0x1ed) >> 8) & 0x7f); - pi->nphy_cal_orig_pwr_idx[1] = - (u8) ((read_phy_reg(pi, 0x1ee) >> 8) & 0x7f); - - if (pi->nphy_txpwrctrl != PHY_TPC_HW_OFF) { - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, - 0x110, 16, - pi->nphy_cal_orig_tx_gain); - } else { - pi->nphy_cal_orig_tx_gain[0] = 0; - pi->nphy_cal_orig_tx_gain[1] = 0; - } - } - target_gain = wlc_phy_get_tx_gain_nphy(pi); - tx_pwr_ctrl_state = pi->nphy_txpwrctrl; - wlc_phy_txpwrctrl_enable_nphy(pi, PHY_TPC_HW_OFF); - - if (pi->antsel_type == ANTSEL_2x3) - wlc_phy_antsel_init((struct brcms_phy_pub *) pi, true); - - mphase = (pi->mphase_cal_phase_id != MPHASE_CAL_STATE_IDLE); - if (!mphase) { - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - wlc_phy_precal_txgain_nphy(pi); - pi->nphy_cal_target_gain = wlc_phy_get_tx_gain_nphy(pi); - restore_tx_gain = true; - - target_gain = pi->nphy_cal_target_gain; - } - if (0 == - wlc_phy_cal_txiqlo_nphy(pi, target_gain, fullcal, - mphase)) { - if (PHY_IPA(pi)) - wlc_phy_a4(pi, true); - - wlc_phyreg_exit((struct brcms_phy_pub *) pi); - wlapi_enable_mac(pi->sh->physhim); - wlapi_bmac_write_shm(pi->sh->physhim, M_CTS_DURATION, - 10000); - wlapi_suspend_mac_and_wait(pi->sh->physhim); - wlc_phyreg_enter((struct brcms_phy_pub *) pi); - - if (0 == wlc_phy_cal_rxiq_nphy(pi, target_gain, - (pi->first_cal_after_assoc || - (pi->cal_type_override == - PHY_PERICAL_FULL)) ? 2 : 0, false)) { - wlc_phy_savecal_nphy(pi); - - wlc_phy_txpwrctrl_coeff_setup_nphy(pi); - - pi->nphy_perical_last = pi->sh->now; - } - } - if (caltype != PHY_PERICAL_AUTO) - wlc_phy_rssi_cal_nphy(pi); - - if (pi->first_cal_after_assoc - || (pi->cal_type_override == PHY_PERICAL_FULL)) { - pi->first_cal_after_assoc = false; - wlc_phy_txpwrctrl_idle_tssi_nphy(pi); - wlc_phy_txpwrctrl_pwr_setup_nphy(pi); - } - - if (NREV_GE(pi->pubpi.phy_rev, 3)) - wlc_phy_radio205x_vcocal_nphy(pi); - } else { - switch (pi->mphase_cal_phase_id) { - case MPHASE_CAL_STATE_INIT: - pi->nphy_perical_last = pi->sh->now; - pi->nphy_txiqlocal_chanspec = pi->radio_chanspec; - - if (NREV_GE(pi->pubpi.phy_rev, 3)) - wlc_phy_precal_txgain_nphy(pi); - - pi->nphy_cal_target_gain = wlc_phy_get_tx_gain_nphy(pi); - pi->mphase_cal_phase_id++; - break; - - case MPHASE_CAL_STATE_TXPHASE0: - case MPHASE_CAL_STATE_TXPHASE1: - case MPHASE_CAL_STATE_TXPHASE2: - case MPHASE_CAL_STATE_TXPHASE3: - case MPHASE_CAL_STATE_TXPHASE4: - case MPHASE_CAL_STATE_TXPHASE5: - if ((pi->radar_percal_mask & 0x10) != 0) - pi->nphy_rxcal_active = true; - - if (wlc_phy_cal_txiqlo_nphy - (pi, pi->nphy_cal_target_gain, fullcal, - true) != 0) { - - wlc_phy_cal_perical_mphase_reset(pi); - break; - } - - if (NREV_LE(pi->pubpi.phy_rev, 2) && - (pi->mphase_cal_phase_id == - MPHASE_CAL_STATE_TXPHASE4)) - pi->mphase_cal_phase_id += 2; - else - pi->mphase_cal_phase_id++; - break; - - case MPHASE_CAL_STATE_PAPDCAL: - if ((pi->radar_percal_mask & 0x2) != 0) - pi->nphy_rxcal_active = true; - - if (PHY_IPA(pi)) - wlc_phy_a4(pi, true); - - pi->mphase_cal_phase_id++; - break; - - case MPHASE_CAL_STATE_RXCAL: - if ((pi->radar_percal_mask & 0x1) != 0) - pi->nphy_rxcal_active = true; - if (wlc_phy_cal_rxiq_nphy(pi, target_gain, - (pi->first_cal_after_assoc || - (pi->cal_type_override == - PHY_PERICAL_FULL)) ? 2 : 0, - false) == 0) - wlc_phy_savecal_nphy(pi); - - pi->mphase_cal_phase_id++; - break; - - case MPHASE_CAL_STATE_RSSICAL: - if ((pi->radar_percal_mask & 0x4) != 0) - pi->nphy_rxcal_active = true; - wlc_phy_txpwrctrl_coeff_setup_nphy(pi); - wlc_phy_rssi_cal_nphy(pi); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) - wlc_phy_radio205x_vcocal_nphy(pi); - - restore_tx_gain = true; - - if (pi->first_cal_after_assoc) - pi->mphase_cal_phase_id++; - else - wlc_phy_cal_perical_mphase_reset(pi); - - break; - - case MPHASE_CAL_STATE_IDLETSSI: - if ((pi->radar_percal_mask & 0x8) != 0) - pi->nphy_rxcal_active = true; - - if (pi->first_cal_after_assoc) { - pi->first_cal_after_assoc = false; - wlc_phy_txpwrctrl_idle_tssi_nphy(pi); - wlc_phy_txpwrctrl_pwr_setup_nphy(pi); - } - - wlc_phy_cal_perical_mphase_reset(pi); - break; - - default: - wlc_phy_cal_perical_mphase_reset(pi); - break; - } - } - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - if (restore_tx_gain) { - if (tx_pwr_ctrl_state != PHY_TPC_HW_OFF) { - - wlc_phy_txpwr_index_nphy(pi, 1, - pi-> - nphy_cal_orig_pwr_idx - [0], false); - wlc_phy_txpwr_index_nphy(pi, 2, - pi-> - nphy_cal_orig_pwr_idx - [1], false); - - pi->nphy_txpwrindex[0].index = -1; - pi->nphy_txpwrindex[1].index = -1; - } else { - wlc_phy_txpwr_index_nphy(pi, (1 << 0), - (s8) (pi-> - nphy_txpwrindex - [0]. - index_internal), - false); - wlc_phy_txpwr_index_nphy(pi, (1 << 1), - (s8) (pi-> - nphy_txpwrindex - [1]. - index_internal), - false); - } - } - } - - wlc_phy_txpwrctrl_enable_nphy(pi, tx_pwr_ctrl_state); - wlc_phyreg_exit((struct brcms_phy_pub *) pi); - wlapi_enable_mac(pi->sh->physhim); -} - -int -wlc_phy_cal_txiqlo_nphy(struct brcms_phy *pi, struct nphy_txgains target_gain, - bool fullcal, bool mphase) -{ - u16 val; - u16 tbl_buf[11]; - u8 cal_cnt; - u16 cal_cmd; - u8 num_cals, max_cal_cmds; - u16 core_no, cal_type; - u16 diq_start = 0; - u8 phy_bw; - u16 max_val; - u16 tone_freq; - u16 gain_save[2]; - u16 cal_gain[2]; - struct nphy_iqcal_params cal_params[2]; - u32 tbl_len; - void *tbl_ptr; - bool ladder_updated[2]; - u8 mphase_cal_lastphase = 0; - int bcmerror = 0; - bool phyhang_avoid_state = false; - - u16 tbl_tx_iqlo_cal_loft_ladder_20[] = { - 0x0300, 0x0500, 0x0700, 0x0900, 0x0d00, 0x1100, 0x1900, 0x1901, - 0x1902, - 0x1903, 0x1904, 0x1905, 0x1906, 0x1907, 0x2407, 0x3207, 0x4607, - 0x6407 - }; - - u16 tbl_tx_iqlo_cal_iqimb_ladder_20[] = { - 0x0200, 0x0300, 0x0600, 0x0900, 0x0d00, 0x1100, 0x1900, 0x2400, - 0x3200, - 0x4600, 0x6400, 0x6401, 0x6402, 0x6403, 0x6404, 0x6405, 0x6406, - 0x6407 - }; - - u16 tbl_tx_iqlo_cal_loft_ladder_40[] = { - 0x0200, 0x0300, 0x0400, 0x0700, 0x0900, 0x0c00, 0x1200, 0x1201, - 0x1202, - 0x1203, 0x1204, 0x1205, 0x1206, 0x1207, 0x1907, 0x2307, 0x3207, - 0x4707 - }; - - u16 tbl_tx_iqlo_cal_iqimb_ladder_40[] = { - 0x0100, 0x0200, 0x0400, 0x0700, 0x0900, 0x0c00, 0x1200, 0x1900, - 0x2300, - 0x3200, 0x4700, 0x4701, 0x4702, 0x4703, 0x4704, 0x4705, 0x4706, - 0x4707 - }; - - u16 tbl_tx_iqlo_cal_startcoefs[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000 - }; - - u16 tbl_tx_iqlo_cal_cmds_fullcal[] = { - 0x8123, 0x8264, 0x8086, 0x8245, 0x8056, - 0x9123, 0x9264, 0x9086, 0x9245, 0x9056 - }; - - u16 tbl_tx_iqlo_cal_cmds_recal[] = { - 0x8101, 0x8253, 0x8053, 0x8234, 0x8034, - 0x9101, 0x9253, 0x9053, 0x9234, 0x9034 - }; - - u16 tbl_tx_iqlo_cal_startcoefs_nphyrev3[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000 - }; - - u16 tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[] = { - 0x8434, 0x8334, 0x8084, 0x8267, 0x8056, 0x8234, - 0x9434, 0x9334, 0x9084, 0x9267, 0x9056, 0x9234 - }; - - u16 tbl_tx_iqlo_cal_cmds_recal_nphyrev3[] = { - 0x8423, 0x8323, 0x8073, 0x8256, 0x8045, 0x8223, - 0x9423, 0x9323, 0x9073, 0x9256, 0x9045, 0x9223 - }; - - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - if (NREV_GE(pi->pubpi.phy_rev, 4)) { - phyhang_avoid_state = pi->phyhang_avoid; - pi->phyhang_avoid = false; - } - - if (CHSPEC_IS40(pi->radio_chanspec)) - phy_bw = 40; - else - phy_bw = 20; - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, gain_save); - - for (core_no = 0; core_no <= 1; core_no++) { - wlc_phy_iqcal_gainparams_nphy(pi, core_no, target_gain, - &cal_params[core_no]); - cal_gain[core_no] = cal_params[core_no].cal_gain; - } - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, cal_gain); - - wlc_phy_txcal_radio_setup_nphy(pi); - - wlc_phy_txcal_physetup_nphy(pi); - - ladder_updated[0] = ladder_updated[1] = false; - if (!(NREV_GE(pi->pubpi.phy_rev, 6) || - (NREV_IS(pi->pubpi.phy_rev, 5) && PHY_IPA(pi) - && (CHSPEC_IS2G(pi->radio_chanspec))))) { - - if (phy_bw == 40) { - tbl_ptr = tbl_tx_iqlo_cal_loft_ladder_40; - tbl_len = ARRAY_SIZE(tbl_tx_iqlo_cal_loft_ladder_40); - } else { - tbl_ptr = tbl_tx_iqlo_cal_loft_ladder_20; - tbl_len = ARRAY_SIZE(tbl_tx_iqlo_cal_loft_ladder_20); - } - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, tbl_len, 0, - 16, tbl_ptr); - - if (phy_bw == 40) { - tbl_ptr = tbl_tx_iqlo_cal_iqimb_ladder_40; - tbl_len = ARRAY_SIZE(tbl_tx_iqlo_cal_iqimb_ladder_40); - } else { - tbl_ptr = tbl_tx_iqlo_cal_iqimb_ladder_20; - tbl_len = ARRAY_SIZE(tbl_tx_iqlo_cal_iqimb_ladder_20); - } - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, tbl_len, 32, - 16, tbl_ptr); - } - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - write_phy_reg(pi, 0xc2, 0x8ad9); - else - write_phy_reg(pi, 0xc2, 0x8aa9); - - max_val = 250; - tone_freq = (phy_bw == 20) ? 2500 : 5000; - - if (pi->mphase_cal_phase_id > MPHASE_CAL_STATE_TXPHASE0) { - wlc_phy_runsamples_nphy(pi, phy_bw * 8, 0xffff, 0, 1, 0, false); - bcmerror = 0; - } else { - bcmerror = - wlc_phy_tx_tone_nphy(pi, tone_freq, max_val, 1, 0, - false); - } - - if (bcmerror == 0) { - - if (pi->mphase_cal_phase_id > MPHASE_CAL_STATE_TXPHASE0) { - tbl_ptr = pi->mphase_txcal_bestcoeffs; - tbl_len = ARRAY_SIZE(pi->mphase_txcal_bestcoeffs); - if (NREV_LT(pi->pubpi.phy_rev, 3)) - tbl_len -= 2; - } else { - if ((!fullcal) && (pi->nphy_txiqlocal_coeffsvalid)) { - - tbl_ptr = pi->nphy_txiqlocal_bestc; - tbl_len = ARRAY_SIZE(pi->nphy_txiqlocal_bestc); - if (NREV_LT(pi->pubpi.phy_rev, 3)) - tbl_len -= 2; - } else { - - fullcal = true; - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - tbl_ptr = - tbl_tx_iqlo_cal_startcoefs_nphyrev3; - tbl_len = ARRAY_SIZE( - tbl_tx_iqlo_cal_startcoefs_nphyrev3); - } else { - tbl_ptr = tbl_tx_iqlo_cal_startcoefs; - tbl_len = ARRAY_SIZE( - tbl_tx_iqlo_cal_startcoefs); - } - } - } - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, tbl_len, 64, - 16, tbl_ptr); - - if (fullcal) { - max_cal_cmds = (NREV_GE(pi->pubpi.phy_rev, 3)) ? - ARRAY_SIZE( - tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3) : - ARRAY_SIZE(tbl_tx_iqlo_cal_cmds_fullcal); - } else { - max_cal_cmds = (NREV_GE(pi->pubpi.phy_rev, 3)) ? - ARRAY_SIZE( - tbl_tx_iqlo_cal_cmds_recal_nphyrev3) : - ARRAY_SIZE(tbl_tx_iqlo_cal_cmds_recal); - } - - if (mphase) { - cal_cnt = pi->mphase_txcal_cmdidx; - if ((cal_cnt + pi->mphase_txcal_numcmds) < max_cal_cmds) - num_cals = cal_cnt + pi->mphase_txcal_numcmds; - else - num_cals = max_cal_cmds; - } else { - cal_cnt = 0; - num_cals = max_cal_cmds; - } - - for (; cal_cnt < num_cals; cal_cnt++) { - - if (fullcal) { - cal_cmd = (NREV_GE(pi->pubpi.phy_rev, 3)) ? - tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3 - [cal_cnt] : - tbl_tx_iqlo_cal_cmds_fullcal[cal_cnt]; - } else { - cal_cmd = (NREV_GE(pi->pubpi.phy_rev, 3)) ? - tbl_tx_iqlo_cal_cmds_recal_nphyrev3[ - cal_cnt] - : tbl_tx_iqlo_cal_cmds_recal[cal_cnt]; - } - - core_no = ((cal_cmd & 0x3000) >> 12); - cal_type = ((cal_cmd & 0x0F00) >> 8); - - if (NREV_GE(pi->pubpi.phy_rev, 6) || - (NREV_IS(pi->pubpi.phy_rev, 5) && - PHY_IPA(pi) - && (CHSPEC_IS2G(pi->radio_chanspec)))) { - if (!ladder_updated[core_no]) { - wlc_phy_update_txcal_ladder_nphy( - pi, - core_no); - ladder_updated[core_no] = true; - } - } - - val = - (cal_params[core_no]. - ncorr[cal_type] << 8) | NPHY_N_GCTL; - write_phy_reg(pi, 0xc1, val); - - if ((cal_type == 1) || (cal_type == 3) - || (cal_type == 4)) { - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, - 1, 69 + core_no, 16, - tbl_buf); - - diq_start = tbl_buf[0]; - - tbl_buf[0] = 0; - wlc_phy_table_write_nphy(pi, - NPHY_TBL_ID_IQLOCAL, 1, - 69 + core_no, 16, - tbl_buf); - } - - write_phy_reg(pi, 0xc0, cal_cmd); - - SPINWAIT(((read_phy_reg(pi, 0xc0) & 0xc000) != 0), - 20000); - if (WARN(read_phy_reg(pi, 0xc0) & 0xc000, - "HW error: txiq calib")) - return -EIO; - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, - tbl_len, 96, 16, tbl_buf); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, - tbl_len, 64, 16, tbl_buf); - - if ((cal_type == 1) || (cal_type == 3) - || (cal_type == 4)) { - - tbl_buf[0] = diq_start; - - } - - } - - if (mphase) { - pi->mphase_txcal_cmdidx = num_cals; - if (pi->mphase_txcal_cmdidx >= max_cal_cmds) - pi->mphase_txcal_cmdidx = 0; - } - - mphase_cal_lastphase = - (NREV_LE(pi->pubpi.phy_rev, 2)) ? - MPHASE_CAL_STATE_TXPHASE4 : MPHASE_CAL_STATE_TXPHASE5; - - if (!mphase - || (pi->mphase_cal_phase_id == mphase_cal_lastphase)) { - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 96, - 16, tbl_buf); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 80, - 16, tbl_buf); - - if (NREV_LT(pi->pubpi.phy_rev, 2)) { - - tbl_buf[0] = 0; - tbl_buf[1] = 0; - tbl_buf[2] = 0; - tbl_buf[3] = 0; - - } - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 88, - 16, tbl_buf); - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 101, - 16, tbl_buf); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 85, - 16, tbl_buf); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 93, - 16, tbl_buf); - - tbl_len = ARRAY_SIZE(pi->nphy_txiqlocal_bestc); - if (NREV_LT(pi->pubpi.phy_rev, 3)) - tbl_len -= 2; - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, - tbl_len, 96, 16, - pi->nphy_txiqlocal_bestc); - - pi->nphy_txiqlocal_coeffsvalid = true; - pi->nphy_txiqlocal_chanspec = pi->radio_chanspec; - } else { - tbl_len = ARRAY_SIZE(pi->mphase_txcal_bestcoeffs); - if (NREV_LT(pi->pubpi.phy_rev, 3)) - tbl_len -= 2; - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, - tbl_len, 96, 16, - pi->mphase_txcal_bestcoeffs); - } - - wlc_phy_stopplayback_nphy(pi); - - write_phy_reg(pi, 0xc2, 0x0000); - - } - - wlc_phy_txcal_phycleanup_nphy(pi); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, - gain_save); - - wlc_phy_txcal_radio_cleanup_nphy(pi); - - if (NREV_LT(pi->pubpi.phy_rev, 2)) { - if (!mphase - || (pi->mphase_cal_phase_id == mphase_cal_lastphase)) - wlc_phy_tx_iq_war_nphy(pi); - } - - if (NREV_GE(pi->pubpi.phy_rev, 4)) - pi->phyhang_avoid = phyhang_avoid_state; - - wlc_phy_stay_in_carriersearch_nphy(pi, false); - - return bcmerror; -} - -static void wlc_phy_reapply_txcal_coeffs_nphy(struct brcms_phy *pi) -{ - u16 tbl_buf[7]; - - if ((pi->nphy_txiqlocal_chanspec == pi->radio_chanspec) && - (pi->nphy_txiqlocal_coeffsvalid)) { - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_IQLOCAL, - ARRAY_SIZE(tbl_buf), 80, 16, tbl_buf); - - if ((pi->nphy_txiqlocal_bestc[0] != tbl_buf[0]) || - (pi->nphy_txiqlocal_bestc[1] != tbl_buf[1]) || - (pi->nphy_txiqlocal_bestc[2] != tbl_buf[2]) || - (pi->nphy_txiqlocal_bestc[3] != tbl_buf[3])) { - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 80, - 16, pi->nphy_txiqlocal_bestc); - - tbl_buf[0] = 0; - tbl_buf[1] = 0; - tbl_buf[2] = 0; - tbl_buf[3] = 0; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 4, 88, - 16, tbl_buf); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 85, - 16, - &pi->nphy_txiqlocal_bestc[5]); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_IQLOCAL, 2, 93, - 16, - &pi->nphy_txiqlocal_bestc[5]); - } - } -} - -void -wlc_phy_rx_iq_coeffs_nphy(struct brcms_phy *pi, u8 write, - struct nphy_iq_comp *pcomp) -{ - if (write) { - write_phy_reg(pi, 0x9a, pcomp->a0); - write_phy_reg(pi, 0x9b, pcomp->b0); - write_phy_reg(pi, 0x9c, pcomp->a1); - write_phy_reg(pi, 0x9d, pcomp->b1); - } else { - pcomp->a0 = read_phy_reg(pi, 0x9a); - pcomp->b0 = read_phy_reg(pi, 0x9b); - pcomp->a1 = read_phy_reg(pi, 0x9c); - pcomp->b1 = read_phy_reg(pi, 0x9d); - } -} - -void -wlc_phy_rx_iq_est_nphy(struct brcms_phy *pi, struct phy_iq_est *est, - u16 num_samps, u8 wait_time, u8 wait_for_crs) -{ - u8 core; - - write_phy_reg(pi, 0x12b, num_samps); - mod_phy_reg(pi, 0x12a, (0xff << 0), (wait_time << 0)); - mod_phy_reg(pi, 0x129, NPHY_IqestCmd_iqMode, - (wait_for_crs) ? NPHY_IqestCmd_iqMode : 0); - - mod_phy_reg(pi, 0x129, NPHY_IqestCmd_iqstart, NPHY_IqestCmd_iqstart); - - SPINWAIT(((read_phy_reg(pi, 0x129) & NPHY_IqestCmd_iqstart) != 0), - 10000); - if (WARN(read_phy_reg(pi, 0x129) & NPHY_IqestCmd_iqstart, - "HW error: rxiq est")) - return; - - if ((read_phy_reg(pi, 0x129) & NPHY_IqestCmd_iqstart) == 0) { - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - est[core].i_pwr = - (read_phy_reg(pi, - NPHY_IqestipwrAccHi(core)) << 16) - | read_phy_reg(pi, NPHY_IqestipwrAccLo(core)); - est[core].q_pwr = - (read_phy_reg(pi, - NPHY_IqestqpwrAccHi(core)) << 16) - | read_phy_reg(pi, NPHY_IqestqpwrAccLo(core)); - est[core].iq_prod = - (read_phy_reg(pi, - NPHY_IqestIqAccHi(core)) << 16) | - read_phy_reg(pi, NPHY_IqestIqAccLo(core)); - } - } -} - -#define CAL_RETRY_CNT 2 -static void wlc_phy_calc_rx_iq_comp_nphy(struct brcms_phy *pi, u8 core_mask) -{ - u8 curr_core; - struct phy_iq_est est[PHY_CORE_MAX]; - struct nphy_iq_comp old_comp, new_comp; - s32 iq = 0; - u32 ii = 0, qq = 0; - s16 iq_nbits, qq_nbits, brsh, arsh; - s32 a, b, temp; - int bcmerror = 0; - uint cal_retry = 0; - - if (core_mask == 0x0) - return; - - wlc_phy_rx_iq_coeffs_nphy(pi, 0, &old_comp); - new_comp.a0 = new_comp.b0 = new_comp.a1 = new_comp.b1 = 0x0; - wlc_phy_rx_iq_coeffs_nphy(pi, 1, &new_comp); - -cal_try: - wlc_phy_rx_iq_est_nphy(pi, est, 0x4000, 32, 0); - - new_comp = old_comp; - - for (curr_core = 0; curr_core < pi->pubpi.phy_corenum; curr_core++) { - - if ((curr_core == PHY_CORE_0) && (core_mask & 0x1)) { - iq = est[curr_core].iq_prod; - ii = est[curr_core].i_pwr; - qq = est[curr_core].q_pwr; - } else if ((curr_core == PHY_CORE_1) && (core_mask & 0x2)) { - iq = est[curr_core].iq_prod; - ii = est[curr_core].i_pwr; - qq = est[curr_core].q_pwr; - } else { - continue; - } - - if ((ii + qq) < NPHY_MIN_RXIQ_PWR) { - bcmerror = -EBADE; - break; - } - - iq_nbits = wlc_phy_nbits(iq); - qq_nbits = wlc_phy_nbits(qq); - - arsh = 10 - (30 - iq_nbits); - if (arsh >= 0) { - a = (-(iq << (30 - iq_nbits)) + (ii >> (1 + arsh))); - temp = (s32) (ii >> arsh); - if (temp == 0) { - bcmerror = -EBADE; - break; - } - } else { - a = (-(iq << (30 - iq_nbits)) + (ii << (-1 - arsh))); - temp = (s32) (ii << -arsh); - if (temp == 0) { - bcmerror = -EBADE; - break; - } - } - - a /= temp; - - brsh = qq_nbits - 31 + 20; - if (brsh >= 0) { - b = (qq << (31 - qq_nbits)); - temp = (s32) (ii >> brsh); - if (temp == 0) { - bcmerror = -EBADE; - break; - } - } else { - b = (qq << (31 - qq_nbits)); - temp = (s32) (ii << -brsh); - if (temp == 0) { - bcmerror = -EBADE; - break; - } - } - b /= temp; - b -= a * a; - b = (s32) int_sqrt((unsigned long) b); - b -= (1 << 10); - - if ((curr_core == PHY_CORE_0) && (core_mask & 0x1)) { - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - new_comp.a0 = (s16) a & 0x3ff; - new_comp.b0 = (s16) b & 0x3ff; - } else { - - new_comp.a0 = (s16) b & 0x3ff; - new_comp.b0 = (s16) a & 0x3ff; - } - } - if ((curr_core == PHY_CORE_1) && (core_mask & 0x2)) { - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - new_comp.a1 = (s16) a & 0x3ff; - new_comp.b1 = (s16) b & 0x3ff; - } else { - - new_comp.a1 = (s16) b & 0x3ff; - new_comp.b1 = (s16) a & 0x3ff; - } - } - } - - if (bcmerror != 0) { - pr_debug("%s: Failed, cnt = %d\n", __func__, cal_retry); - - if (cal_retry < CAL_RETRY_CNT) { - cal_retry++; - goto cal_try; - } - - new_comp = old_comp; - } - - wlc_phy_rx_iq_coeffs_nphy(pi, 1, &new_comp); -} - -static void wlc_phy_rxcal_radio_setup_nphy(struct brcms_phy *pi, u8 rx_core) -{ - u16 offtune_val; - u16 bias_g = 0; - u16 bias_a = 0; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if (rx_core == PHY_CORE_0) { - if (CHSPEC_IS5G(pi->radio_chanspec)) { - pi->tx_rx_cal_radio_saveregs[0] = - read_radio_reg(pi, - RADIO_2057_TX0_TXRXCOUPLE_5G_PWRUP); - pi->tx_rx_cal_radio_saveregs[1] = - read_radio_reg(pi, - RADIO_2057_TX0_TXRXCOUPLE_5G_ATTEN); - - write_radio_reg(pi, - RADIO_2057_TX0_TXRXCOUPLE_5G_PWRUP, - 0x3); - write_radio_reg(pi, - RADIO_2057_TX0_TXRXCOUPLE_5G_ATTEN, - 0xaf); - - } else { - pi->tx_rx_cal_radio_saveregs[0] = - read_radio_reg(pi, - RADIO_2057_TX0_TXRXCOUPLE_2G_PWRUP); - pi->tx_rx_cal_radio_saveregs[1] = - read_radio_reg(pi, - RADIO_2057_TX0_TXRXCOUPLE_2G_ATTEN); - - write_radio_reg( - pi, - RADIO_2057_TX0_TXRXCOUPLE_2G_PWRUP, - 0x3); - write_radio_reg( - pi, - RADIO_2057_TX0_TXRXCOUPLE_2G_ATTEN, - 0x7f); - } - - } else { - if (CHSPEC_IS5G(pi->radio_chanspec)) { - pi->tx_rx_cal_radio_saveregs[0] = - read_radio_reg(pi, - RADIO_2057_TX1_TXRXCOUPLE_5G_PWRUP); - pi->tx_rx_cal_radio_saveregs[1] = - read_radio_reg(pi, - RADIO_2057_TX1_TXRXCOUPLE_5G_ATTEN); - - write_radio_reg( - pi, - RADIO_2057_TX1_TXRXCOUPLE_5G_PWRUP, - 0x3); - write_radio_reg( - pi, - RADIO_2057_TX1_TXRXCOUPLE_5G_ATTEN, - 0xaf); - - } else { - pi->tx_rx_cal_radio_saveregs[0] = - read_radio_reg(pi, - RADIO_2057_TX1_TXRXCOUPLE_2G_PWRUP); - pi->tx_rx_cal_radio_saveregs[1] = - read_radio_reg(pi, - RADIO_2057_TX1_TXRXCOUPLE_2G_ATTEN); - - write_radio_reg(pi, - RADIO_2057_TX1_TXRXCOUPLE_2G_PWRUP, - 0x3); - write_radio_reg(pi, - RADIO_2057_TX1_TXRXCOUPLE_2G_ATTEN, - 0x7f); - } - } - - } else { - if (rx_core == PHY_CORE_0) { - pi->tx_rx_cal_radio_saveregs[0] = - read_radio_reg(pi, - RADIO_2056_TX_RXIQCAL_TXMUX | - RADIO_2056_TX1); - pi->tx_rx_cal_radio_saveregs[1] = - read_radio_reg(pi, - RADIO_2056_RX_RXIQCAL_RXMUX | - RADIO_2056_RX0); - - if (pi->pubpi.radiorev >= 5) { - pi->tx_rx_cal_radio_saveregs[2] = - read_radio_reg(pi, - RADIO_2056_RX_RXSPARE2 | - RADIO_2056_RX0); - pi->tx_rx_cal_radio_saveregs[3] = - read_radio_reg(pi, - RADIO_2056_TX_TXSPARE2 | - RADIO_2056_TX1); - } - - if (CHSPEC_IS5G(pi->radio_chanspec)) { - - if (pi->pubpi.radiorev >= 5) { - pi->tx_rx_cal_radio_saveregs[4] = - read_radio_reg(pi, - RADIO_2056_RX_LNAA_MASTER - | RADIO_2056_RX0); - - write_radio_reg( - pi, - RADIO_2056_RX_LNAA_MASTER - | RADIO_2056_RX0, 0x40); - - write_radio_reg(pi, - RADIO_2056_TX_TXSPARE2 | - RADIO_2056_TX1, bias_a); - - write_radio_reg(pi, - RADIO_2056_RX_RXSPARE2 | - RADIO_2056_RX0, bias_a); - } else { - pi->tx_rx_cal_radio_saveregs[4] = - read_radio_reg(pi, - RADIO_2056_RX_LNAA_TUNE - | RADIO_2056_RX0); - - offtune_val = - (pi->tx_rx_cal_radio_saveregs - [2] & 0xF0) >> 8; - offtune_val = - (offtune_val <= 0x7) ? 0xF : 0; - - mod_radio_reg(pi, - RADIO_2056_RX_LNAA_TUNE | - RADIO_2056_RX0, 0xF0, - (offtune_val << 8)); - } - - write_radio_reg(pi, - RADIO_2056_TX_RXIQCAL_TXMUX | - RADIO_2056_TX1, 0x9); - write_radio_reg(pi, - RADIO_2056_RX_RXIQCAL_RXMUX | - RADIO_2056_RX0, 0x9); - } else { - if (pi->pubpi.radiorev >= 5) { - pi->tx_rx_cal_radio_saveregs[4] = - read_radio_reg( - pi, - RADIO_2056_RX_LNAG_MASTER - | RADIO_2056_RX0); - - write_radio_reg( - pi, - RADIO_2056_RX_LNAG_MASTER - | RADIO_2056_RX0, 0x40); - - write_radio_reg( - pi, - RADIO_2056_TX_TXSPARE2 - | - RADIO_2056_TX1, bias_g); - - write_radio_reg( - pi, - RADIO_2056_RX_RXSPARE2 - | - RADIO_2056_RX0, bias_g); - - } else { - pi->tx_rx_cal_radio_saveregs[4] = - read_radio_reg( - pi, - RADIO_2056_RX_LNAG_TUNE - | RADIO_2056_RX0); - - offtune_val = - (pi-> - tx_rx_cal_radio_saveregs[2] & - 0xF0) >> 8; - offtune_val = - (offtune_val <= 0x7) ? 0xF : 0; - - mod_radio_reg(pi, - RADIO_2056_RX_LNAG_TUNE | - RADIO_2056_RX0, 0xF0, - (offtune_val << 8)); - } - - write_radio_reg(pi, - RADIO_2056_TX_RXIQCAL_TXMUX | - RADIO_2056_TX1, 0x6); - write_radio_reg(pi, - RADIO_2056_RX_RXIQCAL_RXMUX | - RADIO_2056_RX0, 0x6); - } - - } else { - pi->tx_rx_cal_radio_saveregs[0] = - read_radio_reg(pi, - RADIO_2056_TX_RXIQCAL_TXMUX | - RADIO_2056_TX0); - pi->tx_rx_cal_radio_saveregs[1] = - read_radio_reg(pi, - RADIO_2056_RX_RXIQCAL_RXMUX | - RADIO_2056_RX1); - - if (pi->pubpi.radiorev >= 5) { - pi->tx_rx_cal_radio_saveregs[2] = - read_radio_reg(pi, - RADIO_2056_RX_RXSPARE2 | - RADIO_2056_RX1); - pi->tx_rx_cal_radio_saveregs[3] = - read_radio_reg(pi, - RADIO_2056_TX_TXSPARE2 | - RADIO_2056_TX0); - } - - if (CHSPEC_IS5G(pi->radio_chanspec)) { - - if (pi->pubpi.radiorev >= 5) { - pi->tx_rx_cal_radio_saveregs[4] = - read_radio_reg( - pi, - RADIO_2056_RX_LNAA_MASTER - | RADIO_2056_RX1); - - write_radio_reg( - pi, - RADIO_2056_RX_LNAA_MASTER | - RADIO_2056_RX1, 0x40); - - write_radio_reg( - pi, - RADIO_2056_TX_TXSPARE2 - | - RADIO_2056_TX0, bias_a); - - write_radio_reg( - pi, - RADIO_2056_RX_RXSPARE2 - | - RADIO_2056_RX1, bias_a); - } else { - pi->tx_rx_cal_radio_saveregs[4] = - read_radio_reg( - pi, - RADIO_2056_RX_LNAA_TUNE - | RADIO_2056_RX1); - - offtune_val = - (pi-> - tx_rx_cal_radio_saveregs[2] & - 0xF0) >> 8; - offtune_val = - (offtune_val <= 0x7) ? 0xF : 0; - - mod_radio_reg(pi, - RADIO_2056_RX_LNAA_TUNE | - RADIO_2056_RX1, 0xF0, - (offtune_val << 8)); - } - - write_radio_reg(pi, - RADIO_2056_TX_RXIQCAL_TXMUX | - RADIO_2056_TX0, 0x9); - write_radio_reg(pi, - RADIO_2056_RX_RXIQCAL_RXMUX | - RADIO_2056_RX1, 0x9); - } else { - if (pi->pubpi.radiorev >= 5) { - pi->tx_rx_cal_radio_saveregs[4] = - read_radio_reg( - pi, - RADIO_2056_RX_LNAG_MASTER - | RADIO_2056_RX1); - - write_radio_reg( - pi, - RADIO_2056_RX_LNAG_MASTER - | RADIO_2056_RX1, 0x40); - - write_radio_reg( - pi, - RADIO_2056_TX_TXSPARE2 - | - RADIO_2056_TX0, bias_g); - - write_radio_reg( - pi, - RADIO_2056_RX_RXSPARE2 - | - RADIO_2056_RX1, bias_g); - } else { - pi->tx_rx_cal_radio_saveregs[4] = - read_radio_reg( - pi, - RADIO_2056_RX_LNAG_TUNE - | RADIO_2056_RX1); - - offtune_val = - (pi-> - tx_rx_cal_radio_saveregs[2] & - 0xF0) >> 8; - offtune_val = - (offtune_val <= 0x7) ? 0xF : 0; - - mod_radio_reg(pi, - RADIO_2056_RX_LNAG_TUNE | - RADIO_2056_RX1, 0xF0, - (offtune_val << 8)); - } - - write_radio_reg(pi, - RADIO_2056_TX_RXIQCAL_TXMUX | - RADIO_2056_TX0, 0x6); - write_radio_reg(pi, - RADIO_2056_RX_RXIQCAL_RXMUX | - RADIO_2056_RX1, 0x6); - } - } - } -} - -static void wlc_phy_rxcal_radio_cleanup_nphy(struct brcms_phy *pi, u8 rx_core) -{ - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - if (rx_core == PHY_CORE_0) { - if (CHSPEC_IS5G(pi->radio_chanspec)) { - write_radio_reg( - pi, - RADIO_2057_TX0_TXRXCOUPLE_5G_PWRUP, - pi-> - tx_rx_cal_radio_saveregs[0]); - write_radio_reg( - pi, - RADIO_2057_TX0_TXRXCOUPLE_5G_ATTEN, - pi-> - tx_rx_cal_radio_saveregs[1]); - - } else { - write_radio_reg( - pi, - RADIO_2057_TX0_TXRXCOUPLE_2G_PWRUP, - pi-> - tx_rx_cal_radio_saveregs[0]); - write_radio_reg( - pi, - RADIO_2057_TX0_TXRXCOUPLE_2G_ATTEN, - pi-> - tx_rx_cal_radio_saveregs[1]); - } - - } else { - if (CHSPEC_IS5G(pi->radio_chanspec)) { - write_radio_reg( - pi, - RADIO_2057_TX1_TXRXCOUPLE_5G_PWRUP, - pi-> - tx_rx_cal_radio_saveregs[0]); - write_radio_reg( - pi, - RADIO_2057_TX1_TXRXCOUPLE_5G_ATTEN, - pi-> - tx_rx_cal_radio_saveregs[1]); - - } else { - write_radio_reg( - pi, - RADIO_2057_TX1_TXRXCOUPLE_2G_PWRUP, - pi-> - tx_rx_cal_radio_saveregs[0]); - write_radio_reg( - pi, - RADIO_2057_TX1_TXRXCOUPLE_2G_ATTEN, - pi-> - tx_rx_cal_radio_saveregs[1]); - } - } - - } else { - if (rx_core == PHY_CORE_0) { - write_radio_reg(pi, - RADIO_2056_TX_RXIQCAL_TXMUX | - RADIO_2056_TX1, - pi->tx_rx_cal_radio_saveregs[0]); - - write_radio_reg(pi, - RADIO_2056_RX_RXIQCAL_RXMUX | - RADIO_2056_RX0, - pi->tx_rx_cal_radio_saveregs[1]); - - if (pi->pubpi.radiorev >= 5) { - write_radio_reg(pi, - RADIO_2056_RX_RXSPARE2 | - RADIO_2056_RX0, - pi-> - tx_rx_cal_radio_saveregs[2]); - - write_radio_reg(pi, - RADIO_2056_TX_TXSPARE2 | - RADIO_2056_TX1, - pi-> - tx_rx_cal_radio_saveregs[3]); - } - - if (CHSPEC_IS5G(pi->radio_chanspec)) { - if (pi->pubpi.radiorev >= 5) - write_radio_reg( - pi, - RADIO_2056_RX_LNAA_MASTER - | RADIO_2056_RX0, - pi-> - tx_rx_cal_radio_saveregs - [4]); - else - write_radio_reg( - pi, - RADIO_2056_RX_LNAA_TUNE - | RADIO_2056_RX0, - pi-> - tx_rx_cal_radio_saveregs - [4]); - } else { - if (pi->pubpi.radiorev >= 5) - write_radio_reg( - pi, - RADIO_2056_RX_LNAG_MASTER - | RADIO_2056_RX0, - pi-> - tx_rx_cal_radio_saveregs - [4]); - else - write_radio_reg( - pi, - RADIO_2056_RX_LNAG_TUNE - | RADIO_2056_RX0, - pi-> - tx_rx_cal_radio_saveregs - [4]); - } - - } else { - write_radio_reg(pi, - RADIO_2056_TX_RXIQCAL_TXMUX | - RADIO_2056_TX0, - pi->tx_rx_cal_radio_saveregs[0]); - - write_radio_reg(pi, - RADIO_2056_RX_RXIQCAL_RXMUX | - RADIO_2056_RX1, - pi->tx_rx_cal_radio_saveregs[1]); - - if (pi->pubpi.radiorev >= 5) { - write_radio_reg(pi, - RADIO_2056_RX_RXSPARE2 | - RADIO_2056_RX1, - pi-> - tx_rx_cal_radio_saveregs[2]); - - write_radio_reg(pi, - RADIO_2056_TX_TXSPARE2 | - RADIO_2056_TX0, - pi-> - tx_rx_cal_radio_saveregs[3]); - } - - if (CHSPEC_IS5G(pi->radio_chanspec)) { - if (pi->pubpi.radiorev >= 5) - write_radio_reg( - pi, - RADIO_2056_RX_LNAA_MASTER - | RADIO_2056_RX1, - pi-> - tx_rx_cal_radio_saveregs - [4]); - else - write_radio_reg( - pi, - RADIO_2056_RX_LNAA_TUNE - | RADIO_2056_RX1, - pi-> - tx_rx_cal_radio_saveregs - [4]); - } else { - if (pi->pubpi.radiorev >= 5) - write_radio_reg( - pi, - RADIO_2056_RX_LNAG_MASTER - | RADIO_2056_RX1, - pi-> - tx_rx_cal_radio_saveregs - [4]); - else - write_radio_reg( - pi, - RADIO_2056_RX_LNAG_TUNE - | RADIO_2056_RX1, - pi-> - tx_rx_cal_radio_saveregs - [4]); - } - } - } -} - -static void wlc_phy_rxcal_physetup_nphy(struct brcms_phy *pi, u8 rx_core) -{ - u8 tx_core; - u16 rx_antval, tx_antval; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - tx_core = rx_core; - else - tx_core = (rx_core == PHY_CORE_0) ? 1 : 0; - - pi->tx_rx_cal_phy_saveregs[0] = read_phy_reg(pi, 0xa2); - pi->tx_rx_cal_phy_saveregs[1] = - read_phy_reg(pi, (rx_core == PHY_CORE_0) ? 0xa6 : 0xa7); - pi->tx_rx_cal_phy_saveregs[2] = - read_phy_reg(pi, (rx_core == PHY_CORE_0) ? 0x8f : 0xa5); - pi->tx_rx_cal_phy_saveregs[3] = read_phy_reg(pi, 0x91); - pi->tx_rx_cal_phy_saveregs[4] = read_phy_reg(pi, 0x92); - pi->tx_rx_cal_phy_saveregs[5] = read_phy_reg(pi, 0x7a); - pi->tx_rx_cal_phy_saveregs[6] = read_phy_reg(pi, 0x7d); - pi->tx_rx_cal_phy_saveregs[7] = read_phy_reg(pi, 0xe7); - pi->tx_rx_cal_phy_saveregs[8] = read_phy_reg(pi, 0xec); - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - pi->tx_rx_cal_phy_saveregs[11] = read_phy_reg(pi, 0x342); - pi->tx_rx_cal_phy_saveregs[12] = read_phy_reg(pi, 0x343); - pi->tx_rx_cal_phy_saveregs[13] = read_phy_reg(pi, 0x346); - pi->tx_rx_cal_phy_saveregs[14] = read_phy_reg(pi, 0x347); - } - - pi->tx_rx_cal_phy_saveregs[9] = read_phy_reg(pi, 0x297); - pi->tx_rx_cal_phy_saveregs[10] = read_phy_reg(pi, 0x29b); - mod_phy_reg(pi, (0 == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (0) << 0); - - mod_phy_reg(pi, (1 == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 0), (0) << 0); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - mod_phy_reg(pi, 0xa2, (0xf << 0), (1 << tx_core) << 0); - - mod_phy_reg(pi, 0xa2, (0xf << 12), (1 << (1 - rx_core)) << 12); - - } else { - - mod_phy_reg(pi, 0xa2, (0xf << 12), (1 << tx_core) << 12); - mod_phy_reg(pi, 0xa2, (0xf << 0), (1 << tx_core) << 0); - mod_phy_reg(pi, 0xa2, (0xf << 4), (1 << rx_core) << 4); - mod_phy_reg(pi, 0xa2, (0xf << 8), (1 << rx_core) << 8); - } - - mod_phy_reg(pi, ((rx_core == PHY_CORE_0) ? 0xa6 : 0xa7), (0x1 << 2), 0); - mod_phy_reg(pi, (rx_core == PHY_CORE_0) ? 0x8f : 0xa5, - (0x1 << 2), (0x1 << 2)); - if (NREV_LT(pi->pubpi.phy_rev, 7)) { - mod_phy_reg(pi, ((rx_core == PHY_CORE_0) ? 0xa6 : 0xa7), - (0x1 << 0) | (0x1 << 1), 0); - mod_phy_reg(pi, (rx_core == PHY_CORE_0) ? - 0x8f : 0xa5, - (0x1 << 0) | (0x1 << 1), (0x1 << 0) | (0x1 << 1)); - } - - wlc_phy_rfctrlintc_override_nphy(pi, NPHY_RfctrlIntc_override_PA, 0, - RADIO_MIMO_CORESEL_CORE1 | - RADIO_MIMO_CORESEL_CORE2); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 3), - 0, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID0); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 9), 0, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 10), 1, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 0), 1, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 1), 1, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID2); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 11), 0, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - if (CHSPEC_IS40(pi->radio_chanspec)) - wlc_phy_rfctrl_override_nphy_rev7( - pi, - (0x1 << 7), - 2, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - else - wlc_phy_rfctrl_override_nphy_rev7( - pi, - (0x1 << 7), - 0, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 7), - 0, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - wlc_phy_rfctrl_override_nphy_rev7(pi, (0x1 << 5), 0, 0, 0, - NPHY_REV7_RFCTRLOVERRIDE_ID1); - } else { - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 3), 0, 3, 0); - } - - wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RX2TX); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - - wlc_phy_rfctrlintc_override_nphy(pi, - NPHY_RfctrlIntc_override_TRSW, - 0x1, rx_core + 1); - } else { - - if (rx_core == PHY_CORE_0) { - rx_antval = 0x1; - tx_antval = 0x8; - } else { - rx_antval = 0x4; - tx_antval = 0x2; - } - - wlc_phy_rfctrlintc_override_nphy(pi, - NPHY_RfctrlIntc_override_TRSW, - rx_antval, rx_core + 1); - wlc_phy_rfctrlintc_override_nphy(pi, - NPHY_RfctrlIntc_override_TRSW, - tx_antval, tx_core + 1); - } -} - -static void wlc_phy_rxcal_phycleanup_nphy(struct brcms_phy *pi, u8 rx_core) -{ - - write_phy_reg(pi, 0xa2, pi->tx_rx_cal_phy_saveregs[0]); - write_phy_reg(pi, (rx_core == PHY_CORE_0) ? 0xa6 : 0xa7, - pi->tx_rx_cal_phy_saveregs[1]); - write_phy_reg(pi, (rx_core == PHY_CORE_0) ? 0x8f : 0xa5, - pi->tx_rx_cal_phy_saveregs[2]); - write_phy_reg(pi, 0x91, pi->tx_rx_cal_phy_saveregs[3]); - write_phy_reg(pi, 0x92, pi->tx_rx_cal_phy_saveregs[4]); - - write_phy_reg(pi, 0x7a, pi->tx_rx_cal_phy_saveregs[5]); - write_phy_reg(pi, 0x7d, pi->tx_rx_cal_phy_saveregs[6]); - write_phy_reg(pi, 0xe7, pi->tx_rx_cal_phy_saveregs[7]); - write_phy_reg(pi, 0xec, pi->tx_rx_cal_phy_saveregs[8]); - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - write_phy_reg(pi, 0x342, pi->tx_rx_cal_phy_saveregs[11]); - write_phy_reg(pi, 0x343, pi->tx_rx_cal_phy_saveregs[12]); - write_phy_reg(pi, 0x346, pi->tx_rx_cal_phy_saveregs[13]); - write_phy_reg(pi, 0x347, pi->tx_rx_cal_phy_saveregs[14]); - } - - write_phy_reg(pi, 0x297, pi->tx_rx_cal_phy_saveregs[9]); - write_phy_reg(pi, 0x29b, pi->tx_rx_cal_phy_saveregs[10]); -} - -static void -wlc_phy_rxcal_gainctrl_nphy_rev5(struct brcms_phy *pi, u8 rx_core, - u16 *rxgain, u8 cal_type) -{ - - u16 num_samps; - struct phy_iq_est est[PHY_CORE_MAX]; - u8 tx_core; - struct nphy_iq_comp save_comp, zero_comp; - u32 i_pwr, q_pwr, curr_pwr, optim_pwr = 0, prev_pwr = 0, - thresh_pwr = 10000; - s16 desired_log2_pwr, actual_log2_pwr, delta_pwr; - bool gainctrl_done = false; - u8 mix_tia_gain = 3; - s8 optim_gaintbl_index = 0, prev_gaintbl_index = 0; - s8 curr_gaintbl_index = 3; - u8 gainctrl_dirn = NPHY_RXCAL_GAIN_INIT; - const struct nphy_ipa_txrxgain *nphy_rxcal_gaintbl; - u16 hpvga, lpf_biq1, lpf_biq0, lna2, lna1; - int fine_gain_idx; - s8 txpwrindex; - u16 nphy_rxcal_txgain[2]; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - tx_core = rx_core; - else - tx_core = 1 - rx_core; - - num_samps = 1024; - desired_log2_pwr = (cal_type == 0) ? 13 : 13; - - wlc_phy_rx_iq_coeffs_nphy(pi, 0, &save_comp); - zero_comp.a0 = zero_comp.b0 = zero_comp.a1 = zero_comp.b1 = 0x0; - wlc_phy_rx_iq_coeffs_nphy(pi, 1, &zero_comp); - - if (CHSPEC_IS5G(pi->radio_chanspec)) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) - mix_tia_gain = 3; - else if (NREV_GE(pi->pubpi.phy_rev, 4)) - mix_tia_gain = 4; - else - mix_tia_gain = 6; - if (NREV_GE(pi->pubpi.phy_rev, 7)) - nphy_rxcal_gaintbl = nphy_ipa_rxcal_gaintbl_5GHz_rev7; - else - nphy_rxcal_gaintbl = nphy_ipa_rxcal_gaintbl_5GHz; - } else { - if (NREV_GE(pi->pubpi.phy_rev, 7)) - nphy_rxcal_gaintbl = nphy_ipa_rxcal_gaintbl_2GHz_rev7; - else - nphy_rxcal_gaintbl = nphy_ipa_rxcal_gaintbl_2GHz; - } - - do { - - hpvga = (NREV_GE(pi->pubpi.phy_rev, 7)) ? - 0 : nphy_rxcal_gaintbl[curr_gaintbl_index].hpvga; - lpf_biq1 = nphy_rxcal_gaintbl[curr_gaintbl_index].lpf_biq1; - lpf_biq0 = nphy_rxcal_gaintbl[curr_gaintbl_index].lpf_biq0; - lna2 = nphy_rxcal_gaintbl[curr_gaintbl_index].lna2; - lna1 = nphy_rxcal_gaintbl[curr_gaintbl_index].lna1; - txpwrindex = nphy_rxcal_gaintbl[curr_gaintbl_index].txpwrindex; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - wlc_phy_rfctrl_override_1tomany_nphy( - pi, - NPHY_REV7_RfctrlOverride_cmd_rxgain, - ((lpf_biq1 << 12) | - (lpf_biq0 << 8) | - (mix_tia_gain << 4) | (lna2 << 2) - | lna1), 0x3, 0); - else - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12), - ((hpvga << 12) | - (lpf_biq1 << 10) | - (lpf_biq0 << 8) | - (mix_tia_gain << 4) | - (lna2 << 2) | lna1), 0x3, - 0); - - pi->nphy_rxcal_pwr_idx[tx_core] = txpwrindex; - - if (txpwrindex == -1) { - nphy_rxcal_txgain[0] = 0x8ff0 | pi->nphy_gmval; - nphy_rxcal_txgain[1] = 0x8ff0 | pi->nphy_gmval; - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, - 2, 0x110, 16, - nphy_rxcal_txgain); - } else { - wlc_phy_txpwr_index_nphy(pi, tx_core + 1, txpwrindex, - false); - } - - wlc_phy_tx_tone_nphy(pi, (CHSPEC_IS40(pi->radio_chanspec)) ? - NPHY_RXCAL_TONEFREQ_40MHz : - NPHY_RXCAL_TONEFREQ_20MHz, - NPHY_RXCAL_TONEAMP, 0, cal_type, false); - - wlc_phy_rx_iq_est_nphy(pi, est, num_samps, 32, 0); - i_pwr = (est[rx_core].i_pwr + num_samps / 2) / num_samps; - q_pwr = (est[rx_core].q_pwr + num_samps / 2) / num_samps; - curr_pwr = i_pwr + q_pwr; - - switch (gainctrl_dirn) { - case NPHY_RXCAL_GAIN_INIT: - if (curr_pwr > thresh_pwr) { - gainctrl_dirn = NPHY_RXCAL_GAIN_DOWN; - prev_gaintbl_index = curr_gaintbl_index; - curr_gaintbl_index--; - } else { - gainctrl_dirn = NPHY_RXCAL_GAIN_UP; - prev_gaintbl_index = curr_gaintbl_index; - curr_gaintbl_index++; - } - break; - - case NPHY_RXCAL_GAIN_UP: - if (curr_pwr > thresh_pwr) { - gainctrl_done = true; - optim_pwr = prev_pwr; - optim_gaintbl_index = prev_gaintbl_index; - } else { - prev_gaintbl_index = curr_gaintbl_index; - curr_gaintbl_index++; - } - break; - - case NPHY_RXCAL_GAIN_DOWN: - if (curr_pwr > thresh_pwr) { - prev_gaintbl_index = curr_gaintbl_index; - curr_gaintbl_index--; - } else { - gainctrl_done = true; - optim_pwr = curr_pwr; - optim_gaintbl_index = curr_gaintbl_index; - } - break; - - default: - break; - } - - if ((curr_gaintbl_index < 0) || - (curr_gaintbl_index > NPHY_IPA_RXCAL_MAXGAININDEX)) { - gainctrl_done = true; - optim_pwr = curr_pwr; - optim_gaintbl_index = prev_gaintbl_index; - } else { - prev_pwr = curr_pwr; - } - - wlc_phy_stopplayback_nphy(pi); - } while (!gainctrl_done); - - hpvga = nphy_rxcal_gaintbl[optim_gaintbl_index].hpvga; - lpf_biq1 = nphy_rxcal_gaintbl[optim_gaintbl_index].lpf_biq1; - lpf_biq0 = nphy_rxcal_gaintbl[optim_gaintbl_index].lpf_biq0; - lna2 = nphy_rxcal_gaintbl[optim_gaintbl_index].lna2; - lna1 = nphy_rxcal_gaintbl[optim_gaintbl_index].lna1; - txpwrindex = nphy_rxcal_gaintbl[optim_gaintbl_index].txpwrindex; - - actual_log2_pwr = wlc_phy_nbits(optim_pwr); - delta_pwr = desired_log2_pwr - actual_log2_pwr; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - fine_gain_idx = (int)lpf_biq1 + delta_pwr; - - if (fine_gain_idx + (int)lpf_biq0 > 10) - lpf_biq1 = 10 - lpf_biq0; - else - lpf_biq1 = (u16) max(fine_gain_idx, 0); - - wlc_phy_rfctrl_override_1tomany_nphy( - pi, - NPHY_REV7_RfctrlOverride_cmd_rxgain, - ((lpf_biq1 << 12) | - (lpf_biq0 << 8) | - (mix_tia_gain << 4) | - (lna2 << 2) | lna1), 0x3, - 0); - } else { - hpvga = (u16) max(min(((int)hpvga) + delta_pwr, 10), 0); - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12), - ((hpvga << 12) | - (lpf_biq1 << 10) | - (lpf_biq0 << 8) | - (mix_tia_gain << 4) | - (lna2 << 2) | - lna1), 0x3, 0); - } - - if (rxgain != NULL) { - *rxgain++ = lna1; - *rxgain++ = lna2; - *rxgain++ = mix_tia_gain; - *rxgain++ = lpf_biq0; - *rxgain++ = lpf_biq1; - *rxgain = hpvga; - } - - wlc_phy_rx_iq_coeffs_nphy(pi, 1, &save_comp); -} - -static void -wlc_phy_rxcal_gainctrl_nphy(struct brcms_phy *pi, u8 rx_core, u16 *rxgain, - u8 cal_type) -{ - wlc_phy_rxcal_gainctrl_nphy_rev5(pi, rx_core, rxgain, cal_type); -} - -static u8 -wlc_phy_rc_sweep_nphy(struct brcms_phy *pi, u8 core_idx, u8 loopback_type) -{ - u32 target_bws[2] = { 9500, 21000 }; - u32 ref_tones[2] = { 3000, 6000 }; - u32 target_bw, ref_tone; - - u32 target_pwr_ratios[2] = { 28606, 18468 }; - u32 target_pwr_ratio, pwr_ratio, last_pwr_ratio = 0; - - u16 start_rccal_ovr_val = 128; - u16 txlpf_rccal_lpc_ovr_val = 128; - u16 rxlpf_rccal_hpc_ovr_val = 159; - - u16 orig_txlpf_rccal_lpc_ovr_val; - u16 orig_rxlpf_rccal_hpc_ovr_val; - u16 radio_addr_offset_rx; - u16 radio_addr_offset_tx; - u16 orig_dcBypass; - u16 orig_RxStrnFilt40Num[6]; - u16 orig_RxStrnFilt40Den[4]; - u16 orig_rfctrloverride[2]; - u16 orig_rfctrlauxreg[2]; - u16 orig_rfctrlrssiothers; - u16 tx_lpf_bw = 4; - - u16 rx_lpf_bw, rx_lpf_bws[2] = { 2, 4 }; - u16 lpf_hpc = 7, hpvga_hpc = 7; - - s8 rccal_stepsize; - u16 rccal_val, last_rccal_val = 0, best_rccal_val = 0; - u32 ref_iq_vals = 0, target_iq_vals = 0; - u16 num_samps, log_num_samps = 10; - struct phy_iq_est est[PHY_CORE_MAX]; - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - return 0; - - num_samps = (1 << log_num_samps); - - if (CHSPEC_IS40(pi->radio_chanspec)) { - target_bw = target_bws[1]; - target_pwr_ratio = target_pwr_ratios[1]; - ref_tone = ref_tones[1]; - rx_lpf_bw = rx_lpf_bws[1]; - } else { - target_bw = target_bws[0]; - target_pwr_ratio = target_pwr_ratios[0]; - ref_tone = ref_tones[0]; - rx_lpf_bw = rx_lpf_bws[0]; - } - - if (core_idx == 0) { - radio_addr_offset_rx = RADIO_2056_RX0; - radio_addr_offset_tx = - (loopback_type == 0) ? RADIO_2056_TX0 : RADIO_2056_TX1; - } else { - radio_addr_offset_rx = RADIO_2056_RX1; - radio_addr_offset_tx = - (loopback_type == 0) ? RADIO_2056_TX1 : RADIO_2056_TX0; - } - - orig_txlpf_rccal_lpc_ovr_val = - read_radio_reg(pi, - (RADIO_2056_TX_TXLPF_RCCAL | - radio_addr_offset_tx)); - orig_rxlpf_rccal_hpc_ovr_val = - read_radio_reg(pi, - (RADIO_2056_RX_RXLPF_RCCAL_HPC | - radio_addr_offset_rx)); - - orig_dcBypass = ((read_phy_reg(pi, 0x48) >> 8) & 1); - - orig_RxStrnFilt40Num[0] = read_phy_reg(pi, 0x267); - orig_RxStrnFilt40Num[1] = read_phy_reg(pi, 0x268); - orig_RxStrnFilt40Num[2] = read_phy_reg(pi, 0x269); - orig_RxStrnFilt40Den[0] = read_phy_reg(pi, 0x26a); - orig_RxStrnFilt40Den[1] = read_phy_reg(pi, 0x26b); - orig_RxStrnFilt40Num[3] = read_phy_reg(pi, 0x26c); - orig_RxStrnFilt40Num[4] = read_phy_reg(pi, 0x26d); - orig_RxStrnFilt40Num[5] = read_phy_reg(pi, 0x26e); - orig_RxStrnFilt40Den[2] = read_phy_reg(pi, 0x26f); - orig_RxStrnFilt40Den[3] = read_phy_reg(pi, 0x270); - - orig_rfctrloverride[0] = read_phy_reg(pi, 0xe7); - orig_rfctrloverride[1] = read_phy_reg(pi, 0xec); - orig_rfctrlauxreg[0] = read_phy_reg(pi, 0xf8); - orig_rfctrlauxreg[1] = read_phy_reg(pi, 0xfa); - orig_rfctrlrssiothers = read_phy_reg(pi, (core_idx == 0) ? 0x7a : 0x7d); - - write_radio_reg(pi, (RADIO_2056_TX_TXLPF_RCCAL | radio_addr_offset_tx), - txlpf_rccal_lpc_ovr_val); - - write_radio_reg(pi, - (RADIO_2056_RX_RXLPF_RCCAL_HPC | radio_addr_offset_rx), - rxlpf_rccal_hpc_ovr_val); - - mod_phy_reg(pi, 0x48, (0x1 << 8), (0x1 << 8)); - - write_phy_reg(pi, 0x267, 0x02d4); - write_phy_reg(pi, 0x268, 0x0000); - write_phy_reg(pi, 0x269, 0x0000); - write_phy_reg(pi, 0x26a, 0x0000); - write_phy_reg(pi, 0x26b, 0x0000); - write_phy_reg(pi, 0x26c, 0x02d4); - write_phy_reg(pi, 0x26d, 0x0000); - write_phy_reg(pi, 0x26e, 0x0000); - write_phy_reg(pi, 0x26f, 0x0000); - write_phy_reg(pi, 0x270, 0x0000); - - or_phy_reg(pi, (core_idx == 0) ? 0xe7 : 0xec, (0x1 << 8)); - or_phy_reg(pi, (core_idx == 0) ? 0xec : 0xe7, (0x1 << 15)); - or_phy_reg(pi, (core_idx == 0) ? 0xe7 : 0xec, (0x1 << 9)); - or_phy_reg(pi, (core_idx == 0) ? 0xe7 : 0xec, (0x1 << 10)); - - mod_phy_reg(pi, (core_idx == 0) ? 0xfa : 0xf8, - (0x7 << 10), (tx_lpf_bw << 10)); - mod_phy_reg(pi, (core_idx == 0) ? 0xf8 : 0xfa, - (0x7 << 0), (hpvga_hpc << 0)); - mod_phy_reg(pi, (core_idx == 0) ? 0xf8 : 0xfa, - (0x7 << 4), (lpf_hpc << 4)); - mod_phy_reg(pi, (core_idx == 0) ? 0x7a : 0x7d, - (0x7 << 8), (rx_lpf_bw << 8)); - - rccal_stepsize = 16; - rccal_val = start_rccal_ovr_val + rccal_stepsize; - - while (rccal_stepsize >= 0) { - write_radio_reg(pi, - (RADIO_2056_RX_RXLPF_RCCAL_LPC | - radio_addr_offset_rx), rccal_val); - - if (rccal_stepsize == 16) { - - wlc_phy_tx_tone_nphy(pi, ref_tone, NPHY_RXCAL_TONEAMP, - 0, 1, false); - udelay(2); - - wlc_phy_rx_iq_est_nphy(pi, est, num_samps, 32, 0); - - if (core_idx == 0) - ref_iq_vals = - max_t(u32, (est[0].i_pwr + - est[0].q_pwr) >> - (log_num_samps + 1), - 1); - else - ref_iq_vals = - max_t(u32, (est[1].i_pwr + - est[1].q_pwr) >> - (log_num_samps + 1), - 1); - - wlc_phy_tx_tone_nphy(pi, target_bw, NPHY_RXCAL_TONEAMP, - 0, 1, false); - udelay(2); - } - - wlc_phy_rx_iq_est_nphy(pi, est, num_samps, 32, 0); - - if (core_idx == 0) - target_iq_vals = (est[0].i_pwr + est[0].q_pwr) >> - (log_num_samps + 1); - else - target_iq_vals = - (est[1].i_pwr + - est[1].q_pwr) >> (log_num_samps + 1); - - pwr_ratio = (uint) ((target_iq_vals << 16) / ref_iq_vals); - - if (rccal_stepsize == 0) - rccal_stepsize--; - else if (rccal_stepsize == 1) { - last_rccal_val = rccal_val; - rccal_val += (pwr_ratio > target_pwr_ratio) ? 1 : -1; - last_pwr_ratio = pwr_ratio; - rccal_stepsize--; - } else { - rccal_stepsize = (rccal_stepsize >> 1); - rccal_val += ((pwr_ratio > target_pwr_ratio) ? - rccal_stepsize : (-rccal_stepsize)); - } - - if (rccal_stepsize == -1) { - best_rccal_val = - (abs((int)last_pwr_ratio - - (int)target_pwr_ratio) < - abs((int)pwr_ratio - - (int)target_pwr_ratio)) ? last_rccal_val : - rccal_val; - - if (CHSPEC_IS40(pi->radio_chanspec)) { - if ((best_rccal_val > 140) - || (best_rccal_val < 135)) - best_rccal_val = 138; - } else { - if ((best_rccal_val > 142) - || (best_rccal_val < 137)) - best_rccal_val = 140; - } - - write_radio_reg(pi, - (RADIO_2056_RX_RXLPF_RCCAL_LPC | - radio_addr_offset_rx), best_rccal_val); - } - } - - wlc_phy_stopplayback_nphy(pi); - - write_radio_reg(pi, (RADIO_2056_TX_TXLPF_RCCAL | radio_addr_offset_tx), - orig_txlpf_rccal_lpc_ovr_val); - write_radio_reg(pi, - (RADIO_2056_RX_RXLPF_RCCAL_HPC | radio_addr_offset_rx), - orig_rxlpf_rccal_hpc_ovr_val); - - mod_phy_reg(pi, 0x48, (0x1 << 8), (orig_dcBypass << 8)); - - write_phy_reg(pi, 0x267, orig_RxStrnFilt40Num[0]); - write_phy_reg(pi, 0x268, orig_RxStrnFilt40Num[1]); - write_phy_reg(pi, 0x269, orig_RxStrnFilt40Num[2]); - write_phy_reg(pi, 0x26a, orig_RxStrnFilt40Den[0]); - write_phy_reg(pi, 0x26b, orig_RxStrnFilt40Den[1]); - write_phy_reg(pi, 0x26c, orig_RxStrnFilt40Num[3]); - write_phy_reg(pi, 0x26d, orig_RxStrnFilt40Num[4]); - write_phy_reg(pi, 0x26e, orig_RxStrnFilt40Num[5]); - write_phy_reg(pi, 0x26f, orig_RxStrnFilt40Den[2]); - write_phy_reg(pi, 0x270, orig_RxStrnFilt40Den[3]); - - write_phy_reg(pi, 0xe7, orig_rfctrloverride[0]); - write_phy_reg(pi, 0xec, orig_rfctrloverride[1]); - write_phy_reg(pi, 0xf8, orig_rfctrlauxreg[0]); - write_phy_reg(pi, 0xfa, orig_rfctrlauxreg[1]); - write_phy_reg(pi, (core_idx == 0) ? 0x7a : 0x7d, orig_rfctrlrssiothers); - - pi->nphy_anarxlpf_adjusted = false; - - return best_rccal_val - 0x80; -} - -#define WAIT_FOR_SCOPE 4000 -static int wlc_phy_cal_rxiq_nphy_rev3(struct brcms_phy *pi, - struct nphy_txgains target_gain, - u8 cal_type, bool debug) -{ - u16 orig_BBConfig; - u8 core_no, rx_core; - u8 best_rccal[2]; - u16 gain_save[2]; - u16 cal_gain[2]; - struct nphy_iqcal_params cal_params[2]; - u8 rxcore_state; - s8 rxlpf_rccal_hpc, txlpf_rccal_lpc; - s8 txlpf_idac; - bool phyhang_avoid_state = false; - bool skip_rxiqcal = false; - - orig_BBConfig = read_phy_reg(pi, 0x01); - mod_phy_reg(pi, 0x01, (0x1 << 15), 0); - - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - if (NREV_GE(pi->pubpi.phy_rev, 4)) { - phyhang_avoid_state = pi->phyhang_avoid; - pi->phyhang_avoid = false; - } - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, gain_save); - - for (core_no = 0; core_no <= 1; core_no++) { - wlc_phy_iqcal_gainparams_nphy(pi, core_no, target_gain, - &cal_params[core_no]); - cal_gain[core_no] = cal_params[core_no].cal_gain; - } - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, cal_gain); - - rxcore_state = wlc_phy_rxcore_getstate_nphy( - (struct brcms_phy_pub *) pi); - - for (rx_core = 0; rx_core < pi->pubpi.phy_corenum; rx_core++) { - - skip_rxiqcal = - ((rxcore_state & (1 << rx_core)) == 0) ? true : false; - - wlc_phy_rxcal_physetup_nphy(pi, rx_core); - - wlc_phy_rxcal_radio_setup_nphy(pi, rx_core); - - if ((!skip_rxiqcal) && ((cal_type == 0) || (cal_type == 2))) { - - wlc_phy_rxcal_gainctrl_nphy(pi, rx_core, NULL, 0); - - wlc_phy_tx_tone_nphy(pi, - (CHSPEC_IS40( - pi->radio_chanspec)) ? - NPHY_RXCAL_TONEFREQ_40MHz : - NPHY_RXCAL_TONEFREQ_20MHz, - NPHY_RXCAL_TONEAMP, 0, cal_type, - false); - - if (debug) - mdelay(WAIT_FOR_SCOPE); - - wlc_phy_calc_rx_iq_comp_nphy(pi, rx_core + 1); - wlc_phy_stopplayback_nphy(pi); - } - - if (((cal_type == 1) || (cal_type == 2)) - && NREV_LT(pi->pubpi.phy_rev, 7)) { - - if (rx_core == PHY_CORE_1) { - - if (rxcore_state == 1) - wlc_phy_rxcore_setstate_nphy( - (struct brcms_phy_pub *) pi, 3); - - wlc_phy_rxcal_gainctrl_nphy(pi, rx_core, NULL, - 1); - - best_rccal[rx_core] = - wlc_phy_rc_sweep_nphy(pi, rx_core, 1); - pi->nphy_rccal_value = best_rccal[rx_core]; - - if (rxcore_state == 1) - wlc_phy_rxcore_setstate_nphy( - (struct brcms_phy_pub *) pi, - rxcore_state); - } - } - - wlc_phy_rxcal_radio_cleanup_nphy(pi, rx_core); - - wlc_phy_rxcal_phycleanup_nphy(pi, rx_core); - wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); - } - - if ((cal_type == 1) || (cal_type == 2)) { - - best_rccal[0] = best_rccal[1]; - write_radio_reg(pi, - (RADIO_2056_RX_RXLPF_RCCAL_LPC | - RADIO_2056_RX0), (best_rccal[0] | 0x80)); - - for (rx_core = 0; rx_core < pi->pubpi.phy_corenum; rx_core++) { - rxlpf_rccal_hpc = - (((int)best_rccal[rx_core] - 12) >> 1) + 10; - txlpf_rccal_lpc = ((int)best_rccal[rx_core] - 12) + 10; - - if (PHY_IPA(pi)) { - txlpf_rccal_lpc += - (pi->bw == WL_CHANSPEC_BW_40) ? 24 : 12; - txlpf_idac = (pi->bw == WL_CHANSPEC_BW_40) ? - 0x0e : 0x13; - WRITE_RADIO_REG2(pi, RADIO_2056, TX, rx_core, - TXLPF_IDAC_4, txlpf_idac); - } - - rxlpf_rccal_hpc = max(min_t(u8, rxlpf_rccal_hpc, 31), - 0); - txlpf_rccal_lpc = max(min_t(u8, txlpf_rccal_lpc, 31), - 0); - - write_radio_reg(pi, (RADIO_2056_RX_RXLPF_RCCAL_HPC | - ((rx_core == - PHY_CORE_0) ? RADIO_2056_RX0 : - RADIO_2056_RX1)), - (rxlpf_rccal_hpc | 0x80)); - - write_radio_reg(pi, (RADIO_2056_TX_TXLPF_RCCAL | - ((rx_core == - PHY_CORE_0) ? RADIO_2056_TX0 : - RADIO_2056_TX1)), - (txlpf_rccal_lpc | 0x80)); - } - } - - write_phy_reg(pi, 0x01, orig_BBConfig); - - wlc_phy_resetcca_nphy(pi); - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - wlc_phy_rfctrl_override_1tomany_nphy( - pi, - NPHY_REV7_RfctrlOverride_cmd_rxgain, - 0, 0x3, 1); - else - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 12), 0, 0x3, 1); - - wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, - gain_save); - - if (NREV_GE(pi->pubpi.phy_rev, 4)) - pi->phyhang_avoid = phyhang_avoid_state; - - wlc_phy_stay_in_carriersearch_nphy(pi, false); - - return 0; -} - -static int -wlc_phy_cal_rxiq_nphy_rev2(struct brcms_phy *pi, - struct nphy_txgains target_gain, bool debug) -{ - struct phy_iq_est est[PHY_CORE_MAX]; - u8 core_num, rx_core, tx_core; - u16 lna_vals[] = { 0x3, 0x3, 0x1 }; - u16 hpf1_vals[] = { 0x7, 0x2, 0x0 }; - u16 hpf2_vals[] = { 0x2, 0x0, 0x0 }; - s16 curr_hpf1, curr_hpf2, curr_hpf, curr_lna; - s16 desired_log2_pwr, actual_log2_pwr, hpf_change; - u16 orig_RfseqCoreActv, orig_AfectrlCore, orig_AfectrlOverride; - u16 orig_RfctrlIntcRx, orig_RfctrlIntcTx; - u16 num_samps; - u32 i_pwr, q_pwr, tot_pwr[3]; - u8 gain_pass, use_hpf_num; - u16 mask, val1, val2; - u16 core_no; - u16 gain_save[2]; - u16 cal_gain[2]; - struct nphy_iqcal_params cal_params[2]; - u8 phy_bw; - int bcmerror = 0; - bool first_playtone = true; - - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - if (NREV_LT(pi->pubpi.phy_rev, 2)) - wlc_phy_reapply_txcal_coeffs_nphy(pi); - - wlc_phy_table_read_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, gain_save); - - for (core_no = 0; core_no <= 1; core_no++) { - wlc_phy_iqcal_gainparams_nphy(pi, core_no, target_gain, - &cal_params[core_no]); - cal_gain[core_no] = cal_params[core_no].cal_gain; - } - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, cal_gain); - - num_samps = 1024; - desired_log2_pwr = 13; - - for (core_num = 0; core_num < 2; core_num++) { - - rx_core = core_num; - tx_core = 1 - core_num; - - orig_RfseqCoreActv = read_phy_reg(pi, 0xa2); - orig_AfectrlCore = read_phy_reg(pi, (rx_core == PHY_CORE_0) ? - 0xa6 : 0xa7); - orig_AfectrlOverride = read_phy_reg(pi, 0xa5); - orig_RfctrlIntcRx = read_phy_reg(pi, (rx_core == PHY_CORE_0) ? - 0x91 : 0x92); - orig_RfctrlIntcTx = read_phy_reg(pi, (tx_core == PHY_CORE_0) ? - 0x91 : 0x92); - - mod_phy_reg(pi, 0xa2, (0xf << 12), (1 << tx_core) << 12); - mod_phy_reg(pi, 0xa2, (0xf << 0), (1 << tx_core) << 0); - - or_phy_reg(pi, ((rx_core == PHY_CORE_0) ? 0xa6 : 0xa7), - ((0x1 << 1) | (0x1 << 2))); - or_phy_reg(pi, 0xa5, ((0x1 << 1) | (0x1 << 2))); - - if (((pi->nphy_rxcalparams) & 0xff000000)) - write_phy_reg(pi, - (rx_core == PHY_CORE_0) ? 0x91 : 0x92, - (CHSPEC_IS5G(pi->radio_chanspec) ? - 0x140 : 0x110)); - else - write_phy_reg(pi, - (rx_core == PHY_CORE_0) ? 0x91 : 0x92, - (CHSPEC_IS5G(pi->radio_chanspec) ? - 0x180 : 0x120)); - - write_phy_reg(pi, (tx_core == PHY_CORE_0) ? 0x91 : 0x92, - (CHSPEC_IS5G(pi->radio_chanspec) ? 0x148 : - 0x114)); - - mask = RADIO_2055_COUPLE_RX_MASK | RADIO_2055_COUPLE_TX_MASK; - if (rx_core == PHY_CORE_0) { - val1 = RADIO_2055_COUPLE_RX_MASK; - val2 = RADIO_2055_COUPLE_TX_MASK; - } else { - val1 = RADIO_2055_COUPLE_TX_MASK; - val2 = RADIO_2055_COUPLE_RX_MASK; - } - - if ((pi->nphy_rxcalparams & 0x10000)) { - mod_radio_reg(pi, RADIO_2055_CORE1_GEN_SPARE2, mask, - val1); - mod_radio_reg(pi, RADIO_2055_CORE2_GEN_SPARE2, mask, - val2); - } - - for (gain_pass = 0; gain_pass < 4; gain_pass++) { - - if (debug) - mdelay(WAIT_FOR_SCOPE); - - if (gain_pass < 3) { - curr_lna = lna_vals[gain_pass]; - curr_hpf1 = hpf1_vals[gain_pass]; - curr_hpf2 = hpf2_vals[gain_pass]; - } else { - - if (tot_pwr[1] > 10000) { - curr_lna = lna_vals[2]; - curr_hpf1 = hpf1_vals[2]; - curr_hpf2 = hpf2_vals[2]; - use_hpf_num = 1; - curr_hpf = curr_hpf1; - actual_log2_pwr = - wlc_phy_nbits(tot_pwr[2]); - } else { - if (tot_pwr[0] > 10000) { - curr_lna = lna_vals[1]; - curr_hpf1 = hpf1_vals[1]; - curr_hpf2 = hpf2_vals[1]; - use_hpf_num = 1; - curr_hpf = curr_hpf1; - actual_log2_pwr = - wlc_phy_nbits( - tot_pwr[1]); - } else { - curr_lna = lna_vals[0]; - curr_hpf1 = hpf1_vals[0]; - curr_hpf2 = hpf2_vals[0]; - use_hpf_num = 2; - curr_hpf = curr_hpf2; - actual_log2_pwr = - wlc_phy_nbits( - tot_pwr[0]); - } - } - - hpf_change = desired_log2_pwr - actual_log2_pwr; - curr_hpf += hpf_change; - curr_hpf = max(min_t(u16, curr_hpf, 10), 0); - if (use_hpf_num == 1) - curr_hpf1 = curr_hpf; - else - curr_hpf2 = curr_hpf; - } - - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 10), - ((curr_hpf2 << 8) | - (curr_hpf1 << 4) | - (curr_lna << 2)), 0x3, 0); - wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); - - wlc_phy_stopplayback_nphy(pi); - - if (first_playtone) { - bcmerror = wlc_phy_tx_tone_nphy(pi, 4000, - (u16) (pi->nphy_rxcalparams & - 0xffff), 0, 0, true); - first_playtone = false; - } else { - phy_bw = (CHSPEC_IS40(pi->radio_chanspec)) ? - 40 : 20; - wlc_phy_runsamples_nphy(pi, phy_bw * 8, 0xffff, - 0, 0, 0, true); - } - - if (bcmerror == 0) { - if (gain_pass < 3) { - - wlc_phy_rx_iq_est_nphy(pi, est, - num_samps, 32, - 0); - i_pwr = (est[rx_core].i_pwr + - num_samps / 2) / num_samps; - q_pwr = (est[rx_core].q_pwr + - num_samps / 2) / num_samps; - tot_pwr[gain_pass] = i_pwr + q_pwr; - } else { - - wlc_phy_calc_rx_iq_comp_nphy(pi, - (1 << - rx_core)); - } - - wlc_phy_stopplayback_nphy(pi); - } - - if (bcmerror != 0) - break; - } - - and_radio_reg(pi, RADIO_2055_CORE1_GEN_SPARE2, ~mask); - and_radio_reg(pi, RADIO_2055_CORE2_GEN_SPARE2, ~mask); - - write_phy_reg(pi, (tx_core == PHY_CORE_0) ? 0x91 : - 0x92, orig_RfctrlIntcTx); - write_phy_reg(pi, (rx_core == PHY_CORE_0) ? 0x91 : - 0x92, orig_RfctrlIntcRx); - write_phy_reg(pi, 0xa5, orig_AfectrlOverride); - write_phy_reg(pi, (rx_core == PHY_CORE_0) ? 0xa6 : - 0xa7, orig_AfectrlCore); - write_phy_reg(pi, 0xa2, orig_RfseqCoreActv); - - if (bcmerror != 0) - break; - } - - wlc_phy_rfctrl_override_nphy(pi, (0x1 << 10), 0, 0x3, 1); - wlc_phy_force_rfseq_nphy(pi, NPHY_RFSEQ_RESET2RX); - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_RFSEQ, 2, 0x110, 16, - gain_save); - - wlc_phy_stay_in_carriersearch_nphy(pi, false); - - return bcmerror; -} - -int -wlc_phy_cal_rxiq_nphy(struct brcms_phy *pi, struct nphy_txgains target_gain, - u8 cal_type, bool debug) -{ - if (NREV_GE(pi->pubpi.phy_rev, 7)) - cal_type = 0; - - if (NREV_GE(pi->pubpi.phy_rev, 3)) - return wlc_phy_cal_rxiq_nphy_rev3(pi, target_gain, cal_type, - debug); - else - return wlc_phy_cal_rxiq_nphy_rev2(pi, target_gain, debug); -} - -void wlc_phy_txpwr_fixpower_nphy(struct brcms_phy *pi) -{ - uint core; - u32 txgain; - u16 rad_gain, dac_gain, bbmult, m1m2; - u8 txpi[2], chan_freq_range; - s32 rfpwr_offset; - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - if (pi->sh->sromrev < 4) { - txpi[0] = txpi[1] = 72; - } else { - - chan_freq_range = wlc_phy_get_chan_freq_range_nphy(pi, 0); - switch (chan_freq_range) { - case WL_CHAN_FREQ_RANGE_2G: - case WL_CHAN_FREQ_RANGE_5GL: - case WL_CHAN_FREQ_RANGE_5GM: - case WL_CHAN_FREQ_RANGE_5GH: - txpi[0] = 0; - txpi[1] = 0; - break; - default: - txpi[0] = txpi[1] = 91; - break; - } - } - - if (NREV_GE(pi->pubpi.phy_rev, 7)) - txpi[0] = txpi[1] = 30; - else if (NREV_GE(pi->pubpi.phy_rev, 3)) - txpi[0] = txpi[1] = 40; - - if (NREV_LT(pi->pubpi.phy_rev, 7)) { - - if ((txpi[0] < 40) || (txpi[0] > 100) || - (txpi[1] < 40) || (txpi[1] > 100)) - txpi[0] = txpi[1] = 91; - } - - pi->nphy_txpwrindex[PHY_CORE_0].index_internal = txpi[0]; - pi->nphy_txpwrindex[PHY_CORE_1].index_internal = txpi[1]; - pi->nphy_txpwrindex[PHY_CORE_0].index_internal_save = txpi[0]; - pi->nphy_txpwrindex[PHY_CORE_1].index_internal_save = txpi[1]; - - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - uint phyrev = pi->pubpi.phy_rev; - - if (NREV_GE(phyrev, 3)) { - if (PHY_IPA(pi)) { - u32 *tx_gaintbl = - wlc_phy_get_ipa_gaintbl_nphy(pi); - txgain = tx_gaintbl[txpi[core]]; - } else { - if (CHSPEC_IS5G(pi->radio_chanspec)) { - if (NREV_IS(phyrev, 3)) { - txgain = - nphy_tpc_5GHz_txgain_rev3 - [txpi[core]]; - } else if (NREV_IS(phyrev, 4)) { - txgain = ( - pi->srom_fem5g.extpagain == - 3) ? - nphy_tpc_5GHz_txgain_HiPwrEPA - [txpi[core]] : - nphy_tpc_5GHz_txgain_rev4 - [txpi[core]]; - } else { - txgain = - nphy_tpc_5GHz_txgain_rev5 - [txpi[core]]; - } - } else { - if (NREV_GE(phyrev, 5) && - (pi->srom_fem2g.extpagain == 3)) { - txgain = - nphy_tpc_txgain_HiPwrEPA - [txpi[core]]; - } else { - txgain = nphy_tpc_txgain_rev3 - [txpi[core]]; - } - } - } - } else { - txgain = nphy_tpc_txgain[txpi[core]]; - } - - if (NREV_GE(phyrev, 3)) - rad_gain = (txgain >> 16) & ((1 << (32 - 16 + 1)) - 1); - else - rad_gain = (txgain >> 16) & ((1 << (28 - 16 + 1)) - 1); - - if (NREV_GE(phyrev, 7)) - dac_gain = (txgain >> 8) & ((1 << (10 - 8 + 1)) - 1); - else - dac_gain = (txgain >> 8) & ((1 << (13 - 8 + 1)) - 1); - - bbmult = (txgain >> 0) & ((1 << (7 - 0 + 1)) - 1); - - if (NREV_GE(phyrev, 3)) - mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0x8f : - 0xa5), (0x1 << 8), (0x1 << 8)); - else - mod_phy_reg(pi, 0xa5, (0x1 << 14), (0x1 << 14)); - - write_phy_reg(pi, (core == PHY_CORE_0) ? 0xaa : 0xab, dac_gain); - - wlc_phy_table_write_nphy(pi, 7, 1, (0x110 + core), 16, - &rad_gain); - - wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, &m1m2); - m1m2 &= ((core == PHY_CORE_0) ? 0x00ff : 0xff00); - m1m2 |= ((core == PHY_CORE_0) ? (bbmult << 8) : (bbmult << 0)); - wlc_phy_table_write_nphy(pi, 15, 1, 87, 16, &m1m2); - - if (PHY_IPA(pi)) { - wlc_phy_table_read_nphy(pi, - (core == - PHY_CORE_0 ? - NPHY_TBL_ID_CORE1TXPWRCTL : - NPHY_TBL_ID_CORE2TXPWRCTL), 1, - 576 + txpi[core], 32, - &rfpwr_offset); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1ff << 4), - ((s16) rfpwr_offset) << 4); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 2), (1) << 2); - - } - } - - and_phy_reg(pi, 0xbf, (u16) (~(0x1f << 0))); - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); -} - -static void -wlc_phy_txpwr_nphy_srom_convert(u8 *srom_max, u16 *pwr_offset, - u8 tmp_max_pwr, u8 rate_start, - u8 rate_end) -{ - u8 rate; - u8 word_num, nibble_num; - u8 tmp_nibble; - - for (rate = rate_start; rate <= rate_end; rate++) { - word_num = (rate - rate_start) >> 2; - nibble_num = (rate - rate_start) & 0x3; - tmp_nibble = (pwr_offset[word_num] >> 4 * nibble_num) & 0xf; - - srom_max[rate] = tmp_max_pwr - 2 * tmp_nibble; - } -} - -static void -wlc_phy_txpwr_nphy_po_apply(u8 *srom_max, u8 pwr_offset, - u8 rate_start, u8 rate_end) -{ - u8 rate; - - for (rate = rate_start; rate <= rate_end; rate++) - srom_max[rate] -= 2 * pwr_offset; -} - -void -wlc_phy_ofdm_to_mcs_powers_nphy(u8 *power, u8 rate_mcs_start, - u8 rate_mcs_end, u8 rate_ofdm_start) -{ - u8 rate1, rate2; - - rate2 = rate_ofdm_start; - for (rate1 = rate_mcs_start; rate1 <= rate_mcs_end - 1; rate1++) { - power[rate1] = power[rate2]; - rate2 += (rate1 == rate_mcs_start) ? 2 : 1; - } - power[rate_mcs_end] = power[rate_mcs_end - 1]; -} - -void -wlc_phy_mcs_to_ofdm_powers_nphy(u8 *power, u8 rate_ofdm_start, - u8 rate_ofdm_end, u8 rate_mcs_start) -{ - u8 rate1, rate2; - - for (rate1 = rate_ofdm_start, rate2 = rate_mcs_start; - rate1 <= rate_ofdm_end; rate1++, rate2++) { - power[rate1] = power[rate2]; - if (rate1 == rate_ofdm_start) - power[++rate1] = power[rate2]; - } -} - -void wlc_phy_txpwr_apply_nphy(struct brcms_phy *pi) -{ - uint rate1, rate2, band_num; - u8 tmp_bw40po = 0, tmp_cddpo = 0, tmp_stbcpo = 0; - u8 tmp_max_pwr = 0; - u16 pwr_offsets1[2], *pwr_offsets2 = NULL; - u8 *tx_srom_max_rate = NULL; - - for (band_num = 0; band_num < (CH_2G_GROUP + CH_5G_GROUP); - band_num++) { - switch (band_num) { - case 0: - - tmp_max_pwr = min(pi->nphy_pwrctrl_info[0].max_pwr_2g, - pi->nphy_pwrctrl_info[1].max_pwr_2g); - - pwr_offsets1[0] = pi->cck2gpo; - wlc_phy_txpwr_nphy_srom_convert(pi->tx_srom_max_rate_2g, - pwr_offsets1, - tmp_max_pwr, - TXP_FIRST_CCK, - TXP_LAST_CCK); - - pwr_offsets1[0] = (u16) (pi->ofdm2gpo & 0xffff); - pwr_offsets1[1] = - (u16) (pi->ofdm2gpo >> 16) & 0xffff; - - pwr_offsets2 = pi->mcs2gpo; - - tmp_cddpo = pi->cdd2gpo; - tmp_stbcpo = pi->stbc2gpo; - tmp_bw40po = pi->bw402gpo; - - tx_srom_max_rate = pi->tx_srom_max_rate_2g; - break; - case 1: - - tmp_max_pwr = min(pi->nphy_pwrctrl_info[0].max_pwr_5gm, - pi->nphy_pwrctrl_info[1].max_pwr_5gm); - - pwr_offsets1[0] = (u16) (pi->ofdm5gpo & 0xffff); - pwr_offsets1[1] = - (u16) (pi->ofdm5gpo >> 16) & 0xffff; - - pwr_offsets2 = pi->mcs5gpo; - - tmp_cddpo = pi->cdd5gpo; - tmp_stbcpo = pi->stbc5gpo; - tmp_bw40po = pi->bw405gpo; - - tx_srom_max_rate = pi->tx_srom_max_rate_5g_mid; - break; - case 2: - - tmp_max_pwr = min(pi->nphy_pwrctrl_info[0].max_pwr_5gl, - pi->nphy_pwrctrl_info[1].max_pwr_5gl); - - pwr_offsets1[0] = (u16) (pi->ofdm5glpo & 0xffff); - pwr_offsets1[1] = - (u16) (pi->ofdm5glpo >> 16) & 0xffff; - - pwr_offsets2 = pi->mcs5glpo; - - tmp_cddpo = pi->cdd5glpo; - tmp_stbcpo = pi->stbc5glpo; - tmp_bw40po = pi->bw405glpo; - - tx_srom_max_rate = pi->tx_srom_max_rate_5g_low; - break; - case 3: - - tmp_max_pwr = min(pi->nphy_pwrctrl_info[0].max_pwr_5gh, - pi->nphy_pwrctrl_info[1].max_pwr_5gh); - - pwr_offsets1[0] = (u16) (pi->ofdm5ghpo & 0xffff); - pwr_offsets1[1] = - (u16) (pi->ofdm5ghpo >> 16) & 0xffff; - - pwr_offsets2 = pi->mcs5ghpo; - - tmp_cddpo = pi->cdd5ghpo; - tmp_stbcpo = pi->stbc5ghpo; - tmp_bw40po = pi->bw405ghpo; - - tx_srom_max_rate = pi->tx_srom_max_rate_5g_hi; - break; - } - - wlc_phy_txpwr_nphy_srom_convert(tx_srom_max_rate, pwr_offsets1, - tmp_max_pwr, TXP_FIRST_OFDM, - TXP_LAST_OFDM); - - wlc_phy_ofdm_to_mcs_powers_nphy(tx_srom_max_rate, - TXP_FIRST_MCS_20_SISO, - TXP_LAST_MCS_20_SISO, - TXP_FIRST_OFDM); - - wlc_phy_txpwr_nphy_srom_convert(tx_srom_max_rate, pwr_offsets2, - tmp_max_pwr, - TXP_FIRST_MCS_20_CDD, - TXP_LAST_MCS_20_CDD); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) - wlc_phy_txpwr_nphy_po_apply(tx_srom_max_rate, tmp_cddpo, - TXP_FIRST_MCS_20_CDD, - TXP_LAST_MCS_20_CDD); - - wlc_phy_mcs_to_ofdm_powers_nphy(tx_srom_max_rate, - TXP_FIRST_OFDM_20_CDD, - TXP_LAST_OFDM_20_CDD, - TXP_FIRST_MCS_20_CDD); - - wlc_phy_txpwr_nphy_srom_convert(tx_srom_max_rate, pwr_offsets2, - tmp_max_pwr, - TXP_FIRST_MCS_20_STBC, - TXP_LAST_MCS_20_STBC); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) - wlc_phy_txpwr_nphy_po_apply(tx_srom_max_rate, - tmp_stbcpo, - TXP_FIRST_MCS_20_STBC, - TXP_LAST_MCS_20_STBC); - - wlc_phy_txpwr_nphy_srom_convert(tx_srom_max_rate, - &pwr_offsets2[2], tmp_max_pwr, - TXP_FIRST_MCS_20_SDM, - TXP_LAST_MCS_20_SDM); - - if (NPHY_IS_SROM_REINTERPRET) { - - wlc_phy_txpwr_nphy_srom_convert(tx_srom_max_rate, - &pwr_offsets2[4], - tmp_max_pwr, - TXP_FIRST_MCS_40_SISO, - TXP_LAST_MCS_40_SISO); - - wlc_phy_mcs_to_ofdm_powers_nphy(tx_srom_max_rate, - TXP_FIRST_OFDM_40_SISO, - TXP_LAST_OFDM_40_SISO, - TXP_FIRST_MCS_40_SISO); - - wlc_phy_txpwr_nphy_srom_convert(tx_srom_max_rate, - &pwr_offsets2[4], - tmp_max_pwr, - TXP_FIRST_MCS_40_CDD, - TXP_LAST_MCS_40_CDD); - - wlc_phy_txpwr_nphy_po_apply(tx_srom_max_rate, tmp_cddpo, - TXP_FIRST_MCS_40_CDD, - TXP_LAST_MCS_40_CDD); - - wlc_phy_mcs_to_ofdm_powers_nphy(tx_srom_max_rate, - TXP_FIRST_OFDM_40_CDD, - TXP_LAST_OFDM_40_CDD, - TXP_FIRST_MCS_40_CDD); - - wlc_phy_txpwr_nphy_srom_convert(tx_srom_max_rate, - &pwr_offsets2[4], - tmp_max_pwr, - TXP_FIRST_MCS_40_STBC, - TXP_LAST_MCS_40_STBC); - - wlc_phy_txpwr_nphy_po_apply(tx_srom_max_rate, - tmp_stbcpo, - TXP_FIRST_MCS_40_STBC, - TXP_LAST_MCS_40_STBC); - - wlc_phy_txpwr_nphy_srom_convert(tx_srom_max_rate, - &pwr_offsets2[6], - tmp_max_pwr, - TXP_FIRST_MCS_40_SDM, - TXP_LAST_MCS_40_SDM); - } else { - - for (rate1 = TXP_FIRST_OFDM_40_SISO, rate2 = - TXP_FIRST_OFDM; - rate1 <= TXP_LAST_MCS_40_SDM; - rate1++, rate2++) - tx_srom_max_rate[rate1] = - tx_srom_max_rate[rate2]; - } - - if (NREV_GE(pi->pubpi.phy_rev, 3)) - wlc_phy_txpwr_nphy_po_apply(tx_srom_max_rate, - tmp_bw40po, - TXP_FIRST_OFDM_40_SISO, - TXP_LAST_MCS_40_SDM); - - tx_srom_max_rate[TXP_MCS_32] = - tx_srom_max_rate[TXP_FIRST_MCS_40_CDD]; - } - - return; -} - -void wlc_phy_txpower_recalc_target_nphy(struct brcms_phy *pi) -{ - u8 tx_pwr_ctrl_state; - wlc_phy_txpwr_limit_to_tbl_nphy(pi); - wlc_phy_txpwrctrl_pwr_setup_nphy(pi); - - tx_pwr_ctrl_state = pi->nphy_txpwrctrl; - - if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12)) { - wlapi_bmac_mctrl(pi->sh->physhim, MCTL_PHYLOCK, MCTL_PHYLOCK); - (void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol)); - udelay(1); - } - - wlc_phy_txpwrctrl_enable_nphy(pi, tx_pwr_ctrl_state); - - if (D11REV_IS(pi->sh->corerev, 11) || D11REV_IS(pi->sh->corerev, 12)) - wlapi_bmac_mctrl(pi->sh->physhim, MCTL_PHYLOCK, 0); -} - -static bool wlc_phy_txpwr_ison_nphy(struct brcms_phy *pi) -{ - return read_phy_reg((pi), 0x1e7) & ((0x1 << 15) | - (0x1 << 14) | (0x1 << 13)); -} - -u16 wlc_phy_txpwr_idx_get_nphy(struct brcms_phy *pi) -{ - u16 tmp; - u16 pwr_idx[2]; - - if (wlc_phy_txpwr_ison_nphy(pi)) { - pwr_idx[0] = wlc_phy_txpwr_idx_cur_get_nphy(pi, PHY_CORE_0); - pwr_idx[1] = wlc_phy_txpwr_idx_cur_get_nphy(pi, PHY_CORE_1); - - tmp = (pwr_idx[0] << 8) | pwr_idx[1]; - } else { - tmp = ((pi->nphy_txpwrindex[PHY_CORE_0].index_internal & 0xff) - << 8) | - (pi->nphy_txpwrindex[PHY_CORE_1].index_internal & 0xff); - } - - return tmp; -} - -void wlc_phy_txpwr_papd_cal_nphy(struct brcms_phy *pi) -{ - if (PHY_IPA(pi) - && (pi->nphy_force_papd_cal - || (wlc_phy_txpwr_ison_nphy(pi) - && - (((u32) - abs(wlc_phy_txpwr_idx_cur_get_nphy(pi, 0) - - pi->nphy_papd_tx_gain_at_last_cal[0]) >= 4) - || ((u32) - abs(wlc_phy_txpwr_idx_cur_get_nphy(pi, 1) - - pi->nphy_papd_tx_gain_at_last_cal[1]) >= 4))))) - wlc_phy_a4(pi, true); -} - -void wlc_phy_txpwrctrl_enable_nphy(struct brcms_phy *pi, u8 ctrl_type) -{ - u16 mask = 0, val = 0, ishw = 0; - u8 ctr; - uint core; - u32 tbl_offset; - u32 tbl_len; - u16 regval[84]; - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - switch (ctrl_type) { - case PHY_TPC_HW_OFF: - case PHY_TPC_HW_ON: - pi->nphy_txpwrctrl = ctrl_type; - break; - default: - break; - } - - if (ctrl_type == PHY_TPC_HW_OFF) { - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - - if (wlc_phy_txpwr_ison_nphy(pi)) { - for (core = 0; core < pi->pubpi.phy_corenum; - core++) - pi->nphy_txpwr_idx[core] = - wlc_phy_txpwr_idx_cur_get_nphy( - pi, - (u8) core); - } - - } - - tbl_len = 84; - tbl_offset = 64; - for (ctr = 0; ctr < tbl_len; ctr++) - regval[ctr] = 0; - wlc_phy_table_write_nphy(pi, 26, tbl_len, tbl_offset, 16, - regval); - wlc_phy_table_write_nphy(pi, 27, tbl_len, tbl_offset, 16, - regval); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) - and_phy_reg(pi, 0x1e7, - (u16) (~((0x1 << 15) | - (0x1 << 14) | (0x1 << 13)))); - else - and_phy_reg(pi, 0x1e7, - (u16) (~((0x1 << 14) | (0x1 << 13)))); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - or_phy_reg(pi, 0x8f, (0x1 << 8)); - or_phy_reg(pi, 0xa5, (0x1 << 8)); - } else { - or_phy_reg(pi, 0xa5, (0x1 << 14)); - } - - if (NREV_IS(pi->pubpi.phy_rev, 2)) - mod_phy_reg(pi, 0xdc, 0x00ff, 0x53); - else if (NREV_LT(pi->pubpi.phy_rev, 2)) - mod_phy_reg(pi, 0xdc, 0x00ff, 0x5a); - - if (NREV_LT(pi->pubpi.phy_rev, 2) && - pi->bw == WL_CHANSPEC_BW_40) - wlapi_bmac_mhf(pi->sh->physhim, MHF1, MHF1_IQSWAP_WAR, - MHF1_IQSWAP_WAR, BRCM_BAND_ALL); - - } else { - - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE1TXPWRCTL, 84, 64, - 8, pi->adj_pwr_tbl_nphy); - wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_CORE2TXPWRCTL, 84, 64, - 8, pi->adj_pwr_tbl_nphy); - - ishw = (ctrl_type == PHY_TPC_HW_ON) ? 0x1 : 0x0; - mask = (0x1 << 14) | (0x1 << 13); - val = (ishw << 14) | (ishw << 13); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - mask |= (0x1 << 15); - val |= (ishw << 15); - } - - mod_phy_reg(pi, 0x1e7, mask, val); - - if (CHSPEC_IS5G(pi->radio_chanspec)) { - if (NREV_GE(pi->pubpi.phy_rev, 7)) { - mod_phy_reg(pi, 0x1e7, (0x7f << 0), 0x32); - mod_phy_reg(pi, 0x222, (0xff << 0), 0x32); - } else { - mod_phy_reg(pi, 0x1e7, (0x7f << 0), 0x64); - if (NREV_GT(pi->pubpi.phy_rev, 1)) - mod_phy_reg(pi, 0x222, - (0xff << 0), 0x64); - } - } - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - if ((pi->nphy_txpwr_idx[0] != 128) - && (pi->nphy_txpwr_idx[1] != 128)) - wlc_phy_txpwr_idx_cur_set_nphy(pi, - pi-> - nphy_txpwr_idx - [0], - pi-> - nphy_txpwr_idx - [1]); - } - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - and_phy_reg(pi, 0x8f, ~(0x1 << 8)); - and_phy_reg(pi, 0xa5, ~(0x1 << 8)); - } else { - and_phy_reg(pi, 0xa5, ~(0x1 << 14)); - } - - if (NREV_IS(pi->pubpi.phy_rev, 2)) - mod_phy_reg(pi, 0xdc, 0x00ff, 0x3b); - else if (NREV_LT(pi->pubpi.phy_rev, 2)) - mod_phy_reg(pi, 0xdc, 0x00ff, 0x40); - - if (NREV_LT(pi->pubpi.phy_rev, 2) && - pi->bw == WL_CHANSPEC_BW_40) - wlapi_bmac_mhf(pi->sh->physhim, MHF1, MHF1_IQSWAP_WAR, - 0x0, BRCM_BAND_ALL); - - if (PHY_IPA(pi)) { - mod_phy_reg(pi, (0 == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 2), (0) << 2); - - mod_phy_reg(pi, (1 == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 2), (0) << 2); - - } - - } - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); -} - -void -wlc_phy_txpwr_index_nphy(struct brcms_phy *pi, u8 core_mask, s8 txpwrindex, - bool restore_cals) -{ - u8 core, txpwrctl_tbl; - u16 tx_ind0, iq_ind0, lo_ind0; - u16 m1m2; - u32 txgain; - u16 rad_gain, dac_gain; - u8 bbmult; - u32 iqcomp; - u16 iqcomp_a, iqcomp_b; - u32 locomp; - u16 tmpval; - u8 tx_pwr_ctrl_state; - s32 rfpwr_offset; - u16 regval[2]; - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - - tx_ind0 = 192; - iq_ind0 = 320; - lo_ind0 = 448; - - for (core = 0; core < pi->pubpi.phy_corenum; core++) { - - if ((core_mask & (1 << core)) == 0) - continue; - - txpwrctl_tbl = (core == PHY_CORE_0) ? 26 : 27; - - if (txpwrindex < 0) { - if (pi->nphy_txpwrindex[core].index < 0) - continue; - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - mod_phy_reg(pi, 0x8f, - (0x1 << 8), - pi->nphy_txpwrindex[core]. - AfectrlOverride); - mod_phy_reg(pi, 0xa5, (0x1 << 8), - pi->nphy_txpwrindex[core]. - AfectrlOverride); - } else { - mod_phy_reg(pi, 0xa5, - (0x1 << 14), - pi->nphy_txpwrindex[core]. - AfectrlOverride); - } - - write_phy_reg(pi, (core == PHY_CORE_0) ? - 0xaa : 0xab, - pi->nphy_txpwrindex[core].AfeCtrlDacGain); - - wlc_phy_table_write_nphy(pi, 7, 1, (0x110 + core), 16, - &pi->nphy_txpwrindex[core]. - rad_gain); - - wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, &m1m2); - m1m2 &= ((core == PHY_CORE_0) ? 0x00ff : 0xff00); - m1m2 |= ((core == PHY_CORE_0) ? - (pi->nphy_txpwrindex[core].bbmult << 8) : - (pi->nphy_txpwrindex[core].bbmult << 0)); - wlc_phy_table_write_nphy(pi, 15, 1, 87, 16, &m1m2); - - if (restore_cals) { - wlc_phy_table_write_nphy( - pi, 15, 2, (80 + 2 * core), 16, - &pi->nphy_txpwrindex[core].iqcomp_a); - wlc_phy_table_write_nphy( - pi, 15, 1, (85 + core), 16, - &pi->nphy_txpwrindex[core].locomp); - wlc_phy_table_write_nphy( - pi, 15, 1, (93 + core), 16, - &pi->nphy_txpwrindex[core].locomp); - } - - wlc_phy_txpwrctrl_enable_nphy(pi, pi->nphy_txpwrctrl); - - pi->nphy_txpwrindex[core].index_internal = - pi->nphy_txpwrindex[core].index_internal_save; - } else { - - if (pi->nphy_txpwrindex[core].index < 0) { - - if (NREV_GE(pi->pubpi.phy_rev, 3)) { - mod_phy_reg(pi, 0x8f, - (0x1 << 8), - pi->nphy_txpwrindex[core]. - AfectrlOverride); - mod_phy_reg(pi, 0xa5, (0x1 << 8), - pi->nphy_txpwrindex[core]. - AfectrlOverride); - } else { - pi->nphy_txpwrindex[core]. - AfectrlOverride = - read_phy_reg(pi, 0xa5); - } - - pi->nphy_txpwrindex[core].AfeCtrlDacGain = - read_phy_reg(pi, (core == PHY_CORE_0) ? - 0xaa : 0xab); - - wlc_phy_table_read_nphy(pi, 7, 1, - (0x110 + core), 16, - &pi-> - nphy_txpwrindex[core]. - rad_gain); - - wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, - &tmpval); - tmpval >>= ((core == PHY_CORE_0) ? 8 : 0); - tmpval &= 0xff; - pi->nphy_txpwrindex[core].bbmult = (u8) tmpval; - - wlc_phy_table_read_nphy(pi, 15, 2, - (80 + 2 * core), 16, - &pi-> - nphy_txpwrindex[core]. - iqcomp_a); - - wlc_phy_table_read_nphy(pi, 15, 1, (85 + core), - 16, - &pi-> - nphy_txpwrindex[core]. - locomp); - - pi->nphy_txpwrindex[core].index_internal_save = - pi->nphy_txpwrindex[core]. - index_internal; - } - - tx_pwr_ctrl_state = pi->nphy_txpwrctrl; - wlc_phy_txpwrctrl_enable_nphy(pi, PHY_TPC_HW_OFF); - - if (NREV_IS(pi->pubpi.phy_rev, 1)) - wlapi_bmac_phyclk_fgc(pi->sh->physhim, ON); - - wlc_phy_table_read_nphy(pi, txpwrctl_tbl, 1, - (tx_ind0 + txpwrindex), 32, - &txgain); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) - rad_gain = (txgain >> 16) & - ((1 << (32 - 16 + 1)) - 1); - else - rad_gain = (txgain >> 16) & - ((1 << (28 - 16 + 1)) - 1); - - dac_gain = (txgain >> 8) & ((1 << (13 - 8 + 1)) - 1); - bbmult = (txgain >> 0) & ((1 << (7 - 0 + 1)) - 1); - - if (NREV_GE(pi->pubpi.phy_rev, 3)) - mod_phy_reg(pi, ((core == PHY_CORE_0) ? 0x8f : - 0xa5), (0x1 << 8), (0x1 << 8)); - else - mod_phy_reg(pi, 0xa5, (0x1 << 14), (0x1 << 14)); - - write_phy_reg(pi, (core == PHY_CORE_0) ? - 0xaa : 0xab, dac_gain); - - wlc_phy_table_write_nphy(pi, 7, 1, (0x110 + core), 16, - &rad_gain); - - wlc_phy_table_read_nphy(pi, 15, 1, 87, 16, &m1m2); - m1m2 &= ((core == PHY_CORE_0) ? 0x00ff : 0xff00); - m1m2 |= ((core == PHY_CORE_0) ? - (bbmult << 8) : (bbmult << 0)); - - wlc_phy_table_write_nphy(pi, 15, 1, 87, 16, &m1m2); - - wlc_phy_table_read_nphy(pi, txpwrctl_tbl, 1, - (iq_ind0 + txpwrindex), 32, - &iqcomp); - iqcomp_a = (iqcomp >> 10) & ((1 << (19 - 10 + 1)) - 1); - iqcomp_b = (iqcomp >> 0) & ((1 << (9 - 0 + 1)) - 1); - - if (restore_cals) { - regval[0] = (u16) iqcomp_a; - regval[1] = (u16) iqcomp_b; - wlc_phy_table_write_nphy(pi, 15, 2, - (80 + 2 * core), 16, - regval); - } - - wlc_phy_table_read_nphy(pi, txpwrctl_tbl, 1, - (lo_ind0 + txpwrindex), 32, - &locomp); - if (restore_cals) - wlc_phy_table_write_nphy(pi, 15, 1, (85 + core), - 16, &locomp); - - if (NREV_IS(pi->pubpi.phy_rev, 1)) - wlapi_bmac_phyclk_fgc(pi->sh->physhim, OFF); - - if (PHY_IPA(pi)) { - wlc_phy_table_read_nphy(pi, - (core == PHY_CORE_0 ? - NPHY_TBL_ID_CORE1TXPWRCTL : - NPHY_TBL_ID_CORE2TXPWRCTL), - 1, 576 + txpwrindex, 32, - &rfpwr_offset); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1ff << 4), - ((s16) rfpwr_offset) << 4); - - mod_phy_reg(pi, (core == PHY_CORE_0) ? 0x297 : - 0x29b, (0x1 << 2), (1) << 2); - - } - - wlc_phy_txpwrctrl_enable_nphy(pi, tx_pwr_ctrl_state); - } - - pi->nphy_txpwrindex[core].index = txpwrindex; - } - - if (pi->phyhang_avoid) - wlc_phy_stay_in_carriersearch_nphy(pi, false); -} - -void -wlc_phy_txpower_sromlimit_get_nphy(struct brcms_phy *pi, uint chan, u8 *max_pwr, - u8 txp_rate_idx) -{ - u8 chan_freq_range; - - chan_freq_range = wlc_phy_get_chan_freq_range_nphy(pi, chan); - switch (chan_freq_range) { - case WL_CHAN_FREQ_RANGE_2G: - *max_pwr = pi->tx_srom_max_rate_2g[txp_rate_idx]; - break; - case WL_CHAN_FREQ_RANGE_5GM: - *max_pwr = pi->tx_srom_max_rate_5g_mid[txp_rate_idx]; - break; - case WL_CHAN_FREQ_RANGE_5GL: - *max_pwr = pi->tx_srom_max_rate_5g_low[txp_rate_idx]; - break; - case WL_CHAN_FREQ_RANGE_5GH: - *max_pwr = pi->tx_srom_max_rate_5g_hi[txp_rate_idx]; - break; - default: - *max_pwr = pi->tx_srom_max_rate_2g[txp_rate_idx]; - break; - } - - return; -} - -void wlc_phy_stay_in_carriersearch_nphy(struct brcms_phy *pi, bool enable) -{ - u16 clip_off[] = { 0xffff, 0xffff }; - - if (enable) { - if (pi->nphy_deaf_count == 0) { - pi->classifier_state = - wlc_phy_classifier_nphy(pi, 0, 0); - wlc_phy_classifier_nphy(pi, (0x7 << 0), 4); - wlc_phy_clip_det_nphy(pi, 0, pi->clip_state); - wlc_phy_clip_det_nphy(pi, 1, clip_off); - } - - pi->nphy_deaf_count++; - - wlc_phy_resetcca_nphy(pi); - - } else { - pi->nphy_deaf_count--; - - if (pi->nphy_deaf_count == 0) { - wlc_phy_classifier_nphy(pi, (0x7 << 0), - pi->classifier_state); - wlc_phy_clip_det_nphy(pi, 1, pi->clip_state); - } - } -} - -void wlc_nphy_deaf_mode(struct brcms_phy *pi, bool mode) -{ - wlapi_suspend_mac_and_wait(pi->sh->physhim); - - if (mode) { - if (pi->nphy_deaf_count == 0) - wlc_phy_stay_in_carriersearch_nphy(pi, true); - } else if (pi->nphy_deaf_count > 0) { - wlc_phy_stay_in_carriersearch_nphy(pi, false); - } - - wlapi_enable_mac(pi->sh->physhim); -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_qmath.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_qmath.c deleted file mode 100644 index faf1ebe76068..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_qmath.c +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "phy_qmath.h" - -/* - * Description: This function make 16 bit unsigned multiplication. - * To fit the output into 16 bits the 32 bit multiplication result is right - * shifted by 16 bits. - */ -u16 qm_mulu16(u16 op1, u16 op2) -{ - return (u16) (((u32) op1 * (u32) op2) >> 16); -} - -/* - * Description: This function make 16 bit multiplication and return the result - * in 16 bits. To fit the multiplication result into 16 bits the multiplication - * result is right shifted by 15 bits. Right shifting 15 bits instead of 16 bits - * is done to remove the extra sign bit formed due to the multiplication. - * When both the 16bit inputs are 0x8000 then the output is saturated to - * 0x7fffffff. - */ -s16 qm_muls16(s16 op1, s16 op2) -{ - s32 result; - if (op1 == (s16) 0x8000 && op2 == (s16) 0x8000) - result = 0x7fffffff; - else - result = ((s32) (op1) * (s32) (op2)); - - return (s16) (result >> 15); -} - -/* - * Description: This function add two 32 bit numbers and return the 32bit - * result. If the result overflow 32 bits, the output will be saturated to - * 32bits. - */ -s32 qm_add32(s32 op1, s32 op2) -{ - s32 result; - result = op1 + op2; - if (op1 < 0 && op2 < 0 && result > 0) - result = 0x80000000; - else if (op1 > 0 && op2 > 0 && result < 0) - result = 0x7fffffff; - - return result; -} - -/* - * Description: This function add two 16 bit numbers and return the 16bit - * result. If the result overflow 16 bits, the output will be saturated to - * 16bits. - */ -s16 qm_add16(s16 op1, s16 op2) -{ - s16 result; - s32 temp = (s32) op1 + (s32) op2; - if (temp > (s32) 0x7fff) - result = (s16) 0x7fff; - else if (temp < (s32) 0xffff8000) - result = (s16) 0xffff8000; - else - result = (s16) temp; - - return result; -} - -/* - * Description: This function make 16 bit subtraction and return the 16bit - * result. If the result overflow 16 bits, the output will be saturated to - * 16bits. - */ -s16 qm_sub16(s16 op1, s16 op2) -{ - s16 result; - s32 temp = (s32) op1 - (s32) op2; - if (temp > (s32) 0x7fff) - result = (s16) 0x7fff; - else if (temp < (s32) 0xffff8000) - result = (s16) 0xffff8000; - else - result = (s16) temp; - - return result; -} - -/* - * Description: This function make a 32 bit saturated left shift when the - * specified shift is +ve. This function will make a 32 bit right shift when - * the specified shift is -ve. This function return the result after shifting - * operation. - */ -s32 qm_shl32(s32 op, int shift) -{ - int i; - s32 result; - result = op; - if (shift > 31) - shift = 31; - else if (shift < -31) - shift = -31; - if (shift >= 0) { - for (i = 0; i < shift; i++) - result = qm_add32(result, result); - } else { - result = result >> (-shift); - } - - return result; -} - -/* - * Description: This function make a 16 bit saturated left shift when the - * specified shift is +ve. This function will make a 16 bit right shift when - * the specified shift is -ve. This function return the result after shifting - * operation. - */ -s16 qm_shl16(s16 op, int shift) -{ - int i; - s16 result; - result = op; - if (shift > 15) - shift = 15; - else if (shift < -15) - shift = -15; - if (shift > 0) { - for (i = 0; i < shift; i++) - result = qm_add16(result, result); - } else { - result = result >> (-shift); - } - - return result; -} - -/* - * Description: This function make a 16 bit right shift when shift is +ve. - * This function make a 16 bit saturated left shift when shift is -ve. This - * function return the result of the shift operation. - */ -s16 qm_shr16(s16 op, int shift) -{ - return qm_shl16(op, -shift); -} - -/* - * Description: This function return the number of redundant sign bits in a - * 32 bit number. Example: qm_norm32(0x00000080) = 23 - */ -s16 qm_norm32(s32 op) -{ - u16 u16extraSignBits; - if (op == 0) { - return 31; - } else { - u16extraSignBits = 0; - while ((op >> 31) == (op >> 30)) { - u16extraSignBits++; - op = op << 1; - } - } - return u16extraSignBits; -} - -/* This table is log2(1+(i/32)) where i=[0:1:31], in q.15 format */ -static const s16 log_table[] = { - 0, - 1455, - 2866, - 4236, - 5568, - 6863, - 8124, - 9352, - 10549, - 11716, - 12855, - 13968, - 15055, - 16117, - 17156, - 18173, - 19168, - 20143, - 21098, - 22034, - 22952, - 23852, - 24736, - 25604, - 26455, - 27292, - 28114, - 28922, - 29717, - 30498, - 31267, - 32024 -}; - -#define LOG_TABLE_SIZE 32 /* log_table size */ -#define LOG2_LOG_TABLE_SIZE 5 /* log2(log_table size) */ -#define Q_LOG_TABLE 15 /* qformat of log_table */ -#define LOG10_2 19728 /* log10(2) in q.16 */ - -/* - * Description: - * This routine takes the input number N and its q format qN and compute - * the log10(N). This routine first normalizes the input no N. Then N is in - * mag*(2^x) format. mag is any number in the range 2^30-(2^31 - 1). - * Then log2(mag * 2^x) = log2(mag) + x is computed. From that - * log10(mag * 2^x) = log2(mag * 2^x) * log10(2) is computed. - * This routine looks the log2 value in the table considering - * LOG2_LOG_TABLE_SIZE+1 MSBs. As the MSB is always 1, only next - * LOG2_OF_LOG_TABLE_SIZE MSBs are used for table lookup. Next 16 MSBs are used - * for interpolation. - * Inputs: - * N - number to which log10 has to be found. - * qN - q format of N - * log10N - address where log10(N) will be written. - * qLog10N - address where log10N qformat will be written. - * Note/Problem: - * For accurate results input should be in normalized or near normalized form. - */ -void qm_log10(s32 N, s16 qN, s16 *log10N, s16 *qLog10N) -{ - s16 s16norm, s16tableIndex, s16errorApproximation; - u16 u16offset; - s32 s32log; - - /* normalize the N. */ - s16norm = qm_norm32(N); - N = N << s16norm; - - /* The qformat of N after normalization. - * -30 is added to treat the no as between 1.0 to 2.0 - * i.e. after adding the -30 to the qformat the decimal point will be - * just rigtht of the MSB. (i.e. after sign bit and 1st MSB). i.e. - * at the right side of 30th bit. - */ - qN = qN + s16norm - 30; - - /* take the table index as the LOG2_OF_LOG_TABLE_SIZE bits right of the - * MSB */ - s16tableIndex = (s16) (N >> (32 - (2 + LOG2_LOG_TABLE_SIZE))); - - /* remove the MSB. the MSB is always 1 after normalization. */ - s16tableIndex = - s16tableIndex & (s16) ((1 << LOG2_LOG_TABLE_SIZE) - 1); - - /* remove the (1+LOG2_OF_LOG_TABLE_SIZE) MSBs in the N. */ - N = N & ((1 << (32 - (2 + LOG2_LOG_TABLE_SIZE))) - 1); - - /* take the offset as the 16 MSBS after table index. - */ - u16offset = (u16) (N >> (32 - (2 + LOG2_LOG_TABLE_SIZE + 16))); - - /* look the log value in the table. */ - s32log = log_table[s16tableIndex]; /* q.15 format */ - - /* interpolate using the offset. q.15 format. */ - s16errorApproximation = (s16) qm_mulu16(u16offset, - (u16) (log_table[s16tableIndex + 1] - - log_table[s16tableIndex])); - - /* q.15 format */ - s32log = qm_add16((s16) s32log, s16errorApproximation); - - /* adjust for the qformat of the N as - * log2(mag * 2^x) = log2(mag) + x - */ - s32log = qm_add32(s32log, ((s32) -qN) << 15); /* q.15 format */ - - /* normalize the result. */ - s16norm = qm_norm32(s32log); - - /* bring all the important bits into lower 16 bits */ - /* q.15+s16norm-16 format */ - s32log = qm_shl32(s32log, s16norm - 16); - - /* compute the log10(N) by multiplying log2(N) with log10(2). - * as log10(mag * 2^x) = log2(mag * 2^x) * log10(2) - * log10N in q.15+s16norm-16+1 (LOG10_2 is in q.16) - */ - *log10N = qm_muls16((s16) s32log, (s16) LOG10_2); - - /* write the q format of the result. */ - *qLog10N = 15 + s16norm - 16 + 1; - - return; -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_qmath.h b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_qmath.h deleted file mode 100644 index 20e3783f921b..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_qmath.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_QMATH_H_ -#define _BRCM_QMATH_H_ - -#include - -u16 qm_mulu16(u16 op1, u16 op2); - -s16 qm_muls16(s16 op1, s16 op2); - -s32 qm_add32(s32 op1, s32 op2); - -s16 qm_add16(s16 op1, s16 op2); - -s16 qm_sub16(s16 op1, s16 op2); - -s32 qm_shl32(s32 op, int shift); - -s16 qm_shl16(s16 op, int shift); - -s16 qm_shr16(s16 op, int shift); - -s16 qm_norm32(s32 op); - -void qm_log10(s32 N, s16 qN, s16 *log10N, s16 *qLog10N); - -#endif /* #ifndef _BRCM_QMATH_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_radio.h b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_radio.h deleted file mode 100644 index c3a675455ff5..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_radio.h +++ /dev/null @@ -1,1533 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_PHY_RADIO_H_ -#define _BRCM_PHY_RADIO_H_ - -#define RADIO_IDCODE 0x01 - -#define RADIO_DEFAULT_CORE 0 - -#define RXC0_RSSI_RST 0x80 -#define RXC0_MODE_RSSI 0x40 -#define RXC0_MODE_OFF 0x20 -#define RXC0_MODE_CM 0x10 -#define RXC0_LAN_LOAD 0x08 -#define RXC0_OFF_ADJ_MASK 0x07 - -#define TXC0_MODE_TXLPF 0x04 -#define TXC0_PA_TSSI_EN 0x02 -#define TXC0_TSSI_EN 0x01 - -#define TXC1_PA_GAIN_MASK 0x60 -#define TXC1_PA_GAIN_3DB 0x40 -#define TXC1_PA_GAIN_2DB 0x20 -#define TXC1_TX_MIX_GAIN 0x10 -#define TXC1_OFF_I_MASK 0x0c -#define TXC1_OFF_Q_MASK 0x03 - -#define RADIO_2055_READ_OFF 0x100 -#define RADIO_2057_READ_OFF 0x200 - -#define RADIO_2055_GEN_SPARE 0x00 -#define RADIO_2055_SP_PIN_PD 0x02 -#define RADIO_2055_SP_RSSI_CORE1 0x03 -#define RADIO_2055_SP_PD_MISC_CORE1 0x04 -#define RADIO_2055_SP_RSSI_CORE2 0x05 -#define RADIO_2055_SP_PD_MISC_CORE2 0x06 -#define RADIO_2055_SP_RX_GC1_CORE1 0x07 -#define RADIO_2055_SP_RX_GC2_CORE1 0x08 -#define RADIO_2055_SP_RX_GC1_CORE2 0x09 -#define RADIO_2055_SP_RX_GC2_CORE2 0x0a -#define RADIO_2055_SP_LPF_BW_SELECT_CORE1 0x0b -#define RADIO_2055_SP_LPF_BW_SELECT_CORE2 0x0c -#define RADIO_2055_SP_TX_GC1_CORE1 0x0d -#define RADIO_2055_SP_TX_GC2_CORE1 0x0e -#define RADIO_2055_SP_TX_GC1_CORE2 0x0f -#define RADIO_2055_SP_TX_GC2_CORE2 0x10 -#define RADIO_2055_MASTER_CNTRL1 0x11 -#define RADIO_2055_MASTER_CNTRL2 0x12 -#define RADIO_2055_PD_LGEN 0x13 -#define RADIO_2055_PD_PLL_TS 0x14 -#define RADIO_2055_PD_CORE1_LGBUF 0x15 -#define RADIO_2055_PD_CORE1_TX 0x16 -#define RADIO_2055_PD_CORE1_RXTX 0x17 -#define RADIO_2055_PD_CORE1_RSSI_MISC 0x18 -#define RADIO_2055_PD_CORE2_LGBUF 0x19 -#define RADIO_2055_PD_CORE2_TX 0x1a -#define RADIO_2055_PD_CORE2_RXTX 0x1b -#define RADIO_2055_PD_CORE2_RSSI_MISC 0x1c -#define RADIO_2055_PWRDET_LGEN 0x1d -#define RADIO_2055_PWRDET_LGBUF_CORE1 0x1e -#define RADIO_2055_PWRDET_RXTX_CORE1 0x1f -#define RADIO_2055_PWRDET_LGBUF_CORE2 0x20 -#define RADIO_2055_PWRDET_RXTX_CORE2 0x21 -#define RADIO_2055_RRCCAL_CNTRL_SPARE 0x22 -#define RADIO_2055_RRCCAL_N_OPT_SEL 0x23 -#define RADIO_2055_CAL_MISC 0x24 -#define RADIO_2055_CAL_COUNTER_OUT 0x25 -#define RADIO_2055_CAL_COUNTER_OUT2 0x26 -#define RADIO_2055_CAL_CVAR_CNTRL 0x27 -#define RADIO_2055_CAL_RVAR_CNTRL 0x28 -#define RADIO_2055_CAL_LPO_CNTRL 0x29 -#define RADIO_2055_CAL_TS 0x2a -#define RADIO_2055_CAL_RCCAL_READ_TS 0x2b -#define RADIO_2055_CAL_RCAL_READ_TS 0x2c -#define RADIO_2055_PAD_DRIVER 0x2d -#define RADIO_2055_XO_CNTRL1 0x2e -#define RADIO_2055_XO_CNTRL2 0x2f -#define RADIO_2055_XO_REGULATOR 0x30 -#define RADIO_2055_XO_MISC 0x31 -#define RADIO_2055_PLL_LF_C1 0x32 -#define RADIO_2055_PLL_CAL_VTH 0x33 -#define RADIO_2055_PLL_LF_C2 0x34 -#define RADIO_2055_PLL_REF 0x35 -#define RADIO_2055_PLL_LF_R1 0x36 -#define RADIO_2055_PLL_PFD_CP 0x37 -#define RADIO_2055_PLL_IDAC_CPOPAMP 0x38 -#define RADIO_2055_PLL_CP_REGULATOR 0x39 -#define RADIO_2055_PLL_RCAL 0x3a -#define RADIO_2055_RF_PLL_MOD0 0x3b -#define RADIO_2055_RF_PLL_MOD1 0x3c -#define RADIO_2055_RF_MMD_IDAC1 0x3d -#define RADIO_2055_RF_MMD_IDAC0 0x3e -#define RADIO_2055_RF_MMD_SPARE 0x3f -#define RADIO_2055_VCO_CAL1 0x40 -#define RADIO_2055_VCO_CAL2 0x41 -#define RADIO_2055_VCO_CAL3 0x42 -#define RADIO_2055_VCO_CAL4 0x43 -#define RADIO_2055_VCO_CAL5 0x44 -#define RADIO_2055_VCO_CAL6 0x45 -#define RADIO_2055_VCO_CAL7 0x46 -#define RADIO_2055_VCO_CAL8 0x47 -#define RADIO_2055_VCO_CAL9 0x48 -#define RADIO_2055_VCO_CAL10 0x49 -#define RADIO_2055_VCO_CAL11 0x4a -#define RADIO_2055_VCO_CAL12 0x4b -#define RADIO_2055_VCO_CAL13 0x4c -#define RADIO_2055_VCO_CAL14 0x4d -#define RADIO_2055_VCO_CAL15 0x4e -#define RADIO_2055_VCO_CAL16 0x4f -#define RADIO_2055_VCO_KVCO 0x50 -#define RADIO_2055_VCO_CAP_TAIL 0x51 -#define RADIO_2055_VCO_IDAC_VCO 0x52 -#define RADIO_2055_VCO_REGULATOR 0x53 -#define RADIO_2055_PLL_RF_VTH 0x54 -#define RADIO_2055_LGBUF_CEN_BUF 0x55 -#define RADIO_2055_LGEN_TUNE1 0x56 -#define RADIO_2055_LGEN_TUNE2 0x57 -#define RADIO_2055_LGEN_IDAC1 0x58 -#define RADIO_2055_LGEN_IDAC2 0x59 -#define RADIO_2055_LGEN_BIAS_CNT 0x5a -#define RADIO_2055_LGEN_BIAS_IDAC 0x5b -#define RADIO_2055_LGEN_RCAL 0x5c -#define RADIO_2055_LGEN_DIV 0x5d -#define RADIO_2055_LGEN_SPARE2 0x5e -#define RADIO_2055_CORE1_LGBUF_A_TUNE 0x5f -#define RADIO_2055_CORE1_LGBUF_G_TUNE 0x60 -#define RADIO_2055_CORE1_LGBUF_DIV 0x61 -#define RADIO_2055_CORE1_LGBUF_A_IDAC 0x62 -#define RADIO_2055_CORE1_LGBUF_G_IDAC 0x63 -#define RADIO_2055_CORE1_LGBUF_IDACFIL_OVR 0x64 -#define RADIO_2055_CORE1_LGBUF_SPARE 0x65 -#define RADIO_2055_CORE1_RXRF_SPC1 0x66 -#define RADIO_2055_CORE1_RXRF_REG1 0x67 -#define RADIO_2055_CORE1_RXRF_REG2 0x68 -#define RADIO_2055_CORE1_RXRF_RCAL 0x69 -#define RADIO_2055_CORE1_RXBB_BUFI_LPFCMP 0x6a -#define RADIO_2055_CORE1_RXBB_LPF 0x6b -#define RADIO_2055_CORE1_RXBB_MIDAC_HIPAS 0x6c -#define RADIO_2055_CORE1_RXBB_VGA1_IDAC 0x6d -#define RADIO_2055_CORE1_RXBB_VGA2_IDAC 0x6e -#define RADIO_2055_CORE1_RXBB_VGA3_IDAC 0x6f -#define RADIO_2055_CORE1_RXBB_BUFO_CTRL 0x70 -#define RADIO_2055_CORE1_RXBB_RCCAL_CTRL 0x71 -#define RADIO_2055_CORE1_RXBB_RSSI_CTRL1 0x72 -#define RADIO_2055_CORE1_RXBB_RSSI_CTRL2 0x73 -#define RADIO_2055_CORE1_RXBB_RSSI_CTRL3 0x74 -#define RADIO_2055_CORE1_RXBB_RSSI_CTRL4 0x75 -#define RADIO_2055_CORE1_RXBB_RSSI_CTRL5 0x76 -#define RADIO_2055_CORE1_RXBB_REGULATOR 0x77 -#define RADIO_2055_CORE1_RXBB_SPARE1 0x78 -#define RADIO_2055_CORE1_RXTXBB_RCAL 0x79 -#define RADIO_2055_CORE1_TXRF_SGM_PGA 0x7a -#define RADIO_2055_CORE1_TXRF_SGM_PAD 0x7b -#define RADIO_2055_CORE1_TXRF_CNTR_PGA1 0x7c -#define RADIO_2055_CORE1_TXRF_CNTR_PAD1 0x7d -#define RADIO_2055_CORE1_TX_RFPGA_IDAC 0x7e -#define RADIO_2055_CORE1_TX_PGA_PAD_TN 0x7f -#define RADIO_2055_CORE1_TX_PAD_IDAC1 0x80 -#define RADIO_2055_CORE1_TX_PAD_IDAC2 0x81 -#define RADIO_2055_CORE1_TX_MX_BGTRIM 0x82 -#define RADIO_2055_CORE1_TXRF_RCAL 0x83 -#define RADIO_2055_CORE1_TXRF_PAD_TSSI1 0x84 -#define RADIO_2055_CORE1_TXRF_PAD_TSSI2 0x85 -#define RADIO_2055_CORE1_TX_RF_SPARE 0x86 -#define RADIO_2055_CORE1_TXRF_IQCAL1 0x87 -#define RADIO_2055_CORE1_TXRF_IQCAL2 0x88 -#define RADIO_2055_CORE1_TXBB_RCCAL_CTRL 0x89 -#define RADIO_2055_CORE1_TXBB_LPF1 0x8a -#define RADIO_2055_CORE1_TX_VOS_CNCL 0x8b -#define RADIO_2055_CORE1_TX_LPF_MXGM_IDAC 0x8c -#define RADIO_2055_CORE1_TX_BB_MXGM 0x8d -#define RADIO_2055_CORE2_LGBUF_A_TUNE 0x8e -#define RADIO_2055_CORE2_LGBUF_G_TUNE 0x8f -#define RADIO_2055_CORE2_LGBUF_DIV 0x90 -#define RADIO_2055_CORE2_LGBUF_A_IDAC 0x91 -#define RADIO_2055_CORE2_LGBUF_G_IDAC 0x92 -#define RADIO_2055_CORE2_LGBUF_IDACFIL_OVR 0x93 -#define RADIO_2055_CORE2_LGBUF_SPARE 0x94 -#define RADIO_2055_CORE2_RXRF_SPC1 0x95 -#define RADIO_2055_CORE2_RXRF_REG1 0x96 -#define RADIO_2055_CORE2_RXRF_REG2 0x97 -#define RADIO_2055_CORE2_RXRF_RCAL 0x98 -#define RADIO_2055_CORE2_RXBB_BUFI_LPFCMP 0x99 -#define RADIO_2055_CORE2_RXBB_LPF 0x9a -#define RADIO_2055_CORE2_RXBB_MIDAC_HIPAS 0x9b -#define RADIO_2055_CORE2_RXBB_VGA1_IDAC 0x9c -#define RADIO_2055_CORE2_RXBB_VGA2_IDAC 0x9d -#define RADIO_2055_CORE2_RXBB_VGA3_IDAC 0x9e -#define RADIO_2055_CORE2_RXBB_BUFO_CTRL 0x9f -#define RADIO_2055_CORE2_RXBB_RCCAL_CTRL 0xa0 -#define RADIO_2055_CORE2_RXBB_RSSI_CTRL1 0xa1 -#define RADIO_2055_CORE2_RXBB_RSSI_CTRL2 0xa2 -#define RADIO_2055_CORE2_RXBB_RSSI_CTRL3 0xa3 -#define RADIO_2055_CORE2_RXBB_RSSI_CTRL4 0xa4 -#define RADIO_2055_CORE2_RXBB_RSSI_CTRL5 0xa5 -#define RADIO_2055_CORE2_RXBB_REGULATOR 0xa6 -#define RADIO_2055_CORE2_RXBB_SPARE1 0xa7 -#define RADIO_2055_CORE2_RXTXBB_RCAL 0xa8 -#define RADIO_2055_CORE2_TXRF_SGM_PGA 0xa9 -#define RADIO_2055_CORE2_TXRF_SGM_PAD 0xaa -#define RADIO_2055_CORE2_TXRF_CNTR_PGA1 0xab -#define RADIO_2055_CORE2_TXRF_CNTR_PAD1 0xac -#define RADIO_2055_CORE2_TX_RFPGA_IDAC 0xad -#define RADIO_2055_CORE2_TX_PGA_PAD_TN 0xae -#define RADIO_2055_CORE2_TX_PAD_IDAC1 0xaf -#define RADIO_2055_CORE2_TX_PAD_IDAC2 0xb0 -#define RADIO_2055_CORE2_TX_MX_BGTRIM 0xb1 -#define RADIO_2055_CORE2_TXRF_RCAL 0xb2 -#define RADIO_2055_CORE2_TXRF_PAD_TSSI1 0xb3 -#define RADIO_2055_CORE2_TXRF_PAD_TSSI2 0xb4 -#define RADIO_2055_CORE2_TX_RF_SPARE 0xb5 -#define RADIO_2055_CORE2_TXRF_IQCAL1 0xb6 -#define RADIO_2055_CORE2_TXRF_IQCAL2 0xb7 -#define RADIO_2055_CORE2_TXBB_RCCAL_CTRL 0xb8 -#define RADIO_2055_CORE2_TXBB_LPF1 0xb9 -#define RADIO_2055_CORE2_TX_VOS_CNCL 0xba -#define RADIO_2055_CORE2_TX_LPF_MXGM_IDAC 0xbb -#define RADIO_2055_CORE2_TX_BB_MXGM 0xbc -#define RADIO_2055_PRG_GC_HPVGA23_21 0xbd -#define RADIO_2055_PRG_GC_HPVGA23_22 0xbe -#define RADIO_2055_PRG_GC_HPVGA23_23 0xbf -#define RADIO_2055_PRG_GC_HPVGA23_24 0xc0 -#define RADIO_2055_PRG_GC_HPVGA23_25 0xc1 -#define RADIO_2055_PRG_GC_HPVGA23_26 0xc2 -#define RADIO_2055_PRG_GC_HPVGA23_27 0xc3 -#define RADIO_2055_PRG_GC_HPVGA23_28 0xc4 -#define RADIO_2055_PRG_GC_HPVGA23_29 0xc5 -#define RADIO_2055_PRG_GC_HPVGA23_30 0xc6 -#define RADIO_2055_CORE1_LNA_GAINBST 0xcd -#define RADIO_2055_CORE1_B0_NBRSSI_VCM 0xd2 -#define RADIO_2055_CORE1_GEN_SPARE2 0xd6 -#define RADIO_2055_CORE2_LNA_GAINBST 0xd9 -#define RADIO_2055_CORE2_B0_NBRSSI_VCM 0xde -#define RADIO_2055_CORE2_GEN_SPARE2 0xe2 - -#define RADIO_2055_GAINBST_GAIN_DB 6 -#define RADIO_2055_GAINBST_CODE 0x6 - -#define RADIO_2055_JTAGCTRL_MASK 0x04 -#define RADIO_2055_JTAGSYNC_MASK 0x08 -#define RADIO_2055_RRCAL_START 0x40 -#define RADIO_2055_RRCAL_RST_N 0x01 -#define RADIO_2055_CAL_LPO_ENABLE 0x80 -#define RADIO_2055_RCAL_DONE 0x80 -#define RADIO_2055_NBRSSI_VCM_I_MASK 0x03 -#define RADIO_2055_NBRSSI_VCM_I_SHIFT 0x00 -#define RADIO_2055_NBRSSI_VCM_Q_MASK 0x03 -#define RADIO_2055_NBRSSI_VCM_Q_SHIFT 0x00 -#define RADIO_2055_WBRSSI_VCM_IQ_MASK 0x0c -#define RADIO_2055_WBRSSI_VCM_IQ_SHIFT 0x02 -#define RADIO_2055_NBRSSI_PD 0x01 -#define RADIO_2055_WBRSSI_G1_PD 0x04 -#define RADIO_2055_WBRSSI_G2_PD 0x02 -#define RADIO_2055_NBRSSI_SEL 0x01 -#define RADIO_2055_WBRSSI_G1_SEL 0x04 -#define RADIO_2055_WBRSSI_G2_SEL 0x02 -#define RADIO_2055_COUPLE_RX_MASK 0x01 -#define RADIO_2055_COUPLE_TX_MASK 0x02 -#define RADIO_2055_GAINBST_DISABLE 0x02 -#define RADIO_2055_GAINBST_VAL_MASK 0x07 -#define RADIO_2055_RXMX_GC_MASK 0x0c - -#define RADIO_MIMO_CORESEL_OFF 0x0 -#define RADIO_MIMO_CORESEL_CORE1 0x1 -#define RADIO_MIMO_CORESEL_CORE2 0x2 -#define RADIO_MIMO_CORESEL_CORE3 0x3 -#define RADIO_MIMO_CORESEL_CORE4 0x4 -#define RADIO_MIMO_CORESEL_ALLRX 0x5 -#define RADIO_MIMO_CORESEL_ALLTX 0x6 -#define RADIO_MIMO_CORESEL_ALLRXTX 0x7 - -#define RADIO_2064_READ_OFF 0x200 - -#define RADIO_2064_REG000 0x0 -#define RADIO_2064_REG001 0x1 -#define RADIO_2064_REG002 0x2 -#define RADIO_2064_REG003 0x3 -#define RADIO_2064_REG004 0x4 -#define RADIO_2064_REG005 0x5 -#define RADIO_2064_REG006 0x6 -#define RADIO_2064_REG007 0x7 -#define RADIO_2064_REG008 0x8 -#define RADIO_2064_REG009 0x9 -#define RADIO_2064_REG00A 0xa -#define RADIO_2064_REG00B 0xb -#define RADIO_2064_REG00C 0xc -#define RADIO_2064_REG00D 0xd -#define RADIO_2064_REG00E 0xe -#define RADIO_2064_REG00F 0xf -#define RADIO_2064_REG010 0x10 -#define RADIO_2064_REG011 0x11 -#define RADIO_2064_REG012 0x12 -#define RADIO_2064_REG013 0x13 -#define RADIO_2064_REG014 0x14 -#define RADIO_2064_REG015 0x15 -#define RADIO_2064_REG016 0x16 -#define RADIO_2064_REG017 0x17 -#define RADIO_2064_REG018 0x18 -#define RADIO_2064_REG019 0x19 -#define RADIO_2064_REG01A 0x1a -#define RADIO_2064_REG01B 0x1b -#define RADIO_2064_REG01C 0x1c -#define RADIO_2064_REG01D 0x1d -#define RADIO_2064_REG01E 0x1e -#define RADIO_2064_REG01F 0x1f -#define RADIO_2064_REG020 0x20 -#define RADIO_2064_REG021 0x21 -#define RADIO_2064_REG022 0x22 -#define RADIO_2064_REG023 0x23 -#define RADIO_2064_REG024 0x24 -#define RADIO_2064_REG025 0x25 -#define RADIO_2064_REG026 0x26 -#define RADIO_2064_REG027 0x27 -#define RADIO_2064_REG028 0x28 -#define RADIO_2064_REG029 0x29 -#define RADIO_2064_REG02A 0x2a -#define RADIO_2064_REG02B 0x2b -#define RADIO_2064_REG02C 0x2c -#define RADIO_2064_REG02D 0x2d -#define RADIO_2064_REG02E 0x2e -#define RADIO_2064_REG02F 0x2f -#define RADIO_2064_REG030 0x30 -#define RADIO_2064_REG031 0x31 -#define RADIO_2064_REG032 0x32 -#define RADIO_2064_REG033 0x33 -#define RADIO_2064_REG034 0x34 -#define RADIO_2064_REG035 0x35 -#define RADIO_2064_REG036 0x36 -#define RADIO_2064_REG037 0x37 -#define RADIO_2064_REG038 0x38 -#define RADIO_2064_REG039 0x39 -#define RADIO_2064_REG03A 0x3a -#define RADIO_2064_REG03B 0x3b -#define RADIO_2064_REG03C 0x3c -#define RADIO_2064_REG03D 0x3d -#define RADIO_2064_REG03E 0x3e -#define RADIO_2064_REG03F 0x3f -#define RADIO_2064_REG040 0x40 -#define RADIO_2064_REG041 0x41 -#define RADIO_2064_REG042 0x42 -#define RADIO_2064_REG043 0x43 -#define RADIO_2064_REG044 0x44 -#define RADIO_2064_REG045 0x45 -#define RADIO_2064_REG046 0x46 -#define RADIO_2064_REG047 0x47 -#define RADIO_2064_REG048 0x48 -#define RADIO_2064_REG049 0x49 -#define RADIO_2064_REG04A 0x4a -#define RADIO_2064_REG04B 0x4b -#define RADIO_2064_REG04C 0x4c -#define RADIO_2064_REG04D 0x4d -#define RADIO_2064_REG04E 0x4e -#define RADIO_2064_REG04F 0x4f -#define RADIO_2064_REG050 0x50 -#define RADIO_2064_REG051 0x51 -#define RADIO_2064_REG052 0x52 -#define RADIO_2064_REG053 0x53 -#define RADIO_2064_REG054 0x54 -#define RADIO_2064_REG055 0x55 -#define RADIO_2064_REG056 0x56 -#define RADIO_2064_REG057 0x57 -#define RADIO_2064_REG058 0x58 -#define RADIO_2064_REG059 0x59 -#define RADIO_2064_REG05A 0x5a -#define RADIO_2064_REG05B 0x5b -#define RADIO_2064_REG05C 0x5c -#define RADIO_2064_REG05D 0x5d -#define RADIO_2064_REG05E 0x5e -#define RADIO_2064_REG05F 0x5f -#define RADIO_2064_REG060 0x60 -#define RADIO_2064_REG061 0x61 -#define RADIO_2064_REG062 0x62 -#define RADIO_2064_REG063 0x63 -#define RADIO_2064_REG064 0x64 -#define RADIO_2064_REG065 0x65 -#define RADIO_2064_REG066 0x66 -#define RADIO_2064_REG067 0x67 -#define RADIO_2064_REG068 0x68 -#define RADIO_2064_REG069 0x69 -#define RADIO_2064_REG06A 0x6a -#define RADIO_2064_REG06B 0x6b -#define RADIO_2064_REG06C 0x6c -#define RADIO_2064_REG06D 0x6d -#define RADIO_2064_REG06E 0x6e -#define RADIO_2064_REG06F 0x6f -#define RADIO_2064_REG070 0x70 -#define RADIO_2064_REG071 0x71 -#define RADIO_2064_REG072 0x72 -#define RADIO_2064_REG073 0x73 -#define RADIO_2064_REG074 0x74 -#define RADIO_2064_REG075 0x75 -#define RADIO_2064_REG076 0x76 -#define RADIO_2064_REG077 0x77 -#define RADIO_2064_REG078 0x78 -#define RADIO_2064_REG079 0x79 -#define RADIO_2064_REG07A 0x7a -#define RADIO_2064_REG07B 0x7b -#define RADIO_2064_REG07C 0x7c -#define RADIO_2064_REG07D 0x7d -#define RADIO_2064_REG07E 0x7e -#define RADIO_2064_REG07F 0x7f -#define RADIO_2064_REG080 0x80 -#define RADIO_2064_REG081 0x81 -#define RADIO_2064_REG082 0x82 -#define RADIO_2064_REG083 0x83 -#define RADIO_2064_REG084 0x84 -#define RADIO_2064_REG085 0x85 -#define RADIO_2064_REG086 0x86 -#define RADIO_2064_REG087 0x87 -#define RADIO_2064_REG088 0x88 -#define RADIO_2064_REG089 0x89 -#define RADIO_2064_REG08A 0x8a -#define RADIO_2064_REG08B 0x8b -#define RADIO_2064_REG08C 0x8c -#define RADIO_2064_REG08D 0x8d -#define RADIO_2064_REG08E 0x8e -#define RADIO_2064_REG08F 0x8f -#define RADIO_2064_REG090 0x90 -#define RADIO_2064_REG091 0x91 -#define RADIO_2064_REG092 0x92 -#define RADIO_2064_REG093 0x93 -#define RADIO_2064_REG094 0x94 -#define RADIO_2064_REG095 0x95 -#define RADIO_2064_REG096 0x96 -#define RADIO_2064_REG097 0x97 -#define RADIO_2064_REG098 0x98 -#define RADIO_2064_REG099 0x99 -#define RADIO_2064_REG09A 0x9a -#define RADIO_2064_REG09B 0x9b -#define RADIO_2064_REG09C 0x9c -#define RADIO_2064_REG09D 0x9d -#define RADIO_2064_REG09E 0x9e -#define RADIO_2064_REG09F 0x9f -#define RADIO_2064_REG0A0 0xa0 -#define RADIO_2064_REG0A1 0xa1 -#define RADIO_2064_REG0A2 0xa2 -#define RADIO_2064_REG0A3 0xa3 -#define RADIO_2064_REG0A4 0xa4 -#define RADIO_2064_REG0A5 0xa5 -#define RADIO_2064_REG0A6 0xa6 -#define RADIO_2064_REG0A7 0xa7 -#define RADIO_2064_REG0A8 0xa8 -#define RADIO_2064_REG0A9 0xa9 -#define RADIO_2064_REG0AA 0xaa -#define RADIO_2064_REG0AB 0xab -#define RADIO_2064_REG0AC 0xac -#define RADIO_2064_REG0AD 0xad -#define RADIO_2064_REG0AE 0xae -#define RADIO_2064_REG0AF 0xaf -#define RADIO_2064_REG0B0 0xb0 -#define RADIO_2064_REG0B1 0xb1 -#define RADIO_2064_REG0B2 0xb2 -#define RADIO_2064_REG0B3 0xb3 -#define RADIO_2064_REG0B4 0xb4 -#define RADIO_2064_REG0B5 0xb5 -#define RADIO_2064_REG0B6 0xb6 -#define RADIO_2064_REG0B7 0xb7 -#define RADIO_2064_REG0B8 0xb8 -#define RADIO_2064_REG0B9 0xb9 -#define RADIO_2064_REG0BA 0xba -#define RADIO_2064_REG0BB 0xbb -#define RADIO_2064_REG0BC 0xbc -#define RADIO_2064_REG0BD 0xbd -#define RADIO_2064_REG0BE 0xbe -#define RADIO_2064_REG0BF 0xbf -#define RADIO_2064_REG0C0 0xc0 -#define RADIO_2064_REG0C1 0xc1 -#define RADIO_2064_REG0C2 0xc2 -#define RADIO_2064_REG0C3 0xc3 -#define RADIO_2064_REG0C4 0xc4 -#define RADIO_2064_REG0C5 0xc5 -#define RADIO_2064_REG0C6 0xc6 -#define RADIO_2064_REG0C7 0xc7 -#define RADIO_2064_REG0C8 0xc8 -#define RADIO_2064_REG0C9 0xc9 -#define RADIO_2064_REG0CA 0xca -#define RADIO_2064_REG0CB 0xcb -#define RADIO_2064_REG0CC 0xcc -#define RADIO_2064_REG0CD 0xcd -#define RADIO_2064_REG0CE 0xce -#define RADIO_2064_REG0CF 0xcf -#define RADIO_2064_REG0D0 0xd0 -#define RADIO_2064_REG0D1 0xd1 -#define RADIO_2064_REG0D2 0xd2 -#define RADIO_2064_REG0D3 0xd3 -#define RADIO_2064_REG0D4 0xd4 -#define RADIO_2064_REG0D5 0xd5 -#define RADIO_2064_REG0D6 0xd6 -#define RADIO_2064_REG0D7 0xd7 -#define RADIO_2064_REG0D8 0xd8 -#define RADIO_2064_REG0D9 0xd9 -#define RADIO_2064_REG0DA 0xda -#define RADIO_2064_REG0DB 0xdb -#define RADIO_2064_REG0DC 0xdc -#define RADIO_2064_REG0DD 0xdd -#define RADIO_2064_REG0DE 0xde -#define RADIO_2064_REG0DF 0xdf -#define RADIO_2064_REG0E0 0xe0 -#define RADIO_2064_REG0E1 0xe1 -#define RADIO_2064_REG0E2 0xe2 -#define RADIO_2064_REG0E3 0xe3 -#define RADIO_2064_REG0E4 0xe4 -#define RADIO_2064_REG0E5 0xe5 -#define RADIO_2064_REG0E6 0xe6 -#define RADIO_2064_REG0E7 0xe7 -#define RADIO_2064_REG0E8 0xe8 -#define RADIO_2064_REG0E9 0xe9 -#define RADIO_2064_REG0EA 0xea -#define RADIO_2064_REG0EB 0xeb -#define RADIO_2064_REG0EC 0xec -#define RADIO_2064_REG0ED 0xed -#define RADIO_2064_REG0EE 0xee -#define RADIO_2064_REG0EF 0xef -#define RADIO_2064_REG0F0 0xf0 -#define RADIO_2064_REG0F1 0xf1 -#define RADIO_2064_REG0F2 0xf2 -#define RADIO_2064_REG0F3 0xf3 -#define RADIO_2064_REG0F4 0xf4 -#define RADIO_2064_REG0F5 0xf5 -#define RADIO_2064_REG0F6 0xf6 -#define RADIO_2064_REG0F7 0xf7 -#define RADIO_2064_REG0F8 0xf8 -#define RADIO_2064_REG0F9 0xf9 -#define RADIO_2064_REG0FA 0xfa -#define RADIO_2064_REG0FB 0xfb -#define RADIO_2064_REG0FC 0xfc -#define RADIO_2064_REG0FD 0xfd -#define RADIO_2064_REG0FE 0xfe -#define RADIO_2064_REG0FF 0xff -#define RADIO_2064_REG100 0x100 -#define RADIO_2064_REG101 0x101 -#define RADIO_2064_REG102 0x102 -#define RADIO_2064_REG103 0x103 -#define RADIO_2064_REG104 0x104 -#define RADIO_2064_REG105 0x105 -#define RADIO_2064_REG106 0x106 -#define RADIO_2064_REG107 0x107 -#define RADIO_2064_REG108 0x108 -#define RADIO_2064_REG109 0x109 -#define RADIO_2064_REG10A 0x10a -#define RADIO_2064_REG10B 0x10b -#define RADIO_2064_REG10C 0x10c -#define RADIO_2064_REG10D 0x10d -#define RADIO_2064_REG10E 0x10e -#define RADIO_2064_REG10F 0x10f -#define RADIO_2064_REG110 0x110 -#define RADIO_2064_REG111 0x111 -#define RADIO_2064_REG112 0x112 -#define RADIO_2064_REG113 0x113 -#define RADIO_2064_REG114 0x114 -#define RADIO_2064_REG115 0x115 -#define RADIO_2064_REG116 0x116 -#define RADIO_2064_REG117 0x117 -#define RADIO_2064_REG118 0x118 -#define RADIO_2064_REG119 0x119 -#define RADIO_2064_REG11A 0x11a -#define RADIO_2064_REG11B 0x11b -#define RADIO_2064_REG11C 0x11c -#define RADIO_2064_REG11D 0x11d -#define RADIO_2064_REG11E 0x11e -#define RADIO_2064_REG11F 0x11f -#define RADIO_2064_REG120 0x120 -#define RADIO_2064_REG121 0x121 -#define RADIO_2064_REG122 0x122 -#define RADIO_2064_REG123 0x123 -#define RADIO_2064_REG124 0x124 -#define RADIO_2064_REG125 0x125 -#define RADIO_2064_REG126 0x126 -#define RADIO_2064_REG127 0x127 -#define RADIO_2064_REG128 0x128 -#define RADIO_2064_REG129 0x129 -#define RADIO_2064_REG12A 0x12a -#define RADIO_2064_REG12B 0x12b -#define RADIO_2064_REG12C 0x12c -#define RADIO_2064_REG12D 0x12d -#define RADIO_2064_REG12E 0x12e -#define RADIO_2064_REG12F 0x12f -#define RADIO_2064_REG130 0x130 - -#define RADIO_2056_SYN (0x0 << 12) -#define RADIO_2056_TX0 (0x2 << 12) -#define RADIO_2056_TX1 (0x3 << 12) -#define RADIO_2056_RX0 (0x6 << 12) -#define RADIO_2056_RX1 (0x7 << 12) -#define RADIO_2056_ALLTX (0xe << 12) -#define RADIO_2056_ALLRX (0xf << 12) - -#define RADIO_2056_SYN_RESERVED_ADDR0 0x0 -#define RADIO_2056_SYN_IDCODE 0x1 -#define RADIO_2056_SYN_RESERVED_ADDR2 0x2 -#define RADIO_2056_SYN_RESERVED_ADDR3 0x3 -#define RADIO_2056_SYN_RESERVED_ADDR4 0x4 -#define RADIO_2056_SYN_RESERVED_ADDR5 0x5 -#define RADIO_2056_SYN_RESERVED_ADDR6 0x6 -#define RADIO_2056_SYN_RESERVED_ADDR7 0x7 -#define RADIO_2056_SYN_COM_CTRL 0x8 -#define RADIO_2056_SYN_COM_PU 0x9 -#define RADIO_2056_SYN_COM_OVR 0xa -#define RADIO_2056_SYN_COM_RESET 0xb -#define RADIO_2056_SYN_COM_RCAL 0xc -#define RADIO_2056_SYN_COM_RC_RXLPF 0xd -#define RADIO_2056_SYN_COM_RC_TXLPF 0xe -#define RADIO_2056_SYN_COM_RC_RXHPF 0xf -#define RADIO_2056_SYN_RESERVED_ADDR16 0x10 -#define RADIO_2056_SYN_RESERVED_ADDR17 0x11 -#define RADIO_2056_SYN_RESERVED_ADDR18 0x12 -#define RADIO_2056_SYN_RESERVED_ADDR19 0x13 -#define RADIO_2056_SYN_RESERVED_ADDR20 0x14 -#define RADIO_2056_SYN_RESERVED_ADDR21 0x15 -#define RADIO_2056_SYN_RESERVED_ADDR22 0x16 -#define RADIO_2056_SYN_RESERVED_ADDR23 0x17 -#define RADIO_2056_SYN_RESERVED_ADDR24 0x18 -#define RADIO_2056_SYN_RESERVED_ADDR25 0x19 -#define RADIO_2056_SYN_RESERVED_ADDR26 0x1a -#define RADIO_2056_SYN_RESERVED_ADDR27 0x1b -#define RADIO_2056_SYN_RESERVED_ADDR28 0x1c -#define RADIO_2056_SYN_RESERVED_ADDR29 0x1d -#define RADIO_2056_SYN_RESERVED_ADDR30 0x1e -#define RADIO_2056_SYN_RESERVED_ADDR31 0x1f -#define RADIO_2056_SYN_GPIO_MASTER1 0x20 -#define RADIO_2056_SYN_GPIO_MASTER2 0x21 -#define RADIO_2056_SYN_TOPBIAS_MASTER 0x22 -#define RADIO_2056_SYN_TOPBIAS_RCAL 0x23 -#define RADIO_2056_SYN_AFEREG 0x24 -#define RADIO_2056_SYN_TEMPPROCSENSE 0x25 -#define RADIO_2056_SYN_TEMPPROCSENSEIDAC 0x26 -#define RADIO_2056_SYN_TEMPPROCSENSERCAL 0x27 -#define RADIO_2056_SYN_LPO 0x28 -#define RADIO_2056_SYN_VDDCAL_MASTER 0x29 -#define RADIO_2056_SYN_VDDCAL_IDAC 0x2a -#define RADIO_2056_SYN_VDDCAL_STATUS 0x2b -#define RADIO_2056_SYN_RCAL_MASTER 0x2c -#define RADIO_2056_SYN_RCAL_CODE_OUT 0x2d -#define RADIO_2056_SYN_RCCAL_CTRL0 0x2e -#define RADIO_2056_SYN_RCCAL_CTRL1 0x2f -#define RADIO_2056_SYN_RCCAL_CTRL2 0x30 -#define RADIO_2056_SYN_RCCAL_CTRL3 0x31 -#define RADIO_2056_SYN_RCCAL_CTRL4 0x32 -#define RADIO_2056_SYN_RCCAL_CTRL5 0x33 -#define RADIO_2056_SYN_RCCAL_CTRL6 0x34 -#define RADIO_2056_SYN_RCCAL_CTRL7 0x35 -#define RADIO_2056_SYN_RCCAL_CTRL8 0x36 -#define RADIO_2056_SYN_RCCAL_CTRL9 0x37 -#define RADIO_2056_SYN_RCCAL_CTRL10 0x38 -#define RADIO_2056_SYN_RCCAL_CTRL11 0x39 -#define RADIO_2056_SYN_ZCAL_SPARE1 0x3a -#define RADIO_2056_SYN_ZCAL_SPARE2 0x3b -#define RADIO_2056_SYN_PLL_MAST1 0x3c -#define RADIO_2056_SYN_PLL_MAST2 0x3d -#define RADIO_2056_SYN_PLL_MAST3 0x3e -#define RADIO_2056_SYN_PLL_BIAS_RESET 0x3f -#define RADIO_2056_SYN_PLL_XTAL0 0x40 -#define RADIO_2056_SYN_PLL_XTAL1 0x41 -#define RADIO_2056_SYN_PLL_XTAL3 0x42 -#define RADIO_2056_SYN_PLL_XTAL4 0x43 -#define RADIO_2056_SYN_PLL_XTAL5 0x44 -#define RADIO_2056_SYN_PLL_XTAL6 0x45 -#define RADIO_2056_SYN_PLL_REFDIV 0x46 -#define RADIO_2056_SYN_PLL_PFD 0x47 -#define RADIO_2056_SYN_PLL_CP1 0x48 -#define RADIO_2056_SYN_PLL_CP2 0x49 -#define RADIO_2056_SYN_PLL_CP3 0x4a -#define RADIO_2056_SYN_PLL_LOOPFILTER1 0x4b -#define RADIO_2056_SYN_PLL_LOOPFILTER2 0x4c -#define RADIO_2056_SYN_PLL_LOOPFILTER3 0x4d -#define RADIO_2056_SYN_PLL_LOOPFILTER4 0x4e -#define RADIO_2056_SYN_PLL_LOOPFILTER5 0x4f -#define RADIO_2056_SYN_PLL_MMD1 0x50 -#define RADIO_2056_SYN_PLL_MMD2 0x51 -#define RADIO_2056_SYN_PLL_VCO1 0x52 -#define RADIO_2056_SYN_PLL_VCO2 0x53 -#define RADIO_2056_SYN_PLL_MONITOR1 0x54 -#define RADIO_2056_SYN_PLL_MONITOR2 0x55 -#define RADIO_2056_SYN_PLL_VCOCAL1 0x56 -#define RADIO_2056_SYN_PLL_VCOCAL2 0x57 -#define RADIO_2056_SYN_PLL_VCOCAL4 0x58 -#define RADIO_2056_SYN_PLL_VCOCAL5 0x59 -#define RADIO_2056_SYN_PLL_VCOCAL6 0x5a -#define RADIO_2056_SYN_PLL_VCOCAL7 0x5b -#define RADIO_2056_SYN_PLL_VCOCAL8 0x5c -#define RADIO_2056_SYN_PLL_VCOCAL9 0x5d -#define RADIO_2056_SYN_PLL_VCOCAL10 0x5e -#define RADIO_2056_SYN_PLL_VCOCAL11 0x5f -#define RADIO_2056_SYN_PLL_VCOCAL12 0x60 -#define RADIO_2056_SYN_PLL_VCOCAL13 0x61 -#define RADIO_2056_SYN_PLL_VREG 0x62 -#define RADIO_2056_SYN_PLL_STATUS1 0x63 -#define RADIO_2056_SYN_PLL_STATUS2 0x64 -#define RADIO_2056_SYN_PLL_STATUS3 0x65 -#define RADIO_2056_SYN_LOGEN_PU0 0x66 -#define RADIO_2056_SYN_LOGEN_PU1 0x67 -#define RADIO_2056_SYN_LOGEN_PU2 0x68 -#define RADIO_2056_SYN_LOGEN_PU3 0x69 -#define RADIO_2056_SYN_LOGEN_PU5 0x6a -#define RADIO_2056_SYN_LOGEN_PU6 0x6b -#define RADIO_2056_SYN_LOGEN_PU7 0x6c -#define RADIO_2056_SYN_LOGEN_PU8 0x6d -#define RADIO_2056_SYN_LOGEN_BIAS_RESET 0x6e -#define RADIO_2056_SYN_LOGEN_RCCR1 0x6f -#define RADIO_2056_SYN_LOGEN_VCOBUF1 0x70 -#define RADIO_2056_SYN_LOGEN_MIXER1 0x71 -#define RADIO_2056_SYN_LOGEN_MIXER2 0x72 -#define RADIO_2056_SYN_LOGEN_BUF1 0x73 -#define RADIO_2056_SYN_LOGENBUF2 0x74 -#define RADIO_2056_SYN_LOGEN_BUF3 0x75 -#define RADIO_2056_SYN_LOGEN_BUF4 0x76 -#define RADIO_2056_SYN_LOGEN_DIV1 0x77 -#define RADIO_2056_SYN_LOGEN_DIV2 0x78 -#define RADIO_2056_SYN_LOGEN_DIV3 0x79 -#define RADIO_2056_SYN_LOGEN_ACL1 0x7a -#define RADIO_2056_SYN_LOGEN_ACL2 0x7b -#define RADIO_2056_SYN_LOGEN_ACL3 0x7c -#define RADIO_2056_SYN_LOGEN_ACL4 0x7d -#define RADIO_2056_SYN_LOGEN_ACL5 0x7e -#define RADIO_2056_SYN_LOGEN_ACL6 0x7f -#define RADIO_2056_SYN_LOGEN_ACLOUT 0x80 -#define RADIO_2056_SYN_LOGEN_ACLCAL1 0x81 -#define RADIO_2056_SYN_LOGEN_ACLCAL2 0x82 -#define RADIO_2056_SYN_LOGEN_ACLCAL3 0x83 -#define RADIO_2056_SYN_CALEN 0x84 -#define RADIO_2056_SYN_LOGEN_PEAKDET1 0x85 -#define RADIO_2056_SYN_LOGEN_CORE_ACL_OVR 0x86 -#define RADIO_2056_SYN_LOGEN_RX_DIFF_ACL_OVR 0x87 -#define RADIO_2056_SYN_LOGEN_TX_DIFF_ACL_OVR 0x88 -#define RADIO_2056_SYN_LOGEN_RX_CMOS_ACL_OVR 0x89 -#define RADIO_2056_SYN_LOGEN_TX_CMOS_ACL_OVR 0x8a -#define RADIO_2056_SYN_LOGEN_VCOBUF2 0x8b -#define RADIO_2056_SYN_LOGEN_MIXER3 0x8c -#define RADIO_2056_SYN_LOGEN_BUF5 0x8d -#define RADIO_2056_SYN_LOGEN_BUF6 0x8e -#define RADIO_2056_SYN_LOGEN_CBUFRX1 0x8f -#define RADIO_2056_SYN_LOGEN_CBUFRX2 0x90 -#define RADIO_2056_SYN_LOGEN_CBUFRX3 0x91 -#define RADIO_2056_SYN_LOGEN_CBUFRX4 0x92 -#define RADIO_2056_SYN_LOGEN_CBUFTX1 0x93 -#define RADIO_2056_SYN_LOGEN_CBUFTX2 0x94 -#define RADIO_2056_SYN_LOGEN_CBUFTX3 0x95 -#define RADIO_2056_SYN_LOGEN_CBUFTX4 0x96 -#define RADIO_2056_SYN_LOGEN_CMOSRX1 0x97 -#define RADIO_2056_SYN_LOGEN_CMOSRX2 0x98 -#define RADIO_2056_SYN_LOGEN_CMOSRX3 0x99 -#define RADIO_2056_SYN_LOGEN_CMOSRX4 0x9a -#define RADIO_2056_SYN_LOGEN_CMOSTX1 0x9b -#define RADIO_2056_SYN_LOGEN_CMOSTX2 0x9c -#define RADIO_2056_SYN_LOGEN_CMOSTX3 0x9d -#define RADIO_2056_SYN_LOGEN_CMOSTX4 0x9e -#define RADIO_2056_SYN_LOGEN_VCOBUF2_OVRVAL 0x9f -#define RADIO_2056_SYN_LOGEN_MIXER3_OVRVAL 0xa0 -#define RADIO_2056_SYN_LOGEN_BUF5_OVRVAL 0xa1 -#define RADIO_2056_SYN_LOGEN_BUF6_OVRVAL 0xa2 -#define RADIO_2056_SYN_LOGEN_CBUFRX1_OVRVAL 0xa3 -#define RADIO_2056_SYN_LOGEN_CBUFRX2_OVRVAL 0xa4 -#define RADIO_2056_SYN_LOGEN_CBUFRX3_OVRVAL 0xa5 -#define RADIO_2056_SYN_LOGEN_CBUFRX4_OVRVAL 0xa6 -#define RADIO_2056_SYN_LOGEN_CBUFTX1_OVRVAL 0xa7 -#define RADIO_2056_SYN_LOGEN_CBUFTX2_OVRVAL 0xa8 -#define RADIO_2056_SYN_LOGEN_CBUFTX3_OVRVAL 0xa9 -#define RADIO_2056_SYN_LOGEN_CBUFTX4_OVRVAL 0xaa -#define RADIO_2056_SYN_LOGEN_CMOSRX1_OVRVAL 0xab -#define RADIO_2056_SYN_LOGEN_CMOSRX2_OVRVAL 0xac -#define RADIO_2056_SYN_LOGEN_CMOSRX3_OVRVAL 0xad -#define RADIO_2056_SYN_LOGEN_CMOSRX4_OVRVAL 0xae -#define RADIO_2056_SYN_LOGEN_CMOSTX1_OVRVAL 0xaf -#define RADIO_2056_SYN_LOGEN_CMOSTX2_OVRVAL 0xb0 -#define RADIO_2056_SYN_LOGEN_CMOSTX3_OVRVAL 0xb1 -#define RADIO_2056_SYN_LOGEN_CMOSTX4_OVRVAL 0xb2 -#define RADIO_2056_SYN_LOGEN_ACL_WAITCNT 0xb3 -#define RADIO_2056_SYN_LOGEN_CORE_CALVALID 0xb4 -#define RADIO_2056_SYN_LOGEN_RX_CMOS_CALVALID 0xb5 -#define RADIO_2056_SYN_LOGEN_TX_CMOS_VALID 0xb6 - -#define RADIO_2056_TX_RESERVED_ADDR0 0x0 -#define RADIO_2056_TX_IDCODE 0x1 -#define RADIO_2056_TX_RESERVED_ADDR2 0x2 -#define RADIO_2056_TX_RESERVED_ADDR3 0x3 -#define RADIO_2056_TX_RESERVED_ADDR4 0x4 -#define RADIO_2056_TX_RESERVED_ADDR5 0x5 -#define RADIO_2056_TX_RESERVED_ADDR6 0x6 -#define RADIO_2056_TX_RESERVED_ADDR7 0x7 -#define RADIO_2056_TX_COM_CTRL 0x8 -#define RADIO_2056_TX_COM_PU 0x9 -#define RADIO_2056_TX_COM_OVR 0xa -#define RADIO_2056_TX_COM_RESET 0xb -#define RADIO_2056_TX_COM_RCAL 0xc -#define RADIO_2056_TX_COM_RC_RXLPF 0xd -#define RADIO_2056_TX_COM_RC_TXLPF 0xe -#define RADIO_2056_TX_COM_RC_RXHPF 0xf -#define RADIO_2056_TX_RESERVED_ADDR16 0x10 -#define RADIO_2056_TX_RESERVED_ADDR17 0x11 -#define RADIO_2056_TX_RESERVED_ADDR18 0x12 -#define RADIO_2056_TX_RESERVED_ADDR19 0x13 -#define RADIO_2056_TX_RESERVED_ADDR20 0x14 -#define RADIO_2056_TX_RESERVED_ADDR21 0x15 -#define RADIO_2056_TX_RESERVED_ADDR22 0x16 -#define RADIO_2056_TX_RESERVED_ADDR23 0x17 -#define RADIO_2056_TX_RESERVED_ADDR24 0x18 -#define RADIO_2056_TX_RESERVED_ADDR25 0x19 -#define RADIO_2056_TX_RESERVED_ADDR26 0x1a -#define RADIO_2056_TX_RESERVED_ADDR27 0x1b -#define RADIO_2056_TX_RESERVED_ADDR28 0x1c -#define RADIO_2056_TX_RESERVED_ADDR29 0x1d -#define RADIO_2056_TX_RESERVED_ADDR30 0x1e -#define RADIO_2056_TX_RESERVED_ADDR31 0x1f -#define RADIO_2056_TX_IQCAL_GAIN_BW 0x20 -#define RADIO_2056_TX_LOFT_FINE_I 0x21 -#define RADIO_2056_TX_LOFT_FINE_Q 0x22 -#define RADIO_2056_TX_LOFT_COARSE_I 0x23 -#define RADIO_2056_TX_LOFT_COARSE_Q 0x24 -#define RADIO_2056_TX_TX_COM_MASTER1 0x25 -#define RADIO_2056_TX_TX_COM_MASTER2 0x26 -#define RADIO_2056_TX_RXIQCAL_TXMUX 0x27 -#define RADIO_2056_TX_TX_SSI_MASTER 0x28 -#define RADIO_2056_TX_IQCAL_VCM_HG 0x29 -#define RADIO_2056_TX_IQCAL_IDAC 0x2a -#define RADIO_2056_TX_TSSI_VCM 0x2b -#define RADIO_2056_TX_TX_AMP_DET 0x2c -#define RADIO_2056_TX_TX_SSI_MUX 0x2d -#define RADIO_2056_TX_TSSIA 0x2e -#define RADIO_2056_TX_TSSIG 0x2f -#define RADIO_2056_TX_TSSI_MISC1 0x30 -#define RADIO_2056_TX_TSSI_MISC2 0x31 -#define RADIO_2056_TX_TSSI_MISC3 0x32 -#define RADIO_2056_TX_PA_SPARE1 0x33 -#define RADIO_2056_TX_PA_SPARE2 0x34 -#define RADIO_2056_TX_INTPAA_MASTER 0x35 -#define RADIO_2056_TX_INTPAA_GAIN 0x36 -#define RADIO_2056_TX_INTPAA_BOOST_TUNE 0x37 -#define RADIO_2056_TX_INTPAA_IAUX_STAT 0x38 -#define RADIO_2056_TX_INTPAA_IAUX_DYN 0x39 -#define RADIO_2056_TX_INTPAA_IMAIN_STAT 0x3a -#define RADIO_2056_TX_INTPAA_IMAIN_DYN 0x3b -#define RADIO_2056_TX_INTPAA_CASCBIAS 0x3c -#define RADIO_2056_TX_INTPAA_PASLOPE 0x3d -#define RADIO_2056_TX_INTPAA_PA_MISC 0x3e -#define RADIO_2056_TX_INTPAG_MASTER 0x3f -#define RADIO_2056_TX_INTPAG_GAIN 0x40 -#define RADIO_2056_TX_INTPAG_BOOST_TUNE 0x41 -#define RADIO_2056_TX_INTPAG_IAUX_STAT 0x42 -#define RADIO_2056_TX_INTPAG_IAUX_DYN 0x43 -#define RADIO_2056_TX_INTPAG_IMAIN_STAT 0x44 -#define RADIO_2056_TX_INTPAG_IMAIN_DYN 0x45 -#define RADIO_2056_TX_INTPAG_CASCBIAS 0x46 -#define RADIO_2056_TX_INTPAG_PASLOPE 0x47 -#define RADIO_2056_TX_INTPAG_PA_MISC 0x48 -#define RADIO_2056_TX_PADA_MASTER 0x49 -#define RADIO_2056_TX_PADA_IDAC 0x4a -#define RADIO_2056_TX_PADA_CASCBIAS 0x4b -#define RADIO_2056_TX_PADA_GAIN 0x4c -#define RADIO_2056_TX_PADA_BOOST_TUNE 0x4d -#define RADIO_2056_TX_PADA_SLOPE 0x4e -#define RADIO_2056_TX_PADG_MASTER 0x4f -#define RADIO_2056_TX_PADG_IDAC 0x50 -#define RADIO_2056_TX_PADG_CASCBIAS 0x51 -#define RADIO_2056_TX_PADG_GAIN 0x52 -#define RADIO_2056_TX_PADG_BOOST_TUNE 0x53 -#define RADIO_2056_TX_PADG_SLOPE 0x54 -#define RADIO_2056_TX_PGAA_MASTER 0x55 -#define RADIO_2056_TX_PGAA_IDAC 0x56 -#define RADIO_2056_TX_PGAA_GAIN 0x57 -#define RADIO_2056_TX_PGAA_BOOST_TUNE 0x58 -#define RADIO_2056_TX_PGAA_SLOPE 0x59 -#define RADIO_2056_TX_PGAA_MISC 0x5a -#define RADIO_2056_TX_PGAG_MASTER 0x5b -#define RADIO_2056_TX_PGAG_IDAC 0x5c -#define RADIO_2056_TX_PGAG_GAIN 0x5d -#define RADIO_2056_TX_PGAG_BOOST_TUNE 0x5e -#define RADIO_2056_TX_PGAG_SLOPE 0x5f -#define RADIO_2056_TX_PGAG_MISC 0x60 -#define RADIO_2056_TX_MIXA_MASTER 0x61 -#define RADIO_2056_TX_MIXA_BOOST_TUNE 0x62 -#define RADIO_2056_TX_MIXG 0x63 -#define RADIO_2056_TX_MIXG_BOOST_TUNE 0x64 -#define RADIO_2056_TX_BB_GM_MASTER 0x65 -#define RADIO_2056_TX_GMBB_GM 0x66 -#define RADIO_2056_TX_GMBB_IDAC 0x67 -#define RADIO_2056_TX_TXLPF_MASTER 0x68 -#define RADIO_2056_TX_TXLPF_RCCAL 0x69 -#define RADIO_2056_TX_TXLPF_RCCAL_OFF0 0x6a -#define RADIO_2056_TX_TXLPF_RCCAL_OFF1 0x6b -#define RADIO_2056_TX_TXLPF_RCCAL_OFF2 0x6c -#define RADIO_2056_TX_TXLPF_RCCAL_OFF3 0x6d -#define RADIO_2056_TX_TXLPF_RCCAL_OFF4 0x6e -#define RADIO_2056_TX_TXLPF_RCCAL_OFF5 0x6f -#define RADIO_2056_TX_TXLPF_RCCAL_OFF6 0x70 -#define RADIO_2056_TX_TXLPF_BW 0x71 -#define RADIO_2056_TX_TXLPF_GAIN 0x72 -#define RADIO_2056_TX_TXLPF_IDAC 0x73 -#define RADIO_2056_TX_TXLPF_IDAC_0 0x74 -#define RADIO_2056_TX_TXLPF_IDAC_1 0x75 -#define RADIO_2056_TX_TXLPF_IDAC_2 0x76 -#define RADIO_2056_TX_TXLPF_IDAC_3 0x77 -#define RADIO_2056_TX_TXLPF_IDAC_4 0x78 -#define RADIO_2056_TX_TXLPF_IDAC_5 0x79 -#define RADIO_2056_TX_TXLPF_IDAC_6 0x7a -#define RADIO_2056_TX_TXLPF_OPAMP_IDAC 0x7b -#define RADIO_2056_TX_TXLPF_MISC 0x7c -#define RADIO_2056_TX_TXSPARE1 0x7d -#define RADIO_2056_TX_TXSPARE2 0x7e -#define RADIO_2056_TX_TXSPARE3 0x7f -#define RADIO_2056_TX_TXSPARE4 0x80 -#define RADIO_2056_TX_TXSPARE5 0x81 -#define RADIO_2056_TX_TXSPARE6 0x82 -#define RADIO_2056_TX_TXSPARE7 0x83 -#define RADIO_2056_TX_TXSPARE8 0x84 -#define RADIO_2056_TX_TXSPARE9 0x85 -#define RADIO_2056_TX_TXSPARE10 0x86 -#define RADIO_2056_TX_TXSPARE11 0x87 -#define RADIO_2056_TX_TXSPARE12 0x88 -#define RADIO_2056_TX_TXSPARE13 0x89 -#define RADIO_2056_TX_TXSPARE14 0x8a -#define RADIO_2056_TX_TXSPARE15 0x8b -#define RADIO_2056_TX_TXSPARE16 0x8c -#define RADIO_2056_TX_STATUS_INTPA_GAIN 0x8d -#define RADIO_2056_TX_STATUS_PAD_GAIN 0x8e -#define RADIO_2056_TX_STATUS_PGA_GAIN 0x8f -#define RADIO_2056_TX_STATUS_GM_TXLPF_GAIN 0x90 -#define RADIO_2056_TX_STATUS_TXLPF_BW 0x91 -#define RADIO_2056_TX_STATUS_TXLPF_RC 0x92 -#define RADIO_2056_TX_GMBB_IDAC0 0x93 -#define RADIO_2056_TX_GMBB_IDAC1 0x94 -#define RADIO_2056_TX_GMBB_IDAC2 0x95 -#define RADIO_2056_TX_GMBB_IDAC3 0x96 -#define RADIO_2056_TX_GMBB_IDAC4 0x97 -#define RADIO_2056_TX_GMBB_IDAC5 0x98 -#define RADIO_2056_TX_GMBB_IDAC6 0x99 -#define RADIO_2056_TX_GMBB_IDAC7 0x9a - -#define RADIO_2056_RX_RESERVED_ADDR0 0x0 -#define RADIO_2056_RX_IDCODE 0x1 -#define RADIO_2056_RX_RESERVED_ADDR2 0x2 -#define RADIO_2056_RX_RESERVED_ADDR3 0x3 -#define RADIO_2056_RX_RESERVED_ADDR4 0x4 -#define RADIO_2056_RX_RESERVED_ADDR5 0x5 -#define RADIO_2056_RX_RESERVED_ADDR6 0x6 -#define RADIO_2056_RX_RESERVED_ADDR7 0x7 -#define RADIO_2056_RX_COM_CTRL 0x8 -#define RADIO_2056_RX_COM_PU 0x9 -#define RADIO_2056_RX_COM_OVR 0xa -#define RADIO_2056_RX_COM_RESET 0xb -#define RADIO_2056_RX_COM_RCAL 0xc -#define RADIO_2056_RX_COM_RC_RXLPF 0xd -#define RADIO_2056_RX_COM_RC_TXLPF 0xe -#define RADIO_2056_RX_COM_RC_RXHPF 0xf -#define RADIO_2056_RX_RESERVED_ADDR16 0x10 -#define RADIO_2056_RX_RESERVED_ADDR17 0x11 -#define RADIO_2056_RX_RESERVED_ADDR18 0x12 -#define RADIO_2056_RX_RESERVED_ADDR19 0x13 -#define RADIO_2056_RX_RESERVED_ADDR20 0x14 -#define RADIO_2056_RX_RESERVED_ADDR21 0x15 -#define RADIO_2056_RX_RESERVED_ADDR22 0x16 -#define RADIO_2056_RX_RESERVED_ADDR23 0x17 -#define RADIO_2056_RX_RESERVED_ADDR24 0x18 -#define RADIO_2056_RX_RESERVED_ADDR25 0x19 -#define RADIO_2056_RX_RESERVED_ADDR26 0x1a -#define RADIO_2056_RX_RESERVED_ADDR27 0x1b -#define RADIO_2056_RX_RESERVED_ADDR28 0x1c -#define RADIO_2056_RX_RESERVED_ADDR29 0x1d -#define RADIO_2056_RX_RESERVED_ADDR30 0x1e -#define RADIO_2056_RX_RESERVED_ADDR31 0x1f -#define RADIO_2056_RX_RXIQCAL_RXMUX 0x20 -#define RADIO_2056_RX_RSSI_PU 0x21 -#define RADIO_2056_RX_RSSI_SEL 0x22 -#define RADIO_2056_RX_RSSI_GAIN 0x23 -#define RADIO_2056_RX_RSSI_NB_IDAC 0x24 -#define RADIO_2056_RX_RSSI_WB2I_IDAC_1 0x25 -#define RADIO_2056_RX_RSSI_WB2I_IDAC_2 0x26 -#define RADIO_2056_RX_RSSI_WB2Q_IDAC_1 0x27 -#define RADIO_2056_RX_RSSI_WB2Q_IDAC_2 0x28 -#define RADIO_2056_RX_RSSI_POLE 0x29 -#define RADIO_2056_RX_RSSI_WB1_IDAC 0x2a -#define RADIO_2056_RX_RSSI_MISC 0x2b -#define RADIO_2056_RX_LNAA_MASTER 0x2c -#define RADIO_2056_RX_LNAA_TUNE 0x2d -#define RADIO_2056_RX_LNAA_GAIN 0x2e -#define RADIO_2056_RX_LNA_A_SLOPE 0x2f -#define RADIO_2056_RX_BIASPOLE_LNAA1_IDAC 0x30 -#define RADIO_2056_RX_LNAA2_IDAC 0x31 -#define RADIO_2056_RX_LNA1A_MISC 0x32 -#define RADIO_2056_RX_LNAG_MASTER 0x33 -#define RADIO_2056_RX_LNAG_TUNE 0x34 -#define RADIO_2056_RX_LNAG_GAIN 0x35 -#define RADIO_2056_RX_LNA_G_SLOPE 0x36 -#define RADIO_2056_RX_BIASPOLE_LNAG1_IDAC 0x37 -#define RADIO_2056_RX_LNAG2_IDAC 0x38 -#define RADIO_2056_RX_LNA1G_MISC 0x39 -#define RADIO_2056_RX_MIXA_MASTER 0x3a -#define RADIO_2056_RX_MIXA_VCM 0x3b -#define RADIO_2056_RX_MIXA_CTRLPTAT 0x3c -#define RADIO_2056_RX_MIXA_LOB_BIAS 0x3d -#define RADIO_2056_RX_MIXA_CORE_IDAC 0x3e -#define RADIO_2056_RX_MIXA_CMFB_IDAC 0x3f -#define RADIO_2056_RX_MIXA_BIAS_AUX 0x40 -#define RADIO_2056_RX_MIXA_BIAS_MAIN 0x41 -#define RADIO_2056_RX_MIXA_BIAS_MISC 0x42 -#define RADIO_2056_RX_MIXA_MAST_BIAS 0x43 -#define RADIO_2056_RX_MIXG_MASTER 0x44 -#define RADIO_2056_RX_MIXG_VCM 0x45 -#define RADIO_2056_RX_MIXG_CTRLPTAT 0x46 -#define RADIO_2056_RX_MIXG_LOB_BIAS 0x47 -#define RADIO_2056_RX_MIXG_CORE_IDAC 0x48 -#define RADIO_2056_RX_MIXG_CMFB_IDAC 0x49 -#define RADIO_2056_RX_MIXG_BIAS_AUX 0x4a -#define RADIO_2056_RX_MIXG_BIAS_MAIN 0x4b -#define RADIO_2056_RX_MIXG_BIAS_MISC 0x4c -#define RADIO_2056_RX_MIXG_MAST_BIAS 0x4d -#define RADIO_2056_RX_TIA_MASTER 0x4e -#define RADIO_2056_RX_TIA_IOPAMP 0x4f -#define RADIO_2056_RX_TIA_QOPAMP 0x50 -#define RADIO_2056_RX_TIA_IMISC 0x51 -#define RADIO_2056_RX_TIA_QMISC 0x52 -#define RADIO_2056_RX_TIA_GAIN 0x53 -#define RADIO_2056_RX_TIA_SPARE1 0x54 -#define RADIO_2056_RX_TIA_SPARE2 0x55 -#define RADIO_2056_RX_BB_LPF_MASTER 0x56 -#define RADIO_2056_RX_AACI_MASTER 0x57 -#define RADIO_2056_RX_RXLPF_IDAC 0x58 -#define RADIO_2056_RX_RXLPF_OPAMPBIAS_LOWQ 0x59 -#define RADIO_2056_RX_RXLPF_OPAMPBIAS_HIGHQ 0x5a -#define RADIO_2056_RX_RXLPF_BIAS_DCCANCEL 0x5b -#define RADIO_2056_RX_RXLPF_OUTVCM 0x5c -#define RADIO_2056_RX_RXLPF_INVCM_BODY 0x5d -#define RADIO_2056_RX_RXLPF_CC_OP 0x5e -#define RADIO_2056_RX_RXLPF_GAIN 0x5f -#define RADIO_2056_RX_RXLPF_Q_BW 0x60 -#define RADIO_2056_RX_RXLPF_HP_CORNER_BW 0x61 -#define RADIO_2056_RX_RXLPF_RCCAL_HPC 0x62 -#define RADIO_2056_RX_RXHPF_OFF0 0x63 -#define RADIO_2056_RX_RXHPF_OFF1 0x64 -#define RADIO_2056_RX_RXHPF_OFF2 0x65 -#define RADIO_2056_RX_RXHPF_OFF3 0x66 -#define RADIO_2056_RX_RXHPF_OFF4 0x67 -#define RADIO_2056_RX_RXHPF_OFF5 0x68 -#define RADIO_2056_RX_RXHPF_OFF6 0x69 -#define RADIO_2056_RX_RXHPF_OFF7 0x6a -#define RADIO_2056_RX_RXLPF_RCCAL_LPC 0x6b -#define RADIO_2056_RX_RXLPF_OFF_0 0x6c -#define RADIO_2056_RX_RXLPF_OFF_1 0x6d -#define RADIO_2056_RX_RXLPF_OFF_2 0x6e -#define RADIO_2056_RX_RXLPF_OFF_3 0x6f -#define RADIO_2056_RX_RXLPF_OFF_4 0x70 -#define RADIO_2056_RX_UNUSED 0x71 -#define RADIO_2056_RX_VGA_MASTER 0x72 -#define RADIO_2056_RX_VGA_BIAS 0x73 -#define RADIO_2056_RX_VGA_BIAS_DCCANCEL 0x74 -#define RADIO_2056_RX_VGA_GAIN 0x75 -#define RADIO_2056_RX_VGA_HP_CORNER_BW 0x76 -#define RADIO_2056_RX_VGABUF_BIAS 0x77 -#define RADIO_2056_RX_VGABUF_GAIN_BW 0x78 -#define RADIO_2056_RX_TXFBMIX_A 0x79 -#define RADIO_2056_RX_TXFBMIX_G 0x7a -#define RADIO_2056_RX_RXSPARE1 0x7b -#define RADIO_2056_RX_RXSPARE2 0x7c -#define RADIO_2056_RX_RXSPARE3 0x7d -#define RADIO_2056_RX_RXSPARE4 0x7e -#define RADIO_2056_RX_RXSPARE5 0x7f -#define RADIO_2056_RX_RXSPARE6 0x80 -#define RADIO_2056_RX_RXSPARE7 0x81 -#define RADIO_2056_RX_RXSPARE8 0x82 -#define RADIO_2056_RX_RXSPARE9 0x83 -#define RADIO_2056_RX_RXSPARE10 0x84 -#define RADIO_2056_RX_RXSPARE11 0x85 -#define RADIO_2056_RX_RXSPARE12 0x86 -#define RADIO_2056_RX_RXSPARE13 0x87 -#define RADIO_2056_RX_RXSPARE14 0x88 -#define RADIO_2056_RX_RXSPARE15 0x89 -#define RADIO_2056_RX_RXSPARE16 0x8a -#define RADIO_2056_RX_STATUS_LNAA_GAIN 0x8b -#define RADIO_2056_RX_STATUS_LNAG_GAIN 0x8c -#define RADIO_2056_RX_STATUS_MIXTIA_GAIN 0x8d -#define RADIO_2056_RX_STATUS_RXLPF_GAIN 0x8e -#define RADIO_2056_RX_STATUS_VGA_BUF_GAIN 0x8f -#define RADIO_2056_RX_STATUS_RXLPF_Q 0x90 -#define RADIO_2056_RX_STATUS_RXLPF_BUF_BW 0x91 -#define RADIO_2056_RX_STATUS_RXLPF_VGA_HPC 0x92 -#define RADIO_2056_RX_STATUS_RXLPF_RC 0x93 -#define RADIO_2056_RX_STATUS_HPC_RC 0x94 - -#define RADIO_2056_LNA1_A_PU 0x01 -#define RADIO_2056_LNA2_A_PU 0x02 -#define RADIO_2056_LNA1_G_PU 0x01 -#define RADIO_2056_LNA2_G_PU 0x02 -#define RADIO_2056_MIXA_PU_I 0x01 -#define RADIO_2056_MIXA_PU_Q 0x02 -#define RADIO_2056_MIXA_PU_GM 0x10 -#define RADIO_2056_MIXG_PU_I 0x01 -#define RADIO_2056_MIXG_PU_Q 0x02 -#define RADIO_2056_MIXG_PU_GM 0x10 -#define RADIO_2056_TIA_PU 0x01 -#define RADIO_2056_BB_LPF_PU 0x20 -#define RADIO_2056_W1_PU 0x02 -#define RADIO_2056_W2_PU 0x04 -#define RADIO_2056_NB_PU 0x08 -#define RADIO_2056_RSSI_W1_SEL 0x02 -#define RADIO_2056_RSSI_W2_SEL 0x04 -#define RADIO_2056_RSSI_NB_SEL 0x08 -#define RADIO_2056_VCM_MASK 0x1c -#define RADIO_2056_RSSI_VCM_SHIFT 0x02 - -#define RADIO_2057_DACBUF_VINCM_CORE0 0x0 -#define RADIO_2057_IDCODE 0x1 -#define RADIO_2057_RCCAL_MASTER 0x2 -#define RADIO_2057_RCCAL_CAP_SIZE 0x3 -#define RADIO_2057_RCAL_CONFIG 0x4 -#define RADIO_2057_GPAIO_CONFIG 0x5 -#define RADIO_2057_GPAIO_SEL1 0x6 -#define RADIO_2057_GPAIO_SEL0 0x7 -#define RADIO_2057_CLPO_CONFIG 0x8 -#define RADIO_2057_BANDGAP_CONFIG 0x9 -#define RADIO_2057_BANDGAP_RCAL_TRIM 0xa -#define RADIO_2057_AFEREG_CONFIG 0xb -#define RADIO_2057_TEMPSENSE_CONFIG 0xc -#define RADIO_2057_XTAL_CONFIG1 0xd -#define RADIO_2057_XTAL_ICORE_SIZE 0xe -#define RADIO_2057_XTAL_BUF_SIZE 0xf -#define RADIO_2057_XTAL_PULLCAP_SIZE 0x10 -#define RADIO_2057_RFPLL_MASTER 0x11 -#define RADIO_2057_VCOMONITOR_VTH_L 0x12 -#define RADIO_2057_VCOMONITOR_VTH_H 0x13 -#define RADIO_2057_VCOCAL_BIASRESET_RFPLLREG_VOUT 0x14 -#define RADIO_2057_VCO_VARCSIZE_IDAC 0x15 -#define RADIO_2057_VCOCAL_COUNTVAL0 0x16 -#define RADIO_2057_VCOCAL_COUNTVAL1 0x17 -#define RADIO_2057_VCOCAL_INTCLK_COUNT 0x18 -#define RADIO_2057_VCOCAL_MASTER 0x19 -#define RADIO_2057_VCOCAL_NUMCAPCHANGE 0x1a -#define RADIO_2057_VCOCAL_WINSIZE 0x1b -#define RADIO_2057_VCOCAL_DELAY_AFTER_REFRESH 0x1c -#define RADIO_2057_VCOCAL_DELAY_AFTER_CLOSELOOP 0x1d -#define RADIO_2057_VCOCAL_DELAY_AFTER_OPENLOOP 0x1e -#define RADIO_2057_VCOCAL_DELAY_BEFORE_OPENLOOP 0x1f -#define RADIO_2057_VCO_FORCECAPEN_FORCECAP1 0x20 -#define RADIO_2057_VCO_FORCECAP0 0x21 -#define RADIO_2057_RFPLL_REFMASTER_SPAREXTALSIZE 0x22 -#define RADIO_2057_RFPLL_PFD_RESET_PW 0x23 -#define RADIO_2057_RFPLL_LOOPFILTER_R2 0x24 -#define RADIO_2057_RFPLL_LOOPFILTER_R1 0x25 -#define RADIO_2057_RFPLL_LOOPFILTER_C3 0x26 -#define RADIO_2057_RFPLL_LOOPFILTER_C2 0x27 -#define RADIO_2057_RFPLL_LOOPFILTER_C1 0x28 -#define RADIO_2057_CP_KPD_IDAC 0x29 -#define RADIO_2057_RFPLL_IDACS 0x2a -#define RADIO_2057_RFPLL_MISC_EN 0x2b -#define RADIO_2057_RFPLL_MMD0 0x2c -#define RADIO_2057_RFPLL_MMD1 0x2d -#define RADIO_2057_RFPLL_MISC_CAL_RESETN 0x2e -#define RADIO_2057_JTAGXTAL_SIZE_CPBIAS_FILTRES 0x2f -#define RADIO_2057_VCO_ALCREF_BBPLLXTAL_SIZE 0x30 -#define RADIO_2057_VCOCAL_READCAP0 0x31 -#define RADIO_2057_VCOCAL_READCAP1 0x32 -#define RADIO_2057_VCOCAL_STATUS 0x33 -#define RADIO_2057_LOGEN_PUS 0x34 -#define RADIO_2057_LOGEN_PTAT_RESETS 0x35 -#define RADIO_2057_VCOBUF_IDACS 0x36 -#define RADIO_2057_VCOBUF_TUNE 0x37 -#define RADIO_2057_CMOSBUF_TX2GQ_IDACS 0x38 -#define RADIO_2057_CMOSBUF_TX2GI_IDACS 0x39 -#define RADIO_2057_CMOSBUF_TX5GQ_IDACS 0x3a -#define RADIO_2057_CMOSBUF_TX5GI_IDACS 0x3b -#define RADIO_2057_CMOSBUF_RX2GQ_IDACS 0x3c -#define RADIO_2057_CMOSBUF_RX2GI_IDACS 0x3d -#define RADIO_2057_CMOSBUF_RX5GQ_IDACS 0x3e -#define RADIO_2057_CMOSBUF_RX5GI_IDACS 0x3f -#define RADIO_2057_LOGEN_MX2G_IDACS 0x40 -#define RADIO_2057_LOGEN_MX2G_TUNE 0x41 -#define RADIO_2057_LOGEN_MX5G_IDACS 0x42 -#define RADIO_2057_LOGEN_MX5G_TUNE 0x43 -#define RADIO_2057_LOGEN_MX5G_RCCR 0x44 -#define RADIO_2057_LOGEN_INDBUF2G_IDAC 0x45 -#define RADIO_2057_LOGEN_INDBUF2G_IBOOST 0x46 -#define RADIO_2057_LOGEN_INDBUF2G_TUNE 0x47 -#define RADIO_2057_LOGEN_INDBUF5G_IDAC 0x48 -#define RADIO_2057_LOGEN_INDBUF5G_IBOOST 0x49 -#define RADIO_2057_LOGEN_INDBUF5G_TUNE 0x4a -#define RADIO_2057_CMOSBUF_TX_RCCR 0x4b -#define RADIO_2057_CMOSBUF_RX_RCCR 0x4c -#define RADIO_2057_LOGEN_SEL_PKDET 0x4d -#define RADIO_2057_CMOSBUF_SHAREIQ_PTAT 0x4e -#define RADIO_2057_RXTXBIAS_CONFIG_CORE0 0x4f -#define RADIO_2057_TXGM_TXRF_PUS_CORE0 0x50 -#define RADIO_2057_TXGM_IDAC_BLEED_CORE0 0x51 -#define RADIO_2057_TXGM_GAIN_CORE0 0x56 -#define RADIO_2057_TXGM2G_PKDET_PUS_CORE0 0x57 -#define RADIO_2057_PAD2G_PTATS_CORE0 0x58 -#define RADIO_2057_PAD2G_IDACS_CORE0 0x59 -#define RADIO_2057_PAD2G_BOOST_PU_CORE0 0x5a -#define RADIO_2057_PAD2G_CASCV_GAIN_CORE0 0x5b -#define RADIO_2057_TXMIX2G_TUNE_BOOST_PU_CORE0 0x5c -#define RADIO_2057_TXMIX2G_LODC_CORE0 0x5d -#define RADIO_2057_PAD2G_TUNE_PUS_CORE0 0x5e -#define RADIO_2057_IPA2G_GAIN_CORE0 0x5f -#define RADIO_2057_TSSI2G_SPARE1_CORE0 0x60 -#define RADIO_2057_TSSI2G_SPARE2_CORE0 0x61 -#define RADIO_2057_IPA2G_TUNEV_CASCV_PTAT_CORE0 0x62 -#define RADIO_2057_IPA2G_IMAIN_CORE0 0x63 -#define RADIO_2057_IPA2G_CASCONV_CORE0 0x64 -#define RADIO_2057_IPA2G_CASCOFFV_CORE0 0x65 -#define RADIO_2057_IPA2G_BIAS_FILTER_CORE0 0x66 -#define RADIO_2057_TX5G_PKDET_CORE0 0x69 -#define RADIO_2057_PGA_PTAT_TXGM5G_PU_CORE0 0x6a -#define RADIO_2057_PAD5G_PTATS1_CORE0 0x6b -#define RADIO_2057_PAD5G_CLASS_PTATS2_CORE0 0x6c -#define RADIO_2057_PGA_BOOSTPTAT_IMAIN_CORE0 0x6d -#define RADIO_2057_PAD5G_CASCV_IMAIN_CORE0 0x6e -#define RADIO_2057_TXMIX5G_IBOOST_PAD_IAUX_CORE0 0x6f -#define RADIO_2057_PGA_BOOST_TUNE_CORE0 0x70 -#define RADIO_2057_PGA_GAIN_CORE0 0x71 -#define RADIO_2057_PAD5G_CASCOFFV_GAIN_PUS_CORE0 0x72 -#define RADIO_2057_TXMIX5G_BOOST_TUNE_CORE0 0x73 -#define RADIO_2057_PAD5G_TUNE_MISC_PUS_CORE0 0x74 -#define RADIO_2057_IPA5G_IAUX_CORE0 0x75 -#define RADIO_2057_IPA5G_GAIN_CORE0 0x76 -#define RADIO_2057_TSSI5G_SPARE1_CORE0 0x77 -#define RADIO_2057_TSSI5G_SPARE2_CORE0 0x78 -#define RADIO_2057_IPA5G_CASCOFFV_PU_CORE0 0x79 -#define RADIO_2057_IPA5G_PTAT_CORE0 0x7a -#define RADIO_2057_IPA5G_IMAIN_CORE0 0x7b -#define RADIO_2057_IPA5G_CASCONV_CORE0 0x7c -#define RADIO_2057_IPA5G_BIAS_FILTER_CORE0 0x7d -#define RADIO_2057_PAD_BIAS_FILTER_BWS_CORE0 0x80 -#define RADIO_2057_TR2G_CONFIG1_CORE0_NU 0x81 -#define RADIO_2057_TR2G_CONFIG2_CORE0_NU 0x82 -#define RADIO_2057_LNA5G_RFEN_CORE0 0x83 -#define RADIO_2057_TR5G_CONFIG2_CORE0_NU 0x84 -#define RADIO_2057_RXRFBIAS_IBOOST_PU_CORE0 0x85 -#define RADIO_2057_RXRF_IABAND_RXGM_IMAIN_PTAT_CORE0 0x86 -#define RADIO_2057_RXGM_CMFBITAIL_AUXPTAT_CORE0 0x87 -#define RADIO_2057_RXMIX_ICORE_RXGM_IAUX_CORE0 0x88 -#define RADIO_2057_RXMIX_CMFBITAIL_PU_CORE0 0x89 -#define RADIO_2057_LNA2_IMAIN_PTAT_PU_CORE0 0x8a -#define RADIO_2057_LNA2_IAUX_PTAT_CORE0 0x8b -#define RADIO_2057_LNA1_IMAIN_PTAT_PU_CORE0 0x8c -#define RADIO_2057_LNA15G_INPUT_MATCH_TUNE_CORE0 0x8d -#define RADIO_2057_RXRFBIAS_BANDSEL_CORE0 0x8e -#define RADIO_2057_TIA_CONFIG_CORE0 0x8f -#define RADIO_2057_TIA_IQGAIN_CORE0 0x90 -#define RADIO_2057_TIA_IBIAS2_CORE0 0x91 -#define RADIO_2057_TIA_IBIAS1_CORE0 0x92 -#define RADIO_2057_TIA_SPARE_Q_CORE0 0x93 -#define RADIO_2057_TIA_SPARE_I_CORE0 0x94 -#define RADIO_2057_RXMIX2G_PUS_CORE0 0x95 -#define RADIO_2057_RXMIX2G_VCMREFS_CORE0 0x96 -#define RADIO_2057_RXMIX2G_LODC_QI_CORE0 0x97 -#define RADIO_2057_W12G_BW_LNA2G_PUS_CORE0 0x98 -#define RADIO_2057_LNA2G_GAIN_CORE0 0x99 -#define RADIO_2057_LNA2G_TUNE_CORE0 0x9a -#define RADIO_2057_RXMIX5G_PUS_CORE0 0x9b -#define RADIO_2057_RXMIX5G_VCMREFS_CORE0 0x9c -#define RADIO_2057_RXMIX5G_LODC_QI_CORE0 0x9d -#define RADIO_2057_W15G_BW_LNA5G_PUS_CORE0 0x9e -#define RADIO_2057_LNA5G_GAIN_CORE0 0x9f -#define RADIO_2057_LNA5G_TUNE_CORE0 0xa0 -#define RADIO_2057_LPFSEL_TXRX_RXBB_PUS_CORE0 0xa1 -#define RADIO_2057_RXBB_BIAS_MASTER_CORE0 0xa2 -#define RADIO_2057_RXBB_VGABUF_IDACS_CORE0 0xa3 -#define RADIO_2057_LPF_VCMREF_TXBUF_VCMREF_CORE0 0xa4 -#define RADIO_2057_TXBUF_VINCM_CORE0 0xa5 -#define RADIO_2057_TXBUF_IDACS_CORE0 0xa6 -#define RADIO_2057_LPF_RESP_RXBUF_BW_CORE0 0xa7 -#define RADIO_2057_RXBB_CC_CORE0 0xa8 -#define RADIO_2057_RXBB_SPARE3_CORE0 0xa9 -#define RADIO_2057_RXBB_RCCAL_HPC_CORE0 0xaa -#define RADIO_2057_LPF_IDACS_CORE0 0xab -#define RADIO_2057_LPFBYP_DCLOOP_BYP_IDAC_CORE0 0xac -#define RADIO_2057_TXBUF_GAIN_CORE0 0xad -#define RADIO_2057_AFELOOPBACK_AACI_RESP_CORE0 0xae -#define RADIO_2057_RXBUF_DEGEN_CORE0 0xaf -#define RADIO_2057_RXBB_SPARE2_CORE0 0xb0 -#define RADIO_2057_RXBB_SPARE1_CORE0 0xb1 -#define RADIO_2057_RSSI_MASTER_CORE0 0xb2 -#define RADIO_2057_W2_MASTER_CORE0 0xb3 -#define RADIO_2057_NB_MASTER_CORE0 0xb4 -#define RADIO_2057_W2_IDACS0_Q_CORE0 0xb5 -#define RADIO_2057_W2_IDACS1_Q_CORE0 0xb6 -#define RADIO_2057_W2_IDACS0_I_CORE0 0xb7 -#define RADIO_2057_W2_IDACS1_I_CORE0 0xb8 -#define RADIO_2057_RSSI_GPAIOSEL_W1_IDACS_CORE0 0xb9 -#define RADIO_2057_NB_IDACS_Q_CORE0 0xba -#define RADIO_2057_NB_IDACS_I_CORE0 0xbb -#define RADIO_2057_BACKUP4_CORE0 0xc1 -#define RADIO_2057_BACKUP3_CORE0 0xc2 -#define RADIO_2057_BACKUP2_CORE0 0xc3 -#define RADIO_2057_BACKUP1_CORE0 0xc4 -#define RADIO_2057_SPARE16_CORE0 0xc5 -#define RADIO_2057_SPARE15_CORE0 0xc6 -#define RADIO_2057_SPARE14_CORE0 0xc7 -#define RADIO_2057_SPARE13_CORE0 0xc8 -#define RADIO_2057_SPARE12_CORE0 0xc9 -#define RADIO_2057_SPARE11_CORE0 0xca -#define RADIO_2057_TX2G_BIAS_RESETS_CORE0 0xcb -#define RADIO_2057_TX5G_BIAS_RESETS_CORE0 0xcc -#define RADIO_2057_IQTEST_SEL_PU 0xcd -#define RADIO_2057_XTAL_CONFIG2 0xce -#define RADIO_2057_BUFS_MISC_LPFBW_CORE0 0xcf -#define RADIO_2057_TXLPF_RCCAL_CORE0 0xd0 -#define RADIO_2057_RXBB_GPAIOSEL_RXLPF_RCCAL_CORE0 0xd1 -#define RADIO_2057_LPF_GAIN_CORE0 0xd2 -#define RADIO_2057_DACBUF_IDACS_BW_CORE0 0xd3 -#define RADIO_2057_RXTXBIAS_CONFIG_CORE1 0xd4 -#define RADIO_2057_TXGM_TXRF_PUS_CORE1 0xd5 -#define RADIO_2057_TXGM_IDAC_BLEED_CORE1 0xd6 -#define RADIO_2057_TXGM_GAIN_CORE1 0xdb -#define RADIO_2057_TXGM2G_PKDET_PUS_CORE1 0xdc -#define RADIO_2057_PAD2G_PTATS_CORE1 0xdd -#define RADIO_2057_PAD2G_IDACS_CORE1 0xde -#define RADIO_2057_PAD2G_BOOST_PU_CORE1 0xdf -#define RADIO_2057_PAD2G_CASCV_GAIN_CORE1 0xe0 -#define RADIO_2057_TXMIX2G_TUNE_BOOST_PU_CORE1 0xe1 -#define RADIO_2057_TXMIX2G_LODC_CORE1 0xe2 -#define RADIO_2057_PAD2G_TUNE_PUS_CORE1 0xe3 -#define RADIO_2057_IPA2G_GAIN_CORE1 0xe4 -#define RADIO_2057_TSSI2G_SPARE1_CORE1 0xe5 -#define RADIO_2057_TSSI2G_SPARE2_CORE1 0xe6 -#define RADIO_2057_IPA2G_TUNEV_CASCV_PTAT_CORE1 0xe7 -#define RADIO_2057_IPA2G_IMAIN_CORE1 0xe8 -#define RADIO_2057_IPA2G_CASCONV_CORE1 0xe9 -#define RADIO_2057_IPA2G_CASCOFFV_CORE1 0xea -#define RADIO_2057_IPA2G_BIAS_FILTER_CORE1 0xeb -#define RADIO_2057_TX5G_PKDET_CORE1 0xee -#define RADIO_2057_PGA_PTAT_TXGM5G_PU_CORE1 0xef -#define RADIO_2057_PAD5G_PTATS1_CORE1 0xf0 -#define RADIO_2057_PAD5G_CLASS_PTATS2_CORE1 0xf1 -#define RADIO_2057_PGA_BOOSTPTAT_IMAIN_CORE1 0xf2 -#define RADIO_2057_PAD5G_CASCV_IMAIN_CORE1 0xf3 -#define RADIO_2057_TXMIX5G_IBOOST_PAD_IAUX_CORE1 0xf4 -#define RADIO_2057_PGA_BOOST_TUNE_CORE1 0xf5 -#define RADIO_2057_PGA_GAIN_CORE1 0xf6 -#define RADIO_2057_PAD5G_CASCOFFV_GAIN_PUS_CORE1 0xf7 -#define RADIO_2057_TXMIX5G_BOOST_TUNE_CORE1 0xf8 -#define RADIO_2057_PAD5G_TUNE_MISC_PUS_CORE1 0xf9 -#define RADIO_2057_IPA5G_IAUX_CORE1 0xfa -#define RADIO_2057_IPA5G_GAIN_CORE1 0xfb -#define RADIO_2057_TSSI5G_SPARE1_CORE1 0xfc -#define RADIO_2057_TSSI5G_SPARE2_CORE1 0xfd -#define RADIO_2057_IPA5G_CASCOFFV_PU_CORE1 0xfe -#define RADIO_2057_IPA5G_PTAT_CORE1 0xff -#define RADIO_2057_IPA5G_IMAIN_CORE1 0x100 -#define RADIO_2057_IPA5G_CASCONV_CORE1 0x101 -#define RADIO_2057_IPA5G_BIAS_FILTER_CORE1 0x102 -#define RADIO_2057_PAD_BIAS_FILTER_BWS_CORE1 0x105 -#define RADIO_2057_TR2G_CONFIG1_CORE1_NU 0x106 -#define RADIO_2057_TR2G_CONFIG2_CORE1_NU 0x107 -#define RADIO_2057_LNA5G_RFEN_CORE1 0x108 -#define RADIO_2057_TR5G_CONFIG2_CORE1_NU 0x109 -#define RADIO_2057_RXRFBIAS_IBOOST_PU_CORE1 0x10a -#define RADIO_2057_RXRF_IABAND_RXGM_IMAIN_PTAT_CORE1 0x10b -#define RADIO_2057_RXGM_CMFBITAIL_AUXPTAT_CORE1 0x10c -#define RADIO_2057_RXMIX_ICORE_RXGM_IAUX_CORE1 0x10d -#define RADIO_2057_RXMIX_CMFBITAIL_PU_CORE1 0x10e -#define RADIO_2057_LNA2_IMAIN_PTAT_PU_CORE1 0x10f -#define RADIO_2057_LNA2_IAUX_PTAT_CORE1 0x110 -#define RADIO_2057_LNA1_IMAIN_PTAT_PU_CORE1 0x111 -#define RADIO_2057_LNA15G_INPUT_MATCH_TUNE_CORE1 0x112 -#define RADIO_2057_RXRFBIAS_BANDSEL_CORE1 0x113 -#define RADIO_2057_TIA_CONFIG_CORE1 0x114 -#define RADIO_2057_TIA_IQGAIN_CORE1 0x115 -#define RADIO_2057_TIA_IBIAS2_CORE1 0x116 -#define RADIO_2057_TIA_IBIAS1_CORE1 0x117 -#define RADIO_2057_TIA_SPARE_Q_CORE1 0x118 -#define RADIO_2057_TIA_SPARE_I_CORE1 0x119 -#define RADIO_2057_RXMIX2G_PUS_CORE1 0x11a -#define RADIO_2057_RXMIX2G_VCMREFS_CORE1 0x11b -#define RADIO_2057_RXMIX2G_LODC_QI_CORE1 0x11c -#define RADIO_2057_W12G_BW_LNA2G_PUS_CORE1 0x11d -#define RADIO_2057_LNA2G_GAIN_CORE1 0x11e -#define RADIO_2057_LNA2G_TUNE_CORE1 0x11f -#define RADIO_2057_RXMIX5G_PUS_CORE1 0x120 -#define RADIO_2057_RXMIX5G_VCMREFS_CORE1 0x121 -#define RADIO_2057_RXMIX5G_LODC_QI_CORE1 0x122 -#define RADIO_2057_W15G_BW_LNA5G_PUS_CORE1 0x123 -#define RADIO_2057_LNA5G_GAIN_CORE1 0x124 -#define RADIO_2057_LNA5G_TUNE_CORE1 0x125 -#define RADIO_2057_LPFSEL_TXRX_RXBB_PUS_CORE1 0x126 -#define RADIO_2057_RXBB_BIAS_MASTER_CORE1 0x127 -#define RADIO_2057_RXBB_VGABUF_IDACS_CORE1 0x128 -#define RADIO_2057_LPF_VCMREF_TXBUF_VCMREF_CORE1 0x129 -#define RADIO_2057_TXBUF_VINCM_CORE1 0x12a -#define RADIO_2057_TXBUF_IDACS_CORE1 0x12b -#define RADIO_2057_LPF_RESP_RXBUF_BW_CORE1 0x12c -#define RADIO_2057_RXBB_CC_CORE1 0x12d -#define RADIO_2057_RXBB_SPARE3_CORE1 0x12e -#define RADIO_2057_RXBB_RCCAL_HPC_CORE1 0x12f -#define RADIO_2057_LPF_IDACS_CORE1 0x130 -#define RADIO_2057_LPFBYP_DCLOOP_BYP_IDAC_CORE1 0x131 -#define RADIO_2057_TXBUF_GAIN_CORE1 0x132 -#define RADIO_2057_AFELOOPBACK_AACI_RESP_CORE1 0x133 -#define RADIO_2057_RXBUF_DEGEN_CORE1 0x134 -#define RADIO_2057_RXBB_SPARE2_CORE1 0x135 -#define RADIO_2057_RXBB_SPARE1_CORE1 0x136 -#define RADIO_2057_RSSI_MASTER_CORE1 0x137 -#define RADIO_2057_W2_MASTER_CORE1 0x138 -#define RADIO_2057_NB_MASTER_CORE1 0x139 -#define RADIO_2057_W2_IDACS0_Q_CORE1 0x13a -#define RADIO_2057_W2_IDACS1_Q_CORE1 0x13b -#define RADIO_2057_W2_IDACS0_I_CORE1 0x13c -#define RADIO_2057_W2_IDACS1_I_CORE1 0x13d -#define RADIO_2057_RSSI_GPAIOSEL_W1_IDACS_CORE1 0x13e -#define RADIO_2057_NB_IDACS_Q_CORE1 0x13f -#define RADIO_2057_NB_IDACS_I_CORE1 0x140 -#define RADIO_2057_BACKUP4_CORE1 0x146 -#define RADIO_2057_BACKUP3_CORE1 0x147 -#define RADIO_2057_BACKUP2_CORE1 0x148 -#define RADIO_2057_BACKUP1_CORE1 0x149 -#define RADIO_2057_SPARE16_CORE1 0x14a -#define RADIO_2057_SPARE15_CORE1 0x14b -#define RADIO_2057_SPARE14_CORE1 0x14c -#define RADIO_2057_SPARE13_CORE1 0x14d -#define RADIO_2057_SPARE12_CORE1 0x14e -#define RADIO_2057_SPARE11_CORE1 0x14f -#define RADIO_2057_TX2G_BIAS_RESETS_CORE1 0x150 -#define RADIO_2057_TX5G_BIAS_RESETS_CORE1 0x151 -#define RADIO_2057_SPARE8_CORE1 0x152 -#define RADIO_2057_SPARE7_CORE1 0x153 -#define RADIO_2057_BUFS_MISC_LPFBW_CORE1 0x154 -#define RADIO_2057_TXLPF_RCCAL_CORE1 0x155 -#define RADIO_2057_RXBB_GPAIOSEL_RXLPF_RCCAL_CORE1 0x156 -#define RADIO_2057_LPF_GAIN_CORE1 0x157 -#define RADIO_2057_DACBUF_IDACS_BW_CORE1 0x158 -#define RADIO_2057_DACBUF_VINCM_CORE1 0x159 -#define RADIO_2057_RCCAL_START_R1_Q1_P1 0x15a -#define RADIO_2057_RCCAL_X1 0x15b -#define RADIO_2057_RCCAL_TRC0 0x15c -#define RADIO_2057_RCCAL_TRC1 0x15d -#define RADIO_2057_RCCAL_DONE_OSCCAP 0x15e -#define RADIO_2057_RCCAL_N0_0 0x15f -#define RADIO_2057_RCCAL_N0_1 0x160 -#define RADIO_2057_RCCAL_N1_0 0x161 -#define RADIO_2057_RCCAL_N1_1 0x162 -#define RADIO_2057_RCAL_STATUS 0x163 -#define RADIO_2057_XTALPUOVR_PINCTRL 0x164 -#define RADIO_2057_OVR_REG0 0x165 -#define RADIO_2057_OVR_REG1 0x166 -#define RADIO_2057_OVR_REG2 0x167 -#define RADIO_2057_OVR_REG3 0x168 -#define RADIO_2057_OVR_REG4 0x169 -#define RADIO_2057_RCCAL_SCAP_VAL 0x16a -#define RADIO_2057_RCCAL_BCAP_VAL 0x16b -#define RADIO_2057_RCCAL_HPC_VAL 0x16c -#define RADIO_2057_RCCAL_OVERRIDES 0x16d -#define RADIO_2057_TX0_IQCAL_GAIN_BW 0x170 -#define RADIO_2057_TX0_LOFT_FINE_I 0x171 -#define RADIO_2057_TX0_LOFT_FINE_Q 0x172 -#define RADIO_2057_TX0_LOFT_COARSE_I 0x173 -#define RADIO_2057_TX0_LOFT_COARSE_Q 0x174 -#define RADIO_2057_TX0_TX_SSI_MASTER 0x175 -#define RADIO_2057_TX0_IQCAL_VCM_HG 0x176 -#define RADIO_2057_TX0_IQCAL_IDAC 0x177 -#define RADIO_2057_TX0_TSSI_VCM 0x178 -#define RADIO_2057_TX0_TX_SSI_MUX 0x179 -#define RADIO_2057_TX0_TSSIA 0x17a -#define RADIO_2057_TX0_TSSIG 0x17b -#define RADIO_2057_TX0_TSSI_MISC1 0x17c -#define RADIO_2057_TX0_TXRXCOUPLE_2G_ATTEN 0x17d -#define RADIO_2057_TX0_TXRXCOUPLE_2G_PWRUP 0x17e -#define RADIO_2057_TX0_TXRXCOUPLE_5G_ATTEN 0x17f -#define RADIO_2057_TX0_TXRXCOUPLE_5G_PWRUP 0x180 -#define RADIO_2057_TX1_IQCAL_GAIN_BW 0x190 -#define RADIO_2057_TX1_LOFT_FINE_I 0x191 -#define RADIO_2057_TX1_LOFT_FINE_Q 0x192 -#define RADIO_2057_TX1_LOFT_COARSE_I 0x193 -#define RADIO_2057_TX1_LOFT_COARSE_Q 0x194 -#define RADIO_2057_TX1_TX_SSI_MASTER 0x195 -#define RADIO_2057_TX1_IQCAL_VCM_HG 0x196 -#define RADIO_2057_TX1_IQCAL_IDAC 0x197 -#define RADIO_2057_TX1_TSSI_VCM 0x198 -#define RADIO_2057_TX1_TX_SSI_MUX 0x199 -#define RADIO_2057_TX1_TSSIA 0x19a -#define RADIO_2057_TX1_TSSIG 0x19b -#define RADIO_2057_TX1_TSSI_MISC1 0x19c -#define RADIO_2057_TX1_TXRXCOUPLE_2G_ATTEN 0x19d -#define RADIO_2057_TX1_TXRXCOUPLE_2G_PWRUP 0x19e -#define RADIO_2057_TX1_TXRXCOUPLE_5G_ATTEN 0x19f -#define RADIO_2057_TX1_TXRXCOUPLE_5G_PWRUP 0x1a0 -#define RADIO_2057_AFE_VCM_CAL_MASTER_CORE0 0x1a1 -#define RADIO_2057_AFE_SET_VCM_I_CORE0 0x1a2 -#define RADIO_2057_AFE_SET_VCM_Q_CORE0 0x1a3 -#define RADIO_2057_AFE_STATUS_VCM_IQADC_CORE0 0x1a4 -#define RADIO_2057_AFE_STATUS_VCM_I_CORE0 0x1a5 -#define RADIO_2057_AFE_STATUS_VCM_Q_CORE0 0x1a6 -#define RADIO_2057_AFE_VCM_CAL_MASTER_CORE1 0x1a7 -#define RADIO_2057_AFE_SET_VCM_I_CORE1 0x1a8 -#define RADIO_2057_AFE_SET_VCM_Q_CORE1 0x1a9 -#define RADIO_2057_AFE_STATUS_VCM_IQADC_CORE1 0x1aa -#define RADIO_2057_AFE_STATUS_VCM_I_CORE1 0x1ab -#define RADIO_2057_AFE_STATUS_VCM_Q_CORE1 0x1ac - -#define RADIO_2057v7_DACBUF_VINCM_CORE0 0x1ad -#define RADIO_2057v7_RCCAL_MASTER 0x1ae -#define RADIO_2057v7_TR2G_CONFIG3_CORE0_NU 0x1af -#define RADIO_2057v7_TR2G_CONFIG3_CORE1_NU 0x1b0 -#define RADIO_2057v7_LOGEN_PUS1 0x1b1 -#define RADIO_2057v7_OVR_REG5 0x1b2 -#define RADIO_2057v7_OVR_REG6 0x1b3 -#define RADIO_2057v7_OVR_REG7 0x1b4 -#define RADIO_2057v7_OVR_REG8 0x1b5 -#define RADIO_2057v7_OVR_REG9 0x1b6 -#define RADIO_2057v7_OVR_REG10 0x1b7 -#define RADIO_2057v7_OVR_REG11 0x1b8 -#define RADIO_2057v7_OVR_REG12 0x1b9 -#define RADIO_2057v7_OVR_REG13 0x1ba -#define RADIO_2057v7_OVR_REG14 0x1bb -#define RADIO_2057v7_OVR_REG15 0x1bc -#define RADIO_2057v7_OVR_REG16 0x1bd -#define RADIO_2057v7_OVR_REG1 0x1be -#define RADIO_2057v7_OVR_REG18 0x1bf -#define RADIO_2057v7_OVR_REG19 0x1c0 -#define RADIO_2057v7_OVR_REG20 0x1c1 -#define RADIO_2057v7_OVR_REG21 0x1c2 -#define RADIO_2057v7_OVR_REG2 0x1c3 -#define RADIO_2057v7_OVR_REG23 0x1c4 -#define RADIO_2057v7_OVR_REG24 0x1c5 -#define RADIO_2057v7_OVR_REG25 0x1c6 -#define RADIO_2057v7_OVR_REG26 0x1c7 -#define RADIO_2057v7_OVR_REG27 0x1c8 -#define RADIO_2057v7_OVR_REG28 0x1c9 -#define RADIO_2057v7_IQTEST_SEL_PU2 0x1ca - -#define RADIO_2057_VCM_MASK 0x7 - -#endif /* _BRCM_PHY_RADIO_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phyreg_n.h b/drivers/net/wireless/brcm80211/brcmsmac/phy/phyreg_n.h deleted file mode 100644 index a97c3a799479..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phyreg_n.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define NPHY_TBL_ID_GAIN1 0 -#define NPHY_TBL_ID_GAIN2 1 -#define NPHY_TBL_ID_GAINBITS1 2 -#define NPHY_TBL_ID_GAINBITS2 3 -#define NPHY_TBL_ID_GAINLIMIT 4 -#define NPHY_TBL_ID_WRSSIGainLimit 5 -#define NPHY_TBL_ID_RFSEQ 7 -#define NPHY_TBL_ID_AFECTRL 8 -#define NPHY_TBL_ID_ANTSWCTRLLUT 9 -#define NPHY_TBL_ID_IQLOCAL 15 -#define NPHY_TBL_ID_NOISEVAR 16 -#define NPHY_TBL_ID_SAMPLEPLAY 17 -#define NPHY_TBL_ID_CORE1TXPWRCTL 26 -#define NPHY_TBL_ID_CORE2TXPWRCTL 27 -#define NPHY_TBL_ID_CMPMETRICDATAWEIGHTTBL 30 - -#define NPHY_TBL_ID_EPSILONTBL0 31 -#define NPHY_TBL_ID_SCALARTBL0 32 -#define NPHY_TBL_ID_EPSILONTBL1 33 -#define NPHY_TBL_ID_SCALARTBL1 34 - -#define NPHY_TO_BPHY_OFF 0xc00 - -#define NPHY_BandControl_currentBand 0x0001 -#define RFCC_CHIP0_PU 0x0400 -#define RFCC_POR_FORCE 0x0040 -#define RFCC_OE_POR_FORCE 0x0080 -#define NPHY_RfctrlIntc_override_OFF 0 -#define NPHY_RfctrlIntc_override_TRSW 1 -#define NPHY_RfctrlIntc_override_PA 2 -#define NPHY_RfctrlIntc_override_EXT_LNA_PU 3 -#define NPHY_RfctrlIntc_override_EXT_LNA_GAIN 4 -#define RIFS_ENABLE 0x80 -#define BPHY_BAND_SEL_UP20 0x10 -#define NPHY_MLenable 0x02 - -#define NPHY_RfseqMode_CoreActv_override 0x0001 -#define NPHY_RfseqMode_Trigger_override 0x0002 -#define NPHY_RfseqCoreActv_TxRxChain0 (0x11) -#define NPHY_RfseqCoreActv_TxRxChain1 (0x22) - -#define NPHY_RfseqTrigger_rx2tx 0x0001 -#define NPHY_RfseqTrigger_tx2rx 0x0002 -#define NPHY_RfseqTrigger_updategainh 0x0004 -#define NPHY_RfseqTrigger_updategainl 0x0008 -#define NPHY_RfseqTrigger_updategainu 0x0010 -#define NPHY_RfseqTrigger_reset2rx 0x0020 -#define NPHY_RfseqStatus_rx2tx 0x0001 -#define NPHY_RfseqStatus_tx2rx 0x0002 -#define NPHY_RfseqStatus_updategainh 0x0004 -#define NPHY_RfseqStatus_updategainl 0x0008 -#define NPHY_RfseqStatus_updategainu 0x0010 -#define NPHY_RfseqStatus_reset2rx 0x0020 -#define NPHY_ClassifierCtrl_cck_en 0x1 -#define NPHY_ClassifierCtrl_ofdm_en 0x2 -#define NPHY_ClassifierCtrl_waited_en 0x4 -#define NPHY_IQFlip_ADC1 0x0001 -#define NPHY_IQFlip_ADC2 0x0010 -#define NPHY_sampleCmd_STOP 0x0002 - -#define RX_GF_OR_MM 0x0004 -#define RX_GF_MM_AUTO 0x0100 - -#define NPHY_iqloCalCmdGctl_IQLO_CAL_EN 0x8000 - -#define NPHY_IqestCmd_iqstart 0x1 -#define NPHY_IqestCmd_iqMode 0x2 - -#define NPHY_TxPwrCtrlCmd_pwrIndex_init 0x40 -#define NPHY_TxPwrCtrlCmd_pwrIndex_init_rev7 0x19 - -#define PRIM_SEL_UP20 0x8000 - -#define NPHY_RFSEQ_RX2TX 0x0 -#define NPHY_RFSEQ_TX2RX 0x1 -#define NPHY_RFSEQ_RESET2RX 0x2 -#define NPHY_RFSEQ_UPDATEGAINH 0x3 -#define NPHY_RFSEQ_UPDATEGAINL 0x4 -#define NPHY_RFSEQ_UPDATEGAINU 0x5 - -#define NPHY_RFSEQ_CMD_NOP 0x0 -#define NPHY_RFSEQ_CMD_RXG_FBW 0x1 -#define NPHY_RFSEQ_CMD_TR_SWITCH 0x2 -#define NPHY_RFSEQ_CMD_EXT_PA 0x3 -#define NPHY_RFSEQ_CMD_RXPD_TXPD 0x4 -#define NPHY_RFSEQ_CMD_TX_GAIN 0x5 -#define NPHY_RFSEQ_CMD_RX_GAIN 0x6 -#define NPHY_RFSEQ_CMD_SET_HPF_BW 0x7 -#define NPHY_RFSEQ_CMD_CLR_HIQ_DIS 0x8 -#define NPHY_RFSEQ_CMD_END 0xf - -#define NPHY_REV3_RFSEQ_CMD_NOP 0x0 -#define NPHY_REV3_RFSEQ_CMD_RXG_FBW 0x1 -#define NPHY_REV3_RFSEQ_CMD_TR_SWITCH 0x2 -#define NPHY_REV3_RFSEQ_CMD_INT_PA_PU 0x3 -#define NPHY_REV3_RFSEQ_CMD_EXT_PA 0x4 -#define NPHY_REV3_RFSEQ_CMD_RXPD_TXPD 0x5 -#define NPHY_REV3_RFSEQ_CMD_TX_GAIN 0x6 -#define NPHY_REV3_RFSEQ_CMD_RX_GAIN 0x7 -#define NPHY_REV3_RFSEQ_CMD_CLR_HIQ_DIS 0x8 -#define NPHY_REV3_RFSEQ_CMD_SET_HPF_H_HPC 0x9 -#define NPHY_REV3_RFSEQ_CMD_SET_LPF_H_HPC 0xa -#define NPHY_REV3_RFSEQ_CMD_SET_HPF_M_HPC 0xb -#define NPHY_REV3_RFSEQ_CMD_SET_LPF_M_HPC 0xc -#define NPHY_REV3_RFSEQ_CMD_SET_HPF_L_HPC 0xd -#define NPHY_REV3_RFSEQ_CMD_SET_LPF_L_HPC 0xe -#define NPHY_REV3_RFSEQ_CMD_CLR_RXRX_BIAS 0xf -#define NPHY_REV3_RFSEQ_CMD_END 0x1f - -#define NPHY_RSSI_SEL_W1 0x0 -#define NPHY_RSSI_SEL_W2 0x1 -#define NPHY_RSSI_SEL_NB 0x2 -#define NPHY_RSSI_SEL_IQ 0x3 -#define NPHY_RSSI_SEL_TSSI_2G 0x4 -#define NPHY_RSSI_SEL_TSSI_5G 0x5 -#define NPHY_RSSI_SEL_TBD 0x6 - -#define NPHY_RAIL_I 0x0 -#define NPHY_RAIL_Q 0x1 - -#define NPHY_FORCESIG_DECODEGATEDCLKS 0x8 - -#define NPHY_REV7_RfctrlOverride_cmd_rxrf_pu 0x0 -#define NPHY_REV7_RfctrlOverride_cmd_rx_pu 0x1 -#define NPHY_REV7_RfctrlOverride_cmd_tx_pu 0x2 -#define NPHY_REV7_RfctrlOverride_cmd_rxgain 0x3 -#define NPHY_REV7_RfctrlOverride_cmd_txgain 0x4 - -#define NPHY_REV7_RXGAINCODE_RFMXGAIN_MASK 0x000ff -#define NPHY_REV7_RXGAINCODE_LPFGAIN_MASK 0x0ff00 -#define NPHY_REV7_RXGAINCODE_DVGAGAIN_MASK 0xf0000 - -#define NPHY_REV7_TXGAINCODE_TGAIN_MASK 0x7fff -#define NPHY_REV7_TXGAINCODE_LPFGAIN_MASK 0x8000 -#define NPHY_REV7_TXGAINCODE_BIQ0GAIN_SHIFT 14 - -#define NPHY_REV7_RFCTRLOVERRIDE_ID0 0x0 -#define NPHY_REV7_RFCTRLOVERRIDE_ID1 0x1 -#define NPHY_REV7_RFCTRLOVERRIDE_ID2 0x2 - -#define NPHY_IqestIqAccLo(core) ((core == 0) ? 0x12c : 0x134) - -#define NPHY_IqestIqAccHi(core) ((core == 0) ? 0x12d : 0x135) - -#define NPHY_IqestipwrAccLo(core) ((core == 0) ? 0x12e : 0x136) - -#define NPHY_IqestipwrAccHi(core) ((core == 0) ? 0x12f : 0x137) - -#define NPHY_IqestqpwrAccLo(core) ((core == 0) ? 0x130 : 0x138) - -#define NPHY_IqestqpwrAccHi(core) ((core == 0) ? 0x131 : 0x139) diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c deleted file mode 100644 index 622c01ca72c5..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c +++ /dev/null @@ -1,3250 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "phytbl_lcn.h" - -static const u32 dot11lcn_gain_tbl_rev0[] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000004, - 0x00000000, - 0x00000004, - 0x00000008, - 0x00000001, - 0x00000005, - 0x00000009, - 0x0000000d, - 0x0000004d, - 0x0000008d, - 0x0000000d, - 0x0000004d, - 0x0000008d, - 0x000000cd, - 0x0000004f, - 0x0000008f, - 0x000000cf, - 0x000000d3, - 0x00000113, - 0x00000513, - 0x00000913, - 0x00000953, - 0x00000d53, - 0x00001153, - 0x00001193, - 0x00005193, - 0x00009193, - 0x0000d193, - 0x00011193, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000004, - 0x00000000, - 0x00000004, - 0x00000008, - 0x00000001, - 0x00000005, - 0x00000009, - 0x0000000d, - 0x0000004d, - 0x0000008d, - 0x0000000d, - 0x0000004d, - 0x0000008d, - 0x000000cd, - 0x0000004f, - 0x0000008f, - 0x000000cf, - 0x000000d3, - 0x00000113, - 0x00000513, - 0x00000913, - 0x00000953, - 0x00000d53, - 0x00001153, - 0x00005153, - 0x00009153, - 0x0000d153, - 0x00011153, - 0x00015153, - 0x00019153, - 0x0001d153, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -static const u32 dot11lcn_gain_tbl_rev1[] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000008, - 0x00000004, - 0x00000008, - 0x00000001, - 0x00000005, - 0x00000009, - 0x0000000D, - 0x00000011, - 0x00000051, - 0x00000091, - 0x00000011, - 0x00000051, - 0x00000091, - 0x000000d1, - 0x00000053, - 0x00000093, - 0x000000d3, - 0x000000d7, - 0x00000117, - 0x00000517, - 0x00000917, - 0x00000957, - 0x00000d57, - 0x00001157, - 0x00001197, - 0x00005197, - 0x00009197, - 0x0000d197, - 0x00011197, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000008, - 0x00000004, - 0x00000008, - 0x00000001, - 0x00000005, - 0x00000009, - 0x0000000D, - 0x00000011, - 0x00000051, - 0x00000091, - 0x00000011, - 0x00000051, - 0x00000091, - 0x000000d1, - 0x00000053, - 0x00000093, - 0x000000d3, - 0x000000d7, - 0x00000117, - 0x00000517, - 0x00000917, - 0x00000957, - 0x00000d57, - 0x00001157, - 0x00005157, - 0x00009157, - 0x0000d157, - 0x00011157, - 0x00015157, - 0x00019157, - 0x0001d157, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -static const u16 dot11lcn_aux_gain_idx_tbl_rev0[] = { - 0x0401, - 0x0402, - 0x0403, - 0x0404, - 0x0405, - 0x0406, - 0x0407, - 0x0408, - 0x0409, - 0x040a, - 0x058b, - 0x058c, - 0x058d, - 0x058e, - 0x058f, - 0x0090, - 0x0091, - 0x0092, - 0x0193, - 0x0194, - 0x0195, - 0x0196, - 0x0197, - 0x0198, - 0x0199, - 0x019a, - 0x019b, - 0x019c, - 0x019d, - 0x019e, - 0x019f, - 0x01a0, - 0x01a1, - 0x01a2, - 0x01a3, - 0x01a4, - 0x01a5, - 0x0000, -}; - -static const u32 dot11lcn_gain_idx_tbl_rev0[] = { - 0x00000000, - 0x00000000, - 0x10000000, - 0x00000000, - 0x20000000, - 0x00000000, - 0x30000000, - 0x00000000, - 0x40000000, - 0x00000000, - 0x50000000, - 0x00000000, - 0x60000000, - 0x00000000, - 0x70000000, - 0x00000000, - 0x80000000, - 0x00000000, - 0x90000000, - 0x00000008, - 0xa0000000, - 0x00000008, - 0xb0000000, - 0x00000008, - 0xc0000000, - 0x00000008, - 0xd0000000, - 0x00000008, - 0xe0000000, - 0x00000008, - 0xf0000000, - 0x00000008, - 0x00000000, - 0x00000009, - 0x10000000, - 0x00000009, - 0x20000000, - 0x00000019, - 0x30000000, - 0x00000019, - 0x40000000, - 0x00000019, - 0x50000000, - 0x00000019, - 0x60000000, - 0x00000019, - 0x70000000, - 0x00000019, - 0x80000000, - 0x00000019, - 0x90000000, - 0x00000019, - 0xa0000000, - 0x00000019, - 0xb0000000, - 0x00000019, - 0xc0000000, - 0x00000019, - 0xd0000000, - 0x00000019, - 0xe0000000, - 0x00000019, - 0xf0000000, - 0x00000019, - 0x00000000, - 0x0000001a, - 0x10000000, - 0x0000001a, - 0x20000000, - 0x0000001a, - 0x30000000, - 0x0000001a, - 0x40000000, - 0x0000001a, - 0x50000000, - 0x00000002, - 0x60000000, - 0x00000002, - 0x70000000, - 0x00000002, - 0x80000000, - 0x00000002, - 0x90000000, - 0x00000002, - 0xa0000000, - 0x00000002, - 0xb0000000, - 0x00000002, - 0xc0000000, - 0x0000000a, - 0xd0000000, - 0x0000000a, - 0xe0000000, - 0x0000000a, - 0xf0000000, - 0x0000000a, - 0x00000000, - 0x0000000b, - 0x10000000, - 0x0000000b, - 0x20000000, - 0x0000000b, - 0x30000000, - 0x0000000b, - 0x40000000, - 0x0000000b, - 0x50000000, - 0x0000001b, - 0x60000000, - 0x0000001b, - 0x70000000, - 0x0000001b, - 0x80000000, - 0x0000001b, - 0x90000000, - 0x0000001b, - 0xa0000000, - 0x0000001b, - 0xb0000000, - 0x0000001b, - 0xc0000000, - 0x0000001b, - 0xd0000000, - 0x0000001b, - 0xe0000000, - 0x0000001b, - 0xf0000000, - 0x0000001b, - 0x00000000, - 0x0000001c, - 0x10000000, - 0x0000001c, - 0x20000000, - 0x0000001c, - 0x30000000, - 0x0000001c, - 0x40000000, - 0x0000001c, - 0x50000000, - 0x0000001c, - 0x60000000, - 0x0000001c, - 0x70000000, - 0x0000001c, - 0x80000000, - 0x0000001c, - 0x90000000, - 0x0000001c, -}; - -static const u16 dot11lcn_aux_gain_idx_tbl_2G[] = { - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0001, - 0x0080, - 0x0081, - 0x0100, - 0x0101, - 0x0180, - 0x0181, - 0x0182, - 0x0183, - 0x0184, - 0x0185, - 0x0186, - 0x0187, - 0x0188, - 0x0285, - 0x0289, - 0x028a, - 0x028b, - 0x028c, - 0x028d, - 0x028e, - 0x028f, - 0x0290, - 0x0291, - 0x0292, - 0x0293, - 0x0294, - 0x0295, - 0x0296, - 0x0297, - 0x0298, - 0x0299, - 0x029a, - 0x0000 -}; - -static const u8 dot11lcn_gain_val_tbl_2G[] = { - 0xfc, - 0x02, - 0x08, - 0x0e, - 0x13, - 0x1b, - 0xfc, - 0x02, - 0x08, - 0x0e, - 0x13, - 0x1b, - 0xfc, - 0x00, - 0x0c, - 0x03, - 0xeb, - 0xfe, - 0x07, - 0x0b, - 0x0f, - 0xfb, - 0xfe, - 0x01, - 0x05, - 0x08, - 0x0b, - 0x0e, - 0x11, - 0x14, - 0x17, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x03, - 0x06, - 0x09, - 0x0c, - 0x0f, - 0x12, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x03, - 0x06, - 0x09, - 0x0c, - 0x0f, - 0x12, - 0x15, - 0x18, - 0x1b, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 -}; - -static const u32 dot11lcn_gain_idx_tbl_2G[] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x10000000, - 0x00000000, - 0x00000000, - 0x00000008, - 0x10000000, - 0x00000008, - 0x00000000, - 0x00000010, - 0x10000000, - 0x00000010, - 0x00000000, - 0x00000018, - 0x10000000, - 0x00000018, - 0x20000000, - 0x00000018, - 0x30000000, - 0x00000018, - 0x40000000, - 0x00000018, - 0x50000000, - 0x00000018, - 0x60000000, - 0x00000018, - 0x70000000, - 0x00000018, - 0x80000000, - 0x00000018, - 0x50000000, - 0x00000028, - 0x90000000, - 0x00000028, - 0xa0000000, - 0x00000028, - 0xb0000000, - 0x00000028, - 0xc0000000, - 0x00000028, - 0xd0000000, - 0x00000028, - 0xe0000000, - 0x00000028, - 0xf0000000, - 0x00000028, - 0x00000000, - 0x00000029, - 0x10000000, - 0x00000029, - 0x20000000, - 0x00000029, - 0x30000000, - 0x00000029, - 0x40000000, - 0x00000029, - 0x50000000, - 0x00000029, - 0x60000000, - 0x00000029, - 0x70000000, - 0x00000029, - 0x80000000, - 0x00000029, - 0x90000000, - 0x00000029, - 0xa0000000, - 0x00000029, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x10000000, - 0x00000000, - 0x00000000, - 0x00000008, - 0x10000000, - 0x00000008, - 0x00000000, - 0x00000010, - 0x10000000, - 0x00000010, - 0x00000000, - 0x00000018, - 0x10000000, - 0x00000018, - 0x20000000, - 0x00000018, - 0x30000000, - 0x00000018, - 0x40000000, - 0x00000018, - 0x50000000, - 0x00000018, - 0x60000000, - 0x00000018, - 0x70000000, - 0x00000018, - 0x80000000, - 0x00000018, - 0x50000000, - 0x00000028, - 0x90000000, - 0x00000028, - 0xa0000000, - 0x00000028, - 0xb0000000, - 0x00000028, - 0xc0000000, - 0x00000028, - 0xd0000000, - 0x00000028, - 0xe0000000, - 0x00000028, - 0xf0000000, - 0x00000028, - 0x00000000, - 0x00000029, - 0x10000000, - 0x00000029, - 0x20000000, - 0x00000029, - 0x30000000, - 0x00000029, - 0x40000000, - 0x00000029, - 0x50000000, - 0x00000029, - 0x60000000, - 0x00000029, - 0x70000000, - 0x00000029, - 0x80000000, - 0x00000029, - 0x90000000, - 0x00000029, - 0xa0000000, - 0x00000029, - 0xb0000000, - 0x00000029, - 0xc0000000, - 0x00000029, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000 -}; - -static const u32 dot11lcn_gain_tbl_2G[] = { - 0x00000000, - 0x00000004, - 0x00000008, - 0x00000001, - 0x00000005, - 0x00000009, - 0x0000000d, - 0x0000004d, - 0x0000008d, - 0x00000049, - 0x00000089, - 0x000000c9, - 0x0000004b, - 0x0000008b, - 0x000000cb, - 0x000000cf, - 0x0000010f, - 0x0000050f, - 0x0000090f, - 0x0000094f, - 0x00000d4f, - 0x0000114f, - 0x0000118f, - 0x0000518f, - 0x0000918f, - 0x0000d18f, - 0x0001118f, - 0x0001518f, - 0x0001918f, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000 -}; - -static const u32 dot11lcn_gain_tbl_extlna_2G[] = { - 0x00000000, - 0x00000004, - 0x00000008, - 0x00000001, - 0x00000005, - 0x00000009, - 0x0000000d, - 0x00000003, - 0x00000007, - 0x0000000b, - 0x0000000f, - 0x0000004f, - 0x0000008f, - 0x000000cf, - 0x0000010f, - 0x0000014f, - 0x0000018f, - 0x0000058f, - 0x0000098f, - 0x00000d8f, - 0x00008000, - 0x00008004, - 0x00008008, - 0x00008001, - 0x00008005, - 0x00008009, - 0x0000800d, - 0x00008003, - 0x00008007, - 0x0000800b, - 0x0000800f, - 0x0000804f, - 0x0000808f, - 0x000080cf, - 0x0000810f, - 0x0000814f, - 0x0000818f, - 0x0000858f, - 0x0000898f, - 0x00008d8f, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000 -}; - -static const u16 dot11lcn_aux_gain_idx_tbl_extlna_2G[] = { - 0x0400, - 0x0400, - 0x0400, - 0x0400, - 0x0400, - 0x0400, - 0x0400, - 0x0400, - 0x0400, - 0x0401, - 0x0402, - 0x0403, - 0x0404, - 0x0483, - 0x0484, - 0x0485, - 0x0486, - 0x0583, - 0x0584, - 0x0585, - 0x0587, - 0x0588, - 0x0589, - 0x058a, - 0x0687, - 0x0688, - 0x0689, - 0x068a, - 0x068b, - 0x068c, - 0x068d, - 0x068e, - 0x068f, - 0x0690, - 0x0691, - 0x0692, - 0x0693, - 0x0000 -}; - -static const u8 dot11lcn_gain_val_tbl_extlna_2G[] = { - 0xfc, - 0x02, - 0x08, - 0x0e, - 0x13, - 0x1b, - 0xfc, - 0x02, - 0x08, - 0x0e, - 0x13, - 0x1b, - 0xfc, - 0x00, - 0x0f, - 0x03, - 0xeb, - 0xfe, - 0x07, - 0x0b, - 0x0f, - 0xfb, - 0xfe, - 0x01, - 0x05, - 0x08, - 0x0b, - 0x0e, - 0x11, - 0x14, - 0x17, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x03, - 0x06, - 0x09, - 0x0c, - 0x0f, - 0x12, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x03, - 0x06, - 0x09, - 0x0c, - 0x0f, - 0x12, - 0x15, - 0x18, - 0x1b, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 -}; - -static const u32 dot11lcn_gain_idx_tbl_extlna_2G[] = { - 0x00000000, - 0x00000040, - 0x00000000, - 0x00000040, - 0x00000000, - 0x00000040, - 0x00000000, - 0x00000040, - 0x00000000, - 0x00000040, - 0x00000000, - 0x00000040, - 0x00000000, - 0x00000040, - 0x00000000, - 0x00000040, - 0x00000000, - 0x00000040, - 0x10000000, - 0x00000040, - 0x20000000, - 0x00000040, - 0x30000000, - 0x00000040, - 0x40000000, - 0x00000040, - 0x30000000, - 0x00000048, - 0x40000000, - 0x00000048, - 0x50000000, - 0x00000048, - 0x60000000, - 0x00000048, - 0x30000000, - 0x00000058, - 0x40000000, - 0x00000058, - 0x50000000, - 0x00000058, - 0x70000000, - 0x00000058, - 0x80000000, - 0x00000058, - 0x90000000, - 0x00000058, - 0xa0000000, - 0x00000058, - 0x70000000, - 0x00000068, - 0x80000000, - 0x00000068, - 0x90000000, - 0x00000068, - 0xa0000000, - 0x00000068, - 0xb0000000, - 0x00000068, - 0xc0000000, - 0x00000068, - 0xd0000000, - 0x00000068, - 0xe0000000, - 0x00000068, - 0xf0000000, - 0x00000068, - 0x00000000, - 0x00000069, - 0x10000000, - 0x00000069, - 0x20000000, - 0x00000069, - 0x30000000, - 0x00000069, - 0x40000000, - 0x00000041, - 0x40000000, - 0x00000041, - 0x40000000, - 0x00000041, - 0x40000000, - 0x00000041, - 0x40000000, - 0x00000041, - 0x40000000, - 0x00000041, - 0x40000000, - 0x00000041, - 0x40000000, - 0x00000041, - 0x40000000, - 0x00000041, - 0x50000000, - 0x00000041, - 0x60000000, - 0x00000041, - 0x70000000, - 0x00000041, - 0x80000000, - 0x00000041, - 0x70000000, - 0x00000049, - 0x80000000, - 0x00000049, - 0x90000000, - 0x00000049, - 0xa0000000, - 0x00000049, - 0x70000000, - 0x00000059, - 0x80000000, - 0x00000059, - 0x90000000, - 0x00000059, - 0xb0000000, - 0x00000059, - 0xc0000000, - 0x00000059, - 0xd0000000, - 0x00000059, - 0xe0000000, - 0x00000059, - 0xb0000000, - 0x00000069, - 0xc0000000, - 0x00000069, - 0xd0000000, - 0x00000069, - 0xe0000000, - 0x00000069, - 0xf0000000, - 0x00000069, - 0x00000000, - 0x0000006a, - 0x10000000, - 0x0000006a, - 0x20000000, - 0x0000006a, - 0x30000000, - 0x0000006a, - 0x40000000, - 0x0000006a, - 0x50000000, - 0x0000006a, - 0x60000000, - 0x0000006a, - 0x70000000, - 0x0000006a, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000 -}; - -static const u32 dot11lcn_aux_gain_idx_tbl_5G[] = { - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0001, - 0x0002, - 0x0003, - 0x0004, - 0x0083, - 0x0084, - 0x0085, - 0x0086, - 0x0087, - 0x0186, - 0x0187, - 0x0188, - 0x0189, - 0x018a, - 0x018b, - 0x018c, - 0x018d, - 0x018e, - 0x018f, - 0x0190, - 0x0191, - 0x0192, - 0x0193, - 0x0194, - 0x0195, - 0x0196, - 0x0197, - 0x0198, - 0x0199, - 0x019a, - 0x019b, - 0x019c, - 0x019d, - 0x0000 -}; - -static const u32 dot11lcn_gain_val_tbl_5G[] = { - 0xf7, - 0xfd, - 0x00, - 0x04, - 0x04, - 0x04, - 0xf7, - 0xfd, - 0x00, - 0x04, - 0x04, - 0x04, - 0xf6, - 0x00, - 0x0c, - 0x03, - 0xeb, - 0xfe, - 0x06, - 0x0a, - 0x10, - 0x00, - 0x03, - 0x06, - 0x09, - 0x0c, - 0x0f, - 0x12, - 0x15, - 0x18, - 0x1b, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x03, - 0x06, - 0x09, - 0x0c, - 0x0f, - 0x12, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x03, - 0x06, - 0x09, - 0x0c, - 0x0f, - 0x12, - 0x15, - 0x18, - 0x1b, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 -}; - -static const u32 dot11lcn_gain_idx_tbl_5G[] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x10000000, - 0x00000000, - 0x20000000, - 0x00000000, - 0x30000000, - 0x00000000, - 0x40000000, - 0x00000000, - 0x30000000, - 0x00000008, - 0x40000000, - 0x00000008, - 0x50000000, - 0x00000008, - 0x60000000, - 0x00000008, - 0x70000000, - 0x00000008, - 0x60000000, - 0x00000018, - 0x70000000, - 0x00000018, - 0x80000000, - 0x00000018, - 0x90000000, - 0x00000018, - 0xa0000000, - 0x00000018, - 0xb0000000, - 0x00000018, - 0xc0000000, - 0x00000018, - 0xd0000000, - 0x00000018, - 0xe0000000, - 0x00000018, - 0xf0000000, - 0x00000018, - 0x00000000, - 0x00000019, - 0x10000000, - 0x00000019, - 0x20000000, - 0x00000019, - 0x30000000, - 0x00000019, - 0x40000000, - 0x00000019, - 0x50000000, - 0x00000019, - 0x60000000, - 0x00000019, - 0x70000000, - 0x00000019, - 0x80000000, - 0x00000019, - 0x90000000, - 0x00000019, - 0xa0000000, - 0x00000019, - 0xb0000000, - 0x00000019, - 0xc0000000, - 0x00000019, - 0xd0000000, - 0x00000019, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000 -}; - -static const u32 dot11lcn_gain_tbl_5G[] = { - 0x00000000, - 0x00000040, - 0x00000080, - 0x00000001, - 0x00000005, - 0x00000009, - 0x0000000d, - 0x00000011, - 0x00000015, - 0x00000055, - 0x00000095, - 0x00000017, - 0x0000001b, - 0x0000005b, - 0x0000009b, - 0x000000db, - 0x0000011b, - 0x0000015b, - 0x0000019b, - 0x0000059b, - 0x0000099b, - 0x00000d9b, - 0x0000119b, - 0x0000519b, - 0x0000919b, - 0x0000d19b, - 0x0001119b, - 0x0001519b, - 0x0001919b, - 0x0001d19b, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000 -}; - -const struct phytbl_info dot11lcnphytbl_rx_gain_info_rev0[] = { - {&dot11lcn_gain_tbl_rev0, - sizeof(dot11lcn_gain_tbl_rev0) / sizeof(dot11lcn_gain_tbl_rev0[0]), 18, - 0, 32} - , - {&dot11lcn_aux_gain_idx_tbl_rev0, - sizeof(dot11lcn_aux_gain_idx_tbl_rev0) / - sizeof(dot11lcn_aux_gain_idx_tbl_rev0[0]), 14, 0, 16} - , - {&dot11lcn_gain_idx_tbl_rev0, - sizeof(dot11lcn_gain_idx_tbl_rev0) / - sizeof(dot11lcn_gain_idx_tbl_rev0[0]), 13, 0, 32} - , -}; - -static const struct phytbl_info dot11lcnphytbl_rx_gain_info_rev1[] = { - {&dot11lcn_gain_tbl_rev1, - sizeof(dot11lcn_gain_tbl_rev1) / sizeof(dot11lcn_gain_tbl_rev1[0]), 18, - 0, 32} - , - {&dot11lcn_aux_gain_idx_tbl_rev0, - sizeof(dot11lcn_aux_gain_idx_tbl_rev0) / - sizeof(dot11lcn_aux_gain_idx_tbl_rev0[0]), 14, 0, 16} - , - {&dot11lcn_gain_idx_tbl_rev0, - sizeof(dot11lcn_gain_idx_tbl_rev0) / - sizeof(dot11lcn_gain_idx_tbl_rev0[0]), 13, 0, 32} - , -}; - -const struct phytbl_info dot11lcnphytbl_rx_gain_info_2G_rev2[] = { - {&dot11lcn_gain_tbl_2G, - sizeof(dot11lcn_gain_tbl_2G) / sizeof(dot11lcn_gain_tbl_2G[0]), 18, 0, - 32} - , - {&dot11lcn_aux_gain_idx_tbl_2G, - sizeof(dot11lcn_aux_gain_idx_tbl_2G) / - sizeof(dot11lcn_aux_gain_idx_tbl_2G[0]), 14, 0, 16} - , - {&dot11lcn_gain_idx_tbl_2G, - sizeof(dot11lcn_gain_idx_tbl_2G) / sizeof(dot11lcn_gain_idx_tbl_2G[0]), - 13, 0, 32} - , - {&dot11lcn_gain_val_tbl_2G, - sizeof(dot11lcn_gain_val_tbl_2G) / sizeof(dot11lcn_gain_val_tbl_2G[0]), - 17, 0, 8} -}; - -const struct phytbl_info dot11lcnphytbl_rx_gain_info_5G_rev2[] = { - {&dot11lcn_gain_tbl_5G, - sizeof(dot11lcn_gain_tbl_5G) / sizeof(dot11lcn_gain_tbl_5G[0]), 18, 0, - 32} - , - {&dot11lcn_aux_gain_idx_tbl_5G, - sizeof(dot11lcn_aux_gain_idx_tbl_5G) / - sizeof(dot11lcn_aux_gain_idx_tbl_5G[0]), 14, 0, 16} - , - {&dot11lcn_gain_idx_tbl_5G, - sizeof(dot11lcn_gain_idx_tbl_5G) / sizeof(dot11lcn_gain_idx_tbl_5G[0]), - 13, 0, 32} - , - {&dot11lcn_gain_val_tbl_5G, - sizeof(dot11lcn_gain_val_tbl_5G) / sizeof(dot11lcn_gain_val_tbl_5G[0]), - 17, 0, 8} -}; - -const struct phytbl_info dot11lcnphytbl_rx_gain_info_extlna_2G_rev2[] = { - {&dot11lcn_gain_tbl_extlna_2G, - sizeof(dot11lcn_gain_tbl_extlna_2G) / - sizeof(dot11lcn_gain_tbl_extlna_2G[0]), 18, 0, 32} - , - {&dot11lcn_aux_gain_idx_tbl_extlna_2G, - sizeof(dot11lcn_aux_gain_idx_tbl_extlna_2G) / - sizeof(dot11lcn_aux_gain_idx_tbl_extlna_2G[0]), 14, 0, 16} - , - {&dot11lcn_gain_idx_tbl_extlna_2G, - sizeof(dot11lcn_gain_idx_tbl_extlna_2G) / - sizeof(dot11lcn_gain_idx_tbl_extlna_2G[0]), 13, 0, 32} - , - {&dot11lcn_gain_val_tbl_extlna_2G, - sizeof(dot11lcn_gain_val_tbl_extlna_2G) / - sizeof(dot11lcn_gain_val_tbl_extlna_2G[0]), 17, 0, 8} -}; - -const struct phytbl_info dot11lcnphytbl_rx_gain_info_extlna_5G_rev2[] = { - {&dot11lcn_gain_tbl_5G, - sizeof(dot11lcn_gain_tbl_5G) / sizeof(dot11lcn_gain_tbl_5G[0]), 18, 0, - 32} - , - {&dot11lcn_aux_gain_idx_tbl_5G, - sizeof(dot11lcn_aux_gain_idx_tbl_5G) / - sizeof(dot11lcn_aux_gain_idx_tbl_5G[0]), 14, 0, 16} - , - {&dot11lcn_gain_idx_tbl_5G, - sizeof(dot11lcn_gain_idx_tbl_5G) / sizeof(dot11lcn_gain_idx_tbl_5G[0]), - 13, 0, 32} - , - {&dot11lcn_gain_val_tbl_5G, - sizeof(dot11lcn_gain_val_tbl_5G) / sizeof(dot11lcn_gain_val_tbl_5G[0]), - 17, 0, 8} -}; - -const u32 dot11lcnphytbl_rx_gain_info_sz_rev0 = - sizeof(dot11lcnphytbl_rx_gain_info_rev0) / - sizeof(dot11lcnphytbl_rx_gain_info_rev0[0]); - -const u32 dot11lcnphytbl_rx_gain_info_2G_rev2_sz = - sizeof(dot11lcnphytbl_rx_gain_info_2G_rev2) / - sizeof(dot11lcnphytbl_rx_gain_info_2G_rev2[0]); - -const u32 dot11lcnphytbl_rx_gain_info_5G_rev2_sz = - sizeof(dot11lcnphytbl_rx_gain_info_5G_rev2) / - sizeof(dot11lcnphytbl_rx_gain_info_5G_rev2[0]); - -static const u16 dot11lcn_min_sig_sq_tbl_rev0[] = { - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, - 0x014d, -}; - -static const u16 dot11lcn_noise_scale_tbl_rev0[] = { - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, -}; - -static const u32 dot11lcn_fltr_ctrl_tbl_rev0[] = { - 0x000141f8, - 0x000021f8, - 0x000021fb, - 0x000041fb, - 0x0001fe4b, - 0x0000217b, - 0x00002133, - 0x000040eb, - 0x0001fea3, - 0x0000024b, -}; - -static const u32 dot11lcn_ps_ctrl_tbl_rev0[] = { - 0x00100001, - 0x00200010, - 0x00300001, - 0x00400010, - 0x00500022, - 0x00600122, - 0x00700222, - 0x00800322, - 0x00900422, - 0x00a00522, - 0x00b00622, - 0x00c00722, - 0x00d00822, - 0x00f00922, - 0x00100a22, - 0x00200b22, - 0x00300c22, - 0x00400d22, - 0x00500e22, - 0x00600f22, -}; - -static const u16 dot11lcn_sw_ctrl_tbl_4313_epa_rev0_combo[] = { - 0x0007, - 0x0005, - 0x0006, - 0x0004, - 0x0007, - 0x0005, - 0x0006, - 0x0004, - 0x0007, - 0x0005, - 0x0006, - 0x0004, - 0x0007, - 0x0005, - 0x0006, - 0x0004, - 0x000b, - 0x000b, - 0x000a, - 0x000a, - 0x000b, - 0x000b, - 0x000a, - 0x000a, - 0x000b, - 0x000b, - 0x000a, - 0x000a, - 0x000b, - 0x000b, - 0x000a, - 0x000a, - 0x0007, - 0x0005, - 0x0006, - 0x0004, - 0x0007, - 0x0005, - 0x0006, - 0x0004, - 0x0007, - 0x0005, - 0x0006, - 0x0004, - 0x0007, - 0x0005, - 0x0006, - 0x0004, - 0x000b, - 0x000b, - 0x000a, - 0x000a, - 0x000b, - 0x000b, - 0x000a, - 0x000a, - 0x000b, - 0x000b, - 0x000a, - 0x000a, - 0x000b, - 0x000b, - 0x000a, - 0x000a, - -}; - -static const u16 dot11lcn_sw_ctrl_tbl_4313_bt_epa_p250_rev0[] = { - 0x0007, - 0x0005, - 0x0002, - 0x0000, - 0x0007, - 0x0005, - 0x0002, - 0x0000, - 0x0007, - 0x0005, - 0x0002, - 0x0000, - 0x0007, - 0x0005, - 0x0002, - 0x0000, - 0x0007, - 0x0007, - 0x0002, - 0x0002, - 0x0007, - 0x0007, - 0x0002, - 0x0002, - 0x0007, - 0x0007, - 0x0002, - 0x0002, - 0x0007, - 0x0007, - 0x0002, - 0x0002, - 0x0007, - 0x0005, - 0x0002, - 0x0000, - 0x0007, - 0x0005, - 0x0002, - 0x0000, - 0x0007, - 0x0005, - 0x0002, - 0x0000, - 0x0007, - 0x0005, - 0x0002, - 0x0000, - 0x0007, - 0x0007, - 0x0002, - 0x0002, - 0x0007, - 0x0007, - 0x0002, - 0x0002, - 0x0007, - 0x0007, - 0x0002, - 0x0002, - 0x0007, - 0x0007, - 0x0002, - 0x0002, -}; - -static const u16 dot11lcn_sw_ctrl_tbl_4313_epa_rev0[] = { - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, - 0x0002, - 0x0008, - 0x0004, - 0x0001, -}; - -static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = { - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, - 0x000a, - 0x0009, - 0x0006, - 0x0005, -}; - -static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = { - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, - 0x0004, - 0x0004, - 0x0002, - 0x0002, -}; - -static const u8 dot11lcn_nf_table_rev0[] = { - 0x5f, - 0x36, - 0x29, - 0x1f, - 0x5f, - 0x36, - 0x29, - 0x1f, - 0x5f, - 0x36, - 0x29, - 0x1f, - 0x5f, - 0x36, - 0x29, - 0x1f, -}; - -static const u8 dot11lcn_gain_val_tbl_rev0[] = { - 0x09, - 0x0f, - 0x14, - 0x18, - 0xfe, - 0x07, - 0x0b, - 0x0f, - 0xfb, - 0xfe, - 0x01, - 0x05, - 0x08, - 0x0b, - 0x0e, - 0x11, - 0x14, - 0x17, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x03, - 0x06, - 0x09, - 0x0c, - 0x0f, - 0x12, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x03, - 0x06, - 0x09, - 0x0c, - 0x0f, - 0x12, - 0x15, - 0x18, - 0x1b, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x03, - 0xeb, - 0x00, - 0x00, -}; - -static const u8 dot11lcn_spur_tbl_rev0[] = { - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x02, - 0x03, - 0x01, - 0x03, - 0x02, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x02, - 0x03, - 0x01, - 0x03, - 0x02, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, - 0x01, -}; - -static const u16 dot11lcn_unsup_mcs_tbl_rev0[] = { - 0x001a, - 0x0034, - 0x004e, - 0x0068, - 0x009c, - 0x00d0, - 0x00ea, - 0x0104, - 0x0034, - 0x0068, - 0x009c, - 0x00d0, - 0x0138, - 0x01a0, - 0x01d4, - 0x0208, - 0x004e, - 0x009c, - 0x00ea, - 0x0138, - 0x01d4, - 0x0270, - 0x02be, - 0x030c, - 0x0068, - 0x00d0, - 0x0138, - 0x01a0, - 0x0270, - 0x0340, - 0x03a8, - 0x0410, - 0x0018, - 0x009c, - 0x00d0, - 0x0104, - 0x00ea, - 0x0138, - 0x0186, - 0x00d0, - 0x0104, - 0x0104, - 0x0138, - 0x016c, - 0x016c, - 0x01a0, - 0x0138, - 0x0186, - 0x0186, - 0x01d4, - 0x0222, - 0x0222, - 0x0270, - 0x0104, - 0x0138, - 0x016c, - 0x0138, - 0x016c, - 0x01a0, - 0x01d4, - 0x01a0, - 0x01d4, - 0x0208, - 0x0208, - 0x023c, - 0x0186, - 0x01d4, - 0x0222, - 0x01d4, - 0x0222, - 0x0270, - 0x02be, - 0x0270, - 0x02be, - 0x030c, - 0x030c, - 0x035a, - 0x0036, - 0x006c, - 0x00a2, - 0x00d8, - 0x0144, - 0x01b0, - 0x01e6, - 0x021c, - 0x006c, - 0x00d8, - 0x0144, - 0x01b0, - 0x0288, - 0x0360, - 0x03cc, - 0x0438, - 0x00a2, - 0x0144, - 0x01e6, - 0x0288, - 0x03cc, - 0x0510, - 0x05b2, - 0x0654, - 0x00d8, - 0x01b0, - 0x0288, - 0x0360, - 0x0510, - 0x06c0, - 0x0798, - 0x0870, - 0x0018, - 0x0144, - 0x01b0, - 0x021c, - 0x01e6, - 0x0288, - 0x032a, - 0x01b0, - 0x021c, - 0x021c, - 0x0288, - 0x02f4, - 0x02f4, - 0x0360, - 0x0288, - 0x032a, - 0x032a, - 0x03cc, - 0x046e, - 0x046e, - 0x0510, - 0x021c, - 0x0288, - 0x02f4, - 0x0288, - 0x02f4, - 0x0360, - 0x03cc, - 0x0360, - 0x03cc, - 0x0438, - 0x0438, - 0x04a4, - 0x032a, - 0x03cc, - 0x046e, - 0x03cc, - 0x046e, - 0x0510, - 0x05b2, - 0x0510, - 0x05b2, - 0x0654, - 0x0654, - 0x06f6, -}; - -static const u16 dot11lcn_iq_local_tbl_rev0[] = { - 0x0200, - 0x0300, - 0x0400, - 0x0600, - 0x0800, - 0x0b00, - 0x1000, - 0x1001, - 0x1002, - 0x1003, - 0x1004, - 0x1005, - 0x1006, - 0x1007, - 0x1707, - 0x2007, - 0x2d07, - 0x4007, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0200, - 0x0300, - 0x0400, - 0x0600, - 0x0800, - 0x0b00, - 0x1000, - 0x1001, - 0x1002, - 0x1003, - 0x1004, - 0x1005, - 0x1006, - 0x1007, - 0x1707, - 0x2007, - 0x2d07, - 0x4007, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x4000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, -}; - -static const u32 dot11lcn_papd_compdelta_tbl_rev0[] = { - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, - 0x00080000, -}; - -const struct phytbl_info dot11lcnphytbl_info_rev0[] = { - {&dot11lcn_min_sig_sq_tbl_rev0, - sizeof(dot11lcn_min_sig_sq_tbl_rev0) / - sizeof(dot11lcn_min_sig_sq_tbl_rev0[0]), 2, 0, 16} - , - {&dot11lcn_noise_scale_tbl_rev0, - sizeof(dot11lcn_noise_scale_tbl_rev0) / - sizeof(dot11lcn_noise_scale_tbl_rev0[0]), 1, 0, 16} - , - {&dot11lcn_fltr_ctrl_tbl_rev0, - sizeof(dot11lcn_fltr_ctrl_tbl_rev0) / - sizeof(dot11lcn_fltr_ctrl_tbl_rev0[0]), 11, 0, 32} - , - {&dot11lcn_ps_ctrl_tbl_rev0, - sizeof(dot11lcn_ps_ctrl_tbl_rev0) / - sizeof(dot11lcn_ps_ctrl_tbl_rev0[0]), 12, 0, 32} - , - {&dot11lcn_gain_idx_tbl_rev0, - sizeof(dot11lcn_gain_idx_tbl_rev0) / - sizeof(dot11lcn_gain_idx_tbl_rev0[0]), 13, 0, 32} - , - {&dot11lcn_aux_gain_idx_tbl_rev0, - sizeof(dot11lcn_aux_gain_idx_tbl_rev0) / - sizeof(dot11lcn_aux_gain_idx_tbl_rev0[0]), 14, 0, 16} - , - {&dot11lcn_sw_ctrl_tbl_rev0, - sizeof(dot11lcn_sw_ctrl_tbl_rev0) / - sizeof(dot11lcn_sw_ctrl_tbl_rev0[0]), 15, 0, 16} - , - {&dot11lcn_nf_table_rev0, - sizeof(dot11lcn_nf_table_rev0) / sizeof(dot11lcn_nf_table_rev0[0]), 16, - 0, 8} - , - {&dot11lcn_gain_val_tbl_rev0, - sizeof(dot11lcn_gain_val_tbl_rev0) / - sizeof(dot11lcn_gain_val_tbl_rev0[0]), 17, 0, 8} - , - {&dot11lcn_gain_tbl_rev0, - sizeof(dot11lcn_gain_tbl_rev0) / sizeof(dot11lcn_gain_tbl_rev0[0]), 18, - 0, 32} - , - {&dot11lcn_spur_tbl_rev0, - sizeof(dot11lcn_spur_tbl_rev0) / sizeof(dot11lcn_spur_tbl_rev0[0]), 20, - 0, 8} - , - {&dot11lcn_unsup_mcs_tbl_rev0, - sizeof(dot11lcn_unsup_mcs_tbl_rev0) / - sizeof(dot11lcn_unsup_mcs_tbl_rev0[0]), 23, 0, 16} - , - {&dot11lcn_iq_local_tbl_rev0, - sizeof(dot11lcn_iq_local_tbl_rev0) / - sizeof(dot11lcn_iq_local_tbl_rev0[0]), 0, 0, 16} - , - {&dot11lcn_papd_compdelta_tbl_rev0, - sizeof(dot11lcn_papd_compdelta_tbl_rev0) / - sizeof(dot11lcn_papd_compdelta_tbl_rev0[0]), 24, 0, 32} - , -}; - -const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313 = { - &dot11lcn_sw_ctrl_tbl_4313_rev0, - sizeof(dot11lcn_sw_ctrl_tbl_4313_rev0) / - sizeof(dot11lcn_sw_ctrl_tbl_4313_rev0[0]), 15, 0, 16 -}; - -const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_epa = { - &dot11lcn_sw_ctrl_tbl_4313_epa_rev0, - sizeof(dot11lcn_sw_ctrl_tbl_4313_epa_rev0) / - sizeof(dot11lcn_sw_ctrl_tbl_4313_epa_rev0[0]), 15, 0, 16 -}; - -const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_bt_epa = { - &dot11lcn_sw_ctrl_tbl_4313_epa_rev0_combo, - sizeof(dot11lcn_sw_ctrl_tbl_4313_epa_rev0_combo) / - sizeof(dot11lcn_sw_ctrl_tbl_4313_epa_rev0_combo[0]), 15, 0, 16 -}; - -const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_bt_epa_p250 = { - &dot11lcn_sw_ctrl_tbl_4313_bt_epa_p250_rev0, - sizeof(dot11lcn_sw_ctrl_tbl_4313_bt_epa_p250_rev0) / - sizeof(dot11lcn_sw_ctrl_tbl_4313_bt_epa_p250_rev0[0]), 15, 0, 16 -}; - -const u32 dot11lcnphytbl_info_sz_rev0 = - sizeof(dot11lcnphytbl_info_rev0) / sizeof(dot11lcnphytbl_info_rev0[0]); - -const struct lcnphy_tx_gain_tbl_entry -dot11lcnphy_2GHz_extPA_gaintable_rev0[128] = { - {3, 0, 31, 0, 72}, - {3, 0, 31, 0, 70}, - {3, 0, 31, 0, 68}, - {3, 0, 30, 0, 67}, - {3, 0, 29, 0, 68}, - {3, 0, 28, 0, 68}, - {3, 0, 27, 0, 69}, - {3, 0, 26, 0, 70}, - {3, 0, 25, 0, 70}, - {3, 0, 24, 0, 71}, - {3, 0, 23, 0, 72}, - {3, 0, 23, 0, 70}, - {3, 0, 22, 0, 71}, - {3, 0, 21, 0, 72}, - {3, 0, 21, 0, 70}, - {3, 0, 21, 0, 68}, - {3, 0, 21, 0, 66}, - {3, 0, 21, 0, 64}, - {3, 0, 21, 0, 63}, - {3, 0, 20, 0, 64}, - {3, 0, 19, 0, 65}, - {3, 0, 19, 0, 64}, - {3, 0, 18, 0, 65}, - {3, 0, 18, 0, 64}, - {3, 0, 17, 0, 65}, - {3, 0, 17, 0, 64}, - {3, 0, 16, 0, 65}, - {3, 0, 16, 0, 64}, - {3, 0, 16, 0, 62}, - {3, 0, 16, 0, 60}, - {3, 0, 16, 0, 58}, - {3, 0, 15, 0, 61}, - {3, 0, 15, 0, 59}, - {3, 0, 14, 0, 61}, - {3, 0, 14, 0, 60}, - {3, 0, 14, 0, 58}, - {3, 0, 13, 0, 60}, - {3, 0, 13, 0, 59}, - {3, 0, 12, 0, 62}, - {3, 0, 12, 0, 60}, - {3, 0, 12, 0, 58}, - {3, 0, 11, 0, 62}, - {3, 0, 11, 0, 60}, - {3, 0, 11, 0, 59}, - {3, 0, 11, 0, 57}, - {3, 0, 10, 0, 61}, - {3, 0, 10, 0, 59}, - {3, 0, 10, 0, 57}, - {3, 0, 9, 0, 62}, - {3, 0, 9, 0, 60}, - {3, 0, 9, 0, 58}, - {3, 0, 9, 0, 57}, - {3, 0, 8, 0, 62}, - {3, 0, 8, 0, 60}, - {3, 0, 8, 0, 58}, - {3, 0, 8, 0, 57}, - {3, 0, 8, 0, 55}, - {3, 0, 7, 0, 61}, - {3, 0, 7, 0, 60}, - {3, 0, 7, 0, 58}, - {3, 0, 7, 0, 56}, - {3, 0, 7, 0, 55}, - {3, 0, 6, 0, 62}, - {3, 0, 6, 0, 60}, - {3, 0, 6, 0, 58}, - {3, 0, 6, 0, 57}, - {3, 0, 6, 0, 55}, - {3, 0, 6, 0, 54}, - {3, 0, 6, 0, 52}, - {3, 0, 5, 0, 61}, - {3, 0, 5, 0, 59}, - {3, 0, 5, 0, 57}, - {3, 0, 5, 0, 56}, - {3, 0, 5, 0, 54}, - {3, 0, 5, 0, 53}, - {3, 0, 5, 0, 51}, - {3, 0, 4, 0, 62}, - {3, 0, 4, 0, 60}, - {3, 0, 4, 0, 58}, - {3, 0, 4, 0, 57}, - {3, 0, 4, 0, 55}, - {3, 0, 4, 0, 54}, - {3, 0, 4, 0, 52}, - {3, 0, 4, 0, 51}, - {3, 0, 4, 0, 49}, - {3, 0, 4, 0, 48}, - {3, 0, 4, 0, 46}, - {3, 0, 3, 0, 60}, - {3, 0, 3, 0, 58}, - {3, 0, 3, 0, 57}, - {3, 0, 3, 0, 55}, - {3, 0, 3, 0, 54}, - {3, 0, 3, 0, 52}, - {3, 0, 3, 0, 51}, - {3, 0, 3, 0, 49}, - {3, 0, 3, 0, 48}, - {3, 0, 3, 0, 46}, - {3, 0, 3, 0, 45}, - {3, 0, 3, 0, 44}, - {3, 0, 3, 0, 43}, - {3, 0, 3, 0, 41}, - {3, 0, 2, 0, 61}, - {3, 0, 2, 0, 59}, - {3, 0, 2, 0, 57}, - {3, 0, 2, 0, 56}, - {3, 0, 2, 0, 54}, - {3, 0, 2, 0, 53}, - {3, 0, 2, 0, 51}, - {3, 0, 2, 0, 50}, - {3, 0, 2, 0, 48}, - {3, 0, 2, 0, 47}, - {3, 0, 2, 0, 46}, - {3, 0, 2, 0, 44}, - {3, 0, 2, 0, 43}, - {3, 0, 2, 0, 42}, - {3, 0, 2, 0, 41}, - {3, 0, 2, 0, 39}, - {3, 0, 2, 0, 38}, - {3, 0, 2, 0, 37}, - {3, 0, 2, 0, 36}, - {3, 0, 2, 0, 35}, - {3, 0, 2, 0, 34}, - {3, 0, 2, 0, 33}, - {3, 0, 2, 0, 32}, - {3, 0, 1, 0, 63}, - {3, 0, 1, 0, 61}, - {3, 0, 1, 0, 59}, - {3, 0, 1, 0, 57}, -}; - -const struct lcnphy_tx_gain_tbl_entry dot11lcnphy_2GHz_gaintable_rev0[128] = { - {7, 0, 31, 0, 72}, - {7, 0, 31, 0, 70}, - {7, 0, 31, 0, 68}, - {7, 0, 30, 0, 67}, - {7, 0, 29, 0, 68}, - {7, 0, 28, 0, 68}, - {7, 0, 27, 0, 69}, - {7, 0, 26, 0, 70}, - {7, 0, 25, 0, 70}, - {7, 0, 24, 0, 71}, - {7, 0, 23, 0, 72}, - {7, 0, 23, 0, 70}, - {7, 0, 22, 0, 71}, - {7, 0, 21, 0, 72}, - {7, 0, 21, 0, 70}, - {7, 0, 21, 0, 68}, - {7, 0, 21, 0, 66}, - {7, 0, 21, 0, 64}, - {7, 0, 21, 0, 63}, - {7, 0, 20, 0, 64}, - {7, 0, 19, 0, 65}, - {7, 0, 19, 0, 64}, - {7, 0, 18, 0, 65}, - {7, 0, 18, 0, 64}, - {7, 0, 17, 0, 65}, - {7, 0, 17, 0, 64}, - {7, 0, 16, 0, 65}, - {7, 0, 16, 0, 64}, - {7, 0, 16, 0, 62}, - {7, 0, 16, 0, 60}, - {7, 0, 16, 0, 58}, - {7, 0, 15, 0, 61}, - {7, 0, 15, 0, 59}, - {7, 0, 14, 0, 61}, - {7, 0, 14, 0, 60}, - {7, 0, 14, 0, 58}, - {7, 0, 13, 0, 60}, - {7, 0, 13, 0, 59}, - {7, 0, 12, 0, 62}, - {7, 0, 12, 0, 60}, - {7, 0, 12, 0, 58}, - {7, 0, 11, 0, 62}, - {7, 0, 11, 0, 60}, - {7, 0, 11, 0, 59}, - {7, 0, 11, 0, 57}, - {7, 0, 10, 0, 61}, - {7, 0, 10, 0, 59}, - {7, 0, 10, 0, 57}, - {7, 0, 9, 0, 62}, - {7, 0, 9, 0, 60}, - {7, 0, 9, 0, 58}, - {7, 0, 9, 0, 57}, - {7, 0, 8, 0, 62}, - {7, 0, 8, 0, 60}, - {7, 0, 8, 0, 58}, - {7, 0, 8, 0, 57}, - {7, 0, 8, 0, 55}, - {7, 0, 7, 0, 61}, - {7, 0, 7, 0, 60}, - {7, 0, 7, 0, 58}, - {7, 0, 7, 0, 56}, - {7, 0, 7, 0, 55}, - {7, 0, 6, 0, 62}, - {7, 0, 6, 0, 60}, - {7, 0, 6, 0, 58}, - {7, 0, 6, 0, 57}, - {7, 0, 6, 0, 55}, - {7, 0, 6, 0, 54}, - {7, 0, 6, 0, 52}, - {7, 0, 5, 0, 61}, - {7, 0, 5, 0, 59}, - {7, 0, 5, 0, 57}, - {7, 0, 5, 0, 56}, - {7, 0, 5, 0, 54}, - {7, 0, 5, 0, 53}, - {7, 0, 5, 0, 51}, - {7, 0, 4, 0, 62}, - {7, 0, 4, 0, 60}, - {7, 0, 4, 0, 58}, - {7, 0, 4, 0, 57}, - {7, 0, 4, 0, 55}, - {7, 0, 4, 0, 54}, - {7, 0, 4, 0, 52}, - {7, 0, 4, 0, 51}, - {7, 0, 4, 0, 49}, - {7, 0, 4, 0, 48}, - {7, 0, 4, 0, 46}, - {7, 0, 3, 0, 60}, - {7, 0, 3, 0, 58}, - {7, 0, 3, 0, 57}, - {7, 0, 3, 0, 55}, - {7, 0, 3, 0, 54}, - {7, 0, 3, 0, 52}, - {7, 0, 3, 0, 51}, - {7, 0, 3, 0, 49}, - {7, 0, 3, 0, 48}, - {7, 0, 3, 0, 46}, - {7, 0, 3, 0, 45}, - {7, 0, 3, 0, 44}, - {7, 0, 3, 0, 43}, - {7, 0, 3, 0, 41}, - {7, 0, 2, 0, 61}, - {7, 0, 2, 0, 59}, - {7, 0, 2, 0, 57}, - {7, 0, 2, 0, 56}, - {7, 0, 2, 0, 54}, - {7, 0, 2, 0, 53}, - {7, 0, 2, 0, 51}, - {7, 0, 2, 0, 50}, - {7, 0, 2, 0, 48}, - {7, 0, 2, 0, 47}, - {7, 0, 2, 0, 46}, - {7, 0, 2, 0, 44}, - {7, 0, 2, 0, 43}, - {7, 0, 2, 0, 42}, - {7, 0, 2, 0, 41}, - {7, 0, 2, 0, 39}, - {7, 0, 2, 0, 38}, - {7, 0, 2, 0, 37}, - {7, 0, 2, 0, 36}, - {7, 0, 2, 0, 35}, - {7, 0, 2, 0, 34}, - {7, 0, 2, 0, 33}, - {7, 0, 2, 0, 32}, - {7, 0, 1, 0, 63}, - {7, 0, 1, 0, 61}, - {7, 0, 1, 0, 59}, - {7, 0, 1, 0, 57}, -}; - -const struct lcnphy_tx_gain_tbl_entry dot11lcnphy_5GHz_gaintable_rev0[128] = { - {255, 255, 0xf0, 0, 152}, - {255, 255, 0xf0, 0, 147}, - {255, 255, 0xf0, 0, 143}, - {255, 255, 0xf0, 0, 139}, - {255, 255, 0xf0, 0, 135}, - {255, 255, 0xf0, 0, 131}, - {255, 255, 0xf0, 0, 128}, - {255, 255, 0xf0, 0, 124}, - {255, 255, 0xf0, 0, 121}, - {255, 255, 0xf0, 0, 117}, - {255, 255, 0xf0, 0, 114}, - {255, 255, 0xf0, 0, 111}, - {255, 255, 0xf0, 0, 107}, - {255, 255, 0xf0, 0, 104}, - {255, 255, 0xf0, 0, 101}, - {255, 255, 0xf0, 0, 99}, - {255, 255, 0xf0, 0, 96}, - {255, 255, 0xf0, 0, 93}, - {255, 255, 0xf0, 0, 90}, - {255, 255, 0xf0, 0, 88}, - {255, 255, 0xf0, 0, 85}, - {255, 255, 0xf0, 0, 83}, - {255, 255, 0xf0, 0, 81}, - {255, 255, 0xf0, 0, 78}, - {255, 255, 0xf0, 0, 76}, - {255, 255, 0xf0, 0, 74}, - {255, 255, 0xf0, 0, 72}, - {255, 255, 0xf0, 0, 70}, - {255, 255, 0xf0, 0, 68}, - {255, 255, 0xf0, 0, 66}, - {255, 255, 0xf0, 0, 64}, - {255, 248, 0xf0, 0, 64}, - {255, 241, 0xf0, 0, 64}, - {255, 251, 0xe0, 0, 64}, - {255, 244, 0xe0, 0, 64}, - {255, 254, 0xd0, 0, 64}, - {255, 246, 0xd0, 0, 64}, - {255, 239, 0xd0, 0, 64}, - {255, 249, 0xc0, 0, 64}, - {255, 242, 0xc0, 0, 64}, - {255, 255, 0xb0, 0, 64}, - {255, 248, 0xb0, 0, 64}, - {255, 241, 0xb0, 0, 64}, - {255, 254, 0xa0, 0, 64}, - {255, 246, 0xa0, 0, 64}, - {255, 239, 0xa0, 0, 64}, - {255, 255, 0x90, 0, 64}, - {255, 248, 0x90, 0, 64}, - {255, 241, 0x90, 0, 64}, - {255, 234, 0x90, 0, 64}, - {255, 255, 0x80, 0, 64}, - {255, 248, 0x80, 0, 64}, - {255, 241, 0x80, 0, 64}, - {255, 234, 0x80, 0, 64}, - {255, 255, 0x70, 0, 64}, - {255, 248, 0x70, 0, 64}, - {255, 241, 0x70, 0, 64}, - {255, 234, 0x70, 0, 64}, - {255, 227, 0x70, 0, 64}, - {255, 221, 0x70, 0, 64}, - {255, 215, 0x70, 0, 64}, - {255, 208, 0x70, 0, 64}, - {255, 203, 0x70, 0, 64}, - {255, 197, 0x70, 0, 64}, - {255, 255, 0x60, 0, 64}, - {255, 248, 0x60, 0, 64}, - {255, 241, 0x60, 0, 64}, - {255, 234, 0x60, 0, 64}, - {255, 227, 0x60, 0, 64}, - {255, 221, 0x60, 0, 64}, - {255, 255, 0x50, 0, 64}, - {255, 248, 0x50, 0, 64}, - {255, 241, 0x50, 0, 64}, - {255, 234, 0x50, 0, 64}, - {255, 227, 0x50, 0, 64}, - {255, 221, 0x50, 0, 64}, - {255, 215, 0x50, 0, 64}, - {255, 208, 0x50, 0, 64}, - {255, 255, 0x40, 0, 64}, - {255, 248, 0x40, 0, 64}, - {255, 241, 0x40, 0, 64}, - {255, 234, 0x40, 0, 64}, - {255, 227, 0x40, 0, 64}, - {255, 221, 0x40, 0, 64}, - {255, 215, 0x40, 0, 64}, - {255, 208, 0x40, 0, 64}, - {255, 203, 0x40, 0, 64}, - {255, 197, 0x40, 0, 64}, - {255, 255, 0x30, 0, 64}, - {255, 248, 0x30, 0, 64}, - {255, 241, 0x30, 0, 64}, - {255, 234, 0x30, 0, 64}, - {255, 227, 0x30, 0, 64}, - {255, 221, 0x30, 0, 64}, - {255, 215, 0x30, 0, 64}, - {255, 208, 0x30, 0, 64}, - {255, 203, 0x30, 0, 64}, - {255, 197, 0x30, 0, 64}, - {255, 191, 0x30, 0, 64}, - {255, 186, 0x30, 0, 64}, - {255, 181, 0x30, 0, 64}, - {255, 175, 0x30, 0, 64}, - {255, 255, 0x20, 0, 64}, - {255, 248, 0x20, 0, 64}, - {255, 241, 0x20, 0, 64}, - {255, 234, 0x20, 0, 64}, - {255, 227, 0x20, 0, 64}, - {255, 221, 0x20, 0, 64}, - {255, 215, 0x20, 0, 64}, - {255, 208, 0x20, 0, 64}, - {255, 203, 0x20, 0, 64}, - {255, 197, 0x20, 0, 64}, - {255, 191, 0x20, 0, 64}, - {255, 186, 0x20, 0, 64}, - {255, 181, 0x20, 0, 64}, - {255, 175, 0x20, 0, 64}, - {255, 170, 0x20, 0, 64}, - {255, 166, 0x20, 0, 64}, - {255, 161, 0x20, 0, 64}, - {255, 156, 0x20, 0, 64}, - {255, 152, 0x20, 0, 64}, - {255, 148, 0x20, 0, 64}, - {255, 143, 0x20, 0, 64}, - {255, 139, 0x20, 0, 64}, - {255, 135, 0x20, 0, 64}, - {255, 132, 0x20, 0, 64}, - {255, 255, 0x10, 0, 64}, - {255, 248, 0x10, 0, 64}, -}; diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.h b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.h deleted file mode 100644 index 5f75e16bf5a7..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "phy_int.h" - -extern const struct phytbl_info dot11lcnphytbl_rx_gain_info_rev0[]; -extern const u32 dot11lcnphytbl_rx_gain_info_sz_rev0; -extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313; -extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_epa; -extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_epa_combo; -extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_bt_epa; -extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_bt_epa_p250; - -extern const struct phytbl_info dot11lcnphytbl_info_rev0[]; -extern const u32 dot11lcnphytbl_info_sz_rev0; - -extern const struct phytbl_info dot11lcnphytbl_rx_gain_info_2G_rev2[]; -extern const u32 dot11lcnphytbl_rx_gain_info_2G_rev2_sz; - -extern const struct phytbl_info dot11lcnphytbl_rx_gain_info_5G_rev2[]; -extern const u32 dot11lcnphytbl_rx_gain_info_5G_rev2_sz; - -extern const struct phytbl_info dot11lcnphytbl_rx_gain_info_extlna_2G_rev2[]; - -extern const struct phytbl_info dot11lcnphytbl_rx_gain_info_extlna_5G_rev2[]; - -struct lcnphy_tx_gain_tbl_entry { - unsigned char gm; - unsigned char pga; - unsigned char pad; - unsigned char dac; - unsigned char bb_mult; -}; - -extern const struct lcnphy_tx_gain_tbl_entry dot11lcnphy_2GHz_gaintable_rev0[]; - -extern const struct -lcnphy_tx_gain_tbl_entry dot11lcnphy_2GHz_extPA_gaintable_rev0[]; - -extern const struct lcnphy_tx_gain_tbl_entry dot11lcnphy_5GHz_gaintable_rev0[]; diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_n.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_n.c deleted file mode 100644 index dbf50ef6cd75..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_n.c +++ /dev/null @@ -1,10630 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "phytbl_n.h" - -static const u32 frame_struct_rev0[] = { - 0x08004a04, - 0x00100000, - 0x01000a05, - 0x00100020, - 0x09804506, - 0x00100030, - 0x09804507, - 0x00100030, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x08004a0c, - 0x00100004, - 0x01000a0d, - 0x00100024, - 0x0980450e, - 0x00100034, - 0x0980450f, - 0x00100034, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000a04, - 0x00100000, - 0x11008a05, - 0x00100020, - 0x1980c506, - 0x00100030, - 0x21810506, - 0x00100030, - 0x21810506, - 0x00100030, - 0x01800504, - 0x00100030, - 0x11808505, - 0x00100030, - 0x29814507, - 0x01100030, - 0x00000a04, - 0x00100000, - 0x11008a05, - 0x00100020, - 0x21810506, - 0x00100030, - 0x21810506, - 0x00100030, - 0x29814507, - 0x01100030, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000a0c, - 0x00100008, - 0x11008a0d, - 0x00100028, - 0x1980c50e, - 0x00100038, - 0x2181050e, - 0x00100038, - 0x2181050e, - 0x00100038, - 0x0180050c, - 0x00100038, - 0x1180850d, - 0x00100038, - 0x2981450f, - 0x01100038, - 0x00000a0c, - 0x00100008, - 0x11008a0d, - 0x00100028, - 0x2181050e, - 0x00100038, - 0x2181050e, - 0x00100038, - 0x2981450f, - 0x01100038, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x08004a04, - 0x00100000, - 0x01000a05, - 0x00100020, - 0x1980c506, - 0x00100030, - 0x1980c506, - 0x00100030, - 0x11808504, - 0x00100030, - 0x3981ca05, - 0x00100030, - 0x29814507, - 0x01100030, - 0x00000000, - 0x00000000, - 0x10008a04, - 0x00100000, - 0x3981ca05, - 0x00100030, - 0x1980c506, - 0x00100030, - 0x29814507, - 0x01100030, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x08004a0c, - 0x00100008, - 0x01000a0d, - 0x00100028, - 0x1980c50e, - 0x00100038, - 0x1980c50e, - 0x00100038, - 0x1180850c, - 0x00100038, - 0x3981ca0d, - 0x00100038, - 0x2981450f, - 0x01100038, - 0x00000000, - 0x00000000, - 0x10008a0c, - 0x00100008, - 0x3981ca0d, - 0x00100038, - 0x1980c50e, - 0x00100038, - 0x2981450f, - 0x01100038, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x40021404, - 0x00100000, - 0x02001405, - 0x00100040, - 0x0b004a06, - 0x01900060, - 0x13008a06, - 0x01900060, - 0x13008a06, - 0x01900060, - 0x43020a04, - 0x00100060, - 0x1b00ca05, - 0x00100060, - 0x23010a07, - 0x01500060, - 0x40021404, - 0x00100000, - 0x1a00d405, - 0x00100040, - 0x13008a06, - 0x01900060, - 0x13008a06, - 0x01900060, - 0x23010a07, - 0x01500060, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x4002140c, - 0x00100010, - 0x0200140d, - 0x00100050, - 0x0b004a0e, - 0x01900070, - 0x13008a0e, - 0x01900070, - 0x13008a0e, - 0x01900070, - 0x43020a0c, - 0x00100070, - 0x1b00ca0d, - 0x00100070, - 0x23010a0f, - 0x01500070, - 0x4002140c, - 0x00100010, - 0x1a00d40d, - 0x00100050, - 0x13008a0e, - 0x01900070, - 0x13008a0e, - 0x01900070, - 0x23010a0f, - 0x01500070, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x50029404, - 0x00100000, - 0x32019405, - 0x00100040, - 0x0b004a06, - 0x01900060, - 0x0b004a06, - 0x01900060, - 0x5b02ca04, - 0x00100060, - 0x3b01d405, - 0x00100060, - 0x23010a07, - 0x01500060, - 0x00000000, - 0x00000000, - 0x5802d404, - 0x00100000, - 0x3b01d405, - 0x00100060, - 0x0b004a06, - 0x01900060, - 0x23010a07, - 0x01500060, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x5002940c, - 0x00100010, - 0x3201940d, - 0x00100050, - 0x0b004a0e, - 0x01900070, - 0x0b004a0e, - 0x01900070, - 0x5b02ca0c, - 0x00100070, - 0x3b01d40d, - 0x00100070, - 0x23010a0f, - 0x01500070, - 0x00000000, - 0x00000000, - 0x5802d40c, - 0x00100010, - 0x3b01d40d, - 0x00100070, - 0x0b004a0e, - 0x01900070, - 0x23010a0f, - 0x01500070, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x40021404, - 0x000f4800, - 0x62031405, - 0x00100040, - 0x53028a06, - 0x01900060, - 0x53028a07, - 0x01900060, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x4002140c, - 0x000f4808, - 0x6203140d, - 0x00100048, - 0x53028a0e, - 0x01900068, - 0x53028a0f, - 0x01900068, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000a0c, - 0x00100004, - 0x11008a0d, - 0x00100024, - 0x1980c50e, - 0x00100034, - 0x2181050e, - 0x00100034, - 0x2181050e, - 0x00100034, - 0x0180050c, - 0x00100038, - 0x1180850d, - 0x00100038, - 0x1181850d, - 0x00100038, - 0x2981450f, - 0x01100038, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000a0c, - 0x00100008, - 0x11008a0d, - 0x00100028, - 0x2181050e, - 0x00100038, - 0x2181050e, - 0x00100038, - 0x1181850d, - 0x00100038, - 0x2981450f, - 0x01100038, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x08004a04, - 0x00100000, - 0x01000a05, - 0x00100020, - 0x0180c506, - 0x00100030, - 0x0180c506, - 0x00100030, - 0x2180c50c, - 0x00100030, - 0x49820a0d, - 0x0016a130, - 0x41824a0d, - 0x0016a130, - 0x2981450f, - 0x01100030, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x2000ca0c, - 0x00100000, - 0x49820a0d, - 0x0016a130, - 0x1980c50e, - 0x00100030, - 0x41824a0d, - 0x0016a130, - 0x2981450f, - 0x01100030, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x4002140c, - 0x00100008, - 0x0200140d, - 0x00100048, - 0x0b004a0e, - 0x01900068, - 0x13008a0e, - 0x01900068, - 0x13008a0e, - 0x01900068, - 0x43020a0c, - 0x00100070, - 0x1b00ca0d, - 0x00100070, - 0x1b014a0d, - 0x00100070, - 0x23010a0f, - 0x01500070, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x4002140c, - 0x00100010, - 0x1a00d40d, - 0x00100050, - 0x13008a0e, - 0x01900070, - 0x13008a0e, - 0x01900070, - 0x1b014a0d, - 0x00100070, - 0x23010a0f, - 0x01500070, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x50029404, - 0x00100000, - 0x32019405, - 0x00100040, - 0x03004a06, - 0x01900060, - 0x03004a06, - 0x01900060, - 0x6b030a0c, - 0x00100060, - 0x4b02140d, - 0x0016a160, - 0x4302540d, - 0x0016a160, - 0x23010a0f, - 0x01500060, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x6b03140c, - 0x00100060, - 0x4b02140d, - 0x0016a160, - 0x0b004a0e, - 0x01900060, - 0x4302540d, - 0x0016a160, - 0x23010a0f, - 0x01500060, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x40021404, - 0x00100000, - 0x1a00d405, - 0x00100040, - 0x53028a06, - 0x01900060, - 0x5b02ca06, - 0x01900060, - 0x5b02ca06, - 0x01900060, - 0x43020a04, - 0x00100060, - 0x1b00ca05, - 0x00100060, - 0x53028a07, - 0x0190c060, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x4002140c, - 0x00100010, - 0x1a00d40d, - 0x00100050, - 0x53028a0e, - 0x01900070, - 0x5b02ca0e, - 0x01900070, - 0x5b02ca0e, - 0x01900070, - 0x43020a0c, - 0x00100070, - 0x1b00ca0d, - 0x00100070, - 0x53028a0f, - 0x0190c070, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x40021404, - 0x00100000, - 0x1a00d405, - 0x00100040, - 0x5b02ca06, - 0x01900060, - 0x5b02ca06, - 0x01900060, - 0x53028a07, - 0x0190c060, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x4002140c, - 0x00100010, - 0x1a00d40d, - 0x00100050, - 0x5b02ca0e, - 0x01900070, - 0x5b02ca0e, - 0x01900070, - 0x53028a0f, - 0x0190c070, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -static const u8 frame_lut_rev0[] = { - 0x02, - 0x04, - 0x14, - 0x14, - 0x03, - 0x05, - 0x16, - 0x16, - 0x0a, - 0x0c, - 0x1c, - 0x1c, - 0x0b, - 0x0d, - 0x1e, - 0x1e, - 0x06, - 0x08, - 0x18, - 0x18, - 0x07, - 0x09, - 0x1a, - 0x1a, - 0x0e, - 0x10, - 0x20, - 0x28, - 0x0f, - 0x11, - 0x22, - 0x2a, -}; - -static const u32 tmap_tbl_rev0[] = { - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0xf1111110, - 0x11111111, - 0x11f11111, - 0x00000111, - 0x11000000, - 0x1111f111, - 0x11111111, - 0x111111f1, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x000aa888, - 0x88880000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0xa1111110, - 0x11111111, - 0x11c11111, - 0x00000111, - 0x11000000, - 0x1111a111, - 0x11111111, - 0x111111a1, - 0xa2222220, - 0x22222222, - 0x22c22222, - 0x00000222, - 0x22000000, - 0x2222a222, - 0x22222222, - 0x222222a2, - 0xf1111110, - 0x11111111, - 0x11f11111, - 0x00011111, - 0x11110000, - 0x1111f111, - 0x11111111, - 0x111111f1, - 0xa8aa88a0, - 0xa88888a8, - 0xa8a8a88a, - 0x00088aaa, - 0xaaaa0000, - 0xa8a8aa88, - 0xa88aaaaa, - 0xaaaa8a8a, - 0xaaa8aaa0, - 0x8aaa8aaa, - 0xaa8a8a8a, - 0x000aaa88, - 0x8aaa0000, - 0xaaa8a888, - 0x8aa88a8a, - 0x8a88a888, - 0x08080a00, - 0x0a08080a, - 0x080a0a08, - 0x00080808, - 0x080a0000, - 0x080a0808, - 0x080a0808, - 0x0a0a0a08, - 0xa0a0a0a0, - 0x80a0a080, - 0x8080a0a0, - 0x00008080, - 0x80a00000, - 0x80a080a0, - 0xa080a0a0, - 0x8080a0a0, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x99999000, - 0x9b9b99bb, - 0x9bb99999, - 0x9999b9b9, - 0x9b99bb90, - 0x9bbbbb9b, - 0x9b9b9bb9, - 0x00000999, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00aaa888, - 0x22000000, - 0x2222b222, - 0x22222222, - 0x222222b2, - 0xb2222220, - 0x22222222, - 0x22d22222, - 0x00000222, - 0x11000000, - 0x1111a111, - 0x11111111, - 0x111111a1, - 0xa1111110, - 0x11111111, - 0x11c11111, - 0x00000111, - 0x33000000, - 0x3333b333, - 0x33333333, - 0x333333b3, - 0xb3333330, - 0x33333333, - 0x33d33333, - 0x00000333, - 0x22000000, - 0x2222a222, - 0x22222222, - 0x222222a2, - 0xa2222220, - 0x22222222, - 0x22c22222, - 0x00000222, - 0x99b99b00, - 0x9b9b99bb, - 0x9bb99999, - 0x9999b9b9, - 0x9b99bb99, - 0x9bbbbb9b, - 0x9b9b9bb9, - 0x00000999, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa88, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x08aaa888, - 0x22222200, - 0x2222f222, - 0x22222222, - 0x222222f2, - 0x22222222, - 0x22222222, - 0x22f22222, - 0x00000222, - 0x11000000, - 0x1111f111, - 0x11111111, - 0x11111111, - 0xf1111111, - 0x11111111, - 0x11f11111, - 0x01111111, - 0xbb9bb900, - 0xb9b9bb99, - 0xb99bbbbb, - 0xbbbb9b9b, - 0xb9bb99bb, - 0xb99999b9, - 0xb9b9b99b, - 0x00000bbb, - 0xaa000000, - 0xa8a8aa88, - 0xa88aaaaa, - 0xaaaa8a8a, - 0xa8aa88aa, - 0xa88888a8, - 0xa8a8a88a, - 0x0a888aaa, - 0xaa000000, - 0xa8a8aa88, - 0xa88aaaaa, - 0xaaaa8a8a, - 0xa8aa88a0, - 0xa88888a8, - 0xa8a8a88a, - 0x00000aaa, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0xbbbbbb00, - 0x999bbbbb, - 0x9bb99b9b, - 0xb9b9b9bb, - 0xb9b99bbb, - 0xb9b9b9bb, - 0xb9bb9b99, - 0x00000999, - 0x8a000000, - 0xaa88a888, - 0xa88888aa, - 0xa88a8a88, - 0xa88aa88a, - 0x88a8aaaa, - 0xa8aa8aaa, - 0x0888a88a, - 0x0b0b0b00, - 0x090b0b0b, - 0x0b090b0b, - 0x0909090b, - 0x09090b0b, - 0x09090b0b, - 0x09090b09, - 0x00000909, - 0x0a000000, - 0x0a080808, - 0x080a080a, - 0x080a0a08, - 0x080a080a, - 0x0808080a, - 0x0a0a0a08, - 0x0808080a, - 0xb0b0b000, - 0x9090b0b0, - 0x90b09090, - 0xb0b0b090, - 0xb0b090b0, - 0x90b0b0b0, - 0xb0b09090, - 0x00000090, - 0x80000000, - 0xa080a080, - 0xa08080a0, - 0xa0808080, - 0xa080a080, - 0x80a0a0a0, - 0xa0a080a0, - 0x00a0a0a0, - 0x22000000, - 0x2222f222, - 0x22222222, - 0x222222f2, - 0xf2222220, - 0x22222222, - 0x22f22222, - 0x00000222, - 0x11000000, - 0x1111f111, - 0x11111111, - 0x111111f1, - 0xf1111110, - 0x11111111, - 0x11f11111, - 0x00000111, - 0x33000000, - 0x3333f333, - 0x33333333, - 0x333333f3, - 0xf3333330, - 0x33333333, - 0x33f33333, - 0x00000333, - 0x22000000, - 0x2222f222, - 0x22222222, - 0x222222f2, - 0xf2222220, - 0x22222222, - 0x22f22222, - 0x00000222, - 0x99000000, - 0x9b9b99bb, - 0x9bb99999, - 0x9999b9b9, - 0x9b99bb90, - 0x9bbbbb9b, - 0x9b9b9bb9, - 0x00000999, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x88888000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00aaa888, - 0x88a88a00, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa88, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa88, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x08aaa888, - 0x11000000, - 0x1111a111, - 0x11111111, - 0x111111a1, - 0xa1111110, - 0x11111111, - 0x11c11111, - 0x00000111, - 0x11000000, - 0x1111a111, - 0x11111111, - 0x111111a1, - 0xa1111110, - 0x11111111, - 0x11c11111, - 0x00000111, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -static const u32 tdtrn_tbl_rev0[] = { - 0x061c061c, - 0x0050ee68, - 0xf592fe36, - 0xfe5212f6, - 0x00000c38, - 0xfe5212f6, - 0xf592fe36, - 0x0050ee68, - 0x061c061c, - 0xee680050, - 0xfe36f592, - 0x12f6fe52, - 0x0c380000, - 0x12f6fe52, - 0xfe36f592, - 0xee680050, - 0x061c061c, - 0x0050ee68, - 0xf592fe36, - 0xfe5212f6, - 0x00000c38, - 0xfe5212f6, - 0xf592fe36, - 0x0050ee68, - 0x061c061c, - 0xee680050, - 0xfe36f592, - 0x12f6fe52, - 0x0c380000, - 0x12f6fe52, - 0xfe36f592, - 0xee680050, - 0x05e305e3, - 0x004def0c, - 0xf5f3fe47, - 0xfe611246, - 0x00000bc7, - 0xfe611246, - 0xf5f3fe47, - 0x004def0c, - 0x05e305e3, - 0xef0c004d, - 0xfe47f5f3, - 0x1246fe61, - 0x0bc70000, - 0x1246fe61, - 0xfe47f5f3, - 0xef0c004d, - 0x05e305e3, - 0x004def0c, - 0xf5f3fe47, - 0xfe611246, - 0x00000bc7, - 0xfe611246, - 0xf5f3fe47, - 0x004def0c, - 0x05e305e3, - 0xef0c004d, - 0xfe47f5f3, - 0x1246fe61, - 0x0bc70000, - 0x1246fe61, - 0xfe47f5f3, - 0xef0c004d, - 0xfa58fa58, - 0xf895043b, - 0xff4c09c0, - 0xfbc6ffa8, - 0xfb84f384, - 0x0798f6f9, - 0x05760122, - 0x058409f6, - 0x0b500000, - 0x05b7f542, - 0x08860432, - 0x06ddfee7, - 0xfb84f384, - 0xf9d90664, - 0xf7e8025c, - 0x00fff7bd, - 0x05a805a8, - 0xf7bd00ff, - 0x025cf7e8, - 0x0664f9d9, - 0xf384fb84, - 0xfee706dd, - 0x04320886, - 0xf54205b7, - 0x00000b50, - 0x09f60584, - 0x01220576, - 0xf6f90798, - 0xf384fb84, - 0xffa8fbc6, - 0x09c0ff4c, - 0x043bf895, - 0x02d402d4, - 0x07de0270, - 0xfc96079c, - 0xf90afe94, - 0xfe00ff2c, - 0x02d4065d, - 0x092a0096, - 0x0014fbb8, - 0xfd2cfd2c, - 0x076afb3c, - 0x0096f752, - 0xf991fd87, - 0xfb2c0200, - 0xfeb8f960, - 0x08e0fc96, - 0x049802a8, - 0xfd2cfd2c, - 0x02a80498, - 0xfc9608e0, - 0xf960feb8, - 0x0200fb2c, - 0xfd87f991, - 0xf7520096, - 0xfb3c076a, - 0xfd2cfd2c, - 0xfbb80014, - 0x0096092a, - 0x065d02d4, - 0xff2cfe00, - 0xfe94f90a, - 0x079cfc96, - 0x027007de, - 0x02d402d4, - 0x027007de, - 0x079cfc96, - 0xfe94f90a, - 0xff2cfe00, - 0x065d02d4, - 0x0096092a, - 0xfbb80014, - 0xfd2cfd2c, - 0xfb3c076a, - 0xf7520096, - 0xfd87f991, - 0x0200fb2c, - 0xf960feb8, - 0xfc9608e0, - 0x02a80498, - 0xfd2cfd2c, - 0x049802a8, - 0x08e0fc96, - 0xfeb8f960, - 0xfb2c0200, - 0xf991fd87, - 0x0096f752, - 0x076afb3c, - 0xfd2cfd2c, - 0x0014fbb8, - 0x092a0096, - 0x02d4065d, - 0xfe00ff2c, - 0xf90afe94, - 0xfc96079c, - 0x07de0270, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x062a0000, - 0xfefa0759, - 0x08b80908, - 0xf396fc2d, - 0xf9d6045c, - 0xfc4ef608, - 0xf748f596, - 0x07b207bf, - 0x062a062a, - 0xf84ef841, - 0xf748f596, - 0x03b209f8, - 0xf9d6045c, - 0x0c6a03d3, - 0x08b80908, - 0x0106f8a7, - 0x062a0000, - 0xfefaf8a7, - 0x08b8f6f8, - 0xf39603d3, - 0xf9d6fba4, - 0xfc4e09f8, - 0xf7480a6a, - 0x07b2f841, - 0x062af9d6, - 0xf84e07bf, - 0xf7480a6a, - 0x03b2f608, - 0xf9d6fba4, - 0x0c6afc2d, - 0x08b8f6f8, - 0x01060759, - 0x062a0000, - 0xfefa0759, - 0x08b80908, - 0xf396fc2d, - 0xf9d6045c, - 0xfc4ef608, - 0xf748f596, - 0x07b207bf, - 0x062a062a, - 0xf84ef841, - 0xf748f596, - 0x03b209f8, - 0xf9d6045c, - 0x0c6a03d3, - 0x08b80908, - 0x0106f8a7, - 0x062a0000, - 0xfefaf8a7, - 0x08b8f6f8, - 0xf39603d3, - 0xf9d6fba4, - 0xfc4e09f8, - 0xf7480a6a, - 0x07b2f841, - 0x062af9d6, - 0xf84e07bf, - 0xf7480a6a, - 0x03b2f608, - 0xf9d6fba4, - 0x0c6afc2d, - 0x08b8f6f8, - 0x01060759, - 0x061c061c, - 0xff30009d, - 0xffb21141, - 0xfd87fb54, - 0xf65dfe59, - 0x02eef99e, - 0x0166f03c, - 0xfff809b6, - 0x000008a4, - 0x000af42b, - 0x00eff577, - 0xfa840bf2, - 0xfc02ff51, - 0x08260f67, - 0xfff0036f, - 0x0842f9c3, - 0x00000000, - 0x063df7be, - 0xfc910010, - 0xf099f7da, - 0x00af03fe, - 0xf40e057c, - 0x0a89ff11, - 0x0bd5fff6, - 0xf75c0000, - 0xf64a0008, - 0x0fc4fe9a, - 0x0662fd12, - 0x01a709a3, - 0x04ac0279, - 0xeebf004e, - 0xff6300d0, - 0xf9e4f9e4, - 0x00d0ff63, - 0x004eeebf, - 0x027904ac, - 0x09a301a7, - 0xfd120662, - 0xfe9a0fc4, - 0x0008f64a, - 0x0000f75c, - 0xfff60bd5, - 0xff110a89, - 0x057cf40e, - 0x03fe00af, - 0xf7daf099, - 0x0010fc91, - 0xf7be063d, - 0x00000000, - 0xf9c30842, - 0x036ffff0, - 0x0f670826, - 0xff51fc02, - 0x0bf2fa84, - 0xf57700ef, - 0xf42b000a, - 0x08a40000, - 0x09b6fff8, - 0xf03c0166, - 0xf99e02ee, - 0xfe59f65d, - 0xfb54fd87, - 0x1141ffb2, - 0x009dff30, - 0x05e30000, - 0xff060705, - 0x085408a0, - 0xf425fc59, - 0xfa1d042a, - 0xfc78f67a, - 0xf7acf60e, - 0x075a0766, - 0x05e305e3, - 0xf8a6f89a, - 0xf7acf60e, - 0x03880986, - 0xfa1d042a, - 0x0bdb03a7, - 0x085408a0, - 0x00faf8fb, - 0x05e30000, - 0xff06f8fb, - 0x0854f760, - 0xf42503a7, - 0xfa1dfbd6, - 0xfc780986, - 0xf7ac09f2, - 0x075af89a, - 0x05e3fa1d, - 0xf8a60766, - 0xf7ac09f2, - 0x0388f67a, - 0xfa1dfbd6, - 0x0bdbfc59, - 0x0854f760, - 0x00fa0705, - 0x05e30000, - 0xff060705, - 0x085408a0, - 0xf425fc59, - 0xfa1d042a, - 0xfc78f67a, - 0xf7acf60e, - 0x075a0766, - 0x05e305e3, - 0xf8a6f89a, - 0xf7acf60e, - 0x03880986, - 0xfa1d042a, - 0x0bdb03a7, - 0x085408a0, - 0x00faf8fb, - 0x05e30000, - 0xff06f8fb, - 0x0854f760, - 0xf42503a7, - 0xfa1dfbd6, - 0xfc780986, - 0xf7ac09f2, - 0x075af89a, - 0x05e3fa1d, - 0xf8a60766, - 0xf7ac09f2, - 0x0388f67a, - 0xfa1dfbd6, - 0x0bdbfc59, - 0x0854f760, - 0x00fa0705, - 0xfa58fa58, - 0xf8f0fe00, - 0x0448073d, - 0xfdc9fe46, - 0xf9910258, - 0x089d0407, - 0xfd5cf71a, - 0x02affde0, - 0x083e0496, - 0xff5a0740, - 0xff7afd97, - 0x00fe01f1, - 0x0009082e, - 0xfa94ff75, - 0xfecdf8ea, - 0xffb0f693, - 0xfd2cfa58, - 0x0433ff16, - 0xfba405dd, - 0xfa610341, - 0x06a606cb, - 0x0039fd2d, - 0x0677fa97, - 0x01fa05e0, - 0xf896003e, - 0x075a068b, - 0x012cfc3e, - 0xfa23f98d, - 0xfc7cfd43, - 0xff90fc0d, - 0x01c10982, - 0x00c601d6, - 0xfd2cfd2c, - 0x01d600c6, - 0x098201c1, - 0xfc0dff90, - 0xfd43fc7c, - 0xf98dfa23, - 0xfc3e012c, - 0x068b075a, - 0x003ef896, - 0x05e001fa, - 0xfa970677, - 0xfd2d0039, - 0x06cb06a6, - 0x0341fa61, - 0x05ddfba4, - 0xff160433, - 0xfa58fd2c, - 0xf693ffb0, - 0xf8eafecd, - 0xff75fa94, - 0x082e0009, - 0x01f100fe, - 0xfd97ff7a, - 0x0740ff5a, - 0x0496083e, - 0xfde002af, - 0xf71afd5c, - 0x0407089d, - 0x0258f991, - 0xfe46fdc9, - 0x073d0448, - 0xfe00f8f0, - 0xfd2cfd2c, - 0xfce00500, - 0xfc09fddc, - 0xfe680157, - 0x04c70571, - 0xfc3aff21, - 0xfcd70228, - 0x056d0277, - 0x0200fe00, - 0x0022f927, - 0xfe3c032b, - 0xfc44ff3c, - 0x03e9fbdb, - 0x04570313, - 0x04c9ff5c, - 0x000d03b8, - 0xfa580000, - 0xfbe900d2, - 0xf9d0fe0b, - 0x0125fdf9, - 0x042501bf, - 0x0328fa2b, - 0xffa902f0, - 0xfa250157, - 0x0200fe00, - 0x03740438, - 0xff0405fd, - 0x030cfe52, - 0x0037fb39, - 0xff6904c5, - 0x04f8fd23, - 0xfd31fc1b, - 0xfd2cfd2c, - 0xfc1bfd31, - 0xfd2304f8, - 0x04c5ff69, - 0xfb390037, - 0xfe52030c, - 0x05fdff04, - 0x04380374, - 0xfe000200, - 0x0157fa25, - 0x02f0ffa9, - 0xfa2b0328, - 0x01bf0425, - 0xfdf90125, - 0xfe0bf9d0, - 0x00d2fbe9, - 0x0000fa58, - 0x03b8000d, - 0xff5c04c9, - 0x03130457, - 0xfbdb03e9, - 0xff3cfc44, - 0x032bfe3c, - 0xf9270022, - 0xfe000200, - 0x0277056d, - 0x0228fcd7, - 0xff21fc3a, - 0x057104c7, - 0x0157fe68, - 0xfddcfc09, - 0x0500fce0, - 0xfd2cfd2c, - 0x0500fce0, - 0xfddcfc09, - 0x0157fe68, - 0x057104c7, - 0xff21fc3a, - 0x0228fcd7, - 0x0277056d, - 0xfe000200, - 0xf9270022, - 0x032bfe3c, - 0xff3cfc44, - 0xfbdb03e9, - 0x03130457, - 0xff5c04c9, - 0x03b8000d, - 0x0000fa58, - 0x00d2fbe9, - 0xfe0bf9d0, - 0xfdf90125, - 0x01bf0425, - 0xfa2b0328, - 0x02f0ffa9, - 0x0157fa25, - 0xfe000200, - 0x04380374, - 0x05fdff04, - 0xfe52030c, - 0xfb390037, - 0x04c5ff69, - 0xfd2304f8, - 0xfc1bfd31, - 0xfd2cfd2c, - 0xfd31fc1b, - 0x04f8fd23, - 0xff6904c5, - 0x0037fb39, - 0x030cfe52, - 0xff0405fd, - 0x03740438, - 0x0200fe00, - 0xfa250157, - 0xffa902f0, - 0x0328fa2b, - 0x042501bf, - 0x0125fdf9, - 0xf9d0fe0b, - 0xfbe900d2, - 0xfa580000, - 0x000d03b8, - 0x04c9ff5c, - 0x04570313, - 0x03e9fbdb, - 0xfc44ff3c, - 0xfe3c032b, - 0x0022f927, - 0x0200fe00, - 0x056d0277, - 0xfcd70228, - 0xfc3aff21, - 0x04c70571, - 0xfe680157, - 0xfc09fddc, - 0xfce00500, - 0x05a80000, - 0xff1006be, - 0x0800084a, - 0xf49cfc7e, - 0xfa580400, - 0xfc9cf6da, - 0xf800f672, - 0x0710071c, - 0x05a805a8, - 0xf8f0f8e4, - 0xf800f672, - 0x03640926, - 0xfa580400, - 0x0b640382, - 0x0800084a, - 0x00f0f942, - 0x05a80000, - 0xff10f942, - 0x0800f7b6, - 0xf49c0382, - 0xfa58fc00, - 0xfc9c0926, - 0xf800098e, - 0x0710f8e4, - 0x05a8fa58, - 0xf8f0071c, - 0xf800098e, - 0x0364f6da, - 0xfa58fc00, - 0x0b64fc7e, - 0x0800f7b6, - 0x00f006be, - 0x05a80000, - 0xff1006be, - 0x0800084a, - 0xf49cfc7e, - 0xfa580400, - 0xfc9cf6da, - 0xf800f672, - 0x0710071c, - 0x05a805a8, - 0xf8f0f8e4, - 0xf800f672, - 0x03640926, - 0xfa580400, - 0x0b640382, - 0x0800084a, - 0x00f0f942, - 0x05a80000, - 0xff10f942, - 0x0800f7b6, - 0xf49c0382, - 0xfa58fc00, - 0xfc9c0926, - 0xf800098e, - 0x0710f8e4, - 0x05a8fa58, - 0xf8f0071c, - 0xf800098e, - 0x0364f6da, - 0xfa58fc00, - 0x0b64fc7e, - 0x0800f7b6, - 0x00f006be, -}; - -static const u32 intlv_tbl_rev0[] = { - 0x00802070, - 0x0671188d, - 0x0a60192c, - 0x0a300e46, - 0x00c1188d, - 0x080024d2, - 0x00000070, -}; - -static const u16 pilot_tbl_rev0[] = { - 0xff08, - 0xff08, - 0xff08, - 0xff08, - 0xff08, - 0xff08, - 0xff08, - 0xff08, - 0x80d5, - 0x80d5, - 0x80d5, - 0x80d5, - 0x80d5, - 0x80d5, - 0x80d5, - 0x80d5, - 0xff0a, - 0xff82, - 0xffa0, - 0xff28, - 0xffff, - 0xffff, - 0xffff, - 0xffff, - 0xff82, - 0xffa0, - 0xff28, - 0xff0a, - 0xffff, - 0xffff, - 0xffff, - 0xffff, - 0xf83f, - 0xfa1f, - 0xfa97, - 0xfab5, - 0xf2bd, - 0xf0bf, - 0xffff, - 0xffff, - 0xf017, - 0xf815, - 0xf215, - 0xf095, - 0xf035, - 0xf01d, - 0xffff, - 0xffff, - 0xff08, - 0xff02, - 0xff80, - 0xff20, - 0xff08, - 0xff02, - 0xff80, - 0xff20, - 0xf01f, - 0xf817, - 0xfa15, - 0xf295, - 0xf0b5, - 0xf03d, - 0xffff, - 0xffff, - 0xf82a, - 0xfa0a, - 0xfa82, - 0xfaa0, - 0xf2a8, - 0xf0aa, - 0xffff, - 0xffff, - 0xf002, - 0xf800, - 0xf200, - 0xf080, - 0xf020, - 0xf008, - 0xffff, - 0xffff, - 0xf00a, - 0xf802, - 0xfa00, - 0xf280, - 0xf0a0, - 0xf028, - 0xffff, - 0xffff, -}; - -static const u32 pltlut_tbl_rev0[] = { - 0x76540123, - 0x62407351, - 0x76543201, - 0x76540213, - 0x76540123, - 0x76430521, -}; - -static const u32 tdi_tbl20_ant0_rev0[] = { - 0x00091226, - 0x000a1429, - 0x000b56ad, - 0x000c58b0, - 0x000d5ab3, - 0x000e9cb6, - 0x000f9eba, - 0x0000c13d, - 0x00020301, - 0x00030504, - 0x00040708, - 0x0005090b, - 0x00064b8e, - 0x00095291, - 0x000a5494, - 0x000b9718, - 0x000c9927, - 0x000d9b2a, - 0x000edd2e, - 0x000fdf31, - 0x000101b4, - 0x000243b7, - 0x000345bb, - 0x000447be, - 0x00058982, - 0x00068c05, - 0x00099309, - 0x000a950c, - 0x000bd78f, - 0x000cd992, - 0x000ddb96, - 0x000f1d99, - 0x00005fa8, - 0x0001422c, - 0x0002842f, - 0x00038632, - 0x00048835, - 0x0005ca38, - 0x0006ccbc, - 0x0009d3bf, - 0x000b1603, - 0x000c1806, - 0x000d1a0a, - 0x000e1c0d, - 0x000f5e10, - 0x00008093, - 0x00018297, - 0x0002c49a, - 0x0003c680, - 0x0004c880, - 0x00060b00, - 0x00070d00, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -static const u32 tdi_tbl20_ant1_rev0[] = { - 0x00014b26, - 0x00028d29, - 0x000393ad, - 0x00049630, - 0x0005d833, - 0x0006da36, - 0x00099c3a, - 0x000a9e3d, - 0x000bc081, - 0x000cc284, - 0x000dc488, - 0x000f068b, - 0x0000488e, - 0x00018b91, - 0x0002d214, - 0x0003d418, - 0x0004d6a7, - 0x000618aa, - 0x00071aae, - 0x0009dcb1, - 0x000b1eb4, - 0x000c0137, - 0x000d033b, - 0x000e053e, - 0x000f4702, - 0x00008905, - 0x00020c09, - 0x0003128c, - 0x0004148f, - 0x00051712, - 0x00065916, - 0x00091b19, - 0x000a1d28, - 0x000b5f2c, - 0x000c41af, - 0x000d43b2, - 0x000e85b5, - 0x000f87b8, - 0x0000c9bc, - 0x00024cbf, - 0x00035303, - 0x00045506, - 0x0005978a, - 0x0006998d, - 0x00095b90, - 0x000a5d93, - 0x000b9f97, - 0x000c821a, - 0x000d8400, - 0x000ec600, - 0x000fc800, - 0x00010a00, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -static const u32 tdi_tbl40_ant0_rev0[] = { - 0x0011a346, - 0x00136ccf, - 0x0014f5d9, - 0x001641e2, - 0x0017cb6b, - 0x00195475, - 0x001b2383, - 0x001cad0c, - 0x001e7616, - 0x0000821f, - 0x00020ba8, - 0x0003d4b2, - 0x00056447, - 0x00072dd0, - 0x0008b6da, - 0x000a02e3, - 0x000b8c6c, - 0x000d15f6, - 0x0011e484, - 0x0013ae0d, - 0x00153717, - 0x00168320, - 0x00180ca9, - 0x00199633, - 0x001b6548, - 0x001ceed1, - 0x001eb7db, - 0x0000c3e4, - 0x00024d6d, - 0x000416f7, - 0x0005a585, - 0x00076f0f, - 0x0008f818, - 0x000a4421, - 0x000bcdab, - 0x000d9734, - 0x00122649, - 0x0013efd2, - 0x001578dc, - 0x0016c4e5, - 0x00184e6e, - 0x001a17f8, - 0x001ba686, - 0x001d3010, - 0x001ef999, - 0x00010522, - 0x00028eac, - 0x00045835, - 0x0005e74a, - 0x0007b0d3, - 0x00093a5d, - 0x000a85e6, - 0x000c0f6f, - 0x000dd8f9, - 0x00126787, - 0x00143111, - 0x0015ba9a, - 0x00170623, - 0x00188fad, - 0x001a5936, - 0x001be84b, - 0x001db1d4, - 0x001f3b5e, - 0x000146e7, - 0x00031070, - 0x000499fa, - 0x00062888, - 0x0007f212, - 0x00097b9b, - 0x000ac7a4, - 0x000c50ae, - 0x000e1a37, - 0x0012a94c, - 0x001472d5, - 0x0015fc5f, - 0x00174868, - 0x0018d171, - 0x001a9afb, - 0x001c2989, - 0x001df313, - 0x001f7c9c, - 0x000188a5, - 0x000351af, - 0x0004db38, - 0x0006aa4d, - 0x000833d7, - 0x0009bd60, - 0x000b0969, - 0x000c9273, - 0x000e5bfc, - 0x00132a8a, - 0x0014b414, - 0x00163d9d, - 0x001789a6, - 0x001912b0, - 0x001adc39, - 0x001c6bce, - 0x001e34d8, - 0x001fbe61, - 0x0001ca6a, - 0x00039374, - 0x00051cfd, - 0x0006ec0b, - 0x00087515, - 0x0009fe9e, - 0x000b4aa7, - 0x000cd3b1, - 0x000e9d3a, - 0x00000000, - 0x00000000, -}; - -static const u32 tdi_tbl40_ant1_rev0[] = { - 0x001edb36, - 0x000129ca, - 0x0002b353, - 0x00047cdd, - 0x0005c8e6, - 0x000791ef, - 0x00091bf9, - 0x000aaa07, - 0x000c3391, - 0x000dfd1a, - 0x00120923, - 0x0013d22d, - 0x00155c37, - 0x0016eacb, - 0x00187454, - 0x001a3dde, - 0x001b89e7, - 0x001d12f0, - 0x001f1cfa, - 0x00016b88, - 0x00033492, - 0x0004be1b, - 0x00060a24, - 0x0007d32e, - 0x00095d38, - 0x000aec4c, - 0x000c7555, - 0x000e3edf, - 0x00124ae8, - 0x001413f1, - 0x0015a37b, - 0x00172c89, - 0x0018b593, - 0x001a419c, - 0x001bcb25, - 0x001d942f, - 0x001f63b9, - 0x0001ad4d, - 0x00037657, - 0x0004c260, - 0x00068be9, - 0x000814f3, - 0x0009a47c, - 0x000b2d8a, - 0x000cb694, - 0x000e429d, - 0x00128c26, - 0x001455b0, - 0x0015e4ba, - 0x00176e4e, - 0x0018f758, - 0x001a8361, - 0x001c0cea, - 0x001dd674, - 0x001fa57d, - 0x0001ee8b, - 0x0003b795, - 0x0005039e, - 0x0006cd27, - 0x000856b1, - 0x0009e5c6, - 0x000b6f4f, - 0x000cf859, - 0x000e8462, - 0x00130deb, - 0x00149775, - 0x00162603, - 0x0017af8c, - 0x00193896, - 0x001ac49f, - 0x001c4e28, - 0x001e17b2, - 0x0000a6c7, - 0x00023050, - 0x0003f9da, - 0x00054563, - 0x00070eec, - 0x00089876, - 0x000a2704, - 0x000bb08d, - 0x000d3a17, - 0x001185a0, - 0x00134f29, - 0x0014d8b3, - 0x001667c8, - 0x0017f151, - 0x00197adb, - 0x001b0664, - 0x001c8fed, - 0x001e5977, - 0x0000e805, - 0x0002718f, - 0x00043b18, - 0x000586a1, - 0x0007502b, - 0x0008d9b4, - 0x000a68c9, - 0x000bf252, - 0x000dbbdc, - 0x0011c7e5, - 0x001390ee, - 0x00151a78, - 0x0016a906, - 0x00183290, - 0x0019bc19, - 0x001b4822, - 0x001cd12c, - 0x001e9ab5, - 0x00000000, - 0x00000000, -}; - -static const u16 bdi_tbl_rev0[] = { - 0x0070, - 0x0126, - 0x012c, - 0x0246, - 0x048d, - 0x04d2, -}; - -static const u32 chanest_tbl_rev0[] = { - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, -}; - -static const u8 mcs_tbl_rev0[] = { - 0x00, - 0x08, - 0x0a, - 0x10, - 0x12, - 0x19, - 0x1a, - 0x1c, - 0x40, - 0x48, - 0x4a, - 0x50, - 0x52, - 0x59, - 0x5a, - 0x5c, - 0x80, - 0x88, - 0x8a, - 0x90, - 0x92, - 0x99, - 0x9a, - 0x9c, - 0xc0, - 0xc8, - 0xca, - 0xd0, - 0xd2, - 0xd9, - 0xda, - 0xdc, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x01, - 0x02, - 0x04, - 0x08, - 0x09, - 0x0a, - 0x0c, - 0x10, - 0x11, - 0x12, - 0x14, - 0x18, - 0x19, - 0x1a, - 0x1c, - 0x20, - 0x21, - 0x22, - 0x24, - 0x40, - 0x41, - 0x42, - 0x44, - 0x48, - 0x49, - 0x4a, - 0x4c, - 0x50, - 0x51, - 0x52, - 0x54, - 0x58, - 0x59, - 0x5a, - 0x5c, - 0x60, - 0x61, - 0x62, - 0x64, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, -}; - -static const u32 noise_var_tbl0_rev0[] = { - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, -}; - -static const u32 noise_var_tbl1_rev0[] = { - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, -}; - -static const u8 est_pwr_lut_core0_rev0[] = { - 0x50, - 0x4f, - 0x4e, - 0x4d, - 0x4c, - 0x4b, - 0x4a, - 0x49, - 0x48, - 0x47, - 0x46, - 0x45, - 0x44, - 0x43, - 0x42, - 0x41, - 0x40, - 0x3f, - 0x3e, - 0x3d, - 0x3c, - 0x3b, - 0x3a, - 0x39, - 0x38, - 0x37, - 0x36, - 0x35, - 0x34, - 0x33, - 0x32, - 0x31, - 0x30, - 0x2f, - 0x2e, - 0x2d, - 0x2c, - 0x2b, - 0x2a, - 0x29, - 0x28, - 0x27, - 0x26, - 0x25, - 0x24, - 0x23, - 0x22, - 0x21, - 0x20, - 0x1f, - 0x1e, - 0x1d, - 0x1c, - 0x1b, - 0x1a, - 0x19, - 0x18, - 0x17, - 0x16, - 0x15, - 0x14, - 0x13, - 0x12, - 0x11, -}; - -static const u8 est_pwr_lut_core1_rev0[] = { - 0x50, - 0x4f, - 0x4e, - 0x4d, - 0x4c, - 0x4b, - 0x4a, - 0x49, - 0x48, - 0x47, - 0x46, - 0x45, - 0x44, - 0x43, - 0x42, - 0x41, - 0x40, - 0x3f, - 0x3e, - 0x3d, - 0x3c, - 0x3b, - 0x3a, - 0x39, - 0x38, - 0x37, - 0x36, - 0x35, - 0x34, - 0x33, - 0x32, - 0x31, - 0x30, - 0x2f, - 0x2e, - 0x2d, - 0x2c, - 0x2b, - 0x2a, - 0x29, - 0x28, - 0x27, - 0x26, - 0x25, - 0x24, - 0x23, - 0x22, - 0x21, - 0x20, - 0x1f, - 0x1e, - 0x1d, - 0x1c, - 0x1b, - 0x1a, - 0x19, - 0x18, - 0x17, - 0x16, - 0x15, - 0x14, - 0x13, - 0x12, - 0x11, -}; - -static const u8 adj_pwr_lut_core0_rev0[] = { - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, -}; - -static const u8 adj_pwr_lut_core1_rev0[] = { - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, -}; - -static const u32 gainctrl_lut_core0_rev0[] = { - 0x03cc2b44, - 0x03cc2b42, - 0x03cc2b40, - 0x03cc2b3e, - 0x03cc2b3d, - 0x03cc2b3b, - 0x03c82b44, - 0x03c82b42, - 0x03c82b40, - 0x03c82b3e, - 0x03c82b3d, - 0x03c82b3b, - 0x03c82b39, - 0x03c82b38, - 0x03c82b36, - 0x03c82b34, - 0x03c42b44, - 0x03c42b42, - 0x03c42b40, - 0x03c42b3e, - 0x03c42b3d, - 0x03c42b3b, - 0x03c42b39, - 0x03c42b38, - 0x03c42b36, - 0x03c42b34, - 0x03c42b33, - 0x03c42b32, - 0x03c42b30, - 0x03c42b2f, - 0x03c42b2d, - 0x03c02b44, - 0x03c02b42, - 0x03c02b40, - 0x03c02b3e, - 0x03c02b3d, - 0x03c02b3b, - 0x03c02b39, - 0x03c02b38, - 0x03c02b36, - 0x03c02b34, - 0x03b02b44, - 0x03b02b42, - 0x03b02b40, - 0x03b02b3e, - 0x03b02b3d, - 0x03b02b3b, - 0x03b02b39, - 0x03b02b38, - 0x03b02b36, - 0x03b02b34, - 0x03b02b33, - 0x03b02b32, - 0x03b02b30, - 0x03b02b2f, - 0x03b02b2d, - 0x03a02b44, - 0x03a02b42, - 0x03a02b40, - 0x03a02b3e, - 0x03a02b3d, - 0x03a02b3b, - 0x03a02b39, - 0x03a02b38, - 0x03a02b36, - 0x03a02b34, - 0x03902b44, - 0x03902b42, - 0x03902b40, - 0x03902b3e, - 0x03902b3d, - 0x03902b3b, - 0x03902b39, - 0x03902b38, - 0x03902b36, - 0x03902b34, - 0x03902b33, - 0x03902b32, - 0x03902b30, - 0x03802b44, - 0x03802b42, - 0x03802b40, - 0x03802b3e, - 0x03802b3d, - 0x03802b3b, - 0x03802b39, - 0x03802b38, - 0x03802b36, - 0x03802b34, - 0x03802b33, - 0x03802b32, - 0x03802b30, - 0x03802b2f, - 0x03802b2d, - 0x03802b2c, - 0x03802b2b, - 0x03802b2a, - 0x03802b29, - 0x03802b27, - 0x03802b26, - 0x03802b25, - 0x03802b24, - 0x03802b23, - 0x03802b22, - 0x03802b21, - 0x03802b20, - 0x03802b1f, - 0x03802b1e, - 0x03802b1e, - 0x03802b1d, - 0x03802b1c, - 0x03802b1b, - 0x03802b1a, - 0x03802b1a, - 0x03802b19, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x00002b00, -}; - -static const u32 gainctrl_lut_core1_rev0[] = { - 0x03cc2b44, - 0x03cc2b42, - 0x03cc2b40, - 0x03cc2b3e, - 0x03cc2b3d, - 0x03cc2b3b, - 0x03c82b44, - 0x03c82b42, - 0x03c82b40, - 0x03c82b3e, - 0x03c82b3d, - 0x03c82b3b, - 0x03c82b39, - 0x03c82b38, - 0x03c82b36, - 0x03c82b34, - 0x03c42b44, - 0x03c42b42, - 0x03c42b40, - 0x03c42b3e, - 0x03c42b3d, - 0x03c42b3b, - 0x03c42b39, - 0x03c42b38, - 0x03c42b36, - 0x03c42b34, - 0x03c42b33, - 0x03c42b32, - 0x03c42b30, - 0x03c42b2f, - 0x03c42b2d, - 0x03c02b44, - 0x03c02b42, - 0x03c02b40, - 0x03c02b3e, - 0x03c02b3d, - 0x03c02b3b, - 0x03c02b39, - 0x03c02b38, - 0x03c02b36, - 0x03c02b34, - 0x03b02b44, - 0x03b02b42, - 0x03b02b40, - 0x03b02b3e, - 0x03b02b3d, - 0x03b02b3b, - 0x03b02b39, - 0x03b02b38, - 0x03b02b36, - 0x03b02b34, - 0x03b02b33, - 0x03b02b32, - 0x03b02b30, - 0x03b02b2f, - 0x03b02b2d, - 0x03a02b44, - 0x03a02b42, - 0x03a02b40, - 0x03a02b3e, - 0x03a02b3d, - 0x03a02b3b, - 0x03a02b39, - 0x03a02b38, - 0x03a02b36, - 0x03a02b34, - 0x03902b44, - 0x03902b42, - 0x03902b40, - 0x03902b3e, - 0x03902b3d, - 0x03902b3b, - 0x03902b39, - 0x03902b38, - 0x03902b36, - 0x03902b34, - 0x03902b33, - 0x03902b32, - 0x03902b30, - 0x03802b44, - 0x03802b42, - 0x03802b40, - 0x03802b3e, - 0x03802b3d, - 0x03802b3b, - 0x03802b39, - 0x03802b38, - 0x03802b36, - 0x03802b34, - 0x03802b33, - 0x03802b32, - 0x03802b30, - 0x03802b2f, - 0x03802b2d, - 0x03802b2c, - 0x03802b2b, - 0x03802b2a, - 0x03802b29, - 0x03802b27, - 0x03802b26, - 0x03802b25, - 0x03802b24, - 0x03802b23, - 0x03802b22, - 0x03802b21, - 0x03802b20, - 0x03802b1f, - 0x03802b1e, - 0x03802b1e, - 0x03802b1d, - 0x03802b1c, - 0x03802b1b, - 0x03802b1a, - 0x03802b1a, - 0x03802b19, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x03802b18, - 0x00002b00, -}; - -static const u32 iq_lut_core0_rev0[] = { - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, -}; - -static const u32 iq_lut_core1_rev0[] = { - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, - 0x0000007f, -}; - -static const u16 loft_lut_core0_rev0[] = { - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, -}; - -static const u16 loft_lut_core1_rev0[] = { - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, - 0x0000, - 0x0101, - 0x0002, - 0x0103, -}; - -const struct phytbl_info mimophytbl_info_rev0_volatile[] = { - {&bdi_tbl_rev0, sizeof(bdi_tbl_rev0) / sizeof(bdi_tbl_rev0[0]), 21, 0, - 16} - , - {&pltlut_tbl_rev0, sizeof(pltlut_tbl_rev0) / sizeof(pltlut_tbl_rev0[0]), - 20, 0, 32} - , - {&gainctrl_lut_core0_rev0, - sizeof(gainctrl_lut_core0_rev0) / sizeof(gainctrl_lut_core0_rev0[0]), - 26, 192, 32} - , - {&gainctrl_lut_core1_rev0, - sizeof(gainctrl_lut_core1_rev0) / sizeof(gainctrl_lut_core1_rev0[0]), - 27, 192, 32} - , - - {&est_pwr_lut_core0_rev0, - sizeof(est_pwr_lut_core0_rev0) / sizeof(est_pwr_lut_core0_rev0[0]), 26, - 0, 8} - , - {&est_pwr_lut_core1_rev0, - sizeof(est_pwr_lut_core1_rev0) / sizeof(est_pwr_lut_core1_rev0[0]), 27, - 0, 8} - , - {&adj_pwr_lut_core0_rev0, - sizeof(adj_pwr_lut_core0_rev0) / sizeof(adj_pwr_lut_core0_rev0[0]), 26, - 64, 8} - , - {&adj_pwr_lut_core1_rev0, - sizeof(adj_pwr_lut_core1_rev0) / sizeof(adj_pwr_lut_core1_rev0[0]), 27, - 64, 8} - , - {&iq_lut_core0_rev0, - sizeof(iq_lut_core0_rev0) / sizeof(iq_lut_core0_rev0[0]), 26, 320, 32} - , - {&iq_lut_core1_rev0, - sizeof(iq_lut_core1_rev0) / sizeof(iq_lut_core1_rev0[0]), 27, 320, 32} - , - {&loft_lut_core0_rev0, - sizeof(loft_lut_core0_rev0) / sizeof(loft_lut_core0_rev0[0]), 26, 448, - 16} - , - {&loft_lut_core1_rev0, - sizeof(loft_lut_core1_rev0) / sizeof(loft_lut_core1_rev0[0]), 27, 448, - 16} - , -}; - -const struct phytbl_info mimophytbl_info_rev0[] = { - {&frame_struct_rev0, - sizeof(frame_struct_rev0) / sizeof(frame_struct_rev0[0]), 10, 0, 32} - , - {&frame_lut_rev0, sizeof(frame_lut_rev0) / sizeof(frame_lut_rev0[0]), - 24, 0, 8} - , - {&tmap_tbl_rev0, sizeof(tmap_tbl_rev0) / sizeof(tmap_tbl_rev0[0]), 12, - 0, 32} - , - {&tdtrn_tbl_rev0, sizeof(tdtrn_tbl_rev0) / sizeof(tdtrn_tbl_rev0[0]), - 14, 0, 32} - , - {&intlv_tbl_rev0, sizeof(intlv_tbl_rev0) / sizeof(intlv_tbl_rev0[0]), - 13, 0, 32} - , - {&pilot_tbl_rev0, sizeof(pilot_tbl_rev0) / sizeof(pilot_tbl_rev0[0]), - 11, 0, 16} - , - {&tdi_tbl20_ant0_rev0, - sizeof(tdi_tbl20_ant0_rev0) / sizeof(tdi_tbl20_ant0_rev0[0]), 19, 128, - 32} - , - {&tdi_tbl20_ant1_rev0, - sizeof(tdi_tbl20_ant1_rev0) / sizeof(tdi_tbl20_ant1_rev0[0]), 19, 256, - 32} - , - {&tdi_tbl40_ant0_rev0, - sizeof(tdi_tbl40_ant0_rev0) / sizeof(tdi_tbl40_ant0_rev0[0]), 19, 640, - 32} - , - {&tdi_tbl40_ant1_rev0, - sizeof(tdi_tbl40_ant1_rev0) / sizeof(tdi_tbl40_ant1_rev0[0]), 19, 768, - 32} - , - {&chanest_tbl_rev0, - sizeof(chanest_tbl_rev0) / sizeof(chanest_tbl_rev0[0]), 22, 0, 32} - , - {&mcs_tbl_rev0, sizeof(mcs_tbl_rev0) / sizeof(mcs_tbl_rev0[0]), 18, 0, - 8} - , - {&noise_var_tbl0_rev0, - sizeof(noise_var_tbl0_rev0) / sizeof(noise_var_tbl0_rev0[0]), 16, 0, - 32} - , - {&noise_var_tbl1_rev0, - sizeof(noise_var_tbl1_rev0) / sizeof(noise_var_tbl1_rev0[0]), 16, 128, - 32} - , -}; - -const u32 mimophytbl_info_sz_rev0 = - sizeof(mimophytbl_info_rev0) / sizeof(mimophytbl_info_rev0[0]); -const u32 mimophytbl_info_sz_rev0_volatile = - sizeof(mimophytbl_info_rev0_volatile) / - sizeof(mimophytbl_info_rev0_volatile[0]); - -static const u16 ant_swctrl_tbl_rev3[] = { - 0x0082, - 0x0082, - 0x0211, - 0x0222, - 0x0328, - 0x0000, - 0x0000, - 0x0000, - 0x0144, - 0x0000, - 0x0000, - 0x0000, - 0x0188, - 0x0000, - 0x0000, - 0x0000, - 0x0082, - 0x0082, - 0x0211, - 0x0222, - 0x0328, - 0x0000, - 0x0000, - 0x0000, - 0x0144, - 0x0000, - 0x0000, - 0x0000, - 0x0188, - 0x0000, - 0x0000, - 0x0000, -}; - -static const u16 ant_swctrl_tbl_rev3_1[] = { - 0x0022, - 0x0022, - 0x0011, - 0x0022, - 0x0022, - 0x0000, - 0x0000, - 0x0000, - 0x0011, - 0x0000, - 0x0000, - 0x0000, - 0x0022, - 0x0000, - 0x0000, - 0x0000, - 0x0022, - 0x0022, - 0x0011, - 0x0022, - 0x0022, - 0x0000, - 0x0000, - 0x0000, - 0x0011, - 0x0000, - 0x0000, - 0x0000, - 0x0022, - 0x0000, - 0x0000, - 0x0000, -}; - -static const u16 ant_swctrl_tbl_rev3_2[] = { - 0x0088, - 0x0088, - 0x0044, - 0x0088, - 0x0088, - 0x0000, - 0x0000, - 0x0000, - 0x0044, - 0x0000, - 0x0000, - 0x0000, - 0x0088, - 0x0000, - 0x0000, - 0x0000, - 0x0088, - 0x0088, - 0x0044, - 0x0088, - 0x0088, - 0x0000, - 0x0000, - 0x0000, - 0x0044, - 0x0000, - 0x0000, - 0x0000, - 0x0088, - 0x0000, - 0x0000, - 0x0000, -}; - -static const u16 ant_swctrl_tbl_rev3_3[] = { - 0x022, - 0x022, - 0x011, - 0x022, - 0x000, - 0x000, - 0x000, - 0x000, - 0x011, - 0x000, - 0x000, - 0x000, - 0x022, - 0x000, - 0x000, - 0x3cc, - 0x022, - 0x022, - 0x011, - 0x022, - 0x000, - 0x000, - 0x000, - 0x000, - 0x011, - 0x000, - 0x000, - 0x000, - 0x022, - 0x000, - 0x000, - 0x3cc -}; - -static const u32 frame_struct_rev3[] = { - 0x08004a04, - 0x00100000, - 0x01000a05, - 0x00100020, - 0x09804506, - 0x00100030, - 0x09804507, - 0x00100030, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x08004a0c, - 0x00100004, - 0x01000a0d, - 0x00100024, - 0x0980450e, - 0x00100034, - 0x0980450f, - 0x00100034, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000a04, - 0x00100000, - 0x11008a05, - 0x00100020, - 0x1980c506, - 0x00100030, - 0x21810506, - 0x00100030, - 0x21810506, - 0x00100030, - 0x01800504, - 0x00100030, - 0x11808505, - 0x00100030, - 0x29814507, - 0x01100030, - 0x00000a04, - 0x00100000, - 0x11008a05, - 0x00100020, - 0x21810506, - 0x00100030, - 0x21810506, - 0x00100030, - 0x29814507, - 0x01100030, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000a0c, - 0x00100008, - 0x11008a0d, - 0x00100028, - 0x1980c50e, - 0x00100038, - 0x2181050e, - 0x00100038, - 0x2181050e, - 0x00100038, - 0x0180050c, - 0x00100038, - 0x1180850d, - 0x00100038, - 0x2981450f, - 0x01100038, - 0x00000a0c, - 0x00100008, - 0x11008a0d, - 0x00100028, - 0x2181050e, - 0x00100038, - 0x2181050e, - 0x00100038, - 0x2981450f, - 0x01100038, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x08004a04, - 0x00100000, - 0x01000a05, - 0x00100020, - 0x1980c506, - 0x00100030, - 0x1980c506, - 0x00100030, - 0x11808504, - 0x00100030, - 0x3981ca05, - 0x00100030, - 0x29814507, - 0x01100030, - 0x00000000, - 0x00000000, - 0x10008a04, - 0x00100000, - 0x3981ca05, - 0x00100030, - 0x1980c506, - 0x00100030, - 0x29814507, - 0x01100030, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x08004a0c, - 0x00100008, - 0x01000a0d, - 0x00100028, - 0x1980c50e, - 0x00100038, - 0x1980c50e, - 0x00100038, - 0x1180850c, - 0x00100038, - 0x3981ca0d, - 0x00100038, - 0x2981450f, - 0x01100038, - 0x00000000, - 0x00000000, - 0x10008a0c, - 0x00100008, - 0x3981ca0d, - 0x00100038, - 0x1980c50e, - 0x00100038, - 0x2981450f, - 0x01100038, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x40021404, - 0x00100000, - 0x02001405, - 0x00100040, - 0x0b004a06, - 0x01900060, - 0x13008a06, - 0x01900060, - 0x13008a06, - 0x01900060, - 0x43020a04, - 0x00100060, - 0x1b00ca05, - 0x00100060, - 0x23010a07, - 0x01500060, - 0x40021404, - 0x00100000, - 0x1a00d405, - 0x00100040, - 0x13008a06, - 0x01900060, - 0x13008a06, - 0x01900060, - 0x23010a07, - 0x01500060, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x4002140c, - 0x00100010, - 0x0200140d, - 0x00100050, - 0x0b004a0e, - 0x01900070, - 0x13008a0e, - 0x01900070, - 0x13008a0e, - 0x01900070, - 0x43020a0c, - 0x00100070, - 0x1b00ca0d, - 0x00100070, - 0x23010a0f, - 0x01500070, - 0x4002140c, - 0x00100010, - 0x1a00d40d, - 0x00100050, - 0x13008a0e, - 0x01900070, - 0x13008a0e, - 0x01900070, - 0x23010a0f, - 0x01500070, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x50029404, - 0x00100000, - 0x32019405, - 0x00100040, - 0x0b004a06, - 0x01900060, - 0x0b004a06, - 0x01900060, - 0x5b02ca04, - 0x00100060, - 0x3b01d405, - 0x00100060, - 0x23010a07, - 0x01500060, - 0x00000000, - 0x00000000, - 0x5802d404, - 0x00100000, - 0x3b01d405, - 0x00100060, - 0x0b004a06, - 0x01900060, - 0x23010a07, - 0x01500060, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x5002940c, - 0x00100010, - 0x3201940d, - 0x00100050, - 0x0b004a0e, - 0x01900070, - 0x0b004a0e, - 0x01900070, - 0x5b02ca0c, - 0x00100070, - 0x3b01d40d, - 0x00100070, - 0x23010a0f, - 0x01500070, - 0x00000000, - 0x00000000, - 0x5802d40c, - 0x00100010, - 0x3b01d40d, - 0x00100070, - 0x0b004a0e, - 0x01900070, - 0x23010a0f, - 0x01500070, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x40021404, - 0x000f4800, - 0x62031405, - 0x00100040, - 0x53028a06, - 0x01900060, - 0x53028a07, - 0x01900060, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x4002140c, - 0x000f4808, - 0x6203140d, - 0x00100048, - 0x53028a0e, - 0x01900068, - 0x53028a0f, - 0x01900068, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000a0c, - 0x00100004, - 0x11008a0d, - 0x00100024, - 0x1980c50e, - 0x00100034, - 0x2181050e, - 0x00100034, - 0x2181050e, - 0x00100034, - 0x0180050c, - 0x00100038, - 0x1180850d, - 0x00100038, - 0x1181850d, - 0x00100038, - 0x2981450f, - 0x01100038, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000a0c, - 0x00100008, - 0x11008a0d, - 0x00100028, - 0x2181050e, - 0x00100038, - 0x2181050e, - 0x00100038, - 0x1181850d, - 0x00100038, - 0x2981450f, - 0x01100038, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x08004a04, - 0x00100000, - 0x01000a05, - 0x00100020, - 0x0180c506, - 0x00100030, - 0x0180c506, - 0x00100030, - 0x2180c50c, - 0x00100030, - 0x49820a0d, - 0x0016a130, - 0x41824a0d, - 0x0016a130, - 0x2981450f, - 0x01100030, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x2000ca0c, - 0x00100000, - 0x49820a0d, - 0x0016a130, - 0x1980c50e, - 0x00100030, - 0x41824a0d, - 0x0016a130, - 0x2981450f, - 0x01100030, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x4002140c, - 0x00100008, - 0x0200140d, - 0x00100048, - 0x0b004a0e, - 0x01900068, - 0x13008a0e, - 0x01900068, - 0x13008a0e, - 0x01900068, - 0x43020a0c, - 0x00100070, - 0x1b00ca0d, - 0x00100070, - 0x1b014a0d, - 0x00100070, - 0x23010a0f, - 0x01500070, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x4002140c, - 0x00100010, - 0x1a00d40d, - 0x00100050, - 0x13008a0e, - 0x01900070, - 0x13008a0e, - 0x01900070, - 0x1b014a0d, - 0x00100070, - 0x23010a0f, - 0x01500070, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x50029404, - 0x00100000, - 0x32019405, - 0x00100040, - 0x03004a06, - 0x01900060, - 0x03004a06, - 0x01900060, - 0x6b030a0c, - 0x00100060, - 0x4b02140d, - 0x0016a160, - 0x4302540d, - 0x0016a160, - 0x23010a0f, - 0x01500060, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x6b03140c, - 0x00100060, - 0x4b02140d, - 0x0016a160, - 0x0b004a0e, - 0x01900060, - 0x4302540d, - 0x0016a160, - 0x23010a0f, - 0x01500060, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x40021404, - 0x00100000, - 0x1a00d405, - 0x00100040, - 0x53028a06, - 0x01900060, - 0x5b02ca06, - 0x01900060, - 0x5b02ca06, - 0x01900060, - 0x43020a04, - 0x00100060, - 0x1b00ca05, - 0x00100060, - 0x53028a07, - 0x0190c060, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x4002140c, - 0x00100010, - 0x1a00d40d, - 0x00100050, - 0x53028a0e, - 0x01900070, - 0x5b02ca0e, - 0x01900070, - 0x5b02ca0e, - 0x01900070, - 0x43020a0c, - 0x00100070, - 0x1b00ca0d, - 0x00100070, - 0x53028a0f, - 0x0190c070, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x40021404, - 0x00100000, - 0x1a00d405, - 0x00100040, - 0x5b02ca06, - 0x01900060, - 0x5b02ca06, - 0x01900060, - 0x53028a07, - 0x0190c060, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x4002140c, - 0x00100010, - 0x1a00d40d, - 0x00100050, - 0x5b02ca0e, - 0x01900070, - 0x5b02ca0e, - 0x01900070, - 0x53028a0f, - 0x0190c070, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -static const u16 pilot_tbl_rev3[] = { - 0xff08, - 0xff08, - 0xff08, - 0xff08, - 0xff08, - 0xff08, - 0xff08, - 0xff08, - 0x80d5, - 0x80d5, - 0x80d5, - 0x80d5, - 0x80d5, - 0x80d5, - 0x80d5, - 0x80d5, - 0xff0a, - 0xff82, - 0xffa0, - 0xff28, - 0xffff, - 0xffff, - 0xffff, - 0xffff, - 0xff82, - 0xffa0, - 0xff28, - 0xff0a, - 0xffff, - 0xffff, - 0xffff, - 0xffff, - 0xf83f, - 0xfa1f, - 0xfa97, - 0xfab5, - 0xf2bd, - 0xf0bf, - 0xffff, - 0xffff, - 0xf017, - 0xf815, - 0xf215, - 0xf095, - 0xf035, - 0xf01d, - 0xffff, - 0xffff, - 0xff08, - 0xff02, - 0xff80, - 0xff20, - 0xff08, - 0xff02, - 0xff80, - 0xff20, - 0xf01f, - 0xf817, - 0xfa15, - 0xf295, - 0xf0b5, - 0xf03d, - 0xffff, - 0xffff, - 0xf82a, - 0xfa0a, - 0xfa82, - 0xfaa0, - 0xf2a8, - 0xf0aa, - 0xffff, - 0xffff, - 0xf002, - 0xf800, - 0xf200, - 0xf080, - 0xf020, - 0xf008, - 0xffff, - 0xffff, - 0xf00a, - 0xf802, - 0xfa00, - 0xf280, - 0xf0a0, - 0xf028, - 0xffff, - 0xffff, -}; - -static const u32 tmap_tbl_rev3[] = { - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0xf1111110, - 0x11111111, - 0x11f11111, - 0x00000111, - 0x11000000, - 0x1111f111, - 0x11111111, - 0x111111f1, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x000aa888, - 0x88880000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0xa1111110, - 0x11111111, - 0x11c11111, - 0x00000111, - 0x11000000, - 0x1111a111, - 0x11111111, - 0x111111a1, - 0xa2222220, - 0x22222222, - 0x22c22222, - 0x00000222, - 0x22000000, - 0x2222a222, - 0x22222222, - 0x222222a2, - 0xf1111110, - 0x11111111, - 0x11f11111, - 0x00011111, - 0x11110000, - 0x1111f111, - 0x11111111, - 0x111111f1, - 0xa8aa88a0, - 0xa88888a8, - 0xa8a8a88a, - 0x00088aaa, - 0xaaaa0000, - 0xa8a8aa88, - 0xa88aaaaa, - 0xaaaa8a8a, - 0xaaa8aaa0, - 0x8aaa8aaa, - 0xaa8a8a8a, - 0x000aaa88, - 0x8aaa0000, - 0xaaa8a888, - 0x8aa88a8a, - 0x8a88a888, - 0x08080a00, - 0x0a08080a, - 0x080a0a08, - 0x00080808, - 0x080a0000, - 0x080a0808, - 0x080a0808, - 0x0a0a0a08, - 0xa0a0a0a0, - 0x80a0a080, - 0x8080a0a0, - 0x00008080, - 0x80a00000, - 0x80a080a0, - 0xa080a0a0, - 0x8080a0a0, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x99999000, - 0x9b9b99bb, - 0x9bb99999, - 0x9999b9b9, - 0x9b99bb90, - 0x9bbbbb9b, - 0x9b9b9bb9, - 0x00000999, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00aaa888, - 0x22000000, - 0x2222b222, - 0x22222222, - 0x222222b2, - 0xb2222220, - 0x22222222, - 0x22d22222, - 0x00000222, - 0x11000000, - 0x1111a111, - 0x11111111, - 0x111111a1, - 0xa1111110, - 0x11111111, - 0x11c11111, - 0x00000111, - 0x33000000, - 0x3333b333, - 0x33333333, - 0x333333b3, - 0xb3333330, - 0x33333333, - 0x33d33333, - 0x00000333, - 0x22000000, - 0x2222a222, - 0x22222222, - 0x222222a2, - 0xa2222220, - 0x22222222, - 0x22c22222, - 0x00000222, - 0x99b99b00, - 0x9b9b99bb, - 0x9bb99999, - 0x9999b9b9, - 0x9b99bb99, - 0x9bbbbb9b, - 0x9b9b9bb9, - 0x00000999, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa88, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x08aaa888, - 0x22222200, - 0x2222f222, - 0x22222222, - 0x222222f2, - 0x22222222, - 0x22222222, - 0x22f22222, - 0x00000222, - 0x11000000, - 0x1111f111, - 0x11111111, - 0x11111111, - 0xf1111111, - 0x11111111, - 0x11f11111, - 0x01111111, - 0xbb9bb900, - 0xb9b9bb99, - 0xb99bbbbb, - 0xbbbb9b9b, - 0xb9bb99bb, - 0xb99999b9, - 0xb9b9b99b, - 0x00000bbb, - 0xaa000000, - 0xa8a8aa88, - 0xa88aaaaa, - 0xaaaa8a8a, - 0xa8aa88aa, - 0xa88888a8, - 0xa8a8a88a, - 0x0a888aaa, - 0xaa000000, - 0xa8a8aa88, - 0xa88aaaaa, - 0xaaaa8a8a, - 0xa8aa88a0, - 0xa88888a8, - 0xa8a8a88a, - 0x00000aaa, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0xbbbbbb00, - 0x999bbbbb, - 0x9bb99b9b, - 0xb9b9b9bb, - 0xb9b99bbb, - 0xb9b9b9bb, - 0xb9bb9b99, - 0x00000999, - 0x8a000000, - 0xaa88a888, - 0xa88888aa, - 0xa88a8a88, - 0xa88aa88a, - 0x88a8aaaa, - 0xa8aa8aaa, - 0x0888a88a, - 0x0b0b0b00, - 0x090b0b0b, - 0x0b090b0b, - 0x0909090b, - 0x09090b0b, - 0x09090b0b, - 0x09090b09, - 0x00000909, - 0x0a000000, - 0x0a080808, - 0x080a080a, - 0x080a0a08, - 0x080a080a, - 0x0808080a, - 0x0a0a0a08, - 0x0808080a, - 0xb0b0b000, - 0x9090b0b0, - 0x90b09090, - 0xb0b0b090, - 0xb0b090b0, - 0x90b0b0b0, - 0xb0b09090, - 0x00000090, - 0x80000000, - 0xa080a080, - 0xa08080a0, - 0xa0808080, - 0xa080a080, - 0x80a0a0a0, - 0xa0a080a0, - 0x00a0a0a0, - 0x22000000, - 0x2222f222, - 0x22222222, - 0x222222f2, - 0xf2222220, - 0x22222222, - 0x22f22222, - 0x00000222, - 0x11000000, - 0x1111f111, - 0x11111111, - 0x111111f1, - 0xf1111110, - 0x11111111, - 0x11f11111, - 0x00000111, - 0x33000000, - 0x3333f333, - 0x33333333, - 0x333333f3, - 0xf3333330, - 0x33333333, - 0x33f33333, - 0x00000333, - 0x22000000, - 0x2222f222, - 0x22222222, - 0x222222f2, - 0xf2222220, - 0x22222222, - 0x22f22222, - 0x00000222, - 0x99000000, - 0x9b9b99bb, - 0x9bb99999, - 0x9999b9b9, - 0x9b99bb90, - 0x9bbbbb9b, - 0x9b9b9bb9, - 0x00000999, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x88888000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00aaa888, - 0x88a88a00, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa88, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa88, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x08aaa888, - 0x11000000, - 0x1111a111, - 0x11111111, - 0x111111a1, - 0xa1111110, - 0x11111111, - 0x11c11111, - 0x00000111, - 0x11000000, - 0x1111a111, - 0x11111111, - 0x111111a1, - 0xa1111110, - 0x11111111, - 0x11c11111, - 0x00000111, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -static const u32 intlv_tbl_rev3[] = { - 0x00802070, - 0x0671188d, - 0x0a60192c, - 0x0a300e46, - 0x00c1188d, - 0x080024d2, - 0x00000070, -}; - -static const u32 tdtrn_tbl_rev3[] = { - 0x061c061c, - 0x0050ee68, - 0xf592fe36, - 0xfe5212f6, - 0x00000c38, - 0xfe5212f6, - 0xf592fe36, - 0x0050ee68, - 0x061c061c, - 0xee680050, - 0xfe36f592, - 0x12f6fe52, - 0x0c380000, - 0x12f6fe52, - 0xfe36f592, - 0xee680050, - 0x061c061c, - 0x0050ee68, - 0xf592fe36, - 0xfe5212f6, - 0x00000c38, - 0xfe5212f6, - 0xf592fe36, - 0x0050ee68, - 0x061c061c, - 0xee680050, - 0xfe36f592, - 0x12f6fe52, - 0x0c380000, - 0x12f6fe52, - 0xfe36f592, - 0xee680050, - 0x05e305e3, - 0x004def0c, - 0xf5f3fe47, - 0xfe611246, - 0x00000bc7, - 0xfe611246, - 0xf5f3fe47, - 0x004def0c, - 0x05e305e3, - 0xef0c004d, - 0xfe47f5f3, - 0x1246fe61, - 0x0bc70000, - 0x1246fe61, - 0xfe47f5f3, - 0xef0c004d, - 0x05e305e3, - 0x004def0c, - 0xf5f3fe47, - 0xfe611246, - 0x00000bc7, - 0xfe611246, - 0xf5f3fe47, - 0x004def0c, - 0x05e305e3, - 0xef0c004d, - 0xfe47f5f3, - 0x1246fe61, - 0x0bc70000, - 0x1246fe61, - 0xfe47f5f3, - 0xef0c004d, - 0xfa58fa58, - 0xf895043b, - 0xff4c09c0, - 0xfbc6ffa8, - 0xfb84f384, - 0x0798f6f9, - 0x05760122, - 0x058409f6, - 0x0b500000, - 0x05b7f542, - 0x08860432, - 0x06ddfee7, - 0xfb84f384, - 0xf9d90664, - 0xf7e8025c, - 0x00fff7bd, - 0x05a805a8, - 0xf7bd00ff, - 0x025cf7e8, - 0x0664f9d9, - 0xf384fb84, - 0xfee706dd, - 0x04320886, - 0xf54205b7, - 0x00000b50, - 0x09f60584, - 0x01220576, - 0xf6f90798, - 0xf384fb84, - 0xffa8fbc6, - 0x09c0ff4c, - 0x043bf895, - 0x02d402d4, - 0x07de0270, - 0xfc96079c, - 0xf90afe94, - 0xfe00ff2c, - 0x02d4065d, - 0x092a0096, - 0x0014fbb8, - 0xfd2cfd2c, - 0x076afb3c, - 0x0096f752, - 0xf991fd87, - 0xfb2c0200, - 0xfeb8f960, - 0x08e0fc96, - 0x049802a8, - 0xfd2cfd2c, - 0x02a80498, - 0xfc9608e0, - 0xf960feb8, - 0x0200fb2c, - 0xfd87f991, - 0xf7520096, - 0xfb3c076a, - 0xfd2cfd2c, - 0xfbb80014, - 0x0096092a, - 0x065d02d4, - 0xff2cfe00, - 0xfe94f90a, - 0x079cfc96, - 0x027007de, - 0x02d402d4, - 0x027007de, - 0x079cfc96, - 0xfe94f90a, - 0xff2cfe00, - 0x065d02d4, - 0x0096092a, - 0xfbb80014, - 0xfd2cfd2c, - 0xfb3c076a, - 0xf7520096, - 0xfd87f991, - 0x0200fb2c, - 0xf960feb8, - 0xfc9608e0, - 0x02a80498, - 0xfd2cfd2c, - 0x049802a8, - 0x08e0fc96, - 0xfeb8f960, - 0xfb2c0200, - 0xf991fd87, - 0x0096f752, - 0x076afb3c, - 0xfd2cfd2c, - 0x0014fbb8, - 0x092a0096, - 0x02d4065d, - 0xfe00ff2c, - 0xf90afe94, - 0xfc96079c, - 0x07de0270, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x062a0000, - 0xfefa0759, - 0x08b80908, - 0xf396fc2d, - 0xf9d6045c, - 0xfc4ef608, - 0xf748f596, - 0x07b207bf, - 0x062a062a, - 0xf84ef841, - 0xf748f596, - 0x03b209f8, - 0xf9d6045c, - 0x0c6a03d3, - 0x08b80908, - 0x0106f8a7, - 0x062a0000, - 0xfefaf8a7, - 0x08b8f6f8, - 0xf39603d3, - 0xf9d6fba4, - 0xfc4e09f8, - 0xf7480a6a, - 0x07b2f841, - 0x062af9d6, - 0xf84e07bf, - 0xf7480a6a, - 0x03b2f608, - 0xf9d6fba4, - 0x0c6afc2d, - 0x08b8f6f8, - 0x01060759, - 0x062a0000, - 0xfefa0759, - 0x08b80908, - 0xf396fc2d, - 0xf9d6045c, - 0xfc4ef608, - 0xf748f596, - 0x07b207bf, - 0x062a062a, - 0xf84ef841, - 0xf748f596, - 0x03b209f8, - 0xf9d6045c, - 0x0c6a03d3, - 0x08b80908, - 0x0106f8a7, - 0x062a0000, - 0xfefaf8a7, - 0x08b8f6f8, - 0xf39603d3, - 0xf9d6fba4, - 0xfc4e09f8, - 0xf7480a6a, - 0x07b2f841, - 0x062af9d6, - 0xf84e07bf, - 0xf7480a6a, - 0x03b2f608, - 0xf9d6fba4, - 0x0c6afc2d, - 0x08b8f6f8, - 0x01060759, - 0x061c061c, - 0xff30009d, - 0xffb21141, - 0xfd87fb54, - 0xf65dfe59, - 0x02eef99e, - 0x0166f03c, - 0xfff809b6, - 0x000008a4, - 0x000af42b, - 0x00eff577, - 0xfa840bf2, - 0xfc02ff51, - 0x08260f67, - 0xfff0036f, - 0x0842f9c3, - 0x00000000, - 0x063df7be, - 0xfc910010, - 0xf099f7da, - 0x00af03fe, - 0xf40e057c, - 0x0a89ff11, - 0x0bd5fff6, - 0xf75c0000, - 0xf64a0008, - 0x0fc4fe9a, - 0x0662fd12, - 0x01a709a3, - 0x04ac0279, - 0xeebf004e, - 0xff6300d0, - 0xf9e4f9e4, - 0x00d0ff63, - 0x004eeebf, - 0x027904ac, - 0x09a301a7, - 0xfd120662, - 0xfe9a0fc4, - 0x0008f64a, - 0x0000f75c, - 0xfff60bd5, - 0xff110a89, - 0x057cf40e, - 0x03fe00af, - 0xf7daf099, - 0x0010fc91, - 0xf7be063d, - 0x00000000, - 0xf9c30842, - 0x036ffff0, - 0x0f670826, - 0xff51fc02, - 0x0bf2fa84, - 0xf57700ef, - 0xf42b000a, - 0x08a40000, - 0x09b6fff8, - 0xf03c0166, - 0xf99e02ee, - 0xfe59f65d, - 0xfb54fd87, - 0x1141ffb2, - 0x009dff30, - 0x05e30000, - 0xff060705, - 0x085408a0, - 0xf425fc59, - 0xfa1d042a, - 0xfc78f67a, - 0xf7acf60e, - 0x075a0766, - 0x05e305e3, - 0xf8a6f89a, - 0xf7acf60e, - 0x03880986, - 0xfa1d042a, - 0x0bdb03a7, - 0x085408a0, - 0x00faf8fb, - 0x05e30000, - 0xff06f8fb, - 0x0854f760, - 0xf42503a7, - 0xfa1dfbd6, - 0xfc780986, - 0xf7ac09f2, - 0x075af89a, - 0x05e3fa1d, - 0xf8a60766, - 0xf7ac09f2, - 0x0388f67a, - 0xfa1dfbd6, - 0x0bdbfc59, - 0x0854f760, - 0x00fa0705, - 0x05e30000, - 0xff060705, - 0x085408a0, - 0xf425fc59, - 0xfa1d042a, - 0xfc78f67a, - 0xf7acf60e, - 0x075a0766, - 0x05e305e3, - 0xf8a6f89a, - 0xf7acf60e, - 0x03880986, - 0xfa1d042a, - 0x0bdb03a7, - 0x085408a0, - 0x00faf8fb, - 0x05e30000, - 0xff06f8fb, - 0x0854f760, - 0xf42503a7, - 0xfa1dfbd6, - 0xfc780986, - 0xf7ac09f2, - 0x075af89a, - 0x05e3fa1d, - 0xf8a60766, - 0xf7ac09f2, - 0x0388f67a, - 0xfa1dfbd6, - 0x0bdbfc59, - 0x0854f760, - 0x00fa0705, - 0xfa58fa58, - 0xf8f0fe00, - 0x0448073d, - 0xfdc9fe46, - 0xf9910258, - 0x089d0407, - 0xfd5cf71a, - 0x02affde0, - 0x083e0496, - 0xff5a0740, - 0xff7afd97, - 0x00fe01f1, - 0x0009082e, - 0xfa94ff75, - 0xfecdf8ea, - 0xffb0f693, - 0xfd2cfa58, - 0x0433ff16, - 0xfba405dd, - 0xfa610341, - 0x06a606cb, - 0x0039fd2d, - 0x0677fa97, - 0x01fa05e0, - 0xf896003e, - 0x075a068b, - 0x012cfc3e, - 0xfa23f98d, - 0xfc7cfd43, - 0xff90fc0d, - 0x01c10982, - 0x00c601d6, - 0xfd2cfd2c, - 0x01d600c6, - 0x098201c1, - 0xfc0dff90, - 0xfd43fc7c, - 0xf98dfa23, - 0xfc3e012c, - 0x068b075a, - 0x003ef896, - 0x05e001fa, - 0xfa970677, - 0xfd2d0039, - 0x06cb06a6, - 0x0341fa61, - 0x05ddfba4, - 0xff160433, - 0xfa58fd2c, - 0xf693ffb0, - 0xf8eafecd, - 0xff75fa94, - 0x082e0009, - 0x01f100fe, - 0xfd97ff7a, - 0x0740ff5a, - 0x0496083e, - 0xfde002af, - 0xf71afd5c, - 0x0407089d, - 0x0258f991, - 0xfe46fdc9, - 0x073d0448, - 0xfe00f8f0, - 0xfd2cfd2c, - 0xfce00500, - 0xfc09fddc, - 0xfe680157, - 0x04c70571, - 0xfc3aff21, - 0xfcd70228, - 0x056d0277, - 0x0200fe00, - 0x0022f927, - 0xfe3c032b, - 0xfc44ff3c, - 0x03e9fbdb, - 0x04570313, - 0x04c9ff5c, - 0x000d03b8, - 0xfa580000, - 0xfbe900d2, - 0xf9d0fe0b, - 0x0125fdf9, - 0x042501bf, - 0x0328fa2b, - 0xffa902f0, - 0xfa250157, - 0x0200fe00, - 0x03740438, - 0xff0405fd, - 0x030cfe52, - 0x0037fb39, - 0xff6904c5, - 0x04f8fd23, - 0xfd31fc1b, - 0xfd2cfd2c, - 0xfc1bfd31, - 0xfd2304f8, - 0x04c5ff69, - 0xfb390037, - 0xfe52030c, - 0x05fdff04, - 0x04380374, - 0xfe000200, - 0x0157fa25, - 0x02f0ffa9, - 0xfa2b0328, - 0x01bf0425, - 0xfdf90125, - 0xfe0bf9d0, - 0x00d2fbe9, - 0x0000fa58, - 0x03b8000d, - 0xff5c04c9, - 0x03130457, - 0xfbdb03e9, - 0xff3cfc44, - 0x032bfe3c, - 0xf9270022, - 0xfe000200, - 0x0277056d, - 0x0228fcd7, - 0xff21fc3a, - 0x057104c7, - 0x0157fe68, - 0xfddcfc09, - 0x0500fce0, - 0xfd2cfd2c, - 0x0500fce0, - 0xfddcfc09, - 0x0157fe68, - 0x057104c7, - 0xff21fc3a, - 0x0228fcd7, - 0x0277056d, - 0xfe000200, - 0xf9270022, - 0x032bfe3c, - 0xff3cfc44, - 0xfbdb03e9, - 0x03130457, - 0xff5c04c9, - 0x03b8000d, - 0x0000fa58, - 0x00d2fbe9, - 0xfe0bf9d0, - 0xfdf90125, - 0x01bf0425, - 0xfa2b0328, - 0x02f0ffa9, - 0x0157fa25, - 0xfe000200, - 0x04380374, - 0x05fdff04, - 0xfe52030c, - 0xfb390037, - 0x04c5ff69, - 0xfd2304f8, - 0xfc1bfd31, - 0xfd2cfd2c, - 0xfd31fc1b, - 0x04f8fd23, - 0xff6904c5, - 0x0037fb39, - 0x030cfe52, - 0xff0405fd, - 0x03740438, - 0x0200fe00, - 0xfa250157, - 0xffa902f0, - 0x0328fa2b, - 0x042501bf, - 0x0125fdf9, - 0xf9d0fe0b, - 0xfbe900d2, - 0xfa580000, - 0x000d03b8, - 0x04c9ff5c, - 0x04570313, - 0x03e9fbdb, - 0xfc44ff3c, - 0xfe3c032b, - 0x0022f927, - 0x0200fe00, - 0x056d0277, - 0xfcd70228, - 0xfc3aff21, - 0x04c70571, - 0xfe680157, - 0xfc09fddc, - 0xfce00500, - 0x05a80000, - 0xff1006be, - 0x0800084a, - 0xf49cfc7e, - 0xfa580400, - 0xfc9cf6da, - 0xf800f672, - 0x0710071c, - 0x05a805a8, - 0xf8f0f8e4, - 0xf800f672, - 0x03640926, - 0xfa580400, - 0x0b640382, - 0x0800084a, - 0x00f0f942, - 0x05a80000, - 0xff10f942, - 0x0800f7b6, - 0xf49c0382, - 0xfa58fc00, - 0xfc9c0926, - 0xf800098e, - 0x0710f8e4, - 0x05a8fa58, - 0xf8f0071c, - 0xf800098e, - 0x0364f6da, - 0xfa58fc00, - 0x0b64fc7e, - 0x0800f7b6, - 0x00f006be, - 0x05a80000, - 0xff1006be, - 0x0800084a, - 0xf49cfc7e, - 0xfa580400, - 0xfc9cf6da, - 0xf800f672, - 0x0710071c, - 0x05a805a8, - 0xf8f0f8e4, - 0xf800f672, - 0x03640926, - 0xfa580400, - 0x0b640382, - 0x0800084a, - 0x00f0f942, - 0x05a80000, - 0xff10f942, - 0x0800f7b6, - 0xf49c0382, - 0xfa58fc00, - 0xfc9c0926, - 0xf800098e, - 0x0710f8e4, - 0x05a8fa58, - 0xf8f0071c, - 0xf800098e, - 0x0364f6da, - 0xfa58fc00, - 0x0b64fc7e, - 0x0800f7b6, - 0x00f006be, -}; - -const u32 noise_var_tbl_rev3[] = { - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, - 0x02110211, - 0x0000014d, -}; - -static const u16 mcs_tbl_rev3[] = { - 0x0000, - 0x0008, - 0x000a, - 0x0010, - 0x0012, - 0x0019, - 0x001a, - 0x001c, - 0x0080, - 0x0088, - 0x008a, - 0x0090, - 0x0092, - 0x0099, - 0x009a, - 0x009c, - 0x0100, - 0x0108, - 0x010a, - 0x0110, - 0x0112, - 0x0119, - 0x011a, - 0x011c, - 0x0180, - 0x0188, - 0x018a, - 0x0190, - 0x0192, - 0x0199, - 0x019a, - 0x019c, - 0x0000, - 0x0098, - 0x00a0, - 0x00a8, - 0x009a, - 0x00a2, - 0x00aa, - 0x0120, - 0x0128, - 0x0128, - 0x0130, - 0x0138, - 0x0138, - 0x0140, - 0x0122, - 0x012a, - 0x012a, - 0x0132, - 0x013a, - 0x013a, - 0x0142, - 0x01a8, - 0x01b0, - 0x01b8, - 0x01b0, - 0x01b8, - 0x01c0, - 0x01c8, - 0x01c0, - 0x01c8, - 0x01d0, - 0x01d0, - 0x01d8, - 0x01aa, - 0x01b2, - 0x01ba, - 0x01b2, - 0x01ba, - 0x01c2, - 0x01ca, - 0x01c2, - 0x01ca, - 0x01d2, - 0x01d2, - 0x01da, - 0x0001, - 0x0002, - 0x0004, - 0x0009, - 0x000c, - 0x0011, - 0x0014, - 0x0018, - 0x0020, - 0x0021, - 0x0022, - 0x0024, - 0x0081, - 0x0082, - 0x0084, - 0x0089, - 0x008c, - 0x0091, - 0x0094, - 0x0098, - 0x00a0, - 0x00a1, - 0x00a2, - 0x00a4, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, - 0x0007, -}; - -static const u32 tdi_tbl20_ant0_rev3[] = { - 0x00091226, - 0x000a1429, - 0x000b56ad, - 0x000c58b0, - 0x000d5ab3, - 0x000e9cb6, - 0x000f9eba, - 0x0000c13d, - 0x00020301, - 0x00030504, - 0x00040708, - 0x0005090b, - 0x00064b8e, - 0x00095291, - 0x000a5494, - 0x000b9718, - 0x000c9927, - 0x000d9b2a, - 0x000edd2e, - 0x000fdf31, - 0x000101b4, - 0x000243b7, - 0x000345bb, - 0x000447be, - 0x00058982, - 0x00068c05, - 0x00099309, - 0x000a950c, - 0x000bd78f, - 0x000cd992, - 0x000ddb96, - 0x000f1d99, - 0x00005fa8, - 0x0001422c, - 0x0002842f, - 0x00038632, - 0x00048835, - 0x0005ca38, - 0x0006ccbc, - 0x0009d3bf, - 0x000b1603, - 0x000c1806, - 0x000d1a0a, - 0x000e1c0d, - 0x000f5e10, - 0x00008093, - 0x00018297, - 0x0002c49a, - 0x0003c680, - 0x0004c880, - 0x00060b00, - 0x00070d00, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -static const u32 tdi_tbl20_ant1_rev3[] = { - 0x00014b26, - 0x00028d29, - 0x000393ad, - 0x00049630, - 0x0005d833, - 0x0006da36, - 0x00099c3a, - 0x000a9e3d, - 0x000bc081, - 0x000cc284, - 0x000dc488, - 0x000f068b, - 0x0000488e, - 0x00018b91, - 0x0002d214, - 0x0003d418, - 0x0004d6a7, - 0x000618aa, - 0x00071aae, - 0x0009dcb1, - 0x000b1eb4, - 0x000c0137, - 0x000d033b, - 0x000e053e, - 0x000f4702, - 0x00008905, - 0x00020c09, - 0x0003128c, - 0x0004148f, - 0x00051712, - 0x00065916, - 0x00091b19, - 0x000a1d28, - 0x000b5f2c, - 0x000c41af, - 0x000d43b2, - 0x000e85b5, - 0x000f87b8, - 0x0000c9bc, - 0x00024cbf, - 0x00035303, - 0x00045506, - 0x0005978a, - 0x0006998d, - 0x00095b90, - 0x000a5d93, - 0x000b9f97, - 0x000c821a, - 0x000d8400, - 0x000ec600, - 0x000fc800, - 0x00010a00, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -static const u32 tdi_tbl40_ant0_rev3[] = { - 0x0011a346, - 0x00136ccf, - 0x0014f5d9, - 0x001641e2, - 0x0017cb6b, - 0x00195475, - 0x001b2383, - 0x001cad0c, - 0x001e7616, - 0x0000821f, - 0x00020ba8, - 0x0003d4b2, - 0x00056447, - 0x00072dd0, - 0x0008b6da, - 0x000a02e3, - 0x000b8c6c, - 0x000d15f6, - 0x0011e484, - 0x0013ae0d, - 0x00153717, - 0x00168320, - 0x00180ca9, - 0x00199633, - 0x001b6548, - 0x001ceed1, - 0x001eb7db, - 0x0000c3e4, - 0x00024d6d, - 0x000416f7, - 0x0005a585, - 0x00076f0f, - 0x0008f818, - 0x000a4421, - 0x000bcdab, - 0x000d9734, - 0x00122649, - 0x0013efd2, - 0x001578dc, - 0x0016c4e5, - 0x00184e6e, - 0x001a17f8, - 0x001ba686, - 0x001d3010, - 0x001ef999, - 0x00010522, - 0x00028eac, - 0x00045835, - 0x0005e74a, - 0x0007b0d3, - 0x00093a5d, - 0x000a85e6, - 0x000c0f6f, - 0x000dd8f9, - 0x00126787, - 0x00143111, - 0x0015ba9a, - 0x00170623, - 0x00188fad, - 0x001a5936, - 0x001be84b, - 0x001db1d4, - 0x001f3b5e, - 0x000146e7, - 0x00031070, - 0x000499fa, - 0x00062888, - 0x0007f212, - 0x00097b9b, - 0x000ac7a4, - 0x000c50ae, - 0x000e1a37, - 0x0012a94c, - 0x001472d5, - 0x0015fc5f, - 0x00174868, - 0x0018d171, - 0x001a9afb, - 0x001c2989, - 0x001df313, - 0x001f7c9c, - 0x000188a5, - 0x000351af, - 0x0004db38, - 0x0006aa4d, - 0x000833d7, - 0x0009bd60, - 0x000b0969, - 0x000c9273, - 0x000e5bfc, - 0x00132a8a, - 0x0014b414, - 0x00163d9d, - 0x001789a6, - 0x001912b0, - 0x001adc39, - 0x001c6bce, - 0x001e34d8, - 0x001fbe61, - 0x0001ca6a, - 0x00039374, - 0x00051cfd, - 0x0006ec0b, - 0x00087515, - 0x0009fe9e, - 0x000b4aa7, - 0x000cd3b1, - 0x000e9d3a, - 0x00000000, - 0x00000000, -}; - -static const u32 tdi_tbl40_ant1_rev3[] = { - 0x001edb36, - 0x000129ca, - 0x0002b353, - 0x00047cdd, - 0x0005c8e6, - 0x000791ef, - 0x00091bf9, - 0x000aaa07, - 0x000c3391, - 0x000dfd1a, - 0x00120923, - 0x0013d22d, - 0x00155c37, - 0x0016eacb, - 0x00187454, - 0x001a3dde, - 0x001b89e7, - 0x001d12f0, - 0x001f1cfa, - 0x00016b88, - 0x00033492, - 0x0004be1b, - 0x00060a24, - 0x0007d32e, - 0x00095d38, - 0x000aec4c, - 0x000c7555, - 0x000e3edf, - 0x00124ae8, - 0x001413f1, - 0x0015a37b, - 0x00172c89, - 0x0018b593, - 0x001a419c, - 0x001bcb25, - 0x001d942f, - 0x001f63b9, - 0x0001ad4d, - 0x00037657, - 0x0004c260, - 0x00068be9, - 0x000814f3, - 0x0009a47c, - 0x000b2d8a, - 0x000cb694, - 0x000e429d, - 0x00128c26, - 0x001455b0, - 0x0015e4ba, - 0x00176e4e, - 0x0018f758, - 0x001a8361, - 0x001c0cea, - 0x001dd674, - 0x001fa57d, - 0x0001ee8b, - 0x0003b795, - 0x0005039e, - 0x0006cd27, - 0x000856b1, - 0x0009e5c6, - 0x000b6f4f, - 0x000cf859, - 0x000e8462, - 0x00130deb, - 0x00149775, - 0x00162603, - 0x0017af8c, - 0x00193896, - 0x001ac49f, - 0x001c4e28, - 0x001e17b2, - 0x0000a6c7, - 0x00023050, - 0x0003f9da, - 0x00054563, - 0x00070eec, - 0x00089876, - 0x000a2704, - 0x000bb08d, - 0x000d3a17, - 0x001185a0, - 0x00134f29, - 0x0014d8b3, - 0x001667c8, - 0x0017f151, - 0x00197adb, - 0x001b0664, - 0x001c8fed, - 0x001e5977, - 0x0000e805, - 0x0002718f, - 0x00043b18, - 0x000586a1, - 0x0007502b, - 0x0008d9b4, - 0x000a68c9, - 0x000bf252, - 0x000dbbdc, - 0x0011c7e5, - 0x001390ee, - 0x00151a78, - 0x0016a906, - 0x00183290, - 0x0019bc19, - 0x001b4822, - 0x001cd12c, - 0x001e9ab5, - 0x00000000, - 0x00000000, -}; - -static const u32 pltlut_tbl_rev3[] = { - 0x76540213, - 0x62407351, - 0x76543210, - 0x76540213, - 0x76540213, - 0x76430521, -}; - -static const u32 chanest_tbl_rev3[] = { - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x44444444, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, - 0x10101010, -}; - -static const u8 frame_lut_rev3[] = { - 0x02, - 0x04, - 0x14, - 0x14, - 0x03, - 0x05, - 0x16, - 0x16, - 0x0a, - 0x0c, - 0x1c, - 0x1c, - 0x0b, - 0x0d, - 0x1e, - 0x1e, - 0x06, - 0x08, - 0x18, - 0x18, - 0x07, - 0x09, - 0x1a, - 0x1a, - 0x0e, - 0x10, - 0x20, - 0x28, - 0x0f, - 0x11, - 0x22, - 0x2a, -}; - -static const u8 est_pwr_lut_core0_rev3[] = { - 0x55, - 0x54, - 0x54, - 0x53, - 0x52, - 0x52, - 0x51, - 0x51, - 0x50, - 0x4f, - 0x4f, - 0x4e, - 0x4e, - 0x4d, - 0x4c, - 0x4c, - 0x4b, - 0x4a, - 0x49, - 0x49, - 0x48, - 0x47, - 0x46, - 0x46, - 0x45, - 0x44, - 0x43, - 0x42, - 0x41, - 0x40, - 0x40, - 0x3f, - 0x3e, - 0x3d, - 0x3c, - 0x3a, - 0x39, - 0x38, - 0x37, - 0x36, - 0x35, - 0x33, - 0x32, - 0x31, - 0x2f, - 0x2e, - 0x2c, - 0x2b, - 0x29, - 0x27, - 0x25, - 0x23, - 0x21, - 0x1f, - 0x1d, - 0x1a, - 0x18, - 0x15, - 0x12, - 0x0e, - 0x0b, - 0x07, - 0x02, - 0xfd, -}; - -static const u8 est_pwr_lut_core1_rev3[] = { - 0x55, - 0x54, - 0x54, - 0x53, - 0x52, - 0x52, - 0x51, - 0x51, - 0x50, - 0x4f, - 0x4f, - 0x4e, - 0x4e, - 0x4d, - 0x4c, - 0x4c, - 0x4b, - 0x4a, - 0x49, - 0x49, - 0x48, - 0x47, - 0x46, - 0x46, - 0x45, - 0x44, - 0x43, - 0x42, - 0x41, - 0x40, - 0x40, - 0x3f, - 0x3e, - 0x3d, - 0x3c, - 0x3a, - 0x39, - 0x38, - 0x37, - 0x36, - 0x35, - 0x33, - 0x32, - 0x31, - 0x2f, - 0x2e, - 0x2c, - 0x2b, - 0x29, - 0x27, - 0x25, - 0x23, - 0x21, - 0x1f, - 0x1d, - 0x1a, - 0x18, - 0x15, - 0x12, - 0x0e, - 0x0b, - 0x07, - 0x02, - 0xfd, -}; - -static const u8 adj_pwr_lut_core0_rev3[] = { - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, -}; - -static const u8 adj_pwr_lut_core1_rev3[] = { - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, -}; - -static const u32 gainctrl_lut_core0_rev3[] = { - 0x5bf70044, - 0x5bf70042, - 0x5bf70040, - 0x5bf7003e, - 0x5bf7003c, - 0x5bf7003b, - 0x5bf70039, - 0x5bf70037, - 0x5bf70036, - 0x5bf70034, - 0x5bf70033, - 0x5bf70031, - 0x5bf70030, - 0x5ba70044, - 0x5ba70042, - 0x5ba70040, - 0x5ba7003e, - 0x5ba7003c, - 0x5ba7003b, - 0x5ba70039, - 0x5ba70037, - 0x5ba70036, - 0x5ba70034, - 0x5ba70033, - 0x5b770044, - 0x5b770042, - 0x5b770040, - 0x5b77003e, - 0x5b77003c, - 0x5b77003b, - 0x5b770039, - 0x5b770037, - 0x5b770036, - 0x5b770034, - 0x5b770033, - 0x5b770031, - 0x5b770030, - 0x5b77002f, - 0x5b77002d, - 0x5b77002c, - 0x5b470044, - 0x5b470042, - 0x5b470040, - 0x5b47003e, - 0x5b47003c, - 0x5b47003b, - 0x5b470039, - 0x5b470037, - 0x5b470036, - 0x5b470034, - 0x5b470033, - 0x5b470031, - 0x5b470030, - 0x5b47002f, - 0x5b47002d, - 0x5b47002c, - 0x5b47002b, - 0x5b47002a, - 0x5b270044, - 0x5b270042, - 0x5b270040, - 0x5b27003e, - 0x5b27003c, - 0x5b27003b, - 0x5b270039, - 0x5b270037, - 0x5b270036, - 0x5b270034, - 0x5b270033, - 0x5b270031, - 0x5b270030, - 0x5b27002f, - 0x5b170044, - 0x5b170042, - 0x5b170040, - 0x5b17003e, - 0x5b17003c, - 0x5b17003b, - 0x5b170039, - 0x5b170037, - 0x5b170036, - 0x5b170034, - 0x5b170033, - 0x5b170031, - 0x5b170030, - 0x5b17002f, - 0x5b17002d, - 0x5b17002c, - 0x5b17002b, - 0x5b17002a, - 0x5b170028, - 0x5b170027, - 0x5b170026, - 0x5b170025, - 0x5b170024, - 0x5b170023, - 0x5b070044, - 0x5b070042, - 0x5b070040, - 0x5b07003e, - 0x5b07003c, - 0x5b07003b, - 0x5b070039, - 0x5b070037, - 0x5b070036, - 0x5b070034, - 0x5b070033, - 0x5b070031, - 0x5b070030, - 0x5b07002f, - 0x5b07002d, - 0x5b07002c, - 0x5b07002b, - 0x5b07002a, - 0x5b070028, - 0x5b070027, - 0x5b070026, - 0x5b070025, - 0x5b070024, - 0x5b070023, - 0x5b070022, - 0x5b070021, - 0x5b070020, - 0x5b07001f, - 0x5b07001e, - 0x5b07001d, - 0x5b07001d, - 0x5b07001c, -}; - -static const u32 gainctrl_lut_core1_rev3[] = { - 0x5bf70044, - 0x5bf70042, - 0x5bf70040, - 0x5bf7003e, - 0x5bf7003c, - 0x5bf7003b, - 0x5bf70039, - 0x5bf70037, - 0x5bf70036, - 0x5bf70034, - 0x5bf70033, - 0x5bf70031, - 0x5bf70030, - 0x5ba70044, - 0x5ba70042, - 0x5ba70040, - 0x5ba7003e, - 0x5ba7003c, - 0x5ba7003b, - 0x5ba70039, - 0x5ba70037, - 0x5ba70036, - 0x5ba70034, - 0x5ba70033, - 0x5b770044, - 0x5b770042, - 0x5b770040, - 0x5b77003e, - 0x5b77003c, - 0x5b77003b, - 0x5b770039, - 0x5b770037, - 0x5b770036, - 0x5b770034, - 0x5b770033, - 0x5b770031, - 0x5b770030, - 0x5b77002f, - 0x5b77002d, - 0x5b77002c, - 0x5b470044, - 0x5b470042, - 0x5b470040, - 0x5b47003e, - 0x5b47003c, - 0x5b47003b, - 0x5b470039, - 0x5b470037, - 0x5b470036, - 0x5b470034, - 0x5b470033, - 0x5b470031, - 0x5b470030, - 0x5b47002f, - 0x5b47002d, - 0x5b47002c, - 0x5b47002b, - 0x5b47002a, - 0x5b270044, - 0x5b270042, - 0x5b270040, - 0x5b27003e, - 0x5b27003c, - 0x5b27003b, - 0x5b270039, - 0x5b270037, - 0x5b270036, - 0x5b270034, - 0x5b270033, - 0x5b270031, - 0x5b270030, - 0x5b27002f, - 0x5b170044, - 0x5b170042, - 0x5b170040, - 0x5b17003e, - 0x5b17003c, - 0x5b17003b, - 0x5b170039, - 0x5b170037, - 0x5b170036, - 0x5b170034, - 0x5b170033, - 0x5b170031, - 0x5b170030, - 0x5b17002f, - 0x5b17002d, - 0x5b17002c, - 0x5b17002b, - 0x5b17002a, - 0x5b170028, - 0x5b170027, - 0x5b170026, - 0x5b170025, - 0x5b170024, - 0x5b170023, - 0x5b070044, - 0x5b070042, - 0x5b070040, - 0x5b07003e, - 0x5b07003c, - 0x5b07003b, - 0x5b070039, - 0x5b070037, - 0x5b070036, - 0x5b070034, - 0x5b070033, - 0x5b070031, - 0x5b070030, - 0x5b07002f, - 0x5b07002d, - 0x5b07002c, - 0x5b07002b, - 0x5b07002a, - 0x5b070028, - 0x5b070027, - 0x5b070026, - 0x5b070025, - 0x5b070024, - 0x5b070023, - 0x5b070022, - 0x5b070021, - 0x5b070020, - 0x5b07001f, - 0x5b07001e, - 0x5b07001d, - 0x5b07001d, - 0x5b07001c, -}; - -static const u32 iq_lut_core0_rev3[] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -static const u32 iq_lut_core1_rev3[] = { - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -static const u16 loft_lut_core0_rev3[] = { - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, -}; - -static const u16 loft_lut_core1_rev3[] = { - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, -}; - -static const u16 papd_comp_rfpwr_tbl_core0_rev3[] = { - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, -}; - -static const u16 papd_comp_rfpwr_tbl_core1_rev3[] = { - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x0036, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x002a, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x001e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x000e, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01fc, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01ee, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, - 0x01d6, -}; - -static const u32 papd_comp_epsilon_tbl_core0_rev3[] = { - 0x00000000, - 0x00001fa0, - 0x00019f78, - 0x0001df7e, - 0x03fa9f86, - 0x03fd1f90, - 0x03fe5f8a, - 0x03fb1f94, - 0x03fd9fa0, - 0x00009f98, - 0x03fd1fac, - 0x03ff9fa2, - 0x03fe9fae, - 0x00001fae, - 0x03fddfb4, - 0x03ff1fb8, - 0x03ff9fbc, - 0x03ffdfbe, - 0x03fe9fc2, - 0x03fedfc6, - 0x03fedfc6, - 0x03ff9fc8, - 0x03ff5fc6, - 0x03fedfc2, - 0x03ff9fc0, - 0x03ff5fac, - 0x03ff5fac, - 0x03ff9fa2, - 0x03ff9fa6, - 0x03ff9faa, - 0x03ff5fb0, - 0x03ff5fb4, - 0x03ff1fca, - 0x03ff5fce, - 0x03fcdfdc, - 0x03fb4006, - 0x00000030, - 0x03ff808a, - 0x03ff80da, - 0x0000016c, - 0x03ff8318, - 0x03ff063a, - 0x03fd8bd6, - 0x00014ffe, - 0x00034ffe, - 0x00034ffe, - 0x0003cffe, - 0x00040ffe, - 0x00040ffe, - 0x0003cffe, - 0x0003cffe, - 0x00020ffe, - 0x03fe0ffe, - 0x03fdcffe, - 0x03f94ffe, - 0x03f54ffe, - 0x03f44ffe, - 0x03ef8ffe, - 0x03ee0ffe, - 0x03ebcffe, - 0x03e8cffe, - 0x03e74ffe, - 0x03e4cffe, - 0x03e38ffe, -}; - -static const u32 papd_cal_scalars_tbl_core0_rev3[] = { - 0x05af005a, - 0x0571005e, - 0x05040066, - 0x04bd006c, - 0x047d0072, - 0x04430078, - 0x03f70081, - 0x03cb0087, - 0x03870091, - 0x035e0098, - 0x032e00a1, - 0x030300aa, - 0x02d800b4, - 0x02ae00bf, - 0x028900ca, - 0x026400d6, - 0x024100e3, - 0x022200f0, - 0x020200ff, - 0x01e5010e, - 0x01ca011e, - 0x01b0012f, - 0x01990140, - 0x01830153, - 0x016c0168, - 0x0158017d, - 0x01450193, - 0x013301ab, - 0x012101c5, - 0x011101e0, - 0x010201fc, - 0x00f4021a, - 0x00e6011d, - 0x00d9012e, - 0x00cd0140, - 0x00c20153, - 0x00b70167, - 0x00ac017c, - 0x00a30193, - 0x009a01ab, - 0x009101c4, - 0x008901df, - 0x008101fb, - 0x007a0219, - 0x00730239, - 0x006d025b, - 0x0067027e, - 0x006102a4, - 0x005c02cc, - 0x005602f6, - 0x00520323, - 0x004d0353, - 0x00490385, - 0x004503bb, - 0x004103f3, - 0x003d042f, - 0x003a046f, - 0x003704b2, - 0x003404f9, - 0x00310545, - 0x002e0596, - 0x002b05f5, - 0x00290640, - 0x002606a4, -}; - -static const u32 papd_comp_epsilon_tbl_core1_rev3[] = { - 0x00000000, - 0x00001fa0, - 0x00019f78, - 0x0001df7e, - 0x03fa9f86, - 0x03fd1f90, - 0x03fe5f8a, - 0x03fb1f94, - 0x03fd9fa0, - 0x00009f98, - 0x03fd1fac, - 0x03ff9fa2, - 0x03fe9fae, - 0x00001fae, - 0x03fddfb4, - 0x03ff1fb8, - 0x03ff9fbc, - 0x03ffdfbe, - 0x03fe9fc2, - 0x03fedfc6, - 0x03fedfc6, - 0x03ff9fc8, - 0x03ff5fc6, - 0x03fedfc2, - 0x03ff9fc0, - 0x03ff5fac, - 0x03ff5fac, - 0x03ff9fa2, - 0x03ff9fa6, - 0x03ff9faa, - 0x03ff5fb0, - 0x03ff5fb4, - 0x03ff1fca, - 0x03ff5fce, - 0x03fcdfdc, - 0x03fb4006, - 0x00000030, - 0x03ff808a, - 0x03ff80da, - 0x0000016c, - 0x03ff8318, - 0x03ff063a, - 0x03fd8bd6, - 0x00014ffe, - 0x00034ffe, - 0x00034ffe, - 0x0003cffe, - 0x00040ffe, - 0x00040ffe, - 0x0003cffe, - 0x0003cffe, - 0x00020ffe, - 0x03fe0ffe, - 0x03fdcffe, - 0x03f94ffe, - 0x03f54ffe, - 0x03f44ffe, - 0x03ef8ffe, - 0x03ee0ffe, - 0x03ebcffe, - 0x03e8cffe, - 0x03e74ffe, - 0x03e4cffe, - 0x03e38ffe, -}; - -static const u32 papd_cal_scalars_tbl_core1_rev3[] = { - 0x05af005a, - 0x0571005e, - 0x05040066, - 0x04bd006c, - 0x047d0072, - 0x04430078, - 0x03f70081, - 0x03cb0087, - 0x03870091, - 0x035e0098, - 0x032e00a1, - 0x030300aa, - 0x02d800b4, - 0x02ae00bf, - 0x028900ca, - 0x026400d6, - 0x024100e3, - 0x022200f0, - 0x020200ff, - 0x01e5010e, - 0x01ca011e, - 0x01b0012f, - 0x01990140, - 0x01830153, - 0x016c0168, - 0x0158017d, - 0x01450193, - 0x013301ab, - 0x012101c5, - 0x011101e0, - 0x010201fc, - 0x00f4021a, - 0x00e6011d, - 0x00d9012e, - 0x00cd0140, - 0x00c20153, - 0x00b70167, - 0x00ac017c, - 0x00a30193, - 0x009a01ab, - 0x009101c4, - 0x008901df, - 0x008101fb, - 0x007a0219, - 0x00730239, - 0x006d025b, - 0x0067027e, - 0x006102a4, - 0x005c02cc, - 0x005602f6, - 0x00520323, - 0x004d0353, - 0x00490385, - 0x004503bb, - 0x004103f3, - 0x003d042f, - 0x003a046f, - 0x003704b2, - 0x003404f9, - 0x00310545, - 0x002e0596, - 0x002b05f5, - 0x00290640, - 0x002606a4, -}; - -const struct phytbl_info mimophytbl_info_rev3_volatile[] = { - {&ant_swctrl_tbl_rev3, - sizeof(ant_swctrl_tbl_rev3) / sizeof(ant_swctrl_tbl_rev3[0]), 9, 0, 16} - , -}; - -const struct phytbl_info mimophytbl_info_rev3_volatile1[] = { - {&ant_swctrl_tbl_rev3_1, - sizeof(ant_swctrl_tbl_rev3_1) / sizeof(ant_swctrl_tbl_rev3_1[0]), 9, 0, - 16} - , -}; - -const struct phytbl_info mimophytbl_info_rev3_volatile2[] = { - {&ant_swctrl_tbl_rev3_2, - sizeof(ant_swctrl_tbl_rev3_2) / sizeof(ant_swctrl_tbl_rev3_2[0]), 9, 0, - 16} - , -}; - -const struct phytbl_info mimophytbl_info_rev3_volatile3[] = { - {&ant_swctrl_tbl_rev3_3, - sizeof(ant_swctrl_tbl_rev3_3) / sizeof(ant_swctrl_tbl_rev3_3[0]), 9, 0, - 16} - , -}; - -const struct phytbl_info mimophytbl_info_rev3[] = { - {&frame_struct_rev3, - sizeof(frame_struct_rev3) / sizeof(frame_struct_rev3[0]), 10, 0, 32} - , - {&pilot_tbl_rev3, sizeof(pilot_tbl_rev3) / sizeof(pilot_tbl_rev3[0]), - 11, 0, 16} - , - {&tmap_tbl_rev3, sizeof(tmap_tbl_rev3) / sizeof(tmap_tbl_rev3[0]), 12, - 0, 32} - , - {&intlv_tbl_rev3, sizeof(intlv_tbl_rev3) / sizeof(intlv_tbl_rev3[0]), - 13, 0, 32} - , - {&tdtrn_tbl_rev3, sizeof(tdtrn_tbl_rev3) / sizeof(tdtrn_tbl_rev3[0]), - 14, 0, 32} - , - {&noise_var_tbl_rev3, - sizeof(noise_var_tbl_rev3) / sizeof(noise_var_tbl_rev3[0]), 16, 0, 32} - , - {&mcs_tbl_rev3, sizeof(mcs_tbl_rev3) / sizeof(mcs_tbl_rev3[0]), 18, 0, - 16} - , - {&tdi_tbl20_ant0_rev3, - sizeof(tdi_tbl20_ant0_rev3) / sizeof(tdi_tbl20_ant0_rev3[0]), 19, 128, - 32} - , - {&tdi_tbl20_ant1_rev3, - sizeof(tdi_tbl20_ant1_rev3) / sizeof(tdi_tbl20_ant1_rev3[0]), 19, 256, - 32} - , - {&tdi_tbl40_ant0_rev3, - sizeof(tdi_tbl40_ant0_rev3) / sizeof(tdi_tbl40_ant0_rev3[0]), 19, 640, - 32} - , - {&tdi_tbl40_ant1_rev3, - sizeof(tdi_tbl40_ant1_rev3) / sizeof(tdi_tbl40_ant1_rev3[0]), 19, 768, - 32} - , - {&pltlut_tbl_rev3, sizeof(pltlut_tbl_rev3) / sizeof(pltlut_tbl_rev3[0]), - 20, 0, 32} - , - {&chanest_tbl_rev3, - sizeof(chanest_tbl_rev3) / sizeof(chanest_tbl_rev3[0]), 22, 0, 32} - , - {&frame_lut_rev3, sizeof(frame_lut_rev3) / sizeof(frame_lut_rev3[0]), - 24, 0, 8} - , - {&est_pwr_lut_core0_rev3, - sizeof(est_pwr_lut_core0_rev3) / sizeof(est_pwr_lut_core0_rev3[0]), 26, - 0, 8} - , - {&est_pwr_lut_core1_rev3, - sizeof(est_pwr_lut_core1_rev3) / sizeof(est_pwr_lut_core1_rev3[0]), 27, - 0, 8} - , - {&adj_pwr_lut_core0_rev3, - sizeof(adj_pwr_lut_core0_rev3) / sizeof(adj_pwr_lut_core0_rev3[0]), 26, - 64, 8} - , - {&adj_pwr_lut_core1_rev3, - sizeof(adj_pwr_lut_core1_rev3) / sizeof(adj_pwr_lut_core1_rev3[0]), 27, - 64, 8} - , - {&gainctrl_lut_core0_rev3, - sizeof(gainctrl_lut_core0_rev3) / sizeof(gainctrl_lut_core0_rev3[0]), - 26, 192, 32} - , - {&gainctrl_lut_core1_rev3, - sizeof(gainctrl_lut_core1_rev3) / sizeof(gainctrl_lut_core1_rev3[0]), - 27, 192, 32} - , - {&iq_lut_core0_rev3, - sizeof(iq_lut_core0_rev3) / sizeof(iq_lut_core0_rev3[0]), 26, 320, 32} - , - {&iq_lut_core1_rev3, - sizeof(iq_lut_core1_rev3) / sizeof(iq_lut_core1_rev3[0]), 27, 320, 32} - , - {&loft_lut_core0_rev3, - sizeof(loft_lut_core0_rev3) / sizeof(loft_lut_core0_rev3[0]), 26, 448, - 16} - , - {&loft_lut_core1_rev3, - sizeof(loft_lut_core1_rev3) / sizeof(loft_lut_core1_rev3[0]), 27, 448, - 16} -}; - -const u32 mimophytbl_info_sz_rev3 = - sizeof(mimophytbl_info_rev3) / sizeof(mimophytbl_info_rev3[0]); -const u32 mimophytbl_info_sz_rev3_volatile = - sizeof(mimophytbl_info_rev3_volatile) / - sizeof(mimophytbl_info_rev3_volatile[0]); -const u32 mimophytbl_info_sz_rev3_volatile1 = - sizeof(mimophytbl_info_rev3_volatile1) / - sizeof(mimophytbl_info_rev3_volatile1[0]); -const u32 mimophytbl_info_sz_rev3_volatile2 = - sizeof(mimophytbl_info_rev3_volatile2) / - sizeof(mimophytbl_info_rev3_volatile2[0]); -const u32 mimophytbl_info_sz_rev3_volatile3 = - sizeof(mimophytbl_info_rev3_volatile3) / - sizeof(mimophytbl_info_rev3_volatile3[0]); - -static const u32 tmap_tbl_rev7[] = { - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0xf1111110, - 0x11111111, - 0x11f11111, - 0x00000111, - 0x11000000, - 0x1111f111, - 0x11111111, - 0x111111f1, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x000aa888, - 0x88880000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0xa1111110, - 0x11111111, - 0x11c11111, - 0x00000111, - 0x11000000, - 0x1111a111, - 0x11111111, - 0x111111a1, - 0xa2222220, - 0x22222222, - 0x22c22222, - 0x00000222, - 0x22000000, - 0x2222a222, - 0x22222222, - 0x222222a2, - 0xf1111110, - 0x11111111, - 0x11f11111, - 0x00011111, - 0x11110000, - 0x1111f111, - 0x11111111, - 0x111111f1, - 0xa8aa88a0, - 0xa88888a8, - 0xa8a8a88a, - 0x00088aaa, - 0xaaaa0000, - 0xa8a8aa88, - 0xa88aaaaa, - 0xaaaa8a8a, - 0xaaa8aaa0, - 0x8aaa8aaa, - 0xaa8a8a8a, - 0x000aaa88, - 0x8aaa0000, - 0xaaa8a888, - 0x8aa88a8a, - 0x8a88a888, - 0x08080a00, - 0x0a08080a, - 0x080a0a08, - 0x00080808, - 0x080a0000, - 0x080a0808, - 0x080a0808, - 0x0a0a0a08, - 0xa0a0a0a0, - 0x80a0a080, - 0x8080a0a0, - 0x00008080, - 0x80a00000, - 0x80a080a0, - 0xa080a0a0, - 0x8080a0a0, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x99999000, - 0x9b9b99bb, - 0x9bb99999, - 0x9999b9b9, - 0x9b99bb90, - 0x9bbbbb9b, - 0x9b9b9bb9, - 0x00000999, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00aaa888, - 0x22000000, - 0x2222b222, - 0x22222222, - 0x222222b2, - 0xb2222220, - 0x22222222, - 0x22d22222, - 0x00000222, - 0x11000000, - 0x1111a111, - 0x11111111, - 0x111111a1, - 0xa1111110, - 0x11111111, - 0x11c11111, - 0x00000111, - 0x33000000, - 0x3333b333, - 0x33333333, - 0x333333b3, - 0xb3333330, - 0x33333333, - 0x33d33333, - 0x00000333, - 0x22000000, - 0x2222a222, - 0x22222222, - 0x222222a2, - 0xa2222220, - 0x22222222, - 0x22c22222, - 0x00000222, - 0x99b99b00, - 0x9b9b99bb, - 0x9bb99999, - 0x9999b9b9, - 0x9b99bb99, - 0x9bbbbb9b, - 0x9b9b9bb9, - 0x00000999, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa88, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x08aaa888, - 0x22222200, - 0x2222f222, - 0x22222222, - 0x222222f2, - 0x22222222, - 0x22222222, - 0x22f22222, - 0x00000222, - 0x11000000, - 0x1111f111, - 0x11111111, - 0x11111111, - 0xf1111111, - 0x11111111, - 0x11f11111, - 0x01111111, - 0xbb9bb900, - 0xb9b9bb99, - 0xb99bbbbb, - 0xbbbb9b9b, - 0xb9bb99bb, - 0xb99999b9, - 0xb9b9b99b, - 0x00000bbb, - 0xaa000000, - 0xa8a8aa88, - 0xa88aaaaa, - 0xaaaa8a8a, - 0xa8aa88aa, - 0xa88888a8, - 0xa8a8a88a, - 0x0a888aaa, - 0xaa000000, - 0xa8a8aa88, - 0xa88aaaaa, - 0xaaaa8a8a, - 0xa8aa88a0, - 0xa88888a8, - 0xa8a8a88a, - 0x00000aaa, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0xbbbbbb00, - 0x999bbbbb, - 0x9bb99b9b, - 0xb9b9b9bb, - 0xb9b99bbb, - 0xb9b9b9bb, - 0xb9bb9b99, - 0x00000999, - 0x8a000000, - 0xaa88a888, - 0xa88888aa, - 0xa88a8a88, - 0xa88aa88a, - 0x88a8aaaa, - 0xa8aa8aaa, - 0x0888a88a, - 0x0b0b0b00, - 0x090b0b0b, - 0x0b090b0b, - 0x0909090b, - 0x09090b0b, - 0x09090b0b, - 0x09090b09, - 0x00000909, - 0x0a000000, - 0x0a080808, - 0x080a080a, - 0x080a0a08, - 0x080a080a, - 0x0808080a, - 0x0a0a0a08, - 0x0808080a, - 0xb0b0b000, - 0x9090b0b0, - 0x90b09090, - 0xb0b0b090, - 0xb0b090b0, - 0x90b0b0b0, - 0xb0b09090, - 0x00000090, - 0x80000000, - 0xa080a080, - 0xa08080a0, - 0xa0808080, - 0xa080a080, - 0x80a0a0a0, - 0xa0a080a0, - 0x00a0a0a0, - 0x22000000, - 0x2222f222, - 0x22222222, - 0x222222f2, - 0xf2222220, - 0x22222222, - 0x22f22222, - 0x00000222, - 0x11000000, - 0x1111f111, - 0x11111111, - 0x111111f1, - 0xf1111110, - 0x11111111, - 0x11f11111, - 0x00000111, - 0x33000000, - 0x3333f333, - 0x33333333, - 0x333333f3, - 0xf3333330, - 0x33333333, - 0x33f33333, - 0x00000333, - 0x22000000, - 0x2222f222, - 0x22222222, - 0x222222f2, - 0xf2222220, - 0x22222222, - 0x22f22222, - 0x00000222, - 0x99000000, - 0x9b9b99bb, - 0x9bb99999, - 0x9999b9b9, - 0x9b99bb90, - 0x9bbbbb9b, - 0x9b9b9bb9, - 0x00000999, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x88888000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00aaa888, - 0x88a88a00, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa88, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x000aa888, - 0x88880000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa88, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x08aaa888, - 0x11000000, - 0x1111a111, - 0x11111111, - 0x111111a1, - 0xa1111110, - 0x11111111, - 0x11c11111, - 0x00000111, - 0x11000000, - 0x1111a111, - 0x11111111, - 0x111111a1, - 0xa1111110, - 0x11111111, - 0x11c11111, - 0x00000111, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x88000000, - 0x8a8a88aa, - 0x8aa88888, - 0x8888a8a8, - 0x8a88aa80, - 0x8aaaaa8a, - 0x8a8a8aa8, - 0x00000888, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, -}; - -const u32 noise_var_tbl_rev7[] = { - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, - 0x020c020c, - 0x0000014d, -}; - -static const u32 papd_comp_epsilon_tbl_core0_rev7[] = { - 0x00000000, - 0x00000000, - 0x00016023, - 0x00006028, - 0x00034036, - 0x0003402e, - 0x0007203c, - 0x0006e037, - 0x00070030, - 0x0009401f, - 0x0009a00f, - 0x000b600d, - 0x000c8007, - 0x000ce007, - 0x00101fff, - 0x00121ff9, - 0x0012e004, - 0x0014dffc, - 0x0016dff6, - 0x0018dfe9, - 0x001b3fe5, - 0x001c5fd0, - 0x001ddfc2, - 0x001f1fb6, - 0x00207fa4, - 0x00219f8f, - 0x0022ff7d, - 0x00247f6c, - 0x0024df5b, - 0x00267f4b, - 0x0027df3b, - 0x0029bf3b, - 0x002b5f2f, - 0x002d3f2e, - 0x002f5f2a, - 0x002fff15, - 0x00315f0b, - 0x0032defa, - 0x0033beeb, - 0x0034fed9, - 0x00353ec5, - 0x00361eb0, - 0x00363e9b, - 0x0036be87, - 0x0036be70, - 0x0038fe67, - 0x0044beb2, - 0x00513ef3, - 0x00595f11, - 0x00669f3d, - 0x0078dfdf, - 0x00a143aa, - 0x01642fff, - 0x0162afff, - 0x01620fff, - 0x0160cfff, - 0x015f0fff, - 0x015dafff, - 0x015bcfff, - 0x015bcfff, - 0x015b4fff, - 0x015acfff, - 0x01590fff, - 0x0156cfff, -}; - -static const u32 papd_cal_scalars_tbl_core0_rev7[] = { - 0x0b5e002d, - 0x0ae2002f, - 0x0a3b0032, - 0x09a70035, - 0x09220038, - 0x08ab003b, - 0x081f003f, - 0x07a20043, - 0x07340047, - 0x06d2004b, - 0x067a004f, - 0x06170054, - 0x05bf0059, - 0x0571005e, - 0x051e0064, - 0x04d3006a, - 0x04910070, - 0x044c0077, - 0x040f007e, - 0x03d90085, - 0x03a1008d, - 0x036f0095, - 0x033d009e, - 0x030b00a8, - 0x02e000b2, - 0x02b900bc, - 0x029200c7, - 0x026d00d3, - 0x024900e0, - 0x022900ed, - 0x020a00fb, - 0x01ec010a, - 0x01d20119, - 0x01b7012a, - 0x019e013c, - 0x0188014e, - 0x01720162, - 0x015d0177, - 0x0149018e, - 0x013701a5, - 0x012601be, - 0x011501d8, - 0x010601f4, - 0x00f70212, - 0x00e90231, - 0x00dc0253, - 0x00d00276, - 0x00c4029b, - 0x00b902c3, - 0x00af02ed, - 0x00a50319, - 0x009c0348, - 0x0093037a, - 0x008b03af, - 0x008303e6, - 0x007c0422, - 0x00750460, - 0x006e04a3, - 0x006804e9, - 0x00620533, - 0x005d0582, - 0x005805d6, - 0x0053062e, - 0x004e068c, -}; - -static const u32 papd_comp_epsilon_tbl_core1_rev7[] = { - 0x00000000, - 0x00000000, - 0x00016023, - 0x00006028, - 0x00034036, - 0x0003402e, - 0x0007203c, - 0x0006e037, - 0x00070030, - 0x0009401f, - 0x0009a00f, - 0x000b600d, - 0x000c8007, - 0x000ce007, - 0x00101fff, - 0x00121ff9, - 0x0012e004, - 0x0014dffc, - 0x0016dff6, - 0x0018dfe9, - 0x001b3fe5, - 0x001c5fd0, - 0x001ddfc2, - 0x001f1fb6, - 0x00207fa4, - 0x00219f8f, - 0x0022ff7d, - 0x00247f6c, - 0x0024df5b, - 0x00267f4b, - 0x0027df3b, - 0x0029bf3b, - 0x002b5f2f, - 0x002d3f2e, - 0x002f5f2a, - 0x002fff15, - 0x00315f0b, - 0x0032defa, - 0x0033beeb, - 0x0034fed9, - 0x00353ec5, - 0x00361eb0, - 0x00363e9b, - 0x0036be87, - 0x0036be70, - 0x0038fe67, - 0x0044beb2, - 0x00513ef3, - 0x00595f11, - 0x00669f3d, - 0x0078dfdf, - 0x00a143aa, - 0x01642fff, - 0x0162afff, - 0x01620fff, - 0x0160cfff, - 0x015f0fff, - 0x015dafff, - 0x015bcfff, - 0x015bcfff, - 0x015b4fff, - 0x015acfff, - 0x01590fff, - 0x0156cfff, -}; - -static const u32 papd_cal_scalars_tbl_core1_rev7[] = { - 0x0b5e002d, - 0x0ae2002f, - 0x0a3b0032, - 0x09a70035, - 0x09220038, - 0x08ab003b, - 0x081f003f, - 0x07a20043, - 0x07340047, - 0x06d2004b, - 0x067a004f, - 0x06170054, - 0x05bf0059, - 0x0571005e, - 0x051e0064, - 0x04d3006a, - 0x04910070, - 0x044c0077, - 0x040f007e, - 0x03d90085, - 0x03a1008d, - 0x036f0095, - 0x033d009e, - 0x030b00a8, - 0x02e000b2, - 0x02b900bc, - 0x029200c7, - 0x026d00d3, - 0x024900e0, - 0x022900ed, - 0x020a00fb, - 0x01ec010a, - 0x01d20119, - 0x01b7012a, - 0x019e013c, - 0x0188014e, - 0x01720162, - 0x015d0177, - 0x0149018e, - 0x013701a5, - 0x012601be, - 0x011501d8, - 0x010601f4, - 0x00f70212, - 0x00e90231, - 0x00dc0253, - 0x00d00276, - 0x00c4029b, - 0x00b902c3, - 0x00af02ed, - 0x00a50319, - 0x009c0348, - 0x0093037a, - 0x008b03af, - 0x008303e6, - 0x007c0422, - 0x00750460, - 0x006e04a3, - 0x006804e9, - 0x00620533, - 0x005d0582, - 0x005805d6, - 0x0053062e, - 0x004e068c, -}; - -const struct phytbl_info mimophytbl_info_rev7[] = { - {&frame_struct_rev3, - sizeof(frame_struct_rev3) / sizeof(frame_struct_rev3[0]), 10, 0, 32} - , - {&pilot_tbl_rev3, sizeof(pilot_tbl_rev3) / sizeof(pilot_tbl_rev3[0]), - 11, 0, 16} - , - {&tmap_tbl_rev7, sizeof(tmap_tbl_rev7) / sizeof(tmap_tbl_rev7[0]), 12, - 0, 32} - , - {&intlv_tbl_rev3, sizeof(intlv_tbl_rev3) / sizeof(intlv_tbl_rev3[0]), - 13, 0, 32} - , - {&tdtrn_tbl_rev3, sizeof(tdtrn_tbl_rev3) / sizeof(tdtrn_tbl_rev3[0]), - 14, 0, 32} - , - {&noise_var_tbl_rev7, - sizeof(noise_var_tbl_rev7) / sizeof(noise_var_tbl_rev7[0]), 16, 0, 32} - , - {&mcs_tbl_rev3, sizeof(mcs_tbl_rev3) / sizeof(mcs_tbl_rev3[0]), 18, 0, - 16} - , - {&tdi_tbl20_ant0_rev3, - sizeof(tdi_tbl20_ant0_rev3) / sizeof(tdi_tbl20_ant0_rev3[0]), 19, 128, - 32} - , - {&tdi_tbl20_ant1_rev3, - sizeof(tdi_tbl20_ant1_rev3) / sizeof(tdi_tbl20_ant1_rev3[0]), 19, 256, - 32} - , - {&tdi_tbl40_ant0_rev3, - sizeof(tdi_tbl40_ant0_rev3) / sizeof(tdi_tbl40_ant0_rev3[0]), 19, 640, - 32} - , - {&tdi_tbl40_ant1_rev3, - sizeof(tdi_tbl40_ant1_rev3) / sizeof(tdi_tbl40_ant1_rev3[0]), 19, 768, - 32} - , - {&pltlut_tbl_rev3, sizeof(pltlut_tbl_rev3) / sizeof(pltlut_tbl_rev3[0]), - 20, 0, 32} - , - {&chanest_tbl_rev3, - sizeof(chanest_tbl_rev3) / sizeof(chanest_tbl_rev3[0]), 22, 0, 32} - , - {&frame_lut_rev3, sizeof(frame_lut_rev3) / sizeof(frame_lut_rev3[0]), - 24, 0, 8} - , - {&est_pwr_lut_core0_rev3, - sizeof(est_pwr_lut_core0_rev3) / sizeof(est_pwr_lut_core0_rev3[0]), 26, - 0, 8} - , - {&est_pwr_lut_core1_rev3, - sizeof(est_pwr_lut_core1_rev3) / sizeof(est_pwr_lut_core1_rev3[0]), 27, - 0, 8} - , - {&adj_pwr_lut_core0_rev3, - sizeof(adj_pwr_lut_core0_rev3) / sizeof(adj_pwr_lut_core0_rev3[0]), 26, - 64, 8} - , - {&adj_pwr_lut_core1_rev3, - sizeof(adj_pwr_lut_core1_rev3) / sizeof(adj_pwr_lut_core1_rev3[0]), 27, - 64, 8} - , - {&gainctrl_lut_core0_rev3, - sizeof(gainctrl_lut_core0_rev3) / sizeof(gainctrl_lut_core0_rev3[0]), - 26, 192, 32} - , - {&gainctrl_lut_core1_rev3, - sizeof(gainctrl_lut_core1_rev3) / sizeof(gainctrl_lut_core1_rev3[0]), - 27, 192, 32} - , - {&iq_lut_core0_rev3, - sizeof(iq_lut_core0_rev3) / sizeof(iq_lut_core0_rev3[0]), 26, 320, 32} - , - {&iq_lut_core1_rev3, - sizeof(iq_lut_core1_rev3) / sizeof(iq_lut_core1_rev3[0]), 27, 320, 32} - , - {&loft_lut_core0_rev3, - sizeof(loft_lut_core0_rev3) / sizeof(loft_lut_core0_rev3[0]), 26, 448, - 16} - , - {&loft_lut_core1_rev3, - sizeof(loft_lut_core1_rev3) / sizeof(loft_lut_core1_rev3[0]), 27, 448, - 16} - , - {&papd_comp_rfpwr_tbl_core0_rev3, - sizeof(papd_comp_rfpwr_tbl_core0_rev3) / - sizeof(papd_comp_rfpwr_tbl_core0_rev3[0]), 26, 576, 16} - , - {&papd_comp_rfpwr_tbl_core1_rev3, - sizeof(papd_comp_rfpwr_tbl_core1_rev3) / - sizeof(papd_comp_rfpwr_tbl_core1_rev3[0]), 27, 576, 16} - , - {&papd_comp_epsilon_tbl_core0_rev7, - sizeof(papd_comp_epsilon_tbl_core0_rev7) / - sizeof(papd_comp_epsilon_tbl_core0_rev7[0]), 31, 0, 32} - , - {&papd_cal_scalars_tbl_core0_rev7, - sizeof(papd_cal_scalars_tbl_core0_rev7) / - sizeof(papd_cal_scalars_tbl_core0_rev7[0]), 32, 0, 32} - , - {&papd_comp_epsilon_tbl_core1_rev7, - sizeof(papd_comp_epsilon_tbl_core1_rev7) / - sizeof(papd_comp_epsilon_tbl_core1_rev7[0]), 33, 0, 32} - , - {&papd_cal_scalars_tbl_core1_rev7, - sizeof(papd_cal_scalars_tbl_core1_rev7) / - sizeof(papd_cal_scalars_tbl_core1_rev7[0]), 34, 0, 32} - , -}; - -const u32 mimophytbl_info_sz_rev7 = - sizeof(mimophytbl_info_rev7) / sizeof(mimophytbl_info_rev7[0]); - -const struct phytbl_info mimophytbl_info_rev16[] = { - {&noise_var_tbl_rev7, - sizeof(noise_var_tbl_rev7) / sizeof(noise_var_tbl_rev7[0]), 16, 0, 32} - , - {&est_pwr_lut_core0_rev3, - sizeof(est_pwr_lut_core0_rev3) / sizeof(est_pwr_lut_core0_rev3[0]), 26, - 0, 8} - , - {&est_pwr_lut_core1_rev3, - sizeof(est_pwr_lut_core1_rev3) / sizeof(est_pwr_lut_core1_rev3[0]), 27, - 0, 8} - , - {&adj_pwr_lut_core0_rev3, - sizeof(adj_pwr_lut_core0_rev3) / sizeof(adj_pwr_lut_core0_rev3[0]), 26, - 64, 8} - , - {&adj_pwr_lut_core1_rev3, - sizeof(adj_pwr_lut_core1_rev3) / sizeof(adj_pwr_lut_core1_rev3[0]), 27, - 64, 8} - , - {&gainctrl_lut_core0_rev3, - sizeof(gainctrl_lut_core0_rev3) / sizeof(gainctrl_lut_core0_rev3[0]), - 26, 192, 32} - , - {&gainctrl_lut_core1_rev3, - sizeof(gainctrl_lut_core1_rev3) / sizeof(gainctrl_lut_core1_rev3[0]), - 27, 192, 32} - , - {&iq_lut_core0_rev3, - sizeof(iq_lut_core0_rev3) / sizeof(iq_lut_core0_rev3[0]), 26, 320, 32} - , - {&iq_lut_core1_rev3, - sizeof(iq_lut_core1_rev3) / sizeof(iq_lut_core1_rev3[0]), 27, 320, 32} - , - {&loft_lut_core0_rev3, - sizeof(loft_lut_core0_rev3) / sizeof(loft_lut_core0_rev3[0]), 26, 448, - 16} - , - {&loft_lut_core1_rev3, - sizeof(loft_lut_core1_rev3) / sizeof(loft_lut_core1_rev3[0]), 27, 448, - 16} - , -}; - -const u32 mimophytbl_info_sz_rev16 = - sizeof(mimophytbl_info_rev16) / sizeof(mimophytbl_info_rev16[0]); diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_n.h b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_n.h deleted file mode 100644 index dc8a84e85117..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_n.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define ANT_SWCTRL_TBL_REV3_IDX (0) - -#include -#include "phy_int.h" - -extern const struct phytbl_info mimophytbl_info_rev0[], - mimophytbl_info_rev0_volatile[]; - -extern const u32 mimophytbl_info_sz_rev0, - mimophytbl_info_sz_rev0_volatile; - -extern const struct phytbl_info mimophytbl_info_rev3[], - mimophytbl_info_rev3_volatile[], - mimophytbl_info_rev3_volatile1[], - mimophytbl_info_rev3_volatile2[], - mimophytbl_info_rev3_volatile3[]; - -extern const u32 mimophytbl_info_sz_rev3, - mimophytbl_info_sz_rev3_volatile, - mimophytbl_info_sz_rev3_volatile1, - mimophytbl_info_sz_rev3_volatile2, - mimophytbl_info_sz_rev3_volatile3; - -extern const u32 noise_var_tbl_rev3[]; - -extern const struct phytbl_info mimophytbl_info_rev7[]; - -extern const u32 mimophytbl_info_sz_rev7; - -extern const u32 noise_var_tbl_rev7[]; - -extern const struct phytbl_info mimophytbl_info_rev16[]; - -extern const u32 mimophytbl_info_sz_rev16; diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy_shim.c b/drivers/net/wireless/brcm80211/brcmsmac/phy_shim.c deleted file mode 100644 index a0de5db0cd64..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy_shim.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * This is "two-way" interface, acting as the SHIM layer between driver - * and PHY layer. The driver can optionally call this translation layer - * to do some preprocessing, then reach PHY. On the PHY->driver direction, - * all calls go through this layer since PHY doesn't have access to the - * driver's brcms_hardware pointer. - */ -#include -#include - -#include "main.h" -#include "mac80211_if.h" -#include "phy_shim.h" - -/* PHY SHIM module specific state */ -struct phy_shim_info { - struct brcms_hardware *wlc_hw; /* pointer to main wlc_hw structure */ - struct brcms_c_info *wlc; /* pointer to main wlc structure */ - struct brcms_info *wl; /* pointer to os-specific private state */ -}; - -struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw, - struct brcms_info *wl, - struct brcms_c_info *wlc) { - struct phy_shim_info *physhim = NULL; - - physhim = kzalloc(sizeof(struct phy_shim_info), GFP_ATOMIC); - if (!physhim) - return NULL; - - physhim->wlc_hw = wlc_hw; - physhim->wlc = wlc; - physhim->wl = wl; - - return physhim; -} - -void wlc_phy_shim_detach(struct phy_shim_info *physhim) -{ - kfree(physhim); -} - -struct wlapi_timer *wlapi_init_timer(struct phy_shim_info *physhim, - void (*fn)(struct brcms_phy *pi), - void *arg, const char *name) -{ - return (struct wlapi_timer *) - brcms_init_timer(physhim->wl, (void (*)(void *))fn, - arg, name); -} - -void wlapi_free_timer(struct wlapi_timer *t) -{ - brcms_free_timer((struct brcms_timer *)t); -} - -void -wlapi_add_timer(struct wlapi_timer *t, uint ms, int periodic) -{ - brcms_add_timer((struct brcms_timer *)t, ms, periodic); -} - -bool wlapi_del_timer(struct wlapi_timer *t) -{ - return brcms_del_timer((struct brcms_timer *)t); -} - -void wlapi_intrson(struct phy_shim_info *physhim) -{ - brcms_intrson(physhim->wl); -} - -u32 wlapi_intrsoff(struct phy_shim_info *physhim) -{ - return brcms_intrsoff(physhim->wl); -} - -void wlapi_intrsrestore(struct phy_shim_info *physhim, u32 macintmask) -{ - brcms_intrsrestore(physhim->wl, macintmask); -} - -void wlapi_bmac_write_shm(struct phy_shim_info *physhim, uint offset, u16 v) -{ - brcms_b_write_shm(physhim->wlc_hw, offset, v); -} - -u16 wlapi_bmac_read_shm(struct phy_shim_info *physhim, uint offset) -{ - return brcms_b_read_shm(physhim->wlc_hw, offset); -} - -void -wlapi_bmac_mhf(struct phy_shim_info *physhim, u8 idx, u16 mask, - u16 val, int bands) -{ - brcms_b_mhf(physhim->wlc_hw, idx, mask, val, bands); -} - -void wlapi_bmac_corereset(struct phy_shim_info *physhim, u32 flags) -{ - brcms_b_corereset(physhim->wlc_hw, flags); -} - -void wlapi_suspend_mac_and_wait(struct phy_shim_info *physhim) -{ - brcms_c_suspend_mac_and_wait(physhim->wlc); -} - -void wlapi_switch_macfreq(struct phy_shim_info *physhim, u8 spurmode) -{ - brcms_b_switch_macfreq(physhim->wlc_hw, spurmode); -} - -void wlapi_enable_mac(struct phy_shim_info *physhim) -{ - brcms_c_enable_mac(physhim->wlc); -} - -void wlapi_bmac_mctrl(struct phy_shim_info *physhim, u32 mask, u32 val) -{ - brcms_b_mctrl(physhim->wlc_hw, mask, val); -} - -void wlapi_bmac_phy_reset(struct phy_shim_info *physhim) -{ - brcms_b_phy_reset(physhim->wlc_hw); -} - -void wlapi_bmac_bw_set(struct phy_shim_info *physhim, u16 bw) -{ - brcms_b_bw_set(physhim->wlc_hw, bw); -} - -u16 wlapi_bmac_get_txant(struct phy_shim_info *physhim) -{ - return brcms_b_get_txant(physhim->wlc_hw); -} - -void wlapi_bmac_phyclk_fgc(struct phy_shim_info *physhim, bool clk) -{ - brcms_b_phyclk_fgc(physhim->wlc_hw, clk); -} - -void wlapi_bmac_macphyclk_set(struct phy_shim_info *physhim, bool clk) -{ - brcms_b_macphyclk_set(physhim->wlc_hw, clk); -} - -void wlapi_bmac_core_phypll_ctl(struct phy_shim_info *physhim, bool on) -{ - brcms_b_core_phypll_ctl(physhim->wlc_hw, on); -} - -void wlapi_bmac_core_phypll_reset(struct phy_shim_info *physhim) -{ - brcms_b_core_phypll_reset(physhim->wlc_hw); -} - -void wlapi_bmac_ucode_wake_override_phyreg_set(struct phy_shim_info *physhim) -{ - brcms_c_ucode_wake_override_set(physhim->wlc_hw, - BRCMS_WAKE_OVERRIDE_PHYREG); -} - -void wlapi_bmac_ucode_wake_override_phyreg_clear(struct phy_shim_info *physhim) -{ - brcms_c_ucode_wake_override_clear(physhim->wlc_hw, - BRCMS_WAKE_OVERRIDE_PHYREG); -} - -void -wlapi_bmac_write_template_ram(struct phy_shim_info *physhim, int offset, - int len, void *buf) -{ - brcms_b_write_template_ram(physhim->wlc_hw, offset, len, buf); -} - -u16 wlapi_bmac_rate_shm_offset(struct phy_shim_info *physhim, u8 rate) -{ - return brcms_b_rate_shm_offset(physhim->wlc_hw, rate); -} - -void wlapi_ucode_sample_init(struct phy_shim_info *physhim) -{ -} - -void -wlapi_copyfrom_objmem(struct phy_shim_info *physhim, uint offset, void *buf, - int len, u32 sel) -{ - brcms_b_copyfrom_objmem(physhim->wlc_hw, offset, buf, len, sel); -} - -void -wlapi_copyto_objmem(struct phy_shim_info *physhim, uint offset, const void *buf, - int l, u32 sel) -{ - brcms_b_copyto_objmem(physhim->wlc_hw, offset, buf, l, sel); -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy_shim.h b/drivers/net/wireless/brcm80211/brcmsmac/phy_shim.h deleted file mode 100644 index 2c5b66b75970..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy_shim.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * phy_shim.h: stuff defined in phy_shim.c and included only by the phy - */ - -#ifndef _BRCM_PHY_SHIM_H_ -#define _BRCM_PHY_SHIM_H_ - -#include "types.h" - -#define RADAR_TYPE_NONE 0 /* Radar type None */ -#define RADAR_TYPE_ETSI_1 1 /* ETSI 1 Radar type */ -#define RADAR_TYPE_ETSI_2 2 /* ETSI 2 Radar type */ -#define RADAR_TYPE_ETSI_3 3 /* ETSI 3 Radar type */ -#define RADAR_TYPE_ITU_E 4 /* ITU E Radar type */ -#define RADAR_TYPE_ITU_K 5 /* ITU K Radar type */ -#define RADAR_TYPE_UNCLASSIFIED 6 /* Unclassified Radar type */ -#define RADAR_TYPE_BIN5 7 /* long pulse radar type */ -#define RADAR_TYPE_STG2 8 /* staggered-2 radar */ -#define RADAR_TYPE_STG3 9 /* staggered-3 radar */ -#define RADAR_TYPE_FRA 10 /* French radar */ - -/* French radar pulse widths */ -#define FRA_T1_20MHZ 52770 -#define FRA_T2_20MHZ 61538 -#define FRA_T3_20MHZ 66002 -#define FRA_T1_40MHZ 105541 -#define FRA_T2_40MHZ 123077 -#define FRA_T3_40MHZ 132004 -#define FRA_ERR_20MHZ 60 -#define FRA_ERR_40MHZ 120 - -#define ANTSEL_NA 0 /* No boardlevel selection available */ -#define ANTSEL_2x4 1 /* 2x4 boardlevel selection available */ -#define ANTSEL_2x3 2 /* 2x3 CB2 boardlevel selection available */ - -/* Rx Antenna diversity control values */ -#define ANT_RX_DIV_FORCE_0 0 /* Use antenna 0 */ -#define ANT_RX_DIV_FORCE_1 1 /* Use antenna 1 */ -#define ANT_RX_DIV_START_1 2 /* Choose starting with 1 */ -#define ANT_RX_DIV_START_0 3 /* Choose starting with 0 */ -#define ANT_RX_DIV_ENABLE 3 /* APHY bbConfig Enable RX Diversity */ -#define ANT_RX_DIV_DEF ANT_RX_DIV_START_0 /* default antdiv setting */ - -#define WL_ANT_RX_MAX 2 /* max 2 receive antennas */ -#define WL_ANT_HT_RX_MAX 3 /* max 3 receive antennas/cores */ -#define WL_ANT_IDX_1 0 /* antenna index 1 */ -#define WL_ANT_IDX_2 1 /* antenna index 2 */ - -/* values for n_preamble_type */ -#define BRCMS_N_PREAMBLE_MIXEDMODE 0 -#define BRCMS_N_PREAMBLE_GF 1 -#define BRCMS_N_PREAMBLE_GF_BRCM 2 - -#define WL_TX_POWER_RATES_LEGACY 45 -#define WL_TX_POWER_MCS20_FIRST 12 -#define WL_TX_POWER_MCS20_NUM 16 -#define WL_TX_POWER_MCS40_FIRST 28 -#define WL_TX_POWER_MCS40_NUM 17 - - -#define WL_TX_POWER_RATES 101 -#define WL_TX_POWER_CCK_FIRST 0 -#define WL_TX_POWER_CCK_NUM 4 -/* Index for first 20MHz OFDM SISO rate */ -#define WL_TX_POWER_OFDM_FIRST 4 -/* Index for first 20MHz OFDM CDD rate */ -#define WL_TX_POWER_OFDM20_CDD_FIRST 12 -/* Index for first 40MHz OFDM SISO rate */ -#define WL_TX_POWER_OFDM40_SISO_FIRST 52 -/* Index for first 40MHz OFDM CDD rate */ -#define WL_TX_POWER_OFDM40_CDD_FIRST 60 -#define WL_TX_POWER_OFDM_NUM 8 -/* Index for first 20MHz MCS SISO rate */ -#define WL_TX_POWER_MCS20_SISO_FIRST 20 -/* Index for first 20MHz MCS CDD rate */ -#define WL_TX_POWER_MCS20_CDD_FIRST 28 -/* Index for first 20MHz MCS STBC rate */ -#define WL_TX_POWER_MCS20_STBC_FIRST 36 -/* Index for first 20MHz MCS SDM rate */ -#define WL_TX_POWER_MCS20_SDM_FIRST 44 -/* Index for first 40MHz MCS SISO rate */ -#define WL_TX_POWER_MCS40_SISO_FIRST 68 -/* Index for first 40MHz MCS CDD rate */ -#define WL_TX_POWER_MCS40_CDD_FIRST 76 -/* Index for first 40MHz MCS STBC rate */ -#define WL_TX_POWER_MCS40_STBC_FIRST 84 -/* Index for first 40MHz MCS SDM rate */ -#define WL_TX_POWER_MCS40_SDM_FIRST 92 -#define WL_TX_POWER_MCS_1_STREAM_NUM 8 -#define WL_TX_POWER_MCS_2_STREAM_NUM 8 -/* Index for 40MHz rate MCS 32 */ -#define WL_TX_POWER_MCS_32 100 -#define WL_TX_POWER_MCS_32_NUM 1 - -/* sslpnphy specifics */ -/* Index for first 20MHz MCS SISO rate */ -#define WL_TX_POWER_MCS20_SISO_FIRST_SSN 12 - -/* struct tx_power::flags bits */ -#define WL_TX_POWER_F_ENABLED 1 -#define WL_TX_POWER_F_HW 2 -#define WL_TX_POWER_F_MIMO 4 -#define WL_TX_POWER_F_SISO 8 - -/* values to force tx/rx chain */ -#define BRCMS_N_TXRX_CHAIN0 0 -#define BRCMS_N_TXRX_CHAIN1 1 - -struct brcms_phy; - -extern struct phy_shim_info *wlc_phy_shim_attach(struct brcms_hardware *wlc_hw, - struct brcms_info *wl, - struct brcms_c_info *wlc); -extern void wlc_phy_shim_detach(struct phy_shim_info *physhim); - -/* PHY to WL utility functions */ -extern struct wlapi_timer *wlapi_init_timer(struct phy_shim_info *physhim, - void (*fn) (struct brcms_phy *pi), - void *arg, const char *name); -extern void wlapi_free_timer(struct wlapi_timer *t); -extern void wlapi_add_timer(struct wlapi_timer *t, uint ms, int periodic); -extern bool wlapi_del_timer(struct wlapi_timer *t); -extern void wlapi_intrson(struct phy_shim_info *physhim); -extern u32 wlapi_intrsoff(struct phy_shim_info *physhim); -extern void wlapi_intrsrestore(struct phy_shim_info *physhim, - u32 macintmask); - -extern void wlapi_bmac_write_shm(struct phy_shim_info *physhim, uint offset, - u16 v); -extern u16 wlapi_bmac_read_shm(struct phy_shim_info *physhim, uint offset); -extern void wlapi_bmac_mhf(struct phy_shim_info *physhim, u8 idx, - u16 mask, u16 val, int bands); -extern void wlapi_bmac_corereset(struct phy_shim_info *physhim, u32 flags); -extern void wlapi_suspend_mac_and_wait(struct phy_shim_info *physhim); -extern void wlapi_switch_macfreq(struct phy_shim_info *physhim, u8 spurmode); -extern void wlapi_enable_mac(struct phy_shim_info *physhim); -extern void wlapi_bmac_mctrl(struct phy_shim_info *physhim, u32 mask, - u32 val); -extern void wlapi_bmac_phy_reset(struct phy_shim_info *physhim); -extern void wlapi_bmac_bw_set(struct phy_shim_info *physhim, u16 bw); -extern void wlapi_bmac_phyclk_fgc(struct phy_shim_info *physhim, bool clk); -extern void wlapi_bmac_macphyclk_set(struct phy_shim_info *physhim, bool clk); -extern void wlapi_bmac_core_phypll_ctl(struct phy_shim_info *physhim, bool on); -extern void wlapi_bmac_core_phypll_reset(struct phy_shim_info *physhim); -extern void wlapi_bmac_ucode_wake_override_phyreg_set(struct phy_shim_info * - physhim); -extern void wlapi_bmac_ucode_wake_override_phyreg_clear(struct phy_shim_info * - physhim); -extern void wlapi_bmac_write_template_ram(struct phy_shim_info *physhim, int o, - int len, void *buf); -extern u16 wlapi_bmac_rate_shm_offset(struct phy_shim_info *physhim, - u8 rate); -extern void wlapi_ucode_sample_init(struct phy_shim_info *physhim); -extern void wlapi_copyfrom_objmem(struct phy_shim_info *physhim, uint, - void *buf, int, u32 sel); -extern void wlapi_copyto_objmem(struct phy_shim_info *physhim, uint, - const void *buf, int, u32); - -extern void wlapi_high_update_phy_mode(struct phy_shim_info *physhim, - u32 phy_mode); -extern u16 wlapi_bmac_get_txant(struct phy_shim_info *physhim); - -#endif /* _BRCM_PHY_SHIM_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c b/drivers/net/wireless/brcm80211/brcmsmac/pmu.c deleted file mode 100644 index 71b80381f3ad..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2011 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -#include -#include -#include -#include "pub.h" -#include "aiutils.h" -#include "pmu.h" -#include "soc.h" - -/* - * external LPO crystal frequency - */ -#define EXT_ILP_HZ 32768 - -/* - * Duration for ILP clock frequency measurment in milliseconds - * - * remark: 1000 must be an integer multiple of this duration - */ -#define ILP_CALC_DUR 10 - -/* Fields in pmucontrol */ -#define PCTL_ILP_DIV_MASK 0xffff0000 -#define PCTL_ILP_DIV_SHIFT 16 -#define PCTL_PLL_PLLCTL_UPD 0x00000400 /* rev 2 */ -#define PCTL_NOILP_ON_WAIT 0x00000200 /* rev 1 */ -#define PCTL_HT_REQ_EN 0x00000100 -#define PCTL_ALP_REQ_EN 0x00000080 -#define PCTL_XTALFREQ_MASK 0x0000007c -#define PCTL_XTALFREQ_SHIFT 2 -#define PCTL_ILP_DIV_EN 0x00000002 -#define PCTL_LPO_SEL 0x00000001 - -/* ILP clock */ -#define ILP_CLOCK 32000 - -/* ALP clock on pre-PMU chips */ -#define ALP_CLOCK 20000000 - -/* pmustatus */ -#define PST_EXTLPOAVAIL 0x0100 -#define PST_WDRESET 0x0080 -#define PST_INTPEND 0x0040 -#define PST_SBCLKST 0x0030 -#define PST_SBCLKST_ILP 0x0010 -#define PST_SBCLKST_ALP 0x0020 -#define PST_SBCLKST_HT 0x0030 -#define PST_ALPAVAIL 0x0008 -#define PST_HTAVAIL 0x0004 -#define PST_RESINIT 0x0003 - -/* PMU resource bit position */ -#define PMURES_BIT(bit) (1 << (bit)) - -/* PMU corerev and chip specific PLL controls. - * PMU_PLL_XX where is PMU corerev and is an arbitrary - * number to differentiate different PLLs controlled by the same PMU rev. - */ - -/* pmu XtalFreqRatio */ -#define PMU_XTALFREQ_REG_ILPCTR_MASK 0x00001FFF -#define PMU_XTALFREQ_REG_MEASURE_MASK 0x80000000 -#define PMU_XTALFREQ_REG_MEASURE_SHIFT 31 - -/* 4313 resources */ -#define RES4313_BB_PU_RSRC 0 -#define RES4313_ILP_REQ_RSRC 1 -#define RES4313_XTAL_PU_RSRC 2 -#define RES4313_ALP_AVAIL_RSRC 3 -#define RES4313_RADIO_PU_RSRC 4 -#define RES4313_BG_PU_RSRC 5 -#define RES4313_VREG1P4_PU_RSRC 6 -#define RES4313_AFE_PWRSW_RSRC 7 -#define RES4313_RX_PWRSW_RSRC 8 -#define RES4313_TX_PWRSW_RSRC 9 -#define RES4313_BB_PWRSW_RSRC 10 -#define RES4313_SYNTH_PWRSW_RSRC 11 -#define RES4313_MISC_PWRSW_RSRC 12 -#define RES4313_BB_PLL_PWRSW_RSRC 13 -#define RES4313_HT_AVAIL_RSRC 14 -#define RES4313_MACPHY_CLK_AVAIL_RSRC 15 - -u16 si_pmu_fast_pwrup_delay(struct si_pub *sih) -{ - uint delay = PMU_MAX_TRANSITION_DLY; - - switch (ai_get_chip_id(sih)) { - case BCMA_CHIP_ID_BCM43224: - case BCMA_CHIP_ID_BCM43225: - case BCMA_CHIP_ID_BCM4313: - delay = 3700; - break; - default: - break; - } - - return (u16) delay; -} - -u32 si_pmu_measure_alpclk(struct si_pub *sih) -{ - struct si_info *sii = container_of(sih, struct si_info, pub); - struct bcma_device *core; - u32 alp_khz; - - if (ai_get_pmurev(sih) < 10) - return 0; - - /* Remember original core before switch to chipc */ - core = sii->icbus->drv_cc.core; - - if (bcma_read32(core, CHIPCREGOFFS(pmustatus)) & PST_EXTLPOAVAIL) { - u32 ilp_ctr, alp_hz; - - /* - * Enable the reg to measure the freq, - * in case it was disabled before - */ - bcma_write32(core, CHIPCREGOFFS(pmu_xtalfreq), - 1U << PMU_XTALFREQ_REG_MEASURE_SHIFT); - - /* Delay for well over 4 ILP clocks */ - udelay(1000); - - /* Read the latched number of ALP ticks per 4 ILP ticks */ - ilp_ctr = bcma_read32(core, CHIPCREGOFFS(pmu_xtalfreq)) & - PMU_XTALFREQ_REG_ILPCTR_MASK; - - /* - * Turn off the PMU_XTALFREQ_REG_MEASURE_SHIFT - * bit to save power - */ - bcma_write32(core, CHIPCREGOFFS(pmu_xtalfreq), 0); - - /* Calculate ALP frequency */ - alp_hz = (ilp_ctr * EXT_ILP_HZ) / 4; - - /* - * Round to nearest 100KHz, and at - * the same time convert to KHz - */ - alp_khz = (alp_hz + 50000) / 100000 * 100; - } else - alp_khz = 0; - - return alp_khz; -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pmu.h b/drivers/net/wireless/brcm80211/brcmsmac/pmu.h deleted file mode 100644 index 20e2012d5a3a..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/pmu.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -#ifndef _BRCM_PMU_H_ -#define _BRCM_PMU_H_ - -#include "types.h" - -extern u16 si_pmu_fast_pwrup_delay(struct si_pub *sih); -extern u32 si_pmu_measure_alpclk(struct si_pub *sih); - -#endif /* _BRCM_PMU_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pub.h b/drivers/net/wireless/brcm80211/brcmsmac/pub.h deleted file mode 100644 index d36ea5e1cc49..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/pub.h +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_PUB_H_ -#define _BRCM_PUB_H_ - -#include -#include -#include "types.h" -#include "defs.h" - -#define BRCMS_NUMRATES 16 /* max # of rates in a rateset */ - -/* phy types */ -#define PHY_TYPE_A 0 /* Phy type A */ -#define PHY_TYPE_G 2 /* Phy type G */ -#define PHY_TYPE_N 4 /* Phy type N */ -#define PHY_TYPE_LP 5 /* Phy type Low Power A/B/G */ -#define PHY_TYPE_SSN 6 /* Phy type Single Stream N */ -#define PHY_TYPE_LCN 8 /* Phy type Single Stream N */ -#define PHY_TYPE_LCNXN 9 /* Phy type 2-stream N */ -#define PHY_TYPE_HT 7 /* Phy type 3-Stream N */ - -/* bw */ -#define BRCMS_10_MHZ 10 /* 10Mhz nphy channel bandwidth */ -#define BRCMS_20_MHZ 20 /* 20Mhz nphy channel bandwidth */ -#define BRCMS_40_MHZ 40 /* 40Mhz nphy channel bandwidth */ - -#define BRCMS_RSSI_MINVAL -200 /* Low value, e.g. for forcing roam */ -#define BRCMS_RSSI_NO_SIGNAL -91 /* NDIS RSSI link quality cutoffs */ -#define BRCMS_RSSI_VERY_LOW -80 /* Very low quality cutoffs */ -#define BRCMS_RSSI_LOW -70 /* Low quality cutoffs */ -#define BRCMS_RSSI_GOOD -68 /* Good quality cutoffs */ -#define BRCMS_RSSI_VERY_GOOD -58 /* Very good quality cutoffs */ -#define BRCMS_RSSI_EXCELLENT -57 /* Excellent quality cutoffs */ - -/* a large TX Power as an init value to factor out of min() calculations, - * keep low enough to fit in an s8, units are .25 dBm - */ -#define BRCMS_TXPWR_MAX (127) /* ~32 dBm = 1,500 mW */ - -/* rate related definitions */ -#define BRCMS_RATE_FLAG 0x80 /* Flag to indicate it is a basic rate */ -#define BRCMS_RATE_MASK 0x7f /* Rate value mask w/o basic rate flag */ - -/* legacy rx Antenna diversity for SISO rates */ -#define ANT_RX_DIV_FORCE_0 0 /* Use antenna 0 */ -#define ANT_RX_DIV_FORCE_1 1 /* Use antenna 1 */ -#define ANT_RX_DIV_START_1 2 /* Choose starting with 1 */ -#define ANT_RX_DIV_START_0 3 /* Choose starting with 0 */ -#define ANT_RX_DIV_ENABLE 3 /* APHY bbConfig Enable RX Diversity */ -/* default antdiv setting */ -#define ANT_RX_DIV_DEF ANT_RX_DIV_START_0 - -/* legacy rx Antenna diversity for SISO rates */ -/* Tx on antenna 0, "legacy term Main" */ -#define ANT_TX_FORCE_0 0 -/* Tx on antenna 1, "legacy term Aux" */ -#define ANT_TX_FORCE_1 1 -/* Tx on phy's last good Rx antenna */ -#define ANT_TX_LAST_RX 3 -/* driver's default tx antenna setting */ -#define ANT_TX_DEF 3 - -/* Tx Chain values */ -/* def bitmap of txchain */ -#define TXCHAIN_DEF 0x1 -/* default bitmap of tx chains for nphy */ -#define TXCHAIN_DEF_NPHY 0x3 -/* default bitmap of tx chains for nphy */ -#define TXCHAIN_DEF_HTPHY 0x7 -/* def bitmap of rxchain */ -#define RXCHAIN_DEF 0x1 -/* default bitmap of rx chains for nphy */ -#define RXCHAIN_DEF_NPHY 0x3 -/* default bitmap of rx chains for nphy */ -#define RXCHAIN_DEF_HTPHY 0x7 -/* no antenna switch */ -#define ANTSWITCH_NONE 0 -/* antenna switch on 4321CB2, 2of3 */ -#define ANTSWITCH_TYPE_1 1 -/* antenna switch on 4321MPCI, 2of3 */ -#define ANTSWITCH_TYPE_2 2 -/* antenna switch on 4322, 2of3 */ -#define ANTSWITCH_TYPE_3 3 - -#define RXBUFSZ PKTBUFSZ - -#define MAX_STREAMS_SUPPORTED 4 /* max number of streams supported */ - -struct brcm_rateset { - /* # rates in this set */ - u32 count; - /* rates in 500kbps units w/hi bit set if basic */ - u8 rates[WL_NUMRATES]; -}; - -struct brcms_c_rateset { - uint count; /* number of rates in rates[] */ - /* rates in 500kbps units w/hi bit set if basic */ - u8 rates[BRCMS_NUMRATES]; - u8 htphy_membership; /* HT PHY Membership */ - u8 mcs[MCSSET_LEN]; /* supported mcs index bit map */ -}; - -/* All the HT-specific default advertised capabilities (including AMPDU) - * should be grouped here at one place - */ -#define AMPDU_DEF_MPDU_DENSITY 6 /* default mpdu density (110 ==> 4us) */ - -/* wlc internal bss_info */ -struct brcms_bss_info { - u8 BSSID[ETH_ALEN]; /* network BSSID */ - u16 flags; /* flags for internal attributes */ - u8 SSID_len; /* the length of SSID */ - u8 SSID[32]; /* SSID string */ - s16 RSSI; /* receive signal strength (in dBm) */ - s16 SNR; /* receive signal SNR in dB */ - u16 beacon_period; /* units are Kusec */ - u16 chanspec; /* Channel num, bw, ctrl_sb and band */ - struct brcms_c_rateset rateset; /* supported rates */ -}; - -#define MAC80211_PROMISC_BCNS (1 << 0) -#define MAC80211_SCAN (1 << 1) - -/* - * Public portion of common driver state structure. - * The wlc handle points at this. - */ -struct brcms_pub { - struct brcms_c_info *wlc; - struct ieee80211_hw *ieee_hw; - struct scb_ampdu *global_ampdu; - uint mac80211_state; - uint unit; /* device instance number */ - uint corerev; /* core revision */ - struct si_pub *sih; /* SI handle (cookie for siutils calls) */ - bool up; /* interface up and running */ - bool hw_off; /* HW is off */ - bool hw_up; /* one time hw up/down */ - bool _piomode; /* true if pio mode */ - uint _nbands; /* # bands supported */ - uint now; /* # elapsed seconds */ - - bool delayed_down; /* down delayed */ - bool associated; /* true:part of [I]BSS, false: not */ - /* (union of stas_associated, aps_associated) */ - bool _ampdu; /* ampdu enabled or not */ - u8 _n_enab; /* bitmap of 11N + HT support */ - - u8 cur_etheraddr[ETH_ALEN]; /* our local ethernet address */ - - u32 radio_disabled; /* bit vector for radio disabled reasons */ - - u16 boardrev; /* version # of particular board */ - u8 sromrev; /* version # of the srom */ - char srom_ccode[BRCM_CNTRY_BUF_SZ]; /* Country Code in SROM */ - u32 boardflags; /* Board specific flags from srom */ - u32 boardflags2; /* More board flags if sromrev >= 4 */ - bool phy_11ncapable; /* the PHY/HW is capable of 802.11N */ - - struct wl_cnt *_cnt; /* low-level counters in driver */ - struct dentry *dbgfs_dir; -}; - -enum wlc_par_id { - IOV_MPC = 1, - IOV_RTSTHRESH, - IOV_QTXPOWER, - IOV_BCN_LI_BCN /* Beacon listen interval in # of beacons */ -}; - -/*********************************************** - * Feature-related macros to optimize out code * - * ********************************************* - */ - -#define ENAB_1x1 0x01 -#define ENAB_2x2 0x02 -#define ENAB_3x3 0x04 -#define ENAB_4x4 0x08 -#define SUPPORT_11N (ENAB_1x1|ENAB_2x2) -#define SUPPORT_HT (ENAB_1x1|ENAB_2x2|ENAB_3x3) - -/* WL11N Support */ -#define AMPDU_AGG_HOST 1 - -/* network protection config */ -#define BRCMS_PROT_G_SPEC 1 /* SPEC g protection */ -#define BRCMS_PROT_G_OVR 2 /* SPEC g prot override */ -#define BRCMS_PROT_G_USER 3 /* gmode specified by user */ -#define BRCMS_PROT_OVERLAP 4 /* overlap */ -#define BRCMS_PROT_N_USER 10 /* nmode specified by user */ -#define BRCMS_PROT_N_CFG 11 /* n protection */ -#define BRCMS_PROT_N_CFG_OVR 12 /* n protection override */ -#define BRCMS_PROT_N_NONGF 13 /* non-GF protection */ -#define BRCMS_PROT_N_NONGF_OVR 14 /* non-GF protection override */ -#define BRCMS_PROT_N_PAM_OVR 15 /* n preamble override */ -#define BRCMS_PROT_N_OBSS 16 /* non-HT OBSS present */ - -/* - * 54g modes (basic bits may still be overridden) - * - * GMODE_LEGACY_B - * Rateset: 1b, 2b, 5.5, 11 - * Preamble: Long - * Shortslot: Off - * GMODE_AUTO - * Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54 - * Extended Rateset: 6, 9, 12, 48 - * Preamble: Long - * Shortslot: Auto - * GMODE_ONLY - * Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54 - * Extended Rateset: 6b, 9, 12b, 48 - * Preamble: Short required - * Shortslot: Auto - * GMODE_B_DEFERRED - * Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54 - * Extended Rateset: 6, 9, 12, 48 - * Preamble: Long - * Shortslot: On - * GMODE_PERFORMANCE - * Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54 - * Preamble: Short required - * Shortslot: On and required - * GMODE_LRS - * Rateset: 1b, 2b, 5.5b, 11b - * Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54 - * Preamble: Long - * Shortslot: Auto - */ -#define GMODE_LEGACY_B 0 -#define GMODE_AUTO 1 -#define GMODE_ONLY 2 -#define GMODE_B_DEFERRED 3 -#define GMODE_PERFORMANCE 4 -#define GMODE_LRS 5 -#define GMODE_MAX 6 - -/* MCS values greater than this enable multiple streams */ -#define HIGHEST_SINGLE_STREAM_MCS 7 - -#define MAXBANDS 2 /* Maximum #of bands */ - -/* max number of antenna configurations */ -#define ANT_SELCFG_MAX 4 - -struct brcms_antselcfg { - u8 ant_config[ANT_SELCFG_MAX]; /* antenna configuration */ - u8 num_antcfg; /* number of available antenna configurations */ -}; - -/* common functions for every port */ -extern struct brcms_c_info * -brcms_c_attach(struct brcms_info *wl, struct bcma_device *core, uint unit, - bool piomode, uint *perr); -extern uint brcms_c_detach(struct brcms_c_info *wlc); -extern int brcms_c_up(struct brcms_c_info *wlc); -extern uint brcms_c_down(struct brcms_c_info *wlc); - -extern bool brcms_c_chipmatch(struct bcma_device *core); -extern void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx); -extern void brcms_c_reset(struct brcms_c_info *wlc); - -extern void brcms_c_intrson(struct brcms_c_info *wlc); -extern u32 brcms_c_intrsoff(struct brcms_c_info *wlc); -extern void brcms_c_intrsrestore(struct brcms_c_info *wlc, u32 macintmask); -extern bool brcms_c_intrsupd(struct brcms_c_info *wlc); -extern bool brcms_c_isr(struct brcms_c_info *wlc); -extern bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded); -extern bool brcms_c_sendpkt_mac80211(struct brcms_c_info *wlc, - struct sk_buff *sdu, - struct ieee80211_hw *hw); -extern bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid); -extern void brcms_c_protection_upd(struct brcms_c_info *wlc, uint idx, - int val); -extern int brcms_c_get_header_len(void); -extern void brcms_c_set_addrmatch(struct brcms_c_info *wlc, - int match_reg_offset, - const u8 *addr); -extern void brcms_c_wme_setparams(struct brcms_c_info *wlc, u16 aci, - const struct ieee80211_tx_queue_params *arg, - bool suspend); -extern struct brcms_pub *brcms_c_pub(struct brcms_c_info *wlc); -extern void brcms_c_ampdu_flush(struct brcms_c_info *wlc, - struct ieee80211_sta *sta, u16 tid); -extern void brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid, - u8 ba_wsize, uint max_rx_ampdu_bytes); -extern int brcms_c_module_register(struct brcms_pub *pub, - const char *name, struct brcms_info *hdl, - int (*down_fn)(void *handle)); -extern int brcms_c_module_unregister(struct brcms_pub *pub, const char *name, - struct brcms_info *hdl); -extern void brcms_c_suspend_mac_and_wait(struct brcms_c_info *wlc); -extern void brcms_c_enable_mac(struct brcms_c_info *wlc); -extern void brcms_c_associate_upd(struct brcms_c_info *wlc, bool state); -extern void brcms_c_scan_start(struct brcms_c_info *wlc); -extern void brcms_c_scan_stop(struct brcms_c_info *wlc); -extern int brcms_c_get_curband(struct brcms_c_info *wlc); -extern int brcms_c_set_channel(struct brcms_c_info *wlc, u16 channel); -extern int brcms_c_set_rate_limit(struct brcms_c_info *wlc, u16 srl, u16 lrl); -extern void brcms_c_get_current_rateset(struct brcms_c_info *wlc, - struct brcm_rateset *currs); -extern int brcms_c_set_rateset(struct brcms_c_info *wlc, - struct brcm_rateset *rs); -extern int brcms_c_set_beacon_period(struct brcms_c_info *wlc, u16 period); -extern u16 brcms_c_get_phy_type(struct brcms_c_info *wlc, int phyidx); -extern void brcms_c_set_shortslot_override(struct brcms_c_info *wlc, - s8 sslot_override); -extern void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, - u8 interval); -extern u64 brcms_c_tsf_get(struct brcms_c_info *wlc); -extern void brcms_c_tsf_set(struct brcms_c_info *wlc, u64 tsf); -extern int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr); -extern int brcms_c_get_tx_power(struct brcms_c_info *wlc); -extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc); -extern void brcms_c_mute(struct brcms_c_info *wlc, bool on); -extern bool brcms_c_tx_flush_completed(struct brcms_c_info *wlc); -extern void brcms_c_start_station(struct brcms_c_info *wlc, u8 *addr); -extern void brcms_c_start_ap(struct brcms_c_info *wlc, u8 *addr, - const u8 *bssid, u8 *ssid, size_t ssid_len); -extern void brcms_c_start_adhoc(struct brcms_c_info *wlc, u8 *addr); -extern void brcms_c_update_beacon(struct brcms_c_info *wlc); -extern void brcms_c_set_new_beacon(struct brcms_c_info *wlc, - struct sk_buff *beacon, u16 tim_offset, - u16 dtim_period); -extern void brcms_c_set_new_probe_resp(struct brcms_c_info *wlc, - struct sk_buff *probe_resp); -extern void brcms_c_enable_probe_resp(struct brcms_c_info *wlc, bool enable); -extern void brcms_c_set_ssid(struct brcms_c_info *wlc, u8 *ssid, - size_t ssid_len); - -#endif /* _BRCM_PUB_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/rate.c b/drivers/net/wireless/brcm80211/brcmsmac/rate.c deleted file mode 100644 index 0a0c0ad4f96f..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/rate.c +++ /dev/null @@ -1,514 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -#include "d11.h" -#include "pub.h" -#include "rate.h" - -/* - * Rate info per rate: It tells whether a rate is ofdm or not and its phy_rate - * value - */ -const u8 rate_info[BRCM_MAXRATE + 1] = { - /* 0 1 2 3 4 5 6 7 8 9 */ -/* 0 */ 0x00, 0x00, 0x0a, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 10 */ 0x00, 0x37, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x00, -/* 20 */ 0x00, 0x00, 0x6e, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 30 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, -/* 40 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, -/* 50 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 60 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 70 */ 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 80 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* 90 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, -/* 100 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c -}; - -/* rates are in units of Kbps */ -const struct brcms_mcs_info mcs_table[MCS_TABLE_SIZE] = { - /* MCS 0: SS 1, MOD: BPSK, CR 1/2 */ - {6500, 13500, CEIL(6500 * 10, 9), CEIL(13500 * 10, 9), 0x00, - BRCM_RATE_6M}, - /* MCS 1: SS 1, MOD: QPSK, CR 1/2 */ - {13000, 27000, CEIL(13000 * 10, 9), CEIL(27000 * 10, 9), 0x08, - BRCM_RATE_12M}, - /* MCS 2: SS 1, MOD: QPSK, CR 3/4 */ - {19500, 40500, CEIL(19500 * 10, 9), CEIL(40500 * 10, 9), 0x0A, - BRCM_RATE_18M}, - /* MCS 3: SS 1, MOD: 16QAM, CR 1/2 */ - {26000, 54000, CEIL(26000 * 10, 9), CEIL(54000 * 10, 9), 0x10, - BRCM_RATE_24M}, - /* MCS 4: SS 1, MOD: 16QAM, CR 3/4 */ - {39000, 81000, CEIL(39000 * 10, 9), CEIL(81000 * 10, 9), 0x12, - BRCM_RATE_36M}, - /* MCS 5: SS 1, MOD: 64QAM, CR 2/3 */ - {52000, 108000, CEIL(52000 * 10, 9), CEIL(108000 * 10, 9), 0x19, - BRCM_RATE_48M}, - /* MCS 6: SS 1, MOD: 64QAM, CR 3/4 */ - {58500, 121500, CEIL(58500 * 10, 9), CEIL(121500 * 10, 9), 0x1A, - BRCM_RATE_54M}, - /* MCS 7: SS 1, MOD: 64QAM, CR 5/6 */ - {65000, 135000, CEIL(65000 * 10, 9), CEIL(135000 * 10, 9), 0x1C, - BRCM_RATE_54M}, - /* MCS 8: SS 2, MOD: BPSK, CR 1/2 */ - {13000, 27000, CEIL(13000 * 10, 9), CEIL(27000 * 10, 9), 0x40, - BRCM_RATE_6M}, - /* MCS 9: SS 2, MOD: QPSK, CR 1/2 */ - {26000, 54000, CEIL(26000 * 10, 9), CEIL(54000 * 10, 9), 0x48, - BRCM_RATE_12M}, - /* MCS 10: SS 2, MOD: QPSK, CR 3/4 */ - {39000, 81000, CEIL(39000 * 10, 9), CEIL(81000 * 10, 9), 0x4A, - BRCM_RATE_18M}, - /* MCS 11: SS 2, MOD: 16QAM, CR 1/2 */ - {52000, 108000, CEIL(52000 * 10, 9), CEIL(108000 * 10, 9), 0x50, - BRCM_RATE_24M}, - /* MCS 12: SS 2, MOD: 16QAM, CR 3/4 */ - {78000, 162000, CEIL(78000 * 10, 9), CEIL(162000 * 10, 9), 0x52, - BRCM_RATE_36M}, - /* MCS 13: SS 2, MOD: 64QAM, CR 2/3 */ - {104000, 216000, CEIL(104000 * 10, 9), CEIL(216000 * 10, 9), 0x59, - BRCM_RATE_48M}, - /* MCS 14: SS 2, MOD: 64QAM, CR 3/4 */ - {117000, 243000, CEIL(117000 * 10, 9), CEIL(243000 * 10, 9), 0x5A, - BRCM_RATE_54M}, - /* MCS 15: SS 2, MOD: 64QAM, CR 5/6 */ - {130000, 270000, CEIL(130000 * 10, 9), CEIL(270000 * 10, 9), 0x5C, - BRCM_RATE_54M}, - /* MCS 16: SS 3, MOD: BPSK, CR 1/2 */ - {19500, 40500, CEIL(19500 * 10, 9), CEIL(40500 * 10, 9), 0x80, - BRCM_RATE_6M}, - /* MCS 17: SS 3, MOD: QPSK, CR 1/2 */ - {39000, 81000, CEIL(39000 * 10, 9), CEIL(81000 * 10, 9), 0x88, - BRCM_RATE_12M}, - /* MCS 18: SS 3, MOD: QPSK, CR 3/4 */ - {58500, 121500, CEIL(58500 * 10, 9), CEIL(121500 * 10, 9), 0x8A, - BRCM_RATE_18M}, - /* MCS 19: SS 3, MOD: 16QAM, CR 1/2 */ - {78000, 162000, CEIL(78000 * 10, 9), CEIL(162000 * 10, 9), 0x90, - BRCM_RATE_24M}, - /* MCS 20: SS 3, MOD: 16QAM, CR 3/4 */ - {117000, 243000, CEIL(117000 * 10, 9), CEIL(243000 * 10, 9), 0x92, - BRCM_RATE_36M}, - /* MCS 21: SS 3, MOD: 64QAM, CR 2/3 */ - {156000, 324000, CEIL(156000 * 10, 9), CEIL(324000 * 10, 9), 0x99, - BRCM_RATE_48M}, - /* MCS 22: SS 3, MOD: 64QAM, CR 3/4 */ - {175500, 364500, CEIL(175500 * 10, 9), CEIL(364500 * 10, 9), 0x9A, - BRCM_RATE_54M}, - /* MCS 23: SS 3, MOD: 64QAM, CR 5/6 */ - {195000, 405000, CEIL(195000 * 10, 9), CEIL(405000 * 10, 9), 0x9B, - BRCM_RATE_54M}, - /* MCS 24: SS 4, MOD: BPSK, CR 1/2 */ - {26000, 54000, CEIL(26000 * 10, 9), CEIL(54000 * 10, 9), 0xC0, - BRCM_RATE_6M}, - /* MCS 25: SS 4, MOD: QPSK, CR 1/2 */ - {52000, 108000, CEIL(52000 * 10, 9), CEIL(108000 * 10, 9), 0xC8, - BRCM_RATE_12M}, - /* MCS 26: SS 4, MOD: QPSK, CR 3/4 */ - {78000, 162000, CEIL(78000 * 10, 9), CEIL(162000 * 10, 9), 0xCA, - BRCM_RATE_18M}, - /* MCS 27: SS 4, MOD: 16QAM, CR 1/2 */ - {104000, 216000, CEIL(104000 * 10, 9), CEIL(216000 * 10, 9), 0xD0, - BRCM_RATE_24M}, - /* MCS 28: SS 4, MOD: 16QAM, CR 3/4 */ - {156000, 324000, CEIL(156000 * 10, 9), CEIL(324000 * 10, 9), 0xD2, - BRCM_RATE_36M}, - /* MCS 29: SS 4, MOD: 64QAM, CR 2/3 */ - {208000, 432000, CEIL(208000 * 10, 9), CEIL(432000 * 10, 9), 0xD9, - BRCM_RATE_48M}, - /* MCS 30: SS 4, MOD: 64QAM, CR 3/4 */ - {234000, 486000, CEIL(234000 * 10, 9), CEIL(486000 * 10, 9), 0xDA, - BRCM_RATE_54M}, - /* MCS 31: SS 4, MOD: 64QAM, CR 5/6 */ - {260000, 540000, CEIL(260000 * 10, 9), CEIL(540000 * 10, 9), 0xDB, - BRCM_RATE_54M}, - /* MCS 32: SS 1, MOD: BPSK, CR 1/2 */ - {0, 6000, 0, CEIL(6000 * 10, 9), 0x00, BRCM_RATE_6M}, -}; - -/* - * phycfg for legacy OFDM frames: code rate, modulation scheme, spatial streams - * Number of spatial streams: always 1 other fields: refer to table 78 of - * section 17.3.2.2 of the original .11a standard - */ -struct legacy_phycfg { - u32 rate_ofdm; /* ofdm mac rate */ - /* phy ctl byte 3, code rate, modulation type, # of streams */ - u8 tx_phy_ctl3; -}; - -/* Number of legacy_rate_cfg entries in the table */ -#define LEGACY_PHYCFG_TABLE_SIZE 12 - -/* - * In CCK mode LPPHY overloads OFDM Modulation bits with CCK Data Rate - * Eventually MIMOPHY would also be converted to this format - * 0 = 1Mbps; 1 = 2Mbps; 2 = 5.5Mbps; 3 = 11Mbps - */ -static const struct -legacy_phycfg legacy_phycfg_table[LEGACY_PHYCFG_TABLE_SIZE] = { - {BRCM_RATE_1M, 0x00}, /* CCK 1Mbps, data rate 0 */ - {BRCM_RATE_2M, 0x08}, /* CCK 2Mbps, data rate 1 */ - {BRCM_RATE_5M5, 0x10}, /* CCK 5.5Mbps, data rate 2 */ - {BRCM_RATE_11M, 0x18}, /* CCK 11Mbps, data rate 3 */ - /* OFDM 6Mbps, code rate 1/2, BPSK, 1 spatial stream */ - {BRCM_RATE_6M, 0x00}, - /* OFDM 9Mbps, code rate 3/4, BPSK, 1 spatial stream */ - {BRCM_RATE_9M, 0x02}, - /* OFDM 12Mbps, code rate 1/2, QPSK, 1 spatial stream */ - {BRCM_RATE_12M, 0x08}, - /* OFDM 18Mbps, code rate 3/4, QPSK, 1 spatial stream */ - {BRCM_RATE_18M, 0x0A}, - /* OFDM 24Mbps, code rate 1/2, 16-QAM, 1 spatial stream */ - {BRCM_RATE_24M, 0x10}, - /* OFDM 36Mbps, code rate 3/4, 16-QAM, 1 spatial stream */ - {BRCM_RATE_36M, 0x12}, - /* OFDM 48Mbps, code rate 2/3, 64-QAM, 1 spatial stream */ - {BRCM_RATE_48M, 0x19}, - /* OFDM 54Mbps, code rate 3/4, 64-QAM, 1 spatial stream */ - {BRCM_RATE_54M, 0x1A}, -}; - -/* Hardware rates (also encodes default basic rates) */ - -const struct brcms_c_rateset cck_ofdm_mimo_rates = { - 12, - /* 1b, 2b, 5.5b, 6, 9, 11b, 12, 18, 24, 36, 48, */ - { 0x82, 0x84, 0x8b, 0x0c, 0x12, 0x96, 0x18, 0x24, 0x30, 0x48, 0x60, - /* 54 Mbps */ - 0x6c}, - 0x00, - { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00} -}; - -const struct brcms_c_rateset ofdm_mimo_rates = { - 8, - /* 6b, 9, 12b, 18, 24b, 36, 48, 54 Mbps */ - { 0x8c, 0x12, 0x98, 0x24, 0xb0, 0x48, 0x60, 0x6c}, - 0x00, - { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00} -}; - -/* Default ratesets that include MCS32 for 40BW channels */ -static const struct brcms_c_rateset cck_ofdm_40bw_mimo_rates = { - 12, - /* 1b, 2b, 5.5b, 6, 9, 11b, 12, 18, 24, 36, 48 */ - { 0x82, 0x84, 0x8b, 0x0c, 0x12, 0x96, 0x18, 0x24, 0x30, 0x48, 0x60, - /* 54 Mbps */ - 0x6c}, - 0x00, - { 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00} -}; - -static const struct brcms_c_rateset ofdm_40bw_mimo_rates = { - 8, - /* 6b, 9, 12b, 18, 24b, 36, 48, 54 Mbps */ - { 0x8c, 0x12, 0x98, 0x24, 0xb0, 0x48, 0x60, 0x6c}, - 0x00, - { 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00} -}; - -const struct brcms_c_rateset cck_ofdm_rates = { - 12, - /* 1b, 2b, 5.5b, 6, 9, 11b, 12, 18, 24, 36, 48,*/ - { 0x82, 0x84, 0x8b, 0x0c, 0x12, 0x96, 0x18, 0x24, 0x30, 0x48, 0x60, - /*54 Mbps */ - 0x6c}, - 0x00, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00} -}; - -const struct brcms_c_rateset gphy_legacy_rates = { - 4, - /* 1b, 2b, 5.5b, 11b Mbps */ - { 0x82, 0x84, 0x8b, 0x96}, - 0x00, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00} -}; - -const struct brcms_c_rateset ofdm_rates = { - 8, - /* 6b, 9, 12b, 18, 24b, 36, 48, 54 Mbps */ - { 0x8c, 0x12, 0x98, 0x24, 0xb0, 0x48, 0x60, 0x6c}, - 0x00, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00} -}; - -const struct brcms_c_rateset cck_rates = { - 4, - /* 1b, 2b, 5.5, 11 Mbps */ - { 0x82, 0x84, 0x0b, 0x16}, - 0x00, - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00} -}; - -/* check if rateset is valid. - * if check_brate is true, rateset without a basic rate is considered NOT valid. - */ -static bool brcms_c_rateset_valid(struct brcms_c_rateset *rs, bool check_brate) -{ - uint idx; - - if (!rs->count) - return false; - - if (!check_brate) - return true; - - /* error if no basic rates */ - for (idx = 0; idx < rs->count; idx++) { - if (rs->rates[idx] & BRCMS_RATE_FLAG) - return true; - } - return false; -} - -void brcms_c_rateset_mcs_upd(struct brcms_c_rateset *rs, u8 txstreams) -{ - int i; - for (i = txstreams; i < MAX_STREAMS_SUPPORTED; i++) - rs->mcs[i] = 0; -} - -/* - * filter based on hardware rateset, and sort filtered rateset with basic - * bit(s) preserved, and check if resulting rateset is valid. -*/ -bool -brcms_c_rate_hwrs_filter_sort_validate(struct brcms_c_rateset *rs, - const struct brcms_c_rateset *hw_rs, - bool check_brate, u8 txstreams) -{ - u8 rateset[BRCM_MAXRATE + 1]; - u8 r; - uint count; - uint i; - - memset(rateset, 0, sizeof(rateset)); - count = rs->count; - - for (i = 0; i < count; i++) { - /* mask off "basic rate" bit, BRCMS_RATE_FLAG */ - r = (int)rs->rates[i] & BRCMS_RATE_MASK; - if ((r > BRCM_MAXRATE) || (rate_info[r] == 0)) - continue; - rateset[r] = rs->rates[i]; /* preserve basic bit! */ - } - - /* fill out the rates in order, looking at only supported rates */ - count = 0; - for (i = 0; i < hw_rs->count; i++) { - r = hw_rs->rates[i] & BRCMS_RATE_MASK; - if (rateset[r]) - rs->rates[count++] = rateset[r]; - } - - rs->count = count; - - /* only set the mcs rate bit if the equivalent hw mcs bit is set */ - for (i = 0; i < MCSSET_LEN; i++) - rs->mcs[i] = (rs->mcs[i] & hw_rs->mcs[i]); - - if (brcms_c_rateset_valid(rs, check_brate)) - return true; - else - return false; -} - -/* calculate the rate of a rx'd frame and return it as a ratespec */ -u32 brcms_c_compute_rspec(struct d11rxhdr *rxh, u8 *plcp) -{ - int phy_type; - u32 rspec = PHY_TXC1_BW_20MHZ << RSPEC_BW_SHIFT; - - phy_type = - ((rxh->RxChan & RXS_CHAN_PHYTYPE_MASK) >> RXS_CHAN_PHYTYPE_SHIFT); - - if ((phy_type == PHY_TYPE_N) || (phy_type == PHY_TYPE_SSN) || - (phy_type == PHY_TYPE_LCN) || (phy_type == PHY_TYPE_HT)) { - switch (rxh->PhyRxStatus_0 & PRXS0_FT_MASK) { - case PRXS0_CCK: - rspec = - cck_phy2mac_rate( - ((struct cck_phy_hdr *) plcp)->signal); - break; - case PRXS0_OFDM: - rspec = - ofdm_phy2mac_rate( - ((struct ofdm_phy_hdr *) plcp)->rlpt[0]); - break; - case PRXS0_PREN: - rspec = (plcp[0] & MIMO_PLCP_MCS_MASK) | RSPEC_MIMORATE; - if (plcp[0] & MIMO_PLCP_40MHZ) { - /* indicate rspec is for 40 MHz mode */ - rspec &= ~RSPEC_BW_MASK; - rspec |= (PHY_TXC1_BW_40MHZ << RSPEC_BW_SHIFT); - } - break; - case PRXS0_STDN: - /* fallthru */ - default: - /* not supported, error condition */ - break; - } - if (plcp3_issgi(plcp[3])) - rspec |= RSPEC_SHORT_GI; - } else - if ((phy_type == PHY_TYPE_A) || (rxh->PhyRxStatus_0 & PRXS0_OFDM)) - rspec = ofdm_phy2mac_rate( - ((struct ofdm_phy_hdr *) plcp)->rlpt[0]); - else - rspec = cck_phy2mac_rate( - ((struct cck_phy_hdr *) plcp)->signal); - - return rspec; -} - -/* copy rateset src to dst as-is (no masking or sorting) */ -void brcms_c_rateset_copy(const struct brcms_c_rateset *src, - struct brcms_c_rateset *dst) -{ - memcpy(dst, src, sizeof(struct brcms_c_rateset)); -} - -/* - * Copy and selectively filter one rateset to another. - * 'basic_only' means only copy basic rates. - * 'rates' indicates cck (11b) and ofdm rates combinations. - * - 0: cck and ofdm - * - 1: cck only - * - 2: ofdm only - * 'xmask' is the copy mask (typically 0x7f or 0xff). - */ -void -brcms_c_rateset_filter(struct brcms_c_rateset *src, struct brcms_c_rateset *dst, - bool basic_only, u8 rates, uint xmask, bool mcsallow) -{ - uint i; - uint r; - uint count; - - count = 0; - for (i = 0; i < src->count; i++) { - r = src->rates[i]; - if (basic_only && !(r & BRCMS_RATE_FLAG)) - continue; - if (rates == BRCMS_RATES_CCK && - is_ofdm_rate((r & BRCMS_RATE_MASK))) - continue; - if (rates == BRCMS_RATES_OFDM && - is_cck_rate((r & BRCMS_RATE_MASK))) - continue; - dst->rates[count++] = r & xmask; - } - dst->count = count; - dst->htphy_membership = src->htphy_membership; - - if (mcsallow && rates != BRCMS_RATES_CCK) - memcpy(&dst->mcs[0], &src->mcs[0], MCSSET_LEN); - else - brcms_c_rateset_mcs_clear(dst); -} - -/* select rateset for a given phy_type and bandtype and filter it, sort it - * and fill rs_tgt with result - */ -void -brcms_c_rateset_default(struct brcms_c_rateset *rs_tgt, - const struct brcms_c_rateset *rs_hw, - uint phy_type, int bandtype, bool cck_only, - uint rate_mask, bool mcsallow, u8 bw, u8 txstreams) -{ - const struct brcms_c_rateset *rs_dflt; - struct brcms_c_rateset rs_sel; - if ((PHYTYPE_IS(phy_type, PHY_TYPE_HT)) || - (PHYTYPE_IS(phy_type, PHY_TYPE_N)) || - (PHYTYPE_IS(phy_type, PHY_TYPE_LCN)) || - (PHYTYPE_IS(phy_type, PHY_TYPE_SSN))) { - if (bandtype == BRCM_BAND_5G) - rs_dflt = (bw == BRCMS_20_MHZ ? - &ofdm_mimo_rates : &ofdm_40bw_mimo_rates); - else - rs_dflt = (bw == BRCMS_20_MHZ ? - &cck_ofdm_mimo_rates : - &cck_ofdm_40bw_mimo_rates); - } else if (PHYTYPE_IS(phy_type, PHY_TYPE_LP)) { - rs_dflt = (bandtype == BRCM_BAND_5G) ? - &ofdm_rates : &cck_ofdm_rates; - } else if (PHYTYPE_IS(phy_type, PHY_TYPE_A)) { - rs_dflt = &ofdm_rates; - } else if (PHYTYPE_IS(phy_type, PHY_TYPE_G)) { - rs_dflt = &cck_ofdm_rates; - } else { - /* should not happen, error condition */ - rs_dflt = &cck_rates; /* force cck */ - } - - /* if hw rateset is not supplied, assign selected rateset to it */ - if (!rs_hw) - rs_hw = rs_dflt; - - brcms_c_rateset_copy(rs_dflt, &rs_sel); - brcms_c_rateset_mcs_upd(&rs_sel, txstreams); - brcms_c_rateset_filter(&rs_sel, rs_tgt, false, - cck_only ? BRCMS_RATES_CCK : BRCMS_RATES_CCK_OFDM, - rate_mask, mcsallow); - brcms_c_rate_hwrs_filter_sort_validate(rs_tgt, rs_hw, false, - mcsallow ? txstreams : 1); -} - -s16 brcms_c_rate_legacy_phyctl(uint rate) -{ - uint i; - for (i = 0; i < LEGACY_PHYCFG_TABLE_SIZE; i++) - if (rate == legacy_phycfg_table[i].rate_ofdm) - return legacy_phycfg_table[i].tx_phy_ctl3; - - return -1; -} - -void brcms_c_rateset_mcs_clear(struct brcms_c_rateset *rateset) -{ - uint i; - for (i = 0; i < MCSSET_LEN; i++) - rateset->mcs[i] = 0; -} - -void brcms_c_rateset_mcs_build(struct brcms_c_rateset *rateset, u8 txstreams) -{ - memcpy(&rateset->mcs[0], &cck_ofdm_mimo_rates.mcs[0], MCSSET_LEN); - brcms_c_rateset_mcs_upd(rateset, txstreams); -} - -/* Based on bandwidth passed, allow/disallow MCS 32 in the rateset */ -void brcms_c_rateset_bw_mcs_filter(struct brcms_c_rateset *rateset, u8 bw) -{ - if (bw == BRCMS_40_MHZ) - setbit(rateset->mcs, 32); - else - clrbit(rateset->mcs, 32); -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/rate.h b/drivers/net/wireless/brcm80211/brcmsmac/rate.h deleted file mode 100644 index 980d578825cc..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/rate.h +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_RATE_H_ -#define _BRCM_RATE_H_ - -#include "types.h" -#include "d11.h" -#include "phy_hal.h" - -extern const u8 rate_info[]; -extern const struct brcms_c_rateset cck_ofdm_mimo_rates; -extern const struct brcms_c_rateset ofdm_mimo_rates; -extern const struct brcms_c_rateset cck_ofdm_rates; -extern const struct brcms_c_rateset ofdm_rates; -extern const struct brcms_c_rateset cck_rates; -extern const struct brcms_c_rateset gphy_legacy_rates; -extern const struct brcms_c_rateset rate_limit_1_2; - -struct brcms_mcs_info { - /* phy rate in kbps [20Mhz] */ - u32 phy_rate_20; - /* phy rate in kbps [40Mhz] */ - u32 phy_rate_40; - /* phy rate in kbps [20Mhz] with SGI */ - u32 phy_rate_20_sgi; - /* phy rate in kbps [40Mhz] with SGI */ - u32 phy_rate_40_sgi; - /* phy ctl byte 3, code rate, modulation type, # of streams */ - u8 tx_phy_ctl3; - /* matching legacy ofdm rate in 500bkps */ - u8 leg_ofdm; -}; - -#define BRCMS_MAXMCS 32 /* max valid mcs index */ -#define MCS_TABLE_SIZE 33 /* Number of mcs entries in the table */ -extern const struct brcms_mcs_info mcs_table[]; - -#define MCS_TXS_MASK 0xc0 /* num tx streams - 1 bit mask */ -#define MCS_TXS_SHIFT 6 /* num tx streams - 1 bit shift */ - -/* returns num tx streams - 1 */ -static inline u8 mcs_2_txstreams(u8 mcs) -{ - return (mcs_table[mcs].tx_phy_ctl3 & MCS_TXS_MASK) >> MCS_TXS_SHIFT; -} - -static inline uint mcs_2_rate(u8 mcs, bool is40, bool sgi) -{ - if (sgi) { - if (is40) - return mcs_table[mcs].phy_rate_40_sgi; - return mcs_table[mcs].phy_rate_20_sgi; - } - if (is40) - return mcs_table[mcs].phy_rate_40; - - return mcs_table[mcs].phy_rate_20; -} - -/* Macro to use the rate_info table */ -#define BRCMS_RATE_MASK_FULL 0xff /* Rate value mask with basic rate flag */ - -/* - * rate spec : holds rate and mode specific information required to generate a - * tx frame. Legacy CCK and OFDM information is held in the same manner as was - * done in the past (in the lower byte) the upper 3 bytes primarily hold MIMO - * specific information - */ - -/* rate spec bit fields */ - -/* Either 500Kbps units or MIMO MCS idx */ -#define RSPEC_RATE_MASK 0x0000007F -/* mimo MCS is stored in RSPEC_RATE_MASK */ -#define RSPEC_MIMORATE 0x08000000 -/* mimo bw mask */ -#define RSPEC_BW_MASK 0x00000700 -/* mimo bw shift */ -#define RSPEC_BW_SHIFT 8 -/* mimo Space/Time/Frequency mode mask */ -#define RSPEC_STF_MASK 0x00003800 -/* mimo Space/Time/Frequency mode shift */ -#define RSPEC_STF_SHIFT 11 -/* mimo coding type mask */ -#define RSPEC_CT_MASK 0x0000C000 -/* mimo coding type shift */ -#define RSPEC_CT_SHIFT 14 -/* mimo num STC streams per PLCP defn. */ -#define RSPEC_STC_MASK 0x00300000 -/* mimo num STC streams per PLCP defn. */ -#define RSPEC_STC_SHIFT 20 -/* mimo bit indicates adv coding in use */ -#define RSPEC_LDPC_CODING 0x00400000 -/* mimo bit indicates short GI in use */ -#define RSPEC_SHORT_GI 0x00800000 -/* bit indicates override both rate & mode */ -#define RSPEC_OVERRIDE 0x80000000 -/* bit indicates override rate only */ -#define RSPEC_OVERRIDE_MCS_ONLY 0x40000000 - -static inline bool rspec_active(u32 rspec) -{ - return rspec & (RSPEC_RATE_MASK | RSPEC_MIMORATE); -} - -static inline u8 rspec_phytxbyte2(u32 rspec) -{ - return (rspec & 0xff00) >> 8; -} - -static inline u32 rspec_get_bw(u32 rspec) -{ - return (rspec & RSPEC_BW_MASK) >> RSPEC_BW_SHIFT; -} - -static inline bool rspec_issgi(u32 rspec) -{ - return (rspec & RSPEC_SHORT_GI) == RSPEC_SHORT_GI; -} - -static inline bool rspec_is40mhz(u32 rspec) -{ - u32 bw = rspec_get_bw(rspec); - - return bw == PHY_TXC1_BW_40MHZ || bw == PHY_TXC1_BW_40MHZ_DUP; -} - -static inline uint rspec2rate(u32 rspec) -{ - if (rspec & RSPEC_MIMORATE) - return mcs_2_rate(rspec & RSPEC_RATE_MASK, rspec_is40mhz(rspec), - rspec_issgi(rspec)); - return rspec & RSPEC_RATE_MASK; -} - -static inline u8 rspec_mimoplcp3(u32 rspec) -{ - return (rspec & 0xf00000) >> 16; -} - -static inline bool plcp3_issgi(u8 plcp) -{ - return (plcp & (RSPEC_SHORT_GI >> 16)) != 0; -} - -static inline uint rspec_stc(u32 rspec) -{ - return (rspec & RSPEC_STC_MASK) >> RSPEC_STC_SHIFT; -} - -static inline uint rspec_stf(u32 rspec) -{ - return (rspec & RSPEC_STF_MASK) >> RSPEC_STF_SHIFT; -} - -static inline bool is_mcs_rate(u32 ratespec) -{ - return (ratespec & RSPEC_MIMORATE) != 0; -} - -static inline bool is_ofdm_rate(u32 ratespec) -{ - return !is_mcs_rate(ratespec) && - (rate_info[ratespec & RSPEC_RATE_MASK] & BRCMS_RATE_FLAG); -} - -static inline bool is_cck_rate(u32 ratespec) -{ - u32 rate = (ratespec & BRCMS_RATE_MASK); - - return !is_mcs_rate(ratespec) && ( - rate == BRCM_RATE_1M || rate == BRCM_RATE_2M || - rate == BRCM_RATE_5M5 || rate == BRCM_RATE_11M); -} - -static inline bool is_single_stream(u8 mcs) -{ - return mcs <= HIGHEST_SINGLE_STREAM_MCS || mcs == 32; -} - -static inline u8 cck_rspec(u8 cck) -{ - return cck & RSPEC_RATE_MASK; -} - -/* Convert encoded rate value in plcp header to numerical rates in 500 KHz - * increments */ -static inline u8 ofdm_phy2mac_rate(u8 rlpt) -{ - return wlc_phy_get_ofdm_rate_lookup()[rlpt & 0x7]; -} - -static inline u8 cck_phy2mac_rate(u8 signal) -{ - return signal/5; -} - -/* Rates specified in brcms_c_rateset_filter() */ -#define BRCMS_RATES_CCK_OFDM 0 -#define BRCMS_RATES_CCK 1 -#define BRCMS_RATES_OFDM 2 - -/* sanitize, and sort a rateset with the basic bit(s) preserved, validate - * rateset */ -extern bool -brcms_c_rate_hwrs_filter_sort_validate(struct brcms_c_rateset *rs, - const struct brcms_c_rateset *hw_rs, - bool check_brate, u8 txstreams); -/* copy rateset src to dst as-is (no masking or sorting) */ -extern void brcms_c_rateset_copy(const struct brcms_c_rateset *src, - struct brcms_c_rateset *dst); - -/* would be nice to have these documented ... */ -extern u32 brcms_c_compute_rspec(struct d11rxhdr *rxh, u8 *plcp); - -extern void brcms_c_rateset_filter(struct brcms_c_rateset *src, - struct brcms_c_rateset *dst, bool basic_only, u8 rates, uint xmask, - bool mcsallow); - -extern void -brcms_c_rateset_default(struct brcms_c_rateset *rs_tgt, - const struct brcms_c_rateset *rs_hw, uint phy_type, - int bandtype, bool cck_only, uint rate_mask, - bool mcsallow, u8 bw, u8 txstreams); - -extern s16 brcms_c_rate_legacy_phyctl(uint rate); - -extern void brcms_c_rateset_mcs_upd(struct brcms_c_rateset *rs, u8 txstreams); -extern void brcms_c_rateset_mcs_clear(struct brcms_c_rateset *rateset); -extern void brcms_c_rateset_mcs_build(struct brcms_c_rateset *rateset, - u8 txstreams); -extern void brcms_c_rateset_bw_mcs_filter(struct brcms_c_rateset *rateset, - u8 bw); - -#endif /* _BRCM_RATE_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/scb.h b/drivers/net/wireless/brcm80211/brcmsmac/scb.h deleted file mode 100644 index 3a3d73699f83..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/scb.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_SCB_H_ -#define _BRCM_SCB_H_ - -#include -#include -#include -#include "types.h" - -#define AMPDU_TX_BA_MAX_WSIZE 64 /* max Tx ba window size (in pdu) */ - -#define AMPDU_MAX_SCB_TID NUMPRIO - -/* scb flags */ -#define SCB_WMECAP 0x0040 -#define SCB_HTCAP 0x10000 /* HT (MIMO) capable device */ -#define SCB_IS40 0x80000 /* 40MHz capable */ -#define SCB_STBCCAP 0x40000000 /* STBC Capable */ - -#define SCB_MAGIC 0xbeefcafe - -/* structure to store per-tid state for the ampdu initiator */ -struct scb_ampdu_tid_ini { - u8 tid; /* initiator tid for easy lookup */ - /* tx retry count; indexed by seq modulo */ - u8 txretry[AMPDU_TX_BA_MAX_WSIZE]; - struct scb *scb; /* backptr for easy lookup */ - u8 ba_wsize; /* negotiated ba window size (in pdu) */ -}; - -struct scb_ampdu { - struct scb *scb; /* back pointer for easy reference */ - u8 mpdu_density; /* mpdu density */ - u8 max_pdu; /* max pdus allowed in ampdu */ - u8 release; /* # of mpdus released at a time */ - u16 min_len; /* min mpdu len to support the density */ - u32 max_rx_ampdu_bytes; /* max ampdu rcv length; 8k, 16k, 32k, 64k */ - - /* - * This could easily be a ini[] pointer and we keep this info in wl - * itself instead of having mac80211 hold it for us. Also could be made - * dynamic per tid instead of static. - */ - /* initiator info - per tid (NUMPRIO): */ - struct scb_ampdu_tid_ini ini[AMPDU_MAX_SCB_TID]; -}; - -/* station control block - one per remote MAC address */ -struct scb { - u32 magic; - u32 flags; /* various bit flags as defined below */ - u32 flags2; /* various bit flags2 as defined below */ - u8 state; /* current state bitfield of auth/assoc process */ - u8 ea[ETH_ALEN]; /* station address */ - uint fragresid[NUMPRIO];/* #bytes unused in frag buffer per prio */ - - u16 seqctl[NUMPRIO]; /* seqctl of last received frame (for dups) */ - /* seqctl of last received frame (for dups) for non-QoS data and - * management */ - u16 seqctl_nonqos; - u16 seqnum[NUMPRIO];/* WME: driver maintained sw seqnum per priority */ - - struct scb_ampdu scb_ampdu; /* AMPDU state including per tid info */ -}; - -#endif /* _BRCM_SCB_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/stf.c b/drivers/net/wireless/brcm80211/brcmsmac/stf.c deleted file mode 100644 index dd9162722495..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/stf.c +++ /dev/null @@ -1,440 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#include "types.h" -#include "d11.h" -#include "rate.h" -#include "phy/phy_hal.h" -#include "channel.h" -#include "main.h" -#include "stf.h" -#include "debug.h" - -#define MIN_SPATIAL_EXPANSION 0 -#define MAX_SPATIAL_EXPANSION 1 - -#define BRCMS_STF_SS_STBC_RX(wlc) (BRCMS_ISNPHY(wlc->band) && \ - NREV_GT(wlc->band->phyrev, 3) && NREV_LE(wlc->band->phyrev, 6)) - -#define NSTS_1 1 -#define NSTS_2 2 -#define NSTS_3 3 -#define NSTS_4 4 - -static const u8 txcore_default[5] = { - (0), /* bitmap of the core enabled */ - (0x01), /* For Nsts = 1, enable core 1 */ - (0x03), /* For Nsts = 2, enable core 1 & 2 */ - (0x07), /* For Nsts = 3, enable core 1, 2 & 3 */ - (0x0f) /* For Nsts = 4, enable all cores */ -}; - -static void brcms_c_stf_stbc_rx_ht_update(struct brcms_c_info *wlc, int val) -{ - /* MIMOPHYs rev3-6 cannot receive STBC with only one rx core active */ - if (BRCMS_STF_SS_STBC_RX(wlc)) { - if ((wlc->stf->rxstreams == 1) && (val != HT_CAP_RX_STBC_NO)) - return; - } - - if (wlc->pub->up) { - brcms_c_update_beacon(wlc); - brcms_c_update_probe_resp(wlc, true); - } -} - -/* - * every WLC_TEMPSENSE_PERIOD seconds temperature check to decide whether to - * turn on/off txchain. - */ -void brcms_c_tempsense_upd(struct brcms_c_info *wlc) -{ - struct brcms_phy_pub *pi = wlc->band->pi; - uint active_chains, txchain; - - /* Check if the chip is too hot. Disable one Tx chain, if it is */ - /* high 4 bits are for Rx chain, low 4 bits are for Tx chain */ - active_chains = wlc_phy_stf_chain_active_get(pi); - txchain = active_chains & 0xf; - - if (wlc->stf->txchain == wlc->stf->hw_txchain) { - if (txchain && (txchain < wlc->stf->hw_txchain)) - /* turn off 1 tx chain */ - brcms_c_stf_txchain_set(wlc, txchain, true); - } else if (wlc->stf->txchain < wlc->stf->hw_txchain) { - if (txchain == wlc->stf->hw_txchain) - /* turn back on txchain */ - brcms_c_stf_txchain_set(wlc, txchain, true); - } -} - -void -brcms_c_stf_ss_algo_channel_get(struct brcms_c_info *wlc, u16 *ss_algo_channel, - u16 chanspec) -{ - struct tx_power power; - u8 siso_mcs_id, cdd_mcs_id, stbc_mcs_id; - - /* Clear previous settings */ - *ss_algo_channel = 0; - - if (!wlc->pub->up) { - *ss_algo_channel = (u16) -1; - return; - } - - wlc_phy_txpower_get_current(wlc->band->pi, &power, - CHSPEC_CHANNEL(chanspec)); - - siso_mcs_id = (CHSPEC_IS40(chanspec)) ? - WL_TX_POWER_MCS40_SISO_FIRST : WL_TX_POWER_MCS20_SISO_FIRST; - cdd_mcs_id = (CHSPEC_IS40(chanspec)) ? - WL_TX_POWER_MCS40_CDD_FIRST : WL_TX_POWER_MCS20_CDD_FIRST; - stbc_mcs_id = (CHSPEC_IS40(chanspec)) ? - WL_TX_POWER_MCS40_STBC_FIRST : WL_TX_POWER_MCS20_STBC_FIRST; - - /* criteria to choose stf mode */ - - /* - * the "+3dbm (12 0.25db units)" is to account for the fact that with - * CDD, tx occurs on both chains - */ - if (power.target[siso_mcs_id] > (power.target[cdd_mcs_id] + 12)) - setbit(ss_algo_channel, PHY_TXC1_MODE_SISO); - else - setbit(ss_algo_channel, PHY_TXC1_MODE_CDD); - - /* - * STBC is ORed into to algo channel as STBC requires per-packet SCB - * capability check so cannot be default mode of operation. One of - * SISO, CDD have to be set - */ - if (power.target[siso_mcs_id] <= (power.target[stbc_mcs_id] + 12)) - setbit(ss_algo_channel, PHY_TXC1_MODE_STBC); -} - -static bool brcms_c_stf_stbc_tx_set(struct brcms_c_info *wlc, s32 int_val) -{ - if ((int_val != AUTO) && (int_val != OFF) && (int_val != ON)) - return false; - - if ((int_val == ON) && (wlc->stf->txstreams == 1)) - return false; - - wlc->bandstate[BAND_2G_INDEX]->band_stf_stbc_tx = (s8) int_val; - wlc->bandstate[BAND_5G_INDEX]->band_stf_stbc_tx = (s8) int_val; - - return true; -} - -bool brcms_c_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val) -{ - if ((int_val != HT_CAP_RX_STBC_NO) - && (int_val != HT_CAP_RX_STBC_ONE_STREAM)) - return false; - - if (BRCMS_STF_SS_STBC_RX(wlc)) { - if ((int_val != HT_CAP_RX_STBC_NO) - && (wlc->stf->rxstreams == 1)) - return false; - } - - brcms_c_stf_stbc_rx_ht_update(wlc, int_val); - return true; -} - -static int brcms_c_stf_txcore_set(struct brcms_c_info *wlc, u8 Nsts, - u8 core_mask) -{ - brcms_dbg_ht(wlc->hw->d11core, "wl%d: Nsts %d core_mask %x\n", - wlc->pub->unit, Nsts, core_mask); - - if (hweight8(core_mask) > wlc->stf->txstreams) - core_mask = 0; - - if ((hweight8(core_mask) == wlc->stf->txstreams) && - ((core_mask & ~wlc->stf->txchain) - || !(core_mask & wlc->stf->txchain))) - core_mask = wlc->stf->txchain; - - wlc->stf->txcore[Nsts] = core_mask; - /* Nsts = 1..4, txcore index = 1..4 */ - if (Nsts == 1) { - /* Needs to update beacon and ucode generated response - * frames when 1 stream core map changed - */ - wlc->stf->phytxant = core_mask << PHY_TXC_ANT_SHIFT; - brcms_b_txant_set(wlc->hw, wlc->stf->phytxant); - if (wlc->clk) { - brcms_c_suspend_mac_and_wait(wlc); - brcms_c_beacon_phytxctl_txant_upd(wlc, wlc->bcn_rspec); - brcms_c_enable_mac(wlc); - } - } - - return 0; -} - -static int brcms_c_stf_spatial_policy_set(struct brcms_c_info *wlc, int val) -{ - int i; - u8 core_mask = 0; - - brcms_dbg_ht(wlc->hw->d11core, "wl%d: val %x\n", wlc->pub->unit, - val); - - wlc->stf->spatial_policy = (s8) val; - for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++) { - core_mask = (val == MAX_SPATIAL_EXPANSION) ? - wlc->stf->txchain : txcore_default[i]; - brcms_c_stf_txcore_set(wlc, (u8) i, core_mask); - } - return 0; -} - -/* - * Centralized txant update function. call it whenever wlc->stf->txant and/or - * wlc->stf->txchain change. - * - * Antennas are controlled by ucode indirectly, which drives PHY or GPIO to - * achieve various tx/rx antenna selection schemes - * - * legacy phy, bit 6 and bit 7 means antenna 0 and 1 respectively, bit6+bit7 - * means auto(last rx). - * for NREV<3, bit 6 and bit 7 means antenna 0 and 1 respectively, bit6+bit7 - * means last rx and do tx-antenna selection for SISO transmissions - * for NREV=3, bit 6 and bit _8_ means antenna 0 and 1 respectively, bit6+bit7 - * means last rx and do tx-antenna selection for SISO transmissions - * for NREV>=7, bit 6 and bit 7 mean antenna 0 and 1 respectively, nit6+bit7 - * means both cores active -*/ -static void _brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc) -{ - s8 txant; - - txant = (s8) wlc->stf->txant; - if (BRCMS_PHY_11N_CAP(wlc->band)) { - if (txant == ANT_TX_FORCE_0) { - wlc->stf->phytxant = PHY_TXC_ANT_0; - } else if (txant == ANT_TX_FORCE_1) { - wlc->stf->phytxant = PHY_TXC_ANT_1; - - if (BRCMS_ISNPHY(wlc->band) && - NREV_GE(wlc->band->phyrev, 3) - && NREV_LT(wlc->band->phyrev, 7)) - wlc->stf->phytxant = PHY_TXC_ANT_2; - } else { - if (BRCMS_ISLCNPHY(wlc->band) || - BRCMS_ISSSLPNPHY(wlc->band)) - wlc->stf->phytxant = PHY_TXC_LCNPHY_ANT_LAST; - else { - /* catch out of sync wlc->stf->txcore */ - WARN_ON(wlc->stf->txchain <= 0); - wlc->stf->phytxant = - wlc->stf->txchain << PHY_TXC_ANT_SHIFT; - } - } - } else { - if (txant == ANT_TX_FORCE_0) - wlc->stf->phytxant = PHY_TXC_OLD_ANT_0; - else if (txant == ANT_TX_FORCE_1) - wlc->stf->phytxant = PHY_TXC_OLD_ANT_1; - else - wlc->stf->phytxant = PHY_TXC_OLD_ANT_LAST; - } - - brcms_b_txant_set(wlc->hw, wlc->stf->phytxant); -} - -int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force) -{ - u8 txchain = (u8) int_val; - u8 txstreams; - uint i; - - if (wlc->stf->txchain == txchain) - return 0; - - if ((txchain & ~wlc->stf->hw_txchain) - || !(txchain & wlc->stf->hw_txchain)) - return -EINVAL; - - /* - * if nrate override is configured to be non-SISO STF mode, reject - * reducing txchain to 1 - */ - txstreams = (u8) hweight8(txchain); - if (txstreams > MAX_STREAMS_SUPPORTED) - return -EINVAL; - - wlc->stf->txchain = txchain; - wlc->stf->txstreams = txstreams; - brcms_c_stf_stbc_tx_set(wlc, wlc->band->band_stf_stbc_tx); - brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); - brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); - wlc->stf->txant = - (wlc->stf->txstreams == 1) ? ANT_TX_FORCE_0 : ANT_TX_DEF; - _brcms_c_stf_phy_txant_upd(wlc); - - wlc_phy_stf_chain_set(wlc->band->pi, wlc->stf->txchain, - wlc->stf->rxchain); - - for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++) - brcms_c_stf_txcore_set(wlc, (u8) i, txcore_default[i]); - - return 0; -} - -/* - * update wlc->stf->ss_opmode which represents the operational stf_ss mode - * we're using - */ -int brcms_c_stf_ss_update(struct brcms_c_info *wlc, struct brcms_band *band) -{ - int ret_code = 0; - u8 prev_stf_ss; - u8 upd_stf_ss; - - prev_stf_ss = wlc->stf->ss_opmode; - - /* - * NOTE: opmode can only be SISO or CDD as STBC is decided on a - * per-packet basis - */ - if (BRCMS_STBC_CAP_PHY(wlc) && - wlc->stf->ss_algosel_auto - && (wlc->stf->ss_algo_channel != (u16) -1)) { - upd_stf_ss = (wlc->stf->txstreams == 1 || - isset(&wlc->stf->ss_algo_channel, - PHY_TXC1_MODE_SISO)) ? - PHY_TXC1_MODE_SISO : PHY_TXC1_MODE_CDD; - } else { - if (wlc->band != band) - return ret_code; - upd_stf_ss = (wlc->stf->txstreams == 1) ? - PHY_TXC1_MODE_SISO : band->band_stf_ss_mode; - } - if (prev_stf_ss != upd_stf_ss) { - wlc->stf->ss_opmode = upd_stf_ss; - brcms_b_band_stf_ss_set(wlc->hw, upd_stf_ss); - } - - return ret_code; -} - -int brcms_c_stf_attach(struct brcms_c_info *wlc) -{ - wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_SISO; - wlc->bandstate[BAND_5G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_CDD; - - if (BRCMS_ISNPHY(wlc->band) && - (wlc_phy_txpower_hw_ctrl_get(wlc->band->pi) != PHY_TPC_HW_ON)) - wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = - PHY_TXC1_MODE_CDD; - brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); - brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); - - brcms_c_stf_stbc_rx_ht_update(wlc, HT_CAP_RX_STBC_NO); - wlc->bandstate[BAND_2G_INDEX]->band_stf_stbc_tx = OFF; - wlc->bandstate[BAND_5G_INDEX]->band_stf_stbc_tx = OFF; - - if (BRCMS_STBC_CAP_PHY(wlc)) { - wlc->stf->ss_algosel_auto = true; - /* Init the default value */ - wlc->stf->ss_algo_channel = (u16) -1; - } - return 0; -} - -void brcms_c_stf_detach(struct brcms_c_info *wlc) -{ -} - -void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc) -{ - _brcms_c_stf_phy_txant_upd(wlc); -} - -void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc) -{ - struct ssb_sprom *sprom = &wlc->hw->d11core->bus->sprom; - - /* get available rx/tx chains */ - wlc->stf->hw_txchain = sprom->txchain; - wlc->stf->hw_rxchain = sprom->rxchain; - - /* these parameter are intended to be used for all PHY types */ - if (wlc->stf->hw_txchain == 0 || wlc->stf->hw_txchain == 0xf) { - if (BRCMS_ISNPHY(wlc->band)) - wlc->stf->hw_txchain = TXCHAIN_DEF_NPHY; - else - wlc->stf->hw_txchain = TXCHAIN_DEF; - } - - wlc->stf->txchain = wlc->stf->hw_txchain; - wlc->stf->txstreams = (u8) hweight8(wlc->stf->hw_txchain); - - if (wlc->stf->hw_rxchain == 0 || wlc->stf->hw_rxchain == 0xf) { - if (BRCMS_ISNPHY(wlc->band)) - wlc->stf->hw_rxchain = RXCHAIN_DEF_NPHY; - else - wlc->stf->hw_rxchain = RXCHAIN_DEF; - } - - wlc->stf->rxchain = wlc->stf->hw_rxchain; - wlc->stf->rxstreams = (u8) hweight8(wlc->stf->hw_rxchain); - - /* initialize the txcore table */ - memcpy(wlc->stf->txcore, txcore_default, sizeof(wlc->stf->txcore)); - - /* default spatial_policy */ - wlc->stf->spatial_policy = MIN_SPATIAL_EXPANSION; - brcms_c_stf_spatial_policy_set(wlc, MIN_SPATIAL_EXPANSION); -} - -static u16 _brcms_c_stf_phytxchain_sel(struct brcms_c_info *wlc, - u32 rspec) -{ - u16 phytxant = wlc->stf->phytxant; - - if (rspec_stf(rspec) != PHY_TXC1_MODE_SISO) - phytxant = wlc->stf->txchain << PHY_TXC_ANT_SHIFT; - else if (wlc->stf->txant == ANT_TX_DEF) - phytxant = wlc->stf->txchain << PHY_TXC_ANT_SHIFT; - phytxant &= PHY_TXC_ANT_MASK; - return phytxant; -} - -u16 brcms_c_stf_phytxchain_sel(struct brcms_c_info *wlc, u32 rspec) -{ - return _brcms_c_stf_phytxchain_sel(wlc, rspec); -} - -u16 brcms_c_stf_d11hdrs_phyctl_txant(struct brcms_c_info *wlc, u32 rspec) -{ - u16 phytxant = wlc->stf->phytxant; - u16 mask = PHY_TXC_ANT_MASK; - - /* for non-siso rates or default setting, use the available chains */ - if (BRCMS_ISNPHY(wlc->band)) { - phytxant = _brcms_c_stf_phytxchain_sel(wlc, rspec); - mask = PHY_TXC_HTANT_MASK; - } - phytxant |= phytxant & mask; - return phytxant; -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/stf.h b/drivers/net/wireless/brcm80211/brcmsmac/stf.h deleted file mode 100644 index 19f6580f69be..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/stf.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_STF_H_ -#define _BRCM_STF_H_ - -#include "types.h" - -extern int brcms_c_stf_attach(struct brcms_c_info *wlc); -extern void brcms_c_stf_detach(struct brcms_c_info *wlc); - -extern void brcms_c_tempsense_upd(struct brcms_c_info *wlc); -extern void brcms_c_stf_ss_algo_channel_get(struct brcms_c_info *wlc, - u16 *ss_algo_channel, - u16 chanspec); -extern int brcms_c_stf_ss_update(struct brcms_c_info *wlc, - struct brcms_band *band); -extern void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc); -extern int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, - bool force); -extern bool brcms_c_stf_stbc_rx_set(struct brcms_c_info *wlc, s32 int_val); -extern void brcms_c_stf_phy_txant_upd(struct brcms_c_info *wlc); -extern void brcms_c_stf_phy_chain_calc(struct brcms_c_info *wlc); -extern u16 brcms_c_stf_phytxchain_sel(struct brcms_c_info *wlc, - u32 rspec); -extern u16 brcms_c_stf_d11hdrs_phyctl_txant(struct brcms_c_info *wlc, - u32 rspec); - -#endif /* _BRCM_STF_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/types.h b/drivers/net/wireless/brcm80211/brcmsmac/types.h deleted file mode 100644 index ae1f3ad40d45..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/types.h +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_TYPES_H_ -#define _BRCM_TYPES_H_ - -#include -#include - -#define WL_CHAN_FREQ_RANGE_2G 0 -#define WL_CHAN_FREQ_RANGE_5GL 1 -#define WL_CHAN_FREQ_RANGE_5GM 2 -#define WL_CHAN_FREQ_RANGE_5GH 3 - -/* boardflags */ - -/* Board has gpio 9 controlling the PA */ -#define BFL_PACTRL 0x00000002 -/* Not ok to power down the chip pll and oscillator */ -#define BFL_NOPLLDOWN 0x00000020 -/* Board supports the Front End Module */ -#define BFL_FEM 0x00000800 -/* Board has an external LNA in 2.4GHz band */ -#define BFL_EXTLNA 0x00001000 -/* Board has no PA */ -#define BFL_NOPA 0x00010000 -/* Power topology uses BUCKBOOST */ -#define BFL_BUCKBOOST 0x00200000 -/* Board has FEM and switch to share antenna w/ BT */ -#define BFL_FEM_BT 0x00400000 -/* Power topology doesn't use CBUCK */ -#define BFL_NOCBUCK 0x00800000 -/* Power topology uses PALDO */ -#define BFL_PALDO 0x02000000 -/* Board has an external LNA in 5GHz band */ -#define BFL_EXTLNA_5GHz 0x10000000 - -/* boardflags2 */ - -/* Board has an external rxbb regulator */ -#define BFL2_RXBB_INT_REG_DIS 0x00000001 -/* Flag to implement alternative A-band PLL settings */ -#define BFL2_APLL_WAR 0x00000002 -/* Board permits enabling TX Power Control */ -#define BFL2_TXPWRCTRL_EN 0x00000004 -/* Board supports the 2X4 diversity switch */ -#define BFL2_2X4_DIV 0x00000008 -/* Board supports 5G band power gain */ -#define BFL2_5G_PWRGAIN 0x00000010 -/* Board overrides ASPM and Clkreq settings */ -#define BFL2_PCIEWAR_OVR 0x00000020 -#define BFL2_LEGACY 0x00000080 -/* 4321mcm93 board uses Skyworks FEM */ -#define BFL2_SKWRKFEM_BRD 0x00000100 -/* Board has a WAR for clock-harmonic spurs */ -#define BFL2_SPUR_WAR 0x00000200 -/* Flag to narrow G-band PLL loop b/w */ -#define BFL2_GPLL_WAR 0x00000400 -/* Tx CCK pkts on Ant 0 only */ -#define BFL2_SINGLEANT_CCK 0x00001000 -/* WAR to reduce and avoid clock-harmonic spurs in 2G */ -#define BFL2_2G_SPUR_WAR 0x00002000 -/* Flag to widen G-band PLL loop b/w */ -#define BFL2_GPLL_WAR2 0x00010000 -#define BFL2_IPALVLSHIFT_3P3 0x00020000 -/* Use internal envelope detector for TX IQCAL */ -#define BFL2_INTERNDET_TXIQCAL 0x00040000 -/* Keep the buffered Xtal output from radio "ON". Most drivers will turn it - * off without this flag to save power. */ -#define BFL2_XTALBUFOUTEN 0x00080000 - -/* - * board specific GPIO assignment, gpio 0-3 are also customer-configurable - * led - */ - -/* bit 9 controls the PA on new 4306 boards */ -#define BOARD_GPIO_PACTRL 0x200 -#define BOARD_GPIO_12 0x1000 -#define BOARD_GPIO_13 0x2000 - -/* **** Core type/rev defaults **** */ -#define D11CONF 0x0fffffb0 /* Supported D11 revs: 4, 5, 7-27 - * also need to update wlc.h MAXCOREREV - */ - -#define NCONF 0x000001ff /* Supported nphy revs: - * 0 4321a0 - * 1 4321a1 - * 2 4321b0/b1/c0/c1 - * 3 4322a0 - * 4 4322a1 - * 5 4716a0 - * 6 43222a0, 43224a0 - * 7 43226a0 - * 8 5357a0, 43236a0 - */ - -#define LCNCONF 0x00000007 /* Supported lcnphy revs: - * 0 4313a0, 4336a0, 4330a0 - * 1 - * 2 4330a0 - */ - -#define SSLPNCONF 0x0000000f /* Supported sslpnphy revs: - * 0 4329a0/k0 - * 1 4329b0/4329C0 - * 2 4319a0 - * 3 5356a0 - */ - -/******************************************************************** - * Phy/Core Configuration. Defines macros to to check core phy/rev * - * compile-time configuration. Defines default core support. * - * ****************************************************************** - */ - -/* Basic macros to check a configuration bitmask */ - -#define CONF_HAS(config, val) ((config) & (1 << (val))) -#define CONF_MSK(config, mask) ((config) & (mask)) -#define MSK_RANGE(low, hi) ((1 << ((hi)+1)) - (1 << (low))) -#define CONF_RANGE(config, low, hi) (CONF_MSK(config, MSK_RANGE(low, high))) - -#define CONF_IS(config, val) ((config) == (1 << (val))) -#define CONF_GE(config, val) ((config) & (0-(1 << (val)))) -#define CONF_GT(config, val) ((config) & (0-2*(1 << (val)))) -#define CONF_LT(config, val) ((config) & ((1 << (val))-1)) -#define CONF_LE(config, val) ((config) & (2*(1 << (val))-1)) - -/* Wrappers for some of the above, specific to config constants */ - -#define NCONF_HAS(val) CONF_HAS(NCONF, val) -#define NCONF_MSK(mask) CONF_MSK(NCONF, mask) -#define NCONF_IS(val) CONF_IS(NCONF, val) -#define NCONF_GE(val) CONF_GE(NCONF, val) -#define NCONF_GT(val) CONF_GT(NCONF, val) -#define NCONF_LT(val) CONF_LT(NCONF, val) -#define NCONF_LE(val) CONF_LE(NCONF, val) - -#define LCNCONF_HAS(val) CONF_HAS(LCNCONF, val) -#define LCNCONF_MSK(mask) CONF_MSK(LCNCONF, mask) -#define LCNCONF_IS(val) CONF_IS(LCNCONF, val) -#define LCNCONF_GE(val) CONF_GE(LCNCONF, val) -#define LCNCONF_GT(val) CONF_GT(LCNCONF, val) -#define LCNCONF_LT(val) CONF_LT(LCNCONF, val) -#define LCNCONF_LE(val) CONF_LE(LCNCONF, val) - -#define D11CONF_HAS(val) CONF_HAS(D11CONF, val) -#define D11CONF_MSK(mask) CONF_MSK(D11CONF, mask) -#define D11CONF_IS(val) CONF_IS(D11CONF, val) -#define D11CONF_GE(val) CONF_GE(D11CONF, val) -#define D11CONF_GT(val) CONF_GT(D11CONF, val) -#define D11CONF_LT(val) CONF_LT(D11CONF, val) -#define D11CONF_LE(val) CONF_LE(D11CONF, val) - -#define PHYCONF_HAS(val) CONF_HAS(PHYTYPE, val) -#define PHYCONF_IS(val) CONF_IS(PHYTYPE, val) - -#define NREV_IS(var, val) \ - (NCONF_HAS(val) && (NCONF_IS(val) || ((var) == (val)))) - -#define NREV_GE(var, val) \ - (NCONF_GE(val) && (!NCONF_LT(val) || ((var) >= (val)))) - -#define NREV_GT(var, val) \ - (NCONF_GT(val) && (!NCONF_LE(val) || ((var) > (val)))) - -#define NREV_LT(var, val) \ - (NCONF_LT(val) && (!NCONF_GE(val) || ((var) < (val)))) - -#define NREV_LE(var, val) \ - (NCONF_LE(val) && (!NCONF_GT(val) || ((var) <= (val)))) - -#define LCNREV_IS(var, val) \ - (LCNCONF_HAS(val) && (LCNCONF_IS(val) || ((var) == (val)))) - -#define LCNREV_GE(var, val) \ - (LCNCONF_GE(val) && (!LCNCONF_LT(val) || ((var) >= (val)))) - -#define LCNREV_GT(var, val) \ - (LCNCONF_GT(val) && (!LCNCONF_LE(val) || ((var) > (val)))) - -#define LCNREV_LT(var, val) \ - (LCNCONF_LT(val) && (!LCNCONF_GE(val) || ((var) < (val)))) - -#define LCNREV_LE(var, val) \ - (LCNCONF_LE(val) && (!LCNCONF_GT(val) || ((var) <= (val)))) - -#define D11REV_IS(var, val) \ - (D11CONF_HAS(val) && (D11CONF_IS(val) || ((var) == (val)))) - -#define D11REV_GE(var, val) \ - (D11CONF_GE(val) && (!D11CONF_LT(val) || ((var) >= (val)))) - -#define D11REV_GT(var, val) \ - (D11CONF_GT(val) && (!D11CONF_LE(val) || ((var) > (val)))) - -#define D11REV_LT(var, val) \ - (D11CONF_LT(val) && (!D11CONF_GE(val) || ((var) < (val)))) - -#define D11REV_LE(var, val) \ - (D11CONF_LE(val) && (!D11CONF_GT(val) || ((var) <= (val)))) - -#define PHYTYPE_IS(var, val)\ - (PHYCONF_HAS(val) && (PHYCONF_IS(val) || ((var) == (val)))) - -/* Set up PHYTYPE automatically: (depends on PHY_TYPE_X, from d11.h) */ - -#define _PHYCONF_N (1 << PHY_TYPE_N) -#define _PHYCONF_LCN (1 << PHY_TYPE_LCN) -#define _PHYCONF_SSLPN (1 << PHY_TYPE_SSN) - -#define PHYTYPE (_PHYCONF_N | _PHYCONF_LCN | _PHYCONF_SSLPN) - -/* Utility macro to identify 802.11n (HT) capable PHYs */ -#define PHYTYPE_11N_CAP(phytype) \ - (PHYTYPE_IS(phytype, PHY_TYPE_N) || \ - PHYTYPE_IS(phytype, PHY_TYPE_LCN) || \ - PHYTYPE_IS(phytype, PHY_TYPE_SSN)) - -/* Last but not least: shorter wlc-specific var checks */ -#define BRCMS_ISNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_N) -#define BRCMS_ISLCNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_LCN) -#define BRCMS_ISSSLPNPHY(band) PHYTYPE_IS((band)->phytype, PHY_TYPE_SSN) - -#define BRCMS_PHY_11N_CAP(band) PHYTYPE_11N_CAP((band)->phytype) - -/********************************************************************** - * ------------- End of Core phy/rev configuration. ----------------- * - * ******************************************************************** - */ - -#define BCMMSG(dev, fmt, args...) \ -do { \ - if (brcm_msg_level & BRCM_DL_INFO) \ - wiphy_err(dev, "%s: " fmt, __func__, ##args); \ -} while (0) - -#ifdef CONFIG_BCM47XX -/* - * bcm4716 (which includes 4717 & 4718), plus 4706 on PCIe can reorder - * transactions. As a fix, a read after write is performed on certain places - * in the code. Older chips and the newer 5357 family don't require this fix. - */ -#define bcma_wflush16(c, o, v) \ - ({ bcma_write16(c, o, v); (void)bcma_read16(c, o); }) -#else -#define bcma_wflush16(c, o, v) bcma_write16(c, o, v) -#endif /* CONFIG_BCM47XX */ - -/* multi-bool data type: set of bools, mbool is true if any is set */ - -/* set one bool */ -#define mboolset(mb, bit) ((mb) |= (bit)) -/* clear one bool */ -#define mboolclr(mb, bit) ((mb) &= ~(bit)) -/* true if one bool is set */ -#define mboolisset(mb, bit) (((mb) & (bit)) != 0) -#define mboolmaskset(mb, mask, val) ((mb) = (((mb) & ~(mask)) | (val))) - -#define CEIL(x, y) (((x) + ((y)-1)) / (y)) - -/* forward declarations */ -struct wiphy; -struct ieee80211_sta; -struct ieee80211_tx_queue_params; -struct brcms_info; -struct brcms_c_info; -struct brcms_hardware; -struct brcms_band; -struct dma_pub; -struct si_pub; -struct tx_status; -struct d11rxhdr; -struct txpwr_limits; - -/* iovar structure */ -struct brcmu_iovar { - const char *name; /* name for lookup and display */ - u16 varid; /* id for switch */ - u16 flags; /* driver-specific flag bits */ - u16 type; /* base type of argument */ - u16 minlen; /* min length for buffer vars */ -}; - -/* brcm_msg_level is a bit vector with defs in defs.h */ -extern u32 brcm_msg_level; - -#endif /* _BRCM_TYPES_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmsmac/ucode_loader.c b/drivers/net/wireless/brcm80211/brcmsmac/ucode_loader.c deleted file mode 100644 index 80e3ccf865e3..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/ucode_loader.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include "types.h" -#include - -enum { - D11UCODE_NAMETAG_START = 0, - D11LCN0BSINITVALS24, - D11LCN0INITVALS24, - D11LCN1BSINITVALS24, - D11LCN1INITVALS24, - D11LCN2BSINITVALS24, - D11LCN2INITVALS24, - D11N0ABSINITVALS16, - D11N0BSINITVALS16, - D11N0INITVALS16, - D11UCODE_OVERSIGHT16_MIMO, - D11UCODE_OVERSIGHT16_MIMOSZ, - D11UCODE_OVERSIGHT24_LCN, - D11UCODE_OVERSIGHT24_LCNSZ, - D11UCODE_OVERSIGHT_BOMMAJOR, - D11UCODE_OVERSIGHT_BOMMINOR -}; - -int brcms_ucode_data_init(struct brcms_info *wl, struct brcms_ucode *ucode) -{ - int rc; - - rc = brcms_check_firmwares(wl); - - rc = rc < 0 ? rc : - brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn0bsinitvals24, - D11LCN0BSINITVALS24); - rc = rc < 0 ? - rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn0initvals24, - D11LCN0INITVALS24); - rc = rc < 0 ? - rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn1bsinitvals24, - D11LCN1BSINITVALS24); - rc = rc < 0 ? - rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn1initvals24, - D11LCN1INITVALS24); - rc = rc < 0 ? rc : - brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn2bsinitvals24, - D11LCN2BSINITVALS24); - rc = rc < 0 ? - rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11lcn2initvals24, - D11LCN2INITVALS24); - rc = rc < 0 ? - rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11n0absinitvals16, - D11N0ABSINITVALS16); - rc = rc < 0 ? - rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11n0bsinitvals16, - D11N0BSINITVALS16); - rc = rc < 0 ? - rc : brcms_ucode_init_buf(wl, (void **)&ucode->d11n0initvals16, - D11N0INITVALS16); - rc = rc < 0 ? - rc : brcms_ucode_init_buf(wl, (void **)&ucode->bcm43xx_16_mimo, - D11UCODE_OVERSIGHT16_MIMO); - rc = rc < 0 ? - rc : brcms_ucode_init_uint(wl, &ucode->bcm43xx_16_mimosz, - D11UCODE_OVERSIGHT16_MIMOSZ); - rc = rc < 0 ? - rc : brcms_ucode_init_buf(wl, (void **)&ucode->bcm43xx_24_lcn, - D11UCODE_OVERSIGHT24_LCN); - rc = rc < 0 ? - rc : brcms_ucode_init_uint(wl, &ucode->bcm43xx_24_lcnsz, - D11UCODE_OVERSIGHT24_LCNSZ); - rc = rc < 0 ? - rc : brcms_ucode_init_buf(wl, (void **)&ucode->bcm43xx_bommajor, - D11UCODE_OVERSIGHT_BOMMAJOR); - rc = rc < 0 ? - rc : brcms_ucode_init_buf(wl, (void **)&ucode->bcm43xx_bomminor, - D11UCODE_OVERSIGHT_BOMMINOR); - return rc; -} - -void brcms_ucode_data_free(struct brcms_ucode *ucode) -{ - brcms_ucode_free_buf((void *)ucode->d11lcn0bsinitvals24); - brcms_ucode_free_buf((void *)ucode->d11lcn0initvals24); - brcms_ucode_free_buf((void *)ucode->d11lcn1bsinitvals24); - brcms_ucode_free_buf((void *)ucode->d11lcn1initvals24); - brcms_ucode_free_buf((void *)ucode->d11lcn2bsinitvals24); - brcms_ucode_free_buf((void *)ucode->d11lcn2initvals24); - brcms_ucode_free_buf((void *)ucode->d11n0absinitvals16); - brcms_ucode_free_buf((void *)ucode->d11n0bsinitvals16); - brcms_ucode_free_buf((void *)ucode->d11n0initvals16); - brcms_ucode_free_buf((void *)ucode->bcm43xx_16_mimo); - brcms_ucode_free_buf((void *)ucode->bcm43xx_24_lcn); - brcms_ucode_free_buf((void *)ucode->bcm43xx_bommajor); - brcms_ucode_free_buf((void *)ucode->bcm43xx_bomminor); -} diff --git a/drivers/net/wireless/brcm80211/brcmsmac/ucode_loader.h b/drivers/net/wireless/brcm80211/brcmsmac/ucode_loader.h deleted file mode 100644 index 18750a814b4f..000000000000 --- a/drivers/net/wireless/brcm80211/brcmsmac/ucode_loader.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef _BRCM_UCODE_H_ -#define _BRCM_UCODE_H_ - -#include "types.h" /* forward structure declarations */ - -#define MIN_FW_SIZE 40000 /* minimum firmware file size in bytes */ -#define MAX_FW_SIZE 150000 - -#define UCODE_LOADER_API_VER 0 - -struct d11init; - -struct brcms_ucode { - struct d11init *d11lcn0bsinitvals24; - struct d11init *d11lcn0initvals24; - struct d11init *d11lcn1bsinitvals24; - struct d11init *d11lcn1initvals24; - struct d11init *d11lcn2bsinitvals24; - struct d11init *d11lcn2initvals24; - struct d11init *d11n0absinitvals16; - struct d11init *d11n0bsinitvals16; - struct d11init *d11n0initvals16; - __le32 *bcm43xx_16_mimo; - size_t bcm43xx_16_mimosz; - __le32 *bcm43xx_24_lcn; - size_t bcm43xx_24_lcnsz; - u32 *bcm43xx_bommajor; - u32 *bcm43xx_bomminor; -}; - -extern int -brcms_ucode_data_init(struct brcms_info *wl, struct brcms_ucode *ucode); - -extern void brcms_ucode_data_free(struct brcms_ucode *ucode); - -extern int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, - unsigned int idx); -extern int brcms_ucode_init_uint(struct brcms_info *wl, size_t *n_bytes, - unsigned int idx); -extern void brcms_ucode_free_buf(void *); -extern int brcms_check_firmwares(struct brcms_info *wl); - -#endif /* _BRCM_UCODE_H_ */ diff --git a/drivers/net/wireless/brcm80211/brcmutil/Makefile b/drivers/net/wireless/brcm80211/brcmutil/Makefile deleted file mode 100644 index 8a928184016a..000000000000 --- a/drivers/net/wireless/brcm80211/brcmutil/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# -# Makefile fragment for Broadcom 802.11n Networking Device Driver Utilities -# -# Copyright (c) 2011 Broadcom Corporation -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION -# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN -# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -ccflags-y := \ - -Idrivers/net/wireless/brcm80211/brcmutil \ - -Idrivers/net/wireless/brcm80211/include - -obj-$(CONFIG_BRCMUTIL) += brcmutil.o -brcmutil-objs = utils.o d11.o diff --git a/drivers/net/wireless/brcm80211/brcmutil/d11.c b/drivers/net/wireless/brcm80211/brcmutil/d11.c deleted file mode 100644 index 30e54e2c6c9b..000000000000 --- a/drivers/net/wireless/brcm80211/brcmutil/d11.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2013 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/*********************channel spec common functions*********************/ - -#include - -#include -#include -#include - -static void brcmu_d11n_encchspec(struct brcmu_chan *ch) -{ - ch->chspec = ch->chnum & BRCMU_CHSPEC_CH_MASK; - - switch (ch->bw) { - case BRCMU_CHAN_BW_20: - ch->chspec |= BRCMU_CHSPEC_D11N_BW_20 | BRCMU_CHSPEC_D11N_SB_N; - break; - case BRCMU_CHAN_BW_40: - default: - WARN_ON_ONCE(1); - break; - } - - if (ch->chnum <= CH_MAX_2G_CHANNEL) - ch->chspec |= BRCMU_CHSPEC_D11N_BND_2G; - else - ch->chspec |= BRCMU_CHSPEC_D11N_BND_5G; -} - -static void brcmu_d11ac_encchspec(struct brcmu_chan *ch) -{ - ch->chspec = ch->chnum & BRCMU_CHSPEC_CH_MASK; - - switch (ch->bw) { - case BRCMU_CHAN_BW_20: - ch->chspec |= BRCMU_CHSPEC_D11AC_BW_20; - break; - case BRCMU_CHAN_BW_40: - case BRCMU_CHAN_BW_80: - case BRCMU_CHAN_BW_80P80: - case BRCMU_CHAN_BW_160: - default: - WARN_ON_ONCE(1); - break; - } - - if (ch->chnum <= CH_MAX_2G_CHANNEL) - ch->chspec |= BRCMU_CHSPEC_D11AC_BND_2G; - else - ch->chspec |= BRCMU_CHSPEC_D11AC_BND_5G; -} - -static void brcmu_d11n_decchspec(struct brcmu_chan *ch) -{ - u16 val; - - ch->chnum = (u8)(ch->chspec & BRCMU_CHSPEC_CH_MASK); - - switch (ch->chspec & BRCMU_CHSPEC_D11N_BW_MASK) { - case BRCMU_CHSPEC_D11N_BW_20: - ch->bw = BRCMU_CHAN_BW_20; - break; - case BRCMU_CHSPEC_D11N_BW_40: - ch->bw = BRCMU_CHAN_BW_40; - val = ch->chspec & BRCMU_CHSPEC_D11N_SB_MASK; - if (val == BRCMU_CHSPEC_D11N_SB_L) { - ch->sb = BRCMU_CHAN_SB_L; - ch->chnum -= CH_10MHZ_APART; - } else { - ch->sb = BRCMU_CHAN_SB_U; - ch->chnum += CH_10MHZ_APART; - } - break; - default: - WARN_ON_ONCE(1); - break; - } - - switch (ch->chspec & BRCMU_CHSPEC_D11N_BND_MASK) { - case BRCMU_CHSPEC_D11N_BND_5G: - ch->band = BRCMU_CHAN_BAND_5G; - break; - case BRCMU_CHSPEC_D11N_BND_2G: - ch->band = BRCMU_CHAN_BAND_2G; - break; - default: - WARN_ON_ONCE(1); - break; - } -} - -static void brcmu_d11ac_decchspec(struct brcmu_chan *ch) -{ - u16 val; - - ch->chnum = (u8)(ch->chspec & BRCMU_CHSPEC_CH_MASK); - - switch (ch->chspec & BRCMU_CHSPEC_D11AC_BW_MASK) { - case BRCMU_CHSPEC_D11AC_BW_20: - ch->bw = BRCMU_CHAN_BW_20; - break; - case BRCMU_CHSPEC_D11AC_BW_40: - ch->bw = BRCMU_CHAN_BW_40; - val = ch->chspec & BRCMU_CHSPEC_D11AC_SB_MASK; - if (val == BRCMU_CHSPEC_D11AC_SB_L) { - ch->sb = BRCMU_CHAN_SB_L; - ch->chnum -= CH_10MHZ_APART; - } else if (val == BRCMU_CHSPEC_D11AC_SB_U) { - ch->sb = BRCMU_CHAN_SB_U; - ch->chnum += CH_10MHZ_APART; - } else { - WARN_ON_ONCE(1); - } - break; - case BRCMU_CHSPEC_D11AC_BW_80: - ch->bw = BRCMU_CHAN_BW_80; - break; - case BRCMU_CHSPEC_D11AC_BW_8080: - case BRCMU_CHSPEC_D11AC_BW_160: - default: - WARN_ON_ONCE(1); - break; - } - - switch (ch->chspec & BRCMU_CHSPEC_D11AC_BND_MASK) { - case BRCMU_CHSPEC_D11AC_BND_5G: - ch->band = BRCMU_CHAN_BAND_5G; - break; - case BRCMU_CHSPEC_D11AC_BND_2G: - ch->band = BRCMU_CHAN_BAND_2G; - break; - default: - WARN_ON_ONCE(1); - break; - } -} - -void brcmu_d11_attach(struct brcmu_d11inf *d11inf) -{ - if (d11inf->io_type == BRCMU_D11N_IOTYPE) { - d11inf->encchspec = brcmu_d11n_encchspec; - d11inf->decchspec = brcmu_d11n_decchspec; - } else { - d11inf->encchspec = brcmu_d11ac_encchspec; - d11inf->decchspec = brcmu_d11ac_decchspec; - } -} -EXPORT_SYMBOL(brcmu_d11_attach); diff --git a/drivers/net/wireless/brcm80211/brcmutil/utils.c b/drivers/net/wireless/brcm80211/brcmutil/utils.c deleted file mode 100644 index 0f7e1c7b6f58..000000000000 --- a/drivers/net/wireless/brcm80211/brcmutil/utils.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include - -#include - -MODULE_AUTHOR("Broadcom Corporation"); -MODULE_DESCRIPTION("Broadcom 802.11n wireless LAN driver utilities."); -MODULE_SUPPORTED_DEVICE("Broadcom 802.11n WLAN cards"); -MODULE_LICENSE("Dual BSD/GPL"); - -struct sk_buff *brcmu_pkt_buf_get_skb(uint len) -{ - struct sk_buff *skb; - - skb = dev_alloc_skb(len); - if (skb) { - skb_put(skb, len); - skb->priority = 0; - } - - return skb; -} -EXPORT_SYMBOL(brcmu_pkt_buf_get_skb); - -/* Free the driver packet. Free the tag if present */ -void brcmu_pkt_buf_free_skb(struct sk_buff *skb) -{ - if (!skb) - return; - - WARN_ON(skb->next); - dev_kfree_skb_any(skb); -} -EXPORT_SYMBOL(brcmu_pkt_buf_free_skb); - -/* - * osl multiple-precedence packet queue - * hi_prec is always >= the number of the highest non-empty precedence - */ -struct sk_buff *brcmu_pktq_penq(struct pktq *pq, int prec, - struct sk_buff *p) -{ - struct sk_buff_head *q; - - if (pktq_full(pq) || pktq_pfull(pq, prec)) - return NULL; - - q = &pq->q[prec].skblist; - skb_queue_tail(q, p); - pq->len++; - - if (pq->hi_prec < prec) - pq->hi_prec = (u8) prec; - - return p; -} -EXPORT_SYMBOL(brcmu_pktq_penq); - -struct sk_buff *brcmu_pktq_penq_head(struct pktq *pq, int prec, - struct sk_buff *p) -{ - struct sk_buff_head *q; - - if (pktq_full(pq) || pktq_pfull(pq, prec)) - return NULL; - - q = &pq->q[prec].skblist; - skb_queue_head(q, p); - pq->len++; - - if (pq->hi_prec < prec) - pq->hi_prec = (u8) prec; - - return p; -} -EXPORT_SYMBOL(brcmu_pktq_penq_head); - -struct sk_buff *brcmu_pktq_pdeq(struct pktq *pq, int prec) -{ - struct sk_buff_head *q; - struct sk_buff *p; - - q = &pq->q[prec].skblist; - p = skb_dequeue(q); - if (p == NULL) - return NULL; - - pq->len--; - return p; -} -EXPORT_SYMBOL(brcmu_pktq_pdeq); - -/* - * precedence based dequeue with match function. Passing a NULL pointer - * for the match function parameter is considered to be a wildcard so - * any packet on the queue is returned. In that case it is no different - * from brcmu_pktq_pdeq() above. - */ -struct sk_buff *brcmu_pktq_pdeq_match(struct pktq *pq, int prec, - bool (*match_fn)(struct sk_buff *skb, - void *arg), void *arg) -{ - struct sk_buff_head *q; - struct sk_buff *p, *next; - - q = &pq->q[prec].skblist; - skb_queue_walk_safe(q, p, next) { - if (match_fn == NULL || match_fn(p, arg)) { - skb_unlink(p, q); - pq->len--; - return p; - } - } - return NULL; -} -EXPORT_SYMBOL(brcmu_pktq_pdeq_match); - -struct sk_buff *brcmu_pktq_pdeq_tail(struct pktq *pq, int prec) -{ - struct sk_buff_head *q; - struct sk_buff *p; - - q = &pq->q[prec].skblist; - p = skb_dequeue_tail(q); - if (p == NULL) - return NULL; - - pq->len--; - return p; -} -EXPORT_SYMBOL(brcmu_pktq_pdeq_tail); - -void -brcmu_pktq_pflush(struct pktq *pq, int prec, bool dir, - bool (*fn)(struct sk_buff *, void *), void *arg) -{ - struct sk_buff_head *q; - struct sk_buff *p, *next; - - q = &pq->q[prec].skblist; - skb_queue_walk_safe(q, p, next) { - if (fn == NULL || (*fn) (p, arg)) { - skb_unlink(p, q); - brcmu_pkt_buf_free_skb(p); - pq->len--; - } - } -} -EXPORT_SYMBOL(brcmu_pktq_pflush); - -void brcmu_pktq_flush(struct pktq *pq, bool dir, - bool (*fn)(struct sk_buff *, void *), void *arg) -{ - int prec; - for (prec = 0; prec < pq->num_prec; prec++) - brcmu_pktq_pflush(pq, prec, dir, fn, arg); -} -EXPORT_SYMBOL(brcmu_pktq_flush); - -void brcmu_pktq_init(struct pktq *pq, int num_prec, int max_len) -{ - int prec; - - /* pq is variable size; only zero out what's requested */ - memset(pq, 0, - offsetof(struct pktq, q) + (sizeof(struct pktq_prec) * num_prec)); - - pq->num_prec = (u16) num_prec; - - pq->max = (u16) max_len; - - for (prec = 0; prec < num_prec; prec++) { - pq->q[prec].max = pq->max; - skb_queue_head_init(&pq->q[prec].skblist); - } -} -EXPORT_SYMBOL(brcmu_pktq_init); - -struct sk_buff *brcmu_pktq_peek_tail(struct pktq *pq, int *prec_out) -{ - int prec; - - if (pq->len == 0) - return NULL; - - for (prec = 0; prec < pq->hi_prec; prec++) - if (!skb_queue_empty(&pq->q[prec].skblist)) - break; - - if (prec_out) - *prec_out = prec; - - return skb_peek_tail(&pq->q[prec].skblist); -} -EXPORT_SYMBOL(brcmu_pktq_peek_tail); - -/* Return sum of lengths of a specific set of precedences */ -int brcmu_pktq_mlen(struct pktq *pq, uint prec_bmp) -{ - int prec, len; - - len = 0; - - for (prec = 0; prec <= pq->hi_prec; prec++) - if (prec_bmp & (1 << prec)) - len += pq->q[prec].skblist.qlen; - - return len; -} -EXPORT_SYMBOL(brcmu_pktq_mlen); - -/* Priority dequeue from a specific set of precedences */ -struct sk_buff *brcmu_pktq_mdeq(struct pktq *pq, uint prec_bmp, - int *prec_out) -{ - struct sk_buff_head *q; - struct sk_buff *p; - int prec; - - if (pq->len == 0) - return NULL; - - while ((prec = pq->hi_prec) > 0 && - skb_queue_empty(&pq->q[prec].skblist)) - pq->hi_prec--; - - while ((prec_bmp & (1 << prec)) == 0 || - skb_queue_empty(&pq->q[prec].skblist)) - if (prec-- == 0) - return NULL; - - q = &pq->q[prec].skblist; - p = skb_dequeue(q); - if (p == NULL) - return NULL; - - pq->len--; - - if (prec_out) - *prec_out = prec; - - return p; -} -EXPORT_SYMBOL(brcmu_pktq_mdeq); - -#if defined(DEBUG) -/* pretty hex print a pkt buffer chain */ -void brcmu_prpkt(const char *msg, struct sk_buff *p0) -{ - struct sk_buff *p; - - if (msg && (msg[0] != '\0')) - pr_debug("%s:\n", msg); - - for (p = p0; p; p = p->next) - print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, p->data, p->len); -} -EXPORT_SYMBOL(brcmu_prpkt); - -void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...) -{ - struct va_format vaf; - va_list args; - - va_start(args, fmt); - - vaf.fmt = fmt; - vaf.va = &args; - - pr_debug("%pV", &vaf); - - va_end(args); - - print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, data, size); -} -EXPORT_SYMBOL(brcmu_dbg_hex_dump); -#endif /* defined(DEBUG) */ diff --git a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h deleted file mode 100644 index c1fe245bb07e..000000000000 --- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_HW_IDS_H_ -#define _BRCM_HW_IDS_H_ - -#define BCM4313_D11N2G_ID 0x4727 /* 4313 802.11n 2.4G device */ - -#define BCM43224_D11N_ID 0x4353 /* 43224 802.11n dualband device */ -#define BCM43224_D11N_ID_VEN1 0x0576 /* Vendor specific 43224 802.11n db */ - -#define BCM43225_D11N2G_ID 0x4357 /* 43225 802.11n 2.4GHz device */ - -#define BCM43236_D11N_ID 0x4346 /* 43236 802.11n dualband device */ -#define BCM43236_D11N2G_ID 0x4347 /* 43236 802.11n 2.4GHz device */ - -/* Chipcommon Core Chip IDs */ -#define BCM4313_CHIP_ID 0x4313 -#define BCM43143_CHIP_ID 43143 -#define BCM43224_CHIP_ID 43224 -#define BCM43225_CHIP_ID 43225 -#define BCM43235_CHIP_ID 43235 -#define BCM43236_CHIP_ID 43236 -#define BCM43238_CHIP_ID 43238 -#define BCM43241_CHIP_ID 0x4324 -#define BCM4329_CHIP_ID 0x4329 -#define BCM4330_CHIP_ID 0x4330 -#define BCM4331_CHIP_ID 0x4331 -#define BCM4334_CHIP_ID 0x4334 -#define BCM4335_CHIP_ID 0x4335 - -#endif /* _BRCM_HW_IDS_H_ */ diff --git a/drivers/net/wireless/brcm80211/include/brcmu_d11.h b/drivers/net/wireless/brcm80211/include/brcmu_d11.h deleted file mode 100644 index 92623f02b1c0..000000000000 --- a/drivers/net/wireless/brcm80211/include/brcmu_d11.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCMU_D11_H_ -#define _BRCMU_D11_H_ - -/* d11 io type */ -#define BRCMU_D11N_IOTYPE 1 -#define BRCMU_D11AC_IOTYPE 2 - -/* A chanspec (channel specification) holds the channel number, band, - * bandwidth and control sideband - */ - -/* chanspec binary format */ - -#define BRCMU_CHSPEC_INVALID 255 -/* bit 0~7 channel number - * for 80+80 channels: bit 0~3 low channel id, bit 4~7 high channel id - */ -#define BRCMU_CHSPEC_CH_MASK 0x00ff -#define BRCMU_CHSPEC_CH_SHIFT 0 -#define BRCMU_CHSPEC_CHL_MASK 0x000f -#define BRCMU_CHSPEC_CHL_SHIFT 0 -#define BRCMU_CHSPEC_CHH_MASK 0x00f0 -#define BRCMU_CHSPEC_CHH_SHIFT 4 - -/* bit 8~16 for dot 11n IO types - * bit 8~9 sideband - * bit 10~11 bandwidth - * bit 12~13 spectral band - * bit 14~15 not used - */ -#define BRCMU_CHSPEC_D11N_SB_MASK 0x0300 -#define BRCMU_CHSPEC_D11N_SB_SHIFT 8 -#define BRCMU_CHSPEC_D11N_SB_L 0x0100 /* control lower */ -#define BRCMU_CHSPEC_D11N_SB_U 0x0200 /* control upper */ -#define BRCMU_CHSPEC_D11N_SB_N 0x0300 /* none */ -#define BRCMU_CHSPEC_D11N_BW_MASK 0x0c00 -#define BRCMU_CHSPEC_D11N_BW_SHIFT 10 -#define BRCMU_CHSPEC_D11N_BW_10 0x0400 -#define BRCMU_CHSPEC_D11N_BW_20 0x0800 -#define BRCMU_CHSPEC_D11N_BW_40 0x0c00 -#define BRCMU_CHSPEC_D11N_BND_MASK 0x3000 -#define BRCMU_CHSPEC_D11N_BND_SHIFT 12 -#define BRCMU_CHSPEC_D11N_BND_5G 0x1000 -#define BRCMU_CHSPEC_D11N_BND_2G 0x2000 - -/* bit 8~16 for dot 11ac IO types - * bit 8~10 sideband - * bit 11~13 bandwidth - * bit 14~15 spectral band - */ -#define BRCMU_CHSPEC_D11AC_SB_MASK 0x0700 -#define BRCMU_CHSPEC_D11AC_SB_SHIFT 8 -#define BRCMU_CHSPEC_D11AC_SB_LLL 0x0000 -#define BRCMU_CHSPEC_D11AC_SB_LLU 0x0100 -#define BRCMU_CHSPEC_D11AC_SB_LUL 0x0200 -#define BRCMU_CHSPEC_D11AC_SB_LUU 0x0300 -#define BRCMU_CHSPEC_D11AC_SB_ULL 0x0400 -#define BRCMU_CHSPEC_D11AC_SB_ULU 0x0500 -#define BRCMU_CHSPEC_D11AC_SB_UUL 0x0600 -#define BRCMU_CHSPEC_D11AC_SB_UUU 0x0700 -#define BRCMU_CHSPEC_D11AC_SB_LL BRCMU_CHSPEC_D11AC_SB_LLL -#define BRCMU_CHSPEC_D11AC_SB_LU BRCMU_CHSPEC_D11AC_SB_LLU -#define BRCMU_CHSPEC_D11AC_SB_UL BRCMU_CHSPEC_D11AC_SB_LUL -#define BRCMU_CHSPEC_D11AC_SB_UU BRCMU_CHSPEC_D11AC_SB_LUU -#define BRCMU_CHSPEC_D11AC_SB_L BRCMU_CHSPEC_D11AC_SB_LLL -#define BRCMU_CHSPEC_D11AC_SB_U BRCMU_CHSPEC_D11AC_SB_LLU -#define BRCMU_CHSPEC_D11AC_BW_MASK 0x3800 -#define BRCMU_CHSPEC_D11AC_BW_SHIFT 11 -#define BRCMU_CHSPEC_D11AC_BW_5 0x0000 -#define BRCMU_CHSPEC_D11AC_BW_10 0x0800 -#define BRCMU_CHSPEC_D11AC_BW_20 0x1000 -#define BRCMU_CHSPEC_D11AC_BW_40 0x1800 -#define BRCMU_CHSPEC_D11AC_BW_80 0x2000 -#define BRCMU_CHSPEC_D11AC_BW_160 0x2800 -#define BRCMU_CHSPEC_D11AC_BW_8080 0x3000 -#define BRCMU_CHSPEC_D11AC_BND_MASK 0xc000 -#define BRCMU_CHSPEC_D11AC_BND_SHIFT 14 -#define BRCMU_CHSPEC_D11AC_BND_2G 0x0000 -#define BRCMU_CHSPEC_D11AC_BND_3G 0x4000 -#define BRCMU_CHSPEC_D11AC_BND_4G 0x8000 -#define BRCMU_CHSPEC_D11AC_BND_5G 0xc000 - -#define BRCMU_CHAN_BAND_2G 0 -#define BRCMU_CHAN_BAND_5G 1 - -enum brcmu_chan_bw { - BRCMU_CHAN_BW_20, - BRCMU_CHAN_BW_40, - BRCMU_CHAN_BW_80, - BRCMU_CHAN_BW_80P80, - BRCMU_CHAN_BW_160, -}; - -enum brcmu_chan_sb { - BRCMU_CHAN_SB_NONE = 0, - BRCMU_CHAN_SB_L, - BRCMU_CHAN_SB_U, - BRCMU_CHAN_SB_LL, - BRCMU_CHAN_SB_LU, - BRCMU_CHAN_SB_UL, - BRCMU_CHAN_SB_UU, - BRCMU_CHAN_SB_LLL, - BRCMU_CHAN_SB_LLU, - BRCMU_CHAN_SB_LUL, - BRCMU_CHAN_SB_LUU, - BRCMU_CHAN_SB_ULL, - BRCMU_CHAN_SB_ULU, - BRCMU_CHAN_SB_UUL, - BRCMU_CHAN_SB_UUU, -}; - -struct brcmu_chan { - u16 chspec; - u8 chnum; - u8 band; - enum brcmu_chan_bw bw; - enum brcmu_chan_sb sb; -}; - -struct brcmu_d11inf { - u8 io_type; - - void (*encchspec)(struct brcmu_chan *ch); - void (*decchspec)(struct brcmu_chan *ch); -}; - -extern void brcmu_d11_attach(struct brcmu_d11inf *d11inf); - -#endif /* _BRCMU_CHANNELS_H_ */ diff --git a/drivers/net/wireless/brcm80211/include/brcmu_utils.h b/drivers/net/wireless/brcm80211/include/brcmu_utils.h deleted file mode 100644 index 898cacb8d01d..000000000000 --- a/drivers/net/wireless/brcm80211/include/brcmu_utils.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCMU_UTILS_H_ -#define _BRCMU_UTILS_H_ - -#include - -/* - * Spin at most 'us' microseconds while 'exp' is true. - * Caller should explicitly test 'exp' when this completes - * and take appropriate error action if 'exp' is still true. - */ -#define SPINWAIT(exp, us) { \ - uint countdown = (us) + 9; \ - while ((exp) && (countdown >= 10)) {\ - udelay(10); \ - countdown -= 10; \ - } \ -} - -/* osl multi-precedence packet queue */ -#define PKTQ_LEN_DEFAULT 128 /* Max 128 packets */ -#define PKTQ_MAX_PREC 16 /* Maximum precedence levels */ - -#define BCME_STRLEN 64 /* Max string length for BCM errors */ - -/* the largest reasonable packet buffer driver uses for ethernet MTU in bytes */ -#define PKTBUFSZ 2048 - -#ifndef setbit -#ifndef NBBY /* the BSD family defines NBBY */ -#define NBBY 8 /* 8 bits per byte */ -#endif /* #ifndef NBBY */ -#define setbit(a, i) (((u8 *)a)[(i)/NBBY] |= 1<<((i)%NBBY)) -#define clrbit(a, i) (((u8 *)a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) -#define isset(a, i) (((const u8 *)a)[(i)/NBBY] & (1<<((i)%NBBY))) -#define isclr(a, i) ((((const u8 *)a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) -#endif /* setbit */ - -#define NBITS(type) (sizeof(type) * 8) -#define NBITVAL(nbits) (1 << (nbits)) -#define MAXBITVAL(nbits) ((1 << (nbits)) - 1) -#define NBITMASK(nbits) MAXBITVAL(nbits) -#define MAXNBVAL(nbyte) MAXBITVAL((nbyte) * 8) - -/* crc defines */ -#define CRC16_INIT_VALUE 0xffff /* Initial CRC16 checksum value */ -#define CRC16_GOOD_VALUE 0xf0b8 /* Good final CRC16 checksum value */ - -/* 18-bytes of Ethernet address buffer length */ -#define ETHER_ADDR_STR_LEN 18 - -struct pktq_prec { - struct sk_buff_head skblist; - u16 max; /* maximum number of queued packets */ -}; - -/* multi-priority pkt queue */ -struct pktq { - u16 num_prec; /* number of precedences in use */ - u16 hi_prec; /* rapid dequeue hint (>= highest non-empty prec) */ - u16 max; /* total max packets */ - u16 len; /* total number of packets */ - /* - * q array must be last since # of elements can be either - * PKTQ_MAX_PREC or 1 - */ - struct pktq_prec q[PKTQ_MAX_PREC]; -}; - -/* operations on a specific precedence in packet queue */ - -static inline int pktq_plen(struct pktq *pq, int prec) -{ - return pq->q[prec].skblist.qlen; -} - -static inline int pktq_pavail(struct pktq *pq, int prec) -{ - return pq->q[prec].max - pq->q[prec].skblist.qlen; -} - -static inline bool pktq_pfull(struct pktq *pq, int prec) -{ - return pq->q[prec].skblist.qlen >= pq->q[prec].max; -} - -static inline bool pktq_pempty(struct pktq *pq, int prec) -{ - return skb_queue_empty(&pq->q[prec].skblist); -} - -static inline struct sk_buff *pktq_ppeek(struct pktq *pq, int prec) -{ - return skb_peek(&pq->q[prec].skblist); -} - -static inline struct sk_buff *pktq_ppeek_tail(struct pktq *pq, int prec) -{ - return skb_peek_tail(&pq->q[prec].skblist); -} - -extern struct sk_buff *brcmu_pktq_penq(struct pktq *pq, int prec, - struct sk_buff *p); -extern struct sk_buff *brcmu_pktq_penq_head(struct pktq *pq, int prec, - struct sk_buff *p); -extern struct sk_buff *brcmu_pktq_pdeq(struct pktq *pq, int prec); -extern struct sk_buff *brcmu_pktq_pdeq_tail(struct pktq *pq, int prec); -extern struct sk_buff *brcmu_pktq_pdeq_match(struct pktq *pq, int prec, - bool (*match_fn)(struct sk_buff *p, - void *arg), - void *arg); - -/* packet primitives */ -extern struct sk_buff *brcmu_pkt_buf_get_skb(uint len); -extern void brcmu_pkt_buf_free_skb(struct sk_buff *skb); - -/* Empty the queue at particular precedence level */ -/* callback function fn(pkt, arg) returns true if pkt belongs to if */ -extern void brcmu_pktq_pflush(struct pktq *pq, int prec, - bool dir, bool (*fn)(struct sk_buff *, void *), void *arg); - -/* operations on a set of precedences in packet queue */ - -extern int brcmu_pktq_mlen(struct pktq *pq, uint prec_bmp); -extern struct sk_buff *brcmu_pktq_mdeq(struct pktq *pq, uint prec_bmp, - int *prec_out); - -/* operations on packet queue as a whole */ - -static inline int pktq_len(struct pktq *pq) -{ - return (int)pq->len; -} - -static inline int pktq_max(struct pktq *pq) -{ - return (int)pq->max; -} - -static inline int pktq_avail(struct pktq *pq) -{ - return (int)(pq->max - pq->len); -} - -static inline bool pktq_full(struct pktq *pq) -{ - return pq->len >= pq->max; -} - -static inline bool pktq_empty(struct pktq *pq) -{ - return pq->len == 0; -} - -extern void brcmu_pktq_init(struct pktq *pq, int num_prec, int max_len); -/* prec_out may be NULL if caller is not interested in return value */ -extern struct sk_buff *brcmu_pktq_peek_tail(struct pktq *pq, int *prec_out); -extern void brcmu_pktq_flush(struct pktq *pq, bool dir, - bool (*fn)(struct sk_buff *, void *), void *arg); - -/* externs */ -/* ip address */ -struct ipv4_addr; - -/* - * bitfield macros using masking and shift - * - * remark: the mask parameter should be a shifted mask. - */ -static inline void brcmu_maskset32(u32 *var, u32 mask, u8 shift, u32 value) -{ - value = (value << shift) & mask; - *var = (*var & ~mask) | value; -} -static inline u32 brcmu_maskget32(u32 var, u32 mask, u8 shift) -{ - return (var & mask) >> shift; -} -static inline void brcmu_maskset16(u16 *var, u16 mask, u8 shift, u16 value) -{ - value = (value << shift) & mask; - *var = (*var & ~mask) | value; -} -static inline u16 brcmu_maskget16(u16 var, u16 mask, u8 shift) -{ - return (var & mask) >> shift; -} - -/* externs */ -/* format/print */ -#ifdef DEBUG -extern void brcmu_prpkt(const char *msg, struct sk_buff *p0); -#else -#define brcmu_prpkt(a, b) -#endif /* DEBUG */ - -#ifdef DEBUG -extern __printf(3, 4) -void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...); -#else -__printf(3, 4) -static inline -void brcmu_dbg_hex_dump(const void *data, size_t size, const char *fmt, ...) -{ -} -#endif - -#endif /* _BRCMU_UTILS_H_ */ diff --git a/drivers/net/wireless/brcm80211/include/brcmu_wifi.h b/drivers/net/wireless/brcm80211/include/brcmu_wifi.h deleted file mode 100644 index 0505cc065e0d..000000000000 --- a/drivers/net/wireless/brcm80211/include/brcmu_wifi.h +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCMU_WIFI_H_ -#define _BRCMU_WIFI_H_ - -#include /* for ETH_ALEN */ -#include /* for WLAN_PMKID_LEN */ - -/* - * A chanspec (u16) holds the channel number, band, bandwidth and control - * sideband - */ - -/* channel defines */ -#define CH_UPPER_SB 0x01 -#define CH_LOWER_SB 0x02 -#define CH_EWA_VALID 0x04 -#define CH_20MHZ_APART 4 -#define CH_10MHZ_APART 2 -#define CH_5MHZ_APART 1 /* 2G band channels are 5 Mhz apart */ -#define CH_MIN_2G_CHANNEL 1 -#define CH_MAX_2G_CHANNEL 14 /* Max channel in 2G band */ -#define CH_MIN_5G_CHANNEL 34 - -/* bandstate array indices */ -#define BAND_2G_INDEX 0 /* wlc->bandstate[x] index */ -#define BAND_5G_INDEX 1 /* wlc->bandstate[x] index */ - -/* - * max # supported channels. The max channel no is 216, this is that + 1 - * rounded up to a multiple of NBBY (8). DO NOT MAKE it > 255: channels are - * u8's all over -*/ -#define MAXCHANNEL 224 - -#define WL_CHANSPEC_CHAN_MASK 0x00ff -#define WL_CHANSPEC_CHAN_SHIFT 0 - -#define WL_CHANSPEC_CTL_SB_MASK 0x0300 -#define WL_CHANSPEC_CTL_SB_SHIFT 8 -#define WL_CHANSPEC_CTL_SB_LOWER 0x0100 -#define WL_CHANSPEC_CTL_SB_UPPER 0x0200 -#define WL_CHANSPEC_CTL_SB_NONE 0x0300 - -#define WL_CHANSPEC_BW_MASK 0x0C00 -#define WL_CHANSPEC_BW_SHIFT 10 -#define WL_CHANSPEC_BW_10 0x0400 -#define WL_CHANSPEC_BW_20 0x0800 -#define WL_CHANSPEC_BW_40 0x0C00 -#define WL_CHANSPEC_BW_80 0x2000 - -#define WL_CHANSPEC_BAND_MASK 0xf000 -#define WL_CHANSPEC_BAND_SHIFT 12 -#define WL_CHANSPEC_BAND_5G 0x1000 -#define WL_CHANSPEC_BAND_2G 0x2000 -#define INVCHANSPEC 255 - -#define WL_CHAN_VALID_HW (1 << 0) /* valid with current HW */ -#define WL_CHAN_VALID_SW (1 << 1) /* valid with country sett. */ -#define WL_CHAN_BAND_5G (1 << 2) /* 5GHz-band channel */ -#define WL_CHAN_RADAR (1 << 3) /* radar sensitive channel */ -#define WL_CHAN_INACTIVE (1 << 4) /* inactive due to radar */ -#define WL_CHAN_PASSIVE (1 << 5) /* channel in passive mode */ -#define WL_CHAN_RESTRICTED (1 << 6) /* restricted use channel */ - -/* values for band specific 40MHz capabilities */ -#define WLC_N_BW_20ALL 0 -#define WLC_N_BW_40ALL 1 -#define WLC_N_BW_20IN2G_40IN5G 2 - -/* band types */ -#define WLC_BAND_AUTO 0 /* auto-select */ -#define WLC_BAND_5G 1 /* 5 Ghz */ -#define WLC_BAND_2G 2 /* 2.4 Ghz */ -#define WLC_BAND_ALL 3 /* all bands */ - -#define CHSPEC_CHANNEL(chspec) ((u8)((chspec) & WL_CHANSPEC_CHAN_MASK)) -#define CHSPEC_BAND(chspec) ((chspec) & WL_CHANSPEC_BAND_MASK) - -#define CHSPEC_CTL_SB(chspec) ((chspec) & WL_CHANSPEC_CTL_SB_MASK) -#define CHSPEC_BW(chspec) ((chspec) & WL_CHANSPEC_BW_MASK) - -#define CHSPEC_IS10(chspec) \ - (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_10) - -#define CHSPEC_IS20(chspec) \ - (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_20) - -#define CHSPEC_IS40(chspec) \ - (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_40) - -#define CHSPEC_IS80(chspec) \ - (((chspec) & WL_CHANSPEC_BW_MASK) == WL_CHANSPEC_BW_80) - -#define CHSPEC_IS5G(chspec) \ - (((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_5G) - -#define CHSPEC_IS2G(chspec) \ - (((chspec) & WL_CHANSPEC_BAND_MASK) == WL_CHANSPEC_BAND_2G) - -#define CHSPEC_SB_NONE(chspec) \ - (((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_NONE) - -#define CHSPEC_SB_UPPER(chspec) \ - (((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_UPPER) - -#define CHSPEC_SB_LOWER(chspec) \ - (((chspec) & WL_CHANSPEC_CTL_SB_MASK) == WL_CHANSPEC_CTL_SB_LOWER) - -#define CHSPEC_CTL_CHAN(chspec) \ - ((CHSPEC_SB_LOWER(chspec)) ? \ - (lower_20_sb(((chspec) & WL_CHANSPEC_CHAN_MASK))) : \ - (upper_20_sb(((chspec) & WL_CHANSPEC_CHAN_MASK)))) - -#define CHSPEC2BAND(chspec) (CHSPEC_IS5G(chspec) ? BRCM_BAND_5G : BRCM_BAND_2G) - -#define CHANSPEC_STR_LEN 8 - -static inline int lower_20_sb(int channel) -{ - return channel > CH_10MHZ_APART ? (channel - CH_10MHZ_APART) : 0; -} - -static inline int upper_20_sb(int channel) -{ - return (channel < (MAXCHANNEL - CH_10MHZ_APART)) ? - channel + CH_10MHZ_APART : 0; -} - -static inline int chspec_bandunit(u16 chspec) -{ - return CHSPEC_IS5G(chspec) ? BAND_5G_INDEX : BAND_2G_INDEX; -} - -static inline u16 ch20mhz_chspec(int channel) -{ - u16 rc = channel <= CH_MAX_2G_CHANNEL ? - WL_CHANSPEC_BAND_2G : WL_CHANSPEC_BAND_5G; - - return (u16)((u16)channel | WL_CHANSPEC_BW_20 | - WL_CHANSPEC_CTL_SB_NONE | rc); -} - -static inline int next_20mhz_chan(int channel) -{ - return channel < (MAXCHANNEL - CH_20MHZ_APART) ? - channel + CH_20MHZ_APART : 0; -} - -/* defined rate in 500kbps */ -#define BRCM_MAXRATE 108 /* in 500kbps units */ -#define BRCM_RATE_1M 2 /* in 500kbps units */ -#define BRCM_RATE_2M 4 /* in 500kbps units */ -#define BRCM_RATE_5M5 11 /* in 500kbps units */ -#define BRCM_RATE_11M 22 /* in 500kbps units */ -#define BRCM_RATE_6M 12 /* in 500kbps units */ -#define BRCM_RATE_9M 18 /* in 500kbps units */ -#define BRCM_RATE_12M 24 /* in 500kbps units */ -#define BRCM_RATE_18M 36 /* in 500kbps units */ -#define BRCM_RATE_24M 48 /* in 500kbps units */ -#define BRCM_RATE_36M 72 /* in 500kbps units */ -#define BRCM_RATE_48M 96 /* in 500kbps units */ -#define BRCM_RATE_54M 108 /* in 500kbps units */ - -#define BRCM_2G_25MHZ_OFFSET 5 /* 2.4GHz band channel offset */ - -#define MCSSET_LEN 16 - -static inline bool ac_bitmap_tst(u8 bitmap, int prec) -{ - return (bitmap & (1 << (prec))) != 0; -} - -/* Enumerate crypto algorithms */ -#define CRYPTO_ALGO_OFF 0 -#define CRYPTO_ALGO_WEP1 1 -#define CRYPTO_ALGO_TKIP 2 -#define CRYPTO_ALGO_WEP128 3 -#define CRYPTO_ALGO_AES_CCM 4 -#define CRYPTO_ALGO_AES_RESERVED1 5 -#define CRYPTO_ALGO_AES_RESERVED2 6 -#define CRYPTO_ALGO_NALG 7 - -/* wireless security bitvec */ - -#define WEP_ENABLED 0x0001 -#define TKIP_ENABLED 0x0002 -#define AES_ENABLED 0x0004 -#define WSEC_SWFLAG 0x0008 -/* to go into transition mode without setting wep */ -#define SES_OW_ENABLED 0x0040 - -/* WPA authentication mode bitvec */ -#define WPA_AUTH_DISABLED 0x0000 /* Legacy (i.e., non-WPA) */ -#define WPA_AUTH_NONE 0x0001 /* none (IBSS) */ -#define WPA_AUTH_UNSPECIFIED 0x0002 /* over 802.1x */ -#define WPA_AUTH_PSK 0x0004 /* Pre-shared key */ -#define WPA_AUTH_RESERVED1 0x0008 -#define WPA_AUTH_RESERVED2 0x0010 - -#define WPA2_AUTH_RESERVED1 0x0020 -#define WPA2_AUTH_UNSPECIFIED 0x0040 /* over 802.1x */ -#define WPA2_AUTH_PSK 0x0080 /* Pre-shared key */ -#define WPA2_AUTH_RESERVED3 0x0200 -#define WPA2_AUTH_RESERVED4 0x0400 -#define WPA2_AUTH_RESERVED5 0x0800 - -/* pmkid */ -#define MAXPMKID 16 - -#define DOT11_DEFAULT_RTS_LEN 2347 -#define DOT11_DEFAULT_FRAG_LEN 2346 - -#define DOT11_ICV_AES_LEN 8 -#define DOT11_QOS_LEN 2 -#define DOT11_IV_MAX_LEN 8 -#define DOT11_A4_HDR_LEN 30 - -#define HT_CAP_RX_STBC_NO 0x0 -#define HT_CAP_RX_STBC_ONE_STREAM 0x1 - -struct pmkid { - u8 BSSID[ETH_ALEN]; - u8 PMKID[WLAN_PMKID_LEN]; -}; - -struct pmkid_list { - __le32 npmkid; - struct pmkid pmkid[1]; -}; - -struct pmkid_cand { - u8 BSSID[ETH_ALEN]; - u8 preauth; -}; - -struct pmkid_cand_list { - u32 npmkid_cand; - struct pmkid_cand pmkid_cand[1]; -}; - -#endif /* _BRCMU_WIFI_H_ */ diff --git a/drivers/net/wireless/brcm80211/include/chipcommon.h b/drivers/net/wireless/brcm80211/include/chipcommon.h deleted file mode 100644 index d242333b7559..000000000000 --- a/drivers/net/wireless/brcm80211/include/chipcommon.h +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _SBCHIPC_H -#define _SBCHIPC_H - -#include "defs.h" /* for PAD macro */ - -#define CHIPCREGOFFS(field) offsetof(struct chipcregs, field) - -struct chipcregs { - u32 chipid; /* 0x0 */ - u32 capabilities; - u32 corecontrol; /* corerev >= 1 */ - u32 bist; - - /* OTP */ - u32 otpstatus; /* 0x10, corerev >= 10 */ - u32 otpcontrol; - u32 otpprog; - u32 otplayout; /* corerev >= 23 */ - - /* Interrupt control */ - u32 intstatus; /* 0x20 */ - u32 intmask; - - /* Chip specific regs */ - u32 chipcontrol; /* 0x28, rev >= 11 */ - u32 chipstatus; /* 0x2c, rev >= 11 */ - - /* Jtag Master */ - u32 jtagcmd; /* 0x30, rev >= 10 */ - u32 jtagir; - u32 jtagdr; - u32 jtagctrl; - - /* serial flash interface registers */ - u32 flashcontrol; /* 0x40 */ - u32 flashaddress; - u32 flashdata; - u32 PAD[1]; - - /* Silicon backplane configuration broadcast control */ - u32 broadcastaddress; /* 0x50 */ - u32 broadcastdata; - - /* gpio - cleared only by power-on-reset */ - u32 gpiopullup; /* 0x58, corerev >= 20 */ - u32 gpiopulldown; /* 0x5c, corerev >= 20 */ - u32 gpioin; /* 0x60 */ - u32 gpioout; /* 0x64 */ - u32 gpioouten; /* 0x68 */ - u32 gpiocontrol; /* 0x6C */ - u32 gpiointpolarity; /* 0x70 */ - u32 gpiointmask; /* 0x74 */ - - /* GPIO events corerev >= 11 */ - u32 gpioevent; - u32 gpioeventintmask; - - /* Watchdog timer */ - u32 watchdog; /* 0x80 */ - - /* GPIO events corerev >= 11 */ - u32 gpioeventintpolarity; - - /* GPIO based LED powersave registers corerev >= 16 */ - u32 gpiotimerval; /* 0x88 */ - u32 gpiotimeroutmask; - - /* clock control */ - u32 clockcontrol_n; /* 0x90 */ - u32 clockcontrol_sb; /* aka m0 */ - u32 clockcontrol_pci; /* aka m1 */ - u32 clockcontrol_m2; /* mii/uart/mipsref */ - u32 clockcontrol_m3; /* cpu */ - u32 clkdiv; /* corerev >= 3 */ - u32 gpiodebugsel; /* corerev >= 28 */ - u32 capabilities_ext; /* 0xac */ - - /* pll delay registers (corerev >= 4) */ - u32 pll_on_delay; /* 0xb0 */ - u32 fref_sel_delay; - u32 slow_clk_ctl; /* 5 < corerev < 10 */ - u32 PAD; - - /* Instaclock registers (corerev >= 10) */ - u32 system_clk_ctl; /* 0xc0 */ - u32 clkstatestretch; - u32 PAD[2]; - - /* Indirect backplane access (corerev >= 22) */ - u32 bp_addrlow; /* 0xd0 */ - u32 bp_addrhigh; - u32 bp_data; - u32 PAD; - u32 bp_indaccess; - u32 PAD[3]; - - /* More clock dividers (corerev >= 32) */ - u32 clkdiv2; - u32 PAD[2]; - - /* In AI chips, pointer to erom */ - u32 eromptr; /* 0xfc */ - - /* ExtBus control registers (corerev >= 3) */ - u32 pcmcia_config; /* 0x100 */ - u32 pcmcia_memwait; - u32 pcmcia_attrwait; - u32 pcmcia_iowait; - u32 ide_config; - u32 ide_memwait; - u32 ide_attrwait; - u32 ide_iowait; - u32 prog_config; - u32 prog_waitcount; - u32 flash_config; - u32 flash_waitcount; - u32 SECI_config; /* 0x130 SECI configuration */ - u32 PAD[3]; - - /* Enhanced Coexistence Interface (ECI) registers (corerev >= 21) */ - u32 eci_output; /* 0x140 */ - u32 eci_control; - u32 eci_inputlo; - u32 eci_inputmi; - u32 eci_inputhi; - u32 eci_inputintpolaritylo; - u32 eci_inputintpolaritymi; - u32 eci_inputintpolarityhi; - u32 eci_intmasklo; - u32 eci_intmaskmi; - u32 eci_intmaskhi; - u32 eci_eventlo; - u32 eci_eventmi; - u32 eci_eventhi; - u32 eci_eventmasklo; - u32 eci_eventmaskmi; - u32 eci_eventmaskhi; - u32 PAD[3]; - - /* SROM interface (corerev >= 32) */ - u32 sromcontrol; /* 0x190 */ - u32 sromaddress; - u32 sromdata; - u32 PAD[17]; - - /* Clock control and hardware workarounds (corerev >= 20) */ - u32 clk_ctl_st; /* 0x1e0 */ - u32 hw_war; - u32 PAD[70]; - - /* UARTs */ - u8 uart0data; /* 0x300 */ - u8 uart0imr; - u8 uart0fcr; - u8 uart0lcr; - u8 uart0mcr; - u8 uart0lsr; - u8 uart0msr; - u8 uart0scratch; - u8 PAD[248]; /* corerev >= 1 */ - - u8 uart1data; /* 0x400 */ - u8 uart1imr; - u8 uart1fcr; - u8 uart1lcr; - u8 uart1mcr; - u8 uart1lsr; - u8 uart1msr; - u8 uart1scratch; - u32 PAD[126]; - - /* PMU registers (corerev >= 20) */ - u32 pmucontrol; /* 0x600 */ - u32 pmucapabilities; - u32 pmustatus; - u32 res_state; - u32 res_pending; - u32 pmutimer; - u32 min_res_mask; - u32 max_res_mask; - u32 res_table_sel; - u32 res_dep_mask; - u32 res_updn_timer; - u32 res_timer; - u32 clkstretch; - u32 pmuwatchdog; - u32 gpiosel; /* 0x638, rev >= 1 */ - u32 gpioenable; /* 0x63c, rev >= 1 */ - u32 res_req_timer_sel; - u32 res_req_timer; - u32 res_req_mask; - u32 pmucapabilities_ext; /* 0x64c, pmurev >=15 */ - u32 chipcontrol_addr; /* 0x650 */ - u32 chipcontrol_data; /* 0x654 */ - u32 regcontrol_addr; - u32 regcontrol_data; - u32 pllcontrol_addr; - u32 pllcontrol_data; - u32 pmustrapopt; /* 0x668, corerev >= 28 */ - u32 pmu_xtalfreq; /* 0x66C, pmurev >= 10 */ - u32 retention_ctl; /* 0x670, pmurev >= 15 */ - u32 PAD[3]; - u32 retention_grpidx; /* 0x680 */ - u32 retention_grpctl; /* 0x684 */ - u32 PAD[94]; - u16 sromotp[768]; -}; - -/* chipid */ -#define CID_ID_MASK 0x0000ffff /* Chip Id mask */ -#define CID_REV_MASK 0x000f0000 /* Chip Revision mask */ -#define CID_REV_SHIFT 16 /* Chip Revision shift */ -#define CID_PKG_MASK 0x00f00000 /* Package Option mask */ -#define CID_PKG_SHIFT 20 /* Package Option shift */ -#define CID_CC_MASK 0x0f000000 /* CoreCount (corerev >= 4) */ -#define CID_CC_SHIFT 24 -#define CID_TYPE_MASK 0xf0000000 /* Chip Type */ -#define CID_TYPE_SHIFT 28 - -/* capabilities */ -#define CC_CAP_UARTS_MASK 0x00000003 /* Number of UARTs */ -#define CC_CAP_MIPSEB 0x00000004 /* MIPS is in big-endian mode */ -#define CC_CAP_UCLKSEL 0x00000018 /* UARTs clock select */ -/* UARTs are driven by internal divided clock */ -#define CC_CAP_UINTCLK 0x00000008 -#define CC_CAP_UARTGPIO 0x00000020 /* UARTs own GPIOs 15:12 */ -#define CC_CAP_EXTBUS_MASK 0x000000c0 /* External bus mask */ -#define CC_CAP_EXTBUS_NONE 0x00000000 /* No ExtBus present */ -#define CC_CAP_EXTBUS_FULL 0x00000040 /* ExtBus: PCMCIA, IDE & Prog */ -#define CC_CAP_EXTBUS_PROG 0x00000080 /* ExtBus: ProgIf only */ -#define CC_CAP_FLASH_MASK 0x00000700 /* Type of flash */ -#define CC_CAP_PLL_MASK 0x00038000 /* Type of PLL */ -#define CC_CAP_PWR_CTL 0x00040000 /* Power control */ -#define CC_CAP_OTPSIZE 0x00380000 /* OTP Size (0 = none) */ -#define CC_CAP_OTPSIZE_SHIFT 19 /* OTP Size shift */ -#define CC_CAP_OTPSIZE_BASE 5 /* OTP Size base */ -#define CC_CAP_JTAGP 0x00400000 /* JTAG Master Present */ -#define CC_CAP_ROM 0x00800000 /* Internal boot rom active */ -#define CC_CAP_BKPLN64 0x08000000 /* 64-bit backplane */ -#define CC_CAP_PMU 0x10000000 /* PMU Present, rev >= 20 */ -#define CC_CAP_SROM 0x40000000 /* Srom Present, rev >= 32 */ -/* Nand flash present, rev >= 35 */ -#define CC_CAP_NFLASH 0x80000000 - -#define CC_CAP2_SECI 0x00000001 /* SECI Present, rev >= 36 */ -/* GSIO (spi/i2c) present, rev >= 37 */ -#define CC_CAP2_GSIO 0x00000002 - -/* pmucapabilities */ -#define PCAP_REV_MASK 0x000000ff -#define PCAP_RC_MASK 0x00001f00 -#define PCAP_RC_SHIFT 8 -#define PCAP_TC_MASK 0x0001e000 -#define PCAP_TC_SHIFT 13 -#define PCAP_PC_MASK 0x001e0000 -#define PCAP_PC_SHIFT 17 -#define PCAP_VC_MASK 0x01e00000 -#define PCAP_VC_SHIFT 21 -#define PCAP_CC_MASK 0x1e000000 -#define PCAP_CC_SHIFT 25 -#define PCAP5_PC_MASK 0x003e0000 /* PMU corerev >= 5 */ -#define PCAP5_PC_SHIFT 17 -#define PCAP5_VC_MASK 0x07c00000 -#define PCAP5_VC_SHIFT 22 -#define PCAP5_CC_MASK 0xf8000000 -#define PCAP5_CC_SHIFT 27 -/* pmucapabilites_ext PMU rev >= 15 */ -#define PCAPEXT_SR_SUPPORTED_MASK (1 << 1) -/* retention_ctl PMU rev >= 15 */ -#define PMU_RCTL_MACPHY_DISABLE_MASK (1 << 26) -#define PMU_RCTL_LOGIC_DISABLE_MASK (1 << 27) - - -/* -* Maximum delay for the PMU state transition in us. -* This is an upper bound intended for spinwaits etc. -*/ -#define PMU_MAX_TRANSITION_DLY 15000 - -#endif /* _SBCHIPC_H */ diff --git a/drivers/net/wireless/brcm80211/include/defs.h b/drivers/net/wireless/brcm80211/include/defs.h deleted file mode 100644 index fb7cbcf81179..000000000000 --- a/drivers/net/wireless/brcm80211/include/defs.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_DEFS_H_ -#define _BRCM_DEFS_H_ - -#include - -#define SI_BUS 0 -#define PCI_BUS 1 -#define PCMCIA_BUS 2 -#define SDIO_BUS 3 -#define JTAG_BUS 4 -#define USB_BUS 5 -#define SPI_BUS 6 - -#define OFF 0 -#define ON 1 /* ON = 1 */ -#define AUTO (-1) /* Auto = -1 */ - -/* - * Priority definitions according 802.1D - */ -#define PRIO_8021D_NONE 2 -#define PRIO_8021D_BK 1 -#define PRIO_8021D_BE 0 -#define PRIO_8021D_EE 3 -#define PRIO_8021D_CL 4 -#define PRIO_8021D_VI 5 -#define PRIO_8021D_VO 6 -#define PRIO_8021D_NC 7 - -#define MAXPRIO 7 -#define NUMPRIO (MAXPRIO + 1) - -#define WL_NUMRATES 16 /* max # of rates in a rateset */ - -#define BRCM_CNTRY_BUF_SZ 4 /* Country string is 3 bytes + NUL */ - -#define BRCM_SET_CHANNEL 30 -#define BRCM_SET_SRL 32 -#define BRCM_SET_LRL 34 -#define BRCM_SET_BCNPRD 76 - -#define BRCM_GET_CURR_RATESET 114 /* current rateset */ -#define BRCM_GET_PHYLIST 180 - -/* Bit masks for radio disabled status - returned by WL_GET_RADIO */ - -#define WL_RADIO_SW_DISABLE (1<<0) -#define WL_RADIO_HW_DISABLE (1<<1) -/* some countries don't support any channel */ -#define WL_RADIO_COUNTRY_DISABLE (1<<3) - -/* Override bit for SET_TXPWR. if set, ignore other level limits */ -#define WL_TXPWR_OVERRIDE (1U<<31) - -/* band types */ -#define BRCM_BAND_AUTO 0 /* auto-select */ -#define BRCM_BAND_5G 1 /* 5 Ghz */ -#define BRCM_BAND_2G 2 /* 2.4 Ghz */ -#define BRCM_BAND_ALL 3 /* all bands */ - -/* Values for PM */ -#define PM_OFF 0 -#define PM_MAX 1 - -/* Debug levels */ -#define BRCM_DL_INFO 0x00000001 -#define BRCM_DL_MAC80211 0x00000002 -#define BRCM_DL_RX 0x00000004 -#define BRCM_DL_TX 0x00000008 -#define BRCM_DL_INT 0x00000010 -#define BRCM_DL_DMA 0x00000020 -#define BRCM_DL_HT 0x00000040 - -#define PM_OFF 0 -#define PM_MAX 1 -#define PM_FAST 2 - -/* - * Sonics Configuration Space Registers. - */ - -/* core sbconfig regs are top 256bytes of regs */ -#define SBCONFIGOFF 0xf00 - -/* cpp contortions to concatenate w/arg prescan */ -#ifndef PAD -#define _PADLINE(line) pad ## line -#define _XSTR(line) _PADLINE(line) -#define PAD _XSTR(__LINE__) -#endif - -#endif /* _BRCM_DEFS_H_ */ diff --git a/drivers/net/wireless/brcm80211/include/soc.h b/drivers/net/wireless/brcm80211/include/soc.h deleted file mode 100644 index 123cfa854a0d..000000000000 --- a/drivers/net/wireless/brcm80211/include/soc.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2010 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _BRCM_SOC_H -#define _BRCM_SOC_H - -#define SI_ENUM_BASE 0x18000000 /* Enumeration space base */ - -/* Common core control flags */ -#define SICF_BIST_EN 0x8000 -#define SICF_PME_EN 0x4000 -#define SICF_CORE_BITS 0x3ffc -#define SICF_FGC 0x0002 -#define SICF_CLOCK_EN 0x0001 - -/* Common core status flags */ -#define SISF_BIST_DONE 0x8000 -#define SISF_BIST_ERROR 0x4000 -#define SISF_GATED_CLK 0x2000 -#define SISF_DMA64 0x1000 -#define SISF_CORE_BITS 0x0fff - -#endif /* _BRCM_SOC_H */ diff --git a/drivers/net/wireless/esp8089/Kconfig b/drivers/net/wireless/esp8089/Kconfig deleted file mode 100755 index 620c5cfe719d..000000000000 --- a/drivers/net/wireless/esp8089/Kconfig +++ /dev/null @@ -1,22 +0,0 @@ - config ESP8089 - depends on WLAN_80211 && MMC - select WIRELESS_EXT - select WEXT_PRIV - select CFG80211 - select MAC80211 - select NL80211_TESTMODE - bool "Espressif 8089 sdio Wi-Fi" - ---help--- - Espressif 8089 sdio Wi-Fi support - - config BK3515A_COMBO - depends on ESP8089 - select WIRELESS_EXT - select WEXT_PRIV - select CFG80211 - select MAC80211 - select NL80211_TESTMODE - bool "Espressif 8089 sdio Wi-Fi combo with BK3515A bluetooth" - ---help--- - RK Wi-Fi+BT+[GPS optional] Combo module support - diff --git a/drivers/net/wireless/hostap/Kconfig b/drivers/net/wireless/hostap/Kconfig deleted file mode 100644 index 287d82728bc3..000000000000 --- a/drivers/net/wireless/hostap/Kconfig +++ /dev/null @@ -1,98 +0,0 @@ -config HOSTAP - tristate "IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)" - select WIRELESS_EXT - select WEXT_SPY - select WEXT_PRIV - select CRYPTO - select CRYPTO_ARC4 - select CRYPTO_ECB - select CRYPTO_AES - select CRYPTO_MICHAEL_MIC - select CRYPTO_ECB - select CRC32 - select LIB80211 - select LIB80211_CRYPT_WEP - select LIB80211_CRYPT_TKIP - select LIB80211_CRYPT_CCMP - ---help--- - Shared driver code for IEEE 802.11b wireless cards based on - Intersil Prism2/2.5/3 chipset. This driver supports so called - Host AP mode that allows the card to act as an IEEE 802.11 - access point. - - See for more information about the - Host AP driver configuration and tools. This site includes - information and tools (hostapd and wpa_supplicant) for WPA/WPA2 - support. - - This option includes the base Host AP driver code that is shared by - different hardware models. You will also need to enable support for - PLX/PCI/CS version of the driver to actually use the driver. - - The driver can be compiled as a module and it will be called - hostap. - -config HOSTAP_FIRMWARE - bool "Support downloading firmware images with Host AP driver" - depends on HOSTAP - ---help--- - Configure Host AP driver to include support for firmware image - download. This option by itself only enables downloading to the - volatile memory, i.e. the card RAM. This option is required to - support cards that don't have firmware in flash, such as D-Link - DWL-520 rev E and D-Link DWL-650 rev P. - - Firmware image downloading needs a user space tool, prism2_srec. - It is available from http://hostap.epitest.fi/. - -config HOSTAP_FIRMWARE_NVRAM - bool "Support for non-volatile firmware download" - depends on HOSTAP_FIRMWARE - ---help--- - Allow Host AP driver to write firmware images to the non-volatile - card memory, i.e. flash memory that survives power cycling. - Enable this option if you want to be able to change card firmware - permanently. - - Firmware image downloading needs a user space tool, prism2_srec. - It is available from http://hostap.epitest.fi/. - -config HOSTAP_PLX - tristate "Host AP driver for Prism2/2.5/3 in PLX9052 PCI adaptors" - depends on PCI && HOSTAP - ---help--- - Host AP driver's version for Prism2/2.5/3 PC Cards in PLX9052 based - PCI adaptors. - - "Host AP support for Prism2/2.5/3 IEEE 802.11b" is required for this - driver and its help text includes more information about the Host AP - driver. - - The driver can be compiled as a module and will be named - hostap_plx. - -config HOSTAP_PCI - tristate "Host AP driver for Prism2.5 PCI adaptors" - depends on PCI && HOSTAP - ---help--- - Host AP driver's version for Prism2.5 PCI adaptors. - - "Host AP support for Prism2/2.5/3 IEEE 802.11b" is required for this - driver and its help text includes more information about the Host AP - driver. - - The driver can be compiled as a module and will be named - hostap_pci. - -config HOSTAP_CS - tristate "Host AP driver for Prism2/2.5/3 PC Cards" - depends on PCMCIA && HOSTAP - ---help--- - Host AP driver's version for Prism2/2.5/3 PC Cards. - - "Host AP support for Prism2/2.5/3 IEEE 802.11b" is required for this - driver and its help text includes more information about the Host AP - driver. - - The driver can be compiled as a module and will be named - hostap_cs. diff --git a/drivers/net/wireless/hostap/Makefile b/drivers/net/wireless/hostap/Makefile deleted file mode 100644 index b8e41a702c00..000000000000 --- a/drivers/net/wireless/hostap/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -hostap-y := hostap_80211_rx.o hostap_80211_tx.o hostap_ap.o hostap_info.o \ - hostap_ioctl.o hostap_main.o hostap_proc.o -obj-$(CONFIG_HOSTAP) += hostap.o - -obj-$(CONFIG_HOSTAP_CS) += hostap_cs.o -obj-$(CONFIG_HOSTAP_PLX) += hostap_plx.o -obj-$(CONFIG_HOSTAP_PCI) += hostap_pci.o diff --git a/drivers/net/wireless/hostap/hostap.h b/drivers/net/wireless/hostap/hostap.h deleted file mode 100644 index ce8721fbc10e..000000000000 --- a/drivers/net/wireless/hostap/hostap.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef HOSTAP_H -#define HOSTAP_H - -#include -#include - -#include "hostap_wlan.h" -#include "hostap_ap.h" - -static const long freq_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, - 2447, 2452, 2457, 2462, 2467, 2472, 2484 }; -#define FREQ_COUNT ARRAY_SIZE(freq_list) - -/* hostap.c */ - -extern struct proc_dir_entry *hostap_proc; - -u16 hostap_tx_callback_register(local_info_t *local, - void (*func)(struct sk_buff *, int ok, void *), - void *data); -int hostap_tx_callback_unregister(local_info_t *local, u16 idx); -int hostap_set_word(struct net_device *dev, int rid, u16 val); -int hostap_set_string(struct net_device *dev, int rid, const char *val); -u16 hostap_get_porttype(local_info_t *local); -int hostap_set_encryption(local_info_t *local); -int hostap_set_antsel(local_info_t *local); -int hostap_set_roaming(local_info_t *local); -int hostap_set_auth_algs(local_info_t *local); -void hostap_dump_rx_header(const char *name, - const struct hfa384x_rx_frame *rx); -void hostap_dump_tx_header(const char *name, - const struct hfa384x_tx_frame *tx); -extern const struct header_ops hostap_80211_ops; -int hostap_80211_get_hdrlen(__le16 fc); -struct net_device_stats *hostap_get_stats(struct net_device *dev); -void hostap_setup_dev(struct net_device *dev, local_info_t *local, - int type); -void hostap_set_multicast_list_queue(struct work_struct *work); -int hostap_set_hostapd(local_info_t *local, int val, int rtnl_locked); -int hostap_set_hostapd_sta(local_info_t *local, int val, int rtnl_locked); -void hostap_cleanup(local_info_t *local); -void hostap_cleanup_handler(void *data); -struct net_device * hostap_add_interface(struct local_info *local, - int type, int rtnl_locked, - const char *prefix, const char *name); -void hostap_remove_interface(struct net_device *dev, int rtnl_locked, - int remove_from_list); -int prism2_update_comms_qual(struct net_device *dev); -int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, - u8 *body, size_t bodylen); -int prism2_sta_deauth(local_info_t *local, u16 reason); -int prism2_wds_add(local_info_t *local, u8 *remote_addr, - int rtnl_locked); -int prism2_wds_del(local_info_t *local, u8 *remote_addr, - int rtnl_locked, int do_not_remove); - - -/* hostap_ap.c */ - -int ap_control_add_mac(struct mac_restrictions *mac_restrictions, u8 *mac); -int ap_control_del_mac(struct mac_restrictions *mac_restrictions, u8 *mac); -void ap_control_flush_macs(struct mac_restrictions *mac_restrictions); -int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac); -void ap_control_kickall(struct ap_data *ap); -void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent, - struct lib80211_crypt_data ***crypt); -int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], - struct iw_quality qual[], int buf_size, - int aplist); -int prism2_ap_translate_scan(struct net_device *dev, - struct iw_request_info *info, char *buffer); -int prism2_hostapd(struct ap_data *ap, struct prism2_hostapd_param *param); - - -/* hostap_proc.c */ - -void hostap_init_proc(local_info_t *local); -void hostap_remove_proc(local_info_t *local); - - -/* hostap_info.c */ - -void hostap_info_init(local_info_t *local); -void hostap_info_process(local_info_t *local, struct sk_buff *skb); - - -/* hostap_ioctl.c */ - -extern const struct iw_handler_def hostap_iw_handler_def; -extern const struct ethtool_ops prism2_ethtool_ops; - -int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); - - -#endif /* HOSTAP_H */ diff --git a/drivers/net/wireless/hostap/hostap_80211.h b/drivers/net/wireless/hostap/hostap_80211.h deleted file mode 100644 index ed98ce7c8f65..000000000000 --- a/drivers/net/wireless/hostap/hostap_80211.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef HOSTAP_80211_H -#define HOSTAP_80211_H - -#include -#include -#include - -struct hostap_ieee80211_mgmt { - __le16 frame_control; - __le16 duration; - u8 da[6]; - u8 sa[6]; - u8 bssid[6]; - __le16 seq_ctrl; - union { - struct { - __le16 auth_alg; - __le16 auth_transaction; - __le16 status_code; - /* possibly followed by Challenge text */ - u8 variable[0]; - } __packed auth; - struct { - __le16 reason_code; - } __packed deauth; - struct { - __le16 capab_info; - __le16 listen_interval; - /* followed by SSID and Supported rates */ - u8 variable[0]; - } __packed assoc_req; - struct { - __le16 capab_info; - __le16 status_code; - __le16 aid; - /* followed by Supported rates */ - u8 variable[0]; - } __packed assoc_resp, reassoc_resp; - struct { - __le16 capab_info; - __le16 listen_interval; - u8 current_ap[6]; - /* followed by SSID and Supported rates */ - u8 variable[0]; - } __packed reassoc_req; - struct { - __le16 reason_code; - } __packed disassoc; - struct { - } __packed probe_req; - struct { - u8 timestamp[8]; - __le16 beacon_int; - __le16 capab_info; - /* followed by some of SSID, Supported rates, - * FH Params, DS Params, CF Params, IBSS Params, TIM */ - u8 variable[0]; - } __packed beacon, probe_resp; - } u; -} __packed; - - -#define IEEE80211_MGMT_HDR_LEN 24 -#define IEEE80211_DATA_HDR3_LEN 24 -#define IEEE80211_DATA_HDR4_LEN 30 - - -struct hostap_80211_rx_status { - u32 mac_time; - u8 signal; - u8 noise; - u16 rate; /* in 100 kbps */ -}; - -/* prism2_rx_80211 'type' argument */ -enum { - PRISM2_RX_MONITOR, PRISM2_RX_MGMT, PRISM2_RX_NON_ASSOC, - PRISM2_RX_NULLFUNC_ACK -}; - -int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats, int type); -void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats); -void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats); - -void hostap_dump_tx_80211(const char *name, struct sk_buff *skb); -netdev_tx_t hostap_data_start_xmit(struct sk_buff *skb, - struct net_device *dev); -netdev_tx_t hostap_mgmt_start_xmit(struct sk_buff *skb, - struct net_device *dev); -netdev_tx_t hostap_master_start_xmit(struct sk_buff *skb, - struct net_device *dev); - -#endif /* HOSTAP_80211_H */ diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c deleted file mode 100644 index d39e3e24077b..000000000000 --- a/drivers/net/wireless/hostap/hostap_80211_rx.c +++ /dev/null @@ -1,1117 +0,0 @@ -#include -#include -#include -#include -#include - -#include "hostap_80211.h" -#include "hostap.h" -#include "hostap_ap.h" - -/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ -/* Ethernet-II snap header (RFC1042 for most EtherTypes) */ -static unsigned char rfc1042_header[] = -{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; -/* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ -static unsigned char bridge_tunnel_header[] = -{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; -/* No encapsulation header if EtherType < 0x600 (=length) */ - -void hostap_dump_rx_80211(const char *name, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats) -{ - struct ieee80211_hdr *hdr; - u16 fc; - - hdr = (struct ieee80211_hdr *) skb->data; - - printk(KERN_DEBUG "%s: RX signal=%d noise=%d rate=%d len=%d " - "jiffies=%ld\n", - name, rx_stats->signal, rx_stats->noise, rx_stats->rate, - skb->len, jiffies); - - if (skb->len < 2) - return; - - fc = le16_to_cpu(hdr->frame_control); - printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", - fc, (fc & IEEE80211_FCTL_FTYPE) >> 2, - (fc & IEEE80211_FCTL_STYPE) >> 4, - fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", - fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); - - if (skb->len < IEEE80211_DATA_HDR3_LEN) { - printk("\n"); - return; - } - - printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id), - le16_to_cpu(hdr->seq_ctrl)); - - printk(KERN_DEBUG " A1=%pM", hdr->addr1); - printk(" A2=%pM", hdr->addr2); - printk(" A3=%pM", hdr->addr3); - if (skb->len >= 30) - printk(" A4=%pM", hdr->addr4); - printk("\n"); -} - - -/* Send RX frame to netif with 802.11 (and possible prism) header. - * Called from hardware or software IRQ context. */ -int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats, int type) -{ - struct hostap_interface *iface; - local_info_t *local; - int hdrlen, phdrlen, head_need, tail_need; - u16 fc; - int prism_header, ret; - struct ieee80211_hdr *fhdr; - - iface = netdev_priv(dev); - local = iface->local; - - if (dev->type == ARPHRD_IEEE80211_PRISM) { - if (local->monitor_type == PRISM2_MONITOR_PRISM) { - prism_header = 1; - phdrlen = sizeof(struct linux_wlan_ng_prism_hdr); - } else { /* local->monitor_type == PRISM2_MONITOR_CAPHDR */ - prism_header = 2; - phdrlen = sizeof(struct linux_wlan_ng_cap_hdr); - } - } else if (dev->type == ARPHRD_IEEE80211_RADIOTAP) { - prism_header = 3; - phdrlen = sizeof(struct hostap_radiotap_rx); - } else { - prism_header = 0; - phdrlen = 0; - } - - fhdr = (struct ieee80211_hdr *) skb->data; - fc = le16_to_cpu(fhdr->frame_control); - - if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) { - printk(KERN_DEBUG "%s: dropped management frame with header " - "version %d\n", dev->name, fc & IEEE80211_FCTL_VERS); - dev_kfree_skb_any(skb); - return 0; - } - - hdrlen = hostap_80211_get_hdrlen(fhdr->frame_control); - - /* check if there is enough room for extra data; if not, expand skb - * buffer to be large enough for the changes */ - head_need = phdrlen; - tail_need = 0; -#ifdef PRISM2_ADD_BOGUS_CRC - tail_need += 4; -#endif /* PRISM2_ADD_BOGUS_CRC */ - - head_need -= skb_headroom(skb); - tail_need -= skb_tailroom(skb); - - if (head_need > 0 || tail_need > 0) { - if (pskb_expand_head(skb, head_need > 0 ? head_need : 0, - tail_need > 0 ? tail_need : 0, - GFP_ATOMIC)) { - printk(KERN_DEBUG "%s: prism2_rx_80211 failed to " - "reallocate skb buffer\n", dev->name); - dev_kfree_skb_any(skb); - return 0; - } - } - - /* We now have an skb with enough head and tail room, so just insert - * the extra data */ - -#ifdef PRISM2_ADD_BOGUS_CRC - memset(skb_put(skb, 4), 0xff, 4); /* Prism2 strips CRC */ -#endif /* PRISM2_ADD_BOGUS_CRC */ - - if (prism_header == 1) { - struct linux_wlan_ng_prism_hdr *hdr; - hdr = (struct linux_wlan_ng_prism_hdr *) - skb_push(skb, phdrlen); - memset(hdr, 0, phdrlen); - hdr->msgcode = LWNG_CAP_DID_BASE; - hdr->msglen = sizeof(*hdr); - memcpy(hdr->devname, dev->name, sizeof(hdr->devname)); -#define LWNG_SETVAL(f,i,s,l,d) \ -hdr->f.did = LWNG_CAP_DID_BASE | (i << 12); \ -hdr->f.status = s; hdr->f.len = l; hdr->f.data = d - LWNG_SETVAL(hosttime, 1, 0, 4, jiffies); - LWNG_SETVAL(mactime, 2, 0, 4, rx_stats->mac_time); - LWNG_SETVAL(channel, 3, 1 /* no value */, 4, 0); - LWNG_SETVAL(rssi, 4, 1 /* no value */, 4, 0); - LWNG_SETVAL(sq, 5, 1 /* no value */, 4, 0); - LWNG_SETVAL(signal, 6, 0, 4, rx_stats->signal); - LWNG_SETVAL(noise, 7, 0, 4, rx_stats->noise); - LWNG_SETVAL(rate, 8, 0, 4, rx_stats->rate / 5); - LWNG_SETVAL(istx, 9, 0, 4, 0); - LWNG_SETVAL(frmlen, 10, 0, 4, skb->len - phdrlen); -#undef LWNG_SETVAL - } else if (prism_header == 2) { - struct linux_wlan_ng_cap_hdr *hdr; - hdr = (struct linux_wlan_ng_cap_hdr *) - skb_push(skb, phdrlen); - memset(hdr, 0, phdrlen); - hdr->version = htonl(LWNG_CAPHDR_VERSION); - hdr->length = htonl(phdrlen); - hdr->mactime = __cpu_to_be64(rx_stats->mac_time); - hdr->hosttime = __cpu_to_be64(jiffies); - hdr->phytype = htonl(4); /* dss_dot11_b */ - hdr->channel = htonl(local->channel); - hdr->datarate = htonl(rx_stats->rate); - hdr->antenna = htonl(0); /* unknown */ - hdr->priority = htonl(0); /* unknown */ - hdr->ssi_type = htonl(3); /* raw */ - hdr->ssi_signal = htonl(rx_stats->signal); - hdr->ssi_noise = htonl(rx_stats->noise); - hdr->preamble = htonl(0); /* unknown */ - hdr->encoding = htonl(1); /* cck */ - } else if (prism_header == 3) { - struct hostap_radiotap_rx *hdr; - hdr = (struct hostap_radiotap_rx *)skb_push(skb, phdrlen); - memset(hdr, 0, phdrlen); - hdr->hdr.it_len = cpu_to_le16(phdrlen); - hdr->hdr.it_present = - cpu_to_le32((1 << IEEE80211_RADIOTAP_TSFT) | - (1 << IEEE80211_RADIOTAP_CHANNEL) | - (1 << IEEE80211_RADIOTAP_RATE) | - (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | - (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)); - hdr->tsft = cpu_to_le64(rx_stats->mac_time); - hdr->chan_freq = cpu_to_le16(freq_list[local->channel - 1]); - hdr->chan_flags = cpu_to_le16(IEEE80211_CHAN_CCK | - IEEE80211_CHAN_2GHZ); - hdr->rate = rx_stats->rate / 5; - hdr->dbm_antsignal = rx_stats->signal; - hdr->dbm_antnoise = rx_stats->noise; - } - - ret = skb->len - phdrlen; - skb->dev = dev; - skb_reset_mac_header(skb); - skb_pull(skb, hdrlen); - if (prism_header) - skb_pull(skb, phdrlen); - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = cpu_to_be16(ETH_P_802_2); - memset(skb->cb, 0, sizeof(skb->cb)); - netif_rx(skb); - - return ret; -} - - -/* Called only as a tasklet (software IRQ) */ -static void monitor_rx(struct net_device *dev, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats) -{ - int len; - - len = prism2_rx_80211(dev, skb, rx_stats, PRISM2_RX_MONITOR); - dev->stats.rx_packets++; - dev->stats.rx_bytes += len; -} - - -/* Called only as a tasklet (software IRQ) */ -static struct prism2_frag_entry * -prism2_frag_cache_find(local_info_t *local, unsigned int seq, - unsigned int frag, u8 *src, u8 *dst) -{ - struct prism2_frag_entry *entry; - int i; - - for (i = 0; i < PRISM2_FRAG_CACHE_LEN; i++) { - entry = &local->frag_cache[i]; - if (entry->skb != NULL && - time_after(jiffies, entry->first_frag_time + 2 * HZ)) { - printk(KERN_DEBUG "%s: expiring fragment cache entry " - "seq=%u last_frag=%u\n", - local->dev->name, entry->seq, entry->last_frag); - dev_kfree_skb(entry->skb); - entry->skb = NULL; - } - - if (entry->skb != NULL && entry->seq == seq && - (entry->last_frag + 1 == frag || frag == -1) && - memcmp(entry->src_addr, src, ETH_ALEN) == 0 && - memcmp(entry->dst_addr, dst, ETH_ALEN) == 0) - return entry; - } - - return NULL; -} - - -/* Called only as a tasklet (software IRQ) */ -static struct sk_buff * -prism2_frag_cache_get(local_info_t *local, struct ieee80211_hdr *hdr) -{ - struct sk_buff *skb = NULL; - u16 sc; - unsigned int frag, seq; - struct prism2_frag_entry *entry; - - sc = le16_to_cpu(hdr->seq_ctrl); - frag = sc & IEEE80211_SCTL_FRAG; - seq = (sc & IEEE80211_SCTL_SEQ) >> 4; - - if (frag == 0) { - /* Reserve enough space to fit maximum frame length */ - skb = dev_alloc_skb(local->dev->mtu + - sizeof(struct ieee80211_hdr) + - 8 /* LLC */ + - 2 /* alignment */ + - 8 /* WEP */ + ETH_ALEN /* WDS */); - if (skb == NULL) - return NULL; - - entry = &local->frag_cache[local->frag_next_idx]; - local->frag_next_idx++; - if (local->frag_next_idx >= PRISM2_FRAG_CACHE_LEN) - local->frag_next_idx = 0; - - if (entry->skb != NULL) - dev_kfree_skb(entry->skb); - - entry->first_frag_time = jiffies; - entry->seq = seq; - entry->last_frag = frag; - entry->skb = skb; - memcpy(entry->src_addr, hdr->addr2, ETH_ALEN); - memcpy(entry->dst_addr, hdr->addr1, ETH_ALEN); - } else { - /* received a fragment of a frame for which the head fragment - * should have already been received */ - entry = prism2_frag_cache_find(local, seq, frag, hdr->addr2, - hdr->addr1); - if (entry != NULL) { - entry->last_frag = frag; - skb = entry->skb; - } - } - - return skb; -} - - -/* Called only as a tasklet (software IRQ) */ -static int prism2_frag_cache_invalidate(local_info_t *local, - struct ieee80211_hdr *hdr) -{ - u16 sc; - unsigned int seq; - struct prism2_frag_entry *entry; - - sc = le16_to_cpu(hdr->seq_ctrl); - seq = (sc & IEEE80211_SCTL_SEQ) >> 4; - - entry = prism2_frag_cache_find(local, seq, -1, hdr->addr2, hdr->addr1); - - if (entry == NULL) { - printk(KERN_DEBUG "%s: could not invalidate fragment cache " - "entry (seq=%u)\n", - local->dev->name, seq); - return -1; - } - - entry->skb = NULL; - return 0; -} - - -static struct hostap_bss_info *__hostap_get_bss(local_info_t *local, u8 *bssid, - u8 *ssid, size_t ssid_len) -{ - struct list_head *ptr; - struct hostap_bss_info *bss; - - list_for_each(ptr, &local->bss_list) { - bss = list_entry(ptr, struct hostap_bss_info, list); - if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0 && - (ssid == NULL || - (ssid_len == bss->ssid_len && - memcmp(ssid, bss->ssid, ssid_len) == 0))) { - list_move(&bss->list, &local->bss_list); - return bss; - } - } - - return NULL; -} - - -static struct hostap_bss_info *__hostap_add_bss(local_info_t *local, u8 *bssid, - u8 *ssid, size_t ssid_len) -{ - struct hostap_bss_info *bss; - - if (local->num_bss_info >= HOSTAP_MAX_BSS_COUNT) { - bss = list_entry(local->bss_list.prev, - struct hostap_bss_info, list); - list_del(&bss->list); - local->num_bss_info--; - } else { - bss = kmalloc(sizeof(*bss), GFP_ATOMIC); - if (bss == NULL) - return NULL; - } - - memset(bss, 0, sizeof(*bss)); - memcpy(bss->bssid, bssid, ETH_ALEN); - memcpy(bss->ssid, ssid, ssid_len); - bss->ssid_len = ssid_len; - local->num_bss_info++; - list_add(&bss->list, &local->bss_list); - return bss; -} - - -static void __hostap_expire_bss(local_info_t *local) -{ - struct hostap_bss_info *bss; - - while (local->num_bss_info > 0) { - bss = list_entry(local->bss_list.prev, - struct hostap_bss_info, list); - if (!time_after(jiffies, bss->last_update + 60 * HZ)) - break; - - list_del(&bss->list); - local->num_bss_info--; - kfree(bss); - } -} - - -/* Both IEEE 802.11 Beacon and Probe Response frames have similar structure, so - * the same routine can be used to parse both of them. */ -static void hostap_rx_sta_beacon(local_info_t *local, struct sk_buff *skb, - int stype) -{ - struct hostap_ieee80211_mgmt *mgmt; - int left, chan = 0; - u8 *pos; - u8 *ssid = NULL, *wpa = NULL, *rsn = NULL; - size_t ssid_len = 0, wpa_len = 0, rsn_len = 0; - struct hostap_bss_info *bss; - - if (skb->len < IEEE80211_MGMT_HDR_LEN + sizeof(mgmt->u.beacon)) - return; - - mgmt = (struct hostap_ieee80211_mgmt *) skb->data; - pos = mgmt->u.beacon.variable; - left = skb->len - (pos - skb->data); - - while (left >= 2) { - if (2 + pos[1] > left) - return; /* parse failed */ - switch (*pos) { - case WLAN_EID_SSID: - ssid = pos + 2; - ssid_len = pos[1]; - break; - case WLAN_EID_VENDOR_SPECIFIC: - if (pos[1] >= 4 && - pos[2] == 0x00 && pos[3] == 0x50 && - pos[4] == 0xf2 && pos[5] == 1) { - wpa = pos; - wpa_len = pos[1] + 2; - } - break; - case WLAN_EID_RSN: - rsn = pos; - rsn_len = pos[1] + 2; - break; - case WLAN_EID_DS_PARAMS: - if (pos[1] >= 1) - chan = pos[2]; - break; - } - left -= 2 + pos[1]; - pos += 2 + pos[1]; - } - - if (wpa_len > MAX_WPA_IE_LEN) - wpa_len = MAX_WPA_IE_LEN; - if (rsn_len > MAX_WPA_IE_LEN) - rsn_len = MAX_WPA_IE_LEN; - if (ssid_len > sizeof(bss->ssid)) - ssid_len = sizeof(bss->ssid); - - spin_lock(&local->lock); - bss = __hostap_get_bss(local, mgmt->bssid, ssid, ssid_len); - if (bss == NULL) - bss = __hostap_add_bss(local, mgmt->bssid, ssid, ssid_len); - if (bss) { - bss->last_update = jiffies; - bss->count++; - bss->capab_info = le16_to_cpu(mgmt->u.beacon.capab_info); - if (wpa) { - memcpy(bss->wpa_ie, wpa, wpa_len); - bss->wpa_ie_len = wpa_len; - } else - bss->wpa_ie_len = 0; - if (rsn) { - memcpy(bss->rsn_ie, rsn, rsn_len); - bss->rsn_ie_len = rsn_len; - } else - bss->rsn_ie_len = 0; - bss->chan = chan; - } - __hostap_expire_bss(local); - spin_unlock(&local->lock); -} - - -static int -hostap_rx_frame_mgmt(local_info_t *local, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats, u16 type, - u16 stype) -{ - if (local->iw_mode == IW_MODE_MASTER) - hostap_update_sta_ps(local, (struct ieee80211_hdr *) skb->data); - - if (local->hostapd && type == IEEE80211_FTYPE_MGMT) { - if (stype == IEEE80211_STYPE_BEACON && - local->iw_mode == IW_MODE_MASTER) { - struct sk_buff *skb2; - /* Process beacon frames also in kernel driver to - * update STA(AP) table statistics */ - skb2 = skb_clone(skb, GFP_ATOMIC); - if (skb2) - hostap_rx(skb2->dev, skb2, rx_stats); - } - - /* send management frames to the user space daemon for - * processing */ - local->apdevstats.rx_packets++; - local->apdevstats.rx_bytes += skb->len; - if (local->apdev == NULL) - return -1; - prism2_rx_80211(local->apdev, skb, rx_stats, PRISM2_RX_MGMT); - return 0; - } - - if (local->iw_mode == IW_MODE_MASTER) { - if (type != IEEE80211_FTYPE_MGMT && - type != IEEE80211_FTYPE_CTL) { - printk(KERN_DEBUG "%s: unknown management frame " - "(type=0x%02x, stype=0x%02x) dropped\n", - skb->dev->name, type >> 2, stype >> 4); - return -1; - } - - hostap_rx(skb->dev, skb, rx_stats); - return 0; - } else if (type == IEEE80211_FTYPE_MGMT && - (stype == IEEE80211_STYPE_BEACON || - stype == IEEE80211_STYPE_PROBE_RESP)) { - hostap_rx_sta_beacon(local, skb, stype); - return -1; - } else if (type == IEEE80211_FTYPE_MGMT && - (stype == IEEE80211_STYPE_ASSOC_RESP || - stype == IEEE80211_STYPE_REASSOC_RESP)) { - /* Ignore (Re)AssocResp silently since these are not currently - * needed but are still received when WPA/RSN mode is enabled. - */ - return -1; - } else { - printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: dropped unhandled" - " management frame in non-Host AP mode (type=%d:%d)\n", - skb->dev->name, type >> 2, stype >> 4); - return -1; - } -} - - -/* Called only as a tasklet (software IRQ) */ -static struct net_device *prism2_rx_get_wds(local_info_t *local, - u8 *addr) -{ - struct hostap_interface *iface = NULL; - struct list_head *ptr; - - read_lock_bh(&local->iface_lock); - list_for_each(ptr, &local->hostap_interfaces) { - iface = list_entry(ptr, struct hostap_interface, list); - if (iface->type == HOSTAP_INTERFACE_WDS && - memcmp(iface->u.wds.remote_addr, addr, ETH_ALEN) == 0) - break; - iface = NULL; - } - read_unlock_bh(&local->iface_lock); - - return iface ? iface->dev : NULL; -} - - -static int -hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr, u16 fc, - struct net_device **wds) -{ - /* FIX: is this really supposed to accept WDS frames only in Master - * mode? What about Repeater or Managed with WDS frames? */ - if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) != - (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS) && - (local->iw_mode != IW_MODE_MASTER || !(fc & IEEE80211_FCTL_TODS))) - return 0; /* not a WDS frame */ - - /* Possible WDS frame: either IEEE 802.11 compliant (if FromDS) - * or own non-standard frame with 4th address after payload */ - if (memcmp(hdr->addr1, local->dev->dev_addr, ETH_ALEN) != 0 && - (hdr->addr1[0] != 0xff || hdr->addr1[1] != 0xff || - hdr->addr1[2] != 0xff || hdr->addr1[3] != 0xff || - hdr->addr1[4] != 0xff || hdr->addr1[5] != 0xff)) { - /* RA (or BSSID) is not ours - drop */ - PDEBUG(DEBUG_EXTRA2, "%s: received WDS frame with " - "not own or broadcast %s=%pM\n", - local->dev->name, - fc & IEEE80211_FCTL_FROMDS ? "RA" : "BSSID", - hdr->addr1); - return -1; - } - - /* check if the frame came from a registered WDS connection */ - *wds = prism2_rx_get_wds(local, hdr->addr2); - if (*wds == NULL && fc & IEEE80211_FCTL_FROMDS && - (local->iw_mode != IW_MODE_INFRA || - !(local->wds_type & HOSTAP_WDS_AP_CLIENT) || - memcmp(hdr->addr2, local->bssid, ETH_ALEN) != 0)) { - /* require that WDS link has been registered with TA or the - * frame is from current AP when using 'AP client mode' */ - PDEBUG(DEBUG_EXTRA, "%s: received WDS[4 addr] frame " - "from unknown TA=%pM\n", - local->dev->name, hdr->addr2); - if (local->ap && local->ap->autom_ap_wds) - hostap_wds_link_oper(local, hdr->addr2, WDS_ADD); - return -1; - } - - if (*wds && !(fc & IEEE80211_FCTL_FROMDS) && local->ap && - hostap_is_sta_assoc(local->ap, hdr->addr2)) { - /* STA is actually associated with us even though it has a - * registered WDS link. Assume it is in 'AP client' mode. - * Since this is a 3-addr frame, assume it is not (bogus) WDS - * frame and process it like any normal ToDS frame from - * associated STA. */ - *wds = NULL; - } - - return 0; -} - - -static int hostap_is_eapol_frame(local_info_t *local, struct sk_buff *skb) -{ - struct net_device *dev = local->dev; - u16 fc, ethertype; - struct ieee80211_hdr *hdr; - u8 *pos; - - if (skb->len < 24) - return 0; - - hdr = (struct ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); - - /* check that the frame is unicast frame to us */ - if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == - IEEE80211_FCTL_TODS && - memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0 && - memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) { - /* ToDS frame with own addr BSSID and DA */ - } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == - IEEE80211_FCTL_FROMDS && - memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { - /* FromDS frame with own addr as DA */ - } else - return 0; - - if (skb->len < 24 + 8) - return 0; - - /* check for port access entity Ethernet type */ - pos = skb->data + 24; - ethertype = (pos[6] << 8) | pos[7]; - if (ethertype == ETH_P_PAE) - return 1; - - return 0; -} - - -/* Called only as a tasklet (software IRQ) */ -static int -hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb, - struct lib80211_crypt_data *crypt) -{ - struct ieee80211_hdr *hdr; - int res, hdrlen; - - if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) - return 0; - - hdr = (struct ieee80211_hdr *) skb->data; - hdrlen = hostap_80211_get_hdrlen(hdr->frame_control); - - if (local->tkip_countermeasures && - strcmp(crypt->ops->name, "TKIP") == 0) { - if (net_ratelimit()) { - printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " - "received packet from %pM\n", - local->dev->name, hdr->addr2); - } - return -1; - } - - atomic_inc(&crypt->refcnt); - res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); - atomic_dec(&crypt->refcnt); - if (res < 0) { - printk(KERN_DEBUG "%s: decryption failed (SA=%pM) res=%d\n", - local->dev->name, hdr->addr2, res); - local->comm_tallies.rx_discards_wep_undecryptable++; - return -1; - } - - return res; -} - - -/* Called only as a tasklet (software IRQ) */ -static int -hostap_rx_frame_decrypt_msdu(local_info_t *local, struct sk_buff *skb, - int keyidx, struct lib80211_crypt_data *crypt) -{ - struct ieee80211_hdr *hdr; - int res, hdrlen; - - if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) - return 0; - - hdr = (struct ieee80211_hdr *) skb->data; - hdrlen = hostap_80211_get_hdrlen(hdr->frame_control); - - atomic_inc(&crypt->refcnt); - res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); - atomic_dec(&crypt->refcnt); - if (res < 0) { - printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" - " (SA=%pM keyidx=%d)\n", - local->dev->name, hdr->addr2, keyidx); - return -1; - } - - return 0; -} - - -/* All received frames are sent to this function. @skb contains the frame in - * IEEE 802.11 format, i.e., in the format it was sent over air. - * This function is called only as a tasklet (software IRQ). */ -void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats) -{ - struct hostap_interface *iface; - local_info_t *local; - struct ieee80211_hdr *hdr; - size_t hdrlen; - u16 fc, type, stype, sc; - struct net_device *wds = NULL; - unsigned int frag; - u8 *payload; - struct sk_buff *skb2 = NULL; - u16 ethertype; - int frame_authorized = 0; - int from_assoc_ap = 0; - u8 dst[ETH_ALEN]; - u8 src[ETH_ALEN]; - struct lib80211_crypt_data *crypt = NULL; - void *sta = NULL; - int keyidx = 0; - - iface = netdev_priv(dev); - local = iface->local; - iface->stats.rx_packets++; - iface->stats.rx_bytes += skb->len; - - /* dev is the master radio device; change this to be the default - * virtual interface (this may be changed to WDS device below) */ - dev = local->ddev; - iface = netdev_priv(dev); - - hdr = (struct ieee80211_hdr *) skb->data; - - if (skb->len < 10) - goto rx_dropped; - - fc = le16_to_cpu(hdr->frame_control); - type = fc & IEEE80211_FCTL_FTYPE; - stype = fc & IEEE80211_FCTL_STYPE; - sc = le16_to_cpu(hdr->seq_ctrl); - frag = sc & IEEE80211_SCTL_FRAG; - hdrlen = hostap_80211_get_hdrlen(hdr->frame_control); - - /* Put this code here so that we avoid duplicating it in all - * Rx paths. - Jean II */ -#ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ - /* If spy monitoring on */ - if (iface->spy_data.spy_number > 0) { - struct iw_quality wstats; - wstats.level = rx_stats->signal; - wstats.noise = rx_stats->noise; - wstats.updated = IW_QUAL_LEVEL_UPDATED | IW_QUAL_NOISE_UPDATED - | IW_QUAL_QUAL_INVALID | IW_QUAL_DBM; - /* Update spy records */ - wireless_spy_update(dev, hdr->addr2, &wstats); - } -#endif /* IW_WIRELESS_SPY */ - hostap_update_rx_stats(local->ap, hdr, rx_stats); - - if (local->iw_mode == IW_MODE_MONITOR) { - monitor_rx(dev, skb, rx_stats); - return; - } - - if (local->host_decrypt) { - int idx = 0; - if (skb->len >= hdrlen + 3) - idx = skb->data[hdrlen + 3] >> 6; - crypt = local->crypt_info.crypt[idx]; - sta = NULL; - - /* Use station specific key to override default keys if the - * receiver address is a unicast address ("individual RA"). If - * bcrx_sta_key parameter is set, station specific key is used - * even with broad/multicast targets (this is against IEEE - * 802.11, but makes it easier to use different keys with - * stations that do not support WEP key mapping). */ - - if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key) - (void) hostap_handle_sta_crypto(local, hdr, &crypt, - &sta); - - /* allow NULL decrypt to indicate an station specific override - * for default encryption */ - if (crypt && (crypt->ops == NULL || - crypt->ops->decrypt_mpdu == NULL)) - crypt = NULL; - - if (!crypt && (fc & IEEE80211_FCTL_PROTECTED)) { -#if 0 - /* This seems to be triggered by some (multicast?) - * frames from other than current BSS, so just drop the - * frames silently instead of filling system log with - * these reports. */ - printk(KERN_DEBUG "%s: WEP decryption failed (not set)" - " (SA=%pM)\n", - local->dev->name, hdr->addr2); -#endif - local->comm_tallies.rx_discards_wep_undecryptable++; - goto rx_dropped; - } - } - - if (type != IEEE80211_FTYPE_DATA) { - if (type == IEEE80211_FTYPE_MGMT && - stype == IEEE80211_STYPE_AUTH && - fc & IEEE80211_FCTL_PROTECTED && local->host_decrypt && - (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) - { - printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " - "from %pM\n", dev->name, hdr->addr2); - /* TODO: could inform hostapd about this so that it - * could send auth failure report */ - goto rx_dropped; - } - - if (hostap_rx_frame_mgmt(local, skb, rx_stats, type, stype)) - goto rx_dropped; - else - goto rx_exit; - } - - /* Data frame - extract src/dst addresses */ - if (skb->len < IEEE80211_DATA_HDR3_LEN) - goto rx_dropped; - - switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { - case IEEE80211_FCTL_FROMDS: - memcpy(dst, hdr->addr1, ETH_ALEN); - memcpy(src, hdr->addr3, ETH_ALEN); - break; - case IEEE80211_FCTL_TODS: - memcpy(dst, hdr->addr3, ETH_ALEN); - memcpy(src, hdr->addr2, ETH_ALEN); - break; - case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: - if (skb->len < IEEE80211_DATA_HDR4_LEN) - goto rx_dropped; - memcpy(dst, hdr->addr3, ETH_ALEN); - memcpy(src, hdr->addr4, ETH_ALEN); - break; - case 0: - memcpy(dst, hdr->addr1, ETH_ALEN); - memcpy(src, hdr->addr2, ETH_ALEN); - break; - } - - if (hostap_rx_frame_wds(local, hdr, fc, &wds)) - goto rx_dropped; - if (wds) - skb->dev = dev = wds; - - if (local->iw_mode == IW_MODE_MASTER && !wds && - (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == - IEEE80211_FCTL_FROMDS && - local->stadev && - memcmp(hdr->addr2, local->assoc_ap_addr, ETH_ALEN) == 0) { - /* Frame from BSSID of the AP for which we are a client */ - skb->dev = dev = local->stadev; - from_assoc_ap = 1; - } - - if ((local->iw_mode == IW_MODE_MASTER || - local->iw_mode == IW_MODE_REPEAT) && - !from_assoc_ap) { - switch (hostap_handle_sta_rx(local, dev, skb, rx_stats, - wds != NULL)) { - case AP_RX_CONTINUE_NOT_AUTHORIZED: - frame_authorized = 0; - break; - case AP_RX_CONTINUE: - frame_authorized = 1; - break; - case AP_RX_DROP: - goto rx_dropped; - case AP_RX_EXIT: - goto rx_exit; - } - } - - /* Nullfunc frames may have PS-bit set, so they must be passed to - * hostap_handle_sta_rx() before being dropped here. */ - if (stype != IEEE80211_STYPE_DATA && - stype != IEEE80211_STYPE_DATA_CFACK && - stype != IEEE80211_STYPE_DATA_CFPOLL && - stype != IEEE80211_STYPE_DATA_CFACKPOLL) { - if (stype != IEEE80211_STYPE_NULLFUNC) - printk(KERN_DEBUG "%s: RX: dropped data frame " - "with no data (type=0x%02x, subtype=0x%02x)\n", - dev->name, type >> 2, stype >> 4); - goto rx_dropped; - } - - /* skb: hdr + (possibly fragmented, possibly encrypted) payload */ - - if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && - (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) - goto rx_dropped; - hdr = (struct ieee80211_hdr *) skb->data; - - /* skb: hdr + (possibly fragmented) plaintext payload */ - - if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && - (frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) { - int flen; - struct sk_buff *frag_skb = - prism2_frag_cache_get(local, hdr); - if (!frag_skb) { - printk(KERN_DEBUG "%s: Rx cannot get skb from " - "fragment cache (morefrag=%d seq=%u frag=%u)\n", - dev->name, (fc & IEEE80211_FCTL_MOREFRAGS) != 0, - (sc & IEEE80211_SCTL_SEQ) >> 4, frag); - goto rx_dropped; - } - - flen = skb->len; - if (frag != 0) - flen -= hdrlen; - - if (frag_skb->tail + flen > frag_skb->end) { - printk(KERN_WARNING "%s: host decrypted and " - "reassembled frame did not fit skb\n", - dev->name); - prism2_frag_cache_invalidate(local, hdr); - goto rx_dropped; - } - - if (frag == 0) { - /* copy first fragment (including full headers) into - * beginning of the fragment cache skb */ - skb_copy_from_linear_data(skb, skb_put(frag_skb, flen), - flen); - } else { - /* append frame payload to the end of the fragment - * cache skb */ - skb_copy_from_linear_data_offset(skb, hdrlen, - skb_put(frag_skb, - flen), flen); - } - dev_kfree_skb(skb); - skb = NULL; - - if (fc & IEEE80211_FCTL_MOREFRAGS) { - /* more fragments expected - leave the skb in fragment - * cache for now; it will be delivered to upper layers - * after all fragments have been received */ - goto rx_exit; - } - - /* this was the last fragment and the frame will be - * delivered, so remove skb from fragment cache */ - skb = frag_skb; - hdr = (struct ieee80211_hdr *) skb->data; - prism2_frag_cache_invalidate(local, hdr); - } - - /* skb: hdr + (possible reassembled) full MSDU payload; possibly still - * encrypted/authenticated */ - - if (local->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && - hostap_rx_frame_decrypt_msdu(local, skb, keyidx, crypt)) - goto rx_dropped; - - hdr = (struct ieee80211_hdr *) skb->data; - if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !local->open_wep) { - if (local->ieee_802_1x && - hostap_is_eapol_frame(local, skb)) { - /* pass unencrypted EAPOL frames even if encryption is - * configured */ - PDEBUG(DEBUG_EXTRA2, "%s: RX: IEEE 802.1X - passing " - "unencrypted EAPOL frame\n", local->dev->name); - } else { - printk(KERN_DEBUG "%s: encryption configured, but RX " - "frame not encrypted (SA=%pM)\n", - local->dev->name, hdr->addr2); - goto rx_dropped; - } - } - - if (local->drop_unencrypted && !(fc & IEEE80211_FCTL_PROTECTED) && - !hostap_is_eapol_frame(local, skb)) { - if (net_ratelimit()) { - printk(KERN_DEBUG "%s: dropped unencrypted RX data " - "frame from %pM (drop_unencrypted=1)\n", - dev->name, hdr->addr2); - } - goto rx_dropped; - } - - /* skb: hdr + (possible reassembled) full plaintext payload */ - - payload = skb->data + hdrlen; - ethertype = (payload[6] << 8) | payload[7]; - - /* If IEEE 802.1X is used, check whether the port is authorized to send - * the received frame. */ - if (local->ieee_802_1x && local->iw_mode == IW_MODE_MASTER) { - if (ethertype == ETH_P_PAE) { - PDEBUG(DEBUG_EXTRA2, "%s: RX: IEEE 802.1X frame\n", - dev->name); - if (local->hostapd && local->apdev) { - /* Send IEEE 802.1X frames to the user - * space daemon for processing */ - prism2_rx_80211(local->apdev, skb, rx_stats, - PRISM2_RX_MGMT); - local->apdevstats.rx_packets++; - local->apdevstats.rx_bytes += skb->len; - goto rx_exit; - } - } else if (!frame_authorized) { - printk(KERN_DEBUG "%s: dropped frame from " - "unauthorized port (IEEE 802.1X): " - "ethertype=0x%04x\n", - dev->name, ethertype); - goto rx_dropped; - } - } - - /* convert hdr + possible LLC headers into Ethernet header */ - if (skb->len - hdrlen >= 8 && - ((memcmp(payload, rfc1042_header, 6) == 0 && - ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || - memcmp(payload, bridge_tunnel_header, 6) == 0)) { - /* remove RFC1042 or Bridge-Tunnel encapsulation and - * replace EtherType */ - skb_pull(skb, hdrlen + 6); - memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN); - memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); - } else { - __be16 len; - /* Leave Ethernet header part of hdr and full payload */ - skb_pull(skb, hdrlen); - len = htons(skb->len); - memcpy(skb_push(skb, 2), &len, 2); - memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN); - memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); - } - - if (wds && ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == - IEEE80211_FCTL_TODS) && - skb->len >= ETH_HLEN + ETH_ALEN) { - /* Non-standard frame: get addr4 from its bogus location after - * the payload */ - skb_copy_from_linear_data_offset(skb, skb->len - ETH_ALEN, - skb->data + ETH_ALEN, - ETH_ALEN); - skb_trim(skb, skb->len - ETH_ALEN); - } - - dev->stats.rx_packets++; - dev->stats.rx_bytes += skb->len; - - if (local->iw_mode == IW_MODE_MASTER && !wds && - local->ap->bridge_packets) { - if (dst[0] & 0x01) { - /* copy multicast frame both to the higher layers and - * to the wireless media */ - local->ap->bridged_multicast++; - skb2 = skb_clone(skb, GFP_ATOMIC); - if (skb2 == NULL) - printk(KERN_DEBUG "%s: skb_clone failed for " - "multicast frame\n", dev->name); - } else if (hostap_is_sta_authorized(local->ap, dst)) { - /* send frame directly to the associated STA using - * wireless media and not passing to higher layers */ - local->ap->bridged_unicast++; - skb2 = skb; - skb = NULL; - } - } - - if (skb2 != NULL) { - /* send to wireless media */ - skb2->dev = dev; - skb2->protocol = cpu_to_be16(ETH_P_802_3); - skb_reset_mac_header(skb2); - skb_reset_network_header(skb2); - /* skb2->network_header += ETH_HLEN; */ - dev_queue_xmit(skb2); - } - - if (skb) { - skb->protocol = eth_type_trans(skb, dev); - memset(skb->cb, 0, sizeof(skb->cb)); - netif_rx(skb); - } - - rx_exit: - if (sta) - hostap_handle_sta_release(sta); - return; - - rx_dropped: - dev_kfree_skb(skb); - - dev->stats.rx_dropped++; - goto rx_exit; -} - - -EXPORT_SYMBOL(hostap_80211_rx); diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c deleted file mode 100644 index 344a981a052e..000000000000 --- a/drivers/net/wireless/hostap/hostap_80211_tx.c +++ /dev/null @@ -1,553 +0,0 @@ -#include -#include - -#include "hostap_80211.h" -#include "hostap_common.h" -#include "hostap_wlan.h" -#include "hostap.h" -#include "hostap_ap.h" - -/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ -/* Ethernet-II snap header (RFC1042 for most EtherTypes) */ -static unsigned char rfc1042_header[] = -{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; -/* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ -static unsigned char bridge_tunnel_header[] = -{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; -/* No encapsulation header if EtherType < 0x600 (=length) */ - -void hostap_dump_tx_80211(const char *name, struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr; - u16 fc; - - hdr = (struct ieee80211_hdr *) skb->data; - - printk(KERN_DEBUG "%s: TX len=%d jiffies=%ld\n", - name, skb->len, jiffies); - - if (skb->len < 2) - return; - - fc = le16_to_cpu(hdr->frame_control); - printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s", - fc, (fc & IEEE80211_FCTL_FTYPE) >> 2, - (fc & IEEE80211_FCTL_STYPE) >> 4, - fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", - fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); - - if (skb->len < IEEE80211_DATA_HDR3_LEN) { - printk("\n"); - return; - } - - printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id), - le16_to_cpu(hdr->seq_ctrl)); - - printk(KERN_DEBUG " A1=%pM", hdr->addr1); - printk(" A2=%pM", hdr->addr2); - printk(" A3=%pM", hdr->addr3); - if (skb->len >= 30) - printk(" A4=%pM", hdr->addr4); - printk("\n"); -} - - -/* hard_start_xmit function for data interfaces (wlan#, wlan#wds#, wlan#sta) - * Convert Ethernet header into a suitable IEEE 802.11 header depending on - * device configuration. */ -netdev_tx_t hostap_data_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - int need_headroom, need_tailroom = 0; - struct ieee80211_hdr hdr; - u16 fc, ethertype = 0; - enum { - WDS_NO = 0, WDS_OWN_FRAME, WDS_COMPLIANT_FRAME - } use_wds = WDS_NO; - u8 *encaps_data; - int hdr_len, encaps_len, skip_header_bytes; - int to_assoc_ap = 0; - struct hostap_skb_tx_data *meta; - - iface = netdev_priv(dev); - local = iface->local; - - if (skb->len < ETH_HLEN) { - printk(KERN_DEBUG "%s: hostap_data_start_xmit: short skb " - "(len=%d)\n", dev->name, skb->len); - kfree_skb(skb); - return NETDEV_TX_OK; - } - - if (local->ddev != dev) { - use_wds = (local->iw_mode == IW_MODE_MASTER && - !(local->wds_type & HOSTAP_WDS_STANDARD_FRAME)) ? - WDS_OWN_FRAME : WDS_COMPLIANT_FRAME; - if (dev == local->stadev) { - to_assoc_ap = 1; - use_wds = WDS_NO; - } else if (dev == local->apdev) { - printk(KERN_DEBUG "%s: prism2_tx: trying to use " - "AP device with Ethernet net dev\n", dev->name); - kfree_skb(skb); - return NETDEV_TX_OK; - } - } else { - if (local->iw_mode == IW_MODE_REPEAT) { - printk(KERN_DEBUG "%s: prism2_tx: trying to use " - "non-WDS link in Repeater mode\n", dev->name); - kfree_skb(skb); - return NETDEV_TX_OK; - } else if (local->iw_mode == IW_MODE_INFRA && - (local->wds_type & HOSTAP_WDS_AP_CLIENT) && - memcmp(skb->data + ETH_ALEN, dev->dev_addr, - ETH_ALEN) != 0) { - /* AP client mode: send frames with foreign src addr - * using 4-addr WDS frames */ - use_wds = WDS_COMPLIANT_FRAME; - } - } - - /* Incoming skb->data: dst_addr[6], src_addr[6], proto[2], payload - * ==> - * Prism2 TX frame with 802.11 header: - * txdesc (address order depending on used mode; includes dst_addr and - * src_addr), possible encapsulation (RFC1042/Bridge-Tunnel; - * proto[2], payload {, possible addr4[6]} */ - - ethertype = (skb->data[12] << 8) | skb->data[13]; - - memset(&hdr, 0, sizeof(hdr)); - - /* Length of data after IEEE 802.11 header */ - encaps_data = NULL; - encaps_len = 0; - skip_header_bytes = ETH_HLEN; - if (ethertype == ETH_P_AARP || ethertype == ETH_P_IPX) { - encaps_data = bridge_tunnel_header; - encaps_len = sizeof(bridge_tunnel_header); - skip_header_bytes -= 2; - } else if (ethertype >= 0x600) { - encaps_data = rfc1042_header; - encaps_len = sizeof(rfc1042_header); - skip_header_bytes -= 2; - } - - fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA; - hdr_len = IEEE80211_DATA_HDR3_LEN; - - if (use_wds != WDS_NO) { - /* Note! Prism2 station firmware has problems with sending real - * 802.11 frames with four addresses; until these problems can - * be fixed or worked around, 4-addr frames needed for WDS are - * using incompatible format: FromDS flag is not set and the - * fourth address is added after the frame payload; it is - * assumed, that the receiving station knows how to handle this - * frame format */ - - if (use_wds == WDS_COMPLIANT_FRAME) { - fc |= IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS; - /* From&To DS: Addr1 = RA, Addr2 = TA, Addr3 = DA, - * Addr4 = SA */ - skb_copy_from_linear_data_offset(skb, ETH_ALEN, - &hdr.addr4, ETH_ALEN); - hdr_len += ETH_ALEN; - } else { - /* bogus 4-addr format to workaround Prism2 station - * f/w bug */ - fc |= IEEE80211_FCTL_TODS; - /* From DS: Addr1 = DA (used as RA), - * Addr2 = BSSID (used as TA), Addr3 = SA (used as DA), - */ - - /* SA from skb->data + ETH_ALEN will be added after - * frame payload; use hdr.addr4 as a temporary buffer - */ - skb_copy_from_linear_data_offset(skb, ETH_ALEN, - &hdr.addr4, ETH_ALEN); - need_tailroom += ETH_ALEN; - } - - /* send broadcast and multicast frames to broadcast RA, if - * configured; otherwise, use unicast RA of the WDS link */ - if ((local->wds_type & HOSTAP_WDS_BROADCAST_RA) && - skb->data[0] & 0x01) - memset(&hdr.addr1, 0xff, ETH_ALEN); - else if (iface->type == HOSTAP_INTERFACE_WDS) - memcpy(&hdr.addr1, iface->u.wds.remote_addr, - ETH_ALEN); - else - memcpy(&hdr.addr1, local->bssid, ETH_ALEN); - memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN); - skb_copy_from_linear_data(skb, &hdr.addr3, ETH_ALEN); - } else if (local->iw_mode == IW_MODE_MASTER && !to_assoc_ap) { - fc |= IEEE80211_FCTL_FROMDS; - /* From DS: Addr1 = DA, Addr2 = BSSID, Addr3 = SA */ - skb_copy_from_linear_data(skb, &hdr.addr1, ETH_ALEN); - memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN); - skb_copy_from_linear_data_offset(skb, ETH_ALEN, &hdr.addr3, - ETH_ALEN); - } else if (local->iw_mode == IW_MODE_INFRA || to_assoc_ap) { - fc |= IEEE80211_FCTL_TODS; - /* To DS: Addr1 = BSSID, Addr2 = SA, Addr3 = DA */ - memcpy(&hdr.addr1, to_assoc_ap ? - local->assoc_ap_addr : local->bssid, ETH_ALEN); - skb_copy_from_linear_data_offset(skb, ETH_ALEN, &hdr.addr2, - ETH_ALEN); - skb_copy_from_linear_data(skb, &hdr.addr3, ETH_ALEN); - } else if (local->iw_mode == IW_MODE_ADHOC) { - /* not From/To DS: Addr1 = DA, Addr2 = SA, Addr3 = BSSID */ - skb_copy_from_linear_data(skb, &hdr.addr1, ETH_ALEN); - skb_copy_from_linear_data_offset(skb, ETH_ALEN, &hdr.addr2, - ETH_ALEN); - memcpy(&hdr.addr3, local->bssid, ETH_ALEN); - } - - hdr.frame_control = cpu_to_le16(fc); - - skb_pull(skb, skip_header_bytes); - need_headroom = local->func->need_tx_headroom + hdr_len + encaps_len; - if (skb_tailroom(skb) < need_tailroom) { - skb = skb_unshare(skb, GFP_ATOMIC); - if (skb == NULL) { - iface->stats.tx_dropped++; - return NETDEV_TX_OK; - } - if (pskb_expand_head(skb, need_headroom, need_tailroom, - GFP_ATOMIC)) { - kfree_skb(skb); - iface->stats.tx_dropped++; - return NETDEV_TX_OK; - } - } else if (skb_headroom(skb) < need_headroom) { - struct sk_buff *tmp = skb; - skb = skb_realloc_headroom(skb, need_headroom); - kfree_skb(tmp); - if (skb == NULL) { - iface->stats.tx_dropped++; - return NETDEV_TX_OK; - } - } else { - skb = skb_unshare(skb, GFP_ATOMIC); - if (skb == NULL) { - iface->stats.tx_dropped++; - return NETDEV_TX_OK; - } - } - - if (encaps_data) - memcpy(skb_push(skb, encaps_len), encaps_data, encaps_len); - memcpy(skb_push(skb, hdr_len), &hdr, hdr_len); - if (use_wds == WDS_OWN_FRAME) { - memcpy(skb_put(skb, ETH_ALEN), &hdr.addr4, ETH_ALEN); - } - - iface->stats.tx_packets++; - iface->stats.tx_bytes += skb->len; - - skb_reset_mac_header(skb); - meta = (struct hostap_skb_tx_data *) skb->cb; - memset(meta, 0, sizeof(*meta)); - meta->magic = HOSTAP_SKB_TX_DATA_MAGIC; - if (use_wds) - meta->flags |= HOSTAP_TX_FLAGS_WDS; - meta->ethertype = ethertype; - meta->iface = iface; - - /* Send IEEE 802.11 encapsulated frame using the master radio device */ - skb->dev = local->dev; - dev_queue_xmit(skb); - return NETDEV_TX_OK; -} - - -/* hard_start_xmit function for hostapd wlan#ap interfaces */ -netdev_tx_t hostap_mgmt_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - struct hostap_skb_tx_data *meta; - struct ieee80211_hdr *hdr; - u16 fc; - - iface = netdev_priv(dev); - local = iface->local; - - if (skb->len < 10) { - printk(KERN_DEBUG "%s: hostap_mgmt_start_xmit: short skb " - "(len=%d)\n", dev->name, skb->len); - kfree_skb(skb); - return NETDEV_TX_OK; - } - - iface->stats.tx_packets++; - iface->stats.tx_bytes += skb->len; - - meta = (struct hostap_skb_tx_data *) skb->cb; - memset(meta, 0, sizeof(*meta)); - meta->magic = HOSTAP_SKB_TX_DATA_MAGIC; - meta->iface = iface; - - if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) { - hdr = (struct ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); - if (ieee80211_is_data(hdr->frame_control) && - (fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_DATA) { - u8 *pos = &skb->data[IEEE80211_DATA_HDR3_LEN + - sizeof(rfc1042_header)]; - meta->ethertype = (pos[0] << 8) | pos[1]; - } - } - - /* Send IEEE 802.11 encapsulated frame using the master radio device */ - skb->dev = local->dev; - dev_queue_xmit(skb); - return NETDEV_TX_OK; -} - - -/* Called only from software IRQ */ -static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb, - struct lib80211_crypt_data *crypt) -{ - struct hostap_interface *iface; - local_info_t *local; - struct ieee80211_hdr *hdr; - int prefix_len, postfix_len, hdr_len, res; - - iface = netdev_priv(skb->dev); - local = iface->local; - - if (skb->len < IEEE80211_DATA_HDR3_LEN) { - kfree_skb(skb); - return NULL; - } - - if (local->tkip_countermeasures && - strcmp(crypt->ops->name, "TKIP") == 0) { - hdr = (struct ieee80211_hdr *) skb->data; - if (net_ratelimit()) { - printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " - "TX packet to %pM\n", - local->dev->name, hdr->addr1); - } - kfree_skb(skb); - return NULL; - } - - skb = skb_unshare(skb, GFP_ATOMIC); - if (skb == NULL) - return NULL; - - prefix_len = crypt->ops->extra_mpdu_prefix_len + - crypt->ops->extra_msdu_prefix_len; - postfix_len = crypt->ops->extra_mpdu_postfix_len + - crypt->ops->extra_msdu_postfix_len; - if ((skb_headroom(skb) < prefix_len || - skb_tailroom(skb) < postfix_len) && - pskb_expand_head(skb, prefix_len, postfix_len, GFP_ATOMIC)) { - kfree_skb(skb); - return NULL; - } - - hdr = (struct ieee80211_hdr *) skb->data; - hdr_len = hostap_80211_get_hdrlen(hdr->frame_control); - - /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so - * call both MSDU and MPDU encryption functions from here. */ - atomic_inc(&crypt->refcnt); - res = 0; - if (crypt->ops->encrypt_msdu) - res = crypt->ops->encrypt_msdu(skb, hdr_len, crypt->priv); - if (res == 0 && crypt->ops->encrypt_mpdu) - res = crypt->ops->encrypt_mpdu(skb, hdr_len, crypt->priv); - atomic_dec(&crypt->refcnt); - if (res < 0) { - kfree_skb(skb); - return NULL; - } - - return skb; -} - - -/* hard_start_xmit function for master radio interface wifi#. - * AP processing (TX rate control, power save buffering, etc.). - * Use hardware TX function to send the frame. */ -netdev_tx_t hostap_master_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - netdev_tx_t ret = NETDEV_TX_BUSY; - u16 fc; - struct hostap_tx_data tx; - ap_tx_ret tx_ret; - struct hostap_skb_tx_data *meta; - int no_encrypt = 0; - struct ieee80211_hdr *hdr; - - iface = netdev_priv(dev); - local = iface->local; - - tx.skb = skb; - tx.sta_ptr = NULL; - - meta = (struct hostap_skb_tx_data *) skb->cb; - if (meta->magic != HOSTAP_SKB_TX_DATA_MAGIC) { - printk(KERN_DEBUG "%s: invalid skb->cb magic (0x%08x, " - "expected 0x%08x)\n", - dev->name, meta->magic, HOSTAP_SKB_TX_DATA_MAGIC); - ret = NETDEV_TX_OK; - iface->stats.tx_dropped++; - goto fail; - } - - if (local->host_encrypt) { - /* Set crypt to default algorithm and key; will be replaced in - * AP code if STA has own alg/key */ - tx.crypt = local->crypt_info.crypt[local->crypt_info.tx_keyidx]; - tx.host_encrypt = 1; - } else { - tx.crypt = NULL; - tx.host_encrypt = 0; - } - - if (skb->len < 24) { - printk(KERN_DEBUG "%s: hostap_master_start_xmit: short skb " - "(len=%d)\n", dev->name, skb->len); - ret = NETDEV_TX_OK; - iface->stats.tx_dropped++; - goto fail; - } - - /* FIX (?): - * Wi-Fi 802.11b test plan suggests that AP should ignore power save - * bit in authentication and (re)association frames and assume tha - * STA remains awake for the response. */ - tx_ret = hostap_handle_sta_tx(local, &tx); - skb = tx.skb; - meta = (struct hostap_skb_tx_data *) skb->cb; - hdr = (struct ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); - switch (tx_ret) { - case AP_TX_CONTINUE: - break; - case AP_TX_CONTINUE_NOT_AUTHORIZED: - if (local->ieee_802_1x && - ieee80211_is_data(hdr->frame_control) && - meta->ethertype != ETH_P_PAE && - !(meta->flags & HOSTAP_TX_FLAGS_WDS)) { - printk(KERN_DEBUG "%s: dropped frame to unauthorized " - "port (IEEE 802.1X): ethertype=0x%04x\n", - dev->name, meta->ethertype); - hostap_dump_tx_80211(dev->name, skb); - - ret = NETDEV_TX_OK; /* drop packet */ - iface->stats.tx_dropped++; - goto fail; - } - break; - case AP_TX_DROP: - ret = NETDEV_TX_OK; /* drop packet */ - iface->stats.tx_dropped++; - goto fail; - case AP_TX_RETRY: - goto fail; - case AP_TX_BUFFERED: - /* do not free skb here, it will be freed when the - * buffered frame is sent/timed out */ - ret = NETDEV_TX_OK; - goto tx_exit; - } - - /* Request TX callback if protocol version is 2 in 802.11 header; - * this version 2 is a special case used between hostapd and kernel - * driver */ - if (((fc & IEEE80211_FCTL_VERS) == BIT(1)) && - local->ap && local->ap->tx_callback_idx && meta->tx_cb_idx == 0) { - meta->tx_cb_idx = local->ap->tx_callback_idx; - - /* remove special version from the frame header */ - fc &= ~IEEE80211_FCTL_VERS; - hdr->frame_control = cpu_to_le16(fc); - } - - if (!ieee80211_is_data(hdr->frame_control)) { - no_encrypt = 1; - tx.crypt = NULL; - } - - if (local->ieee_802_1x && meta->ethertype == ETH_P_PAE && tx.crypt && - !(fc & IEEE80211_FCTL_PROTECTED)) { - no_encrypt = 1; - PDEBUG(DEBUG_EXTRA2, "%s: TX: IEEE 802.1X - passing " - "unencrypted EAPOL frame\n", dev->name); - tx.crypt = NULL; /* no encryption for IEEE 802.1X frames */ - } - - if (tx.crypt && (!tx.crypt->ops || !tx.crypt->ops->encrypt_mpdu)) - tx.crypt = NULL; - else if ((tx.crypt || - local->crypt_info.crypt[local->crypt_info.tx_keyidx]) && - !no_encrypt) { - /* Add ISWEP flag both for firmware and host based encryption - */ - fc |= IEEE80211_FCTL_PROTECTED; - hdr->frame_control = cpu_to_le16(fc); - } else if (local->drop_unencrypted && - ieee80211_is_data(hdr->frame_control) && - meta->ethertype != ETH_P_PAE) { - if (net_ratelimit()) { - printk(KERN_DEBUG "%s: dropped unencrypted TX data " - "frame (drop_unencrypted=1)\n", dev->name); - } - iface->stats.tx_dropped++; - ret = NETDEV_TX_OK; - goto fail; - } - - if (tx.crypt) { - skb = hostap_tx_encrypt(skb, tx.crypt); - if (skb == NULL) { - printk(KERN_DEBUG "%s: TX - encryption failed\n", - dev->name); - ret = NETDEV_TX_OK; - goto fail; - } - meta = (struct hostap_skb_tx_data *) skb->cb; - if (meta->magic != HOSTAP_SKB_TX_DATA_MAGIC) { - printk(KERN_DEBUG "%s: invalid skb->cb magic (0x%08x, " - "expected 0x%08x) after hostap_tx_encrypt\n", - dev->name, meta->magic, - HOSTAP_SKB_TX_DATA_MAGIC); - ret = NETDEV_TX_OK; - iface->stats.tx_dropped++; - goto fail; - } - } - - if (local->func->tx == NULL || local->func->tx(skb, dev)) { - ret = NETDEV_TX_OK; - iface->stats.tx_dropped++; - } else { - ret = NETDEV_TX_OK; - iface->stats.tx_packets++; - iface->stats.tx_bytes += skb->len; - } - - fail: - if (ret == NETDEV_TX_OK && skb) - dev_kfree_skb(skb); - tx_exit: - if (tx.sta_ptr) - hostap_handle_sta_release(tx.sta_ptr); - return ret; -} - - -EXPORT_SYMBOL(hostap_master_start_xmit); diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c deleted file mode 100644 index d6033a8e5dea..000000000000 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ /dev/null @@ -1,3339 +0,0 @@ -/* - * Intersil Prism2 driver with Host AP (software access point) support - * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen - * - * Copyright (c) 2002-2005, Jouni Malinen - * - * This file is to be included into hostap.c when S/W AP functionality is - * compiled. - * - * AP: FIX: - * - if unicast Class 2 (assoc,reassoc,disassoc) frame received from - * unauthenticated STA, send deauth. frame (8802.11: 5.5) - * - if unicast Class 3 (data with to/from DS,deauth,pspoll) frame received - * from authenticated, but unassoc STA, send disassoc frame (8802.11: 5.5) - * - if unicast Class 3 received from unauthenticated STA, send deauth. frame - * (8802.11: 5.5) - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "hostap_wlan.h" -#include "hostap.h" -#include "hostap_ap.h" - -static int other_ap_policy[MAX_PARM_DEVICES] = { AP_OTHER_AP_SKIP_ALL, - DEF_INTS }; -module_param_array(other_ap_policy, int, NULL, 0444); -MODULE_PARM_DESC(other_ap_policy, "Other AP beacon monitoring policy (0-3)"); - -static int ap_max_inactivity[MAX_PARM_DEVICES] = { AP_MAX_INACTIVITY_SEC, - DEF_INTS }; -module_param_array(ap_max_inactivity, int, NULL, 0444); -MODULE_PARM_DESC(ap_max_inactivity, "AP timeout (in seconds) for station " - "inactivity"); - -static int ap_bridge_packets[MAX_PARM_DEVICES] = { 1, DEF_INTS }; -module_param_array(ap_bridge_packets, int, NULL, 0444); -MODULE_PARM_DESC(ap_bridge_packets, "Bridge packets directly between " - "stations"); - -static int autom_ap_wds[MAX_PARM_DEVICES] = { 0, DEF_INTS }; -module_param_array(autom_ap_wds, int, NULL, 0444); -MODULE_PARM_DESC(autom_ap_wds, "Add WDS connections to other APs " - "automatically"); - - -static struct sta_info* ap_get_sta(struct ap_data *ap, u8 *sta); -static void hostap_event_expired_sta(struct net_device *dev, - struct sta_info *sta); -static void handle_add_proc_queue(struct work_struct *work); - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT -static void handle_wds_oper_queue(struct work_struct *work); -static void prism2_send_mgmt(struct net_device *dev, - u16 type_subtype, char *body, - int body_len, u8 *addr, u16 tx_cb_idx); -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - -#ifndef PRISM2_NO_PROCFS_DEBUG -static int ap_debug_proc_show(struct seq_file *m, void *v) -{ - struct ap_data *ap = m->private; - - seq_printf(m, "BridgedUnicastFrames=%u\n", ap->bridged_unicast); - seq_printf(m, "BridgedMulticastFrames=%u\n", ap->bridged_multicast); - seq_printf(m, "max_inactivity=%u\n", ap->max_inactivity / HZ); - seq_printf(m, "bridge_packets=%u\n", ap->bridge_packets); - seq_printf(m, "nullfunc_ack=%u\n", ap->nullfunc_ack); - seq_printf(m, "autom_ap_wds=%u\n", ap->autom_ap_wds); - seq_printf(m, "auth_algs=%u\n", ap->local->auth_algs); - seq_printf(m, "tx_drop_nonassoc=%u\n", ap->tx_drop_nonassoc); - return 0; -} - -static int ap_debug_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, ap_debug_proc_show, PDE_DATA(inode)); -} - -static const struct file_operations ap_debug_proc_fops = { - .open = ap_debug_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; -#endif /* PRISM2_NO_PROCFS_DEBUG */ - - -static void ap_sta_hash_add(struct ap_data *ap, struct sta_info *sta) -{ - sta->hnext = ap->sta_hash[STA_HASH(sta->addr)]; - ap->sta_hash[STA_HASH(sta->addr)] = sta; -} - -static void ap_sta_hash_del(struct ap_data *ap, struct sta_info *sta) -{ - struct sta_info *s; - - s = ap->sta_hash[STA_HASH(sta->addr)]; - if (s == NULL) return; - if (memcmp(s->addr, sta->addr, ETH_ALEN) == 0) { - ap->sta_hash[STA_HASH(sta->addr)] = s->hnext; - return; - } - - while (s->hnext != NULL && memcmp(s->hnext->addr, sta->addr, ETH_ALEN) - != 0) - s = s->hnext; - if (s->hnext != NULL) - s->hnext = s->hnext->hnext; - else - printk("AP: could not remove STA %pM from hash table\n", - sta->addr); -} - -static void ap_free_sta(struct ap_data *ap, struct sta_info *sta) -{ - if (sta->ap && sta->local) - hostap_event_expired_sta(sta->local->dev, sta); - - if (ap->proc != NULL) { - char name[20]; - sprintf(name, "%pM", sta->addr); - remove_proc_entry(name, ap->proc); - } - - if (sta->crypt) { - sta->crypt->ops->deinit(sta->crypt->priv); - kfree(sta->crypt); - sta->crypt = NULL; - } - - skb_queue_purge(&sta->tx_buf); - - ap->num_sta--; -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - if (sta->aid > 0) - ap->sta_aid[sta->aid - 1] = NULL; - - if (!sta->ap && sta->u.sta.challenge) - kfree(sta->u.sta.challenge); - del_timer(&sta->timer); -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - kfree(sta); -} - - -static void hostap_set_tim(local_info_t *local, int aid, int set) -{ - if (local->func->set_tim) - local->func->set_tim(local->dev, aid, set); -} - - -static void hostap_event_new_sta(struct net_device *dev, struct sta_info *sta) -{ - union iwreq_data wrqu; - memset(&wrqu, 0, sizeof(wrqu)); - memcpy(wrqu.addr.sa_data, sta->addr, ETH_ALEN); - wrqu.addr.sa_family = ARPHRD_ETHER; - wireless_send_event(dev, IWEVREGISTERED, &wrqu, NULL); -} - - -static void hostap_event_expired_sta(struct net_device *dev, - struct sta_info *sta) -{ - union iwreq_data wrqu; - memset(&wrqu, 0, sizeof(wrqu)); - memcpy(wrqu.addr.sa_data, sta->addr, ETH_ALEN); - wrqu.addr.sa_family = ARPHRD_ETHER; - wireless_send_event(dev, IWEVEXPIRED, &wrqu, NULL); -} - - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - -static void ap_handle_timer(unsigned long data) -{ - struct sta_info *sta = (struct sta_info *) data; - local_info_t *local; - struct ap_data *ap; - unsigned long next_time = 0; - int was_assoc; - - if (sta == NULL || sta->local == NULL || sta->local->ap == NULL) { - PDEBUG(DEBUG_AP, "ap_handle_timer() called with NULL data\n"); - return; - } - - local = sta->local; - ap = local->ap; - was_assoc = sta->flags & WLAN_STA_ASSOC; - - if (atomic_read(&sta->users) != 0) - next_time = jiffies + HZ; - else if ((sta->flags & WLAN_STA_PERM) && !(sta->flags & WLAN_STA_AUTH)) - next_time = jiffies + ap->max_inactivity; - - if (time_before(jiffies, sta->last_rx + ap->max_inactivity)) { - /* station activity detected; reset timeout state */ - sta->timeout_next = STA_NULLFUNC; - next_time = sta->last_rx + ap->max_inactivity; - } else if (sta->timeout_next == STA_DISASSOC && - !(sta->flags & WLAN_STA_PENDING_POLL)) { - /* STA ACKed data nullfunc frame poll */ - sta->timeout_next = STA_NULLFUNC; - next_time = jiffies + ap->max_inactivity; - } - - if (next_time) { - sta->timer.expires = next_time; - add_timer(&sta->timer); - return; - } - - if (sta->ap) - sta->timeout_next = STA_DEAUTH; - - if (sta->timeout_next == STA_DEAUTH && !(sta->flags & WLAN_STA_PERM)) { - spin_lock(&ap->sta_table_lock); - ap_sta_hash_del(ap, sta); - list_del(&sta->list); - spin_unlock(&ap->sta_table_lock); - sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC); - } else if (sta->timeout_next == STA_DISASSOC) - sta->flags &= ~WLAN_STA_ASSOC; - - if (was_assoc && !(sta->flags & WLAN_STA_ASSOC) && !sta->ap) - hostap_event_expired_sta(local->dev, sta); - - if (sta->timeout_next == STA_DEAUTH && sta->aid > 0 && - !skb_queue_empty(&sta->tx_buf)) { - hostap_set_tim(local, sta->aid, 0); - sta->flags &= ~WLAN_STA_TIM; - } - - if (sta->ap) { - if (ap->autom_ap_wds) { - PDEBUG(DEBUG_AP, "%s: removing automatic WDS " - "connection to AP %pM\n", - local->dev->name, sta->addr); - hostap_wds_link_oper(local, sta->addr, WDS_DEL); - } - } else if (sta->timeout_next == STA_NULLFUNC) { - /* send data frame to poll STA and check whether this frame - * is ACKed */ - /* FIX: IEEE80211_STYPE_NULLFUNC would be more appropriate, but - * it is apparently not retried so TX Exc events are not - * received for it */ - sta->flags |= WLAN_STA_PENDING_POLL; - prism2_send_mgmt(local->dev, IEEE80211_FTYPE_DATA | - IEEE80211_STYPE_DATA, NULL, 0, - sta->addr, ap->tx_callback_poll); - } else { - int deauth = sta->timeout_next == STA_DEAUTH; - __le16 resp; - PDEBUG(DEBUG_AP, "%s: sending %s info to STA %pM" - "(last=%lu, jiffies=%lu)\n", - local->dev->name, - deauth ? "deauthentication" : "disassociation", - sta->addr, sta->last_rx, jiffies); - - resp = cpu_to_le16(deauth ? WLAN_REASON_PREV_AUTH_NOT_VALID : - WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); - prism2_send_mgmt(local->dev, IEEE80211_FTYPE_MGMT | - (deauth ? IEEE80211_STYPE_DEAUTH : - IEEE80211_STYPE_DISASSOC), - (char *) &resp, 2, sta->addr, 0); - } - - if (sta->timeout_next == STA_DEAUTH) { - if (sta->flags & WLAN_STA_PERM) { - PDEBUG(DEBUG_AP, "%s: STA %pM" - " would have been removed, " - "but it has 'perm' flag\n", - local->dev->name, sta->addr); - } else - ap_free_sta(ap, sta); - return; - } - - if (sta->timeout_next == STA_NULLFUNC) { - sta->timeout_next = STA_DISASSOC; - sta->timer.expires = jiffies + AP_DISASSOC_DELAY; - } else { - sta->timeout_next = STA_DEAUTH; - sta->timer.expires = jiffies + AP_DEAUTH_DELAY; - } - - add_timer(&sta->timer); -} - - -void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap, - int resend) -{ - u8 addr[ETH_ALEN]; - __le16 resp; - int i; - - PDEBUG(DEBUG_AP, "%s: Deauthenticate all stations\n", dev->name); - memset(addr, 0xff, ETH_ALEN); - - resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID); - - /* deauth message sent; try to resend it few times; the message is - * broadcast, so it may be delayed until next DTIM; there is not much - * else we can do at this point since the driver is going to be shut - * down */ - for (i = 0; i < 5; i++) { - prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_DEAUTH, - (char *) &resp, 2, addr, 0); - - if (!resend || ap->num_sta <= 0) - return; - - mdelay(50); - } -} - - -static int ap_control_proc_show(struct seq_file *m, void *v) -{ - struct ap_data *ap = m->private; - char *policy_txt; - struct mac_entry *entry; - - if (v == SEQ_START_TOKEN) { - switch (ap->mac_restrictions.policy) { - case MAC_POLICY_OPEN: - policy_txt = "open"; - break; - case MAC_POLICY_ALLOW: - policy_txt = "allow"; - break; - case MAC_POLICY_DENY: - policy_txt = "deny"; - break; - default: - policy_txt = "unknown"; - break; - } - seq_printf(m, "MAC policy: %s\n", policy_txt); - seq_printf(m, "MAC entries: %u\n", ap->mac_restrictions.entries); - seq_puts(m, "MAC list:\n"); - return 0; - } - - entry = v; - seq_printf(m, "%pM\n", entry->addr); - return 0; -} - -static void *ap_control_proc_start(struct seq_file *m, loff_t *_pos) -{ - struct ap_data *ap = m->private; - spin_lock_bh(&ap->mac_restrictions.lock); - return seq_list_start_head(&ap->mac_restrictions.mac_list, *_pos); -} - -static void *ap_control_proc_next(struct seq_file *m, void *v, loff_t *_pos) -{ - struct ap_data *ap = m->private; - return seq_list_next(v, &ap->mac_restrictions.mac_list, _pos); -} - -static void ap_control_proc_stop(struct seq_file *m, void *v) -{ - struct ap_data *ap = m->private; - spin_unlock_bh(&ap->mac_restrictions.lock); -} - -static const struct seq_operations ap_control_proc_seqops = { - .start = ap_control_proc_start, - .next = ap_control_proc_next, - .stop = ap_control_proc_stop, - .show = ap_control_proc_show, -}; - -static int ap_control_proc_open(struct inode *inode, struct file *file) -{ - int ret = seq_open(file, &ap_control_proc_seqops); - if (ret == 0) { - struct seq_file *m = file->private_data; - m->private = PDE_DATA(inode); - } - return ret; -} - -static const struct file_operations ap_control_proc_fops = { - .open = ap_control_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - - -int ap_control_add_mac(struct mac_restrictions *mac_restrictions, u8 *mac) -{ - struct mac_entry *entry; - - entry = kmalloc(sizeof(struct mac_entry), GFP_KERNEL); - if (entry == NULL) - return -ENOMEM; - - memcpy(entry->addr, mac, ETH_ALEN); - - spin_lock_bh(&mac_restrictions->lock); - list_add_tail(&entry->list, &mac_restrictions->mac_list); - mac_restrictions->entries++; - spin_unlock_bh(&mac_restrictions->lock); - - return 0; -} - - -int ap_control_del_mac(struct mac_restrictions *mac_restrictions, u8 *mac) -{ - struct list_head *ptr; - struct mac_entry *entry; - - spin_lock_bh(&mac_restrictions->lock); - for (ptr = mac_restrictions->mac_list.next; - ptr != &mac_restrictions->mac_list; ptr = ptr->next) { - entry = list_entry(ptr, struct mac_entry, list); - - if (memcmp(entry->addr, mac, ETH_ALEN) == 0) { - list_del(ptr); - kfree(entry); - mac_restrictions->entries--; - spin_unlock_bh(&mac_restrictions->lock); - return 0; - } - } - spin_unlock_bh(&mac_restrictions->lock); - return -1; -} - - -static int ap_control_mac_deny(struct mac_restrictions *mac_restrictions, - u8 *mac) -{ - struct mac_entry *entry; - int found = 0; - - if (mac_restrictions->policy == MAC_POLICY_OPEN) - return 0; - - spin_lock_bh(&mac_restrictions->lock); - list_for_each_entry(entry, &mac_restrictions->mac_list, list) { - if (memcmp(entry->addr, mac, ETH_ALEN) == 0) { - found = 1; - break; - } - } - spin_unlock_bh(&mac_restrictions->lock); - - if (mac_restrictions->policy == MAC_POLICY_ALLOW) - return !found; - else - return found; -} - - -void ap_control_flush_macs(struct mac_restrictions *mac_restrictions) -{ - struct list_head *ptr, *n; - struct mac_entry *entry; - - if (mac_restrictions->entries == 0) - return; - - spin_lock_bh(&mac_restrictions->lock); - for (ptr = mac_restrictions->mac_list.next, n = ptr->next; - ptr != &mac_restrictions->mac_list; - ptr = n, n = ptr->next) { - entry = list_entry(ptr, struct mac_entry, list); - list_del(ptr); - kfree(entry); - } - mac_restrictions->entries = 0; - spin_unlock_bh(&mac_restrictions->lock); -} - - -int ap_control_kick_mac(struct ap_data *ap, struct net_device *dev, u8 *mac) -{ - struct sta_info *sta; - __le16 resp; - - spin_lock_bh(&ap->sta_table_lock); - sta = ap_get_sta(ap, mac); - if (sta) { - ap_sta_hash_del(ap, sta); - list_del(&sta->list); - } - spin_unlock_bh(&ap->sta_table_lock); - - if (!sta) - return -EINVAL; - - resp = cpu_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID); - prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH, - (char *) &resp, 2, sta->addr, 0); - - if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap) - hostap_event_expired_sta(dev, sta); - - ap_free_sta(ap, sta); - - return 0; -} - -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - -void ap_control_kickall(struct ap_data *ap) -{ - struct list_head *ptr, *n; - struct sta_info *sta; - - spin_lock_bh(&ap->sta_table_lock); - for (ptr = ap->sta_list.next, n = ptr->next; ptr != &ap->sta_list; - ptr = n, n = ptr->next) { - sta = list_entry(ptr, struct sta_info, list); - ap_sta_hash_del(ap, sta); - list_del(&sta->list); - if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap && sta->local) - hostap_event_expired_sta(sta->local->dev, sta); - ap_free_sta(ap, sta); - } - spin_unlock_bh(&ap->sta_table_lock); -} - - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - -static int prism2_ap_proc_show(struct seq_file *m, void *v) -{ - struct sta_info *sta = v; - int i; - - if (v == SEQ_START_TOKEN) { - seq_printf(m, "# BSSID CHAN SIGNAL NOISE RATE SSID FLAGS\n"); - return 0; - } - - if (!sta->ap) - return 0; - - seq_printf(m, "%pM %d %d %d %d '", - sta->addr, - sta->u.ap.channel, sta->last_rx_signal, - sta->last_rx_silence, sta->last_rx_rate); - - for (i = 0; i < sta->u.ap.ssid_len; i++) { - if (sta->u.ap.ssid[i] >= 32 && sta->u.ap.ssid[i] < 127) - seq_putc(m, sta->u.ap.ssid[i]); - else - seq_printf(m, "<%02x>", sta->u.ap.ssid[i]); - } - - seq_putc(m, '\''); - if (sta->capability & WLAN_CAPABILITY_ESS) - seq_puts(m, " [ESS]"); - if (sta->capability & WLAN_CAPABILITY_IBSS) - seq_puts(m, " [IBSS]"); - if (sta->capability & WLAN_CAPABILITY_PRIVACY) - seq_puts(m, " [WEP]"); - seq_putc(m, '\n'); - return 0; -} - -static void *prism2_ap_proc_start(struct seq_file *m, loff_t *_pos) -{ - struct ap_data *ap = m->private; - spin_lock_bh(&ap->sta_table_lock); - return seq_list_start_head(&ap->sta_list, *_pos); -} - -static void *prism2_ap_proc_next(struct seq_file *m, void *v, loff_t *_pos) -{ - struct ap_data *ap = m->private; - return seq_list_next(v, &ap->sta_list, _pos); -} - -static void prism2_ap_proc_stop(struct seq_file *m, void *v) -{ - struct ap_data *ap = m->private; - spin_unlock_bh(&ap->sta_table_lock); -} - -static const struct seq_operations prism2_ap_proc_seqops = { - .start = prism2_ap_proc_start, - .next = prism2_ap_proc_next, - .stop = prism2_ap_proc_stop, - .show = prism2_ap_proc_show, -}; - -static int prism2_ap_proc_open(struct inode *inode, struct file *file) -{ - int ret = seq_open(file, &prism2_ap_proc_seqops); - if (ret == 0) { - struct seq_file *m = file->private_data; - m->private = PDE_DATA(inode); - } - return ret; -} - -static const struct file_operations prism2_ap_proc_fops = { - .open = prism2_ap_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - -void hostap_check_sta_fw_version(struct ap_data *ap, int sta_fw_ver) -{ - if (!ap) - return; - - if (sta_fw_ver == PRISM2_FW_VER(0,8,0)) { - PDEBUG(DEBUG_AP, "Using data::nullfunc ACK workaround - " - "firmware upgrade recommended\n"); - ap->nullfunc_ack = 1; - } else - ap->nullfunc_ack = 0; - - if (sta_fw_ver == PRISM2_FW_VER(1,4,2)) { - printk(KERN_WARNING "%s: Warning: secondary station firmware " - "version 1.4.2 does not seem to work in Host AP mode\n", - ap->local->dev->name); - } -} - - -/* Called only as a tasklet (software IRQ) */ -static void hostap_ap_tx_cb(struct sk_buff *skb, int ok, void *data) -{ - struct ap_data *ap = data; - struct ieee80211_hdr *hdr; - - if (!ap->local->hostapd || !ap->local->apdev) { - dev_kfree_skb(skb); - return; - } - - /* Pass the TX callback frame to the hostapd; use 802.11 header version - * 1 to indicate failure (no ACK) and 2 success (frame ACKed) */ - - hdr = (struct ieee80211_hdr *) skb->data; - hdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_VERS); - hdr->frame_control |= cpu_to_le16(ok ? BIT(1) : BIT(0)); - - skb->dev = ap->local->apdev; - skb_pull(skb, hostap_80211_get_hdrlen(hdr->frame_control)); - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = cpu_to_be16(ETH_P_802_2); - memset(skb->cb, 0, sizeof(skb->cb)); - netif_rx(skb); -} - - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT -/* Called only as a tasklet (software IRQ) */ -static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data) -{ - struct ap_data *ap = data; - struct net_device *dev = ap->local->dev; - struct ieee80211_hdr *hdr; - u16 auth_alg, auth_transaction, status; - __le16 *pos; - struct sta_info *sta = NULL; - char *txt = NULL; - - if (ap->local->hostapd) { - dev_kfree_skb(skb); - return; - } - - hdr = (struct ieee80211_hdr *) skb->data; - if (!ieee80211_is_auth(hdr->frame_control) || - skb->len < IEEE80211_MGMT_HDR_LEN + 6) { - printk(KERN_DEBUG "%s: hostap_ap_tx_cb_auth received invalid " - "frame\n", dev->name); - dev_kfree_skb(skb); - return; - } - - pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); - auth_alg = le16_to_cpu(*pos++); - auth_transaction = le16_to_cpu(*pos++); - status = le16_to_cpu(*pos++); - - if (!ok) { - txt = "frame was not ACKed"; - goto done; - } - - spin_lock(&ap->sta_table_lock); - sta = ap_get_sta(ap, hdr->addr1); - if (sta) - atomic_inc(&sta->users); - spin_unlock(&ap->sta_table_lock); - - if (!sta) { - txt = "STA not found"; - goto done; - } - - if (status == WLAN_STATUS_SUCCESS && - ((auth_alg == WLAN_AUTH_OPEN && auth_transaction == 2) || - (auth_alg == WLAN_AUTH_SHARED_KEY && auth_transaction == 4))) { - txt = "STA authenticated"; - sta->flags |= WLAN_STA_AUTH; - sta->last_auth = jiffies; - } else if (status != WLAN_STATUS_SUCCESS) - txt = "authentication failed"; - - done: - if (sta) - atomic_dec(&sta->users); - if (txt) { - PDEBUG(DEBUG_AP, "%s: %pM auth_cb - alg=%d " - "trans#=%d status=%d - %s\n", - dev->name, hdr->addr1, - auth_alg, auth_transaction, status, txt); - } - dev_kfree_skb(skb); -} - - -/* Called only as a tasklet (software IRQ) */ -static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data) -{ - struct ap_data *ap = data; - struct net_device *dev = ap->local->dev; - struct ieee80211_hdr *hdr; - u16 status; - __le16 *pos; - struct sta_info *sta = NULL; - char *txt = NULL; - - if (ap->local->hostapd) { - dev_kfree_skb(skb); - return; - } - - hdr = (struct ieee80211_hdr *) skb->data; - if ((!ieee80211_is_assoc_resp(hdr->frame_control) && - !ieee80211_is_reassoc_resp(hdr->frame_control)) || - skb->len < IEEE80211_MGMT_HDR_LEN + 4) { - printk(KERN_DEBUG "%s: hostap_ap_tx_cb_assoc received invalid " - "frame\n", dev->name); - dev_kfree_skb(skb); - return; - } - - if (!ok) { - txt = "frame was not ACKed"; - goto done; - } - - spin_lock(&ap->sta_table_lock); - sta = ap_get_sta(ap, hdr->addr1); - if (sta) - atomic_inc(&sta->users); - spin_unlock(&ap->sta_table_lock); - - if (!sta) { - txt = "STA not found"; - goto done; - } - - pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); - pos++; - status = le16_to_cpu(*pos++); - if (status == WLAN_STATUS_SUCCESS) { - if (!(sta->flags & WLAN_STA_ASSOC)) - hostap_event_new_sta(dev, sta); - txt = "STA associated"; - sta->flags |= WLAN_STA_ASSOC; - sta->last_assoc = jiffies; - } else - txt = "association failed"; - - done: - if (sta) - atomic_dec(&sta->users); - if (txt) { - PDEBUG(DEBUG_AP, "%s: %pM assoc_cb - %s\n", - dev->name, hdr->addr1, txt); - } - dev_kfree_skb(skb); -} - -/* Called only as a tasklet (software IRQ); TX callback for poll frames used - * in verifying whether the STA is still present. */ -static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data) -{ - struct ap_data *ap = data; - struct ieee80211_hdr *hdr; - struct sta_info *sta; - - if (skb->len < 24) - goto fail; - hdr = (struct ieee80211_hdr *) skb->data; - if (ok) { - spin_lock(&ap->sta_table_lock); - sta = ap_get_sta(ap, hdr->addr1); - if (sta) - sta->flags &= ~WLAN_STA_PENDING_POLL; - spin_unlock(&ap->sta_table_lock); - } else { - PDEBUG(DEBUG_AP, - "%s: STA %pM did not ACK activity poll frame\n", - ap->local->dev->name, hdr->addr1); - } - - fail: - dev_kfree_skb(skb); -} -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - -void hostap_init_data(local_info_t *local) -{ - struct ap_data *ap = local->ap; - - if (ap == NULL) { - printk(KERN_WARNING "hostap_init_data: ap == NULL\n"); - return; - } - memset(ap, 0, sizeof(struct ap_data)); - ap->local = local; - - ap->ap_policy = GET_INT_PARM(other_ap_policy, local->card_idx); - ap->bridge_packets = GET_INT_PARM(ap_bridge_packets, local->card_idx); - ap->max_inactivity = - GET_INT_PARM(ap_max_inactivity, local->card_idx) * HZ; - ap->autom_ap_wds = GET_INT_PARM(autom_ap_wds, local->card_idx); - - spin_lock_init(&ap->sta_table_lock); - INIT_LIST_HEAD(&ap->sta_list); - - /* Initialize task queue structure for AP management */ - INIT_WORK(&local->ap->add_sta_proc_queue, handle_add_proc_queue); - - ap->tx_callback_idx = - hostap_tx_callback_register(local, hostap_ap_tx_cb, ap); - if (ap->tx_callback_idx == 0) - printk(KERN_WARNING "%s: failed to register TX callback for " - "AP\n", local->dev->name); -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - INIT_WORK(&local->ap->wds_oper_queue, handle_wds_oper_queue); - - ap->tx_callback_auth = - hostap_tx_callback_register(local, hostap_ap_tx_cb_auth, ap); - ap->tx_callback_assoc = - hostap_tx_callback_register(local, hostap_ap_tx_cb_assoc, ap); - ap->tx_callback_poll = - hostap_tx_callback_register(local, hostap_ap_tx_cb_poll, ap); - if (ap->tx_callback_auth == 0 || ap->tx_callback_assoc == 0 || - ap->tx_callback_poll == 0) - printk(KERN_WARNING "%s: failed to register TX callback for " - "AP\n", local->dev->name); - - spin_lock_init(&ap->mac_restrictions.lock); - INIT_LIST_HEAD(&ap->mac_restrictions.mac_list); -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - ap->initialized = 1; -} - - -void hostap_init_ap_proc(local_info_t *local) -{ - struct ap_data *ap = local->ap; - - ap->proc = local->proc; - if (ap->proc == NULL) - return; - -#ifndef PRISM2_NO_PROCFS_DEBUG - proc_create_data("ap_debug", 0, ap->proc, &ap_debug_proc_fops, ap); -#endif /* PRISM2_NO_PROCFS_DEBUG */ - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - proc_create_data("ap_control", 0, ap->proc, &ap_control_proc_fops, ap); - proc_create_data("ap", 0, ap->proc, &prism2_ap_proc_fops, ap); -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - -} - - -void hostap_free_data(struct ap_data *ap) -{ - struct sta_info *n, *sta; - - if (ap == NULL || !ap->initialized) { - printk(KERN_DEBUG "hostap_free_data: ap has not yet been " - "initialized - skip resource freeing\n"); - return; - } - - flush_work(&ap->add_sta_proc_queue); - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - flush_work(&ap->wds_oper_queue); - if (ap->crypt) - ap->crypt->deinit(ap->crypt_priv); - ap->crypt = ap->crypt_priv = NULL; -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - list_for_each_entry_safe(sta, n, &ap->sta_list, list) { - ap_sta_hash_del(ap, sta); - list_del(&sta->list); - if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap && sta->local) - hostap_event_expired_sta(sta->local->dev, sta); - ap_free_sta(ap, sta); - } - -#ifndef PRISM2_NO_PROCFS_DEBUG - if (ap->proc != NULL) { - remove_proc_entry("ap_debug", ap->proc); - } -#endif /* PRISM2_NO_PROCFS_DEBUG */ - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - if (ap->proc != NULL) { - remove_proc_entry("ap", ap->proc); - remove_proc_entry("ap_control", ap->proc); - } - ap_control_flush_macs(&ap->mac_restrictions); -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - ap->initialized = 0; -} - - -/* caller should have mutex for AP STA list handling */ -static struct sta_info* ap_get_sta(struct ap_data *ap, u8 *sta) -{ - struct sta_info *s; - - s = ap->sta_hash[STA_HASH(sta)]; - while (s != NULL && memcmp(s->addr, sta, ETH_ALEN) != 0) - s = s->hnext; - return s; -} - - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - -/* Called from timer handler and from scheduled AP queue handlers */ -static void prism2_send_mgmt(struct net_device *dev, - u16 type_subtype, char *body, - int body_len, u8 *addr, u16 tx_cb_idx) -{ - struct hostap_interface *iface; - local_info_t *local; - struct ieee80211_hdr *hdr; - u16 fc; - struct sk_buff *skb; - struct hostap_skb_tx_data *meta; - int hdrlen; - - iface = netdev_priv(dev); - local = iface->local; - dev = local->dev; /* always use master radio device */ - iface = netdev_priv(dev); - - if (!(dev->flags & IFF_UP)) { - PDEBUG(DEBUG_AP, "%s: prism2_send_mgmt - device is not UP - " - "cannot send frame\n", dev->name); - return; - } - - skb = dev_alloc_skb(sizeof(*hdr) + body_len); - if (skb == NULL) { - PDEBUG(DEBUG_AP, "%s: prism2_send_mgmt failed to allocate " - "skb\n", dev->name); - return; - } - - fc = type_subtype; - hdrlen = hostap_80211_get_hdrlen(cpu_to_le16(type_subtype)); - hdr = (struct ieee80211_hdr *) skb_put(skb, hdrlen); - if (body) - memcpy(skb_put(skb, body_len), body, body_len); - - memset(hdr, 0, hdrlen); - - /* FIX: ctrl::ack sending used special HFA384X_TX_CTRL_802_11 - * tx_control instead of using local->tx_control */ - - - memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */ - if (ieee80211_is_data(hdr->frame_control)) { - fc |= IEEE80211_FCTL_FROMDS; - memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */ - memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */ - } else if (ieee80211_is_ctl(hdr->frame_control)) { - /* control:ACK does not have addr2 or addr3 */ - memset(hdr->addr2, 0, ETH_ALEN); - memset(hdr->addr3, 0, ETH_ALEN); - } else { - memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* SA */ - memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* BSSID */ - } - - hdr->frame_control = cpu_to_le16(fc); - - meta = (struct hostap_skb_tx_data *) skb->cb; - memset(meta, 0, sizeof(*meta)); - meta->magic = HOSTAP_SKB_TX_DATA_MAGIC; - meta->iface = iface; - meta->tx_cb_idx = tx_cb_idx; - - skb->dev = dev; - skb_reset_mac_header(skb); - skb_reset_network_header(skb); - dev_queue_xmit(skb); -} -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - -static int prism2_sta_proc_show(struct seq_file *m, void *v) -{ - struct sta_info *sta = m->private; - int i; - - /* FIX: possible race condition.. the STA data could have just expired, - * but proc entry was still here so that the read could have started; - * some locking should be done here.. */ - - seq_printf(m, - "%s=%pM\nusers=%d\naid=%d\n" - "flags=0x%04x%s%s%s%s%s%s%s\n" - "capability=0x%02x\nlisten_interval=%d\nsupported_rates=", - sta->ap ? "AP" : "STA", - sta->addr, atomic_read(&sta->users), sta->aid, - sta->flags, - sta->flags & WLAN_STA_AUTH ? " AUTH" : "", - sta->flags & WLAN_STA_ASSOC ? " ASSOC" : "", - sta->flags & WLAN_STA_PS ? " PS" : "", - sta->flags & WLAN_STA_TIM ? " TIM" : "", - sta->flags & WLAN_STA_PERM ? " PERM" : "", - sta->flags & WLAN_STA_AUTHORIZED ? " AUTHORIZED" : "", - sta->flags & WLAN_STA_PENDING_POLL ? " POLL" : "", - sta->capability, sta->listen_interval); - /* supported_rates: 500 kbit/s units with msb ignored */ - for (i = 0; i < sizeof(sta->supported_rates); i++) - if (sta->supported_rates[i] != 0) - seq_printf(m, "%d%sMbps ", - (sta->supported_rates[i] & 0x7f) / 2, - sta->supported_rates[i] & 1 ? ".5" : ""); - seq_printf(m, - "\njiffies=%lu\nlast_auth=%lu\nlast_assoc=%lu\n" - "last_rx=%lu\nlast_tx=%lu\nrx_packets=%lu\n" - "tx_packets=%lu\n" - "rx_bytes=%lu\ntx_bytes=%lu\nbuffer_count=%d\n" - "last_rx: silence=%d dBm signal=%d dBm rate=%d%s Mbps\n" - "tx_rate=%d\ntx[1M]=%d\ntx[2M]=%d\ntx[5.5M]=%d\n" - "tx[11M]=%d\n" - "rx[1M]=%d\nrx[2M]=%d\nrx[5.5M]=%d\nrx[11M]=%d\n", - jiffies, sta->last_auth, sta->last_assoc, sta->last_rx, - sta->last_tx, - sta->rx_packets, sta->tx_packets, sta->rx_bytes, - sta->tx_bytes, skb_queue_len(&sta->tx_buf), - sta->last_rx_silence, - sta->last_rx_signal, sta->last_rx_rate / 10, - sta->last_rx_rate % 10 ? ".5" : "", - sta->tx_rate, sta->tx_count[0], sta->tx_count[1], - sta->tx_count[2], sta->tx_count[3], sta->rx_count[0], - sta->rx_count[1], sta->rx_count[2], sta->rx_count[3]); - if (sta->crypt && sta->crypt->ops && sta->crypt->ops->print_stats) - sta->crypt->ops->print_stats(m, sta->crypt->priv); -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - if (sta->ap) { - if (sta->u.ap.channel >= 0) - seq_printf(m, "channel=%d\n", sta->u.ap.channel); - seq_puts(m, "ssid="); - for (i = 0; i < sta->u.ap.ssid_len; i++) { - if (sta->u.ap.ssid[i] >= 32 && sta->u.ap.ssid[i] < 127) - seq_putc(m, sta->u.ap.ssid[i]); - else - seq_printf(m, "<%02x>", sta->u.ap.ssid[i]); - } - seq_putc(m, '\n'); - } -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - return 0; -} - -static int prism2_sta_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, prism2_sta_proc_show, PDE_DATA(inode)); -} - -static const struct file_operations prism2_sta_proc_fops = { - .open = prism2_sta_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static void handle_add_proc_queue(struct work_struct *work) -{ - struct ap_data *ap = container_of(work, struct ap_data, - add_sta_proc_queue); - struct sta_info *sta; - char name[20]; - struct add_sta_proc_data *entry, *prev; - - entry = ap->add_sta_proc_entries; - ap->add_sta_proc_entries = NULL; - - while (entry) { - spin_lock_bh(&ap->sta_table_lock); - sta = ap_get_sta(ap, entry->addr); - if (sta) - atomic_inc(&sta->users); - spin_unlock_bh(&ap->sta_table_lock); - - if (sta) { - sprintf(name, "%pM", sta->addr); - sta->proc = proc_create_data( - name, 0, ap->proc, - &prism2_sta_proc_fops, sta); - - atomic_dec(&sta->users); - } - - prev = entry; - entry = entry->next; - kfree(prev); - } -} - - -static struct sta_info * ap_add_sta(struct ap_data *ap, u8 *addr) -{ - struct sta_info *sta; - - sta = kzalloc(sizeof(struct sta_info), GFP_ATOMIC); - if (sta == NULL) { - PDEBUG(DEBUG_AP, "AP: kmalloc failed\n"); - return NULL; - } - - /* initialize STA info data */ - sta->local = ap->local; - skb_queue_head_init(&sta->tx_buf); - memcpy(sta->addr, addr, ETH_ALEN); - - atomic_inc(&sta->users); - spin_lock_bh(&ap->sta_table_lock); - list_add(&sta->list, &ap->sta_list); - ap->num_sta++; - ap_sta_hash_add(ap, sta); - spin_unlock_bh(&ap->sta_table_lock); - - if (ap->proc) { - struct add_sta_proc_data *entry; - /* schedule a non-interrupt context process to add a procfs - * entry for the STA since procfs code use GFP_KERNEL */ - entry = kmalloc(sizeof(*entry), GFP_ATOMIC); - if (entry) { - memcpy(entry->addr, sta->addr, ETH_ALEN); - entry->next = ap->add_sta_proc_entries; - ap->add_sta_proc_entries = entry; - schedule_work(&ap->add_sta_proc_queue); - } else - printk(KERN_DEBUG "Failed to add STA proc data\n"); - } - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - init_timer(&sta->timer); - sta->timer.expires = jiffies + ap->max_inactivity; - sta->timer.data = (unsigned long) sta; - sta->timer.function = ap_handle_timer; - if (!ap->local->hostapd) - add_timer(&sta->timer); -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - return sta; -} - - -static int ap_tx_rate_ok(int rateidx, struct sta_info *sta, - local_info_t *local) -{ - if (rateidx > sta->tx_max_rate || - !(sta->tx_supp_rates & (1 << rateidx))) - return 0; - - if (local->tx_rate_control != 0 && - !(local->tx_rate_control & (1 << rateidx))) - return 0; - - return 1; -} - - -static void prism2_check_tx_rates(struct sta_info *sta) -{ - int i; - - sta->tx_supp_rates = 0; - for (i = 0; i < sizeof(sta->supported_rates); i++) { - if ((sta->supported_rates[i] & 0x7f) == 2) - sta->tx_supp_rates |= WLAN_RATE_1M; - if ((sta->supported_rates[i] & 0x7f) == 4) - sta->tx_supp_rates |= WLAN_RATE_2M; - if ((sta->supported_rates[i] & 0x7f) == 11) - sta->tx_supp_rates |= WLAN_RATE_5M5; - if ((sta->supported_rates[i] & 0x7f) == 22) - sta->tx_supp_rates |= WLAN_RATE_11M; - } - sta->tx_max_rate = sta->tx_rate = sta->tx_rate_idx = 0; - if (sta->tx_supp_rates & WLAN_RATE_1M) { - sta->tx_max_rate = 0; - if (ap_tx_rate_ok(0, sta, sta->local)) { - sta->tx_rate = 10; - sta->tx_rate_idx = 0; - } - } - if (sta->tx_supp_rates & WLAN_RATE_2M) { - sta->tx_max_rate = 1; - if (ap_tx_rate_ok(1, sta, sta->local)) { - sta->tx_rate = 20; - sta->tx_rate_idx = 1; - } - } - if (sta->tx_supp_rates & WLAN_RATE_5M5) { - sta->tx_max_rate = 2; - if (ap_tx_rate_ok(2, sta, sta->local)) { - sta->tx_rate = 55; - sta->tx_rate_idx = 2; - } - } - if (sta->tx_supp_rates & WLAN_RATE_11M) { - sta->tx_max_rate = 3; - if (ap_tx_rate_ok(3, sta, sta->local)) { - sta->tx_rate = 110; - sta->tx_rate_idx = 3; - } - } -} - - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - -static void ap_crypt_init(struct ap_data *ap) -{ - ap->crypt = lib80211_get_crypto_ops("WEP"); - - if (ap->crypt) { - if (ap->crypt->init) { - ap->crypt_priv = ap->crypt->init(0); - if (ap->crypt_priv == NULL) - ap->crypt = NULL; - else { - u8 key[WEP_KEY_LEN]; - get_random_bytes(key, WEP_KEY_LEN); - ap->crypt->set_key(key, WEP_KEY_LEN, NULL, - ap->crypt_priv); - } - } - } - - if (ap->crypt == NULL) { - printk(KERN_WARNING "AP could not initialize WEP: load module " - "lib80211_crypt_wep.ko\n"); - } -} - - -/* Generate challenge data for shared key authentication. IEEE 802.11 specifies - * that WEP algorithm is used for generating challenge. This should be unique, - * but otherwise there is not really need for randomness etc. Initialize WEP - * with pseudo random key and then use increasing IV to get unique challenge - * streams. - * - * Called only as a scheduled task for pending AP frames. - */ -static char * ap_auth_make_challenge(struct ap_data *ap) -{ - char *tmpbuf; - struct sk_buff *skb; - - if (ap->crypt == NULL) { - ap_crypt_init(ap); - if (ap->crypt == NULL) - return NULL; - } - - tmpbuf = kmalloc(WLAN_AUTH_CHALLENGE_LEN, GFP_ATOMIC); - if (tmpbuf == NULL) { - PDEBUG(DEBUG_AP, "AP: kmalloc failed for challenge\n"); - return NULL; - } - - skb = dev_alloc_skb(WLAN_AUTH_CHALLENGE_LEN + - ap->crypt->extra_mpdu_prefix_len + - ap->crypt->extra_mpdu_postfix_len); - if (skb == NULL) { - kfree(tmpbuf); - return NULL; - } - - skb_reserve(skb, ap->crypt->extra_mpdu_prefix_len); - memset(skb_put(skb, WLAN_AUTH_CHALLENGE_LEN), 0, - WLAN_AUTH_CHALLENGE_LEN); - if (ap->crypt->encrypt_mpdu(skb, 0, ap->crypt_priv)) { - dev_kfree_skb(skb); - kfree(tmpbuf); - return NULL; - } - - skb_copy_from_linear_data_offset(skb, ap->crypt->extra_mpdu_prefix_len, - tmpbuf, WLAN_AUTH_CHALLENGE_LEN); - dev_kfree_skb(skb); - - return tmpbuf; -} - - -/* Called only as a scheduled task for pending AP frames. */ -static void handle_authen(local_info_t *local, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats) -{ - struct net_device *dev = local->dev; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - size_t hdrlen; - struct ap_data *ap = local->ap; - char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL; - int len, olen; - u16 auth_alg, auth_transaction, status_code; - __le16 *pos; - u16 resp = WLAN_STATUS_SUCCESS; - struct sta_info *sta = NULL; - struct lib80211_crypt_data *crypt; - char *txt = ""; - - len = skb->len - IEEE80211_MGMT_HDR_LEN; - - hdrlen = hostap_80211_get_hdrlen(hdr->frame_control); - - if (len < 6) { - PDEBUG(DEBUG_AP, "%s: handle_authen - too short payload " - "(len=%d) from %pM\n", dev->name, len, hdr->addr2); - return; - } - - spin_lock_bh(&local->ap->sta_table_lock); - sta = ap_get_sta(local->ap, hdr->addr2); - if (sta) - atomic_inc(&sta->users); - spin_unlock_bh(&local->ap->sta_table_lock); - - if (sta && sta->crypt) - crypt = sta->crypt; - else { - int idx = 0; - if (skb->len >= hdrlen + 3) - idx = skb->data[hdrlen + 3] >> 6; - crypt = local->crypt_info.crypt[idx]; - } - - pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); - auth_alg = __le16_to_cpu(*pos); - pos++; - auth_transaction = __le16_to_cpu(*pos); - pos++; - status_code = __le16_to_cpu(*pos); - pos++; - - if (memcmp(dev->dev_addr, hdr->addr2, ETH_ALEN) == 0 || - ap_control_mac_deny(&ap->mac_restrictions, hdr->addr2)) { - txt = "authentication denied"; - resp = WLAN_STATUS_UNSPECIFIED_FAILURE; - goto fail; - } - - if (((local->auth_algs & PRISM2_AUTH_OPEN) && - auth_alg == WLAN_AUTH_OPEN) || - ((local->auth_algs & PRISM2_AUTH_SHARED_KEY) && - crypt && auth_alg == WLAN_AUTH_SHARED_KEY)) { - } else { - txt = "unsupported algorithm"; - resp = WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG; - goto fail; - } - - if (len >= 8) { - u8 *u = (u8 *) pos; - if (*u == WLAN_EID_CHALLENGE) { - if (*(u + 1) != WLAN_AUTH_CHALLENGE_LEN) { - txt = "invalid challenge len"; - resp = WLAN_STATUS_CHALLENGE_FAIL; - goto fail; - } - if (len - 8 < WLAN_AUTH_CHALLENGE_LEN) { - txt = "challenge underflow"; - resp = WLAN_STATUS_CHALLENGE_FAIL; - goto fail; - } - challenge = (char *) (u + 2); - } - } - - if (sta && sta->ap) { - if (time_after(jiffies, sta->u.ap.last_beacon + - (10 * sta->listen_interval * HZ) / 1024)) { - PDEBUG(DEBUG_AP, "%s: no beacons received for a while," - " assuming AP %pM is now STA\n", - dev->name, sta->addr); - sta->ap = 0; - sta->flags = 0; - sta->u.sta.challenge = NULL; - } else { - txt = "AP trying to authenticate?"; - resp = WLAN_STATUS_UNSPECIFIED_FAILURE; - goto fail; - } - } - - if ((auth_alg == WLAN_AUTH_OPEN && auth_transaction == 1) || - (auth_alg == WLAN_AUTH_SHARED_KEY && - (auth_transaction == 1 || - (auth_transaction == 3 && sta != NULL && - sta->u.sta.challenge != NULL)))) { - } else { - txt = "unknown authentication transaction number"; - resp = WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION; - goto fail; - } - - if (sta == NULL) { - txt = "new STA"; - - if (local->ap->num_sta >= MAX_STA_COUNT) { - /* FIX: might try to remove some old STAs first? */ - txt = "no more room for new STAs"; - resp = WLAN_STATUS_UNSPECIFIED_FAILURE; - goto fail; - } - - sta = ap_add_sta(local->ap, hdr->addr2); - if (sta == NULL) { - txt = "ap_add_sta failed"; - resp = WLAN_STATUS_UNSPECIFIED_FAILURE; - goto fail; - } - } - - switch (auth_alg) { - case WLAN_AUTH_OPEN: - txt = "authOK"; - /* IEEE 802.11 standard is not completely clear about - * whether STA is considered authenticated after - * authentication OK frame has been send or after it - * has been ACKed. In order to reduce interoperability - * issues, mark the STA authenticated before ACK. */ - sta->flags |= WLAN_STA_AUTH; - break; - - case WLAN_AUTH_SHARED_KEY: - if (auth_transaction == 1) { - if (sta->u.sta.challenge == NULL) { - sta->u.sta.challenge = - ap_auth_make_challenge(local->ap); - if (sta->u.sta.challenge == NULL) { - resp = WLAN_STATUS_UNSPECIFIED_FAILURE; - goto fail; - } - } - } else { - if (sta->u.sta.challenge == NULL || - challenge == NULL || - memcmp(sta->u.sta.challenge, challenge, - WLAN_AUTH_CHALLENGE_LEN) != 0 || - !ieee80211_has_protected(hdr->frame_control)) { - txt = "challenge response incorrect"; - resp = WLAN_STATUS_CHALLENGE_FAIL; - goto fail; - } - - txt = "challenge OK - authOK"; - /* IEEE 802.11 standard is not completely clear about - * whether STA is considered authenticated after - * authentication OK frame has been send or after it - * has been ACKed. In order to reduce interoperability - * issues, mark the STA authenticated before ACK. */ - sta->flags |= WLAN_STA_AUTH; - kfree(sta->u.sta.challenge); - sta->u.sta.challenge = NULL; - } - break; - } - - fail: - pos = (__le16 *) body; - *pos = cpu_to_le16(auth_alg); - pos++; - *pos = cpu_to_le16(auth_transaction + 1); - pos++; - *pos = cpu_to_le16(resp); /* status_code */ - pos++; - olen = 6; - - if (resp == WLAN_STATUS_SUCCESS && sta != NULL && - sta->u.sta.challenge != NULL && - auth_alg == WLAN_AUTH_SHARED_KEY && auth_transaction == 1) { - u8 *tmp = (u8 *) pos; - *tmp++ = WLAN_EID_CHALLENGE; - *tmp++ = WLAN_AUTH_CHALLENGE_LEN; - pos++; - memcpy(pos, sta->u.sta.challenge, WLAN_AUTH_CHALLENGE_LEN); - olen += 2 + WLAN_AUTH_CHALLENGE_LEN; - } - - prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH, - body, olen, hdr->addr2, ap->tx_callback_auth); - - if (sta) { - sta->last_rx = jiffies; - atomic_dec(&sta->users); - } - - if (resp) { - PDEBUG(DEBUG_AP, "%s: %pM auth (alg=%d " - "trans#=%d stat=%d len=%d fc=%04x) ==> %d (%s)\n", - dev->name, hdr->addr2, - auth_alg, auth_transaction, status_code, len, - le16_to_cpu(hdr->frame_control), resp, txt); - } -} - - -/* Called only as a scheduled task for pending AP frames. */ -static void handle_assoc(local_info_t *local, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats, int reassoc) -{ - struct net_device *dev = local->dev; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - char body[12], *p, *lpos; - int len, left; - __le16 *pos; - u16 resp = WLAN_STATUS_SUCCESS; - struct sta_info *sta = NULL; - int send_deauth = 0; - char *txt = ""; - u8 prev_ap[ETH_ALEN]; - - left = len = skb->len - IEEE80211_MGMT_HDR_LEN; - - if (len < (reassoc ? 10 : 4)) { - PDEBUG(DEBUG_AP, "%s: handle_assoc - too short payload " - "(len=%d, reassoc=%d) from %pM\n", - dev->name, len, reassoc, hdr->addr2); - return; - } - - spin_lock_bh(&local->ap->sta_table_lock); - sta = ap_get_sta(local->ap, hdr->addr2); - if (sta == NULL || (sta->flags & WLAN_STA_AUTH) == 0) { - spin_unlock_bh(&local->ap->sta_table_lock); - txt = "trying to associate before authentication"; - send_deauth = 1; - resp = WLAN_STATUS_UNSPECIFIED_FAILURE; - sta = NULL; /* do not decrement sta->users */ - goto fail; - } - atomic_inc(&sta->users); - spin_unlock_bh(&local->ap->sta_table_lock); - - pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN); - sta->capability = __le16_to_cpu(*pos); - pos++; left -= 2; - sta->listen_interval = __le16_to_cpu(*pos); - pos++; left -= 2; - - if (reassoc) { - memcpy(prev_ap, pos, ETH_ALEN); - pos++; pos++; pos++; left -= 6; - } else - memset(prev_ap, 0, ETH_ALEN); - - if (left >= 2) { - unsigned int ileft; - unsigned char *u = (unsigned char *) pos; - - if (*u == WLAN_EID_SSID) { - u++; left--; - ileft = *u; - u++; left--; - - if (ileft > left || ileft > MAX_SSID_LEN) { - txt = "SSID overflow"; - resp = WLAN_STATUS_UNSPECIFIED_FAILURE; - goto fail; - } - - if (ileft != strlen(local->essid) || - memcmp(local->essid, u, ileft) != 0) { - txt = "not our SSID"; - resp = WLAN_STATUS_ASSOC_DENIED_UNSPEC; - goto fail; - } - - u += ileft; - left -= ileft; - } - - if (left >= 2 && *u == WLAN_EID_SUPP_RATES) { - u++; left--; - ileft = *u; - u++; left--; - - if (ileft > left || ileft == 0 || - ileft > WLAN_SUPP_RATES_MAX) { - txt = "SUPP_RATES len error"; - resp = WLAN_STATUS_UNSPECIFIED_FAILURE; - goto fail; - } - - memset(sta->supported_rates, 0, - sizeof(sta->supported_rates)); - memcpy(sta->supported_rates, u, ileft); - prism2_check_tx_rates(sta); - - u += ileft; - left -= ileft; - } - - if (left > 0) { - PDEBUG(DEBUG_AP, "%s: assoc from %pM" - " with extra data (%d bytes) [", - dev->name, hdr->addr2, left); - while (left > 0) { - PDEBUG2(DEBUG_AP, "<%02x>", *u); - u++; left--; - } - PDEBUG2(DEBUG_AP, "]\n"); - } - } else { - txt = "frame underflow"; - resp = WLAN_STATUS_UNSPECIFIED_FAILURE; - goto fail; - } - - /* get a unique AID */ - if (sta->aid > 0) - txt = "OK, old AID"; - else { - spin_lock_bh(&local->ap->sta_table_lock); - for (sta->aid = 1; sta->aid <= MAX_AID_TABLE_SIZE; sta->aid++) - if (local->ap->sta_aid[sta->aid - 1] == NULL) - break; - if (sta->aid > MAX_AID_TABLE_SIZE) { - sta->aid = 0; - spin_unlock_bh(&local->ap->sta_table_lock); - resp = WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; - txt = "no room for more AIDs"; - } else { - local->ap->sta_aid[sta->aid - 1] = sta; - spin_unlock_bh(&local->ap->sta_table_lock); - txt = "OK, new AID"; - } - } - - fail: - pos = (__le16 *) body; - - if (send_deauth) { - *pos = cpu_to_le16(WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH); - pos++; - } else { - /* FIX: CF-Pollable and CF-PollReq should be set to match the - * values in beacons/probe responses */ - /* FIX: how about privacy and WEP? */ - /* capability */ - *pos = cpu_to_le16(WLAN_CAPABILITY_ESS); - pos++; - - /* status_code */ - *pos = cpu_to_le16(resp); - pos++; - - *pos = cpu_to_le16((sta && sta->aid > 0 ? sta->aid : 0) | - BIT(14) | BIT(15)); /* AID */ - pos++; - - /* Supported rates (Information element) */ - p = (char *) pos; - *p++ = WLAN_EID_SUPP_RATES; - lpos = p; - *p++ = 0; /* len */ - if (local->tx_rate_control & WLAN_RATE_1M) { - *p++ = local->basic_rates & WLAN_RATE_1M ? 0x82 : 0x02; - (*lpos)++; - } - if (local->tx_rate_control & WLAN_RATE_2M) { - *p++ = local->basic_rates & WLAN_RATE_2M ? 0x84 : 0x04; - (*lpos)++; - } - if (local->tx_rate_control & WLAN_RATE_5M5) { - *p++ = local->basic_rates & WLAN_RATE_5M5 ? - 0x8b : 0x0b; - (*lpos)++; - } - if (local->tx_rate_control & WLAN_RATE_11M) { - *p++ = local->basic_rates & WLAN_RATE_11M ? - 0x96 : 0x16; - (*lpos)++; - } - pos = (__le16 *) p; - } - - prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | - (send_deauth ? IEEE80211_STYPE_DEAUTH : - (reassoc ? IEEE80211_STYPE_REASSOC_RESP : - IEEE80211_STYPE_ASSOC_RESP)), - body, (u8 *) pos - (u8 *) body, - hdr->addr2, - send_deauth ? 0 : local->ap->tx_callback_assoc); - - if (sta) { - if (resp == WLAN_STATUS_SUCCESS) { - sta->last_rx = jiffies; - /* STA will be marked associated from TX callback, if - * AssocResp is ACKed */ - } - atomic_dec(&sta->users); - } - -#if 0 - PDEBUG(DEBUG_AP, "%s: %pM %sassoc (len=%d " - "prev_ap=%pM) => %d(%d) (%s)\n", - dev->name, - hdr->addr2, - reassoc ? "re" : "", len, - prev_ap, - resp, send_deauth, txt); -#endif -} - - -/* Called only as a scheduled task for pending AP frames. */ -static void handle_deauth(local_info_t *local, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats) -{ - struct net_device *dev = local->dev; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN); - int len; - u16 reason_code; - __le16 *pos; - struct sta_info *sta = NULL; - - len = skb->len - IEEE80211_MGMT_HDR_LEN; - - if (len < 2) { - printk("handle_deauth - too short payload (len=%d)\n", len); - return; - } - - pos = (__le16 *) body; - reason_code = le16_to_cpu(*pos); - - PDEBUG(DEBUG_AP, "%s: deauthentication: %pM len=%d, " - "reason_code=%d\n", dev->name, hdr->addr2, - len, reason_code); - - spin_lock_bh(&local->ap->sta_table_lock); - sta = ap_get_sta(local->ap, hdr->addr2); - if (sta != NULL) { - if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap) - hostap_event_expired_sta(local->dev, sta); - sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC); - } - spin_unlock_bh(&local->ap->sta_table_lock); - if (sta == NULL) { - printk("%s: deauthentication from %pM, " - "reason_code=%d, but STA not authenticated\n", dev->name, - hdr->addr2, reason_code); - } -} - - -/* Called only as a scheduled task for pending AP frames. */ -static void handle_disassoc(local_info_t *local, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats) -{ - struct net_device *dev = local->dev; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - char *body = skb->data + IEEE80211_MGMT_HDR_LEN; - int len; - u16 reason_code; - __le16 *pos; - struct sta_info *sta = NULL; - - len = skb->len - IEEE80211_MGMT_HDR_LEN; - - if (len < 2) { - printk("handle_disassoc - too short payload (len=%d)\n", len); - return; - } - - pos = (__le16 *) body; - reason_code = le16_to_cpu(*pos); - - PDEBUG(DEBUG_AP, "%s: disassociation: %pM len=%d, " - "reason_code=%d\n", dev->name, hdr->addr2, - len, reason_code); - - spin_lock_bh(&local->ap->sta_table_lock); - sta = ap_get_sta(local->ap, hdr->addr2); - if (sta != NULL) { - if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap) - hostap_event_expired_sta(local->dev, sta); - sta->flags &= ~WLAN_STA_ASSOC; - } - spin_unlock_bh(&local->ap->sta_table_lock); - if (sta == NULL) { - printk("%s: disassociation from %pM, " - "reason_code=%d, but STA not authenticated\n", - dev->name, hdr->addr2, reason_code); - } -} - - -/* Called only as a scheduled task for pending AP frames. */ -static void ap_handle_data_nullfunc(local_info_t *local, - struct ieee80211_hdr *hdr) -{ - struct net_device *dev = local->dev; - - /* some STA f/w's seem to require control::ACK frame for - * data::nullfunc, but at least Prism2 station f/w version 0.8.0 does - * not send this.. - * send control::ACK for the data::nullfunc */ - - printk(KERN_DEBUG "Sending control::ACK for data::nullfunc\n"); - prism2_send_mgmt(dev, IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK, - NULL, 0, hdr->addr2, 0); -} - - -/* Called only as a scheduled task for pending AP frames. */ -static void ap_handle_dropped_data(local_info_t *local, - struct ieee80211_hdr *hdr) -{ - struct net_device *dev = local->dev; - struct sta_info *sta; - __le16 reason; - - spin_lock_bh(&local->ap->sta_table_lock); - sta = ap_get_sta(local->ap, hdr->addr2); - if (sta) - atomic_inc(&sta->users); - spin_unlock_bh(&local->ap->sta_table_lock); - - if (sta != NULL && (sta->flags & WLAN_STA_ASSOC)) { - PDEBUG(DEBUG_AP, "ap_handle_dropped_data: STA is now okay?\n"); - atomic_dec(&sta->users); - return; - } - - reason = cpu_to_le16(WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA); - prism2_send_mgmt(dev, IEEE80211_FTYPE_MGMT | - ((sta == NULL || !(sta->flags & WLAN_STA_ASSOC)) ? - IEEE80211_STYPE_DEAUTH : IEEE80211_STYPE_DISASSOC), - (char *) &reason, sizeof(reason), hdr->addr2, 0); - - if (sta) - atomic_dec(&sta->users); -} - -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - -/* Called only as a scheduled task for pending AP frames. */ -static void pspoll_send_buffered(local_info_t *local, struct sta_info *sta, - struct sk_buff *skb) -{ - struct hostap_skb_tx_data *meta; - - if (!(sta->flags & WLAN_STA_PS)) { - /* Station has moved to non-PS mode, so send all buffered - * frames using normal device queue. */ - dev_queue_xmit(skb); - return; - } - - /* add a flag for hostap_handle_sta_tx() to know that this skb should - * be passed through even though STA is using PS */ - meta = (struct hostap_skb_tx_data *) skb->cb; - meta->flags |= HOSTAP_TX_FLAGS_BUFFERED_FRAME; - if (!skb_queue_empty(&sta->tx_buf)) { - /* indicate to STA that more frames follow */ - meta->flags |= HOSTAP_TX_FLAGS_ADD_MOREDATA; - } - dev_queue_xmit(skb); -} - - -/* Called only as a scheduled task for pending AP frames. */ -static void handle_pspoll(local_info_t *local, - struct ieee80211_hdr *hdr, - struct hostap_80211_rx_status *rx_stats) -{ - struct net_device *dev = local->dev; - struct sta_info *sta; - u16 aid; - struct sk_buff *skb; - - PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=%pM, TA=%pM PWRMGT=%d\n", - hdr->addr1, hdr->addr2, !!ieee80211_has_pm(hdr->frame_control)); - - if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { - PDEBUG(DEBUG_AP, - "handle_pspoll - addr1(BSSID)=%pM not own MAC\n", - hdr->addr1); - return; - } - - aid = le16_to_cpu(hdr->duration_id); - if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) { - PDEBUG(DEBUG_PS, " PSPOLL and AID[15:14] not set\n"); - return; - } - aid &= ~(BIT(15) | BIT(14)); - if (aid == 0 || aid > MAX_AID_TABLE_SIZE) { - PDEBUG(DEBUG_PS, " invalid aid=%d\n", aid); - return; - } - PDEBUG(DEBUG_PS2, " aid=%d\n", aid); - - spin_lock_bh(&local->ap->sta_table_lock); - sta = ap_get_sta(local->ap, hdr->addr2); - if (sta) - atomic_inc(&sta->users); - spin_unlock_bh(&local->ap->sta_table_lock); - - if (sta == NULL) { - PDEBUG(DEBUG_PS, " STA not found\n"); - return; - } - if (sta->aid != aid) { - PDEBUG(DEBUG_PS, " received aid=%i does not match with " - "assoc.aid=%d\n", aid, sta->aid); - return; - } - - /* FIX: todo: - * - add timeout for buffering (clear aid in TIM vector if buffer timed - * out (expiry time must be longer than ListenInterval for - * the corresponding STA; "8802-11: 11.2.1.9 AP aging function" - * - what to do, if buffered, pspolled, and sent frame is not ACKed by - * sta; store buffer for later use and leave TIM aid bit set? use - * TX event to check whether frame was ACKed? - */ - - while ((skb = skb_dequeue(&sta->tx_buf)) != NULL) { - /* send buffered frame .. */ - PDEBUG(DEBUG_PS2, "Sending buffered frame to STA after PS POLL" - " (buffer_count=%d)\n", skb_queue_len(&sta->tx_buf)); - - pspoll_send_buffered(local, sta, skb); - - if (sta->flags & WLAN_STA_PS) { - /* send only one buffered packet per PS Poll */ - /* FIX: should ignore further PS Polls until the - * buffered packet that was just sent is acknowledged - * (Tx or TxExc event) */ - break; - } - } - - if (skb_queue_empty(&sta->tx_buf)) { - /* try to clear aid from TIM */ - if (!(sta->flags & WLAN_STA_TIM)) - PDEBUG(DEBUG_PS2, "Re-unsetting TIM for aid %d\n", - aid); - hostap_set_tim(local, aid, 0); - sta->flags &= ~WLAN_STA_TIM; - } - - atomic_dec(&sta->users); -} - - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - -static void handle_wds_oper_queue(struct work_struct *work) -{ - struct ap_data *ap = container_of(work, struct ap_data, - wds_oper_queue); - local_info_t *local = ap->local; - struct wds_oper_data *entry, *prev; - - spin_lock_bh(&local->lock); - entry = local->ap->wds_oper_entries; - local->ap->wds_oper_entries = NULL; - spin_unlock_bh(&local->lock); - - while (entry) { - PDEBUG(DEBUG_AP, "%s: %s automatic WDS connection " - "to AP %pM\n", - local->dev->name, - entry->type == WDS_ADD ? "adding" : "removing", - entry->addr); - if (entry->type == WDS_ADD) - prism2_wds_add(local, entry->addr, 0); - else if (entry->type == WDS_DEL) - prism2_wds_del(local, entry->addr, 0, 1); - - prev = entry; - entry = entry->next; - kfree(prev); - } -} - - -/* Called only as a scheduled task for pending AP frames. */ -static void handle_beacon(local_info_t *local, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - char *body = skb->data + IEEE80211_MGMT_HDR_LEN; - int len, left; - u16 beacon_int, capability; - __le16 *pos; - char *ssid = NULL; - unsigned char *supp_rates = NULL; - int ssid_len = 0, supp_rates_len = 0; - struct sta_info *sta = NULL; - int new_sta = 0, channel = -1; - - len = skb->len - IEEE80211_MGMT_HDR_LEN; - - if (len < 8 + 2 + 2) { - printk(KERN_DEBUG "handle_beacon - too short payload " - "(len=%d)\n", len); - return; - } - - pos = (__le16 *) body; - left = len; - - /* Timestamp (8 octets) */ - pos += 4; left -= 8; - /* Beacon interval (2 octets) */ - beacon_int = le16_to_cpu(*pos); - pos++; left -= 2; - /* Capability information (2 octets) */ - capability = le16_to_cpu(*pos); - pos++; left -= 2; - - if (local->ap->ap_policy != AP_OTHER_AP_EVEN_IBSS && - capability & WLAN_CAPABILITY_IBSS) - return; - - if (left >= 2) { - unsigned int ileft; - unsigned char *u = (unsigned char *) pos; - - if (*u == WLAN_EID_SSID) { - u++; left--; - ileft = *u; - u++; left--; - - if (ileft > left || ileft > MAX_SSID_LEN) { - PDEBUG(DEBUG_AP, "SSID: overflow\n"); - return; - } - - if (local->ap->ap_policy == AP_OTHER_AP_SAME_SSID && - (ileft != strlen(local->essid) || - memcmp(local->essid, u, ileft) != 0)) { - /* not our SSID */ - return; - } - - ssid = u; - ssid_len = ileft; - - u += ileft; - left -= ileft; - } - - if (*u == WLAN_EID_SUPP_RATES) { - u++; left--; - ileft = *u; - u++; left--; - - if (ileft > left || ileft == 0 || ileft > 8) { - PDEBUG(DEBUG_AP, " - SUPP_RATES len error\n"); - return; - } - - supp_rates = u; - supp_rates_len = ileft; - - u += ileft; - left -= ileft; - } - - if (*u == WLAN_EID_DS_PARAMS) { - u++; left--; - ileft = *u; - u++; left--; - - if (ileft > left || ileft != 1) { - PDEBUG(DEBUG_AP, " - DS_PARAMS len error\n"); - return; - } - - channel = *u; - - u += ileft; - left -= ileft; - } - } - - spin_lock_bh(&local->ap->sta_table_lock); - sta = ap_get_sta(local->ap, hdr->addr2); - if (sta != NULL) - atomic_inc(&sta->users); - spin_unlock_bh(&local->ap->sta_table_lock); - - if (sta == NULL) { - /* add new AP */ - new_sta = 1; - sta = ap_add_sta(local->ap, hdr->addr2); - if (sta == NULL) { - printk(KERN_INFO "prism2: kmalloc failed for AP " - "data structure\n"); - return; - } - hostap_event_new_sta(local->dev, sta); - - /* mark APs authentication and associated for pseudo ad-hoc - * style communication */ - sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC; - - if (local->ap->autom_ap_wds) { - hostap_wds_link_oper(local, sta->addr, WDS_ADD); - } - } - - sta->ap = 1; - if (ssid) { - sta->u.ap.ssid_len = ssid_len; - memcpy(sta->u.ap.ssid, ssid, ssid_len); - sta->u.ap.ssid[ssid_len] = '\0'; - } else { - sta->u.ap.ssid_len = 0; - sta->u.ap.ssid[0] = '\0'; - } - sta->u.ap.channel = channel; - sta->rx_packets++; - sta->rx_bytes += len; - sta->u.ap.last_beacon = sta->last_rx = jiffies; - sta->capability = capability; - sta->listen_interval = beacon_int; - - atomic_dec(&sta->users); - - if (new_sta) { - memset(sta->supported_rates, 0, sizeof(sta->supported_rates)); - memcpy(sta->supported_rates, supp_rates, supp_rates_len); - prism2_check_tx_rates(sta); - } -} - -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - -/* Called only as a tasklet. */ -static void handle_ap_item(local_info_t *local, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats) -{ -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - struct net_device *dev = local->dev; -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - u16 fc, type, stype; - struct ieee80211_hdr *hdr; - - /* FIX: should give skb->len to handler functions and check that the - * buffer is long enough */ - hdr = (struct ieee80211_hdr *) skb->data; - fc = le16_to_cpu(hdr->frame_control); - type = fc & IEEE80211_FCTL_FTYPE; - stype = fc & IEEE80211_FCTL_STYPE; - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - if (!local->hostapd && type == IEEE80211_FTYPE_DATA) { - PDEBUG(DEBUG_AP, "handle_ap_item - data frame\n"); - - if (!(fc & IEEE80211_FCTL_TODS) || - (fc & IEEE80211_FCTL_FROMDS)) { - if (stype == IEEE80211_STYPE_NULLFUNC) { - /* no ToDS nullfunc seems to be used to check - * AP association; so send reject message to - * speed up re-association */ - ap_handle_dropped_data(local, hdr); - goto done; - } - PDEBUG(DEBUG_AP, " not ToDS frame (fc=0x%04x)\n", - fc); - goto done; - } - - if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { - PDEBUG(DEBUG_AP, "handle_ap_item - addr1(BSSID)=%pM" - " not own MAC\n", hdr->addr1); - goto done; - } - - if (local->ap->nullfunc_ack && - stype == IEEE80211_STYPE_NULLFUNC) - ap_handle_data_nullfunc(local, hdr); - else - ap_handle_dropped_data(local, hdr); - goto done; - } - - if (type == IEEE80211_FTYPE_MGMT && stype == IEEE80211_STYPE_BEACON) { - handle_beacon(local, skb, rx_stats); - goto done; - } -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - if (type == IEEE80211_FTYPE_CTL && stype == IEEE80211_STYPE_PSPOLL) { - handle_pspoll(local, hdr, rx_stats); - goto done; - } - - if (local->hostapd) { - PDEBUG(DEBUG_AP, "Unknown frame in AP queue: type=0x%02x " - "subtype=0x%02x\n", type, stype); - goto done; - } - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - if (type != IEEE80211_FTYPE_MGMT) { - PDEBUG(DEBUG_AP, "handle_ap_item - not a management frame?\n"); - goto done; - } - - if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { - PDEBUG(DEBUG_AP, "handle_ap_item - addr1(DA)=%pM" - " not own MAC\n", hdr->addr1); - goto done; - } - - if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) { - PDEBUG(DEBUG_AP, "handle_ap_item - addr3(BSSID)=%pM" - " not own MAC\n", hdr->addr3); - goto done; - } - - switch (stype) { - case IEEE80211_STYPE_ASSOC_REQ: - handle_assoc(local, skb, rx_stats, 0); - break; - case IEEE80211_STYPE_ASSOC_RESP: - PDEBUG(DEBUG_AP, "==> ASSOC RESP (ignored)\n"); - break; - case IEEE80211_STYPE_REASSOC_REQ: - handle_assoc(local, skb, rx_stats, 1); - break; - case IEEE80211_STYPE_REASSOC_RESP: - PDEBUG(DEBUG_AP, "==> REASSOC RESP (ignored)\n"); - break; - case IEEE80211_STYPE_ATIM: - PDEBUG(DEBUG_AP, "==> ATIM (ignored)\n"); - break; - case IEEE80211_STYPE_DISASSOC: - handle_disassoc(local, skb, rx_stats); - break; - case IEEE80211_STYPE_AUTH: - handle_authen(local, skb, rx_stats); - break; - case IEEE80211_STYPE_DEAUTH: - handle_deauth(local, skb, rx_stats); - break; - default: - PDEBUG(DEBUG_AP, "Unknown mgmt frame subtype 0x%02x\n", - stype >> 4); - break; - } -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - done: - dev_kfree_skb(skb); -} - - -/* Called only as a tasklet (software IRQ) */ -void hostap_rx(struct net_device *dev, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats) -{ - struct hostap_interface *iface; - local_info_t *local; - struct ieee80211_hdr *hdr; - - iface = netdev_priv(dev); - local = iface->local; - - if (skb->len < 16) - goto drop; - - dev->stats.rx_packets++; - - hdr = (struct ieee80211_hdr *) skb->data; - - if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL && - ieee80211_is_beacon(hdr->frame_control)) - goto drop; - - skb->protocol = cpu_to_be16(ETH_P_HOSTAP); - handle_ap_item(local, skb, rx_stats); - return; - - drop: - dev_kfree_skb(skb); -} - - -/* Called only as a tasklet (software IRQ) */ -static void schedule_packet_send(local_info_t *local, struct sta_info *sta) -{ - struct sk_buff *skb; - struct ieee80211_hdr *hdr; - struct hostap_80211_rx_status rx_stats; - - if (skb_queue_empty(&sta->tx_buf)) - return; - - skb = dev_alloc_skb(16); - if (skb == NULL) { - printk(KERN_DEBUG "%s: schedule_packet_send: skb alloc " - "failed\n", local->dev->name); - return; - } - - hdr = (struct ieee80211_hdr *) skb_put(skb, 16); - - /* Generate a fake pspoll frame to start packet delivery */ - hdr->frame_control = cpu_to_le16( - IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL); - memcpy(hdr->addr1, local->dev->dev_addr, ETH_ALEN); - memcpy(hdr->addr2, sta->addr, ETH_ALEN); - hdr->duration_id = cpu_to_le16(sta->aid | BIT(15) | BIT(14)); - - PDEBUG(DEBUG_PS2, - "%s: Scheduling buffered packet delivery for STA %pM\n", - local->dev->name, sta->addr); - - skb->dev = local->dev; - - memset(&rx_stats, 0, sizeof(rx_stats)); - hostap_rx(local->dev, skb, &rx_stats); -} - - -int prism2_ap_get_sta_qual(local_info_t *local, struct sockaddr addr[], - struct iw_quality qual[], int buf_size, - int aplist) -{ - struct ap_data *ap = local->ap; - struct list_head *ptr; - int count = 0; - - spin_lock_bh(&ap->sta_table_lock); - - for (ptr = ap->sta_list.next; ptr != NULL && ptr != &ap->sta_list; - ptr = ptr->next) { - struct sta_info *sta = (struct sta_info *) ptr; - - if (aplist && !sta->ap) - continue; - addr[count].sa_family = ARPHRD_ETHER; - memcpy(addr[count].sa_data, sta->addr, ETH_ALEN); - if (sta->last_rx_silence == 0) - qual[count].qual = sta->last_rx_signal < 27 ? - 0 : (sta->last_rx_signal - 27) * 92 / 127; - else - qual[count].qual = sta->last_rx_signal - - sta->last_rx_silence - 35; - qual[count].level = HFA384X_LEVEL_TO_dBm(sta->last_rx_signal); - qual[count].noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence); - qual[count].updated = sta->last_rx_updated; - - sta->last_rx_updated = IW_QUAL_DBM; - - count++; - if (count >= buf_size) - break; - } - spin_unlock_bh(&ap->sta_table_lock); - - return count; -} - - -/* Translate our list of Access Points & Stations to a card independent - * format that the Wireless Tools will understand - Jean II */ -int prism2_ap_translate_scan(struct net_device *dev, - struct iw_request_info *info, char *buffer) -{ - struct hostap_interface *iface; - local_info_t *local; - struct ap_data *ap; - struct list_head *ptr; - struct iw_event iwe; - char *current_ev = buffer; - char *end_buf = buffer + IW_SCAN_MAX_DATA; -#if !defined(PRISM2_NO_KERNEL_IEEE80211_MGMT) - char buf[64]; -#endif - - iface = netdev_priv(dev); - local = iface->local; - ap = local->ap; - - spin_lock_bh(&ap->sta_table_lock); - - for (ptr = ap->sta_list.next; ptr != NULL && ptr != &ap->sta_list; - ptr = ptr->next) { - struct sta_info *sta = (struct sta_info *) ptr; - - /* First entry *MUST* be the AP MAC address */ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, sta->addr, ETH_ALEN); - iwe.len = IW_EV_ADDR_LEN; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_ADDR_LEN); - - /* Use the mode to indicate if it's a station or - * an Access Point */ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWMODE; - if (sta->ap) - iwe.u.mode = IW_MODE_MASTER; - else - iwe.u.mode = IW_MODE_INFRA; - iwe.len = IW_EV_UINT_LEN; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_UINT_LEN); - - /* Some quality */ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVQUAL; - if (sta->last_rx_silence == 0) - iwe.u.qual.qual = sta->last_rx_signal < 27 ? - 0 : (sta->last_rx_signal - 27) * 92 / 127; - else - iwe.u.qual.qual = sta->last_rx_signal - - sta->last_rx_silence - 35; - iwe.u.qual.level = HFA384X_LEVEL_TO_dBm(sta->last_rx_signal); - iwe.u.qual.noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence); - iwe.u.qual.updated = sta->last_rx_updated; - iwe.len = IW_EV_QUAL_LEN; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_QUAL_LEN); - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - if (sta->ap) { - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWESSID; - iwe.u.data.length = sta->u.ap.ssid_len; - iwe.u.data.flags = 1; - current_ev = iwe_stream_add_point(info, current_ev, - end_buf, &iwe, - sta->u.ap.ssid); - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWENCODE; - if (sta->capability & WLAN_CAPABILITY_PRIVACY) - iwe.u.data.flags = - IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - else - iwe.u.data.flags = IW_ENCODE_DISABLED; - current_ev = iwe_stream_add_point(info, current_ev, - end_buf, &iwe, - sta->u.ap.ssid); - - if (sta->u.ap.channel > 0 && - sta->u.ap.channel <= FREQ_COUNT) { - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWFREQ; - iwe.u.freq.m = freq_list[sta->u.ap.channel - 1] - * 100000; - iwe.u.freq.e = 1; - current_ev = iwe_stream_add_event( - info, current_ev, end_buf, &iwe, - IW_EV_FREQ_LEN); - } - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - sprintf(buf, "beacon_interval=%d", - sta->listen_interval); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info, current_ev, - end_buf, &iwe, buf); - } -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - sta->last_rx_updated = IW_QUAL_DBM; - - /* To be continued, we should make good use of IWEVCUSTOM */ - } - - spin_unlock_bh(&ap->sta_table_lock); - - return current_ev - buffer; -} - - -static int prism2_hostapd_add_sta(struct ap_data *ap, - struct prism2_hostapd_param *param) -{ - struct sta_info *sta; - - spin_lock_bh(&ap->sta_table_lock); - sta = ap_get_sta(ap, param->sta_addr); - if (sta) - atomic_inc(&sta->users); - spin_unlock_bh(&ap->sta_table_lock); - - if (sta == NULL) { - sta = ap_add_sta(ap, param->sta_addr); - if (sta == NULL) - return -1; - } - - if (!(sta->flags & WLAN_STA_ASSOC) && !sta->ap && sta->local) - hostap_event_new_sta(sta->local->dev, sta); - - sta->flags |= WLAN_STA_AUTH | WLAN_STA_ASSOC; - sta->last_rx = jiffies; - sta->aid = param->u.add_sta.aid; - sta->capability = param->u.add_sta.capability; - sta->tx_supp_rates = param->u.add_sta.tx_supp_rates; - if (sta->tx_supp_rates & WLAN_RATE_1M) - sta->supported_rates[0] = 2; - if (sta->tx_supp_rates & WLAN_RATE_2M) - sta->supported_rates[1] = 4; - if (sta->tx_supp_rates & WLAN_RATE_5M5) - sta->supported_rates[2] = 11; - if (sta->tx_supp_rates & WLAN_RATE_11M) - sta->supported_rates[3] = 22; - prism2_check_tx_rates(sta); - atomic_dec(&sta->users); - return 0; -} - - -static int prism2_hostapd_remove_sta(struct ap_data *ap, - struct prism2_hostapd_param *param) -{ - struct sta_info *sta; - - spin_lock_bh(&ap->sta_table_lock); - sta = ap_get_sta(ap, param->sta_addr); - if (sta) { - ap_sta_hash_del(ap, sta); - list_del(&sta->list); - } - spin_unlock_bh(&ap->sta_table_lock); - - if (!sta) - return -ENOENT; - - if ((sta->flags & WLAN_STA_ASSOC) && !sta->ap && sta->local) - hostap_event_expired_sta(sta->local->dev, sta); - ap_free_sta(ap, sta); - - return 0; -} - - -static int prism2_hostapd_get_info_sta(struct ap_data *ap, - struct prism2_hostapd_param *param) -{ - struct sta_info *sta; - - spin_lock_bh(&ap->sta_table_lock); - sta = ap_get_sta(ap, param->sta_addr); - if (sta) - atomic_inc(&sta->users); - spin_unlock_bh(&ap->sta_table_lock); - - if (!sta) - return -ENOENT; - - param->u.get_info_sta.inactive_sec = (jiffies - sta->last_rx) / HZ; - - atomic_dec(&sta->users); - - return 1; -} - - -static int prism2_hostapd_set_flags_sta(struct ap_data *ap, - struct prism2_hostapd_param *param) -{ - struct sta_info *sta; - - spin_lock_bh(&ap->sta_table_lock); - sta = ap_get_sta(ap, param->sta_addr); - if (sta) { - sta->flags |= param->u.set_flags_sta.flags_or; - sta->flags &= param->u.set_flags_sta.flags_and; - } - spin_unlock_bh(&ap->sta_table_lock); - - if (!sta) - return -ENOENT; - - return 0; -} - - -static int prism2_hostapd_sta_clear_stats(struct ap_data *ap, - struct prism2_hostapd_param *param) -{ - struct sta_info *sta; - int rate; - - spin_lock_bh(&ap->sta_table_lock); - sta = ap_get_sta(ap, param->sta_addr); - if (sta) { - sta->rx_packets = sta->tx_packets = 0; - sta->rx_bytes = sta->tx_bytes = 0; - for (rate = 0; rate < WLAN_RATE_COUNT; rate++) { - sta->tx_count[rate] = 0; - sta->rx_count[rate] = 0; - } - } - spin_unlock_bh(&ap->sta_table_lock); - - if (!sta) - return -ENOENT; - - return 0; -} - - -int prism2_hostapd(struct ap_data *ap, struct prism2_hostapd_param *param) -{ - switch (param->cmd) { - case PRISM2_HOSTAPD_FLUSH: - ap_control_kickall(ap); - return 0; - case PRISM2_HOSTAPD_ADD_STA: - return prism2_hostapd_add_sta(ap, param); - case PRISM2_HOSTAPD_REMOVE_STA: - return prism2_hostapd_remove_sta(ap, param); - case PRISM2_HOSTAPD_GET_INFO_STA: - return prism2_hostapd_get_info_sta(ap, param); - case PRISM2_HOSTAPD_SET_FLAGS_STA: - return prism2_hostapd_set_flags_sta(ap, param); - case PRISM2_HOSTAPD_STA_CLEAR_STATS: - return prism2_hostapd_sta_clear_stats(ap, param); - default: - printk(KERN_WARNING "prism2_hostapd: unknown cmd=%d\n", - param->cmd); - return -EOPNOTSUPP; - } -} - - -/* Update station info for host-based TX rate control and return current - * TX rate */ -static int ap_update_sta_tx_rate(struct sta_info *sta, struct net_device *dev) -{ - int ret = sta->tx_rate; - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - sta->tx_count[sta->tx_rate_idx]++; - sta->tx_since_last_failure++; - sta->tx_consecutive_exc = 0; - if (sta->tx_since_last_failure >= WLAN_RATE_UPDATE_COUNT && - sta->tx_rate_idx < sta->tx_max_rate) { - /* use next higher rate */ - int old_rate, new_rate; - old_rate = new_rate = sta->tx_rate_idx; - while (new_rate < sta->tx_max_rate) { - new_rate++; - if (ap_tx_rate_ok(new_rate, sta, local)) { - sta->tx_rate_idx = new_rate; - break; - } - } - if (old_rate != sta->tx_rate_idx) { - switch (sta->tx_rate_idx) { - case 0: sta->tx_rate = 10; break; - case 1: sta->tx_rate = 20; break; - case 2: sta->tx_rate = 55; break; - case 3: sta->tx_rate = 110; break; - default: sta->tx_rate = 0; break; - } - PDEBUG(DEBUG_AP, "%s: STA %pM TX rate raised to %d\n", - dev->name, sta->addr, sta->tx_rate); - } - sta->tx_since_last_failure = 0; - } - - return ret; -} - - -/* Called only from software IRQ. Called for each TX frame prior possible - * encryption and transmit. */ -ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx) -{ - struct sta_info *sta = NULL; - struct sk_buff *skb = tx->skb; - int set_tim, ret; - struct ieee80211_hdr *hdr; - struct hostap_skb_tx_data *meta; - - meta = (struct hostap_skb_tx_data *) skb->cb; - ret = AP_TX_CONTINUE; - if (local->ap == NULL || skb->len < 10 || - meta->iface->type == HOSTAP_INTERFACE_STA) - goto out; - - hdr = (struct ieee80211_hdr *) skb->data; - - if (hdr->addr1[0] & 0x01) { - /* broadcast/multicast frame - no AP related processing */ - if (local->ap->num_sta <= 0) - ret = AP_TX_DROP; - goto out; - } - - /* unicast packet - check whether destination STA is associated */ - spin_lock(&local->ap->sta_table_lock); - sta = ap_get_sta(local->ap, hdr->addr1); - if (sta) - atomic_inc(&sta->users); - spin_unlock(&local->ap->sta_table_lock); - - if (local->iw_mode == IW_MODE_MASTER && sta == NULL && - !(meta->flags & HOSTAP_TX_FLAGS_WDS) && - meta->iface->type != HOSTAP_INTERFACE_MASTER && - meta->iface->type != HOSTAP_INTERFACE_AP) { -#if 0 - /* This can happen, e.g., when wlan0 is added to a bridge and - * bridging code does not know which port is the correct target - * for a unicast frame. In this case, the packet is send to all - * ports of the bridge. Since this is a valid scenario, do not - * print out any errors here. */ - if (net_ratelimit()) { - printk(KERN_DEBUG "AP: drop packet to non-associated " - "STA %pM\n", hdr->addr1); - } -#endif - local->ap->tx_drop_nonassoc++; - ret = AP_TX_DROP; - goto out; - } - - if (sta == NULL) - goto out; - - if (!(sta->flags & WLAN_STA_AUTHORIZED)) - ret = AP_TX_CONTINUE_NOT_AUTHORIZED; - - /* Set tx_rate if using host-based TX rate control */ - if (!local->fw_tx_rate_control) - local->ap->last_tx_rate = meta->rate = - ap_update_sta_tx_rate(sta, local->dev); - - if (local->iw_mode != IW_MODE_MASTER) - goto out; - - if (!(sta->flags & WLAN_STA_PS)) - goto out; - - if (meta->flags & HOSTAP_TX_FLAGS_ADD_MOREDATA) { - /* indicate to STA that more frames follow */ - hdr->frame_control |= - cpu_to_le16(IEEE80211_FCTL_MOREDATA); - } - - if (meta->flags & HOSTAP_TX_FLAGS_BUFFERED_FRAME) { - /* packet was already buffered and now send due to - * PS poll, so do not rebuffer it */ - goto out; - } - - if (skb_queue_len(&sta->tx_buf) >= STA_MAX_TX_BUFFER) { - PDEBUG(DEBUG_PS, "%s: No more space in STA (%pM)'s" - "PS mode buffer\n", - local->dev->name, sta->addr); - /* Make sure that TIM is set for the station (it might not be - * after AP wlan hw reset). */ - /* FIX: should fix hw reset to restore bits based on STA - * buffer state.. */ - hostap_set_tim(local, sta->aid, 1); - sta->flags |= WLAN_STA_TIM; - ret = AP_TX_DROP; - goto out; - } - - /* STA in PS mode, buffer frame for later delivery */ - set_tim = skb_queue_empty(&sta->tx_buf); - skb_queue_tail(&sta->tx_buf, skb); - /* FIX: could save RX time to skb and expire buffered frames after - * some time if STA does not poll for them */ - - if (set_tim) { - if (sta->flags & WLAN_STA_TIM) - PDEBUG(DEBUG_PS2, "Re-setting TIM for aid %d\n", - sta->aid); - hostap_set_tim(local, sta->aid, 1); - sta->flags |= WLAN_STA_TIM; - } - - ret = AP_TX_BUFFERED; - - out: - if (sta != NULL) { - if (ret == AP_TX_CONTINUE || - ret == AP_TX_CONTINUE_NOT_AUTHORIZED) { - sta->tx_packets++; - sta->tx_bytes += skb->len; - sta->last_tx = jiffies; - } - - if ((ret == AP_TX_CONTINUE || - ret == AP_TX_CONTINUE_NOT_AUTHORIZED) && - sta->crypt && tx->host_encrypt) { - tx->crypt = sta->crypt; - tx->sta_ptr = sta; /* hostap_handle_sta_release() will - * be called to release sta info - * later */ - } else - atomic_dec(&sta->users); - } - - return ret; -} - - -void hostap_handle_sta_release(void *ptr) -{ - struct sta_info *sta = ptr; - atomic_dec(&sta->users); -} - - -/* Called only as a tasklet (software IRQ) */ -void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb) -{ - struct sta_info *sta; - struct ieee80211_hdr *hdr; - struct hostap_skb_tx_data *meta; - - hdr = (struct ieee80211_hdr *) skb->data; - meta = (struct hostap_skb_tx_data *) skb->cb; - - spin_lock(&local->ap->sta_table_lock); - sta = ap_get_sta(local->ap, hdr->addr1); - if (!sta) { - spin_unlock(&local->ap->sta_table_lock); - PDEBUG(DEBUG_AP, "%s: Could not find STA %pM" - " for this TX error (@%lu)\n", - local->dev->name, hdr->addr1, jiffies); - return; - } - - sta->tx_since_last_failure = 0; - sta->tx_consecutive_exc++; - - if (sta->tx_consecutive_exc >= WLAN_RATE_DECREASE_THRESHOLD && - sta->tx_rate_idx > 0 && meta->rate <= sta->tx_rate) { - /* use next lower rate */ - int old, rate; - old = rate = sta->tx_rate_idx; - while (rate > 0) { - rate--; - if (ap_tx_rate_ok(rate, sta, local)) { - sta->tx_rate_idx = rate; - break; - } - } - if (old != sta->tx_rate_idx) { - switch (sta->tx_rate_idx) { - case 0: sta->tx_rate = 10; break; - case 1: sta->tx_rate = 20; break; - case 2: sta->tx_rate = 55; break; - case 3: sta->tx_rate = 110; break; - default: sta->tx_rate = 0; break; - } - PDEBUG(DEBUG_AP, - "%s: STA %pM TX rate lowered to %d\n", - local->dev->name, sta->addr, sta->tx_rate); - } - sta->tx_consecutive_exc = 0; - } - spin_unlock(&local->ap->sta_table_lock); -} - - -static void hostap_update_sta_ps2(local_info_t *local, struct sta_info *sta, - int pwrmgt, int type, int stype) -{ - if (pwrmgt && !(sta->flags & WLAN_STA_PS)) { - sta->flags |= WLAN_STA_PS; - PDEBUG(DEBUG_PS2, "STA %pM changed to use PS " - "mode (type=0x%02X, stype=0x%02X)\n", - sta->addr, type >> 2, stype >> 4); - } else if (!pwrmgt && (sta->flags & WLAN_STA_PS)) { - sta->flags &= ~WLAN_STA_PS; - PDEBUG(DEBUG_PS2, "STA %pM changed to not use " - "PS mode (type=0x%02X, stype=0x%02X)\n", - sta->addr, type >> 2, stype >> 4); - if (type != IEEE80211_FTYPE_CTL || - stype != IEEE80211_STYPE_PSPOLL) - schedule_packet_send(local, sta); - } -} - - -/* Called only as a tasklet (software IRQ). Called for each RX frame to update - * STA power saving state. pwrmgt is a flag from 802.11 frame_control field. */ -int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr) -{ - struct sta_info *sta; - u16 fc; - - spin_lock(&local->ap->sta_table_lock); - sta = ap_get_sta(local->ap, hdr->addr2); - if (sta) - atomic_inc(&sta->users); - spin_unlock(&local->ap->sta_table_lock); - - if (!sta) - return -1; - - fc = le16_to_cpu(hdr->frame_control); - hostap_update_sta_ps2(local, sta, fc & IEEE80211_FCTL_PM, - fc & IEEE80211_FCTL_FTYPE, - fc & IEEE80211_FCTL_STYPE); - - atomic_dec(&sta->users); - return 0; -} - - -/* Called only as a tasklet (software IRQ). Called for each RX frame after - * getting RX header and payload from hardware. */ -ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, - struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats, - int wds) -{ - int ret; - struct sta_info *sta; - u16 fc, type, stype; - struct ieee80211_hdr *hdr; - - if (local->ap == NULL) - return AP_RX_CONTINUE; - - hdr = (struct ieee80211_hdr *) skb->data; - - fc = le16_to_cpu(hdr->frame_control); - type = fc & IEEE80211_FCTL_FTYPE; - stype = fc & IEEE80211_FCTL_STYPE; - - spin_lock(&local->ap->sta_table_lock); - sta = ap_get_sta(local->ap, hdr->addr2); - if (sta) - atomic_inc(&sta->users); - spin_unlock(&local->ap->sta_table_lock); - - if (sta && !(sta->flags & WLAN_STA_AUTHORIZED)) - ret = AP_RX_CONTINUE_NOT_AUTHORIZED; - else - ret = AP_RX_CONTINUE; - - - if (fc & IEEE80211_FCTL_TODS) { - if (!wds && (sta == NULL || !(sta->flags & WLAN_STA_ASSOC))) { - if (local->hostapd) { - prism2_rx_80211(local->apdev, skb, rx_stats, - PRISM2_RX_NON_ASSOC); -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - } else { - printk(KERN_DEBUG "%s: dropped received packet" - " from non-associated STA %pM" - " (type=0x%02x, subtype=0x%02x)\n", - dev->name, hdr->addr2, - type >> 2, stype >> 4); - hostap_rx(dev, skb, rx_stats); -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - } - ret = AP_RX_EXIT; - goto out; - } - } else if (fc & IEEE80211_FCTL_FROMDS) { - if (!wds) { - /* FromDS frame - not for us; probably - * broadcast/multicast in another BSS - drop */ - if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { - printk(KERN_DEBUG "Odd.. FromDS packet " - "received with own BSSID\n"); - hostap_dump_rx_80211(dev->name, skb, rx_stats); - } - ret = AP_RX_DROP; - goto out; - } - } else if (stype == IEEE80211_STYPE_NULLFUNC && sta == NULL && - memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { - - if (local->hostapd) { - prism2_rx_80211(local->apdev, skb, rx_stats, - PRISM2_RX_NON_ASSOC); -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - } else { - /* At least Lucent f/w seems to send data::nullfunc - * frames with no ToDS flag when the current AP returns - * after being unavailable for some time. Speed up - * re-association by informing the station about it not - * being associated. */ - printk(KERN_DEBUG "%s: rejected received nullfunc frame" - " without ToDS from not associated STA %pM\n", - dev->name, hdr->addr2); - hostap_rx(dev, skb, rx_stats); -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - } - ret = AP_RX_EXIT; - goto out; - } else if (stype == IEEE80211_STYPE_NULLFUNC) { - /* At least Lucent cards seem to send periodic nullfunc - * frames with ToDS. Let these through to update SQ - * stats and PS state. Nullfunc frames do not contain - * any data and they will be dropped below. */ - } else { - /* If BSSID (Addr3) is foreign, this frame is a normal - * broadcast frame from an IBSS network. Drop it silently. - * If BSSID is own, report the dropping of this frame. */ - if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) { - printk(KERN_DEBUG "%s: dropped received packet from %pM" - " with no ToDS flag " - "(type=0x%02x, subtype=0x%02x)\n", dev->name, - hdr->addr2, type >> 2, stype >> 4); - hostap_dump_rx_80211(dev->name, skb, rx_stats); - } - ret = AP_RX_DROP; - goto out; - } - - if (sta) { - hostap_update_sta_ps2(local, sta, fc & IEEE80211_FCTL_PM, - type, stype); - - sta->rx_packets++; - sta->rx_bytes += skb->len; - sta->last_rx = jiffies; - } - - if (local->ap->nullfunc_ack && stype == IEEE80211_STYPE_NULLFUNC && - fc & IEEE80211_FCTL_TODS) { - if (local->hostapd) { - prism2_rx_80211(local->apdev, skb, rx_stats, - PRISM2_RX_NULLFUNC_ACK); -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - } else { - /* some STA f/w's seem to require control::ACK frame - * for data::nullfunc, but Prism2 f/w 0.8.0 (at least - * from Compaq) does not send this.. Try to generate - * ACK for these frames from the host driver to make - * power saving work with, e.g., Lucent WaveLAN f/w */ - hostap_rx(dev, skb, rx_stats); -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - } - ret = AP_RX_EXIT; - goto out; - } - - out: - if (sta) - atomic_dec(&sta->users); - - return ret; -} - - -/* Called only as a tasklet (software IRQ) */ -int hostap_handle_sta_crypto(local_info_t *local, - struct ieee80211_hdr *hdr, - struct lib80211_crypt_data **crypt, - void **sta_ptr) -{ - struct sta_info *sta; - - spin_lock(&local->ap->sta_table_lock); - sta = ap_get_sta(local->ap, hdr->addr2); - if (sta) - atomic_inc(&sta->users); - spin_unlock(&local->ap->sta_table_lock); - - if (!sta) - return -1; - - if (sta->crypt) { - *crypt = sta->crypt; - *sta_ptr = sta; - /* hostap_handle_sta_release() will be called to release STA - * info */ - } else - atomic_dec(&sta->users); - - return 0; -} - - -/* Called only as a tasklet (software IRQ) */ -int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr) -{ - struct sta_info *sta; - int ret = 0; - - spin_lock(&ap->sta_table_lock); - sta = ap_get_sta(ap, sta_addr); - if (sta != NULL && (sta->flags & WLAN_STA_ASSOC) && !sta->ap) - ret = 1; - spin_unlock(&ap->sta_table_lock); - - return ret; -} - - -/* Called only as a tasklet (software IRQ) */ -int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr) -{ - struct sta_info *sta; - int ret = 0; - - spin_lock(&ap->sta_table_lock); - sta = ap_get_sta(ap, sta_addr); - if (sta != NULL && (sta->flags & WLAN_STA_ASSOC) && !sta->ap && - ((sta->flags & WLAN_STA_AUTHORIZED) || - ap->local->ieee_802_1x == 0)) - ret = 1; - spin_unlock(&ap->sta_table_lock); - - return ret; -} - - -/* Called only as a tasklet (software IRQ) */ -int hostap_add_sta(struct ap_data *ap, u8 *sta_addr) -{ - struct sta_info *sta; - int ret = 1; - - if (!ap) - return -1; - - spin_lock(&ap->sta_table_lock); - sta = ap_get_sta(ap, sta_addr); - if (sta) - ret = 0; - spin_unlock(&ap->sta_table_lock); - - if (ret == 1) { - sta = ap_add_sta(ap, sta_addr); - if (!sta) - return -1; - sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC; - sta->ap = 1; - memset(sta->supported_rates, 0, sizeof(sta->supported_rates)); - /* No way of knowing which rates are supported since we did not - * get supported rates element from beacon/assoc req. Assume - * that remote end supports all 802.11b rates. */ - sta->supported_rates[0] = 0x82; - sta->supported_rates[1] = 0x84; - sta->supported_rates[2] = 0x0b; - sta->supported_rates[3] = 0x16; - sta->tx_supp_rates = WLAN_RATE_1M | WLAN_RATE_2M | - WLAN_RATE_5M5 | WLAN_RATE_11M; - sta->tx_rate = 110; - sta->tx_max_rate = sta->tx_rate_idx = 3; - } - - return ret; -} - - -/* Called only as a tasklet (software IRQ) */ -int hostap_update_rx_stats(struct ap_data *ap, - struct ieee80211_hdr *hdr, - struct hostap_80211_rx_status *rx_stats) -{ - struct sta_info *sta; - - if (!ap) - return -1; - - spin_lock(&ap->sta_table_lock); - sta = ap_get_sta(ap, hdr->addr2); - if (sta) { - sta->last_rx_silence = rx_stats->noise; - sta->last_rx_signal = rx_stats->signal; - sta->last_rx_rate = rx_stats->rate; - sta->last_rx_updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; - if (rx_stats->rate == 10) - sta->rx_count[0]++; - else if (rx_stats->rate == 20) - sta->rx_count[1]++; - else if (rx_stats->rate == 55) - sta->rx_count[2]++; - else if (rx_stats->rate == 110) - sta->rx_count[3]++; - } - spin_unlock(&ap->sta_table_lock); - - return sta ? 0 : -1; -} - - -void hostap_update_rates(local_info_t *local) -{ - struct sta_info *sta; - struct ap_data *ap = local->ap; - - if (!ap) - return; - - spin_lock_bh(&ap->sta_table_lock); - list_for_each_entry(sta, &ap->sta_list, list) { - prism2_check_tx_rates(sta); - } - spin_unlock_bh(&ap->sta_table_lock); -} - - -void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent, - struct lib80211_crypt_data ***crypt) -{ - struct sta_info *sta; - - spin_lock_bh(&ap->sta_table_lock); - sta = ap_get_sta(ap, addr); - if (sta) - atomic_inc(&sta->users); - spin_unlock_bh(&ap->sta_table_lock); - - if (!sta && permanent) - sta = ap_add_sta(ap, addr); - - if (!sta) - return NULL; - - if (permanent) - sta->flags |= WLAN_STA_PERM; - - *crypt = &sta->crypt; - - return sta; -} - - -void hostap_add_wds_links(local_info_t *local) -{ - struct ap_data *ap = local->ap; - struct sta_info *sta; - - spin_lock_bh(&ap->sta_table_lock); - list_for_each_entry(sta, &ap->sta_list, list) { - if (sta->ap) - hostap_wds_link_oper(local, sta->addr, WDS_ADD); - } - spin_unlock_bh(&ap->sta_table_lock); - - schedule_work(&local->ap->wds_oper_queue); -} - - -void hostap_wds_link_oper(local_info_t *local, u8 *addr, wds_oper_type type) -{ - struct wds_oper_data *entry; - - entry = kmalloc(sizeof(*entry), GFP_ATOMIC); - if (!entry) - return; - memcpy(entry->addr, addr, ETH_ALEN); - entry->type = type; - spin_lock_bh(&local->lock); - entry->next = local->ap->wds_oper_entries; - local->ap->wds_oper_entries = entry; - spin_unlock_bh(&local->lock); - - schedule_work(&local->ap->wds_oper_queue); -} - - -EXPORT_SYMBOL(hostap_init_data); -EXPORT_SYMBOL(hostap_init_ap_proc); -EXPORT_SYMBOL(hostap_free_data); -EXPORT_SYMBOL(hostap_check_sta_fw_version); -EXPORT_SYMBOL(hostap_handle_sta_tx_exc); -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ diff --git a/drivers/net/wireless/hostap/hostap_ap.h b/drivers/net/wireless/hostap/hostap_ap.h deleted file mode 100644 index 334e2d0b8e11..000000000000 --- a/drivers/net/wireless/hostap/hostap_ap.h +++ /dev/null @@ -1,263 +0,0 @@ -#ifndef HOSTAP_AP_H -#define HOSTAP_AP_H - -#include "hostap_80211.h" - -/* AP data structures for STAs */ - -/* maximum number of frames to buffer per STA */ -#define STA_MAX_TX_BUFFER 32 - -/* STA flags */ -#define WLAN_STA_AUTH BIT(0) -#define WLAN_STA_ASSOC BIT(1) -#define WLAN_STA_PS BIT(2) -#define WLAN_STA_TIM BIT(3) /* TIM bit is on for PS stations */ -#define WLAN_STA_PERM BIT(4) /* permanent; do not remove entry on expiration */ -#define WLAN_STA_AUTHORIZED BIT(5) /* If 802.1X is used, this flag is - * controlling whether STA is authorized to - * send and receive non-IEEE 802.1X frames - */ -#define WLAN_STA_PENDING_POLL BIT(6) /* pending activity poll not ACKed */ - -#define WLAN_RATE_1M BIT(0) -#define WLAN_RATE_2M BIT(1) -#define WLAN_RATE_5M5 BIT(2) -#define WLAN_RATE_11M BIT(3) -#define WLAN_RATE_COUNT 4 - -/* Maximum size of Supported Rates info element. IEEE 802.11 has a limit of 8, - * but some pre-standard IEEE 802.11g products use longer elements. */ -#define WLAN_SUPP_RATES_MAX 32 - -/* Try to increase TX rate after # successfully sent consecutive packets */ -#define WLAN_RATE_UPDATE_COUNT 50 - -/* Decrease TX rate after # consecutive dropped packets */ -#define WLAN_RATE_DECREASE_THRESHOLD 2 - -struct sta_info { - struct list_head list; - struct sta_info *hnext; /* next entry in hash table list */ - atomic_t users; /* number of users (do not remove if > 0) */ - struct proc_dir_entry *proc; - - u8 addr[6]; - u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */ - u32 flags; - u16 capability; - u16 listen_interval; /* or beacon_int for APs */ - u8 supported_rates[WLAN_SUPP_RATES_MAX]; - - unsigned long last_auth; - unsigned long last_assoc; - unsigned long last_rx; - unsigned long last_tx; - unsigned long rx_packets, tx_packets; - unsigned long rx_bytes, tx_bytes; - struct sk_buff_head tx_buf; - /* FIX: timeout buffers with an expiry time somehow derived from - * listen_interval */ - - s8 last_rx_silence; /* Noise in dBm */ - s8 last_rx_signal; /* Signal strength in dBm */ - u8 last_rx_rate; /* TX rate in 0.1 Mbps */ - u8 last_rx_updated; /* IWSPY's struct iw_quality::updated */ - - u8 tx_supp_rates; /* bit field of supported TX rates */ - u8 tx_rate; /* current TX rate (in 0.1 Mbps) */ - u8 tx_rate_idx; /* current TX rate (WLAN_RATE_*) */ - u8 tx_max_rate; /* max TX rate (WLAN_RATE_*) */ - u32 tx_count[WLAN_RATE_COUNT]; /* number of frames sent (per rate) */ - u32 rx_count[WLAN_RATE_COUNT]; /* number of frames received (per rate) - */ - u32 tx_since_last_failure; - u32 tx_consecutive_exc; - - struct lib80211_crypt_data *crypt; - - int ap; /* whether this station is an AP */ - - local_info_t *local; - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - union { - struct { - char *challenge; /* shared key authentication - * challenge */ - } sta; - struct { - int ssid_len; - unsigned char ssid[MAX_SSID_LEN + 1]; /* AP's ssid */ - int channel; - unsigned long last_beacon; /* last RX beacon time */ - } ap; - } u; - - struct timer_list timer; - enum { STA_NULLFUNC = 0, STA_DISASSOC, STA_DEAUTH } timeout_next; -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ -}; - - -#define MAX_STA_COUNT 1024 - -/* Maximum number of AIDs to use for STAs; must be 2007 or lower - * (8802.11 limitation) */ -#define MAX_AID_TABLE_SIZE 128 - -#define STA_HASH_SIZE 256 -#define STA_HASH(sta) (sta[5]) - - -/* Default value for maximum station inactivity. After AP_MAX_INACTIVITY_SEC - * has passed since last received frame from the station, a nullfunc data - * frame is sent to the station. If this frame is not acknowledged and no other - * frames have been received, the station will be disassociated after - * AP_DISASSOC_DELAY. Similarly, a the station will be deauthenticated after - * AP_DEAUTH_DELAY. AP_TIMEOUT_RESOLUTION is the resolution that is used with - * max inactivity timer. */ -#define AP_MAX_INACTIVITY_SEC (5 * 60) -#define AP_DISASSOC_DELAY (HZ) -#define AP_DEAUTH_DELAY (HZ) - -/* ap_policy: whether to accept frames to/from other APs/IBSS */ -typedef enum { - AP_OTHER_AP_SKIP_ALL = 0, - AP_OTHER_AP_SAME_SSID = 1, - AP_OTHER_AP_ALL = 2, - AP_OTHER_AP_EVEN_IBSS = 3 -} ap_policy_enum; - -#define PRISM2_AUTH_OPEN BIT(0) -#define PRISM2_AUTH_SHARED_KEY BIT(1) - - -/* MAC address-based restrictions */ -struct mac_entry { - struct list_head list; - u8 addr[6]; -}; - -struct mac_restrictions { - enum { MAC_POLICY_OPEN = 0, MAC_POLICY_ALLOW, MAC_POLICY_DENY } policy; - unsigned int entries; - struct list_head mac_list; - spinlock_t lock; -}; - - -struct add_sta_proc_data { - u8 addr[ETH_ALEN]; - struct add_sta_proc_data *next; -}; - - -typedef enum { WDS_ADD, WDS_DEL } wds_oper_type; -struct wds_oper_data { - wds_oper_type type; - u8 addr[ETH_ALEN]; - struct wds_oper_data *next; -}; - - -struct ap_data { - int initialized; /* whether ap_data has been initialized */ - local_info_t *local; - int bridge_packets; /* send packet to associated STAs directly to the - * wireless media instead of higher layers in the - * kernel */ - unsigned int bridged_unicast; /* number of unicast frames bridged on - * wireless media */ - unsigned int bridged_multicast; /* number of non-unicast frames - * bridged on wireless media */ - unsigned int tx_drop_nonassoc; /* number of unicast TX packets dropped - * because they were to an address that - * was not associated */ - int nullfunc_ack; /* use workaround for nullfunc frame ACKs */ - - spinlock_t sta_table_lock; - int num_sta; /* number of entries in sta_list */ - struct list_head sta_list; /* STA info list head */ - struct sta_info *sta_hash[STA_HASH_SIZE]; - - struct proc_dir_entry *proc; - - ap_policy_enum ap_policy; - unsigned int max_inactivity; - int autom_ap_wds; - - struct mac_restrictions mac_restrictions; /* MAC-based auth */ - int last_tx_rate; - - struct work_struct add_sta_proc_queue; - struct add_sta_proc_data *add_sta_proc_entries; - - struct work_struct wds_oper_queue; - struct wds_oper_data *wds_oper_entries; - - u16 tx_callback_idx; - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - /* pointers to STA info; based on allocated AID or NULL if AID free - * AID is in the range 1-2007, so sta_aid[0] corresponders to AID 1 - * and so on - */ - struct sta_info *sta_aid[MAX_AID_TABLE_SIZE]; - - u16 tx_callback_auth, tx_callback_assoc, tx_callback_poll; - - /* WEP operations for generating challenges to be used with shared key - * authentication */ - struct lib80211_crypto_ops *crypt; - void *crypt_priv; -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ -}; - - -void hostap_rx(struct net_device *dev, struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats); -void hostap_init_data(local_info_t *local); -void hostap_init_ap_proc(local_info_t *local); -void hostap_free_data(struct ap_data *ap); -void hostap_check_sta_fw_version(struct ap_data *ap, int sta_fw_ver); - -typedef enum { - AP_TX_CONTINUE, AP_TX_DROP, AP_TX_RETRY, AP_TX_BUFFERED, - AP_TX_CONTINUE_NOT_AUTHORIZED -} ap_tx_ret; -struct hostap_tx_data { - struct sk_buff *skb; - int host_encrypt; - struct lib80211_crypt_data *crypt; - void *sta_ptr; -}; -ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx); -void hostap_handle_sta_release(void *ptr); -void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb); -int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr); -typedef enum { - AP_RX_CONTINUE, AP_RX_DROP, AP_RX_EXIT, AP_RX_CONTINUE_NOT_AUTHORIZED -} ap_rx_ret; -ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev, - struct sk_buff *skb, - struct hostap_80211_rx_status *rx_stats, - int wds); -int hostap_handle_sta_crypto(local_info_t *local, struct ieee80211_hdr *hdr, - struct lib80211_crypt_data **crypt, - void **sta_ptr); -int hostap_is_sta_assoc(struct ap_data *ap, u8 *sta_addr); -int hostap_is_sta_authorized(struct ap_data *ap, u8 *sta_addr); -int hostap_add_sta(struct ap_data *ap, u8 *sta_addr); -int hostap_update_rx_stats(struct ap_data *ap, struct ieee80211_hdr *hdr, - struct hostap_80211_rx_status *rx_stats); -void hostap_update_rates(local_info_t *local); -void hostap_add_wds_links(local_info_t *local); -void hostap_wds_link_oper(local_info_t *local, u8 *addr, wds_oper_type type); - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT -void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap, - int resend); -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - -#endif /* HOSTAP_AP_H */ diff --git a/drivers/net/wireless/hostap/hostap_common.h b/drivers/net/wireless/hostap/hostap_common.h deleted file mode 100644 index 4230102ac9e4..000000000000 --- a/drivers/net/wireless/hostap/hostap_common.h +++ /dev/null @@ -1,419 +0,0 @@ -#ifndef HOSTAP_COMMON_H -#define HOSTAP_COMMON_H - -#include -#include - -/* IEEE 802.11 defines */ - -/* HFA384X Configuration RIDs */ -#define HFA384X_RID_CNFPORTTYPE 0xFC00 -#define HFA384X_RID_CNFOWNMACADDR 0xFC01 -#define HFA384X_RID_CNFDESIREDSSID 0xFC02 -#define HFA384X_RID_CNFOWNCHANNEL 0xFC03 -#define HFA384X_RID_CNFOWNSSID 0xFC04 -#define HFA384X_RID_CNFOWNATIMWINDOW 0xFC05 -#define HFA384X_RID_CNFSYSTEMSCALE 0xFC06 -#define HFA384X_RID_CNFMAXDATALEN 0xFC07 -#define HFA384X_RID_CNFWDSADDRESS 0xFC08 -#define HFA384X_RID_CNFPMENABLED 0xFC09 -#define HFA384X_RID_CNFPMEPS 0xFC0A -#define HFA384X_RID_CNFMULTICASTRECEIVE 0xFC0B -#define HFA384X_RID_CNFMAXSLEEPDURATION 0xFC0C -#define HFA384X_RID_CNFPMHOLDOVERDURATION 0xFC0D -#define HFA384X_RID_CNFOWNNAME 0xFC0E -#define HFA384X_RID_CNFOWNDTIMPERIOD 0xFC10 -#define HFA384X_RID_CNFWDSADDRESS1 0xFC11 /* AP f/w only */ -#define HFA384X_RID_CNFWDSADDRESS2 0xFC12 /* AP f/w only */ -#define HFA384X_RID_CNFWDSADDRESS3 0xFC13 /* AP f/w only */ -#define HFA384X_RID_CNFWDSADDRESS4 0xFC14 /* AP f/w only */ -#define HFA384X_RID_CNFWDSADDRESS5 0xFC15 /* AP f/w only */ -#define HFA384X_RID_CNFWDSADDRESS6 0xFC16 /* AP f/w only */ -#define HFA384X_RID_CNFMULTICASTPMBUFFERING 0xFC17 /* AP f/w only */ -#define HFA384X_RID_UNKNOWN1 0xFC20 -#define HFA384X_RID_UNKNOWN2 0xFC21 -#define HFA384X_RID_CNFWEPDEFAULTKEYID 0xFC23 -#define HFA384X_RID_CNFDEFAULTKEY0 0xFC24 -#define HFA384X_RID_CNFDEFAULTKEY1 0xFC25 -#define HFA384X_RID_CNFDEFAULTKEY2 0xFC26 -#define HFA384X_RID_CNFDEFAULTKEY3 0xFC27 -#define HFA384X_RID_CNFWEPFLAGS 0xFC28 -#define HFA384X_RID_CNFWEPKEYMAPPINGTABLE 0xFC29 -#define HFA384X_RID_CNFAUTHENTICATION 0xFC2A -#define HFA384X_RID_CNFMAXASSOCSTA 0xFC2B /* AP f/w only */ -#define HFA384X_RID_CNFTXCONTROL 0xFC2C -#define HFA384X_RID_CNFROAMINGMODE 0xFC2D -#define HFA384X_RID_CNFHOSTAUTHENTICATION 0xFC2E /* AP f/w only */ -#define HFA384X_RID_CNFRCVCRCERROR 0xFC30 -#define HFA384X_RID_CNFMMLIFE 0xFC31 -#define HFA384X_RID_CNFALTRETRYCOUNT 0xFC32 -#define HFA384X_RID_CNFBEACONINT 0xFC33 -#define HFA384X_RID_CNFAPPCFINFO 0xFC34 /* AP f/w only */ -#define HFA384X_RID_CNFSTAPCFINFO 0xFC35 -#define HFA384X_RID_CNFPRIORITYQUSAGE 0xFC37 -#define HFA384X_RID_CNFTIMCTRL 0xFC40 -#define HFA384X_RID_UNKNOWN3 0xFC41 /* added in STA f/w 0.7.x */ -#define HFA384X_RID_CNFTHIRTY2TALLY 0xFC42 /* added in STA f/w 0.8.0 */ -#define HFA384X_RID_CNFENHSECURITY 0xFC43 /* AP f/w or STA f/w >= 1.6.3 */ -#define HFA384X_RID_CNFDBMADJUST 0xFC46 /* added in STA f/w 1.3.1 */ -#define HFA384X_RID_GENERICELEMENT 0xFC48 /* added in STA f/w 1.7.0; - * write only */ -#define HFA384X_RID_PROPAGATIONDELAY 0xFC49 /* added in STA f/w 1.7.6 */ -#define HFA384X_RID_GROUPADDRESSES 0xFC80 -#define HFA384X_RID_CREATEIBSS 0xFC81 -#define HFA384X_RID_FRAGMENTATIONTHRESHOLD 0xFC82 -#define HFA384X_RID_RTSTHRESHOLD 0xFC83 -#define HFA384X_RID_TXRATECONTROL 0xFC84 -#define HFA384X_RID_PROMISCUOUSMODE 0xFC85 -#define HFA384X_RID_FRAGMENTATIONTHRESHOLD0 0xFC90 /* AP f/w only */ -#define HFA384X_RID_FRAGMENTATIONTHRESHOLD1 0xFC91 /* AP f/w only */ -#define HFA384X_RID_FRAGMENTATIONTHRESHOLD2 0xFC92 /* AP f/w only */ -#define HFA384X_RID_FRAGMENTATIONTHRESHOLD3 0xFC93 /* AP f/w only */ -#define HFA384X_RID_FRAGMENTATIONTHRESHOLD4 0xFC94 /* AP f/w only */ -#define HFA384X_RID_FRAGMENTATIONTHRESHOLD5 0xFC95 /* AP f/w only */ -#define HFA384X_RID_FRAGMENTATIONTHRESHOLD6 0xFC96 /* AP f/w only */ -#define HFA384X_RID_RTSTHRESHOLD0 0xFC97 /* AP f/w only */ -#define HFA384X_RID_RTSTHRESHOLD1 0xFC98 /* AP f/w only */ -#define HFA384X_RID_RTSTHRESHOLD2 0xFC99 /* AP f/w only */ -#define HFA384X_RID_RTSTHRESHOLD3 0xFC9A /* AP f/w only */ -#define HFA384X_RID_RTSTHRESHOLD4 0xFC9B /* AP f/w only */ -#define HFA384X_RID_RTSTHRESHOLD5 0xFC9C /* AP f/w only */ -#define HFA384X_RID_RTSTHRESHOLD6 0xFC9D /* AP f/w only */ -#define HFA384X_RID_TXRATECONTROL0 0xFC9E /* AP f/w only */ -#define HFA384X_RID_TXRATECONTROL1 0xFC9F /* AP f/w only */ -#define HFA384X_RID_TXRATECONTROL2 0xFCA0 /* AP f/w only */ -#define HFA384X_RID_TXRATECONTROL3 0xFCA1 /* AP f/w only */ -#define HFA384X_RID_TXRATECONTROL4 0xFCA2 /* AP f/w only */ -#define HFA384X_RID_TXRATECONTROL5 0xFCA3 /* AP f/w only */ -#define HFA384X_RID_TXRATECONTROL6 0xFCA4 /* AP f/w only */ -#define HFA384X_RID_CNFSHORTPREAMBLE 0xFCB0 -#define HFA384X_RID_CNFEXCLUDELONGPREAMBLE 0xFCB1 -#define HFA384X_RID_CNFAUTHENTICATIONRSPTO 0xFCB2 -#define HFA384X_RID_CNFBASICRATES 0xFCB3 -#define HFA384X_RID_CNFSUPPORTEDRATES 0xFCB4 -#define HFA384X_RID_CNFFALLBACKCTRL 0xFCB5 /* added in STA f/w 1.3.1 */ -#define HFA384X_RID_WEPKEYDISABLE 0xFCB6 /* added in STA f/w 1.3.1 */ -#define HFA384X_RID_WEPKEYMAPINDEX 0xFCB7 /* ? */ -#define HFA384X_RID_BROADCASTKEYID 0xFCB8 /* ? */ -#define HFA384X_RID_ENTSECFLAGEYID 0xFCB9 /* ? */ -#define HFA384X_RID_CNFPASSIVESCANCTRL 0xFCBA /* added in STA f/w 1.5.0 */ -#define HFA384X_RID_SSNHANDLINGMODE 0xFCBB /* added in STA f/w 1.7.0 */ -#define HFA384X_RID_MDCCONTROL 0xFCBC /* added in STA f/w 1.7.0 */ -#define HFA384X_RID_MDCCOUNTRY 0xFCBD /* added in STA f/w 1.7.0 */ -#define HFA384X_RID_TXPOWERMAX 0xFCBE /* added in STA f/w 1.7.0 */ -#define HFA384X_RID_CNFLFOENABLED 0xFCBF /* added in STA f/w 1.6.3 */ -#define HFA384X_RID_CAPINFO 0xFCC0 /* added in STA f/w 1.7.0 */ -#define HFA384X_RID_LISTENINTERVAL 0xFCC1 /* added in STA f/w 1.7.0 */ -#define HFA384X_RID_SW_ANT_DIV 0xFCC2 /* added in STA f/w 1.7.0; Prism3 */ -#define HFA384X_RID_LED_CTRL 0xFCC4 /* added in STA f/w 1.7.6 */ -#define HFA384X_RID_HFODELAY 0xFCC5 /* added in STA f/w 1.7.6 */ -#define HFA384X_RID_DISALLOWEDBSSID 0xFCC6 /* added in STA f/w 1.8.0 */ -#define HFA384X_RID_TICKTIME 0xFCE0 -#define HFA384X_RID_SCANREQUEST 0xFCE1 -#define HFA384X_RID_JOINREQUEST 0xFCE2 -#define HFA384X_RID_AUTHENTICATESTATION 0xFCE3 /* AP f/w only */ -#define HFA384X_RID_CHANNELINFOREQUEST 0xFCE4 /* AP f/w only */ -#define HFA384X_RID_HOSTSCAN 0xFCE5 /* added in STA f/w 1.3.1 */ - -/* HFA384X Information RIDs */ -#define HFA384X_RID_MAXLOADTIME 0xFD00 -#define HFA384X_RID_DOWNLOADBUFFER 0xFD01 -#define HFA384X_RID_PRIID 0xFD02 -#define HFA384X_RID_PRISUPRANGE 0xFD03 -#define HFA384X_RID_CFIACTRANGES 0xFD04 -#define HFA384X_RID_NICSERNUM 0xFD0A -#define HFA384X_RID_NICID 0xFD0B -#define HFA384X_RID_MFISUPRANGE 0xFD0C -#define HFA384X_RID_CFISUPRANGE 0xFD0D -#define HFA384X_RID_CHANNELLIST 0xFD10 -#define HFA384X_RID_REGULATORYDOMAINS 0xFD11 -#define HFA384X_RID_TEMPTYPE 0xFD12 -#define HFA384X_RID_CIS 0xFD13 -#define HFA384X_RID_STAID 0xFD20 -#define HFA384X_RID_STASUPRANGE 0xFD21 -#define HFA384X_RID_MFIACTRANGES 0xFD22 -#define HFA384X_RID_CFIACTRANGES2 0xFD23 -#define HFA384X_RID_PRODUCTNAME 0xFD24 /* added in STA f/w 1.3.1; - * only Prism2.5(?) */ -#define HFA384X_RID_PORTSTATUS 0xFD40 -#define HFA384X_RID_CURRENTSSID 0xFD41 -#define HFA384X_RID_CURRENTBSSID 0xFD42 -#define HFA384X_RID_COMMSQUALITY 0xFD43 -#define HFA384X_RID_CURRENTTXRATE 0xFD44 -#define HFA384X_RID_CURRENTBEACONINTERVAL 0xFD45 -#define HFA384X_RID_CURRENTSCALETHRESHOLDS 0xFD46 -#define HFA384X_RID_PROTOCOLRSPTIME 0xFD47 -#define HFA384X_RID_SHORTRETRYLIMIT 0xFD48 -#define HFA384X_RID_LONGRETRYLIMIT 0xFD49 -#define HFA384X_RID_MAXTRANSMITLIFETIME 0xFD4A -#define HFA384X_RID_MAXRECEIVELIFETIME 0xFD4B -#define HFA384X_RID_CFPOLLABLE 0xFD4C -#define HFA384X_RID_AUTHENTICATIONALGORITHMS 0xFD4D -#define HFA384X_RID_PRIVACYOPTIONIMPLEMENTED 0xFD4F -#define HFA384X_RID_DBMCOMMSQUALITY 0xFD51 /* added in STA f/w 1.3.1 */ -#define HFA384X_RID_CURRENTTXRATE1 0xFD80 /* AP f/w only */ -#define HFA384X_RID_CURRENTTXRATE2 0xFD81 /* AP f/w only */ -#define HFA384X_RID_CURRENTTXRATE3 0xFD82 /* AP f/w only */ -#define HFA384X_RID_CURRENTTXRATE4 0xFD83 /* AP f/w only */ -#define HFA384X_RID_CURRENTTXRATE5 0xFD84 /* AP f/w only */ -#define HFA384X_RID_CURRENTTXRATE6 0xFD85 /* AP f/w only */ -#define HFA384X_RID_OWNMACADDR 0xFD86 /* AP f/w only */ -#define HFA384X_RID_SCANRESULTSTABLE 0xFD88 /* added in STA f/w 0.8.3 */ -#define HFA384X_RID_HOSTSCANRESULTS 0xFD89 /* added in STA f/w 1.3.1 */ -#define HFA384X_RID_AUTHENTICATIONUSED 0xFD8A /* added in STA f/w 1.3.4 */ -#define HFA384X_RID_CNFFAASWITCHCTRL 0xFD8B /* added in STA f/w 1.6.3 */ -#define HFA384X_RID_ASSOCIATIONFAILURE 0xFD8D /* added in STA f/w 1.8.0 */ -#define HFA384X_RID_PHYTYPE 0xFDC0 -#define HFA384X_RID_CURRENTCHANNEL 0xFDC1 -#define HFA384X_RID_CURRENTPOWERSTATE 0xFDC2 -#define HFA384X_RID_CCAMODE 0xFDC3 -#define HFA384X_RID_SUPPORTEDDATARATES 0xFDC6 -#define HFA384X_RID_LFO_VOLT_REG_TEST_RES 0xFDC7 /* added in STA f/w 1.7.1 */ -#define HFA384X_RID_BUILDSEQ 0xFFFE -#define HFA384X_RID_FWID 0xFFFF - - -struct hfa384x_comp_ident -{ - __le16 id; - __le16 variant; - __le16 major; - __le16 minor; -} __packed; - -#define HFA384X_COMP_ID_PRI 0x15 -#define HFA384X_COMP_ID_STA 0x1f -#define HFA384X_COMP_ID_FW_AP 0x14b - -struct hfa384x_sup_range -{ - __le16 role; - __le16 id; - __le16 variant; - __le16 bottom; - __le16 top; -} __packed; - - -struct hfa384x_build_id -{ - __le16 pri_seq; - __le16 sec_seq; -} __packed; - -/* FD01 - Download Buffer */ -struct hfa384x_rid_download_buffer -{ - __le16 page; - __le16 offset; - __le16 length; -} __packed; - -/* BSS connection quality (RID FD43 range, RID FD51 dBm-normalized) */ -struct hfa384x_comms_quality { - __le16 comm_qual; /* 0 .. 92 */ - __le16 signal_level; /* 27 .. 154 */ - __le16 noise_level; /* 27 .. 154 */ -} __packed; - - -/* netdevice private ioctls (used, e.g., with iwpriv from user space) */ - -/* New wireless extensions API - SET/GET convention (even ioctl numbers are - * root only) - */ -#define PRISM2_IOCTL_PRISM2_PARAM (SIOCIWFIRSTPRIV + 0) -#define PRISM2_IOCTL_GET_PRISM2_PARAM (SIOCIWFIRSTPRIV + 1) -#define PRISM2_IOCTL_WRITEMIF (SIOCIWFIRSTPRIV + 2) -#define PRISM2_IOCTL_READMIF (SIOCIWFIRSTPRIV + 3) -#define PRISM2_IOCTL_MONITOR (SIOCIWFIRSTPRIV + 4) -#define PRISM2_IOCTL_RESET (SIOCIWFIRSTPRIV + 6) -#define PRISM2_IOCTL_INQUIRE (SIOCIWFIRSTPRIV + 8) -#define PRISM2_IOCTL_WDS_ADD (SIOCIWFIRSTPRIV + 10) -#define PRISM2_IOCTL_WDS_DEL (SIOCIWFIRSTPRIV + 12) -#define PRISM2_IOCTL_SET_RID_WORD (SIOCIWFIRSTPRIV + 14) -#define PRISM2_IOCTL_MACCMD (SIOCIWFIRSTPRIV + 16) -#define PRISM2_IOCTL_ADDMAC (SIOCIWFIRSTPRIV + 18) -#define PRISM2_IOCTL_DELMAC (SIOCIWFIRSTPRIV + 20) -#define PRISM2_IOCTL_KICKMAC (SIOCIWFIRSTPRIV + 22) - -/* following are not in SIOCGIWPRIV list; check permission in the driver code - */ -#define PRISM2_IOCTL_DOWNLOAD (SIOCDEVPRIVATE + 13) -#define PRISM2_IOCTL_HOSTAPD (SIOCDEVPRIVATE + 14) - - -/* PRISM2_IOCTL_PRISM2_PARAM ioctl() subtypes: */ -enum { - /* PRISM2_PARAM_PTYPE = 1, */ /* REMOVED 2003-10-22 */ - PRISM2_PARAM_TXRATECTRL = 2, - PRISM2_PARAM_BEACON_INT = 3, - PRISM2_PARAM_PSEUDO_IBSS = 4, - PRISM2_PARAM_ALC = 5, - /* PRISM2_PARAM_TXPOWER = 6, */ /* REMOVED 2003-10-22 */ - PRISM2_PARAM_DUMP = 7, - PRISM2_PARAM_OTHER_AP_POLICY = 8, - PRISM2_PARAM_AP_MAX_INACTIVITY = 9, - PRISM2_PARAM_AP_BRIDGE_PACKETS = 10, - PRISM2_PARAM_DTIM_PERIOD = 11, - PRISM2_PARAM_AP_NULLFUNC_ACK = 12, - PRISM2_PARAM_MAX_WDS = 13, - PRISM2_PARAM_AP_AUTOM_AP_WDS = 14, - PRISM2_PARAM_AP_AUTH_ALGS = 15, - PRISM2_PARAM_MONITOR_ALLOW_FCSERR = 16, - PRISM2_PARAM_HOST_ENCRYPT = 17, - PRISM2_PARAM_HOST_DECRYPT = 18, - /* PRISM2_PARAM_BUS_MASTER_THRESHOLD_RX = 19, REMOVED 2005-08-14 */ - /* PRISM2_PARAM_BUS_MASTER_THRESHOLD_TX = 20, REMOVED 2005-08-14 */ - PRISM2_PARAM_HOST_ROAMING = 21, - PRISM2_PARAM_BCRX_STA_KEY = 22, - PRISM2_PARAM_IEEE_802_1X = 23, - PRISM2_PARAM_ANTSEL_TX = 24, - PRISM2_PARAM_ANTSEL_RX = 25, - PRISM2_PARAM_MONITOR_TYPE = 26, - PRISM2_PARAM_WDS_TYPE = 27, - PRISM2_PARAM_HOSTSCAN = 28, - PRISM2_PARAM_AP_SCAN = 29, - PRISM2_PARAM_ENH_SEC = 30, - PRISM2_PARAM_IO_DEBUG = 31, - PRISM2_PARAM_BASIC_RATES = 32, - PRISM2_PARAM_OPER_RATES = 33, - PRISM2_PARAM_HOSTAPD = 34, - PRISM2_PARAM_HOSTAPD_STA = 35, - PRISM2_PARAM_WPA = 36, - PRISM2_PARAM_PRIVACY_INVOKED = 37, - PRISM2_PARAM_TKIP_COUNTERMEASURES = 38, - PRISM2_PARAM_DROP_UNENCRYPTED = 39, - PRISM2_PARAM_SCAN_CHANNEL_MASK = 40, -}; - -enum { HOSTAP_ANTSEL_DO_NOT_TOUCH = 0, HOSTAP_ANTSEL_DIVERSITY = 1, - HOSTAP_ANTSEL_LOW = 2, HOSTAP_ANTSEL_HIGH = 3 }; - - -/* PRISM2_IOCTL_MACCMD ioctl() subcommands: */ -enum { AP_MAC_CMD_POLICY_OPEN = 0, AP_MAC_CMD_POLICY_ALLOW = 1, - AP_MAC_CMD_POLICY_DENY = 2, AP_MAC_CMD_FLUSH = 3, - AP_MAC_CMD_KICKALL = 4 }; - - -/* PRISM2_IOCTL_DOWNLOAD ioctl() dl_cmd: */ -enum { - PRISM2_DOWNLOAD_VOLATILE = 1 /* RAM */, - /* Note! Old versions of prism2_srec have a fatal error in CRC-16 - * calculation, which will corrupt all non-volatile downloads. - * PRISM2_DOWNLOAD_NON_VOLATILE used to be 2, but it is now 3 to - * prevent use of old versions of prism2_srec for non-volatile - * download. */ - PRISM2_DOWNLOAD_NON_VOLATILE = 3 /* FLASH */, - PRISM2_DOWNLOAD_VOLATILE_GENESIS = 4 /* RAM in Genesis mode */, - /* Persistent versions of volatile download commands (keep firmware - * data in memory and automatically re-download after hw_reset */ - PRISM2_DOWNLOAD_VOLATILE_PERSISTENT = 5, - PRISM2_DOWNLOAD_VOLATILE_GENESIS_PERSISTENT = 6, -}; - -struct prism2_download_param { - u32 dl_cmd; - u32 start_addr; - u32 num_areas; - struct prism2_download_area { - u32 addr; /* wlan card address */ - u32 len; - void __user *ptr; /* pointer to data in user space */ - } data[0]; -}; - -#define PRISM2_MAX_DOWNLOAD_AREA_LEN 131072 -#define PRISM2_MAX_DOWNLOAD_LEN 262144 - - -/* PRISM2_IOCTL_HOSTAPD ioctl() cmd: */ -enum { - PRISM2_HOSTAPD_FLUSH = 1, - PRISM2_HOSTAPD_ADD_STA = 2, - PRISM2_HOSTAPD_REMOVE_STA = 3, - PRISM2_HOSTAPD_GET_INFO_STA = 4, - /* REMOVED: PRISM2_HOSTAPD_RESET_TXEXC_STA = 5, */ - PRISM2_SET_ENCRYPTION = 6, - PRISM2_GET_ENCRYPTION = 7, - PRISM2_HOSTAPD_SET_FLAGS_STA = 8, - PRISM2_HOSTAPD_GET_RID = 9, - PRISM2_HOSTAPD_SET_RID = 10, - PRISM2_HOSTAPD_SET_ASSOC_AP_ADDR = 11, - PRISM2_HOSTAPD_SET_GENERIC_ELEMENT = 12, - PRISM2_HOSTAPD_MLME = 13, - PRISM2_HOSTAPD_SCAN_REQ = 14, - PRISM2_HOSTAPD_STA_CLEAR_STATS = 15, -}; - -#define PRISM2_HOSTAPD_MAX_BUF_SIZE 1024 -#define PRISM2_HOSTAPD_RID_HDR_LEN \ -offsetof(struct prism2_hostapd_param, u.rid.data) -#define PRISM2_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \ -offsetof(struct prism2_hostapd_param, u.generic_elem.data) - -/* Maximum length for algorithm names (-1 for nul termination) used in ioctl() - */ -#define HOSTAP_CRYPT_ALG_NAME_LEN 16 - - -struct prism2_hostapd_param { - u32 cmd; - u8 sta_addr[ETH_ALEN]; - union { - struct { - u16 aid; - u16 capability; - u8 tx_supp_rates; - } add_sta; - struct { - u32 inactive_sec; - } get_info_sta; - struct { - u8 alg[HOSTAP_CRYPT_ALG_NAME_LEN]; - u32 flags; - u32 err; - u8 idx; - u8 seq[8]; /* sequence counter (set: RX, get: TX) */ - u16 key_len; - u8 key[0]; - } crypt; - struct { - u32 flags_and; - u32 flags_or; - } set_flags_sta; - struct { - u16 rid; - u16 len; - u8 data[0]; - } rid; - struct { - u8 len; - u8 data[0]; - } generic_elem; - struct { -#define MLME_STA_DEAUTH 0 -#define MLME_STA_DISASSOC 1 - u16 cmd; - u16 reason_code; - } mlme; - struct { - u8 ssid_len; - u8 ssid[32]; - } scan_req; - } u; -}; - -#define HOSTAP_CRYPT_FLAG_SET_TX_KEY BIT(0) -#define HOSTAP_CRYPT_FLAG_PERMANENT BIT(1) - -#define HOSTAP_CRYPT_ERR_UNKNOWN_ALG 2 -#define HOSTAP_CRYPT_ERR_UNKNOWN_ADDR 3 -#define HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED 4 -#define HOSTAP_CRYPT_ERR_KEY_SET_FAILED 5 -#define HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED 6 -#define HOSTAP_CRYPT_ERR_CARD_CONF_FAILED 7 - - -#endif /* HOSTAP_COMMON_H */ diff --git a/drivers/net/wireless/hostap/hostap_config.h b/drivers/net/wireless/hostap/hostap_config.h deleted file mode 100644 index 2c8f71f0ed45..000000000000 --- a/drivers/net/wireless/hostap/hostap_config.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef HOSTAP_CONFIG_H -#define HOSTAP_CONFIG_H - -/* In the previous versions of Host AP driver, support for user space version - * of IEEE 802.11 management (hostapd) used to be disabled in the default - * configuration. From now on, support for hostapd is always included and it is - * possible to disable kernel driver version of IEEE 802.11 management with a - * separate define, PRISM2_NO_KERNEL_IEEE80211_MGMT. */ -/* #define PRISM2_NO_KERNEL_IEEE80211_MGMT */ - -/* Maximum number of events handler per one interrupt */ -#define PRISM2_MAX_INTERRUPT_EVENTS 20 - -/* Include code for downloading firmware images into volatile RAM. */ -#define PRISM2_DOWNLOAD_SUPPORT - -/* Allow kernel configuration to enable download support. */ -#if !defined(PRISM2_DOWNLOAD_SUPPORT) && defined(CONFIG_HOSTAP_FIRMWARE) -#define PRISM2_DOWNLOAD_SUPPORT -#endif - -/* Allow kernel configuration to enable non-volatile download support. */ -#ifdef CONFIG_HOSTAP_FIRMWARE_NVRAM -#define PRISM2_NON_VOLATILE_DOWNLOAD -#endif - -/* Save low-level I/O for debugging. This should not be enabled in normal use. - */ -/* #define PRISM2_IO_DEBUG */ - -/* Following defines can be used to remove unneeded parts of the driver, e.g., - * to limit the size of the kernel module. Definitions can be added here in - * hostap_config.h or they can be added to make command with ccflags-y, - * e.g., - * 'make pccard ccflags-y="-DPRISM2_NO_DEBUG -DPRISM2_NO_PROCFS_DEBUG"' - */ - -/* Do not include debug messages into the driver */ -/* #define PRISM2_NO_DEBUG */ - -/* Do not include /proc/net/prism2/wlan#/{registers,debug} */ -/* #define PRISM2_NO_PROCFS_DEBUG */ - -/* Do not include station functionality (i.e., allow only Master (Host AP) mode - */ -/* #define PRISM2_NO_STATION_MODES */ - -#endif /* HOSTAP_CONFIG_H */ diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c deleted file mode 100644 index 56cd01ca8ad0..000000000000 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ /dev/null @@ -1,712 +0,0 @@ -#define PRISM2_PCCARD - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "hostap_wlan.h" - - -static char *dev_info = "hostap_cs"; - -MODULE_AUTHOR("Jouni Malinen"); -MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " - "cards (PC Card)."); -MODULE_SUPPORTED_DEVICE("Intersil Prism2-based WLAN cards (PC Card)"); -MODULE_LICENSE("GPL"); - - -static int ignore_cis_vcc; -module_param(ignore_cis_vcc, int, 0444); -MODULE_PARM_DESC(ignore_cis_vcc, "Ignore broken CIS VCC entry"); - - -/* struct local_info::hw_priv */ -struct hostap_cs_priv { - struct pcmcia_device *link; - int sandisk_connectplus; -}; - - -#ifdef PRISM2_IO_DEBUG - -static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v) -{ - struct hostap_interface *iface; - local_info_t *local; - unsigned long flags; - - iface = netdev_priv(dev); - local = iface->local; - spin_lock_irqsave(&local->lock, flags); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v); - outb(v, dev->base_addr + a); - spin_unlock_irqrestore(&local->lock, flags); -} - -static inline u8 hfa384x_inb_debug(struct net_device *dev, int a) -{ - struct hostap_interface *iface; - local_info_t *local; - unsigned long flags; - u8 v; - - iface = netdev_priv(dev); - local = iface->local; - spin_lock_irqsave(&local->lock, flags); - v = inb(dev->base_addr + a); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INB, a, v); - spin_unlock_irqrestore(&local->lock, flags); - return v; -} - -static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v) -{ - struct hostap_interface *iface; - local_info_t *local; - unsigned long flags; - - iface = netdev_priv(dev); - local = iface->local; - spin_lock_irqsave(&local->lock, flags); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v); - outw(v, dev->base_addr + a); - spin_unlock_irqrestore(&local->lock, flags); -} - -static inline u16 hfa384x_inw_debug(struct net_device *dev, int a) -{ - struct hostap_interface *iface; - local_info_t *local; - unsigned long flags; - u16 v; - - iface = netdev_priv(dev); - local = iface->local; - spin_lock_irqsave(&local->lock, flags); - v = inw(dev->base_addr + a); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INW, a, v); - spin_unlock_irqrestore(&local->lock, flags); - return v; -} - -static inline void hfa384x_outsw_debug(struct net_device *dev, int a, - u8 *buf, int wc) -{ - struct hostap_interface *iface; - local_info_t *local; - unsigned long flags; - - iface = netdev_priv(dev); - local = iface->local; - spin_lock_irqsave(&local->lock, flags); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTSW, a, wc); - outsw(dev->base_addr + a, buf, wc); - spin_unlock_irqrestore(&local->lock, flags); -} - -static inline void hfa384x_insw_debug(struct net_device *dev, int a, - u8 *buf, int wc) -{ - struct hostap_interface *iface; - local_info_t *local; - unsigned long flags; - - iface = netdev_priv(dev); - local = iface->local; - spin_lock_irqsave(&local->lock, flags); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INSW, a, wc); - insw(dev->base_addr + a, buf, wc); - spin_unlock_irqrestore(&local->lock, flags); -} - -#define HFA384X_OUTB(v,a) hfa384x_outb_debug(dev, (a), (v)) -#define HFA384X_INB(a) hfa384x_inb_debug(dev, (a)) -#define HFA384X_OUTW(v,a) hfa384x_outw_debug(dev, (a), (v)) -#define HFA384X_INW(a) hfa384x_inw_debug(dev, (a)) -#define HFA384X_OUTSW(a, buf, wc) hfa384x_outsw_debug(dev, (a), (buf), (wc)) -#define HFA384X_INSW(a, buf, wc) hfa384x_insw_debug(dev, (a), (buf), (wc)) - -#else /* PRISM2_IO_DEBUG */ - -#define HFA384X_OUTB(v,a) outb((v), dev->base_addr + (a)) -#define HFA384X_INB(a) inb(dev->base_addr + (a)) -#define HFA384X_OUTW(v,a) outw((v), dev->base_addr + (a)) -#define HFA384X_INW(a) inw(dev->base_addr + (a)) -#define HFA384X_INSW(a, buf, wc) insw(dev->base_addr + (a), buf, wc) -#define HFA384X_OUTSW(a, buf, wc) outsw(dev->base_addr + (a), buf, wc) - -#endif /* PRISM2_IO_DEBUG */ - - -static int hfa384x_from_bap(struct net_device *dev, u16 bap, void *buf, - int len) -{ - u16 d_off; - u16 *pos; - - d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF; - pos = (u16 *) buf; - - if (len / 2) - HFA384X_INSW(d_off, buf, len / 2); - pos += len / 2; - - if (len & 1) - *((char *) pos) = HFA384X_INB(d_off); - - return 0; -} - - -static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len) -{ - u16 d_off; - u16 *pos; - - d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF; - pos = (u16 *) buf; - - if (len / 2) - HFA384X_OUTSW(d_off, buf, len / 2); - pos += len / 2; - - if (len & 1) - HFA384X_OUTB(*((char *) pos), d_off); - - return 0; -} - - -/* FIX: This might change at some point.. */ -#include "hostap_hw.c" - - - -static void prism2_detach(struct pcmcia_device *p_dev); -static void prism2_release(u_long arg); -static int prism2_config(struct pcmcia_device *link); - - -static int prism2_pccard_card_present(local_info_t *local) -{ - struct hostap_cs_priv *hw_priv = local->hw_priv; - if (hw_priv != NULL && hw_priv->link != NULL && pcmcia_dev_present(hw_priv->link)) - return 1; - return 0; -} - - -/* - * SanDisk CompactFlash WLAN Flashcard - Product Manual v1.0 - * Document No. 20-10-00058, January 2004 - * http://www.sandisk.com/pdf/industrial/ProdManualCFWLANv1.0.pdf - */ -#define SANDISK_WLAN_ACTIVATION_OFF 0x40 -#define SANDISK_HCR_OFF 0x42 - - -static void sandisk_set_iobase(local_info_t *local) -{ - int res; - struct hostap_cs_priv *hw_priv = local->hw_priv; - - res = pcmcia_write_config_byte(hw_priv->link, 0x10, - hw_priv->link->resource[0]->start & 0x00ff); - if (res != 0) { - printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" - " res=%d\n", res); - } - udelay(10); - - res = pcmcia_write_config_byte(hw_priv->link, 0x12, - (hw_priv->link->resource[0]->start >> 8) & 0x00ff); - if (res != 0) { - printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" - " res=%d\n", res); - } -} - - -static void sandisk_write_hcr(local_info_t *local, int hcr) -{ - struct net_device *dev = local->dev; - int i; - - HFA384X_OUTB(0x80, SANDISK_WLAN_ACTIVATION_OFF); - udelay(50); - for (i = 0; i < 10; i++) { - HFA384X_OUTB(hcr, SANDISK_HCR_OFF); - } - udelay(55); - HFA384X_OUTB(0x45, SANDISK_WLAN_ACTIVATION_OFF); -} - - -static int sandisk_enable_wireless(struct net_device *dev) -{ - int res, ret = 0; - struct hostap_interface *iface = netdev_priv(dev); - local_info_t *local = iface->local; - struct hostap_cs_priv *hw_priv = local->hw_priv; - - if (resource_size(hw_priv->link->resource[0]) < 0x42) { - /* Not enough ports to be SanDisk multi-function card */ - ret = -ENODEV; - goto done; - } - - if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) { - /* No SanDisk manfid found */ - ret = -ENODEV; - goto done; - } - - if (hw_priv->link->socket->functions < 2) { - /* No multi-function links found */ - ret = -ENODEV; - goto done; - } - - printk(KERN_DEBUG "%s: Multi-function SanDisk ConnectPlus detected" - " - using vendor-specific initialization\n", dev->name); - hw_priv->sandisk_connectplus = 1; - - res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, - COR_SOFT_RESET); - if (res != 0) { - printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", - dev->name, res); - goto done; - } - mdelay(5); - - /* - * Do not enable interrupts here to avoid some bogus events. Interrupts - * will be enabled during the first cor_sreset call. - */ - res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, - (COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | - COR_FUNC_ENA)); - if (res != 0) { - printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", - dev->name, res); - goto done; - } - mdelay(5); - - sandisk_set_iobase(local); - - HFA384X_OUTB(0xc5, SANDISK_WLAN_ACTIVATION_OFF); - udelay(10); - HFA384X_OUTB(0x4b, SANDISK_WLAN_ACTIVATION_OFF); - udelay(10); - -done: - return ret; -} - - -static void prism2_pccard_cor_sreset(local_info_t *local) -{ - int res; - u8 val; - struct hostap_cs_priv *hw_priv = local->hw_priv; - - if (!prism2_pccard_card_present(local)) - return; - - res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &val); - if (res != 0) { - printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", - res); - return; - } - printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n", - val); - - val |= COR_SOFT_RESET; - res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val); - if (res != 0) { - printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", - res); - return; - } - - mdelay(hw_priv->sandisk_connectplus ? 5 : 2); - - val &= ~COR_SOFT_RESET; - if (hw_priv->sandisk_connectplus) - val |= COR_IREQ_ENA; - res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val); - if (res != 0) { - printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", - res); - return; - } - - mdelay(hw_priv->sandisk_connectplus ? 5 : 2); - - if (hw_priv->sandisk_connectplus) - sandisk_set_iobase(local); -} - - -static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) -{ - int res; - u8 old_cor; - struct hostap_cs_priv *hw_priv = local->hw_priv; - - if (!prism2_pccard_card_present(local)) - return; - - if (hw_priv->sandisk_connectplus) { - sandisk_write_hcr(local, hcr); - return; - } - - res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &old_cor); - if (res != 0) { - printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " - "(%d)\n", res); - return; - } - printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n", - old_cor); - - res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, - old_cor | COR_SOFT_RESET); - if (res != 0) { - printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " - "(%d)\n", res); - return; - } - - mdelay(10); - - /* Setup Genesis mode */ - res = pcmcia_write_config_byte(hw_priv->link, CISREG_CCSR, hcr); - if (res != 0) { - printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " - "(%d)\n", res); - return; - } - mdelay(10); - - res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, - old_cor & ~COR_SOFT_RESET); - if (res != 0) { - printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " - "(%d)\n", res); - return; - } - - mdelay(10); -} - - -static struct prism2_helper_functions prism2_pccard_funcs = -{ - .card_present = prism2_pccard_card_present, - .cor_sreset = prism2_pccard_cor_sreset, - .genesis_reset = prism2_pccard_genesis_reset, - .hw_type = HOSTAP_HW_PCCARD, -}; - - -/* allocate local data and register with CardServices - * initialize dev_link structure, but do not configure the card yet */ -static int hostap_cs_probe(struct pcmcia_device *p_dev) -{ - int ret; - - PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); - - ret = prism2_config(p_dev); - if (ret) { - PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n"); - } - - return ret; -} - - -static void prism2_detach(struct pcmcia_device *link) -{ - PDEBUG(DEBUG_FLOW, "prism2_detach\n"); - - prism2_release((u_long)link); - - /* release net devices */ - if (link->priv) { - struct hostap_cs_priv *hw_priv; - struct net_device *dev; - struct hostap_interface *iface; - dev = link->priv; - iface = netdev_priv(dev); - hw_priv = iface->local->hw_priv; - prism2_free_local_data(dev); - kfree(hw_priv); - } -} - - -static int prism2_config_check(struct pcmcia_device *p_dev, void *priv_data) -{ - if (p_dev->config_index == 0) - return -EINVAL; - - return pcmcia_request_io(p_dev); -} - -static int prism2_config(struct pcmcia_device *link) -{ - struct net_device *dev; - struct hostap_interface *iface; - local_info_t *local; - int ret = 1; - struct hostap_cs_priv *hw_priv; - unsigned long flags; - - PDEBUG(DEBUG_FLOW, "prism2_config()\n"); - - hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL); - if (hw_priv == NULL) { - ret = -ENOMEM; - goto failed; - } - - /* Look for an appropriate configuration table entry in the CIS */ - link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | - CONF_AUTO_CHECK_VCC | CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; - if (ignore_cis_vcc) - link->config_flags &= ~CONF_AUTO_CHECK_VCC; - ret = pcmcia_loop_config(link, prism2_config_check, NULL); - if (ret) { - if (!ignore_cis_vcc) - printk(KERN_ERR "GetNextTuple(): No matching " - "CIS configuration. Maybe you need the " - "ignore_cis_vcc=1 parameter.\n"); - goto failed; - } - - /* Need to allocate net_device before requesting IRQ handler */ - dev = prism2_init_local_data(&prism2_pccard_funcs, 0, - &link->dev); - if (dev == NULL) - goto failed; - link->priv = dev; - - iface = netdev_priv(dev); - local = iface->local; - local->hw_priv = hw_priv; - hw_priv->link = link; - - /* - * We enable IRQ here, but IRQ handler will not proceed - * until dev->base_addr is set below. This protect us from - * receive interrupts when driver is not initialized. - */ - ret = pcmcia_request_irq(link, prism2_interrupt); - if (ret) - goto failed; - - ret = pcmcia_enable_device(link); - if (ret) - goto failed; - - spin_lock_irqsave(&local->irq_init_lock, flags); - dev->irq = link->irq; - dev->base_addr = link->resource[0]->start; - spin_unlock_irqrestore(&local->irq_init_lock, flags); - - local->shutdown = 0; - - sandisk_enable_wireless(dev); - - ret = prism2_hw_config(dev, 1); - if (!ret) - ret = hostap_hw_ready(dev); - - return ret; - - failed: - kfree(hw_priv); - prism2_release((u_long)link); - return ret; -} - - -static void prism2_release(u_long arg) -{ - struct pcmcia_device *link = (struct pcmcia_device *)arg; - - PDEBUG(DEBUG_FLOW, "prism2_release\n"); - - if (link->priv) { - struct net_device *dev = link->priv; - struct hostap_interface *iface; - - iface = netdev_priv(dev); - prism2_hw_shutdown(dev, 0); - iface->local->shutdown = 1; - } - - pcmcia_disable_device(link); - PDEBUG(DEBUG_FLOW, "release - done\n"); -} - -static int hostap_cs_suspend(struct pcmcia_device *link) -{ - struct net_device *dev = (struct net_device *) link->priv; - int dev_open = 0; - struct hostap_interface *iface = NULL; - - if (!dev) - return -ENODEV; - - iface = netdev_priv(dev); - - PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info); - if (iface && iface->local) - dev_open = iface->local->num_dev_open > 0; - if (dev_open) { - netif_stop_queue(dev); - netif_device_detach(dev); - } - prism2_suspend(dev); - - return 0; -} - -static int hostap_cs_resume(struct pcmcia_device *link) -{ - struct net_device *dev = (struct net_device *) link->priv; - int dev_open = 0; - struct hostap_interface *iface = NULL; - - if (!dev) - return -ENODEV; - - iface = netdev_priv(dev); - - PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_RESUME\n", dev_info); - - if (iface && iface->local) - dev_open = iface->local->num_dev_open > 0; - - prism2_hw_shutdown(dev, 1); - prism2_hw_config(dev, dev_open ? 0 : 1); - if (dev_open) { - netif_device_attach(dev); - netif_start_queue(dev); - } - - return 0; -} - -static const struct pcmcia_device_id hostap_cs_ids[] = { - PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), - PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), - PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), - PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000), - PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), - PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x3301), - PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), - PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b), - PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), - PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), - PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), - PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), - PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001), - PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001), - PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), -/* PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), conflict with pcnet_cs */ - PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), - PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), - PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), - PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010), - PCMCIA_DEVICE_MANF_CARD(0x0126, 0x0002), - PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0xd601, 0x0005, "ADLINK 345 CF", - 0x2d858104), - PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "INTERSIL", - 0x74c5e40d), - PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "Intersil", - 0x4b801a17), - PCMCIA_DEVICE_MANF_CARD_PROD_ID3(0x0156, 0x0002, "Version 01.02", - 0x4b74baa0), - PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus", - 0x7a954bd9, 0x74be00c6), - PCMCIA_DEVICE_PROD_ID123( - "Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02", - 0xe6ec52ce, 0x08649af2, 0x4b74baa0), - PCMCIA_DEVICE_PROD_ID123( - "Canon", "Wireless LAN CF Card K30225", "Version 01.00", - 0x96ef6fe2, 0x263fcbab, 0xa57adb8c), - PCMCIA_DEVICE_PROD_ID123( - "D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02", - 0x71b18589, 0xb6f1b0ab, 0x4b74baa0), - PCMCIA_DEVICE_PROD_ID123( - "Instant Wireless ", " Network PC CARD", "Version 01.02", - 0x11d901af, 0x6e9bd926, 0x4b74baa0), - PCMCIA_DEVICE_PROD_ID123( - "SMC", "SMC2632W", "Version 01.02", - 0xc4f8b18b, 0x474a1f2a, 0x4b74baa0), - PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G", - 0x2decece3, 0x82067c18), - PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card", - 0x54f7c49c, 0x15a75e5b), - PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", - 0x74c5e40d, 0xdb472a18), - PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card", - 0x0733cc81, 0x0c52f395), - PCMCIA_DEVICE_PROD_ID12( - "ZoomAir 11Mbps High", "Rate wireless Networking", - 0x273fe3db, 0x32a1eaee), - PCMCIA_DEVICE_PROD_ID123( - "Pretec", "CompactWLAN Card 802.11b", "2.5", - 0x1cadd3e5, 0xe697636c, 0x7a5bfcf1), - PCMCIA_DEVICE_PROD_ID123( - "U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02", - 0xc7b8df9d, 0x1700d087, 0x4b74baa0), - PCMCIA_DEVICE_PROD_ID123( - "Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", - "Ver. 1.00", - 0x5cd01705, 0x4271660f, 0x9d08ee12), - PCMCIA_DEVICE_PROD_ID123( - "Wireless LAN" , "11Mbps PC Card", "Version 01.02", - 0x4b8870ff, 0x70e946d1, 0x4b74baa0), - PCMCIA_DEVICE_PROD_ID3("HFA3863", 0x355cb092), - PCMCIA_DEVICE_PROD_ID3("ISL37100P", 0x630d52b2), - PCMCIA_DEVICE_PROD_ID3("ISL37101P-10", 0xdd97a26b), - PCMCIA_DEVICE_PROD_ID3("ISL37300P", 0xc9049a39), - PCMCIA_DEVICE_NULL -}; -MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids); - - -static struct pcmcia_driver hostap_driver = { - .name = "hostap_cs", - .probe = hostap_cs_probe, - .remove = prism2_detach, - .owner = THIS_MODULE, - .id_table = hostap_cs_ids, - .suspend = hostap_cs_suspend, - .resume = hostap_cs_resume, -}; -module_pcmcia_driver(hostap_driver); diff --git a/drivers/net/wireless/hostap/hostap_download.c b/drivers/net/wireless/hostap/hostap_download.c deleted file mode 100644 index 705fe668b969..000000000000 --- a/drivers/net/wireless/hostap/hostap_download.c +++ /dev/null @@ -1,812 +0,0 @@ -static int prism2_enable_aux_port(struct net_device *dev, int enable) -{ - u16 val, reg; - int i, tries; - unsigned long flags; - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->no_pri) { - if (enable) { - PDEBUG(DEBUG_EXTRA2, "%s: no PRI f/w - assuming Aux " - "port is already enabled\n", dev->name); - } - return 0; - } - - spin_lock_irqsave(&local->cmdlock, flags); - - /* wait until busy bit is clear */ - tries = HFA384X_CMD_BUSY_TIMEOUT; - while (HFA384X_INW(HFA384X_CMD_OFF) & HFA384X_CMD_BUSY && tries > 0) { - tries--; - udelay(1); - } - if (tries == 0) { - reg = HFA384X_INW(HFA384X_CMD_OFF); - spin_unlock_irqrestore(&local->cmdlock, flags); - printk("%s: prism2_enable_aux_port - timeout - reg=0x%04x\n", - dev->name, reg); - return -ETIMEDOUT; - } - - val = HFA384X_INW(HFA384X_CONTROL_OFF); - - if (enable) { - HFA384X_OUTW(HFA384X_AUX_MAGIC0, HFA384X_PARAM0_OFF); - HFA384X_OUTW(HFA384X_AUX_MAGIC1, HFA384X_PARAM1_OFF); - HFA384X_OUTW(HFA384X_AUX_MAGIC2, HFA384X_PARAM2_OFF); - - if ((val & HFA384X_AUX_PORT_MASK) != HFA384X_AUX_PORT_DISABLED) - printk("prism2_enable_aux_port: was not disabled!?\n"); - val &= ~HFA384X_AUX_PORT_MASK; - val |= HFA384X_AUX_PORT_ENABLE; - } else { - HFA384X_OUTW(0, HFA384X_PARAM0_OFF); - HFA384X_OUTW(0, HFA384X_PARAM1_OFF); - HFA384X_OUTW(0, HFA384X_PARAM2_OFF); - - if ((val & HFA384X_AUX_PORT_MASK) != HFA384X_AUX_PORT_ENABLED) - printk("prism2_enable_aux_port: was not enabled!?\n"); - val &= ~HFA384X_AUX_PORT_MASK; - val |= HFA384X_AUX_PORT_DISABLE; - } - HFA384X_OUTW(val, HFA384X_CONTROL_OFF); - - udelay(5); - - i = 10000; - while (i > 0) { - val = HFA384X_INW(HFA384X_CONTROL_OFF); - val &= HFA384X_AUX_PORT_MASK; - - if ((enable && val == HFA384X_AUX_PORT_ENABLED) || - (!enable && val == HFA384X_AUX_PORT_DISABLED)) - break; - - udelay(10); - i--; - } - - spin_unlock_irqrestore(&local->cmdlock, flags); - - if (i == 0) { - printk("prism2_enable_aux_port(%d) timed out\n", - enable); - return -ETIMEDOUT; - } - - return 0; -} - - -static int hfa384x_from_aux(struct net_device *dev, unsigned int addr, int len, - void *buf) -{ - u16 page, offset; - if (addr & 1 || len & 1) - return -1; - - page = addr >> 7; - offset = addr & 0x7f; - - HFA384X_OUTW(page, HFA384X_AUXPAGE_OFF); - HFA384X_OUTW(offset, HFA384X_AUXOFFSET_OFF); - - udelay(5); - -#ifdef PRISM2_PCI - { - __le16 *pos = (__le16 *) buf; - while (len > 0) { - *pos++ = HFA384X_INW_DATA(HFA384X_AUXDATA_OFF); - len -= 2; - } - } -#else /* PRISM2_PCI */ - HFA384X_INSW(HFA384X_AUXDATA_OFF, buf, len / 2); -#endif /* PRISM2_PCI */ - - return 0; -} - - -static int hfa384x_to_aux(struct net_device *dev, unsigned int addr, int len, - void *buf) -{ - u16 page, offset; - if (addr & 1 || len & 1) - return -1; - - page = addr >> 7; - offset = addr & 0x7f; - - HFA384X_OUTW(page, HFA384X_AUXPAGE_OFF); - HFA384X_OUTW(offset, HFA384X_AUXOFFSET_OFF); - - udelay(5); - -#ifdef PRISM2_PCI - { - __le16 *pos = (__le16 *) buf; - while (len > 0) { - HFA384X_OUTW_DATA(*pos++, HFA384X_AUXDATA_OFF); - len -= 2; - } - } -#else /* PRISM2_PCI */ - HFA384X_OUTSW(HFA384X_AUXDATA_OFF, buf, len / 2); -#endif /* PRISM2_PCI */ - - return 0; -} - - -static int prism2_pda_ok(u8 *buf) -{ - __le16 *pda = (__le16 *) buf; - int pos; - u16 len, pdr; - - if (buf[0] == 0xff && buf[1] == 0x00 && buf[2] == 0xff && - buf[3] == 0x00) - return 0; - - pos = 0; - while (pos + 1 < PRISM2_PDA_SIZE / 2) { - len = le16_to_cpu(pda[pos]); - pdr = le16_to_cpu(pda[pos + 1]); - if (len == 0 || pos + len > PRISM2_PDA_SIZE / 2) - return 0; - - if (pdr == 0x0000 && len == 2) { - /* PDA end found */ - return 1; - } - - pos += len + 1; - } - - return 0; -} - - -#define prism2_download_aux_dump_npages 65536 - -struct prism2_download_aux_dump { - local_info_t *local; - u16 page[0x80]; -}; - -static int prism2_download_aux_dump_proc_show(struct seq_file *m, void *v) -{ - struct prism2_download_aux_dump *ctx = m->private; - - hfa384x_from_aux(ctx->local->dev, (unsigned long)v - 1, 0x80, ctx->page); - seq_write(m, ctx->page, 0x80); - return 0; -} - -static void *prism2_download_aux_dump_proc_start(struct seq_file *m, loff_t *_pos) -{ - struct prism2_download_aux_dump *ctx = m->private; - prism2_enable_aux_port(ctx->local->dev, 1); - if (*_pos >= prism2_download_aux_dump_npages) - return NULL; - return (void *)((unsigned long)*_pos + 1); -} - -static void *prism2_download_aux_dump_proc_next(struct seq_file *m, void *v, loff_t *_pos) -{ - ++*_pos; - if (*_pos >= prism2_download_aux_dump_npages) - return NULL; - return (void *)((unsigned long)*_pos + 1); -} - -static void prism2_download_aux_dump_proc_stop(struct seq_file *m, void *v) -{ - struct prism2_download_aux_dump *ctx = m->private; - prism2_enable_aux_port(ctx->local->dev, 0); -} - -static const struct seq_operations prism2_download_aux_dump_proc_seqops = { - .start = prism2_download_aux_dump_proc_start, - .next = prism2_download_aux_dump_proc_next, - .stop = prism2_download_aux_dump_proc_stop, - .show = prism2_download_aux_dump_proc_show, -}; - -static int prism2_download_aux_dump_proc_open(struct inode *inode, struct file *file) -{ - int ret = seq_open_private(file, &prism2_download_aux_dump_proc_seqops, - sizeof(struct prism2_download_aux_dump)); - if (ret == 0) { - struct seq_file *m = file->private_data; - m->private = PDE_DATA(inode); - } - return ret; -} - -static const struct file_operations prism2_download_aux_dump_proc_fops = { - .open = prism2_download_aux_dump_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release_private, -}; - - -static u8 * prism2_read_pda(struct net_device *dev) -{ - u8 *buf; - int res, i, found = 0; -#define NUM_PDA_ADDRS 4 - unsigned int pda_addr[NUM_PDA_ADDRS] = { - 0x7f0000 /* others than HFA3841 */, - 0x3f0000 /* HFA3841 */, - 0x390000 /* apparently used in older cards */, - 0x7f0002 /* Intel PRO/Wireless 2011B (PCI) */, - }; - - buf = kmalloc(PRISM2_PDA_SIZE, GFP_KERNEL); - if (buf == NULL) - return NULL; - - /* Note: wlan card should be in initial state (just after init cmd) - * and no other operations should be performed concurrently. */ - - prism2_enable_aux_port(dev, 1); - - for (i = 0; i < NUM_PDA_ADDRS; i++) { - PDEBUG(DEBUG_EXTRA2, "%s: trying to read PDA from 0x%08x", - dev->name, pda_addr[i]); - res = hfa384x_from_aux(dev, pda_addr[i], PRISM2_PDA_SIZE, buf); - if (res) - continue; - if (res == 0 && prism2_pda_ok(buf)) { - PDEBUG2(DEBUG_EXTRA2, ": OK\n"); - found = 1; - break; - } else { - PDEBUG2(DEBUG_EXTRA2, ": failed\n"); - } - } - - prism2_enable_aux_port(dev, 0); - - if (!found) { - printk(KERN_DEBUG "%s: valid PDA not found\n", dev->name); - kfree(buf); - buf = NULL; - } - - return buf; -} - - -static int prism2_download_volatile(local_info_t *local, - struct prism2_download_data *param) -{ - struct net_device *dev = local->dev; - int ret = 0, i; - u16 param0, param1; - - if (local->hw_downloading) { - printk(KERN_WARNING "%s: Already downloading - aborting new " - "request\n", dev->name); - return -1; - } - - local->hw_downloading = 1; - if (local->pri_only) { - hfa384x_disable_interrupts(dev); - } else { - prism2_hw_shutdown(dev, 0); - - if (prism2_hw_init(dev, 0)) { - printk(KERN_WARNING "%s: Could not initialize card for" - " download\n", dev->name); - ret = -1; - goto out; - } - } - - if (prism2_enable_aux_port(dev, 1)) { - printk(KERN_WARNING "%s: Could not enable AUX port\n", - dev->name); - ret = -1; - goto out; - } - - param0 = param->start_addr & 0xffff; - param1 = param->start_addr >> 16; - - HFA384X_OUTW(0, HFA384X_PARAM2_OFF); - HFA384X_OUTW(param1, HFA384X_PARAM1_OFF); - if (hfa384x_cmd_wait(dev, HFA384X_CMDCODE_DOWNLOAD | - (HFA384X_PROGMODE_ENABLE_VOLATILE << 8), - param0)) { - printk(KERN_WARNING "%s: Download command execution failed\n", - dev->name); - ret = -1; - goto out; - } - - for (i = 0; i < param->num_areas; i++) { - PDEBUG(DEBUG_EXTRA2, "%s: Writing %d bytes at 0x%08x\n", - dev->name, param->data[i].len, param->data[i].addr); - if (hfa384x_to_aux(dev, param->data[i].addr, - param->data[i].len, param->data[i].data)) { - printk(KERN_WARNING "%s: RAM download at 0x%08x " - "(len=%d) failed\n", dev->name, - param->data[i].addr, param->data[i].len); - ret = -1; - goto out; - } - } - - HFA384X_OUTW(param1, HFA384X_PARAM1_OFF); - HFA384X_OUTW(0, HFA384X_PARAM2_OFF); - if (hfa384x_cmd_no_wait(dev, HFA384X_CMDCODE_DOWNLOAD | - (HFA384X_PROGMODE_DISABLE << 8), param0)) { - printk(KERN_WARNING "%s: Download command execution failed\n", - dev->name); - ret = -1; - goto out; - } - /* ProgMode disable causes the hardware to restart itself from the - * given starting address. Give hw some time and ACK command just in - * case restart did not happen. */ - mdelay(5); - HFA384X_OUTW(HFA384X_EV_CMD, HFA384X_EVACK_OFF); - - if (prism2_enable_aux_port(dev, 0)) { - printk(KERN_DEBUG "%s: Disabling AUX port failed\n", - dev->name); - /* continue anyway.. restart should have taken care of this */ - } - - mdelay(5); - local->hw_downloading = 0; - if (prism2_hw_config(dev, 2)) { - printk(KERN_WARNING "%s: Card configuration after RAM " - "download failed\n", dev->name); - ret = -1; - goto out; - } - - out: - local->hw_downloading = 0; - return ret; -} - - -static int prism2_enable_genesis(local_info_t *local, int hcr) -{ - struct net_device *dev = local->dev; - u8 initseq[4] = { 0x00, 0xe1, 0xa1, 0xff }; - u8 readbuf[4]; - - printk(KERN_DEBUG "%s: test Genesis mode with HCR 0x%02x\n", - dev->name, hcr); - local->func->cor_sreset(local); - hfa384x_to_aux(dev, 0x7e0038, sizeof(initseq), initseq); - local->func->genesis_reset(local, hcr); - - /* Readback test */ - hfa384x_from_aux(dev, 0x7e0038, sizeof(readbuf), readbuf); - hfa384x_to_aux(dev, 0x7e0038, sizeof(initseq), initseq); - hfa384x_from_aux(dev, 0x7e0038, sizeof(readbuf), readbuf); - - if (memcmp(initseq, readbuf, sizeof(initseq)) == 0) { - printk(KERN_DEBUG "Readback test succeeded, HCR 0x%02x\n", - hcr); - return 0; - } else { - printk(KERN_DEBUG "Readback test failed, HCR 0x%02x " - "write %02x %02x %02x %02x read %02x %02x %02x %02x\n", - hcr, initseq[0], initseq[1], initseq[2], initseq[3], - readbuf[0], readbuf[1], readbuf[2], readbuf[3]); - return 1; - } -} - - -static int prism2_get_ram_size(local_info_t *local) -{ - int ret; - - /* Try to enable genesis mode; 0x1F for x8 SRAM or 0x0F for x16 SRAM */ - if (prism2_enable_genesis(local, 0x1f) == 0) - ret = 8; - else if (prism2_enable_genesis(local, 0x0f) == 0) - ret = 16; - else - ret = -1; - - /* Disable genesis mode */ - local->func->genesis_reset(local, ret == 16 ? 0x07 : 0x17); - - return ret; -} - - -static int prism2_download_genesis(local_info_t *local, - struct prism2_download_data *param) -{ - struct net_device *dev = local->dev; - int ram16 = 0, i; - int ret = 0; - - if (local->hw_downloading) { - printk(KERN_WARNING "%s: Already downloading - aborting new " - "request\n", dev->name); - return -EBUSY; - } - - if (!local->func->genesis_reset || !local->func->cor_sreset) { - printk(KERN_INFO "%s: Genesis mode downloading not supported " - "with this hwmodel\n", dev->name); - return -EOPNOTSUPP; - } - - local->hw_downloading = 1; - - if (prism2_enable_aux_port(dev, 1)) { - printk(KERN_DEBUG "%s: failed to enable AUX port\n", - dev->name); - ret = -EIO; - goto out; - } - - if (local->sram_type == -1) { - /* 0x1F for x8 SRAM or 0x0F for x16 SRAM */ - if (prism2_enable_genesis(local, 0x1f) == 0) { - ram16 = 0; - PDEBUG(DEBUG_EXTRA2, "%s: Genesis mode OK using x8 " - "SRAM\n", dev->name); - } else if (prism2_enable_genesis(local, 0x0f) == 0) { - ram16 = 1; - PDEBUG(DEBUG_EXTRA2, "%s: Genesis mode OK using x16 " - "SRAM\n", dev->name); - } else { - printk(KERN_DEBUG "%s: Could not initiate genesis " - "mode\n", dev->name); - ret = -EIO; - goto out; - } - } else { - if (prism2_enable_genesis(local, local->sram_type == 8 ? - 0x1f : 0x0f)) { - printk(KERN_DEBUG "%s: Failed to set Genesis " - "mode (sram_type=%d)\n", dev->name, - local->sram_type); - ret = -EIO; - goto out; - } - ram16 = local->sram_type != 8; - } - - for (i = 0; i < param->num_areas; i++) { - PDEBUG(DEBUG_EXTRA2, "%s: Writing %d bytes at 0x%08x\n", - dev->name, param->data[i].len, param->data[i].addr); - if (hfa384x_to_aux(dev, param->data[i].addr, - param->data[i].len, param->data[i].data)) { - printk(KERN_WARNING "%s: RAM download at 0x%08x " - "(len=%d) failed\n", dev->name, - param->data[i].addr, param->data[i].len); - ret = -EIO; - goto out; - } - } - - PDEBUG(DEBUG_EXTRA2, "Disable genesis mode\n"); - local->func->genesis_reset(local, ram16 ? 0x07 : 0x17); - if (prism2_enable_aux_port(dev, 0)) { - printk(KERN_DEBUG "%s: Failed to disable AUX port\n", - dev->name); - } - - mdelay(5); - local->hw_downloading = 0; - - PDEBUG(DEBUG_EXTRA2, "Trying to initialize card\n"); - /* - * Make sure the INIT command does not generate a command completion - * event by disabling interrupts. - */ - hfa384x_disable_interrupts(dev); - if (prism2_hw_init(dev, 1)) { - printk(KERN_DEBUG "%s: Initialization after genesis mode " - "download failed\n", dev->name); - ret = -EIO; - goto out; - } - - PDEBUG(DEBUG_EXTRA2, "Card initialized - running PRI only\n"); - if (prism2_hw_init2(dev, 1)) { - printk(KERN_DEBUG "%s: Initialization(2) after genesis mode " - "download failed\n", dev->name); - ret = -EIO; - goto out; - } - - out: - local->hw_downloading = 0; - return ret; -} - - -#ifdef PRISM2_NON_VOLATILE_DOWNLOAD -/* Note! Non-volatile downloading functionality has not yet been tested - * thoroughly and it may corrupt flash image and effectively kill the card that - * is being updated. You have been warned. */ - -static inline int prism2_download_block(struct net_device *dev, - u32 addr, u8 *data, - u32 bufaddr, int rest_len) -{ - u16 param0, param1; - int block_len; - - block_len = rest_len < 4096 ? rest_len : 4096; - - param0 = addr & 0xffff; - param1 = addr >> 16; - - HFA384X_OUTW(block_len, HFA384X_PARAM2_OFF); - HFA384X_OUTW(param1, HFA384X_PARAM1_OFF); - - if (hfa384x_cmd_wait(dev, HFA384X_CMDCODE_DOWNLOAD | - (HFA384X_PROGMODE_ENABLE_NON_VOLATILE << 8), - param0)) { - printk(KERN_WARNING "%s: Flash download command execution " - "failed\n", dev->name); - return -1; - } - - if (hfa384x_to_aux(dev, bufaddr, block_len, data)) { - printk(KERN_WARNING "%s: flash download at 0x%08x " - "(len=%d) failed\n", dev->name, addr, block_len); - return -1; - } - - HFA384X_OUTW(0, HFA384X_PARAM2_OFF); - HFA384X_OUTW(0, HFA384X_PARAM1_OFF); - if (hfa384x_cmd_wait(dev, HFA384X_CMDCODE_DOWNLOAD | - (HFA384X_PROGMODE_PROGRAM_NON_VOLATILE << 8), - 0)) { - printk(KERN_WARNING "%s: Flash write command execution " - "failed\n", dev->name); - return -1; - } - - return block_len; -} - - -static int prism2_download_nonvolatile(local_info_t *local, - struct prism2_download_data *dl) -{ - struct net_device *dev = local->dev; - int ret = 0, i; - struct { - __le16 page; - __le16 offset; - __le16 len; - } dlbuffer; - u32 bufaddr; - - if (local->hw_downloading) { - printk(KERN_WARNING "%s: Already downloading - aborting new " - "request\n", dev->name); - return -1; - } - - ret = local->func->get_rid(dev, HFA384X_RID_DOWNLOADBUFFER, - &dlbuffer, 6, 0); - - if (ret < 0) { - printk(KERN_WARNING "%s: Could not read download buffer " - "parameters\n", dev->name); - goto out; - } - - printk(KERN_DEBUG "Download buffer: %d bytes at 0x%04x:0x%04x\n", - le16_to_cpu(dlbuffer.len), - le16_to_cpu(dlbuffer.page), - le16_to_cpu(dlbuffer.offset)); - - bufaddr = (le16_to_cpu(dlbuffer.page) << 7) + le16_to_cpu(dlbuffer.offset); - - local->hw_downloading = 1; - - if (!local->pri_only) { - prism2_hw_shutdown(dev, 0); - - if (prism2_hw_init(dev, 0)) { - printk(KERN_WARNING "%s: Could not initialize card for" - " download\n", dev->name); - ret = -1; - goto out; - } - } - - hfa384x_disable_interrupts(dev); - - if (prism2_enable_aux_port(dev, 1)) { - printk(KERN_WARNING "%s: Could not enable AUX port\n", - dev->name); - ret = -1; - goto out; - } - - printk(KERN_DEBUG "%s: starting flash download\n", dev->name); - for (i = 0; i < dl->num_areas; i++) { - int rest_len = dl->data[i].len; - int data_off = 0; - - while (rest_len > 0) { - int block_len; - - block_len = prism2_download_block( - dev, dl->data[i].addr + data_off, - dl->data[i].data + data_off, bufaddr, - rest_len); - - if (block_len < 0) { - ret = -1; - goto out; - } - - rest_len -= block_len; - data_off += block_len; - } - } - - HFA384X_OUTW(0, HFA384X_PARAM1_OFF); - HFA384X_OUTW(0, HFA384X_PARAM2_OFF); - if (hfa384x_cmd_wait(dev, HFA384X_CMDCODE_DOWNLOAD | - (HFA384X_PROGMODE_DISABLE << 8), 0)) { - printk(KERN_WARNING "%s: Download command execution failed\n", - dev->name); - ret = -1; - goto out; - } - - if (prism2_enable_aux_port(dev, 0)) { - printk(KERN_DEBUG "%s: Disabling AUX port failed\n", - dev->name); - /* continue anyway.. restart should have taken care of this */ - } - - mdelay(5); - - local->func->hw_reset(dev); - local->hw_downloading = 0; - if (prism2_hw_config(dev, 2)) { - printk(KERN_WARNING "%s: Card configuration after flash " - "download failed\n", dev->name); - ret = -1; - } else { - printk(KERN_INFO "%s: Card initialized successfully after " - "flash download\n", dev->name); - } - - out: - local->hw_downloading = 0; - return ret; -} -#endif /* PRISM2_NON_VOLATILE_DOWNLOAD */ - - -static void prism2_download_free_data(struct prism2_download_data *dl) -{ - int i; - - if (dl == NULL) - return; - - for (i = 0; i < dl->num_areas; i++) - kfree(dl->data[i].data); - kfree(dl); -} - - -static int prism2_download(local_info_t *local, - struct prism2_download_param *param) -{ - int ret = 0; - int i; - u32 total_len = 0; - struct prism2_download_data *dl = NULL; - - printk(KERN_DEBUG "prism2_download: dl_cmd=%d start_addr=0x%08x " - "num_areas=%d\n", - param->dl_cmd, param->start_addr, param->num_areas); - - if (param->num_areas > 100) { - ret = -EINVAL; - goto out; - } - - dl = kzalloc(sizeof(*dl) + param->num_areas * - sizeof(struct prism2_download_data_area), GFP_KERNEL); - if (dl == NULL) { - ret = -ENOMEM; - goto out; - } - dl->dl_cmd = param->dl_cmd; - dl->start_addr = param->start_addr; - dl->num_areas = param->num_areas; - for (i = 0; i < param->num_areas; i++) { - PDEBUG(DEBUG_EXTRA2, - " area %d: addr=0x%08x len=%d ptr=0x%p\n", - i, param->data[i].addr, param->data[i].len, - param->data[i].ptr); - - dl->data[i].addr = param->data[i].addr; - dl->data[i].len = param->data[i].len; - - total_len += param->data[i].len; - if (param->data[i].len > PRISM2_MAX_DOWNLOAD_AREA_LEN || - total_len > PRISM2_MAX_DOWNLOAD_LEN) { - ret = -E2BIG; - goto out; - } - - dl->data[i].data = kmalloc(dl->data[i].len, GFP_KERNEL); - if (dl->data[i].data == NULL) { - ret = -ENOMEM; - goto out; - } - - if (copy_from_user(dl->data[i].data, param->data[i].ptr, - param->data[i].len)) { - ret = -EFAULT; - goto out; - } - } - - switch (param->dl_cmd) { - case PRISM2_DOWNLOAD_VOLATILE: - case PRISM2_DOWNLOAD_VOLATILE_PERSISTENT: - ret = prism2_download_volatile(local, dl); - break; - case PRISM2_DOWNLOAD_VOLATILE_GENESIS: - case PRISM2_DOWNLOAD_VOLATILE_GENESIS_PERSISTENT: - ret = prism2_download_genesis(local, dl); - break; - case PRISM2_DOWNLOAD_NON_VOLATILE: -#ifdef PRISM2_NON_VOLATILE_DOWNLOAD - ret = prism2_download_nonvolatile(local, dl); -#else /* PRISM2_NON_VOLATILE_DOWNLOAD */ - printk(KERN_INFO "%s: non-volatile downloading not enabled\n", - local->dev->name); - ret = -EOPNOTSUPP; -#endif /* PRISM2_NON_VOLATILE_DOWNLOAD */ - break; - default: - printk(KERN_DEBUG "%s: unsupported download command %d\n", - local->dev->name, param->dl_cmd); - ret = -EINVAL; - break; - } - - out: - if (ret == 0 && dl && - param->dl_cmd == PRISM2_DOWNLOAD_VOLATILE_GENESIS_PERSISTENT) { - prism2_download_free_data(local->dl_pri); - local->dl_pri = dl; - } else if (ret == 0 && dl && - param->dl_cmd == PRISM2_DOWNLOAD_VOLATILE_PERSISTENT) { - prism2_download_free_data(local->dl_sec); - local->dl_sec = dl; - } else - prism2_download_free_data(dl); - - return ret; -} diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c deleted file mode 100644 index 6307a4e36c85..000000000000 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ /dev/null @@ -1,3424 +0,0 @@ -/* - * Host AP (software wireless LAN access point) driver for - * Intersil Prism2/2.5/3. - * - * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen - * - * Copyright (c) 2002-2005, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. - * - * FIX: - * - there is currently no way of associating TX packets to correct wds device - * when TX Exc/OK event occurs, so all tx_packets and some - * tx_errors/tx_dropped are added to the main netdevice; using sw_support - * field in txdesc might be used to fix this (using Alloc event to increment - * tx_packets would need some further info in txfid table) - * - * Buffer Access Path (BAP) usage: - * Prism2 cards have two separate BAPs for accessing the card memory. These - * should allow concurrent access to two different frames and the driver - * previously used BAP0 for sending data and BAP1 for receiving data. - * However, there seems to be number of issues with concurrent access and at - * least one know hardware bug in using BAP0 and BAP1 concurrently with PCI - * Prism2.5. Therefore, the driver now only uses BAP0 for moving data between - * host and card memories. BAP0 accesses are protected with local->baplock - * (spin_lock_bh) to prevent concurrent use. - */ - - - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "hostap_80211.h" -#include "hostap.h" -#include "hostap_ap.h" - - -/* #define final_version */ - -static int mtu = 1500; -module_param(mtu, int, 0444); -MODULE_PARM_DESC(mtu, "Maximum transfer unit"); - -static int channel[MAX_PARM_DEVICES] = { 3, DEF_INTS }; -module_param_array(channel, int, NULL, 0444); -MODULE_PARM_DESC(channel, "Initial channel"); - -static char essid[33] = "test"; -module_param_string(essid, essid, sizeof(essid), 0444); -MODULE_PARM_DESC(essid, "Host AP's ESSID"); - -static int iw_mode[MAX_PARM_DEVICES] = { IW_MODE_MASTER, DEF_INTS }; -module_param_array(iw_mode, int, NULL, 0444); -MODULE_PARM_DESC(iw_mode, "Initial operation mode"); - -static int beacon_int[MAX_PARM_DEVICES] = { 100, DEF_INTS }; -module_param_array(beacon_int, int, NULL, 0444); -MODULE_PARM_DESC(beacon_int, "Beacon interval (1 = 1024 usec)"); - -static int dtim_period[MAX_PARM_DEVICES] = { 1, DEF_INTS }; -module_param_array(dtim_period, int, NULL, 0444); -MODULE_PARM_DESC(dtim_period, "DTIM period"); - -static char dev_template[16] = "wlan%d"; -module_param_string(dev_template, dev_template, sizeof(dev_template), 0444); -MODULE_PARM_DESC(dev_template, "Prefix for network device name (default: " - "wlan%d)"); - -#ifdef final_version -#define EXTRA_EVENTS_WTERR 0 -#else -/* check WTERR events (Wait Time-out) in development versions */ -#define EXTRA_EVENTS_WTERR HFA384X_EV_WTERR -#endif - -/* Events that will be using BAP0 */ -#define HFA384X_BAP0_EVENTS \ - (HFA384X_EV_TXEXC | HFA384X_EV_RX | HFA384X_EV_INFO | HFA384X_EV_TX) - -/* event mask, i.e., events that will result in an interrupt */ -#define HFA384X_EVENT_MASK \ - (HFA384X_BAP0_EVENTS | HFA384X_EV_ALLOC | HFA384X_EV_INFDROP | \ - HFA384X_EV_CMD | HFA384X_EV_TICK | \ - EXTRA_EVENTS_WTERR) - -/* Default TX control flags: use 802.11 headers and request interrupt for - * failed transmits. Frames that request ACK callback, will add - * _TX_OK flag and _ALT_RTRY flag may be used to select different retry policy. - */ -#define HFA384X_TX_CTRL_FLAGS \ - (HFA384X_TX_CTRL_802_11 | HFA384X_TX_CTRL_TX_EX) - - -/* ca. 1 usec */ -#define HFA384X_CMD_BUSY_TIMEOUT 5000 -#define HFA384X_BAP_BUSY_TIMEOUT 50000 - -/* ca. 10 usec */ -#define HFA384X_CMD_COMPL_TIMEOUT 20000 -#define HFA384X_DL_COMPL_TIMEOUT 1000000 - -/* Wait times for initialization; yield to other processes to avoid busy - * waiting for long time. */ -#define HFA384X_INIT_TIMEOUT (HZ / 2) /* 500 ms */ -#define HFA384X_ALLOC_COMPL_TIMEOUT (HZ / 20) /* 50 ms */ - - -static void prism2_hw_reset(struct net_device *dev); -static void prism2_check_sta_fw_version(local_info_t *local); - -#ifdef PRISM2_DOWNLOAD_SUPPORT -/* hostap_download.c */ -static const struct file_operations prism2_download_aux_dump_proc_fops; -static u8 * prism2_read_pda(struct net_device *dev); -static int prism2_download(local_info_t *local, - struct prism2_download_param *param); -static void prism2_download_free_data(struct prism2_download_data *dl); -static int prism2_download_volatile(local_info_t *local, - struct prism2_download_data *param); -static int prism2_download_genesis(local_info_t *local, - struct prism2_download_data *param); -static int prism2_get_ram_size(local_info_t *local); -#endif /* PRISM2_DOWNLOAD_SUPPORT */ - - - - -#ifndef final_version -/* magic value written to SWSUPPORT0 reg. for detecting whether card is still - * present */ -#define HFA384X_MAGIC 0x8A32 -#endif - - -static u16 hfa384x_read_reg(struct net_device *dev, u16 reg) -{ - return HFA384X_INW(reg); -} - - -static void hfa384x_read_regs(struct net_device *dev, - struct hfa384x_regs *regs) -{ - regs->cmd = HFA384X_INW(HFA384X_CMD_OFF); - regs->evstat = HFA384X_INW(HFA384X_EVSTAT_OFF); - regs->offset0 = HFA384X_INW(HFA384X_OFFSET0_OFF); - regs->offset1 = HFA384X_INW(HFA384X_OFFSET1_OFF); - regs->swsupport0 = HFA384X_INW(HFA384X_SWSUPPORT0_OFF); -} - - -/** - * __hostap_cmd_queue_free - Free Prism2 command queue entry (private) - * @local: pointer to private Host AP driver data - * @entry: Prism2 command queue entry to be freed - * @del_req: request the entry to be removed - * - * Internal helper function for freeing Prism2 command queue entries. - * Caller must have acquired local->cmdlock before calling this function. - */ -static inline void __hostap_cmd_queue_free(local_info_t *local, - struct hostap_cmd_queue *entry, - int del_req) -{ - if (del_req) { - entry->del_req = 1; - if (!list_empty(&entry->list)) { - list_del_init(&entry->list); - local->cmd_queue_len--; - } - } - - if (atomic_dec_and_test(&entry->usecnt) && entry->del_req) - kfree(entry); -} - - -/** - * hostap_cmd_queue_free - Free Prism2 command queue entry - * @local: pointer to private Host AP driver data - * @entry: Prism2 command queue entry to be freed - * @del_req: request the entry to be removed - * - * Free a Prism2 command queue entry. - */ -static inline void hostap_cmd_queue_free(local_info_t *local, - struct hostap_cmd_queue *entry, - int del_req) -{ - unsigned long flags; - - spin_lock_irqsave(&local->cmdlock, flags); - __hostap_cmd_queue_free(local, entry, del_req); - spin_unlock_irqrestore(&local->cmdlock, flags); -} - - -/** - * prism2_clear_cmd_queue - Free all pending Prism2 command queue entries - * @local: pointer to private Host AP driver data - */ -static void prism2_clear_cmd_queue(local_info_t *local) -{ - struct list_head *ptr, *n; - unsigned long flags; - struct hostap_cmd_queue *entry; - - spin_lock_irqsave(&local->cmdlock, flags); - list_for_each_safe(ptr, n, &local->cmd_queue) { - entry = list_entry(ptr, struct hostap_cmd_queue, list); - atomic_inc(&entry->usecnt); - printk(KERN_DEBUG "%s: removed pending cmd_queue entry " - "(type=%d, cmd=0x%04x, param0=0x%04x)\n", - local->dev->name, entry->type, entry->cmd, - entry->param0); - __hostap_cmd_queue_free(local, entry, 1); - } - if (local->cmd_queue_len) { - /* This should not happen; print debug message and clear - * queue length. */ - printk(KERN_DEBUG "%s: cmd_queue_len (%d) not zero after " - "flush\n", local->dev->name, local->cmd_queue_len); - local->cmd_queue_len = 0; - } - spin_unlock_irqrestore(&local->cmdlock, flags); -} - - -/** - * hfa384x_cmd_issue - Issue a Prism2 command to the hardware - * @dev: pointer to net_device - * @entry: Prism2 command queue entry to be issued - */ -static int hfa384x_cmd_issue(struct net_device *dev, - struct hostap_cmd_queue *entry) -{ - struct hostap_interface *iface; - local_info_t *local; - int tries; - u16 reg; - unsigned long flags; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->func->card_present && !local->func->card_present(local)) - return -ENODEV; - - if (entry->issued) { - printk(KERN_DEBUG "%s: driver bug - re-issuing command @%p\n", - dev->name, entry); - } - - /* wait until busy bit is clear; this should always be clear since the - * commands are serialized */ - tries = HFA384X_CMD_BUSY_TIMEOUT; - while (HFA384X_INW(HFA384X_CMD_OFF) & HFA384X_CMD_BUSY && tries > 0) { - tries--; - udelay(1); - } -#ifndef final_version - if (tries != HFA384X_CMD_BUSY_TIMEOUT) { - prism2_io_debug_error(dev, 1); - printk(KERN_DEBUG "%s: hfa384x_cmd_issue: cmd reg was busy " - "for %d usec\n", dev->name, - HFA384X_CMD_BUSY_TIMEOUT - tries); - } -#endif - if (tries == 0) { - reg = HFA384X_INW(HFA384X_CMD_OFF); - prism2_io_debug_error(dev, 2); - printk(KERN_DEBUG "%s: hfa384x_cmd_issue - timeout - " - "reg=0x%04x\n", dev->name, reg); - return -ETIMEDOUT; - } - - /* write command */ - spin_lock_irqsave(&local->cmdlock, flags); - HFA384X_OUTW(entry->param0, HFA384X_PARAM0_OFF); - HFA384X_OUTW(entry->param1, HFA384X_PARAM1_OFF); - HFA384X_OUTW(entry->cmd, HFA384X_CMD_OFF); - entry->issued = 1; - spin_unlock_irqrestore(&local->cmdlock, flags); - - return 0; -} - - -/** - * hfa384x_cmd - Issue a Prism2 command and wait (sleep) for completion - * @dev: pointer to net_device - * @cmd: Prism2 command code (HFA384X_CMD_CODE_*) - * @param0: value for Param0 register - * @param1: value for Param1 register (pointer; %NULL if not used) - * @resp0: pointer for Resp0 data or %NULL if Resp0 is not needed - * - * Issue given command (possibly after waiting in command queue) and sleep - * until the command is completed (or timed out or interrupted). This can be - * called only from user process context. - */ -static int hfa384x_cmd(struct net_device *dev, u16 cmd, u16 param0, - u16 *param1, u16 *resp0) -{ - struct hostap_interface *iface; - local_info_t *local; - int err, res, issue, issued = 0; - unsigned long flags; - struct hostap_cmd_queue *entry; - DECLARE_WAITQUEUE(wait, current); - - iface = netdev_priv(dev); - local = iface->local; - - if (in_interrupt()) { - printk(KERN_DEBUG "%s: hfa384x_cmd called from interrupt " - "context\n", dev->name); - return -1; - } - - if (local->cmd_queue_len >= HOSTAP_CMD_QUEUE_MAX_LEN) { - printk(KERN_DEBUG "%s: hfa384x_cmd: cmd_queue full\n", - dev->name); - return -1; - } - - if (signal_pending(current)) - return -EINTR; - - entry = kzalloc(sizeof(*entry), GFP_ATOMIC); - if (entry == NULL) - return -ENOMEM; - - atomic_set(&entry->usecnt, 1); - entry->type = CMD_SLEEP; - entry->cmd = cmd; - entry->param0 = param0; - if (param1) - entry->param1 = *param1; - init_waitqueue_head(&entry->compl); - - /* prepare to wait for command completion event, but do not sleep yet - */ - add_wait_queue(&entry->compl, &wait); - set_current_state(TASK_INTERRUPTIBLE); - - spin_lock_irqsave(&local->cmdlock, flags); - issue = list_empty(&local->cmd_queue); - if (issue) - entry->issuing = 1; - list_add_tail(&entry->list, &local->cmd_queue); - local->cmd_queue_len++; - spin_unlock_irqrestore(&local->cmdlock, flags); - - err = 0; - if (!issue) - goto wait_completion; - - if (signal_pending(current)) - err = -EINTR; - - if (!err) { - if (hfa384x_cmd_issue(dev, entry)) - err = -ETIMEDOUT; - else - issued = 1; - } - - wait_completion: - if (!err && entry->type != CMD_COMPLETED) { - /* sleep until command is completed or timed out */ - res = schedule_timeout(2 * HZ); - } else - res = -1; - - if (!err && signal_pending(current)) - err = -EINTR; - - if (err && issued) { - /* the command was issued, so a CmdCompl event should occur - * soon; however, there's a pending signal and - * schedule_timeout() would be interrupted; wait a short period - * of time to avoid removing entry from the list before - * CmdCompl event */ - udelay(300); - } - - set_current_state(TASK_RUNNING); - remove_wait_queue(&entry->compl, &wait); - - /* If entry->list is still in the list, it must be removed - * first and in this case prism2_cmd_ev() does not yet have - * local reference to it, and the data can be kfree()'d - * here. If the command completion event is still generated, - * it will be assigned to next (possibly) pending command, but - * the driver will reset the card anyway due to timeout - * - * If the entry is not in the list prism2_cmd_ev() has a local - * reference to it, but keeps cmdlock as long as the data is - * needed, so the data can be kfree()'d here. */ - - /* FIX: if the entry->list is in the list, it has not been completed - * yet, so removing it here is somewhat wrong.. this could cause - * references to freed memory and next list_del() causing NULL pointer - * dereference.. it would probably be better to leave the entry in the - * list and the list should be emptied during hw reset */ - - spin_lock_irqsave(&local->cmdlock, flags); - if (!list_empty(&entry->list)) { - printk(KERN_DEBUG "%s: hfa384x_cmd: entry still in list? " - "(entry=%p, type=%d, res=%d)\n", dev->name, entry, - entry->type, res); - list_del_init(&entry->list); - local->cmd_queue_len--; - } - spin_unlock_irqrestore(&local->cmdlock, flags); - - if (err) { - printk(KERN_DEBUG "%s: hfa384x_cmd: interrupted; err=%d\n", - dev->name, err); - res = err; - goto done; - } - - if (entry->type != CMD_COMPLETED) { - u16 reg = HFA384X_INW(HFA384X_EVSTAT_OFF); - printk(KERN_DEBUG "%s: hfa384x_cmd: command was not " - "completed (res=%d, entry=%p, type=%d, cmd=0x%04x, " - "param0=0x%04x, EVSTAT=%04x INTEN=%04x)\n", dev->name, - res, entry, entry->type, entry->cmd, entry->param0, reg, - HFA384X_INW(HFA384X_INTEN_OFF)); - if (reg & HFA384X_EV_CMD) { - /* Command completion event is pending, but the - * interrupt was not delivered - probably an issue - * with pcmcia-cs configuration. */ - printk(KERN_WARNING "%s: interrupt delivery does not " - "seem to work\n", dev->name); - } - prism2_io_debug_error(dev, 3); - res = -ETIMEDOUT; - goto done; - } - - if (resp0 != NULL) - *resp0 = entry->resp0; -#ifndef final_version - if (entry->res) { - printk(KERN_DEBUG "%s: CMD=0x%04x => res=0x%02x, " - "resp0=0x%04x\n", - dev->name, cmd, entry->res, entry->resp0); - } -#endif /* final_version */ - - res = entry->res; - done: - hostap_cmd_queue_free(local, entry, 1); - return res; -} - - -/** - * hfa384x_cmd_callback - Issue a Prism2 command; callback when completed - * @dev: pointer to net_device - * @cmd: Prism2 command code (HFA384X_CMD_CODE_*) - * @param0: value for Param0 register - * @callback: command completion callback function (%NULL = no callback) - * @context: context data to be given to the callback function - * - * Issue given command (possibly after waiting in command queue) and use - * callback function to indicate command completion. This can be called both - * from user and interrupt context. The callback function will be called in - * hardware IRQ context. It can be %NULL, when no function is called when - * command is completed. - */ -static int hfa384x_cmd_callback(struct net_device *dev, u16 cmd, u16 param0, - void (*callback)(struct net_device *dev, - long context, u16 resp0, - u16 status), - long context) -{ - struct hostap_interface *iface; - local_info_t *local; - int issue, ret; - unsigned long flags; - struct hostap_cmd_queue *entry; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->cmd_queue_len >= HOSTAP_CMD_QUEUE_MAX_LEN + 2) { - printk(KERN_DEBUG "%s: hfa384x_cmd: cmd_queue full\n", - dev->name); - return -1; - } - - entry = kzalloc(sizeof(*entry), GFP_ATOMIC); - if (entry == NULL) - return -ENOMEM; - - atomic_set(&entry->usecnt, 1); - entry->type = CMD_CALLBACK; - entry->cmd = cmd; - entry->param0 = param0; - entry->callback = callback; - entry->context = context; - - spin_lock_irqsave(&local->cmdlock, flags); - issue = list_empty(&local->cmd_queue); - if (issue) - entry->issuing = 1; - list_add_tail(&entry->list, &local->cmd_queue); - local->cmd_queue_len++; - spin_unlock_irqrestore(&local->cmdlock, flags); - - if (issue && hfa384x_cmd_issue(dev, entry)) - ret = -ETIMEDOUT; - else - ret = 0; - - hostap_cmd_queue_free(local, entry, ret); - - return ret; -} - - -/** - * __hfa384x_cmd_no_wait - Issue a Prism2 command (private) - * @dev: pointer to net_device - * @cmd: Prism2 command code (HFA384X_CMD_CODE_*) - * @param0: value for Param0 register - * @io_debug_num: I/O debug error number - * - * Shared helper function for hfa384x_cmd_wait() and hfa384x_cmd_no_wait(). - */ -static int __hfa384x_cmd_no_wait(struct net_device *dev, u16 cmd, u16 param0, - int io_debug_num) -{ - int tries; - u16 reg; - - /* wait until busy bit is clear; this should always be clear since the - * commands are serialized */ - tries = HFA384X_CMD_BUSY_TIMEOUT; - while (HFA384X_INW(HFA384X_CMD_OFF) & HFA384X_CMD_BUSY && tries > 0) { - tries--; - udelay(1); - } - if (tries == 0) { - reg = HFA384X_INW(HFA384X_CMD_OFF); - prism2_io_debug_error(dev, io_debug_num); - printk(KERN_DEBUG "%s: __hfa384x_cmd_no_wait(%d) - timeout - " - "reg=0x%04x\n", dev->name, io_debug_num, reg); - return -ETIMEDOUT; - } - - /* write command */ - HFA384X_OUTW(param0, HFA384X_PARAM0_OFF); - HFA384X_OUTW(cmd, HFA384X_CMD_OFF); - - return 0; -} - - -/** - * hfa384x_cmd_wait - Issue a Prism2 command and busy wait for completion - * @dev: pointer to net_device - * @cmd: Prism2 command code (HFA384X_CMD_CODE_*) - * @param0: value for Param0 register - */ -static int hfa384x_cmd_wait(struct net_device *dev, u16 cmd, u16 param0) -{ - int res, tries; - u16 reg; - - res = __hfa384x_cmd_no_wait(dev, cmd, param0, 4); - if (res) - return res; - - /* wait for command completion */ - if ((cmd & HFA384X_CMDCODE_MASK) == HFA384X_CMDCODE_DOWNLOAD) - tries = HFA384X_DL_COMPL_TIMEOUT; - else - tries = HFA384X_CMD_COMPL_TIMEOUT; - - while (!(HFA384X_INW(HFA384X_EVSTAT_OFF) & HFA384X_EV_CMD) && - tries > 0) { - tries--; - udelay(10); - } - if (tries == 0) { - reg = HFA384X_INW(HFA384X_EVSTAT_OFF); - prism2_io_debug_error(dev, 5); - printk(KERN_DEBUG "%s: hfa384x_cmd_wait - timeout2 - " - "reg=0x%04x\n", dev->name, reg); - return -ETIMEDOUT; - } - - res = (HFA384X_INW(HFA384X_STATUS_OFF) & - (BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10) | BIT(9) | - BIT(8))) >> 8; -#ifndef final_version - if (res) { - printk(KERN_DEBUG "%s: CMD=0x%04x => res=0x%02x\n", - dev->name, cmd, res); - } -#endif - - HFA384X_OUTW(HFA384X_EV_CMD, HFA384X_EVACK_OFF); - - return res; -} - - -/** - * hfa384x_cmd_no_wait - Issue a Prism2 command; do not wait for completion - * @dev: pointer to net_device - * @cmd: Prism2 command code (HFA384X_CMD_CODE_*) - * @param0: value for Param0 register - */ -static inline int hfa384x_cmd_no_wait(struct net_device *dev, u16 cmd, - u16 param0) -{ - return __hfa384x_cmd_no_wait(dev, cmd, param0, 6); -} - - -/** - * prism2_cmd_ev - Prism2 command completion event handler - * @dev: pointer to net_device - * - * Interrupt handler for command completion events. Called by the main - * interrupt handler in hardware IRQ context. Read Resp0 and status registers - * from the hardware and ACK the event. Depending on the issued command type - * either wake up the sleeping process that is waiting for command completion - * or call the callback function. Issue the next command, if one is pending. - */ -static void prism2_cmd_ev(struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - struct hostap_cmd_queue *entry = NULL; - - iface = netdev_priv(dev); - local = iface->local; - - spin_lock(&local->cmdlock); - if (!list_empty(&local->cmd_queue)) { - entry = list_entry(local->cmd_queue.next, - struct hostap_cmd_queue, list); - atomic_inc(&entry->usecnt); - list_del_init(&entry->list); - local->cmd_queue_len--; - - if (!entry->issued) { - printk(KERN_DEBUG "%s: Command completion event, but " - "cmd not issued\n", dev->name); - __hostap_cmd_queue_free(local, entry, 1); - entry = NULL; - } - } - spin_unlock(&local->cmdlock); - - if (!entry) { - HFA384X_OUTW(HFA384X_EV_CMD, HFA384X_EVACK_OFF); - printk(KERN_DEBUG "%s: Command completion event, but no " - "pending commands\n", dev->name); - return; - } - - entry->resp0 = HFA384X_INW(HFA384X_RESP0_OFF); - entry->res = (HFA384X_INW(HFA384X_STATUS_OFF) & - (BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10) | - BIT(9) | BIT(8))) >> 8; - HFA384X_OUTW(HFA384X_EV_CMD, HFA384X_EVACK_OFF); - - /* TODO: rest of the CmdEv handling could be moved to tasklet */ - if (entry->type == CMD_SLEEP) { - entry->type = CMD_COMPLETED; - wake_up_interruptible(&entry->compl); - } else if (entry->type == CMD_CALLBACK) { - if (entry->callback) - entry->callback(dev, entry->context, entry->resp0, - entry->res); - } else { - printk(KERN_DEBUG "%s: Invalid command completion type %d\n", - dev->name, entry->type); - } - hostap_cmd_queue_free(local, entry, 1); - - /* issue next command, if pending */ - entry = NULL; - spin_lock(&local->cmdlock); - if (!list_empty(&local->cmd_queue)) { - entry = list_entry(local->cmd_queue.next, - struct hostap_cmd_queue, list); - if (entry->issuing) { - /* hfa384x_cmd() has already started issuing this - * command, so do not start here */ - entry = NULL; - } - if (entry) - atomic_inc(&entry->usecnt); - } - spin_unlock(&local->cmdlock); - - if (entry) { - /* issue next command; if command issuing fails, remove the - * entry from cmd_queue */ - int res = hfa384x_cmd_issue(dev, entry); - spin_lock(&local->cmdlock); - __hostap_cmd_queue_free(local, entry, res); - spin_unlock(&local->cmdlock); - } -} - - -static int hfa384x_wait_offset(struct net_device *dev, u16 o_off) -{ - int tries = HFA384X_BAP_BUSY_TIMEOUT; - int res = HFA384X_INW(o_off) & HFA384X_OFFSET_BUSY; - - while (res && tries > 0) { - tries--; - udelay(1); - res = HFA384X_INW(o_off) & HFA384X_OFFSET_BUSY; - } - return res; -} - - -/* Offset must be even */ -static int hfa384x_setup_bap(struct net_device *dev, u16 bap, u16 id, - int offset) -{ - u16 o_off, s_off; - int ret = 0; - - if (offset % 2 || bap > 1) - return -EINVAL; - - if (bap == BAP1) { - o_off = HFA384X_OFFSET1_OFF; - s_off = HFA384X_SELECT1_OFF; - } else { - o_off = HFA384X_OFFSET0_OFF; - s_off = HFA384X_SELECT0_OFF; - } - - if (hfa384x_wait_offset(dev, o_off)) { - prism2_io_debug_error(dev, 7); - printk(KERN_DEBUG "%s: hfa384x_setup_bap - timeout before\n", - dev->name); - ret = -ETIMEDOUT; - goto out; - } - - HFA384X_OUTW(id, s_off); - HFA384X_OUTW(offset, o_off); - - if (hfa384x_wait_offset(dev, o_off)) { - prism2_io_debug_error(dev, 8); - printk(KERN_DEBUG "%s: hfa384x_setup_bap - timeout after\n", - dev->name); - ret = -ETIMEDOUT; - goto out; - } -#ifndef final_version - if (HFA384X_INW(o_off) & HFA384X_OFFSET_ERR) { - prism2_io_debug_error(dev, 9); - printk(KERN_DEBUG "%s: hfa384x_setup_bap - offset error " - "(%d,0x04%x,%d); reg=0x%04x\n", - dev->name, bap, id, offset, HFA384X_INW(o_off)); - ret = -EINVAL; - } -#endif - - out: - return ret; -} - - -static int hfa384x_get_rid(struct net_device *dev, u16 rid, void *buf, int len, - int exact_len) -{ - struct hostap_interface *iface; - local_info_t *local; - int res, rlen = 0; - struct hfa384x_rid_hdr rec; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->no_pri) { - printk(KERN_DEBUG "%s: cannot get RID %04x (len=%d) - no PRI " - "f/w\n", dev->name, rid, len); - return -ENOTTY; /* Well.. not really correct, but return - * something unique enough.. */ - } - - if ((local->func->card_present && !local->func->card_present(local)) || - local->hw_downloading) - return -ENODEV; - - res = mutex_lock_interruptible(&local->rid_bap_mtx); - if (res) - return res; - - res = hfa384x_cmd(dev, HFA384X_CMDCODE_ACCESS, rid, NULL, NULL); - if (res) { - printk(KERN_DEBUG "%s: hfa384x_get_rid: CMDCODE_ACCESS failed " - "(res=%d, rid=%04x, len=%d)\n", - dev->name, res, rid, len); - mutex_unlock(&local->rid_bap_mtx); - return res; - } - - spin_lock_bh(&local->baplock); - - res = hfa384x_setup_bap(dev, BAP0, rid, 0); - if (!res) - res = hfa384x_from_bap(dev, BAP0, &rec, sizeof(rec)); - - if (le16_to_cpu(rec.len) == 0) { - /* RID not available */ - res = -ENODATA; - } - - rlen = (le16_to_cpu(rec.len) - 1) * 2; - if (!res && exact_len && rlen != len) { - printk(KERN_DEBUG "%s: hfa384x_get_rid - RID len mismatch: " - "rid=0x%04x, len=%d (expected %d)\n", - dev->name, rid, rlen, len); - res = -ENODATA; - } - - if (!res) - res = hfa384x_from_bap(dev, BAP0, buf, len); - - spin_unlock_bh(&local->baplock); - mutex_unlock(&local->rid_bap_mtx); - - if (res) { - if (res != -ENODATA) - printk(KERN_DEBUG "%s: hfa384x_get_rid (rid=%04x, " - "len=%d) - failed - res=%d\n", dev->name, rid, - len, res); - if (res == -ETIMEDOUT) - prism2_hw_reset(dev); - return res; - } - - return rlen; -} - - -static int hfa384x_set_rid(struct net_device *dev, u16 rid, void *buf, int len) -{ - struct hostap_interface *iface; - local_info_t *local; - struct hfa384x_rid_hdr rec; - int res; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->no_pri) { - printk(KERN_DEBUG "%s: cannot set RID %04x (len=%d) - no PRI " - "f/w\n", dev->name, rid, len); - return -ENOTTY; /* Well.. not really correct, but return - * something unique enough.. */ - } - - if ((local->func->card_present && !local->func->card_present(local)) || - local->hw_downloading) - return -ENODEV; - - rec.rid = cpu_to_le16(rid); - /* RID len in words and +1 for rec.rid */ - rec.len = cpu_to_le16(len / 2 + len % 2 + 1); - - res = mutex_lock_interruptible(&local->rid_bap_mtx); - if (res) - return res; - - spin_lock_bh(&local->baplock); - res = hfa384x_setup_bap(dev, BAP0, rid, 0); - if (!res) - res = hfa384x_to_bap(dev, BAP0, &rec, sizeof(rec)); - if (!res) - res = hfa384x_to_bap(dev, BAP0, buf, len); - spin_unlock_bh(&local->baplock); - - if (res) { - printk(KERN_DEBUG "%s: hfa384x_set_rid (rid=%04x, len=%d) - " - "failed - res=%d\n", dev->name, rid, len, res); - mutex_unlock(&local->rid_bap_mtx); - return res; - } - - res = hfa384x_cmd(dev, HFA384X_CMDCODE_ACCESS_WRITE, rid, NULL, NULL); - mutex_unlock(&local->rid_bap_mtx); - - if (res) { - printk(KERN_DEBUG "%s: hfa384x_set_rid: CMDCODE_ACCESS_WRITE " - "failed (res=%d, rid=%04x, len=%d)\n", - dev->name, res, rid, len); - - if (res == -ETIMEDOUT) - prism2_hw_reset(dev); - } - - return res; -} - - -static void hfa384x_disable_interrupts(struct net_device *dev) -{ - /* disable interrupts and clear event status */ - HFA384X_OUTW(0, HFA384X_INTEN_OFF); - HFA384X_OUTW(0xffff, HFA384X_EVACK_OFF); -} - - -static void hfa384x_enable_interrupts(struct net_device *dev) -{ - /* ack pending events and enable interrupts from selected events */ - HFA384X_OUTW(0xffff, HFA384X_EVACK_OFF); - HFA384X_OUTW(HFA384X_EVENT_MASK, HFA384X_INTEN_OFF); -} - - -static void hfa384x_events_no_bap0(struct net_device *dev) -{ - HFA384X_OUTW(HFA384X_EVENT_MASK & ~HFA384X_BAP0_EVENTS, - HFA384X_INTEN_OFF); -} - - -static void hfa384x_events_all(struct net_device *dev) -{ - HFA384X_OUTW(HFA384X_EVENT_MASK, HFA384X_INTEN_OFF); -} - - -static void hfa384x_events_only_cmd(struct net_device *dev) -{ - HFA384X_OUTW(HFA384X_EV_CMD, HFA384X_INTEN_OFF); -} - - -static u16 hfa384x_allocate_fid(struct net_device *dev, int len) -{ - u16 fid; - unsigned long delay; - - /* FIX: this could be replace with hfa384x_cmd() if the Alloc event - * below would be handled like CmdCompl event (sleep here, wake up from - * interrupt handler */ - if (hfa384x_cmd_wait(dev, HFA384X_CMDCODE_ALLOC, len)) { - printk(KERN_DEBUG "%s: cannot allocate fid, len=%d\n", - dev->name, len); - return 0xffff; - } - - delay = jiffies + HFA384X_ALLOC_COMPL_TIMEOUT; - while (!(HFA384X_INW(HFA384X_EVSTAT_OFF) & HFA384X_EV_ALLOC) && - time_before(jiffies, delay)) - yield(); - if (!(HFA384X_INW(HFA384X_EVSTAT_OFF) & HFA384X_EV_ALLOC)) { - printk("%s: fid allocate, len=%d - timeout\n", dev->name, len); - return 0xffff; - } - - fid = HFA384X_INW(HFA384X_ALLOCFID_OFF); - HFA384X_OUTW(HFA384X_EV_ALLOC, HFA384X_EVACK_OFF); - - return fid; -} - - -static int prism2_reset_port(struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - int res; - - iface = netdev_priv(dev); - local = iface->local; - - if (!local->dev_enabled) - return 0; - - res = hfa384x_cmd(dev, HFA384X_CMDCODE_DISABLE, 0, - NULL, NULL); - if (res) - printk(KERN_DEBUG "%s: reset port failed to disable port\n", - dev->name); - else { - res = hfa384x_cmd(dev, HFA384X_CMDCODE_ENABLE, 0, - NULL, NULL); - if (res) - printk(KERN_DEBUG "%s: reset port failed to enable " - "port\n", dev->name); - } - - /* It looks like at least some STA firmware versions reset - * fragmentation threshold back to 2346 after enable command. Restore - * the configured value, if it differs from this default. */ - if (local->fragm_threshold != 2346 && - hostap_set_word(dev, HFA384X_RID_FRAGMENTATIONTHRESHOLD, - local->fragm_threshold)) { - printk(KERN_DEBUG "%s: failed to restore fragmentation " - "threshold (%d) after Port0 enable\n", - dev->name, local->fragm_threshold); - } - - /* Some firmwares lose antenna selection settings on reset */ - (void) hostap_set_antsel(local); - - return res; -} - - -static int prism2_get_version_info(struct net_device *dev, u16 rid, - const char *txt) -{ - struct hfa384x_comp_ident comp; - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->no_pri) { - /* PRI f/w not yet available - cannot read RIDs */ - return -1; - } - if (hfa384x_get_rid(dev, rid, &comp, sizeof(comp), 1) < 0) { - printk(KERN_DEBUG "Could not get RID for component %s\n", txt); - return -1; - } - - printk(KERN_INFO "%s: %s: id=0x%02x v%d.%d.%d\n", dev->name, txt, - __le16_to_cpu(comp.id), __le16_to_cpu(comp.major), - __le16_to_cpu(comp.minor), __le16_to_cpu(comp.variant)); - return 0; -} - - -static int prism2_setup_rids(struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - __le16 tmp; - int ret = 0; - - iface = netdev_priv(dev); - local = iface->local; - - hostap_set_word(dev, HFA384X_RID_TICKTIME, 2000); - - if (!local->fw_ap) { - u16 tmp1 = hostap_get_porttype(local); - ret = hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, tmp1); - if (ret) { - printk("%s: Port type setting to %d failed\n", - dev->name, tmp1); - goto fail; - } - } - - /* Setting SSID to empty string seems to kill the card in Host AP mode - */ - if (local->iw_mode != IW_MODE_MASTER || local->essid[0] != '\0') { - ret = hostap_set_string(dev, HFA384X_RID_CNFOWNSSID, - local->essid); - if (ret) { - printk("%s: AP own SSID setting failed\n", dev->name); - goto fail; - } - } - - ret = hostap_set_word(dev, HFA384X_RID_CNFMAXDATALEN, - PRISM2_DATA_MAXLEN); - if (ret) { - printk("%s: MAC data length setting to %d failed\n", - dev->name, PRISM2_DATA_MAXLEN); - goto fail; - } - - if (hfa384x_get_rid(dev, HFA384X_RID_CHANNELLIST, &tmp, 2, 1) < 0) { - printk("%s: Channel list read failed\n", dev->name); - ret = -EINVAL; - goto fail; - } - local->channel_mask = le16_to_cpu(tmp); - - if (local->channel < 1 || local->channel > 14 || - !(local->channel_mask & (1 << (local->channel - 1)))) { - printk(KERN_WARNING "%s: Channel setting out of range " - "(%d)!\n", dev->name, local->channel); - ret = -EBUSY; - goto fail; - } - - ret = hostap_set_word(dev, HFA384X_RID_CNFOWNCHANNEL, local->channel); - if (ret) { - printk("%s: Channel setting to %d failed\n", - dev->name, local->channel); - goto fail; - } - - ret = hostap_set_word(dev, HFA384X_RID_CNFBEACONINT, - local->beacon_int); - if (ret) { - printk("%s: Beacon interval setting to %d failed\n", - dev->name, local->beacon_int); - /* this may fail with Symbol/Lucent firmware */ - if (ret == -ETIMEDOUT) - goto fail; - } - - ret = hostap_set_word(dev, HFA384X_RID_CNFOWNDTIMPERIOD, - local->dtim_period); - if (ret) { - printk("%s: DTIM period setting to %d failed\n", - dev->name, local->dtim_period); - /* this may fail with Symbol/Lucent firmware */ - if (ret == -ETIMEDOUT) - goto fail; - } - - ret = hostap_set_word(dev, HFA384X_RID_PROMISCUOUSMODE, - local->is_promisc); - if (ret) - printk(KERN_INFO "%s: Setting promiscuous mode (%d) failed\n", - dev->name, local->is_promisc); - - if (!local->fw_ap) { - ret = hostap_set_string(dev, HFA384X_RID_CNFDESIREDSSID, - local->essid); - if (ret) { - printk("%s: Desired SSID setting failed\n", dev->name); - goto fail; - } - } - - /* Setup TXRateControl, defaults to allow use of 1, 2, 5.5, and - * 11 Mbps in automatic TX rate fallback and 1 and 2 Mbps as basic - * rates */ - if (local->tx_rate_control == 0) { - local->tx_rate_control = - HFA384X_RATES_1MBPS | - HFA384X_RATES_2MBPS | - HFA384X_RATES_5MBPS | - HFA384X_RATES_11MBPS; - } - if (local->basic_rates == 0) - local->basic_rates = HFA384X_RATES_1MBPS | HFA384X_RATES_2MBPS; - - if (!local->fw_ap) { - ret = hostap_set_word(dev, HFA384X_RID_TXRATECONTROL, - local->tx_rate_control); - if (ret) { - printk("%s: TXRateControl setting to %d failed\n", - dev->name, local->tx_rate_control); - goto fail; - } - - ret = hostap_set_word(dev, HFA384X_RID_CNFSUPPORTEDRATES, - local->tx_rate_control); - if (ret) { - printk("%s: cnfSupportedRates setting to %d failed\n", - dev->name, local->tx_rate_control); - } - - ret = hostap_set_word(dev, HFA384X_RID_CNFBASICRATES, - local->basic_rates); - if (ret) { - printk("%s: cnfBasicRates setting to %d failed\n", - dev->name, local->basic_rates); - } - - ret = hostap_set_word(dev, HFA384X_RID_CREATEIBSS, 1); - if (ret) { - printk("%s: Create IBSS setting to 1 failed\n", - dev->name); - } - } - - if (local->name_set) - (void) hostap_set_string(dev, HFA384X_RID_CNFOWNNAME, - local->name); - - if (hostap_set_encryption(local)) { - printk(KERN_INFO "%s: could not configure encryption\n", - dev->name); - } - - (void) hostap_set_antsel(local); - - if (hostap_set_roaming(local)) { - printk(KERN_INFO "%s: could not set host roaming\n", - dev->name); - } - - if (local->sta_fw_ver >= PRISM2_FW_VER(1,6,3) && - hostap_set_word(dev, HFA384X_RID_CNFENHSECURITY, local->enh_sec)) - printk(KERN_INFO "%s: cnfEnhSecurity setting to 0x%x failed\n", - dev->name, local->enh_sec); - - /* 32-bit tallies were added in STA f/w 0.8.0, but they were apparently - * not working correctly (last seven counters report bogus values). - * This has been fixed in 0.8.2, so enable 32-bit tallies only - * beginning with that firmware version. Another bug fix for 32-bit - * tallies in 1.4.0; should 16-bit tallies be used for some other - * versions, too? */ - if (local->sta_fw_ver >= PRISM2_FW_VER(0,8,2)) { - if (hostap_set_word(dev, HFA384X_RID_CNFTHIRTY2TALLY, 1)) { - printk(KERN_INFO "%s: cnfThirty2Tally setting " - "failed\n", dev->name); - local->tallies32 = 0; - } else - local->tallies32 = 1; - } else - local->tallies32 = 0; - - hostap_set_auth_algs(local); - - if (hostap_set_word(dev, HFA384X_RID_FRAGMENTATIONTHRESHOLD, - local->fragm_threshold)) { - printk(KERN_INFO "%s: setting FragmentationThreshold to %d " - "failed\n", dev->name, local->fragm_threshold); - } - - if (hostap_set_word(dev, HFA384X_RID_RTSTHRESHOLD, - local->rts_threshold)) { - printk(KERN_INFO "%s: setting RTSThreshold to %d failed\n", - dev->name, local->rts_threshold); - } - - if (local->manual_retry_count >= 0 && - hostap_set_word(dev, HFA384X_RID_CNFALTRETRYCOUNT, - local->manual_retry_count)) { - printk(KERN_INFO "%s: setting cnfAltRetryCount to %d failed\n", - dev->name, local->manual_retry_count); - } - - if (local->sta_fw_ver >= PRISM2_FW_VER(1,3,1) && - hfa384x_get_rid(dev, HFA384X_RID_CNFDBMADJUST, &tmp, 2, 1) == 2) { - local->rssi_to_dBm = le16_to_cpu(tmp); - } - - if (local->sta_fw_ver >= PRISM2_FW_VER(1,7,0) && local->wpa && - hostap_set_word(dev, HFA384X_RID_SSNHANDLINGMODE, 1)) { - printk(KERN_INFO "%s: setting ssnHandlingMode to 1 failed\n", - dev->name); - } - - if (local->sta_fw_ver >= PRISM2_FW_VER(1,7,0) && local->generic_elem && - hfa384x_set_rid(dev, HFA384X_RID_GENERICELEMENT, - local->generic_elem, local->generic_elem_len)) { - printk(KERN_INFO "%s: setting genericElement failed\n", - dev->name); - } - - fail: - return ret; -} - - -static int prism2_hw_init(struct net_device *dev, int initial) -{ - struct hostap_interface *iface; - local_info_t *local; - int ret, first = 1; - unsigned long start, delay; - - PDEBUG(DEBUG_FLOW, "prism2_hw_init()\n"); - - iface = netdev_priv(dev); - local = iface->local; - - clear_bit(HOSTAP_BITS_TRANSMIT, &local->bits); - - init: - /* initialize HFA 384x */ - ret = hfa384x_cmd_no_wait(dev, HFA384X_CMDCODE_INIT, 0); - if (ret) { - printk(KERN_INFO "%s: first command failed - assuming card " - "does not have primary firmware\n", dev_info); - } - - if (first && (HFA384X_INW(HFA384X_EVSTAT_OFF) & HFA384X_EV_CMD)) { - /* EvStat has Cmd bit set in some cases, so retry once if no - * wait was needed */ - HFA384X_OUTW(HFA384X_EV_CMD, HFA384X_EVACK_OFF); - printk(KERN_DEBUG "%s: init command completed too quickly - " - "retrying\n", dev->name); - first = 0; - goto init; - } - - start = jiffies; - delay = jiffies + HFA384X_INIT_TIMEOUT; - while (!(HFA384X_INW(HFA384X_EVSTAT_OFF) & HFA384X_EV_CMD) && - time_before(jiffies, delay)) - yield(); - if (!(HFA384X_INW(HFA384X_EVSTAT_OFF) & HFA384X_EV_CMD)) { - printk(KERN_DEBUG "%s: assuming no Primary image in " - "flash - card initialization not completed\n", - dev_info); - local->no_pri = 1; -#ifdef PRISM2_DOWNLOAD_SUPPORT - if (local->sram_type == -1) - local->sram_type = prism2_get_ram_size(local); -#endif /* PRISM2_DOWNLOAD_SUPPORT */ - return 1; - } - local->no_pri = 0; - printk(KERN_DEBUG "prism2_hw_init: initialized in %lu ms\n", - (jiffies - start) * 1000 / HZ); - HFA384X_OUTW(HFA384X_EV_CMD, HFA384X_EVACK_OFF); - return 0; -} - - -static int prism2_hw_init2(struct net_device *dev, int initial) -{ - struct hostap_interface *iface; - local_info_t *local; - int i; - - iface = netdev_priv(dev); - local = iface->local; - -#ifdef PRISM2_DOWNLOAD_SUPPORT - kfree(local->pda); - if (local->no_pri) - local->pda = NULL; - else - local->pda = prism2_read_pda(dev); -#endif /* PRISM2_DOWNLOAD_SUPPORT */ - - hfa384x_disable_interrupts(dev); - -#ifndef final_version - HFA384X_OUTW(HFA384X_MAGIC, HFA384X_SWSUPPORT0_OFF); - if (HFA384X_INW(HFA384X_SWSUPPORT0_OFF) != HFA384X_MAGIC) { - printk("SWSUPPORT0 write/read failed: %04X != %04X\n", - HFA384X_INW(HFA384X_SWSUPPORT0_OFF), HFA384X_MAGIC); - goto failed; - } -#endif - - if (initial || local->pri_only) { - hfa384x_events_only_cmd(dev); - /* get card version information */ - if (prism2_get_version_info(dev, HFA384X_RID_NICID, "NIC") || - prism2_get_version_info(dev, HFA384X_RID_PRIID, "PRI")) { - hfa384x_disable_interrupts(dev); - goto failed; - } - - if (prism2_get_version_info(dev, HFA384X_RID_STAID, "STA")) { - printk(KERN_DEBUG "%s: Failed to read STA f/w version " - "- only Primary f/w present\n", dev->name); - local->pri_only = 1; - return 0; - } - local->pri_only = 0; - hfa384x_disable_interrupts(dev); - } - - /* FIX: could convert allocate_fid to use sleeping CmdCompl wait and - * enable interrupts before this. This would also require some sort of - * sleeping AllocEv waiting */ - - /* allocate TX FIDs */ - local->txfid_len = PRISM2_TXFID_LEN; - for (i = 0; i < PRISM2_TXFID_COUNT; i++) { - local->txfid[i] = hfa384x_allocate_fid(dev, local->txfid_len); - if (local->txfid[i] == 0xffff && local->txfid_len > 1600) { - local->txfid[i] = hfa384x_allocate_fid(dev, 1600); - if (local->txfid[i] != 0xffff) { - printk(KERN_DEBUG "%s: Using shorter TX FID " - "(1600 bytes)\n", dev->name); - local->txfid_len = 1600; - } - } - if (local->txfid[i] == 0xffff) - goto failed; - local->intransmitfid[i] = PRISM2_TXFID_EMPTY; - } - - hfa384x_events_only_cmd(dev); - - if (initial) { - struct list_head *ptr; - prism2_check_sta_fw_version(local); - - if (hfa384x_get_rid(dev, HFA384X_RID_CNFOWNMACADDR, - dev->dev_addr, 6, 1) < 0) { - printk("%s: could not get own MAC address\n", - dev->name); - } - list_for_each(ptr, &local->hostap_interfaces) { - iface = list_entry(ptr, struct hostap_interface, list); - memcpy(iface->dev->dev_addr, dev->dev_addr, ETH_ALEN); - } - } else if (local->fw_ap) - prism2_check_sta_fw_version(local); - - prism2_setup_rids(dev); - - /* MAC is now configured, but port 0 is not yet enabled */ - return 0; - - failed: - if (!local->no_pri) - printk(KERN_WARNING "%s: Initialization failed\n", dev_info); - return 1; -} - - -static int prism2_hw_enable(struct net_device *dev, int initial) -{ - struct hostap_interface *iface; - local_info_t *local; - int was_resetting; - - iface = netdev_priv(dev); - local = iface->local; - was_resetting = local->hw_resetting; - - if (hfa384x_cmd(dev, HFA384X_CMDCODE_ENABLE, 0, NULL, NULL)) { - printk("%s: MAC port 0 enabling failed\n", dev->name); - return 1; - } - - local->hw_ready = 1; - local->hw_reset_tries = 0; - local->hw_resetting = 0; - hfa384x_enable_interrupts(dev); - - /* at least D-Link DWL-650 seems to require additional port reset - * before it starts acting as an AP, so reset port automatically - * here just in case */ - if (initial && prism2_reset_port(dev)) { - printk("%s: MAC port 0 resetting failed\n", dev->name); - return 1; - } - - if (was_resetting && netif_queue_stopped(dev)) { - /* If hw_reset() was called during pending transmit, netif - * queue was stopped. Wake it up now since the wlan card has - * been resetted. */ - netif_wake_queue(dev); - } - - return 0; -} - - -static int prism2_hw_config(struct net_device *dev, int initial) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->hw_downloading) - return 1; - - if (prism2_hw_init(dev, initial)) { - return local->no_pri ? 0 : 1; - } - - if (prism2_hw_init2(dev, initial)) - return 1; - - /* Enable firmware if secondary image is loaded and at least one of the - * netdevices is up. */ - if (!local->pri_only && - (initial == 0 || (initial == 2 && local->num_dev_open > 0))) { - if (!local->dev_enabled) - prism2_callback(local, PRISM2_CALLBACK_ENABLE); - local->dev_enabled = 1; - return prism2_hw_enable(dev, initial); - } - - return 0; -} - - -static void prism2_hw_shutdown(struct net_device *dev, int no_disable) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - /* Allow only command completion events during disable */ - hfa384x_events_only_cmd(dev); - - local->hw_ready = 0; - if (local->dev_enabled) - prism2_callback(local, PRISM2_CALLBACK_DISABLE); - local->dev_enabled = 0; - - if (local->func->card_present && !local->func->card_present(local)) { - printk(KERN_DEBUG "%s: card already removed or not configured " - "during shutdown\n", dev->name); - return; - } - - if ((no_disable & HOSTAP_HW_NO_DISABLE) == 0 && - hfa384x_cmd(dev, HFA384X_CMDCODE_DISABLE, 0, NULL, NULL)) - printk(KERN_WARNING "%s: Shutdown failed\n", dev_info); - - hfa384x_disable_interrupts(dev); - - if (no_disable & HOSTAP_HW_ENABLE_CMDCOMPL) - hfa384x_events_only_cmd(dev); - else - prism2_clear_cmd_queue(local); -} - - -static void prism2_hw_reset(struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - -#if 0 - static long last_reset = 0; - - /* do not reset card more than once per second to avoid ending up in a - * busy loop resetting the card */ - if (time_before_eq(jiffies, last_reset + HZ)) - return; - last_reset = jiffies; -#endif - - iface = netdev_priv(dev); - local = iface->local; - - if (in_interrupt()) { - printk(KERN_DEBUG "%s: driver bug - prism2_hw_reset() called " - "in interrupt context\n", dev->name); - return; - } - - if (local->hw_downloading) - return; - - if (local->hw_resetting) { - printk(KERN_WARNING "%s: %s: already resetting card - " - "ignoring reset request\n", dev_info, dev->name); - return; - } - - local->hw_reset_tries++; - if (local->hw_reset_tries > 10) { - printk(KERN_WARNING "%s: too many reset tries, skipping\n", - dev->name); - return; - } - - printk(KERN_WARNING "%s: %s: resetting card\n", dev_info, dev->name); - hfa384x_disable_interrupts(dev); - local->hw_resetting = 1; - if (local->func->cor_sreset) { - /* Host system seems to hang in some cases with high traffic - * load or shared interrupts during COR sreset. Disable shared - * interrupts during reset to avoid these crashes. COS sreset - * takes quite a long time, so it is unfortunate that this - * seems to be needed. Anyway, I do not know of any better way - * of avoiding the crash. */ - disable_irq(dev->irq); - local->func->cor_sreset(local); - enable_irq(dev->irq); - } - prism2_hw_shutdown(dev, 1); - prism2_hw_config(dev, 0); - local->hw_resetting = 0; - -#ifdef PRISM2_DOWNLOAD_SUPPORT - if (local->dl_pri) { - printk(KERN_DEBUG "%s: persistent download of primary " - "firmware\n", dev->name); - if (prism2_download_genesis(local, local->dl_pri) < 0) - printk(KERN_WARNING "%s: download (PRI) failed\n", - dev->name); - } - - if (local->dl_sec) { - printk(KERN_DEBUG "%s: persistent download of secondary " - "firmware\n", dev->name); - if (prism2_download_volatile(local, local->dl_sec) < 0) - printk(KERN_WARNING "%s: download (SEC) failed\n", - dev->name); - } -#endif /* PRISM2_DOWNLOAD_SUPPORT */ - - /* TODO: restore beacon TIM bits for STAs that have buffered frames */ -} - - -static void prism2_schedule_reset(local_info_t *local) -{ - schedule_work(&local->reset_queue); -} - - -/* Called only as scheduled task after noticing card timeout in interrupt - * context */ -static void handle_reset_queue(struct work_struct *work) -{ - local_info_t *local = container_of(work, local_info_t, reset_queue); - - printk(KERN_DEBUG "%s: scheduled card reset\n", local->dev->name); - prism2_hw_reset(local->dev); - - if (netif_queue_stopped(local->dev)) { - int i; - - for (i = 0; i < PRISM2_TXFID_COUNT; i++) - if (local->intransmitfid[i] == PRISM2_TXFID_EMPTY) { - PDEBUG(DEBUG_EXTRA, "prism2_tx_timeout: " - "wake up queue\n"); - netif_wake_queue(local->dev); - break; - } - } -} - - -static int prism2_get_txfid_idx(local_info_t *local) -{ - int idx, end; - unsigned long flags; - - spin_lock_irqsave(&local->txfidlock, flags); - end = idx = local->next_txfid; - do { - if (local->intransmitfid[idx] == PRISM2_TXFID_EMPTY) { - local->intransmitfid[idx] = PRISM2_TXFID_RESERVED; - spin_unlock_irqrestore(&local->txfidlock, flags); - return idx; - } - idx++; - if (idx >= PRISM2_TXFID_COUNT) - idx = 0; - } while (idx != end); - spin_unlock_irqrestore(&local->txfidlock, flags); - - PDEBUG(DEBUG_EXTRA2, "prism2_get_txfid_idx: no room in txfid buf: " - "packet dropped\n"); - local->dev->stats.tx_dropped++; - - return -1; -} - - -/* Called only from hardware IRQ */ -static void prism2_transmit_cb(struct net_device *dev, long context, - u16 resp0, u16 res) -{ - struct hostap_interface *iface; - local_info_t *local; - int idx = (int) context; - - iface = netdev_priv(dev); - local = iface->local; - - if (res) { - printk(KERN_DEBUG "%s: prism2_transmit_cb - res=0x%02x\n", - dev->name, res); - return; - } - - if (idx < 0 || idx >= PRISM2_TXFID_COUNT) { - printk(KERN_DEBUG "%s: prism2_transmit_cb called with invalid " - "idx=%d\n", dev->name, idx); - return; - } - - if (!test_and_clear_bit(HOSTAP_BITS_TRANSMIT, &local->bits)) { - printk(KERN_DEBUG "%s: driver bug: prism2_transmit_cb called " - "with no pending transmit\n", dev->name); - } - - if (netif_queue_stopped(dev)) { - /* ready for next TX, so wake up queue that was stopped in - * prism2_transmit() */ - netif_wake_queue(dev); - } - - spin_lock(&local->txfidlock); - - /* With reclaim, Resp0 contains new txfid for transmit; the old txfid - * will be automatically allocated for the next TX frame */ - local->intransmitfid[idx] = resp0; - - PDEBUG(DEBUG_FID, "%s: prism2_transmit_cb: txfid[%d]=0x%04x, " - "resp0=0x%04x, transmit_txfid=0x%04x\n", - dev->name, idx, local->txfid[idx], - resp0, local->intransmitfid[local->next_txfid]); - - idx++; - if (idx >= PRISM2_TXFID_COUNT) - idx = 0; - local->next_txfid = idx; - - /* check if all TX buffers are occupied */ - do { - if (local->intransmitfid[idx] == PRISM2_TXFID_EMPTY) { - spin_unlock(&local->txfidlock); - return; - } - idx++; - if (idx >= PRISM2_TXFID_COUNT) - idx = 0; - } while (idx != local->next_txfid); - spin_unlock(&local->txfidlock); - - /* no empty TX buffers, stop queue */ - netif_stop_queue(dev); -} - - -/* Called only from software IRQ if PCI bus master is not used (with bus master - * this can be called both from software and hardware IRQ) */ -static int prism2_transmit(struct net_device *dev, int idx) -{ - struct hostap_interface *iface; - local_info_t *local; - int res; - - iface = netdev_priv(dev); - local = iface->local; - - /* The driver tries to stop netif queue so that there would not be - * more than one attempt to transmit frames going on; check that this - * is really the case */ - - if (test_and_set_bit(HOSTAP_BITS_TRANSMIT, &local->bits)) { - printk(KERN_DEBUG "%s: driver bug - prism2_transmit() called " - "when previous TX was pending\n", dev->name); - return -1; - } - - /* stop the queue for the time that transmit is pending */ - netif_stop_queue(dev); - - /* transmit packet */ - res = hfa384x_cmd_callback( - dev, - HFA384X_CMDCODE_TRANSMIT | HFA384X_CMD_TX_RECLAIM, - local->txfid[idx], - prism2_transmit_cb, (long) idx); - - if (res) { - printk(KERN_DEBUG "%s: prism2_transmit: CMDCODE_TRANSMIT " - "failed (res=%d)\n", dev->name, res); - dev->stats.tx_dropped++; - netif_wake_queue(dev); - return -1; - } - dev->trans_start = jiffies; - - /* Since we did not wait for command completion, the card continues - * to process on the background and we will finish handling when - * command completion event is handled (prism2_cmd_ev() function) */ - - return 0; -} - - -/* Send IEEE 802.11 frame (convert the header into Prism2 TX descriptor and - * send the payload with this descriptor) */ -/* Called only from software IRQ */ -static int prism2_tx_80211(struct sk_buff *skb, struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - struct hfa384x_tx_frame txdesc; - struct hostap_skb_tx_data *meta; - int hdr_len, data_len, idx, res, ret = -1; - u16 tx_control, fc; - - iface = netdev_priv(dev); - local = iface->local; - - meta = (struct hostap_skb_tx_data *) skb->cb; - - prism2_callback(local, PRISM2_CALLBACK_TX_START); - - if ((local->func->card_present && !local->func->card_present(local)) || - !local->hw_ready || local->hw_downloading || local->pri_only) { - if (net_ratelimit()) { - printk(KERN_DEBUG "%s: prism2_tx_80211: hw not ready -" - " skipping\n", dev->name); - } - goto fail; - } - - memset(&txdesc, 0, sizeof(txdesc)); - - /* skb->data starts with txdesc->frame_control */ - hdr_len = 24; - skb_copy_from_linear_data(skb, &txdesc.frame_control, hdr_len); - fc = le16_to_cpu(txdesc.frame_control); - if (ieee80211_is_data(txdesc.frame_control) && - ieee80211_has_a4(txdesc.frame_control) && - skb->len >= 30) { - /* Addr4 */ - skb_copy_from_linear_data_offset(skb, hdr_len, txdesc.addr4, - ETH_ALEN); - hdr_len += ETH_ALEN; - } - - tx_control = local->tx_control; - if (meta->tx_cb_idx) { - tx_control |= HFA384X_TX_CTRL_TX_OK; - txdesc.sw_support = cpu_to_le32(meta->tx_cb_idx); - } - txdesc.tx_control = cpu_to_le16(tx_control); - txdesc.tx_rate = meta->rate; - - data_len = skb->len - hdr_len; - txdesc.data_len = cpu_to_le16(data_len); - txdesc.len = cpu_to_be16(data_len); - - idx = prism2_get_txfid_idx(local); - if (idx < 0) - goto fail; - - if (local->frame_dump & PRISM2_DUMP_TX_HDR) - hostap_dump_tx_header(dev->name, &txdesc); - - spin_lock(&local->baplock); - res = hfa384x_setup_bap(dev, BAP0, local->txfid[idx], 0); - - if (!res) - res = hfa384x_to_bap(dev, BAP0, &txdesc, sizeof(txdesc)); - if (!res) - res = hfa384x_to_bap(dev, BAP0, skb->data + hdr_len, - skb->len - hdr_len); - spin_unlock(&local->baplock); - - if (!res) - res = prism2_transmit(dev, idx); - if (res) { - printk(KERN_DEBUG "%s: prism2_tx_80211 - to BAP0 failed\n", - dev->name); - local->intransmitfid[idx] = PRISM2_TXFID_EMPTY; - schedule_work(&local->reset_queue); - goto fail; - } - - ret = 0; - -fail: - prism2_callback(local, PRISM2_CALLBACK_TX_END); - return ret; -} - - -/* Some SMP systems have reported number of odd errors with hostap_pci. fid - * register has changed values between consecutive reads for an unknown reason. - * This should really not happen, so more debugging is needed. This test - * version is a bit slower, but it will detect most of such register changes - * and will try to get the correct fid eventually. */ -#define EXTRA_FID_READ_TESTS - -static u16 prism2_read_fid_reg(struct net_device *dev, u16 reg) -{ -#ifdef EXTRA_FID_READ_TESTS - u16 val, val2, val3; - int i; - - for (i = 0; i < 10; i++) { - val = HFA384X_INW(reg); - val2 = HFA384X_INW(reg); - val3 = HFA384X_INW(reg); - - if (val == val2 && val == val3) - return val; - - printk(KERN_DEBUG "%s: detected fid change (try=%d, reg=%04x):" - " %04x %04x %04x\n", - dev->name, i, reg, val, val2, val3); - if ((val == val2 || val == val3) && val != 0) - return val; - if (val2 == val3 && val2 != 0) - return val2; - } - printk(KERN_WARNING "%s: Uhhuh.. could not read good fid from reg " - "%04x (%04x %04x %04x)\n", dev->name, reg, val, val2, val3); - return val; -#else /* EXTRA_FID_READ_TESTS */ - return HFA384X_INW(reg); -#endif /* EXTRA_FID_READ_TESTS */ -} - - -/* Called only as a tasklet (software IRQ) */ -static void prism2_rx(local_info_t *local) -{ - struct net_device *dev = local->dev; - int res, rx_pending = 0; - u16 len, hdr_len, rxfid, status, macport; - struct hfa384x_rx_frame rxdesc; - struct sk_buff *skb = NULL; - - prism2_callback(local, PRISM2_CALLBACK_RX_START); - - rxfid = prism2_read_fid_reg(dev, HFA384X_RXFID_OFF); -#ifndef final_version - if (rxfid == 0) { - rxfid = HFA384X_INW(HFA384X_RXFID_OFF); - printk(KERN_DEBUG "prism2_rx: rxfid=0 (next 0x%04x)\n", - rxfid); - if (rxfid == 0) { - schedule_work(&local->reset_queue); - goto rx_dropped; - } - /* try to continue with the new rxfid value */ - } -#endif - - spin_lock(&local->baplock); - res = hfa384x_setup_bap(dev, BAP0, rxfid, 0); - if (!res) - res = hfa384x_from_bap(dev, BAP0, &rxdesc, sizeof(rxdesc)); - - if (res) { - spin_unlock(&local->baplock); - printk(KERN_DEBUG "%s: copy from BAP0 failed %d\n", dev->name, - res); - if (res == -ETIMEDOUT) { - schedule_work(&local->reset_queue); - } - goto rx_dropped; - } - - len = le16_to_cpu(rxdesc.data_len); - hdr_len = sizeof(rxdesc); - status = le16_to_cpu(rxdesc.status); - macport = (status >> 8) & 0x07; - - /* Drop frames with too large reported payload length. Monitor mode - * seems to sometimes pass frames (e.g., ctrl::ack) with signed and - * negative value, so allow also values 65522 .. 65534 (-14 .. -2) for - * macport 7 */ - if (len > PRISM2_DATA_MAXLEN + 8 /* WEP */) { - if (macport == 7 && local->iw_mode == IW_MODE_MONITOR) { - if (len >= (u16) -14) { - hdr_len -= 65535 - len; - hdr_len--; - } - len = 0; - } else { - spin_unlock(&local->baplock); - printk(KERN_DEBUG "%s: Received frame with invalid " - "length 0x%04x\n", dev->name, len); - hostap_dump_rx_header(dev->name, &rxdesc); - goto rx_dropped; - } - } - - skb = dev_alloc_skb(len + hdr_len); - if (!skb) { - spin_unlock(&local->baplock); - printk(KERN_DEBUG "%s: RX failed to allocate skb\n", - dev->name); - goto rx_dropped; - } - skb->dev = dev; - memcpy(skb_put(skb, hdr_len), &rxdesc, hdr_len); - - if (len > 0) - res = hfa384x_from_bap(dev, BAP0, skb_put(skb, len), len); - spin_unlock(&local->baplock); - if (res) { - printk(KERN_DEBUG "%s: RX failed to read " - "frame data\n", dev->name); - goto rx_dropped; - } - - skb_queue_tail(&local->rx_list, skb); - tasklet_schedule(&local->rx_tasklet); - - rx_exit: - prism2_callback(local, PRISM2_CALLBACK_RX_END); - if (!rx_pending) { - HFA384X_OUTW(HFA384X_EV_RX, HFA384X_EVACK_OFF); - } - - return; - - rx_dropped: - dev->stats.rx_dropped++; - if (skb) - dev_kfree_skb(skb); - goto rx_exit; -} - - -/* Called only as a tasklet (software IRQ) */ -static void hostap_rx_skb(local_info_t *local, struct sk_buff *skb) -{ - struct hfa384x_rx_frame *rxdesc; - struct net_device *dev = skb->dev; - struct hostap_80211_rx_status stats; - int hdrlen, rx_hdrlen; - - rx_hdrlen = sizeof(*rxdesc); - if (skb->len < sizeof(*rxdesc)) { - /* Allow monitor mode to receive shorter frames */ - if (local->iw_mode == IW_MODE_MONITOR && - skb->len >= sizeof(*rxdesc) - 30) { - rx_hdrlen = skb->len; - } else { - dev_kfree_skb(skb); - return; - } - } - - rxdesc = (struct hfa384x_rx_frame *) skb->data; - - if (local->frame_dump & PRISM2_DUMP_RX_HDR && - skb->len >= sizeof(*rxdesc)) - hostap_dump_rx_header(dev->name, rxdesc); - - if (le16_to_cpu(rxdesc->status) & HFA384X_RX_STATUS_FCSERR && - (!local->monitor_allow_fcserr || - local->iw_mode != IW_MODE_MONITOR)) - goto drop; - - if (skb->len > PRISM2_DATA_MAXLEN) { - printk(KERN_DEBUG "%s: RX: len(%d) > MAX(%d)\n", - dev->name, skb->len, PRISM2_DATA_MAXLEN); - goto drop; - } - - stats.mac_time = le32_to_cpu(rxdesc->time); - stats.signal = rxdesc->signal - local->rssi_to_dBm; - stats.noise = rxdesc->silence - local->rssi_to_dBm; - stats.rate = rxdesc->rate; - - /* Convert Prism2 RX structure into IEEE 802.11 header */ - hdrlen = hostap_80211_get_hdrlen(rxdesc->frame_control); - if (hdrlen > rx_hdrlen) - hdrlen = rx_hdrlen; - - memmove(skb_pull(skb, rx_hdrlen - hdrlen), - &rxdesc->frame_control, hdrlen); - - hostap_80211_rx(dev, skb, &stats); - return; - - drop: - dev_kfree_skb(skb); -} - - -/* Called only as a tasklet (software IRQ) */ -static void hostap_rx_tasklet(unsigned long data) -{ - local_info_t *local = (local_info_t *) data; - struct sk_buff *skb; - - while ((skb = skb_dequeue(&local->rx_list)) != NULL) - hostap_rx_skb(local, skb); -} - - -/* Called only from hardware IRQ */ -static void prism2_alloc_ev(struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - int idx; - u16 fid; - - iface = netdev_priv(dev); - local = iface->local; - - fid = prism2_read_fid_reg(dev, HFA384X_ALLOCFID_OFF); - - PDEBUG(DEBUG_FID, "FID: interrupt: ALLOC - fid=0x%04x\n", fid); - - spin_lock(&local->txfidlock); - idx = local->next_alloc; - - do { - if (local->txfid[idx] == fid) { - PDEBUG(DEBUG_FID, "FID: found matching txfid[%d]\n", - idx); - -#ifndef final_version - if (local->intransmitfid[idx] == PRISM2_TXFID_EMPTY) - printk("Already released txfid found at idx " - "%d\n", idx); - if (local->intransmitfid[idx] == PRISM2_TXFID_RESERVED) - printk("Already reserved txfid found at idx " - "%d\n", idx); -#endif - local->intransmitfid[idx] = PRISM2_TXFID_EMPTY; - idx++; - local->next_alloc = idx >= PRISM2_TXFID_COUNT ? 0 : - idx; - - if (!test_bit(HOSTAP_BITS_TRANSMIT, &local->bits) && - netif_queue_stopped(dev)) - netif_wake_queue(dev); - - spin_unlock(&local->txfidlock); - return; - } - - idx++; - if (idx >= PRISM2_TXFID_COUNT) - idx = 0; - } while (idx != local->next_alloc); - - printk(KERN_WARNING "%s: could not find matching txfid (0x%04x, new " - "read 0x%04x) for alloc event\n", dev->name, fid, - HFA384X_INW(HFA384X_ALLOCFID_OFF)); - printk(KERN_DEBUG "TXFIDs:"); - for (idx = 0; idx < PRISM2_TXFID_COUNT; idx++) - printk(" %04x[%04x]", local->txfid[idx], - local->intransmitfid[idx]); - printk("\n"); - spin_unlock(&local->txfidlock); - - /* FIX: should probably schedule reset; reference to one txfid was lost - * completely.. Bad things will happen if we run out of txfids - * Actually, this will cause netdev watchdog to notice TX timeout and - * then card reset after all txfids have been leaked. */ -} - - -/* Called only as a tasklet (software IRQ) */ -static void hostap_tx_callback(local_info_t *local, - struct hfa384x_tx_frame *txdesc, int ok, - char *payload) -{ - u16 sw_support, hdrlen, len; - struct sk_buff *skb; - struct hostap_tx_callback_info *cb; - - /* Make sure that frame was from us. */ - if (memcmp(txdesc->addr2, local->dev->dev_addr, ETH_ALEN)) { - printk(KERN_DEBUG "%s: TX callback - foreign frame\n", - local->dev->name); - return; - } - - sw_support = le32_to_cpu(txdesc->sw_support); - - spin_lock(&local->lock); - cb = local->tx_callback; - while (cb != NULL && cb->idx != sw_support) - cb = cb->next; - spin_unlock(&local->lock); - - if (cb == NULL) { - printk(KERN_DEBUG "%s: could not find TX callback (idx %d)\n", - local->dev->name, sw_support); - return; - } - - hdrlen = hostap_80211_get_hdrlen(txdesc->frame_control); - len = le16_to_cpu(txdesc->data_len); - skb = dev_alloc_skb(hdrlen + len); - if (skb == NULL) { - printk(KERN_DEBUG "%s: hostap_tx_callback failed to allocate " - "skb\n", local->dev->name); - return; - } - - memcpy(skb_put(skb, hdrlen), (void *) &txdesc->frame_control, hdrlen); - if (payload) - memcpy(skb_put(skb, len), payload, len); - - skb->dev = local->dev; - skb_reset_mac_header(skb); - - cb->func(skb, ok, cb->data); -} - - -/* Called only as a tasklet (software IRQ) */ -static int hostap_tx_compl_read(local_info_t *local, int error, - struct hfa384x_tx_frame *txdesc, - char **payload) -{ - u16 fid, len; - int res, ret = 0; - struct net_device *dev = local->dev; - - fid = prism2_read_fid_reg(dev, HFA384X_TXCOMPLFID_OFF); - - PDEBUG(DEBUG_FID, "interrupt: TX (err=%d) - fid=0x%04x\n", fid, error); - - spin_lock(&local->baplock); - res = hfa384x_setup_bap(dev, BAP0, fid, 0); - if (!res) - res = hfa384x_from_bap(dev, BAP0, txdesc, sizeof(*txdesc)); - if (res) { - PDEBUG(DEBUG_EXTRA, "%s: TX (err=%d) - fid=0x%04x - could not " - "read txdesc\n", dev->name, error, fid); - if (res == -ETIMEDOUT) { - schedule_work(&local->reset_queue); - } - ret = -1; - goto fail; - } - if (txdesc->sw_support) { - len = le16_to_cpu(txdesc->data_len); - if (len < PRISM2_DATA_MAXLEN) { - *payload = kmalloc(len, GFP_ATOMIC); - if (*payload == NULL || - hfa384x_from_bap(dev, BAP0, *payload, len)) { - PDEBUG(DEBUG_EXTRA, "%s: could not read TX " - "frame payload\n", dev->name); - kfree(*payload); - *payload = NULL; - ret = -1; - goto fail; - } - } - } - - fail: - spin_unlock(&local->baplock); - - return ret; -} - - -/* Called only as a tasklet (software IRQ) */ -static void prism2_tx_ev(local_info_t *local) -{ - struct net_device *dev = local->dev; - char *payload = NULL; - struct hfa384x_tx_frame txdesc; - - if (hostap_tx_compl_read(local, 0, &txdesc, &payload)) - goto fail; - - if (local->frame_dump & PRISM2_DUMP_TX_HDR) { - PDEBUG(DEBUG_EXTRA, "%s: TX - status=0x%04x " - "retry_count=%d tx_rate=%d seq_ctrl=%d " - "duration_id=%d\n", - dev->name, le16_to_cpu(txdesc.status), - txdesc.retry_count, txdesc.tx_rate, - le16_to_cpu(txdesc.seq_ctrl), - le16_to_cpu(txdesc.duration_id)); - } - - if (txdesc.sw_support) - hostap_tx_callback(local, &txdesc, 1, payload); - kfree(payload); - - fail: - HFA384X_OUTW(HFA384X_EV_TX, HFA384X_EVACK_OFF); -} - - -/* Called only as a tasklet (software IRQ) */ -static void hostap_sta_tx_exc_tasklet(unsigned long data) -{ - local_info_t *local = (local_info_t *) data; - struct sk_buff *skb; - - while ((skb = skb_dequeue(&local->sta_tx_exc_list)) != NULL) { - struct hfa384x_tx_frame *txdesc = - (struct hfa384x_tx_frame *) skb->data; - - if (skb->len >= sizeof(*txdesc)) { - /* Convert Prism2 RX structure into IEEE 802.11 header - */ - int hdrlen = hostap_80211_get_hdrlen(txdesc->frame_control); - memmove(skb_pull(skb, sizeof(*txdesc) - hdrlen), - &txdesc->frame_control, hdrlen); - - hostap_handle_sta_tx_exc(local, skb); - } - dev_kfree_skb(skb); - } -} - - -/* Called only as a tasklet (software IRQ) */ -static void prism2_txexc(local_info_t *local) -{ - struct net_device *dev = local->dev; - u16 status, fc; - int show_dump, res; - char *payload = NULL; - struct hfa384x_tx_frame txdesc; - - show_dump = local->frame_dump & PRISM2_DUMP_TXEXC_HDR; - dev->stats.tx_errors++; - - res = hostap_tx_compl_read(local, 1, &txdesc, &payload); - HFA384X_OUTW(HFA384X_EV_TXEXC, HFA384X_EVACK_OFF); - if (res) - return; - - status = le16_to_cpu(txdesc.status); - - /* We produce a TXDROP event only for retry or lifetime - * exceeded, because that's the only status that really mean - * that this particular node went away. - * Other errors means that *we* screwed up. - Jean II */ - if (status & (HFA384X_TX_STATUS_RETRYERR | HFA384X_TX_STATUS_AGEDERR)) - { - union iwreq_data wrqu; - - /* Copy 802.11 dest address. */ - memcpy(wrqu.addr.sa_data, txdesc.addr1, ETH_ALEN); - wrqu.addr.sa_family = ARPHRD_ETHER; - wireless_send_event(dev, IWEVTXDROP, &wrqu, NULL); - } else - show_dump = 1; - - if (local->iw_mode == IW_MODE_MASTER || - local->iw_mode == IW_MODE_REPEAT || - local->wds_type & HOSTAP_WDS_AP_CLIENT) { - struct sk_buff *skb; - skb = dev_alloc_skb(sizeof(txdesc)); - if (skb) { - memcpy(skb_put(skb, sizeof(txdesc)), &txdesc, - sizeof(txdesc)); - skb_queue_tail(&local->sta_tx_exc_list, skb); - tasklet_schedule(&local->sta_tx_exc_tasklet); - } - } - - if (txdesc.sw_support) - hostap_tx_callback(local, &txdesc, 0, payload); - kfree(payload); - - if (!show_dump) - return; - - PDEBUG(DEBUG_EXTRA, "%s: TXEXC - status=0x%04x (%s%s%s%s)" - " tx_control=%04x\n", - dev->name, status, - status & HFA384X_TX_STATUS_RETRYERR ? "[RetryErr]" : "", - status & HFA384X_TX_STATUS_AGEDERR ? "[AgedErr]" : "", - status & HFA384X_TX_STATUS_DISCON ? "[Discon]" : "", - status & HFA384X_TX_STATUS_FORMERR ? "[FormErr]" : "", - le16_to_cpu(txdesc.tx_control)); - - fc = le16_to_cpu(txdesc.frame_control); - PDEBUG(DEBUG_EXTRA, " retry_count=%d tx_rate=%d fc=0x%04x " - "(%s%s%s::%d%s%s)\n", - txdesc.retry_count, txdesc.tx_rate, fc, - ieee80211_is_mgmt(txdesc.frame_control) ? "Mgmt" : "", - ieee80211_is_ctl(txdesc.frame_control) ? "Ctrl" : "", - ieee80211_is_data(txdesc.frame_control) ? "Data" : "", - (fc & IEEE80211_FCTL_STYPE) >> 4, - ieee80211_has_tods(txdesc.frame_control) ? " ToDS" : "", - ieee80211_has_fromds(txdesc.frame_control) ? " FromDS" : ""); - PDEBUG(DEBUG_EXTRA, " A1=%pM A2=%pM A3=%pM A4=%pM\n", - txdesc.addr1, txdesc.addr2, - txdesc.addr3, txdesc.addr4); -} - - -/* Called only as a tasklet (software IRQ) */ -static void hostap_info_tasklet(unsigned long data) -{ - local_info_t *local = (local_info_t *) data; - struct sk_buff *skb; - - while ((skb = skb_dequeue(&local->info_list)) != NULL) { - hostap_info_process(local, skb); - dev_kfree_skb(skb); - } -} - - -/* Called only as a tasklet (software IRQ) */ -static void prism2_info(local_info_t *local) -{ - struct net_device *dev = local->dev; - u16 fid; - int res, left; - struct hfa384x_info_frame info; - struct sk_buff *skb; - - fid = HFA384X_INW(HFA384X_INFOFID_OFF); - - spin_lock(&local->baplock); - res = hfa384x_setup_bap(dev, BAP0, fid, 0); - if (!res) - res = hfa384x_from_bap(dev, BAP0, &info, sizeof(info)); - if (res) { - spin_unlock(&local->baplock); - printk(KERN_DEBUG "Could not get info frame (fid=0x%04x)\n", - fid); - if (res == -ETIMEDOUT) { - schedule_work(&local->reset_queue); - } - goto out; - } - - left = (le16_to_cpu(info.len) - 1) * 2; - - if (info.len & cpu_to_le16(0x8000) || info.len == 0 || left > 2060) { - /* data register seems to give 0x8000 in some error cases even - * though busy bit is not set in offset register; - * in addition, length must be at least 1 due to type field */ - spin_unlock(&local->baplock); - printk(KERN_DEBUG "%s: Received info frame with invalid " - "length 0x%04x (type 0x%04x)\n", dev->name, - le16_to_cpu(info.len), le16_to_cpu(info.type)); - goto out; - } - - skb = dev_alloc_skb(sizeof(info) + left); - if (skb == NULL) { - spin_unlock(&local->baplock); - printk(KERN_DEBUG "%s: Could not allocate skb for info " - "frame\n", dev->name); - goto out; - } - - memcpy(skb_put(skb, sizeof(info)), &info, sizeof(info)); - if (left > 0 && hfa384x_from_bap(dev, BAP0, skb_put(skb, left), left)) - { - spin_unlock(&local->baplock); - printk(KERN_WARNING "%s: Info frame read failed (fid=0x%04x, " - "len=0x%04x, type=0x%04x\n", dev->name, fid, - le16_to_cpu(info.len), le16_to_cpu(info.type)); - dev_kfree_skb(skb); - goto out; - } - spin_unlock(&local->baplock); - - skb_queue_tail(&local->info_list, skb); - tasklet_schedule(&local->info_tasklet); - - out: - HFA384X_OUTW(HFA384X_EV_INFO, HFA384X_EVACK_OFF); -} - - -/* Called only as a tasklet (software IRQ) */ -static void hostap_bap_tasklet(unsigned long data) -{ - local_info_t *local = (local_info_t *) data; - struct net_device *dev = local->dev; - u16 ev; - int frames = 30; - - if (local->func->card_present && !local->func->card_present(local)) - return; - - set_bit(HOSTAP_BITS_BAP_TASKLET, &local->bits); - - /* Process all pending BAP events without generating new interrupts - * for them */ - while (frames-- > 0) { - ev = HFA384X_INW(HFA384X_EVSTAT_OFF); - if (ev == 0xffff || !(ev & HFA384X_BAP0_EVENTS)) - break; - if (ev & HFA384X_EV_RX) - prism2_rx(local); - if (ev & HFA384X_EV_INFO) - prism2_info(local); - if (ev & HFA384X_EV_TX) - prism2_tx_ev(local); - if (ev & HFA384X_EV_TXEXC) - prism2_txexc(local); - } - - set_bit(HOSTAP_BITS_BAP_TASKLET2, &local->bits); - clear_bit(HOSTAP_BITS_BAP_TASKLET, &local->bits); - - /* Enable interrupts for new BAP events */ - hfa384x_events_all(dev); - clear_bit(HOSTAP_BITS_BAP_TASKLET2, &local->bits); -} - - -/* Called only from hardware IRQ */ -static void prism2_infdrop(struct net_device *dev) -{ - static unsigned long last_inquire = 0; - - PDEBUG(DEBUG_EXTRA, "%s: INFDROP event\n", dev->name); - - /* some firmware versions seem to get stuck with - * full CommTallies in high traffic load cases; every - * packet will then cause INFDROP event and CommTallies - * info frame will not be sent automatically. Try to - * get out of this state by inquiring CommTallies. */ - if (!last_inquire || time_after(jiffies, last_inquire + HZ)) { - hfa384x_cmd_callback(dev, HFA384X_CMDCODE_INQUIRE, - HFA384X_INFO_COMMTALLIES, NULL, 0); - last_inquire = jiffies; - } -} - - -/* Called only from hardware IRQ */ -static void prism2_ev_tick(struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - u16 evstat, inten; - static int prev_stuck = 0; - - iface = netdev_priv(dev); - local = iface->local; - - if (time_after(jiffies, local->last_tick_timer + 5 * HZ) && - local->last_tick_timer) { - evstat = HFA384X_INW(HFA384X_EVSTAT_OFF); - inten = HFA384X_INW(HFA384X_INTEN_OFF); - if (!prev_stuck) { - printk(KERN_INFO "%s: SW TICK stuck? " - "bits=0x%lx EvStat=%04x IntEn=%04x\n", - dev->name, local->bits, evstat, inten); - } - local->sw_tick_stuck++; - if ((evstat & HFA384X_BAP0_EVENTS) && - (inten & HFA384X_BAP0_EVENTS)) { - printk(KERN_INFO "%s: trying to recover from IRQ " - "hang\n", dev->name); - hfa384x_events_no_bap0(dev); - } - prev_stuck = 1; - } else - prev_stuck = 0; -} - - -/* Called only from hardware IRQ */ -static void prism2_check_magic(local_info_t *local) -{ - /* at least PCI Prism2.5 with bus mastering seems to sometimes - * return 0x0000 in SWSUPPORT0 for unknown reason, but re-reading the - * register once or twice seems to get the correct value.. PCI cards - * cannot anyway be removed during normal operation, so there is not - * really any need for this verification with them. */ - -#ifndef PRISM2_PCI -#ifndef final_version - static unsigned long last_magic_err = 0; - struct net_device *dev = local->dev; - - if (HFA384X_INW(HFA384X_SWSUPPORT0_OFF) != HFA384X_MAGIC) { - if (!local->hw_ready) - return; - HFA384X_OUTW(0xffff, HFA384X_EVACK_OFF); - if (time_after(jiffies, last_magic_err + 10 * HZ)) { - printk("%s: Interrupt, but SWSUPPORT0 does not match: " - "%04X != %04X - card removed?\n", dev->name, - HFA384X_INW(HFA384X_SWSUPPORT0_OFF), - HFA384X_MAGIC); - last_magic_err = jiffies; - } else if (net_ratelimit()) { - printk(KERN_DEBUG "%s: interrupt - SWSUPPORT0=%04x " - "MAGIC=%04x\n", dev->name, - HFA384X_INW(HFA384X_SWSUPPORT0_OFF), - HFA384X_MAGIC); - } - if (HFA384X_INW(HFA384X_SWSUPPORT0_OFF) != 0xffff) - schedule_work(&local->reset_queue); - return; - } -#endif /* final_version */ -#endif /* !PRISM2_PCI */ -} - - -/* Called only from hardware IRQ */ -static irqreturn_t prism2_interrupt(int irq, void *dev_id) -{ - struct net_device *dev = dev_id; - struct hostap_interface *iface; - local_info_t *local; - int events = 0; - u16 ev; - - iface = netdev_priv(dev); - local = iface->local; - - /* Detect early interrupt before driver is fully configured */ - spin_lock(&local->irq_init_lock); - if (!dev->base_addr) { - if (net_ratelimit()) { - printk(KERN_DEBUG "%s: Interrupt, but dev not configured\n", - dev->name); - } - spin_unlock(&local->irq_init_lock); - return IRQ_HANDLED; - } - spin_unlock(&local->irq_init_lock); - - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INTERRUPT, 0, 0); - - if (local->func->card_present && !local->func->card_present(local)) { - if (net_ratelimit()) { - printk(KERN_DEBUG "%s: Interrupt, but dev not OK\n", - dev->name); - } - return IRQ_HANDLED; - } - - prism2_check_magic(local); - - for (;;) { - ev = HFA384X_INW(HFA384X_EVSTAT_OFF); - if (ev == 0xffff) { - if (local->shutdown) - return IRQ_HANDLED; - HFA384X_OUTW(0xffff, HFA384X_EVACK_OFF); - printk(KERN_DEBUG "%s: prism2_interrupt: ev=0xffff\n", - dev->name); - return IRQ_HANDLED; - } - - ev &= HFA384X_INW(HFA384X_INTEN_OFF); - if (ev == 0) - break; - - if (ev & HFA384X_EV_CMD) { - prism2_cmd_ev(dev); - } - - /* Above events are needed even before hw is ready, but other - * events should be skipped during initialization. This may - * change for AllocEv if allocate_fid is implemented without - * busy waiting. */ - if (!local->hw_ready || local->hw_resetting || - !local->dev_enabled) { - ev = HFA384X_INW(HFA384X_EVSTAT_OFF); - if (ev & HFA384X_EV_CMD) - goto next_event; - if ((ev & HFA384X_EVENT_MASK) == 0) - return IRQ_HANDLED; - if (local->dev_enabled && (ev & ~HFA384X_EV_TICK) && - net_ratelimit()) { - printk(KERN_DEBUG "%s: prism2_interrupt: hw " - "not ready; skipping events 0x%04x " - "(IntEn=0x%04x)%s%s%s\n", - dev->name, ev, - HFA384X_INW(HFA384X_INTEN_OFF), - !local->hw_ready ? " (!hw_ready)" : "", - local->hw_resetting ? - " (hw_resetting)" : "", - !local->dev_enabled ? - " (!dev_enabled)" : ""); - } - HFA384X_OUTW(ev, HFA384X_EVACK_OFF); - return IRQ_HANDLED; - } - - if (ev & HFA384X_EV_TICK) { - prism2_ev_tick(dev); - HFA384X_OUTW(HFA384X_EV_TICK, HFA384X_EVACK_OFF); - } - - if (ev & HFA384X_EV_ALLOC) { - prism2_alloc_ev(dev); - HFA384X_OUTW(HFA384X_EV_ALLOC, HFA384X_EVACK_OFF); - } - - /* Reading data from the card is quite time consuming, so do it - * in tasklets. TX, TXEXC, RX, and INFO events will be ACKed - * and unmasked after needed data has been read completely. */ - if (ev & HFA384X_BAP0_EVENTS) { - hfa384x_events_no_bap0(dev); - tasklet_schedule(&local->bap_tasklet); - } - -#ifndef final_version - if (ev & HFA384X_EV_WTERR) { - PDEBUG(DEBUG_EXTRA, "%s: WTERR event\n", dev->name); - HFA384X_OUTW(HFA384X_EV_WTERR, HFA384X_EVACK_OFF); - } -#endif /* final_version */ - - if (ev & HFA384X_EV_INFDROP) { - prism2_infdrop(dev); - HFA384X_OUTW(HFA384X_EV_INFDROP, HFA384X_EVACK_OFF); - } - - next_event: - events++; - if (events >= PRISM2_MAX_INTERRUPT_EVENTS) { - PDEBUG(DEBUG_EXTRA, "prism2_interrupt: >%d events " - "(EvStat=0x%04x)\n", - PRISM2_MAX_INTERRUPT_EVENTS, - HFA384X_INW(HFA384X_EVSTAT_OFF)); - break; - } - } - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INTERRUPT, 0, 1); - return IRQ_RETVAL(events); -} - - -static void prism2_check_sta_fw_version(local_info_t *local) -{ - struct hfa384x_comp_ident comp; - int id, variant, major, minor; - - if (hfa384x_get_rid(local->dev, HFA384X_RID_STAID, - &comp, sizeof(comp), 1) < 0) - return; - - local->fw_ap = 0; - id = le16_to_cpu(comp.id); - if (id != HFA384X_COMP_ID_STA) { - if (id == HFA384X_COMP_ID_FW_AP) - local->fw_ap = 1; - return; - } - - major = __le16_to_cpu(comp.major); - minor = __le16_to_cpu(comp.minor); - variant = __le16_to_cpu(comp.variant); - local->sta_fw_ver = PRISM2_FW_VER(major, minor, variant); - - /* Station firmware versions before 1.4.x seem to have a bug in - * firmware-based WEP encryption when using Host AP mode, so use - * host_encrypt as a default for them. Firmware version 1.4.9 is the - * first one that has been seen to produce correct encryption, but the - * bug might be fixed before that (although, at least 1.4.2 is broken). - */ - local->fw_encrypt_ok = local->sta_fw_ver >= PRISM2_FW_VER(1,4,9); - - if (local->iw_mode == IW_MODE_MASTER && !local->host_encrypt && - !local->fw_encrypt_ok) { - printk(KERN_DEBUG "%s: defaulting to host-based encryption as " - "a workaround for firmware bug in Host AP mode WEP\n", - local->dev->name); - local->host_encrypt = 1; - } - - /* IEEE 802.11 standard compliant WDS frames (4 addresses) were broken - * in station firmware versions before 1.5.x. With these versions, the - * driver uses a workaround with bogus frame format (4th address after - * the payload). This is not compatible with other AP devices. Since - * the firmware bug is fixed in the latest station firmware versions, - * automatically enable standard compliant mode for cards using station - * firmware version 1.5.0 or newer. */ - if (local->sta_fw_ver >= PRISM2_FW_VER(1,5,0)) - local->wds_type |= HOSTAP_WDS_STANDARD_FRAME; - else { - printk(KERN_DEBUG "%s: defaulting to bogus WDS frame as a " - "workaround for firmware bug in Host AP mode WDS\n", - local->dev->name); - } - - hostap_check_sta_fw_version(local->ap, local->sta_fw_ver); -} - - -static void hostap_passive_scan(unsigned long data) -{ - local_info_t *local = (local_info_t *) data; - struct net_device *dev = local->dev; - u16 chan; - - if (local->passive_scan_interval <= 0) - return; - - if (local->passive_scan_state == PASSIVE_SCAN_LISTEN) { - int max_tries = 16; - - /* Even though host system does not really know when the WLAN - * MAC is sending frames, try to avoid changing channels for - * passive scanning when a host-generated frame is being - * transmitted */ - if (test_bit(HOSTAP_BITS_TRANSMIT, &local->bits)) { - printk(KERN_DEBUG "%s: passive scan detected pending " - "TX - delaying\n", dev->name); - local->passive_scan_timer.expires = jiffies + HZ / 10; - add_timer(&local->passive_scan_timer); - return; - } - - do { - local->passive_scan_channel++; - if (local->passive_scan_channel > 14) - local->passive_scan_channel = 1; - max_tries--; - } while (!(local->channel_mask & - (1 << (local->passive_scan_channel - 1))) && - max_tries > 0); - - if (max_tries == 0) { - printk(KERN_INFO "%s: no allowed passive scan channels" - " found\n", dev->name); - return; - } - - printk(KERN_DEBUG "%s: passive scan channel %d\n", - dev->name, local->passive_scan_channel); - chan = local->passive_scan_channel; - local->passive_scan_state = PASSIVE_SCAN_WAIT; - local->passive_scan_timer.expires = jiffies + HZ / 10; - } else { - chan = local->channel; - local->passive_scan_state = PASSIVE_SCAN_LISTEN; - local->passive_scan_timer.expires = jiffies + - local->passive_scan_interval * HZ; - } - - if (hfa384x_cmd_callback(dev, HFA384X_CMDCODE_TEST | - (HFA384X_TEST_CHANGE_CHANNEL << 8), - chan, NULL, 0)) - printk(KERN_ERR "%s: passive scan channel set %d " - "failed\n", dev->name, chan); - - add_timer(&local->passive_scan_timer); -} - - -/* Called only as a scheduled task when communications quality values should - * be updated. */ -static void handle_comms_qual_update(struct work_struct *work) -{ - local_info_t *local = - container_of(work, local_info_t, comms_qual_update); - prism2_update_comms_qual(local->dev); -} - - -/* Software watchdog - called as a timer. Hardware interrupt (Tick event) is - * used to monitor that local->last_tick_timer is being updated. If not, - * interrupt busy-loop is assumed and driver tries to recover by masking out - * some events. */ -static void hostap_tick_timer(unsigned long data) -{ - static unsigned long last_inquire = 0; - local_info_t *local = (local_info_t *) data; - local->last_tick_timer = jiffies; - - /* Inquire CommTallies every 10 seconds to keep the statistics updated - * more often during low load and when using 32-bit tallies. */ - if ((!last_inquire || time_after(jiffies, last_inquire + 10 * HZ)) && - !local->hw_downloading && local->hw_ready && - !local->hw_resetting && local->dev_enabled) { - hfa384x_cmd_callback(local->dev, HFA384X_CMDCODE_INQUIRE, - HFA384X_INFO_COMMTALLIES, NULL, 0); - last_inquire = jiffies; - } - - if ((local->last_comms_qual_update == 0 || - time_after(jiffies, local->last_comms_qual_update + 10 * HZ)) && - (local->iw_mode == IW_MODE_INFRA || - local->iw_mode == IW_MODE_ADHOC)) { - schedule_work(&local->comms_qual_update); - } - - local->tick_timer.expires = jiffies + 2 * HZ; - add_timer(&local->tick_timer); -} - - -#ifndef PRISM2_NO_PROCFS_DEBUG -static int prism2_registers_proc_show(struct seq_file *m, void *v) -{ - local_info_t *local = m->private; - -#define SHOW_REG(n) \ - seq_printf(m, #n "=%04x\n", hfa384x_read_reg(local->dev, HFA384X_##n##_OFF)) - - SHOW_REG(CMD); - SHOW_REG(PARAM0); - SHOW_REG(PARAM1); - SHOW_REG(PARAM2); - SHOW_REG(STATUS); - SHOW_REG(RESP0); - SHOW_REG(RESP1); - SHOW_REG(RESP2); - SHOW_REG(INFOFID); - SHOW_REG(CONTROL); - SHOW_REG(SELECT0); - SHOW_REG(SELECT1); - SHOW_REG(OFFSET0); - SHOW_REG(OFFSET1); - SHOW_REG(RXFID); - SHOW_REG(ALLOCFID); - SHOW_REG(TXCOMPLFID); - SHOW_REG(SWSUPPORT0); - SHOW_REG(SWSUPPORT1); - SHOW_REG(SWSUPPORT2); - SHOW_REG(EVSTAT); - SHOW_REG(INTEN); - SHOW_REG(EVACK); - /* Do not read data registers, because they change the state of the - * MAC (offset += 2) */ - /* SHOW_REG(DATA0); */ - /* SHOW_REG(DATA1); */ - SHOW_REG(AUXPAGE); - SHOW_REG(AUXOFFSET); - /* SHOW_REG(AUXDATA); */ -#ifdef PRISM2_PCI - SHOW_REG(PCICOR); - SHOW_REG(PCIHCR); - SHOW_REG(PCI_M0_ADDRH); - SHOW_REG(PCI_M0_ADDRL); - SHOW_REG(PCI_M0_LEN); - SHOW_REG(PCI_M0_CTL); - SHOW_REG(PCI_STATUS); - SHOW_REG(PCI_M1_ADDRH); - SHOW_REG(PCI_M1_ADDRL); - SHOW_REG(PCI_M1_LEN); - SHOW_REG(PCI_M1_CTL); -#endif /* PRISM2_PCI */ - - return 0; -} - -static int prism2_registers_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, prism2_registers_proc_show, PDE_DATA(inode)); -} - -static const struct file_operations prism2_registers_proc_fops = { - .open = prism2_registers_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -#endif /* PRISM2_NO_PROCFS_DEBUG */ - - -struct set_tim_data { - struct list_head list; - int aid; - int set; -}; - -static int prism2_set_tim(struct net_device *dev, int aid, int set) -{ - struct list_head *ptr; - struct set_tim_data *new_entry; - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - new_entry = kzalloc(sizeof(*new_entry), GFP_ATOMIC); - if (new_entry == NULL) - return -ENOMEM; - - new_entry->aid = aid; - new_entry->set = set; - - spin_lock_bh(&local->set_tim_lock); - list_for_each(ptr, &local->set_tim_list) { - struct set_tim_data *entry = - list_entry(ptr, struct set_tim_data, list); - if (entry->aid == aid) { - PDEBUG(DEBUG_PS2, "%s: prism2_set_tim: aid=%d " - "set=%d ==> %d\n", - local->dev->name, aid, entry->set, set); - entry->set = set; - kfree(new_entry); - new_entry = NULL; - break; - } - } - if (new_entry) - list_add_tail(&new_entry->list, &local->set_tim_list); - spin_unlock_bh(&local->set_tim_lock); - - schedule_work(&local->set_tim_queue); - - return 0; -} - - -static void handle_set_tim_queue(struct work_struct *work) -{ - local_info_t *local = container_of(work, local_info_t, set_tim_queue); - struct set_tim_data *entry; - u16 val; - - for (;;) { - entry = NULL; - spin_lock_bh(&local->set_tim_lock); - if (!list_empty(&local->set_tim_list)) { - entry = list_entry(local->set_tim_list.next, - struct set_tim_data, list); - list_del(&entry->list); - } - spin_unlock_bh(&local->set_tim_lock); - if (!entry) - break; - - PDEBUG(DEBUG_PS2, "%s: handle_set_tim_queue: aid=%d set=%d\n", - local->dev->name, entry->aid, entry->set); - - val = entry->aid; - if (entry->set) - val |= 0x8000; - if (hostap_set_word(local->dev, HFA384X_RID_CNFTIMCTRL, val)) { - printk(KERN_DEBUG "%s: set_tim failed (aid=%d " - "set=%d)\n", - local->dev->name, entry->aid, entry->set); - } - - kfree(entry); - } -} - - -static void prism2_clear_set_tim_queue(local_info_t *local) -{ - struct list_head *ptr, *n; - - list_for_each_safe(ptr, n, &local->set_tim_list) { - struct set_tim_data *entry; - entry = list_entry(ptr, struct set_tim_data, list); - list_del(&entry->list); - kfree(entry); - } -} - - -/* - * HostAP uses two layers of net devices, where the inner - * layer gets called all the time from the outer layer. - * This is a natural nesting, which needs a split lock type. - */ -static struct lock_class_key hostap_netdev_xmit_lock_key; -static struct lock_class_key hostap_netdev_addr_lock_key; - -static void prism2_set_lockdep_class_one(struct net_device *dev, - struct netdev_queue *txq, - void *_unused) -{ - lockdep_set_class(&txq->_xmit_lock, - &hostap_netdev_xmit_lock_key); -} - -static void prism2_set_lockdep_class(struct net_device *dev) -{ - lockdep_set_class(&dev->addr_list_lock, - &hostap_netdev_addr_lock_key); - netdev_for_each_tx_queue(dev, prism2_set_lockdep_class_one, NULL); -} - -static struct net_device * -prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx, - struct device *sdev) -{ - struct net_device *dev; - struct hostap_interface *iface; - struct local_info *local; - int len, i, ret; - - if (funcs == NULL) - return NULL; - - len = strlen(dev_template); - if (len >= IFNAMSIZ || strstr(dev_template, "%d") == NULL) { - printk(KERN_WARNING "hostap: Invalid dev_template='%s'\n", - dev_template); - return NULL; - } - - len = sizeof(struct hostap_interface) + - 3 + sizeof(struct local_info) + - 3 + sizeof(struct ap_data); - - dev = alloc_etherdev(len); - if (dev == NULL) - return NULL; - - iface = netdev_priv(dev); - local = (struct local_info *) ((((long) (iface + 1)) + 3) & ~3); - local->ap = (struct ap_data *) ((((long) (local + 1)) + 3) & ~3); - local->dev = iface->dev = dev; - iface->local = local; - iface->type = HOSTAP_INTERFACE_MASTER; - INIT_LIST_HEAD(&local->hostap_interfaces); - - local->hw_module = THIS_MODULE; - -#ifdef PRISM2_IO_DEBUG - local->io_debug_enabled = 1; -#endif /* PRISM2_IO_DEBUG */ - - local->func = funcs; - local->func->cmd = hfa384x_cmd; - local->func->read_regs = hfa384x_read_regs; - local->func->get_rid = hfa384x_get_rid; - local->func->set_rid = hfa384x_set_rid; - local->func->hw_enable = prism2_hw_enable; - local->func->hw_config = prism2_hw_config; - local->func->hw_reset = prism2_hw_reset; - local->func->hw_shutdown = prism2_hw_shutdown; - local->func->reset_port = prism2_reset_port; - local->func->schedule_reset = prism2_schedule_reset; -#ifdef PRISM2_DOWNLOAD_SUPPORT - local->func->read_aux_fops = &prism2_download_aux_dump_proc_fops; - local->func->download = prism2_download; -#endif /* PRISM2_DOWNLOAD_SUPPORT */ - local->func->tx = prism2_tx_80211; - local->func->set_tim = prism2_set_tim; - local->func->need_tx_headroom = 0; /* no need to add txdesc in - * skb->data (FIX: maybe for DMA bus - * mastering? */ - - local->mtu = mtu; - - rwlock_init(&local->iface_lock); - spin_lock_init(&local->txfidlock); - spin_lock_init(&local->cmdlock); - spin_lock_init(&local->baplock); - spin_lock_init(&local->lock); - spin_lock_init(&local->irq_init_lock); - mutex_init(&local->rid_bap_mtx); - - if (card_idx < 0 || card_idx >= MAX_PARM_DEVICES) - card_idx = 0; - local->card_idx = card_idx; - - len = strlen(essid); - memcpy(local->essid, essid, - len > MAX_SSID_LEN ? MAX_SSID_LEN : len); - local->essid[MAX_SSID_LEN] = '\0'; - i = GET_INT_PARM(iw_mode, card_idx); - if ((i >= IW_MODE_ADHOC && i <= IW_MODE_REPEAT) || - i == IW_MODE_MONITOR) { - local->iw_mode = i; - } else { - printk(KERN_WARNING "prism2: Unknown iw_mode %d; using " - "IW_MODE_MASTER\n", i); - local->iw_mode = IW_MODE_MASTER; - } - local->channel = GET_INT_PARM(channel, card_idx); - local->beacon_int = GET_INT_PARM(beacon_int, card_idx); - local->dtim_period = GET_INT_PARM(dtim_period, card_idx); - local->wds_max_connections = 16; - local->tx_control = HFA384X_TX_CTRL_FLAGS; - local->manual_retry_count = -1; - local->rts_threshold = 2347; - local->fragm_threshold = 2346; - local->rssi_to_dBm = 100; /* default; to be overriden by - * cnfDbmAdjust, if available */ - local->auth_algs = PRISM2_AUTH_OPEN | PRISM2_AUTH_SHARED_KEY; - local->sram_type = -1; - local->scan_channel_mask = 0xffff; - local->monitor_type = PRISM2_MONITOR_RADIOTAP; - - /* Initialize task queue structures */ - INIT_WORK(&local->reset_queue, handle_reset_queue); - INIT_WORK(&local->set_multicast_list_queue, - hostap_set_multicast_list_queue); - - INIT_WORK(&local->set_tim_queue, handle_set_tim_queue); - INIT_LIST_HEAD(&local->set_tim_list); - spin_lock_init(&local->set_tim_lock); - - INIT_WORK(&local->comms_qual_update, handle_comms_qual_update); - - /* Initialize tasklets for handling hardware IRQ related operations - * outside hw IRQ handler */ -#define HOSTAP_TASKLET_INIT(q, f, d) \ -do { memset((q), 0, sizeof(*(q))); (q)->func = (f); (q)->data = (d); } \ -while (0) - HOSTAP_TASKLET_INIT(&local->bap_tasklet, hostap_bap_tasklet, - (unsigned long) local); - - HOSTAP_TASKLET_INIT(&local->info_tasklet, hostap_info_tasklet, - (unsigned long) local); - hostap_info_init(local); - - HOSTAP_TASKLET_INIT(&local->rx_tasklet, - hostap_rx_tasklet, (unsigned long) local); - skb_queue_head_init(&local->rx_list); - - HOSTAP_TASKLET_INIT(&local->sta_tx_exc_tasklet, - hostap_sta_tx_exc_tasklet, (unsigned long) local); - skb_queue_head_init(&local->sta_tx_exc_list); - - INIT_LIST_HEAD(&local->cmd_queue); - init_waitqueue_head(&local->hostscan_wq); - - lib80211_crypt_info_init(&local->crypt_info, dev->name, &local->lock); - - init_timer(&local->passive_scan_timer); - local->passive_scan_timer.data = (unsigned long) local; - local->passive_scan_timer.function = hostap_passive_scan; - - init_timer(&local->tick_timer); - local->tick_timer.data = (unsigned long) local; - local->tick_timer.function = hostap_tick_timer; - local->tick_timer.expires = jiffies + 2 * HZ; - add_timer(&local->tick_timer); - - INIT_LIST_HEAD(&local->bss_list); - - hostap_setup_dev(dev, local, HOSTAP_INTERFACE_MASTER); - - dev->type = ARPHRD_IEEE80211; - dev->header_ops = &hostap_80211_ops; - - rtnl_lock(); - ret = dev_alloc_name(dev, "wifi%d"); - SET_NETDEV_DEV(dev, sdev); - if (ret >= 0) - ret = register_netdevice(dev); - - prism2_set_lockdep_class(dev); - rtnl_unlock(); - if (ret < 0) { - printk(KERN_WARNING "%s: register netdevice failed!\n", - dev_info); - goto fail; - } - printk(KERN_INFO "%s: Registered netdevice %s\n", dev_info, dev->name); - - hostap_init_data(local); - return dev; - - fail: - free_netdev(dev); - return NULL; -} - - -static int hostap_hw_ready(struct net_device *dev) -{ - struct hostap_interface *iface; - struct local_info *local; - - iface = netdev_priv(dev); - local = iface->local; - local->ddev = hostap_add_interface(local, HOSTAP_INTERFACE_MAIN, 0, - "", dev_template); - - if (local->ddev) { - if (local->iw_mode == IW_MODE_INFRA || - local->iw_mode == IW_MODE_ADHOC) { - netif_carrier_off(local->dev); - netif_carrier_off(local->ddev); - } - hostap_init_proc(local); -#ifndef PRISM2_NO_PROCFS_DEBUG - proc_create_data("registers", 0, local->proc, - &prism2_registers_proc_fops, local); -#endif /* PRISM2_NO_PROCFS_DEBUG */ - hostap_init_ap_proc(local); - return 0; - } - - return -1; -} - - -static void prism2_free_local_data(struct net_device *dev) -{ - struct hostap_tx_callback_info *tx_cb, *tx_cb_prev; - int i; - struct hostap_interface *iface; - struct local_info *local; - struct list_head *ptr, *n; - - if (dev == NULL) - return; - - iface = netdev_priv(dev); - local = iface->local; - - /* Unregister all netdevs before freeing local data. */ - list_for_each_safe(ptr, n, &local->hostap_interfaces) { - iface = list_entry(ptr, struct hostap_interface, list); - if (iface->type == HOSTAP_INTERFACE_MASTER) { - /* special handling for this interface below */ - continue; - } - hostap_remove_interface(iface->dev, 0, 1); - } - - unregister_netdev(local->dev); - - flush_work(&local->reset_queue); - flush_work(&local->set_multicast_list_queue); - flush_work(&local->set_tim_queue); -#ifndef PRISM2_NO_STATION_MODES - flush_work(&local->info_queue); -#endif - flush_work(&local->comms_qual_update); - - lib80211_crypt_info_free(&local->crypt_info); - - if (timer_pending(&local->passive_scan_timer)) - del_timer(&local->passive_scan_timer); - - if (timer_pending(&local->tick_timer)) - del_timer(&local->tick_timer); - - prism2_clear_cmd_queue(local); - - skb_queue_purge(&local->info_list); - skb_queue_purge(&local->rx_list); - skb_queue_purge(&local->sta_tx_exc_list); - - if (local->dev_enabled) - prism2_callback(local, PRISM2_CALLBACK_DISABLE); - - if (local->ap != NULL) - hostap_free_data(local->ap); - -#ifndef PRISM2_NO_PROCFS_DEBUG - if (local->proc != NULL) - remove_proc_entry("registers", local->proc); -#endif /* PRISM2_NO_PROCFS_DEBUG */ - hostap_remove_proc(local); - - tx_cb = local->tx_callback; - while (tx_cb != NULL) { - tx_cb_prev = tx_cb; - tx_cb = tx_cb->next; - kfree(tx_cb_prev); - } - - hostap_set_hostapd(local, 0, 0); - hostap_set_hostapd_sta(local, 0, 0); - - for (i = 0; i < PRISM2_FRAG_CACHE_LEN; i++) { - if (local->frag_cache[i].skb != NULL) - dev_kfree_skb(local->frag_cache[i].skb); - } - -#ifdef PRISM2_DOWNLOAD_SUPPORT - prism2_download_free_data(local->dl_pri); - prism2_download_free_data(local->dl_sec); -#endif /* PRISM2_DOWNLOAD_SUPPORT */ - - prism2_clear_set_tim_queue(local); - - list_for_each_safe(ptr, n, &local->bss_list) { - struct hostap_bss_info *bss = - list_entry(ptr, struct hostap_bss_info, list); - kfree(bss); - } - - kfree(local->pda); - kfree(local->last_scan_results); - kfree(local->generic_elem); - - free_netdev(local->dev); -} - - -#if (defined(PRISM2_PCI) && defined(CONFIG_PM)) || defined(PRISM2_PCCARD) -static void prism2_suspend(struct net_device *dev) -{ - struct hostap_interface *iface; - struct local_info *local; - union iwreq_data wrqu; - - iface = netdev_priv(dev); - local = iface->local; - - /* Send disconnect event, e.g., to trigger reassociation after resume - * if wpa_supplicant is used. */ - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL); - - /* Disable hardware and firmware */ - prism2_hw_shutdown(dev, 0); -} -#endif /* (PRISM2_PCI && CONFIG_PM) || PRISM2_PCCARD */ - - -/* These might at some point be compiled separately and used as separate - * kernel modules or linked into one */ -#ifdef PRISM2_DOWNLOAD_SUPPORT -#include "hostap_download.c" -#endif /* PRISM2_DOWNLOAD_SUPPORT */ - -#ifdef PRISM2_CALLBACK -/* External hostap_callback.c file can be used to, e.g., blink activity led. - * This can use platform specific code and must define prism2_callback() - * function (if PRISM2_CALLBACK is not defined, these function calls are not - * used. */ -#include "hostap_callback.c" -#endif /* PRISM2_CALLBACK */ diff --git a/drivers/net/wireless/hostap/hostap_info.c b/drivers/net/wireless/hostap/hostap_info.c deleted file mode 100644 index 970a48baaf80..000000000000 --- a/drivers/net/wireless/hostap/hostap_info.c +++ /dev/null @@ -1,507 +0,0 @@ -/* Host AP driver Info Frame processing (part of hostap.o module) */ - -#include -#include -#include -#include -#include -#include "hostap_wlan.h" -#include "hostap.h" -#include "hostap_ap.h" - -/* Called only as a tasklet (software IRQ) */ -static void prism2_info_commtallies16(local_info_t *local, unsigned char *buf, - int left) -{ - struct hfa384x_comm_tallies *tallies; - - if (left < sizeof(struct hfa384x_comm_tallies)) { - printk(KERN_DEBUG "%s: too short (len=%d) commtallies " - "info frame\n", local->dev->name, left); - return; - } - - tallies = (struct hfa384x_comm_tallies *) buf; -#define ADD_COMM_TALLIES(name) \ -local->comm_tallies.name += le16_to_cpu(tallies->name) - ADD_COMM_TALLIES(tx_unicast_frames); - ADD_COMM_TALLIES(tx_multicast_frames); - ADD_COMM_TALLIES(tx_fragments); - ADD_COMM_TALLIES(tx_unicast_octets); - ADD_COMM_TALLIES(tx_multicast_octets); - ADD_COMM_TALLIES(tx_deferred_transmissions); - ADD_COMM_TALLIES(tx_single_retry_frames); - ADD_COMM_TALLIES(tx_multiple_retry_frames); - ADD_COMM_TALLIES(tx_retry_limit_exceeded); - ADD_COMM_TALLIES(tx_discards); - ADD_COMM_TALLIES(rx_unicast_frames); - ADD_COMM_TALLIES(rx_multicast_frames); - ADD_COMM_TALLIES(rx_fragments); - ADD_COMM_TALLIES(rx_unicast_octets); - ADD_COMM_TALLIES(rx_multicast_octets); - ADD_COMM_TALLIES(rx_fcs_errors); - ADD_COMM_TALLIES(rx_discards_no_buffer); - ADD_COMM_TALLIES(tx_discards_wrong_sa); - ADD_COMM_TALLIES(rx_discards_wep_undecryptable); - ADD_COMM_TALLIES(rx_message_in_msg_fragments); - ADD_COMM_TALLIES(rx_message_in_bad_msg_fragments); -#undef ADD_COMM_TALLIES -} - - -/* Called only as a tasklet (software IRQ) */ -static void prism2_info_commtallies32(local_info_t *local, unsigned char *buf, - int left) -{ - struct hfa384x_comm_tallies32 *tallies; - - if (left < sizeof(struct hfa384x_comm_tallies32)) { - printk(KERN_DEBUG "%s: too short (len=%d) commtallies32 " - "info frame\n", local->dev->name, left); - return; - } - - tallies = (struct hfa384x_comm_tallies32 *) buf; -#define ADD_COMM_TALLIES(name) \ -local->comm_tallies.name += le32_to_cpu(tallies->name) - ADD_COMM_TALLIES(tx_unicast_frames); - ADD_COMM_TALLIES(tx_multicast_frames); - ADD_COMM_TALLIES(tx_fragments); - ADD_COMM_TALLIES(tx_unicast_octets); - ADD_COMM_TALLIES(tx_multicast_octets); - ADD_COMM_TALLIES(tx_deferred_transmissions); - ADD_COMM_TALLIES(tx_single_retry_frames); - ADD_COMM_TALLIES(tx_multiple_retry_frames); - ADD_COMM_TALLIES(tx_retry_limit_exceeded); - ADD_COMM_TALLIES(tx_discards); - ADD_COMM_TALLIES(rx_unicast_frames); - ADD_COMM_TALLIES(rx_multicast_frames); - ADD_COMM_TALLIES(rx_fragments); - ADD_COMM_TALLIES(rx_unicast_octets); - ADD_COMM_TALLIES(rx_multicast_octets); - ADD_COMM_TALLIES(rx_fcs_errors); - ADD_COMM_TALLIES(rx_discards_no_buffer); - ADD_COMM_TALLIES(tx_discards_wrong_sa); - ADD_COMM_TALLIES(rx_discards_wep_undecryptable); - ADD_COMM_TALLIES(rx_message_in_msg_fragments); - ADD_COMM_TALLIES(rx_message_in_bad_msg_fragments); -#undef ADD_COMM_TALLIES -} - - -/* Called only as a tasklet (software IRQ) */ -static void prism2_info_commtallies(local_info_t *local, unsigned char *buf, - int left) -{ - if (local->tallies32) - prism2_info_commtallies32(local, buf, left); - else - prism2_info_commtallies16(local, buf, left); -} - - -#ifndef PRISM2_NO_STATION_MODES -#ifndef PRISM2_NO_DEBUG -static const char* hfa384x_linkstatus_str(u16 linkstatus) -{ - switch (linkstatus) { - case HFA384X_LINKSTATUS_CONNECTED: - return "Connected"; - case HFA384X_LINKSTATUS_DISCONNECTED: - return "Disconnected"; - case HFA384X_LINKSTATUS_AP_CHANGE: - return "Access point change"; - case HFA384X_LINKSTATUS_AP_OUT_OF_RANGE: - return "Access point out of range"; - case HFA384X_LINKSTATUS_AP_IN_RANGE: - return "Access point in range"; - case HFA384X_LINKSTATUS_ASSOC_FAILED: - return "Association failed"; - default: - return "Unknown"; - } -} -#endif /* PRISM2_NO_DEBUG */ - - -/* Called only as a tasklet (software IRQ) */ -static void prism2_info_linkstatus(local_info_t *local, unsigned char *buf, - int left) -{ - u16 val; - int non_sta_mode; - - /* Alloc new JoinRequests to occur since LinkStatus for the previous - * has been received */ - local->last_join_time = 0; - - if (left != 2) { - printk(KERN_DEBUG "%s: invalid linkstatus info frame " - "length %d\n", local->dev->name, left); - return; - } - - non_sta_mode = local->iw_mode == IW_MODE_MASTER || - local->iw_mode == IW_MODE_REPEAT || - local->iw_mode == IW_MODE_MONITOR; - - val = buf[0] | (buf[1] << 8); - if (!non_sta_mode || val != HFA384X_LINKSTATUS_DISCONNECTED) { - PDEBUG(DEBUG_EXTRA, "%s: LinkStatus=%d (%s)\n", - local->dev->name, val, hfa384x_linkstatus_str(val)); - } - - if (non_sta_mode) { - netif_carrier_on(local->dev); - netif_carrier_on(local->ddev); - return; - } - - /* Get current BSSID later in scheduled task */ - set_bit(PRISM2_INFO_PENDING_LINKSTATUS, &local->pending_info); - local->prev_link_status = val; - schedule_work(&local->info_queue); -} - - -static void prism2_host_roaming(local_info_t *local) -{ - struct hfa384x_join_request req; - struct net_device *dev = local->dev; - struct hfa384x_hostscan_result *selected, *entry; - int i; - unsigned long flags; - - if (local->last_join_time && - time_before(jiffies, local->last_join_time + 10 * HZ)) { - PDEBUG(DEBUG_EXTRA, "%s: last join request has not yet been " - "completed - waiting for it before issuing new one\n", - dev->name); - return; - } - - /* ScanResults are sorted: first ESS results in decreasing signal - * quality then IBSS results in similar order. - * Trivial roaming policy: just select the first entry. - * This could probably be improved by adding hysteresis to limit - * number of handoffs, etc. - * - * Could do periodic RID_SCANREQUEST or Inquire F101 to get new - * ScanResults */ - spin_lock_irqsave(&local->lock, flags); - if (local->last_scan_results == NULL || - local->last_scan_results_count == 0) { - spin_unlock_irqrestore(&local->lock, flags); - PDEBUG(DEBUG_EXTRA, "%s: no scan results for host roaming\n", - dev->name); - return; - } - - selected = &local->last_scan_results[0]; - - if (local->preferred_ap[0] || local->preferred_ap[1] || - local->preferred_ap[2] || local->preferred_ap[3] || - local->preferred_ap[4] || local->preferred_ap[5]) { - /* Try to find preferred AP */ - PDEBUG(DEBUG_EXTRA, "%s: Preferred AP BSSID %pM\n", - dev->name, local->preferred_ap); - for (i = 0; i < local->last_scan_results_count; i++) { - entry = &local->last_scan_results[i]; - if (memcmp(local->preferred_ap, entry->bssid, 6) == 0) - { - PDEBUG(DEBUG_EXTRA, "%s: using preferred AP " - "selection\n", dev->name); - selected = entry; - break; - } - } - } - - memcpy(req.bssid, selected->bssid, 6); - req.channel = selected->chid; - spin_unlock_irqrestore(&local->lock, flags); - - PDEBUG(DEBUG_EXTRA, "%s: JoinRequest: BSSID=%pM" - " channel=%d\n", - dev->name, req.bssid, le16_to_cpu(req.channel)); - if (local->func->set_rid(dev, HFA384X_RID_JOINREQUEST, &req, - sizeof(req))) { - printk(KERN_DEBUG "%s: JoinRequest failed\n", dev->name); - } - local->last_join_time = jiffies; -} - - -static void hostap_report_scan_complete(local_info_t *local) -{ - union iwreq_data wrqu; - - /* Inform user space about new scan results (just empty event, - * SIOCGIWSCAN can be used to fetch data */ - wrqu.data.length = 0; - wrqu.data.flags = 0; - wireless_send_event(local->dev, SIOCGIWSCAN, &wrqu, NULL); - - /* Allow SIOCGIWSCAN handling to occur since we have received - * scanning result */ - local->scan_timestamp = 0; -} - - -/* Called only as a tasklet (software IRQ) */ -static void prism2_info_scanresults(local_info_t *local, unsigned char *buf, - int left) -{ - u16 *pos; - int new_count, i; - unsigned long flags; - struct hfa384x_scan_result *res; - struct hfa384x_hostscan_result *results, *prev; - - if (left < 4) { - printk(KERN_DEBUG "%s: invalid scanresult info frame " - "length %d\n", local->dev->name, left); - return; - } - - pos = (u16 *) buf; - pos++; - pos++; - left -= 4; - - new_count = left / sizeof(struct hfa384x_scan_result); - results = kmalloc(new_count * sizeof(struct hfa384x_hostscan_result), - GFP_ATOMIC); - if (results == NULL) - return; - - /* Convert to hostscan result format. */ - res = (struct hfa384x_scan_result *) pos; - for (i = 0; i < new_count; i++) { - memcpy(&results[i], &res[i], - sizeof(struct hfa384x_scan_result)); - results[i].atim = 0; - } - - spin_lock_irqsave(&local->lock, flags); - local->last_scan_type = PRISM2_SCAN; - prev = local->last_scan_results; - local->last_scan_results = results; - local->last_scan_results_count = new_count; - spin_unlock_irqrestore(&local->lock, flags); - kfree(prev); - - hostap_report_scan_complete(local); - - /* Perform rest of ScanResults handling later in scheduled task */ - set_bit(PRISM2_INFO_PENDING_SCANRESULTS, &local->pending_info); - schedule_work(&local->info_queue); -} - - -/* Called only as a tasklet (software IRQ) */ -static void prism2_info_hostscanresults(local_info_t *local, - unsigned char *buf, int left) -{ - int i, result_size, copy_len, new_count; - struct hfa384x_hostscan_result *results, *prev; - unsigned long flags; - __le16 *pos; - u8 *ptr; - - wake_up_interruptible(&local->hostscan_wq); - - if (left < 4) { - printk(KERN_DEBUG "%s: invalid hostscanresult info frame " - "length %d\n", local->dev->name, left); - return; - } - - pos = (__le16 *) buf; - copy_len = result_size = le16_to_cpu(*pos); - if (result_size == 0) { - printk(KERN_DEBUG "%s: invalid result_size (0) in " - "hostscanresults\n", local->dev->name); - return; - } - if (copy_len > sizeof(struct hfa384x_hostscan_result)) - copy_len = sizeof(struct hfa384x_hostscan_result); - - pos++; - pos++; - left -= 4; - ptr = (u8 *) pos; - - new_count = left / result_size; - results = kcalloc(new_count, sizeof(struct hfa384x_hostscan_result), - GFP_ATOMIC); - if (results == NULL) - return; - - for (i = 0; i < new_count; i++) { - memcpy(&results[i], ptr, copy_len); - ptr += result_size; - left -= result_size; - } - - if (left) { - printk(KERN_DEBUG "%s: short HostScan result entry (%d/%d)\n", - local->dev->name, left, result_size); - } - - spin_lock_irqsave(&local->lock, flags); - local->last_scan_type = PRISM2_HOSTSCAN; - prev = local->last_scan_results; - local->last_scan_results = results; - local->last_scan_results_count = new_count; - spin_unlock_irqrestore(&local->lock, flags); - kfree(prev); - - hostap_report_scan_complete(local); -} -#endif /* PRISM2_NO_STATION_MODES */ - - -/* Called only as a tasklet (software IRQ) */ -void hostap_info_process(local_info_t *local, struct sk_buff *skb) -{ - struct hfa384x_info_frame *info; - unsigned char *buf; - int left; -#ifndef PRISM2_NO_DEBUG - int i; -#endif /* PRISM2_NO_DEBUG */ - - info = (struct hfa384x_info_frame *) skb->data; - buf = skb->data + sizeof(*info); - left = skb->len - sizeof(*info); - - switch (le16_to_cpu(info->type)) { - case HFA384X_INFO_COMMTALLIES: - prism2_info_commtallies(local, buf, left); - break; - -#ifndef PRISM2_NO_STATION_MODES - case HFA384X_INFO_LINKSTATUS: - prism2_info_linkstatus(local, buf, left); - break; - - case HFA384X_INFO_SCANRESULTS: - prism2_info_scanresults(local, buf, left); - break; - - case HFA384X_INFO_HOSTSCANRESULTS: - prism2_info_hostscanresults(local, buf, left); - break; -#endif /* PRISM2_NO_STATION_MODES */ - -#ifndef PRISM2_NO_DEBUG - default: - PDEBUG(DEBUG_EXTRA, "%s: INFO - len=%d type=0x%04x\n", - local->dev->name, le16_to_cpu(info->len), - le16_to_cpu(info->type)); - PDEBUG(DEBUG_EXTRA, "Unknown info frame:"); - for (i = 0; i < (left < 100 ? left : 100); i++) - PDEBUG2(DEBUG_EXTRA, " %02x", buf[i]); - PDEBUG2(DEBUG_EXTRA, "\n"); - break; -#endif /* PRISM2_NO_DEBUG */ - } -} - - -#ifndef PRISM2_NO_STATION_MODES -static void handle_info_queue_linkstatus(local_info_t *local) -{ - int val = local->prev_link_status; - int connected; - union iwreq_data wrqu; - - connected = - val == HFA384X_LINKSTATUS_CONNECTED || - val == HFA384X_LINKSTATUS_AP_CHANGE || - val == HFA384X_LINKSTATUS_AP_IN_RANGE; - - if (local->func->get_rid(local->dev, HFA384X_RID_CURRENTBSSID, - local->bssid, ETH_ALEN, 1) < 0) { - printk(KERN_DEBUG "%s: could not read CURRENTBSSID after " - "LinkStatus event\n", local->dev->name); - } else { - PDEBUG(DEBUG_EXTRA, "%s: LinkStatus: BSSID=%pM\n", - local->dev->name, - (unsigned char *) local->bssid); - if (local->wds_type & HOSTAP_WDS_AP_CLIENT) - hostap_add_sta(local->ap, local->bssid); - } - - /* Get BSSID if we have a valid AP address */ - if (connected) { - netif_carrier_on(local->dev); - netif_carrier_on(local->ddev); - memcpy(wrqu.ap_addr.sa_data, local->bssid, ETH_ALEN); - } else { - netif_carrier_off(local->dev); - netif_carrier_off(local->ddev); - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); - } - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - - /* - * Filter out sequential disconnect events in order not to cause a - * flood of SIOCGIWAP events that have a race condition with EAPOL - * frames and can confuse wpa_supplicant about the current association - * status. - */ - if (connected || local->prev_linkstatus_connected) - wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL); - local->prev_linkstatus_connected = connected; -} - - -static void handle_info_queue_scanresults(local_info_t *local) -{ - if (local->host_roaming == 1 && local->iw_mode == IW_MODE_INFRA) - prism2_host_roaming(local); - - if (local->host_roaming == 2 && local->iw_mode == IW_MODE_INFRA && - !is_zero_ether_addr(local->preferred_ap)) { - /* - * Firmware seems to be getting into odd state in host_roaming - * mode 2 when hostscan is used without join command, so try - * to fix this by re-joining the current AP. This does not - * actually trigger a new association if the current AP is - * still in the scan results. - */ - prism2_host_roaming(local); - } -} - - -/* Called only as scheduled task after receiving info frames (used to avoid - * pending too much time in HW IRQ handler). */ -static void handle_info_queue(struct work_struct *work) -{ - local_info_t *local = container_of(work, local_info_t, info_queue); - - if (test_and_clear_bit(PRISM2_INFO_PENDING_LINKSTATUS, - &local->pending_info)) - handle_info_queue_linkstatus(local); - - if (test_and_clear_bit(PRISM2_INFO_PENDING_SCANRESULTS, - &local->pending_info)) - handle_info_queue_scanresults(local); -} -#endif /* PRISM2_NO_STATION_MODES */ - - -void hostap_info_init(local_info_t *local) -{ - skb_queue_head_init(&local->info_list); -#ifndef PRISM2_NO_STATION_MODES - INIT_WORK(&local->info_queue, handle_info_queue); -#endif /* PRISM2_NO_STATION_MODES */ -} - - -EXPORT_SYMBOL(hostap_info_init); -EXPORT_SYMBOL(hostap_info_process); diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c deleted file mode 100644 index e5090309824e..000000000000 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ /dev/null @@ -1,4054 +0,0 @@ -/* ioctl() (mostly Linux Wireless Extensions) routines for Host AP driver */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "hostap_wlan.h" -#include "hostap.h" -#include "hostap_ap.h" - -static struct iw_statistics *hostap_get_wireless_stats(struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - struct iw_statistics *wstats; - - iface = netdev_priv(dev); - local = iface->local; - - /* Why are we doing that ? Jean II */ - if (iface->type != HOSTAP_INTERFACE_MAIN) - return NULL; - - wstats = &local->wstats; - - wstats->status = 0; - wstats->discard.code = - local->comm_tallies.rx_discards_wep_undecryptable; - wstats->discard.misc = - local->comm_tallies.rx_fcs_errors + - local->comm_tallies.rx_discards_no_buffer + - local->comm_tallies.tx_discards_wrong_sa; - - wstats->discard.retries = - local->comm_tallies.tx_retry_limit_exceeded; - wstats->discard.fragment = - local->comm_tallies.rx_message_in_bad_msg_fragments; - - if (local->iw_mode != IW_MODE_MASTER && - local->iw_mode != IW_MODE_REPEAT) { - int update = 1; -#ifdef in_atomic - /* RID reading might sleep and it must not be called in - * interrupt context or while atomic. However, this - * function seems to be called while atomic (at least in Linux - * 2.5.59). Update signal quality values only if in suitable - * context. Otherwise, previous values read from tick timer - * will be used. */ - if (in_atomic()) - update = 0; -#endif /* in_atomic */ - - if (update && prism2_update_comms_qual(dev) == 0) - wstats->qual.updated = IW_QUAL_ALL_UPDATED | - IW_QUAL_DBM; - - wstats->qual.qual = local->comms_qual; - wstats->qual.level = local->avg_signal; - wstats->qual.noise = local->avg_noise; - } else { - wstats->qual.qual = 0; - wstats->qual.level = 0; - wstats->qual.noise = 0; - wstats->qual.updated = IW_QUAL_ALL_INVALID; - } - - return wstats; -} - - -static int prism2_get_datarates(struct net_device *dev, u8 *rates) -{ - struct hostap_interface *iface; - local_info_t *local; - u8 buf[12]; - int len; - u16 val; - - iface = netdev_priv(dev); - local = iface->local; - - len = local->func->get_rid(dev, HFA384X_RID_SUPPORTEDDATARATES, buf, - sizeof(buf), 0); - if (len < 2) - return 0; - - val = le16_to_cpu(*(__le16 *) buf); /* string length */ - - if (len - 2 < val || val > 10) - return 0; - - memcpy(rates, buf + 2, val); - return val; -} - - -static int prism2_get_name(struct net_device *dev, - struct iw_request_info *info, - char *name, char *extra) -{ - u8 rates[10]; - int len, i, over2 = 0; - - len = prism2_get_datarates(dev, rates); - - for (i = 0; i < len; i++) { - if (rates[i] == 0x0b || rates[i] == 0x16) { - over2 = 1; - break; - } - } - - strcpy(name, over2 ? "IEEE 802.11b" : "IEEE 802.11-DS"); - - return 0; -} - - -static int prism2_ioctl_siwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *keybuf) -{ - struct hostap_interface *iface; - local_info_t *local; - int i; - struct lib80211_crypt_data **crypt; - - iface = netdev_priv(dev); - local = iface->local; - - i = erq->flags & IW_ENCODE_INDEX; - if (i < 1 || i > 4) - i = local->crypt_info.tx_keyidx; - else - i--; - if (i < 0 || i >= WEP_KEYS) - return -EINVAL; - - crypt = &local->crypt_info.crypt[i]; - - if (erq->flags & IW_ENCODE_DISABLED) { - if (*crypt) - lib80211_crypt_delayed_deinit(&local->crypt_info, crypt); - goto done; - } - - if (*crypt != NULL && (*crypt)->ops != NULL && - strcmp((*crypt)->ops->name, "WEP") != 0) { - /* changing to use WEP; deinit previously used algorithm */ - lib80211_crypt_delayed_deinit(&local->crypt_info, crypt); - } - - if (*crypt == NULL) { - struct lib80211_crypt_data *new_crypt; - - /* take WEP into use */ - new_crypt = kzalloc(sizeof(struct lib80211_crypt_data), - GFP_KERNEL); - if (new_crypt == NULL) - return -ENOMEM; - new_crypt->ops = lib80211_get_crypto_ops("WEP"); - if (!new_crypt->ops) { - request_module("lib80211_crypt_wep"); - new_crypt->ops = lib80211_get_crypto_ops("WEP"); - } - if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) - new_crypt->priv = new_crypt->ops->init(i); - if (!new_crypt->ops || !new_crypt->priv) { - kfree(new_crypt); - new_crypt = NULL; - - printk(KERN_WARNING "%s: could not initialize WEP: " - "load module hostap_crypt_wep.o\n", - dev->name); - return -EOPNOTSUPP; - } - *crypt = new_crypt; - } - - if (erq->length > 0) { - int len = erq->length <= 5 ? 5 : 13; - int first = 1, j; - if (len > erq->length) - memset(keybuf + erq->length, 0, len - erq->length); - (*crypt)->ops->set_key(keybuf, len, NULL, (*crypt)->priv); - for (j = 0; j < WEP_KEYS; j++) { - if (j != i && local->crypt_info.crypt[j]) { - first = 0; - break; - } - } - if (first) - local->crypt_info.tx_keyidx = i; - } else { - /* No key data - just set the default TX key index */ - local->crypt_info.tx_keyidx = i; - } - - done: - local->open_wep = erq->flags & IW_ENCODE_OPEN; - - if (hostap_set_encryption(local)) { - printk(KERN_DEBUG "%s: set_encryption failed\n", dev->name); - return -EINVAL; - } - - /* Do not reset port0 if card is in Managed mode since resetting will - * generate new IEEE 802.11 authentication which may end up in looping - * with IEEE 802.1X. Prism2 documentation seem to require port reset - * after WEP configuration. However, keys are apparently changed at - * least in Managed mode. */ - if (local->iw_mode != IW_MODE_INFRA && local->func->reset_port(dev)) { - printk(KERN_DEBUG "%s: reset_port failed\n", dev->name); - return -EINVAL; - } - - return 0; -} - - -static int prism2_ioctl_giwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *key) -{ - struct hostap_interface *iface; - local_info_t *local; - int i, len; - u16 val; - struct lib80211_crypt_data *crypt; - - iface = netdev_priv(dev); - local = iface->local; - - i = erq->flags & IW_ENCODE_INDEX; - if (i < 1 || i > 4) - i = local->crypt_info.tx_keyidx; - else - i--; - if (i < 0 || i >= WEP_KEYS) - return -EINVAL; - - crypt = local->crypt_info.crypt[i]; - erq->flags = i + 1; - - if (crypt == NULL || crypt->ops == NULL) { - erq->length = 0; - erq->flags |= IW_ENCODE_DISABLED; - return 0; - } - - if (strcmp(crypt->ops->name, "WEP") != 0) { - /* only WEP is supported with wireless extensions, so just - * report that encryption is used */ - erq->length = 0; - erq->flags |= IW_ENCODE_ENABLED; - return 0; - } - - /* Reads from HFA384X_RID_CNFDEFAULTKEY* return bogus values, so show - * the keys from driver buffer */ - len = crypt->ops->get_key(key, WEP_KEY_LEN, NULL, crypt->priv); - erq->length = (len >= 0 ? len : 0); - - if (local->func->get_rid(dev, HFA384X_RID_CNFWEPFLAGS, &val, 2, 1) < 0) - { - printk("CNFWEPFLAGS reading failed\n"); - return -EOPNOTSUPP; - } - le16_to_cpus(&val); - if (val & HFA384X_WEPFLAGS_PRIVACYINVOKED) - erq->flags |= IW_ENCODE_ENABLED; - else - erq->flags |= IW_ENCODE_DISABLED; - if (val & HFA384X_WEPFLAGS_EXCLUDEUNENCRYPTED) - erq->flags |= IW_ENCODE_RESTRICTED; - else - erq->flags |= IW_ENCODE_OPEN; - - return 0; -} - - -static int hostap_set_rate(struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - int ret, basic_rates; - - iface = netdev_priv(dev); - local = iface->local; - - basic_rates = local->basic_rates & local->tx_rate_control; - if (!basic_rates || basic_rates != local->basic_rates) { - printk(KERN_INFO "%s: updating basic rate set automatically " - "to match with the new supported rate set\n", - dev->name); - if (!basic_rates) - basic_rates = local->tx_rate_control; - - local->basic_rates = basic_rates; - if (hostap_set_word(dev, HFA384X_RID_CNFBASICRATES, - basic_rates)) - printk(KERN_WARNING "%s: failed to set " - "cnfBasicRates\n", dev->name); - } - - ret = (hostap_set_word(dev, HFA384X_RID_TXRATECONTROL, - local->tx_rate_control) || - hostap_set_word(dev, HFA384X_RID_CNFSUPPORTEDRATES, - local->tx_rate_control) || - local->func->reset_port(dev)); - - if (ret) { - printk(KERN_WARNING "%s: TXRateControl/cnfSupportedRates " - "setting to 0x%x failed\n", - dev->name, local->tx_rate_control); - } - - /* Update TX rate configuration for all STAs based on new operational - * rate set. */ - hostap_update_rates(local); - - return ret; -} - - -static int prism2_ioctl_siwrate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - if (rrq->fixed) { - switch (rrq->value) { - case 11000000: - local->tx_rate_control = HFA384X_RATES_11MBPS; - break; - case 5500000: - local->tx_rate_control = HFA384X_RATES_5MBPS; - break; - case 2000000: - local->tx_rate_control = HFA384X_RATES_2MBPS; - break; - case 1000000: - local->tx_rate_control = HFA384X_RATES_1MBPS; - break; - default: - local->tx_rate_control = HFA384X_RATES_1MBPS | - HFA384X_RATES_2MBPS | HFA384X_RATES_5MBPS | - HFA384X_RATES_11MBPS; - break; - } - } else { - switch (rrq->value) { - case 11000000: - local->tx_rate_control = HFA384X_RATES_1MBPS | - HFA384X_RATES_2MBPS | HFA384X_RATES_5MBPS | - HFA384X_RATES_11MBPS; - break; - case 5500000: - local->tx_rate_control = HFA384X_RATES_1MBPS | - HFA384X_RATES_2MBPS | HFA384X_RATES_5MBPS; - break; - case 2000000: - local->tx_rate_control = HFA384X_RATES_1MBPS | - HFA384X_RATES_2MBPS; - break; - case 1000000: - local->tx_rate_control = HFA384X_RATES_1MBPS; - break; - default: - local->tx_rate_control = HFA384X_RATES_1MBPS | - HFA384X_RATES_2MBPS | HFA384X_RATES_5MBPS | - HFA384X_RATES_11MBPS; - break; - } - } - - return hostap_set_rate(dev); -} - - -static int prism2_ioctl_giwrate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, char *extra) -{ - u16 val; - struct hostap_interface *iface; - local_info_t *local; - int ret = 0; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->func->get_rid(dev, HFA384X_RID_TXRATECONTROL, &val, 2, 1) < - 0) - return -EINVAL; - - if ((val & 0x1) && (val > 1)) - rrq->fixed = 0; - else - rrq->fixed = 1; - - if (local->iw_mode == IW_MODE_MASTER && local->ap != NULL && - !local->fw_tx_rate_control) { - /* HFA384X_RID_CURRENTTXRATE seems to always be 2 Mbps in - * Host AP mode, so use the recorded TX rate of the last sent - * frame */ - rrq->value = local->ap->last_tx_rate > 0 ? - local->ap->last_tx_rate * 100000 : 11000000; - return 0; - } - - if (local->func->get_rid(dev, HFA384X_RID_CURRENTTXRATE, &val, 2, 1) < - 0) - return -EINVAL; - - switch (val) { - case HFA384X_RATES_1MBPS: - rrq->value = 1000000; - break; - case HFA384X_RATES_2MBPS: - rrq->value = 2000000; - break; - case HFA384X_RATES_5MBPS: - rrq->value = 5500000; - break; - case HFA384X_RATES_11MBPS: - rrq->value = 11000000; - break; - default: - /* should not happen */ - rrq->value = 11000000; - ret = -EINVAL; - break; - } - - return ret; -} - - -static int prism2_ioctl_siwsens(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *sens, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - /* Set the desired AP density */ - if (sens->value < 1 || sens->value > 3) - return -EINVAL; - - if (hostap_set_word(dev, HFA384X_RID_CNFSYSTEMSCALE, sens->value) || - local->func->reset_port(dev)) - return -EINVAL; - - return 0; -} - -static int prism2_ioctl_giwsens(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *sens, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - __le16 val; - - iface = netdev_priv(dev); - local = iface->local; - - /* Get the current AP density */ - if (local->func->get_rid(dev, HFA384X_RID_CNFSYSTEMSCALE, &val, 2, 1) < - 0) - return -EINVAL; - - sens->value = le16_to_cpu(val); - sens->fixed = 1; - - return 0; -} - - -/* Deprecated in new wireless extension API */ -static int prism2_ioctl_giwaplist(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - struct sockaddr *addr; - struct iw_quality *qual; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->iw_mode != IW_MODE_MASTER) { - printk(KERN_DEBUG "SIOCGIWAPLIST is currently only supported " - "in Host AP mode\n"); - data->length = 0; - return -EOPNOTSUPP; - } - - addr = kmalloc(sizeof(struct sockaddr) * IW_MAX_AP, GFP_KERNEL); - qual = kmalloc(sizeof(struct iw_quality) * IW_MAX_AP, GFP_KERNEL); - if (addr == NULL || qual == NULL) { - kfree(addr); - kfree(qual); - data->length = 0; - return -ENOMEM; - } - - data->length = prism2_ap_get_sta_qual(local, addr, qual, IW_MAX_AP, 1); - - memcpy(extra, addr, sizeof(struct sockaddr) * data->length); - data->flags = 1; /* has quality information */ - memcpy(extra + sizeof(struct sockaddr) * data->length, qual, - sizeof(struct iw_quality) * data->length); - - kfree(addr); - kfree(qual); - return 0; -} - - -static int prism2_ioctl_siwrts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rts, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - __le16 val; - - iface = netdev_priv(dev); - local = iface->local; - - if (rts->disabled) - val = cpu_to_le16(2347); - else if (rts->value < 0 || rts->value > 2347) - return -EINVAL; - else - val = cpu_to_le16(rts->value); - - if (local->func->set_rid(dev, HFA384X_RID_RTSTHRESHOLD, &val, 2) || - local->func->reset_port(dev)) - return -EINVAL; - - local->rts_threshold = rts->value; - - return 0; -} - -static int prism2_ioctl_giwrts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rts, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - __le16 val; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->func->get_rid(dev, HFA384X_RID_RTSTHRESHOLD, &val, 2, 1) < - 0) - return -EINVAL; - - rts->value = le16_to_cpu(val); - rts->disabled = (rts->value == 2347); - rts->fixed = 1; - - return 0; -} - - -static int prism2_ioctl_siwfrag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rts, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - __le16 val; - - iface = netdev_priv(dev); - local = iface->local; - - if (rts->disabled) - val = cpu_to_le16(2346); - else if (rts->value < 256 || rts->value > 2346) - return -EINVAL; - else - val = cpu_to_le16(rts->value & ~0x1); /* even numbers only */ - - local->fragm_threshold = rts->value & ~0x1; - if (local->func->set_rid(dev, HFA384X_RID_FRAGMENTATIONTHRESHOLD, &val, - 2) - || local->func->reset_port(dev)) - return -EINVAL; - - return 0; -} - -static int prism2_ioctl_giwfrag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rts, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - __le16 val; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->func->get_rid(dev, HFA384X_RID_FRAGMENTATIONTHRESHOLD, - &val, 2, 1) < 0) - return -EINVAL; - - rts->value = le16_to_cpu(val); - rts->disabled = (rts->value == 2346); - rts->fixed = 1; - - return 0; -} - - -#ifndef PRISM2_NO_STATION_MODES -static int hostap_join_ap(struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - struct hfa384x_join_request req; - unsigned long flags; - int i; - struct hfa384x_hostscan_result *entry; - - iface = netdev_priv(dev); - local = iface->local; - - memcpy(req.bssid, local->preferred_ap, ETH_ALEN); - req.channel = 0; - - spin_lock_irqsave(&local->lock, flags); - for (i = 0; i < local->last_scan_results_count; i++) { - if (!local->last_scan_results) - break; - entry = &local->last_scan_results[i]; - if (memcmp(local->preferred_ap, entry->bssid, ETH_ALEN) == 0) { - req.channel = entry->chid; - break; - } - } - spin_unlock_irqrestore(&local->lock, flags); - - if (local->func->set_rid(dev, HFA384X_RID_JOINREQUEST, &req, - sizeof(req))) { - printk(KERN_DEBUG "%s: JoinRequest %pM failed\n", - dev->name, local->preferred_ap); - return -1; - } - - printk(KERN_DEBUG "%s: Trying to join BSSID %pM\n", - dev->name, local->preferred_ap); - - return 0; -} -#endif /* PRISM2_NO_STATION_MODES */ - - -static int prism2_ioctl_siwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra) -{ -#ifdef PRISM2_NO_STATION_MODES - return -EOPNOTSUPP; -#else /* PRISM2_NO_STATION_MODES */ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - memcpy(local->preferred_ap, &ap_addr->sa_data, ETH_ALEN); - - if (local->host_roaming == 1 && local->iw_mode == IW_MODE_INFRA) { - struct hfa384x_scan_request scan_req; - memset(&scan_req, 0, sizeof(scan_req)); - scan_req.channel_list = cpu_to_le16(0x3fff); - scan_req.txrate = cpu_to_le16(HFA384X_RATES_1MBPS); - if (local->func->set_rid(dev, HFA384X_RID_SCANREQUEST, - &scan_req, sizeof(scan_req))) { - printk(KERN_DEBUG "%s: ScanResults request failed - " - "preferred AP delayed to next unsolicited " - "scan\n", dev->name); - } - } else if (local->host_roaming == 2 && - local->iw_mode == IW_MODE_INFRA) { - if (hostap_join_ap(dev)) - return -EINVAL; - } else { - printk(KERN_DEBUG "%s: Preferred AP (SIOCSIWAP) is used only " - "in Managed mode when host_roaming is enabled\n", - dev->name); - } - - return 0; -#endif /* PRISM2_NO_STATION_MODES */ -} - -static int prism2_ioctl_giwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - ap_addr->sa_family = ARPHRD_ETHER; - switch (iface->type) { - case HOSTAP_INTERFACE_AP: - memcpy(&ap_addr->sa_data, dev->dev_addr, ETH_ALEN); - break; - case HOSTAP_INTERFACE_STA: - memcpy(&ap_addr->sa_data, local->assoc_ap_addr, ETH_ALEN); - break; - case HOSTAP_INTERFACE_WDS: - memcpy(&ap_addr->sa_data, iface->u.wds.remote_addr, ETH_ALEN); - break; - default: - if (local->func->get_rid(dev, HFA384X_RID_CURRENTBSSID, - &ap_addr->sa_data, ETH_ALEN, 1) < 0) - return -EOPNOTSUPP; - - /* local->bssid is also updated in LinkStatus handler when in - * station mode */ - memcpy(local->bssid, &ap_addr->sa_data, ETH_ALEN); - break; - } - - return 0; -} - - -static int prism2_ioctl_siwnickn(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *nickname) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - memset(local->name, 0, sizeof(local->name)); - memcpy(local->name, nickname, data->length); - local->name_set = 1; - - if (hostap_set_string(dev, HFA384X_RID_CNFOWNNAME, local->name) || - local->func->reset_port(dev)) - return -EINVAL; - - return 0; -} - -static int prism2_ioctl_giwnickn(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *nickname) -{ - struct hostap_interface *iface; - local_info_t *local; - int len; - char name[MAX_NAME_LEN + 3]; - u16 val; - - iface = netdev_priv(dev); - local = iface->local; - - len = local->func->get_rid(dev, HFA384X_RID_CNFOWNNAME, - &name, MAX_NAME_LEN + 2, 0); - val = le16_to_cpu(*(__le16 *) name); - if (len > MAX_NAME_LEN + 2 || len < 0 || val > MAX_NAME_LEN) - return -EOPNOTSUPP; - - name[val + 2] = '\0'; - data->length = val + 1; - memcpy(nickname, name + 2, val + 1); - - return 0; -} - - -static int prism2_ioctl_siwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - /* freq => chan. */ - if (freq->e == 1 && - freq->m / 100000 >= freq_list[0] && - freq->m / 100000 <= freq_list[FREQ_COUNT - 1]) { - int ch; - int fr = freq->m / 100000; - for (ch = 0; ch < FREQ_COUNT; ch++) { - if (fr == freq_list[ch]) { - freq->e = 0; - freq->m = ch + 1; - break; - } - } - } - - if (freq->e != 0 || freq->m < 1 || freq->m > FREQ_COUNT || - !(local->channel_mask & (1 << (freq->m - 1)))) - return -EINVAL; - - local->channel = freq->m; /* channel is used in prism2_setup_rids() */ - if (hostap_set_word(dev, HFA384X_RID_CNFOWNCHANNEL, local->channel) || - local->func->reset_port(dev)) - return -EINVAL; - - return 0; -} - -static int prism2_ioctl_giwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - u16 val; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->func->get_rid(dev, HFA384X_RID_CURRENTCHANNEL, &val, 2, 1) < - 0) - return -EINVAL; - - le16_to_cpus(&val); - if (val < 1 || val > FREQ_COUNT) - return -EINVAL; - - freq->m = freq_list[val - 1] * 100000; - freq->e = 1; - - return 0; -} - - -static void hostap_monitor_set_type(local_info_t *local) -{ - struct net_device *dev = local->ddev; - - if (dev == NULL) - return; - - if (local->monitor_type == PRISM2_MONITOR_PRISM || - local->monitor_type == PRISM2_MONITOR_CAPHDR) { - dev->type = ARPHRD_IEEE80211_PRISM; - } else if (local->monitor_type == PRISM2_MONITOR_RADIOTAP) { - dev->type = ARPHRD_IEEE80211_RADIOTAP; - } else { - dev->type = ARPHRD_IEEE80211; - } -} - - -static int prism2_ioctl_siwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *ssid) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - if (iface->type == HOSTAP_INTERFACE_WDS) - return -EOPNOTSUPP; - - if (data->flags == 0) - ssid[0] = '\0'; /* ANY */ - - if (local->iw_mode == IW_MODE_MASTER && ssid[0] == '\0') { - /* Setting SSID to empty string seems to kill the card in - * Host AP mode */ - printk(KERN_DEBUG "%s: Host AP mode does not support " - "'Any' essid\n", dev->name); - return -EINVAL; - } - - memcpy(local->essid, ssid, data->length); - local->essid[data->length] = '\0'; - - if ((!local->fw_ap && - hostap_set_string(dev, HFA384X_RID_CNFDESIREDSSID, local->essid)) - || hostap_set_string(dev, HFA384X_RID_CNFOWNSSID, local->essid) || - local->func->reset_port(dev)) - return -EINVAL; - - return 0; -} - -static int prism2_ioctl_giwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *essid) -{ - struct hostap_interface *iface; - local_info_t *local; - u16 val; - - iface = netdev_priv(dev); - local = iface->local; - - if (iface->type == HOSTAP_INTERFACE_WDS) - return -EOPNOTSUPP; - - data->flags = 1; /* active */ - if (local->iw_mode == IW_MODE_MASTER) { - data->length = strlen(local->essid); - memcpy(essid, local->essid, IW_ESSID_MAX_SIZE); - } else { - int len; - char ssid[MAX_SSID_LEN + 2]; - memset(ssid, 0, sizeof(ssid)); - len = local->func->get_rid(dev, HFA384X_RID_CURRENTSSID, - &ssid, MAX_SSID_LEN + 2, 0); - val = le16_to_cpu(*(__le16 *) ssid); - if (len > MAX_SSID_LEN + 2 || len < 0 || val > MAX_SSID_LEN) { - return -EOPNOTSUPP; - } - data->length = val; - memcpy(essid, ssid + 2, IW_ESSID_MAX_SIZE); - } - - return 0; -} - - -static int prism2_ioctl_giwrange(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - struct iw_range *range = (struct iw_range *) extra; - u8 rates[10]; - u16 val; - int i, len, over2; - - iface = netdev_priv(dev); - local = iface->local; - - data->length = sizeof(struct iw_range); - memset(range, 0, sizeof(struct iw_range)); - - /* TODO: could fill num_txpower and txpower array with - * something; however, there are 128 different values.. */ - - range->txpower_capa = IW_TXPOW_DBM; - - if (local->iw_mode == IW_MODE_INFRA || local->iw_mode == IW_MODE_ADHOC) - { - range->min_pmp = 1 * 1024; - range->max_pmp = 65535 * 1024; - range->min_pmt = 1 * 1024; - range->max_pmt = 1000 * 1024; - range->pmp_flags = IW_POWER_PERIOD; - range->pmt_flags = IW_POWER_TIMEOUT; - range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | - IW_POWER_UNICAST_R | IW_POWER_ALL_R; - } - - range->we_version_compiled = WIRELESS_EXT; - range->we_version_source = 18; - - range->retry_capa = IW_RETRY_LIMIT; - range->retry_flags = IW_RETRY_LIMIT; - range->min_retry = 0; - range->max_retry = 255; - - range->num_channels = FREQ_COUNT; - - val = 0; - for (i = 0; i < FREQ_COUNT; i++) { - if (local->channel_mask & (1 << i)) { - range->freq[val].i = i + 1; - range->freq[val].m = freq_list[i] * 100000; - range->freq[val].e = 1; - val++; - } - if (val == IW_MAX_FREQUENCIES) - break; - } - range->num_frequency = val; - - if (local->sta_fw_ver >= PRISM2_FW_VER(1,3,1)) { - range->max_qual.qual = 70; /* what is correct max? This was not - * documented exactly. At least - * 69 has been observed. */ - range->max_qual.level = 0; /* dB */ - range->max_qual.noise = 0; /* dB */ - - /* What would be suitable values for "average/typical" qual? */ - range->avg_qual.qual = 20; - range->avg_qual.level = -60; - range->avg_qual.noise = -95; - } else { - range->max_qual.qual = 92; /* 0 .. 92 */ - range->max_qual.level = 154; /* 27 .. 154 */ - range->max_qual.noise = 154; /* 27 .. 154 */ - } - range->sensitivity = 3; - - range->max_encoding_tokens = WEP_KEYS; - range->num_encoding_sizes = 2; - range->encoding_size[0] = 5; - range->encoding_size[1] = 13; - - over2 = 0; - len = prism2_get_datarates(dev, rates); - range->num_bitrates = 0; - for (i = 0; i < len; i++) { - if (range->num_bitrates < IW_MAX_BITRATES) { - range->bitrate[range->num_bitrates] = - rates[i] * 500000; - range->num_bitrates++; - } - if (rates[i] == 0x0b || rates[i] == 0x16) - over2 = 1; - } - /* estimated maximum TCP throughput values (bps) */ - range->throughput = over2 ? 5500000 : 1500000; - - range->min_rts = 0; - range->max_rts = 2347; - range->min_frag = 256; - range->max_frag = 2346; - - /* Event capability (kernel + driver) */ - range->event_capa[0] = (IW_EVENT_CAPA_K_0 | - IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) | - IW_EVENT_CAPA_MASK(SIOCGIWAP) | - IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); - range->event_capa[1] = IW_EVENT_CAPA_K_1; - range->event_capa[4] = (IW_EVENT_CAPA_MASK(IWEVTXDROP) | - IW_EVENT_CAPA_MASK(IWEVCUSTOM) | - IW_EVENT_CAPA_MASK(IWEVREGISTERED) | - IW_EVENT_CAPA_MASK(IWEVEXPIRED)); - - range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | - IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; - - if (local->sta_fw_ver >= PRISM2_FW_VER(1,3,1)) - range->scan_capa = IW_SCAN_CAPA_ESSID; - - return 0; -} - - -static int hostap_monitor_mode_enable(local_info_t *local) -{ - struct net_device *dev = local->dev; - - printk(KERN_DEBUG "Enabling monitor mode\n"); - hostap_monitor_set_type(local); - - if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, - HFA384X_PORTTYPE_PSEUDO_IBSS)) { - printk(KERN_DEBUG "Port type setting for monitor mode " - "failed\n"); - return -EOPNOTSUPP; - } - - /* Host decrypt is needed to get the IV and ICV fields; - * however, monitor mode seems to remove WEP flag from frame - * control field */ - if (hostap_set_word(dev, HFA384X_RID_CNFWEPFLAGS, - HFA384X_WEPFLAGS_HOSTENCRYPT | - HFA384X_WEPFLAGS_HOSTDECRYPT)) { - printk(KERN_DEBUG "WEP flags setting failed\n"); - return -EOPNOTSUPP; - } - - if (local->func->reset_port(dev) || - local->func->cmd(dev, HFA384X_CMDCODE_TEST | - (HFA384X_TEST_MONITOR << 8), - 0, NULL, NULL)) { - printk(KERN_DEBUG "Setting monitor mode failed\n"); - return -EOPNOTSUPP; - } - - return 0; -} - - -static int hostap_monitor_mode_disable(local_info_t *local) -{ - struct net_device *dev = local->ddev; - - if (dev == NULL) - return -1; - - printk(KERN_DEBUG "%s: Disabling monitor mode\n", dev->name); - dev->type = ARPHRD_ETHER; - - if (local->func->cmd(dev, HFA384X_CMDCODE_TEST | - (HFA384X_TEST_STOP << 8), - 0, NULL, NULL)) - return -1; - return hostap_set_encryption(local); -} - - -static int prism2_ioctl_siwmode(struct net_device *dev, - struct iw_request_info *info, - __u32 *mode, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - int double_reset = 0; - - iface = netdev_priv(dev); - local = iface->local; - - if (*mode != IW_MODE_ADHOC && *mode != IW_MODE_INFRA && - *mode != IW_MODE_MASTER && *mode != IW_MODE_REPEAT && - *mode != IW_MODE_MONITOR) - return -EOPNOTSUPP; - -#ifdef PRISM2_NO_STATION_MODES - if (*mode == IW_MODE_ADHOC || *mode == IW_MODE_INFRA) - return -EOPNOTSUPP; -#endif /* PRISM2_NO_STATION_MODES */ - - if (*mode == local->iw_mode) - return 0; - - if (*mode == IW_MODE_MASTER && local->essid[0] == '\0') { - printk(KERN_WARNING "%s: empty SSID not allowed in Master " - "mode\n", dev->name); - return -EINVAL; - } - - if (local->iw_mode == IW_MODE_MONITOR) - hostap_monitor_mode_disable(local); - - if ((local->iw_mode == IW_MODE_ADHOC || - local->iw_mode == IW_MODE_MONITOR) && *mode == IW_MODE_MASTER) { - /* There seems to be a firmware bug in at least STA f/w v1.5.6 - * that leaves beacon frames to use IBSS type when moving from - * IBSS to Host AP mode. Doing double Port0 reset seems to be - * enough to workaround this. */ - double_reset = 1; - } - - printk(KERN_DEBUG "prism2: %s: operating mode changed " - "%d -> %d\n", dev->name, local->iw_mode, *mode); - local->iw_mode = *mode; - - if (local->iw_mode == IW_MODE_MONITOR) - hostap_monitor_mode_enable(local); - else if (local->iw_mode == IW_MODE_MASTER && !local->host_encrypt && - !local->fw_encrypt_ok) { - printk(KERN_DEBUG "%s: defaulting to host-based encryption as " - "a workaround for firmware bug in Host AP mode WEP\n", - dev->name); - local->host_encrypt = 1; - } - - if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, - hostap_get_porttype(local))) - return -EOPNOTSUPP; - - if (local->func->reset_port(dev)) - return -EINVAL; - if (double_reset && local->func->reset_port(dev)) - return -EINVAL; - - if (local->iw_mode != IW_MODE_INFRA && local->iw_mode != IW_MODE_ADHOC) - { - /* netif_carrier is used only in client modes for now, so make - * sure carrier is on when moving to non-client modes. */ - netif_carrier_on(local->dev); - netif_carrier_on(local->ddev); - } - return 0; -} - - -static int prism2_ioctl_giwmode(struct net_device *dev, - struct iw_request_info *info, - __u32 *mode, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - switch (iface->type) { - case HOSTAP_INTERFACE_STA: - *mode = IW_MODE_INFRA; - break; - case HOSTAP_INTERFACE_WDS: - *mode = IW_MODE_REPEAT; - break; - default: - *mode = local->iw_mode; - break; - } - return 0; -} - - -static int prism2_ioctl_siwpower(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, char *extra) -{ -#ifdef PRISM2_NO_STATION_MODES - return -EOPNOTSUPP; -#else /* PRISM2_NO_STATION_MODES */ - int ret = 0; - - if (wrq->disabled) - return hostap_set_word(dev, HFA384X_RID_CNFPMENABLED, 0); - - switch (wrq->flags & IW_POWER_MODE) { - case IW_POWER_UNICAST_R: - ret = hostap_set_word(dev, HFA384X_RID_CNFMULTICASTRECEIVE, 0); - if (ret) - return ret; - ret = hostap_set_word(dev, HFA384X_RID_CNFPMENABLED, 1); - if (ret) - return ret; - break; - case IW_POWER_ALL_R: - ret = hostap_set_word(dev, HFA384X_RID_CNFMULTICASTRECEIVE, 1); - if (ret) - return ret; - ret = hostap_set_word(dev, HFA384X_RID_CNFPMENABLED, 1); - if (ret) - return ret; - break; - case IW_POWER_ON: - break; - default: - return -EINVAL; - } - - if (wrq->flags & IW_POWER_TIMEOUT) { - ret = hostap_set_word(dev, HFA384X_RID_CNFPMENABLED, 1); - if (ret) - return ret; - ret = hostap_set_word(dev, HFA384X_RID_CNFPMHOLDOVERDURATION, - wrq->value / 1024); - if (ret) - return ret; - } - if (wrq->flags & IW_POWER_PERIOD) { - ret = hostap_set_word(dev, HFA384X_RID_CNFPMENABLED, 1); - if (ret) - return ret; - ret = hostap_set_word(dev, HFA384X_RID_CNFMAXSLEEPDURATION, - wrq->value / 1024); - if (ret) - return ret; - } - - return ret; -#endif /* PRISM2_NO_STATION_MODES */ -} - - -static int prism2_ioctl_giwpower(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, char *extra) -{ -#ifdef PRISM2_NO_STATION_MODES - return -EOPNOTSUPP; -#else /* PRISM2_NO_STATION_MODES */ - struct hostap_interface *iface; - local_info_t *local; - __le16 enable, mcast; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->func->get_rid(dev, HFA384X_RID_CNFPMENABLED, &enable, 2, 1) - < 0) - return -EINVAL; - - if (!le16_to_cpu(enable)) { - rrq->disabled = 1; - return 0; - } - - rrq->disabled = 0; - - if ((rrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { - __le16 timeout; - if (local->func->get_rid(dev, - HFA384X_RID_CNFPMHOLDOVERDURATION, - &timeout, 2, 1) < 0) - return -EINVAL; - - rrq->flags = IW_POWER_TIMEOUT; - rrq->value = le16_to_cpu(timeout) * 1024; - } else { - __le16 period; - if (local->func->get_rid(dev, HFA384X_RID_CNFMAXSLEEPDURATION, - &period, 2, 1) < 0) - return -EINVAL; - - rrq->flags = IW_POWER_PERIOD; - rrq->value = le16_to_cpu(period) * 1024; - } - - if (local->func->get_rid(dev, HFA384X_RID_CNFMULTICASTRECEIVE, &mcast, - 2, 1) < 0) - return -EINVAL; - - if (le16_to_cpu(mcast)) - rrq->flags |= IW_POWER_ALL_R; - else - rrq->flags |= IW_POWER_UNICAST_R; - - return 0; -#endif /* PRISM2_NO_STATION_MODES */ -} - - -static int prism2_ioctl_siwretry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - if (rrq->disabled) - return -EINVAL; - - /* setting retry limits is not supported with the current station - * firmware code; simulate this with alternative retry count for now */ - if (rrq->flags == IW_RETRY_LIMIT) { - if (rrq->value < 0) { - /* disable manual retry count setting and use firmware - * defaults */ - local->manual_retry_count = -1; - local->tx_control &= ~HFA384X_TX_CTRL_ALT_RTRY; - } else { - if (hostap_set_word(dev, HFA384X_RID_CNFALTRETRYCOUNT, - rrq->value)) { - printk(KERN_DEBUG "%s: Alternate retry count " - "setting to %d failed\n", - dev->name, rrq->value); - return -EOPNOTSUPP; - } - - local->manual_retry_count = rrq->value; - local->tx_control |= HFA384X_TX_CTRL_ALT_RTRY; - } - return 0; - } - - return -EOPNOTSUPP; - -#if 0 - /* what could be done, if firmware would support this.. */ - - if (rrq->flags & IW_RETRY_LIMIT) { - if (rrq->flags & IW_RETRY_LONG) - HFA384X_RID_LONGRETRYLIMIT = rrq->value; - else if (rrq->flags & IW_RETRY_SHORT) - HFA384X_RID_SHORTRETRYLIMIT = rrq->value; - else { - HFA384X_RID_LONGRETRYLIMIT = rrq->value; - HFA384X_RID_SHORTRETRYLIMIT = rrq->value; - } - - } - - if (rrq->flags & IW_RETRY_LIFETIME) { - HFA384X_RID_MAXTRANSMITLIFETIME = rrq->value / 1024; - } - - return 0; -#endif /* 0 */ -} - -static int prism2_ioctl_giwretry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - __le16 shortretry, longretry, lifetime, altretry; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->func->get_rid(dev, HFA384X_RID_SHORTRETRYLIMIT, &shortretry, - 2, 1) < 0 || - local->func->get_rid(dev, HFA384X_RID_LONGRETRYLIMIT, &longretry, - 2, 1) < 0 || - local->func->get_rid(dev, HFA384X_RID_MAXTRANSMITLIFETIME, - &lifetime, 2, 1) < 0) - return -EINVAL; - - rrq->disabled = 0; - - if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { - rrq->flags = IW_RETRY_LIFETIME; - rrq->value = le16_to_cpu(lifetime) * 1024; - } else { - if (local->manual_retry_count >= 0) { - rrq->flags = IW_RETRY_LIMIT; - if (local->func->get_rid(dev, - HFA384X_RID_CNFALTRETRYCOUNT, - &altretry, 2, 1) >= 0) - rrq->value = le16_to_cpu(altretry); - else - rrq->value = local->manual_retry_count; - } else if ((rrq->flags & IW_RETRY_LONG)) { - rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; - rrq->value = le16_to_cpu(longretry); - } else { - rrq->flags = IW_RETRY_LIMIT; - rrq->value = le16_to_cpu(shortretry); - if (shortretry != longretry) - rrq->flags |= IW_RETRY_SHORT; - } - } - return 0; -} - - -/* Note! This TX power controlling is experimental and should not be used in - * production use. It just sets raw power register and does not use any kind of - * feedback information from the measured TX power (CR58). This is now - * commented out to make sure that it is not used by accident. TX power - * configuration will be enabled again after proper algorithm using feedback - * has been implemented. */ - -#ifdef RAW_TXPOWER_SETTING -/* Map HFA386x's CR31 to and from dBm with some sort of ad hoc mapping.. - * This version assumes following mapping: - * CR31 is 7-bit value with -64 to +63 range. - * -64 is mapped into +20dBm and +63 into -43dBm. - * This is certainly not an exact mapping for every card, but at least - * increasing dBm value should correspond to increasing TX power. - */ - -static int prism2_txpower_hfa386x_to_dBm(u16 val) -{ - signed char tmp; - - if (val > 255) - val = 255; - - tmp = val; - tmp >>= 2; - - return -12 - tmp; -} - -static u16 prism2_txpower_dBm_to_hfa386x(int val) -{ - signed char tmp; - - if (val > 20) - return 128; - else if (val < -43) - return 127; - - tmp = val; - tmp = -12 - tmp; - tmp <<= 2; - - return (unsigned char) tmp; -} -#endif /* RAW_TXPOWER_SETTING */ - - -static int prism2_ioctl_siwtxpow(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; -#ifdef RAW_TXPOWER_SETTING - char *tmp; -#endif - u16 val; - int ret = 0; - - iface = netdev_priv(dev); - local = iface->local; - - if (rrq->disabled) { - if (local->txpower_type != PRISM2_TXPOWER_OFF) { - val = 0xff; /* use all standby and sleep modes */ - ret = local->func->cmd(dev, HFA384X_CMDCODE_WRITEMIF, - HFA386X_CR_A_D_TEST_MODES2, - &val, NULL); - printk(KERN_DEBUG "%s: Turning radio off: %s\n", - dev->name, ret ? "failed" : "OK"); - local->txpower_type = PRISM2_TXPOWER_OFF; - } - return (ret ? -EOPNOTSUPP : 0); - } - - if (local->txpower_type == PRISM2_TXPOWER_OFF) { - val = 0; /* disable all standby and sleep modes */ - ret = local->func->cmd(dev, HFA384X_CMDCODE_WRITEMIF, - HFA386X_CR_A_D_TEST_MODES2, &val, NULL); - printk(KERN_DEBUG "%s: Turning radio on: %s\n", - dev->name, ret ? "failed" : "OK"); - local->txpower_type = PRISM2_TXPOWER_UNKNOWN; - } - -#ifdef RAW_TXPOWER_SETTING - if (!rrq->fixed && local->txpower_type != PRISM2_TXPOWER_AUTO) { - printk(KERN_DEBUG "Setting ALC on\n"); - val = HFA384X_TEST_CFG_BIT_ALC; - local->func->cmd(dev, HFA384X_CMDCODE_TEST | - (HFA384X_TEST_CFG_BITS << 8), 1, &val, NULL); - local->txpower_type = PRISM2_TXPOWER_AUTO; - return 0; - } - - if (local->txpower_type != PRISM2_TXPOWER_FIXED) { - printk(KERN_DEBUG "Setting ALC off\n"); - val = HFA384X_TEST_CFG_BIT_ALC; - local->func->cmd(dev, HFA384X_CMDCODE_TEST | - (HFA384X_TEST_CFG_BITS << 8), 0, &val, NULL); - local->txpower_type = PRISM2_TXPOWER_FIXED; - } - - if (rrq->flags == IW_TXPOW_DBM) - tmp = "dBm"; - else if (rrq->flags == IW_TXPOW_MWATT) - tmp = "mW"; - else - tmp = "UNKNOWN"; - printk(KERN_DEBUG "Setting TX power to %d %s\n", rrq->value, tmp); - - if (rrq->flags != IW_TXPOW_DBM) { - printk("SIOCSIWTXPOW with mW is not supported; use dBm\n"); - return -EOPNOTSUPP; - } - - local->txpower = rrq->value; - val = prism2_txpower_dBm_to_hfa386x(local->txpower); - if (local->func->cmd(dev, HFA384X_CMDCODE_WRITEMIF, - HFA386X_CR_MANUAL_TX_POWER, &val, NULL)) - ret = -EOPNOTSUPP; -#else /* RAW_TXPOWER_SETTING */ - if (rrq->fixed) - ret = -EOPNOTSUPP; -#endif /* RAW_TXPOWER_SETTING */ - - return ret; -} - -static int prism2_ioctl_giwtxpow(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, char *extra) -{ -#ifdef RAW_TXPOWER_SETTING - struct hostap_interface *iface; - local_info_t *local; - u16 resp0; - - iface = netdev_priv(dev); - local = iface->local; - - rrq->flags = IW_TXPOW_DBM; - rrq->disabled = 0; - rrq->fixed = 0; - - if (local->txpower_type == PRISM2_TXPOWER_AUTO) { - if (local->func->cmd(dev, HFA384X_CMDCODE_READMIF, - HFA386X_CR_MANUAL_TX_POWER, - NULL, &resp0) == 0) { - rrq->value = prism2_txpower_hfa386x_to_dBm(resp0); - } else { - /* Could not get real txpower; guess 15 dBm */ - rrq->value = 15; - } - } else if (local->txpower_type == PRISM2_TXPOWER_OFF) { - rrq->value = 0; - rrq->disabled = 1; - } else if (local->txpower_type == PRISM2_TXPOWER_FIXED) { - rrq->value = local->txpower; - rrq->fixed = 1; - } else { - printk("SIOCGIWTXPOW - unknown txpower_type=%d\n", - local->txpower_type); - } - return 0; -#else /* RAW_TXPOWER_SETTING */ - return -EOPNOTSUPP; -#endif /* RAW_TXPOWER_SETTING */ -} - - -#ifndef PRISM2_NO_STATION_MODES - -/* HostScan request works with and without host_roaming mode. In addition, it - * does not break current association. However, it requires newer station - * firmware version (>= 1.3.1) than scan request. */ -static int prism2_request_hostscan(struct net_device *dev, - u8 *ssid, u8 ssid_len) -{ - struct hostap_interface *iface; - local_info_t *local; - struct hfa384x_hostscan_request scan_req; - - iface = netdev_priv(dev); - local = iface->local; - - memset(&scan_req, 0, sizeof(scan_req)); - scan_req.channel_list = cpu_to_le16(local->channel_mask & - local->scan_channel_mask); - scan_req.txrate = cpu_to_le16(HFA384X_RATES_1MBPS); - if (ssid) { - if (ssid_len > 32) - return -EINVAL; - scan_req.target_ssid_len = cpu_to_le16(ssid_len); - memcpy(scan_req.target_ssid, ssid, ssid_len); - } - - if (local->func->set_rid(dev, HFA384X_RID_HOSTSCAN, &scan_req, - sizeof(scan_req))) { - printk(KERN_DEBUG "%s: HOSTSCAN failed\n", dev->name); - return -EINVAL; - } - return 0; -} - - -static int prism2_request_scan(struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - struct hfa384x_scan_request scan_req; - int ret = 0; - - iface = netdev_priv(dev); - local = iface->local; - - memset(&scan_req, 0, sizeof(scan_req)); - scan_req.channel_list = cpu_to_le16(local->channel_mask & - local->scan_channel_mask); - scan_req.txrate = cpu_to_le16(HFA384X_RATES_1MBPS); - - /* FIX: - * It seems to be enough to set roaming mode for a short moment to - * host-based and then setup scanrequest data and return the mode to - * firmware-based. - * - * Master mode would need to drop to Managed mode for a short while - * to make scanning work.. Or sweep through the different channels and - * use passive scan based on beacons. */ - - if (!local->host_roaming) - hostap_set_word(dev, HFA384X_RID_CNFROAMINGMODE, - HFA384X_ROAMING_HOST); - - if (local->func->set_rid(dev, HFA384X_RID_SCANREQUEST, &scan_req, - sizeof(scan_req))) { - printk(KERN_DEBUG "SCANREQUEST failed\n"); - ret = -EINVAL; - } - - if (!local->host_roaming) - hostap_set_word(dev, HFA384X_RID_CNFROAMINGMODE, - HFA384X_ROAMING_FIRMWARE); - - return ret; -} - -#else /* !PRISM2_NO_STATION_MODES */ - -static inline int prism2_request_hostscan(struct net_device *dev, - u8 *ssid, u8 ssid_len) -{ - return -EOPNOTSUPP; -} - - -static inline int prism2_request_scan(struct net_device *dev) -{ - return -EOPNOTSUPP; -} - -#endif /* !PRISM2_NO_STATION_MODES */ - - -static int prism2_ioctl_siwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - int ret; - u8 *ssid = NULL, ssid_len = 0; - struct iw_scan_req *req = (struct iw_scan_req *) extra; - - iface = netdev_priv(dev); - local = iface->local; - - if (data->length < sizeof(struct iw_scan_req)) - req = NULL; - - if (local->iw_mode == IW_MODE_MASTER) { - /* In master mode, we just return the results of our local - * tables, so we don't need to start anything... - * Jean II */ - data->length = 0; - return 0; - } - - if (!local->dev_enabled) - return -ENETDOWN; - - if (req && data->flags & IW_SCAN_THIS_ESSID) { - ssid = req->essid; - ssid_len = req->essid_len; - - if (ssid_len && - ((local->iw_mode != IW_MODE_INFRA && - local->iw_mode != IW_MODE_ADHOC) || - (local->sta_fw_ver < PRISM2_FW_VER(1,3,1)))) - return -EOPNOTSUPP; - } - - if (local->sta_fw_ver >= PRISM2_FW_VER(1,3,1)) - ret = prism2_request_hostscan(dev, ssid, ssid_len); - else - ret = prism2_request_scan(dev); - - if (ret == 0) - local->scan_timestamp = jiffies; - - /* Could inquire F101, F103 or wait for SIOCGIWSCAN and read RID */ - - return ret; -} - - -#ifndef PRISM2_NO_STATION_MODES -static char * __prism2_translate_scan(local_info_t *local, - struct iw_request_info *info, - struct hfa384x_hostscan_result *scan, - struct hostap_bss_info *bss, - char *current_ev, char *end_buf) -{ - int i, chan; - struct iw_event iwe; - char *current_val; - u16 capabilities; - u8 *pos; - u8 *ssid, *bssid; - size_t ssid_len; - char *buf; - - if (bss) { - ssid = bss->ssid; - ssid_len = bss->ssid_len; - bssid = bss->bssid; - } else { - ssid = scan->ssid; - ssid_len = le16_to_cpu(scan->ssid_len); - bssid = scan->bssid; - } - if (ssid_len > 32) - ssid_len = 32; - - /* First entry *MUST* be the AP MAC address */ - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, bssid, ETH_ALEN); - current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, - IW_EV_ADDR_LEN); - - /* Other entries will be displayed in the order we give them */ - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWESSID; - iwe.u.data.length = ssid_len; - iwe.u.data.flags = 1; - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, ssid); - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWMODE; - if (bss) { - capabilities = bss->capab_info; - } else { - capabilities = le16_to_cpu(scan->capability); - } - if (capabilities & (WLAN_CAPABILITY_ESS | - WLAN_CAPABILITY_IBSS)) { - if (capabilities & WLAN_CAPABILITY_ESS) - iwe.u.mode = IW_MODE_MASTER; - else - iwe.u.mode = IW_MODE_ADHOC; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_UINT_LEN); - } - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWFREQ; - if (scan) { - chan = le16_to_cpu(scan->chid); - } else if (bss) { - chan = bss->chan; - } else { - chan = 0; - } - - if (chan > 0) { - iwe.u.freq.m = freq_list[chan - 1] * 100000; - iwe.u.freq.e = 1; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_FREQ_LEN); - } - - if (scan) { - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVQUAL; - if (local->last_scan_type == PRISM2_HOSTSCAN) { - iwe.u.qual.level = le16_to_cpu(scan->sl); - iwe.u.qual.noise = le16_to_cpu(scan->anl); - } else { - iwe.u.qual.level = - HFA384X_LEVEL_TO_dBm(le16_to_cpu(scan->sl)); - iwe.u.qual.noise = - HFA384X_LEVEL_TO_dBm(le16_to_cpu(scan->anl)); - } - iwe.u.qual.updated = IW_QUAL_LEVEL_UPDATED - | IW_QUAL_NOISE_UPDATED - | IW_QUAL_QUAL_INVALID - | IW_QUAL_DBM; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_QUAL_LEN); - } - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWENCODE; - if (capabilities & WLAN_CAPABILITY_PRIVACY) - iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - else - iwe.u.data.flags = IW_ENCODE_DISABLED; - iwe.u.data.length = 0; - current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, ""); - - /* TODO: add SuppRates into BSS table */ - if (scan) { - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWRATE; - current_val = current_ev + iwe_stream_lcp_len(info); - pos = scan->sup_rates; - for (i = 0; i < sizeof(scan->sup_rates); i++) { - if (pos[i] == 0) - break; - /* Bit rate given in 500 kb/s units (+ 0x80) */ - iwe.u.bitrate.value = ((pos[i] & 0x7f) * 500000); - current_val = iwe_stream_add_value( - info, current_ev, current_val, end_buf, &iwe, - IW_EV_PARAM_LEN); - } - /* Check if we added any event */ - if ((current_val - current_ev) > iwe_stream_lcp_len(info)) - current_ev = current_val; - } - - /* TODO: add BeaconInt,resp_rate,atim into BSS table */ - buf = kmalloc(MAX_WPA_IE_LEN * 2 + 30, GFP_ATOMIC); - if (buf && scan) { - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - sprintf(buf, "bcn_int=%d", le16_to_cpu(scan->beacon_interval)); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, buf); - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - sprintf(buf, "resp_rate=%d", le16_to_cpu(scan->rate)); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, buf); - - if (local->last_scan_type == PRISM2_HOSTSCAN && - (capabilities & WLAN_CAPABILITY_IBSS)) { - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - sprintf(buf, "atim=%d", le16_to_cpu(scan->atim)); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info, current_ev, - end_buf, &iwe, buf); - } - } - kfree(buf); - - if (bss && bss->wpa_ie_len > 0 && bss->wpa_ie_len <= MAX_WPA_IE_LEN) { - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = bss->wpa_ie_len; - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, bss->wpa_ie); - } - - if (bss && bss->rsn_ie_len > 0 && bss->rsn_ie_len <= MAX_WPA_IE_LEN) { - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = bss->rsn_ie_len; - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, bss->rsn_ie); - } - - return current_ev; -} - - -/* Translate scan data returned from the card to a card independent - * format that the Wireless Tools will understand - Jean II */ -static inline int prism2_translate_scan(local_info_t *local, - struct iw_request_info *info, - char *buffer, int buflen) -{ - struct hfa384x_hostscan_result *scan; - int entry, hostscan; - char *current_ev = buffer; - char *end_buf = buffer + buflen; - struct list_head *ptr; - - spin_lock_bh(&local->lock); - - list_for_each(ptr, &local->bss_list) { - struct hostap_bss_info *bss; - bss = list_entry(ptr, struct hostap_bss_info, list); - bss->included = 0; - } - - hostscan = local->last_scan_type == PRISM2_HOSTSCAN; - for (entry = 0; entry < local->last_scan_results_count; entry++) { - int found = 0; - scan = &local->last_scan_results[entry]; - - /* Report every SSID if the AP is using multiple SSIDs. If no - * BSS record is found (e.g., when WPA mode is disabled), - * report the AP once. */ - list_for_each(ptr, &local->bss_list) { - struct hostap_bss_info *bss; - bss = list_entry(ptr, struct hostap_bss_info, list); - if (memcmp(bss->bssid, scan->bssid, ETH_ALEN) == 0) { - bss->included = 1; - current_ev = __prism2_translate_scan( - local, info, scan, bss, current_ev, - end_buf); - found++; - } - } - if (!found) { - current_ev = __prism2_translate_scan( - local, info, scan, NULL, current_ev, end_buf); - } - /* Check if there is space for one more entry */ - if ((end_buf - current_ev) <= IW_EV_ADDR_LEN) { - /* Ask user space to try again with a bigger buffer */ - spin_unlock_bh(&local->lock); - return -E2BIG; - } - } - - /* Prism2 firmware has limits (32 at least in some versions) for number - * of BSSes in scan results. Extend this limit by using local BSS list. - */ - list_for_each(ptr, &local->bss_list) { - struct hostap_bss_info *bss; - bss = list_entry(ptr, struct hostap_bss_info, list); - if (bss->included) - continue; - current_ev = __prism2_translate_scan(local, info, NULL, bss, - current_ev, end_buf); - /* Check if there is space for one more entry */ - if ((end_buf - current_ev) <= IW_EV_ADDR_LEN) { - /* Ask user space to try again with a bigger buffer */ - spin_unlock_bh(&local->lock); - return -E2BIG; - } - } - - spin_unlock_bh(&local->lock); - - return current_ev - buffer; -} -#endif /* PRISM2_NO_STATION_MODES */ - - -static inline int prism2_ioctl_giwscan_sta(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ -#ifdef PRISM2_NO_STATION_MODES - return -EOPNOTSUPP; -#else /* PRISM2_NO_STATION_MODES */ - struct hostap_interface *iface; - local_info_t *local; - int res; - - iface = netdev_priv(dev); - local = iface->local; - - /* Wait until the scan is finished. We can probably do better - * than that - Jean II */ - if (local->scan_timestamp && - time_before(jiffies, local->scan_timestamp + 3 * HZ)) { - /* Important note : we don't want to block the caller - * until results are ready for various reasons. - * First, managing wait queues is complex and racy - * (there may be multiple simultaneous callers). - * Second, we grab some rtnetlink lock before coming - * here (in dev_ioctl()). - * Third, the caller can wait on the Wireless Event - * - Jean II */ - return -EAGAIN; - } - local->scan_timestamp = 0; - - res = prism2_translate_scan(local, info, extra, data->length); - - if (res >= 0) { - data->length = res; - return 0; - } else { - data->length = 0; - return res; - } -#endif /* PRISM2_NO_STATION_MODES */ -} - - -static int prism2_ioctl_giwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - int res; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->iw_mode == IW_MODE_MASTER) { - /* In MASTER mode, it doesn't make sense to go around - * scanning the frequencies and make the stations we serve - * wait when what the user is really interested about is the - * list of stations and access points we are talking to. - * So, just extract results from our cache... - * Jean II */ - - /* Translate to WE format */ - res = prism2_ap_translate_scan(dev, info, extra); - if (res >= 0) { - printk(KERN_DEBUG "Scan result translation succeeded " - "(length=%d)\n", res); - data->length = res; - return 0; - } else { - printk(KERN_DEBUG - "Scan result translation failed (res=%d)\n", - res); - data->length = 0; - return res; - } - } else { - /* Station mode */ - return prism2_ioctl_giwscan_sta(dev, info, data, extra); - } -} - - -static const struct iw_priv_args prism2_priv[] = { - { PRISM2_IOCTL_MONITOR, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "monitor" }, - { PRISM2_IOCTL_READMIF, - IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, - IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, "readmif" }, - { PRISM2_IOCTL_WRITEMIF, - IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 2, 0, "writemif" }, - { PRISM2_IOCTL_RESET, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "reset" }, - { PRISM2_IOCTL_INQUIRE, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "inquire" }, - { PRISM2_IOCTL_SET_RID_WORD, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "set_rid_word" }, - { PRISM2_IOCTL_MACCMD, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "maccmd" }, - { PRISM2_IOCTL_WDS_ADD, - IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "wds_add" }, - { PRISM2_IOCTL_WDS_DEL, - IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "wds_del" }, - { PRISM2_IOCTL_ADDMAC, - IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "addmac" }, - { PRISM2_IOCTL_DELMAC, - IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "delmac" }, - { PRISM2_IOCTL_KICKMAC, - IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "kickmac" }, - /* --- raw access to sub-ioctls --- */ - { PRISM2_IOCTL_PRISM2_PARAM, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "prism2_param" }, - { PRISM2_IOCTL_GET_PRISM2_PARAM, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getprism2_param" }, - /* --- sub-ioctls handlers --- */ - { PRISM2_IOCTL_PRISM2_PARAM, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "" }, - { PRISM2_IOCTL_GET_PRISM2_PARAM, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "" }, - /* --- sub-ioctls definitions --- */ - { PRISM2_PARAM_TXRATECTRL, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "txratectrl" }, - { PRISM2_PARAM_TXRATECTRL, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gettxratectrl" }, - { PRISM2_PARAM_BEACON_INT, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "beacon_int" }, - { PRISM2_PARAM_BEACON_INT, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getbeacon_int" }, -#ifndef PRISM2_NO_STATION_MODES - { PRISM2_PARAM_PSEUDO_IBSS, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "pseudo_ibss" }, - { PRISM2_PARAM_PSEUDO_IBSS, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getpseudo_ibss" }, -#endif /* PRISM2_NO_STATION_MODES */ - { PRISM2_PARAM_ALC, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "alc" }, - { PRISM2_PARAM_ALC, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getalc" }, - { PRISM2_PARAM_DUMP, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "dump" }, - { PRISM2_PARAM_DUMP, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getdump" }, - { PRISM2_PARAM_OTHER_AP_POLICY, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "other_ap_policy" }, - { PRISM2_PARAM_OTHER_AP_POLICY, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getother_ap_pol" }, - { PRISM2_PARAM_AP_MAX_INACTIVITY, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "max_inactivity" }, - { PRISM2_PARAM_AP_MAX_INACTIVITY, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getmax_inactivi" }, - { PRISM2_PARAM_AP_BRIDGE_PACKETS, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "bridge_packets" }, - { PRISM2_PARAM_AP_BRIDGE_PACKETS, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getbridge_packe" }, - { PRISM2_PARAM_DTIM_PERIOD, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "dtim_period" }, - { PRISM2_PARAM_DTIM_PERIOD, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getdtim_period" }, - { PRISM2_PARAM_AP_NULLFUNC_ACK, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "nullfunc_ack" }, - { PRISM2_PARAM_AP_NULLFUNC_ACK, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getnullfunc_ack" }, - { PRISM2_PARAM_MAX_WDS, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "max_wds" }, - { PRISM2_PARAM_MAX_WDS, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getmax_wds" }, - { PRISM2_PARAM_AP_AUTOM_AP_WDS, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "autom_ap_wds" }, - { PRISM2_PARAM_AP_AUTOM_AP_WDS, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getautom_ap_wds" }, - { PRISM2_PARAM_AP_AUTH_ALGS, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "ap_auth_algs" }, - { PRISM2_PARAM_AP_AUTH_ALGS, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getap_auth_algs" }, - { PRISM2_PARAM_MONITOR_ALLOW_FCSERR, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "allow_fcserr" }, - { PRISM2_PARAM_MONITOR_ALLOW_FCSERR, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getallow_fcserr" }, - { PRISM2_PARAM_HOST_ENCRYPT, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "host_encrypt" }, - { PRISM2_PARAM_HOST_ENCRYPT, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gethost_encrypt" }, - { PRISM2_PARAM_HOST_DECRYPT, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "host_decrypt" }, - { PRISM2_PARAM_HOST_DECRYPT, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gethost_decrypt" }, -#ifndef PRISM2_NO_STATION_MODES - { PRISM2_PARAM_HOST_ROAMING, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "host_roaming" }, - { PRISM2_PARAM_HOST_ROAMING, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gethost_roaming" }, -#endif /* PRISM2_NO_STATION_MODES */ - { PRISM2_PARAM_BCRX_STA_KEY, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "bcrx_sta_key" }, - { PRISM2_PARAM_BCRX_STA_KEY, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getbcrx_sta_key" }, - { PRISM2_PARAM_IEEE_802_1X, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "ieee_802_1x" }, - { PRISM2_PARAM_IEEE_802_1X, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getieee_802_1x" }, - { PRISM2_PARAM_ANTSEL_TX, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "antsel_tx" }, - { PRISM2_PARAM_ANTSEL_TX, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getantsel_tx" }, - { PRISM2_PARAM_ANTSEL_RX, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "antsel_rx" }, - { PRISM2_PARAM_ANTSEL_RX, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getantsel_rx" }, - { PRISM2_PARAM_MONITOR_TYPE, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "monitor_type" }, - { PRISM2_PARAM_MONITOR_TYPE, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getmonitor_type" }, - { PRISM2_PARAM_WDS_TYPE, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wds_type" }, - { PRISM2_PARAM_WDS_TYPE, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getwds_type" }, - { PRISM2_PARAM_HOSTSCAN, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "hostscan" }, - { PRISM2_PARAM_HOSTSCAN, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gethostscan" }, - { PRISM2_PARAM_AP_SCAN, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "ap_scan" }, - { PRISM2_PARAM_AP_SCAN, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getap_scan" }, - { PRISM2_PARAM_ENH_SEC, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "enh_sec" }, - { PRISM2_PARAM_ENH_SEC, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getenh_sec" }, -#ifdef PRISM2_IO_DEBUG - { PRISM2_PARAM_IO_DEBUG, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "io_debug" }, - { PRISM2_PARAM_IO_DEBUG, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getio_debug" }, -#endif /* PRISM2_IO_DEBUG */ - { PRISM2_PARAM_BASIC_RATES, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "basic_rates" }, - { PRISM2_PARAM_BASIC_RATES, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getbasic_rates" }, - { PRISM2_PARAM_OPER_RATES, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "oper_rates" }, - { PRISM2_PARAM_OPER_RATES, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getoper_rates" }, - { PRISM2_PARAM_HOSTAPD, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "hostapd" }, - { PRISM2_PARAM_HOSTAPD, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gethostapd" }, - { PRISM2_PARAM_HOSTAPD_STA, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "hostapd_sta" }, - { PRISM2_PARAM_HOSTAPD_STA, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gethostapd_sta" }, - { PRISM2_PARAM_WPA, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wpa" }, - { PRISM2_PARAM_WPA, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getwpa" }, - { PRISM2_PARAM_PRIVACY_INVOKED, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "privacy_invoked" }, - { PRISM2_PARAM_PRIVACY_INVOKED, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getprivacy_invo" }, - { PRISM2_PARAM_TKIP_COUNTERMEASURES, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "tkip_countermea" }, - { PRISM2_PARAM_TKIP_COUNTERMEASURES, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gettkip_counter" }, - { PRISM2_PARAM_DROP_UNENCRYPTED, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "drop_unencrypte" }, - { PRISM2_PARAM_DROP_UNENCRYPTED, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getdrop_unencry" }, - { PRISM2_PARAM_SCAN_CHANNEL_MASK, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "scan_channels" }, - { PRISM2_PARAM_SCAN_CHANNEL_MASK, - 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getscan_channel" }, -}; - - -static int prism2_ioctl_priv_inquire(struct net_device *dev, int *i) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->func->cmd(dev, HFA384X_CMDCODE_INQUIRE, *i, NULL, NULL)) - return -EOPNOTSUPP; - - return 0; -} - - -static int prism2_ioctl_priv_prism2_param(struct net_device *dev, - struct iw_request_info *info, - void *wrqu, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - int *i = (int *) extra; - int param = *i; - int value = *(i + 1); - int ret = 0; - u16 val; - - iface = netdev_priv(dev); - local = iface->local; - - switch (param) { - case PRISM2_PARAM_TXRATECTRL: - local->fw_tx_rate_control = value; - break; - - case PRISM2_PARAM_BEACON_INT: - if (hostap_set_word(dev, HFA384X_RID_CNFBEACONINT, value) || - local->func->reset_port(dev)) - ret = -EINVAL; - else - local->beacon_int = value; - break; - -#ifndef PRISM2_NO_STATION_MODES - case PRISM2_PARAM_PSEUDO_IBSS: - if (value == local->pseudo_adhoc) - break; - - if (value != 0 && value != 1) { - ret = -EINVAL; - break; - } - - printk(KERN_DEBUG "prism2: %s: pseudo IBSS change %d -> %d\n", - dev->name, local->pseudo_adhoc, value); - local->pseudo_adhoc = value; - if (local->iw_mode != IW_MODE_ADHOC) - break; - - if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, - hostap_get_porttype(local))) { - ret = -EOPNOTSUPP; - break; - } - - if (local->func->reset_port(dev)) - ret = -EINVAL; - break; -#endif /* PRISM2_NO_STATION_MODES */ - - case PRISM2_PARAM_ALC: - printk(KERN_DEBUG "%s: %s ALC\n", dev->name, - value == 0 ? "Disabling" : "Enabling"); - val = HFA384X_TEST_CFG_BIT_ALC; - local->func->cmd(dev, HFA384X_CMDCODE_TEST | - (HFA384X_TEST_CFG_BITS << 8), - value == 0 ? 0 : 1, &val, NULL); - break; - - case PRISM2_PARAM_DUMP: - local->frame_dump = value; - break; - - case PRISM2_PARAM_OTHER_AP_POLICY: - if (value < 0 || value > 3) { - ret = -EINVAL; - break; - } - if (local->ap != NULL) - local->ap->ap_policy = value; - break; - - case PRISM2_PARAM_AP_MAX_INACTIVITY: - if (value < 0 || value > 7 * 24 * 60 * 60) { - ret = -EINVAL; - break; - } - if (local->ap != NULL) - local->ap->max_inactivity = value * HZ; - break; - - case PRISM2_PARAM_AP_BRIDGE_PACKETS: - if (local->ap != NULL) - local->ap->bridge_packets = value; - break; - - case PRISM2_PARAM_DTIM_PERIOD: - if (value < 0 || value > 65535) { - ret = -EINVAL; - break; - } - if (hostap_set_word(dev, HFA384X_RID_CNFOWNDTIMPERIOD, value) - || local->func->reset_port(dev)) - ret = -EINVAL; - else - local->dtim_period = value; - break; - - case PRISM2_PARAM_AP_NULLFUNC_ACK: - if (local->ap != NULL) - local->ap->nullfunc_ack = value; - break; - - case PRISM2_PARAM_MAX_WDS: - local->wds_max_connections = value; - break; - - case PRISM2_PARAM_AP_AUTOM_AP_WDS: - if (local->ap != NULL) { - if (!local->ap->autom_ap_wds && value) { - /* add WDS link to all APs in STA table */ - hostap_add_wds_links(local); - } - local->ap->autom_ap_wds = value; - } - break; - - case PRISM2_PARAM_AP_AUTH_ALGS: - local->auth_algs = value; - if (hostap_set_auth_algs(local)) - ret = -EINVAL; - break; - - case PRISM2_PARAM_MONITOR_ALLOW_FCSERR: - local->monitor_allow_fcserr = value; - break; - - case PRISM2_PARAM_HOST_ENCRYPT: - local->host_encrypt = value; - if (hostap_set_encryption(local) || - local->func->reset_port(dev)) - ret = -EINVAL; - break; - - case PRISM2_PARAM_HOST_DECRYPT: - local->host_decrypt = value; - if (hostap_set_encryption(local) || - local->func->reset_port(dev)) - ret = -EINVAL; - break; - -#ifndef PRISM2_NO_STATION_MODES - case PRISM2_PARAM_HOST_ROAMING: - if (value < 0 || value > 2) { - ret = -EINVAL; - break; - } - local->host_roaming = value; - if (hostap_set_roaming(local) || local->func->reset_port(dev)) - ret = -EINVAL; - break; -#endif /* PRISM2_NO_STATION_MODES */ - - case PRISM2_PARAM_BCRX_STA_KEY: - local->bcrx_sta_key = value; - break; - - case PRISM2_PARAM_IEEE_802_1X: - local->ieee_802_1x = value; - break; - - case PRISM2_PARAM_ANTSEL_TX: - if (value < 0 || value > HOSTAP_ANTSEL_HIGH) { - ret = -EINVAL; - break; - } - local->antsel_tx = value; - hostap_set_antsel(local); - break; - - case PRISM2_PARAM_ANTSEL_RX: - if (value < 0 || value > HOSTAP_ANTSEL_HIGH) { - ret = -EINVAL; - break; - } - local->antsel_rx = value; - hostap_set_antsel(local); - break; - - case PRISM2_PARAM_MONITOR_TYPE: - if (value != PRISM2_MONITOR_80211 && - value != PRISM2_MONITOR_CAPHDR && - value != PRISM2_MONITOR_PRISM && - value != PRISM2_MONITOR_RADIOTAP) { - ret = -EINVAL; - break; - } - local->monitor_type = value; - if (local->iw_mode == IW_MODE_MONITOR) - hostap_monitor_set_type(local); - break; - - case PRISM2_PARAM_WDS_TYPE: - local->wds_type = value; - break; - - case PRISM2_PARAM_HOSTSCAN: - { - struct hfa384x_hostscan_request scan_req; - u16 rate; - - memset(&scan_req, 0, sizeof(scan_req)); - scan_req.channel_list = cpu_to_le16(0x3fff); - switch (value) { - case 1: rate = HFA384X_RATES_1MBPS; break; - case 2: rate = HFA384X_RATES_2MBPS; break; - case 3: rate = HFA384X_RATES_5MBPS; break; - case 4: rate = HFA384X_RATES_11MBPS; break; - default: rate = HFA384X_RATES_1MBPS; break; - } - scan_req.txrate = cpu_to_le16(rate); - /* leave SSID empty to accept all SSIDs */ - - if (local->iw_mode == IW_MODE_MASTER) { - if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, - HFA384X_PORTTYPE_BSS) || - local->func->reset_port(dev)) - printk(KERN_DEBUG "Leaving Host AP mode " - "for HostScan failed\n"); - } - - if (local->func->set_rid(dev, HFA384X_RID_HOSTSCAN, &scan_req, - sizeof(scan_req))) { - printk(KERN_DEBUG "HOSTSCAN failed\n"); - ret = -EINVAL; - } - if (local->iw_mode == IW_MODE_MASTER) { - wait_queue_t __wait; - init_waitqueue_entry(&__wait, current); - add_wait_queue(&local->hostscan_wq, &__wait); - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(HZ); - if (signal_pending(current)) - ret = -EINTR; - set_current_state(TASK_RUNNING); - remove_wait_queue(&local->hostscan_wq, &__wait); - - if (hostap_set_word(dev, HFA384X_RID_CNFPORTTYPE, - HFA384X_PORTTYPE_HOSTAP) || - local->func->reset_port(dev)) - printk(KERN_DEBUG "Returning to Host AP mode " - "after HostScan failed\n"); - } - break; - } - - case PRISM2_PARAM_AP_SCAN: - local->passive_scan_interval = value; - if (timer_pending(&local->passive_scan_timer)) - del_timer(&local->passive_scan_timer); - if (value > 0) { - local->passive_scan_timer.expires = jiffies + - local->passive_scan_interval * HZ; - add_timer(&local->passive_scan_timer); - } - break; - - case PRISM2_PARAM_ENH_SEC: - if (value < 0 || value > 3) { - ret = -EINVAL; - break; - } - local->enh_sec = value; - if (hostap_set_word(dev, HFA384X_RID_CNFENHSECURITY, - local->enh_sec) || - local->func->reset_port(dev)) { - printk(KERN_INFO "%s: cnfEnhSecurity requires STA f/w " - "1.6.3 or newer\n", dev->name); - ret = -EOPNOTSUPP; - } - break; - -#ifdef PRISM2_IO_DEBUG - case PRISM2_PARAM_IO_DEBUG: - local->io_debug_enabled = value; - break; -#endif /* PRISM2_IO_DEBUG */ - - case PRISM2_PARAM_BASIC_RATES: - if ((value & local->tx_rate_control) != value || value == 0) { - printk(KERN_INFO "%s: invalid basic rate set - basic " - "rates must be in supported rate set\n", - dev->name); - ret = -EINVAL; - break; - } - local->basic_rates = value; - if (hostap_set_word(dev, HFA384X_RID_CNFBASICRATES, - local->basic_rates) || - local->func->reset_port(dev)) - ret = -EINVAL; - break; - - case PRISM2_PARAM_OPER_RATES: - local->tx_rate_control = value; - if (hostap_set_rate(dev)) - ret = -EINVAL; - break; - - case PRISM2_PARAM_HOSTAPD: - ret = hostap_set_hostapd(local, value, 1); - break; - - case PRISM2_PARAM_HOSTAPD_STA: - ret = hostap_set_hostapd_sta(local, value, 1); - break; - - case PRISM2_PARAM_WPA: - local->wpa = value; - if (local->sta_fw_ver < PRISM2_FW_VER(1,7,0)) - ret = -EOPNOTSUPP; - else if (hostap_set_word(dev, HFA384X_RID_SSNHANDLINGMODE, - value ? 1 : 0)) - ret = -EINVAL; - break; - - case PRISM2_PARAM_PRIVACY_INVOKED: - local->privacy_invoked = value; - if (hostap_set_encryption(local) || - local->func->reset_port(dev)) - ret = -EINVAL; - break; - - case PRISM2_PARAM_TKIP_COUNTERMEASURES: - local->tkip_countermeasures = value; - break; - - case PRISM2_PARAM_DROP_UNENCRYPTED: - local->drop_unencrypted = value; - break; - - case PRISM2_PARAM_SCAN_CHANNEL_MASK: - local->scan_channel_mask = value; - break; - - default: - printk(KERN_DEBUG "%s: prism2_param: unknown param %d\n", - dev->name, param); - ret = -EOPNOTSUPP; - break; - } - - return ret; -} - - -static int prism2_ioctl_priv_get_prism2_param(struct net_device *dev, - struct iw_request_info *info, - void *wrqu, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - int *param = (int *) extra; - int ret = 0; - - iface = netdev_priv(dev); - local = iface->local; - - switch (*param) { - case PRISM2_PARAM_TXRATECTRL: - *param = local->fw_tx_rate_control; - break; - - case PRISM2_PARAM_BEACON_INT: - *param = local->beacon_int; - break; - - case PRISM2_PARAM_PSEUDO_IBSS: - *param = local->pseudo_adhoc; - break; - - case PRISM2_PARAM_ALC: - ret = -EOPNOTSUPP; /* FIX */ - break; - - case PRISM2_PARAM_DUMP: - *param = local->frame_dump; - break; - - case PRISM2_PARAM_OTHER_AP_POLICY: - if (local->ap != NULL) - *param = local->ap->ap_policy; - else - ret = -EOPNOTSUPP; - break; - - case PRISM2_PARAM_AP_MAX_INACTIVITY: - if (local->ap != NULL) - *param = local->ap->max_inactivity / HZ; - else - ret = -EOPNOTSUPP; - break; - - case PRISM2_PARAM_AP_BRIDGE_PACKETS: - if (local->ap != NULL) - *param = local->ap->bridge_packets; - else - ret = -EOPNOTSUPP; - break; - - case PRISM2_PARAM_DTIM_PERIOD: - *param = local->dtim_period; - break; - - case PRISM2_PARAM_AP_NULLFUNC_ACK: - if (local->ap != NULL) - *param = local->ap->nullfunc_ack; - else - ret = -EOPNOTSUPP; - break; - - case PRISM2_PARAM_MAX_WDS: - *param = local->wds_max_connections; - break; - - case PRISM2_PARAM_AP_AUTOM_AP_WDS: - if (local->ap != NULL) - *param = local->ap->autom_ap_wds; - else - ret = -EOPNOTSUPP; - break; - - case PRISM2_PARAM_AP_AUTH_ALGS: - *param = local->auth_algs; - break; - - case PRISM2_PARAM_MONITOR_ALLOW_FCSERR: - *param = local->monitor_allow_fcserr; - break; - - case PRISM2_PARAM_HOST_ENCRYPT: - *param = local->host_encrypt; - break; - - case PRISM2_PARAM_HOST_DECRYPT: - *param = local->host_decrypt; - break; - - case PRISM2_PARAM_HOST_ROAMING: - *param = local->host_roaming; - break; - - case PRISM2_PARAM_BCRX_STA_KEY: - *param = local->bcrx_sta_key; - break; - - case PRISM2_PARAM_IEEE_802_1X: - *param = local->ieee_802_1x; - break; - - case PRISM2_PARAM_ANTSEL_TX: - *param = local->antsel_tx; - break; - - case PRISM2_PARAM_ANTSEL_RX: - *param = local->antsel_rx; - break; - - case PRISM2_PARAM_MONITOR_TYPE: - *param = local->monitor_type; - break; - - case PRISM2_PARAM_WDS_TYPE: - *param = local->wds_type; - break; - - case PRISM2_PARAM_HOSTSCAN: - ret = -EOPNOTSUPP; - break; - - case PRISM2_PARAM_AP_SCAN: - *param = local->passive_scan_interval; - break; - - case PRISM2_PARAM_ENH_SEC: - *param = local->enh_sec; - break; - -#ifdef PRISM2_IO_DEBUG - case PRISM2_PARAM_IO_DEBUG: - *param = local->io_debug_enabled; - break; -#endif /* PRISM2_IO_DEBUG */ - - case PRISM2_PARAM_BASIC_RATES: - *param = local->basic_rates; - break; - - case PRISM2_PARAM_OPER_RATES: - *param = local->tx_rate_control; - break; - - case PRISM2_PARAM_HOSTAPD: - *param = local->hostapd; - break; - - case PRISM2_PARAM_HOSTAPD_STA: - *param = local->hostapd_sta; - break; - - case PRISM2_PARAM_WPA: - if (local->sta_fw_ver < PRISM2_FW_VER(1,7,0)) - ret = -EOPNOTSUPP; - *param = local->wpa; - break; - - case PRISM2_PARAM_PRIVACY_INVOKED: - *param = local->privacy_invoked; - break; - - case PRISM2_PARAM_TKIP_COUNTERMEASURES: - *param = local->tkip_countermeasures; - break; - - case PRISM2_PARAM_DROP_UNENCRYPTED: - *param = local->drop_unencrypted; - break; - - case PRISM2_PARAM_SCAN_CHANNEL_MASK: - *param = local->scan_channel_mask; - break; - - default: - printk(KERN_DEBUG "%s: get_prism2_param: unknown param %d\n", - dev->name, *param); - ret = -EOPNOTSUPP; - break; - } - - return ret; -} - - -static int prism2_ioctl_priv_readmif(struct net_device *dev, - struct iw_request_info *info, - void *wrqu, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - u16 resp0; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->func->cmd(dev, HFA384X_CMDCODE_READMIF, *extra, NULL, - &resp0)) - return -EOPNOTSUPP; - else - *extra = resp0; - - return 0; -} - - -static int prism2_ioctl_priv_writemif(struct net_device *dev, - struct iw_request_info *info, - void *wrqu, char *extra) -{ - struct hostap_interface *iface; - local_info_t *local; - u16 cr, val; - - iface = netdev_priv(dev); - local = iface->local; - - cr = *extra; - val = *(extra + 1); - if (local->func->cmd(dev, HFA384X_CMDCODE_WRITEMIF, cr, &val, NULL)) - return -EOPNOTSUPP; - - return 0; -} - - -static int prism2_ioctl_priv_monitor(struct net_device *dev, int *i) -{ - struct hostap_interface *iface; - local_info_t *local; - int ret = 0; - u32 mode; - - iface = netdev_priv(dev); - local = iface->local; - - printk(KERN_DEBUG "%s: process %d (%s) used deprecated iwpriv monitor " - "- update software to use iwconfig mode monitor\n", - dev->name, task_pid_nr(current), current->comm); - - /* Backward compatibility code - this can be removed at some point */ - - if (*i == 0) { - /* Disable monitor mode - old mode was not saved, so go to - * Master mode */ - mode = IW_MODE_MASTER; - ret = prism2_ioctl_siwmode(dev, NULL, &mode, NULL); - } else if (*i == 1) { - /* netlink socket mode is not supported anymore since it did - * not separate different devices from each other and was not - * best method for delivering large amount of packets to - * user space */ - ret = -EOPNOTSUPP; - } else if (*i == 2 || *i == 3) { - switch (*i) { - case 2: - local->monitor_type = PRISM2_MONITOR_80211; - break; - case 3: - local->monitor_type = PRISM2_MONITOR_PRISM; - break; - } - mode = IW_MODE_MONITOR; - ret = prism2_ioctl_siwmode(dev, NULL, &mode, NULL); - hostap_monitor_mode_enable(local); - } else - ret = -EINVAL; - - return ret; -} - - -static int prism2_ioctl_priv_reset(struct net_device *dev, int *i) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - printk(KERN_DEBUG "%s: manual reset request(%d)\n", dev->name, *i); - switch (*i) { - case 0: - /* Disable and enable card */ - local->func->hw_shutdown(dev, 1); - local->func->hw_config(dev, 0); - break; - - case 1: - /* COR sreset */ - local->func->hw_reset(dev); - break; - - case 2: - /* Disable and enable port 0 */ - local->func->reset_port(dev); - break; - - case 3: - prism2_sta_deauth(local, WLAN_REASON_DEAUTH_LEAVING); - if (local->func->cmd(dev, HFA384X_CMDCODE_DISABLE, 0, NULL, - NULL)) - return -EINVAL; - break; - - case 4: - if (local->func->cmd(dev, HFA384X_CMDCODE_ENABLE, 0, NULL, - NULL)) - return -EINVAL; - break; - - default: - printk(KERN_DEBUG "Unknown reset request %d\n", *i); - return -EOPNOTSUPP; - } - - return 0; -} - - -static int prism2_ioctl_priv_set_rid_word(struct net_device *dev, int *i) -{ - int rid = *i; - int value = *(i + 1); - - printk(KERN_DEBUG "%s: Set RID[0x%X] = %d\n", dev->name, rid, value); - - if (hostap_set_word(dev, rid, value)) - return -EINVAL; - - return 0; -} - - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT -static int ap_mac_cmd_ioctl(local_info_t *local, int *cmd) -{ - int ret = 0; - - switch (*cmd) { - case AP_MAC_CMD_POLICY_OPEN: - local->ap->mac_restrictions.policy = MAC_POLICY_OPEN; - break; - case AP_MAC_CMD_POLICY_ALLOW: - local->ap->mac_restrictions.policy = MAC_POLICY_ALLOW; - break; - case AP_MAC_CMD_POLICY_DENY: - local->ap->mac_restrictions.policy = MAC_POLICY_DENY; - break; - case AP_MAC_CMD_FLUSH: - ap_control_flush_macs(&local->ap->mac_restrictions); - break; - case AP_MAC_CMD_KICKALL: - ap_control_kickall(local->ap); - hostap_deauth_all_stas(local->dev, local->ap, 0); - break; - default: - ret = -EOPNOTSUPP; - break; - } - - return ret; -} -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - -#ifdef PRISM2_DOWNLOAD_SUPPORT -static int prism2_ioctl_priv_download(local_info_t *local, struct iw_point *p) -{ - struct prism2_download_param *param; - int ret = 0; - - if (p->length < sizeof(struct prism2_download_param) || - p->length > 1024 || !p->pointer) - return -EINVAL; - - param = kmalloc(p->length, GFP_KERNEL); - if (param == NULL) - return -ENOMEM; - - if (copy_from_user(param, p->pointer, p->length)) { - ret = -EFAULT; - goto out; - } - - if (p->length < sizeof(struct prism2_download_param) + - param->num_areas * sizeof(struct prism2_download_area)) { - ret = -EINVAL; - goto out; - } - - ret = local->func->download(local, param); - - out: - kfree(param); - return ret; -} -#endif /* PRISM2_DOWNLOAD_SUPPORT */ - - -static int prism2_set_genericelement(struct net_device *dev, u8 *elem, - size_t len) -{ - struct hostap_interface *iface = netdev_priv(dev); - local_info_t *local = iface->local; - u8 *buf; - - /* - * Add 16-bit length in the beginning of the buffer because Prism2 RID - * includes it. - */ - buf = kmalloc(len + 2, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - *((__le16 *) buf) = cpu_to_le16(len); - memcpy(buf + 2, elem, len); - - kfree(local->generic_elem); - local->generic_elem = buf; - local->generic_elem_len = len + 2; - - return local->func->set_rid(local->dev, HFA384X_RID_GENERICELEMENT, - buf, len + 2); -} - - -static int prism2_ioctl_siwauth(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *data, char *extra) -{ - struct hostap_interface *iface = netdev_priv(dev); - local_info_t *local = iface->local; - - switch (data->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_KEY_MGMT: - /* - * Host AP driver does not use these parameters and allows - * wpa_supplicant to control them internally. - */ - break; - case IW_AUTH_TKIP_COUNTERMEASURES: - local->tkip_countermeasures = data->value; - break; - case IW_AUTH_DROP_UNENCRYPTED: - local->drop_unencrypted = data->value; - break; - case IW_AUTH_80211_AUTH_ALG: - local->auth_algs = data->value; - break; - case IW_AUTH_WPA_ENABLED: - if (data->value == 0) { - local->wpa = 0; - if (local->sta_fw_ver < PRISM2_FW_VER(1,7,0)) - break; - prism2_set_genericelement(dev, "", 0); - local->host_roaming = 0; - local->privacy_invoked = 0; - if (hostap_set_word(dev, HFA384X_RID_SSNHANDLINGMODE, - 0) || - hostap_set_roaming(local) || - hostap_set_encryption(local) || - local->func->reset_port(dev)) - return -EINVAL; - break; - } - if (local->sta_fw_ver < PRISM2_FW_VER(1,7,0)) - return -EOPNOTSUPP; - local->host_roaming = 2; - local->privacy_invoked = 1; - local->wpa = 1; - if (hostap_set_word(dev, HFA384X_RID_SSNHANDLINGMODE, 1) || - hostap_set_roaming(local) || - hostap_set_encryption(local) || - local->func->reset_port(dev)) - return -EINVAL; - break; - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - local->ieee_802_1x = data->value; - break; - case IW_AUTH_PRIVACY_INVOKED: - local->privacy_invoked = data->value; - break; - default: - return -EOPNOTSUPP; - } - return 0; -} - - -static int prism2_ioctl_giwauth(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *data, char *extra) -{ - struct hostap_interface *iface = netdev_priv(dev); - local_info_t *local = iface->local; - - switch (data->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_KEY_MGMT: - /* - * Host AP driver does not use these parameters and allows - * wpa_supplicant to control them internally. - */ - return -EOPNOTSUPP; - case IW_AUTH_TKIP_COUNTERMEASURES: - data->value = local->tkip_countermeasures; - break; - case IW_AUTH_DROP_UNENCRYPTED: - data->value = local->drop_unencrypted; - break; - case IW_AUTH_80211_AUTH_ALG: - data->value = local->auth_algs; - break; - case IW_AUTH_WPA_ENABLED: - data->value = local->wpa; - break; - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - data->value = local->ieee_802_1x; - break; - default: - return -EOPNOTSUPP; - } - return 0; -} - - -static int prism2_ioctl_siwencodeext(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *extra) -{ - struct hostap_interface *iface = netdev_priv(dev); - local_info_t *local = iface->local; - struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; - int i, ret = 0; - struct lib80211_crypto_ops *ops; - struct lib80211_crypt_data **crypt; - void *sta_ptr; - u8 *addr; - const char *alg, *module; - - i = erq->flags & IW_ENCODE_INDEX; - if (i > WEP_KEYS) - return -EINVAL; - if (i < 1 || i > WEP_KEYS) - i = local->crypt_info.tx_keyidx; - else - i--; - if (i < 0 || i >= WEP_KEYS) - return -EINVAL; - - addr = ext->addr.sa_data; - if (is_broadcast_ether_addr(addr)) { - sta_ptr = NULL; - crypt = &local->crypt_info.crypt[i]; - } else { - if (i != 0) - return -EINVAL; - sta_ptr = ap_crypt_get_ptrs(local->ap, addr, 0, &crypt); - if (sta_ptr == NULL) { - if (local->iw_mode == IW_MODE_INFRA) { - /* - * TODO: add STA entry for the current AP so - * that unicast key can be used. For now, this - * is emulated by using default key idx 0. - */ - i = 0; - crypt = &local->crypt_info.crypt[i]; - } else - return -EINVAL; - } - } - - if ((erq->flags & IW_ENCODE_DISABLED) || - ext->alg == IW_ENCODE_ALG_NONE) { - if (*crypt) - lib80211_crypt_delayed_deinit(&local->crypt_info, crypt); - goto done; - } - - switch (ext->alg) { - case IW_ENCODE_ALG_WEP: - alg = "WEP"; - module = "lib80211_crypt_wep"; - break; - case IW_ENCODE_ALG_TKIP: - alg = "TKIP"; - module = "lib80211_crypt_tkip"; - break; - case IW_ENCODE_ALG_CCMP: - alg = "CCMP"; - module = "lib80211_crypt_ccmp"; - break; - default: - printk(KERN_DEBUG "%s: unsupported algorithm %d\n", - local->dev->name, ext->alg); - ret = -EOPNOTSUPP; - goto done; - } - - ops = lib80211_get_crypto_ops(alg); - if (ops == NULL) { - request_module(module); - ops = lib80211_get_crypto_ops(alg); - } - if (ops == NULL) { - printk(KERN_DEBUG "%s: unknown crypto alg '%s'\n", - local->dev->name, alg); - ret = -EOPNOTSUPP; - goto done; - } - - if (sta_ptr || ext->alg != IW_ENCODE_ALG_WEP) { - /* - * Per station encryption and other than WEP algorithms - * require host-based encryption, so force them on - * automatically. - */ - local->host_decrypt = local->host_encrypt = 1; - } - - if (*crypt == NULL || (*crypt)->ops != ops) { - struct lib80211_crypt_data *new_crypt; - - lib80211_crypt_delayed_deinit(&local->crypt_info, crypt); - - new_crypt = kzalloc(sizeof(struct lib80211_crypt_data), - GFP_KERNEL); - if (new_crypt == NULL) { - ret = -ENOMEM; - goto done; - } - new_crypt->ops = ops; - if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) - new_crypt->priv = new_crypt->ops->init(i); - if (new_crypt->priv == NULL) { - kfree(new_crypt); - ret = -EINVAL; - goto done; - } - - *crypt = new_crypt; - } - - /* - * TODO: if ext_flags does not have IW_ENCODE_EXT_RX_SEQ_VALID, the - * existing seq# should not be changed. - * TODO: if ext_flags has IW_ENCODE_EXT_TX_SEQ_VALID, next TX seq# - * should be changed to something else than zero. - */ - if ((!(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) || ext->key_len > 0) - && (*crypt)->ops->set_key && - (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq, - (*crypt)->priv) < 0) { - printk(KERN_DEBUG "%s: key setting failed\n", - local->dev->name); - ret = -EINVAL; - goto done; - } - - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - if (!sta_ptr) - local->crypt_info.tx_keyidx = i; - } - - - if (sta_ptr == NULL && ext->key_len > 0) { - int first = 1, j; - for (j = 0; j < WEP_KEYS; j++) { - if (j != i && local->crypt_info.crypt[j]) { - first = 0; - break; - } - } - if (first) - local->crypt_info.tx_keyidx = i; - } - - done: - if (sta_ptr) - hostap_handle_sta_release(sta_ptr); - - local->open_wep = erq->flags & IW_ENCODE_OPEN; - - /* - * Do not reset port0 if card is in Managed mode since resetting will - * generate new IEEE 802.11 authentication which may end up in looping - * with IEEE 802.1X. Prism2 documentation seem to require port reset - * after WEP configuration. However, keys are apparently changed at - * least in Managed mode. - */ - if (ret == 0 && - (hostap_set_encryption(local) || - (local->iw_mode != IW_MODE_INFRA && - local->func->reset_port(local->dev)))) - ret = -EINVAL; - - return ret; -} - - -static int prism2_ioctl_giwencodeext(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *extra) -{ - struct hostap_interface *iface = netdev_priv(dev); - local_info_t *local = iface->local; - struct lib80211_crypt_data **crypt; - void *sta_ptr; - int max_key_len, i; - struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; - u8 *addr; - - max_key_len = erq->length - sizeof(*ext); - if (max_key_len < 0) - return -EINVAL; - - i = erq->flags & IW_ENCODE_INDEX; - if (i < 1 || i > WEP_KEYS) - i = local->crypt_info.tx_keyidx; - else - i--; - - addr = ext->addr.sa_data; - if (is_broadcast_ether_addr(addr)) { - sta_ptr = NULL; - crypt = &local->crypt_info.crypt[i]; - } else { - i = 0; - sta_ptr = ap_crypt_get_ptrs(local->ap, addr, 0, &crypt); - if (sta_ptr == NULL) - return -EINVAL; - } - erq->flags = i + 1; - memset(ext, 0, sizeof(*ext)); - - if (*crypt == NULL || (*crypt)->ops == NULL) { - ext->alg = IW_ENCODE_ALG_NONE; - ext->key_len = 0; - erq->flags |= IW_ENCODE_DISABLED; - } else { - if (strcmp((*crypt)->ops->name, "WEP") == 0) - ext->alg = IW_ENCODE_ALG_WEP; - else if (strcmp((*crypt)->ops->name, "TKIP") == 0) - ext->alg = IW_ENCODE_ALG_TKIP; - else if (strcmp((*crypt)->ops->name, "CCMP") == 0) - ext->alg = IW_ENCODE_ALG_CCMP; - else - return -EINVAL; - - if ((*crypt)->ops->get_key) { - ext->key_len = - (*crypt)->ops->get_key(ext->key, - max_key_len, - ext->tx_seq, - (*crypt)->priv); - if (ext->key_len && - (ext->alg == IW_ENCODE_ALG_TKIP || - ext->alg == IW_ENCODE_ALG_CCMP)) - ext->ext_flags |= IW_ENCODE_EXT_TX_SEQ_VALID; - } - } - - if (sta_ptr) - hostap_handle_sta_release(sta_ptr); - - return 0; -} - - -static int prism2_ioctl_set_encryption(local_info_t *local, - struct prism2_hostapd_param *param, - int param_len) -{ - int ret = 0; - struct lib80211_crypto_ops *ops; - struct lib80211_crypt_data **crypt; - void *sta_ptr; - - param->u.crypt.err = 0; - param->u.crypt.alg[HOSTAP_CRYPT_ALG_NAME_LEN - 1] = '\0'; - - if (param_len != - (int) ((char *) param->u.crypt.key - (char *) param) + - param->u.crypt.key_len) - return -EINVAL; - - if (is_broadcast_ether_addr(param->sta_addr)) { - if (param->u.crypt.idx >= WEP_KEYS) - return -EINVAL; - sta_ptr = NULL; - crypt = &local->crypt_info.crypt[param->u.crypt.idx]; - } else { - if (param->u.crypt.idx) - return -EINVAL; - sta_ptr = ap_crypt_get_ptrs( - local->ap, param->sta_addr, - (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_PERMANENT), - &crypt); - - if (sta_ptr == NULL) { - param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; - return -EINVAL; - } - } - - if (strcmp(param->u.crypt.alg, "none") == 0) { - if (crypt) - lib80211_crypt_delayed_deinit(&local->crypt_info, crypt); - goto done; - } - - ops = lib80211_get_crypto_ops(param->u.crypt.alg); - if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { - request_module("lib80211_crypt_wep"); - ops = lib80211_get_crypto_ops(param->u.crypt.alg); - } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { - request_module("lib80211_crypt_tkip"); - ops = lib80211_get_crypto_ops(param->u.crypt.alg); - } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { - request_module("lib80211_crypt_ccmp"); - ops = lib80211_get_crypto_ops(param->u.crypt.alg); - } - if (ops == NULL) { - printk(KERN_DEBUG "%s: unknown crypto alg '%s'\n", - local->dev->name, param->u.crypt.alg); - param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ALG; - ret = -EINVAL; - goto done; - } - - /* station based encryption and other than WEP algorithms require - * host-based encryption, so force them on automatically */ - local->host_decrypt = local->host_encrypt = 1; - - if (*crypt == NULL || (*crypt)->ops != ops) { - struct lib80211_crypt_data *new_crypt; - - lib80211_crypt_delayed_deinit(&local->crypt_info, crypt); - - new_crypt = kzalloc(sizeof(struct lib80211_crypt_data), - GFP_KERNEL); - if (new_crypt == NULL) { - ret = -ENOMEM; - goto done; - } - new_crypt->ops = ops; - new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx); - if (new_crypt->priv == NULL) { - kfree(new_crypt); - param->u.crypt.err = - HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED; - ret = -EINVAL; - goto done; - } - - *crypt = new_crypt; - } - - if ((!(param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) || - param->u.crypt.key_len > 0) && (*crypt)->ops->set_key && - (*crypt)->ops->set_key(param->u.crypt.key, - param->u.crypt.key_len, param->u.crypt.seq, - (*crypt)->priv) < 0) { - printk(KERN_DEBUG "%s: key setting failed\n", - local->dev->name); - param->u.crypt.err = HOSTAP_CRYPT_ERR_KEY_SET_FAILED; - ret = -EINVAL; - goto done; - } - - if (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) { - if (!sta_ptr) - local->crypt_info.tx_keyidx = param->u.crypt.idx; - else if (param->u.crypt.idx) { - printk(KERN_DEBUG "%s: TX key idx setting failed\n", - local->dev->name); - param->u.crypt.err = - HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED; - ret = -EINVAL; - goto done; - } - } - - done: - if (sta_ptr) - hostap_handle_sta_release(sta_ptr); - - /* Do not reset port0 if card is in Managed mode since resetting will - * generate new IEEE 802.11 authentication which may end up in looping - * with IEEE 802.1X. Prism2 documentation seem to require port reset - * after WEP configuration. However, keys are apparently changed at - * least in Managed mode. */ - if (ret == 0 && - (hostap_set_encryption(local) || - (local->iw_mode != IW_MODE_INFRA && - local->func->reset_port(local->dev)))) { - param->u.crypt.err = HOSTAP_CRYPT_ERR_CARD_CONF_FAILED; - return -EINVAL; - } - - return ret; -} - - -static int prism2_ioctl_get_encryption(local_info_t *local, - struct prism2_hostapd_param *param, - int param_len) -{ - struct lib80211_crypt_data **crypt; - void *sta_ptr; - int max_key_len; - - param->u.crypt.err = 0; - - max_key_len = param_len - - (int) ((char *) param->u.crypt.key - (char *) param); - if (max_key_len < 0) - return -EINVAL; - - if (is_broadcast_ether_addr(param->sta_addr)) { - sta_ptr = NULL; - if (param->u.crypt.idx >= WEP_KEYS) - param->u.crypt.idx = local->crypt_info.tx_keyidx; - crypt = &local->crypt_info.crypt[param->u.crypt.idx]; - } else { - param->u.crypt.idx = 0; - sta_ptr = ap_crypt_get_ptrs(local->ap, param->sta_addr, 0, - &crypt); - - if (sta_ptr == NULL) { - param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR; - return -EINVAL; - } - } - - if (*crypt == NULL || (*crypt)->ops == NULL) { - memcpy(param->u.crypt.alg, "none", 5); - param->u.crypt.key_len = 0; - param->u.crypt.idx = 0xff; - } else { - strncpy(param->u.crypt.alg, (*crypt)->ops->name, - HOSTAP_CRYPT_ALG_NAME_LEN); - param->u.crypt.key_len = 0; - - memset(param->u.crypt.seq, 0, 8); - if ((*crypt)->ops->get_key) { - param->u.crypt.key_len = - (*crypt)->ops->get_key(param->u.crypt.key, - max_key_len, - param->u.crypt.seq, - (*crypt)->priv); - } - } - - if (sta_ptr) - hostap_handle_sta_release(sta_ptr); - - return 0; -} - - -static int prism2_ioctl_get_rid(local_info_t *local, - struct prism2_hostapd_param *param, - int param_len) -{ - int max_len, res; - - max_len = param_len - PRISM2_HOSTAPD_RID_HDR_LEN; - if (max_len < 0) - return -EINVAL; - - res = local->func->get_rid(local->dev, param->u.rid.rid, - param->u.rid.data, param->u.rid.len, 0); - if (res >= 0) { - param->u.rid.len = res; - return 0; - } - - return res; -} - - -static int prism2_ioctl_set_rid(local_info_t *local, - struct prism2_hostapd_param *param, - int param_len) -{ - int max_len; - - max_len = param_len - PRISM2_HOSTAPD_RID_HDR_LEN; - if (max_len < 0 || max_len < param->u.rid.len) - return -EINVAL; - - return local->func->set_rid(local->dev, param->u.rid.rid, - param->u.rid.data, param->u.rid.len); -} - - -static int prism2_ioctl_set_assoc_ap_addr(local_info_t *local, - struct prism2_hostapd_param *param, - int param_len) -{ - printk(KERN_DEBUG "%ssta: associated as client with AP %pM\n", - local->dev->name, param->sta_addr); - memcpy(local->assoc_ap_addr, param->sta_addr, ETH_ALEN); - return 0; -} - - -static int prism2_ioctl_siwgenie(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - return prism2_set_genericelement(dev, extra, data->length); -} - - -static int prism2_ioctl_giwgenie(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - struct hostap_interface *iface = netdev_priv(dev); - local_info_t *local = iface->local; - int len = local->generic_elem_len - 2; - - if (len <= 0 || local->generic_elem == NULL) { - data->length = 0; - return 0; - } - - if (data->length < len) - return -E2BIG; - - data->length = len; - memcpy(extra, local->generic_elem + 2, len); - - return 0; -} - - -static int prism2_ioctl_set_generic_element(local_info_t *local, - struct prism2_hostapd_param *param, - int param_len) -{ - int max_len, len; - - len = param->u.generic_elem.len; - max_len = param_len - PRISM2_HOSTAPD_GENERIC_ELEMENT_HDR_LEN; - if (max_len < 0 || max_len < len) - return -EINVAL; - - return prism2_set_genericelement(local->dev, - param->u.generic_elem.data, len); -} - - -static int prism2_ioctl_siwmlme(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - struct hostap_interface *iface = netdev_priv(dev); - local_info_t *local = iface->local; - struct iw_mlme *mlme = (struct iw_mlme *) extra; - __le16 reason; - - reason = cpu_to_le16(mlme->reason_code); - - switch (mlme->cmd) { - case IW_MLME_DEAUTH: - return prism2_sta_send_mgmt(local, mlme->addr.sa_data, - IEEE80211_STYPE_DEAUTH, - (u8 *) &reason, 2); - case IW_MLME_DISASSOC: - return prism2_sta_send_mgmt(local, mlme->addr.sa_data, - IEEE80211_STYPE_DISASSOC, - (u8 *) &reason, 2); - default: - return -EOPNOTSUPP; - } -} - - -static int prism2_ioctl_mlme(local_info_t *local, - struct prism2_hostapd_param *param) -{ - __le16 reason; - - reason = cpu_to_le16(param->u.mlme.reason_code); - switch (param->u.mlme.cmd) { - case MLME_STA_DEAUTH: - return prism2_sta_send_mgmt(local, param->sta_addr, - IEEE80211_STYPE_DEAUTH, - (u8 *) &reason, 2); - case MLME_STA_DISASSOC: - return prism2_sta_send_mgmt(local, param->sta_addr, - IEEE80211_STYPE_DISASSOC, - (u8 *) &reason, 2); - default: - return -EOPNOTSUPP; - } -} - - -static int prism2_ioctl_scan_req(local_info_t *local, - struct prism2_hostapd_param *param) -{ -#ifndef PRISM2_NO_STATION_MODES - if ((local->iw_mode != IW_MODE_INFRA && - local->iw_mode != IW_MODE_ADHOC) || - (local->sta_fw_ver < PRISM2_FW_VER(1,3,1))) - return -EOPNOTSUPP; - - if (!local->dev_enabled) - return -ENETDOWN; - - return prism2_request_hostscan(local->dev, param->u.scan_req.ssid, - param->u.scan_req.ssid_len); -#else /* PRISM2_NO_STATION_MODES */ - return -EOPNOTSUPP; -#endif /* PRISM2_NO_STATION_MODES */ -} - - -static int prism2_ioctl_priv_hostapd(local_info_t *local, struct iw_point *p) -{ - struct prism2_hostapd_param *param; - int ret = 0; - int ap_ioctl = 0; - - if (p->length < sizeof(struct prism2_hostapd_param) || - p->length > PRISM2_HOSTAPD_MAX_BUF_SIZE || !p->pointer) - return -EINVAL; - - param = kmalloc(p->length, GFP_KERNEL); - if (param == NULL) - return -ENOMEM; - - if (copy_from_user(param, p->pointer, p->length)) { - ret = -EFAULT; - goto out; - } - - switch (param->cmd) { - case PRISM2_SET_ENCRYPTION: - ret = prism2_ioctl_set_encryption(local, param, p->length); - break; - case PRISM2_GET_ENCRYPTION: - ret = prism2_ioctl_get_encryption(local, param, p->length); - break; - case PRISM2_HOSTAPD_GET_RID: - ret = prism2_ioctl_get_rid(local, param, p->length); - break; - case PRISM2_HOSTAPD_SET_RID: - ret = prism2_ioctl_set_rid(local, param, p->length); - break; - case PRISM2_HOSTAPD_SET_ASSOC_AP_ADDR: - ret = prism2_ioctl_set_assoc_ap_addr(local, param, p->length); - break; - case PRISM2_HOSTAPD_SET_GENERIC_ELEMENT: - ret = prism2_ioctl_set_generic_element(local, param, - p->length); - break; - case PRISM2_HOSTAPD_MLME: - ret = prism2_ioctl_mlme(local, param); - break; - case PRISM2_HOSTAPD_SCAN_REQ: - ret = prism2_ioctl_scan_req(local, param); - break; - default: - ret = prism2_hostapd(local->ap, param); - ap_ioctl = 1; - break; - } - - if (ret == 1 || !ap_ioctl) { - if (copy_to_user(p->pointer, param, p->length)) { - ret = -EFAULT; - goto out; - } else if (ap_ioctl) - ret = 0; - } - - out: - kfree(param); - return ret; -} - - -static void prism2_get_drvinfo(struct net_device *dev, - struct ethtool_drvinfo *info) -{ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - - strlcpy(info->driver, "hostap", sizeof(info->driver)); - snprintf(info->fw_version, sizeof(info->fw_version), - "%d.%d.%d", (local->sta_fw_ver >> 16) & 0xff, - (local->sta_fw_ver >> 8) & 0xff, - local->sta_fw_ver & 0xff); -} - -const struct ethtool_ops prism2_ethtool_ops = { - .get_drvinfo = prism2_get_drvinfo -}; - - -/* Structures to export the Wireless Handlers */ - -static const iw_handler prism2_handler[] = -{ - (iw_handler) NULL, /* SIOCSIWCOMMIT */ - (iw_handler) prism2_get_name, /* SIOCGIWNAME */ - (iw_handler) NULL, /* SIOCSIWNWID */ - (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) prism2_ioctl_siwfreq, /* SIOCSIWFREQ */ - (iw_handler) prism2_ioctl_giwfreq, /* SIOCGIWFREQ */ - (iw_handler) prism2_ioctl_siwmode, /* SIOCSIWMODE */ - (iw_handler) prism2_ioctl_giwmode, /* SIOCGIWMODE */ - (iw_handler) prism2_ioctl_siwsens, /* SIOCSIWSENS */ - (iw_handler) prism2_ioctl_giwsens, /* SIOCGIWSENS */ - (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */ - (iw_handler) prism2_ioctl_giwrange, /* SIOCGIWRANGE */ - (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */ - (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */ - (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */ - (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */ - iw_handler_set_spy, /* SIOCSIWSPY */ - iw_handler_get_spy, /* SIOCGIWSPY */ - iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ - iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ - (iw_handler) prism2_ioctl_siwap, /* SIOCSIWAP */ - (iw_handler) prism2_ioctl_giwap, /* SIOCGIWAP */ - (iw_handler) prism2_ioctl_siwmlme, /* SIOCSIWMLME */ - (iw_handler) prism2_ioctl_giwaplist, /* SIOCGIWAPLIST */ - (iw_handler) prism2_ioctl_siwscan, /* SIOCSIWSCAN */ - (iw_handler) prism2_ioctl_giwscan, /* SIOCGIWSCAN */ - (iw_handler) prism2_ioctl_siwessid, /* SIOCSIWESSID */ - (iw_handler) prism2_ioctl_giwessid, /* SIOCGIWESSID */ - (iw_handler) prism2_ioctl_siwnickn, /* SIOCSIWNICKN */ - (iw_handler) prism2_ioctl_giwnickn, /* SIOCGIWNICKN */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) prism2_ioctl_siwrate, /* SIOCSIWRATE */ - (iw_handler) prism2_ioctl_giwrate, /* SIOCGIWRATE */ - (iw_handler) prism2_ioctl_siwrts, /* SIOCSIWRTS */ - (iw_handler) prism2_ioctl_giwrts, /* SIOCGIWRTS */ - (iw_handler) prism2_ioctl_siwfrag, /* SIOCSIWFRAG */ - (iw_handler) prism2_ioctl_giwfrag, /* SIOCGIWFRAG */ - (iw_handler) prism2_ioctl_siwtxpow, /* SIOCSIWTXPOW */ - (iw_handler) prism2_ioctl_giwtxpow, /* SIOCGIWTXPOW */ - (iw_handler) prism2_ioctl_siwretry, /* SIOCSIWRETRY */ - (iw_handler) prism2_ioctl_giwretry, /* SIOCGIWRETRY */ - (iw_handler) prism2_ioctl_siwencode, /* SIOCSIWENCODE */ - (iw_handler) prism2_ioctl_giwencode, /* SIOCGIWENCODE */ - (iw_handler) prism2_ioctl_siwpower, /* SIOCSIWPOWER */ - (iw_handler) prism2_ioctl_giwpower, /* SIOCGIWPOWER */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) prism2_ioctl_siwgenie, /* SIOCSIWGENIE */ - (iw_handler) prism2_ioctl_giwgenie, /* SIOCGIWGENIE */ - (iw_handler) prism2_ioctl_siwauth, /* SIOCSIWAUTH */ - (iw_handler) prism2_ioctl_giwauth, /* SIOCGIWAUTH */ - (iw_handler) prism2_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */ - (iw_handler) prism2_ioctl_giwencodeext, /* SIOCGIWENCODEEXT */ - (iw_handler) NULL, /* SIOCSIWPMKSA */ - (iw_handler) NULL, /* -- hole -- */ -}; - -static const iw_handler prism2_private_handler[] = -{ /* SIOCIWFIRSTPRIV + */ - (iw_handler) prism2_ioctl_priv_prism2_param, /* 0 */ - (iw_handler) prism2_ioctl_priv_get_prism2_param, /* 1 */ - (iw_handler) prism2_ioctl_priv_writemif, /* 2 */ - (iw_handler) prism2_ioctl_priv_readmif, /* 3 */ -}; - -const struct iw_handler_def hostap_iw_handler_def = -{ - .num_standard = ARRAY_SIZE(prism2_handler), - .num_private = ARRAY_SIZE(prism2_private_handler), - .num_private_args = ARRAY_SIZE(prism2_priv), - .standard = (iw_handler *) prism2_handler, - .private = (iw_handler *) prism2_private_handler, - .private_args = (struct iw_priv_args *) prism2_priv, - .get_wireless_stats = hostap_get_wireless_stats, -}; - - -int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -{ - struct iwreq *wrq = (struct iwreq *) ifr; - struct hostap_interface *iface; - local_info_t *local; - int ret = 0; - - iface = netdev_priv(dev); - local = iface->local; - - switch (cmd) { - /* Private ioctls (iwpriv) that have not yet been converted - * into new wireless extensions API */ - - case PRISM2_IOCTL_INQUIRE: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = prism2_ioctl_priv_inquire(dev, (int *) wrq->u.name); - break; - - case PRISM2_IOCTL_MONITOR: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = prism2_ioctl_priv_monitor(dev, (int *) wrq->u.name); - break; - - case PRISM2_IOCTL_RESET: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = prism2_ioctl_priv_reset(dev, (int *) wrq->u.name); - break; - - case PRISM2_IOCTL_WDS_ADD: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = prism2_wds_add(local, wrq->u.ap_addr.sa_data, 1); - break; - - case PRISM2_IOCTL_WDS_DEL: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = prism2_wds_del(local, wrq->u.ap_addr.sa_data, 1, 0); - break; - - case PRISM2_IOCTL_SET_RID_WORD: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = prism2_ioctl_priv_set_rid_word(dev, - (int *) wrq->u.name); - break; - -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - case PRISM2_IOCTL_MACCMD: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = ap_mac_cmd_ioctl(local, (int *) wrq->u.name); - break; - - case PRISM2_IOCTL_ADDMAC: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = ap_control_add_mac(&local->ap->mac_restrictions, - wrq->u.ap_addr.sa_data); - break; - case PRISM2_IOCTL_DELMAC: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = ap_control_del_mac(&local->ap->mac_restrictions, - wrq->u.ap_addr.sa_data); - break; - case PRISM2_IOCTL_KICKMAC: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = ap_control_kick_mac(local->ap, local->dev, - wrq->u.ap_addr.sa_data); - break; -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - - /* Private ioctls that are not used with iwpriv; - * in SIOCDEVPRIVATE range */ - -#ifdef PRISM2_DOWNLOAD_SUPPORT - case PRISM2_IOCTL_DOWNLOAD: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = prism2_ioctl_priv_download(local, &wrq->u.data); - break; -#endif /* PRISM2_DOWNLOAD_SUPPORT */ - - case PRISM2_IOCTL_HOSTAPD: - if (!capable(CAP_NET_ADMIN)) ret = -EPERM; - else ret = prism2_ioctl_priv_hostapd(local, &wrq->u.data); - break; - - default: - ret = -EOPNOTSUPP; - break; - } - - return ret; -} diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c deleted file mode 100644 index 15f0fad39add..000000000000 --- a/drivers/net/wireless/hostap/hostap_main.c +++ /dev/null @@ -1,1143 +0,0 @@ -/* - * Host AP (software wireless LAN access point) driver for - * Intersil Prism2/2.5/3 - hostap.o module, common routines - * - * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen - * - * Copyright (c) 2002-2005, Jouni Malinen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "hostap_wlan.h" -#include "hostap_80211.h" -#include "hostap_ap.h" -#include "hostap.h" - -MODULE_AUTHOR("Jouni Malinen"); -MODULE_DESCRIPTION("Host AP common routines"); -MODULE_LICENSE("GPL"); - -#define TX_TIMEOUT (2 * HZ) - -#define PRISM2_MAX_FRAME_SIZE 2304 -#define PRISM2_MIN_MTU 256 -/* FIX: */ -#define PRISM2_MAX_MTU (PRISM2_MAX_FRAME_SIZE - (6 /* LLC */ + 8 /* WEP */)) - - -struct net_device * hostap_add_interface(struct local_info *local, - int type, int rtnl_locked, - const char *prefix, - const char *name) -{ - struct net_device *dev, *mdev; - struct hostap_interface *iface; - int ret; - - dev = alloc_etherdev(sizeof(struct hostap_interface)); - if (dev == NULL) - return NULL; - - iface = netdev_priv(dev); - iface->dev = dev; - iface->local = local; - iface->type = type; - list_add(&iface->list, &local->hostap_interfaces); - - mdev = local->dev; - memcpy(dev->dev_addr, mdev->dev_addr, ETH_ALEN); - dev->base_addr = mdev->base_addr; - dev->irq = mdev->irq; - dev->mem_start = mdev->mem_start; - dev->mem_end = mdev->mem_end; - - hostap_setup_dev(dev, local, type); - dev->destructor = free_netdev; - - sprintf(dev->name, "%s%s", prefix, name); - if (!rtnl_locked) - rtnl_lock(); - - SET_NETDEV_DEV(dev, mdev->dev.parent); - ret = register_netdevice(dev); - - if (!rtnl_locked) - rtnl_unlock(); - - if (ret < 0) { - printk(KERN_WARNING "%s: failed to add new netdevice!\n", - dev->name); - free_netdev(dev); - return NULL; - } - - printk(KERN_DEBUG "%s: registered netdevice %s\n", - mdev->name, dev->name); - - return dev; -} - - -void hostap_remove_interface(struct net_device *dev, int rtnl_locked, - int remove_from_list) -{ - struct hostap_interface *iface; - - if (!dev) - return; - - iface = netdev_priv(dev); - - if (remove_from_list) { - list_del(&iface->list); - } - - if (dev == iface->local->ddev) - iface->local->ddev = NULL; - else if (dev == iface->local->apdev) - iface->local->apdev = NULL; - else if (dev == iface->local->stadev) - iface->local->stadev = NULL; - - if (rtnl_locked) - unregister_netdevice(dev); - else - unregister_netdev(dev); - - /* dev->destructor = free_netdev() will free the device data, including - * private data, when removing the device */ -} - - -static inline int prism2_wds_special_addr(u8 *addr) -{ - if (addr[0] || addr[1] || addr[2] || addr[3] || addr[4] || addr[5]) - return 0; - - return 1; -} - - -int prism2_wds_add(local_info_t *local, u8 *remote_addr, - int rtnl_locked) -{ - struct net_device *dev; - struct list_head *ptr; - struct hostap_interface *iface, *empty, *match; - - empty = match = NULL; - read_lock_bh(&local->iface_lock); - list_for_each(ptr, &local->hostap_interfaces) { - iface = list_entry(ptr, struct hostap_interface, list); - if (iface->type != HOSTAP_INTERFACE_WDS) - continue; - - if (prism2_wds_special_addr(iface->u.wds.remote_addr)) - empty = iface; - else if (memcmp(iface->u.wds.remote_addr, remote_addr, - ETH_ALEN) == 0) { - match = iface; - break; - } - } - if (!match && empty && !prism2_wds_special_addr(remote_addr)) { - /* take pre-allocated entry into use */ - memcpy(empty->u.wds.remote_addr, remote_addr, ETH_ALEN); - read_unlock_bh(&local->iface_lock); - printk(KERN_DEBUG "%s: using pre-allocated WDS netdevice %s\n", - local->dev->name, empty->dev->name); - return 0; - } - read_unlock_bh(&local->iface_lock); - - if (!prism2_wds_special_addr(remote_addr)) { - if (match) - return -EEXIST; - hostap_add_sta(local->ap, remote_addr); - } - - if (local->wds_connections >= local->wds_max_connections) - return -ENOBUFS; - - /* verify that there is room for wds# postfix in the interface name */ - if (strlen(local->dev->name) >= IFNAMSIZ - 5) { - printk(KERN_DEBUG "'%s' too long base device name\n", - local->dev->name); - return -EINVAL; - } - - dev = hostap_add_interface(local, HOSTAP_INTERFACE_WDS, rtnl_locked, - local->ddev->name, "wds%d"); - if (dev == NULL) - return -ENOMEM; - - iface = netdev_priv(dev); - memcpy(iface->u.wds.remote_addr, remote_addr, ETH_ALEN); - - local->wds_connections++; - - return 0; -} - - -int prism2_wds_del(local_info_t *local, u8 *remote_addr, - int rtnl_locked, int do_not_remove) -{ - unsigned long flags; - struct list_head *ptr; - struct hostap_interface *iface, *selected = NULL; - - write_lock_irqsave(&local->iface_lock, flags); - list_for_each(ptr, &local->hostap_interfaces) { - iface = list_entry(ptr, struct hostap_interface, list); - if (iface->type != HOSTAP_INTERFACE_WDS) - continue; - - if (memcmp(iface->u.wds.remote_addr, remote_addr, - ETH_ALEN) == 0) { - selected = iface; - break; - } - } - if (selected && !do_not_remove) - list_del(&selected->list); - write_unlock_irqrestore(&local->iface_lock, flags); - - if (selected) { - if (do_not_remove) - memset(selected->u.wds.remote_addr, 0, ETH_ALEN); - else { - hostap_remove_interface(selected->dev, rtnl_locked, 0); - local->wds_connections--; - } - } - - return selected ? 0 : -ENODEV; -} - - -u16 hostap_tx_callback_register(local_info_t *local, - void (*func)(struct sk_buff *, int ok, void *), - void *data) -{ - unsigned long flags; - struct hostap_tx_callback_info *entry; - - entry = kmalloc(sizeof(*entry), GFP_KERNEL); - if (entry == NULL) - return 0; - - entry->func = func; - entry->data = data; - - spin_lock_irqsave(&local->lock, flags); - entry->idx = local->tx_callback ? local->tx_callback->idx + 1 : 1; - entry->next = local->tx_callback; - local->tx_callback = entry; - spin_unlock_irqrestore(&local->lock, flags); - - return entry->idx; -} - - -int hostap_tx_callback_unregister(local_info_t *local, u16 idx) -{ - unsigned long flags; - struct hostap_tx_callback_info *cb, *prev = NULL; - - spin_lock_irqsave(&local->lock, flags); - cb = local->tx_callback; - while (cb != NULL && cb->idx != idx) { - prev = cb; - cb = cb->next; - } - if (cb) { - if (prev == NULL) - local->tx_callback = cb->next; - else - prev->next = cb->next; - kfree(cb); - } - spin_unlock_irqrestore(&local->lock, flags); - - return cb ? 0 : -1; -} - - -/* val is in host byte order */ -int hostap_set_word(struct net_device *dev, int rid, u16 val) -{ - struct hostap_interface *iface; - __le16 tmp = cpu_to_le16(val); - iface = netdev_priv(dev); - return iface->local->func->set_rid(dev, rid, &tmp, 2); -} - - -int hostap_set_string(struct net_device *dev, int rid, const char *val) -{ - struct hostap_interface *iface; - char buf[MAX_SSID_LEN + 2]; - int len; - - iface = netdev_priv(dev); - len = strlen(val); - if (len > MAX_SSID_LEN) - return -1; - memset(buf, 0, sizeof(buf)); - buf[0] = len; /* little endian 16 bit word */ - memcpy(buf + 2, val, len); - - return iface->local->func->set_rid(dev, rid, &buf, MAX_SSID_LEN + 2); -} - - -u16 hostap_get_porttype(local_info_t *local) -{ - if (local->iw_mode == IW_MODE_ADHOC && local->pseudo_adhoc) - return HFA384X_PORTTYPE_PSEUDO_IBSS; - if (local->iw_mode == IW_MODE_ADHOC) - return HFA384X_PORTTYPE_IBSS; - if (local->iw_mode == IW_MODE_INFRA) - return HFA384X_PORTTYPE_BSS; - if (local->iw_mode == IW_MODE_REPEAT) - return HFA384X_PORTTYPE_WDS; - if (local->iw_mode == IW_MODE_MONITOR) - return HFA384X_PORTTYPE_PSEUDO_IBSS; - return HFA384X_PORTTYPE_HOSTAP; -} - - -int hostap_set_encryption(local_info_t *local) -{ - u16 val, old_val; - int i, keylen, len, idx; - char keybuf[WEP_KEY_LEN + 1]; - enum { NONE, WEP, OTHER } encrypt_type; - - idx = local->crypt_info.tx_keyidx; - if (local->crypt_info.crypt[idx] == NULL || - local->crypt_info.crypt[idx]->ops == NULL) - encrypt_type = NONE; - else if (strcmp(local->crypt_info.crypt[idx]->ops->name, "WEP") == 0) - encrypt_type = WEP; - else - encrypt_type = OTHER; - - if (local->func->get_rid(local->dev, HFA384X_RID_CNFWEPFLAGS, &val, 2, - 1) < 0) { - printk(KERN_DEBUG "Could not read current WEP flags.\n"); - goto fail; - } - le16_to_cpus(&val); - old_val = val; - - if (encrypt_type != NONE || local->privacy_invoked) - val |= HFA384X_WEPFLAGS_PRIVACYINVOKED; - else - val &= ~HFA384X_WEPFLAGS_PRIVACYINVOKED; - - if (local->open_wep || encrypt_type == NONE || - ((local->ieee_802_1x || local->wpa) && local->host_decrypt)) - val &= ~HFA384X_WEPFLAGS_EXCLUDEUNENCRYPTED; - else - val |= HFA384X_WEPFLAGS_EXCLUDEUNENCRYPTED; - - if ((encrypt_type != NONE || local->privacy_invoked) && - (encrypt_type == OTHER || local->host_encrypt)) - val |= HFA384X_WEPFLAGS_HOSTENCRYPT; - else - val &= ~HFA384X_WEPFLAGS_HOSTENCRYPT; - if ((encrypt_type != NONE || local->privacy_invoked) && - (encrypt_type == OTHER || local->host_decrypt)) - val |= HFA384X_WEPFLAGS_HOSTDECRYPT; - else - val &= ~HFA384X_WEPFLAGS_HOSTDECRYPT; - - if (val != old_val && - hostap_set_word(local->dev, HFA384X_RID_CNFWEPFLAGS, val)) { - printk(KERN_DEBUG "Could not write new WEP flags (0x%x)\n", - val); - goto fail; - } - - if (encrypt_type != WEP) - return 0; - - /* 104-bit support seems to require that all the keys are set to the - * same keylen */ - keylen = 6; /* first 5 octets */ - len = local->crypt_info.crypt[idx]->ops->get_key(keybuf, sizeof(keybuf), NULL, - local->crypt_info.crypt[idx]->priv); - if (idx >= 0 && idx < WEP_KEYS && len > 5) - keylen = WEP_KEY_LEN + 1; /* first 13 octets */ - - for (i = 0; i < WEP_KEYS; i++) { - memset(keybuf, 0, sizeof(keybuf)); - if (local->crypt_info.crypt[i]) { - (void) local->crypt_info.crypt[i]->ops->get_key( - keybuf, sizeof(keybuf), - NULL, local->crypt_info.crypt[i]->priv); - } - if (local->func->set_rid(local->dev, - HFA384X_RID_CNFDEFAULTKEY0 + i, - keybuf, keylen)) { - printk(KERN_DEBUG "Could not set key %d (len=%d)\n", - i, keylen); - goto fail; - } - } - if (hostap_set_word(local->dev, HFA384X_RID_CNFWEPDEFAULTKEYID, idx)) { - printk(KERN_DEBUG "Could not set default keyid %d\n", idx); - goto fail; - } - - return 0; - - fail: - printk(KERN_DEBUG "%s: encryption setup failed\n", local->dev->name); - return -1; -} - - -int hostap_set_antsel(local_info_t *local) -{ - u16 val; - int ret = 0; - - if (local->antsel_tx != HOSTAP_ANTSEL_DO_NOT_TOUCH && - local->func->cmd(local->dev, HFA384X_CMDCODE_READMIF, - HFA386X_CR_TX_CONFIGURE, - NULL, &val) == 0) { - val &= ~(BIT(2) | BIT(1)); - switch (local->antsel_tx) { - case HOSTAP_ANTSEL_DIVERSITY: - val |= BIT(1); - break; - case HOSTAP_ANTSEL_LOW: - break; - case HOSTAP_ANTSEL_HIGH: - val |= BIT(2); - break; - } - - if (local->func->cmd(local->dev, HFA384X_CMDCODE_WRITEMIF, - HFA386X_CR_TX_CONFIGURE, &val, NULL)) { - printk(KERN_INFO "%s: setting TX AntSel failed\n", - local->dev->name); - ret = -1; - } - } - - if (local->antsel_rx != HOSTAP_ANTSEL_DO_NOT_TOUCH && - local->func->cmd(local->dev, HFA384X_CMDCODE_READMIF, - HFA386X_CR_RX_CONFIGURE, - NULL, &val) == 0) { - val &= ~(BIT(1) | BIT(0)); - switch (local->antsel_rx) { - case HOSTAP_ANTSEL_DIVERSITY: - break; - case HOSTAP_ANTSEL_LOW: - val |= BIT(0); - break; - case HOSTAP_ANTSEL_HIGH: - val |= BIT(0) | BIT(1); - break; - } - - if (local->func->cmd(local->dev, HFA384X_CMDCODE_WRITEMIF, - HFA386X_CR_RX_CONFIGURE, &val, NULL)) { - printk(KERN_INFO "%s: setting RX AntSel failed\n", - local->dev->name); - ret = -1; - } - } - - return ret; -} - - -int hostap_set_roaming(local_info_t *local) -{ - u16 val; - - switch (local->host_roaming) { - case 1: - val = HFA384X_ROAMING_HOST; - break; - case 2: - val = HFA384X_ROAMING_DISABLED; - break; - case 0: - default: - val = HFA384X_ROAMING_FIRMWARE; - break; - } - - return hostap_set_word(local->dev, HFA384X_RID_CNFROAMINGMODE, val); -} - - -int hostap_set_auth_algs(local_info_t *local) -{ - int val = local->auth_algs; - /* At least STA f/w v0.6.2 seems to have issues with cnfAuthentication - * set to include both Open and Shared Key flags. It tries to use - * Shared Key authentication in that case even if WEP keys are not - * configured.. STA f/w v0.7.6 is able to handle such configuration, - * but it is unknown when this was fixed between 0.6.2 .. 0.7.6. */ - if (local->sta_fw_ver < PRISM2_FW_VER(0,7,0) && - val != PRISM2_AUTH_OPEN && val != PRISM2_AUTH_SHARED_KEY) - val = PRISM2_AUTH_OPEN; - - if (hostap_set_word(local->dev, HFA384X_RID_CNFAUTHENTICATION, val)) { - printk(KERN_INFO "%s: cnfAuthentication setting to 0x%x " - "failed\n", local->dev->name, local->auth_algs); - return -EINVAL; - } - - return 0; -} - - -void hostap_dump_rx_header(const char *name, const struct hfa384x_rx_frame *rx) -{ - u16 status, fc; - - status = __le16_to_cpu(rx->status); - - printk(KERN_DEBUG "%s: RX status=0x%04x (port=%d, type=%d, " - "fcserr=%d) silence=%d signal=%d rate=%d rxflow=%d; " - "jiffies=%ld\n", - name, status, (status >> 8) & 0x07, status >> 13, status & 1, - rx->silence, rx->signal, rx->rate, rx->rxflow, jiffies); - - fc = __le16_to_cpu(rx->frame_control); - printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x " - "data_len=%d%s%s\n", - fc, (fc & IEEE80211_FCTL_FTYPE) >> 2, - (fc & IEEE80211_FCTL_STYPE) >> 4, - __le16_to_cpu(rx->duration_id), __le16_to_cpu(rx->seq_ctrl), - __le16_to_cpu(rx->data_len), - fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", - fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); - - printk(KERN_DEBUG " A1=%pM A2=%pM A3=%pM A4=%pM\n", - rx->addr1, rx->addr2, rx->addr3, rx->addr4); - - printk(KERN_DEBUG " dst=%pM src=%pM len=%d\n", - rx->dst_addr, rx->src_addr, - __be16_to_cpu(rx->len)); -} - - -void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx) -{ - u16 fc; - - printk(KERN_DEBUG "%s: TX status=0x%04x retry_count=%d tx_rate=%d " - "tx_control=0x%04x; jiffies=%ld\n", - name, __le16_to_cpu(tx->status), tx->retry_count, tx->tx_rate, - __le16_to_cpu(tx->tx_control), jiffies); - - fc = __le16_to_cpu(tx->frame_control); - printk(KERN_DEBUG " FC=0x%04x (type=%d:%d) dur=0x%04x seq=0x%04x " - "data_len=%d%s%s\n", - fc, (fc & IEEE80211_FCTL_FTYPE) >> 2, - (fc & IEEE80211_FCTL_STYPE) >> 4, - __le16_to_cpu(tx->duration_id), __le16_to_cpu(tx->seq_ctrl), - __le16_to_cpu(tx->data_len), - fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "", - fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : ""); - - printk(KERN_DEBUG " A1=%pM A2=%pM A3=%pM A4=%pM\n", - tx->addr1, tx->addr2, tx->addr3, tx->addr4); - - printk(KERN_DEBUG " dst=%pM src=%pM len=%d\n", - tx->dst_addr, tx->src_addr, - __be16_to_cpu(tx->len)); -} - - -static int hostap_80211_header_parse(const struct sk_buff *skb, - unsigned char *haddr) -{ - memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */ - return ETH_ALEN; -} - - -int hostap_80211_get_hdrlen(__le16 fc) -{ - if (ieee80211_is_data(fc) && ieee80211_has_a4 (fc)) - return 30; /* Addr4 */ - else if (ieee80211_is_cts(fc) || ieee80211_is_ack(fc)) - return 10; - else if (ieee80211_is_ctl(fc)) - return 16; - - return 24; -} - - -static int prism2_close(struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - - PDEBUG(DEBUG_FLOW, "%s: prism2_close\n", dev->name); - - iface = netdev_priv(dev); - local = iface->local; - - if (dev == local->ddev) { - prism2_sta_deauth(local, WLAN_REASON_DEAUTH_LEAVING); - } -#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT - if (!local->hostapd && dev == local->dev && - (!local->func->card_present || local->func->card_present(local)) && - local->hw_ready && local->ap && local->iw_mode == IW_MODE_MASTER) - hostap_deauth_all_stas(dev, local->ap, 1); -#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ - - if (dev == local->dev) { - local->func->hw_shutdown(dev, HOSTAP_HW_ENABLE_CMDCOMPL); - } - - if (netif_running(dev)) { - netif_stop_queue(dev); - netif_device_detach(dev); - } - - cancel_work_sync(&local->reset_queue); - cancel_work_sync(&local->set_multicast_list_queue); - cancel_work_sync(&local->set_tim_queue); -#ifndef PRISM2_NO_STATION_MODES - cancel_work_sync(&local->info_queue); -#endif - cancel_work_sync(&local->comms_qual_update); - - module_put(local->hw_module); - - local->num_dev_open--; - - if (dev != local->dev && local->dev->flags & IFF_UP && - local->master_dev_auto_open && local->num_dev_open == 1) { - /* Close master radio interface automatically if it was also - * opened automatically and we are now closing the last - * remaining non-master device. */ - dev_close(local->dev); - } - - return 0; -} - - -static int prism2_open(struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - - PDEBUG(DEBUG_FLOW, "%s: prism2_open\n", dev->name); - - iface = netdev_priv(dev); - local = iface->local; - - if (local->no_pri) { - printk(KERN_DEBUG "%s: could not set interface UP - no PRI " - "f/w\n", dev->name); - return 1; - } - - if ((local->func->card_present && !local->func->card_present(local)) || - local->hw_downloading) - return -ENODEV; - - if (!try_module_get(local->hw_module)) - return -ENODEV; - local->num_dev_open++; - - if (!local->dev_enabled && local->func->hw_enable(dev, 1)) { - printk(KERN_WARNING "%s: could not enable MAC port\n", - dev->name); - prism2_close(dev); - return 1; - } - if (!local->dev_enabled) - prism2_callback(local, PRISM2_CALLBACK_ENABLE); - local->dev_enabled = 1; - - if (dev != local->dev && !(local->dev->flags & IFF_UP)) { - /* Master radio interface is needed for all operation, so open - * it automatically when any virtual net_device is opened. */ - local->master_dev_auto_open = 1; - dev_open(local->dev); - } - - netif_device_attach(dev); - netif_start_queue(dev); - - return 0; -} - - -static int prism2_set_mac_address(struct net_device *dev, void *p) -{ - struct hostap_interface *iface; - local_info_t *local; - struct list_head *ptr; - struct sockaddr *addr = p; - - iface = netdev_priv(dev); - local = iface->local; - - if (local->func->set_rid(dev, HFA384X_RID_CNFOWNMACADDR, addr->sa_data, - ETH_ALEN) < 0 || local->func->reset_port(dev)) - return -EINVAL; - - read_lock_bh(&local->iface_lock); - list_for_each(ptr, &local->hostap_interfaces) { - iface = list_entry(ptr, struct hostap_interface, list); - memcpy(iface->dev->dev_addr, addr->sa_data, ETH_ALEN); - } - memcpy(local->dev->dev_addr, addr->sa_data, ETH_ALEN); - read_unlock_bh(&local->iface_lock); - - return 0; -} - - -/* TODO: to be further implemented as soon as Prism2 fully supports - * GroupAddresses and correct documentation is available */ -void hostap_set_multicast_list_queue(struct work_struct *work) -{ - local_info_t *local = - container_of(work, local_info_t, set_multicast_list_queue); - struct net_device *dev = local->dev; - - if (hostap_set_word(dev, HFA384X_RID_PROMISCUOUSMODE, - local->is_promisc)) { - printk(KERN_INFO "%s: %sabling promiscuous mode failed\n", - dev->name, local->is_promisc ? "en" : "dis"); - } -} - - -static void hostap_set_multicast_list(struct net_device *dev) -{ -#if 0 - /* FIX: promiscuous mode seems to be causing a lot of problems with - * some station firmware versions (FCSErr frames, invalid MACPort, etc. - * corrupted incoming frames). This code is now commented out while the - * problems are investigated. */ - struct hostap_interface *iface; - local_info_t *local; - - iface = netdev_priv(dev); - local = iface->local; - if ((dev->flags & IFF_ALLMULTI) || (dev->flags & IFF_PROMISC)) { - local->is_promisc = 1; - } else { - local->is_promisc = 0; - } - - schedule_work(&local->set_multicast_list_queue); -#endif -} - - -static int prism2_change_mtu(struct net_device *dev, int new_mtu) -{ - if (new_mtu < PRISM2_MIN_MTU || new_mtu > PRISM2_MAX_MTU) - return -EINVAL; - - dev->mtu = new_mtu; - return 0; -} - - -static void prism2_tx_timeout(struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - struct hfa384x_regs regs; - - iface = netdev_priv(dev); - local = iface->local; - - printk(KERN_WARNING "%s Tx timed out! Resetting card\n", dev->name); - netif_stop_queue(local->dev); - - local->func->read_regs(dev, ®s); - printk(KERN_DEBUG "%s: CMD=%04x EVSTAT=%04x " - "OFFSET0=%04x OFFSET1=%04x SWSUPPORT0=%04x\n", - dev->name, regs.cmd, regs.evstat, regs.offset0, regs.offset1, - regs.swsupport0); - - local->func->schedule_reset(local); -} - -const struct header_ops hostap_80211_ops = { - .create = eth_header, - .rebuild = eth_rebuild_header, - .cache = eth_header_cache, - .cache_update = eth_header_cache_update, - .parse = hostap_80211_header_parse, -}; -EXPORT_SYMBOL(hostap_80211_ops); - - -static const struct net_device_ops hostap_netdev_ops = { - .ndo_start_xmit = hostap_data_start_xmit, - - .ndo_open = prism2_open, - .ndo_stop = prism2_close, - .ndo_do_ioctl = hostap_ioctl, - .ndo_set_mac_address = prism2_set_mac_address, - .ndo_set_rx_mode = hostap_set_multicast_list, - .ndo_change_mtu = prism2_change_mtu, - .ndo_tx_timeout = prism2_tx_timeout, - .ndo_validate_addr = eth_validate_addr, -}; - -static const struct net_device_ops hostap_mgmt_netdev_ops = { - .ndo_start_xmit = hostap_mgmt_start_xmit, - - .ndo_open = prism2_open, - .ndo_stop = prism2_close, - .ndo_do_ioctl = hostap_ioctl, - .ndo_set_mac_address = prism2_set_mac_address, - .ndo_set_rx_mode = hostap_set_multicast_list, - .ndo_change_mtu = prism2_change_mtu, - .ndo_tx_timeout = prism2_tx_timeout, - .ndo_validate_addr = eth_validate_addr, -}; - -static const struct net_device_ops hostap_master_ops = { - .ndo_start_xmit = hostap_master_start_xmit, - - .ndo_open = prism2_open, - .ndo_stop = prism2_close, - .ndo_do_ioctl = hostap_ioctl, - .ndo_set_mac_address = prism2_set_mac_address, - .ndo_set_rx_mode = hostap_set_multicast_list, - .ndo_change_mtu = prism2_change_mtu, - .ndo_tx_timeout = prism2_tx_timeout, - .ndo_validate_addr = eth_validate_addr, -}; - -void hostap_setup_dev(struct net_device *dev, local_info_t *local, - int type) -{ - struct hostap_interface *iface; - - iface = netdev_priv(dev); - ether_setup(dev); - dev->priv_flags &= ~IFF_TX_SKB_SHARING; - - /* kernel callbacks */ - if (iface) { - /* Currently, we point to the proper spy_data only on - * the main_dev. This could be fixed. Jean II */ - iface->wireless_data.spy_data = &iface->spy_data; - dev->wireless_data = &iface->wireless_data; - } - dev->wireless_handlers = &hostap_iw_handler_def; - dev->watchdog_timeo = TX_TIMEOUT; - - switch(type) { - case HOSTAP_INTERFACE_AP: - dev->tx_queue_len = 0; /* use main radio device queue */ - dev->netdev_ops = &hostap_mgmt_netdev_ops; - dev->type = ARPHRD_IEEE80211; - dev->header_ops = &hostap_80211_ops; - break; - case HOSTAP_INTERFACE_MASTER: - dev->netdev_ops = &hostap_master_ops; - break; - default: - dev->tx_queue_len = 0; /* use main radio device queue */ - dev->netdev_ops = &hostap_netdev_ops; - } - - dev->mtu = local->mtu; - - - SET_ETHTOOL_OPS(dev, &prism2_ethtool_ops); - -} - -static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked) -{ - struct net_device *dev = local->dev; - - if (local->apdev) - return -EEXIST; - - printk(KERN_DEBUG "%s: enabling hostapd mode\n", dev->name); - - local->apdev = hostap_add_interface(local, HOSTAP_INTERFACE_AP, - rtnl_locked, local->ddev->name, - "ap"); - if (local->apdev == NULL) - return -ENOMEM; - - return 0; -} - - -static int hostap_disable_hostapd(local_info_t *local, int rtnl_locked) -{ - struct net_device *dev = local->dev; - - printk(KERN_DEBUG "%s: disabling hostapd mode\n", dev->name); - - hostap_remove_interface(local->apdev, rtnl_locked, 1); - local->apdev = NULL; - - return 0; -} - - -static int hostap_enable_hostapd_sta(local_info_t *local, int rtnl_locked) -{ - struct net_device *dev = local->dev; - - if (local->stadev) - return -EEXIST; - - printk(KERN_DEBUG "%s: enabling hostapd STA mode\n", dev->name); - - local->stadev = hostap_add_interface(local, HOSTAP_INTERFACE_STA, - rtnl_locked, local->ddev->name, - "sta"); - if (local->stadev == NULL) - return -ENOMEM; - - return 0; -} - - -static int hostap_disable_hostapd_sta(local_info_t *local, int rtnl_locked) -{ - struct net_device *dev = local->dev; - - printk(KERN_DEBUG "%s: disabling hostapd mode\n", dev->name); - - hostap_remove_interface(local->stadev, rtnl_locked, 1); - local->stadev = NULL; - - return 0; -} - - -int hostap_set_hostapd(local_info_t *local, int val, int rtnl_locked) -{ - int ret; - - if (val < 0 || val > 1) - return -EINVAL; - - if (local->hostapd == val) - return 0; - - if (val) { - ret = hostap_enable_hostapd(local, rtnl_locked); - if (ret == 0) - local->hostapd = 1; - } else { - local->hostapd = 0; - ret = hostap_disable_hostapd(local, rtnl_locked); - if (ret != 0) - local->hostapd = 1; - } - - return ret; -} - - -int hostap_set_hostapd_sta(local_info_t *local, int val, int rtnl_locked) -{ - int ret; - - if (val < 0 || val > 1) - return -EINVAL; - - if (local->hostapd_sta == val) - return 0; - - if (val) { - ret = hostap_enable_hostapd_sta(local, rtnl_locked); - if (ret == 0) - local->hostapd_sta = 1; - } else { - local->hostapd_sta = 0; - ret = hostap_disable_hostapd_sta(local, rtnl_locked); - if (ret != 0) - local->hostapd_sta = 1; - } - - - return ret; -} - - -int prism2_update_comms_qual(struct net_device *dev) -{ - struct hostap_interface *iface; - local_info_t *local; - int ret = 0; - struct hfa384x_comms_quality sq; - - iface = netdev_priv(dev); - local = iface->local; - if (!local->sta_fw_ver) - ret = -1; - else if (local->sta_fw_ver >= PRISM2_FW_VER(1,3,1)) { - if (local->func->get_rid(local->dev, - HFA384X_RID_DBMCOMMSQUALITY, - &sq, sizeof(sq), 1) >= 0) { - local->comms_qual = (s16) le16_to_cpu(sq.comm_qual); - local->avg_signal = (s16) le16_to_cpu(sq.signal_level); - local->avg_noise = (s16) le16_to_cpu(sq.noise_level); - local->last_comms_qual_update = jiffies; - } else - ret = -1; - } else { - if (local->func->get_rid(local->dev, HFA384X_RID_COMMSQUALITY, - &sq, sizeof(sq), 1) >= 0) { - local->comms_qual = le16_to_cpu(sq.comm_qual); - local->avg_signal = HFA384X_LEVEL_TO_dBm( - le16_to_cpu(sq.signal_level)); - local->avg_noise = HFA384X_LEVEL_TO_dBm( - le16_to_cpu(sq.noise_level)); - local->last_comms_qual_update = jiffies; - } else - ret = -1; - } - - return ret; -} - - -int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, - u8 *body, size_t bodylen) -{ - struct sk_buff *skb; - struct hostap_ieee80211_mgmt *mgmt; - struct hostap_skb_tx_data *meta; - struct net_device *dev = local->dev; - - skb = dev_alloc_skb(IEEE80211_MGMT_HDR_LEN + bodylen); - if (skb == NULL) - return -ENOMEM; - - mgmt = (struct hostap_ieee80211_mgmt *) - skb_put(skb, IEEE80211_MGMT_HDR_LEN); - memset(mgmt, 0, IEEE80211_MGMT_HDR_LEN); - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); - memcpy(mgmt->da, dst, ETH_ALEN); - memcpy(mgmt->sa, dev->dev_addr, ETH_ALEN); - memcpy(mgmt->bssid, dst, ETH_ALEN); - if (body) - memcpy(skb_put(skb, bodylen), body, bodylen); - - meta = (struct hostap_skb_tx_data *) skb->cb; - memset(meta, 0, sizeof(*meta)); - meta->magic = HOSTAP_SKB_TX_DATA_MAGIC; - meta->iface = netdev_priv(dev); - - skb->dev = dev; - skb_reset_mac_header(skb); - skb_reset_network_header(skb); - dev_queue_xmit(skb); - - return 0; -} - - -int prism2_sta_deauth(local_info_t *local, u16 reason) -{ - union iwreq_data wrqu; - int ret; - __le16 val = cpu_to_le16(reason); - - if (local->iw_mode != IW_MODE_INFRA || - is_zero_ether_addr(local->bssid) || - memcmp(local->bssid, "\x44\x44\x44\x44\x44\x44", ETH_ALEN) == 0) - return 0; - - ret = prism2_sta_send_mgmt(local, local->bssid, IEEE80211_STYPE_DEAUTH, - (u8 *) &val, 2); - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); - wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL); - return ret; -} - - -struct proc_dir_entry *hostap_proc; - -static int __init hostap_init(void) -{ - if (init_net.proc_net != NULL) { - hostap_proc = proc_mkdir("hostap", init_net.proc_net); - if (!hostap_proc) - printk(KERN_WARNING "Failed to mkdir " - "/proc/net/hostap\n"); - } else - hostap_proc = NULL; - - return 0; -} - - -static void __exit hostap_exit(void) -{ - if (hostap_proc != NULL) { - hostap_proc = NULL; - remove_proc_entry("hostap", init_net.proc_net); - } -} - - -EXPORT_SYMBOL(hostap_set_word); -EXPORT_SYMBOL(hostap_set_string); -EXPORT_SYMBOL(hostap_get_porttype); -EXPORT_SYMBOL(hostap_set_encryption); -EXPORT_SYMBOL(hostap_set_antsel); -EXPORT_SYMBOL(hostap_set_roaming); -EXPORT_SYMBOL(hostap_set_auth_algs); -EXPORT_SYMBOL(hostap_dump_rx_header); -EXPORT_SYMBOL(hostap_dump_tx_header); -EXPORT_SYMBOL(hostap_80211_get_hdrlen); -EXPORT_SYMBOL(hostap_setup_dev); -EXPORT_SYMBOL(hostap_set_multicast_list_queue); -EXPORT_SYMBOL(hostap_set_hostapd); -EXPORT_SYMBOL(hostap_set_hostapd_sta); -EXPORT_SYMBOL(hostap_add_interface); -EXPORT_SYMBOL(hostap_remove_interface); -EXPORT_SYMBOL(prism2_update_comms_qual); - -module_init(hostap_init); -module_exit(hostap_exit); diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c deleted file mode 100644 index 05ca3402dca7..000000000000 --- a/drivers/net/wireless/hostap/hostap_pci.c +++ /dev/null @@ -1,460 +0,0 @@ -#define PRISM2_PCI - -/* Host AP driver's support for Intersil Prism2.5 PCI cards is based on - * driver patches from Reyk Floeter and - * Andy Warner */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "hostap_wlan.h" - - -static char *dev_info = "hostap_pci"; - - -MODULE_AUTHOR("Jouni Malinen"); -MODULE_DESCRIPTION("Support for Intersil Prism2.5-based 802.11 wireless LAN " - "PCI cards."); -MODULE_SUPPORTED_DEVICE("Intersil Prism2.5-based WLAN PCI cards"); -MODULE_LICENSE("GPL"); - - -/* struct local_info::hw_priv */ -struct hostap_pci_priv { - void __iomem *mem_start; -}; - - -/* FIX: do we need mb/wmb/rmb with memory operations? */ - - -static DEFINE_PCI_DEVICE_TABLE(prism2_pci_id_table) = { - /* Intersil Prism3 ISL3872 11Mb/s WLAN Controller */ - { 0x1260, 0x3872, PCI_ANY_ID, PCI_ANY_ID }, - /* Intersil Prism2.5 ISL3874 11Mb/s WLAN Controller */ - { 0x1260, 0x3873, PCI_ANY_ID, PCI_ANY_ID }, - /* Samsung MagicLAN SWL-2210P */ - { 0x167d, 0xa000, PCI_ANY_ID, PCI_ANY_ID }, - { 0 } -}; - - -#ifdef PRISM2_IO_DEBUG - -static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v) -{ - struct hostap_interface *iface; - struct hostap_pci_priv *hw_priv; - local_info_t *local; - unsigned long flags; - - iface = netdev_priv(dev); - local = iface->local; - hw_priv = local->hw_priv; - - spin_lock_irqsave(&local->lock, flags); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v); - writeb(v, hw_priv->mem_start + a); - spin_unlock_irqrestore(&local->lock, flags); -} - -static inline u8 hfa384x_inb_debug(struct net_device *dev, int a) -{ - struct hostap_interface *iface; - struct hostap_pci_priv *hw_priv; - local_info_t *local; - unsigned long flags; - u8 v; - - iface = netdev_priv(dev); - local = iface->local; - hw_priv = local->hw_priv; - - spin_lock_irqsave(&local->lock, flags); - v = readb(hw_priv->mem_start + a); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INB, a, v); - spin_unlock_irqrestore(&local->lock, flags); - return v; -} - -static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v) -{ - struct hostap_interface *iface; - struct hostap_pci_priv *hw_priv; - local_info_t *local; - unsigned long flags; - - iface = netdev_priv(dev); - local = iface->local; - hw_priv = local->hw_priv; - - spin_lock_irqsave(&local->lock, flags); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v); - writew(v, hw_priv->mem_start + a); - spin_unlock_irqrestore(&local->lock, flags); -} - -static inline u16 hfa384x_inw_debug(struct net_device *dev, int a) -{ - struct hostap_interface *iface; - struct hostap_pci_priv *hw_priv; - local_info_t *local; - unsigned long flags; - u16 v; - - iface = netdev_priv(dev); - local = iface->local; - hw_priv = local->hw_priv; - - spin_lock_irqsave(&local->lock, flags); - v = readw(hw_priv->mem_start + a); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INW, a, v); - spin_unlock_irqrestore(&local->lock, flags); - return v; -} - -#define HFA384X_OUTB(v,a) hfa384x_outb_debug(dev, (a), (v)) -#define HFA384X_INB(a) hfa384x_inb_debug(dev, (a)) -#define HFA384X_OUTW(v,a) hfa384x_outw_debug(dev, (a), (v)) -#define HFA384X_INW(a) hfa384x_inw_debug(dev, (a)) -#define HFA384X_OUTW_DATA(v,a) hfa384x_outw_debug(dev, (a), le16_to_cpu((v))) -#define HFA384X_INW_DATA(a) cpu_to_le16(hfa384x_inw_debug(dev, (a))) - -#else /* PRISM2_IO_DEBUG */ - -static inline void hfa384x_outb(struct net_device *dev, int a, u8 v) -{ - struct hostap_interface *iface; - struct hostap_pci_priv *hw_priv; - iface = netdev_priv(dev); - hw_priv = iface->local->hw_priv; - writeb(v, hw_priv->mem_start + a); -} - -static inline u8 hfa384x_inb(struct net_device *dev, int a) -{ - struct hostap_interface *iface; - struct hostap_pci_priv *hw_priv; - iface = netdev_priv(dev); - hw_priv = iface->local->hw_priv; - return readb(hw_priv->mem_start + a); -} - -static inline void hfa384x_outw(struct net_device *dev, int a, u16 v) -{ - struct hostap_interface *iface; - struct hostap_pci_priv *hw_priv; - iface = netdev_priv(dev); - hw_priv = iface->local->hw_priv; - writew(v, hw_priv->mem_start + a); -} - -static inline u16 hfa384x_inw(struct net_device *dev, int a) -{ - struct hostap_interface *iface; - struct hostap_pci_priv *hw_priv; - iface = netdev_priv(dev); - hw_priv = iface->local->hw_priv; - return readw(hw_priv->mem_start + a); -} - -#define HFA384X_OUTB(v,a) hfa384x_outb(dev, (a), (v)) -#define HFA384X_INB(a) hfa384x_inb(dev, (a)) -#define HFA384X_OUTW(v,a) hfa384x_outw(dev, (a), (v)) -#define HFA384X_INW(a) hfa384x_inw(dev, (a)) -#define HFA384X_OUTW_DATA(v,a) hfa384x_outw(dev, (a), le16_to_cpu((v))) -#define HFA384X_INW_DATA(a) cpu_to_le16(hfa384x_inw(dev, (a))) - -#endif /* PRISM2_IO_DEBUG */ - - -static int hfa384x_from_bap(struct net_device *dev, u16 bap, void *buf, - int len) -{ - u16 d_off; - __le16 *pos; - - d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF; - pos = (__le16 *) buf; - - for ( ; len > 1; len -= 2) - *pos++ = HFA384X_INW_DATA(d_off); - - if (len & 1) - *((char *) pos) = HFA384X_INB(d_off); - - return 0; -} - - -static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len) -{ - u16 d_off; - __le16 *pos; - - d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF; - pos = (__le16 *) buf; - - for ( ; len > 1; len -= 2) - HFA384X_OUTW_DATA(*pos++, d_off); - - if (len & 1) - HFA384X_OUTB(*((char *) pos), d_off); - - return 0; -} - - -/* FIX: This might change at some point.. */ -#include "hostap_hw.c" - -static void prism2_pci_cor_sreset(local_info_t *local) -{ - struct net_device *dev = local->dev; - u16 reg; - - reg = HFA384X_INB(HFA384X_PCICOR_OFF); - printk(KERN_DEBUG "%s: Original COR value: 0x%0x\n", dev->name, reg); - - /* linux-wlan-ng uses extremely long hold and settle times for - * COR sreset. A comment in the driver code mentions that the long - * delays appear to be necessary. However, at least IBM 22P6901 seems - * to work fine with shorter delays. - * - * Longer delays can be configured by uncommenting following line: */ -/* #define PRISM2_PCI_USE_LONG_DELAYS */ - -#ifdef PRISM2_PCI_USE_LONG_DELAYS - int i; - - HFA384X_OUTW(reg | 0x0080, HFA384X_PCICOR_OFF); - mdelay(250); - - HFA384X_OUTW(reg & ~0x0080, HFA384X_PCICOR_OFF); - mdelay(500); - - /* Wait for f/w to complete initialization (CMD:BUSY == 0) */ - i = 2000000 / 10; - while ((HFA384X_INW(HFA384X_CMD_OFF) & HFA384X_CMD_BUSY) && --i) - udelay(10); - -#else /* PRISM2_PCI_USE_LONG_DELAYS */ - - HFA384X_OUTW(reg | 0x0080, HFA384X_PCICOR_OFF); - mdelay(2); - HFA384X_OUTW(reg & ~0x0080, HFA384X_PCICOR_OFF); - mdelay(2); - -#endif /* PRISM2_PCI_USE_LONG_DELAYS */ - - if (HFA384X_INW(HFA384X_CMD_OFF) & HFA384X_CMD_BUSY) { - printk(KERN_DEBUG "%s: COR sreset timeout\n", dev->name); - } -} - - -static void prism2_pci_genesis_reset(local_info_t *local, int hcr) -{ - struct net_device *dev = local->dev; - - HFA384X_OUTW(0x00C5, HFA384X_PCICOR_OFF); - mdelay(10); - HFA384X_OUTW(hcr, HFA384X_PCIHCR_OFF); - mdelay(10); - HFA384X_OUTW(0x0045, HFA384X_PCICOR_OFF); - mdelay(10); -} - - -static struct prism2_helper_functions prism2_pci_funcs = -{ - .card_present = NULL, - .cor_sreset = prism2_pci_cor_sreset, - .genesis_reset = prism2_pci_genesis_reset, - .hw_type = HOSTAP_HW_PCI, -}; - - -static int prism2_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *id) -{ - unsigned long phymem; - void __iomem *mem = NULL; - local_info_t *local = NULL; - struct net_device *dev = NULL; - static int cards_found /* = 0 */; - int irq_registered = 0; - struct hostap_interface *iface; - struct hostap_pci_priv *hw_priv; - - hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL); - if (hw_priv == NULL) - return -ENOMEM; - - if (pci_enable_device(pdev)) - goto err_out_free; - - phymem = pci_resource_start(pdev, 0); - - if (!request_mem_region(phymem, pci_resource_len(pdev, 0), "Prism2")) { - printk(KERN_ERR "prism2: Cannot reserve PCI memory region\n"); - goto err_out_disable; - } - - mem = pci_ioremap_bar(pdev, 0); - if (mem == NULL) { - printk(KERN_ERR "prism2: Cannot remap PCI memory region\n") ; - goto fail; - } - - dev = prism2_init_local_data(&prism2_pci_funcs, cards_found, - &pdev->dev); - if (dev == NULL) - goto fail; - iface = netdev_priv(dev); - local = iface->local; - local->hw_priv = hw_priv; - cards_found++; - - dev->irq = pdev->irq; - hw_priv->mem_start = mem; - dev->base_addr = (unsigned long) mem; - - prism2_pci_cor_sreset(local); - - pci_set_drvdata(pdev, dev); - - if (request_irq(dev->irq, prism2_interrupt, IRQF_SHARED, dev->name, - dev)) { - printk(KERN_WARNING "%s: request_irq failed\n", dev->name); - goto fail; - } else - irq_registered = 1; - - if (!local->pri_only && prism2_hw_config(dev, 1)) { - printk(KERN_DEBUG "%s: hardware initialization failed\n", - dev_info); - goto fail; - } - - printk(KERN_INFO "%s: Intersil Prism2.5 PCI: " - "mem=0x%lx, irq=%d\n", dev->name, phymem, dev->irq); - - return hostap_hw_ready(dev); - - fail: - if (irq_registered && dev) - free_irq(dev->irq, dev); - - if (mem) - iounmap(mem); - - release_mem_region(phymem, pci_resource_len(pdev, 0)); - - err_out_disable: - pci_disable_device(pdev); - prism2_free_local_data(dev); - - err_out_free: - kfree(hw_priv); - - return -ENODEV; -} - - -static void prism2_pci_remove(struct pci_dev *pdev) -{ - struct net_device *dev; - struct hostap_interface *iface; - void __iomem *mem_start; - struct hostap_pci_priv *hw_priv; - - dev = pci_get_drvdata(pdev); - iface = netdev_priv(dev); - hw_priv = iface->local->hw_priv; - - /* Reset the hardware, and ensure interrupts are disabled. */ - prism2_pci_cor_sreset(iface->local); - hfa384x_disable_interrupts(dev); - - if (dev->irq) - free_irq(dev->irq, dev); - - mem_start = hw_priv->mem_start; - prism2_free_local_data(dev); - kfree(hw_priv); - - iounmap(mem_start); - - release_mem_region(pci_resource_start(pdev, 0), - pci_resource_len(pdev, 0)); - pci_disable_device(pdev); -} - - -#ifdef CONFIG_PM -static int prism2_pci_suspend(struct pci_dev *pdev, pm_message_t state) -{ - struct net_device *dev = pci_get_drvdata(pdev); - - if (netif_running(dev)) { - netif_stop_queue(dev); - netif_device_detach(dev); - } - prism2_suspend(dev); - pci_save_state(pdev); - pci_disable_device(pdev); - pci_set_power_state(pdev, PCI_D3hot); - - return 0; -} - -static int prism2_pci_resume(struct pci_dev *pdev) -{ - struct net_device *dev = pci_get_drvdata(pdev); - int err; - - err = pci_enable_device(pdev); - if (err) { - printk(KERN_ERR "%s: pci_enable_device failed on resume\n", - dev->name); - return err; - } - pci_restore_state(pdev); - prism2_hw_config(dev, 0); - if (netif_running(dev)) { - netif_device_attach(dev); - netif_start_queue(dev); - } - - return 0; -} -#endif /* CONFIG_PM */ - - -MODULE_DEVICE_TABLE(pci, prism2_pci_id_table); - -static struct pci_driver prism2_pci_driver = { - .name = "hostap_pci", - .id_table = prism2_pci_id_table, - .probe = prism2_pci_probe, - .remove = prism2_pci_remove, -#ifdef CONFIG_PM - .suspend = prism2_pci_suspend, - .resume = prism2_pci_resume, -#endif /* CONFIG_PM */ -}; - -module_pci_driver(prism2_pci_driver); diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c deleted file mode 100644 index c3d067ee4db9..000000000000 --- a/drivers/net/wireless/hostap/hostap_plx.c +++ /dev/null @@ -1,619 +0,0 @@ -#define PRISM2_PLX - -/* Host AP driver's support for PC Cards on PCI adapters using PLX9052 is - * based on: - * - Host AP driver patch from james@madingley.org - * - linux-wlan-ng driver, Copyright (C) AbsoluteValue Systems, Inc. - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "hostap_wlan.h" - - -static char *dev_info = "hostap_plx"; - - -MODULE_AUTHOR("Jouni Malinen"); -MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " - "cards (PLX)."); -MODULE_SUPPORTED_DEVICE("Intersil Prism2-based WLAN cards (PLX)"); -MODULE_LICENSE("GPL"); - - -static int ignore_cis; -module_param(ignore_cis, int, 0444); -MODULE_PARM_DESC(ignore_cis, "Do not verify manfid information in CIS"); - - -/* struct local_info::hw_priv */ -struct hostap_plx_priv { - void __iomem *attr_mem; - unsigned int cor_offset; -}; - - -#define PLX_MIN_ATTR_LEN 512 /* at least 2 x 256 is needed for CIS */ -#define COR_SRESET 0x80 -#define COR_LEVLREQ 0x40 -#define COR_ENABLE_FUNC 0x01 -/* PCI Configuration Registers */ -#define PLX_PCIIPR 0x3d /* PCI Interrupt Pin */ -/* Local Configuration Registers */ -#define PLX_INTCSR 0x4c /* Interrupt Control/Status Register */ -#define PLX_INTCSR_PCI_INTEN BIT(6) /* PCI Interrupt Enable */ -#define PLX_CNTRL 0x50 -#define PLX_CNTRL_SERIAL_EEPROM_PRESENT BIT(28) - - -#define PLXDEV(vendor,dev,str) { vendor, dev, PCI_ANY_ID, PCI_ANY_ID } - -static DEFINE_PCI_DEVICE_TABLE(prism2_plx_id_table) = { - PLXDEV(0x10b7, 0x7770, "3Com AirConnect PCI 777A"), - PLXDEV(0x111a, 0x1023, "Siemens SpeedStream SS1023"), - PLXDEV(0x126c, 0x8030, "Nortel emobility"), - PLXDEV(0x1562, 0x0001, "Symbol LA-4123"), - PLXDEV(0x1385, 0x4100, "Netgear MA301"), - PLXDEV(0x15e8, 0x0130, "National Datacomm NCP130 (PLX9052)"), - PLXDEV(0x15e8, 0x0131, "National Datacomm NCP130 (TMD7160)"), - PLXDEV(0x1638, 0x1100, "Eumitcom WL11000"), - PLXDEV(0x16ab, 0x1100, "Global Sun Tech GL24110P"), - PLXDEV(0x16ab, 0x1101, "Global Sun Tech GL24110P (?)"), - PLXDEV(0x16ab, 0x1102, "Linksys WPC11 with WDT11"), - PLXDEV(0x16ab, 0x1103, "Longshine 8031"), - PLXDEV(0x16ec, 0x3685, "US Robotics USR2415"), - PLXDEV(0xec80, 0xec00, "Belkin F5D6000"), - { 0 } -}; - - -/* Array of known Prism2/2.5 PC Card manufactured ids. If your card's manfid - * is not listed here, you will need to add it here to get the driver - * initialized. */ -static struct prism2_plx_manfid { - u16 manfid1, manfid2; -} prism2_plx_known_manfids[] = { - { 0x000b, 0x7110 } /* D-Link DWL-650 Rev. P1 */, - { 0x000b, 0x7300 } /* Philips 802.11b WLAN PCMCIA */, - { 0x0101, 0x0777 } /* 3Com AirConnect PCI 777A */, - { 0x0126, 0x8000 } /* Proxim RangeLAN */, - { 0x0138, 0x0002 } /* Compaq WL100 */, - { 0x0156, 0x0002 } /* Intersil Prism II Ref. Design (and others) */, - { 0x026f, 0x030b } /* Buffalo WLI-CF-S11G */, - { 0x0274, 0x1612 } /* Linksys WPC11 Ver 2.5 */, - { 0x0274, 0x1613 } /* Linksys WPC11 Ver 3 */, - { 0x028a, 0x0002 } /* D-Link DRC-650 */, - { 0x0250, 0x0002 } /* Samsung SWL2000-N */, - { 0xc250, 0x0002 } /* EMTAC A2424i */, - { 0xd601, 0x0002 } /* Z-Com XI300 */, - { 0xd601, 0x0005 } /* Zcomax XI-325H 200mW */, - { 0, 0} -}; - - -#ifdef PRISM2_IO_DEBUG - -static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v) -{ - struct hostap_interface *iface; - local_info_t *local; - unsigned long flags; - - iface = netdev_priv(dev); - local = iface->local; - - spin_lock_irqsave(&local->lock, flags); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v); - outb(v, dev->base_addr + a); - spin_unlock_irqrestore(&local->lock, flags); -} - -static inline u8 hfa384x_inb_debug(struct net_device *dev, int a) -{ - struct hostap_interface *iface; - local_info_t *local; - unsigned long flags; - u8 v; - - iface = netdev_priv(dev); - local = iface->local; - - spin_lock_irqsave(&local->lock, flags); - v = inb(dev->base_addr + a); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INB, a, v); - spin_unlock_irqrestore(&local->lock, flags); - return v; -} - -static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v) -{ - struct hostap_interface *iface; - local_info_t *local; - unsigned long flags; - - iface = netdev_priv(dev); - local = iface->local; - - spin_lock_irqsave(&local->lock, flags); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v); - outw(v, dev->base_addr + a); - spin_unlock_irqrestore(&local->lock, flags); -} - -static inline u16 hfa384x_inw_debug(struct net_device *dev, int a) -{ - struct hostap_interface *iface; - local_info_t *local; - unsigned long flags; - u16 v; - - iface = netdev_priv(dev); - local = iface->local; - - spin_lock_irqsave(&local->lock, flags); - v = inw(dev->base_addr + a); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INW, a, v); - spin_unlock_irqrestore(&local->lock, flags); - return v; -} - -static inline void hfa384x_outsw_debug(struct net_device *dev, int a, - u8 *buf, int wc) -{ - struct hostap_interface *iface; - local_info_t *local; - unsigned long flags; - - iface = netdev_priv(dev); - local = iface->local; - - spin_lock_irqsave(&local->lock, flags); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTSW, a, wc); - outsw(dev->base_addr + a, buf, wc); - spin_unlock_irqrestore(&local->lock, flags); -} - -static inline void hfa384x_insw_debug(struct net_device *dev, int a, - u8 *buf, int wc) -{ - struct hostap_interface *iface; - local_info_t *local; - unsigned long flags; - - iface = netdev_priv(dev); - local = iface->local; - - spin_lock_irqsave(&local->lock, flags); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INSW, a, wc); - insw(dev->base_addr + a, buf, wc); - spin_unlock_irqrestore(&local->lock, flags); -} - -#define HFA384X_OUTB(v,a) hfa384x_outb_debug(dev, (a), (v)) -#define HFA384X_INB(a) hfa384x_inb_debug(dev, (a)) -#define HFA384X_OUTW(v,a) hfa384x_outw_debug(dev, (a), (v)) -#define HFA384X_INW(a) hfa384x_inw_debug(dev, (a)) -#define HFA384X_OUTSW(a, buf, wc) hfa384x_outsw_debug(dev, (a), (buf), (wc)) -#define HFA384X_INSW(a, buf, wc) hfa384x_insw_debug(dev, (a), (buf), (wc)) - -#else /* PRISM2_IO_DEBUG */ - -#define HFA384X_OUTB(v,a) outb((v), dev->base_addr + (a)) -#define HFA384X_INB(a) inb(dev->base_addr + (a)) -#define HFA384X_OUTW(v,a) outw((v), dev->base_addr + (a)) -#define HFA384X_INW(a) inw(dev->base_addr + (a)) -#define HFA384X_INSW(a, buf, wc) insw(dev->base_addr + (a), buf, wc) -#define HFA384X_OUTSW(a, buf, wc) outsw(dev->base_addr + (a), buf, wc) - -#endif /* PRISM2_IO_DEBUG */ - - -static int hfa384x_from_bap(struct net_device *dev, u16 bap, void *buf, - int len) -{ - u16 d_off; - u16 *pos; - - d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF; - pos = (u16 *) buf; - - if (len / 2) - HFA384X_INSW(d_off, buf, len / 2); - pos += len / 2; - - if (len & 1) - *((char *) pos) = HFA384X_INB(d_off); - - return 0; -} - - -static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len) -{ - u16 d_off; - u16 *pos; - - d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF; - pos = (u16 *) buf; - - if (len / 2) - HFA384X_OUTSW(d_off, buf, len / 2); - pos += len / 2; - - if (len & 1) - HFA384X_OUTB(*((char *) pos), d_off); - - return 0; -} - - -/* FIX: This might change at some point.. */ -#include "hostap_hw.c" - - -static void prism2_plx_cor_sreset(local_info_t *local) -{ - unsigned char corsave; - struct hostap_plx_priv *hw_priv = local->hw_priv; - - printk(KERN_DEBUG "%s: Doing reset via direct COR access.\n", - dev_info); - - /* Set sreset bit of COR and clear it after hold time */ - - if (hw_priv->attr_mem == NULL) { - /* TMD7160 - COR at card's first I/O addr */ - corsave = inb(hw_priv->cor_offset); - outb(corsave | COR_SRESET, hw_priv->cor_offset); - mdelay(2); - outb(corsave & ~COR_SRESET, hw_priv->cor_offset); - mdelay(2); - } else { - /* PLX9052 */ - corsave = readb(hw_priv->attr_mem + hw_priv->cor_offset); - writeb(corsave | COR_SRESET, - hw_priv->attr_mem + hw_priv->cor_offset); - mdelay(2); - writeb(corsave & ~COR_SRESET, - hw_priv->attr_mem + hw_priv->cor_offset); - mdelay(2); - } -} - - -static void prism2_plx_genesis_reset(local_info_t *local, int hcr) -{ - unsigned char corsave; - struct hostap_plx_priv *hw_priv = local->hw_priv; - - if (hw_priv->attr_mem == NULL) { - /* TMD7160 - COR at card's first I/O addr */ - corsave = inb(hw_priv->cor_offset); - outb(corsave | COR_SRESET, hw_priv->cor_offset); - mdelay(10); - outb(hcr, hw_priv->cor_offset + 2); - mdelay(10); - outb(corsave & ~COR_SRESET, hw_priv->cor_offset); - mdelay(10); - } else { - /* PLX9052 */ - corsave = readb(hw_priv->attr_mem + hw_priv->cor_offset); - writeb(corsave | COR_SRESET, - hw_priv->attr_mem + hw_priv->cor_offset); - mdelay(10); - writeb(hcr, hw_priv->attr_mem + hw_priv->cor_offset + 2); - mdelay(10); - writeb(corsave & ~COR_SRESET, - hw_priv->attr_mem + hw_priv->cor_offset); - mdelay(10); - } -} - - -static struct prism2_helper_functions prism2_plx_funcs = -{ - .card_present = NULL, - .cor_sreset = prism2_plx_cor_sreset, - .genesis_reset = prism2_plx_genesis_reset, - .hw_type = HOSTAP_HW_PLX, -}; - - -static int prism2_plx_check_cis(void __iomem *attr_mem, int attr_len, - unsigned int *cor_offset, - unsigned int *cor_index) -{ -#define CISTPL_CONFIG 0x1A -#define CISTPL_MANFID 0x20 -#define CISTPL_END 0xFF -#define CIS_MAX_LEN 256 - u8 *cis; - int i, pos; - unsigned int rmsz, rasz, manfid1, manfid2; - struct prism2_plx_manfid *manfid; - - cis = kmalloc(CIS_MAX_LEN, GFP_KERNEL); - if (cis == NULL) - return -ENOMEM; - - /* read CIS; it is in even offsets in the beginning of attr_mem */ - for (i = 0; i < CIS_MAX_LEN; i++) - cis[i] = readb(attr_mem + 2 * i); - printk(KERN_DEBUG "%s: CIS: %02x %02x %02x %02x %02x %02x ...\n", - dev_info, cis[0], cis[1], cis[2], cis[3], cis[4], cis[5]); - - /* set reasonable defaults for Prism2 cards just in case CIS parsing - * fails */ - *cor_offset = 0x3e0; - *cor_index = 0x01; - manfid1 = manfid2 = 0; - - pos = 0; - while (pos < CIS_MAX_LEN - 1 && cis[pos] != CISTPL_END) { - if (pos + 2 + cis[pos + 1] > CIS_MAX_LEN) - goto cis_error; - - switch (cis[pos]) { - case CISTPL_CONFIG: - if (cis[pos + 1] < 2) - goto cis_error; - rmsz = (cis[pos + 2] & 0x3c) >> 2; - rasz = cis[pos + 2] & 0x03; - if (4 + rasz + rmsz > cis[pos + 1]) - goto cis_error; - *cor_index = cis[pos + 3] & 0x3F; - *cor_offset = 0; - for (i = 0; i <= rasz; i++) - *cor_offset += cis[pos + 4 + i] << (8 * i); - printk(KERN_DEBUG "%s: cor_index=0x%x " - "cor_offset=0x%x\n", dev_info, - *cor_index, *cor_offset); - if (*cor_offset > attr_len) { - printk(KERN_ERR "%s: COR offset not within " - "attr_mem\n", dev_info); - kfree(cis); - return -1; - } - break; - - case CISTPL_MANFID: - if (cis[pos + 1] < 4) - goto cis_error; - manfid1 = cis[pos + 2] + (cis[pos + 3] << 8); - manfid2 = cis[pos + 4] + (cis[pos + 5] << 8); - printk(KERN_DEBUG "%s: manfid=0x%04x, 0x%04x\n", - dev_info, manfid1, manfid2); - break; - } - - pos += cis[pos + 1] + 2; - } - - if (pos >= CIS_MAX_LEN || cis[pos] != CISTPL_END) - goto cis_error; - - for (manfid = prism2_plx_known_manfids; manfid->manfid1 != 0; manfid++) - if (manfid1 == manfid->manfid1 && manfid2 == manfid->manfid2) { - kfree(cis); - return 0; - } - - printk(KERN_INFO "%s: unknown manfid 0x%04x, 0x%04x - assuming this is" - " not supported card\n", dev_info, manfid1, manfid2); - goto fail; - - cis_error: - printk(KERN_WARNING "%s: invalid CIS data\n", dev_info); - - fail: - kfree(cis); - if (ignore_cis) { - printk(KERN_INFO "%s: ignore_cis parameter set - ignoring " - "errors during CIS verification\n", dev_info); - return 0; - } - return -1; -} - - -static int prism2_plx_probe(struct pci_dev *pdev, - const struct pci_device_id *id) -{ - unsigned int pccard_ioaddr, plx_ioaddr; - unsigned long pccard_attr_mem; - unsigned int pccard_attr_len; - void __iomem *attr_mem = NULL; - unsigned int cor_offset = 0, cor_index = 0; - u32 reg; - local_info_t *local = NULL; - struct net_device *dev = NULL; - struct hostap_interface *iface; - static int cards_found /* = 0 */; - int irq_registered = 0; - int tmd7160; - struct hostap_plx_priv *hw_priv; - - hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL); - if (hw_priv == NULL) - return -ENOMEM; - - if (pci_enable_device(pdev)) - goto err_out_free; - - /* National Datacomm NCP130 based on TMD7160, not PLX9052. */ - tmd7160 = (pdev->vendor == 0x15e8) && (pdev->device == 0x0131); - - plx_ioaddr = pci_resource_start(pdev, 1); - pccard_ioaddr = pci_resource_start(pdev, tmd7160 ? 2 : 3); - - if (tmd7160) { - /* TMD7160 */ - attr_mem = NULL; /* no access to PC Card attribute memory */ - - printk(KERN_INFO "TMD7160 PCI/PCMCIA adapter: io=0x%x, " - "irq=%d, pccard_io=0x%x\n", - plx_ioaddr, pdev->irq, pccard_ioaddr); - - cor_offset = plx_ioaddr; - cor_index = 0x04; - - outb(cor_index | COR_LEVLREQ | COR_ENABLE_FUNC, plx_ioaddr); - mdelay(1); - reg = inb(plx_ioaddr); - if (reg != (cor_index | COR_LEVLREQ | COR_ENABLE_FUNC)) { - printk(KERN_ERR "%s: Error setting COR (expected=" - "0x%02x, was=0x%02x)\n", dev_info, - cor_index | COR_LEVLREQ | COR_ENABLE_FUNC, reg); - goto fail; - } - } else { - /* PLX9052 */ - pccard_attr_mem = pci_resource_start(pdev, 2); - pccard_attr_len = pci_resource_len(pdev, 2); - if (pccard_attr_len < PLX_MIN_ATTR_LEN) - goto fail; - - - attr_mem = ioremap(pccard_attr_mem, pccard_attr_len); - if (attr_mem == NULL) { - printk(KERN_ERR "%s: cannot remap attr_mem\n", - dev_info); - goto fail; - } - - printk(KERN_INFO "PLX9052 PCI/PCMCIA adapter: " - "mem=0x%lx, plx_io=0x%x, irq=%d, pccard_io=0x%x\n", - pccard_attr_mem, plx_ioaddr, pdev->irq, pccard_ioaddr); - - if (prism2_plx_check_cis(attr_mem, pccard_attr_len, - &cor_offset, &cor_index)) { - printk(KERN_INFO "Unknown PC Card CIS - not a " - "Prism2/2.5 card?\n"); - goto fail; - } - - printk(KERN_DEBUG "Prism2/2.5 PC Card detected in PLX9052 " - "adapter\n"); - - /* Write COR to enable PC Card */ - writeb(cor_index | COR_LEVLREQ | COR_ENABLE_FUNC, - attr_mem + cor_offset); - - /* Enable PCI interrupts if they are not already enabled */ - reg = inl(plx_ioaddr + PLX_INTCSR); - printk(KERN_DEBUG "PLX_INTCSR=0x%x\n", reg); - if (!(reg & PLX_INTCSR_PCI_INTEN)) { - outl(reg | PLX_INTCSR_PCI_INTEN, - plx_ioaddr + PLX_INTCSR); - if (!(inl(plx_ioaddr + PLX_INTCSR) & - PLX_INTCSR_PCI_INTEN)) { - printk(KERN_WARNING "%s: Could not enable " - "Local Interrupts\n", dev_info); - goto fail; - } - } - - reg = inl(plx_ioaddr + PLX_CNTRL); - printk(KERN_DEBUG "PLX_CNTRL=0x%x (Serial EEPROM " - "present=%d)\n", - reg, (reg & PLX_CNTRL_SERIAL_EEPROM_PRESENT) != 0); - /* should set PLX_PCIIPR to 0x01 (INTA#) if Serial EEPROM is - * not present; but are there really such cards in use(?) */ - } - - dev = prism2_init_local_data(&prism2_plx_funcs, cards_found, - &pdev->dev); - if (dev == NULL) - goto fail; - iface = netdev_priv(dev); - local = iface->local; - local->hw_priv = hw_priv; - cards_found++; - - dev->irq = pdev->irq; - dev->base_addr = pccard_ioaddr; - hw_priv->attr_mem = attr_mem; - hw_priv->cor_offset = cor_offset; - - pci_set_drvdata(pdev, dev); - - if (request_irq(dev->irq, prism2_interrupt, IRQF_SHARED, dev->name, - dev)) { - printk(KERN_WARNING "%s: request_irq failed\n", dev->name); - goto fail; - } else - irq_registered = 1; - - if (prism2_hw_config(dev, 1)) { - printk(KERN_DEBUG "%s: hardware initialization failed\n", - dev_info); - goto fail; - } - - return hostap_hw_ready(dev); - - fail: - if (irq_registered && dev) - free_irq(dev->irq, dev); - - if (attr_mem) - iounmap(attr_mem); - - pci_disable_device(pdev); - prism2_free_local_data(dev); - - err_out_free: - kfree(hw_priv); - - return -ENODEV; -} - - -static void prism2_plx_remove(struct pci_dev *pdev) -{ - struct net_device *dev; - struct hostap_interface *iface; - struct hostap_plx_priv *hw_priv; - - dev = pci_get_drvdata(pdev); - iface = netdev_priv(dev); - hw_priv = iface->local->hw_priv; - - /* Reset the hardware, and ensure interrupts are disabled. */ - prism2_plx_cor_sreset(iface->local); - hfa384x_disable_interrupts(dev); - - if (hw_priv->attr_mem) - iounmap(hw_priv->attr_mem); - if (dev->irq) - free_irq(dev->irq, dev); - - prism2_free_local_data(dev); - kfree(hw_priv); - pci_disable_device(pdev); -} - - -MODULE_DEVICE_TABLE(pci, prism2_plx_id_table); - -static struct pci_driver prism2_plx_driver = { - .name = "hostap_plx", - .id_table = prism2_plx_id_table, - .probe = prism2_plx_probe, - .remove = prism2_plx_remove, -}; - -module_pci_driver(prism2_plx_driver); diff --git a/drivers/net/wireless/hostap/hostap_proc.c b/drivers/net/wireless/hostap/hostap_proc.c deleted file mode 100644 index aa7ad3a7a69b..000000000000 --- a/drivers/net/wireless/hostap/hostap_proc.c +++ /dev/null @@ -1,504 +0,0 @@ -/* /proc routines for Host AP driver */ - -#include -#include -#include -#include - -#include "hostap_wlan.h" -#include "hostap.h" - -#define PROC_LIMIT (PAGE_SIZE - 80) - - -#ifndef PRISM2_NO_PROCFS_DEBUG -static int prism2_debug_proc_show(struct seq_file *m, void *v) -{ - local_info_t *local = m->private; - int i; - - seq_printf(m, "next_txfid=%d next_alloc=%d\n", - local->next_txfid, local->next_alloc); - for (i = 0; i < PRISM2_TXFID_COUNT; i++) - seq_printf(m, "FID: tx=%04X intransmit=%04X\n", - local->txfid[i], local->intransmitfid[i]); - seq_printf(m, "FW TX rate control: %d\n", local->fw_tx_rate_control); - seq_printf(m, "beacon_int=%d\n", local->beacon_int); - seq_printf(m, "dtim_period=%d\n", local->dtim_period); - seq_printf(m, "wds_max_connections=%d\n", local->wds_max_connections); - seq_printf(m, "dev_enabled=%d\n", local->dev_enabled); - seq_printf(m, "sw_tick_stuck=%d\n", local->sw_tick_stuck); - for (i = 0; i < WEP_KEYS; i++) { - if (local->crypt_info.crypt[i] && - local->crypt_info.crypt[i]->ops) { - seq_printf(m, "crypt[%d]=%s\n", i, - local->crypt_info.crypt[i]->ops->name); - } - } - seq_printf(m, "pri_only=%d\n", local->pri_only); - seq_printf(m, "pci=%d\n", local->func->hw_type == HOSTAP_HW_PCI); - seq_printf(m, "sram_type=%d\n", local->sram_type); - seq_printf(m, "no_pri=%d\n", local->no_pri); - - return 0; -} - -static int prism2_debug_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, prism2_debug_proc_show, PDE_DATA(inode)); -} - -static const struct file_operations prism2_debug_proc_fops = { - .open = prism2_debug_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; -#endif /* PRISM2_NO_PROCFS_DEBUG */ - - -static int prism2_stats_proc_show(struct seq_file *m, void *v) -{ - local_info_t *local = m->private; - struct comm_tallies_sums *sums = &local->comm_tallies; - - seq_printf(m, "TxUnicastFrames=%u\n", sums->tx_unicast_frames); - seq_printf(m, "TxMulticastframes=%u\n", sums->tx_multicast_frames); - seq_printf(m, "TxFragments=%u\n", sums->tx_fragments); - seq_printf(m, "TxUnicastOctets=%u\n", sums->tx_unicast_octets); - seq_printf(m, "TxMulticastOctets=%u\n", sums->tx_multicast_octets); - seq_printf(m, "TxDeferredTransmissions=%u\n", - sums->tx_deferred_transmissions); - seq_printf(m, "TxSingleRetryFrames=%u\n", sums->tx_single_retry_frames); - seq_printf(m, "TxMultipleRetryFrames=%u\n", - sums->tx_multiple_retry_frames); - seq_printf(m, "TxRetryLimitExceeded=%u\n", - sums->tx_retry_limit_exceeded); - seq_printf(m, "TxDiscards=%u\n", sums->tx_discards); - seq_printf(m, "RxUnicastFrames=%u\n", sums->rx_unicast_frames); - seq_printf(m, "RxMulticastFrames=%u\n", sums->rx_multicast_frames); - seq_printf(m, "RxFragments=%u\n", sums->rx_fragments); - seq_printf(m, "RxUnicastOctets=%u\n", sums->rx_unicast_octets); - seq_printf(m, "RxMulticastOctets=%u\n", sums->rx_multicast_octets); - seq_printf(m, "RxFCSErrors=%u\n", sums->rx_fcs_errors); - seq_printf(m, "RxDiscardsNoBuffer=%u\n", sums->rx_discards_no_buffer); - seq_printf(m, "TxDiscardsWrongSA=%u\n", sums->tx_discards_wrong_sa); - seq_printf(m, "RxDiscardsWEPUndecryptable=%u\n", - sums->rx_discards_wep_undecryptable); - seq_printf(m, "RxMessageInMsgFragments=%u\n", - sums->rx_message_in_msg_fragments); - seq_printf(m, "RxMessageInBadMsgFragments=%u\n", - sums->rx_message_in_bad_msg_fragments); - /* FIX: this may grow too long for one page(?) */ - - return 0; -} - -static int prism2_stats_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, prism2_stats_proc_show, PDE_DATA(inode)); -} - -static const struct file_operations prism2_stats_proc_fops = { - .open = prism2_stats_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - - -static int prism2_wds_proc_show(struct seq_file *m, void *v) -{ - struct list_head *ptr = v; - struct hostap_interface *iface; - - iface = list_entry(ptr, struct hostap_interface, list); - if (iface->type == HOSTAP_INTERFACE_WDS) - seq_printf(m, "%s\t%pM\n", - iface->dev->name, iface->u.wds.remote_addr); - return 0; -} - -static void *prism2_wds_proc_start(struct seq_file *m, loff_t *_pos) -{ - local_info_t *local = m->private; - read_lock_bh(&local->iface_lock); - return seq_list_start(&local->hostap_interfaces, *_pos); -} - -static void *prism2_wds_proc_next(struct seq_file *m, void *v, loff_t *_pos) -{ - local_info_t *local = m->private; - return seq_list_next(v, &local->hostap_interfaces, _pos); -} - -static void prism2_wds_proc_stop(struct seq_file *m, void *v) -{ - local_info_t *local = m->private; - read_unlock_bh(&local->iface_lock); -} - -static const struct seq_operations prism2_wds_proc_seqops = { - .start = prism2_wds_proc_start, - .next = prism2_wds_proc_next, - .stop = prism2_wds_proc_stop, - .show = prism2_wds_proc_show, -}; - -static int prism2_wds_proc_open(struct inode *inode, struct file *file) -{ - int ret = seq_open(file, &prism2_wds_proc_seqops); - if (ret == 0) { - struct seq_file *m = file->private_data; - m->private = PDE_DATA(inode); - } - return ret; -} - -static const struct file_operations prism2_wds_proc_fops = { - .open = prism2_wds_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - - -static int prism2_bss_list_proc_show(struct seq_file *m, void *v) -{ - local_info_t *local = m->private; - struct list_head *ptr = v; - struct hostap_bss_info *bss; - int i; - - if (ptr == &local->bss_list) { - seq_printf(m, "#BSSID\tlast_update\tcount\tcapab_info\tSSID(txt)\t" - "SSID(hex)\tWPA IE\n"); - return 0; - } - - bss = list_entry(ptr, struct hostap_bss_info, list); - seq_printf(m, "%pM\t%lu\t%u\t0x%x\t", - bss->bssid, bss->last_update, - bss->count, bss->capab_info); - - for (i = 0; i < bss->ssid_len; i++) - seq_putc(m,bss->ssid[i] >= 32 && bss->ssid[i] < 127 ? - bss->ssid[i] : '_'); - - seq_putc(m, '\t'); - for (i = 0; i < bss->ssid_len; i++) - seq_printf(m, "%02x", bss->ssid[i]); - seq_putc(m, '\t'); - for (i = 0; i < bss->wpa_ie_len; i++) - seq_printf(m, "%02x", bss->wpa_ie[i]); - seq_putc(m, '\n'); - return 0; -} - -static void *prism2_bss_list_proc_start(struct seq_file *m, loff_t *_pos) -{ - local_info_t *local = m->private; - spin_lock_bh(&local->lock); - return seq_list_start_head(&local->bss_list, *_pos); -} - -static void *prism2_bss_list_proc_next(struct seq_file *m, void *v, loff_t *_pos) -{ - local_info_t *local = m->private; - return seq_list_next(v, &local->bss_list, _pos); -} - -static void prism2_bss_list_proc_stop(struct seq_file *m, void *v) -{ - local_info_t *local = m->private; - spin_unlock_bh(&local->lock); -} - -static const struct seq_operations prism2_bss_list_proc_seqops = { - .start = prism2_bss_list_proc_start, - .next = prism2_bss_list_proc_next, - .stop = prism2_bss_list_proc_stop, - .show = prism2_bss_list_proc_show, -}; - -static int prism2_bss_list_proc_open(struct inode *inode, struct file *file) -{ - int ret = seq_open(file, &prism2_bss_list_proc_seqops); - if (ret == 0) { - struct seq_file *m = file->private_data; - m->private = PDE_DATA(inode); - } - return ret; -} - -static const struct file_operations prism2_bss_list_proc_fops = { - .open = prism2_bss_list_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - - -static int prism2_crypt_proc_show(struct seq_file *m, void *v) -{ - local_info_t *local = m->private; - int i; - - seq_printf(m, "tx_keyidx=%d\n", local->crypt_info.tx_keyidx); - for (i = 0; i < WEP_KEYS; i++) { - if (local->crypt_info.crypt[i] && - local->crypt_info.crypt[i]->ops && - local->crypt_info.crypt[i]->ops->print_stats) { - local->crypt_info.crypt[i]->ops->print_stats( - m, local->crypt_info.crypt[i]->priv); - } - } - return 0; -} - -static int prism2_crypt_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, prism2_crypt_proc_show, PDE_DATA(inode)); -} - -static const struct file_operations prism2_crypt_proc_fops = { - .open = prism2_crypt_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - - -static ssize_t prism2_pda_proc_read(struct file *file, char __user *buf, - size_t count, loff_t *_pos) -{ - local_info_t *local = PDE_DATA(file_inode(file)); - size_t off; - - if (local->pda == NULL || *_pos >= PRISM2_PDA_SIZE) - return 0; - - off = *_pos; - if (count > PRISM2_PDA_SIZE - off) - count = PRISM2_PDA_SIZE - off; - if (copy_to_user(buf, local->pda + off, count) != 0) - return -EFAULT; - *_pos += count; - return count; -} - -static const struct file_operations prism2_pda_proc_fops = { - .read = prism2_pda_proc_read, - .llseek = generic_file_llseek, -}; - - -static ssize_t prism2_aux_dump_proc_no_read(struct file *file, char __user *buf, - size_t bufsize, loff_t *_pos) -{ - return 0; -} - -static const struct file_operations prism2_aux_dump_proc_fops = { - .read = prism2_aux_dump_proc_no_read, -}; - - -#ifdef PRISM2_IO_DEBUG -static int prism2_io_debug_proc_read(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - local_info_t *local = (local_info_t *) data; - int head = local->io_debug_head; - int start_bytes, left, copy, copied; - - if (off + count > PRISM2_IO_DEBUG_SIZE * 4) { - *eof = 1; - if (off >= PRISM2_IO_DEBUG_SIZE * 4) - return 0; - count = PRISM2_IO_DEBUG_SIZE * 4 - off; - } - - copied = 0; - start_bytes = (PRISM2_IO_DEBUG_SIZE - head) * 4; - left = count; - - if (off < start_bytes) { - copy = start_bytes - off; - if (copy > count) - copy = count; - memcpy(page, ((u8 *) &local->io_debug[head]) + off, copy); - left -= copy; - if (left > 0) - memcpy(&page[copy], local->io_debug, left); - } else { - memcpy(page, ((u8 *) local->io_debug) + (off - start_bytes), - left); - } - - *start = page; - - return count; -} -#endif /* PRISM2_IO_DEBUG */ - - -#ifndef PRISM2_NO_STATION_MODES -static int prism2_scan_results_proc_show(struct seq_file *m, void *v) -{ - local_info_t *local = m->private; - unsigned long entry; - int i, len; - struct hfa384x_hostscan_result *scanres; - u8 *p; - - if (v == SEQ_START_TOKEN) { - seq_printf(m, - "CHID ANL SL BcnInt Capab Rate BSSID ATIM SupRates SSID\n"); - return 0; - } - - entry = (unsigned long)v - 2; - scanres = &local->last_scan_results[entry]; - - seq_printf(m, "%d %d %d %d 0x%02x %d %pM %d ", - le16_to_cpu(scanres->chid), - (s16) le16_to_cpu(scanres->anl), - (s16) le16_to_cpu(scanres->sl), - le16_to_cpu(scanres->beacon_interval), - le16_to_cpu(scanres->capability), - le16_to_cpu(scanres->rate), - scanres->bssid, - le16_to_cpu(scanres->atim)); - - p = scanres->sup_rates; - for (i = 0; i < sizeof(scanres->sup_rates); i++) { - if (p[i] == 0) - break; - seq_printf(m, "<%02x>", p[i]); - } - seq_putc(m, ' '); - - p = scanres->ssid; - len = le16_to_cpu(scanres->ssid_len); - if (len > 32) - len = 32; - for (i = 0; i < len; i++) { - unsigned char c = p[i]; - if (c >= 32 && c < 127) - seq_putc(m, c); - else - seq_printf(m, "<%02x>", c); - } - seq_putc(m, '\n'); - return 0; -} - -static void *prism2_scan_results_proc_start(struct seq_file *m, loff_t *_pos) -{ - local_info_t *local = m->private; - spin_lock_bh(&local->lock); - - /* We have a header (pos 0) + N results to show (pos 1...N) */ - if (*_pos > local->last_scan_results_count) - return NULL; - return (void *)(unsigned long)(*_pos + 1); /* 0 would be EOF */ -} - -static void *prism2_scan_results_proc_next(struct seq_file *m, void *v, loff_t *_pos) -{ - local_info_t *local = m->private; - - ++*_pos; - if (*_pos > local->last_scan_results_count) - return NULL; - return (void *)(unsigned long)(*_pos + 1); /* 0 would be EOF */ -} - -static void prism2_scan_results_proc_stop(struct seq_file *m, void *v) -{ - local_info_t *local = m->private; - spin_unlock_bh(&local->lock); -} - -static const struct seq_operations prism2_scan_results_proc_seqops = { - .start = prism2_scan_results_proc_start, - .next = prism2_scan_results_proc_next, - .stop = prism2_scan_results_proc_stop, - .show = prism2_scan_results_proc_show, -}; - -static int prism2_scan_results_proc_open(struct inode *inode, struct file *file) -{ - int ret = seq_open(file, &prism2_scan_results_proc_seqops); - if (ret == 0) { - struct seq_file *m = file->private_data; - m->private = PDE_DATA(inode); - } - return ret; -} - -static const struct file_operations prism2_scan_results_proc_fops = { - .open = prism2_scan_results_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; - - -#endif /* PRISM2_NO_STATION_MODES */ - - -void hostap_init_proc(local_info_t *local) -{ - local->proc = NULL; - - if (hostap_proc == NULL) { - printk(KERN_WARNING "%s: hostap proc directory not created\n", - local->dev->name); - return; - } - - local->proc = proc_mkdir(local->ddev->name, hostap_proc); - if (local->proc == NULL) { - printk(KERN_INFO "/proc/net/hostap/%s creation failed\n", - local->ddev->name); - return; - } - -#ifndef PRISM2_NO_PROCFS_DEBUG - proc_create_data("debug", 0, local->proc, - &prism2_debug_proc_fops, local); -#endif /* PRISM2_NO_PROCFS_DEBUG */ - proc_create_data("stats", 0, local->proc, - &prism2_stats_proc_fops, local); - proc_create_data("wds", 0, local->proc, - &prism2_wds_proc_fops, local); - proc_create_data("pda", 0, local->proc, - &prism2_pda_proc_fops, local); - proc_create_data("aux_dump", 0, local->proc, - local->func->read_aux_fops ?: &prism2_aux_dump_proc_fops, - local); - proc_create_data("bss_list", 0, local->proc, - &prism2_bss_list_proc_fops, local); - proc_create_data("crypt", 0, local->proc, - &prism2_crypt_proc_fops, local); -#ifdef PRISM2_IO_DEBUG - proc_create_data("io_debug", 0, local->proc, - &prism2_io_debug_proc_fops, local); -#endif /* PRISM2_IO_DEBUG */ -#ifndef PRISM2_NO_STATION_MODES - proc_create_data("scan_results", 0, local->proc, - &prism2_scan_results_proc_fops, local); -#endif /* PRISM2_NO_STATION_MODES */ -} - - -void hostap_remove_proc(local_info_t *local) -{ - remove_proc_subtree(local->ddev->name, hostap_proc); -} - - -EXPORT_SYMBOL(hostap_init_proc); -EXPORT_SYMBOL(hostap_remove_proc); diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h deleted file mode 100644 index 57904015380f..000000000000 --- a/drivers/net/wireless/hostap/hostap_wlan.h +++ /dev/null @@ -1,1046 +0,0 @@ -#ifndef HOSTAP_WLAN_H -#define HOSTAP_WLAN_H - -#include -#include -#include -#include -#include -#include -#include - -#include "hostap_config.h" -#include "hostap_common.h" - -#define MAX_PARM_DEVICES 8 -#define PARM_MIN_MAX "1-" __MODULE_STRING(MAX_PARM_DEVICES) -#define DEF_INTS -1, -1, -1, -1, -1, -1, -1 -#define GET_INT_PARM(var,idx) var[var[idx] < 0 ? 0 : idx] - - -/* Specific skb->protocol value that indicates that the packet already contains - * txdesc header. - * FIX: This might need own value that would be allocated especially for Prism2 - * txdesc; ETH_P_CONTROL is commented as "Card specific control frames". - * However, these skb's should have only minimal path in the kernel side since - * prism2_send_mgmt() sends these with dev_queue_xmit() to prism2_tx(). */ -#define ETH_P_HOSTAP ETH_P_CONTROL - -/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header - * (from linux-wlan-ng) */ -struct linux_wlan_ng_val { - u32 did; - u16 status, len; - u32 data; -} __packed; - -struct linux_wlan_ng_prism_hdr { - u32 msgcode, msglen; - char devname[16]; - struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal, - noise, rate, istx, frmlen; -} __packed; - -struct linux_wlan_ng_cap_hdr { - __be32 version; - __be32 length; - __be64 mactime; - __be64 hosttime; - __be32 phytype; - __be32 channel; - __be32 datarate; - __be32 antenna; - __be32 priority; - __be32 ssi_type; - __be32 ssi_signal; - __be32 ssi_noise; - __be32 preamble; - __be32 encoding; -} __packed; - -struct hostap_radiotap_rx { - struct ieee80211_radiotap_header hdr; - __le64 tsft; - u8 rate; - u8 padding; - __le16 chan_freq; - __le16 chan_flags; - s8 dbm_antsignal; - s8 dbm_antnoise; -} __packed; - -#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */ -#define LWNG_CAPHDR_VERSION 0x80211001 - -struct hfa384x_rx_frame { - /* HFA384X RX frame descriptor */ - __le16 status; /* HFA384X_RX_STATUS_ flags */ - __le32 time; /* timestamp, 1 microsecond resolution */ - u8 silence; /* 27 .. 154; seems to be 0 */ - u8 signal; /* 27 .. 154 */ - u8 rate; /* 10, 20, 55, or 110 */ - u8 rxflow; - __le32 reserved; - - /* 802.11 */ - __le16 frame_control; - __le16 duration_id; - u8 addr1[6]; - u8 addr2[6]; - u8 addr3[6]; - __le16 seq_ctrl; - u8 addr4[6]; - __le16 data_len; - - /* 802.3 */ - u8 dst_addr[6]; - u8 src_addr[6]; - __be16 len; - - /* followed by frame data; max 2304 bytes */ -} __packed; - - -struct hfa384x_tx_frame { - /* HFA384X TX frame descriptor */ - __le16 status; /* HFA384X_TX_STATUS_ flags */ - __le16 reserved1; - __le16 reserved2; - __le32 sw_support; - u8 retry_count; /* not yet implemented */ - u8 tx_rate; /* Host AP only; 0 = firmware, or 10, 20, 55, 110 */ - __le16 tx_control; /* HFA384X_TX_CTRL_ flags */ - - /* 802.11 */ - __le16 frame_control; /* parts not used */ - __le16 duration_id; - u8 addr1[6]; - u8 addr2[6]; /* filled by firmware */ - u8 addr3[6]; - __le16 seq_ctrl; /* filled by firmware */ - u8 addr4[6]; - __le16 data_len; - - /* 802.3 */ - u8 dst_addr[6]; - u8 src_addr[6]; - __be16 len; - - /* followed by frame data; max 2304 bytes */ -} __packed; - - -struct hfa384x_rid_hdr -{ - __le16 len; - __le16 rid; -} __packed; - - -/* Macro for converting signal levels (range 27 .. 154) to wireless ext - * dBm value with some accuracy */ -#define HFA384X_LEVEL_TO_dBm(v) 0x100 + (v) * 100 / 255 - 100 - -#define HFA384X_LEVEL_TO_dBm_sign(v) (v) * 100 / 255 - 100 - -struct hfa384x_scan_request { - __le16 channel_list; - __le16 txrate; /* HFA384X_RATES_* */ -} __packed; - -struct hfa384x_hostscan_request { - __le16 channel_list; - __le16 txrate; - __le16 target_ssid_len; - u8 target_ssid[32]; -} __packed; - -struct hfa384x_join_request { - u8 bssid[6]; - __le16 channel; -} __packed; - -struct hfa384x_info_frame { - __le16 len; - __le16 type; -} __packed; - -struct hfa384x_comm_tallies { - __le16 tx_unicast_frames; - __le16 tx_multicast_frames; - __le16 tx_fragments; - __le16 tx_unicast_octets; - __le16 tx_multicast_octets; - __le16 tx_deferred_transmissions; - __le16 tx_single_retry_frames; - __le16 tx_multiple_retry_frames; - __le16 tx_retry_limit_exceeded; - __le16 tx_discards; - __le16 rx_unicast_frames; - __le16 rx_multicast_frames; - __le16 rx_fragments; - __le16 rx_unicast_octets; - __le16 rx_multicast_octets; - __le16 rx_fcs_errors; - __le16 rx_discards_no_buffer; - __le16 tx_discards_wrong_sa; - __le16 rx_discards_wep_undecryptable; - __le16 rx_message_in_msg_fragments; - __le16 rx_message_in_bad_msg_fragments; -} __packed; - -struct hfa384x_comm_tallies32 { - __le32 tx_unicast_frames; - __le32 tx_multicast_frames; - __le32 tx_fragments; - __le32 tx_unicast_octets; - __le32 tx_multicast_octets; - __le32 tx_deferred_transmissions; - __le32 tx_single_retry_frames; - __le32 tx_multiple_retry_frames; - __le32 tx_retry_limit_exceeded; - __le32 tx_discards; - __le32 rx_unicast_frames; - __le32 rx_multicast_frames; - __le32 rx_fragments; - __le32 rx_unicast_octets; - __le32 rx_multicast_octets; - __le32 rx_fcs_errors; - __le32 rx_discards_no_buffer; - __le32 tx_discards_wrong_sa; - __le32 rx_discards_wep_undecryptable; - __le32 rx_message_in_msg_fragments; - __le32 rx_message_in_bad_msg_fragments; -} __packed; - -struct hfa384x_scan_result_hdr { - __le16 reserved; - __le16 scan_reason; -#define HFA384X_SCAN_IN_PROGRESS 0 /* no results available yet */ -#define HFA384X_SCAN_HOST_INITIATED 1 -#define HFA384X_SCAN_FIRMWARE_INITIATED 2 -#define HFA384X_SCAN_INQUIRY_FROM_HOST 3 -} __packed; - -#define HFA384X_SCAN_MAX_RESULTS 32 - -struct hfa384x_scan_result { - __le16 chid; - __le16 anl; - __le16 sl; - u8 bssid[6]; - __le16 beacon_interval; - __le16 capability; - __le16 ssid_len; - u8 ssid[32]; - u8 sup_rates[10]; - __le16 rate; -} __packed; - -struct hfa384x_hostscan_result { - __le16 chid; - __le16 anl; - __le16 sl; - u8 bssid[6]; - __le16 beacon_interval; - __le16 capability; - __le16 ssid_len; - u8 ssid[32]; - u8 sup_rates[10]; - __le16 rate; - __le16 atim; -} __packed; - -struct comm_tallies_sums { - unsigned int tx_unicast_frames; - unsigned int tx_multicast_frames; - unsigned int tx_fragments; - unsigned int tx_unicast_octets; - unsigned int tx_multicast_octets; - unsigned int tx_deferred_transmissions; - unsigned int tx_single_retry_frames; - unsigned int tx_multiple_retry_frames; - unsigned int tx_retry_limit_exceeded; - unsigned int tx_discards; - unsigned int rx_unicast_frames; - unsigned int rx_multicast_frames; - unsigned int rx_fragments; - unsigned int rx_unicast_octets; - unsigned int rx_multicast_octets; - unsigned int rx_fcs_errors; - unsigned int rx_discards_no_buffer; - unsigned int tx_discards_wrong_sa; - unsigned int rx_discards_wep_undecryptable; - unsigned int rx_message_in_msg_fragments; - unsigned int rx_message_in_bad_msg_fragments; -}; - - -struct hfa384x_regs { - u16 cmd; - u16 evstat; - u16 offset0; - u16 offset1; - u16 swsupport0; -}; - - -#if defined(PRISM2_PCCARD) || defined(PRISM2_PLX) -/* I/O ports for HFA384X Controller access */ -#define HFA384X_CMD_OFF 0x00 -#define HFA384X_PARAM0_OFF 0x02 -#define HFA384X_PARAM1_OFF 0x04 -#define HFA384X_PARAM2_OFF 0x06 -#define HFA384X_STATUS_OFF 0x08 -#define HFA384X_RESP0_OFF 0x0A -#define HFA384X_RESP1_OFF 0x0C -#define HFA384X_RESP2_OFF 0x0E -#define HFA384X_INFOFID_OFF 0x10 -#define HFA384X_CONTROL_OFF 0x14 -#define HFA384X_SELECT0_OFF 0x18 -#define HFA384X_SELECT1_OFF 0x1A -#define HFA384X_OFFSET0_OFF 0x1C -#define HFA384X_OFFSET1_OFF 0x1E -#define HFA384X_RXFID_OFF 0x20 -#define HFA384X_ALLOCFID_OFF 0x22 -#define HFA384X_TXCOMPLFID_OFF 0x24 -#define HFA384X_SWSUPPORT0_OFF 0x28 -#define HFA384X_SWSUPPORT1_OFF 0x2A -#define HFA384X_SWSUPPORT2_OFF 0x2C -#define HFA384X_EVSTAT_OFF 0x30 -#define HFA384X_INTEN_OFF 0x32 -#define HFA384X_EVACK_OFF 0x34 -#define HFA384X_DATA0_OFF 0x36 -#define HFA384X_DATA1_OFF 0x38 -#define HFA384X_AUXPAGE_OFF 0x3A -#define HFA384X_AUXOFFSET_OFF 0x3C -#define HFA384X_AUXDATA_OFF 0x3E -#endif /* PRISM2_PCCARD || PRISM2_PLX */ - -#ifdef PRISM2_PCI -/* Memory addresses for ISL3874 controller access */ -#define HFA384X_CMD_OFF 0x00 -#define HFA384X_PARAM0_OFF 0x04 -#define HFA384X_PARAM1_OFF 0x08 -#define HFA384X_PARAM2_OFF 0x0C -#define HFA384X_STATUS_OFF 0x10 -#define HFA384X_RESP0_OFF 0x14 -#define HFA384X_RESP1_OFF 0x18 -#define HFA384X_RESP2_OFF 0x1C -#define HFA384X_INFOFID_OFF 0x20 -#define HFA384X_CONTROL_OFF 0x28 -#define HFA384X_SELECT0_OFF 0x30 -#define HFA384X_SELECT1_OFF 0x34 -#define HFA384X_OFFSET0_OFF 0x38 -#define HFA384X_OFFSET1_OFF 0x3C -#define HFA384X_RXFID_OFF 0x40 -#define HFA384X_ALLOCFID_OFF 0x44 -#define HFA384X_TXCOMPLFID_OFF 0x48 -#define HFA384X_PCICOR_OFF 0x4C -#define HFA384X_SWSUPPORT0_OFF 0x50 -#define HFA384X_SWSUPPORT1_OFF 0x54 -#define HFA384X_SWSUPPORT2_OFF 0x58 -#define HFA384X_PCIHCR_OFF 0x5C -#define HFA384X_EVSTAT_OFF 0x60 -#define HFA384X_INTEN_OFF 0x64 -#define HFA384X_EVACK_OFF 0x68 -#define HFA384X_DATA0_OFF 0x6C -#define HFA384X_DATA1_OFF 0x70 -#define HFA384X_AUXPAGE_OFF 0x74 -#define HFA384X_AUXOFFSET_OFF 0x78 -#define HFA384X_AUXDATA_OFF 0x7C -#define HFA384X_PCI_M0_ADDRH_OFF 0x80 -#define HFA384X_PCI_M0_ADDRL_OFF 0x84 -#define HFA384X_PCI_M0_LEN_OFF 0x88 -#define HFA384X_PCI_M0_CTL_OFF 0x8C -#define HFA384X_PCI_STATUS_OFF 0x98 -#define HFA384X_PCI_M1_ADDRH_OFF 0xA0 -#define HFA384X_PCI_M1_ADDRL_OFF 0xA4 -#define HFA384X_PCI_M1_LEN_OFF 0xA8 -#define HFA384X_PCI_M1_CTL_OFF 0xAC - -/* PCI bus master control bits (these are undocumented; based on guessing and - * experimenting..) */ -#define HFA384X_PCI_CTL_FROM_BAP (BIT(5) | BIT(1) | BIT(0)) -#define HFA384X_PCI_CTL_TO_BAP (BIT(5) | BIT(0)) - -#endif /* PRISM2_PCI */ - - -/* Command codes for CMD reg. */ -#define HFA384X_CMDCODE_INIT 0x00 -#define HFA384X_CMDCODE_ENABLE 0x01 -#define HFA384X_CMDCODE_DISABLE 0x02 -#define HFA384X_CMDCODE_ALLOC 0x0A -#define HFA384X_CMDCODE_TRANSMIT 0x0B -#define HFA384X_CMDCODE_INQUIRE 0x11 -#define HFA384X_CMDCODE_ACCESS 0x21 -#define HFA384X_CMDCODE_ACCESS_WRITE (0x21 | BIT(8)) -#define HFA384X_CMDCODE_DOWNLOAD 0x22 -#define HFA384X_CMDCODE_READMIF 0x30 -#define HFA384X_CMDCODE_WRITEMIF 0x31 -#define HFA384X_CMDCODE_TEST 0x38 - -#define HFA384X_CMDCODE_MASK 0x3F - -/* Test mode operations */ -#define HFA384X_TEST_CHANGE_CHANNEL 0x08 -#define HFA384X_TEST_MONITOR 0x0B -#define HFA384X_TEST_STOP 0x0F -#define HFA384X_TEST_CFG_BITS 0x15 -#define HFA384X_TEST_CFG_BIT_ALC BIT(3) - -#define HFA384X_CMD_BUSY BIT(15) - -#define HFA384X_CMD_TX_RECLAIM BIT(8) - -#define HFA384X_OFFSET_ERR BIT(14) -#define HFA384X_OFFSET_BUSY BIT(15) - - -/* ProgMode for download command */ -#define HFA384X_PROGMODE_DISABLE 0 -#define HFA384X_PROGMODE_ENABLE_VOLATILE 1 -#define HFA384X_PROGMODE_ENABLE_NON_VOLATILE 2 -#define HFA384X_PROGMODE_PROGRAM_NON_VOLATILE 3 - -#define HFA384X_AUX_MAGIC0 0xfe01 -#define HFA384X_AUX_MAGIC1 0xdc23 -#define HFA384X_AUX_MAGIC2 0xba45 - -#define HFA384X_AUX_PORT_DISABLED 0 -#define HFA384X_AUX_PORT_DISABLE BIT(14) -#define HFA384X_AUX_PORT_ENABLE BIT(15) -#define HFA384X_AUX_PORT_ENABLED (BIT(14) | BIT(15)) -#define HFA384X_AUX_PORT_MASK (BIT(14) | BIT(15)) - -#define PRISM2_PDA_SIZE 1024 - - -/* Events; EvStat, Interrupt mask (IntEn), and acknowledge bits (EvAck) */ -#define HFA384X_EV_TICK BIT(15) -#define HFA384X_EV_WTERR BIT(14) -#define HFA384X_EV_INFDROP BIT(13) -#ifdef PRISM2_PCI -#define HFA384X_EV_PCI_M1 BIT(9) -#define HFA384X_EV_PCI_M0 BIT(8) -#endif /* PRISM2_PCI */ -#define HFA384X_EV_INFO BIT(7) -#define HFA384X_EV_DTIM BIT(5) -#define HFA384X_EV_CMD BIT(4) -#define HFA384X_EV_ALLOC BIT(3) -#define HFA384X_EV_TXEXC BIT(2) -#define HFA384X_EV_TX BIT(1) -#define HFA384X_EV_RX BIT(0) - - -/* HFA384X Information frames */ -#define HFA384X_INFO_HANDOVERADDR 0xF000 /* AP f/w ? */ -#define HFA384X_INFO_HANDOVERDEAUTHADDR 0xF001 /* AP f/w 1.3.7 */ -#define HFA384X_INFO_COMMTALLIES 0xF100 -#define HFA384X_INFO_SCANRESULTS 0xF101 -#define HFA384X_INFO_CHANNELINFORESULTS 0xF102 /* AP f/w only */ -#define HFA384X_INFO_HOSTSCANRESULTS 0xF103 -#define HFA384X_INFO_LINKSTATUS 0xF200 -#define HFA384X_INFO_ASSOCSTATUS 0xF201 /* ? */ -#define HFA384X_INFO_AUTHREQ 0xF202 /* ? */ -#define HFA384X_INFO_PSUSERCNT 0xF203 /* ? */ -#define HFA384X_INFO_KEYIDCHANGED 0xF204 /* ? */ - -enum { HFA384X_LINKSTATUS_CONNECTED = 1, - HFA384X_LINKSTATUS_DISCONNECTED = 2, - HFA384X_LINKSTATUS_AP_CHANGE = 3, - HFA384X_LINKSTATUS_AP_OUT_OF_RANGE = 4, - HFA384X_LINKSTATUS_AP_IN_RANGE = 5, - HFA384X_LINKSTATUS_ASSOC_FAILED = 6 }; - -enum { HFA384X_PORTTYPE_BSS = 1, HFA384X_PORTTYPE_WDS = 2, - HFA384X_PORTTYPE_PSEUDO_IBSS = 3, HFA384X_PORTTYPE_IBSS = 0, - HFA384X_PORTTYPE_HOSTAP = 6 }; - -#define HFA384X_RATES_1MBPS BIT(0) -#define HFA384X_RATES_2MBPS BIT(1) -#define HFA384X_RATES_5MBPS BIT(2) -#define HFA384X_RATES_11MBPS BIT(3) - -#define HFA384X_ROAMING_FIRMWARE 1 -#define HFA384X_ROAMING_HOST 2 -#define HFA384X_ROAMING_DISABLED 3 - -#define HFA384X_WEPFLAGS_PRIVACYINVOKED BIT(0) -#define HFA384X_WEPFLAGS_EXCLUDEUNENCRYPTED BIT(1) -#define HFA384X_WEPFLAGS_HOSTENCRYPT BIT(4) -#define HFA384X_WEPFLAGS_HOSTDECRYPT BIT(7) - -#define HFA384X_RX_STATUS_MSGTYPE (BIT(15) | BIT(14) | BIT(13)) -#define HFA384X_RX_STATUS_PCF BIT(12) -#define HFA384X_RX_STATUS_MACPORT (BIT(10) | BIT(9) | BIT(8)) -#define HFA384X_RX_STATUS_UNDECR BIT(1) -#define HFA384X_RX_STATUS_FCSERR BIT(0) - -#define HFA384X_RX_STATUS_GET_MSGTYPE(s) \ -(((s) & HFA384X_RX_STATUS_MSGTYPE) >> 13) -#define HFA384X_RX_STATUS_GET_MACPORT(s) \ -(((s) & HFA384X_RX_STATUS_MACPORT) >> 8) - -enum { HFA384X_RX_MSGTYPE_NORMAL = 0, HFA384X_RX_MSGTYPE_RFC1042 = 1, - HFA384X_RX_MSGTYPE_BRIDGETUNNEL = 2, HFA384X_RX_MSGTYPE_MGMT = 4 }; - - -#define HFA384X_TX_CTRL_ALT_RTRY BIT(5) -#define HFA384X_TX_CTRL_802_11 BIT(3) -#define HFA384X_TX_CTRL_802_3 0 -#define HFA384X_TX_CTRL_TX_EX BIT(2) -#define HFA384X_TX_CTRL_TX_OK BIT(1) - -#define HFA384X_TX_STATUS_RETRYERR BIT(0) -#define HFA384X_TX_STATUS_AGEDERR BIT(1) -#define HFA384X_TX_STATUS_DISCON BIT(2) -#define HFA384X_TX_STATUS_FORMERR BIT(3) - -/* HFA3861/3863 (BBP) Control Registers */ -#define HFA386X_CR_TX_CONFIGURE 0x12 /* CR9 */ -#define HFA386X_CR_RX_CONFIGURE 0x14 /* CR10 */ -#define HFA386X_CR_A_D_TEST_MODES2 0x1A /* CR13 */ -#define HFA386X_CR_MANUAL_TX_POWER 0x3E /* CR31 */ -#define HFA386X_CR_MEASURED_TX_POWER 0x74 /* CR58 */ - - -#ifdef __KERNEL__ - -#define PRISM2_TXFID_COUNT 8 -#define PRISM2_DATA_MAXLEN 2304 -#define PRISM2_TXFID_LEN (PRISM2_DATA_MAXLEN + sizeof(struct hfa384x_tx_frame)) -#define PRISM2_TXFID_EMPTY 0xffff -#define PRISM2_TXFID_RESERVED 0xfffe -#define PRISM2_DUMMY_FID 0xffff -#define MAX_SSID_LEN 32 -#define MAX_NAME_LEN 32 /* this is assumed to be equal to MAX_SSID_LEN */ - -#define PRISM2_DUMP_RX_HDR BIT(0) -#define PRISM2_DUMP_TX_HDR BIT(1) -#define PRISM2_DUMP_TXEXC_HDR BIT(2) - -struct hostap_tx_callback_info { - u16 idx; - void (*func)(struct sk_buff *, int ok, void *); - void *data; - struct hostap_tx_callback_info *next; -}; - - -/* IEEE 802.11 requires that STA supports concurrent reception of at least - * three fragmented frames. This define can be increased to support more - * concurrent frames, but it should be noted that each entry can consume about - * 2 kB of RAM and increasing cache size will slow down frame reassembly. */ -#define PRISM2_FRAG_CACHE_LEN 4 - -struct prism2_frag_entry { - unsigned long first_frag_time; - unsigned int seq; - unsigned int last_frag; - struct sk_buff *skb; - u8 src_addr[ETH_ALEN]; - u8 dst_addr[ETH_ALEN]; -}; - - -struct hostap_cmd_queue { - struct list_head list; - wait_queue_head_t compl; - volatile enum { CMD_SLEEP, CMD_CALLBACK, CMD_COMPLETED } type; - void (*callback)(struct net_device *dev, long context, u16 resp0, - u16 res); - long context; - u16 cmd, param0, param1; - u16 resp0, res; - volatile int issued, issuing; - - atomic_t usecnt; - int del_req; -}; - -/* options for hw_shutdown */ -#define HOSTAP_HW_NO_DISABLE BIT(0) -#define HOSTAP_HW_ENABLE_CMDCOMPL BIT(1) - -typedef struct local_info local_info_t; - -struct prism2_helper_functions { - /* these functions are defined in hardware model specific files - * (hostap_{cs,plx,pci}.c */ - int (*card_present)(local_info_t *local); - void (*cor_sreset)(local_info_t *local); - void (*genesis_reset)(local_info_t *local, int hcr); - - /* the following functions are from hostap_hw.c, but they may have some - * hardware model specific code */ - - /* FIX: low-level commands like cmd might disappear at some point to - * make it easier to change them if needed (e.g., cmd would be replaced - * with write_mif/read_mif/testcmd/inquire); at least get_rid and - * set_rid might move to hostap_{cs,plx,pci}.c */ - int (*cmd)(struct net_device *dev, u16 cmd, u16 param0, u16 *param1, - u16 *resp0); - void (*read_regs)(struct net_device *dev, struct hfa384x_regs *regs); - int (*get_rid)(struct net_device *dev, u16 rid, void *buf, int len, - int exact_len); - int (*set_rid)(struct net_device *dev, u16 rid, void *buf, int len); - int (*hw_enable)(struct net_device *dev, int initial); - int (*hw_config)(struct net_device *dev, int initial); - void (*hw_reset)(struct net_device *dev); - void (*hw_shutdown)(struct net_device *dev, int no_disable); - int (*reset_port)(struct net_device *dev); - void (*schedule_reset)(local_info_t *local); - int (*download)(local_info_t *local, - struct prism2_download_param *param); - int (*tx)(struct sk_buff *skb, struct net_device *dev); - int (*set_tim)(struct net_device *dev, int aid, int set); - const struct file_operations *read_aux_fops; - - int need_tx_headroom; /* number of bytes of headroom needed before - * IEEE 802.11 header */ - enum { HOSTAP_HW_PCCARD, HOSTAP_HW_PLX, HOSTAP_HW_PCI } hw_type; -}; - - -struct prism2_download_data { - u32 dl_cmd; - u32 start_addr; - u32 num_areas; - struct prism2_download_data_area { - u32 addr; /* wlan card address */ - u32 len; - u8 *data; /* allocated data */ - } data[0]; -}; - - -#define HOSTAP_MAX_BSS_COUNT 64 -#define MAX_WPA_IE_LEN 64 - -struct hostap_bss_info { - struct list_head list; - unsigned long last_update; - unsigned int count; - u8 bssid[ETH_ALEN]; - u16 capab_info; - u8 ssid[32]; - size_t ssid_len; - u8 wpa_ie[MAX_WPA_IE_LEN]; - size_t wpa_ie_len; - u8 rsn_ie[MAX_WPA_IE_LEN]; - size_t rsn_ie_len; - int chan; - int included; -}; - - -/* Per radio private Host AP data - shared by all net devices interfaces used - * by each radio (wlan#, wlan#ap, wlan#sta, WDS). - * ((struct hostap_interface *) netdev_priv(dev))->local points to this - * structure. */ -struct local_info { - struct module *hw_module; - int card_idx; - int dev_enabled; - int master_dev_auto_open; /* was master device opened automatically */ - int num_dev_open; /* number of open devices */ - struct net_device *dev; /* master radio device */ - struct net_device *ddev; /* main data device */ - struct list_head hostap_interfaces; /* Host AP interface list (contains - * struct hostap_interface entries) - */ - rwlock_t iface_lock; /* hostap_interfaces read lock; use write lock - * when removing entries from the list. - * TX and RX paths can use read lock. */ - spinlock_t cmdlock, baplock, lock, irq_init_lock; - struct mutex rid_bap_mtx; - u16 infofid; /* MAC buffer id for info frame */ - /* txfid, intransmitfid, next_txtid, and next_alloc are protected by - * txfidlock */ - spinlock_t txfidlock; - int txfid_len; /* length of allocated TX buffers */ - u16 txfid[PRISM2_TXFID_COUNT]; /* buffer IDs for TX frames */ - /* buffer IDs for intransmit frames or PRISM2_TXFID_EMPTY if - * corresponding txfid is free for next TX frame */ - u16 intransmitfid[PRISM2_TXFID_COUNT]; - int next_txfid; /* index to the next txfid to be checked for - * availability */ - int next_alloc; /* index to the next intransmitfid to be checked for - * allocation events */ - - /* bitfield for atomic bitops */ -#define HOSTAP_BITS_TRANSMIT 0 -#define HOSTAP_BITS_BAP_TASKLET 1 -#define HOSTAP_BITS_BAP_TASKLET2 2 - unsigned long bits; - - struct ap_data *ap; - - char essid[MAX_SSID_LEN + 1]; - char name[MAX_NAME_LEN + 1]; - int name_set; - u16 channel_mask; /* mask of allowed channels */ - u16 scan_channel_mask; /* mask of channels to be scanned */ - struct comm_tallies_sums comm_tallies; - struct proc_dir_entry *proc; - int iw_mode; /* operating mode (IW_MODE_*) */ - int pseudo_adhoc; /* 0: IW_MODE_ADHOC is real 802.11 compliant IBSS - * 1: IW_MODE_ADHOC is "pseudo IBSS" */ - char bssid[ETH_ALEN]; - int channel; - int beacon_int; - int dtim_period; - int mtu; - int frame_dump; /* dump RX/TX frame headers, PRISM2_DUMP_ flags */ - int fw_tx_rate_control; - u16 tx_rate_control; - u16 basic_rates; - int hw_resetting; - int hw_ready; - int hw_reset_tries; /* how many times reset has been tried */ - int hw_downloading; - int shutdown; - int pri_only; - int no_pri; /* no PRI f/w present */ - int sram_type; /* 8 = x8 SRAM, 16 = x16 SRAM, -1 = unknown */ - - enum { - PRISM2_TXPOWER_AUTO = 0, PRISM2_TXPOWER_OFF, - PRISM2_TXPOWER_FIXED, PRISM2_TXPOWER_UNKNOWN - } txpower_type; - int txpower; /* if txpower_type == PRISM2_TXPOWER_FIXED */ - - /* command queue for hfa384x_cmd(); protected with cmdlock */ - struct list_head cmd_queue; - /* max_len for cmd_queue; in addition, cmd_callback can use two - * additional entries to prevent sleeping commands from stopping - * transmits */ -#define HOSTAP_CMD_QUEUE_MAX_LEN 16 - int cmd_queue_len; /* number of entries in cmd_queue */ - - /* if card timeout is detected in interrupt context, reset_queue is - * used to schedule card reseting to be done in user context */ - struct work_struct reset_queue; - - /* For scheduling a change of the promiscuous mode RID */ - int is_promisc; - struct work_struct set_multicast_list_queue; - - struct work_struct set_tim_queue; - struct list_head set_tim_list; - spinlock_t set_tim_lock; - - int wds_max_connections; - int wds_connections; -#define HOSTAP_WDS_BROADCAST_RA BIT(0) -#define HOSTAP_WDS_AP_CLIENT BIT(1) -#define HOSTAP_WDS_STANDARD_FRAME BIT(2) - u32 wds_type; - u16 tx_control; /* flags to be used in TX description */ - int manual_retry_count; /* -1 = use f/w default; otherwise retry count - * to be used with all frames */ - - struct iw_statistics wstats; - unsigned long scan_timestamp; /* Time started to scan */ - enum { - PRISM2_MONITOR_80211 = 0, PRISM2_MONITOR_PRISM = 1, - PRISM2_MONITOR_CAPHDR = 2, PRISM2_MONITOR_RADIOTAP = 3 - } monitor_type; - int monitor_allow_fcserr; - - int hostapd; /* whether user space daemon, hostapd, is used for AP - * management */ - int hostapd_sta; /* whether hostapd is used with an extra STA interface - */ - struct net_device *apdev; - struct net_device_stats apdevstats; - - char assoc_ap_addr[ETH_ALEN]; - struct net_device *stadev; - struct net_device_stats stadevstats; - -#define WEP_KEYS 4 -#define WEP_KEY_LEN 13 - struct lib80211_crypt_info crypt_info; - - int open_wep; /* allow unencrypted frames */ - int host_encrypt; - int host_decrypt; - int privacy_invoked; /* force privacy invoked flag even if no keys are - * configured */ - int fw_encrypt_ok; /* whether firmware-based WEP encrypt is working - * in Host AP mode (STA f/w 1.4.9 or newer) */ - int bcrx_sta_key; /* use individual keys to override default keys even - * with RX of broad/multicast frames */ - - struct prism2_frag_entry frag_cache[PRISM2_FRAG_CACHE_LEN]; - unsigned int frag_next_idx; - - int ieee_802_1x; /* is IEEE 802.1X used */ - - int antsel_tx, antsel_rx; - int rts_threshold; /* dot11RTSThreshold */ - int fragm_threshold; /* dot11FragmentationThreshold */ - int auth_algs; /* PRISM2_AUTH_ flags */ - - int enh_sec; /* cnfEnhSecurity options (broadcast SSID hide/ignore) */ - int tallies32; /* 32-bit tallies in use */ - - struct prism2_helper_functions *func; - - u8 *pda; - int fw_ap; -#define PRISM2_FW_VER(major, minor, variant) \ -(((major) << 16) | ((minor) << 8) | variant) - u32 sta_fw_ver; - - /* Tasklets for handling hardware IRQ related operations outside hw IRQ - * handler */ - struct tasklet_struct bap_tasklet; - - struct tasklet_struct info_tasklet; - struct sk_buff_head info_list; /* info frames as skb's for - * info_tasklet */ - - struct hostap_tx_callback_info *tx_callback; /* registered TX callbacks - */ - - struct tasklet_struct rx_tasklet; - struct sk_buff_head rx_list; - - struct tasklet_struct sta_tx_exc_tasklet; - struct sk_buff_head sta_tx_exc_list; - - int host_roaming; - unsigned long last_join_time; /* time of last JoinRequest */ - struct hfa384x_hostscan_result *last_scan_results; - int last_scan_results_count; - enum { PRISM2_SCAN, PRISM2_HOSTSCAN } last_scan_type; - struct work_struct info_queue; - unsigned long pending_info; /* bit field of pending info_queue items */ -#define PRISM2_INFO_PENDING_LINKSTATUS 0 -#define PRISM2_INFO_PENDING_SCANRESULTS 1 - int prev_link_status; /* previous received LinkStatus info */ - int prev_linkstatus_connected; - u8 preferred_ap[6]; /* use this AP if possible */ - -#ifdef PRISM2_CALLBACK - void *callback_data; /* Can be used in callbacks; e.g., allocate - * on enable event and free on disable event. - * Host AP driver code does not touch this. */ -#endif /* PRISM2_CALLBACK */ - - wait_queue_head_t hostscan_wq; - - /* Passive scan in Host AP mode */ - struct timer_list passive_scan_timer; - int passive_scan_interval; /* in seconds, 0 = disabled */ - int passive_scan_channel; - enum { PASSIVE_SCAN_WAIT, PASSIVE_SCAN_LISTEN } passive_scan_state; - - struct timer_list tick_timer; - unsigned long last_tick_timer; - unsigned int sw_tick_stuck; - - /* commsQuality / dBmCommsQuality data from periodic polling; only - * valid for Managed and Ad-hoc modes */ - unsigned long last_comms_qual_update; - int comms_qual; /* in some odd unit.. */ - int avg_signal; /* in dB (note: negative) */ - int avg_noise; /* in dB (note: negative) */ - struct work_struct comms_qual_update; - - /* RSSI to dBm adjustment (for RX descriptor fields) */ - int rssi_to_dBm; /* subtract from RSSI to get approximate dBm value */ - - /* BSS list / protected by local->lock */ - struct list_head bss_list; - int num_bss_info; - int wpa; /* WPA support enabled */ - int tkip_countermeasures; - int drop_unencrypted; - /* Generic IEEE 802.11 info element to be added to - * ProbeResp/Beacon/(Re)AssocReq */ - u8 *generic_elem; - size_t generic_elem_len; - -#ifdef PRISM2_DOWNLOAD_SUPPORT - /* Persistent volatile download data */ - struct prism2_download_data *dl_pri; - struct prism2_download_data *dl_sec; -#endif /* PRISM2_DOWNLOAD_SUPPORT */ - -#ifdef PRISM2_IO_DEBUG -#define PRISM2_IO_DEBUG_SIZE 10000 - u32 io_debug[PRISM2_IO_DEBUG_SIZE]; - int io_debug_head; - int io_debug_enabled; -#endif /* PRISM2_IO_DEBUG */ - - /* Pointer to hardware model specific (cs,pci,plx) private data. */ - void *hw_priv; -}; - - -/* Per interface private Host AP data - * Allocated for each net device that Host AP uses (wlan#, wlan#ap, wlan#sta, - * WDS) and netdev_priv(dev) points to this structure. */ -struct hostap_interface { - struct list_head list; /* list entry in Host AP interface list */ - struct net_device *dev; /* pointer to this device */ - struct local_info *local; /* pointer to shared private data */ - struct net_device_stats stats; - struct iw_spy_data spy_data; /* iwspy support */ - struct iw_public_data wireless_data; - - enum { - HOSTAP_INTERFACE_MASTER, - HOSTAP_INTERFACE_MAIN, - HOSTAP_INTERFACE_AP, - HOSTAP_INTERFACE_STA, - HOSTAP_INTERFACE_WDS, - } type; - - union { - struct hostap_interface_wds { - u8 remote_addr[ETH_ALEN]; - } wds; - } u; -}; - - -#define HOSTAP_SKB_TX_DATA_MAGIC 0xf08a36a2 - -/* - * TX meta data - stored in skb->cb buffer, so this must not be increased over - * the 48-byte limit. - * THE PADDING THIS STARTS WITH IS A HORRIBLE HACK THAT SHOULD NOT LIVE - * TO SEE THE DAY. - */ -struct hostap_skb_tx_data { - unsigned int __padding_for_default_qdiscs; - u32 magic; /* HOSTAP_SKB_TX_DATA_MAGIC */ - u8 rate; /* transmit rate */ -#define HOSTAP_TX_FLAGS_WDS BIT(0) -#define HOSTAP_TX_FLAGS_BUFFERED_FRAME BIT(1) -#define HOSTAP_TX_FLAGS_ADD_MOREDATA BIT(2) - u8 flags; /* HOSTAP_TX_FLAGS_* */ - u16 tx_cb_idx; - struct hostap_interface *iface; - unsigned long jiffies; /* queueing timestamp */ - unsigned short ethertype; -}; - - -#ifndef PRISM2_NO_DEBUG - -#define DEBUG_FID BIT(0) -#define DEBUG_PS BIT(1) -#define DEBUG_FLOW BIT(2) -#define DEBUG_AP BIT(3) -#define DEBUG_HW BIT(4) -#define DEBUG_EXTRA BIT(5) -#define DEBUG_EXTRA2 BIT(6) -#define DEBUG_PS2 BIT(7) -#define DEBUG_MASK (DEBUG_PS | DEBUG_AP | DEBUG_HW | DEBUG_EXTRA) -#define PDEBUG(n, args...) \ -do { if ((n) & DEBUG_MASK) printk(KERN_DEBUG args); } while (0) -#define PDEBUG2(n, args...) \ -do { if ((n) & DEBUG_MASK) printk(args); } while (0) - -#else /* PRISM2_NO_DEBUG */ - -#define PDEBUG(n, args...) -#define PDEBUG2(n, args...) - -#endif /* PRISM2_NO_DEBUG */ - -enum { BAP0 = 0, BAP1 = 1 }; - -#define PRISM2_IO_DEBUG_CMD_INB 0 -#define PRISM2_IO_DEBUG_CMD_INW 1 -#define PRISM2_IO_DEBUG_CMD_INSW 2 -#define PRISM2_IO_DEBUG_CMD_OUTB 3 -#define PRISM2_IO_DEBUG_CMD_OUTW 4 -#define PRISM2_IO_DEBUG_CMD_OUTSW 5 -#define PRISM2_IO_DEBUG_CMD_ERROR 6 -#define PRISM2_IO_DEBUG_CMD_INTERRUPT 7 - -#ifdef PRISM2_IO_DEBUG - -#define PRISM2_IO_DEBUG_ENTRY(cmd, reg, value) \ -(((cmd) << 24) | ((reg) << 16) | value) - -static inline void prism2_io_debug_add(struct net_device *dev, int cmd, - int reg, int value) -{ - struct hostap_interface *iface = netdev_priv(dev); - local_info_t *local = iface->local; - - if (!local->io_debug_enabled) - return; - - local->io_debug[local->io_debug_head] = jiffies & 0xffffffff; - if (++local->io_debug_head >= PRISM2_IO_DEBUG_SIZE) - local->io_debug_head = 0; - local->io_debug[local->io_debug_head] = - PRISM2_IO_DEBUG_ENTRY(cmd, reg, value); - if (++local->io_debug_head >= PRISM2_IO_DEBUG_SIZE) - local->io_debug_head = 0; -} - - -static inline void prism2_io_debug_error(struct net_device *dev, int err) -{ - struct hostap_interface *iface = netdev_priv(dev); - local_info_t *local = iface->local; - unsigned long flags; - - if (!local->io_debug_enabled) - return; - - spin_lock_irqsave(&local->lock, flags); - prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_ERROR, 0, err); - if (local->io_debug_enabled == 1) { - local->io_debug_enabled = 0; - printk(KERN_DEBUG "%s: I/O debug stopped\n", dev->name); - } - spin_unlock_irqrestore(&local->lock, flags); -} - -#else /* PRISM2_IO_DEBUG */ - -static inline void prism2_io_debug_add(struct net_device *dev, int cmd, - int reg, int value) -{ -} - -static inline void prism2_io_debug_error(struct net_device *dev, int err) -{ -} - -#endif /* PRISM2_IO_DEBUG */ - - -#ifdef PRISM2_CALLBACK -enum { - /* Called when card is enabled */ - PRISM2_CALLBACK_ENABLE, - - /* Called when card is disabled */ - PRISM2_CALLBACK_DISABLE, - - /* Called when RX/TX starts/ends */ - PRISM2_CALLBACK_RX_START, PRISM2_CALLBACK_RX_END, - PRISM2_CALLBACK_TX_START, PRISM2_CALLBACK_TX_END -}; -void prism2_callback(local_info_t *local, int event); -#else /* PRISM2_CALLBACK */ -#define prism2_callback(d, e) do { } while (0) -#endif /* PRISM2_CALLBACK */ - -#endif /* __KERNEL__ */ - -#endif /* HOSTAP_WLAN_H */ diff --git a/drivers/net/wireless/ipw2x00/Kconfig b/drivers/net/wireless/ipw2x00/Kconfig deleted file mode 100644 index 91c0cb3c368e..000000000000 --- a/drivers/net/wireless/ipw2x00/Kconfig +++ /dev/null @@ -1,197 +0,0 @@ -# -# Intel Centrino wireless drivers -# - -config IPW2100 - tristate "Intel PRO/Wireless 2100 Network Connection" - depends on PCI && CFG80211 - select WIRELESS_EXT - select WEXT_SPY - select WEXT_PRIV - select FW_LOADER - select LIB80211 - select LIBIPW - ---help--- - A driver for the Intel PRO/Wireless 2100 Network - Connection 802.11b wireless network adapter. - - See for information on - the capabilities currently enabled in this driver and for tips - for debugging issues and problems. - - In order to use this driver, you will need a firmware image for it. - You can obtain the firmware from - . Once you have the firmware image, you - will need to place it in /lib/firmware. - - You will also very likely need the Wireless Tools in order to - configure your card: - - . - - It is recommended that you compile this driver as a module (M) - rather than built-in (Y). This driver requires firmware at device - initialization time, and when built-in this typically happens - before the filesystem is accessible (hence firmware will be - unavailable and initialization will fail). If you do choose to build - this driver into your kernel image, you can avoid this problem by - including the firmware and a firmware loader in an initramfs. - -config IPW2100_MONITOR - bool "Enable promiscuous mode" - depends on IPW2100 - ---help--- - Enables promiscuous/monitor mode support for the ipw2100 driver. - With this feature compiled into the driver, you can switch to - promiscuous mode via the Wireless Tool's Monitor mode. While in this - mode, no packets can be sent. - -config IPW2100_DEBUG - bool "Enable full debugging output in IPW2100 module." - depends on IPW2100 - ---help--- - This option will enable debug tracing output for the IPW2100. - - This will result in the kernel module being ~60k larger. You can - control which debug output is sent to the kernel log by setting the - value in - - /sys/bus/pci/drivers/ipw2100/debug_level - - This entry will only exist if this option is enabled. - - If you are not trying to debug or develop the IPW2100 driver, you - most likely want to say N here. - -config IPW2200 - tristate "Intel PRO/Wireless 2200BG and 2915ABG Network Connection" - depends on PCI && CFG80211 && CFG80211_WEXT - select WIRELESS_EXT - select WEXT_SPY - select WEXT_PRIV - select FW_LOADER - select LIB80211 - select LIBIPW - ---help--- - A driver for the Intel PRO/Wireless 2200BG and 2915ABG Network - Connection adapters. - - See for - information on the capabilities currently enabled in this - driver and for tips for debugging issues and problems. - - In order to use this driver, you will need a firmware image for it. - You can obtain the firmware from - . See the above referenced README.ipw2200 - for information on where to install the firmware images. - - You will also very likely need the Wireless Tools in order to - configure your card: - - . - - It is recommended that you compile this driver as a module (M) - rather than built-in (Y). This driver requires firmware at device - initialization time, and when built-in this typically happens - before the filesystem is accessible (hence firmware will be - unavailable and initialization will fail). If you do choose to build - this driver into your kernel image, you can avoid this problem by - including the firmware and a firmware loader in an initramfs. - -config IPW2200_MONITOR - bool "Enable promiscuous mode" - depends on IPW2200 - ---help--- - Enables promiscuous/monitor mode support for the ipw2200 driver. - With this feature compiled into the driver, you can switch to - promiscuous mode via the Wireless Tool's Monitor mode. While in this - mode, no packets can be sent. - -config IPW2200_RADIOTAP - bool "Enable radiotap format 802.11 raw packet support" - depends on IPW2200_MONITOR - -config IPW2200_PROMISCUOUS - bool "Enable creation of a RF radiotap promiscuous interface" - depends on IPW2200_MONITOR - select IPW2200_RADIOTAP - ---help--- - Enables the creation of a second interface prefixed 'rtap'. - This second interface will provide every received in radiotap - format. - - This is useful for performing wireless network analysis while - maintaining an active association. - - Example usage: - - % modprobe ipw2200 rtap_iface=1 - % ifconfig rtap0 up - % tethereal -i rtap0 - - If you do not specify 'rtap_iface=1' as a module parameter then - the rtap interface will not be created and you will need to turn - it on via sysfs: - - % echo 1 > /sys/bus/pci/drivers/ipw2200/*/rtap_iface - -config IPW2200_QOS - bool "Enable QoS support" - depends on IPW2200 - -config IPW2200_DEBUG - bool "Enable full debugging output in IPW2200 module." - depends on IPW2200 - ---help--- - This option will enable low level debug tracing output for IPW2200. - - Note, normal debug code is already compiled in. This low level - debug option enables debug on hot paths (e.g Tx, Rx, ISR) and - will result in the kernel module being ~70 larger. Most users - will typically not need this high verbosity debug information. - - If you are not sure, say N here. - -config LIBIPW - tristate - depends on PCI && CFG80211 - select WIRELESS_EXT - select WEXT_SPY - select CRYPTO - select CRYPTO_ARC4 - select CRYPTO_ECB - select CRYPTO_AES - select CRYPTO_MICHAEL_MIC - select CRYPTO_ECB - select CRC32 - select LIB80211 - select LIB80211_CRYPT_WEP - select LIB80211_CRYPT_TKIP - select LIB80211_CRYPT_CCMP - ---help--- - This option enables the hardware independent IEEE 802.11 - networking stack. This component is deprecated in favor of the - mac80211 component. - -config LIBIPW_DEBUG - bool "Full debugging output for the LIBIPW component" - depends on LIBIPW - ---help--- - This option will enable debug tracing output for the - libipw component. - - This will result in the kernel module being ~70k larger. You - can control which debug output is sent to the kernel log by - setting the value in - - /proc/net/ieee80211/debug_level - - For example: - - % echo 0x00000FFO > /proc/net/ieee80211/debug_level - - For a list of values you can assign to debug_level, you - can look at the bit mask values in ieee80211.h - - If you are not trying to debug or develop the libipw - component, you most likely want to say N here. diff --git a/drivers/net/wireless/ipw2x00/Makefile b/drivers/net/wireless/ipw2x00/Makefile deleted file mode 100644 index aecd2cff462b..000000000000 --- a/drivers/net/wireless/ipw2x00/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# -# Makefile for the Intel Centrino wireless drivers -# - -obj-$(CONFIG_IPW2100) += ipw2100.o -obj-$(CONFIG_IPW2200) += ipw2200.o - -obj-$(CONFIG_LIBIPW) += libipw.o -libipw-objs := \ - libipw_module.o \ - libipw_tx.o \ - libipw_rx.o \ - libipw_wx.o \ - libipw_geo.o diff --git a/drivers/net/wireless/ipw2x00/ipw.h b/drivers/net/wireless/ipw2x00/ipw.h deleted file mode 100644 index 4007bf5ed6f3..000000000000 --- a/drivers/net/wireless/ipw2x00/ipw.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Intel Pro/Wireless 2100, 2200BG, 2915ABG network connection driver - * - * Copyright 2012 Stanislav Yakovlev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef __IPW_H__ -#define __IPW_H__ - -#include - -static const u32 ipw_cipher_suites[] = { - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, -}; - -#endif diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c deleted file mode 100644 index 15920aaa5dd6..000000000000 --- a/drivers/net/wireless/ipw2x00/ipw2100.c +++ /dev/null @@ -1,8656 +0,0 @@ -/****************************************************************************** - - Copyright(c) 2003 - 2006 Intel 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., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - - Contact Information: - Intel Linux Wireless - Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - - Portions of this file are based on the sample_* files provided by Wireless - Extensions 0.26 package and copyright (c) 1997-2003 Jean Tourrilhes - - - Portions of this file are based on the Host AP project, - Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen - - Copyright (c) 2002-2003, Jouni Malinen - - Portions of ipw2100_mod_firmware_load, ipw2100_do_mod_firmware_load, and - ipw2100_fw_load are loosely based on drivers/sound/sound_firmware.c - available in the 2.4.25 kernel sources, and are copyright (c) Alan Cox - -******************************************************************************/ -/* - - Initial driver on which this is based was developed by Janusz Gorycki, - Maciej Urbaniak, and Maciej Sosnowski. - - Promiscuous mode support added by Jacek Wysoczynski and Maciej Urbaniak. - -Theory of Operation - -Tx - Commands and Data - -Firmware and host share a circular queue of Transmit Buffer Descriptors (TBDs) -Each TBD contains a pointer to the physical (dma_addr_t) address of data being -sent to the firmware as well as the length of the data. - -The host writes to the TBD queue at the WRITE index. The WRITE index points -to the _next_ packet to be written and is advanced when after the TBD has been -filled. - -The firmware pulls from the TBD queue at the READ index. The READ index points -to the currently being read entry, and is advanced once the firmware is -done with a packet. - -When data is sent to the firmware, the first TBD is used to indicate to the -firmware if a Command or Data is being sent. If it is Command, all of the -command information is contained within the physical address referred to by the -TBD. If it is Data, the first TBD indicates the type of data packet, number -of fragments, etc. The next TBD then refers to the actual packet location. - -The Tx flow cycle is as follows: - -1) ipw2100_tx() is called by kernel with SKB to transmit -2) Packet is move from the tx_free_list and appended to the transmit pending - list (tx_pend_list) -3) work is scheduled to move pending packets into the shared circular queue. -4) when placing packet in the circular queue, the incoming SKB is DMA mapped - to a physical address. That address is entered into a TBD. Two TBDs are - filled out. The first indicating a data packet, the second referring to the - actual payload data. -5) the packet is removed from tx_pend_list and placed on the end of the - firmware pending list (fw_pend_list) -6) firmware is notified that the WRITE index has -7) Once the firmware has processed the TBD, INTA is triggered. -8) For each Tx interrupt received from the firmware, the READ index is checked - to see which TBDs are done being processed. -9) For each TBD that has been processed, the ISR pulls the oldest packet - from the fw_pend_list. -10)The packet structure contained in the fw_pend_list is then used - to unmap the DMA address and to free the SKB originally passed to the driver - from the kernel. -11)The packet structure is placed onto the tx_free_list - -The above steps are the same for commands, only the msg_free_list/msg_pend_list -are used instead of tx_free_list/tx_pend_list - -... - -Critical Sections / Locking : - -There are two locks utilized. The first is the low level lock (priv->low_lock) -that protects the following: - -- Access to the Tx/Rx queue lists via priv->low_lock. The lists are as follows: - - tx_free_list : Holds pre-allocated Tx buffers. - TAIL modified in __ipw2100_tx_process() - HEAD modified in ipw2100_tx() - - tx_pend_list : Holds used Tx buffers waiting to go into the TBD ring - TAIL modified ipw2100_tx() - HEAD modified by ipw2100_tx_send_data() - - msg_free_list : Holds pre-allocated Msg (Command) buffers - TAIL modified in __ipw2100_tx_process() - HEAD modified in ipw2100_hw_send_command() - - msg_pend_list : Holds used Msg buffers waiting to go into the TBD ring - TAIL modified in ipw2100_hw_send_command() - HEAD modified in ipw2100_tx_send_commands() - - The flow of data on the TX side is as follows: - - MSG_FREE_LIST + COMMAND => MSG_PEND_LIST => TBD => MSG_FREE_LIST - TX_FREE_LIST + DATA => TX_PEND_LIST => TBD => TX_FREE_LIST - - The methods that work on the TBD ring are protected via priv->low_lock. - -- The internal data state of the device itself -- Access to the firmware read/write indexes for the BD queues - and associated logic - -All external entry functions are locked with the priv->action_lock to ensure -that only one external action is invoked at a time. - - -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "ipw2100.h" -#include "ipw.h" - -#define IPW2100_VERSION "git-1.2.2" - -#define DRV_NAME "ipw2100" -#define DRV_VERSION IPW2100_VERSION -#define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2100 Network Driver" -#define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" - -static struct pm_qos_request ipw2100_pm_qos_req; - -/* Debugging stuff */ -#ifdef CONFIG_IPW2100_DEBUG -#define IPW2100_RX_DEBUG /* Reception debugging */ -#endif - -MODULE_DESCRIPTION(DRV_DESCRIPTION); -MODULE_VERSION(DRV_VERSION); -MODULE_AUTHOR(DRV_COPYRIGHT); -MODULE_LICENSE("GPL"); - -static int debug = 0; -static int network_mode = 0; -static int channel = 0; -static int associate = 0; -static int disable = 0; -#ifdef CONFIG_PM -static struct ipw2100_fw ipw2100_firmware; -#endif - -#include -module_param(debug, int, 0444); -module_param_named(mode, network_mode, int, 0444); -module_param(channel, int, 0444); -module_param(associate, int, 0444); -module_param(disable, int, 0444); - -MODULE_PARM_DESC(debug, "debug level"); -MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS,2=Monitor)"); -MODULE_PARM_DESC(channel, "channel"); -MODULE_PARM_DESC(associate, "auto associate when scanning (default off)"); -MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); - -static u32 ipw2100_debug_level = IPW_DL_NONE; - -#ifdef CONFIG_IPW2100_DEBUG -#define IPW_DEBUG(level, message...) \ -do { \ - if (ipw2100_debug_level & (level)) { \ - printk(KERN_DEBUG "ipw2100: %c %s ", \ - in_interrupt() ? 'I' : 'U', __func__); \ - printk(message); \ - } \ -} while (0) -#else -#define IPW_DEBUG(level, message...) do {} while (0) -#endif /* CONFIG_IPW2100_DEBUG */ - -#ifdef CONFIG_IPW2100_DEBUG -static const char *command_types[] = { - "undefined", - "unused", /* HOST_ATTENTION */ - "HOST_COMPLETE", - "unused", /* SLEEP */ - "unused", /* HOST_POWER_DOWN */ - "unused", - "SYSTEM_CONFIG", - "unused", /* SET_IMR */ - "SSID", - "MANDATORY_BSSID", - "AUTHENTICATION_TYPE", - "ADAPTER_ADDRESS", - "PORT_TYPE", - "INTERNATIONAL_MODE", - "CHANNEL", - "RTS_THRESHOLD", - "FRAG_THRESHOLD", - "POWER_MODE", - "TX_RATES", - "BASIC_TX_RATES", - "WEP_KEY_INFO", - "unused", - "unused", - "unused", - "unused", - "WEP_KEY_INDEX", - "WEP_FLAGS", - "ADD_MULTICAST", - "CLEAR_ALL_MULTICAST", - "BEACON_INTERVAL", - "ATIM_WINDOW", - "CLEAR_STATISTICS", - "undefined", - "undefined", - "undefined", - "undefined", - "TX_POWER_INDEX", - "undefined", - "undefined", - "undefined", - "undefined", - "undefined", - "undefined", - "BROADCAST_SCAN", - "CARD_DISABLE", - "PREFERRED_BSSID", - "SET_SCAN_OPTIONS", - "SCAN_DWELL_TIME", - "SWEEP_TABLE", - "AP_OR_STATION_TABLE", - "GROUP_ORDINALS", - "SHORT_RETRY_LIMIT", - "LONG_RETRY_LIMIT", - "unused", /* SAVE_CALIBRATION */ - "unused", /* RESTORE_CALIBRATION */ - "undefined", - "undefined", - "undefined", - "HOST_PRE_POWER_DOWN", - "unused", /* HOST_INTERRUPT_COALESCING */ - "undefined", - "CARD_DISABLE_PHY_OFF", - "MSDU_TX_RATES", - "undefined", - "SET_STATION_STAT_BITS", - "CLEAR_STATIONS_STAT_BITS", - "LEAP_ROGUE_MODE", - "SET_SECURITY_INFORMATION", - "DISASSOCIATION_BSSID", - "SET_WPA_ASS_IE" -}; -#endif - -static const long ipw2100_frequencies[] = { - 2412, 2417, 2422, 2427, - 2432, 2437, 2442, 2447, - 2452, 2457, 2462, 2467, - 2472, 2484 -}; - -#define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies) - -static struct ieee80211_rate ipw2100_bg_rates[] = { - { .bitrate = 10 }, - { .bitrate = 20, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 55, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 110, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, -}; - -#define RATE_COUNT ARRAY_SIZE(ipw2100_bg_rates) - -/* Pre-decl until we get the code solid and then we can clean it up */ -static void ipw2100_tx_send_commands(struct ipw2100_priv *priv); -static void ipw2100_tx_send_data(struct ipw2100_priv *priv); -static int ipw2100_adapter_setup(struct ipw2100_priv *priv); - -static void ipw2100_queues_initialize(struct ipw2100_priv *priv); -static void ipw2100_queues_free(struct ipw2100_priv *priv); -static int ipw2100_queues_allocate(struct ipw2100_priv *priv); - -static int ipw2100_fw_download(struct ipw2100_priv *priv, - struct ipw2100_fw *fw); -static int ipw2100_get_firmware(struct ipw2100_priv *priv, - struct ipw2100_fw *fw); -static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, - size_t max); -static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, - size_t max); -static void ipw2100_release_firmware(struct ipw2100_priv *priv, - struct ipw2100_fw *fw); -static int ipw2100_ucode_download(struct ipw2100_priv *priv, - struct ipw2100_fw *fw); -static void ipw2100_wx_event_work(struct work_struct *work); -static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev); -static struct iw_handler_def ipw2100_wx_handler_def; - -static inline void read_register(struct net_device *dev, u32 reg, u32 * val) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - - *val = ioread32(priv->ioaddr + reg); - IPW_DEBUG_IO("r: 0x%08X => 0x%08X\n", reg, *val); -} - -static inline void write_register(struct net_device *dev, u32 reg, u32 val) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - - iowrite32(val, priv->ioaddr + reg); - IPW_DEBUG_IO("w: 0x%08X <= 0x%08X\n", reg, val); -} - -static inline void read_register_word(struct net_device *dev, u32 reg, - u16 * val) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - - *val = ioread16(priv->ioaddr + reg); - IPW_DEBUG_IO("r: 0x%08X => %04X\n", reg, *val); -} - -static inline void read_register_byte(struct net_device *dev, u32 reg, u8 * val) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - - *val = ioread8(priv->ioaddr + reg); - IPW_DEBUG_IO("r: 0x%08X => %02X\n", reg, *val); -} - -static inline void write_register_word(struct net_device *dev, u32 reg, u16 val) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - - iowrite16(val, priv->ioaddr + reg); - IPW_DEBUG_IO("w: 0x%08X <= %04X\n", reg, val); -} - -static inline void write_register_byte(struct net_device *dev, u32 reg, u8 val) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - - iowrite8(val, priv->ioaddr + reg); - IPW_DEBUG_IO("w: 0x%08X =< %02X\n", reg, val); -} - -static inline void read_nic_dword(struct net_device *dev, u32 addr, u32 * val) -{ - write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, - addr & IPW_REG_INDIRECT_ADDR_MASK); - read_register(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); -} - -static inline void write_nic_dword(struct net_device *dev, u32 addr, u32 val) -{ - write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, - addr & IPW_REG_INDIRECT_ADDR_MASK); - write_register(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); -} - -static inline void read_nic_word(struct net_device *dev, u32 addr, u16 * val) -{ - write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, - addr & IPW_REG_INDIRECT_ADDR_MASK); - read_register_word(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); -} - -static inline void write_nic_word(struct net_device *dev, u32 addr, u16 val) -{ - write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, - addr & IPW_REG_INDIRECT_ADDR_MASK); - write_register_word(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); -} - -static inline void read_nic_byte(struct net_device *dev, u32 addr, u8 * val) -{ - write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, - addr & IPW_REG_INDIRECT_ADDR_MASK); - read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); -} - -static inline void write_nic_byte(struct net_device *dev, u32 addr, u8 val) -{ - write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, - addr & IPW_REG_INDIRECT_ADDR_MASK); - write_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA, val); -} - -static inline void write_nic_auto_inc_address(struct net_device *dev, u32 addr) -{ - write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, - addr & IPW_REG_INDIRECT_ADDR_MASK); -} - -static inline void write_nic_dword_auto_inc(struct net_device *dev, u32 val) -{ - write_register(dev, IPW_REG_AUTOINCREMENT_DATA, val); -} - -static void write_nic_memory(struct net_device *dev, u32 addr, u32 len, - const u8 * buf) -{ - u32 aligned_addr; - u32 aligned_len; - u32 dif_len; - u32 i; - - /* read first nibble byte by byte */ - aligned_addr = addr & (~0x3); - dif_len = addr - aligned_addr; - if (dif_len) { - /* Start reading at aligned_addr + dif_len */ - write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, - aligned_addr); - for (i = dif_len; i < 4; i++, buf++) - write_register_byte(dev, - IPW_REG_INDIRECT_ACCESS_DATA + i, - *buf); - - len -= dif_len; - aligned_addr += 4; - } - - /* read DWs through autoincrement registers */ - write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, aligned_addr); - aligned_len = len & (~0x3); - for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) - write_register(dev, IPW_REG_AUTOINCREMENT_DATA, *(u32 *) buf); - - /* copy the last nibble */ - dif_len = len - aligned_len; - write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); - for (i = 0; i < dif_len; i++, buf++) - write_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, - *buf); -} - -static void read_nic_memory(struct net_device *dev, u32 addr, u32 len, - u8 * buf) -{ - u32 aligned_addr; - u32 aligned_len; - u32 dif_len; - u32 i; - - /* read first nibble byte by byte */ - aligned_addr = addr & (~0x3); - dif_len = addr - aligned_addr; - if (dif_len) { - /* Start reading at aligned_addr + dif_len */ - write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, - aligned_addr); - for (i = dif_len; i < 4; i++, buf++) - read_register_byte(dev, - IPW_REG_INDIRECT_ACCESS_DATA + i, - buf); - - len -= dif_len; - aligned_addr += 4; - } - - /* read DWs through autoincrement registers */ - write_register(dev, IPW_REG_AUTOINCREMENT_ADDRESS, aligned_addr); - aligned_len = len & (~0x3); - for (i = 0; i < aligned_len; i += 4, buf += 4, aligned_addr += 4) - read_register(dev, IPW_REG_AUTOINCREMENT_DATA, (u32 *) buf); - - /* copy the last nibble */ - dif_len = len - aligned_len; - write_register(dev, IPW_REG_INDIRECT_ACCESS_ADDRESS, aligned_addr); - for (i = 0; i < dif_len; i++, buf++) - read_register_byte(dev, IPW_REG_INDIRECT_ACCESS_DATA + i, buf); -} - -static bool ipw2100_hw_is_adapter_in_system(struct net_device *dev) -{ - u32 dbg; - - read_register(dev, IPW_REG_DOA_DEBUG_AREA_START, &dbg); - - return dbg == IPW_DATA_DOA_DEBUG_VALUE; -} - -static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord, - void *val, u32 * len) -{ - struct ipw2100_ordinals *ordinals = &priv->ordinals; - u32 addr; - u32 field_info; - u16 field_len; - u16 field_count; - u32 total_length; - - if (ordinals->table1_addr == 0) { - printk(KERN_WARNING DRV_NAME ": attempt to use fw ordinals " - "before they have been loaded.\n"); - return -EINVAL; - } - - if (IS_ORDINAL_TABLE_ONE(ordinals, ord)) { - if (*len < IPW_ORD_TAB_1_ENTRY_SIZE) { - *len = IPW_ORD_TAB_1_ENTRY_SIZE; - - printk(KERN_WARNING DRV_NAME - ": ordinal buffer length too small, need %zd\n", - IPW_ORD_TAB_1_ENTRY_SIZE); - - return -EINVAL; - } - - read_nic_dword(priv->net_dev, - ordinals->table1_addr + (ord << 2), &addr); - read_nic_dword(priv->net_dev, addr, val); - - *len = IPW_ORD_TAB_1_ENTRY_SIZE; - - return 0; - } - - if (IS_ORDINAL_TABLE_TWO(ordinals, ord)) { - - ord -= IPW_START_ORD_TAB_2; - - /* get the address of statistic */ - read_nic_dword(priv->net_dev, - ordinals->table2_addr + (ord << 3), &addr); - - /* get the second DW of statistics ; - * two 16-bit words - first is length, second is count */ - read_nic_dword(priv->net_dev, - ordinals->table2_addr + (ord << 3) + sizeof(u32), - &field_info); - - /* get each entry length */ - field_len = *((u16 *) & field_info); - - /* get number of entries */ - field_count = *(((u16 *) & field_info) + 1); - - /* abort if no enough memory */ - total_length = field_len * field_count; - if (total_length > *len) { - *len = total_length; - return -EINVAL; - } - - *len = total_length; - if (!total_length) - return 0; - - /* read the ordinal data from the SRAM */ - read_nic_memory(priv->net_dev, addr, total_length, val); - - return 0; - } - - printk(KERN_WARNING DRV_NAME ": ordinal %d neither in table 1 nor " - "in table 2\n", ord); - - return -EINVAL; -} - -static int ipw2100_set_ordinal(struct ipw2100_priv *priv, u32 ord, u32 * val, - u32 * len) -{ - struct ipw2100_ordinals *ordinals = &priv->ordinals; - u32 addr; - - if (IS_ORDINAL_TABLE_ONE(ordinals, ord)) { - if (*len != IPW_ORD_TAB_1_ENTRY_SIZE) { - *len = IPW_ORD_TAB_1_ENTRY_SIZE; - IPW_DEBUG_INFO("wrong size\n"); - return -EINVAL; - } - - read_nic_dword(priv->net_dev, - ordinals->table1_addr + (ord << 2), &addr); - - write_nic_dword(priv->net_dev, addr, *val); - - *len = IPW_ORD_TAB_1_ENTRY_SIZE; - - return 0; - } - - IPW_DEBUG_INFO("wrong table\n"); - if (IS_ORDINAL_TABLE_TWO(ordinals, ord)) - return -EINVAL; - - return -EINVAL; -} - -static char *snprint_line(char *buf, size_t count, - const u8 * data, u32 len, u32 ofs) -{ - int out, i, j, l; - char c; - - out = snprintf(buf, count, "%08X", ofs); - - for (l = 0, i = 0; i < 2; i++) { - out += snprintf(buf + out, count - out, " "); - for (j = 0; j < 8 && l < len; j++, l++) - out += snprintf(buf + out, count - out, "%02X ", - data[(i * 8 + j)]); - for (; j < 8; j++) - out += snprintf(buf + out, count - out, " "); - } - - out += snprintf(buf + out, count - out, " "); - for (l = 0, i = 0; i < 2; i++) { - out += snprintf(buf + out, count - out, " "); - for (j = 0; j < 8 && l < len; j++, l++) { - c = data[(i * 8 + j)]; - if (!isascii(c) || !isprint(c)) - c = '.'; - - out += snprintf(buf + out, count - out, "%c", c); - } - - for (; j < 8; j++) - out += snprintf(buf + out, count - out, " "); - } - - return buf; -} - -static void printk_buf(int level, const u8 * data, u32 len) -{ - char line[81]; - u32 ofs = 0; - if (!(ipw2100_debug_level & level)) - return; - - while (len) { - printk(KERN_DEBUG "%s\n", - snprint_line(line, sizeof(line), &data[ofs], - min(len, 16U), ofs)); - ofs += 16; - len -= min(len, 16U); - } -} - -#define MAX_RESET_BACKOFF 10 - -static void schedule_reset(struct ipw2100_priv *priv) -{ - unsigned long now = get_seconds(); - - /* If we haven't received a reset request within the backoff period, - * then we can reset the backoff interval so this reset occurs - * immediately */ - if (priv->reset_backoff && - (now - priv->last_reset > priv->reset_backoff)) - priv->reset_backoff = 0; - - priv->last_reset = get_seconds(); - - if (!(priv->status & STATUS_RESET_PENDING)) { - IPW_DEBUG_INFO("%s: Scheduling firmware restart (%ds).\n", - priv->net_dev->name, priv->reset_backoff); - netif_carrier_off(priv->net_dev); - netif_stop_queue(priv->net_dev); - priv->status |= STATUS_RESET_PENDING; - if (priv->reset_backoff) - schedule_delayed_work(&priv->reset_work, - priv->reset_backoff * HZ); - else - schedule_delayed_work(&priv->reset_work, 0); - - if (priv->reset_backoff < MAX_RESET_BACKOFF) - priv->reset_backoff++; - - wake_up_interruptible(&priv->wait_command_queue); - } else - IPW_DEBUG_INFO("%s: Firmware restart already in progress.\n", - priv->net_dev->name); - -} - -#define HOST_COMPLETE_TIMEOUT (2 * HZ) -static int ipw2100_hw_send_command(struct ipw2100_priv *priv, - struct host_command *cmd) -{ - struct list_head *element; - struct ipw2100_tx_packet *packet; - unsigned long flags; - int err = 0; - - IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n", - command_types[cmd->host_command], cmd->host_command, - cmd->host_command_length); - printk_buf(IPW_DL_HC, (u8 *) cmd->host_command_parameters, - cmd->host_command_length); - - spin_lock_irqsave(&priv->low_lock, flags); - - if (priv->fatal_error) { - IPW_DEBUG_INFO - ("Attempt to send command while hardware in fatal error condition.\n"); - err = -EIO; - goto fail_unlock; - } - - if (!(priv->status & STATUS_RUNNING)) { - IPW_DEBUG_INFO - ("Attempt to send command while hardware is not running.\n"); - err = -EIO; - goto fail_unlock; - } - - if (priv->status & STATUS_CMD_ACTIVE) { - IPW_DEBUG_INFO - ("Attempt to send command while another command is pending.\n"); - err = -EBUSY; - goto fail_unlock; - } - - if (list_empty(&priv->msg_free_list)) { - IPW_DEBUG_INFO("no available msg buffers\n"); - goto fail_unlock; - } - - priv->status |= STATUS_CMD_ACTIVE; - priv->messages_sent++; - - element = priv->msg_free_list.next; - - packet = list_entry(element, struct ipw2100_tx_packet, list); - packet->jiffy_start = jiffies; - - /* initialize the firmware command packet */ - packet->info.c_struct.cmd->host_command_reg = cmd->host_command; - packet->info.c_struct.cmd->host_command_reg1 = cmd->host_command1; - packet->info.c_struct.cmd->host_command_len_reg = - cmd->host_command_length; - packet->info.c_struct.cmd->sequence = cmd->host_command_sequence; - - memcpy(packet->info.c_struct.cmd->host_command_params_reg, - cmd->host_command_parameters, - sizeof(packet->info.c_struct.cmd->host_command_params_reg)); - - list_del(element); - DEC_STAT(&priv->msg_free_stat); - - list_add_tail(element, &priv->msg_pend_list); - INC_STAT(&priv->msg_pend_stat); - - ipw2100_tx_send_commands(priv); - ipw2100_tx_send_data(priv); - - spin_unlock_irqrestore(&priv->low_lock, flags); - - /* - * We must wait for this command to complete before another - * command can be sent... but if we wait more than 3 seconds - * then there is a problem. - */ - - err = - wait_event_interruptible_timeout(priv->wait_command_queue, - !(priv-> - status & STATUS_CMD_ACTIVE), - HOST_COMPLETE_TIMEOUT); - - if (err == 0) { - IPW_DEBUG_INFO("Command completion failed out after %dms.\n", - 1000 * (HOST_COMPLETE_TIMEOUT / HZ)); - priv->fatal_error = IPW2100_ERR_MSG_TIMEOUT; - priv->status &= ~STATUS_CMD_ACTIVE; - schedule_reset(priv); - return -EIO; - } - - if (priv->fatal_error) { - printk(KERN_WARNING DRV_NAME ": %s: firmware fatal error\n", - priv->net_dev->name); - return -EIO; - } - - /* !!!!! HACK TEST !!!!! - * When lots of debug trace statements are enabled, the driver - * doesn't seem to have as many firmware restart cycles... - * - * As a test, we're sticking in a 1/100s delay here */ - schedule_timeout_uninterruptible(msecs_to_jiffies(10)); - - return 0; - - fail_unlock: - spin_unlock_irqrestore(&priv->low_lock, flags); - - return err; -} - -/* - * Verify the values and data access of the hardware - * No locks needed or used. No functions called. - */ -static int ipw2100_verify(struct ipw2100_priv *priv) -{ - u32 data1, data2; - u32 address; - - u32 val1 = 0x76543210; - u32 val2 = 0xFEDCBA98; - - /* Domain 0 check - all values should be DOA_DEBUG */ - for (address = IPW_REG_DOA_DEBUG_AREA_START; - address < IPW_REG_DOA_DEBUG_AREA_END; address += sizeof(u32)) { - read_register(priv->net_dev, address, &data1); - if (data1 != IPW_DATA_DOA_DEBUG_VALUE) - return -EIO; - } - - /* Domain 1 check - use arbitrary read/write compare */ - for (address = 0; address < 5; address++) { - /* The memory area is not used now */ - write_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x32, - val1); - write_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x36, - val2); - read_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x32, - &data1); - read_register(priv->net_dev, IPW_REG_DOMAIN_1_OFFSET + 0x36, - &data2); - if (val1 == data1 && val2 == data2) - return 0; - } - - return -EIO; -} - -/* - * - * Loop until the CARD_DISABLED bit is the same value as the - * supplied parameter - * - * TODO: See if it would be more efficient to do a wait/wake - * cycle and have the completion event trigger the wakeup - * - */ -#define IPW_CARD_DISABLE_COMPLETE_WAIT 100 // 100 milli -static int ipw2100_wait_for_card_state(struct ipw2100_priv *priv, int state) -{ - int i; - u32 card_state; - u32 len = sizeof(card_state); - int err; - - for (i = 0; i <= IPW_CARD_DISABLE_COMPLETE_WAIT * 1000; i += 50) { - err = ipw2100_get_ordinal(priv, IPW_ORD_CARD_DISABLED, - &card_state, &len); - if (err) { - IPW_DEBUG_INFO("Query of CARD_DISABLED ordinal " - "failed.\n"); - return 0; - } - - /* We'll break out if either the HW state says it is - * in the state we want, or if HOST_COMPLETE command - * finishes */ - if ((card_state == state) || - ((priv->status & STATUS_ENABLED) ? - IPW_HW_STATE_ENABLED : IPW_HW_STATE_DISABLED) == state) { - if (state == IPW_HW_STATE_ENABLED) - priv->status |= STATUS_ENABLED; - else - priv->status &= ~STATUS_ENABLED; - - return 0; - } - - udelay(50); - } - - IPW_DEBUG_INFO("ipw2100_wait_for_card_state to %s state timed out\n", - state ? "DISABLED" : "ENABLED"); - return -EIO; -} - -/********************************************************************* - Procedure : sw_reset_and_clock - Purpose : Asserts s/w reset, asserts clock initialization - and waits for clock stabilization - ********************************************************************/ -static int sw_reset_and_clock(struct ipw2100_priv *priv) -{ - int i; - u32 r; - - // assert s/w reset - write_register(priv->net_dev, IPW_REG_RESET_REG, - IPW_AUX_HOST_RESET_REG_SW_RESET); - - // wait for clock stabilization - for (i = 0; i < 1000; i++) { - udelay(IPW_WAIT_RESET_ARC_COMPLETE_DELAY); - - // check clock ready bit - read_register(priv->net_dev, IPW_REG_RESET_REG, &r); - if (r & IPW_AUX_HOST_RESET_REG_PRINCETON_RESET) - break; - } - - if (i == 1000) - return -EIO; // TODO: better error value - - /* set "initialization complete" bit to move adapter to - * D0 state */ - write_register(priv->net_dev, IPW_REG_GP_CNTRL, - IPW_AUX_HOST_GP_CNTRL_BIT_INIT_DONE); - - /* wait for clock stabilization */ - for (i = 0; i < 10000; i++) { - udelay(IPW_WAIT_CLOCK_STABILIZATION_DELAY * 4); - - /* check clock ready bit */ - read_register(priv->net_dev, IPW_REG_GP_CNTRL, &r); - if (r & IPW_AUX_HOST_GP_CNTRL_BIT_CLOCK_READY) - break; - } - - if (i == 10000) - return -EIO; /* TODO: better error value */ - - /* set D0 standby bit */ - read_register(priv->net_dev, IPW_REG_GP_CNTRL, &r); - write_register(priv->net_dev, IPW_REG_GP_CNTRL, - r | IPW_AUX_HOST_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY); - - return 0; -} - -/********************************************************************* - Procedure : ipw2100_download_firmware - Purpose : Initiaze adapter after power on. - The sequence is: - 1. assert s/w reset first! - 2. awake clocks & wait for clock stabilization - 3. hold ARC (don't ask me why...) - 4. load Dino ucode and reset/clock init again - 5. zero-out shared mem - 6. download f/w - *******************************************************************/ -static int ipw2100_download_firmware(struct ipw2100_priv *priv) -{ - u32 address; - int err; - -#ifndef CONFIG_PM - /* Fetch the firmware and microcode */ - struct ipw2100_fw ipw2100_firmware; -#endif - - if (priv->fatal_error) { - IPW_DEBUG_ERROR("%s: ipw2100_download_firmware called after " - "fatal error %d. Interface must be brought down.\n", - priv->net_dev->name, priv->fatal_error); - return -EINVAL; - } -#ifdef CONFIG_PM - if (!ipw2100_firmware.version) { - err = ipw2100_get_firmware(priv, &ipw2100_firmware); - if (err) { - IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", - priv->net_dev->name, err); - priv->fatal_error = IPW2100_ERR_FW_LOAD; - goto fail; - } - } -#else - err = ipw2100_get_firmware(priv, &ipw2100_firmware); - if (err) { - IPW_DEBUG_ERROR("%s: ipw2100_get_firmware failed: %d\n", - priv->net_dev->name, err); - priv->fatal_error = IPW2100_ERR_FW_LOAD; - goto fail; - } -#endif - priv->firmware_version = ipw2100_firmware.version; - - /* s/w reset and clock stabilization */ - err = sw_reset_and_clock(priv); - if (err) { - IPW_DEBUG_ERROR("%s: sw_reset_and_clock failed: %d\n", - priv->net_dev->name, err); - goto fail; - } - - err = ipw2100_verify(priv); - if (err) { - IPW_DEBUG_ERROR("%s: ipw2100_verify failed: %d\n", - priv->net_dev->name, err); - goto fail; - } - - /* Hold ARC */ - write_nic_dword(priv->net_dev, - IPW_INTERNAL_REGISTER_HALT_AND_RESET, 0x80000000); - - /* allow ARC to run */ - write_register(priv->net_dev, IPW_REG_RESET_REG, 0); - - /* load microcode */ - err = ipw2100_ucode_download(priv, &ipw2100_firmware); - if (err) { - printk(KERN_ERR DRV_NAME ": %s: Error loading microcode: %d\n", - priv->net_dev->name, err); - goto fail; - } - - /* release ARC */ - write_nic_dword(priv->net_dev, - IPW_INTERNAL_REGISTER_HALT_AND_RESET, 0x00000000); - - /* s/w reset and clock stabilization (again!!!) */ - err = sw_reset_and_clock(priv); - if (err) { - printk(KERN_ERR DRV_NAME - ": %s: sw_reset_and_clock failed: %d\n", - priv->net_dev->name, err); - goto fail; - } - - /* load f/w */ - err = ipw2100_fw_download(priv, &ipw2100_firmware); - if (err) { - IPW_DEBUG_ERROR("%s: Error loading firmware: %d\n", - priv->net_dev->name, err); - goto fail; - } -#ifndef CONFIG_PM - /* - * When the .resume method of the driver is called, the other - * part of the system, i.e. the ide driver could still stay in - * the suspend stage. This prevents us from loading the firmware - * from the disk. --YZ - */ - - /* free any storage allocated for firmware image */ - ipw2100_release_firmware(priv, &ipw2100_firmware); -#endif - - /* zero out Domain 1 area indirectly (Si requirement) */ - for (address = IPW_HOST_FW_SHARED_AREA0; - address < IPW_HOST_FW_SHARED_AREA0_END; address += 4) - write_nic_dword(priv->net_dev, address, 0); - for (address = IPW_HOST_FW_SHARED_AREA1; - address < IPW_HOST_FW_SHARED_AREA1_END; address += 4) - write_nic_dword(priv->net_dev, address, 0); - for (address = IPW_HOST_FW_SHARED_AREA2; - address < IPW_HOST_FW_SHARED_AREA2_END; address += 4) - write_nic_dword(priv->net_dev, address, 0); - for (address = IPW_HOST_FW_SHARED_AREA3; - address < IPW_HOST_FW_SHARED_AREA3_END; address += 4) - write_nic_dword(priv->net_dev, address, 0); - for (address = IPW_HOST_FW_INTERRUPT_AREA; - address < IPW_HOST_FW_INTERRUPT_AREA_END; address += 4) - write_nic_dword(priv->net_dev, address, 0); - - return 0; - - fail: - ipw2100_release_firmware(priv, &ipw2100_firmware); - return err; -} - -static inline void ipw2100_enable_interrupts(struct ipw2100_priv *priv) -{ - if (priv->status & STATUS_INT_ENABLED) - return; - priv->status |= STATUS_INT_ENABLED; - write_register(priv->net_dev, IPW_REG_INTA_MASK, IPW_INTERRUPT_MASK); -} - -static inline void ipw2100_disable_interrupts(struct ipw2100_priv *priv) -{ - if (!(priv->status & STATUS_INT_ENABLED)) - return; - priv->status &= ~STATUS_INT_ENABLED; - write_register(priv->net_dev, IPW_REG_INTA_MASK, 0x0); -} - -static void ipw2100_initialize_ordinals(struct ipw2100_priv *priv) -{ - struct ipw2100_ordinals *ord = &priv->ordinals; - - IPW_DEBUG_INFO("enter\n"); - - read_register(priv->net_dev, IPW_MEM_HOST_SHARED_ORDINALS_TABLE_1, - &ord->table1_addr); - - read_register(priv->net_dev, IPW_MEM_HOST_SHARED_ORDINALS_TABLE_2, - &ord->table2_addr); - - read_nic_dword(priv->net_dev, ord->table1_addr, &ord->table1_size); - read_nic_dword(priv->net_dev, ord->table2_addr, &ord->table2_size); - - ord->table2_size &= 0x0000FFFF; - - IPW_DEBUG_INFO("table 1 size: %d\n", ord->table1_size); - IPW_DEBUG_INFO("table 2 size: %d\n", ord->table2_size); - IPW_DEBUG_INFO("exit\n"); -} - -static inline void ipw2100_hw_set_gpio(struct ipw2100_priv *priv) -{ - u32 reg = 0; - /* - * Set GPIO 3 writable by FW; GPIO 1 writable - * by driver and enable clock - */ - reg = (IPW_BIT_GPIO_GPIO3_MASK | IPW_BIT_GPIO_GPIO1_ENABLE | - IPW_BIT_GPIO_LED_OFF); - write_register(priv->net_dev, IPW_REG_GPIO, reg); -} - -static int rf_kill_active(struct ipw2100_priv *priv) -{ -#define MAX_RF_KILL_CHECKS 5 -#define RF_KILL_CHECK_DELAY 40 - - unsigned short value = 0; - u32 reg = 0; - int i; - - if (!(priv->hw_features & HW_FEATURE_RFKILL)) { - wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, false); - priv->status &= ~STATUS_RF_KILL_HW; - return 0; - } - - for (i = 0; i < MAX_RF_KILL_CHECKS; i++) { - udelay(RF_KILL_CHECK_DELAY); - read_register(priv->net_dev, IPW_REG_GPIO, ®); - value = (value << 1) | ((reg & IPW_BIT_GPIO_RF_KILL) ? 0 : 1); - } - - if (value == 0) { - wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, true); - priv->status |= STATUS_RF_KILL_HW; - } else { - wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, false); - priv->status &= ~STATUS_RF_KILL_HW; - } - - return (value == 0); -} - -static int ipw2100_get_hw_features(struct ipw2100_priv *priv) -{ - u32 addr, len; - u32 val; - - /* - * EEPROM_SRAM_DB_START_ADDRESS using ordinal in ordinal table 1 - */ - len = sizeof(addr); - if (ipw2100_get_ordinal - (priv, IPW_ORD_EEPROM_SRAM_DB_BLOCK_START_ADDRESS, &addr, &len)) { - IPW_DEBUG_INFO("failed querying ordinals at line %d\n", - __LINE__); - return -EIO; - } - - IPW_DEBUG_INFO("EEPROM address: %08X\n", addr); - - /* - * EEPROM version is the byte at offset 0xfd in firmware - * We read 4 bytes, then shift out the byte we actually want */ - read_nic_dword(priv->net_dev, addr + 0xFC, &val); - priv->eeprom_version = (val >> 24) & 0xFF; - IPW_DEBUG_INFO("EEPROM version: %d\n", priv->eeprom_version); - - /* - * HW RF Kill enable is bit 0 in byte at offset 0x21 in firmware - * - * notice that the EEPROM bit is reverse polarity, i.e. - * bit = 0 signifies HW RF kill switch is supported - * bit = 1 signifies HW RF kill switch is NOT supported - */ - read_nic_dword(priv->net_dev, addr + 0x20, &val); - if (!((val >> 24) & 0x01)) - priv->hw_features |= HW_FEATURE_RFKILL; - - IPW_DEBUG_INFO("HW RF Kill: %ssupported.\n", - (priv->hw_features & HW_FEATURE_RFKILL) ? "" : "not "); - - return 0; -} - -/* - * Start firmware execution after power on and intialization - * The sequence is: - * 1. Release ARC - * 2. Wait for f/w initialization completes; - */ -static int ipw2100_start_adapter(struct ipw2100_priv *priv) -{ - int i; - u32 inta, inta_mask, gpio; - - IPW_DEBUG_INFO("enter\n"); - - if (priv->status & STATUS_RUNNING) - return 0; - - /* - * Initialize the hw - drive adapter to DO state by setting - * init_done bit. Wait for clk_ready bit and Download - * fw & dino ucode - */ - if (ipw2100_download_firmware(priv)) { - printk(KERN_ERR DRV_NAME - ": %s: Failed to power on the adapter.\n", - priv->net_dev->name); - return -EIO; - } - - /* Clear the Tx, Rx and Msg queues and the r/w indexes - * in the firmware RBD and TBD ring queue */ - ipw2100_queues_initialize(priv); - - ipw2100_hw_set_gpio(priv); - - /* TODO -- Look at disabling interrupts here to make sure none - * get fired during FW initialization */ - - /* Release ARC - clear reset bit */ - write_register(priv->net_dev, IPW_REG_RESET_REG, 0); - - /* wait for f/w intialization complete */ - IPW_DEBUG_FW("Waiting for f/w initialization to complete...\n"); - i = 5000; - do { - schedule_timeout_uninterruptible(msecs_to_jiffies(40)); - /* Todo... wait for sync command ... */ - - read_register(priv->net_dev, IPW_REG_INTA, &inta); - - /* check "init done" bit */ - if (inta & IPW2100_INTA_FW_INIT_DONE) { - /* reset "init done" bit */ - write_register(priv->net_dev, IPW_REG_INTA, - IPW2100_INTA_FW_INIT_DONE); - break; - } - - /* check error conditions : we check these after the firmware - * check so that if there is an error, the interrupt handler - * will see it and the adapter will be reset */ - if (inta & - (IPW2100_INTA_FATAL_ERROR | IPW2100_INTA_PARITY_ERROR)) { - /* clear error conditions */ - write_register(priv->net_dev, IPW_REG_INTA, - IPW2100_INTA_FATAL_ERROR | - IPW2100_INTA_PARITY_ERROR); - } - } while (--i); - - /* Clear out any pending INTAs since we aren't supposed to have - * interrupts enabled at this point... */ - read_register(priv->net_dev, IPW_REG_INTA, &inta); - read_register(priv->net_dev, IPW_REG_INTA_MASK, &inta_mask); - inta &= IPW_INTERRUPT_MASK; - /* Clear out any pending interrupts */ - if (inta & inta_mask) - write_register(priv->net_dev, IPW_REG_INTA, inta); - - IPW_DEBUG_FW("f/w initialization complete: %s\n", - i ? "SUCCESS" : "FAILED"); - - if (!i) { - printk(KERN_WARNING DRV_NAME - ": %s: Firmware did not initialize.\n", - priv->net_dev->name); - return -EIO; - } - - /* allow firmware to write to GPIO1 & GPIO3 */ - read_register(priv->net_dev, IPW_REG_GPIO, &gpio); - - gpio |= (IPW_BIT_GPIO_GPIO1_MASK | IPW_BIT_GPIO_GPIO3_MASK); - - write_register(priv->net_dev, IPW_REG_GPIO, gpio); - - /* Ready to receive commands */ - priv->status |= STATUS_RUNNING; - - /* The adapter has been reset; we are not associated */ - priv->status &= ~(STATUS_ASSOCIATING | STATUS_ASSOCIATED); - - IPW_DEBUG_INFO("exit\n"); - - return 0; -} - -static inline void ipw2100_reset_fatalerror(struct ipw2100_priv *priv) -{ - if (!priv->fatal_error) - return; - - priv->fatal_errors[priv->fatal_index++] = priv->fatal_error; - priv->fatal_index %= IPW2100_ERROR_QUEUE; - priv->fatal_error = 0; -} - -/* NOTE: Our interrupt is disabled when this method is called */ -static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv) -{ - u32 reg; - int i; - - IPW_DEBUG_INFO("Power cycling the hardware.\n"); - - ipw2100_hw_set_gpio(priv); - - /* Step 1. Stop Master Assert */ - write_register(priv->net_dev, IPW_REG_RESET_REG, - IPW_AUX_HOST_RESET_REG_STOP_MASTER); - - /* Step 2. Wait for stop Master Assert - * (not more than 50us, otherwise ret error */ - i = 5; - do { - udelay(IPW_WAIT_RESET_MASTER_ASSERT_COMPLETE_DELAY); - read_register(priv->net_dev, IPW_REG_RESET_REG, ®); - - if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) - break; - } while (--i); - - priv->status &= ~STATUS_RESET_PENDING; - - if (!i) { - IPW_DEBUG_INFO - ("exit - waited too long for master assert stop\n"); - return -EIO; - } - - write_register(priv->net_dev, IPW_REG_RESET_REG, - IPW_AUX_HOST_RESET_REG_SW_RESET); - - /* Reset any fatal_error conditions */ - ipw2100_reset_fatalerror(priv); - - /* At this point, the adapter is now stopped and disabled */ - priv->status &= ~(STATUS_RUNNING | STATUS_ASSOCIATING | - STATUS_ASSOCIATED | STATUS_ENABLED); - - return 0; -} - -/* - * Send the CARD_DISABLE_PHY_OFF command to the card to disable it - * - * After disabling, if the card was associated, a STATUS_ASSN_LOST will be sent. - * - * STATUS_CARD_DISABLE_NOTIFICATION will be sent regardless of - * if STATUS_ASSN_LOST is sent. - */ -static int ipw2100_hw_phy_off(struct ipw2100_priv *priv) -{ - -#define HW_PHY_OFF_LOOP_DELAY (HZ / 5000) - - struct host_command cmd = { - .host_command = CARD_DISABLE_PHY_OFF, - .host_command_sequence = 0, - .host_command_length = 0, - }; - int err, i; - u32 val1, val2; - - IPW_DEBUG_HC("CARD_DISABLE_PHY_OFF\n"); - - /* Turn off the radio */ - err = ipw2100_hw_send_command(priv, &cmd); - if (err) - return err; - - for (i = 0; i < 2500; i++) { - read_nic_dword(priv->net_dev, IPW2100_CONTROL_REG, &val1); - read_nic_dword(priv->net_dev, IPW2100_COMMAND, &val2); - - if ((val1 & IPW2100_CONTROL_PHY_OFF) && - (val2 & IPW2100_COMMAND_PHY_OFF)) - return 0; - - schedule_timeout_uninterruptible(HW_PHY_OFF_LOOP_DELAY); - } - - return -EIO; -} - -static int ipw2100_enable_adapter(struct ipw2100_priv *priv) -{ - struct host_command cmd = { - .host_command = HOST_COMPLETE, - .host_command_sequence = 0, - .host_command_length = 0 - }; - int err = 0; - - IPW_DEBUG_HC("HOST_COMPLETE\n"); - - if (priv->status & STATUS_ENABLED) - return 0; - - mutex_lock(&priv->adapter_mutex); - - if (rf_kill_active(priv)) { - IPW_DEBUG_HC("Command aborted due to RF kill active.\n"); - goto fail_up; - } - - err = ipw2100_hw_send_command(priv, &cmd); - if (err) { - IPW_DEBUG_INFO("Failed to send HOST_COMPLETE command\n"); - goto fail_up; - } - - err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_ENABLED); - if (err) { - IPW_DEBUG_INFO("%s: card not responding to init command.\n", - priv->net_dev->name); - goto fail_up; - } - - if (priv->stop_hang_check) { - priv->stop_hang_check = 0; - schedule_delayed_work(&priv->hang_check, HZ / 2); - } - - fail_up: - mutex_unlock(&priv->adapter_mutex); - return err; -} - -static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv) -{ -#define HW_POWER_DOWN_DELAY (msecs_to_jiffies(100)) - - struct host_command cmd = { - .host_command = HOST_PRE_POWER_DOWN, - .host_command_sequence = 0, - .host_command_length = 0, - }; - int err, i; - u32 reg; - - if (!(priv->status & STATUS_RUNNING)) - return 0; - - priv->status |= STATUS_STOPPING; - - /* We can only shut down the card if the firmware is operational. So, - * if we haven't reset since a fatal_error, then we can not send the - * shutdown commands. */ - if (!priv->fatal_error) { - /* First, make sure the adapter is enabled so that the PHY_OFF - * command can shut it down */ - ipw2100_enable_adapter(priv); - - err = ipw2100_hw_phy_off(priv); - if (err) - printk(KERN_WARNING DRV_NAME - ": Error disabling radio %d\n", err); - - /* - * If in D0-standby mode going directly to D3 may cause a - * PCI bus violation. Therefore we must change out of the D0 - * state. - * - * Sending the PREPARE_FOR_POWER_DOWN will restrict the - * hardware from going into standby mode and will transition - * out of D0-standby if it is already in that state. - * - * STATUS_PREPARE_POWER_DOWN_COMPLETE will be sent by the - * driver upon completion. Once received, the driver can - * proceed to the D3 state. - * - * Prepare for power down command to fw. This command would - * take HW out of D0-standby and prepare it for D3 state. - * - * Currently FW does not support event notification for this - * event. Therefore, skip waiting for it. Just wait a fixed - * 100ms - */ - IPW_DEBUG_HC("HOST_PRE_POWER_DOWN\n"); - - err = ipw2100_hw_send_command(priv, &cmd); - if (err) - printk(KERN_WARNING DRV_NAME ": " - "%s: Power down command failed: Error %d\n", - priv->net_dev->name, err); - else - schedule_timeout_uninterruptible(HW_POWER_DOWN_DELAY); - } - - priv->status &= ~STATUS_ENABLED; - - /* - * Set GPIO 3 writable by FW; GPIO 1 writable - * by driver and enable clock - */ - ipw2100_hw_set_gpio(priv); - - /* - * Power down adapter. Sequence: - * 1. Stop master assert (RESET_REG[9]=1) - * 2. Wait for stop master (RESET_REG[8]==1) - * 3. S/w reset assert (RESET_REG[7] = 1) - */ - - /* Stop master assert */ - write_register(priv->net_dev, IPW_REG_RESET_REG, - IPW_AUX_HOST_RESET_REG_STOP_MASTER); - - /* wait stop master not more than 50 usec. - * Otherwise return error. */ - for (i = 5; i > 0; i--) { - udelay(10); - - /* Check master stop bit */ - read_register(priv->net_dev, IPW_REG_RESET_REG, ®); - - if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) - break; - } - - if (i == 0) - printk(KERN_WARNING DRV_NAME - ": %s: Could now power down adapter.\n", - priv->net_dev->name); - - /* assert s/w reset */ - write_register(priv->net_dev, IPW_REG_RESET_REG, - IPW_AUX_HOST_RESET_REG_SW_RESET); - - priv->status &= ~(STATUS_RUNNING | STATUS_STOPPING); - - return 0; -} - -static int ipw2100_disable_adapter(struct ipw2100_priv *priv) -{ - struct host_command cmd = { - .host_command = CARD_DISABLE, - .host_command_sequence = 0, - .host_command_length = 0 - }; - int err = 0; - - IPW_DEBUG_HC("CARD_DISABLE\n"); - - if (!(priv->status & STATUS_ENABLED)) - return 0; - - /* Make sure we clear the associated state */ - priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); - - if (!priv->stop_hang_check) { - priv->stop_hang_check = 1; - cancel_delayed_work(&priv->hang_check); - } - - mutex_lock(&priv->adapter_mutex); - - err = ipw2100_hw_send_command(priv, &cmd); - if (err) { - printk(KERN_WARNING DRV_NAME - ": exit - failed to send CARD_DISABLE command\n"); - goto fail_up; - } - - err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_DISABLED); - if (err) { - printk(KERN_WARNING DRV_NAME - ": exit - card failed to change to DISABLED\n"); - goto fail_up; - } - - IPW_DEBUG_INFO("TODO: implement scan state machine\n"); - - fail_up: - mutex_unlock(&priv->adapter_mutex); - return err; -} - -static int ipw2100_set_scan_options(struct ipw2100_priv *priv) -{ - struct host_command cmd = { - .host_command = SET_SCAN_OPTIONS, - .host_command_sequence = 0, - .host_command_length = 8 - }; - int err; - - IPW_DEBUG_INFO("enter\n"); - - IPW_DEBUG_SCAN("setting scan options\n"); - - cmd.host_command_parameters[0] = 0; - - if (!(priv->config & CFG_ASSOCIATE)) - cmd.host_command_parameters[0] |= IPW_SCAN_NOASSOCIATE; - if ((priv->ieee->sec.flags & SEC_ENABLED) && priv->ieee->sec.enabled) - cmd.host_command_parameters[0] |= IPW_SCAN_MIXED_CELL; - if (priv->config & CFG_PASSIVE_SCAN) - cmd.host_command_parameters[0] |= IPW_SCAN_PASSIVE; - - cmd.host_command_parameters[1] = priv->channel_mask; - - err = ipw2100_hw_send_command(priv, &cmd); - - IPW_DEBUG_HC("SET_SCAN_OPTIONS 0x%04X\n", - cmd.host_command_parameters[0]); - - return err; -} - -static int ipw2100_start_scan(struct ipw2100_priv *priv) -{ - struct host_command cmd = { - .host_command = BROADCAST_SCAN, - .host_command_sequence = 0, - .host_command_length = 4 - }; - int err; - - IPW_DEBUG_HC("START_SCAN\n"); - - cmd.host_command_parameters[0] = 0; - - /* No scanning if in monitor mode */ - if (priv->ieee->iw_mode == IW_MODE_MONITOR) - return 1; - - if (priv->status & STATUS_SCANNING) { - IPW_DEBUG_SCAN("Scan requested while already in scan...\n"); - return 0; - } - - IPW_DEBUG_INFO("enter\n"); - - /* Not clearing here; doing so makes iwlist always return nothing... - * - * We should modify the table logic to use aging tables vs. clearing - * the table on each scan start. - */ - IPW_DEBUG_SCAN("starting scan\n"); - - priv->status |= STATUS_SCANNING; - err = ipw2100_hw_send_command(priv, &cmd); - if (err) - priv->status &= ~STATUS_SCANNING; - - IPW_DEBUG_INFO("exit\n"); - - return err; -} - -static const struct libipw_geo ipw_geos[] = { - { /* Restricted */ - "---", - .bg_channels = 14, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}, {2467, 12}, - {2472, 13}, {2484, 14}}, - }, -}; - -static int ipw2100_up(struct ipw2100_priv *priv, int deferred) -{ - unsigned long flags; - int rc = 0; - u32 lock; - u32 ord_len = sizeof(lock); - - /* Age scan list entries found before suspend */ - if (priv->suspend_time) { - libipw_networks_age(priv->ieee, priv->suspend_time); - priv->suspend_time = 0; - } - - /* Quiet if manually disabled. */ - if (priv->status & STATUS_RF_KILL_SW) { - IPW_DEBUG_INFO("%s: Radio is disabled by Manual Disable " - "switch\n", priv->net_dev->name); - return 0; - } - - /* the ipw2100 hardware really doesn't want power management delays - * longer than 175usec - */ - pm_qos_update_request(&ipw2100_pm_qos_req, 175); - - /* If the interrupt is enabled, turn it off... */ - spin_lock_irqsave(&priv->low_lock, flags); - ipw2100_disable_interrupts(priv); - - /* Reset any fatal_error conditions */ - ipw2100_reset_fatalerror(priv); - spin_unlock_irqrestore(&priv->low_lock, flags); - - if (priv->status & STATUS_POWERED || - (priv->status & STATUS_RESET_PENDING)) { - /* Power cycle the card ... */ - if (ipw2100_power_cycle_adapter(priv)) { - printk(KERN_WARNING DRV_NAME - ": %s: Could not cycle adapter.\n", - priv->net_dev->name); - rc = 1; - goto exit; - } - } else - priv->status |= STATUS_POWERED; - - /* Load the firmware, start the clocks, etc. */ - if (ipw2100_start_adapter(priv)) { - printk(KERN_ERR DRV_NAME - ": %s: Failed to start the firmware.\n", - priv->net_dev->name); - rc = 1; - goto exit; - } - - ipw2100_initialize_ordinals(priv); - - /* Determine capabilities of this particular HW configuration */ - if (ipw2100_get_hw_features(priv)) { - printk(KERN_ERR DRV_NAME - ": %s: Failed to determine HW features.\n", - priv->net_dev->name); - rc = 1; - goto exit; - } - - /* Initialize the geo */ - libipw_set_geo(priv->ieee, &ipw_geos[0]); - priv->ieee->freq_band = LIBIPW_24GHZ_BAND; - - lock = LOCK_NONE; - if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) { - printk(KERN_ERR DRV_NAME - ": %s: Failed to clear ordinal lock.\n", - priv->net_dev->name); - rc = 1; - goto exit; - } - - priv->status &= ~STATUS_SCANNING; - - if (rf_kill_active(priv)) { - printk(KERN_INFO "%s: Radio is disabled by RF switch.\n", - priv->net_dev->name); - - if (priv->stop_rf_kill) { - priv->stop_rf_kill = 0; - schedule_delayed_work(&priv->rf_kill, - round_jiffies_relative(HZ)); - } - - deferred = 1; - } - - /* Turn on the interrupt so that commands can be processed */ - ipw2100_enable_interrupts(priv); - - /* Send all of the commands that must be sent prior to - * HOST_COMPLETE */ - if (ipw2100_adapter_setup(priv)) { - printk(KERN_ERR DRV_NAME ": %s: Failed to start the card.\n", - priv->net_dev->name); - rc = 1; - goto exit; - } - - if (!deferred) { - /* Enable the adapter - sends HOST_COMPLETE */ - if (ipw2100_enable_adapter(priv)) { - printk(KERN_ERR DRV_NAME ": " - "%s: failed in call to enable adapter.\n", - priv->net_dev->name); - ipw2100_hw_stop_adapter(priv); - rc = 1; - goto exit; - } - - /* Start a scan . . . */ - ipw2100_set_scan_options(priv); - ipw2100_start_scan(priv); - } - - exit: - return rc; -} - -static void ipw2100_down(struct ipw2100_priv *priv) -{ - unsigned long flags; - union iwreq_data wrqu = { - .ap_addr = { - .sa_family = ARPHRD_ETHER} - }; - int associated = priv->status & STATUS_ASSOCIATED; - - /* Kill the RF switch timer */ - if (!priv->stop_rf_kill) { - priv->stop_rf_kill = 1; - cancel_delayed_work(&priv->rf_kill); - } - - /* Kill the firmware hang check timer */ - if (!priv->stop_hang_check) { - priv->stop_hang_check = 1; - cancel_delayed_work(&priv->hang_check); - } - - /* Kill any pending resets */ - if (priv->status & STATUS_RESET_PENDING) - cancel_delayed_work(&priv->reset_work); - - /* Make sure the interrupt is on so that FW commands will be - * processed correctly */ - spin_lock_irqsave(&priv->low_lock, flags); - ipw2100_enable_interrupts(priv); - spin_unlock_irqrestore(&priv->low_lock, flags); - - if (ipw2100_hw_stop_adapter(priv)) - printk(KERN_ERR DRV_NAME ": %s: Error stopping adapter.\n", - priv->net_dev->name); - - /* Do not disable the interrupt until _after_ we disable - * the adaptor. Otherwise the CARD_DISABLE command will never - * be ack'd by the firmware */ - spin_lock_irqsave(&priv->low_lock, flags); - ipw2100_disable_interrupts(priv); - spin_unlock_irqrestore(&priv->low_lock, flags); - - pm_qos_update_request(&ipw2100_pm_qos_req, PM_QOS_DEFAULT_VALUE); - - /* We have to signal any supplicant if we are disassociating */ - if (associated) - wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); - - priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); - netif_carrier_off(priv->net_dev); - netif_stop_queue(priv->net_dev); -} - -static int ipw2100_wdev_init(struct net_device *dev) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - const struct libipw_geo *geo = libipw_get_geo(priv->ieee); - struct wireless_dev *wdev = &priv->ieee->wdev; - int i; - - memcpy(wdev->wiphy->perm_addr, priv->mac_addr, ETH_ALEN); - - /* fill-out priv->ieee->bg_band */ - if (geo->bg_channels) { - struct ieee80211_supported_band *bg_band = &priv->ieee->bg_band; - - bg_band->band = IEEE80211_BAND_2GHZ; - bg_band->n_channels = geo->bg_channels; - bg_band->channels = kcalloc(geo->bg_channels, - sizeof(struct ieee80211_channel), - GFP_KERNEL); - if (!bg_band->channels) { - ipw2100_down(priv); - return -ENOMEM; - } - /* translate geo->bg to bg_band.channels */ - for (i = 0; i < geo->bg_channels; i++) { - bg_band->channels[i].band = IEEE80211_BAND_2GHZ; - bg_band->channels[i].center_freq = geo->bg[i].freq; - bg_band->channels[i].hw_value = geo->bg[i].channel; - bg_band->channels[i].max_power = geo->bg[i].max_power; - if (geo->bg[i].flags & LIBIPW_CH_PASSIVE_ONLY) - bg_band->channels[i].flags |= - IEEE80211_CHAN_PASSIVE_SCAN; - if (geo->bg[i].flags & LIBIPW_CH_NO_IBSS) - bg_band->channels[i].flags |= - IEEE80211_CHAN_NO_IBSS; - if (geo->bg[i].flags & LIBIPW_CH_RADAR_DETECT) - bg_band->channels[i].flags |= - IEEE80211_CHAN_RADAR; - /* No equivalent for LIBIPW_CH_80211H_RULES, - LIBIPW_CH_UNIFORM_SPREADING, or - LIBIPW_CH_B_ONLY... */ - } - /* point at bitrate info */ - bg_band->bitrates = ipw2100_bg_rates; - bg_band->n_bitrates = RATE_COUNT; - - wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = bg_band; - } - - wdev->wiphy->cipher_suites = ipw_cipher_suites; - wdev->wiphy->n_cipher_suites = ARRAY_SIZE(ipw_cipher_suites); - - set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev); - if (wiphy_register(wdev->wiphy)) - return -EIO; - return 0; -} - -static void ipw2100_reset_adapter(struct work_struct *work) -{ - struct ipw2100_priv *priv = - container_of(work, struct ipw2100_priv, reset_work.work); - unsigned long flags; - union iwreq_data wrqu = { - .ap_addr = { - .sa_family = ARPHRD_ETHER} - }; - int associated = priv->status & STATUS_ASSOCIATED; - - spin_lock_irqsave(&priv->low_lock, flags); - IPW_DEBUG_INFO(": %s: Restarting adapter.\n", priv->net_dev->name); - priv->resets++; - priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); - priv->status |= STATUS_SECURITY_UPDATED; - - /* Force a power cycle even if interface hasn't been opened - * yet */ - cancel_delayed_work(&priv->reset_work); - priv->status |= STATUS_RESET_PENDING; - spin_unlock_irqrestore(&priv->low_lock, flags); - - mutex_lock(&priv->action_mutex); - /* stop timed checks so that they don't interfere with reset */ - priv->stop_hang_check = 1; - cancel_delayed_work(&priv->hang_check); - - /* We have to signal any supplicant if we are disassociating */ - if (associated) - wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); - - ipw2100_up(priv, 0); - mutex_unlock(&priv->action_mutex); - -} - -static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) -{ - -#define MAC_ASSOCIATION_READ_DELAY (HZ) - int ret; - unsigned int len, essid_len; - char essid[IW_ESSID_MAX_SIZE]; - u32 txrate; - u32 chan; - char *txratename; - u8 bssid[ETH_ALEN]; - DECLARE_SSID_BUF(ssid); - - /* - * TBD: BSSID is usually 00:00:00:00:00:00 here and not - * an actual MAC of the AP. Seems like FW sets this - * address too late. Read it later and expose through - * /proc or schedule a later task to query and update - */ - - essid_len = IW_ESSID_MAX_SIZE; - ret = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_SSID, - essid, &essid_len); - if (ret) { - IPW_DEBUG_INFO("failed querying ordinals at line %d\n", - __LINE__); - return; - } - - len = sizeof(u32); - ret = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, &txrate, &len); - if (ret) { - IPW_DEBUG_INFO("failed querying ordinals at line %d\n", - __LINE__); - return; - } - - len = sizeof(u32); - ret = ipw2100_get_ordinal(priv, IPW_ORD_OUR_FREQ, &chan, &len); - if (ret) { - IPW_DEBUG_INFO("failed querying ordinals at line %d\n", - __LINE__); - return; - } - len = ETH_ALEN; - ret = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, bssid, - &len); - if (ret) { - IPW_DEBUG_INFO("failed querying ordinals at line %d\n", - __LINE__); - return; - } - memcpy(priv->ieee->bssid, bssid, ETH_ALEN); - - switch (txrate) { - case TX_RATE_1_MBIT: - txratename = "1Mbps"; - break; - case TX_RATE_2_MBIT: - txratename = "2Mbsp"; - break; - case TX_RATE_5_5_MBIT: - txratename = "5.5Mbps"; - break; - case TX_RATE_11_MBIT: - txratename = "11Mbps"; - break; - default: - IPW_DEBUG_INFO("Unknown rate: %d\n", txrate); - txratename = "unknown rate"; - break; - } - - IPW_DEBUG_INFO("%s: Associated with '%s' at %s, channel %d (BSSID=%pM)\n", - priv->net_dev->name, print_ssid(ssid, essid, essid_len), - txratename, chan, bssid); - - /* now we copy read ssid into dev */ - if (!(priv->config & CFG_STATIC_ESSID)) { - priv->essid_len = min((u8) essid_len, (u8) IW_ESSID_MAX_SIZE); - memcpy(priv->essid, essid, priv->essid_len); - } - priv->channel = chan; - memcpy(priv->bssid, bssid, ETH_ALEN); - - priv->status |= STATUS_ASSOCIATING; - priv->connect_start = get_seconds(); - - schedule_delayed_work(&priv->wx_event_work, HZ / 10); -} - -static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, - int length, int batch_mode) -{ - int ssid_len = min(length, IW_ESSID_MAX_SIZE); - struct host_command cmd = { - .host_command = SSID, - .host_command_sequence = 0, - .host_command_length = ssid_len - }; - int err; - DECLARE_SSID_BUF(ssid); - - IPW_DEBUG_HC("SSID: '%s'\n", print_ssid(ssid, essid, ssid_len)); - - if (ssid_len) - memcpy(cmd.host_command_parameters, essid, ssid_len); - - if (!batch_mode) { - err = ipw2100_disable_adapter(priv); - if (err) - return err; - } - - /* Bug in FW currently doesn't honor bit 0 in SET_SCAN_OPTIONS to - * disable auto association -- so we cheat by setting a bogus SSID */ - if (!ssid_len && !(priv->config & CFG_ASSOCIATE)) { - int i; - u8 *bogus = (u8 *) cmd.host_command_parameters; - for (i = 0; i < IW_ESSID_MAX_SIZE; i++) - bogus[i] = 0x18 + i; - cmd.host_command_length = IW_ESSID_MAX_SIZE; - } - - /* NOTE: We always send the SSID command even if the provided ESSID is - * the same as what we currently think is set. */ - - err = ipw2100_hw_send_command(priv, &cmd); - if (!err) { - memset(priv->essid + ssid_len, 0, IW_ESSID_MAX_SIZE - ssid_len); - memcpy(priv->essid, essid, ssid_len); - priv->essid_len = ssid_len; - } - - if (!batch_mode) { - if (ipw2100_enable_adapter(priv)) - err = -EIO; - } - - return err; -} - -static void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status) -{ - DECLARE_SSID_BUF(ssid); - - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, - "disassociated: '%s' %pM\n", - print_ssid(ssid, priv->essid, priv->essid_len), - priv->bssid); - - priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); - - if (priv->status & STATUS_STOPPING) { - IPW_DEBUG_INFO("Card is stopping itself, discard ASSN_LOST.\n"); - return; - } - - memset(priv->bssid, 0, ETH_ALEN); - memset(priv->ieee->bssid, 0, ETH_ALEN); - - netif_carrier_off(priv->net_dev); - netif_stop_queue(priv->net_dev); - - if (!(priv->status & STATUS_RUNNING)) - return; - - if (priv->status & STATUS_SECURITY_UPDATED) - schedule_delayed_work(&priv->security_work, 0); - - schedule_delayed_work(&priv->wx_event_work, 0); -} - -static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status) -{ - IPW_DEBUG_INFO("%s: RF Kill state changed to radio OFF.\n", - priv->net_dev->name); - - /* RF_KILL is now enabled (else we wouldn't be here) */ - wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, true); - priv->status |= STATUS_RF_KILL_HW; - - /* Make sure the RF Kill check timer is running */ - priv->stop_rf_kill = 0; - mod_delayed_work(system_wq, &priv->rf_kill, round_jiffies_relative(HZ)); -} - -static void ipw2100_scan_event(struct work_struct *work) -{ - struct ipw2100_priv *priv = container_of(work, struct ipw2100_priv, - scan_event.work); - union iwreq_data wrqu; - - wrqu.data.length = 0; - wrqu.data.flags = 0; - wireless_send_event(priv->net_dev, SIOCGIWSCAN, &wrqu, NULL); -} - -static void isr_scan_complete(struct ipw2100_priv *priv, u32 status) -{ - IPW_DEBUG_SCAN("scan complete\n"); - /* Age the scan results... */ - priv->ieee->scans++; - priv->status &= ~STATUS_SCANNING; - - /* Only userspace-requested scan completion events go out immediately */ - if (!priv->user_requested_scan) { - schedule_delayed_work(&priv->scan_event, - round_jiffies_relative(msecs_to_jiffies(4000))); - } else { - priv->user_requested_scan = 0; - mod_delayed_work(system_wq, &priv->scan_event, 0); - } -} - -#ifdef CONFIG_IPW2100_DEBUG -#define IPW2100_HANDLER(v, f) { v, f, # v } -struct ipw2100_status_indicator { - int status; - void (*cb) (struct ipw2100_priv * priv, u32 status); - char *name; -}; -#else -#define IPW2100_HANDLER(v, f) { v, f } -struct ipw2100_status_indicator { - int status; - void (*cb) (struct ipw2100_priv * priv, u32 status); -}; -#endif /* CONFIG_IPW2100_DEBUG */ - -static void isr_indicate_scanning(struct ipw2100_priv *priv, u32 status) -{ - IPW_DEBUG_SCAN("Scanning...\n"); - priv->status |= STATUS_SCANNING; -} - -static const struct ipw2100_status_indicator status_handlers[] = { - IPW2100_HANDLER(IPW_STATE_INITIALIZED, NULL), - IPW2100_HANDLER(IPW_STATE_COUNTRY_FOUND, NULL), - IPW2100_HANDLER(IPW_STATE_ASSOCIATED, isr_indicate_associated), - IPW2100_HANDLER(IPW_STATE_ASSN_LOST, isr_indicate_association_lost), - IPW2100_HANDLER(IPW_STATE_ASSN_CHANGED, NULL), - IPW2100_HANDLER(IPW_STATE_SCAN_COMPLETE, isr_scan_complete), - IPW2100_HANDLER(IPW_STATE_ENTERED_PSP, NULL), - IPW2100_HANDLER(IPW_STATE_LEFT_PSP, NULL), - IPW2100_HANDLER(IPW_STATE_RF_KILL, isr_indicate_rf_kill), - IPW2100_HANDLER(IPW_STATE_DISABLED, NULL), - IPW2100_HANDLER(IPW_STATE_POWER_DOWN, NULL), - IPW2100_HANDLER(IPW_STATE_SCANNING, isr_indicate_scanning), - IPW2100_HANDLER(-1, NULL) -}; - -static void isr_status_change(struct ipw2100_priv *priv, int status) -{ - int i; - - if (status == IPW_STATE_SCANNING && - priv->status & STATUS_ASSOCIATED && - !(priv->status & STATUS_SCANNING)) { - IPW_DEBUG_INFO("Scan detected while associated, with " - "no scan request. Restarting firmware.\n"); - - /* Wake up any sleeping jobs */ - schedule_reset(priv); - } - - for (i = 0; status_handlers[i].status != -1; i++) { - if (status == status_handlers[i].status) { - IPW_DEBUG_NOTIF("Status change: %s\n", - status_handlers[i].name); - if (status_handlers[i].cb) - status_handlers[i].cb(priv, status); - priv->wstats.status = status; - return; - } - } - - IPW_DEBUG_NOTIF("unknown status received: %04x\n", status); -} - -static void isr_rx_complete_command(struct ipw2100_priv *priv, - struct ipw2100_cmd_header *cmd) -{ -#ifdef CONFIG_IPW2100_DEBUG - if (cmd->host_command_reg < ARRAY_SIZE(command_types)) { - IPW_DEBUG_HC("Command completed '%s (%d)'\n", - command_types[cmd->host_command_reg], - cmd->host_command_reg); - } -#endif - if (cmd->host_command_reg == HOST_COMPLETE) - priv->status |= STATUS_ENABLED; - - if (cmd->host_command_reg == CARD_DISABLE) - priv->status &= ~STATUS_ENABLED; - - priv->status &= ~STATUS_CMD_ACTIVE; - - wake_up_interruptible(&priv->wait_command_queue); -} - -#ifdef CONFIG_IPW2100_DEBUG -static const char *frame_types[] = { - "COMMAND_STATUS_VAL", - "STATUS_CHANGE_VAL", - "P80211_DATA_VAL", - "P8023_DATA_VAL", - "HOST_NOTIFICATION_VAL" -}; -#endif - -static int ipw2100_alloc_skb(struct ipw2100_priv *priv, - struct ipw2100_rx_packet *packet) -{ - packet->skb = dev_alloc_skb(sizeof(struct ipw2100_rx)); - if (!packet->skb) - return -ENOMEM; - - packet->rxp = (struct ipw2100_rx *)packet->skb->data; - packet->dma_addr = pci_map_single(priv->pci_dev, packet->skb->data, - sizeof(struct ipw2100_rx), - PCI_DMA_FROMDEVICE); - /* NOTE: pci_map_single does not return an error code, and 0 is a valid - * dma_addr */ - - return 0; -} - -#define SEARCH_ERROR 0xffffffff -#define SEARCH_FAIL 0xfffffffe -#define SEARCH_SUCCESS 0xfffffff0 -#define SEARCH_DISCARD 0 -#define SEARCH_SNAPSHOT 1 - -#define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) -static void ipw2100_snapshot_free(struct ipw2100_priv *priv) -{ - int i; - if (!priv->snapshot[0]) - return; - for (i = 0; i < 0x30; i++) - kfree(priv->snapshot[i]); - priv->snapshot[0] = NULL; -} - -#ifdef IPW2100_DEBUG_C3 -static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) -{ - int i; - if (priv->snapshot[0]) - return 1; - for (i = 0; i < 0x30; i++) { - priv->snapshot[i] = kmalloc(0x1000, GFP_ATOMIC); - if (!priv->snapshot[i]) { - IPW_DEBUG_INFO("%s: Error allocating snapshot " - "buffer %d\n", priv->net_dev->name, i); - while (i > 0) - kfree(priv->snapshot[--i]); - priv->snapshot[0] = NULL; - return 0; - } - } - - return 1; -} - -static u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf, - size_t len, int mode) -{ - u32 i, j; - u32 tmp; - u8 *s, *d; - u32 ret; - - s = in_buf; - if (mode == SEARCH_SNAPSHOT) { - if (!ipw2100_snapshot_alloc(priv)) - mode = SEARCH_DISCARD; - } - - for (ret = SEARCH_FAIL, i = 0; i < 0x30000; i += 4) { - read_nic_dword(priv->net_dev, i, &tmp); - if (mode == SEARCH_SNAPSHOT) - *(u32 *) SNAPSHOT_ADDR(i) = tmp; - if (ret == SEARCH_FAIL) { - d = (u8 *) & tmp; - for (j = 0; j < 4; j++) { - if (*s != *d) { - s = in_buf; - continue; - } - - s++; - d++; - - if ((s - in_buf) == len) - ret = (i + j) - len + 1; - } - } else if (mode == SEARCH_DISCARD) - return ret; - } - - return ret; -} -#endif - -/* - * - * 0) Disconnect the SKB from the firmware (just unmap) - * 1) Pack the ETH header into the SKB - * 2) Pass the SKB to the network stack - * - * When packet is provided by the firmware, it contains the following: - * - * . libipw_hdr - * . libipw_snap_hdr - * - * The size of the constructed ethernet - * - */ -#ifdef IPW2100_RX_DEBUG -static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH]; -#endif - -static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i) -{ -#ifdef IPW2100_DEBUG_C3 - struct ipw2100_status *status = &priv->status_queue.drv[i]; - u32 match, reg; - int j; -#endif - - IPW_DEBUG_INFO(": PCI latency error detected at 0x%04zX.\n", - i * sizeof(struct ipw2100_status)); - -#ifdef IPW2100_DEBUG_C3 - /* Halt the firmware so we can get a good image */ - write_register(priv->net_dev, IPW_REG_RESET_REG, - IPW_AUX_HOST_RESET_REG_STOP_MASTER); - j = 5; - do { - udelay(IPW_WAIT_RESET_MASTER_ASSERT_COMPLETE_DELAY); - read_register(priv->net_dev, IPW_REG_RESET_REG, ®); - - if (reg & IPW_AUX_HOST_RESET_REG_MASTER_DISABLED) - break; - } while (j--); - - match = ipw2100_match_buf(priv, (u8 *) status, - sizeof(struct ipw2100_status), - SEARCH_SNAPSHOT); - if (match < SEARCH_SUCCESS) - IPW_DEBUG_INFO("%s: DMA status match in Firmware at " - "offset 0x%06X, length %d:\n", - priv->net_dev->name, match, - sizeof(struct ipw2100_status)); - else - IPW_DEBUG_INFO("%s: No DMA status match in " - "Firmware.\n", priv->net_dev->name); - - printk_buf((u8 *) priv->status_queue.drv, - sizeof(struct ipw2100_status) * RX_QUEUE_LENGTH); -#endif - - priv->fatal_error = IPW2100_ERR_C3_CORRUPTION; - priv->net_dev->stats.rx_errors++; - schedule_reset(priv); -} - -static void isr_rx(struct ipw2100_priv *priv, int i, - struct libipw_rx_stats *stats) -{ - struct net_device *dev = priv->net_dev; - struct ipw2100_status *status = &priv->status_queue.drv[i]; - struct ipw2100_rx_packet *packet = &priv->rx_buffers[i]; - - IPW_DEBUG_RX("Handler...\n"); - - if (unlikely(status->frame_size > skb_tailroom(packet->skb))) { - IPW_DEBUG_INFO("%s: frame_size (%u) > skb_tailroom (%u)!" - " Dropping.\n", - dev->name, - status->frame_size, skb_tailroom(packet->skb)); - dev->stats.rx_errors++; - return; - } - - if (unlikely(!netif_running(dev))) { - dev->stats.rx_errors++; - priv->wstats.discard.misc++; - IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); - return; - } - - if (unlikely(priv->ieee->iw_mode != IW_MODE_MONITOR && - !(priv->status & STATUS_ASSOCIATED))) { - IPW_DEBUG_DROP("Dropping packet while not associated.\n"); - priv->wstats.discard.misc++; - return; - } - - pci_unmap_single(priv->pci_dev, - packet->dma_addr, - sizeof(struct ipw2100_rx), PCI_DMA_FROMDEVICE); - - skb_put(packet->skb, status->frame_size); - -#ifdef IPW2100_RX_DEBUG - /* Make a copy of the frame so we can dump it to the logs if - * libipw_rx fails */ - skb_copy_from_linear_data(packet->skb, packet_data, - min_t(u32, status->frame_size, - IPW_RX_NIC_BUFFER_LENGTH)); -#endif - - if (!libipw_rx(priv->ieee, packet->skb, stats)) { -#ifdef IPW2100_RX_DEBUG - IPW_DEBUG_DROP("%s: Non consumed packet:\n", - dev->name); - printk_buf(IPW_DL_DROP, packet_data, status->frame_size); -#endif - dev->stats.rx_errors++; - - /* libipw_rx failed, so it didn't free the SKB */ - dev_kfree_skb_any(packet->skb); - packet->skb = NULL; - } - - /* We need to allocate a new SKB and attach it to the RDB. */ - if (unlikely(ipw2100_alloc_skb(priv, packet))) { - printk(KERN_WARNING DRV_NAME ": " - "%s: Unable to allocate SKB onto RBD ring - disabling " - "adapter.\n", dev->name); - /* TODO: schedule adapter shutdown */ - IPW_DEBUG_INFO("TODO: Shutdown adapter...\n"); - } - - /* Update the RDB entry */ - priv->rx_queue.drv[i].host_addr = packet->dma_addr; -} - -#ifdef CONFIG_IPW2100_MONITOR - -static void isr_rx_monitor(struct ipw2100_priv *priv, int i, - struct libipw_rx_stats *stats) -{ - struct net_device *dev = priv->net_dev; - struct ipw2100_status *status = &priv->status_queue.drv[i]; - struct ipw2100_rx_packet *packet = &priv->rx_buffers[i]; - - /* Magic struct that slots into the radiotap header -- no reason - * to build this manually element by element, we can write it much - * more efficiently than we can parse it. ORDER MATTERS HERE */ - struct ipw_rt_hdr { - struct ieee80211_radiotap_header rt_hdr; - s8 rt_dbmsignal; /* signal in dbM, kluged to signed */ - } *ipw_rt; - - IPW_DEBUG_RX("Handler...\n"); - - if (unlikely(status->frame_size > skb_tailroom(packet->skb) - - sizeof(struct ipw_rt_hdr))) { - IPW_DEBUG_INFO("%s: frame_size (%u) > skb_tailroom (%u)!" - " Dropping.\n", - dev->name, - status->frame_size, - skb_tailroom(packet->skb)); - dev->stats.rx_errors++; - return; - } - - if (unlikely(!netif_running(dev))) { - dev->stats.rx_errors++; - priv->wstats.discard.misc++; - IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); - return; - } - - if (unlikely(priv->config & CFG_CRC_CHECK && - status->flags & IPW_STATUS_FLAG_CRC_ERROR)) { - IPW_DEBUG_RX("CRC error in packet. Dropping.\n"); - dev->stats.rx_errors++; - return; - } - - pci_unmap_single(priv->pci_dev, packet->dma_addr, - sizeof(struct ipw2100_rx), PCI_DMA_FROMDEVICE); - memmove(packet->skb->data + sizeof(struct ipw_rt_hdr), - packet->skb->data, status->frame_size); - - ipw_rt = (struct ipw_rt_hdr *) packet->skb->data; - - ipw_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; - ipw_rt->rt_hdr.it_pad = 0; /* always good to zero */ - ipw_rt->rt_hdr.it_len = cpu_to_le16(sizeof(struct ipw_rt_hdr)); /* total hdr+data */ - - ipw_rt->rt_hdr.it_present = cpu_to_le32(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL); - - ipw_rt->rt_dbmsignal = status->rssi + IPW2100_RSSI_TO_DBM; - - skb_put(packet->skb, status->frame_size + sizeof(struct ipw_rt_hdr)); - - if (!libipw_rx(priv->ieee, packet->skb, stats)) { - dev->stats.rx_errors++; - - /* libipw_rx failed, so it didn't free the SKB */ - dev_kfree_skb_any(packet->skb); - packet->skb = NULL; - } - - /* We need to allocate a new SKB and attach it to the RDB. */ - if (unlikely(ipw2100_alloc_skb(priv, packet))) { - IPW_DEBUG_WARNING( - "%s: Unable to allocate SKB onto RBD ring - disabling " - "adapter.\n", dev->name); - /* TODO: schedule adapter shutdown */ - IPW_DEBUG_INFO("TODO: Shutdown adapter...\n"); - } - - /* Update the RDB entry */ - priv->rx_queue.drv[i].host_addr = packet->dma_addr; -} - -#endif - -static int ipw2100_corruption_check(struct ipw2100_priv *priv, int i) -{ - struct ipw2100_status *status = &priv->status_queue.drv[i]; - struct ipw2100_rx *u = priv->rx_buffers[i].rxp; - u16 frame_type = status->status_fields & STATUS_TYPE_MASK; - - switch (frame_type) { - case COMMAND_STATUS_VAL: - return (status->frame_size != sizeof(u->rx_data.command)); - case STATUS_CHANGE_VAL: - return (status->frame_size != sizeof(u->rx_data.status)); - case HOST_NOTIFICATION_VAL: - return (status->frame_size < sizeof(u->rx_data.notification)); - case P80211_DATA_VAL: - case P8023_DATA_VAL: -#ifdef CONFIG_IPW2100_MONITOR - return 0; -#else - switch (WLAN_FC_GET_TYPE(le16_to_cpu(u->rx_data.header.frame_ctl))) { - case IEEE80211_FTYPE_MGMT: - case IEEE80211_FTYPE_CTL: - return 0; - case IEEE80211_FTYPE_DATA: - return (status->frame_size > - IPW_MAX_802_11_PAYLOAD_LENGTH); - } -#endif - } - - return 1; -} - -/* - * ipw2100 interrupts are disabled at this point, and the ISR - * is the only code that calls this method. So, we do not need - * to play with any locks. - * - * RX Queue works as follows: - * - * Read index - firmware places packet in entry identified by the - * Read index and advances Read index. In this manner, - * Read index will always point to the next packet to - * be filled--but not yet valid. - * - * Write index - driver fills this entry with an unused RBD entry. - * This entry has not filled by the firmware yet. - * - * In between the W and R indexes are the RBDs that have been received - * but not yet processed. - * - * The process of handling packets will start at WRITE + 1 and advance - * until it reaches the READ index. - * - * The WRITE index is cached in the variable 'priv->rx_queue.next'. - * - */ -static void __ipw2100_rx_process(struct ipw2100_priv *priv) -{ - struct ipw2100_bd_queue *rxq = &priv->rx_queue; - struct ipw2100_status_queue *sq = &priv->status_queue; - struct ipw2100_rx_packet *packet; - u16 frame_type; - u32 r, w, i, s; - struct ipw2100_rx *u; - struct libipw_rx_stats stats = { - .mac_time = jiffies, - }; - - read_register(priv->net_dev, IPW_MEM_HOST_SHARED_RX_READ_INDEX, &r); - read_register(priv->net_dev, IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, &w); - - if (r >= rxq->entries) { - IPW_DEBUG_RX("exit - bad read index\n"); - return; - } - - i = (rxq->next + 1) % rxq->entries; - s = i; - while (i != r) { - /* IPW_DEBUG_RX("r = %d : w = %d : processing = %d\n", - r, rxq->next, i); */ - - packet = &priv->rx_buffers[i]; - - /* Sync the DMA for the RX buffer so CPU is sure to get - * the correct values */ - pci_dma_sync_single_for_cpu(priv->pci_dev, packet->dma_addr, - sizeof(struct ipw2100_rx), - PCI_DMA_FROMDEVICE); - - if (unlikely(ipw2100_corruption_check(priv, i))) { - ipw2100_corruption_detected(priv, i); - goto increment; - } - - u = packet->rxp; - frame_type = sq->drv[i].status_fields & STATUS_TYPE_MASK; - stats.rssi = sq->drv[i].rssi + IPW2100_RSSI_TO_DBM; - stats.len = sq->drv[i].frame_size; - - stats.mask = 0; - if (stats.rssi != 0) - stats.mask |= LIBIPW_STATMASK_RSSI; - stats.freq = LIBIPW_24GHZ_BAND; - - IPW_DEBUG_RX("%s: '%s' frame type received (%d).\n", - priv->net_dev->name, frame_types[frame_type], - stats.len); - - switch (frame_type) { - case COMMAND_STATUS_VAL: - /* Reset Rx watchdog */ - isr_rx_complete_command(priv, &u->rx_data.command); - break; - - case STATUS_CHANGE_VAL: - isr_status_change(priv, u->rx_data.status); - break; - - case P80211_DATA_VAL: - case P8023_DATA_VAL: -#ifdef CONFIG_IPW2100_MONITOR - if (priv->ieee->iw_mode == IW_MODE_MONITOR) { - isr_rx_monitor(priv, i, &stats); - break; - } -#endif - if (stats.len < sizeof(struct libipw_hdr_3addr)) - break; - switch (WLAN_FC_GET_TYPE(le16_to_cpu(u->rx_data.header.frame_ctl))) { - case IEEE80211_FTYPE_MGMT: - libipw_rx_mgt(priv->ieee, - &u->rx_data.header, &stats); - break; - - case IEEE80211_FTYPE_CTL: - break; - - case IEEE80211_FTYPE_DATA: - isr_rx(priv, i, &stats); - break; - - } - break; - } - - increment: - /* clear status field associated with this RBD */ - rxq->drv[i].status.info.field = 0; - - i = (i + 1) % rxq->entries; - } - - if (i != s) { - /* backtrack one entry, wrapping to end if at 0 */ - rxq->next = (i ? i : rxq->entries) - 1; - - write_register(priv->net_dev, - IPW_MEM_HOST_SHARED_RX_WRITE_INDEX, rxq->next); - } -} - -/* - * __ipw2100_tx_process - * - * This routine will determine whether the next packet on - * the fw_pend_list has been processed by the firmware yet. - * - * If not, then it does nothing and returns. - * - * If so, then it removes the item from the fw_pend_list, frees - * any associated storage, and places the item back on the - * free list of its source (either msg_free_list or tx_free_list) - * - * TX Queue works as follows: - * - * Read index - points to the next TBD that the firmware will - * process. The firmware will read the data, and once - * done processing, it will advance the Read index. - * - * Write index - driver fills this entry with an constructed TBD - * entry. The Write index is not advanced until the - * packet has been configured. - * - * In between the W and R indexes are the TBDs that have NOT been - * processed. Lagging behind the R index are packets that have - * been processed but have not been freed by the driver. - * - * In order to free old storage, an internal index will be maintained - * that points to the next packet to be freed. When all used - * packets have been freed, the oldest index will be the same as the - * firmware's read index. - * - * The OLDEST index is cached in the variable 'priv->tx_queue.oldest' - * - * Because the TBD structure can not contain arbitrary data, the - * driver must keep an internal queue of cached allocations such that - * it can put that data back into the tx_free_list and msg_free_list - * for use by future command and data packets. - * - */ -static int __ipw2100_tx_process(struct ipw2100_priv *priv) -{ - struct ipw2100_bd_queue *txq = &priv->tx_queue; - struct ipw2100_bd *tbd; - struct list_head *element; - struct ipw2100_tx_packet *packet; - int descriptors_used; - int e, i; - u32 r, w, frag_num = 0; - - if (list_empty(&priv->fw_pend_list)) - return 0; - - element = priv->fw_pend_list.next; - - packet = list_entry(element, struct ipw2100_tx_packet, list); - tbd = &txq->drv[packet->index]; - - /* Determine how many TBD entries must be finished... */ - switch (packet->type) { - case COMMAND: - /* COMMAND uses only one slot; don't advance */ - descriptors_used = 1; - e = txq->oldest; - break; - - case DATA: - /* DATA uses two slots; advance and loop position. */ - descriptors_used = tbd->num_fragments; - frag_num = tbd->num_fragments - 1; - e = txq->oldest + frag_num; - e %= txq->entries; - break; - - default: - printk(KERN_WARNING DRV_NAME ": %s: Bad fw_pend_list entry!\n", - priv->net_dev->name); - return 0; - } - - /* if the last TBD is not done by NIC yet, then packet is - * not ready to be released. - * - */ - read_register(priv->net_dev, IPW_MEM_HOST_SHARED_TX_QUEUE_READ_INDEX, - &r); - read_register(priv->net_dev, IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, - &w); - if (w != txq->next) - printk(KERN_WARNING DRV_NAME ": %s: write index mismatch\n", - priv->net_dev->name); - - /* - * txq->next is the index of the last packet written txq->oldest is - * the index of the r is the index of the next packet to be read by - * firmware - */ - - /* - * Quick graphic to help you visualize the following - * if / else statement - * - * ===>| s---->|=============== - * e>| - * | a | b | c | d | e | f | g | h | i | j | k | l - * r---->| - * w - * - * w - updated by driver - * r - updated by firmware - * s - start of oldest BD entry (txq->oldest) - * e - end of oldest BD entry - * - */ - if (!((r <= w && (e < r || e >= w)) || (e < r && e >= w))) { - IPW_DEBUG_TX("exit - no processed packets ready to release.\n"); - return 0; - } - - list_del(element); - DEC_STAT(&priv->fw_pend_stat); - -#ifdef CONFIG_IPW2100_DEBUG - { - i = txq->oldest; - IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i, - &txq->drv[i], - (u32) (txq->nic + i * sizeof(struct ipw2100_bd)), - txq->drv[i].host_addr, txq->drv[i].buf_length); - - if (packet->type == DATA) { - i = (i + 1) % txq->entries; - - IPW_DEBUG_TX("TX%d V=%p P=%04X T=%04X L=%d\n", i, - &txq->drv[i], - (u32) (txq->nic + i * - sizeof(struct ipw2100_bd)), - (u32) txq->drv[i].host_addr, - txq->drv[i].buf_length); - } - } -#endif - - switch (packet->type) { - case DATA: - if (txq->drv[txq->oldest].status.info.fields.txType != 0) - printk(KERN_WARNING DRV_NAME ": %s: Queue mismatch. " - "Expecting DATA TBD but pulled " - "something else: ids %d=%d.\n", - priv->net_dev->name, txq->oldest, packet->index); - - /* DATA packet; we have to unmap and free the SKB */ - for (i = 0; i < frag_num; i++) { - tbd = &txq->drv[(packet->index + 1 + i) % txq->entries]; - - IPW_DEBUG_TX("TX%d P=%08x L=%d\n", - (packet->index + 1 + i) % txq->entries, - tbd->host_addr, tbd->buf_length); - - pci_unmap_single(priv->pci_dev, - tbd->host_addr, - tbd->buf_length, PCI_DMA_TODEVICE); - } - - libipw_txb_free(packet->info.d_struct.txb); - packet->info.d_struct.txb = NULL; - - list_add_tail(element, &priv->tx_free_list); - INC_STAT(&priv->tx_free_stat); - - /* We have a free slot in the Tx queue, so wake up the - * transmit layer if it is stopped. */ - if (priv->status & STATUS_ASSOCIATED) - netif_wake_queue(priv->net_dev); - - /* A packet was processed by the hardware, so update the - * watchdog */ - priv->net_dev->trans_start = jiffies; - - break; - - case COMMAND: - if (txq->drv[txq->oldest].status.info.fields.txType != 1) - printk(KERN_WARNING DRV_NAME ": %s: Queue mismatch. " - "Expecting COMMAND TBD but pulled " - "something else: ids %d=%d.\n", - priv->net_dev->name, txq->oldest, packet->index); - -#ifdef CONFIG_IPW2100_DEBUG - if (packet->info.c_struct.cmd->host_command_reg < - ARRAY_SIZE(command_types)) - IPW_DEBUG_TX("Command '%s (%d)' processed: %d.\n", - command_types[packet->info.c_struct.cmd-> - host_command_reg], - packet->info.c_struct.cmd-> - host_command_reg, - packet->info.c_struct.cmd->cmd_status_reg); -#endif - - list_add_tail(element, &priv->msg_free_list); - INC_STAT(&priv->msg_free_stat); - break; - } - - /* advance oldest used TBD pointer to start of next entry */ - txq->oldest = (e + 1) % txq->entries; - /* increase available TBDs number */ - txq->available += descriptors_used; - SET_STAT(&priv->txq_stat, txq->available); - - IPW_DEBUG_TX("packet latency (send to process) %ld jiffies\n", - jiffies - packet->jiffy_start); - - return (!list_empty(&priv->fw_pend_list)); -} - -static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv) -{ - int i = 0; - - while (__ipw2100_tx_process(priv) && i < 200) - i++; - - if (i == 200) { - printk(KERN_WARNING DRV_NAME ": " - "%s: Driver is running slow (%d iters).\n", - priv->net_dev->name, i); - } -} - -static void ipw2100_tx_send_commands(struct ipw2100_priv *priv) -{ - struct list_head *element; - struct ipw2100_tx_packet *packet; - struct ipw2100_bd_queue *txq = &priv->tx_queue; - struct ipw2100_bd *tbd; - int next = txq->next; - - while (!list_empty(&priv->msg_pend_list)) { - /* if there isn't enough space in TBD queue, then - * don't stuff a new one in. - * NOTE: 3 are needed as a command will take one, - * and there is a minimum of 2 that must be - * maintained between the r and w indexes - */ - if (txq->available <= 3) { - IPW_DEBUG_TX("no room in tx_queue\n"); - break; - } - - element = priv->msg_pend_list.next; - list_del(element); - DEC_STAT(&priv->msg_pend_stat); - - packet = list_entry(element, struct ipw2100_tx_packet, list); - - IPW_DEBUG_TX("using TBD at virt=%p, phys=%04X\n", - &txq->drv[txq->next], - (u32) (txq->nic + txq->next * - sizeof(struct ipw2100_bd))); - - packet->index = txq->next; - - tbd = &txq->drv[txq->next]; - - /* initialize TBD */ - tbd->host_addr = packet->info.c_struct.cmd_phys; - tbd->buf_length = sizeof(struct ipw2100_cmd_header); - /* not marking number of fragments causes problems - * with f/w debug version */ - tbd->num_fragments = 1; - tbd->status.info.field = - IPW_BD_STATUS_TX_FRAME_COMMAND | - IPW_BD_STATUS_TX_INTERRUPT_ENABLE; - - /* update TBD queue counters */ - txq->next++; - txq->next %= txq->entries; - txq->available--; - DEC_STAT(&priv->txq_stat); - - list_add_tail(element, &priv->fw_pend_list); - INC_STAT(&priv->fw_pend_stat); - } - - if (txq->next != next) { - /* kick off the DMA by notifying firmware the - * write index has moved; make sure TBD stores are sync'd */ - wmb(); - write_register(priv->net_dev, - IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, - txq->next); - } -} - -/* - * ipw2100_tx_send_data - * - */ -static void ipw2100_tx_send_data(struct ipw2100_priv *priv) -{ - struct list_head *element; - struct ipw2100_tx_packet *packet; - struct ipw2100_bd_queue *txq = &priv->tx_queue; - struct ipw2100_bd *tbd; - int next = txq->next; - int i = 0; - struct ipw2100_data_header *ipw_hdr; - struct libipw_hdr_3addr *hdr; - - while (!list_empty(&priv->tx_pend_list)) { - /* if there isn't enough space in TBD queue, then - * don't stuff a new one in. - * NOTE: 4 are needed as a data will take two, - * and there is a minimum of 2 that must be - * maintained between the r and w indexes - */ - element = priv->tx_pend_list.next; - packet = list_entry(element, struct ipw2100_tx_packet, list); - - if (unlikely(1 + packet->info.d_struct.txb->nr_frags > - IPW_MAX_BDS)) { - /* TODO: Support merging buffers if more than - * IPW_MAX_BDS are used */ - IPW_DEBUG_INFO("%s: Maximum BD threshold exceeded. " - "Increase fragmentation level.\n", - priv->net_dev->name); - } - - if (txq->available <= 3 + packet->info.d_struct.txb->nr_frags) { - IPW_DEBUG_TX("no room in tx_queue\n"); - break; - } - - list_del(element); - DEC_STAT(&priv->tx_pend_stat); - - tbd = &txq->drv[txq->next]; - - packet->index = txq->next; - - ipw_hdr = packet->info.d_struct.data; - hdr = (struct libipw_hdr_3addr *)packet->info.d_struct.txb-> - fragments[0]->data; - - if (priv->ieee->iw_mode == IW_MODE_INFRA) { - /* To DS: Addr1 = BSSID, Addr2 = SA, - Addr3 = DA */ - memcpy(ipw_hdr->src_addr, hdr->addr2, ETH_ALEN); - memcpy(ipw_hdr->dst_addr, hdr->addr3, ETH_ALEN); - } else if (priv->ieee->iw_mode == IW_MODE_ADHOC) { - /* not From/To DS: Addr1 = DA, Addr2 = SA, - Addr3 = BSSID */ - memcpy(ipw_hdr->src_addr, hdr->addr2, ETH_ALEN); - memcpy(ipw_hdr->dst_addr, hdr->addr1, ETH_ALEN); - } - - ipw_hdr->host_command_reg = SEND; - ipw_hdr->host_command_reg1 = 0; - - /* For now we only support host based encryption */ - ipw_hdr->needs_encryption = 0; - ipw_hdr->encrypted = packet->info.d_struct.txb->encrypted; - if (packet->info.d_struct.txb->nr_frags > 1) - ipw_hdr->fragment_size = - packet->info.d_struct.txb->frag_size - - LIBIPW_3ADDR_LEN; - else - ipw_hdr->fragment_size = 0; - - tbd->host_addr = packet->info.d_struct.data_phys; - tbd->buf_length = sizeof(struct ipw2100_data_header); - tbd->num_fragments = 1 + packet->info.d_struct.txb->nr_frags; - tbd->status.info.field = - IPW_BD_STATUS_TX_FRAME_802_3 | - IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; - txq->next++; - txq->next %= txq->entries; - - IPW_DEBUG_TX("data header tbd TX%d P=%08x L=%d\n", - packet->index, tbd->host_addr, tbd->buf_length); -#ifdef CONFIG_IPW2100_DEBUG - if (packet->info.d_struct.txb->nr_frags > 1) - IPW_DEBUG_FRAG("fragment Tx: %d frames\n", - packet->info.d_struct.txb->nr_frags); -#endif - - for (i = 0; i < packet->info.d_struct.txb->nr_frags; i++) { - tbd = &txq->drv[txq->next]; - if (i == packet->info.d_struct.txb->nr_frags - 1) - tbd->status.info.field = - IPW_BD_STATUS_TX_FRAME_802_3 | - IPW_BD_STATUS_TX_INTERRUPT_ENABLE; - else - tbd->status.info.field = - IPW_BD_STATUS_TX_FRAME_802_3 | - IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT; - - tbd->buf_length = packet->info.d_struct.txb-> - fragments[i]->len - LIBIPW_3ADDR_LEN; - - tbd->host_addr = pci_map_single(priv->pci_dev, - packet->info.d_struct. - txb->fragments[i]-> - data + - LIBIPW_3ADDR_LEN, - tbd->buf_length, - PCI_DMA_TODEVICE); - - IPW_DEBUG_TX("data frag tbd TX%d P=%08x L=%d\n", - txq->next, tbd->host_addr, - tbd->buf_length); - - pci_dma_sync_single_for_device(priv->pci_dev, - tbd->host_addr, - tbd->buf_length, - PCI_DMA_TODEVICE); - - txq->next++; - txq->next %= txq->entries; - } - - txq->available -= 1 + packet->info.d_struct.txb->nr_frags; - SET_STAT(&priv->txq_stat, txq->available); - - list_add_tail(element, &priv->fw_pend_list); - INC_STAT(&priv->fw_pend_stat); - } - - if (txq->next != next) { - /* kick off the DMA by notifying firmware the - * write index has moved; make sure TBD stores are sync'd */ - write_register(priv->net_dev, - IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX, - txq->next); - } -} - -static void ipw2100_irq_tasklet(struct ipw2100_priv *priv) -{ - struct net_device *dev = priv->net_dev; - unsigned long flags; - u32 inta, tmp; - - spin_lock_irqsave(&priv->low_lock, flags); - ipw2100_disable_interrupts(priv); - - read_register(dev, IPW_REG_INTA, &inta); - - IPW_DEBUG_ISR("enter - INTA: 0x%08lX\n", - (unsigned long)inta & IPW_INTERRUPT_MASK); - - priv->in_isr++; - priv->interrupts++; - - /* We do not loop and keep polling for more interrupts as this - * is frowned upon and doesn't play nicely with other potentially - * chained IRQs */ - IPW_DEBUG_ISR("INTA: 0x%08lX\n", - (unsigned long)inta & IPW_INTERRUPT_MASK); - - if (inta & IPW2100_INTA_FATAL_ERROR) { - printk(KERN_WARNING DRV_NAME - ": Fatal interrupt. Scheduling firmware restart.\n"); - priv->inta_other++; - write_register(dev, IPW_REG_INTA, IPW2100_INTA_FATAL_ERROR); - - read_nic_dword(dev, IPW_NIC_FATAL_ERROR, &priv->fatal_error); - IPW_DEBUG_INFO("%s: Fatal error value: 0x%08X\n", - priv->net_dev->name, priv->fatal_error); - - read_nic_dword(dev, IPW_ERROR_ADDR(priv->fatal_error), &tmp); - IPW_DEBUG_INFO("%s: Fatal error address value: 0x%08X\n", - priv->net_dev->name, tmp); - - /* Wake up any sleeping jobs */ - schedule_reset(priv); - } - - if (inta & IPW2100_INTA_PARITY_ERROR) { - printk(KERN_ERR DRV_NAME - ": ***** PARITY ERROR INTERRUPT !!!!\n"); - priv->inta_other++; - write_register(dev, IPW_REG_INTA, IPW2100_INTA_PARITY_ERROR); - } - - if (inta & IPW2100_INTA_RX_TRANSFER) { - IPW_DEBUG_ISR("RX interrupt\n"); - - priv->rx_interrupts++; - - write_register(dev, IPW_REG_INTA, IPW2100_INTA_RX_TRANSFER); - - __ipw2100_rx_process(priv); - __ipw2100_tx_complete(priv); - } - - if (inta & IPW2100_INTA_TX_TRANSFER) { - IPW_DEBUG_ISR("TX interrupt\n"); - - priv->tx_interrupts++; - - write_register(dev, IPW_REG_INTA, IPW2100_INTA_TX_TRANSFER); - - __ipw2100_tx_complete(priv); - ipw2100_tx_send_commands(priv); - ipw2100_tx_send_data(priv); - } - - if (inta & IPW2100_INTA_TX_COMPLETE) { - IPW_DEBUG_ISR("TX complete\n"); - priv->inta_other++; - write_register(dev, IPW_REG_INTA, IPW2100_INTA_TX_COMPLETE); - - __ipw2100_tx_complete(priv); - } - - if (inta & IPW2100_INTA_EVENT_INTERRUPT) { - /* ipw2100_handle_event(dev); */ - priv->inta_other++; - write_register(dev, IPW_REG_INTA, IPW2100_INTA_EVENT_INTERRUPT); - } - - if (inta & IPW2100_INTA_FW_INIT_DONE) { - IPW_DEBUG_ISR("FW init done interrupt\n"); - priv->inta_other++; - - read_register(dev, IPW_REG_INTA, &tmp); - if (tmp & (IPW2100_INTA_FATAL_ERROR | - IPW2100_INTA_PARITY_ERROR)) { - write_register(dev, IPW_REG_INTA, - IPW2100_INTA_FATAL_ERROR | - IPW2100_INTA_PARITY_ERROR); - } - - write_register(dev, IPW_REG_INTA, IPW2100_INTA_FW_INIT_DONE); - } - - if (inta & IPW2100_INTA_STATUS_CHANGE) { - IPW_DEBUG_ISR("Status change interrupt\n"); - priv->inta_other++; - write_register(dev, IPW_REG_INTA, IPW2100_INTA_STATUS_CHANGE); - } - - if (inta & IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE) { - IPW_DEBUG_ISR("slave host mode interrupt\n"); - priv->inta_other++; - write_register(dev, IPW_REG_INTA, - IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE); - } - - priv->in_isr--; - ipw2100_enable_interrupts(priv); - - spin_unlock_irqrestore(&priv->low_lock, flags); - - IPW_DEBUG_ISR("exit\n"); -} - -static irqreturn_t ipw2100_interrupt(int irq, void *data) -{ - struct ipw2100_priv *priv = data; - u32 inta, inta_mask; - - if (!data) - return IRQ_NONE; - - spin_lock(&priv->low_lock); - - /* We check to see if we should be ignoring interrupts before - * we touch the hardware. During ucode load if we try and handle - * an interrupt we can cause keyboard problems as well as cause - * the ucode to fail to initialize */ - if (!(priv->status & STATUS_INT_ENABLED)) { - /* Shared IRQ */ - goto none; - } - - read_register(priv->net_dev, IPW_REG_INTA_MASK, &inta_mask); - read_register(priv->net_dev, IPW_REG_INTA, &inta); - - if (inta == 0xFFFFFFFF) { - /* Hardware disappeared */ - printk(KERN_WARNING DRV_NAME ": IRQ INTA == 0xFFFFFFFF\n"); - goto none; - } - - inta &= IPW_INTERRUPT_MASK; - - if (!(inta & inta_mask)) { - /* Shared interrupt */ - goto none; - } - - /* We disable the hardware interrupt here just to prevent unneeded - * calls to be made. We disable this again within the actual - * work tasklet, so if another part of the code re-enables the - * interrupt, that is fine */ - ipw2100_disable_interrupts(priv); - - tasklet_schedule(&priv->irq_tasklet); - spin_unlock(&priv->low_lock); - - return IRQ_HANDLED; - none: - spin_unlock(&priv->low_lock); - return IRQ_NONE; -} - -static netdev_tx_t ipw2100_tx(struct libipw_txb *txb, - struct net_device *dev, int pri) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - struct list_head *element; - struct ipw2100_tx_packet *packet; - unsigned long flags; - - spin_lock_irqsave(&priv->low_lock, flags); - - if (!(priv->status & STATUS_ASSOCIATED)) { - IPW_DEBUG_INFO("Can not transmit when not connected.\n"); - priv->net_dev->stats.tx_carrier_errors++; - netif_stop_queue(dev); - goto fail_unlock; - } - - if (list_empty(&priv->tx_free_list)) - goto fail_unlock; - - element = priv->tx_free_list.next; - packet = list_entry(element, struct ipw2100_tx_packet, list); - - packet->info.d_struct.txb = txb; - - IPW_DEBUG_TX("Sending fragment (%d bytes):\n", txb->fragments[0]->len); - printk_buf(IPW_DL_TX, txb->fragments[0]->data, txb->fragments[0]->len); - - packet->jiffy_start = jiffies; - - list_del(element); - DEC_STAT(&priv->tx_free_stat); - - list_add_tail(element, &priv->tx_pend_list); - INC_STAT(&priv->tx_pend_stat); - - ipw2100_tx_send_data(priv); - - spin_unlock_irqrestore(&priv->low_lock, flags); - return NETDEV_TX_OK; - -fail_unlock: - netif_stop_queue(dev); - spin_unlock_irqrestore(&priv->low_lock, flags); - return NETDEV_TX_BUSY; -} - -static int ipw2100_msg_allocate(struct ipw2100_priv *priv) -{ - int i, j, err = -EINVAL; - void *v; - dma_addr_t p; - - priv->msg_buffers = - kmalloc(IPW_COMMAND_POOL_SIZE * sizeof(struct ipw2100_tx_packet), - GFP_KERNEL); - if (!priv->msg_buffers) - return -ENOMEM; - - for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) { - v = pci_alloc_consistent(priv->pci_dev, - sizeof(struct ipw2100_cmd_header), &p); - if (!v) { - printk(KERN_ERR DRV_NAME ": " - "%s: PCI alloc failed for msg " - "buffers.\n", priv->net_dev->name); - err = -ENOMEM; - break; - } - - memset(v, 0, sizeof(struct ipw2100_cmd_header)); - - priv->msg_buffers[i].type = COMMAND; - priv->msg_buffers[i].info.c_struct.cmd = - (struct ipw2100_cmd_header *)v; - priv->msg_buffers[i].info.c_struct.cmd_phys = p; - } - - if (i == IPW_COMMAND_POOL_SIZE) - return 0; - - for (j = 0; j < i; j++) { - pci_free_consistent(priv->pci_dev, - sizeof(struct ipw2100_cmd_header), - priv->msg_buffers[j].info.c_struct.cmd, - priv->msg_buffers[j].info.c_struct. - cmd_phys); - } - - kfree(priv->msg_buffers); - priv->msg_buffers = NULL; - - return err; -} - -static int ipw2100_msg_initialize(struct ipw2100_priv *priv) -{ - int i; - - INIT_LIST_HEAD(&priv->msg_free_list); - INIT_LIST_HEAD(&priv->msg_pend_list); - - for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) - list_add_tail(&priv->msg_buffers[i].list, &priv->msg_free_list); - SET_STAT(&priv->msg_free_stat, i); - - return 0; -} - -static void ipw2100_msg_free(struct ipw2100_priv *priv) -{ - int i; - - if (!priv->msg_buffers) - return; - - for (i = 0; i < IPW_COMMAND_POOL_SIZE; i++) { - pci_free_consistent(priv->pci_dev, - sizeof(struct ipw2100_cmd_header), - priv->msg_buffers[i].info.c_struct.cmd, - priv->msg_buffers[i].info.c_struct. - cmd_phys); - } - - kfree(priv->msg_buffers); - priv->msg_buffers = NULL; -} - -static ssize_t show_pci(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct pci_dev *pci_dev = container_of(d, struct pci_dev, dev); - char *out = buf; - int i, j; - u32 val; - - for (i = 0; i < 16; i++) { - out += sprintf(out, "[%08X] ", i * 16); - for (j = 0; j < 16; j += 4) { - pci_read_config_dword(pci_dev, i * 16 + j, &val); - out += sprintf(out, "%08X ", val); - } - out += sprintf(out, "\n"); - } - - return out - buf; -} - -static DEVICE_ATTR(pci, S_IRUGO, show_pci, NULL); - -static ssize_t show_cfg(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw2100_priv *p = dev_get_drvdata(d); - return sprintf(buf, "0x%08x\n", (int)p->config); -} - -static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); - -static ssize_t show_status(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw2100_priv *p = dev_get_drvdata(d); - return sprintf(buf, "0x%08x\n", (int)p->status); -} - -static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); - -static ssize_t show_capability(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw2100_priv *p = dev_get_drvdata(d); - return sprintf(buf, "0x%08x\n", (int)p->capability); -} - -static DEVICE_ATTR(capability, S_IRUGO, show_capability, NULL); - -#define IPW2100_REG(x) { IPW_ ##x, #x } -static const struct { - u32 addr; - const char *name; -} hw_data[] = { -IPW2100_REG(REG_GP_CNTRL), - IPW2100_REG(REG_GPIO), - IPW2100_REG(REG_INTA), - IPW2100_REG(REG_INTA_MASK), IPW2100_REG(REG_RESET_REG),}; -#define IPW2100_NIC(x, s) { x, #x, s } -static const struct { - u32 addr; - const char *name; - size_t size; -} nic_data[] = { -IPW2100_NIC(IPW2100_CONTROL_REG, 2), - IPW2100_NIC(0x210014, 1), IPW2100_NIC(0x210000, 1),}; -#define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d } -static const struct { - u8 index; - const char *name; - const char *desc; -} ord_data[] = { -IPW2100_ORD(STAT_TX_HOST_REQUESTS, "requested Host Tx's (MSDU)"), - IPW2100_ORD(STAT_TX_HOST_COMPLETE, - "successful Host Tx's (MSDU)"), - IPW2100_ORD(STAT_TX_DIR_DATA, - "successful Directed Tx's (MSDU)"), - IPW2100_ORD(STAT_TX_DIR_DATA1, - "successful Directed Tx's (MSDU) @ 1MB"), - IPW2100_ORD(STAT_TX_DIR_DATA2, - "successful Directed Tx's (MSDU) @ 2MB"), - IPW2100_ORD(STAT_TX_DIR_DATA5_5, - "successful Directed Tx's (MSDU) @ 5_5MB"), - IPW2100_ORD(STAT_TX_DIR_DATA11, - "successful Directed Tx's (MSDU) @ 11MB"), - IPW2100_ORD(STAT_TX_NODIR_DATA1, - "successful Non_Directed Tx's (MSDU) @ 1MB"), - IPW2100_ORD(STAT_TX_NODIR_DATA2, - "successful Non_Directed Tx's (MSDU) @ 2MB"), - IPW2100_ORD(STAT_TX_NODIR_DATA5_5, - "successful Non_Directed Tx's (MSDU) @ 5.5MB"), - IPW2100_ORD(STAT_TX_NODIR_DATA11, - "successful Non_Directed Tx's (MSDU) @ 11MB"), - IPW2100_ORD(STAT_NULL_DATA, "successful NULL data Tx's"), - IPW2100_ORD(STAT_TX_RTS, "successful Tx RTS"), - IPW2100_ORD(STAT_TX_CTS, "successful Tx CTS"), - IPW2100_ORD(STAT_TX_ACK, "successful Tx ACK"), - IPW2100_ORD(STAT_TX_ASSN, "successful Association Tx's"), - IPW2100_ORD(STAT_TX_ASSN_RESP, - "successful Association response Tx's"), - IPW2100_ORD(STAT_TX_REASSN, - "successful Reassociation Tx's"), - IPW2100_ORD(STAT_TX_REASSN_RESP, - "successful Reassociation response Tx's"), - IPW2100_ORD(STAT_TX_PROBE, - "probes successfully transmitted"), - IPW2100_ORD(STAT_TX_PROBE_RESP, - "probe responses successfully transmitted"), - IPW2100_ORD(STAT_TX_BEACON, "tx beacon"), - IPW2100_ORD(STAT_TX_ATIM, "Tx ATIM"), - IPW2100_ORD(STAT_TX_DISASSN, - "successful Disassociation TX"), - IPW2100_ORD(STAT_TX_AUTH, "successful Authentication Tx"), - IPW2100_ORD(STAT_TX_DEAUTH, - "successful Deauthentication TX"), - IPW2100_ORD(STAT_TX_TOTAL_BYTES, - "Total successful Tx data bytes"), - IPW2100_ORD(STAT_TX_RETRIES, "Tx retries"), - IPW2100_ORD(STAT_TX_RETRY1, "Tx retries at 1MBPS"), - IPW2100_ORD(STAT_TX_RETRY2, "Tx retries at 2MBPS"), - IPW2100_ORD(STAT_TX_RETRY5_5, "Tx retries at 5.5MBPS"), - IPW2100_ORD(STAT_TX_RETRY11, "Tx retries at 11MBPS"), - IPW2100_ORD(STAT_TX_FAILURES, "Tx Failures"), - IPW2100_ORD(STAT_TX_MAX_TRIES_IN_HOP, - "times max tries in a hop failed"), - IPW2100_ORD(STAT_TX_DISASSN_FAIL, - "times disassociation failed"), - IPW2100_ORD(STAT_TX_ERR_CTS, "missed/bad CTS frames"), - IPW2100_ORD(STAT_TX_ERR_ACK, "tx err due to acks"), - IPW2100_ORD(STAT_RX_HOST, "packets passed to host"), - IPW2100_ORD(STAT_RX_DIR_DATA, "directed packets"), - IPW2100_ORD(STAT_RX_DIR_DATA1, "directed packets at 1MB"), - IPW2100_ORD(STAT_RX_DIR_DATA2, "directed packets at 2MB"), - IPW2100_ORD(STAT_RX_DIR_DATA5_5, - "directed packets at 5.5MB"), - IPW2100_ORD(STAT_RX_DIR_DATA11, "directed packets at 11MB"), - IPW2100_ORD(STAT_RX_NODIR_DATA, "nondirected packets"), - IPW2100_ORD(STAT_RX_NODIR_DATA1, - "nondirected packets at 1MB"), - IPW2100_ORD(STAT_RX_NODIR_DATA2, - "nondirected packets at 2MB"), - IPW2100_ORD(STAT_RX_NODIR_DATA5_5, - "nondirected packets at 5.5MB"), - IPW2100_ORD(STAT_RX_NODIR_DATA11, - "nondirected packets at 11MB"), - IPW2100_ORD(STAT_RX_NULL_DATA, "null data rx's"), - IPW2100_ORD(STAT_RX_RTS, "Rx RTS"), IPW2100_ORD(STAT_RX_CTS, - "Rx CTS"), - IPW2100_ORD(STAT_RX_ACK, "Rx ACK"), - IPW2100_ORD(STAT_RX_CFEND, "Rx CF End"), - IPW2100_ORD(STAT_RX_CFEND_ACK, "Rx CF End + CF Ack"), - IPW2100_ORD(STAT_RX_ASSN, "Association Rx's"), - IPW2100_ORD(STAT_RX_ASSN_RESP, "Association response Rx's"), - IPW2100_ORD(STAT_RX_REASSN, "Reassociation Rx's"), - IPW2100_ORD(STAT_RX_REASSN_RESP, - "Reassociation response Rx's"), - IPW2100_ORD(STAT_RX_PROBE, "probe Rx's"), - IPW2100_ORD(STAT_RX_PROBE_RESP, "probe response Rx's"), - IPW2100_ORD(STAT_RX_BEACON, "Rx beacon"), - IPW2100_ORD(STAT_RX_ATIM, "Rx ATIM"), - IPW2100_ORD(STAT_RX_DISASSN, "disassociation Rx"), - IPW2100_ORD(STAT_RX_AUTH, "authentication Rx"), - IPW2100_ORD(STAT_RX_DEAUTH, "deauthentication Rx"), - IPW2100_ORD(STAT_RX_TOTAL_BYTES, - "Total rx data bytes received"), - IPW2100_ORD(STAT_RX_ERR_CRC, "packets with Rx CRC error"), - IPW2100_ORD(STAT_RX_ERR_CRC1, "Rx CRC errors at 1MB"), - IPW2100_ORD(STAT_RX_ERR_CRC2, "Rx CRC errors at 2MB"), - IPW2100_ORD(STAT_RX_ERR_CRC5_5, "Rx CRC errors at 5.5MB"), - IPW2100_ORD(STAT_RX_ERR_CRC11, "Rx CRC errors at 11MB"), - IPW2100_ORD(STAT_RX_DUPLICATE1, - "duplicate rx packets at 1MB"), - IPW2100_ORD(STAT_RX_DUPLICATE2, - "duplicate rx packets at 2MB"), - IPW2100_ORD(STAT_RX_DUPLICATE5_5, - "duplicate rx packets at 5.5MB"), - IPW2100_ORD(STAT_RX_DUPLICATE11, - "duplicate rx packets at 11MB"), - IPW2100_ORD(STAT_RX_DUPLICATE, "duplicate rx packets"), - IPW2100_ORD(PERS_DB_LOCK, "locking fw permanent db"), - IPW2100_ORD(PERS_DB_SIZE, "size of fw permanent db"), - IPW2100_ORD(PERS_DB_ADDR, "address of fw permanent db"), - IPW2100_ORD(STAT_RX_INVALID_PROTOCOL, - "rx frames with invalid protocol"), - IPW2100_ORD(SYS_BOOT_TIME, "Boot time"), - IPW2100_ORD(STAT_RX_NO_BUFFER, - "rx frames rejected due to no buffer"), - IPW2100_ORD(STAT_RX_MISSING_FRAG, - "rx frames dropped due to missing fragment"), - IPW2100_ORD(STAT_RX_ORPHAN_FRAG, - "rx frames dropped due to non-sequential fragment"), - IPW2100_ORD(STAT_RX_ORPHAN_FRAME, - "rx frames dropped due to unmatched 1st frame"), - IPW2100_ORD(STAT_RX_FRAG_AGEOUT, - "rx frames dropped due to uncompleted frame"), - IPW2100_ORD(STAT_RX_ICV_ERRORS, - "ICV errors during decryption"), - IPW2100_ORD(STAT_PSP_SUSPENSION, "times adapter suspended"), - IPW2100_ORD(STAT_PSP_BCN_TIMEOUT, "beacon timeout"), - IPW2100_ORD(STAT_PSP_POLL_TIMEOUT, - "poll response timeouts"), - IPW2100_ORD(STAT_PSP_NONDIR_TIMEOUT, - "timeouts waiting for last {broad,multi}cast pkt"), - IPW2100_ORD(STAT_PSP_RX_DTIMS, "PSP DTIMs received"), - IPW2100_ORD(STAT_PSP_RX_TIMS, "PSP TIMs received"), - IPW2100_ORD(STAT_PSP_STATION_ID, "PSP Station ID"), - IPW2100_ORD(LAST_ASSN_TIME, "RTC time of last association"), - IPW2100_ORD(STAT_PERCENT_MISSED_BCNS, - "current calculation of % missed beacons"), - IPW2100_ORD(STAT_PERCENT_RETRIES, - "current calculation of % missed tx retries"), - IPW2100_ORD(ASSOCIATED_AP_PTR, - "0 if not associated, else pointer to AP table entry"), - IPW2100_ORD(AVAILABLE_AP_CNT, - "AP's decsribed in the AP table"), - IPW2100_ORD(AP_LIST_PTR, "Ptr to list of available APs"), - IPW2100_ORD(STAT_AP_ASSNS, "associations"), - IPW2100_ORD(STAT_ASSN_FAIL, "association failures"), - IPW2100_ORD(STAT_ASSN_RESP_FAIL, - "failures due to response fail"), - IPW2100_ORD(STAT_FULL_SCANS, "full scans"), - IPW2100_ORD(CARD_DISABLED, "Card Disabled"), - IPW2100_ORD(STAT_ROAM_INHIBIT, - "times roaming was inhibited due to activity"), - IPW2100_ORD(RSSI_AT_ASSN, - "RSSI of associated AP at time of association"), - IPW2100_ORD(STAT_ASSN_CAUSE1, - "reassociation: no probe response or TX on hop"), - IPW2100_ORD(STAT_ASSN_CAUSE2, - "reassociation: poor tx/rx quality"), - IPW2100_ORD(STAT_ASSN_CAUSE3, - "reassociation: tx/rx quality (excessive AP load"), - IPW2100_ORD(STAT_ASSN_CAUSE4, - "reassociation: AP RSSI level"), - IPW2100_ORD(STAT_ASSN_CAUSE5, - "reassociations due to load leveling"), - IPW2100_ORD(STAT_AUTH_FAIL, "times authentication failed"), - IPW2100_ORD(STAT_AUTH_RESP_FAIL, - "times authentication response failed"), - IPW2100_ORD(STATION_TABLE_CNT, - "entries in association table"), - IPW2100_ORD(RSSI_AVG_CURR, "Current avg RSSI"), - IPW2100_ORD(POWER_MGMT_MODE, "Power mode - 0=CAM, 1=PSP"), - IPW2100_ORD(COUNTRY_CODE, - "IEEE country code as recv'd from beacon"), - IPW2100_ORD(COUNTRY_CHANNELS, - "channels supported by country"), - IPW2100_ORD(RESET_CNT, "adapter resets (warm)"), - IPW2100_ORD(BEACON_INTERVAL, "Beacon interval"), - IPW2100_ORD(ANTENNA_DIVERSITY, - "TRUE if antenna diversity is disabled"), - IPW2100_ORD(DTIM_PERIOD, "beacon intervals between DTIMs"), - IPW2100_ORD(OUR_FREQ, - "current radio freq lower digits - channel ID"), - IPW2100_ORD(RTC_TIME, "current RTC time"), - IPW2100_ORD(PORT_TYPE, "operating mode"), - IPW2100_ORD(CURRENT_TX_RATE, "current tx rate"), - IPW2100_ORD(SUPPORTED_RATES, "supported tx rates"), - IPW2100_ORD(ATIM_WINDOW, "current ATIM Window"), - IPW2100_ORD(BASIC_RATES, "basic tx rates"), - IPW2100_ORD(NIC_HIGHEST_RATE, "NIC highest tx rate"), - IPW2100_ORD(AP_HIGHEST_RATE, "AP highest tx rate"), - IPW2100_ORD(CAPABILITIES, - "Management frame capability field"), - IPW2100_ORD(AUTH_TYPE, "Type of authentication"), - IPW2100_ORD(RADIO_TYPE, "Adapter card platform type"), - IPW2100_ORD(RTS_THRESHOLD, - "Min packet length for RTS handshaking"), - IPW2100_ORD(INT_MODE, "International mode"), - IPW2100_ORD(FRAGMENTATION_THRESHOLD, - "protocol frag threshold"), - IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_START_ADDRESS, - "EEPROM offset in SRAM"), - IPW2100_ORD(EEPROM_SRAM_DB_BLOCK_SIZE, - "EEPROM size in SRAM"), - IPW2100_ORD(EEPROM_SKU_CAPABILITY, "EEPROM SKU Capability"), - IPW2100_ORD(EEPROM_IBSS_11B_CHANNELS, - "EEPROM IBSS 11b channel set"), - IPW2100_ORD(MAC_VERSION, "MAC Version"), - IPW2100_ORD(MAC_REVISION, "MAC Revision"), - IPW2100_ORD(RADIO_VERSION, "Radio Version"), - IPW2100_ORD(NIC_MANF_DATE_TIME, "MANF Date/Time STAMP"), - IPW2100_ORD(UCODE_VERSION, "Ucode Version"),}; - -static ssize_t show_registers(struct device *d, struct device_attribute *attr, - char *buf) -{ - int i; - struct ipw2100_priv *priv = dev_get_drvdata(d); - struct net_device *dev = priv->net_dev; - char *out = buf; - u32 val = 0; - - out += sprintf(out, "%30s [Address ] : Hex\n", "Register"); - - for (i = 0; i < ARRAY_SIZE(hw_data); i++) { - read_register(dev, hw_data[i].addr, &val); - out += sprintf(out, "%30s [%08X] : %08X\n", - hw_data[i].name, hw_data[i].addr, val); - } - - return out - buf; -} - -static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL); - -static ssize_t show_hardware(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw2100_priv *priv = dev_get_drvdata(d); - struct net_device *dev = priv->net_dev; - char *out = buf; - int i; - - out += sprintf(out, "%30s [Address ] : Hex\n", "NIC entry"); - - for (i = 0; i < ARRAY_SIZE(nic_data); i++) { - u8 tmp8; - u16 tmp16; - u32 tmp32; - - switch (nic_data[i].size) { - case 1: - read_nic_byte(dev, nic_data[i].addr, &tmp8); - out += sprintf(out, "%30s [%08X] : %02X\n", - nic_data[i].name, nic_data[i].addr, - tmp8); - break; - case 2: - read_nic_word(dev, nic_data[i].addr, &tmp16); - out += sprintf(out, "%30s [%08X] : %04X\n", - nic_data[i].name, nic_data[i].addr, - tmp16); - break; - case 4: - read_nic_dword(dev, nic_data[i].addr, &tmp32); - out += sprintf(out, "%30s [%08X] : %08X\n", - nic_data[i].name, nic_data[i].addr, - tmp32); - break; - } - } - return out - buf; -} - -static DEVICE_ATTR(hardware, S_IRUGO, show_hardware, NULL); - -static ssize_t show_memory(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw2100_priv *priv = dev_get_drvdata(d); - struct net_device *dev = priv->net_dev; - static unsigned long loop = 0; - int len = 0; - u32 buffer[4]; - int i; - char line[81]; - - if (loop >= 0x30000) - loop = 0; - - /* sysfs provides us PAGE_SIZE buffer */ - while (len < PAGE_SIZE - 128 && loop < 0x30000) { - - if (priv->snapshot[0]) - for (i = 0; i < 4; i++) - buffer[i] = - *(u32 *) SNAPSHOT_ADDR(loop + i * 4); - else - for (i = 0; i < 4; i++) - read_nic_dword(dev, loop + i * 4, &buffer[i]); - - if (priv->dump_raw) - len += sprintf(buf + len, - "%c%c%c%c" - "%c%c%c%c" - "%c%c%c%c" - "%c%c%c%c", - ((u8 *) buffer)[0x0], - ((u8 *) buffer)[0x1], - ((u8 *) buffer)[0x2], - ((u8 *) buffer)[0x3], - ((u8 *) buffer)[0x4], - ((u8 *) buffer)[0x5], - ((u8 *) buffer)[0x6], - ((u8 *) buffer)[0x7], - ((u8 *) buffer)[0x8], - ((u8 *) buffer)[0x9], - ((u8 *) buffer)[0xa], - ((u8 *) buffer)[0xb], - ((u8 *) buffer)[0xc], - ((u8 *) buffer)[0xd], - ((u8 *) buffer)[0xe], - ((u8 *) buffer)[0xf]); - else - len += sprintf(buf + len, "%s\n", - snprint_line(line, sizeof(line), - (u8 *) buffer, 16, loop)); - loop += 16; - } - - return len; -} - -static ssize_t store_memory(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw2100_priv *priv = dev_get_drvdata(d); - struct net_device *dev = priv->net_dev; - const char *p = buf; - - (void)dev; /* kill unused-var warning for debug-only code */ - - if (count < 1) - return count; - - if (p[0] == '1' || - (count >= 2 && tolower(p[0]) == 'o' && tolower(p[1]) == 'n')) { - IPW_DEBUG_INFO("%s: Setting memory dump to RAW mode.\n", - dev->name); - priv->dump_raw = 1; - - } else if (p[0] == '0' || (count >= 2 && tolower(p[0]) == 'o' && - tolower(p[1]) == 'f')) { - IPW_DEBUG_INFO("%s: Setting memory dump to HEX mode.\n", - dev->name); - priv->dump_raw = 0; - - } else if (tolower(p[0]) == 'r') { - IPW_DEBUG_INFO("%s: Resetting firmware snapshot.\n", dev->name); - ipw2100_snapshot_free(priv); - - } else - IPW_DEBUG_INFO("%s: Usage: 0|on = HEX, 1|off = RAW, " - "reset = clear memory snapshot\n", dev->name); - - return count; -} - -static DEVICE_ATTR(memory, S_IWUSR | S_IRUGO, show_memory, store_memory); - -static ssize_t show_ordinals(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw2100_priv *priv = dev_get_drvdata(d); - u32 val = 0; - int len = 0; - u32 val_len; - static int loop = 0; - - if (priv->status & STATUS_RF_KILL_MASK) - return 0; - - if (loop >= ARRAY_SIZE(ord_data)) - loop = 0; - - /* sysfs provides us PAGE_SIZE buffer */ - while (len < PAGE_SIZE - 128 && loop < ARRAY_SIZE(ord_data)) { - val_len = sizeof(u32); - - if (ipw2100_get_ordinal(priv, ord_data[loop].index, &val, - &val_len)) - len += sprintf(buf + len, "[0x%02X] = ERROR %s\n", - ord_data[loop].index, - ord_data[loop].desc); - else - len += sprintf(buf + len, "[0x%02X] = 0x%08X %s\n", - ord_data[loop].index, val, - ord_data[loop].desc); - loop++; - } - - return len; -} - -static DEVICE_ATTR(ordinals, S_IRUGO, show_ordinals, NULL); - -static ssize_t show_stats(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw2100_priv *priv = dev_get_drvdata(d); - char *out = buf; - - out += sprintf(out, "interrupts: %d {tx: %d, rx: %d, other: %d}\n", - priv->interrupts, priv->tx_interrupts, - priv->rx_interrupts, priv->inta_other); - out += sprintf(out, "firmware resets: %d\n", priv->resets); - out += sprintf(out, "firmware hangs: %d\n", priv->hangs); -#ifdef CONFIG_IPW2100_DEBUG - out += sprintf(out, "packet mismatch image: %s\n", - priv->snapshot[0] ? "YES" : "NO"); -#endif - - return out - buf; -} - -static DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL); - -static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode) -{ - int err; - - if (mode == priv->ieee->iw_mode) - return 0; - - err = ipw2100_disable_adapter(priv); - if (err) { - printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n", - priv->net_dev->name, err); - return err; - } - - switch (mode) { - case IW_MODE_INFRA: - priv->net_dev->type = ARPHRD_ETHER; - break; - case IW_MODE_ADHOC: - priv->net_dev->type = ARPHRD_ETHER; - break; -#ifdef CONFIG_IPW2100_MONITOR - case IW_MODE_MONITOR: - priv->last_mode = priv->ieee->iw_mode; - priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; - break; -#endif /* CONFIG_IPW2100_MONITOR */ - } - - priv->ieee->iw_mode = mode; - -#ifdef CONFIG_PM - /* Indicate ipw2100_download_firmware download firmware - * from disk instead of memory. */ - ipw2100_firmware.version = 0; -#endif - - printk(KERN_INFO "%s: Resetting on mode change.\n", priv->net_dev->name); - priv->reset_backoff = 0; - schedule_reset(priv); - - return 0; -} - -static ssize_t show_internals(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw2100_priv *priv = dev_get_drvdata(d); - int len = 0; - -#define DUMP_VAR(x,y) len += sprintf(buf + len, # x ": %" y "\n", priv-> x) - - if (priv->status & STATUS_ASSOCIATED) - len += sprintf(buf + len, "connected: %lu\n", - get_seconds() - priv->connect_start); - else - len += sprintf(buf + len, "not connected\n"); - - DUMP_VAR(ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx], "p"); - DUMP_VAR(status, "08lx"); - DUMP_VAR(config, "08lx"); - DUMP_VAR(capability, "08lx"); - - len += - sprintf(buf + len, "last_rtc: %lu\n", - (unsigned long)priv->last_rtc); - - DUMP_VAR(fatal_error, "d"); - DUMP_VAR(stop_hang_check, "d"); - DUMP_VAR(stop_rf_kill, "d"); - DUMP_VAR(messages_sent, "d"); - - DUMP_VAR(tx_pend_stat.value, "d"); - DUMP_VAR(tx_pend_stat.hi, "d"); - - DUMP_VAR(tx_free_stat.value, "d"); - DUMP_VAR(tx_free_stat.lo, "d"); - - DUMP_VAR(msg_free_stat.value, "d"); - DUMP_VAR(msg_free_stat.lo, "d"); - - DUMP_VAR(msg_pend_stat.value, "d"); - DUMP_VAR(msg_pend_stat.hi, "d"); - - DUMP_VAR(fw_pend_stat.value, "d"); - DUMP_VAR(fw_pend_stat.hi, "d"); - - DUMP_VAR(txq_stat.value, "d"); - DUMP_VAR(txq_stat.lo, "d"); - - DUMP_VAR(ieee->scans, "d"); - DUMP_VAR(reset_backoff, "d"); - - return len; -} - -static DEVICE_ATTR(internals, S_IRUGO, show_internals, NULL); - -static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw2100_priv *priv = dev_get_drvdata(d); - char essid[IW_ESSID_MAX_SIZE + 1]; - u8 bssid[ETH_ALEN]; - u32 chan = 0; - char *out = buf; - unsigned int length; - int ret; - - if (priv->status & STATUS_RF_KILL_MASK) - return 0; - - memset(essid, 0, sizeof(essid)); - memset(bssid, 0, sizeof(bssid)); - - length = IW_ESSID_MAX_SIZE; - ret = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_SSID, essid, &length); - if (ret) - IPW_DEBUG_INFO("failed querying ordinals at line %d\n", - __LINE__); - - length = sizeof(bssid); - ret = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, - bssid, &length); - if (ret) - IPW_DEBUG_INFO("failed querying ordinals at line %d\n", - __LINE__); - - length = sizeof(u32); - ret = ipw2100_get_ordinal(priv, IPW_ORD_OUR_FREQ, &chan, &length); - if (ret) - IPW_DEBUG_INFO("failed querying ordinals at line %d\n", - __LINE__); - - out += sprintf(out, "ESSID: %s\n", essid); - out += sprintf(out, "BSSID: %pM\n", bssid); - out += sprintf(out, "Channel: %d\n", chan); - - return out - buf; -} - -static DEVICE_ATTR(bssinfo, S_IRUGO, show_bssinfo, NULL); - -#ifdef CONFIG_IPW2100_DEBUG -static ssize_t show_debug_level(struct device_driver *d, char *buf) -{ - return sprintf(buf, "0x%08X\n", ipw2100_debug_level); -} - -static ssize_t store_debug_level(struct device_driver *d, - const char *buf, size_t count) -{ - u32 val; - int ret; - - ret = kstrtou32(buf, 0, &val); - if (ret) - IPW_DEBUG_INFO(": %s is not in hex or decimal form.\n", buf); - else - ipw2100_debug_level = val; - - return strnlen(buf, count); -} - -static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level, - store_debug_level); -#endif /* CONFIG_IPW2100_DEBUG */ - -static ssize_t show_fatal_error(struct device *d, - struct device_attribute *attr, char *buf) -{ - struct ipw2100_priv *priv = dev_get_drvdata(d); - char *out = buf; - int i; - - if (priv->fatal_error) - out += sprintf(out, "0x%08X\n", priv->fatal_error); - else - out += sprintf(out, "0\n"); - - for (i = 1; i <= IPW2100_ERROR_QUEUE; i++) { - if (!priv->fatal_errors[(priv->fatal_index - i) % - IPW2100_ERROR_QUEUE]) - continue; - - out += sprintf(out, "%d. 0x%08X\n", i, - priv->fatal_errors[(priv->fatal_index - i) % - IPW2100_ERROR_QUEUE]); - } - - return out - buf; -} - -static ssize_t store_fatal_error(struct device *d, - struct device_attribute *attr, const char *buf, - size_t count) -{ - struct ipw2100_priv *priv = dev_get_drvdata(d); - schedule_reset(priv); - return count; -} - -static DEVICE_ATTR(fatal_error, S_IWUSR | S_IRUGO, show_fatal_error, - store_fatal_error); - -static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw2100_priv *priv = dev_get_drvdata(d); - return sprintf(buf, "%d\n", priv->ieee->scan_age); -} - -static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw2100_priv *priv = dev_get_drvdata(d); - struct net_device *dev = priv->net_dev; - unsigned long val; - int ret; - - (void)dev; /* kill unused-var warning for debug-only code */ - - IPW_DEBUG_INFO("enter\n"); - - ret = kstrtoul(buf, 0, &val); - if (ret) { - IPW_DEBUG_INFO("%s: user supplied invalid value.\n", dev->name); - } else { - priv->ieee->scan_age = val; - IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age); - } - - IPW_DEBUG_INFO("exit\n"); - return strnlen(buf, count); -} - -static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age); - -static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, - char *buf) -{ - /* 0 - RF kill not enabled - 1 - SW based RF kill active (sysfs) - 2 - HW based RF kill active - 3 - Both HW and SW baed RF kill active */ - struct ipw2100_priv *priv = dev_get_drvdata(d); - int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | - (rf_kill_active(priv) ? 0x2 : 0x0); - return sprintf(buf, "%i\n", val); -} - -static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio) -{ - if ((disable_radio ? 1 : 0) == - (priv->status & STATUS_RF_KILL_SW ? 1 : 0)) - return 0; - - IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", - disable_radio ? "OFF" : "ON"); - - mutex_lock(&priv->action_mutex); - - if (disable_radio) { - priv->status |= STATUS_RF_KILL_SW; - ipw2100_down(priv); - } else { - priv->status &= ~STATUS_RF_KILL_SW; - if (rf_kill_active(priv)) { - IPW_DEBUG_RF_KILL("Can not turn radio back on - " - "disabled by HW switch\n"); - /* Make sure the RF_KILL check timer is running */ - priv->stop_rf_kill = 0; - mod_delayed_work(system_wq, &priv->rf_kill, - round_jiffies_relative(HZ)); - } else - schedule_reset(priv); - } - - mutex_unlock(&priv->action_mutex); - return 1; -} - -static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw2100_priv *priv = dev_get_drvdata(d); - ipw_radio_kill_sw(priv, buf[0] == '1'); - return count; -} - -static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); - -static struct attribute *ipw2100_sysfs_entries[] = { - &dev_attr_hardware.attr, - &dev_attr_registers.attr, - &dev_attr_ordinals.attr, - &dev_attr_pci.attr, - &dev_attr_stats.attr, - &dev_attr_internals.attr, - &dev_attr_bssinfo.attr, - &dev_attr_memory.attr, - &dev_attr_scan_age.attr, - &dev_attr_fatal_error.attr, - &dev_attr_rf_kill.attr, - &dev_attr_cfg.attr, - &dev_attr_status.attr, - &dev_attr_capability.attr, - NULL, -}; - -static struct attribute_group ipw2100_attribute_group = { - .attrs = ipw2100_sysfs_entries, -}; - -static int status_queue_allocate(struct ipw2100_priv *priv, int entries) -{ - struct ipw2100_status_queue *q = &priv->status_queue; - - IPW_DEBUG_INFO("enter\n"); - - q->size = entries * sizeof(struct ipw2100_status); - q->drv = - (struct ipw2100_status *)pci_alloc_consistent(priv->pci_dev, - q->size, &q->nic); - if (!q->drv) { - IPW_DEBUG_WARNING("Can not allocate status queue.\n"); - return -ENOMEM; - } - - memset(q->drv, 0, q->size); - - IPW_DEBUG_INFO("exit\n"); - - return 0; -} - -static void status_queue_free(struct ipw2100_priv *priv) -{ - IPW_DEBUG_INFO("enter\n"); - - if (priv->status_queue.drv) { - pci_free_consistent(priv->pci_dev, priv->status_queue.size, - priv->status_queue.drv, - priv->status_queue.nic); - priv->status_queue.drv = NULL; - } - - IPW_DEBUG_INFO("exit\n"); -} - -static int bd_queue_allocate(struct ipw2100_priv *priv, - struct ipw2100_bd_queue *q, int entries) -{ - IPW_DEBUG_INFO("enter\n"); - - memset(q, 0, sizeof(struct ipw2100_bd_queue)); - - q->entries = entries; - q->size = entries * sizeof(struct ipw2100_bd); - q->drv = pci_alloc_consistent(priv->pci_dev, q->size, &q->nic); - if (!q->drv) { - IPW_DEBUG_INFO - ("can't allocate shared memory for buffer descriptors\n"); - return -ENOMEM; - } - memset(q->drv, 0, q->size); - - IPW_DEBUG_INFO("exit\n"); - - return 0; -} - -static void bd_queue_free(struct ipw2100_priv *priv, struct ipw2100_bd_queue *q) -{ - IPW_DEBUG_INFO("enter\n"); - - if (!q) - return; - - if (q->drv) { - pci_free_consistent(priv->pci_dev, q->size, q->drv, q->nic); - q->drv = NULL; - } - - IPW_DEBUG_INFO("exit\n"); -} - -static void bd_queue_initialize(struct ipw2100_priv *priv, - struct ipw2100_bd_queue *q, u32 base, u32 size, - u32 r, u32 w) -{ - IPW_DEBUG_INFO("enter\n"); - - IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, - (u32) q->nic); - - write_register(priv->net_dev, base, q->nic); - write_register(priv->net_dev, size, q->entries); - write_register(priv->net_dev, r, q->oldest); - write_register(priv->net_dev, w, q->next); - - IPW_DEBUG_INFO("exit\n"); -} - -static void ipw2100_kill_works(struct ipw2100_priv *priv) -{ - priv->stop_rf_kill = 1; - priv->stop_hang_check = 1; - cancel_delayed_work_sync(&priv->reset_work); - cancel_delayed_work_sync(&priv->security_work); - cancel_delayed_work_sync(&priv->wx_event_work); - cancel_delayed_work_sync(&priv->hang_check); - cancel_delayed_work_sync(&priv->rf_kill); - cancel_delayed_work_sync(&priv->scan_event); -} - -static int ipw2100_tx_allocate(struct ipw2100_priv *priv) -{ - int i, j, err = -EINVAL; - void *v; - dma_addr_t p; - - IPW_DEBUG_INFO("enter\n"); - - err = bd_queue_allocate(priv, &priv->tx_queue, TX_QUEUE_LENGTH); - if (err) { - IPW_DEBUG_ERROR("%s: failed bd_queue_allocate\n", - priv->net_dev->name); - return err; - } - - priv->tx_buffers = kmalloc_array(TX_PENDED_QUEUE_LENGTH, - sizeof(struct ipw2100_tx_packet), - GFP_ATOMIC); - if (!priv->tx_buffers) { - bd_queue_free(priv, &priv->tx_queue); - return -ENOMEM; - } - - for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { - v = pci_alloc_consistent(priv->pci_dev, - sizeof(struct ipw2100_data_header), - &p); - if (!v) { - printk(KERN_ERR DRV_NAME - ": %s: PCI alloc failed for tx " "buffers.\n", - priv->net_dev->name); - err = -ENOMEM; - break; - } - - priv->tx_buffers[i].type = DATA; - priv->tx_buffers[i].info.d_struct.data = - (struct ipw2100_data_header *)v; - priv->tx_buffers[i].info.d_struct.data_phys = p; - priv->tx_buffers[i].info.d_struct.txb = NULL; - } - - if (i == TX_PENDED_QUEUE_LENGTH) - return 0; - - for (j = 0; j < i; j++) { - pci_free_consistent(priv->pci_dev, - sizeof(struct ipw2100_data_header), - priv->tx_buffers[j].info.d_struct.data, - priv->tx_buffers[j].info.d_struct. - data_phys); - } - - kfree(priv->tx_buffers); - priv->tx_buffers = NULL; - - return err; -} - -static void ipw2100_tx_initialize(struct ipw2100_priv *priv) -{ - int i; - - IPW_DEBUG_INFO("enter\n"); - - /* - * reinitialize packet info lists - */ - INIT_LIST_HEAD(&priv->fw_pend_list); - INIT_STAT(&priv->fw_pend_stat); - - /* - * reinitialize lists - */ - INIT_LIST_HEAD(&priv->tx_pend_list); - INIT_LIST_HEAD(&priv->tx_free_list); - INIT_STAT(&priv->tx_pend_stat); - INIT_STAT(&priv->tx_free_stat); - - for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { - /* We simply drop any SKBs that have been queued for - * transmit */ - if (priv->tx_buffers[i].info.d_struct.txb) { - libipw_txb_free(priv->tx_buffers[i].info.d_struct. - txb); - priv->tx_buffers[i].info.d_struct.txb = NULL; - } - - list_add_tail(&priv->tx_buffers[i].list, &priv->tx_free_list); - } - - SET_STAT(&priv->tx_free_stat, i); - - priv->tx_queue.oldest = 0; - priv->tx_queue.available = priv->tx_queue.entries; - priv->tx_queue.next = 0; - INIT_STAT(&priv->txq_stat); - SET_STAT(&priv->txq_stat, priv->tx_queue.available); - - bd_queue_initialize(priv, &priv->tx_queue, - IPW_MEM_HOST_SHARED_TX_QUEUE_BD_BASE, - IPW_MEM_HOST_SHARED_TX_QUEUE_BD_SIZE, - IPW_MEM_HOST_SHARED_TX_QUEUE_READ_INDEX, - IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX); - - IPW_DEBUG_INFO("exit\n"); - -} - -static void ipw2100_tx_free(struct ipw2100_priv *priv) -{ - int i; - - IPW_DEBUG_INFO("enter\n"); - - bd_queue_free(priv, &priv->tx_queue); - - if (!priv->tx_buffers) - return; - - for (i = 0; i < TX_PENDED_QUEUE_LENGTH; i++) { - if (priv->tx_buffers[i].info.d_struct.txb) { - libipw_txb_free(priv->tx_buffers[i].info.d_struct. - txb); - priv->tx_buffers[i].info.d_struct.txb = NULL; - } - if (priv->tx_buffers[i].info.d_struct.data) - pci_free_consistent(priv->pci_dev, - sizeof(struct ipw2100_data_header), - priv->tx_buffers[i].info.d_struct. - data, - priv->tx_buffers[i].info.d_struct. - data_phys); - } - - kfree(priv->tx_buffers); - priv->tx_buffers = NULL; - - IPW_DEBUG_INFO("exit\n"); -} - -static int ipw2100_rx_allocate(struct ipw2100_priv *priv) -{ - int i, j, err = -EINVAL; - - IPW_DEBUG_INFO("enter\n"); - - err = bd_queue_allocate(priv, &priv->rx_queue, RX_QUEUE_LENGTH); - if (err) { - IPW_DEBUG_INFO("failed bd_queue_allocate\n"); - return err; - } - - err = status_queue_allocate(priv, RX_QUEUE_LENGTH); - if (err) { - IPW_DEBUG_INFO("failed status_queue_allocate\n"); - bd_queue_free(priv, &priv->rx_queue); - return err; - } - - /* - * allocate packets - */ - priv->rx_buffers = kmalloc(RX_QUEUE_LENGTH * - sizeof(struct ipw2100_rx_packet), - GFP_KERNEL); - if (!priv->rx_buffers) { - IPW_DEBUG_INFO("can't allocate rx packet buffer table\n"); - - bd_queue_free(priv, &priv->rx_queue); - - status_queue_free(priv); - - return -ENOMEM; - } - - for (i = 0; i < RX_QUEUE_LENGTH; i++) { - struct ipw2100_rx_packet *packet = &priv->rx_buffers[i]; - - err = ipw2100_alloc_skb(priv, packet); - if (unlikely(err)) { - err = -ENOMEM; - break; - } - - /* The BD holds the cache aligned address */ - priv->rx_queue.drv[i].host_addr = packet->dma_addr; - priv->rx_queue.drv[i].buf_length = IPW_RX_NIC_BUFFER_LENGTH; - priv->status_queue.drv[i].status_fields = 0; - } - - if (i == RX_QUEUE_LENGTH) - return 0; - - for (j = 0; j < i; j++) { - pci_unmap_single(priv->pci_dev, priv->rx_buffers[j].dma_addr, - sizeof(struct ipw2100_rx_packet), - PCI_DMA_FROMDEVICE); - dev_kfree_skb(priv->rx_buffers[j].skb); - } - - kfree(priv->rx_buffers); - priv->rx_buffers = NULL; - - bd_queue_free(priv, &priv->rx_queue); - - status_queue_free(priv); - - return err; -} - -static void ipw2100_rx_initialize(struct ipw2100_priv *priv) -{ - IPW_DEBUG_INFO("enter\n"); - - priv->rx_queue.oldest = 0; - priv->rx_queue.available = priv->rx_queue.entries - 1; - priv->rx_queue.next = priv->rx_queue.entries - 1; - - INIT_STAT(&priv->rxq_stat); - SET_STAT(&priv->rxq_stat, priv->rx_queue.available); - - bd_queue_initialize(priv, &priv->rx_queue, - IPW_MEM_HOST_SHARED_RX_BD_BASE, - IPW_MEM_HOST_SHARED_RX_BD_SIZE, - IPW_MEM_HOST_SHARED_RX_READ_INDEX, - IPW_MEM_HOST_SHARED_RX_WRITE_INDEX); - - /* set up the status queue */ - write_register(priv->net_dev, IPW_MEM_HOST_SHARED_RX_STATUS_BASE, - priv->status_queue.nic); - - IPW_DEBUG_INFO("exit\n"); -} - -static void ipw2100_rx_free(struct ipw2100_priv *priv) -{ - int i; - - IPW_DEBUG_INFO("enter\n"); - - bd_queue_free(priv, &priv->rx_queue); - status_queue_free(priv); - - if (!priv->rx_buffers) - return; - - for (i = 0; i < RX_QUEUE_LENGTH; i++) { - if (priv->rx_buffers[i].rxp) { - pci_unmap_single(priv->pci_dev, - priv->rx_buffers[i].dma_addr, - sizeof(struct ipw2100_rx), - PCI_DMA_FROMDEVICE); - dev_kfree_skb(priv->rx_buffers[i].skb); - } - } - - kfree(priv->rx_buffers); - priv->rx_buffers = NULL; - - IPW_DEBUG_INFO("exit\n"); -} - -static int ipw2100_read_mac_address(struct ipw2100_priv *priv) -{ - u32 length = ETH_ALEN; - u8 addr[ETH_ALEN]; - - int err; - - err = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ADAPTER_MAC, addr, &length); - if (err) { - IPW_DEBUG_INFO("MAC address read failed\n"); - return -EIO; - } - - memcpy(priv->net_dev->dev_addr, addr, ETH_ALEN); - IPW_DEBUG_INFO("card MAC is %pM\n", priv->net_dev->dev_addr); - - return 0; -} - -/******************************************************************** - * - * Firmware Commands - * - ********************************************************************/ - -static int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode) -{ - struct host_command cmd = { - .host_command = ADAPTER_ADDRESS, - .host_command_sequence = 0, - .host_command_length = ETH_ALEN - }; - int err; - - IPW_DEBUG_HC("SET_MAC_ADDRESS\n"); - - IPW_DEBUG_INFO("enter\n"); - - if (priv->config & CFG_CUSTOM_MAC) { - memcpy(cmd.host_command_parameters, priv->mac_addr, ETH_ALEN); - memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); - } else - memcpy(cmd.host_command_parameters, priv->net_dev->dev_addr, - ETH_ALEN); - - err = ipw2100_hw_send_command(priv, &cmd); - - IPW_DEBUG_INFO("exit\n"); - return err; -} - -static int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type, - int batch_mode) -{ - struct host_command cmd = { - .host_command = PORT_TYPE, - .host_command_sequence = 0, - .host_command_length = sizeof(u32) - }; - int err; - - switch (port_type) { - case IW_MODE_INFRA: - cmd.host_command_parameters[0] = IPW_BSS; - break; - case IW_MODE_ADHOC: - cmd.host_command_parameters[0] = IPW_IBSS; - break; - } - - IPW_DEBUG_HC("PORT_TYPE: %s\n", - port_type == IPW_IBSS ? "Ad-Hoc" : "Managed"); - - if (!batch_mode) { - err = ipw2100_disable_adapter(priv); - if (err) { - printk(KERN_ERR DRV_NAME - ": %s: Could not disable adapter %d\n", - priv->net_dev->name, err); - return err; - } - } - - /* send cmd to firmware */ - err = ipw2100_hw_send_command(priv, &cmd); - - if (!batch_mode) - ipw2100_enable_adapter(priv); - - return err; -} - -static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, - int batch_mode) -{ - struct host_command cmd = { - .host_command = CHANNEL, - .host_command_sequence = 0, - .host_command_length = sizeof(u32) - }; - int err; - - cmd.host_command_parameters[0] = channel; - - IPW_DEBUG_HC("CHANNEL: %d\n", channel); - - /* If BSS then we don't support channel selection */ - if (priv->ieee->iw_mode == IW_MODE_INFRA) - return 0; - - if ((channel != 0) && - ((channel < REG_MIN_CHANNEL) || (channel > REG_MAX_CHANNEL))) - return -EINVAL; - - if (!batch_mode) { - err = ipw2100_disable_adapter(priv); - if (err) - return err; - } - - err = ipw2100_hw_send_command(priv, &cmd); - if (err) { - IPW_DEBUG_INFO("Failed to set channel to %d", channel); - return err; - } - - if (channel) - priv->config |= CFG_STATIC_CHANNEL; - else - priv->config &= ~CFG_STATIC_CHANNEL; - - priv->channel = channel; - - if (!batch_mode) { - err = ipw2100_enable_adapter(priv); - if (err) - return err; - } - - return 0; -} - -static int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode) -{ - struct host_command cmd = { - .host_command = SYSTEM_CONFIG, - .host_command_sequence = 0, - .host_command_length = 12, - }; - u32 ibss_mask, len = sizeof(u32); - int err; - - /* Set system configuration */ - - if (!batch_mode) { - err = ipw2100_disable_adapter(priv); - if (err) - return err; - } - - if (priv->ieee->iw_mode == IW_MODE_ADHOC) - cmd.host_command_parameters[0] |= IPW_CFG_IBSS_AUTO_START; - - cmd.host_command_parameters[0] |= IPW_CFG_IBSS_MASK | - IPW_CFG_BSS_MASK | IPW_CFG_802_1x_ENABLE; - - if (!(priv->config & CFG_LONG_PREAMBLE)) - cmd.host_command_parameters[0] |= IPW_CFG_PREAMBLE_AUTO; - - err = ipw2100_get_ordinal(priv, - IPW_ORD_EEPROM_IBSS_11B_CHANNELS, - &ibss_mask, &len); - if (err) - ibss_mask = IPW_IBSS_11B_DEFAULT_MASK; - - cmd.host_command_parameters[1] = REG_CHANNEL_MASK; - cmd.host_command_parameters[2] = REG_CHANNEL_MASK & ibss_mask; - - /* 11b only */ - /*cmd.host_command_parameters[0] |= DIVERSITY_ANTENNA_A; */ - - err = ipw2100_hw_send_command(priv, &cmd); - if (err) - return err; - -/* If IPv6 is configured in the kernel then we don't want to filter out all - * of the multicast packets as IPv6 needs some. */ -#if !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) - cmd.host_command = ADD_MULTICAST; - cmd.host_command_sequence = 0; - cmd.host_command_length = 0; - - ipw2100_hw_send_command(priv, &cmd); -#endif - if (!batch_mode) { - err = ipw2100_enable_adapter(priv); - if (err) - return err; - } - - return 0; -} - -static int ipw2100_set_tx_rates(struct ipw2100_priv *priv, u32 rate, - int batch_mode) -{ - struct host_command cmd = { - .host_command = BASIC_TX_RATES, - .host_command_sequence = 0, - .host_command_length = 4 - }; - int err; - - cmd.host_command_parameters[0] = rate & TX_RATE_MASK; - - if (!batch_mode) { - err = ipw2100_disable_adapter(priv); - if (err) - return err; - } - - /* Set BASIC TX Rate first */ - ipw2100_hw_send_command(priv, &cmd); - - /* Set TX Rate */ - cmd.host_command = TX_RATES; - ipw2100_hw_send_command(priv, &cmd); - - /* Set MSDU TX Rate */ - cmd.host_command = MSDU_TX_RATES; - ipw2100_hw_send_command(priv, &cmd); - - if (!batch_mode) { - err = ipw2100_enable_adapter(priv); - if (err) - return err; - } - - priv->tx_rates = rate; - - return 0; -} - -static int ipw2100_set_power_mode(struct ipw2100_priv *priv, int power_level) -{ - struct host_command cmd = { - .host_command = POWER_MODE, - .host_command_sequence = 0, - .host_command_length = 4 - }; - int err; - - cmd.host_command_parameters[0] = power_level; - - err = ipw2100_hw_send_command(priv, &cmd); - if (err) - return err; - - if (power_level == IPW_POWER_MODE_CAM) - priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); - else - priv->power_mode = IPW_POWER_ENABLED | power_level; - -#ifdef IPW2100_TX_POWER - if (priv->port_type == IBSS && priv->adhoc_power != DFTL_IBSS_TX_POWER) { - /* Set beacon interval */ - cmd.host_command = TX_POWER_INDEX; - cmd.host_command_parameters[0] = (u32) priv->adhoc_power; - - err = ipw2100_hw_send_command(priv, &cmd); - if (err) - return err; - } -#endif - - return 0; -} - -static int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold) -{ - struct host_command cmd = { - .host_command = RTS_THRESHOLD, - .host_command_sequence = 0, - .host_command_length = 4 - }; - int err; - - if (threshold & RTS_DISABLED) - cmd.host_command_parameters[0] = MAX_RTS_THRESHOLD; - else - cmd.host_command_parameters[0] = threshold & ~RTS_DISABLED; - - err = ipw2100_hw_send_command(priv, &cmd); - if (err) - return err; - - priv->rts_threshold = threshold; - - return 0; -} - -#if 0 -int ipw2100_set_fragmentation_threshold(struct ipw2100_priv *priv, - u32 threshold, int batch_mode) -{ - struct host_command cmd = { - .host_command = FRAG_THRESHOLD, - .host_command_sequence = 0, - .host_command_length = 4, - .host_command_parameters[0] = 0, - }; - int err; - - if (!batch_mode) { - err = ipw2100_disable_adapter(priv); - if (err) - return err; - } - - if (threshold == 0) - threshold = DEFAULT_FRAG_THRESHOLD; - else { - threshold = max(threshold, MIN_FRAG_THRESHOLD); - threshold = min(threshold, MAX_FRAG_THRESHOLD); - } - - cmd.host_command_parameters[0] = threshold; - - IPW_DEBUG_HC("FRAG_THRESHOLD: %u\n", threshold); - - err = ipw2100_hw_send_command(priv, &cmd); - - if (!batch_mode) - ipw2100_enable_adapter(priv); - - if (!err) - priv->frag_threshold = threshold; - - return err; -} -#endif - -static int ipw2100_set_short_retry(struct ipw2100_priv *priv, u32 retry) -{ - struct host_command cmd = { - .host_command = SHORT_RETRY_LIMIT, - .host_command_sequence = 0, - .host_command_length = 4 - }; - int err; - - cmd.host_command_parameters[0] = retry; - - err = ipw2100_hw_send_command(priv, &cmd); - if (err) - return err; - - priv->short_retry_limit = retry; - - return 0; -} - -static int ipw2100_set_long_retry(struct ipw2100_priv *priv, u32 retry) -{ - struct host_command cmd = { - .host_command = LONG_RETRY_LIMIT, - .host_command_sequence = 0, - .host_command_length = 4 - }; - int err; - - cmd.host_command_parameters[0] = retry; - - err = ipw2100_hw_send_command(priv, &cmd); - if (err) - return err; - - priv->long_retry_limit = retry; - - return 0; -} - -static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 * bssid, - int batch_mode) -{ - struct host_command cmd = { - .host_command = MANDATORY_BSSID, - .host_command_sequence = 0, - .host_command_length = (bssid == NULL) ? 0 : ETH_ALEN - }; - int err; - -#ifdef CONFIG_IPW2100_DEBUG - if (bssid != NULL) - IPW_DEBUG_HC("MANDATORY_BSSID: %pM\n", bssid); - else - IPW_DEBUG_HC("MANDATORY_BSSID: \n"); -#endif - /* if BSSID is empty then we disable mandatory bssid mode */ - if (bssid != NULL) - memcpy(cmd.host_command_parameters, bssid, ETH_ALEN); - - if (!batch_mode) { - err = ipw2100_disable_adapter(priv); - if (err) - return err; - } - - err = ipw2100_hw_send_command(priv, &cmd); - - if (!batch_mode) - ipw2100_enable_adapter(priv); - - return err; -} - -static int ipw2100_disassociate_bssid(struct ipw2100_priv *priv) -{ - struct host_command cmd = { - .host_command = DISASSOCIATION_BSSID, - .host_command_sequence = 0, - .host_command_length = ETH_ALEN - }; - int err; - int len; - - IPW_DEBUG_HC("DISASSOCIATION_BSSID\n"); - - len = ETH_ALEN; - /* The Firmware currently ignores the BSSID and just disassociates from - * the currently associated AP -- but in the off chance that a future - * firmware does use the BSSID provided here, we go ahead and try and - * set it to the currently associated AP's BSSID */ - memcpy(cmd.host_command_parameters, priv->bssid, ETH_ALEN); - - err = ipw2100_hw_send_command(priv, &cmd); - - return err; -} - -static int ipw2100_set_wpa_ie(struct ipw2100_priv *, - struct ipw2100_wpa_assoc_frame *, int) - __attribute__ ((unused)); - -static int ipw2100_set_wpa_ie(struct ipw2100_priv *priv, - struct ipw2100_wpa_assoc_frame *wpa_frame, - int batch_mode) -{ - struct host_command cmd = { - .host_command = SET_WPA_IE, - .host_command_sequence = 0, - .host_command_length = sizeof(struct ipw2100_wpa_assoc_frame), - }; - int err; - - IPW_DEBUG_HC("SET_WPA_IE\n"); - - if (!batch_mode) { - err = ipw2100_disable_adapter(priv); - if (err) - return err; - } - - memcpy(cmd.host_command_parameters, wpa_frame, - sizeof(struct ipw2100_wpa_assoc_frame)); - - err = ipw2100_hw_send_command(priv, &cmd); - - if (!batch_mode) { - if (ipw2100_enable_adapter(priv)) - err = -EIO; - } - - return err; -} - -struct security_info_params { - u32 allowed_ciphers; - u16 version; - u8 auth_mode; - u8 replay_counters_number; - u8 unicast_using_group; -} __packed; - -static int ipw2100_set_security_information(struct ipw2100_priv *priv, - int auth_mode, - int security_level, - int unicast_using_group, - int batch_mode) -{ - struct host_command cmd = { - .host_command = SET_SECURITY_INFORMATION, - .host_command_sequence = 0, - .host_command_length = sizeof(struct security_info_params) - }; - struct security_info_params *security = - (struct security_info_params *)&cmd.host_command_parameters; - int err; - memset(security, 0, sizeof(*security)); - - /* If shared key AP authentication is turned on, then we need to - * configure the firmware to try and use it. - * - * Actual data encryption/decryption is handled by the host. */ - security->auth_mode = auth_mode; - security->unicast_using_group = unicast_using_group; - - switch (security_level) { - default: - case SEC_LEVEL_0: - security->allowed_ciphers = IPW_NONE_CIPHER; - break; - case SEC_LEVEL_1: - security->allowed_ciphers = IPW_WEP40_CIPHER | - IPW_WEP104_CIPHER; - break; - case SEC_LEVEL_2: - security->allowed_ciphers = IPW_WEP40_CIPHER | - IPW_WEP104_CIPHER | IPW_TKIP_CIPHER; - break; - case SEC_LEVEL_2_CKIP: - security->allowed_ciphers = IPW_WEP40_CIPHER | - IPW_WEP104_CIPHER | IPW_CKIP_CIPHER; - break; - case SEC_LEVEL_3: - security->allowed_ciphers = IPW_WEP40_CIPHER | - IPW_WEP104_CIPHER | IPW_TKIP_CIPHER | IPW_CCMP_CIPHER; - break; - } - - IPW_DEBUG_HC - ("SET_SECURITY_INFORMATION: auth:%d cipher:0x%02X (level %d)\n", - security->auth_mode, security->allowed_ciphers, security_level); - - security->replay_counters_number = 0; - - if (!batch_mode) { - err = ipw2100_disable_adapter(priv); - if (err) - return err; - } - - err = ipw2100_hw_send_command(priv, &cmd); - - if (!batch_mode) - ipw2100_enable_adapter(priv); - - return err; -} - -static int ipw2100_set_tx_power(struct ipw2100_priv *priv, u32 tx_power) -{ - struct host_command cmd = { - .host_command = TX_POWER_INDEX, - .host_command_sequence = 0, - .host_command_length = 4 - }; - int err = 0; - u32 tmp = tx_power; - - if (tx_power != IPW_TX_POWER_DEFAULT) - tmp = (tx_power - IPW_TX_POWER_MIN_DBM) * 16 / - (IPW_TX_POWER_MAX_DBM - IPW_TX_POWER_MIN_DBM); - - cmd.host_command_parameters[0] = tmp; - - if (priv->ieee->iw_mode == IW_MODE_ADHOC) - err = ipw2100_hw_send_command(priv, &cmd); - if (!err) - priv->tx_power = tx_power; - - return 0; -} - -static int ipw2100_set_ibss_beacon_interval(struct ipw2100_priv *priv, - u32 interval, int batch_mode) -{ - struct host_command cmd = { - .host_command = BEACON_INTERVAL, - .host_command_sequence = 0, - .host_command_length = 4 - }; - int err; - - cmd.host_command_parameters[0] = interval; - - IPW_DEBUG_INFO("enter\n"); - - if (priv->ieee->iw_mode == IW_MODE_ADHOC) { - if (!batch_mode) { - err = ipw2100_disable_adapter(priv); - if (err) - return err; - } - - ipw2100_hw_send_command(priv, &cmd); - - if (!batch_mode) { - err = ipw2100_enable_adapter(priv); - if (err) - return err; - } - } - - IPW_DEBUG_INFO("exit\n"); - - return 0; -} - -static void ipw2100_queues_initialize(struct ipw2100_priv *priv) -{ - ipw2100_tx_initialize(priv); - ipw2100_rx_initialize(priv); - ipw2100_msg_initialize(priv); -} - -static void ipw2100_queues_free(struct ipw2100_priv *priv) -{ - ipw2100_tx_free(priv); - ipw2100_rx_free(priv); - ipw2100_msg_free(priv); -} - -static int ipw2100_queues_allocate(struct ipw2100_priv *priv) -{ - if (ipw2100_tx_allocate(priv) || - ipw2100_rx_allocate(priv) || ipw2100_msg_allocate(priv)) - goto fail; - - return 0; - - fail: - ipw2100_tx_free(priv); - ipw2100_rx_free(priv); - ipw2100_msg_free(priv); - return -ENOMEM; -} - -#define IPW_PRIVACY_CAPABLE 0x0008 - -static int ipw2100_set_wep_flags(struct ipw2100_priv *priv, u32 flags, - int batch_mode) -{ - struct host_command cmd = { - .host_command = WEP_FLAGS, - .host_command_sequence = 0, - .host_command_length = 4 - }; - int err; - - cmd.host_command_parameters[0] = flags; - - IPW_DEBUG_HC("WEP_FLAGS: flags = 0x%08X\n", flags); - - if (!batch_mode) { - err = ipw2100_disable_adapter(priv); - if (err) { - printk(KERN_ERR DRV_NAME - ": %s: Could not disable adapter %d\n", - priv->net_dev->name, err); - return err; - } - } - - /* send cmd to firmware */ - err = ipw2100_hw_send_command(priv, &cmd); - - if (!batch_mode) - ipw2100_enable_adapter(priv); - - return err; -} - -struct ipw2100_wep_key { - u8 idx; - u8 len; - u8 key[13]; -}; - -/* Macros to ease up priting WEP keys */ -#define WEP_FMT_64 "%02X%02X%02X%02X-%02X" -#define WEP_FMT_128 "%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X" -#define WEP_STR_64(x) x[0],x[1],x[2],x[3],x[4] -#define WEP_STR_128(x) x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10] - -/** - * Set a the wep key - * - * @priv: struct to work on - * @idx: index of the key we want to set - * @key: ptr to the key data to set - * @len: length of the buffer at @key - * @batch_mode: FIXME perform the operation in batch mode, not - * disabling the device. - * - * @returns 0 if OK, < 0 errno code on error. - * - * Fill out a command structure with the new wep key, length an - * index and send it down the wire. - */ -static int ipw2100_set_key(struct ipw2100_priv *priv, - int idx, char *key, int len, int batch_mode) -{ - int keylen = len ? (len <= 5 ? 5 : 13) : 0; - struct host_command cmd = { - .host_command = WEP_KEY_INFO, - .host_command_sequence = 0, - .host_command_length = sizeof(struct ipw2100_wep_key), - }; - struct ipw2100_wep_key *wep_key = (void *)cmd.host_command_parameters; - int err; - - IPW_DEBUG_HC("WEP_KEY_INFO: index = %d, len = %d/%d\n", - idx, keylen, len); - - /* NOTE: We don't check cached values in case the firmware was reset - * or some other problem is occurring. If the user is setting the key, - * then we push the change */ - - wep_key->idx = idx; - wep_key->len = keylen; - - if (keylen) { - memcpy(wep_key->key, key, len); - memset(wep_key->key + len, 0, keylen - len); - } - - /* Will be optimized out on debug not being configured in */ - if (keylen == 0) - IPW_DEBUG_WEP("%s: Clearing key %d\n", - priv->net_dev->name, wep_key->idx); - else if (keylen == 5) - IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_64 "\n", - priv->net_dev->name, wep_key->idx, wep_key->len, - WEP_STR_64(wep_key->key)); - else - IPW_DEBUG_WEP("%s: idx: %d, len: %d key: " WEP_FMT_128 - "\n", - priv->net_dev->name, wep_key->idx, wep_key->len, - WEP_STR_128(wep_key->key)); - - if (!batch_mode) { - err = ipw2100_disable_adapter(priv); - /* FIXME: IPG: shouldn't this prink be in _disable_adapter()? */ - if (err) { - printk(KERN_ERR DRV_NAME - ": %s: Could not disable adapter %d\n", - priv->net_dev->name, err); - return err; - } - } - - /* send cmd to firmware */ - err = ipw2100_hw_send_command(priv, &cmd); - - if (!batch_mode) { - int err2 = ipw2100_enable_adapter(priv); - if (err == 0) - err = err2; - } - return err; -} - -static int ipw2100_set_key_index(struct ipw2100_priv *priv, - int idx, int batch_mode) -{ - struct host_command cmd = { - .host_command = WEP_KEY_INDEX, - .host_command_sequence = 0, - .host_command_length = 4, - .host_command_parameters = {idx}, - }; - int err; - - IPW_DEBUG_HC("WEP_KEY_INDEX: index = %d\n", idx); - - if (idx < 0 || idx > 3) - return -EINVAL; - - if (!batch_mode) { - err = ipw2100_disable_adapter(priv); - if (err) { - printk(KERN_ERR DRV_NAME - ": %s: Could not disable adapter %d\n", - priv->net_dev->name, err); - return err; - } - } - - /* send cmd to firmware */ - err = ipw2100_hw_send_command(priv, &cmd); - - if (!batch_mode) - ipw2100_enable_adapter(priv); - - return err; -} - -static int ipw2100_configure_security(struct ipw2100_priv *priv, int batch_mode) -{ - int i, err, auth_mode, sec_level, use_group; - - if (!(priv->status & STATUS_RUNNING)) - return 0; - - if (!batch_mode) { - err = ipw2100_disable_adapter(priv); - if (err) - return err; - } - - if (!priv->ieee->sec.enabled) { - err = - ipw2100_set_security_information(priv, IPW_AUTH_OPEN, - SEC_LEVEL_0, 0, 1); - } else { - auth_mode = IPW_AUTH_OPEN; - if (priv->ieee->sec.flags & SEC_AUTH_MODE) { - if (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY) - auth_mode = IPW_AUTH_SHARED; - else if (priv->ieee->sec.auth_mode == WLAN_AUTH_LEAP) - auth_mode = IPW_AUTH_LEAP_CISCO_ID; - } - - sec_level = SEC_LEVEL_0; - if (priv->ieee->sec.flags & SEC_LEVEL) - sec_level = priv->ieee->sec.level; - - use_group = 0; - if (priv->ieee->sec.flags & SEC_UNICAST_GROUP) - use_group = priv->ieee->sec.unicast_uses_group; - - err = - ipw2100_set_security_information(priv, auth_mode, sec_level, - use_group, 1); - } - - if (err) - goto exit; - - if (priv->ieee->sec.enabled) { - for (i = 0; i < 4; i++) { - if (!(priv->ieee->sec.flags & (1 << i))) { - memset(priv->ieee->sec.keys[i], 0, WEP_KEY_LEN); - priv->ieee->sec.key_sizes[i] = 0; - } else { - err = ipw2100_set_key(priv, i, - priv->ieee->sec.keys[i], - priv->ieee->sec. - key_sizes[i], 1); - if (err) - goto exit; - } - } - - ipw2100_set_key_index(priv, priv->ieee->crypt_info.tx_keyidx, 1); - } - - /* Always enable privacy so the Host can filter WEP packets if - * encrypted data is sent up */ - err = - ipw2100_set_wep_flags(priv, - priv->ieee->sec. - enabled ? IPW_PRIVACY_CAPABLE : 0, 1); - if (err) - goto exit; - - priv->status &= ~STATUS_SECURITY_UPDATED; - - exit: - if (!batch_mode) - ipw2100_enable_adapter(priv); - - return err; -} - -static void ipw2100_security_work(struct work_struct *work) -{ - struct ipw2100_priv *priv = - container_of(work, struct ipw2100_priv, security_work.work); - - /* If we happen to have reconnected before we get a chance to - * process this, then update the security settings--which causes - * a disassociation to occur */ - if (!(priv->status & STATUS_ASSOCIATED) && - priv->status & STATUS_SECURITY_UPDATED) - ipw2100_configure_security(priv, 0); -} - -static void shim__set_security(struct net_device *dev, - struct libipw_security *sec) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - int i, force_update = 0; - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) - goto done; - - for (i = 0; i < 4; i++) { - if (sec->flags & (1 << i)) { - priv->ieee->sec.key_sizes[i] = sec->key_sizes[i]; - if (sec->key_sizes[i] == 0) - priv->ieee->sec.flags &= ~(1 << i); - else - memcpy(priv->ieee->sec.keys[i], sec->keys[i], - sec->key_sizes[i]); - if (sec->level == SEC_LEVEL_1) { - priv->ieee->sec.flags |= (1 << i); - priv->status |= STATUS_SECURITY_UPDATED; - } else - priv->ieee->sec.flags &= ~(1 << i); - } - } - - if ((sec->flags & SEC_ACTIVE_KEY) && - priv->ieee->sec.active_key != sec->active_key) { - if (sec->active_key <= 3) { - priv->ieee->sec.active_key = sec->active_key; - priv->ieee->sec.flags |= SEC_ACTIVE_KEY; - } else - priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; - - priv->status |= STATUS_SECURITY_UPDATED; - } - - if ((sec->flags & SEC_AUTH_MODE) && - (priv->ieee->sec.auth_mode != sec->auth_mode)) { - priv->ieee->sec.auth_mode = sec->auth_mode; - priv->ieee->sec.flags |= SEC_AUTH_MODE; - priv->status |= STATUS_SECURITY_UPDATED; - } - - if (sec->flags & SEC_ENABLED && priv->ieee->sec.enabled != sec->enabled) { - priv->ieee->sec.flags |= SEC_ENABLED; - priv->ieee->sec.enabled = sec->enabled; - priv->status |= STATUS_SECURITY_UPDATED; - force_update = 1; - } - - if (sec->flags & SEC_ENCRYPT) - priv->ieee->sec.encrypt = sec->encrypt; - - if (sec->flags & SEC_LEVEL && priv->ieee->sec.level != sec->level) { - priv->ieee->sec.level = sec->level; - priv->ieee->sec.flags |= SEC_LEVEL; - priv->status |= STATUS_SECURITY_UPDATED; - } - - IPW_DEBUG_WEP("Security flags: %c %c%c%c%c %c%c%c%c\n", - priv->ieee->sec.flags & (1 << 8) ? '1' : '0', - priv->ieee->sec.flags & (1 << 7) ? '1' : '0', - priv->ieee->sec.flags & (1 << 6) ? '1' : '0', - priv->ieee->sec.flags & (1 << 5) ? '1' : '0', - priv->ieee->sec.flags & (1 << 4) ? '1' : '0', - priv->ieee->sec.flags & (1 << 3) ? '1' : '0', - priv->ieee->sec.flags & (1 << 2) ? '1' : '0', - priv->ieee->sec.flags & (1 << 1) ? '1' : '0', - priv->ieee->sec.flags & (1 << 0) ? '1' : '0'); - -/* As a temporary work around to enable WPA until we figure out why - * wpa_supplicant toggles the security capability of the driver, which - * forces a disassocation with force_update... - * - * if (force_update || !(priv->status & STATUS_ASSOCIATED))*/ - if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) - ipw2100_configure_security(priv, 0); - done: - mutex_unlock(&priv->action_mutex); -} - -static int ipw2100_adapter_setup(struct ipw2100_priv *priv) -{ - int err; - int batch_mode = 1; - u8 *bssid; - - IPW_DEBUG_INFO("enter\n"); - - err = ipw2100_disable_adapter(priv); - if (err) - return err; -#ifdef CONFIG_IPW2100_MONITOR - if (priv->ieee->iw_mode == IW_MODE_MONITOR) { - err = ipw2100_set_channel(priv, priv->channel, batch_mode); - if (err) - return err; - - IPW_DEBUG_INFO("exit\n"); - - return 0; - } -#endif /* CONFIG_IPW2100_MONITOR */ - - err = ipw2100_read_mac_address(priv); - if (err) - return -EIO; - - err = ipw2100_set_mac_address(priv, batch_mode); - if (err) - return err; - - err = ipw2100_set_port_type(priv, priv->ieee->iw_mode, batch_mode); - if (err) - return err; - - if (priv->ieee->iw_mode == IW_MODE_ADHOC) { - err = ipw2100_set_channel(priv, priv->channel, batch_mode); - if (err) - return err; - } - - err = ipw2100_system_config(priv, batch_mode); - if (err) - return err; - - err = ipw2100_set_tx_rates(priv, priv->tx_rates, batch_mode); - if (err) - return err; - - /* Default to power mode OFF */ - err = ipw2100_set_power_mode(priv, IPW_POWER_MODE_CAM); - if (err) - return err; - - err = ipw2100_set_rts_threshold(priv, priv->rts_threshold); - if (err) - return err; - - if (priv->config & CFG_STATIC_BSSID) - bssid = priv->bssid; - else - bssid = NULL; - err = ipw2100_set_mandatory_bssid(priv, bssid, batch_mode); - if (err) - return err; - - if (priv->config & CFG_STATIC_ESSID) - err = ipw2100_set_essid(priv, priv->essid, priv->essid_len, - batch_mode); - else - err = ipw2100_set_essid(priv, NULL, 0, batch_mode); - if (err) - return err; - - err = ipw2100_configure_security(priv, batch_mode); - if (err) - return err; - - if (priv->ieee->iw_mode == IW_MODE_ADHOC) { - err = - ipw2100_set_ibss_beacon_interval(priv, - priv->beacon_interval, - batch_mode); - if (err) - return err; - - err = ipw2100_set_tx_power(priv, priv->tx_power); - if (err) - return err; - } - - /* - err = ipw2100_set_fragmentation_threshold( - priv, priv->frag_threshold, batch_mode); - if (err) - return err; - */ - - IPW_DEBUG_INFO("exit\n"); - - return 0; -} - -/************************************************************************* - * - * EXTERNALLY CALLED METHODS - * - *************************************************************************/ - -/* This method is called by the network layer -- not to be confused with - * ipw2100_set_mac_address() declared above called by this driver (and this - * method as well) to talk to the firmware */ -static int ipw2100_set_address(struct net_device *dev, void *p) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - struct sockaddr *addr = p; - int err = 0; - - if (!is_valid_ether_addr(addr->sa_data)) - return -EADDRNOTAVAIL; - - mutex_lock(&priv->action_mutex); - - priv->config |= CFG_CUSTOM_MAC; - memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); - - err = ipw2100_set_mac_address(priv, 0); - if (err) - goto done; - - priv->reset_backoff = 0; - mutex_unlock(&priv->action_mutex); - ipw2100_reset_adapter(&priv->reset_work.work); - return 0; - - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -static int ipw2100_open(struct net_device *dev) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - unsigned long flags; - IPW_DEBUG_INFO("dev->open\n"); - - spin_lock_irqsave(&priv->low_lock, flags); - if (priv->status & STATUS_ASSOCIATED) { - netif_carrier_on(dev); - netif_start_queue(dev); - } - spin_unlock_irqrestore(&priv->low_lock, flags); - - return 0; -} - -static int ipw2100_close(struct net_device *dev) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - unsigned long flags; - struct list_head *element; - struct ipw2100_tx_packet *packet; - - IPW_DEBUG_INFO("enter\n"); - - spin_lock_irqsave(&priv->low_lock, flags); - - if (priv->status & STATUS_ASSOCIATED) - netif_carrier_off(dev); - netif_stop_queue(dev); - - /* Flush the TX queue ... */ - while (!list_empty(&priv->tx_pend_list)) { - element = priv->tx_pend_list.next; - packet = list_entry(element, struct ipw2100_tx_packet, list); - - list_del(element); - DEC_STAT(&priv->tx_pend_stat); - - libipw_txb_free(packet->info.d_struct.txb); - packet->info.d_struct.txb = NULL; - - list_add_tail(element, &priv->tx_free_list); - INC_STAT(&priv->tx_free_stat); - } - spin_unlock_irqrestore(&priv->low_lock, flags); - - IPW_DEBUG_INFO("exit\n"); - - return 0; -} - -/* - * TODO: Fix this function... its just wrong - */ -static void ipw2100_tx_timeout(struct net_device *dev) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - - dev->stats.tx_errors++; - -#ifdef CONFIG_IPW2100_MONITOR - if (priv->ieee->iw_mode == IW_MODE_MONITOR) - return; -#endif - - IPW_DEBUG_INFO("%s: TX timed out. Scheduling firmware restart.\n", - dev->name); - schedule_reset(priv); -} - -static int ipw2100_wpa_enable(struct ipw2100_priv *priv, int value) -{ - /* This is called when wpa_supplicant loads and closes the driver - * interface. */ - priv->ieee->wpa_enabled = value; - return 0; -} - -static int ipw2100_wpa_set_auth_algs(struct ipw2100_priv *priv, int value) -{ - - struct libipw_device *ieee = priv->ieee; - struct libipw_security sec = { - .flags = SEC_AUTH_MODE, - }; - int ret = 0; - - if (value & IW_AUTH_ALG_SHARED_KEY) { - sec.auth_mode = WLAN_AUTH_SHARED_KEY; - ieee->open_wep = 0; - } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { - sec.auth_mode = WLAN_AUTH_OPEN; - ieee->open_wep = 1; - } else if (value & IW_AUTH_ALG_LEAP) { - sec.auth_mode = WLAN_AUTH_LEAP; - ieee->open_wep = 1; - } else - return -EINVAL; - - if (ieee->set_security) - ieee->set_security(ieee->dev, &sec); - else - ret = -EOPNOTSUPP; - - return ret; -} - -static void ipw2100_wpa_assoc_frame(struct ipw2100_priv *priv, - char *wpa_ie, int wpa_ie_len) -{ - - struct ipw2100_wpa_assoc_frame frame; - - frame.fixed_ie_mask = 0; - - /* copy WPA IE */ - memcpy(frame.var_ie, wpa_ie, wpa_ie_len); - frame.var_ie_len = wpa_ie_len; - - /* make sure WPA is enabled */ - ipw2100_wpa_enable(priv, 1); - ipw2100_set_wpa_ie(priv, &frame, 0); -} - -static void ipw_ethtool_get_drvinfo(struct net_device *dev, - struct ethtool_drvinfo *info) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - char fw_ver[64], ucode_ver[64]; - - strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); - strlcpy(info->version, DRV_VERSION, sizeof(info->version)); - - ipw2100_get_fwversion(priv, fw_ver, sizeof(fw_ver)); - ipw2100_get_ucodeversion(priv, ucode_ver, sizeof(ucode_ver)); - - snprintf(info->fw_version, sizeof(info->fw_version), "%s:%d:%s", - fw_ver, priv->eeprom_version, ucode_ver); - - strlcpy(info->bus_info, pci_name(priv->pci_dev), - sizeof(info->bus_info)); -} - -static u32 ipw2100_ethtool_get_link(struct net_device *dev) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - return (priv->status & STATUS_ASSOCIATED) ? 1 : 0; -} - -static const struct ethtool_ops ipw2100_ethtool_ops = { - .get_link = ipw2100_ethtool_get_link, - .get_drvinfo = ipw_ethtool_get_drvinfo, -}; - -static void ipw2100_hang_check(struct work_struct *work) -{ - struct ipw2100_priv *priv = - container_of(work, struct ipw2100_priv, hang_check.work); - unsigned long flags; - u32 rtc = 0xa5a5a5a5; - u32 len = sizeof(rtc); - int restart = 0; - - spin_lock_irqsave(&priv->low_lock, flags); - - if (priv->fatal_error != 0) { - /* If fatal_error is set then we need to restart */ - IPW_DEBUG_INFO("%s: Hardware fatal error detected.\n", - priv->net_dev->name); - - restart = 1; - } else if (ipw2100_get_ordinal(priv, IPW_ORD_RTC_TIME, &rtc, &len) || - (rtc == priv->last_rtc)) { - /* Check if firmware is hung */ - IPW_DEBUG_INFO("%s: Firmware RTC stalled.\n", - priv->net_dev->name); - - restart = 1; - } - - if (restart) { - /* Kill timer */ - priv->stop_hang_check = 1; - priv->hangs++; - - /* Restart the NIC */ - schedule_reset(priv); - } - - priv->last_rtc = rtc; - - if (!priv->stop_hang_check) - schedule_delayed_work(&priv->hang_check, HZ / 2); - - spin_unlock_irqrestore(&priv->low_lock, flags); -} - -static void ipw2100_rf_kill(struct work_struct *work) -{ - struct ipw2100_priv *priv = - container_of(work, struct ipw2100_priv, rf_kill.work); - unsigned long flags; - - spin_lock_irqsave(&priv->low_lock, flags); - - if (rf_kill_active(priv)) { - IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n"); - if (!priv->stop_rf_kill) - schedule_delayed_work(&priv->rf_kill, - round_jiffies_relative(HZ)); - goto exit_unlock; - } - - /* RF Kill is now disabled, so bring the device back up */ - - if (!(priv->status & STATUS_RF_KILL_MASK)) { - IPW_DEBUG_RF_KILL("HW RF Kill no longer active, restarting " - "device\n"); - schedule_reset(priv); - } else - IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still " - "enabled\n"); - - exit_unlock: - spin_unlock_irqrestore(&priv->low_lock, flags); -} - -static void ipw2100_irq_tasklet(struct ipw2100_priv *priv); - -static const struct net_device_ops ipw2100_netdev_ops = { - .ndo_open = ipw2100_open, - .ndo_stop = ipw2100_close, - .ndo_start_xmit = libipw_xmit, - .ndo_change_mtu = libipw_change_mtu, - .ndo_tx_timeout = ipw2100_tx_timeout, - .ndo_set_mac_address = ipw2100_set_address, - .ndo_validate_addr = eth_validate_addr, -}; - -/* Look into using netdev destructor to shutdown libipw? */ - -static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, - void __iomem * ioaddr) -{ - struct ipw2100_priv *priv; - struct net_device *dev; - - dev = alloc_libipw(sizeof(struct ipw2100_priv), 0); - if (!dev) - return NULL; - priv = libipw_priv(dev); - priv->ieee = netdev_priv(dev); - priv->pci_dev = pci_dev; - priv->net_dev = dev; - priv->ioaddr = ioaddr; - - priv->ieee->hard_start_xmit = ipw2100_tx; - priv->ieee->set_security = shim__set_security; - - priv->ieee->perfect_rssi = -20; - priv->ieee->worst_rssi = -85; - - dev->netdev_ops = &ipw2100_netdev_ops; - dev->ethtool_ops = &ipw2100_ethtool_ops; - dev->wireless_handlers = &ipw2100_wx_handler_def; - priv->wireless_data.libipw = priv->ieee; - dev->wireless_data = &priv->wireless_data; - dev->watchdog_timeo = 3 * HZ; - dev->irq = 0; - - /* NOTE: We don't use the wireless_handlers hook - * in dev as the system will start throwing WX requests - * to us before we're actually initialized and it just - * ends up causing problems. So, we just handle - * the WX extensions through the ipw2100_ioctl interface */ - - /* memset() puts everything to 0, so we only have explicitly set - * those values that need to be something else */ - - /* If power management is turned on, default to AUTO mode */ - priv->power_mode = IPW_POWER_AUTO; - -#ifdef CONFIG_IPW2100_MONITOR - priv->config |= CFG_CRC_CHECK; -#endif - priv->ieee->wpa_enabled = 0; - priv->ieee->drop_unencrypted = 0; - priv->ieee->privacy_invoked = 0; - priv->ieee->ieee802_1x = 1; - - /* Set module parameters */ - switch (network_mode) { - case 1: - priv->ieee->iw_mode = IW_MODE_ADHOC; - break; -#ifdef CONFIG_IPW2100_MONITOR - case 2: - priv->ieee->iw_mode = IW_MODE_MONITOR; - break; -#endif - default: - case 0: - priv->ieee->iw_mode = IW_MODE_INFRA; - break; - } - - if (disable == 1) - priv->status |= STATUS_RF_KILL_SW; - - if (channel != 0 && - ((channel >= REG_MIN_CHANNEL) && (channel <= REG_MAX_CHANNEL))) { - priv->config |= CFG_STATIC_CHANNEL; - priv->channel = channel; - } - - if (associate) - priv->config |= CFG_ASSOCIATE; - - priv->beacon_interval = DEFAULT_BEACON_INTERVAL; - priv->short_retry_limit = DEFAULT_SHORT_RETRY_LIMIT; - priv->long_retry_limit = DEFAULT_LONG_RETRY_LIMIT; - priv->rts_threshold = DEFAULT_RTS_THRESHOLD | RTS_DISABLED; - priv->frag_threshold = DEFAULT_FTS | FRAG_DISABLED; - priv->tx_power = IPW_TX_POWER_DEFAULT; - priv->tx_rates = DEFAULT_TX_RATES; - - strcpy(priv->nick, "ipw2100"); - - spin_lock_init(&priv->low_lock); - mutex_init(&priv->action_mutex); - mutex_init(&priv->adapter_mutex); - - init_waitqueue_head(&priv->wait_command_queue); - - netif_carrier_off(dev); - - INIT_LIST_HEAD(&priv->msg_free_list); - INIT_LIST_HEAD(&priv->msg_pend_list); - INIT_STAT(&priv->msg_free_stat); - INIT_STAT(&priv->msg_pend_stat); - - INIT_LIST_HEAD(&priv->tx_free_list); - INIT_LIST_HEAD(&priv->tx_pend_list); - INIT_STAT(&priv->tx_free_stat); - INIT_STAT(&priv->tx_pend_stat); - - INIT_LIST_HEAD(&priv->fw_pend_list); - INIT_STAT(&priv->fw_pend_stat); - - INIT_DELAYED_WORK(&priv->reset_work, ipw2100_reset_adapter); - INIT_DELAYED_WORK(&priv->security_work, ipw2100_security_work); - INIT_DELAYED_WORK(&priv->wx_event_work, ipw2100_wx_event_work); - INIT_DELAYED_WORK(&priv->hang_check, ipw2100_hang_check); - INIT_DELAYED_WORK(&priv->rf_kill, ipw2100_rf_kill); - INIT_DELAYED_WORK(&priv->scan_event, ipw2100_scan_event); - - tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) - ipw2100_irq_tasklet, (unsigned long)priv); - - /* NOTE: We do not start the deferred work for status checks yet */ - priv->stop_rf_kill = 1; - priv->stop_hang_check = 1; - - return dev; -} - -static int ipw2100_pci_init_one(struct pci_dev *pci_dev, - const struct pci_device_id *ent) -{ - void __iomem *ioaddr; - struct net_device *dev = NULL; - struct ipw2100_priv *priv = NULL; - int err = 0; - int registered = 0; - u32 val; - - IPW_DEBUG_INFO("enter\n"); - - if (!(pci_resource_flags(pci_dev, 0) & IORESOURCE_MEM)) { - IPW_DEBUG_INFO("weird - resource type is not memory\n"); - err = -ENODEV; - goto out; - } - - ioaddr = pci_iomap(pci_dev, 0, 0); - if (!ioaddr) { - printk(KERN_WARNING DRV_NAME - "Error calling ioremap_nocache.\n"); - err = -EIO; - goto fail; - } - - /* allocate and initialize our net_device */ - dev = ipw2100_alloc_device(pci_dev, ioaddr); - if (!dev) { - printk(KERN_WARNING DRV_NAME - "Error calling ipw2100_alloc_device.\n"); - err = -ENOMEM; - goto fail; - } - - /* set up PCI mappings for device */ - err = pci_enable_device(pci_dev); - if (err) { - printk(KERN_WARNING DRV_NAME - "Error calling pci_enable_device.\n"); - return err; - } - - priv = libipw_priv(dev); - - pci_set_master(pci_dev); - pci_set_drvdata(pci_dev, priv); - - err = pci_set_dma_mask(pci_dev, DMA_BIT_MASK(32)); - if (err) { - printk(KERN_WARNING DRV_NAME - "Error calling pci_set_dma_mask.\n"); - pci_disable_device(pci_dev); - return err; - } - - err = pci_request_regions(pci_dev, DRV_NAME); - if (err) { - printk(KERN_WARNING DRV_NAME - "Error calling pci_request_regions.\n"); - pci_disable_device(pci_dev); - return err; - } - - /* We disable the RETRY_TIMEOUT register (0x41) to keep - * PCI Tx retries from interfering with C3 CPU state */ - pci_read_config_dword(pci_dev, 0x40, &val); - if ((val & 0x0000ff00) != 0) - pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff); - - pci_set_power_state(pci_dev, PCI_D0); - - if (!ipw2100_hw_is_adapter_in_system(dev)) { - printk(KERN_WARNING DRV_NAME - "Device not found via register read.\n"); - err = -ENODEV; - goto fail; - } - - SET_NETDEV_DEV(dev, &pci_dev->dev); - - /* Force interrupts to be shut off on the device */ - priv->status |= STATUS_INT_ENABLED; - ipw2100_disable_interrupts(priv); - - /* Allocate and initialize the Tx/Rx queues and lists */ - if (ipw2100_queues_allocate(priv)) { - printk(KERN_WARNING DRV_NAME - "Error calling ipw2100_queues_allocate.\n"); - err = -ENOMEM; - goto fail; - } - ipw2100_queues_initialize(priv); - - err = request_irq(pci_dev->irq, - ipw2100_interrupt, IRQF_SHARED, dev->name, priv); - if (err) { - printk(KERN_WARNING DRV_NAME - "Error calling request_irq: %d.\n", pci_dev->irq); - goto fail; - } - dev->irq = pci_dev->irq; - - IPW_DEBUG_INFO("Attempting to register device...\n"); - - printk(KERN_INFO DRV_NAME - ": Detected Intel PRO/Wireless 2100 Network Connection\n"); - - err = ipw2100_up(priv, 1); - if (err) - goto fail; - - err = ipw2100_wdev_init(dev); - if (err) - goto fail; - registered = 1; - - /* Bring up the interface. Pre 0.46, after we registered the - * network device we would call ipw2100_up. This introduced a race - * condition with newer hotplug configurations (network was coming - * up and making calls before the device was initialized). - */ - err = register_netdev(dev); - if (err) { - printk(KERN_WARNING DRV_NAME - "Error calling register_netdev.\n"); - goto fail; - } - registered = 2; - - mutex_lock(&priv->action_mutex); - - IPW_DEBUG_INFO("%s: Bound to %s\n", dev->name, pci_name(pci_dev)); - - /* perform this after register_netdev so that dev->name is set */ - err = sysfs_create_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); - if (err) - goto fail_unlock; - - /* If the RF Kill switch is disabled, go ahead and complete the - * startup sequence */ - if (!(priv->status & STATUS_RF_KILL_MASK)) { - /* Enable the adapter - sends HOST_COMPLETE */ - if (ipw2100_enable_adapter(priv)) { - printk(KERN_WARNING DRV_NAME - ": %s: failed in call to enable adapter.\n", - priv->net_dev->name); - ipw2100_hw_stop_adapter(priv); - err = -EIO; - goto fail_unlock; - } - - /* Start a scan . . . */ - ipw2100_set_scan_options(priv); - ipw2100_start_scan(priv); - } - - IPW_DEBUG_INFO("exit\n"); - - priv->status |= STATUS_INITIALIZED; - - mutex_unlock(&priv->action_mutex); -out: - return err; - - fail_unlock: - mutex_unlock(&priv->action_mutex); - fail: - if (dev) { - if (registered >= 2) - unregister_netdev(dev); - - if (registered) { - wiphy_unregister(priv->ieee->wdev.wiphy); - kfree(priv->ieee->bg_band.channels); - } - - ipw2100_hw_stop_adapter(priv); - - ipw2100_disable_interrupts(priv); - - if (dev->irq) - free_irq(dev->irq, priv); - - ipw2100_kill_works(priv); - - /* These are safe to call even if they weren't allocated */ - ipw2100_queues_free(priv); - sysfs_remove_group(&pci_dev->dev.kobj, - &ipw2100_attribute_group); - - free_libipw(dev, 0); - pci_set_drvdata(pci_dev, NULL); - } - - pci_iounmap(pci_dev, ioaddr); - - pci_release_regions(pci_dev); - pci_disable_device(pci_dev); - goto out; -} - -static void ipw2100_pci_remove_one(struct pci_dev *pci_dev) -{ - struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); - struct net_device *dev = priv->net_dev; - - mutex_lock(&priv->action_mutex); - - priv->status &= ~STATUS_INITIALIZED; - - sysfs_remove_group(&pci_dev->dev.kobj, &ipw2100_attribute_group); - -#ifdef CONFIG_PM - if (ipw2100_firmware.version) - ipw2100_release_firmware(priv, &ipw2100_firmware); -#endif - /* Take down the hardware */ - ipw2100_down(priv); - - /* Release the mutex so that the network subsystem can - * complete any needed calls into the driver... */ - mutex_unlock(&priv->action_mutex); - - /* Unregister the device first - this results in close() - * being called if the device is open. If we free storage - * first, then close() will crash. - * FIXME: remove the comment above. */ - unregister_netdev(dev); - - ipw2100_kill_works(priv); - - ipw2100_queues_free(priv); - - /* Free potential debugging firmware snapshot */ - ipw2100_snapshot_free(priv); - - free_irq(dev->irq, priv); - - pci_iounmap(pci_dev, priv->ioaddr); - - /* wiphy_unregister needs to be here, before free_libipw */ - wiphy_unregister(priv->ieee->wdev.wiphy); - kfree(priv->ieee->bg_band.channels); - free_libipw(dev, 0); - - pci_release_regions(pci_dev); - pci_disable_device(pci_dev); - - IPW_DEBUG_INFO("exit\n"); -} - -#ifdef CONFIG_PM -static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state) -{ - struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); - struct net_device *dev = priv->net_dev; - - IPW_DEBUG_INFO("%s: Going into suspend...\n", dev->name); - - mutex_lock(&priv->action_mutex); - if (priv->status & STATUS_INITIALIZED) { - /* Take down the device; powers it off, etc. */ - ipw2100_down(priv); - } - - /* Remove the PRESENT state of the device */ - netif_device_detach(dev); - - pci_save_state(pci_dev); - pci_disable_device(pci_dev); - pci_set_power_state(pci_dev, PCI_D3hot); - - priv->suspend_at = get_seconds(); - - mutex_unlock(&priv->action_mutex); - - return 0; -} - -static int ipw2100_resume(struct pci_dev *pci_dev) -{ - struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); - struct net_device *dev = priv->net_dev; - int err; - u32 val; - - if (IPW2100_PM_DISABLED) - return 0; - - mutex_lock(&priv->action_mutex); - - IPW_DEBUG_INFO("%s: Coming out of suspend...\n", dev->name); - - pci_set_power_state(pci_dev, PCI_D0); - err = pci_enable_device(pci_dev); - if (err) { - printk(KERN_ERR "%s: pci_enable_device failed on resume\n", - dev->name); - mutex_unlock(&priv->action_mutex); - return err; - } - pci_restore_state(pci_dev); - - /* - * Suspend/Resume resets the PCI configuration space, so we have to - * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries - * from interfering with C3 CPU state. pci_restore_state won't help - * here since it only restores the first 64 bytes pci config header. - */ - pci_read_config_dword(pci_dev, 0x40, &val); - if ((val & 0x0000ff00) != 0) - pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff); - - /* Set the device back into the PRESENT state; this will also wake - * the queue of needed */ - netif_device_attach(dev); - - priv->suspend_time = get_seconds() - priv->suspend_at; - - /* Bring the device back up */ - if (!(priv->status & STATUS_RF_KILL_SW)) - ipw2100_up(priv, 0); - - mutex_unlock(&priv->action_mutex); - - return 0; -} -#endif - -static void ipw2100_shutdown(struct pci_dev *pci_dev) -{ - struct ipw2100_priv *priv = pci_get_drvdata(pci_dev); - - /* Take down the device; powers it off, etc. */ - ipw2100_down(priv); - - pci_disable_device(pci_dev); -} - -#define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x } - -static DEFINE_PCI_DEVICE_TABLE(ipw2100_pci_id_table) = { - IPW2100_DEV_ID(0x2520), /* IN 2100A mPCI 3A */ - IPW2100_DEV_ID(0x2521), /* IN 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2524), /* IN 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2525), /* IN 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2526), /* IN 2100A mPCI Gen A3 */ - IPW2100_DEV_ID(0x2522), /* IN 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2523), /* IN 2100 mPCI 3A */ - IPW2100_DEV_ID(0x2527), /* IN 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2528), /* IN 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2529), /* IN 2100 mPCI 3B */ - IPW2100_DEV_ID(0x252B), /* IN 2100 mPCI 3A */ - IPW2100_DEV_ID(0x252C), /* IN 2100 mPCI 3A */ - IPW2100_DEV_ID(0x252D), /* IN 2100 mPCI 3A */ - - IPW2100_DEV_ID(0x2550), /* IB 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2551), /* IB 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2553), /* IB 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2554), /* IB 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2555), /* IB 2100 mPCI 3B */ - - IPW2100_DEV_ID(0x2560), /* DE 2100A mPCI 3A */ - IPW2100_DEV_ID(0x2562), /* DE 2100A mPCI 3A */ - IPW2100_DEV_ID(0x2563), /* DE 2100A mPCI 3A */ - IPW2100_DEV_ID(0x2561), /* DE 2100 mPCI 3A */ - IPW2100_DEV_ID(0x2565), /* DE 2100 mPCI 3A */ - IPW2100_DEV_ID(0x2566), /* DE 2100 mPCI 3A */ - IPW2100_DEV_ID(0x2567), /* DE 2100 mPCI 3A */ - - IPW2100_DEV_ID(0x2570), /* GA 2100 mPCI 3B */ - - IPW2100_DEV_ID(0x2580), /* TO 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2582), /* TO 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2583), /* TO 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2581), /* TO 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2585), /* TO 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2586), /* TO 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2587), /* TO 2100 mPCI 3B */ - - IPW2100_DEV_ID(0x2590), /* SO 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2592), /* SO 2100A mPCI 3B */ - IPW2100_DEV_ID(0x2591), /* SO 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2593), /* SO 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2596), /* SO 2100 mPCI 3B */ - IPW2100_DEV_ID(0x2598), /* SO 2100 mPCI 3B */ - - IPW2100_DEV_ID(0x25A0), /* HP 2100 mPCI 3B */ - {0,}, -}; - -MODULE_DEVICE_TABLE(pci, ipw2100_pci_id_table); - -static struct pci_driver ipw2100_pci_driver = { - .name = DRV_NAME, - .id_table = ipw2100_pci_id_table, - .probe = ipw2100_pci_init_one, - .remove = ipw2100_pci_remove_one, -#ifdef CONFIG_PM - .suspend = ipw2100_suspend, - .resume = ipw2100_resume, -#endif - .shutdown = ipw2100_shutdown, -}; - -/** - * Initialize the ipw2100 driver/module - * - * @returns 0 if ok, < 0 errno node con error. - * - * Note: we cannot init the /proc stuff until the PCI driver is there, - * or we risk an unlikely race condition on someone accessing - * uninitialized data in the PCI dev struct through /proc. - */ -static int __init ipw2100_init(void) -{ - int ret; - - printk(KERN_INFO DRV_NAME ": %s, %s\n", DRV_DESCRIPTION, DRV_VERSION); - printk(KERN_INFO DRV_NAME ": %s\n", DRV_COPYRIGHT); - - pm_qos_add_request(&ipw2100_pm_qos_req, PM_QOS_CPU_DMA_LATENCY, - PM_QOS_DEFAULT_VALUE); - - ret = pci_register_driver(&ipw2100_pci_driver); - if (ret) - goto out; - -#ifdef CONFIG_IPW2100_DEBUG - ipw2100_debug_level = debug; - ret = driver_create_file(&ipw2100_pci_driver.driver, - &driver_attr_debug_level); -#endif - -out: - return ret; -} - -/** - * Cleanup ipw2100 driver registration - */ -static void __exit ipw2100_exit(void) -{ - /* FIXME: IPG: check that we have no instances of the devices open */ -#ifdef CONFIG_IPW2100_DEBUG - driver_remove_file(&ipw2100_pci_driver.driver, - &driver_attr_debug_level); -#endif - pci_unregister_driver(&ipw2100_pci_driver); - pm_qos_remove_request(&ipw2100_pm_qos_req); -} - -module_init(ipw2100_init); -module_exit(ipw2100_exit); - -static int ipw2100_wx_get_name(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - if (!(priv->status & STATUS_ASSOCIATED)) - strcpy(wrqu->name, "unassociated"); - else - snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11b"); - - IPW_DEBUG_WX("Name: %s\n", wrqu->name); - return 0; -} - -static int ipw2100_wx_set_freq(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - struct iw_freq *fwrq = &wrqu->freq; - int err = 0; - - if (priv->ieee->iw_mode == IW_MODE_INFRA) - return -EOPNOTSUPP; - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - /* if setting by freq convert to channel */ - if (fwrq->e == 1) { - if ((fwrq->m >= (int)2.412e8 && fwrq->m <= (int)2.487e8)) { - int f = fwrq->m / 100000; - int c = 0; - - while ((c < REG_MAX_CHANNEL) && - (f != ipw2100_frequencies[c])) - c++; - - /* hack to fall through */ - fwrq->e = 0; - fwrq->m = c + 1; - } - } - - if (fwrq->e > 0 || fwrq->m > 1000) { - err = -EOPNOTSUPP; - goto done; - } else { /* Set the channel */ - IPW_DEBUG_WX("SET Freq/Channel -> %d\n", fwrq->m); - err = ipw2100_set_channel(priv, fwrq->m, 0); - } - - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -static int ipw2100_wx_get_freq(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - - wrqu->freq.e = 0; - - /* If we are associated, trying to associate, or have a statically - * configured CHANNEL then return that; otherwise return ANY */ - if (priv->config & CFG_STATIC_CHANNEL || - priv->status & STATUS_ASSOCIATED) - wrqu->freq.m = priv->channel; - else - wrqu->freq.m = 0; - - IPW_DEBUG_WX("GET Freq/Channel -> %d\n", priv->channel); - return 0; - -} - -static int ipw2100_wx_set_mode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - int err = 0; - - IPW_DEBUG_WX("SET Mode -> %d\n", wrqu->mode); - - if (wrqu->mode == priv->ieee->iw_mode) - return 0; - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - switch (wrqu->mode) { -#ifdef CONFIG_IPW2100_MONITOR - case IW_MODE_MONITOR: - err = ipw2100_switch_mode(priv, IW_MODE_MONITOR); - break; -#endif /* CONFIG_IPW2100_MONITOR */ - case IW_MODE_ADHOC: - err = ipw2100_switch_mode(priv, IW_MODE_ADHOC); - break; - case IW_MODE_INFRA: - case IW_MODE_AUTO: - default: - err = ipw2100_switch_mode(priv, IW_MODE_INFRA); - break; - } - - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -static int ipw2100_wx_get_mode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - - wrqu->mode = priv->ieee->iw_mode; - IPW_DEBUG_WX("GET Mode -> %d\n", wrqu->mode); - - return 0; -} - -#define POWER_MODES 5 - -/* Values are in microsecond */ -static const s32 timeout_duration[POWER_MODES] = { - 350000, - 250000, - 75000, - 37000, - 25000, -}; - -static const s32 period_duration[POWER_MODES] = { - 400000, - 700000, - 1000000, - 1000000, - 1000000 -}; - -static int ipw2100_wx_get_range(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - struct iw_range *range = (struct iw_range *)extra; - u16 val; - int i, level; - - wrqu->data.length = sizeof(*range); - memset(range, 0, sizeof(*range)); - - /* Let's try to keep this struct in the same order as in - * linux/include/wireless.h - */ - - /* TODO: See what values we can set, and remove the ones we can't - * set, or fill them with some default data. - */ - - /* ~5 Mb/s real (802.11b) */ - range->throughput = 5 * 1000 * 1000; - -// range->sensitivity; /* signal level threshold range */ - - range->max_qual.qual = 100; - /* TODO: Find real max RSSI and stick here */ - range->max_qual.level = 0; - range->max_qual.noise = 0; - range->max_qual.updated = 7; /* Updated all three */ - - range->avg_qual.qual = 70; /* > 8% missed beacons is 'bad' */ - /* TODO: Find real 'good' to 'bad' threshold value for RSSI */ - range->avg_qual.level = 20 + IPW2100_RSSI_TO_DBM; - range->avg_qual.noise = 0; - range->avg_qual.updated = 7; /* Updated all three */ - - range->num_bitrates = RATE_COUNT; - - for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) { - range->bitrate[i] = ipw2100_bg_rates[i].bitrate * 100 * 1000; - } - - range->min_rts = MIN_RTS_THRESHOLD; - range->max_rts = MAX_RTS_THRESHOLD; - range->min_frag = MIN_FRAG_THRESHOLD; - range->max_frag = MAX_FRAG_THRESHOLD; - - range->min_pmp = period_duration[0]; /* Minimal PM period */ - range->max_pmp = period_duration[POWER_MODES - 1]; /* Maximal PM period */ - range->min_pmt = timeout_duration[POWER_MODES - 1]; /* Minimal PM timeout */ - range->max_pmt = timeout_duration[0]; /* Maximal PM timeout */ - - /* How to decode max/min PM period */ - range->pmp_flags = IW_POWER_PERIOD; - /* How to decode max/min PM period */ - range->pmt_flags = IW_POWER_TIMEOUT; - /* What PM options are supported */ - range->pm_capa = IW_POWER_TIMEOUT | IW_POWER_PERIOD; - - range->encoding_size[0] = 5; - range->encoding_size[1] = 13; /* Different token sizes */ - range->num_encoding_sizes = 2; /* Number of entry in the list */ - range->max_encoding_tokens = WEP_KEYS; /* Max number of tokens */ -// range->encoding_login_index; /* token index for login token */ - - if (priv->ieee->iw_mode == IW_MODE_ADHOC) { - range->txpower_capa = IW_TXPOW_DBM; - range->num_txpower = IW_MAX_TXPOWER; - for (i = 0, level = (IPW_TX_POWER_MAX_DBM * 16); - i < IW_MAX_TXPOWER; - i++, level -= - ((IPW_TX_POWER_MAX_DBM - - IPW_TX_POWER_MIN_DBM) * 16) / (IW_MAX_TXPOWER - 1)) - range->txpower[i] = level / 16; - } else { - range->txpower_capa = 0; - range->num_txpower = 0; - } - - /* Set the Wireless Extension versions */ - range->we_version_compiled = WIRELESS_EXT; - range->we_version_source = 18; - -// range->retry_capa; /* What retry options are supported */ -// range->retry_flags; /* How to decode max/min retry limit */ -// range->r_time_flags; /* How to decode max/min retry life */ -// range->min_retry; /* Minimal number of retries */ -// range->max_retry; /* Maximal number of retries */ -// range->min_r_time; /* Minimal retry lifetime */ -// range->max_r_time; /* Maximal retry lifetime */ - - range->num_channels = FREQ_COUNT; - - val = 0; - for (i = 0; i < FREQ_COUNT; i++) { - // TODO: Include only legal frequencies for some countries -// if (local->channel_mask & (1 << i)) { - range->freq[val].i = i + 1; - range->freq[val].m = ipw2100_frequencies[i] * 100000; - range->freq[val].e = 1; - val++; -// } - if (val == IW_MAX_FREQUENCIES) - break; - } - range->num_frequency = val; - - /* Event capability (kernel + driver) */ - range->event_capa[0] = (IW_EVENT_CAPA_K_0 | - IW_EVENT_CAPA_MASK(SIOCGIWAP)); - range->event_capa[1] = IW_EVENT_CAPA_K_1; - - range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | - IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; - - IPW_DEBUG_WX("GET Range\n"); - - return 0; -} - -static int ipw2100_wx_set_wap(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - int err = 0; - - // sanity checks - if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) - return -EINVAL; - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - if (is_broadcast_ether_addr(wrqu->ap_addr.sa_data) || - is_zero_ether_addr(wrqu->ap_addr.sa_data)) { - /* we disable mandatory BSSID association */ - IPW_DEBUG_WX("exit - disable mandatory BSSID\n"); - priv->config &= ~CFG_STATIC_BSSID; - err = ipw2100_set_mandatory_bssid(priv, NULL, 0); - goto done; - } - - priv->config |= CFG_STATIC_BSSID; - memcpy(priv->mandatory_bssid_mac, wrqu->ap_addr.sa_data, ETH_ALEN); - - err = ipw2100_set_mandatory_bssid(priv, wrqu->ap_addr.sa_data, 0); - - IPW_DEBUG_WX("SET BSSID -> %pM\n", wrqu->ap_addr.sa_data); - - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -static int ipw2100_wx_get_wap(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - - /* If we are associated, trying to associate, or have a statically - * configured BSSID then return that; otherwise return ANY */ - if (priv->config & CFG_STATIC_BSSID || priv->status & STATUS_ASSOCIATED) { - wrqu->ap_addr.sa_family = ARPHRD_ETHER; - memcpy(wrqu->ap_addr.sa_data, priv->bssid, ETH_ALEN); - } else - memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); - - IPW_DEBUG_WX("Getting WAP BSSID: %pM\n", wrqu->ap_addr.sa_data); - return 0; -} - -static int ipw2100_wx_set_essid(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - char *essid = ""; /* ANY */ - int length = 0; - int err = 0; - DECLARE_SSID_BUF(ssid); - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - if (wrqu->essid.flags && wrqu->essid.length) { - length = wrqu->essid.length; - essid = extra; - } - - if (length == 0) { - IPW_DEBUG_WX("Setting ESSID to ANY\n"); - priv->config &= ~CFG_STATIC_ESSID; - err = ipw2100_set_essid(priv, NULL, 0, 0); - goto done; - } - - length = min(length, IW_ESSID_MAX_SIZE); - - priv->config |= CFG_STATIC_ESSID; - - if (priv->essid_len == length && !memcmp(priv->essid, extra, length)) { - IPW_DEBUG_WX("ESSID set to current ESSID.\n"); - err = 0; - goto done; - } - - IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n", - print_ssid(ssid, essid, length), length); - - priv->essid_len = length; - memcpy(priv->essid, essid, priv->essid_len); - - err = ipw2100_set_essid(priv, essid, length, 0); - - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -static int ipw2100_wx_get_essid(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - DECLARE_SSID_BUF(ssid); - - /* If we are associated, trying to associate, or have a statically - * configured ESSID then return that; otherwise return ANY */ - if (priv->config & CFG_STATIC_ESSID || priv->status & STATUS_ASSOCIATED) { - IPW_DEBUG_WX("Getting essid: '%s'\n", - print_ssid(ssid, priv->essid, priv->essid_len)); - memcpy(extra, priv->essid, priv->essid_len); - wrqu->essid.length = priv->essid_len; - wrqu->essid.flags = 1; /* active */ - } else { - IPW_DEBUG_WX("Getting essid: ANY\n"); - wrqu->essid.length = 0; - wrqu->essid.flags = 0; /* active */ - } - - return 0; -} - -static int ipw2100_wx_set_nick(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - - if (wrqu->data.length > IW_ESSID_MAX_SIZE) - return -E2BIG; - - wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); - memset(priv->nick, 0, sizeof(priv->nick)); - memcpy(priv->nick, extra, wrqu->data.length); - - IPW_DEBUG_WX("SET Nickname -> %s\n", priv->nick); - - return 0; -} - -static int ipw2100_wx_get_nick(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - - wrqu->data.length = strlen(priv->nick); - memcpy(extra, priv->nick, wrqu->data.length); - wrqu->data.flags = 1; /* active */ - - IPW_DEBUG_WX("GET Nickname -> %s\n", extra); - - return 0; -} - -static int ipw2100_wx_set_rate(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - u32 target_rate = wrqu->bitrate.value; - u32 rate; - int err = 0; - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - rate = 0; - - if (target_rate == 1000000 || - (!wrqu->bitrate.fixed && target_rate > 1000000)) - rate |= TX_RATE_1_MBIT; - if (target_rate == 2000000 || - (!wrqu->bitrate.fixed && target_rate > 2000000)) - rate |= TX_RATE_2_MBIT; - if (target_rate == 5500000 || - (!wrqu->bitrate.fixed && target_rate > 5500000)) - rate |= TX_RATE_5_5_MBIT; - if (target_rate == 11000000 || - (!wrqu->bitrate.fixed && target_rate > 11000000)) - rate |= TX_RATE_11_MBIT; - if (rate == 0) - rate = DEFAULT_TX_RATES; - - err = ipw2100_set_tx_rates(priv, rate, 0); - - IPW_DEBUG_WX("SET Rate -> %04X\n", rate); - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -static int ipw2100_wx_get_rate(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - int val; - unsigned int len = sizeof(val); - int err = 0; - - if (!(priv->status & STATUS_ENABLED) || - priv->status & STATUS_RF_KILL_MASK || - !(priv->status & STATUS_ASSOCIATED)) { - wrqu->bitrate.value = 0; - return 0; - } - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - err = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, &val, &len); - if (err) { - IPW_DEBUG_WX("failed querying ordinals.\n"); - goto done; - } - - switch (val & TX_RATE_MASK) { - case TX_RATE_1_MBIT: - wrqu->bitrate.value = 1000000; - break; - case TX_RATE_2_MBIT: - wrqu->bitrate.value = 2000000; - break; - case TX_RATE_5_5_MBIT: - wrqu->bitrate.value = 5500000; - break; - case TX_RATE_11_MBIT: - wrqu->bitrate.value = 11000000; - break; - default: - wrqu->bitrate.value = 0; - } - - IPW_DEBUG_WX("GET Rate -> %d\n", wrqu->bitrate.value); - - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -static int ipw2100_wx_set_rts(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - int value, err; - - /* Auto RTS not yet supported */ - if (wrqu->rts.fixed == 0) - return -EINVAL; - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - if (wrqu->rts.disabled) - value = priv->rts_threshold | RTS_DISABLED; - else { - if (wrqu->rts.value < 1 || wrqu->rts.value > 2304) { - err = -EINVAL; - goto done; - } - value = wrqu->rts.value; - } - - err = ipw2100_set_rts_threshold(priv, value); - - IPW_DEBUG_WX("SET RTS Threshold -> 0x%08X\n", value); - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -static int ipw2100_wx_get_rts(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - - wrqu->rts.value = priv->rts_threshold & ~RTS_DISABLED; - wrqu->rts.fixed = 1; /* no auto select */ - - /* If RTS is set to the default value, then it is disabled */ - wrqu->rts.disabled = (priv->rts_threshold & RTS_DISABLED) ? 1 : 0; - - IPW_DEBUG_WX("GET RTS Threshold -> 0x%08X\n", wrqu->rts.value); - - return 0; -} - -static int ipw2100_wx_set_txpow(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - int err = 0, value; - - if (ipw_radio_kill_sw(priv, wrqu->txpower.disabled)) - return -EINPROGRESS; - - if (priv->ieee->iw_mode != IW_MODE_ADHOC) - return 0; - - if ((wrqu->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) - return -EINVAL; - - if (wrqu->txpower.fixed == 0) - value = IPW_TX_POWER_DEFAULT; - else { - if (wrqu->txpower.value < IPW_TX_POWER_MIN_DBM || - wrqu->txpower.value > IPW_TX_POWER_MAX_DBM) - return -EINVAL; - - value = wrqu->txpower.value; - } - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - err = ipw2100_set_tx_power(priv, value); - - IPW_DEBUG_WX("SET TX Power -> %d\n", value); - - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -static int ipw2100_wx_get_txpow(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - - wrqu->txpower.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; - - if (priv->tx_power == IPW_TX_POWER_DEFAULT) { - wrqu->txpower.fixed = 0; - wrqu->txpower.value = IPW_TX_POWER_MAX_DBM; - } else { - wrqu->txpower.fixed = 1; - wrqu->txpower.value = priv->tx_power; - } - - wrqu->txpower.flags = IW_TXPOW_DBM; - - IPW_DEBUG_WX("GET TX Power -> %d\n", wrqu->txpower.value); - - return 0; -} - -static int ipw2100_wx_set_frag(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - - if (!wrqu->frag.fixed) - return -EINVAL; - - if (wrqu->frag.disabled) { - priv->frag_threshold |= FRAG_DISABLED; - priv->ieee->fts = DEFAULT_FTS; - } else { - if (wrqu->frag.value < MIN_FRAG_THRESHOLD || - wrqu->frag.value > MAX_FRAG_THRESHOLD) - return -EINVAL; - - priv->ieee->fts = wrqu->frag.value & ~0x1; - priv->frag_threshold = priv->ieee->fts; - } - - IPW_DEBUG_WX("SET Frag Threshold -> %d\n", priv->ieee->fts); - - return 0; -} - -static int ipw2100_wx_get_frag(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - wrqu->frag.value = priv->frag_threshold & ~FRAG_DISABLED; - wrqu->frag.fixed = 0; /* no auto select */ - wrqu->frag.disabled = (priv->frag_threshold & FRAG_DISABLED) ? 1 : 0; - - IPW_DEBUG_WX("GET Frag Threshold -> %d\n", wrqu->frag.value); - - return 0; -} - -static int ipw2100_wx_set_retry(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - int err = 0; - - if (wrqu->retry.flags & IW_RETRY_LIFETIME || wrqu->retry.disabled) - return -EINVAL; - - if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) - return 0; - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - if (wrqu->retry.flags & IW_RETRY_SHORT) { - err = ipw2100_set_short_retry(priv, wrqu->retry.value); - IPW_DEBUG_WX("SET Short Retry Limit -> %d\n", - wrqu->retry.value); - goto done; - } - - if (wrqu->retry.flags & IW_RETRY_LONG) { - err = ipw2100_set_long_retry(priv, wrqu->retry.value); - IPW_DEBUG_WX("SET Long Retry Limit -> %d\n", - wrqu->retry.value); - goto done; - } - - err = ipw2100_set_short_retry(priv, wrqu->retry.value); - if (!err) - err = ipw2100_set_long_retry(priv, wrqu->retry.value); - - IPW_DEBUG_WX("SET Both Retry Limits -> %d\n", wrqu->retry.value); - - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -static int ipw2100_wx_get_retry(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - - wrqu->retry.disabled = 0; /* can't be disabled */ - - if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) - return -EINVAL; - - if (wrqu->retry.flags & IW_RETRY_LONG) { - wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; - wrqu->retry.value = priv->long_retry_limit; - } else { - wrqu->retry.flags = - (priv->short_retry_limit != - priv->long_retry_limit) ? - IW_RETRY_LIMIT | IW_RETRY_SHORT : IW_RETRY_LIMIT; - - wrqu->retry.value = priv->short_retry_limit; - } - - IPW_DEBUG_WX("GET Retry -> %d\n", wrqu->retry.value); - - return 0; -} - -static int ipw2100_wx_set_scan(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - int err = 0; - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - IPW_DEBUG_WX("Initiating scan...\n"); - - priv->user_requested_scan = 1; - if (ipw2100_set_scan_options(priv) || ipw2100_start_scan(priv)) { - IPW_DEBUG_WX("Start scan failed.\n"); - - /* TODO: Mark a scan as pending so when hardware initialized - * a scan starts */ - } - - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -static int ipw2100_wx_get_scan(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - return libipw_wx_get_scan(priv->ieee, info, wrqu, extra); -} - -/* - * Implementation based on code in hostap-driver v0.1.3 hostap_ioctl.c - */ -static int ipw2100_wx_set_encode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key) -{ - /* - * No check of STATUS_INITIALIZED required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - return libipw_wx_set_encode(priv->ieee, info, wrqu, key); -} - -static int ipw2100_wx_get_encode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - return libipw_wx_get_encode(priv->ieee, info, wrqu, key); -} - -static int ipw2100_wx_set_power(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - int err = 0; - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - if (wrqu->power.disabled) { - priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); - err = ipw2100_set_power_mode(priv, IPW_POWER_MODE_CAM); - IPW_DEBUG_WX("SET Power Management Mode -> off\n"); - goto done; - } - - switch (wrqu->power.flags & IW_POWER_MODE) { - case IW_POWER_ON: /* If not specified */ - case IW_POWER_MODE: /* If set all mask */ - case IW_POWER_ALL_R: /* If explicitly state all */ - break; - default: /* Otherwise we don't support it */ - IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", - wrqu->power.flags); - err = -EOPNOTSUPP; - goto done; - } - - /* If the user hasn't specified a power management mode yet, default - * to BATTERY */ - priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; - err = ipw2100_set_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); - - IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); - - done: - mutex_unlock(&priv->action_mutex); - return err; - -} - -static int ipw2100_wx_get_power(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - - if (!(priv->power_mode & IPW_POWER_ENABLED)) - wrqu->power.disabled = 1; - else { - wrqu->power.disabled = 0; - wrqu->power.flags = 0; - } - - IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); - - return 0; -} - -/* - * WE-18 WPA support - */ - -/* SIOCSIWGENIE */ -static int ipw2100_wx_set_genie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - - struct ipw2100_priv *priv = libipw_priv(dev); - struct libipw_device *ieee = priv->ieee; - u8 *buf; - - if (!ieee->wpa_enabled) - return -EOPNOTSUPP; - - if (wrqu->data.length > MAX_WPA_IE_LEN || - (wrqu->data.length && extra == NULL)) - return -EINVAL; - - if (wrqu->data.length) { - buf = kmemdup(extra, wrqu->data.length, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - kfree(ieee->wpa_ie); - ieee->wpa_ie = buf; - ieee->wpa_ie_len = wrqu->data.length; - } else { - kfree(ieee->wpa_ie); - ieee->wpa_ie = NULL; - ieee->wpa_ie_len = 0; - } - - ipw2100_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); - - return 0; -} - -/* SIOCGIWGENIE */ -static int ipw2100_wx_get_genie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - struct libipw_device *ieee = priv->ieee; - - if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { - wrqu->data.length = 0; - return 0; - } - - if (wrqu->data.length < ieee->wpa_ie_len) - return -E2BIG; - - wrqu->data.length = ieee->wpa_ie_len; - memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); - - return 0; -} - -/* SIOCSIWAUTH */ -static int ipw2100_wx_set_auth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - struct libipw_device *ieee = priv->ieee; - struct iw_param *param = &wrqu->param; - struct lib80211_crypt_data *crypt; - unsigned long flags; - int ret = 0; - - switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_KEY_MGMT: - /* - * ipw2200 does not use these parameters - */ - break; - - case IW_AUTH_TKIP_COUNTERMEASURES: - crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx]; - if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) - break; - - flags = crypt->ops->get_flags(crypt->priv); - - if (param->value) - flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; - else - flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; - - crypt->ops->set_flags(flags, crypt->priv); - - break; - - case IW_AUTH_DROP_UNENCRYPTED:{ - /* HACK: - * - * wpa_supplicant calls set_wpa_enabled when the driver - * is loaded and unloaded, regardless of if WPA is being - * used. No other calls are made which can be used to - * determine if encryption will be used or not prior to - * association being expected. If encryption is not being - * used, drop_unencrypted is set to false, else true -- we - * can use this to determine if the CAP_PRIVACY_ON bit should - * be set. - */ - struct libipw_security sec = { - .flags = SEC_ENABLED, - .enabled = param->value, - }; - priv->ieee->drop_unencrypted = param->value; - /* We only change SEC_LEVEL for open mode. Others - * are set by ipw_wpa_set_encryption. - */ - if (!param->value) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_0; - } else { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_1; - } - if (priv->ieee->set_security) - priv->ieee->set_security(priv->ieee->dev, &sec); - break; - } - - case IW_AUTH_80211_AUTH_ALG: - ret = ipw2100_wpa_set_auth_algs(priv, param->value); - break; - - case IW_AUTH_WPA_ENABLED: - ret = ipw2100_wpa_enable(priv, param->value); - break; - - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - ieee->ieee802_1x = param->value; - break; - - //case IW_AUTH_ROAMING_CONTROL: - case IW_AUTH_PRIVACY_INVOKED: - ieee->privacy_invoked = param->value; - break; - - default: - return -EOPNOTSUPP; - } - return ret; -} - -/* SIOCGIWAUTH */ -static int ipw2100_wx_get_auth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - struct libipw_device *ieee = priv->ieee; - struct lib80211_crypt_data *crypt; - struct iw_param *param = &wrqu->param; - int ret = 0; - - switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_KEY_MGMT: - /* - * wpa_supplicant will control these internally - */ - ret = -EOPNOTSUPP; - break; - - case IW_AUTH_TKIP_COUNTERMEASURES: - crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx]; - if (!crypt || !crypt->ops->get_flags) { - IPW_DEBUG_WARNING("Can't get TKIP countermeasures: " - "crypt not set!\n"); - break; - } - - param->value = (crypt->ops->get_flags(crypt->priv) & - IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) ? 1 : 0; - - break; - - case IW_AUTH_DROP_UNENCRYPTED: - param->value = ieee->drop_unencrypted; - break; - - case IW_AUTH_80211_AUTH_ALG: - param->value = priv->ieee->sec.auth_mode; - break; - - case IW_AUTH_WPA_ENABLED: - param->value = ieee->wpa_enabled; - break; - - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - param->value = ieee->ieee802_1x; - break; - - case IW_AUTH_ROAMING_CONTROL: - case IW_AUTH_PRIVACY_INVOKED: - param->value = ieee->privacy_invoked; - break; - - default: - return -EOPNOTSUPP; - } - return 0; -} - -/* SIOCSIWENCODEEXT */ -static int ipw2100_wx_set_encodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - return libipw_wx_set_encodeext(priv->ieee, info, wrqu, extra); -} - -/* SIOCGIWENCODEEXT */ -static int ipw2100_wx_get_encodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - return libipw_wx_get_encodeext(priv->ieee, info, wrqu, extra); -} - -/* SIOCSIWMLME */ -static int ipw2100_wx_set_mlme(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - struct iw_mlme *mlme = (struct iw_mlme *)extra; - __le16 reason; - - reason = cpu_to_le16(mlme->reason_code); - - switch (mlme->cmd) { - case IW_MLME_DEAUTH: - // silently ignore - break; - - case IW_MLME_DISASSOC: - ipw2100_disassociate_bssid(priv); - break; - - default: - return -EOPNOTSUPP; - } - return 0; -} - -/* - * - * IWPRIV handlers - * - */ -#ifdef CONFIG_IPW2100_MONITOR -static int ipw2100_wx_set_promisc(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - int *parms = (int *)extra; - int enable = (parms[0] > 0); - int err = 0; - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - if (enable) { - if (priv->ieee->iw_mode == IW_MODE_MONITOR) { - err = ipw2100_set_channel(priv, parms[1], 0); - goto done; - } - priv->channel = parms[1]; - err = ipw2100_switch_mode(priv, IW_MODE_MONITOR); - } else { - if (priv->ieee->iw_mode == IW_MODE_MONITOR) - err = ipw2100_switch_mode(priv, priv->last_mode); - } - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -static int ipw2100_wx_reset(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - if (priv->status & STATUS_INITIALIZED) - schedule_reset(priv); - return 0; -} - -#endif - -static int ipw2100_wx_set_powermode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - int err = 0, mode = *(int *)extra; - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - if ((mode < 0) || (mode > POWER_MODES)) - mode = IPW_POWER_AUTO; - - if (IPW_POWER_LEVEL(priv->power_mode) != mode) - err = ipw2100_set_power_mode(priv, mode); - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -#define MAX_POWER_STRING 80 -static int ipw2100_wx_get_powermode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - int level = IPW_POWER_LEVEL(priv->power_mode); - s32 timeout, period; - - if (!(priv->power_mode & IPW_POWER_ENABLED)) { - snprintf(extra, MAX_POWER_STRING, - "Power save level: %d (Off)", level); - } else { - switch (level) { - case IPW_POWER_MODE_CAM: - snprintf(extra, MAX_POWER_STRING, - "Power save level: %d (None)", level); - break; - case IPW_POWER_AUTO: - snprintf(extra, MAX_POWER_STRING, - "Power save level: %d (Auto)", level); - break; - default: - timeout = timeout_duration[level - 1] / 1000; - period = period_duration[level - 1] / 1000; - snprintf(extra, MAX_POWER_STRING, - "Power save level: %d " - "(Timeout %dms, Period %dms)", - level, timeout, period); - } - } - - wrqu->data.length = strlen(extra) + 1; - - return 0; -} - -static int ipw2100_wx_set_preamble(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - int err, mode = *(int *)extra; - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - if (mode == 1) - priv->config |= CFG_LONG_PREAMBLE; - else if (mode == 0) - priv->config &= ~CFG_LONG_PREAMBLE; - else { - err = -EINVAL; - goto done; - } - - err = ipw2100_system_config(priv, 0); - - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -static int ipw2100_wx_get_preamble(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - - if (priv->config & CFG_LONG_PREAMBLE) - snprintf(wrqu->name, IFNAMSIZ, "long (1)"); - else - snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); - - return 0; -} - -#ifdef CONFIG_IPW2100_MONITOR -static int ipw2100_wx_set_crc_check(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw2100_priv *priv = libipw_priv(dev); - int err, mode = *(int *)extra; - - mutex_lock(&priv->action_mutex); - if (!(priv->status & STATUS_INITIALIZED)) { - err = -EIO; - goto done; - } - - if (mode == 1) - priv->config |= CFG_CRC_CHECK; - else if (mode == 0) - priv->config &= ~CFG_CRC_CHECK; - else { - err = -EINVAL; - goto done; - } - err = 0; - - done: - mutex_unlock(&priv->action_mutex); - return err; -} - -static int ipw2100_wx_get_crc_check(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * This can be called at any time. No action lock required - */ - - struct ipw2100_priv *priv = libipw_priv(dev); - - if (priv->config & CFG_CRC_CHECK) - snprintf(wrqu->name, IFNAMSIZ, "CRC checked (1)"); - else - snprintf(wrqu->name, IFNAMSIZ, "CRC ignored (0)"); - - return 0; -} -#endif /* CONFIG_IPW2100_MONITOR */ - -static iw_handler ipw2100_wx_handlers[] = { - IW_HANDLER(SIOCGIWNAME, ipw2100_wx_get_name), - IW_HANDLER(SIOCSIWFREQ, ipw2100_wx_set_freq), - IW_HANDLER(SIOCGIWFREQ, ipw2100_wx_get_freq), - IW_HANDLER(SIOCSIWMODE, ipw2100_wx_set_mode), - IW_HANDLER(SIOCGIWMODE, ipw2100_wx_get_mode), - IW_HANDLER(SIOCGIWRANGE, ipw2100_wx_get_range), - IW_HANDLER(SIOCSIWAP, ipw2100_wx_set_wap), - IW_HANDLER(SIOCGIWAP, ipw2100_wx_get_wap), - IW_HANDLER(SIOCSIWMLME, ipw2100_wx_set_mlme), - IW_HANDLER(SIOCSIWSCAN, ipw2100_wx_set_scan), - IW_HANDLER(SIOCGIWSCAN, ipw2100_wx_get_scan), - IW_HANDLER(SIOCSIWESSID, ipw2100_wx_set_essid), - IW_HANDLER(SIOCGIWESSID, ipw2100_wx_get_essid), - IW_HANDLER(SIOCSIWNICKN, ipw2100_wx_set_nick), - IW_HANDLER(SIOCGIWNICKN, ipw2100_wx_get_nick), - IW_HANDLER(SIOCSIWRATE, ipw2100_wx_set_rate), - IW_HANDLER(SIOCGIWRATE, ipw2100_wx_get_rate), - IW_HANDLER(SIOCSIWRTS, ipw2100_wx_set_rts), - IW_HANDLER(SIOCGIWRTS, ipw2100_wx_get_rts), - IW_HANDLER(SIOCSIWFRAG, ipw2100_wx_set_frag), - IW_HANDLER(SIOCGIWFRAG, ipw2100_wx_get_frag), - IW_HANDLER(SIOCSIWTXPOW, ipw2100_wx_set_txpow), - IW_HANDLER(SIOCGIWTXPOW, ipw2100_wx_get_txpow), - IW_HANDLER(SIOCSIWRETRY, ipw2100_wx_set_retry), - IW_HANDLER(SIOCGIWRETRY, ipw2100_wx_get_retry), - IW_HANDLER(SIOCSIWENCODE, ipw2100_wx_set_encode), - IW_HANDLER(SIOCGIWENCODE, ipw2100_wx_get_encode), - IW_HANDLER(SIOCSIWPOWER, ipw2100_wx_set_power), - IW_HANDLER(SIOCGIWPOWER, ipw2100_wx_get_power), - IW_HANDLER(SIOCSIWGENIE, ipw2100_wx_set_genie), - IW_HANDLER(SIOCGIWGENIE, ipw2100_wx_get_genie), - IW_HANDLER(SIOCSIWAUTH, ipw2100_wx_set_auth), - IW_HANDLER(SIOCGIWAUTH, ipw2100_wx_get_auth), - IW_HANDLER(SIOCSIWENCODEEXT, ipw2100_wx_set_encodeext), - IW_HANDLER(SIOCGIWENCODEEXT, ipw2100_wx_get_encodeext), -}; - -#define IPW2100_PRIV_SET_MONITOR SIOCIWFIRSTPRIV -#define IPW2100_PRIV_RESET SIOCIWFIRSTPRIV+1 -#define IPW2100_PRIV_SET_POWER SIOCIWFIRSTPRIV+2 -#define IPW2100_PRIV_GET_POWER SIOCIWFIRSTPRIV+3 -#define IPW2100_PRIV_SET_LONGPREAMBLE SIOCIWFIRSTPRIV+4 -#define IPW2100_PRIV_GET_LONGPREAMBLE SIOCIWFIRSTPRIV+5 -#define IPW2100_PRIV_SET_CRC_CHECK SIOCIWFIRSTPRIV+6 -#define IPW2100_PRIV_GET_CRC_CHECK SIOCIWFIRSTPRIV+7 - -static const struct iw_priv_args ipw2100_private_args[] = { - -#ifdef CONFIG_IPW2100_MONITOR - { - IPW2100_PRIV_SET_MONITOR, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, - { - IPW2100_PRIV_RESET, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"}, -#endif /* CONFIG_IPW2100_MONITOR */ - - { - IPW2100_PRIV_SET_POWER, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_power"}, - { - IPW2100_PRIV_GET_POWER, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_POWER_STRING, - "get_power"}, - { - IPW2100_PRIV_SET_LONGPREAMBLE, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble"}, - { - IPW2100_PRIV_GET_LONGPREAMBLE, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_preamble"}, -#ifdef CONFIG_IPW2100_MONITOR - { - IPW2100_PRIV_SET_CRC_CHECK, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_crc_check"}, - { - IPW2100_PRIV_GET_CRC_CHECK, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, "get_crc_check"}, -#endif /* CONFIG_IPW2100_MONITOR */ -}; - -static iw_handler ipw2100_private_handler[] = { -#ifdef CONFIG_IPW2100_MONITOR - ipw2100_wx_set_promisc, - ipw2100_wx_reset, -#else /* CONFIG_IPW2100_MONITOR */ - NULL, - NULL, -#endif /* CONFIG_IPW2100_MONITOR */ - ipw2100_wx_set_powermode, - ipw2100_wx_get_powermode, - ipw2100_wx_set_preamble, - ipw2100_wx_get_preamble, -#ifdef CONFIG_IPW2100_MONITOR - ipw2100_wx_set_crc_check, - ipw2100_wx_get_crc_check, -#else /* CONFIG_IPW2100_MONITOR */ - NULL, - NULL, -#endif /* CONFIG_IPW2100_MONITOR */ -}; - -/* - * Get wireless statistics. - * Called by /proc/net/wireless - * Also called by SIOCGIWSTATS - */ -static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev) -{ - enum { - POOR = 30, - FAIR = 60, - GOOD = 80, - VERY_GOOD = 90, - EXCELLENT = 95, - PERFECT = 100 - }; - int rssi_qual; - int tx_qual; - int beacon_qual; - int quality; - - struct ipw2100_priv *priv = libipw_priv(dev); - struct iw_statistics *wstats; - u32 rssi, tx_retries, missed_beacons, tx_failures; - u32 ord_len = sizeof(u32); - - if (!priv) - return (struct iw_statistics *)NULL; - - wstats = &priv->wstats; - - /* if hw is disabled, then ipw2100_get_ordinal() can't be called. - * ipw2100_wx_wireless_stats seems to be called before fw is - * initialized. STATUS_ASSOCIATED will only be set if the hw is up - * and associated; if not associcated, the values are all meaningless - * anyway, so set them all to NULL and INVALID */ - if (!(priv->status & STATUS_ASSOCIATED)) { - wstats->miss.beacon = 0; - wstats->discard.retries = 0; - wstats->qual.qual = 0; - wstats->qual.level = 0; - wstats->qual.noise = 0; - wstats->qual.updated = 7; - wstats->qual.updated |= IW_QUAL_NOISE_INVALID | - IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; - return wstats; - } - - if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_PERCENT_MISSED_BCNS, - &missed_beacons, &ord_len)) - goto fail_get_ordinal; - - /* If we don't have a connection the quality and level is 0 */ - if (!(priv->status & STATUS_ASSOCIATED)) { - wstats->qual.qual = 0; - wstats->qual.level = 0; - } else { - if (ipw2100_get_ordinal(priv, IPW_ORD_RSSI_AVG_CURR, - &rssi, &ord_len)) - goto fail_get_ordinal; - wstats->qual.level = rssi + IPW2100_RSSI_TO_DBM; - if (rssi < 10) - rssi_qual = rssi * POOR / 10; - else if (rssi < 15) - rssi_qual = (rssi - 10) * (FAIR - POOR) / 5 + POOR; - else if (rssi < 20) - rssi_qual = (rssi - 15) * (GOOD - FAIR) / 5 + FAIR; - else if (rssi < 30) - rssi_qual = (rssi - 20) * (VERY_GOOD - GOOD) / - 10 + GOOD; - else - rssi_qual = (rssi - 30) * (PERFECT - VERY_GOOD) / - 10 + VERY_GOOD; - - if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_PERCENT_RETRIES, - &tx_retries, &ord_len)) - goto fail_get_ordinal; - - if (tx_retries > 75) - tx_qual = (90 - tx_retries) * POOR / 15; - else if (tx_retries > 70) - tx_qual = (75 - tx_retries) * (FAIR - POOR) / 5 + POOR; - else if (tx_retries > 65) - tx_qual = (70 - tx_retries) * (GOOD - FAIR) / 5 + FAIR; - else if (tx_retries > 50) - tx_qual = (65 - tx_retries) * (VERY_GOOD - GOOD) / - 15 + GOOD; - else - tx_qual = (50 - tx_retries) * - (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; - - if (missed_beacons > 50) - beacon_qual = (60 - missed_beacons) * POOR / 10; - else if (missed_beacons > 40) - beacon_qual = (50 - missed_beacons) * (FAIR - POOR) / - 10 + POOR; - else if (missed_beacons > 32) - beacon_qual = (40 - missed_beacons) * (GOOD - FAIR) / - 18 + FAIR; - else if (missed_beacons > 20) - beacon_qual = (32 - missed_beacons) * - (VERY_GOOD - GOOD) / 20 + GOOD; - else - beacon_qual = (20 - missed_beacons) * - (PERFECT - VERY_GOOD) / 20 + VERY_GOOD; - - quality = min(tx_qual, rssi_qual); - quality = min(beacon_qual, quality); - -#ifdef CONFIG_IPW2100_DEBUG - if (beacon_qual == quality) - IPW_DEBUG_WX("Quality clamped by Missed Beacons\n"); - else if (tx_qual == quality) - IPW_DEBUG_WX("Quality clamped by Tx Retries\n"); - else if (quality != 100) - IPW_DEBUG_WX("Quality clamped by Signal Strength\n"); - else - IPW_DEBUG_WX("Quality not clamped.\n"); -#endif - - wstats->qual.qual = quality; - wstats->qual.level = rssi + IPW2100_RSSI_TO_DBM; - } - - wstats->qual.noise = 0; - wstats->qual.updated = 7; - wstats->qual.updated |= IW_QUAL_NOISE_INVALID; - - /* FIXME: this is percent and not a # */ - wstats->miss.beacon = missed_beacons; - - if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_TX_FAILURES, - &tx_failures, &ord_len)) - goto fail_get_ordinal; - wstats->discard.retries = tx_failures; - - return wstats; - - fail_get_ordinal: - IPW_DEBUG_WX("failed querying ordinals.\n"); - - return (struct iw_statistics *)NULL; -} - -static struct iw_handler_def ipw2100_wx_handler_def = { - .standard = ipw2100_wx_handlers, - .num_standard = ARRAY_SIZE(ipw2100_wx_handlers), - .num_private = ARRAY_SIZE(ipw2100_private_handler), - .num_private_args = ARRAY_SIZE(ipw2100_private_args), - .private = (iw_handler *) ipw2100_private_handler, - .private_args = (struct iw_priv_args *)ipw2100_private_args, - .get_wireless_stats = ipw2100_wx_wireless_stats, -}; - -static void ipw2100_wx_event_work(struct work_struct *work) -{ - struct ipw2100_priv *priv = - container_of(work, struct ipw2100_priv, wx_event_work.work); - union iwreq_data wrqu; - unsigned int len = ETH_ALEN; - - if (priv->status & STATUS_STOPPING) - return; - - mutex_lock(&priv->action_mutex); - - IPW_DEBUG_WX("enter\n"); - - mutex_unlock(&priv->action_mutex); - - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - - /* Fetch BSSID from the hardware */ - if (!(priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) || - priv->status & STATUS_RF_KILL_MASK || - ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, - &priv->bssid, &len)) { - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); - } else { - /* We now have the BSSID, so can finish setting to the full - * associated state */ - memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); - memcpy(priv->ieee->bssid, priv->bssid, ETH_ALEN); - priv->status &= ~STATUS_ASSOCIATING; - priv->status |= STATUS_ASSOCIATED; - netif_carrier_on(priv->net_dev); - netif_wake_queue(priv->net_dev); - } - - if (!(priv->status & STATUS_ASSOCIATED)) { - IPW_DEBUG_WX("Configuring ESSID\n"); - mutex_lock(&priv->action_mutex); - /* This is a disassociation event, so kick the firmware to - * look for another AP */ - if (priv->config & CFG_STATIC_ESSID) - ipw2100_set_essid(priv, priv->essid, priv->essid_len, - 0); - else - ipw2100_set_essid(priv, NULL, 0, 0); - mutex_unlock(&priv->action_mutex); - } - - wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); -} - -#define IPW2100_FW_MAJOR_VERSION 1 -#define IPW2100_FW_MINOR_VERSION 3 - -#define IPW2100_FW_MINOR(x) ((x & 0xff) >> 8) -#define IPW2100_FW_MAJOR(x) (x & 0xff) - -#define IPW2100_FW_VERSION ((IPW2100_FW_MINOR_VERSION << 8) | \ - IPW2100_FW_MAJOR_VERSION) - -#define IPW2100_FW_PREFIX "ipw2100-" __stringify(IPW2100_FW_MAJOR_VERSION) \ -"." __stringify(IPW2100_FW_MINOR_VERSION) - -#define IPW2100_FW_NAME(x) IPW2100_FW_PREFIX "" x ".fw" - -/* - -BINARY FIRMWARE HEADER FORMAT - -offset length desc -0 2 version -2 2 mode == 0:BSS,1:IBSS,2:MONITOR -4 4 fw_len -8 4 uc_len -C fw_len firmware data -12 + fw_len uc_len microcode data - -*/ - -struct ipw2100_fw_header { - short version; - short mode; - unsigned int fw_size; - unsigned int uc_size; -} __packed; - -static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw) -{ - struct ipw2100_fw_header *h = - (struct ipw2100_fw_header *)fw->fw_entry->data; - - if (IPW2100_FW_MAJOR(h->version) != IPW2100_FW_MAJOR_VERSION) { - printk(KERN_WARNING DRV_NAME ": Firmware image not compatible " - "(detected version id of %u). " - "See Documentation/networking/README.ipw2100\n", - h->version); - return 1; - } - - fw->version = h->version; - fw->fw.data = fw->fw_entry->data + sizeof(struct ipw2100_fw_header); - fw->fw.size = h->fw_size; - fw->uc.data = fw->fw.data + h->fw_size; - fw->uc.size = h->uc_size; - - return 0; -} - -static int ipw2100_get_firmware(struct ipw2100_priv *priv, - struct ipw2100_fw *fw) -{ - char *fw_name; - int rc; - - IPW_DEBUG_INFO("%s: Using hotplug firmware load.\n", - priv->net_dev->name); - - switch (priv->ieee->iw_mode) { - case IW_MODE_ADHOC: - fw_name = IPW2100_FW_NAME("-i"); - break; -#ifdef CONFIG_IPW2100_MONITOR - case IW_MODE_MONITOR: - fw_name = IPW2100_FW_NAME("-p"); - break; -#endif - case IW_MODE_INFRA: - default: - fw_name = IPW2100_FW_NAME(""); - break; - } - - rc = request_firmware(&fw->fw_entry, fw_name, &priv->pci_dev->dev); - - if (rc < 0) { - printk(KERN_ERR DRV_NAME ": " - "%s: Firmware '%s' not available or load failed.\n", - priv->net_dev->name, fw_name); - return rc; - } - IPW_DEBUG_INFO("firmware data %p size %zd\n", fw->fw_entry->data, - fw->fw_entry->size); - - ipw2100_mod_firmware_load(fw); - - return 0; -} - -MODULE_FIRMWARE(IPW2100_FW_NAME("-i")); -#ifdef CONFIG_IPW2100_MONITOR -MODULE_FIRMWARE(IPW2100_FW_NAME("-p")); -#endif -MODULE_FIRMWARE(IPW2100_FW_NAME("")); - -static void ipw2100_release_firmware(struct ipw2100_priv *priv, - struct ipw2100_fw *fw) -{ - fw->version = 0; - release_firmware(fw->fw_entry); - fw->fw_entry = NULL; -} - -static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, - size_t max) -{ - char ver[MAX_FW_VERSION_LEN]; - u32 len = MAX_FW_VERSION_LEN; - u32 tmp; - int i; - /* firmware version is an ascii string (max len of 14) */ - if (ipw2100_get_ordinal(priv, IPW_ORD_STAT_FW_VER_NUM, ver, &len)) - return -EIO; - tmp = max; - if (len >= max) - len = max - 1; - for (i = 0; i < len; i++) - buf[i] = ver[i]; - buf[i] = '\0'; - return tmp; -} - -static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, - size_t max) -{ - u32 ver; - u32 len = sizeof(ver); - /* microcode version is a 32 bit integer */ - if (ipw2100_get_ordinal(priv, IPW_ORD_UCODE_VERSION, &ver, &len)) - return -EIO; - return snprintf(buf, max, "%08X", ver); -} - -/* - * On exit, the firmware will have been freed from the fw list - */ -static int ipw2100_fw_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw) -{ - /* firmware is constructed of N contiguous entries, each entry is - * structured as: - * - * offset sie desc - * 0 4 address to write to - * 4 2 length of data run - * 6 length data - */ - unsigned int addr; - unsigned short len; - - const unsigned char *firmware_data = fw->fw.data; - unsigned int firmware_data_left = fw->fw.size; - - while (firmware_data_left > 0) { - addr = *(u32 *) (firmware_data); - firmware_data += 4; - firmware_data_left -= 4; - - len = *(u16 *) (firmware_data); - firmware_data += 2; - firmware_data_left -= 2; - - if (len > 32) { - printk(KERN_ERR DRV_NAME ": " - "Invalid firmware run-length of %d bytes\n", - len); - return -EINVAL; - } - - write_nic_memory(priv->net_dev, addr, len, firmware_data); - firmware_data += len; - firmware_data_left -= len; - } - - return 0; -} - -struct symbol_alive_response { - u8 cmd_id; - u8 seq_num; - u8 ucode_rev; - u8 eeprom_valid; - u16 valid_flags; - u8 IEEE_addr[6]; - u16 flags; - u16 pcb_rev; - u16 clock_settle_time; // 1us LSB - u16 powerup_settle_time; // 1us LSB - u16 hop_settle_time; // 1us LSB - u8 date[3]; // month, day, year - u8 time[2]; // hours, minutes - u8 ucode_valid; -}; - -static int ipw2100_ucode_download(struct ipw2100_priv *priv, - struct ipw2100_fw *fw) -{ - struct net_device *dev = priv->net_dev; - const unsigned char *microcode_data = fw->uc.data; - unsigned int microcode_data_left = fw->uc.size; - void __iomem *reg = priv->ioaddr; - - struct symbol_alive_response response; - int i, j; - u8 data; - - /* Symbol control */ - write_nic_word(dev, IPW2100_CONTROL_REG, 0x703); - readl(reg); - write_nic_word(dev, IPW2100_CONTROL_REG, 0x707); - readl(reg); - - /* HW config */ - write_nic_byte(dev, 0x210014, 0x72); /* fifo width =16 */ - readl(reg); - write_nic_byte(dev, 0x210014, 0x72); /* fifo width =16 */ - readl(reg); - - /* EN_CS_ACCESS bit to reset control store pointer */ - write_nic_byte(dev, 0x210000, 0x40); - readl(reg); - write_nic_byte(dev, 0x210000, 0x0); - readl(reg); - write_nic_byte(dev, 0x210000, 0x40); - readl(reg); - - /* copy microcode from buffer into Symbol */ - - while (microcode_data_left > 0) { - write_nic_byte(dev, 0x210010, *microcode_data++); - write_nic_byte(dev, 0x210010, *microcode_data++); - microcode_data_left -= 2; - } - - /* EN_CS_ACCESS bit to reset the control store pointer */ - write_nic_byte(dev, 0x210000, 0x0); - readl(reg); - - /* Enable System (Reg 0) - * first enable causes garbage in RX FIFO */ - write_nic_byte(dev, 0x210000, 0x0); - readl(reg); - write_nic_byte(dev, 0x210000, 0x80); - readl(reg); - - /* Reset External Baseband Reg */ - write_nic_word(dev, IPW2100_CONTROL_REG, 0x703); - readl(reg); - write_nic_word(dev, IPW2100_CONTROL_REG, 0x707); - readl(reg); - - /* HW Config (Reg 5) */ - write_nic_byte(dev, 0x210014, 0x72); // fifo width =16 - readl(reg); - write_nic_byte(dev, 0x210014, 0x72); // fifo width =16 - readl(reg); - - /* Enable System (Reg 0) - * second enable should be OK */ - write_nic_byte(dev, 0x210000, 0x00); // clear enable system - readl(reg); - write_nic_byte(dev, 0x210000, 0x80); // set enable system - - /* check Symbol is enabled - upped this from 5 as it wasn't always - * catching the update */ - for (i = 0; i < 10; i++) { - udelay(10); - - /* check Dino is enabled bit */ - read_nic_byte(dev, 0x210000, &data); - if (data & 0x1) - break; - } - - if (i == 10) { - printk(KERN_ERR DRV_NAME ": %s: Error initializing Symbol\n", - dev->name); - return -EIO; - } - - /* Get Symbol alive response */ - for (i = 0; i < 30; i++) { - /* Read alive response structure */ - for (j = 0; - j < (sizeof(struct symbol_alive_response) >> 1); j++) - read_nic_word(dev, 0x210004, ((u16 *) & response) + j); - - if ((response.cmd_id == 1) && (response.ucode_valid == 0x1)) - break; - udelay(10); - } - - if (i == 30) { - printk(KERN_ERR DRV_NAME - ": %s: No response from Symbol - hw not alive\n", - dev->name); - printk_buf(IPW_DL_ERROR, (u8 *) & response, sizeof(response)); - return -EIO; - } - - return 0; -} diff --git a/drivers/net/wireless/ipw2x00/ipw2100.h b/drivers/net/wireless/ipw2x00/ipw2100.h deleted file mode 100644 index c6d78790cb0d..000000000000 --- a/drivers/net/wireless/ipw2x00/ipw2100.h +++ /dev/null @@ -1,1156 +0,0 @@ -/****************************************************************************** - - Copyright(c) 2003 - 2006 Intel 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., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - - Contact Information: - Intel Linux Wireless - Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - -******************************************************************************/ -#ifndef _IPW2100_H -#define _IPW2100_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // new driver API - -#ifdef CONFIG_IPW2100_MONITOR -#include -#endif - -#include -#include - -#include "libipw.h" - -struct ipw2100_priv; -struct ipw2100_tx_packet; -struct ipw2100_rx_packet; - -#define IPW_DL_UNINIT 0x80000000 -#define IPW_DL_NONE 0x00000000 -#define IPW_DL_ALL 0x7FFFFFFF - -/* - * To use the debug system; - * - * If you are defining a new debug classification, simply add it to the #define - * list here in the form of: - * - * #define IPW_DL_xxxx VALUE - * - * shifting value to the left one bit from the previous entry. xxxx should be - * the name of the classification (for example, WEP) - * - * You then need to either add a IPW2100_xxxx_DEBUG() macro definition for your - * classification, or use IPW_DEBUG(IPW_DL_xxxx, ...) whenever you want - * to send output to that classification. - * - * To add your debug level to the list of levels seen when you perform - * - * % cat /proc/net/ipw2100/debug_level - * - * you simply need to add your entry to the ipw2100_debug_levels array. - * - * If you do not see debug_level in /proc/net/ipw2100 then you do not have - * CONFIG_IPW2100_DEBUG defined in your kernel configuration - * - */ - -#define IPW_DL_ERROR (1<<0) -#define IPW_DL_WARNING (1<<1) -#define IPW_DL_INFO (1<<2) -#define IPW_DL_WX (1<<3) -#define IPW_DL_HC (1<<5) -#define IPW_DL_STATE (1<<6) - -#define IPW_DL_NOTIF (1<<10) -#define IPW_DL_SCAN (1<<11) -#define IPW_DL_ASSOC (1<<12) -#define IPW_DL_DROP (1<<13) - -#define IPW_DL_IOCTL (1<<14) -#define IPW_DL_RF_KILL (1<<17) - -#define IPW_DL_MANAGE (1<<15) -#define IPW_DL_FW (1<<16) - -#define IPW_DL_FRAG (1<<21) -#define IPW_DL_WEP (1<<22) -#define IPW_DL_TX (1<<23) -#define IPW_DL_RX (1<<24) -#define IPW_DL_ISR (1<<25) -#define IPW_DL_IO (1<<26) -#define IPW_DL_TRACE (1<<28) - -#define IPW_DEBUG_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) -#define IPW_DEBUG_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) -#define IPW_DEBUG_INFO(f...) IPW_DEBUG(IPW_DL_INFO, ## f) -#define IPW_DEBUG_WX(f...) IPW_DEBUG(IPW_DL_WX, ## f) -#define IPW_DEBUG_SCAN(f...) IPW_DEBUG(IPW_DL_SCAN, ## f) -#define IPW_DEBUG_NOTIF(f...) IPW_DEBUG(IPW_DL_NOTIF, ## f) -#define IPW_DEBUG_TRACE(f...) IPW_DEBUG(IPW_DL_TRACE, ## f) -#define IPW_DEBUG_RX(f...) IPW_DEBUG(IPW_DL_RX, ## f) -#define IPW_DEBUG_TX(f...) IPW_DEBUG(IPW_DL_TX, ## f) -#define IPW_DEBUG_ISR(f...) IPW_DEBUG(IPW_DL_ISR, ## f) -#define IPW_DEBUG_MANAGEMENT(f...) IPW_DEBUG(IPW_DL_MANAGE, ## f) -#define IPW_DEBUG_WEP(f...) IPW_DEBUG(IPW_DL_WEP, ## f) -#define IPW_DEBUG_HC(f...) IPW_DEBUG(IPW_DL_HC, ## f) -#define IPW_DEBUG_FRAG(f...) IPW_DEBUG(IPW_DL_FRAG, ## f) -#define IPW_DEBUG_FW(f...) IPW_DEBUG(IPW_DL_FW, ## f) -#define IPW_DEBUG_RF_KILL(f...) IPW_DEBUG(IPW_DL_RF_KILL, ## f) -#define IPW_DEBUG_DROP(f...) IPW_DEBUG(IPW_DL_DROP, ## f) -#define IPW_DEBUG_IO(f...) IPW_DEBUG(IPW_DL_IO, ## f) -#define IPW_DEBUG_IOCTL(f...) IPW_DEBUG(IPW_DL_IOCTL, ## f) -#define IPW_DEBUG_STATE(f, a...) IPW_DEBUG(IPW_DL_STATE | IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) -#define IPW_DEBUG_ASSOC(f, a...) IPW_DEBUG(IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) - -enum { - IPW_HW_STATE_DISABLED = 1, - IPW_HW_STATE_ENABLED = 0 -}; - -extern const char *port_type_str[]; -extern const char *band_str[]; - -#define NUMBER_OF_BD_PER_COMMAND_PACKET 1 -#define NUMBER_OF_BD_PER_DATA_PACKET 2 - -#define IPW_MAX_BDS 6 -#define NUMBER_OF_OVERHEAD_BDS_PER_PACKETR 2 -#define NUMBER_OF_BDS_TO_LEAVE_FOR_COMMANDS 1 - -#define REQUIRED_SPACE_IN_RING_FOR_COMMAND_PACKET \ - (IPW_BD_QUEUE_W_R_MIN_SPARE + NUMBER_OF_BD_PER_COMMAND_PACKET) - -struct bd_status { - union { - struct { - u8 nlf:1, txType:2, intEnabled:1, reserved:4; - } fields; - u8 field; - } info; -} __packed; - -struct ipw2100_bd { - u32 host_addr; - u32 buf_length; - struct bd_status status; - /* number of fragments for frame (should be set only for - * 1st TBD) */ - u8 num_fragments; - u8 reserved[6]; -} __packed; - -#define IPW_BD_QUEUE_LENGTH(n) (1<value = (x)->hi = 0; \ - (x)->lo = 0x7fffffff; \ -} while (0) -#define SET_STAT(x,y) do { \ - (x)->value = y; \ - if ((x)->value > (x)->hi) (x)->hi = (x)->value; \ - if ((x)->value < (x)->lo) (x)->lo = (x)->value; \ -} while (0) -#define INC_STAT(x) do { if (++(x)->value > (x)->hi) (x)->hi = (x)->value; } \ -while (0) -#define DEC_STAT(x) do { if (--(x)->value < (x)->lo) (x)->lo = (x)->value; } \ -while (0) - -#define IPW2100_ERROR_QUEUE 5 - -/* Power management code: enable or disable? */ -enum { -#ifdef CONFIG_PM - IPW2100_PM_DISABLED = 0, - PM_STATE_SIZE = 16, -#else - IPW2100_PM_DISABLED = 1, - PM_STATE_SIZE = 0, -#endif -}; - -#define STATUS_POWERED (1<<0) -#define STATUS_CMD_ACTIVE (1<<1) /**< host command in progress */ -#define STATUS_RUNNING (1<<2) /* Card initialized, but not enabled */ -#define STATUS_ENABLED (1<<3) /* Card enabled -- can scan,Tx,Rx */ -#define STATUS_STOPPING (1<<4) /* Card is in shutdown phase */ -#define STATUS_INITIALIZED (1<<5) /* Card is ready for external calls */ -#define STATUS_ASSOCIATING (1<<9) /* Associated, but no BSSID yet */ -#define STATUS_ASSOCIATED (1<<10) /* Associated and BSSID valid */ -#define STATUS_INT_ENABLED (1<<11) -#define STATUS_RF_KILL_HW (1<<12) -#define STATUS_RF_KILL_SW (1<<13) -#define STATUS_RF_KILL_MASK (STATUS_RF_KILL_HW | STATUS_RF_KILL_SW) -#define STATUS_EXIT_PENDING (1<<14) - -#define STATUS_SCAN_PENDING (1<<23) -#define STATUS_SCANNING (1<<24) -#define STATUS_SCAN_ABORTING (1<<25) -#define STATUS_SCAN_COMPLETE (1<<26) -#define STATUS_WX_EVENT_PENDING (1<<27) -#define STATUS_RESET_PENDING (1<<29) -#define STATUS_SECURITY_UPDATED (1<<30) /* Security sync needed */ - -/* Internal NIC states */ -#define IPW_STATE_INITIALIZED (1<<0) -#define IPW_STATE_COUNTRY_FOUND (1<<1) -#define IPW_STATE_ASSOCIATED (1<<2) -#define IPW_STATE_ASSN_LOST (1<<3) -#define IPW_STATE_ASSN_CHANGED (1<<4) -#define IPW_STATE_SCAN_COMPLETE (1<<5) -#define IPW_STATE_ENTERED_PSP (1<<6) -#define IPW_STATE_LEFT_PSP (1<<7) -#define IPW_STATE_RF_KILL (1<<8) -#define IPW_STATE_DISABLED (1<<9) -#define IPW_STATE_POWER_DOWN (1<<10) -#define IPW_STATE_SCANNING (1<<11) - -#define CFG_STATIC_CHANNEL (1<<0) /* Restrict assoc. to single channel */ -#define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ -#define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ -#define CFG_CUSTOM_MAC (1<<3) -#define CFG_LONG_PREAMBLE (1<<4) -#define CFG_ASSOCIATE (1<<6) -#define CFG_FIXED_RATE (1<<7) -#define CFG_ADHOC_CREATE (1<<8) -#define CFG_PASSIVE_SCAN (1<<10) -#ifdef CONFIG_IPW2100_MONITOR -#define CFG_CRC_CHECK (1<<11) -#endif - -#define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ -#define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ - -struct ipw2100_priv { - void __iomem *ioaddr; - - int stop_hang_check; /* Set 1 when shutting down to kill hang_check */ - int stop_rf_kill; /* Set 1 when shutting down to kill rf_kill */ - - struct libipw_device *ieee; - unsigned long status; - unsigned long config; - unsigned long capability; - - /* Statistics */ - int resets; - int reset_backoff; - - /* Context */ - u8 essid[IW_ESSID_MAX_SIZE]; - u8 essid_len; - u8 bssid[ETH_ALEN]; - u8 channel; - int last_mode; - - unsigned long connect_start; - unsigned long last_reset; - - u32 channel_mask; - u32 fatal_error; - u32 fatal_errors[IPW2100_ERROR_QUEUE]; - u32 fatal_index; - int eeprom_version; - int firmware_version; - unsigned long hw_features; - int hangs; - u32 last_rtc; - int dump_raw; /* 1 to dump raw bytes in /sys/.../memory */ - u8 *snapshot[0x30]; - - u8 mandatory_bssid_mac[ETH_ALEN]; - u8 mac_addr[ETH_ALEN]; - - int power_mode; - - int messages_sent; - - int short_retry_limit; - int long_retry_limit; - - u32 rts_threshold; - u32 frag_threshold; - - int in_isr; - - u32 tx_rates; - int tx_power; - u32 beacon_interval; - - char nick[IW_ESSID_MAX_SIZE + 1]; - - struct ipw2100_status_queue status_queue; - - struct statistic txq_stat; - struct statistic rxq_stat; - struct ipw2100_bd_queue rx_queue; - struct ipw2100_bd_queue tx_queue; - struct ipw2100_rx_packet *rx_buffers; - - struct statistic fw_pend_stat; - struct list_head fw_pend_list; - - struct statistic msg_free_stat; - struct statistic msg_pend_stat; - struct list_head msg_free_list; - struct list_head msg_pend_list; - struct ipw2100_tx_packet *msg_buffers; - - struct statistic tx_free_stat; - struct statistic tx_pend_stat; - struct list_head tx_free_list; - struct list_head tx_pend_list; - struct ipw2100_tx_packet *tx_buffers; - - struct ipw2100_ordinals ordinals; - - struct pci_dev *pci_dev; - - struct proc_dir_entry *dir_dev; - - struct net_device *net_dev; - struct iw_statistics wstats; - - struct iw_public_data wireless_data; - - struct tasklet_struct irq_tasklet; - - struct delayed_work reset_work; - struct delayed_work security_work; - struct delayed_work wx_event_work; - struct delayed_work hang_check; - struct delayed_work rf_kill; - struct delayed_work scan_event; - - int user_requested_scan; - - /* Track time in suspend */ - unsigned long suspend_at; - unsigned long suspend_time; - - u32 interrupts; - int tx_interrupts; - int rx_interrupts; - int inta_other; - - spinlock_t low_lock; - struct mutex action_mutex; - struct mutex adapter_mutex; - - wait_queue_head_t wait_command_queue; -}; - -/********************************************************* - * Host Command -> From Driver to FW - *********************************************************/ - -/** - * Host command identifiers - */ -#define HOST_COMPLETE 2 -#define SYSTEM_CONFIG 6 -#define SSID 8 -#define MANDATORY_BSSID 9 -#define AUTHENTICATION_TYPE 10 -#define ADAPTER_ADDRESS 11 -#define PORT_TYPE 12 -#define INTERNATIONAL_MODE 13 -#define CHANNEL 14 -#define RTS_THRESHOLD 15 -#define FRAG_THRESHOLD 16 -#define POWER_MODE 17 -#define TX_RATES 18 -#define BASIC_TX_RATES 19 -#define WEP_KEY_INFO 20 -#define WEP_KEY_INDEX 25 -#define WEP_FLAGS 26 -#define ADD_MULTICAST 27 -#define CLEAR_ALL_MULTICAST 28 -#define BEACON_INTERVAL 29 -#define ATIM_WINDOW 30 -#define CLEAR_STATISTICS 31 -#define SEND 33 -#define TX_POWER_INDEX 36 -#define BROADCAST_SCAN 43 -#define CARD_DISABLE 44 -#define PREFERRED_BSSID 45 -#define SET_SCAN_OPTIONS 46 -#define SCAN_DWELL_TIME 47 -#define SWEEP_TABLE 48 -#define AP_OR_STATION_TABLE 49 -#define GROUP_ORDINALS 50 -#define SHORT_RETRY_LIMIT 51 -#define LONG_RETRY_LIMIT 52 - -#define HOST_PRE_POWER_DOWN 58 -#define CARD_DISABLE_PHY_OFF 61 -#define MSDU_TX_RATES 62 - -/* Rogue AP Detection */ -#define SET_STATION_STAT_BITS 64 -#define CLEAR_STATIONS_STAT_BITS 65 -#define LEAP_ROGUE_MODE 66 //TODO tbw replaced by CFG_LEAP_ROGUE_AP -#define SET_SECURITY_INFORMATION 67 -#define DISASSOCIATION_BSSID 68 -#define SET_WPA_IE 69 - -/* system configuration bit mask: */ -#define IPW_CFG_MONITOR 0x00004 -#define IPW_CFG_PREAMBLE_AUTO 0x00010 -#define IPW_CFG_IBSS_AUTO_START 0x00020 -#define IPW_CFG_LOOPBACK 0x00100 -#define IPW_CFG_ANSWER_BCSSID_PROBE 0x00800 -#define IPW_CFG_BT_SIDEBAND_SIGNAL 0x02000 -#define IPW_CFG_802_1x_ENABLE 0x04000 -#define IPW_CFG_BSS_MASK 0x08000 -#define IPW_CFG_IBSS_MASK 0x10000 - -#define IPW_SCAN_NOASSOCIATE (1<<0) -#define IPW_SCAN_MIXED_CELL (1<<1) -/* RESERVED (1<<2) */ -#define IPW_SCAN_PASSIVE (1<<3) - -#define IPW_NIC_FATAL_ERROR 0x2A7F0 -#define IPW_ERROR_ADDR(x) (x & 0x3FFFF) -#define IPW_ERROR_CODE(x) ((x & 0xFF000000) >> 24) -#define IPW2100_ERR_C3_CORRUPTION (0x10 << 24) -#define IPW2100_ERR_MSG_TIMEOUT (0x11 << 24) -#define IPW2100_ERR_FW_LOAD (0x12 << 24) - -#define IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND 0x200 -#define IPW_MEM_SRAM_HOST_INTERRUPT_AREA_LOWER_BOUND IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x0D80 - -#define IPW_MEM_HOST_SHARED_RX_BD_BASE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x40) -#define IPW_MEM_HOST_SHARED_RX_STATUS_BASE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x44) -#define IPW_MEM_HOST_SHARED_RX_BD_SIZE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x48) -#define IPW_MEM_HOST_SHARED_RX_READ_INDEX (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0xa0) - -#define IPW_MEM_HOST_SHARED_TX_QUEUE_BD_BASE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x00) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_BD_SIZE (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x04) -#define IPW_MEM_HOST_SHARED_TX_QUEUE_READ_INDEX (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x80) - -#define IPW_MEM_HOST_SHARED_RX_WRITE_INDEX \ - (IPW_MEM_SRAM_HOST_INTERRUPT_AREA_LOWER_BOUND + 0x20) - -#define IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX \ - (IPW_MEM_SRAM_HOST_INTERRUPT_AREA_LOWER_BOUND) - -#define IPW_MEM_HOST_SHARED_ORDINALS_TABLE_1 (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x180) -#define IPW_MEM_HOST_SHARED_ORDINALS_TABLE_2 (IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND + 0x184) - -#define IPW2100_INTA_TX_TRANSFER (0x00000001) // Bit 0 (LSB) -#define IPW2100_INTA_RX_TRANSFER (0x00000002) // Bit 1 -#define IPW2100_INTA_TX_COMPLETE (0x00000004) // Bit 2 -#define IPW2100_INTA_EVENT_INTERRUPT (0x00000008) // Bit 3 -#define IPW2100_INTA_STATUS_CHANGE (0x00000010) // Bit 4 -#define IPW2100_INTA_BEACON_PERIOD_EXPIRED (0x00000020) // Bit 5 -#define IPW2100_INTA_SLAVE_MODE_HOST_COMMAND_DONE (0x00010000) // Bit 16 -#define IPW2100_INTA_FW_INIT_DONE (0x01000000) // Bit 24 -#define IPW2100_INTA_FW_CALIBRATION_CALC (0x02000000) // Bit 25 -#define IPW2100_INTA_FATAL_ERROR (0x40000000) // Bit 30 -#define IPW2100_INTA_PARITY_ERROR (0x80000000) // Bit 31 (MSB) - -#define IPW_AUX_HOST_RESET_REG_PRINCETON_RESET (0x00000001) -#define IPW_AUX_HOST_RESET_REG_FORCE_NMI (0x00000002) -#define IPW_AUX_HOST_RESET_REG_PCI_HOST_CLUSTER_FATAL_NMI (0x00000004) -#define IPW_AUX_HOST_RESET_REG_CORE_FATAL_NMI (0x00000008) -#define IPW_AUX_HOST_RESET_REG_SW_RESET (0x00000080) -#define IPW_AUX_HOST_RESET_REG_MASTER_DISABLED (0x00000100) -#define IPW_AUX_HOST_RESET_REG_STOP_MASTER (0x00000200) - -#define IPW_AUX_HOST_GP_CNTRL_BIT_CLOCK_READY (0x00000001) // Bit 0 (LSB) -#define IPW_AUX_HOST_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY (0x00000002) // Bit 1 -#define IPW_AUX_HOST_GP_CNTRL_BIT_INIT_DONE (0x00000004) // Bit 2 -#define IPW_AUX_HOST_GP_CNTRL_BITS_SYS_CONFIG (0x000007c0) // Bits 6-10 -#define IPW_AUX_HOST_GP_CNTRL_BIT_BUS_TYPE (0x00000200) // Bit 9 -#define IPW_AUX_HOST_GP_CNTRL_BIT_BAR0_BLOCK_SIZE (0x00000400) // Bit 10 -#define IPW_AUX_HOST_GP_CNTRL_BIT_USB_MODE (0x20000000) // Bit 29 -#define IPW_AUX_HOST_GP_CNTRL_BIT_HOST_FORCES_SYS_CLK (0x40000000) // Bit 30 -#define IPW_AUX_HOST_GP_CNTRL_BIT_FW_FORCES_SYS_CLK (0x80000000) // Bit 31 (MSB) - -#define IPW_BIT_GPIO_GPIO1_MASK 0x0000000C -#define IPW_BIT_GPIO_GPIO3_MASK 0x000000C0 -#define IPW_BIT_GPIO_GPIO1_ENABLE 0x00000008 -#define IPW_BIT_GPIO_RF_KILL 0x00010000 - -#define IPW_BIT_GPIO_LED_OFF 0x00002000 // Bit 13 = 1 - -#define IPW_REG_DOMAIN_0_OFFSET 0x0000 -#define IPW_REG_DOMAIN_1_OFFSET IPW_MEM_SRAM_HOST_SHARED_LOWER_BOUND - -#define IPW_REG_INTA IPW_REG_DOMAIN_0_OFFSET + 0x0008 -#define IPW_REG_INTA_MASK IPW_REG_DOMAIN_0_OFFSET + 0x000C -#define IPW_REG_INDIRECT_ACCESS_ADDRESS IPW_REG_DOMAIN_0_OFFSET + 0x0010 -#define IPW_REG_INDIRECT_ACCESS_DATA IPW_REG_DOMAIN_0_OFFSET + 0x0014 -#define IPW_REG_AUTOINCREMENT_ADDRESS IPW_REG_DOMAIN_0_OFFSET + 0x0018 -#define IPW_REG_AUTOINCREMENT_DATA IPW_REG_DOMAIN_0_OFFSET + 0x001C -#define IPW_REG_RESET_REG IPW_REG_DOMAIN_0_OFFSET + 0x0020 -#define IPW_REG_GP_CNTRL IPW_REG_DOMAIN_0_OFFSET + 0x0024 -#define IPW_REG_GPIO IPW_REG_DOMAIN_0_OFFSET + 0x0030 -#define IPW_REG_FW_TYPE IPW_REG_DOMAIN_1_OFFSET + 0x0188 -#define IPW_REG_FW_VERSION IPW_REG_DOMAIN_1_OFFSET + 0x018C -#define IPW_REG_FW_COMPATABILITY_VERSION IPW_REG_DOMAIN_1_OFFSET + 0x0190 - -#define IPW_REG_INDIRECT_ADDR_MASK 0x00FFFFFC - -#define IPW_INTERRUPT_MASK 0xC1010013 - -#define IPW2100_CONTROL_REG 0x220000 -#define IPW2100_CONTROL_PHY_OFF 0x8 - -#define IPW2100_COMMAND 0x00300004 -#define IPW2100_COMMAND_PHY_ON 0x0 -#define IPW2100_COMMAND_PHY_OFF 0x1 - -/* in DEBUG_AREA, values of memory always 0xd55555d5 */ -#define IPW_REG_DOA_DEBUG_AREA_START IPW_REG_DOMAIN_0_OFFSET + 0x0090 -#define IPW_REG_DOA_DEBUG_AREA_END IPW_REG_DOMAIN_0_OFFSET + 0x00FF -#define IPW_DATA_DOA_DEBUG_VALUE 0xd55555d5 - -#define IPW_INTERNAL_REGISTER_HALT_AND_RESET 0x003000e0 - -#define IPW_WAIT_CLOCK_STABILIZATION_DELAY 50 // micro seconds -#define IPW_WAIT_RESET_ARC_COMPLETE_DELAY 10 // micro seconds -#define IPW_WAIT_RESET_MASTER_ASSERT_COMPLETE_DELAY 10 // micro seconds - -// BD ring queue read/write difference -#define IPW_BD_QUEUE_W_R_MIN_SPARE 2 - -#define IPW_CACHE_LINE_LENGTH_DEFAULT 0x80 - -#define IPW_CARD_DISABLE_PHY_OFF_COMPLETE_WAIT 100 // 100 milli -#define IPW_PREPARE_POWER_DOWN_COMPLETE_WAIT 100 // 100 milli - -#define IPW_HEADER_802_11_SIZE sizeof(struct libipw_hdr_3addr) -#define IPW_MAX_80211_PAYLOAD_SIZE 2304U -#define IPW_MAX_802_11_PAYLOAD_LENGTH 2312 -#define IPW_MAX_ACCEPTABLE_TX_FRAME_LENGTH 1536 -#define IPW_MIN_ACCEPTABLE_RX_FRAME_LENGTH 60 -#define IPW_MAX_ACCEPTABLE_RX_FRAME_LENGTH \ - (IPW_MAX_ACCEPTABLE_TX_FRAME_LENGTH + IPW_HEADER_802_11_SIZE - \ - sizeof(struct ethhdr)) - -#define IPW_802_11_FCS_LENGTH 4 -#define IPW_RX_NIC_BUFFER_LENGTH \ - (IPW_MAX_802_11_PAYLOAD_LENGTH + IPW_HEADER_802_11_SIZE + \ - IPW_802_11_FCS_LENGTH) - -#define IPW_802_11_PAYLOAD_OFFSET \ - (sizeof(struct libipw_hdr_3addr) + \ - sizeof(struct libipw_snap_hdr)) - -struct ipw2100_rx { - union { - unsigned char payload[IPW_RX_NIC_BUFFER_LENGTH]; - struct libipw_hdr_4addr header; - u32 status; - struct ipw2100_notification notification; - struct ipw2100_cmd_header command; - } rx_data; -} __packed; - -/* Bit 0-7 are for 802.11b tx rates - . Bit 5-7 are reserved */ -#define TX_RATE_1_MBIT 0x0001 -#define TX_RATE_2_MBIT 0x0002 -#define TX_RATE_5_5_MBIT 0x0004 -#define TX_RATE_11_MBIT 0x0008 -#define TX_RATE_MASK 0x000F -#define DEFAULT_TX_RATES 0x000F - -#define IPW_POWER_MODE_CAM 0x00 //(always on) -#define IPW_POWER_INDEX_1 0x01 -#define IPW_POWER_INDEX_2 0x02 -#define IPW_POWER_INDEX_3 0x03 -#define IPW_POWER_INDEX_4 0x04 -#define IPW_POWER_INDEX_5 0x05 -#define IPW_POWER_AUTO 0x06 -#define IPW_POWER_MASK 0x0F -#define IPW_POWER_ENABLED 0x10 -#define IPW_POWER_LEVEL(x) ((x) & IPW_POWER_MASK) - -#define IPW_TX_POWER_AUTO 0 -#define IPW_TX_POWER_ENHANCED 1 - -#define IPW_TX_POWER_DEFAULT 32 -#define IPW_TX_POWER_MIN 0 -#define IPW_TX_POWER_MAX 16 -#define IPW_TX_POWER_MIN_DBM (-12) -#define IPW_TX_POWER_MAX_DBM 16 - -#define FW_SCAN_DONOT_ASSOCIATE 0x0001 // Dont Attempt to Associate after Scan -#define FW_SCAN_PASSIVE 0x0008 // Force PASSSIVE Scan - -#define REG_MIN_CHANNEL 0 -#define REG_MAX_CHANNEL 14 - -#define REG_CHANNEL_MASK 0x00003FFF -#define IPW_IBSS_11B_DEFAULT_MASK 0x87ff - -#define DIVERSITY_EITHER 0 // Use both antennas -#define DIVERSITY_ANTENNA_A 1 // Use antenna A -#define DIVERSITY_ANTENNA_B 2 // Use antenna B - -#define HOST_COMMAND_WAIT 0 -#define HOST_COMMAND_NO_WAIT 1 - -#define LOCK_NONE 0 -#define LOCK_DRIVER 1 -#define LOCK_FW 2 - -#define TYPE_SWEEP_ORD 0x000D -#define TYPE_IBSS_STTN_ORD 0x000E -#define TYPE_BSS_AP_ORD 0x000F -#define TYPE_RAW_BEACON_ENTRY 0x0010 -#define TYPE_CALIBRATION_DATA 0x0011 -#define TYPE_ROGUE_AP_DATA 0x0012 -#define TYPE_ASSOCIATION_REQUEST 0x0013 -#define TYPE_REASSOCIATION_REQUEST 0x0014 - -#define HW_FEATURE_RFKILL 0x0001 -#define RF_KILLSWITCH_OFF 1 -#define RF_KILLSWITCH_ON 0 - -#define IPW_COMMAND_POOL_SIZE 40 - -#define IPW_START_ORD_TAB_1 1 -#define IPW_START_ORD_TAB_2 1000 - -#define IPW_ORD_TAB_1_ENTRY_SIZE sizeof(u32) - -#define IS_ORDINAL_TABLE_ONE(mgr,id) \ - ((id >= IPW_START_ORD_TAB_1) && (id < mgr->table1_size)) -#define IS_ORDINAL_TABLE_TWO(mgr,id) \ - ((id >= IPW_START_ORD_TAB_2) && (id < (mgr->table2_size + IPW_START_ORD_TAB_2))) - -#define BSS_ID_LENGTH 6 - -// Fixed size data: Ordinal Table 1 -typedef enum _ORDINAL_TABLE_1 { // NS - means Not Supported by FW -// Transmit statistics - IPW_ORD_STAT_TX_HOST_REQUESTS = 1, // # of requested Host Tx's (MSDU) - IPW_ORD_STAT_TX_HOST_COMPLETE, // # of successful Host Tx's (MSDU) - IPW_ORD_STAT_TX_DIR_DATA, // # of successful Directed Tx's (MSDU) - - IPW_ORD_STAT_TX_DIR_DATA1 = 4, // # of successful Directed Tx's (MSDU) @ 1MB - IPW_ORD_STAT_TX_DIR_DATA2, // # of successful Directed Tx's (MSDU) @ 2MB - IPW_ORD_STAT_TX_DIR_DATA5_5, // # of successful Directed Tx's (MSDU) @ 5_5MB - IPW_ORD_STAT_TX_DIR_DATA11, // # of successful Directed Tx's (MSDU) @ 11MB - IPW_ORD_STAT_TX_DIR_DATA22, // # of successful Directed Tx's (MSDU) @ 22MB - - IPW_ORD_STAT_TX_NODIR_DATA1 = 13, // # of successful Non_Directed Tx's (MSDU) @ 1MB - IPW_ORD_STAT_TX_NODIR_DATA2, // # of successful Non_Directed Tx's (MSDU) @ 2MB - IPW_ORD_STAT_TX_NODIR_DATA5_5, // # of successful Non_Directed Tx's (MSDU) @ 5.5MB - IPW_ORD_STAT_TX_NODIR_DATA11, // # of successful Non_Directed Tx's (MSDU) @ 11MB - - IPW_ORD_STAT_NULL_DATA = 21, // # of successful NULL data Tx's - IPW_ORD_STAT_TX_RTS, // # of successful Tx RTS - IPW_ORD_STAT_TX_CTS, // # of successful Tx CTS - IPW_ORD_STAT_TX_ACK, // # of successful Tx ACK - IPW_ORD_STAT_TX_ASSN, // # of successful Association Tx's - IPW_ORD_STAT_TX_ASSN_RESP, // # of successful Association response Tx's - IPW_ORD_STAT_TX_REASSN, // # of successful Reassociation Tx's - IPW_ORD_STAT_TX_REASSN_RESP, // # of successful Reassociation response Tx's - IPW_ORD_STAT_TX_PROBE, // # of probes successfully transmitted - IPW_ORD_STAT_TX_PROBE_RESP, // # of probe responses successfully transmitted - IPW_ORD_STAT_TX_BEACON, // # of tx beacon - IPW_ORD_STAT_TX_ATIM, // # of Tx ATIM - IPW_ORD_STAT_TX_DISASSN, // # of successful Disassociation TX - IPW_ORD_STAT_TX_AUTH, // # of successful Authentication Tx - IPW_ORD_STAT_TX_DEAUTH, // # of successful Deauthentication TX - - IPW_ORD_STAT_TX_TOTAL_BYTES = 41, // Total successful Tx data bytes - IPW_ORD_STAT_TX_RETRIES, // # of Tx retries - IPW_ORD_STAT_TX_RETRY1, // # of Tx retries at 1MBPS - IPW_ORD_STAT_TX_RETRY2, // # of Tx retries at 2MBPS - IPW_ORD_STAT_TX_RETRY5_5, // # of Tx retries at 5.5MBPS - IPW_ORD_STAT_TX_RETRY11, // # of Tx retries at 11MBPS - - IPW_ORD_STAT_TX_FAILURES = 51, // # of Tx Failures - IPW_ORD_STAT_TX_ABORT_AT_HOP, //NS // # of Tx's aborted at hop time - IPW_ORD_STAT_TX_MAX_TRIES_IN_HOP, // # of times max tries in a hop failed - IPW_ORD_STAT_TX_ABORT_LATE_DMA, //NS // # of times tx aborted due to late dma setup - IPW_ORD_STAT_TX_ABORT_STX, //NS // # of times backoff aborted - IPW_ORD_STAT_TX_DISASSN_FAIL, // # of times disassociation failed - IPW_ORD_STAT_TX_ERR_CTS, // # of missed/bad CTS frames - IPW_ORD_STAT_TX_BPDU, //NS // # of spanning tree BPDUs sent - IPW_ORD_STAT_TX_ERR_ACK, // # of tx err due to acks - - // Receive statistics - IPW_ORD_STAT_RX_HOST = 61, // # of packets passed to host - IPW_ORD_STAT_RX_DIR_DATA, // # of directed packets - IPW_ORD_STAT_RX_DIR_DATA1, // # of directed packets at 1MB - IPW_ORD_STAT_RX_DIR_DATA2, // # of directed packets at 2MB - IPW_ORD_STAT_RX_DIR_DATA5_5, // # of directed packets at 5.5MB - IPW_ORD_STAT_RX_DIR_DATA11, // # of directed packets at 11MB - IPW_ORD_STAT_RX_DIR_DATA22, // # of directed packets at 22MB - - IPW_ORD_STAT_RX_NODIR_DATA = 71, // # of nondirected packets - IPW_ORD_STAT_RX_NODIR_DATA1, // # of nondirected packets at 1MB - IPW_ORD_STAT_RX_NODIR_DATA2, // # of nondirected packets at 2MB - IPW_ORD_STAT_RX_NODIR_DATA5_5, // # of nondirected packets at 5.5MB - IPW_ORD_STAT_RX_NODIR_DATA11, // # of nondirected packets at 11MB - - IPW_ORD_STAT_RX_NULL_DATA = 80, // # of null data rx's - IPW_ORD_STAT_RX_POLL, //NS // # of poll rx - IPW_ORD_STAT_RX_RTS, // # of Rx RTS - IPW_ORD_STAT_RX_CTS, // # of Rx CTS - IPW_ORD_STAT_RX_ACK, // # of Rx ACK - IPW_ORD_STAT_RX_CFEND, // # of Rx CF End - IPW_ORD_STAT_RX_CFEND_ACK, // # of Rx CF End + CF Ack - IPW_ORD_STAT_RX_ASSN, // # of Association Rx's - IPW_ORD_STAT_RX_ASSN_RESP, // # of Association response Rx's - IPW_ORD_STAT_RX_REASSN, // # of Reassociation Rx's - IPW_ORD_STAT_RX_REASSN_RESP, // # of Reassociation response Rx's - IPW_ORD_STAT_RX_PROBE, // # of probe Rx's - IPW_ORD_STAT_RX_PROBE_RESP, // # of probe response Rx's - IPW_ORD_STAT_RX_BEACON, // # of Rx beacon - IPW_ORD_STAT_RX_ATIM, // # of Rx ATIM - IPW_ORD_STAT_RX_DISASSN, // # of disassociation Rx - IPW_ORD_STAT_RX_AUTH, // # of authentication Rx - IPW_ORD_STAT_RX_DEAUTH, // # of deauthentication Rx - - IPW_ORD_STAT_RX_TOTAL_BYTES = 101, // Total rx data bytes received - IPW_ORD_STAT_RX_ERR_CRC, // # of packets with Rx CRC error - IPW_ORD_STAT_RX_ERR_CRC1, // # of Rx CRC errors at 1MB - IPW_ORD_STAT_RX_ERR_CRC2, // # of Rx CRC errors at 2MB - IPW_ORD_STAT_RX_ERR_CRC5_5, // # of Rx CRC errors at 5.5MB - IPW_ORD_STAT_RX_ERR_CRC11, // # of Rx CRC errors at 11MB - - IPW_ORD_STAT_RX_DUPLICATE1 = 112, // # of duplicate rx packets at 1MB - IPW_ORD_STAT_RX_DUPLICATE2, // # of duplicate rx packets at 2MB - IPW_ORD_STAT_RX_DUPLICATE5_5, // # of duplicate rx packets at 5.5MB - IPW_ORD_STAT_RX_DUPLICATE11, // # of duplicate rx packets at 11MB - IPW_ORD_STAT_RX_DUPLICATE = 119, // # of duplicate rx packets - - IPW_ORD_PERS_DB_LOCK = 120, // # locking fw permanent db - IPW_ORD_PERS_DB_SIZE, // # size of fw permanent db - IPW_ORD_PERS_DB_ADDR, // # address of fw permanent db - IPW_ORD_STAT_RX_INVALID_PROTOCOL, // # of rx frames with invalid protocol - IPW_ORD_SYS_BOOT_TIME, // # Boot time - IPW_ORD_STAT_RX_NO_BUFFER, // # of rx frames rejected due to no buffer - IPW_ORD_STAT_RX_ABORT_LATE_DMA, //NS // # of rx frames rejected due to dma setup too late - IPW_ORD_STAT_RX_ABORT_AT_HOP, //NS // # of rx frames aborted due to hop - IPW_ORD_STAT_RX_MISSING_FRAG, // # of rx frames dropped due to missing fragment - IPW_ORD_STAT_RX_ORPHAN_FRAG, // # of rx frames dropped due to non-sequential fragment - IPW_ORD_STAT_RX_ORPHAN_FRAME, // # of rx frames dropped due to unmatched 1st frame - IPW_ORD_STAT_RX_FRAG_AGEOUT, // # of rx frames dropped due to uncompleted frame - IPW_ORD_STAT_RX_BAD_SSID, //NS // Bad SSID (unused) - IPW_ORD_STAT_RX_ICV_ERRORS, // # of ICV errors during decryption - -// PSP Statistics - IPW_ORD_STAT_PSP_SUSPENSION = 137, // # of times adapter suspended - IPW_ORD_STAT_PSP_BCN_TIMEOUT, // # of beacon timeout - IPW_ORD_STAT_PSP_POLL_TIMEOUT, // # of poll response timeouts - IPW_ORD_STAT_PSP_NONDIR_TIMEOUT, // # of timeouts waiting for last broadcast/muticast pkt - IPW_ORD_STAT_PSP_RX_DTIMS, // # of PSP DTIMs received - IPW_ORD_STAT_PSP_RX_TIMS, // # of PSP TIMs received - IPW_ORD_STAT_PSP_STATION_ID, // PSP Station ID - -// Association and roaming - IPW_ORD_LAST_ASSN_TIME = 147, // RTC time of last association - IPW_ORD_STAT_PERCENT_MISSED_BCNS, // current calculation of % missed beacons - IPW_ORD_STAT_PERCENT_RETRIES, // current calculation of % missed tx retries - IPW_ORD_ASSOCIATED_AP_PTR, // If associated, this is ptr to the associated - // AP table entry. set to 0 if not associated - IPW_ORD_AVAILABLE_AP_CNT, // # of AP's decsribed in the AP table - IPW_ORD_AP_LIST_PTR, // Ptr to list of available APs - IPW_ORD_STAT_AP_ASSNS, // # of associations - IPW_ORD_STAT_ASSN_FAIL, // # of association failures - IPW_ORD_STAT_ASSN_RESP_FAIL, // # of failuresdue to response fail - IPW_ORD_STAT_FULL_SCANS, // # of full scans - - IPW_ORD_CARD_DISABLED, // # Card Disabled - IPW_ORD_STAT_ROAM_INHIBIT, // # of times roaming was inhibited due to ongoing activity - IPW_FILLER_40, - IPW_ORD_RSSI_AT_ASSN = 160, // RSSI of associated AP at time of association - IPW_ORD_STAT_ASSN_CAUSE1, // # of reassociations due to no tx from AP in last N - // hops or no prob_ responses in last 3 minutes - IPW_ORD_STAT_ASSN_CAUSE2, // # of reassociations due to poor tx/rx quality - IPW_ORD_STAT_ASSN_CAUSE3, // # of reassociations due to tx/rx quality with excessive - // load at the AP - IPW_ORD_STAT_ASSN_CAUSE4, // # of reassociations due to AP RSSI level fell below - // eligible group - IPW_ORD_STAT_ASSN_CAUSE5, // # of reassociations due to load leveling - IPW_ORD_STAT_ASSN_CAUSE6, //NS // # of reassociations due to dropped by Ap - IPW_FILLER_41, - IPW_FILLER_42, - IPW_FILLER_43, - IPW_ORD_STAT_AUTH_FAIL, // # of times authentication failed - IPW_ORD_STAT_AUTH_RESP_FAIL, // # of times authentication response failed - IPW_ORD_STATION_TABLE_CNT, // # of entries in association table - -// Other statistics - IPW_ORD_RSSI_AVG_CURR = 173, // Current avg RSSI - IPW_ORD_STEST_RESULTS_CURR, //NS // Current self test results word - IPW_ORD_STEST_RESULTS_CUM, //NS // Cummulative self test results word - IPW_ORD_SELF_TEST_STATUS, //NS // - IPW_ORD_POWER_MGMT_MODE, // Power mode - 0=CAM, 1=PSP - IPW_ORD_POWER_MGMT_INDEX, //NS // - IPW_ORD_COUNTRY_CODE, // IEEE country code as recv'd from beacon - IPW_ORD_COUNTRY_CHANNELS, // channels supported by country -// IPW_ORD_COUNTRY_CHANNELS: -// For 11b the lower 2-byte are used for channels from 1-14 -// and the higher 2-byte are not used. - IPW_ORD_RESET_CNT, // # of adapter resets (warm) - IPW_ORD_BEACON_INTERVAL, // Beacon interval - - IPW_ORD_PRINCETON_VERSION = 184, //NS // Princeton Version - IPW_ORD_ANTENNA_DIVERSITY, // TRUE if antenna diversity is disabled - IPW_ORD_CCA_RSSI, //NS // CCA RSSI value (factory programmed) - IPW_ORD_STAT_EEPROM_UPDATE, //NS // # of times config EEPROM updated - IPW_ORD_DTIM_PERIOD, // # of beacon intervals between DTIMs - IPW_ORD_OUR_FREQ, // current radio freq lower digits - channel ID - - IPW_ORD_RTC_TIME = 190, // current RTC time - IPW_ORD_PORT_TYPE, // operating mode - IPW_ORD_CURRENT_TX_RATE, // current tx rate - IPW_ORD_SUPPORTED_RATES, // Bitmap of supported tx rates - IPW_ORD_ATIM_WINDOW, // current ATIM Window - IPW_ORD_BASIC_RATES, // bitmap of basic tx rates - IPW_ORD_NIC_HIGHEST_RATE, // bitmap of basic tx rates - IPW_ORD_AP_HIGHEST_RATE, // bitmap of basic tx rates - IPW_ORD_CAPABILITIES, // Management frame capability field - IPW_ORD_AUTH_TYPE, // Type of authentication - IPW_ORD_RADIO_TYPE, // Adapter card platform type - IPW_ORD_RTS_THRESHOLD = 201, // Min length of packet after which RTS handshaking is used - IPW_ORD_INT_MODE, // International mode - IPW_ORD_FRAGMENTATION_THRESHOLD, // protocol frag threshold - IPW_ORD_EEPROM_SRAM_DB_BLOCK_START_ADDRESS, // EEPROM offset in SRAM - IPW_ORD_EEPROM_SRAM_DB_BLOCK_SIZE, // EEPROM size in SRAM - IPW_ORD_EEPROM_SKU_CAPABILITY, // EEPROM SKU Capability 206 = - IPW_ORD_EEPROM_IBSS_11B_CHANNELS, // EEPROM IBSS 11b channel set - - IPW_ORD_MAC_VERSION = 209, // MAC Version - IPW_ORD_MAC_REVISION, // MAC Revision - IPW_ORD_RADIO_VERSION, // Radio Version - IPW_ORD_NIC_MANF_DATE_TIME, // MANF Date/Time STAMP - IPW_ORD_UCODE_VERSION, // Ucode Version - IPW_ORD_HW_RF_SWITCH_STATE = 214, // HW RF Kill Switch State -} ORDINALTABLE1; - -// ordinal table 2 -// Variable length data: -#define IPW_FIRST_VARIABLE_LENGTH_ORDINAL 1001 - -typedef enum _ORDINAL_TABLE_2 { // NS - means Not Supported by FW - IPW_ORD_STAT_BASE = 1000, // contains number of variable ORDs - IPW_ORD_STAT_ADAPTER_MAC = 1001, // 6 bytes: our adapter MAC address - IPW_ORD_STAT_PREFERRED_BSSID = 1002, // 6 bytes: BSSID of the preferred AP - IPW_ORD_STAT_MANDATORY_BSSID = 1003, // 6 bytes: BSSID of the mandatory AP - IPW_FILL_1, //NS // - IPW_ORD_STAT_COUNTRY_TEXT = 1005, // 36 bytes: Country name text, First two bytes are Country code - IPW_ORD_STAT_ASSN_SSID = 1006, // 32 bytes: ESSID String - IPW_ORD_STATION_TABLE = 1007, // ? bytes: Station/AP table (via Direct SSID Scans) - IPW_ORD_STAT_SWEEP_TABLE = 1008, // ? bytes: Sweep/Host Table table (via Broadcast Scans) - IPW_ORD_STAT_ROAM_LOG = 1009, // ? bytes: Roaming log - IPW_ORD_STAT_RATE_LOG = 1010, //NS // 0 bytes: Rate log - IPW_ORD_STAT_FIFO = 1011, //NS // 0 bytes: Fifo buffer data structures - IPW_ORD_STAT_FW_VER_NUM = 1012, // 14 bytes: fw version ID string as in (a.bb.ccc; "0.08.011") - IPW_ORD_STAT_FW_DATE = 1013, // 14 bytes: fw date string (mmm dd yyyy; "Mar 13 2002") - IPW_ORD_STAT_ASSN_AP_BSSID = 1014, // 6 bytes: MAC address of associated AP - IPW_ORD_STAT_DEBUG = 1015, //NS // ? bytes: - IPW_ORD_STAT_NIC_BPA_NUM = 1016, // 11 bytes: NIC BPA number in ASCII - IPW_ORD_STAT_UCODE_DATE = 1017, // 5 bytes: uCode date - IPW_ORD_SECURITY_NGOTIATION_RESULT = 1018, -} ORDINALTABLE2; // NS - means Not Supported by FW - -#define IPW_LAST_VARIABLE_LENGTH_ORDINAL 1018 - -#ifndef WIRELESS_SPY -#define WIRELESS_SPY // enable iwspy support -#endif - -#define IPW_HOST_FW_SHARED_AREA0 0x0002f200 -#define IPW_HOST_FW_SHARED_AREA0_END 0x0002f510 // 0x310 bytes - -#define IPW_HOST_FW_SHARED_AREA1 0x0002f610 -#define IPW_HOST_FW_SHARED_AREA1_END 0x0002f630 // 0x20 bytes - -#define IPW_HOST_FW_SHARED_AREA2 0x0002fa00 -#define IPW_HOST_FW_SHARED_AREA2_END 0x0002fa20 // 0x20 bytes - -#define IPW_HOST_FW_SHARED_AREA3 0x0002fc00 -#define IPW_HOST_FW_SHARED_AREA3_END 0x0002fc10 // 0x10 bytes - -#define IPW_HOST_FW_INTERRUPT_AREA 0x0002ff80 -#define IPW_HOST_FW_INTERRUPT_AREA_END 0x00030000 // 0x80 bytes - -struct ipw2100_fw_chunk { - unsigned char *buf; - long len; - long pos; - struct list_head list; -}; - -struct ipw2100_fw_chunk_set { - const void *data; - unsigned long size; -}; - -struct ipw2100_fw { - int version; - struct ipw2100_fw_chunk_set fw; - struct ipw2100_fw_chunk_set uc; - const struct firmware *fw_entry; -}; - -#define MAX_FW_VERSION_LEN 14 - -#endif /* _IPW2100_H */ diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c deleted file mode 100644 index d96257b79a84..000000000000 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ /dev/null @@ -1,12158 +0,0 @@ -/****************************************************************************** - - Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved. - - 802.11 status code portion of this file from ethereal-0.10.6: - Copyright 2000, Axis Communications AB - Ethereal - Network traffic analyzer - By Gerald Combs - Copyright 1998 Gerald Combs - - 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., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - - Contact Information: - Intel Linux Wireless - Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - -******************************************************************************/ - -#include -#include -#include -#include "ipw2200.h" -#include "ipw.h" - - -#ifndef KBUILD_EXTMOD -#define VK "k" -#else -#define VK -#endif - -#ifdef CONFIG_IPW2200_DEBUG -#define VD "d" -#else -#define VD -#endif - -#ifdef CONFIG_IPW2200_MONITOR -#define VM "m" -#else -#define VM -#endif - -#ifdef CONFIG_IPW2200_PROMISCUOUS -#define VP "p" -#else -#define VP -#endif - -#ifdef CONFIG_IPW2200_RADIOTAP -#define VR "r" -#else -#define VR -#endif - -#ifdef CONFIG_IPW2200_QOS -#define VQ "q" -#else -#define VQ -#endif - -#define IPW2200_VERSION "1.2.2" VK VD VM VP VR VQ -#define DRV_DESCRIPTION "Intel(R) PRO/Wireless 2200/2915 Network Driver" -#define DRV_COPYRIGHT "Copyright(c) 2003-2006 Intel Corporation" -#define DRV_VERSION IPW2200_VERSION - -#define ETH_P_80211_STATS (ETH_P_80211_RAW + 1) - -MODULE_DESCRIPTION(DRV_DESCRIPTION); -MODULE_VERSION(DRV_VERSION); -MODULE_AUTHOR(DRV_COPYRIGHT); -MODULE_LICENSE("GPL"); -MODULE_FIRMWARE("ipw2200-ibss.fw"); -#ifdef CONFIG_IPW2200_MONITOR -MODULE_FIRMWARE("ipw2200-sniffer.fw"); -#endif -MODULE_FIRMWARE("ipw2200-bss.fw"); - -static int cmdlog = 0; -static int debug = 0; -static int default_channel = 0; -static int network_mode = 0; - -static u32 ipw_debug_level; -static int associate; -static int auto_create = 1; -static int led_support = 1; -static int disable = 0; -static int bt_coexist = 0; -static int hwcrypto = 0; -static int roaming = 1; -static const char ipw_modes[] = { - 'a', 'b', 'g', '?' -}; -static int antenna = CFG_SYS_ANTENNA_BOTH; - -#ifdef CONFIG_IPW2200_PROMISCUOUS -static int rtap_iface = 0; /* def: 0 -- do not create rtap interface */ -#endif - -static struct ieee80211_rate ipw2200_rates[] = { - { .bitrate = 10 }, - { .bitrate = 20, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 55, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 110, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 60 }, - { .bitrate = 90 }, - { .bitrate = 120 }, - { .bitrate = 180 }, - { .bitrate = 240 }, - { .bitrate = 360 }, - { .bitrate = 480 }, - { .bitrate = 540 } -}; - -#define ipw2200_a_rates (ipw2200_rates + 4) -#define ipw2200_num_a_rates 8 -#define ipw2200_bg_rates (ipw2200_rates + 0) -#define ipw2200_num_bg_rates 12 - -/* Ugly macro to convert literal channel numbers into their mhz equivalents - * There are certianly some conditions that will break this (like feeding it '30') - * but they shouldn't arise since nothing talks on channel 30. */ -#define ieee80211chan2mhz(x) \ - (((x) <= 14) ? \ - (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \ - ((x) + 1000) * 5) - -#ifdef CONFIG_IPW2200_QOS -static int qos_enable = 0; -static int qos_burst_enable = 0; -static int qos_no_ack_mask = 0; -static int burst_duration_CCK = 0; -static int burst_duration_OFDM = 0; - -static struct libipw_qos_parameters def_qos_parameters_OFDM = { - {QOS_TX0_CW_MIN_OFDM, QOS_TX1_CW_MIN_OFDM, QOS_TX2_CW_MIN_OFDM, - QOS_TX3_CW_MIN_OFDM}, - {QOS_TX0_CW_MAX_OFDM, QOS_TX1_CW_MAX_OFDM, QOS_TX2_CW_MAX_OFDM, - QOS_TX3_CW_MAX_OFDM}, - {QOS_TX0_AIFS, QOS_TX1_AIFS, QOS_TX2_AIFS, QOS_TX3_AIFS}, - {QOS_TX0_ACM, QOS_TX1_ACM, QOS_TX2_ACM, QOS_TX3_ACM}, - {QOS_TX0_TXOP_LIMIT_OFDM, QOS_TX1_TXOP_LIMIT_OFDM, - QOS_TX2_TXOP_LIMIT_OFDM, QOS_TX3_TXOP_LIMIT_OFDM} -}; - -static struct libipw_qos_parameters def_qos_parameters_CCK = { - {QOS_TX0_CW_MIN_CCK, QOS_TX1_CW_MIN_CCK, QOS_TX2_CW_MIN_CCK, - QOS_TX3_CW_MIN_CCK}, - {QOS_TX0_CW_MAX_CCK, QOS_TX1_CW_MAX_CCK, QOS_TX2_CW_MAX_CCK, - QOS_TX3_CW_MAX_CCK}, - {QOS_TX0_AIFS, QOS_TX1_AIFS, QOS_TX2_AIFS, QOS_TX3_AIFS}, - {QOS_TX0_ACM, QOS_TX1_ACM, QOS_TX2_ACM, QOS_TX3_ACM}, - {QOS_TX0_TXOP_LIMIT_CCK, QOS_TX1_TXOP_LIMIT_CCK, QOS_TX2_TXOP_LIMIT_CCK, - QOS_TX3_TXOP_LIMIT_CCK} -}; - -static struct libipw_qos_parameters def_parameters_OFDM = { - {DEF_TX0_CW_MIN_OFDM, DEF_TX1_CW_MIN_OFDM, DEF_TX2_CW_MIN_OFDM, - DEF_TX3_CW_MIN_OFDM}, - {DEF_TX0_CW_MAX_OFDM, DEF_TX1_CW_MAX_OFDM, DEF_TX2_CW_MAX_OFDM, - DEF_TX3_CW_MAX_OFDM}, - {DEF_TX0_AIFS, DEF_TX1_AIFS, DEF_TX2_AIFS, DEF_TX3_AIFS}, - {DEF_TX0_ACM, DEF_TX1_ACM, DEF_TX2_ACM, DEF_TX3_ACM}, - {DEF_TX0_TXOP_LIMIT_OFDM, DEF_TX1_TXOP_LIMIT_OFDM, - DEF_TX2_TXOP_LIMIT_OFDM, DEF_TX3_TXOP_LIMIT_OFDM} -}; - -static struct libipw_qos_parameters def_parameters_CCK = { - {DEF_TX0_CW_MIN_CCK, DEF_TX1_CW_MIN_CCK, DEF_TX2_CW_MIN_CCK, - DEF_TX3_CW_MIN_CCK}, - {DEF_TX0_CW_MAX_CCK, DEF_TX1_CW_MAX_CCK, DEF_TX2_CW_MAX_CCK, - DEF_TX3_CW_MAX_CCK}, - {DEF_TX0_AIFS, DEF_TX1_AIFS, DEF_TX2_AIFS, DEF_TX3_AIFS}, - {DEF_TX0_ACM, DEF_TX1_ACM, DEF_TX2_ACM, DEF_TX3_ACM}, - {DEF_TX0_TXOP_LIMIT_CCK, DEF_TX1_TXOP_LIMIT_CCK, DEF_TX2_TXOP_LIMIT_CCK, - DEF_TX3_TXOP_LIMIT_CCK} -}; - -static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; - -static int from_priority_to_tx_queue[] = { - IPW_TX_QUEUE_1, IPW_TX_QUEUE_2, IPW_TX_QUEUE_2, IPW_TX_QUEUE_1, - IPW_TX_QUEUE_3, IPW_TX_QUEUE_3, IPW_TX_QUEUE_4, IPW_TX_QUEUE_4 -}; - -static u32 ipw_qos_get_burst_duration(struct ipw_priv *priv); - -static int ipw_send_qos_params_command(struct ipw_priv *priv, struct libipw_qos_parameters - *qos_param); -static int ipw_send_qos_info_command(struct ipw_priv *priv, struct libipw_qos_information_element - *qos_param); -#endif /* CONFIG_IPW2200_QOS */ - -static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev); -static void ipw_remove_current_network(struct ipw_priv *priv); -static void ipw_rx(struct ipw_priv *priv); -static int ipw_queue_tx_reclaim(struct ipw_priv *priv, - struct clx2_tx_queue *txq, int qindex); -static int ipw_queue_reset(struct ipw_priv *priv); - -static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf, - int len, int sync); - -static void ipw_tx_queue_free(struct ipw_priv *); - -static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *); -static void ipw_rx_queue_free(struct ipw_priv *, struct ipw_rx_queue *); -static void ipw_rx_queue_replenish(void *); -static int ipw_up(struct ipw_priv *); -static void ipw_bg_up(struct work_struct *work); -static void ipw_down(struct ipw_priv *); -static void ipw_bg_down(struct work_struct *work); -static int ipw_config(struct ipw_priv *); -static int init_supported_rates(struct ipw_priv *priv, - struct ipw_supported_rates *prates); -static void ipw_set_hwcrypto_keys(struct ipw_priv *); -static void ipw_send_wep_keys(struct ipw_priv *, int); - -static int snprint_line(char *buf, size_t count, - const u8 * data, u32 len, u32 ofs) -{ - int out, i, j, l; - char c; - - out = snprintf(buf, count, "%08X", ofs); - - for (l = 0, i = 0; i < 2; i++) { - out += snprintf(buf + out, count - out, " "); - for (j = 0; j < 8 && l < len; j++, l++) - out += snprintf(buf + out, count - out, "%02X ", - data[(i * 8 + j)]); - for (; j < 8; j++) - out += snprintf(buf + out, count - out, " "); - } - - out += snprintf(buf + out, count - out, " "); - for (l = 0, i = 0; i < 2; i++) { - out += snprintf(buf + out, count - out, " "); - for (j = 0; j < 8 && l < len; j++, l++) { - c = data[(i * 8 + j)]; - if (!isascii(c) || !isprint(c)) - c = '.'; - - out += snprintf(buf + out, count - out, "%c", c); - } - - for (; j < 8; j++) - out += snprintf(buf + out, count - out, " "); - } - - return out; -} - -static void printk_buf(int level, const u8 * data, u32 len) -{ - char line[81]; - u32 ofs = 0; - if (!(ipw_debug_level & level)) - return; - - while (len) { - snprint_line(line, sizeof(line), &data[ofs], - min(len, 16U), ofs); - printk(KERN_DEBUG "%s\n", line); - ofs += 16; - len -= min(len, 16U); - } -} - -static int snprintk_buf(u8 * output, size_t size, const u8 * data, size_t len) -{ - size_t out = size; - u32 ofs = 0; - int total = 0; - - while (size && len) { - out = snprint_line(output, size, &data[ofs], - min_t(size_t, len, 16U), ofs); - - ofs += 16; - output += out; - size -= out; - len -= min_t(size_t, len, 16U); - total += out; - } - return total; -} - -/* alias for 32-bit indirect read (for SRAM/reg above 4K), with debug wrapper */ -static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg); -#define ipw_read_reg32(a, b) _ipw_read_reg32(a, b) - -/* alias for 8-bit indirect read (for SRAM/reg above 4K), with debug wrapper */ -static u8 _ipw_read_reg8(struct ipw_priv *ipw, u32 reg); -#define ipw_read_reg8(a, b) _ipw_read_reg8(a, b) - -/* 8-bit indirect write (for SRAM/reg above 4K), with debug wrapper */ -static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value); -static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) -{ - IPW_DEBUG_IO("%s %d: write_indirect8(0x%08X, 0x%08X)\n", __FILE__, - __LINE__, (u32) (b), (u32) (c)); - _ipw_write_reg8(a, b, c); -} - -/* 16-bit indirect write (for SRAM/reg above 4K), with debug wrapper */ -static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value); -static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) -{ - IPW_DEBUG_IO("%s %d: write_indirect16(0x%08X, 0x%08X)\n", __FILE__, - __LINE__, (u32) (b), (u32) (c)); - _ipw_write_reg16(a, b, c); -} - -/* 32-bit indirect write (for SRAM/reg above 4K), with debug wrapper */ -static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value); -static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) -{ - IPW_DEBUG_IO("%s %d: write_indirect32(0x%08X, 0x%08X)\n", __FILE__, - __LINE__, (u32) (b), (u32) (c)); - _ipw_write_reg32(a, b, c); -} - -/* 8-bit direct write (low 4K) */ -static inline void _ipw_write8(struct ipw_priv *ipw, unsigned long ofs, - u8 val) -{ - writeb(val, ipw->hw_base + ofs); -} - -/* 8-bit direct write (for low 4K of SRAM/regs), with debug wrapper */ -#define ipw_write8(ipw, ofs, val) do { \ - IPW_DEBUG_IO("%s %d: write_direct8(0x%08X, 0x%08X)\n", __FILE__, \ - __LINE__, (u32)(ofs), (u32)(val)); \ - _ipw_write8(ipw, ofs, val); \ -} while (0) - -/* 16-bit direct write (low 4K) */ -static inline void _ipw_write16(struct ipw_priv *ipw, unsigned long ofs, - u16 val) -{ - writew(val, ipw->hw_base + ofs); -} - -/* 16-bit direct write (for low 4K of SRAM/regs), with debug wrapper */ -#define ipw_write16(ipw, ofs, val) do { \ - IPW_DEBUG_IO("%s %d: write_direct16(0x%08X, 0x%08X)\n", __FILE__, \ - __LINE__, (u32)(ofs), (u32)(val)); \ - _ipw_write16(ipw, ofs, val); \ -} while (0) - -/* 32-bit direct write (low 4K) */ -static inline void _ipw_write32(struct ipw_priv *ipw, unsigned long ofs, - u32 val) -{ - writel(val, ipw->hw_base + ofs); -} - -/* 32-bit direct write (for low 4K of SRAM/regs), with debug wrapper */ -#define ipw_write32(ipw, ofs, val) do { \ - IPW_DEBUG_IO("%s %d: write_direct32(0x%08X, 0x%08X)\n", __FILE__, \ - __LINE__, (u32)(ofs), (u32)(val)); \ - _ipw_write32(ipw, ofs, val); \ -} while (0) - -/* 8-bit direct read (low 4K) */ -static inline u8 _ipw_read8(struct ipw_priv *ipw, unsigned long ofs) -{ - return readb(ipw->hw_base + ofs); -} - -/* alias to 8-bit direct read (low 4K of SRAM/regs), with debug wrapper */ -#define ipw_read8(ipw, ofs) ({ \ - IPW_DEBUG_IO("%s %d: read_direct8(0x%08X)\n", __FILE__, __LINE__, \ - (u32)(ofs)); \ - _ipw_read8(ipw, ofs); \ -}) - -/* 16-bit direct read (low 4K) */ -static inline u16 _ipw_read16(struct ipw_priv *ipw, unsigned long ofs) -{ - return readw(ipw->hw_base + ofs); -} - -/* alias to 16-bit direct read (low 4K of SRAM/regs), with debug wrapper */ -#define ipw_read16(ipw, ofs) ({ \ - IPW_DEBUG_IO("%s %d: read_direct16(0x%08X)\n", __FILE__, __LINE__, \ - (u32)(ofs)); \ - _ipw_read16(ipw, ofs); \ -}) - -/* 32-bit direct read (low 4K) */ -static inline u32 _ipw_read32(struct ipw_priv *ipw, unsigned long ofs) -{ - return readl(ipw->hw_base + ofs); -} - -/* alias to 32-bit direct read (low 4K of SRAM/regs), with debug wrapper */ -#define ipw_read32(ipw, ofs) ({ \ - IPW_DEBUG_IO("%s %d: read_direct32(0x%08X)\n", __FILE__, __LINE__, \ - (u32)(ofs)); \ - _ipw_read32(ipw, ofs); \ -}) - -static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); -/* alias to multi-byte read (SRAM/regs above 4K), with debug wrapper */ -#define ipw_read_indirect(a, b, c, d) ({ \ - IPW_DEBUG_IO("%s %d: read_indirect(0x%08X) %u bytes\n", __FILE__, \ - __LINE__, (u32)(b), (u32)(d)); \ - _ipw_read_indirect(a, b, c, d); \ -}) - -/* alias to multi-byte read (SRAM/regs above 4K), with debug wrapper */ -static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, - int num); -#define ipw_write_indirect(a, b, c, d) do { \ - IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %u bytes\n", __FILE__, \ - __LINE__, (u32)(b), (u32)(d)); \ - _ipw_write_indirect(a, b, c, d); \ -} while (0) - -/* 32-bit indirect write (above 4K) */ -static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) -{ - IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value); - _ipw_write32(priv, IPW_INDIRECT_ADDR, reg); - _ipw_write32(priv, IPW_INDIRECT_DATA, value); -} - -/* 8-bit indirect write (above 4K) */ -static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) -{ - u32 aligned_addr = reg & IPW_INDIRECT_ADDR_MASK; /* dword align */ - u32 dif_len = reg - aligned_addr; - - IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); - _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); - _ipw_write8(priv, IPW_INDIRECT_DATA + dif_len, value); -} - -/* 16-bit indirect write (above 4K) */ -static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) -{ - u32 aligned_addr = reg & IPW_INDIRECT_ADDR_MASK; /* dword align */ - u32 dif_len = (reg - aligned_addr) & (~0x1ul); - - IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); - _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); - _ipw_write16(priv, IPW_INDIRECT_DATA + dif_len, value); -} - -/* 8-bit indirect read (above 4K) */ -static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) -{ - u32 word; - _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); - IPW_DEBUG_IO(" reg = 0x%8X :\n", reg); - word = _ipw_read32(priv, IPW_INDIRECT_DATA); - return (word >> ((reg & 0x3) * 8)) & 0xff; -} - -/* 32-bit indirect read (above 4K) */ -static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) -{ - u32 value; - - IPW_DEBUG_IO("%p : reg = 0x%08x\n", priv, reg); - - _ipw_write32(priv, IPW_INDIRECT_ADDR, reg); - value = _ipw_read32(priv, IPW_INDIRECT_DATA); - IPW_DEBUG_IO(" reg = 0x%4X : value = 0x%4x\n", reg, value); - return value; -} - -/* General purpose, no alignment requirement, iterative (multi-byte) read, */ -/* for area above 1st 4K of SRAM/reg space */ -static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, - int num) -{ - u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; /* dword align */ - u32 dif_len = addr - aligned_addr; - u32 i; - - IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); - - if (num <= 0) { - return; - } - - /* Read the first dword (or portion) byte by byte */ - if (unlikely(dif_len)) { - _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); - /* Start reading at aligned_addr + dif_len */ - for (i = dif_len; ((i < 4) && (num > 0)); i++, num--) - *buf++ = _ipw_read8(priv, IPW_INDIRECT_DATA + i); - aligned_addr += 4; - } - - /* Read all of the middle dwords as dwords, with auto-increment */ - _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); - for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) - *(u32 *) buf = _ipw_read32(priv, IPW_AUTOINC_DATA); - - /* Read the last dword (or portion) byte by byte */ - if (unlikely(num)) { - _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); - for (i = 0; num > 0; i++, num--) - *buf++ = ipw_read8(priv, IPW_INDIRECT_DATA + i); - } -} - -/* General purpose, no alignment requirement, iterative (multi-byte) write, */ -/* for area above 1st 4K of SRAM/reg space */ -static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, - int num) -{ - u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; /* dword align */ - u32 dif_len = addr - aligned_addr; - u32 i; - - IPW_DEBUG_IO("addr = %i, buf = %p, num = %i\n", addr, buf, num); - - if (num <= 0) { - return; - } - - /* Write the first dword (or portion) byte by byte */ - if (unlikely(dif_len)) { - _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); - /* Start writing at aligned_addr + dif_len */ - for (i = dif_len; ((i < 4) && (num > 0)); i++, num--, buf++) - _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); - aligned_addr += 4; - } - - /* Write all of the middle dwords as dwords, with auto-increment */ - _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); - for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) - _ipw_write32(priv, IPW_AUTOINC_DATA, *(u32 *) buf); - - /* Write the last dword (or portion) byte by byte */ - if (unlikely(num)) { - _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); - for (i = 0; num > 0; i++, num--, buf++) - _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); - } -} - -/* General purpose, no alignment requirement, iterative (multi-byte) write, */ -/* for 1st 4K of SRAM/regs space */ -static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, - int num) -{ - memcpy_toio((priv->hw_base + addr), buf, num); -} - -/* Set bit(s) in low 4K of SRAM/regs */ -static inline void ipw_set_bit(struct ipw_priv *priv, u32 reg, u32 mask) -{ - ipw_write32(priv, reg, ipw_read32(priv, reg) | mask); -} - -/* Clear bit(s) in low 4K of SRAM/regs */ -static inline void ipw_clear_bit(struct ipw_priv *priv, u32 reg, u32 mask) -{ - ipw_write32(priv, reg, ipw_read32(priv, reg) & ~mask); -} - -static inline void __ipw_enable_interrupts(struct ipw_priv *priv) -{ - if (priv->status & STATUS_INT_ENABLED) - return; - priv->status |= STATUS_INT_ENABLED; - ipw_write32(priv, IPW_INTA_MASK_R, IPW_INTA_MASK_ALL); -} - -static inline void __ipw_disable_interrupts(struct ipw_priv *priv) -{ - if (!(priv->status & STATUS_INT_ENABLED)) - return; - priv->status &= ~STATUS_INT_ENABLED; - ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); -} - -static inline void ipw_enable_interrupts(struct ipw_priv *priv) -{ - unsigned long flags; - - spin_lock_irqsave(&priv->irq_lock, flags); - __ipw_enable_interrupts(priv); - spin_unlock_irqrestore(&priv->irq_lock, flags); -} - -static inline void ipw_disable_interrupts(struct ipw_priv *priv) -{ - unsigned long flags; - - spin_lock_irqsave(&priv->irq_lock, flags); - __ipw_disable_interrupts(priv); - spin_unlock_irqrestore(&priv->irq_lock, flags); -} - -static char *ipw_error_desc(u32 val) -{ - switch (val) { - case IPW_FW_ERROR_OK: - return "ERROR_OK"; - case IPW_FW_ERROR_FAIL: - return "ERROR_FAIL"; - case IPW_FW_ERROR_MEMORY_UNDERFLOW: - return "MEMORY_UNDERFLOW"; - case IPW_FW_ERROR_MEMORY_OVERFLOW: - return "MEMORY_OVERFLOW"; - case IPW_FW_ERROR_BAD_PARAM: - return "BAD_PARAM"; - case IPW_FW_ERROR_BAD_CHECKSUM: - return "BAD_CHECKSUM"; - case IPW_FW_ERROR_NMI_INTERRUPT: - return "NMI_INTERRUPT"; - case IPW_FW_ERROR_BAD_DATABASE: - return "BAD_DATABASE"; - case IPW_FW_ERROR_ALLOC_FAIL: - return "ALLOC_FAIL"; - case IPW_FW_ERROR_DMA_UNDERRUN: - return "DMA_UNDERRUN"; - case IPW_FW_ERROR_DMA_STATUS: - return "DMA_STATUS"; - case IPW_FW_ERROR_DINO_ERROR: - return "DINO_ERROR"; - case IPW_FW_ERROR_EEPROM_ERROR: - return "EEPROM_ERROR"; - case IPW_FW_ERROR_SYSASSERT: - return "SYSASSERT"; - case IPW_FW_ERROR_FATAL_ERROR: - return "FATAL_ERROR"; - default: - return "UNKNOWN_ERROR"; - } -} - -static void ipw_dump_error_log(struct ipw_priv *priv, - struct ipw_fw_error *error) -{ - u32 i; - - if (!error) { - IPW_ERROR("Error allocating and capturing error log. " - "Nothing to dump.\n"); - return; - } - - IPW_ERROR("Start IPW Error Log Dump:\n"); - IPW_ERROR("Status: 0x%08X, Config: %08X\n", - error->status, error->config); - - for (i = 0; i < error->elem_len; i++) - IPW_ERROR("%s %i 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", - ipw_error_desc(error->elem[i].desc), - error->elem[i].time, - error->elem[i].blink1, - error->elem[i].blink2, - error->elem[i].link1, - error->elem[i].link2, error->elem[i].data); - for (i = 0; i < error->log_len; i++) - IPW_ERROR("%i\t0x%08x\t%i\n", - error->log[i].time, - error->log[i].data, error->log[i].event); -} - -static inline int ipw_is_init(struct ipw_priv *priv) -{ - return (priv->status & STATUS_INIT) ? 1 : 0; -} - -static int ipw_get_ordinal(struct ipw_priv *priv, u32 ord, void *val, u32 * len) -{ - u32 addr, field_info, field_len, field_count, total_len; - - IPW_DEBUG_ORD("ordinal = %i\n", ord); - - if (!priv || !val || !len) { - IPW_DEBUG_ORD("Invalid argument\n"); - return -EINVAL; - } - - /* verify device ordinal tables have been initialized */ - if (!priv->table0_addr || !priv->table1_addr || !priv->table2_addr) { - IPW_DEBUG_ORD("Access ordinals before initialization\n"); - return -EINVAL; - } - - switch (IPW_ORD_TABLE_ID_MASK & ord) { - case IPW_ORD_TABLE_0_MASK: - /* - * TABLE 0: Direct access to a table of 32 bit values - * - * This is a very simple table with the data directly - * read from the table - */ - - /* remove the table id from the ordinal */ - ord &= IPW_ORD_TABLE_VALUE_MASK; - - /* boundary check */ - if (ord > priv->table0_len) { - IPW_DEBUG_ORD("ordinal value (%i) longer then " - "max (%i)\n", ord, priv->table0_len); - return -EINVAL; - } - - /* verify we have enough room to store the value */ - if (*len < sizeof(u32)) { - IPW_DEBUG_ORD("ordinal buffer length too small, " - "need %zd\n", sizeof(u32)); - return -EINVAL; - } - - IPW_DEBUG_ORD("Reading TABLE0[%i] from offset 0x%08x\n", - ord, priv->table0_addr + (ord << 2)); - - *len = sizeof(u32); - ord <<= 2; - *((u32 *) val) = ipw_read32(priv, priv->table0_addr + ord); - break; - - case IPW_ORD_TABLE_1_MASK: - /* - * TABLE 1: Indirect access to a table of 32 bit values - * - * This is a fairly large table of u32 values each - * representing starting addr for the data (which is - * also a u32) - */ - - /* remove the table id from the ordinal */ - ord &= IPW_ORD_TABLE_VALUE_MASK; - - /* boundary check */ - if (ord > priv->table1_len) { - IPW_DEBUG_ORD("ordinal value too long\n"); - return -EINVAL; - } - - /* verify we have enough room to store the value */ - if (*len < sizeof(u32)) { - IPW_DEBUG_ORD("ordinal buffer length too small, " - "need %zd\n", sizeof(u32)); - return -EINVAL; - } - - *((u32 *) val) = - ipw_read_reg32(priv, (priv->table1_addr + (ord << 2))); - *len = sizeof(u32); - break; - - case IPW_ORD_TABLE_2_MASK: - /* - * TABLE 2: Indirect access to a table of variable sized values - * - * This table consist of six values, each containing - * - dword containing the starting offset of the data - * - dword containing the lengh in the first 16bits - * and the count in the second 16bits - */ - - /* remove the table id from the ordinal */ - ord &= IPW_ORD_TABLE_VALUE_MASK; - - /* boundary check */ - if (ord > priv->table2_len) { - IPW_DEBUG_ORD("ordinal value too long\n"); - return -EINVAL; - } - - /* get the address of statistic */ - addr = ipw_read_reg32(priv, priv->table2_addr + (ord << 3)); - - /* get the second DW of statistics ; - * two 16-bit words - first is length, second is count */ - field_info = - ipw_read_reg32(priv, - priv->table2_addr + (ord << 3) + - sizeof(u32)); - - /* get each entry length */ - field_len = *((u16 *) & field_info); - - /* get number of entries */ - field_count = *(((u16 *) & field_info) + 1); - - /* abort if not enough memory */ - total_len = field_len * field_count; - if (total_len > *len) { - *len = total_len; - return -EINVAL; - } - - *len = total_len; - if (!total_len) - return 0; - - IPW_DEBUG_ORD("addr = 0x%08x, total_len = %i, " - "field_info = 0x%08x\n", - addr, total_len, field_info); - ipw_read_indirect(priv, addr, val, total_len); - break; - - default: - IPW_DEBUG_ORD("Invalid ordinal!\n"); - return -EINVAL; - - } - - return 0; -} - -static void ipw_init_ordinals(struct ipw_priv *priv) -{ - priv->table0_addr = IPW_ORDINALS_TABLE_LOWER; - priv->table0_len = ipw_read32(priv, priv->table0_addr); - - IPW_DEBUG_ORD("table 0 offset at 0x%08x, len = %i\n", - priv->table0_addr, priv->table0_len); - - priv->table1_addr = ipw_read32(priv, IPW_ORDINALS_TABLE_1); - priv->table1_len = ipw_read_reg32(priv, priv->table1_addr); - - IPW_DEBUG_ORD("table 1 offset at 0x%08x, len = %i\n", - priv->table1_addr, priv->table1_len); - - priv->table2_addr = ipw_read32(priv, IPW_ORDINALS_TABLE_2); - priv->table2_len = ipw_read_reg32(priv, priv->table2_addr); - priv->table2_len &= 0x0000ffff; /* use first two bytes */ - - IPW_DEBUG_ORD("table 2 offset at 0x%08x, len = %i\n", - priv->table2_addr, priv->table2_len); - -} - -static u32 ipw_register_toggle(u32 reg) -{ - reg &= ~IPW_START_STANDBY; - if (reg & IPW_GATE_ODMA) - reg &= ~IPW_GATE_ODMA; - if (reg & IPW_GATE_IDMA) - reg &= ~IPW_GATE_IDMA; - if (reg & IPW_GATE_ADMA) - reg &= ~IPW_GATE_ADMA; - return reg; -} - -/* - * LED behavior: - * - On radio ON, turn on any LEDs that require to be on during start - * - On initialization, start unassociated blink - * - On association, disable unassociated blink - * - On disassociation, start unassociated blink - * - On radio OFF, turn off any LEDs started during radio on - * - */ -#define LD_TIME_LINK_ON msecs_to_jiffies(300) -#define LD_TIME_LINK_OFF msecs_to_jiffies(2700) -#define LD_TIME_ACT_ON msecs_to_jiffies(250) - -static void ipw_led_link_on(struct ipw_priv *priv) -{ - unsigned long flags; - u32 led; - - /* If configured to not use LEDs, or nic_type is 1, - * then we don't toggle a LINK led */ - if (priv->config & CFG_NO_LED || priv->nic_type == EEPROM_NIC_TYPE_1) - return; - - spin_lock_irqsave(&priv->lock, flags); - - if (!(priv->status & STATUS_RF_KILL_MASK) && - !(priv->status & STATUS_LED_LINK_ON)) { - IPW_DEBUG_LED("Link LED On\n"); - led = ipw_read_reg32(priv, IPW_EVENT_REG); - led |= priv->led_association_on; - - led = ipw_register_toggle(led); - - IPW_DEBUG_LED("Reg: 0x%08X\n", led); - ipw_write_reg32(priv, IPW_EVENT_REG, led); - - priv->status |= STATUS_LED_LINK_ON; - - /* If we aren't associated, schedule turning the LED off */ - if (!(priv->status & STATUS_ASSOCIATED)) - schedule_delayed_work(&priv->led_link_off, - LD_TIME_LINK_ON); - } - - spin_unlock_irqrestore(&priv->lock, flags); -} - -static void ipw_bg_led_link_on(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, led_link_on.work); - mutex_lock(&priv->mutex); - ipw_led_link_on(priv); - mutex_unlock(&priv->mutex); -} - -static void ipw_led_link_off(struct ipw_priv *priv) -{ - unsigned long flags; - u32 led; - - /* If configured not to use LEDs, or nic type is 1, - * then we don't goggle the LINK led. */ - if (priv->config & CFG_NO_LED || priv->nic_type == EEPROM_NIC_TYPE_1) - return; - - spin_lock_irqsave(&priv->lock, flags); - - if (priv->status & STATUS_LED_LINK_ON) { - led = ipw_read_reg32(priv, IPW_EVENT_REG); - led &= priv->led_association_off; - led = ipw_register_toggle(led); - - IPW_DEBUG_LED("Reg: 0x%08X\n", led); - ipw_write_reg32(priv, IPW_EVENT_REG, led); - - IPW_DEBUG_LED("Link LED Off\n"); - - priv->status &= ~STATUS_LED_LINK_ON; - - /* If we aren't associated and the radio is on, schedule - * turning the LED on (blink while unassociated) */ - if (!(priv->status & STATUS_RF_KILL_MASK) && - !(priv->status & STATUS_ASSOCIATED)) - schedule_delayed_work(&priv->led_link_on, - LD_TIME_LINK_OFF); - - } - - spin_unlock_irqrestore(&priv->lock, flags); -} - -static void ipw_bg_led_link_off(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, led_link_off.work); - mutex_lock(&priv->mutex); - ipw_led_link_off(priv); - mutex_unlock(&priv->mutex); -} - -static void __ipw_led_activity_on(struct ipw_priv *priv) -{ - u32 led; - - if (priv->config & CFG_NO_LED) - return; - - if (priv->status & STATUS_RF_KILL_MASK) - return; - - if (!(priv->status & STATUS_LED_ACT_ON)) { - led = ipw_read_reg32(priv, IPW_EVENT_REG); - led |= priv->led_activity_on; - - led = ipw_register_toggle(led); - - IPW_DEBUG_LED("Reg: 0x%08X\n", led); - ipw_write_reg32(priv, IPW_EVENT_REG, led); - - IPW_DEBUG_LED("Activity LED On\n"); - - priv->status |= STATUS_LED_ACT_ON; - - cancel_delayed_work(&priv->led_act_off); - schedule_delayed_work(&priv->led_act_off, LD_TIME_ACT_ON); - } else { - /* Reschedule LED off for full time period */ - cancel_delayed_work(&priv->led_act_off); - schedule_delayed_work(&priv->led_act_off, LD_TIME_ACT_ON); - } -} - -#if 0 -void ipw_led_activity_on(struct ipw_priv *priv) -{ - unsigned long flags; - spin_lock_irqsave(&priv->lock, flags); - __ipw_led_activity_on(priv); - spin_unlock_irqrestore(&priv->lock, flags); -} -#endif /* 0 */ - -static void ipw_led_activity_off(struct ipw_priv *priv) -{ - unsigned long flags; - u32 led; - - if (priv->config & CFG_NO_LED) - return; - - spin_lock_irqsave(&priv->lock, flags); - - if (priv->status & STATUS_LED_ACT_ON) { - led = ipw_read_reg32(priv, IPW_EVENT_REG); - led &= priv->led_activity_off; - - led = ipw_register_toggle(led); - - IPW_DEBUG_LED("Reg: 0x%08X\n", led); - ipw_write_reg32(priv, IPW_EVENT_REG, led); - - IPW_DEBUG_LED("Activity LED Off\n"); - - priv->status &= ~STATUS_LED_ACT_ON; - } - - spin_unlock_irqrestore(&priv->lock, flags); -} - -static void ipw_bg_led_activity_off(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, led_act_off.work); - mutex_lock(&priv->mutex); - ipw_led_activity_off(priv); - mutex_unlock(&priv->mutex); -} - -static void ipw_led_band_on(struct ipw_priv *priv) -{ - unsigned long flags; - u32 led; - - /* Only nic type 1 supports mode LEDs */ - if (priv->config & CFG_NO_LED || - priv->nic_type != EEPROM_NIC_TYPE_1 || !priv->assoc_network) - return; - - spin_lock_irqsave(&priv->lock, flags); - - led = ipw_read_reg32(priv, IPW_EVENT_REG); - if (priv->assoc_network->mode == IEEE_A) { - led |= priv->led_ofdm_on; - led &= priv->led_association_off; - IPW_DEBUG_LED("Mode LED On: 802.11a\n"); - } else if (priv->assoc_network->mode == IEEE_G) { - led |= priv->led_ofdm_on; - led |= priv->led_association_on; - IPW_DEBUG_LED("Mode LED On: 802.11g\n"); - } else { - led &= priv->led_ofdm_off; - led |= priv->led_association_on; - IPW_DEBUG_LED("Mode LED On: 802.11b\n"); - } - - led = ipw_register_toggle(led); - - IPW_DEBUG_LED("Reg: 0x%08X\n", led); - ipw_write_reg32(priv, IPW_EVENT_REG, led); - - spin_unlock_irqrestore(&priv->lock, flags); -} - -static void ipw_led_band_off(struct ipw_priv *priv) -{ - unsigned long flags; - u32 led; - - /* Only nic type 1 supports mode LEDs */ - if (priv->config & CFG_NO_LED || priv->nic_type != EEPROM_NIC_TYPE_1) - return; - - spin_lock_irqsave(&priv->lock, flags); - - led = ipw_read_reg32(priv, IPW_EVENT_REG); - led &= priv->led_ofdm_off; - led &= priv->led_association_off; - - led = ipw_register_toggle(led); - - IPW_DEBUG_LED("Reg: 0x%08X\n", led); - ipw_write_reg32(priv, IPW_EVENT_REG, led); - - spin_unlock_irqrestore(&priv->lock, flags); -} - -static void ipw_led_radio_on(struct ipw_priv *priv) -{ - ipw_led_link_on(priv); -} - -static void ipw_led_radio_off(struct ipw_priv *priv) -{ - ipw_led_activity_off(priv); - ipw_led_link_off(priv); -} - -static void ipw_led_link_up(struct ipw_priv *priv) -{ - /* Set the Link Led on for all nic types */ - ipw_led_link_on(priv); -} - -static void ipw_led_link_down(struct ipw_priv *priv) -{ - ipw_led_activity_off(priv); - ipw_led_link_off(priv); - - if (priv->status & STATUS_RF_KILL_MASK) - ipw_led_radio_off(priv); -} - -static void ipw_led_init(struct ipw_priv *priv) -{ - priv->nic_type = priv->eeprom[EEPROM_NIC_TYPE]; - - /* Set the default PINs for the link and activity leds */ - priv->led_activity_on = IPW_ACTIVITY_LED; - priv->led_activity_off = ~(IPW_ACTIVITY_LED); - - priv->led_association_on = IPW_ASSOCIATED_LED; - priv->led_association_off = ~(IPW_ASSOCIATED_LED); - - /* Set the default PINs for the OFDM leds */ - priv->led_ofdm_on = IPW_OFDM_LED; - priv->led_ofdm_off = ~(IPW_OFDM_LED); - - switch (priv->nic_type) { - case EEPROM_NIC_TYPE_1: - /* In this NIC type, the LEDs are reversed.... */ - priv->led_activity_on = IPW_ASSOCIATED_LED; - priv->led_activity_off = ~(IPW_ASSOCIATED_LED); - priv->led_association_on = IPW_ACTIVITY_LED; - priv->led_association_off = ~(IPW_ACTIVITY_LED); - - if (!(priv->config & CFG_NO_LED)) - ipw_led_band_on(priv); - - /* And we don't blink link LEDs for this nic, so - * just return here */ - return; - - case EEPROM_NIC_TYPE_3: - case EEPROM_NIC_TYPE_2: - case EEPROM_NIC_TYPE_4: - case EEPROM_NIC_TYPE_0: - break; - - default: - IPW_DEBUG_INFO("Unknown NIC type from EEPROM: %d\n", - priv->nic_type); - priv->nic_type = EEPROM_NIC_TYPE_0; - break; - } - - if (!(priv->config & CFG_NO_LED)) { - if (priv->status & STATUS_ASSOCIATED) - ipw_led_link_on(priv); - else - ipw_led_link_off(priv); - } -} - -static void ipw_led_shutdown(struct ipw_priv *priv) -{ - ipw_led_activity_off(priv); - ipw_led_link_off(priv); - ipw_led_band_off(priv); - cancel_delayed_work(&priv->led_link_on); - cancel_delayed_work(&priv->led_link_off); - cancel_delayed_work(&priv->led_act_off); -} - -/* - * The following adds a new attribute to the sysfs representation - * of this device driver (i.e. a new file in /sys/bus/pci/drivers/ipw/) - * used for controlling the debug level. - * - * See the level definitions in ipw for details. - */ -static ssize_t show_debug_level(struct device_driver *d, char *buf) -{ - return sprintf(buf, "0x%08X\n", ipw_debug_level); -} - -static ssize_t store_debug_level(struct device_driver *d, const char *buf, - size_t count) -{ - char *p = (char *)buf; - u32 val; - - if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') { - p++; - if (p[0] == 'x' || p[0] == 'X') - p++; - val = simple_strtoul(p, &p, 16); - } else - val = simple_strtoul(p, &p, 10); - if (p == buf) - printk(KERN_INFO DRV_NAME - ": %s is not in hex or decimal form.\n", buf); - else - ipw_debug_level = val; - - return strnlen(buf, count); -} - -static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, - show_debug_level, store_debug_level); - -static inline u32 ipw_get_event_log_len(struct ipw_priv *priv) -{ - /* length = 1st dword in log */ - return ipw_read_reg32(priv, ipw_read32(priv, IPW_EVENT_LOG)); -} - -static void ipw_capture_event_log(struct ipw_priv *priv, - u32 log_len, struct ipw_event *log) -{ - u32 base; - - if (log_len) { - base = ipw_read32(priv, IPW_EVENT_LOG); - ipw_read_indirect(priv, base + sizeof(base) + sizeof(u32), - (u8 *) log, sizeof(*log) * log_len); - } -} - -static struct ipw_fw_error *ipw_alloc_error_log(struct ipw_priv *priv) -{ - struct ipw_fw_error *error; - u32 log_len = ipw_get_event_log_len(priv); - u32 base = ipw_read32(priv, IPW_ERROR_LOG); - u32 elem_len = ipw_read_reg32(priv, base); - - error = kmalloc(sizeof(*error) + - sizeof(*error->elem) * elem_len + - sizeof(*error->log) * log_len, GFP_ATOMIC); - if (!error) { - IPW_ERROR("Memory allocation for firmware error log " - "failed.\n"); - return NULL; - } - error->jiffies = jiffies; - error->status = priv->status; - error->config = priv->config; - error->elem_len = elem_len; - error->log_len = log_len; - error->elem = (struct ipw_error_elem *)error->payload; - error->log = (struct ipw_event *)(error->elem + elem_len); - - ipw_capture_event_log(priv, log_len, error->log); - - if (elem_len) - ipw_read_indirect(priv, base + sizeof(base), (u8 *) error->elem, - sizeof(*error->elem) * elem_len); - - return error; -} - -static ssize_t show_event_log(struct device *d, - struct device_attribute *attr, char *buf) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - u32 log_len = ipw_get_event_log_len(priv); - u32 log_size; - struct ipw_event *log; - u32 len = 0, i; - - /* not using min() because of its strict type checking */ - log_size = PAGE_SIZE / sizeof(*log) > log_len ? - sizeof(*log) * log_len : PAGE_SIZE; - log = kzalloc(log_size, GFP_KERNEL); - if (!log) { - IPW_ERROR("Unable to allocate memory for log\n"); - return 0; - } - log_len = log_size / sizeof(*log); - ipw_capture_event_log(priv, log_len, log); - - len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); - for (i = 0; i < log_len; i++) - len += snprintf(buf + len, PAGE_SIZE - len, - "\n%08X%08X%08X", - log[i].time, log[i].event, log[i].data); - len += snprintf(buf + len, PAGE_SIZE - len, "\n"); - kfree(log); - return len; -} - -static DEVICE_ATTR(event_log, S_IRUGO, show_event_log, NULL); - -static ssize_t show_error(struct device *d, - struct device_attribute *attr, char *buf) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - u32 len = 0, i; - if (!priv->error) - return 0; - len += snprintf(buf + len, PAGE_SIZE - len, - "%08lX%08X%08X%08X", - priv->error->jiffies, - priv->error->status, - priv->error->config, priv->error->elem_len); - for (i = 0; i < priv->error->elem_len; i++) - len += snprintf(buf + len, PAGE_SIZE - len, - "\n%08X%08X%08X%08X%08X%08X%08X", - priv->error->elem[i].time, - priv->error->elem[i].desc, - priv->error->elem[i].blink1, - priv->error->elem[i].blink2, - priv->error->elem[i].link1, - priv->error->elem[i].link2, - priv->error->elem[i].data); - - len += snprintf(buf + len, PAGE_SIZE - len, - "\n%08X", priv->error->log_len); - for (i = 0; i < priv->error->log_len; i++) - len += snprintf(buf + len, PAGE_SIZE - len, - "\n%08X%08X%08X", - priv->error->log[i].time, - priv->error->log[i].event, - priv->error->log[i].data); - len += snprintf(buf + len, PAGE_SIZE - len, "\n"); - return len; -} - -static ssize_t clear_error(struct device *d, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - - kfree(priv->error); - priv->error = NULL; - return count; -} - -static DEVICE_ATTR(error, S_IRUGO | S_IWUSR, show_error, clear_error); - -static ssize_t show_cmd_log(struct device *d, - struct device_attribute *attr, char *buf) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - u32 len = 0, i; - if (!priv->cmdlog) - return 0; - for (i = (priv->cmdlog_pos + 1) % priv->cmdlog_len; - (i != priv->cmdlog_pos) && (PAGE_SIZE - len); - i = (i + 1) % priv->cmdlog_len) { - len += - snprintf(buf + len, PAGE_SIZE - len, - "\n%08lX%08X%08X%08X\n", priv->cmdlog[i].jiffies, - priv->cmdlog[i].retcode, priv->cmdlog[i].cmd.cmd, - priv->cmdlog[i].cmd.len); - len += - snprintk_buf(buf + len, PAGE_SIZE - len, - (u8 *) priv->cmdlog[i].cmd.param, - priv->cmdlog[i].cmd.len); - len += snprintf(buf + len, PAGE_SIZE - len, "\n"); - } - len += snprintf(buf + len, PAGE_SIZE - len, "\n"); - return len; -} - -static DEVICE_ATTR(cmd_log, S_IRUGO, show_cmd_log, NULL); - -#ifdef CONFIG_IPW2200_PROMISCUOUS -static void ipw_prom_free(struct ipw_priv *priv); -static int ipw_prom_alloc(struct ipw_priv *priv); -static ssize_t store_rtap_iface(struct device *d, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - int rc = 0; - - if (count < 1) - return -EINVAL; - - switch (buf[0]) { - case '0': - if (!rtap_iface) - return count; - - if (netif_running(priv->prom_net_dev)) { - IPW_WARNING("Interface is up. Cannot unregister.\n"); - return count; - } - - ipw_prom_free(priv); - rtap_iface = 0; - break; - - case '1': - if (rtap_iface) - return count; - - rc = ipw_prom_alloc(priv); - if (!rc) - rtap_iface = 1; - break; - - default: - return -EINVAL; - } - - if (rc) { - IPW_ERROR("Failed to register promiscuous network " - "device (error %d).\n", rc); - } - - return count; -} - -static ssize_t show_rtap_iface(struct device *d, - struct device_attribute *attr, - char *buf) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - if (rtap_iface) - return sprintf(buf, "%s", priv->prom_net_dev->name); - else { - buf[0] = '-'; - buf[1] = '1'; - buf[2] = '\0'; - return 3; - } -} - -static DEVICE_ATTR(rtap_iface, S_IWUSR | S_IRUSR, show_rtap_iface, - store_rtap_iface); - -static ssize_t store_rtap_filter(struct device *d, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - - if (!priv->prom_priv) { - IPW_ERROR("Attempting to set filter without " - "rtap_iface enabled.\n"); - return -EPERM; - } - - priv->prom_priv->filter = simple_strtol(buf, NULL, 0); - - IPW_DEBUG_INFO("Setting rtap filter to " BIT_FMT16 "\n", - BIT_ARG16(priv->prom_priv->filter)); - - return count; -} - -static ssize_t show_rtap_filter(struct device *d, - struct device_attribute *attr, - char *buf) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - return sprintf(buf, "0x%04X", - priv->prom_priv ? priv->prom_priv->filter : 0); -} - -static DEVICE_ATTR(rtap_filter, S_IWUSR | S_IRUSR, show_rtap_filter, - store_rtap_filter); -#endif - -static ssize_t show_scan_age(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - return sprintf(buf, "%d\n", priv->ieee->scan_age); -} - -static ssize_t store_scan_age(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - struct net_device *dev = priv->net_dev; - char buffer[] = "00000000"; - unsigned long len = - (sizeof(buffer) - 1) > count ? count : sizeof(buffer) - 1; - unsigned long val; - char *p = buffer; - - IPW_DEBUG_INFO("enter\n"); - - strncpy(buffer, buf, len); - buffer[len] = 0; - - if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') { - p++; - if (p[0] == 'x' || p[0] == 'X') - p++; - val = simple_strtoul(p, &p, 16); - } else - val = simple_strtoul(p, &p, 10); - if (p == buffer) { - IPW_DEBUG_INFO("%s: user supplied invalid value.\n", dev->name); - } else { - priv->ieee->scan_age = val; - IPW_DEBUG_INFO("set scan_age = %u\n", priv->ieee->scan_age); - } - - IPW_DEBUG_INFO("exit\n"); - return len; -} - -static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age); - -static ssize_t show_led(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - return sprintf(buf, "%d\n", (priv->config & CFG_NO_LED) ? 0 : 1); -} - -static ssize_t store_led(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - - IPW_DEBUG_INFO("enter\n"); - - if (count == 0) - return 0; - - if (*buf == 0) { - IPW_DEBUG_LED("Disabling LED control.\n"); - priv->config |= CFG_NO_LED; - ipw_led_shutdown(priv); - } else { - IPW_DEBUG_LED("Enabling LED control.\n"); - priv->config &= ~CFG_NO_LED; - ipw_led_init(priv); - } - - IPW_DEBUG_INFO("exit\n"); - return count; -} - -static DEVICE_ATTR(led, S_IWUSR | S_IRUGO, show_led, store_led); - -static ssize_t show_status(struct device *d, - struct device_attribute *attr, char *buf) -{ - struct ipw_priv *p = dev_get_drvdata(d); - return sprintf(buf, "0x%08x\n", (int)p->status); -} - -static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); - -static ssize_t show_cfg(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw_priv *p = dev_get_drvdata(d); - return sprintf(buf, "0x%08x\n", (int)p->config); -} - -static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL); - -static ssize_t show_nic_type(struct device *d, - struct device_attribute *attr, char *buf) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - return sprintf(buf, "TYPE: %d\n", priv->nic_type); -} - -static DEVICE_ATTR(nic_type, S_IRUGO, show_nic_type, NULL); - -static ssize_t show_ucode_version(struct device *d, - struct device_attribute *attr, char *buf) -{ - u32 len = sizeof(u32), tmp = 0; - struct ipw_priv *p = dev_get_drvdata(d); - - if (ipw_get_ordinal(p, IPW_ORD_STAT_UCODE_VERSION, &tmp, &len)) - return 0; - - return sprintf(buf, "0x%08x\n", tmp); -} - -static DEVICE_ATTR(ucode_version, S_IWUSR | S_IRUGO, show_ucode_version, NULL); - -static ssize_t show_rtc(struct device *d, struct device_attribute *attr, - char *buf) -{ - u32 len = sizeof(u32), tmp = 0; - struct ipw_priv *p = dev_get_drvdata(d); - - if (ipw_get_ordinal(p, IPW_ORD_STAT_RTC, &tmp, &len)) - return 0; - - return sprintf(buf, "0x%08x\n", tmp); -} - -static DEVICE_ATTR(rtc, S_IWUSR | S_IRUGO, show_rtc, NULL); - -/* - * Add a device attribute to view/control the delay between eeprom - * operations. - */ -static ssize_t show_eeprom_delay(struct device *d, - struct device_attribute *attr, char *buf) -{ - struct ipw_priv *p = dev_get_drvdata(d); - int n = p->eeprom_delay; - return sprintf(buf, "%i\n", n); -} -static ssize_t store_eeprom_delay(struct device *d, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw_priv *p = dev_get_drvdata(d); - sscanf(buf, "%i", &p->eeprom_delay); - return strnlen(buf, count); -} - -static DEVICE_ATTR(eeprom_delay, S_IWUSR | S_IRUGO, - show_eeprom_delay, store_eeprom_delay); - -static ssize_t show_command_event_reg(struct device *d, - struct device_attribute *attr, char *buf) -{ - u32 reg = 0; - struct ipw_priv *p = dev_get_drvdata(d); - - reg = ipw_read_reg32(p, IPW_INTERNAL_CMD_EVENT); - return sprintf(buf, "0x%08x\n", reg); -} -static ssize_t store_command_event_reg(struct device *d, - struct device_attribute *attr, - const char *buf, size_t count) -{ - u32 reg; - struct ipw_priv *p = dev_get_drvdata(d); - - sscanf(buf, "%x", ®); - ipw_write_reg32(p, IPW_INTERNAL_CMD_EVENT, reg); - return strnlen(buf, count); -} - -static DEVICE_ATTR(command_event_reg, S_IWUSR | S_IRUGO, - show_command_event_reg, store_command_event_reg); - -static ssize_t show_mem_gpio_reg(struct device *d, - struct device_attribute *attr, char *buf) -{ - u32 reg = 0; - struct ipw_priv *p = dev_get_drvdata(d); - - reg = ipw_read_reg32(p, 0x301100); - return sprintf(buf, "0x%08x\n", reg); -} -static ssize_t store_mem_gpio_reg(struct device *d, - struct device_attribute *attr, - const char *buf, size_t count) -{ - u32 reg; - struct ipw_priv *p = dev_get_drvdata(d); - - sscanf(buf, "%x", ®); - ipw_write_reg32(p, 0x301100, reg); - return strnlen(buf, count); -} - -static DEVICE_ATTR(mem_gpio_reg, S_IWUSR | S_IRUGO, - show_mem_gpio_reg, store_mem_gpio_reg); - -static ssize_t show_indirect_dword(struct device *d, - struct device_attribute *attr, char *buf) -{ - u32 reg = 0; - struct ipw_priv *priv = dev_get_drvdata(d); - - if (priv->status & STATUS_INDIRECT_DWORD) - reg = ipw_read_reg32(priv, priv->indirect_dword); - else - reg = 0; - - return sprintf(buf, "0x%08x\n", reg); -} -static ssize_t store_indirect_dword(struct device *d, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - - sscanf(buf, "%x", &priv->indirect_dword); - priv->status |= STATUS_INDIRECT_DWORD; - return strnlen(buf, count); -} - -static DEVICE_ATTR(indirect_dword, S_IWUSR | S_IRUGO, - show_indirect_dword, store_indirect_dword); - -static ssize_t show_indirect_byte(struct device *d, - struct device_attribute *attr, char *buf) -{ - u8 reg = 0; - struct ipw_priv *priv = dev_get_drvdata(d); - - if (priv->status & STATUS_INDIRECT_BYTE) - reg = ipw_read_reg8(priv, priv->indirect_byte); - else - reg = 0; - - return sprintf(buf, "0x%02x\n", reg); -} -static ssize_t store_indirect_byte(struct device *d, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - - sscanf(buf, "%x", &priv->indirect_byte); - priv->status |= STATUS_INDIRECT_BYTE; - return strnlen(buf, count); -} - -static DEVICE_ATTR(indirect_byte, S_IWUSR | S_IRUGO, - show_indirect_byte, store_indirect_byte); - -static ssize_t show_direct_dword(struct device *d, - struct device_attribute *attr, char *buf) -{ - u32 reg = 0; - struct ipw_priv *priv = dev_get_drvdata(d); - - if (priv->status & STATUS_DIRECT_DWORD) - reg = ipw_read32(priv, priv->direct_dword); - else - reg = 0; - - return sprintf(buf, "0x%08x\n", reg); -} -static ssize_t store_direct_dword(struct device *d, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - - sscanf(buf, "%x", &priv->direct_dword); - priv->status |= STATUS_DIRECT_DWORD; - return strnlen(buf, count); -} - -static DEVICE_ATTR(direct_dword, S_IWUSR | S_IRUGO, - show_direct_dword, store_direct_dword); - -static int rf_kill_active(struct ipw_priv *priv) -{ - if (0 == (ipw_read32(priv, 0x30) & 0x10000)) { - priv->status |= STATUS_RF_KILL_HW; - wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, true); - } else { - priv->status &= ~STATUS_RF_KILL_HW; - wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, false); - } - - return (priv->status & STATUS_RF_KILL_HW) ? 1 : 0; -} - -static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr, - char *buf) -{ - /* 0 - RF kill not enabled - 1 - SW based RF kill active (sysfs) - 2 - HW based RF kill active - 3 - Both HW and SW baed RF kill active */ - struct ipw_priv *priv = dev_get_drvdata(d); - int val = ((priv->status & STATUS_RF_KILL_SW) ? 0x1 : 0x0) | - (rf_kill_active(priv) ? 0x2 : 0x0); - return sprintf(buf, "%i\n", val); -} - -static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) -{ - if ((disable_radio ? 1 : 0) == - ((priv->status & STATUS_RF_KILL_SW) ? 1 : 0)) - return 0; - - IPW_DEBUG_RF_KILL("Manual SW RF Kill set to: RADIO %s\n", - disable_radio ? "OFF" : "ON"); - - if (disable_radio) { - priv->status |= STATUS_RF_KILL_SW; - - cancel_delayed_work(&priv->request_scan); - cancel_delayed_work(&priv->request_direct_scan); - cancel_delayed_work(&priv->request_passive_scan); - cancel_delayed_work(&priv->scan_event); - schedule_work(&priv->down); - } else { - priv->status &= ~STATUS_RF_KILL_SW; - if (rf_kill_active(priv)) { - IPW_DEBUG_RF_KILL("Can not turn radio back on - " - "disabled by HW switch\n"); - /* Make sure the RF_KILL check timer is running */ - cancel_delayed_work(&priv->rf_kill); - schedule_delayed_work(&priv->rf_kill, - round_jiffies_relative(2 * HZ)); - } else - schedule_work(&priv->up); - } - - return 1; -} - -static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - - ipw_radio_kill_sw(priv, buf[0] == '1'); - - return count; -} - -static DEVICE_ATTR(rf_kill, S_IWUSR | S_IRUGO, show_rf_kill, store_rf_kill); - -static ssize_t show_speed_scan(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - int pos = 0, len = 0; - if (priv->config & CFG_SPEED_SCAN) { - while (priv->speed_scan[pos] != 0) - len += sprintf(&buf[len], "%d ", - priv->speed_scan[pos++]); - return len + sprintf(&buf[len], "\n"); - } - - return sprintf(buf, "0\n"); -} - -static ssize_t store_speed_scan(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - int channel, pos = 0; - const char *p = buf; - - /* list of space separated channels to scan, optionally ending with 0 */ - while ((channel = simple_strtol(p, NULL, 0))) { - if (pos == MAX_SPEED_SCAN - 1) { - priv->speed_scan[pos] = 0; - break; - } - - if (libipw_is_valid_channel(priv->ieee, channel)) - priv->speed_scan[pos++] = channel; - else - IPW_WARNING("Skipping invalid channel request: %d\n", - channel); - p = strchr(p, ' '); - if (!p) - break; - while (*p == ' ' || *p == '\t') - p++; - } - - if (pos == 0) - priv->config &= ~CFG_SPEED_SCAN; - else { - priv->speed_scan_pos = 0; - priv->config |= CFG_SPEED_SCAN; - } - - return count; -} - -static DEVICE_ATTR(speed_scan, S_IWUSR | S_IRUGO, show_speed_scan, - store_speed_scan); - -static ssize_t show_net_stats(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - return sprintf(buf, "%c\n", (priv->config & CFG_NET_STATS) ? '1' : '0'); -} - -static ssize_t store_net_stats(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - if (buf[0] == '1') - priv->config |= CFG_NET_STATS; - else - priv->config &= ~CFG_NET_STATS; - - return count; -} - -static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO, - show_net_stats, store_net_stats); - -static ssize_t show_channels(struct device *d, - struct device_attribute *attr, - char *buf) -{ - struct ipw_priv *priv = dev_get_drvdata(d); - const struct libipw_geo *geo = libipw_get_geo(priv->ieee); - int len = 0, i; - - len = sprintf(&buf[len], - "Displaying %d channels in 2.4Ghz band " - "(802.11bg):\n", geo->bg_channels); - - for (i = 0; i < geo->bg_channels; i++) { - len += sprintf(&buf[len], "%d: BSS%s%s, %s, Band %s.\n", - geo->bg[i].channel, - geo->bg[i].flags & LIBIPW_CH_RADAR_DETECT ? - " (radar spectrum)" : "", - ((geo->bg[i].flags & LIBIPW_CH_NO_IBSS) || - (geo->bg[i].flags & LIBIPW_CH_RADAR_DETECT)) - ? "" : ", IBSS", - geo->bg[i].flags & LIBIPW_CH_PASSIVE_ONLY ? - "passive only" : "active/passive", - geo->bg[i].flags & LIBIPW_CH_B_ONLY ? - "B" : "B/G"); - } - - len += sprintf(&buf[len], - "Displaying %d channels in 5.2Ghz band " - "(802.11a):\n", geo->a_channels); - for (i = 0; i < geo->a_channels; i++) { - len += sprintf(&buf[len], "%d: BSS%s%s, %s.\n", - geo->a[i].channel, - geo->a[i].flags & LIBIPW_CH_RADAR_DETECT ? - " (radar spectrum)" : "", - ((geo->a[i].flags & LIBIPW_CH_NO_IBSS) || - (geo->a[i].flags & LIBIPW_CH_RADAR_DETECT)) - ? "" : ", IBSS", - geo->a[i].flags & LIBIPW_CH_PASSIVE_ONLY ? - "passive only" : "active/passive"); - } - - return len; -} - -static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL); - -static void notify_wx_assoc_event(struct ipw_priv *priv) -{ - union iwreq_data wrqu; - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - if (priv->status & STATUS_ASSOCIATED) - memcpy(wrqu.ap_addr.sa_data, priv->bssid, ETH_ALEN); - else - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); - wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); -} - -static void ipw_irq_tasklet(struct ipw_priv *priv) -{ - u32 inta, inta_mask, handled = 0; - unsigned long flags; - int rc = 0; - - spin_lock_irqsave(&priv->irq_lock, flags); - - inta = ipw_read32(priv, IPW_INTA_RW); - inta_mask = ipw_read32(priv, IPW_INTA_MASK_R); - - if (inta == 0xFFFFFFFF) { - /* Hardware disappeared */ - IPW_WARNING("TASKLET INTA == 0xFFFFFFFF\n"); - /* Only handle the cached INTA values */ - inta = 0; - } - inta &= (IPW_INTA_MASK_ALL & inta_mask); - - /* Add any cached INTA values that need to be handled */ - inta |= priv->isr_inta; - - spin_unlock_irqrestore(&priv->irq_lock, flags); - - spin_lock_irqsave(&priv->lock, flags); - - /* handle all the justifications for the interrupt */ - if (inta & IPW_INTA_BIT_RX_TRANSFER) { - ipw_rx(priv); - handled |= IPW_INTA_BIT_RX_TRANSFER; - } - - if (inta & IPW_INTA_BIT_TX_CMD_QUEUE) { - IPW_DEBUG_HC("Command completed.\n"); - rc = ipw_queue_tx_reclaim(priv, &priv->txq_cmd, -1); - priv->status &= ~STATUS_HCMD_ACTIVE; - wake_up_interruptible(&priv->wait_command_queue); - handled |= IPW_INTA_BIT_TX_CMD_QUEUE; - } - - if (inta & IPW_INTA_BIT_TX_QUEUE_1) { - IPW_DEBUG_TX("TX_QUEUE_1\n"); - rc = ipw_queue_tx_reclaim(priv, &priv->txq[0], 0); - handled |= IPW_INTA_BIT_TX_QUEUE_1; - } - - if (inta & IPW_INTA_BIT_TX_QUEUE_2) { - IPW_DEBUG_TX("TX_QUEUE_2\n"); - rc = ipw_queue_tx_reclaim(priv, &priv->txq[1], 1); - handled |= IPW_INTA_BIT_TX_QUEUE_2; - } - - if (inta & IPW_INTA_BIT_TX_QUEUE_3) { - IPW_DEBUG_TX("TX_QUEUE_3\n"); - rc = ipw_queue_tx_reclaim(priv, &priv->txq[2], 2); - handled |= IPW_INTA_BIT_TX_QUEUE_3; - } - - if (inta & IPW_INTA_BIT_TX_QUEUE_4) { - IPW_DEBUG_TX("TX_QUEUE_4\n"); - rc = ipw_queue_tx_reclaim(priv, &priv->txq[3], 3); - handled |= IPW_INTA_BIT_TX_QUEUE_4; - } - - if (inta & IPW_INTA_BIT_STATUS_CHANGE) { - IPW_WARNING("STATUS_CHANGE\n"); - handled |= IPW_INTA_BIT_STATUS_CHANGE; - } - - if (inta & IPW_INTA_BIT_BEACON_PERIOD_EXPIRED) { - IPW_WARNING("TX_PERIOD_EXPIRED\n"); - handled |= IPW_INTA_BIT_BEACON_PERIOD_EXPIRED; - } - - if (inta & IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE) { - IPW_WARNING("HOST_CMD_DONE\n"); - handled |= IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE; - } - - if (inta & IPW_INTA_BIT_FW_INITIALIZATION_DONE) { - IPW_WARNING("FW_INITIALIZATION_DONE\n"); - handled |= IPW_INTA_BIT_FW_INITIALIZATION_DONE; - } - - if (inta & IPW_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE) { - IPW_WARNING("PHY_OFF_DONE\n"); - handled |= IPW_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE; - } - - if (inta & IPW_INTA_BIT_RF_KILL_DONE) { - IPW_DEBUG_RF_KILL("RF_KILL_DONE\n"); - priv->status |= STATUS_RF_KILL_HW; - wiphy_rfkill_set_hw_state(priv->ieee->wdev.wiphy, true); - wake_up_interruptible(&priv->wait_command_queue); - priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); - cancel_delayed_work(&priv->request_scan); - cancel_delayed_work(&priv->request_direct_scan); - cancel_delayed_work(&priv->request_passive_scan); - cancel_delayed_work(&priv->scan_event); - schedule_work(&priv->link_down); - schedule_delayed_work(&priv->rf_kill, 2 * HZ); - handled |= IPW_INTA_BIT_RF_KILL_DONE; - } - - if (inta & IPW_INTA_BIT_FATAL_ERROR) { - IPW_WARNING("Firmware error detected. Restarting.\n"); - if (priv->error) { - IPW_DEBUG_FW("Sysfs 'error' log already exists.\n"); - if (ipw_debug_level & IPW_DL_FW_ERRORS) { - struct ipw_fw_error *error = - ipw_alloc_error_log(priv); - ipw_dump_error_log(priv, error); - kfree(error); - } - } else { - priv->error = ipw_alloc_error_log(priv); - if (priv->error) - IPW_DEBUG_FW("Sysfs 'error' log captured.\n"); - else - IPW_DEBUG_FW("Error allocating sysfs 'error' " - "log.\n"); - if (ipw_debug_level & IPW_DL_FW_ERRORS) - ipw_dump_error_log(priv, priv->error); - } - - /* XXX: If hardware encryption is for WPA/WPA2, - * we have to notify the supplicant. */ - if (priv->ieee->sec.encrypt) { - priv->status &= ~STATUS_ASSOCIATED; - notify_wx_assoc_event(priv); - } - - /* Keep the restart process from trying to send host - * commands by clearing the INIT status bit */ - priv->status &= ~STATUS_INIT; - - /* Cancel currently queued command. */ - priv->status &= ~STATUS_HCMD_ACTIVE; - wake_up_interruptible(&priv->wait_command_queue); - - schedule_work(&priv->adapter_restart); - handled |= IPW_INTA_BIT_FATAL_ERROR; - } - - if (inta & IPW_INTA_BIT_PARITY_ERROR) { - IPW_ERROR("Parity error\n"); - handled |= IPW_INTA_BIT_PARITY_ERROR; - } - - if (handled != inta) { - IPW_ERROR("Unhandled INTA bits 0x%08x\n", inta & ~handled); - } - - spin_unlock_irqrestore(&priv->lock, flags); - - /* enable all interrupts */ - ipw_enable_interrupts(priv); -} - -#define IPW_CMD(x) case IPW_CMD_ ## x : return #x -static char *get_cmd_string(u8 cmd) -{ - switch (cmd) { - IPW_CMD(HOST_COMPLETE); - IPW_CMD(POWER_DOWN); - IPW_CMD(SYSTEM_CONFIG); - IPW_CMD(MULTICAST_ADDRESS); - IPW_CMD(SSID); - IPW_CMD(ADAPTER_ADDRESS); - IPW_CMD(PORT_TYPE); - IPW_CMD(RTS_THRESHOLD); - IPW_CMD(FRAG_THRESHOLD); - IPW_CMD(POWER_MODE); - IPW_CMD(WEP_KEY); - IPW_CMD(TGI_TX_KEY); - IPW_CMD(SCAN_REQUEST); - IPW_CMD(SCAN_REQUEST_EXT); - IPW_CMD(ASSOCIATE); - IPW_CMD(SUPPORTED_RATES); - IPW_CMD(SCAN_ABORT); - IPW_CMD(TX_FLUSH); - IPW_CMD(QOS_PARAMETERS); - IPW_CMD(DINO_CONFIG); - IPW_CMD(RSN_CAPABILITIES); - IPW_CMD(RX_KEY); - IPW_CMD(CARD_DISABLE); - IPW_CMD(SEED_NUMBER); - IPW_CMD(TX_POWER); - IPW_CMD(COUNTRY_INFO); - IPW_CMD(AIRONET_INFO); - IPW_CMD(AP_TX_POWER); - IPW_CMD(CCKM_INFO); - IPW_CMD(CCX_VER_INFO); - IPW_CMD(SET_CALIBRATION); - IPW_CMD(SENSITIVITY_CALIB); - IPW_CMD(RETRY_LIMIT); - IPW_CMD(IPW_PRE_POWER_DOWN); - IPW_CMD(VAP_BEACON_TEMPLATE); - IPW_CMD(VAP_DTIM_PERIOD); - IPW_CMD(EXT_SUPPORTED_RATES); - IPW_CMD(VAP_LOCAL_TX_PWR_CONSTRAINT); - IPW_CMD(VAP_QUIET_INTERVALS); - IPW_CMD(VAP_CHANNEL_SWITCH); - IPW_CMD(VAP_MANDATORY_CHANNELS); - IPW_CMD(VAP_CELL_PWR_LIMIT); - IPW_CMD(VAP_CF_PARAM_SET); - IPW_CMD(VAP_SET_BEACONING_STATE); - IPW_CMD(MEASUREMENT); - IPW_CMD(POWER_CAPABILITY); - IPW_CMD(SUPPORTED_CHANNELS); - IPW_CMD(TPC_REPORT); - IPW_CMD(WME_INFO); - IPW_CMD(PRODUCTION_COMMAND); - default: - return "UNKNOWN"; - } -} - -#define HOST_COMPLETE_TIMEOUT HZ - -static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) -{ - int rc = 0; - unsigned long flags; - unsigned long now, end; - - spin_lock_irqsave(&priv->lock, flags); - if (priv->status & STATUS_HCMD_ACTIVE) { - IPW_ERROR("Failed to send %s: Already sending a command.\n", - get_cmd_string(cmd->cmd)); - spin_unlock_irqrestore(&priv->lock, flags); - return -EAGAIN; - } - - priv->status |= STATUS_HCMD_ACTIVE; - - if (priv->cmdlog) { - priv->cmdlog[priv->cmdlog_pos].jiffies = jiffies; - priv->cmdlog[priv->cmdlog_pos].cmd.cmd = cmd->cmd; - priv->cmdlog[priv->cmdlog_pos].cmd.len = cmd->len; - memcpy(priv->cmdlog[priv->cmdlog_pos].cmd.param, cmd->param, - cmd->len); - priv->cmdlog[priv->cmdlog_pos].retcode = -1; - } - - IPW_DEBUG_HC("%s command (#%d) %d bytes: 0x%08X\n", - get_cmd_string(cmd->cmd), cmd->cmd, cmd->len, - priv->status); - -#ifndef DEBUG_CMD_WEP_KEY - if (cmd->cmd == IPW_CMD_WEP_KEY) - IPW_DEBUG_HC("WEP_KEY command masked out for secure.\n"); - else -#endif - printk_buf(IPW_DL_HOST_COMMAND, (u8 *) cmd->param, cmd->len); - - rc = ipw_queue_tx_hcmd(priv, cmd->cmd, cmd->param, cmd->len, 0); - if (rc) { - priv->status &= ~STATUS_HCMD_ACTIVE; - IPW_ERROR("Failed to send %s: Reason %d\n", - get_cmd_string(cmd->cmd), rc); - spin_unlock_irqrestore(&priv->lock, flags); - goto exit; - } - spin_unlock_irqrestore(&priv->lock, flags); - - now = jiffies; - end = now + HOST_COMPLETE_TIMEOUT; -again: - rc = wait_event_interruptible_timeout(priv->wait_command_queue, - !(priv-> - status & STATUS_HCMD_ACTIVE), - end - now); - if (rc < 0) { - now = jiffies; - if (time_before(now, end)) - goto again; - rc = 0; - } - - if (rc == 0) { - spin_lock_irqsave(&priv->lock, flags); - if (priv->status & STATUS_HCMD_ACTIVE) { - IPW_ERROR("Failed to send %s: Command timed out.\n", - get_cmd_string(cmd->cmd)); - priv->status &= ~STATUS_HCMD_ACTIVE; - spin_unlock_irqrestore(&priv->lock, flags); - rc = -EIO; - goto exit; - } - spin_unlock_irqrestore(&priv->lock, flags); - } else - rc = 0; - - if (priv->status & STATUS_RF_KILL_HW) { - IPW_ERROR("Failed to send %s: Aborted due to RF kill switch.\n", - get_cmd_string(cmd->cmd)); - rc = -EIO; - goto exit; - } - - exit: - if (priv->cmdlog) { - priv->cmdlog[priv->cmdlog_pos++].retcode = rc; - priv->cmdlog_pos %= priv->cmdlog_len; - } - return rc; -} - -static int ipw_send_cmd_simple(struct ipw_priv *priv, u8 command) -{ - struct host_cmd cmd = { - .cmd = command, - }; - - return __ipw_send_cmd(priv, &cmd); -} - -static int ipw_send_cmd_pdu(struct ipw_priv *priv, u8 command, u8 len, - void *data) -{ - struct host_cmd cmd = { - .cmd = command, - .len = len, - .param = data, - }; - - return __ipw_send_cmd(priv, &cmd); -} - -static int ipw_send_host_complete(struct ipw_priv *priv) -{ - if (!priv) { - IPW_ERROR("Invalid args\n"); - return -1; - } - - return ipw_send_cmd_simple(priv, IPW_CMD_HOST_COMPLETE); -} - -static int ipw_send_system_config(struct ipw_priv *priv) -{ - return ipw_send_cmd_pdu(priv, IPW_CMD_SYSTEM_CONFIG, - sizeof(priv->sys_config), - &priv->sys_config); -} - -static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len) -{ - if (!priv || !ssid) { - IPW_ERROR("Invalid args\n"); - return -1; - } - - return ipw_send_cmd_pdu(priv, IPW_CMD_SSID, min(len, IW_ESSID_MAX_SIZE), - ssid); -} - -static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac) -{ - if (!priv || !mac) { - IPW_ERROR("Invalid args\n"); - return -1; - } - - IPW_DEBUG_INFO("%s: Setting MAC to %pM\n", - priv->net_dev->name, mac); - - return ipw_send_cmd_pdu(priv, IPW_CMD_ADAPTER_ADDRESS, ETH_ALEN, mac); -} - -static void ipw_adapter_restart(void *adapter) -{ - struct ipw_priv *priv = adapter; - - if (priv->status & STATUS_RF_KILL_MASK) - return; - - ipw_down(priv); - - if (priv->assoc_network && - (priv->assoc_network->capability & WLAN_CAPABILITY_IBSS)) - ipw_remove_current_network(priv); - - if (ipw_up(priv)) { - IPW_ERROR("Failed to up device\n"); - return; - } -} - -static void ipw_bg_adapter_restart(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, adapter_restart); - mutex_lock(&priv->mutex); - ipw_adapter_restart(priv); - mutex_unlock(&priv->mutex); -} - -static void ipw_abort_scan(struct ipw_priv *priv); - -#define IPW_SCAN_CHECK_WATCHDOG (5 * HZ) - -static void ipw_scan_check(void *data) -{ - struct ipw_priv *priv = data; - - if (priv->status & STATUS_SCAN_ABORTING) { - IPW_DEBUG_SCAN("Scan completion watchdog resetting " - "adapter after (%dms).\n", - jiffies_to_msecs(IPW_SCAN_CHECK_WATCHDOG)); - schedule_work(&priv->adapter_restart); - } else if (priv->status & STATUS_SCANNING) { - IPW_DEBUG_SCAN("Scan completion watchdog aborting scan " - "after (%dms).\n", - jiffies_to_msecs(IPW_SCAN_CHECK_WATCHDOG)); - ipw_abort_scan(priv); - schedule_delayed_work(&priv->scan_check, HZ); - } -} - -static void ipw_bg_scan_check(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, scan_check.work); - mutex_lock(&priv->mutex); - ipw_scan_check(priv); - mutex_unlock(&priv->mutex); -} - -static int ipw_send_scan_request_ext(struct ipw_priv *priv, - struct ipw_scan_request_ext *request) -{ - return ipw_send_cmd_pdu(priv, IPW_CMD_SCAN_REQUEST_EXT, - sizeof(*request), request); -} - -static int ipw_send_scan_abort(struct ipw_priv *priv) -{ - if (!priv) { - IPW_ERROR("Invalid args\n"); - return -1; - } - - return ipw_send_cmd_simple(priv, IPW_CMD_SCAN_ABORT); -} - -static int ipw_set_sensitivity(struct ipw_priv *priv, u16 sens) -{ - struct ipw_sensitivity_calib calib = { - .beacon_rssi_raw = cpu_to_le16(sens), - }; - - return ipw_send_cmd_pdu(priv, IPW_CMD_SENSITIVITY_CALIB, sizeof(calib), - &calib); -} - -static int ipw_send_associate(struct ipw_priv *priv, - struct ipw_associate *associate) -{ - if (!priv || !associate) { - IPW_ERROR("Invalid args\n"); - return -1; - } - - return ipw_send_cmd_pdu(priv, IPW_CMD_ASSOCIATE, sizeof(*associate), - associate); -} - -static int ipw_send_supported_rates(struct ipw_priv *priv, - struct ipw_supported_rates *rates) -{ - if (!priv || !rates) { - IPW_ERROR("Invalid args\n"); - return -1; - } - - return ipw_send_cmd_pdu(priv, IPW_CMD_SUPPORTED_RATES, sizeof(*rates), - rates); -} - -static int ipw_set_random_seed(struct ipw_priv *priv) -{ - u32 val; - - if (!priv) { - IPW_ERROR("Invalid args\n"); - return -1; - } - - get_random_bytes(&val, sizeof(val)); - - return ipw_send_cmd_pdu(priv, IPW_CMD_SEED_NUMBER, sizeof(val), &val); -} - -static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) -{ - __le32 v = cpu_to_le32(phy_off); - if (!priv) { - IPW_ERROR("Invalid args\n"); - return -1; - } - - return ipw_send_cmd_pdu(priv, IPW_CMD_CARD_DISABLE, sizeof(v), &v); -} - -static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) -{ - if (!priv || !power) { - IPW_ERROR("Invalid args\n"); - return -1; - } - - return ipw_send_cmd_pdu(priv, IPW_CMD_TX_POWER, sizeof(*power), power); -} - -static int ipw_set_tx_power(struct ipw_priv *priv) -{ - const struct libipw_geo *geo = libipw_get_geo(priv->ieee); - struct ipw_tx_power tx_power; - s8 max_power; - int i; - - memset(&tx_power, 0, sizeof(tx_power)); - - /* configure device for 'G' band */ - tx_power.ieee_mode = IPW_G_MODE; - tx_power.num_channels = geo->bg_channels; - for (i = 0; i < geo->bg_channels; i++) { - max_power = geo->bg[i].max_power; - tx_power.channels_tx_power[i].channel_number = - geo->bg[i].channel; - tx_power.channels_tx_power[i].tx_power = max_power ? - min(max_power, priv->tx_power) : priv->tx_power; - } - if (ipw_send_tx_power(priv, &tx_power)) - return -EIO; - - /* configure device to also handle 'B' band */ - tx_power.ieee_mode = IPW_B_MODE; - if (ipw_send_tx_power(priv, &tx_power)) - return -EIO; - - /* configure device to also handle 'A' band */ - if (priv->ieee->abg_true) { - tx_power.ieee_mode = IPW_A_MODE; - tx_power.num_channels = geo->a_channels; - for (i = 0; i < tx_power.num_channels; i++) { - max_power = geo->a[i].max_power; - tx_power.channels_tx_power[i].channel_number = - geo->a[i].channel; - tx_power.channels_tx_power[i].tx_power = max_power ? - min(max_power, priv->tx_power) : priv->tx_power; - } - if (ipw_send_tx_power(priv, &tx_power)) - return -EIO; - } - return 0; -} - -static int ipw_send_rts_threshold(struct ipw_priv *priv, u16 rts) -{ - struct ipw_rts_threshold rts_threshold = { - .rts_threshold = cpu_to_le16(rts), - }; - - if (!priv) { - IPW_ERROR("Invalid args\n"); - return -1; - } - - return ipw_send_cmd_pdu(priv, IPW_CMD_RTS_THRESHOLD, - sizeof(rts_threshold), &rts_threshold); -} - -static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag) -{ - struct ipw_frag_threshold frag_threshold = { - .frag_threshold = cpu_to_le16(frag), - }; - - if (!priv) { - IPW_ERROR("Invalid args\n"); - return -1; - } - - return ipw_send_cmd_pdu(priv, IPW_CMD_FRAG_THRESHOLD, - sizeof(frag_threshold), &frag_threshold); -} - -static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) -{ - __le32 param; - - if (!priv) { - IPW_ERROR("Invalid args\n"); - return -1; - } - - /* If on battery, set to 3, if AC set to CAM, else user - * level */ - switch (mode) { - case IPW_POWER_BATTERY: - param = cpu_to_le32(IPW_POWER_INDEX_3); - break; - case IPW_POWER_AC: - param = cpu_to_le32(IPW_POWER_MODE_CAM); - break; - default: - param = cpu_to_le32(mode); - break; - } - - return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param), - ¶m); -} - -static int ipw_send_retry_limit(struct ipw_priv *priv, u8 slimit, u8 llimit) -{ - struct ipw_retry_limit retry_limit = { - .short_retry_limit = slimit, - .long_retry_limit = llimit - }; - - if (!priv) { - IPW_ERROR("Invalid args\n"); - return -1; - } - - return ipw_send_cmd_pdu(priv, IPW_CMD_RETRY_LIMIT, sizeof(retry_limit), - &retry_limit); -} - -/* - * The IPW device contains a Microwire compatible EEPROM that stores - * various data like the MAC address. Usually the firmware has exclusive - * access to the eeprom, but during device initialization (before the - * device driver has sent the HostComplete command to the firmware) the - * device driver has read access to the EEPROM by way of indirect addressing - * through a couple of memory mapped registers. - * - * The following is a simplified implementation for pulling data out of the - * the eeprom, along with some helper functions to find information in - * the per device private data's copy of the eeprom. - * - * NOTE: To better understand how these functions work (i.e what is a chip - * select and why do have to keep driving the eeprom clock?), read - * just about any data sheet for a Microwire compatible EEPROM. - */ - -/* write a 32 bit value into the indirect accessor register */ -static inline void eeprom_write_reg(struct ipw_priv *p, u32 data) -{ - ipw_write_reg32(p, FW_MEM_REG_EEPROM_ACCESS, data); - - /* the eeprom requires some time to complete the operation */ - udelay(p->eeprom_delay); -} - -/* perform a chip select operation */ -static void eeprom_cs(struct ipw_priv *priv) -{ - eeprom_write_reg(priv, 0); - eeprom_write_reg(priv, EEPROM_BIT_CS); - eeprom_write_reg(priv, EEPROM_BIT_CS | EEPROM_BIT_SK); - eeprom_write_reg(priv, EEPROM_BIT_CS); -} - -/* perform a chip select operation */ -static void eeprom_disable_cs(struct ipw_priv *priv) -{ - eeprom_write_reg(priv, EEPROM_BIT_CS); - eeprom_write_reg(priv, 0); - eeprom_write_reg(priv, EEPROM_BIT_SK); -} - -/* push a single bit down to the eeprom */ -static inline void eeprom_write_bit(struct ipw_priv *p, u8 bit) -{ - int d = (bit ? EEPROM_BIT_DI : 0); - eeprom_write_reg(p, EEPROM_BIT_CS | d); - eeprom_write_reg(p, EEPROM_BIT_CS | d | EEPROM_BIT_SK); -} - -/* push an opcode followed by an address down to the eeprom */ -static void eeprom_op(struct ipw_priv *priv, u8 op, u8 addr) -{ - int i; - - eeprom_cs(priv); - eeprom_write_bit(priv, 1); - eeprom_write_bit(priv, op & 2); - eeprom_write_bit(priv, op & 1); - for (i = 7; i >= 0; i--) { - eeprom_write_bit(priv, addr & (1 << i)); - } -} - -/* pull 16 bits off the eeprom, one bit at a time */ -static u16 eeprom_read_u16(struct ipw_priv *priv, u8 addr) -{ - int i; - u16 r = 0; - - /* Send READ Opcode */ - eeprom_op(priv, EEPROM_CMD_READ, addr); - - /* Send dummy bit */ - eeprom_write_reg(priv, EEPROM_BIT_CS); - - /* Read the byte off the eeprom one bit at a time */ - for (i = 0; i < 16; i++) { - u32 data = 0; - eeprom_write_reg(priv, EEPROM_BIT_CS | EEPROM_BIT_SK); - eeprom_write_reg(priv, EEPROM_BIT_CS); - data = ipw_read_reg32(priv, FW_MEM_REG_EEPROM_ACCESS); - r = (r << 1) | ((data & EEPROM_BIT_DO) ? 1 : 0); - } - - /* Send another dummy bit */ - eeprom_write_reg(priv, 0); - eeprom_disable_cs(priv); - - return r; -} - -/* helper function for pulling the mac address out of the private */ -/* data's copy of the eeprom data */ -static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac) -{ - memcpy(mac, &priv->eeprom[EEPROM_MAC_ADDRESS], 6); -} - -static void ipw_read_eeprom(struct ipw_priv *priv) -{ - int i; - __le16 *eeprom = (__le16 *) priv->eeprom; - - IPW_DEBUG_TRACE(">>\n"); - - /* read entire contents of eeprom into private buffer */ - for (i = 0; i < 128; i++) - eeprom[i] = cpu_to_le16(eeprom_read_u16(priv, (u8) i)); - - IPW_DEBUG_TRACE("<<\n"); -} - -/* - * Either the device driver (i.e. the host) or the firmware can - * load eeprom data into the designated region in SRAM. If neither - * happens then the FW will shutdown with a fatal error. - * - * In order to signal the FW to load the EEPROM, the EEPROM_LOAD_DISABLE - * bit needs region of shared SRAM needs to be non-zero. - */ -static void ipw_eeprom_init_sram(struct ipw_priv *priv) -{ - int i; - - IPW_DEBUG_TRACE(">>\n"); - - /* - If the data looks correct, then copy it to our private - copy. Otherwise let the firmware know to perform the operation - on its own. - */ - if (priv->eeprom[EEPROM_VERSION] != 0) { - IPW_DEBUG_INFO("Writing EEPROM data into SRAM\n"); - - /* write the eeprom data to sram */ - for (i = 0; i < IPW_EEPROM_IMAGE_SIZE; i++) - ipw_write8(priv, IPW_EEPROM_DATA + i, priv->eeprom[i]); - - /* Do not load eeprom data on fatal error or suspend */ - ipw_write32(priv, IPW_EEPROM_LOAD_DISABLE, 0); - } else { - IPW_DEBUG_INFO("Enabling FW initializationg of SRAM\n"); - - /* Load eeprom data on fatal error or suspend */ - ipw_write32(priv, IPW_EEPROM_LOAD_DISABLE, 1); - } - - IPW_DEBUG_TRACE("<<\n"); -} - -static void ipw_zero_memory(struct ipw_priv *priv, u32 start, u32 count) -{ - count >>= 2; - if (!count) - return; - _ipw_write32(priv, IPW_AUTOINC_ADDR, start); - while (count--) - _ipw_write32(priv, IPW_AUTOINC_DATA, 0); -} - -static inline void ipw_fw_dma_reset_command_blocks(struct ipw_priv *priv) -{ - ipw_zero_memory(priv, IPW_SHARED_SRAM_DMA_CONTROL, - CB_NUMBER_OF_ELEMENTS_SMALL * - sizeof(struct command_block)); -} - -static int ipw_fw_dma_enable(struct ipw_priv *priv) -{ /* start dma engine but no transfers yet */ - - IPW_DEBUG_FW(">> :\n"); - - /* Start the dma */ - ipw_fw_dma_reset_command_blocks(priv); - - /* Write CB base address */ - ipw_write_reg32(priv, IPW_DMA_I_CB_BASE, IPW_SHARED_SRAM_DMA_CONTROL); - - IPW_DEBUG_FW("<< :\n"); - return 0; -} - -static void ipw_fw_dma_abort(struct ipw_priv *priv) -{ - u32 control = 0; - - IPW_DEBUG_FW(">> :\n"); - - /* set the Stop and Abort bit */ - control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_STOP_AND_ABORT; - ipw_write_reg32(priv, IPW_DMA_I_DMA_CONTROL, control); - priv->sram_desc.last_cb_index = 0; - - IPW_DEBUG_FW("<<\n"); -} - -static int ipw_fw_dma_write_command_block(struct ipw_priv *priv, int index, - struct command_block *cb) -{ - u32 address = - IPW_SHARED_SRAM_DMA_CONTROL + - (sizeof(struct command_block) * index); - IPW_DEBUG_FW(">> :\n"); - - ipw_write_indirect(priv, address, (u8 *) cb, - (int)sizeof(struct command_block)); - - IPW_DEBUG_FW("<< :\n"); - return 0; - -} - -static int ipw_fw_dma_kick(struct ipw_priv *priv) -{ - u32 control = 0; - u32 index = 0; - - IPW_DEBUG_FW(">> :\n"); - - for (index = 0; index < priv->sram_desc.last_cb_index; index++) - ipw_fw_dma_write_command_block(priv, index, - &priv->sram_desc.cb_list[index]); - - /* Enable the DMA in the CSR register */ - ipw_clear_bit(priv, IPW_RESET_REG, - IPW_RESET_REG_MASTER_DISABLED | - IPW_RESET_REG_STOP_MASTER); - - /* Set the Start bit. */ - control = DMA_CONTROL_SMALL_CB_CONST_VALUE | DMA_CB_START; - ipw_write_reg32(priv, IPW_DMA_I_DMA_CONTROL, control); - - IPW_DEBUG_FW("<< :\n"); - return 0; -} - -static void ipw_fw_dma_dump_command_block(struct ipw_priv *priv) -{ - u32 address; - u32 register_value = 0; - u32 cb_fields_address = 0; - - IPW_DEBUG_FW(">> :\n"); - address = ipw_read_reg32(priv, IPW_DMA_I_CURRENT_CB); - IPW_DEBUG_FW_INFO("Current CB is 0x%x\n", address); - - /* Read the DMA Controlor register */ - register_value = ipw_read_reg32(priv, IPW_DMA_I_DMA_CONTROL); - IPW_DEBUG_FW_INFO("IPW_DMA_I_DMA_CONTROL is 0x%x\n", register_value); - - /* Print the CB values */ - cb_fields_address = address; - register_value = ipw_read_reg32(priv, cb_fields_address); - IPW_DEBUG_FW_INFO("Current CB Control Field is 0x%x\n", register_value); - - cb_fields_address += sizeof(u32); - register_value = ipw_read_reg32(priv, cb_fields_address); - IPW_DEBUG_FW_INFO("Current CB Source Field is 0x%x\n", register_value); - - cb_fields_address += sizeof(u32); - register_value = ipw_read_reg32(priv, cb_fields_address); - IPW_DEBUG_FW_INFO("Current CB Destination Field is 0x%x\n", - register_value); - - cb_fields_address += sizeof(u32); - register_value = ipw_read_reg32(priv, cb_fields_address); - IPW_DEBUG_FW_INFO("Current CB Status Field is 0x%x\n", register_value); - - IPW_DEBUG_FW(">> :\n"); -} - -static int ipw_fw_dma_command_block_index(struct ipw_priv *priv) -{ - u32 current_cb_address = 0; - u32 current_cb_index = 0; - - IPW_DEBUG_FW("<< :\n"); - current_cb_address = ipw_read_reg32(priv, IPW_DMA_I_CURRENT_CB); - - current_cb_index = (current_cb_address - IPW_SHARED_SRAM_DMA_CONTROL) / - sizeof(struct command_block); - - IPW_DEBUG_FW_INFO("Current CB index 0x%x address = 0x%X\n", - current_cb_index, current_cb_address); - - IPW_DEBUG_FW(">> :\n"); - return current_cb_index; - -} - -static int ipw_fw_dma_add_command_block(struct ipw_priv *priv, - u32 src_address, - u32 dest_address, - u32 length, - int interrupt_enabled, int is_last) -{ - - u32 control = CB_VALID | CB_SRC_LE | CB_DEST_LE | CB_SRC_AUTOINC | - CB_SRC_IO_GATED | CB_DEST_AUTOINC | CB_SRC_SIZE_LONG | - CB_DEST_SIZE_LONG; - struct command_block *cb; - u32 last_cb_element = 0; - - IPW_DEBUG_FW_INFO("src_address=0x%x dest_address=0x%x length=0x%x\n", - src_address, dest_address, length); - - if (priv->sram_desc.last_cb_index >= CB_NUMBER_OF_ELEMENTS_SMALL) - return -1; - - last_cb_element = priv->sram_desc.last_cb_index; - cb = &priv->sram_desc.cb_list[last_cb_element]; - priv->sram_desc.last_cb_index++; - - /* Calculate the new CB control word */ - if (interrupt_enabled) - control |= CB_INT_ENABLED; - - if (is_last) - control |= CB_LAST_VALID; - - control |= length; - - /* Calculate the CB Element's checksum value */ - cb->status = control ^ src_address ^ dest_address; - - /* Copy the Source and Destination addresses */ - cb->dest_addr = dest_address; - cb->source_addr = src_address; - - /* Copy the Control Word last */ - cb->control = control; - - return 0; -} - -static int ipw_fw_dma_add_buffer(struct ipw_priv *priv, dma_addr_t *src_address, - int nr, u32 dest_address, u32 len) -{ - int ret, i; - u32 size; - - IPW_DEBUG_FW(">>\n"); - IPW_DEBUG_FW_INFO("nr=%d dest_address=0x%x len=0x%x\n", - nr, dest_address, len); - - for (i = 0; i < nr; i++) { - size = min_t(u32, len - i * CB_MAX_LENGTH, CB_MAX_LENGTH); - ret = ipw_fw_dma_add_command_block(priv, src_address[i], - dest_address + - i * CB_MAX_LENGTH, size, - 0, 0); - if (ret) { - IPW_DEBUG_FW_INFO(": Failed\n"); - return -1; - } else - IPW_DEBUG_FW_INFO(": Added new cb\n"); - } - - IPW_DEBUG_FW("<<\n"); - return 0; -} - -static int ipw_fw_dma_wait(struct ipw_priv *priv) -{ - u32 current_index = 0, previous_index; - u32 watchdog = 0; - - IPW_DEBUG_FW(">> :\n"); - - current_index = ipw_fw_dma_command_block_index(priv); - IPW_DEBUG_FW_INFO("sram_desc.last_cb_index:0x%08X\n", - (int)priv->sram_desc.last_cb_index); - - while (current_index < priv->sram_desc.last_cb_index) { - udelay(50); - previous_index = current_index; - current_index = ipw_fw_dma_command_block_index(priv); - - if (previous_index < current_index) { - watchdog = 0; - continue; - } - if (++watchdog > 400) { - IPW_DEBUG_FW_INFO("Timeout\n"); - ipw_fw_dma_dump_command_block(priv); - ipw_fw_dma_abort(priv); - return -1; - } - } - - ipw_fw_dma_abort(priv); - - /*Disable the DMA in the CSR register */ - ipw_set_bit(priv, IPW_RESET_REG, - IPW_RESET_REG_MASTER_DISABLED | IPW_RESET_REG_STOP_MASTER); - - IPW_DEBUG_FW("<< dmaWaitSync\n"); - return 0; -} - -static void ipw_remove_current_network(struct ipw_priv *priv) -{ - struct list_head *element, *safe; - struct libipw_network *network = NULL; - unsigned long flags; - - spin_lock_irqsave(&priv->ieee->lock, flags); - list_for_each_safe(element, safe, &priv->ieee->network_list) { - network = list_entry(element, struct libipw_network, list); - if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) { - list_del(element); - list_add_tail(&network->list, - &priv->ieee->network_free_list); - } - } - spin_unlock_irqrestore(&priv->ieee->lock, flags); -} - -/** - * Check that card is still alive. - * Reads debug register from domain0. - * If card is present, pre-defined value should - * be found there. - * - * @param priv - * @return 1 if card is present, 0 otherwise - */ -static inline int ipw_alive(struct ipw_priv *priv) -{ - return ipw_read32(priv, 0x90) == 0xd55555d5; -} - -/* timeout in msec, attempted in 10-msec quanta */ -static int ipw_poll_bit(struct ipw_priv *priv, u32 addr, u32 mask, - int timeout) -{ - int i = 0; - - do { - if ((ipw_read32(priv, addr) & mask) == mask) - return i; - mdelay(10); - i += 10; - } while (i < timeout); - - return -ETIME; -} - -/* These functions load the firmware and micro code for the operation of - * the ipw hardware. It assumes the buffer has all the bits for the - * image and the caller is handling the memory allocation and clean up. - */ - -static int ipw_stop_master(struct ipw_priv *priv) -{ - int rc; - - IPW_DEBUG_TRACE(">>\n"); - /* stop master. typical delay - 0 */ - ipw_set_bit(priv, IPW_RESET_REG, IPW_RESET_REG_STOP_MASTER); - - /* timeout is in msec, polled in 10-msec quanta */ - rc = ipw_poll_bit(priv, IPW_RESET_REG, - IPW_RESET_REG_MASTER_DISABLED, 100); - if (rc < 0) { - IPW_ERROR("wait for stop master failed after 100ms\n"); - return -1; - } - - IPW_DEBUG_INFO("stop master %dms\n", rc); - - return rc; -} - -static void ipw_arc_release(struct ipw_priv *priv) -{ - IPW_DEBUG_TRACE(">>\n"); - mdelay(5); - - ipw_clear_bit(priv, IPW_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); - - /* no one knows timing, for safety add some delay */ - mdelay(5); -} - -struct fw_chunk { - __le32 address; - __le32 length; -}; - -static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) -{ - int rc = 0, i, addr; - u8 cr = 0; - __le16 *image; - - image = (__le16 *) data; - - IPW_DEBUG_TRACE(">>\n"); - - rc = ipw_stop_master(priv); - - if (rc < 0) - return rc; - - for (addr = IPW_SHARED_LOWER_BOUND; - addr < IPW_REGISTER_DOMAIN1_END; addr += 4) { - ipw_write32(priv, addr, 0); - } - - /* no ucode (yet) */ - memset(&priv->dino_alive, 0, sizeof(priv->dino_alive)); - /* destroy DMA queues */ - /* reset sequence */ - - ipw_write_reg32(priv, IPW_MEM_HALT_AND_RESET, IPW_BIT_HALT_RESET_ON); - ipw_arc_release(priv); - ipw_write_reg32(priv, IPW_MEM_HALT_AND_RESET, IPW_BIT_HALT_RESET_OFF); - mdelay(1); - - /* reset PHY */ - ipw_write_reg32(priv, IPW_INTERNAL_CMD_EVENT, IPW_BASEBAND_POWER_DOWN); - mdelay(1); - - ipw_write_reg32(priv, IPW_INTERNAL_CMD_EVENT, 0); - mdelay(1); - - /* enable ucode store */ - ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0x0); - ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, DINO_ENABLE_CS); - mdelay(1); - - /* write ucode */ - /** - * @bug - * Do NOT set indirect address register once and then - * store data to indirect data register in the loop. - * It seems very reasonable, but in this case DINO do not - * accept ucode. It is essential to set address each time. - */ - /* load new ipw uCode */ - for (i = 0; i < len / 2; i++) - ipw_write_reg16(priv, IPW_BASEBAND_CONTROL_STORE, - le16_to_cpu(image[i])); - - /* enable DINO */ - ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0); - ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, DINO_ENABLE_SYSTEM); - - /* this is where the igx / win driver deveates from the VAP driver. */ - - /* wait for alive response */ - for (i = 0; i < 100; i++) { - /* poll for incoming data */ - cr = ipw_read_reg8(priv, IPW_BASEBAND_CONTROL_STATUS); - if (cr & DINO_RXFIFO_DATA) - break; - mdelay(1); - } - - if (cr & DINO_RXFIFO_DATA) { - /* alive_command_responce size is NOT multiple of 4 */ - __le32 response_buffer[(sizeof(priv->dino_alive) + 3) / 4]; - - for (i = 0; i < ARRAY_SIZE(response_buffer); i++) - response_buffer[i] = - cpu_to_le32(ipw_read_reg32(priv, - IPW_BASEBAND_RX_FIFO_READ)); - memcpy(&priv->dino_alive, response_buffer, - sizeof(priv->dino_alive)); - if (priv->dino_alive.alive_command == 1 - && priv->dino_alive.ucode_valid == 1) { - rc = 0; - IPW_DEBUG_INFO - ("Microcode OK, rev. %d (0x%x) dev. %d (0x%x) " - "of %02d/%02d/%02d %02d:%02d\n", - priv->dino_alive.software_revision, - priv->dino_alive.software_revision, - priv->dino_alive.device_identifier, - priv->dino_alive.device_identifier, - priv->dino_alive.time_stamp[0], - priv->dino_alive.time_stamp[1], - priv->dino_alive.time_stamp[2], - priv->dino_alive.time_stamp[3], - priv->dino_alive.time_stamp[4]); - } else { - IPW_DEBUG_INFO("Microcode is not alive\n"); - rc = -EINVAL; - } - } else { - IPW_DEBUG_INFO("No alive response from DINO\n"); - rc = -ETIME; - } - - /* disable DINO, otherwise for some reason - firmware have problem getting alive resp. */ - ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0); - - return rc; -} - -static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len) -{ - int ret = -1; - int offset = 0; - struct fw_chunk *chunk; - int total_nr = 0; - int i; - struct pci_pool *pool; - void **virts; - dma_addr_t *phys; - - IPW_DEBUG_TRACE("<< :\n"); - - virts = kmalloc(sizeof(void *) * CB_NUMBER_OF_ELEMENTS_SMALL, - GFP_KERNEL); - if (!virts) - return -ENOMEM; - - phys = kmalloc(sizeof(dma_addr_t) * CB_NUMBER_OF_ELEMENTS_SMALL, - GFP_KERNEL); - if (!phys) { - kfree(virts); - return -ENOMEM; - } - pool = pci_pool_create("ipw2200", priv->pci_dev, CB_MAX_LENGTH, 0, 0); - if (!pool) { - IPW_ERROR("pci_pool_create failed\n"); - kfree(phys); - kfree(virts); - return -ENOMEM; - } - - /* Start the Dma */ - ret = ipw_fw_dma_enable(priv); - - /* the DMA is already ready this would be a bug. */ - BUG_ON(priv->sram_desc.last_cb_index > 0); - - do { - u32 chunk_len; - u8 *start; - int size; - int nr = 0; - - chunk = (struct fw_chunk *)(data + offset); - offset += sizeof(struct fw_chunk); - chunk_len = le32_to_cpu(chunk->length); - start = data + offset; - - nr = (chunk_len + CB_MAX_LENGTH - 1) / CB_MAX_LENGTH; - for (i = 0; i < nr; i++) { - virts[total_nr] = pci_pool_alloc(pool, GFP_KERNEL, - &phys[total_nr]); - if (!virts[total_nr]) { - ret = -ENOMEM; - goto out; - } - size = min_t(u32, chunk_len - i * CB_MAX_LENGTH, - CB_MAX_LENGTH); - memcpy(virts[total_nr], start, size); - start += size; - total_nr++; - /* We don't support fw chunk larger than 64*8K */ - BUG_ON(total_nr > CB_NUMBER_OF_ELEMENTS_SMALL); - } - - /* build DMA packet and queue up for sending */ - /* dma to chunk->address, the chunk->length bytes from data + - * offeset*/ - /* Dma loading */ - ret = ipw_fw_dma_add_buffer(priv, &phys[total_nr - nr], - nr, le32_to_cpu(chunk->address), - chunk_len); - if (ret) { - IPW_DEBUG_INFO("dmaAddBuffer Failed\n"); - goto out; - } - - offset += chunk_len; - } while (offset < len); - - /* Run the DMA and wait for the answer */ - ret = ipw_fw_dma_kick(priv); - if (ret) { - IPW_ERROR("dmaKick Failed\n"); - goto out; - } - - ret = ipw_fw_dma_wait(priv); - if (ret) { - IPW_ERROR("dmaWaitSync Failed\n"); - goto out; - } - out: - for (i = 0; i < total_nr; i++) - pci_pool_free(pool, virts[i], phys[i]); - - pci_pool_destroy(pool); - kfree(phys); - kfree(virts); - - return ret; -} - -/* stop nic */ -static int ipw_stop_nic(struct ipw_priv *priv) -{ - int rc = 0; - - /* stop */ - ipw_write32(priv, IPW_RESET_REG, IPW_RESET_REG_STOP_MASTER); - - rc = ipw_poll_bit(priv, IPW_RESET_REG, - IPW_RESET_REG_MASTER_DISABLED, 500); - if (rc < 0) { - IPW_ERROR("wait for reg master disabled failed after 500ms\n"); - return rc; - } - - ipw_set_bit(priv, IPW_RESET_REG, CBD_RESET_REG_PRINCETON_RESET); - - return rc; -} - -static void ipw_start_nic(struct ipw_priv *priv) -{ - IPW_DEBUG_TRACE(">>\n"); - - /* prvHwStartNic release ARC */ - ipw_clear_bit(priv, IPW_RESET_REG, - IPW_RESET_REG_MASTER_DISABLED | - IPW_RESET_REG_STOP_MASTER | - CBD_RESET_REG_PRINCETON_RESET); - - /* enable power management */ - ipw_set_bit(priv, IPW_GP_CNTRL_RW, - IPW_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY); - - IPW_DEBUG_TRACE("<<\n"); -} - -static int ipw_init_nic(struct ipw_priv *priv) -{ - int rc; - - IPW_DEBUG_TRACE(">>\n"); - /* reset */ - /*prvHwInitNic */ - /* set "initialization complete" bit to move adapter to D0 state */ - ipw_set_bit(priv, IPW_GP_CNTRL_RW, IPW_GP_CNTRL_BIT_INIT_DONE); - - /* low-level PLL activation */ - ipw_write32(priv, IPW_READ_INT_REGISTER, - IPW_BIT_INT_HOST_SRAM_READ_INT_REGISTER); - - /* wait for clock stabilization */ - rc = ipw_poll_bit(priv, IPW_GP_CNTRL_RW, - IPW_GP_CNTRL_BIT_CLOCK_READY, 250); - if (rc < 0) - IPW_DEBUG_INFO("FAILED wait for clock stablization\n"); - - /* assert SW reset */ - ipw_set_bit(priv, IPW_RESET_REG, IPW_RESET_REG_SW_RESET); - - udelay(10); - - /* set "initialization complete" bit to move adapter to D0 state */ - ipw_set_bit(priv, IPW_GP_CNTRL_RW, IPW_GP_CNTRL_BIT_INIT_DONE); - - IPW_DEBUG_TRACE(">>\n"); - return 0; -} - -/* Call this function from process context, it will sleep in request_firmware. - * Probe is an ok place to call this from. - */ -static int ipw_reset_nic(struct ipw_priv *priv) -{ - int rc = 0; - unsigned long flags; - - IPW_DEBUG_TRACE(">>\n"); - - rc = ipw_init_nic(priv); - - spin_lock_irqsave(&priv->lock, flags); - /* Clear the 'host command active' bit... */ - priv->status &= ~STATUS_HCMD_ACTIVE; - wake_up_interruptible(&priv->wait_command_queue); - priv->status &= ~(STATUS_SCANNING | STATUS_SCAN_ABORTING); - wake_up_interruptible(&priv->wait_state); - spin_unlock_irqrestore(&priv->lock, flags); - - IPW_DEBUG_TRACE("<<\n"); - return rc; -} - - -struct ipw_fw { - __le32 ver; - __le32 boot_size; - __le32 ucode_size; - __le32 fw_size; - u8 data[0]; -}; - -static int ipw_get_fw(struct ipw_priv *priv, - const struct firmware **raw, const char *name) -{ - struct ipw_fw *fw; - int rc; - - /* ask firmware_class module to get the boot firmware off disk */ - rc = request_firmware(raw, name, &priv->pci_dev->dev); - if (rc < 0) { - IPW_ERROR("%s request_firmware failed: Reason %d\n", name, rc); - return rc; - } - - if ((*raw)->size < sizeof(*fw)) { - IPW_ERROR("%s is too small (%zd)\n", name, (*raw)->size); - return -EINVAL; - } - - fw = (void *)(*raw)->data; - - if ((*raw)->size < sizeof(*fw) + le32_to_cpu(fw->boot_size) + - le32_to_cpu(fw->ucode_size) + le32_to_cpu(fw->fw_size)) { - IPW_ERROR("%s is too small or corrupt (%zd)\n", - name, (*raw)->size); - return -EINVAL; - } - - IPW_DEBUG_INFO("Read firmware '%s' image v%d.%d (%zd bytes)\n", - name, - le32_to_cpu(fw->ver) >> 16, - le32_to_cpu(fw->ver) & 0xff, - (*raw)->size - sizeof(*fw)); - return 0; -} - -#define IPW_RX_BUF_SIZE (3000) - -static void ipw_rx_queue_reset(struct ipw_priv *priv, - struct ipw_rx_queue *rxq) -{ - unsigned long flags; - int i; - - spin_lock_irqsave(&rxq->lock, flags); - - INIT_LIST_HEAD(&rxq->rx_free); - INIT_LIST_HEAD(&rxq->rx_used); - - /* Fill the rx_used queue with _all_ of the Rx buffers */ - for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) { - /* In the reset function, these buffers may have been allocated - * to an SKB, so we need to unmap and free potential storage */ - if (rxq->pool[i].skb != NULL) { - pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, - IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); - dev_kfree_skb(rxq->pool[i].skb); - rxq->pool[i].skb = NULL; - } - list_add_tail(&rxq->pool[i].list, &rxq->rx_used); - } - - /* Set us so that we have processed and used all buffers, but have - * not restocked the Rx queue with fresh buffers */ - rxq->read = rxq->write = 0; - rxq->free_count = 0; - spin_unlock_irqrestore(&rxq->lock, flags); -} - -#ifdef CONFIG_PM -static int fw_loaded = 0; -static const struct firmware *raw = NULL; - -static void free_firmware(void) -{ - if (fw_loaded) { - release_firmware(raw); - raw = NULL; - fw_loaded = 0; - } -} -#else -#define free_firmware() do {} while (0) -#endif - -static int ipw_load(struct ipw_priv *priv) -{ -#ifndef CONFIG_PM - const struct firmware *raw = NULL; -#endif - struct ipw_fw *fw; - u8 *boot_img, *ucode_img, *fw_img; - u8 *name = NULL; - int rc = 0, retries = 3; - - switch (priv->ieee->iw_mode) { - case IW_MODE_ADHOC: - name = "ipw2200-ibss.fw"; - break; -#ifdef CONFIG_IPW2200_MONITOR - case IW_MODE_MONITOR: - name = "ipw2200-sniffer.fw"; - break; -#endif - case IW_MODE_INFRA: - name = "ipw2200-bss.fw"; - break; - } - - if (!name) { - rc = -EINVAL; - goto error; - } - -#ifdef CONFIG_PM - if (!fw_loaded) { -#endif - rc = ipw_get_fw(priv, &raw, name); - if (rc < 0) - goto error; -#ifdef CONFIG_PM - } -#endif - - fw = (void *)raw->data; - boot_img = &fw->data[0]; - ucode_img = &fw->data[le32_to_cpu(fw->boot_size)]; - fw_img = &fw->data[le32_to_cpu(fw->boot_size) + - le32_to_cpu(fw->ucode_size)]; - - if (rc < 0) - goto error; - - if (!priv->rxq) - priv->rxq = ipw_rx_queue_alloc(priv); - else - ipw_rx_queue_reset(priv, priv->rxq); - if (!priv->rxq) { - IPW_ERROR("Unable to initialize Rx queue\n"); - goto error; - } - - retry: - /* Ensure interrupts are disabled */ - ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); - priv->status &= ~STATUS_INT_ENABLED; - - /* ack pending interrupts */ - ipw_write32(priv, IPW_INTA_RW, IPW_INTA_MASK_ALL); - - ipw_stop_nic(priv); - - rc = ipw_reset_nic(priv); - if (rc < 0) { - IPW_ERROR("Unable to reset NIC\n"); - goto error; - } - - ipw_zero_memory(priv, IPW_NIC_SRAM_LOWER_BOUND, - IPW_NIC_SRAM_UPPER_BOUND - IPW_NIC_SRAM_LOWER_BOUND); - - /* DMA the initial boot firmware into the device */ - rc = ipw_load_firmware(priv, boot_img, le32_to_cpu(fw->boot_size)); - if (rc < 0) { - IPW_ERROR("Unable to load boot firmware: %d\n", rc); - goto error; - } - - /* kick start the device */ - ipw_start_nic(priv); - - /* wait for the device to finish its initial startup sequence */ - rc = ipw_poll_bit(priv, IPW_INTA_RW, - IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); - if (rc < 0) { - IPW_ERROR("device failed to boot initial fw image\n"); - goto error; - } - IPW_DEBUG_INFO("initial device response after %dms\n", rc); - - /* ack fw init done interrupt */ - ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); - - /* DMA the ucode into the device */ - rc = ipw_load_ucode(priv, ucode_img, le32_to_cpu(fw->ucode_size)); - if (rc < 0) { - IPW_ERROR("Unable to load ucode: %d\n", rc); - goto error; - } - - /* stop nic */ - ipw_stop_nic(priv); - - /* DMA bss firmware into the device */ - rc = ipw_load_firmware(priv, fw_img, le32_to_cpu(fw->fw_size)); - if (rc < 0) { - IPW_ERROR("Unable to load firmware: %d\n", rc); - goto error; - } -#ifdef CONFIG_PM - fw_loaded = 1; -#endif - - ipw_write32(priv, IPW_EEPROM_LOAD_DISABLE, 0); - - rc = ipw_queue_reset(priv); - if (rc < 0) { - IPW_ERROR("Unable to initialize queues\n"); - goto error; - } - - /* Ensure interrupts are disabled */ - ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); - /* ack pending interrupts */ - ipw_write32(priv, IPW_INTA_RW, IPW_INTA_MASK_ALL); - - /* kick start the device */ - ipw_start_nic(priv); - - if (ipw_read32(priv, IPW_INTA_RW) & IPW_INTA_BIT_PARITY_ERROR) { - if (retries > 0) { - IPW_WARNING("Parity error. Retrying init.\n"); - retries--; - goto retry; - } - - IPW_ERROR("TODO: Handle parity error -- schedule restart?\n"); - rc = -EIO; - goto error; - } - - /* wait for the device */ - rc = ipw_poll_bit(priv, IPW_INTA_RW, - IPW_INTA_BIT_FW_INITIALIZATION_DONE, 500); - if (rc < 0) { - IPW_ERROR("device failed to start within 500ms\n"); - goto error; - } - IPW_DEBUG_INFO("device response after %dms\n", rc); - - /* ack fw init done interrupt */ - ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); - - /* read eeprom data */ - priv->eeprom_delay = 1; - ipw_read_eeprom(priv); - /* initialize the eeprom region of sram */ - ipw_eeprom_init_sram(priv); - - /* enable interrupts */ - ipw_enable_interrupts(priv); - - /* Ensure our queue has valid packets */ - ipw_rx_queue_replenish(priv); - - ipw_write32(priv, IPW_RX_READ_INDEX, priv->rxq->read); - - /* ack pending interrupts */ - ipw_write32(priv, IPW_INTA_RW, IPW_INTA_MASK_ALL); - -#ifndef CONFIG_PM - release_firmware(raw); -#endif - return 0; - - error: - if (priv->rxq) { - ipw_rx_queue_free(priv, priv->rxq); - priv->rxq = NULL; - } - ipw_tx_queue_free(priv); - release_firmware(raw); -#ifdef CONFIG_PM - fw_loaded = 0; - raw = NULL; -#endif - - return rc; -} - -/** - * DMA services - * - * Theory of operation - * - * A queue is a circular buffers with 'Read' and 'Write' pointers. - * 2 empty entries always kept in the buffer to protect from overflow. - * - * For Tx queue, there are low mark and high mark limits. If, after queuing - * the packet for Tx, free space become < low mark, Tx queue stopped. When - * reclaiming packets (on 'tx done IRQ), if free space become > high mark, - * Tx queue resumed. - * - * The IPW operates with six queues, one receive queue in the device's - * sram, one transmit queue for sending commands to the device firmware, - * and four transmit queues for data. - * - * The four transmit queues allow for performing quality of service (qos) - * transmissions as per the 802.11 protocol. Currently Linux does not - * provide a mechanism to the user for utilizing prioritized queues, so - * we only utilize the first data transmit queue (queue1). - */ - -/** - * Driver allocates buffers of this size for Rx - */ - -/** - * ipw_rx_queue_space - Return number of free slots available in queue. - */ -static int ipw_rx_queue_space(const struct ipw_rx_queue *q) -{ - int s = q->read - q->write; - if (s <= 0) - s += RX_QUEUE_SIZE; - /* keep some buffer to not confuse full and empty queue */ - s -= 2; - if (s < 0) - s = 0; - return s; -} - -static inline int ipw_tx_queue_space(const struct clx2_queue *q) -{ - int s = q->last_used - q->first_empty; - if (s <= 0) - s += q->n_bd; - s -= 2; /* keep some reserve to not confuse empty and full situations */ - if (s < 0) - s = 0; - return s; -} - -static inline int ipw_queue_inc_wrap(int index, int n_bd) -{ - return (++index == n_bd) ? 0 : index; -} - -/** - * Initialize common DMA queue structure - * - * @param q queue to init - * @param count Number of BD's to allocate. Should be power of 2 - * @param read_register Address for 'read' register - * (not offset within BAR, full address) - * @param write_register Address for 'write' register - * (not offset within BAR, full address) - * @param base_register Address for 'base' register - * (not offset within BAR, full address) - * @param size Address for 'size' register - * (not offset within BAR, full address) - */ -static void ipw_queue_init(struct ipw_priv *priv, struct clx2_queue *q, - int count, u32 read, u32 write, u32 base, u32 size) -{ - q->n_bd = count; - - q->low_mark = q->n_bd / 4; - if (q->low_mark < 4) - q->low_mark = 4; - - q->high_mark = q->n_bd / 8; - if (q->high_mark < 2) - q->high_mark = 2; - - q->first_empty = q->last_used = 0; - q->reg_r = read; - q->reg_w = write; - - ipw_write32(priv, base, q->dma_addr); - ipw_write32(priv, size, count); - ipw_write32(priv, read, 0); - ipw_write32(priv, write, 0); - - _ipw_read32(priv, 0x90); -} - -static int ipw_queue_tx_init(struct ipw_priv *priv, - struct clx2_tx_queue *q, - int count, u32 read, u32 write, u32 base, u32 size) -{ - struct pci_dev *dev = priv->pci_dev; - - q->txb = kmalloc(sizeof(q->txb[0]) * count, GFP_KERNEL); - if (!q->txb) { - IPW_ERROR("vmalloc for auxiliary BD structures failed\n"); - return -ENOMEM; - } - - q->bd = - pci_alloc_consistent(dev, sizeof(q->bd[0]) * count, &q->q.dma_addr); - if (!q->bd) { - IPW_ERROR("pci_alloc_consistent(%zd) failed\n", - sizeof(q->bd[0]) * count); - kfree(q->txb); - q->txb = NULL; - return -ENOMEM; - } - - ipw_queue_init(priv, &q->q, count, read, write, base, size); - return 0; -} - -/** - * Free one TFD, those at index [txq->q.last_used]. - * Do NOT advance any indexes - * - * @param dev - * @param txq - */ -static void ipw_queue_tx_free_tfd(struct ipw_priv *priv, - struct clx2_tx_queue *txq) -{ - struct tfd_frame *bd = &txq->bd[txq->q.last_used]; - struct pci_dev *dev = priv->pci_dev; - int i; - - /* classify bd */ - if (bd->control_flags.message_type == TX_HOST_COMMAND_TYPE) - /* nothing to cleanup after for host commands */ - return; - - /* sanity check */ - if (le32_to_cpu(bd->u.data.num_chunks) > NUM_TFD_CHUNKS) { - IPW_ERROR("Too many chunks: %i\n", - le32_to_cpu(bd->u.data.num_chunks)); - /** @todo issue fatal error, it is quite serious situation */ - return; - } - - /* unmap chunks if any */ - for (i = 0; i < le32_to_cpu(bd->u.data.num_chunks); i++) { - pci_unmap_single(dev, le32_to_cpu(bd->u.data.chunk_ptr[i]), - le16_to_cpu(bd->u.data.chunk_len[i]), - PCI_DMA_TODEVICE); - if (txq->txb[txq->q.last_used]) { - libipw_txb_free(txq->txb[txq->q.last_used]); - txq->txb[txq->q.last_used] = NULL; - } - } -} - -/** - * Deallocate DMA queue. - * - * Empty queue by removing and destroying all BD's. - * Free all buffers. - * - * @param dev - * @param q - */ -static void ipw_queue_tx_free(struct ipw_priv *priv, struct clx2_tx_queue *txq) -{ - struct clx2_queue *q = &txq->q; - struct pci_dev *dev = priv->pci_dev; - - if (q->n_bd == 0) - return; - - /* first, empty all BD's */ - for (; q->first_empty != q->last_used; - q->last_used = ipw_queue_inc_wrap(q->last_used, q->n_bd)) { - ipw_queue_tx_free_tfd(priv, txq); - } - - /* free buffers belonging to queue itself */ - pci_free_consistent(dev, sizeof(txq->bd[0]) * q->n_bd, txq->bd, - q->dma_addr); - kfree(txq->txb); - - /* 0 fill whole structure */ - memset(txq, 0, sizeof(*txq)); -} - -/** - * Destroy all DMA queues and structures - * - * @param priv - */ -static void ipw_tx_queue_free(struct ipw_priv *priv) -{ - /* Tx CMD queue */ - ipw_queue_tx_free(priv, &priv->txq_cmd); - - /* Tx queues */ - ipw_queue_tx_free(priv, &priv->txq[0]); - ipw_queue_tx_free(priv, &priv->txq[1]); - ipw_queue_tx_free(priv, &priv->txq[2]); - ipw_queue_tx_free(priv, &priv->txq[3]); -} - -static void ipw_create_bssid(struct ipw_priv *priv, u8 * bssid) -{ - /* First 3 bytes are manufacturer */ - bssid[0] = priv->mac_addr[0]; - bssid[1] = priv->mac_addr[1]; - bssid[2] = priv->mac_addr[2]; - - /* Last bytes are random */ - get_random_bytes(&bssid[3], ETH_ALEN - 3); - - bssid[0] &= 0xfe; /* clear multicast bit */ - bssid[0] |= 0x02; /* set local assignment bit (IEEE802) */ -} - -static u8 ipw_add_station(struct ipw_priv *priv, u8 * bssid) -{ - struct ipw_station_entry entry; - int i; - - for (i = 0; i < priv->num_stations; i++) { - if (!memcmp(priv->stations[i], bssid, ETH_ALEN)) { - /* Another node is active in network */ - priv->missed_adhoc_beacons = 0; - if (!(priv->config & CFG_STATIC_CHANNEL)) - /* when other nodes drop out, we drop out */ - priv->config &= ~CFG_ADHOC_PERSIST; - - return i; - } - } - - if (i == MAX_STATIONS) - return IPW_INVALID_STATION; - - IPW_DEBUG_SCAN("Adding AdHoc station: %pM\n", bssid); - - entry.reserved = 0; - entry.support_mode = 0; - memcpy(entry.mac_addr, bssid, ETH_ALEN); - memcpy(priv->stations[i], bssid, ETH_ALEN); - ipw_write_direct(priv, IPW_STATION_TABLE_LOWER + i * sizeof(entry), - &entry, sizeof(entry)); - priv->num_stations++; - - return i; -} - -static u8 ipw_find_station(struct ipw_priv *priv, u8 * bssid) -{ - int i; - - for (i = 0; i < priv->num_stations; i++) - if (!memcmp(priv->stations[i], bssid, ETH_ALEN)) - return i; - - return IPW_INVALID_STATION; -} - -static void ipw_send_disassociate(struct ipw_priv *priv, int quiet) -{ - int err; - - if (priv->status & STATUS_ASSOCIATING) { - IPW_DEBUG_ASSOC("Disassociating while associating.\n"); - schedule_work(&priv->disassociate); - return; - } - - if (!(priv->status & STATUS_ASSOCIATED)) { - IPW_DEBUG_ASSOC("Disassociating while not associated.\n"); - return; - } - - IPW_DEBUG_ASSOC("Disassocation attempt from %pM " - "on channel %d.\n", - priv->assoc_request.bssid, - priv->assoc_request.channel); - - priv->status &= ~(STATUS_ASSOCIATING | STATUS_ASSOCIATED); - priv->status |= STATUS_DISASSOCIATING; - - if (quiet) - priv->assoc_request.assoc_type = HC_DISASSOC_QUIET; - else - priv->assoc_request.assoc_type = HC_DISASSOCIATE; - - err = ipw_send_associate(priv, &priv->assoc_request); - if (err) { - IPW_DEBUG_HC("Attempt to send [dis]associate command " - "failed.\n"); - return; - } - -} - -static int ipw_disassociate(void *data) -{ - struct ipw_priv *priv = data; - if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) - return 0; - ipw_send_disassociate(data, 0); - netif_carrier_off(priv->net_dev); - return 1; -} - -static void ipw_bg_disassociate(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, disassociate); - mutex_lock(&priv->mutex); - ipw_disassociate(priv); - mutex_unlock(&priv->mutex); -} - -static void ipw_system_config(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, system_config); - -#ifdef CONFIG_IPW2200_PROMISCUOUS - if (priv->prom_net_dev && netif_running(priv->prom_net_dev)) { - priv->sys_config.accept_all_data_frames = 1; - priv->sys_config.accept_non_directed_frames = 1; - priv->sys_config.accept_all_mgmt_bcpr = 1; - priv->sys_config.accept_all_mgmt_frames = 1; - } -#endif - - ipw_send_system_config(priv); -} - -struct ipw_status_code { - u16 status; - const char *reason; -}; - -static const struct ipw_status_code ipw_status_codes[] = { - {0x00, "Successful"}, - {0x01, "Unspecified failure"}, - {0x0A, "Cannot support all requested capabilities in the " - "Capability information field"}, - {0x0B, "Reassociation denied due to inability to confirm that " - "association exists"}, - {0x0C, "Association denied due to reason outside the scope of this " - "standard"}, - {0x0D, - "Responding station does not support the specified authentication " - "algorithm"}, - {0x0E, - "Received an Authentication frame with authentication sequence " - "transaction sequence number out of expected sequence"}, - {0x0F, "Authentication rejected because of challenge failure"}, - {0x10, "Authentication rejected due to timeout waiting for next " - "frame in sequence"}, - {0x11, "Association denied because AP is unable to handle additional " - "associated stations"}, - {0x12, - "Association denied due to requesting station not supporting all " - "of the datarates in the BSSBasicServiceSet Parameter"}, - {0x13, - "Association denied due to requesting station not supporting " - "short preamble operation"}, - {0x14, - "Association denied due to requesting station not supporting " - "PBCC encoding"}, - {0x15, - "Association denied due to requesting station not supporting " - "channel agility"}, - {0x19, - "Association denied due to requesting station not supporting " - "short slot operation"}, - {0x1A, - "Association denied due to requesting station not supporting " - "DSSS-OFDM operation"}, - {0x28, "Invalid Information Element"}, - {0x29, "Group Cipher is not valid"}, - {0x2A, "Pairwise Cipher is not valid"}, - {0x2B, "AKMP is not valid"}, - {0x2C, "Unsupported RSN IE version"}, - {0x2D, "Invalid RSN IE Capabilities"}, - {0x2E, "Cipher suite is rejected per security policy"}, -}; - -static const char *ipw_get_status_code(u16 status) -{ - int i; - for (i = 0; i < ARRAY_SIZE(ipw_status_codes); i++) - if (ipw_status_codes[i].status == (status & 0xff)) - return ipw_status_codes[i].reason; - return "Unknown status value."; -} - -static void inline average_init(struct average *avg) -{ - memset(avg, 0, sizeof(*avg)); -} - -#define DEPTH_RSSI 8 -#define DEPTH_NOISE 16 -static s16 exponential_average(s16 prev_avg, s16 val, u8 depth) -{ - return ((depth-1)*prev_avg + val)/depth; -} - -static void average_add(struct average *avg, s16 val) -{ - avg->sum -= avg->entries[avg->pos]; - avg->sum += val; - avg->entries[avg->pos++] = val; - if (unlikely(avg->pos == AVG_ENTRIES)) { - avg->init = 1; - avg->pos = 0; - } -} - -static s16 average_value(struct average *avg) -{ - if (!unlikely(avg->init)) { - if (avg->pos) - return avg->sum / avg->pos; - return 0; - } - - return avg->sum / AVG_ENTRIES; -} - -static void ipw_reset_stats(struct ipw_priv *priv) -{ - u32 len = sizeof(u32); - - priv->quality = 0; - - average_init(&priv->average_missed_beacons); - priv->exp_avg_rssi = -60; - priv->exp_avg_noise = -85 + 0x100; - - priv->last_rate = 0; - priv->last_missed_beacons = 0; - priv->last_rx_packets = 0; - priv->last_tx_packets = 0; - priv->last_tx_failures = 0; - - /* Firmware managed, reset only when NIC is restarted, so we have to - * normalize on the current value */ - ipw_get_ordinal(priv, IPW_ORD_STAT_RX_ERR_CRC, - &priv->last_rx_err, &len); - ipw_get_ordinal(priv, IPW_ORD_STAT_TX_FAILURE, - &priv->last_tx_failures, &len); - - /* Driver managed, reset with each association */ - priv->missed_adhoc_beacons = 0; - priv->missed_beacons = 0; - priv->tx_packets = 0; - priv->rx_packets = 0; - -} - -static u32 ipw_get_max_rate(struct ipw_priv *priv) -{ - u32 i = 0x80000000; - u32 mask = priv->rates_mask; - /* If currently associated in B mode, restrict the maximum - * rate match to B rates */ - if (priv->assoc_request.ieee_mode == IPW_B_MODE) - mask &= LIBIPW_CCK_RATES_MASK; - - /* TODO: Verify that the rate is supported by the current rates - * list. */ - - while (i && !(mask & i)) - i >>= 1; - switch (i) { - case LIBIPW_CCK_RATE_1MB_MASK: - return 1000000; - case LIBIPW_CCK_RATE_2MB_MASK: - return 2000000; - case LIBIPW_CCK_RATE_5MB_MASK: - return 5500000; - case LIBIPW_OFDM_RATE_6MB_MASK: - return 6000000; - case LIBIPW_OFDM_RATE_9MB_MASK: - return 9000000; - case LIBIPW_CCK_RATE_11MB_MASK: - return 11000000; - case LIBIPW_OFDM_RATE_12MB_MASK: - return 12000000; - case LIBIPW_OFDM_RATE_18MB_MASK: - return 18000000; - case LIBIPW_OFDM_RATE_24MB_MASK: - return 24000000; - case LIBIPW_OFDM_RATE_36MB_MASK: - return 36000000; - case LIBIPW_OFDM_RATE_48MB_MASK: - return 48000000; - case LIBIPW_OFDM_RATE_54MB_MASK: - return 54000000; - } - - if (priv->ieee->mode == IEEE_B) - return 11000000; - else - return 54000000; -} - -static u32 ipw_get_current_rate(struct ipw_priv *priv) -{ - u32 rate, len = sizeof(rate); - int err; - - if (!(priv->status & STATUS_ASSOCIATED)) - return 0; - - if (priv->tx_packets > IPW_REAL_RATE_RX_PACKET_THRESHOLD) { - err = ipw_get_ordinal(priv, IPW_ORD_STAT_TX_CURR_RATE, &rate, - &len); - if (err) { - IPW_DEBUG_INFO("failed querying ordinals.\n"); - return 0; - } - } else - return ipw_get_max_rate(priv); - - switch (rate) { - case IPW_TX_RATE_1MB: - return 1000000; - case IPW_TX_RATE_2MB: - return 2000000; - case IPW_TX_RATE_5MB: - return 5500000; - case IPW_TX_RATE_6MB: - return 6000000; - case IPW_TX_RATE_9MB: - return 9000000; - case IPW_TX_RATE_11MB: - return 11000000; - case IPW_TX_RATE_12MB: - return 12000000; - case IPW_TX_RATE_18MB: - return 18000000; - case IPW_TX_RATE_24MB: - return 24000000; - case IPW_TX_RATE_36MB: - return 36000000; - case IPW_TX_RATE_48MB: - return 48000000; - case IPW_TX_RATE_54MB: - return 54000000; - } - - return 0; -} - -#define IPW_STATS_INTERVAL (2 * HZ) -static void ipw_gather_stats(struct ipw_priv *priv) -{ - u32 rx_err, rx_err_delta, rx_packets_delta; - u32 tx_failures, tx_failures_delta, tx_packets_delta; - u32 missed_beacons_percent, missed_beacons_delta; - u32 quality = 0; - u32 len = sizeof(u32); - s16 rssi; - u32 beacon_quality, signal_quality, tx_quality, rx_quality, - rate_quality; - u32 max_rate; - - if (!(priv->status & STATUS_ASSOCIATED)) { - priv->quality = 0; - return; - } - - /* Update the statistics */ - ipw_get_ordinal(priv, IPW_ORD_STAT_MISSED_BEACONS, - &priv->missed_beacons, &len); - missed_beacons_delta = priv->missed_beacons - priv->last_missed_beacons; - priv->last_missed_beacons = priv->missed_beacons; - if (priv->assoc_request.beacon_interval) { - missed_beacons_percent = missed_beacons_delta * - (HZ * le16_to_cpu(priv->assoc_request.beacon_interval)) / - (IPW_STATS_INTERVAL * 10); - } else { - missed_beacons_percent = 0; - } - average_add(&priv->average_missed_beacons, missed_beacons_percent); - - ipw_get_ordinal(priv, IPW_ORD_STAT_RX_ERR_CRC, &rx_err, &len); - rx_err_delta = rx_err - priv->last_rx_err; - priv->last_rx_err = rx_err; - - ipw_get_ordinal(priv, IPW_ORD_STAT_TX_FAILURE, &tx_failures, &len); - tx_failures_delta = tx_failures - priv->last_tx_failures; - priv->last_tx_failures = tx_failures; - - rx_packets_delta = priv->rx_packets - priv->last_rx_packets; - priv->last_rx_packets = priv->rx_packets; - - tx_packets_delta = priv->tx_packets - priv->last_tx_packets; - priv->last_tx_packets = priv->tx_packets; - - /* Calculate quality based on the following: - * - * Missed beacon: 100% = 0, 0% = 70% missed - * Rate: 60% = 1Mbs, 100% = Max - * Rx and Tx errors represent a straight % of total Rx/Tx - * RSSI: 100% = > -50, 0% = < -80 - * Rx errors: 100% = 0, 0% = 50% missed - * - * The lowest computed quality is used. - * - */ -#define BEACON_THRESHOLD 5 - beacon_quality = 100 - missed_beacons_percent; - if (beacon_quality < BEACON_THRESHOLD) - beacon_quality = 0; - else - beacon_quality = (beacon_quality - BEACON_THRESHOLD) * 100 / - (100 - BEACON_THRESHOLD); - IPW_DEBUG_STATS("Missed beacon: %3d%% (%d%%)\n", - beacon_quality, missed_beacons_percent); - - priv->last_rate = ipw_get_current_rate(priv); - max_rate = ipw_get_max_rate(priv); - rate_quality = priv->last_rate * 40 / max_rate + 60; - IPW_DEBUG_STATS("Rate quality : %3d%% (%dMbs)\n", - rate_quality, priv->last_rate / 1000000); - - if (rx_packets_delta > 100 && rx_packets_delta + rx_err_delta) - rx_quality = 100 - (rx_err_delta * 100) / - (rx_packets_delta + rx_err_delta); - else - rx_quality = 100; - IPW_DEBUG_STATS("Rx quality : %3d%% (%u errors, %u packets)\n", - rx_quality, rx_err_delta, rx_packets_delta); - - if (tx_packets_delta > 100 && tx_packets_delta + tx_failures_delta) - tx_quality = 100 - (tx_failures_delta * 100) / - (tx_packets_delta + tx_failures_delta); - else - tx_quality = 100; - IPW_DEBUG_STATS("Tx quality : %3d%% (%u errors, %u packets)\n", - tx_quality, tx_failures_delta, tx_packets_delta); - - rssi = priv->exp_avg_rssi; - signal_quality = - (100 * - (priv->ieee->perfect_rssi - priv->ieee->worst_rssi) * - (priv->ieee->perfect_rssi - priv->ieee->worst_rssi) - - (priv->ieee->perfect_rssi - rssi) * - (15 * (priv->ieee->perfect_rssi - priv->ieee->worst_rssi) + - 62 * (priv->ieee->perfect_rssi - rssi))) / - ((priv->ieee->perfect_rssi - priv->ieee->worst_rssi) * - (priv->ieee->perfect_rssi - priv->ieee->worst_rssi)); - if (signal_quality > 100) - signal_quality = 100; - else if (signal_quality < 1) - signal_quality = 0; - - IPW_DEBUG_STATS("Signal level : %3d%% (%d dBm)\n", - signal_quality, rssi); - - quality = min(rx_quality, signal_quality); - quality = min(tx_quality, quality); - quality = min(rate_quality, quality); - quality = min(beacon_quality, quality); - if (quality == beacon_quality) - IPW_DEBUG_STATS("Quality (%d%%): Clamped to missed beacons.\n", - quality); - if (quality == rate_quality) - IPW_DEBUG_STATS("Quality (%d%%): Clamped to rate quality.\n", - quality); - if (quality == tx_quality) - IPW_DEBUG_STATS("Quality (%d%%): Clamped to Tx quality.\n", - quality); - if (quality == rx_quality) - IPW_DEBUG_STATS("Quality (%d%%): Clamped to Rx quality.\n", - quality); - if (quality == signal_quality) - IPW_DEBUG_STATS("Quality (%d%%): Clamped to signal quality.\n", - quality); - - priv->quality = quality; - - schedule_delayed_work(&priv->gather_stats, IPW_STATS_INTERVAL); -} - -static void ipw_bg_gather_stats(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, gather_stats.work); - mutex_lock(&priv->mutex); - ipw_gather_stats(priv); - mutex_unlock(&priv->mutex); -} - -/* Missed beacon behavior: - * 1st missed -> roaming_threshold, just wait, don't do any scan/roam. - * roaming_threshold -> disassociate_threshold, scan and roam for better signal. - * Above disassociate threshold, give up and stop scanning. - * Roaming is disabled if disassociate_threshold <= roaming_threshold */ -static void ipw_handle_missed_beacon(struct ipw_priv *priv, - int missed_count) -{ - priv->notif_missed_beacons = missed_count; - - if (missed_count > priv->disassociate_threshold && - priv->status & STATUS_ASSOCIATED) { - /* If associated and we've hit the missed - * beacon threshold, disassociate, turn - * off roaming, and abort any active scans */ - IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | - IPW_DL_STATE | IPW_DL_ASSOC, - "Missed beacon: %d - disassociate\n", missed_count); - priv->status &= ~STATUS_ROAMING; - if (priv->status & STATUS_SCANNING) { - IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | - IPW_DL_STATE, - "Aborting scan with missed beacon.\n"); - schedule_work(&priv->abort_scan); - } - - schedule_work(&priv->disassociate); - return; - } - - if (priv->status & STATUS_ROAMING) { - /* If we are currently roaming, then just - * print a debug statement... */ - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, - "Missed beacon: %d - roam in progress\n", - missed_count); - return; - } - - if (roaming && - (missed_count > priv->roaming_threshold && - missed_count <= priv->disassociate_threshold)) { - /* If we are not already roaming, set the ROAM - * bit in the status and kick off a scan. - * This can happen several times before we reach - * disassociate_threshold. */ - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, - "Missed beacon: %d - initiate " - "roaming\n", missed_count); - if (!(priv->status & STATUS_ROAMING)) { - priv->status |= STATUS_ROAMING; - if (!(priv->status & STATUS_SCANNING)) - schedule_delayed_work(&priv->request_scan, 0); - } - return; - } - - if (priv->status & STATUS_SCANNING && - missed_count > IPW_MB_SCAN_CANCEL_THRESHOLD) { - /* Stop scan to keep fw from getting - * stuck (only if we aren't roaming -- - * otherwise we'll never scan more than 2 or 3 - * channels..) */ - IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | IPW_DL_STATE, - "Aborting scan with missed beacon.\n"); - schedule_work(&priv->abort_scan); - } - - IPW_DEBUG_NOTIF("Missed beacon: %d\n", missed_count); -} - -static void ipw_scan_event(struct work_struct *work) -{ - union iwreq_data wrqu; - - struct ipw_priv *priv = - container_of(work, struct ipw_priv, scan_event.work); - - wrqu.data.length = 0; - wrqu.data.flags = 0; - wireless_send_event(priv->net_dev, SIOCGIWSCAN, &wrqu, NULL); -} - -static void handle_scan_event(struct ipw_priv *priv) -{ - /* Only userspace-requested scan completion events go out immediately */ - if (!priv->user_requested_scan) { - schedule_delayed_work(&priv->scan_event, - round_jiffies_relative(msecs_to_jiffies(4000))); - } else { - priv->user_requested_scan = 0; - mod_delayed_work(system_wq, &priv->scan_event, 0); - } -} - -/** - * Handle host notification packet. - * Called from interrupt routine - */ -static void ipw_rx_notification(struct ipw_priv *priv, - struct ipw_rx_notification *notif) -{ - DECLARE_SSID_BUF(ssid); - u16 size = le16_to_cpu(notif->size); - - IPW_DEBUG_NOTIF("type = %i (%d bytes)\n", notif->subtype, size); - - switch (notif->subtype) { - case HOST_NOTIFICATION_STATUS_ASSOCIATED:{ - struct notif_association *assoc = ¬if->u.assoc; - - switch (assoc->state) { - case CMAS_ASSOCIATED:{ - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, - "associated: '%s' %pM\n", - print_ssid(ssid, priv->essid, - priv->essid_len), - priv->bssid); - - switch (priv->ieee->iw_mode) { - case IW_MODE_INFRA: - memcpy(priv->ieee->bssid, - priv->bssid, ETH_ALEN); - break; - - case IW_MODE_ADHOC: - memcpy(priv->ieee->bssid, - priv->bssid, ETH_ALEN); - - /* clear out the station table */ - priv->num_stations = 0; - - IPW_DEBUG_ASSOC - ("queueing adhoc check\n"); - schedule_delayed_work( - &priv->adhoc_check, - le16_to_cpu(priv-> - assoc_request. - beacon_interval)); - break; - } - - priv->status &= ~STATUS_ASSOCIATING; - priv->status |= STATUS_ASSOCIATED; - schedule_work(&priv->system_config); - -#ifdef CONFIG_IPW2200_QOS -#define IPW_GET_PACKET_STYPE(x) WLAN_FC_GET_STYPE( \ - le16_to_cpu(((struct ieee80211_hdr *)(x))->frame_control)) - if ((priv->status & STATUS_AUTH) && - (IPW_GET_PACKET_STYPE(¬if->u.raw) - == IEEE80211_STYPE_ASSOC_RESP)) { - if ((sizeof - (struct - libipw_assoc_response) - <= size) - && (size <= 2314)) { - struct - libipw_rx_stats - stats = { - .len = size - 1, - }; - - IPW_DEBUG_QOS - ("QoS Associate " - "size %d\n", size); - libipw_rx_mgt(priv-> - ieee, - (struct - libipw_hdr_4addr - *) - ¬if->u.raw, &stats); - } - } -#endif - - schedule_work(&priv->link_up); - - break; - } - - case CMAS_AUTHENTICATED:{ - if (priv-> - status & (STATUS_ASSOCIATED | - STATUS_AUTH)) { - struct notif_authenticate *auth - = ¬if->u.auth; - IPW_DEBUG(IPW_DL_NOTIF | - IPW_DL_STATE | - IPW_DL_ASSOC, - "deauthenticated: '%s' " - "%pM" - ": (0x%04X) - %s\n", - print_ssid(ssid, - priv-> - essid, - priv-> - essid_len), - priv->bssid, - le16_to_cpu(auth->status), - ipw_get_status_code - (le16_to_cpu - (auth->status))); - - priv->status &= - ~(STATUS_ASSOCIATING | - STATUS_AUTH | - STATUS_ASSOCIATED); - - schedule_work(&priv->link_down); - break; - } - - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, - "authenticated: '%s' %pM\n", - print_ssid(ssid, priv->essid, - priv->essid_len), - priv->bssid); - break; - } - - case CMAS_INIT:{ - if (priv->status & STATUS_AUTH) { - struct - libipw_assoc_response - *resp; - resp = - (struct - libipw_assoc_response - *)¬if->u.raw; - IPW_DEBUG(IPW_DL_NOTIF | - IPW_DL_STATE | - IPW_DL_ASSOC, - "association failed (0x%04X): %s\n", - le16_to_cpu(resp->status), - ipw_get_status_code - (le16_to_cpu - (resp->status))); - } - - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, - "disassociated: '%s' %pM\n", - print_ssid(ssid, priv->essid, - priv->essid_len), - priv->bssid); - - priv->status &= - ~(STATUS_DISASSOCIATING | - STATUS_ASSOCIATING | - STATUS_ASSOCIATED | STATUS_AUTH); - if (priv->assoc_network - && (priv->assoc_network-> - capability & - WLAN_CAPABILITY_IBSS)) - ipw_remove_current_network - (priv); - - schedule_work(&priv->link_down); - - break; - } - - case CMAS_RX_ASSOC_RESP: - break; - - default: - IPW_ERROR("assoc: unknown (%d)\n", - assoc->state); - break; - } - - break; - } - - case HOST_NOTIFICATION_STATUS_AUTHENTICATE:{ - struct notif_authenticate *auth = ¬if->u.auth; - switch (auth->state) { - case CMAS_AUTHENTICATED: - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, - "authenticated: '%s' %pM\n", - print_ssid(ssid, priv->essid, - priv->essid_len), - priv->bssid); - priv->status |= STATUS_AUTH; - break; - - case CMAS_INIT: - if (priv->status & STATUS_AUTH) { - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, - "authentication failed (0x%04X): %s\n", - le16_to_cpu(auth->status), - ipw_get_status_code(le16_to_cpu - (auth-> - status))); - } - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, - "deauthenticated: '%s' %pM\n", - print_ssid(ssid, priv->essid, - priv->essid_len), - priv->bssid); - - priv->status &= ~(STATUS_ASSOCIATING | - STATUS_AUTH | - STATUS_ASSOCIATED); - - schedule_work(&priv->link_down); - break; - - case CMAS_TX_AUTH_SEQ_1: - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, "AUTH_SEQ_1\n"); - break; - case CMAS_RX_AUTH_SEQ_2: - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, "AUTH_SEQ_2\n"); - break; - case CMAS_AUTH_SEQ_1_PASS: - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, "AUTH_SEQ_1_PASS\n"); - break; - case CMAS_AUTH_SEQ_1_FAIL: - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, "AUTH_SEQ_1_FAIL\n"); - break; - case CMAS_TX_AUTH_SEQ_3: - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, "AUTH_SEQ_3\n"); - break; - case CMAS_RX_AUTH_SEQ_4: - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, "RX_AUTH_SEQ_4\n"); - break; - case CMAS_AUTH_SEQ_2_PASS: - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, "AUTH_SEQ_2_PASS\n"); - break; - case CMAS_AUTH_SEQ_2_FAIL: - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, "AUT_SEQ_2_FAIL\n"); - break; - case CMAS_TX_ASSOC: - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, "TX_ASSOC\n"); - break; - case CMAS_RX_ASSOC_RESP: - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, "RX_ASSOC_RESP\n"); - - break; - case CMAS_ASSOCIATED: - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | - IPW_DL_ASSOC, "ASSOCIATED\n"); - break; - default: - IPW_DEBUG_NOTIF("auth: failure - %d\n", - auth->state); - break; - } - break; - } - - case HOST_NOTIFICATION_STATUS_SCAN_CHANNEL_RESULT:{ - struct notif_channel_result *x = - ¬if->u.channel_result; - - if (size == sizeof(*x)) { - IPW_DEBUG_SCAN("Scan result for channel %d\n", - x->channel_num); - } else { - IPW_DEBUG_SCAN("Scan result of wrong size %d " - "(should be %zd)\n", - size, sizeof(*x)); - } - break; - } - - case HOST_NOTIFICATION_STATUS_SCAN_COMPLETED:{ - struct notif_scan_complete *x = ¬if->u.scan_complete; - if (size == sizeof(*x)) { - IPW_DEBUG_SCAN - ("Scan completed: type %d, %d channels, " - "%d status\n", x->scan_type, - x->num_channels, x->status); - } else { - IPW_ERROR("Scan completed of wrong size %d " - "(should be %zd)\n", - size, sizeof(*x)); - } - - priv->status &= - ~(STATUS_SCANNING | STATUS_SCAN_ABORTING); - - wake_up_interruptible(&priv->wait_state); - cancel_delayed_work(&priv->scan_check); - - if (priv->status & STATUS_EXIT_PENDING) - break; - - priv->ieee->scans++; - -#ifdef CONFIG_IPW2200_MONITOR - if (priv->ieee->iw_mode == IW_MODE_MONITOR) { - priv->status |= STATUS_SCAN_FORCED; - schedule_delayed_work(&priv->request_scan, 0); - break; - } - priv->status &= ~STATUS_SCAN_FORCED; -#endif /* CONFIG_IPW2200_MONITOR */ - - /* Do queued direct scans first */ - if (priv->status & STATUS_DIRECT_SCAN_PENDING) - schedule_delayed_work(&priv->request_direct_scan, 0); - - if (!(priv->status & (STATUS_ASSOCIATED | - STATUS_ASSOCIATING | - STATUS_ROAMING | - STATUS_DISASSOCIATING))) - schedule_work(&priv->associate); - else if (priv->status & STATUS_ROAMING) { - if (x->status == SCAN_COMPLETED_STATUS_COMPLETE) - /* If a scan completed and we are in roam mode, then - * the scan that completed was the one requested as a - * result of entering roam... so, schedule the - * roam work */ - schedule_work(&priv->roam); - else - /* Don't schedule if we aborted the scan */ - priv->status &= ~STATUS_ROAMING; - } else if (priv->status & STATUS_SCAN_PENDING) - schedule_delayed_work(&priv->request_scan, 0); - else if (priv->config & CFG_BACKGROUND_SCAN - && priv->status & STATUS_ASSOCIATED) - schedule_delayed_work(&priv->request_scan, - round_jiffies_relative(HZ)); - - /* Send an empty event to user space. - * We don't send the received data on the event because - * it would require us to do complex transcoding, and - * we want to minimise the work done in the irq handler - * Use a request to extract the data. - * Also, we generate this even for any scan, regardless - * on how the scan was initiated. User space can just - * sync on periodic scan to get fresh data... - * Jean II */ - if (x->status == SCAN_COMPLETED_STATUS_COMPLETE) - handle_scan_event(priv); - break; - } - - case HOST_NOTIFICATION_STATUS_FRAG_LENGTH:{ - struct notif_frag_length *x = ¬if->u.frag_len; - - if (size == sizeof(*x)) - IPW_ERROR("Frag length: %d\n", - le16_to_cpu(x->frag_length)); - else - IPW_ERROR("Frag length of wrong size %d " - "(should be %zd)\n", - size, sizeof(*x)); - break; - } - - case HOST_NOTIFICATION_STATUS_LINK_DETERIORATION:{ - struct notif_link_deterioration *x = - ¬if->u.link_deterioration; - - if (size == sizeof(*x)) { - IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, - "link deterioration: type %d, cnt %d\n", - x->silence_notification_type, - x->silence_count); - memcpy(&priv->last_link_deterioration, x, - sizeof(*x)); - } else { - IPW_ERROR("Link Deterioration of wrong size %d " - "(should be %zd)\n", - size, sizeof(*x)); - } - break; - } - - case HOST_NOTIFICATION_DINO_CONFIG_RESPONSE:{ - IPW_ERROR("Dino config\n"); - if (priv->hcmd - && priv->hcmd->cmd != HOST_CMD_DINO_CONFIG) - IPW_ERROR("Unexpected DINO_CONFIG_RESPONSE\n"); - - break; - } - - case HOST_NOTIFICATION_STATUS_BEACON_STATE:{ - struct notif_beacon_state *x = ¬if->u.beacon_state; - if (size != sizeof(*x)) { - IPW_ERROR - ("Beacon state of wrong size %d (should " - "be %zd)\n", size, sizeof(*x)); - break; - } - - if (le32_to_cpu(x->state) == - HOST_NOTIFICATION_STATUS_BEACON_MISSING) - ipw_handle_missed_beacon(priv, - le32_to_cpu(x-> - number)); - - break; - } - - case HOST_NOTIFICATION_STATUS_TGI_TX_KEY:{ - struct notif_tgi_tx_key *x = ¬if->u.tgi_tx_key; - if (size == sizeof(*x)) { - IPW_ERROR("TGi Tx Key: state 0x%02x sec type " - "0x%02x station %d\n", - x->key_state, x->security_type, - x->station_index); - break; - } - - IPW_ERROR - ("TGi Tx Key of wrong size %d (should be %zd)\n", - size, sizeof(*x)); - break; - } - - case HOST_NOTIFICATION_CALIB_KEEP_RESULTS:{ - struct notif_calibration *x = ¬if->u.calibration; - - if (size == sizeof(*x)) { - memcpy(&priv->calib, x, sizeof(*x)); - IPW_DEBUG_INFO("TODO: Calibration\n"); - break; - } - - IPW_ERROR - ("Calibration of wrong size %d (should be %zd)\n", - size, sizeof(*x)); - break; - } - - case HOST_NOTIFICATION_NOISE_STATS:{ - if (size == sizeof(u32)) { - priv->exp_avg_noise = - exponential_average(priv->exp_avg_noise, - (u8) (le32_to_cpu(notif->u.noise.value) & 0xff), - DEPTH_NOISE); - break; - } - - IPW_ERROR - ("Noise stat is wrong size %d (should be %zd)\n", - size, sizeof(u32)); - break; - } - - default: - IPW_DEBUG_NOTIF("Unknown notification: " - "subtype=%d,flags=0x%2x,size=%d\n", - notif->subtype, notif->flags, size); - } -} - -/** - * Destroys all DMA structures and initialise them again - * - * @param priv - * @return error code - */ -static int ipw_queue_reset(struct ipw_priv *priv) -{ - int rc = 0; - /** @todo customize queue sizes */ - int nTx = 64, nTxCmd = 8; - ipw_tx_queue_free(priv); - /* Tx CMD queue */ - rc = ipw_queue_tx_init(priv, &priv->txq_cmd, nTxCmd, - IPW_TX_CMD_QUEUE_READ_INDEX, - IPW_TX_CMD_QUEUE_WRITE_INDEX, - IPW_TX_CMD_QUEUE_BD_BASE, - IPW_TX_CMD_QUEUE_BD_SIZE); - if (rc) { - IPW_ERROR("Tx Cmd queue init failed\n"); - goto error; - } - /* Tx queue(s) */ - rc = ipw_queue_tx_init(priv, &priv->txq[0], nTx, - IPW_TX_QUEUE_0_READ_INDEX, - IPW_TX_QUEUE_0_WRITE_INDEX, - IPW_TX_QUEUE_0_BD_BASE, IPW_TX_QUEUE_0_BD_SIZE); - if (rc) { - IPW_ERROR("Tx 0 queue init failed\n"); - goto error; - } - rc = ipw_queue_tx_init(priv, &priv->txq[1], nTx, - IPW_TX_QUEUE_1_READ_INDEX, - IPW_TX_QUEUE_1_WRITE_INDEX, - IPW_TX_QUEUE_1_BD_BASE, IPW_TX_QUEUE_1_BD_SIZE); - if (rc) { - IPW_ERROR("Tx 1 queue init failed\n"); - goto error; - } - rc = ipw_queue_tx_init(priv, &priv->txq[2], nTx, - IPW_TX_QUEUE_2_READ_INDEX, - IPW_TX_QUEUE_2_WRITE_INDEX, - IPW_TX_QUEUE_2_BD_BASE, IPW_TX_QUEUE_2_BD_SIZE); - if (rc) { - IPW_ERROR("Tx 2 queue init failed\n"); - goto error; - } - rc = ipw_queue_tx_init(priv, &priv->txq[3], nTx, - IPW_TX_QUEUE_3_READ_INDEX, - IPW_TX_QUEUE_3_WRITE_INDEX, - IPW_TX_QUEUE_3_BD_BASE, IPW_TX_QUEUE_3_BD_SIZE); - if (rc) { - IPW_ERROR("Tx 3 queue init failed\n"); - goto error; - } - /* statistics */ - priv->rx_bufs_min = 0; - priv->rx_pend_max = 0; - return rc; - - error: - ipw_tx_queue_free(priv); - return rc; -} - -/** - * Reclaim Tx queue entries no more used by NIC. - * - * When FW advances 'R' index, all entries between old and - * new 'R' index need to be reclaimed. As result, some free space - * forms. If there is enough free space (> low mark), wake Tx queue. - * - * @note Need to protect against garbage in 'R' index - * @param priv - * @param txq - * @param qindex - * @return Number of used entries remains in the queue - */ -static int ipw_queue_tx_reclaim(struct ipw_priv *priv, - struct clx2_tx_queue *txq, int qindex) -{ - u32 hw_tail; - int used; - struct clx2_queue *q = &txq->q; - - hw_tail = ipw_read32(priv, q->reg_r); - if (hw_tail >= q->n_bd) { - IPW_ERROR - ("Read index for DMA queue (%d) is out of range [0-%d)\n", - hw_tail, q->n_bd); - goto done; - } - for (; q->last_used != hw_tail; - q->last_used = ipw_queue_inc_wrap(q->last_used, q->n_bd)) { - ipw_queue_tx_free_tfd(priv, txq); - priv->tx_packets++; - } - done: - if ((ipw_tx_queue_space(q) > q->low_mark) && - (qindex >= 0)) - netif_wake_queue(priv->net_dev); - used = q->first_empty - q->last_used; - if (used < 0) - used += q->n_bd; - - return used; -} - -static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf, - int len, int sync) -{ - struct clx2_tx_queue *txq = &priv->txq_cmd; - struct clx2_queue *q = &txq->q; - struct tfd_frame *tfd; - - if (ipw_tx_queue_space(q) < (sync ? 1 : 2)) { - IPW_ERROR("No space for Tx\n"); - return -EBUSY; - } - - tfd = &txq->bd[q->first_empty]; - txq->txb[q->first_empty] = NULL; - - memset(tfd, 0, sizeof(*tfd)); - tfd->control_flags.message_type = TX_HOST_COMMAND_TYPE; - tfd->control_flags.control_bits = TFD_NEED_IRQ_MASK; - priv->hcmd_seq++; - tfd->u.cmd.index = hcmd; - tfd->u.cmd.length = len; - memcpy(tfd->u.cmd.payload, buf, len); - q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd); - ipw_write32(priv, q->reg_w, q->first_empty); - _ipw_read32(priv, 0x90); - - return 0; -} - -/* - * Rx theory of operation - * - * The host allocates 32 DMA target addresses and passes the host address - * to the firmware at register IPW_RFDS_TABLE_LOWER + N * RFD_SIZE where N is - * 0 to 31 - * - * Rx Queue Indexes - * The host/firmware share two index registers for managing the Rx buffers. - * - * The READ index maps to the first position that the firmware may be writing - * to -- the driver can read up to (but not including) this position and get - * good data. - * The READ index is managed by the firmware once the card is enabled. - * - * The WRITE index maps to the last position the driver has read from -- the - * position preceding WRITE is the last slot the firmware can place a packet. - * - * The queue is empty (no good data) if WRITE = READ - 1, and is full if - * WRITE = READ. - * - * During initialization the host sets up the READ queue position to the first - * INDEX position, and WRITE to the last (READ - 1 wrapped) - * - * When the firmware places a packet in a buffer it will advance the READ index - * and fire the RX interrupt. The driver can then query the READ index and - * process as many packets as possible, moving the WRITE index forward as it - * resets the Rx queue buffers with new memory. - * - * The management in the driver is as follows: - * + A list of pre-allocated SKBs is stored in ipw->rxq->rx_free. When - * ipw->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled - * to replensish the ipw->rxq->rx_free. - * + In ipw_rx_queue_replenish (scheduled) if 'processed' != 'read' then the - * ipw->rxq is replenished and the READ INDEX is updated (updating the - * 'processed' and 'read' driver indexes as well) - * + A received packet is processed and handed to the kernel network stack, - * detached from the ipw->rxq. The driver 'processed' index is updated. - * + The Host/Firmware ipw->rxq is replenished at tasklet time from the rx_free - * list. If there are no allocated buffers in ipw->rxq->rx_free, the READ - * INDEX is not incremented and ipw->status(RX_STALLED) is set. If there - * were enough free buffers and RX_STALLED is set it is cleared. - * - * - * Driver sequence: - * - * ipw_rx_queue_alloc() Allocates rx_free - * ipw_rx_queue_replenish() Replenishes rx_free list from rx_used, and calls - * ipw_rx_queue_restock - * ipw_rx_queue_restock() Moves available buffers from rx_free into Rx - * queue, updates firmware pointers, and updates - * the WRITE index. If insufficient rx_free buffers - * are available, schedules ipw_rx_queue_replenish - * - * -- enable interrupts -- - * ISR - ipw_rx() Detach ipw_rx_mem_buffers from pool up to the - * READ INDEX, detaching the SKB from the pool. - * Moves the packet buffer from queue to rx_used. - * Calls ipw_rx_queue_restock to refill any empty - * slots. - * ... - * - */ - -/* - * If there are slots in the RX queue that need to be restocked, - * and we have free pre-allocated buffers, fill the ranks as much - * as we can pulling from rx_free. - * - * This moves the 'write' index forward to catch up with 'processed', and - * also updates the memory address in the firmware to reference the new - * target buffer. - */ -static void ipw_rx_queue_restock(struct ipw_priv *priv) -{ - struct ipw_rx_queue *rxq = priv->rxq; - struct list_head *element; - struct ipw_rx_mem_buffer *rxb; - unsigned long flags; - int write; - - spin_lock_irqsave(&rxq->lock, flags); - write = rxq->write; - while ((ipw_rx_queue_space(rxq) > 0) && (rxq->free_count)) { - element = rxq->rx_free.next; - rxb = list_entry(element, struct ipw_rx_mem_buffer, list); - list_del(element); - - ipw_write32(priv, IPW_RFDS_TABLE_LOWER + rxq->write * RFD_SIZE, - rxb->dma_addr); - rxq->queue[rxq->write] = rxb; - rxq->write = (rxq->write + 1) % RX_QUEUE_SIZE; - rxq->free_count--; - } - spin_unlock_irqrestore(&rxq->lock, flags); - - /* If the pre-allocated buffer pool is dropping low, schedule to - * refill it */ - if (rxq->free_count <= RX_LOW_WATERMARK) - schedule_work(&priv->rx_replenish); - - /* If we've added more space for the firmware to place data, tell it */ - if (write != rxq->write) - ipw_write32(priv, IPW_RX_WRITE_INDEX, rxq->write); -} - -/* - * Move all used packet from rx_used to rx_free, allocating a new SKB for each. - * Also restock the Rx queue via ipw_rx_queue_restock. - * - * This is called as a scheduled work item (except for during intialization) - */ -static void ipw_rx_queue_replenish(void *data) -{ - struct ipw_priv *priv = data; - struct ipw_rx_queue *rxq = priv->rxq; - struct list_head *element; - struct ipw_rx_mem_buffer *rxb; - unsigned long flags; - - spin_lock_irqsave(&rxq->lock, flags); - while (!list_empty(&rxq->rx_used)) { - element = rxq->rx_used.next; - rxb = list_entry(element, struct ipw_rx_mem_buffer, list); - rxb->skb = alloc_skb(IPW_RX_BUF_SIZE, GFP_ATOMIC); - if (!rxb->skb) { - printk(KERN_CRIT "%s: Can not allocate SKB buffers.\n", - priv->net_dev->name); - /* We don't reschedule replenish work here -- we will - * call the restock method and if it still needs - * more buffers it will schedule replenish */ - break; - } - list_del(element); - - rxb->dma_addr = - pci_map_single(priv->pci_dev, rxb->skb->data, - IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); - - list_add_tail(&rxb->list, &rxq->rx_free); - rxq->free_count++; - } - spin_unlock_irqrestore(&rxq->lock, flags); - - ipw_rx_queue_restock(priv); -} - -static void ipw_bg_rx_queue_replenish(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, rx_replenish); - mutex_lock(&priv->mutex); - ipw_rx_queue_replenish(priv); - mutex_unlock(&priv->mutex); -} - -/* Assumes that the skb field of the buffers in 'pool' is kept accurate. - * If an SKB has been detached, the POOL needs to have its SKB set to NULL - * This free routine walks the list of POOL entries and if SKB is set to - * non NULL it is unmapped and freed - */ -static void ipw_rx_queue_free(struct ipw_priv *priv, struct ipw_rx_queue *rxq) -{ - int i; - - if (!rxq) - return; - - for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { - if (rxq->pool[i].skb != NULL) { - pci_unmap_single(priv->pci_dev, rxq->pool[i].dma_addr, - IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); - dev_kfree_skb(rxq->pool[i].skb); - } - } - - kfree(rxq); -} - -static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *priv) -{ - struct ipw_rx_queue *rxq; - int i; - - rxq = kzalloc(sizeof(*rxq), GFP_KERNEL); - if (unlikely(!rxq)) { - IPW_ERROR("memory allocation failed\n"); - return NULL; - } - spin_lock_init(&rxq->lock); - INIT_LIST_HEAD(&rxq->rx_free); - INIT_LIST_HEAD(&rxq->rx_used); - - /* Fill the rx_used queue with _all_ of the Rx buffers */ - for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) - list_add_tail(&rxq->pool[i].list, &rxq->rx_used); - - /* Set us so that we have processed and used all buffers, but have - * not restocked the Rx queue with fresh buffers */ - rxq->read = rxq->write = 0; - rxq->free_count = 0; - - return rxq; -} - -static int ipw_is_rate_in_mask(struct ipw_priv *priv, int ieee_mode, u8 rate) -{ - rate &= ~LIBIPW_BASIC_RATE_MASK; - if (ieee_mode == IEEE_A) { - switch (rate) { - case LIBIPW_OFDM_RATE_6MB: - return priv->rates_mask & LIBIPW_OFDM_RATE_6MB_MASK ? - 1 : 0; - case LIBIPW_OFDM_RATE_9MB: - return priv->rates_mask & LIBIPW_OFDM_RATE_9MB_MASK ? - 1 : 0; - case LIBIPW_OFDM_RATE_12MB: - return priv-> - rates_mask & LIBIPW_OFDM_RATE_12MB_MASK ? 1 : 0; - case LIBIPW_OFDM_RATE_18MB: - return priv-> - rates_mask & LIBIPW_OFDM_RATE_18MB_MASK ? 1 : 0; - case LIBIPW_OFDM_RATE_24MB: - return priv-> - rates_mask & LIBIPW_OFDM_RATE_24MB_MASK ? 1 : 0; - case LIBIPW_OFDM_RATE_36MB: - return priv-> - rates_mask & LIBIPW_OFDM_RATE_36MB_MASK ? 1 : 0; - case LIBIPW_OFDM_RATE_48MB: - return priv-> - rates_mask & LIBIPW_OFDM_RATE_48MB_MASK ? 1 : 0; - case LIBIPW_OFDM_RATE_54MB: - return priv-> - rates_mask & LIBIPW_OFDM_RATE_54MB_MASK ? 1 : 0; - default: - return 0; - } - } - - /* B and G mixed */ - switch (rate) { - case LIBIPW_CCK_RATE_1MB: - return priv->rates_mask & LIBIPW_CCK_RATE_1MB_MASK ? 1 : 0; - case LIBIPW_CCK_RATE_2MB: - return priv->rates_mask & LIBIPW_CCK_RATE_2MB_MASK ? 1 : 0; - case LIBIPW_CCK_RATE_5MB: - return priv->rates_mask & LIBIPW_CCK_RATE_5MB_MASK ? 1 : 0; - case LIBIPW_CCK_RATE_11MB: - return priv->rates_mask & LIBIPW_CCK_RATE_11MB_MASK ? 1 : 0; - } - - /* If we are limited to B modulations, bail at this point */ - if (ieee_mode == IEEE_B) - return 0; - - /* G */ - switch (rate) { - case LIBIPW_OFDM_RATE_6MB: - return priv->rates_mask & LIBIPW_OFDM_RATE_6MB_MASK ? 1 : 0; - case LIBIPW_OFDM_RATE_9MB: - return priv->rates_mask & LIBIPW_OFDM_RATE_9MB_MASK ? 1 : 0; - case LIBIPW_OFDM_RATE_12MB: - return priv->rates_mask & LIBIPW_OFDM_RATE_12MB_MASK ? 1 : 0; - case LIBIPW_OFDM_RATE_18MB: - return priv->rates_mask & LIBIPW_OFDM_RATE_18MB_MASK ? 1 : 0; - case LIBIPW_OFDM_RATE_24MB: - return priv->rates_mask & LIBIPW_OFDM_RATE_24MB_MASK ? 1 : 0; - case LIBIPW_OFDM_RATE_36MB: - return priv->rates_mask & LIBIPW_OFDM_RATE_36MB_MASK ? 1 : 0; - case LIBIPW_OFDM_RATE_48MB: - return priv->rates_mask & LIBIPW_OFDM_RATE_48MB_MASK ? 1 : 0; - case LIBIPW_OFDM_RATE_54MB: - return priv->rates_mask & LIBIPW_OFDM_RATE_54MB_MASK ? 1 : 0; - } - - return 0; -} - -static int ipw_compatible_rates(struct ipw_priv *priv, - const struct libipw_network *network, - struct ipw_supported_rates *rates) -{ - int num_rates, i; - - memset(rates, 0, sizeof(*rates)); - num_rates = min(network->rates_len, (u8) IPW_MAX_RATES); - rates->num_rates = 0; - for (i = 0; i < num_rates; i++) { - if (!ipw_is_rate_in_mask(priv, network->mode, - network->rates[i])) { - - if (network->rates[i] & LIBIPW_BASIC_RATE_MASK) { - IPW_DEBUG_SCAN("Adding masked mandatory " - "rate %02X\n", - network->rates[i]); - rates->supported_rates[rates->num_rates++] = - network->rates[i]; - continue; - } - - IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", - network->rates[i], priv->rates_mask); - continue; - } - - rates->supported_rates[rates->num_rates++] = network->rates[i]; - } - - num_rates = min(network->rates_ex_len, - (u8) (IPW_MAX_RATES - num_rates)); - for (i = 0; i < num_rates; i++) { - if (!ipw_is_rate_in_mask(priv, network->mode, - network->rates_ex[i])) { - if (network->rates_ex[i] & LIBIPW_BASIC_RATE_MASK) { - IPW_DEBUG_SCAN("Adding masked mandatory " - "rate %02X\n", - network->rates_ex[i]); - rates->supported_rates[rates->num_rates++] = - network->rates[i]; - continue; - } - - IPW_DEBUG_SCAN("Rate %02X masked : 0x%08X\n", - network->rates_ex[i], priv->rates_mask); - continue; - } - - rates->supported_rates[rates->num_rates++] = - network->rates_ex[i]; - } - - return 1; -} - -static void ipw_copy_rates(struct ipw_supported_rates *dest, - const struct ipw_supported_rates *src) -{ - u8 i; - for (i = 0; i < src->num_rates; i++) - dest->supported_rates[i] = src->supported_rates[i]; - dest->num_rates = src->num_rates; -} - -/* TODO: Look at sniffed packets in the air to determine if the basic rate - * mask should ever be used -- right now all callers to add the scan rates are - * set with the modulation = CCK, so BASIC_RATE_MASK is never set... */ -static void ipw_add_cck_scan_rates(struct ipw_supported_rates *rates, - u8 modulation, u32 rate_mask) -{ - u8 basic_mask = (LIBIPW_OFDM_MODULATION == modulation) ? - LIBIPW_BASIC_RATE_MASK : 0; - - if (rate_mask & LIBIPW_CCK_RATE_1MB_MASK) - rates->supported_rates[rates->num_rates++] = - LIBIPW_BASIC_RATE_MASK | LIBIPW_CCK_RATE_1MB; - - if (rate_mask & LIBIPW_CCK_RATE_2MB_MASK) - rates->supported_rates[rates->num_rates++] = - LIBIPW_BASIC_RATE_MASK | LIBIPW_CCK_RATE_2MB; - - if (rate_mask & LIBIPW_CCK_RATE_5MB_MASK) - rates->supported_rates[rates->num_rates++] = basic_mask | - LIBIPW_CCK_RATE_5MB; - - if (rate_mask & LIBIPW_CCK_RATE_11MB_MASK) - rates->supported_rates[rates->num_rates++] = basic_mask | - LIBIPW_CCK_RATE_11MB; -} - -static void ipw_add_ofdm_scan_rates(struct ipw_supported_rates *rates, - u8 modulation, u32 rate_mask) -{ - u8 basic_mask = (LIBIPW_OFDM_MODULATION == modulation) ? - LIBIPW_BASIC_RATE_MASK : 0; - - if (rate_mask & LIBIPW_OFDM_RATE_6MB_MASK) - rates->supported_rates[rates->num_rates++] = basic_mask | - LIBIPW_OFDM_RATE_6MB; - - if (rate_mask & LIBIPW_OFDM_RATE_9MB_MASK) - rates->supported_rates[rates->num_rates++] = - LIBIPW_OFDM_RATE_9MB; - - if (rate_mask & LIBIPW_OFDM_RATE_12MB_MASK) - rates->supported_rates[rates->num_rates++] = basic_mask | - LIBIPW_OFDM_RATE_12MB; - - if (rate_mask & LIBIPW_OFDM_RATE_18MB_MASK) - rates->supported_rates[rates->num_rates++] = - LIBIPW_OFDM_RATE_18MB; - - if (rate_mask & LIBIPW_OFDM_RATE_24MB_MASK) - rates->supported_rates[rates->num_rates++] = basic_mask | - LIBIPW_OFDM_RATE_24MB; - - if (rate_mask & LIBIPW_OFDM_RATE_36MB_MASK) - rates->supported_rates[rates->num_rates++] = - LIBIPW_OFDM_RATE_36MB; - - if (rate_mask & LIBIPW_OFDM_RATE_48MB_MASK) - rates->supported_rates[rates->num_rates++] = - LIBIPW_OFDM_RATE_48MB; - - if (rate_mask & LIBIPW_OFDM_RATE_54MB_MASK) - rates->supported_rates[rates->num_rates++] = - LIBIPW_OFDM_RATE_54MB; -} - -struct ipw_network_match { - struct libipw_network *network; - struct ipw_supported_rates rates; -}; - -static int ipw_find_adhoc_network(struct ipw_priv *priv, - struct ipw_network_match *match, - struct libipw_network *network, - int roaming) -{ - struct ipw_supported_rates rates; - DECLARE_SSID_BUF(ssid); - - /* Verify that this network's capability is compatible with the - * current mode (AdHoc or Infrastructure) */ - if ((priv->ieee->iw_mode == IW_MODE_ADHOC && - !(network->capability & WLAN_CAPABILITY_IBSS))) { - IPW_DEBUG_MERGE("Network '%s (%pM)' excluded due to " - "capability mismatch.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid); - return 0; - } - - if (unlikely(roaming)) { - /* If we are roaming, then ensure check if this is a valid - * network to try and roam to */ - if ((network->ssid_len != match->network->ssid_len) || - memcmp(network->ssid, match->network->ssid, - network->ssid_len)) { - IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " - "because of non-network ESSID.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid); - return 0; - } - } else { - /* If an ESSID has been configured then compare the broadcast - * ESSID to ours */ - if ((priv->config & CFG_STATIC_ESSID) && - ((network->ssid_len != priv->essid_len) || - memcmp(network->ssid, priv->essid, - min(network->ssid_len, priv->essid_len)))) { - char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; - - strncpy(escaped, - print_ssid(ssid, network->ssid, - network->ssid_len), - sizeof(escaped)); - IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " - "because of ESSID mismatch: '%s'.\n", - escaped, network->bssid, - print_ssid(ssid, priv->essid, - priv->essid_len)); - return 0; - } - } - - /* If the old network rate is better than this one, don't bother - * testing everything else. */ - - if (network->time_stamp[0] < match->network->time_stamp[0]) { - IPW_DEBUG_MERGE("Network '%s excluded because newer than " - "current network.\n", - print_ssid(ssid, match->network->ssid, - match->network->ssid_len)); - return 0; - } else if (network->time_stamp[1] < match->network->time_stamp[1]) { - IPW_DEBUG_MERGE("Network '%s excluded because newer than " - "current network.\n", - print_ssid(ssid, match->network->ssid, - match->network->ssid_len)); - return 0; - } - - /* Now go through and see if the requested network is valid... */ - if (priv->ieee->scan_age != 0 && - time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { - IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " - "because of age: %ums.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid, - jiffies_to_msecs(jiffies - - network->last_scanned)); - return 0; - } - - if ((priv->config & CFG_STATIC_CHANNEL) && - (network->channel != priv->channel)) { - IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " - "because of channel mismatch: %d != %d.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid, - network->channel, priv->channel); - return 0; - } - - /* Verify privacy compatibility */ - if (((priv->capability & CAP_PRIVACY_ON) ? 1 : 0) != - ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) { - IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " - "because of privacy mismatch: %s != %s.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid, - priv-> - capability & CAP_PRIVACY_ON ? "on" : "off", - network-> - capability & WLAN_CAPABILITY_PRIVACY ? "on" : - "off"); - return 0; - } - - if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) { - IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " - "because of the same BSSID match: %pM" - ".\n", print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid, - priv->bssid); - return 0; - } - - /* Filter out any incompatible freq / mode combinations */ - if (!libipw_is_valid_mode(priv->ieee, network->mode)) { - IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " - "because of invalid frequency/mode " - "combination.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid); - return 0; - } - - /* Ensure that the rates supported by the driver are compatible with - * this AP, including verification of basic rates (mandatory) */ - if (!ipw_compatible_rates(priv, network, &rates)) { - IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " - "because configured rate mask excludes " - "AP mandatory rate.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid); - return 0; - } - - if (rates.num_rates == 0) { - IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " - "because of no compatible rates.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid); - return 0; - } - - /* TODO: Perform any further minimal comparititive tests. We do not - * want to put too much policy logic here; intelligent scan selection - * should occur within a generic IEEE 802.11 user space tool. */ - - /* Set up 'new' AP to this network */ - ipw_copy_rates(&match->rates, &rates); - match->network = network; - IPW_DEBUG_MERGE("Network '%s (%pM)' is a viable match.\n", - print_ssid(ssid, network->ssid, network->ssid_len), - network->bssid); - - return 1; -} - -static void ipw_merge_adhoc_network(struct work_struct *work) -{ - DECLARE_SSID_BUF(ssid); - struct ipw_priv *priv = - container_of(work, struct ipw_priv, merge_networks); - struct libipw_network *network = NULL; - struct ipw_network_match match = { - .network = priv->assoc_network - }; - - if ((priv->status & STATUS_ASSOCIATED) && - (priv->ieee->iw_mode == IW_MODE_ADHOC)) { - /* First pass through ROAM process -- look for a better - * network */ - unsigned long flags; - - spin_lock_irqsave(&priv->ieee->lock, flags); - list_for_each_entry(network, &priv->ieee->network_list, list) { - if (network != priv->assoc_network) - ipw_find_adhoc_network(priv, &match, network, - 1); - } - spin_unlock_irqrestore(&priv->ieee->lock, flags); - - if (match.network == priv->assoc_network) { - IPW_DEBUG_MERGE("No better ADHOC in this network to " - "merge to.\n"); - return; - } - - mutex_lock(&priv->mutex); - if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { - IPW_DEBUG_MERGE("remove network %s\n", - print_ssid(ssid, priv->essid, - priv->essid_len)); - ipw_remove_current_network(priv); - } - - ipw_disassociate(priv); - priv->assoc_network = match.network; - mutex_unlock(&priv->mutex); - return; - } -} - -static int ipw_best_network(struct ipw_priv *priv, - struct ipw_network_match *match, - struct libipw_network *network, int roaming) -{ - struct ipw_supported_rates rates; - DECLARE_SSID_BUF(ssid); - - /* Verify that this network's capability is compatible with the - * current mode (AdHoc or Infrastructure) */ - if ((priv->ieee->iw_mode == IW_MODE_INFRA && - !(network->capability & WLAN_CAPABILITY_ESS)) || - (priv->ieee->iw_mode == IW_MODE_ADHOC && - !(network->capability & WLAN_CAPABILITY_IBSS))) { - IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded due to " - "capability mismatch.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid); - return 0; - } - - if (unlikely(roaming)) { - /* If we are roaming, then ensure check if this is a valid - * network to try and roam to */ - if ((network->ssid_len != match->network->ssid_len) || - memcmp(network->ssid, match->network->ssid, - network->ssid_len)) { - IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " - "because of non-network ESSID.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid); - return 0; - } - } else { - /* If an ESSID has been configured then compare the broadcast - * ESSID to ours */ - if ((priv->config & CFG_STATIC_ESSID) && - ((network->ssid_len != priv->essid_len) || - memcmp(network->ssid, priv->essid, - min(network->ssid_len, priv->essid_len)))) { - char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; - strncpy(escaped, - print_ssid(ssid, network->ssid, - network->ssid_len), - sizeof(escaped)); - IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " - "because of ESSID mismatch: '%s'.\n", - escaped, network->bssid, - print_ssid(ssid, priv->essid, - priv->essid_len)); - return 0; - } - } - - /* If the old network rate is better than this one, don't bother - * testing everything else. */ - if (match->network && match->network->stats.rssi > network->stats.rssi) { - char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; - strncpy(escaped, - print_ssid(ssid, network->ssid, network->ssid_len), - sizeof(escaped)); - IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded because " - "'%s (%pM)' has a stronger signal.\n", - escaped, network->bssid, - print_ssid(ssid, match->network->ssid, - match->network->ssid_len), - match->network->bssid); - return 0; - } - - /* If this network has already had an association attempt within the - * last 3 seconds, do not try and associate again... */ - if (network->last_associate && - time_after(network->last_associate + (HZ * 3UL), jiffies)) { - IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " - "because of storming (%ums since last " - "assoc attempt).\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid, - jiffies_to_msecs(jiffies - - network->last_associate)); - return 0; - } - - /* Now go through and see if the requested network is valid... */ - if (priv->ieee->scan_age != 0 && - time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { - IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " - "because of age: %ums.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid, - jiffies_to_msecs(jiffies - - network->last_scanned)); - return 0; - } - - if ((priv->config & CFG_STATIC_CHANNEL) && - (network->channel != priv->channel)) { - IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " - "because of channel mismatch: %d != %d.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid, - network->channel, priv->channel); - return 0; - } - - /* Verify privacy compatibility */ - if (((priv->capability & CAP_PRIVACY_ON) ? 1 : 0) != - ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) { - IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " - "because of privacy mismatch: %s != %s.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid, - priv->capability & CAP_PRIVACY_ON ? "on" : - "off", - network->capability & - WLAN_CAPABILITY_PRIVACY ? "on" : "off"); - return 0; - } - - if ((priv->config & CFG_STATIC_BSSID) && - memcmp(network->bssid, priv->bssid, ETH_ALEN)) { - IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " - "because of BSSID mismatch: %pM.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid, priv->bssid); - return 0; - } - - /* Filter out any incompatible freq / mode combinations */ - if (!libipw_is_valid_mode(priv->ieee, network->mode)) { - IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " - "because of invalid frequency/mode " - "combination.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid); - return 0; - } - - /* Filter out invalid channel in current GEO */ - if (!libipw_is_valid_channel(priv->ieee, network->channel)) { - IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " - "because of invalid channel in current GEO\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid); - return 0; - } - - /* Ensure that the rates supported by the driver are compatible with - * this AP, including verification of basic rates (mandatory) */ - if (!ipw_compatible_rates(priv, network, &rates)) { - IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " - "because configured rate mask excludes " - "AP mandatory rate.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid); - return 0; - } - - if (rates.num_rates == 0) { - IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " - "because of no compatible rates.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid); - return 0; - } - - /* TODO: Perform any further minimal comparititive tests. We do not - * want to put too much policy logic here; intelligent scan selection - * should occur within a generic IEEE 802.11 user space tool. */ - - /* Set up 'new' AP to this network */ - ipw_copy_rates(&match->rates, &rates); - match->network = network; - - IPW_DEBUG_ASSOC("Network '%s (%pM)' is a viable match.\n", - print_ssid(ssid, network->ssid, network->ssid_len), - network->bssid); - - return 1; -} - -static void ipw_adhoc_create(struct ipw_priv *priv, - struct libipw_network *network) -{ - const struct libipw_geo *geo = libipw_get_geo(priv->ieee); - int i; - - /* - * For the purposes of scanning, we can set our wireless mode - * to trigger scans across combinations of bands, but when it - * comes to creating a new ad-hoc network, we have tell the FW - * exactly which band to use. - * - * We also have the possibility of an invalid channel for the - * chossen band. Attempting to create a new ad-hoc network - * with an invalid channel for wireless mode will trigger a - * FW fatal error. - * - */ - switch (libipw_is_valid_channel(priv->ieee, priv->channel)) { - case LIBIPW_52GHZ_BAND: - network->mode = IEEE_A; - i = libipw_channel_to_index(priv->ieee, priv->channel); - BUG_ON(i == -1); - if (geo->a[i].flags & LIBIPW_CH_PASSIVE_ONLY) { - IPW_WARNING("Overriding invalid channel\n"); - priv->channel = geo->a[0].channel; - } - break; - - case LIBIPW_24GHZ_BAND: - if (priv->ieee->mode & IEEE_G) - network->mode = IEEE_G; - else - network->mode = IEEE_B; - i = libipw_channel_to_index(priv->ieee, priv->channel); - BUG_ON(i == -1); - if (geo->bg[i].flags & LIBIPW_CH_PASSIVE_ONLY) { - IPW_WARNING("Overriding invalid channel\n"); - priv->channel = geo->bg[0].channel; - } - break; - - default: - IPW_WARNING("Overriding invalid channel\n"); - if (priv->ieee->mode & IEEE_A) { - network->mode = IEEE_A; - priv->channel = geo->a[0].channel; - } else if (priv->ieee->mode & IEEE_G) { - network->mode = IEEE_G; - priv->channel = geo->bg[0].channel; - } else { - network->mode = IEEE_B; - priv->channel = geo->bg[0].channel; - } - break; - } - - network->channel = priv->channel; - priv->config |= CFG_ADHOC_PERSIST; - ipw_create_bssid(priv, network->bssid); - network->ssid_len = priv->essid_len; - memcpy(network->ssid, priv->essid, priv->essid_len); - memset(&network->stats, 0, sizeof(network->stats)); - network->capability = WLAN_CAPABILITY_IBSS; - if (!(priv->config & CFG_PREAMBLE_LONG)) - network->capability |= WLAN_CAPABILITY_SHORT_PREAMBLE; - if (priv->capability & CAP_PRIVACY_ON) - network->capability |= WLAN_CAPABILITY_PRIVACY; - network->rates_len = min(priv->rates.num_rates, MAX_RATES_LENGTH); - memcpy(network->rates, priv->rates.supported_rates, network->rates_len); - network->rates_ex_len = priv->rates.num_rates - network->rates_len; - memcpy(network->rates_ex, - &priv->rates.supported_rates[network->rates_len], - network->rates_ex_len); - network->last_scanned = 0; - network->flags = 0; - network->last_associate = 0; - network->time_stamp[0] = 0; - network->time_stamp[1] = 0; - network->beacon_interval = 100; /* Default */ - network->listen_interval = 10; /* Default */ - network->atim_window = 0; /* Default */ - network->wpa_ie_len = 0; - network->rsn_ie_len = 0; -} - -static void ipw_send_tgi_tx_key(struct ipw_priv *priv, int type, int index) -{ - struct ipw_tgi_tx_key key; - - if (!(priv->ieee->sec.flags & (1 << index))) - return; - - key.key_id = index; - memcpy(key.key, priv->ieee->sec.keys[index], SCM_TEMPORAL_KEY_LENGTH); - key.security_type = type; - key.station_index = 0; /* always 0 for BSS */ - key.flags = 0; - /* 0 for new key; previous value of counter (after fatal error) */ - key.tx_counter[0] = cpu_to_le32(0); - key.tx_counter[1] = cpu_to_le32(0); - - ipw_send_cmd_pdu(priv, IPW_CMD_TGI_TX_KEY, sizeof(key), &key); -} - -static void ipw_send_wep_keys(struct ipw_priv *priv, int type) -{ - struct ipw_wep_key key; - int i; - - key.cmd_id = DINO_CMD_WEP_KEY; - key.seq_num = 0; - - /* Note: AES keys cannot be set for multiple times. - * Only set it at the first time. */ - for (i = 0; i < 4; i++) { - key.key_index = i | type; - if (!(priv->ieee->sec.flags & (1 << i))) { - key.key_size = 0; - continue; - } - - key.key_size = priv->ieee->sec.key_sizes[i]; - memcpy(key.key, priv->ieee->sec.keys[i], key.key_size); - - ipw_send_cmd_pdu(priv, IPW_CMD_WEP_KEY, sizeof(key), &key); - } -} - -static void ipw_set_hw_decrypt_unicast(struct ipw_priv *priv, int level) -{ - if (priv->ieee->host_encrypt) - return; - - switch (level) { - case SEC_LEVEL_3: - priv->sys_config.disable_unicast_decryption = 0; - priv->ieee->host_decrypt = 0; - break; - case SEC_LEVEL_2: - priv->sys_config.disable_unicast_decryption = 1; - priv->ieee->host_decrypt = 1; - break; - case SEC_LEVEL_1: - priv->sys_config.disable_unicast_decryption = 0; - priv->ieee->host_decrypt = 0; - break; - case SEC_LEVEL_0: - priv->sys_config.disable_unicast_decryption = 1; - break; - default: - break; - } -} - -static void ipw_set_hw_decrypt_multicast(struct ipw_priv *priv, int level) -{ - if (priv->ieee->host_encrypt) - return; - - switch (level) { - case SEC_LEVEL_3: - priv->sys_config.disable_multicast_decryption = 0; - break; - case SEC_LEVEL_2: - priv->sys_config.disable_multicast_decryption = 1; - break; - case SEC_LEVEL_1: - priv->sys_config.disable_multicast_decryption = 0; - break; - case SEC_LEVEL_0: - priv->sys_config.disable_multicast_decryption = 1; - break; - default: - break; - } -} - -static void ipw_set_hwcrypto_keys(struct ipw_priv *priv) -{ - switch (priv->ieee->sec.level) { - case SEC_LEVEL_3: - if (priv->ieee->sec.flags & SEC_ACTIVE_KEY) - ipw_send_tgi_tx_key(priv, - DCT_FLAG_EXT_SECURITY_CCM, - priv->ieee->sec.active_key); - - if (!priv->ieee->host_mc_decrypt) - ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_CCM); - break; - case SEC_LEVEL_2: - if (priv->ieee->sec.flags & SEC_ACTIVE_KEY) - ipw_send_tgi_tx_key(priv, - DCT_FLAG_EXT_SECURITY_TKIP, - priv->ieee->sec.active_key); - break; - case SEC_LEVEL_1: - ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); - ipw_set_hw_decrypt_unicast(priv, priv->ieee->sec.level); - ipw_set_hw_decrypt_multicast(priv, priv->ieee->sec.level); - break; - case SEC_LEVEL_0: - default: - break; - } -} - -static void ipw_adhoc_check(void *data) -{ - struct ipw_priv *priv = data; - - if (priv->missed_adhoc_beacons++ > priv->disassociate_threshold && - !(priv->config & CFG_ADHOC_PERSIST)) { - IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | - IPW_DL_STATE | IPW_DL_ASSOC, - "Missed beacon: %d - disassociate\n", - priv->missed_adhoc_beacons); - ipw_remove_current_network(priv); - ipw_disassociate(priv); - return; - } - - schedule_delayed_work(&priv->adhoc_check, - le16_to_cpu(priv->assoc_request.beacon_interval)); -} - -static void ipw_bg_adhoc_check(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, adhoc_check.work); - mutex_lock(&priv->mutex); - ipw_adhoc_check(priv); - mutex_unlock(&priv->mutex); -} - -static void ipw_debug_config(struct ipw_priv *priv) -{ - DECLARE_SSID_BUF(ssid); - IPW_DEBUG_INFO("Scan completed, no valid APs matched " - "[CFG 0x%08X]\n", priv->config); - if (priv->config & CFG_STATIC_CHANNEL) - IPW_DEBUG_INFO("Channel locked to %d\n", priv->channel); - else - IPW_DEBUG_INFO("Channel unlocked.\n"); - if (priv->config & CFG_STATIC_ESSID) - IPW_DEBUG_INFO("ESSID locked to '%s'\n", - print_ssid(ssid, priv->essid, priv->essid_len)); - else - IPW_DEBUG_INFO("ESSID unlocked.\n"); - if (priv->config & CFG_STATIC_BSSID) - IPW_DEBUG_INFO("BSSID locked to %pM\n", priv->bssid); - else - IPW_DEBUG_INFO("BSSID unlocked.\n"); - if (priv->capability & CAP_PRIVACY_ON) - IPW_DEBUG_INFO("PRIVACY on\n"); - else - IPW_DEBUG_INFO("PRIVACY off\n"); - IPW_DEBUG_INFO("RATE MASK: 0x%08X\n", priv->rates_mask); -} - -static void ipw_set_fixed_rate(struct ipw_priv *priv, int mode) -{ - /* TODO: Verify that this works... */ - struct ipw_fixed_rate fr; - u32 reg; - u16 mask = 0; - u16 new_tx_rates = priv->rates_mask; - - /* Identify 'current FW band' and match it with the fixed - * Tx rates */ - - switch (priv->ieee->freq_band) { - case LIBIPW_52GHZ_BAND: /* A only */ - /* IEEE_A */ - if (priv->rates_mask & ~LIBIPW_OFDM_RATES_MASK) { - /* Invalid fixed rate mask */ - IPW_DEBUG_WX - ("invalid fixed rate mask in ipw_set_fixed_rate\n"); - new_tx_rates = 0; - break; - } - - new_tx_rates >>= LIBIPW_OFDM_SHIFT_MASK_A; - break; - - default: /* 2.4Ghz or Mixed */ - /* IEEE_B */ - if (mode == IEEE_B) { - if (new_tx_rates & ~LIBIPW_CCK_RATES_MASK) { - /* Invalid fixed rate mask */ - IPW_DEBUG_WX - ("invalid fixed rate mask in ipw_set_fixed_rate\n"); - new_tx_rates = 0; - } - break; - } - - /* IEEE_G */ - if (new_tx_rates & ~(LIBIPW_CCK_RATES_MASK | - LIBIPW_OFDM_RATES_MASK)) { - /* Invalid fixed rate mask */ - IPW_DEBUG_WX - ("invalid fixed rate mask in ipw_set_fixed_rate\n"); - new_tx_rates = 0; - break; - } - - if (LIBIPW_OFDM_RATE_6MB_MASK & new_tx_rates) { - mask |= (LIBIPW_OFDM_RATE_6MB_MASK >> 1); - new_tx_rates &= ~LIBIPW_OFDM_RATE_6MB_MASK; - } - - if (LIBIPW_OFDM_RATE_9MB_MASK & new_tx_rates) { - mask |= (LIBIPW_OFDM_RATE_9MB_MASK >> 1); - new_tx_rates &= ~LIBIPW_OFDM_RATE_9MB_MASK; - } - - if (LIBIPW_OFDM_RATE_12MB_MASK & new_tx_rates) { - mask |= (LIBIPW_OFDM_RATE_12MB_MASK >> 1); - new_tx_rates &= ~LIBIPW_OFDM_RATE_12MB_MASK; - } - - new_tx_rates |= mask; - break; - } - - fr.tx_rates = cpu_to_le16(new_tx_rates); - - reg = ipw_read32(priv, IPW_MEM_FIXED_OVERRIDE); - ipw_write_reg32(priv, reg, *(u32 *) & fr); -} - -static void ipw_abort_scan(struct ipw_priv *priv) -{ - int err; - - if (priv->status & STATUS_SCAN_ABORTING) { - IPW_DEBUG_HC("Ignoring concurrent scan abort request.\n"); - return; - } - priv->status |= STATUS_SCAN_ABORTING; - - err = ipw_send_scan_abort(priv); - if (err) - IPW_DEBUG_HC("Request to abort scan failed.\n"); -} - -static void ipw_add_scan_channels(struct ipw_priv *priv, - struct ipw_scan_request_ext *scan, - int scan_type) -{ - int channel_index = 0; - const struct libipw_geo *geo; - int i; - - geo = libipw_get_geo(priv->ieee); - - if (priv->ieee->freq_band & LIBIPW_52GHZ_BAND) { - int start = channel_index; - for (i = 0; i < geo->a_channels; i++) { - if ((priv->status & STATUS_ASSOCIATED) && - geo->a[i].channel == priv->channel) - continue; - channel_index++; - scan->channels_list[channel_index] = geo->a[i].channel; - ipw_set_scan_type(scan, channel_index, - geo->a[i]. - flags & LIBIPW_CH_PASSIVE_ONLY ? - IPW_SCAN_PASSIVE_FULL_DWELL_SCAN : - scan_type); - } - - if (start != channel_index) { - scan->channels_list[start] = (u8) (IPW_A_MODE << 6) | - (channel_index - start); - channel_index++; - } - } - - if (priv->ieee->freq_band & LIBIPW_24GHZ_BAND) { - int start = channel_index; - if (priv->config & CFG_SPEED_SCAN) { - int index; - u8 channels[LIBIPW_24GHZ_CHANNELS] = { - /* nop out the list */ - [0] = 0 - }; - - u8 channel; - while (channel_index < IPW_SCAN_CHANNELS - 1) { - channel = - priv->speed_scan[priv->speed_scan_pos]; - if (channel == 0) { - priv->speed_scan_pos = 0; - channel = priv->speed_scan[0]; - } - if ((priv->status & STATUS_ASSOCIATED) && - channel == priv->channel) { - priv->speed_scan_pos++; - continue; - } - - /* If this channel has already been - * added in scan, break from loop - * and this will be the first channel - * in the next scan. - */ - if (channels[channel - 1] != 0) - break; - - channels[channel - 1] = 1; - priv->speed_scan_pos++; - channel_index++; - scan->channels_list[channel_index] = channel; - index = - libipw_channel_to_index(priv->ieee, channel); - ipw_set_scan_type(scan, channel_index, - geo->bg[index]. - flags & - LIBIPW_CH_PASSIVE_ONLY ? - IPW_SCAN_PASSIVE_FULL_DWELL_SCAN - : scan_type); - } - } else { - for (i = 0; i < geo->bg_channels; i++) { - if ((priv->status & STATUS_ASSOCIATED) && - geo->bg[i].channel == priv->channel) - continue; - channel_index++; - scan->channels_list[channel_index] = - geo->bg[i].channel; - ipw_set_scan_type(scan, channel_index, - geo->bg[i]. - flags & - LIBIPW_CH_PASSIVE_ONLY ? - IPW_SCAN_PASSIVE_FULL_DWELL_SCAN - : scan_type); - } - } - - if (start != channel_index) { - scan->channels_list[start] = (u8) (IPW_B_MODE << 6) | - (channel_index - start); - } - } -} - -static int ipw_passive_dwell_time(struct ipw_priv *priv) -{ - /* staying on passive channels longer than the DTIM interval during a - * scan, while associated, causes the firmware to cancel the scan - * without notification. Hence, don't stay on passive channels longer - * than the beacon interval. - */ - if (priv->status & STATUS_ASSOCIATED - && priv->assoc_network->beacon_interval > 10) - return priv->assoc_network->beacon_interval - 10; - else - return 120; -} - -static int ipw_request_scan_helper(struct ipw_priv *priv, int type, int direct) -{ - struct ipw_scan_request_ext scan; - int err = 0, scan_type; - - if (!(priv->status & STATUS_INIT) || - (priv->status & STATUS_EXIT_PENDING)) - return 0; - - mutex_lock(&priv->mutex); - - if (direct && (priv->direct_scan_ssid_len == 0)) { - IPW_DEBUG_HC("Direct scan requested but no SSID to scan for\n"); - priv->status &= ~STATUS_DIRECT_SCAN_PENDING; - goto done; - } - - if (priv->status & STATUS_SCANNING) { - IPW_DEBUG_HC("Concurrent scan requested. Queuing.\n"); - priv->status |= direct ? STATUS_DIRECT_SCAN_PENDING : - STATUS_SCAN_PENDING; - goto done; - } - - if (!(priv->status & STATUS_SCAN_FORCED) && - priv->status & STATUS_SCAN_ABORTING) { - IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n"); - priv->status |= direct ? STATUS_DIRECT_SCAN_PENDING : - STATUS_SCAN_PENDING; - goto done; - } - - if (priv->status & STATUS_RF_KILL_MASK) { - IPW_DEBUG_HC("Queuing scan due to RF Kill activation\n"); - priv->status |= direct ? STATUS_DIRECT_SCAN_PENDING : - STATUS_SCAN_PENDING; - goto done; - } - - memset(&scan, 0, sizeof(scan)); - scan.full_scan_index = cpu_to_le32(libipw_get_scans(priv->ieee)); - - if (type == IW_SCAN_TYPE_PASSIVE) { - IPW_DEBUG_WX("use passive scanning\n"); - scan_type = IPW_SCAN_PASSIVE_FULL_DWELL_SCAN; - scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = - cpu_to_le16(ipw_passive_dwell_time(priv)); - ipw_add_scan_channels(priv, &scan, scan_type); - goto send_request; - } - - /* Use active scan by default. */ - if (priv->config & CFG_SPEED_SCAN) - scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = - cpu_to_le16(30); - else - scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = - cpu_to_le16(20); - - scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = - cpu_to_le16(20); - - scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = - cpu_to_le16(ipw_passive_dwell_time(priv)); - scan.dwell_time[IPW_SCAN_ACTIVE_DIRECT_SCAN] = cpu_to_le16(20); - -#ifdef CONFIG_IPW2200_MONITOR - if (priv->ieee->iw_mode == IW_MODE_MONITOR) { - u8 channel; - u8 band = 0; - - switch (libipw_is_valid_channel(priv->ieee, priv->channel)) { - case LIBIPW_52GHZ_BAND: - band = (u8) (IPW_A_MODE << 6) | 1; - channel = priv->channel; - break; - - case LIBIPW_24GHZ_BAND: - band = (u8) (IPW_B_MODE << 6) | 1; - channel = priv->channel; - break; - - default: - band = (u8) (IPW_B_MODE << 6) | 1; - channel = 9; - break; - } - - scan.channels_list[0] = band; - scan.channels_list[1] = channel; - ipw_set_scan_type(&scan, 1, IPW_SCAN_PASSIVE_FULL_DWELL_SCAN); - - /* NOTE: The card will sit on this channel for this time - * period. Scan aborts are timing sensitive and frequently - * result in firmware restarts. As such, it is best to - * set a small dwell_time here and just keep re-issuing - * scans. Otherwise fast channel hopping will not actually - * hop channels. - * - * TODO: Move SPEED SCAN support to all modes and bands */ - scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = - cpu_to_le16(2000); - } else { -#endif /* CONFIG_IPW2200_MONITOR */ - /* Honor direct scans first, otherwise if we are roaming make - * this a direct scan for the current network. Finally, - * ensure that every other scan is a fast channel hop scan */ - if (direct) { - err = ipw_send_ssid(priv, priv->direct_scan_ssid, - priv->direct_scan_ssid_len); - if (err) { - IPW_DEBUG_HC("Attempt to send SSID command " - "failed\n"); - goto done; - } - - scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; - } else if ((priv->status & STATUS_ROAMING) - || (!(priv->status & STATUS_ASSOCIATED) - && (priv->config & CFG_STATIC_ESSID) - && (le32_to_cpu(scan.full_scan_index) % 2))) { - err = ipw_send_ssid(priv, priv->essid, priv->essid_len); - if (err) { - IPW_DEBUG_HC("Attempt to send SSID command " - "failed.\n"); - goto done; - } - - scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; - } else - scan_type = IPW_SCAN_ACTIVE_BROADCAST_SCAN; - - ipw_add_scan_channels(priv, &scan, scan_type); -#ifdef CONFIG_IPW2200_MONITOR - } -#endif - -send_request: - err = ipw_send_scan_request_ext(priv, &scan); - if (err) { - IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); - goto done; - } - - priv->status |= STATUS_SCANNING; - if (direct) { - priv->status &= ~STATUS_DIRECT_SCAN_PENDING; - priv->direct_scan_ssid_len = 0; - } else - priv->status &= ~STATUS_SCAN_PENDING; - - schedule_delayed_work(&priv->scan_check, IPW_SCAN_CHECK_WATCHDOG); -done: - mutex_unlock(&priv->mutex); - return err; -} - -static void ipw_request_passive_scan(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, request_passive_scan.work); - ipw_request_scan_helper(priv, IW_SCAN_TYPE_PASSIVE, 0); -} - -static void ipw_request_scan(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, request_scan.work); - ipw_request_scan_helper(priv, IW_SCAN_TYPE_ACTIVE, 0); -} - -static void ipw_request_direct_scan(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, request_direct_scan.work); - ipw_request_scan_helper(priv, IW_SCAN_TYPE_ACTIVE, 1); -} - -static void ipw_bg_abort_scan(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, abort_scan); - mutex_lock(&priv->mutex); - ipw_abort_scan(priv); - mutex_unlock(&priv->mutex); -} - -static int ipw_wpa_enable(struct ipw_priv *priv, int value) -{ - /* This is called when wpa_supplicant loads and closes the driver - * interface. */ - priv->ieee->wpa_enabled = value; - return 0; -} - -static int ipw_wpa_set_auth_algs(struct ipw_priv *priv, int value) -{ - struct libipw_device *ieee = priv->ieee; - struct libipw_security sec = { - .flags = SEC_AUTH_MODE, - }; - int ret = 0; - - if (value & IW_AUTH_ALG_SHARED_KEY) { - sec.auth_mode = WLAN_AUTH_SHARED_KEY; - ieee->open_wep = 0; - } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { - sec.auth_mode = WLAN_AUTH_OPEN; - ieee->open_wep = 1; - } else if (value & IW_AUTH_ALG_LEAP) { - sec.auth_mode = WLAN_AUTH_LEAP; - ieee->open_wep = 1; - } else - return -EINVAL; - - if (ieee->set_security) - ieee->set_security(ieee->dev, &sec); - else - ret = -EOPNOTSUPP; - - return ret; -} - -static void ipw_wpa_assoc_frame(struct ipw_priv *priv, char *wpa_ie, - int wpa_ie_len) -{ - /* make sure WPA is enabled */ - ipw_wpa_enable(priv, 1); -} - -static int ipw_set_rsn_capa(struct ipw_priv *priv, - char *capabilities, int length) -{ - IPW_DEBUG_HC("HOST_CMD_RSN_CAPABILITIES\n"); - - return ipw_send_cmd_pdu(priv, IPW_CMD_RSN_CAPABILITIES, length, - capabilities); -} - -/* - * WE-18 support - */ - -/* SIOCSIWGENIE */ -static int ipw_wx_set_genie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - struct libipw_device *ieee = priv->ieee; - u8 *buf; - int err = 0; - - if (wrqu->data.length > MAX_WPA_IE_LEN || - (wrqu->data.length && extra == NULL)) - return -EINVAL; - - if (wrqu->data.length) { - buf = kmemdup(extra, wrqu->data.length, GFP_KERNEL); - if (buf == NULL) { - err = -ENOMEM; - goto out; - } - - kfree(ieee->wpa_ie); - ieee->wpa_ie = buf; - ieee->wpa_ie_len = wrqu->data.length; - } else { - kfree(ieee->wpa_ie); - ieee->wpa_ie = NULL; - ieee->wpa_ie_len = 0; - } - - ipw_wpa_assoc_frame(priv, ieee->wpa_ie, ieee->wpa_ie_len); - out: - return err; -} - -/* SIOCGIWGENIE */ -static int ipw_wx_get_genie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - struct libipw_device *ieee = priv->ieee; - int err = 0; - - if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { - wrqu->data.length = 0; - goto out; - } - - if (wrqu->data.length < ieee->wpa_ie_len) { - err = -E2BIG; - goto out; - } - - wrqu->data.length = ieee->wpa_ie_len; - memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); - - out: - return err; -} - -static int wext_cipher2level(int cipher) -{ - switch (cipher) { - case IW_AUTH_CIPHER_NONE: - return SEC_LEVEL_0; - case IW_AUTH_CIPHER_WEP40: - case IW_AUTH_CIPHER_WEP104: - return SEC_LEVEL_1; - case IW_AUTH_CIPHER_TKIP: - return SEC_LEVEL_2; - case IW_AUTH_CIPHER_CCMP: - return SEC_LEVEL_3; - default: - return -1; - } -} - -/* SIOCSIWAUTH */ -static int ipw_wx_set_auth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - struct libipw_device *ieee = priv->ieee; - struct iw_param *param = &wrqu->param; - struct lib80211_crypt_data *crypt; - unsigned long flags; - int ret = 0; - - switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: - break; - case IW_AUTH_CIPHER_PAIRWISE: - ipw_set_hw_decrypt_unicast(priv, - wext_cipher2level(param->value)); - break; - case IW_AUTH_CIPHER_GROUP: - ipw_set_hw_decrypt_multicast(priv, - wext_cipher2level(param->value)); - break; - case IW_AUTH_KEY_MGMT: - /* - * ipw2200 does not use these parameters - */ - break; - - case IW_AUTH_TKIP_COUNTERMEASURES: - crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx]; - if (!crypt || !crypt->ops->set_flags || !crypt->ops->get_flags) - break; - - flags = crypt->ops->get_flags(crypt->priv); - - if (param->value) - flags |= IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; - else - flags &= ~IEEE80211_CRYPTO_TKIP_COUNTERMEASURES; - - crypt->ops->set_flags(flags, crypt->priv); - - break; - - case IW_AUTH_DROP_UNENCRYPTED:{ - /* HACK: - * - * wpa_supplicant calls set_wpa_enabled when the driver - * is loaded and unloaded, regardless of if WPA is being - * used. No other calls are made which can be used to - * determine if encryption will be used or not prior to - * association being expected. If encryption is not being - * used, drop_unencrypted is set to false, else true -- we - * can use this to determine if the CAP_PRIVACY_ON bit should - * be set. - */ - struct libipw_security sec = { - .flags = SEC_ENABLED, - .enabled = param->value, - }; - priv->ieee->drop_unencrypted = param->value; - /* We only change SEC_LEVEL for open mode. Others - * are set by ipw_wpa_set_encryption. - */ - if (!param->value) { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_0; - } else { - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_1; - } - if (priv->ieee->set_security) - priv->ieee->set_security(priv->ieee->dev, &sec); - break; - } - - case IW_AUTH_80211_AUTH_ALG: - ret = ipw_wpa_set_auth_algs(priv, param->value); - break; - - case IW_AUTH_WPA_ENABLED: - ret = ipw_wpa_enable(priv, param->value); - ipw_disassociate(priv); - break; - - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - ieee->ieee802_1x = param->value; - break; - - case IW_AUTH_PRIVACY_INVOKED: - ieee->privacy_invoked = param->value; - break; - - default: - return -EOPNOTSUPP; - } - return ret; -} - -/* SIOCGIWAUTH */ -static int ipw_wx_get_auth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - struct libipw_device *ieee = priv->ieee; - struct lib80211_crypt_data *crypt; - struct iw_param *param = &wrqu->param; - - switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_KEY_MGMT: - /* - * wpa_supplicant will control these internally - */ - return -EOPNOTSUPP; - - case IW_AUTH_TKIP_COUNTERMEASURES: - crypt = priv->ieee->crypt_info.crypt[priv->ieee->crypt_info.tx_keyidx]; - if (!crypt || !crypt->ops->get_flags) - break; - - param->value = (crypt->ops->get_flags(crypt->priv) & - IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) ? 1 : 0; - - break; - - case IW_AUTH_DROP_UNENCRYPTED: - param->value = ieee->drop_unencrypted; - break; - - case IW_AUTH_80211_AUTH_ALG: - param->value = ieee->sec.auth_mode; - break; - - case IW_AUTH_WPA_ENABLED: - param->value = ieee->wpa_enabled; - break; - - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - param->value = ieee->ieee802_1x; - break; - - case IW_AUTH_ROAMING_CONTROL: - case IW_AUTH_PRIVACY_INVOKED: - param->value = ieee->privacy_invoked; - break; - - default: - return -EOPNOTSUPP; - } - return 0; -} - -/* SIOCSIWENCODEEXT */ -static int ipw_wx_set_encodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - - if (hwcrypto) { - if (ext->alg == IW_ENCODE_ALG_TKIP) { - /* IPW HW can't build TKIP MIC, - host decryption still needed */ - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) - priv->ieee->host_mc_decrypt = 1; - else { - priv->ieee->host_encrypt = 0; - priv->ieee->host_encrypt_msdu = 1; - priv->ieee->host_decrypt = 1; - } - } else { - priv->ieee->host_encrypt = 0; - priv->ieee->host_encrypt_msdu = 0; - priv->ieee->host_decrypt = 0; - priv->ieee->host_mc_decrypt = 0; - } - } - - return libipw_wx_set_encodeext(priv->ieee, info, wrqu, extra); -} - -/* SIOCGIWENCODEEXT */ -static int ipw_wx_get_encodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - return libipw_wx_get_encodeext(priv->ieee, info, wrqu, extra); -} - -/* SIOCSIWMLME */ -static int ipw_wx_set_mlme(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - struct iw_mlme *mlme = (struct iw_mlme *)extra; - __le16 reason; - - reason = cpu_to_le16(mlme->reason_code); - - switch (mlme->cmd) { - case IW_MLME_DEAUTH: - /* silently ignore */ - break; - - case IW_MLME_DISASSOC: - ipw_disassociate(priv); - break; - - default: - return -EOPNOTSUPP; - } - return 0; -} - -#ifdef CONFIG_IPW2200_QOS - -/* QoS */ -/* -* get the modulation type of the current network or -* the card current mode -*/ -static u8 ipw_qos_current_mode(struct ipw_priv * priv) -{ - u8 mode = 0; - - if (priv->status & STATUS_ASSOCIATED) { - unsigned long flags; - - spin_lock_irqsave(&priv->ieee->lock, flags); - mode = priv->assoc_network->mode; - spin_unlock_irqrestore(&priv->ieee->lock, flags); - } else { - mode = priv->ieee->mode; - } - IPW_DEBUG_QOS("QoS network/card mode %d\n", mode); - return mode; -} - -/* -* Handle management frame beacon and probe response -*/ -static int ipw_qos_handle_probe_response(struct ipw_priv *priv, - int active_network, - struct libipw_network *network) -{ - u32 size = sizeof(struct libipw_qos_parameters); - - if (network->capability & WLAN_CAPABILITY_IBSS) - network->qos_data.active = network->qos_data.supported; - - if (network->flags & NETWORK_HAS_QOS_MASK) { - if (active_network && - (network->flags & NETWORK_HAS_QOS_PARAMETERS)) - network->qos_data.active = network->qos_data.supported; - - if ((network->qos_data.active == 1) && (active_network == 1) && - (network->flags & NETWORK_HAS_QOS_PARAMETERS) && - (network->qos_data.old_param_count != - network->qos_data.param_count)) { - network->qos_data.old_param_count = - network->qos_data.param_count; - schedule_work(&priv->qos_activate); - IPW_DEBUG_QOS("QoS parameters change call " - "qos_activate\n"); - } - } else { - if ((priv->ieee->mode == IEEE_B) || (network->mode == IEEE_B)) - memcpy(&network->qos_data.parameters, - &def_parameters_CCK, size); - else - memcpy(&network->qos_data.parameters, - &def_parameters_OFDM, size); - - if ((network->qos_data.active == 1) && (active_network == 1)) { - IPW_DEBUG_QOS("QoS was disabled call qos_activate\n"); - schedule_work(&priv->qos_activate); - } - - network->qos_data.active = 0; - network->qos_data.supported = 0; - } - if ((priv->status & STATUS_ASSOCIATED) && - (priv->ieee->iw_mode == IW_MODE_ADHOC) && (active_network == 0)) { - if (memcmp(network->bssid, priv->bssid, ETH_ALEN)) - if (network->capability & WLAN_CAPABILITY_IBSS) - if ((network->ssid_len == - priv->assoc_network->ssid_len) && - !memcmp(network->ssid, - priv->assoc_network->ssid, - network->ssid_len)) { - schedule_work(&priv->merge_networks); - } - } - - return 0; -} - -/* -* This function set up the firmware to support QoS. It sends -* IPW_CMD_QOS_PARAMETERS and IPW_CMD_WME_INFO -*/ -static int ipw_qos_activate(struct ipw_priv *priv, - struct libipw_qos_data *qos_network_data) -{ - int err; - struct libipw_qos_parameters qos_parameters[QOS_QOS_SETS]; - struct libipw_qos_parameters *active_one = NULL; - u32 size = sizeof(struct libipw_qos_parameters); - u32 burst_duration; - int i; - u8 type; - - type = ipw_qos_current_mode(priv); - - active_one = &(qos_parameters[QOS_PARAM_SET_DEF_CCK]); - memcpy(active_one, priv->qos_data.def_qos_parm_CCK, size); - active_one = &(qos_parameters[QOS_PARAM_SET_DEF_OFDM]); - memcpy(active_one, priv->qos_data.def_qos_parm_OFDM, size); - - if (qos_network_data == NULL) { - if (type == IEEE_B) { - IPW_DEBUG_QOS("QoS activate network mode %d\n", type); - active_one = &def_parameters_CCK; - } else - active_one = &def_parameters_OFDM; - - memcpy(&qos_parameters[QOS_PARAM_SET_ACTIVE], active_one, size); - burst_duration = ipw_qos_get_burst_duration(priv); - for (i = 0; i < QOS_QUEUE_NUM; i++) - qos_parameters[QOS_PARAM_SET_ACTIVE].tx_op_limit[i] = - cpu_to_le16(burst_duration); - } else if (priv->ieee->iw_mode == IW_MODE_ADHOC) { - if (type == IEEE_B) { - IPW_DEBUG_QOS("QoS activate IBSS network mode %d\n", - type); - if (priv->qos_data.qos_enable == 0) - active_one = &def_parameters_CCK; - else - active_one = priv->qos_data.def_qos_parm_CCK; - } else { - if (priv->qos_data.qos_enable == 0) - active_one = &def_parameters_OFDM; - else - active_one = priv->qos_data.def_qos_parm_OFDM; - } - memcpy(&qos_parameters[QOS_PARAM_SET_ACTIVE], active_one, size); - } else { - unsigned long flags; - int active; - - spin_lock_irqsave(&priv->ieee->lock, flags); - active_one = &(qos_network_data->parameters); - qos_network_data->old_param_count = - qos_network_data->param_count; - memcpy(&qos_parameters[QOS_PARAM_SET_ACTIVE], active_one, size); - active = qos_network_data->supported; - spin_unlock_irqrestore(&priv->ieee->lock, flags); - - if (active == 0) { - burst_duration = ipw_qos_get_burst_duration(priv); - for (i = 0; i < QOS_QUEUE_NUM; i++) - qos_parameters[QOS_PARAM_SET_ACTIVE]. - tx_op_limit[i] = cpu_to_le16(burst_duration); - } - } - - IPW_DEBUG_QOS("QoS sending IPW_CMD_QOS_PARAMETERS\n"); - err = ipw_send_qos_params_command(priv, &qos_parameters[0]); - if (err) - IPW_DEBUG_QOS("QoS IPW_CMD_QOS_PARAMETERS failed\n"); - - return err; -} - -/* -* send IPW_CMD_WME_INFO to the firmware -*/ -static int ipw_qos_set_info_element(struct ipw_priv *priv) -{ - int ret = 0; - struct libipw_qos_information_element qos_info; - - if (priv == NULL) - return -1; - - qos_info.elementID = QOS_ELEMENT_ID; - qos_info.length = sizeof(struct libipw_qos_information_element) - 2; - - qos_info.version = QOS_VERSION_1; - qos_info.ac_info = 0; - - memcpy(qos_info.qui, qos_oui, QOS_OUI_LEN); - qos_info.qui_type = QOS_OUI_TYPE; - qos_info.qui_subtype = QOS_OUI_INFO_SUB_TYPE; - - ret = ipw_send_qos_info_command(priv, &qos_info); - if (ret != 0) { - IPW_DEBUG_QOS("QoS error calling ipw_send_qos_info_command\n"); - } - return ret; -} - -/* -* Set the QoS parameter with the association request structure -*/ -static int ipw_qos_association(struct ipw_priv *priv, - struct libipw_network *network) -{ - int err = 0; - struct libipw_qos_data *qos_data = NULL; - struct libipw_qos_data ibss_data = { - .supported = 1, - .active = 1, - }; - - switch (priv->ieee->iw_mode) { - case IW_MODE_ADHOC: - BUG_ON(!(network->capability & WLAN_CAPABILITY_IBSS)); - - qos_data = &ibss_data; - break; - - case IW_MODE_INFRA: - qos_data = &network->qos_data; - break; - - default: - BUG(); - break; - } - - err = ipw_qos_activate(priv, qos_data); - if (err) { - priv->assoc_request.policy_support &= ~HC_QOS_SUPPORT_ASSOC; - return err; - } - - if (priv->qos_data.qos_enable && qos_data->supported) { - IPW_DEBUG_QOS("QoS will be enabled for this association\n"); - priv->assoc_request.policy_support |= HC_QOS_SUPPORT_ASSOC; - return ipw_qos_set_info_element(priv); - } - - return 0; -} - -/* -* handling the beaconing responses. if we get different QoS setting -* off the network from the associated setting, adjust the QoS -* setting -*/ -static int ipw_qos_association_resp(struct ipw_priv *priv, - struct libipw_network *network) -{ - int ret = 0; - unsigned long flags; - u32 size = sizeof(struct libipw_qos_parameters); - int set_qos_param = 0; - - if ((priv == NULL) || (network == NULL) || - (priv->assoc_network == NULL)) - return ret; - - if (!(priv->status & STATUS_ASSOCIATED)) - return ret; - - if ((priv->ieee->iw_mode != IW_MODE_INFRA)) - return ret; - - spin_lock_irqsave(&priv->ieee->lock, flags); - if (network->flags & NETWORK_HAS_QOS_PARAMETERS) { - memcpy(&priv->assoc_network->qos_data, &network->qos_data, - sizeof(struct libipw_qos_data)); - priv->assoc_network->qos_data.active = 1; - if ((network->qos_data.old_param_count != - network->qos_data.param_count)) { - set_qos_param = 1; - network->qos_data.old_param_count = - network->qos_data.param_count; - } - - } else { - if ((network->mode == IEEE_B) || (priv->ieee->mode == IEEE_B)) - memcpy(&priv->assoc_network->qos_data.parameters, - &def_parameters_CCK, size); - else - memcpy(&priv->assoc_network->qos_data.parameters, - &def_parameters_OFDM, size); - priv->assoc_network->qos_data.active = 0; - priv->assoc_network->qos_data.supported = 0; - set_qos_param = 1; - } - - spin_unlock_irqrestore(&priv->ieee->lock, flags); - - if (set_qos_param == 1) - schedule_work(&priv->qos_activate); - - return ret; -} - -static u32 ipw_qos_get_burst_duration(struct ipw_priv *priv) -{ - u32 ret = 0; - - if ((priv == NULL)) - return 0; - - if (!(priv->ieee->modulation & LIBIPW_OFDM_MODULATION)) - ret = priv->qos_data.burst_duration_CCK; - else - ret = priv->qos_data.burst_duration_OFDM; - - return ret; -} - -/* -* Initialize the setting of QoS global -*/ -static void ipw_qos_init(struct ipw_priv *priv, int enable, - int burst_enable, u32 burst_duration_CCK, - u32 burst_duration_OFDM) -{ - priv->qos_data.qos_enable = enable; - - if (priv->qos_data.qos_enable) { - priv->qos_data.def_qos_parm_CCK = &def_qos_parameters_CCK; - priv->qos_data.def_qos_parm_OFDM = &def_qos_parameters_OFDM; - IPW_DEBUG_QOS("QoS is enabled\n"); - } else { - priv->qos_data.def_qos_parm_CCK = &def_parameters_CCK; - priv->qos_data.def_qos_parm_OFDM = &def_parameters_OFDM; - IPW_DEBUG_QOS("QoS is not enabled\n"); - } - - priv->qos_data.burst_enable = burst_enable; - - if (burst_enable) { - priv->qos_data.burst_duration_CCK = burst_duration_CCK; - priv->qos_data.burst_duration_OFDM = burst_duration_OFDM; - } else { - priv->qos_data.burst_duration_CCK = 0; - priv->qos_data.burst_duration_OFDM = 0; - } -} - -/* -* map the packet priority to the right TX Queue -*/ -static int ipw_get_tx_queue_number(struct ipw_priv *priv, u16 priority) -{ - if (priority > 7 || !priv->qos_data.qos_enable) - priority = 0; - - return from_priority_to_tx_queue[priority] - 1; -} - -static int ipw_is_qos_active(struct net_device *dev, - struct sk_buff *skb) -{ - struct ipw_priv *priv = libipw_priv(dev); - struct libipw_qos_data *qos_data = NULL; - int active, supported; - u8 *daddr = skb->data + ETH_ALEN; - int unicast = !is_multicast_ether_addr(daddr); - - if (!(priv->status & STATUS_ASSOCIATED)) - return 0; - - qos_data = &priv->assoc_network->qos_data; - - if (priv->ieee->iw_mode == IW_MODE_ADHOC) { - if (unicast == 0) - qos_data->active = 0; - else - qos_data->active = qos_data->supported; - } - active = qos_data->active; - supported = qos_data->supported; - IPW_DEBUG_QOS("QoS %d network is QoS active %d supported %d " - "unicast %d\n", - priv->qos_data.qos_enable, active, supported, unicast); - if (active && priv->qos_data.qos_enable) - return 1; - - return 0; - -} -/* -* add QoS parameter to the TX command -*/ -static int ipw_qos_set_tx_queue_command(struct ipw_priv *priv, - u16 priority, - struct tfd_data *tfd) -{ - int tx_queue_id = 0; - - - tx_queue_id = from_priority_to_tx_queue[priority] - 1; - tfd->tx_flags_ext |= DCT_FLAG_EXT_QOS_ENABLED; - - if (priv->qos_data.qos_no_ack_mask & (1UL << tx_queue_id)) { - tfd->tx_flags &= ~DCT_FLAG_ACK_REQD; - tfd->tfd.tfd_26.mchdr.qos_ctrl |= cpu_to_le16(CTRL_QOS_NO_ACK); - } - return 0; -} - -/* -* background support to run QoS activate functionality -*/ -static void ipw_bg_qos_activate(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, qos_activate); - - mutex_lock(&priv->mutex); - - if (priv->status & STATUS_ASSOCIATED) - ipw_qos_activate(priv, &(priv->assoc_network->qos_data)); - - mutex_unlock(&priv->mutex); -} - -static int ipw_handle_probe_response(struct net_device *dev, - struct libipw_probe_response *resp, - struct libipw_network *network) -{ - struct ipw_priv *priv = libipw_priv(dev); - int active_network = ((priv->status & STATUS_ASSOCIATED) && - (network == priv->assoc_network)); - - ipw_qos_handle_probe_response(priv, active_network, network); - - return 0; -} - -static int ipw_handle_beacon(struct net_device *dev, - struct libipw_beacon *resp, - struct libipw_network *network) -{ - struct ipw_priv *priv = libipw_priv(dev); - int active_network = ((priv->status & STATUS_ASSOCIATED) && - (network == priv->assoc_network)); - - ipw_qos_handle_probe_response(priv, active_network, network); - - return 0; -} - -static int ipw_handle_assoc_response(struct net_device *dev, - struct libipw_assoc_response *resp, - struct libipw_network *network) -{ - struct ipw_priv *priv = libipw_priv(dev); - ipw_qos_association_resp(priv, network); - return 0; -} - -static int ipw_send_qos_params_command(struct ipw_priv *priv, struct libipw_qos_parameters - *qos_param) -{ - return ipw_send_cmd_pdu(priv, IPW_CMD_QOS_PARAMETERS, - sizeof(*qos_param) * 3, qos_param); -} - -static int ipw_send_qos_info_command(struct ipw_priv *priv, struct libipw_qos_information_element - *qos_param) -{ - return ipw_send_cmd_pdu(priv, IPW_CMD_WME_INFO, sizeof(*qos_param), - qos_param); -} - -#endif /* CONFIG_IPW2200_QOS */ - -static int ipw_associate_network(struct ipw_priv *priv, - struct libipw_network *network, - struct ipw_supported_rates *rates, int roaming) -{ - int err; - DECLARE_SSID_BUF(ssid); - - if (priv->config & CFG_FIXED_RATE) - ipw_set_fixed_rate(priv, network->mode); - - if (!(priv->config & CFG_STATIC_ESSID)) { - priv->essid_len = min(network->ssid_len, - (u8) IW_ESSID_MAX_SIZE); - memcpy(priv->essid, network->ssid, priv->essid_len); - } - - network->last_associate = jiffies; - - memset(&priv->assoc_request, 0, sizeof(priv->assoc_request)); - priv->assoc_request.channel = network->channel; - priv->assoc_request.auth_key = 0; - - if ((priv->capability & CAP_PRIVACY_ON) && - (priv->ieee->sec.auth_mode == WLAN_AUTH_SHARED_KEY)) { - priv->assoc_request.auth_type = AUTH_SHARED_KEY; - priv->assoc_request.auth_key = priv->ieee->sec.active_key; - - if (priv->ieee->sec.level == SEC_LEVEL_1) - ipw_send_wep_keys(priv, DCW_WEP_KEY_SEC_TYPE_WEP); - - } else if ((priv->capability & CAP_PRIVACY_ON) && - (priv->ieee->sec.auth_mode == WLAN_AUTH_LEAP)) - priv->assoc_request.auth_type = AUTH_LEAP; - else - priv->assoc_request.auth_type = AUTH_OPEN; - - if (priv->ieee->wpa_ie_len) { - priv->assoc_request.policy_support = cpu_to_le16(0x02); /* RSN active */ - ipw_set_rsn_capa(priv, priv->ieee->wpa_ie, - priv->ieee->wpa_ie_len); - } - - /* - * It is valid for our ieee device to support multiple modes, but - * when it comes to associating to a given network we have to choose - * just one mode. - */ - if (network->mode & priv->ieee->mode & IEEE_A) - priv->assoc_request.ieee_mode = IPW_A_MODE; - else if (network->mode & priv->ieee->mode & IEEE_G) - priv->assoc_request.ieee_mode = IPW_G_MODE; - else if (network->mode & priv->ieee->mode & IEEE_B) - priv->assoc_request.ieee_mode = IPW_B_MODE; - - priv->assoc_request.capability = cpu_to_le16(network->capability); - if ((network->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) - && !(priv->config & CFG_PREAMBLE_LONG)) { - priv->assoc_request.preamble_length = DCT_FLAG_SHORT_PREAMBLE; - } else { - priv->assoc_request.preamble_length = DCT_FLAG_LONG_PREAMBLE; - - /* Clear the short preamble if we won't be supporting it */ - priv->assoc_request.capability &= - ~cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE); - } - - /* Clear capability bits that aren't used in Ad Hoc */ - if (priv->ieee->iw_mode == IW_MODE_ADHOC) - priv->assoc_request.capability &= - ~cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME); - - IPW_DEBUG_ASSOC("%ssociation attempt: '%s', channel %d, " - "802.11%c [%d], %s[:%s], enc=%s%s%s%c%c\n", - roaming ? "Rea" : "A", - print_ssid(ssid, priv->essid, priv->essid_len), - network->channel, - ipw_modes[priv->assoc_request.ieee_mode], - rates->num_rates, - (priv->assoc_request.preamble_length == - DCT_FLAG_LONG_PREAMBLE) ? "long" : "short", - network->capability & - WLAN_CAPABILITY_SHORT_PREAMBLE ? "short" : "long", - priv->capability & CAP_PRIVACY_ON ? "on " : "off", - priv->capability & CAP_PRIVACY_ON ? - (priv->capability & CAP_SHARED_KEY ? "(shared)" : - "(open)") : "", - priv->capability & CAP_PRIVACY_ON ? " key=" : "", - priv->capability & CAP_PRIVACY_ON ? - '1' + priv->ieee->sec.active_key : '.', - priv->capability & CAP_PRIVACY_ON ? '.' : ' '); - - priv->assoc_request.beacon_interval = cpu_to_le16(network->beacon_interval); - if ((priv->ieee->iw_mode == IW_MODE_ADHOC) && - (network->time_stamp[0] == 0) && (network->time_stamp[1] == 0)) { - priv->assoc_request.assoc_type = HC_IBSS_START; - priv->assoc_request.assoc_tsf_msw = 0; - priv->assoc_request.assoc_tsf_lsw = 0; - } else { - if (unlikely(roaming)) - priv->assoc_request.assoc_type = HC_REASSOCIATE; - else - priv->assoc_request.assoc_type = HC_ASSOCIATE; - priv->assoc_request.assoc_tsf_msw = cpu_to_le32(network->time_stamp[1]); - priv->assoc_request.assoc_tsf_lsw = cpu_to_le32(network->time_stamp[0]); - } - - memcpy(priv->assoc_request.bssid, network->bssid, ETH_ALEN); - - if (priv->ieee->iw_mode == IW_MODE_ADHOC) { - memset(&priv->assoc_request.dest, 0xFF, ETH_ALEN); - priv->assoc_request.atim_window = cpu_to_le16(network->atim_window); - } else { - memcpy(priv->assoc_request.dest, network->bssid, ETH_ALEN); - priv->assoc_request.atim_window = 0; - } - - priv->assoc_request.listen_interval = cpu_to_le16(network->listen_interval); - - err = ipw_send_ssid(priv, priv->essid, priv->essid_len); - if (err) { - IPW_DEBUG_HC("Attempt to send SSID command failed.\n"); - return err; - } - - rates->ieee_mode = priv->assoc_request.ieee_mode; - rates->purpose = IPW_RATE_CONNECT; - ipw_send_supported_rates(priv, rates); - - if (priv->assoc_request.ieee_mode == IPW_G_MODE) - priv->sys_config.dot11g_auto_detection = 1; - else - priv->sys_config.dot11g_auto_detection = 0; - - if (priv->ieee->iw_mode == IW_MODE_ADHOC) - priv->sys_config.answer_broadcast_ssid_probe = 1; - else - priv->sys_config.answer_broadcast_ssid_probe = 0; - - err = ipw_send_system_config(priv); - if (err) { - IPW_DEBUG_HC("Attempt to send sys config command failed.\n"); - return err; - } - - IPW_DEBUG_ASSOC("Association sensitivity: %d\n", network->stats.rssi); - err = ipw_set_sensitivity(priv, network->stats.rssi + IPW_RSSI_TO_DBM); - if (err) { - IPW_DEBUG_HC("Attempt to send associate command failed.\n"); - return err; - } - - /* - * If preemption is enabled, it is possible for the association - * to complete before we return from ipw_send_associate. Therefore - * we have to be sure and update our priviate data first. - */ - priv->channel = network->channel; - memcpy(priv->bssid, network->bssid, ETH_ALEN); - priv->status |= STATUS_ASSOCIATING; - priv->status &= ~STATUS_SECURITY_UPDATED; - - priv->assoc_network = network; - -#ifdef CONFIG_IPW2200_QOS - ipw_qos_association(priv, network); -#endif - - err = ipw_send_associate(priv, &priv->assoc_request); - if (err) { - IPW_DEBUG_HC("Attempt to send associate command failed.\n"); - return err; - } - - IPW_DEBUG(IPW_DL_STATE, "associating: '%s' %pM\n", - print_ssid(ssid, priv->essid, priv->essid_len), - priv->bssid); - - return 0; -} - -static void ipw_roam(void *data) -{ - struct ipw_priv *priv = data; - struct libipw_network *network = NULL; - struct ipw_network_match match = { - .network = priv->assoc_network - }; - - /* The roaming process is as follows: - * - * 1. Missed beacon threshold triggers the roaming process by - * setting the status ROAM bit and requesting a scan. - * 2. When the scan completes, it schedules the ROAM work - * 3. The ROAM work looks at all of the known networks for one that - * is a better network than the currently associated. If none - * found, the ROAM process is over (ROAM bit cleared) - * 4. If a better network is found, a disassociation request is - * sent. - * 5. When the disassociation completes, the roam work is again - * scheduled. The second time through, the driver is no longer - * associated, and the newly selected network is sent an - * association request. - * 6. At this point ,the roaming process is complete and the ROAM - * status bit is cleared. - */ - - /* If we are no longer associated, and the roaming bit is no longer - * set, then we are not actively roaming, so just return */ - if (!(priv->status & (STATUS_ASSOCIATED | STATUS_ROAMING))) - return; - - if (priv->status & STATUS_ASSOCIATED) { - /* First pass through ROAM process -- look for a better - * network */ - unsigned long flags; - u8 rssi = priv->assoc_network->stats.rssi; - priv->assoc_network->stats.rssi = -128; - spin_lock_irqsave(&priv->ieee->lock, flags); - list_for_each_entry(network, &priv->ieee->network_list, list) { - if (network != priv->assoc_network) - ipw_best_network(priv, &match, network, 1); - } - spin_unlock_irqrestore(&priv->ieee->lock, flags); - priv->assoc_network->stats.rssi = rssi; - - if (match.network == priv->assoc_network) { - IPW_DEBUG_ASSOC("No better APs in this network to " - "roam to.\n"); - priv->status &= ~STATUS_ROAMING; - ipw_debug_config(priv); - return; - } - - ipw_send_disassociate(priv, 1); - priv->assoc_network = match.network; - - return; - } - - /* Second pass through ROAM process -- request association */ - ipw_compatible_rates(priv, priv->assoc_network, &match.rates); - ipw_associate_network(priv, priv->assoc_network, &match.rates, 1); - priv->status &= ~STATUS_ROAMING; -} - -static void ipw_bg_roam(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, roam); - mutex_lock(&priv->mutex); - ipw_roam(priv); - mutex_unlock(&priv->mutex); -} - -static int ipw_associate(void *data) -{ - struct ipw_priv *priv = data; - - struct libipw_network *network = NULL; - struct ipw_network_match match = { - .network = NULL - }; - struct ipw_supported_rates *rates; - struct list_head *element; - unsigned long flags; - DECLARE_SSID_BUF(ssid); - - if (priv->ieee->iw_mode == IW_MODE_MONITOR) { - IPW_DEBUG_ASSOC("Not attempting association (monitor mode)\n"); - return 0; - } - - if (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { - IPW_DEBUG_ASSOC("Not attempting association (already in " - "progress)\n"); - return 0; - } - - if (priv->status & STATUS_DISASSOCIATING) { - IPW_DEBUG_ASSOC("Not attempting association (in " - "disassociating)\n "); - schedule_work(&priv->associate); - return 0; - } - - if (!ipw_is_init(priv) || (priv->status & STATUS_SCANNING)) { - IPW_DEBUG_ASSOC("Not attempting association (scanning or not " - "initialized)\n"); - return 0; - } - - if (!(priv->config & CFG_ASSOCIATE) && - !(priv->config & (CFG_STATIC_ESSID | CFG_STATIC_BSSID))) { - IPW_DEBUG_ASSOC("Not attempting association (associate=0)\n"); - return 0; - } - - /* Protect our use of the network_list */ - spin_lock_irqsave(&priv->ieee->lock, flags); - list_for_each_entry(network, &priv->ieee->network_list, list) - ipw_best_network(priv, &match, network, 0); - - network = match.network; - rates = &match.rates; - - if (network == NULL && - priv->ieee->iw_mode == IW_MODE_ADHOC && - priv->config & CFG_ADHOC_CREATE && - priv->config & CFG_STATIC_ESSID && - priv->config & CFG_STATIC_CHANNEL) { - /* Use oldest network if the free list is empty */ - if (list_empty(&priv->ieee->network_free_list)) { - struct libipw_network *oldest = NULL; - struct libipw_network *target; - - list_for_each_entry(target, &priv->ieee->network_list, list) { - if ((oldest == NULL) || - (target->last_scanned < oldest->last_scanned)) - oldest = target; - } - - /* If there are no more slots, expire the oldest */ - list_del(&oldest->list); - target = oldest; - IPW_DEBUG_ASSOC("Expired '%s' (%pM) from " - "network list.\n", - print_ssid(ssid, target->ssid, - target->ssid_len), - target->bssid); - list_add_tail(&target->list, - &priv->ieee->network_free_list); - } - - element = priv->ieee->network_free_list.next; - network = list_entry(element, struct libipw_network, list); - ipw_adhoc_create(priv, network); - rates = &priv->rates; - list_del(element); - list_add_tail(&network->list, &priv->ieee->network_list); - } - spin_unlock_irqrestore(&priv->ieee->lock, flags); - - /* If we reached the end of the list, then we don't have any valid - * matching APs */ - if (!network) { - ipw_debug_config(priv); - - if (!(priv->status & STATUS_SCANNING)) { - if (!(priv->config & CFG_SPEED_SCAN)) - schedule_delayed_work(&priv->request_scan, - SCAN_INTERVAL); - else - schedule_delayed_work(&priv->request_scan, 0); - } - - return 0; - } - - ipw_associate_network(priv, network, rates, 0); - - return 1; -} - -static void ipw_bg_associate(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, associate); - mutex_lock(&priv->mutex); - ipw_associate(priv); - mutex_unlock(&priv->mutex); -} - -static void ipw_rebuild_decrypted_skb(struct ipw_priv *priv, - struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr; - u16 fc; - - hdr = (struct ieee80211_hdr *)skb->data; - fc = le16_to_cpu(hdr->frame_control); - if (!(fc & IEEE80211_FCTL_PROTECTED)) - return; - - fc &= ~IEEE80211_FCTL_PROTECTED; - hdr->frame_control = cpu_to_le16(fc); - switch (priv->ieee->sec.level) { - case SEC_LEVEL_3: - /* Remove CCMP HDR */ - memmove(skb->data + LIBIPW_3ADDR_LEN, - skb->data + LIBIPW_3ADDR_LEN + 8, - skb->len - LIBIPW_3ADDR_LEN - 8); - skb_trim(skb, skb->len - 16); /* CCMP_HDR_LEN + CCMP_MIC_LEN */ - break; - case SEC_LEVEL_2: - break; - case SEC_LEVEL_1: - /* Remove IV */ - memmove(skb->data + LIBIPW_3ADDR_LEN, - skb->data + LIBIPW_3ADDR_LEN + 4, - skb->len - LIBIPW_3ADDR_LEN - 4); - skb_trim(skb, skb->len - 8); /* IV + ICV */ - break; - case SEC_LEVEL_0: - break; - default: - printk(KERN_ERR "Unknown security level %d\n", - priv->ieee->sec.level); - break; - } -} - -static void ipw_handle_data_packet(struct ipw_priv *priv, - struct ipw_rx_mem_buffer *rxb, - struct libipw_rx_stats *stats) -{ - struct net_device *dev = priv->net_dev; - struct libipw_hdr_4addr *hdr; - struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)rxb->skb->data; - - /* We received data from the HW, so stop the watchdog */ - dev->trans_start = jiffies; - - /* We only process data packets if the - * interface is open */ - if (unlikely((le16_to_cpu(pkt->u.frame.length) + IPW_RX_FRAME_SIZE) > - skb_tailroom(rxb->skb))) { - dev->stats.rx_errors++; - priv->wstats.discard.misc++; - IPW_DEBUG_DROP("Corruption detected! Oh no!\n"); - return; - } else if (unlikely(!netif_running(priv->net_dev))) { - dev->stats.rx_dropped++; - priv->wstats.discard.misc++; - IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); - return; - } - - /* Advance skb->data to the start of the actual payload */ - skb_reserve(rxb->skb, offsetof(struct ipw_rx_packet, u.frame.data)); - - /* Set the size of the skb to the size of the frame */ - skb_put(rxb->skb, le16_to_cpu(pkt->u.frame.length)); - - IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); - - /* HW decrypt will not clear the WEP bit, MIC, PN, etc. */ - hdr = (struct libipw_hdr_4addr *)rxb->skb->data; - if (priv->ieee->iw_mode != IW_MODE_MONITOR && - (is_multicast_ether_addr(hdr->addr1) ? - !priv->ieee->host_mc_decrypt : !priv->ieee->host_decrypt)) - ipw_rebuild_decrypted_skb(priv, rxb->skb); - - if (!libipw_rx(priv->ieee, rxb->skb, stats)) - dev->stats.rx_errors++; - else { /* libipw_rx succeeded, so it now owns the SKB */ - rxb->skb = NULL; - __ipw_led_activity_on(priv); - } -} - -#ifdef CONFIG_IPW2200_RADIOTAP -static void ipw_handle_data_packet_monitor(struct ipw_priv *priv, - struct ipw_rx_mem_buffer *rxb, - struct libipw_rx_stats *stats) -{ - struct net_device *dev = priv->net_dev; - struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)rxb->skb->data; - struct ipw_rx_frame *frame = &pkt->u.frame; - - /* initial pull of some data */ - u16 received_channel = frame->received_channel; - u8 antennaAndPhy = frame->antennaAndPhy; - s8 antsignal = frame->rssi_dbm - IPW_RSSI_TO_DBM; /* call it signed anyhow */ - u16 pktrate = frame->rate; - - /* Magic struct that slots into the radiotap header -- no reason - * to build this manually element by element, we can write it much - * more efficiently than we can parse it. ORDER MATTERS HERE */ - struct ipw_rt_hdr *ipw_rt; - - unsigned short len = le16_to_cpu(pkt->u.frame.length); - - /* We received data from the HW, so stop the watchdog */ - dev->trans_start = jiffies; - - /* We only process data packets if the - * interface is open */ - if (unlikely((le16_to_cpu(pkt->u.frame.length) + IPW_RX_FRAME_SIZE) > - skb_tailroom(rxb->skb))) { - dev->stats.rx_errors++; - priv->wstats.discard.misc++; - IPW_DEBUG_DROP("Corruption detected! Oh no!\n"); - return; - } else if (unlikely(!netif_running(priv->net_dev))) { - dev->stats.rx_dropped++; - priv->wstats.discard.misc++; - IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); - return; - } - - /* Libpcap 0.9.3+ can handle variable length radiotap, so we'll use - * that now */ - if (len > IPW_RX_BUF_SIZE - sizeof(struct ipw_rt_hdr)) { - /* FIXME: Should alloc bigger skb instead */ - dev->stats.rx_dropped++; - priv->wstats.discard.misc++; - IPW_DEBUG_DROP("Dropping too large packet in monitor\n"); - return; - } - - /* copy the frame itself */ - memmove(rxb->skb->data + sizeof(struct ipw_rt_hdr), - rxb->skb->data + IPW_RX_FRAME_SIZE, len); - - ipw_rt = (struct ipw_rt_hdr *)rxb->skb->data; - - ipw_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; - ipw_rt->rt_hdr.it_pad = 0; /* always good to zero */ - ipw_rt->rt_hdr.it_len = cpu_to_le16(sizeof(struct ipw_rt_hdr)); /* total header+data */ - - /* Big bitfield of all the fields we provide in radiotap */ - ipw_rt->rt_hdr.it_present = cpu_to_le32( - (1 << IEEE80211_RADIOTAP_TSFT) | - (1 << IEEE80211_RADIOTAP_FLAGS) | - (1 << IEEE80211_RADIOTAP_RATE) | - (1 << IEEE80211_RADIOTAP_CHANNEL) | - (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | - (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | - (1 << IEEE80211_RADIOTAP_ANTENNA)); - - /* Zero the flags, we'll add to them as we go */ - ipw_rt->rt_flags = 0; - ipw_rt->rt_tsf = (u64)(frame->parent_tsf[3] << 24 | - frame->parent_tsf[2] << 16 | - frame->parent_tsf[1] << 8 | - frame->parent_tsf[0]); - - /* Convert signal to DBM */ - ipw_rt->rt_dbmsignal = antsignal; - ipw_rt->rt_dbmnoise = (s8) le16_to_cpu(frame->noise); - - /* Convert the channel data and set the flags */ - ipw_rt->rt_channel = cpu_to_le16(ieee80211chan2mhz(received_channel)); - if (received_channel > 14) { /* 802.11a */ - ipw_rt->rt_chbitmask = - cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ)); - } else if (antennaAndPhy & 32) { /* 802.11b */ - ipw_rt->rt_chbitmask = - cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ)); - } else { /* 802.11g */ - ipw_rt->rt_chbitmask = - cpu_to_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ); - } - - /* set the rate in multiples of 500k/s */ - switch (pktrate) { - case IPW_TX_RATE_1MB: - ipw_rt->rt_rate = 2; - break; - case IPW_TX_RATE_2MB: - ipw_rt->rt_rate = 4; - break; - case IPW_TX_RATE_5MB: - ipw_rt->rt_rate = 10; - break; - case IPW_TX_RATE_6MB: - ipw_rt->rt_rate = 12; - break; - case IPW_TX_RATE_9MB: - ipw_rt->rt_rate = 18; - break; - case IPW_TX_RATE_11MB: - ipw_rt->rt_rate = 22; - break; - case IPW_TX_RATE_12MB: - ipw_rt->rt_rate = 24; - break; - case IPW_TX_RATE_18MB: - ipw_rt->rt_rate = 36; - break; - case IPW_TX_RATE_24MB: - ipw_rt->rt_rate = 48; - break; - case IPW_TX_RATE_36MB: - ipw_rt->rt_rate = 72; - break; - case IPW_TX_RATE_48MB: - ipw_rt->rt_rate = 96; - break; - case IPW_TX_RATE_54MB: - ipw_rt->rt_rate = 108; - break; - default: - ipw_rt->rt_rate = 0; - break; - } - - /* antenna number */ - ipw_rt->rt_antenna = (antennaAndPhy & 3); /* Is this right? */ - - /* set the preamble flag if we have it */ - if ((antennaAndPhy & 64)) - ipw_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; - - /* Set the size of the skb to the size of the frame */ - skb_put(rxb->skb, len + sizeof(struct ipw_rt_hdr)); - - IPW_DEBUG_RX("Rx packet of %d bytes.\n", rxb->skb->len); - - if (!libipw_rx(priv->ieee, rxb->skb, stats)) - dev->stats.rx_errors++; - else { /* libipw_rx succeeded, so it now owns the SKB */ - rxb->skb = NULL; - /* no LED during capture */ - } -} -#endif - -#ifdef CONFIG_IPW2200_PROMISCUOUS -#define libipw_is_probe_response(fc) \ - ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT && \ - (fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP ) - -#define libipw_is_management(fc) \ - ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) - -#define libipw_is_control(fc) \ - ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) - -#define libipw_is_data(fc) \ - ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) - -#define libipw_is_assoc_request(fc) \ - ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_ASSOC_REQ) - -#define libipw_is_reassoc_request(fc) \ - ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_REASSOC_REQ) - -static void ipw_handle_promiscuous_rx(struct ipw_priv *priv, - struct ipw_rx_mem_buffer *rxb, - struct libipw_rx_stats *stats) -{ - struct net_device *dev = priv->prom_net_dev; - struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)rxb->skb->data; - struct ipw_rx_frame *frame = &pkt->u.frame; - struct ipw_rt_hdr *ipw_rt; - - /* First cache any information we need before we overwrite - * the information provided in the skb from the hardware */ - struct ieee80211_hdr *hdr; - u16 channel = frame->received_channel; - u8 phy_flags = frame->antennaAndPhy; - s8 signal = frame->rssi_dbm - IPW_RSSI_TO_DBM; - s8 noise = (s8) le16_to_cpu(frame->noise); - u8 rate = frame->rate; - unsigned short len = le16_to_cpu(pkt->u.frame.length); - struct sk_buff *skb; - int hdr_only = 0; - u16 filter = priv->prom_priv->filter; - - /* If the filter is set to not include Rx frames then return */ - if (filter & IPW_PROM_NO_RX) - return; - - /* We received data from the HW, so stop the watchdog */ - dev->trans_start = jiffies; - - if (unlikely((len + IPW_RX_FRAME_SIZE) > skb_tailroom(rxb->skb))) { - dev->stats.rx_errors++; - IPW_DEBUG_DROP("Corruption detected! Oh no!\n"); - return; - } - - /* We only process data packets if the interface is open */ - if (unlikely(!netif_running(dev))) { - dev->stats.rx_dropped++; - IPW_DEBUG_DROP("Dropping packet while interface is not up.\n"); - return; - } - - /* Libpcap 0.9.3+ can handle variable length radiotap, so we'll use - * that now */ - if (len > IPW_RX_BUF_SIZE - sizeof(struct ipw_rt_hdr)) { - /* FIXME: Should alloc bigger skb instead */ - dev->stats.rx_dropped++; - IPW_DEBUG_DROP("Dropping too large packet in monitor\n"); - return; - } - - hdr = (void *)rxb->skb->data + IPW_RX_FRAME_SIZE; - if (libipw_is_management(le16_to_cpu(hdr->frame_control))) { - if (filter & IPW_PROM_NO_MGMT) - return; - if (filter & IPW_PROM_MGMT_HEADER_ONLY) - hdr_only = 1; - } else if (libipw_is_control(le16_to_cpu(hdr->frame_control))) { - if (filter & IPW_PROM_NO_CTL) - return; - if (filter & IPW_PROM_CTL_HEADER_ONLY) - hdr_only = 1; - } else if (libipw_is_data(le16_to_cpu(hdr->frame_control))) { - if (filter & IPW_PROM_NO_DATA) - return; - if (filter & IPW_PROM_DATA_HEADER_ONLY) - hdr_only = 1; - } - - /* Copy the SKB since this is for the promiscuous side */ - skb = skb_copy(rxb->skb, GFP_ATOMIC); - if (skb == NULL) { - IPW_ERROR("skb_clone failed for promiscuous copy.\n"); - return; - } - - /* copy the frame data to write after where the radiotap header goes */ - ipw_rt = (void *)skb->data; - - if (hdr_only) - len = libipw_get_hdrlen(le16_to_cpu(hdr->frame_control)); - - memcpy(ipw_rt->payload, hdr, len); - - ipw_rt->rt_hdr.it_version = PKTHDR_RADIOTAP_VERSION; - ipw_rt->rt_hdr.it_pad = 0; /* always good to zero */ - ipw_rt->rt_hdr.it_len = cpu_to_le16(sizeof(*ipw_rt)); /* total header+data */ - - /* Set the size of the skb to the size of the frame */ - skb_put(skb, sizeof(*ipw_rt) + len); - - /* Big bitfield of all the fields we provide in radiotap */ - ipw_rt->rt_hdr.it_present = cpu_to_le32( - (1 << IEEE80211_RADIOTAP_TSFT) | - (1 << IEEE80211_RADIOTAP_FLAGS) | - (1 << IEEE80211_RADIOTAP_RATE) | - (1 << IEEE80211_RADIOTAP_CHANNEL) | - (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | - (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | - (1 << IEEE80211_RADIOTAP_ANTENNA)); - - /* Zero the flags, we'll add to them as we go */ - ipw_rt->rt_flags = 0; - ipw_rt->rt_tsf = (u64)(frame->parent_tsf[3] << 24 | - frame->parent_tsf[2] << 16 | - frame->parent_tsf[1] << 8 | - frame->parent_tsf[0]); - - /* Convert to DBM */ - ipw_rt->rt_dbmsignal = signal; - ipw_rt->rt_dbmnoise = noise; - - /* Convert the channel data and set the flags */ - ipw_rt->rt_channel = cpu_to_le16(ieee80211chan2mhz(channel)); - if (channel > 14) { /* 802.11a */ - ipw_rt->rt_chbitmask = - cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ)); - } else if (phy_flags & (1 << 5)) { /* 802.11b */ - ipw_rt->rt_chbitmask = - cpu_to_le16((IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ)); - } else { /* 802.11g */ - ipw_rt->rt_chbitmask = - cpu_to_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ); - } - - /* set the rate in multiples of 500k/s */ - switch (rate) { - case IPW_TX_RATE_1MB: - ipw_rt->rt_rate = 2; - break; - case IPW_TX_RATE_2MB: - ipw_rt->rt_rate = 4; - break; - case IPW_TX_RATE_5MB: - ipw_rt->rt_rate = 10; - break; - case IPW_TX_RATE_6MB: - ipw_rt->rt_rate = 12; - break; - case IPW_TX_RATE_9MB: - ipw_rt->rt_rate = 18; - break; - case IPW_TX_RATE_11MB: - ipw_rt->rt_rate = 22; - break; - case IPW_TX_RATE_12MB: - ipw_rt->rt_rate = 24; - break; - case IPW_TX_RATE_18MB: - ipw_rt->rt_rate = 36; - break; - case IPW_TX_RATE_24MB: - ipw_rt->rt_rate = 48; - break; - case IPW_TX_RATE_36MB: - ipw_rt->rt_rate = 72; - break; - case IPW_TX_RATE_48MB: - ipw_rt->rt_rate = 96; - break; - case IPW_TX_RATE_54MB: - ipw_rt->rt_rate = 108; - break; - default: - ipw_rt->rt_rate = 0; - break; - } - - /* antenna number */ - ipw_rt->rt_antenna = (phy_flags & 3); - - /* set the preamble flag if we have it */ - if (phy_flags & (1 << 6)) - ipw_rt->rt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; - - IPW_DEBUG_RX("Rx packet of %d bytes.\n", skb->len); - - if (!libipw_rx(priv->prom_priv->ieee, skb, stats)) { - dev->stats.rx_errors++; - dev_kfree_skb_any(skb); - } -} -#endif - -static int is_network_packet(struct ipw_priv *priv, - struct libipw_hdr_4addr *header) -{ - /* Filter incoming packets to determine if they are targeted toward - * this network, discarding packets coming from ourselves */ - switch (priv->ieee->iw_mode) { - case IW_MODE_ADHOC: /* Header: Dest. | Source | BSSID */ - /* packets from our adapter are dropped (echo) */ - if (!memcmp(header->addr2, priv->net_dev->dev_addr, ETH_ALEN)) - return 0; - - /* {broad,multi}cast packets to our BSSID go through */ - if (is_multicast_ether_addr(header->addr1)) - return !memcmp(header->addr3, priv->bssid, ETH_ALEN); - - /* packets to our adapter go through */ - return !memcmp(header->addr1, priv->net_dev->dev_addr, - ETH_ALEN); - - case IW_MODE_INFRA: /* Header: Dest. | BSSID | Source */ - /* packets from our adapter are dropped (echo) */ - if (!memcmp(header->addr3, priv->net_dev->dev_addr, ETH_ALEN)) - return 0; - - /* {broad,multi}cast packets to our BSS go through */ - if (is_multicast_ether_addr(header->addr1)) - return !memcmp(header->addr2, priv->bssid, ETH_ALEN); - - /* packets to our adapter go through */ - return !memcmp(header->addr1, priv->net_dev->dev_addr, - ETH_ALEN); - } - - return 1; -} - -#define IPW_PACKET_RETRY_TIME HZ - -static int is_duplicate_packet(struct ipw_priv *priv, - struct libipw_hdr_4addr *header) -{ - u16 sc = le16_to_cpu(header->seq_ctl); - u16 seq = WLAN_GET_SEQ_SEQ(sc); - u16 frag = WLAN_GET_SEQ_FRAG(sc); - u16 *last_seq, *last_frag; - unsigned long *last_time; - - switch (priv->ieee->iw_mode) { - case IW_MODE_ADHOC: - { - struct list_head *p; - struct ipw_ibss_seq *entry = NULL; - u8 *mac = header->addr2; - int index = mac[5] % IPW_IBSS_MAC_HASH_SIZE; - - __list_for_each(p, &priv->ibss_mac_hash[index]) { - entry = - list_entry(p, struct ipw_ibss_seq, list); - if (!memcmp(entry->mac, mac, ETH_ALEN)) - break; - } - if (p == &priv->ibss_mac_hash[index]) { - entry = kmalloc(sizeof(*entry), GFP_ATOMIC); - if (!entry) { - IPW_ERROR - ("Cannot malloc new mac entry\n"); - return 0; - } - memcpy(entry->mac, mac, ETH_ALEN); - entry->seq_num = seq; - entry->frag_num = frag; - entry->packet_time = jiffies; - list_add(&entry->list, - &priv->ibss_mac_hash[index]); - return 0; - } - last_seq = &entry->seq_num; - last_frag = &entry->frag_num; - last_time = &entry->packet_time; - break; - } - case IW_MODE_INFRA: - last_seq = &priv->last_seq_num; - last_frag = &priv->last_frag_num; - last_time = &priv->last_packet_time; - break; - default: - return 0; - } - if ((*last_seq == seq) && - time_after(*last_time + IPW_PACKET_RETRY_TIME, jiffies)) { - if (*last_frag == frag) - goto drop; - if (*last_frag + 1 != frag) - /* out-of-order fragment */ - goto drop; - } else - *last_seq = seq; - - *last_frag = frag; - *last_time = jiffies; - return 0; - - drop: - /* Comment this line now since we observed the card receives - * duplicate packets but the FCTL_RETRY bit is not set in the - * IBSS mode with fragmentation enabled. - BUG_ON(!(le16_to_cpu(header->frame_control) & IEEE80211_FCTL_RETRY)); */ - return 1; -} - -static void ipw_handle_mgmt_packet(struct ipw_priv *priv, - struct ipw_rx_mem_buffer *rxb, - struct libipw_rx_stats *stats) -{ - struct sk_buff *skb = rxb->skb; - struct ipw_rx_packet *pkt = (struct ipw_rx_packet *)skb->data; - struct libipw_hdr_4addr *header = (struct libipw_hdr_4addr *) - (skb->data + IPW_RX_FRAME_SIZE); - - libipw_rx_mgt(priv->ieee, header, stats); - - if (priv->ieee->iw_mode == IW_MODE_ADHOC && - ((WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)) == - IEEE80211_STYPE_PROBE_RESP) || - (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl)) == - IEEE80211_STYPE_BEACON))) { - if (!memcmp(header->addr3, priv->bssid, ETH_ALEN)) - ipw_add_station(priv, header->addr2); - } - - if (priv->config & CFG_NET_STATS) { - IPW_DEBUG_HC("sending stat packet\n"); - - /* Set the size of the skb to the size of the full - * ipw header and 802.11 frame */ - skb_put(skb, le16_to_cpu(pkt->u.frame.length) + - IPW_RX_FRAME_SIZE); - - /* Advance past the ipw packet header to the 802.11 frame */ - skb_pull(skb, IPW_RX_FRAME_SIZE); - - /* Push the libipw_rx_stats before the 802.11 frame */ - memcpy(skb_push(skb, sizeof(*stats)), stats, sizeof(*stats)); - - skb->dev = priv->ieee->dev; - - /* Point raw at the libipw_stats */ - skb_reset_mac_header(skb); - - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = cpu_to_be16(ETH_P_80211_STATS); - memset(skb->cb, 0, sizeof(rxb->skb->cb)); - netif_rx(skb); - rxb->skb = NULL; - } -} - -/* - * Main entry function for receiving a packet with 80211 headers. This - * should be called when ever the FW has notified us that there is a new - * skb in the receive queue. - */ -static void ipw_rx(struct ipw_priv *priv) -{ - struct ipw_rx_mem_buffer *rxb; - struct ipw_rx_packet *pkt; - struct libipw_hdr_4addr *header; - u32 r, w, i; - u8 network_packet; - u8 fill_rx = 0; - - r = ipw_read32(priv, IPW_RX_READ_INDEX); - w = ipw_read32(priv, IPW_RX_WRITE_INDEX); - i = priv->rxq->read; - - if (ipw_rx_queue_space (priv->rxq) > (RX_QUEUE_SIZE / 2)) - fill_rx = 1; - - while (i != r) { - rxb = priv->rxq->queue[i]; - if (unlikely(rxb == NULL)) { - printk(KERN_CRIT "Queue not allocated!\n"); - break; - } - priv->rxq->queue[i] = NULL; - - pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, - IPW_RX_BUF_SIZE, - PCI_DMA_FROMDEVICE); - - pkt = (struct ipw_rx_packet *)rxb->skb->data; - IPW_DEBUG_RX("Packet: type=%02X seq=%02X bits=%02X\n", - pkt->header.message_type, - pkt->header.rx_seq_num, pkt->header.control_bits); - - switch (pkt->header.message_type) { - case RX_FRAME_TYPE: /* 802.11 frame */ { - struct libipw_rx_stats stats = { - .rssi = pkt->u.frame.rssi_dbm - - IPW_RSSI_TO_DBM, - .signal = - pkt->u.frame.rssi_dbm - - IPW_RSSI_TO_DBM + 0x100, - .noise = - le16_to_cpu(pkt->u.frame.noise), - .rate = pkt->u.frame.rate, - .mac_time = jiffies, - .received_channel = - pkt->u.frame.received_channel, - .freq = - (pkt->u.frame. - control & (1 << 0)) ? - LIBIPW_24GHZ_BAND : - LIBIPW_52GHZ_BAND, - .len = le16_to_cpu(pkt->u.frame.length), - }; - - if (stats.rssi != 0) - stats.mask |= LIBIPW_STATMASK_RSSI; - if (stats.signal != 0) - stats.mask |= LIBIPW_STATMASK_SIGNAL; - if (stats.noise != 0) - stats.mask |= LIBIPW_STATMASK_NOISE; - if (stats.rate != 0) - stats.mask |= LIBIPW_STATMASK_RATE; - - priv->rx_packets++; - -#ifdef CONFIG_IPW2200_PROMISCUOUS - if (priv->prom_net_dev && netif_running(priv->prom_net_dev)) - ipw_handle_promiscuous_rx(priv, rxb, &stats); -#endif - -#ifdef CONFIG_IPW2200_MONITOR - if (priv->ieee->iw_mode == IW_MODE_MONITOR) { -#ifdef CONFIG_IPW2200_RADIOTAP - - ipw_handle_data_packet_monitor(priv, - rxb, - &stats); -#else - ipw_handle_data_packet(priv, rxb, - &stats); -#endif - break; - } -#endif - - header = - (struct libipw_hdr_4addr *)(rxb->skb-> - data + - IPW_RX_FRAME_SIZE); - /* TODO: Check Ad-Hoc dest/source and make sure - * that we are actually parsing these packets - * correctly -- we should probably use the - * frame control of the packet and disregard - * the current iw_mode */ - - network_packet = - is_network_packet(priv, header); - if (network_packet && priv->assoc_network) { - priv->assoc_network->stats.rssi = - stats.rssi; - priv->exp_avg_rssi = - exponential_average(priv->exp_avg_rssi, - stats.rssi, DEPTH_RSSI); - } - - IPW_DEBUG_RX("Frame: len=%u\n", - le16_to_cpu(pkt->u.frame.length)); - - if (le16_to_cpu(pkt->u.frame.length) < - libipw_get_hdrlen(le16_to_cpu( - header->frame_ctl))) { - IPW_DEBUG_DROP - ("Received packet is too small. " - "Dropping.\n"); - priv->net_dev->stats.rx_errors++; - priv->wstats.discard.misc++; - break; - } - - switch (WLAN_FC_GET_TYPE - (le16_to_cpu(header->frame_ctl))) { - - case IEEE80211_FTYPE_MGMT: - ipw_handle_mgmt_packet(priv, rxb, - &stats); - break; - - case IEEE80211_FTYPE_CTL: - break; - - case IEEE80211_FTYPE_DATA: - if (unlikely(!network_packet || - is_duplicate_packet(priv, - header))) - { - IPW_DEBUG_DROP("Dropping: " - "%pM, " - "%pM, " - "%pM\n", - header->addr1, - header->addr2, - header->addr3); - break; - } - - ipw_handle_data_packet(priv, rxb, - &stats); - - break; - } - break; - } - - case RX_HOST_NOTIFICATION_TYPE:{ - IPW_DEBUG_RX - ("Notification: subtype=%02X flags=%02X size=%d\n", - pkt->u.notification.subtype, - pkt->u.notification.flags, - le16_to_cpu(pkt->u.notification.size)); - ipw_rx_notification(priv, &pkt->u.notification); - break; - } - - default: - IPW_DEBUG_RX("Bad Rx packet of type %d\n", - pkt->header.message_type); - break; - } - - /* For now we just don't re-use anything. We can tweak this - * later to try and re-use notification packets and SKBs that - * fail to Rx correctly */ - if (rxb->skb != NULL) { - dev_kfree_skb_any(rxb->skb); - rxb->skb = NULL; - } - - pci_unmap_single(priv->pci_dev, rxb->dma_addr, - IPW_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); - list_add_tail(&rxb->list, &priv->rxq->rx_used); - - i = (i + 1) % RX_QUEUE_SIZE; - - /* If there are a lot of unsued frames, restock the Rx queue - * so the ucode won't assert */ - if (fill_rx) { - priv->rxq->read = i; - ipw_rx_queue_replenish(priv); - } - } - - /* Backtrack one entry */ - priv->rxq->read = i; - ipw_rx_queue_restock(priv); -} - -#define DEFAULT_RTS_THRESHOLD 2304U -#define MIN_RTS_THRESHOLD 1U -#define MAX_RTS_THRESHOLD 2304U -#define DEFAULT_BEACON_INTERVAL 100U -#define DEFAULT_SHORT_RETRY_LIMIT 7U -#define DEFAULT_LONG_RETRY_LIMIT 4U - -/** - * ipw_sw_reset - * @option: options to control different reset behaviour - * 0 = reset everything except the 'disable' module_param - * 1 = reset everything and print out driver info (for probe only) - * 2 = reset everything - */ -static int ipw_sw_reset(struct ipw_priv *priv, int option) -{ - int band, modulation; - int old_mode = priv->ieee->iw_mode; - - /* Initialize module parameter values here */ - priv->config = 0; - - /* We default to disabling the LED code as right now it causes - * too many systems to lock up... */ - if (!led_support) - priv->config |= CFG_NO_LED; - - if (associate) - priv->config |= CFG_ASSOCIATE; - else - IPW_DEBUG_INFO("Auto associate disabled.\n"); - - if (auto_create) - priv->config |= CFG_ADHOC_CREATE; - else - IPW_DEBUG_INFO("Auto adhoc creation disabled.\n"); - - priv->config &= ~CFG_STATIC_ESSID; - priv->essid_len = 0; - memset(priv->essid, 0, IW_ESSID_MAX_SIZE); - - if (disable && option) { - priv->status |= STATUS_RF_KILL_SW; - IPW_DEBUG_INFO("Radio disabled.\n"); - } - - if (default_channel != 0) { - priv->config |= CFG_STATIC_CHANNEL; - priv->channel = default_channel; - IPW_DEBUG_INFO("Bind to static channel %d\n", default_channel); - /* TODO: Validate that provided channel is in range */ - } -#ifdef CONFIG_IPW2200_QOS - ipw_qos_init(priv, qos_enable, qos_burst_enable, - burst_duration_CCK, burst_duration_OFDM); -#endif /* CONFIG_IPW2200_QOS */ - - switch (network_mode) { - case 1: - priv->ieee->iw_mode = IW_MODE_ADHOC; - priv->net_dev->type = ARPHRD_ETHER; - - break; -#ifdef CONFIG_IPW2200_MONITOR - case 2: - priv->ieee->iw_mode = IW_MODE_MONITOR; -#ifdef CONFIG_IPW2200_RADIOTAP - priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; -#else - priv->net_dev->type = ARPHRD_IEEE80211; -#endif - break; -#endif - default: - case 0: - priv->net_dev->type = ARPHRD_ETHER; - priv->ieee->iw_mode = IW_MODE_INFRA; - break; - } - - if (hwcrypto) { - priv->ieee->host_encrypt = 0; - priv->ieee->host_encrypt_msdu = 0; - priv->ieee->host_decrypt = 0; - priv->ieee->host_mc_decrypt = 0; - } - IPW_DEBUG_INFO("Hardware crypto [%s]\n", hwcrypto ? "on" : "off"); - - /* IPW2200/2915 is abled to do hardware fragmentation. */ - priv->ieee->host_open_frag = 0; - - if ((priv->pci_dev->device == 0x4223) || - (priv->pci_dev->device == 0x4224)) { - if (option == 1) - printk(KERN_INFO DRV_NAME - ": Detected Intel PRO/Wireless 2915ABG Network " - "Connection\n"); - priv->ieee->abg_true = 1; - band = LIBIPW_52GHZ_BAND | LIBIPW_24GHZ_BAND; - modulation = LIBIPW_OFDM_MODULATION | - LIBIPW_CCK_MODULATION; - priv->adapter = IPW_2915ABG; - priv->ieee->mode = IEEE_A | IEEE_G | IEEE_B; - } else { - if (option == 1) - printk(KERN_INFO DRV_NAME - ": Detected Intel PRO/Wireless 2200BG Network " - "Connection\n"); - - priv->ieee->abg_true = 0; - band = LIBIPW_24GHZ_BAND; - modulation = LIBIPW_OFDM_MODULATION | - LIBIPW_CCK_MODULATION; - priv->adapter = IPW_2200BG; - priv->ieee->mode = IEEE_G | IEEE_B; - } - - priv->ieee->freq_band = band; - priv->ieee->modulation = modulation; - - priv->rates_mask = LIBIPW_DEFAULT_RATES_MASK; - - priv->disassociate_threshold = IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT; - priv->roaming_threshold = IPW_MB_ROAMING_THRESHOLD_DEFAULT; - - priv->rts_threshold = DEFAULT_RTS_THRESHOLD; - priv->short_retry_limit = DEFAULT_SHORT_RETRY_LIMIT; - priv->long_retry_limit = DEFAULT_LONG_RETRY_LIMIT; - - /* If power management is turned on, default to AC mode */ - priv->power_mode = IPW_POWER_AC; - priv->tx_power = IPW_TX_POWER_DEFAULT; - - return old_mode == priv->ieee->iw_mode; -} - -/* - * This file defines the Wireless Extension handlers. It does not - * define any methods of hardware manipulation and relies on the - * functions defined in ipw_main to provide the HW interaction. - * - * The exception to this is the use of the ipw_get_ordinal() - * function used to poll the hardware vs. making unnecessary calls. - * - */ - -static int ipw_set_channel(struct ipw_priv *priv, u8 channel) -{ - if (channel == 0) { - IPW_DEBUG_INFO("Setting channel to ANY (0)\n"); - priv->config &= ~CFG_STATIC_CHANNEL; - IPW_DEBUG_ASSOC("Attempting to associate with new " - "parameters.\n"); - ipw_associate(priv); - return 0; - } - - priv->config |= CFG_STATIC_CHANNEL; - - if (priv->channel == channel) { - IPW_DEBUG_INFO("Request to set channel to current value (%d)\n", - channel); - return 0; - } - - IPW_DEBUG_INFO("Setting channel to %i\n", (int)channel); - priv->channel = channel; - -#ifdef CONFIG_IPW2200_MONITOR - if (priv->ieee->iw_mode == IW_MODE_MONITOR) { - int i; - if (priv->status & STATUS_SCANNING) { - IPW_DEBUG_SCAN("Scan abort triggered due to " - "channel change.\n"); - ipw_abort_scan(priv); - } - - for (i = 1000; i && (priv->status & STATUS_SCANNING); i--) - udelay(10); - - if (priv->status & STATUS_SCANNING) - IPW_DEBUG_SCAN("Still scanning...\n"); - else - IPW_DEBUG_SCAN("Took %dms to abort current scan\n", - 1000 - i); - - return 0; - } -#endif /* CONFIG_IPW2200_MONITOR */ - - /* Network configuration changed -- force [re]association */ - IPW_DEBUG_ASSOC("[re]association triggered due to channel change.\n"); - if (!ipw_disassociate(priv)) - ipw_associate(priv); - - return 0; -} - -static int ipw_wx_set_freq(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - const struct libipw_geo *geo = libipw_get_geo(priv->ieee); - struct iw_freq *fwrq = &wrqu->freq; - int ret = 0, i; - u8 channel, flags; - int band; - - if (fwrq->m == 0) { - IPW_DEBUG_WX("SET Freq/Channel -> any\n"); - mutex_lock(&priv->mutex); - ret = ipw_set_channel(priv, 0); - mutex_unlock(&priv->mutex); - return ret; - } - /* if setting by freq convert to channel */ - if (fwrq->e == 1) { - channel = libipw_freq_to_channel(priv->ieee, fwrq->m); - if (channel == 0) - return -EINVAL; - } else - channel = fwrq->m; - - if (!(band = libipw_is_valid_channel(priv->ieee, channel))) - return -EINVAL; - - if (priv->ieee->iw_mode == IW_MODE_ADHOC) { - i = libipw_channel_to_index(priv->ieee, channel); - if (i == -1) - return -EINVAL; - - flags = (band == LIBIPW_24GHZ_BAND) ? - geo->bg[i].flags : geo->a[i].flags; - if (flags & LIBIPW_CH_PASSIVE_ONLY) { - IPW_DEBUG_WX("Invalid Ad-Hoc channel for 802.11a\n"); - return -EINVAL; - } - } - - IPW_DEBUG_WX("SET Freq/Channel -> %d\n", fwrq->m); - mutex_lock(&priv->mutex); - ret = ipw_set_channel(priv, channel); - mutex_unlock(&priv->mutex); - return ret; -} - -static int ipw_wx_get_freq(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - - wrqu->freq.e = 0; - - /* If we are associated, trying to associate, or have a statically - * configured CHANNEL then return that; otherwise return ANY */ - mutex_lock(&priv->mutex); - if (priv->config & CFG_STATIC_CHANNEL || - priv->status & (STATUS_ASSOCIATING | STATUS_ASSOCIATED)) { - int i; - - i = libipw_channel_to_index(priv->ieee, priv->channel); - BUG_ON(i == -1); - wrqu->freq.e = 1; - - switch (libipw_is_valid_channel(priv->ieee, priv->channel)) { - case LIBIPW_52GHZ_BAND: - wrqu->freq.m = priv->ieee->geo.a[i].freq * 100000; - break; - - case LIBIPW_24GHZ_BAND: - wrqu->freq.m = priv->ieee->geo.bg[i].freq * 100000; - break; - - default: - BUG(); - } - } else - wrqu->freq.m = 0; - - mutex_unlock(&priv->mutex); - IPW_DEBUG_WX("GET Freq/Channel -> %d\n", priv->channel); - return 0; -} - -static int ipw_wx_set_mode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - int err = 0; - - IPW_DEBUG_WX("Set MODE: %d\n", wrqu->mode); - - switch (wrqu->mode) { -#ifdef CONFIG_IPW2200_MONITOR - case IW_MODE_MONITOR: -#endif - case IW_MODE_ADHOC: - case IW_MODE_INFRA: - break; - case IW_MODE_AUTO: - wrqu->mode = IW_MODE_INFRA; - break; - default: - return -EINVAL; - } - if (wrqu->mode == priv->ieee->iw_mode) - return 0; - - mutex_lock(&priv->mutex); - - ipw_sw_reset(priv, 0); - -#ifdef CONFIG_IPW2200_MONITOR - if (priv->ieee->iw_mode == IW_MODE_MONITOR) - priv->net_dev->type = ARPHRD_ETHER; - - if (wrqu->mode == IW_MODE_MONITOR) -#ifdef CONFIG_IPW2200_RADIOTAP - priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; -#else - priv->net_dev->type = ARPHRD_IEEE80211; -#endif -#endif /* CONFIG_IPW2200_MONITOR */ - - /* Free the existing firmware and reset the fw_loaded - * flag so ipw_load() will bring in the new firmware */ - free_firmware(); - - priv->ieee->iw_mode = wrqu->mode; - - schedule_work(&priv->adapter_restart); - mutex_unlock(&priv->mutex); - return err; -} - -static int ipw_wx_get_mode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - mutex_lock(&priv->mutex); - wrqu->mode = priv->ieee->iw_mode; - IPW_DEBUG_WX("Get MODE -> %d\n", wrqu->mode); - mutex_unlock(&priv->mutex); - return 0; -} - -/* Values are in microsecond */ -static const s32 timeout_duration[] = { - 350000, - 250000, - 75000, - 37000, - 25000, -}; - -static const s32 period_duration[] = { - 400000, - 700000, - 1000000, - 1000000, - 1000000 -}; - -static int ipw_wx_get_range(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - struct iw_range *range = (struct iw_range *)extra; - const struct libipw_geo *geo = libipw_get_geo(priv->ieee); - int i = 0, j; - - wrqu->data.length = sizeof(*range); - memset(range, 0, sizeof(*range)); - - /* 54Mbs == ~27 Mb/s real (802.11g) */ - range->throughput = 27 * 1000 * 1000; - - range->max_qual.qual = 100; - /* TODO: Find real max RSSI and stick here */ - range->max_qual.level = 0; - range->max_qual.noise = 0; - range->max_qual.updated = 7; /* Updated all three */ - - range->avg_qual.qual = 70; - /* TODO: Find real 'good' to 'bad' threshold value for RSSI */ - range->avg_qual.level = 0; /* FIXME to real average level */ - range->avg_qual.noise = 0; - range->avg_qual.updated = 7; /* Updated all three */ - mutex_lock(&priv->mutex); - range->num_bitrates = min(priv->rates.num_rates, (u8) IW_MAX_BITRATES); - - for (i = 0; i < range->num_bitrates; i++) - range->bitrate[i] = (priv->rates.supported_rates[i] & 0x7F) * - 500000; - - range->max_rts = DEFAULT_RTS_THRESHOLD; - range->min_frag = MIN_FRAG_THRESHOLD; - range->max_frag = MAX_FRAG_THRESHOLD; - - range->encoding_size[0] = 5; - range->encoding_size[1] = 13; - range->num_encoding_sizes = 2; - range->max_encoding_tokens = WEP_KEYS; - - /* Set the Wireless Extension versions */ - range->we_version_compiled = WIRELESS_EXT; - range->we_version_source = 18; - - i = 0; - if (priv->ieee->mode & (IEEE_B | IEEE_G)) { - for (j = 0; j < geo->bg_channels && i < IW_MAX_FREQUENCIES; j++) { - if ((priv->ieee->iw_mode == IW_MODE_ADHOC) && - (geo->bg[j].flags & LIBIPW_CH_PASSIVE_ONLY)) - continue; - - range->freq[i].i = geo->bg[j].channel; - range->freq[i].m = geo->bg[j].freq * 100000; - range->freq[i].e = 1; - i++; - } - } - - if (priv->ieee->mode & IEEE_A) { - for (j = 0; j < geo->a_channels && i < IW_MAX_FREQUENCIES; j++) { - if ((priv->ieee->iw_mode == IW_MODE_ADHOC) && - (geo->a[j].flags & LIBIPW_CH_PASSIVE_ONLY)) - continue; - - range->freq[i].i = geo->a[j].channel; - range->freq[i].m = geo->a[j].freq * 100000; - range->freq[i].e = 1; - i++; - } - } - - range->num_channels = i; - range->num_frequency = i; - - mutex_unlock(&priv->mutex); - - /* Event capability (kernel + driver) */ - range->event_capa[0] = (IW_EVENT_CAPA_K_0 | - IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) | - IW_EVENT_CAPA_MASK(SIOCGIWAP) | - IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); - range->event_capa[1] = IW_EVENT_CAPA_K_1; - - range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | - IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; - - range->scan_capa = IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE; - - IPW_DEBUG_WX("GET Range\n"); - return 0; -} - -static int ipw_wx_set_wap(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - - if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) - return -EINVAL; - mutex_lock(&priv->mutex); - if (is_broadcast_ether_addr(wrqu->ap_addr.sa_data) || - is_zero_ether_addr(wrqu->ap_addr.sa_data)) { - /* we disable mandatory BSSID association */ - IPW_DEBUG_WX("Setting AP BSSID to ANY\n"); - priv->config &= ~CFG_STATIC_BSSID; - IPW_DEBUG_ASSOC("Attempting to associate with new " - "parameters.\n"); - ipw_associate(priv); - mutex_unlock(&priv->mutex); - return 0; - } - - priv->config |= CFG_STATIC_BSSID; - if (!memcmp(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN)) { - IPW_DEBUG_WX("BSSID set to current BSSID.\n"); - mutex_unlock(&priv->mutex); - return 0; - } - - IPW_DEBUG_WX("Setting mandatory BSSID to %pM\n", - wrqu->ap_addr.sa_data); - - memcpy(priv->bssid, wrqu->ap_addr.sa_data, ETH_ALEN); - - /* Network configuration changed -- force [re]association */ - IPW_DEBUG_ASSOC("[re]association triggered due to BSSID change.\n"); - if (!ipw_disassociate(priv)) - ipw_associate(priv); - - mutex_unlock(&priv->mutex); - return 0; -} - -static int ipw_wx_get_wap(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - - /* If we are associated, trying to associate, or have a statically - * configured BSSID then return that; otherwise return ANY */ - mutex_lock(&priv->mutex); - if (priv->config & CFG_STATIC_BSSID || - priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { - wrqu->ap_addr.sa_family = ARPHRD_ETHER; - memcpy(wrqu->ap_addr.sa_data, priv->bssid, ETH_ALEN); - } else - memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); - - IPW_DEBUG_WX("Getting WAP BSSID: %pM\n", - wrqu->ap_addr.sa_data); - mutex_unlock(&priv->mutex); - return 0; -} - -static int ipw_wx_set_essid(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - int length; - DECLARE_SSID_BUF(ssid); - - mutex_lock(&priv->mutex); - - if (!wrqu->essid.flags) - { - IPW_DEBUG_WX("Setting ESSID to ANY\n"); - ipw_disassociate(priv); - priv->config &= ~CFG_STATIC_ESSID; - ipw_associate(priv); - mutex_unlock(&priv->mutex); - return 0; - } - - length = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE); - - priv->config |= CFG_STATIC_ESSID; - - if (priv->essid_len == length && !memcmp(priv->essid, extra, length) - && (priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING))) { - IPW_DEBUG_WX("ESSID set to current ESSID.\n"); - mutex_unlock(&priv->mutex); - return 0; - } - - IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n", - print_ssid(ssid, extra, length), length); - - priv->essid_len = length; - memcpy(priv->essid, extra, priv->essid_len); - - /* Network configuration changed -- force [re]association */ - IPW_DEBUG_ASSOC("[re]association triggered due to ESSID change.\n"); - if (!ipw_disassociate(priv)) - ipw_associate(priv); - - mutex_unlock(&priv->mutex); - return 0; -} - -static int ipw_wx_get_essid(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - DECLARE_SSID_BUF(ssid); - - /* If we are associated, trying to associate, or have a statically - * configured ESSID then return that; otherwise return ANY */ - mutex_lock(&priv->mutex); - if (priv->config & CFG_STATIC_ESSID || - priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { - IPW_DEBUG_WX("Getting essid: '%s'\n", - print_ssid(ssid, priv->essid, priv->essid_len)); - memcpy(extra, priv->essid, priv->essid_len); - wrqu->essid.length = priv->essid_len; - wrqu->essid.flags = 1; /* active */ - } else { - IPW_DEBUG_WX("Getting essid: ANY\n"); - wrqu->essid.length = 0; - wrqu->essid.flags = 0; /* active */ - } - mutex_unlock(&priv->mutex); - return 0; -} - -static int ipw_wx_set_nick(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - - IPW_DEBUG_WX("Setting nick to '%s'\n", extra); - if (wrqu->data.length > IW_ESSID_MAX_SIZE) - return -E2BIG; - mutex_lock(&priv->mutex); - wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick)); - memset(priv->nick, 0, sizeof(priv->nick)); - memcpy(priv->nick, extra, wrqu->data.length); - IPW_DEBUG_TRACE("<<\n"); - mutex_unlock(&priv->mutex); - return 0; - -} - -static int ipw_wx_get_nick(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - IPW_DEBUG_WX("Getting nick\n"); - mutex_lock(&priv->mutex); - wrqu->data.length = strlen(priv->nick); - memcpy(extra, priv->nick, wrqu->data.length); - wrqu->data.flags = 1; /* active */ - mutex_unlock(&priv->mutex); - return 0; -} - -static int ipw_wx_set_sens(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - int err = 0; - - IPW_DEBUG_WX("Setting roaming threshold to %d\n", wrqu->sens.value); - IPW_DEBUG_WX("Setting disassociate threshold to %d\n", 3*wrqu->sens.value); - mutex_lock(&priv->mutex); - - if (wrqu->sens.fixed == 0) - { - priv->roaming_threshold = IPW_MB_ROAMING_THRESHOLD_DEFAULT; - priv->disassociate_threshold = IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT; - goto out; - } - if ((wrqu->sens.value > IPW_MB_ROAMING_THRESHOLD_MAX) || - (wrqu->sens.value < IPW_MB_ROAMING_THRESHOLD_MIN)) { - err = -EINVAL; - goto out; - } - - priv->roaming_threshold = wrqu->sens.value; - priv->disassociate_threshold = 3*wrqu->sens.value; - out: - mutex_unlock(&priv->mutex); - return err; -} - -static int ipw_wx_get_sens(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - mutex_lock(&priv->mutex); - wrqu->sens.fixed = 1; - wrqu->sens.value = priv->roaming_threshold; - mutex_unlock(&priv->mutex); - - IPW_DEBUG_WX("GET roaming threshold -> %s %d\n", - wrqu->power.disabled ? "OFF" : "ON", wrqu->power.value); - - return 0; -} - -static int ipw_wx_set_rate(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* TODO: We should use semaphores or locks for access to priv */ - struct ipw_priv *priv = libipw_priv(dev); - u32 target_rate = wrqu->bitrate.value; - u32 fixed, mask; - - /* value = -1, fixed = 0 means auto only, so we should use all rates offered by AP */ - /* value = X, fixed = 1 means only rate X */ - /* value = X, fixed = 0 means all rates lower equal X */ - - if (target_rate == -1) { - fixed = 0; - mask = LIBIPW_DEFAULT_RATES_MASK; - /* Now we should reassociate */ - goto apply; - } - - mask = 0; - fixed = wrqu->bitrate.fixed; - - if (target_rate == 1000000 || !fixed) - mask |= LIBIPW_CCK_RATE_1MB_MASK; - if (target_rate == 1000000) - goto apply; - - if (target_rate == 2000000 || !fixed) - mask |= LIBIPW_CCK_RATE_2MB_MASK; - if (target_rate == 2000000) - goto apply; - - if (target_rate == 5500000 || !fixed) - mask |= LIBIPW_CCK_RATE_5MB_MASK; - if (target_rate == 5500000) - goto apply; - - if (target_rate == 6000000 || !fixed) - mask |= LIBIPW_OFDM_RATE_6MB_MASK; - if (target_rate == 6000000) - goto apply; - - if (target_rate == 9000000 || !fixed) - mask |= LIBIPW_OFDM_RATE_9MB_MASK; - if (target_rate == 9000000) - goto apply; - - if (target_rate == 11000000 || !fixed) - mask |= LIBIPW_CCK_RATE_11MB_MASK; - if (target_rate == 11000000) - goto apply; - - if (target_rate == 12000000 || !fixed) - mask |= LIBIPW_OFDM_RATE_12MB_MASK; - if (target_rate == 12000000) - goto apply; - - if (target_rate == 18000000 || !fixed) - mask |= LIBIPW_OFDM_RATE_18MB_MASK; - if (target_rate == 18000000) - goto apply; - - if (target_rate == 24000000 || !fixed) - mask |= LIBIPW_OFDM_RATE_24MB_MASK; - if (target_rate == 24000000) - goto apply; - - if (target_rate == 36000000 || !fixed) - mask |= LIBIPW_OFDM_RATE_36MB_MASK; - if (target_rate == 36000000) - goto apply; - - if (target_rate == 48000000 || !fixed) - mask |= LIBIPW_OFDM_RATE_48MB_MASK; - if (target_rate == 48000000) - goto apply; - - if (target_rate == 54000000 || !fixed) - mask |= LIBIPW_OFDM_RATE_54MB_MASK; - if (target_rate == 54000000) - goto apply; - - IPW_DEBUG_WX("invalid rate specified, returning error\n"); - return -EINVAL; - - apply: - IPW_DEBUG_WX("Setting rate mask to 0x%08X [%s]\n", - mask, fixed ? "fixed" : "sub-rates"); - mutex_lock(&priv->mutex); - if (mask == LIBIPW_DEFAULT_RATES_MASK) { - priv->config &= ~CFG_FIXED_RATE; - ipw_set_fixed_rate(priv, priv->ieee->mode); - } else - priv->config |= CFG_FIXED_RATE; - - if (priv->rates_mask == mask) { - IPW_DEBUG_WX("Mask set to current mask.\n"); - mutex_unlock(&priv->mutex); - return 0; - } - - priv->rates_mask = mask; - - /* Network configuration changed -- force [re]association */ - IPW_DEBUG_ASSOC("[re]association triggered due to rates change.\n"); - if (!ipw_disassociate(priv)) - ipw_associate(priv); - - mutex_unlock(&priv->mutex); - return 0; -} - -static int ipw_wx_get_rate(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - mutex_lock(&priv->mutex); - wrqu->bitrate.value = priv->last_rate; - wrqu->bitrate.fixed = (priv->config & CFG_FIXED_RATE) ? 1 : 0; - mutex_unlock(&priv->mutex); - IPW_DEBUG_WX("GET Rate -> %d\n", wrqu->bitrate.value); - return 0; -} - -static int ipw_wx_set_rts(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - mutex_lock(&priv->mutex); - if (wrqu->rts.disabled || !wrqu->rts.fixed) - priv->rts_threshold = DEFAULT_RTS_THRESHOLD; - else { - if (wrqu->rts.value < MIN_RTS_THRESHOLD || - wrqu->rts.value > MAX_RTS_THRESHOLD) { - mutex_unlock(&priv->mutex); - return -EINVAL; - } - priv->rts_threshold = wrqu->rts.value; - } - - ipw_send_rts_threshold(priv, priv->rts_threshold); - mutex_unlock(&priv->mutex); - IPW_DEBUG_WX("SET RTS Threshold -> %d\n", priv->rts_threshold); - return 0; -} - -static int ipw_wx_get_rts(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - mutex_lock(&priv->mutex); - wrqu->rts.value = priv->rts_threshold; - wrqu->rts.fixed = 0; /* no auto select */ - wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); - mutex_unlock(&priv->mutex); - IPW_DEBUG_WX("GET RTS Threshold -> %d\n", wrqu->rts.value); - return 0; -} - -static int ipw_wx_set_txpow(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - int err = 0; - - mutex_lock(&priv->mutex); - if (ipw_radio_kill_sw(priv, wrqu->power.disabled)) { - err = -EINPROGRESS; - goto out; - } - - if (!wrqu->power.fixed) - wrqu->power.value = IPW_TX_POWER_DEFAULT; - - if (wrqu->power.flags != IW_TXPOW_DBM) { - err = -EINVAL; - goto out; - } - - if ((wrqu->power.value > IPW_TX_POWER_MAX) || - (wrqu->power.value < IPW_TX_POWER_MIN)) { - err = -EINVAL; - goto out; - } - - priv->tx_power = wrqu->power.value; - err = ipw_set_tx_power(priv); - out: - mutex_unlock(&priv->mutex); - return err; -} - -static int ipw_wx_get_txpow(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - mutex_lock(&priv->mutex); - wrqu->power.value = priv->tx_power; - wrqu->power.fixed = 1; - wrqu->power.flags = IW_TXPOW_DBM; - wrqu->power.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; - mutex_unlock(&priv->mutex); - - IPW_DEBUG_WX("GET TX Power -> %s %d\n", - wrqu->power.disabled ? "OFF" : "ON", wrqu->power.value); - - return 0; -} - -static int ipw_wx_set_frag(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - mutex_lock(&priv->mutex); - if (wrqu->frag.disabled || !wrqu->frag.fixed) - priv->ieee->fts = DEFAULT_FTS; - else { - if (wrqu->frag.value < MIN_FRAG_THRESHOLD || - wrqu->frag.value > MAX_FRAG_THRESHOLD) { - mutex_unlock(&priv->mutex); - return -EINVAL; - } - - priv->ieee->fts = wrqu->frag.value & ~0x1; - } - - ipw_send_frag_threshold(priv, wrqu->frag.value); - mutex_unlock(&priv->mutex); - IPW_DEBUG_WX("SET Frag Threshold -> %d\n", wrqu->frag.value); - return 0; -} - -static int ipw_wx_get_frag(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - mutex_lock(&priv->mutex); - wrqu->frag.value = priv->ieee->fts; - wrqu->frag.fixed = 0; /* no auto select */ - wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FTS); - mutex_unlock(&priv->mutex); - IPW_DEBUG_WX("GET Frag Threshold -> %d\n", wrqu->frag.value); - - return 0; -} - -static int ipw_wx_set_retry(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - - if (wrqu->retry.flags & IW_RETRY_LIFETIME || wrqu->retry.disabled) - return -EINVAL; - - if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) - return 0; - - if (wrqu->retry.value < 0 || wrqu->retry.value >= 255) - return -EINVAL; - - mutex_lock(&priv->mutex); - if (wrqu->retry.flags & IW_RETRY_SHORT) - priv->short_retry_limit = (u8) wrqu->retry.value; - else if (wrqu->retry.flags & IW_RETRY_LONG) - priv->long_retry_limit = (u8) wrqu->retry.value; - else { - priv->short_retry_limit = (u8) wrqu->retry.value; - priv->long_retry_limit = (u8) wrqu->retry.value; - } - - ipw_send_retry_limit(priv, priv->short_retry_limit, - priv->long_retry_limit); - mutex_unlock(&priv->mutex); - IPW_DEBUG_WX("SET retry limit -> short:%d long:%d\n", - priv->short_retry_limit, priv->long_retry_limit); - return 0; -} - -static int ipw_wx_get_retry(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - - mutex_lock(&priv->mutex); - wrqu->retry.disabled = 0; - - if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { - mutex_unlock(&priv->mutex); - return -EINVAL; - } - - if (wrqu->retry.flags & IW_RETRY_LONG) { - wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; - wrqu->retry.value = priv->long_retry_limit; - } else if (wrqu->retry.flags & IW_RETRY_SHORT) { - wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; - wrqu->retry.value = priv->short_retry_limit; - } else { - wrqu->retry.flags = IW_RETRY_LIMIT; - wrqu->retry.value = priv->short_retry_limit; - } - mutex_unlock(&priv->mutex); - - IPW_DEBUG_WX("GET retry -> %d\n", wrqu->retry.value); - - return 0; -} - -static int ipw_wx_set_scan(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - struct iw_scan_req *req = (struct iw_scan_req *)extra; - struct delayed_work *work = NULL; - - mutex_lock(&priv->mutex); - - priv->user_requested_scan = 1; - - if (wrqu->data.length == sizeof(struct iw_scan_req)) { - if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { - int len = min((int)req->essid_len, - (int)sizeof(priv->direct_scan_ssid)); - memcpy(priv->direct_scan_ssid, req->essid, len); - priv->direct_scan_ssid_len = len; - work = &priv->request_direct_scan; - } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { - work = &priv->request_passive_scan; - } - } else { - /* Normal active broadcast scan */ - work = &priv->request_scan; - } - - mutex_unlock(&priv->mutex); - - IPW_DEBUG_WX("Start scan\n"); - - schedule_delayed_work(work, 0); - - return 0; -} - -static int ipw_wx_get_scan(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - return libipw_wx_get_scan(priv->ieee, info, wrqu, extra); -} - -static int ipw_wx_set_encode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key) -{ - struct ipw_priv *priv = libipw_priv(dev); - int ret; - u32 cap = priv->capability; - - mutex_lock(&priv->mutex); - ret = libipw_wx_set_encode(priv->ieee, info, wrqu, key); - - /* In IBSS mode, we need to notify the firmware to update - * the beacon info after we changed the capability. */ - if (cap != priv->capability && - priv->ieee->iw_mode == IW_MODE_ADHOC && - priv->status & STATUS_ASSOCIATED) - ipw_disassociate(priv); - - mutex_unlock(&priv->mutex); - return ret; -} - -static int ipw_wx_get_encode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key) -{ - struct ipw_priv *priv = libipw_priv(dev); - return libipw_wx_get_encode(priv->ieee, info, wrqu, key); -} - -static int ipw_wx_set_power(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - int err; - mutex_lock(&priv->mutex); - if (wrqu->power.disabled) { - priv->power_mode = IPW_POWER_LEVEL(priv->power_mode); - err = ipw_send_power_mode(priv, IPW_POWER_MODE_CAM); - if (err) { - IPW_DEBUG_WX("failed setting power mode.\n"); - mutex_unlock(&priv->mutex); - return err; - } - IPW_DEBUG_WX("SET Power Management Mode -> off\n"); - mutex_unlock(&priv->mutex); - return 0; - } - - switch (wrqu->power.flags & IW_POWER_MODE) { - case IW_POWER_ON: /* If not specified */ - case IW_POWER_MODE: /* If set all mask */ - case IW_POWER_ALL_R: /* If explicitly state all */ - break; - default: /* Otherwise we don't support it */ - IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", - wrqu->power.flags); - mutex_unlock(&priv->mutex); - return -EOPNOTSUPP; - } - - /* If the user hasn't specified a power management mode yet, default - * to BATTERY */ - if (IPW_POWER_LEVEL(priv->power_mode) == IPW_POWER_AC) - priv->power_mode = IPW_POWER_ENABLED | IPW_POWER_BATTERY; - else - priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; - - err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); - if (err) { - IPW_DEBUG_WX("failed setting power mode.\n"); - mutex_unlock(&priv->mutex); - return err; - } - - IPW_DEBUG_WX("SET Power Management Mode -> 0x%02X\n", priv->power_mode); - mutex_unlock(&priv->mutex); - return 0; -} - -static int ipw_wx_get_power(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - mutex_lock(&priv->mutex); - if (!(priv->power_mode & IPW_POWER_ENABLED)) - wrqu->power.disabled = 1; - else - wrqu->power.disabled = 0; - - mutex_unlock(&priv->mutex); - IPW_DEBUG_WX("GET Power Management Mode -> %02X\n", priv->power_mode); - - return 0; -} - -static int ipw_wx_set_powermode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - int mode = *(int *)extra; - int err; - - mutex_lock(&priv->mutex); - if ((mode < 1) || (mode > IPW_POWER_LIMIT)) - mode = IPW_POWER_AC; - - if (IPW_POWER_LEVEL(priv->power_mode) != mode) { - err = ipw_send_power_mode(priv, mode); - if (err) { - IPW_DEBUG_WX("failed setting power mode.\n"); - mutex_unlock(&priv->mutex); - return err; - } - priv->power_mode = IPW_POWER_ENABLED | mode; - } - mutex_unlock(&priv->mutex); - return 0; -} - -#define MAX_WX_STRING 80 -static int ipw_wx_get_powermode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - int level = IPW_POWER_LEVEL(priv->power_mode); - char *p = extra; - - p += snprintf(p, MAX_WX_STRING, "Power save level: %d ", level); - - switch (level) { - case IPW_POWER_AC: - p += snprintf(p, MAX_WX_STRING - (p - extra), "(AC)"); - break; - case IPW_POWER_BATTERY: - p += snprintf(p, MAX_WX_STRING - (p - extra), "(BATTERY)"); - break; - default: - p += snprintf(p, MAX_WX_STRING - (p - extra), - "(Timeout %dms, Period %dms)", - timeout_duration[level - 1] / 1000, - period_duration[level - 1] / 1000); - } - - if (!(priv->power_mode & IPW_POWER_ENABLED)) - p += snprintf(p, MAX_WX_STRING - (p - extra), " OFF"); - - wrqu->data.length = p - extra + 1; - - return 0; -} - -static int ipw_wx_set_wireless_mode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - int mode = *(int *)extra; - u8 band = 0, modulation = 0; - - if (mode == 0 || mode & ~IEEE_MODE_MASK) { - IPW_WARNING("Attempt to set invalid wireless mode: %d\n", mode); - return -EINVAL; - } - mutex_lock(&priv->mutex); - if (priv->adapter == IPW_2915ABG) { - priv->ieee->abg_true = 1; - if (mode & IEEE_A) { - band |= LIBIPW_52GHZ_BAND; - modulation |= LIBIPW_OFDM_MODULATION; - } else - priv->ieee->abg_true = 0; - } else { - if (mode & IEEE_A) { - IPW_WARNING("Attempt to set 2200BG into " - "802.11a mode\n"); - mutex_unlock(&priv->mutex); - return -EINVAL; - } - - priv->ieee->abg_true = 0; - } - - if (mode & IEEE_B) { - band |= LIBIPW_24GHZ_BAND; - modulation |= LIBIPW_CCK_MODULATION; - } else - priv->ieee->abg_true = 0; - - if (mode & IEEE_G) { - band |= LIBIPW_24GHZ_BAND; - modulation |= LIBIPW_OFDM_MODULATION; - } else - priv->ieee->abg_true = 0; - - priv->ieee->mode = mode; - priv->ieee->freq_band = band; - priv->ieee->modulation = modulation; - init_supported_rates(priv, &priv->rates); - - /* Network configuration changed -- force [re]association */ - IPW_DEBUG_ASSOC("[re]association triggered due to mode change.\n"); - if (!ipw_disassociate(priv)) { - ipw_send_supported_rates(priv, &priv->rates); - ipw_associate(priv); - } - - /* Update the band LEDs */ - ipw_led_band_on(priv); - - IPW_DEBUG_WX("PRIV SET MODE: %c%c%c\n", - mode & IEEE_A ? 'a' : '.', - mode & IEEE_B ? 'b' : '.', mode & IEEE_G ? 'g' : '.'); - mutex_unlock(&priv->mutex); - return 0; -} - -static int ipw_wx_get_wireless_mode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - mutex_lock(&priv->mutex); - switch (priv->ieee->mode) { - case IEEE_A: - strncpy(extra, "802.11a (1)", MAX_WX_STRING); - break; - case IEEE_B: - strncpy(extra, "802.11b (2)", MAX_WX_STRING); - break; - case IEEE_A | IEEE_B: - strncpy(extra, "802.11ab (3)", MAX_WX_STRING); - break; - case IEEE_G: - strncpy(extra, "802.11g (4)", MAX_WX_STRING); - break; - case IEEE_A | IEEE_G: - strncpy(extra, "802.11ag (5)", MAX_WX_STRING); - break; - case IEEE_B | IEEE_G: - strncpy(extra, "802.11bg (6)", MAX_WX_STRING); - break; - case IEEE_A | IEEE_B | IEEE_G: - strncpy(extra, "802.11abg (7)", MAX_WX_STRING); - break; - default: - strncpy(extra, "unknown", MAX_WX_STRING); - break; - } - - IPW_DEBUG_WX("PRIV GET MODE: %s\n", extra); - - wrqu->data.length = strlen(extra) + 1; - mutex_unlock(&priv->mutex); - - return 0; -} - -static int ipw_wx_set_preamble(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - int mode = *(int *)extra; - mutex_lock(&priv->mutex); - /* Switching from SHORT -> LONG requires a disassociation */ - if (mode == 1) { - if (!(priv->config & CFG_PREAMBLE_LONG)) { - priv->config |= CFG_PREAMBLE_LONG; - - /* Network configuration changed -- force [re]association */ - IPW_DEBUG_ASSOC - ("[re]association triggered due to preamble change.\n"); - if (!ipw_disassociate(priv)) - ipw_associate(priv); - } - goto done; - } - - if (mode == 0) { - priv->config &= ~CFG_PREAMBLE_LONG; - goto done; - } - mutex_unlock(&priv->mutex); - return -EINVAL; - - done: - mutex_unlock(&priv->mutex); - return 0; -} - -static int ipw_wx_get_preamble(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - mutex_lock(&priv->mutex); - if (priv->config & CFG_PREAMBLE_LONG) - snprintf(wrqu->name, IFNAMSIZ, "long (1)"); - else - snprintf(wrqu->name, IFNAMSIZ, "auto (0)"); - mutex_unlock(&priv->mutex); - return 0; -} - -#ifdef CONFIG_IPW2200_MONITOR -static int ipw_wx_set_monitor(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - int *parms = (int *)extra; - int enable = (parms[0] > 0); - mutex_lock(&priv->mutex); - IPW_DEBUG_WX("SET MONITOR: %d %d\n", enable, parms[1]); - if (enable) { - if (priv->ieee->iw_mode != IW_MODE_MONITOR) { -#ifdef CONFIG_IPW2200_RADIOTAP - priv->net_dev->type = ARPHRD_IEEE80211_RADIOTAP; -#else - priv->net_dev->type = ARPHRD_IEEE80211; -#endif - schedule_work(&priv->adapter_restart); - } - - ipw_set_channel(priv, parms[1]); - } else { - if (priv->ieee->iw_mode != IW_MODE_MONITOR) { - mutex_unlock(&priv->mutex); - return 0; - } - priv->net_dev->type = ARPHRD_ETHER; - schedule_work(&priv->adapter_restart); - } - mutex_unlock(&priv->mutex); - return 0; -} - -#endif /* CONFIG_IPW2200_MONITOR */ - -static int ipw_wx_reset(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - IPW_DEBUG_WX("RESET\n"); - schedule_work(&priv->adapter_restart); - return 0; -} - -static int ipw_wx_sw_reset(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct ipw_priv *priv = libipw_priv(dev); - union iwreq_data wrqu_sec = { - .encoding = { - .flags = IW_ENCODE_DISABLED, - }, - }; - int ret; - - IPW_DEBUG_WX("SW_RESET\n"); - - mutex_lock(&priv->mutex); - - ret = ipw_sw_reset(priv, 2); - if (!ret) { - free_firmware(); - ipw_adapter_restart(priv); - } - - /* The SW reset bit might have been toggled on by the 'disable' - * module parameter, so take appropriate action */ - ipw_radio_kill_sw(priv, priv->status & STATUS_RF_KILL_SW); - - mutex_unlock(&priv->mutex); - libipw_wx_set_encode(priv->ieee, info, &wrqu_sec, NULL); - mutex_lock(&priv->mutex); - - if (!(priv->status & STATUS_RF_KILL_MASK)) { - /* Configuration likely changed -- force [re]association */ - IPW_DEBUG_ASSOC("[re]association triggered due to sw " - "reset.\n"); - if (!ipw_disassociate(priv)) - ipw_associate(priv); - } - - mutex_unlock(&priv->mutex); - - return 0; -} - -/* Rebase the WE IOCTLs to zero for the handler array */ -static iw_handler ipw_wx_handlers[] = { - IW_HANDLER(SIOCGIWNAME, (iw_handler)cfg80211_wext_giwname), - IW_HANDLER(SIOCSIWFREQ, ipw_wx_set_freq), - IW_HANDLER(SIOCGIWFREQ, ipw_wx_get_freq), - IW_HANDLER(SIOCSIWMODE, ipw_wx_set_mode), - IW_HANDLER(SIOCGIWMODE, ipw_wx_get_mode), - IW_HANDLER(SIOCSIWSENS, ipw_wx_set_sens), - IW_HANDLER(SIOCGIWSENS, ipw_wx_get_sens), - IW_HANDLER(SIOCGIWRANGE, ipw_wx_get_range), - IW_HANDLER(SIOCSIWAP, ipw_wx_set_wap), - IW_HANDLER(SIOCGIWAP, ipw_wx_get_wap), - IW_HANDLER(SIOCSIWSCAN, ipw_wx_set_scan), - IW_HANDLER(SIOCGIWSCAN, ipw_wx_get_scan), - IW_HANDLER(SIOCSIWESSID, ipw_wx_set_essid), - IW_HANDLER(SIOCGIWESSID, ipw_wx_get_essid), - IW_HANDLER(SIOCSIWNICKN, ipw_wx_set_nick), - IW_HANDLER(SIOCGIWNICKN, ipw_wx_get_nick), - IW_HANDLER(SIOCSIWRATE, ipw_wx_set_rate), - IW_HANDLER(SIOCGIWRATE, ipw_wx_get_rate), - IW_HANDLER(SIOCSIWRTS, ipw_wx_set_rts), - IW_HANDLER(SIOCGIWRTS, ipw_wx_get_rts), - IW_HANDLER(SIOCSIWFRAG, ipw_wx_set_frag), - IW_HANDLER(SIOCGIWFRAG, ipw_wx_get_frag), - IW_HANDLER(SIOCSIWTXPOW, ipw_wx_set_txpow), - IW_HANDLER(SIOCGIWTXPOW, ipw_wx_get_txpow), - IW_HANDLER(SIOCSIWRETRY, ipw_wx_set_retry), - IW_HANDLER(SIOCGIWRETRY, ipw_wx_get_retry), - IW_HANDLER(SIOCSIWENCODE, ipw_wx_set_encode), - IW_HANDLER(SIOCGIWENCODE, ipw_wx_get_encode), - IW_HANDLER(SIOCSIWPOWER, ipw_wx_set_power), - IW_HANDLER(SIOCGIWPOWER, ipw_wx_get_power), - IW_HANDLER(SIOCSIWSPY, iw_handler_set_spy), - IW_HANDLER(SIOCGIWSPY, iw_handler_get_spy), - IW_HANDLER(SIOCSIWTHRSPY, iw_handler_set_thrspy), - IW_HANDLER(SIOCGIWTHRSPY, iw_handler_get_thrspy), - IW_HANDLER(SIOCSIWGENIE, ipw_wx_set_genie), - IW_HANDLER(SIOCGIWGENIE, ipw_wx_get_genie), - IW_HANDLER(SIOCSIWMLME, ipw_wx_set_mlme), - IW_HANDLER(SIOCSIWAUTH, ipw_wx_set_auth), - IW_HANDLER(SIOCGIWAUTH, ipw_wx_get_auth), - IW_HANDLER(SIOCSIWENCODEEXT, ipw_wx_set_encodeext), - IW_HANDLER(SIOCGIWENCODEEXT, ipw_wx_get_encodeext), -}; - -enum { - IPW_PRIV_SET_POWER = SIOCIWFIRSTPRIV, - IPW_PRIV_GET_POWER, - IPW_PRIV_SET_MODE, - IPW_PRIV_GET_MODE, - IPW_PRIV_SET_PREAMBLE, - IPW_PRIV_GET_PREAMBLE, - IPW_PRIV_RESET, - IPW_PRIV_SW_RESET, -#ifdef CONFIG_IPW2200_MONITOR - IPW_PRIV_SET_MONITOR, -#endif -}; - -static struct iw_priv_args ipw_priv_args[] = { - { - .cmd = IPW_PRIV_SET_POWER, - .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - .name = "set_power"}, - { - .cmd = IPW_PRIV_GET_POWER, - .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, - .name = "get_power"}, - { - .cmd = IPW_PRIV_SET_MODE, - .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - .name = "set_mode"}, - { - .cmd = IPW_PRIV_GET_MODE, - .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | MAX_WX_STRING, - .name = "get_mode"}, - { - .cmd = IPW_PRIV_SET_PREAMBLE, - .set_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - .name = "set_preamble"}, - { - .cmd = IPW_PRIV_GET_PREAMBLE, - .get_args = IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | IFNAMSIZ, - .name = "get_preamble"}, - { - IPW_PRIV_RESET, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "reset"}, - { - IPW_PRIV_SW_RESET, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 0, 0, "sw_reset"}, -#ifdef CONFIG_IPW2200_MONITOR - { - IPW_PRIV_SET_MONITOR, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "monitor"}, -#endif /* CONFIG_IPW2200_MONITOR */ -}; - -static iw_handler ipw_priv_handler[] = { - ipw_wx_set_powermode, - ipw_wx_get_powermode, - ipw_wx_set_wireless_mode, - ipw_wx_get_wireless_mode, - ipw_wx_set_preamble, - ipw_wx_get_preamble, - ipw_wx_reset, - ipw_wx_sw_reset, -#ifdef CONFIG_IPW2200_MONITOR - ipw_wx_set_monitor, -#endif -}; - -static struct iw_handler_def ipw_wx_handler_def = { - .standard = ipw_wx_handlers, - .num_standard = ARRAY_SIZE(ipw_wx_handlers), - .num_private = ARRAY_SIZE(ipw_priv_handler), - .num_private_args = ARRAY_SIZE(ipw_priv_args), - .private = ipw_priv_handler, - .private_args = ipw_priv_args, - .get_wireless_stats = ipw_get_wireless_stats, -}; - -/* - * Get wireless statistics. - * Called by /proc/net/wireless - * Also called by SIOCGIWSTATS - */ -static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev) -{ - struct ipw_priv *priv = libipw_priv(dev); - struct iw_statistics *wstats; - - wstats = &priv->wstats; - - /* if hw is disabled, then ipw_get_ordinal() can't be called. - * netdev->get_wireless_stats seems to be called before fw is - * initialized. STATUS_ASSOCIATED will only be set if the hw is up - * and associated; if not associcated, the values are all meaningless - * anyway, so set them all to NULL and INVALID */ - if (!(priv->status & STATUS_ASSOCIATED)) { - wstats->miss.beacon = 0; - wstats->discard.retries = 0; - wstats->qual.qual = 0; - wstats->qual.level = 0; - wstats->qual.noise = 0; - wstats->qual.updated = 7; - wstats->qual.updated |= IW_QUAL_NOISE_INVALID | - IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; - return wstats; - } - - wstats->qual.qual = priv->quality; - wstats->qual.level = priv->exp_avg_rssi; - wstats->qual.noise = priv->exp_avg_noise; - wstats->qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | - IW_QUAL_NOISE_UPDATED | IW_QUAL_DBM; - - wstats->miss.beacon = average_value(&priv->average_missed_beacons); - wstats->discard.retries = priv->last_tx_failures; - wstats->discard.code = priv->ieee->ieee_stats.rx_discards_undecryptable; - -/* if (ipw_get_ordinal(priv, IPW_ORD_STAT_TX_RETRY, &tx_retry, &len)) - goto fail_get_ordinal; - wstats->discard.retries += tx_retry; */ - - return wstats; -} - -/* net device stuff */ - -static void init_sys_config(struct ipw_sys_config *sys_config) -{ - memset(sys_config, 0, sizeof(struct ipw_sys_config)); - sys_config->bt_coexistence = 0; - sys_config->answer_broadcast_ssid_probe = 0; - sys_config->accept_all_data_frames = 0; - sys_config->accept_non_directed_frames = 1; - sys_config->exclude_unicast_unencrypted = 0; - sys_config->disable_unicast_decryption = 1; - sys_config->exclude_multicast_unencrypted = 0; - sys_config->disable_multicast_decryption = 1; - if (antenna < CFG_SYS_ANTENNA_BOTH || antenna > CFG_SYS_ANTENNA_B) - antenna = CFG_SYS_ANTENNA_BOTH; - sys_config->antenna_diversity = antenna; - sys_config->pass_crc_to_host = 0; /* TODO: See if 1 gives us FCS */ - sys_config->dot11g_auto_detection = 0; - sys_config->enable_cts_to_self = 0; - sys_config->bt_coexist_collision_thr = 0; - sys_config->pass_noise_stats_to_host = 1; /* 1 -- fix for 256 */ - sys_config->silence_threshold = 0x1e; -} - -static int ipw_net_open(struct net_device *dev) -{ - IPW_DEBUG_INFO("dev->open\n"); - netif_start_queue(dev); - return 0; -} - -static int ipw_net_stop(struct net_device *dev) -{ - IPW_DEBUG_INFO("dev->close\n"); - netif_stop_queue(dev); - return 0; -} - -/* -todo: - -modify to send one tfd per fragment instead of using chunking. otherwise -we need to heavily modify the libipw_skb_to_txb. -*/ - -static int ipw_tx_skb(struct ipw_priv *priv, struct libipw_txb *txb, - int pri) -{ - struct libipw_hdr_3addrqos *hdr = (struct libipw_hdr_3addrqos *) - txb->fragments[0]->data; - int i = 0; - struct tfd_frame *tfd; -#ifdef CONFIG_IPW2200_QOS - int tx_id = ipw_get_tx_queue_number(priv, pri); - struct clx2_tx_queue *txq = &priv->txq[tx_id]; -#else - struct clx2_tx_queue *txq = &priv->txq[0]; -#endif - struct clx2_queue *q = &txq->q; - u8 id, hdr_len, unicast; - int fc; - - if (!(priv->status & STATUS_ASSOCIATED)) - goto drop; - - hdr_len = libipw_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); - switch (priv->ieee->iw_mode) { - case IW_MODE_ADHOC: - unicast = !is_multicast_ether_addr(hdr->addr1); - id = ipw_find_station(priv, hdr->addr1); - if (id == IPW_INVALID_STATION) { - id = ipw_add_station(priv, hdr->addr1); - if (id == IPW_INVALID_STATION) { - IPW_WARNING("Attempt to send data to " - "invalid cell: %pM\n", - hdr->addr1); - goto drop; - } - } - break; - - case IW_MODE_INFRA: - default: - unicast = !is_multicast_ether_addr(hdr->addr3); - id = 0; - break; - } - - tfd = &txq->bd[q->first_empty]; - txq->txb[q->first_empty] = txb; - memset(tfd, 0, sizeof(*tfd)); - tfd->u.data.station_number = id; - - tfd->control_flags.message_type = TX_FRAME_TYPE; - tfd->control_flags.control_bits = TFD_NEED_IRQ_MASK; - - tfd->u.data.cmd_id = DINO_CMD_TX; - tfd->u.data.len = cpu_to_le16(txb->payload_size); - - if (priv->assoc_request.ieee_mode == IPW_B_MODE) - tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_MODE_CCK; - else - tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_MODE_OFDM; - - if (priv->assoc_request.preamble_length == DCT_FLAG_SHORT_PREAMBLE) - tfd->u.data.tx_flags |= DCT_FLAG_SHORT_PREAMBLE; - - fc = le16_to_cpu(hdr->frame_ctl); - hdr->frame_ctl = cpu_to_le16(fc & ~IEEE80211_FCTL_MOREFRAGS); - - memcpy(&tfd->u.data.tfd.tfd_24.mchdr, hdr, hdr_len); - - if (likely(unicast)) - tfd->u.data.tx_flags |= DCT_FLAG_ACK_REQD; - - if (txb->encrypted && !priv->ieee->host_encrypt) { - switch (priv->ieee->sec.level) { - case SEC_LEVEL_3: - tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= - cpu_to_le16(IEEE80211_FCTL_PROTECTED); - /* XXX: ACK flag must be set for CCMP even if it - * is a multicast/broadcast packet, because CCMP - * group communication encrypted by GTK is - * actually done by the AP. */ - if (!unicast) - tfd->u.data.tx_flags |= DCT_FLAG_ACK_REQD; - - tfd->u.data.tx_flags &= ~DCT_FLAG_NO_WEP; - tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_SECURITY_CCM; - tfd->u.data.key_index = 0; - tfd->u.data.key_index |= DCT_WEP_INDEX_USE_IMMEDIATE; - break; - case SEC_LEVEL_2: - tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= - cpu_to_le16(IEEE80211_FCTL_PROTECTED); - tfd->u.data.tx_flags &= ~DCT_FLAG_NO_WEP; - tfd->u.data.tx_flags_ext |= DCT_FLAG_EXT_SECURITY_TKIP; - tfd->u.data.key_index = DCT_WEP_INDEX_USE_IMMEDIATE; - break; - case SEC_LEVEL_1: - tfd->u.data.tfd.tfd_24.mchdr.frame_ctl |= - cpu_to_le16(IEEE80211_FCTL_PROTECTED); - tfd->u.data.key_index = priv->ieee->crypt_info.tx_keyidx; - if (priv->ieee->sec.key_sizes[priv->ieee->crypt_info.tx_keyidx] <= - 40) - tfd->u.data.key_index |= DCT_WEP_KEY_64Bit; - else - tfd->u.data.key_index |= DCT_WEP_KEY_128Bit; - break; - case SEC_LEVEL_0: - break; - default: - printk(KERN_ERR "Unknown security level %d\n", - priv->ieee->sec.level); - break; - } - } else - /* No hardware encryption */ - tfd->u.data.tx_flags |= DCT_FLAG_NO_WEP; - -#ifdef CONFIG_IPW2200_QOS - if (fc & IEEE80211_STYPE_QOS_DATA) - ipw_qos_set_tx_queue_command(priv, pri, &(tfd->u.data)); -#endif /* CONFIG_IPW2200_QOS */ - - /* payload */ - tfd->u.data.num_chunks = cpu_to_le32(min((u8) (NUM_TFD_CHUNKS - 2), - txb->nr_frags)); - IPW_DEBUG_FRAG("%i fragments being sent as %i chunks.\n", - txb->nr_frags, le32_to_cpu(tfd->u.data.num_chunks)); - for (i = 0; i < le32_to_cpu(tfd->u.data.num_chunks); i++) { - IPW_DEBUG_FRAG("Adding fragment %i of %i (%d bytes).\n", - i, le32_to_cpu(tfd->u.data.num_chunks), - txb->fragments[i]->len - hdr_len); - IPW_DEBUG_TX("Dumping TX packet frag %i of %i (%d bytes):\n", - i, tfd->u.data.num_chunks, - txb->fragments[i]->len - hdr_len); - printk_buf(IPW_DL_TX, txb->fragments[i]->data + hdr_len, - txb->fragments[i]->len - hdr_len); - - tfd->u.data.chunk_ptr[i] = - cpu_to_le32(pci_map_single - (priv->pci_dev, - txb->fragments[i]->data + hdr_len, - txb->fragments[i]->len - hdr_len, - PCI_DMA_TODEVICE)); - tfd->u.data.chunk_len[i] = - cpu_to_le16(txb->fragments[i]->len - hdr_len); - } - - if (i != txb->nr_frags) { - struct sk_buff *skb; - u16 remaining_bytes = 0; - int j; - - for (j = i; j < txb->nr_frags; j++) - remaining_bytes += txb->fragments[j]->len - hdr_len; - - printk(KERN_INFO "Trying to reallocate for %d bytes\n", - remaining_bytes); - skb = alloc_skb(remaining_bytes, GFP_ATOMIC); - if (skb != NULL) { - tfd->u.data.chunk_len[i] = cpu_to_le16(remaining_bytes); - for (j = i; j < txb->nr_frags; j++) { - int size = txb->fragments[j]->len - hdr_len; - - printk(KERN_INFO "Adding frag %d %d...\n", - j, size); - memcpy(skb_put(skb, size), - txb->fragments[j]->data + hdr_len, size); - } - dev_kfree_skb_any(txb->fragments[i]); - txb->fragments[i] = skb; - tfd->u.data.chunk_ptr[i] = - cpu_to_le32(pci_map_single - (priv->pci_dev, skb->data, - remaining_bytes, - PCI_DMA_TODEVICE)); - - le32_add_cpu(&tfd->u.data.num_chunks, 1); - } - } - - /* kick DMA */ - q->first_empty = ipw_queue_inc_wrap(q->first_empty, q->n_bd); - ipw_write32(priv, q->reg_w, q->first_empty); - - if (ipw_tx_queue_space(q) < q->high_mark) - netif_stop_queue(priv->net_dev); - - return NETDEV_TX_OK; - - drop: - IPW_DEBUG_DROP("Silently dropping Tx packet.\n"); - libipw_txb_free(txb); - return NETDEV_TX_OK; -} - -static int ipw_net_is_queue_full(struct net_device *dev, int pri) -{ - struct ipw_priv *priv = libipw_priv(dev); -#ifdef CONFIG_IPW2200_QOS - int tx_id = ipw_get_tx_queue_number(priv, pri); - struct clx2_tx_queue *txq = &priv->txq[tx_id]; -#else - struct clx2_tx_queue *txq = &priv->txq[0]; -#endif /* CONFIG_IPW2200_QOS */ - - if (ipw_tx_queue_space(&txq->q) < txq->q.high_mark) - return 1; - - return 0; -} - -#ifdef CONFIG_IPW2200_PROMISCUOUS -static void ipw_handle_promiscuous_tx(struct ipw_priv *priv, - struct libipw_txb *txb) -{ - struct libipw_rx_stats dummystats; - struct ieee80211_hdr *hdr; - u8 n; - u16 filter = priv->prom_priv->filter; - int hdr_only = 0; - - if (filter & IPW_PROM_NO_TX) - return; - - memset(&dummystats, 0, sizeof(dummystats)); - - /* Filtering of fragment chains is done against the first fragment */ - hdr = (void *)txb->fragments[0]->data; - if (libipw_is_management(le16_to_cpu(hdr->frame_control))) { - if (filter & IPW_PROM_NO_MGMT) - return; - if (filter & IPW_PROM_MGMT_HEADER_ONLY) - hdr_only = 1; - } else if (libipw_is_control(le16_to_cpu(hdr->frame_control))) { - if (filter & IPW_PROM_NO_CTL) - return; - if (filter & IPW_PROM_CTL_HEADER_ONLY) - hdr_only = 1; - } else if (libipw_is_data(le16_to_cpu(hdr->frame_control))) { - if (filter & IPW_PROM_NO_DATA) - return; - if (filter & IPW_PROM_DATA_HEADER_ONLY) - hdr_only = 1; - } - - for(n=0; nnr_frags; ++n) { - struct sk_buff *src = txb->fragments[n]; - struct sk_buff *dst; - struct ieee80211_radiotap_header *rt_hdr; - int len; - - if (hdr_only) { - hdr = (void *)src->data; - len = libipw_get_hdrlen(le16_to_cpu(hdr->frame_control)); - } else - len = src->len; - - dst = alloc_skb(len + sizeof(*rt_hdr) + sizeof(u16)*2, GFP_ATOMIC); - if (!dst) - continue; - - rt_hdr = (void *)skb_put(dst, sizeof(*rt_hdr)); - - rt_hdr->it_version = PKTHDR_RADIOTAP_VERSION; - rt_hdr->it_pad = 0; - rt_hdr->it_present = 0; /* after all, it's just an idea */ - rt_hdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_CHANNEL); - - *(__le16*)skb_put(dst, sizeof(u16)) = cpu_to_le16( - ieee80211chan2mhz(priv->channel)); - if (priv->channel > 14) /* 802.11a */ - *(__le16*)skb_put(dst, sizeof(u16)) = - cpu_to_le16(IEEE80211_CHAN_OFDM | - IEEE80211_CHAN_5GHZ); - else if (priv->ieee->mode == IEEE_B) /* 802.11b */ - *(__le16*)skb_put(dst, sizeof(u16)) = - cpu_to_le16(IEEE80211_CHAN_CCK | - IEEE80211_CHAN_2GHZ); - else /* 802.11g */ - *(__le16*)skb_put(dst, sizeof(u16)) = - cpu_to_le16(IEEE80211_CHAN_OFDM | - IEEE80211_CHAN_2GHZ); - - rt_hdr->it_len = cpu_to_le16(dst->len); - - skb_copy_from_linear_data(src, skb_put(dst, len), len); - - if (!libipw_rx(priv->prom_priv->ieee, dst, &dummystats)) - dev_kfree_skb_any(dst); - } -} -#endif - -static netdev_tx_t ipw_net_hard_start_xmit(struct libipw_txb *txb, - struct net_device *dev, int pri) -{ - struct ipw_priv *priv = libipw_priv(dev); - unsigned long flags; - netdev_tx_t ret; - - IPW_DEBUG_TX("dev->xmit(%d bytes)\n", txb->payload_size); - spin_lock_irqsave(&priv->lock, flags); - -#ifdef CONFIG_IPW2200_PROMISCUOUS - if (rtap_iface && netif_running(priv->prom_net_dev)) - ipw_handle_promiscuous_tx(priv, txb); -#endif - - ret = ipw_tx_skb(priv, txb, pri); - if (ret == NETDEV_TX_OK) - __ipw_led_activity_on(priv); - spin_unlock_irqrestore(&priv->lock, flags); - - return ret; -} - -static void ipw_net_set_multicast_list(struct net_device *dev) -{ - -} - -static int ipw_net_set_mac_address(struct net_device *dev, void *p) -{ - struct ipw_priv *priv = libipw_priv(dev); - struct sockaddr *addr = p; - - if (!is_valid_ether_addr(addr->sa_data)) - return -EADDRNOTAVAIL; - mutex_lock(&priv->mutex); - priv->config |= CFG_CUSTOM_MAC; - memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN); - printk(KERN_INFO "%s: Setting MAC to %pM\n", - priv->net_dev->name, priv->mac_addr); - schedule_work(&priv->adapter_restart); - mutex_unlock(&priv->mutex); - return 0; -} - -static void ipw_ethtool_get_drvinfo(struct net_device *dev, - struct ethtool_drvinfo *info) -{ - struct ipw_priv *p = libipw_priv(dev); - char vers[64]; - char date[32]; - u32 len; - - strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); - strlcpy(info->version, DRV_VERSION, sizeof(info->version)); - - len = sizeof(vers); - ipw_get_ordinal(p, IPW_ORD_STAT_FW_VERSION, vers, &len); - len = sizeof(date); - ipw_get_ordinal(p, IPW_ORD_STAT_FW_DATE, date, &len); - - snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)", - vers, date); - strlcpy(info->bus_info, pci_name(p->pci_dev), - sizeof(info->bus_info)); - info->eedump_len = IPW_EEPROM_IMAGE_SIZE; -} - -static u32 ipw_ethtool_get_link(struct net_device *dev) -{ - struct ipw_priv *priv = libipw_priv(dev); - return (priv->status & STATUS_ASSOCIATED) != 0; -} - -static int ipw_ethtool_get_eeprom_len(struct net_device *dev) -{ - return IPW_EEPROM_IMAGE_SIZE; -} - -static int ipw_ethtool_get_eeprom(struct net_device *dev, - struct ethtool_eeprom *eeprom, u8 * bytes) -{ - struct ipw_priv *p = libipw_priv(dev); - - if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) - return -EINVAL; - mutex_lock(&p->mutex); - memcpy(bytes, &p->eeprom[eeprom->offset], eeprom->len); - mutex_unlock(&p->mutex); - return 0; -} - -static int ipw_ethtool_set_eeprom(struct net_device *dev, - struct ethtool_eeprom *eeprom, u8 * bytes) -{ - struct ipw_priv *p = libipw_priv(dev); - int i; - - if (eeprom->offset + eeprom->len > IPW_EEPROM_IMAGE_SIZE) - return -EINVAL; - mutex_lock(&p->mutex); - memcpy(&p->eeprom[eeprom->offset], bytes, eeprom->len); - for (i = 0; i < IPW_EEPROM_IMAGE_SIZE; i++) - ipw_write8(p, i + IPW_EEPROM_DATA, p->eeprom[i]); - mutex_unlock(&p->mutex); - return 0; -} - -static const struct ethtool_ops ipw_ethtool_ops = { - .get_link = ipw_ethtool_get_link, - .get_drvinfo = ipw_ethtool_get_drvinfo, - .get_eeprom_len = ipw_ethtool_get_eeprom_len, - .get_eeprom = ipw_ethtool_get_eeprom, - .set_eeprom = ipw_ethtool_set_eeprom, -}; - -static irqreturn_t ipw_isr(int irq, void *data) -{ - struct ipw_priv *priv = data; - u32 inta, inta_mask; - - if (!priv) - return IRQ_NONE; - - spin_lock(&priv->irq_lock); - - if (!(priv->status & STATUS_INT_ENABLED)) { - /* IRQ is disabled */ - goto none; - } - - inta = ipw_read32(priv, IPW_INTA_RW); - inta_mask = ipw_read32(priv, IPW_INTA_MASK_R); - - if (inta == 0xFFFFFFFF) { - /* Hardware disappeared */ - IPW_WARNING("IRQ INTA == 0xFFFFFFFF\n"); - goto none; - } - - if (!(inta & (IPW_INTA_MASK_ALL & inta_mask))) { - /* Shared interrupt */ - goto none; - } - - /* tell the device to stop sending interrupts */ - __ipw_disable_interrupts(priv); - - /* ack current interrupts */ - inta &= (IPW_INTA_MASK_ALL & inta_mask); - ipw_write32(priv, IPW_INTA_RW, inta); - - /* Cache INTA value for our tasklet */ - priv->isr_inta = inta; - - tasklet_schedule(&priv->irq_tasklet); - - spin_unlock(&priv->irq_lock); - - return IRQ_HANDLED; - none: - spin_unlock(&priv->irq_lock); - return IRQ_NONE; -} - -static void ipw_rf_kill(void *adapter) -{ - struct ipw_priv *priv = adapter; - unsigned long flags; - - spin_lock_irqsave(&priv->lock, flags); - - if (rf_kill_active(priv)) { - IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n"); - schedule_delayed_work(&priv->rf_kill, 2 * HZ); - goto exit_unlock; - } - - /* RF Kill is now disabled, so bring the device back up */ - - if (!(priv->status & STATUS_RF_KILL_MASK)) { - IPW_DEBUG_RF_KILL("HW RF Kill no longer active, restarting " - "device\n"); - - /* we can not do an adapter restart while inside an irq lock */ - schedule_work(&priv->adapter_restart); - } else - IPW_DEBUG_RF_KILL("HW RF Kill deactivated. SW RF Kill still " - "enabled\n"); - - exit_unlock: - spin_unlock_irqrestore(&priv->lock, flags); -} - -static void ipw_bg_rf_kill(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, rf_kill.work); - mutex_lock(&priv->mutex); - ipw_rf_kill(priv); - mutex_unlock(&priv->mutex); -} - -static void ipw_link_up(struct ipw_priv *priv) -{ - priv->last_seq_num = -1; - priv->last_frag_num = -1; - priv->last_packet_time = 0; - - netif_carrier_on(priv->net_dev); - - cancel_delayed_work(&priv->request_scan); - cancel_delayed_work(&priv->request_direct_scan); - cancel_delayed_work(&priv->request_passive_scan); - cancel_delayed_work(&priv->scan_event); - ipw_reset_stats(priv); - /* Ensure the rate is updated immediately */ - priv->last_rate = ipw_get_current_rate(priv); - ipw_gather_stats(priv); - ipw_led_link_up(priv); - notify_wx_assoc_event(priv); - - if (priv->config & CFG_BACKGROUND_SCAN) - schedule_delayed_work(&priv->request_scan, HZ); -} - -static void ipw_bg_link_up(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, link_up); - mutex_lock(&priv->mutex); - ipw_link_up(priv); - mutex_unlock(&priv->mutex); -} - -static void ipw_link_down(struct ipw_priv *priv) -{ - ipw_led_link_down(priv); - netif_carrier_off(priv->net_dev); - notify_wx_assoc_event(priv); - - /* Cancel any queued work ... */ - cancel_delayed_work(&priv->request_scan); - cancel_delayed_work(&priv->request_direct_scan); - cancel_delayed_work(&priv->request_passive_scan); - cancel_delayed_work(&priv->adhoc_check); - cancel_delayed_work(&priv->gather_stats); - - ipw_reset_stats(priv); - - if (!(priv->status & STATUS_EXIT_PENDING)) { - /* Queue up another scan... */ - schedule_delayed_work(&priv->request_scan, 0); - } else - cancel_delayed_work(&priv->scan_event); -} - -static void ipw_bg_link_down(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, link_down); - mutex_lock(&priv->mutex); - ipw_link_down(priv); - mutex_unlock(&priv->mutex); -} - -static int ipw_setup_deferred_work(struct ipw_priv *priv) -{ - int ret = 0; - - init_waitqueue_head(&priv->wait_command_queue); - init_waitqueue_head(&priv->wait_state); - - INIT_DELAYED_WORK(&priv->adhoc_check, ipw_bg_adhoc_check); - INIT_WORK(&priv->associate, ipw_bg_associate); - INIT_WORK(&priv->disassociate, ipw_bg_disassociate); - INIT_WORK(&priv->system_config, ipw_system_config); - INIT_WORK(&priv->rx_replenish, ipw_bg_rx_queue_replenish); - INIT_WORK(&priv->adapter_restart, ipw_bg_adapter_restart); - INIT_DELAYED_WORK(&priv->rf_kill, ipw_bg_rf_kill); - INIT_WORK(&priv->up, ipw_bg_up); - INIT_WORK(&priv->down, ipw_bg_down); - INIT_DELAYED_WORK(&priv->request_scan, ipw_request_scan); - INIT_DELAYED_WORK(&priv->request_direct_scan, ipw_request_direct_scan); - INIT_DELAYED_WORK(&priv->request_passive_scan, ipw_request_passive_scan); - INIT_DELAYED_WORK(&priv->scan_event, ipw_scan_event); - INIT_DELAYED_WORK(&priv->gather_stats, ipw_bg_gather_stats); - INIT_WORK(&priv->abort_scan, ipw_bg_abort_scan); - INIT_WORK(&priv->roam, ipw_bg_roam); - INIT_DELAYED_WORK(&priv->scan_check, ipw_bg_scan_check); - INIT_WORK(&priv->link_up, ipw_bg_link_up); - INIT_WORK(&priv->link_down, ipw_bg_link_down); - INIT_DELAYED_WORK(&priv->led_link_on, ipw_bg_led_link_on); - INIT_DELAYED_WORK(&priv->led_link_off, ipw_bg_led_link_off); - INIT_DELAYED_WORK(&priv->led_act_off, ipw_bg_led_activity_off); - INIT_WORK(&priv->merge_networks, ipw_merge_adhoc_network); - -#ifdef CONFIG_IPW2200_QOS - INIT_WORK(&priv->qos_activate, ipw_bg_qos_activate); -#endif /* CONFIG_IPW2200_QOS */ - - tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) - ipw_irq_tasklet, (unsigned long)priv); - - return ret; -} - -static void shim__set_security(struct net_device *dev, - struct libipw_security *sec) -{ - struct ipw_priv *priv = libipw_priv(dev); - int i; - for (i = 0; i < 4; i++) { - if (sec->flags & (1 << i)) { - priv->ieee->sec.encode_alg[i] = sec->encode_alg[i]; - priv->ieee->sec.key_sizes[i] = sec->key_sizes[i]; - if (sec->key_sizes[i] == 0) - priv->ieee->sec.flags &= ~(1 << i); - else { - memcpy(priv->ieee->sec.keys[i], sec->keys[i], - sec->key_sizes[i]); - priv->ieee->sec.flags |= (1 << i); - } - priv->status |= STATUS_SECURITY_UPDATED; - } else if (sec->level != SEC_LEVEL_1) - priv->ieee->sec.flags &= ~(1 << i); - } - - if (sec->flags & SEC_ACTIVE_KEY) { - if (sec->active_key <= 3) { - priv->ieee->sec.active_key = sec->active_key; - priv->ieee->sec.flags |= SEC_ACTIVE_KEY; - } else - priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; - priv->status |= STATUS_SECURITY_UPDATED; - } else - priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; - - if ((sec->flags & SEC_AUTH_MODE) && - (priv->ieee->sec.auth_mode != sec->auth_mode)) { - priv->ieee->sec.auth_mode = sec->auth_mode; - priv->ieee->sec.flags |= SEC_AUTH_MODE; - if (sec->auth_mode == WLAN_AUTH_SHARED_KEY) - priv->capability |= CAP_SHARED_KEY; - else - priv->capability &= ~CAP_SHARED_KEY; - priv->status |= STATUS_SECURITY_UPDATED; - } - - if (sec->flags & SEC_ENABLED && priv->ieee->sec.enabled != sec->enabled) { - priv->ieee->sec.flags |= SEC_ENABLED; - priv->ieee->sec.enabled = sec->enabled; - priv->status |= STATUS_SECURITY_UPDATED; - if (sec->enabled) - priv->capability |= CAP_PRIVACY_ON; - else - priv->capability &= ~CAP_PRIVACY_ON; - } - - if (sec->flags & SEC_ENCRYPT) - priv->ieee->sec.encrypt = sec->encrypt; - - if (sec->flags & SEC_LEVEL && priv->ieee->sec.level != sec->level) { - priv->ieee->sec.level = sec->level; - priv->ieee->sec.flags |= SEC_LEVEL; - priv->status |= STATUS_SECURITY_UPDATED; - } - - if (!priv->ieee->host_encrypt && (sec->flags & SEC_ENCRYPT)) - ipw_set_hwcrypto_keys(priv); - - /* To match current functionality of ipw2100 (which works well w/ - * various supplicants, we don't force a disassociate if the - * privacy capability changes ... */ -#if 0 - if ((priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) && - (((priv->assoc_request.capability & - cpu_to_le16(WLAN_CAPABILITY_PRIVACY)) && !sec->enabled) || - (!(priv->assoc_request.capability & - cpu_to_le16(WLAN_CAPABILITY_PRIVACY)) && sec->enabled))) { - IPW_DEBUG_ASSOC("Disassociating due to capability " - "change.\n"); - ipw_disassociate(priv); - } -#endif -} - -static int init_supported_rates(struct ipw_priv *priv, - struct ipw_supported_rates *rates) -{ - /* TODO: Mask out rates based on priv->rates_mask */ - - memset(rates, 0, sizeof(*rates)); - /* configure supported rates */ - switch (priv->ieee->freq_band) { - case LIBIPW_52GHZ_BAND: - rates->ieee_mode = IPW_A_MODE; - rates->purpose = IPW_RATE_CAPABILITIES; - ipw_add_ofdm_scan_rates(rates, LIBIPW_CCK_MODULATION, - LIBIPW_OFDM_DEFAULT_RATES_MASK); - break; - - default: /* Mixed or 2.4Ghz */ - rates->ieee_mode = IPW_G_MODE; - rates->purpose = IPW_RATE_CAPABILITIES; - ipw_add_cck_scan_rates(rates, LIBIPW_CCK_MODULATION, - LIBIPW_CCK_DEFAULT_RATES_MASK); - if (priv->ieee->modulation & LIBIPW_OFDM_MODULATION) { - ipw_add_ofdm_scan_rates(rates, LIBIPW_CCK_MODULATION, - LIBIPW_OFDM_DEFAULT_RATES_MASK); - } - break; - } - - return 0; -} - -static int ipw_config(struct ipw_priv *priv) -{ - /* This is only called from ipw_up, which resets/reloads the firmware - so, we don't need to first disable the card before we configure - it */ - if (ipw_set_tx_power(priv)) - goto error; - - /* initialize adapter address */ - if (ipw_send_adapter_address(priv, priv->net_dev->dev_addr)) - goto error; - - /* set basic system config settings */ - init_sys_config(&priv->sys_config); - - /* Support Bluetooth if we have BT h/w on board, and user wants to. - * Does not support BT priority yet (don't abort or defer our Tx) */ - if (bt_coexist) { - unsigned char bt_caps = priv->eeprom[EEPROM_SKU_CAPABILITY]; - - if (bt_caps & EEPROM_SKU_CAP_BT_CHANNEL_SIG) - priv->sys_config.bt_coexistence - |= CFG_BT_COEXISTENCE_SIGNAL_CHNL; - if (bt_caps & EEPROM_SKU_CAP_BT_OOB) - priv->sys_config.bt_coexistence - |= CFG_BT_COEXISTENCE_OOB; - } - -#ifdef CONFIG_IPW2200_PROMISCUOUS - if (priv->prom_net_dev && netif_running(priv->prom_net_dev)) { - priv->sys_config.accept_all_data_frames = 1; - priv->sys_config.accept_non_directed_frames = 1; - priv->sys_config.accept_all_mgmt_bcpr = 1; - priv->sys_config.accept_all_mgmt_frames = 1; - } -#endif - - if (priv->ieee->iw_mode == IW_MODE_ADHOC) - priv->sys_config.answer_broadcast_ssid_probe = 1; - else - priv->sys_config.answer_broadcast_ssid_probe = 0; - - if (ipw_send_system_config(priv)) - goto error; - - init_supported_rates(priv, &priv->rates); - if (ipw_send_supported_rates(priv, &priv->rates)) - goto error; - - /* Set request-to-send threshold */ - if (priv->rts_threshold) { - if (ipw_send_rts_threshold(priv, priv->rts_threshold)) - goto error; - } -#ifdef CONFIG_IPW2200_QOS - IPW_DEBUG_QOS("QoS: call ipw_qos_activate\n"); - ipw_qos_activate(priv, NULL); -#endif /* CONFIG_IPW2200_QOS */ - - if (ipw_set_random_seed(priv)) - goto error; - - /* final state transition to the RUN state */ - if (ipw_send_host_complete(priv)) - goto error; - - priv->status |= STATUS_INIT; - - ipw_led_init(priv); - ipw_led_radio_on(priv); - priv->notif_missed_beacons = 0; - - /* Set hardware WEP key if it is configured. */ - if ((priv->capability & CAP_PRIVACY_ON) && - (priv->ieee->sec.level == SEC_LEVEL_1) && - !(priv->ieee->host_encrypt || priv->ieee->host_decrypt)) - ipw_set_hwcrypto_keys(priv); - - return 0; - - error: - return -EIO; -} - -/* - * NOTE: - * - * These tables have been tested in conjunction with the - * Intel PRO/Wireless 2200BG and 2915ABG Network Connection Adapters. - * - * Altering this values, using it on other hardware, or in geographies - * not intended for resale of the above mentioned Intel adapters has - * not been tested. - * - * Remember to update the table in README.ipw2200 when changing this - * table. - * - */ -static const struct libipw_geo ipw_geos[] = { - { /* Restricted */ - "---", - .bg_channels = 11, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}}, - }, - - { /* Custom US/Canada */ - "ZZF", - .bg_channels = 11, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}}, - .a_channels = 8, - .a = {{5180, 36}, - {5200, 40}, - {5220, 44}, - {5240, 48}, - {5260, 52, LIBIPW_CH_PASSIVE_ONLY}, - {5280, 56, LIBIPW_CH_PASSIVE_ONLY}, - {5300, 60, LIBIPW_CH_PASSIVE_ONLY}, - {5320, 64, LIBIPW_CH_PASSIVE_ONLY}}, - }, - - { /* Rest of World */ - "ZZD", - .bg_channels = 13, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}, {2467, 12}, - {2472, 13}}, - }, - - { /* Custom USA & Europe & High */ - "ZZA", - .bg_channels = 11, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}}, - .a_channels = 13, - .a = {{5180, 36}, - {5200, 40}, - {5220, 44}, - {5240, 48}, - {5260, 52, LIBIPW_CH_PASSIVE_ONLY}, - {5280, 56, LIBIPW_CH_PASSIVE_ONLY}, - {5300, 60, LIBIPW_CH_PASSIVE_ONLY}, - {5320, 64, LIBIPW_CH_PASSIVE_ONLY}, - {5745, 149}, - {5765, 153}, - {5785, 157}, - {5805, 161}, - {5825, 165}}, - }, - - { /* Custom NA & Europe */ - "ZZB", - .bg_channels = 11, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}}, - .a_channels = 13, - .a = {{5180, 36}, - {5200, 40}, - {5220, 44}, - {5240, 48}, - {5260, 52, LIBIPW_CH_PASSIVE_ONLY}, - {5280, 56, LIBIPW_CH_PASSIVE_ONLY}, - {5300, 60, LIBIPW_CH_PASSIVE_ONLY}, - {5320, 64, LIBIPW_CH_PASSIVE_ONLY}, - {5745, 149, LIBIPW_CH_PASSIVE_ONLY}, - {5765, 153, LIBIPW_CH_PASSIVE_ONLY}, - {5785, 157, LIBIPW_CH_PASSIVE_ONLY}, - {5805, 161, LIBIPW_CH_PASSIVE_ONLY}, - {5825, 165, LIBIPW_CH_PASSIVE_ONLY}}, - }, - - { /* Custom Japan */ - "ZZC", - .bg_channels = 11, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}}, - .a_channels = 4, - .a = {{5170, 34}, {5190, 38}, - {5210, 42}, {5230, 46}}, - }, - - { /* Custom */ - "ZZM", - .bg_channels = 11, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}}, - }, - - { /* Europe */ - "ZZE", - .bg_channels = 13, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}, {2467, 12}, - {2472, 13}}, - .a_channels = 19, - .a = {{5180, 36}, - {5200, 40}, - {5220, 44}, - {5240, 48}, - {5260, 52, LIBIPW_CH_PASSIVE_ONLY}, - {5280, 56, LIBIPW_CH_PASSIVE_ONLY}, - {5300, 60, LIBIPW_CH_PASSIVE_ONLY}, - {5320, 64, LIBIPW_CH_PASSIVE_ONLY}, - {5500, 100, LIBIPW_CH_PASSIVE_ONLY}, - {5520, 104, LIBIPW_CH_PASSIVE_ONLY}, - {5540, 108, LIBIPW_CH_PASSIVE_ONLY}, - {5560, 112, LIBIPW_CH_PASSIVE_ONLY}, - {5580, 116, LIBIPW_CH_PASSIVE_ONLY}, - {5600, 120, LIBIPW_CH_PASSIVE_ONLY}, - {5620, 124, LIBIPW_CH_PASSIVE_ONLY}, - {5640, 128, LIBIPW_CH_PASSIVE_ONLY}, - {5660, 132, LIBIPW_CH_PASSIVE_ONLY}, - {5680, 136, LIBIPW_CH_PASSIVE_ONLY}, - {5700, 140, LIBIPW_CH_PASSIVE_ONLY}}, - }, - - { /* Custom Japan */ - "ZZJ", - .bg_channels = 14, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}, {2467, 12}, - {2472, 13}, {2484, 14, LIBIPW_CH_B_ONLY}}, - .a_channels = 4, - .a = {{5170, 34}, {5190, 38}, - {5210, 42}, {5230, 46}}, - }, - - { /* Rest of World */ - "ZZR", - .bg_channels = 14, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}, {2467, 12}, - {2472, 13}, {2484, 14, LIBIPW_CH_B_ONLY | - LIBIPW_CH_PASSIVE_ONLY}}, - }, - - { /* High Band */ - "ZZH", - .bg_channels = 13, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}, - {2467, 12, LIBIPW_CH_PASSIVE_ONLY}, - {2472, 13, LIBIPW_CH_PASSIVE_ONLY}}, - .a_channels = 4, - .a = {{5745, 149}, {5765, 153}, - {5785, 157}, {5805, 161}}, - }, - - { /* Custom Europe */ - "ZZG", - .bg_channels = 13, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}, - {2467, 12}, {2472, 13}}, - .a_channels = 4, - .a = {{5180, 36}, {5200, 40}, - {5220, 44}, {5240, 48}}, - }, - - { /* Europe */ - "ZZK", - .bg_channels = 13, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}, - {2467, 12, LIBIPW_CH_PASSIVE_ONLY}, - {2472, 13, LIBIPW_CH_PASSIVE_ONLY}}, - .a_channels = 24, - .a = {{5180, 36, LIBIPW_CH_PASSIVE_ONLY}, - {5200, 40, LIBIPW_CH_PASSIVE_ONLY}, - {5220, 44, LIBIPW_CH_PASSIVE_ONLY}, - {5240, 48, LIBIPW_CH_PASSIVE_ONLY}, - {5260, 52, LIBIPW_CH_PASSIVE_ONLY}, - {5280, 56, LIBIPW_CH_PASSIVE_ONLY}, - {5300, 60, LIBIPW_CH_PASSIVE_ONLY}, - {5320, 64, LIBIPW_CH_PASSIVE_ONLY}, - {5500, 100, LIBIPW_CH_PASSIVE_ONLY}, - {5520, 104, LIBIPW_CH_PASSIVE_ONLY}, - {5540, 108, LIBIPW_CH_PASSIVE_ONLY}, - {5560, 112, LIBIPW_CH_PASSIVE_ONLY}, - {5580, 116, LIBIPW_CH_PASSIVE_ONLY}, - {5600, 120, LIBIPW_CH_PASSIVE_ONLY}, - {5620, 124, LIBIPW_CH_PASSIVE_ONLY}, - {5640, 128, LIBIPW_CH_PASSIVE_ONLY}, - {5660, 132, LIBIPW_CH_PASSIVE_ONLY}, - {5680, 136, LIBIPW_CH_PASSIVE_ONLY}, - {5700, 140, LIBIPW_CH_PASSIVE_ONLY}, - {5745, 149, LIBIPW_CH_PASSIVE_ONLY}, - {5765, 153, LIBIPW_CH_PASSIVE_ONLY}, - {5785, 157, LIBIPW_CH_PASSIVE_ONLY}, - {5805, 161, LIBIPW_CH_PASSIVE_ONLY}, - {5825, 165, LIBIPW_CH_PASSIVE_ONLY}}, - }, - - { /* Europe */ - "ZZL", - .bg_channels = 11, - .bg = {{2412, 1}, {2417, 2}, {2422, 3}, - {2427, 4}, {2432, 5}, {2437, 6}, - {2442, 7}, {2447, 8}, {2452, 9}, - {2457, 10}, {2462, 11}}, - .a_channels = 13, - .a = {{5180, 36, LIBIPW_CH_PASSIVE_ONLY}, - {5200, 40, LIBIPW_CH_PASSIVE_ONLY}, - {5220, 44, LIBIPW_CH_PASSIVE_ONLY}, - {5240, 48, LIBIPW_CH_PASSIVE_ONLY}, - {5260, 52, LIBIPW_CH_PASSIVE_ONLY}, - {5280, 56, LIBIPW_CH_PASSIVE_ONLY}, - {5300, 60, LIBIPW_CH_PASSIVE_ONLY}, - {5320, 64, LIBIPW_CH_PASSIVE_ONLY}, - {5745, 149, LIBIPW_CH_PASSIVE_ONLY}, - {5765, 153, LIBIPW_CH_PASSIVE_ONLY}, - {5785, 157, LIBIPW_CH_PASSIVE_ONLY}, - {5805, 161, LIBIPW_CH_PASSIVE_ONLY}, - {5825, 165, LIBIPW_CH_PASSIVE_ONLY}}, - } -}; - -static void ipw_set_geo(struct ipw_priv *priv) -{ - int j; - - for (j = 0; j < ARRAY_SIZE(ipw_geos); j++) { - if (!memcmp(&priv->eeprom[EEPROM_COUNTRY_CODE], - ipw_geos[j].name, 3)) - break; - } - - if (j == ARRAY_SIZE(ipw_geos)) { - IPW_WARNING("SKU [%c%c%c] not recognized.\n", - priv->eeprom[EEPROM_COUNTRY_CODE + 0], - priv->eeprom[EEPROM_COUNTRY_CODE + 1], - priv->eeprom[EEPROM_COUNTRY_CODE + 2]); - j = 0; - } - - libipw_set_geo(priv->ieee, &ipw_geos[j]); -} - -#define MAX_HW_RESTARTS 5 -static int ipw_up(struct ipw_priv *priv) -{ - int rc, i; - - /* Age scan list entries found before suspend */ - if (priv->suspend_time) { - libipw_networks_age(priv->ieee, priv->suspend_time); - priv->suspend_time = 0; - } - - if (priv->status & STATUS_EXIT_PENDING) - return -EIO; - - if (cmdlog && !priv->cmdlog) { - priv->cmdlog = kcalloc(cmdlog, sizeof(*priv->cmdlog), - GFP_KERNEL); - if (priv->cmdlog == NULL) { - IPW_ERROR("Error allocating %d command log entries.\n", - cmdlog); - return -ENOMEM; - } else { - priv->cmdlog_len = cmdlog; - } - } - - for (i = 0; i < MAX_HW_RESTARTS; i++) { - /* Load the microcode, firmware, and eeprom. - * Also start the clocks. */ - rc = ipw_load(priv); - if (rc) { - IPW_ERROR("Unable to load firmware: %d\n", rc); - return rc; - } - - ipw_init_ordinals(priv); - if (!(priv->config & CFG_CUSTOM_MAC)) - eeprom_parse_mac(priv, priv->mac_addr); - memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); - - ipw_set_geo(priv); - - if (priv->status & STATUS_RF_KILL_SW) { - IPW_WARNING("Radio disabled by module parameter.\n"); - return 0; - } else if (rf_kill_active(priv)) { - IPW_WARNING("Radio Frequency Kill Switch is On:\n" - "Kill switch must be turned off for " - "wireless networking to work.\n"); - schedule_delayed_work(&priv->rf_kill, 2 * HZ); - return 0; - } - - rc = ipw_config(priv); - if (!rc) { - IPW_DEBUG_INFO("Configured device on count %i\n", i); - - /* If configure to try and auto-associate, kick - * off a scan. */ - schedule_delayed_work(&priv->request_scan, 0); - - return 0; - } - - IPW_DEBUG_INFO("Device configuration failed: 0x%08X\n", rc); - IPW_DEBUG_INFO("Failed to config device on retry %d of %d\n", - i, MAX_HW_RESTARTS); - - /* We had an error bringing up the hardware, so take it - * all the way back down so we can try again */ - ipw_down(priv); - } - - /* tried to restart and config the device for as long as our - * patience could withstand */ - IPW_ERROR("Unable to initialize device after %d attempts.\n", i); - - return -EIO; -} - -static void ipw_bg_up(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, up); - mutex_lock(&priv->mutex); - ipw_up(priv); - mutex_unlock(&priv->mutex); -} - -static void ipw_deinit(struct ipw_priv *priv) -{ - int i; - - if (priv->status & STATUS_SCANNING) { - IPW_DEBUG_INFO("Aborting scan during shutdown.\n"); - ipw_abort_scan(priv); - } - - if (priv->status & STATUS_ASSOCIATED) { - IPW_DEBUG_INFO("Disassociating during shutdown.\n"); - ipw_disassociate(priv); - } - - ipw_led_shutdown(priv); - - /* Wait up to 1s for status to change to not scanning and not - * associated (disassociation can take a while for a ful 802.11 - * exchange */ - for (i = 1000; i && (priv->status & - (STATUS_DISASSOCIATING | - STATUS_ASSOCIATED | STATUS_SCANNING)); i--) - udelay(10); - - if (priv->status & (STATUS_DISASSOCIATING | - STATUS_ASSOCIATED | STATUS_SCANNING)) - IPW_DEBUG_INFO("Still associated or scanning...\n"); - else - IPW_DEBUG_INFO("Took %dms to de-init\n", 1000 - i); - - /* Attempt to disable the card */ - ipw_send_card_disable(priv, 0); - - priv->status &= ~STATUS_INIT; -} - -static void ipw_down(struct ipw_priv *priv) -{ - int exit_pending = priv->status & STATUS_EXIT_PENDING; - - priv->status |= STATUS_EXIT_PENDING; - - if (ipw_is_init(priv)) - ipw_deinit(priv); - - /* Wipe out the EXIT_PENDING status bit if we are not actually - * exiting the module */ - if (!exit_pending) - priv->status &= ~STATUS_EXIT_PENDING; - - /* tell the device to stop sending interrupts */ - ipw_disable_interrupts(priv); - - /* Clear all bits but the RF Kill */ - priv->status &= STATUS_RF_KILL_MASK | STATUS_EXIT_PENDING; - netif_carrier_off(priv->net_dev); - - ipw_stop_nic(priv); - - ipw_led_radio_off(priv); -} - -static void ipw_bg_down(struct work_struct *work) -{ - struct ipw_priv *priv = - container_of(work, struct ipw_priv, down); - mutex_lock(&priv->mutex); - ipw_down(priv); - mutex_unlock(&priv->mutex); -} - -static int ipw_wdev_init(struct net_device *dev) -{ - int i, rc = 0; - struct ipw_priv *priv = libipw_priv(dev); - const struct libipw_geo *geo = libipw_get_geo(priv->ieee); - struct wireless_dev *wdev = &priv->ieee->wdev; - - memcpy(wdev->wiphy->perm_addr, priv->mac_addr, ETH_ALEN); - - /* fill-out priv->ieee->bg_band */ - if (geo->bg_channels) { - struct ieee80211_supported_band *bg_band = &priv->ieee->bg_band; - - bg_band->band = IEEE80211_BAND_2GHZ; - bg_band->n_channels = geo->bg_channels; - bg_band->channels = kcalloc(geo->bg_channels, - sizeof(struct ieee80211_channel), - GFP_KERNEL); - if (!bg_band->channels) { - rc = -ENOMEM; - goto out; - } - /* translate geo->bg to bg_band.channels */ - for (i = 0; i < geo->bg_channels; i++) { - bg_band->channels[i].band = IEEE80211_BAND_2GHZ; - bg_band->channels[i].center_freq = geo->bg[i].freq; - bg_band->channels[i].hw_value = geo->bg[i].channel; - bg_band->channels[i].max_power = geo->bg[i].max_power; - if (geo->bg[i].flags & LIBIPW_CH_PASSIVE_ONLY) - bg_band->channels[i].flags |= - IEEE80211_CHAN_PASSIVE_SCAN; - if (geo->bg[i].flags & LIBIPW_CH_NO_IBSS) - bg_band->channels[i].flags |= - IEEE80211_CHAN_NO_IBSS; - if (geo->bg[i].flags & LIBIPW_CH_RADAR_DETECT) - bg_band->channels[i].flags |= - IEEE80211_CHAN_RADAR; - /* No equivalent for LIBIPW_CH_80211H_RULES, - LIBIPW_CH_UNIFORM_SPREADING, or - LIBIPW_CH_B_ONLY... */ - } - /* point at bitrate info */ - bg_band->bitrates = ipw2200_bg_rates; - bg_band->n_bitrates = ipw2200_num_bg_rates; - - wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = bg_band; - } - - /* fill-out priv->ieee->a_band */ - if (geo->a_channels) { - struct ieee80211_supported_band *a_band = &priv->ieee->a_band; - - a_band->band = IEEE80211_BAND_5GHZ; - a_band->n_channels = geo->a_channels; - a_band->channels = kcalloc(geo->a_channels, - sizeof(struct ieee80211_channel), - GFP_KERNEL); - if (!a_band->channels) { - rc = -ENOMEM; - goto out; - } - /* translate geo->a to a_band.channels */ - for (i = 0; i < geo->a_channels; i++) { - a_band->channels[i].band = IEEE80211_BAND_5GHZ; - a_band->channels[i].center_freq = geo->a[i].freq; - a_band->channels[i].hw_value = geo->a[i].channel; - a_band->channels[i].max_power = geo->a[i].max_power; - if (geo->a[i].flags & LIBIPW_CH_PASSIVE_ONLY) - a_band->channels[i].flags |= - IEEE80211_CHAN_PASSIVE_SCAN; - if (geo->a[i].flags & LIBIPW_CH_NO_IBSS) - a_band->channels[i].flags |= - IEEE80211_CHAN_NO_IBSS; - if (geo->a[i].flags & LIBIPW_CH_RADAR_DETECT) - a_band->channels[i].flags |= - IEEE80211_CHAN_RADAR; - /* No equivalent for LIBIPW_CH_80211H_RULES, - LIBIPW_CH_UNIFORM_SPREADING, or - LIBIPW_CH_B_ONLY... */ - } - /* point at bitrate info */ - a_band->bitrates = ipw2200_a_rates; - a_band->n_bitrates = ipw2200_num_a_rates; - - wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = a_band; - } - - wdev->wiphy->cipher_suites = ipw_cipher_suites; - wdev->wiphy->n_cipher_suites = ARRAY_SIZE(ipw_cipher_suites); - - set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev); - - /* With that information in place, we can now register the wiphy... */ - if (wiphy_register(wdev->wiphy)) - rc = -EIO; -out: - return rc; -} - -/* PCI driver stuff */ -static DEFINE_PCI_DEVICE_TABLE(card_ids) = { - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2701, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2702, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2711, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2712, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2721, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2722, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2731, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2732, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2741, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x103c, 0x2741, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2742, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2751, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2752, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2753, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2754, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2761, 0, 0, 0}, - {PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, 0x2762, 0, 0, 0}, - {PCI_VDEVICE(INTEL, 0x104f), 0}, - {PCI_VDEVICE(INTEL, 0x4220), 0}, /* BG */ - {PCI_VDEVICE(INTEL, 0x4221), 0}, /* BG */ - {PCI_VDEVICE(INTEL, 0x4223), 0}, /* ABG */ - {PCI_VDEVICE(INTEL, 0x4224), 0}, /* ABG */ - - /* required last entry */ - {0,} -}; - -MODULE_DEVICE_TABLE(pci, card_ids); - -static struct attribute *ipw_sysfs_entries[] = { - &dev_attr_rf_kill.attr, - &dev_attr_direct_dword.attr, - &dev_attr_indirect_byte.attr, - &dev_attr_indirect_dword.attr, - &dev_attr_mem_gpio_reg.attr, - &dev_attr_command_event_reg.attr, - &dev_attr_nic_type.attr, - &dev_attr_status.attr, - &dev_attr_cfg.attr, - &dev_attr_error.attr, - &dev_attr_event_log.attr, - &dev_attr_cmd_log.attr, - &dev_attr_eeprom_delay.attr, - &dev_attr_ucode_version.attr, - &dev_attr_rtc.attr, - &dev_attr_scan_age.attr, - &dev_attr_led.attr, - &dev_attr_speed_scan.attr, - &dev_attr_net_stats.attr, - &dev_attr_channels.attr, -#ifdef CONFIG_IPW2200_PROMISCUOUS - &dev_attr_rtap_iface.attr, - &dev_attr_rtap_filter.attr, -#endif - NULL -}; - -static struct attribute_group ipw_attribute_group = { - .name = NULL, /* put in device directory */ - .attrs = ipw_sysfs_entries, -}; - -#ifdef CONFIG_IPW2200_PROMISCUOUS -static int ipw_prom_open(struct net_device *dev) -{ - struct ipw_prom_priv *prom_priv = libipw_priv(dev); - struct ipw_priv *priv = prom_priv->priv; - - IPW_DEBUG_INFO("prom dev->open\n"); - netif_carrier_off(dev); - - if (priv->ieee->iw_mode != IW_MODE_MONITOR) { - priv->sys_config.accept_all_data_frames = 1; - priv->sys_config.accept_non_directed_frames = 1; - priv->sys_config.accept_all_mgmt_bcpr = 1; - priv->sys_config.accept_all_mgmt_frames = 1; - - ipw_send_system_config(priv); - } - - return 0; -} - -static int ipw_prom_stop(struct net_device *dev) -{ - struct ipw_prom_priv *prom_priv = libipw_priv(dev); - struct ipw_priv *priv = prom_priv->priv; - - IPW_DEBUG_INFO("prom dev->stop\n"); - - if (priv->ieee->iw_mode != IW_MODE_MONITOR) { - priv->sys_config.accept_all_data_frames = 0; - priv->sys_config.accept_non_directed_frames = 0; - priv->sys_config.accept_all_mgmt_bcpr = 0; - priv->sys_config.accept_all_mgmt_frames = 0; - - ipw_send_system_config(priv); - } - - return 0; -} - -static netdev_tx_t ipw_prom_hard_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - IPW_DEBUG_INFO("prom dev->xmit\n"); - dev_kfree_skb(skb); - return NETDEV_TX_OK; -} - -static const struct net_device_ops ipw_prom_netdev_ops = { - .ndo_open = ipw_prom_open, - .ndo_stop = ipw_prom_stop, - .ndo_start_xmit = ipw_prom_hard_start_xmit, - .ndo_change_mtu = libipw_change_mtu, - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, -}; - -static int ipw_prom_alloc(struct ipw_priv *priv) -{ - int rc = 0; - - if (priv->prom_net_dev) - return -EPERM; - - priv->prom_net_dev = alloc_libipw(sizeof(struct ipw_prom_priv), 1); - if (priv->prom_net_dev == NULL) - return -ENOMEM; - - priv->prom_priv = libipw_priv(priv->prom_net_dev); - priv->prom_priv->ieee = netdev_priv(priv->prom_net_dev); - priv->prom_priv->priv = priv; - - strcpy(priv->prom_net_dev->name, "rtap%d"); - memcpy(priv->prom_net_dev->dev_addr, priv->mac_addr, ETH_ALEN); - - priv->prom_net_dev->type = ARPHRD_IEEE80211_RADIOTAP; - priv->prom_net_dev->netdev_ops = &ipw_prom_netdev_ops; - - priv->prom_priv->ieee->iw_mode = IW_MODE_MONITOR; - SET_NETDEV_DEV(priv->prom_net_dev, &priv->pci_dev->dev); - - rc = register_netdev(priv->prom_net_dev); - if (rc) { - free_libipw(priv->prom_net_dev, 1); - priv->prom_net_dev = NULL; - return rc; - } - - return 0; -} - -static void ipw_prom_free(struct ipw_priv *priv) -{ - if (!priv->prom_net_dev) - return; - - unregister_netdev(priv->prom_net_dev); - free_libipw(priv->prom_net_dev, 1); - - priv->prom_net_dev = NULL; -} - -#endif - -static const struct net_device_ops ipw_netdev_ops = { - .ndo_open = ipw_net_open, - .ndo_stop = ipw_net_stop, - .ndo_set_rx_mode = ipw_net_set_multicast_list, - .ndo_set_mac_address = ipw_net_set_mac_address, - .ndo_start_xmit = libipw_xmit, - .ndo_change_mtu = libipw_change_mtu, - .ndo_validate_addr = eth_validate_addr, -}; - -static int ipw_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *ent) -{ - int err = 0; - struct net_device *net_dev; - void __iomem *base; - u32 length, val; - struct ipw_priv *priv; - int i; - - net_dev = alloc_libipw(sizeof(struct ipw_priv), 0); - if (net_dev == NULL) { - err = -ENOMEM; - goto out; - } - - priv = libipw_priv(net_dev); - priv->ieee = netdev_priv(net_dev); - - priv->net_dev = net_dev; - priv->pci_dev = pdev; - ipw_debug_level = debug; - spin_lock_init(&priv->irq_lock); - spin_lock_init(&priv->lock); - for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) - INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); - - mutex_init(&priv->mutex); - if (pci_enable_device(pdev)) { - err = -ENODEV; - goto out_free_libipw; - } - - pci_set_master(pdev); - - err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); - if (!err) - err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); - if (err) { - printk(KERN_WARNING DRV_NAME ": No suitable DMA available.\n"); - goto out_pci_disable_device; - } - - pci_set_drvdata(pdev, priv); - - err = pci_request_regions(pdev, DRV_NAME); - if (err) - goto out_pci_disable_device; - - /* We disable the RETRY_TIMEOUT register (0x41) to keep - * PCI Tx retries from interfering with C3 CPU state */ - pci_read_config_dword(pdev, 0x40, &val); - if ((val & 0x0000ff00) != 0) - pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); - - length = pci_resource_len(pdev, 0); - priv->hw_len = length; - - base = pci_ioremap_bar(pdev, 0); - if (!base) { - err = -ENODEV; - goto out_pci_release_regions; - } - - priv->hw_base = base; - IPW_DEBUG_INFO("pci_resource_len = 0x%08x\n", length); - IPW_DEBUG_INFO("pci_resource_base = %p\n", base); - - err = ipw_setup_deferred_work(priv); - if (err) { - IPW_ERROR("Unable to setup deferred work\n"); - goto out_iounmap; - } - - ipw_sw_reset(priv, 1); - - err = request_irq(pdev->irq, ipw_isr, IRQF_SHARED, DRV_NAME, priv); - if (err) { - IPW_ERROR("Error allocating IRQ %d\n", pdev->irq); - goto out_iounmap; - } - - SET_NETDEV_DEV(net_dev, &pdev->dev); - - mutex_lock(&priv->mutex); - - priv->ieee->hard_start_xmit = ipw_net_hard_start_xmit; - priv->ieee->set_security = shim__set_security; - priv->ieee->is_queue_full = ipw_net_is_queue_full; - -#ifdef CONFIG_IPW2200_QOS - priv->ieee->is_qos_active = ipw_is_qos_active; - priv->ieee->handle_probe_response = ipw_handle_beacon; - priv->ieee->handle_beacon = ipw_handle_probe_response; - priv->ieee->handle_assoc_response = ipw_handle_assoc_response; -#endif /* CONFIG_IPW2200_QOS */ - - priv->ieee->perfect_rssi = -20; - priv->ieee->worst_rssi = -85; - - net_dev->netdev_ops = &ipw_netdev_ops; - priv->wireless_data.spy_data = &priv->ieee->spy_data; - net_dev->wireless_data = &priv->wireless_data; - net_dev->wireless_handlers = &ipw_wx_handler_def; - net_dev->ethtool_ops = &ipw_ethtool_ops; - - err = sysfs_create_group(&pdev->dev.kobj, &ipw_attribute_group); - if (err) { - IPW_ERROR("failed to create sysfs device attributes\n"); - mutex_unlock(&priv->mutex); - goto out_release_irq; - } - - if (ipw_up(priv)) { - mutex_unlock(&priv->mutex); - err = -EIO; - goto out_remove_sysfs; - } - - mutex_unlock(&priv->mutex); - - err = ipw_wdev_init(net_dev); - if (err) { - IPW_ERROR("failed to register wireless device\n"); - goto out_remove_sysfs; - } - - err = register_netdev(net_dev); - if (err) { - IPW_ERROR("failed to register network device\n"); - goto out_unregister_wiphy; - } - -#ifdef CONFIG_IPW2200_PROMISCUOUS - if (rtap_iface) { - err = ipw_prom_alloc(priv); - if (err) { - IPW_ERROR("Failed to register promiscuous network " - "device (error %d).\n", err); - unregister_netdev(priv->net_dev); - goto out_unregister_wiphy; - } - } -#endif - - printk(KERN_INFO DRV_NAME ": Detected geography %s (%d 802.11bg " - "channels, %d 802.11a channels)\n", - priv->ieee->geo.name, priv->ieee->geo.bg_channels, - priv->ieee->geo.a_channels); - - return 0; - - out_unregister_wiphy: - wiphy_unregister(priv->ieee->wdev.wiphy); - kfree(priv->ieee->a_band.channels); - kfree(priv->ieee->bg_band.channels); - out_remove_sysfs: - sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); - out_release_irq: - free_irq(pdev->irq, priv); - out_iounmap: - iounmap(priv->hw_base); - out_pci_release_regions: - pci_release_regions(pdev); - out_pci_disable_device: - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - out_free_libipw: - free_libipw(priv->net_dev, 0); - out: - return err; -} - -static void ipw_pci_remove(struct pci_dev *pdev) -{ - struct ipw_priv *priv = pci_get_drvdata(pdev); - struct list_head *p, *q; - int i; - - if (!priv) - return; - - mutex_lock(&priv->mutex); - - priv->status |= STATUS_EXIT_PENDING; - ipw_down(priv); - sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group); - - mutex_unlock(&priv->mutex); - - unregister_netdev(priv->net_dev); - - if (priv->rxq) { - ipw_rx_queue_free(priv, priv->rxq); - priv->rxq = NULL; - } - ipw_tx_queue_free(priv); - - if (priv->cmdlog) { - kfree(priv->cmdlog); - priv->cmdlog = NULL; - } - - /* make sure all works are inactive */ - cancel_delayed_work_sync(&priv->adhoc_check); - cancel_work_sync(&priv->associate); - cancel_work_sync(&priv->disassociate); - cancel_work_sync(&priv->system_config); - cancel_work_sync(&priv->rx_replenish); - cancel_work_sync(&priv->adapter_restart); - cancel_delayed_work_sync(&priv->rf_kill); - cancel_work_sync(&priv->up); - cancel_work_sync(&priv->down); - cancel_delayed_work_sync(&priv->request_scan); - cancel_delayed_work_sync(&priv->request_direct_scan); - cancel_delayed_work_sync(&priv->request_passive_scan); - cancel_delayed_work_sync(&priv->scan_event); - cancel_delayed_work_sync(&priv->gather_stats); - cancel_work_sync(&priv->abort_scan); - cancel_work_sync(&priv->roam); - cancel_delayed_work_sync(&priv->scan_check); - cancel_work_sync(&priv->link_up); - cancel_work_sync(&priv->link_down); - cancel_delayed_work_sync(&priv->led_link_on); - cancel_delayed_work_sync(&priv->led_link_off); - cancel_delayed_work_sync(&priv->led_act_off); - cancel_work_sync(&priv->merge_networks); - - /* Free MAC hash list for ADHOC */ - for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) { - list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) { - list_del(p); - kfree(list_entry(p, struct ipw_ibss_seq, list)); - } - } - - kfree(priv->error); - priv->error = NULL; - -#ifdef CONFIG_IPW2200_PROMISCUOUS - ipw_prom_free(priv); -#endif - - free_irq(pdev->irq, priv); - iounmap(priv->hw_base); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - /* wiphy_unregister needs to be here, before free_libipw */ - wiphy_unregister(priv->ieee->wdev.wiphy); - kfree(priv->ieee->a_band.channels); - kfree(priv->ieee->bg_band.channels); - free_libipw(priv->net_dev, 0); - free_firmware(); -} - -#ifdef CONFIG_PM -static int ipw_pci_suspend(struct pci_dev *pdev, pm_message_t state) -{ - struct ipw_priv *priv = pci_get_drvdata(pdev); - struct net_device *dev = priv->net_dev; - - printk(KERN_INFO "%s: Going into suspend...\n", dev->name); - - /* Take down the device; powers it off, etc. */ - ipw_down(priv); - - /* Remove the PRESENT state of the device */ - netif_device_detach(dev); - - pci_save_state(pdev); - pci_disable_device(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); - - priv->suspend_at = get_seconds(); - - return 0; -} - -static int ipw_pci_resume(struct pci_dev *pdev) -{ - struct ipw_priv *priv = pci_get_drvdata(pdev); - struct net_device *dev = priv->net_dev; - int err; - u32 val; - - printk(KERN_INFO "%s: Coming out of suspend...\n", dev->name); - - pci_set_power_state(pdev, PCI_D0); - err = pci_enable_device(pdev); - if (err) { - printk(KERN_ERR "%s: pci_enable_device failed on resume\n", - dev->name); - return err; - } - pci_restore_state(pdev); - - /* - * Suspend/Resume resets the PCI configuration space, so we have to - * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries - * from interfering with C3 CPU state. pci_restore_state won't help - * here since it only restores the first 64 bytes pci config header. - */ - pci_read_config_dword(pdev, 0x40, &val); - if ((val & 0x0000ff00) != 0) - pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); - - /* Set the device back into the PRESENT state; this will also wake - * the queue of needed */ - netif_device_attach(dev); - - priv->suspend_time = get_seconds() - priv->suspend_at; - - /* Bring the device back up */ - schedule_work(&priv->up); - - return 0; -} -#endif - -static void ipw_pci_shutdown(struct pci_dev *pdev) -{ - struct ipw_priv *priv = pci_get_drvdata(pdev); - - /* Take down the device; powers it off, etc. */ - ipw_down(priv); - - pci_disable_device(pdev); -} - -/* driver initialization stuff */ -static struct pci_driver ipw_driver = { - .name = DRV_NAME, - .id_table = card_ids, - .probe = ipw_pci_probe, - .remove = ipw_pci_remove, -#ifdef CONFIG_PM - .suspend = ipw_pci_suspend, - .resume = ipw_pci_resume, -#endif - .shutdown = ipw_pci_shutdown, -}; - -static int __init ipw_init(void) -{ - int ret; - - printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); - printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); - - ret = pci_register_driver(&ipw_driver); - if (ret) { - IPW_ERROR("Unable to initialize PCI module\n"); - return ret; - } - - ret = driver_create_file(&ipw_driver.driver, &driver_attr_debug_level); - if (ret) { - IPW_ERROR("Unable to create driver sysfs file\n"); - pci_unregister_driver(&ipw_driver); - return ret; - } - - return ret; -} - -static void __exit ipw_exit(void) -{ - driver_remove_file(&ipw_driver.driver, &driver_attr_debug_level); - pci_unregister_driver(&ipw_driver); -} - -module_param(disable, int, 0444); -MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); - -module_param(associate, int, 0444); -MODULE_PARM_DESC(associate, "auto associate when scanning (default off)"); - -module_param(auto_create, int, 0444); -MODULE_PARM_DESC(auto_create, "auto create adhoc network (default on)"); - -module_param_named(led, led_support, int, 0444); -MODULE_PARM_DESC(led, "enable led control on some systems (default 1 on)"); - -module_param(debug, int, 0444); -MODULE_PARM_DESC(debug, "debug output mask"); - -module_param_named(channel, default_channel, int, 0444); -MODULE_PARM_DESC(channel, "channel to limit associate to (default 0 [ANY])"); - -#ifdef CONFIG_IPW2200_PROMISCUOUS -module_param(rtap_iface, int, 0444); -MODULE_PARM_DESC(rtap_iface, "create the rtap interface (1 - create, default 0)"); -#endif - -#ifdef CONFIG_IPW2200_QOS -module_param(qos_enable, int, 0444); -MODULE_PARM_DESC(qos_enable, "enable all QoS functionalitis"); - -module_param(qos_burst_enable, int, 0444); -MODULE_PARM_DESC(qos_burst_enable, "enable QoS burst mode"); - -module_param(qos_no_ack_mask, int, 0444); -MODULE_PARM_DESC(qos_no_ack_mask, "mask Tx_Queue to no ack"); - -module_param(burst_duration_CCK, int, 0444); -MODULE_PARM_DESC(burst_duration_CCK, "set CCK burst value"); - -module_param(burst_duration_OFDM, int, 0444); -MODULE_PARM_DESC(burst_duration_OFDM, "set OFDM burst value"); -#endif /* CONFIG_IPW2200_QOS */ - -#ifdef CONFIG_IPW2200_MONITOR -module_param_named(mode, network_mode, int, 0444); -MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS,2=Monitor)"); -#else -module_param_named(mode, network_mode, int, 0444); -MODULE_PARM_DESC(mode, "network mode (0=BSS,1=IBSS)"); -#endif - -module_param(bt_coexist, int, 0444); -MODULE_PARM_DESC(bt_coexist, "enable bluetooth coexistence (default off)"); - -module_param(hwcrypto, int, 0444); -MODULE_PARM_DESC(hwcrypto, "enable hardware crypto (default off)"); - -module_param(cmdlog, int, 0444); -MODULE_PARM_DESC(cmdlog, - "allocate a ring buffer for logging firmware commands"); - -module_param(roaming, int, 0444); -MODULE_PARM_DESC(roaming, "enable roaming support (default on)"); - -module_param(antenna, int, 0444); -MODULE_PARM_DESC(antenna, "select antenna 1=Main, 3=Aux, default 0 [both], 2=slow_diversity (choose the one with lower background noise)"); - -module_exit(ipw_exit); -module_init(ipw_init); diff --git a/drivers/net/wireless/ipw2x00/ipw2200.h b/drivers/net/wireless/ipw2x00/ipw2200.h deleted file mode 100644 index 570d6fb88967..000000000000 --- a/drivers/net/wireless/ipw2x00/ipw2200.h +++ /dev/null @@ -1,2002 +0,0 @@ -/****************************************************************************** - - Copyright(c) 2003 - 2006 Intel 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., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - - Contact Information: - Intel Linux Wireless - Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - -******************************************************************************/ - -#ifndef __ipw2200_h__ -#define __ipw2200_h__ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#define DRV_NAME "ipw2200" - -#include - -#include "libipw.h" - -/* Authentication and Association States */ -enum connection_manager_assoc_states { - CMAS_INIT = 0, - CMAS_TX_AUTH_SEQ_1, - CMAS_RX_AUTH_SEQ_2, - CMAS_AUTH_SEQ_1_PASS, - CMAS_AUTH_SEQ_1_FAIL, - CMAS_TX_AUTH_SEQ_3, - CMAS_RX_AUTH_SEQ_4, - CMAS_AUTH_SEQ_2_PASS, - CMAS_AUTH_SEQ_2_FAIL, - CMAS_AUTHENTICATED, - CMAS_TX_ASSOC, - CMAS_RX_ASSOC_RESP, - CMAS_ASSOCIATED, - CMAS_LAST -}; - -#define IPW_WAIT (1<<0) -#define IPW_QUIET (1<<1) -#define IPW_ROAMING (1<<2) - -#define IPW_POWER_MODE_CAM 0x00 //(always on) -#define IPW_POWER_INDEX_1 0x01 -#define IPW_POWER_INDEX_2 0x02 -#define IPW_POWER_INDEX_3 0x03 -#define IPW_POWER_INDEX_4 0x04 -#define IPW_POWER_INDEX_5 0x05 -#define IPW_POWER_AC 0x06 -#define IPW_POWER_BATTERY 0x07 -#define IPW_POWER_LIMIT 0x07 -#define IPW_POWER_MASK 0x0F -#define IPW_POWER_ENABLED 0x10 -#define IPW_POWER_LEVEL(x) ((x) & IPW_POWER_MASK) - -#define IPW_CMD_HOST_COMPLETE 2 -#define IPW_CMD_POWER_DOWN 4 -#define IPW_CMD_SYSTEM_CONFIG 6 -#define IPW_CMD_MULTICAST_ADDRESS 7 -#define IPW_CMD_SSID 8 -#define IPW_CMD_ADAPTER_ADDRESS 11 -#define IPW_CMD_PORT_TYPE 12 -#define IPW_CMD_RTS_THRESHOLD 15 -#define IPW_CMD_FRAG_THRESHOLD 16 -#define IPW_CMD_POWER_MODE 17 -#define IPW_CMD_WEP_KEY 18 -#define IPW_CMD_TGI_TX_KEY 19 -#define IPW_CMD_SCAN_REQUEST 20 -#define IPW_CMD_ASSOCIATE 21 -#define IPW_CMD_SUPPORTED_RATES 22 -#define IPW_CMD_SCAN_ABORT 23 -#define IPW_CMD_TX_FLUSH 24 -#define IPW_CMD_QOS_PARAMETERS 25 -#define IPW_CMD_SCAN_REQUEST_EXT 26 -#define IPW_CMD_DINO_CONFIG 30 -#define IPW_CMD_RSN_CAPABILITIES 31 -#define IPW_CMD_RX_KEY 32 -#define IPW_CMD_CARD_DISABLE 33 -#define IPW_CMD_SEED_NUMBER 34 -#define IPW_CMD_TX_POWER 35 -#define IPW_CMD_COUNTRY_INFO 36 -#define IPW_CMD_AIRONET_INFO 37 -#define IPW_CMD_AP_TX_POWER 38 -#define IPW_CMD_CCKM_INFO 39 -#define IPW_CMD_CCX_VER_INFO 40 -#define IPW_CMD_SET_CALIBRATION 41 -#define IPW_CMD_SENSITIVITY_CALIB 42 -#define IPW_CMD_RETRY_LIMIT 51 -#define IPW_CMD_IPW_PRE_POWER_DOWN 58 -#define IPW_CMD_VAP_BEACON_TEMPLATE 60 -#define IPW_CMD_VAP_DTIM_PERIOD 61 -#define IPW_CMD_EXT_SUPPORTED_RATES 62 -#define IPW_CMD_VAP_LOCAL_TX_PWR_CONSTRAINT 63 -#define IPW_CMD_VAP_QUIET_INTERVALS 64 -#define IPW_CMD_VAP_CHANNEL_SWITCH 65 -#define IPW_CMD_VAP_MANDATORY_CHANNELS 66 -#define IPW_CMD_VAP_CELL_PWR_LIMIT 67 -#define IPW_CMD_VAP_CF_PARAM_SET 68 -#define IPW_CMD_VAP_SET_BEACONING_STATE 69 -#define IPW_CMD_MEASUREMENT 80 -#define IPW_CMD_POWER_CAPABILITY 81 -#define IPW_CMD_SUPPORTED_CHANNELS 82 -#define IPW_CMD_TPC_REPORT 83 -#define IPW_CMD_WME_INFO 84 -#define IPW_CMD_PRODUCTION_COMMAND 85 -#define IPW_CMD_LINKSYS_EOU_INFO 90 - -#define RFD_SIZE 4 -#define NUM_TFD_CHUNKS 6 - -#define TX_QUEUE_SIZE 32 -#define RX_QUEUE_SIZE 32 - -#define DINO_CMD_WEP_KEY 0x08 -#define DINO_CMD_TX 0x0B -#define DCT_ANTENNA_A 0x01 -#define DCT_ANTENNA_B 0x02 - -#define IPW_A_MODE 0 -#define IPW_B_MODE 1 -#define IPW_G_MODE 2 - -/* - * TX Queue Flag Definitions - */ - -/* tx wep key definition */ -#define DCT_WEP_KEY_NOT_IMMIDIATE 0x00 -#define DCT_WEP_KEY_64Bit 0x40 -#define DCT_WEP_KEY_128Bit 0x80 -#define DCT_WEP_KEY_128bitIV 0xC0 -#define DCT_WEP_KEY_SIZE_MASK 0xC0 - -#define DCT_WEP_KEY_INDEX_MASK 0x0F -#define DCT_WEP_INDEX_USE_IMMEDIATE 0x20 - -/* abort attempt if mgmt frame is rx'd */ -#define DCT_FLAG_ABORT_MGMT 0x01 - -/* require CTS */ -#define DCT_FLAG_CTS_REQUIRED 0x02 - -/* use short preamble */ -#define DCT_FLAG_LONG_PREAMBLE 0x00 -#define DCT_FLAG_SHORT_PREAMBLE 0x04 - -/* RTS/CTS first */ -#define DCT_FLAG_RTS_REQD 0x08 - -/* dont calculate duration field */ -#define DCT_FLAG_DUR_SET 0x10 - -/* even if MAC WEP set (allows pre-encrypt) */ -#define DCT_FLAG_NO_WEP 0x20 - -/* overwrite TSF field */ -#define DCT_FLAG_TSF_REQD 0x40 - -/* ACK rx is expected to follow */ -#define DCT_FLAG_ACK_REQD 0x80 - -/* TX flags extension */ -#define DCT_FLAG_EXT_MODE_CCK 0x01 -#define DCT_FLAG_EXT_MODE_OFDM 0x00 - -#define DCT_FLAG_EXT_SECURITY_WEP 0x00 -#define DCT_FLAG_EXT_SECURITY_NO DCT_FLAG_EXT_SECURITY_WEP -#define DCT_FLAG_EXT_SECURITY_CKIP 0x04 -#define DCT_FLAG_EXT_SECURITY_CCM 0x08 -#define DCT_FLAG_EXT_SECURITY_TKIP 0x0C -#define DCT_FLAG_EXT_SECURITY_MASK 0x0C - -#define DCT_FLAG_EXT_QOS_ENABLED 0x10 - -#define DCT_FLAG_EXT_HC_NO_SIFS_PIFS 0x00 -#define DCT_FLAG_EXT_HC_SIFS 0x20 -#define DCT_FLAG_EXT_HC_PIFS 0x40 - -#define TX_RX_TYPE_MASK 0xFF -#define TX_FRAME_TYPE 0x00 -#define TX_HOST_COMMAND_TYPE 0x01 -#define RX_FRAME_TYPE 0x09 -#define RX_HOST_NOTIFICATION_TYPE 0x03 -#define RX_HOST_CMD_RESPONSE_TYPE 0x04 -#define RX_TX_FRAME_RESPONSE_TYPE 0x05 -#define TFD_NEED_IRQ_MASK 0x04 - -#define HOST_CMD_DINO_CONFIG 30 - -#define HOST_NOTIFICATION_STATUS_ASSOCIATED 10 -#define HOST_NOTIFICATION_STATUS_AUTHENTICATE 11 -#define HOST_NOTIFICATION_STATUS_SCAN_CHANNEL_RESULT 12 -#define HOST_NOTIFICATION_STATUS_SCAN_COMPLETED 13 -#define HOST_NOTIFICATION_STATUS_FRAG_LENGTH 14 -#define HOST_NOTIFICATION_STATUS_LINK_DETERIORATION 15 -#define HOST_NOTIFICATION_DINO_CONFIG_RESPONSE 16 -#define HOST_NOTIFICATION_STATUS_BEACON_STATE 17 -#define HOST_NOTIFICATION_STATUS_TGI_TX_KEY 18 -#define HOST_NOTIFICATION_TX_STATUS 19 -#define HOST_NOTIFICATION_CALIB_KEEP_RESULTS 20 -#define HOST_NOTIFICATION_MEASUREMENT_STARTED 21 -#define HOST_NOTIFICATION_MEASUREMENT_ENDED 22 -#define HOST_NOTIFICATION_CHANNEL_SWITCHED 23 -#define HOST_NOTIFICATION_RX_DURING_QUIET_PERIOD 24 -#define HOST_NOTIFICATION_NOISE_STATS 25 -#define HOST_NOTIFICATION_S36_MEASUREMENT_ACCEPTED 30 -#define HOST_NOTIFICATION_S36_MEASUREMENT_REFUSED 31 - -#define HOST_NOTIFICATION_STATUS_BEACON_MISSING 1 -#define IPW_MB_SCAN_CANCEL_THRESHOLD 3 -#define IPW_MB_ROAMING_THRESHOLD_MIN 1 -#define IPW_MB_ROAMING_THRESHOLD_DEFAULT 8 -#define IPW_MB_ROAMING_THRESHOLD_MAX 30 -#define IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT 3*IPW_MB_ROAMING_THRESHOLD_DEFAULT -#define IPW_REAL_RATE_RX_PACKET_THRESHOLD 300 - -#define MACADRR_BYTE_LEN 6 - -#define DCR_TYPE_AP 0x01 -#define DCR_TYPE_WLAP 0x02 -#define DCR_TYPE_MU_ESS 0x03 -#define DCR_TYPE_MU_IBSS 0x04 -#define DCR_TYPE_MU_PIBSS 0x05 -#define DCR_TYPE_SNIFFER 0x06 -#define DCR_TYPE_MU_BSS DCR_TYPE_MU_ESS - -/* QoS definitions */ - -#define CW_MIN_OFDM 15 -#define CW_MAX_OFDM 1023 -#define CW_MIN_CCK 31 -#define CW_MAX_CCK 1023 - -#define QOS_TX0_CW_MIN_OFDM cpu_to_le16(CW_MIN_OFDM) -#define QOS_TX1_CW_MIN_OFDM cpu_to_le16(CW_MIN_OFDM) -#define QOS_TX2_CW_MIN_OFDM cpu_to_le16((CW_MIN_OFDM + 1)/2 - 1) -#define QOS_TX3_CW_MIN_OFDM cpu_to_le16((CW_MIN_OFDM + 1)/4 - 1) - -#define QOS_TX0_CW_MIN_CCK cpu_to_le16(CW_MIN_CCK) -#define QOS_TX1_CW_MIN_CCK cpu_to_le16(CW_MIN_CCK) -#define QOS_TX2_CW_MIN_CCK cpu_to_le16((CW_MIN_CCK + 1)/2 - 1) -#define QOS_TX3_CW_MIN_CCK cpu_to_le16((CW_MIN_CCK + 1)/4 - 1) - -#define QOS_TX0_CW_MAX_OFDM cpu_to_le16(CW_MAX_OFDM) -#define QOS_TX1_CW_MAX_OFDM cpu_to_le16(CW_MAX_OFDM) -#define QOS_TX2_CW_MAX_OFDM cpu_to_le16(CW_MIN_OFDM) -#define QOS_TX3_CW_MAX_OFDM cpu_to_le16((CW_MIN_OFDM + 1)/2 - 1) - -#define QOS_TX0_CW_MAX_CCK cpu_to_le16(CW_MAX_CCK) -#define QOS_TX1_CW_MAX_CCK cpu_to_le16(CW_MAX_CCK) -#define QOS_TX2_CW_MAX_CCK cpu_to_le16(CW_MIN_CCK) -#define QOS_TX3_CW_MAX_CCK cpu_to_le16((CW_MIN_CCK + 1)/2 - 1) - -#define QOS_TX0_AIFS (3 - QOS_AIFSN_MIN_VALUE) -#define QOS_TX1_AIFS (7 - QOS_AIFSN_MIN_VALUE) -#define QOS_TX2_AIFS (2 - QOS_AIFSN_MIN_VALUE) -#define QOS_TX3_AIFS (2 - QOS_AIFSN_MIN_VALUE) - -#define QOS_TX0_ACM 0 -#define QOS_TX1_ACM 0 -#define QOS_TX2_ACM 0 -#define QOS_TX3_ACM 0 - -#define QOS_TX0_TXOP_LIMIT_CCK 0 -#define QOS_TX1_TXOP_LIMIT_CCK 0 -#define QOS_TX2_TXOP_LIMIT_CCK cpu_to_le16(6016) -#define QOS_TX3_TXOP_LIMIT_CCK cpu_to_le16(3264) - -#define QOS_TX0_TXOP_LIMIT_OFDM 0 -#define QOS_TX1_TXOP_LIMIT_OFDM 0 -#define QOS_TX2_TXOP_LIMIT_OFDM cpu_to_le16(3008) -#define QOS_TX3_TXOP_LIMIT_OFDM cpu_to_le16(1504) - -#define DEF_TX0_CW_MIN_OFDM cpu_to_le16(CW_MIN_OFDM) -#define DEF_TX1_CW_MIN_OFDM cpu_to_le16(CW_MIN_OFDM) -#define DEF_TX2_CW_MIN_OFDM cpu_to_le16(CW_MIN_OFDM) -#define DEF_TX3_CW_MIN_OFDM cpu_to_le16(CW_MIN_OFDM) - -#define DEF_TX0_CW_MIN_CCK cpu_to_le16(CW_MIN_CCK) -#define DEF_TX1_CW_MIN_CCK cpu_to_le16(CW_MIN_CCK) -#define DEF_TX2_CW_MIN_CCK cpu_to_le16(CW_MIN_CCK) -#define DEF_TX3_CW_MIN_CCK cpu_to_le16(CW_MIN_CCK) - -#define DEF_TX0_CW_MAX_OFDM cpu_to_le16(CW_MAX_OFDM) -#define DEF_TX1_CW_MAX_OFDM cpu_to_le16(CW_MAX_OFDM) -#define DEF_TX2_CW_MAX_OFDM cpu_to_le16(CW_MAX_OFDM) -#define DEF_TX3_CW_MAX_OFDM cpu_to_le16(CW_MAX_OFDM) - -#define DEF_TX0_CW_MAX_CCK cpu_to_le16(CW_MAX_CCK) -#define DEF_TX1_CW_MAX_CCK cpu_to_le16(CW_MAX_CCK) -#define DEF_TX2_CW_MAX_CCK cpu_to_le16(CW_MAX_CCK) -#define DEF_TX3_CW_MAX_CCK cpu_to_le16(CW_MAX_CCK) - -#define DEF_TX0_AIFS 0 -#define DEF_TX1_AIFS 0 -#define DEF_TX2_AIFS 0 -#define DEF_TX3_AIFS 0 - -#define DEF_TX0_ACM 0 -#define DEF_TX1_ACM 0 -#define DEF_TX2_ACM 0 -#define DEF_TX3_ACM 0 - -#define DEF_TX0_TXOP_LIMIT_CCK 0 -#define DEF_TX1_TXOP_LIMIT_CCK 0 -#define DEF_TX2_TXOP_LIMIT_CCK 0 -#define DEF_TX3_TXOP_LIMIT_CCK 0 - -#define DEF_TX0_TXOP_LIMIT_OFDM 0 -#define DEF_TX1_TXOP_LIMIT_OFDM 0 -#define DEF_TX2_TXOP_LIMIT_OFDM 0 -#define DEF_TX3_TXOP_LIMIT_OFDM 0 - -#define QOS_QOS_SETS 3 -#define QOS_PARAM_SET_ACTIVE 0 -#define QOS_PARAM_SET_DEF_CCK 1 -#define QOS_PARAM_SET_DEF_OFDM 2 - -#define CTRL_QOS_NO_ACK (0x0020) - -#define IPW_TX_QUEUE_1 1 -#define IPW_TX_QUEUE_2 2 -#define IPW_TX_QUEUE_3 3 -#define IPW_TX_QUEUE_4 4 - -/* QoS sturctures */ -struct ipw_qos_info { - int qos_enable; - struct libipw_qos_parameters *def_qos_parm_OFDM; - struct libipw_qos_parameters *def_qos_parm_CCK; - u32 burst_duration_CCK; - u32 burst_duration_OFDM; - u16 qos_no_ack_mask; - int burst_enable; -}; - -/**************************************************************/ -/** - * Generic queue structure - * - * Contains common data for Rx and Tx queues - */ -struct clx2_queue { - int n_bd; /**< number of BDs in this queue */ - int first_empty; /**< 1-st empty entry (index) */ - int last_used; /**< last used entry (index) */ - u32 reg_w; /**< 'write' reg (queue head), addr in domain 1 */ - u32 reg_r; /**< 'read' reg (queue tail), addr in domain 1 */ - dma_addr_t dma_addr; /**< physical addr for BD's */ - int low_mark; /**< low watermark, resume queue if free space more than this */ - int high_mark; /**< high watermark, stop queue if free space less than this */ -} __packed; /* XXX */ - -struct machdr32 { - __le16 frame_ctl; - __le16 duration; // watch out for endians! - u8 addr1[MACADRR_BYTE_LEN]; - u8 addr2[MACADRR_BYTE_LEN]; - u8 addr3[MACADRR_BYTE_LEN]; - __le16 seq_ctrl; // more endians! - u8 addr4[MACADRR_BYTE_LEN]; - __le16 qos_ctrl; -} __packed; - -struct machdr30 { - __le16 frame_ctl; - __le16 duration; // watch out for endians! - u8 addr1[MACADRR_BYTE_LEN]; - u8 addr2[MACADRR_BYTE_LEN]; - u8 addr3[MACADRR_BYTE_LEN]; - __le16 seq_ctrl; // more endians! - u8 addr4[MACADRR_BYTE_LEN]; -} __packed; - -struct machdr26 { - __le16 frame_ctl; - __le16 duration; // watch out for endians! - u8 addr1[MACADRR_BYTE_LEN]; - u8 addr2[MACADRR_BYTE_LEN]; - u8 addr3[MACADRR_BYTE_LEN]; - __le16 seq_ctrl; // more endians! - __le16 qos_ctrl; -} __packed; - -struct machdr24 { - __le16 frame_ctl; - __le16 duration; // watch out for endians! - u8 addr1[MACADRR_BYTE_LEN]; - u8 addr2[MACADRR_BYTE_LEN]; - u8 addr3[MACADRR_BYTE_LEN]; - __le16 seq_ctrl; // more endians! -} __packed; - -// TX TFD with 32 byte MAC Header -struct tx_tfd_32 { - struct machdr32 mchdr; // 32 - __le32 uivplaceholder[2]; // 8 -} __packed; - -// TX TFD with 30 byte MAC Header -struct tx_tfd_30 { - struct machdr30 mchdr; // 30 - u8 reserved[2]; // 2 - __le32 uivplaceholder[2]; // 8 -} __packed; - -// tx tfd with 26 byte mac header -struct tx_tfd_26 { - struct machdr26 mchdr; // 26 - u8 reserved1[2]; // 2 - __le32 uivplaceholder[2]; // 8 - u8 reserved2[4]; // 4 -} __packed; - -// tx tfd with 24 byte mac header -struct tx_tfd_24 { - struct machdr24 mchdr; // 24 - __le32 uivplaceholder[2]; // 8 - u8 reserved[8]; // 8 -} __packed; - -#define DCT_WEP_KEY_FIELD_LENGTH 16 - -struct tfd_command { - u8 index; - u8 length; - __le16 reserved; - u8 payload[0]; -} __packed; - -struct tfd_data { - /* Header */ - __le32 work_area_ptr; - u8 station_number; /* 0 for BSS */ - u8 reserved1; - __le16 reserved2; - - /* Tx Parameters */ - u8 cmd_id; - u8 seq_num; - __le16 len; - u8 priority; - u8 tx_flags; - u8 tx_flags_ext; - u8 key_index; - u8 wepkey[DCT_WEP_KEY_FIELD_LENGTH]; - u8 rate; - u8 antenna; - __le16 next_packet_duration; - __le16 next_frag_len; - __le16 back_off_counter; //////txop; - u8 retrylimit; - __le16 cwcurrent; - u8 reserved3; - - /* 802.11 MAC Header */ - union { - struct tx_tfd_24 tfd_24; - struct tx_tfd_26 tfd_26; - struct tx_tfd_30 tfd_30; - struct tx_tfd_32 tfd_32; - } tfd; - - /* Payload DMA info */ - __le32 num_chunks; - __le32 chunk_ptr[NUM_TFD_CHUNKS]; - __le16 chunk_len[NUM_TFD_CHUNKS]; -} __packed; - -struct txrx_control_flags { - u8 message_type; - u8 rx_seq_num; - u8 control_bits; - u8 reserved; -} __packed; - -#define TFD_SIZE 128 -#define TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH (TFD_SIZE - sizeof(struct txrx_control_flags)) - -struct tfd_frame { - struct txrx_control_flags control_flags; - union { - struct tfd_data data; - struct tfd_command cmd; - u8 raw[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH]; - } u; -} __packed; - -typedef void destructor_func(const void *); - -/** - * Tx Queue for DMA. Queue consists of circular buffer of - * BD's and required locking structures. - */ -struct clx2_tx_queue { - struct clx2_queue q; - struct tfd_frame *bd; - struct libipw_txb **txb; -}; - -/* - * RX related structures and functions - */ -#define RX_FREE_BUFFERS 32 -#define RX_LOW_WATERMARK 8 - -#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 -#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 -#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 - -// Used for passing to driver number of successes and failures per rate -struct rate_histogram { - union { - __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; - __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; - __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; - } success; - union { - __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; - __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; - __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; - } failed; -} __packed; - -/* statistics command response */ -struct ipw_cmd_stats { - u8 cmd_id; - u8 seq_num; - __le16 good_sfd; - __le16 bad_plcp; - __le16 wrong_bssid; - __le16 valid_mpdu; - __le16 bad_mac_header; - __le16 reserved_frame_types; - __le16 rx_ina; - __le16 bad_crc32; - __le16 invalid_cts; - __le16 invalid_acks; - __le16 long_distance_ina_fina; - __le16 dsp_silence_unreachable; - __le16 accumulated_rssi; - __le16 rx_ovfl_frame_tossed; - __le16 rssi_silence_threshold; - __le16 rx_ovfl_frame_supplied; - __le16 last_rx_frame_signal; - __le16 last_rx_frame_noise; - __le16 rx_autodetec_no_ofdm; - __le16 rx_autodetec_no_barker; - __le16 reserved; -} __packed; - -struct notif_channel_result { - u8 channel_num; - struct ipw_cmd_stats stats; - u8 uReserved; -} __packed; - -#define SCAN_COMPLETED_STATUS_COMPLETE 1 -#define SCAN_COMPLETED_STATUS_ABORTED 2 - -struct notif_scan_complete { - u8 scan_type; - u8 num_channels; - u8 status; - u8 reserved; -} __packed; - -struct notif_frag_length { - __le16 frag_length; - __le16 reserved; -} __packed; - -struct notif_beacon_state { - __le32 state; - __le32 number; -} __packed; - -struct notif_tgi_tx_key { - u8 key_state; - u8 security_type; - u8 station_index; - u8 reserved; -} __packed; - -#define SILENCE_OVER_THRESH (1) -#define SILENCE_UNDER_THRESH (2) - -struct notif_link_deterioration { - struct ipw_cmd_stats stats; - u8 rate; - u8 modulation; - struct rate_histogram histogram; - u8 silence_notification_type; /* SILENCE_OVER/UNDER_THRESH */ - __le16 silence_count; -} __packed; - -struct notif_association { - u8 state; -} __packed; - -struct notif_authenticate { - u8 state; - struct machdr24 addr; - __le16 status; -} __packed; - -struct notif_calibration { - u8 data[104]; -} __packed; - -struct notif_noise { - __le32 value; -} __packed; - -struct ipw_rx_notification { - u8 reserved[8]; - u8 subtype; - u8 flags; - __le16 size; - union { - struct notif_association assoc; - struct notif_authenticate auth; - struct notif_channel_result channel_result; - struct notif_scan_complete scan_complete; - struct notif_frag_length frag_len; - struct notif_beacon_state beacon_state; - struct notif_tgi_tx_key tgi_tx_key; - struct notif_link_deterioration link_deterioration; - struct notif_calibration calibration; - struct notif_noise noise; - u8 raw[0]; - } u; -} __packed; - -struct ipw_rx_frame { - __le32 reserved1; - u8 parent_tsf[4]; // fw_use[0] is boolean for OUR_TSF_IS_GREATER - u8 received_channel; // The channel that this frame was received on. - // Note that for .11b this does not have to be - // the same as the channel that it was sent. - // Filled by LMAC - u8 frameStatus; - u8 rate; - u8 rssi; - u8 agc; - u8 rssi_dbm; - __le16 signal; - __le16 noise; - u8 antennaAndPhy; - u8 control; // control bit should be on in bg - u8 rtscts_rate; // rate of rts or cts (in rts cts sequence rate - // is identical) - u8 rtscts_seen; // 0x1 RTS seen ; 0x2 CTS seen - __le16 length; - u8 data[0]; -} __packed; - -struct ipw_rx_header { - u8 message_type; - u8 rx_seq_num; - u8 control_bits; - u8 reserved; -} __packed; - -struct ipw_rx_packet { - struct ipw_rx_header header; - union { - struct ipw_rx_frame frame; - struct ipw_rx_notification notification; - } u; -} __packed; - -#define IPW_RX_NOTIFICATION_SIZE sizeof(struct ipw_rx_header) + 12 -#define IPW_RX_FRAME_SIZE (unsigned int)(sizeof(struct ipw_rx_header) + \ - sizeof(struct ipw_rx_frame)) - -struct ipw_rx_mem_buffer { - dma_addr_t dma_addr; - struct sk_buff *skb; - struct list_head list; -}; /* Not transferred over network, so not __packed */ - -struct ipw_rx_queue { - struct ipw_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; - struct ipw_rx_mem_buffer *queue[RX_QUEUE_SIZE]; - u32 processed; /* Internal index to last handled Rx packet */ - u32 read; /* Shared index to newest available Rx buffer */ - u32 write; /* Shared index to oldest written Rx packet */ - u32 free_count; /* Number of pre-allocated buffers in rx_free */ - /* Each of these lists is used as a FIFO for ipw_rx_mem_buffers */ - struct list_head rx_free; /* Own an SKBs */ - struct list_head rx_used; /* No SKB allocated */ - spinlock_t lock; -}; /* Not transferred over network, so not __packed */ - -struct alive_command_responce { - u8 alive_command; - u8 sequence_number; - __le16 software_revision; - u8 device_identifier; - u8 reserved1[5]; - __le16 reserved2; - __le16 reserved3; - __le16 clock_settle_time; - __le16 powerup_settle_time; - __le16 reserved4; - u8 time_stamp[5]; /* month, day, year, hours, minutes */ - u8 ucode_valid; -} __packed; - -#define IPW_MAX_RATES 12 - -struct ipw_rates { - u8 num_rates; - u8 rates[IPW_MAX_RATES]; -} __packed; - -struct command_block { - unsigned int control; - u32 source_addr; - u32 dest_addr; - unsigned int status; -} __packed; - -#define CB_NUMBER_OF_ELEMENTS_SMALL 64 -struct fw_image_desc { - unsigned long last_cb_index; - unsigned long current_cb_index; - struct command_block cb_list[CB_NUMBER_OF_ELEMENTS_SMALL]; - void *v_addr; - unsigned long p_addr; - unsigned long len; -}; - -struct ipw_sys_config { - u8 bt_coexistence; - u8 reserved1; - u8 answer_broadcast_ssid_probe; - u8 accept_all_data_frames; - u8 accept_non_directed_frames; - u8 exclude_unicast_unencrypted; - u8 disable_unicast_decryption; - u8 exclude_multicast_unencrypted; - u8 disable_multicast_decryption; - u8 antenna_diversity; - u8 pass_crc_to_host; - u8 dot11g_auto_detection; - u8 enable_cts_to_self; - u8 enable_multicast_filtering; - u8 bt_coexist_collision_thr; - u8 silence_threshold; - u8 accept_all_mgmt_bcpr; - u8 accept_all_mgmt_frames; - u8 pass_noise_stats_to_host; - u8 reserved3; -} __packed; - -struct ipw_multicast_addr { - u8 num_of_multicast_addresses; - u8 reserved[3]; - u8 mac1[6]; - u8 mac2[6]; - u8 mac3[6]; - u8 mac4[6]; -} __packed; - -#define DCW_WEP_KEY_INDEX_MASK 0x03 /* bits [0:1] */ -#define DCW_WEP_KEY_SEC_TYPE_MASK 0x30 /* bits [4:5] */ - -#define DCW_WEP_KEY_SEC_TYPE_WEP 0x00 -#define DCW_WEP_KEY_SEC_TYPE_CCM 0x20 -#define DCW_WEP_KEY_SEC_TYPE_TKIP 0x30 - -#define DCW_WEP_KEY_INVALID_SIZE 0x00 /* 0 = Invalid key */ -#define DCW_WEP_KEY64Bit_SIZE 0x05 /* 64-bit encryption */ -#define DCW_WEP_KEY128Bit_SIZE 0x0D /* 128-bit encryption */ -#define DCW_CCM_KEY128Bit_SIZE 0x10 /* 128-bit key */ -//#define DCW_WEP_KEY128BitIV_SIZE 0x10 /* 128-bit key and 128-bit IV */ - -struct ipw_wep_key { - u8 cmd_id; - u8 seq_num; - u8 key_index; - u8 key_size; - u8 key[16]; -} __packed; - -struct ipw_tgi_tx_key { - u8 key_id; - u8 security_type; - u8 station_index; - u8 flags; - u8 key[16]; - __le32 tx_counter[2]; -} __packed; - -#define IPW_SCAN_CHANNELS 54 - -struct ipw_scan_request { - u8 scan_type; - __le16 dwell_time; - u8 channels_list[IPW_SCAN_CHANNELS]; - u8 channels_reserved[3]; -} __packed; - -enum { - IPW_SCAN_PASSIVE_TILL_FIRST_BEACON_SCAN = 0, - IPW_SCAN_PASSIVE_FULL_DWELL_SCAN, - IPW_SCAN_ACTIVE_DIRECT_SCAN, - IPW_SCAN_ACTIVE_BROADCAST_SCAN, - IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN, - IPW_SCAN_TYPES -}; - -struct ipw_scan_request_ext { - __le32 full_scan_index; - u8 channels_list[IPW_SCAN_CHANNELS]; - u8 scan_type[IPW_SCAN_CHANNELS / 2]; - u8 reserved; - __le16 dwell_time[IPW_SCAN_TYPES]; -} __packed; - -static inline u8 ipw_get_scan_type(struct ipw_scan_request_ext *scan, u8 index) -{ - if (index % 2) - return scan->scan_type[index / 2] & 0x0F; - else - return (scan->scan_type[index / 2] & 0xF0) >> 4; -} - -static inline void ipw_set_scan_type(struct ipw_scan_request_ext *scan, - u8 index, u8 scan_type) -{ - if (index % 2) - scan->scan_type[index / 2] = - (scan->scan_type[index / 2] & 0xF0) | (scan_type & 0x0F); - else - scan->scan_type[index / 2] = - (scan->scan_type[index / 2] & 0x0F) | - ((scan_type & 0x0F) << 4); -} - -struct ipw_associate { - u8 channel; -#ifdef __LITTLE_ENDIAN_BITFIELD - u8 auth_type:4, auth_key:4; -#else - u8 auth_key:4, auth_type:4; -#endif - u8 assoc_type; - u8 reserved; - __le16 policy_support; - u8 preamble_length; - u8 ieee_mode; - u8 bssid[ETH_ALEN]; - __le32 assoc_tsf_msw; - __le32 assoc_tsf_lsw; - __le16 capability; - __le16 listen_interval; - __le16 beacon_interval; - u8 dest[ETH_ALEN]; - __le16 atim_window; - u8 smr; - u8 reserved1; - __le16 reserved2; -} __packed; - -struct ipw_supported_rates { - u8 ieee_mode; - u8 num_rates; - u8 purpose; - u8 reserved; - u8 supported_rates[IPW_MAX_RATES]; -} __packed; - -struct ipw_rts_threshold { - __le16 rts_threshold; - __le16 reserved; -} __packed; - -struct ipw_frag_threshold { - __le16 frag_threshold; - __le16 reserved; -} __packed; - -struct ipw_retry_limit { - u8 short_retry_limit; - u8 long_retry_limit; - __le16 reserved; -} __packed; - -struct ipw_dino_config { - __le32 dino_config_addr; - __le16 dino_config_size; - u8 dino_response; - u8 reserved; -} __packed; - -struct ipw_aironet_info { - u8 id; - u8 length; - __le16 reserved; -} __packed; - -struct ipw_rx_key { - u8 station_index; - u8 key_type; - u8 key_id; - u8 key_flag; - u8 key[16]; - u8 station_address[6]; - u8 key_index; - u8 reserved; -} __packed; - -struct ipw_country_channel_info { - u8 first_channel; - u8 no_channels; - s8 max_tx_power; -} __packed; - -struct ipw_country_info { - u8 id; - u8 length; - u8 country_str[IEEE80211_COUNTRY_STRING_LEN]; - struct ipw_country_channel_info groups[7]; -} __packed; - -struct ipw_channel_tx_power { - u8 channel_number; - s8 tx_power; -} __packed; - -#define SCAN_ASSOCIATED_INTERVAL (HZ) -#define SCAN_INTERVAL (HZ / 10) -#define MAX_A_CHANNELS 37 -#define MAX_B_CHANNELS 14 - -struct ipw_tx_power { - u8 num_channels; - u8 ieee_mode; - struct ipw_channel_tx_power channels_tx_power[MAX_A_CHANNELS]; -} __packed; - -struct ipw_rsn_capabilities { - u8 id; - u8 length; - __le16 version; -} __packed; - -struct ipw_sensitivity_calib { - __le16 beacon_rssi_raw; - __le16 reserved; -} __packed; - -/** - * Host command structure. - * - * On input, the following fields should be filled: - * - cmd - * - len - * - status_len - * - param (if needed) - * - * On output, - * - \a status contains status; - * - \a param filled with status parameters. - */ -struct ipw_cmd { /* XXX */ - u32 cmd; /**< Host command */ - u32 status;/**< Status */ - u32 status_len; - /**< How many 32 bit parameters in the status */ - u32 len; /**< incoming parameters length, bytes */ - /** - * command parameters. - * There should be enough space for incoming and - * outcoming parameters. - * Incoming parameters listed 1-st, followed by outcoming params. - * nParams=(len+3)/4+status_len - */ - u32 param[0]; -} __packed; - -#define STATUS_HCMD_ACTIVE (1<<0) /**< host command in progress */ - -#define STATUS_INT_ENABLED (1<<1) -#define STATUS_RF_KILL_HW (1<<2) -#define STATUS_RF_KILL_SW (1<<3) -#define STATUS_RF_KILL_MASK (STATUS_RF_KILL_HW | STATUS_RF_KILL_SW) - -#define STATUS_INIT (1<<5) -#define STATUS_AUTH (1<<6) -#define STATUS_ASSOCIATED (1<<7) -#define STATUS_STATE_MASK (STATUS_INIT | STATUS_AUTH | STATUS_ASSOCIATED) - -#define STATUS_ASSOCIATING (1<<8) -#define STATUS_DISASSOCIATING (1<<9) -#define STATUS_ROAMING (1<<10) -#define STATUS_EXIT_PENDING (1<<11) -#define STATUS_DISASSOC_PENDING (1<<12) -#define STATUS_STATE_PENDING (1<<13) - -#define STATUS_DIRECT_SCAN_PENDING (1<<19) -#define STATUS_SCAN_PENDING (1<<20) -#define STATUS_SCANNING (1<<21) -#define STATUS_SCAN_ABORTING (1<<22) -#define STATUS_SCAN_FORCED (1<<23) - -#define STATUS_LED_LINK_ON (1<<24) -#define STATUS_LED_ACT_ON (1<<25) - -#define STATUS_INDIRECT_BYTE (1<<28) /* sysfs entry configured for access */ -#define STATUS_INDIRECT_DWORD (1<<29) /* sysfs entry configured for access */ -#define STATUS_DIRECT_DWORD (1<<30) /* sysfs entry configured for access */ - -#define STATUS_SECURITY_UPDATED (1<<31) /* Security sync needed */ - -#define CFG_STATIC_CHANNEL (1<<0) /* Restrict assoc. to single channel */ -#define CFG_STATIC_ESSID (1<<1) /* Restrict assoc. to single SSID */ -#define CFG_STATIC_BSSID (1<<2) /* Restrict assoc. to single BSSID */ -#define CFG_CUSTOM_MAC (1<<3) -#define CFG_PREAMBLE_LONG (1<<4) -#define CFG_ADHOC_PERSIST (1<<5) -#define CFG_ASSOCIATE (1<<6) -#define CFG_FIXED_RATE (1<<7) -#define CFG_ADHOC_CREATE (1<<8) -#define CFG_NO_LED (1<<9) -#define CFG_BACKGROUND_SCAN (1<<10) -#define CFG_SPEED_SCAN (1<<11) -#define CFG_NET_STATS (1<<12) - -#define CAP_SHARED_KEY (1<<0) /* Off = OPEN */ -#define CAP_PRIVACY_ON (1<<1) /* Off = No privacy */ - -#define MAX_STATIONS 32 -#define IPW_INVALID_STATION (0xff) - -struct ipw_station_entry { - u8 mac_addr[ETH_ALEN]; - u8 reserved; - u8 support_mode; -}; - -#define AVG_ENTRIES 8 -struct average { - s16 entries[AVG_ENTRIES]; - u8 pos; - u8 init; - s32 sum; -}; - -#define MAX_SPEED_SCAN 100 -#define IPW_IBSS_MAC_HASH_SIZE 31 - -struct ipw_ibss_seq { - u8 mac[ETH_ALEN]; - u16 seq_num; - u16 frag_num; - unsigned long packet_time; - struct list_head list; -}; - -struct ipw_error_elem { /* XXX */ - u32 desc; - u32 time; - u32 blink1; - u32 blink2; - u32 link1; - u32 link2; - u32 data; -}; - -struct ipw_event { /* XXX */ - u32 event; - u32 time; - u32 data; -} __packed; - -struct ipw_fw_error { /* XXX */ - unsigned long jiffies; - u32 status; - u32 config; - u32 elem_len; - u32 log_len; - struct ipw_error_elem *elem; - struct ipw_event *log; - u8 payload[0]; -} __packed; - -#ifdef CONFIG_IPW2200_PROMISCUOUS - -enum ipw_prom_filter { - IPW_PROM_CTL_HEADER_ONLY = (1 << 0), - IPW_PROM_MGMT_HEADER_ONLY = (1 << 1), - IPW_PROM_DATA_HEADER_ONLY = (1 << 2), - IPW_PROM_ALL_HEADER_ONLY = 0xf, /* bits 0..3 */ - IPW_PROM_NO_TX = (1 << 4), - IPW_PROM_NO_RX = (1 << 5), - IPW_PROM_NO_CTL = (1 << 6), - IPW_PROM_NO_MGMT = (1 << 7), - IPW_PROM_NO_DATA = (1 << 8), -}; - -struct ipw_priv; -struct ipw_prom_priv { - struct ipw_priv *priv; - struct libipw_device *ieee; - enum ipw_prom_filter filter; - int tx_packets; - int rx_packets; -}; -#endif - -#if defined(CONFIG_IPW2200_RADIOTAP) || defined(CONFIG_IPW2200_PROMISCUOUS) -/* Magic struct that slots into the radiotap header -- no reason - * to build this manually element by element, we can write it much - * more efficiently than we can parse it. ORDER MATTERS HERE - * - * When sent to us via the simulated Rx interface in sysfs, the entire - * structure is provided regardless of any bits unset. - */ -struct ipw_rt_hdr { - struct ieee80211_radiotap_header rt_hdr; - u64 rt_tsf; /* TSF */ /* XXX */ - u8 rt_flags; /* radiotap packet flags */ - u8 rt_rate; /* rate in 500kb/s */ - __le16 rt_channel; /* channel in mhz */ - __le16 rt_chbitmask; /* channel bitfield */ - s8 rt_dbmsignal; /* signal in dbM, kluged to signed */ - s8 rt_dbmnoise; - u8 rt_antenna; /* antenna number */ - u8 payload[0]; /* payload... */ -} __packed; -#endif - -struct ipw_priv { - /* ieee device used by generic ieee processing code */ - struct libipw_device *ieee; - - spinlock_t lock; - spinlock_t irq_lock; - struct mutex mutex; - - /* basic pci-network driver stuff */ - struct pci_dev *pci_dev; - struct net_device *net_dev; - -#ifdef CONFIG_IPW2200_PROMISCUOUS - /* Promiscuous mode */ - struct ipw_prom_priv *prom_priv; - struct net_device *prom_net_dev; -#endif - - /* pci hardware address support */ - void __iomem *hw_base; - unsigned long hw_len; - - struct fw_image_desc sram_desc; - - /* result of ucode download */ - struct alive_command_responce dino_alive; - - wait_queue_head_t wait_command_queue; - wait_queue_head_t wait_state; - - /* Rx and Tx DMA processing queues */ - struct ipw_rx_queue *rxq; - struct clx2_tx_queue txq_cmd; - struct clx2_tx_queue txq[4]; - u32 status; - u32 config; - u32 capability; - - struct average average_missed_beacons; - s16 exp_avg_rssi; - s16 exp_avg_noise; - u32 port_type; - int rx_bufs_min; /**< minimum number of bufs in Rx queue */ - int rx_pend_max; /**< maximum pending buffers for one IRQ */ - u32 hcmd_seq; /**< sequence number for hcmd */ - u32 disassociate_threshold; - u32 roaming_threshold; - - struct ipw_associate assoc_request; - struct libipw_network *assoc_network; - - unsigned long ts_scan_abort; - struct ipw_supported_rates rates; - struct ipw_rates phy[3]; /**< PHY restrictions, per band */ - struct ipw_rates supp; /**< software defined */ - struct ipw_rates extended; /**< use for corresp. IE, AP only */ - - struct notif_link_deterioration last_link_deterioration; /** for statistics */ - struct ipw_cmd *hcmd; /**< host command currently executed */ - - wait_queue_head_t hcmd_wq; /**< host command waits for execution */ - u32 tsf_bcn[2]; /**< TSF from latest beacon */ - - struct notif_calibration calib; /**< last calibration */ - - /* ordinal interface with firmware */ - u32 table0_addr; - u32 table0_len; - u32 table1_addr; - u32 table1_len; - u32 table2_addr; - u32 table2_len; - - /* context information */ - u8 essid[IW_ESSID_MAX_SIZE]; - u8 essid_len; - u8 nick[IW_ESSID_MAX_SIZE]; - u16 rates_mask; - u8 channel; - struct ipw_sys_config sys_config; - u32 power_mode; - u8 bssid[ETH_ALEN]; - u16 rts_threshold; - u8 mac_addr[ETH_ALEN]; - u8 num_stations; - u8 stations[MAX_STATIONS][ETH_ALEN]; - u8 short_retry_limit; - u8 long_retry_limit; - - u32 notif_missed_beacons; - - /* Statistics and counters normalized with each association */ - u32 last_missed_beacons; - u32 last_tx_packets; - u32 last_rx_packets; - u32 last_tx_failures; - u32 last_rx_err; - u32 last_rate; - - u32 missed_adhoc_beacons; - u32 missed_beacons; - u32 rx_packets; - u32 tx_packets; - u32 quality; - - u8 speed_scan[MAX_SPEED_SCAN]; - u8 speed_scan_pos; - - u16 last_seq_num; - u16 last_frag_num; - unsigned long last_packet_time; - struct list_head ibss_mac_hash[IPW_IBSS_MAC_HASH_SIZE]; - - /* eeprom */ - u8 eeprom[0x100]; /* 256 bytes of eeprom */ - u8 country[4]; - int eeprom_delay; - - struct iw_statistics wstats; - - struct iw_public_data wireless_data; - - int user_requested_scan; - u8 direct_scan_ssid[IW_ESSID_MAX_SIZE]; - u8 direct_scan_ssid_len; - - struct delayed_work adhoc_check; - struct work_struct associate; - struct work_struct disassociate; - struct work_struct system_config; - struct work_struct rx_replenish; - struct delayed_work request_scan; - struct delayed_work request_direct_scan; - struct delayed_work request_passive_scan; - struct delayed_work scan_event; - struct work_struct adapter_restart; - struct delayed_work rf_kill; - struct work_struct up; - struct work_struct down; - struct delayed_work gather_stats; - struct work_struct abort_scan; - struct work_struct roam; - struct delayed_work scan_check; - struct work_struct link_up; - struct work_struct link_down; - - struct tasklet_struct irq_tasklet; - - /* LED related variables and work_struct */ - u8 nic_type; - u32 led_activity_on; - u32 led_activity_off; - u32 led_association_on; - u32 led_association_off; - u32 led_ofdm_on; - u32 led_ofdm_off; - - struct delayed_work led_link_on; - struct delayed_work led_link_off; - struct delayed_work led_act_off; - struct work_struct merge_networks; - - struct ipw_cmd_log *cmdlog; - int cmdlog_len; - int cmdlog_pos; - -#define IPW_2200BG 1 -#define IPW_2915ABG 2 - u8 adapter; - - s8 tx_power; - - /* Track time in suspend */ - unsigned long suspend_at; - unsigned long suspend_time; - -#ifdef CONFIG_PM - u32 pm_state[16]; -#endif - - struct ipw_fw_error *error; - - /* network state */ - - /* Used to pass the current INTA value from ISR to Tasklet */ - u32 isr_inta; - - /* QoS */ - struct ipw_qos_info qos_data; - struct work_struct qos_activate; - /*********************************/ - - /* debugging info */ - u32 indirect_dword; - u32 direct_dword; - u32 indirect_byte; -}; /*ipw_priv */ - -/* debug macros */ - -/* Debug and printf string expansion helpers for printing bitfields */ -#define BIT_FMT8 "%c%c%c%c-%c%c%c%c" -#define BIT_FMT16 BIT_FMT8 ":" BIT_FMT8 -#define BIT_FMT32 BIT_FMT16 " " BIT_FMT16 - -#define BITC(x,y) (((x>>y)&1)?'1':'0') -#define BIT_ARG8(x) \ -BITC(x,7),BITC(x,6),BITC(x,5),BITC(x,4),\ -BITC(x,3),BITC(x,2),BITC(x,1),BITC(x,0) - -#define BIT_ARG16(x) \ -BITC(x,15),BITC(x,14),BITC(x,13),BITC(x,12),\ -BITC(x,11),BITC(x,10),BITC(x,9),BITC(x,8),\ -BIT_ARG8(x) - -#define BIT_ARG32(x) \ -BITC(x,31),BITC(x,30),BITC(x,29),BITC(x,28),\ -BITC(x,27),BITC(x,26),BITC(x,25),BITC(x,24),\ -BITC(x,23),BITC(x,22),BITC(x,21),BITC(x,20),\ -BITC(x,19),BITC(x,18),BITC(x,17),BITC(x,16),\ -BIT_ARG16(x) - - -#define IPW_DEBUG(level, fmt, args...) \ -do { if (ipw_debug_level & (level)) \ - printk(KERN_DEBUG DRV_NAME": %c %s " fmt, \ - in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0) - -#ifdef CONFIG_IPW2200_DEBUG -#define IPW_LL_DEBUG(level, fmt, args...) \ -do { if (ipw_debug_level & (level)) \ - printk(KERN_DEBUG DRV_NAME": %c %s " fmt, \ - in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0) -#else -#define IPW_LL_DEBUG(level, fmt, args...) do {} while (0) -#endif /* CONFIG_IPW2200_DEBUG */ - -/* - * To use the debug system; - * - * If you are defining a new debug classification, simply add it to the #define - * list here in the form of: - * - * #define IPW_DL_xxxx VALUE - * - * shifting value to the left one bit from the previous entry. xxxx should be - * the name of the classification (for example, WEP) - * - * You then need to either add a IPW_xxxx_DEBUG() macro definition for your - * classification, or use IPW_DEBUG(IPW_DL_xxxx, ...) whenever you want - * to send output to that classification. - * - * To add your debug level to the list of levels seen when you perform - * - * % cat /proc/net/ipw/debug_level - * - * you simply need to add your entry to the ipw_debug_levels array. - * - * If you do not see debug_level in /proc/net/ipw then you do not have - * CONFIG_IPW2200_DEBUG defined in your kernel configuration - * - */ - -#define IPW_DL_ERROR (1<<0) -#define IPW_DL_WARNING (1<<1) -#define IPW_DL_INFO (1<<2) -#define IPW_DL_WX (1<<3) -#define IPW_DL_HOST_COMMAND (1<<5) -#define IPW_DL_STATE (1<<6) - -#define IPW_DL_NOTIF (1<<10) -#define IPW_DL_SCAN (1<<11) -#define IPW_DL_ASSOC (1<<12) -#define IPW_DL_DROP (1<<13) -#define IPW_DL_IOCTL (1<<14) - -#define IPW_DL_MANAGE (1<<15) -#define IPW_DL_FW (1<<16) -#define IPW_DL_RF_KILL (1<<17) -#define IPW_DL_FW_ERRORS (1<<18) - -#define IPW_DL_LED (1<<19) - -#define IPW_DL_ORD (1<<20) - -#define IPW_DL_FRAG (1<<21) -#define IPW_DL_WEP (1<<22) -#define IPW_DL_TX (1<<23) -#define IPW_DL_RX (1<<24) -#define IPW_DL_ISR (1<<25) -#define IPW_DL_FW_INFO (1<<26) -#define IPW_DL_IO (1<<27) -#define IPW_DL_TRACE (1<<28) - -#define IPW_DL_STATS (1<<29) -#define IPW_DL_MERGE (1<<30) -#define IPW_DL_QOS (1<<31) - -#define IPW_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a) -#define IPW_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a) -#define IPW_DEBUG_INFO(f, a...) IPW_DEBUG(IPW_DL_INFO, f, ## a) - -#define IPW_DEBUG_WX(f, a...) IPW_DEBUG(IPW_DL_WX, f, ## a) -#define IPW_DEBUG_SCAN(f, a...) IPW_DEBUG(IPW_DL_SCAN, f, ## a) -#define IPW_DEBUG_TRACE(f, a...) IPW_LL_DEBUG(IPW_DL_TRACE, f, ## a) -#define IPW_DEBUG_RX(f, a...) IPW_LL_DEBUG(IPW_DL_RX, f, ## a) -#define IPW_DEBUG_TX(f, a...) IPW_LL_DEBUG(IPW_DL_TX, f, ## a) -#define IPW_DEBUG_ISR(f, a...) IPW_LL_DEBUG(IPW_DL_ISR, f, ## a) -#define IPW_DEBUG_MANAGEMENT(f, a...) IPW_DEBUG(IPW_DL_MANAGE, f, ## a) -#define IPW_DEBUG_LED(f, a...) IPW_LL_DEBUG(IPW_DL_LED, f, ## a) -#define IPW_DEBUG_WEP(f, a...) IPW_LL_DEBUG(IPW_DL_WEP, f, ## a) -#define IPW_DEBUG_HC(f, a...) IPW_LL_DEBUG(IPW_DL_HOST_COMMAND, f, ## a) -#define IPW_DEBUG_FRAG(f, a...) IPW_LL_DEBUG(IPW_DL_FRAG, f, ## a) -#define IPW_DEBUG_FW(f, a...) IPW_LL_DEBUG(IPW_DL_FW, f, ## a) -#define IPW_DEBUG_RF_KILL(f, a...) IPW_DEBUG(IPW_DL_RF_KILL, f, ## a) -#define IPW_DEBUG_DROP(f, a...) IPW_DEBUG(IPW_DL_DROP, f, ## a) -#define IPW_DEBUG_IO(f, a...) IPW_LL_DEBUG(IPW_DL_IO, f, ## a) -#define IPW_DEBUG_ORD(f, a...) IPW_LL_DEBUG(IPW_DL_ORD, f, ## a) -#define IPW_DEBUG_FW_INFO(f, a...) IPW_LL_DEBUG(IPW_DL_FW_INFO, f, ## a) -#define IPW_DEBUG_NOTIF(f, a...) IPW_DEBUG(IPW_DL_NOTIF, f, ## a) -#define IPW_DEBUG_STATE(f, a...) IPW_DEBUG(IPW_DL_STATE | IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) -#define IPW_DEBUG_ASSOC(f, a...) IPW_DEBUG(IPW_DL_ASSOC | IPW_DL_INFO, f, ## a) -#define IPW_DEBUG_STATS(f, a...) IPW_LL_DEBUG(IPW_DL_STATS, f, ## a) -#define IPW_DEBUG_MERGE(f, a...) IPW_LL_DEBUG(IPW_DL_MERGE, f, ## a) -#define IPW_DEBUG_QOS(f, a...) IPW_LL_DEBUG(IPW_DL_QOS, f, ## a) - -#include - -/* -* Register bit definitions -*/ - -#define IPW_INTA_RW 0x00000008 -#define IPW_INTA_MASK_R 0x0000000C -#define IPW_INDIRECT_ADDR 0x00000010 -#define IPW_INDIRECT_DATA 0x00000014 -#define IPW_AUTOINC_ADDR 0x00000018 -#define IPW_AUTOINC_DATA 0x0000001C -#define IPW_RESET_REG 0x00000020 -#define IPW_GP_CNTRL_RW 0x00000024 - -#define IPW_READ_INT_REGISTER 0xFF4 - -#define IPW_GP_CNTRL_BIT_INIT_DONE 0x00000004 - -#define IPW_REGISTER_DOMAIN1_END 0x00001000 -#define IPW_SRAM_READ_INT_REGISTER 0x00000ff4 - -#define IPW_SHARED_LOWER_BOUND 0x00000200 -#define IPW_INTERRUPT_AREA_LOWER_BOUND 0x00000f80 - -#define IPW_NIC_SRAM_LOWER_BOUND 0x00000000 -#define IPW_NIC_SRAM_UPPER_BOUND 0x00030000 - -#define IPW_BIT_INT_HOST_SRAM_READ_INT_REGISTER (1 << 29) -#define IPW_GP_CNTRL_BIT_CLOCK_READY 0x00000001 -#define IPW_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY 0x00000002 - -/* - * RESET Register Bit Indexes - */ -#define CBD_RESET_REG_PRINCETON_RESET (1<<0) -#define IPW_START_STANDBY (1<<2) -#define IPW_ACTIVITY_LED (1<<4) -#define IPW_ASSOCIATED_LED (1<<5) -#define IPW_OFDM_LED (1<<6) -#define IPW_RESET_REG_SW_RESET (1<<7) -#define IPW_RESET_REG_MASTER_DISABLED (1<<8) -#define IPW_RESET_REG_STOP_MASTER (1<<9) -#define IPW_GATE_ODMA (1<<25) -#define IPW_GATE_IDMA (1<<26) -#define IPW_ARC_KESHET_CONFIG (1<<27) -#define IPW_GATE_ADMA (1<<29) - -#define IPW_CSR_CIS_UPPER_BOUND 0x00000200 -#define IPW_DOMAIN_0_END 0x1000 -#define CLX_MEM_BAR_SIZE 0x1000 - -/* Dino/baseband control registers bits */ - -#define DINO_ENABLE_SYSTEM 0x80 /* 1 = baseband processor on, 0 = reset */ -#define DINO_ENABLE_CS 0x40 /* 1 = enable ucode load */ -#define DINO_RXFIFO_DATA 0x01 /* 1 = data available */ -#define IPW_BASEBAND_CONTROL_STATUS 0X00200000 -#define IPW_BASEBAND_TX_FIFO_WRITE 0X00200004 -#define IPW_BASEBAND_RX_FIFO_READ 0X00200004 -#define IPW_BASEBAND_CONTROL_STORE 0X00200010 - -#define IPW_INTERNAL_CMD_EVENT 0X00300004 -#define IPW_BASEBAND_POWER_DOWN 0x00000001 - -#define IPW_MEM_HALT_AND_RESET 0x003000e0 - -/* defgroup bits_halt_reset MEM_HALT_AND_RESET register bits */ -#define IPW_BIT_HALT_RESET_ON 0x80000000 -#define IPW_BIT_HALT_RESET_OFF 0x00000000 - -#define CB_LAST_VALID 0x20000000 -#define CB_INT_ENABLED 0x40000000 -#define CB_VALID 0x80000000 -#define CB_SRC_LE 0x08000000 -#define CB_DEST_LE 0x04000000 -#define CB_SRC_AUTOINC 0x00800000 -#define CB_SRC_IO_GATED 0x00400000 -#define CB_DEST_AUTOINC 0x00080000 -#define CB_SRC_SIZE_LONG 0x00200000 -#define CB_DEST_SIZE_LONG 0x00020000 - -/* DMA DEFINES */ - -#define DMA_CONTROL_SMALL_CB_CONST_VALUE 0x00540000 -#define DMA_CB_STOP_AND_ABORT 0x00000C00 -#define DMA_CB_START 0x00000100 - -#define IPW_SHARED_SRAM_SIZE 0x00030000 -#define IPW_SHARED_SRAM_DMA_CONTROL 0x00027000 -#define CB_MAX_LENGTH 0x1FFF - -#define IPW_HOST_EEPROM_DATA_SRAM_SIZE 0xA18 -#define IPW_EEPROM_IMAGE_SIZE 0x100 - -/* DMA defs */ -#define IPW_DMA_I_CURRENT_CB 0x003000D0 -#define IPW_DMA_O_CURRENT_CB 0x003000D4 -#define IPW_DMA_I_DMA_CONTROL 0x003000A4 -#define IPW_DMA_I_CB_BASE 0x003000A0 - -#define IPW_TX_CMD_QUEUE_BD_BASE 0x00000200 -#define IPW_TX_CMD_QUEUE_BD_SIZE 0x00000204 -#define IPW_TX_QUEUE_0_BD_BASE 0x00000208 -#define IPW_TX_QUEUE_0_BD_SIZE (0x0000020C) -#define IPW_TX_QUEUE_1_BD_BASE 0x00000210 -#define IPW_TX_QUEUE_1_BD_SIZE 0x00000214 -#define IPW_TX_QUEUE_2_BD_BASE 0x00000218 -#define IPW_TX_QUEUE_2_BD_SIZE (0x0000021C) -#define IPW_TX_QUEUE_3_BD_BASE 0x00000220 -#define IPW_TX_QUEUE_3_BD_SIZE 0x00000224 -#define IPW_RX_BD_BASE 0x00000240 -#define IPW_RX_BD_SIZE 0x00000244 -#define IPW_RFDS_TABLE_LOWER 0x00000500 - -#define IPW_TX_CMD_QUEUE_READ_INDEX 0x00000280 -#define IPW_TX_QUEUE_0_READ_INDEX 0x00000284 -#define IPW_TX_QUEUE_1_READ_INDEX 0x00000288 -#define IPW_TX_QUEUE_2_READ_INDEX (0x0000028C) -#define IPW_TX_QUEUE_3_READ_INDEX 0x00000290 -#define IPW_RX_READ_INDEX (0x000002A0) - -#define IPW_TX_CMD_QUEUE_WRITE_INDEX (0x00000F80) -#define IPW_TX_QUEUE_0_WRITE_INDEX (0x00000F84) -#define IPW_TX_QUEUE_1_WRITE_INDEX (0x00000F88) -#define IPW_TX_QUEUE_2_WRITE_INDEX (0x00000F8C) -#define IPW_TX_QUEUE_3_WRITE_INDEX (0x00000F90) -#define IPW_RX_WRITE_INDEX (0x00000FA0) - -/* - * EEPROM Related Definitions - */ - -#define IPW_EEPROM_DATA_SRAM_ADDRESS (IPW_SHARED_LOWER_BOUND + 0x814) -#define IPW_EEPROM_DATA_SRAM_SIZE (IPW_SHARED_LOWER_BOUND + 0x818) -#define IPW_EEPROM_LOAD_DISABLE (IPW_SHARED_LOWER_BOUND + 0x81C) -#define IPW_EEPROM_DATA (IPW_SHARED_LOWER_BOUND + 0x820) -#define IPW_EEPROM_UPPER_ADDRESS (IPW_SHARED_LOWER_BOUND + 0x9E0) - -#define IPW_STATION_TABLE_LOWER (IPW_SHARED_LOWER_BOUND + 0xA0C) -#define IPW_STATION_TABLE_UPPER (IPW_SHARED_LOWER_BOUND + 0xB0C) -#define IPW_REQUEST_ATIM (IPW_SHARED_LOWER_BOUND + 0xB0C) -#define IPW_ATIM_SENT (IPW_SHARED_LOWER_BOUND + 0xB10) -#define IPW_WHO_IS_AWAKE (IPW_SHARED_LOWER_BOUND + 0xB14) -#define IPW_DURING_ATIM_WINDOW (IPW_SHARED_LOWER_BOUND + 0xB18) - -#define MSB 1 -#define LSB 0 -#define WORD_TO_BYTE(_word) ((_word) * sizeof(u16)) - -#define GET_EEPROM_ADDR(_wordoffset,_byteoffset) \ - ( WORD_TO_BYTE(_wordoffset) + (_byteoffset) ) - -/* EEPROM access by BYTE */ -#define EEPROM_PME_CAPABILITY (GET_EEPROM_ADDR(0x09,MSB)) /* 1 byte */ -#define EEPROM_MAC_ADDRESS (GET_EEPROM_ADDR(0x21,LSB)) /* 6 byte */ -#define EEPROM_VERSION (GET_EEPROM_ADDR(0x24,MSB)) /* 1 byte */ -#define EEPROM_NIC_TYPE (GET_EEPROM_ADDR(0x25,LSB)) /* 1 byte */ -#define EEPROM_SKU_CAPABILITY (GET_EEPROM_ADDR(0x25,MSB)) /* 1 byte */ -#define EEPROM_COUNTRY_CODE (GET_EEPROM_ADDR(0x26,LSB)) /* 3 bytes */ -#define EEPROM_IBSS_CHANNELS_BG (GET_EEPROM_ADDR(0x28,LSB)) /* 2 bytes */ -#define EEPROM_IBSS_CHANNELS_A (GET_EEPROM_ADDR(0x29,MSB)) /* 5 bytes */ -#define EEPROM_BSS_CHANNELS_BG (GET_EEPROM_ADDR(0x2c,LSB)) /* 2 bytes */ -#define EEPROM_HW_VERSION (GET_EEPROM_ADDR(0x72,LSB)) /* 2 bytes */ - -/* NIC type as found in the one byte EEPROM_NIC_TYPE offset */ -#define EEPROM_NIC_TYPE_0 0 -#define EEPROM_NIC_TYPE_1 1 -#define EEPROM_NIC_TYPE_2 2 -#define EEPROM_NIC_TYPE_3 3 -#define EEPROM_NIC_TYPE_4 4 - -/* Bluetooth Coexistence capabilities as found in EEPROM_SKU_CAPABILITY */ -#define EEPROM_SKU_CAP_BT_CHANNEL_SIG 0x01 /* we can tell BT our channel # */ -#define EEPROM_SKU_CAP_BT_PRIORITY 0x02 /* BT can take priority over us */ -#define EEPROM_SKU_CAP_BT_OOB 0x04 /* we can signal BT out-of-band */ - -#define FW_MEM_REG_LOWER_BOUND 0x00300000 -#define FW_MEM_REG_EEPROM_ACCESS (FW_MEM_REG_LOWER_BOUND + 0x40) -#define IPW_EVENT_REG (FW_MEM_REG_LOWER_BOUND + 0x04) -#define EEPROM_BIT_SK (1<<0) -#define EEPROM_BIT_CS (1<<1) -#define EEPROM_BIT_DI (1<<2) -#define EEPROM_BIT_DO (1<<4) - -#define EEPROM_CMD_READ 0x2 - -/* Interrupts masks */ -#define IPW_INTA_NONE 0x00000000 - -#define IPW_INTA_BIT_RX_TRANSFER 0x00000002 -#define IPW_INTA_BIT_STATUS_CHANGE 0x00000010 -#define IPW_INTA_BIT_BEACON_PERIOD_EXPIRED 0x00000020 - -//Inta Bits for CF -#define IPW_INTA_BIT_TX_CMD_QUEUE 0x00000800 -#define IPW_INTA_BIT_TX_QUEUE_1 0x00001000 -#define IPW_INTA_BIT_TX_QUEUE_2 0x00002000 -#define IPW_INTA_BIT_TX_QUEUE_3 0x00004000 -#define IPW_INTA_BIT_TX_QUEUE_4 0x00008000 - -#define IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE 0x00010000 - -#define IPW_INTA_BIT_PREPARE_FOR_POWER_DOWN 0x00100000 -#define IPW_INTA_BIT_POWER_DOWN 0x00200000 - -#define IPW_INTA_BIT_FW_INITIALIZATION_DONE 0x01000000 -#define IPW_INTA_BIT_FW_CARD_DISABLE_PHY_OFF_DONE 0x02000000 -#define IPW_INTA_BIT_RF_KILL_DONE 0x04000000 -#define IPW_INTA_BIT_FATAL_ERROR 0x40000000 -#define IPW_INTA_BIT_PARITY_ERROR 0x80000000 - -/* Interrupts enabled at init time. */ -#define IPW_INTA_MASK_ALL \ - (IPW_INTA_BIT_TX_QUEUE_1 | \ - IPW_INTA_BIT_TX_QUEUE_2 | \ - IPW_INTA_BIT_TX_QUEUE_3 | \ - IPW_INTA_BIT_TX_QUEUE_4 | \ - IPW_INTA_BIT_TX_CMD_QUEUE | \ - IPW_INTA_BIT_RX_TRANSFER | \ - IPW_INTA_BIT_FATAL_ERROR | \ - IPW_INTA_BIT_PARITY_ERROR | \ - IPW_INTA_BIT_STATUS_CHANGE | \ - IPW_INTA_BIT_FW_INITIALIZATION_DONE | \ - IPW_INTA_BIT_BEACON_PERIOD_EXPIRED | \ - IPW_INTA_BIT_SLAVE_MODE_HOST_CMD_DONE | \ - IPW_INTA_BIT_PREPARE_FOR_POWER_DOWN | \ - IPW_INTA_BIT_POWER_DOWN | \ - IPW_INTA_BIT_RF_KILL_DONE ) - -/* FW event log definitions */ -#define EVENT_ELEM_SIZE (3 * sizeof(u32)) -#define EVENT_START_OFFSET (1 * sizeof(u32) + 2 * sizeof(u16)) - -/* FW error log definitions */ -#define ERROR_ELEM_SIZE (7 * sizeof(u32)) -#define ERROR_START_OFFSET (1 * sizeof(u32)) - -/* TX power level (dbm) */ -#define IPW_TX_POWER_MIN -12 -#define IPW_TX_POWER_MAX 20 -#define IPW_TX_POWER_DEFAULT IPW_TX_POWER_MAX - -enum { - IPW_FW_ERROR_OK = 0, - IPW_FW_ERROR_FAIL, - IPW_FW_ERROR_MEMORY_UNDERFLOW, - IPW_FW_ERROR_MEMORY_OVERFLOW, - IPW_FW_ERROR_BAD_PARAM, - IPW_FW_ERROR_BAD_CHECKSUM, - IPW_FW_ERROR_NMI_INTERRUPT, - IPW_FW_ERROR_BAD_DATABASE, - IPW_FW_ERROR_ALLOC_FAIL, - IPW_FW_ERROR_DMA_UNDERRUN, - IPW_FW_ERROR_DMA_STATUS, - IPW_FW_ERROR_DINO_ERROR, - IPW_FW_ERROR_EEPROM_ERROR, - IPW_FW_ERROR_SYSASSERT, - IPW_FW_ERROR_FATAL_ERROR -}; - -#define AUTH_OPEN 0 -#define AUTH_SHARED_KEY 1 -#define AUTH_LEAP 2 -#define AUTH_IGNORE 3 - -#define HC_ASSOCIATE 0 -#define HC_REASSOCIATE 1 -#define HC_DISASSOCIATE 2 -#define HC_IBSS_START 3 -#define HC_IBSS_RECONF 4 -#define HC_DISASSOC_QUIET 5 - -#define HC_QOS_SUPPORT_ASSOC cpu_to_le16(0x01) - -#define IPW_RATE_CAPABILITIES 1 -#define IPW_RATE_CONNECT 0 - -/* - * Rate values and masks - */ -#define IPW_TX_RATE_1MB 0x0A -#define IPW_TX_RATE_2MB 0x14 -#define IPW_TX_RATE_5MB 0x37 -#define IPW_TX_RATE_6MB 0x0D -#define IPW_TX_RATE_9MB 0x0F -#define IPW_TX_RATE_11MB 0x6E -#define IPW_TX_RATE_12MB 0x05 -#define IPW_TX_RATE_18MB 0x07 -#define IPW_TX_RATE_24MB 0x09 -#define IPW_TX_RATE_36MB 0x0B -#define IPW_TX_RATE_48MB 0x01 -#define IPW_TX_RATE_54MB 0x03 - -#define IPW_ORD_TABLE_ID_MASK 0x0000FF00 -#define IPW_ORD_TABLE_VALUE_MASK 0x000000FF - -#define IPW_ORD_TABLE_0_MASK 0x0000F000 -#define IPW_ORD_TABLE_1_MASK 0x0000F100 -#define IPW_ORD_TABLE_2_MASK 0x0000F200 -#define IPW_ORD_TABLE_3_MASK 0x0000F300 -#define IPW_ORD_TABLE_4_MASK 0x0000F400 -#define IPW_ORD_TABLE_5_MASK 0x0000F500 -#define IPW_ORD_TABLE_6_MASK 0x0000F600 -#define IPW_ORD_TABLE_7_MASK 0x0000F700 - -/* - * Table 0 Entries (all entries are 32 bits) - */ -enum { - IPW_ORD_STAT_TX_CURR_RATE = IPW_ORD_TABLE_0_MASK + 1, - IPW_ORD_STAT_FRAG_TRESHOLD, - IPW_ORD_STAT_RTS_THRESHOLD, - IPW_ORD_STAT_TX_HOST_REQUESTS, - IPW_ORD_STAT_TX_HOST_COMPLETE, - IPW_ORD_STAT_TX_DIR_DATA, - IPW_ORD_STAT_TX_DIR_DATA_B_1, - IPW_ORD_STAT_TX_DIR_DATA_B_2, - IPW_ORD_STAT_TX_DIR_DATA_B_5_5, - IPW_ORD_STAT_TX_DIR_DATA_B_11, - /* Hole */ - - IPW_ORD_STAT_TX_DIR_DATA_G_1 = IPW_ORD_TABLE_0_MASK + 19, - IPW_ORD_STAT_TX_DIR_DATA_G_2, - IPW_ORD_STAT_TX_DIR_DATA_G_5_5, - IPW_ORD_STAT_TX_DIR_DATA_G_6, - IPW_ORD_STAT_TX_DIR_DATA_G_9, - IPW_ORD_STAT_TX_DIR_DATA_G_11, - IPW_ORD_STAT_TX_DIR_DATA_G_12, - IPW_ORD_STAT_TX_DIR_DATA_G_18, - IPW_ORD_STAT_TX_DIR_DATA_G_24, - IPW_ORD_STAT_TX_DIR_DATA_G_36, - IPW_ORD_STAT_TX_DIR_DATA_G_48, - IPW_ORD_STAT_TX_DIR_DATA_G_54, - IPW_ORD_STAT_TX_NON_DIR_DATA, - IPW_ORD_STAT_TX_NON_DIR_DATA_B_1, - IPW_ORD_STAT_TX_NON_DIR_DATA_B_2, - IPW_ORD_STAT_TX_NON_DIR_DATA_B_5_5, - IPW_ORD_STAT_TX_NON_DIR_DATA_B_11, - /* Hole */ - - IPW_ORD_STAT_TX_NON_DIR_DATA_G_1 = IPW_ORD_TABLE_0_MASK + 44, - IPW_ORD_STAT_TX_NON_DIR_DATA_G_2, - IPW_ORD_STAT_TX_NON_DIR_DATA_G_5_5, - IPW_ORD_STAT_TX_NON_DIR_DATA_G_6, - IPW_ORD_STAT_TX_NON_DIR_DATA_G_9, - IPW_ORD_STAT_TX_NON_DIR_DATA_G_11, - IPW_ORD_STAT_TX_NON_DIR_DATA_G_12, - IPW_ORD_STAT_TX_NON_DIR_DATA_G_18, - IPW_ORD_STAT_TX_NON_DIR_DATA_G_24, - IPW_ORD_STAT_TX_NON_DIR_DATA_G_36, - IPW_ORD_STAT_TX_NON_DIR_DATA_G_48, - IPW_ORD_STAT_TX_NON_DIR_DATA_G_54, - IPW_ORD_STAT_TX_RETRY, - IPW_ORD_STAT_TX_FAILURE, - IPW_ORD_STAT_RX_ERR_CRC, - IPW_ORD_STAT_RX_ERR_ICV, - IPW_ORD_STAT_RX_NO_BUFFER, - IPW_ORD_STAT_FULL_SCANS, - IPW_ORD_STAT_PARTIAL_SCANS, - IPW_ORD_STAT_TGH_ABORTED_SCANS, - IPW_ORD_STAT_TX_TOTAL_BYTES, - IPW_ORD_STAT_CURR_RSSI_RAW, - IPW_ORD_STAT_RX_BEACON, - IPW_ORD_STAT_MISSED_BEACONS, - IPW_ORD_TABLE_0_LAST -}; - -#define IPW_RSSI_TO_DBM 112 - -/* Table 1 Entries - */ -enum { - IPW_ORD_TABLE_1_LAST = IPW_ORD_TABLE_1_MASK | 1, -}; - -/* - * Table 2 Entries - * - * FW_VERSION: 16 byte string - * FW_DATE: 16 byte string (only 14 bytes used) - * UCODE_VERSION: 4 byte version code - * UCODE_DATE: 5 bytes code code - * ADDAPTER_MAC: 6 byte MAC address - * RTC: 4 byte clock - */ -enum { - IPW_ORD_STAT_FW_VERSION = IPW_ORD_TABLE_2_MASK | 1, - IPW_ORD_STAT_FW_DATE, - IPW_ORD_STAT_UCODE_VERSION, - IPW_ORD_STAT_UCODE_DATE, - IPW_ORD_STAT_ADAPTER_MAC, - IPW_ORD_STAT_RTC, - IPW_ORD_TABLE_2_LAST -}; - -/* Table 3 */ -enum { - IPW_ORD_STAT_TX_PACKET = IPW_ORD_TABLE_3_MASK | 0, - IPW_ORD_STAT_TX_PACKET_FAILURE, - IPW_ORD_STAT_TX_PACKET_SUCCESS, - IPW_ORD_STAT_TX_PACKET_ABORTED, - IPW_ORD_TABLE_3_LAST -}; - -/* Table 4 */ -enum { - IPW_ORD_TABLE_4_LAST = IPW_ORD_TABLE_4_MASK -}; - -/* Table 5 */ -enum { - IPW_ORD_STAT_AVAILABLE_AP_COUNT = IPW_ORD_TABLE_5_MASK, - IPW_ORD_STAT_AP_ASSNS, - IPW_ORD_STAT_ROAM, - IPW_ORD_STAT_ROAM_CAUSE_MISSED_BEACONS, - IPW_ORD_STAT_ROAM_CAUSE_UNASSOC, - IPW_ORD_STAT_ROAM_CAUSE_RSSI, - IPW_ORD_STAT_ROAM_CAUSE_LINK_QUALITY, - IPW_ORD_STAT_ROAM_CAUSE_AP_LOAD_BALANCE, - IPW_ORD_STAT_ROAM_CAUSE_AP_NO_TX, - IPW_ORD_STAT_LINK_UP, - IPW_ORD_STAT_LINK_DOWN, - IPW_ORD_ANTENNA_DIVERSITY, - IPW_ORD_CURR_FREQ, - IPW_ORD_TABLE_5_LAST -}; - -/* Table 6 */ -enum { - IPW_ORD_COUNTRY_CODE = IPW_ORD_TABLE_6_MASK, - IPW_ORD_CURR_BSSID, - IPW_ORD_CURR_SSID, - IPW_ORD_TABLE_6_LAST -}; - -/* Table 7 */ -enum { - IPW_ORD_STAT_PERCENT_MISSED_BEACONS = IPW_ORD_TABLE_7_MASK, - IPW_ORD_STAT_PERCENT_TX_RETRIES, - IPW_ORD_STAT_PERCENT_LINK_QUALITY, - IPW_ORD_STAT_CURR_RSSI_DBM, - IPW_ORD_TABLE_7_LAST -}; - -#define IPW_ERROR_LOG (IPW_SHARED_LOWER_BOUND + 0x410) -#define IPW_EVENT_LOG (IPW_SHARED_LOWER_BOUND + 0x414) -#define IPW_ORDINALS_TABLE_LOWER (IPW_SHARED_LOWER_BOUND + 0x500) -#define IPW_ORDINALS_TABLE_0 (IPW_SHARED_LOWER_BOUND + 0x180) -#define IPW_ORDINALS_TABLE_1 (IPW_SHARED_LOWER_BOUND + 0x184) -#define IPW_ORDINALS_TABLE_2 (IPW_SHARED_LOWER_BOUND + 0x188) -#define IPW_MEM_FIXED_OVERRIDE (IPW_SHARED_LOWER_BOUND + 0x41C) - -struct ipw_fixed_rate { - __le16 tx_rates; - __le16 reserved; -} __packed; - -#define IPW_INDIRECT_ADDR_MASK (~0x3ul) - -struct host_cmd { - u8 cmd; - u8 len; - u16 reserved; - u32 *param; -} __packed; /* XXX */ - -struct cmdlog_host_cmd { - u8 cmd; - u8 len; - __le16 reserved; - char param[124]; -} __packed; - -struct ipw_cmd_log { - unsigned long jiffies; - int retcode; - struct cmdlog_host_cmd cmd; -}; - -/* SysConfig command parameters ... */ -/* bt_coexistence param */ -#define CFG_BT_COEXISTENCE_SIGNAL_CHNL 0x01 /* tell BT our chnl # */ -#define CFG_BT_COEXISTENCE_DEFER 0x02 /* defer our Tx if BT traffic */ -#define CFG_BT_COEXISTENCE_KILL 0x04 /* kill our Tx if BT traffic */ -#define CFG_BT_COEXISTENCE_WME_OVER_BT 0x08 /* multimedia extensions */ -#define CFG_BT_COEXISTENCE_OOB 0x10 /* signal BT via out-of-band */ - -/* clear-to-send to self param */ -#define CFG_CTS_TO_ITSELF_ENABLED_MIN 0x00 -#define CFG_CTS_TO_ITSELF_ENABLED_MAX 0x01 -#define CFG_CTS_TO_ITSELF_ENABLED_DEF CFG_CTS_TO_ITSELF_ENABLED_MIN - -/* Antenna diversity param (h/w can select best antenna, based on signal) */ -#define CFG_SYS_ANTENNA_BOTH 0x00 /* NIC selects best antenna */ -#define CFG_SYS_ANTENNA_A 0x01 /* force antenna A */ -#define CFG_SYS_ANTENNA_B 0x03 /* force antenna B */ -#define CFG_SYS_ANTENNA_SLOW_DIV 0x02 /* consider background noise */ - -#define IPW_MAX_CONFIG_RETRIES 10 - -#endif /* __ipw2200_h__ */ diff --git a/drivers/net/wireless/ipw2x00/libipw.h b/drivers/net/wireless/ipw2x00/libipw.h deleted file mode 100644 index 6eede52ad8c0..000000000000 --- a/drivers/net/wireless/ipw2x00/libipw.h +++ /dev/null @@ -1,1024 +0,0 @@ -/* - * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11 - * remains copyright by the original authors - * - * Portions of the merged code are based on Host AP (software wireless - * LAN access point) driver for Intersil Prism2/2.5/3. - * - * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen - * - * Copyright (c) 2002-2003, Jouni Malinen - * - * Adaption to a generic IEEE 802.11 stack by James Ketrenos - * - * Copyright (c) 2004-2005, Intel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. - * - * API Version History - * 1.0.x -- Initial version - * 1.1.x -- Added radiotap, QoS, TIM, libipw_geo APIs, - * various structure changes, and crypto API init method - */ -#ifndef LIBIPW_H -#define LIBIPW_H -#include /* ETH_ALEN */ -#include /* ARRAY_SIZE */ -#include -#include - -#include -#include - -#define LIBIPW_VERSION "git-1.1.13" - -#define LIBIPW_DATA_LEN 2304 -/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section - 6.2.1.1.2. - - The figure in section 7.1.2 suggests a body size of up to 2312 - bytes is allowed, which is a bit confusing, I suspect this - represents the 2304 bytes of real data, plus a possible 8 bytes of - WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ - -#define LIBIPW_1ADDR_LEN 10 -#define LIBIPW_2ADDR_LEN 16 -#define LIBIPW_3ADDR_LEN 24 -#define LIBIPW_4ADDR_LEN 30 -#define LIBIPW_FCS_LEN 4 -#define LIBIPW_HLEN (LIBIPW_4ADDR_LEN) -#define LIBIPW_FRAME_LEN (LIBIPW_DATA_LEN + LIBIPW_HLEN) - -#define MIN_FRAG_THRESHOLD 256U -#define MAX_FRAG_THRESHOLD 2346U - -/* QOS control */ -#define LIBIPW_QCTL_TID 0x000F - -/* debug macros */ - -#ifdef CONFIG_LIBIPW_DEBUG -extern u32 libipw_debug_level; -#define LIBIPW_DEBUG(level, fmt, args...) \ -do { if (libipw_debug_level & (level)) \ - printk(KERN_DEBUG "libipw: %c %s " fmt, \ - in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0) -#else -#define LIBIPW_DEBUG(level, fmt, args...) do {} while (0) -#endif /* CONFIG_LIBIPW_DEBUG */ - -/* - * To use the debug system: - * - * If you are defining a new debug classification, simply add it to the #define - * list here in the form of: - * - * #define LIBIPW_DL_xxxx VALUE - * - * shifting value to the left one bit from the previous entry. xxxx should be - * the name of the classification (for example, WEP) - * - * You then need to either add a LIBIPW_xxxx_DEBUG() macro definition for your - * classification, or use LIBIPW_DEBUG(LIBIPW_DL_xxxx, ...) whenever you want - * to send output to that classification. - * - * To add your debug level to the list of levels seen when you perform - * - * % cat /proc/net/ieee80211/debug_level - * - * you simply need to add your entry to the libipw_debug_level array. - * - * If you do not see debug_level in /proc/net/ieee80211 then you do not have - * CONFIG_LIBIPW_DEBUG defined in your kernel configuration - * - */ - -#define LIBIPW_DL_INFO (1<<0) -#define LIBIPW_DL_WX (1<<1) -#define LIBIPW_DL_SCAN (1<<2) -#define LIBIPW_DL_STATE (1<<3) -#define LIBIPW_DL_MGMT (1<<4) -#define LIBIPW_DL_FRAG (1<<5) -#define LIBIPW_DL_DROP (1<<7) - -#define LIBIPW_DL_TX (1<<8) -#define LIBIPW_DL_RX (1<<9) -#define LIBIPW_DL_QOS (1<<31) - -#define LIBIPW_ERROR(f, a...) printk(KERN_ERR "libipw: " f, ## a) -#define LIBIPW_WARNING(f, a...) printk(KERN_WARNING "libipw: " f, ## a) -#define LIBIPW_DEBUG_INFO(f, a...) LIBIPW_DEBUG(LIBIPW_DL_INFO, f, ## a) - -#define LIBIPW_DEBUG_WX(f, a...) LIBIPW_DEBUG(LIBIPW_DL_WX, f, ## a) -#define LIBIPW_DEBUG_SCAN(f, a...) LIBIPW_DEBUG(LIBIPW_DL_SCAN, f, ## a) -#define LIBIPW_DEBUG_STATE(f, a...) LIBIPW_DEBUG(LIBIPW_DL_STATE, f, ## a) -#define LIBIPW_DEBUG_MGMT(f, a...) LIBIPW_DEBUG(LIBIPW_DL_MGMT, f, ## a) -#define LIBIPW_DEBUG_FRAG(f, a...) LIBIPW_DEBUG(LIBIPW_DL_FRAG, f, ## a) -#define LIBIPW_DEBUG_DROP(f, a...) LIBIPW_DEBUG(LIBIPW_DL_DROP, f, ## a) -#define LIBIPW_DEBUG_TX(f, a...) LIBIPW_DEBUG(LIBIPW_DL_TX, f, ## a) -#define LIBIPW_DEBUG_RX(f, a...) LIBIPW_DEBUG(LIBIPW_DL_RX, f, ## a) -#define LIBIPW_DEBUG_QOS(f, a...) LIBIPW_DEBUG(LIBIPW_DL_QOS, f, ## a) -#include -#include /* ARPHRD_ETHER */ - -#ifndef WIRELESS_SPY -#define WIRELESS_SPY /* enable iwspy support */ -#endif -#include /* new driver API */ - -#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */ - -#ifndef ETH_P_80211_RAW -#define ETH_P_80211_RAW (ETH_P_ECONET + 1) -#endif - -/* IEEE 802.11 defines */ - -#define P80211_OUI_LEN 3 - -struct libipw_snap_hdr { - - u8 dsap; /* always 0xAA */ - u8 ssap; /* always 0xAA */ - u8 ctrl; /* always 0x03 */ - u8 oui[P80211_OUI_LEN]; /* organizational universal id */ - -} __packed; - -#define SNAP_SIZE sizeof(struct libipw_snap_hdr) - -#define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS) -#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE) -#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE) - -#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG) -#define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) - -#define LIBIPW_STATMASK_SIGNAL (1<<0) -#define LIBIPW_STATMASK_RSSI (1<<1) -#define LIBIPW_STATMASK_NOISE (1<<2) -#define LIBIPW_STATMASK_RATE (1<<3) -#define LIBIPW_STATMASK_WEMASK 0x7 - -#define LIBIPW_CCK_MODULATION (1<<0) -#define LIBIPW_OFDM_MODULATION (1<<1) - -#define LIBIPW_24GHZ_BAND (1<<0) -#define LIBIPW_52GHZ_BAND (1<<1) - -#define LIBIPW_CCK_RATE_1MB 0x02 -#define LIBIPW_CCK_RATE_2MB 0x04 -#define LIBIPW_CCK_RATE_5MB 0x0B -#define LIBIPW_CCK_RATE_11MB 0x16 -#define LIBIPW_OFDM_RATE_6MB 0x0C -#define LIBIPW_OFDM_RATE_9MB 0x12 -#define LIBIPW_OFDM_RATE_12MB 0x18 -#define LIBIPW_OFDM_RATE_18MB 0x24 -#define LIBIPW_OFDM_RATE_24MB 0x30 -#define LIBIPW_OFDM_RATE_36MB 0x48 -#define LIBIPW_OFDM_RATE_48MB 0x60 -#define LIBIPW_OFDM_RATE_54MB 0x6C -#define LIBIPW_BASIC_RATE_MASK 0x80 - -#define LIBIPW_CCK_RATE_1MB_MASK (1<<0) -#define LIBIPW_CCK_RATE_2MB_MASK (1<<1) -#define LIBIPW_CCK_RATE_5MB_MASK (1<<2) -#define LIBIPW_CCK_RATE_11MB_MASK (1<<3) -#define LIBIPW_OFDM_RATE_6MB_MASK (1<<4) -#define LIBIPW_OFDM_RATE_9MB_MASK (1<<5) -#define LIBIPW_OFDM_RATE_12MB_MASK (1<<6) -#define LIBIPW_OFDM_RATE_18MB_MASK (1<<7) -#define LIBIPW_OFDM_RATE_24MB_MASK (1<<8) -#define LIBIPW_OFDM_RATE_36MB_MASK (1<<9) -#define LIBIPW_OFDM_RATE_48MB_MASK (1<<10) -#define LIBIPW_OFDM_RATE_54MB_MASK (1<<11) - -#define LIBIPW_CCK_RATES_MASK 0x0000000F -#define LIBIPW_CCK_BASIC_RATES_MASK (LIBIPW_CCK_RATE_1MB_MASK | \ - LIBIPW_CCK_RATE_2MB_MASK) -#define LIBIPW_CCK_DEFAULT_RATES_MASK (LIBIPW_CCK_BASIC_RATES_MASK | \ - LIBIPW_CCK_RATE_5MB_MASK | \ - LIBIPW_CCK_RATE_11MB_MASK) - -#define LIBIPW_OFDM_RATES_MASK 0x00000FF0 -#define LIBIPW_OFDM_BASIC_RATES_MASK (LIBIPW_OFDM_RATE_6MB_MASK | \ - LIBIPW_OFDM_RATE_12MB_MASK | \ - LIBIPW_OFDM_RATE_24MB_MASK) -#define LIBIPW_OFDM_DEFAULT_RATES_MASK (LIBIPW_OFDM_BASIC_RATES_MASK | \ - LIBIPW_OFDM_RATE_9MB_MASK | \ - LIBIPW_OFDM_RATE_18MB_MASK | \ - LIBIPW_OFDM_RATE_36MB_MASK | \ - LIBIPW_OFDM_RATE_48MB_MASK | \ - LIBIPW_OFDM_RATE_54MB_MASK) -#define LIBIPW_DEFAULT_RATES_MASK (LIBIPW_OFDM_DEFAULT_RATES_MASK | \ - LIBIPW_CCK_DEFAULT_RATES_MASK) - -#define LIBIPW_NUM_OFDM_RATES 8 -#define LIBIPW_NUM_CCK_RATES 4 -#define LIBIPW_OFDM_SHIFT_MASK_A 4 - -/* NOTE: This data is for statistical purposes; not all hardware provides this - * information for frames received. - * For libipw_rx_mgt, you need to set at least the 'len' parameter. - */ -struct libipw_rx_stats { - u32 mac_time; - s8 rssi; - u8 signal; - u8 noise; - u16 rate; /* in 100 kbps */ - u8 received_channel; - u8 control; - u8 mask; - u8 freq; - u16 len; - u64 tsf; - u32 beacon_time; -}; - -/* IEEE 802.11 requires that STA supports concurrent reception of at least - * three fragmented frames. This define can be increased to support more - * concurrent frames, but it should be noted that each entry can consume about - * 2 kB of RAM and increasing cache size will slow down frame reassembly. */ -#define LIBIPW_FRAG_CACHE_LEN 4 - -struct libipw_frag_entry { - unsigned long first_frag_time; - unsigned int seq; - unsigned int last_frag; - struct sk_buff *skb; - u8 src_addr[ETH_ALEN]; - u8 dst_addr[ETH_ALEN]; -}; - -struct libipw_stats { - unsigned int tx_unicast_frames; - unsigned int tx_multicast_frames; - unsigned int tx_fragments; - unsigned int tx_unicast_octets; - unsigned int tx_multicast_octets; - unsigned int tx_deferred_transmissions; - unsigned int tx_single_retry_frames; - unsigned int tx_multiple_retry_frames; - unsigned int tx_retry_limit_exceeded; - unsigned int tx_discards; - unsigned int rx_unicast_frames; - unsigned int rx_multicast_frames; - unsigned int rx_fragments; - unsigned int rx_unicast_octets; - unsigned int rx_multicast_octets; - unsigned int rx_fcs_errors; - unsigned int rx_discards_no_buffer; - unsigned int tx_discards_wrong_sa; - unsigned int rx_discards_undecryptable; - unsigned int rx_message_in_msg_fragments; - unsigned int rx_message_in_bad_msg_fragments; -}; - -struct libipw_device; - -#define SEC_KEY_1 (1<<0) -#define SEC_KEY_2 (1<<1) -#define SEC_KEY_3 (1<<2) -#define SEC_KEY_4 (1<<3) -#define SEC_ACTIVE_KEY (1<<4) -#define SEC_AUTH_MODE (1<<5) -#define SEC_UNICAST_GROUP (1<<6) -#define SEC_LEVEL (1<<7) -#define SEC_ENABLED (1<<8) -#define SEC_ENCRYPT (1<<9) - -#define SEC_LEVEL_0 0 /* None */ -#define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ -#define SEC_LEVEL_2 2 /* Level 1 + TKIP */ -#define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */ -#define SEC_LEVEL_3 4 /* Level 2 + CCMP */ - -#define SEC_ALG_NONE 0 -#define SEC_ALG_WEP 1 -#define SEC_ALG_TKIP 2 -#define SEC_ALG_CCMP 3 - -#define WEP_KEYS 4 -#define WEP_KEY_LEN 13 -#define SCM_KEY_LEN 32 -#define SCM_TEMPORAL_KEY_LENGTH 16 - -struct libipw_security { - u16 active_key:2, enabled:1, unicast_uses_group:1, encrypt:1; - u8 auth_mode; - u8 encode_alg[WEP_KEYS]; - u8 key_sizes[WEP_KEYS]; - u8 keys[WEP_KEYS][SCM_KEY_LEN]; - u8 level; - u16 flags; -} __packed; - -/* - - 802.11 data frame from AP - - ,-------------------------------------------------------------------. -Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | - |------|------|---------|---------|---------|------|---------|------| -Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | - | | tion | (BSSID) | | | ence | data | | - `-------------------------------------------------------------------' - -Total: 28-2340 bytes - -*/ - -#define BEACON_PROBE_SSID_ID_POSITION 12 - -struct libipw_hdr_1addr { - __le16 frame_ctl; - __le16 duration_id; - u8 addr1[ETH_ALEN]; - u8 payload[0]; -} __packed; - -struct libipw_hdr_2addr { - __le16 frame_ctl; - __le16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 payload[0]; -} __packed; - -struct libipw_hdr_3addr { - __le16 frame_ctl; - __le16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 addr3[ETH_ALEN]; - __le16 seq_ctl; - u8 payload[0]; -} __packed; - -struct libipw_hdr_4addr { - __le16 frame_ctl; - __le16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 addr3[ETH_ALEN]; - __le16 seq_ctl; - u8 addr4[ETH_ALEN]; - u8 payload[0]; -} __packed; - -struct libipw_hdr_3addrqos { - __le16 frame_ctl; - __le16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 addr3[ETH_ALEN]; - __le16 seq_ctl; - u8 payload[0]; - __le16 qos_ctl; -} __packed; - -struct libipw_info_element { - u8 id; - u8 len; - u8 data[0]; -} __packed; - -/* - * These are the data types that can make up management packets - * - u16 auth_algorithm; - u16 auth_sequence; - u16 beacon_interval; - u16 capability; - u8 current_ap[ETH_ALEN]; - u16 listen_interval; - struct { - u16 association_id:14, reserved:2; - } __packed; - u32 time_stamp[2]; - u16 reason; - u16 status; -*/ - -struct libipw_auth { - struct libipw_hdr_3addr header; - __le16 algorithm; - __le16 transaction; - __le16 status; - /* challenge */ - struct libipw_info_element info_element[0]; -} __packed; - -struct libipw_channel_switch { - u8 id; - u8 len; - u8 mode; - u8 channel; - u8 count; -} __packed; - -struct libipw_action { - struct libipw_hdr_3addr header; - u8 category; - u8 action; - union { - struct libipw_action_exchange { - u8 token; - struct libipw_info_element info_element[0]; - } exchange; - struct libipw_channel_switch channel_switch; - - } format; -} __packed; - -struct libipw_disassoc { - struct libipw_hdr_3addr header; - __le16 reason; -} __packed; - -/* Alias deauth for disassoc */ -#define libipw_deauth libipw_disassoc - -struct libipw_probe_request { - struct libipw_hdr_3addr header; - /* SSID, supported rates */ - struct libipw_info_element info_element[0]; -} __packed; - -struct libipw_probe_response { - struct libipw_hdr_3addr header; - __le32 time_stamp[2]; - __le16 beacon_interval; - __le16 capability; - /* SSID, supported rates, FH params, DS params, - * CF params, IBSS params, TIM (if beacon), RSN */ - struct libipw_info_element info_element[0]; -} __packed; - -/* Alias beacon for probe_response */ -#define libipw_beacon libipw_probe_response - -struct libipw_assoc_request { - struct libipw_hdr_3addr header; - __le16 capability; - __le16 listen_interval; - /* SSID, supported rates, RSN */ - struct libipw_info_element info_element[0]; -} __packed; - -struct libipw_reassoc_request { - struct libipw_hdr_3addr header; - __le16 capability; - __le16 listen_interval; - u8 current_ap[ETH_ALEN]; - struct libipw_info_element info_element[0]; -} __packed; - -struct libipw_assoc_response { - struct libipw_hdr_3addr header; - __le16 capability; - __le16 status; - __le16 aid; - /* supported rates */ - struct libipw_info_element info_element[0]; -} __packed; - -struct libipw_txb { - u8 nr_frags; - u8 encrypted; - u8 rts_included; - u8 reserved; - u16 frag_size; - u16 payload_size; - struct sk_buff *fragments[0]; -}; - -/* SWEEP TABLE ENTRIES NUMBER */ -#define MAX_SWEEP_TAB_ENTRIES 42 -#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 -/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs - * only use 8, and then use extended rates for the remaining supported - * rates. Other APs, however, stick all of their supported rates on the - * main rates information element... */ -#define MAX_RATES_LENGTH ((u8)12) -#define MAX_RATES_EX_LENGTH ((u8)16) -#define MAX_NETWORK_COUNT 128 - -#define CRC_LENGTH 4U - -#define MAX_WPA_IE_LEN 64 - -#define NETWORK_HAS_OFDM (1<<1) -#define NETWORK_HAS_CCK (1<<2) - -/* QoS structure */ -#define NETWORK_HAS_QOS_PARAMETERS (1<<3) -#define NETWORK_HAS_QOS_INFORMATION (1<<4) -#define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \ - NETWORK_HAS_QOS_INFORMATION) - -/* 802.11h */ -#define NETWORK_HAS_POWER_CONSTRAINT (1<<5) -#define NETWORK_HAS_CSA (1<<6) -#define NETWORK_HAS_QUIET (1<<7) -#define NETWORK_HAS_IBSS_DFS (1<<8) -#define NETWORK_HAS_TPC_REPORT (1<<9) - -#define NETWORK_HAS_ERP_VALUE (1<<10) - -#define QOS_QUEUE_NUM 4 -#define QOS_OUI_LEN 3 -#define QOS_OUI_TYPE 2 -#define QOS_ELEMENT_ID 221 -#define QOS_OUI_INFO_SUB_TYPE 0 -#define QOS_OUI_PARAM_SUB_TYPE 1 -#define QOS_VERSION_1 1 -#define QOS_AIFSN_MIN_VALUE 2 - -struct libipw_qos_information_element { - u8 elementID; - u8 length; - u8 qui[QOS_OUI_LEN]; - u8 qui_type; - u8 qui_subtype; - u8 version; - u8 ac_info; -} __packed; - -struct libipw_qos_ac_parameter { - u8 aci_aifsn; - u8 ecw_min_max; - __le16 tx_op_limit; -} __packed; - -struct libipw_qos_parameter_info { - struct libipw_qos_information_element info_element; - u8 reserved; - struct libipw_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; -} __packed; - -struct libipw_qos_parameters { - __le16 cw_min[QOS_QUEUE_NUM]; - __le16 cw_max[QOS_QUEUE_NUM]; - u8 aifs[QOS_QUEUE_NUM]; - u8 flag[QOS_QUEUE_NUM]; - __le16 tx_op_limit[QOS_QUEUE_NUM]; -} __packed; - -struct libipw_qos_data { - struct libipw_qos_parameters parameters; - int active; - int supported; - u8 param_count; - u8 old_param_count; -}; - -struct libipw_tim_parameters { - u8 tim_count; - u8 tim_period; -} __packed; - -/*******************************************************/ - -struct libipw_tpc_report { - u8 transmit_power; - u8 link_margin; -} __packed; - -struct libipw_channel_map { - u8 channel; - u8 map; -} __packed; - -struct libipw_ibss_dfs { - struct libipw_info_element ie; - u8 owner[ETH_ALEN]; - u8 recovery_interval; - struct libipw_channel_map channel_map[0]; -}; - -struct libipw_csa { - u8 mode; - u8 channel; - u8 count; -} __packed; - -struct libipw_quiet { - u8 count; - u8 period; - u8 duration; - u8 offset; -} __packed; - -struct libipw_network { - /* These entries are used to identify a unique network */ - u8 bssid[ETH_ALEN]; - u8 channel; - /* Ensure null-terminated for any debug msgs */ - u8 ssid[IW_ESSID_MAX_SIZE + 1]; - u8 ssid_len; - - struct libipw_qos_data qos_data; - - /* These are network statistics */ - struct libipw_rx_stats stats; - u16 capability; - u8 rates[MAX_RATES_LENGTH]; - u8 rates_len; - u8 rates_ex[MAX_RATES_EX_LENGTH]; - u8 rates_ex_len; - unsigned long last_scanned; - u8 mode; - u32 flags; - u32 last_associate; - u32 time_stamp[2]; - u16 beacon_interval; - u16 listen_interval; - u16 atim_window; - u8 erp_value; - u8 wpa_ie[MAX_WPA_IE_LEN]; - size_t wpa_ie_len; - u8 rsn_ie[MAX_WPA_IE_LEN]; - size_t rsn_ie_len; - struct libipw_tim_parameters tim; - - /* 802.11h info */ - - /* Power Constraint - mandatory if spctrm mgmt required */ - u8 power_constraint; - - /* TPC Report - mandatory if spctrm mgmt required */ - struct libipw_tpc_report tpc_report; - - /* IBSS DFS - mandatory if spctrm mgmt required and IBSS - * NOTE: This is variable length and so must be allocated dynamically */ - struct libipw_ibss_dfs *ibss_dfs; - - /* Channel Switch Announcement - optional if spctrm mgmt required */ - struct libipw_csa csa; - - /* Quiet - optional if spctrm mgmt required */ - struct libipw_quiet quiet; - - struct list_head list; -}; - -enum libipw_state { - LIBIPW_UNINITIALIZED = 0, - LIBIPW_INITIALIZED, - LIBIPW_ASSOCIATING, - LIBIPW_ASSOCIATED, - LIBIPW_AUTHENTICATING, - LIBIPW_AUTHENTICATED, - LIBIPW_SHUTDOWN -}; - -#define DEFAULT_MAX_SCAN_AGE (15 * HZ) -#define DEFAULT_FTS 2346 - -#define CFG_LIBIPW_RESERVE_FCS (1<<0) -#define CFG_LIBIPW_COMPUTE_FCS (1<<1) -#define CFG_LIBIPW_RTS (1<<2) - -#define LIBIPW_24GHZ_MIN_CHANNEL 1 -#define LIBIPW_24GHZ_MAX_CHANNEL 14 -#define LIBIPW_24GHZ_CHANNELS (LIBIPW_24GHZ_MAX_CHANNEL - \ - LIBIPW_24GHZ_MIN_CHANNEL + 1) - -#define LIBIPW_52GHZ_MIN_CHANNEL 34 -#define LIBIPW_52GHZ_MAX_CHANNEL 165 -#define LIBIPW_52GHZ_CHANNELS (LIBIPW_52GHZ_MAX_CHANNEL - \ - LIBIPW_52GHZ_MIN_CHANNEL + 1) - -enum { - LIBIPW_CH_PASSIVE_ONLY = (1 << 0), - LIBIPW_CH_80211H_RULES = (1 << 1), - LIBIPW_CH_B_ONLY = (1 << 2), - LIBIPW_CH_NO_IBSS = (1 << 3), - LIBIPW_CH_UNIFORM_SPREADING = (1 << 4), - LIBIPW_CH_RADAR_DETECT = (1 << 5), - LIBIPW_CH_INVALID = (1 << 6), -}; - -struct libipw_channel { - u32 freq; /* in MHz */ - u8 channel; - u8 flags; - u8 max_power; /* in dBm */ -}; - -struct libipw_geo { - u8 name[4]; - u8 bg_channels; - u8 a_channels; - struct libipw_channel bg[LIBIPW_24GHZ_CHANNELS]; - struct libipw_channel a[LIBIPW_52GHZ_CHANNELS]; -}; - -struct libipw_device { - struct net_device *dev; - struct wireless_dev wdev; - struct libipw_security sec; - - /* Bookkeeping structures */ - struct libipw_stats ieee_stats; - - struct libipw_geo geo; - struct ieee80211_supported_band bg_band; - struct ieee80211_supported_band a_band; - - /* Probe / Beacon management */ - struct list_head network_free_list; - struct list_head network_list; - struct libipw_network *networks[MAX_NETWORK_COUNT]; - int scans; - int scan_age; - - int iw_mode; /* operating mode (IW_MODE_*) */ - struct iw_spy_data spy_data; /* iwspy support */ - - spinlock_t lock; - - int tx_headroom; /* Set to size of any additional room needed at front - * of allocated Tx SKBs */ - u32 config; - - /* WEP and other encryption related settings at the device level */ - int open_wep; /* Set to 1 to allow unencrypted frames */ - - /* If the host performs {en,de}cryption, then set to 1 */ - int host_encrypt; - int host_encrypt_msdu; - int host_decrypt; - /* host performs multicast decryption */ - int host_mc_decrypt; - - /* host should strip IV and ICV from protected frames */ - /* meaningful only when hardware decryption is being used */ - int host_strip_iv_icv; - - int host_open_frag; - int ieee802_1x; /* is IEEE 802.1X used */ - - /* WPA data */ - int wpa_enabled; - int drop_unencrypted; - int privacy_invoked; - size_t wpa_ie_len; - u8 *wpa_ie; - - struct lib80211_crypt_info crypt_info; - - int bcrx_sta_key; /* use individual keys to override default keys even - * with RX of broad/multicast frames */ - - /* Fragmentation structures */ - struct libipw_frag_entry frag_cache[LIBIPW_FRAG_CACHE_LEN]; - unsigned int frag_next_idx; - u16 fts; /* Fragmentation Threshold */ - u16 rts; /* RTS threshold */ - - /* Association info */ - u8 bssid[ETH_ALEN]; - - enum libipw_state state; - - int mode; /* A, B, G */ - int modulation; /* CCK, OFDM */ - int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ - int abg_true; /* ABG flag */ - - int perfect_rssi; - int worst_rssi; - - u16 prev_seq_ctl; /* used to drop duplicate frames */ - - /* Callback functions */ - void (*set_security) (struct net_device * dev, - struct libipw_security * sec); - netdev_tx_t (*hard_start_xmit) (struct libipw_txb * txb, - struct net_device * dev, int pri); - int (*is_queue_full) (struct net_device * dev, int pri); - - int (*handle_management) (struct net_device * dev, - struct libipw_network * network, u16 type); - int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb); - - /* Typical STA methods */ - int (*handle_auth) (struct net_device * dev, - struct libipw_auth * auth); - int (*handle_deauth) (struct net_device * dev, - struct libipw_deauth * auth); - int (*handle_action) (struct net_device * dev, - struct libipw_action * action, - struct libipw_rx_stats * stats); - int (*handle_disassoc) (struct net_device * dev, - struct libipw_disassoc * assoc); - int (*handle_beacon) (struct net_device * dev, - struct libipw_beacon * beacon, - struct libipw_network * network); - int (*handle_probe_response) (struct net_device * dev, - struct libipw_probe_response * resp, - struct libipw_network * network); - int (*handle_probe_request) (struct net_device * dev, - struct libipw_probe_request * req, - struct libipw_rx_stats * stats); - int (*handle_assoc_response) (struct net_device * dev, - struct libipw_assoc_response * resp, - struct libipw_network * network); - - /* Typical AP methods */ - int (*handle_assoc_request) (struct net_device * dev); - int (*handle_reassoc_request) (struct net_device * dev, - struct libipw_reassoc_request * req); - - /* This must be the last item so that it points to the data - * allocated beyond this structure by alloc_libipw */ - u8 priv[0]; -}; - -#define IEEE_A (1<<0) -#define IEEE_B (1<<1) -#define IEEE_G (1<<2) -#define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) - -static inline void *libipw_priv(struct net_device *dev) -{ - return ((struct libipw_device *)netdev_priv(dev))->priv; -} - -static inline int libipw_is_valid_mode(struct libipw_device *ieee, - int mode) -{ - /* - * It is possible for both access points and our device to support - * combinations of modes, so as long as there is one valid combination - * of ap/device supported modes, then return success - * - */ - if ((mode & IEEE_A) && - (ieee->modulation & LIBIPW_OFDM_MODULATION) && - (ieee->freq_band & LIBIPW_52GHZ_BAND)) - return 1; - - if ((mode & IEEE_G) && - (ieee->modulation & LIBIPW_OFDM_MODULATION) && - (ieee->freq_band & LIBIPW_24GHZ_BAND)) - return 1; - - if ((mode & IEEE_B) && - (ieee->modulation & LIBIPW_CCK_MODULATION) && - (ieee->freq_band & LIBIPW_24GHZ_BAND)) - return 1; - - return 0; -} - -static inline int libipw_get_hdrlen(u16 fc) -{ - int hdrlen = LIBIPW_3ADDR_LEN; - u16 stype = WLAN_FC_GET_STYPE(fc); - - switch (WLAN_FC_GET_TYPE(fc)) { - case IEEE80211_FTYPE_DATA: - if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) - hdrlen = LIBIPW_4ADDR_LEN; - if (stype & IEEE80211_STYPE_QOS_DATA) - hdrlen += 2; - break; - case IEEE80211_FTYPE_CTL: - switch (WLAN_FC_GET_STYPE(fc)) { - case IEEE80211_STYPE_CTS: - case IEEE80211_STYPE_ACK: - hdrlen = LIBIPW_1ADDR_LEN; - break; - default: - hdrlen = LIBIPW_2ADDR_LEN; - break; - } - break; - } - - return hdrlen; -} - -static inline u8 *libipw_get_payload(struct ieee80211_hdr *hdr) -{ - switch (libipw_get_hdrlen(le16_to_cpu(hdr->frame_control))) { - case LIBIPW_1ADDR_LEN: - return ((struct libipw_hdr_1addr *)hdr)->payload; - case LIBIPW_2ADDR_LEN: - return ((struct libipw_hdr_2addr *)hdr)->payload; - case LIBIPW_3ADDR_LEN: - return ((struct libipw_hdr_3addr *)hdr)->payload; - case LIBIPW_4ADDR_LEN: - return ((struct libipw_hdr_4addr *)hdr)->payload; - } - return NULL; -} - -static inline int libipw_is_ofdm_rate(u8 rate) -{ - switch (rate & ~LIBIPW_BASIC_RATE_MASK) { - case LIBIPW_OFDM_RATE_6MB: - case LIBIPW_OFDM_RATE_9MB: - case LIBIPW_OFDM_RATE_12MB: - case LIBIPW_OFDM_RATE_18MB: - case LIBIPW_OFDM_RATE_24MB: - case LIBIPW_OFDM_RATE_36MB: - case LIBIPW_OFDM_RATE_48MB: - case LIBIPW_OFDM_RATE_54MB: - return 1; - } - return 0; -} - -static inline int libipw_is_cck_rate(u8 rate) -{ - switch (rate & ~LIBIPW_BASIC_RATE_MASK) { - case LIBIPW_CCK_RATE_1MB: - case LIBIPW_CCK_RATE_2MB: - case LIBIPW_CCK_RATE_5MB: - case LIBIPW_CCK_RATE_11MB: - return 1; - } - return 0; -} - -/* libipw.c */ -extern void free_libipw(struct net_device *dev, int monitor); -extern struct net_device *alloc_libipw(int sizeof_priv, int monitor); -extern int libipw_change_mtu(struct net_device *dev, int new_mtu); - -extern void libipw_networks_age(struct libipw_device *ieee, - unsigned long age_secs); - -extern int libipw_set_encryption(struct libipw_device *ieee); - -/* libipw_tx.c */ -extern netdev_tx_t libipw_xmit(struct sk_buff *skb, - struct net_device *dev); -extern void libipw_txb_free(struct libipw_txb *); - -/* libipw_rx.c */ -extern void libipw_rx_any(struct libipw_device *ieee, - struct sk_buff *skb, struct libipw_rx_stats *stats); -extern int libipw_rx(struct libipw_device *ieee, struct sk_buff *skb, - struct libipw_rx_stats *rx_stats); -/* make sure to set stats->len */ -extern void libipw_rx_mgt(struct libipw_device *ieee, - struct libipw_hdr_4addr *header, - struct libipw_rx_stats *stats); -extern void libipw_network_reset(struct libipw_network *network); - -/* libipw_geo.c */ -extern const struct libipw_geo *libipw_get_geo(struct libipw_device - *ieee); -extern void libipw_set_geo(struct libipw_device *ieee, - const struct libipw_geo *geo); - -extern int libipw_is_valid_channel(struct libipw_device *ieee, - u8 channel); -extern int libipw_channel_to_index(struct libipw_device *ieee, - u8 channel); -extern u8 libipw_freq_to_channel(struct libipw_device *ieee, u32 freq); -extern u8 libipw_get_channel_flags(struct libipw_device *ieee, - u8 channel); -extern const struct libipw_channel *libipw_get_channel(struct - libipw_device - *ieee, u8 channel); -extern u32 libipw_channel_to_freq(struct libipw_device * ieee, - u8 channel); - -/* libipw_wx.c */ -extern int libipw_wx_get_scan(struct libipw_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key); -extern int libipw_wx_set_encode(struct libipw_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key); -extern int libipw_wx_get_encode(struct libipw_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *key); -extern int libipw_wx_set_encodeext(struct libipw_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); -extern int libipw_wx_get_encodeext(struct libipw_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); - -static inline void libipw_increment_scans(struct libipw_device *ieee) -{ - ieee->scans++; -} - -static inline int libipw_get_scans(struct libipw_device *ieee) -{ - return ieee->scans; -} - -#endif /* LIBIPW_H */ diff --git a/drivers/net/wireless/ipw2x00/libipw_geo.c b/drivers/net/wireless/ipw2x00/libipw_geo.c deleted file mode 100644 index 218f2a32de21..000000000000 --- a/drivers/net/wireless/ipw2x00/libipw_geo.c +++ /dev/null @@ -1,193 +0,0 @@ -/****************************************************************************** - - Copyright(c) 2005 Intel 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., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - - Contact Information: - Intel Linux Wireless - Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - -******************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libipw.h" - -int libipw_is_valid_channel(struct libipw_device *ieee, u8 channel) -{ - int i; - - /* Driver needs to initialize the geography map before using - * these helper functions */ - if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0) - return 0; - - if (ieee->freq_band & LIBIPW_24GHZ_BAND) - for (i = 0; i < ieee->geo.bg_channels; i++) - /* NOTE: If G mode is currently supported but - * this is a B only channel, we don't see it - * as valid. */ - if ((ieee->geo.bg[i].channel == channel) && - !(ieee->geo.bg[i].flags & LIBIPW_CH_INVALID) && - (!(ieee->mode & IEEE_G) || - !(ieee->geo.bg[i].flags & LIBIPW_CH_B_ONLY))) - return LIBIPW_24GHZ_BAND; - - if (ieee->freq_band & LIBIPW_52GHZ_BAND) - for (i = 0; i < ieee->geo.a_channels; i++) - if ((ieee->geo.a[i].channel == channel) && - !(ieee->geo.a[i].flags & LIBIPW_CH_INVALID)) - return LIBIPW_52GHZ_BAND; - - return 0; -} - -int libipw_channel_to_index(struct libipw_device *ieee, u8 channel) -{ - int i; - - /* Driver needs to initialize the geography map before using - * these helper functions */ - if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0) - return -1; - - if (ieee->freq_band & LIBIPW_24GHZ_BAND) - for (i = 0; i < ieee->geo.bg_channels; i++) - if (ieee->geo.bg[i].channel == channel) - return i; - - if (ieee->freq_band & LIBIPW_52GHZ_BAND) - for (i = 0; i < ieee->geo.a_channels; i++) - if (ieee->geo.a[i].channel == channel) - return i; - - return -1; -} - -u32 libipw_channel_to_freq(struct libipw_device * ieee, u8 channel) -{ - const struct libipw_channel * ch; - - /* Driver needs to initialize the geography map before using - * these helper functions */ - if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0) - return 0; - - ch = libipw_get_channel(ieee, channel); - if (!ch->channel) - return 0; - return ch->freq; -} - -u8 libipw_freq_to_channel(struct libipw_device * ieee, u32 freq) -{ - int i; - - /* Driver needs to initialize the geography map before using - * these helper functions */ - if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0) - return 0; - - freq /= 100000; - - if (ieee->freq_band & LIBIPW_24GHZ_BAND) - for (i = 0; i < ieee->geo.bg_channels; i++) - if (ieee->geo.bg[i].freq == freq) - return ieee->geo.bg[i].channel; - - if (ieee->freq_band & LIBIPW_52GHZ_BAND) - for (i = 0; i < ieee->geo.a_channels; i++) - if (ieee->geo.a[i].freq == freq) - return ieee->geo.a[i].channel; - - return 0; -} - -void libipw_set_geo(struct libipw_device *ieee, - const struct libipw_geo *geo) -{ - memcpy(ieee->geo.name, geo->name, 3); - ieee->geo.name[3] = '\0'; - ieee->geo.bg_channels = geo->bg_channels; - ieee->geo.a_channels = geo->a_channels; - memcpy(ieee->geo.bg, geo->bg, geo->bg_channels * - sizeof(struct libipw_channel)); - memcpy(ieee->geo.a, geo->a, ieee->geo.a_channels * - sizeof(struct libipw_channel)); -} - -const struct libipw_geo *libipw_get_geo(struct libipw_device *ieee) -{ - return &ieee->geo; -} - -u8 libipw_get_channel_flags(struct libipw_device * ieee, u8 channel) -{ - int index = libipw_channel_to_index(ieee, channel); - - if (index == -1) - return LIBIPW_CH_INVALID; - - if (channel <= LIBIPW_24GHZ_CHANNELS) - return ieee->geo.bg[index].flags; - - return ieee->geo.a[index].flags; -} - -static const struct libipw_channel bad_channel = { - .channel = 0, - .flags = LIBIPW_CH_INVALID, - .max_power = 0, -}; - -const struct libipw_channel *libipw_get_channel(struct libipw_device - *ieee, u8 channel) -{ - int index = libipw_channel_to_index(ieee, channel); - - if (index == -1) - return &bad_channel; - - if (channel <= LIBIPW_24GHZ_CHANNELS) - return &ieee->geo.bg[index]; - - return &ieee->geo.a[index]; -} - -EXPORT_SYMBOL(libipw_get_channel); -EXPORT_SYMBOL(libipw_get_channel_flags); -EXPORT_SYMBOL(libipw_is_valid_channel); -EXPORT_SYMBOL(libipw_freq_to_channel); -EXPORT_SYMBOL(libipw_channel_to_freq); -EXPORT_SYMBOL(libipw_channel_to_index); -EXPORT_SYMBOL(libipw_set_geo); -EXPORT_SYMBOL(libipw_get_geo); diff --git a/drivers/net/wireless/ipw2x00/libipw_module.c b/drivers/net/wireless/ipw2x00/libipw_module.c deleted file mode 100644 index 3adb24021a28..000000000000 --- a/drivers/net/wireless/ipw2x00/libipw_module.c +++ /dev/null @@ -1,335 +0,0 @@ -/******************************************************************************* - - Copyright(c) 2004-2005 Intel Corporation. All rights reserved. - - Portions of this file are based on the WEP enablement code provided by the - Host AP project hostap-drivers v0.1.3 - Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen - - Copyright (c) 2002-2003, Jouni Malinen - - 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., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - - Contact Information: - Intel Linux Wireless - Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - -*******************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libipw.h" - -#define DRV_DESCRIPTION "802.11 data/management/control stack" -#define DRV_NAME "libipw" -#define DRV_PROCNAME "ieee80211" -#define DRV_VERSION LIBIPW_VERSION -#define DRV_COPYRIGHT "Copyright (C) 2004-2005 Intel Corporation " - -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION(DRV_DESCRIPTION); -MODULE_AUTHOR(DRV_COPYRIGHT); -MODULE_LICENSE("GPL"); - -static struct cfg80211_ops libipw_config_ops = { }; -static void *libipw_wiphy_privid = &libipw_wiphy_privid; - -static int libipw_networks_allocate(struct libipw_device *ieee) -{ - int i, j; - - for (i = 0; i < MAX_NETWORK_COUNT; i++) { - ieee->networks[i] = kzalloc(sizeof(struct libipw_network), - GFP_KERNEL); - if (!ieee->networks[i]) { - LIBIPW_ERROR("Out of memory allocating beacons\n"); - for (j = 0; j < i; j++) - kfree(ieee->networks[j]); - return -ENOMEM; - } - } - - return 0; -} - -void libipw_network_reset(struct libipw_network *network) -{ - if (!network) - return; - - if (network->ibss_dfs) { - kfree(network->ibss_dfs); - network->ibss_dfs = NULL; - } -} - -static inline void libipw_networks_free(struct libipw_device *ieee) -{ - int i; - - for (i = 0; i < MAX_NETWORK_COUNT; i++) { - if (ieee->networks[i]->ibss_dfs) - kfree(ieee->networks[i]->ibss_dfs); - kfree(ieee->networks[i]); - } -} - -void libipw_networks_age(struct libipw_device *ieee, - unsigned long age_secs) -{ - struct libipw_network *network = NULL; - unsigned long flags; - unsigned long age_jiffies = msecs_to_jiffies(age_secs * MSEC_PER_SEC); - - spin_lock_irqsave(&ieee->lock, flags); - list_for_each_entry(network, &ieee->network_list, list) { - network->last_scanned -= age_jiffies; - } - spin_unlock_irqrestore(&ieee->lock, flags); -} -EXPORT_SYMBOL(libipw_networks_age); - -static void libipw_networks_initialize(struct libipw_device *ieee) -{ - int i; - - INIT_LIST_HEAD(&ieee->network_free_list); - INIT_LIST_HEAD(&ieee->network_list); - for (i = 0; i < MAX_NETWORK_COUNT; i++) - list_add_tail(&ieee->networks[i]->list, - &ieee->network_free_list); -} - -int libipw_change_mtu(struct net_device *dev, int new_mtu) -{ - if ((new_mtu < 68) || (new_mtu > LIBIPW_DATA_LEN)) - return -EINVAL; - dev->mtu = new_mtu; - return 0; -} -EXPORT_SYMBOL(libipw_change_mtu); - -struct net_device *alloc_libipw(int sizeof_priv, int monitor) -{ - struct libipw_device *ieee; - struct net_device *dev; - int err; - - LIBIPW_DEBUG_INFO("Initializing...\n"); - - dev = alloc_etherdev(sizeof(struct libipw_device) + sizeof_priv); - if (!dev) - goto failed; - - ieee = netdev_priv(dev); - - ieee->dev = dev; - - if (!monitor) { - ieee->wdev.wiphy = wiphy_new(&libipw_config_ops, 0); - if (!ieee->wdev.wiphy) { - LIBIPW_ERROR("Unable to allocate wiphy.\n"); - goto failed_free_netdev; - } - - ieee->dev->ieee80211_ptr = &ieee->wdev; - ieee->wdev.iftype = NL80211_IFTYPE_STATION; - - /* Fill-out wiphy structure bits we know... Not enough info - here to call set_wiphy_dev or set MAC address or channel info - -- have to do that in ->ndo_init... */ - ieee->wdev.wiphy->privid = libipw_wiphy_privid; - - ieee->wdev.wiphy->max_scan_ssids = 1; - ieee->wdev.wiphy->max_scan_ie_len = 0; - ieee->wdev.wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) - | BIT(NL80211_IFTYPE_ADHOC); - } - - err = libipw_networks_allocate(ieee); - if (err) { - LIBIPW_ERROR("Unable to allocate beacon storage: %d\n", err); - goto failed_free_wiphy; - } - libipw_networks_initialize(ieee); - - /* Default fragmentation threshold is maximum payload size */ - ieee->fts = DEFAULT_FTS; - ieee->rts = DEFAULT_FTS; - ieee->scan_age = DEFAULT_MAX_SCAN_AGE; - ieee->open_wep = 1; - - /* Default to enabling full open WEP with host based encrypt/decrypt */ - ieee->host_encrypt = 1; - ieee->host_decrypt = 1; - ieee->host_mc_decrypt = 1; - - /* Host fragmentation in Open mode. Default is enabled. - * Note: host fragmentation is always enabled if host encryption - * is enabled. For cards can do hardware encryption, they must do - * hardware fragmentation as well. So we don't need a variable - * like host_enc_frag. */ - ieee->host_open_frag = 1; - ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ - - spin_lock_init(&ieee->lock); - - lib80211_crypt_info_init(&ieee->crypt_info, dev->name, &ieee->lock); - - ieee->wpa_enabled = 0; - ieee->drop_unencrypted = 0; - ieee->privacy_invoked = 0; - - return dev; - -failed_free_wiphy: - if (!monitor) - wiphy_free(ieee->wdev.wiphy); -failed_free_netdev: - free_netdev(dev); -failed: - return NULL; -} -EXPORT_SYMBOL(alloc_libipw); - -void free_libipw(struct net_device *dev, int monitor) -{ - struct libipw_device *ieee = netdev_priv(dev); - - lib80211_crypt_info_free(&ieee->crypt_info); - - libipw_networks_free(ieee); - - /* free cfg80211 resources */ - if (!monitor) - wiphy_free(ieee->wdev.wiphy); - - free_netdev(dev); -} -EXPORT_SYMBOL(free_libipw); - -#ifdef CONFIG_LIBIPW_DEBUG - -static int debug = 0; -u32 libipw_debug_level = 0; -EXPORT_SYMBOL_GPL(libipw_debug_level); -static struct proc_dir_entry *libipw_proc = NULL; - -static int debug_level_proc_show(struct seq_file *m, void *v) -{ - seq_printf(m, "0x%08X\n", libipw_debug_level); - return 0; -} - -static int debug_level_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, debug_level_proc_show, NULL); -} - -static ssize_t debug_level_proc_write(struct file *file, - const char __user *buffer, size_t count, loff_t *pos) -{ - char buf[] = "0x00000000\n"; - size_t len = min(sizeof(buf) - 1, count); - unsigned long val; - - if (copy_from_user(buf, buffer, len)) - return count; - buf[len] = 0; - if (sscanf(buf, "%li", &val) != 1) - printk(KERN_INFO DRV_NAME - ": %s is not in hex or decimal form.\n", buf); - else - libipw_debug_level = val; - - return strnlen(buf, len); -} - -static const struct file_operations debug_level_proc_fops = { - .owner = THIS_MODULE, - .open = debug_level_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, - .write = debug_level_proc_write, -}; -#endif /* CONFIG_LIBIPW_DEBUG */ - -static int __init libipw_init(void) -{ -#ifdef CONFIG_LIBIPW_DEBUG - struct proc_dir_entry *e; - - libipw_debug_level = debug; - libipw_proc = proc_mkdir(DRV_PROCNAME, init_net.proc_net); - if (libipw_proc == NULL) { - LIBIPW_ERROR("Unable to create " DRV_PROCNAME - " proc directory\n"); - return -EIO; - } - e = proc_create("debug_level", S_IRUGO | S_IWUSR, libipw_proc, - &debug_level_proc_fops); - if (!e) { - remove_proc_entry(DRV_PROCNAME, init_net.proc_net); - libipw_proc = NULL; - return -EIO; - } -#endif /* CONFIG_LIBIPW_DEBUG */ - - printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); - printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); - - return 0; -} - -static void __exit libipw_exit(void) -{ -#ifdef CONFIG_LIBIPW_DEBUG - if (libipw_proc) { - remove_proc_entry("debug_level", libipw_proc); - remove_proc_entry(DRV_PROCNAME, init_net.proc_net); - libipw_proc = NULL; - } -#endif /* CONFIG_LIBIPW_DEBUG */ -} - -#ifdef CONFIG_LIBIPW_DEBUG -#include -module_param(debug, int, 0444); -MODULE_PARM_DESC(debug, "debug output mask"); -#endif /* CONFIG_LIBIPW_DEBUG */ - -module_exit(libipw_exit); -module_init(libipw_init); diff --git a/drivers/net/wireless/ipw2x00/libipw_rx.c b/drivers/net/wireless/ipw2x00/libipw_rx.c deleted file mode 100644 index 95a1ca1e895c..000000000000 --- a/drivers/net/wireless/ipw2x00/libipw_rx.c +++ /dev/null @@ -1,1797 +0,0 @@ -/* - * Original code based Host AP (software wireless LAN access point) driver - * for Intersil Prism2/2.5/3 - hostap.o module, common routines - * - * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen - * - * Copyright (c) 2002-2003, Jouni Malinen - * Copyright (c) 2004-2005, Intel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "libipw.h" - -static void libipw_monitor_rx(struct libipw_device *ieee, - struct sk_buff *skb, - struct libipw_rx_stats *rx_stats) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - u16 fc = le16_to_cpu(hdr->frame_control); - - skb->dev = ieee->dev; - skb_reset_mac_header(skb); - skb_pull(skb, libipw_get_hdrlen(fc)); - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = htons(ETH_P_80211_RAW); - memset(skb->cb, 0, sizeof(skb->cb)); - netif_rx(skb); -} - -/* Called only as a tasklet (software IRQ) */ -static struct libipw_frag_entry *libipw_frag_cache_find(struct - libipw_device - *ieee, - unsigned int seq, - unsigned int frag, - u8 * src, - u8 * dst) -{ - struct libipw_frag_entry *entry; - int i; - - for (i = 0; i < LIBIPW_FRAG_CACHE_LEN; i++) { - entry = &ieee->frag_cache[i]; - if (entry->skb != NULL && - time_after(jiffies, entry->first_frag_time + 2 * HZ)) { - LIBIPW_DEBUG_FRAG("expiring fragment cache entry " - "seq=%u last_frag=%u\n", - entry->seq, entry->last_frag); - dev_kfree_skb_any(entry->skb); - entry->skb = NULL; - } - - if (entry->skb != NULL && entry->seq == seq && - (entry->last_frag + 1 == frag || frag == -1) && - ether_addr_equal(entry->src_addr, src) && - ether_addr_equal(entry->dst_addr, dst)) - return entry; - } - - return NULL; -} - -/* Called only as a tasklet (software IRQ) */ -static struct sk_buff *libipw_frag_cache_get(struct libipw_device *ieee, - struct libipw_hdr_4addr *hdr) -{ - struct sk_buff *skb = NULL; - u16 sc; - unsigned int frag, seq; - struct libipw_frag_entry *entry; - - sc = le16_to_cpu(hdr->seq_ctl); - frag = WLAN_GET_SEQ_FRAG(sc); - seq = WLAN_GET_SEQ_SEQ(sc); - - if (frag == 0) { - /* Reserve enough space to fit maximum frame length */ - skb = dev_alloc_skb(ieee->dev->mtu + - sizeof(struct libipw_hdr_4addr) + - 8 /* LLC */ + - 2 /* alignment */ + - 8 /* WEP */ + ETH_ALEN /* WDS */ ); - if (skb == NULL) - return NULL; - - entry = &ieee->frag_cache[ieee->frag_next_idx]; - ieee->frag_next_idx++; - if (ieee->frag_next_idx >= LIBIPW_FRAG_CACHE_LEN) - ieee->frag_next_idx = 0; - - if (entry->skb != NULL) - dev_kfree_skb_any(entry->skb); - - entry->first_frag_time = jiffies; - entry->seq = seq; - entry->last_frag = frag; - entry->skb = skb; - memcpy(entry->src_addr, hdr->addr2, ETH_ALEN); - memcpy(entry->dst_addr, hdr->addr1, ETH_ALEN); - } else { - /* received a fragment of a frame for which the head fragment - * should have already been received */ - entry = libipw_frag_cache_find(ieee, seq, frag, hdr->addr2, - hdr->addr1); - if (entry != NULL) { - entry->last_frag = frag; - skb = entry->skb; - } - } - - return skb; -} - -/* Called only as a tasklet (software IRQ) */ -static int libipw_frag_cache_invalidate(struct libipw_device *ieee, - struct libipw_hdr_4addr *hdr) -{ - u16 sc; - unsigned int seq; - struct libipw_frag_entry *entry; - - sc = le16_to_cpu(hdr->seq_ctl); - seq = WLAN_GET_SEQ_SEQ(sc); - - entry = libipw_frag_cache_find(ieee, seq, -1, hdr->addr2, - hdr->addr1); - - if (entry == NULL) { - LIBIPW_DEBUG_FRAG("could not invalidate fragment cache " - "entry (seq=%u)\n", seq); - return -1; - } - - entry->skb = NULL; - return 0; -} - -#ifdef NOT_YET -/* libipw_rx_frame_mgtmt - * - * Responsible for handling management control frames - * - * Called by libipw_rx */ -static int -libipw_rx_frame_mgmt(struct libipw_device *ieee, struct sk_buff *skb, - struct libipw_rx_stats *rx_stats, u16 type, - u16 stype) -{ - if (ieee->iw_mode == IW_MODE_MASTER) { - printk(KERN_DEBUG "%s: Master mode not yet supported.\n", - ieee->dev->name); - return 0; -/* - hostap_update_sta_ps(ieee, (struct hostap_libipw_hdr_4addr *) - skb->data);*/ - } - - if (ieee->hostapd && type == WLAN_FC_TYPE_MGMT) { - if (stype == WLAN_FC_STYPE_BEACON && - ieee->iw_mode == IW_MODE_MASTER) { - struct sk_buff *skb2; - /* Process beacon frames also in kernel driver to - * update STA(AP) table statistics */ - skb2 = skb_clone(skb, GFP_ATOMIC); - if (skb2) - hostap_rx(skb2->dev, skb2, rx_stats); - } - - /* send management frames to the user space daemon for - * processing */ - ieee->apdevstats.rx_packets++; - ieee->apdevstats.rx_bytes += skb->len; - prism2_rx_80211(ieee->apdev, skb, rx_stats, PRISM2_RX_MGMT); - return 0; - } - - if (ieee->iw_mode == IW_MODE_MASTER) { - if (type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL) { - printk(KERN_DEBUG "%s: unknown management frame " - "(type=0x%02x, stype=0x%02x) dropped\n", - skb->dev->name, type, stype); - return -1; - } - - hostap_rx(skb->dev, skb, rx_stats); - return 0; - } - - printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: management frame " - "received in non-Host AP mode\n", skb->dev->name); - return -1; -} -#endif - -/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ -/* Ethernet-II snap header (RFC1042 for most EtherTypes) */ -static unsigned char libipw_rfc1042_header[] = - { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; - -/* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ -static unsigned char libipw_bridge_tunnel_header[] = - { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; -/* No encapsulation header if EtherType < 0x600 (=length) */ - -/* Called by libipw_rx_frame_decrypt */ -static int libipw_is_eapol_frame(struct libipw_device *ieee, - struct sk_buff *skb) -{ - struct net_device *dev = ieee->dev; - u16 fc, ethertype; - struct libipw_hdr_3addr *hdr; - u8 *pos; - - if (skb->len < 24) - return 0; - - hdr = (struct libipw_hdr_3addr *)skb->data; - fc = le16_to_cpu(hdr->frame_ctl); - - /* check that the frame is unicast frame to us */ - if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == - IEEE80211_FCTL_TODS && - ether_addr_equal(hdr->addr1, dev->dev_addr) && - ether_addr_equal(hdr->addr3, dev->dev_addr)) { - /* ToDS frame with own addr BSSID and DA */ - } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == - IEEE80211_FCTL_FROMDS && - ether_addr_equal(hdr->addr1, dev->dev_addr)) { - /* FromDS frame with own addr as DA */ - } else - return 0; - - if (skb->len < 24 + 8) - return 0; - - /* check for port access entity Ethernet type */ - pos = skb->data + 24; - ethertype = (pos[6] << 8) | pos[7]; - if (ethertype == ETH_P_PAE) - return 1; - - return 0; -} - -/* Called only as a tasklet (software IRQ), by libipw_rx */ -static int -libipw_rx_frame_decrypt(struct libipw_device *ieee, struct sk_buff *skb, - struct lib80211_crypt_data *crypt) -{ - struct libipw_hdr_3addr *hdr; - int res, hdrlen; - - if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) - return 0; - - hdr = (struct libipw_hdr_3addr *)skb->data; - hdrlen = libipw_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); - - atomic_inc(&crypt->refcnt); - res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); - atomic_dec(&crypt->refcnt); - if (res < 0) { - LIBIPW_DEBUG_DROP("decryption failed (SA=%pM) res=%d\n", - hdr->addr2, res); - if (res == -2) - LIBIPW_DEBUG_DROP("Decryption failed ICV " - "mismatch (key %d)\n", - skb->data[hdrlen + 3] >> 6); - ieee->ieee_stats.rx_discards_undecryptable++; - return -1; - } - - return res; -} - -/* Called only as a tasklet (software IRQ), by libipw_rx */ -static int -libipw_rx_frame_decrypt_msdu(struct libipw_device *ieee, - struct sk_buff *skb, int keyidx, - struct lib80211_crypt_data *crypt) -{ - struct libipw_hdr_3addr *hdr; - int res, hdrlen; - - if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) - return 0; - - hdr = (struct libipw_hdr_3addr *)skb->data; - hdrlen = libipw_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); - - atomic_inc(&crypt->refcnt); - res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); - atomic_dec(&crypt->refcnt); - if (res < 0) { - printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" - " (SA=%pM keyidx=%d)\n", ieee->dev->name, hdr->addr2, - keyidx); - return -1; - } - - return 0; -} - -/* All received frames are sent to this function. @skb contains the frame in - * IEEE 802.11 format, i.e., in the format it was sent over air. - * This function is called only as a tasklet (software IRQ). */ -int libipw_rx(struct libipw_device *ieee, struct sk_buff *skb, - struct libipw_rx_stats *rx_stats) -{ - struct net_device *dev = ieee->dev; - struct libipw_hdr_4addr *hdr; - size_t hdrlen; - u16 fc, type, stype, sc; - unsigned int frag; - u8 *payload; - u16 ethertype; -#ifdef NOT_YET - struct net_device *wds = NULL; - struct sk_buff *skb2 = NULL; - struct net_device *wds = NULL; - int frame_authorized = 0; - int from_assoc_ap = 0; - void *sta = NULL; -#endif - u8 dst[ETH_ALEN]; - u8 src[ETH_ALEN]; - struct lib80211_crypt_data *crypt = NULL; - int keyidx = 0; - int can_be_decrypted = 0; - - hdr = (struct libipw_hdr_4addr *)skb->data; - if (skb->len < 10) { - printk(KERN_INFO "%s: SKB length < 10\n", dev->name); - goto rx_dropped; - } - - fc = le16_to_cpu(hdr->frame_ctl); - type = WLAN_FC_GET_TYPE(fc); - stype = WLAN_FC_GET_STYPE(fc); - sc = le16_to_cpu(hdr->seq_ctl); - frag = WLAN_GET_SEQ_FRAG(sc); - hdrlen = libipw_get_hdrlen(fc); - - if (skb->len < hdrlen) { - printk(KERN_INFO "%s: invalid SKB length %d\n", - dev->name, skb->len); - goto rx_dropped; - } - - /* Put this code here so that we avoid duplicating it in all - * Rx paths. - Jean II */ -#ifdef CONFIG_WIRELESS_EXT -#ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ - /* If spy monitoring on */ - if (ieee->spy_data.spy_number > 0) { - struct iw_quality wstats; - - wstats.updated = 0; - if (rx_stats->mask & LIBIPW_STATMASK_RSSI) { - wstats.level = rx_stats->signal; - wstats.updated |= IW_QUAL_LEVEL_UPDATED; - } else - wstats.updated |= IW_QUAL_LEVEL_INVALID; - - if (rx_stats->mask & LIBIPW_STATMASK_NOISE) { - wstats.noise = rx_stats->noise; - wstats.updated |= IW_QUAL_NOISE_UPDATED; - } else - wstats.updated |= IW_QUAL_NOISE_INVALID; - - if (rx_stats->mask & LIBIPW_STATMASK_SIGNAL) { - wstats.qual = rx_stats->signal; - wstats.updated |= IW_QUAL_QUAL_UPDATED; - } else - wstats.updated |= IW_QUAL_QUAL_INVALID; - - /* Update spy records */ - wireless_spy_update(ieee->dev, hdr->addr2, &wstats); - } -#endif /* IW_WIRELESS_SPY */ -#endif /* CONFIG_WIRELESS_EXT */ - -#ifdef NOT_YET - hostap_update_rx_stats(local->ap, hdr, rx_stats); -#endif - - if (ieee->iw_mode == IW_MODE_MONITOR) { - dev->stats.rx_packets++; - dev->stats.rx_bytes += skb->len; - libipw_monitor_rx(ieee, skb, rx_stats); - return 1; - } - - can_be_decrypted = (is_multicast_ether_addr(hdr->addr1) || - is_broadcast_ether_addr(hdr->addr2)) ? - ieee->host_mc_decrypt : ieee->host_decrypt; - - if (can_be_decrypted) { - if (skb->len >= hdrlen + 3) { - /* Top two-bits of byte 3 are the key index */ - keyidx = skb->data[hdrlen + 3] >> 6; - } - - /* ieee->crypt[] is WEP_KEY (4) in length. Given that keyidx - * is only allowed 2-bits of storage, no value of keyidx can - * be provided via above code that would result in keyidx - * being out of range */ - crypt = ieee->crypt_info.crypt[keyidx]; - -#ifdef NOT_YET - sta = NULL; - - /* Use station specific key to override default keys if the - * receiver address is a unicast address ("individual RA"). If - * bcrx_sta_key parameter is set, station specific key is used - * even with broad/multicast targets (this is against IEEE - * 802.11, but makes it easier to use different keys with - * stations that do not support WEP key mapping). */ - - if (is_unicast_ether_addr(hdr->addr1) || local->bcrx_sta_key) - (void)hostap_handle_sta_crypto(local, hdr, &crypt, - &sta); -#endif - - /* allow NULL decrypt to indicate an station specific override - * for default encryption */ - if (crypt && (crypt->ops == NULL || - crypt->ops->decrypt_mpdu == NULL)) - crypt = NULL; - - if (!crypt && (fc & IEEE80211_FCTL_PROTECTED)) { - /* This seems to be triggered by some (multicast?) - * frames from other than current BSS, so just drop the - * frames silently instead of filling system log with - * these reports. */ - LIBIPW_DEBUG_DROP("Decryption failed (not set)" - " (SA=%pM)\n", hdr->addr2); - ieee->ieee_stats.rx_discards_undecryptable++; - goto rx_dropped; - } - } -#ifdef NOT_YET - if (type != WLAN_FC_TYPE_DATA) { - if (type == WLAN_FC_TYPE_MGMT && stype == WLAN_FC_STYPE_AUTH && - fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt && - (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) { - printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " - "from %pM\n", dev->name, hdr->addr2); - /* TODO: could inform hostapd about this so that it - * could send auth failure report */ - goto rx_dropped; - } - - if (libipw_rx_frame_mgmt(ieee, skb, rx_stats, type, stype)) - goto rx_dropped; - else - goto rx_exit; - } -#endif - /* drop duplicate 802.11 retransmissions (IEEE 802.11 Chap. 9.29) */ - if (sc == ieee->prev_seq_ctl) - goto rx_dropped; - else - ieee->prev_seq_ctl = sc; - - /* Data frame - extract src/dst addresses */ - if (skb->len < LIBIPW_3ADDR_LEN) - goto rx_dropped; - - switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { - case IEEE80211_FCTL_FROMDS: - memcpy(dst, hdr->addr1, ETH_ALEN); - memcpy(src, hdr->addr3, ETH_ALEN); - break; - case IEEE80211_FCTL_TODS: - memcpy(dst, hdr->addr3, ETH_ALEN); - memcpy(src, hdr->addr2, ETH_ALEN); - break; - case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: - if (skb->len < LIBIPW_4ADDR_LEN) - goto rx_dropped; - memcpy(dst, hdr->addr3, ETH_ALEN); - memcpy(src, hdr->addr4, ETH_ALEN); - break; - case 0: - memcpy(dst, hdr->addr1, ETH_ALEN); - memcpy(src, hdr->addr2, ETH_ALEN); - break; - } - -#ifdef NOT_YET - if (hostap_rx_frame_wds(ieee, hdr, fc, &wds)) - goto rx_dropped; - if (wds) { - skb->dev = dev = wds; - stats = hostap_get_stats(dev); - } - - if (ieee->iw_mode == IW_MODE_MASTER && !wds && - (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == - IEEE80211_FCTL_FROMDS && ieee->stadev && - ether_addr_equal(hdr->addr2, ieee->assoc_ap_addr)) { - /* Frame from BSSID of the AP for which we are a client */ - skb->dev = dev = ieee->stadev; - stats = hostap_get_stats(dev); - from_assoc_ap = 1; - } -#endif - -#ifdef NOT_YET - if ((ieee->iw_mode == IW_MODE_MASTER || - ieee->iw_mode == IW_MODE_REPEAT) && !from_assoc_ap) { - switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats, - wds != NULL)) { - case AP_RX_CONTINUE_NOT_AUTHORIZED: - frame_authorized = 0; - break; - case AP_RX_CONTINUE: - frame_authorized = 1; - break; - case AP_RX_DROP: - goto rx_dropped; - case AP_RX_EXIT: - goto rx_exit; - } - } -#endif - - /* Nullfunc frames may have PS-bit set, so they must be passed to - * hostap_handle_sta_rx() before being dropped here. */ - - stype &= ~IEEE80211_STYPE_QOS_DATA; - - if (stype != IEEE80211_STYPE_DATA && - stype != IEEE80211_STYPE_DATA_CFACK && - stype != IEEE80211_STYPE_DATA_CFPOLL && - stype != IEEE80211_STYPE_DATA_CFACKPOLL) { - if (stype != IEEE80211_STYPE_NULLFUNC) - LIBIPW_DEBUG_DROP("RX: dropped data frame " - "with no data (type=0x%02x, " - "subtype=0x%02x, len=%d)\n", - type, stype, skb->len); - goto rx_dropped; - } - - /* skb: hdr + (possibly fragmented, possibly encrypted) payload */ - - if ((fc & IEEE80211_FCTL_PROTECTED) && can_be_decrypted && - (keyidx = libipw_rx_frame_decrypt(ieee, skb, crypt)) < 0) - goto rx_dropped; - - hdr = (struct libipw_hdr_4addr *)skb->data; - - /* skb: hdr + (possibly fragmented) plaintext payload */ - // PR: FIXME: hostap has additional conditions in the "if" below: - // ieee->host_decrypt && (fc & IEEE80211_FCTL_PROTECTED) && - if ((frag != 0) || (fc & IEEE80211_FCTL_MOREFRAGS)) { - int flen; - struct sk_buff *frag_skb = libipw_frag_cache_get(ieee, hdr); - LIBIPW_DEBUG_FRAG("Rx Fragment received (%u)\n", frag); - - if (!frag_skb) { - LIBIPW_DEBUG(LIBIPW_DL_RX | LIBIPW_DL_FRAG, - "Rx cannot get skb from fragment " - "cache (morefrag=%d seq=%u frag=%u)\n", - (fc & IEEE80211_FCTL_MOREFRAGS) != 0, - WLAN_GET_SEQ_SEQ(sc), frag); - goto rx_dropped; - } - - flen = skb->len; - if (frag != 0) - flen -= hdrlen; - - if (frag_skb->tail + flen > frag_skb->end) { - printk(KERN_WARNING "%s: host decrypted and " - "reassembled frame did not fit skb\n", - dev->name); - libipw_frag_cache_invalidate(ieee, hdr); - goto rx_dropped; - } - - if (frag == 0) { - /* copy first fragment (including full headers) into - * beginning of the fragment cache skb */ - skb_copy_from_linear_data(skb, skb_put(frag_skb, flen), flen); - } else { - /* append frame payload to the end of the fragment - * cache skb */ - skb_copy_from_linear_data_offset(skb, hdrlen, - skb_put(frag_skb, flen), flen); - } - dev_kfree_skb_any(skb); - skb = NULL; - - if (fc & IEEE80211_FCTL_MOREFRAGS) { - /* more fragments expected - leave the skb in fragment - * cache for now; it will be delivered to upper layers - * after all fragments have been received */ - goto rx_exit; - } - - /* this was the last fragment and the frame will be - * delivered, so remove skb from fragment cache */ - skb = frag_skb; - hdr = (struct libipw_hdr_4addr *)skb->data; - libipw_frag_cache_invalidate(ieee, hdr); - } - - /* skb: hdr + (possible reassembled) full MSDU payload; possibly still - * encrypted/authenticated */ - if ((fc & IEEE80211_FCTL_PROTECTED) && can_be_decrypted && - libipw_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) - goto rx_dropped; - - hdr = (struct libipw_hdr_4addr *)skb->data; - if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep) { - if ( /*ieee->ieee802_1x && */ - libipw_is_eapol_frame(ieee, skb)) { - /* pass unencrypted EAPOL frames even if encryption is - * configured */ - } else { - LIBIPW_DEBUG_DROP("encryption configured, but RX " - "frame not encrypted (SA=%pM)\n", - hdr->addr2); - goto rx_dropped; - } - } - - if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep && - !libipw_is_eapol_frame(ieee, skb)) { - LIBIPW_DEBUG_DROP("dropped unencrypted RX data " - "frame from %pM (drop_unencrypted=1)\n", - hdr->addr2); - goto rx_dropped; - } - - /* If the frame was decrypted in hardware, we may need to strip off - * any security data (IV, ICV, etc) that was left behind */ - if (!can_be_decrypted && (fc & IEEE80211_FCTL_PROTECTED) && - ieee->host_strip_iv_icv) { - int trimlen = 0; - - /* Top two-bits of byte 3 are the key index */ - if (skb->len >= hdrlen + 3) - keyidx = skb->data[hdrlen + 3] >> 6; - - /* To strip off any security data which appears before the - * payload, we simply increase hdrlen (as the header gets - * chopped off immediately below). For the security data which - * appears after the payload, we use skb_trim. */ - - switch (ieee->sec.encode_alg[keyidx]) { - case SEC_ALG_WEP: - /* 4 byte IV */ - hdrlen += 4; - /* 4 byte ICV */ - trimlen = 4; - break; - case SEC_ALG_TKIP: - /* 4 byte IV, 4 byte ExtIV */ - hdrlen += 8; - /* 8 byte MIC, 4 byte ICV */ - trimlen = 12; - break; - case SEC_ALG_CCMP: - /* 8 byte CCMP header */ - hdrlen += 8; - /* 8 byte MIC */ - trimlen = 8; - break; - } - - if (skb->len < trimlen) - goto rx_dropped; - - __skb_trim(skb, skb->len - trimlen); - - if (skb->len < hdrlen) - goto rx_dropped; - } - - /* skb: hdr + (possible reassembled) full plaintext payload */ - - payload = skb->data + hdrlen; - ethertype = (payload[6] << 8) | payload[7]; - -#ifdef NOT_YET - /* If IEEE 802.1X is used, check whether the port is authorized to send - * the received frame. */ - if (ieee->ieee802_1x && ieee->iw_mode == IW_MODE_MASTER) { - if (ethertype == ETH_P_PAE) { - printk(KERN_DEBUG "%s: RX: IEEE 802.1X frame\n", - dev->name); - if (ieee->hostapd && ieee->apdev) { - /* Send IEEE 802.1X frames to the user - * space daemon for processing */ - prism2_rx_80211(ieee->apdev, skb, rx_stats, - PRISM2_RX_MGMT); - ieee->apdevstats.rx_packets++; - ieee->apdevstats.rx_bytes += skb->len; - goto rx_exit; - } - } else if (!frame_authorized) { - printk(KERN_DEBUG "%s: dropped frame from " - "unauthorized port (IEEE 802.1X): " - "ethertype=0x%04x\n", dev->name, ethertype); - goto rx_dropped; - } - } -#endif - - /* convert hdr + possible LLC headers into Ethernet header */ - if (skb->len - hdrlen >= 8 && - ((memcmp(payload, libipw_rfc1042_header, SNAP_SIZE) == 0 && - ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || - memcmp(payload, libipw_bridge_tunnel_header, SNAP_SIZE) == 0)) { - /* remove RFC1042 or Bridge-Tunnel encapsulation and - * replace EtherType */ - skb_pull(skb, hdrlen + SNAP_SIZE); - memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN); - memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); - } else { - __be16 len; - /* Leave Ethernet header part of hdr and full payload */ - skb_pull(skb, hdrlen); - len = htons(skb->len); - memcpy(skb_push(skb, 2), &len, 2); - memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN); - memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); - } - -#ifdef NOT_YET - if (wds && ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == - IEEE80211_FCTL_TODS) && skb->len >= ETH_HLEN + ETH_ALEN) { - /* Non-standard frame: get addr4 from its bogus location after - * the payload */ - skb_copy_to_linear_data_offset(skb, ETH_ALEN, - skb->data + skb->len - ETH_ALEN, - ETH_ALEN); - skb_trim(skb, skb->len - ETH_ALEN); - } -#endif - - dev->stats.rx_packets++; - dev->stats.rx_bytes += skb->len; - -#ifdef NOT_YET - if (ieee->iw_mode == IW_MODE_MASTER && !wds && ieee->ap->bridge_packets) { - if (is_multicast_ether_addr(dst)) { - /* copy multicast frame both to the higher layers and - * to the wireless media */ - ieee->ap->bridged_multicast++; - skb2 = skb_clone(skb, GFP_ATOMIC); - if (skb2 == NULL) - printk(KERN_DEBUG "%s: skb_clone failed for " - "multicast frame\n", dev->name); - } else if (hostap_is_sta_assoc(ieee->ap, dst)) { - /* send frame directly to the associated STA using - * wireless media and not passing to higher layers */ - ieee->ap->bridged_unicast++; - skb2 = skb; - skb = NULL; - } - } - - if (skb2 != NULL) { - /* send to wireless media */ - skb2->dev = dev; - skb2->protocol = htons(ETH_P_802_3); - skb_reset_mac_header(skb2); - skb_reset_network_header(skb2); - /* skb2->network_header += ETH_HLEN; */ - dev_queue_xmit(skb2); - } -#endif - - if (skb) { - skb->protocol = eth_type_trans(skb, dev); - memset(skb->cb, 0, sizeof(skb->cb)); - skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */ - if (netif_rx(skb) == NET_RX_DROP) { - /* netif_rx always succeeds, but it might drop - * the packet. If it drops the packet, we log that - * in our stats. */ - LIBIPW_DEBUG_DROP - ("RX: netif_rx dropped the packet\n"); - dev->stats.rx_dropped++; - } - } - - rx_exit: -#ifdef NOT_YET - if (sta) - hostap_handle_sta_release(sta); -#endif - return 1; - - rx_dropped: - dev->stats.rx_dropped++; - - /* Returning 0 indicates to caller that we have not handled the SKB-- - * so it is still allocated and can be used again by underlying - * hardware as a DMA target */ - return 0; -} - -/* Filter out unrelated packets, call libipw_rx[_mgt] - * This function takes over the skb, it should not be used again after calling - * this function. */ -void libipw_rx_any(struct libipw_device *ieee, - struct sk_buff *skb, struct libipw_rx_stats *stats) -{ - struct libipw_hdr_4addr *hdr; - int is_packet_for_us; - u16 fc; - - if (ieee->iw_mode == IW_MODE_MONITOR) { - if (!libipw_rx(ieee, skb, stats)) - dev_kfree_skb_irq(skb); - return; - } - - if (skb->len < sizeof(struct ieee80211_hdr)) - goto drop_free; - - hdr = (struct libipw_hdr_4addr *)skb->data; - fc = le16_to_cpu(hdr->frame_ctl); - - if ((fc & IEEE80211_FCTL_VERS) != 0) - goto drop_free; - - switch (fc & IEEE80211_FCTL_FTYPE) { - case IEEE80211_FTYPE_MGMT: - if (skb->len < sizeof(struct libipw_hdr_3addr)) - goto drop_free; - libipw_rx_mgt(ieee, hdr, stats); - dev_kfree_skb_irq(skb); - return; - case IEEE80211_FTYPE_DATA: - break; - case IEEE80211_FTYPE_CTL: - return; - default: - return; - } - - is_packet_for_us = 0; - switch (ieee->iw_mode) { - case IW_MODE_ADHOC: - /* our BSS and not from/to DS */ - if (memcmp(hdr->addr3, ieee->bssid, ETH_ALEN) == 0) - if ((fc & (IEEE80211_FCTL_TODS+IEEE80211_FCTL_FROMDS)) == 0) { - /* promisc: get all */ - if (ieee->dev->flags & IFF_PROMISC) - is_packet_for_us = 1; - /* to us */ - else if (memcmp(hdr->addr1, ieee->dev->dev_addr, ETH_ALEN) == 0) - is_packet_for_us = 1; - /* mcast */ - else if (is_multicast_ether_addr(hdr->addr1)) - is_packet_for_us = 1; - } - break; - case IW_MODE_INFRA: - /* our BSS (== from our AP) and from DS */ - if (memcmp(hdr->addr2, ieee->bssid, ETH_ALEN) == 0) - if ((fc & (IEEE80211_FCTL_TODS+IEEE80211_FCTL_FROMDS)) == IEEE80211_FCTL_FROMDS) { - /* promisc: get all */ - if (ieee->dev->flags & IFF_PROMISC) - is_packet_for_us = 1; - /* to us */ - else if (memcmp(hdr->addr1, ieee->dev->dev_addr, ETH_ALEN) == 0) - is_packet_for_us = 1; - /* mcast */ - else if (is_multicast_ether_addr(hdr->addr1)) { - /* not our own packet bcasted from AP */ - if (memcmp(hdr->addr3, ieee->dev->dev_addr, ETH_ALEN)) - is_packet_for_us = 1; - } - } - break; - default: - /* ? */ - break; - } - - if (is_packet_for_us) - if (!libipw_rx(ieee, skb, stats)) - dev_kfree_skb_irq(skb); - return; - -drop_free: - dev_kfree_skb_irq(skb); - ieee->dev->stats.rx_dropped++; -} - -#define MGMT_FRAME_FIXED_PART_LENGTH 0x24 - -static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; - -/* -* Make the structure we read from the beacon packet to have -* the right values -*/ -static int libipw_verify_qos_info(struct libipw_qos_information_element - *info_element, int sub_type) -{ - - if (info_element->qui_subtype != sub_type) - return -1; - if (memcmp(info_element->qui, qos_oui, QOS_OUI_LEN)) - return -1; - if (info_element->qui_type != QOS_OUI_TYPE) - return -1; - if (info_element->version != QOS_VERSION_1) - return -1; - - return 0; -} - -/* - * Parse a QoS parameter element - */ -static int libipw_read_qos_param_element(struct libipw_qos_parameter_info - *element_param, struct libipw_info_element - *info_element) -{ - int ret = 0; - u16 size = sizeof(struct libipw_qos_parameter_info) - 2; - - if ((info_element == NULL) || (element_param == NULL)) - return -1; - - if (info_element->id == QOS_ELEMENT_ID && info_element->len == size) { - memcpy(element_param->info_element.qui, info_element->data, - info_element->len); - element_param->info_element.elementID = info_element->id; - element_param->info_element.length = info_element->len; - } else - ret = -1; - if (ret == 0) - ret = libipw_verify_qos_info(&element_param->info_element, - QOS_OUI_PARAM_SUB_TYPE); - return ret; -} - -/* - * Parse a QoS information element - */ -static int libipw_read_qos_info_element(struct - libipw_qos_information_element - *element_info, struct libipw_info_element - *info_element) -{ - int ret = 0; - u16 size = sizeof(struct libipw_qos_information_element) - 2; - - if (element_info == NULL) - return -1; - if (info_element == NULL) - return -1; - - if ((info_element->id == QOS_ELEMENT_ID) && (info_element->len == size)) { - memcpy(element_info->qui, info_element->data, - info_element->len); - element_info->elementID = info_element->id; - element_info->length = info_element->len; - } else - ret = -1; - - if (ret == 0) - ret = libipw_verify_qos_info(element_info, - QOS_OUI_INFO_SUB_TYPE); - return ret; -} - -/* - * Write QoS parameters from the ac parameters. - */ -static int libipw_qos_convert_ac_to_parameters(struct - libipw_qos_parameter_info - *param_elm, struct - libipw_qos_parameters - *qos_param) -{ - int rc = 0; - int i; - struct libipw_qos_ac_parameter *ac_params; - u32 txop; - u8 cw_min; - u8 cw_max; - - for (i = 0; i < QOS_QUEUE_NUM; i++) { - ac_params = &(param_elm->ac_params_record[i]); - - qos_param->aifs[i] = (ac_params->aci_aifsn) & 0x0F; - qos_param->aifs[i] -= (qos_param->aifs[i] < 2) ? 0 : 2; - - cw_min = ac_params->ecw_min_max & 0x0F; - qos_param->cw_min[i] = cpu_to_le16((1 << cw_min) - 1); - - cw_max = (ac_params->ecw_min_max & 0xF0) >> 4; - qos_param->cw_max[i] = cpu_to_le16((1 << cw_max) - 1); - - qos_param->flag[i] = - (ac_params->aci_aifsn & 0x10) ? 0x01 : 0x00; - - txop = le16_to_cpu(ac_params->tx_op_limit) * 32; - qos_param->tx_op_limit[i] = cpu_to_le16(txop); - } - return rc; -} - -/* - * we have a generic data element which it may contain QoS information or - * parameters element. check the information element length to decide - * which type to read - */ -static int libipw_parse_qos_info_param_IE(struct libipw_info_element - *info_element, - struct libipw_network *network) -{ - int rc = 0; - struct libipw_qos_parameters *qos_param = NULL; - struct libipw_qos_information_element qos_info_element; - - rc = libipw_read_qos_info_element(&qos_info_element, info_element); - - if (rc == 0) { - network->qos_data.param_count = qos_info_element.ac_info & 0x0F; - network->flags |= NETWORK_HAS_QOS_INFORMATION; - } else { - struct libipw_qos_parameter_info param_element; - - rc = libipw_read_qos_param_element(¶m_element, - info_element); - if (rc == 0) { - qos_param = &(network->qos_data.parameters); - libipw_qos_convert_ac_to_parameters(¶m_element, - qos_param); - network->flags |= NETWORK_HAS_QOS_PARAMETERS; - network->qos_data.param_count = - param_element.info_element.ac_info & 0x0F; - } - } - - if (rc == 0) { - LIBIPW_DEBUG_QOS("QoS is supported\n"); - network->qos_data.supported = 1; - } - return rc; -} - -#ifdef CONFIG_LIBIPW_DEBUG -#define MFIE_STRING(x) case WLAN_EID_ ##x: return #x - -static const char *get_info_element_string(u16 id) -{ - switch (id) { - MFIE_STRING(SSID); - MFIE_STRING(SUPP_RATES); - MFIE_STRING(FH_PARAMS); - MFIE_STRING(DS_PARAMS); - MFIE_STRING(CF_PARAMS); - MFIE_STRING(TIM); - MFIE_STRING(IBSS_PARAMS); - MFIE_STRING(COUNTRY); - MFIE_STRING(HP_PARAMS); - MFIE_STRING(HP_TABLE); - MFIE_STRING(REQUEST); - MFIE_STRING(CHALLENGE); - MFIE_STRING(PWR_CONSTRAINT); - MFIE_STRING(PWR_CAPABILITY); - MFIE_STRING(TPC_REQUEST); - MFIE_STRING(TPC_REPORT); - MFIE_STRING(SUPPORTED_CHANNELS); - MFIE_STRING(CHANNEL_SWITCH); - MFIE_STRING(MEASURE_REQUEST); - MFIE_STRING(MEASURE_REPORT); - MFIE_STRING(QUIET); - MFIE_STRING(IBSS_DFS); - MFIE_STRING(ERP_INFO); - MFIE_STRING(RSN); - MFIE_STRING(EXT_SUPP_RATES); - MFIE_STRING(VENDOR_SPECIFIC); - MFIE_STRING(QOS_PARAMETER); - default: - return "UNKNOWN"; - } -} -#endif - -static int libipw_parse_info_param(struct libipw_info_element - *info_element, u16 length, - struct libipw_network *network) -{ - DECLARE_SSID_BUF(ssid); - u8 i; -#ifdef CONFIG_LIBIPW_DEBUG - char rates_str[64]; - char *p; -#endif - - while (length >= sizeof(*info_element)) { - if (sizeof(*info_element) + info_element->len > length) { - LIBIPW_DEBUG_MGMT("Info elem: parse failed: " - "info_element->len + 2 > left : " - "info_element->len+2=%zd left=%d, id=%d.\n", - info_element->len + - sizeof(*info_element), - length, info_element->id); - /* We stop processing but don't return an error here - * because some misbehaviour APs break this rule. ie. - * Orinoco AP1000. */ - break; - } - - switch (info_element->id) { - case WLAN_EID_SSID: - network->ssid_len = min(info_element->len, - (u8) IW_ESSID_MAX_SIZE); - memcpy(network->ssid, info_element->data, - network->ssid_len); - if (network->ssid_len < IW_ESSID_MAX_SIZE) - memset(network->ssid + network->ssid_len, 0, - IW_ESSID_MAX_SIZE - network->ssid_len); - - LIBIPW_DEBUG_MGMT("WLAN_EID_SSID: '%s' len=%d.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->ssid_len); - break; - - case WLAN_EID_SUPP_RATES: -#ifdef CONFIG_LIBIPW_DEBUG - p = rates_str; -#endif - network->rates_len = min(info_element->len, - MAX_RATES_LENGTH); - for (i = 0; i < network->rates_len; i++) { - network->rates[i] = info_element->data[i]; -#ifdef CONFIG_LIBIPW_DEBUG - p += snprintf(p, sizeof(rates_str) - - (p - rates_str), "%02X ", - network->rates[i]); -#endif - if (libipw_is_ofdm_rate - (info_element->data[i])) { - network->flags |= NETWORK_HAS_OFDM; - if (info_element->data[i] & - LIBIPW_BASIC_RATE_MASK) - network->flags &= - ~NETWORK_HAS_CCK; - } - } - - LIBIPW_DEBUG_MGMT("WLAN_EID_SUPP_RATES: '%s' (%d)\n", - rates_str, network->rates_len); - break; - - case WLAN_EID_EXT_SUPP_RATES: -#ifdef CONFIG_LIBIPW_DEBUG - p = rates_str; -#endif - network->rates_ex_len = min(info_element->len, - MAX_RATES_EX_LENGTH); - for (i = 0; i < network->rates_ex_len; i++) { - network->rates_ex[i] = info_element->data[i]; -#ifdef CONFIG_LIBIPW_DEBUG - p += snprintf(p, sizeof(rates_str) - - (p - rates_str), "%02X ", - network->rates[i]); -#endif - if (libipw_is_ofdm_rate - (info_element->data[i])) { - network->flags |= NETWORK_HAS_OFDM; - if (info_element->data[i] & - LIBIPW_BASIC_RATE_MASK) - network->flags &= - ~NETWORK_HAS_CCK; - } - } - - LIBIPW_DEBUG_MGMT("WLAN_EID_EXT_SUPP_RATES: '%s' (%d)\n", - rates_str, network->rates_ex_len); - break; - - case WLAN_EID_DS_PARAMS: - LIBIPW_DEBUG_MGMT("WLAN_EID_DS_PARAMS: %d\n", - info_element->data[0]); - network->channel = info_element->data[0]; - break; - - case WLAN_EID_FH_PARAMS: - LIBIPW_DEBUG_MGMT("WLAN_EID_FH_PARAMS: ignored\n"); - break; - - case WLAN_EID_CF_PARAMS: - LIBIPW_DEBUG_MGMT("WLAN_EID_CF_PARAMS: ignored\n"); - break; - - case WLAN_EID_TIM: - network->tim.tim_count = info_element->data[0]; - network->tim.tim_period = info_element->data[1]; - LIBIPW_DEBUG_MGMT("WLAN_EID_TIM: partially ignored\n"); - break; - - case WLAN_EID_ERP_INFO: - network->erp_value = info_element->data[0]; - network->flags |= NETWORK_HAS_ERP_VALUE; - LIBIPW_DEBUG_MGMT("MFIE_TYPE_ERP_SET: %d\n", - network->erp_value); - break; - - case WLAN_EID_IBSS_PARAMS: - network->atim_window = info_element->data[0]; - LIBIPW_DEBUG_MGMT("WLAN_EID_IBSS_PARAMS: %d\n", - network->atim_window); - break; - - case WLAN_EID_CHALLENGE: - LIBIPW_DEBUG_MGMT("WLAN_EID_CHALLENGE: ignored\n"); - break; - - case WLAN_EID_VENDOR_SPECIFIC: - LIBIPW_DEBUG_MGMT("WLAN_EID_VENDOR_SPECIFIC: %d bytes\n", - info_element->len); - if (!libipw_parse_qos_info_param_IE(info_element, - network)) - break; - - if (info_element->len >= 4 && - info_element->data[0] == 0x00 && - info_element->data[1] == 0x50 && - info_element->data[2] == 0xf2 && - info_element->data[3] == 0x01) { - network->wpa_ie_len = min(info_element->len + 2, - MAX_WPA_IE_LEN); - memcpy(network->wpa_ie, info_element, - network->wpa_ie_len); - } - break; - - case WLAN_EID_RSN: - LIBIPW_DEBUG_MGMT("WLAN_EID_RSN: %d bytes\n", - info_element->len); - network->rsn_ie_len = min(info_element->len + 2, - MAX_WPA_IE_LEN); - memcpy(network->rsn_ie, info_element, - network->rsn_ie_len); - break; - - case WLAN_EID_QOS_PARAMETER: - printk(KERN_ERR - "QoS Error need to parse QOS_PARAMETER IE\n"); - break; - /* 802.11h */ - case WLAN_EID_PWR_CONSTRAINT: - network->power_constraint = info_element->data[0]; - network->flags |= NETWORK_HAS_POWER_CONSTRAINT; - break; - - case WLAN_EID_CHANNEL_SWITCH: - network->power_constraint = info_element->data[0]; - network->flags |= NETWORK_HAS_CSA; - break; - - case WLAN_EID_QUIET: - network->quiet.count = info_element->data[0]; - network->quiet.period = info_element->data[1]; - network->quiet.duration = info_element->data[2]; - network->quiet.offset = info_element->data[3]; - network->flags |= NETWORK_HAS_QUIET; - break; - - case WLAN_EID_IBSS_DFS: - if (network->ibss_dfs) - break; - network->ibss_dfs = kmemdup(info_element->data, - info_element->len, - GFP_ATOMIC); - if (!network->ibss_dfs) - return 1; - network->flags |= NETWORK_HAS_IBSS_DFS; - break; - - case WLAN_EID_TPC_REPORT: - network->tpc_report.transmit_power = - info_element->data[0]; - network->tpc_report.link_margin = info_element->data[1]; - network->flags |= NETWORK_HAS_TPC_REPORT; - break; - - default: - LIBIPW_DEBUG_MGMT - ("Unsupported info element: %s (%d)\n", - get_info_element_string(info_element->id), - info_element->id); - break; - } - - length -= sizeof(*info_element) + info_element->len; - info_element = - (struct libipw_info_element *)&info_element-> - data[info_element->len]; - } - - return 0; -} - -static int libipw_handle_assoc_resp(struct libipw_device *ieee, struct libipw_assoc_response - *frame, struct libipw_rx_stats *stats) -{ - struct libipw_network network_resp = { - .ibss_dfs = NULL, - }; - struct libipw_network *network = &network_resp; - struct net_device *dev = ieee->dev; - - network->flags = 0; - network->qos_data.active = 0; - network->qos_data.supported = 0; - network->qos_data.param_count = 0; - network->qos_data.old_param_count = 0; - - //network->atim_window = le16_to_cpu(frame->aid) & (0x3FFF); - network->atim_window = le16_to_cpu(frame->aid); - network->listen_interval = le16_to_cpu(frame->status); - memcpy(network->bssid, frame->header.addr3, ETH_ALEN); - network->capability = le16_to_cpu(frame->capability); - network->last_scanned = jiffies; - network->rates_len = network->rates_ex_len = 0; - network->last_associate = 0; - network->ssid_len = 0; - network->erp_value = - (network->capability & WLAN_CAPABILITY_IBSS) ? 0x3 : 0x0; - - if (stats->freq == LIBIPW_52GHZ_BAND) { - /* for A band (No DS info) */ - network->channel = stats->received_channel; - } else - network->flags |= NETWORK_HAS_CCK; - - network->wpa_ie_len = 0; - network->rsn_ie_len = 0; - - if (libipw_parse_info_param - (frame->info_element, stats->len - sizeof(*frame), network)) - return 1; - - network->mode = 0; - if (stats->freq == LIBIPW_52GHZ_BAND) - network->mode = IEEE_A; - else { - if (network->flags & NETWORK_HAS_OFDM) - network->mode |= IEEE_G; - if (network->flags & NETWORK_HAS_CCK) - network->mode |= IEEE_B; - } - - memcpy(&network->stats, stats, sizeof(network->stats)); - - if (ieee->handle_assoc_response != NULL) - ieee->handle_assoc_response(dev, frame, network); - - return 0; -} - -/***************************************************/ - -static int libipw_network_init(struct libipw_device *ieee, struct libipw_probe_response - *beacon, - struct libipw_network *network, - struct libipw_rx_stats *stats) -{ - DECLARE_SSID_BUF(ssid); - - network->qos_data.active = 0; - network->qos_data.supported = 0; - network->qos_data.param_count = 0; - network->qos_data.old_param_count = 0; - - /* Pull out fixed field data */ - memcpy(network->bssid, beacon->header.addr3, ETH_ALEN); - network->capability = le16_to_cpu(beacon->capability); - network->last_scanned = jiffies; - network->time_stamp[0] = le32_to_cpu(beacon->time_stamp[0]); - network->time_stamp[1] = le32_to_cpu(beacon->time_stamp[1]); - network->beacon_interval = le16_to_cpu(beacon->beacon_interval); - /* Where to pull this? beacon->listen_interval; */ - network->listen_interval = 0x0A; - network->rates_len = network->rates_ex_len = 0; - network->last_associate = 0; - network->ssid_len = 0; - network->flags = 0; - network->atim_window = 0; - network->erp_value = (network->capability & WLAN_CAPABILITY_IBSS) ? - 0x3 : 0x0; - - if (stats->freq == LIBIPW_52GHZ_BAND) { - /* for A band (No DS info) */ - network->channel = stats->received_channel; - } else - network->flags |= NETWORK_HAS_CCK; - - network->wpa_ie_len = 0; - network->rsn_ie_len = 0; - - if (libipw_parse_info_param - (beacon->info_element, stats->len - sizeof(*beacon), network)) - return 1; - - network->mode = 0; - if (stats->freq == LIBIPW_52GHZ_BAND) - network->mode = IEEE_A; - else { - if (network->flags & NETWORK_HAS_OFDM) - network->mode |= IEEE_G; - if (network->flags & NETWORK_HAS_CCK) - network->mode |= IEEE_B; - } - - if (network->mode == 0) { - LIBIPW_DEBUG_SCAN("Filtered out '%s (%pM)' " - "network.\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid); - return 1; - } - - memcpy(&network->stats, stats, sizeof(network->stats)); - - return 0; -} - -static inline int is_same_network(struct libipw_network *src, - struct libipw_network *dst) -{ - /* A network is only a duplicate if the channel, BSSID, and ESSID - * all match. We treat all with the same BSSID and channel - * as one network */ - return ((src->ssid_len == dst->ssid_len) && - (src->channel == dst->channel) && - ether_addr_equal(src->bssid, dst->bssid) && - !memcmp(src->ssid, dst->ssid, src->ssid_len)); -} - -static void update_network(struct libipw_network *dst, - struct libipw_network *src) -{ - int qos_active; - u8 old_param; - - libipw_network_reset(dst); - dst->ibss_dfs = src->ibss_dfs; - - /* We only update the statistics if they were created by receiving - * the network information on the actual channel the network is on. - * - * This keeps beacons received on neighbor channels from bringing - * down the signal level of an AP. */ - if (dst->channel == src->stats.received_channel) - memcpy(&dst->stats, &src->stats, - sizeof(struct libipw_rx_stats)); - else - LIBIPW_DEBUG_SCAN("Network %pM info received " - "off channel (%d vs. %d)\n", src->bssid, - dst->channel, src->stats.received_channel); - - dst->capability = src->capability; - memcpy(dst->rates, src->rates, src->rates_len); - dst->rates_len = src->rates_len; - memcpy(dst->rates_ex, src->rates_ex, src->rates_ex_len); - dst->rates_ex_len = src->rates_ex_len; - - dst->mode = src->mode; - dst->flags = src->flags; - dst->time_stamp[0] = src->time_stamp[0]; - dst->time_stamp[1] = src->time_stamp[1]; - - dst->beacon_interval = src->beacon_interval; - dst->listen_interval = src->listen_interval; - dst->atim_window = src->atim_window; - dst->erp_value = src->erp_value; - dst->tim = src->tim; - - memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len); - dst->wpa_ie_len = src->wpa_ie_len; - memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len); - dst->rsn_ie_len = src->rsn_ie_len; - - dst->last_scanned = jiffies; - qos_active = src->qos_data.active; - old_param = dst->qos_data.old_param_count; - if (dst->flags & NETWORK_HAS_QOS_MASK) - memcpy(&dst->qos_data, &src->qos_data, - sizeof(struct libipw_qos_data)); - else { - dst->qos_data.supported = src->qos_data.supported; - dst->qos_data.param_count = src->qos_data.param_count; - } - - if (dst->qos_data.supported == 1) { - if (dst->ssid_len) - LIBIPW_DEBUG_QOS - ("QoS the network %s is QoS supported\n", - dst->ssid); - else - LIBIPW_DEBUG_QOS - ("QoS the network is QoS supported\n"); - } - dst->qos_data.active = qos_active; - dst->qos_data.old_param_count = old_param; - - /* dst->last_associate is not overwritten */ -} - -static inline int is_beacon(__le16 fc) -{ - return (WLAN_FC_GET_STYPE(le16_to_cpu(fc)) == IEEE80211_STYPE_BEACON); -} - -static void libipw_process_probe_response(struct libipw_device - *ieee, struct - libipw_probe_response - *beacon, struct libipw_rx_stats - *stats) -{ - struct net_device *dev = ieee->dev; - struct libipw_network network = { - .ibss_dfs = NULL, - }; - struct libipw_network *target; - struct libipw_network *oldest = NULL; -#ifdef CONFIG_LIBIPW_DEBUG - struct libipw_info_element *info_element = beacon->info_element; -#endif - unsigned long flags; - DECLARE_SSID_BUF(ssid); - - LIBIPW_DEBUG_SCAN("'%s' (%pM" - "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", - print_ssid(ssid, info_element->data, info_element->len), - beacon->header.addr3, - (beacon->capability & cpu_to_le16(1 << 0xf)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0xe)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0xd)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0xc)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0xb)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0xa)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0x9)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0x8)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0x7)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0x6)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0x5)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0x4)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0x3)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0x2)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0x1)) ? '1' : '0', - (beacon->capability & cpu_to_le16(1 << 0x0)) ? '1' : '0'); - - if (libipw_network_init(ieee, beacon, &network, stats)) { - LIBIPW_DEBUG_SCAN("Dropped '%s' (%pM) via %s.\n", - print_ssid(ssid, info_element->data, - info_element->len), - beacon->header.addr3, - is_beacon(beacon->header.frame_ctl) ? - "BEACON" : "PROBE RESPONSE"); - return; - } - - /* The network parsed correctly -- so now we scan our known networks - * to see if we can find it in our list. - * - * NOTE: This search is definitely not optimized. Once its doing - * the "right thing" we'll optimize it for efficiency if - * necessary */ - - /* Search for this entry in the list and update it if it is - * already there. */ - - spin_lock_irqsave(&ieee->lock, flags); - - list_for_each_entry(target, &ieee->network_list, list) { - if (is_same_network(target, &network)) - break; - - if ((oldest == NULL) || - time_before(target->last_scanned, oldest->last_scanned)) - oldest = target; - } - - /* If we didn't find a match, then get a new network slot to initialize - * with this beacon's information */ - if (&target->list == &ieee->network_list) { - if (list_empty(&ieee->network_free_list)) { - /* If there are no more slots, expire the oldest */ - list_del(&oldest->list); - target = oldest; - LIBIPW_DEBUG_SCAN("Expired '%s' (%pM) from " - "network list.\n", - print_ssid(ssid, target->ssid, - target->ssid_len), - target->bssid); - libipw_network_reset(target); - } else { - /* Otherwise just pull from the free list */ - target = list_entry(ieee->network_free_list.next, - struct libipw_network, list); - list_del(ieee->network_free_list.next); - } - -#ifdef CONFIG_LIBIPW_DEBUG - LIBIPW_DEBUG_SCAN("Adding '%s' (%pM) via %s.\n", - print_ssid(ssid, network.ssid, - network.ssid_len), - network.bssid, - is_beacon(beacon->header.frame_ctl) ? - "BEACON" : "PROBE RESPONSE"); -#endif - memcpy(target, &network, sizeof(*target)); - network.ibss_dfs = NULL; - list_add_tail(&target->list, &ieee->network_list); - } else { - LIBIPW_DEBUG_SCAN("Updating '%s' (%pM) via %s.\n", - print_ssid(ssid, target->ssid, - target->ssid_len), - target->bssid, - is_beacon(beacon->header.frame_ctl) ? - "BEACON" : "PROBE RESPONSE"); - update_network(target, &network); - network.ibss_dfs = NULL; - } - - spin_unlock_irqrestore(&ieee->lock, flags); - - if (is_beacon(beacon->header.frame_ctl)) { - if (ieee->handle_beacon != NULL) - ieee->handle_beacon(dev, beacon, target); - } else { - if (ieee->handle_probe_response != NULL) - ieee->handle_probe_response(dev, beacon, target); - } -} - -void libipw_rx_mgt(struct libipw_device *ieee, - struct libipw_hdr_4addr *header, - struct libipw_rx_stats *stats) -{ - switch (WLAN_FC_GET_STYPE(le16_to_cpu(header->frame_ctl))) { - case IEEE80211_STYPE_ASSOC_RESP: - LIBIPW_DEBUG_MGMT("received ASSOCIATION RESPONSE (%d)\n", - WLAN_FC_GET_STYPE(le16_to_cpu - (header->frame_ctl))); - libipw_handle_assoc_resp(ieee, - (struct libipw_assoc_response *) - header, stats); - break; - - case IEEE80211_STYPE_REASSOC_RESP: - LIBIPW_DEBUG_MGMT("received REASSOCIATION RESPONSE (%d)\n", - WLAN_FC_GET_STYPE(le16_to_cpu - (header->frame_ctl))); - break; - - case IEEE80211_STYPE_PROBE_REQ: - LIBIPW_DEBUG_MGMT("received auth (%d)\n", - WLAN_FC_GET_STYPE(le16_to_cpu - (header->frame_ctl))); - - if (ieee->handle_probe_request != NULL) - ieee->handle_probe_request(ieee->dev, - (struct - libipw_probe_request *) - header, stats); - break; - - case IEEE80211_STYPE_PROBE_RESP: - LIBIPW_DEBUG_MGMT("received PROBE RESPONSE (%d)\n", - WLAN_FC_GET_STYPE(le16_to_cpu - (header->frame_ctl))); - LIBIPW_DEBUG_SCAN("Probe response\n"); - libipw_process_probe_response(ieee, - (struct - libipw_probe_response *) - header, stats); - break; - - case IEEE80211_STYPE_BEACON: - LIBIPW_DEBUG_MGMT("received BEACON (%d)\n", - WLAN_FC_GET_STYPE(le16_to_cpu - (header->frame_ctl))); - LIBIPW_DEBUG_SCAN("Beacon\n"); - libipw_process_probe_response(ieee, - (struct - libipw_probe_response *) - header, stats); - break; - case IEEE80211_STYPE_AUTH: - - LIBIPW_DEBUG_MGMT("received auth (%d)\n", - WLAN_FC_GET_STYPE(le16_to_cpu - (header->frame_ctl))); - - if (ieee->handle_auth != NULL) - ieee->handle_auth(ieee->dev, - (struct libipw_auth *)header); - break; - - case IEEE80211_STYPE_DISASSOC: - if (ieee->handle_disassoc != NULL) - ieee->handle_disassoc(ieee->dev, - (struct libipw_disassoc *) - header); - break; - - case IEEE80211_STYPE_ACTION: - LIBIPW_DEBUG_MGMT("ACTION\n"); - if (ieee->handle_action) - ieee->handle_action(ieee->dev, - (struct libipw_action *) - header, stats); - break; - - case IEEE80211_STYPE_REASSOC_REQ: - LIBIPW_DEBUG_MGMT("received reassoc (%d)\n", - WLAN_FC_GET_STYPE(le16_to_cpu - (header->frame_ctl))); - - LIBIPW_DEBUG_MGMT("%s: LIBIPW_REASSOC_REQ received\n", - ieee->dev->name); - if (ieee->handle_reassoc_request != NULL) - ieee->handle_reassoc_request(ieee->dev, - (struct libipw_reassoc_request *) - header); - break; - - case IEEE80211_STYPE_ASSOC_REQ: - LIBIPW_DEBUG_MGMT("received assoc (%d)\n", - WLAN_FC_GET_STYPE(le16_to_cpu - (header->frame_ctl))); - - LIBIPW_DEBUG_MGMT("%s: LIBIPW_ASSOC_REQ received\n", - ieee->dev->name); - if (ieee->handle_assoc_request != NULL) - ieee->handle_assoc_request(ieee->dev); - break; - - case IEEE80211_STYPE_DEAUTH: - LIBIPW_DEBUG_MGMT("DEAUTH\n"); - if (ieee->handle_deauth != NULL) - ieee->handle_deauth(ieee->dev, - (struct libipw_deauth *) - header); - break; - default: - LIBIPW_DEBUG_MGMT("received UNKNOWN (%d)\n", - WLAN_FC_GET_STYPE(le16_to_cpu - (header->frame_ctl))); - LIBIPW_DEBUG_MGMT("%s: Unknown management packet: %d\n", - ieee->dev->name, - WLAN_FC_GET_STYPE(le16_to_cpu - (header->frame_ctl))); - break; - } -} - -EXPORT_SYMBOL_GPL(libipw_rx_any); -EXPORT_SYMBOL(libipw_rx_mgt); -EXPORT_SYMBOL(libipw_rx); diff --git a/drivers/net/wireless/ipw2x00/libipw_tx.c b/drivers/net/wireless/ipw2x00/libipw_tx.c deleted file mode 100644 index e8c039879b05..000000000000 --- a/drivers/net/wireless/ipw2x00/libipw_tx.c +++ /dev/null @@ -1,536 +0,0 @@ -/****************************************************************************** - - Copyright(c) 2003 - 2005 Intel 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., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - - Contact Information: - Intel Linux Wireless - Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - -******************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libipw.h" - -/* - -802.11 Data Frame - - ,-------------------------------------------------------------------. -Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | - |------|------|---------|---------|---------|------|---------|------| -Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | - | | tion | (BSSID) | | | ence | data | | - `--------------------------------------------------| |------' -Total: 28 non-data bytes `----.----' - | - .- 'Frame data' expands, if WEP enabled, to <----------' - | - V - ,-----------------------. -Bytes | 4 | 0-2296 | 4 | - |-----|-----------|-----| -Desc. | IV | Encrypted | ICV | - | | Packet | | - `-----| |-----' - `-----.-----' - | - .- 'Encrypted Packet' expands to - | - V - ,---------------------------------------------------. -Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | - |------|------|---------|----------|------|---------| -Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | - | DSAP | SSAP | | | | Packet | - | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | - `---------------------------------------------------- -Total: 8 non-data bytes - -802.3 Ethernet Data Frame - - ,-----------------------------------------. -Bytes | 6 | 6 | 2 | Variable | 4 | - |-------|-------|------|-----------|------| -Desc. | Dest. | Source| Type | IP Packet | fcs | - | MAC | MAC | | | | - `-----------------------------------------' -Total: 18 non-data bytes - -In the event that fragmentation is required, the incoming payload is split into -N parts of size ieee->fts. The first fragment contains the SNAP header and the -remaining packets are just data. - -If encryption is enabled, each fragment payload size is reduced by enough space -to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) -So if you have 1500 bytes of payload with ieee->fts set to 500 without -encryption it will take 3 frames. With WEP it will take 4 frames as the -payload of each frame is reduced to 492 bytes. - -* SKB visualization -* -* ,- skb->data -* | -* | ETHERNET HEADER ,-<-- PAYLOAD -* | | 14 bytes from skb->data -* | 2 bytes for Type --> ,T. | (sizeof ethhdr) -* | | | | -* |,-Dest.--. ,--Src.---. | | | -* | 6 bytes| | 6 bytes | | | | -* v | | | | | | -* 0 | v 1 | v | v 2 -* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 -* ^ | ^ | ^ | -* | | | | | | -* | | | | `T' <---- 2 bytes for Type -* | | | | -* | | '---SNAP--' <-------- 6 bytes for SNAP -* | | -* `-IV--' <-------------------- 4 bytes for IV (WEP) -* -* SNAP HEADER -* -*/ - -static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; -static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; - -static int libipw_copy_snap(u8 * data, __be16 h_proto) -{ - struct libipw_snap_hdr *snap; - u8 *oui; - - snap = (struct libipw_snap_hdr *)data; - snap->dsap = 0xaa; - snap->ssap = 0xaa; - snap->ctrl = 0x03; - - if (h_proto == htons(ETH_P_AARP) || h_proto == htons(ETH_P_IPX)) - oui = P802_1H_OUI; - else - oui = RFC1042_OUI; - snap->oui[0] = oui[0]; - snap->oui[1] = oui[1]; - snap->oui[2] = oui[2]; - - memcpy(data + SNAP_SIZE, &h_proto, sizeof(u16)); - - return SNAP_SIZE + sizeof(u16); -} - -static int libipw_encrypt_fragment(struct libipw_device *ieee, - struct sk_buff *frag, int hdr_len) -{ - struct lib80211_crypt_data *crypt = - ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; - int res; - - if (crypt == NULL) - return -1; - - /* To encrypt, frame format is: - * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ - atomic_inc(&crypt->refcnt); - res = 0; - if (crypt->ops && crypt->ops->encrypt_mpdu) - res = crypt->ops->encrypt_mpdu(frag, hdr_len, crypt->priv); - - atomic_dec(&crypt->refcnt); - if (res < 0) { - printk(KERN_INFO "%s: Encryption failed: len=%d.\n", - ieee->dev->name, frag->len); - ieee->ieee_stats.tx_discards++; - return -1; - } - - return 0; -} - -void libipw_txb_free(struct libipw_txb *txb) -{ - int i; - if (unlikely(!txb)) - return; - for (i = 0; i < txb->nr_frags; i++) - if (txb->fragments[i]) - dev_kfree_skb_any(txb->fragments[i]); - kfree(txb); -} - -static struct libipw_txb *libipw_alloc_txb(int nr_frags, int txb_size, - int headroom, gfp_t gfp_mask) -{ - struct libipw_txb *txb; - int i; - txb = kmalloc(sizeof(struct libipw_txb) + (sizeof(u8 *) * nr_frags), - gfp_mask); - if (!txb) - return NULL; - - memset(txb, 0, sizeof(struct libipw_txb)); - txb->nr_frags = nr_frags; - txb->frag_size = txb_size; - - for (i = 0; i < nr_frags; i++) { - txb->fragments[i] = __dev_alloc_skb(txb_size + headroom, - gfp_mask); - if (unlikely(!txb->fragments[i])) { - i--; - break; - } - skb_reserve(txb->fragments[i], headroom); - } - if (unlikely(i != nr_frags)) { - while (i >= 0) - dev_kfree_skb_any(txb->fragments[i--]); - kfree(txb); - return NULL; - } - return txb; -} - -static int libipw_classify(struct sk_buff *skb) -{ - struct ethhdr *eth; - struct iphdr *ip; - - eth = (struct ethhdr *)skb->data; - if (eth->h_proto != htons(ETH_P_IP)) - return 0; - - ip = ip_hdr(skb); - switch (ip->tos & 0xfc) { - case 0x20: - return 2; - case 0x40: - return 1; - case 0x60: - return 3; - case 0x80: - return 4; - case 0xa0: - return 5; - case 0xc0: - return 6; - case 0xe0: - return 7; - default: - return 0; - } -} - -/* Incoming skb is converted to a txb which consists of - * a block of 802.11 fragment packets (stored as skbs) */ -netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net_device *dev) -{ - struct libipw_device *ieee = netdev_priv(dev); - struct libipw_txb *txb = NULL; - struct libipw_hdr_3addrqos *frag_hdr; - int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size, - rts_required; - unsigned long flags; - int encrypt, host_encrypt, host_encrypt_msdu; - __be16 ether_type; - int bytes, fc, hdr_len; - struct sk_buff *skb_frag; - struct libipw_hdr_3addrqos header = {/* Ensure zero initialized */ - .duration_id = 0, - .seq_ctl = 0, - .qos_ctl = 0 - }; - u8 dest[ETH_ALEN], src[ETH_ALEN]; - struct lib80211_crypt_data *crypt; - int priority = skb->priority; - int snapped = 0; - - if (ieee->is_queue_full && (*ieee->is_queue_full) (dev, priority)) - return NETDEV_TX_BUSY; - - spin_lock_irqsave(&ieee->lock, flags); - - /* If there is no driver handler to take the TXB, dont' bother - * creating it... */ - if (!ieee->hard_start_xmit) { - printk(KERN_WARNING "%s: No xmit handler.\n", ieee->dev->name); - goto success; - } - - if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) { - printk(KERN_WARNING "%s: skb too small (%d).\n", - ieee->dev->name, skb->len); - goto success; - } - - ether_type = ((struct ethhdr *)skb->data)->h_proto; - - crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; - - encrypt = !(ether_type == htons(ETH_P_PAE) && ieee->ieee802_1x) && - ieee->sec.encrypt; - - host_encrypt = ieee->host_encrypt && encrypt && crypt; - host_encrypt_msdu = ieee->host_encrypt_msdu && encrypt && crypt; - - if (!encrypt && ieee->ieee802_1x && - ieee->drop_unencrypted && ether_type != htons(ETH_P_PAE)) { - dev->stats.tx_dropped++; - goto success; - } - - /* Save source and destination addresses */ - skb_copy_from_linear_data(skb, dest, ETH_ALEN); - skb_copy_from_linear_data_offset(skb, ETH_ALEN, src, ETH_ALEN); - - if (host_encrypt) - fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | - IEEE80211_FCTL_PROTECTED; - else - fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA; - - if (ieee->iw_mode == IW_MODE_INFRA) { - fc |= IEEE80211_FCTL_TODS; - /* To DS: Addr1 = BSSID, Addr2 = SA, Addr3 = DA */ - memcpy(header.addr1, ieee->bssid, ETH_ALEN); - memcpy(header.addr2, src, ETH_ALEN); - memcpy(header.addr3, dest, ETH_ALEN); - } else if (ieee->iw_mode == IW_MODE_ADHOC) { - /* not From/To DS: Addr1 = DA, Addr2 = SA, Addr3 = BSSID */ - memcpy(header.addr1, dest, ETH_ALEN); - memcpy(header.addr2, src, ETH_ALEN); - memcpy(header.addr3, ieee->bssid, ETH_ALEN); - } - hdr_len = LIBIPW_3ADDR_LEN; - - if (ieee->is_qos_active && ieee->is_qos_active(dev, skb)) { - fc |= IEEE80211_STYPE_QOS_DATA; - hdr_len += 2; - - skb->priority = libipw_classify(skb); - header.qos_ctl |= cpu_to_le16(skb->priority & LIBIPW_QCTL_TID); - } - header.frame_ctl = cpu_to_le16(fc); - - /* Advance the SKB to the start of the payload */ - skb_pull(skb, sizeof(struct ethhdr)); - - /* Determine total amount of storage required for TXB packets */ - bytes = skb->len + SNAP_SIZE + sizeof(u16); - - /* Encrypt msdu first on the whole data packet. */ - if ((host_encrypt || host_encrypt_msdu) && - crypt && crypt->ops && crypt->ops->encrypt_msdu) { - int res = 0; - int len = bytes + hdr_len + crypt->ops->extra_msdu_prefix_len + - crypt->ops->extra_msdu_postfix_len; - struct sk_buff *skb_new = dev_alloc_skb(len); - - if (unlikely(!skb_new)) - goto failed; - - skb_reserve(skb_new, crypt->ops->extra_msdu_prefix_len); - memcpy(skb_put(skb_new, hdr_len), &header, hdr_len); - snapped = 1; - libipw_copy_snap(skb_put(skb_new, SNAP_SIZE + sizeof(u16)), - ether_type); - skb_copy_from_linear_data(skb, skb_put(skb_new, skb->len), skb->len); - res = crypt->ops->encrypt_msdu(skb_new, hdr_len, crypt->priv); - if (res < 0) { - LIBIPW_ERROR("msdu encryption failed\n"); - dev_kfree_skb_any(skb_new); - goto failed; - } - dev_kfree_skb_any(skb); - skb = skb_new; - bytes += crypt->ops->extra_msdu_prefix_len + - crypt->ops->extra_msdu_postfix_len; - skb_pull(skb, hdr_len); - } - - if (host_encrypt || ieee->host_open_frag) { - /* Determine fragmentation size based on destination (multicast - * and broadcast are not fragmented) */ - if (is_multicast_ether_addr(dest) || - is_broadcast_ether_addr(dest)) - frag_size = MAX_FRAG_THRESHOLD; - else - frag_size = ieee->fts; - - /* Determine amount of payload per fragment. Regardless of if - * this stack is providing the full 802.11 header, one will - * eventually be affixed to this fragment -- so we must account - * for it when determining the amount of payload space. */ - bytes_per_frag = frag_size - hdr_len; - if (ieee->config & - (CFG_LIBIPW_COMPUTE_FCS | CFG_LIBIPW_RESERVE_FCS)) - bytes_per_frag -= LIBIPW_FCS_LEN; - - /* Each fragment may need to have room for encryption - * pre/postfix */ - if (host_encrypt) - bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len + - crypt->ops->extra_mpdu_postfix_len; - - /* Number of fragments is the total - * bytes_per_frag / payload_per_fragment */ - nr_frags = bytes / bytes_per_frag; - bytes_last_frag = bytes % bytes_per_frag; - if (bytes_last_frag) - nr_frags++; - else - bytes_last_frag = bytes_per_frag; - } else { - nr_frags = 1; - bytes_per_frag = bytes_last_frag = bytes; - frag_size = bytes + hdr_len; - } - - rts_required = (frag_size > ieee->rts - && ieee->config & CFG_LIBIPW_RTS); - if (rts_required) - nr_frags++; - - /* When we allocate the TXB we allocate enough space for the reserve - * and full fragment bytes (bytes_per_frag doesn't include prefix, - * postfix, header, FCS, etc.) */ - txb = libipw_alloc_txb(nr_frags, frag_size, - ieee->tx_headroom, GFP_ATOMIC); - if (unlikely(!txb)) { - printk(KERN_WARNING "%s: Could not allocate TXB\n", - ieee->dev->name); - goto failed; - } - txb->encrypted = encrypt; - if (host_encrypt) - txb->payload_size = frag_size * (nr_frags - 1) + - bytes_last_frag; - else - txb->payload_size = bytes; - - if (rts_required) { - skb_frag = txb->fragments[0]; - frag_hdr = - (struct libipw_hdr_3addrqos *)skb_put(skb_frag, hdr_len); - - /* - * Set header frame_ctl to the RTS. - */ - header.frame_ctl = - cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS); - memcpy(frag_hdr, &header, hdr_len); - - /* - * Restore header frame_ctl to the original data setting. - */ - header.frame_ctl = cpu_to_le16(fc); - - if (ieee->config & - (CFG_LIBIPW_COMPUTE_FCS | CFG_LIBIPW_RESERVE_FCS)) - skb_put(skb_frag, 4); - - txb->rts_included = 1; - i = 1; - } else - i = 0; - - for (; i < nr_frags; i++) { - skb_frag = txb->fragments[i]; - - if (host_encrypt) - skb_reserve(skb_frag, - crypt->ops->extra_mpdu_prefix_len); - - frag_hdr = - (struct libipw_hdr_3addrqos *)skb_put(skb_frag, hdr_len); - memcpy(frag_hdr, &header, hdr_len); - - /* If this is not the last fragment, then add the MOREFRAGS - * bit to the frame control */ - if (i != nr_frags - 1) { - frag_hdr->frame_ctl = - cpu_to_le16(fc | IEEE80211_FCTL_MOREFRAGS); - bytes = bytes_per_frag; - } else { - /* The last fragment takes the remaining length */ - bytes = bytes_last_frag; - } - - if (i == 0 && !snapped) { - libipw_copy_snap(skb_put - (skb_frag, SNAP_SIZE + sizeof(u16)), - ether_type); - bytes -= SNAP_SIZE + sizeof(u16); - } - - skb_copy_from_linear_data(skb, skb_put(skb_frag, bytes), bytes); - - /* Advance the SKB... */ - skb_pull(skb, bytes); - - /* Encryption routine will move the header forward in order - * to insert the IV between the header and the payload */ - if (host_encrypt) - libipw_encrypt_fragment(ieee, skb_frag, hdr_len); - - if (ieee->config & - (CFG_LIBIPW_COMPUTE_FCS | CFG_LIBIPW_RESERVE_FCS)) - skb_put(skb_frag, 4); - } - - success: - spin_unlock_irqrestore(&ieee->lock, flags); - - dev_kfree_skb_any(skb); - - if (txb) { - netdev_tx_t ret = (*ieee->hard_start_xmit)(txb, dev, priority); - if (ret == NETDEV_TX_OK) { - dev->stats.tx_packets++; - dev->stats.tx_bytes += txb->payload_size; - return NETDEV_TX_OK; - } - - libipw_txb_free(txb); - } - - return NETDEV_TX_OK; - - failed: - spin_unlock_irqrestore(&ieee->lock, flags); - netif_stop_queue(dev); - dev->stats.tx_errors++; - return NETDEV_TX_BUSY; -} -EXPORT_SYMBOL(libipw_xmit); - -EXPORT_SYMBOL(libipw_txb_free); diff --git a/drivers/net/wireless/ipw2x00/libipw_wx.c b/drivers/net/wireless/ipw2x00/libipw_wx.c deleted file mode 100644 index 54aba4744438..000000000000 --- a/drivers/net/wireless/ipw2x00/libipw_wx.c +++ /dev/null @@ -1,744 +0,0 @@ -/****************************************************************************** - - Copyright(c) 2004-2005 Intel Corporation. All rights reserved. - - Portions of this file are based on the WEP enablement code provided by the - Host AP project hostap-drivers v0.1.3 - Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen - - Copyright (c) 2002-2003, Jouni Malinen - - 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., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - - Contact Information: - Intel Linux Wireless - Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - -******************************************************************************/ - -#include -#include -#include -#include -#include - -#include -#include - -#include "libipw.h" - -static const char *libipw_modes[] = { - "?", "a", "b", "ab", "g", "ag", "bg", "abg" -}; - -static inline unsigned int elapsed_jiffies_msecs(unsigned long start) -{ - unsigned long end = jiffies; - - if (end >= start) - return jiffies_to_msecs(end - start); - - return jiffies_to_msecs(end + (MAX_JIFFY_OFFSET - start) + 1); -} - -#define MAX_CUSTOM_LEN 64 -static char *libipw_translate_scan(struct libipw_device *ieee, - char *start, char *stop, - struct libipw_network *network, - struct iw_request_info *info) -{ - char custom[MAX_CUSTOM_LEN]; - char *p; - struct iw_event iwe; - int i, j; - char *current_val; /* For rates */ - u8 rate; - - /* First entry *MUST* be the AP MAC address */ - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN); - start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_ADDR_LEN); - - /* Remaining entries will be displayed in the order we provide them */ - - /* Add the ESSID */ - iwe.cmd = SIOCGIWESSID; - iwe.u.data.flags = 1; - iwe.u.data.length = min(network->ssid_len, (u8) 32); - start = iwe_stream_add_point(info, start, stop, - &iwe, network->ssid); - - /* Add the protocol name */ - iwe.cmd = SIOCGIWNAME; - snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s", - libipw_modes[network->mode]); - start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_CHAR_LEN); - - /* Add mode */ - iwe.cmd = SIOCGIWMODE; - if (network->capability & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) { - if (network->capability & WLAN_CAPABILITY_ESS) - iwe.u.mode = IW_MODE_MASTER; - else - iwe.u.mode = IW_MODE_ADHOC; - - start = iwe_stream_add_event(info, start, stop, - &iwe, IW_EV_UINT_LEN); - } - - /* Add channel and frequency */ - /* Note : userspace automatically computes channel using iwrange */ - iwe.cmd = SIOCGIWFREQ; - iwe.u.freq.m = libipw_channel_to_freq(ieee, network->channel); - iwe.u.freq.e = 6; - iwe.u.freq.i = 0; - start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_FREQ_LEN); - - /* Add encryption capability */ - iwe.cmd = SIOCGIWENCODE; - if (network->capability & WLAN_CAPABILITY_PRIVACY) - iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - else - iwe.u.data.flags = IW_ENCODE_DISABLED; - iwe.u.data.length = 0; - start = iwe_stream_add_point(info, start, stop, - &iwe, network->ssid); - - /* Add basic and extended rates */ - /* Rate : stuffing multiple values in a single event require a bit - * more of magic - Jean II */ - current_val = start + iwe_stream_lcp_len(info); - iwe.cmd = SIOCGIWRATE; - /* Those two flags are ignored... */ - iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; - - for (i = 0, j = 0; i < network->rates_len;) { - if (j < network->rates_ex_len && - ((network->rates_ex[j] & 0x7F) < - (network->rates[i] & 0x7F))) - rate = network->rates_ex[j++] & 0x7F; - else - rate = network->rates[i++] & 0x7F; - /* Bit rate given in 500 kb/s units (+ 0x80) */ - iwe.u.bitrate.value = ((rate & 0x7f) * 500000); - /* Add new value to event */ - current_val = iwe_stream_add_value(info, start, current_val, - stop, &iwe, IW_EV_PARAM_LEN); - } - for (; j < network->rates_ex_len; j++) { - rate = network->rates_ex[j] & 0x7F; - /* Bit rate given in 500 kb/s units (+ 0x80) */ - iwe.u.bitrate.value = ((rate & 0x7f) * 500000); - /* Add new value to event */ - current_val = iwe_stream_add_value(info, start, current_val, - stop, &iwe, IW_EV_PARAM_LEN); - } - /* Check if we added any rate */ - if ((current_val - start) > iwe_stream_lcp_len(info)) - start = current_val; - - /* Add quality statistics */ - iwe.cmd = IWEVQUAL; - iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_LEVEL_UPDATED | - IW_QUAL_NOISE_UPDATED; - - if (!(network->stats.mask & LIBIPW_STATMASK_RSSI)) { - iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID | - IW_QUAL_LEVEL_INVALID; - iwe.u.qual.qual = 0; - } else { - if (ieee->perfect_rssi == ieee->worst_rssi) - iwe.u.qual.qual = 100; - else - iwe.u.qual.qual = - (100 * - (ieee->perfect_rssi - ieee->worst_rssi) * - (ieee->perfect_rssi - ieee->worst_rssi) - - (ieee->perfect_rssi - network->stats.rssi) * - (15 * (ieee->perfect_rssi - ieee->worst_rssi) + - 62 * (ieee->perfect_rssi - - network->stats.rssi))) / - ((ieee->perfect_rssi - - ieee->worst_rssi) * (ieee->perfect_rssi - - ieee->worst_rssi)); - if (iwe.u.qual.qual > 100) - iwe.u.qual.qual = 100; - else if (iwe.u.qual.qual < 1) - iwe.u.qual.qual = 0; - } - - if (!(network->stats.mask & LIBIPW_STATMASK_NOISE)) { - iwe.u.qual.updated |= IW_QUAL_NOISE_INVALID; - iwe.u.qual.noise = 0; - } else { - iwe.u.qual.noise = network->stats.noise; - } - - if (!(network->stats.mask & LIBIPW_STATMASK_SIGNAL)) { - iwe.u.qual.updated |= IW_QUAL_LEVEL_INVALID; - iwe.u.qual.level = 0; - } else { - iwe.u.qual.level = network->stats.signal; - } - - start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN); - - iwe.cmd = IWEVCUSTOM; - p = custom; - - iwe.u.data.length = p - custom; - if (iwe.u.data.length) - start = iwe_stream_add_point(info, start, stop, &iwe, custom); - - memset(&iwe, 0, sizeof(iwe)); - if (network->wpa_ie_len) { - char buf[MAX_WPA_IE_LEN]; - memcpy(buf, network->wpa_ie, network->wpa_ie_len); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = network->wpa_ie_len; - start = iwe_stream_add_point(info, start, stop, &iwe, buf); - } - - memset(&iwe, 0, sizeof(iwe)); - if (network->rsn_ie_len) { - char buf[MAX_WPA_IE_LEN]; - memcpy(buf, network->rsn_ie, network->rsn_ie_len); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = network->rsn_ie_len; - start = iwe_stream_add_point(info, start, stop, &iwe, buf); - } - - /* Add EXTRA: Age to display seconds since last beacon/probe response - * for given network. */ - iwe.cmd = IWEVCUSTOM; - p = custom; - p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), - " Last beacon: %ums ago", - elapsed_jiffies_msecs(network->last_scanned)); - iwe.u.data.length = p - custom; - if (iwe.u.data.length) - start = iwe_stream_add_point(info, start, stop, &iwe, custom); - - /* Add spectrum management information */ - iwe.cmd = -1; - p = custom; - p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Channel flags: "); - - if (libipw_get_channel_flags(ieee, network->channel) & - LIBIPW_CH_INVALID) { - iwe.cmd = IWEVCUSTOM; - p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), "INVALID "); - } - - if (libipw_get_channel_flags(ieee, network->channel) & - LIBIPW_CH_RADAR_DETECT) { - iwe.cmd = IWEVCUSTOM; - p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), "DFS "); - } - - if (iwe.cmd == IWEVCUSTOM) { - iwe.u.data.length = p - custom; - start = iwe_stream_add_point(info, start, stop, &iwe, custom); - } - - return start; -} - -#define SCAN_ITEM_SIZE 128 - -int libipw_wx_get_scan(struct libipw_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct libipw_network *network; - unsigned long flags; - int err = 0; - - char *ev = extra; - char *stop = ev + wrqu->data.length; - int i = 0; - DECLARE_SSID_BUF(ssid); - - LIBIPW_DEBUG_WX("Getting scan\n"); - - spin_lock_irqsave(&ieee->lock, flags); - - list_for_each_entry(network, &ieee->network_list, list) { - i++; - if (stop - ev < SCAN_ITEM_SIZE) { - err = -E2BIG; - break; - } - - if (ieee->scan_age == 0 || - time_after(network->last_scanned + ieee->scan_age, jiffies)) - ev = libipw_translate_scan(ieee, ev, stop, network, - info); - else { - LIBIPW_DEBUG_SCAN("Not showing network '%s (" - "%pM)' due to age (%ums).\n", - print_ssid(ssid, network->ssid, - network->ssid_len), - network->bssid, - elapsed_jiffies_msecs( - network->last_scanned)); - } - } - - spin_unlock_irqrestore(&ieee->lock, flags); - - wrqu->data.length = ev - extra; - wrqu->data.flags = 0; - - LIBIPW_DEBUG_WX("exit: %d networks returned.\n", i); - - return err; -} - -int libipw_wx_set_encode(struct libipw_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *keybuf) -{ - struct iw_point *erq = &(wrqu->encoding); - struct net_device *dev = ieee->dev; - struct libipw_security sec = { - .flags = 0 - }; - int i, key, key_provided, len; - struct lib80211_crypt_data **crypt; - int host_crypto = ieee->host_encrypt || ieee->host_decrypt; - DECLARE_SSID_BUF(ssid); - - LIBIPW_DEBUG_WX("SET_ENCODE\n"); - - key = erq->flags & IW_ENCODE_INDEX; - if (key) { - if (key > WEP_KEYS) - return -EINVAL; - key--; - key_provided = 1; - } else { - key_provided = 0; - key = ieee->crypt_info.tx_keyidx; - } - - LIBIPW_DEBUG_WX("Key: %d [%s]\n", key, key_provided ? - "provided" : "default"); - - crypt = &ieee->crypt_info.crypt[key]; - - if (erq->flags & IW_ENCODE_DISABLED) { - if (key_provided && *crypt) { - LIBIPW_DEBUG_WX("Disabling encryption on key %d.\n", - key); - lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); - } else - LIBIPW_DEBUG_WX("Disabling encryption.\n"); - - /* Check all the keys to see if any are still configured, - * and if no key index was provided, de-init them all */ - for (i = 0; i < WEP_KEYS; i++) { - if (ieee->crypt_info.crypt[i] != NULL) { - if (key_provided) - break; - lib80211_crypt_delayed_deinit(&ieee->crypt_info, - &ieee->crypt_info.crypt[i]); - } - } - - if (i == WEP_KEYS) { - sec.enabled = 0; - sec.encrypt = 0; - sec.level = SEC_LEVEL_0; - sec.flags |= SEC_ENABLED | SEC_LEVEL | SEC_ENCRYPT; - } - - goto done; - } - - sec.enabled = 1; - sec.encrypt = 1; - sec.flags |= SEC_ENABLED | SEC_ENCRYPT; - - if (*crypt != NULL && (*crypt)->ops != NULL && - strcmp((*crypt)->ops->name, "WEP") != 0) { - /* changing to use WEP; deinit previously used algorithm - * on this key */ - lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); - } - - if (*crypt == NULL && host_crypto) { - struct lib80211_crypt_data *new_crypt; - - /* take WEP into use */ - new_crypt = kzalloc(sizeof(struct lib80211_crypt_data), - GFP_KERNEL); - if (new_crypt == NULL) - return -ENOMEM; - new_crypt->ops = lib80211_get_crypto_ops("WEP"); - if (!new_crypt->ops) { - request_module("lib80211_crypt_wep"); - new_crypt->ops = lib80211_get_crypto_ops("WEP"); - } - - if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) - new_crypt->priv = new_crypt->ops->init(key); - - if (!new_crypt->ops || !new_crypt->priv) { - kfree(new_crypt); - new_crypt = NULL; - - printk(KERN_WARNING "%s: could not initialize WEP: " - "load module lib80211_crypt_wep\n", dev->name); - return -EOPNOTSUPP; - } - *crypt = new_crypt; - } - - /* If a new key was provided, set it up */ - if (erq->length > 0) { - len = erq->length <= 5 ? 5 : 13; - memcpy(sec.keys[key], keybuf, erq->length); - if (len > erq->length) - memset(sec.keys[key] + erq->length, 0, - len - erq->length); - LIBIPW_DEBUG_WX("Setting key %d to '%s' (%d:%d bytes)\n", - key, print_ssid(ssid, sec.keys[key], len), - erq->length, len); - sec.key_sizes[key] = len; - if (*crypt) - (*crypt)->ops->set_key(sec.keys[key], len, NULL, - (*crypt)->priv); - sec.flags |= (1 << key); - /* This ensures a key will be activated if no key is - * explicitly set */ - if (key == sec.active_key) - sec.flags |= SEC_ACTIVE_KEY; - - } else { - if (host_crypto) { - len = (*crypt)->ops->get_key(sec.keys[key], WEP_KEY_LEN, - NULL, (*crypt)->priv); - if (len == 0) { - /* Set a default key of all 0 */ - LIBIPW_DEBUG_WX("Setting key %d to all " - "zero.\n", key); - memset(sec.keys[key], 0, 13); - (*crypt)->ops->set_key(sec.keys[key], 13, NULL, - (*crypt)->priv); - sec.key_sizes[key] = 13; - sec.flags |= (1 << key); - } - } - /* No key data - just set the default TX key index */ - if (key_provided) { - LIBIPW_DEBUG_WX("Setting key %d to default Tx " - "key.\n", key); - ieee->crypt_info.tx_keyidx = key; - sec.active_key = key; - sec.flags |= SEC_ACTIVE_KEY; - } - } - if (erq->flags & (IW_ENCODE_OPEN | IW_ENCODE_RESTRICTED)) { - ieee->open_wep = !(erq->flags & IW_ENCODE_RESTRICTED); - sec.auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : - WLAN_AUTH_SHARED_KEY; - sec.flags |= SEC_AUTH_MODE; - LIBIPW_DEBUG_WX("Auth: %s\n", - sec.auth_mode == WLAN_AUTH_OPEN ? - "OPEN" : "SHARED KEY"); - } - - /* For now we just support WEP, so only set that security level... - * TODO: When WPA is added this is one place that needs to change */ - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */ - sec.encode_alg[key] = SEC_ALG_WEP; - - done: - if (ieee->set_security) - ieee->set_security(dev, &sec); - - return 0; -} - -int libipw_wx_get_encode(struct libipw_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *keybuf) -{ - struct iw_point *erq = &(wrqu->encoding); - int len, key; - struct lib80211_crypt_data *crypt; - struct libipw_security *sec = &ieee->sec; - - LIBIPW_DEBUG_WX("GET_ENCODE\n"); - - key = erq->flags & IW_ENCODE_INDEX; - if (key) { - if (key > WEP_KEYS) - return -EINVAL; - key--; - } else - key = ieee->crypt_info.tx_keyidx; - - crypt = ieee->crypt_info.crypt[key]; - erq->flags = key + 1; - - if (!sec->enabled) { - erq->length = 0; - erq->flags |= IW_ENCODE_DISABLED; - return 0; - } - - len = sec->key_sizes[key]; - memcpy(keybuf, sec->keys[key], len); - - erq->length = len; - erq->flags |= IW_ENCODE_ENABLED; - - if (ieee->open_wep) - erq->flags |= IW_ENCODE_OPEN; - else - erq->flags |= IW_ENCODE_RESTRICTED; - - return 0; -} - -int libipw_wx_set_encodeext(struct libipw_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct net_device *dev = ieee->dev; - struct iw_point *encoding = &wrqu->encoding; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int i, idx, ret = 0; - int group_key = 0; - const char *alg, *module; - struct lib80211_crypto_ops *ops; - struct lib80211_crypt_data **crypt; - - struct libipw_security sec = { - .flags = 0, - }; - - idx = encoding->flags & IW_ENCODE_INDEX; - if (idx) { - if (idx < 1 || idx > WEP_KEYS) - return -EINVAL; - idx--; - } else - idx = ieee->crypt_info.tx_keyidx; - - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - crypt = &ieee->crypt_info.crypt[idx]; - group_key = 1; - } else { - /* some Cisco APs use idx>0 for unicast in dynamic WEP */ - if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) - return -EINVAL; - if (ieee->iw_mode == IW_MODE_INFRA) - crypt = &ieee->crypt_info.crypt[idx]; - else - return -EINVAL; - } - - sec.flags |= SEC_ENABLED | SEC_ENCRYPT; - if ((encoding->flags & IW_ENCODE_DISABLED) || - ext->alg == IW_ENCODE_ALG_NONE) { - if (*crypt) - lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); - - for (i = 0; i < WEP_KEYS; i++) - if (ieee->crypt_info.crypt[i] != NULL) - break; - - if (i == WEP_KEYS) { - sec.enabled = 0; - sec.encrypt = 0; - sec.level = SEC_LEVEL_0; - sec.flags |= SEC_LEVEL; - } - goto done; - } - - sec.enabled = 1; - sec.encrypt = 1; - - if (group_key ? !ieee->host_mc_decrypt : - !(ieee->host_encrypt || ieee->host_decrypt || - ieee->host_encrypt_msdu)) - goto skip_host_crypt; - - switch (ext->alg) { - case IW_ENCODE_ALG_WEP: - alg = "WEP"; - module = "lib80211_crypt_wep"; - break; - case IW_ENCODE_ALG_TKIP: - alg = "TKIP"; - module = "lib80211_crypt_tkip"; - break; - case IW_ENCODE_ALG_CCMP: - alg = "CCMP"; - module = "lib80211_crypt_ccmp"; - break; - default: - LIBIPW_DEBUG_WX("%s: unknown crypto alg %d\n", - dev->name, ext->alg); - ret = -EINVAL; - goto done; - } - - ops = lib80211_get_crypto_ops(alg); - if (ops == NULL) { - request_module(module); - ops = lib80211_get_crypto_ops(alg); - } - if (ops == NULL) { - LIBIPW_DEBUG_WX("%s: unknown crypto alg %d\n", - dev->name, ext->alg); - ret = -EINVAL; - goto done; - } - - if (*crypt == NULL || (*crypt)->ops != ops) { - struct lib80211_crypt_data *new_crypt; - - lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); - - new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); - if (new_crypt == NULL) { - ret = -ENOMEM; - goto done; - } - new_crypt->ops = ops; - if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) - new_crypt->priv = new_crypt->ops->init(idx); - if (new_crypt->priv == NULL) { - kfree(new_crypt); - ret = -EINVAL; - goto done; - } - *crypt = new_crypt; - } - - if (ext->key_len > 0 && (*crypt)->ops->set_key && - (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq, - (*crypt)->priv) < 0) { - LIBIPW_DEBUG_WX("%s: key setting failed\n", dev->name); - ret = -EINVAL; - goto done; - } - - skip_host_crypt: - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - ieee->crypt_info.tx_keyidx = idx; - sec.active_key = idx; - sec.flags |= SEC_ACTIVE_KEY; - } - - if (ext->alg != IW_ENCODE_ALG_NONE) { - memcpy(sec.keys[idx], ext->key, ext->key_len); - sec.key_sizes[idx] = ext->key_len; - sec.flags |= (1 << idx); - if (ext->alg == IW_ENCODE_ALG_WEP) { - sec.encode_alg[idx] = SEC_ALG_WEP; - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_1; - } else if (ext->alg == IW_ENCODE_ALG_TKIP) { - sec.encode_alg[idx] = SEC_ALG_TKIP; - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_2; - } else if (ext->alg == IW_ENCODE_ALG_CCMP) { - sec.encode_alg[idx] = SEC_ALG_CCMP; - sec.flags |= SEC_LEVEL; - sec.level = SEC_LEVEL_3; - } - /* Don't set sec level for group keys. */ - if (group_key) - sec.flags &= ~SEC_LEVEL; - } - done: - if (ieee->set_security) - ieee->set_security(dev, &sec); - - return ret; -} - -int libipw_wx_get_encodeext(struct libipw_device *ieee, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct iw_point *encoding = &wrqu->encoding; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - struct libipw_security *sec = &ieee->sec; - int idx, max_key_len; - - max_key_len = encoding->length - sizeof(*ext); - if (max_key_len < 0) - return -EINVAL; - - idx = encoding->flags & IW_ENCODE_INDEX; - if (idx) { - if (idx < 1 || idx > WEP_KEYS) - return -EINVAL; - idx--; - } else - idx = ieee->crypt_info.tx_keyidx; - - if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) && - ext->alg != IW_ENCODE_ALG_WEP) - if (idx != 0 || ieee->iw_mode != IW_MODE_INFRA) - return -EINVAL; - - encoding->flags = idx + 1; - memset(ext, 0, sizeof(*ext)); - - if (!sec->enabled) { - ext->alg = IW_ENCODE_ALG_NONE; - ext->key_len = 0; - encoding->flags |= IW_ENCODE_DISABLED; - } else { - if (sec->encode_alg[idx] == SEC_ALG_WEP) - ext->alg = IW_ENCODE_ALG_WEP; - else if (sec->encode_alg[idx] == SEC_ALG_TKIP) - ext->alg = IW_ENCODE_ALG_TKIP; - else if (sec->encode_alg[idx] == SEC_ALG_CCMP) - ext->alg = IW_ENCODE_ALG_CCMP; - else - return -EINVAL; - - ext->key_len = sec->key_sizes[idx]; - memcpy(ext->key, sec->keys[idx], ext->key_len); - encoding->flags |= IW_ENCODE_ENABLED; - if (ext->key_len && - (ext->alg == IW_ENCODE_ALG_TKIP || - ext->alg == IW_ENCODE_ALG_CCMP)) - ext->ext_flags |= IW_ENCODE_EXT_TX_SEQ_VALID; - - } - - return 0; -} - -EXPORT_SYMBOL(libipw_wx_set_encodeext); -EXPORT_SYMBOL(libipw_wx_get_encodeext); - -EXPORT_SYMBOL(libipw_wx_get_scan); -EXPORT_SYMBOL(libipw_wx_set_encode); -EXPORT_SYMBOL(libipw_wx_get_encode); diff --git a/drivers/net/wireless/iwlegacy/3945-debug.c b/drivers/net/wireless/iwlegacy/3945-debug.c deleted file mode 100644 index f767dd106b09..000000000000 --- a/drivers/net/wireless/iwlegacy/3945-debug.c +++ /dev/null @@ -1,511 +0,0 @@ -/****************************************************************************** - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called LICENSE.GPL. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - *****************************************************************************/ - -#include "common.h" -#include "3945.h" - -static int -il3945_stats_flag(struct il_priv *il, char *buf, int bufsz) -{ - int p = 0; - - p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", - le32_to_cpu(il->_3945.stats.flag)); - if (le32_to_cpu(il->_3945.stats.flag) & UCODE_STATS_CLEAR_MSK) - p += scnprintf(buf + p, bufsz - p, - "\tStatistics have been cleared\n"); - p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n", - (le32_to_cpu(il->_3945.stats.flag) & - UCODE_STATS_FREQUENCY_MSK) ? "2.4 GHz" : "5.2 GHz"); - p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n", - (le32_to_cpu(il->_3945.stats.flag) & - UCODE_STATS_NARROW_BAND_MSK) ? "enabled" : "disabled"); - return p; -} - -ssize_t -il3945_ucode_rx_stats_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - int pos = 0; - char *buf; - int bufsz = - sizeof(struct iwl39_stats_rx_phy) * 40 + - sizeof(struct iwl39_stats_rx_non_phy) * 40 + 400; - ssize_t ret; - struct iwl39_stats_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm; - struct iwl39_stats_rx_phy *cck, *accum_cck, *delta_cck, *max_cck; - struct iwl39_stats_rx_non_phy *general, *accum_general; - struct iwl39_stats_rx_non_phy *delta_general, *max_general; - - if (!il_is_alive(il)) - return -EAGAIN; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) { - IL_ERR("Can not allocate Buffer\n"); - return -ENOMEM; - } - - /* - * The statistic information display here is based on - * the last stats notification from uCode - * might not reflect the current uCode activity - */ - ofdm = &il->_3945.stats.rx.ofdm; - cck = &il->_3945.stats.rx.cck; - general = &il->_3945.stats.rx.general; - accum_ofdm = &il->_3945.accum_stats.rx.ofdm; - accum_cck = &il->_3945.accum_stats.rx.cck; - accum_general = &il->_3945.accum_stats.rx.general; - delta_ofdm = &il->_3945.delta_stats.rx.ofdm; - delta_cck = &il->_3945.delta_stats.rx.cck; - delta_general = &il->_3945.delta_stats.rx.general; - max_ofdm = &il->_3945.max_delta.rx.ofdm; - max_cck = &il->_3945.max_delta.rx.cck; - max_general = &il->_3945.max_delta.rx.general; - - pos += il3945_stats_flag(il, buf, bufsz); - pos += - scnprintf(buf + pos, bufsz - pos, - "%-32s current" - "acumulative delta max\n", - "Statistics_Rx - OFDM:"); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "ina_cnt:", - le32_to_cpu(ofdm->ina_cnt), accum_ofdm->ina_cnt, - delta_ofdm->ina_cnt, max_ofdm->ina_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "fina_cnt:", - le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt, - delta_ofdm->fina_cnt, max_ofdm->fina_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "plcp_err:", - le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err, - delta_ofdm->plcp_err, max_ofdm->plcp_err); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "crc32_err:", - le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err, - delta_ofdm->crc32_err, max_ofdm->crc32_err); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "overrun_err:", - le32_to_cpu(ofdm->overrun_err), accum_ofdm->overrun_err, - delta_ofdm->overrun_err, max_ofdm->overrun_err); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "early_overrun_err:", - le32_to_cpu(ofdm->early_overrun_err), - accum_ofdm->early_overrun_err, - delta_ofdm->early_overrun_err, - max_ofdm->early_overrun_err); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "crc32_good:", - le32_to_cpu(ofdm->crc32_good), accum_ofdm->crc32_good, - delta_ofdm->crc32_good, max_ofdm->crc32_good); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "false_alarm_cnt:", - le32_to_cpu(ofdm->false_alarm_cnt), - accum_ofdm->false_alarm_cnt, delta_ofdm->false_alarm_cnt, - max_ofdm->false_alarm_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "fina_sync_err_cnt:", - le32_to_cpu(ofdm->fina_sync_err_cnt), - accum_ofdm->fina_sync_err_cnt, - delta_ofdm->fina_sync_err_cnt, - max_ofdm->fina_sync_err_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "sfd_timeout:", - le32_to_cpu(ofdm->sfd_timeout), accum_ofdm->sfd_timeout, - delta_ofdm->sfd_timeout, max_ofdm->sfd_timeout); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "fina_timeout:", - le32_to_cpu(ofdm->fina_timeout), accum_ofdm->fina_timeout, - delta_ofdm->fina_timeout, max_ofdm->fina_timeout); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "unresponded_rts:", - le32_to_cpu(ofdm->unresponded_rts), - accum_ofdm->unresponded_rts, delta_ofdm->unresponded_rts, - max_ofdm->unresponded_rts); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", - "rxe_frame_lmt_ovrun:", - le32_to_cpu(ofdm->rxe_frame_limit_overrun), - accum_ofdm->rxe_frame_limit_overrun, - delta_ofdm->rxe_frame_limit_overrun, - max_ofdm->rxe_frame_limit_overrun); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "sent_ack_cnt:", - le32_to_cpu(ofdm->sent_ack_cnt), accum_ofdm->sent_ack_cnt, - delta_ofdm->sent_ack_cnt, max_ofdm->sent_ack_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "sent_cts_cnt:", - le32_to_cpu(ofdm->sent_cts_cnt), accum_ofdm->sent_cts_cnt, - delta_ofdm->sent_cts_cnt, max_ofdm->sent_cts_cnt); - - pos += - scnprintf(buf + pos, bufsz - pos, - "%-32s current" - "acumulative delta max\n", - "Statistics_Rx - CCK:"); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "ina_cnt:", - le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt, - delta_cck->ina_cnt, max_cck->ina_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "fina_cnt:", - le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt, - delta_cck->fina_cnt, max_cck->fina_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "plcp_err:", - le32_to_cpu(cck->plcp_err), accum_cck->plcp_err, - delta_cck->plcp_err, max_cck->plcp_err); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "crc32_err:", - le32_to_cpu(cck->crc32_err), accum_cck->crc32_err, - delta_cck->crc32_err, max_cck->crc32_err); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "overrun_err:", - le32_to_cpu(cck->overrun_err), accum_cck->overrun_err, - delta_cck->overrun_err, max_cck->overrun_err); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "early_overrun_err:", - le32_to_cpu(cck->early_overrun_err), - accum_cck->early_overrun_err, - delta_cck->early_overrun_err, max_cck->early_overrun_err); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "crc32_good:", - le32_to_cpu(cck->crc32_good), accum_cck->crc32_good, - delta_cck->crc32_good, max_cck->crc32_good); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "false_alarm_cnt:", - le32_to_cpu(cck->false_alarm_cnt), - accum_cck->false_alarm_cnt, delta_cck->false_alarm_cnt, - max_cck->false_alarm_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "fina_sync_err_cnt:", - le32_to_cpu(cck->fina_sync_err_cnt), - accum_cck->fina_sync_err_cnt, - delta_cck->fina_sync_err_cnt, max_cck->fina_sync_err_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "sfd_timeout:", - le32_to_cpu(cck->sfd_timeout), accum_cck->sfd_timeout, - delta_cck->sfd_timeout, max_cck->sfd_timeout); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "fina_timeout:", - le32_to_cpu(cck->fina_timeout), accum_cck->fina_timeout, - delta_cck->fina_timeout, max_cck->fina_timeout); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "unresponded_rts:", - le32_to_cpu(cck->unresponded_rts), - accum_cck->unresponded_rts, delta_cck->unresponded_rts, - max_cck->unresponded_rts); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", - "rxe_frame_lmt_ovrun:", - le32_to_cpu(cck->rxe_frame_limit_overrun), - accum_cck->rxe_frame_limit_overrun, - delta_cck->rxe_frame_limit_overrun, - max_cck->rxe_frame_limit_overrun); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "sent_ack_cnt:", - le32_to_cpu(cck->sent_ack_cnt), accum_cck->sent_ack_cnt, - delta_cck->sent_ack_cnt, max_cck->sent_ack_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "sent_cts_cnt:", - le32_to_cpu(cck->sent_cts_cnt), accum_cck->sent_cts_cnt, - delta_cck->sent_cts_cnt, max_cck->sent_cts_cnt); - - pos += - scnprintf(buf + pos, bufsz - pos, - "%-32s current" - "acumulative delta max\n", - "Statistics_Rx - GENERAL:"); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "bogus_cts:", - le32_to_cpu(general->bogus_cts), accum_general->bogus_cts, - delta_general->bogus_cts, max_general->bogus_cts); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "bogus_ack:", - le32_to_cpu(general->bogus_ack), accum_general->bogus_ack, - delta_general->bogus_ack, max_general->bogus_ack); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "non_bssid_frames:", - le32_to_cpu(general->non_bssid_frames), - accum_general->non_bssid_frames, - delta_general->non_bssid_frames, - max_general->non_bssid_frames); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "filtered_frames:", - le32_to_cpu(general->filtered_frames), - accum_general->filtered_frames, - delta_general->filtered_frames, - max_general->filtered_frames); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", - "non_channel_beacons:", - le32_to_cpu(general->non_channel_beacons), - accum_general->non_channel_beacons, - delta_general->non_channel_beacons, - max_general->non_channel_beacons); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -ssize_t -il3945_ucode_tx_stats_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - int pos = 0; - char *buf; - int bufsz = (sizeof(struct iwl39_stats_tx) * 48) + 250; - ssize_t ret; - struct iwl39_stats_tx *tx, *accum_tx, *delta_tx, *max_tx; - - if (!il_is_alive(il)) - return -EAGAIN; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) { - IL_ERR("Can not allocate Buffer\n"); - return -ENOMEM; - } - - /* - * The statistic information display here is based on - * the last stats notification from uCode - * might not reflect the current uCode activity - */ - tx = &il->_3945.stats.tx; - accum_tx = &il->_3945.accum_stats.tx; - delta_tx = &il->_3945.delta_stats.tx; - max_tx = &il->_3945.max_delta.tx; - pos += il3945_stats_flag(il, buf, bufsz); - pos += - scnprintf(buf + pos, bufsz - pos, - "%-32s current" - "acumulative delta max\n", - "Statistics_Tx:"); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "preamble:", - le32_to_cpu(tx->preamble_cnt), accum_tx->preamble_cnt, - delta_tx->preamble_cnt, max_tx->preamble_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "rx_detected_cnt:", - le32_to_cpu(tx->rx_detected_cnt), - accum_tx->rx_detected_cnt, delta_tx->rx_detected_cnt, - max_tx->rx_detected_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "bt_prio_defer_cnt:", - le32_to_cpu(tx->bt_prio_defer_cnt), - accum_tx->bt_prio_defer_cnt, delta_tx->bt_prio_defer_cnt, - max_tx->bt_prio_defer_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "bt_prio_kill_cnt:", - le32_to_cpu(tx->bt_prio_kill_cnt), - accum_tx->bt_prio_kill_cnt, delta_tx->bt_prio_kill_cnt, - max_tx->bt_prio_kill_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "few_bytes_cnt:", - le32_to_cpu(tx->few_bytes_cnt), accum_tx->few_bytes_cnt, - delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "cts_timeout:", - le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout, - delta_tx->cts_timeout, max_tx->cts_timeout); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "ack_timeout:", - le32_to_cpu(tx->ack_timeout), accum_tx->ack_timeout, - delta_tx->ack_timeout, max_tx->ack_timeout); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "expected_ack_cnt:", - le32_to_cpu(tx->expected_ack_cnt), - accum_tx->expected_ack_cnt, delta_tx->expected_ack_cnt, - max_tx->expected_ack_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "actual_ack_cnt:", - le32_to_cpu(tx->actual_ack_cnt), accum_tx->actual_ack_cnt, - delta_tx->actual_ack_cnt, max_tx->actual_ack_cnt); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -ssize_t -il3945_ucode_general_stats_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - int pos = 0; - char *buf; - int bufsz = sizeof(struct iwl39_stats_general) * 10 + 300; - ssize_t ret; - struct iwl39_stats_general *general, *accum_general; - struct iwl39_stats_general *delta_general, *max_general; - struct stats_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; - struct iwl39_stats_div *div, *accum_div, *delta_div, *max_div; - - if (!il_is_alive(il)) - return -EAGAIN; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) { - IL_ERR("Can not allocate Buffer\n"); - return -ENOMEM; - } - - /* - * The statistic information display here is based on - * the last stats notification from uCode - * might not reflect the current uCode activity - */ - general = &il->_3945.stats.general; - dbg = &il->_3945.stats.general.dbg; - div = &il->_3945.stats.general.div; - accum_general = &il->_3945.accum_stats.general; - delta_general = &il->_3945.delta_stats.general; - max_general = &il->_3945.max_delta.general; - accum_dbg = &il->_3945.accum_stats.general.dbg; - delta_dbg = &il->_3945.delta_stats.general.dbg; - max_dbg = &il->_3945.max_delta.general.dbg; - accum_div = &il->_3945.accum_stats.general.div; - delta_div = &il->_3945.delta_stats.general.div; - max_div = &il->_3945.max_delta.general.div; - pos += il3945_stats_flag(il, buf, bufsz); - pos += - scnprintf(buf + pos, bufsz - pos, - "%-32s current" - "acumulative delta max\n", - "Statistics_General:"); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "burst_check:", - le32_to_cpu(dbg->burst_check), accum_dbg->burst_check, - delta_dbg->burst_check, max_dbg->burst_check); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "burst_count:", - le32_to_cpu(dbg->burst_count), accum_dbg->burst_count, - delta_dbg->burst_count, max_dbg->burst_count); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "sleep_time:", - le32_to_cpu(general->sleep_time), - accum_general->sleep_time, delta_general->sleep_time, - max_general->sleep_time); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "slots_out:", - le32_to_cpu(general->slots_out), accum_general->slots_out, - delta_general->slots_out, max_general->slots_out); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "slots_idle:", - le32_to_cpu(general->slots_idle), - accum_general->slots_idle, delta_general->slots_idle, - max_general->slots_idle); - pos += - scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n", - le32_to_cpu(general->ttl_timestamp)); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "tx_on_a:", - le32_to_cpu(div->tx_on_a), accum_div->tx_on_a, - delta_div->tx_on_a, max_div->tx_on_a); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "tx_on_b:", - le32_to_cpu(div->tx_on_b), accum_div->tx_on_b, - delta_div->tx_on_b, max_div->tx_on_b); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "exec_time:", - le32_to_cpu(div->exec_time), accum_div->exec_time, - delta_div->exec_time, max_div->exec_time); - pos += - scnprintf(buf + pos, bufsz - pos, - " %-30s %10u %10u %10u %10u\n", "probe_time:", - le32_to_cpu(div->probe_time), accum_div->probe_time, - delta_div->probe_time, max_div->probe_time); - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -const struct il_debugfs_ops il3945_debugfs_ops = { - .rx_stats_read = il3945_ucode_rx_stats_read, - .tx_stats_read = il3945_ucode_tx_stats_read, - .general_stats_read = il3945_ucode_general_stats_read, -}; diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c deleted file mode 100644 index b37a582ccbe7..000000000000 --- a/drivers/net/wireless/iwlegacy/3945-mac.c +++ /dev/null @@ -1,3966 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portions of the ieee80211 subsystem header files. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#define DRV_NAME "iwl3945" - -#include "commands.h" -#include "common.h" -#include "3945.h" -#include "iwl-spectrum.h" - -/* - * module name, copyright, version, etc. - */ - -#define DRV_DESCRIPTION \ -"Intel(R) PRO/Wireless 3945ABG/BG Network Connection driver for Linux" - -#ifdef CONFIG_IWLEGACY_DEBUG -#define VD "d" -#else -#define VD -#endif - -/* - * add "s" to indicate spectrum measurement included. - * we add it here to be consistent with previous releases in which - * this was configurable. - */ -#define DRV_VERSION IWLWIFI_VERSION VD "s" -#define DRV_COPYRIGHT "Copyright(c) 2003-2011 Intel Corporation" -#define DRV_AUTHOR "" - -MODULE_DESCRIPTION(DRV_DESCRIPTION); -MODULE_VERSION(DRV_VERSION); -MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); -MODULE_LICENSE("GPL"); - - /* module parameters */ -struct il_mod_params il3945_mod_params = { - .sw_crypto = 1, - .restart_fw = 1, - .disable_hw_scan = 1, - /* the rest are 0 by default */ -}; - -/** - * il3945_get_antenna_flags - Get antenna flags for RXON command - * @il: eeprom and antenna fields are used to determine antenna flags - * - * il->eeprom39 is used to determine if antenna AUX/MAIN are reversed - * il3945_mod_params.antenna specifies the antenna diversity mode: - * - * IL_ANTENNA_DIVERSITY - NIC selects best antenna by itself - * IL_ANTENNA_MAIN - Force MAIN antenna - * IL_ANTENNA_AUX - Force AUX antenna - */ -__le32 -il3945_get_antenna_flags(const struct il_priv *il) -{ - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; - - switch (il3945_mod_params.antenna) { - case IL_ANTENNA_DIVERSITY: - return 0; - - case IL_ANTENNA_MAIN: - if (eeprom->antenna_switch_type) - return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK; - return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK; - - case IL_ANTENNA_AUX: - if (eeprom->antenna_switch_type) - return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK; - return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK; - } - - /* bad antenna selector value */ - IL_ERR("Bad antenna selector value (0x%x)\n", - il3945_mod_params.antenna); - - return 0; /* "diversity" is default if error */ -} - -static int -il3945_set_ccmp_dynamic_key_info(struct il_priv *il, - struct ieee80211_key_conf *keyconf, u8 sta_id) -{ - unsigned long flags; - __le16 key_flags = 0; - int ret; - - key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); - key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); - - if (sta_id == il->hw_params.bcast_id) - key_flags |= STA_KEY_MULTICAST_MSK; - - keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - keyconf->hw_key_idx = keyconf->keyidx; - key_flags &= ~STA_KEY_FLG_INVALID; - - spin_lock_irqsave(&il->sta_lock, flags); - il->stations[sta_id].keyinfo.cipher = keyconf->cipher; - il->stations[sta_id].keyinfo.keylen = keyconf->keylen; - memcpy(il->stations[sta_id].keyinfo.key, keyconf->key, keyconf->keylen); - - memcpy(il->stations[sta_id].sta.key.key, keyconf->key, keyconf->keylen); - - if ((il->stations[sta_id].sta.key. - key_flags & STA_KEY_FLG_ENCRYPT_MSK) == STA_KEY_FLG_NO_ENC) - il->stations[sta_id].sta.key.key_offset = - il_get_free_ucode_key_idx(il); - /* else, we are overriding an existing key => no need to allocated room - * in uCode. */ - - WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, - "no space for a new key"); - - il->stations[sta_id].sta.key.key_flags = key_flags; - il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; - il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - - D_INFO("hwcrypto: modify ucode station key info\n"); - - ret = il_send_add_sta(il, &il->stations[sta_id].sta, CMD_ASYNC); - - spin_unlock_irqrestore(&il->sta_lock, flags); - - return ret; -} - -static int -il3945_set_tkip_dynamic_key_info(struct il_priv *il, - struct ieee80211_key_conf *keyconf, u8 sta_id) -{ - return -EOPNOTSUPP; -} - -static int -il3945_set_wep_dynamic_key_info(struct il_priv *il, - struct ieee80211_key_conf *keyconf, u8 sta_id) -{ - return -EOPNOTSUPP; -} - -static int -il3945_clear_sta_key_info(struct il_priv *il, u8 sta_id) -{ - unsigned long flags; - struct il_addsta_cmd sta_cmd; - - spin_lock_irqsave(&il->sta_lock, flags); - memset(&il->stations[sta_id].keyinfo, 0, sizeof(struct il_hw_key)); - memset(&il->stations[sta_id].sta.key, 0, sizeof(struct il4965_keyinfo)); - il->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; - il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; - il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - memcpy(&sta_cmd, &il->stations[sta_id].sta, - sizeof(struct il_addsta_cmd)); - spin_unlock_irqrestore(&il->sta_lock, flags); - - D_INFO("hwcrypto: clear ucode station key info\n"); - return il_send_add_sta(il, &sta_cmd, CMD_SYNC); -} - -static int -il3945_set_dynamic_key(struct il_priv *il, struct ieee80211_key_conf *keyconf, - u8 sta_id) -{ - int ret = 0; - - keyconf->hw_key_idx = HW_KEY_DYNAMIC; - - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_CCMP: - ret = il3945_set_ccmp_dynamic_key_info(il, keyconf, sta_id); - break; - case WLAN_CIPHER_SUITE_TKIP: - ret = il3945_set_tkip_dynamic_key_info(il, keyconf, sta_id); - break; - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - ret = il3945_set_wep_dynamic_key_info(il, keyconf, sta_id); - break; - default: - IL_ERR("Unknown alg: %s alg=%x\n", __func__, keyconf->cipher); - ret = -EINVAL; - } - - D_WEP("Set dynamic key: alg=%x len=%d idx=%d sta=%d ret=%d\n", - keyconf->cipher, keyconf->keylen, keyconf->keyidx, sta_id, ret); - - return ret; -} - -static int -il3945_remove_static_key(struct il_priv *il) -{ - int ret = -EOPNOTSUPP; - - return ret; -} - -static int -il3945_set_static_key(struct il_priv *il, struct ieee80211_key_conf *key) -{ - if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || - key->cipher == WLAN_CIPHER_SUITE_WEP104) - return -EOPNOTSUPP; - - IL_ERR("Static key invalid: cipher %x\n", key->cipher); - return -EINVAL; -} - -static void -il3945_clear_free_frames(struct il_priv *il) -{ - struct list_head *element; - - D_INFO("%d frames on pre-allocated heap on clear.\n", il->frames_count); - - while (!list_empty(&il->free_frames)) { - element = il->free_frames.next; - list_del(element); - kfree(list_entry(element, struct il3945_frame, list)); - il->frames_count--; - } - - if (il->frames_count) { - IL_WARN("%d frames still in use. Did we lose one?\n", - il->frames_count); - il->frames_count = 0; - } -} - -static struct il3945_frame * -il3945_get_free_frame(struct il_priv *il) -{ - struct il3945_frame *frame; - struct list_head *element; - if (list_empty(&il->free_frames)) { - frame = kzalloc(sizeof(*frame), GFP_KERNEL); - if (!frame) { - IL_ERR("Could not allocate frame!\n"); - return NULL; - } - - il->frames_count++; - return frame; - } - - element = il->free_frames.next; - list_del(element); - return list_entry(element, struct il3945_frame, list); -} - -static void -il3945_free_frame(struct il_priv *il, struct il3945_frame *frame) -{ - memset(frame, 0, sizeof(*frame)); - list_add(&frame->list, &il->free_frames); -} - -unsigned int -il3945_fill_beacon_frame(struct il_priv *il, struct ieee80211_hdr *hdr, - int left) -{ - - if (!il_is_associated(il) || !il->beacon_skb) - return 0; - - if (il->beacon_skb->len > left) - return 0; - - memcpy(hdr, il->beacon_skb->data, il->beacon_skb->len); - - return il->beacon_skb->len; -} - -static int -il3945_send_beacon_cmd(struct il_priv *il) -{ - struct il3945_frame *frame; - unsigned int frame_size; - int rc; - u8 rate; - - frame = il3945_get_free_frame(il); - - if (!frame) { - IL_ERR("Could not obtain free frame buffer for beacon " - "command.\n"); - return -ENOMEM; - } - - rate = il_get_lowest_plcp(il); - - frame_size = il3945_hw_get_beacon_cmd(il, frame, rate); - - rc = il_send_cmd_pdu(il, C_TX_BEACON, frame_size, &frame->u.cmd[0]); - - il3945_free_frame(il, frame); - - return rc; -} - -static void -il3945_unset_hw_params(struct il_priv *il) -{ - if (il->_3945.shared_virt) - dma_free_coherent(&il->pci_dev->dev, - sizeof(struct il3945_shared), - il->_3945.shared_virt, il->_3945.shared_phys); -} - -static void -il3945_build_tx_cmd_hwcrypto(struct il_priv *il, struct ieee80211_tx_info *info, - struct il_device_cmd *cmd, - struct sk_buff *skb_frag, int sta_id) -{ - struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload; - struct il_hw_key *keyinfo = &il->stations[sta_id].keyinfo; - - tx_cmd->sec_ctl = 0; - - switch (keyinfo->cipher) { - case WLAN_CIPHER_SUITE_CCMP: - tx_cmd->sec_ctl = TX_CMD_SEC_CCM; - memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen); - D_TX("tx_cmd with AES hwcrypto\n"); - break; - - case WLAN_CIPHER_SUITE_TKIP: - break; - - case WLAN_CIPHER_SUITE_WEP104: - tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128; - /* fall through */ - case WLAN_CIPHER_SUITE_WEP40: - tx_cmd->sec_ctl |= - TX_CMD_SEC_WEP | (info->control.hw_key-> - hw_key_idx & TX_CMD_SEC_MSK) << - TX_CMD_SEC_SHIFT; - - memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen); - - D_TX("Configuring packet for WEP encryption " "with key %d\n", - info->control.hw_key->hw_key_idx); - break; - - default: - IL_ERR("Unknown encode cipher %x\n", keyinfo->cipher); - break; - } -} - -/* - * handle build C_TX command notification. - */ -static void -il3945_build_tx_cmd_basic(struct il_priv *il, struct il_device_cmd *cmd, - struct ieee80211_tx_info *info, - struct ieee80211_hdr *hdr, u8 std_id) -{ - struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload; - __le32 tx_flags = tx_cmd->tx_flags; - __le16 fc = hdr->frame_control; - - tx_cmd->stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; - if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { - tx_flags |= TX_CMD_FLG_ACK_MSK; - if (ieee80211_is_mgmt(fc)) - tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; - if (ieee80211_is_probe_resp(fc) && - !(le16_to_cpu(hdr->seq_ctrl) & 0xf)) - tx_flags |= TX_CMD_FLG_TSF_MSK; - } else { - tx_flags &= (~TX_CMD_FLG_ACK_MSK); - tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; - } - - tx_cmd->sta_id = std_id; - if (ieee80211_has_morefrags(fc)) - tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK; - - if (ieee80211_is_data_qos(fc)) { - u8 *qc = ieee80211_get_qos_ctl(hdr); - tx_cmd->tid_tspec = qc[0] & 0xf; - tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK; - } else { - tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; - } - - il_tx_cmd_protection(il, info, fc, &tx_flags); - - tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); - if (ieee80211_is_mgmt(fc)) { - if (ieee80211_is_assoc_req(fc) || ieee80211_is_reassoc_req(fc)) - tx_cmd->timeout.pm_frame_timeout = cpu_to_le16(3); - else - tx_cmd->timeout.pm_frame_timeout = cpu_to_le16(2); - } else { - tx_cmd->timeout.pm_frame_timeout = 0; - } - - tx_cmd->driver_txop = 0; - tx_cmd->tx_flags = tx_flags; - tx_cmd->next_frame_len = 0; -} - -/* - * start C_TX command process - */ -static int -il3945_tx_skb(struct il_priv *il, - struct ieee80211_sta *sta, - struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct il3945_tx_cmd *tx_cmd; - struct il_tx_queue *txq = NULL; - struct il_queue *q = NULL; - struct il_device_cmd *out_cmd; - struct il_cmd_meta *out_meta; - dma_addr_t phys_addr; - dma_addr_t txcmd_phys; - int txq_id = skb_get_queue_mapping(skb); - u16 len, idx, hdr_len; - u16 firstlen, secondlen; - u8 id; - u8 unicast; - u8 sta_id; - u8 tid = 0; - __le16 fc; - u8 wait_write_ptr = 0; - unsigned long flags; - - spin_lock_irqsave(&il->lock, flags); - if (il_is_rfkill(il)) { - D_DROP("Dropping - RF KILL\n"); - goto drop_unlock; - } - - if ((ieee80211_get_tx_rate(il->hw, info)->hw_value & 0xFF) == - IL_INVALID_RATE) { - IL_ERR("ERROR: No TX rate available.\n"); - goto drop_unlock; - } - - unicast = !is_multicast_ether_addr(hdr->addr1); - id = 0; - - fc = hdr->frame_control; - -#ifdef CONFIG_IWLEGACY_DEBUG - if (ieee80211_is_auth(fc)) - D_TX("Sending AUTH frame\n"); - else if (ieee80211_is_assoc_req(fc)) - D_TX("Sending ASSOC frame\n"); - else if (ieee80211_is_reassoc_req(fc)) - D_TX("Sending REASSOC frame\n"); -#endif - - spin_unlock_irqrestore(&il->lock, flags); - - hdr_len = ieee80211_hdrlen(fc); - - /* Find idx into station table for destination station */ - sta_id = il_sta_id_or_broadcast(il, sta); - if (sta_id == IL_INVALID_STATION) { - D_DROP("Dropping - INVALID STATION: %pM\n", hdr->addr1); - goto drop; - } - - D_RATE("station Id %d\n", sta_id); - - if (ieee80211_is_data_qos(fc)) { - u8 *qc = ieee80211_get_qos_ctl(hdr); - tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; - if (unlikely(tid >= MAX_TID_COUNT)) - goto drop; - } - - /* Descriptor for chosen Tx queue */ - txq = &il->txq[txq_id]; - q = &txq->q; - - if ((il_queue_space(q) < q->high_mark)) - goto drop; - - spin_lock_irqsave(&il->lock, flags); - - idx = il_get_cmd_idx(q, q->write_ptr, 0); - - txq->skbs[q->write_ptr] = skb; - - /* Init first empty entry in queue's array of Tx/cmd buffers */ - out_cmd = txq->cmd[idx]; - out_meta = &txq->meta[idx]; - tx_cmd = (struct il3945_tx_cmd *)out_cmd->cmd.payload; - memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); - memset(tx_cmd, 0, sizeof(*tx_cmd)); - - /* - * Set up the Tx-command (not MAC!) header. - * Store the chosen Tx queue and TFD idx within the sequence field; - * after Tx, uCode's Tx response will return this value so driver can - * locate the frame within the tx queue and do post-tx processing. - */ - out_cmd->hdr.cmd = C_TX; - out_cmd->hdr.sequence = - cpu_to_le16((u16) - (QUEUE_TO_SEQ(txq_id) | IDX_TO_SEQ(q->write_ptr))); - - /* Copy MAC header from skb into command buffer */ - memcpy(tx_cmd->hdr, hdr, hdr_len); - - if (info->control.hw_key) - il3945_build_tx_cmd_hwcrypto(il, info, out_cmd, skb, sta_id); - - /* TODO need this for burst mode later on */ - il3945_build_tx_cmd_basic(il, out_cmd, info, hdr, sta_id); - - il3945_hw_build_tx_cmd_rate(il, out_cmd, info, hdr, sta_id); - - /* Total # bytes to be transmitted */ - tx_cmd->len = cpu_to_le16((u16) skb->len); - - tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; - tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; - - /* - * Use the first empty entry in this queue's command buffer array - * to contain the Tx command and MAC header concatenated together - * (payload data will be in another buffer). - * Size of this varies, due to varying MAC header length. - * If end is not dword aligned, we'll have 2 extra bytes at the end - * of the MAC header (device reads on dword boundaries). - * We'll tell device about this padding later. - */ - len = - sizeof(struct il3945_tx_cmd) + sizeof(struct il_cmd_header) + - hdr_len; - firstlen = (len + 3) & ~3; - - /* Physical address of this Tx command's header (not MAC header!), - * within command buffer array. */ - txcmd_phys = - pci_map_single(il->pci_dev, &out_cmd->hdr, firstlen, - PCI_DMA_TODEVICE); - if (unlikely(pci_dma_mapping_error(il->pci_dev, txcmd_phys))) - goto drop_unlock; - - /* Set up TFD's 2nd entry to point directly to remainder of skb, - * if any (802.11 null frames have no payload). */ - secondlen = skb->len - hdr_len; - if (secondlen > 0) { - phys_addr = - pci_map_single(il->pci_dev, skb->data + hdr_len, secondlen, - PCI_DMA_TODEVICE); - if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr))) - goto drop_unlock; - } - - /* Add buffer containing Tx command and MAC(!) header to TFD's - * first entry */ - il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, firstlen, 1, 0); - dma_unmap_addr_set(out_meta, mapping, txcmd_phys); - dma_unmap_len_set(out_meta, len, firstlen); - if (secondlen > 0) - il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, secondlen, 0, - U32_PAD(secondlen)); - - if (!ieee80211_has_morefrags(hdr->frame_control)) { - txq->need_update = 1; - } else { - wait_write_ptr = 1; - txq->need_update = 0; - } - - il_update_stats(il, true, fc, skb->len); - - D_TX("sequence nr = 0X%x\n", le16_to_cpu(out_cmd->hdr.sequence)); - D_TX("tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); - il_print_hex_dump(il, IL_DL_TX, tx_cmd, sizeof(*tx_cmd)); - il_print_hex_dump(il, IL_DL_TX, (u8 *) tx_cmd->hdr, - ieee80211_hdrlen(fc)); - - /* Tell device the write idx *just past* this latest filled TFD */ - q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); - il_txq_update_write_ptr(il, txq); - spin_unlock_irqrestore(&il->lock, flags); - - if (il_queue_space(q) < q->high_mark && il->mac80211_registered) { - if (wait_write_ptr) { - spin_lock_irqsave(&il->lock, flags); - txq->need_update = 1; - il_txq_update_write_ptr(il, txq); - spin_unlock_irqrestore(&il->lock, flags); - } - - il_stop_queue(il, txq); - } - - return 0; - -drop_unlock: - spin_unlock_irqrestore(&il->lock, flags); -drop: - return -1; -} - -static int -il3945_get_measurement(struct il_priv *il, - struct ieee80211_measurement_params *params, u8 type) -{ - struct il_spectrum_cmd spectrum; - struct il_rx_pkt *pkt; - struct il_host_cmd cmd = { - .id = C_SPECTRUM_MEASUREMENT, - .data = (void *)&spectrum, - .flags = CMD_WANT_SKB, - }; - u32 add_time = le64_to_cpu(params->start_time); - int rc; - int spectrum_resp_status; - int duration = le16_to_cpu(params->duration); - - if (il_is_associated(il)) - add_time = - il_usecs_to_beacons(il, - le64_to_cpu(params->start_time) - - il->_3945.last_tsf, - le16_to_cpu(il->timing.beacon_interval)); - - memset(&spectrum, 0, sizeof(spectrum)); - - spectrum.channel_count = cpu_to_le16(1); - spectrum.flags = - RXON_FLG_TSF2HOST_MSK | RXON_FLG_ANT_A_MSK | RXON_FLG_DIS_DIV_MSK; - spectrum.filter_flags = MEASUREMENT_FILTER_FLAG; - cmd.len = sizeof(spectrum); - spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len)); - - if (il_is_associated(il)) - spectrum.start_time = - il_add_beacon_time(il, il->_3945.last_beacon_time, add_time, - le16_to_cpu(il->timing.beacon_interval)); - else - spectrum.start_time = 0; - - spectrum.channels[0].duration = cpu_to_le32(duration * TIME_UNIT); - spectrum.channels[0].channel = params->channel; - spectrum.channels[0].type = type; - if (il->active.flags & RXON_FLG_BAND_24G_MSK) - spectrum.flags |= - RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK | - RXON_FLG_TGG_PROTECT_MSK; - - rc = il_send_cmd_sync(il, &cmd); - if (rc) - return rc; - - pkt = (struct il_rx_pkt *)cmd.reply_page; - if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { - IL_ERR("Bad return from N_RX_ON_ASSOC command\n"); - rc = -EIO; - } - - spectrum_resp_status = le16_to_cpu(pkt->u.spectrum.status); - switch (spectrum_resp_status) { - case 0: /* Command will be handled */ - if (pkt->u.spectrum.id != 0xff) { - D_INFO("Replaced existing measurement: %d\n", - pkt->u.spectrum.id); - il->measurement_status &= ~MEASUREMENT_READY; - } - il->measurement_status |= MEASUREMENT_ACTIVE; - rc = 0; - break; - - case 1: /* Command will not be handled */ - rc = -EAGAIN; - break; - } - - il_free_pages(il, cmd.reply_page); - - return rc; -} - -static void -il3945_hdl_alive(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il_alive_resp *palive; - struct delayed_work *pwork; - - palive = &pkt->u.alive_frame; - - D_INFO("Alive ucode status 0x%08X revision " "0x%01X 0x%01X\n", - palive->is_valid, palive->ver_type, palive->ver_subtype); - - if (palive->ver_subtype == INITIALIZE_SUBTYPE) { - D_INFO("Initialization Alive received.\n"); - memcpy(&il->card_alive_init, &pkt->u.alive_frame, - sizeof(struct il_alive_resp)); - pwork = &il->init_alive_start; - } else { - D_INFO("Runtime Alive received.\n"); - memcpy(&il->card_alive, &pkt->u.alive_frame, - sizeof(struct il_alive_resp)); - pwork = &il->alive_start; - il3945_disable_events(il); - } - - /* We delay the ALIVE response by 5ms to - * give the HW RF Kill time to activate... */ - if (palive->is_valid == UCODE_VALID_OK) - queue_delayed_work(il->workqueue, pwork, msecs_to_jiffies(5)); - else - IL_WARN("uCode did not respond OK.\n"); -} - -static void -il3945_hdl_add_sta(struct il_priv *il, struct il_rx_buf *rxb) -{ -#ifdef CONFIG_IWLEGACY_DEBUG - struct il_rx_pkt *pkt = rxb_addr(rxb); -#endif - - D_RX("Received C_ADD_STA: 0x%02X\n", pkt->u.status); -} - -static void -il3945_hdl_beacon(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il3945_beacon_notif *beacon = &(pkt->u.beacon_status); -#ifdef CONFIG_IWLEGACY_DEBUG - u8 rate = beacon->beacon_notify_hdr.rate; - - D_RX("beacon status %x retries %d iss %d " "tsf %d %d rate %d\n", - le32_to_cpu(beacon->beacon_notify_hdr.status) & TX_STATUS_MSK, - beacon->beacon_notify_hdr.failure_frame, - le32_to_cpu(beacon->ibss_mgr_status), - le32_to_cpu(beacon->high_tsf), le32_to_cpu(beacon->low_tsf), rate); -#endif - - il->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); - -} - -/* Handle notification from uCode that card's power state is changing - * due to software, hardware, or critical temperature RFKILL */ -static void -il3945_hdl_card_state(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); - unsigned long status = il->status; - - IL_WARN("Card state received: HW:%s SW:%s\n", - (flags & HW_CARD_DISABLED) ? "Kill" : "On", - (flags & SW_CARD_DISABLED) ? "Kill" : "On"); - - _il_wr(il, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - - if (flags & HW_CARD_DISABLED) - set_bit(S_RFKILL, &il->status); - else - clear_bit(S_RFKILL, &il->status); - - il_scan_cancel(il); - - if ((test_bit(S_RFKILL, &status) != - test_bit(S_RFKILL, &il->status))) - wiphy_rfkill_set_hw_state(il->hw->wiphy, - test_bit(S_RFKILL, &il->status)); - else - wake_up(&il->wait_command_queue); -} - -/** - * il3945_setup_handlers - Initialize Rx handler callbacks - * - * Setup the RX handlers for each of the reply types sent from the uCode - * to the host. - * - * This function chains into the hardware specific files for them to setup - * any hardware specific handlers as well. - */ -static void -il3945_setup_handlers(struct il_priv *il) -{ - il->handlers[N_ALIVE] = il3945_hdl_alive; - il->handlers[C_ADD_STA] = il3945_hdl_add_sta; - il->handlers[N_ERROR] = il_hdl_error; - il->handlers[N_CHANNEL_SWITCH] = il_hdl_csa; - il->handlers[N_SPECTRUM_MEASUREMENT] = il_hdl_spectrum_measurement; - il->handlers[N_PM_SLEEP] = il_hdl_pm_sleep; - il->handlers[N_PM_DEBUG_STATS] = il_hdl_pm_debug_stats; - il->handlers[N_BEACON] = il3945_hdl_beacon; - - /* - * The same handler is used for both the REPLY to a discrete - * stats request from the host as well as for the periodic - * stats notifications (after received beacons) from the uCode. - */ - il->handlers[C_STATS] = il3945_hdl_c_stats; - il->handlers[N_STATS] = il3945_hdl_stats; - - il_setup_rx_scan_handlers(il); - il->handlers[N_CARD_STATE] = il3945_hdl_card_state; - - /* Set up hardware specific Rx handlers */ - il3945_hw_handler_setup(il); -} - -/************************** RX-FUNCTIONS ****************************/ -/* - * Rx theory of operation - * - * The host allocates 32 DMA target addresses and passes the host address - * to the firmware at register IL_RFDS_TBL_LOWER + N * RFD_SIZE where N is - * 0 to 31 - * - * Rx Queue Indexes - * The host/firmware share two idx registers for managing the Rx buffers. - * - * The READ idx maps to the first position that the firmware may be writing - * to -- the driver can read up to (but not including) this position and get - * good data. - * The READ idx is managed by the firmware once the card is enabled. - * - * The WRITE idx maps to the last position the driver has read from -- the - * position preceding WRITE is the last slot the firmware can place a packet. - * - * The queue is empty (no good data) if WRITE = READ - 1, and is full if - * WRITE = READ. - * - * During initialization, the host sets up the READ queue position to the first - * IDX position, and WRITE to the last (READ - 1 wrapped) - * - * When the firmware places a packet in a buffer, it will advance the READ idx - * and fire the RX interrupt. The driver can then query the READ idx and - * process as many packets as possible, moving the WRITE idx forward as it - * resets the Rx queue buffers with new memory. - * - * The management in the driver is as follows: - * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When - * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled - * to replenish the iwl->rxq->rx_free. - * + In il3945_rx_replenish (scheduled) if 'processed' != 'read' then the - * iwl->rxq is replenished and the READ IDX is updated (updating the - * 'processed' and 'read' driver idxes as well) - * + A received packet is processed and handed to the kernel network stack, - * detached from the iwl->rxq. The driver 'processed' idx is updated. - * + The Host/Firmware iwl->rxq is replenished at tasklet time from the rx_free - * list. If there are no allocated buffers in iwl->rxq->rx_free, the READ - * IDX is not incremented and iwl->status(RX_STALLED) is set. If there - * were enough free buffers and RX_STALLED is set it is cleared. - * - * - * Driver sequence: - * - * il3945_rx_replenish() Replenishes rx_free list from rx_used, and calls - * il3945_rx_queue_restock - * il3945_rx_queue_restock() Moves available buffers from rx_free into Rx - * queue, updates firmware pointers, and updates - * the WRITE idx. If insufficient rx_free buffers - * are available, schedules il3945_rx_replenish - * - * -- enable interrupts -- - * ISR - il3945_rx() Detach il_rx_bufs from pool up to the - * READ IDX, detaching the SKB from the pool. - * Moves the packet buffer from queue to rx_used. - * Calls il3945_rx_queue_restock to refill any empty - * slots. - * ... - * - */ - -/** - * il3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr - */ -static inline __le32 -il3945_dma_addr2rbd_ptr(struct il_priv *il, dma_addr_t dma_addr) -{ - return cpu_to_le32((u32) dma_addr); -} - -/** - * il3945_rx_queue_restock - refill RX queue from pre-allocated pool - * - * If there are slots in the RX queue that need to be restocked, - * and we have free pre-allocated buffers, fill the ranks as much - * as we can, pulling from rx_free. - * - * This moves the 'write' idx forward to catch up with 'processed', and - * also updates the memory address in the firmware to reference the new - * target buffer. - */ -static void -il3945_rx_queue_restock(struct il_priv *il) -{ - struct il_rx_queue *rxq = &il->rxq; - struct list_head *element; - struct il_rx_buf *rxb; - unsigned long flags; - int write; - - spin_lock_irqsave(&rxq->lock, flags); - write = rxq->write & ~0x7; - while (il_rx_queue_space(rxq) > 0 && rxq->free_count) { - /* Get next free Rx buffer, remove from free list */ - element = rxq->rx_free.next; - rxb = list_entry(element, struct il_rx_buf, list); - list_del(element); - - /* Point to Rx buffer via next RBD in circular buffer */ - rxq->bd[rxq->write] = - il3945_dma_addr2rbd_ptr(il, rxb->page_dma); - rxq->queue[rxq->write] = rxb; - rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; - rxq->free_count--; - } - spin_unlock_irqrestore(&rxq->lock, flags); - /* If the pre-allocated buffer pool is dropping low, schedule to - * refill it */ - if (rxq->free_count <= RX_LOW_WATERMARK) - queue_work(il->workqueue, &il->rx_replenish); - - /* If we've added more space for the firmware to place data, tell it. - * Increment device's write pointer in multiples of 8. */ - if (rxq->write_actual != (rxq->write & ~0x7) || - abs(rxq->write - rxq->read) > 7) { - spin_lock_irqsave(&rxq->lock, flags); - rxq->need_update = 1; - spin_unlock_irqrestore(&rxq->lock, flags); - il_rx_queue_update_write_ptr(il, rxq); - } -} - -/** - * il3945_rx_replenish - Move all used packet from rx_used to rx_free - * - * When moving to rx_free an SKB is allocated for the slot. - * - * Also restock the Rx queue via il3945_rx_queue_restock. - * This is called as a scheduled work item (except for during initialization) - */ -static void -il3945_rx_allocate(struct il_priv *il, gfp_t priority) -{ - struct il_rx_queue *rxq = &il->rxq; - struct list_head *element; - struct il_rx_buf *rxb; - struct page *page; - dma_addr_t page_dma; - unsigned long flags; - gfp_t gfp_mask = priority; - - while (1) { - spin_lock_irqsave(&rxq->lock, flags); - if (list_empty(&rxq->rx_used)) { - spin_unlock_irqrestore(&rxq->lock, flags); - return; - } - spin_unlock_irqrestore(&rxq->lock, flags); - - if (rxq->free_count > RX_LOW_WATERMARK) - gfp_mask |= __GFP_NOWARN; - - if (il->hw_params.rx_page_order > 0) - gfp_mask |= __GFP_COMP; - - /* Alloc a new receive buffer */ - page = alloc_pages(gfp_mask, il->hw_params.rx_page_order); - if (!page) { - if (net_ratelimit()) - D_INFO("Failed to allocate SKB buffer.\n"); - if (rxq->free_count <= RX_LOW_WATERMARK && - net_ratelimit()) - IL_ERR("Failed to allocate SKB buffer with %0x." - "Only %u free buffers remaining.\n", - priority, rxq->free_count); - /* We don't reschedule replenish work here -- we will - * call the restock method and if it still needs - * more buffers it will schedule replenish */ - break; - } - - /* Get physical address of RB/SKB */ - page_dma = - pci_map_page(il->pci_dev, page, 0, - PAGE_SIZE << il->hw_params.rx_page_order, - PCI_DMA_FROMDEVICE); - - if (unlikely(pci_dma_mapping_error(il->pci_dev, page_dma))) { - __free_pages(page, il->hw_params.rx_page_order); - break; - } - - spin_lock_irqsave(&rxq->lock, flags); - - if (list_empty(&rxq->rx_used)) { - spin_unlock_irqrestore(&rxq->lock, flags); - pci_unmap_page(il->pci_dev, page_dma, - PAGE_SIZE << il->hw_params.rx_page_order, - PCI_DMA_FROMDEVICE); - __free_pages(page, il->hw_params.rx_page_order); - return; - } - - element = rxq->rx_used.next; - rxb = list_entry(element, struct il_rx_buf, list); - list_del(element); - - rxb->page = page; - rxb->page_dma = page_dma; - list_add_tail(&rxb->list, &rxq->rx_free); - rxq->free_count++; - il->alloc_rxb_page++; - - spin_unlock_irqrestore(&rxq->lock, flags); - } -} - -void -il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq) -{ - unsigned long flags; - int i; - spin_lock_irqsave(&rxq->lock, flags); - INIT_LIST_HEAD(&rxq->rx_free); - INIT_LIST_HEAD(&rxq->rx_used); - /* Fill the rx_used queue with _all_ of the Rx buffers */ - for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) { - /* In the reset function, these buffers may have been allocated - * to an SKB, so we need to unmap and free potential storage */ - if (rxq->pool[i].page != NULL) { - pci_unmap_page(il->pci_dev, rxq->pool[i].page_dma, - PAGE_SIZE << il->hw_params.rx_page_order, - PCI_DMA_FROMDEVICE); - __il_free_pages(il, rxq->pool[i].page); - rxq->pool[i].page = NULL; - } - list_add_tail(&rxq->pool[i].list, &rxq->rx_used); - } - - /* Set us so that we have processed and used all buffers, but have - * not restocked the Rx queue with fresh buffers */ - rxq->read = rxq->write = 0; - rxq->write_actual = 0; - rxq->free_count = 0; - spin_unlock_irqrestore(&rxq->lock, flags); -} - -void -il3945_rx_replenish(void *data) -{ - struct il_priv *il = data; - unsigned long flags; - - il3945_rx_allocate(il, GFP_KERNEL); - - spin_lock_irqsave(&il->lock, flags); - il3945_rx_queue_restock(il); - spin_unlock_irqrestore(&il->lock, flags); -} - -static void -il3945_rx_replenish_now(struct il_priv *il) -{ - il3945_rx_allocate(il, GFP_ATOMIC); - - il3945_rx_queue_restock(il); -} - -/* Assumes that the skb field of the buffers in 'pool' is kept accurate. - * If an SKB has been detached, the POOL needs to have its SKB set to NULL - * This free routine walks the list of POOL entries and if SKB is set to - * non NULL it is unmapped and freed - */ -static void -il3945_rx_queue_free(struct il_priv *il, struct il_rx_queue *rxq) -{ - int i; - for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { - if (rxq->pool[i].page != NULL) { - pci_unmap_page(il->pci_dev, rxq->pool[i].page_dma, - PAGE_SIZE << il->hw_params.rx_page_order, - PCI_DMA_FROMDEVICE); - __il_free_pages(il, rxq->pool[i].page); - rxq->pool[i].page = NULL; - } - } - - dma_free_coherent(&il->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, - rxq->bd_dma); - dma_free_coherent(&il->pci_dev->dev, sizeof(struct il_rb_status), - rxq->rb_stts, rxq->rb_stts_dma); - rxq->bd = NULL; - rxq->rb_stts = NULL; -} - -/* Convert linear signal-to-noise ratio into dB */ -static u8 ratio2dB[100] = { -/* 0 1 2 3 4 5 6 7 8 9 */ - 0, 0, 6, 10, 12, 14, 16, 17, 18, 19, /* 00 - 09 */ - 20, 21, 22, 22, 23, 23, 24, 25, 26, 26, /* 10 - 19 */ - 26, 26, 26, 27, 27, 28, 28, 28, 29, 29, /* 20 - 29 */ - 29, 30, 30, 30, 31, 31, 31, 31, 32, 32, /* 30 - 39 */ - 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, /* 40 - 49 */ - 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, /* 50 - 59 */ - 36, 36, 36, 36, 36, 36, 36, 37, 37, 37, /* 60 - 69 */ - 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, /* 70 - 79 */ - 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, /* 80 - 89 */ - 39, 39, 39, 39, 39, 40, 40, 40, 40, 40 /* 90 - 99 */ -}; - -/* Calculates a relative dB value from a ratio of linear - * (i.e. not dB) signal levels. - * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ -int -il3945_calc_db_from_ratio(int sig_ratio) -{ - /* 1000:1 or higher just report as 60 dB */ - if (sig_ratio >= 1000) - return 60; - - /* 100:1 or higher, divide by 10 and use table, - * add 20 dB to make up for divide by 10 */ - if (sig_ratio >= 100) - return 20 + (int)ratio2dB[sig_ratio / 10]; - - /* We shouldn't see this */ - if (sig_ratio < 1) - return 0; - - /* Use table for ratios 1:1 - 99:1 */ - return (int)ratio2dB[sig_ratio]; -} - -/** - * il3945_rx_handle - Main entry function for receiving responses from uCode - * - * Uses the il->handlers callback function array to invoke - * the appropriate handlers, including command responses, - * frame-received notifications, and other notifications. - */ -static void -il3945_rx_handle(struct il_priv *il) -{ - struct il_rx_buf *rxb; - struct il_rx_pkt *pkt; - struct il_rx_queue *rxq = &il->rxq; - u32 r, i; - int reclaim; - unsigned long flags; - u8 fill_rx = 0; - u32 count = 8; - int total_empty = 0; - - /* uCode's read idx (stored in shared DRAM) indicates the last Rx - * buffer that the driver may process (last buffer filled by ucode). */ - r = le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF; - i = rxq->read; - - /* calculate total frames need to be restock after handling RX */ - total_empty = r - rxq->write_actual; - if (total_empty < 0) - total_empty += RX_QUEUE_SIZE; - - if (total_empty > (RX_QUEUE_SIZE / 2)) - fill_rx = 1; - /* Rx interrupt, but nothing sent from uCode */ - if (i == r) - D_RX("r = %d, i = %d\n", r, i); - - while (i != r) { - int len; - - rxb = rxq->queue[i]; - - /* If an RXB doesn't have a Rx queue slot associated with it, - * then a bug has been introduced in the queue refilling - * routines -- catch it here */ - BUG_ON(rxb == NULL); - - rxq->queue[i] = NULL; - - pci_unmap_page(il->pci_dev, rxb->page_dma, - PAGE_SIZE << il->hw_params.rx_page_order, - PCI_DMA_FROMDEVICE); - pkt = rxb_addr(rxb); - - len = le32_to_cpu(pkt->len_n_flags) & IL_RX_FRAME_SIZE_MSK; - len += sizeof(u32); /* account for status word */ - - /* Reclaim a command buffer only if this packet is a response - * to a (driver-originated) command. - * If the packet (e.g. Rx frame) originated from uCode, - * there is no command buffer to reclaim. - * Ucode should set SEQ_RX_FRAME bit if ucode-originated, - * but apparently a few don't get set; catch them here. */ - reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) && - pkt->hdr.cmd != N_STATS && pkt->hdr.cmd != C_TX; - - /* Based on type of command response or notification, - * handle those that need handling via function in - * handlers table. See il3945_setup_handlers() */ - if (il->handlers[pkt->hdr.cmd]) { - D_RX("r = %d, i = %d, %s, 0x%02x\n", r, i, - il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); - il->isr_stats.handlers[pkt->hdr.cmd]++; - il->handlers[pkt->hdr.cmd] (il, rxb); - } else { - /* No handling needed */ - D_RX("r %d i %d No handler needed for %s, 0x%02x\n", r, - i, il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); - } - - /* - * XXX: After here, we should always check rxb->page - * against NULL before touching it or its virtual - * memory (pkt). Because some handler might have - * already taken or freed the pages. - */ - - if (reclaim) { - /* Invoke any callbacks, transfer the buffer to caller, - * and fire off the (possibly) blocking il_send_cmd() - * as we reclaim the driver command queue */ - if (rxb->page) - il_tx_cmd_complete(il, rxb); - else - IL_WARN("Claim null rxb?\n"); - } - - /* Reuse the page if possible. For notification packets and - * SKBs that fail to Rx correctly, add them back into the - * rx_free list for reuse later. */ - spin_lock_irqsave(&rxq->lock, flags); - if (rxb->page != NULL) { - rxb->page_dma = - pci_map_page(il->pci_dev, rxb->page, 0, - PAGE_SIZE << il->hw_params. - rx_page_order, PCI_DMA_FROMDEVICE); - if (unlikely(pci_dma_mapping_error(il->pci_dev, - rxb->page_dma))) { - __il_free_pages(il, rxb->page); - rxb->page = NULL; - list_add_tail(&rxb->list, &rxq->rx_used); - } else { - list_add_tail(&rxb->list, &rxq->rx_free); - rxq->free_count++; - } - } else - list_add_tail(&rxb->list, &rxq->rx_used); - - spin_unlock_irqrestore(&rxq->lock, flags); - - i = (i + 1) & RX_QUEUE_MASK; - /* If there are a lot of unused frames, - * restock the Rx queue so ucode won't assert. */ - if (fill_rx) { - count++; - if (count >= 8) { - rxq->read = i; - il3945_rx_replenish_now(il); - count = 0; - } - } - } - - /* Backtrack one entry */ - rxq->read = i; - if (fill_rx) - il3945_rx_replenish_now(il); - else - il3945_rx_queue_restock(il); -} - -/* call this function to flush any scheduled tasklet */ -static inline void -il3945_synchronize_irq(struct il_priv *il) -{ - /* wait to make sure we flush pending tasklet */ - synchronize_irq(il->pci_dev->irq); - tasklet_kill(&il->irq_tasklet); -} - -static const char * -il3945_desc_lookup(int i) -{ - switch (i) { - case 1: - return "FAIL"; - case 2: - return "BAD_PARAM"; - case 3: - return "BAD_CHECKSUM"; - case 4: - return "NMI_INTERRUPT"; - case 5: - return "SYSASSERT"; - case 6: - return "FATAL_ERROR"; - } - - return "UNKNOWN"; -} - -#define ERROR_START_OFFSET (1 * sizeof(u32)) -#define ERROR_ELEM_SIZE (7 * sizeof(u32)) - -void -il3945_dump_nic_error_log(struct il_priv *il) -{ - u32 i; - u32 desc, time, count, base, data1; - u32 blink1, blink2, ilink1, ilink2; - - base = le32_to_cpu(il->card_alive.error_event_table_ptr); - - if (!il3945_hw_valid_rtc_data_addr(base)) { - IL_ERR("Not valid error log pointer 0x%08X\n", base); - return; - } - - count = il_read_targ_mem(il, base); - - if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { - IL_ERR("Start IWL Error Log Dump:\n"); - IL_ERR("Status: 0x%08lX, count: %d\n", il->status, count); - } - - IL_ERR("Desc Time asrtPC blink2 " - "ilink1 nmiPC Line\n"); - for (i = ERROR_START_OFFSET; - i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET; - i += ERROR_ELEM_SIZE) { - desc = il_read_targ_mem(il, base + i); - time = il_read_targ_mem(il, base + i + 1 * sizeof(u32)); - blink1 = il_read_targ_mem(il, base + i + 2 * sizeof(u32)); - blink2 = il_read_targ_mem(il, base + i + 3 * sizeof(u32)); - ilink1 = il_read_targ_mem(il, base + i + 4 * sizeof(u32)); - ilink2 = il_read_targ_mem(il, base + i + 5 * sizeof(u32)); - data1 = il_read_targ_mem(il, base + i + 6 * sizeof(u32)); - - IL_ERR("%-13s (0x%X) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n", - il3945_desc_lookup(desc), desc, time, blink1, blink2, - ilink1, ilink2, data1); - } -} - -static void -il3945_irq_tasklet(struct il_priv *il) -{ - u32 inta, handled = 0; - u32 inta_fh; - unsigned long flags; -#ifdef CONFIG_IWLEGACY_DEBUG - u32 inta_mask; -#endif - - spin_lock_irqsave(&il->lock, flags); - - /* Ack/clear/reset pending uCode interrupts. - * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, - * and will clear only when CSR_FH_INT_STATUS gets cleared. */ - inta = _il_rd(il, CSR_INT); - _il_wr(il, CSR_INT, inta); - - /* Ack/clear/reset pending flow-handler (DMA) interrupts. - * Any new interrupts that happen after this, either while we're - * in this tasklet, or later, will show up in next ISR/tasklet. */ - inta_fh = _il_rd(il, CSR_FH_INT_STATUS); - _il_wr(il, CSR_FH_INT_STATUS, inta_fh); - -#ifdef CONFIG_IWLEGACY_DEBUG - if (il_get_debug_level(il) & IL_DL_ISR) { - /* just for debug */ - inta_mask = _il_rd(il, CSR_INT_MASK); - D_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, - inta_mask, inta_fh); - } -#endif - - spin_unlock_irqrestore(&il->lock, flags); - - /* Since CSR_INT and CSR_FH_INT_STATUS reads and clears are not - * atomic, make sure that inta covers all the interrupts that - * we've discovered, even if FH interrupt came in just after - * reading CSR_INT. */ - if (inta_fh & CSR39_FH_INT_RX_MASK) - inta |= CSR_INT_BIT_FH_RX; - if (inta_fh & CSR39_FH_INT_TX_MASK) - inta |= CSR_INT_BIT_FH_TX; - - /* Now service all interrupt bits discovered above. */ - if (inta & CSR_INT_BIT_HW_ERR) { - IL_ERR("Hardware error detected. Restarting.\n"); - - /* Tell the device to stop sending interrupts */ - il_disable_interrupts(il); - - il->isr_stats.hw++; - il_irq_handle_error(il); - - handled |= CSR_INT_BIT_HW_ERR; - - return; - } -#ifdef CONFIG_IWLEGACY_DEBUG - if (il_get_debug_level(il) & (IL_DL_ISR)) { - /* NIC fires this, but we don't use it, redundant with WAKEUP */ - if (inta & CSR_INT_BIT_SCD) { - D_ISR("Scheduler finished to transmit " - "the frame/frames.\n"); - il->isr_stats.sch++; - } - - /* Alive notification via Rx interrupt will do the real work */ - if (inta & CSR_INT_BIT_ALIVE) { - D_ISR("Alive interrupt\n"); - il->isr_stats.alive++; - } - } -#endif - /* Safely ignore these bits for debug checks below */ - inta &= ~(CSR_INT_BIT_SCD | CSR_INT_BIT_ALIVE); - - /* Error detected by uCode */ - if (inta & CSR_INT_BIT_SW_ERR) { - IL_ERR("Microcode SW error detected. " "Restarting 0x%X.\n", - inta); - il->isr_stats.sw++; - il_irq_handle_error(il); - handled |= CSR_INT_BIT_SW_ERR; - } - - /* uCode wakes up after power-down sleep */ - if (inta & CSR_INT_BIT_WAKEUP) { - D_ISR("Wakeup interrupt\n"); - il_rx_queue_update_write_ptr(il, &il->rxq); - il_txq_update_write_ptr(il, &il->txq[0]); - il_txq_update_write_ptr(il, &il->txq[1]); - il_txq_update_write_ptr(il, &il->txq[2]); - il_txq_update_write_ptr(il, &il->txq[3]); - il_txq_update_write_ptr(il, &il->txq[4]); - il_txq_update_write_ptr(il, &il->txq[5]); - - il->isr_stats.wakeup++; - handled |= CSR_INT_BIT_WAKEUP; - } - - /* All uCode command responses, including Tx command responses, - * Rx "responses" (frame-received notification), and other - * notifications from uCode come through here*/ - if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { - il3945_rx_handle(il); - il->isr_stats.rx++; - handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); - } - - if (inta & CSR_INT_BIT_FH_TX) { - D_ISR("Tx interrupt\n"); - il->isr_stats.tx++; - - _il_wr(il, CSR_FH_INT_STATUS, (1 << 6)); - il_wr(il, FH39_TCSR_CREDIT(FH39_SRVC_CHNL), 0x0); - handled |= CSR_INT_BIT_FH_TX; - } - - if (inta & ~handled) { - IL_ERR("Unhandled INTA bits 0x%08x\n", inta & ~handled); - il->isr_stats.unhandled++; - } - - if (inta & ~il->inta_mask) { - IL_WARN("Disabled INTA bits 0x%08x were pending\n", - inta & ~il->inta_mask); - IL_WARN(" with inta_fh = 0x%08x\n", inta_fh); - } - - /* Re-enable all interrupts */ - /* only Re-enable if disabled by irq */ - if (test_bit(S_INT_ENABLED, &il->status)) - il_enable_interrupts(il); - -#ifdef CONFIG_IWLEGACY_DEBUG - if (il_get_debug_level(il) & (IL_DL_ISR)) { - inta = _il_rd(il, CSR_INT); - inta_mask = _il_rd(il, CSR_INT_MASK); - inta_fh = _il_rd(il, CSR_FH_INT_STATUS); - D_ISR("End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " - "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); - } -#endif -} - -static int -il3945_get_channels_for_scan(struct il_priv *il, enum ieee80211_band band, - u8 is_active, u8 n_probes, - struct il3945_scan_channel *scan_ch, - struct ieee80211_vif *vif) -{ - struct ieee80211_channel *chan; - const struct ieee80211_supported_band *sband; - const struct il_channel_info *ch_info; - u16 passive_dwell = 0; - u16 active_dwell = 0; - int added, i; - - sband = il_get_hw_mode(il, band); - if (!sband) - return 0; - - active_dwell = il_get_active_dwell_time(il, band, n_probes); - passive_dwell = il_get_passive_dwell_time(il, band, vif); - - if (passive_dwell <= active_dwell) - passive_dwell = active_dwell + 1; - - for (i = 0, added = 0; i < il->scan_request->n_channels; i++) { - chan = il->scan_request->channels[i]; - - if (chan->band != band) - continue; - - scan_ch->channel = chan->hw_value; - - ch_info = il_get_channel_info(il, band, scan_ch->channel); - if (!il_is_channel_valid(ch_info)) { - D_SCAN("Channel %d is INVALID for this band.\n", - scan_ch->channel); - continue; - } - - scan_ch->active_dwell = cpu_to_le16(active_dwell); - scan_ch->passive_dwell = cpu_to_le16(passive_dwell); - /* If passive , set up for auto-switch - * and use long active_dwell time. - */ - if (!is_active || il_is_channel_passive(ch_info) || - (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)) { - scan_ch->type = 0; /* passive */ - if (IL_UCODE_API(il->ucode_ver) == 1) - scan_ch->active_dwell = - cpu_to_le16(passive_dwell - 1); - } else { - scan_ch->type = 1; /* active */ - } - - /* Set direct probe bits. These may be used both for active - * scan channels (probes gets sent right away), - * or for passive channels (probes get se sent only after - * hearing clear Rx packet).*/ - if (IL_UCODE_API(il->ucode_ver) >= 2) { - if (n_probes) - scan_ch->type |= IL39_SCAN_PROBE_MASK(n_probes); - } else { - /* uCode v1 does not allow setting direct probe bits on - * passive channel. */ - if ((scan_ch->type & 1) && n_probes) - scan_ch->type |= IL39_SCAN_PROBE_MASK(n_probes); - } - - /* Set txpower levels to defaults */ - scan_ch->tpc.dsp_atten = 110; - /* scan_pwr_info->tpc.dsp_atten; */ - - /*scan_pwr_info->tpc.tx_gain; */ - if (band == IEEE80211_BAND_5GHZ) - scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3; - else { - scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); - /* NOTE: if we were doing 6Mb OFDM for scans we'd use - * power level: - * scan_ch->tpc.tx_gain = ((1 << 5) | (2 << 3)) | 3; - */ - } - - D_SCAN("Scanning %d [%s %d]\n", scan_ch->channel, - (scan_ch->type & 1) ? "ACTIVE" : "PASSIVE", - (scan_ch->type & 1) ? active_dwell : passive_dwell); - - scan_ch++; - added++; - } - - D_SCAN("total channels to scan %d\n", added); - return added; -} - -static void -il3945_init_hw_rates(struct il_priv *il, struct ieee80211_rate *rates) -{ - int i; - - for (i = 0; i < RATE_COUNT_LEGACY; i++) { - rates[i].bitrate = il3945_rates[i].ieee * 5; - rates[i].hw_value = i; /* Rate scaling will work on idxes */ - rates[i].hw_value_short = i; - rates[i].flags = 0; - if (i > IL39_LAST_OFDM_RATE || i < IL_FIRST_OFDM_RATE) { - /* - * If CCK != 1M then set short preamble rate flag. - */ - rates[i].flags |= - (il3945_rates[i].plcp == - 10) ? 0 : IEEE80211_RATE_SHORT_PREAMBLE; - } - } -} - -/****************************************************************************** - * - * uCode download functions - * - ******************************************************************************/ - -static void -il3945_dealloc_ucode_pci(struct il_priv *il) -{ - il_free_fw_desc(il->pci_dev, &il->ucode_code); - il_free_fw_desc(il->pci_dev, &il->ucode_data); - il_free_fw_desc(il->pci_dev, &il->ucode_data_backup); - il_free_fw_desc(il->pci_dev, &il->ucode_init); - il_free_fw_desc(il->pci_dev, &il->ucode_init_data); - il_free_fw_desc(il->pci_dev, &il->ucode_boot); -} - -/** - * il3945_verify_inst_full - verify runtime uCode image in card vs. host, - * looking at all data. - */ -static int -il3945_verify_inst_full(struct il_priv *il, __le32 * image, u32 len) -{ - u32 val; - u32 save_len = len; - int rc = 0; - u32 errcnt; - - D_INFO("ucode inst image size is %u\n", len); - - il_wr(il, HBUS_TARG_MEM_RADDR, IL39_RTC_INST_LOWER_BOUND); - - errcnt = 0; - for (; len > 0; len -= sizeof(u32), image++) { - /* read data comes through single port, auto-incr addr */ - /* NOTE: Use the debugless read so we don't flood kernel log - * if IL_DL_IO is set */ - val = _il_rd(il, HBUS_TARG_MEM_RDAT); - if (val != le32_to_cpu(*image)) { - IL_ERR("uCode INST section is invalid at " - "offset 0x%x, is 0x%x, s/b 0x%x\n", - save_len - len, val, le32_to_cpu(*image)); - rc = -EIO; - errcnt++; - if (errcnt >= 20) - break; - } - } - - if (!errcnt) - D_INFO("ucode image in INSTRUCTION memory is good\n"); - - return rc; -} - -/** - * il3945_verify_inst_sparse - verify runtime uCode image in card vs. host, - * using sample data 100 bytes apart. If these sample points are good, - * it's a pretty good bet that everything between them is good, too. - */ -static int -il3945_verify_inst_sparse(struct il_priv *il, __le32 * image, u32 len) -{ - u32 val; - int rc = 0; - u32 errcnt = 0; - u32 i; - - D_INFO("ucode inst image size is %u\n", len); - - for (i = 0; i < len; i += 100, image += 100 / sizeof(u32)) { - /* read data comes through single port, auto-incr addr */ - /* NOTE: Use the debugless read so we don't flood kernel log - * if IL_DL_IO is set */ - il_wr(il, HBUS_TARG_MEM_RADDR, i + IL39_RTC_INST_LOWER_BOUND); - val = _il_rd(il, HBUS_TARG_MEM_RDAT); - if (val != le32_to_cpu(*image)) { -#if 0 /* Enable this if you want to see details */ - IL_ERR("uCode INST section is invalid at " - "offset 0x%x, is 0x%x, s/b 0x%x\n", i, val, - *image); -#endif - rc = -EIO; - errcnt++; - if (errcnt >= 3) - break; - } - } - - return rc; -} - -/** - * il3945_verify_ucode - determine which instruction image is in SRAM, - * and verify its contents - */ -static int -il3945_verify_ucode(struct il_priv *il) -{ - __le32 *image; - u32 len; - int rc = 0; - - /* Try bootstrap */ - image = (__le32 *) il->ucode_boot.v_addr; - len = il->ucode_boot.len; - rc = il3945_verify_inst_sparse(il, image, len); - if (rc == 0) { - D_INFO("Bootstrap uCode is good in inst SRAM\n"); - return 0; - } - - /* Try initialize */ - image = (__le32 *) il->ucode_init.v_addr; - len = il->ucode_init.len; - rc = il3945_verify_inst_sparse(il, image, len); - if (rc == 0) { - D_INFO("Initialize uCode is good in inst SRAM\n"); - return 0; - } - - /* Try runtime/protocol */ - image = (__le32 *) il->ucode_code.v_addr; - len = il->ucode_code.len; - rc = il3945_verify_inst_sparse(il, image, len); - if (rc == 0) { - D_INFO("Runtime uCode is good in inst SRAM\n"); - return 0; - } - - IL_ERR("NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); - - /* Since nothing seems to match, show first several data entries in - * instruction SRAM, so maybe visual inspection will give a clue. - * Selection of bootstrap image (vs. other images) is arbitrary. */ - image = (__le32 *) il->ucode_boot.v_addr; - len = il->ucode_boot.len; - rc = il3945_verify_inst_full(il, image, len); - - return rc; -} - -static void -il3945_nic_start(struct il_priv *il) -{ - /* Remove all resets to allow NIC to operate */ - _il_wr(il, CSR_RESET, 0); -} - -#define IL3945_UCODE_GET(item) \ -static u32 il3945_ucode_get_##item(const struct il_ucode_header *ucode)\ -{ \ - return le32_to_cpu(ucode->v1.item); \ -} - -static u32 -il3945_ucode_get_header_size(u32 api_ver) -{ - return 24; -} - -static u8 * -il3945_ucode_get_data(const struct il_ucode_header *ucode) -{ - return (u8 *) ucode->v1.data; -} - -IL3945_UCODE_GET(inst_size); -IL3945_UCODE_GET(data_size); -IL3945_UCODE_GET(init_size); -IL3945_UCODE_GET(init_data_size); -IL3945_UCODE_GET(boot_size); - -/** - * il3945_read_ucode - Read uCode images from disk file. - * - * Copy into buffers for card to fetch via bus-mastering - */ -static int -il3945_read_ucode(struct il_priv *il) -{ - const struct il_ucode_header *ucode; - int ret = -EINVAL, idx; - const struct firmware *ucode_raw; - /* firmware file name contains uCode/driver compatibility version */ - const char *name_pre = il->cfg->fw_name_pre; - const unsigned int api_max = il->cfg->ucode_api_max; - const unsigned int api_min = il->cfg->ucode_api_min; - char buf[25]; - u8 *src; - size_t len; - u32 api_ver, inst_size, data_size, init_size, init_data_size, boot_size; - - /* Ask kernel firmware_class module to get the boot firmware off disk. - * request_firmware() is synchronous, file is in memory on return. */ - for (idx = api_max; idx >= api_min; idx--) { - sprintf(buf, "%s%u%s", name_pre, idx, ".ucode"); - ret = request_firmware(&ucode_raw, buf, &il->pci_dev->dev); - if (ret < 0) { - IL_ERR("%s firmware file req failed: %d\n", buf, ret); - if (ret == -ENOENT) - continue; - else - goto error; - } else { - if (idx < api_max) - IL_ERR("Loaded firmware %s, " - "which is deprecated. " - " Please use API v%u instead.\n", buf, - api_max); - D_INFO("Got firmware '%s' file " - "(%zd bytes) from disk\n", buf, ucode_raw->size); - break; - } - } - - if (ret < 0) - goto error; - - /* Make sure that we got at least our header! */ - if (ucode_raw->size < il3945_ucode_get_header_size(1)) { - IL_ERR("File size way too small!\n"); - ret = -EINVAL; - goto err_release; - } - - /* Data from ucode file: header followed by uCode images */ - ucode = (struct il_ucode_header *)ucode_raw->data; - - il->ucode_ver = le32_to_cpu(ucode->ver); - api_ver = IL_UCODE_API(il->ucode_ver); - inst_size = il3945_ucode_get_inst_size(ucode); - data_size = il3945_ucode_get_data_size(ucode); - init_size = il3945_ucode_get_init_size(ucode); - init_data_size = il3945_ucode_get_init_data_size(ucode); - boot_size = il3945_ucode_get_boot_size(ucode); - src = il3945_ucode_get_data(ucode); - - /* api_ver should match the api version forming part of the - * firmware filename ... but we don't check for that and only rely - * on the API version read from firmware header from here on forward */ - - if (api_ver < api_min || api_ver > api_max) { - IL_ERR("Driver unable to support your firmware API. " - "Driver supports v%u, firmware is v%u.\n", api_max, - api_ver); - il->ucode_ver = 0; - ret = -EINVAL; - goto err_release; - } - if (api_ver != api_max) - IL_ERR("Firmware has old API version. Expected %u, " - "got %u. New firmware can be obtained " - "from http://www.intellinuxwireless.org.\n", api_max, - api_ver); - - IL_INFO("loaded firmware version %u.%u.%u.%u\n", - IL_UCODE_MAJOR(il->ucode_ver), IL_UCODE_MINOR(il->ucode_ver), - IL_UCODE_API(il->ucode_ver), IL_UCODE_SERIAL(il->ucode_ver)); - - snprintf(il->hw->wiphy->fw_version, sizeof(il->hw->wiphy->fw_version), - "%u.%u.%u.%u", IL_UCODE_MAJOR(il->ucode_ver), - IL_UCODE_MINOR(il->ucode_ver), IL_UCODE_API(il->ucode_ver), - IL_UCODE_SERIAL(il->ucode_ver)); - - D_INFO("f/w package hdr ucode version raw = 0x%x\n", il->ucode_ver); - D_INFO("f/w package hdr runtime inst size = %u\n", inst_size); - D_INFO("f/w package hdr runtime data size = %u\n", data_size); - D_INFO("f/w package hdr init inst size = %u\n", init_size); - D_INFO("f/w package hdr init data size = %u\n", init_data_size); - D_INFO("f/w package hdr boot inst size = %u\n", boot_size); - - /* Verify size of file vs. image size info in file's header */ - if (ucode_raw->size != - il3945_ucode_get_header_size(api_ver) + inst_size + data_size + - init_size + init_data_size + boot_size) { - - D_INFO("uCode file size %zd does not match expected size\n", - ucode_raw->size); - ret = -EINVAL; - goto err_release; - } - - /* Verify that uCode images will fit in card's SRAM */ - if (inst_size > IL39_MAX_INST_SIZE) { - D_INFO("uCode instr len %d too large to fit in\n", inst_size); - ret = -EINVAL; - goto err_release; - } - - if (data_size > IL39_MAX_DATA_SIZE) { - D_INFO("uCode data len %d too large to fit in\n", data_size); - ret = -EINVAL; - goto err_release; - } - if (init_size > IL39_MAX_INST_SIZE) { - D_INFO("uCode init instr len %d too large to fit in\n", - init_size); - ret = -EINVAL; - goto err_release; - } - if (init_data_size > IL39_MAX_DATA_SIZE) { - D_INFO("uCode init data len %d too large to fit in\n", - init_data_size); - ret = -EINVAL; - goto err_release; - } - if (boot_size > IL39_MAX_BSM_SIZE) { - D_INFO("uCode boot instr len %d too large to fit in\n", - boot_size); - ret = -EINVAL; - goto err_release; - } - - /* Allocate ucode buffers for card's bus-master loading ... */ - - /* Runtime instructions and 2 copies of data: - * 1) unmodified from disk - * 2) backup cache for save/restore during power-downs */ - il->ucode_code.len = inst_size; - il_alloc_fw_desc(il->pci_dev, &il->ucode_code); - - il->ucode_data.len = data_size; - il_alloc_fw_desc(il->pci_dev, &il->ucode_data); - - il->ucode_data_backup.len = data_size; - il_alloc_fw_desc(il->pci_dev, &il->ucode_data_backup); - - if (!il->ucode_code.v_addr || !il->ucode_data.v_addr || - !il->ucode_data_backup.v_addr) - goto err_pci_alloc; - - /* Initialization instructions and data */ - if (init_size && init_data_size) { - il->ucode_init.len = init_size; - il_alloc_fw_desc(il->pci_dev, &il->ucode_init); - - il->ucode_init_data.len = init_data_size; - il_alloc_fw_desc(il->pci_dev, &il->ucode_init_data); - - if (!il->ucode_init.v_addr || !il->ucode_init_data.v_addr) - goto err_pci_alloc; - } - - /* Bootstrap (instructions only, no data) */ - if (boot_size) { - il->ucode_boot.len = boot_size; - il_alloc_fw_desc(il->pci_dev, &il->ucode_boot); - - if (!il->ucode_boot.v_addr) - goto err_pci_alloc; - } - - /* Copy images into buffers for card's bus-master reads ... */ - - /* Runtime instructions (first block of data in file) */ - len = inst_size; - D_INFO("Copying (but not loading) uCode instr len %zd\n", len); - memcpy(il->ucode_code.v_addr, src, len); - src += len; - - D_INFO("uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", - il->ucode_code.v_addr, (u32) il->ucode_code.p_addr); - - /* Runtime data (2nd block) - * NOTE: Copy into backup buffer will be done in il3945_up() */ - len = data_size; - D_INFO("Copying (but not loading) uCode data len %zd\n", len); - memcpy(il->ucode_data.v_addr, src, len); - memcpy(il->ucode_data_backup.v_addr, src, len); - src += len; - - /* Initialization instructions (3rd block) */ - if (init_size) { - len = init_size; - D_INFO("Copying (but not loading) init instr len %zd\n", len); - memcpy(il->ucode_init.v_addr, src, len); - src += len; - } - - /* Initialization data (4th block) */ - if (init_data_size) { - len = init_data_size; - D_INFO("Copying (but not loading) init data len %zd\n", len); - memcpy(il->ucode_init_data.v_addr, src, len); - src += len; - } - - /* Bootstrap instructions (5th block) */ - len = boot_size; - D_INFO("Copying (but not loading) boot instr len %zd\n", len); - memcpy(il->ucode_boot.v_addr, src, len); - - /* We have our copies now, allow OS release its copies */ - release_firmware(ucode_raw); - return 0; - -err_pci_alloc: - IL_ERR("failed to allocate pci memory\n"); - ret = -ENOMEM; - il3945_dealloc_ucode_pci(il); - -err_release: - release_firmware(ucode_raw); - -error: - return ret; -} - -/** - * il3945_set_ucode_ptrs - Set uCode address location - * - * Tell initialization uCode where to find runtime uCode. - * - * BSM registers initially contain pointers to initialization uCode. - * We need to replace them to load runtime uCode inst and data, - * and to save runtime data when powering down. - */ -static int -il3945_set_ucode_ptrs(struct il_priv *il) -{ - dma_addr_t pinst; - dma_addr_t pdata; - - /* bits 31:0 for 3945 */ - pinst = il->ucode_code.p_addr; - pdata = il->ucode_data_backup.p_addr; - - /* Tell bootstrap uCode where to find image to load */ - il_wr_prph(il, BSM_DRAM_INST_PTR_REG, pinst); - il_wr_prph(il, BSM_DRAM_DATA_PTR_REG, pdata); - il_wr_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, il->ucode_data.len); - - /* Inst byte count must be last to set up, bit 31 signals uCode - * that all new ptr/size info is in place */ - il_wr_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, - il->ucode_code.len | BSM_DRAM_INST_LOAD); - - D_INFO("Runtime uCode pointers are set.\n"); - - return 0; -} - -/** - * il3945_init_alive_start - Called after N_ALIVE notification received - * - * Called after N_ALIVE notification received from "initialize" uCode. - * - * Tell "initialize" uCode to go ahead and load the runtime uCode. - */ -static void -il3945_init_alive_start(struct il_priv *il) -{ - /* Check alive response for "valid" sign from uCode */ - if (il->card_alive_init.is_valid != UCODE_VALID_OK) { - /* We had an error bringing up the hardware, so take it - * all the way back down so we can try again */ - D_INFO("Initialize Alive failed.\n"); - goto restart; - } - - /* Bootstrap uCode has loaded initialize uCode ... verify inst image. - * This is a paranoid check, because we would not have gotten the - * "initialize" alive if code weren't properly loaded. */ - if (il3945_verify_ucode(il)) { - /* Runtime instruction load was bad; - * take it all the way back down so we can try again */ - D_INFO("Bad \"initialize\" uCode load.\n"); - goto restart; - } - - /* Send pointers to protocol/runtime uCode image ... init code will - * load and launch runtime uCode, which will send us another "Alive" - * notification. */ - D_INFO("Initialization Alive received.\n"); - if (il3945_set_ucode_ptrs(il)) { - /* Runtime instruction load won't happen; - * take it all the way back down so we can try again */ - D_INFO("Couldn't set up uCode pointers.\n"); - goto restart; - } - return; - -restart: - queue_work(il->workqueue, &il->restart); -} - -/** - * il3945_alive_start - called after N_ALIVE notification received - * from protocol/runtime uCode (initialization uCode's - * Alive gets handled by il3945_init_alive_start()). - */ -static void -il3945_alive_start(struct il_priv *il) -{ - int thermal_spin = 0; - u32 rfkill; - - D_INFO("Runtime Alive received.\n"); - - if (il->card_alive.is_valid != UCODE_VALID_OK) { - /* We had an error bringing up the hardware, so take it - * all the way back down so we can try again */ - D_INFO("Alive failed.\n"); - goto restart; - } - - /* Initialize uCode has loaded Runtime uCode ... verify inst image. - * This is a paranoid check, because we would not have gotten the - * "runtime" alive if code weren't properly loaded. */ - if (il3945_verify_ucode(il)) { - /* Runtime instruction load was bad; - * take it all the way back down so we can try again */ - D_INFO("Bad runtime uCode load.\n"); - goto restart; - } - - rfkill = il_rd_prph(il, APMG_RFKILL_REG); - D_INFO("RFKILL status: 0x%x\n", rfkill); - - if (rfkill & 0x1) { - clear_bit(S_RFKILL, &il->status); - /* if RFKILL is not on, then wait for thermal - * sensor in adapter to kick in */ - while (il3945_hw_get_temperature(il) == 0) { - thermal_spin++; - udelay(10); - } - - if (thermal_spin) - D_INFO("Thermal calibration took %dus\n", - thermal_spin * 10); - } else - set_bit(S_RFKILL, &il->status); - - /* After the ALIVE response, we can send commands to 3945 uCode */ - set_bit(S_ALIVE, &il->status); - - /* Enable watchdog to monitor the driver tx queues */ - il_setup_watchdog(il); - - if (il_is_rfkill(il)) - return; - - ieee80211_wake_queues(il->hw); - - il->active_rate = RATES_MASK_3945; - - il_power_update_mode(il, true); - - if (il_is_associated(il)) { - struct il3945_rxon_cmd *active_rxon = - (struct il3945_rxon_cmd *)(&il->active); - - il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; - } else { - /* Initialize our rx_config data */ - il_connection_init_rx_config(il); - } - - /* Configure Bluetooth device coexistence support */ - il_send_bt_config(il); - - set_bit(S_READY, &il->status); - - /* Configure the adapter for unassociated operation */ - il3945_commit_rxon(il); - - il3945_reg_txpower_periodic(il); - - D_INFO("ALIVE processing complete.\n"); - wake_up(&il->wait_command_queue); - - return; - -restart: - queue_work(il->workqueue, &il->restart); -} - -static void il3945_cancel_deferred_work(struct il_priv *il); - -static void -__il3945_down(struct il_priv *il) -{ - unsigned long flags; - int exit_pending; - - D_INFO(DRV_NAME " is going down\n"); - - il_scan_cancel_timeout(il, 200); - - exit_pending = test_and_set_bit(S_EXIT_PENDING, &il->status); - - /* Stop TX queues watchdog. We need to have S_EXIT_PENDING bit set - * to prevent rearm timer */ - del_timer_sync(&il->watchdog); - - /* Station information will now be cleared in device */ - il_clear_ucode_stations(il); - il_dealloc_bcast_stations(il); - il_clear_driver_stations(il); - - /* Unblock any waiting calls */ - wake_up_all(&il->wait_command_queue); - - /* Wipe out the EXIT_PENDING status bit if we are not actually - * exiting the module */ - if (!exit_pending) - clear_bit(S_EXIT_PENDING, &il->status); - - /* stop and reset the on-board processor */ - _il_wr(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); - - /* tell the device to stop sending interrupts */ - spin_lock_irqsave(&il->lock, flags); - il_disable_interrupts(il); - spin_unlock_irqrestore(&il->lock, flags); - il3945_synchronize_irq(il); - - if (il->mac80211_registered) - ieee80211_stop_queues(il->hw); - - /* If we have not previously called il3945_init() then - * clear all bits but the RF Kill bits and return */ - if (!il_is_init(il)) { - il->status = - test_bit(S_RFKILL, &il->status) << S_RFKILL | - test_bit(S_GEO_CONFIGURED, &il->status) << S_GEO_CONFIGURED | - test_bit(S_EXIT_PENDING, &il->status) << S_EXIT_PENDING; - goto exit; - } - - /* ...otherwise clear out all the status bits but the RF Kill - * bit and continue taking the NIC down. */ - il->status &= - test_bit(S_RFKILL, &il->status) << S_RFKILL | - test_bit(S_GEO_CONFIGURED, &il->status) << S_GEO_CONFIGURED | - test_bit(S_FW_ERROR, &il->status) << S_FW_ERROR | - test_bit(S_EXIT_PENDING, &il->status) << S_EXIT_PENDING; - - /* - * We disabled and synchronized interrupt, and priv->mutex is taken, so - * here is the only thread which will program device registers, but - * still have lockdep assertions, so we are taking reg_lock. - */ - spin_lock_irq(&il->reg_lock); - /* FIXME: il_grab_nic_access if rfkill is off ? */ - - il3945_hw_txq_ctx_stop(il); - il3945_hw_rxq_stop(il); - /* Power-down device's busmaster DMA clocks */ - _il_wr_prph(il, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); - udelay(5); - /* Stop the device, and put it in low power state */ - _il_apm_stop(il); - - spin_unlock_irq(&il->reg_lock); - - il3945_hw_txq_ctx_free(il); -exit: - memset(&il->card_alive, 0, sizeof(struct il_alive_resp)); - - if (il->beacon_skb) - dev_kfree_skb(il->beacon_skb); - il->beacon_skb = NULL; - - /* clear out any free frames */ - il3945_clear_free_frames(il); -} - -static void -il3945_down(struct il_priv *il) -{ - mutex_lock(&il->mutex); - __il3945_down(il); - mutex_unlock(&il->mutex); - - il3945_cancel_deferred_work(il); -} - -#define MAX_HW_RESTARTS 5 - -static int -il3945_alloc_bcast_station(struct il_priv *il) -{ - unsigned long flags; - u8 sta_id; - - spin_lock_irqsave(&il->sta_lock, flags); - sta_id = il_prep_station(il, il_bcast_addr, false, NULL); - if (sta_id == IL_INVALID_STATION) { - IL_ERR("Unable to prepare broadcast station\n"); - spin_unlock_irqrestore(&il->sta_lock, flags); - - return -EINVAL; - } - - il->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE; - il->stations[sta_id].used |= IL_STA_BCAST; - spin_unlock_irqrestore(&il->sta_lock, flags); - - return 0; -} - -static int -__il3945_up(struct il_priv *il) -{ - int rc, i; - - rc = il3945_alloc_bcast_station(il); - if (rc) - return rc; - - if (test_bit(S_EXIT_PENDING, &il->status)) { - IL_WARN("Exit pending; will not bring the NIC up\n"); - return -EIO; - } - - if (!il->ucode_data_backup.v_addr || !il->ucode_data.v_addr) { - IL_ERR("ucode not available for device bring up\n"); - return -EIO; - } - - /* If platform's RF_KILL switch is NOT set to KILL */ - if (_il_rd(il, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) - clear_bit(S_RFKILL, &il->status); - else { - set_bit(S_RFKILL, &il->status); - IL_WARN("Radio disabled by HW RF Kill switch\n"); - return -ENODEV; - } - - _il_wr(il, CSR_INT, 0xFFFFFFFF); - - rc = il3945_hw_nic_init(il); - if (rc) { - IL_ERR("Unable to int nic\n"); - return rc; - } - - /* make sure rfkill handshake bits are cleared */ - _il_wr(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - _il_wr(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - - /* clear (again), then enable host interrupts */ - _il_wr(il, CSR_INT, 0xFFFFFFFF); - il_enable_interrupts(il); - - /* really make sure rfkill handshake bits are cleared */ - _il_wr(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - _il_wr(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - - /* Copy original ucode data image from disk into backup cache. - * This will be used to initialize the on-board processor's - * data SRAM for a clean start when the runtime program first loads. */ - memcpy(il->ucode_data_backup.v_addr, il->ucode_data.v_addr, - il->ucode_data.len); - - /* We return success when we resume from suspend and rf_kill is on. */ - if (test_bit(S_RFKILL, &il->status)) - return 0; - - for (i = 0; i < MAX_HW_RESTARTS; i++) { - - /* load bootstrap state machine, - * load bootstrap program into processor's memory, - * prepare to load the "initialize" uCode */ - rc = il->ops->load_ucode(il); - - if (rc) { - IL_ERR("Unable to set up bootstrap uCode: %d\n", rc); - continue; - } - - /* start card; "initialize" will load runtime ucode */ - il3945_nic_start(il); - - D_INFO(DRV_NAME " is coming up\n"); - - return 0; - } - - set_bit(S_EXIT_PENDING, &il->status); - __il3945_down(il); - clear_bit(S_EXIT_PENDING, &il->status); - - /* tried to restart and config the device for as long as our - * patience could withstand */ - IL_ERR("Unable to initialize device after %d attempts.\n", i); - return -EIO; -} - -/***************************************************************************** - * - * Workqueue callbacks - * - *****************************************************************************/ - -static void -il3945_bg_init_alive_start(struct work_struct *data) -{ - struct il_priv *il = - container_of(data, struct il_priv, init_alive_start.work); - - mutex_lock(&il->mutex); - if (test_bit(S_EXIT_PENDING, &il->status)) - goto out; - - il3945_init_alive_start(il); -out: - mutex_unlock(&il->mutex); -} - -static void -il3945_bg_alive_start(struct work_struct *data) -{ - struct il_priv *il = - container_of(data, struct il_priv, alive_start.work); - - mutex_lock(&il->mutex); - if (test_bit(S_EXIT_PENDING, &il->status) || il->txq == NULL) - goto out; - - il3945_alive_start(il); -out: - mutex_unlock(&il->mutex); -} - -/* - * 3945 cannot interrupt driver when hardware rf kill switch toggles; - * driver must poll CSR_GP_CNTRL_REG register for change. This register - * *is* readable even when device has been SW_RESET into low power mode - * (e.g. during RF KILL). - */ -static void -il3945_rfkill_poll(struct work_struct *data) -{ - struct il_priv *il = - container_of(data, struct il_priv, _3945.rfkill_poll.work); - bool old_rfkill = test_bit(S_RFKILL, &il->status); - bool new_rfkill = - !(_il_rd(il, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); - - if (new_rfkill != old_rfkill) { - if (new_rfkill) - set_bit(S_RFKILL, &il->status); - else - clear_bit(S_RFKILL, &il->status); - - wiphy_rfkill_set_hw_state(il->hw->wiphy, new_rfkill); - - D_RF_KILL("RF_KILL bit toggled to %s.\n", - new_rfkill ? "disable radio" : "enable radio"); - } - - /* Keep this running, even if radio now enabled. This will be - * cancelled in mac_start() if system decides to start again */ - queue_delayed_work(il->workqueue, &il->_3945.rfkill_poll, - round_jiffies_relative(2 * HZ)); - -} - -int -il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif) -{ - struct il_host_cmd cmd = { - .id = C_SCAN, - .len = sizeof(struct il3945_scan_cmd), - .flags = CMD_SIZE_HUGE, - }; - struct il3945_scan_cmd *scan; - u8 n_probes = 0; - enum ieee80211_band band; - bool is_active = false; - int ret; - u16 len; - - lockdep_assert_held(&il->mutex); - - if (!il->scan_cmd) { - il->scan_cmd = - kmalloc(sizeof(struct il3945_scan_cmd) + IL_MAX_SCAN_SIZE, - GFP_KERNEL); - if (!il->scan_cmd) { - D_SCAN("Fail to allocate scan memory\n"); - return -ENOMEM; - } - } - scan = il->scan_cmd; - memset(scan, 0, sizeof(struct il3945_scan_cmd) + IL_MAX_SCAN_SIZE); - - scan->quiet_plcp_th = IL_PLCP_QUIET_THRESH; - scan->quiet_time = IL_ACTIVE_QUIET_TIME; - - if (il_is_associated(il)) { - u16 interval; - u32 extra; - u32 suspend_time = 100; - u32 scan_suspend_time = 100; - - D_INFO("Scanning while associated...\n"); - - interval = vif->bss_conf.beacon_int; - - scan->suspend_time = 0; - scan->max_out_time = cpu_to_le32(200 * 1024); - if (!interval) - interval = suspend_time; - /* - * suspend time format: - * 0-19: beacon interval in usec (time before exec.) - * 20-23: 0 - * 24-31: number of beacons (suspend between channels) - */ - - extra = (suspend_time / interval) << 24; - scan_suspend_time = - 0xFF0FFFFF & (extra | ((suspend_time % interval) * 1024)); - - scan->suspend_time = cpu_to_le32(scan_suspend_time); - D_SCAN("suspend_time 0x%X beacon interval %d\n", - scan_suspend_time, interval); - } - - if (il->scan_request->n_ssids) { - int i, p = 0; - D_SCAN("Kicking off active scan\n"); - for (i = 0; i < il->scan_request->n_ssids; i++) { - /* always does wildcard anyway */ - if (!il->scan_request->ssids[i].ssid_len) - continue; - scan->direct_scan[p].id = WLAN_EID_SSID; - scan->direct_scan[p].len = - il->scan_request->ssids[i].ssid_len; - memcpy(scan->direct_scan[p].ssid, - il->scan_request->ssids[i].ssid, - il->scan_request->ssids[i].ssid_len); - n_probes++; - p++; - } - is_active = true; - } else - D_SCAN("Kicking off passive scan.\n"); - - /* We don't build a direct scan probe request; the uCode will do - * that based on the direct_mask added to each channel entry */ - scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; - scan->tx_cmd.sta_id = il->hw_params.bcast_id; - scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; - - /* flags + rate selection */ - - switch (il->scan_band) { - case IEEE80211_BAND_2GHZ: - scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; - scan->tx_cmd.rate = RATE_1M_PLCP; - band = IEEE80211_BAND_2GHZ; - break; - case IEEE80211_BAND_5GHZ: - scan->tx_cmd.rate = RATE_6M_PLCP; - band = IEEE80211_BAND_5GHZ; - break; - default: - IL_WARN("Invalid scan band\n"); - return -EIO; - } - - /* - * If active scaning is requested but a certain channel is marked - * passive, we can do active scanning if we detect transmissions. For - * passive only scanning disable switching to active on any channel. - */ - scan->good_CRC_th = - is_active ? IL_GOOD_CRC_TH_DEFAULT : IL_GOOD_CRC_TH_NEVER; - - len = - il_fill_probe_req(il, (struct ieee80211_mgmt *)scan->data, - vif->addr, il->scan_request->ie, - il->scan_request->ie_len, - IL_MAX_SCAN_SIZE - sizeof(*scan)); - scan->tx_cmd.len = cpu_to_le16(len); - - /* select Rx antennas */ - scan->flags |= il3945_get_antenna_flags(il); - - scan->channel_count = - il3945_get_channels_for_scan(il, band, is_active, n_probes, - (void *)&scan->data[len], vif); - if (scan->channel_count == 0) { - D_SCAN("channel count %d\n", scan->channel_count); - return -EIO; - } - - cmd.len += - le16_to_cpu(scan->tx_cmd.len) + - scan->channel_count * sizeof(struct il3945_scan_channel); - cmd.data = scan; - scan->len = cpu_to_le16(cmd.len); - - set_bit(S_SCAN_HW, &il->status); - ret = il_send_cmd_sync(il, &cmd); - if (ret) - clear_bit(S_SCAN_HW, &il->status); - return ret; -} - -void -il3945_post_scan(struct il_priv *il) -{ - /* - * Since setting the RXON may have been deferred while - * performing the scan, fire one off if needed - */ - if (memcmp(&il->staging, &il->active, sizeof(il->staging))) - il3945_commit_rxon(il); -} - -static void -il3945_bg_restart(struct work_struct *data) -{ - struct il_priv *il = container_of(data, struct il_priv, restart); - - if (test_bit(S_EXIT_PENDING, &il->status)) - return; - - if (test_and_clear_bit(S_FW_ERROR, &il->status)) { - mutex_lock(&il->mutex); - il->is_open = 0; - mutex_unlock(&il->mutex); - il3945_down(il); - ieee80211_restart_hw(il->hw); - } else { - il3945_down(il); - - mutex_lock(&il->mutex); - if (test_bit(S_EXIT_PENDING, &il->status)) { - mutex_unlock(&il->mutex); - return; - } - - __il3945_up(il); - mutex_unlock(&il->mutex); - } -} - -static void -il3945_bg_rx_replenish(struct work_struct *data) -{ - struct il_priv *il = container_of(data, struct il_priv, rx_replenish); - - mutex_lock(&il->mutex); - if (test_bit(S_EXIT_PENDING, &il->status)) - goto out; - - il3945_rx_replenish(il); -out: - mutex_unlock(&il->mutex); -} - -void -il3945_post_associate(struct il_priv *il) -{ - int rc = 0; - struct ieee80211_conf *conf = NULL; - - if (!il->vif || !il->is_open) - return; - - D_ASSOC("Associated as %d to: %pM\n", il->vif->bss_conf.aid, - il->active.bssid_addr); - - if (test_bit(S_EXIT_PENDING, &il->status)) - return; - - il_scan_cancel_timeout(il, 200); - - conf = &il->hw->conf; - - il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - il3945_commit_rxon(il); - - rc = il_send_rxon_timing(il); - if (rc) - IL_WARN("C_RXON_TIMING failed - " "Attempting to continue.\n"); - - il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - - il->staging.assoc_id = cpu_to_le16(il->vif->bss_conf.aid); - - D_ASSOC("assoc id %d beacon interval %d\n", il->vif->bss_conf.aid, - il->vif->bss_conf.beacon_int); - - if (il->vif->bss_conf.use_short_preamble) - il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; - else - il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; - - if (il->staging.flags & RXON_FLG_BAND_24G_MSK) { - if (il->vif->bss_conf.use_short_slot) - il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; - else - il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; - } - - il3945_commit_rxon(il); - - switch (il->vif->type) { - case NL80211_IFTYPE_STATION: - il3945_rate_scale_init(il->hw, IL_AP_ID); - break; - case NL80211_IFTYPE_ADHOC: - il3945_send_beacon_cmd(il); - break; - default: - IL_ERR("%s Should not be called in %d mode\n", __func__, - il->vif->type); - break; - } -} - -/***************************************************************************** - * - * mac80211 entry point functions - * - *****************************************************************************/ - -#define UCODE_READY_TIMEOUT (2 * HZ) - -static int -il3945_mac_start(struct ieee80211_hw *hw) -{ - struct il_priv *il = hw->priv; - int ret; - - /* we should be verifying the device is ready to be opened */ - mutex_lock(&il->mutex); - D_MAC80211("enter\n"); - - /* fetch ucode file from disk, alloc and copy to bus-master buffers ... - * ucode filename and max sizes are card-specific. */ - - if (!il->ucode_code.len) { - ret = il3945_read_ucode(il); - if (ret) { - IL_ERR("Could not read microcode: %d\n", ret); - mutex_unlock(&il->mutex); - goto out_release_irq; - } - } - - ret = __il3945_up(il); - - mutex_unlock(&il->mutex); - - if (ret) - goto out_release_irq; - - D_INFO("Start UP work.\n"); - - /* Wait for START_ALIVE from ucode. Otherwise callbacks from - * mac80211 will not be run successfully. */ - ret = wait_event_timeout(il->wait_command_queue, - test_bit(S_READY, &il->status), - UCODE_READY_TIMEOUT); - if (!ret) { - if (!test_bit(S_READY, &il->status)) { - IL_ERR("Wait for START_ALIVE timeout after %dms.\n", - jiffies_to_msecs(UCODE_READY_TIMEOUT)); - ret = -ETIMEDOUT; - goto out_release_irq; - } - } - - /* ucode is running and will send rfkill notifications, - * no need to poll the killswitch state anymore */ - cancel_delayed_work(&il->_3945.rfkill_poll); - - il->is_open = 1; - D_MAC80211("leave\n"); - return 0; - -out_release_irq: - il->is_open = 0; - D_MAC80211("leave - failed\n"); - return ret; -} - -static void -il3945_mac_stop(struct ieee80211_hw *hw) -{ - struct il_priv *il = hw->priv; - - D_MAC80211("enter\n"); - - if (!il->is_open) { - D_MAC80211("leave - skip\n"); - return; - } - - il->is_open = 0; - - il3945_down(il); - - flush_workqueue(il->workqueue); - - /* start polling the killswitch state again */ - queue_delayed_work(il->workqueue, &il->_3945.rfkill_poll, - round_jiffies_relative(2 * HZ)); - - D_MAC80211("leave\n"); -} - -static void -il3945_mac_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct il_priv *il = hw->priv; - - D_MAC80211("enter\n"); - - D_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, - ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); - - if (il3945_tx_skb(il, control->sta, skb)) - dev_kfree_skb_any(skb); - - D_MAC80211("leave\n"); -} - -void -il3945_config_ap(struct il_priv *il) -{ - struct ieee80211_vif *vif = il->vif; - int rc = 0; - - if (test_bit(S_EXIT_PENDING, &il->status)) - return; - - /* The following should be done only at AP bring up */ - if (!(il_is_associated(il))) { - - /* RXON - unassoc (to set timing command) */ - il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - il3945_commit_rxon(il); - - /* RXON Timing */ - rc = il_send_rxon_timing(il); - if (rc) - IL_WARN("C_RXON_TIMING failed - " - "Attempting to continue.\n"); - - il->staging.assoc_id = 0; - - if (vif->bss_conf.use_short_preamble) - il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; - else - il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; - - if (il->staging.flags & RXON_FLG_BAND_24G_MSK) { - if (vif->bss_conf.use_short_slot) - il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; - else - il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; - } - /* restore RXON assoc */ - il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - il3945_commit_rxon(il); - } - il3945_send_beacon_cmd(il); -} - -static int -il3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct il_priv *il = hw->priv; - int ret = 0; - u8 sta_id = IL_INVALID_STATION; - u8 static_key; - - D_MAC80211("enter\n"); - - if (il3945_mod_params.sw_crypto) { - D_MAC80211("leave - hwcrypto disabled\n"); - return -EOPNOTSUPP; - } - - /* - * To support IBSS RSN, don't program group keys in IBSS, the - * hardware will then not attempt to decrypt the frames. - */ - if (vif->type == NL80211_IFTYPE_ADHOC && - !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { - D_MAC80211("leave - IBSS RSN\n"); - return -EOPNOTSUPP; - } - - static_key = !il_is_associated(il); - - if (!static_key) { - sta_id = il_sta_id_or_broadcast(il, sta); - if (sta_id == IL_INVALID_STATION) { - D_MAC80211("leave - station not found\n"); - return -EINVAL; - } - } - - mutex_lock(&il->mutex); - il_scan_cancel_timeout(il, 100); - - switch (cmd) { - case SET_KEY: - if (static_key) - ret = il3945_set_static_key(il, key); - else - ret = il3945_set_dynamic_key(il, key, sta_id); - D_MAC80211("enable hwcrypto key\n"); - break; - case DISABLE_KEY: - if (static_key) - ret = il3945_remove_static_key(il); - else - ret = il3945_clear_sta_key_info(il, sta_id); - D_MAC80211("disable hwcrypto key\n"); - break; - default: - ret = -EINVAL; - } - - D_MAC80211("leave ret %d\n", ret); - mutex_unlock(&il->mutex); - - return ret; -} - -static int -il3945_mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct il_priv *il = hw->priv; - struct il3945_sta_priv *sta_priv = (void *)sta->drv_priv; - int ret; - bool is_ap = vif->type == NL80211_IFTYPE_STATION; - u8 sta_id; - - mutex_lock(&il->mutex); - D_INFO("station %pM\n", sta->addr); - sta_priv->common.sta_id = IL_INVALID_STATION; - - ret = il_add_station_common(il, sta->addr, is_ap, sta, &sta_id); - if (ret) { - IL_ERR("Unable to add station %pM (%d)\n", sta->addr, ret); - /* Should we return success if return code is EEXIST ? */ - mutex_unlock(&il->mutex); - return ret; - } - - sta_priv->common.sta_id = sta_id; - - /* Initialize rate scaling */ - D_INFO("Initializing rate scaling for station %pM\n", sta->addr); - il3945_rs_rate_init(il, sta, sta_id); - mutex_unlock(&il->mutex); - - return 0; -} - -static void -il3945_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, - unsigned int *total_flags, u64 multicast) -{ - struct il_priv *il = hw->priv; - __le32 filter_or = 0, filter_nand = 0; - -#define CHK(test, flag) do { \ - if (*total_flags & (test)) \ - filter_or |= (flag); \ - else \ - filter_nand |= (flag); \ - } while (0) - - D_MAC80211("Enter: changed: 0x%x, total: 0x%x\n", changed_flags, - *total_flags); - - CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); - CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK); - CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); - -#undef CHK - - mutex_lock(&il->mutex); - - il->staging.filter_flags &= ~filter_nand; - il->staging.filter_flags |= filter_or; - - /* - * Not committing directly because hardware can perform a scan, - * but even if hw is ready, committing here breaks for some reason, - * we'll eventually commit the filter flags change anyway. - */ - - mutex_unlock(&il->mutex); - - /* - * Receiving all multicast frames is always enabled by the - * default flags setup in il_connection_init_rx_config() - * since we currently do not support programming multicast - * filters into the device. - */ - *total_flags &= - FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | - FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; -} - -/***************************************************************************** - * - * sysfs attributes - * - *****************************************************************************/ - -#ifdef CONFIG_IWLEGACY_DEBUG - -/* - * The following adds a new attribute to the sysfs representation - * of this device driver (i.e. a new file in /sys/bus/pci/drivers/iwl/) - * used for controlling the debug level. - * - * See the level definitions in iwl for details. - * - * The debug_level being managed using sysfs below is a per device debug - * level that is used instead of the global debug level if it (the per - * device debug level) is set. - */ -static ssize_t -il3945_show_debug_level(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct il_priv *il = dev_get_drvdata(d); - return sprintf(buf, "0x%08X\n", il_get_debug_level(il)); -} - -static ssize_t -il3945_store_debug_level(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct il_priv *il = dev_get_drvdata(d); - unsigned long val; - int ret; - - ret = strict_strtoul(buf, 0, &val); - if (ret) - IL_INFO("%s is not in hex or decimal form.\n", buf); - else - il->debug_level = val; - - return strnlen(buf, count); -} - -static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, il3945_show_debug_level, - il3945_store_debug_level); - -#endif /* CONFIG_IWLEGACY_DEBUG */ - -static ssize_t -il3945_show_temperature(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct il_priv *il = dev_get_drvdata(d); - - if (!il_is_alive(il)) - return -EAGAIN; - - return sprintf(buf, "%d\n", il3945_hw_get_temperature(il)); -} - -static DEVICE_ATTR(temperature, S_IRUGO, il3945_show_temperature, NULL); - -static ssize_t -il3945_show_tx_power(struct device *d, struct device_attribute *attr, char *buf) -{ - struct il_priv *il = dev_get_drvdata(d); - return sprintf(buf, "%d\n", il->tx_power_user_lmt); -} - -static ssize_t -il3945_store_tx_power(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct il_priv *il = dev_get_drvdata(d); - char *p = (char *)buf; - u32 val; - - val = simple_strtoul(p, &p, 10); - if (p == buf) - IL_INFO(": %s is not in decimal form.\n", buf); - else - il3945_hw_reg_set_txpower(il, val); - - return count; -} - -static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, il3945_show_tx_power, - il3945_store_tx_power); - -static ssize_t -il3945_show_flags(struct device *d, struct device_attribute *attr, char *buf) -{ - struct il_priv *il = dev_get_drvdata(d); - - return sprintf(buf, "0x%04X\n", il->active.flags); -} - -static ssize_t -il3945_store_flags(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct il_priv *il = dev_get_drvdata(d); - u32 flags = simple_strtoul(buf, NULL, 0); - - mutex_lock(&il->mutex); - if (le32_to_cpu(il->staging.flags) != flags) { - /* Cancel any currently running scans... */ - if (il_scan_cancel_timeout(il, 100)) - IL_WARN("Could not cancel scan.\n"); - else { - D_INFO("Committing rxon.flags = 0x%04X\n", flags); - il->staging.flags = cpu_to_le32(flags); - il3945_commit_rxon(il); - } - } - mutex_unlock(&il->mutex); - - return count; -} - -static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, il3945_show_flags, - il3945_store_flags); - -static ssize_t -il3945_show_filter_flags(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct il_priv *il = dev_get_drvdata(d); - - return sprintf(buf, "0x%04X\n", le32_to_cpu(il->active.filter_flags)); -} - -static ssize_t -il3945_store_filter_flags(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct il_priv *il = dev_get_drvdata(d); - u32 filter_flags = simple_strtoul(buf, NULL, 0); - - mutex_lock(&il->mutex); - if (le32_to_cpu(il->staging.filter_flags) != filter_flags) { - /* Cancel any currently running scans... */ - if (il_scan_cancel_timeout(il, 100)) - IL_WARN("Could not cancel scan.\n"); - else { - D_INFO("Committing rxon.filter_flags = " "0x%04X\n", - filter_flags); - il->staging.filter_flags = cpu_to_le32(filter_flags); - il3945_commit_rxon(il); - } - } - mutex_unlock(&il->mutex); - - return count; -} - -static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, il3945_show_filter_flags, - il3945_store_filter_flags); - -static ssize_t -il3945_show_measurement(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct il_priv *il = dev_get_drvdata(d); - struct il_spectrum_notification measure_report; - u32 size = sizeof(measure_report), len = 0, ofs = 0; - u8 *data = (u8 *) &measure_report; - unsigned long flags; - - spin_lock_irqsave(&il->lock, flags); - if (!(il->measurement_status & MEASUREMENT_READY)) { - spin_unlock_irqrestore(&il->lock, flags); - return 0; - } - memcpy(&measure_report, &il->measure_report, size); - il->measurement_status = 0; - spin_unlock_irqrestore(&il->lock, flags); - - while (size && PAGE_SIZE - len) { - hex_dump_to_buffer(data + ofs, size, 16, 1, buf + len, - PAGE_SIZE - len, 1); - len = strlen(buf); - if (PAGE_SIZE - len) - buf[len++] = '\n'; - - ofs += 16; - size -= min(size, 16U); - } - - return len; -} - -static ssize_t -il3945_store_measurement(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct il_priv *il = dev_get_drvdata(d); - struct ieee80211_measurement_params params = { - .channel = le16_to_cpu(il->active.channel), - .start_time = cpu_to_le64(il->_3945.last_tsf), - .duration = cpu_to_le16(1), - }; - u8 type = IL_MEASURE_BASIC; - u8 buffer[32]; - u8 channel; - - if (count) { - char *p = buffer; - strlcpy(buffer, buf, sizeof(buffer)); - channel = simple_strtoul(p, NULL, 0); - if (channel) - params.channel = channel; - - p = buffer; - while (*p && *p != ' ') - p++; - if (*p) - type = simple_strtoul(p + 1, NULL, 0); - } - - D_INFO("Invoking measurement of type %d on " "channel %d (for '%s')\n", - type, params.channel, buf); - il3945_get_measurement(il, ¶ms, type); - - return count; -} - -static DEVICE_ATTR(measurement, S_IRUSR | S_IWUSR, il3945_show_measurement, - il3945_store_measurement); - -static ssize_t -il3945_store_retry_rate(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct il_priv *il = dev_get_drvdata(d); - - il->retry_rate = simple_strtoul(buf, NULL, 0); - if (il->retry_rate <= 0) - il->retry_rate = 1; - - return count; -} - -static ssize_t -il3945_show_retry_rate(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct il_priv *il = dev_get_drvdata(d); - return sprintf(buf, "%d", il->retry_rate); -} - -static DEVICE_ATTR(retry_rate, S_IWUSR | S_IRUSR, il3945_show_retry_rate, - il3945_store_retry_rate); - -static ssize_t -il3945_show_channels(struct device *d, struct device_attribute *attr, char *buf) -{ - /* all this shit doesn't belong into sysfs anyway */ - return 0; -} - -static DEVICE_ATTR(channels, S_IRUSR, il3945_show_channels, NULL); - -static ssize_t -il3945_show_antenna(struct device *d, struct device_attribute *attr, char *buf) -{ - struct il_priv *il = dev_get_drvdata(d); - - if (!il_is_alive(il)) - return -EAGAIN; - - return sprintf(buf, "%d\n", il3945_mod_params.antenna); -} - -static ssize_t -il3945_store_antenna(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct il_priv *il __maybe_unused = dev_get_drvdata(d); - int ant; - - if (count == 0) - return 0; - - if (sscanf(buf, "%1i", &ant) != 1) { - D_INFO("not in hex or decimal form.\n"); - return count; - } - - if (ant >= 0 && ant <= 2) { - D_INFO("Setting antenna select to %d.\n", ant); - il3945_mod_params.antenna = (enum il3945_antenna)ant; - } else - D_INFO("Bad antenna select value %d.\n", ant); - - return count; -} - -static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, il3945_show_antenna, - il3945_store_antenna); - -static ssize_t -il3945_show_status(struct device *d, struct device_attribute *attr, char *buf) -{ - struct il_priv *il = dev_get_drvdata(d); - if (!il_is_alive(il)) - return -EAGAIN; - return sprintf(buf, "0x%08x\n", (int)il->status); -} - -static DEVICE_ATTR(status, S_IRUGO, il3945_show_status, NULL); - -static ssize_t -il3945_dump_error_log(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct il_priv *il = dev_get_drvdata(d); - char *p = (char *)buf; - - if (p[0] == '1') - il3945_dump_nic_error_log(il); - - return strnlen(buf, count); -} - -static DEVICE_ATTR(dump_errors, S_IWUSR, NULL, il3945_dump_error_log); - -/***************************************************************************** - * - * driver setup and tear down - * - *****************************************************************************/ - -static void -il3945_setup_deferred_work(struct il_priv *il) -{ - il->workqueue = create_singlethread_workqueue(DRV_NAME); - - init_waitqueue_head(&il->wait_command_queue); - - INIT_WORK(&il->restart, il3945_bg_restart); - INIT_WORK(&il->rx_replenish, il3945_bg_rx_replenish); - INIT_DELAYED_WORK(&il->init_alive_start, il3945_bg_init_alive_start); - INIT_DELAYED_WORK(&il->alive_start, il3945_bg_alive_start); - INIT_DELAYED_WORK(&il->_3945.rfkill_poll, il3945_rfkill_poll); - - il_setup_scan_deferred_work(il); - - il3945_hw_setup_deferred_work(il); - - init_timer(&il->watchdog); - il->watchdog.data = (unsigned long)il; - il->watchdog.function = il_bg_watchdog; - - tasklet_init(&il->irq_tasklet, - (void (*)(unsigned long))il3945_irq_tasklet, - (unsigned long)il); -} - -static void -il3945_cancel_deferred_work(struct il_priv *il) -{ - il3945_hw_cancel_deferred_work(il); - - cancel_delayed_work_sync(&il->init_alive_start); - cancel_delayed_work(&il->alive_start); - - il_cancel_scan_deferred_work(il); -} - -static struct attribute *il3945_sysfs_entries[] = { - &dev_attr_antenna.attr, - &dev_attr_channels.attr, - &dev_attr_dump_errors.attr, - &dev_attr_flags.attr, - &dev_attr_filter_flags.attr, - &dev_attr_measurement.attr, - &dev_attr_retry_rate.attr, - &dev_attr_status.attr, - &dev_attr_temperature.attr, - &dev_attr_tx_power.attr, -#ifdef CONFIG_IWLEGACY_DEBUG - &dev_attr_debug_level.attr, -#endif - NULL -}; - -static struct attribute_group il3945_attribute_group = { - .name = NULL, /* put in device directory */ - .attrs = il3945_sysfs_entries, -}; - -static struct ieee80211_ops il3945_mac_ops __read_mostly = { - .tx = il3945_mac_tx, - .start = il3945_mac_start, - .stop = il3945_mac_stop, - .add_interface = il_mac_add_interface, - .remove_interface = il_mac_remove_interface, - .change_interface = il_mac_change_interface, - .config = il_mac_config, - .configure_filter = il3945_configure_filter, - .set_key = il3945_mac_set_key, - .conf_tx = il_mac_conf_tx, - .reset_tsf = il_mac_reset_tsf, - .bss_info_changed = il_mac_bss_info_changed, - .hw_scan = il_mac_hw_scan, - .sta_add = il3945_mac_sta_add, - .sta_remove = il_mac_sta_remove, - .tx_last_beacon = il_mac_tx_last_beacon, - .flush = il_mac_flush, -}; - -static int -il3945_init_drv(struct il_priv *il) -{ - int ret; - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; - - il->retry_rate = 1; - il->beacon_skb = NULL; - - spin_lock_init(&il->sta_lock); - spin_lock_init(&il->hcmd_lock); - - INIT_LIST_HEAD(&il->free_frames); - - mutex_init(&il->mutex); - - il->ieee_channels = NULL; - il->ieee_rates = NULL; - il->band = IEEE80211_BAND_2GHZ; - - il->iw_mode = NL80211_IFTYPE_STATION; - il->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF; - - /* initialize force reset */ - il->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD; - - if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { - IL_WARN("Unsupported EEPROM version: 0x%04X\n", - eeprom->version); - ret = -EINVAL; - goto err; - } - ret = il_init_channel_map(il); - if (ret) { - IL_ERR("initializing regulatory failed: %d\n", ret); - goto err; - } - - /* Set up txpower settings in driver for all channels */ - if (il3945_txpower_set_from_eeprom(il)) { - ret = -EIO; - goto err_free_channel_map; - } - - ret = il_init_geos(il); - if (ret) { - IL_ERR("initializing geos failed: %d\n", ret); - goto err_free_channel_map; - } - il3945_init_hw_rates(il, il->ieee_rates); - - return 0; - -err_free_channel_map: - il_free_channel_map(il); -err: - return ret; -} - -#define IL3945_MAX_PROBE_REQUEST 200 - -static int -il3945_setup_mac(struct il_priv *il) -{ - int ret; - struct ieee80211_hw *hw = il->hw; - - hw->rate_control_algorithm = "iwl-3945-rs"; - hw->sta_data_size = sizeof(struct il3945_sta_priv); - hw->vif_data_size = sizeof(struct il_vif_priv); - - /* Tell mac80211 our characteristics */ - hw->flags = IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_SPECTRUM_MGMT | - IEEE80211_HW_SUPPORTS_PS | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; - - hw->wiphy->interface_modes = - BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); - - hw->wiphy->flags |= - WIPHY_FLAG_CUSTOM_REGULATORY | WIPHY_FLAG_DISABLE_BEACON_HINTS | - WIPHY_FLAG_IBSS_RSN; - - hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; - - hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX_3945; - /* we create the 802.11 header and a zero-length SSID element */ - hw->wiphy->max_scan_ie_len = IL3945_MAX_PROBE_REQUEST - 24 - 2; - - /* Default value; 4 EDCA QOS priorities */ - hw->queues = 4; - - if (il->bands[IEEE80211_BAND_2GHZ].n_channels) - il->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = - &il->bands[IEEE80211_BAND_2GHZ]; - - if (il->bands[IEEE80211_BAND_5GHZ].n_channels) - il->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = - &il->bands[IEEE80211_BAND_5GHZ]; - - il_leds_init(il); - - ret = ieee80211_register_hw(il->hw); - if (ret) { - IL_ERR("Failed to register hw (error %d)\n", ret); - return ret; - } - il->mac80211_registered = 1; - - return 0; -} - -static int -il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - int err = 0; - struct il_priv *il; - struct ieee80211_hw *hw; - struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data); - struct il3945_eeprom *eeprom; - unsigned long flags; - - /*********************** - * 1. Allocating HW data - * ********************/ - - hw = ieee80211_alloc_hw(sizeof(struct il_priv), &il3945_mac_ops); - if (!hw) { - err = -ENOMEM; - goto out; - } - il = hw->priv; - il->hw = hw; - SET_IEEE80211_DEV(hw, &pdev->dev); - - il->cmd_queue = IL39_CMD_QUEUE_NUM; - - /* - * Disabling hardware scan means that mac80211 will perform scans - * "the hard way", rather than using device's scan. - */ - if (il3945_mod_params.disable_hw_scan) { - D_INFO("Disabling hw_scan\n"); - il3945_mac_ops.hw_scan = NULL; - } - - D_INFO("*** LOAD DRIVER ***\n"); - il->cfg = cfg; - il->ops = &il3945_ops; -#ifdef CONFIG_IWLEGACY_DEBUGFS - il->debugfs_ops = &il3945_debugfs_ops; -#endif - il->pci_dev = pdev; - il->inta_mask = CSR_INI_SET_MASK; - - /*************************** - * 2. Initializing PCI bus - * *************************/ - pci_disable_link_state(pdev, - PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 | - PCIE_LINK_STATE_CLKPM); - - if (pci_enable_device(pdev)) { - err = -ENODEV; - goto out_ieee80211_free_hw; - } - - pci_set_master(pdev); - - err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); - if (!err) - err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); - if (err) { - IL_WARN("No suitable DMA available.\n"); - goto out_pci_disable_device; - } - - pci_set_drvdata(pdev, il); - err = pci_request_regions(pdev, DRV_NAME); - if (err) - goto out_pci_disable_device; - - /*********************** - * 3. Read REV Register - * ********************/ - il->hw_base = pci_ioremap_bar(pdev, 0); - if (!il->hw_base) { - err = -ENODEV; - goto out_pci_release_regions; - } - - D_INFO("pci_resource_len = 0x%08llx\n", - (unsigned long long)pci_resource_len(pdev, 0)); - D_INFO("pci_resource_base = %p\n", il->hw_base); - - /* We disable the RETRY_TIMEOUT register (0x41) to keep - * PCI Tx retries from interfering with C3 CPU state */ - pci_write_config_byte(pdev, 0x41, 0x00); - - /* these spin locks will be used in apm_init and EEPROM access - * we should init now - */ - spin_lock_init(&il->reg_lock); - spin_lock_init(&il->lock); - - /* - * stop and reset the on-board processor just in case it is in a - * strange state ... like being left stranded by a primary kernel - * and this is now the kdump kernel trying to start up - */ - _il_wr(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); - - /*********************** - * 4. Read EEPROM - * ********************/ - - /* Read the EEPROM */ - err = il_eeprom_init(il); - if (err) { - IL_ERR("Unable to init EEPROM\n"); - goto out_iounmap; - } - /* MAC Address location in EEPROM same for 3945/4965 */ - eeprom = (struct il3945_eeprom *)il->eeprom; - D_INFO("MAC address: %pM\n", eeprom->mac_address); - SET_IEEE80211_PERM_ADDR(il->hw, eeprom->mac_address); - - /*********************** - * 5. Setup HW Constants - * ********************/ - /* Device-specific setup */ - if (il3945_hw_set_hw_params(il)) { - IL_ERR("failed to set hw settings\n"); - goto out_eeprom_free; - } - - /*********************** - * 6. Setup il - * ********************/ - - err = il3945_init_drv(il); - if (err) { - IL_ERR("initializing driver failed\n"); - goto out_unset_hw_params; - } - - IL_INFO("Detected Intel Wireless WiFi Link %s\n", il->cfg->name); - - /*********************** - * 7. Setup Services - * ********************/ - - spin_lock_irqsave(&il->lock, flags); - il_disable_interrupts(il); - spin_unlock_irqrestore(&il->lock, flags); - - pci_enable_msi(il->pci_dev); - - err = request_irq(il->pci_dev->irq, il_isr, IRQF_SHARED, DRV_NAME, il); - if (err) { - IL_ERR("Error allocating IRQ %d\n", il->pci_dev->irq); - goto out_disable_msi; - } - - err = sysfs_create_group(&pdev->dev.kobj, &il3945_attribute_group); - if (err) { - IL_ERR("failed to create sysfs device attributes\n"); - goto out_release_irq; - } - - il_set_rxon_channel(il, &il->bands[IEEE80211_BAND_2GHZ].channels[5]); - il3945_setup_deferred_work(il); - il3945_setup_handlers(il); - il_power_initialize(il); - - /********************************* - * 8. Setup and Register mac80211 - * *******************************/ - - il_enable_interrupts(il); - - err = il3945_setup_mac(il); - if (err) - goto out_remove_sysfs; - - err = il_dbgfs_register(il, DRV_NAME); - if (err) - IL_ERR("failed to create debugfs files. Ignoring error: %d\n", - err); - - /* Start monitoring the killswitch */ - queue_delayed_work(il->workqueue, &il->_3945.rfkill_poll, 2 * HZ); - - return 0; - -out_remove_sysfs: - destroy_workqueue(il->workqueue); - il->workqueue = NULL; - sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group); -out_release_irq: - free_irq(il->pci_dev->irq, il); -out_disable_msi: - pci_disable_msi(il->pci_dev); - il_free_geos(il); - il_free_channel_map(il); -out_unset_hw_params: - il3945_unset_hw_params(il); -out_eeprom_free: - il_eeprom_free(il); -out_iounmap: - iounmap(il->hw_base); -out_pci_release_regions: - pci_release_regions(pdev); -out_pci_disable_device: - pci_set_drvdata(pdev, NULL); - pci_disable_device(pdev); -out_ieee80211_free_hw: - ieee80211_free_hw(il->hw); -out: - return err; -} - -static void -il3945_pci_remove(struct pci_dev *pdev) -{ - struct il_priv *il = pci_get_drvdata(pdev); - unsigned long flags; - - if (!il) - return; - - D_INFO("*** UNLOAD DRIVER ***\n"); - - il_dbgfs_unregister(il); - - set_bit(S_EXIT_PENDING, &il->status); - - il_leds_exit(il); - - if (il->mac80211_registered) { - ieee80211_unregister_hw(il->hw); - il->mac80211_registered = 0; - } else { - il3945_down(il); - } - - /* - * Make sure device is reset to low power before unloading driver. - * This may be redundant with il_down(), but there are paths to - * run il_down() without calling apm_ops.stop(), and there are - * paths to avoid running il_down() at all before leaving driver. - * This (inexpensive) call *makes sure* device is reset. - */ - il_apm_stop(il); - - /* make sure we flush any pending irq or - * tasklet for the driver - */ - spin_lock_irqsave(&il->lock, flags); - il_disable_interrupts(il); - spin_unlock_irqrestore(&il->lock, flags); - - il3945_synchronize_irq(il); - - sysfs_remove_group(&pdev->dev.kobj, &il3945_attribute_group); - - cancel_delayed_work_sync(&il->_3945.rfkill_poll); - - il3945_dealloc_ucode_pci(il); - - if (il->rxq.bd) - il3945_rx_queue_free(il, &il->rxq); - il3945_hw_txq_ctx_free(il); - - il3945_unset_hw_params(il); - - /*netif_stop_queue(dev); */ - flush_workqueue(il->workqueue); - - /* ieee80211_unregister_hw calls il3945_mac_stop, which flushes - * il->workqueue... so we can't take down the workqueue - * until now... */ - destroy_workqueue(il->workqueue); - il->workqueue = NULL; - - free_irq(pdev->irq, il); - pci_disable_msi(pdev); - - iounmap(il->hw_base); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - - il_free_channel_map(il); - il_free_geos(il); - kfree(il->scan_cmd); - if (il->beacon_skb) - dev_kfree_skb(il->beacon_skb); - - ieee80211_free_hw(il->hw); -} - -/***************************************************************************** - * - * driver and module entry point - * - *****************************************************************************/ - -static struct pci_driver il3945_driver = { - .name = DRV_NAME, - .id_table = il3945_hw_card_ids, - .probe = il3945_pci_probe, - .remove = il3945_pci_remove, - .driver.pm = IL_LEGACY_PM_OPS, -}; - -static int __init -il3945_init(void) -{ - - int ret; - pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n"); - pr_info(DRV_COPYRIGHT "\n"); - - ret = il3945_rate_control_register(); - if (ret) { - pr_err("Unable to register rate control algorithm: %d\n", ret); - return ret; - } - - ret = pci_register_driver(&il3945_driver); - if (ret) { - pr_err("Unable to initialize PCI module\n"); - goto error_register; - } - - return ret; - -error_register: - il3945_rate_control_unregister(); - return ret; -} - -static void __exit -il3945_exit(void) -{ - pci_unregister_driver(&il3945_driver); - il3945_rate_control_unregister(); -} - -MODULE_FIRMWARE(IL3945_MODULE_FIRMWARE(IL3945_UCODE_API_MAX)); - -module_param_named(antenna, il3945_mod_params.antenna, int, S_IRUGO); -MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); -module_param_named(swcrypto, il3945_mod_params.sw_crypto, int, S_IRUGO); -MODULE_PARM_DESC(swcrypto, "using software crypto (default 1 [software])"); -module_param_named(disable_hw_scan, il3945_mod_params.disable_hw_scan, int, - S_IRUGO); -MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 1)"); -#ifdef CONFIG_IWLEGACY_DEBUG -module_param_named(debug, il_debug_level, uint, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(debug, "debug output mask"); -#endif -module_param_named(fw_restart, il3945_mod_params.restart_fw, int, S_IRUGO); -MODULE_PARM_DESC(fw_restart, "restart firmware in case of error"); - -module_exit(il3945_exit); -module_init(il3945_init); diff --git a/drivers/net/wireless/iwlegacy/3945-rs.c b/drivers/net/wireless/iwlegacy/3945-rs.c deleted file mode 100644 index fe31590a51b2..000000000000 --- a/drivers/net/wireless/iwlegacy/3945-rs.c +++ /dev/null @@ -1,980 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2005 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "commands.h" -#include "3945.h" - -#define RS_NAME "iwl-3945-rs" - -static s32 il3945_expected_tpt_g[RATE_COUNT_3945] = { - 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 -}; - -static s32 il3945_expected_tpt_g_prot[RATE_COUNT_3945] = { - 7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125 -}; - -static s32 il3945_expected_tpt_a[RATE_COUNT_3945] = { - 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186 -}; - -static s32 il3945_expected_tpt_b[RATE_COUNT_3945] = { - 7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -struct il3945_tpt_entry { - s8 min_rssi; - u8 idx; -}; - -static struct il3945_tpt_entry il3945_tpt_table_a[] = { - {-60, RATE_54M_IDX}, - {-64, RATE_48M_IDX}, - {-72, RATE_36M_IDX}, - {-80, RATE_24M_IDX}, - {-84, RATE_18M_IDX}, - {-85, RATE_12M_IDX}, - {-87, RATE_9M_IDX}, - {-89, RATE_6M_IDX} -}; - -static struct il3945_tpt_entry il3945_tpt_table_g[] = { - {-60, RATE_54M_IDX}, - {-64, RATE_48M_IDX}, - {-68, RATE_36M_IDX}, - {-80, RATE_24M_IDX}, - {-84, RATE_18M_IDX}, - {-85, RATE_12M_IDX}, - {-86, RATE_11M_IDX}, - {-88, RATE_5M_IDX}, - {-90, RATE_2M_IDX}, - {-92, RATE_1M_IDX} -}; - -#define RATE_MAX_WINDOW 62 -#define RATE_FLUSH (3*HZ) -#define RATE_WIN_FLUSH (HZ/2) -#define IL39_RATE_HIGH_TH 11520 -#define IL_SUCCESS_UP_TH 8960 -#define IL_SUCCESS_DOWN_TH 10880 -#define RATE_MIN_FAILURE_TH 6 -#define RATE_MIN_SUCCESS_TH 8 -#define RATE_DECREASE_TH 1920 -#define RATE_RETRY_TH 15 - -static u8 -il3945_get_rate_idx_by_rssi(s32 rssi, enum ieee80211_band band) -{ - u32 idx = 0; - u32 table_size = 0; - struct il3945_tpt_entry *tpt_table = NULL; - - if (rssi < IL_MIN_RSSI_VAL || rssi > IL_MAX_RSSI_VAL) - rssi = IL_MIN_RSSI_VAL; - - switch (band) { - case IEEE80211_BAND_2GHZ: - tpt_table = il3945_tpt_table_g; - table_size = ARRAY_SIZE(il3945_tpt_table_g); - break; - case IEEE80211_BAND_5GHZ: - tpt_table = il3945_tpt_table_a; - table_size = ARRAY_SIZE(il3945_tpt_table_a); - break; - default: - BUG(); - break; - } - - while (idx < table_size && rssi < tpt_table[idx].min_rssi) - idx++; - - idx = min(idx, table_size - 1); - - return tpt_table[idx].idx; -} - -static void -il3945_clear_win(struct il3945_rate_scale_data *win) -{ - win->data = 0; - win->success_counter = 0; - win->success_ratio = -1; - win->counter = 0; - win->average_tpt = IL_INVALID_VALUE; - win->stamp = 0; -} - -/** - * il3945_rate_scale_flush_wins - flush out the rate scale wins - * - * Returns the number of wins that have gathered data but were - * not flushed. If there were any that were not flushed, then - * reschedule the rate flushing routine. - */ -static int -il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta) -{ - int unflushed = 0; - int i; - unsigned long flags; - struct il_priv *il __maybe_unused = rs_sta->il; - - /* - * For each rate, if we have collected data on that rate - * and it has been more than RATE_WIN_FLUSH - * since we flushed, clear out the gathered stats - */ - for (i = 0; i < RATE_COUNT_3945; i++) { - if (!rs_sta->win[i].counter) - continue; - - spin_lock_irqsave(&rs_sta->lock, flags); - if (time_after(jiffies, rs_sta->win[i].stamp + RATE_WIN_FLUSH)) { - D_RATE("flushing %d samples of rate " "idx %d\n", - rs_sta->win[i].counter, i); - il3945_clear_win(&rs_sta->win[i]); - } else - unflushed++; - spin_unlock_irqrestore(&rs_sta->lock, flags); - } - - return unflushed; -} - -#define RATE_FLUSH_MAX 5000 /* msec */ -#define RATE_FLUSH_MIN 50 /* msec */ -#define IL_AVERAGE_PACKETS 1500 - -static void -il3945_bg_rate_scale_flush(unsigned long data) -{ - struct il3945_rs_sta *rs_sta = (void *)data; - struct il_priv *il __maybe_unused = rs_sta->il; - int unflushed = 0; - unsigned long flags; - u32 packet_count, duration, pps; - - D_RATE("enter\n"); - - unflushed = il3945_rate_scale_flush_wins(rs_sta); - - spin_lock_irqsave(&rs_sta->lock, flags); - - /* Number of packets Rx'd since last time this timer ran */ - packet_count = (rs_sta->tx_packets - rs_sta->last_tx_packets) + 1; - - rs_sta->last_tx_packets = rs_sta->tx_packets + 1; - - if (unflushed) { - duration = - jiffies_to_msecs(jiffies - rs_sta->last_partial_flush); - - D_RATE("Tx'd %d packets in %dms\n", packet_count, duration); - - /* Determine packets per second */ - if (duration) - pps = (packet_count * 1000) / duration; - else - pps = 0; - - if (pps) { - duration = (IL_AVERAGE_PACKETS * 1000) / pps; - if (duration < RATE_FLUSH_MIN) - duration = RATE_FLUSH_MIN; - else if (duration > RATE_FLUSH_MAX) - duration = RATE_FLUSH_MAX; - } else - duration = RATE_FLUSH_MAX; - - rs_sta->flush_time = msecs_to_jiffies(duration); - - D_RATE("new flush period: %d msec ave %d\n", duration, - packet_count); - - mod_timer(&rs_sta->rate_scale_flush, - jiffies + rs_sta->flush_time); - - rs_sta->last_partial_flush = jiffies; - } else { - rs_sta->flush_time = RATE_FLUSH; - rs_sta->flush_pending = 0; - } - /* If there weren't any unflushed entries, we don't schedule the timer - * to run again */ - - rs_sta->last_flush = jiffies; - - spin_unlock_irqrestore(&rs_sta->lock, flags); - - D_RATE("leave\n"); -} - -/** - * il3945_collect_tx_data - Update the success/failure sliding win - * - * We keep a sliding win of the last 64 packets transmitted - * at this rate. win->data contains the bitmask of successful - * packets. - */ -static void -il3945_collect_tx_data(struct il3945_rs_sta *rs_sta, - struct il3945_rate_scale_data *win, int success, - int retries, int idx) -{ - unsigned long flags; - s32 fail_count; - struct il_priv *il __maybe_unused = rs_sta->il; - - if (!retries) { - D_RATE("leave: retries == 0 -- should be at least 1\n"); - return; - } - - spin_lock_irqsave(&rs_sta->lock, flags); - - /* - * Keep track of only the latest 62 tx frame attempts in this rate's - * history win; anything older isn't really relevant any more. - * If we have filled up the sliding win, drop the oldest attempt; - * if the oldest attempt (highest bit in bitmap) shows "success", - * subtract "1" from the success counter (this is the main reason - * we keep these bitmaps!). - * */ - while (retries > 0) { - if (win->counter >= RATE_MAX_WINDOW) { - - /* remove earliest */ - win->counter = RATE_MAX_WINDOW - 1; - - if (win->data & (1ULL << (RATE_MAX_WINDOW - 1))) { - win->data &= ~(1ULL << (RATE_MAX_WINDOW - 1)); - win->success_counter--; - } - } - - /* Increment frames-attempted counter */ - win->counter++; - - /* Shift bitmap by one frame (throw away oldest history), - * OR in "1", and increment "success" if this - * frame was successful. */ - win->data <<= 1; - if (success > 0) { - win->success_counter++; - win->data |= 0x1; - success--; - } - - retries--; - } - - /* Calculate current success ratio, avoid divide-by-0! */ - if (win->counter > 0) - win->success_ratio = - 128 * (100 * win->success_counter) / win->counter; - else - win->success_ratio = IL_INVALID_VALUE; - - fail_count = win->counter - win->success_counter; - - /* Calculate average throughput, if we have enough history. */ - if (fail_count >= RATE_MIN_FAILURE_TH || - win->success_counter >= RATE_MIN_SUCCESS_TH) - win->average_tpt = - ((win->success_ratio * rs_sta->expected_tpt[idx] + - 64) / 128); - else - win->average_tpt = IL_INVALID_VALUE; - - /* Tag this win as having been updated */ - win->stamp = jiffies; - - spin_unlock_irqrestore(&rs_sta->lock, flags); -} - -/* - * Called after adding a new station to initialize rate scaling - */ -void -il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id) -{ - struct ieee80211_hw *hw = il->hw; - struct ieee80211_conf *conf = &il->hw->conf; - struct il3945_sta_priv *psta; - struct il3945_rs_sta *rs_sta; - struct ieee80211_supported_band *sband; - int i; - - D_INFO("enter\n"); - if (sta_id == il->hw_params.bcast_id) - goto out; - - psta = (struct il3945_sta_priv *)sta->drv_priv; - rs_sta = &psta->rs_sta; - sband = hw->wiphy->bands[conf->chandef.chan->band]; - - rs_sta->il = il; - - rs_sta->start_rate = RATE_INVALID; - - /* default to just 802.11b */ - rs_sta->expected_tpt = il3945_expected_tpt_b; - - rs_sta->last_partial_flush = jiffies; - rs_sta->last_flush = jiffies; - rs_sta->flush_time = RATE_FLUSH; - rs_sta->last_tx_packets = 0; - - rs_sta->rate_scale_flush.data = (unsigned long)rs_sta; - rs_sta->rate_scale_flush.function = il3945_bg_rate_scale_flush; - - for (i = 0; i < RATE_COUNT_3945; i++) - il3945_clear_win(&rs_sta->win[i]); - - /* TODO: what is a good starting rate for STA? About middle? Maybe not - * the lowest or the highest rate.. Could consider using RSSI from - * previous packets? Need to have IEEE 802.1X auth succeed immediately - * after assoc.. */ - - for (i = sband->n_bitrates - 1; i >= 0; i--) { - if (sta->supp_rates[sband->band] & (1 << i)) { - rs_sta->last_txrate_idx = i; - break; - } - } - - il->_3945.sta_supp_rates = sta->supp_rates[sband->band]; - /* For 5 GHz band it start at IL_FIRST_OFDM_RATE */ - if (sband->band == IEEE80211_BAND_5GHZ) { - rs_sta->last_txrate_idx += IL_FIRST_OFDM_RATE; - il->_3945.sta_supp_rates <<= IL_FIRST_OFDM_RATE; - } - -out: - il->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS; - - D_INFO("leave\n"); -} - -static void * -il3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) -{ - return hw->priv; -} - -/* rate scale requires free function to be implemented */ -static void -il3945_rs_free(void *il) -{ -} - -static void * -il3945_rs_alloc_sta(void *il_priv, struct ieee80211_sta *sta, gfp_t gfp) -{ - struct il3945_rs_sta *rs_sta; - struct il3945_sta_priv *psta = (void *)sta->drv_priv; - struct il_priv *il __maybe_unused = il_priv; - - D_RATE("enter\n"); - - rs_sta = &psta->rs_sta; - - spin_lock_init(&rs_sta->lock); - init_timer(&rs_sta->rate_scale_flush); - - D_RATE("leave\n"); - - return rs_sta; -} - -static void -il3945_rs_free_sta(void *il_priv, struct ieee80211_sta *sta, void *il_sta) -{ - struct il3945_rs_sta *rs_sta = il_sta; - - /* - * Be careful not to use any members of il3945_rs_sta (like trying - * to use il_priv to print out debugging) since it may not be fully - * initialized at this point. - */ - del_timer_sync(&rs_sta->rate_scale_flush); -} - -/** - * il3945_rs_tx_status - Update rate control values based on Tx results - * - * NOTE: Uses il_priv->retry_rate for the # of retries attempted by - * the hardware for each rate. - */ -static void -il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *il_sta, - struct sk_buff *skb) -{ - s8 retries = 0, current_count; - int scale_rate_idx, first_idx, last_idx; - unsigned long flags; - struct il_priv *il = (struct il_priv *)il_rate; - struct il3945_rs_sta *rs_sta = il_sta; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - D_RATE("enter\n"); - - retries = info->status.rates[0].count; - /* Sanity Check for retries */ - if (retries > RATE_RETRY_TH) - retries = RATE_RETRY_TH; - - first_idx = sband->bitrates[info->status.rates[0].idx].hw_value; - if (first_idx < 0 || first_idx >= RATE_COUNT_3945) { - D_RATE("leave: Rate out of bounds: %d\n", first_idx); - return; - } - - if (!il_sta) { - D_RATE("leave: No STA il data to update!\n"); - return; - } - - /* Treat uninitialized rate scaling data same as non-existing. */ - if (!rs_sta->il) { - D_RATE("leave: STA il data uninitialized!\n"); - return; - } - - rs_sta->tx_packets++; - - scale_rate_idx = first_idx; - last_idx = first_idx; - - /* - * Update the win for each rate. We determine which rates - * were Tx'd based on the total number of retries vs. the number - * of retries configured for each rate -- currently set to the - * il value 'retry_rate' vs. rate specific - * - * On exit from this while loop last_idx indicates the rate - * at which the frame was finally transmitted (or failed if no - * ACK) - */ - while (retries > 1) { - if ((retries - 1) < il->retry_rate) { - current_count = (retries - 1); - last_idx = scale_rate_idx; - } else { - current_count = il->retry_rate; - last_idx = il3945_rs_next_rate(il, scale_rate_idx); - } - - /* Update this rate accounting for as many retries - * as was used for it (per current_count) */ - il3945_collect_tx_data(rs_sta, &rs_sta->win[scale_rate_idx], 0, - current_count, scale_rate_idx); - D_RATE("Update rate %d for %d retries.\n", scale_rate_idx, - current_count); - - retries -= current_count; - - scale_rate_idx = last_idx; - } - - /* Update the last idx win with success/failure based on ACK */ - D_RATE("Update rate %d with %s.\n", last_idx, - (info->flags & IEEE80211_TX_STAT_ACK) ? "success" : "failure"); - il3945_collect_tx_data(rs_sta, &rs_sta->win[last_idx], - info->flags & IEEE80211_TX_STAT_ACK, 1, - last_idx); - - /* We updated the rate scale win -- if its been more than - * flush_time since the last run, schedule the flush - * again */ - spin_lock_irqsave(&rs_sta->lock, flags); - - if (!rs_sta->flush_pending && - time_after(jiffies, rs_sta->last_flush + rs_sta->flush_time)) { - - rs_sta->last_partial_flush = jiffies; - rs_sta->flush_pending = 1; - mod_timer(&rs_sta->rate_scale_flush, - jiffies + rs_sta->flush_time); - } - - spin_unlock_irqrestore(&rs_sta->lock, flags); - - D_RATE("leave\n"); -} - -static u16 -il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta, u8 idx, u16 rate_mask, - enum ieee80211_band band) -{ - u8 high = RATE_INVALID; - u8 low = RATE_INVALID; - struct il_priv *il __maybe_unused = rs_sta->il; - - /* 802.11A walks to the next literal adjacent rate in - * the rate table */ - if (unlikely(band == IEEE80211_BAND_5GHZ)) { - int i; - u32 mask; - - /* Find the previous rate that is in the rate mask */ - i = idx - 1; - for (mask = (1 << i); i >= 0; i--, mask >>= 1) { - if (rate_mask & mask) { - low = i; - break; - } - } - - /* Find the next rate that is in the rate mask */ - i = idx + 1; - for (mask = (1 << i); i < RATE_COUNT_3945; i++, mask <<= 1) { - if (rate_mask & mask) { - high = i; - break; - } - } - - return (high << 8) | low; - } - - low = idx; - while (low != RATE_INVALID) { - if (rs_sta->tgg) - low = il3945_rates[low].prev_rs_tgg; - else - low = il3945_rates[low].prev_rs; - if (low == RATE_INVALID) - break; - if (rate_mask & (1 << low)) - break; - D_RATE("Skipping masked lower rate: %d\n", low); - } - - high = idx; - while (high != RATE_INVALID) { - if (rs_sta->tgg) - high = il3945_rates[high].next_rs_tgg; - else - high = il3945_rates[high].next_rs; - if (high == RATE_INVALID) - break; - if (rate_mask & (1 << high)) - break; - D_RATE("Skipping masked higher rate: %d\n", high); - } - - return (high << 8) | low; -} - -/** - * il3945_rs_get_rate - find the rate for the requested packet - * - * Returns the ieee80211_rate structure allocated by the driver. - * - * The rate control algorithm has no internal mapping between hw_mode's - * rate ordering and the rate ordering used by the rate control algorithm. - * - * The rate control algorithm uses a single table of rates that goes across - * the entire A/B/G spectrum vs. being limited to just one particular - * hw_mode. - * - * As such, we can't convert the idx obtained below into the hw_mode's - * rate table and must reference the driver allocated rate table - * - */ -static void -il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta, - struct ieee80211_tx_rate_control *txrc) -{ - struct ieee80211_supported_band *sband = txrc->sband; - struct sk_buff *skb = txrc->skb; - u8 low = RATE_INVALID; - u8 high = RATE_INVALID; - u16 high_low; - int idx; - struct il3945_rs_sta *rs_sta = il_sta; - struct il3945_rate_scale_data *win = NULL; - int current_tpt = IL_INVALID_VALUE; - int low_tpt = IL_INVALID_VALUE; - int high_tpt = IL_INVALID_VALUE; - u32 fail_count; - s8 scale_action = 0; - unsigned long flags; - u16 rate_mask; - s8 max_rate_idx = -1; - struct il_priv *il __maybe_unused = (struct il_priv *)il_r; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - D_RATE("enter\n"); - - /* Treat uninitialized rate scaling data same as non-existing. */ - if (rs_sta && !rs_sta->il) { - D_RATE("Rate scaling information not initialized yet.\n"); - il_sta = NULL; - } - - if (rate_control_send_low(sta, il_sta, txrc)) - return; - - rate_mask = sta->supp_rates[sband->band]; - - /* get user max rate if set */ - max_rate_idx = txrc->max_rate_idx; - if (sband->band == IEEE80211_BAND_5GHZ && max_rate_idx != -1) - max_rate_idx += IL_FIRST_OFDM_RATE; - if (max_rate_idx < 0 || max_rate_idx >= RATE_COUNT) - max_rate_idx = -1; - - idx = min(rs_sta->last_txrate_idx & 0xffff, RATE_COUNT_3945 - 1); - - if (sband->band == IEEE80211_BAND_5GHZ) - rate_mask = rate_mask << IL_FIRST_OFDM_RATE; - - spin_lock_irqsave(&rs_sta->lock, flags); - - /* for recent assoc, choose best rate regarding - * to rssi value - */ - if (rs_sta->start_rate != RATE_INVALID) { - if (rs_sta->start_rate < idx && - (rate_mask & (1 << rs_sta->start_rate))) - idx = rs_sta->start_rate; - rs_sta->start_rate = RATE_INVALID; - } - - /* force user max rate if set by user */ - if (max_rate_idx != -1 && max_rate_idx < idx) { - if (rate_mask & (1 << max_rate_idx)) - idx = max_rate_idx; - } - - win = &(rs_sta->win[idx]); - - fail_count = win->counter - win->success_counter; - - if (fail_count < RATE_MIN_FAILURE_TH && - win->success_counter < RATE_MIN_SUCCESS_TH) { - spin_unlock_irqrestore(&rs_sta->lock, flags); - - D_RATE("Invalid average_tpt on rate %d: " - "counter: %d, success_counter: %d, " - "expected_tpt is %sNULL\n", idx, win->counter, - win->success_counter, - rs_sta->expected_tpt ? "not " : ""); - - /* Can't calculate this yet; not enough history */ - win->average_tpt = IL_INVALID_VALUE; - goto out; - - } - - current_tpt = win->average_tpt; - - high_low = - il3945_get_adjacent_rate(rs_sta, idx, rate_mask, sband->band); - low = high_low & 0xff; - high = (high_low >> 8) & 0xff; - - /* If user set max rate, dont allow higher than user constrain */ - if (max_rate_idx != -1 && max_rate_idx < high) - high = RATE_INVALID; - - /* Collect Measured throughputs of adjacent rates */ - if (low != RATE_INVALID) - low_tpt = rs_sta->win[low].average_tpt; - - if (high != RATE_INVALID) - high_tpt = rs_sta->win[high].average_tpt; - - spin_unlock_irqrestore(&rs_sta->lock, flags); - - scale_action = 0; - - /* Low success ratio , need to drop the rate */ - if (win->success_ratio < RATE_DECREASE_TH || !current_tpt) { - D_RATE("decrease rate because of low success_ratio\n"); - scale_action = -1; - /* No throughput measured yet for adjacent rates, - * try increase */ - } else if (low_tpt == IL_INVALID_VALUE && high_tpt == IL_INVALID_VALUE) { - - if (high != RATE_INVALID && - win->success_ratio >= RATE_INCREASE_TH) - scale_action = 1; - else if (low != RATE_INVALID) - scale_action = 0; - - /* Both adjacent throughputs are measured, but neither one has - * better throughput; we're using the best rate, don't change - * it! */ - } else if (low_tpt != IL_INVALID_VALUE && high_tpt != IL_INVALID_VALUE - && low_tpt < current_tpt && high_tpt < current_tpt) { - - D_RATE("No action -- low [%d] & high [%d] < " - "current_tpt [%d]\n", low_tpt, high_tpt, current_tpt); - scale_action = 0; - - /* At least one of the rates has better throughput */ - } else { - if (high_tpt != IL_INVALID_VALUE) { - - /* High rate has better throughput, Increase - * rate */ - if (high_tpt > current_tpt && - win->success_ratio >= RATE_INCREASE_TH) - scale_action = 1; - else { - D_RATE("decrease rate because of high tpt\n"); - scale_action = 0; - } - } else if (low_tpt != IL_INVALID_VALUE) { - if (low_tpt > current_tpt) { - D_RATE("decrease rate because of low tpt\n"); - scale_action = -1; - } else if (win->success_ratio >= RATE_INCREASE_TH) { - /* Lower rate has better - * throughput,decrease rate */ - scale_action = 1; - } - } - } - - /* Sanity check; asked for decrease, but success rate or throughput - * has been good at old rate. Don't change it. */ - if (scale_action == -1 && low != RATE_INVALID && - (win->success_ratio > RATE_HIGH_TH || - current_tpt > 100 * rs_sta->expected_tpt[low])) - scale_action = 0; - - switch (scale_action) { - case -1: - /* Decrese rate */ - if (low != RATE_INVALID) - idx = low; - break; - case 1: - /* Increase rate */ - if (high != RATE_INVALID) - idx = high; - - break; - case 0: - default: - /* No change */ - break; - } - - D_RATE("Selected %d (action %d) - low %d high %d\n", idx, scale_action, - low, high); - -out: - - if (sband->band == IEEE80211_BAND_5GHZ) { - if (WARN_ON_ONCE(idx < IL_FIRST_OFDM_RATE)) - idx = IL_FIRST_OFDM_RATE; - rs_sta->last_txrate_idx = idx; - info->control.rates[0].idx = idx - IL_FIRST_OFDM_RATE; - } else { - rs_sta->last_txrate_idx = idx; - info->control.rates[0].idx = rs_sta->last_txrate_idx; - } - info->control.rates[0].count = 1; - - D_RATE("leave: %d\n", idx); -} - -#ifdef CONFIG_MAC80211_DEBUGFS - -static ssize_t -il3945_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - char *buff; - int desc = 0; - int j; - ssize_t ret; - struct il3945_rs_sta *lq_sta = file->private_data; - - buff = kmalloc(1024, GFP_KERNEL); - if (!buff) - return -ENOMEM; - - desc += - sprintf(buff + desc, - "tx packets=%d last rate idx=%d\n" - "rate=0x%X flush time %d\n", lq_sta->tx_packets, - lq_sta->last_txrate_idx, lq_sta->start_rate, - jiffies_to_msecs(lq_sta->flush_time)); - for (j = 0; j < RATE_COUNT_3945; j++) { - desc += - sprintf(buff + desc, "counter=%d success=%d %%=%d\n", - lq_sta->win[j].counter, - lq_sta->win[j].success_counter, - lq_sta->win[j].success_ratio); - } - ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); - kfree(buff); - return ret; -} - -static const struct file_operations rs_sta_dbgfs_stats_table_ops = { - .read = il3945_sta_dbgfs_stats_table_read, - .open = simple_open, - .llseek = default_llseek, -}; - -static void -il3945_add_debugfs(void *il, void *il_sta, struct dentry *dir) -{ - struct il3945_rs_sta *lq_sta = il_sta; - - lq_sta->rs_sta_dbgfs_stats_table_file = - debugfs_create_file("rate_stats_table", 0600, dir, lq_sta, - &rs_sta_dbgfs_stats_table_ops); - -} - -static void -il3945_remove_debugfs(void *il, void *il_sta) -{ - struct il3945_rs_sta *lq_sta = il_sta; - debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); -} -#endif - -/* - * Initialization of rate scaling information is done by driver after - * the station is added. Since mac80211 calls this function before a - * station is added we ignore it. - */ -static void -il3945_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *il_sta) -{ -} - -static struct rate_control_ops rs_ops = { - .module = NULL, - .name = RS_NAME, - .tx_status = il3945_rs_tx_status, - .get_rate = il3945_rs_get_rate, - .rate_init = il3945_rs_rate_init_stub, - .alloc = il3945_rs_alloc, - .free = il3945_rs_free, - .alloc_sta = il3945_rs_alloc_sta, - .free_sta = il3945_rs_free_sta, -#ifdef CONFIG_MAC80211_DEBUGFS - .add_sta_debugfs = il3945_add_debugfs, - .remove_sta_debugfs = il3945_remove_debugfs, -#endif - -}; - -void -il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) -{ - struct il_priv *il = hw->priv; - s32 rssi = 0; - unsigned long flags; - struct il3945_rs_sta *rs_sta; - struct ieee80211_sta *sta; - struct il3945_sta_priv *psta; - - D_RATE("enter\n"); - - rcu_read_lock(); - - sta = ieee80211_find_sta(il->vif, il->stations[sta_id].sta.sta.addr); - if (!sta) { - D_RATE("Unable to find station to initialize rate scaling.\n"); - rcu_read_unlock(); - return; - } - - psta = (void *)sta->drv_priv; - rs_sta = &psta->rs_sta; - - spin_lock_irqsave(&rs_sta->lock, flags); - - rs_sta->tgg = 0; - switch (il->band) { - case IEEE80211_BAND_2GHZ: - /* TODO: this always does G, not a regression */ - if (il->active.flags & RXON_FLG_TGG_PROTECT_MSK) { - rs_sta->tgg = 1; - rs_sta->expected_tpt = il3945_expected_tpt_g_prot; - } else - rs_sta->expected_tpt = il3945_expected_tpt_g; - break; - case IEEE80211_BAND_5GHZ: - rs_sta->expected_tpt = il3945_expected_tpt_a; - break; - default: - BUG(); - break; - } - - spin_unlock_irqrestore(&rs_sta->lock, flags); - - rssi = il->_3945.last_rx_rssi; - if (rssi == 0) - rssi = IL_MIN_RSSI_VAL; - - D_RATE("Network RSSI: %d\n", rssi); - - rs_sta->start_rate = il3945_get_rate_idx_by_rssi(rssi, il->band); - - D_RATE("leave: rssi %d assign rate idx: " "%d (plcp 0x%x)\n", rssi, - rs_sta->start_rate, il3945_rates[rs_sta->start_rate].plcp); - rcu_read_unlock(); -} - -int -il3945_rate_control_register(void) -{ - return ieee80211_rate_control_register(&rs_ops); -} - -void -il3945_rate_control_unregister(void) -{ - ieee80211_rate_control_unregister(&rs_ops); -} diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c deleted file mode 100644 index 9a5f36e5c864..000000000000 --- a/drivers/net/wireless/iwlegacy/3945.c +++ /dev/null @@ -1,2724 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "common.h" -#include "3945.h" - -/* Send led command */ -static int -il3945_send_led_cmd(struct il_priv *il, struct il_led_cmd *led_cmd) -{ - struct il_host_cmd cmd = { - .id = C_LEDS, - .len = sizeof(struct il_led_cmd), - .data = led_cmd, - .flags = CMD_ASYNC, - .callback = NULL, - }; - - return il_send_cmd(il, &cmd); -} - -#define IL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np) \ - [RATE_##r##M_IDX] = { RATE_##r##M_PLCP, \ - RATE_##r##M_IEEE, \ - RATE_##ip##M_IDX, \ - RATE_##in##M_IDX, \ - RATE_##rp##M_IDX, \ - RATE_##rn##M_IDX, \ - RATE_##pp##M_IDX, \ - RATE_##np##M_IDX, \ - RATE_##r##M_IDX_TBL, \ - RATE_##ip##M_IDX_TBL } - -/* - * Parameter order: - * rate, prev rate, next rate, prev tgg rate, next tgg rate - * - * If there isn't a valid next or previous rate then INV is used which - * maps to RATE_INVALID - * - */ -const struct il3945_rate_info il3945_rates[RATE_COUNT_3945] = { - IL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2), /* 1mbps */ - IL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5), /* 2mbps */ - IL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11), /*5.5mbps */ - IL_DECLARE_RATE_INFO(11, 9, 12, 5, 12, 5, 18), /* 11mbps */ - IL_DECLARE_RATE_INFO(6, 5, 9, 5, 11, 5, 11), /* 6mbps */ - IL_DECLARE_RATE_INFO(9, 6, 11, 5, 11, 5, 11), /* 9mbps */ - IL_DECLARE_RATE_INFO(12, 11, 18, 11, 18, 11, 18), /* 12mbps */ - IL_DECLARE_RATE_INFO(18, 12, 24, 12, 24, 11, 24), /* 18mbps */ - IL_DECLARE_RATE_INFO(24, 18, 36, 18, 36, 18, 36), /* 24mbps */ - IL_DECLARE_RATE_INFO(36, 24, 48, 24, 48, 24, 48), /* 36mbps */ - IL_DECLARE_RATE_INFO(48, 36, 54, 36, 54, 36, 54), /* 48mbps */ - IL_DECLARE_RATE_INFO(54, 48, INV, 48, INV, 48, INV), /* 54mbps */ -}; - -static inline u8 -il3945_get_prev_ieee_rate(u8 rate_idx) -{ - u8 rate = il3945_rates[rate_idx].prev_ieee; - - if (rate == RATE_INVALID) - rate = rate_idx; - return rate; -} - -/* 1 = enable the il3945_disable_events() function */ -#define IL_EVT_DISABLE (0) -#define IL_EVT_DISABLE_SIZE (1532/32) - -/** - * il3945_disable_events - Disable selected events in uCode event log - * - * Disable an event by writing "1"s into "disable" - * bitmap in SRAM. Bit position corresponds to Event # (id/type). - * Default values of 0 enable uCode events to be logged. - * Use for only special debugging. This function is just a placeholder as-is, - * you'll need to provide the special bits! ... - * ... and set IL_EVT_DISABLE to 1. */ -void -il3945_disable_events(struct il_priv *il) -{ - int i; - u32 base; /* SRAM address of event log header */ - u32 disable_ptr; /* SRAM address of event-disable bitmap array */ - u32 array_size; /* # of u32 entries in array */ - static const u32 evt_disable[IL_EVT_DISABLE_SIZE] = { - 0x00000000, /* 31 - 0 Event id numbers */ - 0x00000000, /* 63 - 32 */ - 0x00000000, /* 95 - 64 */ - 0x00000000, /* 127 - 96 */ - 0x00000000, /* 159 - 128 */ - 0x00000000, /* 191 - 160 */ - 0x00000000, /* 223 - 192 */ - 0x00000000, /* 255 - 224 */ - 0x00000000, /* 287 - 256 */ - 0x00000000, /* 319 - 288 */ - 0x00000000, /* 351 - 320 */ - 0x00000000, /* 383 - 352 */ - 0x00000000, /* 415 - 384 */ - 0x00000000, /* 447 - 416 */ - 0x00000000, /* 479 - 448 */ - 0x00000000, /* 511 - 480 */ - 0x00000000, /* 543 - 512 */ - 0x00000000, /* 575 - 544 */ - 0x00000000, /* 607 - 576 */ - 0x00000000, /* 639 - 608 */ - 0x00000000, /* 671 - 640 */ - 0x00000000, /* 703 - 672 */ - 0x00000000, /* 735 - 704 */ - 0x00000000, /* 767 - 736 */ - 0x00000000, /* 799 - 768 */ - 0x00000000, /* 831 - 800 */ - 0x00000000, /* 863 - 832 */ - 0x00000000, /* 895 - 864 */ - 0x00000000, /* 927 - 896 */ - 0x00000000, /* 959 - 928 */ - 0x00000000, /* 991 - 960 */ - 0x00000000, /* 1023 - 992 */ - 0x00000000, /* 1055 - 1024 */ - 0x00000000, /* 1087 - 1056 */ - 0x00000000, /* 1119 - 1088 */ - 0x00000000, /* 1151 - 1120 */ - 0x00000000, /* 1183 - 1152 */ - 0x00000000, /* 1215 - 1184 */ - 0x00000000, /* 1247 - 1216 */ - 0x00000000, /* 1279 - 1248 */ - 0x00000000, /* 1311 - 1280 */ - 0x00000000, /* 1343 - 1312 */ - 0x00000000, /* 1375 - 1344 */ - 0x00000000, /* 1407 - 1376 */ - 0x00000000, /* 1439 - 1408 */ - 0x00000000, /* 1471 - 1440 */ - 0x00000000, /* 1503 - 1472 */ - }; - - base = le32_to_cpu(il->card_alive.log_event_table_ptr); - if (!il3945_hw_valid_rtc_data_addr(base)) { - IL_ERR("Invalid event log pointer 0x%08X\n", base); - return; - } - - disable_ptr = il_read_targ_mem(il, base + (4 * sizeof(u32))); - array_size = il_read_targ_mem(il, base + (5 * sizeof(u32))); - - if (IL_EVT_DISABLE && array_size == IL_EVT_DISABLE_SIZE) { - D_INFO("Disabling selected uCode log events at 0x%x\n", - disable_ptr); - for (i = 0; i < IL_EVT_DISABLE_SIZE; i++) - il_write_targ_mem(il, disable_ptr + (i * sizeof(u32)), - evt_disable[i]); - - } else { - D_INFO("Selected uCode log events may be disabled\n"); - D_INFO(" by writing \"1\"s into disable bitmap\n"); - D_INFO(" in SRAM at 0x%x, size %d u32s\n", disable_ptr, - array_size); - } - -} - -static int -il3945_hwrate_to_plcp_idx(u8 plcp) -{ - int idx; - - for (idx = 0; idx < RATE_COUNT_3945; idx++) - if (il3945_rates[idx].plcp == plcp) - return idx; - return -1; -} - -#ifdef CONFIG_IWLEGACY_DEBUG -#define TX_STATUS_ENTRY(x) case TX_3945_STATUS_FAIL_ ## x: return #x - -static const char * -il3945_get_tx_fail_reason(u32 status) -{ - switch (status & TX_STATUS_MSK) { - case TX_3945_STATUS_SUCCESS: - return "SUCCESS"; - TX_STATUS_ENTRY(SHORT_LIMIT); - TX_STATUS_ENTRY(LONG_LIMIT); - TX_STATUS_ENTRY(FIFO_UNDERRUN); - TX_STATUS_ENTRY(MGMNT_ABORT); - TX_STATUS_ENTRY(NEXT_FRAG); - TX_STATUS_ENTRY(LIFE_EXPIRE); - TX_STATUS_ENTRY(DEST_PS); - TX_STATUS_ENTRY(ABORTED); - TX_STATUS_ENTRY(BT_RETRY); - TX_STATUS_ENTRY(STA_INVALID); - TX_STATUS_ENTRY(FRAG_DROPPED); - TX_STATUS_ENTRY(TID_DISABLE); - TX_STATUS_ENTRY(FRAME_FLUSHED); - TX_STATUS_ENTRY(INSUFFICIENT_CF_POLL); - TX_STATUS_ENTRY(TX_LOCKED); - TX_STATUS_ENTRY(NO_BEACON_ON_RADAR); - } - - return "UNKNOWN"; -} -#else -static inline const char * -il3945_get_tx_fail_reason(u32 status) -{ - return ""; -} -#endif - -/* - * get ieee prev rate from rate scale table. - * for A and B mode we need to overright prev - * value - */ -int -il3945_rs_next_rate(struct il_priv *il, int rate) -{ - int next_rate = il3945_get_prev_ieee_rate(rate); - - switch (il->band) { - case IEEE80211_BAND_5GHZ: - if (rate == RATE_12M_IDX) - next_rate = RATE_9M_IDX; - else if (rate == RATE_6M_IDX) - next_rate = RATE_6M_IDX; - break; - case IEEE80211_BAND_2GHZ: - if (!(il->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && - il_is_associated(il)) { - if (rate == RATE_11M_IDX) - next_rate = RATE_5M_IDX; - } - break; - - default: - break; - } - - return next_rate; -} - -/** - * il3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd - * - * When FW advances 'R' idx, all entries between old and new 'R' idx - * need to be reclaimed. As result, some free space forms. If there is - * enough free space (> low mark), wake the stack that feeds us. - */ -static void -il3945_tx_queue_reclaim(struct il_priv *il, int txq_id, int idx) -{ - struct il_tx_queue *txq = &il->txq[txq_id]; - struct il_queue *q = &txq->q; - struct sk_buff *skb; - - BUG_ON(txq_id == IL39_CMD_QUEUE_NUM); - - for (idx = il_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; - q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) { - - skb = txq->skbs[txq->q.read_ptr]; - ieee80211_tx_status_irqsafe(il->hw, skb); - txq->skbs[txq->q.read_ptr] = NULL; - il->ops->txq_free_tfd(il, txq); - } - - if (il_queue_space(q) > q->low_mark && txq_id >= 0 && - txq_id != IL39_CMD_QUEUE_NUM && il->mac80211_registered) - il_wake_queue(il, txq); -} - -/** - * il3945_hdl_tx - Handle Tx response - */ -static void -il3945_hdl_tx(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - u16 sequence = le16_to_cpu(pkt->hdr.sequence); - int txq_id = SEQ_TO_QUEUE(sequence); - int idx = SEQ_TO_IDX(sequence); - struct il_tx_queue *txq = &il->txq[txq_id]; - struct ieee80211_tx_info *info; - struct il3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; - u32 status = le32_to_cpu(tx_resp->status); - int rate_idx; - int fail; - - if (idx >= txq->q.n_bd || il_queue_used(&txq->q, idx) == 0) { - IL_ERR("Read idx for DMA queue txq_id (%d) idx %d " - "is out of range [0-%d] %d %d\n", txq_id, idx, - txq->q.n_bd, txq->q.write_ptr, txq->q.read_ptr); - return; - } - - txq->time_stamp = jiffies; - info = IEEE80211_SKB_CB(txq->skbs[txq->q.read_ptr]); - ieee80211_tx_info_clear_status(info); - - /* Fill the MRR chain with some info about on-chip retransmissions */ - rate_idx = il3945_hwrate_to_plcp_idx(tx_resp->rate); - if (info->band == IEEE80211_BAND_5GHZ) - rate_idx -= IL_FIRST_OFDM_RATE; - - fail = tx_resp->failure_frame; - - info->status.rates[0].idx = rate_idx; - info->status.rates[0].count = fail + 1; /* add final attempt */ - - /* tx_status->rts_retry_count = tx_resp->failure_rts; */ - info->flags |= - ((status & TX_STATUS_MSK) == - TX_STATUS_SUCCESS) ? IEEE80211_TX_STAT_ACK : 0; - - D_TX("Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", txq_id, - il3945_get_tx_fail_reason(status), status, tx_resp->rate, - tx_resp->failure_frame); - - D_TX_REPLY("Tx queue reclaim %d\n", idx); - il3945_tx_queue_reclaim(il, txq_id, idx); - - if (status & TX_ABORT_REQUIRED_MSK) - IL_ERR("TODO: Implement Tx ABORT REQUIRED!!!\n"); -} - -/***************************************************************************** - * - * Intel PRO/Wireless 3945ABG/BG Network Connection - * - * RX handler implementations - * - *****************************************************************************/ -#ifdef CONFIG_IWLEGACY_DEBUGFS -static void -il3945_accumulative_stats(struct il_priv *il, __le32 * stats) -{ - int i; - __le32 *prev_stats; - u32 *accum_stats; - u32 *delta, *max_delta; - - prev_stats = (__le32 *) &il->_3945.stats; - accum_stats = (u32 *) &il->_3945.accum_stats; - delta = (u32 *) &il->_3945.delta_stats; - max_delta = (u32 *) &il->_3945.max_delta; - - for (i = sizeof(__le32); i < sizeof(struct il3945_notif_stats); - i += - sizeof(__le32), stats++, prev_stats++, delta++, max_delta++, - accum_stats++) { - if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) { - *delta = - (le32_to_cpu(*stats) - le32_to_cpu(*prev_stats)); - *accum_stats += *delta; - if (*delta > *max_delta) - *max_delta = *delta; - } - } - - /* reset accumulative stats for "no-counter" type stats */ - il->_3945.accum_stats.general.temperature = - il->_3945.stats.general.temperature; - il->_3945.accum_stats.general.ttl_timestamp = - il->_3945.stats.general.ttl_timestamp; -} -#endif - -void -il3945_hdl_stats(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - - D_RX("Statistics notification received (%d vs %d).\n", - (int)sizeof(struct il3945_notif_stats), - le32_to_cpu(pkt->len_n_flags) & IL_RX_FRAME_SIZE_MSK); -#ifdef CONFIG_IWLEGACY_DEBUGFS - il3945_accumulative_stats(il, (__le32 *) &pkt->u.raw); -#endif - - memcpy(&il->_3945.stats, pkt->u.raw, sizeof(il->_3945.stats)); -} - -void -il3945_hdl_c_stats(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - __le32 *flag = (__le32 *) &pkt->u.raw; - - if (le32_to_cpu(*flag) & UCODE_STATS_CLEAR_MSK) { -#ifdef CONFIG_IWLEGACY_DEBUGFS - memset(&il->_3945.accum_stats, 0, - sizeof(struct il3945_notif_stats)); - memset(&il->_3945.delta_stats, 0, - sizeof(struct il3945_notif_stats)); - memset(&il->_3945.max_delta, 0, - sizeof(struct il3945_notif_stats)); -#endif - D_RX("Statistics have been cleared\n"); - } - il3945_hdl_stats(il, rxb); -} - -/****************************************************************************** - * - * Misc. internal state and helper functions - * - ******************************************************************************/ - -/* This is necessary only for a number of stats, see the caller. */ -static int -il3945_is_network_packet(struct il_priv *il, struct ieee80211_hdr *header) -{ - /* Filter incoming packets to determine if they are targeted toward - * this network, discarding packets coming from ourselves */ - switch (il->iw_mode) { - case NL80211_IFTYPE_ADHOC: /* Header: Dest. | Source | BSSID */ - /* packets to our IBSS update information */ - return ether_addr_equal(header->addr3, il->bssid); - case NL80211_IFTYPE_STATION: /* Header: Dest. | AP{BSSID} | Source */ - /* packets to our IBSS update information */ - return ether_addr_equal(header->addr2, il->bssid); - default: - return 1; - } -} - -#define SMALL_PACKET_SIZE 256 - -static void -il3945_pass_packet_to_mac80211(struct il_priv *il, struct il_rx_buf *rxb, - struct ieee80211_rx_status *stats) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IL_RX_DATA(pkt); - struct il3945_rx_frame_hdr *rx_hdr = IL_RX_HDR(pkt); - struct il3945_rx_frame_end *rx_end = IL_RX_END(pkt); - u32 len = le16_to_cpu(rx_hdr->len); - struct sk_buff *skb; - __le16 fc = hdr->frame_control; - u32 fraglen = PAGE_SIZE << il->hw_params.rx_page_order; - - /* We received data from the HW, so stop the watchdog */ - if (unlikely(len + IL39_RX_FRAME_SIZE > fraglen)) { - D_DROP("Corruption detected!\n"); - return; - } - - /* We only process data packets if the interface is open */ - if (unlikely(!il->is_open)) { - D_DROP("Dropping packet while interface is not open.\n"); - return; - } - - skb = dev_alloc_skb(SMALL_PACKET_SIZE); - if (!skb) { - IL_ERR("dev_alloc_skb failed\n"); - return; - } - - if (!il3945_mod_params.sw_crypto) - il_set_decrypted_flag(il, (struct ieee80211_hdr *)pkt, - le32_to_cpu(rx_end->status), stats); - - /* If frame is small enough to fit into skb->head, copy it - * and do not consume a full page - */ - if (len <= SMALL_PACKET_SIZE) { - memcpy(skb_put(skb, len), rx_hdr->payload, len); - } else { - skb_add_rx_frag(skb, 0, rxb->page, - (void *)rx_hdr->payload - (void *)pkt, len, - fraglen); - il->alloc_rxb_page--; - rxb->page = NULL; - } - il_update_stats(il, false, fc, len); - memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); - - ieee80211_rx(il->hw, skb); -} - -#define IL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) - -static void -il3945_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct ieee80211_hdr *header; - struct ieee80211_rx_status rx_status = {}; - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il3945_rx_frame_stats *rx_stats = IL_RX_STATS(pkt); - struct il3945_rx_frame_hdr *rx_hdr = IL_RX_HDR(pkt); - struct il3945_rx_frame_end *rx_end = IL_RX_END(pkt); - u16 rx_stats_sig_avg __maybe_unused = le16_to_cpu(rx_stats->sig_avg); - u16 rx_stats_noise_diff __maybe_unused = - le16_to_cpu(rx_stats->noise_diff); - u8 network_packet; - - rx_status.flag = 0; - rx_status.mactime = le64_to_cpu(rx_end->timestamp); - rx_status.band = - (rx_hdr-> - phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? IEEE80211_BAND_2GHZ : - IEEE80211_BAND_5GHZ; - rx_status.freq = - ieee80211_channel_to_frequency(le16_to_cpu(rx_hdr->channel), - rx_status.band); - - rx_status.rate_idx = il3945_hwrate_to_plcp_idx(rx_hdr->rate); - if (rx_status.band == IEEE80211_BAND_5GHZ) - rx_status.rate_idx -= IL_FIRST_OFDM_RATE; - - rx_status.antenna = - (le16_to_cpu(rx_hdr->phy_flags) & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> - 4; - - /* set the preamble flag if appropriate */ - if (rx_hdr->phy_flags & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) - rx_status.flag |= RX_FLAG_SHORTPRE; - - if ((unlikely(rx_stats->phy_count > 20))) { - D_DROP("dsp size out of range [0,20]: %d/n", - rx_stats->phy_count); - return; - } - - if (!(rx_end->status & RX_RES_STATUS_NO_CRC32_ERROR) || - !(rx_end->status & RX_RES_STATUS_NO_RXE_OVERFLOW)) { - D_RX("Bad CRC or FIFO: 0x%08X.\n", rx_end->status); - return; - } - - /* Convert 3945's rssi indicator to dBm */ - rx_status.signal = rx_stats->rssi - IL39_RSSI_OFFSET; - - D_STATS("Rssi %d sig_avg %d noise_diff %d\n", rx_status.signal, - rx_stats_sig_avg, rx_stats_noise_diff); - - header = (struct ieee80211_hdr *)IL_RX_DATA(pkt); - - network_packet = il3945_is_network_packet(il, header); - - D_STATS("[%c] %d RSSI:%d Signal:%u, Rate:%u\n", - network_packet ? '*' : ' ', le16_to_cpu(rx_hdr->channel), - rx_status.signal, rx_status.signal, rx_status.rate_idx); - - if (network_packet) { - il->_3945.last_beacon_time = - le32_to_cpu(rx_end->beacon_timestamp); - il->_3945.last_tsf = le64_to_cpu(rx_end->timestamp); - il->_3945.last_rx_rssi = rx_status.signal; - } - - il3945_pass_packet_to_mac80211(il, rxb, &rx_status); -} - -int -il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il, struct il_tx_queue *txq, - dma_addr_t addr, u16 len, u8 reset, u8 pad) -{ - int count; - struct il_queue *q; - struct il3945_tfd *tfd, *tfd_tmp; - - q = &txq->q; - tfd_tmp = (struct il3945_tfd *)txq->tfds; - tfd = &tfd_tmp[q->write_ptr]; - - if (reset) - memset(tfd, 0, sizeof(*tfd)); - - count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); - - if (count >= NUM_TFD_CHUNKS || count < 0) { - IL_ERR("Error can not send more than %d chunks\n", - NUM_TFD_CHUNKS); - return -EINVAL; - } - - tfd->tbs[count].addr = cpu_to_le32(addr); - tfd->tbs[count].len = cpu_to_le32(len); - - count++; - - tfd->control_flags = - cpu_to_le32(TFD_CTL_COUNT_SET(count) | TFD_CTL_PAD_SET(pad)); - - return 0; -} - -/** - * il3945_hw_txq_free_tfd - Free one TFD, those at idx [txq->q.read_ptr] - * - * Does NOT advance any idxes - */ -void -il3945_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq) -{ - struct il3945_tfd *tfd_tmp = (struct il3945_tfd *)txq->tfds; - int idx = txq->q.read_ptr; - struct il3945_tfd *tfd = &tfd_tmp[idx]; - struct pci_dev *dev = il->pci_dev; - int i; - int counter; - - /* sanity check */ - counter = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); - if (counter > NUM_TFD_CHUNKS) { - IL_ERR("Too many chunks: %i\n", counter); - /* @todo issue fatal error, it is quite serious situation */ - return; - } - - /* Unmap tx_cmd */ - if (counter) - pci_unmap_single(dev, dma_unmap_addr(&txq->meta[idx], mapping), - dma_unmap_len(&txq->meta[idx], len), - PCI_DMA_TODEVICE); - - /* unmap chunks if any */ - - for (i = 1; i < counter; i++) - pci_unmap_single(dev, le32_to_cpu(tfd->tbs[i].addr), - le32_to_cpu(tfd->tbs[i].len), - PCI_DMA_TODEVICE); - - /* free SKB */ - if (txq->skbs) { - struct sk_buff *skb = txq->skbs[txq->q.read_ptr]; - - /* can be called from irqs-disabled context */ - if (skb) { - dev_kfree_skb_any(skb); - txq->skbs[txq->q.read_ptr] = NULL; - } - } -} - -/** - * il3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD: - * -*/ -void -il3945_hw_build_tx_cmd_rate(struct il_priv *il, struct il_device_cmd *cmd, - struct ieee80211_tx_info *info, - struct ieee80211_hdr *hdr, int sta_id) -{ - u16 hw_value = ieee80211_get_tx_rate(il->hw, info)->hw_value; - u16 rate_idx = min(hw_value & 0xffff, RATE_COUNT_3945 - 1); - u16 rate_mask; - int rate; - const u8 rts_retry_limit = 7; - u8 data_retry_limit; - __le32 tx_flags; - __le16 fc = hdr->frame_control; - struct il3945_tx_cmd *tx_cmd = (struct il3945_tx_cmd *)cmd->cmd.payload; - - rate = il3945_rates[rate_idx].plcp; - tx_flags = tx_cmd->tx_flags; - - /* We need to figure out how to get the sta->supp_rates while - * in this running context */ - rate_mask = RATES_MASK_3945; - - /* Set retry limit on DATA packets and Probe Responses */ - if (ieee80211_is_probe_resp(fc)) - data_retry_limit = 3; - else - data_retry_limit = IL_DEFAULT_TX_RETRY; - tx_cmd->data_retry_limit = data_retry_limit; - /* Set retry limit on RTS packets */ - tx_cmd->rts_retry_limit = min(data_retry_limit, rts_retry_limit); - - tx_cmd->rate = rate; - tx_cmd->tx_flags = tx_flags; - - /* OFDM */ - tx_cmd->supp_rates[0] = - ((rate_mask & IL_OFDM_RATES_MASK) >> IL_FIRST_OFDM_RATE) & 0xFF; - - /* CCK */ - tx_cmd->supp_rates[1] = (rate_mask & 0xF); - - D_RATE("Tx sta id: %d, rate: %d (plcp), flags: 0x%4X " - "cck/ofdm mask: 0x%x/0x%x\n", sta_id, tx_cmd->rate, - le32_to_cpu(tx_cmd->tx_flags), tx_cmd->supp_rates[1], - tx_cmd->supp_rates[0]); -} - -static u8 -il3945_sync_sta(struct il_priv *il, int sta_id, u16 tx_rate) -{ - unsigned long flags_spin; - struct il_station_entry *station; - - if (sta_id == IL_INVALID_STATION) - return IL_INVALID_STATION; - - spin_lock_irqsave(&il->sta_lock, flags_spin); - station = &il->stations[sta_id]; - - station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK; - station->sta.rate_n_flags = cpu_to_le16(tx_rate); - station->sta.mode = STA_CONTROL_MODIFY_MSK; - il_send_add_sta(il, &station->sta, CMD_ASYNC); - spin_unlock_irqrestore(&il->sta_lock, flags_spin); - - D_RATE("SCALE sync station %d to rate %d\n", sta_id, tx_rate); - return sta_id; -} - -static void -il3945_set_pwr_vmain(struct il_priv *il) -{ -/* - * (for documentation purposes) - * to set power to V_AUX, do - - if (pci_pme_capable(il->pci_dev, PCI_D3cold)) { - il_set_bits_mask_prph(il, APMG_PS_CTRL_REG, - APMG_PS_CTRL_VAL_PWR_SRC_VAUX, - ~APMG_PS_CTRL_MSK_PWR_SRC); - - _il_poll_bit(il, CSR_GPIO_IN, - CSR_GPIO_IN_VAL_VAUX_PWR_SRC, - CSR_GPIO_IN_BIT_AUX_POWER, 5000); - } - */ - - il_set_bits_mask_prph(il, APMG_PS_CTRL_REG, - APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, - ~APMG_PS_CTRL_MSK_PWR_SRC); - - _il_poll_bit(il, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC, - CSR_GPIO_IN_BIT_AUX_POWER, 5000); -} - -static int -il3945_rx_init(struct il_priv *il, struct il_rx_queue *rxq) -{ - il_wr(il, FH39_RCSR_RBD_BASE(0), rxq->bd_dma); - il_wr(il, FH39_RCSR_RPTR_ADDR(0), rxq->rb_stts_dma); - il_wr(il, FH39_RCSR_WPTR(0), 0); - il_wr(il, FH39_RCSR_CONFIG(0), - FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE | - FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE | - FH39_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN | - FH39_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 | (RX_QUEUE_SIZE_LOG - << - FH39_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE) - | FH39_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST | (1 << - FH39_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH) - | FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH); - - /* fake read to flush all prev I/O */ - il_rd(il, FH39_RSSR_CTRL); - - return 0; -} - -static int -il3945_tx_reset(struct il_priv *il) -{ - /* bypass mode */ - il_wr_prph(il, ALM_SCD_MODE_REG, 0x2); - - /* RA 0 is active */ - il_wr_prph(il, ALM_SCD_ARASTAT_REG, 0x01); - - /* all 6 fifo are active */ - il_wr_prph(il, ALM_SCD_TXFACT_REG, 0x3f); - - il_wr_prph(il, ALM_SCD_SBYP_MODE_1_REG, 0x010000); - il_wr_prph(il, ALM_SCD_SBYP_MODE_2_REG, 0x030002); - il_wr_prph(il, ALM_SCD_TXF4MF_REG, 0x000004); - il_wr_prph(il, ALM_SCD_TXF5MF_REG, 0x000005); - - il_wr(il, FH39_TSSR_CBB_BASE, il->_3945.shared_phys); - - il_wr(il, FH39_TSSR_MSG_CONFIG, - FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON | - FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON | - FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B | - FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON | - FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON | - FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH | - FH39_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH); - - return 0; -} - -/** - * il3945_txq_ctx_reset - Reset TX queue context - * - * Destroys all DMA structures and initialize them again - */ -static int -il3945_txq_ctx_reset(struct il_priv *il) -{ - int rc, txq_id; - - il3945_hw_txq_ctx_free(il); - - /* allocate tx queue structure */ - rc = il_alloc_txq_mem(il); - if (rc) - return rc; - - /* Tx CMD queue */ - rc = il3945_tx_reset(il); - if (rc) - goto error; - - /* Tx queue(s) */ - for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) { - rc = il_tx_queue_init(il, txq_id); - if (rc) { - IL_ERR("Tx %d queue init failed\n", txq_id); - goto error; - } - } - - return rc; - -error: - il3945_hw_txq_ctx_free(il); - return rc; -} - -/* - * Start up 3945's basic functionality after it has been reset - * (e.g. after platform boot, or shutdown via il_apm_stop()) - * NOTE: This does not load uCode nor start the embedded processor - */ -static int -il3945_apm_init(struct il_priv *il) -{ - int ret = il_apm_init(il); - - /* Clear APMG (NIC's internal power management) interrupts */ - il_wr_prph(il, APMG_RTC_INT_MSK_REG, 0x0); - il_wr_prph(il, APMG_RTC_INT_STT_REG, 0xFFFFFFFF); - - /* Reset radio chip */ - il_set_bits_prph(il, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); - udelay(5); - il_clear_bits_prph(il, APMG_PS_CTRL_REG, APMG_PS_CTRL_VAL_RESET_REQ); - - return ret; -} - -static void -il3945_nic_config(struct il_priv *il) -{ - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; - unsigned long flags; - u8 rev_id = il->pci_dev->revision; - - spin_lock_irqsave(&il->lock, flags); - - /* Determine HW type */ - D_INFO("HW Revision ID = 0x%X\n", rev_id); - - if (rev_id & PCI_CFG_REV_ID_BIT_RTP) - D_INFO("RTP type\n"); - else if (rev_id & PCI_CFG_REV_ID_BIT_BASIC_SKU) { - D_INFO("3945 RADIO-MB type\n"); - il_set_bit(il, CSR_HW_IF_CONFIG_REG, - CSR39_HW_IF_CONFIG_REG_BIT_3945_MB); - } else { - D_INFO("3945 RADIO-MM type\n"); - il_set_bit(il, CSR_HW_IF_CONFIG_REG, - CSR39_HW_IF_CONFIG_REG_BIT_3945_MM); - } - - if (EEPROM_SKU_CAP_OP_MODE_MRC == eeprom->sku_cap) { - D_INFO("SKU OP mode is mrc\n"); - il_set_bit(il, CSR_HW_IF_CONFIG_REG, - CSR39_HW_IF_CONFIG_REG_BIT_SKU_MRC); - } else - D_INFO("SKU OP mode is basic\n"); - - if ((eeprom->board_revision & 0xF0) == 0xD0) { - D_INFO("3945ABG revision is 0x%X\n", eeprom->board_revision); - il_set_bit(il, CSR_HW_IF_CONFIG_REG, - CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); - } else { - D_INFO("3945ABG revision is 0x%X\n", eeprom->board_revision); - il_clear_bit(il, CSR_HW_IF_CONFIG_REG, - CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE); - } - - if (eeprom->almgor_m_version <= 1) { - il_set_bit(il, CSR_HW_IF_CONFIG_REG, - CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A); - D_INFO("Card M type A version is 0x%X\n", - eeprom->almgor_m_version); - } else { - D_INFO("Card M type B version is 0x%X\n", - eeprom->almgor_m_version); - il_set_bit(il, CSR_HW_IF_CONFIG_REG, - CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B); - } - spin_unlock_irqrestore(&il->lock, flags); - - if (eeprom->sku_cap & EEPROM_SKU_CAP_SW_RF_KILL_ENABLE) - D_RF_KILL("SW RF KILL supported in EEPROM.\n"); - - if (eeprom->sku_cap & EEPROM_SKU_CAP_HW_RF_KILL_ENABLE) - D_RF_KILL("HW RF KILL supported in EEPROM.\n"); -} - -int -il3945_hw_nic_init(struct il_priv *il) -{ - int rc; - unsigned long flags; - struct il_rx_queue *rxq = &il->rxq; - - spin_lock_irqsave(&il->lock, flags); - il3945_apm_init(il); - spin_unlock_irqrestore(&il->lock, flags); - - il3945_set_pwr_vmain(il); - il3945_nic_config(il); - - /* Allocate the RX queue, or reset if it is already allocated */ - if (!rxq->bd) { - rc = il_rx_queue_alloc(il); - if (rc) { - IL_ERR("Unable to initialize Rx queue\n"); - return -ENOMEM; - } - } else - il3945_rx_queue_reset(il, rxq); - - il3945_rx_replenish(il); - - il3945_rx_init(il, rxq); - - /* Look at using this instead: - rxq->need_update = 1; - il_rx_queue_update_write_ptr(il, rxq); - */ - - il_wr(il, FH39_RCSR_WPTR(0), rxq->write & ~7); - - rc = il3945_txq_ctx_reset(il); - if (rc) - return rc; - - set_bit(S_INIT, &il->status); - - return 0; -} - -/** - * il3945_hw_txq_ctx_free - Free TXQ Context - * - * Destroy all TX DMA queues and structures - */ -void -il3945_hw_txq_ctx_free(struct il_priv *il) -{ - int txq_id; - - /* Tx queues */ - if (il->txq) - for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) - if (txq_id == IL39_CMD_QUEUE_NUM) - il_cmd_queue_free(il); - else - il_tx_queue_free(il, txq_id); - - /* free tx queue structure */ - il_free_txq_mem(il); -} - -void -il3945_hw_txq_ctx_stop(struct il_priv *il) -{ - int txq_id; - - /* stop SCD */ - _il_wr_prph(il, ALM_SCD_MODE_REG, 0); - _il_wr_prph(il, ALM_SCD_TXFACT_REG, 0); - - /* reset TFD queues */ - for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) { - _il_wr(il, FH39_TCSR_CONFIG(txq_id), 0x0); - _il_poll_bit(il, FH39_TSSR_TX_STATUS, - FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(txq_id), - FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(txq_id), - 1000); - } -} - -/** - * il3945_hw_reg_adjust_power_by_temp - * return idx delta into power gain settings table -*/ -static int -il3945_hw_reg_adjust_power_by_temp(int new_reading, int old_reading) -{ - return (new_reading - old_reading) * (-11) / 100; -} - -/** - * il3945_hw_reg_temp_out_of_range - Keep temperature in sane range - */ -static inline int -il3945_hw_reg_temp_out_of_range(int temperature) -{ - return (temperature < -260 || temperature > 25) ? 1 : 0; -} - -int -il3945_hw_get_temperature(struct il_priv *il) -{ - return _il_rd(il, CSR_UCODE_DRV_GP2); -} - -/** - * il3945_hw_reg_txpower_get_temperature - * get the current temperature by reading from NIC -*/ -static int -il3945_hw_reg_txpower_get_temperature(struct il_priv *il) -{ - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; - int temperature; - - temperature = il3945_hw_get_temperature(il); - - /* driver's okay range is -260 to +25. - * human readable okay range is 0 to +285 */ - D_INFO("Temperature: %d\n", temperature + IL_TEMP_CONVERT); - - /* handle insane temp reading */ - if (il3945_hw_reg_temp_out_of_range(temperature)) { - IL_ERR("Error bad temperature value %d\n", temperature); - - /* if really really hot(?), - * substitute the 3rd band/group's temp measured at factory */ - if (il->last_temperature > 100) - temperature = eeprom->groups[2].temperature; - else /* else use most recent "sane" value from driver */ - temperature = il->last_temperature; - } - - return temperature; /* raw, not "human readable" */ -} - -/* Adjust Txpower only if temperature variance is greater than threshold. - * - * Both are lower than older versions' 9 degrees */ -#define IL_TEMPERATURE_LIMIT_TIMER 6 - -/** - * il3945_is_temp_calib_needed - determines if new calibration is needed - * - * records new temperature in tx_mgr->temperature. - * replaces tx_mgr->last_temperature *only* if calib needed - * (assumes caller will actually do the calibration!). */ -static int -il3945_is_temp_calib_needed(struct il_priv *il) -{ - int temp_diff; - - il->temperature = il3945_hw_reg_txpower_get_temperature(il); - temp_diff = il->temperature - il->last_temperature; - - /* get absolute value */ - if (temp_diff < 0) { - D_POWER("Getting cooler, delta %d,\n", temp_diff); - temp_diff = -temp_diff; - } else if (temp_diff == 0) - D_POWER("Same temp,\n"); - else - D_POWER("Getting warmer, delta %d,\n", temp_diff); - - /* if we don't need calibration, *don't* update last_temperature */ - if (temp_diff < IL_TEMPERATURE_LIMIT_TIMER) { - D_POWER("Timed thermal calib not needed\n"); - return 0; - } - - D_POWER("Timed thermal calib needed\n"); - - /* assume that caller will actually do calib ... - * update the "last temperature" value */ - il->last_temperature = il->temperature; - return 1; -} - -#define IL_MAX_GAIN_ENTRIES 78 -#define IL_CCK_FROM_OFDM_POWER_DIFF -5 -#define IL_CCK_FROM_OFDM_IDX_DIFF (10) - -/* radio and DSP power table, each step is 1/2 dB. - * 1st number is for RF analog gain, 2nd number is for DSP pre-DAC gain. */ -static struct il3945_tx_power power_gain_table[2][IL_MAX_GAIN_ENTRIES] = { - { - {251, 127}, /* 2.4 GHz, highest power */ - {251, 127}, - {251, 127}, - {251, 127}, - {251, 125}, - {251, 110}, - {251, 105}, - {251, 98}, - {187, 125}, - {187, 115}, - {187, 108}, - {187, 99}, - {243, 119}, - {243, 111}, - {243, 105}, - {243, 97}, - {243, 92}, - {211, 106}, - {211, 100}, - {179, 120}, - {179, 113}, - {179, 107}, - {147, 125}, - {147, 119}, - {147, 112}, - {147, 106}, - {147, 101}, - {147, 97}, - {147, 91}, - {115, 107}, - {235, 121}, - {235, 115}, - {235, 109}, - {203, 127}, - {203, 121}, - {203, 115}, - {203, 108}, - {203, 102}, - {203, 96}, - {203, 92}, - {171, 110}, - {171, 104}, - {171, 98}, - {139, 116}, - {227, 125}, - {227, 119}, - {227, 113}, - {227, 107}, - {227, 101}, - {227, 96}, - {195, 113}, - {195, 106}, - {195, 102}, - {195, 95}, - {163, 113}, - {163, 106}, - {163, 102}, - {163, 95}, - {131, 113}, - {131, 106}, - {131, 102}, - {131, 95}, - {99, 113}, - {99, 106}, - {99, 102}, - {99, 95}, - {67, 113}, - {67, 106}, - {67, 102}, - {67, 95}, - {35, 113}, - {35, 106}, - {35, 102}, - {35, 95}, - {3, 113}, - {3, 106}, - {3, 102}, - {3, 95} /* 2.4 GHz, lowest power */ - }, - { - {251, 127}, /* 5.x GHz, highest power */ - {251, 120}, - {251, 114}, - {219, 119}, - {219, 101}, - {187, 113}, - {187, 102}, - {155, 114}, - {155, 103}, - {123, 117}, - {123, 107}, - {123, 99}, - {123, 92}, - {91, 108}, - {59, 125}, - {59, 118}, - {59, 109}, - {59, 102}, - {59, 96}, - {59, 90}, - {27, 104}, - {27, 98}, - {27, 92}, - {115, 118}, - {115, 111}, - {115, 104}, - {83, 126}, - {83, 121}, - {83, 113}, - {83, 105}, - {83, 99}, - {51, 118}, - {51, 111}, - {51, 104}, - {51, 98}, - {19, 116}, - {19, 109}, - {19, 102}, - {19, 98}, - {19, 93}, - {171, 113}, - {171, 107}, - {171, 99}, - {139, 120}, - {139, 113}, - {139, 107}, - {139, 99}, - {107, 120}, - {107, 113}, - {107, 107}, - {107, 99}, - {75, 120}, - {75, 113}, - {75, 107}, - {75, 99}, - {43, 120}, - {43, 113}, - {43, 107}, - {43, 99}, - {11, 120}, - {11, 113}, - {11, 107}, - {11, 99}, - {131, 107}, - {131, 99}, - {99, 120}, - {99, 113}, - {99, 107}, - {99, 99}, - {67, 120}, - {67, 113}, - {67, 107}, - {67, 99}, - {35, 120}, - {35, 113}, - {35, 107}, - {35, 99}, - {3, 120} /* 5.x GHz, lowest power */ - } -}; - -static inline u8 -il3945_hw_reg_fix_power_idx(int idx) -{ - if (idx < 0) - return 0; - if (idx >= IL_MAX_GAIN_ENTRIES) - return IL_MAX_GAIN_ENTRIES - 1; - return (u8) idx; -} - -/* Kick off thermal recalibration check every 60 seconds */ -#define REG_RECALIB_PERIOD (60) - -/** - * il3945_hw_reg_set_scan_power - Set Tx power for scan probe requests - * - * Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK) - * or 6 Mbit (OFDM) rates. - */ -static void -il3945_hw_reg_set_scan_power(struct il_priv *il, u32 scan_tbl_idx, s32 rate_idx, - const s8 *clip_pwrs, - struct il_channel_info *ch_info, int band_idx) -{ - struct il3945_scan_power_info *scan_power_info; - s8 power; - u8 power_idx; - - scan_power_info = &ch_info->scan_pwr_info[scan_tbl_idx]; - - /* use this channel group's 6Mbit clipping/saturation pwr, - * but cap at regulatory scan power restriction (set during init - * based on eeprom channel data) for this channel. */ - power = min(ch_info->scan_power, clip_pwrs[RATE_6M_IDX_TBL]); - - power = min(power, il->tx_power_user_lmt); - scan_power_info->requested_power = power; - - /* find difference between new scan *power* and current "normal" - * Tx *power* for 6Mb. Use this difference (x2) to adjust the - * current "normal" temperature-compensated Tx power *idx* for - * this rate (1Mb or 6Mb) to yield new temp-compensated scan power - * *idx*. */ - power_idx = - ch_info->power_info[rate_idx].power_table_idx - (power - - ch_info-> - power_info - [RATE_6M_IDX_TBL]. - requested_power) * - 2; - - /* store reference idx that we use when adjusting *all* scan - * powers. So we can accommodate user (all channel) or spectrum - * management (single channel) power changes "between" temperature - * feedback compensation procedures. - * don't force fit this reference idx into gain table; it may be a - * negative number. This will help avoid errors when we're at - * the lower bounds (highest gains, for warmest temperatures) - * of the table. */ - - /* don't exceed table bounds for "real" setting */ - power_idx = il3945_hw_reg_fix_power_idx(power_idx); - - scan_power_info->power_table_idx = power_idx; - scan_power_info->tpc.tx_gain = - power_gain_table[band_idx][power_idx].tx_gain; - scan_power_info->tpc.dsp_atten = - power_gain_table[band_idx][power_idx].dsp_atten; -} - -/** - * il3945_send_tx_power - fill in Tx Power command with gain settings - * - * Configures power settings for all rates for the current channel, - * using values from channel info struct, and send to NIC - */ -static int -il3945_send_tx_power(struct il_priv *il) -{ - int rate_idx, i; - const struct il_channel_info *ch_info = NULL; - struct il3945_txpowertable_cmd txpower = { - .channel = il->active.channel, - }; - u16 chan; - - if (WARN_ONCE - (test_bit(S_SCAN_HW, &il->status), - "TX Power requested while scanning!\n")) - return -EAGAIN; - - chan = le16_to_cpu(il->active.channel); - - txpower.band = (il->band == IEEE80211_BAND_5GHZ) ? 0 : 1; - ch_info = il_get_channel_info(il, il->band, chan); - if (!ch_info) { - IL_ERR("Failed to get channel info for channel %d [%d]\n", chan, - il->band); - return -EINVAL; - } - - if (!il_is_channel_valid(ch_info)) { - D_POWER("Not calling TX_PWR_TBL_CMD on " "non-Tx channel.\n"); - return 0; - } - - /* fill cmd with power settings for all rates for current channel */ - /* Fill OFDM rate */ - for (rate_idx = IL_FIRST_OFDM_RATE, i = 0; - rate_idx <= IL39_LAST_OFDM_RATE; rate_idx++, i++) { - - txpower.power[i].tpc = ch_info->power_info[i].tpc; - txpower.power[i].rate = il3945_rates[rate_idx].plcp; - - D_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n", - le16_to_cpu(txpower.channel), txpower.band, - txpower.power[i].tpc.tx_gain, - txpower.power[i].tpc.dsp_atten, txpower.power[i].rate); - } - /* Fill CCK rates */ - for (rate_idx = IL_FIRST_CCK_RATE; rate_idx <= IL_LAST_CCK_RATE; - rate_idx++, i++) { - txpower.power[i].tpc = ch_info->power_info[i].tpc; - txpower.power[i].rate = il3945_rates[rate_idx].plcp; - - D_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n", - le16_to_cpu(txpower.channel), txpower.band, - txpower.power[i].tpc.tx_gain, - txpower.power[i].tpc.dsp_atten, txpower.power[i].rate); - } - - return il_send_cmd_pdu(il, C_TX_PWR_TBL, - sizeof(struct il3945_txpowertable_cmd), - &txpower); - -} - -/** - * il3945_hw_reg_set_new_power - Configures power tables at new levels - * @ch_info: Channel to update. Uses power_info.requested_power. - * - * Replace requested_power and base_power_idx ch_info fields for - * one channel. - * - * Called if user or spectrum management changes power preferences. - * Takes into account h/w and modulation limitations (clip power). - * - * This does *not* send anything to NIC, just sets up ch_info for one channel. - * - * NOTE: reg_compensate_for_temperature_dif() *must* be run after this to - * properly fill out the scan powers, and actual h/w gain settings, - * and send changes to NIC - */ -static int -il3945_hw_reg_set_new_power(struct il_priv *il, struct il_channel_info *ch_info) -{ - struct il3945_channel_power_info *power_info; - int power_changed = 0; - int i; - const s8 *clip_pwrs; - int power; - - /* Get this chnlgrp's rate-to-max/clip-powers table */ - clip_pwrs = il->_3945.clip_groups[ch_info->group_idx].clip_powers; - - /* Get this channel's rate-to-current-power settings table */ - power_info = ch_info->power_info; - - /* update OFDM Txpower settings */ - for (i = RATE_6M_IDX_TBL; i <= RATE_54M_IDX_TBL; i++, ++power_info) { - int delta_idx; - - /* limit new power to be no more than h/w capability */ - power = min(ch_info->curr_txpow, clip_pwrs[i]); - if (power == power_info->requested_power) - continue; - - /* find difference between old and new requested powers, - * update base (non-temp-compensated) power idx */ - delta_idx = (power - power_info->requested_power) * 2; - power_info->base_power_idx -= delta_idx; - - /* save new requested power value */ - power_info->requested_power = power; - - power_changed = 1; - } - - /* update CCK Txpower settings, based on OFDM 12M setting ... - * ... all CCK power settings for a given channel are the *same*. */ - if (power_changed) { - power = - ch_info->power_info[RATE_12M_IDX_TBL].requested_power + - IL_CCK_FROM_OFDM_POWER_DIFF; - - /* do all CCK rates' il3945_channel_power_info structures */ - for (i = RATE_1M_IDX_TBL; i <= RATE_11M_IDX_TBL; i++) { - power_info->requested_power = power; - power_info->base_power_idx = - ch_info->power_info[RATE_12M_IDX_TBL]. - base_power_idx + IL_CCK_FROM_OFDM_IDX_DIFF; - ++power_info; - } - } - - return 0; -} - -/** - * il3945_hw_reg_get_ch_txpower_limit - returns new power limit for channel - * - * NOTE: Returned power limit may be less (but not more) than requested, - * based strictly on regulatory (eeprom and spectrum mgt) limitations - * (no consideration for h/w clipping limitations). - */ -static int -il3945_hw_reg_get_ch_txpower_limit(struct il_channel_info *ch_info) -{ - s8 max_power; - -#if 0 - /* if we're using TGd limits, use lower of TGd or EEPROM */ - if (ch_info->tgd_data.max_power != 0) - max_power = - min(ch_info->tgd_data.max_power, - ch_info->eeprom.max_power_avg); - - /* else just use EEPROM limits */ - else -#endif - max_power = ch_info->eeprom.max_power_avg; - - return min(max_power, ch_info->max_power_avg); -} - -/** - * il3945_hw_reg_comp_txpower_temp - Compensate for temperature - * - * Compensate txpower settings of *all* channels for temperature. - * This only accounts for the difference between current temperature - * and the factory calibration temperatures, and bases the new settings - * on the channel's base_power_idx. - * - * If RxOn is "associated", this sends the new Txpower to NIC! - */ -static int -il3945_hw_reg_comp_txpower_temp(struct il_priv *il) -{ - struct il_channel_info *ch_info = NULL; - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; - int delta_idx; - const s8 *clip_pwrs; /* array of h/w max power levels for each rate */ - u8 a_band; - u8 rate_idx; - u8 scan_tbl_idx; - u8 i; - int ref_temp; - int temperature = il->temperature; - - if (il->disable_tx_power_cal || test_bit(S_SCANNING, &il->status)) { - /* do not perform tx power calibration */ - return 0; - } - /* set up new Tx power info for each and every channel, 2.4 and 5.x */ - for (i = 0; i < il->channel_count; i++) { - ch_info = &il->channel_info[i]; - a_band = il_is_channel_a_band(ch_info); - - /* Get this chnlgrp's factory calibration temperature */ - ref_temp = (s16) eeprom->groups[ch_info->group_idx].temperature; - - /* get power idx adjustment based on current and factory - * temps */ - delta_idx = - il3945_hw_reg_adjust_power_by_temp(temperature, ref_temp); - - /* set tx power value for all rates, OFDM and CCK */ - for (rate_idx = 0; rate_idx < RATE_COUNT_3945; rate_idx++) { - int power_idx = - ch_info->power_info[rate_idx].base_power_idx; - - /* temperature compensate */ - power_idx += delta_idx; - - /* stay within table range */ - power_idx = il3945_hw_reg_fix_power_idx(power_idx); - ch_info->power_info[rate_idx].power_table_idx = - (u8) power_idx; - ch_info->power_info[rate_idx].tpc = - power_gain_table[a_band][power_idx]; - } - - /* Get this chnlgrp's rate-to-max/clip-powers table */ - clip_pwrs = - il->_3945.clip_groups[ch_info->group_idx].clip_powers; - - /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */ - for (scan_tbl_idx = 0; scan_tbl_idx < IL_NUM_SCAN_RATES; - scan_tbl_idx++) { - s32 actual_idx = - (scan_tbl_idx == - 0) ? RATE_1M_IDX_TBL : RATE_6M_IDX_TBL; - il3945_hw_reg_set_scan_power(il, scan_tbl_idx, - actual_idx, clip_pwrs, - ch_info, a_band); - } - } - - /* send Txpower command for current channel to ucode */ - return il->ops->send_tx_power(il); -} - -int -il3945_hw_reg_set_txpower(struct il_priv *il, s8 power) -{ - struct il_channel_info *ch_info; - s8 max_power; - u8 a_band; - u8 i; - - if (il->tx_power_user_lmt == power) { - D_POWER("Requested Tx power same as current " "limit: %ddBm.\n", - power); - return 0; - } - - D_POWER("Setting upper limit clamp to %ddBm.\n", power); - il->tx_power_user_lmt = power; - - /* set up new Tx powers for each and every channel, 2.4 and 5.x */ - - for (i = 0; i < il->channel_count; i++) { - ch_info = &il->channel_info[i]; - a_band = il_is_channel_a_band(ch_info); - - /* find minimum power of all user and regulatory constraints - * (does not consider h/w clipping limitations) */ - max_power = il3945_hw_reg_get_ch_txpower_limit(ch_info); - max_power = min(power, max_power); - if (max_power != ch_info->curr_txpow) { - ch_info->curr_txpow = max_power; - - /* this considers the h/w clipping limitations */ - il3945_hw_reg_set_new_power(il, ch_info); - } - } - - /* update txpower settings for all channels, - * send to NIC if associated. */ - il3945_is_temp_calib_needed(il); - il3945_hw_reg_comp_txpower_temp(il); - - return 0; -} - -static int -il3945_send_rxon_assoc(struct il_priv *il) -{ - int rc = 0; - struct il_rx_pkt *pkt; - struct il3945_rxon_assoc_cmd rxon_assoc; - struct il_host_cmd cmd = { - .id = C_RXON_ASSOC, - .len = sizeof(rxon_assoc), - .flags = CMD_WANT_SKB, - .data = &rxon_assoc, - }; - const struct il_rxon_cmd *rxon1 = &il->staging; - const struct il_rxon_cmd *rxon2 = &il->active; - - if (rxon1->flags == rxon2->flags && - rxon1->filter_flags == rxon2->filter_flags && - rxon1->cck_basic_rates == rxon2->cck_basic_rates && - rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates) { - D_INFO("Using current RXON_ASSOC. Not resending.\n"); - return 0; - } - - rxon_assoc.flags = il->staging.flags; - rxon_assoc.filter_flags = il->staging.filter_flags; - rxon_assoc.ofdm_basic_rates = il->staging.ofdm_basic_rates; - rxon_assoc.cck_basic_rates = il->staging.cck_basic_rates; - rxon_assoc.reserved = 0; - - rc = il_send_cmd_sync(il, &cmd); - if (rc) - return rc; - - pkt = (struct il_rx_pkt *)cmd.reply_page; - if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { - IL_ERR("Bad return from C_RXON_ASSOC command\n"); - rc = -EIO; - } - - il_free_pages(il, cmd.reply_page); - - return rc; -} - -/** - * il3945_commit_rxon - commit staging_rxon to hardware - * - * The RXON command in staging_rxon is committed to the hardware and - * the active_rxon structure is updated with the new data. This - * function correctly transitions out of the RXON_ASSOC_MSK state if - * a HW tune is required based on the RXON structure changes. - */ -int -il3945_commit_rxon(struct il_priv *il) -{ - /* cast away the const for active_rxon in this function */ - struct il3945_rxon_cmd *active_rxon = (void *)&il->active; - struct il3945_rxon_cmd *staging_rxon = (void *)&il->staging; - int rc = 0; - bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK); - - if (test_bit(S_EXIT_PENDING, &il->status)) - return -EINVAL; - - if (!il_is_alive(il)) - return -1; - - /* always get timestamp with Rx frame */ - staging_rxon->flags |= RXON_FLG_TSF2HOST_MSK; - - /* select antenna */ - staging_rxon->flags &= ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); - staging_rxon->flags |= il3945_get_antenna_flags(il); - - rc = il_check_rxon_cmd(il); - if (rc) { - IL_ERR("Invalid RXON configuration. Not committing.\n"); - return -EINVAL; - } - - /* If we don't need to send a full RXON, we can use - * il3945_rxon_assoc_cmd which is used to reconfigure filter - * and other flags for the current radio configuration. */ - if (!il_full_rxon_required(il)) { - rc = il_send_rxon_assoc(il); - if (rc) { - IL_ERR("Error setting RXON_ASSOC " - "configuration (%d).\n", rc); - return rc; - } - - memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); - /* - * We do not commit tx power settings while channel changing, - * do it now if tx power changed. - */ - il_set_tx_power(il, il->tx_power_next, false); - return 0; - } - - /* If we are currently associated and the new config requires - * an RXON_ASSOC and the new config wants the associated mask enabled, - * we must clear the associated from the active configuration - * before we apply the new config */ - if (il_is_associated(il) && new_assoc) { - D_INFO("Toggling associated bit on current RXON\n"); - active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; - - /* - * reserved4 and 5 could have been filled by the iwlcore code. - * Let's clear them before pushing to the 3945. - */ - active_rxon->reserved4 = 0; - active_rxon->reserved5 = 0; - rc = il_send_cmd_pdu(il, C_RXON, sizeof(struct il3945_rxon_cmd), - &il->active); - - /* If the mask clearing failed then we set - * active_rxon back to what it was previously */ - if (rc) { - active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK; - IL_ERR("Error clearing ASSOC_MSK on current " - "configuration (%d).\n", rc); - return rc; - } - il_clear_ucode_stations(il); - il_restore_stations(il); - } - - D_INFO("Sending RXON\n" "* with%s RXON_FILTER_ASSOC_MSK\n" - "* channel = %d\n" "* bssid = %pM\n", (new_assoc ? "" : "out"), - le16_to_cpu(staging_rxon->channel), staging_rxon->bssid_addr); - - /* - * reserved4 and 5 could have been filled by the iwlcore code. - * Let's clear them before pushing to the 3945. - */ - staging_rxon->reserved4 = 0; - staging_rxon->reserved5 = 0; - - il_set_rxon_hwcrypto(il, !il3945_mod_params.sw_crypto); - - /* Apply the new configuration */ - rc = il_send_cmd_pdu(il, C_RXON, sizeof(struct il3945_rxon_cmd), - staging_rxon); - if (rc) { - IL_ERR("Error setting new configuration (%d).\n", rc); - return rc; - } - - memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); - - if (!new_assoc) { - il_clear_ucode_stations(il); - il_restore_stations(il); - } - - /* If we issue a new RXON command which required a tune then we must - * send a new TXPOWER command or we won't be able to Tx any frames */ - rc = il_set_tx_power(il, il->tx_power_next, true); - if (rc) { - IL_ERR("Error setting Tx power (%d).\n", rc); - return rc; - } - - /* Init the hardware's rate fallback order based on the band */ - rc = il3945_init_hw_rate_table(il); - if (rc) { - IL_ERR("Error setting HW rate table: %02X\n", rc); - return -EIO; - } - - return 0; -} - -/** - * il3945_reg_txpower_periodic - called when time to check our temperature. - * - * -- reset periodic timer - * -- see if temp has changed enough to warrant re-calibration ... if so: - * -- correct coeffs for temp (can reset temp timer) - * -- save this temp as "last", - * -- send new set of gain settings to NIC - * NOTE: This should continue working, even when we're not associated, - * so we can keep our internal table of scan powers current. */ -void -il3945_reg_txpower_periodic(struct il_priv *il) -{ - /* This will kick in the "brute force" - * il3945_hw_reg_comp_txpower_temp() below */ - if (!il3945_is_temp_calib_needed(il)) - goto reschedule; - - /* Set up a new set of temp-adjusted TxPowers, send to NIC. - * This is based *only* on current temperature, - * ignoring any previous power measurements */ - il3945_hw_reg_comp_txpower_temp(il); - -reschedule: - queue_delayed_work(il->workqueue, &il->_3945.thermal_periodic, - REG_RECALIB_PERIOD * HZ); -} - -static void -il3945_bg_reg_txpower_periodic(struct work_struct *work) -{ - struct il_priv *il = container_of(work, struct il_priv, - _3945.thermal_periodic.work); - - mutex_lock(&il->mutex); - if (test_bit(S_EXIT_PENDING, &il->status) || il->txq == NULL) - goto out; - - il3945_reg_txpower_periodic(il); -out: - mutex_unlock(&il->mutex); -} - -/** - * il3945_hw_reg_get_ch_grp_idx - find the channel-group idx (0-4) for channel. - * - * This function is used when initializing channel-info structs. - * - * NOTE: These channel groups do *NOT* match the bands above! - * These channel groups are based on factory-tested channels; - * on A-band, EEPROM's "group frequency" entries represent the top - * channel in each group 1-4. Group 5 All B/G channels are in group 0. - */ -static u16 -il3945_hw_reg_get_ch_grp_idx(struct il_priv *il, - const struct il_channel_info *ch_info) -{ - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; - struct il3945_eeprom_txpower_group *ch_grp = &eeprom->groups[0]; - u8 group; - u16 group_idx = 0; /* based on factory calib frequencies */ - u8 grp_channel; - - /* Find the group idx for the channel ... don't use idx 1(?) */ - if (il_is_channel_a_band(ch_info)) { - for (group = 1; group < 5; group++) { - grp_channel = ch_grp[group].group_channel; - if (ch_info->channel <= grp_channel) { - group_idx = group; - break; - } - } - /* group 4 has a few channels *above* its factory cal freq */ - if (group == 5) - group_idx = 4; - } else - group_idx = 0; /* 2.4 GHz, group 0 */ - - D_POWER("Chnl %d mapped to grp %d\n", ch_info->channel, group_idx); - return group_idx; -} - -/** - * il3945_hw_reg_get_matched_power_idx - Interpolate to get nominal idx - * - * Interpolate to get nominal (i.e. at factory calibration temperature) idx - * into radio/DSP gain settings table for requested power. - */ -static int -il3945_hw_reg_get_matched_power_idx(struct il_priv *il, s8 requested_power, - s32 setting_idx, s32 *new_idx) -{ - const struct il3945_eeprom_txpower_group *chnl_grp = NULL; - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; - s32 idx0, idx1; - s32 power = 2 * requested_power; - s32 i; - const struct il3945_eeprom_txpower_sample *samples; - s32 gains0, gains1; - s32 res; - s32 denominator; - - chnl_grp = &eeprom->groups[setting_idx]; - samples = chnl_grp->samples; - for (i = 0; i < 5; i++) { - if (power == samples[i].power) { - *new_idx = samples[i].gain_idx; - return 0; - } - } - - if (power > samples[1].power) { - idx0 = 0; - idx1 = 1; - } else if (power > samples[2].power) { - idx0 = 1; - idx1 = 2; - } else if (power > samples[3].power) { - idx0 = 2; - idx1 = 3; - } else { - idx0 = 3; - idx1 = 4; - } - - denominator = (s32) samples[idx1].power - (s32) samples[idx0].power; - if (denominator == 0) - return -EINVAL; - gains0 = (s32) samples[idx0].gain_idx * (1 << 19); - gains1 = (s32) samples[idx1].gain_idx * (1 << 19); - res = - gains0 + (gains1 - gains0) * ((s32) power - - (s32) samples[idx0].power) / - denominator + (1 << 18); - *new_idx = res >> 19; - return 0; -} - -static void -il3945_hw_reg_init_channel_groups(struct il_priv *il) -{ - u32 i; - s32 rate_idx; - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; - const struct il3945_eeprom_txpower_group *group; - - D_POWER("Initializing factory calib info from EEPROM\n"); - - for (i = 0; i < IL_NUM_TX_CALIB_GROUPS; i++) { - s8 *clip_pwrs; /* table of power levels for each rate */ - s8 satur_pwr; /* saturation power for each chnl group */ - group = &eeprom->groups[i]; - - /* sanity check on factory saturation power value */ - if (group->saturation_power < 40) { - IL_WARN("Error: saturation power is %d, " - "less than minimum expected 40\n", - group->saturation_power); - return; - } - - /* - * Derive requested power levels for each rate, based on - * hardware capabilities (saturation power for band). - * Basic value is 3dB down from saturation, with further - * power reductions for highest 3 data rates. These - * backoffs provide headroom for high rate modulation - * power peaks, without too much distortion (clipping). - */ - /* we'll fill in this array with h/w max power levels */ - clip_pwrs = (s8 *) il->_3945.clip_groups[i].clip_powers; - - /* divide factory saturation power by 2 to find -3dB level */ - satur_pwr = (s8) (group->saturation_power >> 1); - - /* fill in channel group's nominal powers for each rate */ - for (rate_idx = 0; rate_idx < RATE_COUNT_3945; - rate_idx++, clip_pwrs++) { - switch (rate_idx) { - case RATE_36M_IDX_TBL: - if (i == 0) /* B/G */ - *clip_pwrs = satur_pwr; - else /* A */ - *clip_pwrs = satur_pwr - 5; - break; - case RATE_48M_IDX_TBL: - if (i == 0) - *clip_pwrs = satur_pwr - 7; - else - *clip_pwrs = satur_pwr - 10; - break; - case RATE_54M_IDX_TBL: - if (i == 0) - *clip_pwrs = satur_pwr - 9; - else - *clip_pwrs = satur_pwr - 12; - break; - default: - *clip_pwrs = satur_pwr; - break; - } - } - } -} - -/** - * il3945_txpower_set_from_eeprom - Set channel power info based on EEPROM - * - * Second pass (during init) to set up il->channel_info - * - * Set up Tx-power settings in our channel info database for each VALID - * (for this geo/SKU) channel, at all Tx data rates, based on eeprom values - * and current temperature. - * - * Since this is based on current temperature (at init time), these values may - * not be valid for very long, but it gives us a starting/default point, - * and allows us to active (i.e. using Tx) scan. - * - * This does *not* write values to NIC, just sets up our internal table. - */ -int -il3945_txpower_set_from_eeprom(struct il_priv *il) -{ - struct il_channel_info *ch_info = NULL; - struct il3945_channel_power_info *pwr_info; - struct il3945_eeprom *eeprom = (struct il3945_eeprom *)il->eeprom; - int delta_idx; - u8 rate_idx; - u8 scan_tbl_idx; - const s8 *clip_pwrs; /* array of power levels for each rate */ - u8 gain, dsp_atten; - s8 power; - u8 pwr_idx, base_pwr_idx, a_band; - u8 i; - int temperature; - - /* save temperature reference, - * so we can determine next time to calibrate */ - temperature = il3945_hw_reg_txpower_get_temperature(il); - il->last_temperature = temperature; - - il3945_hw_reg_init_channel_groups(il); - - /* initialize Tx power info for each and every channel, 2.4 and 5.x */ - for (i = 0, ch_info = il->channel_info; i < il->channel_count; - i++, ch_info++) { - a_band = il_is_channel_a_band(ch_info); - if (!il_is_channel_valid(ch_info)) - continue; - - /* find this channel's channel group (*not* "band") idx */ - ch_info->group_idx = il3945_hw_reg_get_ch_grp_idx(il, ch_info); - - /* Get this chnlgrp's rate->max/clip-powers table */ - clip_pwrs = - il->_3945.clip_groups[ch_info->group_idx].clip_powers; - - /* calculate power idx *adjustment* value according to - * diff between current temperature and factory temperature */ - delta_idx = - il3945_hw_reg_adjust_power_by_temp(temperature, - eeprom->groups[ch_info-> - group_idx]. - temperature); - - D_POWER("Delta idx for channel %d: %d [%d]\n", ch_info->channel, - delta_idx, temperature + IL_TEMP_CONVERT); - - /* set tx power value for all OFDM rates */ - for (rate_idx = 0; rate_idx < IL_OFDM_RATES; rate_idx++) { - s32 uninitialized_var(power_idx); - int rc; - - /* use channel group's clip-power table, - * but don't exceed channel's max power */ - s8 pwr = min(ch_info->max_power_avg, - clip_pwrs[rate_idx]); - - pwr_info = &ch_info->power_info[rate_idx]; - - /* get base (i.e. at factory-measured temperature) - * power table idx for this rate's power */ - rc = il3945_hw_reg_get_matched_power_idx(il, pwr, - ch_info-> - group_idx, - &power_idx); - if (rc) { - IL_ERR("Invalid power idx\n"); - return rc; - } - pwr_info->base_power_idx = (u8) power_idx; - - /* temperature compensate */ - power_idx += delta_idx; - - /* stay within range of gain table */ - power_idx = il3945_hw_reg_fix_power_idx(power_idx); - - /* fill 1 OFDM rate's il3945_channel_power_info struct */ - pwr_info->requested_power = pwr; - pwr_info->power_table_idx = (u8) power_idx; - pwr_info->tpc.tx_gain = - power_gain_table[a_band][power_idx].tx_gain; - pwr_info->tpc.dsp_atten = - power_gain_table[a_band][power_idx].dsp_atten; - } - - /* set tx power for CCK rates, based on OFDM 12 Mbit settings */ - pwr_info = &ch_info->power_info[RATE_12M_IDX_TBL]; - power = pwr_info->requested_power + IL_CCK_FROM_OFDM_POWER_DIFF; - pwr_idx = pwr_info->power_table_idx + IL_CCK_FROM_OFDM_IDX_DIFF; - base_pwr_idx = - pwr_info->base_power_idx + IL_CCK_FROM_OFDM_IDX_DIFF; - - /* stay within table range */ - pwr_idx = il3945_hw_reg_fix_power_idx(pwr_idx); - gain = power_gain_table[a_band][pwr_idx].tx_gain; - dsp_atten = power_gain_table[a_band][pwr_idx].dsp_atten; - - /* fill each CCK rate's il3945_channel_power_info structure - * NOTE: All CCK-rate Txpwrs are the same for a given chnl! - * NOTE: CCK rates start at end of OFDM rates! */ - for (rate_idx = 0; rate_idx < IL_CCK_RATES; rate_idx++) { - pwr_info = - &ch_info->power_info[rate_idx + IL_OFDM_RATES]; - pwr_info->requested_power = power; - pwr_info->power_table_idx = pwr_idx; - pwr_info->base_power_idx = base_pwr_idx; - pwr_info->tpc.tx_gain = gain; - pwr_info->tpc.dsp_atten = dsp_atten; - } - - /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */ - for (scan_tbl_idx = 0; scan_tbl_idx < IL_NUM_SCAN_RATES; - scan_tbl_idx++) { - s32 actual_idx = - (scan_tbl_idx == - 0) ? RATE_1M_IDX_TBL : RATE_6M_IDX_TBL; - il3945_hw_reg_set_scan_power(il, scan_tbl_idx, - actual_idx, clip_pwrs, - ch_info, a_band); - } - } - - return 0; -} - -int -il3945_hw_rxq_stop(struct il_priv *il) -{ - int ret; - - _il_wr(il, FH39_RCSR_CONFIG(0), 0); - ret = _il_poll_bit(il, FH39_RSSR_STATUS, - FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, - FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, - 1000); - if (ret < 0) - IL_ERR("Can't stop Rx DMA.\n"); - - return 0; -} - -int -il3945_hw_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq) -{ - int txq_id = txq->q.id; - - struct il3945_shared *shared_data = il->_3945.shared_virt; - - shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32) txq->q.dma_addr); - - il_wr(il, FH39_CBCC_CTRL(txq_id), 0); - il_wr(il, FH39_CBCC_BASE(txq_id), 0); - - il_wr(il, FH39_TCSR_CONFIG(txq_id), - FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT | - FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF | - FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD | - FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL | - FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE); - - /* fake read to flush all prev. writes */ - _il_rd(il, FH39_TSSR_CBB_BASE); - - return 0; -} - -/* - * HCMD utils - */ -static u16 -il3945_get_hcmd_size(u8 cmd_id, u16 len) -{ - switch (cmd_id) { - case C_RXON: - return sizeof(struct il3945_rxon_cmd); - case C_POWER_TBL: - return sizeof(struct il3945_powertable_cmd); - default: - return len; - } -} - -static u16 -il3945_build_addsta_hcmd(const struct il_addsta_cmd *cmd, u8 * data) -{ - struct il3945_addsta_cmd *addsta = (struct il3945_addsta_cmd *)data; - addsta->mode = cmd->mode; - memcpy(&addsta->sta, &cmd->sta, sizeof(struct sta_id_modify)); - memcpy(&addsta->key, &cmd->key, sizeof(struct il4965_keyinfo)); - addsta->station_flags = cmd->station_flags; - addsta->station_flags_msk = cmd->station_flags_msk; - addsta->tid_disable_tx = cpu_to_le16(0); - addsta->rate_n_flags = cmd->rate_n_flags; - addsta->add_immediate_ba_tid = cmd->add_immediate_ba_tid; - addsta->remove_immediate_ba_tid = cmd->remove_immediate_ba_tid; - addsta->add_immediate_ba_ssn = cmd->add_immediate_ba_ssn; - - return (u16) sizeof(struct il3945_addsta_cmd); -} - -static int -il3945_add_bssid_station(struct il_priv *il, const u8 * addr, u8 * sta_id_r) -{ - int ret; - u8 sta_id; - unsigned long flags; - - if (sta_id_r) - *sta_id_r = IL_INVALID_STATION; - - ret = il_add_station_common(il, addr, 0, NULL, &sta_id); - if (ret) { - IL_ERR("Unable to add station %pM\n", addr); - return ret; - } - - if (sta_id_r) - *sta_id_r = sta_id; - - spin_lock_irqsave(&il->sta_lock, flags); - il->stations[sta_id].used |= IL_STA_LOCAL; - spin_unlock_irqrestore(&il->sta_lock, flags); - - return 0; -} - -static int -il3945_manage_ibss_station(struct il_priv *il, struct ieee80211_vif *vif, - bool add) -{ - struct il_vif_priv *vif_priv = (void *)vif->drv_priv; - int ret; - - if (add) { - ret = - il3945_add_bssid_station(il, vif->bss_conf.bssid, - &vif_priv->ibss_bssid_sta_id); - if (ret) - return ret; - - il3945_sync_sta(il, vif_priv->ibss_bssid_sta_id, - (il->band == - IEEE80211_BAND_5GHZ) ? RATE_6M_PLCP : - RATE_1M_PLCP); - il3945_rate_scale_init(il->hw, vif_priv->ibss_bssid_sta_id); - - return 0; - } - - return il_remove_station(il, vif_priv->ibss_bssid_sta_id, - vif->bss_conf.bssid); -} - -/** - * il3945_init_hw_rate_table - Initialize the hardware rate fallback table - */ -int -il3945_init_hw_rate_table(struct il_priv *il) -{ - int rc, i, idx, prev_idx; - struct il3945_rate_scaling_cmd rate_cmd = { - .reserved = {0, 0, 0}, - }; - struct il3945_rate_scaling_info *table = rate_cmd.table; - - for (i = 0; i < ARRAY_SIZE(il3945_rates); i++) { - idx = il3945_rates[i].table_rs_idx; - - table[idx].rate_n_flags = cpu_to_le16(il3945_rates[i].plcp); - table[idx].try_cnt = il->retry_rate; - prev_idx = il3945_get_prev_ieee_rate(i); - table[idx].next_rate_idx = il3945_rates[prev_idx].table_rs_idx; - } - - switch (il->band) { - case IEEE80211_BAND_5GHZ: - D_RATE("Select A mode rate scale\n"); - /* If one of the following CCK rates is used, - * have it fall back to the 6M OFDM rate */ - for (i = RATE_1M_IDX_TBL; i <= RATE_11M_IDX_TBL; i++) - table[i].next_rate_idx = - il3945_rates[IL_FIRST_OFDM_RATE].table_rs_idx; - - /* Don't fall back to CCK rates */ - table[RATE_12M_IDX_TBL].next_rate_idx = RATE_9M_IDX_TBL; - - /* Don't drop out of OFDM rates */ - table[RATE_6M_IDX_TBL].next_rate_idx = - il3945_rates[IL_FIRST_OFDM_RATE].table_rs_idx; - break; - - case IEEE80211_BAND_2GHZ: - D_RATE("Select B/G mode rate scale\n"); - /* If an OFDM rate is used, have it fall back to the - * 1M CCK rates */ - - if (!(il->_3945.sta_supp_rates & IL_OFDM_RATES_MASK) && - il_is_associated(il)) { - - idx = IL_FIRST_CCK_RATE; - for (i = RATE_6M_IDX_TBL; i <= RATE_54M_IDX_TBL; i++) - table[i].next_rate_idx = - il3945_rates[idx].table_rs_idx; - - idx = RATE_11M_IDX_TBL; - /* CCK shouldn't fall back to OFDM... */ - table[idx].next_rate_idx = RATE_5M_IDX_TBL; - } - break; - - default: - WARN_ON(1); - break; - } - - /* Update the rate scaling for control frame Tx */ - rate_cmd.table_id = 0; - rc = il_send_cmd_pdu(il, C_RATE_SCALE, sizeof(rate_cmd), &rate_cmd); - if (rc) - return rc; - - /* Update the rate scaling for data frame Tx */ - rate_cmd.table_id = 1; - return il_send_cmd_pdu(il, C_RATE_SCALE, sizeof(rate_cmd), &rate_cmd); -} - -/* Called when initializing driver */ -int -il3945_hw_set_hw_params(struct il_priv *il) -{ - memset((void *)&il->hw_params, 0, sizeof(struct il_hw_params)); - - il->_3945.shared_virt = - dma_alloc_coherent(&il->pci_dev->dev, sizeof(struct il3945_shared), - &il->_3945.shared_phys, GFP_KERNEL); - if (!il->_3945.shared_virt) - return -ENOMEM; - - il->hw_params.bcast_id = IL3945_BROADCAST_ID; - - /* Assign number of Usable TX queues */ - il->hw_params.max_txq_num = il->cfg->num_of_queues; - - il->hw_params.tfd_size = sizeof(struct il3945_tfd); - il->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_3K); - il->hw_params.max_rxq_size = RX_QUEUE_SIZE; - il->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; - il->hw_params.max_stations = IL3945_STATION_COUNT; - - il->sta_key_max_num = STA_KEY_MAX_NUM; - - il->hw_params.rx_wrt_ptr_reg = FH39_RSCSR_CHNL0_WPTR; - il->hw_params.max_beacon_itrvl = IL39_MAX_UCODE_BEACON_INTERVAL; - il->hw_params.beacon_time_tsf_bits = IL3945_EXT_BEACON_TIME_POS; - - return 0; -} - -unsigned int -il3945_hw_get_beacon_cmd(struct il_priv *il, struct il3945_frame *frame, - u8 rate) -{ - struct il3945_tx_beacon_cmd *tx_beacon_cmd; - unsigned int frame_size; - - tx_beacon_cmd = (struct il3945_tx_beacon_cmd *)&frame->u; - memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); - - tx_beacon_cmd->tx.sta_id = il->hw_params.bcast_id; - tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; - - frame_size = - il3945_fill_beacon_frame(il, tx_beacon_cmd->frame, - sizeof(frame->u) - sizeof(*tx_beacon_cmd)); - - BUG_ON(frame_size > MAX_MPDU_SIZE); - tx_beacon_cmd->tx.len = cpu_to_le16((u16) frame_size); - - tx_beacon_cmd->tx.rate = rate; - tx_beacon_cmd->tx.tx_flags = - (TX_CMD_FLG_SEQ_CTL_MSK | TX_CMD_FLG_TSF_MSK); - - /* supp_rates[0] == OFDM start at IL_FIRST_OFDM_RATE */ - tx_beacon_cmd->tx.supp_rates[0] = - (IL_OFDM_BASIC_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF; - - tx_beacon_cmd->tx.supp_rates[1] = (IL_CCK_BASIC_RATES_MASK & 0xF); - - return sizeof(struct il3945_tx_beacon_cmd) + frame_size; -} - -void -il3945_hw_handler_setup(struct il_priv *il) -{ - il->handlers[C_TX] = il3945_hdl_tx; - il->handlers[N_3945_RX] = il3945_hdl_rx; -} - -void -il3945_hw_setup_deferred_work(struct il_priv *il) -{ - INIT_DELAYED_WORK(&il->_3945.thermal_periodic, - il3945_bg_reg_txpower_periodic); -} - -void -il3945_hw_cancel_deferred_work(struct il_priv *il) -{ - cancel_delayed_work(&il->_3945.thermal_periodic); -} - -/* check contents of special bootstrap uCode SRAM */ -static int -il3945_verify_bsm(struct il_priv *il) -{ - __le32 *image = il->ucode_boot.v_addr; - u32 len = il->ucode_boot.len; - u32 reg; - u32 val; - - D_INFO("Begin verify bsm\n"); - - /* verify BSM SRAM contents */ - val = il_rd_prph(il, BSM_WR_DWCOUNT_REG); - for (reg = BSM_SRAM_LOWER_BOUND; reg < BSM_SRAM_LOWER_BOUND + len; - reg += sizeof(u32), image++) { - val = il_rd_prph(il, reg); - if (val != le32_to_cpu(*image)) { - IL_ERR("BSM uCode verification failed at " - "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", - BSM_SRAM_LOWER_BOUND, reg - BSM_SRAM_LOWER_BOUND, - len, val, le32_to_cpu(*image)); - return -EIO; - } - } - - D_INFO("BSM bootstrap uCode image OK\n"); - - return 0; -} - -/****************************************************************************** - * - * EEPROM related functions - * - ******************************************************************************/ - -/* - * Clear the OWNER_MSK, to establish driver (instead of uCode running on - * embedded controller) as EEPROM reader; each read is a series of pulses - * to/from the EEPROM chip, not a single event, so even reads could conflict - * if they weren't arbitrated by some ownership mechanism. Here, the driver - * simply claims ownership, which should be safe when this function is called - * (i.e. before loading uCode!). - */ -static int -il3945_eeprom_acquire_semaphore(struct il_priv *il) -{ - _il_clear_bit(il, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK); - return 0; -} - -static void -il3945_eeprom_release_semaphore(struct il_priv *il) -{ - return; -} - - /** - * il3945_load_bsm - Load bootstrap instructions - * - * BSM operation: - * - * The Bootstrap State Machine (BSM) stores a short bootstrap uCode program - * in special SRAM that does not power down during RFKILL. When powering back - * up after power-saving sleeps (or during initial uCode load), the BSM loads - * the bootstrap program into the on-board processor, and starts it. - * - * The bootstrap program loads (via DMA) instructions and data for a new - * program from host DRAM locations indicated by the host driver in the - * BSM_DRAM_* registers. Once the new program is loaded, it starts - * automatically. - * - * When initializing the NIC, the host driver points the BSM to the - * "initialize" uCode image. This uCode sets up some internal data, then - * notifies host via "initialize alive" that it is complete. - * - * The host then replaces the BSM_DRAM_* pointer values to point to the - * normal runtime uCode instructions and a backup uCode data cache buffer - * (filled initially with starting data values for the on-board processor), - * then triggers the "initialize" uCode to load and launch the runtime uCode, - * which begins normal operation. - * - * When doing a power-save shutdown, runtime uCode saves data SRAM into - * the backup data cache in DRAM before SRAM is powered down. - * - * When powering back up, the BSM loads the bootstrap program. This reloads - * the runtime uCode instructions and the backup data cache into SRAM, - * and re-launches the runtime uCode from where it left off. - */ -static int -il3945_load_bsm(struct il_priv *il) -{ - __le32 *image = il->ucode_boot.v_addr; - u32 len = il->ucode_boot.len; - dma_addr_t pinst; - dma_addr_t pdata; - u32 inst_len; - u32 data_len; - int rc; - int i; - u32 done; - u32 reg_offset; - - D_INFO("Begin load bsm\n"); - - /* make sure bootstrap program is no larger than BSM's SRAM size */ - if (len > IL39_MAX_BSM_SIZE) - return -EINVAL; - - /* Tell bootstrap uCode where to find the "Initialize" uCode - * in host DRAM ... host DRAM physical address bits 31:0 for 3945. - * NOTE: il3945_initialize_alive_start() will replace these values, - * after the "initialize" uCode has run, to point to - * runtime/protocol instructions and backup data cache. */ - pinst = il->ucode_init.p_addr; - pdata = il->ucode_init_data.p_addr; - inst_len = il->ucode_init.len; - data_len = il->ucode_init_data.len; - - il_wr_prph(il, BSM_DRAM_INST_PTR_REG, pinst); - il_wr_prph(il, BSM_DRAM_DATA_PTR_REG, pdata); - il_wr_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); - il_wr_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); - - /* Fill BSM memory with bootstrap instructions */ - for (reg_offset = BSM_SRAM_LOWER_BOUND; - reg_offset < BSM_SRAM_LOWER_BOUND + len; - reg_offset += sizeof(u32), image++) - _il_wr_prph(il, reg_offset, le32_to_cpu(*image)); - - rc = il3945_verify_bsm(il); - if (rc) - return rc; - - /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ - il_wr_prph(il, BSM_WR_MEM_SRC_REG, 0x0); - il_wr_prph(il, BSM_WR_MEM_DST_REG, IL39_RTC_INST_LOWER_BOUND); - il_wr_prph(il, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); - - /* Load bootstrap code into instruction SRAM now, - * to prepare to load "initialize" uCode */ - il_wr_prph(il, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); - - /* Wait for load of bootstrap uCode to finish */ - for (i = 0; i < 100; i++) { - done = il_rd_prph(il, BSM_WR_CTRL_REG); - if (!(done & BSM_WR_CTRL_REG_BIT_START)) - break; - udelay(10); - } - if (i < 100) - D_INFO("BSM write complete, poll %d iterations\n", i); - else { - IL_ERR("BSM write did not complete!\n"); - return -EIO; - } - - /* Enable future boot loads whenever power management unit triggers it - * (e.g. when powering back up after power-save shutdown) */ - il_wr_prph(il, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); - - return 0; -} - -const struct il_ops il3945_ops = { - .txq_attach_buf_to_tfd = il3945_hw_txq_attach_buf_to_tfd, - .txq_free_tfd = il3945_hw_txq_free_tfd, - .txq_init = il3945_hw_tx_queue_init, - .load_ucode = il3945_load_bsm, - .dump_nic_error_log = il3945_dump_nic_error_log, - .apm_init = il3945_apm_init, - .send_tx_power = il3945_send_tx_power, - .is_valid_rtc_data_addr = il3945_hw_valid_rtc_data_addr, - .eeprom_acquire_semaphore = il3945_eeprom_acquire_semaphore, - .eeprom_release_semaphore = il3945_eeprom_release_semaphore, - - .rxon_assoc = il3945_send_rxon_assoc, - .commit_rxon = il3945_commit_rxon, - - .get_hcmd_size = il3945_get_hcmd_size, - .build_addsta_hcmd = il3945_build_addsta_hcmd, - .request_scan = il3945_request_scan, - .post_scan = il3945_post_scan, - - .post_associate = il3945_post_associate, - .config_ap = il3945_config_ap, - .manage_ibss_station = il3945_manage_ibss_station, - - .send_led_cmd = il3945_send_led_cmd, -}; - -static struct il_cfg il3945_bg_cfg = { - .name = "3945BG", - .fw_name_pre = IL3945_FW_PRE, - .ucode_api_max = IL3945_UCODE_API_MAX, - .ucode_api_min = IL3945_UCODE_API_MIN, - .sku = IL_SKU_G, - .eeprom_ver = EEPROM_3945_EEPROM_VERSION, - .mod_params = &il3945_mod_params, - .led_mode = IL_LED_BLINK, - - .eeprom_size = IL3945_EEPROM_IMG_SIZE, - .num_of_queues = IL39_NUM_QUEUES, - .pll_cfg_val = CSR39_ANA_PLL_CFG_VAL, - .set_l0s = false, - .use_bsm = true, - .led_compensation = 64, - .wd_timeout = IL_DEF_WD_TIMEOUT, - - .regulatory_bands = { - EEPROM_REGULATORY_BAND_1_CHANNELS, - EEPROM_REGULATORY_BAND_2_CHANNELS, - EEPROM_REGULATORY_BAND_3_CHANNELS, - EEPROM_REGULATORY_BAND_4_CHANNELS, - EEPROM_REGULATORY_BAND_5_CHANNELS, - EEPROM_REGULATORY_BAND_NO_HT40, - EEPROM_REGULATORY_BAND_NO_HT40, - }, -}; - -static struct il_cfg il3945_abg_cfg = { - .name = "3945ABG", - .fw_name_pre = IL3945_FW_PRE, - .ucode_api_max = IL3945_UCODE_API_MAX, - .ucode_api_min = IL3945_UCODE_API_MIN, - .sku = IL_SKU_A | IL_SKU_G, - .eeprom_ver = EEPROM_3945_EEPROM_VERSION, - .mod_params = &il3945_mod_params, - .led_mode = IL_LED_BLINK, - - .eeprom_size = IL3945_EEPROM_IMG_SIZE, - .num_of_queues = IL39_NUM_QUEUES, - .pll_cfg_val = CSR39_ANA_PLL_CFG_VAL, - .set_l0s = false, - .use_bsm = true, - .led_compensation = 64, - .wd_timeout = IL_DEF_WD_TIMEOUT, - - .regulatory_bands = { - EEPROM_REGULATORY_BAND_1_CHANNELS, - EEPROM_REGULATORY_BAND_2_CHANNELS, - EEPROM_REGULATORY_BAND_3_CHANNELS, - EEPROM_REGULATORY_BAND_4_CHANNELS, - EEPROM_REGULATORY_BAND_5_CHANNELS, - EEPROM_REGULATORY_BAND_NO_HT40, - EEPROM_REGULATORY_BAND_NO_HT40, - }, -}; - -DEFINE_PCI_DEVICE_TABLE(il3945_hw_card_ids) = { - {IL_PCI_DEVICE(0x4222, 0x1005, il3945_bg_cfg)}, - {IL_PCI_DEVICE(0x4222, 0x1034, il3945_bg_cfg)}, - {IL_PCI_DEVICE(0x4222, 0x1044, il3945_bg_cfg)}, - {IL_PCI_DEVICE(0x4227, 0x1014, il3945_bg_cfg)}, - {IL_PCI_DEVICE(0x4222, PCI_ANY_ID, il3945_abg_cfg)}, - {IL_PCI_DEVICE(0x4227, PCI_ANY_ID, il3945_abg_cfg)}, - {0} -}; - -MODULE_DEVICE_TABLE(pci, il3945_hw_card_ids); diff --git a/drivers/net/wireless/iwlegacy/3945.h b/drivers/net/wireless/iwlegacy/3945.h deleted file mode 100644 index 9a8703def0ba..000000000000 --- a/drivers/net/wireless/iwlegacy/3945.h +++ /dev/null @@ -1,597 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#ifndef __il_3945_h__ -#define __il_3945_h__ - -#include /* for struct pci_device_id */ -#include -#include - -/* Hardware specific file defines the PCI IDs table for that hardware module */ -extern const struct pci_device_id il3945_hw_card_ids[]; - -#include "common.h" - -extern const struct il_ops il3945_ops; - -/* Highest firmware API version supported */ -#define IL3945_UCODE_API_MAX 2 - -/* Lowest firmware API version supported */ -#define IL3945_UCODE_API_MIN 1 - -#define IL3945_FW_PRE "iwlwifi-3945-" -#define _IL3945_MODULE_FIRMWARE(api) IL3945_FW_PRE #api ".ucode" -#define IL3945_MODULE_FIRMWARE(api) _IL3945_MODULE_FIRMWARE(api) - -/* Default noise level to report when noise measurement is not available. - * This may be because we're: - * 1) Not associated (4965, no beacon stats being sent to driver) - * 2) Scanning (noise measurement does not apply to associated channel) - * 3) Receiving CCK (3945 delivers noise info only for OFDM frames) - * Use default noise value of -127 ... this is below the range of measurable - * Rx dBm for either 3945 or 4965, so it can indicate "unmeasurable" to user. - * Also, -127 works better than 0 when averaging frames with/without - * noise info (e.g. averaging might be done in app); measured dBm values are - * always negative ... using a negative value as the default keeps all - * averages within an s8's (used in some apps) range of negative values. */ -#define IL_NOISE_MEAS_NOT_AVAILABLE (-127) - -/* Module parameters accessible from iwl-*.c */ -extern struct il_mod_params il3945_mod_params; - -struct il3945_rate_scale_data { - u64 data; - s32 success_counter; - s32 success_ratio; - s32 counter; - s32 average_tpt; - unsigned long stamp; -}; - -struct il3945_rs_sta { - spinlock_t lock; - struct il_priv *il; - s32 *expected_tpt; - unsigned long last_partial_flush; - unsigned long last_flush; - u32 flush_time; - u32 last_tx_packets; - u32 tx_packets; - u8 tgg; - u8 flush_pending; - u8 start_rate; - struct timer_list rate_scale_flush; - struct il3945_rate_scale_data win[RATE_COUNT_3945]; -#ifdef CONFIG_MAC80211_DEBUGFS - struct dentry *rs_sta_dbgfs_stats_table_file; -#endif - - /* used to be in sta_info */ - int last_txrate_idx; -}; - -/* - * The common struct MUST be first because it is shared between - * 3945 and 4965! - */ -struct il3945_sta_priv { - struct il_station_priv_common common; - struct il3945_rs_sta rs_sta; -}; - -enum il3945_antenna { - IL_ANTENNA_DIVERSITY, - IL_ANTENNA_MAIN, - IL_ANTENNA_AUX -}; - -/* - * RTS threshold here is total size [2347] minus 4 FCS bytes - * Per spec: - * a value of 0 means RTS on all data/management packets - * a value > max MSDU size means no RTS - * else RTS for data/management frames where MPDU is larger - * than RTS value. - */ -#define DEFAULT_RTS_THRESHOLD 2347U -#define MIN_RTS_THRESHOLD 0U -#define MAX_RTS_THRESHOLD 2347U -#define MAX_MSDU_SIZE 2304U -#define MAX_MPDU_SIZE 2346U -#define DEFAULT_BEACON_INTERVAL 100U -#define DEFAULT_SHORT_RETRY_LIMIT 7U -#define DEFAULT_LONG_RETRY_LIMIT 4U - -#define IL_TX_FIFO_AC0 0 -#define IL_TX_FIFO_AC1 1 -#define IL_TX_FIFO_AC2 2 -#define IL_TX_FIFO_AC3 3 -#define IL_TX_FIFO_HCCA_1 5 -#define IL_TX_FIFO_HCCA_2 6 -#define IL_TX_FIFO_NONE 7 - -#define IEEE80211_DATA_LEN 2304 -#define IEEE80211_4ADDR_LEN 30 -#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) -#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) - -struct il3945_frame { - union { - struct ieee80211_hdr frame; - struct il3945_tx_beacon_cmd beacon; - u8 raw[IEEE80211_FRAME_LEN]; - u8 cmd[360]; - } u; - struct list_head list; -}; - -#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 -#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 -#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 - -#define IL_SUPPORTED_RATES_IE_LEN 8 - -#define SCAN_INTERVAL 100 - -#define MAX_TID_COUNT 9 - -#define IL_INVALID_RATE 0xFF -#define IL_INVALID_VALUE -1 - -#define STA_PS_STATUS_WAKE 0 -#define STA_PS_STATUS_SLEEP 1 - -struct il3945_ibss_seq { - u8 mac[ETH_ALEN]; - u16 seq_num; - u16 frag_num; - unsigned long packet_time; - struct list_head list; -}; - -#define IL_RX_HDR(x) ((struct il3945_rx_frame_hdr *)(\ - x->u.rx_frame.stats.payload + \ - x->u.rx_frame.stats.phy_count)) -#define IL_RX_END(x) ((struct il3945_rx_frame_end *)(\ - IL_RX_HDR(x)->payload + \ - le16_to_cpu(IL_RX_HDR(x)->len))) -#define IL_RX_STATS(x) (&x->u.rx_frame.stats) -#define IL_RX_DATA(x) (IL_RX_HDR(x)->payload) - -/****************************************************************************** - * - * Functions implemented in iwl3945-base.c which are forward declared here - * for use by iwl-*.c - * - *****************************************************************************/ -extern int il3945_calc_db_from_ratio(int sig_ratio); -extern void il3945_rx_replenish(void *data); -extern void il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq); -extern unsigned int il3945_fill_beacon_frame(struct il_priv *il, - struct ieee80211_hdr *hdr, - int left); -extern int il3945_dump_nic_event_log(struct il_priv *il, bool full_log, - char **buf, bool display); -extern void il3945_dump_nic_error_log(struct il_priv *il); - -/****************************************************************************** - * - * Functions implemented in iwl-[34]*.c which are forward declared here - * for use by iwl3945-base.c - * - * NOTE: The implementation of these functions are hardware specific - * which is why they are in the hardware specific files (vs. iwl-base.c) - * - * Naming convention -- - * il3945_ <-- Its part of iwlwifi (should be changed to il3945_) - * il3945_hw_ <-- Hardware specific (implemented in iwl-XXXX.c by all HW) - * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) - * il3945_bg_ <-- Called from work queue context - * il3945_mac_ <-- mac80211 callback - * - ****************************************************************************/ -extern void il3945_hw_handler_setup(struct il_priv *il); -extern void il3945_hw_setup_deferred_work(struct il_priv *il); -extern void il3945_hw_cancel_deferred_work(struct il_priv *il); -extern int il3945_hw_rxq_stop(struct il_priv *il); -extern int il3945_hw_set_hw_params(struct il_priv *il); -extern int il3945_hw_nic_init(struct il_priv *il); -extern int il3945_hw_nic_stop_master(struct il_priv *il); -extern void il3945_hw_txq_ctx_free(struct il_priv *il); -extern void il3945_hw_txq_ctx_stop(struct il_priv *il); -extern int il3945_hw_nic_reset(struct il_priv *il); -extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il, - struct il_tx_queue *txq, - dma_addr_t addr, u16 len, u8 reset, - u8 pad); -extern void il3945_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq); -extern int il3945_hw_get_temperature(struct il_priv *il); -extern int il3945_hw_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq); -extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *il, - struct il3945_frame *frame, - u8 rate); -void il3945_hw_build_tx_cmd_rate(struct il_priv *il, struct il_device_cmd *cmd, - struct ieee80211_tx_info *info, - struct ieee80211_hdr *hdr, int sta_id); -extern int il3945_hw_reg_send_txpower(struct il_priv *il); -extern int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power); -extern void il3945_hdl_stats(struct il_priv *il, struct il_rx_buf *rxb); -void il3945_hdl_c_stats(struct il_priv *il, struct il_rx_buf *rxb); -extern void il3945_disable_events(struct il_priv *il); -extern int il4965_get_temperature(const struct il_priv *il); -extern void il3945_post_associate(struct il_priv *il); -extern void il3945_config_ap(struct il_priv *il); - -extern int il3945_commit_rxon(struct il_priv *il); - -/** - * il3945_hw_find_station - Find station id for a given BSSID - * @bssid: MAC address of station ID to find - * - * NOTE: This should not be hardware specific but the code has - * not yet been merged into a single common layer for managing the - * station tables. - */ -extern u8 il3945_hw_find_station(struct il_priv *il, const u8 * bssid); - -extern __le32 il3945_get_antenna_flags(const struct il_priv *il); -extern int il3945_init_hw_rate_table(struct il_priv *il); -extern void il3945_reg_txpower_periodic(struct il_priv *il); -extern int il3945_txpower_set_from_eeprom(struct il_priv *il); - -extern int il3945_rs_next_rate(struct il_priv *il, int rate); - -/* scanning */ -int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif); -void il3945_post_scan(struct il_priv *il); - -/* rates */ -extern const struct il3945_rate_info il3945_rates[RATE_COUNT_3945]; - -/* RSSI to dBm */ -#define IL39_RSSI_OFFSET 95 - -/* - * EEPROM related constants, enums, and structures. - */ -#define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7) - -/* - * Mapping of a Tx power level, at factory calibration temperature, - * to a radio/DSP gain table idx. - * One for each of 5 "sample" power levels in each band. - * v_det is measured at the factory, using the 3945's built-in power amplifier - * (PA) output voltage detector. This same detector is used during Tx of - * long packets in normal operation to provide feedback as to proper output - * level. - * Data copied from EEPROM. - * DO NOT ALTER THIS STRUCTURE!!! - */ -struct il3945_eeprom_txpower_sample { - u8 gain_idx; /* idx into power (gain) setup table ... */ - s8 power; /* ... for this pwr level for this chnl group */ - u16 v_det; /* PA output voltage */ -} __packed; - -/* - * Mappings of Tx power levels -> nominal radio/DSP gain table idxes. - * One for each channel group (a.k.a. "band") (1 for BG, 4 for A). - * Tx power setup code interpolates between the 5 "sample" power levels - * to determine the nominal setup for a requested power level. - * Data copied from EEPROM. - * DO NOT ALTER THIS STRUCTURE!!! - */ -struct il3945_eeprom_txpower_group { - struct il3945_eeprom_txpower_sample samples[5]; /* 5 power levels */ - s32 a, b, c, d, e; /* coefficients for voltage->power - * formula (signed) */ - s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on - * frequency (signed) */ - s8 saturation_power; /* highest power possible by h/w in this - * band */ - u8 group_channel; /* "representative" channel # in this band */ - s16 temperature; /* h/w temperature at factory calib this band - * (signed) */ -} __packed; - -/* - * Temperature-based Tx-power compensation data, not band-specific. - * These coefficients are use to modify a/b/c/d/e coeffs based on - * difference between current temperature and factory calib temperature. - * Data copied from EEPROM. - */ -struct il3945_eeprom_temperature_corr { - u32 Ta; - u32 Tb; - u32 Tc; - u32 Td; - u32 Te; -} __packed; - -/* - * EEPROM map - */ -struct il3945_eeprom { - u8 reserved0[16]; - u16 device_id; /* abs.ofs: 16 */ - u8 reserved1[2]; - u16 pmc; /* abs.ofs: 20 */ - u8 reserved2[20]; - u8 mac_address[6]; /* abs.ofs: 42 */ - u8 reserved3[58]; - u16 board_revision; /* abs.ofs: 106 */ - u8 reserved4[11]; - u8 board_pba_number[9]; /* abs.ofs: 119 */ - u8 reserved5[8]; - u16 version; /* abs.ofs: 136 */ - u8 sku_cap; /* abs.ofs: 138 */ - u8 leds_mode; /* abs.ofs: 139 */ - u16 oem_mode; - u16 wowlan_mode; /* abs.ofs: 142 */ - u16 leds_time_interval; /* abs.ofs: 144 */ - u8 leds_off_time; /* abs.ofs: 146 */ - u8 leds_on_time; /* abs.ofs: 147 */ - u8 almgor_m_version; /* abs.ofs: 148 */ - u8 antenna_switch_type; /* abs.ofs: 149 */ - u8 reserved6[42]; - u8 sku_id[4]; /* abs.ofs: 192 */ - -/* - * Per-channel regulatory data. - * - * Each channel that *might* be supported by 3945 has a fixed location - * in EEPROM containing EEPROM_CHANNEL_* usage flags (LSB) and max regulatory - * txpower (MSB). - * - * Entries immediately below are for 20 MHz channel width. - * - * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 - */ - u16 band_1_count; /* abs.ofs: 196 */ - struct il_eeprom_channel band_1_channels[14]; /* abs.ofs: 198 */ - -/* - * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196, - * 5.0 GHz channels 7, 8, 11, 12, 16 - * (4915-5080MHz) (none of these is ever supported) - */ - u16 band_2_count; /* abs.ofs: 226 */ - struct il_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */ - -/* - * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 - * (5170-5320MHz) - */ - u16 band_3_count; /* abs.ofs: 254 */ - struct il_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */ - -/* - * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 - * (5500-5700MHz) - */ - u16 band_4_count; /* abs.ofs: 280 */ - struct il_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */ - -/* - * 5.7 GHz channels 145, 149, 153, 157, 161, 165 - * (5725-5825MHz) - */ - u16 band_5_count; /* abs.ofs: 304 */ - struct il_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */ - - u8 reserved9[194]; - -/* - * 3945 Txpower calibration data. - */ -#define IL_NUM_TX_CALIB_GROUPS 5 - struct il3945_eeprom_txpower_group groups[IL_NUM_TX_CALIB_GROUPS]; -/* abs.ofs: 512 */ - struct il3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */ - u8 reserved16[172]; /* fill out to full 1024 byte block */ -} __packed; - -#define IL3945_EEPROM_IMG_SIZE 1024 - -/* End of EEPROM */ - -#define PCI_CFG_REV_ID_BIT_BASIC_SKU (0x40) /* bit 6 */ -#define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */ - -/* 4 DATA + 1 CMD. There are 2 HCCA queues that are not used. */ -#define IL39_NUM_QUEUES 5 -#define IL39_CMD_QUEUE_NUM 4 - -#define IL_DEFAULT_TX_RETRY 15 - -/*********************************************/ - -#define RFD_SIZE 4 -#define NUM_TFD_CHUNKS 4 - -#define TFD_CTL_COUNT_SET(n) (n << 24) -#define TFD_CTL_COUNT_GET(ctl) ((ctl >> 24) & 7) -#define TFD_CTL_PAD_SET(n) (n << 28) -#define TFD_CTL_PAD_GET(ctl) (ctl >> 28) - -/* Sizes and addresses for instruction and data memory (SRAM) in - * 3945's embedded processor. Driver access is via HBUS_TARG_MEM_* regs. */ -#define IL39_RTC_INST_LOWER_BOUND (0x000000) -#define IL39_RTC_INST_UPPER_BOUND (0x014000) - -#define IL39_RTC_DATA_LOWER_BOUND (0x800000) -#define IL39_RTC_DATA_UPPER_BOUND (0x808000) - -#define IL39_RTC_INST_SIZE (IL39_RTC_INST_UPPER_BOUND - \ - IL39_RTC_INST_LOWER_BOUND) -#define IL39_RTC_DATA_SIZE (IL39_RTC_DATA_UPPER_BOUND - \ - IL39_RTC_DATA_LOWER_BOUND) - -#define IL39_MAX_INST_SIZE IL39_RTC_INST_SIZE -#define IL39_MAX_DATA_SIZE IL39_RTC_DATA_SIZE - -/* Size of uCode instruction memory in bootstrap state machine */ -#define IL39_MAX_BSM_SIZE IL39_RTC_INST_SIZE - -static inline int -il3945_hw_valid_rtc_data_addr(u32 addr) -{ - return (addr >= IL39_RTC_DATA_LOWER_BOUND && - addr < IL39_RTC_DATA_UPPER_BOUND); -} - -/* Base physical address of il3945_shared is provided to FH39_TSSR_CBB_BASE - * and &il3945_shared.rx_read_ptr[0] is provided to FH39_RCSR_RPTR_ADDR(0) */ -struct il3945_shared { - __le32 tx_base_ptr[8]; -} __packed; - -/************************************/ -/* iwl3945 Flow Handler Definitions */ -/************************************/ - -/** - * This I/O area is directly read/writable by driver (e.g. Linux uses writel()) - * Addresses are offsets from device's PCI hardware base address. - */ -#define FH39_MEM_LOWER_BOUND (0x0800) -#define FH39_MEM_UPPER_BOUND (0x1000) - -#define FH39_CBCC_TBL (FH39_MEM_LOWER_BOUND + 0x140) -#define FH39_TFDB_TBL (FH39_MEM_LOWER_BOUND + 0x180) -#define FH39_RCSR_TBL (FH39_MEM_LOWER_BOUND + 0x400) -#define FH39_RSSR_TBL (FH39_MEM_LOWER_BOUND + 0x4c0) -#define FH39_TCSR_TBL (FH39_MEM_LOWER_BOUND + 0x500) -#define FH39_TSSR_TBL (FH39_MEM_LOWER_BOUND + 0x680) - -/* TFDB (Transmit Frame Buffer Descriptor) */ -#define FH39_TFDB(_ch, buf) (FH39_TFDB_TBL + \ - ((_ch) * 2 + (buf)) * 0x28) -#define FH39_TFDB_CHNL_BUF_CTRL_REG(_ch) (FH39_TFDB_TBL + 0x50 * (_ch)) - -/* CBCC channel is [0,2] */ -#define FH39_CBCC(_ch) (FH39_CBCC_TBL + (_ch) * 0x8) -#define FH39_CBCC_CTRL(_ch) (FH39_CBCC(_ch) + 0x00) -#define FH39_CBCC_BASE(_ch) (FH39_CBCC(_ch) + 0x04) - -/* RCSR channel is [0,2] */ -#define FH39_RCSR(_ch) (FH39_RCSR_TBL + (_ch) * 0x40) -#define FH39_RCSR_CONFIG(_ch) (FH39_RCSR(_ch) + 0x00) -#define FH39_RCSR_RBD_BASE(_ch) (FH39_RCSR(_ch) + 0x04) -#define FH39_RCSR_WPTR(_ch) (FH39_RCSR(_ch) + 0x20) -#define FH39_RCSR_RPTR_ADDR(_ch) (FH39_RCSR(_ch) + 0x24) - -#define FH39_RSCSR_CHNL0_WPTR (FH39_RCSR_WPTR(0)) - -/* RSSR */ -#define FH39_RSSR_CTRL (FH39_RSSR_TBL + 0x000) -#define FH39_RSSR_STATUS (FH39_RSSR_TBL + 0x004) - -/* TCSR */ -#define FH39_TCSR(_ch) (FH39_TCSR_TBL + (_ch) * 0x20) -#define FH39_TCSR_CONFIG(_ch) (FH39_TCSR(_ch) + 0x00) -#define FH39_TCSR_CREDIT(_ch) (FH39_TCSR(_ch) + 0x04) -#define FH39_TCSR_BUFF_STTS(_ch) (FH39_TCSR(_ch) + 0x08) - -/* TSSR */ -#define FH39_TSSR_CBB_BASE (FH39_TSSR_TBL + 0x000) -#define FH39_TSSR_MSG_CONFIG (FH39_TSSR_TBL + 0x008) -#define FH39_TSSR_TX_STATUS (FH39_TSSR_TBL + 0x010) - -/* DBM */ - -#define FH39_SRVC_CHNL (6) - -#define FH39_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE (20) -#define FH39_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH (4) - -#define FH39_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN (0x08000000) - -#define FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE (0x80000000) - -#define FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE (0x20000000) - -#define FH39_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 (0x01000000) - -#define FH39_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST (0x00001000) - -#define FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH (0x00000000) - -#define FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000) -#define FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001) - -#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000) -#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008) - -#define FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) - -#define FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000) - -#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) -#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000) - -#define FH39_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00004000) - -#define FH39_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001) - -#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000) -#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000) - -#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400) - -#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100) -#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080) - -#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020) -#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005) - -#define FH39_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_ch) (BIT(_ch) << 24) -#define FH39_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_ch) (BIT(_ch) << 16) - -#define FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_ch) \ - (FH39_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_ch) | \ - FH39_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_ch)) - -#define FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) - -struct il3945_tfd_tb { - __le32 addr; - __le32 len; -} __packed; - -struct il3945_tfd { - __le32 control_flags; - struct il3945_tfd_tb tbs[4]; - u8 __pad[28]; -} __packed; - -#ifdef CONFIG_IWLEGACY_DEBUGFS -extern const struct il_debugfs_ops il3945_debugfs_ops; -#endif - -#endif diff --git a/drivers/net/wireless/iwlegacy/4965-calib.c b/drivers/net/wireless/iwlegacy/4965-calib.c deleted file mode 100644 index e78bdefb8952..000000000000 --- a/drivers/net/wireless/iwlegacy/4965-calib.c +++ /dev/null @@ -1,934 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called LICENSE.GPL. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -#include "common.h" -#include "4965.h" - -/***************************************************************************** - * INIT calibrations framework - *****************************************************************************/ - -struct stats_general_data { - u32 beacon_silence_rssi_a; - u32 beacon_silence_rssi_b; - u32 beacon_silence_rssi_c; - u32 beacon_energy_a; - u32 beacon_energy_b; - u32 beacon_energy_c; -}; - -/***************************************************************************** - * RUNTIME calibrations framework - *****************************************************************************/ - -/* "false alarms" are signals that our DSP tries to lock onto, - * but then determines that they are either noise, or transmissions - * from a distant wireless network (also "noise", really) that get - * "stepped on" by stronger transmissions within our own network. - * This algorithm attempts to set a sensitivity level that is high - * enough to receive all of our own network traffic, but not so - * high that our DSP gets too busy trying to lock onto non-network - * activity/noise. */ -static int -il4965_sens_energy_cck(struct il_priv *il, u32 norm_fa, u32 rx_enable_time, - struct stats_general_data *rx_info) -{ - u32 max_nrg_cck = 0; - int i = 0; - u8 max_silence_rssi = 0; - u32 silence_ref = 0; - u8 silence_rssi_a = 0; - u8 silence_rssi_b = 0; - u8 silence_rssi_c = 0; - u32 val; - - /* "false_alarms" values below are cross-multiplications to assess the - * numbers of false alarms within the measured period of actual Rx - * (Rx is off when we're txing), vs the min/max expected false alarms - * (some should be expected if rx is sensitive enough) in a - * hypothetical listening period of 200 time units (TU), 204.8 msec: - * - * MIN_FA/fixed-time < false_alarms/actual-rx-time < MAX_FA/beacon-time - * - * */ - u32 false_alarms = norm_fa * 200 * 1024; - u32 max_false_alarms = MAX_FA_CCK * rx_enable_time; - u32 min_false_alarms = MIN_FA_CCK * rx_enable_time; - struct il_sensitivity_data *data = NULL; - const struct il_sensitivity_ranges *ranges = il->hw_params.sens; - - data = &(il->sensitivity_data); - - data->nrg_auto_corr_silence_diff = 0; - - /* Find max silence rssi among all 3 receivers. - * This is background noise, which may include transmissions from other - * networks, measured during silence before our network's beacon */ - silence_rssi_a = - (u8) ((rx_info->beacon_silence_rssi_a & ALL_BAND_FILTER) >> 8); - silence_rssi_b = - (u8) ((rx_info->beacon_silence_rssi_b & ALL_BAND_FILTER) >> 8); - silence_rssi_c = - (u8) ((rx_info->beacon_silence_rssi_c & ALL_BAND_FILTER) >> 8); - - val = max(silence_rssi_b, silence_rssi_c); - max_silence_rssi = max(silence_rssi_a, (u8) val); - - /* Store silence rssi in 20-beacon history table */ - data->nrg_silence_rssi[data->nrg_silence_idx] = max_silence_rssi; - data->nrg_silence_idx++; - if (data->nrg_silence_idx >= NRG_NUM_PREV_STAT_L) - data->nrg_silence_idx = 0; - - /* Find max silence rssi across 20 beacon history */ - for (i = 0; i < NRG_NUM_PREV_STAT_L; i++) { - val = data->nrg_silence_rssi[i]; - silence_ref = max(silence_ref, val); - } - D_CALIB("silence a %u, b %u, c %u, 20-bcn max %u\n", silence_rssi_a, - silence_rssi_b, silence_rssi_c, silence_ref); - - /* Find max rx energy (min value!) among all 3 receivers, - * measured during beacon frame. - * Save it in 10-beacon history table. */ - i = data->nrg_energy_idx; - val = min(rx_info->beacon_energy_b, rx_info->beacon_energy_c); - data->nrg_value[i] = min(rx_info->beacon_energy_a, val); - - data->nrg_energy_idx++; - if (data->nrg_energy_idx >= 10) - data->nrg_energy_idx = 0; - - /* Find min rx energy (max value) across 10 beacon history. - * This is the minimum signal level that we want to receive well. - * Add backoff (margin so we don't miss slightly lower energy frames). - * This establishes an upper bound (min value) for energy threshold. */ - max_nrg_cck = data->nrg_value[0]; - for (i = 1; i < 10; i++) - max_nrg_cck = (u32) max(max_nrg_cck, (data->nrg_value[i])); - max_nrg_cck += 6; - - D_CALIB("rx energy a %u, b %u, c %u, 10-bcn max/min %u\n", - rx_info->beacon_energy_a, rx_info->beacon_energy_b, - rx_info->beacon_energy_c, max_nrg_cck - 6); - - /* Count number of consecutive beacons with fewer-than-desired - * false alarms. */ - if (false_alarms < min_false_alarms) - data->num_in_cck_no_fa++; - else - data->num_in_cck_no_fa = 0; - D_CALIB("consecutive bcns with few false alarms = %u\n", - data->num_in_cck_no_fa); - - /* If we got too many false alarms this time, reduce sensitivity */ - if (false_alarms > max_false_alarms && - data->auto_corr_cck > AUTO_CORR_MAX_TH_CCK) { - D_CALIB("norm FA %u > max FA %u\n", false_alarms, - max_false_alarms); - D_CALIB("... reducing sensitivity\n"); - data->nrg_curr_state = IL_FA_TOO_MANY; - /* Store for "fewer than desired" on later beacon */ - data->nrg_silence_ref = silence_ref; - - /* increase energy threshold (reduce nrg value) - * to decrease sensitivity */ - data->nrg_th_cck = data->nrg_th_cck - NRG_STEP_CCK; - /* Else if we got fewer than desired, increase sensitivity */ - } else if (false_alarms < min_false_alarms) { - data->nrg_curr_state = IL_FA_TOO_FEW; - - /* Compare silence level with silence level for most recent - * healthy number or too many false alarms */ - data->nrg_auto_corr_silence_diff = - (s32) data->nrg_silence_ref - (s32) silence_ref; - - D_CALIB("norm FA %u < min FA %u, silence diff %d\n", - false_alarms, min_false_alarms, - data->nrg_auto_corr_silence_diff); - - /* Increase value to increase sensitivity, but only if: - * 1a) previous beacon did *not* have *too many* false alarms - * 1b) AND there's a significant difference in Rx levels - * from a previous beacon with too many, or healthy # FAs - * OR 2) We've seen a lot of beacons (100) with too few - * false alarms */ - if (data->nrg_prev_state != IL_FA_TOO_MANY && - (data->nrg_auto_corr_silence_diff > NRG_DIFF || - data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA)) { - - D_CALIB("... increasing sensitivity\n"); - /* Increase nrg value to increase sensitivity */ - val = data->nrg_th_cck + NRG_STEP_CCK; - data->nrg_th_cck = min((u32) ranges->min_nrg_cck, val); - } else { - D_CALIB("... but not changing sensitivity\n"); - } - - /* Else we got a healthy number of false alarms, keep status quo */ - } else { - D_CALIB(" FA in safe zone\n"); - data->nrg_curr_state = IL_FA_GOOD_RANGE; - - /* Store for use in "fewer than desired" with later beacon */ - data->nrg_silence_ref = silence_ref; - - /* If previous beacon had too many false alarms, - * give it some extra margin by reducing sensitivity again - * (but don't go below measured energy of desired Rx) */ - if (IL_FA_TOO_MANY == data->nrg_prev_state) { - D_CALIB("... increasing margin\n"); - if (data->nrg_th_cck > (max_nrg_cck + NRG_MARGIN)) - data->nrg_th_cck -= NRG_MARGIN; - else - data->nrg_th_cck = max_nrg_cck; - } - } - - /* Make sure the energy threshold does not go above the measured - * energy of the desired Rx signals (reduced by backoff margin), - * or else we might start missing Rx frames. - * Lower value is higher energy, so we use max()! - */ - data->nrg_th_cck = max(max_nrg_cck, data->nrg_th_cck); - D_CALIB("new nrg_th_cck %u\n", data->nrg_th_cck); - - data->nrg_prev_state = data->nrg_curr_state; - - /* Auto-correlation CCK algorithm */ - if (false_alarms > min_false_alarms) { - - /* increase auto_corr values to decrease sensitivity - * so the DSP won't be disturbed by the noise - */ - if (data->auto_corr_cck < AUTO_CORR_MAX_TH_CCK) - data->auto_corr_cck = AUTO_CORR_MAX_TH_CCK + 1; - else { - val = data->auto_corr_cck + AUTO_CORR_STEP_CCK; - data->auto_corr_cck = - min((u32) ranges->auto_corr_max_cck, val); - } - val = data->auto_corr_cck_mrc + AUTO_CORR_STEP_CCK; - data->auto_corr_cck_mrc = - min((u32) ranges->auto_corr_max_cck_mrc, val); - } else if (false_alarms < min_false_alarms && - (data->nrg_auto_corr_silence_diff > NRG_DIFF || - data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA)) { - - /* Decrease auto_corr values to increase sensitivity */ - val = data->auto_corr_cck - AUTO_CORR_STEP_CCK; - data->auto_corr_cck = max((u32) ranges->auto_corr_min_cck, val); - val = data->auto_corr_cck_mrc - AUTO_CORR_STEP_CCK; - data->auto_corr_cck_mrc = - max((u32) ranges->auto_corr_min_cck_mrc, val); - } - - return 0; -} - -static int -il4965_sens_auto_corr_ofdm(struct il_priv *il, u32 norm_fa, u32 rx_enable_time) -{ - u32 val; - u32 false_alarms = norm_fa * 200 * 1024; - u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time; - u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time; - struct il_sensitivity_data *data = NULL; - const struct il_sensitivity_ranges *ranges = il->hw_params.sens; - - data = &(il->sensitivity_data); - - /* If we got too many false alarms this time, reduce sensitivity */ - if (false_alarms > max_false_alarms) { - - D_CALIB("norm FA %u > max FA %u)\n", false_alarms, - max_false_alarms); - - val = data->auto_corr_ofdm + AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm = - min((u32) ranges->auto_corr_max_ofdm, val); - - val = data->auto_corr_ofdm_mrc + AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm_mrc = - min((u32) ranges->auto_corr_max_ofdm_mrc, val); - - val = data->auto_corr_ofdm_x1 + AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm_x1 = - min((u32) ranges->auto_corr_max_ofdm_x1, val); - - val = data->auto_corr_ofdm_mrc_x1 + AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm_mrc_x1 = - min((u32) ranges->auto_corr_max_ofdm_mrc_x1, val); - } - - /* Else if we got fewer than desired, increase sensitivity */ - else if (false_alarms < min_false_alarms) { - - D_CALIB("norm FA %u < min FA %u\n", false_alarms, - min_false_alarms); - - val = data->auto_corr_ofdm - AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm = - max((u32) ranges->auto_corr_min_ofdm, val); - - val = data->auto_corr_ofdm_mrc - AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm_mrc = - max((u32) ranges->auto_corr_min_ofdm_mrc, val); - - val = data->auto_corr_ofdm_x1 - AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm_x1 = - max((u32) ranges->auto_corr_min_ofdm_x1, val); - - val = data->auto_corr_ofdm_mrc_x1 - AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm_mrc_x1 = - max((u32) ranges->auto_corr_min_ofdm_mrc_x1, val); - } else { - D_CALIB("min FA %u < norm FA %u < max FA %u OK\n", - min_false_alarms, false_alarms, max_false_alarms); - } - return 0; -} - -static void -il4965_prepare_legacy_sensitivity_tbl(struct il_priv *il, - struct il_sensitivity_data *data, - __le16 *tbl) -{ - tbl[HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX] = - cpu_to_le16((u16) data->auto_corr_ofdm); - tbl[HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX] = - cpu_to_le16((u16) data->auto_corr_ofdm_mrc); - tbl[HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX] = - cpu_to_le16((u16) data->auto_corr_ofdm_x1); - tbl[HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX] = - cpu_to_le16((u16) data->auto_corr_ofdm_mrc_x1); - - tbl[HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX] = - cpu_to_le16((u16) data->auto_corr_cck); - tbl[HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX] = - cpu_to_le16((u16) data->auto_corr_cck_mrc); - - tbl[HD_MIN_ENERGY_CCK_DET_IDX] = cpu_to_le16((u16) data->nrg_th_cck); - tbl[HD_MIN_ENERGY_OFDM_DET_IDX] = cpu_to_le16((u16) data->nrg_th_ofdm); - - tbl[HD_BARKER_CORR_TH_ADD_MIN_IDX] = - cpu_to_le16(data->barker_corr_th_min); - tbl[HD_BARKER_CORR_TH_ADD_MIN_MRC_IDX] = - cpu_to_le16(data->barker_corr_th_min_mrc); - tbl[HD_OFDM_ENERGY_TH_IN_IDX] = cpu_to_le16(data->nrg_th_cca); - - D_CALIB("ofdm: ac %u mrc %u x1 %u mrc_x1 %u thresh %u\n", - data->auto_corr_ofdm, data->auto_corr_ofdm_mrc, - data->auto_corr_ofdm_x1, data->auto_corr_ofdm_mrc_x1, - data->nrg_th_ofdm); - - D_CALIB("cck: ac %u mrc %u thresh %u\n", data->auto_corr_cck, - data->auto_corr_cck_mrc, data->nrg_th_cck); -} - -/* Prepare a C_SENSITIVITY, send to uCode if values have changed */ -static int -il4965_sensitivity_write(struct il_priv *il) -{ - struct il_sensitivity_cmd cmd; - struct il_sensitivity_data *data = NULL; - struct il_host_cmd cmd_out = { - .id = C_SENSITIVITY, - .len = sizeof(struct il_sensitivity_cmd), - .flags = CMD_ASYNC, - .data = &cmd, - }; - - data = &(il->sensitivity_data); - - memset(&cmd, 0, sizeof(cmd)); - - il4965_prepare_legacy_sensitivity_tbl(il, data, &cmd.table[0]); - - /* Update uCode's "work" table, and copy it to DSP */ - cmd.control = C_SENSITIVITY_CONTROL_WORK_TBL; - - /* Don't send command to uCode if nothing has changed */ - if (!memcmp - (&cmd.table[0], &(il->sensitivity_tbl[0]), - sizeof(u16) * HD_TBL_SIZE)) { - D_CALIB("No change in C_SENSITIVITY\n"); - return 0; - } - - /* Copy table for comparison next time */ - memcpy(&(il->sensitivity_tbl[0]), &(cmd.table[0]), - sizeof(u16) * HD_TBL_SIZE); - - return il_send_cmd(il, &cmd_out); -} - -void -il4965_init_sensitivity(struct il_priv *il) -{ - int ret = 0; - int i; - struct il_sensitivity_data *data = NULL; - const struct il_sensitivity_ranges *ranges = il->hw_params.sens; - - if (il->disable_sens_cal) - return; - - D_CALIB("Start il4965_init_sensitivity\n"); - - /* Clear driver's sensitivity algo data */ - data = &(il->sensitivity_data); - - if (ranges == NULL) - return; - - memset(data, 0, sizeof(struct il_sensitivity_data)); - - data->num_in_cck_no_fa = 0; - data->nrg_curr_state = IL_FA_TOO_MANY; - data->nrg_prev_state = IL_FA_TOO_MANY; - data->nrg_silence_ref = 0; - data->nrg_silence_idx = 0; - data->nrg_energy_idx = 0; - - for (i = 0; i < 10; i++) - data->nrg_value[i] = 0; - - for (i = 0; i < NRG_NUM_PREV_STAT_L; i++) - data->nrg_silence_rssi[i] = 0; - - data->auto_corr_ofdm = ranges->auto_corr_min_ofdm; - data->auto_corr_ofdm_mrc = ranges->auto_corr_min_ofdm_mrc; - data->auto_corr_ofdm_x1 = ranges->auto_corr_min_ofdm_x1; - data->auto_corr_ofdm_mrc_x1 = ranges->auto_corr_min_ofdm_mrc_x1; - data->auto_corr_cck = AUTO_CORR_CCK_MIN_VAL_DEF; - data->auto_corr_cck_mrc = ranges->auto_corr_min_cck_mrc; - data->nrg_th_cck = ranges->nrg_th_cck; - data->nrg_th_ofdm = ranges->nrg_th_ofdm; - data->barker_corr_th_min = ranges->barker_corr_th_min; - data->barker_corr_th_min_mrc = ranges->barker_corr_th_min_mrc; - data->nrg_th_cca = ranges->nrg_th_cca; - - data->last_bad_plcp_cnt_ofdm = 0; - data->last_fa_cnt_ofdm = 0; - data->last_bad_plcp_cnt_cck = 0; - data->last_fa_cnt_cck = 0; - - ret |= il4965_sensitivity_write(il); - D_CALIB("<disable_sens_cal) - return; - - data = &(il->sensitivity_data); - - if (!il_is_any_associated(il)) { - D_CALIB("<< - not associated\n"); - return; - } - - spin_lock_irqsave(&il->lock, flags); - - rx_info = &(((struct il_notif_stats *)resp)->rx.general); - ofdm = &(((struct il_notif_stats *)resp)->rx.ofdm); - cck = &(((struct il_notif_stats *)resp)->rx.cck); - - if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { - D_CALIB("<< invalid data.\n"); - spin_unlock_irqrestore(&il->lock, flags); - return; - } - - /* Extract Statistics: */ - rx_enable_time = le32_to_cpu(rx_info->channel_load); - fa_cck = le32_to_cpu(cck->false_alarm_cnt); - fa_ofdm = le32_to_cpu(ofdm->false_alarm_cnt); - bad_plcp_cck = le32_to_cpu(cck->plcp_err); - bad_plcp_ofdm = le32_to_cpu(ofdm->plcp_err); - - statis.beacon_silence_rssi_a = - le32_to_cpu(rx_info->beacon_silence_rssi_a); - statis.beacon_silence_rssi_b = - le32_to_cpu(rx_info->beacon_silence_rssi_b); - statis.beacon_silence_rssi_c = - le32_to_cpu(rx_info->beacon_silence_rssi_c); - statis.beacon_energy_a = le32_to_cpu(rx_info->beacon_energy_a); - statis.beacon_energy_b = le32_to_cpu(rx_info->beacon_energy_b); - statis.beacon_energy_c = le32_to_cpu(rx_info->beacon_energy_c); - - spin_unlock_irqrestore(&il->lock, flags); - - D_CALIB("rx_enable_time = %u usecs\n", rx_enable_time); - - if (!rx_enable_time) { - D_CALIB("<< RX Enable Time == 0!\n"); - return; - } - - /* These stats increase monotonically, and do not reset - * at each beacon. Calculate difference from last value, or just - * use the new stats value if it has reset or wrapped around. */ - if (data->last_bad_plcp_cnt_cck > bad_plcp_cck) - data->last_bad_plcp_cnt_cck = bad_plcp_cck; - else { - bad_plcp_cck -= data->last_bad_plcp_cnt_cck; - data->last_bad_plcp_cnt_cck += bad_plcp_cck; - } - - if (data->last_bad_plcp_cnt_ofdm > bad_plcp_ofdm) - data->last_bad_plcp_cnt_ofdm = bad_plcp_ofdm; - else { - bad_plcp_ofdm -= data->last_bad_plcp_cnt_ofdm; - data->last_bad_plcp_cnt_ofdm += bad_plcp_ofdm; - } - - if (data->last_fa_cnt_ofdm > fa_ofdm) - data->last_fa_cnt_ofdm = fa_ofdm; - else { - fa_ofdm -= data->last_fa_cnt_ofdm; - data->last_fa_cnt_ofdm += fa_ofdm; - } - - if (data->last_fa_cnt_cck > fa_cck) - data->last_fa_cnt_cck = fa_cck; - else { - fa_cck -= data->last_fa_cnt_cck; - data->last_fa_cnt_cck += fa_cck; - } - - /* Total aborted signal locks */ - norm_fa_ofdm = fa_ofdm + bad_plcp_ofdm; - norm_fa_cck = fa_cck + bad_plcp_cck; - - D_CALIB("cck: fa %u badp %u ofdm: fa %u badp %u\n", fa_cck, - bad_plcp_cck, fa_ofdm, bad_plcp_ofdm); - - il4965_sens_auto_corr_ofdm(il, norm_fa_ofdm, rx_enable_time); - il4965_sens_energy_cck(il, norm_fa_cck, rx_enable_time, &statis); - - il4965_sensitivity_write(il); -} - -static inline u8 -il4965_find_first_chain(u8 mask) -{ - if (mask & ANT_A) - return CHAIN_A; - if (mask & ANT_B) - return CHAIN_B; - return CHAIN_C; -} - -/** - * Run disconnected antenna algorithm to find out which antennas are - * disconnected. - */ -static void -il4965_find_disconn_antenna(struct il_priv *il, u32 * average_sig, - struct il_chain_noise_data *data) -{ - u32 active_chains = 0; - u32 max_average_sig; - u16 max_average_sig_antenna_i; - u8 num_tx_chains; - u8 first_chain; - u16 i = 0; - - average_sig[0] = - data->chain_signal_a / - il->cfg->chain_noise_num_beacons; - average_sig[1] = - data->chain_signal_b / - il->cfg->chain_noise_num_beacons; - average_sig[2] = - data->chain_signal_c / - il->cfg->chain_noise_num_beacons; - - if (average_sig[0] >= average_sig[1]) { - max_average_sig = average_sig[0]; - max_average_sig_antenna_i = 0; - active_chains = (1 << max_average_sig_antenna_i); - } else { - max_average_sig = average_sig[1]; - max_average_sig_antenna_i = 1; - active_chains = (1 << max_average_sig_antenna_i); - } - - if (average_sig[2] >= max_average_sig) { - max_average_sig = average_sig[2]; - max_average_sig_antenna_i = 2; - active_chains = (1 << max_average_sig_antenna_i); - } - - D_CALIB("average_sig: a %d b %d c %d\n", average_sig[0], average_sig[1], - average_sig[2]); - D_CALIB("max_average_sig = %d, antenna %d\n", max_average_sig, - max_average_sig_antenna_i); - - /* Compare signal strengths for all 3 receivers. */ - for (i = 0; i < NUM_RX_CHAINS; i++) { - if (i != max_average_sig_antenna_i) { - s32 rssi_delta = (max_average_sig - average_sig[i]); - - /* If signal is very weak, compared with - * strongest, mark it as disconnected. */ - if (rssi_delta > MAXIMUM_ALLOWED_PATHLOSS) - data->disconn_array[i] = 1; - else - active_chains |= (1 << i); - D_CALIB("i = %d rssiDelta = %d " - "disconn_array[i] = %d\n", i, rssi_delta, - data->disconn_array[i]); - } - } - - /* - * The above algorithm sometimes fails when the ucode - * reports 0 for all chains. It's not clear why that - * happens to start with, but it is then causing trouble - * because this can make us enable more chains than the - * hardware really has. - * - * To be safe, simply mask out any chains that we know - * are not on the device. - */ - active_chains &= il->hw_params.valid_rx_ant; - - num_tx_chains = 0; - for (i = 0; i < NUM_RX_CHAINS; i++) { - /* loops on all the bits of - * il->hw_setting.valid_tx_ant */ - u8 ant_msk = (1 << i); - if (!(il->hw_params.valid_tx_ant & ant_msk)) - continue; - - num_tx_chains++; - if (data->disconn_array[i] == 0) - /* there is a Tx antenna connected */ - break; - if (num_tx_chains == il->hw_params.tx_chains_num && - data->disconn_array[i]) { - /* - * If all chains are disconnected - * connect the first valid tx chain - */ - first_chain = - il4965_find_first_chain(il->cfg->valid_tx_ant); - data->disconn_array[first_chain] = 0; - active_chains |= BIT(first_chain); - D_CALIB("All Tx chains are disconnected" - "- declare %d as connected\n", first_chain); - break; - } - } - - if (active_chains != il->hw_params.valid_rx_ant && - active_chains != il->chain_noise_data.active_chains) - D_CALIB("Detected that not all antennas are connected! " - "Connected: %#x, valid: %#x.\n", active_chains, - il->hw_params.valid_rx_ant); - - /* Save for use within RXON, TX, SCAN commands, etc. */ - data->active_chains = active_chains; - D_CALIB("active_chains (bitwise) = 0x%x\n", active_chains); -} - -static void -il4965_gain_computation(struct il_priv *il, u32 * average_noise, - u16 min_average_noise_antenna_i, u32 min_average_noise, - u8 default_chain) -{ - int i, ret; - struct il_chain_noise_data *data = &il->chain_noise_data; - - data->delta_gain_code[min_average_noise_antenna_i] = 0; - - for (i = default_chain; i < NUM_RX_CHAINS; i++) { - s32 delta_g = 0; - - if (!data->disconn_array[i] && - data->delta_gain_code[i] == - CHAIN_NOISE_DELTA_GAIN_INIT_VAL) { - delta_g = average_noise[i] - min_average_noise; - data->delta_gain_code[i] = (u8) ((delta_g * 10) / 15); - data->delta_gain_code[i] = - min(data->delta_gain_code[i], - (u8) CHAIN_NOISE_MAX_DELTA_GAIN_CODE); - - data->delta_gain_code[i] = - (data->delta_gain_code[i] | (1 << 2)); - } else { - data->delta_gain_code[i] = 0; - } - } - D_CALIB("delta_gain_codes: a %d b %d c %d\n", data->delta_gain_code[0], - data->delta_gain_code[1], data->delta_gain_code[2]); - - /* Differential gain gets sent to uCode only once */ - if (!data->radio_write) { - struct il_calib_diff_gain_cmd cmd; - data->radio_write = 1; - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.op_code = IL_PHY_CALIBRATE_DIFF_GAIN_CMD; - cmd.diff_gain_a = data->delta_gain_code[0]; - cmd.diff_gain_b = data->delta_gain_code[1]; - cmd.diff_gain_c = data->delta_gain_code[2]; - ret = il_send_cmd_pdu(il, C_PHY_CALIBRATION, sizeof(cmd), &cmd); - if (ret) - D_CALIB("fail sending cmd " "C_PHY_CALIBRATION\n"); - - /* TODO we might want recalculate - * rx_chain in rxon cmd */ - - /* Mark so we run this algo only once! */ - data->state = IL_CHAIN_NOISE_CALIBRATED; - } -} - -/* - * Accumulate 16 beacons of signal and noise stats for each of - * 3 receivers/antennas/rx-chains, then figure out: - * 1) Which antennas are connected. - * 2) Differential rx gain settings to balance the 3 receivers. - */ -void -il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp) -{ - struct il_chain_noise_data *data = NULL; - - u32 chain_noise_a; - u32 chain_noise_b; - u32 chain_noise_c; - u32 chain_sig_a; - u32 chain_sig_b; - u32 chain_sig_c; - u32 average_sig[NUM_RX_CHAINS] = { INITIALIZATION_VALUE }; - u32 average_noise[NUM_RX_CHAINS] = { INITIALIZATION_VALUE }; - u32 min_average_noise = MIN_AVERAGE_NOISE_MAX_VALUE; - u16 min_average_noise_antenna_i = INITIALIZATION_VALUE; - u16 i = 0; - u16 rxon_chnum = INITIALIZATION_VALUE; - u16 stat_chnum = INITIALIZATION_VALUE; - u8 rxon_band24; - u8 stat_band24; - unsigned long flags; - struct stats_rx_non_phy *rx_info; - - if (il->disable_chain_noise_cal) - return; - - data = &(il->chain_noise_data); - - /* - * Accumulate just the first "chain_noise_num_beacons" after - * the first association, then we're done forever. - */ - if (data->state != IL_CHAIN_NOISE_ACCUMULATE) { - if (data->state == IL_CHAIN_NOISE_ALIVE) - D_CALIB("Wait for noise calib reset\n"); - return; - } - - spin_lock_irqsave(&il->lock, flags); - - rx_info = &(((struct il_notif_stats *)stat_resp)->rx.general); - - if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { - D_CALIB(" << Interference data unavailable\n"); - spin_unlock_irqrestore(&il->lock, flags); - return; - } - - rxon_band24 = !!(il->staging.flags & RXON_FLG_BAND_24G_MSK); - rxon_chnum = le16_to_cpu(il->staging.channel); - - stat_band24 = - !!(((struct il_notif_stats *)stat_resp)-> - flag & STATS_REPLY_FLG_BAND_24G_MSK); - stat_chnum = - le32_to_cpu(((struct il_notif_stats *)stat_resp)->flag) >> 16; - - /* Make sure we accumulate data for just the associated channel - * (even if scanning). */ - if (rxon_chnum != stat_chnum || rxon_band24 != stat_band24) { - D_CALIB("Stats not from chan=%d, band24=%d\n", rxon_chnum, - rxon_band24); - spin_unlock_irqrestore(&il->lock, flags); - return; - } - - /* - * Accumulate beacon stats values across - * "chain_noise_num_beacons" - */ - chain_noise_a = - le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER; - chain_noise_b = - le32_to_cpu(rx_info->beacon_silence_rssi_b) & IN_BAND_FILTER; - chain_noise_c = - le32_to_cpu(rx_info->beacon_silence_rssi_c) & IN_BAND_FILTER; - - chain_sig_a = le32_to_cpu(rx_info->beacon_rssi_a) & IN_BAND_FILTER; - chain_sig_b = le32_to_cpu(rx_info->beacon_rssi_b) & IN_BAND_FILTER; - chain_sig_c = le32_to_cpu(rx_info->beacon_rssi_c) & IN_BAND_FILTER; - - spin_unlock_irqrestore(&il->lock, flags); - - data->beacon_count++; - - data->chain_noise_a = (chain_noise_a + data->chain_noise_a); - data->chain_noise_b = (chain_noise_b + data->chain_noise_b); - data->chain_noise_c = (chain_noise_c + data->chain_noise_c); - - data->chain_signal_a = (chain_sig_a + data->chain_signal_a); - data->chain_signal_b = (chain_sig_b + data->chain_signal_b); - data->chain_signal_c = (chain_sig_c + data->chain_signal_c); - - D_CALIB("chan=%d, band24=%d, beacon=%d\n", rxon_chnum, rxon_band24, - data->beacon_count); - D_CALIB("chain_sig: a %d b %d c %d\n", chain_sig_a, chain_sig_b, - chain_sig_c); - D_CALIB("chain_noise: a %d b %d c %d\n", chain_noise_a, chain_noise_b, - chain_noise_c); - - /* If this is the "chain_noise_num_beacons", determine: - * 1) Disconnected antennas (using signal strengths) - * 2) Differential gain (using silence noise) to balance receivers */ - if (data->beacon_count != il->cfg->chain_noise_num_beacons) - return; - - /* Analyze signal for disconnected antenna */ - il4965_find_disconn_antenna(il, average_sig, data); - - /* Analyze noise for rx balance */ - average_noise[0] = - data->chain_noise_a / il->cfg->chain_noise_num_beacons; - average_noise[1] = - data->chain_noise_b / il->cfg->chain_noise_num_beacons; - average_noise[2] = - data->chain_noise_c / il->cfg->chain_noise_num_beacons; - - for (i = 0; i < NUM_RX_CHAINS; i++) { - if (!data->disconn_array[i] && - average_noise[i] <= min_average_noise) { - /* This means that chain i is active and has - * lower noise values so far: */ - min_average_noise = average_noise[i]; - min_average_noise_antenna_i = i; - } - } - - D_CALIB("average_noise: a %d b %d c %d\n", average_noise[0], - average_noise[1], average_noise[2]); - - D_CALIB("min_average_noise = %d, antenna %d\n", min_average_noise, - min_average_noise_antenna_i); - - il4965_gain_computation(il, average_noise, min_average_noise_antenna_i, - min_average_noise, - il4965_find_first_chain(il->cfg->valid_rx_ant)); - - /* Some power changes may have been made during the calibration. - * Update and commit the RXON - */ - if (il->ops->update_chain_flags) - il->ops->update_chain_flags(il); - - data->state = IL_CHAIN_NOISE_DONE; - il_power_update_mode(il, false); -} - -void -il4965_reset_run_time_calib(struct il_priv *il) -{ - int i; - memset(&(il->sensitivity_data), 0, sizeof(struct il_sensitivity_data)); - memset(&(il->chain_noise_data), 0, sizeof(struct il_chain_noise_data)); - for (i = 0; i < NUM_RX_CHAINS; i++) - il->chain_noise_data.delta_gain_code[i] = - CHAIN_NOISE_DELTA_GAIN_INIT_VAL; - - /* Ask for stats now, the uCode will send notification - * periodically after association */ - il_send_stats_request(il, CMD_ASYNC, true); -} diff --git a/drivers/net/wireless/iwlegacy/4965-debug.c b/drivers/net/wireless/iwlegacy/4965-debug.c deleted file mode 100644 index c8153fc64f74..000000000000 --- a/drivers/net/wireless/iwlegacy/4965-debug.c +++ /dev/null @@ -1,752 +0,0 @@ -/****************************************************************************** -* -* GPL LICENSE SUMMARY -* -* Copyright(c) 2008 - 2011 Intel 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 -* -* The full GNU General Public License is included in this distribution -* in the file called LICENSE.GPL. -* -* Contact Information: -* Intel Linux Wireless -* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 -*****************************************************************************/ -#include "common.h" -#include "4965.h" - -static const char *fmt_value = " %-30s %10u\n"; -static const char *fmt_table = " %-30s %10u %10u %10u %10u\n"; -static const char *fmt_header = - "%-32s current cumulative delta max\n"; - -static int -il4965_stats_flag(struct il_priv *il, char *buf, int bufsz) -{ - int p = 0; - u32 flag; - - flag = le32_to_cpu(il->_4965.stats.flag); - - p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag); - if (flag & UCODE_STATS_CLEAR_MSK) - p += scnprintf(buf + p, bufsz - p, - "\tStatistics have been cleared\n"); - p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n", - (flag & UCODE_STATS_FREQUENCY_MSK) ? "2.4 GHz" : - "5.2 GHz"); - p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n", - (flag & UCODE_STATS_NARROW_BAND_MSK) ? "enabled" : - "disabled"); - - return p; -} - -ssize_t -il4965_ucode_rx_stats_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - int pos = 0; - char *buf; - int bufsz = - sizeof(struct stats_rx_phy) * 40 + - sizeof(struct stats_rx_non_phy) * 40 + - sizeof(struct stats_rx_ht_phy) * 40 + 400; - ssize_t ret; - struct stats_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm; - struct stats_rx_phy *cck, *accum_cck, *delta_cck, *max_cck; - struct stats_rx_non_phy *general, *accum_general; - struct stats_rx_non_phy *delta_general, *max_general; - struct stats_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht; - - if (!il_is_alive(il)) - return -EAGAIN; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) { - IL_ERR("Can not allocate Buffer\n"); - return -ENOMEM; - } - - /* - * the statistic information display here is based on - * the last stats notification from uCode - * might not reflect the current uCode activity - */ - ofdm = &il->_4965.stats.rx.ofdm; - cck = &il->_4965.stats.rx.cck; - general = &il->_4965.stats.rx.general; - ht = &il->_4965.stats.rx.ofdm_ht; - accum_ofdm = &il->_4965.accum_stats.rx.ofdm; - accum_cck = &il->_4965.accum_stats.rx.cck; - accum_general = &il->_4965.accum_stats.rx.general; - accum_ht = &il->_4965.accum_stats.rx.ofdm_ht; - delta_ofdm = &il->_4965.delta_stats.rx.ofdm; - delta_cck = &il->_4965.delta_stats.rx.cck; - delta_general = &il->_4965.delta_stats.rx.general; - delta_ht = &il->_4965.delta_stats.rx.ofdm_ht; - max_ofdm = &il->_4965.max_delta.rx.ofdm; - max_cck = &il->_4965.max_delta.rx.cck; - max_general = &il->_4965.max_delta.rx.general; - max_ht = &il->_4965.max_delta.rx.ofdm_ht; - - pos += il4965_stats_flag(il, buf, bufsz); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_header, - "Statistics_Rx - OFDM:"); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "ina_cnt:", - le32_to_cpu(ofdm->ina_cnt), accum_ofdm->ina_cnt, - delta_ofdm->ina_cnt, max_ofdm->ina_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "fina_cnt:", - le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt, - delta_ofdm->fina_cnt, max_ofdm->fina_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "plcp_err:", - le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err, - delta_ofdm->plcp_err, max_ofdm->plcp_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "crc32_err:", - le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err, - delta_ofdm->crc32_err, max_ofdm->crc32_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "overrun_err:", - le32_to_cpu(ofdm->overrun_err), accum_ofdm->overrun_err, - delta_ofdm->overrun_err, max_ofdm->overrun_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "early_overrun_err:", - le32_to_cpu(ofdm->early_overrun_err), - accum_ofdm->early_overrun_err, - delta_ofdm->early_overrun_err, - max_ofdm->early_overrun_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "crc32_good:", - le32_to_cpu(ofdm->crc32_good), accum_ofdm->crc32_good, - delta_ofdm->crc32_good, max_ofdm->crc32_good); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "false_alarm_cnt:", - le32_to_cpu(ofdm->false_alarm_cnt), - accum_ofdm->false_alarm_cnt, delta_ofdm->false_alarm_cnt, - max_ofdm->false_alarm_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "fina_sync_err_cnt:", - le32_to_cpu(ofdm->fina_sync_err_cnt), - accum_ofdm->fina_sync_err_cnt, - delta_ofdm->fina_sync_err_cnt, - max_ofdm->fina_sync_err_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "sfd_timeout:", - le32_to_cpu(ofdm->sfd_timeout), accum_ofdm->sfd_timeout, - delta_ofdm->sfd_timeout, max_ofdm->sfd_timeout); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "fina_timeout:", - le32_to_cpu(ofdm->fina_timeout), accum_ofdm->fina_timeout, - delta_ofdm->fina_timeout, max_ofdm->fina_timeout); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "unresponded_rts:", - le32_to_cpu(ofdm->unresponded_rts), - accum_ofdm->unresponded_rts, delta_ofdm->unresponded_rts, - max_ofdm->unresponded_rts); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "rxe_frame_lmt_ovrun:", - le32_to_cpu(ofdm->rxe_frame_limit_overrun), - accum_ofdm->rxe_frame_limit_overrun, - delta_ofdm->rxe_frame_limit_overrun, - max_ofdm->rxe_frame_limit_overrun); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "sent_ack_cnt:", - le32_to_cpu(ofdm->sent_ack_cnt), accum_ofdm->sent_ack_cnt, - delta_ofdm->sent_ack_cnt, max_ofdm->sent_ack_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "sent_cts_cnt:", - le32_to_cpu(ofdm->sent_cts_cnt), accum_ofdm->sent_cts_cnt, - delta_ofdm->sent_cts_cnt, max_ofdm->sent_cts_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "sent_ba_rsp_cnt:", - le32_to_cpu(ofdm->sent_ba_rsp_cnt), - accum_ofdm->sent_ba_rsp_cnt, delta_ofdm->sent_ba_rsp_cnt, - max_ofdm->sent_ba_rsp_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "dsp_self_kill:", - le32_to_cpu(ofdm->dsp_self_kill), - accum_ofdm->dsp_self_kill, delta_ofdm->dsp_self_kill, - max_ofdm->dsp_self_kill); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "mh_format_err:", - le32_to_cpu(ofdm->mh_format_err), - accum_ofdm->mh_format_err, delta_ofdm->mh_format_err, - max_ofdm->mh_format_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "re_acq_main_rssi_sum:", - le32_to_cpu(ofdm->re_acq_main_rssi_sum), - accum_ofdm->re_acq_main_rssi_sum, - delta_ofdm->re_acq_main_rssi_sum, - max_ofdm->re_acq_main_rssi_sum); - - pos += - scnprintf(buf + pos, bufsz - pos, fmt_header, - "Statistics_Rx - CCK:"); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "ina_cnt:", - le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt, - delta_cck->ina_cnt, max_cck->ina_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "fina_cnt:", - le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt, - delta_cck->fina_cnt, max_cck->fina_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "plcp_err:", - le32_to_cpu(cck->plcp_err), accum_cck->plcp_err, - delta_cck->plcp_err, max_cck->plcp_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "crc32_err:", - le32_to_cpu(cck->crc32_err), accum_cck->crc32_err, - delta_cck->crc32_err, max_cck->crc32_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "overrun_err:", - le32_to_cpu(cck->overrun_err), accum_cck->overrun_err, - delta_cck->overrun_err, max_cck->overrun_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "early_overrun_err:", - le32_to_cpu(cck->early_overrun_err), - accum_cck->early_overrun_err, - delta_cck->early_overrun_err, max_cck->early_overrun_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "crc32_good:", - le32_to_cpu(cck->crc32_good), accum_cck->crc32_good, - delta_cck->crc32_good, max_cck->crc32_good); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "false_alarm_cnt:", - le32_to_cpu(cck->false_alarm_cnt), - accum_cck->false_alarm_cnt, delta_cck->false_alarm_cnt, - max_cck->false_alarm_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "fina_sync_err_cnt:", - le32_to_cpu(cck->fina_sync_err_cnt), - accum_cck->fina_sync_err_cnt, - delta_cck->fina_sync_err_cnt, max_cck->fina_sync_err_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "sfd_timeout:", - le32_to_cpu(cck->sfd_timeout), accum_cck->sfd_timeout, - delta_cck->sfd_timeout, max_cck->sfd_timeout); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "fina_timeout:", - le32_to_cpu(cck->fina_timeout), accum_cck->fina_timeout, - delta_cck->fina_timeout, max_cck->fina_timeout); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "unresponded_rts:", - le32_to_cpu(cck->unresponded_rts), - accum_cck->unresponded_rts, delta_cck->unresponded_rts, - max_cck->unresponded_rts); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "rxe_frame_lmt_ovrun:", - le32_to_cpu(cck->rxe_frame_limit_overrun), - accum_cck->rxe_frame_limit_overrun, - delta_cck->rxe_frame_limit_overrun, - max_cck->rxe_frame_limit_overrun); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "sent_ack_cnt:", - le32_to_cpu(cck->sent_ack_cnt), accum_cck->sent_ack_cnt, - delta_cck->sent_ack_cnt, max_cck->sent_ack_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "sent_cts_cnt:", - le32_to_cpu(cck->sent_cts_cnt), accum_cck->sent_cts_cnt, - delta_cck->sent_cts_cnt, max_cck->sent_cts_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "sent_ba_rsp_cnt:", - le32_to_cpu(cck->sent_ba_rsp_cnt), - accum_cck->sent_ba_rsp_cnt, delta_cck->sent_ba_rsp_cnt, - max_cck->sent_ba_rsp_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "dsp_self_kill:", - le32_to_cpu(cck->dsp_self_kill), accum_cck->dsp_self_kill, - delta_cck->dsp_self_kill, max_cck->dsp_self_kill); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "mh_format_err:", - le32_to_cpu(cck->mh_format_err), accum_cck->mh_format_err, - delta_cck->mh_format_err, max_cck->mh_format_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "re_acq_main_rssi_sum:", - le32_to_cpu(cck->re_acq_main_rssi_sum), - accum_cck->re_acq_main_rssi_sum, - delta_cck->re_acq_main_rssi_sum, - max_cck->re_acq_main_rssi_sum); - - pos += - scnprintf(buf + pos, bufsz - pos, fmt_header, - "Statistics_Rx - GENERAL:"); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "bogus_cts:", - le32_to_cpu(general->bogus_cts), accum_general->bogus_cts, - delta_general->bogus_cts, max_general->bogus_cts); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "bogus_ack:", - le32_to_cpu(general->bogus_ack), accum_general->bogus_ack, - delta_general->bogus_ack, max_general->bogus_ack); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "non_bssid_frames:", - le32_to_cpu(general->non_bssid_frames), - accum_general->non_bssid_frames, - delta_general->non_bssid_frames, - max_general->non_bssid_frames); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "filtered_frames:", - le32_to_cpu(general->filtered_frames), - accum_general->filtered_frames, - delta_general->filtered_frames, - max_general->filtered_frames); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "non_channel_beacons:", - le32_to_cpu(general->non_channel_beacons), - accum_general->non_channel_beacons, - delta_general->non_channel_beacons, - max_general->non_channel_beacons); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "channel_beacons:", - le32_to_cpu(general->channel_beacons), - accum_general->channel_beacons, - delta_general->channel_beacons, - max_general->channel_beacons); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "num_missed_bcon:", - le32_to_cpu(general->num_missed_bcon), - accum_general->num_missed_bcon, - delta_general->num_missed_bcon, - max_general->num_missed_bcon); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "adc_rx_saturation_time:", - le32_to_cpu(general->adc_rx_saturation_time), - accum_general->adc_rx_saturation_time, - delta_general->adc_rx_saturation_time, - max_general->adc_rx_saturation_time); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "ina_detect_search_tm:", - le32_to_cpu(general->ina_detection_search_time), - accum_general->ina_detection_search_time, - delta_general->ina_detection_search_time, - max_general->ina_detection_search_time); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "beacon_silence_rssi_a:", - le32_to_cpu(general->beacon_silence_rssi_a), - accum_general->beacon_silence_rssi_a, - delta_general->beacon_silence_rssi_a, - max_general->beacon_silence_rssi_a); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "beacon_silence_rssi_b:", - le32_to_cpu(general->beacon_silence_rssi_b), - accum_general->beacon_silence_rssi_b, - delta_general->beacon_silence_rssi_b, - max_general->beacon_silence_rssi_b); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "beacon_silence_rssi_c:", - le32_to_cpu(general->beacon_silence_rssi_c), - accum_general->beacon_silence_rssi_c, - delta_general->beacon_silence_rssi_c, - max_general->beacon_silence_rssi_c); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "interference_data_flag:", - le32_to_cpu(general->interference_data_flag), - accum_general->interference_data_flag, - delta_general->interference_data_flag, - max_general->interference_data_flag); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "channel_load:", - le32_to_cpu(general->channel_load), - accum_general->channel_load, delta_general->channel_load, - max_general->channel_load); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "dsp_false_alarms:", - le32_to_cpu(general->dsp_false_alarms), - accum_general->dsp_false_alarms, - delta_general->dsp_false_alarms, - max_general->dsp_false_alarms); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "beacon_rssi_a:", - le32_to_cpu(general->beacon_rssi_a), - accum_general->beacon_rssi_a, - delta_general->beacon_rssi_a, max_general->beacon_rssi_a); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "beacon_rssi_b:", - le32_to_cpu(general->beacon_rssi_b), - accum_general->beacon_rssi_b, - delta_general->beacon_rssi_b, max_general->beacon_rssi_b); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "beacon_rssi_c:", - le32_to_cpu(general->beacon_rssi_c), - accum_general->beacon_rssi_c, - delta_general->beacon_rssi_c, max_general->beacon_rssi_c); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "beacon_energy_a:", - le32_to_cpu(general->beacon_energy_a), - accum_general->beacon_energy_a, - delta_general->beacon_energy_a, - max_general->beacon_energy_a); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "beacon_energy_b:", - le32_to_cpu(general->beacon_energy_b), - accum_general->beacon_energy_b, - delta_general->beacon_energy_b, - max_general->beacon_energy_b); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "beacon_energy_c:", - le32_to_cpu(general->beacon_energy_c), - accum_general->beacon_energy_c, - delta_general->beacon_energy_c, - max_general->beacon_energy_c); - - pos += - scnprintf(buf + pos, bufsz - pos, fmt_header, - "Statistics_Rx - OFDM_HT:"); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "plcp_err:", - le32_to_cpu(ht->plcp_err), accum_ht->plcp_err, - delta_ht->plcp_err, max_ht->plcp_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "overrun_err:", - le32_to_cpu(ht->overrun_err), accum_ht->overrun_err, - delta_ht->overrun_err, max_ht->overrun_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "early_overrun_err:", - le32_to_cpu(ht->early_overrun_err), - accum_ht->early_overrun_err, delta_ht->early_overrun_err, - max_ht->early_overrun_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "crc32_good:", - le32_to_cpu(ht->crc32_good), accum_ht->crc32_good, - delta_ht->crc32_good, max_ht->crc32_good); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "crc32_err:", - le32_to_cpu(ht->crc32_err), accum_ht->crc32_err, - delta_ht->crc32_err, max_ht->crc32_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "mh_format_err:", - le32_to_cpu(ht->mh_format_err), accum_ht->mh_format_err, - delta_ht->mh_format_err, max_ht->mh_format_err); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "agg_crc32_good:", - le32_to_cpu(ht->agg_crc32_good), accum_ht->agg_crc32_good, - delta_ht->agg_crc32_good, max_ht->agg_crc32_good); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "agg_mpdu_cnt:", - le32_to_cpu(ht->agg_mpdu_cnt), accum_ht->agg_mpdu_cnt, - delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "agg_cnt:", - le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt, - delta_ht->agg_cnt, max_ht->agg_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "unsupport_mcs:", - le32_to_cpu(ht->unsupport_mcs), accum_ht->unsupport_mcs, - delta_ht->unsupport_mcs, max_ht->unsupport_mcs); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -ssize_t -il4965_ucode_tx_stats_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - int pos = 0; - char *buf; - int bufsz = (sizeof(struct stats_tx) * 48) + 250; - ssize_t ret; - struct stats_tx *tx, *accum_tx, *delta_tx, *max_tx; - - if (!il_is_alive(il)) - return -EAGAIN; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) { - IL_ERR("Can not allocate Buffer\n"); - return -ENOMEM; - } - - /* the statistic information display here is based on - * the last stats notification from uCode - * might not reflect the current uCode activity - */ - tx = &il->_4965.stats.tx; - accum_tx = &il->_4965.accum_stats.tx; - delta_tx = &il->_4965.delta_stats.tx; - max_tx = &il->_4965.max_delta.tx; - - pos += il4965_stats_flag(il, buf, bufsz); - pos += scnprintf(buf + pos, bufsz - pos, fmt_header, "Statistics_Tx:"); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "preamble:", - le32_to_cpu(tx->preamble_cnt), accum_tx->preamble_cnt, - delta_tx->preamble_cnt, max_tx->preamble_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "rx_detected_cnt:", - le32_to_cpu(tx->rx_detected_cnt), - accum_tx->rx_detected_cnt, delta_tx->rx_detected_cnt, - max_tx->rx_detected_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "bt_prio_defer_cnt:", - le32_to_cpu(tx->bt_prio_defer_cnt), - accum_tx->bt_prio_defer_cnt, delta_tx->bt_prio_defer_cnt, - max_tx->bt_prio_defer_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "bt_prio_kill_cnt:", - le32_to_cpu(tx->bt_prio_kill_cnt), - accum_tx->bt_prio_kill_cnt, delta_tx->bt_prio_kill_cnt, - max_tx->bt_prio_kill_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "few_bytes_cnt:", - le32_to_cpu(tx->few_bytes_cnt), accum_tx->few_bytes_cnt, - delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "cts_timeout:", - le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout, - delta_tx->cts_timeout, max_tx->cts_timeout); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "ack_timeout:", - le32_to_cpu(tx->ack_timeout), accum_tx->ack_timeout, - delta_tx->ack_timeout, max_tx->ack_timeout); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "expected_ack_cnt:", - le32_to_cpu(tx->expected_ack_cnt), - accum_tx->expected_ack_cnt, delta_tx->expected_ack_cnt, - max_tx->expected_ack_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "actual_ack_cnt:", - le32_to_cpu(tx->actual_ack_cnt), accum_tx->actual_ack_cnt, - delta_tx->actual_ack_cnt, max_tx->actual_ack_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "dump_msdu_cnt:", - le32_to_cpu(tx->dump_msdu_cnt), accum_tx->dump_msdu_cnt, - delta_tx->dump_msdu_cnt, max_tx->dump_msdu_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "abort_nxt_frame_mismatch:", - le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt), - accum_tx->burst_abort_next_frame_mismatch_cnt, - delta_tx->burst_abort_next_frame_mismatch_cnt, - max_tx->burst_abort_next_frame_mismatch_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "abort_missing_nxt_frame:", - le32_to_cpu(tx->burst_abort_missing_next_frame_cnt), - accum_tx->burst_abort_missing_next_frame_cnt, - delta_tx->burst_abort_missing_next_frame_cnt, - max_tx->burst_abort_missing_next_frame_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "cts_timeout_collision:", - le32_to_cpu(tx->cts_timeout_collision), - accum_tx->cts_timeout_collision, - delta_tx->cts_timeout_collision, - max_tx->cts_timeout_collision); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "ack_ba_timeout_collision:", - le32_to_cpu(tx->ack_or_ba_timeout_collision), - accum_tx->ack_or_ba_timeout_collision, - delta_tx->ack_or_ba_timeout_collision, - max_tx->ack_or_ba_timeout_collision); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "agg ba_timeout:", - le32_to_cpu(tx->agg.ba_timeout), accum_tx->agg.ba_timeout, - delta_tx->agg.ba_timeout, max_tx->agg.ba_timeout); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "agg ba_resched_frames:", - le32_to_cpu(tx->agg.ba_reschedule_frames), - accum_tx->agg.ba_reschedule_frames, - delta_tx->agg.ba_reschedule_frames, - max_tx->agg.ba_reschedule_frames); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "agg scd_query_agg_frame:", - le32_to_cpu(tx->agg.scd_query_agg_frame_cnt), - accum_tx->agg.scd_query_agg_frame_cnt, - delta_tx->agg.scd_query_agg_frame_cnt, - max_tx->agg.scd_query_agg_frame_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "agg scd_query_no_agg:", - le32_to_cpu(tx->agg.scd_query_no_agg), - accum_tx->agg.scd_query_no_agg, - delta_tx->agg.scd_query_no_agg, - max_tx->agg.scd_query_no_agg); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "agg scd_query_agg:", - le32_to_cpu(tx->agg.scd_query_agg), - accum_tx->agg.scd_query_agg, delta_tx->agg.scd_query_agg, - max_tx->agg.scd_query_agg); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "agg scd_query_mismatch:", - le32_to_cpu(tx->agg.scd_query_mismatch), - accum_tx->agg.scd_query_mismatch, - delta_tx->agg.scd_query_mismatch, - max_tx->agg.scd_query_mismatch); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "agg frame_not_ready:", - le32_to_cpu(tx->agg.frame_not_ready), - accum_tx->agg.frame_not_ready, - delta_tx->agg.frame_not_ready, - max_tx->agg.frame_not_ready); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "agg underrun:", - le32_to_cpu(tx->agg.underrun), accum_tx->agg.underrun, - delta_tx->agg.underrun, max_tx->agg.underrun); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "agg bt_prio_kill:", - le32_to_cpu(tx->agg.bt_prio_kill), - accum_tx->agg.bt_prio_kill, delta_tx->agg.bt_prio_kill, - max_tx->agg.bt_prio_kill); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "agg rx_ba_rsp_cnt:", - le32_to_cpu(tx->agg.rx_ba_rsp_cnt), - accum_tx->agg.rx_ba_rsp_cnt, delta_tx->agg.rx_ba_rsp_cnt, - max_tx->agg.rx_ba_rsp_cnt); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -ssize_t -il4965_ucode_general_stats_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - int pos = 0; - char *buf; - int bufsz = sizeof(struct stats_general) * 10 + 300; - ssize_t ret; - struct stats_general_common *general, *accum_general; - struct stats_general_common *delta_general, *max_general; - struct stats_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; - struct stats_div *div, *accum_div, *delta_div, *max_div; - - if (!il_is_alive(il)) - return -EAGAIN; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) { - IL_ERR("Can not allocate Buffer\n"); - return -ENOMEM; - } - - /* the statistic information display here is based on - * the last stats notification from uCode - * might not reflect the current uCode activity - */ - general = &il->_4965.stats.general.common; - dbg = &il->_4965.stats.general.common.dbg; - div = &il->_4965.stats.general.common.div; - accum_general = &il->_4965.accum_stats.general.common; - accum_dbg = &il->_4965.accum_stats.general.common.dbg; - accum_div = &il->_4965.accum_stats.general.common.div; - delta_general = &il->_4965.delta_stats.general.common; - max_general = &il->_4965.max_delta.general.common; - delta_dbg = &il->_4965.delta_stats.general.common.dbg; - max_dbg = &il->_4965.max_delta.general.common.dbg; - delta_div = &il->_4965.delta_stats.general.common.div; - max_div = &il->_4965.max_delta.general.common.div; - - pos += il4965_stats_flag(il, buf, bufsz); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_header, - "Statistics_General:"); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_value, "temperature:", - le32_to_cpu(general->temperature)); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_value, "ttl_timestamp:", - le32_to_cpu(general->ttl_timestamp)); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "burst_check:", - le32_to_cpu(dbg->burst_check), accum_dbg->burst_check, - delta_dbg->burst_check, max_dbg->burst_check); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "burst_count:", - le32_to_cpu(dbg->burst_count), accum_dbg->burst_count, - delta_dbg->burst_count, max_dbg->burst_count); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, - "wait_for_silence_timeout_count:", - le32_to_cpu(dbg->wait_for_silence_timeout_cnt), - accum_dbg->wait_for_silence_timeout_cnt, - delta_dbg->wait_for_silence_timeout_cnt, - max_dbg->wait_for_silence_timeout_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "sleep_time:", - le32_to_cpu(general->sleep_time), - accum_general->sleep_time, delta_general->sleep_time, - max_general->sleep_time); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "slots_out:", - le32_to_cpu(general->slots_out), accum_general->slots_out, - delta_general->slots_out, max_general->slots_out); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "slots_idle:", - le32_to_cpu(general->slots_idle), - accum_general->slots_idle, delta_general->slots_idle, - max_general->slots_idle); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "tx_on_a:", - le32_to_cpu(div->tx_on_a), accum_div->tx_on_a, - delta_div->tx_on_a, max_div->tx_on_a); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "tx_on_b:", - le32_to_cpu(div->tx_on_b), accum_div->tx_on_b, - delta_div->tx_on_b, max_div->tx_on_b); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "exec_time:", - le32_to_cpu(div->exec_time), accum_div->exec_time, - delta_div->exec_time, max_div->exec_time); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "probe_time:", - le32_to_cpu(div->probe_time), accum_div->probe_time, - delta_div->probe_time, max_div->probe_time); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "rx_enable_counter:", - le32_to_cpu(general->rx_enable_counter), - accum_general->rx_enable_counter, - delta_general->rx_enable_counter, - max_general->rx_enable_counter); - pos += - scnprintf(buf + pos, bufsz - pos, fmt_table, "num_of_sos_states:", - le32_to_cpu(general->num_of_sos_states), - accum_general->num_of_sos_states, - delta_general->num_of_sos_states, - max_general->num_of_sos_states); - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -const struct il_debugfs_ops il4965_debugfs_ops = { - .rx_stats_read = il4965_ucode_rx_stats_read, - .tx_stats_read = il4965_ucode_tx_stats_read, - .general_stats_read = il4965_ucode_general_stats_read, -}; diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c deleted file mode 100644 index d2586f09f45c..000000000000 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ /dev/null @@ -1,6864 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portions of the ieee80211 subsystem header files. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#define DRV_NAME "iwl4965" - -#include "common.h" -#include "4965.h" - -/****************************************************************************** - * - * module boiler plate - * - ******************************************************************************/ - -/* - * module name, copyright, version, etc. - */ -#define DRV_DESCRIPTION "Intel(R) Wireless WiFi 4965 driver for Linux" - -#ifdef CONFIG_IWLEGACY_DEBUG -#define VD "d" -#else -#define VD -#endif - -#define DRV_VERSION IWLWIFI_VERSION VD - -MODULE_DESCRIPTION(DRV_DESCRIPTION); -MODULE_VERSION(DRV_VERSION); -MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("iwl4965"); - -void -il4965_check_abort_status(struct il_priv *il, u8 frame_count, u32 status) -{ - if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) { - IL_ERR("Tx flush command to flush out all frames\n"); - if (!test_bit(S_EXIT_PENDING, &il->status)) - queue_work(il->workqueue, &il->tx_flush); - } -} - -/* - * EEPROM - */ -struct il_mod_params il4965_mod_params = { - .amsdu_size_8K = 1, - .restart_fw = 1, - /* the rest are 0 by default */ -}; - -void -il4965_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq) -{ - unsigned long flags; - int i; - spin_lock_irqsave(&rxq->lock, flags); - INIT_LIST_HEAD(&rxq->rx_free); - INIT_LIST_HEAD(&rxq->rx_used); - /* Fill the rx_used queue with _all_ of the Rx buffers */ - for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) { - /* In the reset function, these buffers may have been allocated - * to an SKB, so we need to unmap and free potential storage */ - if (rxq->pool[i].page != NULL) { - pci_unmap_page(il->pci_dev, rxq->pool[i].page_dma, - PAGE_SIZE << il->hw_params.rx_page_order, - PCI_DMA_FROMDEVICE); - __il_free_pages(il, rxq->pool[i].page); - rxq->pool[i].page = NULL; - } - list_add_tail(&rxq->pool[i].list, &rxq->rx_used); - } - - for (i = 0; i < RX_QUEUE_SIZE; i++) - rxq->queue[i] = NULL; - - /* Set us so that we have processed and used all buffers, but have - * not restocked the Rx queue with fresh buffers */ - rxq->read = rxq->write = 0; - rxq->write_actual = 0; - rxq->free_count = 0; - spin_unlock_irqrestore(&rxq->lock, flags); -} - -int -il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq) -{ - u32 rb_size; - const u32 rfdnlog = RX_QUEUE_SIZE_LOG; /* 256 RBDs */ - u32 rb_timeout = 0; - - if (il->cfg->mod_params->amsdu_size_8K) - rb_size = FH49_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K; - else - rb_size = FH49_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K; - - /* Stop Rx DMA */ - il_wr(il, FH49_MEM_RCSR_CHNL0_CONFIG_REG, 0); - - /* Reset driver's Rx queue write idx */ - il_wr(il, FH49_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); - - /* Tell device where to find RBD circular buffer in DRAM */ - il_wr(il, FH49_RSCSR_CHNL0_RBDCB_BASE_REG, (u32) (rxq->bd_dma >> 8)); - - /* Tell device where in DRAM to update its Rx status */ - il_wr(il, FH49_RSCSR_CHNL0_STTS_WPTR_REG, rxq->rb_stts_dma >> 4); - - /* Enable Rx DMA - * Direct rx interrupts to hosts - * Rx buffer size 4 or 8k - * RB timeout 0x10 - * 256 RBDs - */ - il_wr(il, FH49_MEM_RCSR_CHNL0_CONFIG_REG, - FH49_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | - FH49_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | - FH49_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK | - rb_size | - (rb_timeout << FH49_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS) | - (rfdnlog << FH49_RCSR_RX_CONFIG_RBDCB_SIZE_POS)); - - /* Set interrupt coalescing timer to default (2048 usecs) */ - il_write8(il, CSR_INT_COALESCING, IL_HOST_INT_TIMEOUT_DEF); - - return 0; -} - -static void -il4965_set_pwr_vmain(struct il_priv *il) -{ -/* - * (for documentation purposes) - * to set power to V_AUX, do: - - if (pci_pme_capable(il->pci_dev, PCI_D3cold)) - il_set_bits_mask_prph(il, APMG_PS_CTRL_REG, - APMG_PS_CTRL_VAL_PWR_SRC_VAUX, - ~APMG_PS_CTRL_MSK_PWR_SRC); - */ - - il_set_bits_mask_prph(il, APMG_PS_CTRL_REG, - APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, - ~APMG_PS_CTRL_MSK_PWR_SRC); -} - -int -il4965_hw_nic_init(struct il_priv *il) -{ - unsigned long flags; - struct il_rx_queue *rxq = &il->rxq; - int ret; - - spin_lock_irqsave(&il->lock, flags); - il_apm_init(il); - /* Set interrupt coalescing calibration timer to default (512 usecs) */ - il_write8(il, CSR_INT_COALESCING, IL_HOST_INT_CALIB_TIMEOUT_DEF); - spin_unlock_irqrestore(&il->lock, flags); - - il4965_set_pwr_vmain(il); - il4965_nic_config(il); - - /* Allocate the RX queue, or reset if it is already allocated */ - if (!rxq->bd) { - ret = il_rx_queue_alloc(il); - if (ret) { - IL_ERR("Unable to initialize Rx queue\n"); - return -ENOMEM; - } - } else - il4965_rx_queue_reset(il, rxq); - - il4965_rx_replenish(il); - - il4965_rx_init(il, rxq); - - spin_lock_irqsave(&il->lock, flags); - - rxq->need_update = 1; - il_rx_queue_update_write_ptr(il, rxq); - - spin_unlock_irqrestore(&il->lock, flags); - - /* Allocate or reset and init all Tx and Command queues */ - if (!il->txq) { - ret = il4965_txq_ctx_alloc(il); - if (ret) - return ret; - } else - il4965_txq_ctx_reset(il); - - set_bit(S_INIT, &il->status); - - return 0; -} - -/** - * il4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr - */ -static inline __le32 -il4965_dma_addr2rbd_ptr(struct il_priv *il, dma_addr_t dma_addr) -{ - return cpu_to_le32((u32) (dma_addr >> 8)); -} - -/** - * il4965_rx_queue_restock - refill RX queue from pre-allocated pool - * - * If there are slots in the RX queue that need to be restocked, - * and we have free pre-allocated buffers, fill the ranks as much - * as we can, pulling from rx_free. - * - * This moves the 'write' idx forward to catch up with 'processed', and - * also updates the memory address in the firmware to reference the new - * target buffer. - */ -void -il4965_rx_queue_restock(struct il_priv *il) -{ - struct il_rx_queue *rxq = &il->rxq; - struct list_head *element; - struct il_rx_buf *rxb; - unsigned long flags; - - spin_lock_irqsave(&rxq->lock, flags); - while (il_rx_queue_space(rxq) > 0 && rxq->free_count) { - /* The overwritten rxb must be a used one */ - rxb = rxq->queue[rxq->write]; - BUG_ON(rxb && rxb->page); - - /* Get next free Rx buffer, remove from free list */ - element = rxq->rx_free.next; - rxb = list_entry(element, struct il_rx_buf, list); - list_del(element); - - /* Point to Rx buffer via next RBD in circular buffer */ - rxq->bd[rxq->write] = - il4965_dma_addr2rbd_ptr(il, rxb->page_dma); - rxq->queue[rxq->write] = rxb; - rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; - rxq->free_count--; - } - spin_unlock_irqrestore(&rxq->lock, flags); - /* If the pre-allocated buffer pool is dropping low, schedule to - * refill it */ - if (rxq->free_count <= RX_LOW_WATERMARK) - queue_work(il->workqueue, &il->rx_replenish); - - /* If we've added more space for the firmware to place data, tell it. - * Increment device's write pointer in multiples of 8. */ - if (rxq->write_actual != (rxq->write & ~0x7)) { - spin_lock_irqsave(&rxq->lock, flags); - rxq->need_update = 1; - spin_unlock_irqrestore(&rxq->lock, flags); - il_rx_queue_update_write_ptr(il, rxq); - } -} - -/** - * il4965_rx_replenish - Move all used packet from rx_used to rx_free - * - * When moving to rx_free an SKB is allocated for the slot. - * - * Also restock the Rx queue via il_rx_queue_restock. - * This is called as a scheduled work item (except for during initialization) - */ -static void -il4965_rx_allocate(struct il_priv *il, gfp_t priority) -{ - struct il_rx_queue *rxq = &il->rxq; - struct list_head *element; - struct il_rx_buf *rxb; - struct page *page; - dma_addr_t page_dma; - unsigned long flags; - gfp_t gfp_mask = priority; - - while (1) { - spin_lock_irqsave(&rxq->lock, flags); - if (list_empty(&rxq->rx_used)) { - spin_unlock_irqrestore(&rxq->lock, flags); - return; - } - spin_unlock_irqrestore(&rxq->lock, flags); - - if (rxq->free_count > RX_LOW_WATERMARK) - gfp_mask |= __GFP_NOWARN; - - if (il->hw_params.rx_page_order > 0) - gfp_mask |= __GFP_COMP; - - /* Alloc a new receive buffer */ - page = alloc_pages(gfp_mask, il->hw_params.rx_page_order); - if (!page) { - if (net_ratelimit()) - D_INFO("alloc_pages failed, " "order: %d\n", - il->hw_params.rx_page_order); - - if (rxq->free_count <= RX_LOW_WATERMARK && - net_ratelimit()) - IL_ERR("Failed to alloc_pages with %s. " - "Only %u free buffers remaining.\n", - priority == - GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL", - rxq->free_count); - /* We don't reschedule replenish work here -- we will - * call the restock method and if it still needs - * more buffers it will schedule replenish */ - return; - } - - /* Get physical address of the RB */ - page_dma = - pci_map_page(il->pci_dev, page, 0, - PAGE_SIZE << il->hw_params.rx_page_order, - PCI_DMA_FROMDEVICE); - if (unlikely(pci_dma_mapping_error(il->pci_dev, page_dma))) { - __free_pages(page, il->hw_params.rx_page_order); - break; - } - - spin_lock_irqsave(&rxq->lock, flags); - - if (list_empty(&rxq->rx_used)) { - spin_unlock_irqrestore(&rxq->lock, flags); - pci_unmap_page(il->pci_dev, page_dma, - PAGE_SIZE << il->hw_params.rx_page_order, - PCI_DMA_FROMDEVICE); - __free_pages(page, il->hw_params.rx_page_order); - return; - } - - element = rxq->rx_used.next; - rxb = list_entry(element, struct il_rx_buf, list); - list_del(element); - - BUG_ON(rxb->page); - - rxb->page = page; - rxb->page_dma = page_dma; - list_add_tail(&rxb->list, &rxq->rx_free); - rxq->free_count++; - il->alloc_rxb_page++; - - spin_unlock_irqrestore(&rxq->lock, flags); - } -} - -void -il4965_rx_replenish(struct il_priv *il) -{ - unsigned long flags; - - il4965_rx_allocate(il, GFP_KERNEL); - - spin_lock_irqsave(&il->lock, flags); - il4965_rx_queue_restock(il); - spin_unlock_irqrestore(&il->lock, flags); -} - -void -il4965_rx_replenish_now(struct il_priv *il) -{ - il4965_rx_allocate(il, GFP_ATOMIC); - - il4965_rx_queue_restock(il); -} - -/* Assumes that the skb field of the buffers in 'pool' is kept accurate. - * If an SKB has been detached, the POOL needs to have its SKB set to NULL - * This free routine walks the list of POOL entries and if SKB is set to - * non NULL it is unmapped and freed - */ -void -il4965_rx_queue_free(struct il_priv *il, struct il_rx_queue *rxq) -{ - int i; - for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { - if (rxq->pool[i].page != NULL) { - pci_unmap_page(il->pci_dev, rxq->pool[i].page_dma, - PAGE_SIZE << il->hw_params.rx_page_order, - PCI_DMA_FROMDEVICE); - __il_free_pages(il, rxq->pool[i].page); - rxq->pool[i].page = NULL; - } - } - - dma_free_coherent(&il->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, - rxq->bd_dma); - dma_free_coherent(&il->pci_dev->dev, sizeof(struct il_rb_status), - rxq->rb_stts, rxq->rb_stts_dma); - rxq->bd = NULL; - rxq->rb_stts = NULL; -} - -int -il4965_rxq_stop(struct il_priv *il) -{ - int ret; - - _il_wr(il, FH49_MEM_RCSR_CHNL0_CONFIG_REG, 0); - ret = _il_poll_bit(il, FH49_MEM_RSSR_RX_STATUS_REG, - FH49_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, - FH49_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, - 1000); - if (ret < 0) - IL_ERR("Can't stop Rx DMA.\n"); - - return 0; -} - -int -il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band) -{ - int idx = 0; - int band_offset = 0; - - /* HT rate format: mac80211 wants an MCS number, which is just LSB */ - if (rate_n_flags & RATE_MCS_HT_MSK) { - idx = (rate_n_flags & 0xff); - return idx; - /* Legacy rate format, search for match in table */ - } else { - if (band == IEEE80211_BAND_5GHZ) - band_offset = IL_FIRST_OFDM_RATE; - for (idx = band_offset; idx < RATE_COUNT_LEGACY; idx++) - if (il_rates[idx].plcp == (rate_n_flags & 0xFF)) - return idx - band_offset; - } - - return -1; -} - -static int -il4965_calc_rssi(struct il_priv *il, struct il_rx_phy_res *rx_resp) -{ - /* data from PHY/DSP regarding signal strength, etc., - * contents are always there, not configurable by host. */ - struct il4965_rx_non_cfg_phy *ncphy = - (struct il4965_rx_non_cfg_phy *)rx_resp->non_cfg_phy_buf; - u32 agc = - (le16_to_cpu(ncphy->agc_info) & IL49_AGC_DB_MASK) >> - IL49_AGC_DB_POS; - - u32 valid_antennae = - (le16_to_cpu(rx_resp->phy_flags) & IL49_RX_PHY_FLAGS_ANTENNAE_MASK) - >> IL49_RX_PHY_FLAGS_ANTENNAE_OFFSET; - u8 max_rssi = 0; - u32 i; - - /* Find max rssi among 3 possible receivers. - * These values are measured by the digital signal processor (DSP). - * They should stay fairly constant even as the signal strength varies, - * if the radio's automatic gain control (AGC) is working right. - * AGC value (see below) will provide the "interesting" info. */ - for (i = 0; i < 3; i++) - if (valid_antennae & (1 << i)) - max_rssi = max(ncphy->rssi_info[i << 1], max_rssi); - - D_STATS("Rssi In A %d B %d C %d Max %d AGC dB %d\n", - ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4], - max_rssi, agc); - - /* dBm = max_rssi dB - agc dB - constant. - * Higher AGC (higher radio gain) means lower signal. */ - return max_rssi - agc - IL4965_RSSI_OFFSET; -} - -static u32 -il4965_translate_rx_status(struct il_priv *il, u32 decrypt_in) -{ - u32 decrypt_out = 0; - - if ((decrypt_in & RX_RES_STATUS_STATION_FOUND) == - RX_RES_STATUS_STATION_FOUND) - decrypt_out |= - (RX_RES_STATUS_STATION_FOUND | - RX_RES_STATUS_NO_STATION_INFO_MISMATCH); - - decrypt_out |= (decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK); - - /* packet was not encrypted */ - if ((decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK) == - RX_RES_STATUS_SEC_TYPE_NONE) - return decrypt_out; - - /* packet was encrypted with unknown alg */ - if ((decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK) == - RX_RES_STATUS_SEC_TYPE_ERR) - return decrypt_out; - - /* decryption was not done in HW */ - if ((decrypt_in & RX_MPDU_RES_STATUS_DEC_DONE_MSK) != - RX_MPDU_RES_STATUS_DEC_DONE_MSK) - return decrypt_out; - - switch (decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK) { - - case RX_RES_STATUS_SEC_TYPE_CCMP: - /* alg is CCM: check MIC only */ - if (!(decrypt_in & RX_MPDU_RES_STATUS_MIC_OK)) - /* Bad MIC */ - decrypt_out |= RX_RES_STATUS_BAD_ICV_MIC; - else - decrypt_out |= RX_RES_STATUS_DECRYPT_OK; - - break; - - case RX_RES_STATUS_SEC_TYPE_TKIP: - if (!(decrypt_in & RX_MPDU_RES_STATUS_TTAK_OK)) { - /* Bad TTAK */ - decrypt_out |= RX_RES_STATUS_BAD_KEY_TTAK; - break; - } - /* fall through if TTAK OK */ - default: - if (!(decrypt_in & RX_MPDU_RES_STATUS_ICV_OK)) - decrypt_out |= RX_RES_STATUS_BAD_ICV_MIC; - else - decrypt_out |= RX_RES_STATUS_DECRYPT_OK; - break; - } - - D_RX("decrypt_in:0x%x decrypt_out = 0x%x\n", decrypt_in, decrypt_out); - - return decrypt_out; -} - -#define SMALL_PACKET_SIZE 256 - -static void -il4965_pass_packet_to_mac80211(struct il_priv *il, struct ieee80211_hdr *hdr, - u32 len, u32 ampdu_status, struct il_rx_buf *rxb, - struct ieee80211_rx_status *stats) -{ - struct sk_buff *skb; - __le16 fc = hdr->frame_control; - - /* We only process data packets if the interface is open */ - if (unlikely(!il->is_open)) { - D_DROP("Dropping packet while interface is not open.\n"); - return; - } - - /* In case of HW accelerated crypto and bad decryption, drop */ - if (!il->cfg->mod_params->sw_crypto && - il_set_decrypted_flag(il, hdr, ampdu_status, stats)) - return; - - skb = dev_alloc_skb(SMALL_PACKET_SIZE); - if (!skb) { - IL_ERR("dev_alloc_skb failed\n"); - return; - } - - if (len <= SMALL_PACKET_SIZE) { - memcpy(skb_put(skb, len), hdr, len); - } else { - skb_add_rx_frag(skb, 0, rxb->page, (void *)hdr - rxb_addr(rxb), - len, PAGE_SIZE << il->hw_params.rx_page_order); - il->alloc_rxb_page--; - rxb->page = NULL; - } - - il_update_stats(il, false, fc, len); - memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); - - ieee80211_rx(il->hw, skb); -} - -/* Called for N_RX (legacy ABG frames), or - * N_RX_MPDU (HT high-throughput N frames). */ -static void -il4965_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct ieee80211_hdr *header; - struct ieee80211_rx_status rx_status = {}; - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il_rx_phy_res *phy_res; - __le32 rx_pkt_status; - struct il_rx_mpdu_res_start *amsdu; - u32 len; - u32 ampdu_status; - u32 rate_n_flags; - - /** - * N_RX and N_RX_MPDU are handled differently. - * N_RX: physical layer info is in this buffer - * N_RX_MPDU: physical layer info was sent in separate - * command and cached in il->last_phy_res - * - * Here we set up local variables depending on which command is - * received. - */ - if (pkt->hdr.cmd == N_RX) { - phy_res = (struct il_rx_phy_res *)pkt->u.raw; - header = - (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*phy_res) + - phy_res->cfg_phy_cnt); - - len = le16_to_cpu(phy_res->byte_count); - rx_pkt_status = - *(__le32 *) (pkt->u.raw + sizeof(*phy_res) + - phy_res->cfg_phy_cnt + len); - ampdu_status = le32_to_cpu(rx_pkt_status); - } else { - if (!il->_4965.last_phy_res_valid) { - IL_ERR("MPDU frame without cached PHY data\n"); - return; - } - phy_res = &il->_4965.last_phy_res; - amsdu = (struct il_rx_mpdu_res_start *)pkt->u.raw; - header = (struct ieee80211_hdr *)(pkt->u.raw + sizeof(*amsdu)); - len = le16_to_cpu(amsdu->byte_count); - rx_pkt_status = *(__le32 *) (pkt->u.raw + sizeof(*amsdu) + len); - ampdu_status = - il4965_translate_rx_status(il, le32_to_cpu(rx_pkt_status)); - } - - if ((unlikely(phy_res->cfg_phy_cnt > 20))) { - D_DROP("dsp size out of range [0,20]: %d/n", - phy_res->cfg_phy_cnt); - return; - } - - if (!(rx_pkt_status & RX_RES_STATUS_NO_CRC32_ERROR) || - !(rx_pkt_status & RX_RES_STATUS_NO_RXE_OVERFLOW)) { - D_RX("Bad CRC or FIFO: 0x%08X.\n", le32_to_cpu(rx_pkt_status)); - return; - } - - /* This will be used in several places later */ - rate_n_flags = le32_to_cpu(phy_res->rate_n_flags); - - /* rx_status carries information about the packet to mac80211 */ - rx_status.mactime = le64_to_cpu(phy_res->timestamp); - rx_status.band = - (phy_res-> - phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? IEEE80211_BAND_2GHZ : - IEEE80211_BAND_5GHZ; - rx_status.freq = - ieee80211_channel_to_frequency(le16_to_cpu(phy_res->channel), - rx_status.band); - rx_status.rate_idx = - il4965_hwrate_to_mac80211_idx(rate_n_flags, rx_status.band); - rx_status.flag = 0; - - /* TSF isn't reliable. In order to allow smooth user experience, - * this W/A doesn't propagate it to the mac80211 */ - /*rx_status.flag |= RX_FLAG_MACTIME_START; */ - - il->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp); - - /* Find max signal strength (dBm) among 3 antenna/receiver chains */ - rx_status.signal = il4965_calc_rssi(il, phy_res); - - D_STATS("Rssi %d, TSF %llu\n", rx_status.signal, - (unsigned long long)rx_status.mactime); - - /* - * "antenna number" - * - * It seems that the antenna field in the phy flags value - * is actually a bit field. This is undefined by radiotap, - * it wants an actual antenna number but I always get "7" - * for most legacy frames I receive indicating that the - * same frame was received on all three RX chains. - * - * I think this field should be removed in favor of a - * new 802.11n radiotap field "RX chains" that is defined - * as a bitmask. - */ - rx_status.antenna = - (le16_to_cpu(phy_res->phy_flags) & RX_RES_PHY_FLAGS_ANTENNA_MSK) >> - RX_RES_PHY_FLAGS_ANTENNA_POS; - - /* set the preamble flag if appropriate */ - if (phy_res->phy_flags & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) - rx_status.flag |= RX_FLAG_SHORTPRE; - - /* Set up the HT phy flags */ - if (rate_n_flags & RATE_MCS_HT_MSK) - rx_status.flag |= RX_FLAG_HT; - if (rate_n_flags & RATE_MCS_HT40_MSK) - rx_status.flag |= RX_FLAG_40MHZ; - if (rate_n_flags & RATE_MCS_SGI_MSK) - rx_status.flag |= RX_FLAG_SHORT_GI; - - if (phy_res->phy_flags & RX_RES_PHY_FLAGS_AGG_MSK) { - /* We know which subframes of an A-MPDU belong - * together since we get a single PHY response - * from the firmware for all of them. - */ - - rx_status.flag |= RX_FLAG_AMPDU_DETAILS; - rx_status.ampdu_reference = il->_4965.ampdu_ref; - } - - il4965_pass_packet_to_mac80211(il, header, len, ampdu_status, rxb, - &rx_status); -} - -/* Cache phy data (Rx signal strength, etc) for HT frame (N_RX_PHY). - * This will be used later in il_hdl_rx() for N_RX_MPDU. */ -static void -il4965_hdl_rx_phy(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - il->_4965.last_phy_res_valid = true; - il->_4965.ampdu_ref++; - memcpy(&il->_4965.last_phy_res, pkt->u.raw, - sizeof(struct il_rx_phy_res)); -} - -static int -il4965_get_channels_for_scan(struct il_priv *il, struct ieee80211_vif *vif, - enum ieee80211_band band, u8 is_active, - u8 n_probes, struct il_scan_channel *scan_ch) -{ - struct ieee80211_channel *chan; - const struct ieee80211_supported_band *sband; - const struct il_channel_info *ch_info; - u16 passive_dwell = 0; - u16 active_dwell = 0; - int added, i; - u16 channel; - - sband = il_get_hw_mode(il, band); - if (!sband) - return 0; - - active_dwell = il_get_active_dwell_time(il, band, n_probes); - passive_dwell = il_get_passive_dwell_time(il, band, vif); - - if (passive_dwell <= active_dwell) - passive_dwell = active_dwell + 1; - - for (i = 0, added = 0; i < il->scan_request->n_channels; i++) { - chan = il->scan_request->channels[i]; - - if (chan->band != band) - continue; - - channel = chan->hw_value; - scan_ch->channel = cpu_to_le16(channel); - - ch_info = il_get_channel_info(il, band, channel); - if (!il_is_channel_valid(ch_info)) { - D_SCAN("Channel %d is INVALID for this band.\n", - channel); - continue; - } - - if (!is_active || il_is_channel_passive(ch_info) || - (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)) - scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; - else - scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE; - - if (n_probes) - scan_ch->type |= IL_SCAN_PROBE_MASK(n_probes); - - scan_ch->active_dwell = cpu_to_le16(active_dwell); - scan_ch->passive_dwell = cpu_to_le16(passive_dwell); - - /* Set txpower levels to defaults */ - scan_ch->dsp_atten = 110; - - /* NOTE: if we were doing 6Mb OFDM for scans we'd use - * power level: - * scan_ch->tx_gain = ((1 << 5) | (2 << 3)) | 3; - */ - if (band == IEEE80211_BAND_5GHZ) - scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3; - else - scan_ch->tx_gain = ((1 << 5) | (5 << 3)); - - D_SCAN("Scanning ch=%d prob=0x%X [%s %d]\n", channel, - le32_to_cpu(scan_ch->type), - (scan_ch-> - type & SCAN_CHANNEL_TYPE_ACTIVE) ? "ACTIVE" : "PASSIVE", - (scan_ch-> - type & SCAN_CHANNEL_TYPE_ACTIVE) ? active_dwell : - passive_dwell); - - scan_ch++; - added++; - } - - D_SCAN("total channels to scan %d\n", added); - return added; -} - -static void -il4965_toggle_tx_ant(struct il_priv *il, u8 *ant, u8 valid) -{ - int i; - u8 ind = *ant; - - for (i = 0; i < RATE_ANT_NUM - 1; i++) { - ind = (ind + 1) < RATE_ANT_NUM ? ind + 1 : 0; - if (valid & BIT(ind)) { - *ant = ind; - return; - } - } -} - -int -il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif) -{ - struct il_host_cmd cmd = { - .id = C_SCAN, - .len = sizeof(struct il_scan_cmd), - .flags = CMD_SIZE_HUGE, - }; - struct il_scan_cmd *scan; - u32 rate_flags = 0; - u16 cmd_len; - u16 rx_chain = 0; - enum ieee80211_band band; - u8 n_probes = 0; - u8 rx_ant = il->hw_params.valid_rx_ant; - u8 rate; - bool is_active = false; - int chan_mod; - u8 active_chains; - u8 scan_tx_antennas = il->hw_params.valid_tx_ant; - int ret; - - lockdep_assert_held(&il->mutex); - - if (!il->scan_cmd) { - il->scan_cmd = - kmalloc(sizeof(struct il_scan_cmd) + IL_MAX_SCAN_SIZE, - GFP_KERNEL); - if (!il->scan_cmd) { - D_SCAN("fail to allocate memory for scan\n"); - return -ENOMEM; - } - } - scan = il->scan_cmd; - memset(scan, 0, sizeof(struct il_scan_cmd) + IL_MAX_SCAN_SIZE); - - scan->quiet_plcp_th = IL_PLCP_QUIET_THRESH; - scan->quiet_time = IL_ACTIVE_QUIET_TIME; - - if (il_is_any_associated(il)) { - u16 interval; - u32 extra; - u32 suspend_time = 100; - u32 scan_suspend_time = 100; - - D_INFO("Scanning while associated...\n"); - interval = vif->bss_conf.beacon_int; - - scan->suspend_time = 0; - scan->max_out_time = cpu_to_le32(200 * 1024); - if (!interval) - interval = suspend_time; - - extra = (suspend_time / interval) << 22; - scan_suspend_time = - (extra | ((suspend_time % interval) * 1024)); - scan->suspend_time = cpu_to_le32(scan_suspend_time); - D_SCAN("suspend_time 0x%X beacon interval %d\n", - scan_suspend_time, interval); - } - - if (il->scan_request->n_ssids) { - int i, p = 0; - D_SCAN("Kicking off active scan\n"); - for (i = 0; i < il->scan_request->n_ssids; i++) { - /* always does wildcard anyway */ - if (!il->scan_request->ssids[i].ssid_len) - continue; - scan->direct_scan[p].id = WLAN_EID_SSID; - scan->direct_scan[p].len = - il->scan_request->ssids[i].ssid_len; - memcpy(scan->direct_scan[p].ssid, - il->scan_request->ssids[i].ssid, - il->scan_request->ssids[i].ssid_len); - n_probes++; - p++; - } - is_active = true; - } else - D_SCAN("Start passive scan.\n"); - - scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; - scan->tx_cmd.sta_id = il->hw_params.bcast_id; - scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; - - switch (il->scan_band) { - case IEEE80211_BAND_2GHZ: - scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; - chan_mod = - le32_to_cpu(il->active.flags & RXON_FLG_CHANNEL_MODE_MSK) >> - RXON_FLG_CHANNEL_MODE_POS; - if (chan_mod == CHANNEL_MODE_PURE_40) { - rate = RATE_6M_PLCP; - } else { - rate = RATE_1M_PLCP; - rate_flags = RATE_MCS_CCK_MSK; - } - break; - case IEEE80211_BAND_5GHZ: - rate = RATE_6M_PLCP; - break; - default: - IL_WARN("Invalid scan band\n"); - return -EIO; - } - - /* - * If active scanning is requested but a certain channel is - * marked passive, we can do active scanning if we detect - * transmissions. - * - * There is an issue with some firmware versions that triggers - * a sysassert on a "good CRC threshold" of zero (== disabled), - * on a radar channel even though this means that we should NOT - * send probes. - * - * The "good CRC threshold" is the number of frames that we - * need to receive during our dwell time on a channel before - * sending out probes -- setting this to a huge value will - * mean we never reach it, but at the same time work around - * the aforementioned issue. Thus use IL_GOOD_CRC_TH_NEVER - * here instead of IL_GOOD_CRC_TH_DISABLED. - */ - scan->good_CRC_th = - is_active ? IL_GOOD_CRC_TH_DEFAULT : IL_GOOD_CRC_TH_NEVER; - - band = il->scan_band; - - if (il->cfg->scan_rx_antennas[band]) - rx_ant = il->cfg->scan_rx_antennas[band]; - - il4965_toggle_tx_ant(il, &il->scan_tx_ant[band], scan_tx_antennas); - rate_flags |= BIT(il->scan_tx_ant[band]) << RATE_MCS_ANT_POS; - scan->tx_cmd.rate_n_flags = cpu_to_le32(rate | rate_flags); - - /* In power save mode use one chain, otherwise use all chains */ - if (test_bit(S_POWER_PMI, &il->status)) { - /* rx_ant has been set to all valid chains previously */ - active_chains = - rx_ant & ((u8) (il->chain_noise_data.active_chains)); - if (!active_chains) - active_chains = rx_ant; - - D_SCAN("chain_noise_data.active_chains: %u\n", - il->chain_noise_data.active_chains); - - rx_ant = il4965_first_antenna(active_chains); - } - - /* MIMO is not used here, but value is required */ - rx_chain |= il->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS; - rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS; - rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS; - rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS; - scan->rx_chain = cpu_to_le16(rx_chain); - - cmd_len = - il_fill_probe_req(il, (struct ieee80211_mgmt *)scan->data, - vif->addr, il->scan_request->ie, - il->scan_request->ie_len, - IL_MAX_SCAN_SIZE - sizeof(*scan)); - scan->tx_cmd.len = cpu_to_le16(cmd_len); - - scan->filter_flags |= - (RXON_FILTER_ACCEPT_GRP_MSK | RXON_FILTER_BCON_AWARE_MSK); - - scan->channel_count = - il4965_get_channels_for_scan(il, vif, band, is_active, n_probes, - (void *)&scan->data[cmd_len]); - if (scan->channel_count == 0) { - D_SCAN("channel count %d\n", scan->channel_count); - return -EIO; - } - - cmd.len += - le16_to_cpu(scan->tx_cmd.len) + - scan->channel_count * sizeof(struct il_scan_channel); - cmd.data = scan; - scan->len = cpu_to_le16(cmd.len); - - set_bit(S_SCAN_HW, &il->status); - - ret = il_send_cmd_sync(il, &cmd); - if (ret) - clear_bit(S_SCAN_HW, &il->status); - - return ret; -} - -int -il4965_manage_ibss_station(struct il_priv *il, struct ieee80211_vif *vif, - bool add) -{ - struct il_vif_priv *vif_priv = (void *)vif->drv_priv; - - if (add) - return il4965_add_bssid_station(il, vif->bss_conf.bssid, - &vif_priv->ibss_bssid_sta_id); - return il_remove_station(il, vif_priv->ibss_bssid_sta_id, - vif->bss_conf.bssid); -} - -void -il4965_free_tfds_in_queue(struct il_priv *il, int sta_id, int tid, int freed) -{ - lockdep_assert_held(&il->sta_lock); - - if (il->stations[sta_id].tid[tid].tfds_in_queue >= freed) - il->stations[sta_id].tid[tid].tfds_in_queue -= freed; - else { - D_TX("free more than tfds_in_queue (%u:%d)\n", - il->stations[sta_id].tid[tid].tfds_in_queue, freed); - il->stations[sta_id].tid[tid].tfds_in_queue = 0; - } -} - -#define IL_TX_QUEUE_MSK 0xfffff - -static bool -il4965_is_single_rx_stream(struct il_priv *il) -{ - return il->current_ht_config.smps == IEEE80211_SMPS_STATIC || - il->current_ht_config.single_chain_sufficient; -} - -#define IL_NUM_RX_CHAINS_MULTIPLE 3 -#define IL_NUM_RX_CHAINS_SINGLE 2 -#define IL_NUM_IDLE_CHAINS_DUAL 2 -#define IL_NUM_IDLE_CHAINS_SINGLE 1 - -/* - * Determine how many receiver/antenna chains to use. - * - * More provides better reception via diversity. Fewer saves power - * at the expense of throughput, but only when not in powersave to - * start with. - * - * MIMO (dual stream) requires at least 2, but works better with 3. - * This does not determine *which* chains to use, just how many. - */ -static int -il4965_get_active_rx_chain_count(struct il_priv *il) -{ - /* # of Rx chains to use when expecting MIMO. */ - if (il4965_is_single_rx_stream(il)) - return IL_NUM_RX_CHAINS_SINGLE; - else - return IL_NUM_RX_CHAINS_MULTIPLE; -} - -/* - * When we are in power saving mode, unless device support spatial - * multiplexing power save, use the active count for rx chain count. - */ -static int -il4965_get_idle_rx_chain_count(struct il_priv *il, int active_cnt) -{ - /* # Rx chains when idling, depending on SMPS mode */ - switch (il->current_ht_config.smps) { - case IEEE80211_SMPS_STATIC: - case IEEE80211_SMPS_DYNAMIC: - return IL_NUM_IDLE_CHAINS_SINGLE; - case IEEE80211_SMPS_OFF: - return active_cnt; - default: - WARN(1, "invalid SMPS mode %d", il->current_ht_config.smps); - return active_cnt; - } -} - -/* up to 4 chains */ -static u8 -il4965_count_chain_bitmap(u32 chain_bitmap) -{ - u8 res; - res = (chain_bitmap & BIT(0)) >> 0; - res += (chain_bitmap & BIT(1)) >> 1; - res += (chain_bitmap & BIT(2)) >> 2; - res += (chain_bitmap & BIT(3)) >> 3; - return res; -} - -/** - * il4965_set_rxon_chain - Set up Rx chain usage in "staging" RXON image - * - * Selects how many and which Rx receivers/antennas/chains to use. - * This should not be used for scan command ... it puts data in wrong place. - */ -void -il4965_set_rxon_chain(struct il_priv *il) -{ - bool is_single = il4965_is_single_rx_stream(il); - bool is_cam = !test_bit(S_POWER_PMI, &il->status); - u8 idle_rx_cnt, active_rx_cnt, valid_rx_cnt; - u32 active_chains; - u16 rx_chain; - - /* Tell uCode which antennas are actually connected. - * Before first association, we assume all antennas are connected. - * Just after first association, il4965_chain_noise_calibration() - * checks which antennas actually *are* connected. */ - if (il->chain_noise_data.active_chains) - active_chains = il->chain_noise_data.active_chains; - else - active_chains = il->hw_params.valid_rx_ant; - - rx_chain = active_chains << RXON_RX_CHAIN_VALID_POS; - - /* How many receivers should we use? */ - active_rx_cnt = il4965_get_active_rx_chain_count(il); - idle_rx_cnt = il4965_get_idle_rx_chain_count(il, active_rx_cnt); - - /* correct rx chain count according hw settings - * and chain noise calibration - */ - valid_rx_cnt = il4965_count_chain_bitmap(active_chains); - if (valid_rx_cnt < active_rx_cnt) - active_rx_cnt = valid_rx_cnt; - - if (valid_rx_cnt < idle_rx_cnt) - idle_rx_cnt = valid_rx_cnt; - - rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS; - rx_chain |= idle_rx_cnt << RXON_RX_CHAIN_CNT_POS; - - il->staging.rx_chain = cpu_to_le16(rx_chain); - - if (!is_single && active_rx_cnt >= IL_NUM_RX_CHAINS_SINGLE && is_cam) - il->staging.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; - else - il->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; - - D_ASSOC("rx_chain=0x%X active=%d idle=%d\n", il->staging.rx_chain, - active_rx_cnt, idle_rx_cnt); - - WARN_ON(active_rx_cnt == 0 || idle_rx_cnt == 0 || - active_rx_cnt < idle_rx_cnt); -} - -static const char * -il4965_get_fh_string(int cmd) -{ - switch (cmd) { - IL_CMD(FH49_RSCSR_CHNL0_STTS_WPTR_REG); - IL_CMD(FH49_RSCSR_CHNL0_RBDCB_BASE_REG); - IL_CMD(FH49_RSCSR_CHNL0_WPTR); - IL_CMD(FH49_MEM_RCSR_CHNL0_CONFIG_REG); - IL_CMD(FH49_MEM_RSSR_SHARED_CTRL_REG); - IL_CMD(FH49_MEM_RSSR_RX_STATUS_REG); - IL_CMD(FH49_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV); - IL_CMD(FH49_TSSR_TX_STATUS_REG); - IL_CMD(FH49_TSSR_TX_ERROR_REG); - default: - return "UNKNOWN"; - } -} - -int -il4965_dump_fh(struct il_priv *il, char **buf, bool display) -{ - int i; -#ifdef CONFIG_IWLEGACY_DEBUG - int pos = 0; - size_t bufsz = 0; -#endif - static const u32 fh_tbl[] = { - FH49_RSCSR_CHNL0_STTS_WPTR_REG, - FH49_RSCSR_CHNL0_RBDCB_BASE_REG, - FH49_RSCSR_CHNL0_WPTR, - FH49_MEM_RCSR_CHNL0_CONFIG_REG, - FH49_MEM_RSSR_SHARED_CTRL_REG, - FH49_MEM_RSSR_RX_STATUS_REG, - FH49_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV, - FH49_TSSR_TX_STATUS_REG, - FH49_TSSR_TX_ERROR_REG - }; -#ifdef CONFIG_IWLEGACY_DEBUG - if (display) { - bufsz = ARRAY_SIZE(fh_tbl) * 48 + 40; - *buf = kmalloc(bufsz, GFP_KERNEL); - if (!*buf) - return -ENOMEM; - pos += - scnprintf(*buf + pos, bufsz - pos, "FH register values:\n"); - for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) { - pos += - scnprintf(*buf + pos, bufsz - pos, - " %34s: 0X%08x\n", - il4965_get_fh_string(fh_tbl[i]), - il_rd(il, fh_tbl[i])); - } - return pos; - } -#endif - IL_ERR("FH register values:\n"); - for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) { - IL_ERR(" %34s: 0X%08x\n", il4965_get_fh_string(fh_tbl[i]), - il_rd(il, fh_tbl[i])); - } - return 0; -} - -static void -il4965_hdl_missed_beacon(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il_missed_beacon_notif *missed_beacon; - - missed_beacon = &pkt->u.missed_beacon; - if (le32_to_cpu(missed_beacon->consecutive_missed_beacons) > - il->missed_beacon_threshold) { - D_CALIB("missed bcn cnsq %d totl %d rcd %d expctd %d\n", - le32_to_cpu(missed_beacon->consecutive_missed_beacons), - le32_to_cpu(missed_beacon->total_missed_becons), - le32_to_cpu(missed_beacon->num_recvd_beacons), - le32_to_cpu(missed_beacon->num_expected_beacons)); - if (!test_bit(S_SCANNING, &il->status)) - il4965_init_sensitivity(il); - } -} - -/* Calculate noise level, based on measurements during network silence just - * before arriving beacon. This measurement can be done only if we know - * exactly when to expect beacons, therefore only when we're associated. */ -static void -il4965_rx_calc_noise(struct il_priv *il) -{ - struct stats_rx_non_phy *rx_info; - int num_active_rx = 0; - int total_silence = 0; - int bcn_silence_a, bcn_silence_b, bcn_silence_c; - int last_rx_noise; - - rx_info = &(il->_4965.stats.rx.general); - bcn_silence_a = - le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER; - bcn_silence_b = - le32_to_cpu(rx_info->beacon_silence_rssi_b) & IN_BAND_FILTER; - bcn_silence_c = - le32_to_cpu(rx_info->beacon_silence_rssi_c) & IN_BAND_FILTER; - - if (bcn_silence_a) { - total_silence += bcn_silence_a; - num_active_rx++; - } - if (bcn_silence_b) { - total_silence += bcn_silence_b; - num_active_rx++; - } - if (bcn_silence_c) { - total_silence += bcn_silence_c; - num_active_rx++; - } - - /* Average among active antennas */ - if (num_active_rx) - last_rx_noise = (total_silence / num_active_rx) - 107; - else - last_rx_noise = IL_NOISE_MEAS_NOT_AVAILABLE; - - D_CALIB("inband silence a %u, b %u, c %u, dBm %d\n", bcn_silence_a, - bcn_silence_b, bcn_silence_c, last_rx_noise); -} - -#ifdef CONFIG_IWLEGACY_DEBUGFS -/* - * based on the assumption of all stats counter are in DWORD - * FIXME: This function is for debugging, do not deal with - * the case of counters roll-over. - */ -static void -il4965_accumulative_stats(struct il_priv *il, __le32 * stats) -{ - int i, size; - __le32 *prev_stats; - u32 *accum_stats; - u32 *delta, *max_delta; - struct stats_general_common *general, *accum_general; - struct stats_tx *tx, *accum_tx; - - prev_stats = (__le32 *) &il->_4965.stats; - accum_stats = (u32 *) &il->_4965.accum_stats; - size = sizeof(struct il_notif_stats); - general = &il->_4965.stats.general.common; - accum_general = &il->_4965.accum_stats.general.common; - tx = &il->_4965.stats.tx; - accum_tx = &il->_4965.accum_stats.tx; - delta = (u32 *) &il->_4965.delta_stats; - max_delta = (u32 *) &il->_4965.max_delta; - - for (i = sizeof(__le32); i < size; - i += - sizeof(__le32), stats++, prev_stats++, delta++, max_delta++, - accum_stats++) { - if (le32_to_cpu(*stats) > le32_to_cpu(*prev_stats)) { - *delta = - (le32_to_cpu(*stats) - le32_to_cpu(*prev_stats)); - *accum_stats += *delta; - if (*delta > *max_delta) - *max_delta = *delta; - } - } - - /* reset accumulative stats for "no-counter" type stats */ - accum_general->temperature = general->temperature; - accum_general->ttl_timestamp = general->ttl_timestamp; -} -#endif - -static void -il4965_hdl_stats(struct il_priv *il, struct il_rx_buf *rxb) -{ - const int recalib_seconds = 60; - bool change; - struct il_rx_pkt *pkt = rxb_addr(rxb); - - D_RX("Statistics notification received (%d vs %d).\n", - (int)sizeof(struct il_notif_stats), - le32_to_cpu(pkt->len_n_flags) & IL_RX_FRAME_SIZE_MSK); - - change = - ((il->_4965.stats.general.common.temperature != - pkt->u.stats.general.common.temperature) || - ((il->_4965.stats.flag & STATS_REPLY_FLG_HT40_MODE_MSK) != - (pkt->u.stats.flag & STATS_REPLY_FLG_HT40_MODE_MSK))); -#ifdef CONFIG_IWLEGACY_DEBUGFS - il4965_accumulative_stats(il, (__le32 *) &pkt->u.stats); -#endif - - /* TODO: reading some of stats is unneeded */ - memcpy(&il->_4965.stats, &pkt->u.stats, sizeof(il->_4965.stats)); - - set_bit(S_STATS, &il->status); - - /* - * Reschedule the stats timer to occur in recalib_seconds to ensure - * we get a thermal update even if the uCode doesn't give us one - */ - mod_timer(&il->stats_periodic, - jiffies + msecs_to_jiffies(recalib_seconds * 1000)); - - if (unlikely(!test_bit(S_SCANNING, &il->status)) && - (pkt->hdr.cmd == N_STATS)) { - il4965_rx_calc_noise(il); - queue_work(il->workqueue, &il->run_time_calib_work); - } - - if (change) - il4965_temperature_calib(il); -} - -static void -il4965_hdl_c_stats(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - - if (le32_to_cpu(pkt->u.stats.flag) & UCODE_STATS_CLEAR_MSK) { -#ifdef CONFIG_IWLEGACY_DEBUGFS - memset(&il->_4965.accum_stats, 0, - sizeof(struct il_notif_stats)); - memset(&il->_4965.delta_stats, 0, - sizeof(struct il_notif_stats)); - memset(&il->_4965.max_delta, 0, sizeof(struct il_notif_stats)); -#endif - D_RX("Statistics have been cleared\n"); - } - il4965_hdl_stats(il, rxb); -} - - -/* - * mac80211 queues, ACs, hardware queues, FIFOs. - * - * Cf. http://wireless.kernel.org/en/developers/Documentation/mac80211/queues - * - * Mac80211 uses the following numbers, which we get as from it - * by way of skb_get_queue_mapping(skb): - * - * VO 0 - * VI 1 - * BE 2 - * BK 3 - * - * - * Regular (not A-MPDU) frames are put into hardware queues corresponding - * to the FIFOs, see comments in iwl-prph.h. Aggregated frames get their - * own queue per aggregation session (RA/TID combination), such queues are - * set up to map into FIFOs too, for which we need an AC->FIFO mapping. In - * order to map frames to the right queue, we also need an AC->hw queue - * mapping. This is implemented here. - * - * Due to the way hw queues are set up (by the hw specific modules like - * 4965.c), the AC->hw queue mapping is the identity - * mapping. - */ - -static const u8 tid_to_ac[] = { - IEEE80211_AC_BE, - IEEE80211_AC_BK, - IEEE80211_AC_BK, - IEEE80211_AC_BE, - IEEE80211_AC_VI, - IEEE80211_AC_VI, - IEEE80211_AC_VO, - IEEE80211_AC_VO -}; - -static inline int -il4965_get_ac_from_tid(u16 tid) -{ - if (likely(tid < ARRAY_SIZE(tid_to_ac))) - return tid_to_ac[tid]; - - /* no support for TIDs 8-15 yet */ - return -EINVAL; -} - -static inline int -il4965_get_fifo_from_tid(u16 tid) -{ - const u8 ac_to_fifo[] = { - IL_TX_FIFO_VO, - IL_TX_FIFO_VI, - IL_TX_FIFO_BE, - IL_TX_FIFO_BK, - }; - - if (likely(tid < ARRAY_SIZE(tid_to_ac))) - return ac_to_fifo[tid_to_ac[tid]]; - - /* no support for TIDs 8-15 yet */ - return -EINVAL; -} - -/* - * handle build C_TX command notification. - */ -static void -il4965_tx_cmd_build_basic(struct il_priv *il, struct sk_buff *skb, - struct il_tx_cmd *tx_cmd, - struct ieee80211_tx_info *info, - struct ieee80211_hdr *hdr, u8 std_id) -{ - __le16 fc = hdr->frame_control; - __le32 tx_flags = tx_cmd->tx_flags; - - tx_cmd->stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; - if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { - tx_flags |= TX_CMD_FLG_ACK_MSK; - if (ieee80211_is_mgmt(fc)) - tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; - if (ieee80211_is_probe_resp(fc) && - !(le16_to_cpu(hdr->seq_ctrl) & 0xf)) - tx_flags |= TX_CMD_FLG_TSF_MSK; - } else { - tx_flags &= (~TX_CMD_FLG_ACK_MSK); - tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; - } - - if (ieee80211_is_back_req(fc)) - tx_flags |= TX_CMD_FLG_ACK_MSK | TX_CMD_FLG_IMM_BA_RSP_MASK; - - tx_cmd->sta_id = std_id; - if (ieee80211_has_morefrags(fc)) - tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK; - - if (ieee80211_is_data_qos(fc)) { - u8 *qc = ieee80211_get_qos_ctl(hdr); - tx_cmd->tid_tspec = qc[0] & 0xf; - tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK; - } else { - tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; - } - - il_tx_cmd_protection(il, info, fc, &tx_flags); - - tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); - if (ieee80211_is_mgmt(fc)) { - if (ieee80211_is_assoc_req(fc) || ieee80211_is_reassoc_req(fc)) - tx_cmd->timeout.pm_frame_timeout = cpu_to_le16(3); - else - tx_cmd->timeout.pm_frame_timeout = cpu_to_le16(2); - } else { - tx_cmd->timeout.pm_frame_timeout = 0; - } - - tx_cmd->driver_txop = 0; - tx_cmd->tx_flags = tx_flags; - tx_cmd->next_frame_len = 0; -} - -static void -il4965_tx_cmd_build_rate(struct il_priv *il, - struct il_tx_cmd *tx_cmd, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - __le16 fc) -{ - const u8 rts_retry_limit = 60; - u32 rate_flags; - int rate_idx; - u8 data_retry_limit; - u8 rate_plcp; - - /* Set retry limit on DATA packets and Probe Responses */ - if (ieee80211_is_probe_resp(fc)) - data_retry_limit = 3; - else - data_retry_limit = IL4965_DEFAULT_TX_RETRY; - tx_cmd->data_retry_limit = data_retry_limit; - /* Set retry limit on RTS packets */ - tx_cmd->rts_retry_limit = min(data_retry_limit, rts_retry_limit); - - /* DATA packets will use the uCode station table for rate/antenna - * selection */ - if (ieee80211_is_data(fc)) { - tx_cmd->initial_rate_idx = 0; - tx_cmd->tx_flags |= TX_CMD_FLG_STA_RATE_MSK; - return; - } - - /** - * If the current TX rate stored in mac80211 has the MCS bit set, it's - * not really a TX rate. Thus, we use the lowest supported rate for - * this band. Also use the lowest supported rate if the stored rate - * idx is invalid. - */ - rate_idx = info->control.rates[0].idx; - if ((info->control.rates[0].flags & IEEE80211_TX_RC_MCS) || rate_idx < 0 - || rate_idx > RATE_COUNT_LEGACY) - rate_idx = rate_lowest_index(&il->bands[info->band], sta); - /* For 5 GHZ band, remap mac80211 rate indices into driver indices */ - if (info->band == IEEE80211_BAND_5GHZ) - rate_idx += IL_FIRST_OFDM_RATE; - /* Get PLCP rate for tx_cmd->rate_n_flags */ - rate_plcp = il_rates[rate_idx].plcp; - /* Zero out flags for this packet */ - rate_flags = 0; - - /* Set CCK flag as needed */ - if (rate_idx >= IL_FIRST_CCK_RATE && rate_idx <= IL_LAST_CCK_RATE) - rate_flags |= RATE_MCS_CCK_MSK; - - /* Set up antennas */ - il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant); - rate_flags |= BIT(il->mgmt_tx_ant) << RATE_MCS_ANT_POS; - - /* Set the rate in the TX cmd */ - tx_cmd->rate_n_flags = cpu_to_le32(rate_plcp | rate_flags); -} - -static void -il4965_tx_cmd_build_hwcrypto(struct il_priv *il, struct ieee80211_tx_info *info, - struct il_tx_cmd *tx_cmd, struct sk_buff *skb_frag, - int sta_id) -{ - struct ieee80211_key_conf *keyconf = info->control.hw_key; - - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_CCMP: - tx_cmd->sec_ctl = TX_CMD_SEC_CCM; - memcpy(tx_cmd->key, keyconf->key, keyconf->keylen); - if (info->flags & IEEE80211_TX_CTL_AMPDU) - tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK; - D_TX("tx_cmd with AES hwcrypto\n"); - break; - - case WLAN_CIPHER_SUITE_TKIP: - tx_cmd->sec_ctl = TX_CMD_SEC_TKIP; - ieee80211_get_tkip_p2k(keyconf, skb_frag, tx_cmd->key); - D_TX("tx_cmd with tkip hwcrypto\n"); - break; - - case WLAN_CIPHER_SUITE_WEP104: - tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128; - /* fall through */ - case WLAN_CIPHER_SUITE_WEP40: - tx_cmd->sec_ctl |= - (TX_CMD_SEC_WEP | (keyconf->keyidx & TX_CMD_SEC_MSK) << - TX_CMD_SEC_SHIFT); - - memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen); - - D_TX("Configuring packet for WEP encryption " "with key %d\n", - keyconf->keyidx); - break; - - default: - IL_ERR("Unknown encode cipher %x\n", keyconf->cipher); - break; - } -} - -/* - * start C_TX command process - */ -int -il4965_tx_skb(struct il_priv *il, - struct ieee80211_sta *sta, - struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct il_station_priv *sta_priv = NULL; - struct il_tx_queue *txq; - struct il_queue *q; - struct il_device_cmd *out_cmd; - struct il_cmd_meta *out_meta; - struct il_tx_cmd *tx_cmd; - int txq_id; - dma_addr_t phys_addr; - dma_addr_t txcmd_phys; - dma_addr_t scratch_phys; - u16 len, firstlen, secondlen; - u16 seq_number = 0; - __le16 fc; - u8 hdr_len; - u8 sta_id; - u8 wait_write_ptr = 0; - u8 tid = 0; - u8 *qc = NULL; - unsigned long flags; - bool is_agg = false; - - spin_lock_irqsave(&il->lock, flags); - if (il_is_rfkill(il)) { - D_DROP("Dropping - RF KILL\n"); - goto drop_unlock; - } - - fc = hdr->frame_control; - -#ifdef CONFIG_IWLEGACY_DEBUG - if (ieee80211_is_auth(fc)) - D_TX("Sending AUTH frame\n"); - else if (ieee80211_is_assoc_req(fc)) - D_TX("Sending ASSOC frame\n"); - else if (ieee80211_is_reassoc_req(fc)) - D_TX("Sending REASSOC frame\n"); -#endif - - hdr_len = ieee80211_hdrlen(fc); - - /* For management frames use broadcast id to do not break aggregation */ - if (!ieee80211_is_data(fc)) - sta_id = il->hw_params.bcast_id; - else { - /* Find idx into station table for destination station */ - sta_id = il_sta_id_or_broadcast(il, sta); - - if (sta_id == IL_INVALID_STATION) { - D_DROP("Dropping - INVALID STATION: %pM\n", hdr->addr1); - goto drop_unlock; - } - } - - D_TX("station Id %d\n", sta_id); - - if (sta) - sta_priv = (void *)sta->drv_priv; - - if (sta_priv && sta_priv->asleep && - (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)) { - /* - * This sends an asynchronous command to the device, - * but we can rely on it being processed before the - * next frame is processed -- and the next frame to - * this station is the one that will consume this - * counter. - * For now set the counter to just 1 since we do not - * support uAPSD yet. - */ - il4965_sta_modify_sleep_tx_count(il, sta_id, 1); - } - - /* FIXME: remove me ? */ - WARN_ON_ONCE(info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM); - - /* Access category (AC) is also the queue number */ - txq_id = skb_get_queue_mapping(skb); - - /* irqs already disabled/saved above when locking il->lock */ - spin_lock(&il->sta_lock); - - if (ieee80211_is_data_qos(fc)) { - qc = ieee80211_get_qos_ctl(hdr); - tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; - if (WARN_ON_ONCE(tid >= MAX_TID_COUNT)) { - spin_unlock(&il->sta_lock); - goto drop_unlock; - } - seq_number = il->stations[sta_id].tid[tid].seq_number; - seq_number &= IEEE80211_SCTL_SEQ; - hdr->seq_ctrl = - hdr->seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG); - hdr->seq_ctrl |= cpu_to_le16(seq_number); - seq_number += 0x10; - /* aggregation is on for this */ - if (info->flags & IEEE80211_TX_CTL_AMPDU && - il->stations[sta_id].tid[tid].agg.state == IL_AGG_ON) { - txq_id = il->stations[sta_id].tid[tid].agg.txq_id; - is_agg = true; - } - } - - txq = &il->txq[txq_id]; - q = &txq->q; - - if (unlikely(il_queue_space(q) < q->high_mark)) { - spin_unlock(&il->sta_lock); - goto drop_unlock; - } - - if (ieee80211_is_data_qos(fc)) { - il->stations[sta_id].tid[tid].tfds_in_queue++; - if (!ieee80211_has_morefrags(fc)) - il->stations[sta_id].tid[tid].seq_number = seq_number; - } - - spin_unlock(&il->sta_lock); - - txq->skbs[q->write_ptr] = skb; - - /* Set up first empty entry in queue's array of Tx/cmd buffers */ - out_cmd = txq->cmd[q->write_ptr]; - out_meta = &txq->meta[q->write_ptr]; - tx_cmd = &out_cmd->cmd.tx; - memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); - memset(tx_cmd, 0, sizeof(struct il_tx_cmd)); - - /* - * Set up the Tx-command (not MAC!) header. - * Store the chosen Tx queue and TFD idx within the sequence field; - * after Tx, uCode's Tx response will return this value so driver can - * locate the frame within the tx queue and do post-tx processing. - */ - out_cmd->hdr.cmd = C_TX; - out_cmd->hdr.sequence = - cpu_to_le16((u16) - (QUEUE_TO_SEQ(txq_id) | IDX_TO_SEQ(q->write_ptr))); - - /* Copy MAC header from skb into command buffer */ - memcpy(tx_cmd->hdr, hdr, hdr_len); - - /* Total # bytes to be transmitted */ - tx_cmd->len = cpu_to_le16((u16) skb->len); - - if (info->control.hw_key) - il4965_tx_cmd_build_hwcrypto(il, info, tx_cmd, skb, sta_id); - - /* TODO need this for burst mode later on */ - il4965_tx_cmd_build_basic(il, skb, tx_cmd, info, hdr, sta_id); - - il4965_tx_cmd_build_rate(il, tx_cmd, info, sta, fc); - - /* - * Use the first empty entry in this queue's command buffer array - * to contain the Tx command and MAC header concatenated together - * (payload data will be in another buffer). - * Size of this varies, due to varying MAC header length. - * If end is not dword aligned, we'll have 2 extra bytes at the end - * of the MAC header (device reads on dword boundaries). - * We'll tell device about this padding later. - */ - len = sizeof(struct il_tx_cmd) + sizeof(struct il_cmd_header) + hdr_len; - firstlen = (len + 3) & ~3; - - /* Tell NIC about any 2-byte padding after MAC header */ - if (firstlen != len) - tx_cmd->tx_flags |= TX_CMD_FLG_MH_PAD_MSK; - - /* Physical address of this Tx command's header (not MAC header!), - * within command buffer array. */ - txcmd_phys = - pci_map_single(il->pci_dev, &out_cmd->hdr, firstlen, - PCI_DMA_BIDIRECTIONAL); - if (unlikely(pci_dma_mapping_error(il->pci_dev, txcmd_phys))) - goto drop_unlock; - - /* Set up TFD's 2nd entry to point directly to remainder of skb, - * if any (802.11 null frames have no payload). */ - secondlen = skb->len - hdr_len; - if (secondlen > 0) { - phys_addr = - pci_map_single(il->pci_dev, skb->data + hdr_len, secondlen, - PCI_DMA_TODEVICE); - if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr))) - goto drop_unlock; - } - - /* Add buffer containing Tx command and MAC(!) header to TFD's - * first entry */ - il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, firstlen, 1, 0); - dma_unmap_addr_set(out_meta, mapping, txcmd_phys); - dma_unmap_len_set(out_meta, len, firstlen); - if (secondlen) - il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, secondlen, - 0, 0); - - if (!ieee80211_has_morefrags(hdr->frame_control)) { - txq->need_update = 1; - } else { - wait_write_ptr = 1; - txq->need_update = 0; - } - - scratch_phys = - txcmd_phys + sizeof(struct il_cmd_header) + - offsetof(struct il_tx_cmd, scratch); - - /* take back ownership of DMA buffer to enable update */ - pci_dma_sync_single_for_cpu(il->pci_dev, txcmd_phys, firstlen, - PCI_DMA_BIDIRECTIONAL); - tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); - tx_cmd->dram_msb_ptr = il_get_dma_hi_addr(scratch_phys); - - il_update_stats(il, true, fc, skb->len); - - D_TX("sequence nr = 0X%x\n", le16_to_cpu(out_cmd->hdr.sequence)); - D_TX("tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags)); - il_print_hex_dump(il, IL_DL_TX, (u8 *) tx_cmd, sizeof(*tx_cmd)); - il_print_hex_dump(il, IL_DL_TX, (u8 *) tx_cmd->hdr, hdr_len); - - /* Set up entry for this TFD in Tx byte-count array */ - if (info->flags & IEEE80211_TX_CTL_AMPDU) - il->ops->txq_update_byte_cnt_tbl(il, txq, le16_to_cpu(tx_cmd->len)); - - pci_dma_sync_single_for_device(il->pci_dev, txcmd_phys, firstlen, - PCI_DMA_BIDIRECTIONAL); - - /* Tell device the write idx *just past* this latest filled TFD */ - q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); - il_txq_update_write_ptr(il, txq); - spin_unlock_irqrestore(&il->lock, flags); - - /* - * At this point the frame is "transmitted" successfully - * and we will get a TX status notification eventually, - * regardless of the value of ret. "ret" only indicates - * whether or not we should update the write pointer. - */ - - /* - * Avoid atomic ops if it isn't an associated client. - * Also, if this is a packet for aggregation, don't - * increase the counter because the ucode will stop - * aggregation queues when their respective station - * goes to sleep. - */ - if (sta_priv && sta_priv->client && !is_agg) - atomic_inc(&sta_priv->pending_frames); - - if (il_queue_space(q) < q->high_mark && il->mac80211_registered) { - if (wait_write_ptr) { - spin_lock_irqsave(&il->lock, flags); - txq->need_update = 1; - il_txq_update_write_ptr(il, txq); - spin_unlock_irqrestore(&il->lock, flags); - } else { - il_stop_queue(il, txq); - } - } - - return 0; - -drop_unlock: - spin_unlock_irqrestore(&il->lock, flags); - return -1; -} - -static inline int -il4965_alloc_dma_ptr(struct il_priv *il, struct il_dma_ptr *ptr, size_t size) -{ - ptr->addr = dma_alloc_coherent(&il->pci_dev->dev, size, &ptr->dma, - GFP_KERNEL); - if (!ptr->addr) - return -ENOMEM; - ptr->size = size; - return 0; -} - -static inline void -il4965_free_dma_ptr(struct il_priv *il, struct il_dma_ptr *ptr) -{ - if (unlikely(!ptr->addr)) - return; - - dma_free_coherent(&il->pci_dev->dev, ptr->size, ptr->addr, ptr->dma); - memset(ptr, 0, sizeof(*ptr)); -} - -/** - * il4965_hw_txq_ctx_free - Free TXQ Context - * - * Destroy all TX DMA queues and structures - */ -void -il4965_hw_txq_ctx_free(struct il_priv *il) -{ - int txq_id; - - /* Tx queues */ - if (il->txq) { - for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) - if (txq_id == il->cmd_queue) - il_cmd_queue_free(il); - else - il_tx_queue_free(il, txq_id); - } - il4965_free_dma_ptr(il, &il->kw); - - il4965_free_dma_ptr(il, &il->scd_bc_tbls); - - /* free tx queue structure */ - il_free_txq_mem(il); -} - -/** - * il4965_txq_ctx_alloc - allocate TX queue context - * Allocate all Tx DMA structures and initialize them - * - * @param il - * @return error code - */ -int -il4965_txq_ctx_alloc(struct il_priv *il) -{ - int ret, txq_id; - unsigned long flags; - - /* Free all tx/cmd queues and keep-warm buffer */ - il4965_hw_txq_ctx_free(il); - - ret = - il4965_alloc_dma_ptr(il, &il->scd_bc_tbls, - il->hw_params.scd_bc_tbls_size); - if (ret) { - IL_ERR("Scheduler BC Table allocation failed\n"); - goto error_bc_tbls; - } - /* Alloc keep-warm buffer */ - ret = il4965_alloc_dma_ptr(il, &il->kw, IL_KW_SIZE); - if (ret) { - IL_ERR("Keep Warm allocation failed\n"); - goto error_kw; - } - - /* allocate tx queue structure */ - ret = il_alloc_txq_mem(il); - if (ret) - goto error; - - spin_lock_irqsave(&il->lock, flags); - - /* Turn off all Tx DMA fifos */ - il4965_txq_set_sched(il, 0); - - /* Tell NIC where to find the "keep warm" buffer */ - il_wr(il, FH49_KW_MEM_ADDR_REG, il->kw.dma >> 4); - - spin_unlock_irqrestore(&il->lock, flags); - - /* Alloc and init all Tx queues, including the command queue (#4/#9) */ - for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) { - ret = il_tx_queue_init(il, txq_id); - if (ret) { - IL_ERR("Tx %d queue init failed\n", txq_id); - goto error; - } - } - - return ret; - -error: - il4965_hw_txq_ctx_free(il); - il4965_free_dma_ptr(il, &il->kw); -error_kw: - il4965_free_dma_ptr(il, &il->scd_bc_tbls); -error_bc_tbls: - return ret; -} - -void -il4965_txq_ctx_reset(struct il_priv *il) -{ - int txq_id; - unsigned long flags; - - spin_lock_irqsave(&il->lock, flags); - - /* Turn off all Tx DMA fifos */ - il4965_txq_set_sched(il, 0); - /* Tell NIC where to find the "keep warm" buffer */ - il_wr(il, FH49_KW_MEM_ADDR_REG, il->kw.dma >> 4); - - spin_unlock_irqrestore(&il->lock, flags); - - /* Alloc and init all Tx queues, including the command queue (#4) */ - for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) - il_tx_queue_reset(il, txq_id); -} - -static void -il4965_txq_ctx_unmap(struct il_priv *il) -{ - int txq_id; - - if (!il->txq) - return; - - /* Unmap DMA from host system and free skb's */ - for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) - if (txq_id == il->cmd_queue) - il_cmd_queue_unmap(il); - else - il_tx_queue_unmap(il, txq_id); -} - -/** - * il4965_txq_ctx_stop - Stop all Tx DMA channels - */ -void -il4965_txq_ctx_stop(struct il_priv *il) -{ - int ch, ret; - - _il_wr_prph(il, IL49_SCD_TXFACT, 0); - - /* Stop each Tx DMA channel, and wait for it to be idle */ - for (ch = 0; ch < il->hw_params.dma_chnl_num; ch++) { - _il_wr(il, FH49_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0); - ret = - _il_poll_bit(il, FH49_TSSR_TX_STATUS_REG, - FH49_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch), - FH49_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch), - 1000); - if (ret < 0) - IL_ERR("Timeout stopping DMA channel %d [0x%08x]", - ch, _il_rd(il, FH49_TSSR_TX_STATUS_REG)); - } -} - -/* - * Find first available (lowest unused) Tx Queue, mark it "active". - * Called only when finding queue for aggregation. - * Should never return anything < 7, because they should already - * be in use as EDCA AC (0-3), Command (4), reserved (5, 6) - */ -static int -il4965_txq_ctx_activate_free(struct il_priv *il) -{ - int txq_id; - - for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++) - if (!test_and_set_bit(txq_id, &il->txq_ctx_active_msk)) - return txq_id; - return -1; -} - -/** - * il4965_tx_queue_stop_scheduler - Stop queue, but keep configuration - */ -static void -il4965_tx_queue_stop_scheduler(struct il_priv *il, u16 txq_id) -{ - /* Simply stop the queue, but don't change any configuration; - * the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */ - il_wr_prph(il, IL49_SCD_QUEUE_STATUS_BITS(txq_id), - (0 << IL49_SCD_QUEUE_STTS_REG_POS_ACTIVE) | - (1 << IL49_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); -} - -/** - * il4965_tx_queue_set_q2ratid - Map unique receiver/tid combination to a queue - */ -static int -il4965_tx_queue_set_q2ratid(struct il_priv *il, u16 ra_tid, u16 txq_id) -{ - u32 tbl_dw_addr; - u32 tbl_dw; - u16 scd_q2ratid; - - scd_q2ratid = ra_tid & IL_SCD_QUEUE_RA_TID_MAP_RATID_MSK; - - tbl_dw_addr = - il->scd_base_addr + IL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id); - - tbl_dw = il_read_targ_mem(il, tbl_dw_addr); - - if (txq_id & 0x1) - tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF); - else - tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000); - - il_write_targ_mem(il, tbl_dw_addr, tbl_dw); - - return 0; -} - -/** - * il4965_tx_queue_agg_enable - Set up & enable aggregation for selected queue - * - * NOTE: txq_id must be greater than IL49_FIRST_AMPDU_QUEUE, - * i.e. it must be one of the higher queues used for aggregation - */ -static int -il4965_txq_agg_enable(struct il_priv *il, int txq_id, int tx_fifo, int sta_id, - int tid, u16 ssn_idx) -{ - unsigned long flags; - u16 ra_tid; - int ret; - - if ((IL49_FIRST_AMPDU_QUEUE > txq_id) || - (IL49_FIRST_AMPDU_QUEUE + - il->cfg->num_of_ampdu_queues <= txq_id)) { - IL_WARN("queue number out of range: %d, must be %d to %d\n", - txq_id, IL49_FIRST_AMPDU_QUEUE, - IL49_FIRST_AMPDU_QUEUE + - il->cfg->num_of_ampdu_queues - 1); - return -EINVAL; - } - - ra_tid = BUILD_RAxTID(sta_id, tid); - - /* Modify device's station table to Tx this TID */ - ret = il4965_sta_tx_modify_enable_tid(il, sta_id, tid); - if (ret) - return ret; - - spin_lock_irqsave(&il->lock, flags); - - /* Stop this Tx queue before configuring it */ - il4965_tx_queue_stop_scheduler(il, txq_id); - - /* Map receiver-address / traffic-ID to this queue */ - il4965_tx_queue_set_q2ratid(il, ra_tid, txq_id); - - /* Set this queue as a chain-building queue */ - il_set_bits_prph(il, IL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); - - /* Place first TFD at idx corresponding to start sequence number. - * Assumes that ssn_idx is valid (!= 0xFFF) */ - il->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); - il->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); - il4965_set_wr_ptrs(il, txq_id, ssn_idx); - - /* Set up Tx win size and frame limit for this queue */ - il_write_targ_mem(il, - il->scd_base_addr + - IL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id), - (SCD_WIN_SIZE << IL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) - & IL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); - - il_write_targ_mem(il, - il->scd_base_addr + - IL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32), - (SCD_FRAME_LIMIT << - IL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) & - IL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); - - il_set_bits_prph(il, IL49_SCD_INTERRUPT_MASK, (1 << txq_id)); - - /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */ - il4965_tx_queue_set_status(il, &il->txq[txq_id], tx_fifo, 1); - - spin_unlock_irqrestore(&il->lock, flags); - - return 0; -} - -int -il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid, u16 * ssn) -{ - int sta_id; - int tx_fifo; - int txq_id; - int ret; - unsigned long flags; - struct il_tid_data *tid_data; - - /* FIXME: warning if tx fifo not found ? */ - tx_fifo = il4965_get_fifo_from_tid(tid); - if (unlikely(tx_fifo < 0)) - return tx_fifo; - - D_HT("%s on ra = %pM tid = %d\n", __func__, sta->addr, tid); - - sta_id = il_sta_id(sta); - if (sta_id == IL_INVALID_STATION) { - IL_ERR("Start AGG on invalid station\n"); - return -ENXIO; - } - if (unlikely(tid >= MAX_TID_COUNT)) - return -EINVAL; - - if (il->stations[sta_id].tid[tid].agg.state != IL_AGG_OFF) { - IL_ERR("Start AGG when state is not IL_AGG_OFF !\n"); - return -ENXIO; - } - - txq_id = il4965_txq_ctx_activate_free(il); - if (txq_id == -1) { - IL_ERR("No free aggregation queue available\n"); - return -ENXIO; - } - - spin_lock_irqsave(&il->sta_lock, flags); - tid_data = &il->stations[sta_id].tid[tid]; - *ssn = IEEE80211_SEQ_TO_SN(tid_data->seq_number); - tid_data->agg.txq_id = txq_id; - il_set_swq_id(&il->txq[txq_id], il4965_get_ac_from_tid(tid), txq_id); - spin_unlock_irqrestore(&il->sta_lock, flags); - - ret = il4965_txq_agg_enable(il, txq_id, tx_fifo, sta_id, tid, *ssn); - if (ret) - return ret; - - spin_lock_irqsave(&il->sta_lock, flags); - tid_data = &il->stations[sta_id].tid[tid]; - if (tid_data->tfds_in_queue == 0) { - D_HT("HW queue is empty\n"); - tid_data->agg.state = IL_AGG_ON; - ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); - } else { - D_HT("HW queue is NOT empty: %d packets in HW queue\n", - tid_data->tfds_in_queue); - tid_data->agg.state = IL_EMPTYING_HW_QUEUE_ADDBA; - } - spin_unlock_irqrestore(&il->sta_lock, flags); - return ret; -} - -/** - * txq_id must be greater than IL49_FIRST_AMPDU_QUEUE - * il->lock must be held by the caller - */ -static int -il4965_txq_agg_disable(struct il_priv *il, u16 txq_id, u16 ssn_idx, u8 tx_fifo) -{ - if ((IL49_FIRST_AMPDU_QUEUE > txq_id) || - (IL49_FIRST_AMPDU_QUEUE + - il->cfg->num_of_ampdu_queues <= txq_id)) { - IL_WARN("queue number out of range: %d, must be %d to %d\n", - txq_id, IL49_FIRST_AMPDU_QUEUE, - IL49_FIRST_AMPDU_QUEUE + - il->cfg->num_of_ampdu_queues - 1); - return -EINVAL; - } - - il4965_tx_queue_stop_scheduler(il, txq_id); - - il_clear_bits_prph(il, IL49_SCD_QUEUECHAIN_SEL, (1 << txq_id)); - - il->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); - il->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); - /* supposes that ssn_idx is valid (!= 0xFFF) */ - il4965_set_wr_ptrs(il, txq_id, ssn_idx); - - il_clear_bits_prph(il, IL49_SCD_INTERRUPT_MASK, (1 << txq_id)); - il_txq_ctx_deactivate(il, txq_id); - il4965_tx_queue_set_status(il, &il->txq[txq_id], tx_fifo, 0); - - return 0; -} - -int -il4965_tx_agg_stop(struct il_priv *il, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid) -{ - int tx_fifo_id, txq_id, sta_id, ssn; - struct il_tid_data *tid_data; - int write_ptr, read_ptr; - unsigned long flags; - - /* FIXME: warning if tx_fifo_id not found ? */ - tx_fifo_id = il4965_get_fifo_from_tid(tid); - if (unlikely(tx_fifo_id < 0)) - return tx_fifo_id; - - sta_id = il_sta_id(sta); - - if (sta_id == IL_INVALID_STATION) { - IL_ERR("Invalid station for AGG tid %d\n", tid); - return -ENXIO; - } - - spin_lock_irqsave(&il->sta_lock, flags); - - tid_data = &il->stations[sta_id].tid[tid]; - ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4; - txq_id = tid_data->agg.txq_id; - - switch (il->stations[sta_id].tid[tid].agg.state) { - case IL_EMPTYING_HW_QUEUE_ADDBA: - /* - * This can happen if the peer stops aggregation - * again before we've had a chance to drain the - * queue we selected previously, i.e. before the - * session was really started completely. - */ - D_HT("AGG stop before setup done\n"); - goto turn_off; - case IL_AGG_ON: - break; - default: - IL_WARN("Stopping AGG while state not ON or starting\n"); - } - - write_ptr = il->txq[txq_id].q.write_ptr; - read_ptr = il->txq[txq_id].q.read_ptr; - - /* The queue is not empty */ - if (write_ptr != read_ptr) { - D_HT("Stopping a non empty AGG HW QUEUE\n"); - il->stations[sta_id].tid[tid].agg.state = - IL_EMPTYING_HW_QUEUE_DELBA; - spin_unlock_irqrestore(&il->sta_lock, flags); - return 0; - } - - D_HT("HW queue is empty\n"); -turn_off: - il->stations[sta_id].tid[tid].agg.state = IL_AGG_OFF; - - /* do not restore/save irqs */ - spin_unlock(&il->sta_lock); - spin_lock(&il->lock); - - /* - * the only reason this call can fail is queue number out of range, - * which can happen if uCode is reloaded and all the station - * information are lost. if it is outside the range, there is no need - * to deactivate the uCode queue, just return "success" to allow - * mac80211 to clean up it own data. - */ - il4965_txq_agg_disable(il, txq_id, ssn, tx_fifo_id); - spin_unlock_irqrestore(&il->lock, flags); - - ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); - - return 0; -} - -int -il4965_txq_check_empty(struct il_priv *il, int sta_id, u8 tid, int txq_id) -{ - struct il_queue *q = &il->txq[txq_id].q; - u8 *addr = il->stations[sta_id].sta.sta.addr; - struct il_tid_data *tid_data = &il->stations[sta_id].tid[tid]; - - lockdep_assert_held(&il->sta_lock); - - switch (il->stations[sta_id].tid[tid].agg.state) { - case IL_EMPTYING_HW_QUEUE_DELBA: - /* We are reclaiming the last packet of the */ - /* aggregated HW queue */ - if (txq_id == tid_data->agg.txq_id && - q->read_ptr == q->write_ptr) { - u16 ssn = IEEE80211_SEQ_TO_SN(tid_data->seq_number); - int tx_fifo = il4965_get_fifo_from_tid(tid); - D_HT("HW queue empty: continue DELBA flow\n"); - il4965_txq_agg_disable(il, txq_id, ssn, tx_fifo); - tid_data->agg.state = IL_AGG_OFF; - ieee80211_stop_tx_ba_cb_irqsafe(il->vif, addr, tid); - } - break; - case IL_EMPTYING_HW_QUEUE_ADDBA: - /* We are reclaiming the last packet of the queue */ - if (tid_data->tfds_in_queue == 0) { - D_HT("HW queue empty: continue ADDBA flow\n"); - tid_data->agg.state = IL_AGG_ON; - ieee80211_start_tx_ba_cb_irqsafe(il->vif, addr, tid); - } - break; - } - - return 0; -} - -static void -il4965_non_agg_tx_status(struct il_priv *il, const u8 *addr1) -{ - struct ieee80211_sta *sta; - struct il_station_priv *sta_priv; - - rcu_read_lock(); - sta = ieee80211_find_sta(il->vif, addr1); - if (sta) { - sta_priv = (void *)sta->drv_priv; - /* avoid atomic ops if this isn't a client */ - if (sta_priv->client && - atomic_dec_return(&sta_priv->pending_frames) == 0) - ieee80211_sta_block_awake(il->hw, sta, false); - } - rcu_read_unlock(); -} - -static void -il4965_tx_status(struct il_priv *il, struct sk_buff *skb, bool is_agg) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - - if (!is_agg) - il4965_non_agg_tx_status(il, hdr->addr1); - - ieee80211_tx_status_irqsafe(il->hw, skb); -} - -int -il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int idx) -{ - struct il_tx_queue *txq = &il->txq[txq_id]; - struct il_queue *q = &txq->q; - int nfreed = 0; - struct ieee80211_hdr *hdr; - struct sk_buff *skb; - - if (idx >= q->n_bd || il_queue_used(q, idx) == 0) { - IL_ERR("Read idx for DMA queue txq id (%d), idx %d, " - "is out of range [0-%d] %d %d.\n", txq_id, idx, q->n_bd, - q->write_ptr, q->read_ptr); - return 0; - } - - for (idx = il_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; - q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) { - - skb = txq->skbs[txq->q.read_ptr]; - - if (WARN_ON_ONCE(skb == NULL)) - continue; - - hdr = (struct ieee80211_hdr *) skb->data; - if (ieee80211_is_data_qos(hdr->frame_control)) - nfreed++; - - il4965_tx_status(il, skb, txq_id >= IL4965_FIRST_AMPDU_QUEUE); - - txq->skbs[txq->q.read_ptr] = NULL; - il->ops->txq_free_tfd(il, txq); - } - return nfreed; -} - -/** - * il4965_tx_status_reply_compressed_ba - Update tx status from block-ack - * - * Go through block-ack's bitmap of ACK'd frames, update driver's record of - * ACK vs. not. This gets sent to mac80211, then to rate scaling algo. - */ -static int -il4965_tx_status_reply_compressed_ba(struct il_priv *il, struct il_ht_agg *agg, - struct il_compressed_ba_resp *ba_resp) -{ - int i, sh, ack; - u16 seq_ctl = le16_to_cpu(ba_resp->seq_ctl); - u16 scd_flow = le16_to_cpu(ba_resp->scd_flow); - int successes = 0; - struct ieee80211_tx_info *info; - u64 bitmap, sent_bitmap; - - if (unlikely(!agg->wait_for_ba)) { - if (unlikely(ba_resp->bitmap)) - IL_ERR("Received BA when not expected\n"); - return -EINVAL; - } - - /* Mark that the expected block-ack response arrived */ - agg->wait_for_ba = 0; - D_TX_REPLY("BA %d %d\n", agg->start_idx, ba_resp->seq_ctl); - - /* Calculate shift to align block-ack bits with our Tx win bits */ - sh = agg->start_idx - SEQ_TO_IDX(seq_ctl >> 4); - if (sh < 0) /* tbw something is wrong with indices */ - sh += 0x100; - - if (agg->frame_count > (64 - sh)) { - D_TX_REPLY("more frames than bitmap size"); - return -1; - } - - /* don't use 64-bit values for now */ - bitmap = le64_to_cpu(ba_resp->bitmap) >> sh; - - /* check for success or failure according to the - * transmitted bitmap and block-ack bitmap */ - sent_bitmap = bitmap & agg->bitmap; - - /* For each frame attempted in aggregation, - * update driver's record of tx frame's status. */ - i = 0; - while (sent_bitmap) { - ack = sent_bitmap & 1ULL; - successes += ack; - D_TX_REPLY("%s ON i=%d idx=%d raw=%d\n", ack ? "ACK" : "NACK", - i, (agg->start_idx + i) & 0xff, agg->start_idx + i); - sent_bitmap >>= 1; - ++i; - } - - D_TX_REPLY("Bitmap %llx\n", (unsigned long long)bitmap); - - info = IEEE80211_SKB_CB(il->txq[scd_flow].skbs[agg->start_idx]); - memset(&info->status, 0, sizeof(info->status)); - info->flags |= IEEE80211_TX_STAT_ACK; - info->flags |= IEEE80211_TX_STAT_AMPDU; - info->status.ampdu_ack_len = successes; - info->status.ampdu_len = agg->frame_count; - il4965_hwrate_to_tx_control(il, agg->rate_n_flags, info); - - return 0; -} - -static inline bool -il4965_is_tx_success(u32 status) -{ - status &= TX_STATUS_MSK; - return (status == TX_STATUS_SUCCESS || status == TX_STATUS_DIRECT_DONE); -} - -static u8 -il4965_find_station(struct il_priv *il, const u8 *addr) -{ - int i; - int start = 0; - int ret = IL_INVALID_STATION; - unsigned long flags; - - if (il->iw_mode == NL80211_IFTYPE_ADHOC) - start = IL_STA_ID; - - if (is_broadcast_ether_addr(addr)) - return il->hw_params.bcast_id; - - spin_lock_irqsave(&il->sta_lock, flags); - for (i = start; i < il->hw_params.max_stations; i++) - if (il->stations[i].used && - ether_addr_equal(il->stations[i].sta.sta.addr, addr)) { - ret = i; - goto out; - } - - D_ASSOC("can not find STA %pM total %d\n", addr, il->num_stations); - -out: - /* - * It may be possible that more commands interacting with stations - * arrive before we completed processing the adding of - * station - */ - if (ret != IL_INVALID_STATION && - (!(il->stations[ret].used & IL_STA_UCODE_ACTIVE) || - ((il->stations[ret].used & IL_STA_UCODE_ACTIVE) && - (il->stations[ret].used & IL_STA_UCODE_INPROGRESS)))) { - IL_ERR("Requested station info for sta %d before ready.\n", - ret); - ret = IL_INVALID_STATION; - } - spin_unlock_irqrestore(&il->sta_lock, flags); - return ret; -} - -static int -il4965_get_ra_sta_id(struct il_priv *il, struct ieee80211_hdr *hdr) -{ - if (il->iw_mode == NL80211_IFTYPE_STATION) - return IL_AP_ID; - else { - u8 *da = ieee80211_get_DA(hdr); - - return il4965_find_station(il, da); - } -} - -static inline u32 -il4965_get_scd_ssn(struct il4965_tx_resp *tx_resp) -{ - return le32_to_cpup(&tx_resp->u.status + - tx_resp->frame_count) & IEEE80211_MAX_SN; -} - -static inline u32 -il4965_tx_status_to_mac80211(u32 status) -{ - status &= TX_STATUS_MSK; - - switch (status) { - case TX_STATUS_SUCCESS: - case TX_STATUS_DIRECT_DONE: - return IEEE80211_TX_STAT_ACK; - case TX_STATUS_FAIL_DEST_PS: - return IEEE80211_TX_STAT_TX_FILTERED; - default: - return 0; - } -} - -/** - * il4965_tx_status_reply_tx - Handle Tx response for frames in aggregation queue - */ -static int -il4965_tx_status_reply_tx(struct il_priv *il, struct il_ht_agg *agg, - struct il4965_tx_resp *tx_resp, int txq_id, - u16 start_idx) -{ - u16 status; - struct agg_tx_status *frame_status = tx_resp->u.agg_status; - struct ieee80211_tx_info *info = NULL; - struct ieee80211_hdr *hdr = NULL; - u32 rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags); - int i, sh, idx; - u16 seq; - if (agg->wait_for_ba) - D_TX_REPLY("got tx response w/o block-ack\n"); - - agg->frame_count = tx_resp->frame_count; - agg->start_idx = start_idx; - agg->rate_n_flags = rate_n_flags; - agg->bitmap = 0; - - /* num frames attempted by Tx command */ - if (agg->frame_count == 1) { - /* Only one frame was attempted; no block-ack will arrive */ - status = le16_to_cpu(frame_status[0].status); - idx = start_idx; - - D_TX_REPLY("FrameCnt = %d, StartIdx=%d idx=%d\n", - agg->frame_count, agg->start_idx, idx); - - info = IEEE80211_SKB_CB(il->txq[txq_id].skbs[idx]); - info->status.rates[0].count = tx_resp->failure_frame + 1; - info->flags &= ~IEEE80211_TX_CTL_AMPDU; - info->flags |= il4965_tx_status_to_mac80211(status); - il4965_hwrate_to_tx_control(il, rate_n_flags, info); - - D_TX_REPLY("1 Frame 0x%x failure :%d\n", status & 0xff, - tx_resp->failure_frame); - D_TX_REPLY("Rate Info rate_n_flags=%x\n", rate_n_flags); - - agg->wait_for_ba = 0; - } else { - /* Two or more frames were attempted; expect block-ack */ - u64 bitmap = 0; - int start = agg->start_idx; - struct sk_buff *skb; - - /* Construct bit-map of pending frames within Tx win */ - for (i = 0; i < agg->frame_count; i++) { - u16 sc; - status = le16_to_cpu(frame_status[i].status); - seq = le16_to_cpu(frame_status[i].sequence); - idx = SEQ_TO_IDX(seq); - txq_id = SEQ_TO_QUEUE(seq); - - if (status & - (AGG_TX_STATE_FEW_BYTES_MSK | - AGG_TX_STATE_ABORT_MSK)) - continue; - - D_TX_REPLY("FrameCnt = %d, txq_id=%d idx=%d\n", - agg->frame_count, txq_id, idx); - - skb = il->txq[txq_id].skbs[idx]; - if (WARN_ON_ONCE(skb == NULL)) - return -1; - hdr = (struct ieee80211_hdr *) skb->data; - - sc = le16_to_cpu(hdr->seq_ctrl); - if (idx != (IEEE80211_SEQ_TO_SN(sc) & 0xff)) { - IL_ERR("BUG_ON idx doesn't match seq control" - " idx=%d, seq_idx=%d, seq=%d\n", idx, - IEEE80211_SEQ_TO_SN(sc), hdr->seq_ctrl); - return -1; - } - - D_TX_REPLY("AGG Frame i=%d idx %d seq=%d\n", i, idx, - IEEE80211_SEQ_TO_SN(sc)); - - sh = idx - start; - if (sh > 64) { - sh = (start - idx) + 0xff; - bitmap = bitmap << sh; - sh = 0; - start = idx; - } else if (sh < -64) - sh = 0xff - (start - idx); - else if (sh < 0) { - sh = start - idx; - start = idx; - bitmap = bitmap << sh; - sh = 0; - } - bitmap |= 1ULL << sh; - D_TX_REPLY("start=%d bitmap=0x%llx\n", start, - (unsigned long long)bitmap); - } - - agg->bitmap = bitmap; - agg->start_idx = start; - D_TX_REPLY("Frames %d start_idx=%d bitmap=0x%llx\n", - agg->frame_count, agg->start_idx, - (unsigned long long)agg->bitmap); - - if (bitmap) - agg->wait_for_ba = 1; - } - return 0; -} - -/** - * il4965_hdl_tx - Handle standard (non-aggregation) Tx response - */ -static void -il4965_hdl_tx(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - u16 sequence = le16_to_cpu(pkt->hdr.sequence); - int txq_id = SEQ_TO_QUEUE(sequence); - int idx = SEQ_TO_IDX(sequence); - struct il_tx_queue *txq = &il->txq[txq_id]; - struct sk_buff *skb; - struct ieee80211_hdr *hdr; - struct ieee80211_tx_info *info; - struct il4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; - u32 status = le32_to_cpu(tx_resp->u.status); - int uninitialized_var(tid); - int sta_id; - int freed; - u8 *qc = NULL; - unsigned long flags; - - if (idx >= txq->q.n_bd || il_queue_used(&txq->q, idx) == 0) { - IL_ERR("Read idx for DMA queue txq_id (%d) idx %d " - "is out of range [0-%d] %d %d\n", txq_id, idx, - txq->q.n_bd, txq->q.write_ptr, txq->q.read_ptr); - return; - } - - txq->time_stamp = jiffies; - - skb = txq->skbs[txq->q.read_ptr]; - info = IEEE80211_SKB_CB(skb); - memset(&info->status, 0, sizeof(info->status)); - - hdr = (struct ieee80211_hdr *) skb->data; - if (ieee80211_is_data_qos(hdr->frame_control)) { - qc = ieee80211_get_qos_ctl(hdr); - tid = qc[0] & 0xf; - } - - sta_id = il4965_get_ra_sta_id(il, hdr); - if (txq->sched_retry && unlikely(sta_id == IL_INVALID_STATION)) { - IL_ERR("Station not known\n"); - return; - } - - spin_lock_irqsave(&il->sta_lock, flags); - if (txq->sched_retry) { - const u32 scd_ssn = il4965_get_scd_ssn(tx_resp); - struct il_ht_agg *agg = NULL; - WARN_ON(!qc); - - agg = &il->stations[sta_id].tid[tid].agg; - - il4965_tx_status_reply_tx(il, agg, tx_resp, txq_id, idx); - - /* check if BAR is needed */ - if (tx_resp->frame_count == 1 && - !il4965_is_tx_success(status)) - info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; - - if (txq->q.read_ptr != (scd_ssn & 0xff)) { - idx = il_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd); - D_TX_REPLY("Retry scheduler reclaim scd_ssn " - "%d idx %d\n", scd_ssn, idx); - freed = il4965_tx_queue_reclaim(il, txq_id, idx); - if (qc) - il4965_free_tfds_in_queue(il, sta_id, tid, - freed); - - if (il->mac80211_registered && - il_queue_space(&txq->q) > txq->q.low_mark && - agg->state != IL_EMPTYING_HW_QUEUE_DELBA) - il_wake_queue(il, txq); - } - } else { - info->status.rates[0].count = tx_resp->failure_frame + 1; - info->flags |= il4965_tx_status_to_mac80211(status); - il4965_hwrate_to_tx_control(il, - le32_to_cpu(tx_resp->rate_n_flags), - info); - - D_TX_REPLY("TXQ %d status %s (0x%08x) " - "rate_n_flags 0x%x retries %d\n", txq_id, - il4965_get_tx_fail_reason(status), status, - le32_to_cpu(tx_resp->rate_n_flags), - tx_resp->failure_frame); - - freed = il4965_tx_queue_reclaim(il, txq_id, idx); - if (qc && likely(sta_id != IL_INVALID_STATION)) - il4965_free_tfds_in_queue(il, sta_id, tid, freed); - else if (sta_id == IL_INVALID_STATION) - D_TX_REPLY("Station not known\n"); - - if (il->mac80211_registered && - il_queue_space(&txq->q) > txq->q.low_mark) - il_wake_queue(il, txq); - } - if (qc && likely(sta_id != IL_INVALID_STATION)) - il4965_txq_check_empty(il, sta_id, tid, txq_id); - - il4965_check_abort_status(il, tx_resp->frame_count, status); - - spin_unlock_irqrestore(&il->sta_lock, flags); -} - -/** - * translate ucode response to mac80211 tx status control values - */ -void -il4965_hwrate_to_tx_control(struct il_priv *il, u32 rate_n_flags, - struct ieee80211_tx_info *info) -{ - struct ieee80211_tx_rate *r = &info->status.rates[0]; - - info->status.antenna = - ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS); - if (rate_n_flags & RATE_MCS_HT_MSK) - r->flags |= IEEE80211_TX_RC_MCS; - if (rate_n_flags & RATE_MCS_GF_MSK) - r->flags |= IEEE80211_TX_RC_GREEN_FIELD; - if (rate_n_flags & RATE_MCS_HT40_MSK) - r->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; - if (rate_n_flags & RATE_MCS_DUP_MSK) - r->flags |= IEEE80211_TX_RC_DUP_DATA; - if (rate_n_flags & RATE_MCS_SGI_MSK) - r->flags |= IEEE80211_TX_RC_SHORT_GI; - r->idx = il4965_hwrate_to_mac80211_idx(rate_n_flags, info->band); -} - -/** - * il4965_hdl_compressed_ba - Handler for N_COMPRESSED_BA - * - * Handles block-acknowledge notification from device, which reports success - * of frames sent via aggregation. - */ -static void -il4965_hdl_compressed_ba(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il_compressed_ba_resp *ba_resp = &pkt->u.compressed_ba; - struct il_tx_queue *txq = NULL; - struct il_ht_agg *agg; - int idx; - int sta_id; - int tid; - unsigned long flags; - - /* "flow" corresponds to Tx queue */ - u16 scd_flow = le16_to_cpu(ba_resp->scd_flow); - - /* "ssn" is start of block-ack Tx win, corresponds to idx - * (in Tx queue's circular buffer) of first TFD/frame in win */ - u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); - - if (scd_flow >= il->hw_params.max_txq_num) { - IL_ERR("BUG_ON scd_flow is bigger than number of queues\n"); - return; - } - - txq = &il->txq[scd_flow]; - sta_id = ba_resp->sta_id; - tid = ba_resp->tid; - agg = &il->stations[sta_id].tid[tid].agg; - if (unlikely(agg->txq_id != scd_flow)) { - /* - * FIXME: this is a uCode bug which need to be addressed, - * log the information and return for now! - * since it is possible happen very often and in order - * not to fill the syslog, don't enable the logging by default - */ - D_TX_REPLY("BA scd_flow %d does not match txq_id %d\n", - scd_flow, agg->txq_id); - return; - } - - /* Find idx just before block-ack win */ - idx = il_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); - - spin_lock_irqsave(&il->sta_lock, flags); - - D_TX_REPLY("N_COMPRESSED_BA [%d] Received from %pM, " "sta_id = %d\n", - agg->wait_for_ba, (u8 *) &ba_resp->sta_addr_lo32, - ba_resp->sta_id); - D_TX_REPLY("TID = %d, SeqCtl = %d, bitmap = 0x%llx," "scd_flow = " - "%d, scd_ssn = %d\n", ba_resp->tid, ba_resp->seq_ctl, - (unsigned long long)le64_to_cpu(ba_resp->bitmap), - ba_resp->scd_flow, ba_resp->scd_ssn); - D_TX_REPLY("DAT start_idx = %d, bitmap = 0x%llx\n", agg->start_idx, - (unsigned long long)agg->bitmap); - - /* Update driver's record of ACK vs. not for each frame in win */ - il4965_tx_status_reply_compressed_ba(il, agg, ba_resp); - - /* Release all TFDs before the SSN, i.e. all TFDs in front of - * block-ack win (we assume that they've been successfully - * transmitted ... if not, it's too late anyway). */ - if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) { - /* calculate mac80211 ampdu sw queue to wake */ - int freed = il4965_tx_queue_reclaim(il, scd_flow, idx); - il4965_free_tfds_in_queue(il, sta_id, tid, freed); - - if (il_queue_space(&txq->q) > txq->q.low_mark && - il->mac80211_registered && - agg->state != IL_EMPTYING_HW_QUEUE_DELBA) - il_wake_queue(il, txq); - - il4965_txq_check_empty(il, sta_id, tid, scd_flow); - } - - spin_unlock_irqrestore(&il->sta_lock, flags); -} - -#ifdef CONFIG_IWLEGACY_DEBUG -const char * -il4965_get_tx_fail_reason(u32 status) -{ -#define TX_STATUS_FAIL(x) case TX_STATUS_FAIL_ ## x: return #x -#define TX_STATUS_POSTPONE(x) case TX_STATUS_POSTPONE_ ## x: return #x - - switch (status & TX_STATUS_MSK) { - case TX_STATUS_SUCCESS: - return "SUCCESS"; - TX_STATUS_POSTPONE(DELAY); - TX_STATUS_POSTPONE(FEW_BYTES); - TX_STATUS_POSTPONE(QUIET_PERIOD); - TX_STATUS_POSTPONE(CALC_TTAK); - TX_STATUS_FAIL(INTERNAL_CROSSED_RETRY); - TX_STATUS_FAIL(SHORT_LIMIT); - TX_STATUS_FAIL(LONG_LIMIT); - TX_STATUS_FAIL(FIFO_UNDERRUN); - TX_STATUS_FAIL(DRAIN_FLOW); - TX_STATUS_FAIL(RFKILL_FLUSH); - TX_STATUS_FAIL(LIFE_EXPIRE); - TX_STATUS_FAIL(DEST_PS); - TX_STATUS_FAIL(HOST_ABORTED); - TX_STATUS_FAIL(BT_RETRY); - TX_STATUS_FAIL(STA_INVALID); - TX_STATUS_FAIL(FRAG_DROPPED); - TX_STATUS_FAIL(TID_DISABLE); - TX_STATUS_FAIL(FIFO_FLUSHED); - TX_STATUS_FAIL(INSUFFICIENT_CF_POLL); - TX_STATUS_FAIL(PASSIVE_NO_RX); - TX_STATUS_FAIL(NO_BEACON_ON_RADAR); - } - - return "UNKNOWN"; - -#undef TX_STATUS_FAIL -#undef TX_STATUS_POSTPONE -} -#endif /* CONFIG_IWLEGACY_DEBUG */ - -static struct il_link_quality_cmd * -il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id) -{ - int i, r; - struct il_link_quality_cmd *link_cmd; - u32 rate_flags = 0; - __le32 rate_n_flags; - - link_cmd = kzalloc(sizeof(struct il_link_quality_cmd), GFP_KERNEL); - if (!link_cmd) { - IL_ERR("Unable to allocate memory for LQ cmd.\n"); - return NULL; - } - /* Set up the rate scaling to start at selected rate, fall back - * all the way down to 1M in IEEE order, and then spin on 1M */ - if (il->band == IEEE80211_BAND_5GHZ) - r = RATE_6M_IDX; - else - r = RATE_1M_IDX; - - if (r >= IL_FIRST_CCK_RATE && r <= IL_LAST_CCK_RATE) - rate_flags |= RATE_MCS_CCK_MSK; - - rate_flags |= - il4965_first_antenna(il->hw_params. - valid_tx_ant) << RATE_MCS_ANT_POS; - rate_n_flags = cpu_to_le32(il_rates[r].plcp | rate_flags); - for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) - link_cmd->rs_table[i].rate_n_flags = rate_n_flags; - - link_cmd->general_params.single_stream_ant_msk = - il4965_first_antenna(il->hw_params.valid_tx_ant); - - link_cmd->general_params.dual_stream_ant_msk = - il->hw_params.valid_tx_ant & ~il4965_first_antenna(il->hw_params. - valid_tx_ant); - if (!link_cmd->general_params.dual_stream_ant_msk) { - link_cmd->general_params.dual_stream_ant_msk = ANT_AB; - } else if (il4965_num_of_ant(il->hw_params.valid_tx_ant) == 2) { - link_cmd->general_params.dual_stream_ant_msk = - il->hw_params.valid_tx_ant; - } - - link_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; - link_cmd->agg_params.agg_time_limit = - cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF); - - link_cmd->sta_id = sta_id; - - return link_cmd; -} - -/* - * il4965_add_bssid_station - Add the special IBSS BSSID station - * - * Function sleeps. - */ -int -il4965_add_bssid_station(struct il_priv *il, const u8 *addr, u8 *sta_id_r) -{ - int ret; - u8 sta_id; - struct il_link_quality_cmd *link_cmd; - unsigned long flags; - - if (sta_id_r) - *sta_id_r = IL_INVALID_STATION; - - ret = il_add_station_common(il, addr, 0, NULL, &sta_id); - if (ret) { - IL_ERR("Unable to add station %pM\n", addr); - return ret; - } - - if (sta_id_r) - *sta_id_r = sta_id; - - spin_lock_irqsave(&il->sta_lock, flags); - il->stations[sta_id].used |= IL_STA_LOCAL; - spin_unlock_irqrestore(&il->sta_lock, flags); - - /* Set up default rate scaling table in device's station table */ - link_cmd = il4965_sta_alloc_lq(il, sta_id); - if (!link_cmd) { - IL_ERR("Unable to initialize rate scaling for station %pM.\n", - addr); - return -ENOMEM; - } - - ret = il_send_lq_cmd(il, link_cmd, CMD_SYNC, true); - if (ret) - IL_ERR("Link quality command failed (%d)\n", ret); - - spin_lock_irqsave(&il->sta_lock, flags); - il->stations[sta_id].lq = link_cmd; - spin_unlock_irqrestore(&il->sta_lock, flags); - - return 0; -} - -static int -il4965_static_wepkey_cmd(struct il_priv *il, bool send_if_empty) -{ - int i; - u8 buff[sizeof(struct il_wep_cmd) + - sizeof(struct il_wep_key) * WEP_KEYS_MAX]; - struct il_wep_cmd *wep_cmd = (struct il_wep_cmd *)buff; - size_t cmd_size = sizeof(struct il_wep_cmd); - struct il_host_cmd cmd = { - .id = C_WEPKEY, - .data = wep_cmd, - .flags = CMD_SYNC, - }; - bool not_empty = false; - - might_sleep(); - - memset(wep_cmd, 0, - cmd_size + (sizeof(struct il_wep_key) * WEP_KEYS_MAX)); - - for (i = 0; i < WEP_KEYS_MAX; i++) { - u8 key_size = il->_4965.wep_keys[i].key_size; - - wep_cmd->key[i].key_idx = i; - if (key_size) { - wep_cmd->key[i].key_offset = i; - not_empty = true; - } else - wep_cmd->key[i].key_offset = WEP_INVALID_OFFSET; - - wep_cmd->key[i].key_size = key_size; - memcpy(&wep_cmd->key[i].key[3], il->_4965.wep_keys[i].key, key_size); - } - - wep_cmd->global_key_type = WEP_KEY_WEP_TYPE; - wep_cmd->num_keys = WEP_KEYS_MAX; - - cmd_size += sizeof(struct il_wep_key) * WEP_KEYS_MAX; - cmd.len = cmd_size; - - if (not_empty || send_if_empty) - return il_send_cmd(il, &cmd); - else - return 0; -} - -int -il4965_restore_default_wep_keys(struct il_priv *il) -{ - lockdep_assert_held(&il->mutex); - - return il4965_static_wepkey_cmd(il, false); -} - -int -il4965_remove_default_wep_key(struct il_priv *il, - struct ieee80211_key_conf *keyconf) -{ - int ret; - int idx = keyconf->keyidx; - - lockdep_assert_held(&il->mutex); - - D_WEP("Removing default WEP key: idx=%d\n", idx); - - memset(&il->_4965.wep_keys[idx], 0, sizeof(struct il_wep_key)); - if (il_is_rfkill(il)) { - D_WEP("Not sending C_WEPKEY command due to RFKILL.\n"); - /* but keys in device are clear anyway so return success */ - return 0; - } - ret = il4965_static_wepkey_cmd(il, 1); - D_WEP("Remove default WEP key: idx=%d ret=%d\n", idx, ret); - - return ret; -} - -int -il4965_set_default_wep_key(struct il_priv *il, - struct ieee80211_key_conf *keyconf) -{ - int ret; - int len = keyconf->keylen; - int idx = keyconf->keyidx; - - lockdep_assert_held(&il->mutex); - - if (len != WEP_KEY_LEN_128 && len != WEP_KEY_LEN_64) { - D_WEP("Bad WEP key length %d\n", keyconf->keylen); - return -EINVAL; - } - - keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV; - keyconf->hw_key_idx = HW_KEY_DEFAULT; - il->stations[IL_AP_ID].keyinfo.cipher = keyconf->cipher; - - il->_4965.wep_keys[idx].key_size = len; - memcpy(&il->_4965.wep_keys[idx].key, &keyconf->key, len); - - ret = il4965_static_wepkey_cmd(il, false); - - D_WEP("Set default WEP key: len=%d idx=%d ret=%d\n", len, idx, ret); - return ret; -} - -static int -il4965_set_wep_dynamic_key_info(struct il_priv *il, - struct ieee80211_key_conf *keyconf, u8 sta_id) -{ - unsigned long flags; - __le16 key_flags = 0; - struct il_addsta_cmd sta_cmd; - - lockdep_assert_held(&il->mutex); - - keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV; - - key_flags |= (STA_KEY_FLG_WEP | STA_KEY_FLG_MAP_KEY_MSK); - key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); - key_flags &= ~STA_KEY_FLG_INVALID; - - if (keyconf->keylen == WEP_KEY_LEN_128) - key_flags |= STA_KEY_FLG_KEY_SIZE_MSK; - - if (sta_id == il->hw_params.bcast_id) - key_flags |= STA_KEY_MULTICAST_MSK; - - spin_lock_irqsave(&il->sta_lock, flags); - - il->stations[sta_id].keyinfo.cipher = keyconf->cipher; - il->stations[sta_id].keyinfo.keylen = keyconf->keylen; - il->stations[sta_id].keyinfo.keyidx = keyconf->keyidx; - - memcpy(il->stations[sta_id].keyinfo.key, keyconf->key, keyconf->keylen); - - memcpy(&il->stations[sta_id].sta.key.key[3], keyconf->key, - keyconf->keylen); - - if ((il->stations[sta_id].sta.key. - key_flags & STA_KEY_FLG_ENCRYPT_MSK) == STA_KEY_FLG_NO_ENC) - il->stations[sta_id].sta.key.key_offset = - il_get_free_ucode_key_idx(il); - /* else, we are overriding an existing key => no need to allocated room - * in uCode. */ - - WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, - "no space for a new key"); - - il->stations[sta_id].sta.key.key_flags = key_flags; - il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; - il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - - memcpy(&sta_cmd, &il->stations[sta_id].sta, - sizeof(struct il_addsta_cmd)); - spin_unlock_irqrestore(&il->sta_lock, flags); - - return il_send_add_sta(il, &sta_cmd, CMD_SYNC); -} - -static int -il4965_set_ccmp_dynamic_key_info(struct il_priv *il, - struct ieee80211_key_conf *keyconf, u8 sta_id) -{ - unsigned long flags; - __le16 key_flags = 0; - struct il_addsta_cmd sta_cmd; - - lockdep_assert_held(&il->mutex); - - key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK); - key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); - key_flags &= ~STA_KEY_FLG_INVALID; - - if (sta_id == il->hw_params.bcast_id) - key_flags |= STA_KEY_MULTICAST_MSK; - - keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - - spin_lock_irqsave(&il->sta_lock, flags); - il->stations[sta_id].keyinfo.cipher = keyconf->cipher; - il->stations[sta_id].keyinfo.keylen = keyconf->keylen; - - memcpy(il->stations[sta_id].keyinfo.key, keyconf->key, keyconf->keylen); - - memcpy(il->stations[sta_id].sta.key.key, keyconf->key, keyconf->keylen); - - if ((il->stations[sta_id].sta.key. - key_flags & STA_KEY_FLG_ENCRYPT_MSK) == STA_KEY_FLG_NO_ENC) - il->stations[sta_id].sta.key.key_offset = - il_get_free_ucode_key_idx(il); - /* else, we are overriding an existing key => no need to allocated room - * in uCode. */ - - WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, - "no space for a new key"); - - il->stations[sta_id].sta.key.key_flags = key_flags; - il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; - il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - - memcpy(&sta_cmd, &il->stations[sta_id].sta, - sizeof(struct il_addsta_cmd)); - spin_unlock_irqrestore(&il->sta_lock, flags); - - return il_send_add_sta(il, &sta_cmd, CMD_SYNC); -} - -static int -il4965_set_tkip_dynamic_key_info(struct il_priv *il, - struct ieee80211_key_conf *keyconf, u8 sta_id) -{ - unsigned long flags; - int ret = 0; - __le16 key_flags = 0; - - key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK); - key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); - key_flags &= ~STA_KEY_FLG_INVALID; - - if (sta_id == il->hw_params.bcast_id) - key_flags |= STA_KEY_MULTICAST_MSK; - - keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; - - spin_lock_irqsave(&il->sta_lock, flags); - - il->stations[sta_id].keyinfo.cipher = keyconf->cipher; - il->stations[sta_id].keyinfo.keylen = 16; - - if ((il->stations[sta_id].sta.key. - key_flags & STA_KEY_FLG_ENCRYPT_MSK) == STA_KEY_FLG_NO_ENC) - il->stations[sta_id].sta.key.key_offset = - il_get_free_ucode_key_idx(il); - /* else, we are overriding an existing key => no need to allocated room - * in uCode. */ - - WARN(il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, - "no space for a new key"); - - il->stations[sta_id].sta.key.key_flags = key_flags; - - /* This copy is acutally not needed: we get the key with each TX */ - memcpy(il->stations[sta_id].keyinfo.key, keyconf->key, 16); - - memcpy(il->stations[sta_id].sta.key.key, keyconf->key, 16); - - spin_unlock_irqrestore(&il->sta_lock, flags); - - return ret; -} - -void -il4965_update_tkip_key(struct il_priv *il, struct ieee80211_key_conf *keyconf, - struct ieee80211_sta *sta, u32 iv32, u16 *phase1key) -{ - u8 sta_id; - unsigned long flags; - int i; - - if (il_scan_cancel(il)) { - /* cancel scan failed, just live w/ bad key and rely - briefly on SW decryption */ - return; - } - - sta_id = il_sta_id_or_broadcast(il, sta); - if (sta_id == IL_INVALID_STATION) - return; - - spin_lock_irqsave(&il->sta_lock, flags); - - il->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32; - - for (i = 0; i < 5; i++) - il->stations[sta_id].sta.key.tkip_rx_ttak[i] = - cpu_to_le16(phase1key[i]); - - il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; - il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - - il_send_add_sta(il, &il->stations[sta_id].sta, CMD_ASYNC); - - spin_unlock_irqrestore(&il->sta_lock, flags); -} - -int -il4965_remove_dynamic_key(struct il_priv *il, - struct ieee80211_key_conf *keyconf, u8 sta_id) -{ - unsigned long flags; - u16 key_flags; - u8 keyidx; - struct il_addsta_cmd sta_cmd; - - lockdep_assert_held(&il->mutex); - - il->_4965.key_mapping_keys--; - - spin_lock_irqsave(&il->sta_lock, flags); - key_flags = le16_to_cpu(il->stations[sta_id].sta.key.key_flags); - keyidx = (key_flags >> STA_KEY_FLG_KEYID_POS) & 0x3; - - D_WEP("Remove dynamic key: idx=%d sta=%d\n", keyconf->keyidx, sta_id); - - if (keyconf->keyidx != keyidx) { - /* We need to remove a key with idx different that the one - * in the uCode. This means that the key we need to remove has - * been replaced by another one with different idx. - * Don't do anything and return ok - */ - spin_unlock_irqrestore(&il->sta_lock, flags); - return 0; - } - - if (il->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_INVALID) { - IL_WARN("Removing wrong key %d 0x%x\n", keyconf->keyidx, - key_flags); - spin_unlock_irqrestore(&il->sta_lock, flags); - return 0; - } - - if (!test_and_clear_bit - (il->stations[sta_id].sta.key.key_offset, &il->ucode_key_table)) - IL_ERR("idx %d not used in uCode key table.\n", - il->stations[sta_id].sta.key.key_offset); - memset(&il->stations[sta_id].keyinfo, 0, sizeof(struct il_hw_key)); - memset(&il->stations[sta_id].sta.key, 0, sizeof(struct il4965_keyinfo)); - il->stations[sta_id].sta.key.key_flags = - STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID; - il->stations[sta_id].sta.key.key_offset = keyconf->hw_key_idx; - il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; - il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - - if (il_is_rfkill(il)) { - D_WEP - ("Not sending C_ADD_STA command because RFKILL enabled.\n"); - spin_unlock_irqrestore(&il->sta_lock, flags); - return 0; - } - memcpy(&sta_cmd, &il->stations[sta_id].sta, - sizeof(struct il_addsta_cmd)); - spin_unlock_irqrestore(&il->sta_lock, flags); - - return il_send_add_sta(il, &sta_cmd, CMD_SYNC); -} - -int -il4965_set_dynamic_key(struct il_priv *il, struct ieee80211_key_conf *keyconf, - u8 sta_id) -{ - int ret; - - lockdep_assert_held(&il->mutex); - - il->_4965.key_mapping_keys++; - keyconf->hw_key_idx = HW_KEY_DYNAMIC; - - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_CCMP: - ret = - il4965_set_ccmp_dynamic_key_info(il, keyconf, sta_id); - break; - case WLAN_CIPHER_SUITE_TKIP: - ret = - il4965_set_tkip_dynamic_key_info(il, keyconf, sta_id); - break; - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - ret = il4965_set_wep_dynamic_key_info(il, keyconf, sta_id); - break; - default: - IL_ERR("Unknown alg: %s cipher = %x\n", __func__, - keyconf->cipher); - ret = -EINVAL; - } - - D_WEP("Set dynamic key: cipher=%x len=%d idx=%d sta=%d ret=%d\n", - keyconf->cipher, keyconf->keylen, keyconf->keyidx, sta_id, ret); - - return ret; -} - -/** - * il4965_alloc_bcast_station - add broadcast station into driver's station table. - * - * This adds the broadcast station into the driver's station table - * and marks it driver active, so that it will be restored to the - * device at the next best time. - */ -int -il4965_alloc_bcast_station(struct il_priv *il) -{ - struct il_link_quality_cmd *link_cmd; - unsigned long flags; - u8 sta_id; - - spin_lock_irqsave(&il->sta_lock, flags); - sta_id = il_prep_station(il, il_bcast_addr, false, NULL); - if (sta_id == IL_INVALID_STATION) { - IL_ERR("Unable to prepare broadcast station\n"); - spin_unlock_irqrestore(&il->sta_lock, flags); - - return -EINVAL; - } - - il->stations[sta_id].used |= IL_STA_DRIVER_ACTIVE; - il->stations[sta_id].used |= IL_STA_BCAST; - spin_unlock_irqrestore(&il->sta_lock, flags); - - link_cmd = il4965_sta_alloc_lq(il, sta_id); - if (!link_cmd) { - IL_ERR - ("Unable to initialize rate scaling for bcast station.\n"); - return -ENOMEM; - } - - spin_lock_irqsave(&il->sta_lock, flags); - il->stations[sta_id].lq = link_cmd; - spin_unlock_irqrestore(&il->sta_lock, flags); - - return 0; -} - -/** - * il4965_update_bcast_station - update broadcast station's LQ command - * - * Only used by iwl4965. Placed here to have all bcast station management - * code together. - */ -static int -il4965_update_bcast_station(struct il_priv *il) -{ - unsigned long flags; - struct il_link_quality_cmd *link_cmd; - u8 sta_id = il->hw_params.bcast_id; - - link_cmd = il4965_sta_alloc_lq(il, sta_id); - if (!link_cmd) { - IL_ERR("Unable to initialize rate scaling for bcast sta.\n"); - return -ENOMEM; - } - - spin_lock_irqsave(&il->sta_lock, flags); - if (il->stations[sta_id].lq) - kfree(il->stations[sta_id].lq); - else - D_INFO("Bcast sta rate scaling has not been initialized.\n"); - il->stations[sta_id].lq = link_cmd; - spin_unlock_irqrestore(&il->sta_lock, flags); - - return 0; -} - -int -il4965_update_bcast_stations(struct il_priv *il) -{ - return il4965_update_bcast_station(il); -} - -/** - * il4965_sta_tx_modify_enable_tid - Enable Tx for this TID in station table - */ -int -il4965_sta_tx_modify_enable_tid(struct il_priv *il, int sta_id, int tid) -{ - unsigned long flags; - struct il_addsta_cmd sta_cmd; - - lockdep_assert_held(&il->mutex); - - /* Remove "disable" flag, to enable Tx for this TID */ - spin_lock_irqsave(&il->sta_lock, flags); - il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX; - il->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid)); - il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - memcpy(&sta_cmd, &il->stations[sta_id].sta, - sizeof(struct il_addsta_cmd)); - spin_unlock_irqrestore(&il->sta_lock, flags); - - return il_send_add_sta(il, &sta_cmd, CMD_SYNC); -} - -int -il4965_sta_rx_agg_start(struct il_priv *il, struct ieee80211_sta *sta, int tid, - u16 ssn) -{ - unsigned long flags; - int sta_id; - struct il_addsta_cmd sta_cmd; - - lockdep_assert_held(&il->mutex); - - sta_id = il_sta_id(sta); - if (sta_id == IL_INVALID_STATION) - return -ENXIO; - - spin_lock_irqsave(&il->sta_lock, flags); - il->stations[sta_id].sta.station_flags_msk = 0; - il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK; - il->stations[sta_id].sta.add_immediate_ba_tid = (u8) tid; - il->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn); - il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - memcpy(&sta_cmd, &il->stations[sta_id].sta, - sizeof(struct il_addsta_cmd)); - spin_unlock_irqrestore(&il->sta_lock, flags); - - return il_send_add_sta(il, &sta_cmd, CMD_SYNC); -} - -int -il4965_sta_rx_agg_stop(struct il_priv *il, struct ieee80211_sta *sta, int tid) -{ - unsigned long flags; - int sta_id; - struct il_addsta_cmd sta_cmd; - - lockdep_assert_held(&il->mutex); - - sta_id = il_sta_id(sta); - if (sta_id == IL_INVALID_STATION) { - IL_ERR("Invalid station for AGG tid %d\n", tid); - return -ENXIO; - } - - spin_lock_irqsave(&il->sta_lock, flags); - il->stations[sta_id].sta.station_flags_msk = 0; - il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK; - il->stations[sta_id].sta.remove_immediate_ba_tid = (u8) tid; - il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - memcpy(&sta_cmd, &il->stations[sta_id].sta, - sizeof(struct il_addsta_cmd)); - spin_unlock_irqrestore(&il->sta_lock, flags); - - return il_send_add_sta(il, &sta_cmd, CMD_SYNC); -} - -void -il4965_sta_modify_sleep_tx_count(struct il_priv *il, int sta_id, int cnt) -{ - unsigned long flags; - - spin_lock_irqsave(&il->sta_lock, flags); - il->stations[sta_id].sta.station_flags |= STA_FLG_PWR_SAVE_MSK; - il->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK; - il->stations[sta_id].sta.sta.modify_mask = - STA_MODIFY_SLEEP_TX_COUNT_MSK; - il->stations[sta_id].sta.sleep_tx_count = cpu_to_le16(cnt); - il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - il_send_add_sta(il, &il->stations[sta_id].sta, CMD_ASYNC); - spin_unlock_irqrestore(&il->sta_lock, flags); - -} - -void -il4965_update_chain_flags(struct il_priv *il) -{ - if (il->ops->set_rxon_chain) { - il->ops->set_rxon_chain(il); - if (il->active.rx_chain != il->staging.rx_chain) - il_commit_rxon(il); - } -} - -static void -il4965_clear_free_frames(struct il_priv *il) -{ - struct list_head *element; - - D_INFO("%d frames on pre-allocated heap on clear.\n", il->frames_count); - - while (!list_empty(&il->free_frames)) { - element = il->free_frames.next; - list_del(element); - kfree(list_entry(element, struct il_frame, list)); - il->frames_count--; - } - - if (il->frames_count) { - IL_WARN("%d frames still in use. Did we lose one?\n", - il->frames_count); - il->frames_count = 0; - } -} - -static struct il_frame * -il4965_get_free_frame(struct il_priv *il) -{ - struct il_frame *frame; - struct list_head *element; - if (list_empty(&il->free_frames)) { - frame = kzalloc(sizeof(*frame), GFP_KERNEL); - if (!frame) { - IL_ERR("Could not allocate frame!\n"); - return NULL; - } - - il->frames_count++; - return frame; - } - - element = il->free_frames.next; - list_del(element); - return list_entry(element, struct il_frame, list); -} - -static void -il4965_free_frame(struct il_priv *il, struct il_frame *frame) -{ - memset(frame, 0, sizeof(*frame)); - list_add(&frame->list, &il->free_frames); -} - -static u32 -il4965_fill_beacon_frame(struct il_priv *il, struct ieee80211_hdr *hdr, - int left) -{ - lockdep_assert_held(&il->mutex); - - if (!il->beacon_skb) - return 0; - - if (il->beacon_skb->len > left) - return 0; - - memcpy(hdr, il->beacon_skb->data, il->beacon_skb->len); - - return il->beacon_skb->len; -} - -/* Parse the beacon frame to find the TIM element and set tim_idx & tim_size */ -static void -il4965_set_beacon_tim(struct il_priv *il, - struct il_tx_beacon_cmd *tx_beacon_cmd, u8 * beacon, - u32 frame_size) -{ - u16 tim_idx; - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)beacon; - - /* - * The idx is relative to frame start but we start looking at the - * variable-length part of the beacon. - */ - tim_idx = mgmt->u.beacon.variable - beacon; - - /* Parse variable-length elements of beacon to find WLAN_EID_TIM */ - while ((tim_idx < (frame_size - 2)) && - (beacon[tim_idx] != WLAN_EID_TIM)) - tim_idx += beacon[tim_idx + 1] + 2; - - /* If TIM field was found, set variables */ - if ((tim_idx < (frame_size - 1)) && (beacon[tim_idx] == WLAN_EID_TIM)) { - tx_beacon_cmd->tim_idx = cpu_to_le16(tim_idx); - tx_beacon_cmd->tim_size = beacon[tim_idx + 1]; - } else - IL_WARN("Unable to find TIM Element in beacon\n"); -} - -static unsigned int -il4965_hw_get_beacon_cmd(struct il_priv *il, struct il_frame *frame) -{ - struct il_tx_beacon_cmd *tx_beacon_cmd; - u32 frame_size; - u32 rate_flags; - u32 rate; - /* - * We have to set up the TX command, the TX Beacon command, and the - * beacon contents. - */ - - lockdep_assert_held(&il->mutex); - - if (!il->beacon_enabled) { - IL_ERR("Trying to build beacon without beaconing enabled\n"); - return 0; - } - - /* Initialize memory */ - tx_beacon_cmd = &frame->u.beacon; - memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); - - /* Set up TX beacon contents */ - frame_size = - il4965_fill_beacon_frame(il, tx_beacon_cmd->frame, - sizeof(frame->u) - sizeof(*tx_beacon_cmd)); - if (WARN_ON_ONCE(frame_size > MAX_MPDU_SIZE)) - return 0; - if (!frame_size) - return 0; - - /* Set up TX command fields */ - tx_beacon_cmd->tx.len = cpu_to_le16((u16) frame_size); - tx_beacon_cmd->tx.sta_id = il->hw_params.bcast_id; - tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; - tx_beacon_cmd->tx.tx_flags = - TX_CMD_FLG_SEQ_CTL_MSK | TX_CMD_FLG_TSF_MSK | - TX_CMD_FLG_STA_RATE_MSK; - - /* Set up TX beacon command fields */ - il4965_set_beacon_tim(il, tx_beacon_cmd, (u8 *) tx_beacon_cmd->frame, - frame_size); - - /* Set up packet rate and flags */ - rate = il_get_lowest_plcp(il); - il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant); - rate_flags = BIT(il->mgmt_tx_ant) << RATE_MCS_ANT_POS; - if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE)) - rate_flags |= RATE_MCS_CCK_MSK; - tx_beacon_cmd->tx.rate_n_flags = cpu_to_le32(rate | rate_flags); - - return sizeof(*tx_beacon_cmd) + frame_size; -} - -int -il4965_send_beacon_cmd(struct il_priv *il) -{ - struct il_frame *frame; - unsigned int frame_size; - int rc; - - frame = il4965_get_free_frame(il); - if (!frame) { - IL_ERR("Could not obtain free frame buffer for beacon " - "command.\n"); - return -ENOMEM; - } - - frame_size = il4965_hw_get_beacon_cmd(il, frame); - if (!frame_size) { - IL_ERR("Error configuring the beacon command\n"); - il4965_free_frame(il, frame); - return -EINVAL; - } - - rc = il_send_cmd_pdu(il, C_TX_BEACON, frame_size, &frame->u.cmd[0]); - - il4965_free_frame(il, frame); - - return rc; -} - -static inline dma_addr_t -il4965_tfd_tb_get_addr(struct il_tfd *tfd, u8 idx) -{ - struct il_tfd_tb *tb = &tfd->tbs[idx]; - - dma_addr_t addr = get_unaligned_le32(&tb->lo); - if (sizeof(dma_addr_t) > sizeof(u32)) - addr |= - ((dma_addr_t) (le16_to_cpu(tb->hi_n_len) & 0xF) << 16) << - 16; - - return addr; -} - -static inline u16 -il4965_tfd_tb_get_len(struct il_tfd *tfd, u8 idx) -{ - struct il_tfd_tb *tb = &tfd->tbs[idx]; - - return le16_to_cpu(tb->hi_n_len) >> 4; -} - -static inline void -il4965_tfd_set_tb(struct il_tfd *tfd, u8 idx, dma_addr_t addr, u16 len) -{ - struct il_tfd_tb *tb = &tfd->tbs[idx]; - u16 hi_n_len = len << 4; - - put_unaligned_le32(addr, &tb->lo); - if (sizeof(dma_addr_t) > sizeof(u32)) - hi_n_len |= ((addr >> 16) >> 16) & 0xF; - - tb->hi_n_len = cpu_to_le16(hi_n_len); - - tfd->num_tbs = idx + 1; -} - -static inline u8 -il4965_tfd_get_num_tbs(struct il_tfd *tfd) -{ - return tfd->num_tbs & 0x1f; -} - -/** - * il4965_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr] - * @il - driver ilate data - * @txq - tx queue - * - * Does NOT advance any TFD circular buffer read/write idxes - * Does NOT free the TFD itself (which is within circular buffer) - */ -void -il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq) -{ - struct il_tfd *tfd_tmp = (struct il_tfd *)txq->tfds; - struct il_tfd *tfd; - struct pci_dev *dev = il->pci_dev; - int idx = txq->q.read_ptr; - int i; - int num_tbs; - - tfd = &tfd_tmp[idx]; - - /* Sanity check on number of chunks */ - num_tbs = il4965_tfd_get_num_tbs(tfd); - - if (num_tbs >= IL_NUM_OF_TBS) { - IL_ERR("Too many chunks: %i\n", num_tbs); - /* @todo issue fatal error, it is quite serious situation */ - return; - } - - /* Unmap tx_cmd */ - if (num_tbs) - pci_unmap_single(dev, dma_unmap_addr(&txq->meta[idx], mapping), - dma_unmap_len(&txq->meta[idx], len), - PCI_DMA_BIDIRECTIONAL); - - /* Unmap chunks, if any. */ - for (i = 1; i < num_tbs; i++) - pci_unmap_single(dev, il4965_tfd_tb_get_addr(tfd, i), - il4965_tfd_tb_get_len(tfd, i), - PCI_DMA_TODEVICE); - - /* free SKB */ - if (txq->skbs) { - struct sk_buff *skb = txq->skbs[txq->q.read_ptr]; - - /* can be called from irqs-disabled context */ - if (skb) { - dev_kfree_skb_any(skb); - txq->skbs[txq->q.read_ptr] = NULL; - } - } -} - -int -il4965_hw_txq_attach_buf_to_tfd(struct il_priv *il, struct il_tx_queue *txq, - dma_addr_t addr, u16 len, u8 reset, u8 pad) -{ - struct il_queue *q; - struct il_tfd *tfd, *tfd_tmp; - u32 num_tbs; - - q = &txq->q; - tfd_tmp = (struct il_tfd *)txq->tfds; - tfd = &tfd_tmp[q->write_ptr]; - - if (reset) - memset(tfd, 0, sizeof(*tfd)); - - num_tbs = il4965_tfd_get_num_tbs(tfd); - - /* Each TFD can point to a maximum 20 Tx buffers */ - if (num_tbs >= IL_NUM_OF_TBS) { - IL_ERR("Error can not send more than %d chunks\n", - IL_NUM_OF_TBS); - return -EINVAL; - } - - BUG_ON(addr & ~DMA_BIT_MASK(36)); - if (unlikely(addr & ~IL_TX_DMA_MASK)) - IL_ERR("Unaligned address = %llx\n", (unsigned long long)addr); - - il4965_tfd_set_tb(tfd, num_tbs, addr, len); - - return 0; -} - -/* - * Tell nic where to find circular buffer of Tx Frame Descriptors for - * given Tx queue, and enable the DMA channel used for that queue. - * - * 4965 supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA - * channels supported in hardware. - */ -int -il4965_hw_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq) -{ - int txq_id = txq->q.id; - - /* Circular buffer (TFD queue in DRAM) physical base address */ - il_wr(il, FH49_MEM_CBBC_QUEUE(txq_id), txq->q.dma_addr >> 8); - - return 0; -} - -/****************************************************************************** - * - * Generic RX handler implementations - * - ******************************************************************************/ -static void -il4965_hdl_alive(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il_alive_resp *palive; - struct delayed_work *pwork; - - palive = &pkt->u.alive_frame; - - D_INFO("Alive ucode status 0x%08X revision " "0x%01X 0x%01X\n", - palive->is_valid, palive->ver_type, palive->ver_subtype); - - if (palive->ver_subtype == INITIALIZE_SUBTYPE) { - D_INFO("Initialization Alive received.\n"); - memcpy(&il->card_alive_init, &pkt->u.alive_frame, - sizeof(struct il_init_alive_resp)); - pwork = &il->init_alive_start; - } else { - D_INFO("Runtime Alive received.\n"); - memcpy(&il->card_alive, &pkt->u.alive_frame, - sizeof(struct il_alive_resp)); - pwork = &il->alive_start; - } - - /* We delay the ALIVE response by 5ms to - * give the HW RF Kill time to activate... */ - if (palive->is_valid == UCODE_VALID_OK) - queue_delayed_work(il->workqueue, pwork, msecs_to_jiffies(5)); - else - IL_WARN("uCode did not respond OK.\n"); -} - -/** - * il4965_bg_stats_periodic - Timer callback to queue stats - * - * This callback is provided in order to send a stats request. - * - * This timer function is continually reset to execute within - * 60 seconds since the last N_STATS was received. We need to - * ensure we receive the stats in order to update the temperature - * used for calibrating the TXPOWER. - */ -static void -il4965_bg_stats_periodic(unsigned long data) -{ - struct il_priv *il = (struct il_priv *)data; - - if (test_bit(S_EXIT_PENDING, &il->status)) - return; - - /* dont send host command if rf-kill is on */ - if (!il_is_ready_rf(il)) - return; - - il_send_stats_request(il, CMD_ASYNC, false); -} - -static void -il4965_hdl_beacon(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il4965_beacon_notif *beacon = - (struct il4965_beacon_notif *)pkt->u.raw; -#ifdef CONFIG_IWLEGACY_DEBUG - u8 rate = il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); - - D_RX("beacon status %x retries %d iss %d tsf:0x%.8x%.8x rate %d\n", - le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK, - beacon->beacon_notify_hdr.failure_frame, - le32_to_cpu(beacon->ibss_mgr_status), - le32_to_cpu(beacon->high_tsf), le32_to_cpu(beacon->low_tsf), rate); -#endif - il->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); -} - -static void -il4965_perform_ct_kill_task(struct il_priv *il) -{ - unsigned long flags; - - D_POWER("Stop all queues\n"); - - if (il->mac80211_registered) - ieee80211_stop_queues(il->hw); - - _il_wr(il, CSR_UCODE_DRV_GP1_SET, - CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); - _il_rd(il, CSR_UCODE_DRV_GP1); - - spin_lock_irqsave(&il->reg_lock, flags); - if (likely(_il_grab_nic_access(il))) - _il_release_nic_access(il); - spin_unlock_irqrestore(&il->reg_lock, flags); -} - -/* Handle notification from uCode that card's power state is changing - * due to software, hardware, or critical temperature RFKILL */ -static void -il4965_hdl_card_state(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); - unsigned long status = il->status; - - D_RF_KILL("Card state received: HW:%s SW:%s CT:%s\n", - (flags & HW_CARD_DISABLED) ? "Kill" : "On", - (flags & SW_CARD_DISABLED) ? "Kill" : "On", - (flags & CT_CARD_DISABLED) ? "Reached" : "Not reached"); - - if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED | CT_CARD_DISABLED)) { - - _il_wr(il, CSR_UCODE_DRV_GP1_SET, - CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - - il_wr(il, HBUS_TARG_MBX_C, HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); - - if (!(flags & RXON_CARD_DISABLED)) { - _il_wr(il, CSR_UCODE_DRV_GP1_CLR, - CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - il_wr(il, HBUS_TARG_MBX_C, - HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); - } - } - - if (flags & CT_CARD_DISABLED) - il4965_perform_ct_kill_task(il); - - if (flags & HW_CARD_DISABLED) - set_bit(S_RFKILL, &il->status); - else - clear_bit(S_RFKILL, &il->status); - - if (!(flags & RXON_CARD_DISABLED)) - il_scan_cancel(il); - - if ((test_bit(S_RFKILL, &status) != - test_bit(S_RFKILL, &il->status))) - wiphy_rfkill_set_hw_state(il->hw->wiphy, - test_bit(S_RFKILL, &il->status)); - else - wake_up(&il->wait_command_queue); -} - -/** - * il4965_setup_handlers - Initialize Rx handler callbacks - * - * Setup the RX handlers for each of the reply types sent from the uCode - * to the host. - * - * This function chains into the hardware specific files for them to setup - * any hardware specific handlers as well. - */ -static void -il4965_setup_handlers(struct il_priv *il) -{ - il->handlers[N_ALIVE] = il4965_hdl_alive; - il->handlers[N_ERROR] = il_hdl_error; - il->handlers[N_CHANNEL_SWITCH] = il_hdl_csa; - il->handlers[N_SPECTRUM_MEASUREMENT] = il_hdl_spectrum_measurement; - il->handlers[N_PM_SLEEP] = il_hdl_pm_sleep; - il->handlers[N_PM_DEBUG_STATS] = il_hdl_pm_debug_stats; - il->handlers[N_BEACON] = il4965_hdl_beacon; - - /* - * The same handler is used for both the REPLY to a discrete - * stats request from the host as well as for the periodic - * stats notifications (after received beacons) from the uCode. - */ - il->handlers[C_STATS] = il4965_hdl_c_stats; - il->handlers[N_STATS] = il4965_hdl_stats; - - il_setup_rx_scan_handlers(il); - - /* status change handler */ - il->handlers[N_CARD_STATE] = il4965_hdl_card_state; - - il->handlers[N_MISSED_BEACONS] = il4965_hdl_missed_beacon; - /* Rx handlers */ - il->handlers[N_RX_PHY] = il4965_hdl_rx_phy; - il->handlers[N_RX_MPDU] = il4965_hdl_rx; - il->handlers[N_RX] = il4965_hdl_rx; - /* block ack */ - il->handlers[N_COMPRESSED_BA] = il4965_hdl_compressed_ba; - /* Tx response */ - il->handlers[C_TX] = il4965_hdl_tx; -} - -/** - * il4965_rx_handle - Main entry function for receiving responses from uCode - * - * Uses the il->handlers callback function array to invoke - * the appropriate handlers, including command responses, - * frame-received notifications, and other notifications. - */ -void -il4965_rx_handle(struct il_priv *il) -{ - struct il_rx_buf *rxb; - struct il_rx_pkt *pkt; - struct il_rx_queue *rxq = &il->rxq; - u32 r, i; - int reclaim; - unsigned long flags; - u8 fill_rx = 0; - u32 count = 8; - int total_empty; - - /* uCode's read idx (stored in shared DRAM) indicates the last Rx - * buffer that the driver may process (last buffer filled by ucode). */ - r = le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF; - i = rxq->read; - - /* Rx interrupt, but nothing sent from uCode */ - if (i == r) - D_RX("r = %d, i = %d\n", r, i); - - /* calculate total frames need to be restock after handling RX */ - total_empty = r - rxq->write_actual; - if (total_empty < 0) - total_empty += RX_QUEUE_SIZE; - - if (total_empty > (RX_QUEUE_SIZE / 2)) - fill_rx = 1; - - while (i != r) { - int len; - - rxb = rxq->queue[i]; - - /* If an RXB doesn't have a Rx queue slot associated with it, - * then a bug has been introduced in the queue refilling - * routines -- catch it here */ - BUG_ON(rxb == NULL); - - rxq->queue[i] = NULL; - - pci_unmap_page(il->pci_dev, rxb->page_dma, - PAGE_SIZE << il->hw_params.rx_page_order, - PCI_DMA_FROMDEVICE); - pkt = rxb_addr(rxb); - - len = le32_to_cpu(pkt->len_n_flags) & IL_RX_FRAME_SIZE_MSK; - len += sizeof(u32); /* account for status word */ - - /* Reclaim a command buffer only if this packet is a response - * to a (driver-originated) command. - * If the packet (e.g. Rx frame) originated from uCode, - * there is no command buffer to reclaim. - * Ucode should set SEQ_RX_FRAME bit if ucode-originated, - * but apparently a few don't get set; catch them here. */ - reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME) && - (pkt->hdr.cmd != N_RX_PHY) && (pkt->hdr.cmd != N_RX) && - (pkt->hdr.cmd != N_RX_MPDU) && - (pkt->hdr.cmd != N_COMPRESSED_BA) && - (pkt->hdr.cmd != N_STATS) && (pkt->hdr.cmd != C_TX); - - /* Based on type of command response or notification, - * handle those that need handling via function in - * handlers table. See il4965_setup_handlers() */ - if (il->handlers[pkt->hdr.cmd]) { - D_RX("r = %d, i = %d, %s, 0x%02x\n", r, i, - il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); - il->isr_stats.handlers[pkt->hdr.cmd]++; - il->handlers[pkt->hdr.cmd] (il, rxb); - } else { - /* No handling needed */ - D_RX("r %d i %d No handler needed for %s, 0x%02x\n", r, - i, il_get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); - } - - /* - * XXX: After here, we should always check rxb->page - * against NULL before touching it or its virtual - * memory (pkt). Because some handler might have - * already taken or freed the pages. - */ - - if (reclaim) { - /* Invoke any callbacks, transfer the buffer to caller, - * and fire off the (possibly) blocking il_send_cmd() - * as we reclaim the driver command queue */ - if (rxb->page) - il_tx_cmd_complete(il, rxb); - else - IL_WARN("Claim null rxb?\n"); - } - - /* Reuse the page if possible. For notification packets and - * SKBs that fail to Rx correctly, add them back into the - * rx_free list for reuse later. */ - spin_lock_irqsave(&rxq->lock, flags); - if (rxb->page != NULL) { - rxb->page_dma = - pci_map_page(il->pci_dev, rxb->page, 0, - PAGE_SIZE << il->hw_params. - rx_page_order, PCI_DMA_FROMDEVICE); - - if (unlikely(pci_dma_mapping_error(il->pci_dev, - rxb->page_dma))) { - __il_free_pages(il, rxb->page); - rxb->page = NULL; - list_add_tail(&rxb->list, &rxq->rx_used); - } else { - list_add_tail(&rxb->list, &rxq->rx_free); - rxq->free_count++; - } - } else - list_add_tail(&rxb->list, &rxq->rx_used); - - spin_unlock_irqrestore(&rxq->lock, flags); - - i = (i + 1) & RX_QUEUE_MASK; - /* If there are a lot of unused frames, - * restock the Rx queue so ucode wont assert. */ - if (fill_rx) { - count++; - if (count >= 8) { - rxq->read = i; - il4965_rx_replenish_now(il); - count = 0; - } - } - } - - /* Backtrack one entry */ - rxq->read = i; - if (fill_rx) - il4965_rx_replenish_now(il); - else - il4965_rx_queue_restock(il); -} - -/* call this function to flush any scheduled tasklet */ -static inline void -il4965_synchronize_irq(struct il_priv *il) -{ - /* wait to make sure we flush pending tasklet */ - synchronize_irq(il->pci_dev->irq); - tasklet_kill(&il->irq_tasklet); -} - -static void -il4965_irq_tasklet(struct il_priv *il) -{ - u32 inta, handled = 0; - u32 inta_fh; - unsigned long flags; - u32 i; -#ifdef CONFIG_IWLEGACY_DEBUG - u32 inta_mask; -#endif - - spin_lock_irqsave(&il->lock, flags); - - /* Ack/clear/reset pending uCode interrupts. - * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, - * and will clear only when CSR_FH_INT_STATUS gets cleared. */ - inta = _il_rd(il, CSR_INT); - _il_wr(il, CSR_INT, inta); - - /* Ack/clear/reset pending flow-handler (DMA) interrupts. - * Any new interrupts that happen after this, either while we're - * in this tasklet, or later, will show up in next ISR/tasklet. */ - inta_fh = _il_rd(il, CSR_FH_INT_STATUS); - _il_wr(il, CSR_FH_INT_STATUS, inta_fh); - -#ifdef CONFIG_IWLEGACY_DEBUG - if (il_get_debug_level(il) & IL_DL_ISR) { - /* just for debug */ - inta_mask = _il_rd(il, CSR_INT_MASK); - D_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, - inta_mask, inta_fh); - } -#endif - - spin_unlock_irqrestore(&il->lock, flags); - - /* Since CSR_INT and CSR_FH_INT_STATUS reads and clears are not - * atomic, make sure that inta covers all the interrupts that - * we've discovered, even if FH interrupt came in just after - * reading CSR_INT. */ - if (inta_fh & CSR49_FH_INT_RX_MASK) - inta |= CSR_INT_BIT_FH_RX; - if (inta_fh & CSR49_FH_INT_TX_MASK) - inta |= CSR_INT_BIT_FH_TX; - - /* Now service all interrupt bits discovered above. */ - if (inta & CSR_INT_BIT_HW_ERR) { - IL_ERR("Hardware error detected. Restarting.\n"); - - /* Tell the device to stop sending interrupts */ - il_disable_interrupts(il); - - il->isr_stats.hw++; - il_irq_handle_error(il); - - handled |= CSR_INT_BIT_HW_ERR; - - return; - } -#ifdef CONFIG_IWLEGACY_DEBUG - if (il_get_debug_level(il) & (IL_DL_ISR)) { - /* NIC fires this, but we don't use it, redundant with WAKEUP */ - if (inta & CSR_INT_BIT_SCD) { - D_ISR("Scheduler finished to transmit " - "the frame/frames.\n"); - il->isr_stats.sch++; - } - - /* Alive notification via Rx interrupt will do the real work */ - if (inta & CSR_INT_BIT_ALIVE) { - D_ISR("Alive interrupt\n"); - il->isr_stats.alive++; - } - } -#endif - /* Safely ignore these bits for debug checks below */ - inta &= ~(CSR_INT_BIT_SCD | CSR_INT_BIT_ALIVE); - - /* HW RF KILL switch toggled */ - if (inta & CSR_INT_BIT_RF_KILL) { - int hw_rf_kill = 0; - - if (!(_il_rd(il, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) - hw_rf_kill = 1; - - IL_WARN("RF_KILL bit toggled to %s.\n", - hw_rf_kill ? "disable radio" : "enable radio"); - - il->isr_stats.rfkill++; - - /* driver only loads ucode once setting the interface up. - * the driver allows loading the ucode even if the radio - * is killed. Hence update the killswitch state here. The - * rfkill handler will care about restarting if needed. - */ - if (hw_rf_kill) { - set_bit(S_RFKILL, &il->status); - } else { - clear_bit(S_RFKILL, &il->status); - il_force_reset(il, true); - } - wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rf_kill); - - handled |= CSR_INT_BIT_RF_KILL; - } - - /* Chip got too hot and stopped itself */ - if (inta & CSR_INT_BIT_CT_KILL) { - IL_ERR("Microcode CT kill error detected.\n"); - il->isr_stats.ctkill++; - handled |= CSR_INT_BIT_CT_KILL; - } - - /* Error detected by uCode */ - if (inta & CSR_INT_BIT_SW_ERR) { - IL_ERR("Microcode SW error detected. " " Restarting 0x%X.\n", - inta); - il->isr_stats.sw++; - il_irq_handle_error(il); - handled |= CSR_INT_BIT_SW_ERR; - } - - /* - * uCode wakes up after power-down sleep. - * Tell device about any new tx or host commands enqueued, - * and about any Rx buffers made available while asleep. - */ - if (inta & CSR_INT_BIT_WAKEUP) { - D_ISR("Wakeup interrupt\n"); - il_rx_queue_update_write_ptr(il, &il->rxq); - for (i = 0; i < il->hw_params.max_txq_num; i++) - il_txq_update_write_ptr(il, &il->txq[i]); - il->isr_stats.wakeup++; - handled |= CSR_INT_BIT_WAKEUP; - } - - /* All uCode command responses, including Tx command responses, - * Rx "responses" (frame-received notification), and other - * notifications from uCode come through here*/ - if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { - il4965_rx_handle(il); - il->isr_stats.rx++; - handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); - } - - /* This "Tx" DMA channel is used only for loading uCode */ - if (inta & CSR_INT_BIT_FH_TX) { - D_ISR("uCode load interrupt\n"); - il->isr_stats.tx++; - handled |= CSR_INT_BIT_FH_TX; - /* Wake up uCode load routine, now that load is complete */ - il->ucode_write_complete = 1; - wake_up(&il->wait_command_queue); - } - - if (inta & ~handled) { - IL_ERR("Unhandled INTA bits 0x%08x\n", inta & ~handled); - il->isr_stats.unhandled++; - } - - if (inta & ~(il->inta_mask)) { - IL_WARN("Disabled INTA bits 0x%08x were pending\n", - inta & ~il->inta_mask); - IL_WARN(" with FH49_INT = 0x%08x\n", inta_fh); - } - - /* Re-enable all interrupts */ - /* only Re-enable if disabled by irq */ - if (test_bit(S_INT_ENABLED, &il->status)) - il_enable_interrupts(il); - /* Re-enable RF_KILL if it occurred */ - else if (handled & CSR_INT_BIT_RF_KILL) - il_enable_rfkill_int(il); - -#ifdef CONFIG_IWLEGACY_DEBUG - if (il_get_debug_level(il) & (IL_DL_ISR)) { - inta = _il_rd(il, CSR_INT); - inta_mask = _il_rd(il, CSR_INT_MASK); - inta_fh = _il_rd(il, CSR_FH_INT_STATUS); - D_ISR("End inta 0x%08x, enabled 0x%08x, fh 0x%08x, " - "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags); - } -#endif -} - -/***************************************************************************** - * - * sysfs attributes - * - *****************************************************************************/ - -#ifdef CONFIG_IWLEGACY_DEBUG - -/* - * The following adds a new attribute to the sysfs representation - * of this device driver (i.e. a new file in /sys/class/net/wlan0/device/) - * used for controlling the debug level. - * - * See the level definitions in iwl for details. - * - * The debug_level being managed using sysfs below is a per device debug - * level that is used instead of the global debug level if it (the per - * device debug level) is set. - */ -static ssize_t -il4965_show_debug_level(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct il_priv *il = dev_get_drvdata(d); - return sprintf(buf, "0x%08X\n", il_get_debug_level(il)); -} - -static ssize_t -il4965_store_debug_level(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct il_priv *il = dev_get_drvdata(d); - unsigned long val; - int ret; - - ret = strict_strtoul(buf, 0, &val); - if (ret) - IL_ERR("%s is not in hex or decimal form.\n", buf); - else - il->debug_level = val; - - return strnlen(buf, count); -} - -static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, il4965_show_debug_level, - il4965_store_debug_level); - -#endif /* CONFIG_IWLEGACY_DEBUG */ - -static ssize_t -il4965_show_temperature(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct il_priv *il = dev_get_drvdata(d); - - if (!il_is_alive(il)) - return -EAGAIN; - - return sprintf(buf, "%d\n", il->temperature); -} - -static DEVICE_ATTR(temperature, S_IRUGO, il4965_show_temperature, NULL); - -static ssize_t -il4965_show_tx_power(struct device *d, struct device_attribute *attr, char *buf) -{ - struct il_priv *il = dev_get_drvdata(d); - - if (!il_is_ready_rf(il)) - return sprintf(buf, "off\n"); - else - return sprintf(buf, "%d\n", il->tx_power_user_lmt); -} - -static ssize_t -il4965_store_tx_power(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct il_priv *il = dev_get_drvdata(d); - unsigned long val; - int ret; - - ret = strict_strtoul(buf, 10, &val); - if (ret) - IL_INFO("%s is not in decimal form.\n", buf); - else { - ret = il_set_tx_power(il, val, false); - if (ret) - IL_ERR("failed setting tx power (0x%d).\n", ret); - else - ret = count; - } - return ret; -} - -static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, il4965_show_tx_power, - il4965_store_tx_power); - -static struct attribute *il_sysfs_entries[] = { - &dev_attr_temperature.attr, - &dev_attr_tx_power.attr, -#ifdef CONFIG_IWLEGACY_DEBUG - &dev_attr_debug_level.attr, -#endif - NULL -}; - -static struct attribute_group il_attribute_group = { - .name = NULL, /* put in device directory */ - .attrs = il_sysfs_entries, -}; - -/****************************************************************************** - * - * uCode download functions - * - ******************************************************************************/ - -static void -il4965_dealloc_ucode_pci(struct il_priv *il) -{ - il_free_fw_desc(il->pci_dev, &il->ucode_code); - il_free_fw_desc(il->pci_dev, &il->ucode_data); - il_free_fw_desc(il->pci_dev, &il->ucode_data_backup); - il_free_fw_desc(il->pci_dev, &il->ucode_init); - il_free_fw_desc(il->pci_dev, &il->ucode_init_data); - il_free_fw_desc(il->pci_dev, &il->ucode_boot); -} - -static void -il4965_nic_start(struct il_priv *il) -{ - /* Remove all resets to allow NIC to operate */ - _il_wr(il, CSR_RESET, 0); -} - -static void il4965_ucode_callback(const struct firmware *ucode_raw, - void *context); -static int il4965_mac_setup_register(struct il_priv *il, u32 max_probe_length); - -static int __must_check -il4965_request_firmware(struct il_priv *il, bool first) -{ - const char *name_pre = il->cfg->fw_name_pre; - char tag[8]; - - if (first) { - il->fw_idx = il->cfg->ucode_api_max; - sprintf(tag, "%d", il->fw_idx); - } else { - il->fw_idx--; - sprintf(tag, "%d", il->fw_idx); - } - - if (il->fw_idx < il->cfg->ucode_api_min) { - IL_ERR("no suitable firmware found!\n"); - return -ENOENT; - } - - sprintf(il->firmware_name, "%s%s%s", name_pre, tag, ".ucode"); - - D_INFO("attempting to load firmware '%s'\n", il->firmware_name); - - return request_firmware_nowait(THIS_MODULE, 1, il->firmware_name, - &il->pci_dev->dev, GFP_KERNEL, il, - il4965_ucode_callback); -} - -struct il4965_firmware_pieces { - const void *inst, *data, *init, *init_data, *boot; - size_t inst_size, data_size, init_size, init_data_size, boot_size; -}; - -static int -il4965_load_firmware(struct il_priv *il, const struct firmware *ucode_raw, - struct il4965_firmware_pieces *pieces) -{ - struct il_ucode_header *ucode = (void *)ucode_raw->data; - u32 api_ver, hdr_size; - const u8 *src; - - il->ucode_ver = le32_to_cpu(ucode->ver); - api_ver = IL_UCODE_API(il->ucode_ver); - - switch (api_ver) { - default: - case 0: - case 1: - case 2: - hdr_size = 24; - if (ucode_raw->size < hdr_size) { - IL_ERR("File size too small!\n"); - return -EINVAL; - } - pieces->inst_size = le32_to_cpu(ucode->v1.inst_size); - pieces->data_size = le32_to_cpu(ucode->v1.data_size); - pieces->init_size = le32_to_cpu(ucode->v1.init_size); - pieces->init_data_size = le32_to_cpu(ucode->v1.init_data_size); - pieces->boot_size = le32_to_cpu(ucode->v1.boot_size); - src = ucode->v1.data; - break; - } - - /* Verify size of file vs. image size info in file's header */ - if (ucode_raw->size != - hdr_size + pieces->inst_size + pieces->data_size + - pieces->init_size + pieces->init_data_size + pieces->boot_size) { - - IL_ERR("uCode file size %d does not match expected size\n", - (int)ucode_raw->size); - return -EINVAL; - } - - pieces->inst = src; - src += pieces->inst_size; - pieces->data = src; - src += pieces->data_size; - pieces->init = src; - src += pieces->init_size; - pieces->init_data = src; - src += pieces->init_data_size; - pieces->boot = src; - src += pieces->boot_size; - - return 0; -} - -/** - * il4965_ucode_callback - callback when firmware was loaded - * - * If loaded successfully, copies the firmware into buffers - * for the card to fetch (via DMA). - */ -static void -il4965_ucode_callback(const struct firmware *ucode_raw, void *context) -{ - struct il_priv *il = context; - struct il_ucode_header *ucode; - int err; - struct il4965_firmware_pieces pieces; - const unsigned int api_max = il->cfg->ucode_api_max; - const unsigned int api_min = il->cfg->ucode_api_min; - u32 api_ver; - - u32 max_probe_length = 200; - u32 standard_phy_calibration_size = - IL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE; - - memset(&pieces, 0, sizeof(pieces)); - - if (!ucode_raw) { - if (il->fw_idx <= il->cfg->ucode_api_max) - IL_ERR("request for firmware file '%s' failed.\n", - il->firmware_name); - goto try_again; - } - - D_INFO("Loaded firmware file '%s' (%zd bytes).\n", il->firmware_name, - ucode_raw->size); - - /* Make sure that we got at least the API version number */ - if (ucode_raw->size < 4) { - IL_ERR("File size way too small!\n"); - goto try_again; - } - - /* Data from ucode file: header followed by uCode images */ - ucode = (struct il_ucode_header *)ucode_raw->data; - - err = il4965_load_firmware(il, ucode_raw, &pieces); - - if (err) - goto try_again; - - api_ver = IL_UCODE_API(il->ucode_ver); - - /* - * api_ver should match the api version forming part of the - * firmware filename ... but we don't check for that and only rely - * on the API version read from firmware header from here on forward - */ - if (api_ver < api_min || api_ver > api_max) { - IL_ERR("Driver unable to support your firmware API. " - "Driver supports v%u, firmware is v%u.\n", api_max, - api_ver); - goto try_again; - } - - if (api_ver != api_max) - IL_ERR("Firmware has old API version. Expected v%u, " - "got v%u. New firmware can be obtained " - "from http://www.intellinuxwireless.org.\n", api_max, - api_ver); - - IL_INFO("loaded firmware version %u.%u.%u.%u\n", - IL_UCODE_MAJOR(il->ucode_ver), IL_UCODE_MINOR(il->ucode_ver), - IL_UCODE_API(il->ucode_ver), IL_UCODE_SERIAL(il->ucode_ver)); - - snprintf(il->hw->wiphy->fw_version, sizeof(il->hw->wiphy->fw_version), - "%u.%u.%u.%u", IL_UCODE_MAJOR(il->ucode_ver), - IL_UCODE_MINOR(il->ucode_ver), IL_UCODE_API(il->ucode_ver), - IL_UCODE_SERIAL(il->ucode_ver)); - - /* - * For any of the failures below (before allocating pci memory) - * we will try to load a version with a smaller API -- maybe the - * user just got a corrupted version of the latest API. - */ - - D_INFO("f/w package hdr ucode version raw = 0x%x\n", il->ucode_ver); - D_INFO("f/w package hdr runtime inst size = %Zd\n", pieces.inst_size); - D_INFO("f/w package hdr runtime data size = %Zd\n", pieces.data_size); - D_INFO("f/w package hdr init inst size = %Zd\n", pieces.init_size); - D_INFO("f/w package hdr init data size = %Zd\n", pieces.init_data_size); - D_INFO("f/w package hdr boot inst size = %Zd\n", pieces.boot_size); - - /* Verify that uCode images will fit in card's SRAM */ - if (pieces.inst_size > il->hw_params.max_inst_size) { - IL_ERR("uCode instr len %Zd too large to fit in\n", - pieces.inst_size); - goto try_again; - } - - if (pieces.data_size > il->hw_params.max_data_size) { - IL_ERR("uCode data len %Zd too large to fit in\n", - pieces.data_size); - goto try_again; - } - - if (pieces.init_size > il->hw_params.max_inst_size) { - IL_ERR("uCode init instr len %Zd too large to fit in\n", - pieces.init_size); - goto try_again; - } - - if (pieces.init_data_size > il->hw_params.max_data_size) { - IL_ERR("uCode init data len %Zd too large to fit in\n", - pieces.init_data_size); - goto try_again; - } - - if (pieces.boot_size > il->hw_params.max_bsm_size) { - IL_ERR("uCode boot instr len %Zd too large to fit in\n", - pieces.boot_size); - goto try_again; - } - - /* Allocate ucode buffers for card's bus-master loading ... */ - - /* Runtime instructions and 2 copies of data: - * 1) unmodified from disk - * 2) backup cache for save/restore during power-downs */ - il->ucode_code.len = pieces.inst_size; - il_alloc_fw_desc(il->pci_dev, &il->ucode_code); - - il->ucode_data.len = pieces.data_size; - il_alloc_fw_desc(il->pci_dev, &il->ucode_data); - - il->ucode_data_backup.len = pieces.data_size; - il_alloc_fw_desc(il->pci_dev, &il->ucode_data_backup); - - if (!il->ucode_code.v_addr || !il->ucode_data.v_addr || - !il->ucode_data_backup.v_addr) - goto err_pci_alloc; - - /* Initialization instructions and data */ - if (pieces.init_size && pieces.init_data_size) { - il->ucode_init.len = pieces.init_size; - il_alloc_fw_desc(il->pci_dev, &il->ucode_init); - - il->ucode_init_data.len = pieces.init_data_size; - il_alloc_fw_desc(il->pci_dev, &il->ucode_init_data); - - if (!il->ucode_init.v_addr || !il->ucode_init_data.v_addr) - goto err_pci_alloc; - } - - /* Bootstrap (instructions only, no data) */ - if (pieces.boot_size) { - il->ucode_boot.len = pieces.boot_size; - il_alloc_fw_desc(il->pci_dev, &il->ucode_boot); - - if (!il->ucode_boot.v_addr) - goto err_pci_alloc; - } - - /* Now that we can no longer fail, copy information */ - - il->sta_key_max_num = STA_KEY_MAX_NUM; - - /* Copy images into buffers for card's bus-master reads ... */ - - /* Runtime instructions (first block of data in file) */ - D_INFO("Copying (but not loading) uCode instr len %Zd\n", - pieces.inst_size); - memcpy(il->ucode_code.v_addr, pieces.inst, pieces.inst_size); - - D_INFO("uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n", - il->ucode_code.v_addr, (u32) il->ucode_code.p_addr); - - /* - * Runtime data - * NOTE: Copy into backup buffer will be done in il_up() - */ - D_INFO("Copying (but not loading) uCode data len %Zd\n", - pieces.data_size); - memcpy(il->ucode_data.v_addr, pieces.data, pieces.data_size); - memcpy(il->ucode_data_backup.v_addr, pieces.data, pieces.data_size); - - /* Initialization instructions */ - if (pieces.init_size) { - D_INFO("Copying (but not loading) init instr len %Zd\n", - pieces.init_size); - memcpy(il->ucode_init.v_addr, pieces.init, pieces.init_size); - } - - /* Initialization data */ - if (pieces.init_data_size) { - D_INFO("Copying (but not loading) init data len %Zd\n", - pieces.init_data_size); - memcpy(il->ucode_init_data.v_addr, pieces.init_data, - pieces.init_data_size); - } - - /* Bootstrap instructions */ - D_INFO("Copying (but not loading) boot instr len %Zd\n", - pieces.boot_size); - memcpy(il->ucode_boot.v_addr, pieces.boot, pieces.boot_size); - - /* - * figure out the offset of chain noise reset and gain commands - * base on the size of standard phy calibration commands table size - */ - il->_4965.phy_calib_chain_noise_reset_cmd = - standard_phy_calibration_size; - il->_4965.phy_calib_chain_noise_gain_cmd = - standard_phy_calibration_size + 1; - - /************************************************** - * This is still part of probe() in a sense... - * - * 9. Setup and register with mac80211 and debugfs - **************************************************/ - err = il4965_mac_setup_register(il, max_probe_length); - if (err) - goto out_unbind; - - err = il_dbgfs_register(il, DRV_NAME); - if (err) - IL_ERR("failed to create debugfs files. Ignoring error: %d\n", - err); - - err = sysfs_create_group(&il->pci_dev->dev.kobj, &il_attribute_group); - if (err) { - IL_ERR("failed to create sysfs device attributes\n"); - goto out_unbind; - } - - /* We have our copies now, allow OS release its copies */ - release_firmware(ucode_raw); - complete(&il->_4965.firmware_loading_complete); - return; - -try_again: - /* try next, if any */ - if (il4965_request_firmware(il, false)) - goto out_unbind; - release_firmware(ucode_raw); - return; - -err_pci_alloc: - IL_ERR("failed to allocate pci memory\n"); - il4965_dealloc_ucode_pci(il); -out_unbind: - complete(&il->_4965.firmware_loading_complete); - device_release_driver(&il->pci_dev->dev); - release_firmware(ucode_raw); -} - -static const char *const desc_lookup_text[] = { - "OK", - "FAIL", - "BAD_PARAM", - "BAD_CHECKSUM", - "NMI_INTERRUPT_WDG", - "SYSASSERT", - "FATAL_ERROR", - "BAD_COMMAND", - "HW_ERROR_TUNE_LOCK", - "HW_ERROR_TEMPERATURE", - "ILLEGAL_CHAN_FREQ", - "VCC_NOT_STBL", - "FH49_ERROR", - "NMI_INTERRUPT_HOST", - "NMI_INTERRUPT_ACTION_PT", - "NMI_INTERRUPT_UNKNOWN", - "UCODE_VERSION_MISMATCH", - "HW_ERROR_ABS_LOCK", - "HW_ERROR_CAL_LOCK_FAIL", - "NMI_INTERRUPT_INST_ACTION_PT", - "NMI_INTERRUPT_DATA_ACTION_PT", - "NMI_TRM_HW_ER", - "NMI_INTERRUPT_TRM", - "NMI_INTERRUPT_BREAK_POINT", - "DEBUG_0", - "DEBUG_1", - "DEBUG_2", - "DEBUG_3", -}; - -static struct { - char *name; - u8 num; -} advanced_lookup[] = { - { - "NMI_INTERRUPT_WDG", 0x34}, { - "SYSASSERT", 0x35}, { - "UCODE_VERSION_MISMATCH", 0x37}, { - "BAD_COMMAND", 0x38}, { - "NMI_INTERRUPT_DATA_ACTION_PT", 0x3C}, { - "FATAL_ERROR", 0x3D}, { - "NMI_TRM_HW_ERR", 0x46}, { - "NMI_INTERRUPT_TRM", 0x4C}, { - "NMI_INTERRUPT_BREAK_POINT", 0x54}, { - "NMI_INTERRUPT_WDG_RXF_FULL", 0x5C}, { - "NMI_INTERRUPT_WDG_NO_RBD_RXF_FULL", 0x64}, { - "NMI_INTERRUPT_HOST", 0x66}, { - "NMI_INTERRUPT_ACTION_PT", 0x7C}, { - "NMI_INTERRUPT_UNKNOWN", 0x84}, { - "NMI_INTERRUPT_INST_ACTION_PT", 0x86}, { -"ADVANCED_SYSASSERT", 0},}; - -static const char * -il4965_desc_lookup(u32 num) -{ - int i; - int max = ARRAY_SIZE(desc_lookup_text); - - if (num < max) - return desc_lookup_text[num]; - - max = ARRAY_SIZE(advanced_lookup) - 1; - for (i = 0; i < max; i++) { - if (advanced_lookup[i].num == num) - break; - } - return advanced_lookup[i].name; -} - -#define ERROR_START_OFFSET (1 * sizeof(u32)) -#define ERROR_ELEM_SIZE (7 * sizeof(u32)) - -void -il4965_dump_nic_error_log(struct il_priv *il) -{ - u32 data2, line; - u32 desc, time, count, base, data1; - u32 blink1, blink2, ilink1, ilink2; - u32 pc, hcmd; - - if (il->ucode_type == UCODE_INIT) - base = le32_to_cpu(il->card_alive_init.error_event_table_ptr); - else - base = le32_to_cpu(il->card_alive.error_event_table_ptr); - - if (!il->ops->is_valid_rtc_data_addr(base)) { - IL_ERR("Not valid error log pointer 0x%08X for %s uCode\n", - base, (il->ucode_type == UCODE_INIT) ? "Init" : "RT"); - return; - } - - count = il_read_targ_mem(il, base); - - if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) { - IL_ERR("Start IWL Error Log Dump:\n"); - IL_ERR("Status: 0x%08lX, count: %d\n", il->status, count); - } - - desc = il_read_targ_mem(il, base + 1 * sizeof(u32)); - il->isr_stats.err_code = desc; - pc = il_read_targ_mem(il, base + 2 * sizeof(u32)); - blink1 = il_read_targ_mem(il, base + 3 * sizeof(u32)); - blink2 = il_read_targ_mem(il, base + 4 * sizeof(u32)); - ilink1 = il_read_targ_mem(il, base + 5 * sizeof(u32)); - ilink2 = il_read_targ_mem(il, base + 6 * sizeof(u32)); - data1 = il_read_targ_mem(il, base + 7 * sizeof(u32)); - data2 = il_read_targ_mem(il, base + 8 * sizeof(u32)); - line = il_read_targ_mem(il, base + 9 * sizeof(u32)); - time = il_read_targ_mem(il, base + 11 * sizeof(u32)); - hcmd = il_read_targ_mem(il, base + 22 * sizeof(u32)); - - IL_ERR("Desc Time " - "data1 data2 line\n"); - IL_ERR("%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n", - il4965_desc_lookup(desc), desc, time, data1, data2, line); - IL_ERR("pc blink1 blink2 ilink1 ilink2 hcmd\n"); - IL_ERR("0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n", pc, blink1, - blink2, ilink1, ilink2, hcmd); -} - -static void -il4965_rf_kill_ct_config(struct il_priv *il) -{ - struct il_ct_kill_config cmd; - unsigned long flags; - int ret = 0; - - spin_lock_irqsave(&il->lock, flags); - _il_wr(il, CSR_UCODE_DRV_GP1_CLR, - CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); - spin_unlock_irqrestore(&il->lock, flags); - - cmd.critical_temperature_R = - cpu_to_le32(il->hw_params.ct_kill_threshold); - - ret = il_send_cmd_pdu(il, C_CT_KILL_CONFIG, sizeof(cmd), &cmd); - if (ret) - IL_ERR("C_CT_KILL_CONFIG failed\n"); - else - D_INFO("C_CT_KILL_CONFIG " "succeeded, " - "critical temperature is %d\n", - il->hw_params.ct_kill_threshold); -} - -static const s8 default_queue_to_tx_fifo[] = { - IL_TX_FIFO_VO, - IL_TX_FIFO_VI, - IL_TX_FIFO_BE, - IL_TX_FIFO_BK, - IL49_CMD_FIFO_NUM, - IL_TX_FIFO_UNUSED, - IL_TX_FIFO_UNUSED, -}; - -#define IL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) - -static int -il4965_alive_notify(struct il_priv *il) -{ - u32 a; - unsigned long flags; - int i, chan; - u32 reg_val; - - spin_lock_irqsave(&il->lock, flags); - - /* Clear 4965's internal Tx Scheduler data base */ - il->scd_base_addr = il_rd_prph(il, IL49_SCD_SRAM_BASE_ADDR); - a = il->scd_base_addr + IL49_SCD_CONTEXT_DATA_OFFSET; - for (; a < il->scd_base_addr + IL49_SCD_TX_STTS_BITMAP_OFFSET; a += 4) - il_write_targ_mem(il, a, 0); - for (; a < il->scd_base_addr + IL49_SCD_TRANSLATE_TBL_OFFSET; a += 4) - il_write_targ_mem(il, a, 0); - for (; - a < - il->scd_base_addr + - IL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(il->hw_params.max_txq_num); - a += 4) - il_write_targ_mem(il, a, 0); - - /* Tel 4965 where to find Tx byte count tables */ - il_wr_prph(il, IL49_SCD_DRAM_BASE_ADDR, il->scd_bc_tbls.dma >> 10); - - /* Enable DMA channel */ - for (chan = 0; chan < FH49_TCSR_CHNL_NUM; chan++) - il_wr(il, FH49_TCSR_CHNL_TX_CONFIG_REG(chan), - FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | - FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE); - - /* Update FH chicken bits */ - reg_val = il_rd(il, FH49_TX_CHICKEN_BITS_REG); - il_wr(il, FH49_TX_CHICKEN_BITS_REG, - reg_val | FH49_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); - - /* Disable chain mode for all queues */ - il_wr_prph(il, IL49_SCD_QUEUECHAIN_SEL, 0); - - /* Initialize each Tx queue (including the command queue) */ - for (i = 0; i < il->hw_params.max_txq_num; i++) { - - /* TFD circular buffer read/write idxes */ - il_wr_prph(il, IL49_SCD_QUEUE_RDPTR(i), 0); - il_wr(il, HBUS_TARG_WRPTR, 0 | (i << 8)); - - /* Max Tx Window size for Scheduler-ACK mode */ - il_write_targ_mem(il, - il->scd_base_addr + - IL49_SCD_CONTEXT_QUEUE_OFFSET(i), - (SCD_WIN_SIZE << - IL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & - IL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); - - /* Frame limit */ - il_write_targ_mem(il, - il->scd_base_addr + - IL49_SCD_CONTEXT_QUEUE_OFFSET(i) + - sizeof(u32), - (SCD_FRAME_LIMIT << - IL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) & - IL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); - - } - il_wr_prph(il, IL49_SCD_INTERRUPT_MASK, - (1 << il->hw_params.max_txq_num) - 1); - - /* Activate all Tx DMA/FIFO channels */ - il4965_txq_set_sched(il, IL_MASK(0, 6)); - - il4965_set_wr_ptrs(il, IL_DEFAULT_CMD_QUEUE_NUM, 0); - - /* make sure all queue are not stopped */ - memset(&il->queue_stopped[0], 0, sizeof(il->queue_stopped)); - for (i = 0; i < 4; i++) - atomic_set(&il->queue_stop_count[i], 0); - - /* reset to 0 to enable all the queue first */ - il->txq_ctx_active_msk = 0; - /* Map each Tx/cmd queue to its corresponding fifo */ - BUILD_BUG_ON(ARRAY_SIZE(default_queue_to_tx_fifo) != 7); - - for (i = 0; i < ARRAY_SIZE(default_queue_to_tx_fifo); i++) { - int ac = default_queue_to_tx_fifo[i]; - - il_txq_ctx_activate(il, i); - - if (ac == IL_TX_FIFO_UNUSED) - continue; - - il4965_tx_queue_set_status(il, &il->txq[i], ac, 0); - } - - spin_unlock_irqrestore(&il->lock, flags); - - return 0; -} - -/** - * il4965_alive_start - called after N_ALIVE notification received - * from protocol/runtime uCode (initialization uCode's - * Alive gets handled by il_init_alive_start()). - */ -static void -il4965_alive_start(struct il_priv *il) -{ - int ret = 0; - - D_INFO("Runtime Alive received.\n"); - - if (il->card_alive.is_valid != UCODE_VALID_OK) { - /* We had an error bringing up the hardware, so take it - * all the way back down so we can try again */ - D_INFO("Alive failed.\n"); - goto restart; - } - - /* Initialize uCode has loaded Runtime uCode ... verify inst image. - * This is a paranoid check, because we would not have gotten the - * "runtime" alive if code weren't properly loaded. */ - if (il4965_verify_ucode(il)) { - /* Runtime instruction load was bad; - * take it all the way back down so we can try again */ - D_INFO("Bad runtime uCode load.\n"); - goto restart; - } - - ret = il4965_alive_notify(il); - if (ret) { - IL_WARN("Could not complete ALIVE transition [ntf]: %d\n", ret); - goto restart; - } - - /* After the ALIVE response, we can send host commands to the uCode */ - set_bit(S_ALIVE, &il->status); - - /* Enable watchdog to monitor the driver tx queues */ - il_setup_watchdog(il); - - if (il_is_rfkill(il)) - return; - - ieee80211_wake_queues(il->hw); - - il->active_rate = RATES_MASK; - - il_power_update_mode(il, true); - D_INFO("Updated power mode\n"); - - if (il_is_associated(il)) { - struct il_rxon_cmd *active_rxon = - (struct il_rxon_cmd *)&il->active; - /* apply any changes in staging */ - il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; - } else { - /* Initialize our rx_config data */ - il_connection_init_rx_config(il); - - if (il->ops->set_rxon_chain) - il->ops->set_rxon_chain(il); - } - - /* Configure bluetooth coexistence if enabled */ - il_send_bt_config(il); - - il4965_reset_run_time_calib(il); - - set_bit(S_READY, &il->status); - - /* Configure the adapter for unassociated operation */ - il_commit_rxon(il); - - /* At this point, the NIC is initialized and operational */ - il4965_rf_kill_ct_config(il); - - D_INFO("ALIVE processing complete.\n"); - wake_up(&il->wait_command_queue); - - return; - -restart: - queue_work(il->workqueue, &il->restart); -} - -static void il4965_cancel_deferred_work(struct il_priv *il); - -static void -__il4965_down(struct il_priv *il) -{ - unsigned long flags; - int exit_pending; - - D_INFO(DRV_NAME " is going down\n"); - - il_scan_cancel_timeout(il, 200); - - exit_pending = test_and_set_bit(S_EXIT_PENDING, &il->status); - - /* Stop TX queues watchdog. We need to have S_EXIT_PENDING bit set - * to prevent rearm timer */ - del_timer_sync(&il->watchdog); - - il_clear_ucode_stations(il); - - /* FIXME: race conditions ? */ - spin_lock_irq(&il->sta_lock); - /* - * Remove all key information that is not stored as part - * of station information since mac80211 may not have had - * a chance to remove all the keys. When device is - * reconfigured by mac80211 after an error all keys will - * be reconfigured. - */ - memset(il->_4965.wep_keys, 0, sizeof(il->_4965.wep_keys)); - il->_4965.key_mapping_keys = 0; - spin_unlock_irq(&il->sta_lock); - - il_dealloc_bcast_stations(il); - il_clear_driver_stations(il); - - /* Unblock any waiting calls */ - wake_up_all(&il->wait_command_queue); - - /* Wipe out the EXIT_PENDING status bit if we are not actually - * exiting the module */ - if (!exit_pending) - clear_bit(S_EXIT_PENDING, &il->status); - - /* stop and reset the on-board processor */ - _il_wr(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); - - /* tell the device to stop sending interrupts */ - spin_lock_irqsave(&il->lock, flags); - il_disable_interrupts(il); - spin_unlock_irqrestore(&il->lock, flags); - il4965_synchronize_irq(il); - - if (il->mac80211_registered) - ieee80211_stop_queues(il->hw); - - /* If we have not previously called il_init() then - * clear all bits but the RF Kill bit and return */ - if (!il_is_init(il)) { - il->status = - test_bit(S_RFKILL, &il->status) << S_RFKILL | - test_bit(S_GEO_CONFIGURED, &il->status) << S_GEO_CONFIGURED | - test_bit(S_EXIT_PENDING, &il->status) << S_EXIT_PENDING; - goto exit; - } - - /* ...otherwise clear out all the status bits but the RF Kill - * bit and continue taking the NIC down. */ - il->status &= - test_bit(S_RFKILL, &il->status) << S_RFKILL | - test_bit(S_GEO_CONFIGURED, &il->status) << S_GEO_CONFIGURED | - test_bit(S_FW_ERROR, &il->status) << S_FW_ERROR | - test_bit(S_EXIT_PENDING, &il->status) << S_EXIT_PENDING; - - /* - * We disabled and synchronized interrupt, and priv->mutex is taken, so - * here is the only thread which will program device registers, but - * still have lockdep assertions, so we are taking reg_lock. - */ - spin_lock_irq(&il->reg_lock); - /* FIXME: il_grab_nic_access if rfkill is off ? */ - - il4965_txq_ctx_stop(il); - il4965_rxq_stop(il); - /* Power-down device's busmaster DMA clocks */ - _il_wr_prph(il, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); - udelay(5); - /* Make sure (redundant) we've released our request to stay awake */ - _il_clear_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - /* Stop the device, and put it in low power state */ - _il_apm_stop(il); - - spin_unlock_irq(&il->reg_lock); - - il4965_txq_ctx_unmap(il); -exit: - memset(&il->card_alive, 0, sizeof(struct il_alive_resp)); - - dev_kfree_skb(il->beacon_skb); - il->beacon_skb = NULL; - - /* clear out any free frames */ - il4965_clear_free_frames(il); -} - -static void -il4965_down(struct il_priv *il) -{ - mutex_lock(&il->mutex); - __il4965_down(il); - mutex_unlock(&il->mutex); - - il4965_cancel_deferred_work(il); -} - - -static void -il4965_set_hw_ready(struct il_priv *il) -{ - int ret; - - il_set_bit(il, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_BIT_NIC_READY); - - /* See if we got it */ - ret = _il_poll_bit(il, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, - CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, - 100); - if (ret >= 0) - il->hw_ready = true; - - D_INFO("hardware %s ready\n", (il->hw_ready) ? "" : "not"); -} - -static void -il4965_prepare_card_hw(struct il_priv *il) -{ - int ret; - - il->hw_ready = false; - - il4965_set_hw_ready(il); - if (il->hw_ready) - return; - - /* If HW is not ready, prepare the conditions to check again */ - il_set_bit(il, CSR_HW_IF_CONFIG_REG, CSR_HW_IF_CONFIG_REG_PREPARE); - - ret = - _il_poll_bit(il, CSR_HW_IF_CONFIG_REG, - ~CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, - CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000); - - /* HW should be ready by now, check again. */ - if (ret != -ETIMEDOUT) - il4965_set_hw_ready(il); -} - -#define MAX_HW_RESTARTS 5 - -static int -__il4965_up(struct il_priv *il) -{ - int i; - int ret; - - if (test_bit(S_EXIT_PENDING, &il->status)) { - IL_WARN("Exit pending; will not bring the NIC up\n"); - return -EIO; - } - - if (!il->ucode_data_backup.v_addr || !il->ucode_data.v_addr) { - IL_ERR("ucode not available for device bringup\n"); - return -EIO; - } - - ret = il4965_alloc_bcast_station(il); - if (ret) { - il_dealloc_bcast_stations(il); - return ret; - } - - il4965_prepare_card_hw(il); - if (!il->hw_ready) { - IL_ERR("HW not ready\n"); - return -EIO; - } - - /* If platform's RF_KILL switch is NOT set to KILL */ - if (_il_rd(il, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) - clear_bit(S_RFKILL, &il->status); - else { - set_bit(S_RFKILL, &il->status); - wiphy_rfkill_set_hw_state(il->hw->wiphy, true); - - il_enable_rfkill_int(il); - IL_WARN("Radio disabled by HW RF Kill switch\n"); - return 0; - } - - _il_wr(il, CSR_INT, 0xFFFFFFFF); - - /* must be initialised before il_hw_nic_init */ - il->cmd_queue = IL_DEFAULT_CMD_QUEUE_NUM; - - ret = il4965_hw_nic_init(il); - if (ret) { - IL_ERR("Unable to init nic\n"); - return ret; - } - - /* make sure rfkill handshake bits are cleared */ - _il_wr(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - _il_wr(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - - /* clear (again), then enable host interrupts */ - _il_wr(il, CSR_INT, 0xFFFFFFFF); - il_enable_interrupts(il); - - /* really make sure rfkill handshake bits are cleared */ - _il_wr(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - _il_wr(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - - /* Copy original ucode data image from disk into backup cache. - * This will be used to initialize the on-board processor's - * data SRAM for a clean start when the runtime program first loads. */ - memcpy(il->ucode_data_backup.v_addr, il->ucode_data.v_addr, - il->ucode_data.len); - - for (i = 0; i < MAX_HW_RESTARTS; i++) { - - /* load bootstrap state machine, - * load bootstrap program into processor's memory, - * prepare to load the "initialize" uCode */ - ret = il->ops->load_ucode(il); - - if (ret) { - IL_ERR("Unable to set up bootstrap uCode: %d\n", ret); - continue; - } - - /* start card; "initialize" will load runtime ucode */ - il4965_nic_start(il); - - D_INFO(DRV_NAME " is coming up\n"); - - return 0; - } - - set_bit(S_EXIT_PENDING, &il->status); - __il4965_down(il); - clear_bit(S_EXIT_PENDING, &il->status); - - /* tried to restart and config the device for as long as our - * patience could withstand */ - IL_ERR("Unable to initialize device after %d attempts.\n", i); - return -EIO; -} - -/***************************************************************************** - * - * Workqueue callbacks - * - *****************************************************************************/ - -static void -il4965_bg_init_alive_start(struct work_struct *data) -{ - struct il_priv *il = - container_of(data, struct il_priv, init_alive_start.work); - - mutex_lock(&il->mutex); - if (test_bit(S_EXIT_PENDING, &il->status)) - goto out; - - il->ops->init_alive_start(il); -out: - mutex_unlock(&il->mutex); -} - -static void -il4965_bg_alive_start(struct work_struct *data) -{ - struct il_priv *il = - container_of(data, struct il_priv, alive_start.work); - - mutex_lock(&il->mutex); - if (test_bit(S_EXIT_PENDING, &il->status)) - goto out; - - il4965_alive_start(il); -out: - mutex_unlock(&il->mutex); -} - -static void -il4965_bg_run_time_calib_work(struct work_struct *work) -{ - struct il_priv *il = container_of(work, struct il_priv, - run_time_calib_work); - - mutex_lock(&il->mutex); - - if (test_bit(S_EXIT_PENDING, &il->status) || - test_bit(S_SCANNING, &il->status)) { - mutex_unlock(&il->mutex); - return; - } - - if (il->start_calib) { - il4965_chain_noise_calibration(il, (void *)&il->_4965.stats); - il4965_sensitivity_calibration(il, (void *)&il->_4965.stats); - } - - mutex_unlock(&il->mutex); -} - -static void -il4965_bg_restart(struct work_struct *data) -{ - struct il_priv *il = container_of(data, struct il_priv, restart); - - if (test_bit(S_EXIT_PENDING, &il->status)) - return; - - if (test_and_clear_bit(S_FW_ERROR, &il->status)) { - mutex_lock(&il->mutex); - il->is_open = 0; - - __il4965_down(il); - - mutex_unlock(&il->mutex); - il4965_cancel_deferred_work(il); - ieee80211_restart_hw(il->hw); - } else { - il4965_down(il); - - mutex_lock(&il->mutex); - if (test_bit(S_EXIT_PENDING, &il->status)) { - mutex_unlock(&il->mutex); - return; - } - - __il4965_up(il); - mutex_unlock(&il->mutex); - } -} - -static void -il4965_bg_rx_replenish(struct work_struct *data) -{ - struct il_priv *il = container_of(data, struct il_priv, rx_replenish); - - if (test_bit(S_EXIT_PENDING, &il->status)) - return; - - mutex_lock(&il->mutex); - il4965_rx_replenish(il); - mutex_unlock(&il->mutex); -} - -/***************************************************************************** - * - * mac80211 entry point functions - * - *****************************************************************************/ - -#define UCODE_READY_TIMEOUT (4 * HZ) - -/* - * Not a mac80211 entry point function, but it fits in with all the - * other mac80211 functions grouped here. - */ -static int -il4965_mac_setup_register(struct il_priv *il, u32 max_probe_length) -{ - int ret; - struct ieee80211_hw *hw = il->hw; - - hw->rate_control_algorithm = "iwl-4965-rs"; - - /* Tell mac80211 our characteristics */ - hw->flags = - IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_AMPDU_AGGREGATION | - IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC | IEEE80211_HW_SPECTRUM_MGMT | - IEEE80211_HW_SUPPORTS_PS | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; - if (il->cfg->sku & IL_SKU_N) - hw->flags |= - IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | - IEEE80211_HW_SUPPORTS_STATIC_SMPS; - - hw->sta_data_size = sizeof(struct il_station_priv); - hw->vif_data_size = sizeof(struct il_vif_priv); - - hw->wiphy->interface_modes = - BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); - - hw->wiphy->flags |= - WIPHY_FLAG_CUSTOM_REGULATORY | WIPHY_FLAG_DISABLE_BEACON_HINTS | - WIPHY_FLAG_IBSS_RSN; - - /* - * For now, disable PS by default because it affects - * RX performance significantly. - */ - hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; - - hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; - /* we create the 802.11 header and a zero-length SSID element */ - hw->wiphy->max_scan_ie_len = max_probe_length - 24 - 2; - - /* Default value; 4 EDCA QOS priorities */ - hw->queues = 4; - - hw->max_listen_interval = IL_CONN_MAX_LISTEN_INTERVAL; - - if (il->bands[IEEE80211_BAND_2GHZ].n_channels) - il->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = - &il->bands[IEEE80211_BAND_2GHZ]; - if (il->bands[IEEE80211_BAND_5GHZ].n_channels) - il->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = - &il->bands[IEEE80211_BAND_5GHZ]; - - il_leds_init(il); - - ret = ieee80211_register_hw(il->hw); - if (ret) { - IL_ERR("Failed to register hw (error %d)\n", ret); - return ret; - } - il->mac80211_registered = 1; - - return 0; -} - -int -il4965_mac_start(struct ieee80211_hw *hw) -{ - struct il_priv *il = hw->priv; - int ret; - - D_MAC80211("enter\n"); - - /* we should be verifying the device is ready to be opened */ - mutex_lock(&il->mutex); - ret = __il4965_up(il); - mutex_unlock(&il->mutex); - - if (ret) - return ret; - - if (il_is_rfkill(il)) - goto out; - - D_INFO("Start UP work done.\n"); - - /* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from - * mac80211 will not be run successfully. */ - ret = wait_event_timeout(il->wait_command_queue, - test_bit(S_READY, &il->status), - UCODE_READY_TIMEOUT); - if (!ret) { - if (!test_bit(S_READY, &il->status)) { - IL_ERR("START_ALIVE timeout after %dms.\n", - jiffies_to_msecs(UCODE_READY_TIMEOUT)); - return -ETIMEDOUT; - } - } - - il4965_led_enable(il); - -out: - il->is_open = 1; - D_MAC80211("leave\n"); - return 0; -} - -void -il4965_mac_stop(struct ieee80211_hw *hw) -{ - struct il_priv *il = hw->priv; - - D_MAC80211("enter\n"); - - if (!il->is_open) - return; - - il->is_open = 0; - - il4965_down(il); - - flush_workqueue(il->workqueue); - - /* User space software may expect getting rfkill changes - * even if interface is down */ - _il_wr(il, CSR_INT, 0xFFFFFFFF); - il_enable_rfkill_int(il); - - D_MAC80211("leave\n"); -} - -void -il4965_mac_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct il_priv *il = hw->priv; - - D_MACDUMP("enter\n"); - - D_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, - ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); - - if (il4965_tx_skb(il, control->sta, skb)) - dev_kfree_skb_any(skb); - - D_MACDUMP("leave\n"); -} - -void -il4965_mac_update_tkip_key(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_key_conf *keyconf, - struct ieee80211_sta *sta, u32 iv32, u16 * phase1key) -{ - struct il_priv *il = hw->priv; - - D_MAC80211("enter\n"); - - il4965_update_tkip_key(il, keyconf, sta, iv32, phase1key); - - D_MAC80211("leave\n"); -} - -int -il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct il_priv *il = hw->priv; - int ret; - u8 sta_id; - bool is_default_wep_key = false; - - D_MAC80211("enter\n"); - - if (il->cfg->mod_params->sw_crypto) { - D_MAC80211("leave - hwcrypto disabled\n"); - return -EOPNOTSUPP; - } - - /* - * To support IBSS RSN, don't program group keys in IBSS, the - * hardware will then not attempt to decrypt the frames. - */ - if (vif->type == NL80211_IFTYPE_ADHOC && - !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { - D_MAC80211("leave - ad-hoc group key\n"); - return -EOPNOTSUPP; - } - - sta_id = il_sta_id_or_broadcast(il, sta); - if (sta_id == IL_INVALID_STATION) - return -EINVAL; - - mutex_lock(&il->mutex); - il_scan_cancel_timeout(il, 100); - - /* - * If we are getting WEP group key and we didn't receive any key mapping - * so far, we are in legacy wep mode (group key only), otherwise we are - * in 1X mode. - * In legacy wep mode, we use another host command to the uCode. - */ - if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 || - key->cipher == WLAN_CIPHER_SUITE_WEP104) && !sta) { - if (cmd == SET_KEY) - is_default_wep_key = !il->_4965.key_mapping_keys; - else - is_default_wep_key = - (key->hw_key_idx == HW_KEY_DEFAULT); - } - - switch (cmd) { - case SET_KEY: - if (is_default_wep_key) - ret = il4965_set_default_wep_key(il, key); - else - ret = il4965_set_dynamic_key(il, key, sta_id); - - D_MAC80211("enable hwcrypto key\n"); - break; - case DISABLE_KEY: - if (is_default_wep_key) - ret = il4965_remove_default_wep_key(il, key); - else - ret = il4965_remove_dynamic_key(il, key, sta_id); - - D_MAC80211("disable hwcrypto key\n"); - break; - default: - ret = -EINVAL; - } - - mutex_unlock(&il->mutex); - D_MAC80211("leave\n"); - - return ret; -} - -int -il4965_mac_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, u16 tid, u16 * ssn, - u8 buf_size) -{ - struct il_priv *il = hw->priv; - int ret = -EINVAL; - - D_HT("A-MPDU action on addr %pM tid %d\n", sta->addr, tid); - - if (!(il->cfg->sku & IL_SKU_N)) - return -EACCES; - - mutex_lock(&il->mutex); - - switch (action) { - case IEEE80211_AMPDU_RX_START: - D_HT("start Rx\n"); - ret = il4965_sta_rx_agg_start(il, sta, tid, *ssn); - break; - case IEEE80211_AMPDU_RX_STOP: - D_HT("stop Rx\n"); - ret = il4965_sta_rx_agg_stop(il, sta, tid); - if (test_bit(S_EXIT_PENDING, &il->status)) - ret = 0; - break; - case IEEE80211_AMPDU_TX_START: - D_HT("start Tx\n"); - ret = il4965_tx_agg_start(il, vif, sta, tid, ssn); - break; - case IEEE80211_AMPDU_TX_STOP_CONT: - case IEEE80211_AMPDU_TX_STOP_FLUSH: - case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: - D_HT("stop Tx\n"); - ret = il4965_tx_agg_stop(il, vif, sta, tid); - if (test_bit(S_EXIT_PENDING, &il->status)) - ret = 0; - break; - case IEEE80211_AMPDU_TX_OPERATIONAL: - ret = 0; - break; - } - mutex_unlock(&il->mutex); - - return ret; -} - -int -il4965_mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct il_priv *il = hw->priv; - struct il_station_priv *sta_priv = (void *)sta->drv_priv; - bool is_ap = vif->type == NL80211_IFTYPE_STATION; - int ret; - u8 sta_id; - - D_INFO("received request to add station %pM\n", sta->addr); - mutex_lock(&il->mutex); - D_INFO("proceeding to add station %pM\n", sta->addr); - sta_priv->common.sta_id = IL_INVALID_STATION; - - atomic_set(&sta_priv->pending_frames, 0); - - ret = - il_add_station_common(il, sta->addr, is_ap, sta, &sta_id); - if (ret) { - IL_ERR("Unable to add station %pM (%d)\n", sta->addr, ret); - /* Should we return success if return code is EEXIST ? */ - mutex_unlock(&il->mutex); - return ret; - } - - sta_priv->common.sta_id = sta_id; - - /* Initialize rate scaling */ - D_INFO("Initializing rate scaling for station %pM\n", sta->addr); - il4965_rs_rate_init(il, sta, sta_id); - mutex_unlock(&il->mutex); - - return 0; -} - -void -il4965_mac_channel_switch(struct ieee80211_hw *hw, - struct ieee80211_channel_switch *ch_switch) -{ - struct il_priv *il = hw->priv; - const struct il_channel_info *ch_info; - struct ieee80211_conf *conf = &hw->conf; - struct ieee80211_channel *channel = ch_switch->chandef.chan; - struct il_ht_config *ht_conf = &il->current_ht_config; - u16 ch; - - D_MAC80211("enter\n"); - - mutex_lock(&il->mutex); - - if (il_is_rfkill(il)) - goto out; - - if (test_bit(S_EXIT_PENDING, &il->status) || - test_bit(S_SCANNING, &il->status) || - test_bit(S_CHANNEL_SWITCH_PENDING, &il->status)) - goto out; - - if (!il_is_associated(il)) - goto out; - - if (!il->ops->set_channel_switch) - goto out; - - ch = channel->hw_value; - if (le16_to_cpu(il->active.channel) == ch) - goto out; - - ch_info = il_get_channel_info(il, channel->band, ch); - if (!il_is_channel_valid(ch_info)) { - D_MAC80211("invalid channel\n"); - goto out; - } - - spin_lock_irq(&il->lock); - - il->current_ht_config.smps = conf->smps_mode; - - /* Configure HT40 channels */ - switch (cfg80211_get_chandef_type(&ch_switch->chandef)) { - case NL80211_CHAN_NO_HT: - case NL80211_CHAN_HT20: - il->ht.is_40mhz = false; - il->ht.extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; - break; - case NL80211_CHAN_HT40MINUS: - il->ht.extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_BELOW; - il->ht.is_40mhz = true; - break; - case NL80211_CHAN_HT40PLUS: - il->ht.extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; - il->ht.is_40mhz = true; - break; - } - - if ((le16_to_cpu(il->staging.channel) != ch)) - il->staging.flags = 0; - - il_set_rxon_channel(il, channel); - il_set_rxon_ht(il, ht_conf); - il_set_flags_for_band(il, channel->band, il->vif); - - spin_unlock_irq(&il->lock); - - il_set_rate(il); - /* - * at this point, staging_rxon has the - * configuration for channel switch - */ - set_bit(S_CHANNEL_SWITCH_PENDING, &il->status); - il->switch_channel = cpu_to_le16(ch); - if (il->ops->set_channel_switch(il, ch_switch)) { - clear_bit(S_CHANNEL_SWITCH_PENDING, &il->status); - il->switch_channel = 0; - ieee80211_chswitch_done(il->vif, false); - } - -out: - mutex_unlock(&il->mutex); - D_MAC80211("leave\n"); -} - -void -il4965_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, - unsigned int *total_flags, u64 multicast) -{ - struct il_priv *il = hw->priv; - __le32 filter_or = 0, filter_nand = 0; - -#define CHK(test, flag) do { \ - if (*total_flags & (test)) \ - filter_or |= (flag); \ - else \ - filter_nand |= (flag); \ - } while (0) - - D_MAC80211("Enter: changed: 0x%x, total: 0x%x\n", changed_flags, - *total_flags); - - CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); - /* Setting _just_ RXON_FILTER_CTL2HOST_MSK causes FH errors */ - CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_PROMISC_MSK); - CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); - -#undef CHK - - mutex_lock(&il->mutex); - - il->staging.filter_flags &= ~filter_nand; - il->staging.filter_flags |= filter_or; - - /* - * Not committing directly because hardware can perform a scan, - * but we'll eventually commit the filter flags change anyway. - */ - - mutex_unlock(&il->mutex); - - /* - * Receiving all multicast frames is always enabled by the - * default flags setup in il_connection_init_rx_config() - * since we currently do not support programming multicast - * filters into the device. - */ - *total_flags &= - FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | - FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; -} - -/***************************************************************************** - * - * driver setup and teardown - * - *****************************************************************************/ - -static void -il4965_bg_txpower_work(struct work_struct *work) -{ - struct il_priv *il = container_of(work, struct il_priv, - txpower_work); - - mutex_lock(&il->mutex); - - /* If a scan happened to start before we got here - * then just return; the stats notification will - * kick off another scheduled work to compensate for - * any temperature delta we missed here. */ - if (test_bit(S_EXIT_PENDING, &il->status) || - test_bit(S_SCANNING, &il->status)) - goto out; - - /* Regardless of if we are associated, we must reconfigure the - * TX power since frames can be sent on non-radar channels while - * not associated */ - il->ops->send_tx_power(il); - - /* Update last_temperature to keep is_calib_needed from running - * when it isn't needed... */ - il->last_temperature = il->temperature; -out: - mutex_unlock(&il->mutex); -} - -static void -il4965_setup_deferred_work(struct il_priv *il) -{ - il->workqueue = create_singlethread_workqueue(DRV_NAME); - - init_waitqueue_head(&il->wait_command_queue); - - INIT_WORK(&il->restart, il4965_bg_restart); - INIT_WORK(&il->rx_replenish, il4965_bg_rx_replenish); - INIT_WORK(&il->run_time_calib_work, il4965_bg_run_time_calib_work); - INIT_DELAYED_WORK(&il->init_alive_start, il4965_bg_init_alive_start); - INIT_DELAYED_WORK(&il->alive_start, il4965_bg_alive_start); - - il_setup_scan_deferred_work(il); - - INIT_WORK(&il->txpower_work, il4965_bg_txpower_work); - - init_timer(&il->stats_periodic); - il->stats_periodic.data = (unsigned long)il; - il->stats_periodic.function = il4965_bg_stats_periodic; - - init_timer(&il->watchdog); - il->watchdog.data = (unsigned long)il; - il->watchdog.function = il_bg_watchdog; - - tasklet_init(&il->irq_tasklet, - (void (*)(unsigned long))il4965_irq_tasklet, - (unsigned long)il); -} - -static void -il4965_cancel_deferred_work(struct il_priv *il) -{ - cancel_work_sync(&il->txpower_work); - cancel_delayed_work_sync(&il->init_alive_start); - cancel_delayed_work(&il->alive_start); - cancel_work_sync(&il->run_time_calib_work); - - il_cancel_scan_deferred_work(il); - - del_timer_sync(&il->stats_periodic); -} - -static void -il4965_init_hw_rates(struct il_priv *il, struct ieee80211_rate *rates) -{ - int i; - - for (i = 0; i < RATE_COUNT_LEGACY; i++) { - rates[i].bitrate = il_rates[i].ieee * 5; - rates[i].hw_value = i; /* Rate scaling will work on idxes */ - rates[i].hw_value_short = i; - rates[i].flags = 0; - if ((i >= IL_FIRST_CCK_RATE) && (i <= IL_LAST_CCK_RATE)) { - /* - * If CCK != 1M then set short preamble rate flag. - */ - rates[i].flags |= - (il_rates[i].plcp == - RATE_1M_PLCP) ? 0 : IEEE80211_RATE_SHORT_PREAMBLE; - } - } -} - -/* - * Acquire il->lock before calling this function ! - */ -void -il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 idx) -{ - il_wr(il, HBUS_TARG_WRPTR, (idx & 0xff) | (txq_id << 8)); - il_wr_prph(il, IL49_SCD_QUEUE_RDPTR(txq_id), idx); -} - -void -il4965_tx_queue_set_status(struct il_priv *il, struct il_tx_queue *txq, - int tx_fifo_id, int scd_retry) -{ - int txq_id = txq->q.id; - - /* Find out whether to activate Tx queue */ - int active = test_bit(txq_id, &il->txq_ctx_active_msk) ? 1 : 0; - - /* Set up and activate */ - il_wr_prph(il, IL49_SCD_QUEUE_STATUS_BITS(txq_id), - (active << IL49_SCD_QUEUE_STTS_REG_POS_ACTIVE) | - (tx_fifo_id << IL49_SCD_QUEUE_STTS_REG_POS_TXF) | - (scd_retry << IL49_SCD_QUEUE_STTS_REG_POS_WSL) | - (scd_retry << IL49_SCD_QUEUE_STTS_REG_POS_SCD_ACK) | - IL49_SCD_QUEUE_STTS_REG_MSK); - - txq->sched_retry = scd_retry; - - D_INFO("%s %s Queue %d on AC %d\n", active ? "Activate" : "Deactivate", - scd_retry ? "BA" : "AC", txq_id, tx_fifo_id); -} - -static const struct ieee80211_ops il4965_mac_ops = { - .tx = il4965_mac_tx, - .start = il4965_mac_start, - .stop = il4965_mac_stop, - .add_interface = il_mac_add_interface, - .remove_interface = il_mac_remove_interface, - .change_interface = il_mac_change_interface, - .config = il_mac_config, - .configure_filter = il4965_configure_filter, - .set_key = il4965_mac_set_key, - .update_tkip_key = il4965_mac_update_tkip_key, - .conf_tx = il_mac_conf_tx, - .reset_tsf = il_mac_reset_tsf, - .bss_info_changed = il_mac_bss_info_changed, - .ampdu_action = il4965_mac_ampdu_action, - .hw_scan = il_mac_hw_scan, - .sta_add = il4965_mac_sta_add, - .sta_remove = il_mac_sta_remove, - .channel_switch = il4965_mac_channel_switch, - .tx_last_beacon = il_mac_tx_last_beacon, - .flush = il_mac_flush, -}; - -static int -il4965_init_drv(struct il_priv *il) -{ - int ret; - - spin_lock_init(&il->sta_lock); - spin_lock_init(&il->hcmd_lock); - - INIT_LIST_HEAD(&il->free_frames); - - mutex_init(&il->mutex); - - il->ieee_channels = NULL; - il->ieee_rates = NULL; - il->band = IEEE80211_BAND_2GHZ; - - il->iw_mode = NL80211_IFTYPE_STATION; - il->current_ht_config.smps = IEEE80211_SMPS_STATIC; - il->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF; - - /* initialize force reset */ - il->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD; - - /* Choose which receivers/antennas to use */ - if (il->ops->set_rxon_chain) - il->ops->set_rxon_chain(il); - - il_init_scan_params(il); - - ret = il_init_channel_map(il); - if (ret) { - IL_ERR("initializing regulatory failed: %d\n", ret); - goto err; - } - - ret = il_init_geos(il); - if (ret) { - IL_ERR("initializing geos failed: %d\n", ret); - goto err_free_channel_map; - } - il4965_init_hw_rates(il, il->ieee_rates); - - return 0; - -err_free_channel_map: - il_free_channel_map(il); -err: - return ret; -} - -static void -il4965_uninit_drv(struct il_priv *il) -{ - il_free_geos(il); - il_free_channel_map(il); - kfree(il->scan_cmd); -} - -static void -il4965_hw_detect(struct il_priv *il) -{ - il->hw_rev = _il_rd(il, CSR_HW_REV); - il->hw_wa_rev = _il_rd(il, CSR_HW_REV_WA_REG); - il->rev_id = il->pci_dev->revision; - D_INFO("HW Revision ID = 0x%X\n", il->rev_id); -} - -static struct il_sensitivity_ranges il4965_sensitivity = { - .min_nrg_cck = 97, - .max_nrg_cck = 0, /* not used, set to 0 */ - - .auto_corr_min_ofdm = 85, - .auto_corr_min_ofdm_mrc = 170, - .auto_corr_min_ofdm_x1 = 105, - .auto_corr_min_ofdm_mrc_x1 = 220, - - .auto_corr_max_ofdm = 120, - .auto_corr_max_ofdm_mrc = 210, - .auto_corr_max_ofdm_x1 = 140, - .auto_corr_max_ofdm_mrc_x1 = 270, - - .auto_corr_min_cck = 125, - .auto_corr_max_cck = 200, - .auto_corr_min_cck_mrc = 200, - .auto_corr_max_cck_mrc = 400, - - .nrg_th_cck = 100, - .nrg_th_ofdm = 100, - - .barker_corr_th_min = 190, - .barker_corr_th_min_mrc = 390, - .nrg_th_cca = 62, -}; - -static void -il4965_set_hw_params(struct il_priv *il) -{ - il->hw_params.bcast_id = IL4965_BROADCAST_ID; - il->hw_params.max_rxq_size = RX_QUEUE_SIZE; - il->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG; - if (il->cfg->mod_params->amsdu_size_8K) - il->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_8K); - else - il->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_4K); - - il->hw_params.max_beacon_itrvl = IL_MAX_UCODE_BEACON_INTERVAL; - - if (il->cfg->mod_params->disable_11n) - il->cfg->sku &= ~IL_SKU_N; - - if (il->cfg->mod_params->num_of_queues >= IL_MIN_NUM_QUEUES && - il->cfg->mod_params->num_of_queues <= IL49_NUM_QUEUES) - il->cfg->num_of_queues = - il->cfg->mod_params->num_of_queues; - - il->hw_params.max_txq_num = il->cfg->num_of_queues; - il->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM; - il->hw_params.scd_bc_tbls_size = - il->cfg->num_of_queues * - sizeof(struct il4965_scd_bc_tbl); - - il->hw_params.tfd_size = sizeof(struct il_tfd); - il->hw_params.max_stations = IL4965_STATION_COUNT; - il->hw_params.max_data_size = IL49_RTC_DATA_SIZE; - il->hw_params.max_inst_size = IL49_RTC_INST_SIZE; - il->hw_params.max_bsm_size = BSM_SRAM_SIZE; - il->hw_params.ht40_channel = BIT(IEEE80211_BAND_5GHZ); - - il->hw_params.rx_wrt_ptr_reg = FH49_RSCSR_CHNL0_WPTR; - - il->hw_params.tx_chains_num = il4965_num_of_ant(il->cfg->valid_tx_ant); - il->hw_params.rx_chains_num = il4965_num_of_ant(il->cfg->valid_rx_ant); - il->hw_params.valid_tx_ant = il->cfg->valid_tx_ant; - il->hw_params.valid_rx_ant = il->cfg->valid_rx_ant; - - il->hw_params.ct_kill_threshold = - CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY); - - il->hw_params.sens = &il4965_sensitivity; - il->hw_params.beacon_time_tsf_bits = IL4965_EXT_BEACON_TIME_POS; -} - -static int -il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - int err = 0; - struct il_priv *il; - struct ieee80211_hw *hw; - struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data); - unsigned long flags; - u16 pci_cmd; - - /************************ - * 1. Allocating HW data - ************************/ - - hw = ieee80211_alloc_hw(sizeof(struct il_priv), &il4965_mac_ops); - if (!hw) { - err = -ENOMEM; - goto out; - } - il = hw->priv; - il->hw = hw; - SET_IEEE80211_DEV(hw, &pdev->dev); - - D_INFO("*** LOAD DRIVER ***\n"); - il->cfg = cfg; - il->ops = &il4965_ops; -#ifdef CONFIG_IWLEGACY_DEBUGFS - il->debugfs_ops = &il4965_debugfs_ops; -#endif - il->pci_dev = pdev; - il->inta_mask = CSR_INI_SET_MASK; - - /************************** - * 2. Initializing PCI bus - **************************/ - pci_disable_link_state(pdev, - PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 | - PCIE_LINK_STATE_CLKPM); - - if (pci_enable_device(pdev)) { - err = -ENODEV; - goto out_ieee80211_free_hw; - } - - pci_set_master(pdev); - - err = pci_set_dma_mask(pdev, DMA_BIT_MASK(36)); - if (!err) - err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(36)); - if (err) { - err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); - if (!err) - err = - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); - /* both attempts failed: */ - if (err) { - IL_WARN("No suitable DMA available.\n"); - goto out_pci_disable_device; - } - } - - err = pci_request_regions(pdev, DRV_NAME); - if (err) - goto out_pci_disable_device; - - pci_set_drvdata(pdev, il); - - /*********************** - * 3. Read REV register - ***********************/ - il->hw_base = pci_ioremap_bar(pdev, 0); - if (!il->hw_base) { - err = -ENODEV; - goto out_pci_release_regions; - } - - D_INFO("pci_resource_len = 0x%08llx\n", - (unsigned long long)pci_resource_len(pdev, 0)); - D_INFO("pci_resource_base = %p\n", il->hw_base); - - /* these spin locks will be used in apm_ops.init and EEPROM access - * we should init now - */ - spin_lock_init(&il->reg_lock); - spin_lock_init(&il->lock); - - /* - * stop and reset the on-board processor just in case it is in a - * strange state ... like being left stranded by a primary kernel - * and this is now the kdump kernel trying to start up - */ - _il_wr(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); - - il4965_hw_detect(il); - IL_INFO("Detected %s, REV=0x%X\n", il->cfg->name, il->hw_rev); - - /* We disable the RETRY_TIMEOUT register (0x41) to keep - * PCI Tx retries from interfering with C3 CPU state */ - pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); - - il4965_prepare_card_hw(il); - if (!il->hw_ready) { - IL_WARN("Failed, HW not ready\n"); - err = -EIO; - goto out_iounmap; - } - - /***************** - * 4. Read EEPROM - *****************/ - /* Read the EEPROM */ - err = il_eeprom_init(il); - if (err) { - IL_ERR("Unable to init EEPROM\n"); - goto out_iounmap; - } - err = il4965_eeprom_check_version(il); - if (err) - goto out_free_eeprom; - - /* extract MAC Address */ - il4965_eeprom_get_mac(il, il->addresses[0].addr); - D_INFO("MAC address: %pM\n", il->addresses[0].addr); - il->hw->wiphy->addresses = il->addresses; - il->hw->wiphy->n_addresses = 1; - - /************************ - * 5. Setup HW constants - ************************/ - il4965_set_hw_params(il); - - /******************* - * 6. Setup il - *******************/ - - err = il4965_init_drv(il); - if (err) - goto out_free_eeprom; - /* At this point both hw and il are initialized. */ - - /******************** - * 7. Setup services - ********************/ - spin_lock_irqsave(&il->lock, flags); - il_disable_interrupts(il); - spin_unlock_irqrestore(&il->lock, flags); - - pci_enable_msi(il->pci_dev); - - err = request_irq(il->pci_dev->irq, il_isr, IRQF_SHARED, DRV_NAME, il); - if (err) { - IL_ERR("Error allocating IRQ %d\n", il->pci_dev->irq); - goto out_disable_msi; - } - - il4965_setup_deferred_work(il); - il4965_setup_handlers(il); - - /********************************************* - * 8. Enable interrupts and read RFKILL state - *********************************************/ - - /* enable rfkill interrupt: hw bug w/a */ - pci_read_config_word(il->pci_dev, PCI_COMMAND, &pci_cmd); - if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { - pci_cmd &= ~PCI_COMMAND_INTX_DISABLE; - pci_write_config_word(il->pci_dev, PCI_COMMAND, pci_cmd); - } - - il_enable_rfkill_int(il); - - /* If platform's RF_KILL switch is NOT set to KILL */ - if (_il_rd(il, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) - clear_bit(S_RFKILL, &il->status); - else - set_bit(S_RFKILL, &il->status); - - wiphy_rfkill_set_hw_state(il->hw->wiphy, - test_bit(S_RFKILL, &il->status)); - - il_power_initialize(il); - - init_completion(&il->_4965.firmware_loading_complete); - - err = il4965_request_firmware(il, true); - if (err) - goto out_destroy_workqueue; - - return 0; - -out_destroy_workqueue: - destroy_workqueue(il->workqueue); - il->workqueue = NULL; - free_irq(il->pci_dev->irq, il); -out_disable_msi: - pci_disable_msi(il->pci_dev); - il4965_uninit_drv(il); -out_free_eeprom: - il_eeprom_free(il); -out_iounmap: - iounmap(il->hw_base); -out_pci_release_regions: - pci_set_drvdata(pdev, NULL); - pci_release_regions(pdev); -out_pci_disable_device: - pci_disable_device(pdev); -out_ieee80211_free_hw: - ieee80211_free_hw(il->hw); -out: - return err; -} - -static void -il4965_pci_remove(struct pci_dev *pdev) -{ - struct il_priv *il = pci_get_drvdata(pdev); - unsigned long flags; - - if (!il) - return; - - wait_for_completion(&il->_4965.firmware_loading_complete); - - D_INFO("*** UNLOAD DRIVER ***\n"); - - il_dbgfs_unregister(il); - sysfs_remove_group(&pdev->dev.kobj, &il_attribute_group); - - /* ieee80211_unregister_hw call wil cause il_mac_stop to - * to be called and il4965_down since we are removing the device - * we need to set S_EXIT_PENDING bit. - */ - set_bit(S_EXIT_PENDING, &il->status); - - il_leds_exit(il); - - if (il->mac80211_registered) { - ieee80211_unregister_hw(il->hw); - il->mac80211_registered = 0; - } else { - il4965_down(il); - } - - /* - * Make sure device is reset to low power before unloading driver. - * This may be redundant with il4965_down(), but there are paths to - * run il4965_down() without calling apm_ops.stop(), and there are - * paths to avoid running il4965_down() at all before leaving driver. - * This (inexpensive) call *makes sure* device is reset. - */ - il_apm_stop(il); - - /* make sure we flush any pending irq or - * tasklet for the driver - */ - spin_lock_irqsave(&il->lock, flags); - il_disable_interrupts(il); - spin_unlock_irqrestore(&il->lock, flags); - - il4965_synchronize_irq(il); - - il4965_dealloc_ucode_pci(il); - - if (il->rxq.bd) - il4965_rx_queue_free(il, &il->rxq); - il4965_hw_txq_ctx_free(il); - - il_eeprom_free(il); - - /*netif_stop_queue(dev); */ - flush_workqueue(il->workqueue); - - /* ieee80211_unregister_hw calls il_mac_stop, which flushes - * il->workqueue... so we can't take down the workqueue - * until now... */ - destroy_workqueue(il->workqueue); - il->workqueue = NULL; - - free_irq(il->pci_dev->irq, il); - pci_disable_msi(il->pci_dev); - iounmap(il->hw_base); - pci_release_regions(pdev); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); - - il4965_uninit_drv(il); - - dev_kfree_skb(il->beacon_skb); - - ieee80211_free_hw(il->hw); -} - -/* - * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask - * must be called under il->lock and mac access - */ -void -il4965_txq_set_sched(struct il_priv *il, u32 mask) -{ - il_wr_prph(il, IL49_SCD_TXFACT, mask); -} - -/***************************************************************************** - * - * driver and module entry point - * - *****************************************************************************/ - -/* Hardware specific file defines the PCI IDs table for that hardware module */ -static DEFINE_PCI_DEVICE_TABLE(il4965_hw_card_ids) = { - {IL_PCI_DEVICE(0x4229, PCI_ANY_ID, il4965_cfg)}, - {IL_PCI_DEVICE(0x4230, PCI_ANY_ID, il4965_cfg)}, - {0} -}; -MODULE_DEVICE_TABLE(pci, il4965_hw_card_ids); - -static struct pci_driver il4965_driver = { - .name = DRV_NAME, - .id_table = il4965_hw_card_ids, - .probe = il4965_pci_probe, - .remove = il4965_pci_remove, - .driver.pm = IL_LEGACY_PM_OPS, -}; - -static int __init -il4965_init(void) -{ - - int ret; - pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n"); - pr_info(DRV_COPYRIGHT "\n"); - - ret = il4965_rate_control_register(); - if (ret) { - pr_err("Unable to register rate control algorithm: %d\n", ret); - return ret; - } - - ret = pci_register_driver(&il4965_driver); - if (ret) { - pr_err("Unable to initialize PCI module\n"); - goto error_register; - } - - return ret; - -error_register: - il4965_rate_control_unregister(); - return ret; -} - -static void __exit -il4965_exit(void) -{ - pci_unregister_driver(&il4965_driver); - il4965_rate_control_unregister(); -} - -module_exit(il4965_exit); -module_init(il4965_init); - -#ifdef CONFIG_IWLEGACY_DEBUG -module_param_named(debug, il_debug_level, uint, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(debug, "debug output mask"); -#endif - -module_param_named(swcrypto, il4965_mod_params.sw_crypto, int, S_IRUGO); -MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])"); -module_param_named(queues_num, il4965_mod_params.num_of_queues, int, S_IRUGO); -MODULE_PARM_DESC(queues_num, "number of hw queues."); -module_param_named(11n_disable, il4965_mod_params.disable_11n, int, S_IRUGO); -MODULE_PARM_DESC(11n_disable, "disable 11n functionality"); -module_param_named(amsdu_size_8K, il4965_mod_params.amsdu_size_8K, int, - S_IRUGO); -MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size"); -module_param_named(fw_restart, il4965_mod_params.restart_fw, int, S_IRUGO); -MODULE_PARM_DESC(fw_restart, "restart firmware in case of error"); diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c deleted file mode 100644 index ed3c42a63a43..000000000000 --- a/drivers/net/wireless/iwlegacy/4965-rs.c +++ /dev/null @@ -1,2836 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2005 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "common.h" -#include "4965.h" - -#define IL4965_RS_NAME "iwl-4965-rs" - -#define NUM_TRY_BEFORE_ANT_TOGGLE 1 -#define IL_NUMBER_TRY 1 -#define IL_HT_NUMBER_TRY 3 - -#define RATE_MAX_WINDOW 62 /* # tx in history win */ -#define RATE_MIN_FAILURE_TH 6 /* min failures to calc tpt */ -#define RATE_MIN_SUCCESS_TH 8 /* min successes to calc tpt */ - -/* max allowed rate miss before sync LQ cmd */ -#define IL_MISSED_RATE_MAX 15 -/* max time to accum history 2 seconds */ -#define RATE_SCALE_FLUSH_INTVL (3*HZ) - -static u8 rs_ht_to_legacy[] = { - RATE_6M_IDX, RATE_6M_IDX, - RATE_6M_IDX, RATE_6M_IDX, - RATE_6M_IDX, - RATE_6M_IDX, RATE_9M_IDX, - RATE_12M_IDX, RATE_18M_IDX, - RATE_24M_IDX, RATE_36M_IDX, - RATE_48M_IDX, RATE_54M_IDX -}; - -static const u8 ant_toggle_lookup[] = { - /*ANT_NONE -> */ ANT_NONE, - /*ANT_A -> */ ANT_B, - /*ANT_B -> */ ANT_C, - /*ANT_AB -> */ ANT_BC, - /*ANT_C -> */ ANT_A, - /*ANT_AC -> */ ANT_AB, - /*ANT_BC -> */ ANT_AC, - /*ANT_ABC -> */ ANT_ABC, -}; - -#define IL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ - [RATE_##r##M_IDX] = { RATE_##r##M_PLCP, \ - RATE_SISO_##s##M_PLCP, \ - RATE_MIMO2_##s##M_PLCP,\ - RATE_##r##M_IEEE, \ - RATE_##ip##M_IDX, \ - RATE_##in##M_IDX, \ - RATE_##rp##M_IDX, \ - RATE_##rn##M_IDX, \ - RATE_##pp##M_IDX, \ - RATE_##np##M_IDX } - -/* - * Parameter order: - * rate, ht rate, prev rate, next rate, prev tgg rate, next tgg rate - * - * If there isn't a valid next or previous rate then INV is used which - * maps to RATE_INVALID - * - */ -const struct il_rate_info il_rates[RATE_COUNT] = { - IL_DECLARE_RATE_INFO(1, INV, INV, 2, INV, 2, INV, 2), /* 1mbps */ - IL_DECLARE_RATE_INFO(2, INV, 1, 5, 1, 5, 1, 5), /* 2mbps */ - IL_DECLARE_RATE_INFO(5, INV, 2, 6, 2, 11, 2, 11), /*5.5mbps */ - IL_DECLARE_RATE_INFO(11, INV, 9, 12, 9, 12, 5, 18), /* 11mbps */ - IL_DECLARE_RATE_INFO(6, 6, 5, 9, 5, 11, 5, 11), /* 6mbps */ - IL_DECLARE_RATE_INFO(9, 6, 6, 11, 6, 11, 5, 11), /* 9mbps */ - IL_DECLARE_RATE_INFO(12, 12, 11, 18, 11, 18, 11, 18), /* 12mbps */ - IL_DECLARE_RATE_INFO(18, 18, 12, 24, 12, 24, 11, 24), /* 18mbps */ - IL_DECLARE_RATE_INFO(24, 24, 18, 36, 18, 36, 18, 36), /* 24mbps */ - IL_DECLARE_RATE_INFO(36, 36, 24, 48, 24, 48, 24, 48), /* 36mbps */ - IL_DECLARE_RATE_INFO(48, 48, 36, 54, 36, 54, 36, 54), /* 48mbps */ - IL_DECLARE_RATE_INFO(54, 54, 48, INV, 48, INV, 48, INV),/* 54mbps */ - IL_DECLARE_RATE_INFO(60, 60, 48, INV, 48, INV, 48, INV),/* 60mbps */ -}; - -static int -il4965_hwrate_to_plcp_idx(u32 rate_n_flags) -{ - int idx = 0; - - /* HT rate format */ - if (rate_n_flags & RATE_MCS_HT_MSK) { - idx = (rate_n_flags & 0xff); - - if (idx >= RATE_MIMO2_6M_PLCP) - idx = idx - RATE_MIMO2_6M_PLCP; - - idx += IL_FIRST_OFDM_RATE; - /* skip 9M not supported in ht */ - if (idx >= RATE_9M_IDX) - idx += 1; - if (idx >= IL_FIRST_OFDM_RATE && idx <= IL_LAST_OFDM_RATE) - return idx; - - /* legacy rate format, search for match in table */ - } else { - for (idx = 0; idx < ARRAY_SIZE(il_rates); idx++) - if (il_rates[idx].plcp == (rate_n_flags & 0xFF)) - return idx; - } - - return -1; -} - -static void il4965_rs_rate_scale_perform(struct il_priv *il, - struct sk_buff *skb, - struct ieee80211_sta *sta, - struct il_lq_sta *lq_sta); -static void il4965_rs_fill_link_cmd(struct il_priv *il, - struct il_lq_sta *lq_sta, u32 rate_n_flags); -static void il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, - bool force_search); - -#ifdef CONFIG_MAC80211_DEBUGFS -static void il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, - u32 *rate_n_flags, int idx); -#else -static void -il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, u32 * rate_n_flags, int idx) -{ -} -#endif - -/** - * The following tables contain the expected throughput metrics for all rates - * - * 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54, 60 MBits - * - * where invalid entries are zeros. - * - * CCK rates are only valid in legacy table and will only be used in G - * (2.4 GHz) band. - */ - -static s32 expected_tpt_legacy[RATE_COUNT] = { - 7, 13, 35, 58, 40, 57, 72, 98, 121, 154, 177, 186, 0 -}; - -static s32 expected_tpt_siso20MHz[4][RATE_COUNT] = { - {0, 0, 0, 0, 42, 0, 76, 102, 124, 158, 183, 193, 202}, /* Norm */ - {0, 0, 0, 0, 46, 0, 82, 110, 132, 167, 192, 202, 210}, /* SGI */ - {0, 0, 0, 0, 48, 0, 93, 135, 176, 251, 319, 351, 381}, /* AGG */ - {0, 0, 0, 0, 53, 0, 102, 149, 193, 275, 348, 381, 413}, /* AGG+SGI */ -}; - -static s32 expected_tpt_siso40MHz[4][RATE_COUNT] = { - {0, 0, 0, 0, 77, 0, 127, 160, 184, 220, 242, 250, 257}, /* Norm */ - {0, 0, 0, 0, 83, 0, 135, 169, 193, 229, 250, 257, 264}, /* SGI */ - {0, 0, 0, 0, 96, 0, 182, 259, 328, 451, 553, 598, 640}, /* AGG */ - {0, 0, 0, 0, 106, 0, 199, 282, 357, 487, 593, 640, 683}, /* AGG+SGI */ -}; - -static s32 expected_tpt_mimo2_20MHz[4][RATE_COUNT] = { - {0, 0, 0, 0, 74, 0, 123, 155, 179, 213, 235, 243, 250}, /* Norm */ - {0, 0, 0, 0, 81, 0, 131, 164, 187, 221, 242, 250, 256}, /* SGI */ - {0, 0, 0, 0, 92, 0, 175, 250, 317, 436, 534, 578, 619}, /* AGG */ - {0, 0, 0, 0, 102, 0, 192, 273, 344, 470, 573, 619, 660}, /* AGG+SGI */ -}; - -static s32 expected_tpt_mimo2_40MHz[4][RATE_COUNT] = { - {0, 0, 0, 0, 123, 0, 182, 214, 235, 264, 279, 285, 289}, /* Norm */ - {0, 0, 0, 0, 131, 0, 191, 222, 242, 270, 284, 289, 293}, /* SGI */ - {0, 0, 0, 0, 180, 0, 327, 446, 545, 708, 828, 878, 922}, /* AGG */ - {0, 0, 0, 0, 197, 0, 355, 481, 584, 752, 872, 922, 966}, /* AGG+SGI */ -}; - -/* mbps, mcs */ -static const struct il_rate_mcs_info il_rate_mcs[RATE_COUNT] = { - {"1", "BPSK DSSS"}, - {"2", "QPSK DSSS"}, - {"5.5", "BPSK CCK"}, - {"11", "QPSK CCK"}, - {"6", "BPSK 1/2"}, - {"9", "BPSK 1/2"}, - {"12", "QPSK 1/2"}, - {"18", "QPSK 3/4"}, - {"24", "16QAM 1/2"}, - {"36", "16QAM 3/4"}, - {"48", "64QAM 2/3"}, - {"54", "64QAM 3/4"}, - {"60", "64QAM 5/6"}, -}; - -#define MCS_IDX_PER_STREAM (8) - -static inline u8 -il4965_rs_extract_rate(u32 rate_n_flags) -{ - return (u8) (rate_n_flags & 0xFF); -} - -static void -il4965_rs_rate_scale_clear_win(struct il_rate_scale_data *win) -{ - win->data = 0; - win->success_counter = 0; - win->success_ratio = IL_INVALID_VALUE; - win->counter = 0; - win->average_tpt = IL_INVALID_VALUE; - win->stamp = 0; -} - -static inline u8 -il4965_rs_is_valid_ant(u8 valid_antenna, u8 ant_type) -{ - return (ant_type & valid_antenna) == ant_type; -} - -/* - * removes the old data from the stats. All data that is older than - * TID_MAX_TIME_DIFF, will be deleted. - */ -static void -il4965_rs_tl_rm_old_stats(struct il_traffic_load *tl, u32 curr_time) -{ - /* The oldest age we want to keep */ - u32 oldest_time = curr_time - TID_MAX_TIME_DIFF; - - while (tl->queue_count && tl->time_stamp < oldest_time) { - tl->total -= tl->packet_count[tl->head]; - tl->packet_count[tl->head] = 0; - tl->time_stamp += TID_QUEUE_CELL_SPACING; - tl->queue_count--; - tl->head++; - if (tl->head >= TID_QUEUE_MAX_SIZE) - tl->head = 0; - } -} - -/* - * increment traffic load value for tid and also remove - * any old values if passed the certain time period - */ -static u8 -il4965_rs_tl_add_packet(struct il_lq_sta *lq_data, struct ieee80211_hdr *hdr) -{ - u32 curr_time = jiffies_to_msecs(jiffies); - u32 time_diff; - s32 idx; - struct il_traffic_load *tl = NULL; - u8 tid; - - if (ieee80211_is_data_qos(hdr->frame_control)) { - u8 *qc = ieee80211_get_qos_ctl(hdr); - tid = qc[0] & 0xf; - } else - return MAX_TID_COUNT; - - if (unlikely(tid >= TID_MAX_LOAD_COUNT)) - return MAX_TID_COUNT; - - tl = &lq_data->load[tid]; - - curr_time -= curr_time % TID_ROUND_VALUE; - - /* Happens only for the first packet. Initialize the data */ - if (!(tl->queue_count)) { - tl->total = 1; - tl->time_stamp = curr_time; - tl->queue_count = 1; - tl->head = 0; - tl->packet_count[0] = 1; - return MAX_TID_COUNT; - } - - time_diff = TIME_WRAP_AROUND(tl->time_stamp, curr_time); - idx = time_diff / TID_QUEUE_CELL_SPACING; - - /* The history is too long: remove data that is older than */ - /* TID_MAX_TIME_DIFF */ - if (idx >= TID_QUEUE_MAX_SIZE) - il4965_rs_tl_rm_old_stats(tl, curr_time); - - idx = (tl->head + idx) % TID_QUEUE_MAX_SIZE; - tl->packet_count[idx] = tl->packet_count[idx] + 1; - tl->total = tl->total + 1; - - if ((idx + 1) > tl->queue_count) - tl->queue_count = idx + 1; - - return tid; -} - -/* - get the traffic load value for tid -*/ -static u32 -il4965_rs_tl_get_load(struct il_lq_sta *lq_data, u8 tid) -{ - u32 curr_time = jiffies_to_msecs(jiffies); - u32 time_diff; - s32 idx; - struct il_traffic_load *tl = NULL; - - if (tid >= TID_MAX_LOAD_COUNT) - return 0; - - tl = &(lq_data->load[tid]); - - curr_time -= curr_time % TID_ROUND_VALUE; - - if (!(tl->queue_count)) - return 0; - - time_diff = TIME_WRAP_AROUND(tl->time_stamp, curr_time); - idx = time_diff / TID_QUEUE_CELL_SPACING; - - /* The history is too long: remove data that is older than */ - /* TID_MAX_TIME_DIFF */ - if (idx >= TID_QUEUE_MAX_SIZE) - il4965_rs_tl_rm_old_stats(tl, curr_time); - - return tl->total; -} - -static int -il4965_rs_tl_turn_on_agg_for_tid(struct il_priv *il, struct il_lq_sta *lq_data, - u8 tid, struct ieee80211_sta *sta) -{ - int ret = -EAGAIN; - u32 load; - - load = il4965_rs_tl_get_load(lq_data, tid); - - if (load > IL_AGG_LOAD_THRESHOLD) { - D_HT("Starting Tx agg: STA: %pM tid: %d\n", sta->addr, tid); - ret = ieee80211_start_tx_ba_session(sta, tid, 5000); - if (ret == -EAGAIN) { - /* - * driver and mac80211 is out of sync - * this might be cause by reloading firmware - * stop the tx ba session here - */ - IL_ERR("Fail start Tx agg on tid: %d\n", tid); - ieee80211_stop_tx_ba_session(sta, tid); - } - } else - D_HT("Aggregation not enabled for tid %d because load = %u\n", - tid, load); - - return ret; -} - -static void -il4965_rs_tl_turn_on_agg(struct il_priv *il, u8 tid, struct il_lq_sta *lq_data, - struct ieee80211_sta *sta) -{ - if (tid < TID_MAX_LOAD_COUNT) - il4965_rs_tl_turn_on_agg_for_tid(il, lq_data, tid, sta); - else - IL_ERR("tid exceeds max load count: %d/%d\n", tid, - TID_MAX_LOAD_COUNT); -} - -static inline int -il4965_get_il4965_num_of_ant_from_rate(u32 rate_n_flags) -{ - return !!(rate_n_flags & RATE_MCS_ANT_A_MSK) + - !!(rate_n_flags & RATE_MCS_ANT_B_MSK) + - !!(rate_n_flags & RATE_MCS_ANT_C_MSK); -} - -/* - * Static function to get the expected throughput from an il_scale_tbl_info - * that wraps a NULL pointer check - */ -static s32 -il4965_get_expected_tpt(struct il_scale_tbl_info *tbl, int rs_idx) -{ - if (tbl->expected_tpt) - return tbl->expected_tpt[rs_idx]; - return 0; -} - -/** - * il4965_rs_collect_tx_data - Update the success/failure sliding win - * - * We keep a sliding win of the last 62 packets transmitted - * at this rate. win->data contains the bitmask of successful - * packets. - */ -static int -il4965_rs_collect_tx_data(struct il_scale_tbl_info *tbl, int scale_idx, - int attempts, int successes) -{ - struct il_rate_scale_data *win = NULL; - static const u64 mask = (((u64) 1) << (RATE_MAX_WINDOW - 1)); - s32 fail_count, tpt; - - if (scale_idx < 0 || scale_idx >= RATE_COUNT) - return -EINVAL; - - /* Select win for current tx bit rate */ - win = &(tbl->win[scale_idx]); - - /* Get expected throughput */ - tpt = il4965_get_expected_tpt(tbl, scale_idx); - - /* - * Keep track of only the latest 62 tx frame attempts in this rate's - * history win; anything older isn't really relevant any more. - * If we have filled up the sliding win, drop the oldest attempt; - * if the oldest attempt (highest bit in bitmap) shows "success", - * subtract "1" from the success counter (this is the main reason - * we keep these bitmaps!). - */ - while (attempts > 0) { - if (win->counter >= RATE_MAX_WINDOW) { - - /* remove earliest */ - win->counter = RATE_MAX_WINDOW - 1; - - if (win->data & mask) { - win->data &= ~mask; - win->success_counter--; - } - } - - /* Increment frames-attempted counter */ - win->counter++; - - /* Shift bitmap by one frame to throw away oldest history */ - win->data <<= 1; - - /* Mark the most recent #successes attempts as successful */ - if (successes > 0) { - win->success_counter++; - win->data |= 0x1; - successes--; - } - - attempts--; - } - - /* Calculate current success ratio, avoid divide-by-0! */ - if (win->counter > 0) - win->success_ratio = - 128 * (100 * win->success_counter) / win->counter; - else - win->success_ratio = IL_INVALID_VALUE; - - fail_count = win->counter - win->success_counter; - - /* Calculate average throughput, if we have enough history. */ - if (fail_count >= RATE_MIN_FAILURE_TH || - win->success_counter >= RATE_MIN_SUCCESS_TH) - win->average_tpt = (win->success_ratio * tpt + 64) / 128; - else - win->average_tpt = IL_INVALID_VALUE; - - /* Tag this win as having been updated */ - win->stamp = jiffies; - - return 0; -} - -/* - * Fill uCode API rate_n_flags field, based on "search" or "active" table. - */ -static u32 -il4965_rate_n_flags_from_tbl(struct il_priv *il, struct il_scale_tbl_info *tbl, - int idx, u8 use_green) -{ - u32 rate_n_flags = 0; - - if (is_legacy(tbl->lq_type)) { - rate_n_flags = il_rates[idx].plcp; - if (idx >= IL_FIRST_CCK_RATE && idx <= IL_LAST_CCK_RATE) - rate_n_flags |= RATE_MCS_CCK_MSK; - - } else if (is_Ht(tbl->lq_type)) { - if (idx > IL_LAST_OFDM_RATE) { - IL_ERR("Invalid HT rate idx %d\n", idx); - idx = IL_LAST_OFDM_RATE; - } - rate_n_flags = RATE_MCS_HT_MSK; - - if (is_siso(tbl->lq_type)) - rate_n_flags |= il_rates[idx].plcp_siso; - else - rate_n_flags |= il_rates[idx].plcp_mimo2; - } else { - IL_ERR("Invalid tbl->lq_type %d\n", tbl->lq_type); - } - - rate_n_flags |= - ((tbl->ant_type << RATE_MCS_ANT_POS) & RATE_MCS_ANT_ABC_MSK); - - if (is_Ht(tbl->lq_type)) { - if (tbl->is_ht40) { - if (tbl->is_dup) - rate_n_flags |= RATE_MCS_DUP_MSK; - else - rate_n_flags |= RATE_MCS_HT40_MSK; - } - if (tbl->is_SGI) - rate_n_flags |= RATE_MCS_SGI_MSK; - - if (use_green) { - rate_n_flags |= RATE_MCS_GF_MSK; - if (is_siso(tbl->lq_type) && tbl->is_SGI) { - rate_n_flags &= ~RATE_MCS_SGI_MSK; - IL_ERR("GF was set with SGI:SISO\n"); - } - } - } - return rate_n_flags; -} - -/* - * Interpret uCode API's rate_n_flags format, - * fill "search" or "active" tx mode table. - */ -static int -il4965_rs_get_tbl_info_from_mcs(const u32 rate_n_flags, - enum ieee80211_band band, - struct il_scale_tbl_info *tbl, int *rate_idx) -{ - u32 ant_msk = (rate_n_flags & RATE_MCS_ANT_ABC_MSK); - u8 il4965_num_of_ant = - il4965_get_il4965_num_of_ant_from_rate(rate_n_flags); - u8 mcs; - - memset(tbl, 0, sizeof(struct il_scale_tbl_info)); - *rate_idx = il4965_hwrate_to_plcp_idx(rate_n_flags); - - if (*rate_idx == RATE_INVALID) { - *rate_idx = -1; - return -EINVAL; - } - tbl->is_SGI = 0; /* default legacy setup */ - tbl->is_ht40 = 0; - tbl->is_dup = 0; - tbl->ant_type = (ant_msk >> RATE_MCS_ANT_POS); - tbl->lq_type = LQ_NONE; - tbl->max_search = IL_MAX_SEARCH; - - /* legacy rate format */ - if (!(rate_n_flags & RATE_MCS_HT_MSK)) { - if (il4965_num_of_ant == 1) { - if (band == IEEE80211_BAND_5GHZ) - tbl->lq_type = LQ_A; - else - tbl->lq_type = LQ_G; - } - /* HT rate format */ - } else { - if (rate_n_flags & RATE_MCS_SGI_MSK) - tbl->is_SGI = 1; - - if ((rate_n_flags & RATE_MCS_HT40_MSK) || - (rate_n_flags & RATE_MCS_DUP_MSK)) - tbl->is_ht40 = 1; - - if (rate_n_flags & RATE_MCS_DUP_MSK) - tbl->is_dup = 1; - - mcs = il4965_rs_extract_rate(rate_n_flags); - - /* SISO */ - if (mcs <= RATE_SISO_60M_PLCP) { - if (il4965_num_of_ant == 1) - tbl->lq_type = LQ_SISO; /*else NONE */ - /* MIMO2 */ - } else { - if (il4965_num_of_ant == 2) - tbl->lq_type = LQ_MIMO2; - } - } - return 0; -} - -/* switch to another antenna/antennas and return 1 */ -/* if no other valid antenna found, return 0 */ -static int -il4965_rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags, - struct il_scale_tbl_info *tbl) -{ - u8 new_ant_type; - - if (!tbl->ant_type || tbl->ant_type > ANT_ABC) - return 0; - - if (!il4965_rs_is_valid_ant(valid_ant, tbl->ant_type)) - return 0; - - new_ant_type = ant_toggle_lookup[tbl->ant_type]; - - while (new_ant_type != tbl->ant_type && - !il4965_rs_is_valid_ant(valid_ant, new_ant_type)) - new_ant_type = ant_toggle_lookup[new_ant_type]; - - if (new_ant_type == tbl->ant_type) - return 0; - - tbl->ant_type = new_ant_type; - *rate_n_flags &= ~RATE_MCS_ANT_ABC_MSK; - *rate_n_flags |= new_ant_type << RATE_MCS_ANT_POS; - return 1; -} - -/** - * Green-field mode is valid if the station supports it and - * there are no non-GF stations present in the BSS. - */ -static bool -il4965_rs_use_green(struct il_priv *il, struct ieee80211_sta *sta) -{ - return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) && - !il->ht.non_gf_sta_present; -} - -/** - * il4965_rs_get_supported_rates - get the available rates - * - * if management frame or broadcast frame only return - * basic available rates. - * - */ -static u16 -il4965_rs_get_supported_rates(struct il_lq_sta *lq_sta, - struct ieee80211_hdr *hdr, - enum il_table_type rate_type) -{ - if (is_legacy(rate_type)) { - return lq_sta->active_legacy_rate; - } else { - if (is_siso(rate_type)) - return lq_sta->active_siso_rate; - else - return lq_sta->active_mimo2_rate; - } -} - -static u16 -il4965_rs_get_adjacent_rate(struct il_priv *il, u8 idx, u16 rate_mask, - int rate_type) -{ - u8 high = RATE_INVALID; - u8 low = RATE_INVALID; - - /* 802.11A or ht walks to the next literal adjacent rate in - * the rate table */ - if (is_a_band(rate_type) || !is_legacy(rate_type)) { - int i; - u32 mask; - - /* Find the previous rate that is in the rate mask */ - i = idx - 1; - for (mask = (1 << i); i >= 0; i--, mask >>= 1) { - if (rate_mask & mask) { - low = i; - break; - } - } - - /* Find the next rate that is in the rate mask */ - i = idx + 1; - for (mask = (1 << i); i < RATE_COUNT; i++, mask <<= 1) { - if (rate_mask & mask) { - high = i; - break; - } - } - - return (high << 8) | low; - } - - low = idx; - while (low != RATE_INVALID) { - low = il_rates[low].prev_rs; - if (low == RATE_INVALID) - break; - if (rate_mask & (1 << low)) - break; - D_RATE("Skipping masked lower rate: %d\n", low); - } - - high = idx; - while (high != RATE_INVALID) { - high = il_rates[high].next_rs; - if (high == RATE_INVALID) - break; - if (rate_mask & (1 << high)) - break; - D_RATE("Skipping masked higher rate: %d\n", high); - } - - return (high << 8) | low; -} - -static u32 -il4965_rs_get_lower_rate(struct il_lq_sta *lq_sta, - struct il_scale_tbl_info *tbl, u8 scale_idx, - u8 ht_possible) -{ - s32 low; - u16 rate_mask; - u16 high_low; - u8 switch_to_legacy = 0; - u8 is_green = lq_sta->is_green; - struct il_priv *il = lq_sta->drv; - - /* check if we need to switch from HT to legacy rates. - * assumption is that mandatory rates (1Mbps or 6Mbps) - * are always supported (spec demand) */ - if (!is_legacy(tbl->lq_type) && (!ht_possible || !scale_idx)) { - switch_to_legacy = 1; - scale_idx = rs_ht_to_legacy[scale_idx]; - if (lq_sta->band == IEEE80211_BAND_5GHZ) - tbl->lq_type = LQ_A; - else - tbl->lq_type = LQ_G; - - if (il4965_num_of_ant(tbl->ant_type) > 1) - tbl->ant_type = - il4965_first_antenna(il->hw_params.valid_tx_ant); - - tbl->is_ht40 = 0; - tbl->is_SGI = 0; - tbl->max_search = IL_MAX_SEARCH; - } - - rate_mask = il4965_rs_get_supported_rates(lq_sta, NULL, tbl->lq_type); - - /* Mask with station rate restriction */ - if (is_legacy(tbl->lq_type)) { - /* supp_rates has no CCK bits in A mode */ - if (lq_sta->band == IEEE80211_BAND_5GHZ) - rate_mask = - (u16) (rate_mask & - (lq_sta->supp_rates << IL_FIRST_OFDM_RATE)); - else - rate_mask = (u16) (rate_mask & lq_sta->supp_rates); - } - - /* If we switched from HT to legacy, check current rate */ - if (switch_to_legacy && (rate_mask & (1 << scale_idx))) { - low = scale_idx; - goto out; - } - - high_low = - il4965_rs_get_adjacent_rate(lq_sta->drv, scale_idx, rate_mask, - tbl->lq_type); - low = high_low & 0xff; - - if (low == RATE_INVALID) - low = scale_idx; - -out: - return il4965_rate_n_flags_from_tbl(lq_sta->drv, tbl, low, is_green); -} - -/* - * Simple function to compare two rate scale table types - */ -static bool -il4965_table_type_matches(struct il_scale_tbl_info *a, - struct il_scale_tbl_info *b) -{ - return (a->lq_type == b->lq_type && a->ant_type == b->ant_type && - a->is_SGI == b->is_SGI); -} - -/* - * mac80211 sends us Tx status - */ -static void -il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *il_sta, - struct sk_buff *skb) -{ - int legacy_success; - int retries; - int rs_idx, mac_idx, i; - struct il_lq_sta *lq_sta = il_sta; - struct il_link_quality_cmd *table; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct il_priv *il = (struct il_priv *)il_r; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - enum mac80211_rate_control_flags mac_flags; - u32 tx_rate; - struct il_scale_tbl_info tbl_type; - struct il_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; - - D_RATE("get frame ack response, update rate scale win\n"); - - /* Treat uninitialized rate scaling data same as non-existing. */ - if (!lq_sta) { - D_RATE("Station rate scaling not created yet.\n"); - return; - } else if (!lq_sta->drv) { - D_RATE("Rate scaling not initialized yet.\n"); - return; - } - - if (!ieee80211_is_data(hdr->frame_control) || - (info->flags & IEEE80211_TX_CTL_NO_ACK)) - return; - - /* This packet was aggregated but doesn't carry status info */ - if ((info->flags & IEEE80211_TX_CTL_AMPDU) && - !(info->flags & IEEE80211_TX_STAT_AMPDU)) - return; - - /* - * Ignore this Tx frame response if its initial rate doesn't match - * that of latest Link Quality command. There may be stragglers - * from a previous Link Quality command, but we're no longer interested - * in those; they're either from the "active" mode while we're trying - * to check "search" mode, or a prior "search" mode after we've moved - * to a new "search" mode (which might become the new "active" mode). - */ - table = &lq_sta->lq; - tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); - il4965_rs_get_tbl_info_from_mcs(tx_rate, il->band, &tbl_type, &rs_idx); - if (il->band == IEEE80211_BAND_5GHZ) - rs_idx -= IL_FIRST_OFDM_RATE; - mac_flags = info->status.rates[0].flags; - mac_idx = info->status.rates[0].idx; - /* For HT packets, map MCS to PLCP */ - if (mac_flags & IEEE80211_TX_RC_MCS) { - mac_idx &= RATE_MCS_CODE_MSK; /* Remove # of streams */ - if (mac_idx >= (RATE_9M_IDX - IL_FIRST_OFDM_RATE)) - mac_idx++; - /* - * mac80211 HT idx is always zero-idxed; we need to move - * HT OFDM rates after CCK rates in 2.4 GHz band - */ - if (il->band == IEEE80211_BAND_2GHZ) - mac_idx += IL_FIRST_OFDM_RATE; - } - /* Here we actually compare this rate to the latest LQ command */ - if (mac_idx < 0 || - tbl_type.is_SGI != !!(mac_flags & IEEE80211_TX_RC_SHORT_GI) || - tbl_type.is_ht40 != !!(mac_flags & IEEE80211_TX_RC_40_MHZ_WIDTH) || - tbl_type.is_dup != !!(mac_flags & IEEE80211_TX_RC_DUP_DATA) || - tbl_type.ant_type != info->status.antenna || - !!(tx_rate & RATE_MCS_HT_MSK) != !!(mac_flags & IEEE80211_TX_RC_MCS) - || !!(tx_rate & RATE_MCS_GF_MSK) != - !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD) || rs_idx != mac_idx) { - D_RATE("initial rate %d does not match %d (0x%x)\n", mac_idx, - rs_idx, tx_rate); - /* - * Since rates mis-match, the last LQ command may have failed. - * After IL_MISSED_RATE_MAX mis-matches, resync the uCode with - * ... driver. - */ - lq_sta->missed_rate_counter++; - if (lq_sta->missed_rate_counter > IL_MISSED_RATE_MAX) { - lq_sta->missed_rate_counter = 0; - il_send_lq_cmd(il, &lq_sta->lq, CMD_ASYNC, false); - } - /* Regardless, ignore this status info for outdated rate */ - return; - } else - /* Rate did match, so reset the missed_rate_counter */ - lq_sta->missed_rate_counter = 0; - - /* Figure out if rate scale algorithm is in active or search table */ - if (il4965_table_type_matches - (&tbl_type, &(lq_sta->lq_info[lq_sta->active_tbl]))) { - curr_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - other_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); - } else - if (il4965_table_type_matches - (&tbl_type, &lq_sta->lq_info[1 - lq_sta->active_tbl])) { - curr_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); - other_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - } else { - D_RATE("Neither active nor search matches tx rate\n"); - tmp_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - D_RATE("active- lq:%x, ant:%x, SGI:%d\n", tmp_tbl->lq_type, - tmp_tbl->ant_type, tmp_tbl->is_SGI); - tmp_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); - D_RATE("search- lq:%x, ant:%x, SGI:%d\n", tmp_tbl->lq_type, - tmp_tbl->ant_type, tmp_tbl->is_SGI); - D_RATE("actual- lq:%x, ant:%x, SGI:%d\n", tbl_type.lq_type, - tbl_type.ant_type, tbl_type.is_SGI); - /* - * no matching table found, let's by-pass the data collection - * and continue to perform rate scale to find the rate table - */ - il4965_rs_stay_in_table(lq_sta, true); - goto done; - } - - /* - * Updating the frame history depends on whether packets were - * aggregated. - * - * For aggregation, all packets were transmitted at the same rate, the - * first idx into rate scale table. - */ - if (info->flags & IEEE80211_TX_STAT_AMPDU) { - tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); - il4965_rs_get_tbl_info_from_mcs(tx_rate, il->band, &tbl_type, - &rs_idx); - il4965_rs_collect_tx_data(curr_tbl, rs_idx, - info->status.ampdu_len, - info->status.ampdu_ack_len); - - /* Update success/fail counts if not searching for new mode */ - if (lq_sta->stay_in_tbl) { - lq_sta->total_success += info->status.ampdu_ack_len; - lq_sta->total_failed += - (info->status.ampdu_len - - info->status.ampdu_ack_len); - } - } else { - /* - * For legacy, update frame history with for each Tx retry. - */ - retries = info->status.rates[0].count - 1; - /* HW doesn't send more than 15 retries */ - retries = min(retries, 15); - - /* The last transmission may have been successful */ - legacy_success = !!(info->flags & IEEE80211_TX_STAT_ACK); - /* Collect data for each rate used during failed TX attempts */ - for (i = 0; i <= retries; ++i) { - tx_rate = le32_to_cpu(table->rs_table[i].rate_n_flags); - il4965_rs_get_tbl_info_from_mcs(tx_rate, il->band, - &tbl_type, &rs_idx); - /* - * Only collect stats if retried rate is in the same RS - * table as active/search. - */ - if (il4965_table_type_matches(&tbl_type, curr_tbl)) - tmp_tbl = curr_tbl; - else if (il4965_table_type_matches - (&tbl_type, other_tbl)) - tmp_tbl = other_tbl; - else - continue; - il4965_rs_collect_tx_data(tmp_tbl, rs_idx, 1, - i < - retries ? 0 : legacy_success); - } - - /* Update success/fail counts if not searching for new mode */ - if (lq_sta->stay_in_tbl) { - lq_sta->total_success += legacy_success; - lq_sta->total_failed += retries + (1 - legacy_success); - } - } - /* The last TX rate is cached in lq_sta; it's set in if/else above */ - lq_sta->last_rate_n_flags = tx_rate; -done: - /* See if there's a better rate or modulation mode to try. */ - if (sta->supp_rates[sband->band]) - il4965_rs_rate_scale_perform(il, skb, sta, lq_sta); -} - -/* - * Begin a period of staying with a selected modulation mode. - * Set "stay_in_tbl" flag to prevent any mode switches. - * Set frame tx success limits according to legacy vs. high-throughput, - * and reset overall (spanning all rates) tx success history stats. - * These control how long we stay using same modulation mode before - * searching for a new mode. - */ -static void -il4965_rs_set_stay_in_table(struct il_priv *il, u8 is_legacy, - struct il_lq_sta *lq_sta) -{ - D_RATE("we are staying in the same table\n"); - lq_sta->stay_in_tbl = 1; /* only place this gets set */ - if (is_legacy) { - lq_sta->table_count_limit = IL_LEGACY_TBL_COUNT; - lq_sta->max_failure_limit = IL_LEGACY_FAILURE_LIMIT; - lq_sta->max_success_limit = IL_LEGACY_SUCCESS_LIMIT; - } else { - lq_sta->table_count_limit = IL_NONE_LEGACY_TBL_COUNT; - lq_sta->max_failure_limit = IL_NONE_LEGACY_FAILURE_LIMIT; - lq_sta->max_success_limit = IL_NONE_LEGACY_SUCCESS_LIMIT; - } - lq_sta->table_count = 0; - lq_sta->total_failed = 0; - lq_sta->total_success = 0; - lq_sta->flush_timer = jiffies; - lq_sta->action_counter = 0; -} - -/* - * Find correct throughput table for given mode of modulation - */ -static void -il4965_rs_set_expected_tpt_table(struct il_lq_sta *lq_sta, - struct il_scale_tbl_info *tbl) -{ - /* Used to choose among HT tables */ - s32(*ht_tbl_pointer)[RATE_COUNT]; - - /* Check for invalid LQ type */ - if (WARN_ON_ONCE(!is_legacy(tbl->lq_type) && !is_Ht(tbl->lq_type))) { - tbl->expected_tpt = expected_tpt_legacy; - return; - } - - /* Legacy rates have only one table */ - if (is_legacy(tbl->lq_type)) { - tbl->expected_tpt = expected_tpt_legacy; - return; - } - - /* Choose among many HT tables depending on number of streams - * (SISO/MIMO2), channel width (20/40), SGI, and aggregation - * status */ - if (is_siso(tbl->lq_type) && (!tbl->is_ht40 || lq_sta->is_dup)) - ht_tbl_pointer = expected_tpt_siso20MHz; - else if (is_siso(tbl->lq_type)) - ht_tbl_pointer = expected_tpt_siso40MHz; - else if (is_mimo2(tbl->lq_type) && (!tbl->is_ht40 || lq_sta->is_dup)) - ht_tbl_pointer = expected_tpt_mimo2_20MHz; - else /* if (is_mimo2(tbl->lq_type)) <-- must be true */ - ht_tbl_pointer = expected_tpt_mimo2_40MHz; - - if (!tbl->is_SGI && !lq_sta->is_agg) /* Normal */ - tbl->expected_tpt = ht_tbl_pointer[0]; - else if (tbl->is_SGI && !lq_sta->is_agg) /* SGI */ - tbl->expected_tpt = ht_tbl_pointer[1]; - else if (!tbl->is_SGI && lq_sta->is_agg) /* AGG */ - tbl->expected_tpt = ht_tbl_pointer[2]; - else /* AGG+SGI */ - tbl->expected_tpt = ht_tbl_pointer[3]; -} - -/* - * Find starting rate for new "search" high-throughput mode of modulation. - * Goal is to find lowest expected rate (under perfect conditions) that is - * above the current measured throughput of "active" mode, to give new mode - * a fair chance to prove itself without too many challenges. - * - * This gets called when transitioning to more aggressive modulation - * (i.e. legacy to SISO or MIMO, or SISO to MIMO), as well as less aggressive - * (i.e. MIMO to SISO). When moving to MIMO, bit rate will typically need - * to decrease to match "active" throughput. When moving from MIMO to SISO, - * bit rate will typically need to increase, but not if performance was bad. - */ -static s32 -il4965_rs_get_best_rate(struct il_priv *il, struct il_lq_sta *lq_sta, - struct il_scale_tbl_info *tbl, /* "search" */ - u16 rate_mask, s8 idx) -{ - /* "active" values */ - struct il_scale_tbl_info *active_tbl = - &(lq_sta->lq_info[lq_sta->active_tbl]); - s32 active_sr = active_tbl->win[idx].success_ratio; - s32 active_tpt = active_tbl->expected_tpt[idx]; - - /* expected "search" throughput */ - s32 *tpt_tbl = tbl->expected_tpt; - - s32 new_rate, high, low, start_hi; - u16 high_low; - s8 rate = idx; - - new_rate = high = low = start_hi = RATE_INVALID; - - for (;;) { - high_low = - il4965_rs_get_adjacent_rate(il, rate, rate_mask, - tbl->lq_type); - - low = high_low & 0xff; - high = (high_low >> 8) & 0xff; - - /* - * Lower the "search" bit rate, to give new "search" mode - * approximately the same throughput as "active" if: - * - * 1) "Active" mode has been working modestly well (but not - * great), and expected "search" throughput (under perfect - * conditions) at candidate rate is above the actual - * measured "active" throughput (but less than expected - * "active" throughput under perfect conditions). - * OR - * 2) "Active" mode has been working perfectly or very well - * and expected "search" throughput (under perfect - * conditions) at candidate rate is above expected - * "active" throughput (under perfect conditions). - */ - if ((100 * tpt_tbl[rate] > lq_sta->last_tpt && - (active_sr > RATE_DECREASE_TH && active_sr <= RATE_HIGH_TH - && tpt_tbl[rate] <= active_tpt)) || - (active_sr >= RATE_SCALE_SWITCH && - tpt_tbl[rate] > active_tpt)) { - - /* (2nd or later pass) - * If we've already tried to raise the rate, and are - * now trying to lower it, use the higher rate. */ - if (start_hi != RATE_INVALID) { - new_rate = start_hi; - break; - } - - new_rate = rate; - - /* Loop again with lower rate */ - if (low != RATE_INVALID) - rate = low; - - /* Lower rate not available, use the original */ - else - break; - - /* Else try to raise the "search" rate to match "active" */ - } else { - /* (2nd or later pass) - * If we've already tried to lower the rate, and are - * now trying to raise it, use the lower rate. */ - if (new_rate != RATE_INVALID) - break; - - /* Loop again with higher rate */ - else if (high != RATE_INVALID) { - start_hi = high; - rate = high; - - /* Higher rate not available, use the original */ - } else { - new_rate = rate; - break; - } - } - } - - return new_rate; -} - -/* - * Set up search table for MIMO2 - */ -static int -il4965_rs_switch_to_mimo2(struct il_priv *il, struct il_lq_sta *lq_sta, - struct ieee80211_conf *conf, - struct ieee80211_sta *sta, - struct il_scale_tbl_info *tbl, int idx) -{ - u16 rate_mask; - s32 rate; - s8 is_green = lq_sta->is_green; - - if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) - return -1; - - if (sta->smps_mode == IEEE80211_SMPS_STATIC) - return -1; - - /* Need both Tx chains/antennas to support MIMO */ - if (il->hw_params.tx_chains_num < 2) - return -1; - - D_RATE("LQ: try to switch to MIMO2\n"); - - tbl->lq_type = LQ_MIMO2; - tbl->is_dup = lq_sta->is_dup; - tbl->action = 0; - tbl->max_search = IL_MAX_SEARCH; - rate_mask = lq_sta->active_mimo2_rate; - - if (il_is_ht40_tx_allowed(il, &sta->ht_cap)) - tbl->is_ht40 = 1; - else - tbl->is_ht40 = 0; - - il4965_rs_set_expected_tpt_table(lq_sta, tbl); - - rate = il4965_rs_get_best_rate(il, lq_sta, tbl, rate_mask, idx); - - D_RATE("LQ: MIMO2 best rate %d mask %X\n", rate, rate_mask); - if (rate == RATE_INVALID || !((1 << rate) & rate_mask)) { - D_RATE("Can't switch with idx %d rate mask %x\n", rate, - rate_mask); - return -1; - } - tbl->current_rate = - il4965_rate_n_flags_from_tbl(il, tbl, rate, is_green); - - D_RATE("LQ: Switch to new mcs %X idx is green %X\n", tbl->current_rate, - is_green); - return 0; -} - -/* - * Set up search table for SISO - */ -static int -il4965_rs_switch_to_siso(struct il_priv *il, struct il_lq_sta *lq_sta, - struct ieee80211_conf *conf, struct ieee80211_sta *sta, - struct il_scale_tbl_info *tbl, int idx) -{ - u16 rate_mask; - u8 is_green = lq_sta->is_green; - s32 rate; - - if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) - return -1; - - D_RATE("LQ: try to switch to SISO\n"); - - tbl->is_dup = lq_sta->is_dup; - tbl->lq_type = LQ_SISO; - tbl->action = 0; - tbl->max_search = IL_MAX_SEARCH; - rate_mask = lq_sta->active_siso_rate; - - if (il_is_ht40_tx_allowed(il, &sta->ht_cap)) - tbl->is_ht40 = 1; - else - tbl->is_ht40 = 0; - - if (is_green) - tbl->is_SGI = 0; /*11n spec: no SGI in SISO+Greenfield */ - - il4965_rs_set_expected_tpt_table(lq_sta, tbl); - rate = il4965_rs_get_best_rate(il, lq_sta, tbl, rate_mask, idx); - - D_RATE("LQ: get best rate %d mask %X\n", rate, rate_mask); - if (rate == RATE_INVALID || !((1 << rate) & rate_mask)) { - D_RATE("can not switch with idx %d rate mask %x\n", rate, - rate_mask); - return -1; - } - tbl->current_rate = - il4965_rate_n_flags_from_tbl(il, tbl, rate, is_green); - D_RATE("LQ: Switch to new mcs %X idx is green %X\n", tbl->current_rate, - is_green); - return 0; -} - -/* - * Try to switch to new modulation mode from legacy - */ -static int -il4965_rs_move_legacy_other(struct il_priv *il, struct il_lq_sta *lq_sta, - struct ieee80211_conf *conf, - struct ieee80211_sta *sta, int idx) -{ - struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - struct il_scale_tbl_info *search_tbl = - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - struct il_rate_scale_data *win = &(tbl->win[idx]); - u32 sz = - (sizeof(struct il_scale_tbl_info) - - (sizeof(struct il_rate_scale_data) * RATE_COUNT)); - u8 start_action; - u8 valid_tx_ant = il->hw_params.valid_tx_ant; - u8 tx_chains_num = il->hw_params.tx_chains_num; - int ret = 0; - u8 update_search_tbl_counter = 0; - - tbl->action = IL_LEGACY_SWITCH_SISO; - - start_action = tbl->action; - for (;;) { - lq_sta->action_counter++; - switch (tbl->action) { - case IL_LEGACY_SWITCH_ANTENNA1: - case IL_LEGACY_SWITCH_ANTENNA2: - D_RATE("LQ: Legacy toggle Antenna\n"); - - if ((tbl->action == IL_LEGACY_SWITCH_ANTENNA1 && - tx_chains_num <= 1) || - (tbl->action == IL_LEGACY_SWITCH_ANTENNA2 && - tx_chains_num <= 2)) - break; - - /* Don't change antenna if success has been great */ - if (win->success_ratio >= IL_RS_GOOD_RATIO) - break; - - /* Set up search table to try other antenna */ - memcpy(search_tbl, tbl, sz); - - if (il4965_rs_toggle_antenna - (valid_tx_ant, &search_tbl->current_rate, - search_tbl)) { - update_search_tbl_counter = 1; - il4965_rs_set_expected_tpt_table(lq_sta, - search_tbl); - goto out; - } - break; - case IL_LEGACY_SWITCH_SISO: - D_RATE("LQ: Legacy switch to SISO\n"); - - /* Set up search table to try SISO */ - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - ret = - il4965_rs_switch_to_siso(il, lq_sta, conf, sta, - search_tbl, idx); - if (!ret) { - lq_sta->action_counter = 0; - goto out; - } - - break; - case IL_LEGACY_SWITCH_MIMO2_AB: - case IL_LEGACY_SWITCH_MIMO2_AC: - case IL_LEGACY_SWITCH_MIMO2_BC: - D_RATE("LQ: Legacy switch to MIMO2\n"); - - /* Set up search table to try MIMO */ - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - - if (tbl->action == IL_LEGACY_SWITCH_MIMO2_AB) - search_tbl->ant_type = ANT_AB; - else if (tbl->action == IL_LEGACY_SWITCH_MIMO2_AC) - search_tbl->ant_type = ANT_AC; - else - search_tbl->ant_type = ANT_BC; - - if (!il4965_rs_is_valid_ant - (valid_tx_ant, search_tbl->ant_type)) - break; - - ret = - il4965_rs_switch_to_mimo2(il, lq_sta, conf, sta, - search_tbl, idx); - if (!ret) { - lq_sta->action_counter = 0; - goto out; - } - break; - } - tbl->action++; - if (tbl->action > IL_LEGACY_SWITCH_MIMO2_BC) - tbl->action = IL_LEGACY_SWITCH_ANTENNA1; - - if (tbl->action == start_action) - break; - - } - search_tbl->lq_type = LQ_NONE; - return 0; - -out: - lq_sta->search_better_tbl = 1; - tbl->action++; - if (tbl->action > IL_LEGACY_SWITCH_MIMO2_BC) - tbl->action = IL_LEGACY_SWITCH_ANTENNA1; - if (update_search_tbl_counter) - search_tbl->action = tbl->action; - return 0; - -} - -/* - * Try to switch to new modulation mode from SISO - */ -static int -il4965_rs_move_siso_to_other(struct il_priv *il, struct il_lq_sta *lq_sta, - struct ieee80211_conf *conf, - struct ieee80211_sta *sta, int idx) -{ - u8 is_green = lq_sta->is_green; - struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - struct il_scale_tbl_info *search_tbl = - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - struct il_rate_scale_data *win = &(tbl->win[idx]); - struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - u32 sz = - (sizeof(struct il_scale_tbl_info) - - (sizeof(struct il_rate_scale_data) * RATE_COUNT)); - u8 start_action; - u8 valid_tx_ant = il->hw_params.valid_tx_ant; - u8 tx_chains_num = il->hw_params.tx_chains_num; - u8 update_search_tbl_counter = 0; - int ret; - - start_action = tbl->action; - - for (;;) { - lq_sta->action_counter++; - switch (tbl->action) { - case IL_SISO_SWITCH_ANTENNA1: - case IL_SISO_SWITCH_ANTENNA2: - D_RATE("LQ: SISO toggle Antenna\n"); - if ((tbl->action == IL_SISO_SWITCH_ANTENNA1 && - tx_chains_num <= 1) || - (tbl->action == IL_SISO_SWITCH_ANTENNA2 && - tx_chains_num <= 2)) - break; - - if (win->success_ratio >= IL_RS_GOOD_RATIO) - break; - - memcpy(search_tbl, tbl, sz); - if (il4965_rs_toggle_antenna - (valid_tx_ant, &search_tbl->current_rate, - search_tbl)) { - update_search_tbl_counter = 1; - goto out; - } - break; - case IL_SISO_SWITCH_MIMO2_AB: - case IL_SISO_SWITCH_MIMO2_AC: - case IL_SISO_SWITCH_MIMO2_BC: - D_RATE("LQ: SISO switch to MIMO2\n"); - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - - if (tbl->action == IL_SISO_SWITCH_MIMO2_AB) - search_tbl->ant_type = ANT_AB; - else if (tbl->action == IL_SISO_SWITCH_MIMO2_AC) - search_tbl->ant_type = ANT_AC; - else - search_tbl->ant_type = ANT_BC; - - if (!il4965_rs_is_valid_ant - (valid_tx_ant, search_tbl->ant_type)) - break; - - ret = - il4965_rs_switch_to_mimo2(il, lq_sta, conf, sta, - search_tbl, idx); - if (!ret) - goto out; - break; - case IL_SISO_SWITCH_GI: - if (!tbl->is_ht40 && - !(ht_cap->cap & IEEE80211_HT_CAP_SGI_20)) - break; - if (tbl->is_ht40 && - !(ht_cap->cap & IEEE80211_HT_CAP_SGI_40)) - break; - - D_RATE("LQ: SISO toggle SGI/NGI\n"); - - memcpy(search_tbl, tbl, sz); - if (is_green) { - if (!tbl->is_SGI) - break; - else - IL_ERR("SGI was set in GF+SISO\n"); - } - search_tbl->is_SGI = !tbl->is_SGI; - il4965_rs_set_expected_tpt_table(lq_sta, search_tbl); - if (tbl->is_SGI) { - s32 tpt = lq_sta->last_tpt / 100; - if (tpt >= search_tbl->expected_tpt[idx]) - break; - } - search_tbl->current_rate = - il4965_rate_n_flags_from_tbl(il, search_tbl, idx, - is_green); - update_search_tbl_counter = 1; - goto out; - } - tbl->action++; - if (tbl->action > IL_SISO_SWITCH_GI) - tbl->action = IL_SISO_SWITCH_ANTENNA1; - - if (tbl->action == start_action) - break; - } - search_tbl->lq_type = LQ_NONE; - return 0; - -out: - lq_sta->search_better_tbl = 1; - tbl->action++; - if (tbl->action > IL_SISO_SWITCH_GI) - tbl->action = IL_SISO_SWITCH_ANTENNA1; - if (update_search_tbl_counter) - search_tbl->action = tbl->action; - - return 0; -} - -/* - * Try to switch to new modulation mode from MIMO2 - */ -static int -il4965_rs_move_mimo2_to_other(struct il_priv *il, struct il_lq_sta *lq_sta, - struct ieee80211_conf *conf, - struct ieee80211_sta *sta, int idx) -{ - s8 is_green = lq_sta->is_green; - struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - struct il_scale_tbl_info *search_tbl = - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - struct il_rate_scale_data *win = &(tbl->win[idx]); - struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - u32 sz = - (sizeof(struct il_scale_tbl_info) - - (sizeof(struct il_rate_scale_data) * RATE_COUNT)); - u8 start_action; - u8 valid_tx_ant = il->hw_params.valid_tx_ant; - u8 tx_chains_num = il->hw_params.tx_chains_num; - u8 update_search_tbl_counter = 0; - int ret; - - start_action = tbl->action; - for (;;) { - lq_sta->action_counter++; - switch (tbl->action) { - case IL_MIMO2_SWITCH_ANTENNA1: - case IL_MIMO2_SWITCH_ANTENNA2: - D_RATE("LQ: MIMO2 toggle Antennas\n"); - - if (tx_chains_num <= 2) - break; - - if (win->success_ratio >= IL_RS_GOOD_RATIO) - break; - - memcpy(search_tbl, tbl, sz); - if (il4965_rs_toggle_antenna - (valid_tx_ant, &search_tbl->current_rate, - search_tbl)) { - update_search_tbl_counter = 1; - goto out; - } - break; - case IL_MIMO2_SWITCH_SISO_A: - case IL_MIMO2_SWITCH_SISO_B: - case IL_MIMO2_SWITCH_SISO_C: - D_RATE("LQ: MIMO2 switch to SISO\n"); - - /* Set up new search table for SISO */ - memcpy(search_tbl, tbl, sz); - - if (tbl->action == IL_MIMO2_SWITCH_SISO_A) - search_tbl->ant_type = ANT_A; - else if (tbl->action == IL_MIMO2_SWITCH_SISO_B) - search_tbl->ant_type = ANT_B; - else - search_tbl->ant_type = ANT_C; - - if (!il4965_rs_is_valid_ant - (valid_tx_ant, search_tbl->ant_type)) - break; - - ret = - il4965_rs_switch_to_siso(il, lq_sta, conf, sta, - search_tbl, idx); - if (!ret) - goto out; - - break; - - case IL_MIMO2_SWITCH_GI: - if (!tbl->is_ht40 && - !(ht_cap->cap & IEEE80211_HT_CAP_SGI_20)) - break; - if (tbl->is_ht40 && - !(ht_cap->cap & IEEE80211_HT_CAP_SGI_40)) - break; - - D_RATE("LQ: MIMO2 toggle SGI/NGI\n"); - - /* Set up new search table for MIMO2 */ - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = !tbl->is_SGI; - il4965_rs_set_expected_tpt_table(lq_sta, search_tbl); - /* - * If active table already uses the fastest possible - * modulation (dual stream with short guard interval), - * and it's working well, there's no need to look - * for a better type of modulation! - */ - if (tbl->is_SGI) { - s32 tpt = lq_sta->last_tpt / 100; - if (tpt >= search_tbl->expected_tpt[idx]) - break; - } - search_tbl->current_rate = - il4965_rate_n_flags_from_tbl(il, search_tbl, idx, - is_green); - update_search_tbl_counter = 1; - goto out; - - } - tbl->action++; - if (tbl->action > IL_MIMO2_SWITCH_GI) - tbl->action = IL_MIMO2_SWITCH_ANTENNA1; - - if (tbl->action == start_action) - break; - } - search_tbl->lq_type = LQ_NONE; - return 0; -out: - lq_sta->search_better_tbl = 1; - tbl->action++; - if (tbl->action > IL_MIMO2_SWITCH_GI) - tbl->action = IL_MIMO2_SWITCH_ANTENNA1; - if (update_search_tbl_counter) - search_tbl->action = tbl->action; - - return 0; - -} - -/* - * Check whether we should continue using same modulation mode, or - * begin search for a new mode, based on: - * 1) # tx successes or failures while using this mode - * 2) # times calling this function - * 3) elapsed time in this mode (not used, for now) - */ -static void -il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search) -{ - struct il_scale_tbl_info *tbl; - int i; - int active_tbl; - int flush_interval_passed = 0; - struct il_priv *il; - - il = lq_sta->drv; - active_tbl = lq_sta->active_tbl; - - tbl = &(lq_sta->lq_info[active_tbl]); - - /* If we've been disallowing search, see if we should now allow it */ - if (lq_sta->stay_in_tbl) { - - /* Elapsed time using current modulation mode */ - if (lq_sta->flush_timer) - flush_interval_passed = - time_after(jiffies, - (unsigned long)(lq_sta->flush_timer + - RATE_SCALE_FLUSH_INTVL)); - - /* - * Check if we should allow search for new modulation mode. - * If many frames have failed or succeeded, or we've used - * this same modulation for a long time, allow search, and - * reset history stats that keep track of whether we should - * allow a new search. Also (below) reset all bitmaps and - * stats in active history. - */ - if (force_search || - lq_sta->total_failed > lq_sta->max_failure_limit || - lq_sta->total_success > lq_sta->max_success_limit || - (!lq_sta->search_better_tbl && lq_sta->flush_timer && - flush_interval_passed)) { - D_RATE("LQ: stay is expired %d %d %d\n:", - lq_sta->total_failed, lq_sta->total_success, - flush_interval_passed); - - /* Allow search for new mode */ - lq_sta->stay_in_tbl = 0; /* only place reset */ - lq_sta->total_failed = 0; - lq_sta->total_success = 0; - lq_sta->flush_timer = 0; - - /* - * Else if we've used this modulation mode enough repetitions - * (regardless of elapsed time or success/failure), reset - * history bitmaps and rate-specific stats for all rates in - * active table. - */ - } else { - lq_sta->table_count++; - if (lq_sta->table_count >= lq_sta->table_count_limit) { - lq_sta->table_count = 0; - - D_RATE("LQ: stay in table clear win\n"); - for (i = 0; i < RATE_COUNT; i++) - il4965_rs_rate_scale_clear_win(& - (tbl-> - win - [i])); - } - } - - /* If transitioning to allow "search", reset all history - * bitmaps and stats in active table (this will become the new - * "search" table). */ - if (!lq_sta->stay_in_tbl) { - for (i = 0; i < RATE_COUNT; i++) - il4965_rs_rate_scale_clear_win(&(tbl->win[i])); - } - } -} - -/* - * setup rate table in uCode - */ -static void -il4965_rs_update_rate_tbl(struct il_priv *il, struct il_lq_sta *lq_sta, - struct il_scale_tbl_info *tbl, int idx, u8 is_green) -{ - u32 rate; - - /* Update uCode's rate table. */ - rate = il4965_rate_n_flags_from_tbl(il, tbl, idx, is_green); - il4965_rs_fill_link_cmd(il, lq_sta, rate); - il_send_lq_cmd(il, &lq_sta->lq, CMD_ASYNC, false); -} - -/* - * Do rate scaling and search for new modulation mode. - */ -static void -il4965_rs_rate_scale_perform(struct il_priv *il, struct sk_buff *skb, - struct ieee80211_sta *sta, - struct il_lq_sta *lq_sta) -{ - struct ieee80211_hw *hw = il->hw; - struct ieee80211_conf *conf = &hw->conf; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - int low = RATE_INVALID; - int high = RATE_INVALID; - int idx; - int i; - struct il_rate_scale_data *win = NULL; - int current_tpt = IL_INVALID_VALUE; - int low_tpt = IL_INVALID_VALUE; - int high_tpt = IL_INVALID_VALUE; - u32 fail_count; - s8 scale_action = 0; - u16 rate_mask; - u8 update_lq = 0; - struct il_scale_tbl_info *tbl, *tbl1; - u16 rate_scale_idx_msk = 0; - u8 is_green = 0; - u8 active_tbl = 0; - u8 done_search = 0; - u16 high_low; - s32 sr; - u8 tid = MAX_TID_COUNT; - struct il_tid_data *tid_data; - - D_RATE("rate scale calculate new rate for skb\n"); - - /* Send management frames and NO_ACK data using lowest rate. */ - /* TODO: this could probably be improved.. */ - if (!ieee80211_is_data(hdr->frame_control) || - (info->flags & IEEE80211_TX_CTL_NO_ACK)) - return; - - lq_sta->supp_rates = sta->supp_rates[lq_sta->band]; - - tid = il4965_rs_tl_add_packet(lq_sta, hdr); - if (tid != MAX_TID_COUNT && (lq_sta->tx_agg_tid_en & (1 << tid))) { - tid_data = &il->stations[lq_sta->lq.sta_id].tid[tid]; - if (tid_data->agg.state == IL_AGG_OFF) - lq_sta->is_agg = 0; - else - lq_sta->is_agg = 1; - } else - lq_sta->is_agg = 0; - - /* - * Select rate-scale / modulation-mode table to work with in - * the rest of this function: "search" if searching for better - * modulation mode, or "active" if doing rate scaling within a mode. - */ - if (!lq_sta->search_better_tbl) - active_tbl = lq_sta->active_tbl; - else - active_tbl = 1 - lq_sta->active_tbl; - - tbl = &(lq_sta->lq_info[active_tbl]); - if (is_legacy(tbl->lq_type)) - lq_sta->is_green = 0; - else - lq_sta->is_green = il4965_rs_use_green(il, sta); - is_green = lq_sta->is_green; - - /* current tx rate */ - idx = lq_sta->last_txrate_idx; - - D_RATE("Rate scale idx %d for type %d\n", idx, tbl->lq_type); - - /* rates available for this association, and for modulation mode */ - rate_mask = il4965_rs_get_supported_rates(lq_sta, hdr, tbl->lq_type); - - D_RATE("mask 0x%04X\n", rate_mask); - - /* mask with station rate restriction */ - if (is_legacy(tbl->lq_type)) { - if (lq_sta->band == IEEE80211_BAND_5GHZ) - /* supp_rates has no CCK bits in A mode */ - rate_scale_idx_msk = - (u16) (rate_mask & - (lq_sta->supp_rates << IL_FIRST_OFDM_RATE)); - else - rate_scale_idx_msk = - (u16) (rate_mask & lq_sta->supp_rates); - - } else - rate_scale_idx_msk = rate_mask; - - if (!rate_scale_idx_msk) - rate_scale_idx_msk = rate_mask; - - if (!((1 << idx) & rate_scale_idx_msk)) { - IL_ERR("Current Rate is not valid\n"); - if (lq_sta->search_better_tbl) { - /* revert to active table if search table is not valid */ - tbl->lq_type = LQ_NONE; - lq_sta->search_better_tbl = 0; - tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - /* get "active" rate info */ - idx = il4965_hwrate_to_plcp_idx(tbl->current_rate); - il4965_rs_update_rate_tbl(il, lq_sta, tbl, idx, - is_green); - } - return; - } - - /* Get expected throughput table and history win for current rate */ - if (!tbl->expected_tpt) { - IL_ERR("tbl->expected_tpt is NULL\n"); - return; - } - - /* force user max rate if set by user */ - if (lq_sta->max_rate_idx != -1 && lq_sta->max_rate_idx < idx) { - idx = lq_sta->max_rate_idx; - update_lq = 1; - win = &(tbl->win[idx]); - goto lq_update; - } - - win = &(tbl->win[idx]); - - /* - * If there is not enough history to calculate actual average - * throughput, keep analyzing results of more tx frames, without - * changing rate or mode (bypass most of the rest of this function). - * Set up new rate table in uCode only if old rate is not supported - * in current association (use new rate found above). - */ - fail_count = win->counter - win->success_counter; - if (fail_count < RATE_MIN_FAILURE_TH && - win->success_counter < RATE_MIN_SUCCESS_TH) { - D_RATE("LQ: still below TH. succ=%d total=%d " "for idx %d\n", - win->success_counter, win->counter, idx); - - /* Can't calculate this yet; not enough history */ - win->average_tpt = IL_INVALID_VALUE; - - /* Should we stay with this modulation mode, - * or search for a new one? */ - il4965_rs_stay_in_table(lq_sta, false); - - goto out; - } - /* Else we have enough samples; calculate estimate of - * actual average throughput */ - if (win->average_tpt != - ((win->success_ratio * tbl->expected_tpt[idx] + 64) / 128)) { - IL_ERR("expected_tpt should have been calculated by now\n"); - win->average_tpt = - ((win->success_ratio * tbl->expected_tpt[idx] + 64) / 128); - } - - /* If we are searching for better modulation mode, check success. */ - if (lq_sta->search_better_tbl) { - /* If good success, continue using the "search" mode; - * no need to send new link quality command, since we're - * continuing to use the setup that we've been trying. */ - if (win->average_tpt > lq_sta->last_tpt) { - - D_RATE("LQ: SWITCHING TO NEW TBL " - "suc=%d cur-tpt=%d old-tpt=%d\n", - win->success_ratio, win->average_tpt, - lq_sta->last_tpt); - - if (!is_legacy(tbl->lq_type)) - lq_sta->enable_counter = 1; - - /* Swap tables; "search" becomes "active" */ - lq_sta->active_tbl = active_tbl; - current_tpt = win->average_tpt; - - /* Else poor success; go back to mode in "active" table */ - } else { - - D_RATE("LQ: GOING BACK TO THE OLD TBL " - "suc=%d cur-tpt=%d old-tpt=%d\n", - win->success_ratio, win->average_tpt, - lq_sta->last_tpt); - - /* Nullify "search" table */ - tbl->lq_type = LQ_NONE; - - /* Revert to "active" table */ - active_tbl = lq_sta->active_tbl; - tbl = &(lq_sta->lq_info[active_tbl]); - - /* Revert to "active" rate and throughput info */ - idx = il4965_hwrate_to_plcp_idx(tbl->current_rate); - current_tpt = lq_sta->last_tpt; - - /* Need to set up a new rate table in uCode */ - update_lq = 1; - } - - /* Either way, we've made a decision; modulation mode - * search is done, allow rate adjustment next time. */ - lq_sta->search_better_tbl = 0; - done_search = 1; /* Don't switch modes below! */ - goto lq_update; - } - - /* (Else) not in search of better modulation mode, try for better - * starting rate, while staying in this mode. */ - high_low = - il4965_rs_get_adjacent_rate(il, idx, rate_scale_idx_msk, - tbl->lq_type); - low = high_low & 0xff; - high = (high_low >> 8) & 0xff; - - /* If user set max rate, dont allow higher than user constrain */ - if (lq_sta->max_rate_idx != -1 && lq_sta->max_rate_idx < high) - high = RATE_INVALID; - - sr = win->success_ratio; - - /* Collect measured throughputs for current and adjacent rates */ - current_tpt = win->average_tpt; - if (low != RATE_INVALID) - low_tpt = tbl->win[low].average_tpt; - if (high != RATE_INVALID) - high_tpt = tbl->win[high].average_tpt; - - scale_action = 0; - - /* Too many failures, decrease rate */ - if (sr <= RATE_DECREASE_TH || current_tpt == 0) { - D_RATE("decrease rate because of low success_ratio\n"); - scale_action = -1; - - /* No throughput measured yet for adjacent rates; try increase. */ - } else if (low_tpt == IL_INVALID_VALUE && high_tpt == IL_INVALID_VALUE) { - - if (high != RATE_INVALID && sr >= RATE_INCREASE_TH) - scale_action = 1; - else if (low != RATE_INVALID) - scale_action = 0; - } - - /* Both adjacent throughputs are measured, but neither one has better - * throughput; we're using the best rate, don't change it! */ - else if (low_tpt != IL_INVALID_VALUE && high_tpt != IL_INVALID_VALUE && - low_tpt < current_tpt && high_tpt < current_tpt) - scale_action = 0; - - /* At least one adjacent rate's throughput is measured, - * and may have better performance. */ - else { - /* Higher adjacent rate's throughput is measured */ - if (high_tpt != IL_INVALID_VALUE) { - /* Higher rate has better throughput */ - if (high_tpt > current_tpt && sr >= RATE_INCREASE_TH) - scale_action = 1; - else - scale_action = 0; - - /* Lower adjacent rate's throughput is measured */ - } else if (low_tpt != IL_INVALID_VALUE) { - /* Lower rate has better throughput */ - if (low_tpt > current_tpt) { - D_RATE("decrease rate because of low tpt\n"); - scale_action = -1; - } else if (sr >= RATE_INCREASE_TH) { - scale_action = 1; - } - } - } - - /* Sanity check; asked for decrease, but success rate or throughput - * has been good at old rate. Don't change it. */ - if (scale_action == -1 && low != RATE_INVALID && - (sr > RATE_HIGH_TH || current_tpt > 100 * tbl->expected_tpt[low])) - scale_action = 0; - - switch (scale_action) { - case -1: - /* Decrease starting rate, update uCode's rate table */ - if (low != RATE_INVALID) { - update_lq = 1; - idx = low; - } - - break; - case 1: - /* Increase starting rate, update uCode's rate table */ - if (high != RATE_INVALID) { - update_lq = 1; - idx = high; - } - - break; - case 0: - /* No change */ - default: - break; - } - - D_RATE("choose rate scale idx %d action %d low %d " "high %d type %d\n", - idx, scale_action, low, high, tbl->lq_type); - -lq_update: - /* Replace uCode's rate table for the destination station. */ - if (update_lq) - il4965_rs_update_rate_tbl(il, lq_sta, tbl, idx, is_green); - - /* Should we stay with this modulation mode, - * or search for a new one? */ - il4965_rs_stay_in_table(lq_sta, false); - - /* - * Search for new modulation mode if we're: - * 1) Not changing rates right now - * 2) Not just finishing up a search - * 3) Allowing a new search - */ - if (!update_lq && !done_search && !lq_sta->stay_in_tbl && win->counter) { - /* Save current throughput to compare with "search" throughput */ - lq_sta->last_tpt = current_tpt; - - /* Select a new "search" modulation mode to try. - * If one is found, set up the new "search" table. */ - if (is_legacy(tbl->lq_type)) - il4965_rs_move_legacy_other(il, lq_sta, conf, sta, idx); - else if (is_siso(tbl->lq_type)) - il4965_rs_move_siso_to_other(il, lq_sta, conf, sta, - idx); - else /* (is_mimo2(tbl->lq_type)) */ - il4965_rs_move_mimo2_to_other(il, lq_sta, conf, sta, - idx); - - /* If new "search" mode was selected, set up in uCode table */ - if (lq_sta->search_better_tbl) { - /* Access the "search" table, clear its history. */ - tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - for (i = 0; i < RATE_COUNT; i++) - il4965_rs_rate_scale_clear_win(&(tbl->win[i])); - - /* Use new "search" start rate */ - idx = il4965_hwrate_to_plcp_idx(tbl->current_rate); - - D_RATE("Switch current mcs: %X idx: %d\n", - tbl->current_rate, idx); - il4965_rs_fill_link_cmd(il, lq_sta, tbl->current_rate); - il_send_lq_cmd(il, &lq_sta->lq, CMD_ASYNC, false); - } else - done_search = 1; - } - - if (done_search && !lq_sta->stay_in_tbl) { - /* If the "active" (non-search) mode was legacy, - * and we've tried switching antennas, - * but we haven't been able to try HT modes (not available), - * stay with best antenna legacy modulation for a while - * before next round of mode comparisons. */ - tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); - if (is_legacy(tbl1->lq_type) && !conf_is_ht(conf) && - lq_sta->action_counter > tbl1->max_search) { - D_RATE("LQ: STAY in legacy table\n"); - il4965_rs_set_stay_in_table(il, 1, lq_sta); - } - - /* If we're in an HT mode, and all 3 mode switch actions - * have been tried and compared, stay in this best modulation - * mode for a while before next round of mode comparisons. */ - if (lq_sta->enable_counter && - lq_sta->action_counter >= tbl1->max_search) { - if (lq_sta->last_tpt > IL_AGG_TPT_THREHOLD && - (lq_sta->tx_agg_tid_en & (1 << tid)) && - tid != MAX_TID_COUNT) { - tid_data = - &il->stations[lq_sta->lq.sta_id].tid[tid]; - if (tid_data->agg.state == IL_AGG_OFF) { - D_RATE("try to aggregate tid %d\n", - tid); - il4965_rs_tl_turn_on_agg(il, tid, - lq_sta, sta); - } - } - il4965_rs_set_stay_in_table(il, 0, lq_sta); - } - } - -out: - tbl->current_rate = - il4965_rate_n_flags_from_tbl(il, tbl, idx, is_green); - i = idx; - lq_sta->last_txrate_idx = i; -} - -/** - * il4965_rs_initialize_lq - Initialize a station's hardware rate table - * - * The uCode's station table contains a table of fallback rates - * for automatic fallback during transmission. - * - * NOTE: This sets up a default set of values. These will be replaced later - * if the driver's iwl-4965-rs rate scaling algorithm is used, instead of - * rc80211_simple. - * - * NOTE: Run C_ADD_STA command to set up station table entry, before - * calling this function (which runs C_TX_LINK_QUALITY_CMD, - * which requires station table entry to exist). - */ -static void -il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf, - struct ieee80211_sta *sta, struct il_lq_sta *lq_sta) -{ - struct il_scale_tbl_info *tbl; - int rate_idx; - int i; - u32 rate; - u8 use_green; - u8 active_tbl = 0; - u8 valid_tx_ant; - struct il_station_priv *sta_priv; - - if (!sta || !lq_sta) - return; - - use_green = il4965_rs_use_green(il, sta); - sta_priv = (void *)sta->drv_priv; - - i = lq_sta->last_txrate_idx; - - valid_tx_ant = il->hw_params.valid_tx_ant; - - if (!lq_sta->search_better_tbl) - active_tbl = lq_sta->active_tbl; - else - active_tbl = 1 - lq_sta->active_tbl; - - tbl = &(lq_sta->lq_info[active_tbl]); - - if (i < 0 || i >= RATE_COUNT) - i = 0; - - rate = il_rates[i].plcp; - tbl->ant_type = il4965_first_antenna(valid_tx_ant); - rate |= tbl->ant_type << RATE_MCS_ANT_POS; - - if (i >= IL_FIRST_CCK_RATE && i <= IL_LAST_CCK_RATE) - rate |= RATE_MCS_CCK_MSK; - - il4965_rs_get_tbl_info_from_mcs(rate, il->band, tbl, &rate_idx); - if (!il4965_rs_is_valid_ant(valid_tx_ant, tbl->ant_type)) - il4965_rs_toggle_antenna(valid_tx_ant, &rate, tbl); - - rate = il4965_rate_n_flags_from_tbl(il, tbl, rate_idx, use_green); - tbl->current_rate = rate; - il4965_rs_set_expected_tpt_table(lq_sta, tbl); - il4965_rs_fill_link_cmd(NULL, lq_sta, rate); - il->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; - il_send_lq_cmd(il, &lq_sta->lq, CMD_SYNC, true); -} - -static void -il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta, - struct ieee80211_tx_rate_control *txrc) -{ - - struct sk_buff *skb = txrc->skb; - struct ieee80211_supported_band *sband = txrc->sband; - struct il_priv *il __maybe_unused = (struct il_priv *)il_r; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct il_lq_sta *lq_sta = il_sta; - int rate_idx; - - D_RATE("rate scale calculate new rate for skb\n"); - - /* Get max rate if user set max rate */ - if (lq_sta) { - lq_sta->max_rate_idx = txrc->max_rate_idx; - if (sband->band == IEEE80211_BAND_5GHZ && - lq_sta->max_rate_idx != -1) - lq_sta->max_rate_idx += IL_FIRST_OFDM_RATE; - if (lq_sta->max_rate_idx < 0 || - lq_sta->max_rate_idx >= RATE_COUNT) - lq_sta->max_rate_idx = -1; - } - - /* Treat uninitialized rate scaling data same as non-existing. */ - if (lq_sta && !lq_sta->drv) { - D_RATE("Rate scaling not initialized yet.\n"); - il_sta = NULL; - } - - /* Send management frames and NO_ACK data using lowest rate. */ - if (rate_control_send_low(sta, il_sta, txrc)) - return; - - if (!lq_sta) - return; - - rate_idx = lq_sta->last_txrate_idx; - - if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) { - rate_idx -= IL_FIRST_OFDM_RATE; - /* 6M and 9M shared same MCS idx */ - rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0; - if (il4965_rs_extract_rate(lq_sta->last_rate_n_flags) >= - RATE_MIMO2_6M_PLCP) - rate_idx = rate_idx + MCS_IDX_PER_STREAM; - info->control.rates[0].flags = IEEE80211_TX_RC_MCS; - if (lq_sta->last_rate_n_flags & RATE_MCS_SGI_MSK) - info->control.rates[0].flags |= - IEEE80211_TX_RC_SHORT_GI; - if (lq_sta->last_rate_n_flags & RATE_MCS_DUP_MSK) - info->control.rates[0].flags |= - IEEE80211_TX_RC_DUP_DATA; - if (lq_sta->last_rate_n_flags & RATE_MCS_HT40_MSK) - info->control.rates[0].flags |= - IEEE80211_TX_RC_40_MHZ_WIDTH; - if (lq_sta->last_rate_n_flags & RATE_MCS_GF_MSK) - info->control.rates[0].flags |= - IEEE80211_TX_RC_GREEN_FIELD; - } else { - /* Check for invalid rates */ - if (rate_idx < 0 || rate_idx >= RATE_COUNT_LEGACY || - (sband->band == IEEE80211_BAND_5GHZ && - rate_idx < IL_FIRST_OFDM_RATE)) - rate_idx = rate_lowest_index(sband, sta); - /* On valid 5 GHz rate, adjust idx */ - else if (sband->band == IEEE80211_BAND_5GHZ) - rate_idx -= IL_FIRST_OFDM_RATE; - info->control.rates[0].flags = 0; - } - info->control.rates[0].idx = rate_idx; - info->control.rates[0].count = 1; -} - -static void * -il4965_rs_alloc_sta(void *il_rate, struct ieee80211_sta *sta, gfp_t gfp) -{ - struct il_station_priv *sta_priv = - (struct il_station_priv *)sta->drv_priv; - struct il_priv *il; - - il = (struct il_priv *)il_rate; - D_RATE("create station rate scale win\n"); - - return &sta_priv->lq_sta; -} - -/* - * Called after adding a new station to initialize rate scaling - */ -void -il4965_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id) -{ - int i, j; - struct ieee80211_hw *hw = il->hw; - struct ieee80211_conf *conf = &il->hw->conf; - struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - struct il_station_priv *sta_priv; - struct il_lq_sta *lq_sta; - struct ieee80211_supported_band *sband; - - sta_priv = (struct il_station_priv *)sta->drv_priv; - lq_sta = &sta_priv->lq_sta; - sband = hw->wiphy->bands[conf->chandef.chan->band]; - - lq_sta->lq.sta_id = sta_id; - - for (j = 0; j < LQ_SIZE; j++) - for (i = 0; i < RATE_COUNT; i++) - il4965_rs_rate_scale_clear_win(&lq_sta->lq_info[j]. - win[i]); - - lq_sta->flush_timer = 0; - lq_sta->supp_rates = sta->supp_rates[sband->band]; - for (j = 0; j < LQ_SIZE; j++) - for (i = 0; i < RATE_COUNT; i++) - il4965_rs_rate_scale_clear_win(&lq_sta->lq_info[j]. - win[i]); - - D_RATE("LQ:" "*** rate scale station global init for station %d ***\n", - sta_id); - /* TODO: what is a good starting rate for STA? About middle? Maybe not - * the lowest or the highest rate.. Could consider using RSSI from - * previous packets? Need to have IEEE 802.1X auth succeed immediately - * after assoc.. */ - - lq_sta->is_dup = 0; - lq_sta->max_rate_idx = -1; - lq_sta->missed_rate_counter = IL_MISSED_RATE_MAX; - lq_sta->is_green = il4965_rs_use_green(il, sta); - lq_sta->active_legacy_rate = il->active_rate & ~(0x1000); - lq_sta->band = il->band; - /* - * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), - * supp_rates[] does not; shift to convert format, force 9 MBits off. - */ - lq_sta->active_siso_rate = ht_cap->mcs.rx_mask[0] << 1; - lq_sta->active_siso_rate |= ht_cap->mcs.rx_mask[0] & 0x1; - lq_sta->active_siso_rate &= ~((u16) 0x2); - lq_sta->active_siso_rate <<= IL_FIRST_OFDM_RATE; - - /* Same here */ - lq_sta->active_mimo2_rate = ht_cap->mcs.rx_mask[1] << 1; - lq_sta->active_mimo2_rate |= ht_cap->mcs.rx_mask[1] & 0x1; - lq_sta->active_mimo2_rate &= ~((u16) 0x2); - lq_sta->active_mimo2_rate <<= IL_FIRST_OFDM_RATE; - - /* These values will be overridden later */ - lq_sta->lq.general_params.single_stream_ant_msk = - il4965_first_antenna(il->hw_params.valid_tx_ant); - lq_sta->lq.general_params.dual_stream_ant_msk = - il->hw_params.valid_tx_ant & ~il4965_first_antenna(il->hw_params. - valid_tx_ant); - if (!lq_sta->lq.general_params.dual_stream_ant_msk) { - lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; - } else if (il4965_num_of_ant(il->hw_params.valid_tx_ant) == 2) { - lq_sta->lq.general_params.dual_stream_ant_msk = - il->hw_params.valid_tx_ant; - } - - /* as default allow aggregation for all tids */ - lq_sta->tx_agg_tid_en = IL_AGG_ALL_TID; - lq_sta->drv = il; - - /* Set last_txrate_idx to lowest rate */ - lq_sta->last_txrate_idx = rate_lowest_index(sband, sta); - if (sband->band == IEEE80211_BAND_5GHZ) - lq_sta->last_txrate_idx += IL_FIRST_OFDM_RATE; - lq_sta->is_agg = 0; - -#ifdef CONFIG_MAC80211_DEBUGFS - lq_sta->dbg_fixed_rate = 0; -#endif - - il4965_rs_initialize_lq(il, conf, sta, lq_sta); -} - -static void -il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta, - u32 new_rate) -{ - struct il_scale_tbl_info tbl_type; - int idx = 0; - int rate_idx; - int repeat_rate = 0; - u8 ant_toggle_cnt = 0; - u8 use_ht_possible = 1; - u8 valid_tx_ant = 0; - struct il_link_quality_cmd *lq_cmd = &lq_sta->lq; - - /* Override starting rate (idx 0) if needed for debug purposes */ - il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, idx); - - /* Interpret new_rate (rate_n_flags) */ - il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, &tbl_type, - &rate_idx); - - /* How many times should we repeat the initial rate? */ - if (is_legacy(tbl_type.lq_type)) { - ant_toggle_cnt = 1; - repeat_rate = IL_NUMBER_TRY; - } else { - repeat_rate = IL_HT_NUMBER_TRY; - } - - lq_cmd->general_params.mimo_delimiter = - is_mimo(tbl_type.lq_type) ? 1 : 0; - - /* Fill 1st table entry (idx 0) */ - lq_cmd->rs_table[idx].rate_n_flags = cpu_to_le32(new_rate); - - if (il4965_num_of_ant(tbl_type.ant_type) == 1) { - lq_cmd->general_params.single_stream_ant_msk = - tbl_type.ant_type; - } else if (il4965_num_of_ant(tbl_type.ant_type) == 2) { - lq_cmd->general_params.dual_stream_ant_msk = tbl_type.ant_type; - } - /* otherwise we don't modify the existing value */ - idx++; - repeat_rate--; - if (il) - valid_tx_ant = il->hw_params.valid_tx_ant; - - /* Fill rest of rate table */ - while (idx < LINK_QUAL_MAX_RETRY_NUM) { - /* Repeat initial/next rate. - * For legacy IL_NUMBER_TRY == 1, this loop will not execute. - * For HT IL_HT_NUMBER_TRY == 3, this executes twice. */ - while (repeat_rate > 0 && idx < LINK_QUAL_MAX_RETRY_NUM) { - if (is_legacy(tbl_type.lq_type)) { - if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) - ant_toggle_cnt++; - else if (il && - il4965_rs_toggle_antenna(valid_tx_ant, - &new_rate, - &tbl_type)) - ant_toggle_cnt = 1; - } - - /* Override next rate if needed for debug purposes */ - il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, idx); - - /* Fill next table entry */ - lq_cmd->rs_table[idx].rate_n_flags = - cpu_to_le32(new_rate); - repeat_rate--; - idx++; - } - - il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, - &tbl_type, &rate_idx); - - /* Indicate to uCode which entries might be MIMO. - * If initial rate was MIMO, this will finally end up - * as (IL_HT_NUMBER_TRY * 2), after 2nd pass, otherwise 0. */ - if (is_mimo(tbl_type.lq_type)) - lq_cmd->general_params.mimo_delimiter = idx; - - /* Get next rate */ - new_rate = - il4965_rs_get_lower_rate(lq_sta, &tbl_type, rate_idx, - use_ht_possible); - - /* How many times should we repeat the next rate? */ - if (is_legacy(tbl_type.lq_type)) { - if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) - ant_toggle_cnt++; - else if (il && - il4965_rs_toggle_antenna(valid_tx_ant, - &new_rate, &tbl_type)) - ant_toggle_cnt = 1; - - repeat_rate = IL_NUMBER_TRY; - } else { - repeat_rate = IL_HT_NUMBER_TRY; - } - - /* Don't allow HT rates after next pass. - * il4965_rs_get_lower_rate() will change type to LQ_A or LQ_G. */ - use_ht_possible = 0; - - /* Override next rate if needed for debug purposes */ - il4965_rs_dbgfs_set_mcs(lq_sta, &new_rate, idx); - - /* Fill next table entry */ - lq_cmd->rs_table[idx].rate_n_flags = cpu_to_le32(new_rate); - - idx++; - repeat_rate--; - } - - lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_DEF; - lq_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; - - lq_cmd->agg_params.agg_time_limit = - cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF); -} - -static void * -il4965_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) -{ - return hw->priv; -} - -/* rate scale requires free function to be implemented */ -static void -il4965_rs_free(void *il_rate) -{ - return; -} - -static void -il4965_rs_free_sta(void *il_r, struct ieee80211_sta *sta, void *il_sta) -{ - struct il_priv *il __maybe_unused = il_r; - - D_RATE("enter\n"); - D_RATE("leave\n"); -} - -#ifdef CONFIG_MAC80211_DEBUGFS - -static void -il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, u32 * rate_n_flags, int idx) -{ - struct il_priv *il; - u8 valid_tx_ant; - u8 ant_sel_tx; - - il = lq_sta->drv; - valid_tx_ant = il->hw_params.valid_tx_ant; - if (lq_sta->dbg_fixed_rate) { - ant_sel_tx = - ((lq_sta-> - dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK) >> - RATE_MCS_ANT_POS); - if ((valid_tx_ant & ant_sel_tx) == ant_sel_tx) { - *rate_n_flags = lq_sta->dbg_fixed_rate; - D_RATE("Fixed rate ON\n"); - } else { - lq_sta->dbg_fixed_rate = 0; - IL_ERR - ("Invalid antenna selection 0x%X, Valid is 0x%X\n", - ant_sel_tx, valid_tx_ant); - D_RATE("Fixed rate OFF\n"); - } - } else { - D_RATE("Fixed rate OFF\n"); - } -} - -static ssize_t -il4965_rs_sta_dbgfs_scale_table_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_lq_sta *lq_sta = file->private_data; - struct il_priv *il; - char buf[64]; - size_t buf_size; - u32 parsed_rate; - - il = lq_sta->drv; - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - - if (sscanf(buf, "%x", &parsed_rate) == 1) - lq_sta->dbg_fixed_rate = parsed_rate; - else - lq_sta->dbg_fixed_rate = 0; - - lq_sta->active_legacy_rate = 0x0FFF; /* 1 - 54 MBits, includes CCK */ - lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ - lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ - - D_RATE("sta_id %d rate 0x%X\n", lq_sta->lq.sta_id, - lq_sta->dbg_fixed_rate); - - if (lq_sta->dbg_fixed_rate) { - il4965_rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate); - il_send_lq_cmd(lq_sta->drv, &lq_sta->lq, CMD_ASYNC, false); - } - - return count; -} - -static ssize_t -il4965_rs_sta_dbgfs_scale_table_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - char *buff; - int desc = 0; - int i = 0; - int idx = 0; - ssize_t ret; - - struct il_lq_sta *lq_sta = file->private_data; - struct il_priv *il; - struct il_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - - il = lq_sta->drv; - buff = kmalloc(1024, GFP_KERNEL); - if (!buff) - return -ENOMEM; - - desc += sprintf(buff + desc, "sta_id %d\n", lq_sta->lq.sta_id); - desc += - sprintf(buff + desc, "failed=%d success=%d rate=0%X\n", - lq_sta->total_failed, lq_sta->total_success, - lq_sta->active_legacy_rate); - desc += - sprintf(buff + desc, "fixed rate 0x%X\n", lq_sta->dbg_fixed_rate); - desc += - sprintf(buff + desc, "valid_tx_ant %s%s%s\n", - (il->hw_params.valid_tx_ant & ANT_A) ? "ANT_A," : "", - (il->hw_params.valid_tx_ant & ANT_B) ? "ANT_B," : "", - (il->hw_params.valid_tx_ant & ANT_C) ? "ANT_C" : ""); - desc += - sprintf(buff + desc, "lq type %s\n", - (is_legacy(tbl->lq_type)) ? "legacy" : "HT"); - if (is_Ht(tbl->lq_type)) { - desc += - sprintf(buff + desc, " %s", - (is_siso(tbl->lq_type)) ? "SISO" : "MIMO2"); - desc += - sprintf(buff + desc, " %s", - (tbl->is_ht40) ? "40MHz" : "20MHz"); - desc += - sprintf(buff + desc, " %s %s %s\n", - (tbl->is_SGI) ? "SGI" : "", - (lq_sta->is_green) ? "GF enabled" : "", - (lq_sta->is_agg) ? "AGG on" : ""); - } - desc += - sprintf(buff + desc, "last tx rate=0x%X\n", - lq_sta->last_rate_n_flags); - desc += - sprintf(buff + desc, - "general:" "flags=0x%X mimo-d=%d s-ant0x%x d-ant=0x%x\n", - lq_sta->lq.general_params.flags, - lq_sta->lq.general_params.mimo_delimiter, - lq_sta->lq.general_params.single_stream_ant_msk, - lq_sta->lq.general_params.dual_stream_ant_msk); - - desc += - sprintf(buff + desc, - "agg:" - "time_limit=%d dist_start_th=%d frame_cnt_limit=%d\n", - le16_to_cpu(lq_sta->lq.agg_params.agg_time_limit), - lq_sta->lq.agg_params.agg_dis_start_th, - lq_sta->lq.agg_params.agg_frame_cnt_limit); - - desc += - sprintf(buff + desc, - "Start idx [0]=0x%x [1]=0x%x [2]=0x%x [3]=0x%x\n", - lq_sta->lq.general_params.start_rate_idx[0], - lq_sta->lq.general_params.start_rate_idx[1], - lq_sta->lq.general_params.start_rate_idx[2], - lq_sta->lq.general_params.start_rate_idx[3]); - - for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { - idx = - il4965_hwrate_to_plcp_idx(le32_to_cpu - (lq_sta->lq.rs_table[i]. - rate_n_flags)); - if (is_legacy(tbl->lq_type)) { - desc += - sprintf(buff + desc, " rate[%d] 0x%X %smbps\n", i, - le32_to_cpu(lq_sta->lq.rs_table[i]. - rate_n_flags), - il_rate_mcs[idx].mbps); - } else { - desc += - sprintf(buff + desc, " rate[%d] 0x%X %smbps (%s)\n", - i, - le32_to_cpu(lq_sta->lq.rs_table[i]. - rate_n_flags), - il_rate_mcs[idx].mbps, - il_rate_mcs[idx].mcs); - } - } - - ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); - kfree(buff); - return ret; -} - -static const struct file_operations rs_sta_dbgfs_scale_table_ops = { - .write = il4965_rs_sta_dbgfs_scale_table_write, - .read = il4965_rs_sta_dbgfs_scale_table_read, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t -il4965_rs_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - char *buff; - int desc = 0; - int i, j; - ssize_t ret; - - struct il_lq_sta *lq_sta = file->private_data; - - buff = kmalloc(1024, GFP_KERNEL); - if (!buff) - return -ENOMEM; - - for (i = 0; i < LQ_SIZE; i++) { - desc += - sprintf(buff + desc, - "%s type=%d SGI=%d HT40=%d DUP=%d GF=%d\n" - "rate=0x%X\n", lq_sta->active_tbl == i ? "*" : "x", - lq_sta->lq_info[i].lq_type, - lq_sta->lq_info[i].is_SGI, - lq_sta->lq_info[i].is_ht40, - lq_sta->lq_info[i].is_dup, lq_sta->is_green, - lq_sta->lq_info[i].current_rate); - for (j = 0; j < RATE_COUNT; j++) { - desc += - sprintf(buff + desc, - "counter=%d success=%d %%=%d\n", - lq_sta->lq_info[i].win[j].counter, - lq_sta->lq_info[i].win[j].success_counter, - lq_sta->lq_info[i].win[j].success_ratio); - } - } - ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); - kfree(buff); - return ret; -} - -static const struct file_operations rs_sta_dbgfs_stats_table_ops = { - .read = il4965_rs_sta_dbgfs_stats_table_read, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t -il4965_rs_sta_dbgfs_rate_scale_data_read(struct file *file, - char __user *user_buf, size_t count, - loff_t *ppos) -{ - char buff[120]; - int desc = 0; - struct il_lq_sta *lq_sta = file->private_data; - struct il_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; - - if (is_Ht(tbl->lq_type)) - desc += - sprintf(buff + desc, "Bit Rate= %d Mb/s\n", - tbl->expected_tpt[lq_sta->last_txrate_idx]); - else - desc += - sprintf(buff + desc, "Bit Rate= %d Mb/s\n", - il_rates[lq_sta->last_txrate_idx].ieee >> 1); - - return simple_read_from_buffer(user_buf, count, ppos, buff, desc); -} - -static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { - .read = il4965_rs_sta_dbgfs_rate_scale_data_read, - .open = simple_open, - .llseek = default_llseek, -}; - -static void -il4965_rs_add_debugfs(void *il, void *il_sta, struct dentry *dir) -{ - struct il_lq_sta *lq_sta = il_sta; - lq_sta->rs_sta_dbgfs_scale_table_file = - debugfs_create_file("rate_scale_table", S_IRUSR | S_IWUSR, dir, - lq_sta, &rs_sta_dbgfs_scale_table_ops); - lq_sta->rs_sta_dbgfs_stats_table_file = - debugfs_create_file("rate_stats_table", S_IRUSR, dir, lq_sta, - &rs_sta_dbgfs_stats_table_ops); - lq_sta->rs_sta_dbgfs_rate_scale_data_file = - debugfs_create_file("rate_scale_data", S_IRUSR, dir, lq_sta, - &rs_sta_dbgfs_rate_scale_data_ops); - lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file = - debugfs_create_u8("tx_agg_tid_enable", S_IRUSR | S_IWUSR, dir, - &lq_sta->tx_agg_tid_en); - -} - -static void -il4965_rs_remove_debugfs(void *il, void *il_sta) -{ - struct il_lq_sta *lq_sta = il_sta; - debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); - debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); - debugfs_remove(lq_sta->rs_sta_dbgfs_rate_scale_data_file); - debugfs_remove(lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file); -} -#endif - -/* - * Initialization of rate scaling information is done by driver after - * the station is added. Since mac80211 calls this function before a - * station is added we ignore it. - */ -static void -il4965_rs_rate_init_stub(void *il_r, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *il_sta) -{ -} - -static struct rate_control_ops rs_4965_ops = { - .module = NULL, - .name = IL4965_RS_NAME, - .tx_status = il4965_rs_tx_status, - .get_rate = il4965_rs_get_rate, - .rate_init = il4965_rs_rate_init_stub, - .alloc = il4965_rs_alloc, - .free = il4965_rs_free, - .alloc_sta = il4965_rs_alloc_sta, - .free_sta = il4965_rs_free_sta, -#ifdef CONFIG_MAC80211_DEBUGFS - .add_sta_debugfs = il4965_rs_add_debugfs, - .remove_sta_debugfs = il4965_rs_remove_debugfs, -#endif -}; - -int -il4965_rate_control_register(void) -{ - return ieee80211_rate_control_register(&rs_4965_ops); -} - -void -il4965_rate_control_unregister(void) -{ - ieee80211_rate_control_unregister(&rs_4965_ops); -} diff --git a/drivers/net/wireless/iwlegacy/4965.c b/drivers/net/wireless/iwlegacy/4965.c deleted file mode 100644 index 777a578294bd..000000000000 --- a/drivers/net/wireless/iwlegacy/4965.c +++ /dev/null @@ -1,1951 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "common.h" -#include "4965.h" - -/** - * il_verify_inst_sparse - verify runtime uCode image in card vs. host, - * using sample data 100 bytes apart. If these sample points are good, - * it's a pretty good bet that everything between them is good, too. - */ -static int -il4965_verify_inst_sparse(struct il_priv *il, __le32 * image, u32 len) -{ - u32 val; - int ret = 0; - u32 errcnt = 0; - u32 i; - - D_INFO("ucode inst image size is %u\n", len); - - for (i = 0; i < len; i += 100, image += 100 / sizeof(u32)) { - /* read data comes through single port, auto-incr addr */ - /* NOTE: Use the debugless read so we don't flood kernel log - * if IL_DL_IO is set */ - il_wr(il, HBUS_TARG_MEM_RADDR, i + IL4965_RTC_INST_LOWER_BOUND); - val = _il_rd(il, HBUS_TARG_MEM_RDAT); - if (val != le32_to_cpu(*image)) { - ret = -EIO; - errcnt++; - if (errcnt >= 3) - break; - } - } - - return ret; -} - -/** - * il4965_verify_inst_full - verify runtime uCode image in card vs. host, - * looking at all data. - */ -static int -il4965_verify_inst_full(struct il_priv *il, __le32 * image, u32 len) -{ - u32 val; - u32 save_len = len; - int ret = 0; - u32 errcnt; - - D_INFO("ucode inst image size is %u\n", len); - - il_wr(il, HBUS_TARG_MEM_RADDR, IL4965_RTC_INST_LOWER_BOUND); - - errcnt = 0; - for (; len > 0; len -= sizeof(u32), image++) { - /* read data comes through single port, auto-incr addr */ - /* NOTE: Use the debugless read so we don't flood kernel log - * if IL_DL_IO is set */ - val = _il_rd(il, HBUS_TARG_MEM_RDAT); - if (val != le32_to_cpu(*image)) { - IL_ERR("uCode INST section is invalid at " - "offset 0x%x, is 0x%x, s/b 0x%x\n", - save_len - len, val, le32_to_cpu(*image)); - ret = -EIO; - errcnt++; - if (errcnt >= 20) - break; - } - } - - if (!errcnt) - D_INFO("ucode image in INSTRUCTION memory is good\n"); - - return ret; -} - -/** - * il4965_verify_ucode - determine which instruction image is in SRAM, - * and verify its contents - */ -int -il4965_verify_ucode(struct il_priv *il) -{ - __le32 *image; - u32 len; - int ret; - - /* Try bootstrap */ - image = (__le32 *) il->ucode_boot.v_addr; - len = il->ucode_boot.len; - ret = il4965_verify_inst_sparse(il, image, len); - if (!ret) { - D_INFO("Bootstrap uCode is good in inst SRAM\n"); - return 0; - } - - /* Try initialize */ - image = (__le32 *) il->ucode_init.v_addr; - len = il->ucode_init.len; - ret = il4965_verify_inst_sparse(il, image, len); - if (!ret) { - D_INFO("Initialize uCode is good in inst SRAM\n"); - return 0; - } - - /* Try runtime/protocol */ - image = (__le32 *) il->ucode_code.v_addr; - len = il->ucode_code.len; - ret = il4965_verify_inst_sparse(il, image, len); - if (!ret) { - D_INFO("Runtime uCode is good in inst SRAM\n"); - return 0; - } - - IL_ERR("NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); - - /* Since nothing seems to match, show first several data entries in - * instruction SRAM, so maybe visual inspection will give a clue. - * Selection of bootstrap image (vs. other images) is arbitrary. */ - image = (__le32 *) il->ucode_boot.v_addr; - len = il->ucode_boot.len; - ret = il4965_verify_inst_full(il, image, len); - - return ret; -} - -/****************************************************************************** - * - * EEPROM related functions - * -******************************************************************************/ - -/* - * The device's EEPROM semaphore prevents conflicts between driver and uCode - * when accessing the EEPROM; each access is a series of pulses to/from the - * EEPROM chip, not a single event, so even reads could conflict if they - * weren't arbitrated by the semaphore. - */ -int -il4965_eeprom_acquire_semaphore(struct il_priv *il) -{ - u16 count; - int ret; - - for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) { - /* Request semaphore */ - il_set_bit(il, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); - - /* See if we got it */ - ret = - _il_poll_bit(il, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, - CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, - EEPROM_SEM_TIMEOUT); - if (ret >= 0) - return ret; - } - - return ret; -} - -void -il4965_eeprom_release_semaphore(struct il_priv *il) -{ - il_clear_bit(il, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); - -} - -int -il4965_eeprom_check_version(struct il_priv *il) -{ - u16 eeprom_ver; - u16 calib_ver; - - eeprom_ver = il_eeprom_query16(il, EEPROM_VERSION); - calib_ver = il_eeprom_query16(il, EEPROM_4965_CALIB_VERSION_OFFSET); - - if (eeprom_ver < il->cfg->eeprom_ver || - calib_ver < il->cfg->eeprom_calib_ver) - goto err; - - IL_INFO("device EEPROM VER=0x%x, CALIB=0x%x\n", eeprom_ver, calib_ver); - - return 0; -err: - IL_ERR("Unsupported (too old) EEPROM VER=0x%x < 0x%x " - "CALIB=0x%x < 0x%x\n", eeprom_ver, il->cfg->eeprom_ver, - calib_ver, il->cfg->eeprom_calib_ver); - return -EINVAL; - -} - -void -il4965_eeprom_get_mac(const struct il_priv *il, u8 * mac) -{ - const u8 *addr = il_eeprom_query_addr(il, - EEPROM_MAC_ADDRESS); - memcpy(mac, addr, ETH_ALEN); -} - -/* Send led command */ -static int -il4965_send_led_cmd(struct il_priv *il, struct il_led_cmd *led_cmd) -{ - struct il_host_cmd cmd = { - .id = C_LEDS, - .len = sizeof(struct il_led_cmd), - .data = led_cmd, - .flags = CMD_ASYNC, - .callback = NULL, - }; - u32 reg; - - reg = _il_rd(il, CSR_LED_REG); - if (reg != (reg & CSR_LED_BSM_CTRL_MSK)) - _il_wr(il, CSR_LED_REG, reg & CSR_LED_BSM_CTRL_MSK); - - return il_send_cmd(il, &cmd); -} - -/* Set led register off */ -void -il4965_led_enable(struct il_priv *il) -{ - _il_wr(il, CSR_LED_REG, CSR_LED_REG_TRUN_ON); -} - -static int il4965_send_tx_power(struct il_priv *il); -static int il4965_hw_get_temperature(struct il_priv *il); - -/* Highest firmware API version supported */ -#define IL4965_UCODE_API_MAX 2 - -/* Lowest firmware API version supported */ -#define IL4965_UCODE_API_MIN 2 - -#define IL4965_FW_PRE "iwlwifi-4965-" -#define _IL4965_MODULE_FIRMWARE(api) IL4965_FW_PRE #api ".ucode" -#define IL4965_MODULE_FIRMWARE(api) _IL4965_MODULE_FIRMWARE(api) - -/* check contents of special bootstrap uCode SRAM */ -static int -il4965_verify_bsm(struct il_priv *il) -{ - __le32 *image = il->ucode_boot.v_addr; - u32 len = il->ucode_boot.len; - u32 reg; - u32 val; - - D_INFO("Begin verify bsm\n"); - - /* verify BSM SRAM contents */ - val = il_rd_prph(il, BSM_WR_DWCOUNT_REG); - for (reg = BSM_SRAM_LOWER_BOUND; reg < BSM_SRAM_LOWER_BOUND + len; - reg += sizeof(u32), image++) { - val = il_rd_prph(il, reg); - if (val != le32_to_cpu(*image)) { - IL_ERR("BSM uCode verification failed at " - "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", - BSM_SRAM_LOWER_BOUND, reg - BSM_SRAM_LOWER_BOUND, - len, val, le32_to_cpu(*image)); - return -EIO; - } - } - - D_INFO("BSM bootstrap uCode image OK\n"); - - return 0; -} - -/** - * il4965_load_bsm - Load bootstrap instructions - * - * BSM operation: - * - * The Bootstrap State Machine (BSM) stores a short bootstrap uCode program - * in special SRAM that does not power down during RFKILL. When powering back - * up after power-saving sleeps (or during initial uCode load), the BSM loads - * the bootstrap program into the on-board processor, and starts it. - * - * The bootstrap program loads (via DMA) instructions and data for a new - * program from host DRAM locations indicated by the host driver in the - * BSM_DRAM_* registers. Once the new program is loaded, it starts - * automatically. - * - * When initializing the NIC, the host driver points the BSM to the - * "initialize" uCode image. This uCode sets up some internal data, then - * notifies host via "initialize alive" that it is complete. - * - * The host then replaces the BSM_DRAM_* pointer values to point to the - * normal runtime uCode instructions and a backup uCode data cache buffer - * (filled initially with starting data values for the on-board processor), - * then triggers the "initialize" uCode to load and launch the runtime uCode, - * which begins normal operation. - * - * When doing a power-save shutdown, runtime uCode saves data SRAM into - * the backup data cache in DRAM before SRAM is powered down. - * - * When powering back up, the BSM loads the bootstrap program. This reloads - * the runtime uCode instructions and the backup data cache into SRAM, - * and re-launches the runtime uCode from where it left off. - */ -static int -il4965_load_bsm(struct il_priv *il) -{ - __le32 *image = il->ucode_boot.v_addr; - u32 len = il->ucode_boot.len; - dma_addr_t pinst; - dma_addr_t pdata; - u32 inst_len; - u32 data_len; - int i; - u32 done; - u32 reg_offset; - int ret; - - D_INFO("Begin load bsm\n"); - - il->ucode_type = UCODE_RT; - - /* make sure bootstrap program is no larger than BSM's SRAM size */ - if (len > IL49_MAX_BSM_SIZE) - return -EINVAL; - - /* Tell bootstrap uCode where to find the "Initialize" uCode - * in host DRAM ... host DRAM physical address bits 35:4 for 4965. - * NOTE: il_init_alive_start() will replace these values, - * after the "initialize" uCode has run, to point to - * runtime/protocol instructions and backup data cache. - */ - pinst = il->ucode_init.p_addr >> 4; - pdata = il->ucode_init_data.p_addr >> 4; - inst_len = il->ucode_init.len; - data_len = il->ucode_init_data.len; - - il_wr_prph(il, BSM_DRAM_INST_PTR_REG, pinst); - il_wr_prph(il, BSM_DRAM_DATA_PTR_REG, pdata); - il_wr_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, inst_len); - il_wr_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, data_len); - - /* Fill BSM memory with bootstrap instructions */ - for (reg_offset = BSM_SRAM_LOWER_BOUND; - reg_offset < BSM_SRAM_LOWER_BOUND + len; - reg_offset += sizeof(u32), image++) - _il_wr_prph(il, reg_offset, le32_to_cpu(*image)); - - ret = il4965_verify_bsm(il); - if (ret) - return ret; - - /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ - il_wr_prph(il, BSM_WR_MEM_SRC_REG, 0x0); - il_wr_prph(il, BSM_WR_MEM_DST_REG, IL49_RTC_INST_LOWER_BOUND); - il_wr_prph(il, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); - - /* Load bootstrap code into instruction SRAM now, - * to prepare to load "initialize" uCode */ - il_wr_prph(il, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START); - - /* Wait for load of bootstrap uCode to finish */ - for (i = 0; i < 100; i++) { - done = il_rd_prph(il, BSM_WR_CTRL_REG); - if (!(done & BSM_WR_CTRL_REG_BIT_START)) - break; - udelay(10); - } - if (i < 100) - D_INFO("BSM write complete, poll %d iterations\n", i); - else { - IL_ERR("BSM write did not complete!\n"); - return -EIO; - } - - /* Enable future boot loads whenever power management unit triggers it - * (e.g. when powering back up after power-save shutdown) */ - il_wr_prph(il, BSM_WR_CTRL_REG, BSM_WR_CTRL_REG_BIT_START_EN); - - return 0; -} - -/** - * il4965_set_ucode_ptrs - Set uCode address location - * - * Tell initialization uCode where to find runtime uCode. - * - * BSM registers initially contain pointers to initialization uCode. - * We need to replace them to load runtime uCode inst and data, - * and to save runtime data when powering down. - */ -static int -il4965_set_ucode_ptrs(struct il_priv *il) -{ - dma_addr_t pinst; - dma_addr_t pdata; - int ret = 0; - - /* bits 35:4 for 4965 */ - pinst = il->ucode_code.p_addr >> 4; - pdata = il->ucode_data_backup.p_addr >> 4; - - /* Tell bootstrap uCode where to find image to load */ - il_wr_prph(il, BSM_DRAM_INST_PTR_REG, pinst); - il_wr_prph(il, BSM_DRAM_DATA_PTR_REG, pdata); - il_wr_prph(il, BSM_DRAM_DATA_BYTECOUNT_REG, il->ucode_data.len); - - /* Inst byte count must be last to set up, bit 31 signals uCode - * that all new ptr/size info is in place */ - il_wr_prph(il, BSM_DRAM_INST_BYTECOUNT_REG, - il->ucode_code.len | BSM_DRAM_INST_LOAD); - D_INFO("Runtime uCode pointers are set.\n"); - - return ret; -} - -/** - * il4965_init_alive_start - Called after N_ALIVE notification received - * - * Called after N_ALIVE notification received from "initialize" uCode. - * - * The 4965 "initialize" ALIVE reply contains calibration data for: - * Voltage, temperature, and MIMO tx gain correction, now stored in il - * (3945 does not contain this data). - * - * Tell "initialize" uCode to go ahead and load the runtime uCode. -*/ -static void -il4965_init_alive_start(struct il_priv *il) -{ - /* Bootstrap uCode has loaded initialize uCode ... verify inst image. - * This is a paranoid check, because we would not have gotten the - * "initialize" alive if code weren't properly loaded. */ - if (il4965_verify_ucode(il)) { - /* Runtime instruction load was bad; - * take it all the way back down so we can try again */ - D_INFO("Bad \"initialize\" uCode load.\n"); - goto restart; - } - - /* Calculate temperature */ - il->temperature = il4965_hw_get_temperature(il); - - /* Send pointers to protocol/runtime uCode image ... init code will - * load and launch runtime uCode, which will send us another "Alive" - * notification. */ - D_INFO("Initialization Alive received.\n"); - if (il4965_set_ucode_ptrs(il)) { - /* Runtime instruction load won't happen; - * take it all the way back down so we can try again */ - D_INFO("Couldn't set up uCode pointers.\n"); - goto restart; - } - return; - -restart: - queue_work(il->workqueue, &il->restart); -} - -static bool -iw4965_is_ht40_channel(__le32 rxon_flags) -{ - int chan_mod = - le32_to_cpu(rxon_flags & RXON_FLG_CHANNEL_MODE_MSK) >> - RXON_FLG_CHANNEL_MODE_POS; - return (chan_mod == CHANNEL_MODE_PURE_40 || - chan_mod == CHANNEL_MODE_MIXED); -} - -void -il4965_nic_config(struct il_priv *il) -{ - unsigned long flags; - u16 radio_cfg; - - spin_lock_irqsave(&il->lock, flags); - - radio_cfg = il_eeprom_query16(il, EEPROM_RADIO_CONFIG); - - /* write radio config values to register */ - if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) == EEPROM_4965_RF_CFG_TYPE_MAX) - il_set_bit(il, CSR_HW_IF_CONFIG_REG, - EEPROM_RF_CFG_TYPE_MSK(radio_cfg) | - EEPROM_RF_CFG_STEP_MSK(radio_cfg) | - EEPROM_RF_CFG_DASH_MSK(radio_cfg)); - - /* set CSR_HW_CONFIG_REG for uCode use */ - il_set_bit(il, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | - CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); - - il->calib_info = - (struct il_eeprom_calib_info *) - il_eeprom_query_addr(il, EEPROM_4965_CALIB_TXPOWER_OFFSET); - - spin_unlock_irqrestore(&il->lock, flags); -} - -/* Reset differential Rx gains in NIC to prepare for chain noise calibration. - * Called after every association, but this runs only once! - * ... once chain noise is calibrated the first time, it's good forever. */ -static void -il4965_chain_noise_reset(struct il_priv *il) -{ - struct il_chain_noise_data *data = &(il->chain_noise_data); - - if (data->state == IL_CHAIN_NOISE_ALIVE && il_is_any_associated(il)) { - struct il_calib_diff_gain_cmd cmd; - - /* clear data for chain noise calibration algorithm */ - data->chain_noise_a = 0; - data->chain_noise_b = 0; - data->chain_noise_c = 0; - data->chain_signal_a = 0; - data->chain_signal_b = 0; - data->chain_signal_c = 0; - data->beacon_count = 0; - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.op_code = IL_PHY_CALIBRATE_DIFF_GAIN_CMD; - cmd.diff_gain_a = 0; - cmd.diff_gain_b = 0; - cmd.diff_gain_c = 0; - if (il_send_cmd_pdu(il, C_PHY_CALIBRATION, sizeof(cmd), &cmd)) - IL_ERR("Could not send C_PHY_CALIBRATION\n"); - data->state = IL_CHAIN_NOISE_ACCUMULATE; - D_CALIB("Run chain_noise_calibrate\n"); - } -} - -static s32 -il4965_math_div_round(s32 num, s32 denom, s32 * res) -{ - s32 sign = 1; - - if (num < 0) { - sign = -sign; - num = -num; - } - if (denom < 0) { - sign = -sign; - denom = -denom; - } - *res = 1; - *res = ((num * 2 + denom) / (denom * 2)) * sign; - - return 1; -} - -/** - * il4965_get_voltage_compensation - Power supply voltage comp for txpower - * - * Determines power supply voltage compensation for txpower calculations. - * Returns number of 1/2-dB steps to subtract from gain table idx, - * to compensate for difference between power supply voltage during - * factory measurements, vs. current power supply voltage. - * - * Voltage indication is higher for lower voltage. - * Lower voltage requires more gain (lower gain table idx). - */ -static s32 -il4965_get_voltage_compensation(s32 eeprom_voltage, s32 current_voltage) -{ - s32 comp = 0; - - if (TX_POWER_IL_ILLEGAL_VOLTAGE == eeprom_voltage || - TX_POWER_IL_ILLEGAL_VOLTAGE == current_voltage) - return 0; - - il4965_math_div_round(current_voltage - eeprom_voltage, - TX_POWER_IL_VOLTAGE_CODES_PER_03V, &comp); - - if (current_voltage > eeprom_voltage) - comp *= 2; - if ((comp < -2) || (comp > 2)) - comp = 0; - - return comp; -} - -static s32 -il4965_get_tx_atten_grp(u16 channel) -{ - if (channel >= CALIB_IL_TX_ATTEN_GR5_FCH && - channel <= CALIB_IL_TX_ATTEN_GR5_LCH) - return CALIB_CH_GROUP_5; - - if (channel >= CALIB_IL_TX_ATTEN_GR1_FCH && - channel <= CALIB_IL_TX_ATTEN_GR1_LCH) - return CALIB_CH_GROUP_1; - - if (channel >= CALIB_IL_TX_ATTEN_GR2_FCH && - channel <= CALIB_IL_TX_ATTEN_GR2_LCH) - return CALIB_CH_GROUP_2; - - if (channel >= CALIB_IL_TX_ATTEN_GR3_FCH && - channel <= CALIB_IL_TX_ATTEN_GR3_LCH) - return CALIB_CH_GROUP_3; - - if (channel >= CALIB_IL_TX_ATTEN_GR4_FCH && - channel <= CALIB_IL_TX_ATTEN_GR4_LCH) - return CALIB_CH_GROUP_4; - - return -EINVAL; -} - -static u32 -il4965_get_sub_band(const struct il_priv *il, u32 channel) -{ - s32 b = -1; - - for (b = 0; b < EEPROM_TX_POWER_BANDS; b++) { - if (il->calib_info->band_info[b].ch_from == 0) - continue; - - if (channel >= il->calib_info->band_info[b].ch_from && - channel <= il->calib_info->band_info[b].ch_to) - break; - } - - return b; -} - -static s32 -il4965_interpolate_value(s32 x, s32 x1, s32 y1, s32 x2, s32 y2) -{ - s32 val; - - if (x2 == x1) - return y1; - else { - il4965_math_div_round((x2 - x) * (y1 - y2), (x2 - x1), &val); - return val + y2; - } -} - -/** - * il4965_interpolate_chan - Interpolate factory measurements for one channel - * - * Interpolates factory measurements from the two sample channels within a - * sub-band, to apply to channel of interest. Interpolation is proportional to - * differences in channel frequencies, which is proportional to differences - * in channel number. - */ -static int -il4965_interpolate_chan(struct il_priv *il, u32 channel, - struct il_eeprom_calib_ch_info *chan_info) -{ - s32 s = -1; - u32 c; - u32 m; - const struct il_eeprom_calib_measure *m1; - const struct il_eeprom_calib_measure *m2; - struct il_eeprom_calib_measure *omeas; - u32 ch_i1; - u32 ch_i2; - - s = il4965_get_sub_band(il, channel); - if (s >= EEPROM_TX_POWER_BANDS) { - IL_ERR("Tx Power can not find channel %d\n", channel); - return -1; - } - - ch_i1 = il->calib_info->band_info[s].ch1.ch_num; - ch_i2 = il->calib_info->band_info[s].ch2.ch_num; - chan_info->ch_num = (u8) channel; - - D_TXPOWER("channel %d subband %d factory cal ch %d & %d\n", channel, s, - ch_i1, ch_i2); - - for (c = 0; c < EEPROM_TX_POWER_TX_CHAINS; c++) { - for (m = 0; m < EEPROM_TX_POWER_MEASUREMENTS; m++) { - m1 = &(il->calib_info->band_info[s].ch1. - measurements[c][m]); - m2 = &(il->calib_info->band_info[s].ch2. - measurements[c][m]); - omeas = &(chan_info->measurements[c][m]); - - omeas->actual_pow = - (u8) il4965_interpolate_value(channel, ch_i1, - m1->actual_pow, ch_i2, - m2->actual_pow); - omeas->gain_idx = - (u8) il4965_interpolate_value(channel, ch_i1, - m1->gain_idx, ch_i2, - m2->gain_idx); - omeas->temperature = - (u8) il4965_interpolate_value(channel, ch_i1, - m1->temperature, - ch_i2, - m2->temperature); - omeas->pa_det = - (s8) il4965_interpolate_value(channel, ch_i1, - m1->pa_det, ch_i2, - m2->pa_det); - - D_TXPOWER("chain %d meas %d AP1=%d AP2=%d AP=%d\n", c, - m, m1->actual_pow, m2->actual_pow, - omeas->actual_pow); - D_TXPOWER("chain %d meas %d NI1=%d NI2=%d NI=%d\n", c, - m, m1->gain_idx, m2->gain_idx, - omeas->gain_idx); - D_TXPOWER("chain %d meas %d PA1=%d PA2=%d PA=%d\n", c, - m, m1->pa_det, m2->pa_det, omeas->pa_det); - D_TXPOWER("chain %d meas %d T1=%d T2=%d T=%d\n", c, - m, m1->temperature, m2->temperature, - omeas->temperature); - } - } - - return 0; -} - -/* bit-rate-dependent table to prevent Tx distortion, in half-dB units, - * for OFDM 6, 12, 18, 24, 36, 48, 54, 60 MBit, and CCK all rates. */ -static s32 back_off_table[] = { - 10, 10, 10, 10, 10, 15, 17, 20, /* OFDM SISO 20 MHz */ - 10, 10, 10, 10, 10, 15, 17, 20, /* OFDM MIMO 20 MHz */ - 10, 10, 10, 10, 10, 15, 17, 20, /* OFDM SISO 40 MHz */ - 10, 10, 10, 10, 10, 15, 17, 20, /* OFDM MIMO 40 MHz */ - 10 /* CCK */ -}; - -/* Thermal compensation values for txpower for various frequency ranges ... - * ratios from 3:1 to 4.5:1 of degrees (Celsius) per half-dB gain adjust */ -static struct il4965_txpower_comp_entry { - s32 degrees_per_05db_a; - s32 degrees_per_05db_a_denom; -} tx_power_cmp_tble[CALIB_CH_GROUP_MAX] = { - { - 9, 2}, /* group 0 5.2, ch 34-43 */ - { - 4, 1}, /* group 1 5.2, ch 44-70 */ - { - 4, 1}, /* group 2 5.2, ch 71-124 */ - { - 4, 1}, /* group 3 5.2, ch 125-200 */ - { - 3, 1} /* group 4 2.4, ch all */ -}; - -static s32 -get_min_power_idx(s32 rate_power_idx, u32 band) -{ - if (!band) { - if ((rate_power_idx & 7) <= 4) - return MIN_TX_GAIN_IDX_52GHZ_EXT; - } - return MIN_TX_GAIN_IDX; -} - -struct gain_entry { - u8 dsp; - u8 radio; -}; - -static const struct gain_entry gain_table[2][108] = { - /* 5.2GHz power gain idx table */ - { - {123, 0x3F}, /* highest txpower */ - {117, 0x3F}, - {110, 0x3F}, - {104, 0x3F}, - {98, 0x3F}, - {110, 0x3E}, - {104, 0x3E}, - {98, 0x3E}, - {110, 0x3D}, - {104, 0x3D}, - {98, 0x3D}, - {110, 0x3C}, - {104, 0x3C}, - {98, 0x3C}, - {110, 0x3B}, - {104, 0x3B}, - {98, 0x3B}, - {110, 0x3A}, - {104, 0x3A}, - {98, 0x3A}, - {110, 0x39}, - {104, 0x39}, - {98, 0x39}, - {110, 0x38}, - {104, 0x38}, - {98, 0x38}, - {110, 0x37}, - {104, 0x37}, - {98, 0x37}, - {110, 0x36}, - {104, 0x36}, - {98, 0x36}, - {110, 0x35}, - {104, 0x35}, - {98, 0x35}, - {110, 0x34}, - {104, 0x34}, - {98, 0x34}, - {110, 0x33}, - {104, 0x33}, - {98, 0x33}, - {110, 0x32}, - {104, 0x32}, - {98, 0x32}, - {110, 0x31}, - {104, 0x31}, - {98, 0x31}, - {110, 0x30}, - {104, 0x30}, - {98, 0x30}, - {110, 0x25}, - {104, 0x25}, - {98, 0x25}, - {110, 0x24}, - {104, 0x24}, - {98, 0x24}, - {110, 0x23}, - {104, 0x23}, - {98, 0x23}, - {110, 0x22}, - {104, 0x18}, - {98, 0x18}, - {110, 0x17}, - {104, 0x17}, - {98, 0x17}, - {110, 0x16}, - {104, 0x16}, - {98, 0x16}, - {110, 0x15}, - {104, 0x15}, - {98, 0x15}, - {110, 0x14}, - {104, 0x14}, - {98, 0x14}, - {110, 0x13}, - {104, 0x13}, - {98, 0x13}, - {110, 0x12}, - {104, 0x08}, - {98, 0x08}, - {110, 0x07}, - {104, 0x07}, - {98, 0x07}, - {110, 0x06}, - {104, 0x06}, - {98, 0x06}, - {110, 0x05}, - {104, 0x05}, - {98, 0x05}, - {110, 0x04}, - {104, 0x04}, - {98, 0x04}, - {110, 0x03}, - {104, 0x03}, - {98, 0x03}, - {110, 0x02}, - {104, 0x02}, - {98, 0x02}, - {110, 0x01}, - {104, 0x01}, - {98, 0x01}, - {110, 0x00}, - {104, 0x00}, - {98, 0x00}, - {93, 0x00}, - {88, 0x00}, - {83, 0x00}, - {78, 0x00}, - }, - /* 2.4GHz power gain idx table */ - { - {110, 0x3f}, /* highest txpower */ - {104, 0x3f}, - {98, 0x3f}, - {110, 0x3e}, - {104, 0x3e}, - {98, 0x3e}, - {110, 0x3d}, - {104, 0x3d}, - {98, 0x3d}, - {110, 0x3c}, - {104, 0x3c}, - {98, 0x3c}, - {110, 0x3b}, - {104, 0x3b}, - {98, 0x3b}, - {110, 0x3a}, - {104, 0x3a}, - {98, 0x3a}, - {110, 0x39}, - {104, 0x39}, - {98, 0x39}, - {110, 0x38}, - {104, 0x38}, - {98, 0x38}, - {110, 0x37}, - {104, 0x37}, - {98, 0x37}, - {110, 0x36}, - {104, 0x36}, - {98, 0x36}, - {110, 0x35}, - {104, 0x35}, - {98, 0x35}, - {110, 0x34}, - {104, 0x34}, - {98, 0x34}, - {110, 0x33}, - {104, 0x33}, - {98, 0x33}, - {110, 0x32}, - {104, 0x32}, - {98, 0x32}, - {110, 0x31}, - {104, 0x31}, - {98, 0x31}, - {110, 0x30}, - {104, 0x30}, - {98, 0x30}, - {110, 0x6}, - {104, 0x6}, - {98, 0x6}, - {110, 0x5}, - {104, 0x5}, - {98, 0x5}, - {110, 0x4}, - {104, 0x4}, - {98, 0x4}, - {110, 0x3}, - {104, 0x3}, - {98, 0x3}, - {110, 0x2}, - {104, 0x2}, - {98, 0x2}, - {110, 0x1}, - {104, 0x1}, - {98, 0x1}, - {110, 0x0}, - {104, 0x0}, - {98, 0x0}, - {97, 0}, - {96, 0}, - {95, 0}, - {94, 0}, - {93, 0}, - {92, 0}, - {91, 0}, - {90, 0}, - {89, 0}, - {88, 0}, - {87, 0}, - {86, 0}, - {85, 0}, - {84, 0}, - {83, 0}, - {82, 0}, - {81, 0}, - {80, 0}, - {79, 0}, - {78, 0}, - {77, 0}, - {76, 0}, - {75, 0}, - {74, 0}, - {73, 0}, - {72, 0}, - {71, 0}, - {70, 0}, - {69, 0}, - {68, 0}, - {67, 0}, - {66, 0}, - {65, 0}, - {64, 0}, - {63, 0}, - {62, 0}, - {61, 0}, - {60, 0}, - {59, 0}, - } -}; - -static int -il4965_fill_txpower_tbl(struct il_priv *il, u8 band, u16 channel, u8 is_ht40, - u8 ctrl_chan_high, - struct il4965_tx_power_db *tx_power_tbl) -{ - u8 saturation_power; - s32 target_power; - s32 user_target_power; - s32 power_limit; - s32 current_temp; - s32 reg_limit; - s32 current_regulatory; - s32 txatten_grp = CALIB_CH_GROUP_MAX; - int i; - int c; - const struct il_channel_info *ch_info = NULL; - struct il_eeprom_calib_ch_info ch_eeprom_info; - const struct il_eeprom_calib_measure *measurement; - s16 voltage; - s32 init_voltage; - s32 voltage_compensation; - s32 degrees_per_05db_num; - s32 degrees_per_05db_denom; - s32 factory_temp; - s32 temperature_comp[2]; - s32 factory_gain_idx[2]; - s32 factory_actual_pwr[2]; - s32 power_idx; - - /* tx_power_user_lmt is in dBm, convert to half-dBm (half-dB units - * are used for idxing into txpower table) */ - user_target_power = 2 * il->tx_power_user_lmt; - - /* Get current (RXON) channel, band, width */ - D_TXPOWER("chan %d band %d is_ht40 %d\n", channel, band, is_ht40); - - ch_info = il_get_channel_info(il, il->band, channel); - - if (!il_is_channel_valid(ch_info)) - return -EINVAL; - - /* get txatten group, used to select 1) thermal txpower adjustment - * and 2) mimo txpower balance between Tx chains. */ - txatten_grp = il4965_get_tx_atten_grp(channel); - if (txatten_grp < 0) { - IL_ERR("Can't find txatten group for channel %d.\n", channel); - return txatten_grp; - } - - D_TXPOWER("channel %d belongs to txatten group %d\n", channel, - txatten_grp); - - if (is_ht40) { - if (ctrl_chan_high) - channel -= 2; - else - channel += 2; - } - - /* hardware txpower limits ... - * saturation (clipping distortion) txpowers are in half-dBm */ - if (band) - saturation_power = il->calib_info->saturation_power24; - else - saturation_power = il->calib_info->saturation_power52; - - if (saturation_power < IL_TX_POWER_SATURATION_MIN || - saturation_power > IL_TX_POWER_SATURATION_MAX) { - if (band) - saturation_power = IL_TX_POWER_DEFAULT_SATURATION_24; - else - saturation_power = IL_TX_POWER_DEFAULT_SATURATION_52; - } - - /* regulatory txpower limits ... reg_limit values are in half-dBm, - * max_power_avg values are in dBm, convert * 2 */ - if (is_ht40) - reg_limit = ch_info->ht40_max_power_avg * 2; - else - reg_limit = ch_info->max_power_avg * 2; - - if ((reg_limit < IL_TX_POWER_REGULATORY_MIN) || - (reg_limit > IL_TX_POWER_REGULATORY_MAX)) { - if (band) - reg_limit = IL_TX_POWER_DEFAULT_REGULATORY_24; - else - reg_limit = IL_TX_POWER_DEFAULT_REGULATORY_52; - } - - /* Interpolate txpower calibration values for this channel, - * based on factory calibration tests on spaced channels. */ - il4965_interpolate_chan(il, channel, &ch_eeprom_info); - - /* calculate tx gain adjustment based on power supply voltage */ - voltage = le16_to_cpu(il->calib_info->voltage); - init_voltage = (s32) le32_to_cpu(il->card_alive_init.voltage); - voltage_compensation = - il4965_get_voltage_compensation(voltage, init_voltage); - - D_TXPOWER("curr volt %d eeprom volt %d volt comp %d\n", init_voltage, - voltage, voltage_compensation); - - /* get current temperature (Celsius) */ - current_temp = max(il->temperature, IL_TX_POWER_TEMPERATURE_MIN); - current_temp = min(il->temperature, IL_TX_POWER_TEMPERATURE_MAX); - current_temp = KELVIN_TO_CELSIUS(current_temp); - - /* select thermal txpower adjustment params, based on channel group - * (same frequency group used for mimo txatten adjustment) */ - degrees_per_05db_num = - tx_power_cmp_tble[txatten_grp].degrees_per_05db_a; - degrees_per_05db_denom = - tx_power_cmp_tble[txatten_grp].degrees_per_05db_a_denom; - - /* get per-chain txpower values from factory measurements */ - for (c = 0; c < 2; c++) { - measurement = &ch_eeprom_info.measurements[c][1]; - - /* txgain adjustment (in half-dB steps) based on difference - * between factory and current temperature */ - factory_temp = measurement->temperature; - il4965_math_div_round((current_temp - - factory_temp) * degrees_per_05db_denom, - degrees_per_05db_num, - &temperature_comp[c]); - - factory_gain_idx[c] = measurement->gain_idx; - factory_actual_pwr[c] = measurement->actual_pow; - - D_TXPOWER("chain = %d\n", c); - D_TXPOWER("fctry tmp %d, " "curr tmp %d, comp %d steps\n", - factory_temp, current_temp, temperature_comp[c]); - - D_TXPOWER("fctry idx %d, fctry pwr %d\n", factory_gain_idx[c], - factory_actual_pwr[c]); - } - - /* for each of 33 bit-rates (including 1 for CCK) */ - for (i = 0; i < POWER_TBL_NUM_ENTRIES; i++) { - u8 is_mimo_rate; - union il4965_tx_power_dual_stream tx_power; - - /* for mimo, reduce each chain's txpower by half - * (3dB, 6 steps), so total output power is regulatory - * compliant. */ - if (i & 0x8) { - current_regulatory = - reg_limit - - IL_TX_POWER_MIMO_REGULATORY_COMPENSATION; - is_mimo_rate = 1; - } else { - current_regulatory = reg_limit; - is_mimo_rate = 0; - } - - /* find txpower limit, either hardware or regulatory */ - power_limit = saturation_power - back_off_table[i]; - if (power_limit > current_regulatory) - power_limit = current_regulatory; - - /* reduce user's txpower request if necessary - * for this rate on this channel */ - target_power = user_target_power; - if (target_power > power_limit) - target_power = power_limit; - - D_TXPOWER("rate %d sat %d reg %d usr %d tgt %d\n", i, - saturation_power - back_off_table[i], - current_regulatory, user_target_power, target_power); - - /* for each of 2 Tx chains (radio transmitters) */ - for (c = 0; c < 2; c++) { - s32 atten_value; - - if (is_mimo_rate) - atten_value = - (s32) le32_to_cpu(il->card_alive_init. - tx_atten[txatten_grp][c]); - else - atten_value = 0; - - /* calculate idx; higher idx means lower txpower */ - power_idx = - (u8) (factory_gain_idx[c] - - (target_power - factory_actual_pwr[c]) - - temperature_comp[c] - voltage_compensation + - atten_value); - -/* D_TXPOWER("calculated txpower idx %d\n", - power_idx); */ - - if (power_idx < get_min_power_idx(i, band)) - power_idx = get_min_power_idx(i, band); - - /* adjust 5 GHz idx to support negative idxes */ - if (!band) - power_idx += 9; - - /* CCK, rate 32, reduce txpower for CCK */ - if (i == POWER_TBL_CCK_ENTRY) - power_idx += - IL_TX_POWER_CCK_COMPENSATION_C_STEP; - - /* stay within the table! */ - if (power_idx > 107) { - IL_WARN("txpower idx %d > 107\n", power_idx); - power_idx = 107; - } - if (power_idx < 0) { - IL_WARN("txpower idx %d < 0\n", power_idx); - power_idx = 0; - } - - /* fill txpower command for this rate/chain */ - tx_power.s.radio_tx_gain[c] = - gain_table[band][power_idx].radio; - tx_power.s.dsp_predis_atten[c] = - gain_table[band][power_idx].dsp; - - D_TXPOWER("chain %d mimo %d idx %d " - "gain 0x%02x dsp %d\n", c, atten_value, - power_idx, tx_power.s.radio_tx_gain[c], - tx_power.s.dsp_predis_atten[c]); - } /* for each chain */ - - tx_power_tbl->power_tbl[i].dw = cpu_to_le32(tx_power.dw); - - } /* for each rate */ - - return 0; -} - -/** - * il4965_send_tx_power - Configure the TXPOWER level user limit - * - * Uses the active RXON for channel, band, and characteristics (ht40, high) - * The power limit is taken from il->tx_power_user_lmt. - */ -static int -il4965_send_tx_power(struct il_priv *il) -{ - struct il4965_txpowertable_cmd cmd = { 0 }; - int ret; - u8 band = 0; - bool is_ht40 = false; - u8 ctrl_chan_high = 0; - - if (WARN_ONCE - (test_bit(S_SCAN_HW, &il->status), - "TX Power requested while scanning!\n")) - return -EAGAIN; - - band = il->band == IEEE80211_BAND_2GHZ; - - is_ht40 = iw4965_is_ht40_channel(il->active.flags); - - if (is_ht40 && (il->active.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK)) - ctrl_chan_high = 1; - - cmd.band = band; - cmd.channel = il->active.channel; - - ret = - il4965_fill_txpower_tbl(il, band, le16_to_cpu(il->active.channel), - is_ht40, ctrl_chan_high, &cmd.tx_power); - if (ret) - goto out; - - ret = il_send_cmd_pdu(il, C_TX_PWR_TBL, sizeof(cmd), &cmd); - -out: - return ret; -} - -static int -il4965_send_rxon_assoc(struct il_priv *il) -{ - int ret = 0; - struct il4965_rxon_assoc_cmd rxon_assoc; - const struct il_rxon_cmd *rxon1 = &il->staging; - const struct il_rxon_cmd *rxon2 = &il->active; - - if (rxon1->flags == rxon2->flags && - rxon1->filter_flags == rxon2->filter_flags && - rxon1->cck_basic_rates == rxon2->cck_basic_rates && - rxon1->ofdm_ht_single_stream_basic_rates == - rxon2->ofdm_ht_single_stream_basic_rates && - rxon1->ofdm_ht_dual_stream_basic_rates == - rxon2->ofdm_ht_dual_stream_basic_rates && - rxon1->rx_chain == rxon2->rx_chain && - rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates) { - D_INFO("Using current RXON_ASSOC. Not resending.\n"); - return 0; - } - - rxon_assoc.flags = il->staging.flags; - rxon_assoc.filter_flags = il->staging.filter_flags; - rxon_assoc.ofdm_basic_rates = il->staging.ofdm_basic_rates; - rxon_assoc.cck_basic_rates = il->staging.cck_basic_rates; - rxon_assoc.reserved = 0; - rxon_assoc.ofdm_ht_single_stream_basic_rates = - il->staging.ofdm_ht_single_stream_basic_rates; - rxon_assoc.ofdm_ht_dual_stream_basic_rates = - il->staging.ofdm_ht_dual_stream_basic_rates; - rxon_assoc.rx_chain_select_flags = il->staging.rx_chain; - - ret = - il_send_cmd_pdu_async(il, C_RXON_ASSOC, sizeof(rxon_assoc), - &rxon_assoc, NULL); - - return ret; -} - -static int -il4965_commit_rxon(struct il_priv *il) -{ - /* cast away the const for active_rxon in this function */ - struct il_rxon_cmd *active_rxon = (void *)&il->active; - int ret; - bool new_assoc = !!(il->staging.filter_flags & RXON_FILTER_ASSOC_MSK); - - if (!il_is_alive(il)) - return -EBUSY; - - /* always get timestamp with Rx frame */ - il->staging.flags |= RXON_FLG_TSF2HOST_MSK; - - ret = il_check_rxon_cmd(il); - if (ret) { - IL_ERR("Invalid RXON configuration. Not committing.\n"); - return -EINVAL; - } - - /* - * receive commit_rxon request - * abort any previous channel switch if still in process - */ - if (test_bit(S_CHANNEL_SWITCH_PENDING, &il->status) && - il->switch_channel != il->staging.channel) { - D_11H("abort channel switch on %d\n", - le16_to_cpu(il->switch_channel)); - il_chswitch_done(il, false); - } - - /* If we don't need to send a full RXON, we can use - * il_rxon_assoc_cmd which is used to reconfigure filter - * and other flags for the current radio configuration. */ - if (!il_full_rxon_required(il)) { - ret = il_send_rxon_assoc(il); - if (ret) { - IL_ERR("Error setting RXON_ASSOC (%d)\n", ret); - return ret; - } - - memcpy(active_rxon, &il->staging, sizeof(*active_rxon)); - il_print_rx_config_cmd(il); - /* - * We do not commit tx power settings while channel changing, - * do it now if tx power changed. - */ - il_set_tx_power(il, il->tx_power_next, false); - return 0; - } - - /* If we are currently associated and the new config requires - * an RXON_ASSOC and the new config wants the associated mask enabled, - * we must clear the associated from the active configuration - * before we apply the new config */ - if (il_is_associated(il) && new_assoc) { - D_INFO("Toggling associated bit on current RXON\n"); - active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; - - ret = - il_send_cmd_pdu(il, C_RXON, - sizeof(struct il_rxon_cmd), active_rxon); - - /* If the mask clearing failed then we set - * active_rxon back to what it was previously */ - if (ret) { - active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK; - IL_ERR("Error clearing ASSOC_MSK (%d)\n", ret); - return ret; - } - il_clear_ucode_stations(il); - il_restore_stations(il); - ret = il4965_restore_default_wep_keys(il); - if (ret) { - IL_ERR("Failed to restore WEP keys (%d)\n", ret); - return ret; - } - } - - D_INFO("Sending RXON\n" "* with%s RXON_FILTER_ASSOC_MSK\n" - "* channel = %d\n" "* bssid = %pM\n", (new_assoc ? "" : "out"), - le16_to_cpu(il->staging.channel), il->staging.bssid_addr); - - il_set_rxon_hwcrypto(il, !il->cfg->mod_params->sw_crypto); - - /* Apply the new configuration - * RXON unassoc clears the station table in uCode so restoration of - * stations is needed after it (the RXON command) completes - */ - if (!new_assoc) { - ret = - il_send_cmd_pdu(il, C_RXON, - sizeof(struct il_rxon_cmd), &il->staging); - if (ret) { - IL_ERR("Error setting new RXON (%d)\n", ret); - return ret; - } - D_INFO("Return from !new_assoc RXON.\n"); - memcpy(active_rxon, &il->staging, sizeof(*active_rxon)); - il_clear_ucode_stations(il); - il_restore_stations(il); - ret = il4965_restore_default_wep_keys(il); - if (ret) { - IL_ERR("Failed to restore WEP keys (%d)\n", ret); - return ret; - } - } - if (new_assoc) { - il->start_calib = 0; - /* Apply the new configuration - * RXON assoc doesn't clear the station table in uCode, - */ - ret = - il_send_cmd_pdu(il, C_RXON, - sizeof(struct il_rxon_cmd), &il->staging); - if (ret) { - IL_ERR("Error setting new RXON (%d)\n", ret); - return ret; - } - memcpy(active_rxon, &il->staging, sizeof(*active_rxon)); - } - il_print_rx_config_cmd(il); - - il4965_init_sensitivity(il); - - /* If we issue a new RXON command which required a tune then we must - * send a new TXPOWER command or we won't be able to Tx any frames */ - ret = il_set_tx_power(il, il->tx_power_next, true); - if (ret) { - IL_ERR("Error sending TX power (%d)\n", ret); - return ret; - } - - return 0; -} - -static int -il4965_hw_channel_switch(struct il_priv *il, - struct ieee80211_channel_switch *ch_switch) -{ - int rc; - u8 band = 0; - bool is_ht40 = false; - u8 ctrl_chan_high = 0; - struct il4965_channel_switch_cmd cmd; - const struct il_channel_info *ch_info; - u32 switch_time_in_usec, ucode_switch_time; - u16 ch; - u32 tsf_low; - u8 switch_count; - u16 beacon_interval = le16_to_cpu(il->timing.beacon_interval); - struct ieee80211_vif *vif = il->vif; - band = (il->band == IEEE80211_BAND_2GHZ); - - if (WARN_ON_ONCE(vif == NULL)) - return -EIO; - - is_ht40 = iw4965_is_ht40_channel(il->staging.flags); - - if (is_ht40 && (il->staging.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK)) - ctrl_chan_high = 1; - - cmd.band = band; - cmd.expect_beacon = 0; - ch = ch_switch->chandef.chan->hw_value; - cmd.channel = cpu_to_le16(ch); - cmd.rxon_flags = il->staging.flags; - cmd.rxon_filter_flags = il->staging.filter_flags; - switch_count = ch_switch->count; - tsf_low = ch_switch->timestamp & 0x0ffffffff; - /* - * calculate the ucode channel switch time - * adding TSF as one of the factor for when to switch - */ - if (il->ucode_beacon_time > tsf_low && beacon_interval) { - if (switch_count > - ((il->ucode_beacon_time - tsf_low) / beacon_interval)) { - switch_count -= - (il->ucode_beacon_time - tsf_low) / beacon_interval; - } else - switch_count = 0; - } - if (switch_count <= 1) - cmd.switch_time = cpu_to_le32(il->ucode_beacon_time); - else { - switch_time_in_usec = - vif->bss_conf.beacon_int * switch_count * TIME_UNIT; - ucode_switch_time = - il_usecs_to_beacons(il, switch_time_in_usec, - beacon_interval); - cmd.switch_time = - il_add_beacon_time(il, il->ucode_beacon_time, - ucode_switch_time, beacon_interval); - } - D_11H("uCode time for the switch is 0x%x\n", cmd.switch_time); - ch_info = il_get_channel_info(il, il->band, ch); - if (ch_info) - cmd.expect_beacon = il_is_channel_radar(ch_info); - else { - IL_ERR("invalid channel switch from %u to %u\n", - il->active.channel, ch); - return -EFAULT; - } - - rc = il4965_fill_txpower_tbl(il, band, ch, is_ht40, ctrl_chan_high, - &cmd.tx_power); - if (rc) { - D_11H("error:%d fill txpower_tbl\n", rc); - return rc; - } - - return il_send_cmd_pdu(il, C_CHANNEL_SWITCH, sizeof(cmd), &cmd); -} - -/** - * il4965_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array - */ -static void -il4965_txq_update_byte_cnt_tbl(struct il_priv *il, struct il_tx_queue *txq, - u16 byte_cnt) -{ - struct il4965_scd_bc_tbl *scd_bc_tbl = il->scd_bc_tbls.addr; - int txq_id = txq->q.id; - int write_ptr = txq->q.write_ptr; - int len = byte_cnt + IL_TX_CRC_SIZE + IL_TX_DELIMITER_SIZE; - __le16 bc_ent; - - WARN_ON(len > 0xFFF || write_ptr >= TFD_QUEUE_SIZE_MAX); - - bc_ent = cpu_to_le16(len & 0xFFF); - /* Set up byte count within first 256 entries */ - scd_bc_tbl[txq_id].tfd_offset[write_ptr] = bc_ent; - - /* If within first 64 entries, duplicate at end */ - if (write_ptr < TFD_QUEUE_SIZE_BC_DUP) - scd_bc_tbl[txq_id].tfd_offset[TFD_QUEUE_SIZE_MAX + write_ptr] = - bc_ent; -} - -/** - * il4965_hw_get_temperature - return the calibrated temperature (in Kelvin) - * @stats: Provides the temperature reading from the uCode - * - * A return of <0 indicates bogus data in the stats - */ -static int -il4965_hw_get_temperature(struct il_priv *il) -{ - s32 temperature; - s32 vt; - s32 R1, R2, R3; - u32 R4; - - if (test_bit(S_TEMPERATURE, &il->status) && - (il->_4965.stats.flag & STATS_REPLY_FLG_HT40_MODE_MSK)) { - D_TEMP("Running HT40 temperature calibration\n"); - R1 = (s32) le32_to_cpu(il->card_alive_init.therm_r1[1]); - R2 = (s32) le32_to_cpu(il->card_alive_init.therm_r2[1]); - R3 = (s32) le32_to_cpu(il->card_alive_init.therm_r3[1]); - R4 = le32_to_cpu(il->card_alive_init.therm_r4[1]); - } else { - D_TEMP("Running temperature calibration\n"); - R1 = (s32) le32_to_cpu(il->card_alive_init.therm_r1[0]); - R2 = (s32) le32_to_cpu(il->card_alive_init.therm_r2[0]); - R3 = (s32) le32_to_cpu(il->card_alive_init.therm_r3[0]); - R4 = le32_to_cpu(il->card_alive_init.therm_r4[0]); - } - - /* - * Temperature is only 23 bits, so sign extend out to 32. - * - * NOTE If we haven't received a stats notification yet - * with an updated temperature, use R4 provided to us in the - * "initialize" ALIVE response. - */ - if (!test_bit(S_TEMPERATURE, &il->status)) - vt = sign_extend32(R4, 23); - else - vt = sign_extend32(le32_to_cpu - (il->_4965.stats.general.common.temperature), - 23); - - D_TEMP("Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt); - - if (R3 == R1) { - IL_ERR("Calibration conflict R1 == R3\n"); - return -1; - } - - /* Calculate temperature in degrees Kelvin, adjust by 97%. - * Add offset to center the adjustment around 0 degrees Centigrade. */ - temperature = TEMPERATURE_CALIB_A_VAL * (vt - R2); - temperature /= (R3 - R1); - temperature = - (temperature * 97) / 100 + TEMPERATURE_CALIB_KELVIN_OFFSET; - - D_TEMP("Calibrated temperature: %dK, %dC\n", temperature, - KELVIN_TO_CELSIUS(temperature)); - - return temperature; -} - -/* Adjust Txpower only if temperature variance is greater than threshold. */ -#define IL_TEMPERATURE_THRESHOLD 3 - -/** - * il4965_is_temp_calib_needed - determines if new calibration is needed - * - * If the temperature changed has changed sufficiently, then a recalibration - * is needed. - * - * Assumes caller will replace il->last_temperature once calibration - * executed. - */ -static int -il4965_is_temp_calib_needed(struct il_priv *il) -{ - int temp_diff; - - if (!test_bit(S_STATS, &il->status)) { - D_TEMP("Temperature not updated -- no stats.\n"); - return 0; - } - - temp_diff = il->temperature - il->last_temperature; - - /* get absolute value */ - if (temp_diff < 0) { - D_POWER("Getting cooler, delta %d\n", temp_diff); - temp_diff = -temp_diff; - } else if (temp_diff == 0) - D_POWER("Temperature unchanged\n"); - else - D_POWER("Getting warmer, delta %d\n", temp_diff); - - if (temp_diff < IL_TEMPERATURE_THRESHOLD) { - D_POWER(" => thermal txpower calib not needed\n"); - return 0; - } - - D_POWER(" => thermal txpower calib needed\n"); - - return 1; -} - -void -il4965_temperature_calib(struct il_priv *il) -{ - s32 temp; - - temp = il4965_hw_get_temperature(il); - if (IL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(temp)) - return; - - if (il->temperature != temp) { - if (il->temperature) - D_TEMP("Temperature changed " "from %dC to %dC\n", - KELVIN_TO_CELSIUS(il->temperature), - KELVIN_TO_CELSIUS(temp)); - else - D_TEMP("Temperature " "initialized to %dC\n", - KELVIN_TO_CELSIUS(temp)); - } - - il->temperature = temp; - set_bit(S_TEMPERATURE, &il->status); - - if (!il->disable_tx_power_cal && - unlikely(!test_bit(S_SCANNING, &il->status)) && - il4965_is_temp_calib_needed(il)) - queue_work(il->workqueue, &il->txpower_work); -} - -static u16 -il4965_get_hcmd_size(u8 cmd_id, u16 len) -{ - switch (cmd_id) { - case C_RXON: - return (u16) sizeof(struct il4965_rxon_cmd); - default: - return len; - } -} - -static u16 -il4965_build_addsta_hcmd(const struct il_addsta_cmd *cmd, u8 * data) -{ - struct il4965_addsta_cmd *addsta = (struct il4965_addsta_cmd *)data; - addsta->mode = cmd->mode; - memcpy(&addsta->sta, &cmd->sta, sizeof(struct sta_id_modify)); - memcpy(&addsta->key, &cmd->key, sizeof(struct il4965_keyinfo)); - addsta->station_flags = cmd->station_flags; - addsta->station_flags_msk = cmd->station_flags_msk; - addsta->tid_disable_tx = cmd->tid_disable_tx; - addsta->add_immediate_ba_tid = cmd->add_immediate_ba_tid; - addsta->remove_immediate_ba_tid = cmd->remove_immediate_ba_tid; - addsta->add_immediate_ba_ssn = cmd->add_immediate_ba_ssn; - addsta->sleep_tx_count = cmd->sleep_tx_count; - addsta->reserved1 = cpu_to_le16(0); - addsta->reserved2 = cpu_to_le16(0); - - return (u16) sizeof(struct il4965_addsta_cmd); -} - -static void -il4965_post_scan(struct il_priv *il) -{ - /* - * Since setting the RXON may have been deferred while - * performing the scan, fire one off if needed - */ - if (memcmp(&il->staging, &il->active, sizeof(il->staging))) - il_commit_rxon(il); -} - -static void -il4965_post_associate(struct il_priv *il) -{ - struct ieee80211_vif *vif = il->vif; - int ret = 0; - - if (!vif || !il->is_open) - return; - - if (test_bit(S_EXIT_PENDING, &il->status)) - return; - - il_scan_cancel_timeout(il, 200); - - il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - il_commit_rxon(il); - - ret = il_send_rxon_timing(il); - if (ret) - IL_WARN("RXON timing - " "Attempting to continue.\n"); - - il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - - il_set_rxon_ht(il, &il->current_ht_config); - - if (il->ops->set_rxon_chain) - il->ops->set_rxon_chain(il); - - il->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid); - - D_ASSOC("assoc id %d beacon interval %d\n", vif->bss_conf.aid, - vif->bss_conf.beacon_int); - - if (vif->bss_conf.use_short_preamble) - il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; - else - il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; - - if (il->staging.flags & RXON_FLG_BAND_24G_MSK) { - if (vif->bss_conf.use_short_slot) - il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; - else - il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; - } - - il_commit_rxon(il); - - D_ASSOC("Associated as %d to: %pM\n", vif->bss_conf.aid, - il->active.bssid_addr); - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - break; - case NL80211_IFTYPE_ADHOC: - il4965_send_beacon_cmd(il); - break; - default: - IL_ERR("%s Should not be called in %d mode\n", __func__, - vif->type); - break; - } - - /* the chain noise calibration will enabled PM upon completion - * If chain noise has already been run, then we need to enable - * power management here */ - if (il->chain_noise_data.state == IL_CHAIN_NOISE_DONE) - il_power_update_mode(il, false); - - /* Enable Rx differential gain and sensitivity calibrations */ - il4965_chain_noise_reset(il); - il->start_calib = 1; -} - -static void -il4965_config_ap(struct il_priv *il) -{ - struct ieee80211_vif *vif = il->vif; - int ret = 0; - - lockdep_assert_held(&il->mutex); - - if (test_bit(S_EXIT_PENDING, &il->status)) - return; - - /* The following should be done only at AP bring up */ - if (!il_is_associated(il)) { - - /* RXON - unassoc (to set timing command) */ - il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - il_commit_rxon(il); - - /* RXON Timing */ - ret = il_send_rxon_timing(il); - if (ret) - IL_WARN("RXON timing failed - " - "Attempting to continue.\n"); - - /* AP has all antennas */ - il->chain_noise_data.active_chains = il->hw_params.valid_rx_ant; - il_set_rxon_ht(il, &il->current_ht_config); - if (il->ops->set_rxon_chain) - il->ops->set_rxon_chain(il); - - il->staging.assoc_id = 0; - - if (vif->bss_conf.use_short_preamble) - il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; - else - il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; - - if (il->staging.flags & RXON_FLG_BAND_24G_MSK) { - if (vif->bss_conf.use_short_slot) - il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; - else - il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; - } - /* need to send beacon cmd before committing assoc RXON! */ - il4965_send_beacon_cmd(il); - /* restore RXON assoc */ - il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - il_commit_rxon(il); - } - il4965_send_beacon_cmd(il); -} - -const struct il_ops il4965_ops = { - .txq_update_byte_cnt_tbl = il4965_txq_update_byte_cnt_tbl, - .txq_attach_buf_to_tfd = il4965_hw_txq_attach_buf_to_tfd, - .txq_free_tfd = il4965_hw_txq_free_tfd, - .txq_init = il4965_hw_tx_queue_init, - .is_valid_rtc_data_addr = il4965_hw_valid_rtc_data_addr, - .init_alive_start = il4965_init_alive_start, - .load_ucode = il4965_load_bsm, - .dump_nic_error_log = il4965_dump_nic_error_log, - .dump_fh = il4965_dump_fh, - .set_channel_switch = il4965_hw_channel_switch, - .apm_init = il_apm_init, - .send_tx_power = il4965_send_tx_power, - .update_chain_flags = il4965_update_chain_flags, - .eeprom_acquire_semaphore = il4965_eeprom_acquire_semaphore, - .eeprom_release_semaphore = il4965_eeprom_release_semaphore, - - .rxon_assoc = il4965_send_rxon_assoc, - .commit_rxon = il4965_commit_rxon, - .set_rxon_chain = il4965_set_rxon_chain, - - .get_hcmd_size = il4965_get_hcmd_size, - .build_addsta_hcmd = il4965_build_addsta_hcmd, - .request_scan = il4965_request_scan, - .post_scan = il4965_post_scan, - - .post_associate = il4965_post_associate, - .config_ap = il4965_config_ap, - .manage_ibss_station = il4965_manage_ibss_station, - .update_bcast_stations = il4965_update_bcast_stations, - - .send_led_cmd = il4965_send_led_cmd, -}; - -struct il_cfg il4965_cfg = { - .name = "Intel(R) Wireless WiFi Link 4965AGN", - .fw_name_pre = IL4965_FW_PRE, - .ucode_api_max = IL4965_UCODE_API_MAX, - .ucode_api_min = IL4965_UCODE_API_MIN, - .sku = IL_SKU_A | IL_SKU_G | IL_SKU_N, - .valid_tx_ant = ANT_AB, - .valid_rx_ant = ANT_ABC, - .eeprom_ver = EEPROM_4965_EEPROM_VERSION, - .eeprom_calib_ver = EEPROM_4965_TX_POWER_VERSION, - .mod_params = &il4965_mod_params, - .led_mode = IL_LED_BLINK, - /* - * Force use of chains B and C for scan RX on 5 GHz band - * because the device has off-channel reception on chain A. - */ - .scan_rx_antennas[IEEE80211_BAND_5GHZ] = ANT_BC, - - .eeprom_size = IL4965_EEPROM_IMG_SIZE, - .num_of_queues = IL49_NUM_QUEUES, - .num_of_ampdu_queues = IL49_NUM_AMPDU_QUEUES, - .pll_cfg_val = 0, - .set_l0s = true, - .use_bsm = true, - .led_compensation = 61, - .chain_noise_num_beacons = IL4965_CAL_NUM_BEACONS, - .wd_timeout = IL_DEF_WD_TIMEOUT, - .temperature_kelvin = true, - .ucode_tracing = true, - .sensitivity_calib_by_driver = true, - .chain_noise_calib_by_driver = true, - - .regulatory_bands = { - EEPROM_REGULATORY_BAND_1_CHANNELS, - EEPROM_REGULATORY_BAND_2_CHANNELS, - EEPROM_REGULATORY_BAND_3_CHANNELS, - EEPROM_REGULATORY_BAND_4_CHANNELS, - EEPROM_REGULATORY_BAND_5_CHANNELS, - EEPROM_4965_REGULATORY_BAND_24_HT40_CHANNELS, - EEPROM_4965_REGULATORY_BAND_52_HT40_CHANNELS - }, - -}; - -/* Module firmware */ -MODULE_FIRMWARE(IL4965_MODULE_FIRMWARE(IL4965_UCODE_API_MAX)); diff --git a/drivers/net/wireless/iwlegacy/4965.h b/drivers/net/wireless/iwlegacy/4965.h deleted file mode 100644 index 1b15b0b2292b..000000000000 --- a/drivers/net/wireless/iwlegacy/4965.h +++ /dev/null @@ -1,1284 +0,0 @@ -/****************************************************************************** - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called LICENSE.GPL. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#ifndef __il_4965_h__ -#define __il_4965_h__ - -struct il_rx_queue; -struct il_rx_buf; -struct il_rx_pkt; -struct il_tx_queue; -struct il_rxon_context; - -/* configuration for the _4965 devices */ -extern struct il_cfg il4965_cfg; -extern const struct il_ops il4965_ops; - -extern struct il_mod_params il4965_mod_params; - -/* tx queue */ -void il4965_free_tfds_in_queue(struct il_priv *il, int sta_id, int tid, - int freed); - -/* RXON */ -void il4965_set_rxon_chain(struct il_priv *il); - -/* uCode */ -int il4965_verify_ucode(struct il_priv *il); - -/* lib */ -void il4965_check_abort_status(struct il_priv *il, u8 frame_count, u32 status); - -void il4965_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq); -int il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq); -int il4965_hw_nic_init(struct il_priv *il); -int il4965_dump_fh(struct il_priv *il, char **buf, bool display); - -void il4965_nic_config(struct il_priv *il); - -/* rx */ -void il4965_rx_queue_restock(struct il_priv *il); -void il4965_rx_replenish(struct il_priv *il); -void il4965_rx_replenish_now(struct il_priv *il); -void il4965_rx_queue_free(struct il_priv *il, struct il_rx_queue *rxq); -int il4965_rxq_stop(struct il_priv *il); -int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band); -void il4965_rx_handle(struct il_priv *il); - -/* tx */ -void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq); -int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *il, struct il_tx_queue *txq, - dma_addr_t addr, u16 len, u8 reset, u8 pad); -int il4965_hw_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq); -void il4965_hwrate_to_tx_control(struct il_priv *il, u32 rate_n_flags, - struct ieee80211_tx_info *info); -int il4965_tx_skb(struct il_priv *il, - struct ieee80211_sta *sta, - struct sk_buff *skb); -int il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid, u16 * ssn); -int il4965_tx_agg_stop(struct il_priv *il, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid); -int il4965_txq_check_empty(struct il_priv *il, int sta_id, u8 tid, int txq_id); -int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int idx); -void il4965_hw_txq_ctx_free(struct il_priv *il); -int il4965_txq_ctx_alloc(struct il_priv *il); -void il4965_txq_ctx_reset(struct il_priv *il); -void il4965_txq_ctx_stop(struct il_priv *il); -void il4965_txq_set_sched(struct il_priv *il, u32 mask); - -/* - * Acquire il->lock before calling this function ! - */ -void il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 idx); -/** - * il4965_tx_queue_set_status - (optionally) start Tx/Cmd queue - * @tx_fifo_id: Tx DMA/FIFO channel (range 0-7) that the queue will feed - * @scd_retry: (1) Indicates queue will be used in aggregation mode - * - * NOTE: Acquire il->lock before calling this function ! - */ -void il4965_tx_queue_set_status(struct il_priv *il, struct il_tx_queue *txq, - int tx_fifo_id, int scd_retry); - -/* scan */ -int il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif); - -/* station mgmt */ -int il4965_manage_ibss_station(struct il_priv *il, struct ieee80211_vif *vif, - bool add); - -/* hcmd */ -int il4965_send_beacon_cmd(struct il_priv *il); - -#ifdef CONFIG_IWLEGACY_DEBUG -const char *il4965_get_tx_fail_reason(u32 status); -#else -static inline const char * -il4965_get_tx_fail_reason(u32 status) -{ - return ""; -} -#endif - -/* station management */ -int il4965_alloc_bcast_station(struct il_priv *il); -int il4965_add_bssid_station(struct il_priv *il, const u8 *addr, u8 *sta_id_r); -int il4965_remove_default_wep_key(struct il_priv *il, - struct ieee80211_key_conf *key); -int il4965_set_default_wep_key(struct il_priv *il, - struct ieee80211_key_conf *key); -int il4965_restore_default_wep_keys(struct il_priv *il); -int il4965_set_dynamic_key(struct il_priv *il, - struct ieee80211_key_conf *key, u8 sta_id); -int il4965_remove_dynamic_key(struct il_priv *il, - struct ieee80211_key_conf *key, u8 sta_id); -void il4965_update_tkip_key(struct il_priv *il, - struct ieee80211_key_conf *keyconf, - struct ieee80211_sta *sta, u32 iv32, - u16 *phase1key); -int il4965_sta_tx_modify_enable_tid(struct il_priv *il, int sta_id, int tid); -int il4965_sta_rx_agg_start(struct il_priv *il, struct ieee80211_sta *sta, - int tid, u16 ssn); -int il4965_sta_rx_agg_stop(struct il_priv *il, struct ieee80211_sta *sta, - int tid); -void il4965_sta_modify_sleep_tx_count(struct il_priv *il, int sta_id, int cnt); -int il4965_update_bcast_stations(struct il_priv *il); - -/* rate */ -static inline u8 -il4965_hw_get_rate(__le32 rate_n_flags) -{ - return le32_to_cpu(rate_n_flags) & 0xFF; -} - -/* eeprom */ -void il4965_eeprom_get_mac(const struct il_priv *il, u8 * mac); -int il4965_eeprom_acquire_semaphore(struct il_priv *il); -void il4965_eeprom_release_semaphore(struct il_priv *il); -int il4965_eeprom_check_version(struct il_priv *il); - -/* mac80211 handlers (for 4965) */ -void il4965_mac_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb); -int il4965_mac_start(struct ieee80211_hw *hw); -void il4965_mac_stop(struct ieee80211_hw *hw); -void il4965_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *total_flags, u64 multicast); -int il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key); -void il4965_mac_update_tkip_key(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_key_conf *keyconf, - struct ieee80211_sta *sta, u32 iv32, - u16 *phase1key); -int il4965_mac_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, u16 tid, u16 * ssn, - u8 buf_size); -int il4965_mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); -void il4965_mac_channel_switch(struct ieee80211_hw *hw, - struct ieee80211_channel_switch *ch_switch); - -void il4965_led_enable(struct il_priv *il); - -/* EEPROM */ -#define IL4965_EEPROM_IMG_SIZE 1024 - -/* - * uCode queue management definitions ... - * The first queue used for block-ack aggregation is #7 (4965 only). - * All block-ack aggregation queues should map to Tx DMA/FIFO channel 7. - */ -#define IL49_FIRST_AMPDU_QUEUE 7 - -/* Sizes and addresses for instruction and data memory (SRAM) in - * 4965's embedded processor. Driver access is via HBUS_TARG_MEM_* regs. */ -#define IL49_RTC_INST_LOWER_BOUND (0x000000) -#define IL49_RTC_INST_UPPER_BOUND (0x018000) - -#define IL49_RTC_DATA_LOWER_BOUND (0x800000) -#define IL49_RTC_DATA_UPPER_BOUND (0x80A000) - -#define IL49_RTC_INST_SIZE (IL49_RTC_INST_UPPER_BOUND - \ - IL49_RTC_INST_LOWER_BOUND) -#define IL49_RTC_DATA_SIZE (IL49_RTC_DATA_UPPER_BOUND - \ - IL49_RTC_DATA_LOWER_BOUND) - -#define IL49_MAX_INST_SIZE IL49_RTC_INST_SIZE -#define IL49_MAX_DATA_SIZE IL49_RTC_DATA_SIZE - -/* Size of uCode instruction memory in bootstrap state machine */ -#define IL49_MAX_BSM_SIZE BSM_SRAM_SIZE - -static inline int -il4965_hw_valid_rtc_data_addr(u32 addr) -{ - return (addr >= IL49_RTC_DATA_LOWER_BOUND && - addr < IL49_RTC_DATA_UPPER_BOUND); -} - -/********************* START TEMPERATURE *************************************/ - -/** - * 4965 temperature calculation. - * - * The driver must calculate the device temperature before calculating - * a txpower setting (amplifier gain is temperature dependent). The - * calculation uses 4 measurements, 3 of which (R1, R2, R3) are calibration - * values used for the life of the driver, and one of which (R4) is the - * real-time temperature indicator. - * - * uCode provides all 4 values to the driver via the "initialize alive" - * notification (see struct il4965_init_alive_resp). After the runtime uCode - * image loads, uCode updates the R4 value via stats notifications - * (see N_STATS), which occur after each received beacon - * when associated, or can be requested via C_STATS. - * - * NOTE: uCode provides the R4 value as a 23-bit signed value. Driver - * must sign-extend to 32 bits before applying formula below. - * - * Formula: - * - * degrees Kelvin = ((97 * 259 * (R4 - R2) / (R3 - R1)) / 100) + 8 - * - * NOTE: The basic formula is 259 * (R4-R2) / (R3-R1). The 97/100 is - * an additional correction, which should be centered around 0 degrees - * Celsius (273 degrees Kelvin). The 8 (3 percent of 273) compensates for - * centering the 97/100 correction around 0 degrees K. - * - * Add 273 to Kelvin value to find degrees Celsius, for comparing current - * temperature with factory-measured temperatures when calculating txpower - * settings. - */ -#define TEMPERATURE_CALIB_KELVIN_OFFSET 8 -#define TEMPERATURE_CALIB_A_VAL 259 - -/* Limit range of calculated temperature to be between these Kelvin values */ -#define IL_TX_POWER_TEMPERATURE_MIN (263) -#define IL_TX_POWER_TEMPERATURE_MAX (410) - -#define IL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(t) \ - ((t) < IL_TX_POWER_TEMPERATURE_MIN || \ - (t) > IL_TX_POWER_TEMPERATURE_MAX) - -extern void il4965_temperature_calib(struct il_priv *il); -/********************* END TEMPERATURE ***************************************/ - -/********************* START TXPOWER *****************************************/ - -/** - * 4965 txpower calculations rely on information from three sources: - * - * 1) EEPROM - * 2) "initialize" alive notification - * 3) stats notifications - * - * EEPROM data consists of: - * - * 1) Regulatory information (max txpower and channel usage flags) is provided - * separately for each channel that can possibly supported by 4965. - * 40 MHz wide (.11n HT40) channels are listed separately from 20 MHz - * (legacy) channels. - * - * See struct il4965_eeprom_channel for format, and struct il4965_eeprom - * for locations in EEPROM. - * - * 2) Factory txpower calibration information is provided separately for - * sub-bands of contiguous channels. 2.4GHz has just one sub-band, - * but 5 GHz has several sub-bands. - * - * In addition, per-band (2.4 and 5 Ghz) saturation txpowers are provided. - * - * See struct il4965_eeprom_calib_info (and the tree of structures - * contained within it) for format, and struct il4965_eeprom for - * locations in EEPROM. - * - * "Initialization alive" notification (see struct il4965_init_alive_resp) - * consists of: - * - * 1) Temperature calculation parameters. - * - * 2) Power supply voltage measurement. - * - * 3) Tx gain compensation to balance 2 transmitters for MIMO use. - * - * Statistics notifications deliver: - * - * 1) Current values for temperature param R4. - */ - -/** - * To calculate a txpower setting for a given desired target txpower, channel, - * modulation bit rate, and transmitter chain (4965 has 2 transmitters to - * support MIMO and transmit diversity), driver must do the following: - * - * 1) Compare desired txpower vs. (EEPROM) regulatory limit for this channel. - * Do not exceed regulatory limit; reduce target txpower if necessary. - * - * If setting up txpowers for MIMO rates (rate idxes 8-15, 24-31), - * 2 transmitters will be used simultaneously; driver must reduce the - * regulatory limit by 3 dB (half-power) for each transmitter, so the - * combined total output of the 2 transmitters is within regulatory limits. - * - * - * 2) Compare target txpower vs. (EEPROM) saturation txpower *reduced by - * backoff for this bit rate*. Do not exceed (saturation - backoff[rate]); - * reduce target txpower if necessary. - * - * Backoff values below are in 1/2 dB units (equivalent to steps in - * txpower gain tables): - * - * OFDM 6 - 36 MBit: 10 steps (5 dB) - * OFDM 48 MBit: 15 steps (7.5 dB) - * OFDM 54 MBit: 17 steps (8.5 dB) - * OFDM 60 MBit: 20 steps (10 dB) - * CCK all rates: 10 steps (5 dB) - * - * Backoff values apply to saturation txpower on a per-transmitter basis; - * when using MIMO (2 transmitters), each transmitter uses the same - * saturation level provided in EEPROM, and the same backoff values; - * no reduction (such as with regulatory txpower limits) is required. - * - * Saturation and Backoff values apply equally to 20 Mhz (legacy) channel - * widths and 40 Mhz (.11n HT40) channel widths; there is no separate - * factory measurement for ht40 channels. - * - * The result of this step is the final target txpower. The rest of - * the steps figure out the proper settings for the device to achieve - * that target txpower. - * - * - * 3) Determine (EEPROM) calibration sub band for the target channel, by - * comparing against first and last channels in each sub band - * (see struct il4965_eeprom_calib_subband_info). - * - * - * 4) Linearly interpolate (EEPROM) factory calibration measurement sets, - * referencing the 2 factory-measured (sample) channels within the sub band. - * - * Interpolation is based on difference between target channel's frequency - * and the sample channels' frequencies. Since channel numbers are based - * on frequency (5 MHz between each channel number), this is equivalent - * to interpolating based on channel number differences. - * - * Note that the sample channels may or may not be the channels at the - * edges of the sub band. The target channel may be "outside" of the - * span of the sampled channels. - * - * Driver may choose the pair (for 2 Tx chains) of measurements (see - * struct il4965_eeprom_calib_ch_info) for which the actual measured - * txpower comes closest to the desired txpower. Usually, though, - * the middle set of measurements is closest to the regulatory limits, - * and is therefore a good choice for all txpower calculations (this - * assumes that high accuracy is needed for maximizing legal txpower, - * while lower txpower configurations do not need as much accuracy). - * - * Driver should interpolate both members of the chosen measurement pair, - * i.e. for both Tx chains (radio transmitters), unless the driver knows - * that only one of the chains will be used (e.g. only one tx antenna - * connected, but this should be unusual). The rate scaling algorithm - * switches antennas to find best performance, so both Tx chains will - * be used (although only one at a time) even for non-MIMO transmissions. - * - * Driver should interpolate factory values for temperature, gain table - * idx, and actual power. The power amplifier detector values are - * not used by the driver. - * - * Sanity check: If the target channel happens to be one of the sample - * channels, the results should agree with the sample channel's - * measurements! - * - * - * 5) Find difference between desired txpower and (interpolated) - * factory-measured txpower. Using (interpolated) factory gain table idx - * (shown elsewhere) as a starting point, adjust this idx lower to - * increase txpower, or higher to decrease txpower, until the target - * txpower is reached. Each step in the gain table is 1/2 dB. - * - * For example, if factory measured txpower is 16 dBm, and target txpower - * is 13 dBm, add 6 steps to the factory gain idx to reduce txpower - * by 3 dB. - * - * - * 6) Find difference between current device temperature and (interpolated) - * factory-measured temperature for sub-band. Factory values are in - * degrees Celsius. To calculate current temperature, see comments for - * "4965 temperature calculation". - * - * If current temperature is higher than factory temperature, driver must - * increase gain (lower gain table idx), and vice verse. - * - * Temperature affects gain differently for different channels: - * - * 2.4 GHz all channels: 3.5 degrees per half-dB step - * 5 GHz channels 34-43: 4.5 degrees per half-dB step - * 5 GHz channels >= 44: 4.0 degrees per half-dB step - * - * NOTE: Temperature can increase rapidly when transmitting, especially - * with heavy traffic at high txpowers. Driver should update - * temperature calculations often under these conditions to - * maintain strong txpower in the face of rising temperature. - * - * - * 7) Find difference between current power supply voltage indicator - * (from "initialize alive") and factory-measured power supply voltage - * indicator (EEPROM). - * - * If the current voltage is higher (indicator is lower) than factory - * voltage, gain should be reduced (gain table idx increased) by: - * - * (eeprom - current) / 7 - * - * If the current voltage is lower (indicator is higher) than factory - * voltage, gain should be increased (gain table idx decreased) by: - * - * 2 * (current - eeprom) / 7 - * - * If number of idx steps in either direction turns out to be > 2, - * something is wrong ... just use 0. - * - * NOTE: Voltage compensation is independent of band/channel. - * - * NOTE: "Initialize" uCode measures current voltage, which is assumed - * to be constant after this initial measurement. Voltage - * compensation for txpower (number of steps in gain table) - * may be calculated once and used until the next uCode bootload. - * - * - * 8) If setting up txpowers for MIMO rates (rate idxes 8-15, 24-31), - * adjust txpower for each transmitter chain, so txpower is balanced - * between the two chains. There are 5 pairs of tx_atten[group][chain] - * values in "initialize alive", one pair for each of 5 channel ranges: - * - * Group 0: 5 GHz channel 34-43 - * Group 1: 5 GHz channel 44-70 - * Group 2: 5 GHz channel 71-124 - * Group 3: 5 GHz channel 125-200 - * Group 4: 2.4 GHz all channels - * - * Add the tx_atten[group][chain] value to the idx for the target chain. - * The values are signed, but are in pairs of 0 and a non-negative number, - * so as to reduce gain (if necessary) of the "hotter" channel. This - * avoids any need to double-check for regulatory compliance after - * this step. - * - * - * 9) If setting up for a CCK rate, lower the gain by adding a CCK compensation - * value to the idx: - * - * Hardware rev B: 9 steps (4.5 dB) - * Hardware rev C: 5 steps (2.5 dB) - * - * Hardware rev for 4965 can be determined by reading CSR_HW_REV_WA_REG, - * bits [3:2], 1 = B, 2 = C. - * - * NOTE: This compensation is in addition to any saturation backoff that - * might have been applied in an earlier step. - * - * - * 10) Select the gain table, based on band (2.4 vs 5 GHz). - * - * Limit the adjusted idx to stay within the table! - * - * - * 11) Read gain table entries for DSP and radio gain, place into appropriate - * location(s) in command (struct il4965_txpowertable_cmd). - */ - -/** - * When MIMO is used (2 transmitters operating simultaneously), driver should - * limit each transmitter to deliver a max of 3 dB below the regulatory limit - * for the device. That is, use half power for each transmitter, so total - * txpower is within regulatory limits. - * - * The value "6" represents number of steps in gain table to reduce power 3 dB. - * Each step is 1/2 dB. - */ -#define IL_TX_POWER_MIMO_REGULATORY_COMPENSATION (6) - -/** - * CCK gain compensation. - * - * When calculating txpowers for CCK, after making sure that the target power - * is within regulatory and saturation limits, driver must additionally - * back off gain by adding these values to the gain table idx. - * - * Hardware rev for 4965 can be determined by reading CSR_HW_REV_WA_REG, - * bits [3:2], 1 = B, 2 = C. - */ -#define IL_TX_POWER_CCK_COMPENSATION_B_STEP (9) -#define IL_TX_POWER_CCK_COMPENSATION_C_STEP (5) - -/* - * 4965 power supply voltage compensation for txpower - */ -#define TX_POWER_IL_VOLTAGE_CODES_PER_03V (7) - -/** - * Gain tables. - * - * The following tables contain pair of values for setting txpower, i.e. - * gain settings for the output of the device's digital signal processor (DSP), - * and for the analog gain structure of the transmitter. - * - * Each entry in the gain tables represents a step of 1/2 dB. Note that these - * are *relative* steps, not indications of absolute output power. Output - * power varies with temperature, voltage, and channel frequency, and also - * requires consideration of average power (to satisfy regulatory constraints), - * and peak power (to avoid distortion of the output signal). - * - * Each entry contains two values: - * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained - * linear value that multiplies the output of the digital signal processor, - * before being sent to the analog radio. - * 2) Radio gain. This sets the analog gain of the radio Tx path. - * It is a coarser setting, and behaves in a logarithmic (dB) fashion. - * - * EEPROM contains factory calibration data for txpower. This maps actual - * measured txpower levels to gain settings in the "well known" tables - * below ("well-known" means here that both factory calibration *and* the - * driver work with the same table). - * - * There are separate tables for 2.4 GHz and 5 GHz bands. The 5 GHz table - * has an extension (into negative idxes), in case the driver needs to - * boost power setting for high device temperatures (higher than would be - * present during factory calibration). A 5 Ghz EEPROM idx of "40" - * corresponds to the 49th entry in the table used by the driver. - */ -#define MIN_TX_GAIN_IDX (0) /* highest gain, lowest idx, 2.4 */ -#define MIN_TX_GAIN_IDX_52GHZ_EXT (-9) /* highest gain, lowest idx, 5 */ - -/** - * 2.4 GHz gain table - * - * Index Dsp gain Radio gain - * 0 110 0x3f (highest gain) - * 1 104 0x3f - * 2 98 0x3f - * 3 110 0x3e - * 4 104 0x3e - * 5 98 0x3e - * 6 110 0x3d - * 7 104 0x3d - * 8 98 0x3d - * 9 110 0x3c - * 10 104 0x3c - * 11 98 0x3c - * 12 110 0x3b - * 13 104 0x3b - * 14 98 0x3b - * 15 110 0x3a - * 16 104 0x3a - * 17 98 0x3a - * 18 110 0x39 - * 19 104 0x39 - * 20 98 0x39 - * 21 110 0x38 - * 22 104 0x38 - * 23 98 0x38 - * 24 110 0x37 - * 25 104 0x37 - * 26 98 0x37 - * 27 110 0x36 - * 28 104 0x36 - * 29 98 0x36 - * 30 110 0x35 - * 31 104 0x35 - * 32 98 0x35 - * 33 110 0x34 - * 34 104 0x34 - * 35 98 0x34 - * 36 110 0x33 - * 37 104 0x33 - * 38 98 0x33 - * 39 110 0x32 - * 40 104 0x32 - * 41 98 0x32 - * 42 110 0x31 - * 43 104 0x31 - * 44 98 0x31 - * 45 110 0x30 - * 46 104 0x30 - * 47 98 0x30 - * 48 110 0x6 - * 49 104 0x6 - * 50 98 0x6 - * 51 110 0x5 - * 52 104 0x5 - * 53 98 0x5 - * 54 110 0x4 - * 55 104 0x4 - * 56 98 0x4 - * 57 110 0x3 - * 58 104 0x3 - * 59 98 0x3 - * 60 110 0x2 - * 61 104 0x2 - * 62 98 0x2 - * 63 110 0x1 - * 64 104 0x1 - * 65 98 0x1 - * 66 110 0x0 - * 67 104 0x0 - * 68 98 0x0 - * 69 97 0 - * 70 96 0 - * 71 95 0 - * 72 94 0 - * 73 93 0 - * 74 92 0 - * 75 91 0 - * 76 90 0 - * 77 89 0 - * 78 88 0 - * 79 87 0 - * 80 86 0 - * 81 85 0 - * 82 84 0 - * 83 83 0 - * 84 82 0 - * 85 81 0 - * 86 80 0 - * 87 79 0 - * 88 78 0 - * 89 77 0 - * 90 76 0 - * 91 75 0 - * 92 74 0 - * 93 73 0 - * 94 72 0 - * 95 71 0 - * 96 70 0 - * 97 69 0 - * 98 68 0 - */ - -/** - * 5 GHz gain table - * - * Index Dsp gain Radio gain - * -9 123 0x3F (highest gain) - * -8 117 0x3F - * -7 110 0x3F - * -6 104 0x3F - * -5 98 0x3F - * -4 110 0x3E - * -3 104 0x3E - * -2 98 0x3E - * -1 110 0x3D - * 0 104 0x3D - * 1 98 0x3D - * 2 110 0x3C - * 3 104 0x3C - * 4 98 0x3C - * 5 110 0x3B - * 6 104 0x3B - * 7 98 0x3B - * 8 110 0x3A - * 9 104 0x3A - * 10 98 0x3A - * 11 110 0x39 - * 12 104 0x39 - * 13 98 0x39 - * 14 110 0x38 - * 15 104 0x38 - * 16 98 0x38 - * 17 110 0x37 - * 18 104 0x37 - * 19 98 0x37 - * 20 110 0x36 - * 21 104 0x36 - * 22 98 0x36 - * 23 110 0x35 - * 24 104 0x35 - * 25 98 0x35 - * 26 110 0x34 - * 27 104 0x34 - * 28 98 0x34 - * 29 110 0x33 - * 30 104 0x33 - * 31 98 0x33 - * 32 110 0x32 - * 33 104 0x32 - * 34 98 0x32 - * 35 110 0x31 - * 36 104 0x31 - * 37 98 0x31 - * 38 110 0x30 - * 39 104 0x30 - * 40 98 0x30 - * 41 110 0x25 - * 42 104 0x25 - * 43 98 0x25 - * 44 110 0x24 - * 45 104 0x24 - * 46 98 0x24 - * 47 110 0x23 - * 48 104 0x23 - * 49 98 0x23 - * 50 110 0x22 - * 51 104 0x18 - * 52 98 0x18 - * 53 110 0x17 - * 54 104 0x17 - * 55 98 0x17 - * 56 110 0x16 - * 57 104 0x16 - * 58 98 0x16 - * 59 110 0x15 - * 60 104 0x15 - * 61 98 0x15 - * 62 110 0x14 - * 63 104 0x14 - * 64 98 0x14 - * 65 110 0x13 - * 66 104 0x13 - * 67 98 0x13 - * 68 110 0x12 - * 69 104 0x08 - * 70 98 0x08 - * 71 110 0x07 - * 72 104 0x07 - * 73 98 0x07 - * 74 110 0x06 - * 75 104 0x06 - * 76 98 0x06 - * 77 110 0x05 - * 78 104 0x05 - * 79 98 0x05 - * 80 110 0x04 - * 81 104 0x04 - * 82 98 0x04 - * 83 110 0x03 - * 84 104 0x03 - * 85 98 0x03 - * 86 110 0x02 - * 87 104 0x02 - * 88 98 0x02 - * 89 110 0x01 - * 90 104 0x01 - * 91 98 0x01 - * 92 110 0x00 - * 93 104 0x00 - * 94 98 0x00 - * 95 93 0x00 - * 96 88 0x00 - * 97 83 0x00 - * 98 78 0x00 - */ - -/** - * Sanity checks and default values for EEPROM regulatory levels. - * If EEPROM values fall outside MIN/MAX range, use default values. - * - * Regulatory limits refer to the maximum average txpower allowed by - * regulatory agencies in the geographies in which the device is meant - * to be operated. These limits are SKU-specific (i.e. geography-specific), - * and channel-specific; each channel has an individual regulatory limit - * listed in the EEPROM. - * - * Units are in half-dBm (i.e. "34" means 17 dBm). - */ -#define IL_TX_POWER_DEFAULT_REGULATORY_24 (34) -#define IL_TX_POWER_DEFAULT_REGULATORY_52 (34) -#define IL_TX_POWER_REGULATORY_MIN (0) -#define IL_TX_POWER_REGULATORY_MAX (34) - -/** - * Sanity checks and default values for EEPROM saturation levels. - * If EEPROM values fall outside MIN/MAX range, use default values. - * - * Saturation is the highest level that the output power amplifier can produce - * without significant clipping distortion. This is a "peak" power level. - * Different types of modulation (i.e. various "rates", and OFDM vs. CCK) - * require differing amounts of backoff, relative to their average power output, - * in order to avoid clipping distortion. - * - * Driver must make sure that it is violating neither the saturation limit, - * nor the regulatory limit, when calculating Tx power settings for various - * rates. - * - * Units are in half-dBm (i.e. "38" means 19 dBm). - */ -#define IL_TX_POWER_DEFAULT_SATURATION_24 (38) -#define IL_TX_POWER_DEFAULT_SATURATION_52 (38) -#define IL_TX_POWER_SATURATION_MIN (20) -#define IL_TX_POWER_SATURATION_MAX (50) - -/** - * Channel groups used for Tx Attenuation calibration (MIMO tx channel balance) - * and thermal Txpower calibration. - * - * When calculating txpower, driver must compensate for current device - * temperature; higher temperature requires higher gain. Driver must calculate - * current temperature (see "4965 temperature calculation"), then compare vs. - * factory calibration temperature in EEPROM; if current temperature is higher - * than factory temperature, driver must *increase* gain by proportions shown - * in table below. If current temperature is lower than factory, driver must - * *decrease* gain. - * - * Different frequency ranges require different compensation, as shown below. - */ -/* Group 0, 5.2 GHz ch 34-43: 4.5 degrees per 1/2 dB. */ -#define CALIB_IL_TX_ATTEN_GR1_FCH 34 -#define CALIB_IL_TX_ATTEN_GR1_LCH 43 - -/* Group 1, 5.3 GHz ch 44-70: 4.0 degrees per 1/2 dB. */ -#define CALIB_IL_TX_ATTEN_GR2_FCH 44 -#define CALIB_IL_TX_ATTEN_GR2_LCH 70 - -/* Group 2, 5.5 GHz ch 71-124: 4.0 degrees per 1/2 dB. */ -#define CALIB_IL_TX_ATTEN_GR3_FCH 71 -#define CALIB_IL_TX_ATTEN_GR3_LCH 124 - -/* Group 3, 5.7 GHz ch 125-200: 4.0 degrees per 1/2 dB. */ -#define CALIB_IL_TX_ATTEN_GR4_FCH 125 -#define CALIB_IL_TX_ATTEN_GR4_LCH 200 - -/* Group 4, 2.4 GHz all channels: 3.5 degrees per 1/2 dB. */ -#define CALIB_IL_TX_ATTEN_GR5_FCH 1 -#define CALIB_IL_TX_ATTEN_GR5_LCH 20 - -enum { - CALIB_CH_GROUP_1 = 0, - CALIB_CH_GROUP_2 = 1, - CALIB_CH_GROUP_3 = 2, - CALIB_CH_GROUP_4 = 3, - CALIB_CH_GROUP_5 = 4, - CALIB_CH_GROUP_MAX -}; - -/********************* END TXPOWER *****************************************/ - -/** - * Tx/Rx Queues - * - * Most communication between driver and 4965 is via queues of data buffers. - * For example, all commands that the driver issues to device's embedded - * controller (uCode) are via the command queue (one of the Tx queues). All - * uCode command responses/replies/notifications, including Rx frames, are - * conveyed from uCode to driver via the Rx queue. - * - * Most support for these queues, including handshake support, resides in - * structures in host DRAM, shared between the driver and the device. When - * allocating this memory, the driver must make sure that data written by - * the host CPU updates DRAM immediately (and does not get "stuck" in CPU's - * cache memory), so DRAM and cache are consistent, and the device can - * immediately see changes made by the driver. - * - * 4965 supports up to 16 DRAM-based Tx queues, and services these queues via - * up to 7 DMA channels (FIFOs). Each Tx queue is supported by a circular array - * in DRAM containing 256 Transmit Frame Descriptors (TFDs). - */ -#define IL49_NUM_FIFOS 7 -#define IL49_CMD_FIFO_NUM 4 -#define IL49_NUM_QUEUES 16 -#define IL49_NUM_AMPDU_QUEUES 8 - -/** - * struct il4965_schedq_bc_tbl - * - * Byte Count table - * - * Each Tx queue uses a byte-count table containing 320 entries: - * one 16-bit entry for each of 256 TFDs, plus an additional 64 entries that - * duplicate the first 64 entries (to avoid wrap-around within a Tx win; - * max Tx win is 64 TFDs). - * - * When driver sets up a new TFD, it must also enter the total byte count - * of the frame to be transmitted into the corresponding entry in the byte - * count table for the chosen Tx queue. If the TFD idx is 0-63, the driver - * must duplicate the byte count entry in corresponding idx 256-319. - * - * padding puts each byte count table on a 1024-byte boundary; - * 4965 assumes tables are separated by 1024 bytes. - */ -struct il4965_scd_bc_tbl { - __le16 tfd_offset[TFD_QUEUE_BC_SIZE]; - u8 pad[1024 - (TFD_QUEUE_BC_SIZE) * sizeof(__le16)]; -} __packed; - -#define IL4965_RTC_INST_LOWER_BOUND (0x000000) - -/* RSSI to dBm */ -#define IL4965_RSSI_OFFSET 44 - -/* PCI registers */ -#define PCI_CFG_RETRY_TIMEOUT 0x041 - -#define IL4965_DEFAULT_TX_RETRY 15 - -/* EEPROM */ -#define IL4965_FIRST_AMPDU_QUEUE 10 - -/* Calibration */ -void il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp); -void il4965_sensitivity_calibration(struct il_priv *il, void *resp); -void il4965_init_sensitivity(struct il_priv *il); -void il4965_reset_run_time_calib(struct il_priv *il); - -/* Debug */ -#ifdef CONFIG_IWLEGACY_DEBUGFS -extern const struct il_debugfs_ops il4965_debugfs_ops; -#endif - -/****************************/ -/* Flow Handler Definitions */ -/****************************/ - -/** - * This I/O area is directly read/writable by driver (e.g. Linux uses writel()) - * Addresses are offsets from device's PCI hardware base address. - */ -#define FH49_MEM_LOWER_BOUND (0x1000) -#define FH49_MEM_UPPER_BOUND (0x2000) - -/** - * Keep-Warm (KW) buffer base address. - * - * Driver must allocate a 4KByte buffer that is used by 4965 for keeping the - * host DRAM powered on (via dummy accesses to DRAM) to maintain low-latency - * DRAM access when 4965 is Txing or Rxing. The dummy accesses prevent host - * from going into a power-savings mode that would cause higher DRAM latency, - * and possible data over/under-runs, before all Tx/Rx is complete. - * - * Driver loads FH49_KW_MEM_ADDR_REG with the physical address (bits 35:4) - * of the buffer, which must be 4K aligned. Once this is set up, the 4965 - * automatically invokes keep-warm accesses when normal accesses might not - * be sufficient to maintain fast DRAM response. - * - * Bit fields: - * 31-0: Keep-warm buffer physical base address [35:4], must be 4K aligned - */ -#define FH49_KW_MEM_ADDR_REG (FH49_MEM_LOWER_BOUND + 0x97C) - -/** - * TFD Circular Buffers Base (CBBC) addresses - * - * 4965 has 16 base pointer registers, one for each of 16 host-DRAM-resident - * circular buffers (CBs/queues) containing Transmit Frame Descriptors (TFDs) - * (see struct il_tfd_frame). These 16 pointer registers are offset by 0x04 - * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte - * aligned (address bits 0-7 must be 0). - * - * Bit fields in each pointer register: - * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned - */ -#define FH49_MEM_CBBC_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0x9D0) -#define FH49_MEM_CBBC_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0xA10) - -/* Find TFD CB base pointer for given queue (range 0-15). */ -#define FH49_MEM_CBBC_QUEUE(x) (FH49_MEM_CBBC_LOWER_BOUND + (x) * 0x4) - -/** - * Rx SRAM Control and Status Registers (RSCSR) - * - * These registers provide handshake between driver and 4965 for the Rx queue - * (this queue handles *all* command responses, notifications, Rx data, etc. - * sent from 4965 uCode to host driver). Unlike Tx, there is only one Rx - * queue, and only one Rx DMA/FIFO channel. Also unlike Tx, which can - * concatenate up to 20 DRAM buffers to form a Tx frame, each Receive Buffer - * Descriptor (RBD) points to only one Rx Buffer (RB); there is a 1:1 - * mapping between RBDs and RBs. - * - * Driver must allocate host DRAM memory for the following, and set the - * physical address of each into 4965 registers: - * - * 1) Receive Buffer Descriptor (RBD) circular buffer (CB), typically with 256 - * entries (although any power of 2, up to 4096, is selectable by driver). - * Each entry (1 dword) points to a receive buffer (RB) of consistent size - * (typically 4K, although 8K or 16K are also selectable by driver). - * Driver sets up RB size and number of RBDs in the CB via Rx config - * register FH49_MEM_RCSR_CHNL0_CONFIG_REG. - * - * Bit fields within one RBD: - * 27-0: Receive Buffer physical address bits [35:8], 256-byte aligned - * - * Driver sets physical address [35:8] of base of RBD circular buffer - * into FH49_RSCSR_CHNL0_RBDCB_BASE_REG [27:0]. - * - * 2) Rx status buffer, 8 bytes, in which 4965 indicates which Rx Buffers - * (RBs) have been filled, via a "write pointer", actually the idx of - * the RB's corresponding RBD within the circular buffer. Driver sets - * physical address [35:4] into FH49_RSCSR_CHNL0_STTS_WPTR_REG [31:0]. - * - * Bit fields in lower dword of Rx status buffer (upper dword not used - * by driver; see struct il4965_shared, val0): - * 31-12: Not used by driver - * 11- 0: Index of last filled Rx buffer descriptor - * (4965 writes, driver reads this value) - * - * As the driver prepares Receive Buffers (RBs) for 4965 to fill, driver must - * enter pointers to these RBs into contiguous RBD circular buffer entries, - * and update the 4965's "write" idx register, - * FH49_RSCSR_CHNL0_RBDCB_WPTR_REG. - * - * This "write" idx corresponds to the *next* RBD that the driver will make - * available, i.e. one RBD past the tail of the ready-to-fill RBDs within - * the circular buffer. This value should initially be 0 (before preparing any - * RBs), should be 8 after preparing the first 8 RBs (for example), and must - * wrap back to 0 at the end of the circular buffer (but don't wrap before - * "read" idx has advanced past 1! See below). - * NOTE: 4965 EXPECTS THE WRITE IDX TO BE INCREMENTED IN MULTIPLES OF 8. - * - * As the 4965 fills RBs (referenced from contiguous RBDs within the circular - * buffer), it updates the Rx status buffer in host DRAM, 2) described above, - * to tell the driver the idx of the latest filled RBD. The driver must - * read this "read" idx from DRAM after receiving an Rx interrupt from 4965. - * - * The driver must also internally keep track of a third idx, which is the - * next RBD to process. When receiving an Rx interrupt, driver should process - * all filled but unprocessed RBs up to, but not including, the RB - * corresponding to the "read" idx. For example, if "read" idx becomes "1", - * driver may process the RB pointed to by RBD 0. Depending on volume of - * traffic, there may be many RBs to process. - * - * If read idx == write idx, 4965 thinks there is no room to put new data. - * Due to this, the maximum number of filled RBs is 255, instead of 256. To - * be safe, make sure that there is a gap of at least 2 RBDs between "write" - * and "read" idxes; that is, make sure that there are no more than 254 - * buffers waiting to be filled. - */ -#define FH49_MEM_RSCSR_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0xBC0) -#define FH49_MEM_RSCSR_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0xC00) -#define FH49_MEM_RSCSR_CHNL0 (FH49_MEM_RSCSR_LOWER_BOUND) - -/** - * Physical base address of 8-byte Rx Status buffer. - * Bit fields: - * 31-0: Rx status buffer physical base address [35:4], must 16-byte aligned. - */ -#define FH49_RSCSR_CHNL0_STTS_WPTR_REG (FH49_MEM_RSCSR_CHNL0) - -/** - * Physical base address of Rx Buffer Descriptor Circular Buffer. - * Bit fields: - * 27-0: RBD CD physical base address [35:8], must be 256-byte aligned. - */ -#define FH49_RSCSR_CHNL0_RBDCB_BASE_REG (FH49_MEM_RSCSR_CHNL0 + 0x004) - -/** - * Rx write pointer (idx, really!). - * Bit fields: - * 11-0: Index of driver's most recent prepared-to-be-filled RBD, + 1. - * NOTE: For 256-entry circular buffer, use only bits [7:0]. - */ -#define FH49_RSCSR_CHNL0_RBDCB_WPTR_REG (FH49_MEM_RSCSR_CHNL0 + 0x008) -#define FH49_RSCSR_CHNL0_WPTR (FH49_RSCSR_CHNL0_RBDCB_WPTR_REG) - -/** - * Rx Config/Status Registers (RCSR) - * Rx Config Reg for channel 0 (only channel used) - * - * Driver must initialize FH49_MEM_RCSR_CHNL0_CONFIG_REG as follows for - * normal operation (see bit fields). - * - * Clearing FH49_MEM_RCSR_CHNL0_CONFIG_REG to 0 turns off Rx DMA. - * Driver should poll FH49_MEM_RSSR_RX_STATUS_REG for - * FH49_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (bit 24) before continuing. - * - * Bit fields: - * 31-30: Rx DMA channel enable: '00' off/pause, '01' pause at end of frame, - * '10' operate normally - * 29-24: reserved - * 23-20: # RBDs in circular buffer = 2^value; use "8" for 256 RBDs (normal), - * min "5" for 32 RBDs, max "12" for 4096 RBDs. - * 19-18: reserved - * 17-16: size of each receive buffer; '00' 4K (normal), '01' 8K, - * '10' 12K, '11' 16K. - * 15-14: reserved - * 13-12: IRQ destination; '00' none, '01' host driver (normal operation) - * 11- 4: timeout for closing Rx buffer and interrupting host (units 32 usec) - * typical value 0x10 (about 1/2 msec) - * 3- 0: reserved - */ -#define FH49_MEM_RCSR_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0xC00) -#define FH49_MEM_RCSR_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0xCC0) -#define FH49_MEM_RCSR_CHNL0 (FH49_MEM_RCSR_LOWER_BOUND) - -#define FH49_MEM_RCSR_CHNL0_CONFIG_REG (FH49_MEM_RCSR_CHNL0) - -#define FH49_RCSR_CHNL0_RX_CONFIG_RB_TIMEOUT_MSK (0x00000FF0) /* bits 4-11 */ -#define FH49_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_MSK (0x00001000) /* bits 12 */ -#define FH49_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK (0x00008000) /* bit 15 */ -#define FH49_RCSR_CHNL0_RX_CONFIG_RB_SIZE_MSK (0x00030000) /* bits 16-17 */ -#define FH49_RCSR_CHNL0_RX_CONFIG_RBDBC_SIZE_MSK (0x00F00000) /* bits 20-23 */ -#define FH49_RCSR_CHNL0_RX_CONFIG_DMA_CHNL_EN_MSK (0xC0000000) /* bits 30-31 */ - -#define FH49_RCSR_RX_CONFIG_RBDCB_SIZE_POS (20) -#define FH49_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS (4) -#define RX_RB_TIMEOUT (0x10) - -#define FH49_RCSR_RX_CONFIG_CHNL_EN_PAUSE_VAL (0x00000000) -#define FH49_RCSR_RX_CONFIG_CHNL_EN_PAUSE_EOF_VAL (0x40000000) -#define FH49_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL (0x80000000) - -#define FH49_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K (0x00000000) -#define FH49_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K (0x00010000) -#define FH49_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_12K (0x00020000) -#define FH49_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_16K (0x00030000) - -#define FH49_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY (0x00000004) -#define FH49_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000) -#define FH49_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000) - -/** - * Rx Shared Status Registers (RSSR) - * - * After stopping Rx DMA channel (writing 0 to - * FH49_MEM_RCSR_CHNL0_CONFIG_REG), driver must poll - * FH49_MEM_RSSR_RX_STATUS_REG until Rx channel is idle. - * - * Bit fields: - * 24: 1 = Channel 0 is idle - * - * FH49_MEM_RSSR_SHARED_CTRL_REG and FH49_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV - * contain default values that should not be altered by the driver. - */ -#define FH49_MEM_RSSR_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0xC40) -#define FH49_MEM_RSSR_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0xD00) - -#define FH49_MEM_RSSR_SHARED_CTRL_REG (FH49_MEM_RSSR_LOWER_BOUND) -#define FH49_MEM_RSSR_RX_STATUS_REG (FH49_MEM_RSSR_LOWER_BOUND + 0x004) -#define FH49_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV\ - (FH49_MEM_RSSR_LOWER_BOUND + 0x008) - -#define FH49_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) - -#define FH49_MEM_TFDIB_REG1_ADDR_BITSHIFT 28 - -/* TFDB Area - TFDs buffer table */ -#define FH49_MEM_TFDIB_DRAM_ADDR_LSB_MSK (0xFFFFFFFF) -#define FH49_TFDIB_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0x900) -#define FH49_TFDIB_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0x958) -#define FH49_TFDIB_CTRL0_REG(_chnl) (FH49_TFDIB_LOWER_BOUND + 0x8 * (_chnl)) -#define FH49_TFDIB_CTRL1_REG(_chnl) (FH49_TFDIB_LOWER_BOUND + 0x8 * (_chnl) + 0x4) - -/** - * Transmit DMA Channel Control/Status Registers (TCSR) - * - * 4965 has one configuration register for each of 8 Tx DMA/FIFO channels - * supported in hardware (don't confuse these with the 16 Tx queues in DRAM, - * which feed the DMA/FIFO channels); config regs are separated by 0x20 bytes. - * - * To use a Tx DMA channel, driver must initialize its - * FH49_TCSR_CHNL_TX_CONFIG_REG(chnl) with: - * - * FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | - * FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL - * - * All other bits should be 0. - * - * Bit fields: - * 31-30: Tx DMA channel enable: '00' off/pause, '01' pause at end of frame, - * '10' operate normally - * 29- 4: Reserved, set to "0" - * 3: Enable internal DMA requests (1, normal operation), disable (0) - * 2- 0: Reserved, set to "0" - */ -#define FH49_TCSR_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0xD00) -#define FH49_TCSR_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0xE60) - -/* Find Control/Status reg for given Tx DMA/FIFO channel */ -#define FH49_TCSR_CHNL_NUM (7) -#define FH50_TCSR_CHNL_NUM (8) - -/* TCSR: tx_config register values */ -#define FH49_TCSR_CHNL_TX_CONFIG_REG(_chnl) \ - (FH49_TCSR_LOWER_BOUND + 0x20 * (_chnl)) -#define FH49_TCSR_CHNL_TX_CREDIT_REG(_chnl) \ - (FH49_TCSR_LOWER_BOUND + 0x20 * (_chnl) + 0x4) -#define FH49_TCSR_CHNL_TX_BUF_STS_REG(_chnl) \ - (FH49_TCSR_LOWER_BOUND + 0x20 * (_chnl) + 0x8) - -#define FH49_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000) -#define FH49_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRV (0x00000001) - -#define FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE (0x00000000) -#define FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE (0x00000008) - -#define FH49_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_NOINT (0x00000000) -#define FH49_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD (0x00100000) -#define FH49_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) - -#define FH49_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000) -#define FH49_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_ENDTFD (0x00400000) -#define FH49_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_IFTFD (0x00800000) - -#define FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) -#define FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE_EOF (0x40000000) -#define FH49_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000) - -#define FH49_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_EMPTY (0x00000000) -#define FH49_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_WAIT (0x00002000) -#define FH49_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00000003) - -#define FH49_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM (20) -#define FH49_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX (12) - -/** - * Tx Shared Status Registers (TSSR) - * - * After stopping Tx DMA channel (writing 0 to - * FH49_TCSR_CHNL_TX_CONFIG_REG(chnl)), driver must poll - * FH49_TSSR_TX_STATUS_REG until selected Tx channel is idle - * (channel's buffers empty | no pending requests). - * - * Bit fields: - * 31-24: 1 = Channel buffers empty (channel 7:0) - * 23-16: 1 = No pending requests (channel 7:0) - */ -#define FH49_TSSR_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0xEA0) -#define FH49_TSSR_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0xEC0) - -#define FH49_TSSR_TX_STATUS_REG (FH49_TSSR_LOWER_BOUND + 0x010) - -/** - * Bit fields for TSSR(Tx Shared Status & Control) error status register: - * 31: Indicates an address error when accessed to internal memory - * uCode/driver must write "1" in order to clear this flag - * 30: Indicates that Host did not send the expected number of dwords to FH - * uCode/driver must write "1" in order to clear this flag - * 16-9:Each status bit is for one channel. Indicates that an (Error) ActDMA - * command was received from the scheduler while the TRB was already full - * with previous command - * uCode/driver must write "1" in order to clear this flag - * 7-0: Each status bit indicates a channel's TxCredit error. When an error - * bit is set, it indicates that the FH has received a full indication - * from the RTC TxFIFO and the current value of the TxCredit counter was - * not equal to zero. This mean that the credit mechanism was not - * synchronized to the TxFIFO status - * uCode/driver must write "1" in order to clear this flag - */ -#define FH49_TSSR_TX_ERROR_REG (FH49_TSSR_LOWER_BOUND + 0x018) - -#define FH49_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_chnl) ((1 << (_chnl)) << 16) - -/* Tx service channels */ -#define FH49_SRVC_CHNL (9) -#define FH49_SRVC_LOWER_BOUND (FH49_MEM_LOWER_BOUND + 0x9C8) -#define FH49_SRVC_UPPER_BOUND (FH49_MEM_LOWER_BOUND + 0x9D0) -#define FH49_SRVC_CHNL_SRAM_ADDR_REG(_chnl) \ - (FH49_SRVC_LOWER_BOUND + ((_chnl) - 9) * 0x4) - -#define FH49_TX_CHICKEN_BITS_REG (FH49_MEM_LOWER_BOUND + 0xE98) -/* Instruct FH to increment the retry count of a packet when - * it is brought from the memory to TX-FIFO - */ -#define FH49_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN (0x00000002) - -/* Keep Warm Size */ -#define IL_KW_SIZE 0x1000 /* 4k */ - -#endif /* __il_4965_h__ */ diff --git a/drivers/net/wireless/iwlegacy/Kconfig b/drivers/net/wireless/iwlegacy/Kconfig deleted file mode 100644 index fb919727b8bb..000000000000 --- a/drivers/net/wireless/iwlegacy/Kconfig +++ /dev/null @@ -1,100 +0,0 @@ -config IWLEGACY - tristate - select FW_LOADER - select NEW_LEDS - select LEDS_CLASS - select LEDS_TRIGGERS - select MAC80211_LEDS - -config IWL4965 - tristate "Intel Wireless WiFi 4965AGN (iwl4965)" - depends on PCI && MAC80211 - select IWLEGACY - ---help--- - This option enables support for - - Select to build the driver supporting the: - - Intel Wireless WiFi Link 4965AGN - - This driver uses the kernel's mac80211 subsystem. - - In order to use this driver, you will need a microcode (uCode) - image for it. You can obtain the microcode from: - - . - - The microcode is typically installed in /lib/firmware. You can - look in the hotplug script /etc/hotplug/firmware.agent to - determine which directory FIRMWARE_DIR is set to when the script - runs. - - If you want to compile the driver as a module ( = code which can be - inserted in and removed from the running kernel whenever you want), - say M here and read . The - module will be called iwl4965. - -config IWL3945 - tristate "Intel PRO/Wireless 3945ABG/BG Network Connection (iwl3945)" - depends on PCI && MAC80211 - select IWLEGACY - ---help--- - Select to build the driver supporting the: - - Intel PRO/Wireless 3945ABG/BG Network Connection - - This driver uses the kernel's mac80211 subsystem. - - In order to use this driver, you will need a microcode (uCode) - image for it. You can obtain the microcode from: - - . - - The microcode is typically installed in /lib/firmware. You can - look in the hotplug script /etc/hotplug/firmware.agent to - determine which directory FIRMWARE_DIR is set to when the script - runs. - - If you want to compile the driver as a module ( = code which can be - inserted in and removed from the running kernel whenever you want), - say M here and read . The - module will be called iwl3945. - -menu "iwl3945 / iwl4965 Debugging Options" - depends on IWLEGACY - -config IWLEGACY_DEBUG - bool "Enable full debugging output in iwlegacy (iwl 3945/4965) drivers" - depends on IWLEGACY - ---help--- - This option will enable debug tracing output for the iwlegacy - drivers. - - This will result in the kernel module being ~100k larger. You can - control which debug output is sent to the kernel log by setting the - value in - - /sys/class/net/wlan0/device/debug_level - - This entry will only exist if this option is enabled. - - To set a value, simply echo an 8-byte hex value to the same file: - - % echo 0x43fff > /sys/class/net/wlan0/device/debug_level - - You can find the list of debug mask values in: - drivers/net/wireless/iwlegacy/common.h - - If this is your first time using this driver, you should say Y here - as the debug information can assist others in helping you resolve - any problems you may encounter. - -config IWLEGACY_DEBUGFS - bool "iwlegacy (iwl 3945/4965) debugfs support" - depends on IWLEGACY && MAC80211_DEBUGFS - ---help--- - Enable creation of debugfs files for the iwlegacy drivers. This - is a low-impact option that allows getting insight into the - driver's state at runtime. - -endmenu diff --git a/drivers/net/wireless/iwlegacy/Makefile b/drivers/net/wireless/iwlegacy/Makefile deleted file mode 100644 index c985a01a0731..000000000000 --- a/drivers/net/wireless/iwlegacy/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -obj-$(CONFIG_IWLEGACY) += iwlegacy.o -iwlegacy-objs := common.o -iwlegacy-$(CONFIG_IWLEGACY_DEBUGFS) += debug.o - -iwlegacy-objs += $(iwlegacy-m) - -# 4965 -obj-$(CONFIG_IWL4965) += iwl4965.o -iwl4965-objs := 4965.o 4965-mac.o 4965-rs.o 4965-calib.o -iwl4965-$(CONFIG_IWLEGACY_DEBUGFS) += 4965-debug.o - -# 3945 -obj-$(CONFIG_IWL3945) += iwl3945.o -iwl3945-objs := 3945-mac.o 3945.o 3945-rs.o -iwl3945-$(CONFIG_IWLEGACY_DEBUGFS) += 3945-debug.o - -ccflags-y += -D__CHECK_ENDIAN__ diff --git a/drivers/net/wireless/iwlegacy/commands.h b/drivers/net/wireless/iwlegacy/commands.h deleted file mode 100644 index 3b6c99400892..000000000000 --- a/drivers/net/wireless/iwlegacy/commands.h +++ /dev/null @@ -1,3377 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2005 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called LICENSE.GPL. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#ifndef __il_commands_h__ -#define __il_commands_h__ - -#include - -struct il_priv; - -/* uCode version contains 4 values: Major/Minor/API/Serial */ -#define IL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24) -#define IL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16) -#define IL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8) -#define IL_UCODE_SERIAL(ver) ((ver) & 0x000000FF) - -/* Tx rates */ -#define IL_CCK_RATES 4 -#define IL_OFDM_RATES 8 -#define IL_MAX_RATES (IL_CCK_RATES + IL_OFDM_RATES) - -enum { - N_ALIVE = 0x1, - N_ERROR = 0x2, - - /* RXON and QOS commands */ - C_RXON = 0x10, - C_RXON_ASSOC = 0x11, - C_QOS_PARAM = 0x13, - C_RXON_TIMING = 0x14, - - /* Multi-Station support */ - C_ADD_STA = 0x18, - C_REM_STA = 0x19, - - /* Security */ - C_WEPKEY = 0x20, - - /* RX, TX, LEDs */ - N_3945_RX = 0x1b, /* 3945 only */ - C_TX = 0x1c, - C_RATE_SCALE = 0x47, /* 3945 only */ - C_LEDS = 0x48, - C_TX_LINK_QUALITY_CMD = 0x4e, /* for 4965 */ - - /* 802.11h related */ - C_CHANNEL_SWITCH = 0x72, - N_CHANNEL_SWITCH = 0x73, - C_SPECTRUM_MEASUREMENT = 0x74, - N_SPECTRUM_MEASUREMENT = 0x75, - - /* Power Management */ - C_POWER_TBL = 0x77, - N_PM_SLEEP = 0x7A, - N_PM_DEBUG_STATS = 0x7B, - - /* Scan commands and notifications */ - C_SCAN = 0x80, - C_SCAN_ABORT = 0x81, - N_SCAN_START = 0x82, - N_SCAN_RESULTS = 0x83, - N_SCAN_COMPLETE = 0x84, - - /* IBSS/AP commands */ - N_BEACON = 0x90, - C_TX_BEACON = 0x91, - - /* Miscellaneous commands */ - C_TX_PWR_TBL = 0x97, - - /* Bluetooth device coexistence config command */ - C_BT_CONFIG = 0x9b, - - /* Statistics */ - C_STATS = 0x9c, - N_STATS = 0x9d, - - /* RF-KILL commands and notifications */ - N_CARD_STATE = 0xa1, - - /* Missed beacons notification */ - N_MISSED_BEACONS = 0xa2, - - C_CT_KILL_CONFIG = 0xa4, - C_SENSITIVITY = 0xa8, - C_PHY_CALIBRATION = 0xb0, - N_RX_PHY = 0xc0, - N_RX_MPDU = 0xc1, - N_RX = 0xc3, - N_COMPRESSED_BA = 0xc5, - - IL_CN_MAX = 0xff -}; - -/****************************************************************************** - * (0) - * Commonly used structures and definitions: - * Command header, rate_n_flags, txpower - * - *****************************************************************************/ - -/* il_cmd_header flags value */ -#define IL_CMD_FAILED_MSK 0x40 - -#define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f) -#define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8) -#define SEQ_TO_IDX(s) ((s) & 0xff) -#define IDX_TO_SEQ(i) ((i) & 0xff) -#define SEQ_HUGE_FRAME cpu_to_le16(0x4000) -#define SEQ_RX_FRAME cpu_to_le16(0x8000) - -/** - * struct il_cmd_header - * - * This header format appears in the beginning of each command sent from the - * driver, and each response/notification received from uCode. - */ -struct il_cmd_header { - u8 cmd; /* Command ID: C_RXON, etc. */ - u8 flags; /* 0:5 reserved, 6 abort, 7 internal */ - /* - * The driver sets up the sequence number to values of its choosing. - * uCode does not use this value, but passes it back to the driver - * when sending the response to each driver-originated command, so - * the driver can match the response to the command. Since the values - * don't get used by uCode, the driver may set up an arbitrary format. - * - * There is one exception: uCode sets bit 15 when it originates - * the response/notification, i.e. when the response/notification - * is not a direct response to a command sent by the driver. For - * example, uCode issues N_3945_RX when it sends a received frame - * to the driver; it is not a direct response to any driver command. - * - * The Linux driver uses the following format: - * - * 0:7 tfd idx - position within TX queue - * 8:12 TX queue id - * 13 reserved - * 14 huge - driver sets this to indicate command is in the - * 'huge' storage at the end of the command buffers - * 15 unsolicited RX or uCode-originated notification - */ - __le16 sequence; - - /* command or response/notification data follows immediately */ - u8 data[0]; -} __packed; - -/** - * struct il3945_tx_power - * - * Used in C_TX_PWR_TBL, C_SCAN, C_CHANNEL_SWITCH - * - * Each entry contains two values: - * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained - * linear value that multiplies the output of the digital signal processor, - * before being sent to the analog radio. - * 2) Radio gain. This sets the analog gain of the radio Tx path. - * It is a coarser setting, and behaves in a logarithmic (dB) fashion. - * - * Driver obtains values from struct il3945_tx_power power_gain_table[][]. - */ -struct il3945_tx_power { - u8 tx_gain; /* gain for analog radio */ - u8 dsp_atten; /* gain for DSP */ -} __packed; - -/** - * struct il3945_power_per_rate - * - * Used in C_TX_PWR_TBL, C_CHANNEL_SWITCH - */ -struct il3945_power_per_rate { - u8 rate; /* plcp */ - struct il3945_tx_power tpc; - u8 reserved; -} __packed; - -/** - * iwl4965 rate_n_flags bit fields - * - * rate_n_flags format is used in following iwl4965 commands: - * N_RX (response only) - * N_RX_MPDU (response only) - * C_TX (both command and response) - * C_TX_LINK_QUALITY_CMD - * - * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"): - * 2-0: 0) 6 Mbps - * 1) 12 Mbps - * 2) 18 Mbps - * 3) 24 Mbps - * 4) 36 Mbps - * 5) 48 Mbps - * 6) 54 Mbps - * 7) 60 Mbps - * - * 4-3: 0) Single stream (SISO) - * 1) Dual stream (MIMO) - * 2) Triple stream (MIMO) - * - * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data - * - * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"): - * 3-0: 0xD) 6 Mbps - * 0xF) 9 Mbps - * 0x5) 12 Mbps - * 0x7) 18 Mbps - * 0x9) 24 Mbps - * 0xB) 36 Mbps - * 0x1) 48 Mbps - * 0x3) 54 Mbps - * - * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): - * 6-0: 10) 1 Mbps - * 20) 2 Mbps - * 55) 5.5 Mbps - * 110) 11 Mbps - */ -#define RATE_MCS_CODE_MSK 0x7 -#define RATE_MCS_SPATIAL_POS 3 -#define RATE_MCS_SPATIAL_MSK 0x18 -#define RATE_MCS_HT_DUP_POS 5 -#define RATE_MCS_HT_DUP_MSK 0x20 - -/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */ -#define RATE_MCS_FLAGS_POS 8 -#define RATE_MCS_HT_POS 8 -#define RATE_MCS_HT_MSK 0x100 - -/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */ -#define RATE_MCS_CCK_POS 9 -#define RATE_MCS_CCK_MSK 0x200 - -/* Bit 10: (1) Use Green Field preamble */ -#define RATE_MCS_GF_POS 10 -#define RATE_MCS_GF_MSK 0x400 - -/* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */ -#define RATE_MCS_HT40_POS 11 -#define RATE_MCS_HT40_MSK 0x800 - -/* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */ -#define RATE_MCS_DUP_POS 12 -#define RATE_MCS_DUP_MSK 0x1000 - -/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */ -#define RATE_MCS_SGI_POS 13 -#define RATE_MCS_SGI_MSK 0x2000 - -/** - * rate_n_flags Tx antenna masks - * 4965 has 2 transmitters - * bit14:16 - */ -#define RATE_MCS_ANT_POS 14 -#define RATE_MCS_ANT_A_MSK 0x04000 -#define RATE_MCS_ANT_B_MSK 0x08000 -#define RATE_MCS_ANT_C_MSK 0x10000 -#define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK) -#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK) -#define RATE_ANT_NUM 3 - -#define POWER_TBL_NUM_ENTRIES 33 -#define POWER_TBL_NUM_HT_OFDM_ENTRIES 32 -#define POWER_TBL_CCK_ENTRY 32 - -#define IL_PWR_NUM_HT_OFDM_ENTRIES 24 -#define IL_PWR_CCK_ENTRIES 2 - -/** - * union il4965_tx_power_dual_stream - * - * Host format used for C_TX_PWR_TBL, C_CHANNEL_SWITCH - * Use __le32 version (struct tx_power_dual_stream) when building command. - * - * Driver provides radio gain and DSP attenuation settings to device in pairs, - * one value for each transmitter chain. The first value is for transmitter A, - * second for transmitter B. - * - * For SISO bit rates, both values in a pair should be identical. - * For MIMO rates, one value may be different from the other, - * in order to balance the Tx output between the two transmitters. - * - * See more details in doc for TXPOWER in 4965.h. - */ -union il4965_tx_power_dual_stream { - struct { - u8 radio_tx_gain[2]; - u8 dsp_predis_atten[2]; - } s; - u32 dw; -}; - -/** - * struct tx_power_dual_stream - * - * Table entries in C_TX_PWR_TBL, C_CHANNEL_SWITCH - * - * Same format as il_tx_power_dual_stream, but __le32 - */ -struct tx_power_dual_stream { - __le32 dw; -} __packed; - -/** - * struct il4965_tx_power_db - * - * Entire table within C_TX_PWR_TBL, C_CHANNEL_SWITCH - */ -struct il4965_tx_power_db { - struct tx_power_dual_stream power_tbl[POWER_TBL_NUM_ENTRIES]; -} __packed; - -/****************************************************************************** - * (0a) - * Alive and Error Commands & Responses: - * - *****************************************************************************/ - -#define UCODE_VALID_OK cpu_to_le32(0x1) -#define INITIALIZE_SUBTYPE (9) - -/* - * ("Initialize") N_ALIVE = 0x1 (response only, not a command) - * - * uCode issues this "initialize alive" notification once the initialization - * uCode image has completed its work, and is ready to load the runtime image. - * This is the *first* "alive" notification that the driver will receive after - * rebooting uCode; the "initialize" alive is indicated by subtype field == 9. - * - * See comments documenting "BSM" (bootstrap state machine). - * - * For 4965, this notification contains important calibration data for - * calculating txpower settings: - * - * 1) Power supply voltage indication. The voltage sensor outputs higher - * values for lower voltage, and vice verse. - * - * 2) Temperature measurement parameters, for each of two channel widths - * (20 MHz and 40 MHz) supported by the radios. Temperature sensing - * is done via one of the receiver chains, and channel width influences - * the results. - * - * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation, - * for each of 5 frequency ranges. - */ -struct il_init_alive_resp { - u8 ucode_minor; - u8 ucode_major; - __le16 reserved1; - u8 sw_rev[8]; - u8 ver_type; - u8 ver_subtype; /* "9" for initialize alive */ - __le16 reserved2; - __le32 log_event_table_ptr; - __le32 error_event_table_ptr; - __le32 timestamp; - __le32 is_valid; - - /* calibration values from "initialize" uCode */ - __le32 voltage; /* signed, higher value is lower voltage */ - __le32 therm_r1[2]; /* signed, 1st for normal, 2nd for HT40 */ - __le32 therm_r2[2]; /* signed */ - __le32 therm_r3[2]; /* signed */ - __le32 therm_r4[2]; /* signed */ - __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups, - * 2 Tx chains */ -} __packed; - -/** - * N_ALIVE = 0x1 (response only, not a command) - * - * uCode issues this "alive" notification once the runtime image is ready - * to receive commands from the driver. This is the *second* "alive" - * notification that the driver will receive after rebooting uCode; - * this "alive" is indicated by subtype field != 9. - * - * See comments documenting "BSM" (bootstrap state machine). - * - * This response includes two pointers to structures within the device's - * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging: - * - * 1) log_event_table_ptr indicates base of the event log. This traces - * a 256-entry history of uCode execution within a circular buffer. - * Its header format is: - * - * __le32 log_size; log capacity (in number of entries) - * __le32 type; (1) timestamp with each entry, (0) no timestamp - * __le32 wraps; # times uCode has wrapped to top of circular buffer - * __le32 write_idx; next circular buffer entry that uCode would fill - * - * The header is followed by the circular buffer of log entries. Entries - * with timestamps have the following format: - * - * __le32 event_id; range 0 - 1500 - * __le32 timestamp; low 32 bits of TSF (of network, if associated) - * __le32 data; event_id-specific data value - * - * Entries without timestamps contain only event_id and data. - * - * - * 2) error_event_table_ptr indicates base of the error log. This contains - * information about any uCode error that occurs. For 4965, the format - * of the error log is: - * - * __le32 valid; (nonzero) valid, (0) log is empty - * __le32 error_id; type of error - * __le32 pc; program counter - * __le32 blink1; branch link - * __le32 blink2; branch link - * __le32 ilink1; interrupt link - * __le32 ilink2; interrupt link - * __le32 data1; error-specific data - * __le32 data2; error-specific data - * __le32 line; source code line of error - * __le32 bcon_time; beacon timer - * __le32 tsf_low; network timestamp function timer - * __le32 tsf_hi; network timestamp function timer - * __le32 gp1; GP1 timer register - * __le32 gp2; GP2 timer register - * __le32 gp3; GP3 timer register - * __le32 ucode_ver; uCode version - * __le32 hw_ver; HW Silicon version - * __le32 brd_ver; HW board version - * __le32 log_pc; log program counter - * __le32 frame_ptr; frame pointer - * __le32 stack_ptr; stack pointer - * __le32 hcmd; last host command - * __le32 isr0; isr status register LMPM_NIC_ISR0: rxtx_flag - * __le32 isr1; isr status register LMPM_NIC_ISR1: host_flag - * __le32 isr2; isr status register LMPM_NIC_ISR2: enc_flag - * __le32 isr3; isr status register LMPM_NIC_ISR3: time_flag - * __le32 isr4; isr status register LMPM_NIC_ISR4: wico interrupt - * __le32 isr_pref; isr status register LMPM_NIC_PREF_STAT - * __le32 wait_event; wait event() caller address - * __le32 l2p_control; L2pControlField - * __le32 l2p_duration; L2pDurationField - * __le32 l2p_mhvalid; L2pMhValidBits - * __le32 l2p_addr_match; L2pAddrMatchStat - * __le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL) - * __le32 u_timestamp; indicate when the date and time of the compilation - * __le32 reserved; - * - * The Linux driver can print both logs to the system log when a uCode error - * occurs. - */ -struct il_alive_resp { - u8 ucode_minor; - u8 ucode_major; - __le16 reserved1; - u8 sw_rev[8]; - u8 ver_type; - u8 ver_subtype; /* not "9" for runtime alive */ - __le16 reserved2; - __le32 log_event_table_ptr; /* SRAM address for event log */ - __le32 error_event_table_ptr; /* SRAM address for error log */ - __le32 timestamp; - __le32 is_valid; -} __packed; - -/* - * N_ERROR = 0x2 (response only, not a command) - */ -struct il_error_resp { - __le32 error_type; - u8 cmd_id; - u8 reserved1; - __le16 bad_cmd_seq_num; - __le32 error_info; - __le64 timestamp; -} __packed; - -/****************************************************************************** - * (1) - * RXON Commands & Responses: - * - *****************************************************************************/ - -/* - * Rx config defines & structure - */ -/* rx_config device types */ -enum { - RXON_DEV_TYPE_AP = 1, - RXON_DEV_TYPE_ESS = 3, - RXON_DEV_TYPE_IBSS = 4, - RXON_DEV_TYPE_SNIFFER = 6, -}; - -#define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0) -#define RXON_RX_CHAIN_DRIVER_FORCE_POS (0) -#define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1) -#define RXON_RX_CHAIN_VALID_POS (1) -#define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4) -#define RXON_RX_CHAIN_FORCE_SEL_POS (4) -#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7) -#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7) -#define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10) -#define RXON_RX_CHAIN_CNT_POS (10) -#define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12) -#define RXON_RX_CHAIN_MIMO_CNT_POS (12) -#define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14) -#define RXON_RX_CHAIN_MIMO_FORCE_POS (14) - -/* rx_config flags */ -/* band & modulation selection */ -#define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0) -#define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1) -/* auto detection enable */ -#define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2) -/* TGg protection when tx */ -#define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3) -/* cck short slot & preamble */ -#define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4) -#define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5) -/* antenna selection */ -#define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7) -#define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00) -#define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8) -#define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9) -/* radar detection enable */ -#define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12) -#define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13) -/* rx response to host with 8-byte TSF -* (according to ON_AIR deassertion) */ -#define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15) - -/* HT flags */ -#define RXON_FLG_CTRL_CHANNEL_LOC_POS (22) -#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22) - -#define RXON_FLG_HT_OPERATING_MODE_POS (23) - -#define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23) -#define RXON_FLG_HT40_PROT_MSK cpu_to_le32(0x2 << 23) - -#define RXON_FLG_CHANNEL_MODE_POS (25) -#define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25) - -/* channel mode */ -enum { - CHANNEL_MODE_LEGACY = 0, - CHANNEL_MODE_PURE_40 = 1, - CHANNEL_MODE_MIXED = 2, - CHANNEL_MODE_RESERVED = 3, -}; -#define RXON_FLG_CHANNEL_MODE_LEGACY \ - cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS) -#define RXON_FLG_CHANNEL_MODE_PURE_40 \ - cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS) -#define RXON_FLG_CHANNEL_MODE_MIXED \ - cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS) - -/* CTS to self (if spec allows) flag */ -#define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30) - -/* rx_config filter flags */ -/* accept all data frames */ -#define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0) -/* pass control & management to host */ -#define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1) -/* accept multi-cast */ -#define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2) -/* don't decrypt uni-cast frames */ -#define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3) -/* don't decrypt multi-cast frames */ -#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4) -/* STA is associated */ -#define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5) -/* transfer to host non bssid beacons in associated state */ -#define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6) - -/** - * C_RXON = 0x10 (command, has simple generic response) - * - * RXON tunes the radio tuner to a service channel, and sets up a number - * of parameters that are used primarily for Rx, but also for Tx operations. - * - * NOTE: When tuning to a new channel, driver must set the - * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent - * info within the device, including the station tables, tx retry - * rate tables, and txpower tables. Driver must build a new station - * table and txpower table before transmitting anything on the RXON - * channel. - * - * NOTE: All RXONs wipe clean the internal txpower table. Driver must - * issue a new C_TX_PWR_TBL after each C_RXON (0x10), - * regardless of whether RXON_FILTER_ASSOC_MSK is set. - */ - -struct il3945_rxon_cmd { - u8 node_addr[6]; - __le16 reserved1; - u8 bssid_addr[6]; - __le16 reserved2; - u8 wlap_bssid_addr[6]; - __le16 reserved3; - u8 dev_type; - u8 air_propagation; - __le16 reserved4; - u8 ofdm_basic_rates; - u8 cck_basic_rates; - __le16 assoc_id; - __le32 flags; - __le32 filter_flags; - __le16 channel; - __le16 reserved5; -} __packed; - -struct il4965_rxon_cmd { - u8 node_addr[6]; - __le16 reserved1; - u8 bssid_addr[6]; - __le16 reserved2; - u8 wlap_bssid_addr[6]; - __le16 reserved3; - u8 dev_type; - u8 air_propagation; - __le16 rx_chain; - u8 ofdm_basic_rates; - u8 cck_basic_rates; - __le16 assoc_id; - __le32 flags; - __le32 filter_flags; - __le16 channel; - u8 ofdm_ht_single_stream_basic_rates; - u8 ofdm_ht_dual_stream_basic_rates; -} __packed; - -/* Create a common rxon cmd which will be typecast into the 3945 or 4965 - * specific rxon cmd, depending on where it is called from. - */ -struct il_rxon_cmd { - u8 node_addr[6]; - __le16 reserved1; - u8 bssid_addr[6]; - __le16 reserved2; - u8 wlap_bssid_addr[6]; - __le16 reserved3; - u8 dev_type; - u8 air_propagation; - __le16 rx_chain; - u8 ofdm_basic_rates; - u8 cck_basic_rates; - __le16 assoc_id; - __le32 flags; - __le32 filter_flags; - __le16 channel; - u8 ofdm_ht_single_stream_basic_rates; - u8 ofdm_ht_dual_stream_basic_rates; - u8 reserved4; - u8 reserved5; -} __packed; - -/* - * C_RXON_ASSOC = 0x11 (command, has simple generic response) - */ -struct il3945_rxon_assoc_cmd { - __le32 flags; - __le32 filter_flags; - u8 ofdm_basic_rates; - u8 cck_basic_rates; - __le16 reserved; -} __packed; - -struct il4965_rxon_assoc_cmd { - __le32 flags; - __le32 filter_flags; - u8 ofdm_basic_rates; - u8 cck_basic_rates; - u8 ofdm_ht_single_stream_basic_rates; - u8 ofdm_ht_dual_stream_basic_rates; - __le16 rx_chain_select_flags; - __le16 reserved; -} __packed; - -#define IL_CONN_MAX_LISTEN_INTERVAL 10 -#define IL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */ -#define IL39_MAX_UCODE_BEACON_INTERVAL 1 /* 1024 */ - -/* - * C_RXON_TIMING = 0x14 (command, has simple generic response) - */ -struct il_rxon_time_cmd { - __le64 timestamp; - __le16 beacon_interval; - __le16 atim_win; - __le32 beacon_init_val; - __le16 listen_interval; - u8 dtim_period; - u8 delta_cp_bss_tbtts; -} __packed; - -/* - * C_CHANNEL_SWITCH = 0x72 (command, has simple generic response) - */ -struct il3945_channel_switch_cmd { - u8 band; - u8 expect_beacon; - __le16 channel; - __le32 rxon_flags; - __le32 rxon_filter_flags; - __le32 switch_time; - struct il3945_power_per_rate power[IL_MAX_RATES]; -} __packed; - -struct il4965_channel_switch_cmd { - u8 band; - u8 expect_beacon; - __le16 channel; - __le32 rxon_flags; - __le32 rxon_filter_flags; - __le32 switch_time; - struct il4965_tx_power_db tx_power; -} __packed; - -/* - * N_CHANNEL_SWITCH = 0x73 (notification only, not a command) - */ -struct il_csa_notification { - __le16 band; - __le16 channel; - __le32 status; /* 0 - OK, 1 - fail */ -} __packed; - -/****************************************************************************** - * (2) - * Quality-of-Service (QOS) Commands & Responses: - * - *****************************************************************************/ - -/** - * struct il_ac_qos -- QOS timing params for C_QOS_PARAM - * One for each of 4 EDCA access categories in struct il_qosparam_cmd - * - * @cw_min: Contention win, start value in numbers of slots. - * Should be a power-of-2, minus 1. Device's default is 0x0f. - * @cw_max: Contention win, max value in numbers of slots. - * Should be a power-of-2, minus 1. Device's default is 0x3f. - * @aifsn: Number of slots in Arbitration Interframe Space (before - * performing random backoff timing prior to Tx). Device default 1. - * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0. - * - * Device will automatically increase contention win by (2*CW) + 1 for each - * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW - * value, to cap the CW value. - */ -struct il_ac_qos { - __le16 cw_min; - __le16 cw_max; - u8 aifsn; - u8 reserved1; - __le16 edca_txop; -} __packed; - -/* QoS flags defines */ -#define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01) -#define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02) -#define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10) - -/* Number of Access Categories (AC) (EDCA), queues 0..3 */ -#define AC_NUM 4 - -/* - * C_QOS_PARAM = 0x13 (command, has simple generic response) - * - * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs - * 0: Background, 1: Best Effort, 2: Video, 3: Voice. - */ -struct il_qosparam_cmd { - __le32 qos_flags; - struct il_ac_qos ac[AC_NUM]; -} __packed; - -/****************************************************************************** - * (3) - * Add/Modify Stations Commands & Responses: - * - *****************************************************************************/ -/* - * Multi station support - */ - -/* Special, dedicated locations within device's station table */ -#define IL_AP_ID 0 -#define IL_STA_ID 2 -#define IL3945_BROADCAST_ID 24 -#define IL3945_STATION_COUNT 25 -#define IL4965_BROADCAST_ID 31 -#define IL4965_STATION_COUNT 32 - -#define IL_STATION_COUNT 32 /* MAX(3945,4965) */ -#define IL_INVALID_STATION 255 - -#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2) -#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8) -#define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17) -#define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18) -#define STA_FLG_MAX_AGG_SIZE_POS (19) -#define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19) -#define STA_FLG_HT40_EN_MSK cpu_to_le32(1 << 21) -#define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22) -#define STA_FLG_AGG_MPDU_DENSITY_POS (23) -#define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23) - -/* Use in mode field. 1: modify existing entry, 0: add new station entry */ -#define STA_CONTROL_MODIFY_MSK 0x01 - -/* key flags __le16*/ -#define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007) -#define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000) -#define STA_KEY_FLG_WEP cpu_to_le16(0x0001) -#define STA_KEY_FLG_CCMP cpu_to_le16(0x0002) -#define STA_KEY_FLG_TKIP cpu_to_le16(0x0003) - -#define STA_KEY_FLG_KEYID_POS 8 -#define STA_KEY_FLG_INVALID cpu_to_le16(0x0800) -/* wep key is either from global key (0) or from station info array (1) */ -#define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008) - -/* wep key in STA: 5-bytes (0) or 13-bytes (1) */ -#define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000) -#define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000) -#define STA_KEY_MAX_NUM 8 - -/* Flags indicate whether to modify vs. don't change various station params */ -#define STA_MODIFY_KEY_MASK 0x01 -#define STA_MODIFY_TID_DISABLE_TX 0x02 -#define STA_MODIFY_TX_RATE_MSK 0x04 -#define STA_MODIFY_ADDBA_TID_MSK 0x08 -#define STA_MODIFY_DELBA_TID_MSK 0x10 -#define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20 - -/* Receiver address (actually, Rx station's idx into station table), - * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */ -#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid)) - -struct il4965_keyinfo { - __le16 key_flags; - u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ - u8 reserved1; - __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ - u8 key_offset; - u8 reserved2; - u8 key[16]; /* 16-byte unicast decryption key */ -} __packed; - -/** - * struct sta_id_modify - * @addr[ETH_ALEN]: station's MAC address - * @sta_id: idx of station in uCode's station table - * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change - * - * Driver selects unused table idx when adding new station, - * or the idx to a pre-existing station entry when modifying that station. - * Some idxes have special purposes (IL_AP_ID, idx 0, is for AP). - * - * modify_mask flags select which parameters to modify vs. leave alone. - */ -struct sta_id_modify { - u8 addr[ETH_ALEN]; - __le16 reserved1; - u8 sta_id; - u8 modify_mask; - __le16 reserved2; -} __packed; - -/* - * C_ADD_STA = 0x18 (command) - * - * The device contains an internal table of per-station information, - * with info on security keys, aggregation parameters, and Tx rates for - * initial Tx attempt and any retries (4965 devices uses - * C_TX_LINK_QUALITY_CMD, - * 3945 uses C_RATE_SCALE to set up rate tables). - * - * C_ADD_STA sets up the table entry for one station, either creating - * a new entry, or modifying a pre-existing one. - * - * NOTE: RXON command (without "associated" bit set) wipes the station table - * clean. Moving into RF_KILL state does this also. Driver must set up - * new station table before transmitting anything on the RXON channel - * (except active scans or active measurements; those commands carry - * their own txpower/rate setup data). - * - * When getting started on a new channel, driver must set up the - * IL_BROADCAST_ID entry (last entry in the table). For a client - * station in a BSS, once an AP is selected, driver sets up the AP STA - * in the IL_AP_ID entry (1st entry in the table). BROADCAST and AP - * are all that are needed for a BSS client station. If the device is - * used as AP, or in an IBSS network, driver must set up station table - * entries for all STAs in network, starting with idx IL_STA_ID. - */ - -struct il3945_addsta_cmd { - u8 mode; /* 1: modify existing, 0: add new station */ - u8 reserved[3]; - struct sta_id_modify sta; - struct il4965_keyinfo key; - __le32 station_flags; /* STA_FLG_* */ - __le32 station_flags_msk; /* STA_FLG_* */ - - /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) - * corresponding to bit (e.g. bit 5 controls TID 5). - * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ - __le16 tid_disable_tx; - - __le16 rate_n_flags; - - /* TID for which to add block-ack support. - * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ - u8 add_immediate_ba_tid; - - /* TID for which to remove block-ack support. - * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ - u8 remove_immediate_ba_tid; - - /* Starting Sequence Number for added block-ack support. - * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ - __le16 add_immediate_ba_ssn; -} __packed; - -struct il4965_addsta_cmd { - u8 mode; /* 1: modify existing, 0: add new station */ - u8 reserved[3]; - struct sta_id_modify sta; - struct il4965_keyinfo key; - __le32 station_flags; /* STA_FLG_* */ - __le32 station_flags_msk; /* STA_FLG_* */ - - /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) - * corresponding to bit (e.g. bit 5 controls TID 5). - * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ - __le16 tid_disable_tx; - - __le16 reserved1; - - /* TID for which to add block-ack support. - * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ - u8 add_immediate_ba_tid; - - /* TID for which to remove block-ack support. - * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ - u8 remove_immediate_ba_tid; - - /* Starting Sequence Number for added block-ack support. - * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ - __le16 add_immediate_ba_ssn; - - /* - * Number of packets OK to transmit to station even though - * it is asleep -- used to synchronise PS-poll and u-APSD - * responses while ucode keeps track of STA sleep state. - */ - __le16 sleep_tx_count; - - __le16 reserved2; -} __packed; - -/* Wrapper struct for 3945 and 4965 addsta_cmd structures */ -struct il_addsta_cmd { - u8 mode; /* 1: modify existing, 0: add new station */ - u8 reserved[3]; - struct sta_id_modify sta; - struct il4965_keyinfo key; - __le32 station_flags; /* STA_FLG_* */ - __le32 station_flags_msk; /* STA_FLG_* */ - - /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) - * corresponding to bit (e.g. bit 5 controls TID 5). - * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ - __le16 tid_disable_tx; - - __le16 rate_n_flags; /* 3945 only */ - - /* TID for which to add block-ack support. - * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ - u8 add_immediate_ba_tid; - - /* TID for which to remove block-ack support. - * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ - u8 remove_immediate_ba_tid; - - /* Starting Sequence Number for added block-ack support. - * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ - __le16 add_immediate_ba_ssn; - - /* - * Number of packets OK to transmit to station even though - * it is asleep -- used to synchronise PS-poll and u-APSD - * responses while ucode keeps track of STA sleep state. - */ - __le16 sleep_tx_count; - - __le16 reserved2; -} __packed; - -#define ADD_STA_SUCCESS_MSK 0x1 -#define ADD_STA_NO_ROOM_IN_TBL 0x2 -#define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4 -#define ADD_STA_MODIFY_NON_EXIST_STA 0x8 -/* - * C_ADD_STA = 0x18 (response) - */ -struct il_add_sta_resp { - u8 status; /* ADD_STA_* */ -} __packed; - -#define REM_STA_SUCCESS_MSK 0x1 -/* - * C_REM_STA = 0x19 (response) - */ -struct il_rem_sta_resp { - u8 status; -} __packed; - -/* - * C_REM_STA = 0x19 (command) - */ -struct il_rem_sta_cmd { - u8 num_sta; /* number of removed stations */ - u8 reserved[3]; - u8 addr[ETH_ALEN]; /* MAC addr of the first station */ - u8 reserved2[2]; -} __packed; - -#define IL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0)) -#define IL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1)) -#define IL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2)) -#define IL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3)) -#define IL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00) - -#define IL_DROP_SINGLE 0 -#define IL_DROP_SELECTED 1 -#define IL_DROP_ALL 2 - -/* - * REPLY_WEP_KEY = 0x20 - */ -struct il_wep_key { - u8 key_idx; - u8 key_offset; - u8 reserved1[2]; - u8 key_size; - u8 reserved2[3]; - u8 key[16]; -} __packed; - -struct il_wep_cmd { - u8 num_keys; - u8 global_key_type; - u8 flags; - u8 reserved; - struct il_wep_key key[0]; -} __packed; - -#define WEP_KEY_WEP_TYPE 1 -#define WEP_KEYS_MAX 4 -#define WEP_INVALID_OFFSET 0xff -#define WEP_KEY_LEN_64 5 -#define WEP_KEY_LEN_128 13 - -/****************************************************************************** - * (4) - * Rx Responses: - * - *****************************************************************************/ - -#define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0) -#define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1) - -#define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0) -#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1) -#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2) -#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) -#define RX_RES_PHY_FLAGS_ANTENNA_MSK 0x70 -#define RX_RES_PHY_FLAGS_ANTENNA_POS 4 -#define RX_RES_PHY_FLAGS_AGG_MSK cpu_to_le16(1 << 7) - -#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) -#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) -#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) -#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) -#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) -#define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8) - -#define RX_RES_STATUS_STATION_FOUND (1<<6) -#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7) - -#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) -#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) -#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) -#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) -#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) - -#define RX_MPDU_RES_STATUS_ICV_OK (0x20) -#define RX_MPDU_RES_STATUS_MIC_OK (0x40) -#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7) -#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800) - -struct il3945_rx_frame_stats { - u8 phy_count; - u8 id; - u8 rssi; - u8 agc; - __le16 sig_avg; - __le16 noise_diff; - u8 payload[0]; -} __packed; - -struct il3945_rx_frame_hdr { - __le16 channel; - __le16 phy_flags; - u8 reserved1; - u8 rate; - __le16 len; - u8 payload[0]; -} __packed; - -struct il3945_rx_frame_end { - __le32 status; - __le64 timestamp; - __le32 beacon_timestamp; -} __packed; - -/* - * N_3945_RX = 0x1b (response only, not a command) - * - * NOTE: DO NOT dereference from casts to this structure - * It is provided only for calculating minimum data set size. - * The actual offsets of the hdr and end are dynamic based on - * stats.phy_count - */ -struct il3945_rx_frame { - struct il3945_rx_frame_stats stats; - struct il3945_rx_frame_hdr hdr; - struct il3945_rx_frame_end end; -} __packed; - -#define IL39_RX_FRAME_SIZE (4 + sizeof(struct il3945_rx_frame)) - -/* Fixed (non-configurable) rx data from phy */ - -#define IL49_RX_RES_PHY_CNT 14 -#define IL49_RX_PHY_FLAGS_ANTENNAE_OFFSET (4) -#define IL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70) -#define IL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ -#define IL49_AGC_DB_POS (7) -struct il4965_rx_non_cfg_phy { - __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ - __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ - u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */ - u8 pad[0]; -} __packed; - -/* - * N_RX = 0xc3 (response only, not a command) - * Used only for legacy (non 11n) frames. - */ -struct il_rx_phy_res { - u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ - u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ - u8 stat_id; /* configurable DSP phy data set ID */ - u8 reserved1; - __le64 timestamp; /* TSF at on air rise */ - __le32 beacon_time_stamp; /* beacon at on-air rise */ - __le16 phy_flags; /* general phy flags: band, modulation, ... */ - __le16 channel; /* channel number */ - u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */ - __le32 rate_n_flags; /* RATE_MCS_* */ - __le16 byte_count; /* frame's byte-count */ - __le16 frame_time; /* frame's time on the air */ -} __packed; - -struct il_rx_mpdu_res_start { - __le16 byte_count; - __le16 reserved; -} __packed; - -/****************************************************************************** - * (5) - * Tx Commands & Responses: - * - * Driver must place each C_TX command into one of the prioritized Tx - * queues in host DRAM, shared between driver and device (see comments for - * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode - * are preparing to transmit, the device pulls the Tx command over the PCI - * bus via one of the device's Tx DMA channels, to fill an internal FIFO - * from which data will be transmitted. - * - * uCode handles all timing and protocol related to control frames - * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler - * handle reception of block-acks; uCode updates the host driver via - * N_COMPRESSED_BA. - * - * uCode handles retrying Tx when an ACK is expected but not received. - * This includes trying lower data rates than the one requested in the Tx - * command, as set up by the C_RATE_SCALE (for 3945) or - * C_TX_LINK_QUALITY_CMD (4965). - * - * Driver sets up transmit power for various rates via C_TX_PWR_TBL. - * This command must be executed after every RXON command, before Tx can occur. - *****************************************************************************/ - -/* C_TX Tx flags field */ - -/* - * 1: Use Request-To-Send protocol before this frame. - * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. - */ -#define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1) - -/* - * 1: Transmit Clear-To-Send to self before this frame. - * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames. - * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. - */ -#define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2) - -/* 1: Expect ACK from receiving station - * 0: Don't expect ACK (MAC header's duration field s/b 0) - * Set this for unicast frames, but not broadcast/multicast. */ -#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3) - -/* For 4965 devices: - * 1: Use rate scale table (see C_TX_LINK_QUALITY_CMD). - * Tx command's initial_rate_idx indicates first rate to try; - * uCode walks through table for additional Tx attempts. - * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. - * This rate will be used for all Tx attempts; it will not be scaled. */ -#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4) - -/* 1: Expect immediate block-ack. - * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ -#define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6) - -/* - * 1: Frame requires full Tx-Op protection. - * Set this if either RTS or CTS Tx Flag gets set. - */ -#define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7) - -/* Tx antenna selection field; used only for 3945, reserved (0) for 4965 devices. - * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */ -#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) -#define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8) -#define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9) - -/* 1: uCode overrides sequence control field in MAC header. - * 0: Driver provides sequence control field in MAC header. - * Set this for management frames, non-QOS data frames, non-unicast frames, - * and also in Tx command embedded in C_SCAN for active scans. */ -#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13) - -/* 1: This frame is non-last MPDU; more fragments are coming. - * 0: Last fragment, or not using fragmentation. */ -#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14) - -/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. - * 0: No TSF required in outgoing frame. - * Set this for transmitting beacons and probe responses. */ -#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16) - -/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword - * alignment of frame's payload data field. - * 0: No pad - * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 - * field (but not both). Driver must align frame data (i.e. data following - * MAC header) to DWORD boundary. */ -#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20) - -/* accelerate aggregation support - * 0 - no CCMP encryption; 1 - CCMP encryption */ -#define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22) - -/* HCCA-AP - disable duration overwriting. */ -#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25) - -/* - * TX command security control - */ -#define TX_CMD_SEC_WEP 0x01 -#define TX_CMD_SEC_CCM 0x02 -#define TX_CMD_SEC_TKIP 0x03 -#define TX_CMD_SEC_MSK 0x03 -#define TX_CMD_SEC_SHIFT 6 -#define TX_CMD_SEC_KEY128 0x08 - -/* - * security overhead sizes - */ -#define WEP_IV_LEN 4 -#define WEP_ICV_LEN 4 -#define CCMP_MIC_LEN 8 -#define TKIP_ICV_LEN 4 - -/* - * C_TX = 0x1c (command) - */ - -struct il3945_tx_cmd { - /* - * MPDU byte count: - * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, - * + 8 byte IV for CCM or TKIP (not used for WEP) - * + Data payload - * + 8-byte MIC (not used for CCM/WEP) - * NOTE: Does not include Tx command bytes, post-MAC pad bytes, - * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i - * Range: 14-2342 bytes. - */ - __le16 len; - - /* - * MPDU or MSDU byte count for next frame. - * Used for fragmentation and bursting, but not 11n aggregation. - * Same as "len", but for next frame. Set to 0 if not applicable. - */ - __le16 next_frame_len; - - __le32 tx_flags; /* TX_CMD_FLG_* */ - - u8 rate; - - /* Index of recipient station in uCode's station table */ - u8 sta_id; - u8 tid_tspec; - u8 sec_ctl; - u8 key[16]; - union { - u8 byte[8]; - __le16 word[4]; - __le32 dw[2]; - } tkip_mic; - __le32 next_frame_info; - union { - __le32 life_time; - __le32 attempt; - } stop_time; - u8 supp_rates[2]; - u8 rts_retry_limit; /*byte 50 */ - u8 data_retry_limit; /*byte 51 */ - union { - __le16 pm_frame_timeout; - __le16 attempt_duration; - } timeout; - - /* - * Duration of EDCA burst Tx Opportunity, in 32-usec units. - * Set this if txop time is not specified by HCCA protocol (e.g. by AP). - */ - __le16 driver_txop; - - /* - * MAC header goes here, followed by 2 bytes padding if MAC header - * length is 26 or 30 bytes, followed by payload data - */ - u8 payload[0]; - struct ieee80211_hdr hdr[0]; -} __packed; - -/* - * C_TX = 0x1c (response) - */ -struct il3945_tx_resp { - u8 failure_rts; - u8 failure_frame; - u8 bt_kill_count; - u8 rate; - __le32 wireless_media_time; - __le32 status; /* TX status */ -} __packed; - -/* - * 4965 uCode updates these Tx attempt count values in host DRAM. - * Used for managing Tx retries when expecting block-acks. - * Driver should set these fields to 0. - */ -struct il_dram_scratch { - u8 try_cnt; /* Tx attempts */ - u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */ - __le16 reserved; -} __packed; - -struct il_tx_cmd { - /* - * MPDU byte count: - * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, - * + 8 byte IV for CCM or TKIP (not used for WEP) - * + Data payload - * + 8-byte MIC (not used for CCM/WEP) - * NOTE: Does not include Tx command bytes, post-MAC pad bytes, - * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i - * Range: 14-2342 bytes. - */ - __le16 len; - - /* - * MPDU or MSDU byte count for next frame. - * Used for fragmentation and bursting, but not 11n aggregation. - * Same as "len", but for next frame. Set to 0 if not applicable. - */ - __le16 next_frame_len; - - __le32 tx_flags; /* TX_CMD_FLG_* */ - - /* uCode may modify this field of the Tx command (in host DRAM!). - * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */ - struct il_dram_scratch scratch; - - /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */ - __le32 rate_n_flags; /* RATE_MCS_* */ - - /* Index of destination station in uCode's station table */ - u8 sta_id; - - /* Type of security encryption: CCM or TKIP */ - u8 sec_ctl; /* TX_CMD_SEC_* */ - - /* - * Index into rate table (see C_TX_LINK_QUALITY_CMD) for initial - * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for - * data frames, this field may be used to selectively reduce initial - * rate (via non-0 value) for special frames (e.g. management), while - * still supporting rate scaling for all frames. - */ - u8 initial_rate_idx; - u8 reserved; - u8 key[16]; - __le16 next_frame_flags; - __le16 reserved2; - union { - __le32 life_time; - __le32 attempt; - } stop_time; - - /* Host DRAM physical address pointer to "scratch" in this command. - * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */ - __le32 dram_lsb_ptr; - u8 dram_msb_ptr; - - u8 rts_retry_limit; /*byte 50 */ - u8 data_retry_limit; /*byte 51 */ - u8 tid_tspec; - union { - __le16 pm_frame_timeout; - __le16 attempt_duration; - } timeout; - - /* - * Duration of EDCA burst Tx Opportunity, in 32-usec units. - * Set this if txop time is not specified by HCCA protocol (e.g. by AP). - */ - __le16 driver_txop; - - /* - * MAC header goes here, followed by 2 bytes padding if MAC header - * length is 26 or 30 bytes, followed by payload data - */ - u8 payload[0]; - struct ieee80211_hdr hdr[0]; -} __packed; - -/* TX command response is sent after *3945* transmission attempts. - * - * NOTES: - * - * TX_STATUS_FAIL_NEXT_FRAG - * - * If the fragment flag in the MAC header for the frame being transmitted - * is set and there is insufficient time to transmit the next frame, the - * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'. - * - * TX_STATUS_FIFO_UNDERRUN - * - * Indicates the host did not provide bytes to the FIFO fast enough while - * a TX was in progress. - * - * TX_STATUS_FAIL_MGMNT_ABORT - * - * This status is only possible if the ABORT ON MGMT RX parameter was - * set to true with the TX command. - * - * If the MSB of the status parameter is set then an abort sequence is - * required. This sequence consists of the host activating the TX Abort - * control line, and then waiting for the TX Abort command response. This - * indicates that a the device is no longer in a transmit state, and that the - * command FIFO has been cleared. The host must then deactivate the TX Abort - * control line. Receiving is still allowed in this case. - */ -enum { - TX_3945_STATUS_SUCCESS = 0x01, - TX_3945_STATUS_DIRECT_DONE = 0x02, - TX_3945_STATUS_FAIL_SHORT_LIMIT = 0x82, - TX_3945_STATUS_FAIL_LONG_LIMIT = 0x83, - TX_3945_STATUS_FAIL_FIFO_UNDERRUN = 0x84, - TX_3945_STATUS_FAIL_MGMNT_ABORT = 0x85, - TX_3945_STATUS_FAIL_NEXT_FRAG = 0x86, - TX_3945_STATUS_FAIL_LIFE_EXPIRE = 0x87, - TX_3945_STATUS_FAIL_DEST_PS = 0x88, - TX_3945_STATUS_FAIL_ABORTED = 0x89, - TX_3945_STATUS_FAIL_BT_RETRY = 0x8a, - TX_3945_STATUS_FAIL_STA_INVALID = 0x8b, - TX_3945_STATUS_FAIL_FRAG_DROPPED = 0x8c, - TX_3945_STATUS_FAIL_TID_DISABLE = 0x8d, - TX_3945_STATUS_FAIL_FRAME_FLUSHED = 0x8e, - TX_3945_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, - TX_3945_STATUS_FAIL_TX_LOCKED = 0x90, - TX_3945_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, -}; - -/* - * TX command response is sent after *4965* transmission attempts. - * - * both postpone and abort status are expected behavior from uCode. there is - * no special operation required from driver; except for RFKILL_FLUSH, - * which required tx flush host command to flush all the tx frames in queues - */ -enum { - TX_STATUS_SUCCESS = 0x01, - TX_STATUS_DIRECT_DONE = 0x02, - /* postpone TX */ - TX_STATUS_POSTPONE_DELAY = 0x40, - TX_STATUS_POSTPONE_FEW_BYTES = 0x41, - TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43, - TX_STATUS_POSTPONE_CALC_TTAK = 0x44, - /* abort TX */ - TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81, - TX_STATUS_FAIL_SHORT_LIMIT = 0x82, - TX_STATUS_FAIL_LONG_LIMIT = 0x83, - TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, - TX_STATUS_FAIL_DRAIN_FLOW = 0x85, - TX_STATUS_FAIL_RFKILL_FLUSH = 0x86, - TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, - TX_STATUS_FAIL_DEST_PS = 0x88, - TX_STATUS_FAIL_HOST_ABORTED = 0x89, - TX_STATUS_FAIL_BT_RETRY = 0x8a, - TX_STATUS_FAIL_STA_INVALID = 0x8b, - TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, - TX_STATUS_FAIL_TID_DISABLE = 0x8d, - TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e, - TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, - TX_STATUS_FAIL_PASSIVE_NO_RX = 0x90, - TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, -}; - -#define TX_PACKET_MODE_REGULAR 0x0000 -#define TX_PACKET_MODE_BURST_SEQ 0x0100 -#define TX_PACKET_MODE_BURST_FIRST 0x0200 - -enum { - TX_POWER_PA_NOT_ACTIVE = 0x0, -}; - -enum { - TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ - TX_STATUS_DELAY_MSK = 0x00000040, - TX_STATUS_ABORT_MSK = 0x00000080, - TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ - TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ - TX_RESERVED = 0x00780000, /* bits 19:22 */ - TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ - TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ -}; - -/* ******************************* - * TX aggregation status - ******************************* */ - -enum { - AGG_TX_STATE_TRANSMITTED = 0x00, - AGG_TX_STATE_UNDERRUN_MSK = 0x01, - AGG_TX_STATE_FEW_BYTES_MSK = 0x04, - AGG_TX_STATE_ABORT_MSK = 0x08, - AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10, - AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20, - AGG_TX_STATE_SCD_QUERY_MSK = 0x80, - AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100, - AGG_TX_STATE_RESPONSE_MSK = 0x1ff, - AGG_TX_STATE_DUMP_TX_MSK = 0x200, - AGG_TX_STATE_DELAY_TX_MSK = 0x400 -}; - -#define AGG_TX_STATUS_MSK 0x00000fff /* bits 0:11 */ -#define AGG_TX_TRY_MSK 0x0000f000 /* bits 12:15 */ - -#define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \ - AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK) - -/* # tx attempts for first frame in aggregation */ -#define AGG_TX_STATE_TRY_CNT_POS 12 -#define AGG_TX_STATE_TRY_CNT_MSK 0xf000 - -/* Command ID and sequence number of Tx command for this frame */ -#define AGG_TX_STATE_SEQ_NUM_POS 16 -#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 - -/* - * C_TX = 0x1c (response) - * - * This response may be in one of two slightly different formats, indicated - * by the frame_count field: - * - * 1) No aggregation (frame_count == 1). This reports Tx results for - * a single frame. Multiple attempts, at various bit rates, may have - * been made for this frame. - * - * 2) Aggregation (frame_count > 1). This reports Tx results for - * 2 or more frames that used block-acknowledge. All frames were - * transmitted at same rate. Rate scaling may have been used if first - * frame in this new agg block failed in previous agg block(s). - * - * Note that, for aggregation, ACK (block-ack) status is not delivered here; - * block-ack has not been received by the time the 4965 device records - * this status. - * This status relates to reasons the tx might have been blocked or aborted - * within the sending station (this 4965 device), rather than whether it was - * received successfully by the destination station. - */ -struct agg_tx_status { - __le16 status; - __le16 sequence; -} __packed; - -struct il4965_tx_resp { - u8 frame_count; /* 1 no aggregation, >1 aggregation */ - u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */ - u8 failure_rts; /* # failures due to unsuccessful RTS */ - u8 failure_frame; /* # failures due to no ACK (unused for agg) */ - - /* For non-agg: Rate at which frame was successful. - * For agg: Rate at which all frames were transmitted. */ - __le32 rate_n_flags; /* RATE_MCS_* */ - - /* For non-agg: RTS + CTS + frame tx attempts time + ACK. - * For agg: RTS + CTS + aggregation tx time + block-ack time. */ - __le16 wireless_media_time; /* uSecs */ - - __le16 reserved; - __le32 pa_power1; /* RF power amplifier measurement (not used) */ - __le32 pa_power2; - - /* - * For non-agg: frame status TX_STATUS_* - * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status - * fields follow this one, up to frame_count. - * Bit fields: - * 11- 0: AGG_TX_STATE_* status code - * 15-12: Retry count for 1st frame in aggregation (retries - * occur if tx failed for this frame when it was a - * member of a previous aggregation block). If rate - * scaling is used, retry count indicates the rate - * table entry used for all frames in the new agg. - * 31-16: Sequence # for this frame's Tx cmd (not SSN!) - */ - union { - __le32 status; - struct agg_tx_status agg_status[0]; /* for each agg frame */ - } u; -} __packed; - -/* - * N_COMPRESSED_BA = 0xc5 (response only, not a command) - * - * Reports Block-Acknowledge from recipient station - */ -struct il_compressed_ba_resp { - __le32 sta_addr_lo32; - __le16 sta_addr_hi16; - __le16 reserved; - - /* Index of recipient (BA-sending) station in uCode's station table */ - u8 sta_id; - u8 tid; - __le16 seq_ctl; - __le64 bitmap; - __le16 scd_flow; - __le16 scd_ssn; -} __packed; - -/* - * C_TX_PWR_TBL = 0x97 (command, has simple generic response) - * - * See details under "TXPOWER" in 4965.h. - */ - -struct il3945_txpowertable_cmd { - u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ - u8 reserved; - __le16 channel; - struct il3945_power_per_rate power[IL_MAX_RATES]; -} __packed; - -struct il4965_txpowertable_cmd { - u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ - u8 reserved; - __le16 channel; - struct il4965_tx_power_db tx_power; -} __packed; - -/** - * struct il3945_rate_scaling_cmd - Rate Scaling Command & Response - * - * C_RATE_SCALE = 0x47 (command, has simple generic response) - * - * NOTE: The table of rates passed to the uCode via the - * RATE_SCALE command sets up the corresponding order of - * rates used for all related commands, including rate - * masks, etc. - * - * For example, if you set 9MB (PLCP 0x0f) as the first - * rate in the rate table, the bit mask for that rate - * when passed through ofdm_basic_rates on the C_RXON - * command would be bit 0 (1 << 0) - */ -struct il3945_rate_scaling_info { - __le16 rate_n_flags; - u8 try_cnt; - u8 next_rate_idx; -} __packed; - -struct il3945_rate_scaling_cmd { - u8 table_id; - u8 reserved[3]; - struct il3945_rate_scaling_info table[IL_MAX_RATES]; -} __packed; - -/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ -#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0) - -/* # of EDCA prioritized tx fifos */ -#define LINK_QUAL_AC_NUM AC_NUM - -/* # entries in rate scale table to support Tx retries */ -#define LINK_QUAL_MAX_RETRY_NUM 16 - -/* Tx antenna selection values */ -#define LINK_QUAL_ANT_A_MSK (1 << 0) -#define LINK_QUAL_ANT_B_MSK (1 << 1) -#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) - -/** - * struct il_link_qual_general_params - * - * Used in C_TX_LINK_QUALITY_CMD - */ -struct il_link_qual_general_params { - u8 flags; - - /* No entries at or above this (driver chosen) idx contain MIMO */ - u8 mimo_delimiter; - - /* Best single antenna to use for single stream (legacy, SISO). */ - u8 single_stream_ant_msk; /* LINK_QUAL_ANT_* */ - - /* Best antennas to use for MIMO (unused for 4965, assumes both). */ - u8 dual_stream_ant_msk; /* LINK_QUAL_ANT_* */ - - /* - * If driver needs to use different initial rates for different - * EDCA QOS access categories (as implemented by tx fifos 0-3), - * this table will set that up, by indicating the idxes in the - * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start. - * Otherwise, driver should set all entries to 0. - * - * Entry usage: - * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice - * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3. - */ - u8 start_rate_idx[LINK_QUAL_AC_NUM]; -} __packed; - -#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */ -#define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000) -#define LINK_QUAL_AGG_TIME_LIMIT_MIN (100) - -#define LINK_QUAL_AGG_DISABLE_START_DEF (3) -#define LINK_QUAL_AGG_DISABLE_START_MAX (255) -#define LINK_QUAL_AGG_DISABLE_START_MIN (0) - -#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (31) -#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63) -#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0) - -/** - * struct il_link_qual_agg_params - * - * Used in C_TX_LINK_QUALITY_CMD - */ -struct il_link_qual_agg_params { - - /* - *Maximum number of uSec in aggregation. - * default set to 4000 (4 milliseconds) if not configured in .cfg - */ - __le16 agg_time_limit; - - /* - * Number of Tx retries allowed for a frame, before that frame will - * no longer be considered for the start of an aggregation sequence - * (scheduler will then try to tx it as single frame). - * Driver should set this to 3. - */ - u8 agg_dis_start_th; - - /* - * Maximum number of frames in aggregation. - * 0 = no limit (default). 1 = no aggregation. - * Other values = max # frames in aggregation. - */ - u8 agg_frame_cnt_limit; - - __le32 reserved; -} __packed; - -/* - * C_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) - * - * For 4965 devices only; 3945 uses C_RATE_SCALE. - * - * Each station in the 4965 device's internal station table has its own table - * of 16 - * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when - * an ACK is not received. This command replaces the entire table for - * one station. - * - * NOTE: Station must already be in 4965 device's station table. - * Use C_ADD_STA. - * - * The rate scaling procedures described below work well. Of course, other - * procedures are possible, and may work better for particular environments. - * - * - * FILLING THE RATE TBL - * - * Given a particular initial rate and mode, as determined by the rate - * scaling algorithm described below, the Linux driver uses the following - * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the - * Link Quality command: - * - * - * 1) If using High-throughput (HT) (SISO or MIMO) initial rate: - * a) Use this same initial rate for first 3 entries. - * b) Find next lower available rate using same mode (SISO or MIMO), - * use for next 3 entries. If no lower rate available, switch to - * legacy mode (no HT40 channel, no MIMO, no short guard interval). - * c) If using MIMO, set command's mimo_delimiter to number of entries - * using MIMO (3 or 6). - * d) After trying 2 HT rates, switch to legacy mode (no HT40 channel, - * no MIMO, no short guard interval), at the next lower bit rate - * (e.g. if second HT bit rate was 54, try 48 legacy), and follow - * legacy procedure for remaining table entries. - * - * 2) If using legacy initial rate: - * a) Use the initial rate for only one entry. - * b) For each following entry, reduce the rate to next lower available - * rate, until reaching the lowest available rate. - * c) When reducing rate, also switch antenna selection. - * d) Once lowest available rate is reached, repeat this rate until - * rate table is filled (16 entries), switching antenna each entry. - * - * - * ACCUMULATING HISTORY - * - * The rate scaling algorithm for 4965 devices, as implemented in Linux driver, - * uses two sets of frame Tx success history: One for the current/active - * modulation mode, and one for a speculative/search mode that is being - * attempted. If the speculative mode turns out to be more effective (i.e. - * actual transfer rate is better), then the driver continues to use the - * speculative mode as the new current active mode. - * - * Each history set contains, separately for each possible rate, data for a - * sliding win of the 62 most recent tx attempts at that rate. The data - * includes a shifting bitmap of success(1)/failure(0), and sums of successful - * and attempted frames, from which the driver can additionally calculate a - * success ratio (success / attempted) and number of failures - * (attempted - success), and control the size of the win (attempted). - * The driver uses the bit map to remove successes from the success sum, as - * the oldest tx attempts fall out of the win. - * - * When the 4965 device makes multiple tx attempts for a given frame, each - * attempt might be at a different rate, and have different modulation - * characteristics (e.g. antenna, fat channel, short guard interval), as set - * up in the rate scaling table in the Link Quality command. The driver must - * determine which rate table entry was used for each tx attempt, to determine - * which rate-specific history to update, and record only those attempts that - * match the modulation characteristics of the history set. - * - * When using block-ack (aggregation), all frames are transmitted at the same - * rate, since there is no per-attempt acknowledgment from the destination - * station. The Tx response struct il_tx_resp indicates the Tx rate in - * rate_n_flags field. After receiving a block-ack, the driver can update - * history for the entire block all at once. - * - * - * FINDING BEST STARTING RATE: - * - * When working with a selected initial modulation mode (see below), the - * driver attempts to find a best initial rate. The initial rate is the - * first entry in the Link Quality command's rate table. - * - * 1) Calculate actual throughput (success ratio * expected throughput, see - * table below) for current initial rate. Do this only if enough frames - * have been attempted to make the value meaningful: at least 6 failed - * tx attempts, or at least 8 successes. If not enough, don't try rate - * scaling yet. - * - * 2) Find available rates adjacent to current initial rate. Available means: - * a) supported by hardware && - * b) supported by association && - * c) within any constraints selected by user - * - * 3) Gather measured throughputs for adjacent rates. These might not have - * enough history to calculate a throughput. That's okay, we might try - * using one of them anyway! - * - * 4) Try decreasing rate if, for current rate: - * a) success ratio is < 15% || - * b) lower adjacent rate has better measured throughput || - * c) higher adjacent rate has worse throughput, and lower is unmeasured - * - * As a sanity check, if decrease was determined above, leave rate - * unchanged if: - * a) lower rate unavailable - * b) success ratio at current rate > 85% (very good) - * c) current measured throughput is better than expected throughput - * of lower rate (under perfect 100% tx conditions, see table below) - * - * 5) Try increasing rate if, for current rate: - * a) success ratio is < 15% || - * b) both adjacent rates' throughputs are unmeasured (try it!) || - * b) higher adjacent rate has better measured throughput || - * c) lower adjacent rate has worse throughput, and higher is unmeasured - * - * As a sanity check, if increase was determined above, leave rate - * unchanged if: - * a) success ratio at current rate < 70%. This is not particularly - * good performance; higher rate is sure to have poorer success. - * - * 6) Re-evaluate the rate after each tx frame. If working with block- - * acknowledge, history and stats may be calculated for the entire - * block (including prior history that fits within the history wins), - * before re-evaluation. - * - * FINDING BEST STARTING MODULATION MODE: - * - * After working with a modulation mode for a "while" (and doing rate scaling), - * the driver searches for a new initial mode in an attempt to improve - * throughput. The "while" is measured by numbers of attempted frames: - * - * For legacy mode, search for new mode after: - * 480 successful frames, or 160 failed frames - * For high-throughput modes (SISO or MIMO), search for new mode after: - * 4500 successful frames, or 400 failed frames - * - * Mode switch possibilities are (3 for each mode): - * - * For legacy: - * Change antenna, try SISO (if HT association), try MIMO (if HT association) - * For SISO: - * Change antenna, try MIMO, try shortened guard interval (SGI) - * For MIMO: - * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI) - * - * When trying a new mode, use the same bit rate as the old/current mode when - * trying antenna switches and shortened guard interval. When switching to - * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate - * for which the expected throughput (under perfect conditions) is about the - * same or slightly better than the actual measured throughput delivered by - * the old/current mode. - * - * Actual throughput can be estimated by multiplying the expected throughput - * by the success ratio (successful / attempted tx frames). Frame size is - * not considered in this calculation; it assumes that frame size will average - * out to be fairly consistent over several samples. The following are - * metric values for expected throughput assuming 100% success ratio. - * Only G band has support for CCK rates: - * - * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60 - * - * G: 7 13 35 58 40 57 72 98 121 154 177 186 186 - * A: 0 0 0 0 40 57 72 98 121 154 177 186 186 - * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202 - * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211 - * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251 - * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257 - * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257 - * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264 - * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289 - * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293 - * - * After the new mode has been tried for a short while (minimum of 6 failed - * frames or 8 successful frames), compare success ratio and actual throughput - * estimate of the new mode with the old. If either is better with the new - * mode, continue to use the new mode. - * - * Continue comparing modes until all 3 possibilities have been tried. - * If moving from legacy to HT, try all 3 possibilities from the new HT - * mode. After trying all 3, a best mode is found. Continue to use this mode - * for the longer "while" described above (e.g. 480 successful frames for - * legacy), and then repeat the search process. - * - */ -struct il_link_quality_cmd { - - /* Index of destination/recipient station in uCode's station table */ - u8 sta_id; - u8 reserved1; - __le16 control; /* not used */ - struct il_link_qual_general_params general_params; - struct il_link_qual_agg_params agg_params; - - /* - * Rate info; when using rate-scaling, Tx command's initial_rate_idx - * specifies 1st Tx rate attempted, via idx into this table. - * 4965 devices works its way through table when retrying Tx. - */ - struct { - __le32 rate_n_flags; /* RATE_MCS_*, RATE_* */ - } rs_table[LINK_QUAL_MAX_RETRY_NUM]; - __le32 reserved2; -} __packed; - -/* - * BT configuration enable flags: - * bit 0 - 1: BT channel announcement enabled - * 0: disable - * bit 1 - 1: priority of BT device enabled - * 0: disable - */ -#define BT_COEX_DISABLE (0x0) -#define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0) -#define BT_ENABLE_PRIORITY BIT(1) - -#define BT_COEX_ENABLE (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY) - -#define BT_LEAD_TIME_DEF (0x1E) - -#define BT_MAX_KILL_DEF (0x5) - -/* - * C_BT_CONFIG = 0x9b (command, has simple generic response) - * - * 3945 and 4965 devices support hardware handshake with Bluetooth device on - * same platform. Bluetooth device alerts wireless device when it will Tx; - * wireless device can delay or kill its own Tx to accommodate. - */ -struct il_bt_cmd { - u8 flags; - u8 lead_time; - u8 max_kill; - u8 reserved; - __le32 kill_ack_mask; - __le32 kill_cts_mask; -} __packed; - -/****************************************************************************** - * (6) - * Spectrum Management (802.11h) Commands, Responses, Notifications: - * - *****************************************************************************/ - -/* - * Spectrum Management - */ -#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \ - RXON_FILTER_CTL2HOST_MSK | \ - RXON_FILTER_ACCEPT_GRP_MSK | \ - RXON_FILTER_DIS_DECRYPT_MSK | \ - RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ - RXON_FILTER_ASSOC_MSK | \ - RXON_FILTER_BCON_AWARE_MSK) - -struct il_measure_channel { - __le32 duration; /* measurement duration in extended beacon - * format */ - u8 channel; /* channel to measure */ - u8 type; /* see enum il_measure_type */ - __le16 reserved; -} __packed; - -/* - * C_SPECTRUM_MEASUREMENT = 0x74 (command) - */ -struct il_spectrum_cmd { - __le16 len; /* number of bytes starting from token */ - u8 token; /* token id */ - u8 id; /* measurement id -- 0 or 1 */ - u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */ - u8 periodic; /* 1 = periodic */ - __le16 path_loss_timeout; - __le32 start_time; /* start time in extended beacon format */ - __le32 reserved2; - __le32 flags; /* rxon flags */ - __le32 filter_flags; /* rxon filter flags */ - __le16 channel_count; /* minimum 1, maximum 10 */ - __le16 reserved3; - struct il_measure_channel channels[10]; -} __packed; - -/* - * C_SPECTRUM_MEASUREMENT = 0x74 (response) - */ -struct il_spectrum_resp { - u8 token; - u8 id; /* id of the prior command replaced, or 0xff */ - __le16 status; /* 0 - command will be handled - * 1 - cannot handle (conflicts with another - * measurement) */ -} __packed; - -enum il_measurement_state { - IL_MEASUREMENT_START = 0, - IL_MEASUREMENT_STOP = 1, -}; - -enum il_measurement_status { - IL_MEASUREMENT_OK = 0, - IL_MEASUREMENT_CONCURRENT = 1, - IL_MEASUREMENT_CSA_CONFLICT = 2, - IL_MEASUREMENT_TGH_CONFLICT = 3, - /* 4-5 reserved */ - IL_MEASUREMENT_STOPPED = 6, - IL_MEASUREMENT_TIMEOUT = 7, - IL_MEASUREMENT_PERIODIC_FAILED = 8, -}; - -#define NUM_ELEMENTS_IN_HISTOGRAM 8 - -struct il_measurement_histogram { - __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ - __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ -} __packed; - -/* clear channel availability counters */ -struct il_measurement_cca_counters { - __le32 ofdm; - __le32 cck; -} __packed; - -enum il_measure_type { - IL_MEASURE_BASIC = (1 << 0), - IL_MEASURE_CHANNEL_LOAD = (1 << 1), - IL_MEASURE_HISTOGRAM_RPI = (1 << 2), - IL_MEASURE_HISTOGRAM_NOISE = (1 << 3), - IL_MEASURE_FRAME = (1 << 4), - /* bits 5:6 are reserved */ - IL_MEASURE_IDLE = (1 << 7), -}; - -/* - * N_SPECTRUM_MEASUREMENT = 0x75 (notification only, not a command) - */ -struct il_spectrum_notification { - u8 id; /* measurement id -- 0 or 1 */ - u8 token; - u8 channel_idx; /* idx in measurement channel list */ - u8 state; /* 0 - start, 1 - stop */ - __le32 start_time; /* lower 32-bits of TSF */ - u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ - u8 channel; - u8 type; /* see enum il_measurement_type */ - u8 reserved1; - /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only - * valid if applicable for measurement type requested. */ - __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */ - __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */ - __le32 cca_time; /* channel load time in usecs */ - u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - - * unidentified */ - u8 reserved2[3]; - struct il_measurement_histogram histogram; - __le32 stop_time; /* lower 32-bits of TSF */ - __le32 status; /* see il_measurement_status */ -} __packed; - -/****************************************************************************** - * (7) - * Power Management Commands, Responses, Notifications: - * - *****************************************************************************/ - -/** - * struct il_powertable_cmd - Power Table Command - * @flags: See below: - * - * C_POWER_TBL = 0x77 (command, has simple generic response) - * - * PM allow: - * bit 0 - '0' Driver not allow power management - * '1' Driver allow PM (use rest of parameters) - * - * uCode send sleep notifications: - * bit 1 - '0' Don't send sleep notification - * '1' send sleep notification (SEND_PM_NOTIFICATION) - * - * Sleep over DTIM - * bit 2 - '0' PM have to walk up every DTIM - * '1' PM could sleep over DTIM till listen Interval. - * - * PCI power managed - * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1) - * '1' !(PCI_CFG_LINK_CTRL & 0x1) - * - * Fast PD - * bit 4 - '1' Put radio to sleep when receiving frame for others - * - * Force sleep Modes - * bit 31/30- '00' use both mac/xtal sleeps - * '01' force Mac sleep - * '10' force xtal sleep - * '11' Illegal set - * - * NOTE: if sleep_interval[SLEEP_INTRVL_TBL_SIZE-1] > DTIM period then - * ucode assume sleep over DTIM is allowed and we don't need to wake up - * for every DTIM. - */ -#define IL_POWER_VEC_SIZE 5 - -#define IL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0)) -#define IL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3)) - -struct il3945_powertable_cmd { - __le16 flags; - u8 reserved[2]; - __le32 rx_data_timeout; - __le32 tx_data_timeout; - __le32 sleep_interval[IL_POWER_VEC_SIZE]; -} __packed; - -struct il_powertable_cmd { - __le16 flags; - u8 keep_alive_seconds; /* 3945 reserved */ - u8 debug_flags; /* 3945 reserved */ - __le32 rx_data_timeout; - __le32 tx_data_timeout; - __le32 sleep_interval[IL_POWER_VEC_SIZE]; - __le32 keep_alive_beacons; -} __packed; - -/* - * N_PM_SLEEP = 0x7A (notification only, not a command) - * all devices identical. - */ -struct il_sleep_notification { - u8 pm_sleep_mode; - u8 pm_wakeup_src; - __le16 reserved; - __le32 sleep_time; - __le32 tsf_low; - __le32 bcon_timer; -} __packed; - -/* Sleep states. all devices identical. */ -enum { - IL_PM_NO_SLEEP = 0, - IL_PM_SLP_MAC = 1, - IL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, - IL_PM_SLP_FULL_MAC_CARD_STATE = 3, - IL_PM_SLP_PHY = 4, - IL_PM_SLP_REPENT = 5, - IL_PM_WAKEUP_BY_TIMER = 6, - IL_PM_WAKEUP_BY_DRIVER = 7, - IL_PM_WAKEUP_BY_RFKILL = 8, - /* 3 reserved */ - IL_PM_NUM_OF_MODES = 12, -}; - -/* - * N_CARD_STATE = 0xa1 (notification only, not a command) - */ -struct il_card_state_notif { - __le32 flags; -} __packed; - -#define HW_CARD_DISABLED 0x01 -#define SW_CARD_DISABLED 0x02 -#define CT_CARD_DISABLED 0x04 -#define RXON_CARD_DISABLED 0x10 - -struct il_ct_kill_config { - __le32 reserved; - __le32 critical_temperature_M; - __le32 critical_temperature_R; -} __packed; - -/****************************************************************************** - * (8) - * Scan Commands, Responses, Notifications: - * - *****************************************************************************/ - -#define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0) -#define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1) - -/** - * struct il_scan_channel - entry in C_SCAN channel table - * - * One for each channel in the scan list. - * Each channel can independently select: - * 1) SSID for directed active scans - * 2) Txpower setting (for rate specified within Tx command) - * 3) How long to stay on-channel (behavior may be modified by quiet_time, - * quiet_plcp_th, good_CRC_th) - * - * To avoid uCode errors, make sure the following are true (see comments - * under struct il_scan_cmd about max_out_time and quiet_time): - * 1) If using passive_dwell (i.e. passive_dwell != 0): - * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) - * 2) quiet_time <= active_dwell - * 3) If restricting off-channel time (i.e. max_out_time !=0): - * passive_dwell < max_out_time - * active_dwell < max_out_time - */ -struct il3945_scan_channel { - /* - * type is defined as: - * 0:0 1 = active, 0 = passive - * 1:4 SSID direct bit map; if a bit is set, then corresponding - * SSID IE is transmitted in probe request. - * 5:7 reserved - */ - u8 type; - u8 channel; /* band is selected by il3945_scan_cmd "flags" field */ - struct il3945_tx_power tpc; - __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ - __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ -} __packed; - -/* set number of direct probes u8 type */ -#define IL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1)))) - -struct il_scan_channel { - /* - * type is defined as: - * 0:0 1 = active, 0 = passive - * 1:20 SSID direct bit map; if a bit is set, then corresponding - * SSID IE is transmitted in probe request. - * 21:31 reserved - */ - __le32 type; - __le16 channel; /* band is selected by il_scan_cmd "flags" field */ - u8 tx_gain; /* gain for analog radio */ - u8 dsp_atten; /* gain for DSP */ - __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ - __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ -} __packed; - -/* set number of direct probes __le32 type */ -#define IL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) - -/** - * struct il_ssid_ie - directed scan network information element - * - * Up to 20 of these may appear in C_SCAN (Note: Only 4 are in - * 3945 SCAN api), selected by "type" bit field in struct il_scan_channel; - * each channel may select different ssids from among the 20 (4) entries. - * SSID IEs get transmitted in reverse order of entry. - */ -struct il_ssid_ie { - u8 id; - u8 len; - u8 ssid[32]; -} __packed; - -#define PROBE_OPTION_MAX_3945 4 -#define PROBE_OPTION_MAX 20 -#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) -#define IL_GOOD_CRC_TH_DISABLED 0 -#define IL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1) -#define IL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff) -#define IL_MAX_SCAN_SIZE 1024 -#define IL_MAX_CMD_SIZE 4096 - -/* - * C_SCAN = 0x80 (command) - * - * The hardware scan command is very powerful; the driver can set it up to - * maintain (relatively) normal network traffic while doing a scan in the - * background. The max_out_time and suspend_time control the ratio of how - * long the device stays on an associated network channel ("service channel") - * vs. how long it's away from the service channel, i.e. tuned to other channels - * for scanning. - * - * max_out_time is the max time off-channel (in usec), and suspend_time - * is how long (in "extended beacon" format) that the scan is "suspended" - * after returning to the service channel. That is, suspend_time is the - * time that we stay on the service channel, doing normal work, between - * scan segments. The driver may set these parameters differently to support - * scanning when associated vs. not associated, and light vs. heavy traffic - * loads when associated. - * - * After receiving this command, the device's scan engine does the following; - * - * 1) Sends SCAN_START notification to driver - * 2) Checks to see if it has time to do scan for one channel - * 3) Sends NULL packet, with power-save (PS) bit set to 1, - * to tell AP that we're going off-channel - * 4) Tunes to first channel in scan list, does active or passive scan - * 5) Sends SCAN_RESULT notification to driver - * 6) Checks to see if it has time to do scan on *next* channel in list - * 7) Repeats 4-6 until it no longer has time to scan the next channel - * before max_out_time expires - * 8) Returns to service channel - * 9) Sends NULL packet with PS=0 to tell AP that we're back - * 10) Stays on service channel until suspend_time expires - * 11) Repeats entire process 2-10 until list is complete - * 12) Sends SCAN_COMPLETE notification - * - * For fast, efficient scans, the scan command also has support for staying on - * a channel for just a short time, if doing active scanning and getting no - * responses to the transmitted probe request. This time is controlled by - * quiet_time, and the number of received packets below which a channel is - * considered "quiet" is controlled by quiet_plcp_threshold. - * - * For active scanning on channels that have regulatory restrictions against - * blindly transmitting, the scan can listen before transmitting, to make sure - * that there is already legitimate activity on the channel. If enough - * packets are cleanly received on the channel (controlled by good_CRC_th, - * typical value 1), the scan engine starts transmitting probe requests. - * - * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. - * - * To avoid uCode errors, see timing restrictions described under - * struct il_scan_channel. - */ - -struct il3945_scan_cmd { - __le16 len; - u8 reserved0; - u8 channel_count; /* # channels in channel list */ - __le16 quiet_time; /* dwell only this # millisecs on quiet channel - * (only for active scan) */ - __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ - __le16 good_CRC_th; /* passive -> active promotion threshold */ - __le16 reserved1; - __le32 max_out_time; /* max usec to be away from associated (service) - * channel */ - __le32 suspend_time; /* pause scan this long (in "extended beacon - * format") when returning to service channel: - * 3945; 31:24 # beacons, 19:0 additional usec, - * 4965; 31:22 # beacons, 21:0 additional usec. - */ - __le32 flags; /* RXON_FLG_* */ - __le32 filter_flags; /* RXON_FILTER_* */ - - /* For active scans (set to all-0s for passive scans). - * Does not include payload. Must specify Tx rate; no rate scaling. */ - struct il3945_tx_cmd tx_cmd; - - /* For directed active scans (set to all-0s otherwise) */ - struct il_ssid_ie direct_scan[PROBE_OPTION_MAX_3945]; - - /* - * Probe request frame, followed by channel list. - * - * Size of probe request frame is specified by byte count in tx_cmd. - * Channel list follows immediately after probe request frame. - * Number of channels in list is specified by channel_count. - * Each channel in list is of type: - * - * struct il3945_scan_channel channels[0]; - * - * NOTE: Only one band of channels can be scanned per pass. You - * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait - * for one scan to complete (i.e. receive N_SCAN_COMPLETE) - * before requesting another scan. - */ - u8 data[0]; -} __packed; - -struct il_scan_cmd { - __le16 len; - u8 reserved0; - u8 channel_count; /* # channels in channel list */ - __le16 quiet_time; /* dwell only this # millisecs on quiet channel - * (only for active scan) */ - __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ - __le16 good_CRC_th; /* passive -> active promotion threshold */ - __le16 rx_chain; /* RXON_RX_CHAIN_* */ - __le32 max_out_time; /* max usec to be away from associated (service) - * channel */ - __le32 suspend_time; /* pause scan this long (in "extended beacon - * format") when returning to service chnl: - * 3945; 31:24 # beacons, 19:0 additional usec, - * 4965; 31:22 # beacons, 21:0 additional usec. - */ - __le32 flags; /* RXON_FLG_* */ - __le32 filter_flags; /* RXON_FILTER_* */ - - /* For active scans (set to all-0s for passive scans). - * Does not include payload. Must specify Tx rate; no rate scaling. */ - struct il_tx_cmd tx_cmd; - - /* For directed active scans (set to all-0s otherwise) */ - struct il_ssid_ie direct_scan[PROBE_OPTION_MAX]; - - /* - * Probe request frame, followed by channel list. - * - * Size of probe request frame is specified by byte count in tx_cmd. - * Channel list follows immediately after probe request frame. - * Number of channels in list is specified by channel_count. - * Each channel in list is of type: - * - * struct il_scan_channel channels[0]; - * - * NOTE: Only one band of channels can be scanned per pass. You - * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait - * for one scan to complete (i.e. receive N_SCAN_COMPLETE) - * before requesting another scan. - */ - u8 data[0]; -} __packed; - -/* Can abort will notify by complete notification with abort status. */ -#define CAN_ABORT_STATUS cpu_to_le32(0x1) -/* complete notification statuses */ -#define ABORT_STATUS 0x2 - -/* - * C_SCAN = 0x80 (response) - */ -struct il_scanreq_notification { - __le32 status; /* 1: okay, 2: cannot fulfill request */ -} __packed; - -/* - * N_SCAN_START = 0x82 (notification only, not a command) - */ -struct il_scanstart_notification { - __le32 tsf_low; - __le32 tsf_high; - __le32 beacon_timer; - u8 channel; - u8 band; - u8 reserved[2]; - __le32 status; -} __packed; - -#define SCAN_OWNER_STATUS 0x1 -#define MEASURE_OWNER_STATUS 0x2 - -#define IL_PROBE_STATUS_OK 0 -#define IL_PROBE_STATUS_TX_FAILED BIT(0) -/* error statuses combined with TX_FAILED */ -#define IL_PROBE_STATUS_FAIL_TTL BIT(1) -#define IL_PROBE_STATUS_FAIL_BT BIT(2) - -#define NUMBER_OF_STATS 1 /* first __le32 is good CRC */ -/* - * N_SCAN_RESULTS = 0x83 (notification only, not a command) - */ -struct il_scanresults_notification { - u8 channel; - u8 band; - u8 probe_status; - u8 num_probe_not_sent; /* not enough time to send */ - __le32 tsf_low; - __le32 tsf_high; - __le32 stats[NUMBER_OF_STATS]; -} __packed; - -/* - * N_SCAN_COMPLETE = 0x84 (notification only, not a command) - */ -struct il_scancomplete_notification { - u8 scanned_channels; - u8 status; - u8 last_channel; - __le32 tsf_low; - __le32 tsf_high; -} __packed; - -/****************************************************************************** - * (9) - * IBSS/AP Commands and Notifications: - * - *****************************************************************************/ - -enum il_ibss_manager { - IL_NOT_IBSS_MANAGER = 0, - IL_IBSS_MANAGER = 1, -}; - -/* - * N_BEACON = 0x90 (notification only, not a command) - */ - -struct il3945_beacon_notif { - struct il3945_tx_resp beacon_notify_hdr; - __le32 low_tsf; - __le32 high_tsf; - __le32 ibss_mgr_status; -} __packed; - -struct il4965_beacon_notif { - struct il4965_tx_resp beacon_notify_hdr; - __le32 low_tsf; - __le32 high_tsf; - __le32 ibss_mgr_status; -} __packed; - -/* - * C_TX_BEACON= 0x91 (command, has simple generic response) - */ - -struct il3945_tx_beacon_cmd { - struct il3945_tx_cmd tx; - __le16 tim_idx; - u8 tim_size; - u8 reserved1; - struct ieee80211_hdr frame[0]; /* beacon frame */ -} __packed; - -struct il_tx_beacon_cmd { - struct il_tx_cmd tx; - __le16 tim_idx; - u8 tim_size; - u8 reserved1; - struct ieee80211_hdr frame[0]; /* beacon frame */ -} __packed; - -/****************************************************************************** - * (10) - * Statistics Commands and Notifications: - * - *****************************************************************************/ - -#define IL_TEMP_CONVERT 260 - -#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 -#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 -#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 - -/* Used for passing to driver number of successes and failures per rate */ -struct rate_histogram { - union { - __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; - __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; - __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; - } success; - union { - __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; - __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; - __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; - } failed; -} __packed; - -/* stats command response */ - -struct iwl39_stats_rx_phy { - __le32 ina_cnt; - __le32 fina_cnt; - __le32 plcp_err; - __le32 crc32_err; - __le32 overrun_err; - __le32 early_overrun_err; - __le32 crc32_good; - __le32 false_alarm_cnt; - __le32 fina_sync_err_cnt; - __le32 sfd_timeout; - __le32 fina_timeout; - __le32 unresponded_rts; - __le32 rxe_frame_limit_overrun; - __le32 sent_ack_cnt; - __le32 sent_cts_cnt; -} __packed; - -struct iwl39_stats_rx_non_phy { - __le32 bogus_cts; /* CTS received when not expecting CTS */ - __le32 bogus_ack; /* ACK received when not expecting ACK */ - __le32 non_bssid_frames; /* number of frames with BSSID that - * doesn't belong to the STA BSSID */ - __le32 filtered_frames; /* count frames that were dumped in the - * filtering process */ - __le32 non_channel_beacons; /* beacons with our bss id but not on - * our serving channel */ -} __packed; - -struct iwl39_stats_rx { - struct iwl39_stats_rx_phy ofdm; - struct iwl39_stats_rx_phy cck; - struct iwl39_stats_rx_non_phy general; -} __packed; - -struct iwl39_stats_tx { - __le32 preamble_cnt; - __le32 rx_detected_cnt; - __le32 bt_prio_defer_cnt; - __le32 bt_prio_kill_cnt; - __le32 few_bytes_cnt; - __le32 cts_timeout; - __le32 ack_timeout; - __le32 expected_ack_cnt; - __le32 actual_ack_cnt; -} __packed; - -struct stats_dbg { - __le32 burst_check; - __le32 burst_count; - __le32 wait_for_silence_timeout_cnt; - __le32 reserved[3]; -} __packed; - -struct iwl39_stats_div { - __le32 tx_on_a; - __le32 tx_on_b; - __le32 exec_time; - __le32 probe_time; -} __packed; - -struct iwl39_stats_general { - __le32 temperature; - struct stats_dbg dbg; - __le32 sleep_time; - __le32 slots_out; - __le32 slots_idle; - __le32 ttl_timestamp; - struct iwl39_stats_div div; -} __packed; - -struct stats_rx_phy { - __le32 ina_cnt; - __le32 fina_cnt; - __le32 plcp_err; - __le32 crc32_err; - __le32 overrun_err; - __le32 early_overrun_err; - __le32 crc32_good; - __le32 false_alarm_cnt; - __le32 fina_sync_err_cnt; - __le32 sfd_timeout; - __le32 fina_timeout; - __le32 unresponded_rts; - __le32 rxe_frame_limit_overrun; - __le32 sent_ack_cnt; - __le32 sent_cts_cnt; - __le32 sent_ba_rsp_cnt; - __le32 dsp_self_kill; - __le32 mh_format_err; - __le32 re_acq_main_rssi_sum; - __le32 reserved3; -} __packed; - -struct stats_rx_ht_phy { - __le32 plcp_err; - __le32 overrun_err; - __le32 early_overrun_err; - __le32 crc32_good; - __le32 crc32_err; - __le32 mh_format_err; - __le32 agg_crc32_good; - __le32 agg_mpdu_cnt; - __le32 agg_cnt; - __le32 unsupport_mcs; -} __packed; - -#define INTERFERENCE_DATA_AVAILABLE cpu_to_le32(1) - -struct stats_rx_non_phy { - __le32 bogus_cts; /* CTS received when not expecting CTS */ - __le32 bogus_ack; /* ACK received when not expecting ACK */ - __le32 non_bssid_frames; /* number of frames with BSSID that - * doesn't belong to the STA BSSID */ - __le32 filtered_frames; /* count frames that were dumped in the - * filtering process */ - __le32 non_channel_beacons; /* beacons with our bss id but not on - * our serving channel */ - __le32 channel_beacons; /* beacons with our bss id and in our - * serving channel */ - __le32 num_missed_bcon; /* number of missed beacons */ - __le32 adc_rx_saturation_time; /* count in 0.8us units the time the - * ADC was in saturation */ - __le32 ina_detection_search_time; /* total time (in 0.8us) searched - * for INA */ - __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */ - __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */ - __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */ - __le32 interference_data_flag; /* flag for interference data - * availability. 1 when data is - * available. */ - __le32 channel_load; /* counts RX Enable time in uSec */ - __le32 dsp_false_alarms; /* DSP false alarm (both OFDM - * and CCK) counter */ - __le32 beacon_rssi_a; - __le32 beacon_rssi_b; - __le32 beacon_rssi_c; - __le32 beacon_energy_a; - __le32 beacon_energy_b; - __le32 beacon_energy_c; -} __packed; - -struct stats_rx { - struct stats_rx_phy ofdm; - struct stats_rx_phy cck; - struct stats_rx_non_phy general; - struct stats_rx_ht_phy ofdm_ht; -} __packed; - -/** - * struct stats_tx_power - current tx power - * - * @ant_a: current tx power on chain a in 1/2 dB step - * @ant_b: current tx power on chain b in 1/2 dB step - * @ant_c: current tx power on chain c in 1/2 dB step - */ -struct stats_tx_power { - u8 ant_a; - u8 ant_b; - u8 ant_c; - u8 reserved; -} __packed; - -struct stats_tx_non_phy_agg { - __le32 ba_timeout; - __le32 ba_reschedule_frames; - __le32 scd_query_agg_frame_cnt; - __le32 scd_query_no_agg; - __le32 scd_query_agg; - __le32 scd_query_mismatch; - __le32 frame_not_ready; - __le32 underrun; - __le32 bt_prio_kill; - __le32 rx_ba_rsp_cnt; -} __packed; - -struct stats_tx { - __le32 preamble_cnt; - __le32 rx_detected_cnt; - __le32 bt_prio_defer_cnt; - __le32 bt_prio_kill_cnt; - __le32 few_bytes_cnt; - __le32 cts_timeout; - __le32 ack_timeout; - __le32 expected_ack_cnt; - __le32 actual_ack_cnt; - __le32 dump_msdu_cnt; - __le32 burst_abort_next_frame_mismatch_cnt; - __le32 burst_abort_missing_next_frame_cnt; - __le32 cts_timeout_collision; - __le32 ack_or_ba_timeout_collision; - struct stats_tx_non_phy_agg agg; - - __le32 reserved1; -} __packed; - -struct stats_div { - __le32 tx_on_a; - __le32 tx_on_b; - __le32 exec_time; - __le32 probe_time; - __le32 reserved1; - __le32 reserved2; -} __packed; - -struct stats_general_common { - __le32 temperature; /* radio temperature */ - struct stats_dbg dbg; - __le32 sleep_time; - __le32 slots_out; - __le32 slots_idle; - __le32 ttl_timestamp; - struct stats_div div; - __le32 rx_enable_counter; - /* - * num_of_sos_states: - * count the number of times we have to re-tune - * in order to get out of bad PHY status - */ - __le32 num_of_sos_states; -} __packed; - -struct stats_general { - struct stats_general_common common; - __le32 reserved2; - __le32 reserved3; -} __packed; - -#define UCODE_STATS_CLEAR_MSK (0x1 << 0) -#define UCODE_STATS_FREQUENCY_MSK (0x1 << 1) -#define UCODE_STATS_NARROW_BAND_MSK (0x1 << 2) - -/* - * C_STATS = 0x9c, - * all devices identical. - * - * This command triggers an immediate response containing uCode stats. - * The response is in the same format as N_STATS 0x9d, below. - * - * If the CLEAR_STATS configuration flag is set, uCode will clear its - * internal copy of the stats (counters) after issuing the response. - * This flag does not affect N_STATSs after beacons (see below). - * - * If the DISABLE_NOTIF configuration flag is set, uCode will not issue - * N_STATSs after received beacons (see below). This flag - * does not affect the response to the C_STATS 0x9c itself. - */ -#define IL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */ -#define IL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2) /* see above */ -struct il_stats_cmd { - __le32 configuration_flags; /* IL_STATS_CONF_* */ -} __packed; - -/* - * N_STATS = 0x9d (notification only, not a command) - * - * By default, uCode issues this notification after receiving a beacon - * while associated. To disable this behavior, set DISABLE_NOTIF flag in the - * C_STATS 0x9c, above. - * - * Statistics counters continue to increment beacon after beacon, but are - * cleared when changing channels or when driver issues C_STATS - * 0x9c with CLEAR_STATS bit set (see above). - * - * uCode also issues this notification during scans. uCode clears stats - * appropriately so that each notification contains stats for only the - * one channel that has just been scanned. - */ -#define STATS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2) -#define STATS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8) - -struct il3945_notif_stats { - __le32 flag; - struct iwl39_stats_rx rx; - struct iwl39_stats_tx tx; - struct iwl39_stats_general general; -} __packed; - -struct il_notif_stats { - __le32 flag; - struct stats_rx rx; - struct stats_tx tx; - struct stats_general general; -} __packed; - -/* - * N_MISSED_BEACONS = 0xa2 (notification only, not a command) - * - * uCode send N_MISSED_BEACONS to driver when detect beacon missed - * in regardless of how many missed beacons, which mean when driver receive the - * notification, inside the command, it can find all the beacons information - * which include number of total missed beacons, number of consecutive missed - * beacons, number of beacons received and number of beacons expected to - * receive. - * - * If uCode detected consecutive_missed_beacons > 5, it will reset the radio - * in order to bring the radio/PHY back to working state; which has no relation - * to when driver will perform sensitivity calibration. - * - * Driver should set it own missed_beacon_threshold to decide when to perform - * sensitivity calibration based on number of consecutive missed beacons in - * order to improve overall performance, especially in noisy environment. - * - */ - -#define IL_MISSED_BEACON_THRESHOLD_MIN (1) -#define IL_MISSED_BEACON_THRESHOLD_DEF (5) -#define IL_MISSED_BEACON_THRESHOLD_MAX IL_MISSED_BEACON_THRESHOLD_DEF - -struct il_missed_beacon_notif { - __le32 consecutive_missed_beacons; - __le32 total_missed_becons; - __le32 num_expected_beacons; - __le32 num_recvd_beacons; -} __packed; - -/****************************************************************************** - * (11) - * Rx Calibration Commands: - * - * With the uCode used for open source drivers, most Tx calibration (except - * for Tx Power) and most Rx calibration is done by uCode during the - * "initialize" phase of uCode boot. Driver must calibrate only: - * - * 1) Tx power (depends on temperature), described elsewhere - * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas) - * 3) Receiver sensitivity (to optimize signal detection) - * - *****************************************************************************/ - -/** - * C_SENSITIVITY = 0xa8 (command, has simple generic response) - * - * This command sets up the Rx signal detector for a sensitivity level that - * is high enough to lock onto all signals within the associated network, - * but low enough to ignore signals that are below a certain threshold, so as - * not to have too many "false alarms". False alarms are signals that the - * Rx DSP tries to lock onto, but then discards after determining that they - * are noise. - * - * The optimum number of false alarms is between 5 and 50 per 200 TUs - * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e. - * time listening, not transmitting). Driver must adjust sensitivity so that - * the ratio of actual false alarms to actual Rx time falls within this range. - * - * While associated, uCode delivers N_STATSs after each - * received beacon. These provide information to the driver to analyze the - * sensitivity. Don't analyze stats that come in from scanning, or any - * other non-associated-network source. Pertinent stats include: - * - * From "general" stats (struct stats_rx_non_phy): - * - * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level) - * Measure of energy of desired signal. Used for establishing a level - * below which the device does not detect signals. - * - * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB) - * Measure of background noise in silent period after beacon. - * - * channel_load - * uSecs of actual Rx time during beacon period (varies according to - * how much time was spent transmitting). - * - * From "cck" and "ofdm" stats (struct stats_rx_phy), separately: - * - * false_alarm_cnt - * Signal locks abandoned early (before phy-level header). - * - * plcp_err - * Signal locks abandoned late (during phy-level header). - * - * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from - * beacon to beacon, i.e. each value is an accumulation of all errors - * before and including the latest beacon. Values will wrap around to 0 - * after counting up to 2^32 - 1. Driver must differentiate vs. - * previous beacon's values to determine # false alarms in the current - * beacon period. - * - * Total number of false alarms = false_alarms + plcp_errs - * - * For OFDM, adjust the following table entries in struct il_sensitivity_cmd - * (notice that the start points for OFDM are at or close to settings for - * maximum sensitivity): - * - * START / MIN / MAX - * HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX 90 / 85 / 120 - * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX 170 / 170 / 210 - * HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX 105 / 105 / 140 - * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX 220 / 220 / 270 - * - * If actual rate of OFDM false alarms (+ plcp_errors) is too high - * (greater than 50 for each 204.8 msecs listening), reduce sensitivity - * by *adding* 1 to all 4 of the table entries above, up to the max for - * each entry. Conversely, if false alarm rate is too low (less than 5 - * for each 204.8 msecs listening), *subtract* 1 from each entry to - * increase sensitivity. - * - * For CCK sensitivity, keep track of the following: - * - * 1). 20-beacon history of maximum background noise, indicated by - * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the - * 3 receivers. For any given beacon, the "silence reference" is - * the maximum of last 60 samples (20 beacons * 3 receivers). - * - * 2). 10-beacon history of strongest signal level, as indicated - * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers, - * i.e. the strength of the signal through the best receiver at the - * moment. These measurements are "upside down", with lower values - * for stronger signals, so max energy will be *minimum* value. - * - * Then for any given beacon, the driver must determine the *weakest* - * of the strongest signals; this is the minimum level that needs to be - * successfully detected, when using the best receiver at the moment. - * "Max cck energy" is the maximum (higher value means lower energy!) - * of the last 10 minima. Once this is determined, driver must add - * a little margin by adding "6" to it. - * - * 3). Number of consecutive beacon periods with too few false alarms. - * Reset this to 0 at the first beacon period that falls within the - * "good" range (5 to 50 false alarms per 204.8 milliseconds rx). - * - * Then, adjust the following CCK table entries in struct il_sensitivity_cmd - * (notice that the start points for CCK are at maximum sensitivity): - * - * START / MIN / MAX - * HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX 125 / 125 / 200 - * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX 200 / 200 / 400 - * HD_MIN_ENERGY_CCK_DET_IDX 100 / 0 / 100 - * - * If actual rate of CCK false alarms (+ plcp_errors) is too high - * (greater than 50 for each 204.8 msecs listening), method for reducing - * sensitivity is: - * - * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX, - * up to max 400. - * - * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is < 160, - * sensitivity has been reduced a significant amount; bring it up to - * a moderate 161. Otherwise, *add* 3, up to max 200. - * - * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is > 160, - * sensitivity has been reduced only a moderate or small amount; - * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_IDX, - * down to min 0. Otherwise (if gain has been significantly reduced), - * don't change the HD_MIN_ENERGY_CCK_DET_IDX value. - * - * b) Save a snapshot of the "silence reference". - * - * If actual rate of CCK false alarms (+ plcp_errors) is too low - * (less than 5 for each 204.8 msecs listening), method for increasing - * sensitivity is used only if: - * - * 1a) Previous beacon did not have too many false alarms - * 1b) AND difference between previous "silence reference" and current - * "silence reference" (prev - current) is 2 or more, - * OR 2) 100 or more consecutive beacon periods have had rate of - * less than 5 false alarms per 204.8 milliseconds rx time. - * - * Method for increasing sensitivity: - * - * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX, - * down to min 125. - * - * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX, - * down to min 200. - * - * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_IDX, up to max 100. - * - * If actual rate of CCK false alarms (+ plcp_errors) is within good range - * (between 5 and 50 for each 204.8 msecs listening): - * - * 1) Save a snapshot of the silence reference. - * - * 2) If previous beacon had too many CCK false alarms (+ plcp_errors), - * give some extra margin to energy threshold by *subtracting* 8 - * from value in HD_MIN_ENERGY_CCK_DET_IDX. - * - * For all cases (too few, too many, good range), make sure that the CCK - * detection threshold (energy) is below the energy level for robust - * detection over the past 10 beacon periods, the "Max cck energy". - * Lower values mean higher energy; this means making sure that the value - * in HD_MIN_ENERGY_CCK_DET_IDX is at or *above* "Max cck energy". - * - */ - -/* - * Table entries in C_SENSITIVITY (struct il_sensitivity_cmd) - */ -#define HD_TBL_SIZE (11) /* number of entries */ -#define HD_MIN_ENERGY_CCK_DET_IDX (0) /* table idxes */ -#define HD_MIN_ENERGY_OFDM_DET_IDX (1) -#define HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX (2) -#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX (3) -#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX (4) -#define HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX (5) -#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX (6) -#define HD_BARKER_CORR_TH_ADD_MIN_IDX (7) -#define HD_BARKER_CORR_TH_ADD_MIN_MRC_IDX (8) -#define HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX (9) -#define HD_OFDM_ENERGY_TH_IN_IDX (10) - -/* Control field in struct il_sensitivity_cmd */ -#define C_SENSITIVITY_CONTROL_DEFAULT_TBL cpu_to_le16(0) -#define C_SENSITIVITY_CONTROL_WORK_TBL cpu_to_le16(1) - -/** - * struct il_sensitivity_cmd - * @control: (1) updates working table, (0) updates default table - * @table: energy threshold values, use HD_* as idx into table - * - * Always use "1" in "control" to update uCode's working table and DSP. - */ -struct il_sensitivity_cmd { - __le16 control; /* always use "1" */ - __le16 table[HD_TBL_SIZE]; /* use HD_* as idx */ -} __packed; - -/** - * C_PHY_CALIBRATION = 0xb0 (command, has simple generic response) - * - * This command sets the relative gains of 4965 device's 3 radio receiver chains. - * - * After the first association, driver should accumulate signal and noise - * stats from the N_STATSs that follow the first 20 - * beacons from the associated network (don't collect stats that come - * in from scanning, or any other non-network source). - * - * DISCONNECTED ANTENNA: - * - * Driver should determine which antennas are actually connected, by comparing - * average beacon signal levels for the 3 Rx chains. Accumulate (add) the - * following values over 20 beacons, one accumulator for each of the chains - * a/b/c, from struct stats_rx_non_phy: - * - * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB) - * - * Find the strongest signal from among a/b/c. Compare the other two to the - * strongest. If any signal is more than 15 dB (times 20, unless you - * divide the accumulated values by 20) below the strongest, the driver - * considers that antenna to be disconnected, and should not try to use that - * antenna/chain for Rx or Tx. If both A and B seem to be disconnected, - * driver should declare the stronger one as connected, and attempt to use it - * (A and B are the only 2 Tx chains!). - * - * - * RX BALANCE: - * - * Driver should balance the 3 receivers (but just the ones that are connected - * to antennas, see above) for gain, by comparing the average signal levels - * detected during the silence after each beacon (background noise). - * Accumulate (add) the following values over 20 beacons, one accumulator for - * each of the chains a/b/c, from struct stats_rx_non_phy: - * - * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB) - * - * Find the weakest background noise level from among a/b/c. This Rx chain - * will be the reference, with 0 gain adjustment. Attenuate other channels by - * finding noise difference: - * - * (accum_noise[i] - accum_noise[reference]) / 30 - * - * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB. - * For use in diff_gain_[abc] fields of struct il_calibration_cmd, the - * driver should limit the difference results to a range of 0-3 (0-4.5 dB), - * and set bit 2 to indicate "reduce gain". The value for the reference - * (weakest) chain should be "0". - * - * diff_gain_[abc] bit fields: - * 2: (1) reduce gain, (0) increase gain - * 1-0: amount of gain, units of 1.5 dB - */ - -/* Phy calibration command for series */ -/* The default calibrate table size if not specified by firmware */ -#define IL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18 -enum { - IL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7, - IL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 19, -}; - -#define IL_MAX_PHY_CALIBRATE_TBL_SIZE (253) - -struct il_calib_hdr { - u8 op_code; - u8 first_group; - u8 groups_num; - u8 data_valid; -} __packed; - -/* IL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */ -struct il_calib_diff_gain_cmd { - struct il_calib_hdr hdr; - s8 diff_gain_a; /* see above */ - s8 diff_gain_b; - s8 diff_gain_c; - u8 reserved1; -} __packed; - -/****************************************************************************** - * (12) - * Miscellaneous Commands: - * - *****************************************************************************/ - -/* - * LEDs Command & Response - * C_LEDS = 0x48 (command, has simple generic response) - * - * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), - * this command turns it on or off, or sets up a periodic blinking cycle. - */ -struct il_led_cmd { - __le32 interval; /* "interval" in uSec */ - u8 id; /* 1: Activity, 2: Link, 3: Tech */ - u8 off; /* # intervals off while blinking; - * "0", with >0 "on" value, turns LED on */ - u8 on; /* # intervals on while blinking; - * "0", regardless of "off", turns LED off */ - u8 reserved; -} __packed; - -/****************************************************************************** - * (13) - * Union of all expected notifications/responses: - * - *****************************************************************************/ - -#define IL_RX_FRAME_SIZE_MSK 0x00003fff - -struct il_rx_pkt { - /* - * The first 4 bytes of the RX frame header contain both the RX frame - * size and some flags. - * Bit fields: - * 31: flag flush RB request - * 30: flag ignore TC (terminal counter) request - * 29: flag fast IRQ request - * 28-14: Reserved - * 13-00: RX frame size - */ - __le32 len_n_flags; - struct il_cmd_header hdr; - union { - struct il3945_rx_frame rx_frame; - struct il3945_tx_resp tx_resp; - struct il3945_beacon_notif beacon_status; - - struct il_alive_resp alive_frame; - struct il_spectrum_notification spectrum_notif; - struct il_csa_notification csa_notif; - struct il_error_resp err_resp; - struct il_card_state_notif card_state_notif; - struct il_add_sta_resp add_sta; - struct il_rem_sta_resp rem_sta; - struct il_sleep_notification sleep_notif; - struct il_spectrum_resp spectrum; - struct il_notif_stats stats; - struct il_compressed_ba_resp compressed_ba; - struct il_missed_beacon_notif missed_beacon; - __le32 status; - u8 raw[0]; - } u; -} __packed; - -#endif /* __il_commands_h__ */ diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c deleted file mode 100644 index 9c9ebadc22e2..000000000000 --- a/drivers/net/wireless/iwlegacy/common.c +++ /dev/null @@ -1,5518 +0,0 @@ -/****************************************************************************** - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called LICENSE.GPL. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - *****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "common.h" - -int -_il_poll_bit(struct il_priv *il, u32 addr, u32 bits, u32 mask, int timeout) -{ - const int interval = 10; /* microseconds */ - int t = 0; - - do { - if ((_il_rd(il, addr) & mask) == (bits & mask)) - return t; - udelay(interval); - t += interval; - } while (t < timeout); - - return -ETIMEDOUT; -} -EXPORT_SYMBOL(_il_poll_bit); - -void -il_set_bit(struct il_priv *p, u32 r, u32 m) -{ - unsigned long reg_flags; - - spin_lock_irqsave(&p->reg_lock, reg_flags); - _il_set_bit(p, r, m); - spin_unlock_irqrestore(&p->reg_lock, reg_flags); -} -EXPORT_SYMBOL(il_set_bit); - -void -il_clear_bit(struct il_priv *p, u32 r, u32 m) -{ - unsigned long reg_flags; - - spin_lock_irqsave(&p->reg_lock, reg_flags); - _il_clear_bit(p, r, m); - spin_unlock_irqrestore(&p->reg_lock, reg_flags); -} -EXPORT_SYMBOL(il_clear_bit); - -bool -_il_grab_nic_access(struct il_priv *il) -{ - int ret; - u32 val; - - /* this bit wakes up the NIC */ - _il_set_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - - /* - * These bits say the device is running, and should keep running for - * at least a short while (at least as long as MAC_ACCESS_REQ stays 1), - * but they do not indicate that embedded SRAM is restored yet; - * 3945 and 4965 have volatile SRAM, and must save/restore contents - * to/from host DRAM when sleeping/waking for power-saving. - * Each direction takes approximately 1/4 millisecond; with this - * overhead, it's a good idea to grab and hold MAC_ACCESS_REQUEST if a - * series of register accesses are expected (e.g. reading Event Log), - * to keep device from sleeping. - * - * CSR_UCODE_DRV_GP1 register bit MAC_SLEEP == 0 indicates that - * SRAM is okay/restored. We don't check that here because this call - * is just for hardware register access; but GP1 MAC_SLEEP check is a - * good idea before accessing 3945/4965 SRAM (e.g. reading Event Log). - * - */ - ret = - _il_poll_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, - (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | - CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 15000); - if (unlikely(ret < 0)) { - val = _il_rd(il, CSR_GP_CNTRL); - WARN_ONCE(1, "Timeout waiting for ucode processor access " - "(CSR_GP_CNTRL 0x%08x)\n", val); - _il_wr(il, CSR_RESET, CSR_RESET_REG_FLAG_FORCE_NMI); - return false; - } - - return true; -} -EXPORT_SYMBOL_GPL(_il_grab_nic_access); - -int -il_poll_bit(struct il_priv *il, u32 addr, u32 mask, int timeout) -{ - const int interval = 10; /* microseconds */ - int t = 0; - - do { - if ((il_rd(il, addr) & mask) == mask) - return t; - udelay(interval); - t += interval; - } while (t < timeout); - - return -ETIMEDOUT; -} -EXPORT_SYMBOL(il_poll_bit); - -u32 -il_rd_prph(struct il_priv *il, u32 reg) -{ - unsigned long reg_flags; - u32 val; - - spin_lock_irqsave(&il->reg_lock, reg_flags); - _il_grab_nic_access(il); - val = _il_rd_prph(il, reg); - _il_release_nic_access(il); - spin_unlock_irqrestore(&il->reg_lock, reg_flags); - return val; -} -EXPORT_SYMBOL(il_rd_prph); - -void -il_wr_prph(struct il_priv *il, u32 addr, u32 val) -{ - unsigned long reg_flags; - - spin_lock_irqsave(&il->reg_lock, reg_flags); - if (likely(_il_grab_nic_access(il))) { - _il_wr_prph(il, addr, val); - _il_release_nic_access(il); - } - spin_unlock_irqrestore(&il->reg_lock, reg_flags); -} -EXPORT_SYMBOL(il_wr_prph); - -u32 -il_read_targ_mem(struct il_priv *il, u32 addr) -{ - unsigned long reg_flags; - u32 value; - - spin_lock_irqsave(&il->reg_lock, reg_flags); - _il_grab_nic_access(il); - - _il_wr(il, HBUS_TARG_MEM_RADDR, addr); - value = _il_rd(il, HBUS_TARG_MEM_RDAT); - - _il_release_nic_access(il); - spin_unlock_irqrestore(&il->reg_lock, reg_flags); - return value; -} -EXPORT_SYMBOL(il_read_targ_mem); - -void -il_write_targ_mem(struct il_priv *il, u32 addr, u32 val) -{ - unsigned long reg_flags; - - spin_lock_irqsave(&il->reg_lock, reg_flags); - if (likely(_il_grab_nic_access(il))) { - _il_wr(il, HBUS_TARG_MEM_WADDR, addr); - _il_wr(il, HBUS_TARG_MEM_WDAT, val); - _il_release_nic_access(il); - } - spin_unlock_irqrestore(&il->reg_lock, reg_flags); -} -EXPORT_SYMBOL(il_write_targ_mem); - -const char * -il_get_cmd_string(u8 cmd) -{ - switch (cmd) { - IL_CMD(N_ALIVE); - IL_CMD(N_ERROR); - IL_CMD(C_RXON); - IL_CMD(C_RXON_ASSOC); - IL_CMD(C_QOS_PARAM); - IL_CMD(C_RXON_TIMING); - IL_CMD(C_ADD_STA); - IL_CMD(C_REM_STA); - IL_CMD(C_WEPKEY); - IL_CMD(N_3945_RX); - IL_CMD(C_TX); - IL_CMD(C_RATE_SCALE); - IL_CMD(C_LEDS); - IL_CMD(C_TX_LINK_QUALITY_CMD); - IL_CMD(C_CHANNEL_SWITCH); - IL_CMD(N_CHANNEL_SWITCH); - IL_CMD(C_SPECTRUM_MEASUREMENT); - IL_CMD(N_SPECTRUM_MEASUREMENT); - IL_CMD(C_POWER_TBL); - IL_CMD(N_PM_SLEEP); - IL_CMD(N_PM_DEBUG_STATS); - IL_CMD(C_SCAN); - IL_CMD(C_SCAN_ABORT); - IL_CMD(N_SCAN_START); - IL_CMD(N_SCAN_RESULTS); - IL_CMD(N_SCAN_COMPLETE); - IL_CMD(N_BEACON); - IL_CMD(C_TX_BEACON); - IL_CMD(C_TX_PWR_TBL); - IL_CMD(C_BT_CONFIG); - IL_CMD(C_STATS); - IL_CMD(N_STATS); - IL_CMD(N_CARD_STATE); - IL_CMD(N_MISSED_BEACONS); - IL_CMD(C_CT_KILL_CONFIG); - IL_CMD(C_SENSITIVITY); - IL_CMD(C_PHY_CALIBRATION); - IL_CMD(N_RX_PHY); - IL_CMD(N_RX_MPDU); - IL_CMD(N_RX); - IL_CMD(N_COMPRESSED_BA); - default: - return "UNKNOWN"; - - } -} -EXPORT_SYMBOL(il_get_cmd_string); - -#define HOST_COMPLETE_TIMEOUT (HZ / 2) - -static void -il_generic_cmd_callback(struct il_priv *il, struct il_device_cmd *cmd, - struct il_rx_pkt *pkt) -{ - if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { - IL_ERR("Bad return from %s (0x%08X)\n", - il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); - return; - } -#ifdef CONFIG_IWLEGACY_DEBUG - switch (cmd->hdr.cmd) { - case C_TX_LINK_QUALITY_CMD: - case C_SENSITIVITY: - D_HC_DUMP("back from %s (0x%08X)\n", - il_get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); - break; - default: - D_HC("back from %s (0x%08X)\n", il_get_cmd_string(cmd->hdr.cmd), - pkt->hdr.flags); - } -#endif -} - -static int -il_send_cmd_async(struct il_priv *il, struct il_host_cmd *cmd) -{ - int ret; - - BUG_ON(!(cmd->flags & CMD_ASYNC)); - - /* An asynchronous command can not expect an SKB to be set. */ - BUG_ON(cmd->flags & CMD_WANT_SKB); - - /* Assign a generic callback if one is not provided */ - if (!cmd->callback) - cmd->callback = il_generic_cmd_callback; - - if (test_bit(S_EXIT_PENDING, &il->status)) - return -EBUSY; - - ret = il_enqueue_hcmd(il, cmd); - if (ret < 0) { - IL_ERR("Error sending %s: enqueue_hcmd failed: %d\n", - il_get_cmd_string(cmd->id), ret); - return ret; - } - return 0; -} - -int -il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd) -{ - int cmd_idx; - int ret; - - lockdep_assert_held(&il->mutex); - - BUG_ON(cmd->flags & CMD_ASYNC); - - /* A synchronous command can not have a callback set. */ - BUG_ON(cmd->callback); - - D_INFO("Attempting to send sync command %s\n", - il_get_cmd_string(cmd->id)); - - set_bit(S_HCMD_ACTIVE, &il->status); - D_INFO("Setting HCMD_ACTIVE for command %s\n", - il_get_cmd_string(cmd->id)); - - cmd_idx = il_enqueue_hcmd(il, cmd); - if (cmd_idx < 0) { - ret = cmd_idx; - IL_ERR("Error sending %s: enqueue_hcmd failed: %d\n", - il_get_cmd_string(cmd->id), ret); - goto out; - } - - ret = wait_event_timeout(il->wait_command_queue, - !test_bit(S_HCMD_ACTIVE, &il->status), - HOST_COMPLETE_TIMEOUT); - if (!ret) { - if (test_bit(S_HCMD_ACTIVE, &il->status)) { - IL_ERR("Error sending %s: time out after %dms.\n", - il_get_cmd_string(cmd->id), - jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); - - clear_bit(S_HCMD_ACTIVE, &il->status); - D_INFO("Clearing HCMD_ACTIVE for command %s\n", - il_get_cmd_string(cmd->id)); - ret = -ETIMEDOUT; - goto cancel; - } - } - - if (test_bit(S_RFKILL, &il->status)) { - IL_ERR("Command %s aborted: RF KILL Switch\n", - il_get_cmd_string(cmd->id)); - ret = -ECANCELED; - goto fail; - } - if (test_bit(S_FW_ERROR, &il->status)) { - IL_ERR("Command %s failed: FW Error\n", - il_get_cmd_string(cmd->id)); - ret = -EIO; - goto fail; - } - if ((cmd->flags & CMD_WANT_SKB) && !cmd->reply_page) { - IL_ERR("Error: Response NULL in '%s'\n", - il_get_cmd_string(cmd->id)); - ret = -EIO; - goto cancel; - } - - ret = 0; - goto out; - -cancel: - if (cmd->flags & CMD_WANT_SKB) { - /* - * Cancel the CMD_WANT_SKB flag for the cmd in the - * TX cmd queue. Otherwise in case the cmd comes - * in later, it will possibly set an invalid - * address (cmd->meta.source). - */ - il->txq[il->cmd_queue].meta[cmd_idx].flags &= ~CMD_WANT_SKB; - } -fail: - if (cmd->reply_page) { - il_free_pages(il, cmd->reply_page); - cmd->reply_page = 0; - } -out: - return ret; -} -EXPORT_SYMBOL(il_send_cmd_sync); - -int -il_send_cmd(struct il_priv *il, struct il_host_cmd *cmd) -{ - if (cmd->flags & CMD_ASYNC) - return il_send_cmd_async(il, cmd); - - return il_send_cmd_sync(il, cmd); -} -EXPORT_SYMBOL(il_send_cmd); - -int -il_send_cmd_pdu(struct il_priv *il, u8 id, u16 len, const void *data) -{ - struct il_host_cmd cmd = { - .id = id, - .len = len, - .data = data, - }; - - return il_send_cmd_sync(il, &cmd); -} -EXPORT_SYMBOL(il_send_cmd_pdu); - -int -il_send_cmd_pdu_async(struct il_priv *il, u8 id, u16 len, const void *data, - void (*callback) (struct il_priv *il, - struct il_device_cmd *cmd, - struct il_rx_pkt *pkt)) -{ - struct il_host_cmd cmd = { - .id = id, - .len = len, - .data = data, - }; - - cmd.flags |= CMD_ASYNC; - cmd.callback = callback; - - return il_send_cmd_async(il, &cmd); -} -EXPORT_SYMBOL(il_send_cmd_pdu_async); - -/* default: IL_LED_BLINK(0) using blinking idx table */ -static int led_mode; -module_param(led_mode, int, S_IRUGO); -MODULE_PARM_DESC(led_mode, - "0=system default, " "1=On(RF On)/Off(RF Off), 2=blinking"); - -/* Throughput OFF time(ms) ON time (ms) - * >300 25 25 - * >200 to 300 40 40 - * >100 to 200 55 55 - * >70 to 100 65 65 - * >50 to 70 75 75 - * >20 to 50 85 85 - * >10 to 20 95 95 - * >5 to 10 110 110 - * >1 to 5 130 130 - * >0 to 1 167 167 - * <=0 SOLID ON - */ -static const struct ieee80211_tpt_blink il_blink[] = { - {.throughput = 0, .blink_time = 334}, - {.throughput = 1 * 1024 - 1, .blink_time = 260}, - {.throughput = 5 * 1024 - 1, .blink_time = 220}, - {.throughput = 10 * 1024 - 1, .blink_time = 190}, - {.throughput = 20 * 1024 - 1, .blink_time = 170}, - {.throughput = 50 * 1024 - 1, .blink_time = 150}, - {.throughput = 70 * 1024 - 1, .blink_time = 130}, - {.throughput = 100 * 1024 - 1, .blink_time = 110}, - {.throughput = 200 * 1024 - 1, .blink_time = 80}, - {.throughput = 300 * 1024 - 1, .blink_time = 50}, -}; - -/* - * Adjust led blink rate to compensate on a MAC Clock difference on every HW - * Led blink rate analysis showed an average deviation of 0% on 3945, - * 5% on 4965 HW. - * Need to compensate on the led on/off time per HW according to the deviation - * to achieve the desired led frequency - * The calculation is: (100-averageDeviation)/100 * blinkTime - * For code efficiency the calculation will be: - * compensation = (100 - averageDeviation) * 64 / 100 - * NewBlinkTime = (compensation * BlinkTime) / 64 - */ -static inline u8 -il_blink_compensation(struct il_priv *il, u8 time, u16 compensation) -{ - if (!compensation) { - IL_ERR("undefined blink compensation: " - "use pre-defined blinking time\n"); - return time; - } - - return (u8) ((time * compensation) >> 6); -} - -/* Set led pattern command */ -static int -il_led_cmd(struct il_priv *il, unsigned long on, unsigned long off) -{ - struct il_led_cmd led_cmd = { - .id = IL_LED_LINK, - .interval = IL_DEF_LED_INTRVL - }; - int ret; - - if (!test_bit(S_READY, &il->status)) - return -EBUSY; - - if (il->blink_on == on && il->blink_off == off) - return 0; - - if (off == 0) { - /* led is SOLID_ON */ - on = IL_LED_SOLID; - } - - D_LED("Led blink time compensation=%u\n", - il->cfg->led_compensation); - led_cmd.on = - il_blink_compensation(il, on, - il->cfg->led_compensation); - led_cmd.off = - il_blink_compensation(il, off, - il->cfg->led_compensation); - - ret = il->ops->send_led_cmd(il, &led_cmd); - if (!ret) { - il->blink_on = on; - il->blink_off = off; - } - return ret; -} - -static void -il_led_brightness_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct il_priv *il = container_of(led_cdev, struct il_priv, led); - unsigned long on = 0; - - if (brightness > 0) - on = IL_LED_SOLID; - - il_led_cmd(il, on, 0); -} - -static int -il_led_blink_set(struct led_classdev *led_cdev, unsigned long *delay_on, - unsigned long *delay_off) -{ - struct il_priv *il = container_of(led_cdev, struct il_priv, led); - - return il_led_cmd(il, *delay_on, *delay_off); -} - -void -il_leds_init(struct il_priv *il) -{ - int mode = led_mode; - int ret; - - if (mode == IL_LED_DEFAULT) - mode = il->cfg->led_mode; - - il->led.name = - kasprintf(GFP_KERNEL, "%s-led", wiphy_name(il->hw->wiphy)); - il->led.brightness_set = il_led_brightness_set; - il->led.blink_set = il_led_blink_set; - il->led.max_brightness = 1; - - switch (mode) { - case IL_LED_DEFAULT: - WARN_ON(1); - break; - case IL_LED_BLINK: - il->led.default_trigger = - ieee80211_create_tpt_led_trigger(il->hw, - IEEE80211_TPT_LEDTRIG_FL_CONNECTED, - il_blink, - ARRAY_SIZE(il_blink)); - break; - case IL_LED_RF_STATE: - il->led.default_trigger = ieee80211_get_radio_led_name(il->hw); - break; - } - - ret = led_classdev_register(&il->pci_dev->dev, &il->led); - if (ret) { - kfree(il->led.name); - return; - } - - il->led_registered = true; -} -EXPORT_SYMBOL(il_leds_init); - -void -il_leds_exit(struct il_priv *il) -{ - if (!il->led_registered) - return; - - led_classdev_unregister(&il->led); - kfree(il->led.name); -} -EXPORT_SYMBOL(il_leds_exit); - -/************************** EEPROM BANDS **************************** - * - * The il_eeprom_band definitions below provide the mapping from the - * EEPROM contents to the specific channel number supported for each - * band. - * - * For example, il_priv->eeprom.band_3_channels[4] from the band_3 - * definition below maps to physical channel 42 in the 5.2GHz spectrum. - * The specific geography and calibration information for that channel - * is contained in the eeprom map itself. - * - * During init, we copy the eeprom information and channel map - * information into il->channel_info_24/52 and il->channel_map_24/52 - * - * channel_map_24/52 provides the idx in the channel_info array for a - * given channel. We have to have two separate maps as there is channel - * overlap with the 2.4GHz and 5.2GHz spectrum as seen in band_1 and - * band_2 - * - * A value of 0xff stored in the channel_map indicates that the channel - * is not supported by the hardware at all. - * - * A value of 0xfe in the channel_map indicates that the channel is not - * valid for Tx with the current hardware. This means that - * while the system can tune and receive on a given channel, it may not - * be able to associate or transmit any frames on that - * channel. There is no corresponding channel information for that - * entry. - * - *********************************************************************/ - -/* 2.4 GHz */ -const u8 il_eeprom_band_1[14] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 -}; - -/* 5.2 GHz bands */ -static const u8 il_eeprom_band_2[] = { /* 4915-5080MHz */ - 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16 -}; - -static const u8 il_eeprom_band_3[] = { /* 5170-5320MHz */ - 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 -}; - -static const u8 il_eeprom_band_4[] = { /* 5500-5700MHz */ - 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 -}; - -static const u8 il_eeprom_band_5[] = { /* 5725-5825MHz */ - 145, 149, 153, 157, 161, 165 -}; - -static const u8 il_eeprom_band_6[] = { /* 2.4 ht40 channel */ - 1, 2, 3, 4, 5, 6, 7 -}; - -static const u8 il_eeprom_band_7[] = { /* 5.2 ht40 channel */ - 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157 -}; - -/****************************************************************************** - * - * EEPROM related functions - * -******************************************************************************/ - -static int -il_eeprom_verify_signature(struct il_priv *il) -{ - u32 gp = _il_rd(il, CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK; - int ret = 0; - - D_EEPROM("EEPROM signature=0x%08x\n", gp); - switch (gp) { - case CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K: - case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K: - break; - default: - IL_ERR("bad EEPROM signature," "EEPROM_GP=0x%08x\n", gp); - ret = -ENOENT; - break; - } - return ret; -} - -const u8 * -il_eeprom_query_addr(const struct il_priv *il, size_t offset) -{ - BUG_ON(offset >= il->cfg->eeprom_size); - return &il->eeprom[offset]; -} -EXPORT_SYMBOL(il_eeprom_query_addr); - -u16 -il_eeprom_query16(const struct il_priv *il, size_t offset) -{ - if (!il->eeprom) - return 0; - return (u16) il->eeprom[offset] | ((u16) il->eeprom[offset + 1] << 8); -} -EXPORT_SYMBOL(il_eeprom_query16); - -/** - * il_eeprom_init - read EEPROM contents - * - * Load the EEPROM contents from adapter into il->eeprom - * - * NOTE: This routine uses the non-debug IO access functions. - */ -int -il_eeprom_init(struct il_priv *il) -{ - __le16 *e; - u32 gp = _il_rd(il, CSR_EEPROM_GP); - int sz; - int ret; - u16 addr; - - /* allocate eeprom */ - sz = il->cfg->eeprom_size; - D_EEPROM("NVM size = %d\n", sz); - il->eeprom = kzalloc(sz, GFP_KERNEL); - if (!il->eeprom) { - ret = -ENOMEM; - goto alloc_err; - } - e = (__le16 *) il->eeprom; - - il->ops->apm_init(il); - - ret = il_eeprom_verify_signature(il); - if (ret < 0) { - IL_ERR("EEPROM not found, EEPROM_GP=0x%08x\n", gp); - ret = -ENOENT; - goto err; - } - - /* Make sure driver (instead of uCode) is allowed to read EEPROM */ - ret = il->ops->eeprom_acquire_semaphore(il); - if (ret < 0) { - IL_ERR("Failed to acquire EEPROM semaphore.\n"); - ret = -ENOENT; - goto err; - } - - /* eeprom is an array of 16bit values */ - for (addr = 0; addr < sz; addr += sizeof(u16)) { - u32 r; - - _il_wr(il, CSR_EEPROM_REG, - CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); - - ret = - _il_poll_bit(il, CSR_EEPROM_REG, - CSR_EEPROM_REG_READ_VALID_MSK, - CSR_EEPROM_REG_READ_VALID_MSK, - IL_EEPROM_ACCESS_TIMEOUT); - if (ret < 0) { - IL_ERR("Time out reading EEPROM[%d]\n", addr); - goto done; - } - r = _il_rd(il, CSR_EEPROM_REG); - e[addr / 2] = cpu_to_le16(r >> 16); - } - - D_EEPROM("NVM Type: %s, version: 0x%x\n", "EEPROM", - il_eeprom_query16(il, EEPROM_VERSION)); - - ret = 0; -done: - il->ops->eeprom_release_semaphore(il); - -err: - if (ret) - il_eeprom_free(il); - /* Reset chip to save power until we load uCode during "up". */ - il_apm_stop(il); -alloc_err: - return ret; -} -EXPORT_SYMBOL(il_eeprom_init); - -void -il_eeprom_free(struct il_priv *il) -{ - kfree(il->eeprom); - il->eeprom = NULL; -} -EXPORT_SYMBOL(il_eeprom_free); - -static void -il_init_band_reference(const struct il_priv *il, int eep_band, - int *eeprom_ch_count, - const struct il_eeprom_channel **eeprom_ch_info, - const u8 **eeprom_ch_idx) -{ - u32 offset = il->cfg->regulatory_bands[eep_band - 1]; - - switch (eep_band) { - case 1: /* 2.4GHz band */ - *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_1); - *eeprom_ch_info = - (struct il_eeprom_channel *)il_eeprom_query_addr(il, - offset); - *eeprom_ch_idx = il_eeprom_band_1; - break; - case 2: /* 4.9GHz band */ - *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_2); - *eeprom_ch_info = - (struct il_eeprom_channel *)il_eeprom_query_addr(il, - offset); - *eeprom_ch_idx = il_eeprom_band_2; - break; - case 3: /* 5.2GHz band */ - *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_3); - *eeprom_ch_info = - (struct il_eeprom_channel *)il_eeprom_query_addr(il, - offset); - *eeprom_ch_idx = il_eeprom_band_3; - break; - case 4: /* 5.5GHz band */ - *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_4); - *eeprom_ch_info = - (struct il_eeprom_channel *)il_eeprom_query_addr(il, - offset); - *eeprom_ch_idx = il_eeprom_band_4; - break; - case 5: /* 5.7GHz band */ - *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_5); - *eeprom_ch_info = - (struct il_eeprom_channel *)il_eeprom_query_addr(il, - offset); - *eeprom_ch_idx = il_eeprom_band_5; - break; - case 6: /* 2.4GHz ht40 channels */ - *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_6); - *eeprom_ch_info = - (struct il_eeprom_channel *)il_eeprom_query_addr(il, - offset); - *eeprom_ch_idx = il_eeprom_band_6; - break; - case 7: /* 5 GHz ht40 channels */ - *eeprom_ch_count = ARRAY_SIZE(il_eeprom_band_7); - *eeprom_ch_info = - (struct il_eeprom_channel *)il_eeprom_query_addr(il, - offset); - *eeprom_ch_idx = il_eeprom_band_7; - break; - default: - BUG(); - } -} - -#define CHECK_AND_PRINT(x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \ - ? # x " " : "") -/** - * il_mod_ht40_chan_info - Copy ht40 channel info into driver's il. - * - * Does not set up a command, or touch hardware. - */ -static int -il_mod_ht40_chan_info(struct il_priv *il, enum ieee80211_band band, u16 channel, - const struct il_eeprom_channel *eeprom_ch, - u8 clear_ht40_extension_channel) -{ - struct il_channel_info *ch_info; - - ch_info = - (struct il_channel_info *)il_get_channel_info(il, band, channel); - - if (!il_is_channel_valid(ch_info)) - return -1; - - D_EEPROM("HT40 Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm):" - " Ad-Hoc %ssupported\n", ch_info->channel, - il_is_channel_a_band(ch_info) ? "5.2" : "2.4", - CHECK_AND_PRINT(IBSS), CHECK_AND_PRINT(ACTIVE), - CHECK_AND_PRINT(RADAR), CHECK_AND_PRINT(WIDE), - CHECK_AND_PRINT(DFS), eeprom_ch->flags, - eeprom_ch->max_power_avg, - ((eeprom_ch->flags & EEPROM_CHANNEL_IBSS) && - !(eeprom_ch->flags & EEPROM_CHANNEL_RADAR)) ? "" : "not "); - - ch_info->ht40_eeprom = *eeprom_ch; - ch_info->ht40_max_power_avg = eeprom_ch->max_power_avg; - ch_info->ht40_flags = eeprom_ch->flags; - if (eeprom_ch->flags & EEPROM_CHANNEL_VALID) - ch_info->ht40_extension_channel &= - ~clear_ht40_extension_channel; - - return 0; -} - -#define CHECK_AND_PRINT_I(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \ - ? # x " " : "") - -/** - * il_init_channel_map - Set up driver's info for all possible channels - */ -int -il_init_channel_map(struct il_priv *il) -{ - int eeprom_ch_count = 0; - const u8 *eeprom_ch_idx = NULL; - const struct il_eeprom_channel *eeprom_ch_info = NULL; - int band, ch; - struct il_channel_info *ch_info; - - if (il->channel_count) { - D_EEPROM("Channel map already initialized.\n"); - return 0; - } - - D_EEPROM("Initializing regulatory info from EEPROM\n"); - - il->channel_count = - ARRAY_SIZE(il_eeprom_band_1) + ARRAY_SIZE(il_eeprom_band_2) + - ARRAY_SIZE(il_eeprom_band_3) + ARRAY_SIZE(il_eeprom_band_4) + - ARRAY_SIZE(il_eeprom_band_5); - - D_EEPROM("Parsing data for %d channels.\n", il->channel_count); - - il->channel_info = - kzalloc(sizeof(struct il_channel_info) * il->channel_count, - GFP_KERNEL); - if (!il->channel_info) { - IL_ERR("Could not allocate channel_info\n"); - il->channel_count = 0; - return -ENOMEM; - } - - ch_info = il->channel_info; - - /* Loop through the 5 EEPROM bands adding them in order to the - * channel map we maintain (that contains additional information than - * what just in the EEPROM) */ - for (band = 1; band <= 5; band++) { - - il_init_band_reference(il, band, &eeprom_ch_count, - &eeprom_ch_info, &eeprom_ch_idx); - - /* Loop through each band adding each of the channels */ - for (ch = 0; ch < eeprom_ch_count; ch++) { - ch_info->channel = eeprom_ch_idx[ch]; - ch_info->band = - (band == - 1) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; - - /* permanently store EEPROM's channel regulatory flags - * and max power in channel info database. */ - ch_info->eeprom = eeprom_ch_info[ch]; - - /* Copy the run-time flags so they are there even on - * invalid channels */ - ch_info->flags = eeprom_ch_info[ch].flags; - /* First write that ht40 is not enabled, and then enable - * one by one */ - ch_info->ht40_extension_channel = - IEEE80211_CHAN_NO_HT40; - - if (!(il_is_channel_valid(ch_info))) { - D_EEPROM("Ch. %d Flags %x [%sGHz] - " - "No traffic\n", ch_info->channel, - ch_info->flags, - il_is_channel_a_band(ch_info) ? "5.2" : - "2.4"); - ch_info++; - continue; - } - - /* Initialize regulatory-based run-time data */ - ch_info->max_power_avg = ch_info->curr_txpow = - eeprom_ch_info[ch].max_power_avg; - ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; - ch_info->min_power = 0; - - D_EEPROM("Ch. %d [%sGHz] " "%s%s%s%s%s%s(0x%02x %ddBm):" - " Ad-Hoc %ssupported\n", ch_info->channel, - il_is_channel_a_band(ch_info) ? "5.2" : "2.4", - CHECK_AND_PRINT_I(VALID), - CHECK_AND_PRINT_I(IBSS), - CHECK_AND_PRINT_I(ACTIVE), - CHECK_AND_PRINT_I(RADAR), - CHECK_AND_PRINT_I(WIDE), - CHECK_AND_PRINT_I(DFS), - eeprom_ch_info[ch].flags, - eeprom_ch_info[ch].max_power_avg, - ((eeprom_ch_info[ch]. - flags & EEPROM_CHANNEL_IBSS) && - !(eeprom_ch_info[ch]. - flags & EEPROM_CHANNEL_RADAR)) ? "" : - "not "); - - ch_info++; - } - } - - /* Check if we do have HT40 channels */ - if (il->cfg->regulatory_bands[5] == EEPROM_REGULATORY_BAND_NO_HT40 && - il->cfg->regulatory_bands[6] == EEPROM_REGULATORY_BAND_NO_HT40) - return 0; - - /* Two additional EEPROM bands for 2.4 and 5 GHz HT40 channels */ - for (band = 6; band <= 7; band++) { - enum ieee80211_band ieeeband; - - il_init_band_reference(il, band, &eeprom_ch_count, - &eeprom_ch_info, &eeprom_ch_idx); - - /* EEPROM band 6 is 2.4, band 7 is 5 GHz */ - ieeeband = - (band == 6) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; - - /* Loop through each band adding each of the channels */ - for (ch = 0; ch < eeprom_ch_count; ch++) { - /* Set up driver's info for lower half */ - il_mod_ht40_chan_info(il, ieeeband, eeprom_ch_idx[ch], - &eeprom_ch_info[ch], - IEEE80211_CHAN_NO_HT40PLUS); - - /* Set up driver's info for upper half */ - il_mod_ht40_chan_info(il, ieeeband, - eeprom_ch_idx[ch] + 4, - &eeprom_ch_info[ch], - IEEE80211_CHAN_NO_HT40MINUS); - } - } - - return 0; -} -EXPORT_SYMBOL(il_init_channel_map); - -/* - * il_free_channel_map - undo allocations in il_init_channel_map - */ -void -il_free_channel_map(struct il_priv *il) -{ - kfree(il->channel_info); - il->channel_count = 0; -} -EXPORT_SYMBOL(il_free_channel_map); - -/** - * il_get_channel_info - Find driver's ilate channel info - * - * Based on band and channel number. - */ -const struct il_channel_info * -il_get_channel_info(const struct il_priv *il, enum ieee80211_band band, - u16 channel) -{ - int i; - - switch (band) { - case IEEE80211_BAND_5GHZ: - for (i = 14; i < il->channel_count; i++) { - if (il->channel_info[i].channel == channel) - return &il->channel_info[i]; - } - break; - case IEEE80211_BAND_2GHZ: - if (channel >= 1 && channel <= 14) - return &il->channel_info[channel - 1]; - break; - default: - BUG(); - } - - return NULL; -} -EXPORT_SYMBOL(il_get_channel_info); - -/* - * Setting power level allows the card to go to sleep when not busy. - * - * We calculate a sleep command based on the required latency, which - * we get from mac80211. In order to handle thermal throttling, we can - * also use pre-defined power levels. - */ - -/* - * This defines the old power levels. They are still used by default - * (level 1) and for thermal throttle (levels 3 through 5) - */ - -struct il_power_vec_entry { - struct il_powertable_cmd cmd; - u8 no_dtim; /* number of skip dtim */ -}; - -static void -il_power_sleep_cam_cmd(struct il_priv *il, struct il_powertable_cmd *cmd) -{ - memset(cmd, 0, sizeof(*cmd)); - - if (il->power_data.pci_pm) - cmd->flags |= IL_POWER_PCI_PM_MSK; - - D_POWER("Sleep command for CAM\n"); -} - -static int -il_set_power(struct il_priv *il, struct il_powertable_cmd *cmd) -{ - D_POWER("Sending power/sleep command\n"); - D_POWER("Flags value = 0x%08X\n", cmd->flags); - D_POWER("Tx timeout = %u\n", le32_to_cpu(cmd->tx_data_timeout)); - D_POWER("Rx timeout = %u\n", le32_to_cpu(cmd->rx_data_timeout)); - D_POWER("Sleep interval vector = { %d , %d , %d , %d , %d }\n", - le32_to_cpu(cmd->sleep_interval[0]), - le32_to_cpu(cmd->sleep_interval[1]), - le32_to_cpu(cmd->sleep_interval[2]), - le32_to_cpu(cmd->sleep_interval[3]), - le32_to_cpu(cmd->sleep_interval[4])); - - return il_send_cmd_pdu(il, C_POWER_TBL, - sizeof(struct il_powertable_cmd), cmd); -} - -static int -il_power_set_mode(struct il_priv *il, struct il_powertable_cmd *cmd, bool force) -{ - int ret; - bool update_chains; - - lockdep_assert_held(&il->mutex); - - /* Don't update the RX chain when chain noise calibration is running */ - update_chains = il->chain_noise_data.state == IL_CHAIN_NOISE_DONE || - il->chain_noise_data.state == IL_CHAIN_NOISE_ALIVE; - - if (!memcmp(&il->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force) - return 0; - - if (!il_is_ready_rf(il)) - return -EIO; - - /* scan complete use sleep_power_next, need to be updated */ - memcpy(&il->power_data.sleep_cmd_next, cmd, sizeof(*cmd)); - if (test_bit(S_SCANNING, &il->status) && !force) { - D_INFO("Defer power set mode while scanning\n"); - return 0; - } - - if (cmd->flags & IL_POWER_DRIVER_ALLOW_SLEEP_MSK) - set_bit(S_POWER_PMI, &il->status); - - ret = il_set_power(il, cmd); - if (!ret) { - if (!(cmd->flags & IL_POWER_DRIVER_ALLOW_SLEEP_MSK)) - clear_bit(S_POWER_PMI, &il->status); - - if (il->ops->update_chain_flags && update_chains) - il->ops->update_chain_flags(il); - else if (il->ops->update_chain_flags) - D_POWER("Cannot update the power, chain noise " - "calibration running: %d\n", - il->chain_noise_data.state); - - memcpy(&il->power_data.sleep_cmd, cmd, sizeof(*cmd)); - } else - IL_ERR("set power fail, ret = %d", ret); - - return ret; -} - -int -il_power_update_mode(struct il_priv *il, bool force) -{ - struct il_powertable_cmd cmd; - - il_power_sleep_cam_cmd(il, &cmd); - return il_power_set_mode(il, &cmd, force); -} -EXPORT_SYMBOL(il_power_update_mode); - -/* initialize to default */ -void -il_power_initialize(struct il_priv *il) -{ - u16 lctl; - - pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl); - il->power_data.pci_pm = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S); - - il->power_data.debug_sleep_level_override = -1; - - memset(&il->power_data.sleep_cmd, 0, sizeof(il->power_data.sleep_cmd)); -} -EXPORT_SYMBOL(il_power_initialize); - -/* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after - * sending probe req. This should be set long enough to hear probe responses - * from more than one AP. */ -#define IL_ACTIVE_DWELL_TIME_24 (30) /* all times in msec */ -#define IL_ACTIVE_DWELL_TIME_52 (20) - -#define IL_ACTIVE_DWELL_FACTOR_24GHZ (3) -#define IL_ACTIVE_DWELL_FACTOR_52GHZ (2) - -/* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel. - * Must be set longer than active dwell time. - * For the most reliable scan, set > AP beacon interval (typically 100msec). */ -#define IL_PASSIVE_DWELL_TIME_24 (20) /* all times in msec */ -#define IL_PASSIVE_DWELL_TIME_52 (10) -#define IL_PASSIVE_DWELL_BASE (100) -#define IL_CHANNEL_TUNE_TIME 5 - -static int -il_send_scan_abort(struct il_priv *il) -{ - int ret; - struct il_rx_pkt *pkt; - struct il_host_cmd cmd = { - .id = C_SCAN_ABORT, - .flags = CMD_WANT_SKB, - }; - - /* Exit instantly with error when device is not ready - * to receive scan abort command or it does not perform - * hardware scan currently */ - if (!test_bit(S_READY, &il->status) || - !test_bit(S_GEO_CONFIGURED, &il->status) || - !test_bit(S_SCAN_HW, &il->status) || - test_bit(S_FW_ERROR, &il->status) || - test_bit(S_EXIT_PENDING, &il->status)) - return -EIO; - - ret = il_send_cmd_sync(il, &cmd); - if (ret) - return ret; - - pkt = (struct il_rx_pkt *)cmd.reply_page; - if (pkt->u.status != CAN_ABORT_STATUS) { - /* The scan abort will return 1 for success or - * 2 for "failure". A failure condition can be - * due to simply not being in an active scan which - * can occur if we send the scan abort before we - * the microcode has notified us that a scan is - * completed. */ - D_SCAN("SCAN_ABORT ret %d.\n", pkt->u.status); - ret = -EIO; - } - - il_free_pages(il, cmd.reply_page); - return ret; -} - -static void -il_complete_scan(struct il_priv *il, bool aborted) -{ - /* check if scan was requested from mac80211 */ - if (il->scan_request) { - D_SCAN("Complete scan in mac80211\n"); - ieee80211_scan_completed(il->hw, aborted); - } - - il->scan_vif = NULL; - il->scan_request = NULL; -} - -void -il_force_scan_end(struct il_priv *il) -{ - lockdep_assert_held(&il->mutex); - - if (!test_bit(S_SCANNING, &il->status)) { - D_SCAN("Forcing scan end while not scanning\n"); - return; - } - - D_SCAN("Forcing scan end\n"); - clear_bit(S_SCANNING, &il->status); - clear_bit(S_SCAN_HW, &il->status); - clear_bit(S_SCAN_ABORTING, &il->status); - il_complete_scan(il, true); -} - -static void -il_do_scan_abort(struct il_priv *il) -{ - int ret; - - lockdep_assert_held(&il->mutex); - - if (!test_bit(S_SCANNING, &il->status)) { - D_SCAN("Not performing scan to abort\n"); - return; - } - - if (test_and_set_bit(S_SCAN_ABORTING, &il->status)) { - D_SCAN("Scan abort in progress\n"); - return; - } - - ret = il_send_scan_abort(il); - if (ret) { - D_SCAN("Send scan abort failed %d\n", ret); - il_force_scan_end(il); - } else - D_SCAN("Successfully send scan abort\n"); -} - -/** - * il_scan_cancel - Cancel any currently executing HW scan - */ -int -il_scan_cancel(struct il_priv *il) -{ - D_SCAN("Queuing abort scan\n"); - queue_work(il->workqueue, &il->abort_scan); - return 0; -} -EXPORT_SYMBOL(il_scan_cancel); - -/** - * il_scan_cancel_timeout - Cancel any currently executing HW scan - * @ms: amount of time to wait (in milliseconds) for scan to abort - * - */ -int -il_scan_cancel_timeout(struct il_priv *il, unsigned long ms) -{ - unsigned long timeout = jiffies + msecs_to_jiffies(ms); - - lockdep_assert_held(&il->mutex); - - D_SCAN("Scan cancel timeout\n"); - - il_do_scan_abort(il); - - while (time_before_eq(jiffies, timeout)) { - if (!test_bit(S_SCAN_HW, &il->status)) - break; - msleep(20); - } - - return test_bit(S_SCAN_HW, &il->status); -} -EXPORT_SYMBOL(il_scan_cancel_timeout); - -/* Service response to C_SCAN (0x80) */ -static void -il_hdl_scan(struct il_priv *il, struct il_rx_buf *rxb) -{ -#ifdef CONFIG_IWLEGACY_DEBUG - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il_scanreq_notification *notif = - (struct il_scanreq_notification *)pkt->u.raw; - - D_SCAN("Scan request status = 0x%x\n", notif->status); -#endif -} - -/* Service N_SCAN_START (0x82) */ -static void -il_hdl_scan_start(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il_scanstart_notification *notif = - (struct il_scanstart_notification *)pkt->u.raw; - il->scan_start_tsf = le32_to_cpu(notif->tsf_low); - D_SCAN("Scan start: " "%d [802.11%s] " - "(TSF: 0x%08X:%08X) - %d (beacon timer %u)\n", notif->channel, - notif->band ? "bg" : "a", le32_to_cpu(notif->tsf_high), - le32_to_cpu(notif->tsf_low), notif->status, notif->beacon_timer); -} - -/* Service N_SCAN_RESULTS (0x83) */ -static void -il_hdl_scan_results(struct il_priv *il, struct il_rx_buf *rxb) -{ -#ifdef CONFIG_IWLEGACY_DEBUG - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il_scanresults_notification *notif = - (struct il_scanresults_notification *)pkt->u.raw; - - D_SCAN("Scan ch.res: " "%d [802.11%s] " "(TSF: 0x%08X:%08X) - %d " - "elapsed=%lu usec\n", notif->channel, notif->band ? "bg" : "a", - le32_to_cpu(notif->tsf_high), le32_to_cpu(notif->tsf_low), - le32_to_cpu(notif->stats[0]), - le32_to_cpu(notif->tsf_low) - il->scan_start_tsf); -#endif -} - -/* Service N_SCAN_COMPLETE (0x84) */ -static void -il_hdl_scan_complete(struct il_priv *il, struct il_rx_buf *rxb) -{ - -#ifdef CONFIG_IWLEGACY_DEBUG - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il_scancomplete_notification *scan_notif = (void *)pkt->u.raw; -#endif - - D_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", - scan_notif->scanned_channels, scan_notif->tsf_low, - scan_notif->tsf_high, scan_notif->status); - - /* The HW is no longer scanning */ - clear_bit(S_SCAN_HW, &il->status); - - D_SCAN("Scan on %sGHz took %dms\n", - (il->scan_band == IEEE80211_BAND_2GHZ) ? "2.4" : "5.2", - jiffies_to_msecs(jiffies - il->scan_start)); - - queue_work(il->workqueue, &il->scan_completed); -} - -void -il_setup_rx_scan_handlers(struct il_priv *il) -{ - /* scan handlers */ - il->handlers[C_SCAN] = il_hdl_scan; - il->handlers[N_SCAN_START] = il_hdl_scan_start; - il->handlers[N_SCAN_RESULTS] = il_hdl_scan_results; - il->handlers[N_SCAN_COMPLETE] = il_hdl_scan_complete; -} -EXPORT_SYMBOL(il_setup_rx_scan_handlers); - -u16 -il_get_active_dwell_time(struct il_priv *il, enum ieee80211_band band, - u8 n_probes) -{ - if (band == IEEE80211_BAND_5GHZ) - return IL_ACTIVE_DWELL_TIME_52 + - IL_ACTIVE_DWELL_FACTOR_52GHZ * (n_probes + 1); - else - return IL_ACTIVE_DWELL_TIME_24 + - IL_ACTIVE_DWELL_FACTOR_24GHZ * (n_probes + 1); -} -EXPORT_SYMBOL(il_get_active_dwell_time); - -u16 -il_get_passive_dwell_time(struct il_priv *il, enum ieee80211_band band, - struct ieee80211_vif *vif) -{ - u16 value; - - u16 passive = - (band == - IEEE80211_BAND_2GHZ) ? IL_PASSIVE_DWELL_BASE + - IL_PASSIVE_DWELL_TIME_24 : IL_PASSIVE_DWELL_BASE + - IL_PASSIVE_DWELL_TIME_52; - - if (il_is_any_associated(il)) { - /* - * If we're associated, we clamp the maximum passive - * dwell time to be 98% of the smallest beacon interval - * (minus 2 * channel tune time) - */ - value = il->vif ? il->vif->bss_conf.beacon_int : 0; - if (value > IL_PASSIVE_DWELL_BASE || !value) - value = IL_PASSIVE_DWELL_BASE; - value = (value * 98) / 100 - IL_CHANNEL_TUNE_TIME * 2; - passive = min(value, passive); - } - - return passive; -} -EXPORT_SYMBOL(il_get_passive_dwell_time); - -void -il_init_scan_params(struct il_priv *il) -{ - u8 ant_idx = fls(il->hw_params.valid_tx_ant) - 1; - if (!il->scan_tx_ant[IEEE80211_BAND_5GHZ]) - il->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx; - if (!il->scan_tx_ant[IEEE80211_BAND_2GHZ]) - il->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx; -} -EXPORT_SYMBOL(il_init_scan_params); - -static int -il_scan_initiate(struct il_priv *il, struct ieee80211_vif *vif) -{ - int ret; - - lockdep_assert_held(&il->mutex); - - cancel_delayed_work(&il->scan_check); - - if (!il_is_ready_rf(il)) { - IL_WARN("Request scan called when driver not ready.\n"); - return -EIO; - } - - if (test_bit(S_SCAN_HW, &il->status)) { - D_SCAN("Multiple concurrent scan requests in parallel.\n"); - return -EBUSY; - } - - if (test_bit(S_SCAN_ABORTING, &il->status)) { - D_SCAN("Scan request while abort pending.\n"); - return -EBUSY; - } - - D_SCAN("Starting scan...\n"); - - set_bit(S_SCANNING, &il->status); - il->scan_start = jiffies; - - ret = il->ops->request_scan(il, vif); - if (ret) { - clear_bit(S_SCANNING, &il->status); - return ret; - } - - queue_delayed_work(il->workqueue, &il->scan_check, - IL_SCAN_CHECK_WATCHDOG); - - return 0; -} - -int -il_mac_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct cfg80211_scan_request *req) -{ - struct il_priv *il = hw->priv; - int ret; - - if (req->n_channels == 0) { - IL_ERR("Can not scan on no channels.\n"); - return -EINVAL; - } - - mutex_lock(&il->mutex); - D_MAC80211("enter\n"); - - if (test_bit(S_SCANNING, &il->status)) { - D_SCAN("Scan already in progress.\n"); - ret = -EAGAIN; - goto out_unlock; - } - - /* mac80211 will only ask for one band at a time */ - il->scan_request = req; - il->scan_vif = vif; - il->scan_band = req->channels[0]->band; - - ret = il_scan_initiate(il, vif); - -out_unlock: - D_MAC80211("leave ret %d\n", ret); - mutex_unlock(&il->mutex); - - return ret; -} -EXPORT_SYMBOL(il_mac_hw_scan); - -static void -il_bg_scan_check(struct work_struct *data) -{ - struct il_priv *il = - container_of(data, struct il_priv, scan_check.work); - - D_SCAN("Scan check work\n"); - - /* Since we are here firmware does not finish scan and - * most likely is in bad shape, so we don't bother to - * send abort command, just force scan complete to mac80211 */ - mutex_lock(&il->mutex); - il_force_scan_end(il); - mutex_unlock(&il->mutex); -} - -/** - * il_fill_probe_req - fill in all required fields and IE for probe request - */ - -u16 -il_fill_probe_req(struct il_priv *il, struct ieee80211_mgmt *frame, - const u8 *ta, const u8 *ies, int ie_len, int left) -{ - int len = 0; - u8 *pos = NULL; - - /* Make sure there is enough space for the probe request, - * two mandatory IEs and the data */ - left -= 24; - if (left < 0) - return 0; - - frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); - eth_broadcast_addr(frame->da); - memcpy(frame->sa, ta, ETH_ALEN); - eth_broadcast_addr(frame->bssid); - frame->seq_ctrl = 0; - - len += 24; - - /* ...next IE... */ - pos = &frame->u.probe_req.variable[0]; - - /* fill in our indirect SSID IE */ - left -= 2; - if (left < 0) - return 0; - *pos++ = WLAN_EID_SSID; - *pos++ = 0; - - len += 2; - - if (WARN_ON(left < ie_len)) - return len; - - if (ies && ie_len) { - memcpy(pos, ies, ie_len); - len += ie_len; - } - - return (u16) len; -} -EXPORT_SYMBOL(il_fill_probe_req); - -static void -il_bg_abort_scan(struct work_struct *work) -{ - struct il_priv *il = container_of(work, struct il_priv, abort_scan); - - D_SCAN("Abort scan work\n"); - - /* We keep scan_check work queued in case when firmware will not - * report back scan completed notification */ - mutex_lock(&il->mutex); - il_scan_cancel_timeout(il, 200); - mutex_unlock(&il->mutex); -} - -static void -il_bg_scan_completed(struct work_struct *work) -{ - struct il_priv *il = container_of(work, struct il_priv, scan_completed); - bool aborted; - - D_SCAN("Completed scan.\n"); - - cancel_delayed_work(&il->scan_check); - - mutex_lock(&il->mutex); - - aborted = test_and_clear_bit(S_SCAN_ABORTING, &il->status); - if (aborted) - D_SCAN("Aborted scan completed.\n"); - - if (!test_and_clear_bit(S_SCANNING, &il->status)) { - D_SCAN("Scan already completed.\n"); - goto out_settings; - } - - il_complete_scan(il, aborted); - -out_settings: - /* Can we still talk to firmware ? */ - if (!il_is_ready_rf(il)) - goto out; - - /* - * We do not commit power settings while scan is pending, - * do it now if the settings changed. - */ - il_power_set_mode(il, &il->power_data.sleep_cmd_next, false); - il_set_tx_power(il, il->tx_power_next, false); - - il->ops->post_scan(il); - -out: - mutex_unlock(&il->mutex); -} - -void -il_setup_scan_deferred_work(struct il_priv *il) -{ - INIT_WORK(&il->scan_completed, il_bg_scan_completed); - INIT_WORK(&il->abort_scan, il_bg_abort_scan); - INIT_DELAYED_WORK(&il->scan_check, il_bg_scan_check); -} -EXPORT_SYMBOL(il_setup_scan_deferred_work); - -void -il_cancel_scan_deferred_work(struct il_priv *il) -{ - cancel_work_sync(&il->abort_scan); - cancel_work_sync(&il->scan_completed); - - if (cancel_delayed_work_sync(&il->scan_check)) { - mutex_lock(&il->mutex); - il_force_scan_end(il); - mutex_unlock(&il->mutex); - } -} -EXPORT_SYMBOL(il_cancel_scan_deferred_work); - -/* il->sta_lock must be held */ -static void -il_sta_ucode_activate(struct il_priv *il, u8 sta_id) -{ - - if (!(il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE)) - IL_ERR("ACTIVATE a non DRIVER active station id %u addr %pM\n", - sta_id, il->stations[sta_id].sta.sta.addr); - - if (il->stations[sta_id].used & IL_STA_UCODE_ACTIVE) { - D_ASSOC("STA id %u addr %pM already present" - " in uCode (according to driver)\n", sta_id, - il->stations[sta_id].sta.sta.addr); - } else { - il->stations[sta_id].used |= IL_STA_UCODE_ACTIVE; - D_ASSOC("Added STA id %u addr %pM to uCode\n", sta_id, - il->stations[sta_id].sta.sta.addr); - } -} - -static int -il_process_add_sta_resp(struct il_priv *il, struct il_addsta_cmd *addsta, - struct il_rx_pkt *pkt, bool sync) -{ - u8 sta_id = addsta->sta.sta_id; - unsigned long flags; - int ret = -EIO; - - if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { - IL_ERR("Bad return from C_ADD_STA (0x%08X)\n", pkt->hdr.flags); - return ret; - } - - D_INFO("Processing response for adding station %u\n", sta_id); - - spin_lock_irqsave(&il->sta_lock, flags); - - switch (pkt->u.add_sta.status) { - case ADD_STA_SUCCESS_MSK: - D_INFO("C_ADD_STA PASSED\n"); - il_sta_ucode_activate(il, sta_id); - ret = 0; - break; - case ADD_STA_NO_ROOM_IN_TBL: - IL_ERR("Adding station %d failed, no room in table.\n", sta_id); - break; - case ADD_STA_NO_BLOCK_ACK_RESOURCE: - IL_ERR("Adding station %d failed, no block ack resource.\n", - sta_id); - break; - case ADD_STA_MODIFY_NON_EXIST_STA: - IL_ERR("Attempting to modify non-existing station %d\n", - sta_id); - break; - default: - D_ASSOC("Received C_ADD_STA:(0x%08X)\n", pkt->u.add_sta.status); - break; - } - - D_INFO("%s station id %u addr %pM\n", - il->stations[sta_id].sta.mode == - STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", sta_id, - il->stations[sta_id].sta.sta.addr); - - /* - * XXX: The MAC address in the command buffer is often changed from - * the original sent to the device. That is, the MAC address - * written to the command buffer often is not the same MAC address - * read from the command buffer when the command returns. This - * issue has not yet been resolved and this debugging is left to - * observe the problem. - */ - D_INFO("%s station according to cmd buffer %pM\n", - il->stations[sta_id].sta.mode == - STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", addsta->sta.addr); - spin_unlock_irqrestore(&il->sta_lock, flags); - - return ret; -} - -static void -il_add_sta_callback(struct il_priv *il, struct il_device_cmd *cmd, - struct il_rx_pkt *pkt) -{ - struct il_addsta_cmd *addsta = (struct il_addsta_cmd *)cmd->cmd.payload; - - il_process_add_sta_resp(il, addsta, pkt, false); - -} - -int -il_send_add_sta(struct il_priv *il, struct il_addsta_cmd *sta, u8 flags) -{ - struct il_rx_pkt *pkt = NULL; - int ret = 0; - u8 data[sizeof(*sta)]; - struct il_host_cmd cmd = { - .id = C_ADD_STA, - .flags = flags, - .data = data, - }; - u8 sta_id __maybe_unused = sta->sta.sta_id; - - D_INFO("Adding sta %u (%pM) %ssynchronously\n", sta_id, sta->sta.addr, - flags & CMD_ASYNC ? "a" : ""); - - if (flags & CMD_ASYNC) - cmd.callback = il_add_sta_callback; - else { - cmd.flags |= CMD_WANT_SKB; - might_sleep(); - } - - cmd.len = il->ops->build_addsta_hcmd(sta, data); - ret = il_send_cmd(il, &cmd); - - if (ret || (flags & CMD_ASYNC)) - return ret; - - if (ret == 0) { - pkt = (struct il_rx_pkt *)cmd.reply_page; - ret = il_process_add_sta_resp(il, sta, pkt, true); - } - il_free_pages(il, cmd.reply_page); - - return ret; -} -EXPORT_SYMBOL(il_send_add_sta); - -static void -il_set_ht_add_station(struct il_priv *il, u8 idx, struct ieee80211_sta *sta) -{ - struct ieee80211_sta_ht_cap *sta_ht_inf = &sta->ht_cap; - __le32 sta_flags; - - if (!sta || !sta_ht_inf->ht_supported) - goto done; - - D_ASSOC("spatial multiplexing power save mode: %s\n", - (sta->smps_mode == IEEE80211_SMPS_STATIC) ? "static" : - (sta->smps_mode == IEEE80211_SMPS_DYNAMIC) ? "dynamic" : - "disabled"); - - sta_flags = il->stations[idx].sta.station_flags; - - sta_flags &= ~(STA_FLG_RTS_MIMO_PROT_MSK | STA_FLG_MIMO_DIS_MSK); - - switch (sta->smps_mode) { - case IEEE80211_SMPS_STATIC: - sta_flags |= STA_FLG_MIMO_DIS_MSK; - break; - case IEEE80211_SMPS_DYNAMIC: - sta_flags |= STA_FLG_RTS_MIMO_PROT_MSK; - break; - case IEEE80211_SMPS_OFF: - break; - default: - IL_WARN("Invalid MIMO PS mode %d\n", sta->smps_mode); - break; - } - - sta_flags |= - cpu_to_le32((u32) sta_ht_inf-> - ampdu_factor << STA_FLG_MAX_AGG_SIZE_POS); - - sta_flags |= - cpu_to_le32((u32) sta_ht_inf-> - ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); - - if (il_is_ht40_tx_allowed(il, &sta->ht_cap)) - sta_flags |= STA_FLG_HT40_EN_MSK; - else - sta_flags &= ~STA_FLG_HT40_EN_MSK; - - il->stations[idx].sta.station_flags = sta_flags; -done: - return; -} - -/** - * il_prep_station - Prepare station information for addition - * - * should be called with sta_lock held - */ -u8 -il_prep_station(struct il_priv *il, const u8 *addr, bool is_ap, - struct ieee80211_sta *sta) -{ - struct il_station_entry *station; - int i; - u8 sta_id = IL_INVALID_STATION; - u16 rate; - - if (is_ap) - sta_id = IL_AP_ID; - else if (is_broadcast_ether_addr(addr)) - sta_id = il->hw_params.bcast_id; - else - for (i = IL_STA_ID; i < il->hw_params.max_stations; i++) { - if (ether_addr_equal(il->stations[i].sta.sta.addr, - addr)) { - sta_id = i; - break; - } - - if (!il->stations[i].used && - sta_id == IL_INVALID_STATION) - sta_id = i; - } - - /* - * These two conditions have the same outcome, but keep them - * separate - */ - if (unlikely(sta_id == IL_INVALID_STATION)) - return sta_id; - - /* - * uCode is not able to deal with multiple requests to add a - * station. Keep track if one is in progress so that we do not send - * another. - */ - if (il->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) { - D_INFO("STA %d already in process of being added.\n", sta_id); - return sta_id; - } - - if ((il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) && - (il->stations[sta_id].used & IL_STA_UCODE_ACTIVE) && - ether_addr_equal(il->stations[sta_id].sta.sta.addr, addr)) { - D_ASSOC("STA %d (%pM) already added, not adding again.\n", - sta_id, addr); - return sta_id; - } - - station = &il->stations[sta_id]; - station->used = IL_STA_DRIVER_ACTIVE; - D_ASSOC("Add STA to driver ID %d: %pM\n", sta_id, addr); - il->num_stations++; - - /* Set up the C_ADD_STA command to send to device */ - memset(&station->sta, 0, sizeof(struct il_addsta_cmd)); - memcpy(station->sta.sta.addr, addr, ETH_ALEN); - station->sta.mode = 0; - station->sta.sta.sta_id = sta_id; - station->sta.station_flags = 0; - - /* - * OK to call unconditionally, since local stations (IBSS BSSID - * STA and broadcast STA) pass in a NULL sta, and mac80211 - * doesn't allow HT IBSS. - */ - il_set_ht_add_station(il, sta_id, sta); - - /* 3945 only */ - rate = (il->band == IEEE80211_BAND_5GHZ) ? RATE_6M_PLCP : RATE_1M_PLCP; - /* Turn on both antennas for the station... */ - station->sta.rate_n_flags = cpu_to_le16(rate | RATE_MCS_ANT_AB_MSK); - - return sta_id; - -} -EXPORT_SYMBOL_GPL(il_prep_station); - -#define STA_WAIT_TIMEOUT (HZ/2) - -/** - * il_add_station_common - - */ -int -il_add_station_common(struct il_priv *il, const u8 *addr, bool is_ap, - struct ieee80211_sta *sta, u8 *sta_id_r) -{ - unsigned long flags_spin; - int ret = 0; - u8 sta_id; - struct il_addsta_cmd sta_cmd; - - *sta_id_r = 0; - spin_lock_irqsave(&il->sta_lock, flags_spin); - sta_id = il_prep_station(il, addr, is_ap, sta); - if (sta_id == IL_INVALID_STATION) { - IL_ERR("Unable to prepare station %pM for addition\n", addr); - spin_unlock_irqrestore(&il->sta_lock, flags_spin); - return -EINVAL; - } - - /* - * uCode is not able to deal with multiple requests to add a - * station. Keep track if one is in progress so that we do not send - * another. - */ - if (il->stations[sta_id].used & IL_STA_UCODE_INPROGRESS) { - D_INFO("STA %d already in process of being added.\n", sta_id); - spin_unlock_irqrestore(&il->sta_lock, flags_spin); - return -EEXIST; - } - - if ((il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE) && - (il->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) { - D_ASSOC("STA %d (%pM) already added, not adding again.\n", - sta_id, addr); - spin_unlock_irqrestore(&il->sta_lock, flags_spin); - return -EEXIST; - } - - il->stations[sta_id].used |= IL_STA_UCODE_INPROGRESS; - memcpy(&sta_cmd, &il->stations[sta_id].sta, - sizeof(struct il_addsta_cmd)); - spin_unlock_irqrestore(&il->sta_lock, flags_spin); - - /* Add station to device's station table */ - ret = il_send_add_sta(il, &sta_cmd, CMD_SYNC); - if (ret) { - spin_lock_irqsave(&il->sta_lock, flags_spin); - IL_ERR("Adding station %pM failed.\n", - il->stations[sta_id].sta.sta.addr); - il->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE; - il->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS; - spin_unlock_irqrestore(&il->sta_lock, flags_spin); - } - *sta_id_r = sta_id; - return ret; -} -EXPORT_SYMBOL(il_add_station_common); - -/** - * il_sta_ucode_deactivate - deactivate ucode status for a station - * - * il->sta_lock must be held - */ -static void -il_sta_ucode_deactivate(struct il_priv *il, u8 sta_id) -{ - /* Ucode must be active and driver must be non active */ - if ((il->stations[sta_id]. - used & (IL_STA_UCODE_ACTIVE | IL_STA_DRIVER_ACTIVE)) != - IL_STA_UCODE_ACTIVE) - IL_ERR("removed non active STA %u\n", sta_id); - - il->stations[sta_id].used &= ~IL_STA_UCODE_ACTIVE; - - memset(&il->stations[sta_id], 0, sizeof(struct il_station_entry)); - D_ASSOC("Removed STA %u\n", sta_id); -} - -static int -il_send_remove_station(struct il_priv *il, const u8 * addr, int sta_id, - bool temporary) -{ - struct il_rx_pkt *pkt; - int ret; - - unsigned long flags_spin; - struct il_rem_sta_cmd rm_sta_cmd; - - struct il_host_cmd cmd = { - .id = C_REM_STA, - .len = sizeof(struct il_rem_sta_cmd), - .flags = CMD_SYNC, - .data = &rm_sta_cmd, - }; - - memset(&rm_sta_cmd, 0, sizeof(rm_sta_cmd)); - rm_sta_cmd.num_sta = 1; - memcpy(&rm_sta_cmd.addr, addr, ETH_ALEN); - - cmd.flags |= CMD_WANT_SKB; - - ret = il_send_cmd(il, &cmd); - - if (ret) - return ret; - - pkt = (struct il_rx_pkt *)cmd.reply_page; - if (pkt->hdr.flags & IL_CMD_FAILED_MSK) { - IL_ERR("Bad return from C_REM_STA (0x%08X)\n", pkt->hdr.flags); - ret = -EIO; - } - - if (!ret) { - switch (pkt->u.rem_sta.status) { - case REM_STA_SUCCESS_MSK: - if (!temporary) { - spin_lock_irqsave(&il->sta_lock, flags_spin); - il_sta_ucode_deactivate(il, sta_id); - spin_unlock_irqrestore(&il->sta_lock, - flags_spin); - } - D_ASSOC("C_REM_STA PASSED\n"); - break; - default: - ret = -EIO; - IL_ERR("C_REM_STA failed\n"); - break; - } - } - il_free_pages(il, cmd.reply_page); - - return ret; -} - -/** - * il_remove_station - Remove driver's knowledge of station. - */ -int -il_remove_station(struct il_priv *il, const u8 sta_id, const u8 * addr) -{ - unsigned long flags; - - if (!il_is_ready(il)) { - D_INFO("Unable to remove station %pM, device not ready.\n", - addr); - /* - * It is typical for stations to be removed when we are - * going down. Return success since device will be down - * soon anyway - */ - return 0; - } - - D_ASSOC("Removing STA from driver:%d %pM\n", sta_id, addr); - - if (WARN_ON(sta_id == IL_INVALID_STATION)) - return -EINVAL; - - spin_lock_irqsave(&il->sta_lock, flags); - - if (!(il->stations[sta_id].used & IL_STA_DRIVER_ACTIVE)) { - D_INFO("Removing %pM but non DRIVER active\n", addr); - goto out_err; - } - - if (!(il->stations[sta_id].used & IL_STA_UCODE_ACTIVE)) { - D_INFO("Removing %pM but non UCODE active\n", addr); - goto out_err; - } - - if (il->stations[sta_id].used & IL_STA_LOCAL) { - kfree(il->stations[sta_id].lq); - il->stations[sta_id].lq = NULL; - } - - il->stations[sta_id].used &= ~IL_STA_DRIVER_ACTIVE; - - il->num_stations--; - - BUG_ON(il->num_stations < 0); - - spin_unlock_irqrestore(&il->sta_lock, flags); - - return il_send_remove_station(il, addr, sta_id, false); -out_err: - spin_unlock_irqrestore(&il->sta_lock, flags); - return -EINVAL; -} -EXPORT_SYMBOL_GPL(il_remove_station); - -/** - * il_clear_ucode_stations - clear ucode station table bits - * - * This function clears all the bits in the driver indicating - * which stations are active in the ucode. Call when something - * other than explicit station management would cause this in - * the ucode, e.g. unassociated RXON. - */ -void -il_clear_ucode_stations(struct il_priv *il) -{ - int i; - unsigned long flags_spin; - bool cleared = false; - - D_INFO("Clearing ucode stations in driver\n"); - - spin_lock_irqsave(&il->sta_lock, flags_spin); - for (i = 0; i < il->hw_params.max_stations; i++) { - if (il->stations[i].used & IL_STA_UCODE_ACTIVE) { - D_INFO("Clearing ucode active for station %d\n", i); - il->stations[i].used &= ~IL_STA_UCODE_ACTIVE; - cleared = true; - } - } - spin_unlock_irqrestore(&il->sta_lock, flags_spin); - - if (!cleared) - D_INFO("No active stations found to be cleared\n"); -} -EXPORT_SYMBOL(il_clear_ucode_stations); - -/** - * il_restore_stations() - Restore driver known stations to device - * - * All stations considered active by driver, but not present in ucode, is - * restored. - * - * Function sleeps. - */ -void -il_restore_stations(struct il_priv *il) -{ - struct il_addsta_cmd sta_cmd; - struct il_link_quality_cmd lq; - unsigned long flags_spin; - int i; - bool found = false; - int ret; - bool send_lq; - - if (!il_is_ready(il)) { - D_INFO("Not ready yet, not restoring any stations.\n"); - return; - } - - D_ASSOC("Restoring all known stations ... start.\n"); - spin_lock_irqsave(&il->sta_lock, flags_spin); - for (i = 0; i < il->hw_params.max_stations; i++) { - if ((il->stations[i].used & IL_STA_DRIVER_ACTIVE) && - !(il->stations[i].used & IL_STA_UCODE_ACTIVE)) { - D_ASSOC("Restoring sta %pM\n", - il->stations[i].sta.sta.addr); - il->stations[i].sta.mode = 0; - il->stations[i].used |= IL_STA_UCODE_INPROGRESS; - found = true; - } - } - - for (i = 0; i < il->hw_params.max_stations; i++) { - if ((il->stations[i].used & IL_STA_UCODE_INPROGRESS)) { - memcpy(&sta_cmd, &il->stations[i].sta, - sizeof(struct il_addsta_cmd)); - send_lq = false; - if (il->stations[i].lq) { - memcpy(&lq, il->stations[i].lq, - sizeof(struct il_link_quality_cmd)); - send_lq = true; - } - spin_unlock_irqrestore(&il->sta_lock, flags_spin); - ret = il_send_add_sta(il, &sta_cmd, CMD_SYNC); - if (ret) { - spin_lock_irqsave(&il->sta_lock, flags_spin); - IL_ERR("Adding station %pM failed.\n", - il->stations[i].sta.sta.addr); - il->stations[i].used &= ~IL_STA_DRIVER_ACTIVE; - il->stations[i].used &= - ~IL_STA_UCODE_INPROGRESS; - spin_unlock_irqrestore(&il->sta_lock, - flags_spin); - } - /* - * Rate scaling has already been initialized, send - * current LQ command - */ - if (send_lq) - il_send_lq_cmd(il, &lq, CMD_SYNC, true); - spin_lock_irqsave(&il->sta_lock, flags_spin); - il->stations[i].used &= ~IL_STA_UCODE_INPROGRESS; - } - } - - spin_unlock_irqrestore(&il->sta_lock, flags_spin); - if (!found) - D_INFO("Restoring all known stations" - " .... no stations to be restored.\n"); - else - D_INFO("Restoring all known stations" " .... complete.\n"); -} -EXPORT_SYMBOL(il_restore_stations); - -int -il_get_free_ucode_key_idx(struct il_priv *il) -{ - int i; - - for (i = 0; i < il->sta_key_max_num; i++) - if (!test_and_set_bit(i, &il->ucode_key_table)) - return i; - - return WEP_INVALID_OFFSET; -} -EXPORT_SYMBOL(il_get_free_ucode_key_idx); - -void -il_dealloc_bcast_stations(struct il_priv *il) -{ - unsigned long flags; - int i; - - spin_lock_irqsave(&il->sta_lock, flags); - for (i = 0; i < il->hw_params.max_stations; i++) { - if (!(il->stations[i].used & IL_STA_BCAST)) - continue; - - il->stations[i].used &= ~IL_STA_UCODE_ACTIVE; - il->num_stations--; - BUG_ON(il->num_stations < 0); - kfree(il->stations[i].lq); - il->stations[i].lq = NULL; - } - spin_unlock_irqrestore(&il->sta_lock, flags); -} -EXPORT_SYMBOL_GPL(il_dealloc_bcast_stations); - -#ifdef CONFIG_IWLEGACY_DEBUG -static void -il_dump_lq_cmd(struct il_priv *il, struct il_link_quality_cmd *lq) -{ - int i; - D_RATE("lq station id 0x%x\n", lq->sta_id); - D_RATE("lq ant 0x%X 0x%X\n", lq->general_params.single_stream_ant_msk, - lq->general_params.dual_stream_ant_msk); - - for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) - D_RATE("lq idx %d 0x%X\n", i, lq->rs_table[i].rate_n_flags); -} -#else -static inline void -il_dump_lq_cmd(struct il_priv *il, struct il_link_quality_cmd *lq) -{ -} -#endif - -/** - * il_is_lq_table_valid() - Test one aspect of LQ cmd for validity - * - * It sometimes happens when a HT rate has been in use and we - * loose connectivity with AP then mac80211 will first tell us that the - * current channel is not HT anymore before removing the station. In such a - * scenario the RXON flags will be updated to indicate we are not - * communicating HT anymore, but the LQ command may still contain HT rates. - * Test for this to prevent driver from sending LQ command between the time - * RXON flags are updated and when LQ command is updated. - */ -static bool -il_is_lq_table_valid(struct il_priv *il, struct il_link_quality_cmd *lq) -{ - int i; - - if (il->ht.enabled) - return true; - - D_INFO("Channel %u is not an HT channel\n", il->active.channel); - for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { - if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & RATE_MCS_HT_MSK) { - D_INFO("idx %d of LQ expects HT channel\n", i); - return false; - } - } - return true; -} - -/** - * il_send_lq_cmd() - Send link quality command - * @init: This command is sent as part of station initialization right - * after station has been added. - * - * The link quality command is sent as the last step of station creation. - * This is the special case in which init is set and we call a callback in - * this case to clear the state indicating that station creation is in - * progress. - */ -int -il_send_lq_cmd(struct il_priv *il, struct il_link_quality_cmd *lq, - u8 flags, bool init) -{ - int ret = 0; - unsigned long flags_spin; - - struct il_host_cmd cmd = { - .id = C_TX_LINK_QUALITY_CMD, - .len = sizeof(struct il_link_quality_cmd), - .flags = flags, - .data = lq, - }; - - if (WARN_ON(lq->sta_id == IL_INVALID_STATION)) - return -EINVAL; - - spin_lock_irqsave(&il->sta_lock, flags_spin); - if (!(il->stations[lq->sta_id].used & IL_STA_DRIVER_ACTIVE)) { - spin_unlock_irqrestore(&il->sta_lock, flags_spin); - return -EINVAL; - } - spin_unlock_irqrestore(&il->sta_lock, flags_spin); - - il_dump_lq_cmd(il, lq); - BUG_ON(init && (cmd.flags & CMD_ASYNC)); - - if (il_is_lq_table_valid(il, lq)) - ret = il_send_cmd(il, &cmd); - else - ret = -EINVAL; - - if (cmd.flags & CMD_ASYNC) - return ret; - - if (init) { - D_INFO("init LQ command complete," - " clearing sta addition status for sta %d\n", - lq->sta_id); - spin_lock_irqsave(&il->sta_lock, flags_spin); - il->stations[lq->sta_id].used &= ~IL_STA_UCODE_INPROGRESS; - spin_unlock_irqrestore(&il->sta_lock, flags_spin); - } - return ret; -} -EXPORT_SYMBOL(il_send_lq_cmd); - -int -il_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct il_priv *il = hw->priv; - struct il_station_priv_common *sta_common = (void *)sta->drv_priv; - int ret; - - mutex_lock(&il->mutex); - D_MAC80211("enter station %pM\n", sta->addr); - - ret = il_remove_station(il, sta_common->sta_id, sta->addr); - if (ret) - IL_ERR("Error removing station %pM\n", sta->addr); - - D_MAC80211("leave ret %d\n", ret); - mutex_unlock(&il->mutex); - - return ret; -} -EXPORT_SYMBOL(il_mac_sta_remove); - -/************************** RX-FUNCTIONS ****************************/ -/* - * Rx theory of operation - * - * Driver allocates a circular buffer of Receive Buffer Descriptors (RBDs), - * each of which point to Receive Buffers to be filled by the NIC. These get - * used not only for Rx frames, but for any command response or notification - * from the NIC. The driver and NIC manage the Rx buffers by means - * of idxes into the circular buffer. - * - * Rx Queue Indexes - * The host/firmware share two idx registers for managing the Rx buffers. - * - * The READ idx maps to the first position that the firmware may be writing - * to -- the driver can read up to (but not including) this position and get - * good data. - * The READ idx is managed by the firmware once the card is enabled. - * - * The WRITE idx maps to the last position the driver has read from -- the - * position preceding WRITE is the last slot the firmware can place a packet. - * - * The queue is empty (no good data) if WRITE = READ - 1, and is full if - * WRITE = READ. - * - * During initialization, the host sets up the READ queue position to the first - * IDX position, and WRITE to the last (READ - 1 wrapped) - * - * When the firmware places a packet in a buffer, it will advance the READ idx - * and fire the RX interrupt. The driver can then query the READ idx and - * process as many packets as possible, moving the WRITE idx forward as it - * resets the Rx queue buffers with new memory. - * - * The management in the driver is as follows: - * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When - * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled - * to replenish the iwl->rxq->rx_free. - * + In il_rx_replenish (scheduled) if 'processed' != 'read' then the - * iwl->rxq is replenished and the READ IDX is updated (updating the - * 'processed' and 'read' driver idxes as well) - * + A received packet is processed and handed to the kernel network stack, - * detached from the iwl->rxq. The driver 'processed' idx is updated. - * + The Host/Firmware iwl->rxq is replenished at tasklet time from the rx_free - * list. If there are no allocated buffers in iwl->rxq->rx_free, the READ - * IDX is not incremented and iwl->status(RX_STALLED) is set. If there - * were enough free buffers and RX_STALLED is set it is cleared. - * - * - * Driver sequence: - * - * il_rx_queue_alloc() Allocates rx_free - * il_rx_replenish() Replenishes rx_free list from rx_used, and calls - * il_rx_queue_restock - * il_rx_queue_restock() Moves available buffers from rx_free into Rx - * queue, updates firmware pointers, and updates - * the WRITE idx. If insufficient rx_free buffers - * are available, schedules il_rx_replenish - * - * -- enable interrupts -- - * ISR - il_rx() Detach il_rx_bufs from pool up to the - * READ IDX, detaching the SKB from the pool. - * Moves the packet buffer from queue to rx_used. - * Calls il_rx_queue_restock to refill any empty - * slots. - * ... - * - */ - -/** - * il_rx_queue_space - Return number of free slots available in queue. - */ -int -il_rx_queue_space(const struct il_rx_queue *q) -{ - int s = q->read - q->write; - if (s <= 0) - s += RX_QUEUE_SIZE; - /* keep some buffer to not confuse full and empty queue */ - s -= 2; - if (s < 0) - s = 0; - return s; -} -EXPORT_SYMBOL(il_rx_queue_space); - -/** - * il_rx_queue_update_write_ptr - Update the write pointer for the RX queue - */ -void -il_rx_queue_update_write_ptr(struct il_priv *il, struct il_rx_queue *q) -{ - unsigned long flags; - u32 rx_wrt_ptr_reg = il->hw_params.rx_wrt_ptr_reg; - u32 reg; - - spin_lock_irqsave(&q->lock, flags); - - if (q->need_update == 0) - goto exit_unlock; - - /* If power-saving is in use, make sure device is awake */ - if (test_bit(S_POWER_PMI, &il->status)) { - reg = _il_rd(il, CSR_UCODE_DRV_GP1); - - if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { - D_INFO("Rx queue requesting wakeup," " GP1 = 0x%x\n", - reg); - il_set_bit(il, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - goto exit_unlock; - } - - q->write_actual = (q->write & ~0x7); - il_wr(il, rx_wrt_ptr_reg, q->write_actual); - - /* Else device is assumed to be awake */ - } else { - /* Device expects a multiple of 8 */ - q->write_actual = (q->write & ~0x7); - il_wr(il, rx_wrt_ptr_reg, q->write_actual); - } - - q->need_update = 0; - -exit_unlock: - spin_unlock_irqrestore(&q->lock, flags); -} -EXPORT_SYMBOL(il_rx_queue_update_write_ptr); - -int -il_rx_queue_alloc(struct il_priv *il) -{ - struct il_rx_queue *rxq = &il->rxq; - struct device *dev = &il->pci_dev->dev; - int i; - - spin_lock_init(&rxq->lock); - INIT_LIST_HEAD(&rxq->rx_free); - INIT_LIST_HEAD(&rxq->rx_used); - - /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */ - rxq->bd = dma_alloc_coherent(dev, 4 * RX_QUEUE_SIZE, &rxq->bd_dma, - GFP_KERNEL); - if (!rxq->bd) - goto err_bd; - - rxq->rb_stts = dma_alloc_coherent(dev, sizeof(struct il_rb_status), - &rxq->rb_stts_dma, GFP_KERNEL); - if (!rxq->rb_stts) - goto err_rb; - - /* Fill the rx_used queue with _all_ of the Rx buffers */ - for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) - list_add_tail(&rxq->pool[i].list, &rxq->rx_used); - - /* Set us so that we have processed and used all buffers, but have - * not restocked the Rx queue with fresh buffers */ - rxq->read = rxq->write = 0; - rxq->write_actual = 0; - rxq->free_count = 0; - rxq->need_update = 0; - return 0; - -err_rb: - dma_free_coherent(&il->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, - rxq->bd_dma); -err_bd: - return -ENOMEM; -} -EXPORT_SYMBOL(il_rx_queue_alloc); - -void -il_hdl_spectrum_measurement(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il_spectrum_notification *report = &(pkt->u.spectrum_notif); - - if (!report->state) { - D_11H("Spectrum Measure Notification: Start\n"); - return; - } - - memcpy(&il->measure_report, report, sizeof(*report)); - il->measurement_status |= MEASUREMENT_READY; -} -EXPORT_SYMBOL(il_hdl_spectrum_measurement); - -/* - * returns non-zero if packet should be dropped - */ -int -il_set_decrypted_flag(struct il_priv *il, struct ieee80211_hdr *hdr, - u32 decrypt_res, struct ieee80211_rx_status *stats) -{ - u16 fc = le16_to_cpu(hdr->frame_control); - - /* - * All contexts have the same setting here due to it being - * a module parameter, so OK to check any context. - */ - if (il->active.filter_flags & RXON_FILTER_DIS_DECRYPT_MSK) - return 0; - - if (!(fc & IEEE80211_FCTL_PROTECTED)) - return 0; - - D_RX("decrypt_res:0x%x\n", decrypt_res); - switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) { - case RX_RES_STATUS_SEC_TYPE_TKIP: - /* The uCode has got a bad phase 1 Key, pushes the packet. - * Decryption will be done in SW. */ - if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == - RX_RES_STATUS_BAD_KEY_TTAK) - break; - - case RX_RES_STATUS_SEC_TYPE_WEP: - if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == - RX_RES_STATUS_BAD_ICV_MIC) { - /* bad ICV, the packet is destroyed since the - * decryption is inplace, drop it */ - D_RX("Packet destroyed\n"); - return -1; - } - case RX_RES_STATUS_SEC_TYPE_CCMP: - if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == - RX_RES_STATUS_DECRYPT_OK) { - D_RX("hw decrypt successfully!!!\n"); - stats->flag |= RX_FLAG_DECRYPTED; - } - break; - - default: - break; - } - return 0; -} -EXPORT_SYMBOL(il_set_decrypted_flag); - -/** - * il_txq_update_write_ptr - Send new write idx to hardware - */ -void -il_txq_update_write_ptr(struct il_priv *il, struct il_tx_queue *txq) -{ - u32 reg = 0; - int txq_id = txq->q.id; - - if (txq->need_update == 0) - return; - - /* if we're trying to save power */ - if (test_bit(S_POWER_PMI, &il->status)) { - /* wake up nic if it's powered down ... - * uCode will wake up, and interrupt us again, so next - * time we'll skip this part. */ - reg = _il_rd(il, CSR_UCODE_DRV_GP1); - - if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { - D_INFO("Tx queue %d requesting wakeup," " GP1 = 0x%x\n", - txq_id, reg); - il_set_bit(il, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - return; - } - - il_wr(il, HBUS_TARG_WRPTR, txq->q.write_ptr | (txq_id << 8)); - - /* - * else not in power-save mode, - * uCode will never sleep when we're - * trying to tx (during RFKILL, we're not trying to tx). - */ - } else - _il_wr(il, HBUS_TARG_WRPTR, txq->q.write_ptr | (txq_id << 8)); - txq->need_update = 0; -} -EXPORT_SYMBOL(il_txq_update_write_ptr); - -/** - * il_tx_queue_unmap - Unmap any remaining DMA mappings and free skb's - */ -void -il_tx_queue_unmap(struct il_priv *il, int txq_id) -{ - struct il_tx_queue *txq = &il->txq[txq_id]; - struct il_queue *q = &txq->q; - - if (q->n_bd == 0) - return; - - while (q->write_ptr != q->read_ptr) { - il->ops->txq_free_tfd(il, txq); - q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd); - } -} -EXPORT_SYMBOL(il_tx_queue_unmap); - -/** - * il_tx_queue_free - Deallocate DMA queue. - * @txq: Transmit queue to deallocate. - * - * Empty queue by removing and destroying all BD's. - * Free all buffers. - * 0-fill, but do not free "txq" descriptor structure. - */ -void -il_tx_queue_free(struct il_priv *il, int txq_id) -{ - struct il_tx_queue *txq = &il->txq[txq_id]; - struct device *dev = &il->pci_dev->dev; - int i; - - il_tx_queue_unmap(il, txq_id); - - /* De-alloc array of command/tx buffers */ - for (i = 0; i < TFD_TX_CMD_SLOTS; i++) - kfree(txq->cmd[i]); - - /* De-alloc circular buffer of TFDs */ - if (txq->q.n_bd) - dma_free_coherent(dev, il->hw_params.tfd_size * txq->q.n_bd, - txq->tfds, txq->q.dma_addr); - - /* De-alloc array of per-TFD driver data */ - kfree(txq->skbs); - txq->skbs = NULL; - - /* deallocate arrays */ - kfree(txq->cmd); - kfree(txq->meta); - txq->cmd = NULL; - txq->meta = NULL; - - /* 0-fill queue descriptor structure */ - memset(txq, 0, sizeof(*txq)); -} -EXPORT_SYMBOL(il_tx_queue_free); - -/** - * il_cmd_queue_unmap - Unmap any remaining DMA mappings from command queue - */ -void -il_cmd_queue_unmap(struct il_priv *il) -{ - struct il_tx_queue *txq = &il->txq[il->cmd_queue]; - struct il_queue *q = &txq->q; - int i; - - if (q->n_bd == 0) - return; - - while (q->read_ptr != q->write_ptr) { - i = il_get_cmd_idx(q, q->read_ptr, 0); - - if (txq->meta[i].flags & CMD_MAPPED) { - pci_unmap_single(il->pci_dev, - dma_unmap_addr(&txq->meta[i], mapping), - dma_unmap_len(&txq->meta[i], len), - PCI_DMA_BIDIRECTIONAL); - txq->meta[i].flags = 0; - } - - q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd); - } - - i = q->n_win; - if (txq->meta[i].flags & CMD_MAPPED) { - pci_unmap_single(il->pci_dev, - dma_unmap_addr(&txq->meta[i], mapping), - dma_unmap_len(&txq->meta[i], len), - PCI_DMA_BIDIRECTIONAL); - txq->meta[i].flags = 0; - } -} -EXPORT_SYMBOL(il_cmd_queue_unmap); - -/** - * il_cmd_queue_free - Deallocate DMA queue. - * @txq: Transmit queue to deallocate. - * - * Empty queue by removing and destroying all BD's. - * Free all buffers. - * 0-fill, but do not free "txq" descriptor structure. - */ -void -il_cmd_queue_free(struct il_priv *il) -{ - struct il_tx_queue *txq = &il->txq[il->cmd_queue]; - struct device *dev = &il->pci_dev->dev; - int i; - - il_cmd_queue_unmap(il); - - /* De-alloc array of command/tx buffers */ - for (i = 0; i <= TFD_CMD_SLOTS; i++) - kfree(txq->cmd[i]); - - /* De-alloc circular buffer of TFDs */ - if (txq->q.n_bd) - dma_free_coherent(dev, il->hw_params.tfd_size * txq->q.n_bd, - txq->tfds, txq->q.dma_addr); - - /* deallocate arrays */ - kfree(txq->cmd); - kfree(txq->meta); - txq->cmd = NULL; - txq->meta = NULL; - - /* 0-fill queue descriptor structure */ - memset(txq, 0, sizeof(*txq)); -} -EXPORT_SYMBOL(il_cmd_queue_free); - -/*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** - * DMA services - * - * Theory of operation - * - * A Tx or Rx queue resides in host DRAM, and is comprised of a circular buffer - * of buffer descriptors, each of which points to one or more data buffers for - * the device to read from or fill. Driver and device exchange status of each - * queue via "read" and "write" pointers. Driver keeps minimum of 2 empty - * entries in each circular buffer, to protect against confusing empty and full - * queue states. - * - * The device reads or writes the data in the queues via the device's several - * DMA/FIFO channels. Each queue is mapped to a single DMA channel. - * - * For Tx queue, there are low mark and high mark limits. If, after queuing - * the packet for Tx, free space become < low mark, Tx queue stopped. When - * reclaiming packets (on 'tx done IRQ), if free space become > high mark, - * Tx queue resumed. - * - * See more detailed info in 4965.h. - ***************************************************/ - -int -il_queue_space(const struct il_queue *q) -{ - int s = q->read_ptr - q->write_ptr; - - if (q->read_ptr > q->write_ptr) - s -= q->n_bd; - - if (s <= 0) - s += q->n_win; - /* keep some reserve to not confuse empty and full situations */ - s -= 2; - if (s < 0) - s = 0; - return s; -} -EXPORT_SYMBOL(il_queue_space); - - -/** - * il_queue_init - Initialize queue's high/low-water and read/write idxes - */ -static int -il_queue_init(struct il_priv *il, struct il_queue *q, int slots, u32 id) -{ - /* - * TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise - * il_queue_inc_wrap and il_queue_dec_wrap are broken. - */ - BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); - /* FIXME: remove q->n_bd */ - q->n_bd = TFD_QUEUE_SIZE_MAX; - - q->n_win = slots; - q->id = id; - - /* slots_must be power-of-two size, otherwise - * il_get_cmd_idx is broken. */ - BUG_ON(!is_power_of_2(slots)); - - q->low_mark = q->n_win / 4; - if (q->low_mark < 4) - q->low_mark = 4; - - q->high_mark = q->n_win / 8; - if (q->high_mark < 2) - q->high_mark = 2; - - q->write_ptr = q->read_ptr = 0; - - return 0; -} - -/** - * il_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue - */ -static int -il_tx_queue_alloc(struct il_priv *il, struct il_tx_queue *txq, u32 id) -{ - struct device *dev = &il->pci_dev->dev; - size_t tfd_sz = il->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX; - - /* Driver ilate data, only for Tx (not command) queues, - * not shared with device. */ - if (id != il->cmd_queue) { - txq->skbs = kcalloc(TFD_QUEUE_SIZE_MAX, sizeof(struct skb *), - GFP_KERNEL); - if (!txq->skbs) { - IL_ERR("Fail to alloc skbs\n"); - goto error; - } - } else - txq->skbs = NULL; - - /* Circular buffer of transmit frame descriptors (TFDs), - * shared with device */ - txq->tfds = - dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr, GFP_KERNEL); - if (!txq->tfds) - goto error; - - txq->q.id = id; - - return 0; - -error: - kfree(txq->skbs); - txq->skbs = NULL; - - return -ENOMEM; -} - -/** - * il_tx_queue_init - Allocate and initialize one tx/cmd queue - */ -int -il_tx_queue_init(struct il_priv *il, u32 txq_id) -{ - int i, len, ret; - int slots, actual_slots; - struct il_tx_queue *txq = &il->txq[txq_id]; - - /* - * Alloc buffer array for commands (Tx or other types of commands). - * For the command queue (#4/#9), allocate command space + one big - * command for scan, since scan command is very huge; the system will - * not have two scans at the same time, so only one is needed. - * For normal Tx queues (all other queues), no super-size command - * space is needed. - */ - if (txq_id == il->cmd_queue) { - slots = TFD_CMD_SLOTS; - actual_slots = slots + 1; - } else { - slots = TFD_TX_CMD_SLOTS; - actual_slots = slots; - } - - txq->meta = - kzalloc(sizeof(struct il_cmd_meta) * actual_slots, GFP_KERNEL); - txq->cmd = - kzalloc(sizeof(struct il_device_cmd *) * actual_slots, GFP_KERNEL); - - if (!txq->meta || !txq->cmd) - goto out_free_arrays; - - len = sizeof(struct il_device_cmd); - for (i = 0; i < actual_slots; i++) { - /* only happens for cmd queue */ - if (i == slots) - len = IL_MAX_CMD_SIZE; - - txq->cmd[i] = kmalloc(len, GFP_KERNEL); - if (!txq->cmd[i]) - goto err; - } - - /* Alloc driver data array and TFD circular buffer */ - ret = il_tx_queue_alloc(il, txq, txq_id); - if (ret) - goto err; - - txq->need_update = 0; - - /* - * For the default queues 0-3, set up the swq_id - * already -- all others need to get one later - * (if they need one at all). - */ - if (txq_id < 4) - il_set_swq_id(txq, txq_id, txq_id); - - /* Initialize queue's high/low-water marks, and head/tail idxes */ - il_queue_init(il, &txq->q, slots, txq_id); - - /* Tell device where to find queue */ - il->ops->txq_init(il, txq); - - return 0; -err: - for (i = 0; i < actual_slots; i++) - kfree(txq->cmd[i]); -out_free_arrays: - kfree(txq->meta); - kfree(txq->cmd); - - return -ENOMEM; -} -EXPORT_SYMBOL(il_tx_queue_init); - -void -il_tx_queue_reset(struct il_priv *il, u32 txq_id) -{ - int slots, actual_slots; - struct il_tx_queue *txq = &il->txq[txq_id]; - - if (txq_id == il->cmd_queue) { - slots = TFD_CMD_SLOTS; - actual_slots = TFD_CMD_SLOTS + 1; - } else { - slots = TFD_TX_CMD_SLOTS; - actual_slots = TFD_TX_CMD_SLOTS; - } - - memset(txq->meta, 0, sizeof(struct il_cmd_meta) * actual_slots); - txq->need_update = 0; - - /* Initialize queue's high/low-water marks, and head/tail idxes */ - il_queue_init(il, &txq->q, slots, txq_id); - - /* Tell device where to find queue */ - il->ops->txq_init(il, txq); -} -EXPORT_SYMBOL(il_tx_queue_reset); - -/*************** HOST COMMAND QUEUE FUNCTIONS *****/ - -/** - * il_enqueue_hcmd - enqueue a uCode command - * @il: device ilate data point - * @cmd: a point to the ucode command structure - * - * The function returns < 0 values to indicate the operation is - * failed. On success, it turns the idx (> 0) of command in the - * command queue. - */ -int -il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd) -{ - struct il_tx_queue *txq = &il->txq[il->cmd_queue]; - struct il_queue *q = &txq->q; - struct il_device_cmd *out_cmd; - struct il_cmd_meta *out_meta; - dma_addr_t phys_addr; - unsigned long flags; - int len; - u32 idx; - u16 fix_size; - - cmd->len = il->ops->get_hcmd_size(cmd->id, cmd->len); - fix_size = (u16) (cmd->len + sizeof(out_cmd->hdr)); - - /* If any of the command structures end up being larger than - * the TFD_MAX_PAYLOAD_SIZE, and it sent as a 'small' command then - * we will need to increase the size of the TFD entries - * Also, check to see if command buffer should not exceed the size - * of device_cmd and max_cmd_size. */ - BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) && - !(cmd->flags & CMD_SIZE_HUGE)); - BUG_ON(fix_size > IL_MAX_CMD_SIZE); - - if (il_is_rfkill(il) || il_is_ctkill(il)) { - IL_WARN("Not sending command - %s KILL\n", - il_is_rfkill(il) ? "RF" : "CT"); - return -EIO; - } - - spin_lock_irqsave(&il->hcmd_lock, flags); - - if (il_queue_space(q) < ((cmd->flags & CMD_ASYNC) ? 2 : 1)) { - spin_unlock_irqrestore(&il->hcmd_lock, flags); - - IL_ERR("Restarting adapter due to command queue full\n"); - queue_work(il->workqueue, &il->restart); - return -ENOSPC; - } - - idx = il_get_cmd_idx(q, q->write_ptr, cmd->flags & CMD_SIZE_HUGE); - out_cmd = txq->cmd[idx]; - out_meta = &txq->meta[idx]; - - if (WARN_ON(out_meta->flags & CMD_MAPPED)) { - spin_unlock_irqrestore(&il->hcmd_lock, flags); - return -ENOSPC; - } - - memset(out_meta, 0, sizeof(*out_meta)); /* re-initialize to NULL */ - out_meta->flags = cmd->flags | CMD_MAPPED; - if (cmd->flags & CMD_WANT_SKB) - out_meta->source = cmd; - if (cmd->flags & CMD_ASYNC) - out_meta->callback = cmd->callback; - - out_cmd->hdr.cmd = cmd->id; - memcpy(&out_cmd->cmd.payload, cmd->data, cmd->len); - - /* At this point, the out_cmd now has all of the incoming cmd - * information */ - - out_cmd->hdr.flags = 0; - out_cmd->hdr.sequence = - cpu_to_le16(QUEUE_TO_SEQ(il->cmd_queue) | IDX_TO_SEQ(q->write_ptr)); - if (cmd->flags & CMD_SIZE_HUGE) - out_cmd->hdr.sequence |= SEQ_HUGE_FRAME; - len = sizeof(struct il_device_cmd); - if (idx == TFD_CMD_SLOTS) - len = IL_MAX_CMD_SIZE; - -#ifdef CONFIG_IWLEGACY_DEBUG - switch (out_cmd->hdr.cmd) { - case C_TX_LINK_QUALITY_CMD: - case C_SENSITIVITY: - D_HC_DUMP("Sending command %s (#%x), seq: 0x%04X, " - "%d bytes at %d[%d]:%d\n", - il_get_cmd_string(out_cmd->hdr.cmd), out_cmd->hdr.cmd, - le16_to_cpu(out_cmd->hdr.sequence), fix_size, - q->write_ptr, idx, il->cmd_queue); - break; - default: - D_HC("Sending command %s (#%x), seq: 0x%04X, " - "%d bytes at %d[%d]:%d\n", - il_get_cmd_string(out_cmd->hdr.cmd), out_cmd->hdr.cmd, - le16_to_cpu(out_cmd->hdr.sequence), fix_size, q->write_ptr, - idx, il->cmd_queue); - } -#endif - - phys_addr = - pci_map_single(il->pci_dev, &out_cmd->hdr, fix_size, - PCI_DMA_BIDIRECTIONAL); - if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr))) { - idx = -ENOMEM; - goto out; - } - dma_unmap_addr_set(out_meta, mapping, phys_addr); - dma_unmap_len_set(out_meta, len, fix_size); - - txq->need_update = 1; - - if (il->ops->txq_update_byte_cnt_tbl) - /* Set up entry in queue's byte count circular buffer */ - il->ops->txq_update_byte_cnt_tbl(il, txq, 0); - - il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, fix_size, 1, - U32_PAD(cmd->len)); - - /* Increment and update queue's write idx */ - q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); - il_txq_update_write_ptr(il, txq); - -out: - spin_unlock_irqrestore(&il->hcmd_lock, flags); - return idx; -} - -/** - * il_hcmd_queue_reclaim - Reclaim TX command queue entries already Tx'd - * - * When FW advances 'R' idx, all entries between old and new 'R' idx - * need to be reclaimed. As result, some free space forms. If there is - * enough free space (> low mark), wake the stack that feeds us. - */ -static void -il_hcmd_queue_reclaim(struct il_priv *il, int txq_id, int idx, int cmd_idx) -{ - struct il_tx_queue *txq = &il->txq[txq_id]; - struct il_queue *q = &txq->q; - int nfreed = 0; - - if (idx >= q->n_bd || il_queue_used(q, idx) == 0) { - IL_ERR("Read idx for DMA queue txq id (%d), idx %d, " - "is out of range [0-%d] %d %d.\n", txq_id, idx, q->n_bd, - q->write_ptr, q->read_ptr); - return; - } - - for (idx = il_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; - q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) { - - if (nfreed++ > 0) { - IL_ERR("HCMD skipped: idx (%d) %d %d\n", idx, - q->write_ptr, q->read_ptr); - queue_work(il->workqueue, &il->restart); - } - - } -} - -/** - * il_tx_cmd_complete - Pull unused buffers off the queue and reclaim them - * @rxb: Rx buffer to reclaim - * - * If an Rx buffer has an async callback associated with it the callback - * will be executed. The attached skb (if present) will only be freed - * if the callback returns 1 - */ -void -il_tx_cmd_complete(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - u16 sequence = le16_to_cpu(pkt->hdr.sequence); - int txq_id = SEQ_TO_QUEUE(sequence); - int idx = SEQ_TO_IDX(sequence); - int cmd_idx; - bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME); - struct il_device_cmd *cmd; - struct il_cmd_meta *meta; - struct il_tx_queue *txq = &il->txq[il->cmd_queue]; - unsigned long flags; - - /* If a Tx command is being handled and it isn't in the actual - * command queue then there a command routing bug has been introduced - * in the queue management code. */ - if (WARN - (txq_id != il->cmd_queue, - "wrong command queue %d (should be %d), sequence 0x%X readp=%d writep=%d\n", - txq_id, il->cmd_queue, sequence, il->txq[il->cmd_queue].q.read_ptr, - il->txq[il->cmd_queue].q.write_ptr)) { - il_print_hex_error(il, pkt, 32); - return; - } - - cmd_idx = il_get_cmd_idx(&txq->q, idx, huge); - cmd = txq->cmd[cmd_idx]; - meta = &txq->meta[cmd_idx]; - - txq->time_stamp = jiffies; - - pci_unmap_single(il->pci_dev, dma_unmap_addr(meta, mapping), - dma_unmap_len(meta, len), PCI_DMA_BIDIRECTIONAL); - - /* Input error checking is done when commands are added to queue. */ - if (meta->flags & CMD_WANT_SKB) { - meta->source->reply_page = (unsigned long)rxb_addr(rxb); - rxb->page = NULL; - } else if (meta->callback) - meta->callback(il, cmd, pkt); - - spin_lock_irqsave(&il->hcmd_lock, flags); - - il_hcmd_queue_reclaim(il, txq_id, idx, cmd_idx); - - if (!(meta->flags & CMD_ASYNC)) { - clear_bit(S_HCMD_ACTIVE, &il->status); - D_INFO("Clearing HCMD_ACTIVE for command %s\n", - il_get_cmd_string(cmd->hdr.cmd)); - wake_up(&il->wait_command_queue); - } - - /* Mark as unmapped */ - meta->flags = 0; - - spin_unlock_irqrestore(&il->hcmd_lock, flags); -} -EXPORT_SYMBOL(il_tx_cmd_complete); - -MODULE_DESCRIPTION("iwl-legacy: common functions for 3945 and 4965"); -MODULE_VERSION(IWLWIFI_VERSION); -MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); -MODULE_LICENSE("GPL"); - -/* - * set bt_coex_active to true, uCode will do kill/defer - * every time the priority line is asserted (BT is sending signals on the - * priority line in the PCIx). - * set bt_coex_active to false, uCode will ignore the BT activity and - * perform the normal operation - * - * User might experience transmit issue on some platform due to WiFi/BT - * co-exist problem. The possible behaviors are: - * Able to scan and finding all the available AP - * Not able to associate with any AP - * On those platforms, WiFi communication can be restored by set - * "bt_coex_active" module parameter to "false" - * - * default: bt_coex_active = true (BT_COEX_ENABLE) - */ -static bool bt_coex_active = true; -module_param(bt_coex_active, bool, S_IRUGO); -MODULE_PARM_DESC(bt_coex_active, "enable wifi/bluetooth co-exist"); - -u32 il_debug_level; -EXPORT_SYMBOL(il_debug_level); - -const u8 il_bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; -EXPORT_SYMBOL(il_bcast_addr); - -#define MAX_BIT_RATE_40_MHZ 150 /* Mbps */ -#define MAX_BIT_RATE_20_MHZ 72 /* Mbps */ -static void -il_init_ht_hw_capab(const struct il_priv *il, - struct ieee80211_sta_ht_cap *ht_info, - enum ieee80211_band band) -{ - u16 max_bit_rate = 0; - u8 rx_chains_num = il->hw_params.rx_chains_num; - u8 tx_chains_num = il->hw_params.tx_chains_num; - - ht_info->cap = 0; - memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); - - ht_info->ht_supported = true; - - ht_info->cap |= IEEE80211_HT_CAP_SGI_20; - max_bit_rate = MAX_BIT_RATE_20_MHZ; - if (il->hw_params.ht40_channel & BIT(band)) { - ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; - ht_info->cap |= IEEE80211_HT_CAP_SGI_40; - ht_info->mcs.rx_mask[4] = 0x01; - max_bit_rate = MAX_BIT_RATE_40_MHZ; - } - - if (il->cfg->mod_params->amsdu_size_8K) - ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU; - - ht_info->ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF; - ht_info->ampdu_density = CFG_HT_MPDU_DENSITY_DEF; - - ht_info->mcs.rx_mask[0] = 0xFF; - if (rx_chains_num >= 2) - ht_info->mcs.rx_mask[1] = 0xFF; - if (rx_chains_num >= 3) - ht_info->mcs.rx_mask[2] = 0xFF; - - /* Highest supported Rx data rate */ - max_bit_rate *= rx_chains_num; - WARN_ON(max_bit_rate & ~IEEE80211_HT_MCS_RX_HIGHEST_MASK); - ht_info->mcs.rx_highest = cpu_to_le16(max_bit_rate); - - /* Tx MCS capabilities */ - ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; - if (tx_chains_num != rx_chains_num) { - ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF; - ht_info->mcs.tx_params |= - ((tx_chains_num - - 1) << IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT); - } -} - -/** - * il_init_geos - Initialize mac80211's geo/channel info based from eeprom - */ -int -il_init_geos(struct il_priv *il) -{ - struct il_channel_info *ch; - struct ieee80211_supported_band *sband; - struct ieee80211_channel *channels; - struct ieee80211_channel *geo_ch; - struct ieee80211_rate *rates; - int i = 0; - s8 max_tx_power = 0; - - if (il->bands[IEEE80211_BAND_2GHZ].n_bitrates || - il->bands[IEEE80211_BAND_5GHZ].n_bitrates) { - D_INFO("Geography modes already initialized.\n"); - set_bit(S_GEO_CONFIGURED, &il->status); - return 0; - } - - channels = - kzalloc(sizeof(struct ieee80211_channel) * il->channel_count, - GFP_KERNEL); - if (!channels) - return -ENOMEM; - - rates = - kzalloc((sizeof(struct ieee80211_rate) * RATE_COUNT_LEGACY), - GFP_KERNEL); - if (!rates) { - kfree(channels); - return -ENOMEM; - } - - /* 5.2GHz channels start after the 2.4GHz channels */ - sband = &il->bands[IEEE80211_BAND_5GHZ]; - sband->channels = &channels[ARRAY_SIZE(il_eeprom_band_1)]; - /* just OFDM */ - sband->bitrates = &rates[IL_FIRST_OFDM_RATE]; - sband->n_bitrates = RATE_COUNT_LEGACY - IL_FIRST_OFDM_RATE; - - if (il->cfg->sku & IL_SKU_N) - il_init_ht_hw_capab(il, &sband->ht_cap, IEEE80211_BAND_5GHZ); - - sband = &il->bands[IEEE80211_BAND_2GHZ]; - sband->channels = channels; - /* OFDM & CCK */ - sband->bitrates = rates; - sband->n_bitrates = RATE_COUNT_LEGACY; - - if (il->cfg->sku & IL_SKU_N) - il_init_ht_hw_capab(il, &sband->ht_cap, IEEE80211_BAND_2GHZ); - - il->ieee_channels = channels; - il->ieee_rates = rates; - - for (i = 0; i < il->channel_count; i++) { - ch = &il->channel_info[i]; - - if (!il_is_channel_valid(ch)) - continue; - - sband = &il->bands[ch->band]; - - geo_ch = &sband->channels[sband->n_channels++]; - - geo_ch->center_freq = - ieee80211_channel_to_frequency(ch->channel, ch->band); - geo_ch->max_power = ch->max_power_avg; - geo_ch->max_antenna_gain = 0xff; - geo_ch->hw_value = ch->channel; - - if (il_is_channel_valid(ch)) { - if (!(ch->flags & EEPROM_CHANNEL_IBSS)) - geo_ch->flags |= IEEE80211_CHAN_NO_IBSS; - - if (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) - geo_ch->flags |= IEEE80211_CHAN_PASSIVE_SCAN; - - if (ch->flags & EEPROM_CHANNEL_RADAR) - geo_ch->flags |= IEEE80211_CHAN_RADAR; - - geo_ch->flags |= ch->ht40_extension_channel; - - if (ch->max_power_avg > max_tx_power) - max_tx_power = ch->max_power_avg; - } else { - geo_ch->flags |= IEEE80211_CHAN_DISABLED; - } - - D_INFO("Channel %d Freq=%d[%sGHz] %s flag=0x%X\n", ch->channel, - geo_ch->center_freq, - il_is_channel_a_band(ch) ? "5.2" : "2.4", - geo_ch-> - flags & IEEE80211_CHAN_DISABLED ? "restricted" : "valid", - geo_ch->flags); - } - - il->tx_power_device_lmt = max_tx_power; - il->tx_power_user_lmt = max_tx_power; - il->tx_power_next = max_tx_power; - - if (il->bands[IEEE80211_BAND_5GHZ].n_channels == 0 && - (il->cfg->sku & IL_SKU_A)) { - IL_INFO("Incorrectly detected BG card as ABG. " - "Please send your PCI ID 0x%04X:0x%04X to maintainer.\n", - il->pci_dev->device, il->pci_dev->subsystem_device); - il->cfg->sku &= ~IL_SKU_A; - } - - IL_INFO("Tunable channels: %d 802.11bg, %d 802.11a channels\n", - il->bands[IEEE80211_BAND_2GHZ].n_channels, - il->bands[IEEE80211_BAND_5GHZ].n_channels); - - set_bit(S_GEO_CONFIGURED, &il->status); - - return 0; -} -EXPORT_SYMBOL(il_init_geos); - -/* - * il_free_geos - undo allocations in il_init_geos - */ -void -il_free_geos(struct il_priv *il) -{ - kfree(il->ieee_channels); - kfree(il->ieee_rates); - clear_bit(S_GEO_CONFIGURED, &il->status); -} -EXPORT_SYMBOL(il_free_geos); - -static bool -il_is_channel_extension(struct il_priv *il, enum ieee80211_band band, - u16 channel, u8 extension_chan_offset) -{ - const struct il_channel_info *ch_info; - - ch_info = il_get_channel_info(il, band, channel); - if (!il_is_channel_valid(ch_info)) - return false; - - if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE) - return !(ch_info-> - ht40_extension_channel & IEEE80211_CHAN_NO_HT40PLUS); - else if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_BELOW) - return !(ch_info-> - ht40_extension_channel & IEEE80211_CHAN_NO_HT40MINUS); - - return false; -} - -bool -il_is_ht40_tx_allowed(struct il_priv *il, struct ieee80211_sta_ht_cap *ht_cap) -{ - if (!il->ht.enabled || !il->ht.is_40mhz) - return false; - - /* - * We do not check for IEEE80211_HT_CAP_SUP_WIDTH_20_40 - * the bit will not set if it is pure 40MHz case - */ - if (ht_cap && !ht_cap->ht_supported) - return false; - -#ifdef CONFIG_IWLEGACY_DEBUGFS - if (il->disable_ht40) - return false; -#endif - - return il_is_channel_extension(il, il->band, - le16_to_cpu(il->staging.channel), - il->ht.extension_chan_offset); -} -EXPORT_SYMBOL(il_is_ht40_tx_allowed); - -static u16 -il_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) -{ - u16 new_val; - u16 beacon_factor; - - /* - * If mac80211 hasn't given us a beacon interval, program - * the default into the device. - */ - if (!beacon_val) - return DEFAULT_BEACON_INTERVAL; - - /* - * If the beacon interval we obtained from the peer - * is too large, we'll have to wake up more often - * (and in IBSS case, we'll beacon too much) - * - * For example, if max_beacon_val is 4096, and the - * requested beacon interval is 7000, we'll have to - * use 3500 to be able to wake up on the beacons. - * - * This could badly influence beacon detection stats. - */ - - beacon_factor = (beacon_val + max_beacon_val) / max_beacon_val; - new_val = beacon_val / beacon_factor; - - if (!new_val) - new_val = max_beacon_val; - - return new_val; -} - -int -il_send_rxon_timing(struct il_priv *il) -{ - u64 tsf; - s32 interval_tm, rem; - struct ieee80211_conf *conf = NULL; - u16 beacon_int; - struct ieee80211_vif *vif = il->vif; - - conf = &il->hw->conf; - - lockdep_assert_held(&il->mutex); - - memset(&il->timing, 0, sizeof(struct il_rxon_time_cmd)); - - il->timing.timestamp = cpu_to_le64(il->timestamp); - il->timing.listen_interval = cpu_to_le16(conf->listen_interval); - - beacon_int = vif ? vif->bss_conf.beacon_int : 0; - - /* - * TODO: For IBSS we need to get atim_win from mac80211, - * for now just always use 0 - */ - il->timing.atim_win = 0; - - beacon_int = - il_adjust_beacon_interval(beacon_int, - il->hw_params.max_beacon_itrvl * - TIME_UNIT); - il->timing.beacon_interval = cpu_to_le16(beacon_int); - - tsf = il->timestamp; /* tsf is modifed by do_div: copy it */ - interval_tm = beacon_int * TIME_UNIT; - rem = do_div(tsf, interval_tm); - il->timing.beacon_init_val = cpu_to_le32(interval_tm - rem); - - il->timing.dtim_period = vif ? (vif->bss_conf.dtim_period ? : 1) : 1; - - D_ASSOC("beacon interval %d beacon timer %d beacon tim %d\n", - le16_to_cpu(il->timing.beacon_interval), - le32_to_cpu(il->timing.beacon_init_val), - le16_to_cpu(il->timing.atim_win)); - - return il_send_cmd_pdu(il, C_RXON_TIMING, sizeof(il->timing), - &il->timing); -} -EXPORT_SYMBOL(il_send_rxon_timing); - -void -il_set_rxon_hwcrypto(struct il_priv *il, int hw_decrypt) -{ - struct il_rxon_cmd *rxon = &il->staging; - - if (hw_decrypt) - rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; - else - rxon->filter_flags |= RXON_FILTER_DIS_DECRYPT_MSK; - -} -EXPORT_SYMBOL(il_set_rxon_hwcrypto); - -/* validate RXON structure is valid */ -int -il_check_rxon_cmd(struct il_priv *il) -{ - struct il_rxon_cmd *rxon = &il->staging; - bool error = false; - - if (rxon->flags & RXON_FLG_BAND_24G_MSK) { - if (rxon->flags & RXON_FLG_TGJ_NARROW_BAND_MSK) { - IL_WARN("check 2.4G: wrong narrow\n"); - error = true; - } - if (rxon->flags & RXON_FLG_RADAR_DETECT_MSK) { - IL_WARN("check 2.4G: wrong radar\n"); - error = true; - } - } else { - if (!(rxon->flags & RXON_FLG_SHORT_SLOT_MSK)) { - IL_WARN("check 5.2G: not short slot!\n"); - error = true; - } - if (rxon->flags & RXON_FLG_CCK_MSK) { - IL_WARN("check 5.2G: CCK!\n"); - error = true; - } - } - if ((rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1) { - IL_WARN("mac/bssid mcast!\n"); - error = true; - } - - /* make sure basic rates 6Mbps and 1Mbps are supported */ - if ((rxon->ofdm_basic_rates & RATE_6M_MASK) == 0 && - (rxon->cck_basic_rates & RATE_1M_MASK) == 0) { - IL_WARN("neither 1 nor 6 are basic\n"); - error = true; - } - - if (le16_to_cpu(rxon->assoc_id) > 2007) { - IL_WARN("aid > 2007\n"); - error = true; - } - - if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) == - (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) { - IL_WARN("CCK and short slot\n"); - error = true; - } - - if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) == - (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) { - IL_WARN("CCK and auto detect"); - error = true; - } - - if ((rxon-> - flags & (RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK)) == - RXON_FLG_TGG_PROTECT_MSK) { - IL_WARN("TGg but no auto-detect\n"); - error = true; - } - - if (error) - IL_WARN("Tuning to channel %d\n", le16_to_cpu(rxon->channel)); - - if (error) { - IL_ERR("Invalid RXON\n"); - return -EINVAL; - } - return 0; -} -EXPORT_SYMBOL(il_check_rxon_cmd); - -/** - * il_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed - * @il: staging_rxon is compared to active_rxon - * - * If the RXON structure is changing enough to require a new tune, - * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that - * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. - */ -int -il_full_rxon_required(struct il_priv *il) -{ - const struct il_rxon_cmd *staging = &il->staging; - const struct il_rxon_cmd *active = &il->active; - -#define CHK(cond) \ - if ((cond)) { \ - D_INFO("need full RXON - " #cond "\n"); \ - return 1; \ - } - -#define CHK_NEQ(c1, c2) \ - if ((c1) != (c2)) { \ - D_INFO("need full RXON - " \ - #c1 " != " #c2 " - %d != %d\n", \ - (c1), (c2)); \ - return 1; \ - } - - /* These items are only settable from the full RXON command */ - CHK(!il_is_associated(il)); - CHK(!ether_addr_equal(staging->bssid_addr, active->bssid_addr)); - CHK(!ether_addr_equal(staging->node_addr, active->node_addr)); - CHK(!ether_addr_equal(staging->wlap_bssid_addr, - active->wlap_bssid_addr)); - CHK_NEQ(staging->dev_type, active->dev_type); - CHK_NEQ(staging->channel, active->channel); - CHK_NEQ(staging->air_propagation, active->air_propagation); - CHK_NEQ(staging->ofdm_ht_single_stream_basic_rates, - active->ofdm_ht_single_stream_basic_rates); - CHK_NEQ(staging->ofdm_ht_dual_stream_basic_rates, - active->ofdm_ht_dual_stream_basic_rates); - CHK_NEQ(staging->assoc_id, active->assoc_id); - - /* flags, filter_flags, ofdm_basic_rates, and cck_basic_rates can - * be updated with the RXON_ASSOC command -- however only some - * flag transitions are allowed using RXON_ASSOC */ - - /* Check if we are not switching bands */ - CHK_NEQ(staging->flags & RXON_FLG_BAND_24G_MSK, - active->flags & RXON_FLG_BAND_24G_MSK); - - /* Check if we are switching association toggle */ - CHK_NEQ(staging->filter_flags & RXON_FILTER_ASSOC_MSK, - active->filter_flags & RXON_FILTER_ASSOC_MSK); - -#undef CHK -#undef CHK_NEQ - - return 0; -} -EXPORT_SYMBOL(il_full_rxon_required); - -u8 -il_get_lowest_plcp(struct il_priv *il) -{ - /* - * Assign the lowest rate -- should really get this from - * the beacon skb from mac80211. - */ - if (il->staging.flags & RXON_FLG_BAND_24G_MSK) - return RATE_1M_PLCP; - else - return RATE_6M_PLCP; -} -EXPORT_SYMBOL(il_get_lowest_plcp); - -static void -_il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf) -{ - struct il_rxon_cmd *rxon = &il->staging; - - if (!il->ht.enabled) { - rxon->flags &= - ~(RXON_FLG_CHANNEL_MODE_MSK | - RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK | RXON_FLG_HT40_PROT_MSK - | RXON_FLG_HT_PROT_MSK); - return; - } - - rxon->flags |= - cpu_to_le32(il->ht.protection << RXON_FLG_HT_OPERATING_MODE_POS); - - /* Set up channel bandwidth: - * 20 MHz only, 20/40 mixed or pure 40 if ht40 ok */ - /* clear the HT channel mode before set the mode */ - rxon->flags &= - ~(RXON_FLG_CHANNEL_MODE_MSK | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); - if (il_is_ht40_tx_allowed(il, NULL)) { - /* pure ht40 */ - if (il->ht.protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) { - rxon->flags |= RXON_FLG_CHANNEL_MODE_PURE_40; - /* Note: control channel is opposite of extension channel */ - switch (il->ht.extension_chan_offset) { - case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: - rxon->flags &= - ~RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK; - break; - case IEEE80211_HT_PARAM_CHA_SEC_BELOW: - rxon->flags |= RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK; - break; - } - } else { - /* Note: control channel is opposite of extension channel */ - switch (il->ht.extension_chan_offset) { - case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: - rxon->flags &= - ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); - rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED; - break; - case IEEE80211_HT_PARAM_CHA_SEC_BELOW: - rxon->flags |= RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK; - rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED; - break; - case IEEE80211_HT_PARAM_CHA_SEC_NONE: - default: - /* channel location only valid if in Mixed mode */ - IL_ERR("invalid extension channel offset\n"); - break; - } - } - } else { - rxon->flags |= RXON_FLG_CHANNEL_MODE_LEGACY; - } - - if (il->ops->set_rxon_chain) - il->ops->set_rxon_chain(il); - - D_ASSOC("rxon flags 0x%X operation mode :0x%X " - "extension channel offset 0x%x\n", le32_to_cpu(rxon->flags), - il->ht.protection, il->ht.extension_chan_offset); -} - -void -il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf) -{ - _il_set_rxon_ht(il, ht_conf); -} -EXPORT_SYMBOL(il_set_rxon_ht); - -/* Return valid, unused, channel for a passive scan to reset the RF */ -u8 -il_get_single_channel_number(struct il_priv *il, enum ieee80211_band band) -{ - const struct il_channel_info *ch_info; - int i; - u8 channel = 0; - u8 min, max; - - if (band == IEEE80211_BAND_5GHZ) { - min = 14; - max = il->channel_count; - } else { - min = 0; - max = 14; - } - - for (i = min; i < max; i++) { - channel = il->channel_info[i].channel; - if (channel == le16_to_cpu(il->staging.channel)) - continue; - - ch_info = il_get_channel_info(il, band, channel); - if (il_is_channel_valid(ch_info)) - break; - } - - return channel; -} -EXPORT_SYMBOL(il_get_single_channel_number); - -/** - * il_set_rxon_channel - Set the band and channel values in staging RXON - * @ch: requested channel as a pointer to struct ieee80211_channel - - * NOTE: Does not commit to the hardware; it sets appropriate bit fields - * in the staging RXON flag structure based on the ch->band - */ -int -il_set_rxon_channel(struct il_priv *il, struct ieee80211_channel *ch) -{ - enum ieee80211_band band = ch->band; - u16 channel = ch->hw_value; - - if (le16_to_cpu(il->staging.channel) == channel && il->band == band) - return 0; - - il->staging.channel = cpu_to_le16(channel); - if (band == IEEE80211_BAND_5GHZ) - il->staging.flags &= ~RXON_FLG_BAND_24G_MSK; - else - il->staging.flags |= RXON_FLG_BAND_24G_MSK; - - il->band = band; - - D_INFO("Staging channel set to %d [%d]\n", channel, band); - - return 0; -} -EXPORT_SYMBOL(il_set_rxon_channel); - -void -il_set_flags_for_band(struct il_priv *il, enum ieee80211_band band, - struct ieee80211_vif *vif) -{ - if (band == IEEE80211_BAND_5GHZ) { - il->staging.flags &= - ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK | - RXON_FLG_CCK_MSK); - il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; - } else { - /* Copied from il_post_associate() */ - if (vif && vif->bss_conf.use_short_slot) - il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; - else - il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; - - il->staging.flags |= RXON_FLG_BAND_24G_MSK; - il->staging.flags |= RXON_FLG_AUTO_DETECT_MSK; - il->staging.flags &= ~RXON_FLG_CCK_MSK; - } -} -EXPORT_SYMBOL(il_set_flags_for_band); - -/* - * initialize rxon structure with default values from eeprom - */ -void -il_connection_init_rx_config(struct il_priv *il) -{ - const struct il_channel_info *ch_info; - - memset(&il->staging, 0, sizeof(il->staging)); - - switch (il->iw_mode) { - case NL80211_IFTYPE_UNSPECIFIED: - il->staging.dev_type = RXON_DEV_TYPE_ESS; - break; - case NL80211_IFTYPE_STATION: - il->staging.dev_type = RXON_DEV_TYPE_ESS; - il->staging.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; - break; - case NL80211_IFTYPE_ADHOC: - il->staging.dev_type = RXON_DEV_TYPE_IBSS; - il->staging.flags = RXON_FLG_SHORT_PREAMBLE_MSK; - il->staging.filter_flags = - RXON_FILTER_BCON_AWARE_MSK | RXON_FILTER_ACCEPT_GRP_MSK; - break; - default: - IL_ERR("Unsupported interface type %d\n", il->vif->type); - return; - } - -#if 0 - /* TODO: Figure out when short_preamble would be set and cache from - * that */ - if (!hw_to_local(il->hw)->short_preamble) - il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; - else - il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; -#endif - - ch_info = - il_get_channel_info(il, il->band, le16_to_cpu(il->active.channel)); - - if (!ch_info) - ch_info = &il->channel_info[0]; - - il->staging.channel = cpu_to_le16(ch_info->channel); - il->band = ch_info->band; - - il_set_flags_for_band(il, il->band, il->vif); - - il->staging.ofdm_basic_rates = - (IL_OFDM_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF; - il->staging.cck_basic_rates = - (IL_CCK_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF; - - /* clear both MIX and PURE40 mode flag */ - il->staging.flags &= - ~(RXON_FLG_CHANNEL_MODE_MIXED | RXON_FLG_CHANNEL_MODE_PURE_40); - if (il->vif) - memcpy(il->staging.node_addr, il->vif->addr, ETH_ALEN); - - il->staging.ofdm_ht_single_stream_basic_rates = 0xff; - il->staging.ofdm_ht_dual_stream_basic_rates = 0xff; -} -EXPORT_SYMBOL(il_connection_init_rx_config); - -void -il_set_rate(struct il_priv *il) -{ - const struct ieee80211_supported_band *hw = NULL; - struct ieee80211_rate *rate; - int i; - - hw = il_get_hw_mode(il, il->band); - if (!hw) { - IL_ERR("Failed to set rate: unable to get hw mode\n"); - return; - } - - il->active_rate = 0; - - for (i = 0; i < hw->n_bitrates; i++) { - rate = &(hw->bitrates[i]); - if (rate->hw_value < RATE_COUNT_LEGACY) - il->active_rate |= (1 << rate->hw_value); - } - - D_RATE("Set active_rate = %0x\n", il->active_rate); - - il->staging.cck_basic_rates = - (IL_CCK_BASIC_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF; - - il->staging.ofdm_basic_rates = - (IL_OFDM_BASIC_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF; -} -EXPORT_SYMBOL(il_set_rate); - -void -il_chswitch_done(struct il_priv *il, bool is_success) -{ - if (test_bit(S_EXIT_PENDING, &il->status)) - return; - - if (test_and_clear_bit(S_CHANNEL_SWITCH_PENDING, &il->status)) - ieee80211_chswitch_done(il->vif, is_success); -} -EXPORT_SYMBOL(il_chswitch_done); - -void -il_hdl_csa(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il_csa_notification *csa = &(pkt->u.csa_notif); - struct il_rxon_cmd *rxon = (void *)&il->active; - - if (!test_bit(S_CHANNEL_SWITCH_PENDING, &il->status)) - return; - - if (!le32_to_cpu(csa->status) && csa->channel == il->switch_channel) { - rxon->channel = csa->channel; - il->staging.channel = csa->channel; - D_11H("CSA notif: channel %d\n", le16_to_cpu(csa->channel)); - il_chswitch_done(il, true); - } else { - IL_ERR("CSA notif (fail) : channel %d\n", - le16_to_cpu(csa->channel)); - il_chswitch_done(il, false); - } -} -EXPORT_SYMBOL(il_hdl_csa); - -#ifdef CONFIG_IWLEGACY_DEBUG -void -il_print_rx_config_cmd(struct il_priv *il) -{ - struct il_rxon_cmd *rxon = &il->staging; - - D_RADIO("RX CONFIG:\n"); - il_print_hex_dump(il, IL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); - D_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); - D_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); - D_RADIO("u32 filter_flags: 0x%08x\n", le32_to_cpu(rxon->filter_flags)); - D_RADIO("u8 dev_type: 0x%x\n", rxon->dev_type); - D_RADIO("u8 ofdm_basic_rates: 0x%02x\n", rxon->ofdm_basic_rates); - D_RADIO("u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates); - D_RADIO("u8[6] node_addr: %pM\n", rxon->node_addr); - D_RADIO("u8[6] bssid_addr: %pM\n", rxon->bssid_addr); - D_RADIO("u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id)); -} -EXPORT_SYMBOL(il_print_rx_config_cmd); -#endif -/** - * il_irq_handle_error - called for HW or SW error interrupt from card - */ -void -il_irq_handle_error(struct il_priv *il) -{ - /* Set the FW error flag -- cleared on il_down */ - set_bit(S_FW_ERROR, &il->status); - - /* Cancel currently queued command. */ - clear_bit(S_HCMD_ACTIVE, &il->status); - - IL_ERR("Loaded firmware version: %s\n", il->hw->wiphy->fw_version); - - il->ops->dump_nic_error_log(il); - if (il->ops->dump_fh) - il->ops->dump_fh(il, NULL, false); -#ifdef CONFIG_IWLEGACY_DEBUG - if (il_get_debug_level(il) & IL_DL_FW_ERRORS) - il_print_rx_config_cmd(il); -#endif - - wake_up(&il->wait_command_queue); - - /* Keep the restart process from trying to send host - * commands by clearing the INIT status bit */ - clear_bit(S_READY, &il->status); - - if (!test_bit(S_EXIT_PENDING, &il->status)) { - IL_DBG(IL_DL_FW_ERRORS, - "Restarting adapter due to uCode error.\n"); - - if (il->cfg->mod_params->restart_fw) - queue_work(il->workqueue, &il->restart); - } -} -EXPORT_SYMBOL(il_irq_handle_error); - -static int -_il_apm_stop_master(struct il_priv *il) -{ - int ret = 0; - - /* stop device's busmaster DMA activity */ - _il_set_bit(il, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); - - ret = - _il_poll_bit(il, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED, - CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); - if (ret < 0) - IL_WARN("Master Disable Timed Out, 100 usec\n"); - - D_INFO("stop master\n"); - - return ret; -} - -void -_il_apm_stop(struct il_priv *il) -{ - lockdep_assert_held(&il->reg_lock); - - D_INFO("Stop card, put in low power state\n"); - - /* Stop device's DMA activity */ - _il_apm_stop_master(il); - - /* Reset the entire device */ - _il_set_bit(il, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); - - udelay(10); - - /* - * Clear "initialization complete" bit to move adapter from - * D0A* (powered-up Active) --> D0U* (Uninitialized) state. - */ - _il_clear_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); -} -EXPORT_SYMBOL(_il_apm_stop); - -void -il_apm_stop(struct il_priv *il) -{ - unsigned long flags; - - spin_lock_irqsave(&il->reg_lock, flags); - _il_apm_stop(il); - spin_unlock_irqrestore(&il->reg_lock, flags); -} -EXPORT_SYMBOL(il_apm_stop); - -/* - * Start up NIC's basic functionality after it has been reset - * (e.g. after platform boot, or shutdown via il_apm_stop()) - * NOTE: This does not load uCode nor start the embedded processor - */ -int -il_apm_init(struct il_priv *il) -{ - int ret = 0; - u16 lctl; - - D_INFO("Init card's basic functions\n"); - - /* - * Use "set_bit" below rather than "write", to preserve any hardware - * bits already set by default after reset. - */ - - /* Disable L0S exit timer (platform NMI Work/Around) */ - il_set_bit(il, CSR_GIO_CHICKEN_BITS, - CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); - - /* - * Disable L0s without affecting L1; - * don't wait for ICH L0s (ICH bug W/A) - */ - il_set_bit(il, CSR_GIO_CHICKEN_BITS, - CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); - - /* Set FH wait threshold to maximum (HW error during stress W/A) */ - il_set_bit(il, CSR_DBG_HPET_MEM_REG, CSR_DBG_HPET_MEM_REG_VAL); - - /* - * Enable HAP INTA (interrupt from management bus) to - * wake device's PCI Express link L1a -> L0s - * NOTE: This is no-op for 3945 (non-existent bit) - */ - il_set_bit(il, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); - - /* - * HW bug W/A for instability in PCIe bus L0->L0S->L1 transition. - * Check if BIOS (or OS) enabled L1-ASPM on this device. - * If so (likely), disable L0S, so device moves directly L0->L1; - * costs negligible amount of power savings. - * If not (unlikely), enable L0S, so there is at least some - * power savings, even without L1. - */ - if (il->cfg->set_l0s) { - pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl); - if (lctl & PCI_EXP_LNKCTL_ASPM_L1) { - /* L1-ASPM enabled; disable(!) L0S */ - il_set_bit(il, CSR_GIO_REG, - CSR_GIO_REG_VAL_L0S_ENABLED); - D_POWER("L1 Enabled; Disabling L0S\n"); - } else { - /* L1-ASPM disabled; enable(!) L0S */ - il_clear_bit(il, CSR_GIO_REG, - CSR_GIO_REG_VAL_L0S_ENABLED); - D_POWER("L1 Disabled; Enabling L0S\n"); - } - } - - /* Configure analog phase-lock-loop before activating to D0A */ - if (il->cfg->pll_cfg_val) - il_set_bit(il, CSR_ANA_PLL_CFG, - il->cfg->pll_cfg_val); - - /* - * Set "initialization complete" bit to move adapter from - * D0U* --> D0A* (powered-up active) state. - */ - il_set_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); - - /* - * Wait for clock stabilization; once stabilized, access to - * device-internal resources is supported, e.g. il_wr_prph() - * and accesses to uCode SRAM. - */ - ret = - _il_poll_bit(il, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, - CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); - if (ret < 0) { - D_INFO("Failed to init the card\n"); - goto out; - } - - /* - * Enable DMA and BSM (if used) clocks, wait for them to stabilize. - * BSM (Boostrap State Machine) is only in 3945 and 4965. - * - * Write to "CLK_EN_REG"; "1" bits enable clocks, while "0" bits - * do not disable clocks. This preserves any hardware bits already - * set by default in "CLK_CTRL_REG" after reset. - */ - if (il->cfg->use_bsm) - il_wr_prph(il, APMG_CLK_EN_REG, - APMG_CLK_VAL_DMA_CLK_RQT | APMG_CLK_VAL_BSM_CLK_RQT); - else - il_wr_prph(il, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT); - udelay(20); - - /* Disable L1-Active */ - il_set_bits_prph(il, APMG_PCIDEV_STT_REG, - APMG_PCIDEV_STT_VAL_L1_ACT_DIS); - -out: - return ret; -} -EXPORT_SYMBOL(il_apm_init); - -int -il_set_tx_power(struct il_priv *il, s8 tx_power, bool force) -{ - int ret; - s8 prev_tx_power; - bool defer; - - lockdep_assert_held(&il->mutex); - - if (il->tx_power_user_lmt == tx_power && !force) - return 0; - - if (!il->ops->send_tx_power) - return -EOPNOTSUPP; - - /* 0 dBm mean 1 milliwatt */ - if (tx_power < 0) { - IL_WARN("Requested user TXPOWER %d below 1 mW.\n", tx_power); - return -EINVAL; - } - - if (tx_power > il->tx_power_device_lmt) { - IL_WARN("Requested user TXPOWER %d above upper limit %d.\n", - tx_power, il->tx_power_device_lmt); - return -EINVAL; - } - - if (!il_is_ready_rf(il)) - return -EIO; - - /* scan complete and commit_rxon use tx_power_next value, - * it always need to be updated for newest request */ - il->tx_power_next = tx_power; - - /* do not set tx power when scanning or channel changing */ - defer = test_bit(S_SCANNING, &il->status) || - memcmp(&il->active, &il->staging, sizeof(il->staging)); - if (defer && !force) { - D_INFO("Deferring tx power set\n"); - return 0; - } - - prev_tx_power = il->tx_power_user_lmt; - il->tx_power_user_lmt = tx_power; - - ret = il->ops->send_tx_power(il); - - /* if fail to set tx_power, restore the orig. tx power */ - if (ret) { - il->tx_power_user_lmt = prev_tx_power; - il->tx_power_next = prev_tx_power; - } - return ret; -} -EXPORT_SYMBOL(il_set_tx_power); - -void -il_send_bt_config(struct il_priv *il) -{ - struct il_bt_cmd bt_cmd = { - .lead_time = BT_LEAD_TIME_DEF, - .max_kill = BT_MAX_KILL_DEF, - .kill_ack_mask = 0, - .kill_cts_mask = 0, - }; - - if (!bt_coex_active) - bt_cmd.flags = BT_COEX_DISABLE; - else - bt_cmd.flags = BT_COEX_ENABLE; - - D_INFO("BT coex %s\n", - (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active"); - - if (il_send_cmd_pdu(il, C_BT_CONFIG, sizeof(struct il_bt_cmd), &bt_cmd)) - IL_ERR("failed to send BT Coex Config\n"); -} -EXPORT_SYMBOL(il_send_bt_config); - -int -il_send_stats_request(struct il_priv *il, u8 flags, bool clear) -{ - struct il_stats_cmd stats_cmd = { - .configuration_flags = clear ? IL_STATS_CONF_CLEAR_STATS : 0, - }; - - if (flags & CMD_ASYNC) - return il_send_cmd_pdu_async(il, C_STATS, sizeof(struct il_stats_cmd), - &stats_cmd, NULL); - else - return il_send_cmd_pdu(il, C_STATS, sizeof(struct il_stats_cmd), - &stats_cmd); -} -EXPORT_SYMBOL(il_send_stats_request); - -void -il_hdl_pm_sleep(struct il_priv *il, struct il_rx_buf *rxb) -{ -#ifdef CONFIG_IWLEGACY_DEBUG - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il_sleep_notification *sleep = &(pkt->u.sleep_notif); - D_RX("sleep mode: %d, src: %d\n", - sleep->pm_sleep_mode, sleep->pm_wakeup_src); -#endif -} -EXPORT_SYMBOL(il_hdl_pm_sleep); - -void -il_hdl_pm_debug_stats(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - u32 len = le32_to_cpu(pkt->len_n_flags) & IL_RX_FRAME_SIZE_MSK; - D_RADIO("Dumping %d bytes of unhandled notification for %s:\n", len, - il_get_cmd_string(pkt->hdr.cmd)); - il_print_hex_dump(il, IL_DL_RADIO, pkt->u.raw, len); -} -EXPORT_SYMBOL(il_hdl_pm_debug_stats); - -void -il_hdl_error(struct il_priv *il, struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - - IL_ERR("Error Reply type 0x%08X cmd %s (0x%02X) " - "seq 0x%04X ser 0x%08X\n", - le32_to_cpu(pkt->u.err_resp.error_type), - il_get_cmd_string(pkt->u.err_resp.cmd_id), - pkt->u.err_resp.cmd_id, - le16_to_cpu(pkt->u.err_resp.bad_cmd_seq_num), - le32_to_cpu(pkt->u.err_resp.error_info)); -} -EXPORT_SYMBOL(il_hdl_error); - -void -il_clear_isr_stats(struct il_priv *il) -{ - memset(&il->isr_stats, 0, sizeof(il->isr_stats)); -} - -int -il_mac_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - struct il_priv *il = hw->priv; - unsigned long flags; - int q; - - D_MAC80211("enter\n"); - - if (!il_is_ready_rf(il)) { - D_MAC80211("leave - RF not ready\n"); - return -EIO; - } - - if (queue >= AC_NUM) { - D_MAC80211("leave - queue >= AC_NUM %d\n", queue); - return 0; - } - - q = AC_NUM - 1 - queue; - - spin_lock_irqsave(&il->lock, flags); - - il->qos_data.def_qos_parm.ac[q].cw_min = - cpu_to_le16(params->cw_min); - il->qos_data.def_qos_parm.ac[q].cw_max = - cpu_to_le16(params->cw_max); - il->qos_data.def_qos_parm.ac[q].aifsn = params->aifs; - il->qos_data.def_qos_parm.ac[q].edca_txop = - cpu_to_le16((params->txop * 32)); - - il->qos_data.def_qos_parm.ac[q].reserved1 = 0; - - spin_unlock_irqrestore(&il->lock, flags); - - D_MAC80211("leave\n"); - return 0; -} -EXPORT_SYMBOL(il_mac_conf_tx); - -int -il_mac_tx_last_beacon(struct ieee80211_hw *hw) -{ - struct il_priv *il = hw->priv; - int ret; - - D_MAC80211("enter\n"); - - ret = (il->ibss_manager == IL_IBSS_MANAGER); - - D_MAC80211("leave ret %d\n", ret); - return ret; -} -EXPORT_SYMBOL_GPL(il_mac_tx_last_beacon); - -static int -il_set_mode(struct il_priv *il) -{ - il_connection_init_rx_config(il); - - if (il->ops->set_rxon_chain) - il->ops->set_rxon_chain(il); - - return il_commit_rxon(il); -} - -int -il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct il_priv *il = hw->priv; - int err; - bool reset; - - mutex_lock(&il->mutex); - D_MAC80211("enter: type %d, addr %pM\n", vif->type, vif->addr); - - if (!il_is_ready_rf(il)) { - IL_WARN("Try to add interface when device not ready\n"); - err = -EINVAL; - goto out; - } - - /* - * We do not support multiple virtual interfaces, but on hardware reset - * we have to add the same interface again. - */ - reset = (il->vif == vif); - if (il->vif && !reset) { - err = -EOPNOTSUPP; - goto out; - } - - il->vif = vif; - il->iw_mode = vif->type; - - err = il_set_mode(il); - if (err) { - IL_WARN("Fail to set mode %d\n", vif->type); - if (!reset) { - il->vif = NULL; - il->iw_mode = NL80211_IFTYPE_STATION; - } - } - -out: - D_MAC80211("leave err %d\n", err); - mutex_unlock(&il->mutex); - - return err; -} -EXPORT_SYMBOL(il_mac_add_interface); - -static void -il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif) -{ - lockdep_assert_held(&il->mutex); - - if (il->scan_vif == vif) { - il_scan_cancel_timeout(il, 200); - il_force_scan_end(il); - } - - il_set_mode(il); -} - -void -il_mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct il_priv *il = hw->priv; - - mutex_lock(&il->mutex); - D_MAC80211("enter: type %d, addr %pM\n", vif->type, vif->addr); - - WARN_ON(il->vif != vif); - il->vif = NULL; - il->iw_mode = NL80211_IFTYPE_UNSPECIFIED; - il_teardown_interface(il, vif); - memset(il->bssid, 0, ETH_ALEN); - - D_MAC80211("leave\n"); - mutex_unlock(&il->mutex); -} -EXPORT_SYMBOL(il_mac_remove_interface); - -int -il_alloc_txq_mem(struct il_priv *il) -{ - if (!il->txq) - il->txq = - kzalloc(sizeof(struct il_tx_queue) * - il->cfg->num_of_queues, GFP_KERNEL); - if (!il->txq) { - IL_ERR("Not enough memory for txq\n"); - return -ENOMEM; - } - return 0; -} -EXPORT_SYMBOL(il_alloc_txq_mem); - -void -il_free_txq_mem(struct il_priv *il) -{ - kfree(il->txq); - il->txq = NULL; -} -EXPORT_SYMBOL(il_free_txq_mem); - -int -il_force_reset(struct il_priv *il, bool external) -{ - struct il_force_reset *force_reset; - - if (test_bit(S_EXIT_PENDING, &il->status)) - return -EINVAL; - - force_reset = &il->force_reset; - force_reset->reset_request_count++; - if (!external) { - if (force_reset->last_force_reset_jiffies && - time_after(force_reset->last_force_reset_jiffies + - force_reset->reset_duration, jiffies)) { - D_INFO("force reset rejected\n"); - force_reset->reset_reject_count++; - return -EAGAIN; - } - } - force_reset->reset_success_count++; - force_reset->last_force_reset_jiffies = jiffies; - - /* - * if the request is from external(ex: debugfs), - * then always perform the request in regardless the module - * parameter setting - * if the request is from internal (uCode error or driver - * detect failure), then fw_restart module parameter - * need to be check before performing firmware reload - */ - - if (!external && !il->cfg->mod_params->restart_fw) { - D_INFO("Cancel firmware reload based on " - "module parameter setting\n"); - return 0; - } - - IL_ERR("On demand firmware reload\n"); - - /* Set the FW error flag -- cleared on il_down */ - set_bit(S_FW_ERROR, &il->status); - wake_up(&il->wait_command_queue); - /* - * Keep the restart process from trying to send host - * commands by clearing the INIT status bit - */ - clear_bit(S_READY, &il->status); - queue_work(il->workqueue, &il->restart); - - return 0; -} -EXPORT_SYMBOL(il_force_reset); - -int -il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - enum nl80211_iftype newtype, bool newp2p) -{ - struct il_priv *il = hw->priv; - int err; - - mutex_lock(&il->mutex); - D_MAC80211("enter: type %d, addr %pM newtype %d newp2p %d\n", - vif->type, vif->addr, newtype, newp2p); - - if (newp2p) { - err = -EOPNOTSUPP; - goto out; - } - - if (!il->vif || !il_is_ready_rf(il)) { - /* - * Huh? But wait ... this can maybe happen when - * we're in the middle of a firmware restart! - */ - err = -EBUSY; - goto out; - } - - /* success */ - vif->type = newtype; - vif->p2p = false; - il->iw_mode = newtype; - il_teardown_interface(il, vif); - err = 0; - -out: - D_MAC80211("leave err %d\n", err); - mutex_unlock(&il->mutex); - - return err; -} -EXPORT_SYMBOL(il_mac_change_interface); - -void il_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop) -{ - struct il_priv *il = hw->priv; - unsigned long timeout = jiffies + msecs_to_jiffies(500); - int i; - - mutex_lock(&il->mutex); - D_MAC80211("enter\n"); - - if (il->txq == NULL) - goto out; - - for (i = 0; i < il->hw_params.max_txq_num; i++) { - struct il_queue *q; - - if (i == il->cmd_queue) - continue; - - q = &il->txq[i].q; - if (q->read_ptr == q->write_ptr) - continue; - - if (time_after(jiffies, timeout)) { - IL_ERR("Failed to flush queue %d\n", q->id); - break; - } - - msleep(20); - } -out: - D_MAC80211("leave\n"); - mutex_unlock(&il->mutex); -} -EXPORT_SYMBOL(il_mac_flush); - -/* - * On every watchdog tick we check (latest) time stamp. If it does not - * change during timeout period and queue is not empty we reset firmware. - */ -static int -il_check_stuck_queue(struct il_priv *il, int cnt) -{ - struct il_tx_queue *txq = &il->txq[cnt]; - struct il_queue *q = &txq->q; - unsigned long timeout; - unsigned long now = jiffies; - int ret; - - if (q->read_ptr == q->write_ptr) { - txq->time_stamp = now; - return 0; - } - - timeout = - txq->time_stamp + - msecs_to_jiffies(il->cfg->wd_timeout); - - if (time_after(now, timeout)) { - IL_ERR("Queue %d stuck for %u ms.\n", q->id, - jiffies_to_msecs(now - txq->time_stamp)); - ret = il_force_reset(il, false); - return (ret == -EAGAIN) ? 0 : 1; - } - - return 0; -} - -/* - * Making watchdog tick be a quarter of timeout assure we will - * discover the queue hung between timeout and 1.25*timeout - */ -#define IL_WD_TICK(timeout) ((timeout) / 4) - -/* - * Watchdog timer callback, we check each tx queue for stuck, if if hung - * we reset the firmware. If everything is fine just rearm the timer. - */ -void -il_bg_watchdog(unsigned long data) -{ - struct il_priv *il = (struct il_priv *)data; - int cnt; - unsigned long timeout; - - if (test_bit(S_EXIT_PENDING, &il->status)) - return; - - timeout = il->cfg->wd_timeout; - if (timeout == 0) - return; - - /* monitor and check for stuck cmd queue */ - if (il_check_stuck_queue(il, il->cmd_queue)) - return; - - /* monitor and check for other stuck queues */ - for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) { - /* skip as we already checked the command queue */ - if (cnt == il->cmd_queue) - continue; - if (il_check_stuck_queue(il, cnt)) - return; - } - - mod_timer(&il->watchdog, - jiffies + msecs_to_jiffies(IL_WD_TICK(timeout))); -} -EXPORT_SYMBOL(il_bg_watchdog); - -void -il_setup_watchdog(struct il_priv *il) -{ - unsigned int timeout = il->cfg->wd_timeout; - - if (timeout) - mod_timer(&il->watchdog, - jiffies + msecs_to_jiffies(IL_WD_TICK(timeout))); - else - del_timer(&il->watchdog); -} -EXPORT_SYMBOL(il_setup_watchdog); - -/* - * extended beacon time format - * time in usec will be changed into a 32-bit value in extended:internal format - * the extended part is the beacon counts - * the internal part is the time in usec within one beacon interval - */ -u32 -il_usecs_to_beacons(struct il_priv *il, u32 usec, u32 beacon_interval) -{ - u32 quot; - u32 rem; - u32 interval = beacon_interval * TIME_UNIT; - - if (!interval || !usec) - return 0; - - quot = - (usec / - interval) & (il_beacon_time_mask_high(il, - il->hw_params. - beacon_time_tsf_bits) >> il-> - hw_params.beacon_time_tsf_bits); - rem = - (usec % interval) & il_beacon_time_mask_low(il, - il->hw_params. - beacon_time_tsf_bits); - - return (quot << il->hw_params.beacon_time_tsf_bits) + rem; -} -EXPORT_SYMBOL(il_usecs_to_beacons); - -/* base is usually what we get from ucode with each received frame, - * the same as HW timer counter counting down - */ -__le32 -il_add_beacon_time(struct il_priv *il, u32 base, u32 addon, - u32 beacon_interval) -{ - u32 base_low = base & il_beacon_time_mask_low(il, - il->hw_params. - beacon_time_tsf_bits); - u32 addon_low = addon & il_beacon_time_mask_low(il, - il->hw_params. - beacon_time_tsf_bits); - u32 interval = beacon_interval * TIME_UNIT; - u32 res = (base & il_beacon_time_mask_high(il, - il->hw_params. - beacon_time_tsf_bits)) + - (addon & il_beacon_time_mask_high(il, - il->hw_params. - beacon_time_tsf_bits)); - - if (base_low > addon_low) - res += base_low - addon_low; - else if (base_low < addon_low) { - res += interval + base_low - addon_low; - res += (1 << il->hw_params.beacon_time_tsf_bits); - } else - res += (1 << il->hw_params.beacon_time_tsf_bits); - - return cpu_to_le32(res); -} -EXPORT_SYMBOL(il_add_beacon_time); - -#ifdef CONFIG_PM_SLEEP - -static int -il_pci_suspend(struct device *device) -{ - struct pci_dev *pdev = to_pci_dev(device); - struct il_priv *il = pci_get_drvdata(pdev); - - /* - * This function is called when system goes into suspend state - * mac80211 will call il_mac_stop() from the mac80211 suspend function - * first but since il_mac_stop() has no knowledge of who the caller is, - * it will not call apm_ops.stop() to stop the DMA operation. - * Calling apm_ops.stop here to make sure we stop the DMA. - */ - il_apm_stop(il); - - return 0; -} - -static int -il_pci_resume(struct device *device) -{ - struct pci_dev *pdev = to_pci_dev(device); - struct il_priv *il = pci_get_drvdata(pdev); - bool hw_rfkill = false; - - /* - * We disable the RETRY_TIMEOUT register (0x41) to keep - * PCI Tx retries from interfering with C3 CPU state. - */ - pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); - - il_enable_interrupts(il); - - if (!(_il_rd(il, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)) - hw_rfkill = true; - - if (hw_rfkill) - set_bit(S_RFKILL, &il->status); - else - clear_bit(S_RFKILL, &il->status); - - wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rfkill); - - return 0; -} - -SIMPLE_DEV_PM_OPS(il_pm_ops, il_pci_suspend, il_pci_resume); -EXPORT_SYMBOL(il_pm_ops); - -#endif /* CONFIG_PM_SLEEP */ - -static void -il_update_qos(struct il_priv *il) -{ - if (test_bit(S_EXIT_PENDING, &il->status)) - return; - - il->qos_data.def_qos_parm.qos_flags = 0; - - if (il->qos_data.qos_active) - il->qos_data.def_qos_parm.qos_flags |= - QOS_PARAM_FLG_UPDATE_EDCA_MSK; - - if (il->ht.enabled) - il->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK; - - D_QOS("send QoS cmd with Qos active=%d FLAGS=0x%X\n", - il->qos_data.qos_active, il->qos_data.def_qos_parm.qos_flags); - - il_send_cmd_pdu_async(il, C_QOS_PARAM, sizeof(struct il_qosparam_cmd), - &il->qos_data.def_qos_parm, NULL); -} - -/** - * il_mac_config - mac80211 config callback - */ -int -il_mac_config(struct ieee80211_hw *hw, u32 changed) -{ - struct il_priv *il = hw->priv; - const struct il_channel_info *ch_info; - struct ieee80211_conf *conf = &hw->conf; - struct ieee80211_channel *channel = conf->chandef.chan; - struct il_ht_config *ht_conf = &il->current_ht_config; - unsigned long flags = 0; - int ret = 0; - u16 ch; - int scan_active = 0; - bool ht_changed = false; - - mutex_lock(&il->mutex); - D_MAC80211("enter: channel %d changed 0x%X\n", channel->hw_value, - changed); - - if (unlikely(test_bit(S_SCANNING, &il->status))) { - scan_active = 1; - D_MAC80211("scan active\n"); - } - - if (changed & - (IEEE80211_CONF_CHANGE_SMPS | IEEE80211_CONF_CHANGE_CHANNEL)) { - /* mac80211 uses static for non-HT which is what we want */ - il->current_ht_config.smps = conf->smps_mode; - - /* - * Recalculate chain counts. - * - * If monitor mode is enabled then mac80211 will - * set up the SM PS mode to OFF if an HT channel is - * configured. - */ - if (il->ops->set_rxon_chain) - il->ops->set_rxon_chain(il); - } - - /* during scanning mac80211 will delay channel setting until - * scan finish with changed = 0 - */ - if (!changed || (changed & IEEE80211_CONF_CHANGE_CHANNEL)) { - - if (scan_active) - goto set_ch_out; - - ch = channel->hw_value; - ch_info = il_get_channel_info(il, channel->band, ch); - if (!il_is_channel_valid(ch_info)) { - D_MAC80211("leave - invalid channel\n"); - ret = -EINVAL; - goto set_ch_out; - } - - if (il->iw_mode == NL80211_IFTYPE_ADHOC && - !il_is_channel_ibss(ch_info)) { - D_MAC80211("leave - not IBSS channel\n"); - ret = -EINVAL; - goto set_ch_out; - } - - spin_lock_irqsave(&il->lock, flags); - - /* Configure HT40 channels */ - if (il->ht.enabled != conf_is_ht(conf)) { - il->ht.enabled = conf_is_ht(conf); - ht_changed = true; - } - if (il->ht.enabled) { - if (conf_is_ht40_minus(conf)) { - il->ht.extension_chan_offset = - IEEE80211_HT_PARAM_CHA_SEC_BELOW; - il->ht.is_40mhz = true; - } else if (conf_is_ht40_plus(conf)) { - il->ht.extension_chan_offset = - IEEE80211_HT_PARAM_CHA_SEC_ABOVE; - il->ht.is_40mhz = true; - } else { - il->ht.extension_chan_offset = - IEEE80211_HT_PARAM_CHA_SEC_NONE; - il->ht.is_40mhz = false; - } - } else - il->ht.is_40mhz = false; - - /* - * Default to no protection. Protection mode will - * later be set from BSS config in il_ht_conf - */ - il->ht.protection = IEEE80211_HT_OP_MODE_PROTECTION_NONE; - - /* if we are switching from ht to 2.4 clear flags - * from any ht related info since 2.4 does not - * support ht */ - if ((le16_to_cpu(il->staging.channel) != ch)) - il->staging.flags = 0; - - il_set_rxon_channel(il, channel); - il_set_rxon_ht(il, ht_conf); - - il_set_flags_for_band(il, channel->band, il->vif); - - spin_unlock_irqrestore(&il->lock, flags); - - if (il->ops->update_bcast_stations) - ret = il->ops->update_bcast_stations(il); - -set_ch_out: - /* The list of supported rates and rate mask can be different - * for each band; since the band may have changed, reset - * the rate mask to what mac80211 lists */ - il_set_rate(il); - } - - if (changed & (IEEE80211_CONF_CHANGE_PS | IEEE80211_CONF_CHANGE_IDLE)) { - ret = il_power_update_mode(il, false); - if (ret) - D_MAC80211("Error setting sleep level\n"); - } - - if (changed & IEEE80211_CONF_CHANGE_POWER) { - D_MAC80211("TX Power old=%d new=%d\n", il->tx_power_user_lmt, - conf->power_level); - - il_set_tx_power(il, conf->power_level, false); - } - - if (!il_is_ready(il)) { - D_MAC80211("leave - not ready\n"); - goto out; - } - - if (scan_active) - goto out; - - if (memcmp(&il->active, &il->staging, sizeof(il->staging))) - il_commit_rxon(il); - else - D_INFO("Not re-sending same RXON configuration.\n"); - if (ht_changed) - il_update_qos(il); - -out: - D_MAC80211("leave ret %d\n", ret); - mutex_unlock(&il->mutex); - - return ret; -} -EXPORT_SYMBOL(il_mac_config); - -void -il_mac_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct il_priv *il = hw->priv; - unsigned long flags; - - mutex_lock(&il->mutex); - D_MAC80211("enter: type %d, addr %pM\n", vif->type, vif->addr); - - spin_lock_irqsave(&il->lock, flags); - - memset(&il->current_ht_config, 0, sizeof(struct il_ht_config)); - - /* new association get rid of ibss beacon skb */ - if (il->beacon_skb) - dev_kfree_skb(il->beacon_skb); - il->beacon_skb = NULL; - il->timestamp = 0; - - spin_unlock_irqrestore(&il->lock, flags); - - il_scan_cancel_timeout(il, 100); - if (!il_is_ready_rf(il)) { - D_MAC80211("leave - not ready\n"); - mutex_unlock(&il->mutex); - return; - } - - /* we are restarting association process */ - il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - il_commit_rxon(il); - - il_set_rate(il); - - D_MAC80211("leave\n"); - mutex_unlock(&il->mutex); -} -EXPORT_SYMBOL(il_mac_reset_tsf); - -static void -il_ht_conf(struct il_priv *il, struct ieee80211_vif *vif) -{ - struct il_ht_config *ht_conf = &il->current_ht_config; - struct ieee80211_sta *sta; - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; - - D_ASSOC("enter:\n"); - - if (!il->ht.enabled) - return; - - il->ht.protection = - bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION; - il->ht.non_gf_sta_present = - !!(bss_conf-> - ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); - - ht_conf->single_chain_sufficient = false; - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - rcu_read_lock(); - sta = ieee80211_find_sta(vif, bss_conf->bssid); - if (sta) { - struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - int maxstreams; - - maxstreams = - (ht_cap->mcs. - tx_params & IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK) - >> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT; - maxstreams += 1; - - if (ht_cap->mcs.rx_mask[1] == 0 && - ht_cap->mcs.rx_mask[2] == 0) - ht_conf->single_chain_sufficient = true; - if (maxstreams <= 1) - ht_conf->single_chain_sufficient = true; - } else { - /* - * If at all, this can only happen through a race - * when the AP disconnects us while we're still - * setting up the connection, in that case mac80211 - * will soon tell us about that. - */ - ht_conf->single_chain_sufficient = true; - } - rcu_read_unlock(); - break; - case NL80211_IFTYPE_ADHOC: - ht_conf->single_chain_sufficient = true; - break; - default: - break; - } - - D_ASSOC("leave\n"); -} - -static inline void -il_set_no_assoc(struct il_priv *il, struct ieee80211_vif *vif) -{ - /* - * inform the ucode that there is no longer an - * association and that no more packets should be - * sent - */ - il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - il->staging.assoc_id = 0; - il_commit_rxon(il); -} - -static void -il_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct il_priv *il = hw->priv; - unsigned long flags; - __le64 timestamp; - struct sk_buff *skb = ieee80211_beacon_get(hw, vif); - - if (!skb) - return; - - D_MAC80211("enter\n"); - - lockdep_assert_held(&il->mutex); - - if (!il->beacon_enabled) { - IL_ERR("update beacon with no beaconing enabled\n"); - dev_kfree_skb(skb); - return; - } - - spin_lock_irqsave(&il->lock, flags); - - if (il->beacon_skb) - dev_kfree_skb(il->beacon_skb); - - il->beacon_skb = skb; - - timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; - il->timestamp = le64_to_cpu(timestamp); - - D_MAC80211("leave\n"); - spin_unlock_irqrestore(&il->lock, flags); - - if (!il_is_ready_rf(il)) { - D_MAC80211("leave - RF not ready\n"); - return; - } - - il->ops->post_associate(il); -} - -void -il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, u32 changes) -{ - struct il_priv *il = hw->priv; - int ret; - - mutex_lock(&il->mutex); - D_MAC80211("enter: changes 0x%x\n", changes); - - if (!il_is_alive(il)) { - D_MAC80211("leave - not alive\n"); - mutex_unlock(&il->mutex); - return; - } - - if (changes & BSS_CHANGED_QOS) { - unsigned long flags; - - spin_lock_irqsave(&il->lock, flags); - il->qos_data.qos_active = bss_conf->qos; - il_update_qos(il); - spin_unlock_irqrestore(&il->lock, flags); - } - - if (changes & BSS_CHANGED_BEACON_ENABLED) { - /* FIXME: can we remove beacon_enabled ? */ - if (vif->bss_conf.enable_beacon) - il->beacon_enabled = true; - else - il->beacon_enabled = false; - } - - if (changes & BSS_CHANGED_BSSID) { - D_MAC80211("BSSID %pM\n", bss_conf->bssid); - - /* - * If there is currently a HW scan going on in the background, - * then we need to cancel it, otherwise sometimes we are not - * able to authenticate (FIXME: why ?) - */ - if (il_scan_cancel_timeout(il, 100)) { - D_MAC80211("leave - scan abort failed\n"); - mutex_unlock(&il->mutex); - return; - } - - /* mac80211 only sets assoc when in STATION mode */ - memcpy(il->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); - - /* FIXME: currently needed in a few places */ - memcpy(il->bssid, bss_conf->bssid, ETH_ALEN); - } - - /* - * This needs to be after setting the BSSID in case - * mac80211 decides to do both changes at once because - * it will invoke post_associate. - */ - if (vif->type == NL80211_IFTYPE_ADHOC && (changes & BSS_CHANGED_BEACON)) - il_beacon_update(hw, vif); - - if (changes & BSS_CHANGED_ERP_PREAMBLE) { - D_MAC80211("ERP_PREAMBLE %d\n", bss_conf->use_short_preamble); - if (bss_conf->use_short_preamble) - il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; - else - il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; - } - - if (changes & BSS_CHANGED_ERP_CTS_PROT) { - D_MAC80211("ERP_CTS %d\n", bss_conf->use_cts_prot); - if (bss_conf->use_cts_prot && il->band != IEEE80211_BAND_5GHZ) - il->staging.flags |= RXON_FLG_TGG_PROTECT_MSK; - else - il->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; - if (bss_conf->use_cts_prot) - il->staging.flags |= RXON_FLG_SELF_CTS_EN; - else - il->staging.flags &= ~RXON_FLG_SELF_CTS_EN; - } - - if (changes & BSS_CHANGED_BASIC_RATES) { - /* XXX use this information - * - * To do that, remove code from il_set_rate() and put something - * like this here: - * - if (A-band) - il->staging.ofdm_basic_rates = - bss_conf->basic_rates; - else - il->staging.ofdm_basic_rates = - bss_conf->basic_rates >> 4; - il->staging.cck_basic_rates = - bss_conf->basic_rates & 0xF; - */ - } - - if (changes & BSS_CHANGED_HT) { - il_ht_conf(il, vif); - - if (il->ops->set_rxon_chain) - il->ops->set_rxon_chain(il); - } - - if (changes & BSS_CHANGED_ASSOC) { - D_MAC80211("ASSOC %d\n", bss_conf->assoc); - if (bss_conf->assoc) { - il->timestamp = bss_conf->sync_tsf; - - if (!il_is_rfkill(il)) - il->ops->post_associate(il); - } else - il_set_no_assoc(il, vif); - } - - if (changes && il_is_associated(il) && bss_conf->aid) { - D_MAC80211("Changes (%#x) while associated\n", changes); - ret = il_send_rxon_assoc(il); - if (!ret) { - /* Sync active_rxon with latest change. */ - memcpy((void *)&il->active, &il->staging, - sizeof(struct il_rxon_cmd)); - } - } - - if (changes & BSS_CHANGED_BEACON_ENABLED) { - if (vif->bss_conf.enable_beacon) { - memcpy(il->staging.bssid_addr, bss_conf->bssid, - ETH_ALEN); - memcpy(il->bssid, bss_conf->bssid, ETH_ALEN); - il->ops->config_ap(il); - } else - il_set_no_assoc(il, vif); - } - - if (changes & BSS_CHANGED_IBSS) { - ret = il->ops->manage_ibss_station(il, vif, - bss_conf->ibss_joined); - if (ret) - IL_ERR("failed to %s IBSS station %pM\n", - bss_conf->ibss_joined ? "add" : "remove", - bss_conf->bssid); - } - - D_MAC80211("leave\n"); - mutex_unlock(&il->mutex); -} -EXPORT_SYMBOL(il_mac_bss_info_changed); - -irqreturn_t -il_isr(int irq, void *data) -{ - struct il_priv *il = data; - u32 inta, inta_mask; - u32 inta_fh; - unsigned long flags; - if (!il) - return IRQ_NONE; - - spin_lock_irqsave(&il->lock, flags); - - /* Disable (but don't clear!) interrupts here to avoid - * back-to-back ISRs and sporadic interrupts from our NIC. - * If we have something to service, the tasklet will re-enable ints. - * If we *don't* have something, we'll re-enable before leaving here. */ - inta_mask = _il_rd(il, CSR_INT_MASK); /* just for debug */ - _il_wr(il, CSR_INT_MASK, 0x00000000); - - /* Discover which interrupts are active/pending */ - inta = _il_rd(il, CSR_INT); - inta_fh = _il_rd(il, CSR_FH_INT_STATUS); - - /* Ignore interrupt if there's nothing in NIC to service. - * This may be due to IRQ shared with another device, - * or due to sporadic interrupts thrown from our NIC. */ - if (!inta && !inta_fh) { - D_ISR("Ignore interrupt, inta == 0, inta_fh == 0\n"); - goto none; - } - - if (inta == 0xFFFFFFFF || (inta & 0xFFFFFFF0) == 0xa5a5a5a0) { - /* Hardware disappeared. It might have already raised - * an interrupt */ - IL_WARN("HARDWARE GONE?? INTA == 0x%08x\n", inta); - goto unplugged; - } - - D_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", inta, inta_mask, - inta_fh); - - inta &= ~CSR_INT_BIT_SCD; - - /* il_irq_tasklet() will service interrupts and re-enable them */ - if (likely(inta || inta_fh)) - tasklet_schedule(&il->irq_tasklet); - -unplugged: - spin_unlock_irqrestore(&il->lock, flags); - return IRQ_HANDLED; - -none: - /* re-enable interrupts here since we don't have anything to service. */ - /* only Re-enable if disabled by irq */ - if (test_bit(S_INT_ENABLED, &il->status)) - il_enable_interrupts(il); - spin_unlock_irqrestore(&il->lock, flags); - return IRQ_NONE; -} -EXPORT_SYMBOL(il_isr); - -/* - * il_tx_cmd_protection: Set rts/cts. 3945 and 4965 only share this - * function. - */ -void -il_tx_cmd_protection(struct il_priv *il, struct ieee80211_tx_info *info, - __le16 fc, __le32 *tx_flags) -{ - if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) { - *tx_flags |= TX_CMD_FLG_RTS_MSK; - *tx_flags &= ~TX_CMD_FLG_CTS_MSK; - *tx_flags |= TX_CMD_FLG_FULL_TXOP_PROT_MSK; - - if (!ieee80211_is_mgmt(fc)) - return; - - switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) { - case cpu_to_le16(IEEE80211_STYPE_AUTH): - case cpu_to_le16(IEEE80211_STYPE_DEAUTH): - case cpu_to_le16(IEEE80211_STYPE_ASSOC_REQ): - case cpu_to_le16(IEEE80211_STYPE_REASSOC_REQ): - *tx_flags &= ~TX_CMD_FLG_RTS_MSK; - *tx_flags |= TX_CMD_FLG_CTS_MSK; - break; - } - } else if (info->control.rates[0]. - flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { - *tx_flags &= ~TX_CMD_FLG_RTS_MSK; - *tx_flags |= TX_CMD_FLG_CTS_MSK; - *tx_flags |= TX_CMD_FLG_FULL_TXOP_PROT_MSK; - } -} -EXPORT_SYMBOL(il_tx_cmd_protection); diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h deleted file mode 100644 index 4caaf52986a4..000000000000 --- a/drivers/net/wireless/iwlegacy/common.h +++ /dev/null @@ -1,3035 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ -#ifndef __il_core_h__ -#define __il_core_h__ - -#include -#include /* for struct pci_device_id */ -#include -#include -#include -#include -#include -#include - -#include "commands.h" -#include "csr.h" -#include "prph.h" - -struct il_host_cmd; -struct il_cmd; -struct il_tx_queue; - -#define IL_ERR(f, a...) dev_err(&il->pci_dev->dev, f, ## a) -#define IL_WARN(f, a...) dev_warn(&il->pci_dev->dev, f, ## a) -#define IL_INFO(f, a...) dev_info(&il->pci_dev->dev, f, ## a) - -#define RX_QUEUE_SIZE 256 -#define RX_QUEUE_MASK 255 -#define RX_QUEUE_SIZE_LOG 8 - -/* - * RX related structures and functions - */ -#define RX_FREE_BUFFERS 64 -#define RX_LOW_WATERMARK 8 - -#define U32_PAD(n) ((4-(n))&0x3) - -/* CT-KILL constants */ -#define CT_KILL_THRESHOLD_LEGACY 110 /* in Celsius */ - -/* Default noise level to report when noise measurement is not available. - * This may be because we're: - * 1) Not associated (4965, no beacon stats being sent to driver) - * 2) Scanning (noise measurement does not apply to associated channel) - * 3) Receiving CCK (3945 delivers noise info only for OFDM frames) - * Use default noise value of -127 ... this is below the range of measurable - * Rx dBm for either 3945 or 4965, so it can indicate "unmeasurable" to user. - * Also, -127 works better than 0 when averaging frames with/without - * noise info (e.g. averaging might be done in app); measured dBm values are - * always negative ... using a negative value as the default keeps all - * averages within an s8's (used in some apps) range of negative values. */ -#define IL_NOISE_MEAS_NOT_AVAILABLE (-127) - -/* - * RTS threshold here is total size [2347] minus 4 FCS bytes - * Per spec: - * a value of 0 means RTS on all data/management packets - * a value > max MSDU size means no RTS - * else RTS for data/management frames where MPDU is larger - * than RTS value. - */ -#define DEFAULT_RTS_THRESHOLD 2347U -#define MIN_RTS_THRESHOLD 0U -#define MAX_RTS_THRESHOLD 2347U -#define MAX_MSDU_SIZE 2304U -#define MAX_MPDU_SIZE 2346U -#define DEFAULT_BEACON_INTERVAL 100U -#define DEFAULT_SHORT_RETRY_LIMIT 7U -#define DEFAULT_LONG_RETRY_LIMIT 4U - -struct il_rx_buf { - dma_addr_t page_dma; - struct page *page; - struct list_head list; -}; - -#define rxb_addr(r) page_address(r->page) - -/* defined below */ -struct il_device_cmd; - -struct il_cmd_meta { - /* only for SYNC commands, iff the reply skb is wanted */ - struct il_host_cmd *source; - /* - * only for ASYNC commands - * (which is somewhat stupid -- look at common.c for instance - * which duplicates a bunch of code because the callback isn't - * invoked for SYNC commands, if it were and its result passed - * through it would be simpler...) - */ - void (*callback) (struct il_priv *il, struct il_device_cmd *cmd, - struct il_rx_pkt *pkt); - - /* The CMD_SIZE_HUGE flag bit indicates that the command - * structure is stored at the end of the shared queue memory. */ - u32 flags; - - DEFINE_DMA_UNMAP_ADDR(mapping); - DEFINE_DMA_UNMAP_LEN(len); -}; - -/* - * Generic queue structure - * - * Contains common data for Rx and Tx queues - */ -struct il_queue { - int n_bd; /* number of BDs in this queue */ - int write_ptr; /* 1-st empty entry (idx) host_w */ - int read_ptr; /* last used entry (idx) host_r */ - /* use for monitoring and recovering the stuck queue */ - dma_addr_t dma_addr; /* physical addr for BD's */ - int n_win; /* safe queue win */ - u32 id; - int low_mark; /* low watermark, resume queue if free - * space more than this */ - int high_mark; /* high watermark, stop queue if free - * space less than this */ -}; - -/** - * struct il_tx_queue - Tx Queue for DMA - * @q: generic Rx/Tx queue descriptor - * @bd: base of circular buffer of TFDs - * @cmd: array of command/TX buffer pointers - * @meta: array of meta data for each command/tx buffer - * @dma_addr_cmd: physical address of cmd/tx buffer array - * @skbs: array of per-TFD socket buffer pointers - * @time_stamp: time (in jiffies) of last read_ptr change - * @need_update: indicates need to update read/write idx - * @sched_retry: indicates queue is high-throughput aggregation (HT AGG) enabled - * - * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame - * descriptors) and required locking structures. - */ -#define TFD_TX_CMD_SLOTS 256 -#define TFD_CMD_SLOTS 32 - -struct il_tx_queue { - struct il_queue q; - void *tfds; - struct il_device_cmd **cmd; - struct il_cmd_meta *meta; - struct sk_buff **skbs; - unsigned long time_stamp; - u8 need_update; - u8 sched_retry; - u8 active; - u8 swq_id; -}; - -/* - * EEPROM access time values: - * - * Driver initiates EEPROM read by writing byte address << 1 to CSR_EEPROM_REG. - * Driver then polls CSR_EEPROM_REG for CSR_EEPROM_REG_READ_VALID_MSK (0x1). - * When polling, wait 10 uSec between polling loops, up to a maximum 5000 uSec. - * Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG. - */ -#define IL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */ - -#define IL_EEPROM_SEM_TIMEOUT 10 /* microseconds */ -#define IL_EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ - -/* - * Regulatory channel usage flags in EEPROM struct il4965_eeprom_channel.flags. - * - * IBSS and/or AP operation is allowed *only* on those channels with - * (VALID && IBSS && ACTIVE && !RADAR). This restriction is in place because - * RADAR detection is not supported by the 4965 driver, but is a - * requirement for establishing a new network for legal operation on channels - * requiring RADAR detection or restricting ACTIVE scanning. - * - * NOTE: "WIDE" flag does not indicate anything about "HT40" 40 MHz channels. - * It only indicates that 20 MHz channel use is supported; HT40 channel - * usage is indicated by a separate set of regulatory flags for each - * HT40 channel pair. - * - * NOTE: Using a channel inappropriately will result in a uCode error! - */ -#define IL_NUM_TX_CALIB_GROUPS 5 -enum { - EEPROM_CHANNEL_VALID = (1 << 0), /* usable for this SKU/geo */ - EEPROM_CHANNEL_IBSS = (1 << 1), /* usable as an IBSS channel */ - /* Bit 2 Reserved */ - EEPROM_CHANNEL_ACTIVE = (1 << 3), /* active scanning allowed */ - EEPROM_CHANNEL_RADAR = (1 << 4), /* radar detection required */ - EEPROM_CHANNEL_WIDE = (1 << 5), /* 20 MHz channel okay */ - /* Bit 6 Reserved (was Narrow Channel) */ - EEPROM_CHANNEL_DFS = (1 << 7), /* dynamic freq selection candidate */ -}; - -/* SKU Capabilities */ -/* 3945 only */ -#define EEPROM_SKU_CAP_SW_RF_KILL_ENABLE (1 << 0) -#define EEPROM_SKU_CAP_HW_RF_KILL_ENABLE (1 << 1) - -/* *regulatory* channel data format in eeprom, one for each channel. - * There are separate entries for HT40 (40 MHz) vs. normal (20 MHz) channels. */ -struct il_eeprom_channel { - u8 flags; /* EEPROM_CHANNEL_* flags copied from EEPROM */ - s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */ -} __packed; - -/* 3945 Specific */ -#define EEPROM_3945_EEPROM_VERSION (0x2f) - -/* 4965 has two radio transmitters (and 3 radio receivers) */ -#define EEPROM_TX_POWER_TX_CHAINS (2) - -/* 4965 has room for up to 8 sets of txpower calibration data */ -#define EEPROM_TX_POWER_BANDS (8) - -/* 4965 factory calibration measures txpower gain settings for - * each of 3 target output levels */ -#define EEPROM_TX_POWER_MEASUREMENTS (3) - -/* 4965 Specific */ -/* 4965 driver does not work with txpower calibration version < 5 */ -#define EEPROM_4965_TX_POWER_VERSION (5) -#define EEPROM_4965_EEPROM_VERSION (0x2f) -#define EEPROM_4965_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */ -#define EEPROM_4965_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */ -#define EEPROM_4965_BOARD_REVISION (2*0x4F) /* 2 bytes */ -#define EEPROM_4965_BOARD_PBA (2*0x56+1) /* 9 bytes */ - -/* 2.4 GHz */ -extern const u8 il_eeprom_band_1[14]; - -/* - * factory calibration data for one txpower level, on one channel, - * measured on one of the 2 tx chains (radio transmitter and associated - * antenna). EEPROM contains: - * - * 1) Temperature (degrees Celsius) of device when measurement was made. - * - * 2) Gain table idx used to achieve the target measurement power. - * This refers to the "well-known" gain tables (see 4965.h). - * - * 3) Actual measured output power, in half-dBm ("34" = 17 dBm). - * - * 4) RF power amplifier detector level measurement (not used). - */ -struct il_eeprom_calib_measure { - u8 temperature; /* Device temperature (Celsius) */ - u8 gain_idx; /* Index into gain table */ - u8 actual_pow; /* Measured RF output power, half-dBm */ - s8 pa_det; /* Power amp detector level (not used) */ -} __packed; - -/* - * measurement set for one channel. EEPROM contains: - * - * 1) Channel number measured - * - * 2) Measurements for each of 3 power levels for each of 2 radio transmitters - * (a.k.a. "tx chains") (6 measurements altogether) - */ -struct il_eeprom_calib_ch_info { - u8 ch_num; - struct il_eeprom_calib_measure - measurements[EEPROM_TX_POWER_TX_CHAINS] - [EEPROM_TX_POWER_MEASUREMENTS]; -} __packed; - -/* - * txpower subband info. - * - * For each frequency subband, EEPROM contains the following: - * - * 1) First and last channels within range of the subband. "0" values - * indicate that this sample set is not being used. - * - * 2) Sample measurement sets for 2 channels close to the range endpoints. - */ -struct il_eeprom_calib_subband_info { - u8 ch_from; /* channel number of lowest channel in subband */ - u8 ch_to; /* channel number of highest channel in subband */ - struct il_eeprom_calib_ch_info ch1; - struct il_eeprom_calib_ch_info ch2; -} __packed; - -/* - * txpower calibration info. EEPROM contains: - * - * 1) Factory-measured saturation power levels (maximum levels at which - * tx power amplifier can output a signal without too much distortion). - * There is one level for 2.4 GHz band and one for 5 GHz band. These - * values apply to all channels within each of the bands. - * - * 2) Factory-measured power supply voltage level. This is assumed to be - * constant (i.e. same value applies to all channels/bands) while the - * factory measurements are being made. - * - * 3) Up to 8 sets of factory-measured txpower calibration values. - * These are for different frequency ranges, since txpower gain - * characteristics of the analog radio circuitry vary with frequency. - * - * Not all sets need to be filled with data; - * struct il_eeprom_calib_subband_info contains range of channels - * (0 if unused) for each set of data. - */ -struct il_eeprom_calib_info { - u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */ - u8 saturation_power52; /* half-dBm */ - __le16 voltage; /* signed */ - struct il_eeprom_calib_subband_info band_info[EEPROM_TX_POWER_BANDS]; -} __packed; - -/* General */ -#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */ -#define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */ -#define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */ -#define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */ -#define EEPROM_VERSION (2*0x44) /* 2 bytes */ -#define EEPROM_SKU_CAP (2*0x45) /* 2 bytes */ -#define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */ -#define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */ -#define EEPROM_RADIO_CONFIG (2*0x48) /* 2 bytes */ -#define EEPROM_NUM_MAC_ADDRESS (2*0x4C) /* 2 bytes */ - -/* The following masks are to be applied on EEPROM_RADIO_CONFIG */ -#define EEPROM_RF_CFG_TYPE_MSK(x) (x & 0x3) /* bits 0-1 */ -#define EEPROM_RF_CFG_STEP_MSK(x) ((x >> 2) & 0x3) /* bits 2-3 */ -#define EEPROM_RF_CFG_DASH_MSK(x) ((x >> 4) & 0x3) /* bits 4-5 */ -#define EEPROM_RF_CFG_PNUM_MSK(x) ((x >> 6) & 0x3) /* bits 6-7 */ -#define EEPROM_RF_CFG_TX_ANT_MSK(x) ((x >> 8) & 0xF) /* bits 8-11 */ -#define EEPROM_RF_CFG_RX_ANT_MSK(x) ((x >> 12) & 0xF) /* bits 12-15 */ - -#define EEPROM_3945_RF_CFG_TYPE_MAX 0x0 -#define EEPROM_4965_RF_CFG_TYPE_MAX 0x1 - -/* - * Per-channel regulatory data. - * - * Each channel that *might* be supported by iwl has a fixed location - * in EEPROM containing EEPROM_CHANNEL_* usage flags (LSB) and max regulatory - * txpower (MSB). - * - * Entries immediately below are for 20 MHz channel width. HT40 (40 MHz) - * channels (only for 4965, not supported by 3945) appear later in the EEPROM. - * - * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 - */ -#define EEPROM_REGULATORY_SKU_ID (2*0x60) /* 4 bytes */ -#define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */ -#define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */ - -/* - * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196, - * 5.0 GHz channels 7, 8, 11, 12, 16 - * (4915-5080MHz) (none of these is ever supported) - */ -#define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */ -#define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */ - -/* - * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 - * (5170-5320MHz) - */ -#define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */ -#define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */ - -/* - * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 - * (5500-5700MHz) - */ -#define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */ -#define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */ - -/* - * 5.7 GHz channels 145, 149, 153, 157, 161, 165 - * (5725-5825MHz) - */ -#define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */ -#define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */ - -/* - * 2.4 GHz HT40 channels 1 (5), 2 (6), 3 (7), 4 (8), 5 (9), 6 (10), 7 (11) - * - * The channel listed is the center of the lower 20 MHz half of the channel. - * The overall center frequency is actually 2 channels (10 MHz) above that, - * and the upper half of each HT40 channel is centered 4 channels (20 MHz) away - * from the lower half; e.g. the upper half of HT40 channel 1 is channel 5, - * and the overall HT40 channel width centers on channel 3. - * - * NOTE: The RXON command uses 20 MHz channel numbers to specify the - * control channel to which to tune. RXON also specifies whether the - * control channel is the upper or lower half of a HT40 channel. - * - * NOTE: 4965 does not support HT40 channels on 2.4 GHz. - */ -#define EEPROM_4965_REGULATORY_BAND_24_HT40_CHANNELS (2*0xA0) /* 14 bytes */ - -/* - * 5.2 GHz HT40 channels 36 (40), 44 (48), 52 (56), 60 (64), - * 100 (104), 108 (112), 116 (120), 124 (128), 132 (136), 149 (153), 157 (161) - */ -#define EEPROM_4965_REGULATORY_BAND_52_HT40_CHANNELS (2*0xA8) /* 22 bytes */ - -#define EEPROM_REGULATORY_BAND_NO_HT40 (0) - -int il_eeprom_init(struct il_priv *il); -void il_eeprom_free(struct il_priv *il); -const u8 *il_eeprom_query_addr(const struct il_priv *il, size_t offset); -u16 il_eeprom_query16(const struct il_priv *il, size_t offset); -int il_init_channel_map(struct il_priv *il); -void il_free_channel_map(struct il_priv *il); -const struct il_channel_info *il_get_channel_info(const struct il_priv *il, - enum ieee80211_band band, - u16 channel); - -#define IL_NUM_SCAN_RATES (2) - -struct il4965_channel_tgd_info { - u8 type; - s8 max_power; -}; - -struct il4965_channel_tgh_info { - s64 last_radar_time; -}; - -#define IL4965_MAX_RATE (33) - -struct il3945_clip_group { - /* maximum power level to prevent clipping for each rate, derived by - * us from this band's saturation power in EEPROM */ - const s8 clip_powers[IL_MAX_RATES]; -}; - -/* current Tx power values to use, one for each rate for each channel. - * requested power is limited by: - * -- regulatory EEPROM limits for this channel - * -- hardware capabilities (clip-powers) - * -- spectrum management - * -- user preference (e.g. iwconfig) - * when requested power is set, base power idx must also be set. */ -struct il3945_channel_power_info { - struct il3945_tx_power tpc; /* actual radio and DSP gain settings */ - s8 power_table_idx; /* actual (compenst'd) idx into gain table */ - s8 base_power_idx; /* gain idx for power at factory temp. */ - s8 requested_power; /* power (dBm) requested for this chnl/rate */ -}; - -/* current scan Tx power values to use, one for each scan rate for each - * channel. */ -struct il3945_scan_power_info { - struct il3945_tx_power tpc; /* actual radio and DSP gain settings */ - s8 power_table_idx; /* actual (compenst'd) idx into gain table */ - s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */ -}; - -/* - * One for each channel, holds all channel setup data - * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant - * with one another! - */ -struct il_channel_info { - struct il4965_channel_tgd_info tgd; - struct il4965_channel_tgh_info tgh; - struct il_eeprom_channel eeprom; /* EEPROM regulatory limit */ - struct il_eeprom_channel ht40_eeprom; /* EEPROM regulatory limit for - * HT40 channel */ - - u8 channel; /* channel number */ - u8 flags; /* flags copied from EEPROM */ - s8 max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */ - s8 curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) limit */ - s8 min_power; /* always 0 */ - s8 scan_power; /* (dBm) regul. eeprom, direct scans, any rate */ - - u8 group_idx; /* 0-4, maps channel to group1/2/3/4/5 */ - u8 band_idx; /* 0-4, maps channel to band1/2/3/4/5 */ - enum ieee80211_band band; - - /* HT40 channel info */ - s8 ht40_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */ - u8 ht40_flags; /* flags copied from EEPROM */ - u8 ht40_extension_channel; /* HT_IE_EXT_CHANNEL_* */ - - /* Radio/DSP gain settings for each "normal" data Tx rate. - * These include, in addition to RF and DSP gain, a few fields for - * remembering/modifying gain settings (idxes). */ - struct il3945_channel_power_info power_info[IL4965_MAX_RATE]; - - /* Radio/DSP gain settings for each scan rate, for directed scans. */ - struct il3945_scan_power_info scan_pwr_info[IL_NUM_SCAN_RATES]; -}; - -#define IL_TX_FIFO_BK 0 /* shared */ -#define IL_TX_FIFO_BE 1 -#define IL_TX_FIFO_VI 2 /* shared */ -#define IL_TX_FIFO_VO 3 -#define IL_TX_FIFO_UNUSED -1 - -/* Minimum number of queues. MAX_NUM is defined in hw specific files. - * Set the minimum to accommodate the 4 standard TX queues, 1 command - * queue, 2 (unused) HCCA queues, and 4 HT queues (one for each AC) */ -#define IL_MIN_NUM_QUEUES 10 - -#define IL_DEFAULT_CMD_QUEUE_NUM 4 - -#define IEEE80211_DATA_LEN 2304 -#define IEEE80211_4ADDR_LEN 30 -#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) -#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) - -struct il_frame { - union { - struct ieee80211_hdr frame; - struct il_tx_beacon_cmd beacon; - u8 raw[IEEE80211_FRAME_LEN]; - u8 cmd[360]; - } u; - struct list_head list; -}; - -enum { - CMD_SYNC = 0, - CMD_SIZE_NORMAL = 0, - CMD_NO_SKB = 0, - CMD_SIZE_HUGE = (1 << 0), - CMD_ASYNC = (1 << 1), - CMD_WANT_SKB = (1 << 2), - CMD_MAPPED = (1 << 3), -}; - -#define DEF_CMD_PAYLOAD_SIZE 320 - -/** - * struct il_device_cmd - * - * For allocation of the command and tx queues, this establishes the overall - * size of the largest command we send to uCode, except for a scan command - * (which is relatively huge; space is allocated separately). - */ -struct il_device_cmd { - struct il_cmd_header hdr; /* uCode API */ - union { - u32 flags; - u8 val8; - u16 val16; - u32 val32; - struct il_tx_cmd tx; - u8 payload[DEF_CMD_PAYLOAD_SIZE]; - } __packed cmd; -} __packed; - -#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct il_device_cmd)) - -struct il_host_cmd { - const void *data; - unsigned long reply_page; - void (*callback) (struct il_priv *il, struct il_device_cmd *cmd, - struct il_rx_pkt *pkt); - u32 flags; - u16 len; - u8 id; -}; - -#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 -#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 -#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 - -/** - * struct il_rx_queue - Rx queue - * @bd: driver's pointer to buffer of receive buffer descriptors (rbd) - * @bd_dma: bus address of buffer of receive buffer descriptors (rbd) - * @read: Shared idx to newest available Rx buffer - * @write: Shared idx to oldest written Rx packet - * @free_count: Number of pre-allocated buffers in rx_free - * @rx_free: list of free SKBs for use - * @rx_used: List of Rx buffers with no SKB - * @need_update: flag to indicate we need to update read/write idx - * @rb_stts: driver's pointer to receive buffer status - * @rb_stts_dma: bus address of receive buffer status - * - * NOTE: rx_free and rx_used are used as a FIFO for il_rx_bufs - */ -struct il_rx_queue { - __le32 *bd; - dma_addr_t bd_dma; - struct il_rx_buf pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; - struct il_rx_buf *queue[RX_QUEUE_SIZE]; - u32 read; - u32 write; - u32 free_count; - u32 write_actual; - struct list_head rx_free; - struct list_head rx_used; - int need_update; - struct il_rb_status *rb_stts; - dma_addr_t rb_stts_dma; - spinlock_t lock; -}; - -#define IL_SUPPORTED_RATES_IE_LEN 8 - -#define MAX_TID_COUNT 9 - -#define IL_INVALID_RATE 0xFF -#define IL_INVALID_VALUE -1 - -/** - * struct il_ht_agg -- aggregation status while waiting for block-ack - * @txq_id: Tx queue used for Tx attempt - * @frame_count: # frames attempted by Tx command - * @wait_for_ba: Expect block-ack before next Tx reply - * @start_idx: Index of 1st Transmit Frame Descriptor (TFD) in Tx win - * @bitmap0: Low order bitmap, one bit for each frame pending ACK in Tx win - * @bitmap1: High order, one bit for each frame pending ACK in Tx win - * @rate_n_flags: Rate at which Tx was attempted - * - * If C_TX indicates that aggregation was attempted, driver must wait - * for block ack (N_COMPRESSED_BA). This struct stores tx reply info - * until block ack arrives. - */ -struct il_ht_agg { - u16 txq_id; - u16 frame_count; - u16 wait_for_ba; - u16 start_idx; - u64 bitmap; - u32 rate_n_flags; -#define IL_AGG_OFF 0 -#define IL_AGG_ON 1 -#define IL_EMPTYING_HW_QUEUE_ADDBA 2 -#define IL_EMPTYING_HW_QUEUE_DELBA 3 - u8 state; -}; - -struct il_tid_data { - u16 seq_number; /* 4965 only */ - u16 tfds_in_queue; - struct il_ht_agg agg; -}; - -struct il_hw_key { - u32 cipher; - int keylen; - u8 keyidx; - u8 key[32]; -}; - -union il_ht_rate_supp { - u16 rates; - struct { - u8 siso_rate; - u8 mimo_rate; - }; -}; - -#define CFG_HT_RX_AMPDU_FACTOR_8K (0x0) -#define CFG_HT_RX_AMPDU_FACTOR_16K (0x1) -#define CFG_HT_RX_AMPDU_FACTOR_32K (0x2) -#define CFG_HT_RX_AMPDU_FACTOR_64K (0x3) -#define CFG_HT_RX_AMPDU_FACTOR_DEF CFG_HT_RX_AMPDU_FACTOR_64K -#define CFG_HT_RX_AMPDU_FACTOR_MAX CFG_HT_RX_AMPDU_FACTOR_64K -#define CFG_HT_RX_AMPDU_FACTOR_MIN CFG_HT_RX_AMPDU_FACTOR_8K - -/* - * Maximal MPDU density for TX aggregation - * 4 - 2us density - * 5 - 4us density - * 6 - 8us density - * 7 - 16us density - */ -#define CFG_HT_MPDU_DENSITY_2USEC (0x4) -#define CFG_HT_MPDU_DENSITY_4USEC (0x5) -#define CFG_HT_MPDU_DENSITY_8USEC (0x6) -#define CFG_HT_MPDU_DENSITY_16USEC (0x7) -#define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_4USEC -#define CFG_HT_MPDU_DENSITY_MAX CFG_HT_MPDU_DENSITY_16USEC -#define CFG_HT_MPDU_DENSITY_MIN (0x1) - -struct il_ht_config { - bool single_chain_sufficient; - enum ieee80211_smps_mode smps; /* current smps mode */ -}; - -/* QoS structures */ -struct il_qos_info { - int qos_active; - struct il_qosparam_cmd def_qos_parm; -}; - -/* - * Structure should be accessed with sta_lock held. When station addition - * is in progress (IL_STA_UCODE_INPROGRESS) it is possible to access only - * the commands (il_addsta_cmd and il_link_quality_cmd) without - * sta_lock held. - */ -struct il_station_entry { - struct il_addsta_cmd sta; - struct il_tid_data tid[MAX_TID_COUNT]; - u8 used; - struct il_hw_key keyinfo; - struct il_link_quality_cmd *lq; -}; - -struct il_station_priv_common { - u8 sta_id; -}; - -/** - * struct il_vif_priv - driver's ilate per-interface information - * - * When mac80211 allocates a virtual interface, it can allocate - * space for us to put data into. - */ -struct il_vif_priv { - u8 ibss_bssid_sta_id; -}; - -/* one for each uCode image (inst/data, boot/init/runtime) */ -struct fw_desc { - void *v_addr; /* access by driver */ - dma_addr_t p_addr; /* access by card's busmaster DMA */ - u32 len; /* bytes */ -}; - -/* uCode file layout */ -struct il_ucode_header { - __le32 ver; /* major/minor/API/serial */ - struct { - __le32 inst_size; /* bytes of runtime code */ - __le32 data_size; /* bytes of runtime data */ - __le32 init_size; /* bytes of init code */ - __le32 init_data_size; /* bytes of init data */ - __le32 boot_size; /* bytes of bootstrap code */ - u8 data[0]; /* in same order as sizes */ - } v1; -}; - -struct il4965_ibss_seq { - u8 mac[ETH_ALEN]; - u16 seq_num; - u16 frag_num; - unsigned long packet_time; - struct list_head list; -}; - -struct il_sensitivity_ranges { - u16 min_nrg_cck; - u16 max_nrg_cck; - - u16 nrg_th_cck; - u16 nrg_th_ofdm; - - u16 auto_corr_min_ofdm; - u16 auto_corr_min_ofdm_mrc; - u16 auto_corr_min_ofdm_x1; - u16 auto_corr_min_ofdm_mrc_x1; - - u16 auto_corr_max_ofdm; - u16 auto_corr_max_ofdm_mrc; - u16 auto_corr_max_ofdm_x1; - u16 auto_corr_max_ofdm_mrc_x1; - - u16 auto_corr_max_cck; - u16 auto_corr_max_cck_mrc; - u16 auto_corr_min_cck; - u16 auto_corr_min_cck_mrc; - - u16 barker_corr_th_min; - u16 barker_corr_th_min_mrc; - u16 nrg_th_cca; -}; - -#define KELVIN_TO_CELSIUS(x) ((x)-273) -#define CELSIUS_TO_KELVIN(x) ((x)+273) - -/** - * struct il_hw_params - * @bcast_id: f/w broadcast station ID - * @max_txq_num: Max # Tx queues supported - * @dma_chnl_num: Number of Tx DMA/FIFO channels - * @scd_bc_tbls_size: size of scheduler byte count tables - * @tfd_size: TFD size - * @tx/rx_chains_num: Number of TX/RX chains - * @valid_tx/rx_ant: usable antennas - * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2) - * @max_rxq_log: Log-base-2 of max_rxq_size - * @rx_page_order: Rx buffer page order - * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR - * @max_stations: - * @ht40_channel: is 40MHz width possible in band 2.4 - * BIT(IEEE80211_BAND_5GHZ) BIT(IEEE80211_BAND_5GHZ) - * @sw_crypto: 0 for hw, 1 for sw - * @max_xxx_size: for ucode uses - * @ct_kill_threshold: temperature threshold - * @beacon_time_tsf_bits: number of valid tsf bits for beacon time - * @struct il_sensitivity_ranges: range of sensitivity values - */ -struct il_hw_params { - u8 bcast_id; - u8 max_txq_num; - u8 dma_chnl_num; - u16 scd_bc_tbls_size; - u32 tfd_size; - u8 tx_chains_num; - u8 rx_chains_num; - u8 valid_tx_ant; - u8 valid_rx_ant; - u16 max_rxq_size; - u16 max_rxq_log; - u32 rx_page_order; - u32 rx_wrt_ptr_reg; - u8 max_stations; - u8 ht40_channel; - u8 max_beacon_itrvl; /* in 1024 ms */ - u32 max_inst_size; - u32 max_data_size; - u32 max_bsm_size; - u32 ct_kill_threshold; /* value in hw-dependent units */ - u16 beacon_time_tsf_bits; - const struct il_sensitivity_ranges *sens; -}; - -/****************************************************************************** - * - * Functions implemented in core module which are forward declared here - * for use by iwl-[4-5].c - * - * NOTE: The implementation of these functions are not hardware specific - * which is why they are in the core module files. - * - * Naming convention -- - * il_ <-- Is part of iwlwifi - * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) - * il4965_bg_ <-- Called from work queue context - * il4965_mac_ <-- mac80211 callback - * - ****************************************************************************/ -extern void il4965_update_chain_flags(struct il_priv *il); -extern const u8 il_bcast_addr[ETH_ALEN]; -extern int il_queue_space(const struct il_queue *q); -static inline int -il_queue_used(const struct il_queue *q, int i) -{ - return q->write_ptr >= q->read_ptr ? (i >= q->read_ptr && - i < q->write_ptr) : !(i < - q->read_ptr - && i >= - q-> - write_ptr); -} - -static inline u8 -il_get_cmd_idx(struct il_queue *q, u32 idx, int is_huge) -{ - /* - * This is for init calibration result and scan command which - * required buffer > TFD_MAX_PAYLOAD_SIZE, - * the big buffer at end of command array - */ - if (is_huge) - return q->n_win; /* must be power of 2 */ - - /* Otherwise, use normal size buffers */ - return idx & (q->n_win - 1); -} - -struct il_dma_ptr { - dma_addr_t dma; - void *addr; - size_t size; -}; - -#define IL_OPERATION_MODE_AUTO 0 -#define IL_OPERATION_MODE_HT_ONLY 1 -#define IL_OPERATION_MODE_MIXED 2 -#define IL_OPERATION_MODE_20MHZ 3 - -#define IL_TX_CRC_SIZE 4 -#define IL_TX_DELIMITER_SIZE 4 - -#define TX_POWER_IL_ILLEGAL_VOLTAGE -10000 - -/* Sensitivity and chain noise calibration */ -#define INITIALIZATION_VALUE 0xFFFF -#define IL4965_CAL_NUM_BEACONS 20 -#define IL_CAL_NUM_BEACONS 16 -#define MAXIMUM_ALLOWED_PATHLOSS 15 - -#define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3 - -#define MAX_FA_OFDM 50 -#define MIN_FA_OFDM 5 -#define MAX_FA_CCK 50 -#define MIN_FA_CCK 5 - -#define AUTO_CORR_STEP_OFDM 1 - -#define AUTO_CORR_STEP_CCK 3 -#define AUTO_CORR_MAX_TH_CCK 160 - -#define NRG_DIFF 2 -#define NRG_STEP_CCK 2 -#define NRG_MARGIN 8 -#define MAX_NUMBER_CCK_NO_FA 100 - -#define AUTO_CORR_CCK_MIN_VAL_DEF (125) - -#define CHAIN_A 0 -#define CHAIN_B 1 -#define CHAIN_C 2 -#define CHAIN_NOISE_DELTA_GAIN_INIT_VAL 4 -#define ALL_BAND_FILTER 0xFF00 -#define IN_BAND_FILTER 0xFF -#define MIN_AVERAGE_NOISE_MAX_VALUE 0xFFFFFFFF - -#define NRG_NUM_PREV_STAT_L 20 -#define NUM_RX_CHAINS 3 - -enum il4965_false_alarm_state { - IL_FA_TOO_MANY = 0, - IL_FA_TOO_FEW = 1, - IL_FA_GOOD_RANGE = 2, -}; - -enum il4965_chain_noise_state { - IL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */ - IL_CHAIN_NOISE_ACCUMULATE, - IL_CHAIN_NOISE_CALIBRATED, - IL_CHAIN_NOISE_DONE, -}; - -enum ucode_type { - UCODE_NONE = 0, - UCODE_INIT, - UCODE_RT -}; - -/* Sensitivity calib data */ -struct il_sensitivity_data { - u32 auto_corr_ofdm; - u32 auto_corr_ofdm_mrc; - u32 auto_corr_ofdm_x1; - u32 auto_corr_ofdm_mrc_x1; - u32 auto_corr_cck; - u32 auto_corr_cck_mrc; - - u32 last_bad_plcp_cnt_ofdm; - u32 last_fa_cnt_ofdm; - u32 last_bad_plcp_cnt_cck; - u32 last_fa_cnt_cck; - - u32 nrg_curr_state; - u32 nrg_prev_state; - u32 nrg_value[10]; - u8 nrg_silence_rssi[NRG_NUM_PREV_STAT_L]; - u32 nrg_silence_ref; - u32 nrg_energy_idx; - u32 nrg_silence_idx; - u32 nrg_th_cck; - s32 nrg_auto_corr_silence_diff; - u32 num_in_cck_no_fa; - u32 nrg_th_ofdm; - - u16 barker_corr_th_min; - u16 barker_corr_th_min_mrc; - u16 nrg_th_cca; -}; - -/* Chain noise (differential Rx gain) calib data */ -struct il_chain_noise_data { - u32 active_chains; - u32 chain_noise_a; - u32 chain_noise_b; - u32 chain_noise_c; - u32 chain_signal_a; - u32 chain_signal_b; - u32 chain_signal_c; - u16 beacon_count; - u8 disconn_array[NUM_RX_CHAINS]; - u8 delta_gain_code[NUM_RX_CHAINS]; - u8 radio_write; - u8 state; -}; - -#define EEPROM_SEM_TIMEOUT 10 /* milliseconds */ -#define EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ - -#define IL_TRAFFIC_ENTRIES (256) -#define IL_TRAFFIC_ENTRY_SIZE (64) - -enum { - MEASUREMENT_READY = (1 << 0), - MEASUREMENT_ACTIVE = (1 << 1), -}; - -/* interrupt stats */ -struct isr_stats { - u32 hw; - u32 sw; - u32 err_code; - u32 sch; - u32 alive; - u32 rfkill; - u32 ctkill; - u32 wakeup; - u32 rx; - u32 handlers[IL_CN_MAX]; - u32 tx; - u32 unhandled; -}; - -/* management stats */ -enum il_mgmt_stats { - MANAGEMENT_ASSOC_REQ = 0, - MANAGEMENT_ASSOC_RESP, - MANAGEMENT_REASSOC_REQ, - MANAGEMENT_REASSOC_RESP, - MANAGEMENT_PROBE_REQ, - MANAGEMENT_PROBE_RESP, - MANAGEMENT_BEACON, - MANAGEMENT_ATIM, - MANAGEMENT_DISASSOC, - MANAGEMENT_AUTH, - MANAGEMENT_DEAUTH, - MANAGEMENT_ACTION, - MANAGEMENT_MAX, -}; -/* control stats */ -enum il_ctrl_stats { - CONTROL_BACK_REQ = 0, - CONTROL_BACK, - CONTROL_PSPOLL, - CONTROL_RTS, - CONTROL_CTS, - CONTROL_ACK, - CONTROL_CFEND, - CONTROL_CFENDACK, - CONTROL_MAX, -}; - -struct traffic_stats { -#ifdef CONFIG_IWLEGACY_DEBUGFS - u32 mgmt[MANAGEMENT_MAX]; - u32 ctrl[CONTROL_MAX]; - u32 data_cnt; - u64 data_bytes; -#endif -}; - -/* - * host interrupt timeout value - * used with setting interrupt coalescing timer - * the CSR_INT_COALESCING is an 8 bit register in 32-usec unit - * - * default interrupt coalescing timer is 64 x 32 = 2048 usecs - * default interrupt coalescing calibration timer is 16 x 32 = 512 usecs - */ -#define IL_HOST_INT_TIMEOUT_MAX (0xFF) -#define IL_HOST_INT_TIMEOUT_DEF (0x40) -#define IL_HOST_INT_TIMEOUT_MIN (0x0) -#define IL_HOST_INT_CALIB_TIMEOUT_MAX (0xFF) -#define IL_HOST_INT_CALIB_TIMEOUT_DEF (0x10) -#define IL_HOST_INT_CALIB_TIMEOUT_MIN (0x0) - -#define IL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) - -/* TX queue watchdog timeouts in mSecs */ -#define IL_DEF_WD_TIMEOUT (2000) -#define IL_LONG_WD_TIMEOUT (10000) -#define IL_MAX_WD_TIMEOUT (120000) - -struct il_force_reset { - int reset_request_count; - int reset_success_count; - int reset_reject_count; - unsigned long reset_duration; - unsigned long last_force_reset_jiffies; -}; - -/* extend beacon time format bit shifting */ -/* - * for _3945 devices - * bits 31:24 - extended - * bits 23:0 - interval - */ -#define IL3945_EXT_BEACON_TIME_POS 24 -/* - * for _4965 devices - * bits 31:22 - extended - * bits 21:0 - interval - */ -#define IL4965_EXT_BEACON_TIME_POS 22 - -struct il_rxon_context { - struct ieee80211_vif *vif; -}; - -struct il_power_mgr { - struct il_powertable_cmd sleep_cmd; - struct il_powertable_cmd sleep_cmd_next; - int debug_sleep_level_override; - bool pci_pm; -}; - -struct il_priv { - struct ieee80211_hw *hw; - struct ieee80211_channel *ieee_channels; - struct ieee80211_rate *ieee_rates; - - struct il_cfg *cfg; - const struct il_ops *ops; -#ifdef CONFIG_IWLEGACY_DEBUGFS - const struct il_debugfs_ops *debugfs_ops; -#endif - - /* temporary frame storage list */ - struct list_head free_frames; - int frames_count; - - enum ieee80211_band band; - int alloc_rxb_page; - - void (*handlers[IL_CN_MAX]) (struct il_priv *il, - struct il_rx_buf *rxb); - - struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; - - /* spectrum measurement report caching */ - struct il_spectrum_notification measure_report; - u8 measurement_status; - - /* ucode beacon time */ - u32 ucode_beacon_time; - int missed_beacon_threshold; - - /* track IBSS manager (last beacon) status */ - u32 ibss_manager; - - /* force reset */ - struct il_force_reset force_reset; - - /* we allocate array of il_channel_info for NIC's valid channels. - * Access via channel # using indirect idx array */ - struct il_channel_info *channel_info; /* channel info array */ - u8 channel_count; /* # of channels */ - - /* thermal calibration */ - s32 temperature; /* degrees Kelvin */ - s32 last_temperature; - - /* Scan related variables */ - unsigned long scan_start; - unsigned long scan_start_tsf; - void *scan_cmd; - enum ieee80211_band scan_band; - struct cfg80211_scan_request *scan_request; - struct ieee80211_vif *scan_vif; - u8 scan_tx_ant[IEEE80211_NUM_BANDS]; - u8 mgmt_tx_ant; - - /* spinlock */ - spinlock_t lock; /* protect general shared data */ - spinlock_t hcmd_lock; /* protect hcmd */ - spinlock_t reg_lock; /* protect hw register access */ - struct mutex mutex; - - /* basic pci-network driver stuff */ - struct pci_dev *pci_dev; - - /* pci hardware address support */ - void __iomem *hw_base; - u32 hw_rev; - u32 hw_wa_rev; - u8 rev_id; - - /* command queue number */ - u8 cmd_queue; - - /* max number of station keys */ - u8 sta_key_max_num; - - /* EEPROM MAC addresses */ - struct mac_address addresses[1]; - - /* uCode images, save to reload in case of failure */ - int fw_idx; /* firmware we're trying to load */ - u32 ucode_ver; /* version of ucode, copy of - il_ucode.ver */ - struct fw_desc ucode_code; /* runtime inst */ - struct fw_desc ucode_data; /* runtime data original */ - struct fw_desc ucode_data_backup; /* runtime data save/restore */ - struct fw_desc ucode_init; /* initialization inst */ - struct fw_desc ucode_init_data; /* initialization data */ - struct fw_desc ucode_boot; /* bootstrap inst */ - enum ucode_type ucode_type; - u8 ucode_write_complete; /* the image write is complete */ - char firmware_name[25]; - - struct ieee80211_vif *vif; - - struct il_qos_info qos_data; - - struct { - bool enabled; - bool is_40mhz; - bool non_gf_sta_present; - u8 protection; - u8 extension_chan_offset; - } ht; - - /* - * We declare this const so it can only be - * changed via explicit cast within the - * routines that actually update the physical - * hardware. - */ - const struct il_rxon_cmd active; - struct il_rxon_cmd staging; - - struct il_rxon_time_cmd timing; - - __le16 switch_channel; - - /* 1st responses from initialize and runtime uCode images. - * _4965's initialize alive response contains some calibration data. */ - struct il_init_alive_resp card_alive_init; - struct il_alive_resp card_alive; - - u16 active_rate; - - u8 start_calib; - struct il_sensitivity_data sensitivity_data; - struct il_chain_noise_data chain_noise_data; - __le16 sensitivity_tbl[HD_TBL_SIZE]; - - struct il_ht_config current_ht_config; - - /* Rate scaling data */ - u8 retry_rate; - - wait_queue_head_t wait_command_queue; - - int activity_timer_active; - - /* Rx and Tx DMA processing queues */ - struct il_rx_queue rxq; - struct il_tx_queue *txq; - unsigned long txq_ctx_active_msk; - struct il_dma_ptr kw; /* keep warm address */ - struct il_dma_ptr scd_bc_tbls; - - u32 scd_base_addr; /* scheduler sram base address */ - - unsigned long status; - - /* counts mgmt, ctl, and data packets */ - struct traffic_stats tx_stats; - struct traffic_stats rx_stats; - - /* counts interrupts */ - struct isr_stats isr_stats; - - struct il_power_mgr power_data; - - /* context information */ - u8 bssid[ETH_ALEN]; /* used only on 3945 but filled by core */ - - /* station table variables */ - - /* Note: if lock and sta_lock are needed, lock must be acquired first */ - spinlock_t sta_lock; - int num_stations; - struct il_station_entry stations[IL_STATION_COUNT]; - unsigned long ucode_key_table; - - /* queue refcounts */ -#define IL_MAX_HW_QUEUES 32 - unsigned long queue_stopped[BITS_TO_LONGS(IL_MAX_HW_QUEUES)]; - /* for each AC */ - atomic_t queue_stop_count[4]; - - /* Indication if ieee80211_ops->open has been called */ - u8 is_open; - - u8 mac80211_registered; - - /* eeprom -- this is in the card's little endian byte order */ - u8 *eeprom; - struct il_eeprom_calib_info *calib_info; - - enum nl80211_iftype iw_mode; - - /* Last Rx'd beacon timestamp */ - u64 timestamp; - - union { -#if defined(CONFIG_IWL3945) || defined(CONFIG_IWL3945_MODULE) - struct { - void *shared_virt; - dma_addr_t shared_phys; - - struct delayed_work thermal_periodic; - struct delayed_work rfkill_poll; - - struct il3945_notif_stats stats; -#ifdef CONFIG_IWLEGACY_DEBUGFS - struct il3945_notif_stats accum_stats; - struct il3945_notif_stats delta_stats; - struct il3945_notif_stats max_delta; -#endif - - u32 sta_supp_rates; - int last_rx_rssi; /* From Rx packet stats */ - - /* Rx'd packet timing information */ - u32 last_beacon_time; - u64 last_tsf; - - /* - * each calibration channel group in the - * EEPROM has a derived clip setting for - * each rate. - */ - const struct il3945_clip_group clip_groups[5]; - - } _3945; -#endif -#if defined(CONFIG_IWL4965) || defined(CONFIG_IWL4965_MODULE) - struct { - struct il_rx_phy_res last_phy_res; - bool last_phy_res_valid; - u32 ampdu_ref; - - struct completion firmware_loading_complete; - - /* - * chain noise reset and gain commands are the - * two extra calibration commands follows the standard - * phy calibration commands - */ - u8 phy_calib_chain_noise_reset_cmd; - u8 phy_calib_chain_noise_gain_cmd; - - u8 key_mapping_keys; - struct il_wep_key wep_keys[WEP_KEYS_MAX]; - - struct il_notif_stats stats; -#ifdef CONFIG_IWLEGACY_DEBUGFS - struct il_notif_stats accum_stats; - struct il_notif_stats delta_stats; - struct il_notif_stats max_delta; -#endif - - } _4965; -#endif - }; - - struct il_hw_params hw_params; - - u32 inta_mask; - - struct workqueue_struct *workqueue; - - struct work_struct restart; - struct work_struct scan_completed; - struct work_struct rx_replenish; - struct work_struct abort_scan; - - bool beacon_enabled; - struct sk_buff *beacon_skb; - - struct work_struct tx_flush; - - struct tasklet_struct irq_tasklet; - - struct delayed_work init_alive_start; - struct delayed_work alive_start; - struct delayed_work scan_check; - - /* TX Power */ - s8 tx_power_user_lmt; - s8 tx_power_device_lmt; - s8 tx_power_next; - -#ifdef CONFIG_IWLEGACY_DEBUG - /* debugging info */ - u32 debug_level; /* per device debugging will override global - il_debug_level if set */ -#endif /* CONFIG_IWLEGACY_DEBUG */ -#ifdef CONFIG_IWLEGACY_DEBUGFS - /* debugfs */ - u16 tx_traffic_idx; - u16 rx_traffic_idx; - u8 *tx_traffic; - u8 *rx_traffic; - struct dentry *debugfs_dir; - u32 dbgfs_sram_offset, dbgfs_sram_len; - bool disable_ht40; -#endif /* CONFIG_IWLEGACY_DEBUGFS */ - - struct work_struct txpower_work; - u32 disable_sens_cal; - u32 disable_chain_noise_cal; - u32 disable_tx_power_cal; - struct work_struct run_time_calib_work; - struct timer_list stats_periodic; - struct timer_list watchdog; - bool hw_ready; - - struct led_classdev led; - unsigned long blink_on, blink_off; - bool led_registered; -}; /*il_priv */ - -static inline void -il_txq_ctx_activate(struct il_priv *il, int txq_id) -{ - set_bit(txq_id, &il->txq_ctx_active_msk); -} - -static inline void -il_txq_ctx_deactivate(struct il_priv *il, int txq_id) -{ - clear_bit(txq_id, &il->txq_ctx_active_msk); -} - -static inline int -il_is_associated(struct il_priv *il) -{ - return (il->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; -} - -static inline int -il_is_any_associated(struct il_priv *il) -{ - return il_is_associated(il); -} - -static inline int -il_is_channel_valid(const struct il_channel_info *ch_info) -{ - if (ch_info == NULL) - return 0; - return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0; -} - -static inline int -il_is_channel_radar(const struct il_channel_info *ch_info) -{ - return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0; -} - -static inline u8 -il_is_channel_a_band(const struct il_channel_info *ch_info) -{ - return ch_info->band == IEEE80211_BAND_5GHZ; -} - -static inline int -il_is_channel_passive(const struct il_channel_info *ch) -{ - return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0; -} - -static inline int -il_is_channel_ibss(const struct il_channel_info *ch) -{ - return (ch->flags & EEPROM_CHANNEL_IBSS) ? 1 : 0; -} - -static inline void -__il_free_pages(struct il_priv *il, struct page *page) -{ - __free_pages(page, il->hw_params.rx_page_order); - il->alloc_rxb_page--; -} - -static inline void -il_free_pages(struct il_priv *il, unsigned long page) -{ - free_pages(page, il->hw_params.rx_page_order); - il->alloc_rxb_page--; -} - -#define IWLWIFI_VERSION "in-tree:" -#define DRV_COPYRIGHT "Copyright(c) 2003-2011 Intel Corporation" -#define DRV_AUTHOR "" - -#define IL_PCI_DEVICE(dev, subdev, cfg) \ - .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ - .subvendor = PCI_ANY_ID, .subdevice = (subdev), \ - .driver_data = (kernel_ulong_t)&(cfg) - -#define TIME_UNIT 1024 - -#define IL_SKU_G 0x1 -#define IL_SKU_A 0x2 -#define IL_SKU_N 0x8 - -#define IL_CMD(x) case x: return #x - -/* Size of one Rx buffer in host DRAM */ -#define IL_RX_BUF_SIZE_3K (3 * 1000) /* 3945 only */ -#define IL_RX_BUF_SIZE_4K (4 * 1024) -#define IL_RX_BUF_SIZE_8K (8 * 1024) - -#ifdef CONFIG_IWLEGACY_DEBUGFS -struct il_debugfs_ops { - ssize_t(*rx_stats_read) (struct file *file, char __user *user_buf, - size_t count, loff_t *ppos); - ssize_t(*tx_stats_read) (struct file *file, char __user *user_buf, - size_t count, loff_t *ppos); - ssize_t(*general_stats_read) (struct file *file, - char __user *user_buf, size_t count, - loff_t *ppos); -}; -#endif - -struct il_ops { - /* Handling TX */ - void (*txq_update_byte_cnt_tbl) (struct il_priv *il, - struct il_tx_queue *txq, - u16 byte_cnt); - int (*txq_attach_buf_to_tfd) (struct il_priv *il, - struct il_tx_queue *txq, dma_addr_t addr, - u16 len, u8 reset, u8 pad); - void (*txq_free_tfd) (struct il_priv *il, struct il_tx_queue *txq); - int (*txq_init) (struct il_priv *il, struct il_tx_queue *txq); - /* alive notification after init uCode load */ - void (*init_alive_start) (struct il_priv *il); - /* check validity of rtc data address */ - int (*is_valid_rtc_data_addr) (u32 addr); - /* 1st ucode load */ - int (*load_ucode) (struct il_priv *il); - - void (*dump_nic_error_log) (struct il_priv *il); - int (*dump_fh) (struct il_priv *il, char **buf, bool display); - int (*set_channel_switch) (struct il_priv *il, - struct ieee80211_channel_switch *ch_switch); - /* power management */ - int (*apm_init) (struct il_priv *il); - - /* tx power */ - int (*send_tx_power) (struct il_priv *il); - void (*update_chain_flags) (struct il_priv *il); - - /* eeprom operations */ - int (*eeprom_acquire_semaphore) (struct il_priv *il); - void (*eeprom_release_semaphore) (struct il_priv *il); - - int (*rxon_assoc) (struct il_priv *il); - int (*commit_rxon) (struct il_priv *il); - void (*set_rxon_chain) (struct il_priv *il); - - u16(*get_hcmd_size) (u8 cmd_id, u16 len); - u16(*build_addsta_hcmd) (const struct il_addsta_cmd *cmd, u8 *data); - - int (*request_scan) (struct il_priv *il, struct ieee80211_vif *vif); - void (*post_scan) (struct il_priv *il); - void (*post_associate) (struct il_priv *il); - void (*config_ap) (struct il_priv *il); - /* station management */ - int (*update_bcast_stations) (struct il_priv *il); - int (*manage_ibss_station) (struct il_priv *il, - struct ieee80211_vif *vif, bool add); - - int (*send_led_cmd) (struct il_priv *il, struct il_led_cmd *led_cmd); -}; - -struct il_mod_params { - int sw_crypto; /* def: 0 = using hardware encryption */ - int disable_hw_scan; /* def: 0 = use h/w scan */ - int num_of_queues; /* def: HW dependent */ - int disable_11n; /* def: 0 = 11n capabilities enabled */ - int amsdu_size_8K; /* def: 1 = enable 8K amsdu size */ - int antenna; /* def: 0 = both antennas (use diversity) */ - int restart_fw; /* def: 1 = restart firmware */ -}; - -#define IL_LED_SOLID 11 -#define IL_DEF_LED_INTRVL cpu_to_le32(1000) - -#define IL_LED_ACTIVITY (0<<1) -#define IL_LED_LINK (1<<1) - -/* - * LED mode - * IL_LED_DEFAULT: use device default - * IL_LED_RF_STATE: turn LED on/off based on RF state - * LED ON = RF ON - * LED OFF = RF OFF - * IL_LED_BLINK: adjust led blink rate based on blink table - */ -enum il_led_mode { - IL_LED_DEFAULT, - IL_LED_RF_STATE, - IL_LED_BLINK, -}; - -void il_leds_init(struct il_priv *il); -void il_leds_exit(struct il_priv *il); - -/** - * struct il_cfg - * @fw_name_pre: Firmware filename prefix. The api version and extension - * (.ucode) will be added to filename before loading from disk. The - * filename is constructed as fw_name_pre.ucode. - * @ucode_api_max: Highest version of uCode API supported by driver. - * @ucode_api_min: Lowest version of uCode API supported by driver. - * @scan_antennas: available antenna for scan operation - * @led_mode: 0=blinking, 1=On(RF On)/Off(RF Off) - * - * We enable the driver to be backward compatible wrt API version. The - * driver specifies which APIs it supports (with @ucode_api_max being the - * highest and @ucode_api_min the lowest). Firmware will only be loaded if - * it has a supported API version. The firmware's API version will be - * stored in @il_priv, enabling the driver to make runtime changes based - * on firmware version used. - * - * For example, - * if (IL_UCODE_API(il->ucode_ver) >= 2) { - * Driver interacts with Firmware API version >= 2. - * } else { - * Driver interacts with Firmware API version 1. - * } - * - * The ideal usage of this infrastructure is to treat a new ucode API - * release as a new hardware revision. That is, through utilizing the - * il_hcmd_utils_ops etc. we accommodate different command structures - * and flows between hardware versions as well as their API - * versions. - * - */ -struct il_cfg { - /* params specific to an individual device within a device family */ - const char *name; - const char *fw_name_pre; - const unsigned int ucode_api_max; - const unsigned int ucode_api_min; - u8 valid_tx_ant; - u8 valid_rx_ant; - unsigned int sku; - u16 eeprom_ver; - u16 eeprom_calib_ver; - /* module based parameters which can be set from modprobe cmd */ - const struct il_mod_params *mod_params; - /* params not likely to change within a device family */ - struct il_base_params *base_params; - /* params likely to change within a device family */ - u8 scan_rx_antennas[IEEE80211_NUM_BANDS]; - enum il_led_mode led_mode; - - int eeprom_size; - int num_of_queues; /* def: HW dependent */ - int num_of_ampdu_queues; /* def: HW dependent */ - /* for il_apm_init() */ - u32 pll_cfg_val; - bool set_l0s; - bool use_bsm; - - u16 led_compensation; - int chain_noise_num_beacons; - unsigned int wd_timeout; - bool temperature_kelvin; - const bool ucode_tracing; - const bool sensitivity_calib_by_driver; - const bool chain_noise_calib_by_driver; - - const u32 regulatory_bands[7]; -}; - -/*************************** - * L i b * - ***************************/ - -int il_mac_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - u16 queue, const struct ieee80211_tx_queue_params *params); -int il_mac_tx_last_beacon(struct ieee80211_hw *hw); - -void il_set_rxon_hwcrypto(struct il_priv *il, int hw_decrypt); -int il_check_rxon_cmd(struct il_priv *il); -int il_full_rxon_required(struct il_priv *il); -int il_set_rxon_channel(struct il_priv *il, struct ieee80211_channel *ch); -void il_set_flags_for_band(struct il_priv *il, enum ieee80211_band band, - struct ieee80211_vif *vif); -u8 il_get_single_channel_number(struct il_priv *il, enum ieee80211_band band); -void il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf); -bool il_is_ht40_tx_allowed(struct il_priv *il, - struct ieee80211_sta_ht_cap *ht_cap); -void il_connection_init_rx_config(struct il_priv *il); -void il_set_rate(struct il_priv *il); -int il_set_decrypted_flag(struct il_priv *il, struct ieee80211_hdr *hdr, - u32 decrypt_res, struct ieee80211_rx_status *stats); -void il_irq_handle_error(struct il_priv *il); -int il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif); -void il_mac_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif); -int il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - enum nl80211_iftype newtype, bool newp2p); -void il_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop); -int il_alloc_txq_mem(struct il_priv *il); -void il_free_txq_mem(struct il_priv *il); - -#ifdef CONFIG_IWLEGACY_DEBUGFS -extern void il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len); -#else -static inline void -il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len) -{ -} -#endif - -/***************************************************** - * Handlers - ***************************************************/ -void il_hdl_pm_sleep(struct il_priv *il, struct il_rx_buf *rxb); -void il_hdl_pm_debug_stats(struct il_priv *il, struct il_rx_buf *rxb); -void il_hdl_error(struct il_priv *il, struct il_rx_buf *rxb); -void il_hdl_csa(struct il_priv *il, struct il_rx_buf *rxb); - -/***************************************************** -* RX -******************************************************/ -void il_cmd_queue_unmap(struct il_priv *il); -void il_cmd_queue_free(struct il_priv *il); -int il_rx_queue_alloc(struct il_priv *il); -void il_rx_queue_update_write_ptr(struct il_priv *il, struct il_rx_queue *q); -int il_rx_queue_space(const struct il_rx_queue *q); -void il_tx_cmd_complete(struct il_priv *il, struct il_rx_buf *rxb); - -void il_hdl_spectrum_measurement(struct il_priv *il, struct il_rx_buf *rxb); -void il_recover_from_stats(struct il_priv *il, struct il_rx_pkt *pkt); -void il_chswitch_done(struct il_priv *il, bool is_success); - -/***************************************************** -* TX -******************************************************/ -extern void il_txq_update_write_ptr(struct il_priv *il, struct il_tx_queue *txq); -extern int il_tx_queue_init(struct il_priv *il, u32 txq_id); -extern void il_tx_queue_reset(struct il_priv *il, u32 txq_id); -extern void il_tx_queue_unmap(struct il_priv *il, int txq_id); -extern void il_tx_queue_free(struct il_priv *il, int txq_id); -extern void il_setup_watchdog(struct il_priv *il); -/***************************************************** - * TX power - ****************************************************/ -int il_set_tx_power(struct il_priv *il, s8 tx_power, bool force); - -/******************************************************************************* - * Rate - ******************************************************************************/ - -u8 il_get_lowest_plcp(struct il_priv *il); - -/******************************************************************************* - * Scanning - ******************************************************************************/ -void il_init_scan_params(struct il_priv *il); -int il_scan_cancel(struct il_priv *il); -int il_scan_cancel_timeout(struct il_priv *il, unsigned long ms); -void il_force_scan_end(struct il_priv *il); -int il_mac_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct cfg80211_scan_request *req); -void il_internal_short_hw_scan(struct il_priv *il); -int il_force_reset(struct il_priv *il, bool external); -u16 il_fill_probe_req(struct il_priv *il, struct ieee80211_mgmt *frame, - const u8 *ta, const u8 *ie, int ie_len, int left); -void il_setup_rx_scan_handlers(struct il_priv *il); -u16 il_get_active_dwell_time(struct il_priv *il, enum ieee80211_band band, - u8 n_probes); -u16 il_get_passive_dwell_time(struct il_priv *il, enum ieee80211_band band, - struct ieee80211_vif *vif); -void il_setup_scan_deferred_work(struct il_priv *il); -void il_cancel_scan_deferred_work(struct il_priv *il); - -/* For faster active scanning, scan will move to the next channel if fewer than - * PLCP_QUIET_THRESH packets are heard on this channel within - * ACTIVE_QUIET_TIME after sending probe request. This shortens the dwell - * time if it's a quiet channel (nothing responded to our probe, and there's - * no other traffic). - * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */ -#define IL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */ -#define IL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */ - -#define IL_SCAN_CHECK_WATCHDOG (HZ * 7) - -/***************************************************** - * S e n d i n g H o s t C o m m a n d s * - *****************************************************/ - -const char *il_get_cmd_string(u8 cmd); -int __must_check il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd); -int il_send_cmd(struct il_priv *il, struct il_host_cmd *cmd); -int __must_check il_send_cmd_pdu(struct il_priv *il, u8 id, u16 len, - const void *data); -int il_send_cmd_pdu_async(struct il_priv *il, u8 id, u16 len, const void *data, - void (*callback) (struct il_priv *il, - struct il_device_cmd *cmd, - struct il_rx_pkt *pkt)); - -int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd); - -/***************************************************** - * PCI * - *****************************************************/ - -void il_bg_watchdog(unsigned long data); -u32 il_usecs_to_beacons(struct il_priv *il, u32 usec, u32 beacon_interval); -__le32 il_add_beacon_time(struct il_priv *il, u32 base, u32 addon, - u32 beacon_interval); - -#ifdef CONFIG_PM_SLEEP -extern const struct dev_pm_ops il_pm_ops; - -#define IL_LEGACY_PM_OPS (&il_pm_ops) - -#else /* !CONFIG_PM_SLEEP */ - -#define IL_LEGACY_PM_OPS NULL - -#endif /* !CONFIG_PM_SLEEP */ - -/***************************************************** -* Error Handling Debugging -******************************************************/ -void il4965_dump_nic_error_log(struct il_priv *il); -#ifdef CONFIG_IWLEGACY_DEBUG -void il_print_rx_config_cmd(struct il_priv *il); -#else -static inline void -il_print_rx_config_cmd(struct il_priv *il) -{ -} -#endif - -void il_clear_isr_stats(struct il_priv *il); - -/***************************************************** -* GEOS -******************************************************/ -int il_init_geos(struct il_priv *il); -void il_free_geos(struct il_priv *il); - -/*************** DRIVER STATUS FUNCTIONS *****/ - -#define S_HCMD_ACTIVE 0 /* host command in progress */ -/* 1 is unused (used to be S_HCMD_SYNC_ACTIVE) */ -#define S_INT_ENABLED 2 -#define S_RFKILL 3 -#define S_CT_KILL 4 -#define S_INIT 5 -#define S_ALIVE 6 -#define S_READY 7 -#define S_TEMPERATURE 8 -#define S_GEO_CONFIGURED 9 -#define S_EXIT_PENDING 10 -#define S_STATS 12 -#define S_SCANNING 13 -#define S_SCAN_ABORTING 14 -#define S_SCAN_HW 15 -#define S_POWER_PMI 16 -#define S_FW_ERROR 17 -#define S_CHANNEL_SWITCH_PENDING 18 - -static inline int -il_is_ready(struct il_priv *il) -{ - /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are - * set but EXIT_PENDING is not */ - return test_bit(S_READY, &il->status) && - test_bit(S_GEO_CONFIGURED, &il->status) && - !test_bit(S_EXIT_PENDING, &il->status); -} - -static inline int -il_is_alive(struct il_priv *il) -{ - return test_bit(S_ALIVE, &il->status); -} - -static inline int -il_is_init(struct il_priv *il) -{ - return test_bit(S_INIT, &il->status); -} - -static inline int -il_is_rfkill(struct il_priv *il) -{ - return test_bit(S_RFKILL, &il->status); -} - -static inline int -il_is_ctkill(struct il_priv *il) -{ - return test_bit(S_CT_KILL, &il->status); -} - -static inline int -il_is_ready_rf(struct il_priv *il) -{ - - if (il_is_rfkill(il)) - return 0; - - return il_is_ready(il); -} - -extern void il_send_bt_config(struct il_priv *il); -extern int il_send_stats_request(struct il_priv *il, u8 flags, bool clear); -extern void il_apm_stop(struct il_priv *il); -extern void _il_apm_stop(struct il_priv *il); - -int il_apm_init(struct il_priv *il); - -int il_send_rxon_timing(struct il_priv *il); - -static inline int -il_send_rxon_assoc(struct il_priv *il) -{ - return il->ops->rxon_assoc(il); -} - -static inline int -il_commit_rxon(struct il_priv *il) -{ - return il->ops->commit_rxon(il); -} - -static inline const struct ieee80211_supported_band * -il_get_hw_mode(struct il_priv *il, enum ieee80211_band band) -{ - return il->hw->wiphy->bands[band]; -} - -/* mac80211 handlers */ -int il_mac_config(struct ieee80211_hw *hw, u32 changed); -void il_mac_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif); -void il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, u32 changes); -void il_tx_cmd_protection(struct il_priv *il, struct ieee80211_tx_info *info, - __le16 fc, __le32 *tx_flags); - -irqreturn_t il_isr(int irq, void *data); - -extern void il_set_bit(struct il_priv *p, u32 r, u32 m); -extern void il_clear_bit(struct il_priv *p, u32 r, u32 m); -extern bool _il_grab_nic_access(struct il_priv *il); -extern int _il_poll_bit(struct il_priv *il, u32 addr, u32 bits, u32 mask, int timeout); -extern int il_poll_bit(struct il_priv *il, u32 addr, u32 mask, int timeout); -extern u32 il_rd_prph(struct il_priv *il, u32 reg); -extern void il_wr_prph(struct il_priv *il, u32 addr, u32 val); -extern u32 il_read_targ_mem(struct il_priv *il, u32 addr); -extern void il_write_targ_mem(struct il_priv *il, u32 addr, u32 val); - -static inline void -_il_write8(struct il_priv *il, u32 ofs, u8 val) -{ - writeb(val, il->hw_base + ofs); -} -#define il_write8(il, ofs, val) _il_write8(il, ofs, val) - -static inline void -_il_wr(struct il_priv *il, u32 ofs, u32 val) -{ - writel(val, il->hw_base + ofs); -} - -static inline u32 -_il_rd(struct il_priv *il, u32 ofs) -{ - return readl(il->hw_base + ofs); -} - -static inline void -_il_clear_bit(struct il_priv *il, u32 reg, u32 mask) -{ - _il_wr(il, reg, _il_rd(il, reg) & ~mask); -} - -static inline void -_il_set_bit(struct il_priv *il, u32 reg, u32 mask) -{ - _il_wr(il, reg, _il_rd(il, reg) | mask); -} - -static inline void -_il_release_nic_access(struct il_priv *il) -{ - _il_clear_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - /* - * In above we are reading CSR_GP_CNTRL register, what will flush any - * previous writes, but still want write, which clear MAC_ACCESS_REQ - * bit, be performed on PCI bus before any other writes scheduled on - * different CPUs (after we drop reg_lock). - */ - mmiowb(); -} - -static inline u32 -il_rd(struct il_priv *il, u32 reg) -{ - u32 value; - unsigned long reg_flags; - - spin_lock_irqsave(&il->reg_lock, reg_flags); - _il_grab_nic_access(il); - value = _il_rd(il, reg); - _il_release_nic_access(il); - spin_unlock_irqrestore(&il->reg_lock, reg_flags); - return value; -} - -static inline void -il_wr(struct il_priv *il, u32 reg, u32 value) -{ - unsigned long reg_flags; - - spin_lock_irqsave(&il->reg_lock, reg_flags); - if (likely(_il_grab_nic_access(il))) { - _il_wr(il, reg, value); - _il_release_nic_access(il); - } - spin_unlock_irqrestore(&il->reg_lock, reg_flags); -} - -static inline u32 -_il_rd_prph(struct il_priv *il, u32 reg) -{ - _il_wr(il, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); - return _il_rd(il, HBUS_TARG_PRPH_RDAT); -} - -static inline void -_il_wr_prph(struct il_priv *il, u32 addr, u32 val) -{ - _il_wr(il, HBUS_TARG_PRPH_WADDR, ((addr & 0x0000FFFF) | (3 << 24))); - _il_wr(il, HBUS_TARG_PRPH_WDAT, val); -} - -static inline void -il_set_bits_prph(struct il_priv *il, u32 reg, u32 mask) -{ - unsigned long reg_flags; - - spin_lock_irqsave(&il->reg_lock, reg_flags); - if (likely(_il_grab_nic_access(il))) { - _il_wr_prph(il, reg, (_il_rd_prph(il, reg) | mask)); - _il_release_nic_access(il); - } - spin_unlock_irqrestore(&il->reg_lock, reg_flags); -} - -static inline void -il_set_bits_mask_prph(struct il_priv *il, u32 reg, u32 bits, u32 mask) -{ - unsigned long reg_flags; - - spin_lock_irqsave(&il->reg_lock, reg_flags); - if (likely(_il_grab_nic_access(il))) { - _il_wr_prph(il, reg, ((_il_rd_prph(il, reg) & mask) | bits)); - _il_release_nic_access(il); - } - spin_unlock_irqrestore(&il->reg_lock, reg_flags); -} - -static inline void -il_clear_bits_prph(struct il_priv *il, u32 reg, u32 mask) -{ - unsigned long reg_flags; - u32 val; - - spin_lock_irqsave(&il->reg_lock, reg_flags); - if (likely(_il_grab_nic_access(il))) { - val = _il_rd_prph(il, reg); - _il_wr_prph(il, reg, (val & ~mask)); - _il_release_nic_access(il); - } - spin_unlock_irqrestore(&il->reg_lock, reg_flags); -} - -#define HW_KEY_DYNAMIC 0 -#define HW_KEY_DEFAULT 1 - -#define IL_STA_DRIVER_ACTIVE BIT(0) /* driver entry is active */ -#define IL_STA_UCODE_ACTIVE BIT(1) /* ucode entry is active */ -#define IL_STA_UCODE_INPROGRESS BIT(2) /* ucode entry is in process of - being activated */ -#define IL_STA_LOCAL BIT(3) /* station state not directed by mac80211; - (this is for the IBSS BSSID stations) */ -#define IL_STA_BCAST BIT(4) /* this station is the special bcast station */ - -void il_restore_stations(struct il_priv *il); -void il_clear_ucode_stations(struct il_priv *il); -void il_dealloc_bcast_stations(struct il_priv *il); -int il_get_free_ucode_key_idx(struct il_priv *il); -int il_send_add_sta(struct il_priv *il, struct il_addsta_cmd *sta, u8 flags); -int il_add_station_common(struct il_priv *il, const u8 *addr, bool is_ap, - struct ieee80211_sta *sta, u8 *sta_id_r); -int il_remove_station(struct il_priv *il, const u8 sta_id, const u8 * addr); -int il_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); - -u8 il_prep_station(struct il_priv *il, const u8 *addr, bool is_ap, - struct ieee80211_sta *sta); - -int il_send_lq_cmd(struct il_priv *il, struct il_link_quality_cmd *lq, - u8 flags, bool init); - -/** - * il_clear_driver_stations - clear knowledge of all stations from driver - * @il: iwl il struct - * - * This is called during il_down() to make sure that in the case - * we're coming there from a hardware restart mac80211 will be - * able to reconfigure stations -- if we're getting there in the - * normal down flow then the stations will already be cleared. - */ -static inline void -il_clear_driver_stations(struct il_priv *il) -{ - unsigned long flags; - - spin_lock_irqsave(&il->sta_lock, flags); - memset(il->stations, 0, sizeof(il->stations)); - il->num_stations = 0; - il->ucode_key_table = 0; - spin_unlock_irqrestore(&il->sta_lock, flags); -} - -static inline int -il_sta_id(struct ieee80211_sta *sta) -{ - if (WARN_ON(!sta)) - return IL_INVALID_STATION; - - return ((struct il_station_priv_common *)sta->drv_priv)->sta_id; -} - -/** - * il_sta_id_or_broadcast - return sta_id or broadcast sta - * @il: iwl il - * @context: the current context - * @sta: mac80211 station - * - * In certain circumstances mac80211 passes a station pointer - * that may be %NULL, for example during TX or key setup. In - * that case, we need to use the broadcast station, so this - * inline wraps that pattern. - */ -static inline int -il_sta_id_or_broadcast(struct il_priv *il, struct ieee80211_sta *sta) -{ - int sta_id; - - if (!sta) - return il->hw_params.bcast_id; - - sta_id = il_sta_id(sta); - - /* - * mac80211 should not be passing a partially - * initialised station! - */ - WARN_ON(sta_id == IL_INVALID_STATION); - - return sta_id; -} - -/** - * il_queue_inc_wrap - increment queue idx, wrap back to beginning - * @idx -- current idx - * @n_bd -- total number of entries in queue (must be power of 2) - */ -static inline int -il_queue_inc_wrap(int idx, int n_bd) -{ - return ++idx & (n_bd - 1); -} - -/** - * il_queue_dec_wrap - decrement queue idx, wrap back to end - * @idx -- current idx - * @n_bd -- total number of entries in queue (must be power of 2) - */ -static inline int -il_queue_dec_wrap(int idx, int n_bd) -{ - return --idx & (n_bd - 1); -} - -/* TODO: Move fw_desc functions to iwl-pci.ko */ -static inline void -il_free_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc) -{ - if (desc->v_addr) - dma_free_coherent(&pci_dev->dev, desc->len, desc->v_addr, - desc->p_addr); - desc->v_addr = NULL; - desc->len = 0; -} - -static inline int -il_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc) -{ - if (!desc->len) { - desc->v_addr = NULL; - return -EINVAL; - } - - desc->v_addr = dma_alloc_coherent(&pci_dev->dev, desc->len, - &desc->p_addr, GFP_KERNEL); - return (desc->v_addr != NULL) ? 0 : -ENOMEM; -} - -/* - * we have 8 bits used like this: - * - * 7 6 5 4 3 2 1 0 - * | | | | | | | | - * | | | | | | +-+-------- AC queue (0-3) - * | | | | | | - * | +-+-+-+-+------------ HW queue ID - * | - * +---------------------- unused - */ -static inline void -il_set_swq_id(struct il_tx_queue *txq, u8 ac, u8 hwq) -{ - BUG_ON(ac > 3); /* only have 2 bits */ - BUG_ON(hwq > 31); /* only use 5 bits */ - - txq->swq_id = (hwq << 2) | ac; -} - -static inline void -il_wake_queue(struct il_priv *il, struct il_tx_queue *txq) -{ - u8 queue = txq->swq_id; - u8 ac = queue & 3; - u8 hwq = (queue >> 2) & 0x1f; - - if (test_and_clear_bit(hwq, il->queue_stopped)) - if (atomic_dec_return(&il->queue_stop_count[ac]) <= 0) - ieee80211_wake_queue(il->hw, ac); -} - -static inline void -il_stop_queue(struct il_priv *il, struct il_tx_queue *txq) -{ - u8 queue = txq->swq_id; - u8 ac = queue & 3; - u8 hwq = (queue >> 2) & 0x1f; - - if (!test_and_set_bit(hwq, il->queue_stopped)) - if (atomic_inc_return(&il->queue_stop_count[ac]) > 0) - ieee80211_stop_queue(il->hw, ac); -} - -#ifdef ieee80211_stop_queue -#undef ieee80211_stop_queue -#endif - -#define ieee80211_stop_queue DO_NOT_USE_ieee80211_stop_queue - -#ifdef ieee80211_wake_queue -#undef ieee80211_wake_queue -#endif - -#define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue - -static inline void -il_disable_interrupts(struct il_priv *il) -{ - clear_bit(S_INT_ENABLED, &il->status); - - /* disable interrupts from uCode/NIC to host */ - _il_wr(il, CSR_INT_MASK, 0x00000000); - - /* acknowledge/clear/reset any interrupts still pending - * from uCode or flow handler (Rx/Tx DMA) */ - _il_wr(il, CSR_INT, 0xffffffff); - _il_wr(il, CSR_FH_INT_STATUS, 0xffffffff); -} - -static inline void -il_enable_rfkill_int(struct il_priv *il) -{ - _il_wr(il, CSR_INT_MASK, CSR_INT_BIT_RF_KILL); -} - -static inline void -il_enable_interrupts(struct il_priv *il) -{ - set_bit(S_INT_ENABLED, &il->status); - _il_wr(il, CSR_INT_MASK, il->inta_mask); -} - -/** - * il_beacon_time_mask_low - mask of lower 32 bit of beacon time - * @il -- pointer to il_priv data structure - * @tsf_bits -- number of bits need to shift for masking) - */ -static inline u32 -il_beacon_time_mask_low(struct il_priv *il, u16 tsf_bits) -{ - return (1 << tsf_bits) - 1; -} - -/** - * il_beacon_time_mask_high - mask of higher 32 bit of beacon time - * @il -- pointer to il_priv data structure - * @tsf_bits -- number of bits need to shift for masking) - */ -static inline u32 -il_beacon_time_mask_high(struct il_priv *il, u16 tsf_bits) -{ - return ((1 << (32 - tsf_bits)) - 1) << tsf_bits; -} - -/** - * struct il_rb_status - reseve buffer status host memory mapped FH registers - * - * @closed_rb_num [0:11] - Indicates the idx of the RB which was closed - * @closed_fr_num [0:11] - Indicates the idx of the RX Frame which was closed - * @finished_rb_num [0:11] - Indicates the idx of the current RB - * in which the last frame was written to - * @finished_fr_num [0:11] - Indicates the idx of the RX Frame - * which was transferred - */ -struct il_rb_status { - __le16 closed_rb_num; - __le16 closed_fr_num; - __le16 finished_rb_num; - __le16 finished_fr_nam; - __le32 __unused; /* 3945 only */ -} __packed; - -#define TFD_QUEUE_SIZE_MAX 256 -#define TFD_QUEUE_SIZE_BC_DUP 64 -#define TFD_QUEUE_BC_SIZE (TFD_QUEUE_SIZE_MAX + TFD_QUEUE_SIZE_BC_DUP) -#define IL_TX_DMA_MASK DMA_BIT_MASK(36) -#define IL_NUM_OF_TBS 20 - -static inline u8 -il_get_dma_hi_addr(dma_addr_t addr) -{ - return (sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0) & 0xF; -} - -/** - * struct il_tfd_tb transmit buffer descriptor within transmit frame descriptor - * - * This structure contains dma address and length of transmission address - * - * @lo: low [31:0] portion of the dma address of TX buffer every even is - * unaligned on 16 bit boundary - * @hi_n_len: 0-3 [35:32] portion of dma - * 4-15 length of the tx buffer - */ -struct il_tfd_tb { - __le32 lo; - __le16 hi_n_len; -} __packed; - -/** - * struct il_tfd - * - * Transmit Frame Descriptor (TFD) - * - * @ __reserved1[3] reserved - * @ num_tbs 0-4 number of active tbs - * 5 reserved - * 6-7 padding (not used) - * @ tbs[20] transmit frame buffer descriptors - * @ __pad padding - * - * Each Tx queue uses a circular buffer of 256 TFDs stored in host DRAM. - * Both driver and device share these circular buffers, each of which must be - * contiguous 256 TFDs x 128 bytes-per-TFD = 32 KBytes - * - * Driver must indicate the physical address of the base of each - * circular buffer via the FH49_MEM_CBBC_QUEUE registers. - * - * Each TFD contains pointer/size information for up to 20 data buffers - * in host DRAM. These buffers collectively contain the (one) frame described - * by the TFD. Each buffer must be a single contiguous block of memory within - * itself, but buffers may be scattered in host DRAM. Each buffer has max size - * of (4K - 4). The concatenates all of a TFD's buffers into a single - * Tx frame, up to 8 KBytes in size. - * - * A maximum of 255 (not 256!) TFDs may be on a queue waiting for Tx. - */ -struct il_tfd { - u8 __reserved1[3]; - u8 num_tbs; - struct il_tfd_tb tbs[IL_NUM_OF_TBS]; - __le32 __pad; -} __packed; -/* PCI registers */ -#define PCI_CFG_RETRY_TIMEOUT 0x041 - -struct il_rate_info { - u8 plcp; /* uCode API: RATE_6M_PLCP, etc. */ - u8 plcp_siso; /* uCode API: RATE_SISO_6M_PLCP, etc. */ - u8 plcp_mimo2; /* uCode API: RATE_MIMO2_6M_PLCP, etc. */ - u8 ieee; /* MAC header: RATE_6M_IEEE, etc. */ - u8 prev_ieee; /* previous rate in IEEE speeds */ - u8 next_ieee; /* next rate in IEEE speeds */ - u8 prev_rs; /* previous rate used in rs algo */ - u8 next_rs; /* next rate used in rs algo */ - u8 prev_rs_tgg; /* previous rate used in TGG rs algo */ - u8 next_rs_tgg; /* next rate used in TGG rs algo */ -}; - -struct il3945_rate_info { - u8 plcp; /* uCode API: RATE_6M_PLCP, etc. */ - u8 ieee; /* MAC header: RATE_6M_IEEE, etc. */ - u8 prev_ieee; /* previous rate in IEEE speeds */ - u8 next_ieee; /* next rate in IEEE speeds */ - u8 prev_rs; /* previous rate used in rs algo */ - u8 next_rs; /* next rate used in rs algo */ - u8 prev_rs_tgg; /* previous rate used in TGG rs algo */ - u8 next_rs_tgg; /* next rate used in TGG rs algo */ - u8 table_rs_idx; /* idx in rate scale table cmd */ - u8 prev_table_rs; /* prev in rate table cmd */ -}; - -/* - * These serve as idxes into - * struct il_rate_info il_rates[RATE_COUNT]; - */ -enum { - RATE_1M_IDX = 0, - RATE_2M_IDX, - RATE_5M_IDX, - RATE_11M_IDX, - RATE_6M_IDX, - RATE_9M_IDX, - RATE_12M_IDX, - RATE_18M_IDX, - RATE_24M_IDX, - RATE_36M_IDX, - RATE_48M_IDX, - RATE_54M_IDX, - RATE_60M_IDX, - RATE_COUNT, - RATE_COUNT_LEGACY = RATE_COUNT - 1, /* Excluding 60M */ - RATE_COUNT_3945 = RATE_COUNT - 1, - RATE_INVM_IDX = RATE_COUNT, - RATE_INVALID = RATE_COUNT, -}; - -enum { - RATE_6M_IDX_TBL = 0, - RATE_9M_IDX_TBL, - RATE_12M_IDX_TBL, - RATE_18M_IDX_TBL, - RATE_24M_IDX_TBL, - RATE_36M_IDX_TBL, - RATE_48M_IDX_TBL, - RATE_54M_IDX_TBL, - RATE_1M_IDX_TBL, - RATE_2M_IDX_TBL, - RATE_5M_IDX_TBL, - RATE_11M_IDX_TBL, - RATE_INVM_IDX_TBL = RATE_INVM_IDX - 1, -}; - -enum { - IL_FIRST_OFDM_RATE = RATE_6M_IDX, - IL39_LAST_OFDM_RATE = RATE_54M_IDX, - IL_LAST_OFDM_RATE = RATE_60M_IDX, - IL_FIRST_CCK_RATE = RATE_1M_IDX, - IL_LAST_CCK_RATE = RATE_11M_IDX, -}; - -/* #define vs. enum to keep from defaulting to 'large integer' */ -#define RATE_6M_MASK (1 << RATE_6M_IDX) -#define RATE_9M_MASK (1 << RATE_9M_IDX) -#define RATE_12M_MASK (1 << RATE_12M_IDX) -#define RATE_18M_MASK (1 << RATE_18M_IDX) -#define RATE_24M_MASK (1 << RATE_24M_IDX) -#define RATE_36M_MASK (1 << RATE_36M_IDX) -#define RATE_48M_MASK (1 << RATE_48M_IDX) -#define RATE_54M_MASK (1 << RATE_54M_IDX) -#define RATE_60M_MASK (1 << RATE_60M_IDX) -#define RATE_1M_MASK (1 << RATE_1M_IDX) -#define RATE_2M_MASK (1 << RATE_2M_IDX) -#define RATE_5M_MASK (1 << RATE_5M_IDX) -#define RATE_11M_MASK (1 << RATE_11M_IDX) - -/* uCode API values for legacy bit rates, both OFDM and CCK */ -enum { - RATE_6M_PLCP = 13, - RATE_9M_PLCP = 15, - RATE_12M_PLCP = 5, - RATE_18M_PLCP = 7, - RATE_24M_PLCP = 9, - RATE_36M_PLCP = 11, - RATE_48M_PLCP = 1, - RATE_54M_PLCP = 3, - RATE_60M_PLCP = 3, /*FIXME:RS:should be removed */ - RATE_1M_PLCP = 10, - RATE_2M_PLCP = 20, - RATE_5M_PLCP = 55, - RATE_11M_PLCP = 110, - /*FIXME:RS:add RATE_LEGACY_INVM_PLCP = 0, */ -}; - -/* uCode API values for OFDM high-throughput (HT) bit rates */ -enum { - RATE_SISO_6M_PLCP = 0, - RATE_SISO_12M_PLCP = 1, - RATE_SISO_18M_PLCP = 2, - RATE_SISO_24M_PLCP = 3, - RATE_SISO_36M_PLCP = 4, - RATE_SISO_48M_PLCP = 5, - RATE_SISO_54M_PLCP = 6, - RATE_SISO_60M_PLCP = 7, - RATE_MIMO2_6M_PLCP = 0x8, - RATE_MIMO2_12M_PLCP = 0x9, - RATE_MIMO2_18M_PLCP = 0xa, - RATE_MIMO2_24M_PLCP = 0xb, - RATE_MIMO2_36M_PLCP = 0xc, - RATE_MIMO2_48M_PLCP = 0xd, - RATE_MIMO2_54M_PLCP = 0xe, - RATE_MIMO2_60M_PLCP = 0xf, - RATE_SISO_INVM_PLCP, - RATE_MIMO2_INVM_PLCP = RATE_SISO_INVM_PLCP, -}; - -/* MAC header values for bit rates */ -enum { - RATE_6M_IEEE = 12, - RATE_9M_IEEE = 18, - RATE_12M_IEEE = 24, - RATE_18M_IEEE = 36, - RATE_24M_IEEE = 48, - RATE_36M_IEEE = 72, - RATE_48M_IEEE = 96, - RATE_54M_IEEE = 108, - RATE_60M_IEEE = 120, - RATE_1M_IEEE = 2, - RATE_2M_IEEE = 4, - RATE_5M_IEEE = 11, - RATE_11M_IEEE = 22, -}; - -#define IL_CCK_BASIC_RATES_MASK \ - (RATE_1M_MASK | \ - RATE_2M_MASK) - -#define IL_CCK_RATES_MASK \ - (IL_CCK_BASIC_RATES_MASK | \ - RATE_5M_MASK | \ - RATE_11M_MASK) - -#define IL_OFDM_BASIC_RATES_MASK \ - (RATE_6M_MASK | \ - RATE_12M_MASK | \ - RATE_24M_MASK) - -#define IL_OFDM_RATES_MASK \ - (IL_OFDM_BASIC_RATES_MASK | \ - RATE_9M_MASK | \ - RATE_18M_MASK | \ - RATE_36M_MASK | \ - RATE_48M_MASK | \ - RATE_54M_MASK) - -#define IL_BASIC_RATES_MASK \ - (IL_OFDM_BASIC_RATES_MASK | \ - IL_CCK_BASIC_RATES_MASK) - -#define RATES_MASK ((1 << RATE_COUNT) - 1) -#define RATES_MASK_3945 ((1 << RATE_COUNT_3945) - 1) - -#define IL_INVALID_VALUE -1 - -#define IL_MIN_RSSI_VAL -100 -#define IL_MAX_RSSI_VAL 0 - -/* These values specify how many Tx frame attempts before - * searching for a new modulation mode */ -#define IL_LEGACY_FAILURE_LIMIT 160 -#define IL_LEGACY_SUCCESS_LIMIT 480 -#define IL_LEGACY_TBL_COUNT 160 - -#define IL_NONE_LEGACY_FAILURE_LIMIT 400 -#define IL_NONE_LEGACY_SUCCESS_LIMIT 4500 -#define IL_NONE_LEGACY_TBL_COUNT 1500 - -/* Success ratio (ACKed / attempted tx frames) values (perfect is 128 * 100) */ -#define IL_RS_GOOD_RATIO 12800 /* 100% */ -#define RATE_SCALE_SWITCH 10880 /* 85% */ -#define RATE_HIGH_TH 10880 /* 85% */ -#define RATE_INCREASE_TH 6400 /* 50% */ -#define RATE_DECREASE_TH 1920 /* 15% */ - -/* possible actions when in legacy mode */ -#define IL_LEGACY_SWITCH_ANTENNA1 0 -#define IL_LEGACY_SWITCH_ANTENNA2 1 -#define IL_LEGACY_SWITCH_SISO 2 -#define IL_LEGACY_SWITCH_MIMO2_AB 3 -#define IL_LEGACY_SWITCH_MIMO2_AC 4 -#define IL_LEGACY_SWITCH_MIMO2_BC 5 - -/* possible actions when in siso mode */ -#define IL_SISO_SWITCH_ANTENNA1 0 -#define IL_SISO_SWITCH_ANTENNA2 1 -#define IL_SISO_SWITCH_MIMO2_AB 2 -#define IL_SISO_SWITCH_MIMO2_AC 3 -#define IL_SISO_SWITCH_MIMO2_BC 4 -#define IL_SISO_SWITCH_GI 5 - -/* possible actions when in mimo mode */ -#define IL_MIMO2_SWITCH_ANTENNA1 0 -#define IL_MIMO2_SWITCH_ANTENNA2 1 -#define IL_MIMO2_SWITCH_SISO_A 2 -#define IL_MIMO2_SWITCH_SISO_B 3 -#define IL_MIMO2_SWITCH_SISO_C 4 -#define IL_MIMO2_SWITCH_GI 5 - -#define IL_MAX_SEARCH IL_MIMO2_SWITCH_GI - -#define IL_ACTION_LIMIT 3 /* # possible actions */ - -#define LQ_SIZE 2 /* 2 mode tables: "Active" and "Search" */ - -/* load per tid defines for A-MPDU activation */ -#define IL_AGG_TPT_THREHOLD 0 -#define IL_AGG_LOAD_THRESHOLD 10 -#define IL_AGG_ALL_TID 0xff -#define TID_QUEUE_CELL_SPACING 50 /*mS */ -#define TID_QUEUE_MAX_SIZE 20 -#define TID_ROUND_VALUE 5 /* mS */ -#define TID_MAX_LOAD_COUNT 8 - -#define TID_MAX_TIME_DIFF ((TID_QUEUE_MAX_SIZE - 1) * TID_QUEUE_CELL_SPACING) -#define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y)) - -extern const struct il_rate_info il_rates[RATE_COUNT]; - -enum il_table_type { - LQ_NONE, - LQ_G, /* legacy types */ - LQ_A, - LQ_SISO, /* high-throughput types */ - LQ_MIMO2, - LQ_MAX, -}; - -#define is_legacy(tbl) ((tbl) == LQ_G || (tbl) == LQ_A) -#define is_siso(tbl) ((tbl) == LQ_SISO) -#define is_mimo2(tbl) ((tbl) == LQ_MIMO2) -#define is_mimo(tbl) (is_mimo2(tbl)) -#define is_Ht(tbl) (is_siso(tbl) || is_mimo(tbl)) -#define is_a_band(tbl) ((tbl) == LQ_A) -#define is_g_and(tbl) ((tbl) == LQ_G) - -#define ANT_NONE 0x0 -#define ANT_A BIT(0) -#define ANT_B BIT(1) -#define ANT_AB (ANT_A | ANT_B) -#define ANT_C BIT(2) -#define ANT_AC (ANT_A | ANT_C) -#define ANT_BC (ANT_B | ANT_C) -#define ANT_ABC (ANT_AB | ANT_C) - -#define IL_MAX_MCS_DISPLAY_SIZE 12 - -struct il_rate_mcs_info { - char mbps[IL_MAX_MCS_DISPLAY_SIZE]; - char mcs[IL_MAX_MCS_DISPLAY_SIZE]; -}; - -/** - * struct il_rate_scale_data -- tx success history for one rate - */ -struct il_rate_scale_data { - u64 data; /* bitmap of successful frames */ - s32 success_counter; /* number of frames successful */ - s32 success_ratio; /* per-cent * 128 */ - s32 counter; /* number of frames attempted */ - s32 average_tpt; /* success ratio * expected throughput */ - unsigned long stamp; -}; - -/** - * struct il_scale_tbl_info -- tx params and success history for all rates - * - * There are two of these in struct il_lq_sta, - * one for "active", and one for "search". - */ -struct il_scale_tbl_info { - enum il_table_type lq_type; - u8 ant_type; - u8 is_SGI; /* 1 = short guard interval */ - u8 is_ht40; /* 1 = 40 MHz channel width */ - u8 is_dup; /* 1 = duplicated data streams */ - u8 action; /* change modulation; IL_[LEGACY/SISO/MIMO]_SWITCH_* */ - u8 max_search; /* maximun number of tables we can search */ - s32 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */ - u32 current_rate; /* rate_n_flags, uCode API format */ - struct il_rate_scale_data win[RATE_COUNT]; /* rate histories */ -}; - -struct il_traffic_load { - unsigned long time_stamp; /* age of the oldest stats */ - u32 packet_count[TID_QUEUE_MAX_SIZE]; /* packet count in this time - * slice */ - u32 total; /* total num of packets during the - * last TID_MAX_TIME_DIFF */ - u8 queue_count; /* number of queues that has - * been used since the last cleanup */ - u8 head; /* start of the circular buffer */ -}; - -/** - * struct il_lq_sta -- driver's rate scaling ilate structure - * - * Pointer to this gets passed back and forth between driver and mac80211. - */ -struct il_lq_sta { - u8 active_tbl; /* idx of active table, range 0-1 */ - u8 enable_counter; /* indicates HT mode */ - u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */ - u8 search_better_tbl; /* 1: currently trying alternate mode */ - s32 last_tpt; - - /* The following determine when to search for a new mode */ - u32 table_count_limit; - u32 max_failure_limit; /* # failed frames before new search */ - u32 max_success_limit; /* # successful frames before new search */ - u32 table_count; - u32 total_failed; /* total failed frames, any/all rates */ - u32 total_success; /* total successful frames, any/all rates */ - u64 flush_timer; /* time staying in mode before new search */ - - u8 action_counter; /* # mode-switch actions tried */ - u8 is_green; - u8 is_dup; - enum ieee80211_band band; - - /* The following are bitmaps of rates; RATE_6M_MASK, etc. */ - u32 supp_rates; - u16 active_legacy_rate; - u16 active_siso_rate; - u16 active_mimo2_rate; - s8 max_rate_idx; /* Max rate set by user */ - u8 missed_rate_counter; - - struct il_link_quality_cmd lq; - struct il_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ - struct il_traffic_load load[TID_MAX_LOAD_COUNT]; - u8 tx_agg_tid_en; -#ifdef CONFIG_MAC80211_DEBUGFS - struct dentry *rs_sta_dbgfs_scale_table_file; - struct dentry *rs_sta_dbgfs_stats_table_file; - struct dentry *rs_sta_dbgfs_rate_scale_data_file; - struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file; - u32 dbg_fixed_rate; -#endif - struct il_priv *drv; - - /* used to be in sta_info */ - int last_txrate_idx; - /* last tx rate_n_flags */ - u32 last_rate_n_flags; - /* packets destined for this STA are aggregated */ - u8 is_agg; -}; - -/* - * il_station_priv: Driver's ilate station information - * - * When mac80211 creates a station it reserves some space (hw->sta_data_size) - * in the structure for use by driver. This structure is places in that - * space. - * - * The common struct MUST be first because it is shared between - * 3945 and 4965! - */ -struct il_station_priv { - struct il_station_priv_common common; - struct il_lq_sta lq_sta; - atomic_t pending_frames; - bool client; - bool asleep; -}; - -static inline u8 -il4965_num_of_ant(u8 m) -{ - return !!(m & ANT_A) + !!(m & ANT_B) + !!(m & ANT_C); -} - -static inline u8 -il4965_first_antenna(u8 mask) -{ - if (mask & ANT_A) - return ANT_A; - if (mask & ANT_B) - return ANT_B; - return ANT_C; -} - -/** - * il3945_rate_scale_init - Initialize the rate scale table based on assoc info - * - * The specific throughput table used is based on the type of network - * the associated with, including A, B, G, and G w/ TGG protection - */ -extern void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id); - -/* Initialize station's rate scaling information after adding station */ -extern void il4965_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, - u8 sta_id); -extern void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, - u8 sta_id); - -/** - * il_rate_control_register - Register the rate control algorithm callbacks - * - * Since the rate control algorithm is hardware specific, there is no need - * or reason to place it as a stand alone module. The driver can call - * il_rate_control_register in order to register the rate control callbacks - * with the mac80211 subsystem. This should be performed prior to calling - * ieee80211_register_hw - * - */ -extern int il4965_rate_control_register(void); -extern int il3945_rate_control_register(void); - -/** - * il_rate_control_unregister - Unregister the rate control callbacks - * - * This should be called after calling ieee80211_unregister_hw, but before - * the driver is unloaded. - */ -extern void il4965_rate_control_unregister(void); -extern void il3945_rate_control_unregister(void); - -extern int il_power_update_mode(struct il_priv *il, bool force); -extern void il_power_initialize(struct il_priv *il); - -extern u32 il_debug_level; - -#ifdef CONFIG_IWLEGACY_DEBUG -/* - * il_get_debug_level: Return active debug level for device - * - * Using sysfs it is possible to set per device debug level. This debug - * level will be used if set, otherwise the global debug level which can be - * set via module parameter is used. - */ -static inline u32 -il_get_debug_level(struct il_priv *il) -{ - if (il->debug_level) - return il->debug_level; - else - return il_debug_level; -} -#else -static inline u32 -il_get_debug_level(struct il_priv *il) -{ - return il_debug_level; -} -#endif - -#define il_print_hex_error(il, p, len) \ -do { \ - print_hex_dump(KERN_ERR, "iwl data: ", \ - DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ -} while (0) - -#ifdef CONFIG_IWLEGACY_DEBUG -#define IL_DBG(level, fmt, args...) \ -do { \ - if (il_get_debug_level(il) & level) \ - dev_err(&il->hw->wiphy->dev, "%c %s " fmt, \ - in_interrupt() ? 'I' : 'U', __func__ , ##args); \ -} while (0) - -#define il_print_hex_dump(il, level, p, len) \ -do { \ - if (il_get_debug_level(il) & level) \ - print_hex_dump(KERN_DEBUG, "iwl data: ", \ - DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ -} while (0) - -#else -#define IL_DBG(level, fmt, args...) -static inline void -il_print_hex_dump(struct il_priv *il, int level, const void *p, u32 len) -{ -} -#endif /* CONFIG_IWLEGACY_DEBUG */ - -#ifdef CONFIG_IWLEGACY_DEBUGFS -int il_dbgfs_register(struct il_priv *il, const char *name); -void il_dbgfs_unregister(struct il_priv *il); -#else -static inline int -il_dbgfs_register(struct il_priv *il, const char *name) -{ - return 0; -} - -static inline void -il_dbgfs_unregister(struct il_priv *il) -{ -} -#endif /* CONFIG_IWLEGACY_DEBUGFS */ - -/* - * To use the debug system: - * - * If you are defining a new debug classification, simply add it to the #define - * list here in the form of - * - * #define IL_DL_xxxx VALUE - * - * where xxxx should be the name of the classification (for example, WEP). - * - * You then need to either add a IL_xxxx_DEBUG() macro definition for your - * classification, or use IL_DBG(IL_DL_xxxx, ...) whenever you want - * to send output to that classification. - * - * The active debug levels can be accessed via files - * - * /sys/module/iwl4965/parameters/debug - * /sys/module/iwl3945/parameters/debug - * /sys/class/net/wlan0/device/debug_level - * - * when CONFIG_IWLEGACY_DEBUG=y. - */ - -/* 0x0000000F - 0x00000001 */ -#define IL_DL_INFO (1 << 0) -#define IL_DL_MAC80211 (1 << 1) -#define IL_DL_HCMD (1 << 2) -#define IL_DL_STATE (1 << 3) -/* 0x000000F0 - 0x00000010 */ -#define IL_DL_MACDUMP (1 << 4) -#define IL_DL_HCMD_DUMP (1 << 5) -#define IL_DL_EEPROM (1 << 6) -#define IL_DL_RADIO (1 << 7) -/* 0x00000F00 - 0x00000100 */ -#define IL_DL_POWER (1 << 8) -#define IL_DL_TEMP (1 << 9) -#define IL_DL_NOTIF (1 << 10) -#define IL_DL_SCAN (1 << 11) -/* 0x0000F000 - 0x00001000 */ -#define IL_DL_ASSOC (1 << 12) -#define IL_DL_DROP (1 << 13) -#define IL_DL_TXPOWER (1 << 14) -#define IL_DL_AP (1 << 15) -/* 0x000F0000 - 0x00010000 */ -#define IL_DL_FW (1 << 16) -#define IL_DL_RF_KILL (1 << 17) -#define IL_DL_FW_ERRORS (1 << 18) -#define IL_DL_LED (1 << 19) -/* 0x00F00000 - 0x00100000 */ -#define IL_DL_RATE (1 << 20) -#define IL_DL_CALIB (1 << 21) -#define IL_DL_WEP (1 << 22) -#define IL_DL_TX (1 << 23) -/* 0x0F000000 - 0x01000000 */ -#define IL_DL_RX (1 << 24) -#define IL_DL_ISR (1 << 25) -#define IL_DL_HT (1 << 26) -/* 0xF0000000 - 0x10000000 */ -#define IL_DL_11H (1 << 28) -#define IL_DL_STATS (1 << 29) -#define IL_DL_TX_REPLY (1 << 30) -#define IL_DL_QOS (1 << 31) - -#define D_INFO(f, a...) IL_DBG(IL_DL_INFO, f, ## a) -#define D_MAC80211(f, a...) IL_DBG(IL_DL_MAC80211, f, ## a) -#define D_MACDUMP(f, a...) IL_DBG(IL_DL_MACDUMP, f, ## a) -#define D_TEMP(f, a...) IL_DBG(IL_DL_TEMP, f, ## a) -#define D_SCAN(f, a...) IL_DBG(IL_DL_SCAN, f, ## a) -#define D_RX(f, a...) IL_DBG(IL_DL_RX, f, ## a) -#define D_TX(f, a...) IL_DBG(IL_DL_TX, f, ## a) -#define D_ISR(f, a...) IL_DBG(IL_DL_ISR, f, ## a) -#define D_LED(f, a...) IL_DBG(IL_DL_LED, f, ## a) -#define D_WEP(f, a...) IL_DBG(IL_DL_WEP, f, ## a) -#define D_HC(f, a...) IL_DBG(IL_DL_HCMD, f, ## a) -#define D_HC_DUMP(f, a...) IL_DBG(IL_DL_HCMD_DUMP, f, ## a) -#define D_EEPROM(f, a...) IL_DBG(IL_DL_EEPROM, f, ## a) -#define D_CALIB(f, a...) IL_DBG(IL_DL_CALIB, f, ## a) -#define D_FW(f, a...) IL_DBG(IL_DL_FW, f, ## a) -#define D_RF_KILL(f, a...) IL_DBG(IL_DL_RF_KILL, f, ## a) -#define D_DROP(f, a...) IL_DBG(IL_DL_DROP, f, ## a) -#define D_AP(f, a...) IL_DBG(IL_DL_AP, f, ## a) -#define D_TXPOWER(f, a...) IL_DBG(IL_DL_TXPOWER, f, ## a) -#define D_RATE(f, a...) IL_DBG(IL_DL_RATE, f, ## a) -#define D_NOTIF(f, a...) IL_DBG(IL_DL_NOTIF, f, ## a) -#define D_ASSOC(f, a...) IL_DBG(IL_DL_ASSOC, f, ## a) -#define D_HT(f, a...) IL_DBG(IL_DL_HT, f, ## a) -#define D_STATS(f, a...) IL_DBG(IL_DL_STATS, f, ## a) -#define D_TX_REPLY(f, a...) IL_DBG(IL_DL_TX_REPLY, f, ## a) -#define D_QOS(f, a...) IL_DBG(IL_DL_QOS, f, ## a) -#define D_RADIO(f, a...) IL_DBG(IL_DL_RADIO, f, ## a) -#define D_POWER(f, a...) IL_DBG(IL_DL_POWER, f, ## a) -#define D_11H(f, a...) IL_DBG(IL_DL_11H, f, ## a) - -#endif /* __il_core_h__ */ diff --git a/drivers/net/wireless/iwlegacy/csr.h b/drivers/net/wireless/iwlegacy/csr.h deleted file mode 100644 index 9138e15004fa..000000000000 --- a/drivers/net/wireless/iwlegacy/csr.h +++ /dev/null @@ -1,419 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2005 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called LICENSE.GPL. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#ifndef __il_csr_h__ -#define __il_csr_h__ -/* - * CSR (control and status registers) - * - * CSR registers are mapped directly into PCI bus space, and are accessible - * whenever platform supplies power to device, even when device is in - * low power states due to driver-invoked device resets - * (e.g. CSR_RESET_REG_FLAG_SW_RESET) or uCode-driven power-saving modes. - * - * Use _il_wr() and _il_rd() family to access these registers; - * these provide simple PCI bus access, without waking up the MAC. - * Do not use il_wr() family for these registers; - * no need to "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ. - * The MAC (uCode processor, etc.) does not need to be powered up for accessing - * the CSR registers. - * - * NOTE: Device does need to be awake in order to read this memory - * via CSR_EEPROM register - */ -#define CSR_BASE (0x000) - -#define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */ -#define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */ -#define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */ -#define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */ -#define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack */ -#define CSR_GPIO_IN (CSR_BASE+0x018) /* read external chip pins */ -#define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc */ -#define CSR_GP_CNTRL (CSR_BASE+0x024) - -/* 2nd byte of CSR_INT_COALESCING, not accessible via _il_wr()! */ -#define CSR_INT_PERIODIC_REG (CSR_BASE+0x005) - -/* - * Hardware revision info - * Bit fields: - * 31-8: Reserved - * 7-4: Type of device: see CSR_HW_REV_TYPE_xxx definitions - * 3-2: Revision step: 0 = A, 1 = B, 2 = C, 3 = D - * 1-0: "Dash" (-) value, as in A-1, etc. - * - * NOTE: Revision step affects calculation of CCK txpower for 4965. - * NOTE: See also CSR_HW_REV_WA_REG (work-around for bug in 4965). - */ -#define CSR_HW_REV (CSR_BASE+0x028) - -/* - * EEPROM memory reads - * - * NOTE: Device must be awake, initialized via apm_ops.init(), - * in order to read. - */ -#define CSR_EEPROM_REG (CSR_BASE+0x02c) -#define CSR_EEPROM_GP (CSR_BASE+0x030) - -#define CSR_GIO_REG (CSR_BASE+0x03C) -#define CSR_GP_UCODE_REG (CSR_BASE+0x048) -#define CSR_GP_DRIVER_REG (CSR_BASE+0x050) - -/* - * UCODE-DRIVER GP (general purpose) mailbox registers. - * SET/CLR registers set/clear bit(s) if "1" is written. - */ -#define CSR_UCODE_DRV_GP1 (CSR_BASE+0x054) -#define CSR_UCODE_DRV_GP1_SET (CSR_BASE+0x058) -#define CSR_UCODE_DRV_GP1_CLR (CSR_BASE+0x05c) -#define CSR_UCODE_DRV_GP2 (CSR_BASE+0x060) - -#define CSR_LED_REG (CSR_BASE+0x094) -#define CSR_DRAM_INT_TBL_REG (CSR_BASE+0x0A0) - -/* GIO Chicken Bits (PCI Express bus link power management) */ -#define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100) - -/* Analog phase-lock-loop configuration */ -#define CSR_ANA_PLL_CFG (CSR_BASE+0x20c) - -/* - * CSR Hardware Revision Workaround Register. Indicates hardware rev; - * "step" determines CCK backoff for txpower calculation. Used for 4965 only. - * See also CSR_HW_REV register. - * Bit fields: - * 3-2: 0 = A, 1 = B, 2 = C, 3 = D step - * 1-0: "Dash" (-) value, as in C-1, etc. - */ -#define CSR_HW_REV_WA_REG (CSR_BASE+0x22C) - -#define CSR_DBG_HPET_MEM_REG (CSR_BASE+0x240) -#define CSR_DBG_LINK_PWR_MGMT_REG (CSR_BASE+0x250) - -/* Bits for CSR_HW_IF_CONFIG_REG */ -#define CSR49_HW_IF_CONFIG_REG_BIT_4965_R (0x00000010) -#define CSR_HW_IF_CONFIG_REG_MSK_BOARD_VER (0x00000C00) -#define CSR_HW_IF_CONFIG_REG_BIT_MAC_SI (0x00000100) -#define CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI (0x00000200) - -#define CSR39_HW_IF_CONFIG_REG_BIT_3945_MB (0x00000100) -#define CSR39_HW_IF_CONFIG_REG_BIT_3945_MM (0x00000200) -#define CSR39_HW_IF_CONFIG_REG_BIT_SKU_MRC (0x00000400) -#define CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE (0x00000800) -#define CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A (0x00000000) -#define CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B (0x00001000) - -#define CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A (0x00080000) -#define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000) -#define CSR_HW_IF_CONFIG_REG_BIT_NIC_READY (0x00400000) /* PCI_OWN_SEM */ -#define CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE (0x02000000) /* ME_OWN */ -#define CSR_HW_IF_CONFIG_REG_PREPARE (0x08000000) /* WAKE_ME */ - -#define CSR_INT_PERIODIC_DIS (0x00) /* disable periodic int */ -#define CSR_INT_PERIODIC_ENA (0xFF) /* 255*32 usec ~ 8 msec */ - -/* interrupt flags in INTA, set by uCode or hardware (e.g. dma), - * acknowledged (reset) by host writing "1" to flagged bits. */ -#define CSR_INT_BIT_FH_RX (1 << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */ -#define CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */ -#define CSR_INT_BIT_RX_PERIODIC (1 << 28) /* Rx periodic */ -#define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */ -#define CSR_INT_BIT_SCD (1 << 26) /* TXQ pointer advanced */ -#define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */ -#define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */ -#define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */ -#define CSR_INT_BIT_SW_RX (1 << 3) /* Rx, command responses, 3945 */ -#define CSR_INT_BIT_WAKEUP (1 << 1) /* NIC controller waking up (pwr mgmt) */ -#define CSR_INT_BIT_ALIVE (1 << 0) /* uCode interrupts once it initializes */ - -#define CSR_INI_SET_MASK (CSR_INT_BIT_FH_RX | \ - CSR_INT_BIT_HW_ERR | \ - CSR_INT_BIT_FH_TX | \ - CSR_INT_BIT_SW_ERR | \ - CSR_INT_BIT_RF_KILL | \ - CSR_INT_BIT_SW_RX | \ - CSR_INT_BIT_WAKEUP | \ - CSR_INT_BIT_ALIVE) - -/* interrupt flags in FH (flow handler) (PCI busmaster DMA) */ -#define CSR_FH_INT_BIT_ERR (1 << 31) /* Error */ -#define CSR_FH_INT_BIT_HI_PRIOR (1 << 30) /* High priority Rx, bypass coalescing */ -#define CSR39_FH_INT_BIT_RX_CHNL2 (1 << 18) /* Rx channel 2 (3945 only) */ -#define CSR_FH_INT_BIT_RX_CHNL1 (1 << 17) /* Rx channel 1 */ -#define CSR_FH_INT_BIT_RX_CHNL0 (1 << 16) /* Rx channel 0 */ -#define CSR39_FH_INT_BIT_TX_CHNL6 (1 << 6) /* Tx channel 6 (3945 only) */ -#define CSR_FH_INT_BIT_TX_CHNL1 (1 << 1) /* Tx channel 1 */ -#define CSR_FH_INT_BIT_TX_CHNL0 (1 << 0) /* Tx channel 0 */ - -#define CSR39_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \ - CSR39_FH_INT_BIT_RX_CHNL2 | \ - CSR_FH_INT_BIT_RX_CHNL1 | \ - CSR_FH_INT_BIT_RX_CHNL0) - -#define CSR39_FH_INT_TX_MASK (CSR39_FH_INT_BIT_TX_CHNL6 | \ - CSR_FH_INT_BIT_TX_CHNL1 | \ - CSR_FH_INT_BIT_TX_CHNL0) - -#define CSR49_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \ - CSR_FH_INT_BIT_RX_CHNL1 | \ - CSR_FH_INT_BIT_RX_CHNL0) - -#define CSR49_FH_INT_TX_MASK (CSR_FH_INT_BIT_TX_CHNL1 | \ - CSR_FH_INT_BIT_TX_CHNL0) - -/* GPIO */ -#define CSR_GPIO_IN_BIT_AUX_POWER (0x00000200) -#define CSR_GPIO_IN_VAL_VAUX_PWR_SRC (0x00000000) -#define CSR_GPIO_IN_VAL_VMAIN_PWR_SRC (0x00000200) - -/* RESET */ -#define CSR_RESET_REG_FLAG_NEVO_RESET (0x00000001) -#define CSR_RESET_REG_FLAG_FORCE_NMI (0x00000002) -#define CSR_RESET_REG_FLAG_SW_RESET (0x00000080) -#define CSR_RESET_REG_FLAG_MASTER_DISABLED (0x00000100) -#define CSR_RESET_REG_FLAG_STOP_MASTER (0x00000200) -#define CSR_RESET_LINK_PWR_MGMT_DISABLED (0x80000000) - -/* - * GP (general purpose) CONTROL REGISTER - * Bit fields: - * 27: HW_RF_KILL_SW - * Indicates state of (platform's) hardware RF-Kill switch - * 26-24: POWER_SAVE_TYPE - * Indicates current power-saving mode: - * 000 -- No power saving - * 001 -- MAC power-down - * 010 -- PHY (radio) power-down - * 011 -- Error - * 9-6: SYS_CONFIG - * Indicates current system configuration, reflecting pins on chip - * as forced high/low by device circuit board. - * 4: GOING_TO_SLEEP - * Indicates MAC is entering a power-saving sleep power-down. - * Not a good time to access device-internal resources. - * 3: MAC_ACCESS_REQ - * Host sets this to request and maintain MAC wakeup, to allow host - * access to device-internal resources. Host must wait for - * MAC_CLOCK_READY (and !GOING_TO_SLEEP) before accessing non-CSR - * device registers. - * 2: INIT_DONE - * Host sets this to put device into fully operational D0 power mode. - * Host resets this after SW_RESET to put device into low power mode. - * 0: MAC_CLOCK_READY - * Indicates MAC (ucode processor, etc.) is powered up and can run. - * Internal resources are accessible. - * NOTE: This does not indicate that the processor is actually running. - * NOTE: This does not indicate that 4965 or 3945 has completed - * init or post-power-down restore of internal SRAM memory. - * Use CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP as indication that - * SRAM is restored and uCode is in normal operation mode. - * Later devices (5xxx/6xxx/1xxx) use non-volatile SRAM, and - * do not need to save/restore it. - * NOTE: After device reset, this bit remains "0" until host sets - * INIT_DONE - */ -#define CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY (0x00000001) -#define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004) -#define CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ (0x00000008) -#define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010) - -#define CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN (0x00000001) - -#define CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x07000000) -#define CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000) -#define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000) - -/* EEPROM REG */ -#define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001) -#define CSR_EEPROM_REG_BIT_CMD (0x00000002) -#define CSR_EEPROM_REG_MSK_ADDR (0x0000FFFC) -#define CSR_EEPROM_REG_MSK_DATA (0xFFFF0000) - -/* EEPROM GP */ -#define CSR_EEPROM_GP_VALID_MSK (0x00000007) /* signature */ -#define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180) -#define CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K (0x00000002) -#define CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K (0x00000004) - -/* GP REG */ -#define CSR_GP_REG_POWER_SAVE_STATUS_MSK (0x03000000) /* bit 24/25 */ -#define CSR_GP_REG_NO_POWER_SAVE (0x00000000) -#define CSR_GP_REG_MAC_POWER_SAVE (0x01000000) -#define CSR_GP_REG_PHY_POWER_SAVE (0x02000000) -#define CSR_GP_REG_POWER_SAVE_ERROR (0x03000000) - -/* CSR GIO */ -#define CSR_GIO_REG_VAL_L0S_ENABLED (0x00000002) - -/* - * UCODE-DRIVER GP (general purpose) mailbox register 1 - * Host driver and uCode write and/or read this register to communicate with - * each other. - * Bit fields: - * 4: UCODE_DISABLE - * Host sets this to request permanent halt of uCode, same as - * sending CARD_STATE command with "halt" bit set. - * 3: CT_KILL_EXIT - * Host sets this to request exit from CT_KILL state, i.e. host thinks - * device temperature is low enough to continue normal operation. - * 2: CMD_BLOCKED - * Host sets this during RF KILL power-down sequence (HW, SW, CT KILL) - * to release uCode to clear all Tx and command queues, enter - * unassociated mode, and power down. - * NOTE: Some devices also use HBUS_TARG_MBX_C register for this bit. - * 1: SW_BIT_RFKILL - * Host sets this when issuing CARD_STATE command to request - * device sleep. - * 0: MAC_SLEEP - * uCode sets this when preparing a power-saving power-down. - * uCode resets this when power-up is complete and SRAM is sane. - * NOTE: 3945/4965 saves internal SRAM data to host when powering down, - * and must restore this data after powering back up. - * MAC_SLEEP is the best indication that restore is complete. - * Later devices (5xxx/6xxx/1xxx) use non-volatile SRAM, and - * do not need to save/restore it. - */ -#define CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP (0x00000001) -#define CSR_UCODE_SW_BIT_RFKILL (0x00000002) -#define CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED (0x00000004) -#define CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT (0x00000008) - -/* GIO Chicken Bits (PCI Express bus link power management) */ -#define CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000) -#define CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER (0x20000000) - -/* LED */ -#define CSR_LED_BSM_CTRL_MSK (0xFFFFFFDF) -#define CSR_LED_REG_TRUN_ON (0x78) -#define CSR_LED_REG_TRUN_OFF (0x38) - -/* ANA_PLL */ -#define CSR39_ANA_PLL_CFG_VAL (0x01000000) - -/* HPET MEM debug */ -#define CSR_DBG_HPET_MEM_REG_VAL (0xFFFF0000) - -/* DRAM INT TBL */ -#define CSR_DRAM_INT_TBL_ENABLE (1 << 31) -#define CSR_DRAM_INIT_TBL_WRAP_CHECK (1 << 27) - -/* - * HBUS (Host-side Bus) - * - * HBUS registers are mapped directly into PCI bus space, but are used - * to indirectly access device's internal memory or registers that - * may be powered-down. - * - * Use il_wr()/il_rd() family - * for these registers; - * host must "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ - * to make sure the MAC (uCode processor, etc.) is powered up for accessing - * internal resources. - * - * Do not use _il_wr()/_il_rd() family to access these registers; - * these provide only simple PCI bus access, without waking up the MAC. - */ -#define HBUS_BASE (0x400) - -/* - * Registers for accessing device's internal SRAM memory (e.g. SCD SRAM - * structures, error log, event log, verifying uCode load). - * First write to address register, then read from or write to data register - * to complete the job. Once the address register is set up, accesses to - * data registers auto-increment the address by one dword. - * Bit usage for address registers (read or write): - * 0-31: memory address within device - */ -#define HBUS_TARG_MEM_RADDR (HBUS_BASE+0x00c) -#define HBUS_TARG_MEM_WADDR (HBUS_BASE+0x010) -#define HBUS_TARG_MEM_WDAT (HBUS_BASE+0x018) -#define HBUS_TARG_MEM_RDAT (HBUS_BASE+0x01c) - -/* Mailbox C, used as workaround alternative to CSR_UCODE_DRV_GP1 mailbox */ -#define HBUS_TARG_MBX_C (HBUS_BASE+0x030) -#define HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED (0x00000004) - -/* - * Registers for accessing device's internal peripheral registers - * (e.g. SCD, BSM, etc.). First write to address register, - * then read from or write to data register to complete the job. - * Bit usage for address registers (read or write): - * 0-15: register address (offset) within device - * 24-25: (# bytes - 1) to read or write (e.g. 3 for dword) - */ -#define HBUS_TARG_PRPH_WADDR (HBUS_BASE+0x044) -#define HBUS_TARG_PRPH_RADDR (HBUS_BASE+0x048) -#define HBUS_TARG_PRPH_WDAT (HBUS_BASE+0x04c) -#define HBUS_TARG_PRPH_RDAT (HBUS_BASE+0x050) - -/* - * Per-Tx-queue write pointer (idx, really!) - * Indicates idx to next TFD that driver will fill (1 past latest filled). - * Bit usage: - * 0-7: queue write idx - * 11-8: queue selector - */ -#define HBUS_TARG_WRPTR (HBUS_BASE+0x060) - -#endif /* !__il_csr_h__ */ diff --git a/drivers/net/wireless/iwlegacy/debug.c b/drivers/net/wireless/iwlegacy/debug.c deleted file mode 100644 index eff26501d60a..000000000000 --- a/drivers/net/wireless/iwlegacy/debug.c +++ /dev/null @@ -1,1430 +0,0 @@ -/****************************************************************************** - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called LICENSE.GPL. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - *****************************************************************************/ -#include -#include -#include - -#include "common.h" - -void -il_clear_traffic_stats(struct il_priv *il) -{ - memset(&il->tx_stats, 0, sizeof(struct traffic_stats)); - memset(&il->rx_stats, 0, sizeof(struct traffic_stats)); -} - -/* - * il_update_stats function record all the MGMT, CTRL and DATA pkt for - * both TX and Rx . Use debugfs to display the rx/rx_stats - */ -void -il_update_stats(struct il_priv *il, bool is_tx, __le16 fc, u16 len) -{ - struct traffic_stats *stats; - - if (is_tx) - stats = &il->tx_stats; - else - stats = &il->rx_stats; - - if (ieee80211_is_mgmt(fc)) { - switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) { - case cpu_to_le16(IEEE80211_STYPE_ASSOC_REQ): - stats->mgmt[MANAGEMENT_ASSOC_REQ]++; - break; - case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP): - stats->mgmt[MANAGEMENT_ASSOC_RESP]++; - break; - case cpu_to_le16(IEEE80211_STYPE_REASSOC_REQ): - stats->mgmt[MANAGEMENT_REASSOC_REQ]++; - break; - case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP): - stats->mgmt[MANAGEMENT_REASSOC_RESP]++; - break; - case cpu_to_le16(IEEE80211_STYPE_PROBE_REQ): - stats->mgmt[MANAGEMENT_PROBE_REQ]++; - break; - case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP): - stats->mgmt[MANAGEMENT_PROBE_RESP]++; - break; - case cpu_to_le16(IEEE80211_STYPE_BEACON): - stats->mgmt[MANAGEMENT_BEACON]++; - break; - case cpu_to_le16(IEEE80211_STYPE_ATIM): - stats->mgmt[MANAGEMENT_ATIM]++; - break; - case cpu_to_le16(IEEE80211_STYPE_DISASSOC): - stats->mgmt[MANAGEMENT_DISASSOC]++; - break; - case cpu_to_le16(IEEE80211_STYPE_AUTH): - stats->mgmt[MANAGEMENT_AUTH]++; - break; - case cpu_to_le16(IEEE80211_STYPE_DEAUTH): - stats->mgmt[MANAGEMENT_DEAUTH]++; - break; - case cpu_to_le16(IEEE80211_STYPE_ACTION): - stats->mgmt[MANAGEMENT_ACTION]++; - break; - } - } else if (ieee80211_is_ctl(fc)) { - switch (fc & cpu_to_le16(IEEE80211_FCTL_STYPE)) { - case cpu_to_le16(IEEE80211_STYPE_BACK_REQ): - stats->ctrl[CONTROL_BACK_REQ]++; - break; - case cpu_to_le16(IEEE80211_STYPE_BACK): - stats->ctrl[CONTROL_BACK]++; - break; - case cpu_to_le16(IEEE80211_STYPE_PSPOLL): - stats->ctrl[CONTROL_PSPOLL]++; - break; - case cpu_to_le16(IEEE80211_STYPE_RTS): - stats->ctrl[CONTROL_RTS]++; - break; - case cpu_to_le16(IEEE80211_STYPE_CTS): - stats->ctrl[CONTROL_CTS]++; - break; - case cpu_to_le16(IEEE80211_STYPE_ACK): - stats->ctrl[CONTROL_ACK]++; - break; - case cpu_to_le16(IEEE80211_STYPE_CFEND): - stats->ctrl[CONTROL_CFEND]++; - break; - case cpu_to_le16(IEEE80211_STYPE_CFENDACK): - stats->ctrl[CONTROL_CFENDACK]++; - break; - } - } else { - /* data */ - stats->data_cnt++; - stats->data_bytes += len; - } -} -EXPORT_SYMBOL(il_update_stats); - -/* create and remove of files */ -#define DEBUGFS_ADD_FILE(name, parent, mode) do { \ - if (!debugfs_create_file(#name, mode, parent, il, \ - &il_dbgfs_##name##_ops)) \ - goto err; \ -} while (0) - -#define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \ - struct dentry *__tmp; \ - __tmp = debugfs_create_bool(#name, S_IWUSR | S_IRUSR, \ - parent, ptr); \ - if (IS_ERR(__tmp) || !__tmp) \ - goto err; \ -} while (0) - -#define DEBUGFS_ADD_X32(name, parent, ptr) do { \ - struct dentry *__tmp; \ - __tmp = debugfs_create_x32(#name, S_IWUSR | S_IRUSR, \ - parent, ptr); \ - if (IS_ERR(__tmp) || !__tmp) \ - goto err; \ -} while (0) - -/* file operation */ -#define DEBUGFS_READ_FUNC(name) \ -static ssize_t il_dbgfs_##name##_read(struct file *file, \ - char __user *user_buf, \ - size_t count, loff_t *ppos); - -#define DEBUGFS_WRITE_FUNC(name) \ -static ssize_t il_dbgfs_##name##_write(struct file *file, \ - const char __user *user_buf, \ - size_t count, loff_t *ppos); - - -#define DEBUGFS_READ_FILE_OPS(name) \ - DEBUGFS_READ_FUNC(name); \ -static const struct file_operations il_dbgfs_##name##_ops = { \ - .read = il_dbgfs_##name##_read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -#define DEBUGFS_WRITE_FILE_OPS(name) \ - DEBUGFS_WRITE_FUNC(name); \ -static const struct file_operations il_dbgfs_##name##_ops = { \ - .write = il_dbgfs_##name##_write, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -#define DEBUGFS_READ_WRITE_FILE_OPS(name) \ - DEBUGFS_READ_FUNC(name); \ - DEBUGFS_WRITE_FUNC(name); \ -static const struct file_operations il_dbgfs_##name##_ops = { \ - .write = il_dbgfs_##name##_write, \ - .read = il_dbgfs_##name##_read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -static const char * -il_get_mgmt_string(int cmd) -{ - switch (cmd) { - IL_CMD(MANAGEMENT_ASSOC_REQ); - IL_CMD(MANAGEMENT_ASSOC_RESP); - IL_CMD(MANAGEMENT_REASSOC_REQ); - IL_CMD(MANAGEMENT_REASSOC_RESP); - IL_CMD(MANAGEMENT_PROBE_REQ); - IL_CMD(MANAGEMENT_PROBE_RESP); - IL_CMD(MANAGEMENT_BEACON); - IL_CMD(MANAGEMENT_ATIM); - IL_CMD(MANAGEMENT_DISASSOC); - IL_CMD(MANAGEMENT_AUTH); - IL_CMD(MANAGEMENT_DEAUTH); - IL_CMD(MANAGEMENT_ACTION); - default: - return "UNKNOWN"; - - } -} - -static const char * -il_get_ctrl_string(int cmd) -{ - switch (cmd) { - IL_CMD(CONTROL_BACK_REQ); - IL_CMD(CONTROL_BACK); - IL_CMD(CONTROL_PSPOLL); - IL_CMD(CONTROL_RTS); - IL_CMD(CONTROL_CTS); - IL_CMD(CONTROL_ACK); - IL_CMD(CONTROL_CFEND); - IL_CMD(CONTROL_CFENDACK); - default: - return "UNKNOWN"; - - } -} - -static ssize_t -il_dbgfs_tx_stats_read(struct file *file, char __user *user_buf, size_t count, - loff_t *ppos) -{ - - struct il_priv *il = file->private_data; - char *buf; - int pos = 0; - - int cnt; - ssize_t ret; - const size_t bufsz = - 100 + sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX); - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - pos += scnprintf(buf + pos, bufsz - pos, "Management:\n"); - for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) { - pos += - scnprintf(buf + pos, bufsz - pos, "\t%25s\t\t: %u\n", - il_get_mgmt_string(cnt), il->tx_stats.mgmt[cnt]); - } - pos += scnprintf(buf + pos, bufsz - pos, "Control\n"); - for (cnt = 0; cnt < CONTROL_MAX; cnt++) { - pos += - scnprintf(buf + pos, bufsz - pos, "\t%25s\t\t: %u\n", - il_get_ctrl_string(cnt), il->tx_stats.ctrl[cnt]); - } - pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); - pos += - scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", - il->tx_stats.data_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", - il->tx_stats.data_bytes); - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t -il_dbgfs_clear_traffic_stats_write(struct file *file, - const char __user *user_buf, size_t count, - loff_t *ppos) -{ - struct il_priv *il = file->private_data; - u32 clear_flag; - char buf[8]; - int buf_size; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%x", &clear_flag) != 1) - return -EFAULT; - il_clear_traffic_stats(il); - - return count; -} - -static ssize_t -il_dbgfs_rx_stats_read(struct file *file, char __user *user_buf, size_t count, - loff_t *ppos) -{ - - struct il_priv *il = file->private_data; - char *buf; - int pos = 0; - int cnt; - ssize_t ret; - const size_t bufsz = - 100 + sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX); - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - pos += scnprintf(buf + pos, bufsz - pos, "Management:\n"); - for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) { - pos += - scnprintf(buf + pos, bufsz - pos, "\t%25s\t\t: %u\n", - il_get_mgmt_string(cnt), il->rx_stats.mgmt[cnt]); - } - pos += scnprintf(buf + pos, bufsz - pos, "Control:\n"); - for (cnt = 0; cnt < CONTROL_MAX; cnt++) { - pos += - scnprintf(buf + pos, bufsz - pos, "\t%25s\t\t: %u\n", - il_get_ctrl_string(cnt), il->rx_stats.ctrl[cnt]); - } - pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); - pos += - scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", - il->rx_stats.data_cnt); - pos += - scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", - il->rx_stats.data_bytes); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -#define BYTE1_MASK 0x000000ff; -#define BYTE2_MASK 0x0000ffff; -#define BYTE3_MASK 0x00ffffff; -static ssize_t -il_dbgfs_sram_read(struct file *file, char __user *user_buf, size_t count, - loff_t *ppos) -{ - u32 val; - char *buf; - ssize_t ret; - int i; - int pos = 0; - struct il_priv *il = file->private_data; - size_t bufsz; - - /* default is to dump the entire data segment */ - if (!il->dbgfs_sram_offset && !il->dbgfs_sram_len) { - il->dbgfs_sram_offset = 0x800000; - if (il->ucode_type == UCODE_INIT) - il->dbgfs_sram_len = il->ucode_init_data.len; - else - il->dbgfs_sram_len = il->ucode_data.len; - } - bufsz = 30 + il->dbgfs_sram_len * sizeof(char) * 10; - buf = kmalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - pos += - scnprintf(buf + pos, bufsz - pos, "sram_len: 0x%x\n", - il->dbgfs_sram_len); - pos += - scnprintf(buf + pos, bufsz - pos, "sram_offset: 0x%x\n", - il->dbgfs_sram_offset); - for (i = il->dbgfs_sram_len; i > 0; i -= 4) { - val = - il_read_targ_mem(il, - il->dbgfs_sram_offset + - il->dbgfs_sram_len - i); - if (i < 4) { - switch (i) { - case 1: - val &= BYTE1_MASK; - break; - case 2: - val &= BYTE2_MASK; - break; - case 3: - val &= BYTE3_MASK; - break; - } - } - if (!(i % 16)) - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - pos += scnprintf(buf + pos, bufsz - pos, "0x%08x ", val); - } - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t -il_dbgfs_sram_write(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - char buf[64]; - int buf_size; - u32 offset, len; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - - if (sscanf(buf, "%x,%x", &offset, &len) == 2) { - il->dbgfs_sram_offset = offset; - il->dbgfs_sram_len = len; - } else { - il->dbgfs_sram_offset = 0; - il->dbgfs_sram_len = 0; - } - - return count; -} - -static ssize_t -il_dbgfs_stations_read(struct file *file, char __user *user_buf, size_t count, - loff_t *ppos) -{ - struct il_priv *il = file->private_data; - struct il_station_entry *station; - int max_sta = il->hw_params.max_stations; - char *buf; - int i, j, pos = 0; - ssize_t ret; - /* Add 30 for initial string */ - const size_t bufsz = 30 + sizeof(char) * 500 * (il->num_stations); - - buf = kmalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - pos += - scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n", - il->num_stations); - - for (i = 0; i < max_sta; i++) { - station = &il->stations[i]; - if (!station->used) - continue; - pos += - scnprintf(buf + pos, bufsz - pos, - "station %d - addr: %pM, flags: %#x\n", i, - station->sta.sta.addr, - station->sta.station_flags_msk); - pos += - scnprintf(buf + pos, bufsz - pos, - "TID\tseq_num\ttxq_id\tframes\ttfds\t"); - pos += - scnprintf(buf + pos, bufsz - pos, - "start_idx\tbitmap\t\t\trate_n_flags\n"); - - for (j = 0; j < MAX_TID_COUNT; j++) { - pos += - scnprintf(buf + pos, bufsz - pos, - "%d:\t%#x\t%#x\t%u\t%u\t%u\t\t%#.16llx\t%#x", - j, station->tid[j].seq_number, - station->tid[j].agg.txq_id, - station->tid[j].agg.frame_count, - station->tid[j].tfds_in_queue, - station->tid[j].agg.start_idx, - station->tid[j].agg.bitmap, - station->tid[j].agg.rate_n_flags); - - if (station->tid[j].agg.wait_for_ba) - pos += - scnprintf(buf + pos, bufsz - pos, - " - waitforba"); - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - } - - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - } - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t -il_dbgfs_nvm_read(struct file *file, char __user *user_buf, size_t count, - loff_t *ppos) -{ - ssize_t ret; - struct il_priv *il = file->private_data; - int pos = 0, ofs = 0, buf_size = 0; - const u8 *ptr; - char *buf; - u16 eeprom_ver; - size_t eeprom_len = il->cfg->eeprom_size; - buf_size = 4 * eeprom_len + 256; - - if (eeprom_len % 16) { - IL_ERR("NVM size is not multiple of 16.\n"); - return -ENODATA; - } - - ptr = il->eeprom; - if (!ptr) { - IL_ERR("Invalid EEPROM memory\n"); - return -ENOMEM; - } - - /* 4 characters for byte 0xYY */ - buf = kzalloc(buf_size, GFP_KERNEL); - if (!buf) { - IL_ERR("Can not allocate Buffer\n"); - return -ENOMEM; - } - eeprom_ver = il_eeprom_query16(il, EEPROM_VERSION); - pos += - scnprintf(buf + pos, buf_size - pos, "EEPROM " "version: 0x%x\n", - eeprom_ver); - for (ofs = 0; ofs < eeprom_len; ofs += 16) { - pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs); - hex_dump_to_buffer(ptr + ofs, 16, 16, 2, buf + pos, - buf_size - pos, 0); - pos += strlen(buf + pos); - if (buf_size - pos > 0) - buf[pos++] = '\n'; - } - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t -il_dbgfs_channels_read(struct file *file, char __user *user_buf, size_t count, - loff_t *ppos) -{ - struct il_priv *il = file->private_data; - struct ieee80211_channel *channels = NULL; - const struct ieee80211_supported_band *supp_band = NULL; - int pos = 0, i, bufsz = PAGE_SIZE; - char *buf; - ssize_t ret; - - if (!test_bit(S_GEO_CONFIGURED, &il->status)) - return -EAGAIN; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) { - IL_ERR("Can not allocate Buffer\n"); - return -ENOMEM; - } - - supp_band = il_get_hw_mode(il, IEEE80211_BAND_2GHZ); - if (supp_band) { - channels = supp_band->channels; - - pos += - scnprintf(buf + pos, bufsz - pos, - "Displaying %d channels in 2.4GHz band 802.11bg):\n", - supp_band->n_channels); - - for (i = 0; i < supp_band->n_channels; i++) - pos += - scnprintf(buf + pos, bufsz - pos, - "%d: %ddBm: BSS%s%s, %s.\n", - channels[i].hw_value, - channels[i].max_power, - channels[i]. - flags & IEEE80211_CHAN_RADAR ? - " (IEEE 802.11h required)" : "", - ((channels[i]. - flags & IEEE80211_CHAN_NO_IBSS) || - (channels[i]. - flags & IEEE80211_CHAN_RADAR)) ? "" : - ", IBSS", - channels[i]. - flags & IEEE80211_CHAN_PASSIVE_SCAN ? - "passive only" : "active/passive"); - } - supp_band = il_get_hw_mode(il, IEEE80211_BAND_5GHZ); - if (supp_band) { - channels = supp_band->channels; - - pos += - scnprintf(buf + pos, bufsz - pos, - "Displaying %d channels in 5.2GHz band (802.11a)\n", - supp_band->n_channels); - - for (i = 0; i < supp_band->n_channels; i++) - pos += - scnprintf(buf + pos, bufsz - pos, - "%d: %ddBm: BSS%s%s, %s.\n", - channels[i].hw_value, - channels[i].max_power, - channels[i]. - flags & IEEE80211_CHAN_RADAR ? - " (IEEE 802.11h required)" : "", - ((channels[i]. - flags & IEEE80211_CHAN_NO_IBSS) || - (channels[i]. - flags & IEEE80211_CHAN_RADAR)) ? "" : - ", IBSS", - channels[i]. - flags & IEEE80211_CHAN_PASSIVE_SCAN ? - "passive only" : "active/passive"); - } - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t -il_dbgfs_status_read(struct file *file, char __user *user_buf, size_t count, - loff_t *ppos) -{ - - struct il_priv *il = file->private_data; - char buf[512]; - int pos = 0; - const size_t bufsz = sizeof(buf); - - pos += - scnprintf(buf + pos, bufsz - pos, "S_HCMD_ACTIVE:\t %d\n", - test_bit(S_HCMD_ACTIVE, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_INT_ENABLED:\t %d\n", - test_bit(S_INT_ENABLED, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_RFKILL:\t %d\n", - test_bit(S_RFKILL, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_CT_KILL:\t\t %d\n", - test_bit(S_CT_KILL, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_INIT:\t\t %d\n", - test_bit(S_INIT, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_ALIVE:\t\t %d\n", - test_bit(S_ALIVE, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_READY:\t\t %d\n", - test_bit(S_READY, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_TEMPERATURE:\t %d\n", - test_bit(S_TEMPERATURE, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_GEO_CONFIGURED:\t %d\n", - test_bit(S_GEO_CONFIGURED, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_EXIT_PENDING:\t %d\n", - test_bit(S_EXIT_PENDING, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_STATS:\t %d\n", - test_bit(S_STATS, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_SCANNING:\t %d\n", - test_bit(S_SCANNING, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_SCAN_ABORTING:\t %d\n", - test_bit(S_SCAN_ABORTING, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_SCAN_HW:\t\t %d\n", - test_bit(S_SCAN_HW, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_POWER_PMI:\t %d\n", - test_bit(S_POWER_PMI, &il->status)); - pos += - scnprintf(buf + pos, bufsz - pos, "S_FW_ERROR:\t %d\n", - test_bit(S_FW_ERROR, &il->status)); - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t -il_dbgfs_interrupt_read(struct file *file, char __user *user_buf, size_t count, - loff_t *ppos) -{ - - struct il_priv *il = file->private_data; - int pos = 0; - int cnt = 0; - char *buf; - int bufsz = 24 * 64; /* 24 items * 64 char per item */ - ssize_t ret; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) { - IL_ERR("Can not allocate Buffer\n"); - return -ENOMEM; - } - - pos += - scnprintf(buf + pos, bufsz - pos, "Interrupt Statistics Report:\n"); - - pos += - scnprintf(buf + pos, bufsz - pos, "HW Error:\t\t\t %u\n", - il->isr_stats.hw); - pos += - scnprintf(buf + pos, bufsz - pos, "SW Error:\t\t\t %u\n", - il->isr_stats.sw); - if (il->isr_stats.sw || il->isr_stats.hw) { - pos += - scnprintf(buf + pos, bufsz - pos, - "\tLast Restarting Code: 0x%X\n", - il->isr_stats.err_code); - } -#ifdef CONFIG_IWLEGACY_DEBUG - pos += - scnprintf(buf + pos, bufsz - pos, "Frame transmitted:\t\t %u\n", - il->isr_stats.sch); - pos += - scnprintf(buf + pos, bufsz - pos, "Alive interrupt:\t\t %u\n", - il->isr_stats.alive); -#endif - pos += - scnprintf(buf + pos, bufsz - pos, - "HW RF KILL switch toggled:\t %u\n", - il->isr_stats.rfkill); - - pos += - scnprintf(buf + pos, bufsz - pos, "CT KILL:\t\t\t %u\n", - il->isr_stats.ctkill); - - pos += - scnprintf(buf + pos, bufsz - pos, "Wakeup Interrupt:\t\t %u\n", - il->isr_stats.wakeup); - - pos += - scnprintf(buf + pos, bufsz - pos, "Rx command responses:\t\t %u\n", - il->isr_stats.rx); - for (cnt = 0; cnt < IL_CN_MAX; cnt++) { - if (il->isr_stats.handlers[cnt] > 0) - pos += - scnprintf(buf + pos, bufsz - pos, - "\tRx handler[%36s]:\t\t %u\n", - il_get_cmd_string(cnt), - il->isr_stats.handlers[cnt]); - } - - pos += - scnprintf(buf + pos, bufsz - pos, "Tx/FH interrupt:\t\t %u\n", - il->isr_stats.tx); - - pos += - scnprintf(buf + pos, bufsz - pos, "Unexpected INTA:\t\t %u\n", - il->isr_stats.unhandled); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t -il_dbgfs_interrupt_write(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - char buf[8]; - int buf_size; - u32 reset_flag; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%x", &reset_flag) != 1) - return -EFAULT; - if (reset_flag == 0) - il_clear_isr_stats(il); - - return count; -} - -static ssize_t -il_dbgfs_qos_read(struct file *file, char __user *user_buf, size_t count, - loff_t *ppos) -{ - struct il_priv *il = file->private_data; - int pos = 0, i; - char buf[256]; - const size_t bufsz = sizeof(buf); - - for (i = 0; i < AC_NUM; i++) { - pos += - scnprintf(buf + pos, bufsz - pos, - "\tcw_min\tcw_max\taifsn\ttxop\n"); - pos += - scnprintf(buf + pos, bufsz - pos, - "AC[%d]\t%u\t%u\t%u\t%u\n", i, - il->qos_data.def_qos_parm.ac[i].cw_min, - il->qos_data.def_qos_parm.ac[i].cw_max, - il->qos_data.def_qos_parm.ac[i].aifsn, - il->qos_data.def_qos_parm.ac[i].edca_txop); - } - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t -il_dbgfs_disable_ht40_write(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - char buf[8]; - int buf_size; - int ht40; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%d", &ht40) != 1) - return -EFAULT; - if (!il_is_any_associated(il)) - il->disable_ht40 = ht40 ? true : false; - else { - IL_ERR("Sta associated with AP - " - "Change to 40MHz channel support is not allowed\n"); - return -EINVAL; - } - - return count; -} - -static ssize_t -il_dbgfs_disable_ht40_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - char buf[100]; - int pos = 0; - const size_t bufsz = sizeof(buf); - - pos += - scnprintf(buf + pos, bufsz - pos, "11n 40MHz Mode: %s\n", - il->disable_ht40 ? "Disabled" : "Enabled"); - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -DEBUGFS_READ_WRITE_FILE_OPS(sram); -DEBUGFS_READ_FILE_OPS(nvm); -DEBUGFS_READ_FILE_OPS(stations); -DEBUGFS_READ_FILE_OPS(channels); -DEBUGFS_READ_FILE_OPS(status); -DEBUGFS_READ_WRITE_FILE_OPS(interrupt); -DEBUGFS_READ_FILE_OPS(qos); -DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40); - -static ssize_t -il_dbgfs_tx_queue_read(struct file *file, char __user *user_buf, size_t count, - loff_t *ppos) -{ - - struct il_priv *il = file->private_data; - struct il_tx_queue *txq; - struct il_queue *q; - char *buf; - int pos = 0; - int cnt; - int ret; - const size_t bufsz = - sizeof(char) * 64 * il->cfg->num_of_queues; - - if (!il->txq) { - IL_ERR("txq not ready\n"); - return -EAGAIN; - } - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) { - txq = &il->txq[cnt]; - q = &txq->q; - pos += - scnprintf(buf + pos, bufsz - pos, - "hwq %.2d: read=%u write=%u stop=%d" - " swq_id=%#.2x (ac %d/hwq %d)\n", cnt, - q->read_ptr, q->write_ptr, - !!test_bit(cnt, il->queue_stopped), - txq->swq_id, txq->swq_id & 3, - (txq->swq_id >> 2) & 0x1f); - if (cnt >= 4) - continue; - /* for the ACs, display the stop count too */ - pos += - scnprintf(buf + pos, bufsz - pos, - " stop-count: %d\n", - atomic_read(&il->queue_stop_count[cnt])); - } - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t -il_dbgfs_rx_queue_read(struct file *file, char __user *user_buf, size_t count, - loff_t *ppos) -{ - - struct il_priv *il = file->private_data; - struct il_rx_queue *rxq = &il->rxq; - char buf[256]; - int pos = 0; - const size_t bufsz = sizeof(buf); - - pos += scnprintf(buf + pos, bufsz - pos, "read: %u\n", rxq->read); - pos += scnprintf(buf + pos, bufsz - pos, "write: %u\n", rxq->write); - pos += - scnprintf(buf + pos, bufsz - pos, "free_count: %u\n", - rxq->free_count); - if (rxq->rb_stts) { - pos += - scnprintf(buf + pos, bufsz - pos, "closed_rb_num: %u\n", - le16_to_cpu(rxq->rb_stts-> - closed_rb_num) & 0x0FFF); - } else { - pos += - scnprintf(buf + pos, bufsz - pos, - "closed_rb_num: Not Allocated\n"); - } - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t -il_dbgfs_ucode_rx_stats_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - - return il->debugfs_ops->rx_stats_read(file, user_buf, count, ppos); -} - -static ssize_t -il_dbgfs_ucode_tx_stats_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - - return il->debugfs_ops->tx_stats_read(file, user_buf, count, ppos); -} - -static ssize_t -il_dbgfs_ucode_general_stats_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - - return il->debugfs_ops->general_stats_read(file, user_buf, count, ppos); -} - -static ssize_t -il_dbgfs_sensitivity_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - - struct il_priv *il = file->private_data; - int pos = 0; - int cnt = 0; - char *buf; - int bufsz = sizeof(struct il_sensitivity_data) * 4 + 100; - ssize_t ret; - struct il_sensitivity_data *data; - - data = &il->sensitivity_data; - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) { - IL_ERR("Can not allocate Buffer\n"); - return -ENOMEM; - } - - pos += - scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm:\t\t\t %u\n", - data->auto_corr_ofdm); - pos += - scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm_mrc:\t\t %u\n", - data->auto_corr_ofdm_mrc); - pos += - scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm_x1:\t\t %u\n", - data->auto_corr_ofdm_x1); - pos += - scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm_mrc_x1:\t\t %u\n", - data->auto_corr_ofdm_mrc_x1); - pos += - scnprintf(buf + pos, bufsz - pos, "auto_corr_cck:\t\t\t %u\n", - data->auto_corr_cck); - pos += - scnprintf(buf + pos, bufsz - pos, "auto_corr_cck_mrc:\t\t %u\n", - data->auto_corr_cck_mrc); - pos += - scnprintf(buf + pos, bufsz - pos, - "last_bad_plcp_cnt_ofdm:\t\t %u\n", - data->last_bad_plcp_cnt_ofdm); - pos += - scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_ofdm:\t\t %u\n", - data->last_fa_cnt_ofdm); - pos += - scnprintf(buf + pos, bufsz - pos, "last_bad_plcp_cnt_cck:\t\t %u\n", - data->last_bad_plcp_cnt_cck); - pos += - scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_cck:\t\t %u\n", - data->last_fa_cnt_cck); - pos += - scnprintf(buf + pos, bufsz - pos, "nrg_curr_state:\t\t\t %u\n", - data->nrg_curr_state); - pos += - scnprintf(buf + pos, bufsz - pos, "nrg_prev_state:\t\t\t %u\n", - data->nrg_prev_state); - pos += scnprintf(buf + pos, bufsz - pos, "nrg_value:\t\t\t"); - for (cnt = 0; cnt < 10; cnt++) { - pos += - scnprintf(buf + pos, bufsz - pos, " %u", - data->nrg_value[cnt]); - } - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_rssi:\t\t"); - for (cnt = 0; cnt < NRG_NUM_PREV_STAT_L; cnt++) { - pos += - scnprintf(buf + pos, bufsz - pos, " %u", - data->nrg_silence_rssi[cnt]); - } - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - pos += - scnprintf(buf + pos, bufsz - pos, "nrg_silence_ref:\t\t %u\n", - data->nrg_silence_ref); - pos += - scnprintf(buf + pos, bufsz - pos, "nrg_energy_idx:\t\t\t %u\n", - data->nrg_energy_idx); - pos += - scnprintf(buf + pos, bufsz - pos, "nrg_silence_idx:\t\t %u\n", - data->nrg_silence_idx); - pos += - scnprintf(buf + pos, bufsz - pos, "nrg_th_cck:\t\t\t %u\n", - data->nrg_th_cck); - pos += - scnprintf(buf + pos, bufsz - pos, - "nrg_auto_corr_silence_diff:\t %u\n", - data->nrg_auto_corr_silence_diff); - pos += - scnprintf(buf + pos, bufsz - pos, "num_in_cck_no_fa:\t\t %u\n", - data->num_in_cck_no_fa); - pos += - scnprintf(buf + pos, bufsz - pos, "nrg_th_ofdm:\t\t\t %u\n", - data->nrg_th_ofdm); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t -il_dbgfs_chain_noise_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - - struct il_priv *il = file->private_data; - int pos = 0; - int cnt = 0; - char *buf; - int bufsz = sizeof(struct il_chain_noise_data) * 4 + 100; - ssize_t ret; - struct il_chain_noise_data *data; - - data = &il->chain_noise_data; - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) { - IL_ERR("Can not allocate Buffer\n"); - return -ENOMEM; - } - - pos += - scnprintf(buf + pos, bufsz - pos, "active_chains:\t\t\t %u\n", - data->active_chains); - pos += - scnprintf(buf + pos, bufsz - pos, "chain_noise_a:\t\t\t %u\n", - data->chain_noise_a); - pos += - scnprintf(buf + pos, bufsz - pos, "chain_noise_b:\t\t\t %u\n", - data->chain_noise_b); - pos += - scnprintf(buf + pos, bufsz - pos, "chain_noise_c:\t\t\t %u\n", - data->chain_noise_c); - pos += - scnprintf(buf + pos, bufsz - pos, "chain_signal_a:\t\t\t %u\n", - data->chain_signal_a); - pos += - scnprintf(buf + pos, bufsz - pos, "chain_signal_b:\t\t\t %u\n", - data->chain_signal_b); - pos += - scnprintf(buf + pos, bufsz - pos, "chain_signal_c:\t\t\t %u\n", - data->chain_signal_c); - pos += - scnprintf(buf + pos, bufsz - pos, "beacon_count:\t\t\t %u\n", - data->beacon_count); - - pos += scnprintf(buf + pos, bufsz - pos, "disconn_array:\t\t\t"); - for (cnt = 0; cnt < NUM_RX_CHAINS; cnt++) { - pos += - scnprintf(buf + pos, bufsz - pos, " %u", - data->disconn_array[cnt]); - } - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - pos += scnprintf(buf + pos, bufsz - pos, "delta_gain_code:\t\t"); - for (cnt = 0; cnt < NUM_RX_CHAINS; cnt++) { - pos += - scnprintf(buf + pos, bufsz - pos, " %u", - data->delta_gain_code[cnt]); - } - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - pos += - scnprintf(buf + pos, bufsz - pos, "radio_write:\t\t\t %u\n", - data->radio_write); - pos += - scnprintf(buf + pos, bufsz - pos, "state:\t\t\t\t %u\n", - data->state); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t -il_dbgfs_power_save_status_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - char buf[60]; - int pos = 0; - const size_t bufsz = sizeof(buf); - u32 pwrsave_status; - - pwrsave_status = - _il_rd(il, CSR_GP_CNTRL) & CSR_GP_REG_POWER_SAVE_STATUS_MSK; - - pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: "); - pos += - scnprintf(buf + pos, bufsz - pos, "%s\n", - (pwrsave_status == CSR_GP_REG_NO_POWER_SAVE) ? "none" : - (pwrsave_status == CSR_GP_REG_MAC_POWER_SAVE) ? "MAC" : - (pwrsave_status == CSR_GP_REG_PHY_POWER_SAVE) ? "PHY" : - "error"); - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t -il_dbgfs_clear_ucode_stats_write(struct file *file, - const char __user *user_buf, size_t count, - loff_t *ppos) -{ - struct il_priv *il = file->private_data; - char buf[8]; - int buf_size; - int clear; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%d", &clear) != 1) - return -EFAULT; - - /* make request to uCode to retrieve stats information */ - mutex_lock(&il->mutex); - il_send_stats_request(il, CMD_SYNC, true); - mutex_unlock(&il->mutex); - - return count; -} - -static ssize_t -il_dbgfs_rxon_flags_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - - struct il_priv *il = file->private_data; - int len = 0; - char buf[20]; - - len = sprintf(buf, "0x%04X\n", le32_to_cpu(il->active.flags)); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t -il_dbgfs_rxon_filter_flags_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - - struct il_priv *il = file->private_data; - int len = 0; - char buf[20]; - - len = - sprintf(buf, "0x%04X\n", le32_to_cpu(il->active.filter_flags)); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t -il_dbgfs_fh_reg_read(struct file *file, char __user *user_buf, size_t count, - loff_t *ppos) -{ - struct il_priv *il = file->private_data; - char *buf; - int pos = 0; - ssize_t ret = -EFAULT; - - if (il->ops->dump_fh) { - ret = pos = il->ops->dump_fh(il, &buf, true); - if (buf) { - ret = - simple_read_from_buffer(user_buf, count, ppos, buf, - pos); - kfree(buf); - } - } - - return ret; -} - -static ssize_t -il_dbgfs_missed_beacon_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - - struct il_priv *il = file->private_data; - int pos = 0; - char buf[12]; - const size_t bufsz = sizeof(buf); - - pos += - scnprintf(buf + pos, bufsz - pos, "%d\n", - il->missed_beacon_threshold); - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t -il_dbgfs_missed_beacon_write(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct il_priv *il = file->private_data; - char buf[8]; - int buf_size; - int missed; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%d", &missed) != 1) - return -EINVAL; - - if (missed < IL_MISSED_BEACON_THRESHOLD_MIN || - missed > IL_MISSED_BEACON_THRESHOLD_MAX) - il->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF; - else - il->missed_beacon_threshold = missed; - - return count; -} - -static ssize_t -il_dbgfs_force_reset_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - - struct il_priv *il = file->private_data; - int pos = 0; - char buf[300]; - const size_t bufsz = sizeof(buf); - struct il_force_reset *force_reset; - - force_reset = &il->force_reset; - - pos += - scnprintf(buf + pos, bufsz - pos, "\tnumber of reset request: %d\n", - force_reset->reset_request_count); - pos += - scnprintf(buf + pos, bufsz - pos, - "\tnumber of reset request success: %d\n", - force_reset->reset_success_count); - pos += - scnprintf(buf + pos, bufsz - pos, - "\tnumber of reset request reject: %d\n", - force_reset->reset_reject_count); - pos += - scnprintf(buf + pos, bufsz - pos, "\treset duration: %lu\n", - force_reset->reset_duration); - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t -il_dbgfs_force_reset_write(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - - int ret; - struct il_priv *il = file->private_data; - - ret = il_force_reset(il, true); - - return ret ? ret : count; -} - -static ssize_t -il_dbgfs_wd_timeout_write(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - - struct il_priv *il = file->private_data; - char buf[8]; - int buf_size; - int timeout; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%d", &timeout) != 1) - return -EINVAL; - if (timeout < 0 || timeout > IL_MAX_WD_TIMEOUT) - timeout = IL_DEF_WD_TIMEOUT; - - il->cfg->wd_timeout = timeout; - il_setup_watchdog(il); - return count; -} - -DEBUGFS_READ_FILE_OPS(rx_stats); -DEBUGFS_READ_FILE_OPS(tx_stats); -DEBUGFS_READ_FILE_OPS(rx_queue); -DEBUGFS_READ_FILE_OPS(tx_queue); -DEBUGFS_READ_FILE_OPS(ucode_rx_stats); -DEBUGFS_READ_FILE_OPS(ucode_tx_stats); -DEBUGFS_READ_FILE_OPS(ucode_general_stats); -DEBUGFS_READ_FILE_OPS(sensitivity); -DEBUGFS_READ_FILE_OPS(chain_noise); -DEBUGFS_READ_FILE_OPS(power_save_status); -DEBUGFS_WRITE_FILE_OPS(clear_ucode_stats); -DEBUGFS_WRITE_FILE_OPS(clear_traffic_stats); -DEBUGFS_READ_FILE_OPS(fh_reg); -DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); -DEBUGFS_READ_WRITE_FILE_OPS(force_reset); -DEBUGFS_READ_FILE_OPS(rxon_flags); -DEBUGFS_READ_FILE_OPS(rxon_filter_flags); -DEBUGFS_WRITE_FILE_OPS(wd_timeout); - -/* - * Create the debugfs files and directories - * - */ -int -il_dbgfs_register(struct il_priv *il, const char *name) -{ - struct dentry *phyd = il->hw->wiphy->debugfsdir; - struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug; - - dir_drv = debugfs_create_dir(name, phyd); - if (!dir_drv) - return -ENOMEM; - - il->debugfs_dir = dir_drv; - - dir_data = debugfs_create_dir("data", dir_drv); - if (!dir_data) - goto err; - dir_rf = debugfs_create_dir("rf", dir_drv); - if (!dir_rf) - goto err; - dir_debug = debugfs_create_dir("debug", dir_drv); - if (!dir_debug) - goto err; - - DEBUGFS_ADD_FILE(nvm, dir_data, S_IRUSR); - DEBUGFS_ADD_FILE(sram, dir_data, S_IWUSR | S_IRUSR); - DEBUGFS_ADD_FILE(stations, dir_data, S_IRUSR); - DEBUGFS_ADD_FILE(channels, dir_data, S_IRUSR); - DEBUGFS_ADD_FILE(status, dir_data, S_IRUSR); - DEBUGFS_ADD_FILE(interrupt, dir_data, S_IWUSR | S_IRUSR); - DEBUGFS_ADD_FILE(qos, dir_data, S_IRUSR); - DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); - DEBUGFS_ADD_FILE(rx_stats, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(tx_stats, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(rx_queue, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(tx_queue, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(clear_ucode_stats, dir_debug, S_IWUSR); - DEBUGFS_ADD_FILE(clear_traffic_stats, dir_debug, S_IWUSR); - DEBUGFS_ADD_FILE(fh_reg, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); - DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR); - DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); - - if (il->cfg->sensitivity_calib_by_driver) - DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); - if (il->cfg->chain_noise_calib_by_driver) - DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); - DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); - DEBUGFS_ADD_FILE(wd_timeout, dir_debug, S_IWUSR); - if (il->cfg->sensitivity_calib_by_driver) - DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, - &il->disable_sens_cal); - if (il->cfg->chain_noise_calib_by_driver) - DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, - &il->disable_chain_noise_cal); - DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, &il->disable_tx_power_cal); - return 0; - -err: - IL_ERR("Can't create the debugfs directory\n"); - il_dbgfs_unregister(il); - return -ENOMEM; -} -EXPORT_SYMBOL(il_dbgfs_register); - -/** - * Remove the debugfs files and directories - * - */ -void -il_dbgfs_unregister(struct il_priv *il) -{ - if (!il->debugfs_dir) - return; - - debugfs_remove_recursive(il->debugfs_dir); - il->debugfs_dir = NULL; -} -EXPORT_SYMBOL(il_dbgfs_unregister); diff --git a/drivers/net/wireless/iwlegacy/iwl-spectrum.h b/drivers/net/wireless/iwlegacy/iwl-spectrum.h deleted file mode 100644 index 85fe48e520f9..000000000000 --- a/drivers/net/wireless/iwlegacy/iwl-spectrum.h +++ /dev/null @@ -1,92 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ieee80211 subsystem header files. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#ifndef __il_spectrum_h__ -#define __il_spectrum_h__ -enum { /* ieee80211_basic_report.map */ - IEEE80211_BASIC_MAP_BSS = (1 << 0), - IEEE80211_BASIC_MAP_OFDM = (1 << 1), - IEEE80211_BASIC_MAP_UNIDENTIFIED = (1 << 2), - IEEE80211_BASIC_MAP_RADAR = (1 << 3), - IEEE80211_BASIC_MAP_UNMEASURED = (1 << 4), - /* Bits 5-7 are reserved */ - -}; -struct ieee80211_basic_report { - u8 channel; - __le64 start_time; - __le16 duration; - u8 map; -} __packed; - -enum { /* ieee80211_measurement_request.mode */ - /* Bit 0 is reserved */ - IEEE80211_MEASUREMENT_ENABLE = (1 << 1), - IEEE80211_MEASUREMENT_REQUEST = (1 << 2), - IEEE80211_MEASUREMENT_REPORT = (1 << 3), - /* Bits 4-7 are reserved */ -}; - -enum { - IEEE80211_REPORT_BASIC = 0, /* required */ - IEEE80211_REPORT_CCA = 1, /* optional */ - IEEE80211_REPORT_RPI = 2, /* optional */ - /* 3-255 reserved */ -}; - -struct ieee80211_measurement_params { - u8 channel; - __le64 start_time; - __le16 duration; -} __packed; - -struct ieee80211_info_element { - u8 id; - u8 len; - u8 data[0]; -} __packed; - -struct ieee80211_measurement_request { - struct ieee80211_info_element ie; - u8 token; - u8 mode; - u8 type; - struct ieee80211_measurement_params params[0]; -} __packed; - -struct ieee80211_measurement_report { - struct ieee80211_info_element ie; - u8 token; - u8 mode; - u8 type; - union { - struct ieee80211_basic_report basic[0]; - } u; -} __packed; - -#endif diff --git a/drivers/net/wireless/iwlegacy/prph.h b/drivers/net/wireless/iwlegacy/prph.h deleted file mode 100644 index ffec4b4a248a..000000000000 --- a/drivers/net/wireless/iwlegacy/prph.h +++ /dev/null @@ -1,522 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2005 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called LICENSE.GPL. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef __il_prph_h__ -#define __il_prph_h__ - -/* - * Registers in this file are internal, not PCI bus memory mapped. - * Driver accesses these via HBUS_TARG_PRPH_* registers. - */ -#define PRPH_BASE (0x00000) -#define PRPH_END (0xFFFFF) - -/* APMG (power management) constants */ -#define APMG_BASE (PRPH_BASE + 0x3000) -#define APMG_CLK_CTRL_REG (APMG_BASE + 0x0000) -#define APMG_CLK_EN_REG (APMG_BASE + 0x0004) -#define APMG_CLK_DIS_REG (APMG_BASE + 0x0008) -#define APMG_PS_CTRL_REG (APMG_BASE + 0x000c) -#define APMG_PCIDEV_STT_REG (APMG_BASE + 0x0010) -#define APMG_RFKILL_REG (APMG_BASE + 0x0014) -#define APMG_RTC_INT_STT_REG (APMG_BASE + 0x001c) -#define APMG_RTC_INT_MSK_REG (APMG_BASE + 0x0020) -#define APMG_DIGITAL_SVR_REG (APMG_BASE + 0x0058) -#define APMG_ANALOG_SVR_REG (APMG_BASE + 0x006C) - -#define APMS_CLK_VAL_MRB_FUNC_MODE (0x00000001) -#define APMG_CLK_VAL_DMA_CLK_RQT (0x00000200) -#define APMG_CLK_VAL_BSM_CLK_RQT (0x00000800) - -#define APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS (0x00400000) -#define APMG_PS_CTRL_VAL_RESET_REQ (0x04000000) -#define APMG_PS_CTRL_MSK_PWR_SRC (0x03000000) -#define APMG_PS_CTRL_VAL_PWR_SRC_VMAIN (0x00000000) -#define APMG_PS_CTRL_VAL_PWR_SRC_MAX (0x01000000) /* 3945 only */ -#define APMG_PS_CTRL_VAL_PWR_SRC_VAUX (0x02000000) -#define APMG_SVR_VOLTAGE_CONFIG_BIT_MSK (0x000001E0) /* bit 8:5 */ -#define APMG_SVR_DIGITAL_VOLTAGE_1_32 (0x00000060) - -#define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800) - -/** - * BSM (Bootstrap State Machine) - * - * The Bootstrap State Machine (BSM) stores a short bootstrap uCode program - * in special SRAM that does not power down when the embedded control - * processor is sleeping (e.g. for periodic power-saving shutdowns of radio). - * - * When powering back up after sleeps (or during initial uCode load), the BSM - * internally loads the short bootstrap program from the special SRAM into the - * embedded processor's instruction SRAM, and starts the processor so it runs - * the bootstrap program. - * - * This bootstrap program loads (via PCI busmaster DMA) instructions and data - * images for a uCode program from host DRAM locations. The host driver - * indicates DRAM locations and sizes for instruction and data images via the - * four BSM_DRAM_* registers. Once the bootstrap program loads the new program, - * the new program starts automatically. - * - * The uCode used for open-source drivers includes two programs: - * - * 1) Initialization -- performs hardware calibration and sets up some - * internal data, then notifies host via "initialize alive" notification - * (struct il_init_alive_resp) that it has completed all of its work. - * After signal from host, it then loads and starts the runtime program. - * The initialization program must be used when initially setting up the - * NIC after loading the driver. - * - * 2) Runtime/Protocol -- performs all normal runtime operations. This - * notifies host via "alive" notification (struct il_alive_resp) that it - * is ready to be used. - * - * When initializing the NIC, the host driver does the following procedure: - * - * 1) Load bootstrap program (instructions only, no data image for bootstrap) - * into bootstrap memory. Use dword writes starting at BSM_SRAM_LOWER_BOUND - * - * 2) Point (via BSM_DRAM_*) to the "initialize" uCode data and instruction - * images in host DRAM. - * - * 3) Set up BSM to copy from BSM SRAM into uCode instruction SRAM when asked: - * BSM_WR_MEM_SRC_REG = 0 - * BSM_WR_MEM_DST_REG = RTC_INST_LOWER_BOUND - * BSM_WR_MEM_DWCOUNT_REG = # dwords in bootstrap instruction image - * - * 4) Load bootstrap into instruction SRAM: - * BSM_WR_CTRL_REG = BSM_WR_CTRL_REG_BIT_START - * - * 5) Wait for load completion: - * Poll BSM_WR_CTRL_REG for BSM_WR_CTRL_REG_BIT_START = 0 - * - * 6) Enable future boot loads whenever NIC's power management triggers it: - * BSM_WR_CTRL_REG = BSM_WR_CTRL_REG_BIT_START_EN - * - * 7) Start the NIC by removing all reset bits: - * CSR_RESET = 0 - * - * The bootstrap uCode (already in instruction SRAM) loads initialization - * uCode. Initialization uCode performs data initialization, sends - * "initialize alive" notification to host, and waits for a signal from - * host to load runtime code. - * - * 4) Point (via BSM_DRAM_*) to the "runtime" uCode data and instruction - * images in host DRAM. The last register loaded must be the instruction - * byte count register ("1" in MSbit tells initialization uCode to load - * the runtime uCode): - * BSM_DRAM_INST_BYTECOUNT_REG = byte count | BSM_DRAM_INST_LOAD - * - * 5) Wait for "alive" notification, then issue normal runtime commands. - * - * Data caching during power-downs: - * - * Just before the embedded controller powers down (e.g for automatic - * power-saving modes, or for RFKILL), uCode stores (via PCI busmaster DMA) - * a current snapshot of the embedded processor's data SRAM into host DRAM. - * This caches the data while the embedded processor's memory is powered down. - * Location and size are controlled by BSM_DRAM_DATA_* registers. - * - * NOTE: Instruction SRAM does not need to be saved, since that doesn't - * change during operation; the original image (from uCode distribution - * file) can be used for reload. - * - * When powering back up, the BSM loads the bootstrap program. Bootstrap looks - * at the BSM_DRAM_* registers, which now point to the runtime instruction - * image and the cached (modified) runtime data (*not* the initialization - * uCode). Bootstrap reloads these runtime images into SRAM, and restarts the - * uCode from where it left off before the power-down. - * - * NOTE: Initialization uCode does *not* run as part of the save/restore - * procedure. - * - * This save/restore method is mostly for autonomous power management during - * normal operation (result of C_POWER_TBL). Platform suspend/resume and - * RFKILL should use complete restarts (with total re-initialization) of uCode, - * allowing total shutdown (including BSM memory). - * - * Note that, during normal operation, the host DRAM that held the initial - * startup data for the runtime code is now being used as a backup data cache - * for modified data! If you need to completely re-initialize the NIC, make - * sure that you use the runtime data image from the uCode distribution file, - * not the modified/saved runtime data. You may want to store a separate - * "clean" runtime data image in DRAM to avoid disk reads of distribution file. - */ - -/* BSM bit fields */ -#define BSM_WR_CTRL_REG_BIT_START (0x80000000) /* start boot load now */ -#define BSM_WR_CTRL_REG_BIT_START_EN (0x40000000) /* enable boot after pwrup */ -#define BSM_DRAM_INST_LOAD (0x80000000) /* start program load now */ - -/* BSM addresses */ -#define BSM_BASE (PRPH_BASE + 0x3400) -#define BSM_END (PRPH_BASE + 0x3800) - -#define BSM_WR_CTRL_REG (BSM_BASE + 0x000) /* ctl and status */ -#define BSM_WR_MEM_SRC_REG (BSM_BASE + 0x004) /* source in BSM mem */ -#define BSM_WR_MEM_DST_REG (BSM_BASE + 0x008) /* dest in SRAM mem */ -#define BSM_WR_DWCOUNT_REG (BSM_BASE + 0x00C) /* bytes */ -#define BSM_WR_STATUS_REG (BSM_BASE + 0x010) /* bit 0: 1 == done */ - -/* - * Pointers and size regs for bootstrap load and data SRAM save/restore. - * NOTE: 3945 pointers use bits 31:0 of DRAM address. - * 4965 pointers use bits 35:4 of DRAM address. - */ -#define BSM_DRAM_INST_PTR_REG (BSM_BASE + 0x090) -#define BSM_DRAM_INST_BYTECOUNT_REG (BSM_BASE + 0x094) -#define BSM_DRAM_DATA_PTR_REG (BSM_BASE + 0x098) -#define BSM_DRAM_DATA_BYTECOUNT_REG (BSM_BASE + 0x09C) - -/* - * BSM special memory, stays powered on during power-save sleeps. - * Read/write, address range from LOWER_BOUND to (LOWER_BOUND + SIZE -1) - */ -#define BSM_SRAM_LOWER_BOUND (PRPH_BASE + 0x3800) -#define BSM_SRAM_SIZE (1024) /* bytes */ - -/* 3945 Tx scheduler registers */ -#define ALM_SCD_BASE (PRPH_BASE + 0x2E00) -#define ALM_SCD_MODE_REG (ALM_SCD_BASE + 0x000) -#define ALM_SCD_ARASTAT_REG (ALM_SCD_BASE + 0x004) -#define ALM_SCD_TXFACT_REG (ALM_SCD_BASE + 0x010) -#define ALM_SCD_TXF4MF_REG (ALM_SCD_BASE + 0x014) -#define ALM_SCD_TXF5MF_REG (ALM_SCD_BASE + 0x020) -#define ALM_SCD_SBYP_MODE_1_REG (ALM_SCD_BASE + 0x02C) -#define ALM_SCD_SBYP_MODE_2_REG (ALM_SCD_BASE + 0x030) - -/** - * Tx Scheduler - * - * The Tx Scheduler selects the next frame to be transmitted, choosing TFDs - * (Transmit Frame Descriptors) from up to 16 circular Tx queues resident in - * host DRAM. It steers each frame's Tx command (which contains the frame - * data) into one of up to 7 prioritized Tx DMA FIFO channels within the - * device. A queue maps to only one (selectable by driver) Tx DMA channel, - * but one DMA channel may take input from several queues. - * - * Tx DMA FIFOs have dedicated purposes. For 4965, they are used as follows - * (cf. default_queue_to_tx_fifo in 4965.c): - * - * 0 -- EDCA BK (background) frames, lowest priority - * 1 -- EDCA BE (best effort) frames, normal priority - * 2 -- EDCA VI (video) frames, higher priority - * 3 -- EDCA VO (voice) and management frames, highest priority - * 4 -- Commands (e.g. RXON, etc.) - * 5 -- unused (HCCA) - * 6 -- unused (HCCA) - * 7 -- not used by driver (device-internal only) - * - * - * Driver should normally map queues 0-6 to Tx DMA/FIFO channels 0-6. - * In addition, driver can map the remaining queues to Tx DMA/FIFO - * channels 0-3 to support 11n aggregation via EDCA DMA channels. - * - * The driver sets up each queue to work in one of two modes: - * - * 1) Scheduler-Ack, in which the scheduler automatically supports a - * block-ack (BA) win of up to 64 TFDs. In this mode, each queue - * contains TFDs for a unique combination of Recipient Address (RA) - * and Traffic Identifier (TID), that is, traffic of a given - * Quality-Of-Service (QOS) priority, destined for a single station. - * - * In scheduler-ack mode, the scheduler keeps track of the Tx status of - * each frame within the BA win, including whether it's been transmitted, - * and whether it's been acknowledged by the receiving station. The device - * automatically processes block-acks received from the receiving STA, - * and reschedules un-acked frames to be retransmitted (successful - * Tx completion may end up being out-of-order). - * - * The driver must maintain the queue's Byte Count table in host DRAM - * (struct il4965_sched_queue_byte_cnt_tbl) for this mode. - * This mode does not support fragmentation. - * - * 2) FIFO (a.k.a. non-Scheduler-ACK), in which each TFD is processed in order. - * The device may automatically retry Tx, but will retry only one frame - * at a time, until receiving ACK from receiving station, or reaching - * retry limit and giving up. - * - * The command queue (#4/#9) must use this mode! - * This mode does not require use of the Byte Count table in host DRAM. - * - * Driver controls scheduler operation via 3 means: - * 1) Scheduler registers - * 2) Shared scheduler data base in internal 4956 SRAM - * 3) Shared data in host DRAM - * - * Initialization: - * - * When loading, driver should allocate memory for: - * 1) 16 TFD circular buffers, each with space for (typically) 256 TFDs. - * 2) 16 Byte Count circular buffers in 16 KBytes contiguous memory - * (1024 bytes for each queue). - * - * After receiving "Alive" response from uCode, driver must initialize - * the scheduler (especially for queue #4/#9, the command queue, otherwise - * the driver can't issue commands!): - */ - -/** - * Max Tx win size is the max number of contiguous TFDs that the scheduler - * can keep track of at one time when creating block-ack chains of frames. - * Note that "64" matches the number of ack bits in a block-ack packet. - * Driver should use SCD_WIN_SIZE and SCD_FRAME_LIMIT values to initialize - * IL49_SCD_CONTEXT_QUEUE_OFFSET(x) values. - */ -#define SCD_WIN_SIZE 64 -#define SCD_FRAME_LIMIT 64 - -/* SCD registers are internal, must be accessed via HBUS_TARG_PRPH regs */ -#define IL49_SCD_START_OFFSET 0xa02c00 - -/* - * 4965 tells driver SRAM address for internal scheduler structs via this reg. - * Value is valid only after "Alive" response from uCode. - */ -#define IL49_SCD_SRAM_BASE_ADDR (IL49_SCD_START_OFFSET + 0x0) - -/* - * Driver may need to update queue-empty bits after changing queue's - * write and read pointers (idxes) during (re-)initialization (i.e. when - * scheduler is not tracking what's happening). - * Bit fields: - * 31-16: Write mask -- 1: update empty bit, 0: don't change empty bit - * 15-00: Empty state, one for each queue -- 1: empty, 0: non-empty - * NOTE: This register is not used by Linux driver. - */ -#define IL49_SCD_EMPTY_BITS (IL49_SCD_START_OFFSET + 0x4) - -/* - * Physical base address of array of byte count (BC) circular buffers (CBs). - * Each Tx queue has a BC CB in host DRAM to support Scheduler-ACK mode. - * This register points to BC CB for queue 0, must be on 1024-byte boundary. - * Others are spaced by 1024 bytes. - * Each BC CB is 2 bytes * (256 + 64) = 740 bytes, followed by 384 bytes pad. - * (Index into a queue's BC CB) = (idx into queue's TFD CB) = (SSN & 0xff). - * Bit fields: - * 25-00: Byte Count CB physical address [35:10], must be 1024-byte aligned. - */ -#define IL49_SCD_DRAM_BASE_ADDR (IL49_SCD_START_OFFSET + 0x10) - -/* - * Enables any/all Tx DMA/FIFO channels. - * Scheduler generates requests for only the active channels. - * Set this to 0xff to enable all 8 channels (normal usage). - * Bit fields: - * 7- 0: Enable (1), disable (0), one bit for each channel 0-7 - */ -#define IL49_SCD_TXFACT (IL49_SCD_START_OFFSET + 0x1c) -/* - * Queue (x) Write Pointers (idxes, really!), one for each Tx queue. - * Initialized and updated by driver as new TFDs are added to queue. - * NOTE: If using Block Ack, idx must correspond to frame's - * Start Sequence Number; idx = (SSN & 0xff) - * NOTE: Alternative to HBUS_TARG_WRPTR, which is what Linux driver uses? - */ -#define IL49_SCD_QUEUE_WRPTR(x) (IL49_SCD_START_OFFSET + 0x24 + (x) * 4) - -/* - * Queue (x) Read Pointers (idxes, really!), one for each Tx queue. - * For FIFO mode, idx indicates next frame to transmit. - * For Scheduler-ACK mode, idx indicates first frame in Tx win. - * Initialized by driver, updated by scheduler. - */ -#define IL49_SCD_QUEUE_RDPTR(x) (IL49_SCD_START_OFFSET + 0x64 + (x) * 4) - -/* - * Select which queues work in chain mode (1) vs. not (0). - * Use chain mode to build chains of aggregated frames. - * Bit fields: - * 31-16: Reserved - * 15-00: Mode, one bit for each queue -- 1: Chain mode, 0: one-at-a-time - * NOTE: If driver sets up queue for chain mode, it should be also set up - * Scheduler-ACK mode as well, via SCD_QUEUE_STATUS_BITS(x). - */ -#define IL49_SCD_QUEUECHAIN_SEL (IL49_SCD_START_OFFSET + 0xd0) - -/* - * Select which queues interrupt driver when scheduler increments - * a queue's read pointer (idx). - * Bit fields: - * 31-16: Reserved - * 15-00: Interrupt enable, one bit for each queue -- 1: enabled, 0: disabled - * NOTE: This functionality is apparently a no-op; driver relies on interrupts - * from Rx queue to read Tx command responses and update Tx queues. - */ -#define IL49_SCD_INTERRUPT_MASK (IL49_SCD_START_OFFSET + 0xe4) - -/* - * Queue search status registers. One for each queue. - * Sets up queue mode and assigns queue to Tx DMA channel. - * Bit fields: - * 19-10: Write mask/enable bits for bits 0-9 - * 9: Driver should init to "0" - * 8: Scheduler-ACK mode (1), non-Scheduler-ACK (i.e. FIFO) mode (0). - * Driver should init to "1" for aggregation mode, or "0" otherwise. - * 7-6: Driver should init to "0" - * 5: Window Size Left; indicates whether scheduler can request - * another TFD, based on win size, etc. Driver should init - * this bit to "1" for aggregation mode, or "0" for non-agg. - * 4-1: Tx FIFO to use (range 0-7). - * 0: Queue is active (1), not active (0). - * Other bits should be written as "0" - * - * NOTE: If enabling Scheduler-ACK mode, chain mode should also be enabled - * via SCD_QUEUECHAIN_SEL. - */ -#define IL49_SCD_QUEUE_STATUS_BITS(x)\ - (IL49_SCD_START_OFFSET + 0x104 + (x) * 4) - -/* Bit field positions */ -#define IL49_SCD_QUEUE_STTS_REG_POS_ACTIVE (0) -#define IL49_SCD_QUEUE_STTS_REG_POS_TXF (1) -#define IL49_SCD_QUEUE_STTS_REG_POS_WSL (5) -#define IL49_SCD_QUEUE_STTS_REG_POS_SCD_ACK (8) - -/* Write masks */ -#define IL49_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN (10) -#define IL49_SCD_QUEUE_STTS_REG_MSK (0x0007FC00) - -/** - * 4965 internal SRAM structures for scheduler, shared with driver ... - * - * Driver should clear and initialize the following areas after receiving - * "Alive" response from 4965 uCode, i.e. after initial - * uCode load, or after a uCode load done for error recovery: - * - * SCD_CONTEXT_DATA_OFFSET (size 128 bytes) - * SCD_TX_STTS_BITMAP_OFFSET (size 256 bytes) - * SCD_TRANSLATE_TBL_OFFSET (size 32 bytes) - * - * Driver accesses SRAM via HBUS_TARG_MEM_* registers. - * Driver reads base address of this scheduler area from SCD_SRAM_BASE_ADDR. - * All OFFSET values must be added to this base address. - */ - -/* - * Queue context. One 8-byte entry for each of 16 queues. - * - * Driver should clear this entire area (size 0x80) to 0 after receiving - * "Alive" notification from uCode. Additionally, driver should init - * each queue's entry as follows: - * - * LS Dword bit fields: - * 0-06: Max Tx win size for Scheduler-ACK. Driver should init to 64. - * - * MS Dword bit fields: - * 16-22: Frame limit. Driver should init to 10 (0xa). - * - * Driver should init all other bits to 0. - * - * Init must be done after driver receives "Alive" response from 4965 uCode, - * and when setting up queue for aggregation. - */ -#define IL49_SCD_CONTEXT_DATA_OFFSET 0x380 -#define IL49_SCD_CONTEXT_QUEUE_OFFSET(x) \ - (IL49_SCD_CONTEXT_DATA_OFFSET + ((x) * 8)) - -#define IL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS (0) -#define IL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK (0x0000007F) -#define IL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS (16) -#define IL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK (0x007F0000) - -/* - * Tx Status Bitmap - * - * Driver should clear this entire area (size 0x100) to 0 after receiving - * "Alive" notification from uCode. Area is used only by device itself; - * no other support (besides clearing) is required from driver. - */ -#define IL49_SCD_TX_STTS_BITMAP_OFFSET 0x400 - -/* - * RAxTID to queue translation mapping. - * - * When queue is in Scheduler-ACK mode, frames placed in a that queue must be - * for only one combination of receiver address (RA) and traffic ID (TID), i.e. - * one QOS priority level destined for one station (for this wireless link, - * not final destination). The SCD_TRANSLATE_TBL area provides 16 16-bit - * mappings, one for each of the 16 queues. If queue is not in Scheduler-ACK - * mode, the device ignores the mapping value. - * - * Bit fields, for each 16-bit map: - * 15-9: Reserved, set to 0 - * 8-4: Index into device's station table for recipient station - * 3-0: Traffic ID (tid), range 0-15 - * - * Driver should clear this entire area (size 32 bytes) to 0 after receiving - * "Alive" notification from uCode. To update a 16-bit map value, driver - * must read a dword-aligned value from device SRAM, replace the 16-bit map - * value of interest, and write the dword value back into device SRAM. - */ -#define IL49_SCD_TRANSLATE_TBL_OFFSET 0x500 - -/* Find translation table dword to read/write for given queue */ -#define IL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \ - ((IL49_SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffffffc) - -#define IL_SCD_TXFIFO_POS_TID (0) -#define IL_SCD_TXFIFO_POS_RA (4) -#define IL_SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF) - -/*********************** END TX SCHEDULER *************************************/ - -#endif /* __il_prph_h__ */ diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig deleted file mode 100644 index 56c2040a955b..000000000000 --- a/drivers/net/wireless/iwlwifi/Kconfig +++ /dev/null @@ -1,156 +0,0 @@ -config IWLWIFI - tristate "Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) " - depends on PCI && MAC80211 && HAS_IOMEM - select FW_LOADER - select NEW_LEDS - select LEDS_CLASS - select LEDS_TRIGGERS - select MAC80211_LEDS - ---help--- - Select to build the driver supporting the: - - Intel Wireless WiFi Link Next-Gen AGN - - This option enables support for use with the following hardware: - Intel Wireless WiFi Link 6250AGN Adapter - Intel 6000 Series Wi-Fi Adapters (6200AGN and 6300AGN) - Intel WiFi Link 1000BGN - Intel Wireless WiFi 5150AGN - Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN - Intel 6005 Series Wi-Fi Adapters - Intel 6030 Series Wi-Fi Adapters - Intel Wireless WiFi Link 6150BGN 2 Adapter - Intel 100 Series Wi-Fi Adapters (100BGN and 130BGN) - Intel 2000 Series Wi-Fi Adapters - - - This driver uses the kernel's mac80211 subsystem. - - In order to use this driver, you will need a microcode (uCode) - image for it. You can obtain the microcode from: - - . - - The microcode is typically installed in /lib/firmware. You can - look in the hotplug script /etc/hotplug/firmware.agent to - determine which directory FIRMWARE_DIR is set to when the script - runs. - - If you want to compile the driver as a module ( = code which can be - inserted in and removed from the running kernel whenever you want), - say M here and read . The - module will be called iwlwifi. - -config IWLDVM - tristate "Intel Wireless WiFi DVM Firmware support" - depends on IWLWIFI - default IWLWIFI - help - This is the driver supporting the DVM firmware which is - currently the only firmware available for existing devices. - -config IWLMVM - tristate "Intel Wireless WiFi MVM Firmware support" - depends on IWLWIFI - help - This is the driver supporting the MVM firmware which is - currently only available for 7000 series devices. - - Say yes if you have such a device. - -# don't call it _MODULE -- will confuse Kconfig/fixdep/... -config IWLWIFI_OPMODE_MODULAR - bool - default y if IWLDVM=m - default y if IWLMVM=m - -comment "WARNING: iwlwifi is useless without IWLDVM or IWLMVM" - depends on IWLWIFI && IWLDVM=n && IWLMVM=n - -menu "Debugging Options" - depends on IWLWIFI - -config IWLWIFI_DEBUG - bool "Enable full debugging output in the iwlwifi driver" - depends on IWLWIFI - ---help--- - This option will enable debug tracing output for the iwlwifi drivers - - This will result in the kernel module being ~100k larger. You can - control which debug output is sent to the kernel log by setting the - value in - - /sys/module/iwlwifi/parameters/debug - - This entry will only exist if this option is enabled. - - To set a value, simply echo an 8-byte hex value to the same file: - - % echo 0x43fff > /sys/module/iwlwifi/parameters/debug - - You can find the list of debug mask values in: - drivers/net/wireless/iwlwifi/iwl-debug.h - - If this is your first time using this driver, you should say Y here - as the debug information can assist others in helping you resolve - any problems you may encounter. - -config IWLWIFI_DEBUGFS - bool "iwlwifi debugfs support" - depends on IWLWIFI && MAC80211_DEBUGFS - ---help--- - Enable creation of debugfs files for the iwlwifi drivers. This - is a low-impact option that allows getting insight into the - driver's state at runtime. - -config IWLWIFI_DEBUG_EXPERIMENTAL_UCODE - bool "Experimental uCode support" - depends on IWLWIFI && IWLWIFI_DEBUG - ---help--- - Enable use of experimental ucode for testing and debugging. - -config IWLWIFI_DEVICE_TRACING - bool "iwlwifi device access tracing" - depends on IWLWIFI - depends on EVENT_TRACING - help - Say Y here to trace all commands, including TX frames and IO - accesses, sent to the device. If you say yes, iwlwifi will - register with the ftrace framework for event tracing and dump - all this information to the ringbuffer, you may need to - increase the ringbuffer size. See the ftrace documentation - for more information. - - When tracing is not enabled, this option still has some - (though rather small) overhead. - - If unsure, say Y so we can help you better when problems - occur. -endmenu - -config IWLWIFI_DEVICE_TESTMODE - def_bool y - depends on IWLWIFI - depends on NL80211_TESTMODE - help - This option enables the testmode support for iwlwifi device through - NL80211_TESTMODE. This provide the capabilities of enable user space - validation applications to interacts with the device through the - generic netlink message via NL80211_TESTMODE channel. - -config IWLWIFI_P2P - def_bool y - bool "iwlwifi experimental P2P support" - depends on IWLWIFI - help - This option enables experimental P2P support for some devices - based on microcode support. Since P2P support is still under - development, this option may even enable it for some devices - now that turn out to not support it in the future due to - microcode restrictions. - - To determine if your microcode supports the experimental P2P - offered by this option, check if the driver advertises AP - support when it is loaded. - - Say Y only if you want to experiment with P2P. diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile deleted file mode 100644 index 3b5613ea458b..000000000000 --- a/drivers/net/wireless/iwlwifi/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# common -obj-$(CONFIG_IWLWIFI) += iwlwifi.o -iwlwifi-objs += iwl-io.o -iwlwifi-objs += iwl-drv.o -iwlwifi-objs += iwl-debug.o -iwlwifi-objs += iwl-notif-wait.o -iwlwifi-objs += iwl-eeprom-read.o iwl-eeprom-parse.o -iwlwifi-objs += iwl-phy-db.o iwl-nvm-parse.o -iwlwifi-objs += pcie/drv.o pcie/rx.o pcie/tx.o pcie/trans.o -iwlwifi-objs += iwl-1000.o iwl-2000.o iwl-5000.o iwl-6000.o iwl-7000.o - -iwlwifi-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o -iwlwifi-$(CONFIG_IWLWIFI_DEVICE_TESTMODE) += iwl-test.o - -ccflags-y += -D__CHECK_ENDIAN__ -I$(src) - - -obj-$(CONFIG_IWLDVM) += dvm/ -obj-$(CONFIG_IWLMVM) += mvm/ - -CFLAGS_iwl-devtrace.o := -I$(src) diff --git a/drivers/net/wireless/iwlwifi/dvm/Makefile b/drivers/net/wireless/iwlwifi/dvm/Makefile deleted file mode 100644 index 5ff76b204141..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# DVM -obj-$(CONFIG_IWLDVM) += iwldvm.o -iwldvm-objs += main.o rs.o mac80211.o ucode.o tx.o -iwldvm-objs += lib.o calib.o tt.o sta.o rx.o - -iwldvm-objs += power.o -iwldvm-objs += scan.o led.o -iwldvm-objs += rxon.o devices.o - -iwldvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o -iwldvm-$(CONFIG_IWLWIFI_DEVICE_TESTMODE) += testmode.o - -ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/../ diff --git a/drivers/net/wireless/iwlwifi/dvm/agn.h b/drivers/net/wireless/iwlwifi/dvm/agn.h deleted file mode 100644 index 48545ab00311..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/agn.h +++ /dev/null @@ -1,532 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef __iwl_agn_h__ -#define __iwl_agn_h__ - -#include "iwl-config.h" - -#include "dev.h" - -/* The first 11 queues (0-10) are used otherwise */ -#define IWLAGN_FIRST_AMPDU_QUEUE 11 - -/* AUX (TX during scan dwell) queue */ -#define IWL_AUX_QUEUE 10 - -#define IWL_INVALID_STATION 255 - -/* device operations */ -extern struct iwl_lib_ops iwl1000_lib; -extern struct iwl_lib_ops iwl2000_lib; -extern struct iwl_lib_ops iwl2030_lib; -extern struct iwl_lib_ops iwl5000_lib; -extern struct iwl_lib_ops iwl5150_lib; -extern struct iwl_lib_ops iwl6000_lib; -extern struct iwl_lib_ops iwl6030_lib; - - -#define TIME_UNIT 1024 - -/***************************************************** -* DRIVER STATUS FUNCTIONS -******************************************************/ -#define STATUS_RF_KILL_HW 0 -#define STATUS_CT_KILL 1 -#define STATUS_ALIVE 2 -#define STATUS_READY 3 -#define STATUS_EXIT_PENDING 5 -#define STATUS_STATISTICS 6 -#define STATUS_SCANNING 7 -#define STATUS_SCAN_ABORTING 8 -#define STATUS_SCAN_HW 9 -#define STATUS_FW_ERROR 10 -#define STATUS_CHANNEL_SWITCH_PENDING 11 -#define STATUS_SCAN_COMPLETE 12 -#define STATUS_POWER_PMI 13 -#define STATUS_SCAN_ROC_EXPIRED 14 - -struct iwl_ucode_capabilities; - -extern struct ieee80211_ops iwlagn_hw_ops; - -static inline void iwl_set_calib_hdr(struct iwl_calib_hdr *hdr, u8 cmd) -{ - hdr->op_code = cmd; - hdr->first_group = 0; - hdr->groups_num = 1; - hdr->data_valid = 1; -} - -void iwl_down(struct iwl_priv *priv); -void iwl_cancel_deferred_work(struct iwl_priv *priv); -void iwlagn_prepare_restart(struct iwl_priv *priv); -int __must_check iwl_rx_dispatch(struct iwl_op_mode *op_mode, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); - -bool iwl_check_for_ct_kill(struct iwl_priv *priv); - -void iwlagn_lift_passive_no_rx(struct iwl_priv *priv); - -/* MAC80211 */ -struct ieee80211_hw *iwl_alloc_all(void); -int iwlagn_mac_setup_register(struct iwl_priv *priv, - const struct iwl_ucode_capabilities *capa); -void iwlagn_mac_unregister(struct iwl_priv *priv); - -/* commands */ -int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd); -int iwl_dvm_send_cmd_pdu(struct iwl_priv *priv, u8 id, - u32 flags, u16 len, const void *data); - -/* RXON */ -void iwl_connection_init_rx_config(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); -int iwlagn_set_pan_params(struct iwl_priv *priv); -int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx); -void iwlagn_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx); -int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed); -void iwlagn_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changes); -void iwlagn_config_ht40(struct ieee80211_conf *conf, - struct iwl_rxon_context *ctx); -void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); -void iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch, - struct iwl_rxon_context *ctx); -void iwl_set_flags_for_band(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - enum ieee80211_band band, - struct ieee80211_vif *vif); - -/* uCode */ -int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type); -void iwl_send_prio_tbl(struct iwl_priv *priv); -int iwl_init_alive_start(struct iwl_priv *priv); -int iwl_run_init_ucode(struct iwl_priv *priv); -int iwl_load_ucode_wait_alive(struct iwl_priv *priv, - enum iwl_ucode_type ucode_type); -int iwl_send_calib_results(struct iwl_priv *priv); -int iwl_calib_set(struct iwl_priv *priv, - const struct iwl_calib_hdr *cmd, int len); -void iwl_calib_free_results(struct iwl_priv *priv); -int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, - char **buf); -int iwlagn_hw_valid_rtc_data_addr(u32 addr); - -/* lib */ -int iwlagn_send_tx_power(struct iwl_priv *priv); -void iwlagn_temperature(struct iwl_priv *priv); -int iwlagn_txfifo_flush(struct iwl_priv *priv, u32 scd_q_msk); -void iwlagn_dev_txfifo_flush(struct iwl_priv *priv); -int iwlagn_send_beacon_cmd(struct iwl_priv *priv); -int iwl_send_statistics_request(struct iwl_priv *priv, - u8 flags, bool clear); - -static inline const struct ieee80211_supported_band *iwl_get_hw_mode( - struct iwl_priv *priv, enum ieee80211_band band) -{ - return priv->hw->wiphy->bands[band]; -} - -#ifdef CONFIG_PM_SLEEP -int iwlagn_send_patterns(struct iwl_priv *priv, - struct cfg80211_wowlan *wowlan); -int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan); -#endif - -/* rx */ -int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band); -void iwl_setup_rx_handlers(struct iwl_priv *priv); -void iwl_chswitch_done(struct iwl_priv *priv, bool is_success); - - -/* tx */ -int iwlagn_tx_skb(struct iwl_priv *priv, - struct ieee80211_sta *sta, - struct sk_buff *skb); -int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid, u16 *ssn); -int iwlagn_tx_agg_oper(struct iwl_priv *priv, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid, u8 buf_size); -int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid); -int iwlagn_tx_agg_flush(struct iwl_priv *priv, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid); -int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); - -static inline u32 iwl_tx_status_to_mac80211(u32 status) -{ - status &= TX_STATUS_MSK; - - switch (status) { - case TX_STATUS_SUCCESS: - case TX_STATUS_DIRECT_DONE: - return IEEE80211_TX_STAT_ACK; - case TX_STATUS_FAIL_DEST_PS: - case TX_STATUS_FAIL_PASSIVE_NO_RX: - return IEEE80211_TX_STAT_TX_FILTERED; - default: - return 0; - } -} - -static inline bool iwl_is_tx_success(u32 status) -{ - status &= TX_STATUS_MSK; - return (status == TX_STATUS_SUCCESS) || - (status == TX_STATUS_DIRECT_DONE); -} - -u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant_idx, u8 valid); - -/* scan */ -void iwlagn_post_scan(struct iwl_priv *priv); -void iwlagn_disable_roc(struct iwl_priv *priv); -int iwl_force_rf_reset(struct iwl_priv *priv, bool external); -void iwl_init_scan_params(struct iwl_priv *priv); -int iwl_scan_cancel(struct iwl_priv *priv); -void iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); -void iwl_force_scan_end(struct iwl_priv *priv); -void iwl_internal_short_hw_scan(struct iwl_priv *priv); -void iwl_setup_rx_scan_handlers(struct iwl_priv *priv); -void iwl_setup_scan_deferred_work(struct iwl_priv *priv); -void iwl_cancel_scan_deferred_work(struct iwl_priv *priv); -int __must_check iwl_scan_initiate(struct iwl_priv *priv, - struct ieee80211_vif *vif, - enum iwl_scan_type scan_type, - enum ieee80211_band band); - -void iwl_scan_roc_expired(struct iwl_priv *priv); -void iwl_scan_offchannel_skb(struct iwl_priv *priv); -void iwl_scan_offchannel_skb_status(struct iwl_priv *priv); - -/* For faster active scanning, scan will move to the next channel if fewer than - * PLCP_QUIET_THRESH packets are heard on this channel within - * ACTIVE_QUIET_TIME after sending probe request. This shortens the dwell - * time if it's a quiet channel (nothing responded to our probe, and there's - * no other traffic). - * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */ -#define IWL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */ -#define IWL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */ - -#define IWL_SCAN_CHECK_WATCHDOG (HZ * 15) - - -/* bt coex */ -void iwlagn_send_advance_bt_config(struct iwl_priv *priv); -int iwlagn_bt_coex_profile_notif(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -void iwlagn_bt_rx_handler_setup(struct iwl_priv *priv); -void iwlagn_bt_setup_deferred_work(struct iwl_priv *priv); -void iwlagn_bt_cancel_deferred_work(struct iwl_priv *priv); -void iwlagn_bt_coex_rssi_monitor(struct iwl_priv *priv); -void iwlagn_bt_adjust_rssi_monitor(struct iwl_priv *priv, bool rssi_ena); - -static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv) -{ - return priv->cfg->bt_params && - priv->cfg->bt_params->advanced_bt_coexist; -} - -#ifdef CONFIG_IWLWIFI_DEBUG -const char *iwl_get_tx_fail_reason(u32 status); -const char *iwl_get_agg_tx_fail_reason(u16 status); -#else -static inline const char *iwl_get_tx_fail_reason(u32 status) { return ""; } -static inline const char *iwl_get_agg_tx_fail_reason(u16 status) { return ""; } -#endif - - -/* station management */ -int iwlagn_manage_ibss_station(struct iwl_priv *priv, - struct ieee80211_vif *vif, bool add); -#define IWL_STA_DRIVER_ACTIVE BIT(0) /* driver entry is active */ -#define IWL_STA_UCODE_ACTIVE BIT(1) /* ucode entry is active */ -#define IWL_STA_UCODE_INPROGRESS BIT(2) /* ucode entry is in process of - being activated */ -#define IWL_STA_LOCAL BIT(3) /* station state not directed by mac80211; - (this is for the IBSS BSSID stations) */ -#define IWL_STA_BCAST BIT(4) /* this station is the special bcast station */ - - -void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx); -void iwl_clear_ucode_stations(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); -void iwl_dealloc_bcast_stations(struct iwl_priv *priv); -int iwl_get_free_ucode_key_offset(struct iwl_priv *priv); -int iwl_send_add_sta(struct iwl_priv *priv, - struct iwl_addsta_cmd *sta, u8 flags); -int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - const u8 *addr, bool is_ap, - struct ieee80211_sta *sta, u8 *sta_id_r); -int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, - const u8 *addr); -void iwl_deactivate_station(struct iwl_priv *priv, const u8 sta_id, - const u8 *addr); -u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - const u8 *addr, bool is_ap, struct ieee80211_sta *sta); - -int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - struct iwl_link_quality_cmd *lq, u8 flags, bool init); -int iwl_add_sta_callback(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -int iwl_sta_update_ht(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - struct ieee80211_sta *sta); - -bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct ieee80211_sta *sta); - -static inline int iwl_sta_id(struct ieee80211_sta *sta) -{ - if (WARN_ON(!sta)) - return IWL_INVALID_STATION; - - return ((struct iwl_station_priv *)sta->drv_priv)->sta_id; -} - -int iwlagn_alloc_bcast_station(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); -int iwlagn_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - const u8 *addr, u8 *sta_id_r); -int iwl_remove_default_wep_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct ieee80211_key_conf *key); -int iwl_set_default_wep_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct ieee80211_key_conf *key); -int iwl_restore_default_wep_keys(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); -int iwl_set_dynamic_key(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - struct ieee80211_key_conf *key, - struct ieee80211_sta *sta); -int iwl_remove_dynamic_key(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - struct ieee80211_key_conf *key, - struct ieee80211_sta *sta); -void iwl_update_tkip_key(struct iwl_priv *priv, - struct ieee80211_vif *vif, - struct ieee80211_key_conf *keyconf, - struct ieee80211_sta *sta, u32 iv32, u16 *phase1key); -int iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid); -int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, - int tid, u16 ssn); -int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, - int tid); -void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt); -int iwl_update_bcast_station(struct iwl_priv *priv, - struct iwl_rxon_context *ctx); -int iwl_update_bcast_stations(struct iwl_priv *priv); - -/* rate */ -static inline u32 iwl_ant_idx_to_flags(u8 ant_idx) -{ - return BIT(ant_idx) << RATE_MCS_ANT_POS; -} - -static inline u8 iwl_hw_get_rate(__le32 rate_n_flags) -{ - return le32_to_cpu(rate_n_flags) & RATE_MCS_RATE_MSK; -} - -static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags) -{ - return cpu_to_le32(flags|(u32)rate); -} - -extern int iwl_alive_start(struct iwl_priv *priv); - -/* testmode support */ -#ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE - -extern int iwlagn_mac_testmode_cmd(struct ieee80211_hw *hw, void *data, - int len); -extern int iwlagn_mac_testmode_dump(struct ieee80211_hw *hw, - struct sk_buff *skb, - struct netlink_callback *cb, - void *data, int len); -extern void iwl_testmode_init(struct iwl_priv *priv); -extern void iwl_testmode_free(struct iwl_priv *priv); - -#else - -static inline -int iwlagn_mac_testmode_cmd(struct ieee80211_hw *hw, void *data, int len) -{ - return -ENOSYS; -} - -static inline -int iwlagn_mac_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb, - struct netlink_callback *cb, - void *data, int len) -{ - return -ENOSYS; -} - -static inline void iwl_testmode_init(struct iwl_priv *priv) -{ -} - -static inline void iwl_testmode_free(struct iwl_priv *priv) -{ -} -#endif - -#ifdef CONFIG_IWLWIFI_DEBUG -void iwl_print_rx_config_cmd(struct iwl_priv *priv, - enum iwl_rxon_context_id ctxid); -#else -static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv, - enum iwl_rxon_context_id ctxid) -{ -} -#endif - -/* status checks */ - -static inline int iwl_is_ready(struct iwl_priv *priv) -{ - /* The adapter is 'ready' if READY EXIT_PENDING is not set */ - return test_bit(STATUS_READY, &priv->status) && - !test_bit(STATUS_EXIT_PENDING, &priv->status); -} - -static inline int iwl_is_alive(struct iwl_priv *priv) -{ - return test_bit(STATUS_ALIVE, &priv->status); -} - -static inline int iwl_is_rfkill(struct iwl_priv *priv) -{ - return test_bit(STATUS_RF_KILL_HW, &priv->status); -} - -static inline int iwl_is_ctkill(struct iwl_priv *priv) -{ - return test_bit(STATUS_CT_KILL, &priv->status); -} - -static inline int iwl_is_ready_rf(struct iwl_priv *priv) -{ - if (iwl_is_rfkill(priv)) - return 0; - - return iwl_is_ready(priv); -} - -static inline void iwl_dvm_set_pmi(struct iwl_priv *priv, bool state) -{ - if (state) - set_bit(STATUS_POWER_PMI, &priv->status); - else - clear_bit(STATUS_POWER_PMI, &priv->status); - iwl_trans_set_pmi(priv->trans, state); -} - -#ifdef CONFIG_IWLWIFI_DEBUGFS -int iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir); -#else -static inline int iwl_dbgfs_register(struct iwl_priv *priv, - struct dentry *dbgfs_dir) -{ - return 0; -} -#endif /* CONFIG_IWLWIFI_DEBUGFS */ - -#ifdef CONFIG_IWLWIFI_DEBUG -#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \ -do { \ - if (!iwl_is_rfkill((m))) \ - IWL_ERR(m, fmt, ##args); \ - else \ - __iwl_err((m)->dev, true, \ - !iwl_have_debug_level(IWL_DL_RADIO), \ - fmt, ##args); \ -} while (0) -#else -#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \ -do { \ - if (!iwl_is_rfkill((m))) \ - IWL_ERR(m, fmt, ##args); \ - else \ - __iwl_err((m)->dev, true, true, fmt, ##args); \ -} while (0) -#endif /* CONFIG_IWLWIFI_DEBUG */ - -extern const char *iwl_dvm_cmd_strings[REPLY_MAX]; - -static inline const char *iwl_dvm_get_cmd_string(u8 cmd) -{ - const char *s = iwl_dvm_cmd_strings[cmd]; - if (s) - return s; - return "UNKNOWN"; -} -#endif /* __iwl_agn_h__ */ diff --git a/drivers/net/wireless/iwlwifi/dvm/calib.c b/drivers/net/wireless/iwlwifi/dvm/calib.c deleted file mode 100644 index d6c4cf2ad7c5..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/calib.c +++ /dev/null @@ -1,1114 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#include -#include - -#include "iwl-trans.h" - -#include "dev.h" -#include "calib.h" -#include "agn.h" - -/***************************************************************************** - * INIT calibrations framework - *****************************************************************************/ - -/* Opaque calibration results */ -struct iwl_calib_result { - struct list_head list; - size_t cmd_len; - struct iwl_calib_hdr hdr; - /* data follows */ -}; - -struct statistics_general_data { - u32 beacon_silence_rssi_a; - u32 beacon_silence_rssi_b; - u32 beacon_silence_rssi_c; - u32 beacon_energy_a; - u32 beacon_energy_b; - u32 beacon_energy_c; -}; - -int iwl_send_calib_results(struct iwl_priv *priv) -{ - struct iwl_host_cmd hcmd = { - .id = REPLY_PHY_CALIBRATION_CMD, - .flags = CMD_SYNC, - }; - struct iwl_calib_result *res; - - list_for_each_entry(res, &priv->calib_results, list) { - int ret; - - hcmd.len[0] = res->cmd_len; - hcmd.data[0] = &res->hdr; - hcmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY; - ret = iwl_dvm_send_cmd(priv, &hcmd); - if (ret) { - IWL_ERR(priv, "Error %d on calib cmd %d\n", - ret, res->hdr.op_code); - return ret; - } - } - - return 0; -} - -int iwl_calib_set(struct iwl_priv *priv, - const struct iwl_calib_hdr *cmd, int len) -{ - struct iwl_calib_result *res, *tmp; - - res = kmalloc(sizeof(*res) + len - sizeof(struct iwl_calib_hdr), - GFP_ATOMIC); - if (!res) - return -ENOMEM; - memcpy(&res->hdr, cmd, len); - res->cmd_len = len; - - list_for_each_entry(tmp, &priv->calib_results, list) { - if (tmp->hdr.op_code == res->hdr.op_code) { - list_replace(&tmp->list, &res->list); - kfree(tmp); - return 0; - } - } - - /* wasn't in list already */ - list_add_tail(&res->list, &priv->calib_results); - - return 0; -} - -void iwl_calib_free_results(struct iwl_priv *priv) -{ - struct iwl_calib_result *res, *tmp; - - list_for_each_entry_safe(res, tmp, &priv->calib_results, list) { - list_del(&res->list); - kfree(res); - } -} - -/***************************************************************************** - * RUNTIME calibrations framework - *****************************************************************************/ - -/* "false alarms" are signals that our DSP tries to lock onto, - * but then determines that they are either noise, or transmissions - * from a distant wireless network (also "noise", really) that get - * "stepped on" by stronger transmissions within our own network. - * This algorithm attempts to set a sensitivity level that is high - * enough to receive all of our own network traffic, but not so - * high that our DSP gets too busy trying to lock onto non-network - * activity/noise. */ -static int iwl_sens_energy_cck(struct iwl_priv *priv, - u32 norm_fa, - u32 rx_enable_time, - struct statistics_general_data *rx_info) -{ - u32 max_nrg_cck = 0; - int i = 0; - u8 max_silence_rssi = 0; - u32 silence_ref = 0; - u8 silence_rssi_a = 0; - u8 silence_rssi_b = 0; - u8 silence_rssi_c = 0; - u32 val; - - /* "false_alarms" values below are cross-multiplications to assess the - * numbers of false alarms within the measured period of actual Rx - * (Rx is off when we're txing), vs the min/max expected false alarms - * (some should be expected if rx is sensitive enough) in a - * hypothetical listening period of 200 time units (TU), 204.8 msec: - * - * MIN_FA/fixed-time < false_alarms/actual-rx-time < MAX_FA/beacon-time - * - * */ - u32 false_alarms = norm_fa * 200 * 1024; - u32 max_false_alarms = MAX_FA_CCK * rx_enable_time; - u32 min_false_alarms = MIN_FA_CCK * rx_enable_time; - struct iwl_sensitivity_data *data = NULL; - const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; - - data = &(priv->sensitivity_data); - - data->nrg_auto_corr_silence_diff = 0; - - /* Find max silence rssi among all 3 receivers. - * This is background noise, which may include transmissions from other - * networks, measured during silence before our network's beacon */ - silence_rssi_a = (u8)((rx_info->beacon_silence_rssi_a & - ALL_BAND_FILTER) >> 8); - silence_rssi_b = (u8)((rx_info->beacon_silence_rssi_b & - ALL_BAND_FILTER) >> 8); - silence_rssi_c = (u8)((rx_info->beacon_silence_rssi_c & - ALL_BAND_FILTER) >> 8); - - val = max(silence_rssi_b, silence_rssi_c); - max_silence_rssi = max(silence_rssi_a, (u8) val); - - /* Store silence rssi in 20-beacon history table */ - data->nrg_silence_rssi[data->nrg_silence_idx] = max_silence_rssi; - data->nrg_silence_idx++; - if (data->nrg_silence_idx >= NRG_NUM_PREV_STAT_L) - data->nrg_silence_idx = 0; - - /* Find max silence rssi across 20 beacon history */ - for (i = 0; i < NRG_NUM_PREV_STAT_L; i++) { - val = data->nrg_silence_rssi[i]; - silence_ref = max(silence_ref, val); - } - IWL_DEBUG_CALIB(priv, "silence a %u, b %u, c %u, 20-bcn max %u\n", - silence_rssi_a, silence_rssi_b, silence_rssi_c, - silence_ref); - - /* Find max rx energy (min value!) among all 3 receivers, - * measured during beacon frame. - * Save it in 10-beacon history table. */ - i = data->nrg_energy_idx; - val = min(rx_info->beacon_energy_b, rx_info->beacon_energy_c); - data->nrg_value[i] = min(rx_info->beacon_energy_a, val); - - data->nrg_energy_idx++; - if (data->nrg_energy_idx >= 10) - data->nrg_energy_idx = 0; - - /* Find min rx energy (max value) across 10 beacon history. - * This is the minimum signal level that we want to receive well. - * Add backoff (margin so we don't miss slightly lower energy frames). - * This establishes an upper bound (min value) for energy threshold. */ - max_nrg_cck = data->nrg_value[0]; - for (i = 1; i < 10; i++) - max_nrg_cck = (u32) max(max_nrg_cck, (data->nrg_value[i])); - max_nrg_cck += 6; - - IWL_DEBUG_CALIB(priv, "rx energy a %u, b %u, c %u, 10-bcn max/min %u\n", - rx_info->beacon_energy_a, rx_info->beacon_energy_b, - rx_info->beacon_energy_c, max_nrg_cck - 6); - - /* Count number of consecutive beacons with fewer-than-desired - * false alarms. */ - if (false_alarms < min_false_alarms) - data->num_in_cck_no_fa++; - else - data->num_in_cck_no_fa = 0; - IWL_DEBUG_CALIB(priv, "consecutive bcns with few false alarms = %u\n", - data->num_in_cck_no_fa); - - /* If we got too many false alarms this time, reduce sensitivity */ - if ((false_alarms > max_false_alarms) && - (data->auto_corr_cck > AUTO_CORR_MAX_TH_CCK)) { - IWL_DEBUG_CALIB(priv, "norm FA %u > max FA %u\n", - false_alarms, max_false_alarms); - IWL_DEBUG_CALIB(priv, "... reducing sensitivity\n"); - data->nrg_curr_state = IWL_FA_TOO_MANY; - /* Store for "fewer than desired" on later beacon */ - data->nrg_silence_ref = silence_ref; - - /* increase energy threshold (reduce nrg value) - * to decrease sensitivity */ - data->nrg_th_cck = data->nrg_th_cck - NRG_STEP_CCK; - /* Else if we got fewer than desired, increase sensitivity */ - } else if (false_alarms < min_false_alarms) { - data->nrg_curr_state = IWL_FA_TOO_FEW; - - /* Compare silence level with silence level for most recent - * healthy number or too many false alarms */ - data->nrg_auto_corr_silence_diff = (s32)data->nrg_silence_ref - - (s32)silence_ref; - - IWL_DEBUG_CALIB(priv, "norm FA %u < min FA %u, silence diff %d\n", - false_alarms, min_false_alarms, - data->nrg_auto_corr_silence_diff); - - /* Increase value to increase sensitivity, but only if: - * 1a) previous beacon did *not* have *too many* false alarms - * 1b) AND there's a significant difference in Rx levels - * from a previous beacon with too many, or healthy # FAs - * OR 2) We've seen a lot of beacons (100) with too few - * false alarms */ - if ((data->nrg_prev_state != IWL_FA_TOO_MANY) && - ((data->nrg_auto_corr_silence_diff > NRG_DIFF) || - (data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA))) { - - IWL_DEBUG_CALIB(priv, "... increasing sensitivity\n"); - /* Increase nrg value to increase sensitivity */ - val = data->nrg_th_cck + NRG_STEP_CCK; - data->nrg_th_cck = min((u32)ranges->min_nrg_cck, val); - } else { - IWL_DEBUG_CALIB(priv, "... but not changing sensitivity\n"); - } - - /* Else we got a healthy number of false alarms, keep status quo */ - } else { - IWL_DEBUG_CALIB(priv, " FA in safe zone\n"); - data->nrg_curr_state = IWL_FA_GOOD_RANGE; - - /* Store for use in "fewer than desired" with later beacon */ - data->nrg_silence_ref = silence_ref; - - /* If previous beacon had too many false alarms, - * give it some extra margin by reducing sensitivity again - * (but don't go below measured energy of desired Rx) */ - if (IWL_FA_TOO_MANY == data->nrg_prev_state) { - IWL_DEBUG_CALIB(priv, "... increasing margin\n"); - if (data->nrg_th_cck > (max_nrg_cck + NRG_MARGIN)) - data->nrg_th_cck -= NRG_MARGIN; - else - data->nrg_th_cck = max_nrg_cck; - } - } - - /* Make sure the energy threshold does not go above the measured - * energy of the desired Rx signals (reduced by backoff margin), - * or else we might start missing Rx frames. - * Lower value is higher energy, so we use max()! - */ - data->nrg_th_cck = max(max_nrg_cck, data->nrg_th_cck); - IWL_DEBUG_CALIB(priv, "new nrg_th_cck %u\n", data->nrg_th_cck); - - data->nrg_prev_state = data->nrg_curr_state; - - /* Auto-correlation CCK algorithm */ - if (false_alarms > min_false_alarms) { - - /* increase auto_corr values to decrease sensitivity - * so the DSP won't be disturbed by the noise - */ - if (data->auto_corr_cck < AUTO_CORR_MAX_TH_CCK) - data->auto_corr_cck = AUTO_CORR_MAX_TH_CCK + 1; - else { - val = data->auto_corr_cck + AUTO_CORR_STEP_CCK; - data->auto_corr_cck = - min((u32)ranges->auto_corr_max_cck, val); - } - val = data->auto_corr_cck_mrc + AUTO_CORR_STEP_CCK; - data->auto_corr_cck_mrc = - min((u32)ranges->auto_corr_max_cck_mrc, val); - } else if ((false_alarms < min_false_alarms) && - ((data->nrg_auto_corr_silence_diff > NRG_DIFF) || - (data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA))) { - - /* Decrease auto_corr values to increase sensitivity */ - val = data->auto_corr_cck - AUTO_CORR_STEP_CCK; - data->auto_corr_cck = - max((u32)ranges->auto_corr_min_cck, val); - val = data->auto_corr_cck_mrc - AUTO_CORR_STEP_CCK; - data->auto_corr_cck_mrc = - max((u32)ranges->auto_corr_min_cck_mrc, val); - } - - return 0; -} - - -static int iwl_sens_auto_corr_ofdm(struct iwl_priv *priv, - u32 norm_fa, - u32 rx_enable_time) -{ - u32 val; - u32 false_alarms = norm_fa * 200 * 1024; - u32 max_false_alarms = MAX_FA_OFDM * rx_enable_time; - u32 min_false_alarms = MIN_FA_OFDM * rx_enable_time; - struct iwl_sensitivity_data *data = NULL; - const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; - - data = &(priv->sensitivity_data); - - /* If we got too many false alarms this time, reduce sensitivity */ - if (false_alarms > max_false_alarms) { - - IWL_DEBUG_CALIB(priv, "norm FA %u > max FA %u)\n", - false_alarms, max_false_alarms); - - val = data->auto_corr_ofdm + AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm = - min((u32)ranges->auto_corr_max_ofdm, val); - - val = data->auto_corr_ofdm_mrc + AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm_mrc = - min((u32)ranges->auto_corr_max_ofdm_mrc, val); - - val = data->auto_corr_ofdm_x1 + AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm_x1 = - min((u32)ranges->auto_corr_max_ofdm_x1, val); - - val = data->auto_corr_ofdm_mrc_x1 + AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm_mrc_x1 = - min((u32)ranges->auto_corr_max_ofdm_mrc_x1, val); - } - - /* Else if we got fewer than desired, increase sensitivity */ - else if (false_alarms < min_false_alarms) { - - IWL_DEBUG_CALIB(priv, "norm FA %u < min FA %u\n", - false_alarms, min_false_alarms); - - val = data->auto_corr_ofdm - AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm = - max((u32)ranges->auto_corr_min_ofdm, val); - - val = data->auto_corr_ofdm_mrc - AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm_mrc = - max((u32)ranges->auto_corr_min_ofdm_mrc, val); - - val = data->auto_corr_ofdm_x1 - AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm_x1 = - max((u32)ranges->auto_corr_min_ofdm_x1, val); - - val = data->auto_corr_ofdm_mrc_x1 - AUTO_CORR_STEP_OFDM; - data->auto_corr_ofdm_mrc_x1 = - max((u32)ranges->auto_corr_min_ofdm_mrc_x1, val); - } else { - IWL_DEBUG_CALIB(priv, "min FA %u < norm FA %u < max FA %u OK\n", - min_false_alarms, false_alarms, max_false_alarms); - } - return 0; -} - -static void iwl_prepare_legacy_sensitivity_tbl(struct iwl_priv *priv, - struct iwl_sensitivity_data *data, - __le16 *tbl) -{ - tbl[HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX] = - cpu_to_le16((u16)data->auto_corr_ofdm); - tbl[HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX] = - cpu_to_le16((u16)data->auto_corr_ofdm_mrc); - tbl[HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX] = - cpu_to_le16((u16)data->auto_corr_ofdm_x1); - tbl[HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX] = - cpu_to_le16((u16)data->auto_corr_ofdm_mrc_x1); - - tbl[HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX] = - cpu_to_le16((u16)data->auto_corr_cck); - tbl[HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX] = - cpu_to_le16((u16)data->auto_corr_cck_mrc); - - tbl[HD_MIN_ENERGY_CCK_DET_INDEX] = - cpu_to_le16((u16)data->nrg_th_cck); - tbl[HD_MIN_ENERGY_OFDM_DET_INDEX] = - cpu_to_le16((u16)data->nrg_th_ofdm); - - tbl[HD_BARKER_CORR_TH_ADD_MIN_INDEX] = - cpu_to_le16(data->barker_corr_th_min); - tbl[HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX] = - cpu_to_le16(data->barker_corr_th_min_mrc); - tbl[HD_OFDM_ENERGY_TH_IN_INDEX] = - cpu_to_le16(data->nrg_th_cca); - - IWL_DEBUG_CALIB(priv, "ofdm: ac %u mrc %u x1 %u mrc_x1 %u thresh %u\n", - data->auto_corr_ofdm, data->auto_corr_ofdm_mrc, - data->auto_corr_ofdm_x1, data->auto_corr_ofdm_mrc_x1, - data->nrg_th_ofdm); - - IWL_DEBUG_CALIB(priv, "cck: ac %u mrc %u thresh %u\n", - data->auto_corr_cck, data->auto_corr_cck_mrc, - data->nrg_th_cck); -} - -/* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ -static int iwl_sensitivity_write(struct iwl_priv *priv) -{ - struct iwl_sensitivity_cmd cmd; - struct iwl_sensitivity_data *data = NULL; - struct iwl_host_cmd cmd_out = { - .id = SENSITIVITY_CMD, - .len = { sizeof(struct iwl_sensitivity_cmd), }, - .flags = CMD_ASYNC, - .data = { &cmd, }, - }; - - data = &(priv->sensitivity_data); - - memset(&cmd, 0, sizeof(cmd)); - - iwl_prepare_legacy_sensitivity_tbl(priv, data, &cmd.table[0]); - - /* Update uCode's "work" table, and copy it to DSP */ - cmd.control = SENSITIVITY_CMD_CONTROL_WORK_TABLE; - - /* Don't send command to uCode if nothing has changed */ - if (!memcmp(&cmd.table[0], &(priv->sensitivity_tbl[0]), - sizeof(u16)*HD_TABLE_SIZE)) { - IWL_DEBUG_CALIB(priv, "No change in SENSITIVITY_CMD\n"); - return 0; - } - - /* Copy table for comparison next time */ - memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]), - sizeof(u16)*HD_TABLE_SIZE); - - return iwl_dvm_send_cmd(priv, &cmd_out); -} - -/* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ -static int iwl_enhance_sensitivity_write(struct iwl_priv *priv) -{ - struct iwl_enhance_sensitivity_cmd cmd; - struct iwl_sensitivity_data *data = NULL; - struct iwl_host_cmd cmd_out = { - .id = SENSITIVITY_CMD, - .len = { sizeof(struct iwl_enhance_sensitivity_cmd), }, - .flags = CMD_ASYNC, - .data = { &cmd, }, - }; - - data = &(priv->sensitivity_data); - - memset(&cmd, 0, sizeof(cmd)); - - iwl_prepare_legacy_sensitivity_tbl(priv, data, &cmd.enhance_table[0]); - - if (priv->cfg->base_params->hd_v2) { - cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX] = - HD_INA_NON_SQUARE_DET_OFDM_DATA_V2; - cmd.enhance_table[HD_INA_NON_SQUARE_DET_CCK_INDEX] = - HD_INA_NON_SQUARE_DET_CCK_DATA_V2; - cmd.enhance_table[HD_CORR_11_INSTEAD_OF_CORR_9_EN_INDEX] = - HD_CORR_11_INSTEAD_OF_CORR_9_EN_DATA_V2; - cmd.enhance_table[HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_INDEX] = - HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_DATA_V2; - cmd.enhance_table[HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_INDEX] = - HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V2; - cmd.enhance_table[HD_OFDM_NON_SQUARE_DET_SLOPE_INDEX] = - HD_OFDM_NON_SQUARE_DET_SLOPE_DATA_V2; - cmd.enhance_table[HD_OFDM_NON_SQUARE_DET_INTERCEPT_INDEX] = - HD_OFDM_NON_SQUARE_DET_INTERCEPT_DATA_V2; - cmd.enhance_table[HD_CCK_NON_SQUARE_DET_SLOPE_MRC_INDEX] = - HD_CCK_NON_SQUARE_DET_SLOPE_MRC_DATA_V2; - cmd.enhance_table[HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_INDEX] = - HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V2; - cmd.enhance_table[HD_CCK_NON_SQUARE_DET_SLOPE_INDEX] = - HD_CCK_NON_SQUARE_DET_SLOPE_DATA_V2; - cmd.enhance_table[HD_CCK_NON_SQUARE_DET_INTERCEPT_INDEX] = - HD_CCK_NON_SQUARE_DET_INTERCEPT_DATA_V2; - } else { - cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX] = - HD_INA_NON_SQUARE_DET_OFDM_DATA_V1; - cmd.enhance_table[HD_INA_NON_SQUARE_DET_CCK_INDEX] = - HD_INA_NON_SQUARE_DET_CCK_DATA_V1; - cmd.enhance_table[HD_CORR_11_INSTEAD_OF_CORR_9_EN_INDEX] = - HD_CORR_11_INSTEAD_OF_CORR_9_EN_DATA_V1; - cmd.enhance_table[HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_INDEX] = - HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_DATA_V1; - cmd.enhance_table[HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_INDEX] = - HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V1; - cmd.enhance_table[HD_OFDM_NON_SQUARE_DET_SLOPE_INDEX] = - HD_OFDM_NON_SQUARE_DET_SLOPE_DATA_V1; - cmd.enhance_table[HD_OFDM_NON_SQUARE_DET_INTERCEPT_INDEX] = - HD_OFDM_NON_SQUARE_DET_INTERCEPT_DATA_V1; - cmd.enhance_table[HD_CCK_NON_SQUARE_DET_SLOPE_MRC_INDEX] = - HD_CCK_NON_SQUARE_DET_SLOPE_MRC_DATA_V1; - cmd.enhance_table[HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_INDEX] = - HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V1; - cmd.enhance_table[HD_CCK_NON_SQUARE_DET_SLOPE_INDEX] = - HD_CCK_NON_SQUARE_DET_SLOPE_DATA_V1; - cmd.enhance_table[HD_CCK_NON_SQUARE_DET_INTERCEPT_INDEX] = - HD_CCK_NON_SQUARE_DET_INTERCEPT_DATA_V1; - } - - /* Update uCode's "work" table, and copy it to DSP */ - cmd.control = SENSITIVITY_CMD_CONTROL_WORK_TABLE; - - /* Don't send command to uCode if nothing has changed */ - if (!memcmp(&cmd.enhance_table[0], &(priv->sensitivity_tbl[0]), - sizeof(u16)*HD_TABLE_SIZE) && - !memcmp(&cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX], - &(priv->enhance_sensitivity_tbl[0]), - sizeof(u16)*ENHANCE_HD_TABLE_ENTRIES)) { - IWL_DEBUG_CALIB(priv, "No change in SENSITIVITY_CMD\n"); - return 0; - } - - /* Copy table for comparison next time */ - memcpy(&(priv->sensitivity_tbl[0]), &(cmd.enhance_table[0]), - sizeof(u16)*HD_TABLE_SIZE); - memcpy(&(priv->enhance_sensitivity_tbl[0]), - &(cmd.enhance_table[HD_INA_NON_SQUARE_DET_OFDM_INDEX]), - sizeof(u16)*ENHANCE_HD_TABLE_ENTRIES); - - return iwl_dvm_send_cmd(priv, &cmd_out); -} - -void iwl_init_sensitivity(struct iwl_priv *priv) -{ - int ret = 0; - int i; - struct iwl_sensitivity_data *data = NULL; - const struct iwl_sensitivity_ranges *ranges = priv->hw_params.sens; - - if (priv->calib_disabled & IWL_SENSITIVITY_CALIB_DISABLED) - return; - - IWL_DEBUG_CALIB(priv, "Start iwl_init_sensitivity\n"); - - /* Clear driver's sensitivity algo data */ - data = &(priv->sensitivity_data); - - if (ranges == NULL) - return; - - memset(data, 0, sizeof(struct iwl_sensitivity_data)); - - data->num_in_cck_no_fa = 0; - data->nrg_curr_state = IWL_FA_TOO_MANY; - data->nrg_prev_state = IWL_FA_TOO_MANY; - data->nrg_silence_ref = 0; - data->nrg_silence_idx = 0; - data->nrg_energy_idx = 0; - - for (i = 0; i < 10; i++) - data->nrg_value[i] = 0; - - for (i = 0; i < NRG_NUM_PREV_STAT_L; i++) - data->nrg_silence_rssi[i] = 0; - - data->auto_corr_ofdm = ranges->auto_corr_min_ofdm; - data->auto_corr_ofdm_mrc = ranges->auto_corr_min_ofdm_mrc; - data->auto_corr_ofdm_x1 = ranges->auto_corr_min_ofdm_x1; - data->auto_corr_ofdm_mrc_x1 = ranges->auto_corr_min_ofdm_mrc_x1; - data->auto_corr_cck = AUTO_CORR_CCK_MIN_VAL_DEF; - data->auto_corr_cck_mrc = ranges->auto_corr_min_cck_mrc; - data->nrg_th_cck = ranges->nrg_th_cck; - data->nrg_th_ofdm = ranges->nrg_th_ofdm; - data->barker_corr_th_min = ranges->barker_corr_th_min; - data->barker_corr_th_min_mrc = ranges->barker_corr_th_min_mrc; - data->nrg_th_cca = ranges->nrg_th_cca; - - data->last_bad_plcp_cnt_ofdm = 0; - data->last_fa_cnt_ofdm = 0; - data->last_bad_plcp_cnt_cck = 0; - data->last_fa_cnt_cck = 0; - - if (priv->fw->enhance_sensitivity_table) - ret |= iwl_enhance_sensitivity_write(priv); - else - ret |= iwl_sensitivity_write(priv); - IWL_DEBUG_CALIB(priv, "<calib_disabled & IWL_SENSITIVITY_CALIB_DISABLED) - return; - - data = &(priv->sensitivity_data); - - if (!iwl_is_any_associated(priv)) { - IWL_DEBUG_CALIB(priv, "<< - not associated\n"); - return; - } - - spin_lock_bh(&priv->statistics.lock); - rx_info = &priv->statistics.rx_non_phy; - ofdm = &priv->statistics.rx_ofdm; - cck = &priv->statistics.rx_cck; - if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { - IWL_DEBUG_CALIB(priv, "<< invalid data.\n"); - spin_unlock_bh(&priv->statistics.lock); - return; - } - - /* Extract Statistics: */ - rx_enable_time = le32_to_cpu(rx_info->channel_load); - fa_cck = le32_to_cpu(cck->false_alarm_cnt); - fa_ofdm = le32_to_cpu(ofdm->false_alarm_cnt); - bad_plcp_cck = le32_to_cpu(cck->plcp_err); - bad_plcp_ofdm = le32_to_cpu(ofdm->plcp_err); - - statis.beacon_silence_rssi_a = - le32_to_cpu(rx_info->beacon_silence_rssi_a); - statis.beacon_silence_rssi_b = - le32_to_cpu(rx_info->beacon_silence_rssi_b); - statis.beacon_silence_rssi_c = - le32_to_cpu(rx_info->beacon_silence_rssi_c); - statis.beacon_energy_a = - le32_to_cpu(rx_info->beacon_energy_a); - statis.beacon_energy_b = - le32_to_cpu(rx_info->beacon_energy_b); - statis.beacon_energy_c = - le32_to_cpu(rx_info->beacon_energy_c); - - spin_unlock_bh(&priv->statistics.lock); - - IWL_DEBUG_CALIB(priv, "rx_enable_time = %u usecs\n", rx_enable_time); - - if (!rx_enable_time) { - IWL_DEBUG_CALIB(priv, "<< RX Enable Time == 0!\n"); - return; - } - - /* These statistics increase monotonically, and do not reset - * at each beacon. Calculate difference from last value, or just - * use the new statistics value if it has reset or wrapped around. */ - if (data->last_bad_plcp_cnt_cck > bad_plcp_cck) - data->last_bad_plcp_cnt_cck = bad_plcp_cck; - else { - bad_plcp_cck -= data->last_bad_plcp_cnt_cck; - data->last_bad_plcp_cnt_cck += bad_plcp_cck; - } - - if (data->last_bad_plcp_cnt_ofdm > bad_plcp_ofdm) - data->last_bad_plcp_cnt_ofdm = bad_plcp_ofdm; - else { - bad_plcp_ofdm -= data->last_bad_plcp_cnt_ofdm; - data->last_bad_plcp_cnt_ofdm += bad_plcp_ofdm; - } - - if (data->last_fa_cnt_ofdm > fa_ofdm) - data->last_fa_cnt_ofdm = fa_ofdm; - else { - fa_ofdm -= data->last_fa_cnt_ofdm; - data->last_fa_cnt_ofdm += fa_ofdm; - } - - if (data->last_fa_cnt_cck > fa_cck) - data->last_fa_cnt_cck = fa_cck; - else { - fa_cck -= data->last_fa_cnt_cck; - data->last_fa_cnt_cck += fa_cck; - } - - /* Total aborted signal locks */ - norm_fa_ofdm = fa_ofdm + bad_plcp_ofdm; - norm_fa_cck = fa_cck + bad_plcp_cck; - - IWL_DEBUG_CALIB(priv, "cck: fa %u badp %u ofdm: fa %u badp %u\n", fa_cck, - bad_plcp_cck, fa_ofdm, bad_plcp_ofdm); - - iwl_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time); - iwl_sens_energy_cck(priv, norm_fa_cck, rx_enable_time, &statis); - if (priv->fw->enhance_sensitivity_table) - iwl_enhance_sensitivity_write(priv); - else - iwl_sensitivity_write(priv); -} - -static inline u8 find_first_chain(u8 mask) -{ - if (mask & ANT_A) - return CHAIN_A; - if (mask & ANT_B) - return CHAIN_B; - return CHAIN_C; -} - -/** - * Run disconnected antenna algorithm to find out which antennas are - * disconnected. - */ -static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig, - struct iwl_chain_noise_data *data) -{ - u32 active_chains = 0; - u32 max_average_sig; - u16 max_average_sig_antenna_i; - u8 num_tx_chains; - u8 first_chain; - u16 i = 0; - - average_sig[0] = data->chain_signal_a / IWL_CAL_NUM_BEACONS; - average_sig[1] = data->chain_signal_b / IWL_CAL_NUM_BEACONS; - average_sig[2] = data->chain_signal_c / IWL_CAL_NUM_BEACONS; - - if (average_sig[0] >= average_sig[1]) { - max_average_sig = average_sig[0]; - max_average_sig_antenna_i = 0; - active_chains = (1 << max_average_sig_antenna_i); - } else { - max_average_sig = average_sig[1]; - max_average_sig_antenna_i = 1; - active_chains = (1 << max_average_sig_antenna_i); - } - - if (average_sig[2] >= max_average_sig) { - max_average_sig = average_sig[2]; - max_average_sig_antenna_i = 2; - active_chains = (1 << max_average_sig_antenna_i); - } - - IWL_DEBUG_CALIB(priv, "average_sig: a %d b %d c %d\n", - average_sig[0], average_sig[1], average_sig[2]); - IWL_DEBUG_CALIB(priv, "max_average_sig = %d, antenna %d\n", - max_average_sig, max_average_sig_antenna_i); - - /* Compare signal strengths for all 3 receivers. */ - for (i = 0; i < NUM_RX_CHAINS; i++) { - if (i != max_average_sig_antenna_i) { - s32 rssi_delta = (max_average_sig - average_sig[i]); - - /* If signal is very weak, compared with - * strongest, mark it as disconnected. */ - if (rssi_delta > MAXIMUM_ALLOWED_PATHLOSS) - data->disconn_array[i] = 1; - else - active_chains |= (1 << i); - IWL_DEBUG_CALIB(priv, "i = %d rssiDelta = %d " - "disconn_array[i] = %d\n", - i, rssi_delta, data->disconn_array[i]); - } - } - - /* - * The above algorithm sometimes fails when the ucode - * reports 0 for all chains. It's not clear why that - * happens to start with, but it is then causing trouble - * because this can make us enable more chains than the - * hardware really has. - * - * To be safe, simply mask out any chains that we know - * are not on the device. - */ - active_chains &= priv->nvm_data->valid_rx_ant; - - num_tx_chains = 0; - for (i = 0; i < NUM_RX_CHAINS; i++) { - /* loops on all the bits of - * priv->hw_setting.valid_tx_ant */ - u8 ant_msk = (1 << i); - if (!(priv->nvm_data->valid_tx_ant & ant_msk)) - continue; - - num_tx_chains++; - if (data->disconn_array[i] == 0) - /* there is a Tx antenna connected */ - break; - if (num_tx_chains == priv->hw_params.tx_chains_num && - data->disconn_array[i]) { - /* - * If all chains are disconnected - * connect the first valid tx chain - */ - first_chain = - find_first_chain(priv->nvm_data->valid_tx_ant); - data->disconn_array[first_chain] = 0; - active_chains |= BIT(first_chain); - IWL_DEBUG_CALIB(priv, - "All Tx chains are disconnected W/A - declare %d as connected\n", - first_chain); - break; - } - } - - if (active_chains != priv->nvm_data->valid_rx_ant && - active_chains != priv->chain_noise_data.active_chains) - IWL_DEBUG_CALIB(priv, - "Detected that not all antennas are connected! " - "Connected: %#x, valid: %#x.\n", - active_chains, - priv->nvm_data->valid_rx_ant); - - /* Save for use within RXON, TX, SCAN commands, etc. */ - data->active_chains = active_chains; - IWL_DEBUG_CALIB(priv, "active_chains (bitwise) = 0x%x\n", - active_chains); -} - -static void iwlagn_gain_computation(struct iwl_priv *priv, - u32 average_noise[NUM_RX_CHAINS], - u8 default_chain) -{ - int i; - s32 delta_g; - struct iwl_chain_noise_data *data = &priv->chain_noise_data; - - /* - * Find Gain Code for the chains based on "default chain" - */ - for (i = default_chain + 1; i < NUM_RX_CHAINS; i++) { - if ((data->disconn_array[i])) { - data->delta_gain_code[i] = 0; - continue; - } - - delta_g = (priv->cfg->base_params->chain_noise_scale * - ((s32)average_noise[default_chain] - - (s32)average_noise[i])) / 1500; - - /* bound gain by 2 bits value max, 3rd bit is sign */ - data->delta_gain_code[i] = - min(abs(delta_g), - (long) CHAIN_NOISE_MAX_DELTA_GAIN_CODE); - - if (delta_g < 0) - /* - * set negative sign ... - * note to Intel developers: This is uCode API format, - * not the format of any internal device registers. - * Do not change this format for e.g. 6050 or similar - * devices. Change format only if more resolution - * (i.e. more than 2 bits magnitude) is needed. - */ - data->delta_gain_code[i] |= (1 << 2); - } - - IWL_DEBUG_CALIB(priv, "Delta gains: ANT_B = %d ANT_C = %d\n", - data->delta_gain_code[1], data->delta_gain_code[2]); - - if (!data->radio_write) { - struct iwl_calib_chain_noise_gain_cmd cmd; - - memset(&cmd, 0, sizeof(cmd)); - - iwl_set_calib_hdr(&cmd.hdr, - priv->phy_calib_chain_noise_gain_cmd); - cmd.delta_gain_1 = data->delta_gain_code[1]; - cmd.delta_gain_2 = data->delta_gain_code[2]; - iwl_dvm_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, - CMD_ASYNC, sizeof(cmd), &cmd); - - data->radio_write = 1; - data->state = IWL_CHAIN_NOISE_CALIBRATED; - } -} - -/* - * Accumulate 16 beacons of signal and noise statistics for each of - * 3 receivers/antennas/rx-chains, then figure out: - * 1) Which antennas are connected. - * 2) Differential rx gain settings to balance the 3 receivers. - */ -void iwl_chain_noise_calibration(struct iwl_priv *priv) -{ - struct iwl_chain_noise_data *data = NULL; - - u32 chain_noise_a; - u32 chain_noise_b; - u32 chain_noise_c; - u32 chain_sig_a; - u32 chain_sig_b; - u32 chain_sig_c; - u32 average_sig[NUM_RX_CHAINS] = {INITIALIZATION_VALUE}; - u32 average_noise[NUM_RX_CHAINS] = {INITIALIZATION_VALUE}; - u32 min_average_noise = MIN_AVERAGE_NOISE_MAX_VALUE; - u16 min_average_noise_antenna_i = INITIALIZATION_VALUE; - u16 i = 0; - u16 rxon_chnum = INITIALIZATION_VALUE; - u16 stat_chnum = INITIALIZATION_VALUE; - u8 rxon_band24; - u8 stat_band24; - struct statistics_rx_non_phy *rx_info; - - /* - * MULTI-FIXME: - * When we support multiple interfaces on different channels, - * this must be modified/fixed. - */ - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - - if (priv->calib_disabled & IWL_CHAIN_NOISE_CALIB_DISABLED) - return; - - data = &(priv->chain_noise_data); - - /* - * Accumulate just the first "chain_noise_num_beacons" after - * the first association, then we're done forever. - */ - if (data->state != IWL_CHAIN_NOISE_ACCUMULATE) { - if (data->state == IWL_CHAIN_NOISE_ALIVE) - IWL_DEBUG_CALIB(priv, "Wait for noise calib reset\n"); - return; - } - - spin_lock_bh(&priv->statistics.lock); - - rx_info = &priv->statistics.rx_non_phy; - - if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) { - IWL_DEBUG_CALIB(priv, " << Interference data unavailable\n"); - spin_unlock_bh(&priv->statistics.lock); - return; - } - - rxon_band24 = !!(ctx->staging.flags & RXON_FLG_BAND_24G_MSK); - rxon_chnum = le16_to_cpu(ctx->staging.channel); - stat_band24 = - !!(priv->statistics.flag & STATISTICS_REPLY_FLG_BAND_24G_MSK); - stat_chnum = le32_to_cpu(priv->statistics.flag) >> 16; - - /* Make sure we accumulate data for just the associated channel - * (even if scanning). */ - if ((rxon_chnum != stat_chnum) || (rxon_band24 != stat_band24)) { - IWL_DEBUG_CALIB(priv, "Stats not from chan=%d, band24=%d\n", - rxon_chnum, rxon_band24); - spin_unlock_bh(&priv->statistics.lock); - return; - } - - /* - * Accumulate beacon statistics values across - * "chain_noise_num_beacons" - */ - chain_noise_a = le32_to_cpu(rx_info->beacon_silence_rssi_a) & - IN_BAND_FILTER; - chain_noise_b = le32_to_cpu(rx_info->beacon_silence_rssi_b) & - IN_BAND_FILTER; - chain_noise_c = le32_to_cpu(rx_info->beacon_silence_rssi_c) & - IN_BAND_FILTER; - - chain_sig_a = le32_to_cpu(rx_info->beacon_rssi_a) & IN_BAND_FILTER; - chain_sig_b = le32_to_cpu(rx_info->beacon_rssi_b) & IN_BAND_FILTER; - chain_sig_c = le32_to_cpu(rx_info->beacon_rssi_c) & IN_BAND_FILTER; - - spin_unlock_bh(&priv->statistics.lock); - - data->beacon_count++; - - data->chain_noise_a = (chain_noise_a + data->chain_noise_a); - data->chain_noise_b = (chain_noise_b + data->chain_noise_b); - data->chain_noise_c = (chain_noise_c + data->chain_noise_c); - - data->chain_signal_a = (chain_sig_a + data->chain_signal_a); - data->chain_signal_b = (chain_sig_b + data->chain_signal_b); - data->chain_signal_c = (chain_sig_c + data->chain_signal_c); - - IWL_DEBUG_CALIB(priv, "chan=%d, band24=%d, beacon=%d\n", - rxon_chnum, rxon_band24, data->beacon_count); - IWL_DEBUG_CALIB(priv, "chain_sig: a %d b %d c %d\n", - chain_sig_a, chain_sig_b, chain_sig_c); - IWL_DEBUG_CALIB(priv, "chain_noise: a %d b %d c %d\n", - chain_noise_a, chain_noise_b, chain_noise_c); - - /* If this is the "chain_noise_num_beacons", determine: - * 1) Disconnected antennas (using signal strengths) - * 2) Differential gain (using silence noise) to balance receivers */ - if (data->beacon_count != IWL_CAL_NUM_BEACONS) - return; - - /* Analyze signal for disconnected antenna */ - if (priv->cfg->bt_params && - priv->cfg->bt_params->advanced_bt_coexist) { - /* Disable disconnected antenna algorithm for advanced - bt coex, assuming valid antennas are connected */ - data->active_chains = priv->nvm_data->valid_rx_ant; - for (i = 0; i < NUM_RX_CHAINS; i++) - if (!(data->active_chains & (1<disconn_array[i] = 1; - } else - iwl_find_disconn_antenna(priv, average_sig, data); - - /* Analyze noise for rx balance */ - average_noise[0] = data->chain_noise_a / IWL_CAL_NUM_BEACONS; - average_noise[1] = data->chain_noise_b / IWL_CAL_NUM_BEACONS; - average_noise[2] = data->chain_noise_c / IWL_CAL_NUM_BEACONS; - - for (i = 0; i < NUM_RX_CHAINS; i++) { - if (!(data->disconn_array[i]) && - (average_noise[i] <= min_average_noise)) { - /* This means that chain i is active and has - * lower noise values so far: */ - min_average_noise = average_noise[i]; - min_average_noise_antenna_i = i; - } - } - - IWL_DEBUG_CALIB(priv, "average_noise: a %d b %d c %d\n", - average_noise[0], average_noise[1], - average_noise[2]); - - IWL_DEBUG_CALIB(priv, "min_average_noise = %d, antenna %d\n", - min_average_noise, min_average_noise_antenna_i); - - iwlagn_gain_computation( - priv, average_noise, - find_first_chain(priv->nvm_data->valid_rx_ant)); - - /* Some power changes may have been made during the calibration. - * Update and commit the RXON - */ - iwl_update_chain_flags(priv); - - data->state = IWL_CHAIN_NOISE_DONE; - iwl_power_update_mode(priv, false); -} - -void iwl_reset_run_time_calib(struct iwl_priv *priv) -{ - int i; - memset(&(priv->sensitivity_data), 0, - sizeof(struct iwl_sensitivity_data)); - memset(&(priv->chain_noise_data), 0, - sizeof(struct iwl_chain_noise_data)); - for (i = 0; i < NUM_RX_CHAINS; i++) - priv->chain_noise_data.delta_gain_code[i] = - CHAIN_NOISE_DELTA_GAIN_INIT_VAL; - - /* Ask for statistics now, the uCode will send notification - * periodically after association */ - iwl_send_statistics_request(priv, CMD_ASYNC, true); -} diff --git a/drivers/net/wireless/iwlwifi/dvm/calib.h b/drivers/net/wireless/iwlwifi/dvm/calib.h deleted file mode 100644 index cfddde194940..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/calib.h +++ /dev/null @@ -1,74 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ -#ifndef __iwl_calib_h__ -#define __iwl_calib_h__ - -#include "dev.h" -#include "commands.h" - -void iwl_chain_noise_calibration(struct iwl_priv *priv); -void iwl_sensitivity_calibration(struct iwl_priv *priv); - -void iwl_init_sensitivity(struct iwl_priv *priv); -void iwl_reset_run_time_calib(struct iwl_priv *priv); - -#endif /* __iwl_calib_h__ */ diff --git a/drivers/net/wireless/iwlwifi/dvm/commands.h b/drivers/net/wireless/iwlwifi/dvm/commands.h deleted file mode 100644 index 95ca026ecc9d..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/commands.h +++ /dev/null @@ -1,4015 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2005 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -/* - * Please use this file (commands.h) only for uCode API definitions. - * Please use iwl-xxxx-hw.h for hardware-related definitions. - * Please use dev.h for driver implementation definitions. - */ - -#ifndef __iwl_commands_h__ -#define __iwl_commands_h__ - -#include -#include - - -enum { - REPLY_ALIVE = 0x1, - REPLY_ERROR = 0x2, - REPLY_ECHO = 0x3, /* test command */ - - /* RXON and QOS commands */ - REPLY_RXON = 0x10, - REPLY_RXON_ASSOC = 0x11, - REPLY_QOS_PARAM = 0x13, - REPLY_RXON_TIMING = 0x14, - - /* Multi-Station support */ - REPLY_ADD_STA = 0x18, - REPLY_REMOVE_STA = 0x19, - REPLY_REMOVE_ALL_STA = 0x1a, /* not used */ - REPLY_TXFIFO_FLUSH = 0x1e, - - /* Security */ - REPLY_WEPKEY = 0x20, - - /* RX, TX, LEDs */ - REPLY_TX = 0x1c, - REPLY_LEDS_CMD = 0x48, - REPLY_TX_LINK_QUALITY_CMD = 0x4e, - - /* WiMAX coexistence */ - COEX_PRIORITY_TABLE_CMD = 0x5a, - COEX_MEDIUM_NOTIFICATION = 0x5b, - COEX_EVENT_CMD = 0x5c, - - /* Calibration */ - TEMPERATURE_NOTIFICATION = 0x62, - CALIBRATION_CFG_CMD = 0x65, - CALIBRATION_RES_NOTIFICATION = 0x66, - CALIBRATION_COMPLETE_NOTIFICATION = 0x67, - - /* 802.11h related */ - REPLY_QUIET_CMD = 0x71, /* not used */ - REPLY_CHANNEL_SWITCH = 0x72, - CHANNEL_SWITCH_NOTIFICATION = 0x73, - REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74, - SPECTRUM_MEASURE_NOTIFICATION = 0x75, - - /* Power Management */ - POWER_TABLE_CMD = 0x77, - PM_SLEEP_NOTIFICATION = 0x7A, - PM_DEBUG_STATISTIC_NOTIFIC = 0x7B, - - /* Scan commands and notifications */ - REPLY_SCAN_CMD = 0x80, - REPLY_SCAN_ABORT_CMD = 0x81, - SCAN_START_NOTIFICATION = 0x82, - SCAN_RESULTS_NOTIFICATION = 0x83, - SCAN_COMPLETE_NOTIFICATION = 0x84, - - /* IBSS/AP commands */ - BEACON_NOTIFICATION = 0x90, - REPLY_TX_BEACON = 0x91, - WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */ - - /* Miscellaneous commands */ - REPLY_TX_POWER_DBM_CMD = 0x95, - QUIET_NOTIFICATION = 0x96, /* not used */ - REPLY_TX_PWR_TABLE_CMD = 0x97, - REPLY_TX_POWER_DBM_CMD_V1 = 0x98, /* old version of API */ - TX_ANT_CONFIGURATION_CMD = 0x98, - MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ - - /* Bluetooth device coexistence config command */ - REPLY_BT_CONFIG = 0x9b, - - /* Statistics */ - REPLY_STATISTICS_CMD = 0x9c, - STATISTICS_NOTIFICATION = 0x9d, - - /* RF-KILL commands and notifications */ - REPLY_CARD_STATE_CMD = 0xa0, - CARD_STATE_NOTIFICATION = 0xa1, - - /* Missed beacons notification */ - MISSED_BEACONS_NOTIFICATION = 0xa2, - - REPLY_CT_KILL_CONFIG_CMD = 0xa4, - SENSITIVITY_CMD = 0xa8, - REPLY_PHY_CALIBRATION_CMD = 0xb0, - REPLY_RX_PHY_CMD = 0xc0, - REPLY_RX_MPDU_CMD = 0xc1, - REPLY_RX = 0xc3, - REPLY_COMPRESSED_BA = 0xc5, - - /* BT Coex */ - REPLY_BT_COEX_PRIO_TABLE = 0xcc, - REPLY_BT_COEX_PROT_ENV = 0xcd, - REPLY_BT_COEX_PROFILE_NOTIF = 0xce, - - /* PAN commands */ - REPLY_WIPAN_PARAMS = 0xb2, - REPLY_WIPAN_RXON = 0xb3, /* use REPLY_RXON structure */ - REPLY_WIPAN_RXON_TIMING = 0xb4, /* use REPLY_RXON_TIMING structure */ - REPLY_WIPAN_RXON_ASSOC = 0xb6, /* use REPLY_RXON_ASSOC structure */ - REPLY_WIPAN_QOS_PARAM = 0xb7, /* use REPLY_QOS_PARAM structure */ - REPLY_WIPAN_WEPKEY = 0xb8, /* use REPLY_WEPKEY structure */ - REPLY_WIPAN_P2P_CHANNEL_SWITCH = 0xb9, - REPLY_WIPAN_NOA_NOTIFICATION = 0xbc, - REPLY_WIPAN_DEACTIVATION_COMPLETE = 0xbd, - - REPLY_WOWLAN_PATTERNS = 0xe0, - REPLY_WOWLAN_WAKEUP_FILTER = 0xe1, - REPLY_WOWLAN_TSC_RSC_PARAMS = 0xe2, - REPLY_WOWLAN_TKIP_PARAMS = 0xe3, - REPLY_WOWLAN_KEK_KCK_MATERIAL = 0xe4, - REPLY_WOWLAN_GET_STATUS = 0xe5, - REPLY_D3_CONFIG = 0xd3, - - REPLY_MAX = 0xff -}; - -/* - * Minimum number of queues. MAX_NUM is defined in hw specific files. - * Set the minimum to accommodate - * - 4 standard TX queues - * - the command queue - * - 4 PAN TX queues - * - the PAN multicast queue, and - * - the AUX (TX during scan dwell) queue. - */ -#define IWL_MIN_NUM_QUEUES 11 - -/* - * Command queue depends on iPAN support. - */ -#define IWL_DEFAULT_CMD_QUEUE_NUM 4 -#define IWL_IPAN_CMD_QUEUE_NUM 9 - -#define IWL_TX_FIFO_BK 0 /* shared */ -#define IWL_TX_FIFO_BE 1 -#define IWL_TX_FIFO_VI 2 /* shared */ -#define IWL_TX_FIFO_VO 3 -#define IWL_TX_FIFO_BK_IPAN IWL_TX_FIFO_BK -#define IWL_TX_FIFO_BE_IPAN 4 -#define IWL_TX_FIFO_VI_IPAN IWL_TX_FIFO_VI -#define IWL_TX_FIFO_VO_IPAN 5 -/* re-uses the VO FIFO, uCode will properly flush/schedule */ -#define IWL_TX_FIFO_AUX 5 -#define IWL_TX_FIFO_UNUSED 255 - -#define IWLAGN_CMD_FIFO_NUM 7 - -/* - * This queue number is required for proper operation - * because the ucode will stop/start the scheduler as - * required. - */ -#define IWL_IPAN_MCAST_QUEUE 8 - -/****************************************************************************** - * (0) - * Commonly used structures and definitions: - * Command header, rate_n_flags, txpower - * - *****************************************************************************/ - -/** - * iwlagn rate_n_flags bit fields - * - * rate_n_flags format is used in following iwlagn commands: - * REPLY_RX (response only) - * REPLY_RX_MPDU (response only) - * REPLY_TX (both command and response) - * REPLY_TX_LINK_QUALITY_CMD - * - * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"): - * 2-0: 0) 6 Mbps - * 1) 12 Mbps - * 2) 18 Mbps - * 3) 24 Mbps - * 4) 36 Mbps - * 5) 48 Mbps - * 6) 54 Mbps - * 7) 60 Mbps - * - * 4-3: 0) Single stream (SISO) - * 1) Dual stream (MIMO) - * 2) Triple stream (MIMO) - * - * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data - * - * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"): - * 3-0: 0xD) 6 Mbps - * 0xF) 9 Mbps - * 0x5) 12 Mbps - * 0x7) 18 Mbps - * 0x9) 24 Mbps - * 0xB) 36 Mbps - * 0x1) 48 Mbps - * 0x3) 54 Mbps - * - * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): - * 6-0: 10) 1 Mbps - * 20) 2 Mbps - * 55) 5.5 Mbps - * 110) 11 Mbps - */ -#define RATE_MCS_CODE_MSK 0x7 -#define RATE_MCS_SPATIAL_POS 3 -#define RATE_MCS_SPATIAL_MSK 0x18 -#define RATE_MCS_HT_DUP_POS 5 -#define RATE_MCS_HT_DUP_MSK 0x20 -/* Both legacy and HT use bits 7:0 as the CCK/OFDM rate or HT MCS */ -#define RATE_MCS_RATE_MSK 0xff - -/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */ -#define RATE_MCS_FLAGS_POS 8 -#define RATE_MCS_HT_POS 8 -#define RATE_MCS_HT_MSK 0x100 - -/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */ -#define RATE_MCS_CCK_POS 9 -#define RATE_MCS_CCK_MSK 0x200 - -/* Bit 10: (1) Use Green Field preamble */ -#define RATE_MCS_GF_POS 10 -#define RATE_MCS_GF_MSK 0x400 - -/* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */ -#define RATE_MCS_HT40_POS 11 -#define RATE_MCS_HT40_MSK 0x800 - -/* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */ -#define RATE_MCS_DUP_POS 12 -#define RATE_MCS_DUP_MSK 0x1000 - -/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */ -#define RATE_MCS_SGI_POS 13 -#define RATE_MCS_SGI_MSK 0x2000 - -/** - * rate_n_flags Tx antenna masks - * 4965 has 2 transmitters - * 5100 has 1 transmitter B - * 5150 has 1 transmitter A - * 5300 has 3 transmitters - * 5350 has 3 transmitters - * bit14:16 - */ -#define RATE_MCS_ANT_POS 14 -#define RATE_MCS_ANT_A_MSK 0x04000 -#define RATE_MCS_ANT_B_MSK 0x08000 -#define RATE_MCS_ANT_C_MSK 0x10000 -#define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK) -#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK) -#define RATE_ANT_NUM 3 - -#define POWER_TABLE_NUM_ENTRIES 33 -#define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32 -#define POWER_TABLE_CCK_ENTRY 32 - -#define IWL_PWR_NUM_HT_OFDM_ENTRIES 24 -#define IWL_PWR_CCK_ENTRIES 2 - -/** - * struct tx_power_dual_stream - * - * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH - * - * Same format as iwl_tx_power_dual_stream, but __le32 - */ -struct tx_power_dual_stream { - __le32 dw; -} __packed; - -/** - * Command REPLY_TX_POWER_DBM_CMD = 0x98 - * struct iwlagn_tx_power_dbm_cmd - */ -#define IWLAGN_TX_POWER_AUTO 0x7f -#define IWLAGN_TX_POWER_NO_CLOSED (0x1 << 6) - -struct iwlagn_tx_power_dbm_cmd { - s8 global_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */ - u8 flags; - s8 srv_chan_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */ - u8 reserved; -} __packed; - -/** - * Command TX_ANT_CONFIGURATION_CMD = 0x98 - * This command is used to configure valid Tx antenna. - * By default uCode concludes the valid antenna according to the radio flavor. - * This command enables the driver to override/modify this conclusion. - */ -struct iwl_tx_ant_config_cmd { - __le32 valid; -} __packed; - -/****************************************************************************** - * (0a) - * Alive and Error Commands & Responses: - * - *****************************************************************************/ - -#define UCODE_VALID_OK cpu_to_le32(0x1) - -/** - * REPLY_ALIVE = 0x1 (response only, not a command) - * - * uCode issues this "alive" notification once the runtime image is ready - * to receive commands from the driver. This is the *second* "alive" - * notification that the driver will receive after rebooting uCode; - * this "alive" is indicated by subtype field != 9. - * - * See comments documenting "BSM" (bootstrap state machine). - * - * This response includes two pointers to structures within the device's - * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging: - * - * 1) log_event_table_ptr indicates base of the event log. This traces - * a 256-entry history of uCode execution within a circular buffer. - * Its header format is: - * - * __le32 log_size; log capacity (in number of entries) - * __le32 type; (1) timestamp with each entry, (0) no timestamp - * __le32 wraps; # times uCode has wrapped to top of circular buffer - * __le32 write_index; next circular buffer entry that uCode would fill - * - * The header is followed by the circular buffer of log entries. Entries - * with timestamps have the following format: - * - * __le32 event_id; range 0 - 1500 - * __le32 timestamp; low 32 bits of TSF (of network, if associated) - * __le32 data; event_id-specific data value - * - * Entries without timestamps contain only event_id and data. - * - * - * 2) error_event_table_ptr indicates base of the error log. This contains - * information about any uCode error that occurs. For agn, the format - * of the error log is defined by struct iwl_error_event_table. - * - * The Linux driver can print both logs to the system log when a uCode error - * occurs. - */ - -/* - * Note: This structure is read from the device with IO accesses, - * and the reading already does the endian conversion. As it is - * read with u32-sized accesses, any members with a different size - * need to be ordered correctly though! - */ -struct iwl_error_event_table { - u32 valid; /* (nonzero) valid, (0) log is empty */ - u32 error_id; /* type of error */ - u32 pc; /* program counter */ - u32 blink1; /* branch link */ - u32 blink2; /* branch link */ - u32 ilink1; /* interrupt link */ - u32 ilink2; /* interrupt link */ - u32 data1; /* error-specific data */ - u32 data2; /* error-specific data */ - u32 line; /* source code line of error */ - u32 bcon_time; /* beacon timer */ - u32 tsf_low; /* network timestamp function timer */ - u32 tsf_hi; /* network timestamp function timer */ - u32 gp1; /* GP1 timer register */ - u32 gp2; /* GP2 timer register */ - u32 gp3; /* GP3 timer register */ - u32 ucode_ver; /* uCode version */ - u32 hw_ver; /* HW Silicon version */ - u32 brd_ver; /* HW board version */ - u32 log_pc; /* log program counter */ - u32 frame_ptr; /* frame pointer */ - u32 stack_ptr; /* stack pointer */ - u32 hcmd; /* last host command header */ - u32 isr0; /* isr status register LMPM_NIC_ISR0: - * rxtx_flag */ - u32 isr1; /* isr status register LMPM_NIC_ISR1: - * host_flag */ - u32 isr2; /* isr status register LMPM_NIC_ISR2: - * enc_flag */ - u32 isr3; /* isr status register LMPM_NIC_ISR3: - * time_flag */ - u32 isr4; /* isr status register LMPM_NIC_ISR4: - * wico interrupt */ - u32 isr_pref; /* isr status register LMPM_NIC_PREF_STAT */ - u32 wait_event; /* wait event() caller address */ - u32 l2p_control; /* L2pControlField */ - u32 l2p_duration; /* L2pDurationField */ - u32 l2p_mhvalid; /* L2pMhValidBits */ - u32 l2p_addr_match; /* L2pAddrMatchStat */ - u32 lmpm_pmg_sel; /* indicate which clocks are turned on - * (LMPM_PMG_SEL) */ - u32 u_timestamp; /* indicate when the date and time of the - * compilation */ - u32 flow_handler; /* FH read/write pointers, RX credit */ -} __packed; - -struct iwl_alive_resp { - u8 ucode_minor; - u8 ucode_major; - __le16 reserved1; - u8 sw_rev[8]; - u8 ver_type; - u8 ver_subtype; /* not "9" for runtime alive */ - __le16 reserved2; - __le32 log_event_table_ptr; /* SRAM address for event log */ - __le32 error_event_table_ptr; /* SRAM address for error log */ - __le32 timestamp; - __le32 is_valid; -} __packed; - -/* - * REPLY_ERROR = 0x2 (response only, not a command) - */ -struct iwl_error_resp { - __le32 error_type; - u8 cmd_id; - u8 reserved1; - __le16 bad_cmd_seq_num; - __le32 error_info; - __le64 timestamp; -} __packed; - -/****************************************************************************** - * (1) - * RXON Commands & Responses: - * - *****************************************************************************/ - -/* - * Rx config defines & structure - */ -/* rx_config device types */ -enum { - RXON_DEV_TYPE_AP = 1, - RXON_DEV_TYPE_ESS = 3, - RXON_DEV_TYPE_IBSS = 4, - RXON_DEV_TYPE_SNIFFER = 6, - RXON_DEV_TYPE_CP = 7, - RXON_DEV_TYPE_2STA = 8, - RXON_DEV_TYPE_P2P = 9, -}; - - -#define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0) -#define RXON_RX_CHAIN_DRIVER_FORCE_POS (0) -#define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1) -#define RXON_RX_CHAIN_VALID_POS (1) -#define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4) -#define RXON_RX_CHAIN_FORCE_SEL_POS (4) -#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7) -#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7) -#define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10) -#define RXON_RX_CHAIN_CNT_POS (10) -#define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12) -#define RXON_RX_CHAIN_MIMO_CNT_POS (12) -#define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14) -#define RXON_RX_CHAIN_MIMO_FORCE_POS (14) - -/* rx_config flags */ -/* band & modulation selection */ -#define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0) -#define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1) -/* auto detection enable */ -#define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2) -/* TGg protection when tx */ -#define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3) -/* cck short slot & preamble */ -#define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4) -#define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5) -/* antenna selection */ -#define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7) -#define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00) -#define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8) -#define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9) -/* radar detection enable */ -#define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12) -#define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13) -/* rx response to host with 8-byte TSF -* (according to ON_AIR deassertion) */ -#define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15) - - -/* HT flags */ -#define RXON_FLG_CTRL_CHANNEL_LOC_POS (22) -#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22) - -#define RXON_FLG_HT_OPERATING_MODE_POS (23) - -#define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23) -#define RXON_FLG_HT40_PROT_MSK cpu_to_le32(0x2 << 23) - -#define RXON_FLG_CHANNEL_MODE_POS (25) -#define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25) - -/* channel mode */ -enum { - CHANNEL_MODE_LEGACY = 0, - CHANNEL_MODE_PURE_40 = 1, - CHANNEL_MODE_MIXED = 2, - CHANNEL_MODE_RESERVED = 3, -}; -#define RXON_FLG_CHANNEL_MODE_LEGACY cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS) -#define RXON_FLG_CHANNEL_MODE_PURE_40 cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS) -#define RXON_FLG_CHANNEL_MODE_MIXED cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS) - -/* CTS to self (if spec allows) flag */ -#define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30) - -/* rx_config filter flags */ -/* accept all data frames */ -#define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0) -/* pass control & management to host */ -#define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1) -/* accept multi-cast */ -#define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2) -/* don't decrypt uni-cast frames */ -#define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3) -/* don't decrypt multi-cast frames */ -#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4) -/* STA is associated */ -#define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5) -/* transfer to host non bssid beacons in associated state */ -#define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6) - -/** - * REPLY_RXON = 0x10 (command, has simple generic response) - * - * RXON tunes the radio tuner to a service channel, and sets up a number - * of parameters that are used primarily for Rx, but also for Tx operations. - * - * NOTE: When tuning to a new channel, driver must set the - * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent - * info within the device, including the station tables, tx retry - * rate tables, and txpower tables. Driver must build a new station - * table and txpower table before transmitting anything on the RXON - * channel. - * - * NOTE: All RXONs wipe clean the internal txpower table. Driver must - * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10), - * regardless of whether RXON_FILTER_ASSOC_MSK is set. - */ - -struct iwl_rxon_cmd { - u8 node_addr[6]; - __le16 reserved1; - u8 bssid_addr[6]; - __le16 reserved2; - u8 wlap_bssid_addr[6]; - __le16 reserved3; - u8 dev_type; - u8 air_propagation; - __le16 rx_chain; - u8 ofdm_basic_rates; - u8 cck_basic_rates; - __le16 assoc_id; - __le32 flags; - __le32 filter_flags; - __le16 channel; - u8 ofdm_ht_single_stream_basic_rates; - u8 ofdm_ht_dual_stream_basic_rates; - u8 ofdm_ht_triple_stream_basic_rates; - u8 reserved5; - __le16 acquisition_data; - __le16 reserved6; -} __packed; - -/* - * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) - */ -struct iwl_rxon_assoc_cmd { - __le32 flags; - __le32 filter_flags; - u8 ofdm_basic_rates; - u8 cck_basic_rates; - __le16 reserved1; - u8 ofdm_ht_single_stream_basic_rates; - u8 ofdm_ht_dual_stream_basic_rates; - u8 ofdm_ht_triple_stream_basic_rates; - u8 reserved2; - __le16 rx_chain_select_flags; - __le16 acquisition_data; - __le32 reserved3; -} __packed; - -#define IWL_CONN_MAX_LISTEN_INTERVAL 10 -#define IWL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */ - -/* - * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) - */ -struct iwl_rxon_time_cmd { - __le64 timestamp; - __le16 beacon_interval; - __le16 atim_window; - __le32 beacon_init_val; - __le16 listen_interval; - u8 dtim_period; - u8 delta_cp_bss_tbtts; -} __packed; - -/* - * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) - */ -/** - * struct iwl5000_channel_switch_cmd - * @band: 0- 5.2GHz, 1- 2.4GHz - * @expect_beacon: 0- resume transmits after channel switch - * 1- wait for beacon to resume transmits - * @channel: new channel number - * @rxon_flags: Rx on flags - * @rxon_filter_flags: filtering parameters - * @switch_time: switch time in extended beacon format - * @reserved: reserved bytes - */ -struct iwl5000_channel_switch_cmd { - u8 band; - u8 expect_beacon; - __le16 channel; - __le32 rxon_flags; - __le32 rxon_filter_flags; - __le32 switch_time; - __le32 reserved[2][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES]; -} __packed; - -/** - * struct iwl6000_channel_switch_cmd - * @band: 0- 5.2GHz, 1- 2.4GHz - * @expect_beacon: 0- resume transmits after channel switch - * 1- wait for beacon to resume transmits - * @channel: new channel number - * @rxon_flags: Rx on flags - * @rxon_filter_flags: filtering parameters - * @switch_time: switch time in extended beacon format - * @reserved: reserved bytes - */ -struct iwl6000_channel_switch_cmd { - u8 band; - u8 expect_beacon; - __le16 channel; - __le32 rxon_flags; - __le32 rxon_filter_flags; - __le32 switch_time; - __le32 reserved[3][IWL_PWR_NUM_HT_OFDM_ENTRIES + IWL_PWR_CCK_ENTRIES]; -} __packed; - -/* - * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) - */ -struct iwl_csa_notification { - __le16 band; - __le16 channel; - __le32 status; /* 0 - OK, 1 - fail */ -} __packed; - -/****************************************************************************** - * (2) - * Quality-of-Service (QOS) Commands & Responses: - * - *****************************************************************************/ - -/** - * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM - * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd - * - * @cw_min: Contention window, start value in numbers of slots. - * Should be a power-of-2, minus 1. Device's default is 0x0f. - * @cw_max: Contention window, max value in numbers of slots. - * Should be a power-of-2, minus 1. Device's default is 0x3f. - * @aifsn: Number of slots in Arbitration Interframe Space (before - * performing random backoff timing prior to Tx). Device default 1. - * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0. - * - * Device will automatically increase contention window by (2*CW) + 1 for each - * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW - * value, to cap the CW value. - */ -struct iwl_ac_qos { - __le16 cw_min; - __le16 cw_max; - u8 aifsn; - u8 reserved1; - __le16 edca_txop; -} __packed; - -/* QoS flags defines */ -#define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01) -#define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02) -#define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10) - -/* Number of Access Categories (AC) (EDCA), queues 0..3 */ -#define AC_NUM 4 - -/* - * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) - * - * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs - * 0: Background, 1: Best Effort, 2: Video, 3: Voice. - */ -struct iwl_qosparam_cmd { - __le32 qos_flags; - struct iwl_ac_qos ac[AC_NUM]; -} __packed; - -/****************************************************************************** - * (3) - * Add/Modify Stations Commands & Responses: - * - *****************************************************************************/ -/* - * Multi station support - */ - -/* Special, dedicated locations within device's station table */ -#define IWL_AP_ID 0 -#define IWL_AP_ID_PAN 1 -#define IWL_STA_ID 2 -#define IWLAGN_PAN_BCAST_ID 14 -#define IWLAGN_BROADCAST_ID 15 -#define IWLAGN_STATION_COUNT 16 - -#define IWL_TID_NON_QOS IWL_MAX_TID_COUNT - -#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2) -#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8) -#define STA_FLG_PAN_STATION cpu_to_le32(1 << 13) -#define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17) -#define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18) -#define STA_FLG_MAX_AGG_SIZE_POS (19) -#define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19) -#define STA_FLG_HT40_EN_MSK cpu_to_le32(1 << 21) -#define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22) -#define STA_FLG_AGG_MPDU_DENSITY_POS (23) -#define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23) - -/* Use in mode field. 1: modify existing entry, 0: add new station entry */ -#define STA_CONTROL_MODIFY_MSK 0x01 - -/* key flags __le16*/ -#define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007) -#define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000) -#define STA_KEY_FLG_WEP cpu_to_le16(0x0001) -#define STA_KEY_FLG_CCMP cpu_to_le16(0x0002) -#define STA_KEY_FLG_TKIP cpu_to_le16(0x0003) - -#define STA_KEY_FLG_KEYID_POS 8 -#define STA_KEY_FLG_INVALID cpu_to_le16(0x0800) -/* wep key is either from global key (0) or from station info array (1) */ -#define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008) - -/* wep key in STA: 5-bytes (0) or 13-bytes (1) */ -#define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000) -#define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000) -#define STA_KEY_MAX_NUM 8 -#define STA_KEY_MAX_NUM_PAN 16 -/* must not match WEP_INVALID_OFFSET */ -#define IWLAGN_HW_KEY_DEFAULT 0xfe - -/* Flags indicate whether to modify vs. don't change various station params */ -#define STA_MODIFY_KEY_MASK 0x01 -#define STA_MODIFY_TID_DISABLE_TX 0x02 -#define STA_MODIFY_TX_RATE_MSK 0x04 -#define STA_MODIFY_ADDBA_TID_MSK 0x08 -#define STA_MODIFY_DELBA_TID_MSK 0x10 -#define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20 - -/* Receiver address (actually, Rx station's index into station table), - * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */ -#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid)) - -/* agn */ -struct iwl_keyinfo { - __le16 key_flags; - u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ - u8 reserved1; - __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ - u8 key_offset; - u8 reserved2; - u8 key[16]; /* 16-byte unicast decryption key */ - __le64 tx_secur_seq_cnt; - __le64 hw_tkip_mic_rx_key; - __le64 hw_tkip_mic_tx_key; -} __packed; - -/** - * struct sta_id_modify - * @addr[ETH_ALEN]: station's MAC address - * @sta_id: index of station in uCode's station table - * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change - * - * Driver selects unused table index when adding new station, - * or the index to a pre-existing station entry when modifying that station. - * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP). - * - * modify_mask flags select which parameters to modify vs. leave alone. - */ -struct sta_id_modify { - u8 addr[ETH_ALEN]; - __le16 reserved1; - u8 sta_id; - u8 modify_mask; - __le16 reserved2; -} __packed; - -/* - * REPLY_ADD_STA = 0x18 (command) - * - * The device contains an internal table of per-station information, - * with info on security keys, aggregation parameters, and Tx rates for - * initial Tx attempt and any retries (agn devices uses - * REPLY_TX_LINK_QUALITY_CMD, - * - * REPLY_ADD_STA sets up the table entry for one station, either creating - * a new entry, or modifying a pre-existing one. - * - * NOTE: RXON command (without "associated" bit set) wipes the station table - * clean. Moving into RF_KILL state does this also. Driver must set up - * new station table before transmitting anything on the RXON channel - * (except active scans or active measurements; those commands carry - * their own txpower/rate setup data). - * - * When getting started on a new channel, driver must set up the - * IWL_BROADCAST_ID entry (last entry in the table). For a client - * station in a BSS, once an AP is selected, driver sets up the AP STA - * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP - * are all that are needed for a BSS client station. If the device is - * used as AP, or in an IBSS network, driver must set up station table - * entries for all STAs in network, starting with index IWL_STA_ID. - */ - -struct iwl_addsta_cmd { - u8 mode; /* 1: modify existing, 0: add new station */ - u8 reserved[3]; - struct sta_id_modify sta; - struct iwl_keyinfo key; - __le32 station_flags; /* STA_FLG_* */ - __le32 station_flags_msk; /* STA_FLG_* */ - - /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) - * corresponding to bit (e.g. bit 5 controls TID 5). - * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ - __le16 tid_disable_tx; - __le16 legacy_reserved; - - /* TID for which to add block-ack support. - * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ - u8 add_immediate_ba_tid; - - /* TID for which to remove block-ack support. - * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ - u8 remove_immediate_ba_tid; - - /* Starting Sequence Number for added block-ack support. - * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ - __le16 add_immediate_ba_ssn; - - /* - * Number of packets OK to transmit to station even though - * it is asleep -- used to synchronise PS-poll and u-APSD - * responses while ucode keeps track of STA sleep state. - */ - __le16 sleep_tx_count; - - __le16 reserved2; -} __packed; - - -#define ADD_STA_SUCCESS_MSK 0x1 -#define ADD_STA_NO_ROOM_IN_TABLE 0x2 -#define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4 -#define ADD_STA_MODIFY_NON_EXIST_STA 0x8 -/* - * REPLY_ADD_STA = 0x18 (response) - */ -struct iwl_add_sta_resp { - u8 status; /* ADD_STA_* */ -} __packed; - -#define REM_STA_SUCCESS_MSK 0x1 -/* - * REPLY_REM_STA = 0x19 (response) - */ -struct iwl_rem_sta_resp { - u8 status; -} __packed; - -/* - * REPLY_REM_STA = 0x19 (command) - */ -struct iwl_rem_sta_cmd { - u8 num_sta; /* number of removed stations */ - u8 reserved[3]; - u8 addr[ETH_ALEN]; /* MAC addr of the first station */ - u8 reserved2[2]; -} __packed; - - -/* WiFi queues mask */ -#define IWL_SCD_BK_MSK cpu_to_le32(BIT(0)) -#define IWL_SCD_BE_MSK cpu_to_le32(BIT(1)) -#define IWL_SCD_VI_MSK cpu_to_le32(BIT(2)) -#define IWL_SCD_VO_MSK cpu_to_le32(BIT(3)) -#define IWL_SCD_MGMT_MSK cpu_to_le32(BIT(3)) - -/* PAN queues mask */ -#define IWL_PAN_SCD_BK_MSK cpu_to_le32(BIT(4)) -#define IWL_PAN_SCD_BE_MSK cpu_to_le32(BIT(5)) -#define IWL_PAN_SCD_VI_MSK cpu_to_le32(BIT(6)) -#define IWL_PAN_SCD_VO_MSK cpu_to_le32(BIT(7)) -#define IWL_PAN_SCD_MGMT_MSK cpu_to_le32(BIT(7)) -#define IWL_PAN_SCD_MULTICAST_MSK cpu_to_le32(BIT(8)) - -#define IWL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00) - -#define IWL_DROP_ALL BIT(1) - -/* - * REPLY_TXFIFO_FLUSH = 0x1e(command and response) - * - * When using full FIFO flush this command checks the scheduler HW block WR/RD - * pointers to check if all the frames were transferred by DMA into the - * relevant TX FIFO queue. Only when the DMA is finished and the queue is - * empty the command can finish. - * This command is used to flush the TXFIFO from transmit commands, it may - * operate on single or multiple queues, the command queue can't be flushed by - * this command. The command response is returned when all the queue flush - * operations are done. Each TX command flushed return response with the FLUSH - * status set in the TX response status. When FIFO flush operation is used, - * the flush operation ends when both the scheduler DMA done and TXFIFO empty - * are set. - * - * @queue_control: bit mask for which queues to flush - * @flush_control: flush controls - * 0: Dump single MSDU - * 1: Dump multiple MSDU according to PS, INVALID STA, TTL, TID disable. - * 2: Dump all FIFO - */ -struct iwl_txfifo_flush_cmd { - __le32 queue_control; - __le16 flush_control; - __le16 reserved; -} __packed; - -/* - * REPLY_WEP_KEY = 0x20 - */ -struct iwl_wep_key { - u8 key_index; - u8 key_offset; - u8 reserved1[2]; - u8 key_size; - u8 reserved2[3]; - u8 key[16]; -} __packed; - -struct iwl_wep_cmd { - u8 num_keys; - u8 global_key_type; - u8 flags; - u8 reserved; - struct iwl_wep_key key[0]; -} __packed; - -#define WEP_KEY_WEP_TYPE 1 -#define WEP_KEYS_MAX 4 -#define WEP_INVALID_OFFSET 0xff -#define WEP_KEY_LEN_64 5 -#define WEP_KEY_LEN_128 13 - -/****************************************************************************** - * (4) - * Rx Responses: - * - *****************************************************************************/ - -#define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0) -#define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1) - -#define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0) -#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1) -#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2) -#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3) -#define RX_RES_PHY_FLAGS_ANTENNA_MSK 0x70 -#define RX_RES_PHY_FLAGS_ANTENNA_POS 4 -#define RX_RES_PHY_FLAGS_AGG_MSK cpu_to_le16(1 << 7) - -#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) -#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) -#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) -#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) -#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) -#define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8) - -#define RX_RES_STATUS_STATION_FOUND (1<<6) -#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7) - -#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) -#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) -#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) -#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) -#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) - -#define RX_MPDU_RES_STATUS_ICV_OK (0x20) -#define RX_MPDU_RES_STATUS_MIC_OK (0x40) -#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7) -#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800) - - -#define IWLAGN_RX_RES_PHY_CNT 8 -#define IWLAGN_RX_RES_AGC_IDX 1 -#define IWLAGN_RX_RES_RSSI_AB_IDX 2 -#define IWLAGN_RX_RES_RSSI_C_IDX 3 -#define IWLAGN_OFDM_AGC_MSK 0xfe00 -#define IWLAGN_OFDM_AGC_BIT_POS 9 -#define IWLAGN_OFDM_RSSI_INBAND_A_BITMSK 0x00ff -#define IWLAGN_OFDM_RSSI_ALLBAND_A_BITMSK 0xff00 -#define IWLAGN_OFDM_RSSI_A_BIT_POS 0 -#define IWLAGN_OFDM_RSSI_INBAND_B_BITMSK 0xff0000 -#define IWLAGN_OFDM_RSSI_ALLBAND_B_BITMSK 0xff000000 -#define IWLAGN_OFDM_RSSI_B_BIT_POS 16 -#define IWLAGN_OFDM_RSSI_INBAND_C_BITMSK 0x00ff -#define IWLAGN_OFDM_RSSI_ALLBAND_C_BITMSK 0xff00 -#define IWLAGN_OFDM_RSSI_C_BIT_POS 0 - -struct iwlagn_non_cfg_phy { - __le32 non_cfg_phy[IWLAGN_RX_RES_PHY_CNT]; /* up to 8 phy entries */ -} __packed; - - -/* - * REPLY_RX = 0xc3 (response only, not a command) - * Used only for legacy (non 11n) frames. - */ -struct iwl_rx_phy_res { - u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ - u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ - u8 stat_id; /* configurable DSP phy data set ID */ - u8 reserved1; - __le64 timestamp; /* TSF at on air rise */ - __le32 beacon_time_stamp; /* beacon at on-air rise */ - __le16 phy_flags; /* general phy flags: band, modulation, ... */ - __le16 channel; /* channel number */ - u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */ - __le32 rate_n_flags; /* RATE_MCS_* */ - __le16 byte_count; /* frame's byte-count */ - __le16 frame_time; /* frame's time on the air */ -} __packed; - -struct iwl_rx_mpdu_res_start { - __le16 byte_count; - __le16 reserved; -} __packed; - - -/****************************************************************************** - * (5) - * Tx Commands & Responses: - * - * Driver must place each REPLY_TX command into one of the prioritized Tx - * queues in host DRAM, shared between driver and device (see comments for - * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode - * are preparing to transmit, the device pulls the Tx command over the PCI - * bus via one of the device's Tx DMA channels, to fill an internal FIFO - * from which data will be transmitted. - * - * uCode handles all timing and protocol related to control frames - * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler - * handle reception of block-acks; uCode updates the host driver via - * REPLY_COMPRESSED_BA. - * - * uCode handles retrying Tx when an ACK is expected but not received. - * This includes trying lower data rates than the one requested in the Tx - * command, as set up by the REPLY_TX_LINK_QUALITY_CMD (agn). - * - * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD. - * This command must be executed after every RXON command, before Tx can occur. - *****************************************************************************/ - -/* REPLY_TX Tx flags field */ - -/* - * 1: Use RTS/CTS protocol or CTS-to-self if spec allows it - * before this frame. if CTS-to-self required check - * RXON_FLG_SELF_CTS_EN status. - */ -#define TX_CMD_FLG_PROT_REQUIRE_MSK cpu_to_le32(1 << 0) - -/* 1: Expect ACK from receiving station - * 0: Don't expect ACK (MAC header's duration field s/b 0) - * Set this for unicast frames, but not broadcast/multicast. */ -#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3) - -/* For agn devices: - * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). - * Tx command's initial_rate_index indicates first rate to try; - * uCode walks through table for additional Tx attempts. - * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. - * This rate will be used for all Tx attempts; it will not be scaled. */ -#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4) - -/* 1: Expect immediate block-ack. - * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ -#define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6) - -/* Tx antenna selection field; reserved (0) for agn devices. */ -#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00) - -/* 1: Ignore Bluetooth priority for this frame. - * 0: Delay Tx until Bluetooth device is done (normal usage). */ -#define TX_CMD_FLG_IGNORE_BT cpu_to_le32(1 << 12) - -/* 1: uCode overrides sequence control field in MAC header. - * 0: Driver provides sequence control field in MAC header. - * Set this for management frames, non-QOS data frames, non-unicast frames, - * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */ -#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13) - -/* 1: This frame is non-last MPDU; more fragments are coming. - * 0: Last fragment, or not using fragmentation. */ -#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14) - -/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. - * 0: No TSF required in outgoing frame. - * Set this for transmitting beacons and probe responses. */ -#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16) - -/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword - * alignment of frame's payload data field. - * 0: No pad - * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 - * field (but not both). Driver must align frame data (i.e. data following - * MAC header) to DWORD boundary. */ -#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20) - -/* accelerate aggregation support - * 0 - no CCMP encryption; 1 - CCMP encryption */ -#define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22) - -/* HCCA-AP - disable duration overwriting. */ -#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25) - - -/* - * TX command security control - */ -#define TX_CMD_SEC_WEP 0x01 -#define TX_CMD_SEC_CCM 0x02 -#define TX_CMD_SEC_TKIP 0x03 -#define TX_CMD_SEC_MSK 0x03 -#define TX_CMD_SEC_SHIFT 6 -#define TX_CMD_SEC_KEY128 0x08 - -/* - * security overhead sizes - */ -#define WEP_IV_LEN 4 -#define WEP_ICV_LEN 4 -#define CCMP_MIC_LEN 8 -#define TKIP_ICV_LEN 4 - -/* - * REPLY_TX = 0x1c (command) - */ - -/* - * 4965 uCode updates these Tx attempt count values in host DRAM. - * Used for managing Tx retries when expecting block-acks. - * Driver should set these fields to 0. - */ -struct iwl_dram_scratch { - u8 try_cnt; /* Tx attempts */ - u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */ - __le16 reserved; -} __packed; - -struct iwl_tx_cmd { - /* - * MPDU byte count: - * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, - * + 8 byte IV for CCM or TKIP (not used for WEP) - * + Data payload - * + 8-byte MIC (not used for CCM/WEP) - * NOTE: Does not include Tx command bytes, post-MAC pad bytes, - * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i - * Range: 14-2342 bytes. - */ - __le16 len; - - /* - * MPDU or MSDU byte count for next frame. - * Used for fragmentation and bursting, but not 11n aggregation. - * Same as "len", but for next frame. Set to 0 if not applicable. - */ - __le16 next_frame_len; - - __le32 tx_flags; /* TX_CMD_FLG_* */ - - /* uCode may modify this field of the Tx command (in host DRAM!). - * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */ - struct iwl_dram_scratch scratch; - - /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */ - __le32 rate_n_flags; /* RATE_MCS_* */ - - /* Index of destination station in uCode's station table */ - u8 sta_id; - - /* Type of security encryption: CCM or TKIP */ - u8 sec_ctl; /* TX_CMD_SEC_* */ - - /* - * Index into rate table (see REPLY_TX_LINK_QUALITY_CMD) for initial - * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for - * data frames, this field may be used to selectively reduce initial - * rate (via non-0 value) for special frames (e.g. management), while - * still supporting rate scaling for all frames. - */ - u8 initial_rate_index; - u8 reserved; - u8 key[16]; - __le16 next_frame_flags; - __le16 reserved2; - union { - __le32 life_time; - __le32 attempt; - } stop_time; - - /* Host DRAM physical address pointer to "scratch" in this command. - * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */ - __le32 dram_lsb_ptr; - u8 dram_msb_ptr; - - u8 rts_retry_limit; /*byte 50 */ - u8 data_retry_limit; /*byte 51 */ - u8 tid_tspec; - union { - __le16 pm_frame_timeout; - __le16 attempt_duration; - } timeout; - - /* - * Duration of EDCA burst Tx Opportunity, in 32-usec units. - * Set this if txop time is not specified by HCCA protocol (e.g. by AP). - */ - __le16 driver_txop; - - /* - * MAC header goes here, followed by 2 bytes padding if MAC header - * length is 26 or 30 bytes, followed by payload data - */ - u8 payload[0]; - struct ieee80211_hdr hdr[0]; -} __packed; - -/* - * TX command response is sent after *agn* transmission attempts. - * - * both postpone and abort status are expected behavior from uCode. there is - * no special operation required from driver; except for RFKILL_FLUSH, - * which required tx flush host command to flush all the tx frames in queues - */ -enum { - TX_STATUS_SUCCESS = 0x01, - TX_STATUS_DIRECT_DONE = 0x02, - /* postpone TX */ - TX_STATUS_POSTPONE_DELAY = 0x40, - TX_STATUS_POSTPONE_FEW_BYTES = 0x41, - TX_STATUS_POSTPONE_BT_PRIO = 0x42, - TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43, - TX_STATUS_POSTPONE_CALC_TTAK = 0x44, - /* abort TX */ - TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81, - TX_STATUS_FAIL_SHORT_LIMIT = 0x82, - TX_STATUS_FAIL_LONG_LIMIT = 0x83, - TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, - TX_STATUS_FAIL_DRAIN_FLOW = 0x85, - TX_STATUS_FAIL_RFKILL_FLUSH = 0x86, - TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, - TX_STATUS_FAIL_DEST_PS = 0x88, - TX_STATUS_FAIL_HOST_ABORTED = 0x89, - TX_STATUS_FAIL_BT_RETRY = 0x8a, - TX_STATUS_FAIL_STA_INVALID = 0x8b, - TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, - TX_STATUS_FAIL_TID_DISABLE = 0x8d, - TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e, - TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, - TX_STATUS_FAIL_PASSIVE_NO_RX = 0x90, - TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, -}; - -#define TX_PACKET_MODE_REGULAR 0x0000 -#define TX_PACKET_MODE_BURST_SEQ 0x0100 -#define TX_PACKET_MODE_BURST_FIRST 0x0200 - -enum { - TX_POWER_PA_NOT_ACTIVE = 0x0, -}; - -enum { - TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ - TX_STATUS_DELAY_MSK = 0x00000040, - TX_STATUS_ABORT_MSK = 0x00000080, - TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ - TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ - TX_RESERVED = 0x00780000, /* bits 19:22 */ - TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ - TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ -}; - -/* ******************************* - * TX aggregation status - ******************************* */ - -enum { - AGG_TX_STATE_TRANSMITTED = 0x00, - AGG_TX_STATE_UNDERRUN_MSK = 0x01, - AGG_TX_STATE_BT_PRIO_MSK = 0x02, - AGG_TX_STATE_FEW_BYTES_MSK = 0x04, - AGG_TX_STATE_ABORT_MSK = 0x08, - AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10, - AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20, - AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40, - AGG_TX_STATE_SCD_QUERY_MSK = 0x80, - AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100, - AGG_TX_STATE_RESPONSE_MSK = 0x1ff, - AGG_TX_STATE_DUMP_TX_MSK = 0x200, - AGG_TX_STATE_DELAY_TX_MSK = 0x400 -}; - -#define AGG_TX_STATUS_MSK 0x00000fff /* bits 0:11 */ -#define AGG_TX_TRY_MSK 0x0000f000 /* bits 12:15 */ -#define AGG_TX_TRY_POS 12 - -#define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \ - AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \ - AGG_TX_STATE_LAST_SENT_BT_KILL_MSK) - -/* # tx attempts for first frame in aggregation */ -#define AGG_TX_STATE_TRY_CNT_POS 12 -#define AGG_TX_STATE_TRY_CNT_MSK 0xf000 - -/* Command ID and sequence number of Tx command for this frame */ -#define AGG_TX_STATE_SEQ_NUM_POS 16 -#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 - -/* - * REPLY_TX = 0x1c (response) - * - * This response may be in one of two slightly different formats, indicated - * by the frame_count field: - * - * 1) No aggregation (frame_count == 1). This reports Tx results for - * a single frame. Multiple attempts, at various bit rates, may have - * been made for this frame. - * - * 2) Aggregation (frame_count > 1). This reports Tx results for - * 2 or more frames that used block-acknowledge. All frames were - * transmitted at same rate. Rate scaling may have been used if first - * frame in this new agg block failed in previous agg block(s). - * - * Note that, for aggregation, ACK (block-ack) status is not delivered here; - * block-ack has not been received by the time the agn device records - * this status. - * This status relates to reasons the tx might have been blocked or aborted - * within the sending station (this agn device), rather than whether it was - * received successfully by the destination station. - */ -struct agg_tx_status { - __le16 status; - __le16 sequence; -} __packed; - -/* - * definitions for initial rate index field - * bits [3:0] initial rate index - * bits [6:4] rate table color, used for the initial rate - * bit-7 invalid rate indication - * i.e. rate was not chosen from rate table - * or rate table color was changed during frame retries - * refer tlc rate info - */ - -#define IWL50_TX_RES_INIT_RATE_INDEX_POS 0 -#define IWL50_TX_RES_INIT_RATE_INDEX_MSK 0x0f -#define IWL50_TX_RES_RATE_TABLE_COLOR_POS 4 -#define IWL50_TX_RES_RATE_TABLE_COLOR_MSK 0x70 -#define IWL50_TX_RES_INV_RATE_INDEX_MSK 0x80 - -/* refer to ra_tid */ -#define IWLAGN_TX_RES_TID_POS 0 -#define IWLAGN_TX_RES_TID_MSK 0x0f -#define IWLAGN_TX_RES_RA_POS 4 -#define IWLAGN_TX_RES_RA_MSK 0xf0 - -struct iwlagn_tx_resp { - u8 frame_count; /* 1 no aggregation, >1 aggregation */ - u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */ - u8 failure_rts; /* # failures due to unsuccessful RTS */ - u8 failure_frame; /* # failures due to no ACK (unused for agg) */ - - /* For non-agg: Rate at which frame was successful. - * For agg: Rate at which all frames were transmitted. */ - __le32 rate_n_flags; /* RATE_MCS_* */ - - /* For non-agg: RTS + CTS + frame tx attempts time + ACK. - * For agg: RTS + CTS + aggregation tx time + block-ack time. */ - __le16 wireless_media_time; /* uSecs */ - - u8 pa_status; /* RF power amplifier measurement (not used) */ - u8 pa_integ_res_a[3]; - u8 pa_integ_res_b[3]; - u8 pa_integ_res_C[3]; - - __le32 tfd_info; - __le16 seq_ctl; - __le16 byte_cnt; - u8 tlc_info; - u8 ra_tid; /* tid (0:3), sta_id (4:7) */ - __le16 frame_ctrl; - /* - * For non-agg: frame status TX_STATUS_* - * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status - * fields follow this one, up to frame_count. - * Bit fields: - * 11- 0: AGG_TX_STATE_* status code - * 15-12: Retry count for 1st frame in aggregation (retries - * occur if tx failed for this frame when it was a - * member of a previous aggregation block). If rate - * scaling is used, retry count indicates the rate - * table entry used for all frames in the new agg. - * 31-16: Sequence # for this frame's Tx cmd (not SSN!) - */ - struct agg_tx_status status; /* TX status (in aggregation - - * status of 1st frame) */ -} __packed; -/* - * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) - * - * Reports Block-Acknowledge from recipient station - */ -struct iwl_compressed_ba_resp { - __le32 sta_addr_lo32; - __le16 sta_addr_hi16; - __le16 reserved; - - /* Index of recipient (BA-sending) station in uCode's station table */ - u8 sta_id; - u8 tid; - __le16 seq_ctl; - __le64 bitmap; - __le16 scd_flow; - __le16 scd_ssn; - u8 txed; /* number of frames sent */ - u8 txed_2_done; /* number of frames acked */ - __le16 reserved1; -} __packed; - -/* - * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) - * - */ - -/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ -#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0) - -/* # of EDCA prioritized tx fifos */ -#define LINK_QUAL_AC_NUM AC_NUM - -/* # entries in rate scale table to support Tx retries */ -#define LINK_QUAL_MAX_RETRY_NUM 16 - -/* Tx antenna selection values */ -#define LINK_QUAL_ANT_A_MSK (1 << 0) -#define LINK_QUAL_ANT_B_MSK (1 << 1) -#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) - - -/** - * struct iwl_link_qual_general_params - * - * Used in REPLY_TX_LINK_QUALITY_CMD - */ -struct iwl_link_qual_general_params { - u8 flags; - - /* No entries at or above this (driver chosen) index contain MIMO */ - u8 mimo_delimiter; - - /* Best single antenna to use for single stream (legacy, SISO). */ - u8 single_stream_ant_msk; /* LINK_QUAL_ANT_* */ - - /* Best antennas to use for MIMO (unused for 4965, assumes both). */ - u8 dual_stream_ant_msk; /* LINK_QUAL_ANT_* */ - - /* - * If driver needs to use different initial rates for different - * EDCA QOS access categories (as implemented by tx fifos 0-3), - * this table will set that up, by indicating the indexes in the - * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start. - * Otherwise, driver should set all entries to 0. - * - * Entry usage: - * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice - * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3. - */ - u8 start_rate_index[LINK_QUAL_AC_NUM]; -} __packed; - -#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */ -#define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000) -#define LINK_QUAL_AGG_TIME_LIMIT_MIN (100) - -#define LINK_QUAL_AGG_DISABLE_START_DEF (3) -#define LINK_QUAL_AGG_DISABLE_START_MAX (255) -#define LINK_QUAL_AGG_DISABLE_START_MIN (0) - -#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (63) -#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63) -#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0) - -/** - * struct iwl_link_qual_agg_params - * - * Used in REPLY_TX_LINK_QUALITY_CMD - */ -struct iwl_link_qual_agg_params { - - /* - *Maximum number of uSec in aggregation. - * default set to 4000 (4 milliseconds) if not configured in .cfg - */ - __le16 agg_time_limit; - - /* - * Number of Tx retries allowed for a frame, before that frame will - * no longer be considered for the start of an aggregation sequence - * (scheduler will then try to tx it as single frame). - * Driver should set this to 3. - */ - u8 agg_dis_start_th; - - /* - * Maximum number of frames in aggregation. - * 0 = no limit (default). 1 = no aggregation. - * Other values = max # frames in aggregation. - */ - u8 agg_frame_cnt_limit; - - __le32 reserved; -} __packed; - -/* - * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) - * - * For agn devices - * - * Each station in the agn device's internal station table has its own table - * of 16 - * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when - * an ACK is not received. This command replaces the entire table for - * one station. - * - * NOTE: Station must already be in agn device's station table. - * Use REPLY_ADD_STA. - * - * The rate scaling procedures described below work well. Of course, other - * procedures are possible, and may work better for particular environments. - * - * - * FILLING THE RATE TABLE - * - * Given a particular initial rate and mode, as determined by the rate - * scaling algorithm described below, the Linux driver uses the following - * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the - * Link Quality command: - * - * - * 1) If using High-throughput (HT) (SISO or MIMO) initial rate: - * a) Use this same initial rate for first 3 entries. - * b) Find next lower available rate using same mode (SISO or MIMO), - * use for next 3 entries. If no lower rate available, switch to - * legacy mode (no HT40 channel, no MIMO, no short guard interval). - * c) If using MIMO, set command's mimo_delimiter to number of entries - * using MIMO (3 or 6). - * d) After trying 2 HT rates, switch to legacy mode (no HT40 channel, - * no MIMO, no short guard interval), at the next lower bit rate - * (e.g. if second HT bit rate was 54, try 48 legacy), and follow - * legacy procedure for remaining table entries. - * - * 2) If using legacy initial rate: - * a) Use the initial rate for only one entry. - * b) For each following entry, reduce the rate to next lower available - * rate, until reaching the lowest available rate. - * c) When reducing rate, also switch antenna selection. - * d) Once lowest available rate is reached, repeat this rate until - * rate table is filled (16 entries), switching antenna each entry. - * - * - * ACCUMULATING HISTORY - * - * The rate scaling algorithm for agn devices, as implemented in Linux driver, - * uses two sets of frame Tx success history: One for the current/active - * modulation mode, and one for a speculative/search mode that is being - * attempted. If the speculative mode turns out to be more effective (i.e. - * actual transfer rate is better), then the driver continues to use the - * speculative mode as the new current active mode. - * - * Each history set contains, separately for each possible rate, data for a - * sliding window of the 62 most recent tx attempts at that rate. The data - * includes a shifting bitmap of success(1)/failure(0), and sums of successful - * and attempted frames, from which the driver can additionally calculate a - * success ratio (success / attempted) and number of failures - * (attempted - success), and control the size of the window (attempted). - * The driver uses the bit map to remove successes from the success sum, as - * the oldest tx attempts fall out of the window. - * - * When the agn device makes multiple tx attempts for a given frame, each - * attempt might be at a different rate, and have different modulation - * characteristics (e.g. antenna, fat channel, short guard interval), as set - * up in the rate scaling table in the Link Quality command. The driver must - * determine which rate table entry was used for each tx attempt, to determine - * which rate-specific history to update, and record only those attempts that - * match the modulation characteristics of the history set. - * - * When using block-ack (aggregation), all frames are transmitted at the same - * rate, since there is no per-attempt acknowledgment from the destination - * station. The Tx response struct iwl_tx_resp indicates the Tx rate in - * rate_n_flags field. After receiving a block-ack, the driver can update - * history for the entire block all at once. - * - * - * FINDING BEST STARTING RATE: - * - * When working with a selected initial modulation mode (see below), the - * driver attempts to find a best initial rate. The initial rate is the - * first entry in the Link Quality command's rate table. - * - * 1) Calculate actual throughput (success ratio * expected throughput, see - * table below) for current initial rate. Do this only if enough frames - * have been attempted to make the value meaningful: at least 6 failed - * tx attempts, or at least 8 successes. If not enough, don't try rate - * scaling yet. - * - * 2) Find available rates adjacent to current initial rate. Available means: - * a) supported by hardware && - * b) supported by association && - * c) within any constraints selected by user - * - * 3) Gather measured throughputs for adjacent rates. These might not have - * enough history to calculate a throughput. That's okay, we might try - * using one of them anyway! - * - * 4) Try decreasing rate if, for current rate: - * a) success ratio is < 15% || - * b) lower adjacent rate has better measured throughput || - * c) higher adjacent rate has worse throughput, and lower is unmeasured - * - * As a sanity check, if decrease was determined above, leave rate - * unchanged if: - * a) lower rate unavailable - * b) success ratio at current rate > 85% (very good) - * c) current measured throughput is better than expected throughput - * of lower rate (under perfect 100% tx conditions, see table below) - * - * 5) Try increasing rate if, for current rate: - * a) success ratio is < 15% || - * b) both adjacent rates' throughputs are unmeasured (try it!) || - * b) higher adjacent rate has better measured throughput || - * c) lower adjacent rate has worse throughput, and higher is unmeasured - * - * As a sanity check, if increase was determined above, leave rate - * unchanged if: - * a) success ratio at current rate < 70%. This is not particularly - * good performance; higher rate is sure to have poorer success. - * - * 6) Re-evaluate the rate after each tx frame. If working with block- - * acknowledge, history and statistics may be calculated for the entire - * block (including prior history that fits within the history windows), - * before re-evaluation. - * - * FINDING BEST STARTING MODULATION MODE: - * - * After working with a modulation mode for a "while" (and doing rate scaling), - * the driver searches for a new initial mode in an attempt to improve - * throughput. The "while" is measured by numbers of attempted frames: - * - * For legacy mode, search for new mode after: - * 480 successful frames, or 160 failed frames - * For high-throughput modes (SISO or MIMO), search for new mode after: - * 4500 successful frames, or 400 failed frames - * - * Mode switch possibilities are (3 for each mode): - * - * For legacy: - * Change antenna, try SISO (if HT association), try MIMO (if HT association) - * For SISO: - * Change antenna, try MIMO, try shortened guard interval (SGI) - * For MIMO: - * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI) - * - * When trying a new mode, use the same bit rate as the old/current mode when - * trying antenna switches and shortened guard interval. When switching to - * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate - * for which the expected throughput (under perfect conditions) is about the - * same or slightly better than the actual measured throughput delivered by - * the old/current mode. - * - * Actual throughput can be estimated by multiplying the expected throughput - * by the success ratio (successful / attempted tx frames). Frame size is - * not considered in this calculation; it assumes that frame size will average - * out to be fairly consistent over several samples. The following are - * metric values for expected throughput assuming 100% success ratio. - * Only G band has support for CCK rates: - * - * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60 - * - * G: 7 13 35 58 40 57 72 98 121 154 177 186 186 - * A: 0 0 0 0 40 57 72 98 121 154 177 186 186 - * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202 - * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211 - * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251 - * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257 - * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257 - * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264 - * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289 - * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293 - * - * After the new mode has been tried for a short while (minimum of 6 failed - * frames or 8 successful frames), compare success ratio and actual throughput - * estimate of the new mode with the old. If either is better with the new - * mode, continue to use the new mode. - * - * Continue comparing modes until all 3 possibilities have been tried. - * If moving from legacy to HT, try all 3 possibilities from the new HT - * mode. After trying all 3, a best mode is found. Continue to use this mode - * for the longer "while" described above (e.g. 480 successful frames for - * legacy), and then repeat the search process. - * - */ -struct iwl_link_quality_cmd { - - /* Index of destination/recipient station in uCode's station table */ - u8 sta_id; - u8 reserved1; - __le16 control; /* not used */ - struct iwl_link_qual_general_params general_params; - struct iwl_link_qual_agg_params agg_params; - - /* - * Rate info; when using rate-scaling, Tx command's initial_rate_index - * specifies 1st Tx rate attempted, via index into this table. - * agn devices works its way through table when retrying Tx. - */ - struct { - __le32 rate_n_flags; /* RATE_MCS_*, IWL_RATE_* */ - } rs_table[LINK_QUAL_MAX_RETRY_NUM]; - __le32 reserved2; -} __packed; - -/* - * BT configuration enable flags: - * bit 0 - 1: BT channel announcement enabled - * 0: disable - * bit 1 - 1: priority of BT device enabled - * 0: disable - * bit 2 - 1: BT 2 wire support enabled - * 0: disable - */ -#define BT_COEX_DISABLE (0x0) -#define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0) -#define BT_ENABLE_PRIORITY BIT(1) -#define BT_ENABLE_2_WIRE BIT(2) - -#define BT_COEX_DISABLE (0x0) -#define BT_COEX_ENABLE (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY) - -#define BT_LEAD_TIME_MIN (0x0) -#define BT_LEAD_TIME_DEF (0x1E) -#define BT_LEAD_TIME_MAX (0xFF) - -#define BT_MAX_KILL_MIN (0x1) -#define BT_MAX_KILL_DEF (0x5) -#define BT_MAX_KILL_MAX (0xFF) - -#define BT_DURATION_LIMIT_DEF 625 -#define BT_DURATION_LIMIT_MAX 1250 -#define BT_DURATION_LIMIT_MIN 625 - -#define BT_ON_THRESHOLD_DEF 4 -#define BT_ON_THRESHOLD_MAX 1000 -#define BT_ON_THRESHOLD_MIN 1 - -#define BT_FRAG_THRESHOLD_DEF 0 -#define BT_FRAG_THRESHOLD_MAX 0 -#define BT_FRAG_THRESHOLD_MIN 0 - -#define BT_AGG_THRESHOLD_DEF 1200 -#define BT_AGG_THRESHOLD_MAX 8000 -#define BT_AGG_THRESHOLD_MIN 400 - -/* - * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) - * - * agn devices support hardware handshake with Bluetooth device on - * same platform. Bluetooth device alerts wireless device when it will Tx; - * wireless device can delay or kill its own Tx to accommodate. - */ -struct iwl_bt_cmd { - u8 flags; - u8 lead_time; - u8 max_kill; - u8 reserved; - __le32 kill_ack_mask; - __le32 kill_cts_mask; -} __packed; - -#define IWLAGN_BT_FLAG_CHANNEL_INHIBITION BIT(0) - -#define IWLAGN_BT_FLAG_COEX_MODE_MASK (BIT(3)|BIT(4)|BIT(5)) -#define IWLAGN_BT_FLAG_COEX_MODE_SHIFT 3 -#define IWLAGN_BT_FLAG_COEX_MODE_DISABLED 0 -#define IWLAGN_BT_FLAG_COEX_MODE_LEGACY_2W 1 -#define IWLAGN_BT_FLAG_COEX_MODE_3W 2 -#define IWLAGN_BT_FLAG_COEX_MODE_4W 3 - -#define IWLAGN_BT_FLAG_UCODE_DEFAULT BIT(6) -/* Disable Sync PSPoll on SCO/eSCO */ -#define IWLAGN_BT_FLAG_SYNC_2_BT_DISABLE BIT(7) - -#define IWLAGN_BT_PSP_MIN_RSSI_THRESHOLD -75 /* dBm */ -#define IWLAGN_BT_PSP_MAX_RSSI_THRESHOLD -65 /* dBm */ - -#define IWLAGN_BT_PRIO_BOOST_MAX 0xFF -#define IWLAGN_BT_PRIO_BOOST_MIN 0x00 -#define IWLAGN_BT_PRIO_BOOST_DEFAULT 0xF0 -#define IWLAGN_BT_PRIO_BOOST_DEFAULT32 0xF0F0F0F0 - -#define IWLAGN_BT_MAX_KILL_DEFAULT 5 - -#define IWLAGN_BT3_T7_DEFAULT 1 - -enum iwl_bt_kill_idx { - IWL_BT_KILL_DEFAULT = 0, - IWL_BT_KILL_OVERRIDE = 1, - IWL_BT_KILL_REDUCE = 2, -}; - -#define IWLAGN_BT_KILL_ACK_MASK_DEFAULT cpu_to_le32(0xffff0000) -#define IWLAGN_BT_KILL_CTS_MASK_DEFAULT cpu_to_le32(0xffff0000) -#define IWLAGN_BT_KILL_ACK_CTS_MASK_SCO cpu_to_le32(0xffffffff) -#define IWLAGN_BT_KILL_ACK_CTS_MASK_REDUCE cpu_to_le32(0) - -#define IWLAGN_BT3_PRIO_SAMPLE_DEFAULT 2 - -#define IWLAGN_BT3_T2_DEFAULT 0xc - -#define IWLAGN_BT_VALID_ENABLE_FLAGS cpu_to_le16(BIT(0)) -#define IWLAGN_BT_VALID_BOOST cpu_to_le16(BIT(1)) -#define IWLAGN_BT_VALID_MAX_KILL cpu_to_le16(BIT(2)) -#define IWLAGN_BT_VALID_3W_TIMERS cpu_to_le16(BIT(3)) -#define IWLAGN_BT_VALID_KILL_ACK_MASK cpu_to_le16(BIT(4)) -#define IWLAGN_BT_VALID_KILL_CTS_MASK cpu_to_le16(BIT(5)) -#define IWLAGN_BT_VALID_REDUCED_TX_PWR cpu_to_le16(BIT(6)) -#define IWLAGN_BT_VALID_3W_LUT cpu_to_le16(BIT(7)) - -#define IWLAGN_BT_ALL_VALID_MSK (IWLAGN_BT_VALID_ENABLE_FLAGS | \ - IWLAGN_BT_VALID_BOOST | \ - IWLAGN_BT_VALID_MAX_KILL | \ - IWLAGN_BT_VALID_3W_TIMERS | \ - IWLAGN_BT_VALID_KILL_ACK_MASK | \ - IWLAGN_BT_VALID_KILL_CTS_MASK | \ - IWLAGN_BT_VALID_REDUCED_TX_PWR | \ - IWLAGN_BT_VALID_3W_LUT) - -#define IWLAGN_BT_REDUCED_TX_PWR BIT(0) - -#define IWLAGN_BT_DECISION_LUT_SIZE 12 - -struct iwl_basic_bt_cmd { - u8 flags; - u8 ledtime; /* unused */ - u8 max_kill; - u8 bt3_timer_t7_value; - __le32 kill_ack_mask; - __le32 kill_cts_mask; - u8 bt3_prio_sample_time; - u8 bt3_timer_t2_value; - __le16 bt4_reaction_time; /* unused */ - __le32 bt3_lookup_table[IWLAGN_BT_DECISION_LUT_SIZE]; - /* - * bit 0: use reduced tx power for control frame - * bit 1 - 7: reserved - */ - u8 reduce_txpower; - u8 reserved; - __le16 valid; -}; - -struct iwl_bt_cmd_v1 { - struct iwl_basic_bt_cmd basic; - u8 prio_boost; - /* - * set IWLAGN_BT_VALID_BOOST to "1" in "valid" bitmask - * if configure the following patterns - */ - u8 tx_prio_boost; /* SW boost of WiFi tx priority */ - __le16 rx_prio_boost; /* SW boost of WiFi rx priority */ -}; - -struct iwl_bt_cmd_v2 { - struct iwl_basic_bt_cmd basic; - __le32 prio_boost; - /* - * set IWLAGN_BT_VALID_BOOST to "1" in "valid" bitmask - * if configure the following patterns - */ - u8 reserved; - u8 tx_prio_boost; /* SW boost of WiFi tx priority */ - __le16 rx_prio_boost; /* SW boost of WiFi rx priority */ -}; - -#define IWLAGN_BT_SCO_ACTIVE cpu_to_le32(BIT(0)) - -struct iwlagn_bt_sco_cmd { - __le32 flags; -}; - -/****************************************************************************** - * (6) - * Spectrum Management (802.11h) Commands, Responses, Notifications: - * - *****************************************************************************/ - -/* - * Spectrum Management - */ -#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \ - RXON_FILTER_CTL2HOST_MSK | \ - RXON_FILTER_ACCEPT_GRP_MSK | \ - RXON_FILTER_DIS_DECRYPT_MSK | \ - RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ - RXON_FILTER_ASSOC_MSK | \ - RXON_FILTER_BCON_AWARE_MSK) - -struct iwl_measure_channel { - __le32 duration; /* measurement duration in extended beacon - * format */ - u8 channel; /* channel to measure */ - u8 type; /* see enum iwl_measure_type */ - __le16 reserved; -} __packed; - -/* - * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) - */ -struct iwl_spectrum_cmd { - __le16 len; /* number of bytes starting from token */ - u8 token; /* token id */ - u8 id; /* measurement id -- 0 or 1 */ - u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */ - u8 periodic; /* 1 = periodic */ - __le16 path_loss_timeout; - __le32 start_time; /* start time in extended beacon format */ - __le32 reserved2; - __le32 flags; /* rxon flags */ - __le32 filter_flags; /* rxon filter flags */ - __le16 channel_count; /* minimum 1, maximum 10 */ - __le16 reserved3; - struct iwl_measure_channel channels[10]; -} __packed; - -/* - * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) - */ -struct iwl_spectrum_resp { - u8 token; - u8 id; /* id of the prior command replaced, or 0xff */ - __le16 status; /* 0 - command will be handled - * 1 - cannot handle (conflicts with another - * measurement) */ -} __packed; - -enum iwl_measurement_state { - IWL_MEASUREMENT_START = 0, - IWL_MEASUREMENT_STOP = 1, -}; - -enum iwl_measurement_status { - IWL_MEASUREMENT_OK = 0, - IWL_MEASUREMENT_CONCURRENT = 1, - IWL_MEASUREMENT_CSA_CONFLICT = 2, - IWL_MEASUREMENT_TGH_CONFLICT = 3, - /* 4-5 reserved */ - IWL_MEASUREMENT_STOPPED = 6, - IWL_MEASUREMENT_TIMEOUT = 7, - IWL_MEASUREMENT_PERIODIC_FAILED = 8, -}; - -#define NUM_ELEMENTS_IN_HISTOGRAM 8 - -struct iwl_measurement_histogram { - __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ - __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ -} __packed; - -/* clear channel availability counters */ -struct iwl_measurement_cca_counters { - __le32 ofdm; - __le32 cck; -} __packed; - -enum iwl_measure_type { - IWL_MEASURE_BASIC = (1 << 0), - IWL_MEASURE_CHANNEL_LOAD = (1 << 1), - IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), - IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3), - IWL_MEASURE_FRAME = (1 << 4), - /* bits 5:6 are reserved */ - IWL_MEASURE_IDLE = (1 << 7), -}; - -/* - * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) - */ -struct iwl_spectrum_notification { - u8 id; /* measurement id -- 0 or 1 */ - u8 token; - u8 channel_index; /* index in measurement channel list */ - u8 state; /* 0 - start, 1 - stop */ - __le32 start_time; /* lower 32-bits of TSF */ - u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ - u8 channel; - u8 type; /* see enum iwl_measurement_type */ - u8 reserved1; - /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only - * valid if applicable for measurement type requested. */ - __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */ - __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */ - __le32 cca_time; /* channel load time in usecs */ - u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - - * unidentified */ - u8 reserved2[3]; - struct iwl_measurement_histogram histogram; - __le32 stop_time; /* lower 32-bits of TSF */ - __le32 status; /* see iwl_measurement_status */ -} __packed; - -/****************************************************************************** - * (7) - * Power Management Commands, Responses, Notifications: - * - *****************************************************************************/ - -/** - * struct iwl_powertable_cmd - Power Table Command - * @flags: See below: - * - * POWER_TABLE_CMD = 0x77 (command, has simple generic response) - * - * PM allow: - * bit 0 - '0' Driver not allow power management - * '1' Driver allow PM (use rest of parameters) - * - * uCode send sleep notifications: - * bit 1 - '0' Don't send sleep notification - * '1' send sleep notification (SEND_PM_NOTIFICATION) - * - * Sleep over DTIM - * bit 2 - '0' PM have to walk up every DTIM - * '1' PM could sleep over DTIM till listen Interval. - * - * PCI power managed - * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1) - * '1' !(PCI_CFG_LINK_CTRL & 0x1) - * - * Fast PD - * bit 4 - '1' Put radio to sleep when receiving frame for others - * - * Force sleep Modes - * bit 31/30- '00' use both mac/xtal sleeps - * '01' force Mac sleep - * '10' force xtal sleep - * '11' Illegal set - * - * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then - * ucode assume sleep over DTIM is allowed and we don't need to wake up - * for every DTIM. - */ -#define IWL_POWER_VEC_SIZE 5 - -#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0)) -#define IWL_POWER_POWER_SAVE_ENA_MSK cpu_to_le16(BIT(0)) -#define IWL_POWER_POWER_MANAGEMENT_ENA_MSK cpu_to_le16(BIT(1)) -#define IWL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le16(BIT(2)) -#define IWL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3)) -#define IWL_POWER_FAST_PD cpu_to_le16(BIT(4)) -#define IWL_POWER_BEACON_FILTERING cpu_to_le16(BIT(5)) -#define IWL_POWER_SHADOW_REG_ENA cpu_to_le16(BIT(6)) -#define IWL_POWER_CT_KILL_SET cpu_to_le16(BIT(7)) -#define IWL_POWER_BT_SCO_ENA cpu_to_le16(BIT(8)) -#define IWL_POWER_ADVANCE_PM_ENA_MSK cpu_to_le16(BIT(9)) - -struct iwl_powertable_cmd { - __le16 flags; - u8 keep_alive_seconds; - u8 debug_flags; - __le32 rx_data_timeout; - __le32 tx_data_timeout; - __le32 sleep_interval[IWL_POWER_VEC_SIZE]; - __le32 keep_alive_beacons; -} __packed; - -/* - * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) - * all devices identical. - */ -struct iwl_sleep_notification { - u8 pm_sleep_mode; - u8 pm_wakeup_src; - __le16 reserved; - __le32 sleep_time; - __le32 tsf_low; - __le32 bcon_timer; -} __packed; - -/* Sleep states. all devices identical. */ -enum { - IWL_PM_NO_SLEEP = 0, - IWL_PM_SLP_MAC = 1, - IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, - IWL_PM_SLP_FULL_MAC_CARD_STATE = 3, - IWL_PM_SLP_PHY = 4, - IWL_PM_SLP_REPENT = 5, - IWL_PM_WAKEUP_BY_TIMER = 6, - IWL_PM_WAKEUP_BY_DRIVER = 7, - IWL_PM_WAKEUP_BY_RFKILL = 8, - /* 3 reserved */ - IWL_PM_NUM_OF_MODES = 12, -}; - -/* - * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response) - */ -#define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ -#define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ -#define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ -struct iwl_card_state_cmd { - __le32 status; /* CARD_STATE_CMD_* request new power state */ -} __packed; - -/* - * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) - */ -struct iwl_card_state_notif { - __le32 flags; -} __packed; - -#define HW_CARD_DISABLED 0x01 -#define SW_CARD_DISABLED 0x02 -#define CT_CARD_DISABLED 0x04 -#define RXON_CARD_DISABLED 0x10 - -struct iwl_ct_kill_config { - __le32 reserved; - __le32 critical_temperature_M; - __le32 critical_temperature_R; -} __packed; - -/* 1000, and 6x00 */ -struct iwl_ct_kill_throttling_config { - __le32 critical_temperature_exit; - __le32 reserved; - __le32 critical_temperature_enter; -} __packed; - -/****************************************************************************** - * (8) - * Scan Commands, Responses, Notifications: - * - *****************************************************************************/ - -#define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0) -#define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1) - -/** - * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table - * - * One for each channel in the scan list. - * Each channel can independently select: - * 1) SSID for directed active scans - * 2) Txpower setting (for rate specified within Tx command) - * 3) How long to stay on-channel (behavior may be modified by quiet_time, - * quiet_plcp_th, good_CRC_th) - * - * To avoid uCode errors, make sure the following are true (see comments - * under struct iwl_scan_cmd about max_out_time and quiet_time): - * 1) If using passive_dwell (i.e. passive_dwell != 0): - * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) - * 2) quiet_time <= active_dwell - * 3) If restricting off-channel time (i.e. max_out_time !=0): - * passive_dwell < max_out_time - * active_dwell < max_out_time - */ - -struct iwl_scan_channel { - /* - * type is defined as: - * 0:0 1 = active, 0 = passive - * 1:20 SSID direct bit map; if a bit is set, then corresponding - * SSID IE is transmitted in probe request. - * 21:31 reserved - */ - __le32 type; - __le16 channel; /* band is selected by iwl_scan_cmd "flags" field */ - u8 tx_gain; /* gain for analog radio */ - u8 dsp_atten; /* gain for DSP */ - __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ - __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ -} __packed; - -/* set number of direct probes __le32 type */ -#define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) - -/** - * struct iwl_ssid_ie - directed scan network information element - * - * Up to 20 of these may appear in REPLY_SCAN_CMD, - * selected by "type" bit field in struct iwl_scan_channel; - * each channel may select different ssids from among the 20 entries. - * SSID IEs get transmitted in reverse order of entry. - */ -struct iwl_ssid_ie { - u8 id; - u8 len; - u8 ssid[32]; -} __packed; - -#define PROBE_OPTION_MAX 20 -#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) -#define IWL_GOOD_CRC_TH_DISABLED 0 -#define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1) -#define IWL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff) -#define IWL_MAX_CMD_SIZE 4096 - -/* - * REPLY_SCAN_CMD = 0x80 (command) - * - * The hardware scan command is very powerful; the driver can set it up to - * maintain (relatively) normal network traffic while doing a scan in the - * background. The max_out_time and suspend_time control the ratio of how - * long the device stays on an associated network channel ("service channel") - * vs. how long it's away from the service channel, i.e. tuned to other channels - * for scanning. - * - * max_out_time is the max time off-channel (in usec), and suspend_time - * is how long (in "extended beacon" format) that the scan is "suspended" - * after returning to the service channel. That is, suspend_time is the - * time that we stay on the service channel, doing normal work, between - * scan segments. The driver may set these parameters differently to support - * scanning when associated vs. not associated, and light vs. heavy traffic - * loads when associated. - * - * After receiving this command, the device's scan engine does the following; - * - * 1) Sends SCAN_START notification to driver - * 2) Checks to see if it has time to do scan for one channel - * 3) Sends NULL packet, with power-save (PS) bit set to 1, - * to tell AP that we're going off-channel - * 4) Tunes to first channel in scan list, does active or passive scan - * 5) Sends SCAN_RESULT notification to driver - * 6) Checks to see if it has time to do scan on *next* channel in list - * 7) Repeats 4-6 until it no longer has time to scan the next channel - * before max_out_time expires - * 8) Returns to service channel - * 9) Sends NULL packet with PS=0 to tell AP that we're back - * 10) Stays on service channel until suspend_time expires - * 11) Repeats entire process 2-10 until list is complete - * 12) Sends SCAN_COMPLETE notification - * - * For fast, efficient scans, the scan command also has support for staying on - * a channel for just a short time, if doing active scanning and getting no - * responses to the transmitted probe request. This time is controlled by - * quiet_time, and the number of received packets below which a channel is - * considered "quiet" is controlled by quiet_plcp_threshold. - * - * For active scanning on channels that have regulatory restrictions against - * blindly transmitting, the scan can listen before transmitting, to make sure - * that there is already legitimate activity on the channel. If enough - * packets are cleanly received on the channel (controlled by good_CRC_th, - * typical value 1), the scan engine starts transmitting probe requests. - * - * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. - * - * To avoid uCode errors, see timing restrictions described under - * struct iwl_scan_channel. - */ - -enum iwl_scan_flags { - /* BIT(0) currently unused */ - IWL_SCAN_FLAGS_ACTION_FRAME_TX = BIT(1), - /* bits 2-7 reserved */ -}; - -struct iwl_scan_cmd { - __le16 len; - u8 scan_flags; /* scan flags: see enum iwl_scan_flags */ - u8 channel_count; /* # channels in channel list */ - __le16 quiet_time; /* dwell only this # millisecs on quiet channel - * (only for active scan) */ - __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ - __le16 good_CRC_th; /* passive -> active promotion threshold */ - __le16 rx_chain; /* RXON_RX_CHAIN_* */ - __le32 max_out_time; /* max usec to be away from associated (service) - * channel */ - __le32 suspend_time; /* pause scan this long (in "extended beacon - * format") when returning to service chnl: - */ - __le32 flags; /* RXON_FLG_* */ - __le32 filter_flags; /* RXON_FILTER_* */ - - /* For active scans (set to all-0s for passive scans). - * Does not include payload. Must specify Tx rate; no rate scaling. */ - struct iwl_tx_cmd tx_cmd; - - /* For directed active scans (set to all-0s otherwise) */ - struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; - - /* - * Probe request frame, followed by channel list. - * - * Size of probe request frame is specified by byte count in tx_cmd. - * Channel list follows immediately after probe request frame. - * Number of channels in list is specified by channel_count. - * Each channel in list is of type: - * - * struct iwl_scan_channel channels[0]; - * - * NOTE: Only one band of channels can be scanned per pass. You - * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait - * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION) - * before requesting another scan. - */ - u8 data[0]; -} __packed; - -/* Can abort will notify by complete notification with abort status. */ -#define CAN_ABORT_STATUS cpu_to_le32(0x1) -/* complete notification statuses */ -#define ABORT_STATUS 0x2 - -/* - * REPLY_SCAN_CMD = 0x80 (response) - */ -struct iwl_scanreq_notification { - __le32 status; /* 1: okay, 2: cannot fulfill request */ -} __packed; - -/* - * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) - */ -struct iwl_scanstart_notification { - __le32 tsf_low; - __le32 tsf_high; - __le32 beacon_timer; - u8 channel; - u8 band; - u8 reserved[2]; - __le32 status; -} __packed; - -#define SCAN_OWNER_STATUS 0x1 -#define MEASURE_OWNER_STATUS 0x2 - -#define IWL_PROBE_STATUS_OK 0 -#define IWL_PROBE_STATUS_TX_FAILED BIT(0) -/* error statuses combined with TX_FAILED */ -#define IWL_PROBE_STATUS_FAIL_TTL BIT(1) -#define IWL_PROBE_STATUS_FAIL_BT BIT(2) - -#define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ -/* - * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) - */ -struct iwl_scanresults_notification { - u8 channel; - u8 band; - u8 probe_status; - u8 num_probe_not_sent; /* not enough time to send */ - __le32 tsf_low; - __le32 tsf_high; - __le32 statistics[NUMBER_OF_STATISTICS]; -} __packed; - -/* - * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) - */ -struct iwl_scancomplete_notification { - u8 scanned_channels; - u8 status; - u8 bt_status; /* BT On/Off status */ - u8 last_channel; - __le32 tsf_low; - __le32 tsf_high; -} __packed; - - -/****************************************************************************** - * (9) - * IBSS/AP Commands and Notifications: - * - *****************************************************************************/ - -enum iwl_ibss_manager { - IWL_NOT_IBSS_MANAGER = 0, - IWL_IBSS_MANAGER = 1, -}; - -/* - * BEACON_NOTIFICATION = 0x90 (notification only, not a command) - */ - -struct iwlagn_beacon_notif { - struct iwlagn_tx_resp beacon_notify_hdr; - __le32 low_tsf; - __le32 high_tsf; - __le32 ibss_mgr_status; -} __packed; - -/* - * REPLY_TX_BEACON = 0x91 (command, has simple generic response) - */ - -struct iwl_tx_beacon_cmd { - struct iwl_tx_cmd tx; - __le16 tim_idx; - u8 tim_size; - u8 reserved1; - struct ieee80211_hdr frame[0]; /* beacon frame */ -} __packed; - -/****************************************************************************** - * (10) - * Statistics Commands and Notifications: - * - *****************************************************************************/ - -#define IWL_TEMP_CONVERT 260 - -#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 -#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 -#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 - -/* Used for passing to driver number of successes and failures per rate */ -struct rate_histogram { - union { - __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; - __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; - __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; - } success; - union { - __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; - __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; - __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; - } failed; -} __packed; - -/* statistics command response */ - -struct statistics_dbg { - __le32 burst_check; - __le32 burst_count; - __le32 wait_for_silence_timeout_cnt; - __le32 reserved[3]; -} __packed; - -struct statistics_rx_phy { - __le32 ina_cnt; - __le32 fina_cnt; - __le32 plcp_err; - __le32 crc32_err; - __le32 overrun_err; - __le32 early_overrun_err; - __le32 crc32_good; - __le32 false_alarm_cnt; - __le32 fina_sync_err_cnt; - __le32 sfd_timeout; - __le32 fina_timeout; - __le32 unresponded_rts; - __le32 rxe_frame_limit_overrun; - __le32 sent_ack_cnt; - __le32 sent_cts_cnt; - __le32 sent_ba_rsp_cnt; - __le32 dsp_self_kill; - __le32 mh_format_err; - __le32 re_acq_main_rssi_sum; - __le32 reserved3; -} __packed; - -struct statistics_rx_ht_phy { - __le32 plcp_err; - __le32 overrun_err; - __le32 early_overrun_err; - __le32 crc32_good; - __le32 crc32_err; - __le32 mh_format_err; - __le32 agg_crc32_good; - __le32 agg_mpdu_cnt; - __le32 agg_cnt; - __le32 unsupport_mcs; -} __packed; - -#define INTERFERENCE_DATA_AVAILABLE cpu_to_le32(1) - -struct statistics_rx_non_phy { - __le32 bogus_cts; /* CTS received when not expecting CTS */ - __le32 bogus_ack; /* ACK received when not expecting ACK */ - __le32 non_bssid_frames; /* number of frames with BSSID that - * doesn't belong to the STA BSSID */ - __le32 filtered_frames; /* count frames that were dumped in the - * filtering process */ - __le32 non_channel_beacons; /* beacons with our bss id but not on - * our serving channel */ - __le32 channel_beacons; /* beacons with our bss id and in our - * serving channel */ - __le32 num_missed_bcon; /* number of missed beacons */ - __le32 adc_rx_saturation_time; /* count in 0.8us units the time the - * ADC was in saturation */ - __le32 ina_detection_search_time;/* total time (in 0.8us) searched - * for INA */ - __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */ - __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */ - __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */ - __le32 interference_data_flag; /* flag for interference data - * availability. 1 when data is - * available. */ - __le32 channel_load; /* counts RX Enable time in uSec */ - __le32 dsp_false_alarms; /* DSP false alarm (both OFDM - * and CCK) counter */ - __le32 beacon_rssi_a; - __le32 beacon_rssi_b; - __le32 beacon_rssi_c; - __le32 beacon_energy_a; - __le32 beacon_energy_b; - __le32 beacon_energy_c; -} __packed; - -struct statistics_rx_non_phy_bt { - struct statistics_rx_non_phy common; - /* additional stats for bt */ - __le32 num_bt_kills; - __le32 reserved[2]; -} __packed; - -struct statistics_rx { - struct statistics_rx_phy ofdm; - struct statistics_rx_phy cck; - struct statistics_rx_non_phy general; - struct statistics_rx_ht_phy ofdm_ht; -} __packed; - -struct statistics_rx_bt { - struct statistics_rx_phy ofdm; - struct statistics_rx_phy cck; - struct statistics_rx_non_phy_bt general; - struct statistics_rx_ht_phy ofdm_ht; -} __packed; - -/** - * struct statistics_tx_power - current tx power - * - * @ant_a: current tx power on chain a in 1/2 dB step - * @ant_b: current tx power on chain b in 1/2 dB step - * @ant_c: current tx power on chain c in 1/2 dB step - */ -struct statistics_tx_power { - u8 ant_a; - u8 ant_b; - u8 ant_c; - u8 reserved; -} __packed; - -struct statistics_tx_non_phy_agg { - __le32 ba_timeout; - __le32 ba_reschedule_frames; - __le32 scd_query_agg_frame_cnt; - __le32 scd_query_no_agg; - __le32 scd_query_agg; - __le32 scd_query_mismatch; - __le32 frame_not_ready; - __le32 underrun; - __le32 bt_prio_kill; - __le32 rx_ba_rsp_cnt; -} __packed; - -struct statistics_tx { - __le32 preamble_cnt; - __le32 rx_detected_cnt; - __le32 bt_prio_defer_cnt; - __le32 bt_prio_kill_cnt; - __le32 few_bytes_cnt; - __le32 cts_timeout; - __le32 ack_timeout; - __le32 expected_ack_cnt; - __le32 actual_ack_cnt; - __le32 dump_msdu_cnt; - __le32 burst_abort_next_frame_mismatch_cnt; - __le32 burst_abort_missing_next_frame_cnt; - __le32 cts_timeout_collision; - __le32 ack_or_ba_timeout_collision; - struct statistics_tx_non_phy_agg agg; - /* - * "tx_power" are optional parameters provided by uCode, - * 6000 series is the only device provide the information, - * Those are reserved fields for all the other devices - */ - struct statistics_tx_power tx_power; - __le32 reserved1; -} __packed; - - -struct statistics_div { - __le32 tx_on_a; - __le32 tx_on_b; - __le32 exec_time; - __le32 probe_time; - __le32 reserved1; - __le32 reserved2; -} __packed; - -struct statistics_general_common { - __le32 temperature; /* radio temperature */ - __le32 temperature_m; /* radio voltage */ - struct statistics_dbg dbg; - __le32 sleep_time; - __le32 slots_out; - __le32 slots_idle; - __le32 ttl_timestamp; - struct statistics_div div; - __le32 rx_enable_counter; - /* - * num_of_sos_states: - * count the number of times we have to re-tune - * in order to get out of bad PHY status - */ - __le32 num_of_sos_states; -} __packed; - -struct statistics_bt_activity { - /* Tx statistics */ - __le32 hi_priority_tx_req_cnt; - __le32 hi_priority_tx_denied_cnt; - __le32 lo_priority_tx_req_cnt; - __le32 lo_priority_tx_denied_cnt; - /* Rx statistics */ - __le32 hi_priority_rx_req_cnt; - __le32 hi_priority_rx_denied_cnt; - __le32 lo_priority_rx_req_cnt; - __le32 lo_priority_rx_denied_cnt; -} __packed; - -struct statistics_general { - struct statistics_general_common common; - __le32 reserved2; - __le32 reserved3; -} __packed; - -struct statistics_general_bt { - struct statistics_general_common common; - struct statistics_bt_activity activity; - __le32 reserved2; - __le32 reserved3; -} __packed; - -#define UCODE_STATISTICS_CLEAR_MSK (0x1 << 0) -#define UCODE_STATISTICS_FREQUENCY_MSK (0x1 << 1) -#define UCODE_STATISTICS_NARROW_BAND_MSK (0x1 << 2) - -/* - * REPLY_STATISTICS_CMD = 0x9c, - * all devices identical. - * - * This command triggers an immediate response containing uCode statistics. - * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below. - * - * If the CLEAR_STATS configuration flag is set, uCode will clear its - * internal copy of the statistics (counters) after issuing the response. - * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below). - * - * If the DISABLE_NOTIF configuration flag is set, uCode will not issue - * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag - * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. - */ -#define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */ -#define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */ -struct iwl_statistics_cmd { - __le32 configuration_flags; /* IWL_STATS_CONF_* */ -} __packed; - -/* - * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command) - * - * By default, uCode issues this notification after receiving a beacon - * while associated. To disable this behavior, set DISABLE_NOTIF flag in the - * REPLY_STATISTICS_CMD 0x9c, above. - * - * Statistics counters continue to increment beacon after beacon, but are - * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD - * 0x9c with CLEAR_STATS bit set (see above). - * - * uCode also issues this notification during scans. uCode clears statistics - * appropriately so that each notification contains statistics for only the - * one channel that has just been scanned. - */ -#define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2) -#define STATISTICS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8) - -struct iwl_notif_statistics { - __le32 flag; - struct statistics_rx rx; - struct statistics_tx tx; - struct statistics_general general; -} __packed; - -struct iwl_bt_notif_statistics { - __le32 flag; - struct statistics_rx_bt rx; - struct statistics_tx tx; - struct statistics_general_bt general; -} __packed; - -/* - * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) - * - * uCode send MISSED_BEACONS_NOTIFICATION to driver when detect beacon missed - * in regardless of how many missed beacons, which mean when driver receive the - * notification, inside the command, it can find all the beacons information - * which include number of total missed beacons, number of consecutive missed - * beacons, number of beacons received and number of beacons expected to - * receive. - * - * If uCode detected consecutive_missed_beacons > 5, it will reset the radio - * in order to bring the radio/PHY back to working state; which has no relation - * to when driver will perform sensitivity calibration. - * - * Driver should set it own missed_beacon_threshold to decide when to perform - * sensitivity calibration based on number of consecutive missed beacons in - * order to improve overall performance, especially in noisy environment. - * - */ - -#define IWL_MISSED_BEACON_THRESHOLD_MIN (1) -#define IWL_MISSED_BEACON_THRESHOLD_DEF (5) -#define IWL_MISSED_BEACON_THRESHOLD_MAX IWL_MISSED_BEACON_THRESHOLD_DEF - -struct iwl_missed_beacon_notif { - __le32 consecutive_missed_beacons; - __le32 total_missed_becons; - __le32 num_expected_beacons; - __le32 num_recvd_beacons; -} __packed; - - -/****************************************************************************** - * (11) - * Rx Calibration Commands: - * - * With the uCode used for open source drivers, most Tx calibration (except - * for Tx Power) and most Rx calibration is done by uCode during the - * "initialize" phase of uCode boot. Driver must calibrate only: - * - * 1) Tx power (depends on temperature), described elsewhere - * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas) - * 3) Receiver sensitivity (to optimize signal detection) - * - *****************************************************************************/ - -/** - * SENSITIVITY_CMD = 0xa8 (command, has simple generic response) - * - * This command sets up the Rx signal detector for a sensitivity level that - * is high enough to lock onto all signals within the associated network, - * but low enough to ignore signals that are below a certain threshold, so as - * not to have too many "false alarms". False alarms are signals that the - * Rx DSP tries to lock onto, but then discards after determining that they - * are noise. - * - * The optimum number of false alarms is between 5 and 50 per 200 TUs - * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e. - * time listening, not transmitting). Driver must adjust sensitivity so that - * the ratio of actual false alarms to actual Rx time falls within this range. - * - * While associated, uCode delivers STATISTICS_NOTIFICATIONs after each - * received beacon. These provide information to the driver to analyze the - * sensitivity. Don't analyze statistics that come in from scanning, or any - * other non-associated-network source. Pertinent statistics include: - * - * From "general" statistics (struct statistics_rx_non_phy): - * - * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level) - * Measure of energy of desired signal. Used for establishing a level - * below which the device does not detect signals. - * - * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB) - * Measure of background noise in silent period after beacon. - * - * channel_load - * uSecs of actual Rx time during beacon period (varies according to - * how much time was spent transmitting). - * - * From "cck" and "ofdm" statistics (struct statistics_rx_phy), separately: - * - * false_alarm_cnt - * Signal locks abandoned early (before phy-level header). - * - * plcp_err - * Signal locks abandoned late (during phy-level header). - * - * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from - * beacon to beacon, i.e. each value is an accumulation of all errors - * before and including the latest beacon. Values will wrap around to 0 - * after counting up to 2^32 - 1. Driver must differentiate vs. - * previous beacon's values to determine # false alarms in the current - * beacon period. - * - * Total number of false alarms = false_alarms + plcp_errs - * - * For OFDM, adjust the following table entries in struct iwl_sensitivity_cmd - * (notice that the start points for OFDM are at or close to settings for - * maximum sensitivity): - * - * START / MIN / MAX - * HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX 90 / 85 / 120 - * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX 170 / 170 / 210 - * HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX 105 / 105 / 140 - * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX 220 / 220 / 270 - * - * If actual rate of OFDM false alarms (+ plcp_errors) is too high - * (greater than 50 for each 204.8 msecs listening), reduce sensitivity - * by *adding* 1 to all 4 of the table entries above, up to the max for - * each entry. Conversely, if false alarm rate is too low (less than 5 - * for each 204.8 msecs listening), *subtract* 1 from each entry to - * increase sensitivity. - * - * For CCK sensitivity, keep track of the following: - * - * 1). 20-beacon history of maximum background noise, indicated by - * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the - * 3 receivers. For any given beacon, the "silence reference" is - * the maximum of last 60 samples (20 beacons * 3 receivers). - * - * 2). 10-beacon history of strongest signal level, as indicated - * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers, - * i.e. the strength of the signal through the best receiver at the - * moment. These measurements are "upside down", with lower values - * for stronger signals, so max energy will be *minimum* value. - * - * Then for any given beacon, the driver must determine the *weakest* - * of the strongest signals; this is the minimum level that needs to be - * successfully detected, when using the best receiver at the moment. - * "Max cck energy" is the maximum (higher value means lower energy!) - * of the last 10 minima. Once this is determined, driver must add - * a little margin by adding "6" to it. - * - * 3). Number of consecutive beacon periods with too few false alarms. - * Reset this to 0 at the first beacon period that falls within the - * "good" range (5 to 50 false alarms per 204.8 milliseconds rx). - * - * Then, adjust the following CCK table entries in struct iwl_sensitivity_cmd - * (notice that the start points for CCK are at maximum sensitivity): - * - * START / MIN / MAX - * HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX 125 / 125 / 200 - * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX 200 / 200 / 400 - * HD_MIN_ENERGY_CCK_DET_INDEX 100 / 0 / 100 - * - * If actual rate of CCK false alarms (+ plcp_errors) is too high - * (greater than 50 for each 204.8 msecs listening), method for reducing - * sensitivity is: - * - * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX, - * up to max 400. - * - * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is < 160, - * sensitivity has been reduced a significant amount; bring it up to - * a moderate 161. Otherwise, *add* 3, up to max 200. - * - * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is > 160, - * sensitivity has been reduced only a moderate or small amount; - * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_INDEX, - * down to min 0. Otherwise (if gain has been significantly reduced), - * don't change the HD_MIN_ENERGY_CCK_DET_INDEX value. - * - * b) Save a snapshot of the "silence reference". - * - * If actual rate of CCK false alarms (+ plcp_errors) is too low - * (less than 5 for each 204.8 msecs listening), method for increasing - * sensitivity is used only if: - * - * 1a) Previous beacon did not have too many false alarms - * 1b) AND difference between previous "silence reference" and current - * "silence reference" (prev - current) is 2 or more, - * OR 2) 100 or more consecutive beacon periods have had rate of - * less than 5 false alarms per 204.8 milliseconds rx time. - * - * Method for increasing sensitivity: - * - * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX, - * down to min 125. - * - * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX, - * down to min 200. - * - * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_INDEX, up to max 100. - * - * If actual rate of CCK false alarms (+ plcp_errors) is within good range - * (between 5 and 50 for each 204.8 msecs listening): - * - * 1) Save a snapshot of the silence reference. - * - * 2) If previous beacon had too many CCK false alarms (+ plcp_errors), - * give some extra margin to energy threshold by *subtracting* 8 - * from value in HD_MIN_ENERGY_CCK_DET_INDEX. - * - * For all cases (too few, too many, good range), make sure that the CCK - * detection threshold (energy) is below the energy level for robust - * detection over the past 10 beacon periods, the "Max cck energy". - * Lower values mean higher energy; this means making sure that the value - * in HD_MIN_ENERGY_CCK_DET_INDEX is at or *above* "Max cck energy". - * - */ - -/* - * Table entries in SENSITIVITY_CMD (struct iwl_sensitivity_cmd) - */ -#define HD_TABLE_SIZE (11) /* number of entries */ -#define HD_MIN_ENERGY_CCK_DET_INDEX (0) /* table indexes */ -#define HD_MIN_ENERGY_OFDM_DET_INDEX (1) -#define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX (2) -#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX (3) -#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX (4) -#define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX (5) -#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX (6) -#define HD_BARKER_CORR_TH_ADD_MIN_INDEX (7) -#define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX (8) -#define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9) -#define HD_OFDM_ENERGY_TH_IN_INDEX (10) - -/* - * Additional table entries in enhance SENSITIVITY_CMD - */ -#define HD_INA_NON_SQUARE_DET_OFDM_INDEX (11) -#define HD_INA_NON_SQUARE_DET_CCK_INDEX (12) -#define HD_CORR_11_INSTEAD_OF_CORR_9_EN_INDEX (13) -#define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_INDEX (14) -#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_INDEX (15) -#define HD_OFDM_NON_SQUARE_DET_SLOPE_INDEX (16) -#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_INDEX (17) -#define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_INDEX (18) -#define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_INDEX (19) -#define HD_CCK_NON_SQUARE_DET_SLOPE_INDEX (20) -#define HD_CCK_NON_SQUARE_DET_INTERCEPT_INDEX (21) -#define HD_RESERVED (22) - -/* number of entries for enhanced tbl */ -#define ENHANCE_HD_TABLE_SIZE (23) - -/* number of additional entries for enhanced tbl */ -#define ENHANCE_HD_TABLE_ENTRIES (ENHANCE_HD_TABLE_SIZE - HD_TABLE_SIZE) - -#define HD_INA_NON_SQUARE_DET_OFDM_DATA_V1 cpu_to_le16(0) -#define HD_INA_NON_SQUARE_DET_CCK_DATA_V1 cpu_to_le16(0) -#define HD_CORR_11_INSTEAD_OF_CORR_9_EN_DATA_V1 cpu_to_le16(0) -#define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_DATA_V1 cpu_to_le16(668) -#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V1 cpu_to_le16(4) -#define HD_OFDM_NON_SQUARE_DET_SLOPE_DATA_V1 cpu_to_le16(486) -#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_DATA_V1 cpu_to_le16(37) -#define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_DATA_V1 cpu_to_le16(853) -#define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V1 cpu_to_le16(4) -#define HD_CCK_NON_SQUARE_DET_SLOPE_DATA_V1 cpu_to_le16(476) -#define HD_CCK_NON_SQUARE_DET_INTERCEPT_DATA_V1 cpu_to_le16(99) - -#define HD_INA_NON_SQUARE_DET_OFDM_DATA_V2 cpu_to_le16(1) -#define HD_INA_NON_SQUARE_DET_CCK_DATA_V2 cpu_to_le16(1) -#define HD_CORR_11_INSTEAD_OF_CORR_9_EN_DATA_V2 cpu_to_le16(1) -#define HD_OFDM_NON_SQUARE_DET_SLOPE_MRC_DATA_V2 cpu_to_le16(600) -#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V2 cpu_to_le16(40) -#define HD_OFDM_NON_SQUARE_DET_SLOPE_DATA_V2 cpu_to_le16(486) -#define HD_OFDM_NON_SQUARE_DET_INTERCEPT_DATA_V2 cpu_to_le16(45) -#define HD_CCK_NON_SQUARE_DET_SLOPE_MRC_DATA_V2 cpu_to_le16(853) -#define HD_CCK_NON_SQUARE_DET_INTERCEPT_MRC_DATA_V2 cpu_to_le16(60) -#define HD_CCK_NON_SQUARE_DET_SLOPE_DATA_V2 cpu_to_le16(476) -#define HD_CCK_NON_SQUARE_DET_INTERCEPT_DATA_V2 cpu_to_le16(99) - - -/* Control field in struct iwl_sensitivity_cmd */ -#define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE cpu_to_le16(0) -#define SENSITIVITY_CMD_CONTROL_WORK_TABLE cpu_to_le16(1) - -/** - * struct iwl_sensitivity_cmd - * @control: (1) updates working table, (0) updates default table - * @table: energy threshold values, use HD_* as index into table - * - * Always use "1" in "control" to update uCode's working table and DSP. - */ -struct iwl_sensitivity_cmd { - __le16 control; /* always use "1" */ - __le16 table[HD_TABLE_SIZE]; /* use HD_* as index */ -} __packed; - -/* - * - */ -struct iwl_enhance_sensitivity_cmd { - __le16 control; /* always use "1" */ - __le16 enhance_table[ENHANCE_HD_TABLE_SIZE]; /* use HD_* as index */ -} __packed; - - -/** - * REPLY_PHY_CALIBRATION_CMD = 0xb0 (command, has simple generic response) - * - * This command sets the relative gains of agn device's 3 radio receiver chains. - * - * After the first association, driver should accumulate signal and noise - * statistics from the STATISTICS_NOTIFICATIONs that follow the first 20 - * beacons from the associated network (don't collect statistics that come - * in from scanning, or any other non-network source). - * - * DISCONNECTED ANTENNA: - * - * Driver should determine which antennas are actually connected, by comparing - * average beacon signal levels for the 3 Rx chains. Accumulate (add) the - * following values over 20 beacons, one accumulator for each of the chains - * a/b/c, from struct statistics_rx_non_phy: - * - * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB) - * - * Find the strongest signal from among a/b/c. Compare the other two to the - * strongest. If any signal is more than 15 dB (times 20, unless you - * divide the accumulated values by 20) below the strongest, the driver - * considers that antenna to be disconnected, and should not try to use that - * antenna/chain for Rx or Tx. If both A and B seem to be disconnected, - * driver should declare the stronger one as connected, and attempt to use it - * (A and B are the only 2 Tx chains!). - * - * - * RX BALANCE: - * - * Driver should balance the 3 receivers (but just the ones that are connected - * to antennas, see above) for gain, by comparing the average signal levels - * detected during the silence after each beacon (background noise). - * Accumulate (add) the following values over 20 beacons, one accumulator for - * each of the chains a/b/c, from struct statistics_rx_non_phy: - * - * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB) - * - * Find the weakest background noise level from among a/b/c. This Rx chain - * will be the reference, with 0 gain adjustment. Attenuate other channels by - * finding noise difference: - * - * (accum_noise[i] - accum_noise[reference]) / 30 - * - * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB. - * For use in diff_gain_[abc] fields of struct iwl_calibration_cmd, the - * driver should limit the difference results to a range of 0-3 (0-4.5 dB), - * and set bit 2 to indicate "reduce gain". The value for the reference - * (weakest) chain should be "0". - * - * diff_gain_[abc] bit fields: - * 2: (1) reduce gain, (0) increase gain - * 1-0: amount of gain, units of 1.5 dB - */ - -/* Phy calibration command for series */ -enum { - IWL_PHY_CALIBRATE_DC_CMD = 8, - IWL_PHY_CALIBRATE_LO_CMD = 9, - IWL_PHY_CALIBRATE_TX_IQ_CMD = 11, - IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15, - IWL_PHY_CALIBRATE_BASE_BAND_CMD = 16, - IWL_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17, - IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD = 18, -}; - -/* This enum defines the bitmap of various calibrations to enable in both - * init ucode and runtime ucode through CALIBRATION_CFG_CMD. - */ -enum iwl_ucode_calib_cfg { - IWL_CALIB_CFG_RX_BB_IDX = BIT(0), - IWL_CALIB_CFG_DC_IDX = BIT(1), - IWL_CALIB_CFG_LO_IDX = BIT(2), - IWL_CALIB_CFG_TX_IQ_IDX = BIT(3), - IWL_CALIB_CFG_RX_IQ_IDX = BIT(4), - IWL_CALIB_CFG_NOISE_IDX = BIT(5), - IWL_CALIB_CFG_CRYSTAL_IDX = BIT(6), - IWL_CALIB_CFG_TEMPERATURE_IDX = BIT(7), - IWL_CALIB_CFG_PAPD_IDX = BIT(8), - IWL_CALIB_CFG_SENSITIVITY_IDX = BIT(9), - IWL_CALIB_CFG_TX_PWR_IDX = BIT(10), -}; - -#define IWL_CALIB_INIT_CFG_ALL cpu_to_le32(IWL_CALIB_CFG_RX_BB_IDX | \ - IWL_CALIB_CFG_DC_IDX | \ - IWL_CALIB_CFG_LO_IDX | \ - IWL_CALIB_CFG_TX_IQ_IDX | \ - IWL_CALIB_CFG_RX_IQ_IDX | \ - IWL_CALIB_CFG_CRYSTAL_IDX) - -#define IWL_CALIB_RT_CFG_ALL cpu_to_le32(IWL_CALIB_CFG_RX_BB_IDX | \ - IWL_CALIB_CFG_DC_IDX | \ - IWL_CALIB_CFG_LO_IDX | \ - IWL_CALIB_CFG_TX_IQ_IDX | \ - IWL_CALIB_CFG_RX_IQ_IDX | \ - IWL_CALIB_CFG_TEMPERATURE_IDX | \ - IWL_CALIB_CFG_PAPD_IDX | \ - IWL_CALIB_CFG_TX_PWR_IDX | \ - IWL_CALIB_CFG_CRYSTAL_IDX) - -#define IWL_CALIB_CFG_FLAG_SEND_COMPLETE_NTFY_MSK cpu_to_le32(BIT(0)) - -struct iwl_calib_cfg_elmnt_s { - __le32 is_enable; - __le32 start; - __le32 send_res; - __le32 apply_res; - __le32 reserved; -} __packed; - -struct iwl_calib_cfg_status_s { - struct iwl_calib_cfg_elmnt_s once; - struct iwl_calib_cfg_elmnt_s perd; - __le32 flags; -} __packed; - -struct iwl_calib_cfg_cmd { - struct iwl_calib_cfg_status_s ucd_calib_cfg; - struct iwl_calib_cfg_status_s drv_calib_cfg; - __le32 reserved1; -} __packed; - -struct iwl_calib_hdr { - u8 op_code; - u8 first_group; - u8 groups_num; - u8 data_valid; -} __packed; - -struct iwl_calib_cmd { - struct iwl_calib_hdr hdr; - u8 data[0]; -} __packed; - -struct iwl_calib_xtal_freq_cmd { - struct iwl_calib_hdr hdr; - u8 cap_pin1; - u8 cap_pin2; - u8 pad[2]; -} __packed; - -#define DEFAULT_RADIO_SENSOR_OFFSET cpu_to_le16(2700) -struct iwl_calib_temperature_offset_cmd { - struct iwl_calib_hdr hdr; - __le16 radio_sensor_offset; - __le16 reserved; -} __packed; - -struct iwl_calib_temperature_offset_v2_cmd { - struct iwl_calib_hdr hdr; - __le16 radio_sensor_offset_high; - __le16 radio_sensor_offset_low; - __le16 burntVoltageRef; - __le16 reserved; -} __packed; - -/* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */ -struct iwl_calib_chain_noise_reset_cmd { - struct iwl_calib_hdr hdr; - u8 data[0]; -}; - -/* IWL_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */ -struct iwl_calib_chain_noise_gain_cmd { - struct iwl_calib_hdr hdr; - u8 delta_gain_1; - u8 delta_gain_2; - u8 pad[2]; -} __packed; - -/****************************************************************************** - * (12) - * Miscellaneous Commands: - * - *****************************************************************************/ - -/* - * LEDs Command & Response - * REPLY_LEDS_CMD = 0x48 (command, has simple generic response) - * - * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), - * this command turns it on or off, or sets up a periodic blinking cycle. - */ -struct iwl_led_cmd { - __le32 interval; /* "interval" in uSec */ - u8 id; /* 1: Activity, 2: Link, 3: Tech */ - u8 off; /* # intervals off while blinking; - * "0", with >0 "on" value, turns LED on */ - u8 on; /* # intervals on while blinking; - * "0", regardless of "off", turns LED off */ - u8 reserved; -} __packed; - -/* - * station priority table entries - * also used as potential "events" value for both - * COEX_MEDIUM_NOTIFICATION and COEX_EVENT_CMD - */ - -/* - * COEX events entry flag masks - * RP - Requested Priority - * WP - Win Medium Priority: priority assigned when the contention has been won - */ -#define COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG (0x1) -#define COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG (0x2) -#define COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG (0x4) - -#define COEX_CU_UNASSOC_IDLE_RP 4 -#define COEX_CU_UNASSOC_MANUAL_SCAN_RP 4 -#define COEX_CU_UNASSOC_AUTO_SCAN_RP 4 -#define COEX_CU_CALIBRATION_RP 4 -#define COEX_CU_PERIODIC_CALIBRATION_RP 4 -#define COEX_CU_CONNECTION_ESTAB_RP 4 -#define COEX_CU_ASSOCIATED_IDLE_RP 4 -#define COEX_CU_ASSOC_MANUAL_SCAN_RP 4 -#define COEX_CU_ASSOC_AUTO_SCAN_RP 4 -#define COEX_CU_ASSOC_ACTIVE_LEVEL_RP 4 -#define COEX_CU_RF_ON_RP 6 -#define COEX_CU_RF_OFF_RP 4 -#define COEX_CU_STAND_ALONE_DEBUG_RP 6 -#define COEX_CU_IPAN_ASSOC_LEVEL_RP 4 -#define COEX_CU_RSRVD1_RP 4 -#define COEX_CU_RSRVD2_RP 4 - -#define COEX_CU_UNASSOC_IDLE_WP 3 -#define COEX_CU_UNASSOC_MANUAL_SCAN_WP 3 -#define COEX_CU_UNASSOC_AUTO_SCAN_WP 3 -#define COEX_CU_CALIBRATION_WP 3 -#define COEX_CU_PERIODIC_CALIBRATION_WP 3 -#define COEX_CU_CONNECTION_ESTAB_WP 3 -#define COEX_CU_ASSOCIATED_IDLE_WP 3 -#define COEX_CU_ASSOC_MANUAL_SCAN_WP 3 -#define COEX_CU_ASSOC_AUTO_SCAN_WP 3 -#define COEX_CU_ASSOC_ACTIVE_LEVEL_WP 3 -#define COEX_CU_RF_ON_WP 3 -#define COEX_CU_RF_OFF_WP 3 -#define COEX_CU_STAND_ALONE_DEBUG_WP 6 -#define COEX_CU_IPAN_ASSOC_LEVEL_WP 3 -#define COEX_CU_RSRVD1_WP 3 -#define COEX_CU_RSRVD2_WP 3 - -#define COEX_UNASSOC_IDLE_FLAGS 0 -#define COEX_UNASSOC_MANUAL_SCAN_FLAGS \ - (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ - COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) -#define COEX_UNASSOC_AUTO_SCAN_FLAGS \ - (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ - COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) -#define COEX_CALIBRATION_FLAGS \ - (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ - COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) -#define COEX_PERIODIC_CALIBRATION_FLAGS 0 -/* - * COEX_CONNECTION_ESTAB: - * we need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network. - */ -#define COEX_CONNECTION_ESTAB_FLAGS \ - (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ - COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \ - COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG) -#define COEX_ASSOCIATED_IDLE_FLAGS 0 -#define COEX_ASSOC_MANUAL_SCAN_FLAGS \ - (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ - COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) -#define COEX_ASSOC_AUTO_SCAN_FLAGS \ - (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ - COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) -#define COEX_ASSOC_ACTIVE_LEVEL_FLAGS 0 -#define COEX_RF_ON_FLAGS 0 -#define COEX_RF_OFF_FLAGS 0 -#define COEX_STAND_ALONE_DEBUG_FLAGS \ - (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ - COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG) -#define COEX_IPAN_ASSOC_LEVEL_FLAGS \ - (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ - COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \ - COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG) -#define COEX_RSRVD1_FLAGS 0 -#define COEX_RSRVD2_FLAGS 0 -/* - * COEX_CU_RF_ON is the event wrapping all radio ownership. - * We need DELAY_MEDIUM_FREE_NTFY to let WiMAX disconnect from network. - */ -#define COEX_CU_RF_ON_FLAGS \ - (COEX_EVT_FLAG_MEDIUM_FREE_NTFY_FLG | \ - COEX_EVT_FLAG_MEDIUM_ACTV_NTFY_FLG | \ - COEX_EVT_FLAG_DELAY_MEDIUM_FREE_NTFY_FLG) - - -enum { - /* un-association part */ - COEX_UNASSOC_IDLE = 0, - COEX_UNASSOC_MANUAL_SCAN = 1, - COEX_UNASSOC_AUTO_SCAN = 2, - /* calibration */ - COEX_CALIBRATION = 3, - COEX_PERIODIC_CALIBRATION = 4, - /* connection */ - COEX_CONNECTION_ESTAB = 5, - /* association part */ - COEX_ASSOCIATED_IDLE = 6, - COEX_ASSOC_MANUAL_SCAN = 7, - COEX_ASSOC_AUTO_SCAN = 8, - COEX_ASSOC_ACTIVE_LEVEL = 9, - /* RF ON/OFF */ - COEX_RF_ON = 10, - COEX_RF_OFF = 11, - COEX_STAND_ALONE_DEBUG = 12, - /* IPAN */ - COEX_IPAN_ASSOC_LEVEL = 13, - /* reserved */ - COEX_RSRVD1 = 14, - COEX_RSRVD2 = 15, - COEX_NUM_OF_EVENTS = 16 -}; - -/* - * Coexistence WIFI/WIMAX Command - * COEX_PRIORITY_TABLE_CMD = 0x5a - * - */ -struct iwl_wimax_coex_event_entry { - u8 request_prio; - u8 win_medium_prio; - u8 reserved; - u8 flags; -} __packed; - -/* COEX flag masks */ - -/* Station table is valid */ -#define COEX_FLAGS_STA_TABLE_VALID_MSK (0x1) -/* UnMask wake up src at unassociated sleep */ -#define COEX_FLAGS_UNASSOC_WA_UNMASK_MSK (0x4) -/* UnMask wake up src at associated sleep */ -#define COEX_FLAGS_ASSOC_WA_UNMASK_MSK (0x8) -/* Enable CoEx feature. */ -#define COEX_FLAGS_COEX_ENABLE_MSK (0x80) - -struct iwl_wimax_coex_cmd { - u8 flags; - u8 reserved[3]; - struct iwl_wimax_coex_event_entry sta_prio[COEX_NUM_OF_EVENTS]; -} __packed; - -/* - * Coexistence MEDIUM NOTIFICATION - * COEX_MEDIUM_NOTIFICATION = 0x5b - * - * notification from uCode to host to indicate medium changes - * - */ -/* - * status field - * bit 0 - 2: medium status - * bit 3: medium change indication - * bit 4 - 31: reserved - */ -/* status option values, (0 - 2 bits) */ -#define COEX_MEDIUM_BUSY (0x0) /* radio belongs to WiMAX */ -#define COEX_MEDIUM_ACTIVE (0x1) /* radio belongs to WiFi */ -#define COEX_MEDIUM_PRE_RELEASE (0x2) /* received radio release */ -#define COEX_MEDIUM_MSK (0x7) - -/* send notification status (1 bit) */ -#define COEX_MEDIUM_CHANGED (0x8) -#define COEX_MEDIUM_CHANGED_MSK (0x8) -#define COEX_MEDIUM_SHIFT (3) - -struct iwl_coex_medium_notification { - __le32 status; - __le32 events; -} __packed; - -/* - * Coexistence EVENT Command - * COEX_EVENT_CMD = 0x5c - * - * send from host to uCode for coex event request. - */ -/* flags options */ -#define COEX_EVENT_REQUEST_MSK (0x1) - -struct iwl_coex_event_cmd { - u8 flags; - u8 event; - __le16 reserved; -} __packed; - -struct iwl_coex_event_resp { - __le32 status; -} __packed; - - -/****************************************************************************** - * Bluetooth Coexistence commands - * - *****************************************************************************/ - -/* - * BT Status notification - * REPLY_BT_COEX_PROFILE_NOTIF = 0xce - */ -enum iwl_bt_coex_profile_traffic_load { - IWL_BT_COEX_TRAFFIC_LOAD_NONE = 0, - IWL_BT_COEX_TRAFFIC_LOAD_LOW = 1, - IWL_BT_COEX_TRAFFIC_LOAD_HIGH = 2, - IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS = 3, -/* - * There are no more even though below is a u8, the - * indication from the BT device only has two bits. - */ -}; - -#define BT_SESSION_ACTIVITY_1_UART_MSG 0x1 -#define BT_SESSION_ACTIVITY_2_UART_MSG 0x2 - -/* BT UART message - Share Part (BT -> WiFi) */ -#define BT_UART_MSG_FRAME1MSGTYPE_POS (0) -#define BT_UART_MSG_FRAME1MSGTYPE_MSK \ - (0x7 << BT_UART_MSG_FRAME1MSGTYPE_POS) -#define BT_UART_MSG_FRAME1SSN_POS (3) -#define BT_UART_MSG_FRAME1SSN_MSK \ - (0x3 << BT_UART_MSG_FRAME1SSN_POS) -#define BT_UART_MSG_FRAME1UPDATEREQ_POS (5) -#define BT_UART_MSG_FRAME1UPDATEREQ_MSK \ - (0x1 << BT_UART_MSG_FRAME1UPDATEREQ_POS) -#define BT_UART_MSG_FRAME1RESERVED_POS (6) -#define BT_UART_MSG_FRAME1RESERVED_MSK \ - (0x3 << BT_UART_MSG_FRAME1RESERVED_POS) - -#define BT_UART_MSG_FRAME2OPENCONNECTIONS_POS (0) -#define BT_UART_MSG_FRAME2OPENCONNECTIONS_MSK \ - (0x3 << BT_UART_MSG_FRAME2OPENCONNECTIONS_POS) -#define BT_UART_MSG_FRAME2TRAFFICLOAD_POS (2) -#define BT_UART_MSG_FRAME2TRAFFICLOAD_MSK \ - (0x3 << BT_UART_MSG_FRAME2TRAFFICLOAD_POS) -#define BT_UART_MSG_FRAME2CHLSEQN_POS (4) -#define BT_UART_MSG_FRAME2CHLSEQN_MSK \ - (0x1 << BT_UART_MSG_FRAME2CHLSEQN_POS) -#define BT_UART_MSG_FRAME2INBAND_POS (5) -#define BT_UART_MSG_FRAME2INBAND_MSK \ - (0x1 << BT_UART_MSG_FRAME2INBAND_POS) -#define BT_UART_MSG_FRAME2RESERVED_POS (6) -#define BT_UART_MSG_FRAME2RESERVED_MSK \ - (0x3 << BT_UART_MSG_FRAME2RESERVED_POS) - -#define BT_UART_MSG_FRAME3SCOESCO_POS (0) -#define BT_UART_MSG_FRAME3SCOESCO_MSK \ - (0x1 << BT_UART_MSG_FRAME3SCOESCO_POS) -#define BT_UART_MSG_FRAME3SNIFF_POS (1) -#define BT_UART_MSG_FRAME3SNIFF_MSK \ - (0x1 << BT_UART_MSG_FRAME3SNIFF_POS) -#define BT_UART_MSG_FRAME3A2DP_POS (2) -#define BT_UART_MSG_FRAME3A2DP_MSK \ - (0x1 << BT_UART_MSG_FRAME3A2DP_POS) -#define BT_UART_MSG_FRAME3ACL_POS (3) -#define BT_UART_MSG_FRAME3ACL_MSK \ - (0x1 << BT_UART_MSG_FRAME3ACL_POS) -#define BT_UART_MSG_FRAME3MASTER_POS (4) -#define BT_UART_MSG_FRAME3MASTER_MSK \ - (0x1 << BT_UART_MSG_FRAME3MASTER_POS) -#define BT_UART_MSG_FRAME3OBEX_POS (5) -#define BT_UART_MSG_FRAME3OBEX_MSK \ - (0x1 << BT_UART_MSG_FRAME3OBEX_POS) -#define BT_UART_MSG_FRAME3RESERVED_POS (6) -#define BT_UART_MSG_FRAME3RESERVED_MSK \ - (0x3 << BT_UART_MSG_FRAME3RESERVED_POS) - -#define BT_UART_MSG_FRAME4IDLEDURATION_POS (0) -#define BT_UART_MSG_FRAME4IDLEDURATION_MSK \ - (0x3F << BT_UART_MSG_FRAME4IDLEDURATION_POS) -#define BT_UART_MSG_FRAME4RESERVED_POS (6) -#define BT_UART_MSG_FRAME4RESERVED_MSK \ - (0x3 << BT_UART_MSG_FRAME4RESERVED_POS) - -#define BT_UART_MSG_FRAME5TXACTIVITY_POS (0) -#define BT_UART_MSG_FRAME5TXACTIVITY_MSK \ - (0x3 << BT_UART_MSG_FRAME5TXACTIVITY_POS) -#define BT_UART_MSG_FRAME5RXACTIVITY_POS (2) -#define BT_UART_MSG_FRAME5RXACTIVITY_MSK \ - (0x3 << BT_UART_MSG_FRAME5RXACTIVITY_POS) -#define BT_UART_MSG_FRAME5ESCORETRANSMIT_POS (4) -#define BT_UART_MSG_FRAME5ESCORETRANSMIT_MSK \ - (0x3 << BT_UART_MSG_FRAME5ESCORETRANSMIT_POS) -#define BT_UART_MSG_FRAME5RESERVED_POS (6) -#define BT_UART_MSG_FRAME5RESERVED_MSK \ - (0x3 << BT_UART_MSG_FRAME5RESERVED_POS) - -#define BT_UART_MSG_FRAME6SNIFFINTERVAL_POS (0) -#define BT_UART_MSG_FRAME6SNIFFINTERVAL_MSK \ - (0x1F << BT_UART_MSG_FRAME6SNIFFINTERVAL_POS) -#define BT_UART_MSG_FRAME6DISCOVERABLE_POS (5) -#define BT_UART_MSG_FRAME6DISCOVERABLE_MSK \ - (0x1 << BT_UART_MSG_FRAME6DISCOVERABLE_POS) -#define BT_UART_MSG_FRAME6RESERVED_POS (6) -#define BT_UART_MSG_FRAME6RESERVED_MSK \ - (0x3 << BT_UART_MSG_FRAME6RESERVED_POS) - -#define BT_UART_MSG_FRAME7SNIFFACTIVITY_POS (0) -#define BT_UART_MSG_FRAME7SNIFFACTIVITY_MSK \ - (0x7 << BT_UART_MSG_FRAME7SNIFFACTIVITY_POS) -#define BT_UART_MSG_FRAME7PAGE_POS (3) -#define BT_UART_MSG_FRAME7PAGE_MSK \ - (0x1 << BT_UART_MSG_FRAME7PAGE_POS) -#define BT_UART_MSG_FRAME7INQUIRY_POS (4) -#define BT_UART_MSG_FRAME7INQUIRY_MSK \ - (0x1 << BT_UART_MSG_FRAME7INQUIRY_POS) -#define BT_UART_MSG_FRAME7CONNECTABLE_POS (5) -#define BT_UART_MSG_FRAME7CONNECTABLE_MSK \ - (0x1 << BT_UART_MSG_FRAME7CONNECTABLE_POS) -#define BT_UART_MSG_FRAME7RESERVED_POS (6) -#define BT_UART_MSG_FRAME7RESERVED_MSK \ - (0x3 << BT_UART_MSG_FRAME7RESERVED_POS) - -/* BT Session Activity 2 UART message (BT -> WiFi) */ -#define BT_UART_MSG_2_FRAME1RESERVED1_POS (5) -#define BT_UART_MSG_2_FRAME1RESERVED1_MSK \ - (0x1< - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - *****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include "iwl-debug.h" -#include "iwl-io.h" -#include "dev.h" -#include "agn.h" - -/* create and remove of files */ -#define DEBUGFS_ADD_FILE(name, parent, mode) do { \ - if (!debugfs_create_file(#name, mode, parent, priv, \ - &iwl_dbgfs_##name##_ops)) \ - goto err; \ -} while (0) - -#define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \ - struct dentry *__tmp; \ - __tmp = debugfs_create_bool(#name, S_IWUSR | S_IRUSR, \ - parent, ptr); \ - if (IS_ERR(__tmp) || !__tmp) \ - goto err; \ -} while (0) - -#define DEBUGFS_ADD_X32(name, parent, ptr) do { \ - struct dentry *__tmp; \ - __tmp = debugfs_create_x32(#name, S_IWUSR | S_IRUSR, \ - parent, ptr); \ - if (IS_ERR(__tmp) || !__tmp) \ - goto err; \ -} while (0) - -#define DEBUGFS_ADD_U32(name, parent, ptr, mode) do { \ - struct dentry *__tmp; \ - __tmp = debugfs_create_u32(#name, mode, \ - parent, ptr); \ - if (IS_ERR(__tmp) || !__tmp) \ - goto err; \ -} while (0) - -/* file operation */ -#define DEBUGFS_READ_FUNC(name) \ -static ssize_t iwl_dbgfs_##name##_read(struct file *file, \ - char __user *user_buf, \ - size_t count, loff_t *ppos); - -#define DEBUGFS_WRITE_FUNC(name) \ -static ssize_t iwl_dbgfs_##name##_write(struct file *file, \ - const char __user *user_buf, \ - size_t count, loff_t *ppos); - - -#define DEBUGFS_READ_FILE_OPS(name) \ - DEBUGFS_READ_FUNC(name); \ -static const struct file_operations iwl_dbgfs_##name##_ops = { \ - .read = iwl_dbgfs_##name##_read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -#define DEBUGFS_WRITE_FILE_OPS(name) \ - DEBUGFS_WRITE_FUNC(name); \ -static const struct file_operations iwl_dbgfs_##name##_ops = { \ - .write = iwl_dbgfs_##name##_write, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - - -#define DEBUGFS_READ_WRITE_FILE_OPS(name) \ - DEBUGFS_READ_FUNC(name); \ - DEBUGFS_WRITE_FUNC(name); \ -static const struct file_operations iwl_dbgfs_##name##_ops = { \ - .write = iwl_dbgfs_##name##_write, \ - .read = iwl_dbgfs_##name##_read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -static ssize_t iwl_dbgfs_sram_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - u32 val = 0; - char *buf; - ssize_t ret; - int i = 0; - bool device_format = false; - int offset = 0; - int len = 0; - int pos = 0; - int sram; - struct iwl_priv *priv = file->private_data; - const struct fw_img *img; - size_t bufsz; - - if (!iwl_is_ready_rf(priv)) - return -EAGAIN; - - /* default is to dump the entire data segment */ - if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { - priv->dbgfs_sram_offset = 0x800000; - if (!priv->ucode_loaded) - return -EINVAL; - img = &priv->fw->img[priv->cur_ucode]; - priv->dbgfs_sram_len = img->sec[IWL_UCODE_SECTION_DATA].len; - } - len = priv->dbgfs_sram_len; - - if (len == -4) { - device_format = true; - len = 4; - } - - bufsz = 50 + len * 4; - buf = kmalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - pos += scnprintf(buf + pos, bufsz - pos, "sram_len: 0x%x\n", - len); - pos += scnprintf(buf + pos, bufsz - pos, "sram_offset: 0x%x\n", - priv->dbgfs_sram_offset); - - /* adjust sram address since reads are only on even u32 boundaries */ - offset = priv->dbgfs_sram_offset & 0x3; - sram = priv->dbgfs_sram_offset & ~0x3; - - /* read the first u32 from sram */ - val = iwl_trans_read_mem32(priv->trans, sram); - - for (; len; len--) { - /* put the address at the start of every line */ - if (i == 0) - pos += scnprintf(buf + pos, bufsz - pos, - "%08X: ", sram + offset); - - if (device_format) - pos += scnprintf(buf + pos, bufsz - pos, - "%02x", (val >> (8 * (3 - offset))) & 0xff); - else - pos += scnprintf(buf + pos, bufsz - pos, - "%02x ", (val >> (8 * offset)) & 0xff); - - /* if all bytes processed, read the next u32 from sram */ - if (++offset == 4) { - sram += 4; - offset = 0; - val = iwl_trans_read_mem32(priv->trans, sram); - } - - /* put in extra spaces and split lines for human readability */ - if (++i == 16) { - i = 0; - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - } else if (!(i & 7)) { - pos += scnprintf(buf + pos, bufsz - pos, " "); - } else if (!(i & 3)) { - pos += scnprintf(buf + pos, bufsz - pos, " "); - } - } - if (i) - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t iwl_dbgfs_sram_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char buf[64]; - int buf_size; - u32 offset, len; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - - if (sscanf(buf, "%x,%x", &offset, &len) == 2) { - priv->dbgfs_sram_offset = offset; - priv->dbgfs_sram_len = len; - } else if (sscanf(buf, "%x", &offset) == 1) { - priv->dbgfs_sram_offset = offset; - priv->dbgfs_sram_len = -4; - } else { - priv->dbgfs_sram_offset = 0; - priv->dbgfs_sram_len = 0; - } - - return count; -} - -static ssize_t iwl_dbgfs_wowlan_sram_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - const struct fw_img *img = &priv->fw->img[IWL_UCODE_WOWLAN]; - - if (!priv->wowlan_sram) - return -ENODATA; - - return simple_read_from_buffer(user_buf, count, ppos, - priv->wowlan_sram, - img->sec[IWL_UCODE_SECTION_DATA].len); -} -static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - struct iwl_station_entry *station; - struct iwl_tid_data *tid_data; - char *buf; - int i, j, pos = 0; - ssize_t ret; - /* Add 30 for initial string */ - const size_t bufsz = 30 + sizeof(char) * 500 * (priv->num_stations); - - buf = kmalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - pos += scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n", - priv->num_stations); - - for (i = 0; i < IWLAGN_STATION_COUNT; i++) { - station = &priv->stations[i]; - if (!station->used) - continue; - pos += scnprintf(buf + pos, bufsz - pos, - "station %d - addr: %pM, flags: %#x\n", - i, station->sta.sta.addr, - station->sta.station_flags_msk); - pos += scnprintf(buf + pos, bufsz - pos, - "TID seqno next_rclmd " - "rate_n_flags state txq\n"); - - for (j = 0; j < IWL_MAX_TID_COUNT; j++) { - tid_data = &priv->tid_data[i][j]; - pos += scnprintf(buf + pos, bufsz - pos, - "%d: 0x%.4x 0x%.4x 0x%.8x " - "%d %.2d", - j, tid_data->seq_number, - tid_data->next_reclaimed, - tid_data->agg.rate_n_flags, - tid_data->agg.state, - tid_data->agg.txq_id); - - if (tid_data->agg.wait_for_ba) - pos += scnprintf(buf + pos, bufsz - pos, - " - waitforba"); - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - } - - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - } - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t iwl_dbgfs_nvm_read(struct file *file, - char __user *user_buf, - size_t count, - loff_t *ppos) -{ - ssize_t ret; - struct iwl_priv *priv = file->private_data; - int pos = 0, ofs = 0, buf_size = 0; - const u8 *ptr; - char *buf; - u16 nvm_ver; - size_t eeprom_len = priv->eeprom_blob_size; - buf_size = 4 * eeprom_len + 256; - - if (eeprom_len % 16) - return -ENODATA; - - ptr = priv->eeprom_blob; - if (!ptr) - return -ENOMEM; - - /* 4 characters for byte 0xYY */ - buf = kzalloc(buf_size, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - nvm_ver = priv->nvm_data->nvm_version; - pos += scnprintf(buf + pos, buf_size - pos, - "NVM version: 0x%x\n", nvm_ver); - for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { - pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs); - hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos, - buf_size - pos, 0); - pos += strlen(buf + pos); - if (buf_size - pos > 0) - buf[pos++] = '\n'; - } - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - struct ieee80211_channel *channels = NULL; - const struct ieee80211_supported_band *supp_band = NULL; - int pos = 0, i, bufsz = PAGE_SIZE; - char *buf; - ssize_t ret; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); - if (supp_band) { - channels = supp_band->channels; - - pos += scnprintf(buf + pos, bufsz - pos, - "Displaying %d channels in 2.4GHz band 802.11bg):\n", - supp_band->n_channels); - - for (i = 0; i < supp_band->n_channels; i++) - pos += scnprintf(buf + pos, bufsz - pos, - "%d: %ddBm: BSS%s%s, %s.\n", - channels[i].hw_value, - channels[i].max_power, - channels[i].flags & IEEE80211_CHAN_RADAR ? - " (IEEE 802.11h required)" : "", - ((channels[i].flags & IEEE80211_CHAN_NO_IBSS) - || (channels[i].flags & - IEEE80211_CHAN_RADAR)) ? "" : - ", IBSS", - channels[i].flags & - IEEE80211_CHAN_PASSIVE_SCAN ? - "passive only" : "active/passive"); - } - supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ); - if (supp_band) { - channels = supp_band->channels; - - pos += scnprintf(buf + pos, bufsz - pos, - "Displaying %d channels in 5.2GHz band (802.11a)\n", - supp_band->n_channels); - - for (i = 0; i < supp_band->n_channels; i++) - pos += scnprintf(buf + pos, bufsz - pos, - "%d: %ddBm: BSS%s%s, %s.\n", - channels[i].hw_value, - channels[i].max_power, - channels[i].flags & IEEE80211_CHAN_RADAR ? - " (IEEE 802.11h required)" : "", - ((channels[i].flags & IEEE80211_CHAN_NO_IBSS) - || (channels[i].flags & - IEEE80211_CHAN_RADAR)) ? "" : - ", IBSS", - channels[i].flags & - IEEE80211_CHAN_PASSIVE_SCAN ? - "passive only" : "active/passive"); - } - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t iwl_dbgfs_status_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) { - - struct iwl_priv *priv = file->private_data; - char buf[512]; - int pos = 0; - const size_t bufsz = sizeof(buf); - - pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n", - test_bit(STATUS_RF_KILL_HW, &priv->status)); - pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n", - test_bit(STATUS_CT_KILL, &priv->status)); - pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n", - test_bit(STATUS_ALIVE, &priv->status)); - pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n", - test_bit(STATUS_READY, &priv->status)); - pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n", - test_bit(STATUS_EXIT_PENDING, &priv->status)); - pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n", - test_bit(STATUS_STATISTICS, &priv->status)); - pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n", - test_bit(STATUS_SCANNING, &priv->status)); - pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n", - test_bit(STATUS_SCAN_ABORTING, &priv->status)); - pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n", - test_bit(STATUS_SCAN_HW, &priv->status)); - pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n", - test_bit(STATUS_POWER_PMI, &priv->status)); - pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n", - test_bit(STATUS_FW_ERROR, &priv->status)); - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_rx_handlers_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) { - - struct iwl_priv *priv = file->private_data; - - int pos = 0; - int cnt = 0; - char *buf; - int bufsz = 24 * 64; /* 24 items * 64 char per item */ - ssize_t ret; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - for (cnt = 0; cnt < REPLY_MAX; cnt++) { - if (priv->rx_handlers_stats[cnt] > 0) - pos += scnprintf(buf + pos, bufsz - pos, - "\tRx handler[%36s]:\t\t %u\n", - iwl_dvm_get_cmd_string(cnt), - priv->rx_handlers_stats[cnt]); - } - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t iwl_dbgfs_rx_handlers_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - - char buf[8]; - int buf_size; - u32 reset_flag; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%x", &reset_flag) != 1) - return -EFAULT; - if (reset_flag == 0) - memset(&priv->rx_handlers_stats[0], 0, - sizeof(priv->rx_handlers_stats)); - - return count; -} - -static ssize_t iwl_dbgfs_qos_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - struct iwl_rxon_context *ctx; - int pos = 0, i; - char buf[256 * NUM_IWL_RXON_CTX]; - const size_t bufsz = sizeof(buf); - - for_each_context(priv, ctx) { - pos += scnprintf(buf + pos, bufsz - pos, "context %d:\n", - ctx->ctxid); - for (i = 0; i < AC_NUM; i++) { - pos += scnprintf(buf + pos, bufsz - pos, - "\tcw_min\tcw_max\taifsn\ttxop\n"); - pos += scnprintf(buf + pos, bufsz - pos, - "AC[%d]\t%u\t%u\t%u\t%u\n", i, - ctx->qos_data.def_qos_parm.ac[i].cw_min, - ctx->qos_data.def_qos_parm.ac[i].cw_max, - ctx->qos_data.def_qos_parm.ac[i].aifsn, - ctx->qos_data.def_qos_parm.ac[i].edca_txop); - } - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - } - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_thermal_throttling_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - struct iwl_tt_mgmt *tt = &priv->thermal_throttle; - struct iwl_tt_restriction *restriction; - char buf[100]; - int pos = 0; - const size_t bufsz = sizeof(buf); - - pos += scnprintf(buf + pos, bufsz - pos, - "Thermal Throttling Mode: %s\n", - tt->advanced_tt ? "Advance" : "Legacy"); - pos += scnprintf(buf + pos, bufsz - pos, - "Thermal Throttling State: %d\n", - tt->state); - if (tt->advanced_tt) { - restriction = tt->restriction + tt->state; - pos += scnprintf(buf + pos, bufsz - pos, - "Tx mode: %d\n", - restriction->tx_stream); - pos += scnprintf(buf + pos, bufsz - pos, - "Rx mode: %d\n", - restriction->rx_stream); - pos += scnprintf(buf + pos, bufsz - pos, - "HT mode: %d\n", - restriction->is_ht); - } - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_disable_ht40_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char buf[8]; - int buf_size; - int ht40; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%d", &ht40) != 1) - return -EFAULT; - if (!iwl_is_any_associated(priv)) - priv->disable_ht40 = ht40 ? true : false; - else - return -EINVAL; - - return count; -} - -static ssize_t iwl_dbgfs_disable_ht40_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char buf[100]; - int pos = 0; - const size_t bufsz = sizeof(buf); - - pos += scnprintf(buf + pos, bufsz - pos, - "11n 40MHz Mode: %s\n", - priv->disable_ht40 ? "Disabled" : "Enabled"); - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_temperature_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char buf[8]; - int pos = 0; - const size_t bufsz = sizeof(buf); - - pos += scnprintf(buf + pos, bufsz - pos, "%d\n", priv->temperature); - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - - -static ssize_t iwl_dbgfs_sleep_level_override_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char buf[8]; - int buf_size; - int value; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - - if (sscanf(buf, "%d", &value) != 1) - return -EINVAL; - - /* - * Our users expect 0 to be "CAM", but 0 isn't actually - * valid here. However, let's not confuse them and present - * IWL_POWER_INDEX_1 as "1", not "0". - */ - if (value == 0) - return -EINVAL; - else if (value > 0) - value -= 1; - - if (value != -1 && (value < 0 || value >= IWL_POWER_NUM)) - return -EINVAL; - - if (!iwl_is_ready_rf(priv)) - return -EAGAIN; - - priv->power_data.debug_sleep_level_override = value; - - mutex_lock(&priv->mutex); - iwl_power_update_mode(priv, true); - mutex_unlock(&priv->mutex); - - return count; -} - -static ssize_t iwl_dbgfs_sleep_level_override_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char buf[10]; - int pos, value; - const size_t bufsz = sizeof(buf); - - /* see the write function */ - value = priv->power_data.debug_sleep_level_override; - if (value >= 0) - value += 1; - - pos = scnprintf(buf, bufsz, "%d\n", value); - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_current_sleep_command_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char buf[200]; - int pos = 0, i; - const size_t bufsz = sizeof(buf); - struct iwl_powertable_cmd *cmd = &priv->power_data.sleep_cmd; - - pos += scnprintf(buf + pos, bufsz - pos, - "flags: %#.2x\n", le16_to_cpu(cmd->flags)); - pos += scnprintf(buf + pos, bufsz - pos, - "RX/TX timeout: %d/%d usec\n", - le32_to_cpu(cmd->rx_data_timeout), - le32_to_cpu(cmd->tx_data_timeout)); - for (i = 0; i < IWL_POWER_VEC_SIZE; i++) - pos += scnprintf(buf + pos, bufsz - pos, - "sleep_interval[%d]: %d\n", i, - le32_to_cpu(cmd->sleep_interval[i])); - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -DEBUGFS_READ_WRITE_FILE_OPS(sram); -DEBUGFS_READ_FILE_OPS(wowlan_sram); -DEBUGFS_READ_FILE_OPS(nvm); -DEBUGFS_READ_FILE_OPS(stations); -DEBUGFS_READ_FILE_OPS(channels); -DEBUGFS_READ_FILE_OPS(status); -DEBUGFS_READ_WRITE_FILE_OPS(rx_handlers); -DEBUGFS_READ_FILE_OPS(qos); -DEBUGFS_READ_FILE_OPS(thermal_throttling); -DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40); -DEBUGFS_READ_FILE_OPS(temperature); -DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override); -DEBUGFS_READ_FILE_OPS(current_sleep_command); - -static const char *fmt_value = " %-30s %10u\n"; -static const char *fmt_hex = " %-30s 0x%02X\n"; -static const char *fmt_table = " %-30s %10u %10u %10u %10u\n"; -static const char *fmt_header = - "%-32s current cumulative delta max\n"; - -static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz) -{ - int p = 0; - u32 flag; - - lockdep_assert_held(&priv->statistics.lock); - - flag = le32_to_cpu(priv->statistics.flag); - - p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n", flag); - if (flag & UCODE_STATISTICS_CLEAR_MSK) - p += scnprintf(buf + p, bufsz - p, - "\tStatistics have been cleared\n"); - p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n", - (flag & UCODE_STATISTICS_FREQUENCY_MSK) - ? "2.4 GHz" : "5.2 GHz"); - p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n", - (flag & UCODE_STATISTICS_NARROW_BAND_MSK) - ? "enabled" : "disabled"); - - return p; -} - -static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - int pos = 0; - char *buf; - int bufsz = sizeof(struct statistics_rx_phy) * 40 + - sizeof(struct statistics_rx_non_phy) * 40 + - sizeof(struct statistics_rx_ht_phy) * 40 + 400; - ssize_t ret; - struct statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm; - struct statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck; - struct statistics_rx_non_phy *general, *accum_general; - struct statistics_rx_non_phy *delta_general, *max_general; - struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht; - - if (!iwl_is_alive(priv)) - return -EAGAIN; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - /* - * the statistic information display here is based on - * the last statistics notification from uCode - * might not reflect the current uCode activity - */ - spin_lock_bh(&priv->statistics.lock); - ofdm = &priv->statistics.rx_ofdm; - cck = &priv->statistics.rx_cck; - general = &priv->statistics.rx_non_phy; - ht = &priv->statistics.rx_ofdm_ht; - accum_ofdm = &priv->accum_stats.rx_ofdm; - accum_cck = &priv->accum_stats.rx_cck; - accum_general = &priv->accum_stats.rx_non_phy; - accum_ht = &priv->accum_stats.rx_ofdm_ht; - delta_ofdm = &priv->delta_stats.rx_ofdm; - delta_cck = &priv->delta_stats.rx_cck; - delta_general = &priv->delta_stats.rx_non_phy; - delta_ht = &priv->delta_stats.rx_ofdm_ht; - max_ofdm = &priv->max_delta_stats.rx_ofdm; - max_cck = &priv->max_delta_stats.rx_cck; - max_general = &priv->max_delta_stats.rx_non_phy; - max_ht = &priv->max_delta_stats.rx_ofdm_ht; - - pos += iwl_statistics_flag(priv, buf, bufsz); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_header, "Statistics_Rx - OFDM:"); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "ina_cnt:", - le32_to_cpu(ofdm->ina_cnt), - accum_ofdm->ina_cnt, - delta_ofdm->ina_cnt, max_ofdm->ina_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "fina_cnt:", - le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt, - delta_ofdm->fina_cnt, max_ofdm->fina_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "plcp_err:", - le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err, - delta_ofdm->plcp_err, max_ofdm->plcp_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "crc32_err:", - le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err, - delta_ofdm->crc32_err, max_ofdm->crc32_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "overrun_err:", - le32_to_cpu(ofdm->overrun_err), - accum_ofdm->overrun_err, delta_ofdm->overrun_err, - max_ofdm->overrun_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "early_overrun_err:", - le32_to_cpu(ofdm->early_overrun_err), - accum_ofdm->early_overrun_err, - delta_ofdm->early_overrun_err, - max_ofdm->early_overrun_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "crc32_good:", - le32_to_cpu(ofdm->crc32_good), - accum_ofdm->crc32_good, delta_ofdm->crc32_good, - max_ofdm->crc32_good); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "false_alarm_cnt:", - le32_to_cpu(ofdm->false_alarm_cnt), - accum_ofdm->false_alarm_cnt, - delta_ofdm->false_alarm_cnt, - max_ofdm->false_alarm_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "fina_sync_err_cnt:", - le32_to_cpu(ofdm->fina_sync_err_cnt), - accum_ofdm->fina_sync_err_cnt, - delta_ofdm->fina_sync_err_cnt, - max_ofdm->fina_sync_err_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "sfd_timeout:", - le32_to_cpu(ofdm->sfd_timeout), - accum_ofdm->sfd_timeout, delta_ofdm->sfd_timeout, - max_ofdm->sfd_timeout); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "fina_timeout:", - le32_to_cpu(ofdm->fina_timeout), - accum_ofdm->fina_timeout, delta_ofdm->fina_timeout, - max_ofdm->fina_timeout); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "unresponded_rts:", - le32_to_cpu(ofdm->unresponded_rts), - accum_ofdm->unresponded_rts, - delta_ofdm->unresponded_rts, - max_ofdm->unresponded_rts); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "rxe_frame_lmt_ovrun:", - le32_to_cpu(ofdm->rxe_frame_limit_overrun), - accum_ofdm->rxe_frame_limit_overrun, - delta_ofdm->rxe_frame_limit_overrun, - max_ofdm->rxe_frame_limit_overrun); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "sent_ack_cnt:", - le32_to_cpu(ofdm->sent_ack_cnt), - accum_ofdm->sent_ack_cnt, delta_ofdm->sent_ack_cnt, - max_ofdm->sent_ack_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "sent_cts_cnt:", - le32_to_cpu(ofdm->sent_cts_cnt), - accum_ofdm->sent_cts_cnt, delta_ofdm->sent_cts_cnt, - max_ofdm->sent_cts_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "sent_ba_rsp_cnt:", - le32_to_cpu(ofdm->sent_ba_rsp_cnt), - accum_ofdm->sent_ba_rsp_cnt, - delta_ofdm->sent_ba_rsp_cnt, - max_ofdm->sent_ba_rsp_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "dsp_self_kill:", - le32_to_cpu(ofdm->dsp_self_kill), - accum_ofdm->dsp_self_kill, - delta_ofdm->dsp_self_kill, - max_ofdm->dsp_self_kill); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "mh_format_err:", - le32_to_cpu(ofdm->mh_format_err), - accum_ofdm->mh_format_err, - delta_ofdm->mh_format_err, - max_ofdm->mh_format_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "re_acq_main_rssi_sum:", - le32_to_cpu(ofdm->re_acq_main_rssi_sum), - accum_ofdm->re_acq_main_rssi_sum, - delta_ofdm->re_acq_main_rssi_sum, - max_ofdm->re_acq_main_rssi_sum); - - pos += scnprintf(buf + pos, bufsz - pos, - fmt_header, "Statistics_Rx - CCK:"); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "ina_cnt:", - le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt, - delta_cck->ina_cnt, max_cck->ina_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "fina_cnt:", - le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt, - delta_cck->fina_cnt, max_cck->fina_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "plcp_err:", - le32_to_cpu(cck->plcp_err), accum_cck->plcp_err, - delta_cck->plcp_err, max_cck->plcp_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "crc32_err:", - le32_to_cpu(cck->crc32_err), accum_cck->crc32_err, - delta_cck->crc32_err, max_cck->crc32_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "overrun_err:", - le32_to_cpu(cck->overrun_err), - accum_cck->overrun_err, delta_cck->overrun_err, - max_cck->overrun_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "early_overrun_err:", - le32_to_cpu(cck->early_overrun_err), - accum_cck->early_overrun_err, - delta_cck->early_overrun_err, - max_cck->early_overrun_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "crc32_good:", - le32_to_cpu(cck->crc32_good), accum_cck->crc32_good, - delta_cck->crc32_good, max_cck->crc32_good); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "false_alarm_cnt:", - le32_to_cpu(cck->false_alarm_cnt), - accum_cck->false_alarm_cnt, - delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "fina_sync_err_cnt:", - le32_to_cpu(cck->fina_sync_err_cnt), - accum_cck->fina_sync_err_cnt, - delta_cck->fina_sync_err_cnt, - max_cck->fina_sync_err_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "sfd_timeout:", - le32_to_cpu(cck->sfd_timeout), - accum_cck->sfd_timeout, delta_cck->sfd_timeout, - max_cck->sfd_timeout); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "fina_timeout:", - le32_to_cpu(cck->fina_timeout), - accum_cck->fina_timeout, delta_cck->fina_timeout, - max_cck->fina_timeout); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "unresponded_rts:", - le32_to_cpu(cck->unresponded_rts), - accum_cck->unresponded_rts, delta_cck->unresponded_rts, - max_cck->unresponded_rts); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "rxe_frame_lmt_ovrun:", - le32_to_cpu(cck->rxe_frame_limit_overrun), - accum_cck->rxe_frame_limit_overrun, - delta_cck->rxe_frame_limit_overrun, - max_cck->rxe_frame_limit_overrun); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "sent_ack_cnt:", - le32_to_cpu(cck->sent_ack_cnt), - accum_cck->sent_ack_cnt, delta_cck->sent_ack_cnt, - max_cck->sent_ack_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "sent_cts_cnt:", - le32_to_cpu(cck->sent_cts_cnt), - accum_cck->sent_cts_cnt, delta_cck->sent_cts_cnt, - max_cck->sent_cts_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "sent_ba_rsp_cnt:", - le32_to_cpu(cck->sent_ba_rsp_cnt), - accum_cck->sent_ba_rsp_cnt, - delta_cck->sent_ba_rsp_cnt, - max_cck->sent_ba_rsp_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "dsp_self_kill:", - le32_to_cpu(cck->dsp_self_kill), - accum_cck->dsp_self_kill, delta_cck->dsp_self_kill, - max_cck->dsp_self_kill); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "mh_format_err:", - le32_to_cpu(cck->mh_format_err), - accum_cck->mh_format_err, delta_cck->mh_format_err, - max_cck->mh_format_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "re_acq_main_rssi_sum:", - le32_to_cpu(cck->re_acq_main_rssi_sum), - accum_cck->re_acq_main_rssi_sum, - delta_cck->re_acq_main_rssi_sum, - max_cck->re_acq_main_rssi_sum); - - pos += scnprintf(buf + pos, bufsz - pos, - fmt_header, "Statistics_Rx - GENERAL:"); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "bogus_cts:", - le32_to_cpu(general->bogus_cts), - accum_general->bogus_cts, delta_general->bogus_cts, - max_general->bogus_cts); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "bogus_ack:", - le32_to_cpu(general->bogus_ack), - accum_general->bogus_ack, delta_general->bogus_ack, - max_general->bogus_ack); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "non_bssid_frames:", - le32_to_cpu(general->non_bssid_frames), - accum_general->non_bssid_frames, - delta_general->non_bssid_frames, - max_general->non_bssid_frames); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "filtered_frames:", - le32_to_cpu(general->filtered_frames), - accum_general->filtered_frames, - delta_general->filtered_frames, - max_general->filtered_frames); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "non_channel_beacons:", - le32_to_cpu(general->non_channel_beacons), - accum_general->non_channel_beacons, - delta_general->non_channel_beacons, - max_general->non_channel_beacons); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "channel_beacons:", - le32_to_cpu(general->channel_beacons), - accum_general->channel_beacons, - delta_general->channel_beacons, - max_general->channel_beacons); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "num_missed_bcon:", - le32_to_cpu(general->num_missed_bcon), - accum_general->num_missed_bcon, - delta_general->num_missed_bcon, - max_general->num_missed_bcon); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "adc_rx_saturation_time:", - le32_to_cpu(general->adc_rx_saturation_time), - accum_general->adc_rx_saturation_time, - delta_general->adc_rx_saturation_time, - max_general->adc_rx_saturation_time); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "ina_detect_search_tm:", - le32_to_cpu(general->ina_detection_search_time), - accum_general->ina_detection_search_time, - delta_general->ina_detection_search_time, - max_general->ina_detection_search_time); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "beacon_silence_rssi_a:", - le32_to_cpu(general->beacon_silence_rssi_a), - accum_general->beacon_silence_rssi_a, - delta_general->beacon_silence_rssi_a, - max_general->beacon_silence_rssi_a); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "beacon_silence_rssi_b:", - le32_to_cpu(general->beacon_silence_rssi_b), - accum_general->beacon_silence_rssi_b, - delta_general->beacon_silence_rssi_b, - max_general->beacon_silence_rssi_b); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "beacon_silence_rssi_c:", - le32_to_cpu(general->beacon_silence_rssi_c), - accum_general->beacon_silence_rssi_c, - delta_general->beacon_silence_rssi_c, - max_general->beacon_silence_rssi_c); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "interference_data_flag:", - le32_to_cpu(general->interference_data_flag), - accum_general->interference_data_flag, - delta_general->interference_data_flag, - max_general->interference_data_flag); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "channel_load:", - le32_to_cpu(general->channel_load), - accum_general->channel_load, - delta_general->channel_load, - max_general->channel_load); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "dsp_false_alarms:", - le32_to_cpu(general->dsp_false_alarms), - accum_general->dsp_false_alarms, - delta_general->dsp_false_alarms, - max_general->dsp_false_alarms); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "beacon_rssi_a:", - le32_to_cpu(general->beacon_rssi_a), - accum_general->beacon_rssi_a, - delta_general->beacon_rssi_a, - max_general->beacon_rssi_a); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "beacon_rssi_b:", - le32_to_cpu(general->beacon_rssi_b), - accum_general->beacon_rssi_b, - delta_general->beacon_rssi_b, - max_general->beacon_rssi_b); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "beacon_rssi_c:", - le32_to_cpu(general->beacon_rssi_c), - accum_general->beacon_rssi_c, - delta_general->beacon_rssi_c, - max_general->beacon_rssi_c); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "beacon_energy_a:", - le32_to_cpu(general->beacon_energy_a), - accum_general->beacon_energy_a, - delta_general->beacon_energy_a, - max_general->beacon_energy_a); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "beacon_energy_b:", - le32_to_cpu(general->beacon_energy_b), - accum_general->beacon_energy_b, - delta_general->beacon_energy_b, - max_general->beacon_energy_b); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "beacon_energy_c:", - le32_to_cpu(general->beacon_energy_c), - accum_general->beacon_energy_c, - delta_general->beacon_energy_c, - max_general->beacon_energy_c); - - pos += scnprintf(buf + pos, bufsz - pos, - fmt_header, "Statistics_Rx - OFDM_HT:"); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "plcp_err:", - le32_to_cpu(ht->plcp_err), accum_ht->plcp_err, - delta_ht->plcp_err, max_ht->plcp_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "overrun_err:", - le32_to_cpu(ht->overrun_err), accum_ht->overrun_err, - delta_ht->overrun_err, max_ht->overrun_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "early_overrun_err:", - le32_to_cpu(ht->early_overrun_err), - accum_ht->early_overrun_err, - delta_ht->early_overrun_err, - max_ht->early_overrun_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "crc32_good:", - le32_to_cpu(ht->crc32_good), accum_ht->crc32_good, - delta_ht->crc32_good, max_ht->crc32_good); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "crc32_err:", - le32_to_cpu(ht->crc32_err), accum_ht->crc32_err, - delta_ht->crc32_err, max_ht->crc32_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "mh_format_err:", - le32_to_cpu(ht->mh_format_err), - accum_ht->mh_format_err, - delta_ht->mh_format_err, max_ht->mh_format_err); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "agg_crc32_good:", - le32_to_cpu(ht->agg_crc32_good), - accum_ht->agg_crc32_good, - delta_ht->agg_crc32_good, max_ht->agg_crc32_good); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "agg_mpdu_cnt:", - le32_to_cpu(ht->agg_mpdu_cnt), - accum_ht->agg_mpdu_cnt, - delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "agg_cnt:", - le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt, - delta_ht->agg_cnt, max_ht->agg_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "unsupport_mcs:", - le32_to_cpu(ht->unsupport_mcs), - accum_ht->unsupport_mcs, - delta_ht->unsupport_mcs, max_ht->unsupport_mcs); - - spin_unlock_bh(&priv->statistics.lock); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - int pos = 0; - char *buf; - int bufsz = (sizeof(struct statistics_tx) * 48) + 250; - ssize_t ret; - struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; - - if (!iwl_is_alive(priv)) - return -EAGAIN; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - /* the statistic information display here is based on - * the last statistics notification from uCode - * might not reflect the current uCode activity - */ - spin_lock_bh(&priv->statistics.lock); - - tx = &priv->statistics.tx; - accum_tx = &priv->accum_stats.tx; - delta_tx = &priv->delta_stats.tx; - max_tx = &priv->max_delta_stats.tx; - - pos += iwl_statistics_flag(priv, buf, bufsz); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_header, "Statistics_Tx:"); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "preamble:", - le32_to_cpu(tx->preamble_cnt), - accum_tx->preamble_cnt, - delta_tx->preamble_cnt, max_tx->preamble_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "rx_detected_cnt:", - le32_to_cpu(tx->rx_detected_cnt), - accum_tx->rx_detected_cnt, - delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "bt_prio_defer_cnt:", - le32_to_cpu(tx->bt_prio_defer_cnt), - accum_tx->bt_prio_defer_cnt, - delta_tx->bt_prio_defer_cnt, - max_tx->bt_prio_defer_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "bt_prio_kill_cnt:", - le32_to_cpu(tx->bt_prio_kill_cnt), - accum_tx->bt_prio_kill_cnt, - delta_tx->bt_prio_kill_cnt, - max_tx->bt_prio_kill_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "few_bytes_cnt:", - le32_to_cpu(tx->few_bytes_cnt), - accum_tx->few_bytes_cnt, - delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "cts_timeout:", - le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout, - delta_tx->cts_timeout, max_tx->cts_timeout); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "ack_timeout:", - le32_to_cpu(tx->ack_timeout), - accum_tx->ack_timeout, - delta_tx->ack_timeout, max_tx->ack_timeout); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "expected_ack_cnt:", - le32_to_cpu(tx->expected_ack_cnt), - accum_tx->expected_ack_cnt, - delta_tx->expected_ack_cnt, - max_tx->expected_ack_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "actual_ack_cnt:", - le32_to_cpu(tx->actual_ack_cnt), - accum_tx->actual_ack_cnt, - delta_tx->actual_ack_cnt, - max_tx->actual_ack_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "dump_msdu_cnt:", - le32_to_cpu(tx->dump_msdu_cnt), - accum_tx->dump_msdu_cnt, - delta_tx->dump_msdu_cnt, - max_tx->dump_msdu_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "abort_nxt_frame_mismatch:", - le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt), - accum_tx->burst_abort_next_frame_mismatch_cnt, - delta_tx->burst_abort_next_frame_mismatch_cnt, - max_tx->burst_abort_next_frame_mismatch_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "abort_missing_nxt_frame:", - le32_to_cpu(tx->burst_abort_missing_next_frame_cnt), - accum_tx->burst_abort_missing_next_frame_cnt, - delta_tx->burst_abort_missing_next_frame_cnt, - max_tx->burst_abort_missing_next_frame_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "cts_timeout_collision:", - le32_to_cpu(tx->cts_timeout_collision), - accum_tx->cts_timeout_collision, - delta_tx->cts_timeout_collision, - max_tx->cts_timeout_collision); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "ack_ba_timeout_collision:", - le32_to_cpu(tx->ack_or_ba_timeout_collision), - accum_tx->ack_or_ba_timeout_collision, - delta_tx->ack_or_ba_timeout_collision, - max_tx->ack_or_ba_timeout_collision); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "agg ba_timeout:", - le32_to_cpu(tx->agg.ba_timeout), - accum_tx->agg.ba_timeout, - delta_tx->agg.ba_timeout, - max_tx->agg.ba_timeout); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "agg ba_resched_frames:", - le32_to_cpu(tx->agg.ba_reschedule_frames), - accum_tx->agg.ba_reschedule_frames, - delta_tx->agg.ba_reschedule_frames, - max_tx->agg.ba_reschedule_frames); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "agg scd_query_agg_frame:", - le32_to_cpu(tx->agg.scd_query_agg_frame_cnt), - accum_tx->agg.scd_query_agg_frame_cnt, - delta_tx->agg.scd_query_agg_frame_cnt, - max_tx->agg.scd_query_agg_frame_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "agg scd_query_no_agg:", - le32_to_cpu(tx->agg.scd_query_no_agg), - accum_tx->agg.scd_query_no_agg, - delta_tx->agg.scd_query_no_agg, - max_tx->agg.scd_query_no_agg); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "agg scd_query_agg:", - le32_to_cpu(tx->agg.scd_query_agg), - accum_tx->agg.scd_query_agg, - delta_tx->agg.scd_query_agg, - max_tx->agg.scd_query_agg); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "agg scd_query_mismatch:", - le32_to_cpu(tx->agg.scd_query_mismatch), - accum_tx->agg.scd_query_mismatch, - delta_tx->agg.scd_query_mismatch, - max_tx->agg.scd_query_mismatch); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "agg frame_not_ready:", - le32_to_cpu(tx->agg.frame_not_ready), - accum_tx->agg.frame_not_ready, - delta_tx->agg.frame_not_ready, - max_tx->agg.frame_not_ready); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "agg underrun:", - le32_to_cpu(tx->agg.underrun), - accum_tx->agg.underrun, - delta_tx->agg.underrun, max_tx->agg.underrun); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "agg bt_prio_kill:", - le32_to_cpu(tx->agg.bt_prio_kill), - accum_tx->agg.bt_prio_kill, - delta_tx->agg.bt_prio_kill, - max_tx->agg.bt_prio_kill); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "agg rx_ba_rsp_cnt:", - le32_to_cpu(tx->agg.rx_ba_rsp_cnt), - accum_tx->agg.rx_ba_rsp_cnt, - delta_tx->agg.rx_ba_rsp_cnt, - max_tx->agg.rx_ba_rsp_cnt); - - if (tx->tx_power.ant_a || tx->tx_power.ant_b || tx->tx_power.ant_c) { - pos += scnprintf(buf + pos, bufsz - pos, - "tx power: (1/2 dB step)\n"); - if ((priv->nvm_data->valid_tx_ant & ANT_A) && - tx->tx_power.ant_a) - pos += scnprintf(buf + pos, bufsz - pos, - fmt_hex, "antenna A:", - tx->tx_power.ant_a); - if ((priv->nvm_data->valid_tx_ant & ANT_B) && - tx->tx_power.ant_b) - pos += scnprintf(buf + pos, bufsz - pos, - fmt_hex, "antenna B:", - tx->tx_power.ant_b); - if ((priv->nvm_data->valid_tx_ant & ANT_C) && - tx->tx_power.ant_c) - pos += scnprintf(buf + pos, bufsz - pos, - fmt_hex, "antenna C:", - tx->tx_power.ant_c); - } - - spin_unlock_bh(&priv->statistics.lock); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - int pos = 0; - char *buf; - int bufsz = sizeof(struct statistics_general) * 10 + 300; - ssize_t ret; - struct statistics_general_common *general, *accum_general; - struct statistics_general_common *delta_general, *max_general; - struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; - struct statistics_div *div, *accum_div, *delta_div, *max_div; - - if (!iwl_is_alive(priv)) - return -EAGAIN; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - /* the statistic information display here is based on - * the last statistics notification from uCode - * might not reflect the current uCode activity - */ - - spin_lock_bh(&priv->statistics.lock); - - general = &priv->statistics.common; - dbg = &priv->statistics.common.dbg; - div = &priv->statistics.common.div; - accum_general = &priv->accum_stats.common; - accum_dbg = &priv->accum_stats.common.dbg; - accum_div = &priv->accum_stats.common.div; - delta_general = &priv->delta_stats.common; - max_general = &priv->max_delta_stats.common; - delta_dbg = &priv->delta_stats.common.dbg; - max_dbg = &priv->max_delta_stats.common.dbg; - delta_div = &priv->delta_stats.common.div; - max_div = &priv->max_delta_stats.common.div; - - pos += iwl_statistics_flag(priv, buf, bufsz); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_header, "Statistics_General:"); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_value, "temperature:", - le32_to_cpu(general->temperature)); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_value, "temperature_m:", - le32_to_cpu(general->temperature_m)); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_value, "ttl_timestamp:", - le32_to_cpu(general->ttl_timestamp)); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "burst_check:", - le32_to_cpu(dbg->burst_check), - accum_dbg->burst_check, - delta_dbg->burst_check, max_dbg->burst_check); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "burst_count:", - le32_to_cpu(dbg->burst_count), - accum_dbg->burst_count, - delta_dbg->burst_count, max_dbg->burst_count); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "wait_for_silence_timeout_count:", - le32_to_cpu(dbg->wait_for_silence_timeout_cnt), - accum_dbg->wait_for_silence_timeout_cnt, - delta_dbg->wait_for_silence_timeout_cnt, - max_dbg->wait_for_silence_timeout_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "sleep_time:", - le32_to_cpu(general->sleep_time), - accum_general->sleep_time, - delta_general->sleep_time, max_general->sleep_time); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "slots_out:", - le32_to_cpu(general->slots_out), - accum_general->slots_out, - delta_general->slots_out, max_general->slots_out); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "slots_idle:", - le32_to_cpu(general->slots_idle), - accum_general->slots_idle, - delta_general->slots_idle, max_general->slots_idle); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "tx_on_a:", - le32_to_cpu(div->tx_on_a), accum_div->tx_on_a, - delta_div->tx_on_a, max_div->tx_on_a); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "tx_on_b:", - le32_to_cpu(div->tx_on_b), accum_div->tx_on_b, - delta_div->tx_on_b, max_div->tx_on_b); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "exec_time:", - le32_to_cpu(div->exec_time), accum_div->exec_time, - delta_div->exec_time, max_div->exec_time); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "probe_time:", - le32_to_cpu(div->probe_time), accum_div->probe_time, - delta_div->probe_time, max_div->probe_time); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "rx_enable_counter:", - le32_to_cpu(general->rx_enable_counter), - accum_general->rx_enable_counter, - delta_general->rx_enable_counter, - max_general->rx_enable_counter); - pos += scnprintf(buf + pos, bufsz - pos, - fmt_table, "num_of_sos_states:", - le32_to_cpu(general->num_of_sos_states), - accum_general->num_of_sos_states, - delta_general->num_of_sos_states, - max_general->num_of_sos_states); - - spin_unlock_bh(&priv->statistics.lock); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t iwl_dbgfs_ucode_bt_stats_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = (struct iwl_priv *)file->private_data; - int pos = 0; - char *buf; - int bufsz = (sizeof(struct statistics_bt_activity) * 24) + 200; - ssize_t ret; - struct statistics_bt_activity *bt, *accum_bt; - - if (!iwl_is_alive(priv)) - return -EAGAIN; - - if (!priv->bt_enable_flag) - return -EINVAL; - - /* make request to uCode to retrieve statistics information */ - mutex_lock(&priv->mutex); - ret = iwl_send_statistics_request(priv, CMD_SYNC, false); - mutex_unlock(&priv->mutex); - - if (ret) - return -EAGAIN; - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - /* - * the statistic information display here is based on - * the last statistics notification from uCode - * might not reflect the current uCode activity - */ - - spin_lock_bh(&priv->statistics.lock); - - bt = &priv->statistics.bt_activity; - accum_bt = &priv->accum_stats.bt_activity; - - pos += iwl_statistics_flag(priv, buf, bufsz); - pos += scnprintf(buf + pos, bufsz - pos, "Statistics_BT:\n"); - pos += scnprintf(buf + pos, bufsz - pos, - "\t\t\tcurrent\t\t\taccumulative\n"); - pos += scnprintf(buf + pos, bufsz - pos, - "hi_priority_tx_req_cnt:\t\t%u\t\t\t%u\n", - le32_to_cpu(bt->hi_priority_tx_req_cnt), - accum_bt->hi_priority_tx_req_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - "hi_priority_tx_denied_cnt:\t%u\t\t\t%u\n", - le32_to_cpu(bt->hi_priority_tx_denied_cnt), - accum_bt->hi_priority_tx_denied_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - "lo_priority_tx_req_cnt:\t\t%u\t\t\t%u\n", - le32_to_cpu(bt->lo_priority_tx_req_cnt), - accum_bt->lo_priority_tx_req_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - "lo_priority_tx_denied_cnt:\t%u\t\t\t%u\n", - le32_to_cpu(bt->lo_priority_tx_denied_cnt), - accum_bt->lo_priority_tx_denied_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - "hi_priority_rx_req_cnt:\t\t%u\t\t\t%u\n", - le32_to_cpu(bt->hi_priority_rx_req_cnt), - accum_bt->hi_priority_rx_req_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - "hi_priority_rx_denied_cnt:\t%u\t\t\t%u\n", - le32_to_cpu(bt->hi_priority_rx_denied_cnt), - accum_bt->hi_priority_rx_denied_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - "lo_priority_rx_req_cnt:\t\t%u\t\t\t%u\n", - le32_to_cpu(bt->lo_priority_rx_req_cnt), - accum_bt->lo_priority_rx_req_cnt); - pos += scnprintf(buf + pos, bufsz - pos, - "lo_priority_rx_denied_cnt:\t%u\t\t\t%u\n", - le32_to_cpu(bt->lo_priority_rx_denied_cnt), - accum_bt->lo_priority_rx_denied_cnt); - - pos += scnprintf(buf + pos, bufsz - pos, - "(rx)num_bt_kills:\t\t%u\t\t\t%u\n", - le32_to_cpu(priv->statistics.num_bt_kills), - priv->statistics.accum_num_bt_kills); - - spin_unlock_bh(&priv->statistics.lock); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t iwl_dbgfs_reply_tx_error_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = (struct iwl_priv *)file->private_data; - int pos = 0; - char *buf; - int bufsz = (sizeof(struct reply_tx_error_statistics) * 24) + - (sizeof(struct reply_agg_tx_error_statistics) * 24) + 200; - ssize_t ret; - - if (!iwl_is_alive(priv)) - return -EAGAIN; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - pos += scnprintf(buf + pos, bufsz - pos, "Statistics_TX_Error:\n"); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_DELAY), - priv->reply_tx_stats.pp_delay); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_FEW_BYTES), - priv->reply_tx_stats.pp_few_bytes); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_BT_PRIO), - priv->reply_tx_stats.pp_bt_prio); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_QUIET_PERIOD), - priv->reply_tx_stats.pp_quiet_period); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_POSTPONE_CALC_TTAK), - priv->reply_tx_stats.pp_calc_ttak); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n", - iwl_get_tx_fail_reason( - TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY), - priv->reply_tx_stats.int_crossed_retry); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_FAIL_SHORT_LIMIT), - priv->reply_tx_stats.short_limit); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_FAIL_LONG_LIMIT), - priv->reply_tx_stats.long_limit); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_FAIL_FIFO_UNDERRUN), - priv->reply_tx_stats.fifo_underrun); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_FAIL_DRAIN_FLOW), - priv->reply_tx_stats.drain_flow); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_FAIL_RFKILL_FLUSH), - priv->reply_tx_stats.rfkill_flush); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_FAIL_LIFE_EXPIRE), - priv->reply_tx_stats.life_expire); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_FAIL_DEST_PS), - priv->reply_tx_stats.dest_ps); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_FAIL_HOST_ABORTED), - priv->reply_tx_stats.host_abort); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_FAIL_BT_RETRY), - priv->reply_tx_stats.pp_delay); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_FAIL_STA_INVALID), - priv->reply_tx_stats.sta_invalid); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_FAIL_FRAG_DROPPED), - priv->reply_tx_stats.frag_drop); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_FAIL_TID_DISABLE), - priv->reply_tx_stats.tid_disable); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_FAIL_FIFO_FLUSHED), - priv->reply_tx_stats.fifo_flush); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n", - iwl_get_tx_fail_reason( - TX_STATUS_FAIL_INSUFFICIENT_CF_POLL), - priv->reply_tx_stats.insuff_cf_poll); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_tx_fail_reason(TX_STATUS_FAIL_PASSIVE_NO_RX), - priv->reply_tx_stats.fail_hw_drop); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n", - iwl_get_tx_fail_reason( - TX_STATUS_FAIL_NO_BEACON_ON_RADAR), - priv->reply_tx_stats.sta_color_mismatch); - pos += scnprintf(buf + pos, bufsz - pos, "UNKNOWN:\t\t\t%u\n", - priv->reply_tx_stats.unknown); - - pos += scnprintf(buf + pos, bufsz - pos, - "\nStatistics_Agg_TX_Error:\n"); - - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_agg_tx_fail_reason(AGG_TX_STATE_UNDERRUN_MSK), - priv->reply_agg_tx_stats.underrun); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_agg_tx_fail_reason(AGG_TX_STATE_BT_PRIO_MSK), - priv->reply_agg_tx_stats.bt_prio); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_agg_tx_fail_reason(AGG_TX_STATE_FEW_BYTES_MSK), - priv->reply_agg_tx_stats.few_bytes); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_agg_tx_fail_reason(AGG_TX_STATE_ABORT_MSK), - priv->reply_agg_tx_stats.abort); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n", - iwl_get_agg_tx_fail_reason( - AGG_TX_STATE_LAST_SENT_TTL_MSK), - priv->reply_agg_tx_stats.last_sent_ttl); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n", - iwl_get_agg_tx_fail_reason( - AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK), - priv->reply_agg_tx_stats.last_sent_try); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n", - iwl_get_agg_tx_fail_reason( - AGG_TX_STATE_LAST_SENT_BT_KILL_MSK), - priv->reply_agg_tx_stats.last_sent_bt_kill); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_agg_tx_fail_reason(AGG_TX_STATE_SCD_QUERY_MSK), - priv->reply_agg_tx_stats.scd_query); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t%u\n", - iwl_get_agg_tx_fail_reason( - AGG_TX_STATE_TEST_BAD_CRC32_MSK), - priv->reply_agg_tx_stats.bad_crc32); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_agg_tx_fail_reason(AGG_TX_STATE_RESPONSE_MSK), - priv->reply_agg_tx_stats.response); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_agg_tx_fail_reason(AGG_TX_STATE_DUMP_TX_MSK), - priv->reply_agg_tx_stats.dump_tx); - pos += scnprintf(buf + pos, bufsz - pos, "%s:\t\t\t%u\n", - iwl_get_agg_tx_fail_reason(AGG_TX_STATE_DELAY_TX_MSK), - priv->reply_agg_tx_stats.delay_tx); - pos += scnprintf(buf + pos, bufsz - pos, "UNKNOWN:\t\t\t%u\n", - priv->reply_agg_tx_stats.unknown); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t iwl_dbgfs_sensitivity_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) { - - struct iwl_priv *priv = file->private_data; - int pos = 0; - int cnt = 0; - char *buf; - int bufsz = sizeof(struct iwl_sensitivity_data) * 4 + 100; - ssize_t ret; - struct iwl_sensitivity_data *data; - - data = &priv->sensitivity_data; - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm:\t\t\t %u\n", - data->auto_corr_ofdm); - pos += scnprintf(buf + pos, bufsz - pos, - "auto_corr_ofdm_mrc:\t\t %u\n", - data->auto_corr_ofdm_mrc); - pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm_x1:\t\t %u\n", - data->auto_corr_ofdm_x1); - pos += scnprintf(buf + pos, bufsz - pos, - "auto_corr_ofdm_mrc_x1:\t\t %u\n", - data->auto_corr_ofdm_mrc_x1); - pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_cck:\t\t\t %u\n", - data->auto_corr_cck); - pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_cck_mrc:\t\t %u\n", - data->auto_corr_cck_mrc); - pos += scnprintf(buf + pos, bufsz - pos, - "last_bad_plcp_cnt_ofdm:\t\t %u\n", - data->last_bad_plcp_cnt_ofdm); - pos += scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_ofdm:\t\t %u\n", - data->last_fa_cnt_ofdm); - pos += scnprintf(buf + pos, bufsz - pos, - "last_bad_plcp_cnt_cck:\t\t %u\n", - data->last_bad_plcp_cnt_cck); - pos += scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_cck:\t\t %u\n", - data->last_fa_cnt_cck); - pos += scnprintf(buf + pos, bufsz - pos, "nrg_curr_state:\t\t\t %u\n", - data->nrg_curr_state); - pos += scnprintf(buf + pos, bufsz - pos, "nrg_prev_state:\t\t\t %u\n", - data->nrg_prev_state); - pos += scnprintf(buf + pos, bufsz - pos, "nrg_value:\t\t\t"); - for (cnt = 0; cnt < 10; cnt++) { - pos += scnprintf(buf + pos, bufsz - pos, " %u", - data->nrg_value[cnt]); - } - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_rssi:\t\t"); - for (cnt = 0; cnt < NRG_NUM_PREV_STAT_L; cnt++) { - pos += scnprintf(buf + pos, bufsz - pos, " %u", - data->nrg_silence_rssi[cnt]); - } - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_ref:\t\t %u\n", - data->nrg_silence_ref); - pos += scnprintf(buf + pos, bufsz - pos, "nrg_energy_idx:\t\t\t %u\n", - data->nrg_energy_idx); - pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_idx:\t\t %u\n", - data->nrg_silence_idx); - pos += scnprintf(buf + pos, bufsz - pos, "nrg_th_cck:\t\t\t %u\n", - data->nrg_th_cck); - pos += scnprintf(buf + pos, bufsz - pos, - "nrg_auto_corr_silence_diff:\t %u\n", - data->nrg_auto_corr_silence_diff); - pos += scnprintf(buf + pos, bufsz - pos, "num_in_cck_no_fa:\t\t %u\n", - data->num_in_cck_no_fa); - pos += scnprintf(buf + pos, bufsz - pos, "nrg_th_ofdm:\t\t\t %u\n", - data->nrg_th_ofdm); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - - -static ssize_t iwl_dbgfs_chain_noise_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) { - - struct iwl_priv *priv = file->private_data; - int pos = 0; - int cnt = 0; - char *buf; - int bufsz = sizeof(struct iwl_chain_noise_data) * 4 + 100; - ssize_t ret; - struct iwl_chain_noise_data *data; - - data = &priv->chain_noise_data; - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - pos += scnprintf(buf + pos, bufsz - pos, "active_chains:\t\t\t %u\n", - data->active_chains); - pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_a:\t\t\t %u\n", - data->chain_noise_a); - pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_b:\t\t\t %u\n", - data->chain_noise_b); - pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_c:\t\t\t %u\n", - data->chain_noise_c); - pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_a:\t\t\t %u\n", - data->chain_signal_a); - pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_b:\t\t\t %u\n", - data->chain_signal_b); - pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_c:\t\t\t %u\n", - data->chain_signal_c); - pos += scnprintf(buf + pos, bufsz - pos, "beacon_count:\t\t\t %u\n", - data->beacon_count); - - pos += scnprintf(buf + pos, bufsz - pos, "disconn_array:\t\t\t"); - for (cnt = 0; cnt < NUM_RX_CHAINS; cnt++) { - pos += scnprintf(buf + pos, bufsz - pos, " %u", - data->disconn_array[cnt]); - } - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - pos += scnprintf(buf + pos, bufsz - pos, "delta_gain_code:\t\t"); - for (cnt = 0; cnt < NUM_RX_CHAINS; cnt++) { - pos += scnprintf(buf + pos, bufsz - pos, " %u", - data->delta_gain_code[cnt]); - } - pos += scnprintf(buf + pos, bufsz - pos, "\n"); - pos += scnprintf(buf + pos, bufsz - pos, "radio_write:\t\t\t %u\n", - data->radio_write); - pos += scnprintf(buf + pos, bufsz - pos, "state:\t\t\t\t %u\n", - data->state); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t iwl_dbgfs_power_save_status_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char buf[60]; - int pos = 0; - const size_t bufsz = sizeof(buf); - u32 pwrsave_status; - - pwrsave_status = iwl_read32(priv->trans, CSR_GP_CNTRL) & - CSR_GP_REG_POWER_SAVE_STATUS_MSK; - - pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: "); - pos += scnprintf(buf + pos, bufsz - pos, "%s\n", - (pwrsave_status == CSR_GP_REG_NO_POWER_SAVE) ? "none" : - (pwrsave_status == CSR_GP_REG_MAC_POWER_SAVE) ? "MAC" : - (pwrsave_status == CSR_GP_REG_PHY_POWER_SAVE) ? "PHY" : - "error"); - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_clear_ucode_statistics_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char buf[8]; - int buf_size; - int clear; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%d", &clear) != 1) - return -EFAULT; - - /* make request to uCode to retrieve statistics information */ - mutex_lock(&priv->mutex); - iwl_send_statistics_request(priv, CMD_SYNC, true); - mutex_unlock(&priv->mutex); - - return count; -} - -static ssize_t iwl_dbgfs_ucode_tracing_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) { - - struct iwl_priv *priv = file->private_data; - int pos = 0; - char buf[128]; - const size_t bufsz = sizeof(buf); - - pos += scnprintf(buf + pos, bufsz - pos, "ucode trace timer is %s\n", - priv->event_log.ucode_trace ? "On" : "Off"); - pos += scnprintf(buf + pos, bufsz - pos, "non_wraps_count:\t\t %u\n", - priv->event_log.non_wraps_count); - pos += scnprintf(buf + pos, bufsz - pos, "wraps_once_count:\t\t %u\n", - priv->event_log.wraps_once_count); - pos += scnprintf(buf + pos, bufsz - pos, "wraps_more_count:\t\t %u\n", - priv->event_log.wraps_more_count); - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_ucode_tracing_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char buf[8]; - int buf_size; - int trace; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%d", &trace) != 1) - return -EFAULT; - - if (trace) { - priv->event_log.ucode_trace = true; - if (iwl_is_alive(priv)) { - /* start collecting data now */ - mod_timer(&priv->ucode_trace, jiffies); - } - } else { - priv->event_log.ucode_trace = false; - del_timer_sync(&priv->ucode_trace); - } - - return count; -} - -static ssize_t iwl_dbgfs_rxon_flags_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) { - - struct iwl_priv *priv = file->private_data; - int len = 0; - char buf[20]; - - len = sprintf(buf, "0x%04X\n", - le32_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.flags)); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t iwl_dbgfs_rxon_filter_flags_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) { - - struct iwl_priv *priv = file->private_data; - int len = 0; - char buf[20]; - - len = sprintf(buf, "0x%04X\n", - le32_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.filter_flags)); - return simple_read_from_buffer(user_buf, count, ppos, buf, len); -} - -static ssize_t iwl_dbgfs_missed_beacon_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) { - - struct iwl_priv *priv = file->private_data; - int pos = 0; - char buf[12]; - const size_t bufsz = sizeof(buf); - - pos += scnprintf(buf + pos, bufsz - pos, "%d\n", - priv->missed_beacon_threshold); - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_missed_beacon_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char buf[8]; - int buf_size; - int missed; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%d", &missed) != 1) - return -EINVAL; - - if (missed < IWL_MISSED_BEACON_THRESHOLD_MIN || - missed > IWL_MISSED_BEACON_THRESHOLD_MAX) - priv->missed_beacon_threshold = - IWL_MISSED_BEACON_THRESHOLD_DEF; - else - priv->missed_beacon_threshold = missed; - - return count; -} - -static ssize_t iwl_dbgfs_plcp_delta_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) { - - struct iwl_priv *priv = file->private_data; - int pos = 0; - char buf[12]; - const size_t bufsz = sizeof(buf); - - pos += scnprintf(buf + pos, bufsz - pos, "%u\n", - priv->plcp_delta_threshold); - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_plcp_delta_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) { - - struct iwl_priv *priv = file->private_data; - char buf[8]; - int buf_size; - int plcp; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%d", &plcp) != 1) - return -EINVAL; - if ((plcp < IWL_MAX_PLCP_ERR_THRESHOLD_MIN) || - (plcp > IWL_MAX_PLCP_ERR_THRESHOLD_MAX)) - priv->plcp_delta_threshold = - IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE; - else - priv->plcp_delta_threshold = plcp; - return count; -} - -static ssize_t iwl_dbgfs_rf_reset_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - int pos = 0; - char buf[300]; - const size_t bufsz = sizeof(buf); - struct iwl_rf_reset *rf_reset = &priv->rf_reset; - - pos += scnprintf(buf + pos, bufsz - pos, - "RF reset statistics\n"); - pos += scnprintf(buf + pos, bufsz - pos, - "\tnumber of reset request: %d\n", - rf_reset->reset_request_count); - pos += scnprintf(buf + pos, bufsz - pos, - "\tnumber of reset request success: %d\n", - rf_reset->reset_success_count); - pos += scnprintf(buf + pos, bufsz - pos, - "\tnumber of reset request reject: %d\n", - rf_reset->reset_reject_count); - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_rf_reset_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) { - - struct iwl_priv *priv = file->private_data; - int ret; - - ret = iwl_force_rf_reset(priv, true); - return ret ? ret : count; -} - -static ssize_t iwl_dbgfs_txfifo_flush_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) { - - struct iwl_priv *priv = file->private_data; - char buf[8]; - int buf_size; - int flush; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%d", &flush) != 1) - return -EINVAL; - - if (iwl_is_rfkill(priv)) - return -EFAULT; - - iwlagn_dev_txfifo_flush(priv); - - return count; -} - -static ssize_t iwl_dbgfs_bt_traffic_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) { - - struct iwl_priv *priv = (struct iwl_priv *)file->private_data; - int pos = 0; - char buf[200]; - const size_t bufsz = sizeof(buf); - - if (!priv->bt_enable_flag) { - pos += scnprintf(buf + pos, bufsz - pos, "BT coex disabled\n"); - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); - } - pos += scnprintf(buf + pos, bufsz - pos, "BT enable flag: 0x%x\n", - priv->bt_enable_flag); - pos += scnprintf(buf + pos, bufsz - pos, "BT in %s mode\n", - priv->bt_full_concurrent ? "full concurrency" : "3-wire"); - pos += scnprintf(buf + pos, bufsz - pos, "BT status: %s, " - "last traffic notif: %d\n", - priv->bt_status ? "On" : "Off", priv->last_bt_traffic_load); - pos += scnprintf(buf + pos, bufsz - pos, "ch_announcement: %d, " - "kill_ack_mask: %x, kill_cts_mask: %x\n", - priv->bt_ch_announce, priv->kill_ack_mask, - priv->kill_cts_mask); - - pos += scnprintf(buf + pos, bufsz - pos, "bluetooth traffic load: "); - switch (priv->bt_traffic_load) { - case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: - pos += scnprintf(buf + pos, bufsz - pos, "Continuous\n"); - break; - case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: - pos += scnprintf(buf + pos, bufsz - pos, "High\n"); - break; - case IWL_BT_COEX_TRAFFIC_LOAD_LOW: - pos += scnprintf(buf + pos, bufsz - pos, "Low\n"); - break; - case IWL_BT_COEX_TRAFFIC_LOAD_NONE: - default: - pos += scnprintf(buf + pos, bufsz - pos, "None\n"); - break; - } - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_protection_mode_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = (struct iwl_priv *)file->private_data; - - int pos = 0; - char buf[40]; - const size_t bufsz = sizeof(buf); - - if (priv->cfg->ht_params) - pos += scnprintf(buf + pos, bufsz - pos, - "use %s for aggregation\n", - (priv->hw_params.use_rts_for_aggregation) ? - "rts/cts" : "cts-to-self"); - else - pos += scnprintf(buf + pos, bufsz - pos, "N/A"); - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_protection_mode_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) { - - struct iwl_priv *priv = file->private_data; - char buf[8]; - int buf_size; - int rts; - - if (!priv->cfg->ht_params) - return -EINVAL; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%d", &rts) != 1) - return -EINVAL; - if (rts) - priv->hw_params.use_rts_for_aggregation = true; - else - priv->hw_params.use_rts_for_aggregation = false; - return count; -} - -static int iwl_cmd_echo_test(struct iwl_priv *priv) -{ - int ret; - struct iwl_host_cmd cmd = { - .id = REPLY_ECHO, - .len = { 0 }, - .flags = CMD_SYNC, - }; - - ret = iwl_dvm_send_cmd(priv, &cmd); - if (ret) - IWL_ERR(priv, "echo testing fail: 0X%x\n", ret); - else - IWL_DEBUG_INFO(priv, "echo testing pass\n"); - return ret; -} - -static ssize_t iwl_dbgfs_echo_test_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char buf[8]; - int buf_size; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - - iwl_cmd_echo_test(priv); - return count; -} - -#ifdef CONFIG_IWLWIFI_DEBUG -static ssize_t iwl_dbgfs_log_event_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char *buf = NULL; - ssize_t ret; - - ret = iwl_dump_nic_event_log(priv, true, &buf); - if (ret > 0) - ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); - kfree(buf); - return ret; -} - -static ssize_t iwl_dbgfs_log_event_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - u32 event_log_flag; - char buf[8]; - int buf_size; - - /* check that the interface is up */ - if (!iwl_is_ready(priv)) - return -EAGAIN; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%d", &event_log_flag) != 1) - return -EFAULT; - if (event_log_flag == 1) - iwl_dump_nic_event_log(priv, true, NULL); - - return count; -} -#endif - -static ssize_t iwl_dbgfs_calib_disabled_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char buf[120]; - int pos = 0; - const size_t bufsz = sizeof(buf); - - pos += scnprintf(buf + pos, bufsz - pos, - "Sensitivity calibrations %s\n", - (priv->calib_disabled & - IWL_SENSITIVITY_CALIB_DISABLED) ? - "DISABLED" : "ENABLED"); - pos += scnprintf(buf + pos, bufsz - pos, - "Chain noise calibrations %s\n", - (priv->calib_disabled & - IWL_CHAIN_NOISE_CALIB_DISABLED) ? - "DISABLED" : "ENABLED"); - pos += scnprintf(buf + pos, bufsz - pos, - "Tx power calibrations %s\n", - (priv->calib_disabled & - IWL_TX_POWER_CALIB_DISABLED) ? - "DISABLED" : "ENABLED"); - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_calib_disabled_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - char buf[8]; - u32 calib_disabled; - int buf_size; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%x", &calib_disabled) != 1) - return -EFAULT; - - priv->calib_disabled = calib_disabled; - - return count; -} - -static ssize_t iwl_dbgfs_fw_restart_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_priv *priv = file->private_data; - bool restart_fw = iwlwifi_mod_params.restart_fw; - int ret; - - iwlwifi_mod_params.restart_fw = true; - - mutex_lock(&priv->mutex); - - /* take the return value to make compiler happy - it will fail anyway */ - ret = iwl_dvm_send_cmd_pdu(priv, REPLY_ERROR, CMD_SYNC, 0, NULL); - - mutex_unlock(&priv->mutex); - - iwlwifi_mod_params.restart_fw = restart_fw; - - return count; -} - -DEBUGFS_READ_FILE_OPS(ucode_rx_stats); -DEBUGFS_READ_FILE_OPS(ucode_tx_stats); -DEBUGFS_READ_FILE_OPS(ucode_general_stats); -DEBUGFS_READ_FILE_OPS(sensitivity); -DEBUGFS_READ_FILE_OPS(chain_noise); -DEBUGFS_READ_FILE_OPS(power_save_status); -DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); -DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); -DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); -DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); -DEBUGFS_READ_WRITE_FILE_OPS(rf_reset); -DEBUGFS_READ_FILE_OPS(rxon_flags); -DEBUGFS_READ_FILE_OPS(rxon_filter_flags); -DEBUGFS_WRITE_FILE_OPS(txfifo_flush); -DEBUGFS_READ_FILE_OPS(ucode_bt_stats); -DEBUGFS_READ_FILE_OPS(bt_traffic); -DEBUGFS_READ_WRITE_FILE_OPS(protection_mode); -DEBUGFS_READ_FILE_OPS(reply_tx_error); -DEBUGFS_WRITE_FILE_OPS(echo_test); -DEBUGFS_WRITE_FILE_OPS(fw_restart); -#ifdef CONFIG_IWLWIFI_DEBUG -DEBUGFS_READ_WRITE_FILE_OPS(log_event); -#endif -DEBUGFS_READ_WRITE_FILE_OPS(calib_disabled); - -/* - * Create the debugfs files and directories - * - */ -int iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir) -{ - struct dentry *dir_data, *dir_rf, *dir_debug; - - priv->debugfs_dir = dbgfs_dir; - - dir_data = debugfs_create_dir("data", dbgfs_dir); - if (!dir_data) - goto err; - dir_rf = debugfs_create_dir("rf", dbgfs_dir); - if (!dir_rf) - goto err; - dir_debug = debugfs_create_dir("debug", dbgfs_dir); - if (!dir_debug) - goto err; - - DEBUGFS_ADD_FILE(nvm, dir_data, S_IRUSR); - DEBUGFS_ADD_FILE(sram, dir_data, S_IWUSR | S_IRUSR); - DEBUGFS_ADD_FILE(wowlan_sram, dir_data, S_IRUSR); - DEBUGFS_ADD_FILE(stations, dir_data, S_IRUSR); - DEBUGFS_ADD_FILE(channels, dir_data, S_IRUSR); - DEBUGFS_ADD_FILE(status, dir_data, S_IRUSR); - DEBUGFS_ADD_FILE(rx_handlers, dir_data, S_IWUSR | S_IRUSR); - DEBUGFS_ADD_FILE(qos, dir_data, S_IRUSR); - DEBUGFS_ADD_FILE(sleep_level_override, dir_data, S_IWUSR | S_IRUSR); - DEBUGFS_ADD_FILE(current_sleep_command, dir_data, S_IRUSR); - DEBUGFS_ADD_FILE(thermal_throttling, dir_data, S_IRUSR); - DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); - DEBUGFS_ADD_FILE(temperature, dir_data, S_IRUSR); - - DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR); - DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); - DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); - DEBUGFS_ADD_FILE(rf_reset, dir_debug, S_IWUSR | S_IRUSR); - DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(txfifo_flush, dir_debug, S_IWUSR); - DEBUGFS_ADD_FILE(protection_mode, dir_debug, S_IWUSR | S_IRUSR); - DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); - DEBUGFS_ADD_FILE(ucode_bt_stats, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(reply_tx_error, dir_debug, S_IRUSR); - DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); - DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); - DEBUGFS_ADD_FILE(echo_test, dir_debug, S_IWUSR); - DEBUGFS_ADD_FILE(fw_restart, dir_debug, S_IWUSR); -#ifdef CONFIG_IWLWIFI_DEBUG - DEBUGFS_ADD_FILE(log_event, dir_debug, S_IWUSR | S_IRUSR); -#endif - - if (iwl_advanced_bt_coexist(priv)) - DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); - - /* Calibrations disabled/enabled status*/ - DEBUGFS_ADD_FILE(calib_disabled, dir_rf, S_IWUSR | S_IRUSR); - - /* - * Create a symlink with mac80211. This is not very robust, as it does - * not remove the symlink created. The implicit assumption is that - * when the opmode exits, mac80211 will also exit, and will remove - * this symlink as part of its cleanup. - */ - if (priv->mac80211_registered) { - char buf[100]; - struct dentry *mac80211_dir, *dev_dir, *root_dir; - - dev_dir = dbgfs_dir->d_parent; - root_dir = dev_dir->d_parent; - mac80211_dir = priv->hw->wiphy->debugfsdir; - - snprintf(buf, 100, "../../%s/%s", root_dir->d_name.name, - dev_dir->d_name.name); - - if (!debugfs_create_symlink("iwlwifi", mac80211_dir, buf)) - goto err; - } - - return 0; - -err: - IWL_ERR(priv, "failed to create the dvm debugfs entries\n"); - return -ENOMEM; -} diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h deleted file mode 100644 index 71ea77576d22..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/dev.h +++ /dev/null @@ -1,917 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ -/* - * Please use this file (dev.h) for driver implementation definitions. - * Please use commands.h for uCode API definitions. - */ - -#ifndef __iwl_dev_h__ -#define __iwl_dev_h__ - -#include -#include -#include -#include -#include -#include - -#include "iwl-fw.h" -#include "iwl-eeprom-parse.h" -#include "iwl-csr.h" -#include "iwl-debug.h" -#include "iwl-agn-hw.h" -#include "iwl-op-mode.h" -#include "iwl-notif-wait.h" -#include "iwl-trans.h" - -#include "led.h" -#include "power.h" -#include "rs.h" -#include "tt.h" - -#include "iwl-test.h" - -/* CT-KILL constants */ -#define CT_KILL_THRESHOLD_LEGACY 110 /* in Celsius */ -#define CT_KILL_THRESHOLD 114 /* in Celsius */ -#define CT_KILL_EXIT_THRESHOLD 95 /* in Celsius */ - -/* Default noise level to report when noise measurement is not available. - * This may be because we're: - * 1) Not associated no beacon statistics being sent to driver) - * 2) Scanning (noise measurement does not apply to associated channel) - * Use default noise value of -127 ... this is below the range of measurable - * Rx dBm for all agn devices, so it can indicate "unmeasurable" to user. - * Also, -127 works better than 0 when averaging frames with/without - * noise info (e.g. averaging might be done in app); measured dBm values are - * always negative ... using a negative value as the default keeps all - * averages within an s8's (used in some apps) range of negative values. */ -#define IWL_NOISE_MEAS_NOT_AVAILABLE (-127) - -/* - * RTS threshold here is total size [2347] minus 4 FCS bytes - * Per spec: - * a value of 0 means RTS on all data/management packets - * a value > max MSDU size means no RTS - * else RTS for data/management frames where MPDU is larger - * than RTS value. - */ -#define DEFAULT_RTS_THRESHOLD 2347U -#define MIN_RTS_THRESHOLD 0U -#define MAX_RTS_THRESHOLD 2347U -#define MAX_MSDU_SIZE 2304U -#define MAX_MPDU_SIZE 2346U -#define DEFAULT_BEACON_INTERVAL 200U -#define DEFAULT_SHORT_RETRY_LIMIT 7U -#define DEFAULT_LONG_RETRY_LIMIT 4U - -#define IWL_NUM_SCAN_RATES (2) - - -#define IEEE80211_DATA_LEN 2304 -#define IEEE80211_4ADDR_LEN 30 -#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) -#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) - -#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 -#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 -#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 - -#define IWL_SUPPORTED_RATES_IE_LEN 8 - -#define IWL_INVALID_RATE 0xFF -#define IWL_INVALID_VALUE -1 - -union iwl_ht_rate_supp { - u16 rates; - struct { - u8 siso_rate; - u8 mimo_rate; - }; -}; - -struct iwl_ht_config { - bool single_chain_sufficient; - enum ieee80211_smps_mode smps; /* current smps mode */ -}; - -/* QoS structures */ -struct iwl_qos_info { - int qos_active; - struct iwl_qosparam_cmd def_qos_parm; -}; - -/** - * enum iwl_agg_state - * - * The state machine of the BA agreement establishment / tear down. - * These states relate to a specific RA / TID. - * - * @IWL_AGG_OFF: aggregation is not used - * @IWL_AGG_STARTING: aggregation are starting (between start and oper) - * @IWL_AGG_ON: aggregation session is up - * @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the - * HW queue to be empty from packets for this RA /TID. - * @IWL_EMPTYING_HW_QUEUE_DELBA: tearing down a BA session - waiting for the - * HW queue to be empty from packets for this RA /TID. - */ -enum iwl_agg_state { - IWL_AGG_OFF = 0, - IWL_AGG_STARTING, - IWL_AGG_ON, - IWL_EMPTYING_HW_QUEUE_ADDBA, - IWL_EMPTYING_HW_QUEUE_DELBA, -}; - -/** - * struct iwl_ht_agg - aggregation state machine - - * This structs holds the states for the BA agreement establishment and tear - * down. It also holds the state during the BA session itself. This struct is - * duplicated for each RA / TID. - - * @rate_n_flags: Rate at which Tx was attempted. Holds the data between the - * Tx response (REPLY_TX), and the block ack notification - * (REPLY_COMPRESSED_BA). - * @state: state of the BA agreement establishment / tear down. - * @txq_id: Tx queue used by the BA session - * @ssn: the first packet to be sent in AGG HW queue in Tx AGG start flow, or - * the first packet to be sent in legacy HW queue in Tx AGG stop flow. - * Basically when next_reclaimed reaches ssn, we can tell mac80211 that - * we are ready to finish the Tx AGG stop / start flow. - * @wait_for_ba: Expect block-ack before next Tx reply - */ -struct iwl_ht_agg { - u32 rate_n_flags; - enum iwl_agg_state state; - u16 txq_id; - u16 ssn; - bool wait_for_ba; -}; - -/** - * struct iwl_tid_data - one for each RA / TID - - * This structs holds the states for each RA / TID. - - * @seq_number: the next WiFi sequence number to use - * @next_reclaimed: the WiFi sequence number of the next packet to be acked. - * This is basically (last acked packet++). - * @agg: aggregation state machine - */ -struct iwl_tid_data { - u16 seq_number; - u16 next_reclaimed; - struct iwl_ht_agg agg; -}; - -/* - * Structure should be accessed with sta_lock held. When station addition - * is in progress (IWL_STA_UCODE_INPROGRESS) it is possible to access only - * the commands (iwl_addsta_cmd and iwl_link_quality_cmd) without sta_lock - * held. - */ -struct iwl_station_entry { - struct iwl_addsta_cmd sta; - u8 used, ctxid; - struct iwl_link_quality_cmd *lq; -}; - -/* - * iwl_station_priv: Driver's private station information - * - * When mac80211 creates a station it reserves some space (hw->sta_data_size) - * in the structure for use by driver. This structure is places in that - * space. - */ -struct iwl_station_priv { - struct iwl_rxon_context *ctx; - struct iwl_lq_sta lq_sta; - atomic_t pending_frames; - bool client; - bool asleep; - u8 max_agg_bufsize; - u8 sta_id; -}; - -/** - * struct iwl_vif_priv - driver's private per-interface information - * - * When mac80211 allocates a virtual interface, it can allocate - * space for us to put data into. - */ -struct iwl_vif_priv { - struct iwl_rxon_context *ctx; - u8 ibss_bssid_sta_id; -}; - -struct iwl_sensitivity_ranges { - u16 min_nrg_cck; - - u16 nrg_th_cck; - u16 nrg_th_ofdm; - - u16 auto_corr_min_ofdm; - u16 auto_corr_min_ofdm_mrc; - u16 auto_corr_min_ofdm_x1; - u16 auto_corr_min_ofdm_mrc_x1; - - u16 auto_corr_max_ofdm; - u16 auto_corr_max_ofdm_mrc; - u16 auto_corr_max_ofdm_x1; - u16 auto_corr_max_ofdm_mrc_x1; - - u16 auto_corr_max_cck; - u16 auto_corr_max_cck_mrc; - u16 auto_corr_min_cck; - u16 auto_corr_min_cck_mrc; - - u16 barker_corr_th_min; - u16 barker_corr_th_min_mrc; - u16 nrg_th_cca; -}; - - -#define KELVIN_TO_CELSIUS(x) ((x)-273) -#define CELSIUS_TO_KELVIN(x) ((x)+273) - - -/****************************************************************************** - * - * Functions implemented in core module which are forward declared here - * for use by iwl-[4-5].c - * - * NOTE: The implementation of these functions are not hardware specific - * which is why they are in the core module files. - * - * Naming convention -- - * iwl_ <-- Is part of iwlwifi - * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX) - * - ****************************************************************************/ -extern void iwl_update_chain_flags(struct iwl_priv *priv); -extern const u8 iwl_bcast_addr[ETH_ALEN]; - -#define IWL_OPERATION_MODE_AUTO 0 -#define IWL_OPERATION_MODE_HT_ONLY 1 -#define IWL_OPERATION_MODE_MIXED 2 -#define IWL_OPERATION_MODE_20MHZ 3 - -#define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000 - -/* Sensitivity and chain noise calibration */ -#define INITIALIZATION_VALUE 0xFFFF -#define IWL_CAL_NUM_BEACONS 16 -#define MAXIMUM_ALLOWED_PATHLOSS 15 - -#define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3 - -#define MAX_FA_OFDM 50 -#define MIN_FA_OFDM 5 -#define MAX_FA_CCK 50 -#define MIN_FA_CCK 5 - -#define AUTO_CORR_STEP_OFDM 1 - -#define AUTO_CORR_STEP_CCK 3 -#define AUTO_CORR_MAX_TH_CCK 160 - -#define NRG_DIFF 2 -#define NRG_STEP_CCK 2 -#define NRG_MARGIN 8 -#define MAX_NUMBER_CCK_NO_FA 100 - -#define AUTO_CORR_CCK_MIN_VAL_DEF (125) - -#define CHAIN_A 0 -#define CHAIN_B 1 -#define CHAIN_C 2 -#define CHAIN_NOISE_DELTA_GAIN_INIT_VAL 4 -#define ALL_BAND_FILTER 0xFF00 -#define IN_BAND_FILTER 0xFF -#define MIN_AVERAGE_NOISE_MAX_VALUE 0xFFFFFFFF - -#define NRG_NUM_PREV_STAT_L 20 -#define NUM_RX_CHAINS 3 - -enum iwlagn_false_alarm_state { - IWL_FA_TOO_MANY = 0, - IWL_FA_TOO_FEW = 1, - IWL_FA_GOOD_RANGE = 2, -}; - -enum iwlagn_chain_noise_state { - IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */ - IWL_CHAIN_NOISE_ACCUMULATE, - IWL_CHAIN_NOISE_CALIBRATED, - IWL_CHAIN_NOISE_DONE, -}; - -/* Sensitivity calib data */ -struct iwl_sensitivity_data { - u32 auto_corr_ofdm; - u32 auto_corr_ofdm_mrc; - u32 auto_corr_ofdm_x1; - u32 auto_corr_ofdm_mrc_x1; - u32 auto_corr_cck; - u32 auto_corr_cck_mrc; - - u32 last_bad_plcp_cnt_ofdm; - u32 last_fa_cnt_ofdm; - u32 last_bad_plcp_cnt_cck; - u32 last_fa_cnt_cck; - - u32 nrg_curr_state; - u32 nrg_prev_state; - u32 nrg_value[10]; - u8 nrg_silence_rssi[NRG_NUM_PREV_STAT_L]; - u32 nrg_silence_ref; - u32 nrg_energy_idx; - u32 nrg_silence_idx; - u32 nrg_th_cck; - s32 nrg_auto_corr_silence_diff; - u32 num_in_cck_no_fa; - u32 nrg_th_ofdm; - - u16 barker_corr_th_min; - u16 barker_corr_th_min_mrc; - u16 nrg_th_cca; -}; - -/* Chain noise (differential Rx gain) calib data */ -struct iwl_chain_noise_data { - u32 active_chains; - u32 chain_noise_a; - u32 chain_noise_b; - u32 chain_noise_c; - u32 chain_signal_a; - u32 chain_signal_b; - u32 chain_signal_c; - u16 beacon_count; - u8 disconn_array[NUM_RX_CHAINS]; - u8 delta_gain_code[NUM_RX_CHAINS]; - u8 radio_write; - u8 state; -}; - -enum { - MEASUREMENT_READY = (1 << 0), - MEASUREMENT_ACTIVE = (1 << 1), -}; - -/* reply_tx_statistics (for _agn devices) */ -struct reply_tx_error_statistics { - u32 pp_delay; - u32 pp_few_bytes; - u32 pp_bt_prio; - u32 pp_quiet_period; - u32 pp_calc_ttak; - u32 int_crossed_retry; - u32 short_limit; - u32 long_limit; - u32 fifo_underrun; - u32 drain_flow; - u32 rfkill_flush; - u32 life_expire; - u32 dest_ps; - u32 host_abort; - u32 bt_retry; - u32 sta_invalid; - u32 frag_drop; - u32 tid_disable; - u32 fifo_flush; - u32 insuff_cf_poll; - u32 fail_hw_drop; - u32 sta_color_mismatch; - u32 unknown; -}; - -/* reply_agg_tx_statistics (for _agn devices) */ -struct reply_agg_tx_error_statistics { - u32 underrun; - u32 bt_prio; - u32 few_bytes; - u32 abort; - u32 last_sent_ttl; - u32 last_sent_try; - u32 last_sent_bt_kill; - u32 scd_query; - u32 bad_crc32; - u32 response; - u32 dump_tx; - u32 delay_tx; - u32 unknown; -}; - -/* - * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds - * to perform continuous uCode event logging operation if enabled - */ -#define UCODE_TRACE_PERIOD (10) - -/* - * iwl_event_log: current uCode event log position - * - * @ucode_trace: enable/disable ucode continuous trace timer - * @num_wraps: how many times the event buffer wraps - * @next_entry: the entry just before the next one that uCode would fill - * @non_wraps_count: counter for no wrap detected when dump ucode events - * @wraps_once_count: counter for wrap once detected when dump ucode events - * @wraps_more_count: counter for wrap more than once detected - * when dump ucode events - */ -struct iwl_event_log { - bool ucode_trace; - u32 num_wraps; - u32 next_entry; - int non_wraps_count; - int wraps_once_count; - int wraps_more_count; -}; - -#define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3) - -/* BT Antenna Coupling Threshold (dB) */ -#define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35) - -/* Firmware reload counter and Timestamp */ -#define IWL_MIN_RELOAD_DURATION 1000 /* 1000 ms */ -#define IWL_MAX_CONTINUE_RELOAD_CNT 4 - - -struct iwl_rf_reset { - int reset_request_count; - int reset_success_count; - int reset_reject_count; - unsigned long last_reset_jiffies; -}; - -enum iwl_rxon_context_id { - IWL_RXON_CTX_BSS, - IWL_RXON_CTX_PAN, - - NUM_IWL_RXON_CTX -}; - -/* extend beacon time format bit shifting */ -/* - * for _agn devices - * bits 31:22 - extended - * bits 21:0 - interval - */ -#define IWLAGN_EXT_BEACON_TIME_POS 22 - -struct iwl_rxon_context { - struct ieee80211_vif *vif; - - u8 mcast_queue; - u8 ac_to_queue[IEEE80211_NUM_ACS]; - u8 ac_to_fifo[IEEE80211_NUM_ACS]; - - /* - * We could use the vif to indicate active, but we - * also need it to be active during disabling when - * we already removed the vif for type setting. - */ - bool always_active, is_active; - - bool ht_need_multiple_chains; - - enum iwl_rxon_context_id ctxid; - - u32 interface_modes, exclusive_interface_modes; - u8 unused_devtype, ap_devtype, ibss_devtype, station_devtype; - - /* - * We declare this const so it can only be - * changed via explicit cast within the - * routines that actually update the physical - * hardware. - */ - const struct iwl_rxon_cmd active; - struct iwl_rxon_cmd staging; - - struct iwl_rxon_time_cmd timing; - - struct iwl_qos_info qos_data; - - u8 bcast_sta_id, ap_sta_id; - - u8 rxon_cmd, rxon_assoc_cmd, rxon_timing_cmd; - u8 qos_cmd; - u8 wep_key_cmd; - - struct iwl_wep_key wep_keys[WEP_KEYS_MAX]; - u8 key_mapping_keys; - - __le32 station_flags; - - int beacon_int; - - struct { - bool non_gf_sta_present; - u8 protection; - bool enabled, is_40mhz; - u8 extension_chan_offset; - } ht; -}; - -enum iwl_scan_type { - IWL_SCAN_NORMAL, - IWL_SCAN_RADIO_RESET, - IWL_SCAN_ROC, -}; - -/** - * struct iwl_hw_params - * - * Holds the module parameters - * - * @tx_chains_num: Number of TX chains - * @rx_chains_num: Number of RX chains - * @ct_kill_threshold: temperature threshold - in hw dependent unit - * @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit - * relevant for 1000, 6000 and up - * @struct iwl_sensitivity_ranges: range of sensitivity values - * @use_rts_for_aggregation: use rts/cts protection for HT traffic - */ -struct iwl_hw_params { - u8 tx_chains_num; - u8 rx_chains_num; - bool use_rts_for_aggregation; - u32 ct_kill_threshold; - u32 ct_kill_exit_threshold; - - const struct iwl_sensitivity_ranges *sens; -}; - -struct iwl_lib_ops { - /* set hw dependent parameters */ - void (*set_hw_params)(struct iwl_priv *priv); - int (*set_channel_switch)(struct iwl_priv *priv, - struct ieee80211_channel_switch *ch_switch); - /* device specific configuration */ - void (*nic_config)(struct iwl_priv *priv); - - /* temperature */ - void (*temperature)(struct iwl_priv *priv); -}; - -struct iwl_wipan_noa_data { - struct rcu_head rcu_head; - u32 length; - u8 data[]; -}; - -/* Calibration disabling bit mask */ -enum { - IWL_CALIB_ENABLE_ALL = 0, - - IWL_SENSITIVITY_CALIB_DISABLED = BIT(0), - IWL_CHAIN_NOISE_CALIB_DISABLED = BIT(1), - IWL_TX_POWER_CALIB_DISABLED = BIT(2), - - IWL_CALIB_DISABLE_ALL = 0xFFFFFFFF, -}; - -#define IWL_OP_MODE_GET_DVM(_iwl_op_mode) \ - ((struct iwl_priv *) ((_iwl_op_mode)->op_mode_specific)) - -#define IWL_MAC80211_GET_DVM(_hw) \ - ((struct iwl_priv *) ((struct iwl_op_mode *) \ - (_hw)->priv)->op_mode_specific) - -struct iwl_priv { - - struct iwl_trans *trans; - struct device *dev; /* for debug prints only */ - const struct iwl_cfg *cfg; - const struct iwl_fw *fw; - const struct iwl_lib_ops *lib; - unsigned long status; - - spinlock_t sta_lock; - struct mutex mutex; - - unsigned long transport_queue_stop; - bool passive_no_rx; -#define IWL_INVALID_MAC80211_QUEUE 0xff - u8 queue_to_mac80211[IWL_MAX_HW_QUEUES]; - atomic_t queue_stop_count[IWL_MAX_HW_QUEUES]; - - unsigned long agg_q_alloc[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)]; - - /* ieee device used by generic ieee processing code */ - struct ieee80211_hw *hw; - - struct list_head calib_results; - - struct workqueue_struct *workqueue; - - struct iwl_hw_params hw_params; - - enum ieee80211_band band; - u8 valid_contexts; - - int (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); - - struct iwl_notif_wait_data notif_wait; - - /* spectrum measurement report caching */ - struct iwl_spectrum_notification measure_report; - u8 measurement_status; - -#define IWL_OWNERSHIP_DRIVER 0 -#define IWL_OWNERSHIP_TM 1 - u8 ucode_owner; - - /* ucode beacon time */ - u32 ucode_beacon_time; - int missed_beacon_threshold; - - /* track IBSS manager (last beacon) status */ - u32 ibss_manager; - - /* jiffies when last recovery from statistics was performed */ - unsigned long rx_statistics_jiffies; - - /*counters */ - u32 rx_handlers_stats[REPLY_MAX]; - - /* rf reset */ - struct iwl_rf_reset rf_reset; - - /* firmware reload counter and timestamp */ - unsigned long reload_jiffies; - int reload_count; - bool ucode_loaded; - bool init_ucode_run; /* Don't run init uCode again */ - - u8 plcp_delta_threshold; - - /* thermal calibration */ - s32 temperature; /* Celsius */ - s32 last_temperature; - - struct iwl_wipan_noa_data __rcu *noa_data; - - /* Scan related variables */ - unsigned long scan_start; - unsigned long scan_start_tsf; - void *scan_cmd; - enum ieee80211_band scan_band; - struct cfg80211_scan_request *scan_request; - struct ieee80211_vif *scan_vif; - enum iwl_scan_type scan_type; - u8 scan_tx_ant[IEEE80211_NUM_BANDS]; - u8 mgmt_tx_ant; - - /* max number of station keys */ - u8 sta_key_max_num; - - bool new_scan_threshold_behaviour; - - bool wowlan; - - /* EEPROM MAC addresses */ - struct mac_address addresses[2]; - - struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; - - __le16 switch_channel; - - u8 start_calib; - struct iwl_sensitivity_data sensitivity_data; - struct iwl_chain_noise_data chain_noise_data; - __le16 sensitivity_tbl[HD_TABLE_SIZE]; - __le16 enhance_sensitivity_tbl[ENHANCE_HD_TABLE_ENTRIES]; - - struct iwl_ht_config current_ht_config; - - /* Rate scaling data */ - u8 retry_rate; - - int activity_timer_active; - - struct iwl_power_mgr power_data; - struct iwl_tt_mgmt thermal_throttle; - - /* station table variables */ - int num_stations; - struct iwl_station_entry stations[IWLAGN_STATION_COUNT]; - unsigned long ucode_key_table; - struct iwl_tid_data tid_data[IWLAGN_STATION_COUNT][IWL_MAX_TID_COUNT]; - atomic_t num_aux_in_flight; - - u8 mac80211_registered; - - /* Indication if ieee80211_ops->open has been called */ - u8 is_open; - - enum nl80211_iftype iw_mode; - - /* Last Rx'd beacon timestamp */ - u64 timestamp; - - struct { - __le32 flag; - struct statistics_general_common common; - struct statistics_rx_non_phy rx_non_phy; - struct statistics_rx_phy rx_ofdm; - struct statistics_rx_ht_phy rx_ofdm_ht; - struct statistics_rx_phy rx_cck; - struct statistics_tx tx; -#ifdef CONFIG_IWLWIFI_DEBUGFS - struct statistics_bt_activity bt_activity; - __le32 num_bt_kills, accum_num_bt_kills; -#endif - spinlock_t lock; - } statistics; -#ifdef CONFIG_IWLWIFI_DEBUGFS - struct { - struct statistics_general_common common; - struct statistics_rx_non_phy rx_non_phy; - struct statistics_rx_phy rx_ofdm; - struct statistics_rx_ht_phy rx_ofdm_ht; - struct statistics_rx_phy rx_cck; - struct statistics_tx tx; - struct statistics_bt_activity bt_activity; - } accum_stats, delta_stats, max_delta_stats; -#endif - - /* - * reporting the number of tids has AGG on. 0 means - * no AGGREGATION - */ - u8 agg_tids_count; - - struct iwl_rx_phy_res last_phy_res; - u32 ampdu_ref; - bool last_phy_res_valid; - - /* - * chain noise reset and gain commands are the - * two extra calibration commands follows the standard - * phy calibration commands - */ - u8 phy_calib_chain_noise_reset_cmd; - u8 phy_calib_chain_noise_gain_cmd; - - /* counts reply_tx error */ - struct reply_tx_error_statistics reply_tx_stats; - struct reply_agg_tx_error_statistics reply_agg_tx_stats; - - /* remain-on-channel offload support */ - struct ieee80211_channel *hw_roc_channel; - struct delayed_work hw_roc_disable_work; - int hw_roc_duration; - bool hw_roc_setup, hw_roc_start_notified; - - /* bt coex */ - u8 bt_enable_flag; - u8 bt_status; - u8 bt_traffic_load, last_bt_traffic_load; - bool bt_ch_announce; - bool bt_full_concurrent; - bool bt_ant_couple_ok; - __le32 kill_ack_mask; - __le32 kill_cts_mask; - __le16 bt_valid; - bool reduced_txpower; - u16 bt_on_thresh; - u16 bt_duration; - u16 dynamic_frag_thresh; - u8 bt_ci_compliance; - struct work_struct bt_traffic_change_work; - bool bt_enable_pspoll; - struct iwl_rxon_context *cur_rssi_ctx; - bool bt_is_sco; - - struct work_struct restart; - struct work_struct scan_completed; - struct work_struct abort_scan; - - struct work_struct beacon_update; - struct iwl_rxon_context *beacon_ctx; - struct sk_buff *beacon_skb; - void *beacon_cmd; - - struct work_struct tt_work; - struct work_struct ct_enter; - struct work_struct ct_exit; - struct work_struct start_internal_scan; - struct work_struct tx_flush; - struct work_struct bt_full_concurrency; - struct work_struct bt_runtime_config; - - struct delayed_work scan_check; - - /* TX Power settings */ - s8 tx_power_user_lmt; - s8 tx_power_next; - -#ifdef CONFIG_IWLWIFI_DEBUGFS - /* debugfs */ - struct dentry *debugfs_dir; - u32 dbgfs_sram_offset, dbgfs_sram_len; - bool disable_ht40; - void *wowlan_sram; -#endif /* CONFIG_IWLWIFI_DEBUGFS */ - - struct iwl_nvm_data *nvm_data; - /* eeprom blob for debugfs/testmode */ - u8 *eeprom_blob; - size_t eeprom_blob_size; - - struct work_struct txpower_work; - u32 calib_disabled; - struct work_struct run_time_calib_work; - struct timer_list statistics_periodic; - struct timer_list ucode_trace; - - struct iwl_event_log event_log; - - struct led_classdev led; - unsigned long blink_on, blink_off; - bool led_registered; - -#ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE - struct iwl_test tst; - u32 tm_fixed_rate; -#endif - - /* WoWLAN GTK rekey data */ - u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN]; - __le64 replay_ctr; - __le16 last_seq_ctl; - bool have_rekey_data; - - /* device_pointers: pointers to ucode event tables */ - struct { - u32 error_event_table; - u32 log_event_table; - } device_pointers; - - /* indicator of loaded ucode image */ - enum iwl_ucode_type cur_ucode; -}; /*iwl_priv */ - -static inline struct iwl_rxon_context * -iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif) -{ - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; - - return vif_priv->ctx; -} - -#define for_each_context(priv, ctx) \ - for (ctx = &priv->contexts[IWL_RXON_CTX_BSS]; \ - ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \ - if (priv->valid_contexts & BIT(ctx->ctxid)) - -static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx) -{ - return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; -} - -static inline int iwl_is_associated(struct iwl_priv *priv, - enum iwl_rxon_context_id ctxid) -{ - return iwl_is_associated_ctx(&priv->contexts[ctxid]); -} - -static inline int iwl_is_any_associated(struct iwl_priv *priv) -{ - struct iwl_rxon_context *ctx; - for_each_context(priv, ctx) - if (iwl_is_associated_ctx(ctx)) - return true; - return false; -} - -#endif /* __iwl_dev_h__ */ diff --git a/drivers/net/wireless/iwlwifi/dvm/devices.c b/drivers/net/wireless/iwlwifi/dvm/devices.c deleted file mode 100644 index c48907c8ab43..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/devices.c +++ /dev/null @@ -1,599 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -/* - * DVM device-specific data & functions - */ -#include "iwl-io.h" -#include "iwl-prph.h" -#include "iwl-eeprom-parse.h" - -#include "agn.h" -#include "dev.h" -#include "commands.h" - - -/* - * 1000 series - * =========== - */ - -/* - * For 1000, use advance thermal throttling critical temperature threshold, - * but legacy thermal management implementation for now. - * This is for the reason of 1000 uCode using advance thermal throttling API - * but not implement ct_kill_exit based on ct_kill exit temperature - * so the thermal throttling will still based on legacy thermal throttling - * management. - * The code here need to be modified once 1000 uCode has the advanced thermal - * throttling algorithm in place - */ -static void iwl1000_set_ct_threshold(struct iwl_priv *priv) -{ - /* want Celsius */ - priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY; - priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD; -} - -/* NIC configuration for 1000 series */ -static void iwl1000_nic_config(struct iwl_priv *priv) -{ - /* Setting digital SVR for 1000 card to 1.32V */ - /* locking is acquired in iwl_set_bits_mask_prph() function */ - iwl_set_bits_mask_prph(priv->trans, APMG_DIGITAL_SVR_REG, - APMG_SVR_DIGITAL_VOLTAGE_1_32, - ~APMG_SVR_VOLTAGE_CONFIG_BIT_MSK); -} - -/** - * iwl_beacon_time_mask_low - mask of lower 32 bit of beacon time - * @priv -- pointer to iwl_priv data structure - * @tsf_bits -- number of bits need to shift for masking) - */ -static inline u32 iwl_beacon_time_mask_low(struct iwl_priv *priv, - u16 tsf_bits) -{ - return (1 << tsf_bits) - 1; -} - -/** - * iwl_beacon_time_mask_high - mask of higher 32 bit of beacon time - * @priv -- pointer to iwl_priv data structure - * @tsf_bits -- number of bits need to shift for masking) - */ -static inline u32 iwl_beacon_time_mask_high(struct iwl_priv *priv, - u16 tsf_bits) -{ - return ((1 << (32 - tsf_bits)) - 1) << tsf_bits; -} - -/* - * extended beacon time format - * time in usec will be changed into a 32-bit value in extended:internal format - * the extended part is the beacon counts - * the internal part is the time in usec within one beacon interval - */ -static u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, - u32 beacon_interval) -{ - u32 quot; - u32 rem; - u32 interval = beacon_interval * TIME_UNIT; - - if (!interval || !usec) - return 0; - - quot = (usec / interval) & - (iwl_beacon_time_mask_high(priv, IWLAGN_EXT_BEACON_TIME_POS) >> - IWLAGN_EXT_BEACON_TIME_POS); - rem = (usec % interval) & iwl_beacon_time_mask_low(priv, - IWLAGN_EXT_BEACON_TIME_POS); - - return (quot << IWLAGN_EXT_BEACON_TIME_POS) + rem; -} - -/* base is usually what we get from ucode with each received frame, - * the same as HW timer counter counting down - */ -static __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base, - u32 addon, u32 beacon_interval) -{ - u32 base_low = base & iwl_beacon_time_mask_low(priv, - IWLAGN_EXT_BEACON_TIME_POS); - u32 addon_low = addon & iwl_beacon_time_mask_low(priv, - IWLAGN_EXT_BEACON_TIME_POS); - u32 interval = beacon_interval * TIME_UNIT; - u32 res = (base & iwl_beacon_time_mask_high(priv, - IWLAGN_EXT_BEACON_TIME_POS)) + - (addon & iwl_beacon_time_mask_high(priv, - IWLAGN_EXT_BEACON_TIME_POS)); - - if (base_low > addon_low) - res += base_low - addon_low; - else if (base_low < addon_low) { - res += interval + base_low - addon_low; - res += (1 << IWLAGN_EXT_BEACON_TIME_POS); - } else - res += (1 << IWLAGN_EXT_BEACON_TIME_POS); - - return cpu_to_le32(res); -} - -static const struct iwl_sensitivity_ranges iwl1000_sensitivity = { - .min_nrg_cck = 95, - .auto_corr_min_ofdm = 90, - .auto_corr_min_ofdm_mrc = 170, - .auto_corr_min_ofdm_x1 = 120, - .auto_corr_min_ofdm_mrc_x1 = 240, - - .auto_corr_max_ofdm = 120, - .auto_corr_max_ofdm_mrc = 210, - .auto_corr_max_ofdm_x1 = 155, - .auto_corr_max_ofdm_mrc_x1 = 290, - - .auto_corr_min_cck = 125, - .auto_corr_max_cck = 200, - .auto_corr_min_cck_mrc = 170, - .auto_corr_max_cck_mrc = 400, - .nrg_th_cck = 95, - .nrg_th_ofdm = 95, - - .barker_corr_th_min = 190, - .barker_corr_th_min_mrc = 390, - .nrg_th_cca = 62, -}; - -static void iwl1000_hw_set_hw_params(struct iwl_priv *priv) -{ - iwl1000_set_ct_threshold(priv); - - /* Set initial sensitivity parameters */ - priv->hw_params.sens = &iwl1000_sensitivity; -} - -struct iwl_lib_ops iwl1000_lib = { - .set_hw_params = iwl1000_hw_set_hw_params, - .nic_config = iwl1000_nic_config, - .temperature = iwlagn_temperature, -}; - - -/* - * 2000 series - * =========== - */ - -static void iwl2000_set_ct_threshold(struct iwl_priv *priv) -{ - /* want Celsius */ - priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD; - priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD; -} - -/* NIC configuration for 2000 series */ -static void iwl2000_nic_config(struct iwl_priv *priv) -{ - iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG, - CSR_GP_DRIVER_REG_BIT_RADIO_IQ_INVER); -} - -static const struct iwl_sensitivity_ranges iwl2000_sensitivity = { - .min_nrg_cck = 97, - .auto_corr_min_ofdm = 80, - .auto_corr_min_ofdm_mrc = 128, - .auto_corr_min_ofdm_x1 = 105, - .auto_corr_min_ofdm_mrc_x1 = 192, - - .auto_corr_max_ofdm = 145, - .auto_corr_max_ofdm_mrc = 232, - .auto_corr_max_ofdm_x1 = 110, - .auto_corr_max_ofdm_mrc_x1 = 232, - - .auto_corr_min_cck = 125, - .auto_corr_max_cck = 175, - .auto_corr_min_cck_mrc = 160, - .auto_corr_max_cck_mrc = 310, - .nrg_th_cck = 97, - .nrg_th_ofdm = 100, - - .barker_corr_th_min = 190, - .barker_corr_th_min_mrc = 390, - .nrg_th_cca = 62, -}; - -static void iwl2000_hw_set_hw_params(struct iwl_priv *priv) -{ - iwl2000_set_ct_threshold(priv); - - /* Set initial sensitivity parameters */ - priv->hw_params.sens = &iwl2000_sensitivity; -} - -struct iwl_lib_ops iwl2000_lib = { - .set_hw_params = iwl2000_hw_set_hw_params, - .nic_config = iwl2000_nic_config, - .temperature = iwlagn_temperature, -}; - -struct iwl_lib_ops iwl2030_lib = { - .set_hw_params = iwl2000_hw_set_hw_params, - .nic_config = iwl2000_nic_config, - .temperature = iwlagn_temperature, -}; - -/* - * 5000 series - * =========== - */ - -/* NIC configuration for 5000 series */ -static const struct iwl_sensitivity_ranges iwl5000_sensitivity = { - .min_nrg_cck = 100, - .auto_corr_min_ofdm = 90, - .auto_corr_min_ofdm_mrc = 170, - .auto_corr_min_ofdm_x1 = 105, - .auto_corr_min_ofdm_mrc_x1 = 220, - - .auto_corr_max_ofdm = 120, - .auto_corr_max_ofdm_mrc = 210, - .auto_corr_max_ofdm_x1 = 120, - .auto_corr_max_ofdm_mrc_x1 = 240, - - .auto_corr_min_cck = 125, - .auto_corr_max_cck = 200, - .auto_corr_min_cck_mrc = 200, - .auto_corr_max_cck_mrc = 400, - .nrg_th_cck = 100, - .nrg_th_ofdm = 100, - - .barker_corr_th_min = 190, - .barker_corr_th_min_mrc = 390, - .nrg_th_cca = 62, -}; - -static struct iwl_sensitivity_ranges iwl5150_sensitivity = { - .min_nrg_cck = 95, - .auto_corr_min_ofdm = 90, - .auto_corr_min_ofdm_mrc = 170, - .auto_corr_min_ofdm_x1 = 105, - .auto_corr_min_ofdm_mrc_x1 = 220, - - .auto_corr_max_ofdm = 120, - .auto_corr_max_ofdm_mrc = 210, - /* max = min for performance bug in 5150 DSP */ - .auto_corr_max_ofdm_x1 = 105, - .auto_corr_max_ofdm_mrc_x1 = 220, - - .auto_corr_min_cck = 125, - .auto_corr_max_cck = 200, - .auto_corr_min_cck_mrc = 170, - .auto_corr_max_cck_mrc = 400, - .nrg_th_cck = 95, - .nrg_th_ofdm = 95, - - .barker_corr_th_min = 190, - .barker_corr_th_min_mrc = 390, - .nrg_th_cca = 62, -}; - -#define IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF (-5) - -static s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) -{ - u16 temperature, voltage; - - temperature = le16_to_cpu(priv->nvm_data->kelvin_temperature); - voltage = le16_to_cpu(priv->nvm_data->kelvin_voltage); - - /* offset = temp - volt / coeff */ - return (s32)(temperature - - voltage / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF); -} - -static void iwl5150_set_ct_threshold(struct iwl_priv *priv) -{ - const s32 volt2temp_coef = IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF; - s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) - - iwl_temp_calib_to_offset(priv); - - priv->hw_params.ct_kill_threshold = threshold * volt2temp_coef; -} - -static void iwl5000_set_ct_threshold(struct iwl_priv *priv) -{ - /* want Celsius */ - priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD_LEGACY; -} - -static void iwl5000_hw_set_hw_params(struct iwl_priv *priv) -{ - iwl5000_set_ct_threshold(priv); - - /* Set initial sensitivity parameters */ - priv->hw_params.sens = &iwl5000_sensitivity; -} - -static void iwl5150_hw_set_hw_params(struct iwl_priv *priv) -{ - iwl5150_set_ct_threshold(priv); - - /* Set initial sensitivity parameters */ - priv->hw_params.sens = &iwl5150_sensitivity; -} - -static void iwl5150_temperature(struct iwl_priv *priv) -{ - u32 vt = 0; - s32 offset = iwl_temp_calib_to_offset(priv); - - vt = le32_to_cpu(priv->statistics.common.temperature); - vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset; - /* now vt hold the temperature in Kelvin */ - priv->temperature = KELVIN_TO_CELSIUS(vt); - iwl_tt_handler(priv); -} - -static int iwl5000_hw_channel_switch(struct iwl_priv *priv, - struct ieee80211_channel_switch *ch_switch) -{ - /* - * MULTI-FIXME - * See iwlagn_mac_channel_switch. - */ - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - struct iwl5000_channel_switch_cmd cmd; - u32 switch_time_in_usec, ucode_switch_time; - u16 ch; - u32 tsf_low; - u8 switch_count; - u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval); - struct ieee80211_vif *vif = ctx->vif; - struct iwl_host_cmd hcmd = { - .id = REPLY_CHANNEL_SWITCH, - .len = { sizeof(cmd), }, - .flags = CMD_SYNC, - .data = { &cmd, }, - }; - - cmd.band = priv->band == IEEE80211_BAND_2GHZ; - ch = ch_switch->chandef.chan->hw_value; - IWL_DEBUG_11H(priv, "channel switch from %d to %d\n", - ctx->active.channel, ch); - cmd.channel = cpu_to_le16(ch); - cmd.rxon_flags = ctx->staging.flags; - cmd.rxon_filter_flags = ctx->staging.filter_flags; - switch_count = ch_switch->count; - tsf_low = ch_switch->timestamp & 0x0ffffffff; - /* - * calculate the ucode channel switch time - * adding TSF as one of the factor for when to switch - */ - if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) { - if (switch_count > ((priv->ucode_beacon_time - tsf_low) / - beacon_interval)) { - switch_count -= (priv->ucode_beacon_time - - tsf_low) / beacon_interval; - } else - switch_count = 0; - } - if (switch_count <= 1) - cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time); - else { - switch_time_in_usec = - vif->bss_conf.beacon_int * switch_count * TIME_UNIT; - ucode_switch_time = iwl_usecs_to_beacons(priv, - switch_time_in_usec, - beacon_interval); - cmd.switch_time = iwl_add_beacon_time(priv, - priv->ucode_beacon_time, - ucode_switch_time, - beacon_interval); - } - IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n", - cmd.switch_time); - cmd.expect_beacon = - ch_switch->chandef.chan->flags & IEEE80211_CHAN_RADAR; - - return iwl_dvm_send_cmd(priv, &hcmd); -} - -struct iwl_lib_ops iwl5000_lib = { - .set_hw_params = iwl5000_hw_set_hw_params, - .set_channel_switch = iwl5000_hw_channel_switch, - .temperature = iwlagn_temperature, -}; - -struct iwl_lib_ops iwl5150_lib = { - .set_hw_params = iwl5150_hw_set_hw_params, - .set_channel_switch = iwl5000_hw_channel_switch, - .temperature = iwl5150_temperature, -}; - - - -/* - * 6000 series - * =========== - */ - -static void iwl6000_set_ct_threshold(struct iwl_priv *priv) -{ - /* want Celsius */ - priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD; - priv->hw_params.ct_kill_exit_threshold = CT_KILL_EXIT_THRESHOLD; -} - -/* NIC configuration for 6000 series */ -static void iwl6000_nic_config(struct iwl_priv *priv) -{ - switch (priv->cfg->device_family) { - case IWL_DEVICE_FAMILY_6005: - case IWL_DEVICE_FAMILY_6030: - case IWL_DEVICE_FAMILY_6000: - break; - case IWL_DEVICE_FAMILY_6000i: - /* 2x2 IPA phy type */ - iwl_write32(priv->trans, CSR_GP_DRIVER_REG, - CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA); - break; - case IWL_DEVICE_FAMILY_6050: - /* Indicate calibration version to uCode. */ - if (priv->nvm_data->calib_version >= 6) - iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG, - CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); - break; - case IWL_DEVICE_FAMILY_6150: - /* Indicate calibration version to uCode. */ - if (priv->nvm_data->calib_version >= 6) - iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG, - CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); - iwl_set_bit(priv->trans, CSR_GP_DRIVER_REG, - CSR_GP_DRIVER_REG_BIT_6050_1x2); - break; - default: - WARN_ON(1); - } -} - -static const struct iwl_sensitivity_ranges iwl6000_sensitivity = { - .min_nrg_cck = 110, - .auto_corr_min_ofdm = 80, - .auto_corr_min_ofdm_mrc = 128, - .auto_corr_min_ofdm_x1 = 105, - .auto_corr_min_ofdm_mrc_x1 = 192, - - .auto_corr_max_ofdm = 145, - .auto_corr_max_ofdm_mrc = 232, - .auto_corr_max_ofdm_x1 = 110, - .auto_corr_max_ofdm_mrc_x1 = 232, - - .auto_corr_min_cck = 125, - .auto_corr_max_cck = 175, - .auto_corr_min_cck_mrc = 160, - .auto_corr_max_cck_mrc = 310, - .nrg_th_cck = 110, - .nrg_th_ofdm = 110, - - .barker_corr_th_min = 190, - .barker_corr_th_min_mrc = 336, - .nrg_th_cca = 62, -}; - -static void iwl6000_hw_set_hw_params(struct iwl_priv *priv) -{ - iwl6000_set_ct_threshold(priv); - - /* Set initial sensitivity parameters */ - priv->hw_params.sens = &iwl6000_sensitivity; - -} - -static int iwl6000_hw_channel_switch(struct iwl_priv *priv, - struct ieee80211_channel_switch *ch_switch) -{ - /* - * MULTI-FIXME - * See iwlagn_mac_channel_switch. - */ - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - struct iwl6000_channel_switch_cmd *cmd; - u32 switch_time_in_usec, ucode_switch_time; - u16 ch; - u32 tsf_low; - u8 switch_count; - u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval); - struct ieee80211_vif *vif = ctx->vif; - struct iwl_host_cmd hcmd = { - .id = REPLY_CHANNEL_SWITCH, - .len = { sizeof(*cmd), }, - .flags = CMD_SYNC, - .dataflags[0] = IWL_HCMD_DFL_NOCOPY, - }; - int err; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) - return -ENOMEM; - - hcmd.data[0] = cmd; - - cmd->band = priv->band == IEEE80211_BAND_2GHZ; - ch = ch_switch->chandef.chan->hw_value; - IWL_DEBUG_11H(priv, "channel switch from %u to %u\n", - ctx->active.channel, ch); - cmd->channel = cpu_to_le16(ch); - cmd->rxon_flags = ctx->staging.flags; - cmd->rxon_filter_flags = ctx->staging.filter_flags; - switch_count = ch_switch->count; - tsf_low = ch_switch->timestamp & 0x0ffffffff; - /* - * calculate the ucode channel switch time - * adding TSF as one of the factor for when to switch - */ - if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) { - if (switch_count > ((priv->ucode_beacon_time - tsf_low) / - beacon_interval)) { - switch_count -= (priv->ucode_beacon_time - - tsf_low) / beacon_interval; - } else - switch_count = 0; - } - if (switch_count <= 1) - cmd->switch_time = cpu_to_le32(priv->ucode_beacon_time); - else { - switch_time_in_usec = - vif->bss_conf.beacon_int * switch_count * TIME_UNIT; - ucode_switch_time = iwl_usecs_to_beacons(priv, - switch_time_in_usec, - beacon_interval); - cmd->switch_time = iwl_add_beacon_time(priv, - priv->ucode_beacon_time, - ucode_switch_time, - beacon_interval); - } - IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n", - cmd->switch_time); - cmd->expect_beacon = - ch_switch->chandef.chan->flags & IEEE80211_CHAN_RADAR; - - err = iwl_dvm_send_cmd(priv, &hcmd); - kfree(cmd); - return err; -} - -struct iwl_lib_ops iwl6000_lib = { - .set_hw_params = iwl6000_hw_set_hw_params, - .set_channel_switch = iwl6000_hw_channel_switch, - .nic_config = iwl6000_nic_config, - .temperature = iwlagn_temperature, -}; - -struct iwl_lib_ops iwl6030_lib = { - .set_hw_params = iwl6000_hw_set_hw_params, - .set_channel_switch = iwl6000_hw_channel_switch, - .nic_config = iwl6000_nic_config, - .temperature = iwlagn_temperature, -}; diff --git a/drivers/net/wireless/iwlwifi/dvm/led.c b/drivers/net/wireless/iwlwifi/dvm/led.c deleted file mode 100644 index 33c7e15d24f5..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/led.c +++ /dev/null @@ -1,224 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "iwl-io.h" -#include "iwl-trans.h" -#include "iwl-modparams.h" -#include "dev.h" -#include "agn.h" - -/* Throughput OFF time(ms) ON time (ms) - * >300 25 25 - * >200 to 300 40 40 - * >100 to 200 55 55 - * >70 to 100 65 65 - * >50 to 70 75 75 - * >20 to 50 85 85 - * >10 to 20 95 95 - * >5 to 10 110 110 - * >1 to 5 130 130 - * >0 to 1 167 167 - * <=0 SOLID ON - */ -static const struct ieee80211_tpt_blink iwl_blink[] = { - { .throughput = 0, .blink_time = 334 }, - { .throughput = 1 * 1024 - 1, .blink_time = 260 }, - { .throughput = 5 * 1024 - 1, .blink_time = 220 }, - { .throughput = 10 * 1024 - 1, .blink_time = 190 }, - { .throughput = 20 * 1024 - 1, .blink_time = 170 }, - { .throughput = 50 * 1024 - 1, .blink_time = 150 }, - { .throughput = 70 * 1024 - 1, .blink_time = 130 }, - { .throughput = 100 * 1024 - 1, .blink_time = 110 }, - { .throughput = 200 * 1024 - 1, .blink_time = 80 }, - { .throughput = 300 * 1024 - 1, .blink_time = 50 }, -}; - -/* Set led register off */ -void iwlagn_led_enable(struct iwl_priv *priv) -{ - iwl_write32(priv->trans, CSR_LED_REG, CSR_LED_REG_TURN_ON); -} - -/* - * Adjust led blink rate to compensate on a MAC Clock difference on every HW - * Led blink rate analysis showed an average deviation of 20% on 5000 series - * and up. - * Need to compensate on the led on/off time per HW according to the deviation - * to achieve the desired led frequency - * The calculation is: (100-averageDeviation)/100 * blinkTime - * For code efficiency the calculation will be: - * compensation = (100 - averageDeviation) * 64 / 100 - * NewBlinkTime = (compensation * BlinkTime) / 64 - */ -static inline u8 iwl_blink_compensation(struct iwl_priv *priv, - u8 time, u16 compensation) -{ - if (!compensation) { - IWL_ERR(priv, "undefined blink compensation: " - "use pre-defined blinking time\n"); - return time; - } - - return (u8)((time * compensation) >> 6); -} - -static int iwl_send_led_cmd(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd) -{ - struct iwl_host_cmd cmd = { - .id = REPLY_LEDS_CMD, - .len = { sizeof(struct iwl_led_cmd), }, - .data = { led_cmd, }, - .flags = CMD_ASYNC, - }; - u32 reg; - - reg = iwl_read32(priv->trans, CSR_LED_REG); - if (reg != (reg & CSR_LED_BSM_CTRL_MSK)) - iwl_write32(priv->trans, CSR_LED_REG, - reg & CSR_LED_BSM_CTRL_MSK); - - return iwl_dvm_send_cmd(priv, &cmd); -} - -/* Set led pattern command */ -static int iwl_led_cmd(struct iwl_priv *priv, - unsigned long on, - unsigned long off) -{ - struct iwl_led_cmd led_cmd = { - .id = IWL_LED_LINK, - .interval = IWL_DEF_LED_INTRVL - }; - int ret; - - if (!test_bit(STATUS_READY, &priv->status)) - return -EBUSY; - - if (priv->blink_on == on && priv->blink_off == off) - return 0; - - if (off == 0) { - /* led is SOLID_ON */ - on = IWL_LED_SOLID; - } - - IWL_DEBUG_LED(priv, "Led blink time compensation=%u\n", - priv->cfg->base_params->led_compensation); - led_cmd.on = iwl_blink_compensation(priv, on, - priv->cfg->base_params->led_compensation); - led_cmd.off = iwl_blink_compensation(priv, off, - priv->cfg->base_params->led_compensation); - - ret = iwl_send_led_cmd(priv, &led_cmd); - if (!ret) { - priv->blink_on = on; - priv->blink_off = off; - } - return ret; -} - -static void iwl_led_brightness_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct iwl_priv *priv = container_of(led_cdev, struct iwl_priv, led); - unsigned long on = 0; - - if (brightness > 0) - on = IWL_LED_SOLID; - - iwl_led_cmd(priv, on, 0); -} - -static int iwl_led_blink_set(struct led_classdev *led_cdev, - unsigned long *delay_on, - unsigned long *delay_off) -{ - struct iwl_priv *priv = container_of(led_cdev, struct iwl_priv, led); - - return iwl_led_cmd(priv, *delay_on, *delay_off); -} - -void iwl_leds_init(struct iwl_priv *priv) -{ - int mode = iwlwifi_mod_params.led_mode; - int ret; - - if (mode == IWL_LED_DISABLE) { - IWL_INFO(priv, "Led disabled\n"); - return; - } - if (mode == IWL_LED_DEFAULT) - mode = priv->cfg->led_mode; - - priv->led.name = kasprintf(GFP_KERNEL, "%s-led", - wiphy_name(priv->hw->wiphy)); - priv->led.brightness_set = iwl_led_brightness_set; - priv->led.blink_set = iwl_led_blink_set; - priv->led.max_brightness = 1; - - switch (mode) { - case IWL_LED_DEFAULT: - WARN_ON(1); - break; - case IWL_LED_BLINK: - priv->led.default_trigger = - ieee80211_create_tpt_led_trigger(priv->hw, - IEEE80211_TPT_LEDTRIG_FL_CONNECTED, - iwl_blink, ARRAY_SIZE(iwl_blink)); - break; - case IWL_LED_RF_STATE: - priv->led.default_trigger = - ieee80211_get_radio_led_name(priv->hw); - break; - } - - ret = led_classdev_register(priv->trans->dev, &priv->led); - if (ret) { - kfree(priv->led.name); - return; - } - - priv->led_registered = true; -} - -void iwl_leds_exit(struct iwl_priv *priv) -{ - if (!priv->led_registered) - return; - - led_classdev_unregister(&priv->led); - kfree(priv->led.name); -} diff --git a/drivers/net/wireless/iwlwifi/dvm/led.h b/drivers/net/wireless/iwlwifi/dvm/led.h deleted file mode 100644 index 8749dcfe695f..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/led.h +++ /dev/null @@ -1,43 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#ifndef __iwl_leds_h__ -#define __iwl_leds_h__ - - -struct iwl_priv; - -#define IWL_LED_SOLID 11 -#define IWL_DEF_LED_INTRVL cpu_to_le32(1000) - -#define IWL_LED_ACTIVITY (0<<1) -#define IWL_LED_LINK (1<<1) - -void iwlagn_led_enable(struct iwl_priv *priv); -void iwl_leds_init(struct iwl_priv *priv); -void iwl_leds_exit(struct iwl_priv *priv); - -#endif /* __iwl_leds_h__ */ diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c deleted file mode 100644 index 54f553380aa8..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/lib.c +++ /dev/null @@ -1,1311 +0,0 @@ -/****************************************************************************** - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ -#include -#include -#include -#include -#include -#include - -#include "iwl-io.h" -#include "iwl-agn-hw.h" -#include "iwl-trans.h" -#include "iwl-modparams.h" - -#include "dev.h" -#include "agn.h" - -int iwlagn_hw_valid_rtc_data_addr(u32 addr) -{ - return (addr >= IWLAGN_RTC_DATA_LOWER_BOUND) && - (addr < IWLAGN_RTC_DATA_UPPER_BOUND); -} - -int iwlagn_send_tx_power(struct iwl_priv *priv) -{ - struct iwlagn_tx_power_dbm_cmd tx_power_cmd; - u8 tx_ant_cfg_cmd; - - if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->status), - "TX Power requested while scanning!\n")) - return -EAGAIN; - - /* half dBm need to multiply */ - tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt); - - if (tx_power_cmd.global_lmt > priv->nvm_data->max_tx_pwr_half_dbm) { - /* - * For the newer devices which using enhanced/extend tx power - * table in EEPROM, the format is in half dBm. driver need to - * convert to dBm format before report to mac80211. - * By doing so, there is a possibility of 1/2 dBm resolution - * lost. driver will perform "round-up" operation before - * reporting, but it will cause 1/2 dBm tx power over the - * regulatory limit. Perform the checking here, if the - * "tx_power_user_lmt" is higher than EEPROM value (in - * half-dBm format), lower the tx power based on EEPROM - */ - tx_power_cmd.global_lmt = - priv->nvm_data->max_tx_pwr_half_dbm; - } - tx_power_cmd.flags = IWLAGN_TX_POWER_NO_CLOSED; - tx_power_cmd.srv_chan_lmt = IWLAGN_TX_POWER_AUTO; - - if (IWL_UCODE_API(priv->fw->ucode_ver) == 1) - tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD_V1; - else - tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD; - - return iwl_dvm_send_cmd_pdu(priv, tx_ant_cfg_cmd, CMD_SYNC, - sizeof(tx_power_cmd), &tx_power_cmd); -} - -void iwlagn_temperature(struct iwl_priv *priv) -{ - lockdep_assert_held(&priv->statistics.lock); - - /* store temperature from correct statistics (in Celsius) */ - priv->temperature = le32_to_cpu(priv->statistics.common.temperature); - iwl_tt_handler(priv); -} - -int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band) -{ - int idx = 0; - int band_offset = 0; - - /* HT rate format: mac80211 wants an MCS number, which is just LSB */ - if (rate_n_flags & RATE_MCS_HT_MSK) { - idx = (rate_n_flags & 0xff); - return idx; - /* Legacy rate format, search for match in table */ - } else { - if (band == IEEE80211_BAND_5GHZ) - band_offset = IWL_FIRST_OFDM_RATE; - for (idx = band_offset; idx < IWL_RATE_COUNT_LEGACY; idx++) - if (iwl_rates[idx].plcp == (rate_n_flags & 0xFF)) - return idx - band_offset; - } - - return -1; -} - -int iwlagn_manage_ibss_station(struct iwl_priv *priv, - struct ieee80211_vif *vif, bool add) -{ - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; - - if (add) - return iwlagn_add_bssid_station(priv, vif_priv->ctx, - vif->bss_conf.bssid, - &vif_priv->ibss_bssid_sta_id); - return iwl_remove_station(priv, vif_priv->ibss_bssid_sta_id, - vif->bss_conf.bssid); -} - -/** - * iwlagn_txfifo_flush: send REPLY_TXFIFO_FLUSH command to uCode - * - * pre-requirements: - * 1. acquire mutex before calling - * 2. make sure rf is on and not in exit state - */ -int iwlagn_txfifo_flush(struct iwl_priv *priv, u32 scd_q_msk) -{ - struct iwl_txfifo_flush_cmd flush_cmd; - struct iwl_host_cmd cmd = { - .id = REPLY_TXFIFO_FLUSH, - .len = { sizeof(struct iwl_txfifo_flush_cmd), }, - .flags = CMD_SYNC, - .data = { &flush_cmd, }, - }; - - memset(&flush_cmd, 0, sizeof(flush_cmd)); - - flush_cmd.queue_control = IWL_SCD_VO_MSK | IWL_SCD_VI_MSK | - IWL_SCD_BE_MSK | IWL_SCD_BK_MSK | - IWL_SCD_MGMT_MSK; - if ((priv->valid_contexts != BIT(IWL_RXON_CTX_BSS))) - flush_cmd.queue_control |= IWL_PAN_SCD_VO_MSK | - IWL_PAN_SCD_VI_MSK | - IWL_PAN_SCD_BE_MSK | - IWL_PAN_SCD_BK_MSK | - IWL_PAN_SCD_MGMT_MSK | - IWL_PAN_SCD_MULTICAST_MSK; - - if (priv->nvm_data->sku_cap_11n_enable) - flush_cmd.queue_control |= IWL_AGG_TX_QUEUE_MSK; - - if (scd_q_msk) - flush_cmd.queue_control = cpu_to_le32(scd_q_msk); - - IWL_DEBUG_INFO(priv, "queue control: 0x%x\n", - flush_cmd.queue_control); - flush_cmd.flush_control = cpu_to_le16(IWL_DROP_ALL); - - return iwl_dvm_send_cmd(priv, &cmd); -} - -void iwlagn_dev_txfifo_flush(struct iwl_priv *priv) -{ - mutex_lock(&priv->mutex); - ieee80211_stop_queues(priv->hw); - if (iwlagn_txfifo_flush(priv, 0)) { - IWL_ERR(priv, "flush request fail\n"); - goto done; - } - IWL_DEBUG_INFO(priv, "wait transmit/flush all frames\n"); - iwl_trans_wait_tx_queue_empty(priv->trans); -done: - ieee80211_wake_queues(priv->hw); - mutex_unlock(&priv->mutex); -} - -/* - * BT coex - */ -/* Notmal TDM */ -static const __le32 iwlagn_def_3w_lookup[IWLAGN_BT_DECISION_LUT_SIZE] = { - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaeaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xcc00ff28), - cpu_to_le32(0x0000aaaa), - cpu_to_le32(0xcc00aaaa), - cpu_to_le32(0x0000aaaa), - cpu_to_le32(0xc0004000), - cpu_to_le32(0x00004000), - cpu_to_le32(0xf0005000), - cpu_to_le32(0xf0005000), -}; - - -/* Loose Coex */ -static const __le32 iwlagn_loose_lookup[IWLAGN_BT_DECISION_LUT_SIZE] = { - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaeaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xcc00ff28), - cpu_to_le32(0x0000aaaa), - cpu_to_le32(0xcc00aaaa), - cpu_to_le32(0x0000aaaa), - cpu_to_le32(0x00000000), - cpu_to_le32(0x00000000), - cpu_to_le32(0xf0005000), - cpu_to_le32(0xf0005000), -}; - -/* Full concurrency */ -static const __le32 iwlagn_concurrent_lookup[IWLAGN_BT_DECISION_LUT_SIZE] = { - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0x00000000), - cpu_to_le32(0x00000000), - cpu_to_le32(0x00000000), - cpu_to_le32(0x00000000), -}; - -void iwlagn_send_advance_bt_config(struct iwl_priv *priv) -{ - struct iwl_basic_bt_cmd basic = { - .max_kill = IWLAGN_BT_MAX_KILL_DEFAULT, - .bt3_timer_t7_value = IWLAGN_BT3_T7_DEFAULT, - .bt3_prio_sample_time = IWLAGN_BT3_PRIO_SAMPLE_DEFAULT, - .bt3_timer_t2_value = IWLAGN_BT3_T2_DEFAULT, - }; - struct iwl_bt_cmd_v1 bt_cmd_v1; - struct iwl_bt_cmd_v2 bt_cmd_v2; - int ret; - - BUILD_BUG_ON(sizeof(iwlagn_def_3w_lookup) != - sizeof(basic.bt3_lookup_table)); - - if (priv->cfg->bt_params) { - /* - * newer generation of devices (2000 series and newer) - * use the version 2 of the bt command - * we need to make sure sending the host command - * with correct data structure to avoid uCode assert - */ - if (priv->cfg->bt_params->bt_session_2) { - bt_cmd_v2.prio_boost = cpu_to_le32( - priv->cfg->bt_params->bt_prio_boost); - bt_cmd_v2.tx_prio_boost = 0; - bt_cmd_v2.rx_prio_boost = 0; - } else { - /* older version only has 8 bits */ - WARN_ON(priv->cfg->bt_params->bt_prio_boost & ~0xFF); - bt_cmd_v1.prio_boost = - priv->cfg->bt_params->bt_prio_boost; - bt_cmd_v1.tx_prio_boost = 0; - bt_cmd_v1.rx_prio_boost = 0; - } - } else { - IWL_ERR(priv, "failed to construct BT Coex Config\n"); - return; - } - - /* - * Possible situations when BT needs to take over for receive, - * at the same time where STA needs to response to AP's frame(s), - * reduce the tx power of the required response frames, by that, - * allow the concurrent BT receive & WiFi transmit - * (BT - ANT A, WiFi -ANT B), without interference to one another - * - * Reduced tx power apply to control frames only (ACK/Back/CTS) - * when indicated by the BT config command - */ - basic.kill_ack_mask = priv->kill_ack_mask; - basic.kill_cts_mask = priv->kill_cts_mask; - if (priv->reduced_txpower) - basic.reduce_txpower = IWLAGN_BT_REDUCED_TX_PWR; - basic.valid = priv->bt_valid; - - /* - * Configure BT coex mode to "no coexistence" when the - * user disabled BT coexistence, we have no interface - * (might be in monitor mode), or the interface is in - * IBSS mode (no proper uCode support for coex then). - */ - if (!iwlwifi_mod_params.bt_coex_active || - priv->iw_mode == NL80211_IFTYPE_ADHOC) { - basic.flags = IWLAGN_BT_FLAG_COEX_MODE_DISABLED; - } else { - basic.flags = IWLAGN_BT_FLAG_COEX_MODE_3W << - IWLAGN_BT_FLAG_COEX_MODE_SHIFT; - - if (!priv->bt_enable_pspoll) - basic.flags |= IWLAGN_BT_FLAG_SYNC_2_BT_DISABLE; - else - basic.flags &= ~IWLAGN_BT_FLAG_SYNC_2_BT_DISABLE; - - if (priv->bt_ch_announce) - basic.flags |= IWLAGN_BT_FLAG_CHANNEL_INHIBITION; - IWL_DEBUG_COEX(priv, "BT coex flag: 0X%x\n", basic.flags); - } - priv->bt_enable_flag = basic.flags; - if (priv->bt_full_concurrent) - memcpy(basic.bt3_lookup_table, iwlagn_concurrent_lookup, - sizeof(iwlagn_concurrent_lookup)); - else - memcpy(basic.bt3_lookup_table, iwlagn_def_3w_lookup, - sizeof(iwlagn_def_3w_lookup)); - - IWL_DEBUG_COEX(priv, "BT coex %s in %s mode\n", - basic.flags ? "active" : "disabled", - priv->bt_full_concurrent ? - "full concurrency" : "3-wire"); - - if (priv->cfg->bt_params->bt_session_2) { - memcpy(&bt_cmd_v2.basic, &basic, - sizeof(basic)); - ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, - CMD_SYNC, sizeof(bt_cmd_v2), &bt_cmd_v2); - } else { - memcpy(&bt_cmd_v1.basic, &basic, - sizeof(basic)); - ret = iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, - CMD_SYNC, sizeof(bt_cmd_v1), &bt_cmd_v1); - } - if (ret) - IWL_ERR(priv, "failed to send BT Coex Config\n"); - -} - -void iwlagn_bt_adjust_rssi_monitor(struct iwl_priv *priv, bool rssi_ena) -{ - struct iwl_rxon_context *ctx, *found_ctx = NULL; - bool found_ap = false; - - lockdep_assert_held(&priv->mutex); - - /* Check whether AP or GO mode is active. */ - if (rssi_ena) { - for_each_context(priv, ctx) { - if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_AP && - iwl_is_associated_ctx(ctx)) { - found_ap = true; - break; - } - } - } - - /* - * If disable was received or If GO/AP mode, disable RSSI - * measurements. - */ - if (!rssi_ena || found_ap) { - if (priv->cur_rssi_ctx) { - ctx = priv->cur_rssi_ctx; - ieee80211_disable_rssi_reports(ctx->vif); - priv->cur_rssi_ctx = NULL; - } - return; - } - - /* - * If rssi measurements need to be enabled, consider all cases now. - * Figure out how many contexts are active. - */ - for_each_context(priv, ctx) { - if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION && - iwl_is_associated_ctx(ctx)) { - found_ctx = ctx; - break; - } - } - - /* - * rssi monitor already enabled for the correct interface...nothing - * to do. - */ - if (found_ctx == priv->cur_rssi_ctx) - return; - - /* - * Figure out if rssi monitor is currently enabled, and needs - * to be changed. If rssi monitor is already enabled, disable - * it first else just enable rssi measurements on the - * interface found above. - */ - if (priv->cur_rssi_ctx) { - ctx = priv->cur_rssi_ctx; - if (ctx->vif) - ieee80211_disable_rssi_reports(ctx->vif); - } - - priv->cur_rssi_ctx = found_ctx; - - if (!found_ctx) - return; - - ieee80211_enable_rssi_reports(found_ctx->vif, - IWLAGN_BT_PSP_MIN_RSSI_THRESHOLD, - IWLAGN_BT_PSP_MAX_RSSI_THRESHOLD); -} - -static bool iwlagn_bt_traffic_is_sco(struct iwl_bt_uart_msg *uart_msg) -{ - return BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3 >> - BT_UART_MSG_FRAME3SCOESCO_POS; -} - -static void iwlagn_bt_traffic_change_work(struct work_struct *work) -{ - struct iwl_priv *priv = - container_of(work, struct iwl_priv, bt_traffic_change_work); - struct iwl_rxon_context *ctx; - int smps_request = -1; - - if (priv->bt_enable_flag == IWLAGN_BT_FLAG_COEX_MODE_DISABLED) { - /* bt coex disabled */ - return; - } - - /* - * Note: bt_traffic_load can be overridden by scan complete and - * coex profile notifications. Ignore that since only bad consequence - * can be not matching debug print with actual state. - */ - IWL_DEBUG_COEX(priv, "BT traffic load changes: %d\n", - priv->bt_traffic_load); - - switch (priv->bt_traffic_load) { - case IWL_BT_COEX_TRAFFIC_LOAD_NONE: - if (priv->bt_status) - smps_request = IEEE80211_SMPS_DYNAMIC; - else - smps_request = IEEE80211_SMPS_AUTOMATIC; - break; - case IWL_BT_COEX_TRAFFIC_LOAD_LOW: - smps_request = IEEE80211_SMPS_DYNAMIC; - break; - case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: - case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: - smps_request = IEEE80211_SMPS_STATIC; - break; - default: - IWL_ERR(priv, "Invalid BT traffic load: %d\n", - priv->bt_traffic_load); - break; - } - - mutex_lock(&priv->mutex); - - /* - * We can not send command to firmware while scanning. When the scan - * complete we will schedule this work again. We do check with mutex - * locked to prevent new scan request to arrive. We do not check - * STATUS_SCANNING to avoid race when queue_work two times from - * different notifications, but quit and not perform any work at all. - */ - if (test_bit(STATUS_SCAN_HW, &priv->status)) - goto out; - - iwl_update_chain_flags(priv); - - if (smps_request != -1) { - priv->current_ht_config.smps = smps_request; - for_each_context(priv, ctx) { - if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION) - ieee80211_request_smps(ctx->vif, smps_request); - } - } - - /* - * Dynamic PS poll related functionality. Adjust RSSI measurements if - * necessary. - */ - iwlagn_bt_coex_rssi_monitor(priv); -out: - mutex_unlock(&priv->mutex); -} - -/* - * If BT sco traffic, and RSSI monitor is enabled, move measurements to the - * correct interface or disable it if this is the last interface to be - * removed. - */ -void iwlagn_bt_coex_rssi_monitor(struct iwl_priv *priv) -{ - if (priv->bt_is_sco && - priv->bt_traffic_load == IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS) - iwlagn_bt_adjust_rssi_monitor(priv, true); - else - iwlagn_bt_adjust_rssi_monitor(priv, false); -} - -static void iwlagn_print_uartmsg(struct iwl_priv *priv, - struct iwl_bt_uart_msg *uart_msg) -{ - IWL_DEBUG_COEX(priv, "Message Type = 0x%X, SSN = 0x%X, " - "Update Req = 0x%X\n", - (BT_UART_MSG_FRAME1MSGTYPE_MSK & uart_msg->frame1) >> - BT_UART_MSG_FRAME1MSGTYPE_POS, - (BT_UART_MSG_FRAME1SSN_MSK & uart_msg->frame1) >> - BT_UART_MSG_FRAME1SSN_POS, - (BT_UART_MSG_FRAME1UPDATEREQ_MSK & uart_msg->frame1) >> - BT_UART_MSG_FRAME1UPDATEREQ_POS); - - IWL_DEBUG_COEX(priv, "Open connections = 0x%X, Traffic load = 0x%X, " - "Chl_SeqN = 0x%X, In band = 0x%X\n", - (BT_UART_MSG_FRAME2OPENCONNECTIONS_MSK & uart_msg->frame2) >> - BT_UART_MSG_FRAME2OPENCONNECTIONS_POS, - (BT_UART_MSG_FRAME2TRAFFICLOAD_MSK & uart_msg->frame2) >> - BT_UART_MSG_FRAME2TRAFFICLOAD_POS, - (BT_UART_MSG_FRAME2CHLSEQN_MSK & uart_msg->frame2) >> - BT_UART_MSG_FRAME2CHLSEQN_POS, - (BT_UART_MSG_FRAME2INBAND_MSK & uart_msg->frame2) >> - BT_UART_MSG_FRAME2INBAND_POS); - - IWL_DEBUG_COEX(priv, "SCO/eSCO = 0x%X, Sniff = 0x%X, A2DP = 0x%X, " - "ACL = 0x%X, Master = 0x%X, OBEX = 0x%X\n", - (BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3) >> - BT_UART_MSG_FRAME3SCOESCO_POS, - (BT_UART_MSG_FRAME3SNIFF_MSK & uart_msg->frame3) >> - BT_UART_MSG_FRAME3SNIFF_POS, - (BT_UART_MSG_FRAME3A2DP_MSK & uart_msg->frame3) >> - BT_UART_MSG_FRAME3A2DP_POS, - (BT_UART_MSG_FRAME3ACL_MSK & uart_msg->frame3) >> - BT_UART_MSG_FRAME3ACL_POS, - (BT_UART_MSG_FRAME3MASTER_MSK & uart_msg->frame3) >> - BT_UART_MSG_FRAME3MASTER_POS, - (BT_UART_MSG_FRAME3OBEX_MSK & uart_msg->frame3) >> - BT_UART_MSG_FRAME3OBEX_POS); - - IWL_DEBUG_COEX(priv, "Idle duration = 0x%X\n", - (BT_UART_MSG_FRAME4IDLEDURATION_MSK & uart_msg->frame4) >> - BT_UART_MSG_FRAME4IDLEDURATION_POS); - - IWL_DEBUG_COEX(priv, "Tx Activity = 0x%X, Rx Activity = 0x%X, " - "eSCO Retransmissions = 0x%X\n", - (BT_UART_MSG_FRAME5TXACTIVITY_MSK & uart_msg->frame5) >> - BT_UART_MSG_FRAME5TXACTIVITY_POS, - (BT_UART_MSG_FRAME5RXACTIVITY_MSK & uart_msg->frame5) >> - BT_UART_MSG_FRAME5RXACTIVITY_POS, - (BT_UART_MSG_FRAME5ESCORETRANSMIT_MSK & uart_msg->frame5) >> - BT_UART_MSG_FRAME5ESCORETRANSMIT_POS); - - IWL_DEBUG_COEX(priv, "Sniff Interval = 0x%X, Discoverable = 0x%X\n", - (BT_UART_MSG_FRAME6SNIFFINTERVAL_MSK & uart_msg->frame6) >> - BT_UART_MSG_FRAME6SNIFFINTERVAL_POS, - (BT_UART_MSG_FRAME6DISCOVERABLE_MSK & uart_msg->frame6) >> - BT_UART_MSG_FRAME6DISCOVERABLE_POS); - - IWL_DEBUG_COEX(priv, "Sniff Activity = 0x%X, Page = " - "0x%X, Inquiry = 0x%X, Connectable = 0x%X\n", - (BT_UART_MSG_FRAME7SNIFFACTIVITY_MSK & uart_msg->frame7) >> - BT_UART_MSG_FRAME7SNIFFACTIVITY_POS, - (BT_UART_MSG_FRAME7PAGE_MSK & uart_msg->frame7) >> - BT_UART_MSG_FRAME7PAGE_POS, - (BT_UART_MSG_FRAME7INQUIRY_MSK & uart_msg->frame7) >> - BT_UART_MSG_FRAME7INQUIRY_POS, - (BT_UART_MSG_FRAME7CONNECTABLE_MSK & uart_msg->frame7) >> - BT_UART_MSG_FRAME7CONNECTABLE_POS); -} - -static bool iwlagn_set_kill_msk(struct iwl_priv *priv, - struct iwl_bt_uart_msg *uart_msg) -{ - bool need_update = false; - u8 kill_msk = IWL_BT_KILL_REDUCE; - static const __le32 bt_kill_ack_msg[3] = { - IWLAGN_BT_KILL_ACK_MASK_DEFAULT, - IWLAGN_BT_KILL_ACK_CTS_MASK_SCO, - IWLAGN_BT_KILL_ACK_CTS_MASK_REDUCE}; - static const __le32 bt_kill_cts_msg[3] = { - IWLAGN_BT_KILL_CTS_MASK_DEFAULT, - IWLAGN_BT_KILL_ACK_CTS_MASK_SCO, - IWLAGN_BT_KILL_ACK_CTS_MASK_REDUCE}; - - if (!priv->reduced_txpower) - kill_msk = (BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3) - ? IWL_BT_KILL_OVERRIDE : IWL_BT_KILL_DEFAULT; - if (priv->kill_ack_mask != bt_kill_ack_msg[kill_msk] || - priv->kill_cts_mask != bt_kill_cts_msg[kill_msk]) { - priv->bt_valid |= IWLAGN_BT_VALID_KILL_ACK_MASK; - priv->kill_ack_mask = bt_kill_ack_msg[kill_msk]; - priv->bt_valid |= IWLAGN_BT_VALID_KILL_CTS_MASK; - priv->kill_cts_mask = bt_kill_cts_msg[kill_msk]; - need_update = true; - } - return need_update; -} - -/* - * Upon RSSI changes, sends a bt config command with following changes - * 1. enable/disable "reduced control frames tx power - * 2. update the "kill)ack_mask" and "kill_cts_mask" - * - * If "reduced tx power" is enabled, uCode shall - * 1. ACK/Back/CTS rate shall reduced to 6Mbps - * 2. not use duplciate 20/40MHz mode - */ -static bool iwlagn_fill_txpower_mode(struct iwl_priv *priv, - struct iwl_bt_uart_msg *uart_msg) -{ - bool need_update = false; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - int ave_rssi; - - if (!ctx->vif || (ctx->vif->type != NL80211_IFTYPE_STATION)) { - IWL_DEBUG_INFO(priv, "BSS ctx not active or not in sta mode\n"); - return false; - } - - ave_rssi = ieee80211_ave_rssi(ctx->vif); - if (!ave_rssi) { - /* no rssi data, no changes to reduce tx power */ - IWL_DEBUG_COEX(priv, "no rssi data available\n"); - return need_update; - } - if (!priv->reduced_txpower && - !iwl_is_associated(priv, IWL_RXON_CTX_PAN) && - (ave_rssi > BT_ENABLE_REDUCED_TXPOWER_THRESHOLD) && - (uart_msg->frame3 & (BT_UART_MSG_FRAME3ACL_MSK | - BT_UART_MSG_FRAME3OBEX_MSK)) && - !(uart_msg->frame3 & (BT_UART_MSG_FRAME3SCOESCO_MSK | - BT_UART_MSG_FRAME3SNIFF_MSK | BT_UART_MSG_FRAME3A2DP_MSK))) { - /* enabling reduced tx power */ - priv->reduced_txpower = true; - priv->bt_valid |= IWLAGN_BT_VALID_REDUCED_TX_PWR; - need_update = true; - } else if (priv->reduced_txpower && - (iwl_is_associated(priv, IWL_RXON_CTX_PAN) || - (ave_rssi < BT_DISABLE_REDUCED_TXPOWER_THRESHOLD) || - (uart_msg->frame3 & (BT_UART_MSG_FRAME3SCOESCO_MSK | - BT_UART_MSG_FRAME3SNIFF_MSK | BT_UART_MSG_FRAME3A2DP_MSK)) || - !(uart_msg->frame3 & (BT_UART_MSG_FRAME3ACL_MSK | - BT_UART_MSG_FRAME3OBEX_MSK)))) { - /* disable reduced tx power */ - priv->reduced_txpower = false; - priv->bt_valid |= IWLAGN_BT_VALID_REDUCED_TX_PWR; - need_update = true; - } - - return need_update; -} - -int iwlagn_bt_coex_profile_notif(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_bt_coex_profile_notif *coex = (void *)pkt->data; - struct iwl_bt_uart_msg *uart_msg = &coex->last_bt_uart_msg; - - if (priv->bt_enable_flag == IWLAGN_BT_FLAG_COEX_MODE_DISABLED) { - /* bt coex disabled */ - return 0; - } - - IWL_DEBUG_COEX(priv, "BT Coex notification:\n"); - IWL_DEBUG_COEX(priv, " status: %d\n", coex->bt_status); - IWL_DEBUG_COEX(priv, " traffic load: %d\n", coex->bt_traffic_load); - IWL_DEBUG_COEX(priv, " CI compliance: %d\n", - coex->bt_ci_compliance); - iwlagn_print_uartmsg(priv, uart_msg); - - priv->last_bt_traffic_load = priv->bt_traffic_load; - priv->bt_is_sco = iwlagn_bt_traffic_is_sco(uart_msg); - - if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { - if (priv->bt_status != coex->bt_status || - priv->last_bt_traffic_load != coex->bt_traffic_load) { - if (coex->bt_status) { - /* BT on */ - if (!priv->bt_ch_announce) - priv->bt_traffic_load = - IWL_BT_COEX_TRAFFIC_LOAD_HIGH; - else - priv->bt_traffic_load = - coex->bt_traffic_load; - } else { - /* BT off */ - priv->bt_traffic_load = - IWL_BT_COEX_TRAFFIC_LOAD_NONE; - } - priv->bt_status = coex->bt_status; - queue_work(priv->workqueue, - &priv->bt_traffic_change_work); - } - } - - /* schedule to send runtime bt_config */ - /* check reduce power before change ack/cts kill mask */ - if (iwlagn_fill_txpower_mode(priv, uart_msg) || - iwlagn_set_kill_msk(priv, uart_msg)) - queue_work(priv->workqueue, &priv->bt_runtime_config); - - - /* FIXME: based on notification, adjust the prio_boost */ - - priv->bt_ci_compliance = coex->bt_ci_compliance; - return 0; -} - -void iwlagn_bt_rx_handler_setup(struct iwl_priv *priv) -{ - priv->rx_handlers[REPLY_BT_COEX_PROFILE_NOTIF] = - iwlagn_bt_coex_profile_notif; -} - -void iwlagn_bt_setup_deferred_work(struct iwl_priv *priv) -{ - INIT_WORK(&priv->bt_traffic_change_work, - iwlagn_bt_traffic_change_work); -} - -void iwlagn_bt_cancel_deferred_work(struct iwl_priv *priv) -{ - cancel_work_sync(&priv->bt_traffic_change_work); -} - -static bool is_single_rx_stream(struct iwl_priv *priv) -{ - return priv->current_ht_config.smps == IEEE80211_SMPS_STATIC || - priv->current_ht_config.single_chain_sufficient; -} - -#define IWL_NUM_RX_CHAINS_MULTIPLE 3 -#define IWL_NUM_RX_CHAINS_SINGLE 2 -#define IWL_NUM_IDLE_CHAINS_DUAL 2 -#define IWL_NUM_IDLE_CHAINS_SINGLE 1 - -/* - * Determine how many receiver/antenna chains to use. - * - * More provides better reception via diversity. Fewer saves power - * at the expense of throughput, but only when not in powersave to - * start with. - * - * MIMO (dual stream) requires at least 2, but works better with 3. - * This does not determine *which* chains to use, just how many. - */ -static int iwl_get_active_rx_chain_count(struct iwl_priv *priv) -{ - if (priv->cfg->bt_params && - priv->cfg->bt_params->advanced_bt_coexist && - (priv->bt_full_concurrent || - priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) { - /* - * only use chain 'A' in bt high traffic load or - * full concurrency mode - */ - return IWL_NUM_RX_CHAINS_SINGLE; - } - /* # of Rx chains to use when expecting MIMO. */ - if (is_single_rx_stream(priv)) - return IWL_NUM_RX_CHAINS_SINGLE; - else - return IWL_NUM_RX_CHAINS_MULTIPLE; -} - -/* - * When we are in power saving mode, unless device support spatial - * multiplexing power save, use the active count for rx chain count. - */ -static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt) -{ - /* # Rx chains when idling, depending on SMPS mode */ - switch (priv->current_ht_config.smps) { - case IEEE80211_SMPS_STATIC: - case IEEE80211_SMPS_DYNAMIC: - return IWL_NUM_IDLE_CHAINS_SINGLE; - case IEEE80211_SMPS_AUTOMATIC: - case IEEE80211_SMPS_OFF: - return active_cnt; - default: - WARN(1, "invalid SMPS mode %d", - priv->current_ht_config.smps); - return active_cnt; - } -} - -/* up to 4 chains */ -static u8 iwl_count_chain_bitmap(u32 chain_bitmap) -{ - u8 res; - res = (chain_bitmap & BIT(0)) >> 0; - res += (chain_bitmap & BIT(1)) >> 1; - res += (chain_bitmap & BIT(2)) >> 2; - res += (chain_bitmap & BIT(3)) >> 3; - return res; -} - -/** - * iwlagn_set_rxon_chain - Set up Rx chain usage in "staging" RXON image - * - * Selects how many and which Rx receivers/antennas/chains to use. - * This should not be used for scan command ... it puts data in wrong place. - */ -void iwlagn_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx) -{ - bool is_single = is_single_rx_stream(priv); - bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); - u8 idle_rx_cnt, active_rx_cnt, valid_rx_cnt; - u32 active_chains; - u16 rx_chain; - - /* Tell uCode which antennas are actually connected. - * Before first association, we assume all antennas are connected. - * Just after first association, iwl_chain_noise_calibration() - * checks which antennas actually *are* connected. */ - if (priv->chain_noise_data.active_chains) - active_chains = priv->chain_noise_data.active_chains; - else - active_chains = priv->nvm_data->valid_rx_ant; - - if (priv->cfg->bt_params && - priv->cfg->bt_params->advanced_bt_coexist && - (priv->bt_full_concurrent || - priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) { - /* - * only use chain 'A' in bt high traffic load or - * full concurrency mode - */ - active_chains = first_antenna(active_chains); - } - - rx_chain = active_chains << RXON_RX_CHAIN_VALID_POS; - - /* How many receivers should we use? */ - active_rx_cnt = iwl_get_active_rx_chain_count(priv); - idle_rx_cnt = iwl_get_idle_rx_chain_count(priv, active_rx_cnt); - - - /* correct rx chain count according hw settings - * and chain noise calibration - */ - valid_rx_cnt = iwl_count_chain_bitmap(active_chains); - if (valid_rx_cnt < active_rx_cnt) - active_rx_cnt = valid_rx_cnt; - - if (valid_rx_cnt < idle_rx_cnt) - idle_rx_cnt = valid_rx_cnt; - - rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS; - rx_chain |= idle_rx_cnt << RXON_RX_CHAIN_CNT_POS; - - ctx->staging.rx_chain = cpu_to_le16(rx_chain); - - if (!is_single && (active_rx_cnt >= IWL_NUM_RX_CHAINS_SINGLE) && is_cam) - ctx->staging.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; - else - ctx->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; - - IWL_DEBUG_ASSOC(priv, "rx_chain=0x%X active=%d idle=%d\n", - ctx->staging.rx_chain, - active_rx_cnt, idle_rx_cnt); - - WARN_ON(active_rx_cnt == 0 || idle_rx_cnt == 0 || - active_rx_cnt < idle_rx_cnt); -} - -u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant, u8 valid) -{ - int i; - u8 ind = ant; - - if (priv->band == IEEE80211_BAND_2GHZ && - priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH) - return 0; - - for (i = 0; i < RATE_ANT_NUM - 1; i++) { - ind = (ind + 1) < RATE_ANT_NUM ? ind + 1 : 0; - if (valid & BIT(ind)) - return ind; - } - return ant; -} - -#ifdef CONFIG_PM_SLEEP -static void iwlagn_convert_p1k(u16 *p1k, __le16 *out) -{ - int i; - - for (i = 0; i < IWLAGN_P1K_SIZE; i++) - out[i] = cpu_to_le16(p1k[i]); -} - -struct wowlan_key_data { - struct iwl_rxon_context *ctx; - struct iwlagn_wowlan_rsc_tsc_params_cmd *rsc_tsc; - struct iwlagn_wowlan_tkip_params_cmd *tkip; - const u8 *bssid; - bool error, use_rsc_tsc, use_tkip; -}; - - -static void iwlagn_wowlan_program_keys(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key, - void *_data) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct wowlan_key_data *data = _data; - struct iwl_rxon_context *ctx = data->ctx; - struct aes_sc *aes_sc, *aes_tx_sc = NULL; - struct tkip_sc *tkip_sc, *tkip_tx_sc = NULL; - struct iwlagn_p1k_cache *rx_p1ks; - u8 *rx_mic_key; - struct ieee80211_key_seq seq; - u32 cur_rx_iv32 = 0; - u16 p1k[IWLAGN_P1K_SIZE]; - int ret, i; - - mutex_lock(&priv->mutex); - - if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 || - key->cipher == WLAN_CIPHER_SUITE_WEP104) && - !sta && !ctx->key_mapping_keys) - ret = iwl_set_default_wep_key(priv, ctx, key); - else - ret = iwl_set_dynamic_key(priv, ctx, key, sta); - - if (ret) { - IWL_ERR(priv, "Error setting key during suspend!\n"); - data->error = true; - } - - switch (key->cipher) { - case WLAN_CIPHER_SUITE_TKIP: - if (sta) { - tkip_sc = data->rsc_tsc->all_tsc_rsc.tkip.unicast_rsc; - tkip_tx_sc = &data->rsc_tsc->all_tsc_rsc.tkip.tsc; - - rx_p1ks = data->tkip->rx_uni; - - ieee80211_get_key_tx_seq(key, &seq); - tkip_tx_sc->iv16 = cpu_to_le16(seq.tkip.iv16); - tkip_tx_sc->iv32 = cpu_to_le32(seq.tkip.iv32); - - ieee80211_get_tkip_p1k_iv(key, seq.tkip.iv32, p1k); - iwlagn_convert_p1k(p1k, data->tkip->tx.p1k); - - memcpy(data->tkip->mic_keys.tx, - &key->key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY], - IWLAGN_MIC_KEY_SIZE); - - rx_mic_key = data->tkip->mic_keys.rx_unicast; - } else { - tkip_sc = - data->rsc_tsc->all_tsc_rsc.tkip.multicast_rsc; - rx_p1ks = data->tkip->rx_multi; - rx_mic_key = data->tkip->mic_keys.rx_mcast; - } - - /* - * For non-QoS this relies on the fact that both the uCode and - * mac80211 use TID 0 (as they need to to avoid replay attacks) - * for checking the IV in the frames. - */ - for (i = 0; i < IWLAGN_NUM_RSC; i++) { - ieee80211_get_key_rx_seq(key, i, &seq); - tkip_sc[i].iv16 = cpu_to_le16(seq.tkip.iv16); - tkip_sc[i].iv32 = cpu_to_le32(seq.tkip.iv32); - /* wrapping isn't allowed, AP must rekey */ - if (seq.tkip.iv32 > cur_rx_iv32) - cur_rx_iv32 = seq.tkip.iv32; - } - - ieee80211_get_tkip_rx_p1k(key, data->bssid, cur_rx_iv32, p1k); - iwlagn_convert_p1k(p1k, rx_p1ks[0].p1k); - ieee80211_get_tkip_rx_p1k(key, data->bssid, - cur_rx_iv32 + 1, p1k); - iwlagn_convert_p1k(p1k, rx_p1ks[1].p1k); - - memcpy(rx_mic_key, - &key->key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY], - IWLAGN_MIC_KEY_SIZE); - - data->use_tkip = true; - data->use_rsc_tsc = true; - break; - case WLAN_CIPHER_SUITE_CCMP: - if (sta) { - u8 *pn = seq.ccmp.pn; - - aes_sc = data->rsc_tsc->all_tsc_rsc.aes.unicast_rsc; - aes_tx_sc = &data->rsc_tsc->all_tsc_rsc.aes.tsc; - - ieee80211_get_key_tx_seq(key, &seq); - aes_tx_sc->pn = cpu_to_le64( - (u64)pn[5] | - ((u64)pn[4] << 8) | - ((u64)pn[3] << 16) | - ((u64)pn[2] << 24) | - ((u64)pn[1] << 32) | - ((u64)pn[0] << 40)); - } else - aes_sc = data->rsc_tsc->all_tsc_rsc.aes.multicast_rsc; - - /* - * For non-QoS this relies on the fact that both the uCode and - * mac80211 use TID 0 for checking the IV in the frames. - */ - for (i = 0; i < IWLAGN_NUM_RSC; i++) { - u8 *pn = seq.ccmp.pn; - - ieee80211_get_key_rx_seq(key, i, &seq); - aes_sc->pn = cpu_to_le64( - (u64)pn[5] | - ((u64)pn[4] << 8) | - ((u64)pn[3] << 16) | - ((u64)pn[2] << 24) | - ((u64)pn[1] << 32) | - ((u64)pn[0] << 40)); - } - data->use_rsc_tsc = true; - break; - } - - mutex_unlock(&priv->mutex); -} - -int iwlagn_send_patterns(struct iwl_priv *priv, - struct cfg80211_wowlan *wowlan) -{ - struct iwlagn_wowlan_patterns_cmd *pattern_cmd; - struct iwl_host_cmd cmd = { - .id = REPLY_WOWLAN_PATTERNS, - .dataflags[0] = IWL_HCMD_DFL_NOCOPY, - .flags = CMD_SYNC, - }; - int i, err; - - if (!wowlan->n_patterns) - return 0; - - cmd.len[0] = sizeof(*pattern_cmd) + - wowlan->n_patterns * sizeof(struct iwlagn_wowlan_pattern); - - pattern_cmd = kmalloc(cmd.len[0], GFP_KERNEL); - if (!pattern_cmd) - return -ENOMEM; - - pattern_cmd->n_patterns = cpu_to_le32(wowlan->n_patterns); - - for (i = 0; i < wowlan->n_patterns; i++) { - int mask_len = DIV_ROUND_UP(wowlan->patterns[i].pattern_len, 8); - - memcpy(&pattern_cmd->patterns[i].mask, - wowlan->patterns[i].mask, mask_len); - memcpy(&pattern_cmd->patterns[i].pattern, - wowlan->patterns[i].pattern, - wowlan->patterns[i].pattern_len); - pattern_cmd->patterns[i].mask_size = mask_len; - pattern_cmd->patterns[i].pattern_size = - wowlan->patterns[i].pattern_len; - } - - cmd.data[0] = pattern_cmd; - err = iwl_dvm_send_cmd(priv, &cmd); - kfree(pattern_cmd); - return err; -} - -int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan) -{ - struct iwlagn_wowlan_wakeup_filter_cmd wakeup_filter_cmd; - struct iwl_rxon_cmd rxon; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - struct iwlagn_wowlan_kek_kck_material_cmd kek_kck_cmd; - struct iwlagn_wowlan_tkip_params_cmd tkip_cmd = {}; - struct iwlagn_d3_config_cmd d3_cfg_cmd = { - /* - * Program the minimum sleep time to 10 seconds, as many - * platforms have issues processing a wakeup signal while - * still being in the process of suspending. - */ - .min_sleep_time = cpu_to_le32(10 * 1000 * 1000), - }; - struct wowlan_key_data key_data = { - .ctx = ctx, - .bssid = ctx->active.bssid_addr, - .use_rsc_tsc = false, - .tkip = &tkip_cmd, - .use_tkip = false, - }; - int ret, i; - u16 seq; - - key_data.rsc_tsc = kzalloc(sizeof(*key_data.rsc_tsc), GFP_KERNEL); - if (!key_data.rsc_tsc) - return -ENOMEM; - - memset(&wakeup_filter_cmd, 0, sizeof(wakeup_filter_cmd)); - - /* - * We know the last used seqno, and the uCode expects to know that - * one, it will increment before TX. - */ - seq = le16_to_cpu(priv->last_seq_ctl) & IEEE80211_SCTL_SEQ; - wakeup_filter_cmd.non_qos_seq = cpu_to_le16(seq); - - /* - * For QoS counters, we store the one to use next, so subtract 0x10 - * since the uCode will add 0x10 before using the value. - */ - for (i = 0; i < IWL_MAX_TID_COUNT; i++) { - seq = priv->tid_data[IWL_AP_ID][i].seq_number; - seq -= 0x10; - wakeup_filter_cmd.qos_seq[i] = cpu_to_le16(seq); - } - - if (wowlan->disconnect) - wakeup_filter_cmd.enabled |= - cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_BEACON_MISS | - IWLAGN_WOWLAN_WAKEUP_LINK_CHANGE); - if (wowlan->magic_pkt) - wakeup_filter_cmd.enabled |= - cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_MAGIC_PACKET); - if (wowlan->gtk_rekey_failure) - wakeup_filter_cmd.enabled |= - cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_GTK_REKEY_FAIL); - if (wowlan->eap_identity_req) - wakeup_filter_cmd.enabled |= - cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_EAP_IDENT_REQ); - if (wowlan->four_way_handshake) - wakeup_filter_cmd.enabled |= - cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_4WAY_HANDSHAKE); - if (wowlan->n_patterns) - wakeup_filter_cmd.enabled |= - cpu_to_le32(IWLAGN_WOWLAN_WAKEUP_PATTERN_MATCH); - - if (wowlan->rfkill_release) - d3_cfg_cmd.wakeup_flags |= - cpu_to_le32(IWLAGN_D3_WAKEUP_RFKILL); - - iwl_scan_cancel_timeout(priv, 200); - - memcpy(&rxon, &ctx->active, sizeof(rxon)); - - priv->ucode_loaded = false; - iwl_trans_stop_device(priv->trans); - - priv->wowlan = true; - - ret = iwl_load_ucode_wait_alive(priv, IWL_UCODE_WOWLAN); - if (ret) - goto out; - - /* now configure WoWLAN ucode */ - ret = iwl_alive_start(priv); - if (ret) - goto out; - - memcpy(&ctx->staging, &rxon, sizeof(rxon)); - ret = iwlagn_commit_rxon(priv, ctx); - if (ret) - goto out; - - ret = iwl_power_update_mode(priv, true); - if (ret) - goto out; - - if (!iwlwifi_mod_params.sw_crypto) { - /* mark all keys clear */ - priv->ucode_key_table = 0; - ctx->key_mapping_keys = 0; - - /* - * This needs to be unlocked due to lock ordering - * constraints. Since we're in the suspend path - * that isn't really a problem though. - */ - mutex_unlock(&priv->mutex); - ieee80211_iter_keys(priv->hw, ctx->vif, - iwlagn_wowlan_program_keys, - &key_data); - mutex_lock(&priv->mutex); - if (key_data.error) { - ret = -EIO; - goto out; - } - - if (key_data.use_rsc_tsc) { - struct iwl_host_cmd rsc_tsc_cmd = { - .id = REPLY_WOWLAN_TSC_RSC_PARAMS, - .flags = CMD_SYNC, - .data[0] = key_data.rsc_tsc, - .dataflags[0] = IWL_HCMD_DFL_NOCOPY, - .len[0] = sizeof(*key_data.rsc_tsc), - }; - - ret = iwl_dvm_send_cmd(priv, &rsc_tsc_cmd); - if (ret) - goto out; - } - - if (key_data.use_tkip) { - ret = iwl_dvm_send_cmd_pdu(priv, - REPLY_WOWLAN_TKIP_PARAMS, - CMD_SYNC, sizeof(tkip_cmd), - &tkip_cmd); - if (ret) - goto out; - } - - if (priv->have_rekey_data) { - memset(&kek_kck_cmd, 0, sizeof(kek_kck_cmd)); - memcpy(kek_kck_cmd.kck, priv->kck, NL80211_KCK_LEN); - kek_kck_cmd.kck_len = cpu_to_le16(NL80211_KCK_LEN); - memcpy(kek_kck_cmd.kek, priv->kek, NL80211_KEK_LEN); - kek_kck_cmd.kek_len = cpu_to_le16(NL80211_KEK_LEN); - kek_kck_cmd.replay_ctr = priv->replay_ctr; - - ret = iwl_dvm_send_cmd_pdu(priv, - REPLY_WOWLAN_KEK_KCK_MATERIAL, - CMD_SYNC, sizeof(kek_kck_cmd), - &kek_kck_cmd); - if (ret) - goto out; - } - } - - ret = iwl_dvm_send_cmd_pdu(priv, REPLY_D3_CONFIG, CMD_SYNC, - sizeof(d3_cfg_cmd), &d3_cfg_cmd); - if (ret) - goto out; - - ret = iwl_dvm_send_cmd_pdu(priv, REPLY_WOWLAN_WAKEUP_FILTER, - CMD_SYNC, sizeof(wakeup_filter_cmd), - &wakeup_filter_cmd); - if (ret) - goto out; - - ret = iwlagn_send_patterns(priv, wowlan); - out: - kfree(key_data.rsc_tsc); - return ret; -} -#endif - -int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) -{ - if (iwl_is_rfkill(priv) || iwl_is_ctkill(priv)) { - IWL_WARN(priv, "Not sending command - %s KILL\n", - iwl_is_rfkill(priv) ? "RF" : "CT"); - return -EIO; - } - - if (test_bit(STATUS_FW_ERROR, &priv->status)) { - IWL_ERR(priv, "Command %s failed: FW Error\n", - iwl_dvm_get_cmd_string(cmd->id)); - return -EIO; - } - - /* - * This can happen upon FW ASSERT: we clear the STATUS_FW_ERROR flag - * in iwl_down but cancel the workers only later. - */ - if (!priv->ucode_loaded) { - IWL_ERR(priv, "Fw not loaded - dropping CMD: %x\n", cmd->id); - return -EIO; - } - - /* - * Synchronous commands from this op-mode must hold - * the mutex, this ensures we don't try to send two - * (or more) synchronous commands at a time. - */ - if (!(cmd->flags & CMD_ASYNC)) - lockdep_assert_held(&priv->mutex); - - if (priv->ucode_owner == IWL_OWNERSHIP_TM && - !(cmd->flags & CMD_ON_DEMAND)) { - IWL_DEBUG_HC(priv, "tm own the uCode, no regular hcmd send\n"); - return -EIO; - } - - return iwl_trans_send_cmd(priv->trans, cmd); -} - -int iwl_dvm_send_cmd_pdu(struct iwl_priv *priv, u8 id, - u32 flags, u16 len, const void *data) -{ - struct iwl_host_cmd cmd = { - .id = id, - .len = { len, }, - .data = { data, }, - .flags = flags, - }; - - return iwl_dvm_send_cmd(priv, &cmd); -} diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c deleted file mode 100644 index e04f3da1ccb3..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c +++ /dev/null @@ -1,1788 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portions of the ieee80211 subsystem header files. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include "iwl-io.h" -#include "iwl-trans.h" -#include "iwl-op-mode.h" -#include "iwl-modparams.h" - -#include "dev.h" -#include "calib.h" -#include "agn.h" - -/***************************************************************************** - * - * mac80211 entry point functions - * - *****************************************************************************/ - -static const struct ieee80211_iface_limit iwlagn_sta_ap_limits[] = { - { - .max = 1, - .types = BIT(NL80211_IFTYPE_STATION), - }, - { - .max = 1, - .types = BIT(NL80211_IFTYPE_AP), - }, -}; - -static const struct ieee80211_iface_limit iwlagn_2sta_limits[] = { - { - .max = 2, - .types = BIT(NL80211_IFTYPE_STATION), - }, -}; - -static const struct ieee80211_iface_limit iwlagn_p2p_sta_go_limits[] = { - { - .max = 1, - .types = BIT(NL80211_IFTYPE_STATION), - }, - { - .max = 1, - .types = BIT(NL80211_IFTYPE_P2P_GO) | - BIT(NL80211_IFTYPE_AP), - }, -}; - -static const struct ieee80211_iface_limit iwlagn_p2p_2sta_limits[] = { - { - .max = 2, - .types = BIT(NL80211_IFTYPE_STATION), - }, - { - .max = 1, - .types = BIT(NL80211_IFTYPE_P2P_CLIENT), - }, -}; - -static const struct ieee80211_iface_combination -iwlagn_iface_combinations_dualmode[] = { - { .num_different_channels = 1, - .max_interfaces = 2, - .beacon_int_infra_match = true, - .limits = iwlagn_sta_ap_limits, - .n_limits = ARRAY_SIZE(iwlagn_sta_ap_limits), - }, - { .num_different_channels = 1, - .max_interfaces = 2, - .limits = iwlagn_2sta_limits, - .n_limits = ARRAY_SIZE(iwlagn_2sta_limits), - }, -}; - -static const struct ieee80211_iface_combination -iwlagn_iface_combinations_p2p[] = { - { .num_different_channels = 1, - .max_interfaces = 2, - .beacon_int_infra_match = true, - .limits = iwlagn_p2p_sta_go_limits, - .n_limits = ARRAY_SIZE(iwlagn_p2p_sta_go_limits), - }, - { .num_different_channels = 1, - .max_interfaces = 2, - .limits = iwlagn_p2p_2sta_limits, - .n_limits = ARRAY_SIZE(iwlagn_p2p_2sta_limits), - }, -}; - -/* - * Not a mac80211 entry point function, but it fits in with all the - * other mac80211 functions grouped here. - */ -int iwlagn_mac_setup_register(struct iwl_priv *priv, - const struct iwl_ucode_capabilities *capa) -{ - int ret; - struct ieee80211_hw *hw = priv->hw; - struct iwl_rxon_context *ctx; - - hw->rate_control_algorithm = "iwl-agn-rs"; - - /* Tell mac80211 our characteristics */ - hw->flags = IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_AMPDU_AGGREGATION | - IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC | - IEEE80211_HW_SPECTRUM_MGMT | - IEEE80211_HW_REPORTS_TX_ACK_STATUS | - IEEE80211_HW_QUEUE_CONTROL | - IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_SUPPORTS_DYNAMIC_PS | - IEEE80211_HW_WANT_MONITOR_VIF; - - hw->offchannel_tx_hw_queue = IWL_AUX_QUEUE; - hw->radiotap_mcs_details |= IEEE80211_RADIOTAP_MCS_HAVE_FMT; - - /* - * Including the following line will crash some AP's. This - * workaround removes the stimulus which causes the crash until - * the AP software can be fixed. - hw->max_tx_aggregation_subframes = LINK_QUAL_AGG_FRAME_LIMIT_DEF; - */ - - if (priv->nvm_data->sku_cap_11n_enable) - hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | - IEEE80211_HW_SUPPORTS_STATIC_SMPS; - - /* - * Enable 11w if advertised by firmware and software crypto - * is not enabled (as the firmware will interpret some mgmt - * packets, so enabling it with software crypto isn't safe) - */ - if (priv->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_MFP && - !iwlwifi_mod_params.sw_crypto) - hw->flags |= IEEE80211_HW_MFP_CAPABLE; - - hw->sta_data_size = sizeof(struct iwl_station_priv); - hw->vif_data_size = sizeof(struct iwl_vif_priv); - - for_each_context(priv, ctx) { - hw->wiphy->interface_modes |= ctx->interface_modes; - hw->wiphy->interface_modes |= ctx->exclusive_interface_modes; - } - - BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); - - if (hw->wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) { - hw->wiphy->iface_combinations = iwlagn_iface_combinations_p2p; - hw->wiphy->n_iface_combinations = - ARRAY_SIZE(iwlagn_iface_combinations_p2p); - } else if (hw->wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) { - hw->wiphy->iface_combinations = - iwlagn_iface_combinations_dualmode; - hw->wiphy->n_iface_combinations = - ARRAY_SIZE(iwlagn_iface_combinations_dualmode); - } - - hw->wiphy->max_remain_on_channel_duration = 500; - - hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | - WIPHY_FLAG_DISABLE_BEACON_HINTS | - WIPHY_FLAG_IBSS_RSN; - -#ifdef CONFIG_PM_SLEEP - if (priv->fw->img[IWL_UCODE_WOWLAN].sec[0].len && - priv->trans->ops->d3_suspend && - priv->trans->ops->d3_resume && - device_can_wakeup(priv->trans->dev)) { - hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | - WIPHY_WOWLAN_DISCONNECT | - WIPHY_WOWLAN_EAP_IDENTITY_REQ | - WIPHY_WOWLAN_RFKILL_RELEASE; - if (!iwlwifi_mod_params.sw_crypto) - hw->wiphy->wowlan.flags |= - WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | - WIPHY_WOWLAN_GTK_REKEY_FAILURE; - - hw->wiphy->wowlan.n_patterns = IWLAGN_WOWLAN_MAX_PATTERNS; - hw->wiphy->wowlan.pattern_min_len = - IWLAGN_WOWLAN_MIN_PATTERN_LEN; - hw->wiphy->wowlan.pattern_max_len = - IWLAGN_WOWLAN_MAX_PATTERN_LEN; - } -#endif - - if (iwlwifi_mod_params.power_save) - hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; - else - hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; - - hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; - /* we create the 802.11 header and a max-length SSID element */ - hw->wiphy->max_scan_ie_len = capa->max_probe_length - 24 - 34; - - /* - * We don't use all queues: 4 and 9 are unused and any - * aggregation queue gets mapped down to the AC queue. - */ - hw->queues = IWLAGN_FIRST_AMPDU_QUEUE; - - hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; - - if (priv->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels) - priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = - &priv->nvm_data->bands[IEEE80211_BAND_2GHZ]; - if (priv->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels) - priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = - &priv->nvm_data->bands[IEEE80211_BAND_5GHZ]; - - hw->wiphy->hw_version = priv->trans->hw_id; - - iwl_leds_init(priv); - - ret = ieee80211_register_hw(priv->hw); - if (ret) { - IWL_ERR(priv, "Failed to register hw (error %d)\n", ret); - iwl_leds_exit(priv); - return ret; - } - priv->mac80211_registered = 1; - - return 0; -} - -void iwlagn_mac_unregister(struct iwl_priv *priv) -{ - if (!priv->mac80211_registered) - return; - iwl_leds_exit(priv); - ieee80211_unregister_hw(priv->hw); - priv->mac80211_registered = 0; -} - -static int __iwl_up(struct iwl_priv *priv) -{ - struct iwl_rxon_context *ctx; - int ret; - - lockdep_assert_held(&priv->mutex); - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { - IWL_WARN(priv, "Exit pending; will not bring the NIC up\n"); - return -EIO; - } - - for_each_context(priv, ctx) { - ret = iwlagn_alloc_bcast_station(priv, ctx); - if (ret) { - iwl_dealloc_bcast_stations(priv); - return ret; - } - } - - ret = iwl_run_init_ucode(priv); - if (ret) { - IWL_ERR(priv, "Failed to run INIT ucode: %d\n", ret); - goto error; - } - - ret = iwl_load_ucode_wait_alive(priv, IWL_UCODE_REGULAR); - if (ret) { - IWL_ERR(priv, "Failed to start RT ucode: %d\n", ret); - goto error; - } - - ret = iwl_alive_start(priv); - if (ret) - goto error; - return 0; - - error: - set_bit(STATUS_EXIT_PENDING, &priv->status); - iwl_down(priv); - clear_bit(STATUS_EXIT_PENDING, &priv->status); - - IWL_ERR(priv, "Unable to initialize device.\n"); - return ret; -} - -static int iwlagn_mac_start(struct ieee80211_hw *hw) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - int ret; - - IWL_DEBUG_MAC80211(priv, "enter\n"); - - /* we should be verifying the device is ready to be opened */ - mutex_lock(&priv->mutex); - ret = __iwl_up(priv); - mutex_unlock(&priv->mutex); - if (ret) - return ret; - - IWL_DEBUG_INFO(priv, "Start UP work done.\n"); - - /* Now we should be done, and the READY bit should be set. */ - if (WARN_ON(!test_bit(STATUS_READY, &priv->status))) - ret = -EIO; - - iwlagn_led_enable(priv); - - priv->is_open = 1; - IWL_DEBUG_MAC80211(priv, "leave\n"); - return 0; -} - -static void iwlagn_mac_stop(struct ieee80211_hw *hw) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - - IWL_DEBUG_MAC80211(priv, "enter\n"); - - if (!priv->is_open) - return; - - priv->is_open = 0; - - mutex_lock(&priv->mutex); - iwl_down(priv); - mutex_unlock(&priv->mutex); - - iwl_cancel_deferred_work(priv); - - flush_workqueue(priv->workqueue); - - /* User space software may expect getting rfkill changes - * even if interface is down, trans->down will leave the RF - * kill interrupt enabled - */ - iwl_trans_stop_hw(priv->trans, false); - - IWL_DEBUG_MAC80211(priv, "leave\n"); -} - -static void iwlagn_mac_set_rekey_data(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct cfg80211_gtk_rekey_data *data) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - - if (iwlwifi_mod_params.sw_crypto) - return; - - IWL_DEBUG_MAC80211(priv, "enter\n"); - mutex_lock(&priv->mutex); - - if (priv->contexts[IWL_RXON_CTX_BSS].vif != vif) - goto out; - - memcpy(priv->kek, data->kek, NL80211_KEK_LEN); - memcpy(priv->kck, data->kck, NL80211_KCK_LEN); - priv->replay_ctr = - cpu_to_le64(be64_to_cpup((__be64 *)&data->replay_ctr)); - priv->have_rekey_data = true; - - out: - mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); -} - -#ifdef CONFIG_PM_SLEEP - -static int iwlagn_mac_suspend(struct ieee80211_hw *hw, - struct cfg80211_wowlan *wowlan) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - int ret; - - if (WARN_ON(!wowlan)) - return -EINVAL; - - IWL_DEBUG_MAC80211(priv, "enter\n"); - mutex_lock(&priv->mutex); - - /* Don't attempt WoWLAN when not associated, tear down instead. */ - if (!ctx->vif || ctx->vif->type != NL80211_IFTYPE_STATION || - !iwl_is_associated_ctx(ctx)) { - ret = 1; - goto out; - } - - ret = iwlagn_suspend(priv, wowlan); - if (ret) - goto error; - - iwl_trans_d3_suspend(priv->trans); - - goto out; - - error: - priv->wowlan = false; - iwlagn_prepare_restart(priv); - ieee80211_restart_hw(priv->hw); - out: - mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); - - return ret; -} - -struct iwl_resume_data { - struct iwl_priv *priv; - struct iwlagn_wowlan_status *cmd; - bool valid; -}; - -static bool iwl_resume_status_fn(struct iwl_notif_wait_data *notif_wait, - struct iwl_rx_packet *pkt, void *data) -{ - struct iwl_resume_data *resume_data = data; - struct iwl_priv *priv = resume_data->priv; - u32 len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; - - if (len - 4 != sizeof(*resume_data->cmd)) { - IWL_ERR(priv, "rx wrong size data\n"); - return true; - } - memcpy(resume_data->cmd, pkt->data, sizeof(*resume_data->cmd)); - resume_data->valid = true; - - return true; -} - -static int iwlagn_mac_resume(struct ieee80211_hw *hw) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - struct ieee80211_vif *vif; - u32 base; - int ret; - enum iwl_d3_status d3_status; - struct error_table_start { - /* cf. struct iwl_error_event_table */ - u32 valid; - u32 error_id; - } err_info; - struct iwl_notification_wait status_wait; - static const u8 status_cmd[] = { - REPLY_WOWLAN_GET_STATUS, - }; - struct iwlagn_wowlan_status status_data = {}; - struct iwl_resume_data resume_data = { - .priv = priv, - .cmd = &status_data, - .valid = false, - }; - struct cfg80211_wowlan_wakeup wakeup = { - .pattern_idx = -1, - }; -#ifdef CONFIG_IWLWIFI_DEBUGFS - const struct fw_img *img; -#endif - - IWL_DEBUG_MAC80211(priv, "enter\n"); - mutex_lock(&priv->mutex); - - /* we'll clear ctx->vif during iwlagn_prepare_restart() */ - vif = ctx->vif; - - ret = iwl_trans_d3_resume(priv->trans, &d3_status); - if (ret) - goto out_unlock; - - if (d3_status != IWL_D3_STATUS_ALIVE) { - IWL_INFO(priv, "Device was reset during suspend\n"); - goto out_unlock; - } - - base = priv->device_pointers.error_event_table; - if (!iwlagn_hw_valid_rtc_data_addr(base)) { - IWL_WARN(priv, "Invalid error table during resume!\n"); - goto out_unlock; - } - - iwl_trans_read_mem_bytes(priv->trans, base, - &err_info, sizeof(err_info)); - - if (err_info.valid) { - IWL_INFO(priv, "error table is valid (%d, 0x%x)\n", - err_info.valid, err_info.error_id); - if (err_info.error_id == RF_KILL_INDICATOR_FOR_WOWLAN) { - wakeup.rfkill_release = true; - ieee80211_report_wowlan_wakeup(vif, &wakeup, - GFP_KERNEL); - } - goto out_unlock; - } - -#ifdef CONFIG_IWLWIFI_DEBUGFS - img = &priv->fw->img[IWL_UCODE_WOWLAN]; - if (!priv->wowlan_sram) - priv->wowlan_sram = - kzalloc(img->sec[IWL_UCODE_SECTION_DATA].len, - GFP_KERNEL); - - if (priv->wowlan_sram) - iwl_trans_read_mem(priv->trans, 0x800000, - priv->wowlan_sram, - img->sec[IWL_UCODE_SECTION_DATA].len / 4); -#endif - - /* - * This is very strange. The GET_STATUS command is sent but the device - * doesn't reply properly, it seems it doesn't close the RBD so one is - * always left open ... As a result, we need to send another command - * and have to reset the driver afterwards. As we need to switch to - * runtime firmware again that'll happen. - */ - - iwl_init_notification_wait(&priv->notif_wait, &status_wait, status_cmd, - ARRAY_SIZE(status_cmd), iwl_resume_status_fn, - &resume_data); - - iwl_dvm_send_cmd_pdu(priv, REPLY_WOWLAN_GET_STATUS, CMD_ASYNC, 0, NULL); - iwl_dvm_send_cmd_pdu(priv, REPLY_ECHO, CMD_ASYNC, 0, NULL); - /* an RBD is left open in the firmware now! */ - - ret = iwl_wait_notification(&priv->notif_wait, &status_wait, HZ/5); - if (ret) - goto out_unlock; - - if (resume_data.valid && priv->contexts[IWL_RXON_CTX_BSS].vif) { - u32 reasons = le32_to_cpu(status_data.wakeup_reason); - struct cfg80211_wowlan_wakeup *wakeup_report; - - IWL_INFO(priv, "WoWLAN wakeup reason(s): 0x%.8x\n", reasons); - - if (reasons) { - if (reasons & IWLAGN_WOWLAN_WAKEUP_MAGIC_PACKET) - wakeup.magic_pkt = true; - if (reasons & IWLAGN_WOWLAN_WAKEUP_PATTERN_MATCH) - wakeup.pattern_idx = status_data.pattern_number; - if (reasons & (IWLAGN_WOWLAN_WAKEUP_BEACON_MISS | - IWLAGN_WOWLAN_WAKEUP_LINK_CHANGE)) - wakeup.disconnect = true; - if (reasons & IWLAGN_WOWLAN_WAKEUP_GTK_REKEY_FAIL) - wakeup.gtk_rekey_failure = true; - if (reasons & IWLAGN_WOWLAN_WAKEUP_EAP_IDENT_REQ) - wakeup.eap_identity_req = true; - if (reasons & IWLAGN_WOWLAN_WAKEUP_4WAY_HANDSHAKE) - wakeup.four_way_handshake = true; - wakeup_report = &wakeup; - } else { - wakeup_report = NULL; - } - - ieee80211_report_wowlan_wakeup(vif, wakeup_report, GFP_KERNEL); - } - - priv->wowlan = false; - - iwlagn_prepare_restart(priv); - - memset((void *)&ctx->active, 0, sizeof(ctx->active)); - iwl_connection_init_rx_config(priv, ctx); - iwlagn_set_rxon_chain(priv, ctx); - - out_unlock: - mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); - - ieee80211_resume_disconnect(vif); - - return 1; -} - -static void iwlagn_mac_set_wakeup(struct ieee80211_hw *hw, bool enabled) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - - device_set_wakeup_enable(priv->trans->dev, enabled); -} -#endif - -static void iwlagn_mac_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - - if (iwlagn_tx_skb(priv, control->sta, skb)) - ieee80211_free_txskb(hw, skb); -} - -static void iwlagn_mac_update_tkip_key(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_key_conf *keyconf, - struct ieee80211_sta *sta, - u32 iv32, u16 *phase1key) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - - iwl_update_tkip_key(priv, vif, keyconf, sta, iv32, phase1key); -} - -static int iwlagn_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; - struct iwl_rxon_context *ctx = vif_priv->ctx; - int ret; - bool is_default_wep_key = false; - - IWL_DEBUG_MAC80211(priv, "enter\n"); - - if (iwlwifi_mod_params.sw_crypto) { - IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n"); - return -EOPNOTSUPP; - } - - switch (key->cipher) { - case WLAN_CIPHER_SUITE_TKIP: - key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; - /* fall through */ - case WLAN_CIPHER_SUITE_CCMP: - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - break; - default: - break; - } - - /* - * We could program these keys into the hardware as well, but we - * don't expect much multicast traffic in IBSS and having keys - * for more stations is probably more useful. - * - * Mark key TX-only and return 0. - */ - if (vif->type == NL80211_IFTYPE_ADHOC && - !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { - key->hw_key_idx = WEP_INVALID_OFFSET; - return 0; - } - - /* If they key was TX-only, accept deletion */ - if (cmd == DISABLE_KEY && key->hw_key_idx == WEP_INVALID_OFFSET) - return 0; - - mutex_lock(&priv->mutex); - iwl_scan_cancel_timeout(priv, 100); - - BUILD_BUG_ON(WEP_INVALID_OFFSET == IWLAGN_HW_KEY_DEFAULT); - - /* - * If we are getting WEP group key and we didn't receive any key mapping - * so far, we are in legacy wep mode (group key only), otherwise we are - * in 1X mode. - * In legacy wep mode, we use another host command to the uCode. - */ - if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 || - key->cipher == WLAN_CIPHER_SUITE_WEP104) && !sta) { - if (cmd == SET_KEY) - is_default_wep_key = !ctx->key_mapping_keys; - else - is_default_wep_key = - key->hw_key_idx == IWLAGN_HW_KEY_DEFAULT; - } - - - switch (cmd) { - case SET_KEY: - if (is_default_wep_key) { - ret = iwl_set_default_wep_key(priv, vif_priv->ctx, key); - break; - } - ret = iwl_set_dynamic_key(priv, vif_priv->ctx, key, sta); - if (ret) { - /* - * can't add key for RX, but we don't need it - * in the device for TX so still return 0 - */ - ret = 0; - key->hw_key_idx = WEP_INVALID_OFFSET; - } - - IWL_DEBUG_MAC80211(priv, "enable hwcrypto key\n"); - break; - case DISABLE_KEY: - if (is_default_wep_key) - ret = iwl_remove_default_wep_key(priv, ctx, key); - else - ret = iwl_remove_dynamic_key(priv, ctx, key, sta); - - IWL_DEBUG_MAC80211(priv, "disable hwcrypto key\n"); - break; - default: - ret = -EINVAL; - } - - mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); - - return ret; -} - -static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, u16 tid, u16 *ssn, - u8 buf_size) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - int ret = -EINVAL; - struct iwl_station_priv *sta_priv = (void *) sta->drv_priv; - - IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", - sta->addr, tid); - - if (!(priv->nvm_data->sku_cap_11n_enable)) - return -EACCES; - - IWL_DEBUG_MAC80211(priv, "enter\n"); - mutex_lock(&priv->mutex); - - switch (action) { - case IEEE80211_AMPDU_RX_START: - if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG) - break; - IWL_DEBUG_HT(priv, "start Rx\n"); - ret = iwl_sta_rx_agg_start(priv, sta, tid, *ssn); - break; - case IEEE80211_AMPDU_RX_STOP: - IWL_DEBUG_HT(priv, "stop Rx\n"); - ret = iwl_sta_rx_agg_stop(priv, sta, tid); - break; - case IEEE80211_AMPDU_TX_START: - if (!priv->trans->ops->txq_enable) - break; - if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) - break; - IWL_DEBUG_HT(priv, "start Tx\n"); - ret = iwlagn_tx_agg_start(priv, vif, sta, tid, ssn); - break; - case IEEE80211_AMPDU_TX_STOP_FLUSH: - case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: - IWL_DEBUG_HT(priv, "Flush Tx\n"); - ret = iwlagn_tx_agg_flush(priv, vif, sta, tid); - break; - case IEEE80211_AMPDU_TX_STOP_CONT: - IWL_DEBUG_HT(priv, "stop Tx\n"); - ret = iwlagn_tx_agg_stop(priv, vif, sta, tid); - if ((ret == 0) && (priv->agg_tids_count > 0)) { - priv->agg_tids_count--; - IWL_DEBUG_HT(priv, "priv->agg_tids_count = %u\n", - priv->agg_tids_count); - } - if (!priv->agg_tids_count && - priv->hw_params.use_rts_for_aggregation) { - /* - * switch off RTS/CTS if it was previously enabled - */ - sta_priv->lq_sta.lq.general_params.flags &= - ~LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK; - iwl_send_lq_cmd(priv, iwl_rxon_ctx_from_vif(vif), - &sta_priv->lq_sta.lq, CMD_ASYNC, false); - } - break; - case IEEE80211_AMPDU_TX_OPERATIONAL: - ret = iwlagn_tx_agg_oper(priv, vif, sta, tid, buf_size); - break; - } - mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); - return ret; -} - -static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; - bool is_ap = vif->type == NL80211_IFTYPE_STATION; - int ret; - u8 sta_id; - - IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n", - sta->addr); - sta_priv->sta_id = IWL_INVALID_STATION; - - atomic_set(&sta_priv->pending_frames, 0); - if (vif->type == NL80211_IFTYPE_AP) - sta_priv->client = true; - - ret = iwl_add_station_common(priv, vif_priv->ctx, sta->addr, - is_ap, sta, &sta_id); - if (ret) { - IWL_ERR(priv, "Unable to add station %pM (%d)\n", - sta->addr, ret); - /* Should we return success if return code is EEXIST ? */ - return ret; - } - - sta_priv->sta_id = sta_id; - - return 0; -} - -static int iwlagn_mac_sta_remove(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; - int ret; - - IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n", sta->addr); - - if (vif->type == NL80211_IFTYPE_STATION) { - /* - * Station will be removed from device when the RXON - * is set to unassociated -- just deactivate it here - * to avoid re-programming it. - */ - ret = 0; - iwl_deactivate_station(priv, sta_priv->sta_id, sta->addr); - } else { - ret = iwl_remove_station(priv, sta_priv->sta_id, sta->addr); - if (ret) - IWL_DEBUG_QUIET_RFKILL(priv, - "Error removing station %pM\n", sta->addr); - } - return ret; -} - -static int iwlagn_mac_sta_state(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - enum ieee80211_sta_state old_state, - enum ieee80211_sta_state new_state) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; - enum { - NONE, ADD, REMOVE, HT_RATE_INIT, ADD_RATE_INIT, - } op = NONE; - int ret; - - IWL_DEBUG_MAC80211(priv, "station %pM state change %d->%d\n", - sta->addr, old_state, new_state); - - mutex_lock(&priv->mutex); - if (vif->type == NL80211_IFTYPE_STATION) { - if (old_state == IEEE80211_STA_NOTEXIST && - new_state == IEEE80211_STA_NONE) - op = ADD; - else if (old_state == IEEE80211_STA_NONE && - new_state == IEEE80211_STA_NOTEXIST) - op = REMOVE; - else if (old_state == IEEE80211_STA_AUTH && - new_state == IEEE80211_STA_ASSOC) - op = HT_RATE_INIT; - } else { - if (old_state == IEEE80211_STA_AUTH && - new_state == IEEE80211_STA_ASSOC) - op = ADD_RATE_INIT; - else if (old_state == IEEE80211_STA_ASSOC && - new_state == IEEE80211_STA_AUTH) - op = REMOVE; - } - - switch (op) { - case ADD: - ret = iwlagn_mac_sta_add(hw, vif, sta); - if (ret) - break; - /* - * Clear the in-progress flag, the AP station entry was added - * but we'll initialize LQ only when we've associated (which - * would also clear the in-progress flag). This is necessary - * in case we never initialize LQ because association fails. - */ - spin_lock_bh(&priv->sta_lock); - priv->stations[iwl_sta_id(sta)].used &= - ~IWL_STA_UCODE_INPROGRESS; - spin_unlock_bh(&priv->sta_lock); - break; - case REMOVE: - ret = iwlagn_mac_sta_remove(hw, vif, sta); - break; - case ADD_RATE_INIT: - ret = iwlagn_mac_sta_add(hw, vif, sta); - if (ret) - break; - /* Initialize rate scaling */ - IWL_DEBUG_INFO(priv, - "Initializing rate scaling for station %pM\n", - sta->addr); - iwl_rs_rate_init(priv, sta, iwl_sta_id(sta)); - ret = 0; - break; - case HT_RATE_INIT: - /* Initialize rate scaling */ - ret = iwl_sta_update_ht(priv, vif_priv->ctx, sta); - if (ret) - break; - IWL_DEBUG_INFO(priv, - "Initializing rate scaling for station %pM\n", - sta->addr); - iwl_rs_rate_init(priv, sta, iwl_sta_id(sta)); - ret = 0; - break; - default: - ret = 0; - break; - } - - /* - * mac80211 might WARN if we fail, but due the way we - * (badly) handle hard rfkill, we might fail here - */ - if (iwl_is_rfkill(priv)) - ret = 0; - - mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); - - return ret; -} - -static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, - struct ieee80211_channel_switch *ch_switch) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct ieee80211_conf *conf = &hw->conf; - struct ieee80211_channel *channel = ch_switch->chandef.chan; - struct iwl_ht_config *ht_conf = &priv->current_ht_config; - /* - * MULTI-FIXME - * When we add support for multiple interfaces, we need to - * revisit this. The channel switch command in the device - * only affects the BSS context, but what does that really - * mean? And what if we get a CSA on the second interface? - * This needs a lot of work. - */ - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - u16 ch; - - IWL_DEBUG_MAC80211(priv, "enter\n"); - - mutex_lock(&priv->mutex); - - if (iwl_is_rfkill(priv)) - goto out; - - if (test_bit(STATUS_EXIT_PENDING, &priv->status) || - test_bit(STATUS_SCANNING, &priv->status) || - test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) - goto out; - - if (!iwl_is_associated_ctx(ctx)) - goto out; - - if (!priv->lib->set_channel_switch) - goto out; - - ch = channel->hw_value; - if (le16_to_cpu(ctx->active.channel) == ch) - goto out; - - priv->current_ht_config.smps = conf->smps_mode; - - /* Configure HT40 channels */ - switch (cfg80211_get_chandef_type(&ch_switch->chandef)) { - case NL80211_CHAN_NO_HT: - case NL80211_CHAN_HT20: - ctx->ht.is_40mhz = false; - ctx->ht.extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; - break; - case NL80211_CHAN_HT40MINUS: - ctx->ht.extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_BELOW; - ctx->ht.is_40mhz = true; - break; - case NL80211_CHAN_HT40PLUS: - ctx->ht.extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; - ctx->ht.is_40mhz = true; - break; - } - - if ((le16_to_cpu(ctx->staging.channel) != ch)) - ctx->staging.flags = 0; - - iwl_set_rxon_channel(priv, channel, ctx); - iwl_set_rxon_ht(priv, ht_conf); - iwl_set_flags_for_band(priv, ctx, channel->band, ctx->vif); - - /* - * at this point, staging_rxon has the - * configuration for channel switch - */ - set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status); - priv->switch_channel = cpu_to_le16(ch); - if (priv->lib->set_channel_switch(priv, ch_switch)) { - clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status); - priv->switch_channel = 0; - ieee80211_chswitch_done(ctx->vif, false); - } - -out: - mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); -} - -void iwl_chswitch_done(struct iwl_priv *priv, bool is_success) -{ - /* - * MULTI-FIXME - * See iwlagn_mac_channel_switch. - */ - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - if (!test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) - return; - - if (ctx->vif) - ieee80211_chswitch_done(ctx->vif, is_success); -} - -static void iwlagn_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - __le32 filter_or = 0, filter_nand = 0; - struct iwl_rxon_context *ctx; - -#define CHK(test, flag) do { \ - if (*total_flags & (test)) \ - filter_or |= (flag); \ - else \ - filter_nand |= (flag); \ - } while (0) - - IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", - changed_flags, *total_flags); - - CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); - /* Setting _just_ RXON_FILTER_CTL2HOST_MSK causes FH errors */ - CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_PROMISC_MSK); - CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); - -#undef CHK - - mutex_lock(&priv->mutex); - - for_each_context(priv, ctx) { - ctx->staging.filter_flags &= ~filter_nand; - ctx->staging.filter_flags |= filter_or; - - /* - * Not committing directly because hardware can perform a scan, - * but we'll eventually commit the filter flags change anyway. - */ - } - - mutex_unlock(&priv->mutex); - - /* - * Receiving all multicast frames is always enabled by the - * default flags setup in iwl_connection_init_rx_config() - * since we currently do not support programming multicast - * filters into the device. - */ - *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | - FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; -} - -static void iwlagn_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - - mutex_lock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "enter\n"); - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { - IWL_DEBUG_TX(priv, "Aborting flush due to device shutdown\n"); - goto done; - } - if (iwl_is_rfkill(priv)) { - IWL_DEBUG_TX(priv, "Aborting flush due to RF Kill\n"); - goto done; - } - - /* - * mac80211 will not push any more frames for transmit - * until the flush is completed - */ - if (drop) { - IWL_DEBUG_MAC80211(priv, "send flush command\n"); - if (iwlagn_txfifo_flush(priv, 0)) { - IWL_ERR(priv, "flush request fail\n"); - goto done; - } - } - IWL_DEBUG_MAC80211(priv, "wait transmit/flush all frames\n"); - iwl_trans_wait_tx_queue_empty(priv->trans); -done: - mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); -} - -static int iwlagn_mac_remain_on_channel(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_channel *channel, - int duration, - enum ieee80211_roc_type type) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_PAN]; - int err = 0; - - if (!(priv->valid_contexts & BIT(IWL_RXON_CTX_PAN))) - return -EOPNOTSUPP; - - if (!(ctx->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT))) - return -EOPNOTSUPP; - - IWL_DEBUG_MAC80211(priv, "enter\n"); - mutex_lock(&priv->mutex); - - if (test_bit(STATUS_SCAN_HW, &priv->status)) { - /* mac80211 should not scan while ROC or ROC while scanning */ - if (WARN_ON_ONCE(priv->scan_type != IWL_SCAN_RADIO_RESET)) { - err = -EBUSY; - goto out; - } - - iwl_scan_cancel_timeout(priv, 100); - - if (test_bit(STATUS_SCAN_HW, &priv->status)) { - err = -EBUSY; - goto out; - } - } - - priv->hw_roc_channel = channel; - /* convert from ms to TU */ - priv->hw_roc_duration = DIV_ROUND_UP(1000 * duration, 1024); - priv->hw_roc_start_notified = false; - cancel_delayed_work(&priv->hw_roc_disable_work); - - if (!ctx->is_active) { - static const struct iwl_qos_info default_qos_data = { - .def_qos_parm = { - .ac[0] = { - .cw_min = cpu_to_le16(3), - .cw_max = cpu_to_le16(7), - .aifsn = 2, - .edca_txop = cpu_to_le16(1504), - }, - .ac[1] = { - .cw_min = cpu_to_le16(7), - .cw_max = cpu_to_le16(15), - .aifsn = 2, - .edca_txop = cpu_to_le16(3008), - }, - .ac[2] = { - .cw_min = cpu_to_le16(15), - .cw_max = cpu_to_le16(1023), - .aifsn = 3, - }, - .ac[3] = { - .cw_min = cpu_to_le16(15), - .cw_max = cpu_to_le16(1023), - .aifsn = 7, - }, - }, - }; - - ctx->is_active = true; - ctx->qos_data = default_qos_data; - ctx->staging.dev_type = RXON_DEV_TYPE_P2P; - memcpy(ctx->staging.node_addr, - priv->contexts[IWL_RXON_CTX_BSS].staging.node_addr, - ETH_ALEN); - memcpy(ctx->staging.bssid_addr, - priv->contexts[IWL_RXON_CTX_BSS].staging.node_addr, - ETH_ALEN); - err = iwlagn_commit_rxon(priv, ctx); - if (err) - goto out; - ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK | - RXON_FILTER_PROMISC_MSK | - RXON_FILTER_CTL2HOST_MSK; - - err = iwlagn_commit_rxon(priv, ctx); - if (err) { - iwlagn_disable_roc(priv); - goto out; - } - priv->hw_roc_setup = true; - } - - err = iwl_scan_initiate(priv, ctx->vif, IWL_SCAN_ROC, channel->band); - if (err) - iwlagn_disable_roc(priv); - - out: - mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); - - return err; -} - -static int iwlagn_mac_cancel_remain_on_channel(struct ieee80211_hw *hw) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - - if (!(priv->valid_contexts & BIT(IWL_RXON_CTX_PAN))) - return -EOPNOTSUPP; - - IWL_DEBUG_MAC80211(priv, "enter\n"); - mutex_lock(&priv->mutex); - iwl_scan_cancel_timeout(priv, priv->hw_roc_duration); - iwlagn_disable_roc(priv); - mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); - - return 0; -} - -static void iwlagn_mac_rssi_callback(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum ieee80211_rssi_event rssi_event) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - - IWL_DEBUG_MAC80211(priv, "enter\n"); - mutex_lock(&priv->mutex); - - if (priv->cfg->bt_params && - priv->cfg->bt_params->advanced_bt_coexist) { - if (rssi_event == RSSI_EVENT_LOW) - priv->bt_enable_pspoll = true; - else if (rssi_event == RSSI_EVENT_HIGH) - priv->bt_enable_pspoll = false; - - iwlagn_send_advance_bt_config(priv); - } else { - IWL_DEBUG_MAC80211(priv, "Advanced BT coex disabled," - "ignoring RSSI callback\n"); - } - - mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); -} - -static int iwlagn_mac_set_tim(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, bool set) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - - queue_work(priv->workqueue, &priv->beacon_update); - - return 0; -} - -static int iwlagn_mac_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; - struct iwl_rxon_context *ctx = vif_priv->ctx; - int q; - - if (WARN_ON(!ctx)) - return -EINVAL; - - IWL_DEBUG_MAC80211(priv, "enter\n"); - - if (!iwl_is_ready_rf(priv)) { - IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); - return -EIO; - } - - if (queue >= AC_NUM) { - IWL_DEBUG_MAC80211(priv, "leave - queue >= AC_NUM %d\n", queue); - return 0; - } - - q = AC_NUM - 1 - queue; - - mutex_lock(&priv->mutex); - - ctx->qos_data.def_qos_parm.ac[q].cw_min = - cpu_to_le16(params->cw_min); - ctx->qos_data.def_qos_parm.ac[q].cw_max = - cpu_to_le16(params->cw_max); - ctx->qos_data.def_qos_parm.ac[q].aifsn = params->aifs; - ctx->qos_data.def_qos_parm.ac[q].edca_txop = - cpu_to_le16((params->txop * 32)); - - ctx->qos_data.def_qos_parm.ac[q].reserved1 = 0; - - mutex_unlock(&priv->mutex); - - IWL_DEBUG_MAC80211(priv, "leave\n"); - return 0; -} - -static int iwlagn_mac_tx_last_beacon(struct ieee80211_hw *hw) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - - return priv->ibss_manager == IWL_IBSS_MANAGER; -} - -static int iwl_set_mode(struct iwl_priv *priv, struct iwl_rxon_context *ctx) -{ - iwl_connection_init_rx_config(priv, ctx); - - iwlagn_set_rxon_chain(priv, ctx); - - return iwlagn_commit_rxon(priv, ctx); -} - -static int iwl_setup_interface(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) -{ - struct ieee80211_vif *vif = ctx->vif; - int err, ac; - - lockdep_assert_held(&priv->mutex); - - /* - * This variable will be correct only when there's just - * a single context, but all code using it is for hardware - * that supports only one context. - */ - priv->iw_mode = vif->type; - - ctx->is_active = true; - - err = iwl_set_mode(priv, ctx); - if (err) { - if (!ctx->always_active) - ctx->is_active = false; - return err; - } - - if (priv->cfg->bt_params && priv->cfg->bt_params->advanced_bt_coexist && - vif->type == NL80211_IFTYPE_ADHOC) { - /* - * pretend to have high BT traffic as long as we - * are operating in IBSS mode, as this will cause - * the rate scaling etc. to behave as intended. - */ - priv->bt_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_HIGH; - } - - /* set up queue mappings */ - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) - vif->hw_queue[ac] = ctx->ac_to_queue[ac]; - - if (vif->type == NL80211_IFTYPE_AP) - vif->cab_queue = ctx->mcast_queue; - else - vif->cab_queue = IEEE80211_INVAL_HW_QUEUE; - - return 0; -} - -static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; - struct iwl_rxon_context *tmp, *ctx = NULL; - int err; - enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); - bool reset = false; - - IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", - viftype, vif->addr); - - cancel_delayed_work_sync(&priv->hw_roc_disable_work); - - mutex_lock(&priv->mutex); - - iwlagn_disable_roc(priv); - - if (!iwl_is_ready_rf(priv)) { - IWL_WARN(priv, "Try to add interface when device not ready\n"); - err = -EINVAL; - goto out; - } - - for_each_context(priv, tmp) { - u32 possible_modes = - tmp->interface_modes | tmp->exclusive_interface_modes; - - if (tmp->vif) { - /* On reset we need to add the same interface again */ - if (tmp->vif == vif) { - reset = true; - ctx = tmp; - break; - } - - /* check if this busy context is exclusive */ - if (tmp->exclusive_interface_modes & - BIT(tmp->vif->type)) { - err = -EINVAL; - goto out; - } - continue; - } - - if (!(possible_modes & BIT(viftype))) - continue; - - /* have maybe usable context w/o interface */ - ctx = tmp; - break; - } - - if (!ctx) { - err = -EOPNOTSUPP; - goto out; - } - - vif_priv->ctx = ctx; - ctx->vif = vif; - - /* - * In SNIFFER device type, the firmware reports the FCS to - * the host, rather than snipping it off. Unfortunately, - * mac80211 doesn't (yet) provide a per-packet flag for - * this, so that we have to set the hardware flag based - * on the interfaces added. As the monitor interface can - * only be present by itself, and will be removed before - * other interfaces are added, this is safe. - */ - if (vif->type == NL80211_IFTYPE_MONITOR) - priv->hw->flags |= IEEE80211_HW_RX_INCLUDES_FCS; - else - priv->hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS; - - err = iwl_setup_interface(priv, ctx); - if (!err || reset) - goto out; - - ctx->vif = NULL; - priv->iw_mode = NL80211_IFTYPE_STATION; - out: - mutex_unlock(&priv->mutex); - - IWL_DEBUG_MAC80211(priv, "leave\n"); - return err; -} - -static void iwl_teardown_interface(struct iwl_priv *priv, - struct ieee80211_vif *vif, - bool mode_change) -{ - struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); - - lockdep_assert_held(&priv->mutex); - - if (priv->scan_vif == vif) { - iwl_scan_cancel_timeout(priv, 200); - iwl_force_scan_end(priv); - } - - if (!mode_change) { - iwl_set_mode(priv, ctx); - if (!ctx->always_active) - ctx->is_active = false; - } - - /* - * When removing the IBSS interface, overwrite the - * BT traffic load with the stored one from the last - * notification, if any. If this is a device that - * doesn't implement this, this has no effect since - * both values are the same and zero. - */ - if (vif->type == NL80211_IFTYPE_ADHOC) - priv->bt_traffic_load = priv->last_bt_traffic_load; -} - -static void iwlagn_mac_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); - - IWL_DEBUG_MAC80211(priv, "enter\n"); - - mutex_lock(&priv->mutex); - - if (WARN_ON(ctx->vif != vif)) { - struct iwl_rxon_context *tmp; - IWL_ERR(priv, "ctx->vif = %p, vif = %p\n", ctx->vif, vif); - for_each_context(priv, tmp) - IWL_ERR(priv, "\tID = %d:\tctx = %p\tctx->vif = %p\n", - tmp->ctxid, tmp, tmp->vif); - } - ctx->vif = NULL; - - iwl_teardown_interface(priv, vif, false); - - mutex_unlock(&priv->mutex); - - IWL_DEBUG_MAC80211(priv, "leave\n"); - -} - -static int iwlagn_mac_change_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum nl80211_iftype newtype, bool newp2p) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_rxon_context *ctx, *tmp; - enum nl80211_iftype newviftype = newtype; - u32 interface_modes; - int err; - - IWL_DEBUG_MAC80211(priv, "enter\n"); - - newtype = ieee80211_iftype_p2p(newtype, newp2p); - - mutex_lock(&priv->mutex); - - ctx = iwl_rxon_ctx_from_vif(vif); - - /* - * To simplify this code, only support changes on the - * BSS context. The PAN context is usually reassigned - * by creating/removing P2P interfaces anyway. - */ - if (ctx->ctxid != IWL_RXON_CTX_BSS) { - err = -EBUSY; - goto out; - } - - if (!ctx->vif || !iwl_is_ready_rf(priv)) { - /* - * Huh? But wait ... this can maybe happen when - * we're in the middle of a firmware restart! - */ - err = -EBUSY; - goto out; - } - - /* Check if the switch is supported in the same context */ - interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes; - if (!(interface_modes & BIT(newtype))) { - err = -EBUSY; - goto out; - } - - if (ctx->exclusive_interface_modes & BIT(newtype)) { - for_each_context(priv, tmp) { - if (ctx == tmp) - continue; - - if (!tmp->is_active) - continue; - - /* - * The current mode switch would be exclusive, but - * another context is active ... refuse the switch. - */ - err = -EBUSY; - goto out; - } - } - - /* success */ - iwl_teardown_interface(priv, vif, true); - vif->type = newviftype; - vif->p2p = newp2p; - err = iwl_setup_interface(priv, ctx); - WARN_ON(err); - /* - * We've switched internally, but submitting to the - * device may have failed for some reason. Mask this - * error, because otherwise mac80211 will not switch - * (and set the interface type back) and we'll be - * out of sync with it. - */ - err = 0; - - out: - mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); - - return err; -} - -static int iwlagn_mac_hw_scan(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct cfg80211_scan_request *req) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - int ret; - - IWL_DEBUG_MAC80211(priv, "enter\n"); - - if (req->n_channels == 0) - return -EINVAL; - - mutex_lock(&priv->mutex); - - /* - * If an internal scan is in progress, just set - * up the scan_request as per above. - */ - if (priv->scan_type != IWL_SCAN_NORMAL) { - IWL_DEBUG_SCAN(priv, - "SCAN request during internal scan - defer\n"); - priv->scan_request = req; - priv->scan_vif = vif; - ret = 0; - } else { - priv->scan_request = req; - priv->scan_vif = vif; - /* - * mac80211 will only ask for one band at a time - * so using channels[0] here is ok - */ - ret = iwl_scan_initiate(priv, vif, IWL_SCAN_NORMAL, - req->channels[0]->band); - if (ret) { - priv->scan_request = NULL; - priv->scan_vif = NULL; - } - } - - IWL_DEBUG_MAC80211(priv, "leave\n"); - - mutex_unlock(&priv->mutex); - - return ret; -} - -static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id) -{ - struct iwl_addsta_cmd cmd = { - .mode = STA_CONTROL_MODIFY_MSK, - .station_flags_msk = STA_FLG_PWR_SAVE_MSK, - .sta.sta_id = sta_id, - }; - - iwl_send_add_sta(priv, &cmd, CMD_ASYNC); -} - -static void iwlagn_mac_sta_notify(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum sta_notify_cmd cmd, - struct ieee80211_sta *sta) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; - int sta_id; - - IWL_DEBUG_MAC80211(priv, "enter\n"); - - switch (cmd) { - case STA_NOTIFY_SLEEP: - WARN_ON(!sta_priv->client); - sta_priv->asleep = true; - if (atomic_read(&sta_priv->pending_frames) > 0) - ieee80211_sta_block_awake(hw, sta, true); - break; - case STA_NOTIFY_AWAKE: - WARN_ON(!sta_priv->client); - if (!sta_priv->asleep) - break; - sta_priv->asleep = false; - sta_id = iwl_sta_id(sta); - if (sta_id != IWL_INVALID_STATION) - iwl_sta_modify_ps_wake(priv, sta_id); - break; - default: - break; - } - IWL_DEBUG_MAC80211(priv, "leave\n"); -} - -struct ieee80211_ops iwlagn_hw_ops = { - .tx = iwlagn_mac_tx, - .start = iwlagn_mac_start, - .stop = iwlagn_mac_stop, -#ifdef CONFIG_PM_SLEEP - .suspend = iwlagn_mac_suspend, - .resume = iwlagn_mac_resume, - .set_wakeup = iwlagn_mac_set_wakeup, -#endif - .add_interface = iwlagn_mac_add_interface, - .remove_interface = iwlagn_mac_remove_interface, - .change_interface = iwlagn_mac_change_interface, - .config = iwlagn_mac_config, - .configure_filter = iwlagn_configure_filter, - .set_key = iwlagn_mac_set_key, - .update_tkip_key = iwlagn_mac_update_tkip_key, - .set_rekey_data = iwlagn_mac_set_rekey_data, - .conf_tx = iwlagn_mac_conf_tx, - .bss_info_changed = iwlagn_bss_info_changed, - .ampdu_action = iwlagn_mac_ampdu_action, - .hw_scan = iwlagn_mac_hw_scan, - .sta_notify = iwlagn_mac_sta_notify, - .sta_state = iwlagn_mac_sta_state, - .channel_switch = iwlagn_mac_channel_switch, - .flush = iwlagn_mac_flush, - .tx_last_beacon = iwlagn_mac_tx_last_beacon, - .remain_on_channel = iwlagn_mac_remain_on_channel, - .cancel_remain_on_channel = iwlagn_mac_cancel_remain_on_channel, - .rssi_callback = iwlagn_mac_rssi_callback, - CFG80211_TESTMODE_CMD(iwlagn_mac_testmode_cmd) - CFG80211_TESTMODE_DUMP(iwlagn_mac_testmode_dump) - .set_tim = iwlagn_mac_set_tim, -}; - -/* This function both allocates and initializes hw and priv. */ -struct ieee80211_hw *iwl_alloc_all(void) -{ - struct iwl_priv *priv; - struct iwl_op_mode *op_mode; - /* mac80211 allocates memory for this device instance, including - * space for this driver's private structure */ - struct ieee80211_hw *hw; - - hw = ieee80211_alloc_hw(sizeof(struct iwl_priv) + - sizeof(struct iwl_op_mode), &iwlagn_hw_ops); - if (!hw) - goto out; - - op_mode = hw->priv; - priv = IWL_OP_MODE_GET_DVM(op_mode); - priv->hw = hw; - -out: - return hw; -} diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c deleted file mode 100644 index a8afc7bee545..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/main.c +++ /dev/null @@ -1,2170 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portions of the ieee80211 subsystem header files. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "iwl-eeprom-read.h" -#include "iwl-eeprom-parse.h" -#include "iwl-io.h" -#include "iwl-trans.h" -#include "iwl-op-mode.h" -#include "iwl-drv.h" -#include "iwl-modparams.h" -#include "iwl-prph.h" - -#include "dev.h" -#include "calib.h" -#include "agn.h" - - -/****************************************************************************** - * - * module boiler plate - * - ******************************************************************************/ - -/* - * module name, copyright, version, etc. - */ -#define DRV_DESCRIPTION "Intel(R) Wireless WiFi Link AGN driver for Linux" - -#ifdef CONFIG_IWLWIFI_DEBUG -#define VD "d" -#else -#define VD -#endif - -#define DRV_VERSION IWLWIFI_VERSION VD - - -MODULE_DESCRIPTION(DRV_DESCRIPTION); -MODULE_VERSION(DRV_VERSION); -MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); -MODULE_LICENSE("GPL"); - -static const struct iwl_op_mode_ops iwl_dvm_ops; - -void iwl_update_chain_flags(struct iwl_priv *priv) -{ - struct iwl_rxon_context *ctx; - - for_each_context(priv, ctx) { - iwlagn_set_rxon_chain(priv, ctx); - if (ctx->active.rx_chain != ctx->staging.rx_chain) - iwlagn_commit_rxon(priv, ctx); - } -} - -/* Parse the beacon frame to find the TIM element and set tim_idx & tim_size */ -static void iwl_set_beacon_tim(struct iwl_priv *priv, - struct iwl_tx_beacon_cmd *tx_beacon_cmd, - u8 *beacon, u32 frame_size) -{ - u16 tim_idx; - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)beacon; - - /* - * The index is relative to frame start but we start looking at the - * variable-length part of the beacon. - */ - tim_idx = mgmt->u.beacon.variable - beacon; - - /* Parse variable-length elements of beacon to find WLAN_EID_TIM */ - while ((tim_idx < (frame_size - 2)) && - (beacon[tim_idx] != WLAN_EID_TIM)) - tim_idx += beacon[tim_idx+1] + 2; - - /* If TIM field was found, set variables */ - if ((tim_idx < (frame_size - 1)) && (beacon[tim_idx] == WLAN_EID_TIM)) { - tx_beacon_cmd->tim_idx = cpu_to_le16(tim_idx); - tx_beacon_cmd->tim_size = beacon[tim_idx+1]; - } else - IWL_WARN(priv, "Unable to find TIM Element in beacon\n"); -} - -int iwlagn_send_beacon_cmd(struct iwl_priv *priv) -{ - struct iwl_tx_beacon_cmd *tx_beacon_cmd; - struct iwl_host_cmd cmd = { - .id = REPLY_TX_BEACON, - .flags = CMD_SYNC, - }; - struct ieee80211_tx_info *info; - u32 frame_size; - u32 rate_flags; - u32 rate; - - /* - * We have to set up the TX command, the TX Beacon command, and the - * beacon contents. - */ - - lockdep_assert_held(&priv->mutex); - - if (!priv->beacon_ctx) { - IWL_ERR(priv, "trying to build beacon w/o beacon context!\n"); - return 0; - } - - if (WARN_ON(!priv->beacon_skb)) - return -EINVAL; - - /* Allocate beacon command */ - if (!priv->beacon_cmd) - priv->beacon_cmd = kzalloc(sizeof(*tx_beacon_cmd), GFP_KERNEL); - tx_beacon_cmd = priv->beacon_cmd; - if (!tx_beacon_cmd) - return -ENOMEM; - - frame_size = priv->beacon_skb->len; - - /* Set up TX command fields */ - tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); - tx_beacon_cmd->tx.sta_id = priv->beacon_ctx->bcast_sta_id; - tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; - tx_beacon_cmd->tx.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK | - TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK; - - /* Set up TX beacon command fields */ - iwl_set_beacon_tim(priv, tx_beacon_cmd, priv->beacon_skb->data, - frame_size); - - /* Set up packet rate and flags */ - info = IEEE80211_SKB_CB(priv->beacon_skb); - - /* - * Let's set up the rate at least somewhat correctly; - * it will currently not actually be used by the uCode, - * it uses the broadcast station's rate instead. - */ - if (info->control.rates[0].idx < 0 || - info->control.rates[0].flags & IEEE80211_TX_RC_MCS) - rate = 0; - else - rate = info->control.rates[0].idx; - - priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, - priv->nvm_data->valid_tx_ant); - rate_flags = iwl_ant_idx_to_flags(priv->mgmt_tx_ant); - - /* In mac80211, rates for 5 GHz start at 0 */ - if (info->band == IEEE80211_BAND_5GHZ) - rate += IWL_FIRST_OFDM_RATE; - else if (rate >= IWL_FIRST_CCK_RATE && rate <= IWL_LAST_CCK_RATE) - rate_flags |= RATE_MCS_CCK_MSK; - - tx_beacon_cmd->tx.rate_n_flags = - iwl_hw_set_rate_n_flags(rate, rate_flags); - - /* Submit command */ - cmd.len[0] = sizeof(*tx_beacon_cmd); - cmd.data[0] = tx_beacon_cmd; - cmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY; - cmd.len[1] = frame_size; - cmd.data[1] = priv->beacon_skb->data; - cmd.dataflags[1] = IWL_HCMD_DFL_NOCOPY; - - return iwl_dvm_send_cmd(priv, &cmd); -} - -static void iwl_bg_beacon_update(struct work_struct *work) -{ - struct iwl_priv *priv = - container_of(work, struct iwl_priv, beacon_update); - struct sk_buff *beacon; - - mutex_lock(&priv->mutex); - if (!priv->beacon_ctx) { - IWL_ERR(priv, "updating beacon w/o beacon context!\n"); - goto out; - } - - if (priv->beacon_ctx->vif->type != NL80211_IFTYPE_AP) { - /* - * The ucode will send beacon notifications even in - * IBSS mode, but we don't want to process them. But - * we need to defer the type check to here due to - * requiring locking around the beacon_ctx access. - */ - goto out; - } - - /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ - beacon = ieee80211_beacon_get(priv->hw, priv->beacon_ctx->vif); - if (!beacon) { - IWL_ERR(priv, "update beacon failed -- keeping old\n"); - goto out; - } - - /* new beacon skb is allocated every time; dispose previous.*/ - dev_kfree_skb(priv->beacon_skb); - - priv->beacon_skb = beacon; - - iwlagn_send_beacon_cmd(priv); - out: - mutex_unlock(&priv->mutex); -} - -static void iwl_bg_bt_runtime_config(struct work_struct *work) -{ - struct iwl_priv *priv = - container_of(work, struct iwl_priv, bt_runtime_config); - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - /* dont send host command if rf-kill is on */ - if (!iwl_is_ready_rf(priv)) - return; - iwlagn_send_advance_bt_config(priv); -} - -static void iwl_bg_bt_full_concurrency(struct work_struct *work) -{ - struct iwl_priv *priv = - container_of(work, struct iwl_priv, bt_full_concurrency); - struct iwl_rxon_context *ctx; - - mutex_lock(&priv->mutex); - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - goto out; - - /* dont send host command if rf-kill is on */ - if (!iwl_is_ready_rf(priv)) - goto out; - - IWL_DEBUG_INFO(priv, "BT coex in %s mode\n", - priv->bt_full_concurrent ? - "full concurrency" : "3-wire"); - - /* - * LQ & RXON updated cmds must be sent before BT Config cmd - * to avoid 3-wire collisions - */ - for_each_context(priv, ctx) { - iwlagn_set_rxon_chain(priv, ctx); - iwlagn_commit_rxon(priv, ctx); - } - - iwlagn_send_advance_bt_config(priv); -out: - mutex_unlock(&priv->mutex); -} - -int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags, bool clear) -{ - struct iwl_statistics_cmd statistics_cmd = { - .configuration_flags = - clear ? IWL_STATS_CONF_CLEAR_STATS : 0, - }; - - if (flags & CMD_ASYNC) - return iwl_dvm_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, - CMD_ASYNC, - sizeof(struct iwl_statistics_cmd), - &statistics_cmd); - else - return iwl_dvm_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, - CMD_SYNC, - sizeof(struct iwl_statistics_cmd), - &statistics_cmd); -} - -/** - * iwl_bg_statistics_periodic - Timer callback to queue statistics - * - * This callback is provided in order to send a statistics request. - * - * This timer function is continually reset to execute within - * REG_RECALIB_PERIOD seconds since the last STATISTICS_NOTIFICATION - * was received. We need to ensure we receive the statistics in order - * to update the temperature used for calibrating the TXPOWER. - */ -static void iwl_bg_statistics_periodic(unsigned long data) -{ - struct iwl_priv *priv = (struct iwl_priv *)data; - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - /* dont send host command if rf-kill is on */ - if (!iwl_is_ready_rf(priv)) - return; - - iwl_send_statistics_request(priv, CMD_ASYNC, false); -} - - -static void iwl_print_cont_event_trace(struct iwl_priv *priv, u32 base, - u32 start_idx, u32 num_events, - u32 capacity, u32 mode) -{ - u32 i; - u32 ptr; /* SRAM byte address of log data */ - u32 ev, time, data; /* event log data */ - unsigned long reg_flags; - - if (mode == 0) - ptr = base + (4 * sizeof(u32)) + (start_idx * 2 * sizeof(u32)); - else - ptr = base + (4 * sizeof(u32)) + (start_idx * 3 * sizeof(u32)); - - /* Make sure device is powered up for SRAM reads */ - if (!iwl_trans_grab_nic_access(priv->trans, false, ®_flags)) - return; - - /* Set starting address; reads will auto-increment */ - iwl_write32(priv->trans, HBUS_TARG_MEM_RADDR, ptr); - - /* - * Refuse to read more than would have fit into the log from - * the current start_idx. This used to happen due to the race - * described below, but now WARN because the code below should - * prevent it from happening here. - */ - if (WARN_ON(num_events > capacity - start_idx)) - num_events = capacity - start_idx; - - /* - * "time" is actually "data" for mode 0 (no timestamp). - * place event id # at far right for easier visual parsing. - */ - for (i = 0; i < num_events; i++) { - ev = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT); - time = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT); - if (mode == 0) { - trace_iwlwifi_dev_ucode_cont_event( - priv->trans->dev, 0, time, ev); - } else { - data = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT); - trace_iwlwifi_dev_ucode_cont_event( - priv->trans->dev, time, data, ev); - } - } - /* Allow device to power down */ - iwl_trans_release_nic_access(priv->trans, ®_flags); -} - -static void iwl_continuous_event_trace(struct iwl_priv *priv) -{ - u32 capacity; /* event log capacity in # entries */ - struct { - u32 capacity; - u32 mode; - u32 wrap_counter; - u32 write_counter; - } __packed read; - u32 base; /* SRAM byte address of event log header */ - u32 mode; /* 0 - no timestamp, 1 - timestamp recorded */ - u32 num_wraps; /* # times uCode wrapped to top of log */ - u32 next_entry; /* index of next entry to be written by uCode */ - - base = priv->device_pointers.log_event_table; - if (iwlagn_hw_valid_rtc_data_addr(base)) { - iwl_trans_read_mem_bytes(priv->trans, base, - &read, sizeof(read)); - capacity = read.capacity; - mode = read.mode; - num_wraps = read.wrap_counter; - next_entry = read.write_counter; - } else - return; - - /* - * Unfortunately, the uCode doesn't use temporary variables. - * Therefore, it can happen that we read next_entry == capacity, - * which really means next_entry == 0. - */ - if (unlikely(next_entry == capacity)) - next_entry = 0; - /* - * Additionally, the uCode increases the write pointer before - * the wraps counter, so if the write pointer is smaller than - * the old write pointer (wrap occurred) but we read that no - * wrap occurred, we actually read between the next_entry and - * num_wraps update (this does happen in practice!!) -- take - * that into account by increasing num_wraps. - */ - if (unlikely(next_entry < priv->event_log.next_entry && - num_wraps == priv->event_log.num_wraps)) - num_wraps++; - - if (num_wraps == priv->event_log.num_wraps) { - iwl_print_cont_event_trace( - priv, base, priv->event_log.next_entry, - next_entry - priv->event_log.next_entry, - capacity, mode); - - priv->event_log.non_wraps_count++; - } else { - if (num_wraps - priv->event_log.num_wraps > 1) - priv->event_log.wraps_more_count++; - else - priv->event_log.wraps_once_count++; - - trace_iwlwifi_dev_ucode_wrap_event(priv->trans->dev, - num_wraps - priv->event_log.num_wraps, - next_entry, priv->event_log.next_entry); - - if (next_entry < priv->event_log.next_entry) { - iwl_print_cont_event_trace( - priv, base, priv->event_log.next_entry, - capacity - priv->event_log.next_entry, - capacity, mode); - - iwl_print_cont_event_trace( - priv, base, 0, next_entry, capacity, mode); - } else { - iwl_print_cont_event_trace( - priv, base, next_entry, - capacity - next_entry, - capacity, mode); - - iwl_print_cont_event_trace( - priv, base, 0, next_entry, capacity, mode); - } - } - - priv->event_log.num_wraps = num_wraps; - priv->event_log.next_entry = next_entry; -} - -/** - * iwl_bg_ucode_trace - Timer callback to log ucode event - * - * The timer is continually set to execute every - * UCODE_TRACE_PERIOD milliseconds after the last timer expired - * this function is to perform continuous uCode event logging operation - * if enabled - */ -static void iwl_bg_ucode_trace(unsigned long data) -{ - struct iwl_priv *priv = (struct iwl_priv *)data; - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - if (priv->event_log.ucode_trace) { - iwl_continuous_event_trace(priv); - /* Reschedule the timer to occur in UCODE_TRACE_PERIOD */ - mod_timer(&priv->ucode_trace, - jiffies + msecs_to_jiffies(UCODE_TRACE_PERIOD)); - } -} - -static void iwl_bg_tx_flush(struct work_struct *work) -{ - struct iwl_priv *priv = - container_of(work, struct iwl_priv, tx_flush); - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - /* do nothing if rf-kill is on */ - if (!iwl_is_ready_rf(priv)) - return; - - IWL_DEBUG_INFO(priv, "device request: flush all tx frames\n"); - iwlagn_dev_txfifo_flush(priv); -} - -/* - * queue/FIFO/AC mapping definitions - */ - -static const u8 iwlagn_bss_ac_to_fifo[] = { - IWL_TX_FIFO_VO, - IWL_TX_FIFO_VI, - IWL_TX_FIFO_BE, - IWL_TX_FIFO_BK, -}; - -static const u8 iwlagn_bss_ac_to_queue[] = { - 0, 1, 2, 3, -}; - -static const u8 iwlagn_pan_ac_to_fifo[] = { - IWL_TX_FIFO_VO_IPAN, - IWL_TX_FIFO_VI_IPAN, - IWL_TX_FIFO_BE_IPAN, - IWL_TX_FIFO_BK_IPAN, -}; - -static const u8 iwlagn_pan_ac_to_queue[] = { - 7, 6, 5, 4, -}; - -static void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags) -{ - int i; - - /* - * The default context is always valid, - * the PAN context depends on uCode. - */ - priv->valid_contexts = BIT(IWL_RXON_CTX_BSS); - if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) - priv->valid_contexts |= BIT(IWL_RXON_CTX_PAN); - - for (i = 0; i < NUM_IWL_RXON_CTX; i++) - priv->contexts[i].ctxid = i; - - priv->contexts[IWL_RXON_CTX_BSS].always_active = true; - priv->contexts[IWL_RXON_CTX_BSS].is_active = true; - priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON; - priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING; - priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC; - priv->contexts[IWL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM; - priv->contexts[IWL_RXON_CTX_BSS].ap_sta_id = IWL_AP_ID; - priv->contexts[IWL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY; - priv->contexts[IWL_RXON_CTX_BSS].bcast_sta_id = IWLAGN_BROADCAST_ID; - priv->contexts[IWL_RXON_CTX_BSS].exclusive_interface_modes = - BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_MONITOR); - priv->contexts[IWL_RXON_CTX_BSS].interface_modes = - BIT(NL80211_IFTYPE_STATION); - priv->contexts[IWL_RXON_CTX_BSS].ap_devtype = RXON_DEV_TYPE_AP; - priv->contexts[IWL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS; - priv->contexts[IWL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS; - priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS; - memcpy(priv->contexts[IWL_RXON_CTX_BSS].ac_to_queue, - iwlagn_bss_ac_to_queue, sizeof(iwlagn_bss_ac_to_queue)); - memcpy(priv->contexts[IWL_RXON_CTX_BSS].ac_to_fifo, - iwlagn_bss_ac_to_fifo, sizeof(iwlagn_bss_ac_to_fifo)); - - priv->contexts[IWL_RXON_CTX_PAN].rxon_cmd = REPLY_WIPAN_RXON; - priv->contexts[IWL_RXON_CTX_PAN].rxon_timing_cmd = - REPLY_WIPAN_RXON_TIMING; - priv->contexts[IWL_RXON_CTX_PAN].rxon_assoc_cmd = - REPLY_WIPAN_RXON_ASSOC; - priv->contexts[IWL_RXON_CTX_PAN].qos_cmd = REPLY_WIPAN_QOS_PARAM; - priv->contexts[IWL_RXON_CTX_PAN].ap_sta_id = IWL_AP_ID_PAN; - priv->contexts[IWL_RXON_CTX_PAN].wep_key_cmd = REPLY_WIPAN_WEPKEY; - priv->contexts[IWL_RXON_CTX_PAN].bcast_sta_id = IWLAGN_PAN_BCAST_ID; - priv->contexts[IWL_RXON_CTX_PAN].station_flags = STA_FLG_PAN_STATION; - priv->contexts[IWL_RXON_CTX_PAN].interface_modes = - BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP); - - if (ucode_flags & IWL_UCODE_TLV_FLAGS_P2P) - priv->contexts[IWL_RXON_CTX_PAN].interface_modes |= - BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_P2P_GO); - - priv->contexts[IWL_RXON_CTX_PAN].ap_devtype = RXON_DEV_TYPE_CP; - priv->contexts[IWL_RXON_CTX_PAN].station_devtype = RXON_DEV_TYPE_2STA; - priv->contexts[IWL_RXON_CTX_PAN].unused_devtype = RXON_DEV_TYPE_P2P; - memcpy(priv->contexts[IWL_RXON_CTX_PAN].ac_to_queue, - iwlagn_pan_ac_to_queue, sizeof(iwlagn_pan_ac_to_queue)); - memcpy(priv->contexts[IWL_RXON_CTX_PAN].ac_to_fifo, - iwlagn_pan_ac_to_fifo, sizeof(iwlagn_pan_ac_to_fifo)); - priv->contexts[IWL_RXON_CTX_PAN].mcast_queue = IWL_IPAN_MCAST_QUEUE; - - BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); -} - -static void iwl_rf_kill_ct_config(struct iwl_priv *priv) -{ - struct iwl_ct_kill_config cmd; - struct iwl_ct_kill_throttling_config adv_cmd; - int ret = 0; - - iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_CLR, - CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); - - priv->thermal_throttle.ct_kill_toggle = false; - - if (priv->cfg->base_params->support_ct_kill_exit) { - adv_cmd.critical_temperature_enter = - cpu_to_le32(priv->hw_params.ct_kill_threshold); - adv_cmd.critical_temperature_exit = - cpu_to_le32(priv->hw_params.ct_kill_exit_threshold); - - ret = iwl_dvm_send_cmd_pdu(priv, - REPLY_CT_KILL_CONFIG_CMD, - CMD_SYNC, sizeof(adv_cmd), &adv_cmd); - if (ret) - IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); - else - IWL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD " - "succeeded, critical temperature enter is %d," - "exit is %d\n", - priv->hw_params.ct_kill_threshold, - priv->hw_params.ct_kill_exit_threshold); - } else { - cmd.critical_temperature_R = - cpu_to_le32(priv->hw_params.ct_kill_threshold); - - ret = iwl_dvm_send_cmd_pdu(priv, - REPLY_CT_KILL_CONFIG_CMD, - CMD_SYNC, sizeof(cmd), &cmd); - if (ret) - IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n"); - else - IWL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD " - "succeeded, " - "critical temperature is %d\n", - priv->hw_params.ct_kill_threshold); - } -} - -static int iwlagn_send_calib_cfg_rt(struct iwl_priv *priv, u32 cfg) -{ - struct iwl_calib_cfg_cmd calib_cfg_cmd; - struct iwl_host_cmd cmd = { - .id = CALIBRATION_CFG_CMD, - .len = { sizeof(struct iwl_calib_cfg_cmd), }, - .data = { &calib_cfg_cmd, }, - }; - - memset(&calib_cfg_cmd, 0, sizeof(calib_cfg_cmd)); - calib_cfg_cmd.ucd_calib_cfg.once.is_enable = IWL_CALIB_RT_CFG_ALL; - calib_cfg_cmd.ucd_calib_cfg.once.start = cpu_to_le32(cfg); - - return iwl_dvm_send_cmd(priv, &cmd); -} - - -static int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant) -{ - struct iwl_tx_ant_config_cmd tx_ant_cmd = { - .valid = cpu_to_le32(valid_tx_ant), - }; - - if (IWL_UCODE_API(priv->fw->ucode_ver) > 1) { - IWL_DEBUG_HC(priv, "select valid tx ant: %u\n", valid_tx_ant); - return iwl_dvm_send_cmd_pdu(priv, - TX_ANT_CONFIGURATION_CMD, - CMD_SYNC, - sizeof(struct iwl_tx_ant_config_cmd), - &tx_ant_cmd); - } else { - IWL_DEBUG_HC(priv, "TX_ANT_CONFIGURATION_CMD not supported\n"); - return -EOPNOTSUPP; - } -} - -static void iwl_send_bt_config(struct iwl_priv *priv) -{ - struct iwl_bt_cmd bt_cmd = { - .lead_time = BT_LEAD_TIME_DEF, - .max_kill = BT_MAX_KILL_DEF, - .kill_ack_mask = 0, - .kill_cts_mask = 0, - }; - - if (!iwlwifi_mod_params.bt_coex_active) - bt_cmd.flags = BT_COEX_DISABLE; - else - bt_cmd.flags = BT_COEX_ENABLE; - - priv->bt_enable_flag = bt_cmd.flags; - IWL_DEBUG_INFO(priv, "BT coex %s\n", - (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active"); - - if (iwl_dvm_send_cmd_pdu(priv, REPLY_BT_CONFIG, - CMD_SYNC, sizeof(struct iwl_bt_cmd), &bt_cmd)) - IWL_ERR(priv, "failed to send BT Coex Config\n"); -} - -/** - * iwl_alive_start - called after REPLY_ALIVE notification received - * from protocol/runtime uCode (initialization uCode's - * Alive gets handled by iwl_init_alive_start()). - */ -int iwl_alive_start(struct iwl_priv *priv) -{ - int ret = 0; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - - IWL_DEBUG_INFO(priv, "Runtime Alive received.\n"); - - /* After the ALIVE response, we can send host commands to the uCode */ - set_bit(STATUS_ALIVE, &priv->status); - - if (iwl_is_rfkill(priv)) - return -ERFKILL; - - if (priv->event_log.ucode_trace) { - /* start collecting data now */ - mod_timer(&priv->ucode_trace, jiffies); - } - - /* download priority table before any calibration request */ - if (priv->cfg->bt_params && - priv->cfg->bt_params->advanced_bt_coexist) { - /* Configure Bluetooth device coexistence support */ - if (priv->cfg->bt_params->bt_sco_disable) - priv->bt_enable_pspoll = false; - else - priv->bt_enable_pspoll = true; - - priv->bt_valid = IWLAGN_BT_ALL_VALID_MSK; - priv->kill_ack_mask = IWLAGN_BT_KILL_ACK_MASK_DEFAULT; - priv->kill_cts_mask = IWLAGN_BT_KILL_CTS_MASK_DEFAULT; - iwlagn_send_advance_bt_config(priv); - priv->bt_valid = IWLAGN_BT_VALID_ENABLE_FLAGS; - priv->cur_rssi_ctx = NULL; - - iwl_send_prio_tbl(priv); - - /* FIXME: w/a to force change uCode BT state machine */ - ret = iwl_send_bt_env(priv, IWL_BT_COEX_ENV_OPEN, - BT_COEX_PRIO_TBL_EVT_INIT_CALIB2); - if (ret) - return ret; - ret = iwl_send_bt_env(priv, IWL_BT_COEX_ENV_CLOSE, - BT_COEX_PRIO_TBL_EVT_INIT_CALIB2); - if (ret) - return ret; - } else if (priv->cfg->bt_params) { - /* - * default is 2-wire BT coexexistence support - */ - iwl_send_bt_config(priv); - } - - /* - * Perform runtime calibrations, including DC calibration. - */ - iwlagn_send_calib_cfg_rt(priv, IWL_CALIB_CFG_DC_IDX); - - ieee80211_wake_queues(priv->hw); - - /* Configure Tx antenna selection based on H/W config */ - iwlagn_send_tx_ant_config(priv, priv->nvm_data->valid_tx_ant); - - if (iwl_is_associated_ctx(ctx) && !priv->wowlan) { - struct iwl_rxon_cmd *active_rxon = - (struct iwl_rxon_cmd *)&ctx->active; - /* apply any changes in staging */ - ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; - } else { - struct iwl_rxon_context *tmp; - /* Initialize our rx_config data */ - for_each_context(priv, tmp) - iwl_connection_init_rx_config(priv, tmp); - - iwlagn_set_rxon_chain(priv, ctx); - } - - if (!priv->wowlan) { - /* WoWLAN ucode will not reply in the same way, skip it */ - iwl_reset_run_time_calib(priv); - } - - set_bit(STATUS_READY, &priv->status); - - /* Configure the adapter for unassociated operation */ - ret = iwlagn_commit_rxon(priv, ctx); - if (ret) - return ret; - - /* At this point, the NIC is initialized and operational */ - iwl_rf_kill_ct_config(priv); - - IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); - - return iwl_power_update_mode(priv, true); -} - -/** - * iwl_clear_driver_stations - clear knowledge of all stations from driver - * @priv: iwl priv struct - * - * This is called during iwl_down() to make sure that in the case - * we're coming there from a hardware restart mac80211 will be - * able to reconfigure stations -- if we're getting there in the - * normal down flow then the stations will already be cleared. - */ -static void iwl_clear_driver_stations(struct iwl_priv *priv) -{ - struct iwl_rxon_context *ctx; - - spin_lock_bh(&priv->sta_lock); - memset(priv->stations, 0, sizeof(priv->stations)); - priv->num_stations = 0; - - priv->ucode_key_table = 0; - - for_each_context(priv, ctx) { - /* - * Remove all key information that is not stored as part - * of station information since mac80211 may not have had - * a chance to remove all the keys. When device is - * reconfigured by mac80211 after an error all keys will - * be reconfigured. - */ - memset(ctx->wep_keys, 0, sizeof(ctx->wep_keys)); - ctx->key_mapping_keys = 0; - } - - spin_unlock_bh(&priv->sta_lock); -} - -void iwl_down(struct iwl_priv *priv) -{ - int exit_pending; - - IWL_DEBUG_INFO(priv, DRV_NAME " is going down\n"); - - lockdep_assert_held(&priv->mutex); - - iwl_scan_cancel_timeout(priv, 200); - - /* - * If active, scanning won't cancel it, so say it expired. - * No race since we hold the mutex here and a new one - * can't come in at this time. - */ - if (priv->ucode_loaded && priv->cur_ucode != IWL_UCODE_INIT) - ieee80211_remain_on_channel_expired(priv->hw); - - exit_pending = - test_and_set_bit(STATUS_EXIT_PENDING, &priv->status); - - iwl_clear_ucode_stations(priv, NULL); - iwl_dealloc_bcast_stations(priv); - iwl_clear_driver_stations(priv); - - /* reset BT coex data */ - priv->bt_status = 0; - priv->cur_rssi_ctx = NULL; - priv->bt_is_sco = 0; - if (priv->cfg->bt_params) - priv->bt_traffic_load = - priv->cfg->bt_params->bt_init_traffic_load; - else - priv->bt_traffic_load = 0; - priv->bt_full_concurrent = false; - priv->bt_ci_compliance = 0; - - /* Wipe out the EXIT_PENDING status bit if we are not actually - * exiting the module */ - if (!exit_pending) - clear_bit(STATUS_EXIT_PENDING, &priv->status); - - if (priv->mac80211_registered) - ieee80211_stop_queues(priv->hw); - - priv->ucode_loaded = false; - iwl_trans_stop_device(priv->trans); - - /* Set num_aux_in_flight must be done after the transport is stopped */ - atomic_set(&priv->num_aux_in_flight, 0); - - /* Clear out all status bits but a few that are stable across reset */ - priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << - STATUS_RF_KILL_HW | - test_bit(STATUS_FW_ERROR, &priv->status) << - STATUS_FW_ERROR | - test_bit(STATUS_EXIT_PENDING, &priv->status) << - STATUS_EXIT_PENDING; - - dev_kfree_skb(priv->beacon_skb); - priv->beacon_skb = NULL; -} - -/***************************************************************************** - * - * Workqueue callbacks - * - *****************************************************************************/ - -static void iwl_bg_run_time_calib_work(struct work_struct *work) -{ - struct iwl_priv *priv = container_of(work, struct iwl_priv, - run_time_calib_work); - - mutex_lock(&priv->mutex); - - if (test_bit(STATUS_EXIT_PENDING, &priv->status) || - test_bit(STATUS_SCANNING, &priv->status)) { - mutex_unlock(&priv->mutex); - return; - } - - if (priv->start_calib) { - iwl_chain_noise_calibration(priv); - iwl_sensitivity_calibration(priv); - } - - mutex_unlock(&priv->mutex); -} - -void iwlagn_prepare_restart(struct iwl_priv *priv) -{ - bool bt_full_concurrent; - u8 bt_ci_compliance; - u8 bt_load; - u8 bt_status; - bool bt_is_sco; - int i; - - lockdep_assert_held(&priv->mutex); - - priv->is_open = 0; - - /* - * __iwl_down() will clear the BT status variables, - * which is correct, but when we restart we really - * want to keep them so restore them afterwards. - * - * The restart process will later pick them up and - * re-configure the hw when we reconfigure the BT - * command. - */ - bt_full_concurrent = priv->bt_full_concurrent; - bt_ci_compliance = priv->bt_ci_compliance; - bt_load = priv->bt_traffic_load; - bt_status = priv->bt_status; - bt_is_sco = priv->bt_is_sco; - - iwl_down(priv); - - priv->bt_full_concurrent = bt_full_concurrent; - priv->bt_ci_compliance = bt_ci_compliance; - priv->bt_traffic_load = bt_load; - priv->bt_status = bt_status; - priv->bt_is_sco = bt_is_sco; - - /* reset aggregation queues */ - for (i = IWLAGN_FIRST_AMPDU_QUEUE; i < IWL_MAX_HW_QUEUES; i++) - priv->queue_to_mac80211[i] = IWL_INVALID_MAC80211_QUEUE; - /* and stop counts */ - for (i = 0; i < IWL_MAX_HW_QUEUES; i++) - atomic_set(&priv->queue_stop_count[i], 0); - - memset(priv->agg_q_alloc, 0, sizeof(priv->agg_q_alloc)); -} - -static void iwl_bg_restart(struct work_struct *data) -{ - struct iwl_priv *priv = container_of(data, struct iwl_priv, restart); - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { - mutex_lock(&priv->mutex); - iwlagn_prepare_restart(priv); - mutex_unlock(&priv->mutex); - iwl_cancel_deferred_work(priv); - if (priv->mac80211_registered) - ieee80211_restart_hw(priv->hw); - else - IWL_ERR(priv, - "Cannot request restart before registrating with mac80211"); - } else { - WARN_ON(1); - } -} - - - - -void iwlagn_disable_roc(struct iwl_priv *priv) -{ - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_PAN]; - - lockdep_assert_held(&priv->mutex); - - if (!priv->hw_roc_setup) - return; - - ctx->staging.dev_type = RXON_DEV_TYPE_P2P; - ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - - priv->hw_roc_channel = NULL; - - memset(ctx->staging.node_addr, 0, ETH_ALEN); - - iwlagn_commit_rxon(priv, ctx); - - ctx->is_active = false; - priv->hw_roc_setup = false; -} - -static void iwlagn_disable_roc_work(struct work_struct *work) -{ - struct iwl_priv *priv = container_of(work, struct iwl_priv, - hw_roc_disable_work.work); - - mutex_lock(&priv->mutex); - iwlagn_disable_roc(priv); - mutex_unlock(&priv->mutex); -} - -/***************************************************************************** - * - * driver setup and teardown - * - *****************************************************************************/ - -static void iwl_setup_deferred_work(struct iwl_priv *priv) -{ - priv->workqueue = create_singlethread_workqueue(DRV_NAME); - - INIT_WORK(&priv->restart, iwl_bg_restart); - INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); - INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work); - INIT_WORK(&priv->tx_flush, iwl_bg_tx_flush); - INIT_WORK(&priv->bt_full_concurrency, iwl_bg_bt_full_concurrency); - INIT_WORK(&priv->bt_runtime_config, iwl_bg_bt_runtime_config); - INIT_DELAYED_WORK(&priv->hw_roc_disable_work, - iwlagn_disable_roc_work); - - iwl_setup_scan_deferred_work(priv); - - if (priv->cfg->bt_params) - iwlagn_bt_setup_deferred_work(priv); - - init_timer(&priv->statistics_periodic); - priv->statistics_periodic.data = (unsigned long)priv; - priv->statistics_periodic.function = iwl_bg_statistics_periodic; - - init_timer(&priv->ucode_trace); - priv->ucode_trace.data = (unsigned long)priv; - priv->ucode_trace.function = iwl_bg_ucode_trace; -} - -void iwl_cancel_deferred_work(struct iwl_priv *priv) -{ - if (priv->cfg->bt_params) - iwlagn_bt_cancel_deferred_work(priv); - - cancel_work_sync(&priv->run_time_calib_work); - cancel_work_sync(&priv->beacon_update); - - iwl_cancel_scan_deferred_work(priv); - - cancel_work_sync(&priv->bt_full_concurrency); - cancel_work_sync(&priv->bt_runtime_config); - cancel_delayed_work_sync(&priv->hw_roc_disable_work); - - del_timer_sync(&priv->statistics_periodic); - del_timer_sync(&priv->ucode_trace); -} - -static int iwl_init_drv(struct iwl_priv *priv) -{ - spin_lock_init(&priv->sta_lock); - - mutex_init(&priv->mutex); - - INIT_LIST_HEAD(&priv->calib_results); - - priv->band = IEEE80211_BAND_2GHZ; - - priv->plcp_delta_threshold = - priv->cfg->base_params->plcp_delta_threshold; - - priv->iw_mode = NL80211_IFTYPE_STATION; - priv->current_ht_config.smps = IEEE80211_SMPS_STATIC; - priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF; - priv->agg_tids_count = 0; - - priv->ucode_owner = IWL_OWNERSHIP_DRIVER; - - priv->rx_statistics_jiffies = jiffies; - - /* Choose which receivers/antennas to use */ - iwlagn_set_rxon_chain(priv, &priv->contexts[IWL_RXON_CTX_BSS]); - - iwl_init_scan_params(priv); - - /* init bt coex */ - if (priv->cfg->bt_params && - priv->cfg->bt_params->advanced_bt_coexist) { - priv->kill_ack_mask = IWLAGN_BT_KILL_ACK_MASK_DEFAULT; - priv->kill_cts_mask = IWLAGN_BT_KILL_CTS_MASK_DEFAULT; - priv->bt_valid = IWLAGN_BT_ALL_VALID_MSK; - priv->bt_on_thresh = BT_ON_THRESHOLD_DEF; - priv->bt_duration = BT_DURATION_LIMIT_DEF; - priv->dynamic_frag_thresh = BT_FRAG_THRESHOLD_DEF; - } - - return 0; -} - -static void iwl_uninit_drv(struct iwl_priv *priv) -{ - kfree(priv->scan_cmd); - kfree(priv->beacon_cmd); - kfree(rcu_dereference_raw(priv->noa_data)); - iwl_calib_free_results(priv); -#ifdef CONFIG_IWLWIFI_DEBUGFS - kfree(priv->wowlan_sram); -#endif -} - -static void iwl_set_hw_params(struct iwl_priv *priv) -{ - if (priv->cfg->ht_params) - priv->hw_params.use_rts_for_aggregation = - priv->cfg->ht_params->use_rts_for_aggregation; - - /* Device-specific setup */ - priv->lib->set_hw_params(priv); -} - - - -/* show what optional capabilities we have */ -static void iwl_option_config(struct iwl_priv *priv) -{ -#ifdef CONFIG_IWLWIFI_DEBUG - IWL_INFO(priv, "CONFIG_IWLWIFI_DEBUG enabled\n"); -#else - IWL_INFO(priv, "CONFIG_IWLWIFI_DEBUG disabled\n"); -#endif - -#ifdef CONFIG_IWLWIFI_DEBUGFS - IWL_INFO(priv, "CONFIG_IWLWIFI_DEBUGFS enabled\n"); -#else - IWL_INFO(priv, "CONFIG_IWLWIFI_DEBUGFS disabled\n"); -#endif - -#ifdef CONFIG_IWLWIFI_DEVICE_TRACING - IWL_INFO(priv, "CONFIG_IWLWIFI_DEVICE_TRACING enabled\n"); -#else - IWL_INFO(priv, "CONFIG_IWLWIFI_DEVICE_TRACING disabled\n"); -#endif - -#ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE - IWL_INFO(priv, "CONFIG_IWLWIFI_DEVICE_TESTMODE enabled\n"); -#else - IWL_INFO(priv, "CONFIG_IWLWIFI_DEVICE_TESTMODE disabled\n"); -#endif - -#ifdef CONFIG_IWLWIFI_P2P - IWL_INFO(priv, "CONFIG_IWLWIFI_P2P enabled\n"); -#else - IWL_INFO(priv, "CONFIG_IWLWIFI_P2P disabled\n"); -#endif -} - -static int iwl_eeprom_init_hw_params(struct iwl_priv *priv) -{ - struct iwl_nvm_data *data = priv->nvm_data; - char *debug_msg; - - if (data->sku_cap_11n_enable && - !priv->cfg->ht_params) { - IWL_ERR(priv, "Invalid 11n configuration\n"); - return -EINVAL; - } - - if (!data->sku_cap_11n_enable && !data->sku_cap_band_24GHz_enable && - !data->sku_cap_band_52GHz_enable) { - IWL_ERR(priv, "Invalid device sku\n"); - return -EINVAL; - } - - debug_msg = "Device SKU: 24GHz %s %s, 52GHz %s %s, 11.n %s %s\n"; - IWL_DEBUG_INFO(priv, debug_msg, - data->sku_cap_band_24GHz_enable ? "" : "NOT", "enabled", - data->sku_cap_band_52GHz_enable ? "" : "NOT", "enabled", - data->sku_cap_11n_enable ? "" : "NOT", "enabled"); - - priv->hw_params.tx_chains_num = - num_of_ant(data->valid_tx_ant); - if (priv->cfg->rx_with_siso_diversity) - priv->hw_params.rx_chains_num = 1; - else - priv->hw_params.rx_chains_num = - num_of_ant(data->valid_rx_ant); - - IWL_DEBUG_INFO(priv, "Valid Tx ant: 0x%X, Valid Rx ant: 0x%X\n", - data->valid_tx_ant, - data->valid_rx_ant); - - return 0; -} - -static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, - const struct iwl_cfg *cfg, - const struct iwl_fw *fw, - struct dentry *dbgfs_dir) -{ - struct iwl_priv *priv; - struct ieee80211_hw *hw; - struct iwl_op_mode *op_mode; - u16 num_mac; - u32 ucode_flags; - struct iwl_trans_config trans_cfg = {}; - static const u8 no_reclaim_cmds[] = { - REPLY_RX_PHY_CMD, - REPLY_RX_MPDU_CMD, - REPLY_COMPRESSED_BA, - STATISTICS_NOTIFICATION, - REPLY_TX, - }; - int i; - - /************************ - * 1. Allocating HW data - ************************/ - hw = iwl_alloc_all(); - if (!hw) { - pr_err("%s: Cannot allocate network device\n", cfg->name); - goto out; - } - - op_mode = hw->priv; - op_mode->ops = &iwl_dvm_ops; - priv = IWL_OP_MODE_GET_DVM(op_mode); - priv->trans = trans; - priv->dev = trans->dev; - priv->cfg = cfg; - priv->fw = fw; - - switch (priv->cfg->device_family) { - case IWL_DEVICE_FAMILY_1000: - case IWL_DEVICE_FAMILY_100: - priv->lib = &iwl1000_lib; - break; - case IWL_DEVICE_FAMILY_2000: - case IWL_DEVICE_FAMILY_105: - priv->lib = &iwl2000_lib; - break; - case IWL_DEVICE_FAMILY_2030: - case IWL_DEVICE_FAMILY_135: - priv->lib = &iwl2030_lib; - break; - case IWL_DEVICE_FAMILY_5000: - priv->lib = &iwl5000_lib; - break; - case IWL_DEVICE_FAMILY_5150: - priv->lib = &iwl5150_lib; - break; - case IWL_DEVICE_FAMILY_6000: - case IWL_DEVICE_FAMILY_6005: - case IWL_DEVICE_FAMILY_6000i: - case IWL_DEVICE_FAMILY_6050: - case IWL_DEVICE_FAMILY_6150: - priv->lib = &iwl6000_lib; - break; - case IWL_DEVICE_FAMILY_6030: - priv->lib = &iwl6030_lib; - break; - default: - break; - } - - if (WARN_ON(!priv->lib)) - goto out_free_hw; - - /* - * Populate the state variables that the transport layer needs - * to know about. - */ - trans_cfg.op_mode = op_mode; - trans_cfg.no_reclaim_cmds = no_reclaim_cmds; - trans_cfg.n_no_reclaim_cmds = ARRAY_SIZE(no_reclaim_cmds); - trans_cfg.rx_buf_size_8k = iwlwifi_mod_params.amsdu_size_8K; - if (!iwlwifi_mod_params.wd_disable) - trans_cfg.queue_watchdog_timeout = - priv->cfg->base_params->wd_timeout; - else - trans_cfg.queue_watchdog_timeout = IWL_WATCHDOG_DISABLED; - trans_cfg.command_names = iwl_dvm_cmd_strings; - trans_cfg.cmd_fifo = IWLAGN_CMD_FIFO_NUM; - - WARN_ON(sizeof(priv->transport_queue_stop) * BITS_PER_BYTE < - priv->cfg->base_params->num_of_queues); - - ucode_flags = fw->ucode_capa.flags; - -#ifndef CONFIG_IWLWIFI_P2P - ucode_flags &= ~IWL_UCODE_TLV_FLAGS_P2P; -#endif - - if (ucode_flags & IWL_UCODE_TLV_FLAGS_PAN) { - priv->sta_key_max_num = STA_KEY_MAX_NUM_PAN; - trans_cfg.cmd_queue = IWL_IPAN_CMD_QUEUE_NUM; - } else { - priv->sta_key_max_num = STA_KEY_MAX_NUM; - trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM; - } - - /* Configure transport layer */ - iwl_trans_configure(priv->trans, &trans_cfg); - - trans->rx_mpdu_cmd = REPLY_RX_MPDU_CMD; - trans->rx_mpdu_cmd_hdr_size = sizeof(struct iwl_rx_mpdu_res_start); - - /* At this point both hw and priv are allocated. */ - - SET_IEEE80211_DEV(priv->hw, priv->trans->dev); - - iwl_option_config(priv); - - IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n"); - - /* is antenna coupling more than 35dB ? */ - priv->bt_ant_couple_ok = - (iwlwifi_mod_params.ant_coupling > - IWL_BT_ANTENNA_COUPLING_THRESHOLD) ? - true : false; - - /* enable/disable bt channel inhibition */ - priv->bt_ch_announce = iwlwifi_mod_params.bt_ch_announce; - IWL_DEBUG_INFO(priv, "BT channel inhibition is %s\n", - (priv->bt_ch_announce) ? "On" : "Off"); - - /* these spin locks will be used in apm_ops.init and EEPROM access - * we should init now - */ - spin_lock_init(&priv->statistics.lock); - - /*********************** - * 2. Read REV register - ***********************/ - IWL_INFO(priv, "Detected %s, REV=0x%X\n", - priv->cfg->name, priv->trans->hw_rev); - - if (iwl_trans_start_hw(priv->trans)) - goto out_free_hw; - - /* Read the EEPROM */ - if (iwl_read_eeprom(priv->trans, &priv->eeprom_blob, - &priv->eeprom_blob_size)) { - IWL_ERR(priv, "Unable to init EEPROM\n"); - goto out_free_hw; - } - - /* Reset chip to save power until we load uCode during "up". */ - iwl_trans_stop_hw(priv->trans, false); - - priv->nvm_data = iwl_parse_eeprom_data(priv->trans->dev, priv->cfg, - priv->eeprom_blob, - priv->eeprom_blob_size); - if (!priv->nvm_data) - goto out_free_eeprom_blob; - - if (iwl_nvm_check_version(priv->nvm_data, priv->trans)) - goto out_free_eeprom; - - if (iwl_eeprom_init_hw_params(priv)) - goto out_free_eeprom; - - /* extract MAC Address */ - memcpy(priv->addresses[0].addr, priv->nvm_data->hw_addr, ETH_ALEN); - IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr); - priv->hw->wiphy->addresses = priv->addresses; - priv->hw->wiphy->n_addresses = 1; - num_mac = priv->nvm_data->n_hw_addrs; - if (num_mac > 1) { - memcpy(priv->addresses[1].addr, priv->addresses[0].addr, - ETH_ALEN); - priv->addresses[1].addr[5]++; - priv->hw->wiphy->n_addresses++; - } - - /************************ - * 4. Setup HW constants - ************************/ - iwl_set_hw_params(priv); - - if (!(priv->nvm_data->sku_cap_ipan_enable)) { - IWL_DEBUG_INFO(priv, "Your EEPROM disabled PAN"); - ucode_flags &= ~IWL_UCODE_TLV_FLAGS_PAN; - /* - * if not PAN, then don't support P2P -- might be a uCode - * packaging bug or due to the eeprom check above - */ - ucode_flags &= ~IWL_UCODE_TLV_FLAGS_P2P; - priv->sta_key_max_num = STA_KEY_MAX_NUM; - trans_cfg.cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM; - - /* Configure transport layer again*/ - iwl_trans_configure(priv->trans, &trans_cfg); - } - - /******************* - * 5. Setup priv - *******************/ - for (i = 0; i < IWL_MAX_HW_QUEUES; i++) { - priv->queue_to_mac80211[i] = IWL_INVALID_MAC80211_QUEUE; - if (i < IWLAGN_FIRST_AMPDU_QUEUE && - i != IWL_DEFAULT_CMD_QUEUE_NUM && - i != IWL_IPAN_CMD_QUEUE_NUM) - priv->queue_to_mac80211[i] = i; - atomic_set(&priv->queue_stop_count[i], 0); - } - - if (iwl_init_drv(priv)) - goto out_free_eeprom; - - /* At this point both hw and priv are initialized. */ - - /******************** - * 6. Setup services - ********************/ - iwl_setup_deferred_work(priv); - iwl_setup_rx_handlers(priv); - iwl_testmode_init(priv); - - iwl_power_initialize(priv); - iwl_tt_initialize(priv); - - snprintf(priv->hw->wiphy->fw_version, - sizeof(priv->hw->wiphy->fw_version), - "%s", fw->fw_version); - - priv->new_scan_threshold_behaviour = - !!(ucode_flags & IWL_UCODE_TLV_FLAGS_NEWSCAN); - - priv->phy_calib_chain_noise_reset_cmd = - fw->ucode_capa.standard_phy_calibration_size; - priv->phy_calib_chain_noise_gain_cmd = - fw->ucode_capa.standard_phy_calibration_size + 1; - - /* initialize all valid contexts */ - iwl_init_context(priv, ucode_flags); - - /************************************************** - * This is still part of probe() in a sense... - * - * 7. Setup and register with mac80211 and debugfs - **************************************************/ - if (iwlagn_mac_setup_register(priv, &fw->ucode_capa)) - goto out_destroy_workqueue; - - if (iwl_dbgfs_register(priv, dbgfs_dir)) - goto out_mac80211_unregister; - - return op_mode; - -out_mac80211_unregister: - iwlagn_mac_unregister(priv); -out_destroy_workqueue: - iwl_tt_exit(priv); - iwl_testmode_free(priv); - iwl_cancel_deferred_work(priv); - destroy_workqueue(priv->workqueue); - priv->workqueue = NULL; - iwl_uninit_drv(priv); -out_free_eeprom_blob: - kfree(priv->eeprom_blob); -out_free_eeprom: - iwl_free_nvm_data(priv->nvm_data); -out_free_hw: - ieee80211_free_hw(priv->hw); -out: - op_mode = NULL; - return op_mode; -} - -static void iwl_op_mode_dvm_stop(struct iwl_op_mode *op_mode) -{ - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - - IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); - - iwl_testmode_free(priv); - iwlagn_mac_unregister(priv); - - iwl_tt_exit(priv); - - kfree(priv->eeprom_blob); - iwl_free_nvm_data(priv->nvm_data); - - /*netif_stop_queue(dev); */ - flush_workqueue(priv->workqueue); - - /* ieee80211_unregister_hw calls iwlagn_mac_stop, which flushes - * priv->workqueue... so we can't take down the workqueue - * until now... */ - destroy_workqueue(priv->workqueue); - priv->workqueue = NULL; - - iwl_uninit_drv(priv); - - dev_kfree_skb(priv->beacon_skb); - - iwl_trans_stop_hw(priv->trans, true); - ieee80211_free_hw(priv->hw); -} - -static const char * const desc_lookup_text[] = { - "OK", - "FAIL", - "BAD_PARAM", - "BAD_CHECKSUM", - "NMI_INTERRUPT_WDG", - "SYSASSERT", - "FATAL_ERROR", - "BAD_COMMAND", - "HW_ERROR_TUNE_LOCK", - "HW_ERROR_TEMPERATURE", - "ILLEGAL_CHAN_FREQ", - "VCC_NOT_STABLE", - "FH_ERROR", - "NMI_INTERRUPT_HOST", - "NMI_INTERRUPT_ACTION_PT", - "NMI_INTERRUPT_UNKNOWN", - "UCODE_VERSION_MISMATCH", - "HW_ERROR_ABS_LOCK", - "HW_ERROR_CAL_LOCK_FAIL", - "NMI_INTERRUPT_INST_ACTION_PT", - "NMI_INTERRUPT_DATA_ACTION_PT", - "NMI_TRM_HW_ER", - "NMI_INTERRUPT_TRM", - "NMI_INTERRUPT_BREAK_POINT", - "DEBUG_0", - "DEBUG_1", - "DEBUG_2", - "DEBUG_3", -}; - -static struct { char *name; u8 num; } advanced_lookup[] = { - { "NMI_INTERRUPT_WDG", 0x34 }, - { "SYSASSERT", 0x35 }, - { "UCODE_VERSION_MISMATCH", 0x37 }, - { "BAD_COMMAND", 0x38 }, - { "NMI_INTERRUPT_DATA_ACTION_PT", 0x3C }, - { "FATAL_ERROR", 0x3D }, - { "NMI_TRM_HW_ERR", 0x46 }, - { "NMI_INTERRUPT_TRM", 0x4C }, - { "NMI_INTERRUPT_BREAK_POINT", 0x54 }, - { "NMI_INTERRUPT_WDG_RXF_FULL", 0x5C }, - { "NMI_INTERRUPT_WDG_NO_RBD_RXF_FULL", 0x64 }, - { "NMI_INTERRUPT_HOST", 0x66 }, - { "NMI_INTERRUPT_ACTION_PT", 0x7C }, - { "NMI_INTERRUPT_UNKNOWN", 0x84 }, - { "NMI_INTERRUPT_INST_ACTION_PT", 0x86 }, - { "ADVANCED_SYSASSERT", 0 }, -}; - -static const char *desc_lookup(u32 num) -{ - int i; - int max = ARRAY_SIZE(desc_lookup_text); - - if (num < max) - return desc_lookup_text[num]; - - max = ARRAY_SIZE(advanced_lookup) - 1; - for (i = 0; i < max; i++) { - if (advanced_lookup[i].num == num) - break; - } - return advanced_lookup[i].name; -} - -#define ERROR_START_OFFSET (1 * sizeof(u32)) -#define ERROR_ELEM_SIZE (7 * sizeof(u32)) - -static void iwl_dump_nic_error_log(struct iwl_priv *priv) -{ - struct iwl_trans *trans = priv->trans; - u32 base; - struct iwl_error_event_table table; - - base = priv->device_pointers.error_event_table; - if (priv->cur_ucode == IWL_UCODE_INIT) { - if (!base) - base = priv->fw->init_errlog_ptr; - } else { - if (!base) - base = priv->fw->inst_errlog_ptr; - } - - if (!iwlagn_hw_valid_rtc_data_addr(base)) { - IWL_ERR(priv, - "Not valid error log pointer 0x%08X for %s uCode\n", - base, - (priv->cur_ucode == IWL_UCODE_INIT) - ? "Init" : "RT"); - return; - } - - /*TODO: Update dbgfs with ISR error stats obtained below */ - iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table)); - - if (ERROR_START_OFFSET <= table.valid * ERROR_ELEM_SIZE) { - IWL_ERR(trans, "Start IWL Error Log Dump:\n"); - IWL_ERR(trans, "Status: 0x%08lX, count: %d\n", - priv->status, table.valid); - } - - trace_iwlwifi_dev_ucode_error(trans->dev, table.error_id, table.tsf_low, - table.data1, table.data2, table.line, - table.blink1, table.blink2, table.ilink1, - table.ilink2, table.bcon_time, table.gp1, - table.gp2, table.gp3, table.ucode_ver, - table.hw_ver, table.brd_ver); - IWL_ERR(priv, "0x%08X | %-28s\n", table.error_id, - desc_lookup(table.error_id)); - IWL_ERR(priv, "0x%08X | uPc\n", table.pc); - IWL_ERR(priv, "0x%08X | branchlink1\n", table.blink1); - IWL_ERR(priv, "0x%08X | branchlink2\n", table.blink2); - IWL_ERR(priv, "0x%08X | interruptlink1\n", table.ilink1); - IWL_ERR(priv, "0x%08X | interruptlink2\n", table.ilink2); - IWL_ERR(priv, "0x%08X | data1\n", table.data1); - IWL_ERR(priv, "0x%08X | data2\n", table.data2); - IWL_ERR(priv, "0x%08X | line\n", table.line); - IWL_ERR(priv, "0x%08X | beacon time\n", table.bcon_time); - IWL_ERR(priv, "0x%08X | tsf low\n", table.tsf_low); - IWL_ERR(priv, "0x%08X | tsf hi\n", table.tsf_hi); - IWL_ERR(priv, "0x%08X | time gp1\n", table.gp1); - IWL_ERR(priv, "0x%08X | time gp2\n", table.gp2); - IWL_ERR(priv, "0x%08X | time gp3\n", table.gp3); - IWL_ERR(priv, "0x%08X | uCode version\n", table.ucode_ver); - IWL_ERR(priv, "0x%08X | hw version\n", table.hw_ver); - IWL_ERR(priv, "0x%08X | board version\n", table.brd_ver); - IWL_ERR(priv, "0x%08X | hcmd\n", table.hcmd); - IWL_ERR(priv, "0x%08X | isr0\n", table.isr0); - IWL_ERR(priv, "0x%08X | isr1\n", table.isr1); - IWL_ERR(priv, "0x%08X | isr2\n", table.isr2); - IWL_ERR(priv, "0x%08X | isr3\n", table.isr3); - IWL_ERR(priv, "0x%08X | isr4\n", table.isr4); - IWL_ERR(priv, "0x%08X | isr_pref\n", table.isr_pref); - IWL_ERR(priv, "0x%08X | wait_event\n", table.wait_event); - IWL_ERR(priv, "0x%08X | l2p_control\n", table.l2p_control); - IWL_ERR(priv, "0x%08X | l2p_duration\n", table.l2p_duration); - IWL_ERR(priv, "0x%08X | l2p_mhvalid\n", table.l2p_mhvalid); - IWL_ERR(priv, "0x%08X | l2p_addr_match\n", table.l2p_addr_match); - IWL_ERR(priv, "0x%08X | lmpm_pmg_sel\n", table.lmpm_pmg_sel); - IWL_ERR(priv, "0x%08X | timestamp\n", table.u_timestamp); - IWL_ERR(priv, "0x%08X | flow_handler\n", table.flow_handler); -} - -#define EVENT_START_OFFSET (4 * sizeof(u32)) - -/** - * iwl_print_event_log - Dump error event log to syslog - * - */ -static int iwl_print_event_log(struct iwl_priv *priv, u32 start_idx, - u32 num_events, u32 mode, - int pos, char **buf, size_t bufsz) -{ - u32 i; - u32 base; /* SRAM byte address of event log header */ - u32 event_size; /* 2 u32s, or 3 u32s if timestamp recorded */ - u32 ptr; /* SRAM byte address of log data */ - u32 ev, time, data; /* event log data */ - unsigned long reg_flags; - - struct iwl_trans *trans = priv->trans; - - if (num_events == 0) - return pos; - - base = priv->device_pointers.log_event_table; - if (priv->cur_ucode == IWL_UCODE_INIT) { - if (!base) - base = priv->fw->init_evtlog_ptr; - } else { - if (!base) - base = priv->fw->inst_evtlog_ptr; - } - - if (mode == 0) - event_size = 2 * sizeof(u32); - else - event_size = 3 * sizeof(u32); - - ptr = base + EVENT_START_OFFSET + (start_idx * event_size); - - /* Make sure device is powered up for SRAM reads */ - if (!iwl_trans_grab_nic_access(trans, false, ®_flags)) - return pos; - - /* Set starting address; reads will auto-increment */ - iwl_write32(trans, HBUS_TARG_MEM_RADDR, ptr); - - /* "time" is actually "data" for mode 0 (no timestamp). - * place event id # at far right for easier visual parsing. */ - for (i = 0; i < num_events; i++) { - ev = iwl_read32(trans, HBUS_TARG_MEM_RDAT); - time = iwl_read32(trans, HBUS_TARG_MEM_RDAT); - if (mode == 0) { - /* data, ev */ - if (bufsz) { - pos += scnprintf(*buf + pos, bufsz - pos, - "EVT_LOG:0x%08x:%04u\n", - time, ev); - } else { - trace_iwlwifi_dev_ucode_event(trans->dev, 0, - time, ev); - IWL_ERR(priv, "EVT_LOG:0x%08x:%04u\n", - time, ev); - } - } else { - data = iwl_read32(trans, HBUS_TARG_MEM_RDAT); - if (bufsz) { - pos += scnprintf(*buf + pos, bufsz - pos, - "EVT_LOGT:%010u:0x%08x:%04u\n", - time, data, ev); - } else { - IWL_ERR(priv, "EVT_LOGT:%010u:0x%08x:%04u\n", - time, data, ev); - trace_iwlwifi_dev_ucode_event(trans->dev, time, - data, ev); - } - } - } - - /* Allow device to power down */ - iwl_trans_release_nic_access(trans, ®_flags); - return pos; -} - -/** - * iwl_print_last_event_logs - Dump the newest # of event log to syslog - */ -static int iwl_print_last_event_logs(struct iwl_priv *priv, u32 capacity, - u32 num_wraps, u32 next_entry, - u32 size, u32 mode, - int pos, char **buf, size_t bufsz) -{ - /* - * display the newest DEFAULT_LOG_ENTRIES entries - * i.e the entries just before the next ont that uCode would fill. - */ - if (num_wraps) { - if (next_entry < size) { - pos = iwl_print_event_log(priv, - capacity - (size - next_entry), - size - next_entry, mode, - pos, buf, bufsz); - pos = iwl_print_event_log(priv, 0, - next_entry, mode, - pos, buf, bufsz); - } else - pos = iwl_print_event_log(priv, next_entry - size, - size, mode, pos, buf, bufsz); - } else { - if (next_entry < size) { - pos = iwl_print_event_log(priv, 0, next_entry, - mode, pos, buf, bufsz); - } else { - pos = iwl_print_event_log(priv, next_entry - size, - size, mode, pos, buf, bufsz); - } - } - return pos; -} - -#define DEFAULT_DUMP_EVENT_LOG_ENTRIES (20) - -int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, - char **buf) -{ - u32 base; /* SRAM byte address of event log header */ - u32 capacity; /* event log capacity in # entries */ - u32 mode; /* 0 - no timestamp, 1 - timestamp recorded */ - u32 num_wraps; /* # times uCode wrapped to top of log */ - u32 next_entry; /* index of next entry to be written by uCode */ - u32 size; /* # entries that we'll print */ - u32 logsize; - int pos = 0; - size_t bufsz = 0; - struct iwl_trans *trans = priv->trans; - - base = priv->device_pointers.log_event_table; - if (priv->cur_ucode == IWL_UCODE_INIT) { - logsize = priv->fw->init_evtlog_size; - if (!base) - base = priv->fw->init_evtlog_ptr; - } else { - logsize = priv->fw->inst_evtlog_size; - if (!base) - base = priv->fw->inst_evtlog_ptr; - } - - if (!iwlagn_hw_valid_rtc_data_addr(base)) { - IWL_ERR(priv, - "Invalid event log pointer 0x%08X for %s uCode\n", - base, - (priv->cur_ucode == IWL_UCODE_INIT) - ? "Init" : "RT"); - return -EINVAL; - } - - /* event log header */ - capacity = iwl_trans_read_mem32(trans, base); - mode = iwl_trans_read_mem32(trans, base + (1 * sizeof(u32))); - num_wraps = iwl_trans_read_mem32(trans, base + (2 * sizeof(u32))); - next_entry = iwl_trans_read_mem32(trans, base + (3 * sizeof(u32))); - - if (capacity > logsize) { - IWL_ERR(priv, "Log capacity %d is bogus, limit to %d " - "entries\n", capacity, logsize); - capacity = logsize; - } - - if (next_entry > logsize) { - IWL_ERR(priv, "Log write index %d is bogus, limit to %d\n", - next_entry, logsize); - next_entry = logsize; - } - - size = num_wraps ? capacity : next_entry; - - /* bail out if nothing in log */ - if (size == 0) { - IWL_ERR(trans, "Start IWL Event Log Dump: nothing in log\n"); - return pos; - } - -#ifdef CONFIG_IWLWIFI_DEBUG - if (!(iwl_have_debug_level(IWL_DL_FW_ERRORS)) && !full_log) - size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) - ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; -#else - size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) - ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; -#endif - IWL_ERR(priv, "Start IWL Event Log Dump: display last %u entries\n", - size); - -#ifdef CONFIG_IWLWIFI_DEBUG - if (buf) { - if (full_log) - bufsz = capacity * 48; - else - bufsz = size * 48; - *buf = kmalloc(bufsz, GFP_KERNEL); - if (!*buf) - return -ENOMEM; - } - if (iwl_have_debug_level(IWL_DL_FW_ERRORS) || full_log) { - /* - * if uCode has wrapped back to top of log, - * start at the oldest entry, - * i.e the next one that uCode would fill. - */ - if (num_wraps) - pos = iwl_print_event_log(priv, next_entry, - capacity - next_entry, mode, - pos, buf, bufsz); - /* (then/else) start at top of log */ - pos = iwl_print_event_log(priv, 0, - next_entry, mode, pos, buf, bufsz); - } else - pos = iwl_print_last_event_logs(priv, capacity, num_wraps, - next_entry, size, mode, - pos, buf, bufsz); -#else - pos = iwl_print_last_event_logs(priv, capacity, num_wraps, - next_entry, size, mode, - pos, buf, bufsz); -#endif - return pos; -} - -static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand) -{ - unsigned int reload_msec; - unsigned long reload_jiffies; - -#ifdef CONFIG_IWLWIFI_DEBUG - if (iwl_have_debug_level(IWL_DL_FW_ERRORS)) - iwl_print_rx_config_cmd(priv, IWL_RXON_CTX_BSS); -#endif - - /* uCode is no longer loaded. */ - priv->ucode_loaded = false; - - /* Set the FW error flag -- cleared on iwl_down */ - set_bit(STATUS_FW_ERROR, &priv->status); - - iwl_abort_notification_waits(&priv->notif_wait); - - /* Keep the restart process from trying to send host - * commands by clearing the ready bit */ - clear_bit(STATUS_READY, &priv->status); - - if (!ondemand) { - /* - * If firmware keep reloading, then it indicate something - * serious wrong and firmware having problem to recover - * from it. Instead of keep trying which will fill the syslog - * and hang the system, let's just stop it - */ - reload_jiffies = jiffies; - reload_msec = jiffies_to_msecs((long) reload_jiffies - - (long) priv->reload_jiffies); - priv->reload_jiffies = reload_jiffies; - if (reload_msec <= IWL_MIN_RELOAD_DURATION) { - priv->reload_count++; - if (priv->reload_count >= IWL_MAX_CONTINUE_RELOAD_CNT) { - IWL_ERR(priv, "BUG_ON, Stop restarting\n"); - return; - } - } else - priv->reload_count = 0; - } - - if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) { - if (iwlwifi_mod_params.restart_fw) { - IWL_DEBUG_FW_ERRORS(priv, - "Restarting adapter due to uCode error.\n"); - queue_work(priv->workqueue, &priv->restart); - } else - IWL_DEBUG_FW_ERRORS(priv, - "Detected FW error, but not restarting\n"); - } -} - -static void iwl_nic_error(struct iwl_op_mode *op_mode) -{ - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - - IWL_ERR(priv, "Loaded firmware version: %s\n", - priv->fw->fw_version); - - iwl_dump_nic_error_log(priv); - iwl_dump_nic_event_log(priv, false, NULL); - - iwlagn_fw_error(priv, false); -} - -static void iwl_cmd_queue_full(struct iwl_op_mode *op_mode) -{ - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - - if (!iwl_check_for_ct_kill(priv)) { - IWL_ERR(priv, "Restarting adapter queue is full\n"); - iwlagn_fw_error(priv, false); - } -} - -#define EEPROM_RF_CONFIG_TYPE_MAX 0x3 - -static void iwl_nic_config(struct iwl_op_mode *op_mode) -{ - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - - /* SKU Control */ - iwl_trans_set_bits_mask(priv->trans, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH | - CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP, - (CSR_HW_REV_STEP(priv->trans->hw_rev) << - CSR_HW_IF_CONFIG_REG_POS_MAC_STEP) | - (CSR_HW_REV_DASH(priv->trans->hw_rev) << - CSR_HW_IF_CONFIG_REG_POS_MAC_DASH)); - - /* write radio config values to register */ - if (priv->nvm_data->radio_cfg_type <= EEPROM_RF_CONFIG_TYPE_MAX) { - u32 reg_val = - priv->nvm_data->radio_cfg_type << - CSR_HW_IF_CONFIG_REG_POS_PHY_TYPE | - priv->nvm_data->radio_cfg_step << - CSR_HW_IF_CONFIG_REG_POS_PHY_STEP | - priv->nvm_data->radio_cfg_dash << - CSR_HW_IF_CONFIG_REG_POS_PHY_DASH; - - iwl_trans_set_bits_mask(priv->trans, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_MSK_PHY_TYPE | - CSR_HW_IF_CONFIG_REG_MSK_PHY_STEP | - CSR_HW_IF_CONFIG_REG_MSK_PHY_DASH, - reg_val); - - IWL_INFO(priv, "Radio type=0x%x-0x%x-0x%x\n", - priv->nvm_data->radio_cfg_type, - priv->nvm_data->radio_cfg_step, - priv->nvm_data->radio_cfg_dash); - } else { - WARN_ON(1); - } - - /* set CSR_HW_CONFIG_REG for uCode use */ - iwl_set_bit(priv->trans, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | - CSR_HW_IF_CONFIG_REG_BIT_MAC_SI); - - /* W/A : NIC is stuck in a reset state after Early PCIe power off - * (PCIe power is lost before PERST# is asserted), - * causing ME FW to lose ownership and not being able to obtain it back. - */ - iwl_set_bits_mask_prph(priv->trans, APMG_PS_CTRL_REG, - APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS, - ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS); - - if (priv->lib->nic_config) - priv->lib->nic_config(priv); -} - -static void iwl_wimax_active(struct iwl_op_mode *op_mode) -{ - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - - clear_bit(STATUS_READY, &priv->status); - IWL_ERR(priv, "RF is used by WiMAX\n"); -} - -static void iwl_stop_sw_queue(struct iwl_op_mode *op_mode, int queue) -{ - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - int mq = priv->queue_to_mac80211[queue]; - - if (WARN_ON_ONCE(mq == IWL_INVALID_MAC80211_QUEUE)) - return; - - if (atomic_inc_return(&priv->queue_stop_count[mq]) > 1) { - IWL_DEBUG_TX_QUEUES(priv, - "queue %d (mac80211 %d) already stopped\n", - queue, mq); - return; - } - - set_bit(mq, &priv->transport_queue_stop); - ieee80211_stop_queue(priv->hw, mq); -} - -static void iwl_wake_sw_queue(struct iwl_op_mode *op_mode, int queue) -{ - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - int mq = priv->queue_to_mac80211[queue]; - - if (WARN_ON_ONCE(mq == IWL_INVALID_MAC80211_QUEUE)) - return; - - if (atomic_dec_return(&priv->queue_stop_count[mq]) > 0) { - IWL_DEBUG_TX_QUEUES(priv, - "queue %d (mac80211 %d) already awake\n", - queue, mq); - return; - } - - clear_bit(mq, &priv->transport_queue_stop); - - if (!priv->passive_no_rx) - ieee80211_wake_queue(priv->hw, mq); -} - -void iwlagn_lift_passive_no_rx(struct iwl_priv *priv) -{ - int mq; - - if (!priv->passive_no_rx) - return; - - for (mq = 0; mq < IWLAGN_FIRST_AMPDU_QUEUE; mq++) { - if (!test_bit(mq, &priv->transport_queue_stop)) { - IWL_DEBUG_TX_QUEUES(priv, "Wake queue %d", mq); - ieee80211_wake_queue(priv->hw, mq); - } else { - IWL_DEBUG_TX_QUEUES(priv, "Don't wake queue %d", mq); - } - } - - priv->passive_no_rx = false; -} - -static void iwl_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb) -{ - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - struct ieee80211_tx_info *info; - - info = IEEE80211_SKB_CB(skb); - iwl_trans_free_tx_cmd(priv->trans, info->driver_data[1]); - ieee80211_free_txskb(priv->hw, skb); -} - -static void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) -{ - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - - if (state) - set_bit(STATUS_RF_KILL_HW, &priv->status); - else - clear_bit(STATUS_RF_KILL_HW, &priv->status); - - wiphy_rfkill_set_hw_state(priv->hw->wiphy, state); -} - -static const struct iwl_op_mode_ops iwl_dvm_ops = { - .start = iwl_op_mode_dvm_start, - .stop = iwl_op_mode_dvm_stop, - .rx = iwl_rx_dispatch, - .queue_full = iwl_stop_sw_queue, - .queue_not_full = iwl_wake_sw_queue, - .hw_rf_kill = iwl_set_hw_rfkill_state, - .free_skb = iwl_free_skb, - .nic_error = iwl_nic_error, - .cmd_queue_full = iwl_cmd_queue_full, - .nic_config = iwl_nic_config, - .wimax_active = iwl_wimax_active, -}; - -/***************************************************************************** - * - * driver and module entry point - * - *****************************************************************************/ -static int __init iwl_init(void) -{ - - int ret; - - ret = iwlagn_rate_control_register(); - if (ret) { - pr_err("Unable to register rate control algorithm: %d\n", ret); - return ret; - } - - ret = iwl_opmode_register("iwldvm", &iwl_dvm_ops); - if (ret) { - pr_err("Unable to register op_mode: %d\n", ret); - iwlagn_rate_control_unregister(); - } - - return ret; -} -module_init(iwl_init); - -static void __exit iwl_exit(void) -{ - iwl_opmode_deregister("iwldvm"); - iwlagn_rate_control_unregister(); -} -module_exit(iwl_exit); diff --git a/drivers/net/wireless/iwlwifi/dvm/power.c b/drivers/net/wireless/iwlwifi/dvm/power.c deleted file mode 100644 index bd69018d07a9..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/power.c +++ /dev/null @@ -1,387 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2013 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portions of the ieee80211 subsystem header files. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - *****************************************************************************/ - - -#include -#include -#include -#include -#include -#include "iwl-io.h" -#include "iwl-debug.h" -#include "iwl-trans.h" -#include "iwl-modparams.h" -#include "dev.h" -#include "agn.h" -#include "commands.h" -#include "power.h" - -/* - * Setting power level allows the card to go to sleep when not busy. - * - * We calculate a sleep command based on the required latency, which - * we get from mac80211. In order to handle thermal throttling, we can - * also use pre-defined power levels. - */ - -/* - * This defines the old power levels. They are still used by default - * (level 1) and for thermal throttle (levels 3 through 5) - */ - -struct iwl_power_vec_entry { - struct iwl_powertable_cmd cmd; - u8 no_dtim; /* number of skip dtim */ -}; - -#define IWL_DTIM_RANGE_0_MAX 2 -#define IWL_DTIM_RANGE_1_MAX 10 - -#define NOSLP cpu_to_le16(0), 0, 0 -#define SLP IWL_POWER_DRIVER_ALLOW_SLEEP_MSK, 0, 0 -#define ASLP (IWL_POWER_POWER_SAVE_ENA_MSK | \ - IWL_POWER_POWER_MANAGEMENT_ENA_MSK | \ - IWL_POWER_ADVANCE_PM_ENA_MSK) -#define ASLP_TOUT(T) cpu_to_le32(T) -#define TU_TO_USEC 1024 -#define SLP_TOUT(T) cpu_to_le32((T) * TU_TO_USEC) -#define SLP_VEC(X0, X1, X2, X3, X4) {cpu_to_le32(X0), \ - cpu_to_le32(X1), \ - cpu_to_le32(X2), \ - cpu_to_le32(X3), \ - cpu_to_le32(X4)} -/* default power management (not Tx power) table values */ -/* for DTIM period 0 through IWL_DTIM_RANGE_0_MAX */ -/* DTIM 0 - 2 */ -static const struct iwl_power_vec_entry range_0[IWL_POWER_NUM] = { - {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 1, 2, 2, 0xFF)}, 0}, - {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, - {{SLP, SLP_TOUT(50), SLP_TOUT(100), SLP_VEC(2, 2, 2, 2, 0xFF)}, 0}, - {{SLP, SLP_TOUT(50), SLP_TOUT(25), SLP_VEC(2, 2, 4, 4, 0xFF)}, 1}, - {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(2, 2, 4, 6, 0xFF)}, 2} -}; - - -/* for DTIM period IWL_DTIM_RANGE_0_MAX + 1 through IWL_DTIM_RANGE_1_MAX */ -/* DTIM 3 - 10 */ -static const struct iwl_power_vec_entry range_1[IWL_POWER_NUM] = { - {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, - {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(1, 2, 3, 4, 7)}, 0}, - {{SLP, SLP_TOUT(50), SLP_TOUT(100), SLP_VEC(2, 4, 6, 7, 9)}, 0}, - {{SLP, SLP_TOUT(50), SLP_TOUT(25), SLP_VEC(2, 4, 6, 9, 10)}, 1}, - {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(2, 4, 6, 10, 10)}, 2} -}; - -/* for DTIM period > IWL_DTIM_RANGE_1_MAX */ -/* DTIM 11 - */ -static const struct iwl_power_vec_entry range_2[IWL_POWER_NUM] = { - {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, - {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(2, 4, 6, 7, 0xFF)}, 0}, - {{SLP, SLP_TOUT(50), SLP_TOUT(100), SLP_VEC(2, 7, 9, 9, 0xFF)}, 0}, - {{SLP, SLP_TOUT(50), SLP_TOUT(25), SLP_VEC(2, 7, 9, 9, 0xFF)}, 0}, - {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} -}; - -/* advance power management */ -/* DTIM 0 - 2 */ -static const struct iwl_power_vec_entry apm_range_0[IWL_POWER_NUM] = { - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 4, 6, 0xFF), 0}, 0}, - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 4, 6, 0xFF), 0}, 0}, - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 4, 6, 0xFF), 0}, 0}, - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 4, 6, 0xFF), 0}, 0}, - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 6, 8, 0xFF), ASLP_TOUT(2)}, 2} -}; - - -/* for DTIM period IWL_DTIM_RANGE_0_MAX + 1 through IWL_DTIM_RANGE_1_MAX */ -/* DTIM 3 - 10 */ -static const struct iwl_power_vec_entry apm_range_1[IWL_POWER_NUM] = { - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 4, 6, 0xFF), 0}, 0}, - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 4, 6, 0xFF), 0}, 0}, - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 4, 6, 0xFF), 0}, 0}, - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 4, 6, 0xFF), 0}, 0}, - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 6, 8, 0xFF), 0}, 2} -}; - -/* for DTIM period > IWL_DTIM_RANGE_1_MAX */ -/* DTIM 11 - */ -static const struct iwl_power_vec_entry apm_range_2[IWL_POWER_NUM] = { - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 4, 6, 0xFF), 0}, 0}, - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 4, 6, 0xFF), 0}, 0}, - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 4, 6, 0xFF), 0}, 0}, - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 4, 6, 0xFF), 0}, 0}, - {{ASLP, 0, 0, ASLP_TOUT(50), ASLP_TOUT(50), - SLP_VEC(1, 2, 6, 8, 0xFF), ASLP_TOUT(2)}, 2} -}; - -static void iwl_static_sleep_cmd(struct iwl_priv *priv, - struct iwl_powertable_cmd *cmd, - enum iwl_power_level lvl, int period) -{ - const struct iwl_power_vec_entry *table; - int max_sleep[IWL_POWER_VEC_SIZE] = { 0 }; - int i; - u8 skip; - u32 slp_itrvl; - - if (priv->cfg->adv_pm) { - table = apm_range_2; - if (period <= IWL_DTIM_RANGE_1_MAX) - table = apm_range_1; - if (period <= IWL_DTIM_RANGE_0_MAX) - table = apm_range_0; - } else { - table = range_2; - if (period <= IWL_DTIM_RANGE_1_MAX) - table = range_1; - if (period <= IWL_DTIM_RANGE_0_MAX) - table = range_0; - } - - if (WARN_ON(lvl < 0 || lvl >= IWL_POWER_NUM)) - memset(cmd, 0, sizeof(*cmd)); - else - *cmd = table[lvl].cmd; - - if (period == 0) { - skip = 0; - period = 1; - for (i = 0; i < IWL_POWER_VEC_SIZE; i++) - max_sleep[i] = 1; - - } else { - skip = table[lvl].no_dtim; - for (i = 0; i < IWL_POWER_VEC_SIZE; i++) - max_sleep[i] = le32_to_cpu(cmd->sleep_interval[i]); - max_sleep[IWL_POWER_VEC_SIZE - 1] = skip + 1; - } - - slp_itrvl = le32_to_cpu(cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1]); - /* figure out the listen interval based on dtim period and skip */ - if (slp_itrvl == 0xFF) - cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1] = - cpu_to_le32(period * (skip + 1)); - - slp_itrvl = le32_to_cpu(cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1]); - if (slp_itrvl > period) - cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1] = - cpu_to_le32((slp_itrvl / period) * period); - - if (skip) - cmd->flags |= IWL_POWER_SLEEP_OVER_DTIM_MSK; - else - cmd->flags &= ~IWL_POWER_SLEEP_OVER_DTIM_MSK; - - if (priv->cfg->base_params->shadow_reg_enable) - cmd->flags |= IWL_POWER_SHADOW_REG_ENA; - else - cmd->flags &= ~IWL_POWER_SHADOW_REG_ENA; - - if (iwl_advanced_bt_coexist(priv)) { - if (!priv->cfg->bt_params->bt_sco_disable) - cmd->flags |= IWL_POWER_BT_SCO_ENA; - else - cmd->flags &= ~IWL_POWER_BT_SCO_ENA; - } - - - slp_itrvl = le32_to_cpu(cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1]); - if (slp_itrvl > IWL_CONN_MAX_LISTEN_INTERVAL) - cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1] = - cpu_to_le32(IWL_CONN_MAX_LISTEN_INTERVAL); - - /* enforce max sleep interval */ - for (i = IWL_POWER_VEC_SIZE - 1; i >= 0 ; i--) { - if (le32_to_cpu(cmd->sleep_interval[i]) > - (max_sleep[i] * period)) - cmd->sleep_interval[i] = - cpu_to_le32(max_sleep[i] * period); - if (i != (IWL_POWER_VEC_SIZE - 1)) { - if (le32_to_cpu(cmd->sleep_interval[i]) > - le32_to_cpu(cmd->sleep_interval[i+1])) - cmd->sleep_interval[i] = - cmd->sleep_interval[i+1]; - } - } - - if (priv->power_data.bus_pm) - cmd->flags |= IWL_POWER_PCI_PM_MSK; - else - cmd->flags &= ~IWL_POWER_PCI_PM_MSK; - - IWL_DEBUG_POWER(priv, "numSkipDtim = %u, dtimPeriod = %d\n", - skip, period); - /* The power level here is 0-4 (used as array index), but user expects - to see 1-5 (according to spec). */ - IWL_DEBUG_POWER(priv, "Sleep command for index %d\n", lvl + 1); -} - -static void iwl_power_sleep_cam_cmd(struct iwl_priv *priv, - struct iwl_powertable_cmd *cmd) -{ - memset(cmd, 0, sizeof(*cmd)); - - if (priv->power_data.bus_pm) - cmd->flags |= IWL_POWER_PCI_PM_MSK; - - IWL_DEBUG_POWER(priv, "Sleep command for CAM\n"); -} - -static int iwl_set_power(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd) -{ - IWL_DEBUG_POWER(priv, "Sending power/sleep command\n"); - IWL_DEBUG_POWER(priv, "Flags value = 0x%08X\n", cmd->flags); - IWL_DEBUG_POWER(priv, "Tx timeout = %u\n", le32_to_cpu(cmd->tx_data_timeout)); - IWL_DEBUG_POWER(priv, "Rx timeout = %u\n", le32_to_cpu(cmd->rx_data_timeout)); - IWL_DEBUG_POWER(priv, "Sleep interval vector = { %d , %d , %d , %d , %d }\n", - le32_to_cpu(cmd->sleep_interval[0]), - le32_to_cpu(cmd->sleep_interval[1]), - le32_to_cpu(cmd->sleep_interval[2]), - le32_to_cpu(cmd->sleep_interval[3]), - le32_to_cpu(cmd->sleep_interval[4])); - - return iwl_dvm_send_cmd_pdu(priv, POWER_TABLE_CMD, CMD_SYNC, - sizeof(struct iwl_powertable_cmd), cmd); -} - -static void iwl_power_build_cmd(struct iwl_priv *priv, - struct iwl_powertable_cmd *cmd) -{ - bool enabled = priv->hw->conf.flags & IEEE80211_CONF_PS; - int dtimper; - - dtimper = priv->hw->conf.ps_dtim_period ?: 1; - - if (priv->wowlan) - iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, dtimper); - else if (!priv->cfg->base_params->no_idle_support && - priv->hw->conf.flags & IEEE80211_CONF_IDLE) - iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, 20); - else if (iwl_tt_is_low_power_state(priv)) { - /* in thermal throttling low power state */ - iwl_static_sleep_cmd(priv, cmd, - iwl_tt_current_power_mode(priv), dtimper); - } else if (!enabled) - iwl_power_sleep_cam_cmd(priv, cmd); - else if (priv->power_data.debug_sleep_level_override >= 0) - iwl_static_sleep_cmd(priv, cmd, - priv->power_data.debug_sleep_level_override, - dtimper); - else { - /* Note that the user parameter is 1-5 (according to spec), - but we pass 0-4 because it acts as an array index. */ - if (iwlwifi_mod_params.power_level > IWL_POWER_INDEX_1 && - iwlwifi_mod_params.power_level <= IWL_POWER_NUM) - iwl_static_sleep_cmd(priv, cmd, - iwlwifi_mod_params.power_level - 1, dtimper); - else - iwl_static_sleep_cmd(priv, cmd, - IWL_POWER_INDEX_1, dtimper); - } -} - -int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, - bool force) -{ - int ret; - bool update_chains; - - lockdep_assert_held(&priv->mutex); - - /* Don't update the RX chain when chain noise calibration is running */ - update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE || - priv->chain_noise_data.state == IWL_CHAIN_NOISE_ALIVE; - - if (!memcmp(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force) - return 0; - - if (!iwl_is_ready_rf(priv)) - return -EIO; - - /* scan complete use sleep_power_next, need to be updated */ - memcpy(&priv->power_data.sleep_cmd_next, cmd, sizeof(*cmd)); - if (test_bit(STATUS_SCANNING, &priv->status) && !force) { - IWL_DEBUG_INFO(priv, "Defer power set mode while scanning\n"); - return 0; - } - - if (cmd->flags & IWL_POWER_DRIVER_ALLOW_SLEEP_MSK) - iwl_dvm_set_pmi(priv, true); - - ret = iwl_set_power(priv, cmd); - if (!ret) { - if (!(cmd->flags & IWL_POWER_DRIVER_ALLOW_SLEEP_MSK)) - iwl_dvm_set_pmi(priv, false); - - if (update_chains) - iwl_update_chain_flags(priv); - else - IWL_DEBUG_POWER(priv, - "Cannot update the power, chain noise " - "calibration running: %d\n", - priv->chain_noise_data.state); - - memcpy(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)); - } else - IWL_ERR(priv, "set power fail, ret = %d", ret); - - return ret; -} - -int iwl_power_update_mode(struct iwl_priv *priv, bool force) -{ - struct iwl_powertable_cmd cmd; - - iwl_power_build_cmd(priv, &cmd); - return iwl_power_set_mode(priv, &cmd, force); -} - -/* initialize to default */ -void iwl_power_initialize(struct iwl_priv *priv) -{ - priv->power_data.bus_pm = priv->trans->pm_support; - - priv->power_data.debug_sleep_level_override = -1; - - memset(&priv->power_data.sleep_cmd, 0, - sizeof(priv->power_data.sleep_cmd)); -} diff --git a/drivers/net/wireless/iwlwifi/dvm/power.h b/drivers/net/wireless/iwlwifi/dvm/power.h deleted file mode 100644 index 7b03e1342d47..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/power.h +++ /dev/null @@ -1,47 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2013 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portions of the ieee80211 subsystem header files. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - *****************************************************************************/ -#ifndef __iwl_power_setting_h__ -#define __iwl_power_setting_h__ - -#include "commands.h" - -struct iwl_power_mgr { - struct iwl_powertable_cmd sleep_cmd; - struct iwl_powertable_cmd sleep_cmd_next; - int debug_sleep_level_override; - bool bus_pm; -}; - -int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd, - bool force); -int iwl_power_update_mode(struct iwl_priv *priv, bool force); -void iwl_power_initialize(struct iwl_priv *priv); - -extern bool no_sleep_autoadjust; - -#endif /* __iwl_power_setting_h__ */ diff --git a/drivers/net/wireless/iwlwifi/dvm/rs.c b/drivers/net/wireless/iwlwifi/dvm/rs.c deleted file mode 100644 index 10fbb176cc8e..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/rs.c +++ /dev/null @@ -1,3369 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2005 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "dev.h" -#include "agn.h" - -#define RS_NAME "iwl-agn-rs" - -#define NUM_TRY_BEFORE_ANT_TOGGLE 1 -#define IWL_NUMBER_TRY 1 -#define IWL_HT_NUMBER_TRY 3 - -#define IWL_RATE_MAX_WINDOW 62 /* # tx in history window */ -#define IWL_RATE_MIN_FAILURE_TH 6 /* min failures to calc tpt */ -#define IWL_RATE_MIN_SUCCESS_TH 8 /* min successes to calc tpt */ - -/* max allowed rate miss before sync LQ cmd */ -#define IWL_MISSED_RATE_MAX 15 -/* max time to accum history 2 seconds */ -#define IWL_RATE_SCALE_FLUSH_INTVL (3*HZ) - -static u8 rs_ht_to_legacy[] = { - IWL_RATE_6M_INDEX, IWL_RATE_6M_INDEX, - IWL_RATE_6M_INDEX, IWL_RATE_6M_INDEX, - IWL_RATE_6M_INDEX, - IWL_RATE_6M_INDEX, IWL_RATE_9M_INDEX, - IWL_RATE_12M_INDEX, IWL_RATE_18M_INDEX, - IWL_RATE_24M_INDEX, IWL_RATE_36M_INDEX, - IWL_RATE_48M_INDEX, IWL_RATE_54M_INDEX -}; - -static const u8 ant_toggle_lookup[] = { - /*ANT_NONE -> */ ANT_NONE, - /*ANT_A -> */ ANT_B, - /*ANT_B -> */ ANT_C, - /*ANT_AB -> */ ANT_BC, - /*ANT_C -> */ ANT_A, - /*ANT_AC -> */ ANT_AB, - /*ANT_BC -> */ ANT_AC, - /*ANT_ABC -> */ ANT_ABC, -}; - -#define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ - [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ - IWL_RATE_SISO_##s##M_PLCP, \ - IWL_RATE_MIMO2_##s##M_PLCP,\ - IWL_RATE_MIMO3_##s##M_PLCP,\ - IWL_RATE_##r##M_IEEE, \ - IWL_RATE_##ip##M_INDEX, \ - IWL_RATE_##in##M_INDEX, \ - IWL_RATE_##rp##M_INDEX, \ - IWL_RATE_##rn##M_INDEX, \ - IWL_RATE_##pp##M_INDEX, \ - IWL_RATE_##np##M_INDEX } - -/* - * Parameter order: - * rate, ht rate, prev rate, next rate, prev tgg rate, next tgg rate - * - * If there isn't a valid next or previous rate then INV is used which - * maps to IWL_RATE_INVALID - * - */ -const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { - IWL_DECLARE_RATE_INFO(1, INV, INV, 2, INV, 2, INV, 2), /* 1mbps */ - IWL_DECLARE_RATE_INFO(2, INV, 1, 5, 1, 5, 1, 5), /* 2mbps */ - IWL_DECLARE_RATE_INFO(5, INV, 2, 6, 2, 11, 2, 11), /*5.5mbps */ - IWL_DECLARE_RATE_INFO(11, INV, 9, 12, 9, 12, 5, 18), /* 11mbps */ - IWL_DECLARE_RATE_INFO(6, 6, 5, 9, 5, 11, 5, 11), /* 6mbps */ - IWL_DECLARE_RATE_INFO(9, 6, 6, 11, 6, 11, 5, 11), /* 9mbps */ - IWL_DECLARE_RATE_INFO(12, 12, 11, 18, 11, 18, 11, 18), /* 12mbps */ - IWL_DECLARE_RATE_INFO(18, 18, 12, 24, 12, 24, 11, 24), /* 18mbps */ - IWL_DECLARE_RATE_INFO(24, 24, 18, 36, 18, 36, 18, 36), /* 24mbps */ - IWL_DECLARE_RATE_INFO(36, 36, 24, 48, 24, 48, 24, 48), /* 36mbps */ - IWL_DECLARE_RATE_INFO(48, 48, 36, 54, 36, 54, 36, 54), /* 48mbps */ - IWL_DECLARE_RATE_INFO(54, 54, 48, INV, 48, INV, 48, INV),/* 54mbps */ - IWL_DECLARE_RATE_INFO(60, 60, 48, INV, 48, INV, 48, INV),/* 60mbps */ - /* FIXME:RS: ^^ should be INV (legacy) */ -}; - -static inline u8 rs_extract_rate(u32 rate_n_flags) -{ - return (u8)(rate_n_flags & RATE_MCS_RATE_MSK); -} - -static int iwl_hwrate_to_plcp_idx(u32 rate_n_flags) -{ - int idx = 0; - - /* HT rate format */ - if (rate_n_flags & RATE_MCS_HT_MSK) { - idx = rs_extract_rate(rate_n_flags); - - if (idx >= IWL_RATE_MIMO3_6M_PLCP) - idx = idx - IWL_RATE_MIMO3_6M_PLCP; - else if (idx >= IWL_RATE_MIMO2_6M_PLCP) - idx = idx - IWL_RATE_MIMO2_6M_PLCP; - - idx += IWL_FIRST_OFDM_RATE; - /* skip 9M not supported in ht*/ - if (idx >= IWL_RATE_9M_INDEX) - idx += 1; - if ((idx >= IWL_FIRST_OFDM_RATE) && (idx <= IWL_LAST_OFDM_RATE)) - return idx; - - /* legacy rate format, search for match in table */ - } else { - for (idx = 0; idx < ARRAY_SIZE(iwl_rates); idx++) - if (iwl_rates[idx].plcp == - rs_extract_rate(rate_n_flags)) - return idx; - } - - return -1; -} - -static void rs_rate_scale_perform(struct iwl_priv *priv, - struct sk_buff *skb, - struct ieee80211_sta *sta, - struct iwl_lq_sta *lq_sta); -static void rs_fill_link_cmd(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, u32 rate_n_flags); -static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search); - - -#ifdef CONFIG_MAC80211_DEBUGFS -static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, - u32 *rate_n_flags, int index); -#else -static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, - u32 *rate_n_flags, int index) -{} -#endif - -/** - * The following tables contain the expected throughput metrics for all rates - * - * 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54, 60 MBits - * - * where invalid entries are zeros. - * - * CCK rates are only valid in legacy table and will only be used in G - * (2.4 GHz) band. - */ - -static s32 expected_tpt_legacy[IWL_RATE_COUNT] = { - 7, 13, 35, 58, 40, 57, 72, 98, 121, 154, 177, 186, 0 -}; - -static s32 expected_tpt_siso20MHz[4][IWL_RATE_COUNT] = { - {0, 0, 0, 0, 42, 0, 76, 102, 124, 159, 183, 193, 202}, /* Norm */ - {0, 0, 0, 0, 46, 0, 82, 110, 132, 168, 192, 202, 210}, /* SGI */ - {0, 0, 0, 0, 47, 0, 91, 133, 171, 242, 305, 334, 362}, /* AGG */ - {0, 0, 0, 0, 52, 0, 101, 145, 187, 264, 330, 361, 390}, /* AGG+SGI */ -}; - -static s32 expected_tpt_siso40MHz[4][IWL_RATE_COUNT] = { - {0, 0, 0, 0, 77, 0, 127, 160, 184, 220, 242, 250, 257}, /* Norm */ - {0, 0, 0, 0, 83, 0, 135, 169, 193, 229, 250, 257, 264}, /* SGI */ - {0, 0, 0, 0, 94, 0, 177, 249, 313, 423, 512, 550, 586}, /* AGG */ - {0, 0, 0, 0, 104, 0, 193, 270, 338, 454, 545, 584, 620}, /* AGG+SGI */ -}; - -static s32 expected_tpt_mimo2_20MHz[4][IWL_RATE_COUNT] = { - {0, 0, 0, 0, 74, 0, 123, 155, 179, 214, 236, 244, 251}, /* Norm */ - {0, 0, 0, 0, 81, 0, 131, 164, 188, 223, 243, 251, 257}, /* SGI */ - {0, 0, 0, 0, 89, 0, 167, 235, 296, 402, 488, 526, 560}, /* AGG */ - {0, 0, 0, 0, 97, 0, 182, 255, 320, 431, 520, 558, 593}, /* AGG+SGI*/ -}; - -static s32 expected_tpt_mimo2_40MHz[4][IWL_RATE_COUNT] = { - {0, 0, 0, 0, 123, 0, 182, 214, 235, 264, 279, 285, 289}, /* Norm */ - {0, 0, 0, 0, 131, 0, 191, 222, 242, 270, 284, 289, 293}, /* SGI */ - {0, 0, 0, 0, 171, 0, 305, 410, 496, 634, 731, 771, 805}, /* AGG */ - {0, 0, 0, 0, 186, 0, 329, 439, 527, 667, 764, 803, 838}, /* AGG+SGI */ -}; - -static s32 expected_tpt_mimo3_20MHz[4][IWL_RATE_COUNT] = { - {0, 0, 0, 0, 99, 0, 153, 186, 208, 239, 256, 263, 268}, /* Norm */ - {0, 0, 0, 0, 106, 0, 162, 194, 215, 246, 262, 268, 273}, /* SGI */ - {0, 0, 0, 0, 134, 0, 249, 346, 431, 574, 685, 732, 775}, /* AGG */ - {0, 0, 0, 0, 148, 0, 272, 376, 465, 614, 727, 775, 818}, /* AGG+SGI */ -}; - -static s32 expected_tpt_mimo3_40MHz[4][IWL_RATE_COUNT] = { - {0, 0, 0, 0, 152, 0, 211, 239, 255, 279, 290, 294, 297}, /* Norm */ - {0, 0, 0, 0, 160, 0, 219, 245, 261, 284, 294, 297, 300}, /* SGI */ - {0, 0, 0, 0, 254, 0, 443, 584, 695, 868, 984, 1030, 1070}, /* AGG */ - {0, 0, 0, 0, 277, 0, 478, 624, 737, 911, 1026, 1070, 1109}, /* AGG+SGI */ -}; - -/* mbps, mcs */ -static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { - { "1", "BPSK DSSS"}, - { "2", "QPSK DSSS"}, - {"5.5", "BPSK CCK"}, - { "11", "QPSK CCK"}, - { "6", "BPSK 1/2"}, - { "9", "BPSK 1/2"}, - { "12", "QPSK 1/2"}, - { "18", "QPSK 3/4"}, - { "24", "16QAM 1/2"}, - { "36", "16QAM 3/4"}, - { "48", "64QAM 2/3"}, - { "54", "64QAM 3/4"}, - { "60", "64QAM 5/6"}, -}; - -#define MCS_INDEX_PER_STREAM (8) - -static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window) -{ - window->data = 0; - window->success_counter = 0; - window->success_ratio = IWL_INVALID_VALUE; - window->counter = 0; - window->average_tpt = IWL_INVALID_VALUE; - window->stamp = 0; -} - -static inline u8 rs_is_valid_ant(u8 valid_antenna, u8 ant_type) -{ - return (ant_type & valid_antenna) == ant_type; -} - -/* - * removes the old data from the statistics. All data that is older than - * TID_MAX_TIME_DIFF, will be deleted. - */ -static void rs_tl_rm_old_stats(struct iwl_traffic_load *tl, u32 curr_time) -{ - /* The oldest age we want to keep */ - u32 oldest_time = curr_time - TID_MAX_TIME_DIFF; - - while (tl->queue_count && - (tl->time_stamp < oldest_time)) { - tl->total -= tl->packet_count[tl->head]; - tl->packet_count[tl->head] = 0; - tl->time_stamp += TID_QUEUE_CELL_SPACING; - tl->queue_count--; - tl->head++; - if (tl->head >= TID_QUEUE_MAX_SIZE) - tl->head = 0; - } -} - -/* - * increment traffic load value for tid and also remove - * any old values if passed the certain time period - */ -static u8 rs_tl_add_packet(struct iwl_lq_sta *lq_data, - struct ieee80211_hdr *hdr) -{ - u32 curr_time = jiffies_to_msecs(jiffies); - u32 time_diff; - s32 index; - struct iwl_traffic_load *tl = NULL; - u8 tid; - - if (ieee80211_is_data_qos(hdr->frame_control)) { - u8 *qc = ieee80211_get_qos_ctl(hdr); - tid = qc[0] & 0xf; - } else - return IWL_MAX_TID_COUNT; - - if (unlikely(tid >= IWL_MAX_TID_COUNT)) - return IWL_MAX_TID_COUNT; - - tl = &lq_data->load[tid]; - - curr_time -= curr_time % TID_ROUND_VALUE; - - /* Happens only for the first packet. Initialize the data */ - if (!(tl->queue_count)) { - tl->total = 1; - tl->time_stamp = curr_time; - tl->queue_count = 1; - tl->head = 0; - tl->packet_count[0] = 1; - return IWL_MAX_TID_COUNT; - } - - time_diff = TIME_WRAP_AROUND(tl->time_stamp, curr_time); - index = time_diff / TID_QUEUE_CELL_SPACING; - - /* The history is too long: remove data that is older than */ - /* TID_MAX_TIME_DIFF */ - if (index >= TID_QUEUE_MAX_SIZE) - rs_tl_rm_old_stats(tl, curr_time); - - index = (tl->head + index) % TID_QUEUE_MAX_SIZE; - tl->packet_count[index] = tl->packet_count[index] + 1; - tl->total = tl->total + 1; - - if ((index + 1) > tl->queue_count) - tl->queue_count = index + 1; - - return tid; -} - -#ifdef CONFIG_MAC80211_DEBUGFS -/** - * Program the device to use fixed rate for frame transmit - * This is for debugging/testing only - * once the device start use fixed rate, we need to reload the module - * to being back the normal operation. - */ -static void rs_program_fix_rate(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta) -{ - struct iwl_station_priv *sta_priv = - container_of(lq_sta, struct iwl_station_priv, lq_sta); - struct iwl_rxon_context *ctx = sta_priv->ctx; - - lq_sta->active_legacy_rate = 0x0FFF; /* 1 - 54 MBits, includes CCK */ - lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ - lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ - lq_sta->active_mimo3_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ - -#ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE - /* testmode has higher priority to overwirte the fixed rate */ - if (priv->tm_fixed_rate) - lq_sta->dbg_fixed_rate = priv->tm_fixed_rate; -#endif - - IWL_DEBUG_RATE(priv, "sta_id %d rate 0x%X\n", - lq_sta->lq.sta_id, lq_sta->dbg_fixed_rate); - - if (lq_sta->dbg_fixed_rate) { - rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate); - iwl_send_lq_cmd(lq_sta->drv, ctx, &lq_sta->lq, CMD_ASYNC, - false); - } -} -#endif - -/* - get the traffic load value for tid -*/ -static u32 rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid) -{ - u32 curr_time = jiffies_to_msecs(jiffies); - u32 time_diff; - s32 index; - struct iwl_traffic_load *tl = NULL; - - if (tid >= IWL_MAX_TID_COUNT) - return 0; - - tl = &(lq_data->load[tid]); - - curr_time -= curr_time % TID_ROUND_VALUE; - - if (!(tl->queue_count)) - return 0; - - time_diff = TIME_WRAP_AROUND(tl->time_stamp, curr_time); - index = time_diff / TID_QUEUE_CELL_SPACING; - - /* The history is too long: remove data that is older than */ - /* TID_MAX_TIME_DIFF */ - if (index >= TID_QUEUE_MAX_SIZE) - rs_tl_rm_old_stats(tl, curr_time); - - return tl->total; -} - -static int rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, - struct iwl_lq_sta *lq_data, u8 tid, - struct ieee80211_sta *sta) -{ - int ret = -EAGAIN; - u32 load; - - /* - * Don't create TX aggregation sessions when in high - * BT traffic, as they would just be disrupted by BT. - */ - if (priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH) { - IWL_DEBUG_COEX(priv, - "BT traffic (%d), no aggregation allowed\n", - priv->bt_traffic_load); - return ret; - } - - load = rs_tl_get_load(lq_data, tid); - - if ((iwlwifi_mod_params.auto_agg) || (load > IWL_AGG_LOAD_THRESHOLD)) { - IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", - sta->addr, tid); - ret = ieee80211_start_tx_ba_session(sta, tid, 5000); - if (ret == -EAGAIN) { - /* - * driver and mac80211 is out of sync - * this might be cause by reloading firmware - * stop the tx ba session here - */ - IWL_ERR(priv, "Fail start Tx agg on tid: %d\n", - tid); - ieee80211_stop_tx_ba_session(sta, tid); - } - } else { - IWL_DEBUG_HT(priv, "Aggregation not enabled for tid %d " - "because load = %u\n", tid, load); - } - return ret; -} - -static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid, - struct iwl_lq_sta *lq_data, - struct ieee80211_sta *sta) -{ - if (tid < IWL_MAX_TID_COUNT) - rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); - else - IWL_ERR(priv, "tid exceeds max TID count: %d/%d\n", - tid, IWL_MAX_TID_COUNT); -} - -static inline int get_num_of_ant_from_rate(u32 rate_n_flags) -{ - return !!(rate_n_flags & RATE_MCS_ANT_A_MSK) + - !!(rate_n_flags & RATE_MCS_ANT_B_MSK) + - !!(rate_n_flags & RATE_MCS_ANT_C_MSK); -} - -/* - * Static function to get the expected throughput from an iwl_scale_tbl_info - * that wraps a NULL pointer check - */ -static s32 get_expected_tpt(struct iwl_scale_tbl_info *tbl, int rs_index) -{ - if (tbl->expected_tpt) - return tbl->expected_tpt[rs_index]; - return 0; -} - -/** - * rs_collect_tx_data - Update the success/failure sliding window - * - * We keep a sliding window of the last 62 packets transmitted - * at this rate. window->data contains the bitmask of successful - * packets. - */ -static int rs_collect_tx_data(struct iwl_scale_tbl_info *tbl, - int scale_index, int attempts, int successes) -{ - struct iwl_rate_scale_data *window = NULL; - static const u64 mask = (((u64)1) << (IWL_RATE_MAX_WINDOW - 1)); - s32 fail_count, tpt; - - if (scale_index < 0 || scale_index >= IWL_RATE_COUNT) - return -EINVAL; - - /* Select window for current tx bit rate */ - window = &(tbl->win[scale_index]); - - /* Get expected throughput */ - tpt = get_expected_tpt(tbl, scale_index); - - /* - * Keep track of only the latest 62 tx frame attempts in this rate's - * history window; anything older isn't really relevant any more. - * If we have filled up the sliding window, drop the oldest attempt; - * if the oldest attempt (highest bit in bitmap) shows "success", - * subtract "1" from the success counter (this is the main reason - * we keep these bitmaps!). - */ - while (attempts > 0) { - if (window->counter >= IWL_RATE_MAX_WINDOW) { - - /* remove earliest */ - window->counter = IWL_RATE_MAX_WINDOW - 1; - - if (window->data & mask) { - window->data &= ~mask; - window->success_counter--; - } - } - - /* Increment frames-attempted counter */ - window->counter++; - - /* Shift bitmap by one frame to throw away oldest history */ - window->data <<= 1; - - /* Mark the most recent #successes attempts as successful */ - if (successes > 0) { - window->success_counter++; - window->data |= 0x1; - successes--; - } - - attempts--; - } - - /* Calculate current success ratio, avoid divide-by-0! */ - if (window->counter > 0) - window->success_ratio = 128 * (100 * window->success_counter) - / window->counter; - else - window->success_ratio = IWL_INVALID_VALUE; - - fail_count = window->counter - window->success_counter; - - /* Calculate average throughput, if we have enough history. */ - if ((fail_count >= IWL_RATE_MIN_FAILURE_TH) || - (window->success_counter >= IWL_RATE_MIN_SUCCESS_TH)) - window->average_tpt = (window->success_ratio * tpt + 64) / 128; - else - window->average_tpt = IWL_INVALID_VALUE; - - /* Tag this window as having been updated */ - window->stamp = jiffies; - - return 0; -} - -/* - * Fill uCode API rate_n_flags field, based on "search" or "active" table. - */ -/* FIXME:RS:remove this function and put the flags statically in the table */ -static u32 rate_n_flags_from_tbl(struct iwl_priv *priv, - struct iwl_scale_tbl_info *tbl, - int index, u8 use_green) -{ - u32 rate_n_flags = 0; - - if (is_legacy(tbl->lq_type)) { - rate_n_flags = iwl_rates[index].plcp; - if (index >= IWL_FIRST_CCK_RATE && index <= IWL_LAST_CCK_RATE) - rate_n_flags |= RATE_MCS_CCK_MSK; - - } else if (is_Ht(tbl->lq_type)) { - if (index > IWL_LAST_OFDM_RATE) { - IWL_ERR(priv, "Invalid HT rate index %d\n", index); - index = IWL_LAST_OFDM_RATE; - } - rate_n_flags = RATE_MCS_HT_MSK; - - if (is_siso(tbl->lq_type)) - rate_n_flags |= iwl_rates[index].plcp_siso; - else if (is_mimo2(tbl->lq_type)) - rate_n_flags |= iwl_rates[index].plcp_mimo2; - else - rate_n_flags |= iwl_rates[index].plcp_mimo3; - } else { - IWL_ERR(priv, "Invalid tbl->lq_type %d\n", tbl->lq_type); - } - - rate_n_flags |= ((tbl->ant_type << RATE_MCS_ANT_POS) & - RATE_MCS_ANT_ABC_MSK); - - if (is_Ht(tbl->lq_type)) { - if (tbl->is_ht40) { - if (tbl->is_dup) - rate_n_flags |= RATE_MCS_DUP_MSK; - else - rate_n_flags |= RATE_MCS_HT40_MSK; - } - if (tbl->is_SGI) - rate_n_flags |= RATE_MCS_SGI_MSK; - - if (use_green) { - rate_n_flags |= RATE_MCS_GF_MSK; - if (is_siso(tbl->lq_type) && tbl->is_SGI) { - rate_n_flags &= ~RATE_MCS_SGI_MSK; - IWL_ERR(priv, "GF was set with SGI:SISO\n"); - } - } - } - return rate_n_flags; -} - -/* - * Interpret uCode API's rate_n_flags format, - * fill "search" or "active" tx mode table. - */ -static int rs_get_tbl_info_from_mcs(const u32 rate_n_flags, - enum ieee80211_band band, - struct iwl_scale_tbl_info *tbl, - int *rate_idx) -{ - u32 ant_msk = (rate_n_flags & RATE_MCS_ANT_ABC_MSK); - u8 num_of_ant = get_num_of_ant_from_rate(rate_n_flags); - u8 mcs; - - memset(tbl, 0, sizeof(struct iwl_scale_tbl_info)); - *rate_idx = iwl_hwrate_to_plcp_idx(rate_n_flags); - - if (*rate_idx == IWL_RATE_INVALID) { - *rate_idx = -1; - return -EINVAL; - } - tbl->is_SGI = 0; /* default legacy setup */ - tbl->is_ht40 = 0; - tbl->is_dup = 0; - tbl->ant_type = (ant_msk >> RATE_MCS_ANT_POS); - tbl->lq_type = LQ_NONE; - tbl->max_search = IWL_MAX_SEARCH; - - /* legacy rate format */ - if (!(rate_n_flags & RATE_MCS_HT_MSK)) { - if (num_of_ant == 1) { - if (band == IEEE80211_BAND_5GHZ) - tbl->lq_type = LQ_A; - else - tbl->lq_type = LQ_G; - } - /* HT rate format */ - } else { - if (rate_n_flags & RATE_MCS_SGI_MSK) - tbl->is_SGI = 1; - - if ((rate_n_flags & RATE_MCS_HT40_MSK) || - (rate_n_flags & RATE_MCS_DUP_MSK)) - tbl->is_ht40 = 1; - - if (rate_n_flags & RATE_MCS_DUP_MSK) - tbl->is_dup = 1; - - mcs = rs_extract_rate(rate_n_flags); - - /* SISO */ - if (mcs <= IWL_RATE_SISO_60M_PLCP) { - if (num_of_ant == 1) - tbl->lq_type = LQ_SISO; /*else NONE*/ - /* MIMO2 */ - } else if (mcs <= IWL_RATE_MIMO2_60M_PLCP) { - if (num_of_ant == 2) - tbl->lq_type = LQ_MIMO2; - /* MIMO3 */ - } else { - if (num_of_ant == 3) { - tbl->max_search = IWL_MAX_11N_MIMO3_SEARCH; - tbl->lq_type = LQ_MIMO3; - } - } - } - return 0; -} - -/* switch to another antenna/antennas and return 1 */ -/* if no other valid antenna found, return 0 */ -static int rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags, - struct iwl_scale_tbl_info *tbl) -{ - u8 new_ant_type; - - if (!tbl->ant_type || tbl->ant_type > ANT_ABC) - return 0; - - if (!rs_is_valid_ant(valid_ant, tbl->ant_type)) - return 0; - - new_ant_type = ant_toggle_lookup[tbl->ant_type]; - - while ((new_ant_type != tbl->ant_type) && - !rs_is_valid_ant(valid_ant, new_ant_type)) - new_ant_type = ant_toggle_lookup[new_ant_type]; - - if (new_ant_type == tbl->ant_type) - return 0; - - tbl->ant_type = new_ant_type; - *rate_n_flags &= ~RATE_MCS_ANT_ABC_MSK; - *rate_n_flags |= new_ant_type << RATE_MCS_ANT_POS; - return 1; -} - -/** - * Green-field mode is valid if the station supports it and - * there are no non-GF stations present in the BSS. - */ -static bool rs_use_green(struct ieee80211_sta *sta) -{ - /* - * There's a bug somewhere in this code that causes the - * scaling to get stuck because GF+SGI can't be combined - * in SISO rates. Until we find that bug, disable GF, it - * has only limited benefit and we still interoperate with - * GF APs since we can always receive GF transmissions. - */ - return false; -} - -/** - * rs_get_supported_rates - get the available rates - * - * if management frame or broadcast frame only return - * basic available rates. - * - */ -static u16 rs_get_supported_rates(struct iwl_lq_sta *lq_sta, - struct ieee80211_hdr *hdr, - enum iwl_table_type rate_type) -{ - if (is_legacy(rate_type)) { - return lq_sta->active_legacy_rate; - } else { - if (is_siso(rate_type)) - return lq_sta->active_siso_rate; - else if (is_mimo2(rate_type)) - return lq_sta->active_mimo2_rate; - else - return lq_sta->active_mimo3_rate; - } -} - -static u16 rs_get_adjacent_rate(struct iwl_priv *priv, u8 index, u16 rate_mask, - int rate_type) -{ - u8 high = IWL_RATE_INVALID; - u8 low = IWL_RATE_INVALID; - - /* 802.11A or ht walks to the next literal adjacent rate in - * the rate table */ - if (is_a_band(rate_type) || !is_legacy(rate_type)) { - int i; - u32 mask; - - /* Find the previous rate that is in the rate mask */ - i = index - 1; - for (mask = (1 << i); i >= 0; i--, mask >>= 1) { - if (rate_mask & mask) { - low = i; - break; - } - } - - /* Find the next rate that is in the rate mask */ - i = index + 1; - for (mask = (1 << i); i < IWL_RATE_COUNT; i++, mask <<= 1) { - if (rate_mask & mask) { - high = i; - break; - } - } - - return (high << 8) | low; - } - - low = index; - while (low != IWL_RATE_INVALID) { - low = iwl_rates[low].prev_rs; - if (low == IWL_RATE_INVALID) - break; - if (rate_mask & (1 << low)) - break; - IWL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low); - } - - high = index; - while (high != IWL_RATE_INVALID) { - high = iwl_rates[high].next_rs; - if (high == IWL_RATE_INVALID) - break; - if (rate_mask & (1 << high)) - break; - IWL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high); - } - - return (high << 8) | low; -} - -static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta, - struct iwl_scale_tbl_info *tbl, - u8 scale_index, u8 ht_possible) -{ - s32 low; - u16 rate_mask; - u16 high_low; - u8 switch_to_legacy = 0; - u8 is_green = lq_sta->is_green; - struct iwl_priv *priv = lq_sta->drv; - - /* check if we need to switch from HT to legacy rates. - * assumption is that mandatory rates (1Mbps or 6Mbps) - * are always supported (spec demand) */ - if (!is_legacy(tbl->lq_type) && (!ht_possible || !scale_index)) { - switch_to_legacy = 1; - scale_index = rs_ht_to_legacy[scale_index]; - if (lq_sta->band == IEEE80211_BAND_5GHZ) - tbl->lq_type = LQ_A; - else - tbl->lq_type = LQ_G; - - if (num_of_ant(tbl->ant_type) > 1) - tbl->ant_type = - first_antenna(priv->nvm_data->valid_tx_ant); - - tbl->is_ht40 = 0; - tbl->is_SGI = 0; - tbl->max_search = IWL_MAX_SEARCH; - } - - rate_mask = rs_get_supported_rates(lq_sta, NULL, tbl->lq_type); - - /* Mask with station rate restriction */ - if (is_legacy(tbl->lq_type)) { - /* supp_rates has no CCK bits in A mode */ - if (lq_sta->band == IEEE80211_BAND_5GHZ) - rate_mask = (u16)(rate_mask & - (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE)); - else - rate_mask = (u16)(rate_mask & lq_sta->supp_rates); - } - - /* If we switched from HT to legacy, check current rate */ - if (switch_to_legacy && (rate_mask & (1 << scale_index))) { - low = scale_index; - goto out; - } - - high_low = rs_get_adjacent_rate(lq_sta->drv, scale_index, rate_mask, - tbl->lq_type); - low = high_low & 0xff; - - if (low == IWL_RATE_INVALID) - low = scale_index; - -out: - return rate_n_flags_from_tbl(lq_sta->drv, tbl, low, is_green); -} - -/* - * Simple function to compare two rate scale table types - */ -static bool table_type_matches(struct iwl_scale_tbl_info *a, - struct iwl_scale_tbl_info *b) -{ - return (a->lq_type == b->lq_type) && (a->ant_type == b->ant_type) && - (a->is_SGI == b->is_SGI); -} - -static void rs_bt_update_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - struct iwl_lq_sta *lq_sta) -{ - struct iwl_scale_tbl_info *tbl; - bool full_concurrent = priv->bt_full_concurrent; - - if (priv->bt_ant_couple_ok) { - /* - * Is there a need to switch between - * full concurrency and 3-wire? - */ - if (priv->bt_ci_compliance && priv->bt_ant_couple_ok) - full_concurrent = true; - else - full_concurrent = false; - } - if ((priv->bt_traffic_load != priv->last_bt_traffic_load) || - (priv->bt_full_concurrent != full_concurrent)) { - priv->bt_full_concurrent = full_concurrent; - priv->last_bt_traffic_load = priv->bt_traffic_load; - - /* Update uCode's rate table. */ - tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - rs_fill_link_cmd(priv, lq_sta, tbl->current_rate); - iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); - - queue_work(priv->workqueue, &priv->bt_full_concurrency); - } -} - -/* - * mac80211 sends us Tx status - */ -static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta, - struct sk_buff *skb) -{ - int legacy_success; - int retries; - int rs_index, mac_index, i; - struct iwl_lq_sta *lq_sta = priv_sta; - struct iwl_link_quality_cmd *table; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct iwl_op_mode *op_mode = (struct iwl_op_mode *)priv_r; - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - enum mac80211_rate_control_flags mac_flags; - u32 tx_rate; - struct iwl_scale_tbl_info tbl_type; - struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; - struct iwl_rxon_context *ctx = sta_priv->ctx; - - IWL_DEBUG_RATE_LIMIT(priv, "get frame ack response, update rate scale window\n"); - - /* Treat uninitialized rate scaling data same as non-existing. */ - if (!lq_sta) { - IWL_DEBUG_RATE(priv, "Station rate scaling not created yet.\n"); - return; - } else if (!lq_sta->drv) { - IWL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); - return; - } - - if (!ieee80211_is_data(hdr->frame_control) || - info->flags & IEEE80211_TX_CTL_NO_ACK) - return; - - /* This packet was aggregated but doesn't carry status info */ - if ((info->flags & IEEE80211_TX_CTL_AMPDU) && - !(info->flags & IEEE80211_TX_STAT_AMPDU)) - return; - - /* - * Ignore this Tx frame response if its initial rate doesn't match - * that of latest Link Quality command. There may be stragglers - * from a previous Link Quality command, but we're no longer interested - * in those; they're either from the "active" mode while we're trying - * to check "search" mode, or a prior "search" mode after we've moved - * to a new "search" mode (which might become the new "active" mode). - */ - table = &lq_sta->lq; - tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); - rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, &rs_index); - if (priv->band == IEEE80211_BAND_5GHZ) - rs_index -= IWL_FIRST_OFDM_RATE; - mac_flags = info->status.rates[0].flags; - mac_index = info->status.rates[0].idx; - /* For HT packets, map MCS to PLCP */ - if (mac_flags & IEEE80211_TX_RC_MCS) { - mac_index &= RATE_MCS_CODE_MSK; /* Remove # of streams */ - if (mac_index >= (IWL_RATE_9M_INDEX - IWL_FIRST_OFDM_RATE)) - mac_index++; - /* - * mac80211 HT index is always zero-indexed; we need to move - * HT OFDM rates after CCK rates in 2.4 GHz band - */ - if (priv->band == IEEE80211_BAND_2GHZ) - mac_index += IWL_FIRST_OFDM_RATE; - } - /* Here we actually compare this rate to the latest LQ command */ - if ((mac_index < 0) || - (tbl_type.is_SGI != !!(mac_flags & IEEE80211_TX_RC_SHORT_GI)) || - (tbl_type.is_ht40 != !!(mac_flags & IEEE80211_TX_RC_40_MHZ_WIDTH)) || - (tbl_type.is_dup != !!(mac_flags & IEEE80211_TX_RC_DUP_DATA)) || - (tbl_type.ant_type != info->status.antenna) || - (!!(tx_rate & RATE_MCS_HT_MSK) != !!(mac_flags & IEEE80211_TX_RC_MCS)) || - (!!(tx_rate & RATE_MCS_GF_MSK) != !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD)) || - (rs_index != mac_index)) { - IWL_DEBUG_RATE(priv, "initial rate %d does not match %d (0x%x)\n", mac_index, rs_index, tx_rate); - /* - * Since rates mis-match, the last LQ command may have failed. - * After IWL_MISSED_RATE_MAX mis-matches, resync the uCode with - * ... driver. - */ - lq_sta->missed_rate_counter++; - if (lq_sta->missed_rate_counter > IWL_MISSED_RATE_MAX) { - lq_sta->missed_rate_counter = 0; - iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); - } - /* Regardless, ignore this status info for outdated rate */ - return; - } else - /* Rate did match, so reset the missed_rate_counter */ - lq_sta->missed_rate_counter = 0; - - /* Figure out if rate scale algorithm is in active or search table */ - if (table_type_matches(&tbl_type, - &(lq_sta->lq_info[lq_sta->active_tbl]))) { - curr_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - other_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); - } else if (table_type_matches(&tbl_type, - &lq_sta->lq_info[1 - lq_sta->active_tbl])) { - curr_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); - other_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - } else { - IWL_DEBUG_RATE(priv, "Neither active nor search matches tx rate\n"); - tmp_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - IWL_DEBUG_RATE(priv, "active- lq:%x, ant:%x, SGI:%d\n", - tmp_tbl->lq_type, tmp_tbl->ant_type, tmp_tbl->is_SGI); - tmp_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); - IWL_DEBUG_RATE(priv, "search- lq:%x, ant:%x, SGI:%d\n", - tmp_tbl->lq_type, tmp_tbl->ant_type, tmp_tbl->is_SGI); - IWL_DEBUG_RATE(priv, "actual- lq:%x, ant:%x, SGI:%d\n", - tbl_type.lq_type, tbl_type.ant_type, tbl_type.is_SGI); - /* - * no matching table found, let's by-pass the data collection - * and continue to perform rate scale to find the rate table - */ - rs_stay_in_table(lq_sta, true); - goto done; - } - - /* - * Updating the frame history depends on whether packets were - * aggregated. - * - * For aggregation, all packets were transmitted at the same rate, the - * first index into rate scale table. - */ - if (info->flags & IEEE80211_TX_STAT_AMPDU) { - tx_rate = le32_to_cpu(table->rs_table[0].rate_n_flags); - rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, - &rs_index); - rs_collect_tx_data(curr_tbl, rs_index, - info->status.ampdu_len, - info->status.ampdu_ack_len); - - /* Update success/fail counts if not searching for new mode */ - if (lq_sta->stay_in_tbl) { - lq_sta->total_success += info->status.ampdu_ack_len; - lq_sta->total_failed += (info->status.ampdu_len - - info->status.ampdu_ack_len); - } - } else { - /* - * For legacy, update frame history with for each Tx retry. - */ - retries = info->status.rates[0].count - 1; - /* HW doesn't send more than 15 retries */ - retries = min(retries, 15); - - /* The last transmission may have been successful */ - legacy_success = !!(info->flags & IEEE80211_TX_STAT_ACK); - /* Collect data for each rate used during failed TX attempts */ - for (i = 0; i <= retries; ++i) { - tx_rate = le32_to_cpu(table->rs_table[i].rate_n_flags); - rs_get_tbl_info_from_mcs(tx_rate, priv->band, - &tbl_type, &rs_index); - /* - * Only collect stats if retried rate is in the same RS - * table as active/search. - */ - if (table_type_matches(&tbl_type, curr_tbl)) - tmp_tbl = curr_tbl; - else if (table_type_matches(&tbl_type, other_tbl)) - tmp_tbl = other_tbl; - else - continue; - rs_collect_tx_data(tmp_tbl, rs_index, 1, - i < retries ? 0 : legacy_success); - } - - /* Update success/fail counts if not searching for new mode */ - if (lq_sta->stay_in_tbl) { - lq_sta->total_success += legacy_success; - lq_sta->total_failed += retries + (1 - legacy_success); - } - } - /* The last TX rate is cached in lq_sta; it's set in if/else above */ - lq_sta->last_rate_n_flags = tx_rate; -done: - /* See if there's a better rate or modulation mode to try. */ - if (sta && sta->supp_rates[sband->band]) - rs_rate_scale_perform(priv, skb, sta, lq_sta); - -#if defined(CONFIG_MAC80211_DEBUGFS) && defined(CONFIG_IWLWIFI_DEVICE_TESTMODE) - if ((priv->tm_fixed_rate) && - (priv->tm_fixed_rate != lq_sta->dbg_fixed_rate)) - rs_program_fix_rate(priv, lq_sta); -#endif - if (priv->cfg->bt_params && priv->cfg->bt_params->advanced_bt_coexist) - rs_bt_update_lq(priv, ctx, lq_sta); -} - -/* - * Begin a period of staying with a selected modulation mode. - * Set "stay_in_tbl" flag to prevent any mode switches. - * Set frame tx success limits according to legacy vs. high-throughput, - * and reset overall (spanning all rates) tx success history statistics. - * These control how long we stay using same modulation mode before - * searching for a new mode. - */ -static void rs_set_stay_in_table(struct iwl_priv *priv, u8 is_legacy, - struct iwl_lq_sta *lq_sta) -{ - IWL_DEBUG_RATE(priv, "we are staying in the same table\n"); - lq_sta->stay_in_tbl = 1; /* only place this gets set */ - if (is_legacy) { - lq_sta->table_count_limit = IWL_LEGACY_TABLE_COUNT; - lq_sta->max_failure_limit = IWL_LEGACY_FAILURE_LIMIT; - lq_sta->max_success_limit = IWL_LEGACY_SUCCESS_LIMIT; - } else { - lq_sta->table_count_limit = IWL_NONE_LEGACY_TABLE_COUNT; - lq_sta->max_failure_limit = IWL_NONE_LEGACY_FAILURE_LIMIT; - lq_sta->max_success_limit = IWL_NONE_LEGACY_SUCCESS_LIMIT; - } - lq_sta->table_count = 0; - lq_sta->total_failed = 0; - lq_sta->total_success = 0; - lq_sta->flush_timer = jiffies; - lq_sta->action_counter = 0; -} - -/* - * Find correct throughput table for given mode of modulation - */ -static void rs_set_expected_tpt_table(struct iwl_lq_sta *lq_sta, - struct iwl_scale_tbl_info *tbl) -{ - /* Used to choose among HT tables */ - s32 (*ht_tbl_pointer)[IWL_RATE_COUNT]; - - /* Check for invalid LQ type */ - if (WARN_ON_ONCE(!is_legacy(tbl->lq_type) && !is_Ht(tbl->lq_type))) { - tbl->expected_tpt = expected_tpt_legacy; - return; - } - - /* Legacy rates have only one table */ - if (is_legacy(tbl->lq_type)) { - tbl->expected_tpt = expected_tpt_legacy; - return; - } - - /* Choose among many HT tables depending on number of streams - * (SISO/MIMO2/MIMO3), channel width (20/40), SGI, and aggregation - * status */ - if (is_siso(tbl->lq_type) && (!tbl->is_ht40 || lq_sta->is_dup)) - ht_tbl_pointer = expected_tpt_siso20MHz; - else if (is_siso(tbl->lq_type)) - ht_tbl_pointer = expected_tpt_siso40MHz; - else if (is_mimo2(tbl->lq_type) && (!tbl->is_ht40 || lq_sta->is_dup)) - ht_tbl_pointer = expected_tpt_mimo2_20MHz; - else if (is_mimo2(tbl->lq_type)) - ht_tbl_pointer = expected_tpt_mimo2_40MHz; - else if (is_mimo3(tbl->lq_type) && (!tbl->is_ht40 || lq_sta->is_dup)) - ht_tbl_pointer = expected_tpt_mimo3_20MHz; - else /* if (is_mimo3(tbl->lq_type)) <-- must be true */ - ht_tbl_pointer = expected_tpt_mimo3_40MHz; - - if (!tbl->is_SGI && !lq_sta->is_agg) /* Normal */ - tbl->expected_tpt = ht_tbl_pointer[0]; - else if (tbl->is_SGI && !lq_sta->is_agg) /* SGI */ - tbl->expected_tpt = ht_tbl_pointer[1]; - else if (!tbl->is_SGI && lq_sta->is_agg) /* AGG */ - tbl->expected_tpt = ht_tbl_pointer[2]; - else /* AGG+SGI */ - tbl->expected_tpt = ht_tbl_pointer[3]; -} - -/* - * Find starting rate for new "search" high-throughput mode of modulation. - * Goal is to find lowest expected rate (under perfect conditions) that is - * above the current measured throughput of "active" mode, to give new mode - * a fair chance to prove itself without too many challenges. - * - * This gets called when transitioning to more aggressive modulation - * (i.e. legacy to SISO or MIMO, or SISO to MIMO), as well as less aggressive - * (i.e. MIMO to SISO). When moving to MIMO, bit rate will typically need - * to decrease to match "active" throughput. When moving from MIMO to SISO, - * bit rate will typically need to increase, but not if performance was bad. - */ -static s32 rs_get_best_rate(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, - struct iwl_scale_tbl_info *tbl, /* "search" */ - u16 rate_mask, s8 index) -{ - /* "active" values */ - struct iwl_scale_tbl_info *active_tbl = - &(lq_sta->lq_info[lq_sta->active_tbl]); - s32 active_sr = active_tbl->win[index].success_ratio; - s32 active_tpt = active_tbl->expected_tpt[index]; - - /* expected "search" throughput */ - s32 *tpt_tbl = tbl->expected_tpt; - - s32 new_rate, high, low, start_hi; - u16 high_low; - s8 rate = index; - - new_rate = high = low = start_hi = IWL_RATE_INVALID; - - for (; ;) { - high_low = rs_get_adjacent_rate(priv, rate, rate_mask, - tbl->lq_type); - - low = high_low & 0xff; - high = (high_low >> 8) & 0xff; - - /* - * Lower the "search" bit rate, to give new "search" mode - * approximately the same throughput as "active" if: - * - * 1) "Active" mode has been working modestly well (but not - * great), and expected "search" throughput (under perfect - * conditions) at candidate rate is above the actual - * measured "active" throughput (but less than expected - * "active" throughput under perfect conditions). - * OR - * 2) "Active" mode has been working perfectly or very well - * and expected "search" throughput (under perfect - * conditions) at candidate rate is above expected - * "active" throughput (under perfect conditions). - */ - if ((((100 * tpt_tbl[rate]) > lq_sta->last_tpt) && - ((active_sr > IWL_RATE_DECREASE_TH) && - (active_sr <= IWL_RATE_HIGH_TH) && - (tpt_tbl[rate] <= active_tpt))) || - ((active_sr >= IWL_RATE_SCALE_SWITCH) && - (tpt_tbl[rate] > active_tpt))) { - - /* (2nd or later pass) - * If we've already tried to raise the rate, and are - * now trying to lower it, use the higher rate. */ - if (start_hi != IWL_RATE_INVALID) { - new_rate = start_hi; - break; - } - - new_rate = rate; - - /* Loop again with lower rate */ - if (low != IWL_RATE_INVALID) - rate = low; - - /* Lower rate not available, use the original */ - else - break; - - /* Else try to raise the "search" rate to match "active" */ - } else { - /* (2nd or later pass) - * If we've already tried to lower the rate, and are - * now trying to raise it, use the lower rate. */ - if (new_rate != IWL_RATE_INVALID) - break; - - /* Loop again with higher rate */ - else if (high != IWL_RATE_INVALID) { - start_hi = high; - rate = high; - - /* Higher rate not available, use the original */ - } else { - new_rate = rate; - break; - } - } - } - - return new_rate; -} - -/* - * Set up search table for MIMO2 - */ -static int rs_switch_to_mimo2(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, - struct ieee80211_conf *conf, - struct ieee80211_sta *sta, - struct iwl_scale_tbl_info *tbl, int index) -{ - u16 rate_mask; - s32 rate; - s8 is_green = lq_sta->is_green; - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; - struct iwl_rxon_context *ctx = sta_priv->ctx; - - if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) - return -1; - - if (sta->smps_mode == IEEE80211_SMPS_STATIC) - return -1; - - /* Need both Tx chains/antennas to support MIMO */ - if (priv->hw_params.tx_chains_num < 2) - return -1; - - IWL_DEBUG_RATE(priv, "LQ: try to switch to MIMO2\n"); - - tbl->lq_type = LQ_MIMO2; - tbl->is_dup = lq_sta->is_dup; - tbl->action = 0; - tbl->max_search = IWL_MAX_SEARCH; - rate_mask = lq_sta->active_mimo2_rate; - - if (iwl_is_ht40_tx_allowed(priv, ctx, sta)) - tbl->is_ht40 = 1; - else - tbl->is_ht40 = 0; - - rs_set_expected_tpt_table(lq_sta, tbl); - - rate = rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); - - IWL_DEBUG_RATE(priv, "LQ: MIMO2 best rate %d mask %X\n", rate, rate_mask); - if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { - IWL_DEBUG_RATE(priv, "Can't switch with index %d rate mask %x\n", - rate, rate_mask); - return -1; - } - tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, rate, is_green); - - IWL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n", - tbl->current_rate, is_green); - return 0; -} - -/* - * Set up search table for MIMO3 - */ -static int rs_switch_to_mimo3(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, - struct ieee80211_conf *conf, - struct ieee80211_sta *sta, - struct iwl_scale_tbl_info *tbl, int index) -{ - u16 rate_mask; - s32 rate; - s8 is_green = lq_sta->is_green; - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; - struct iwl_rxon_context *ctx = sta_priv->ctx; - - if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) - return -1; - - if (sta->smps_mode == IEEE80211_SMPS_STATIC) - return -1; - - /* Need both Tx chains/antennas to support MIMO */ - if (priv->hw_params.tx_chains_num < 3) - return -1; - - IWL_DEBUG_RATE(priv, "LQ: try to switch to MIMO3\n"); - - tbl->lq_type = LQ_MIMO3; - tbl->is_dup = lq_sta->is_dup; - tbl->action = 0; - tbl->max_search = IWL_MAX_11N_MIMO3_SEARCH; - rate_mask = lq_sta->active_mimo3_rate; - - if (iwl_is_ht40_tx_allowed(priv, ctx, sta)) - tbl->is_ht40 = 1; - else - tbl->is_ht40 = 0; - - rs_set_expected_tpt_table(lq_sta, tbl); - - rate = rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); - - IWL_DEBUG_RATE(priv, "LQ: MIMO3 best rate %d mask %X\n", - rate, rate_mask); - if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { - IWL_DEBUG_RATE(priv, "Can't switch with index %d rate mask %x\n", - rate, rate_mask); - return -1; - } - tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, rate, is_green); - - IWL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n", - tbl->current_rate, is_green); - return 0; -} - -/* - * Set up search table for SISO - */ -static int rs_switch_to_siso(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, - struct ieee80211_conf *conf, - struct ieee80211_sta *sta, - struct iwl_scale_tbl_info *tbl, int index) -{ - u16 rate_mask; - u8 is_green = lq_sta->is_green; - s32 rate; - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; - struct iwl_rxon_context *ctx = sta_priv->ctx; - - if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) - return -1; - - IWL_DEBUG_RATE(priv, "LQ: try to switch to SISO\n"); - - tbl->is_dup = lq_sta->is_dup; - tbl->lq_type = LQ_SISO; - tbl->action = 0; - tbl->max_search = IWL_MAX_SEARCH; - rate_mask = lq_sta->active_siso_rate; - - if (iwl_is_ht40_tx_allowed(priv, ctx, sta)) - tbl->is_ht40 = 1; - else - tbl->is_ht40 = 0; - - if (is_green) - tbl->is_SGI = 0; /*11n spec: no SGI in SISO+Greenfield*/ - - rs_set_expected_tpt_table(lq_sta, tbl); - rate = rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); - - IWL_DEBUG_RATE(priv, "LQ: get best rate %d mask %X\n", rate, rate_mask); - if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { - IWL_DEBUG_RATE(priv, "can not switch with index %d rate mask %x\n", - rate, rate_mask); - return -1; - } - tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, rate, is_green); - IWL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n", - tbl->current_rate, is_green); - return 0; -} - -/* - * Try to switch to new modulation mode from legacy - */ -static int rs_move_legacy_other(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, - struct ieee80211_conf *conf, - struct ieee80211_sta *sta, - int index) -{ - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - struct iwl_scale_tbl_info *search_tbl = - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - struct iwl_rate_scale_data *window = &(tbl->win[index]); - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); - u8 start_action; - u8 valid_tx_ant = priv->nvm_data->valid_tx_ant; - u8 tx_chains_num = priv->hw_params.tx_chains_num; - int ret = 0; - u8 update_search_tbl_counter = 0; - - switch (priv->bt_traffic_load) { - case IWL_BT_COEX_TRAFFIC_LOAD_NONE: - /* nothing */ - break; - case IWL_BT_COEX_TRAFFIC_LOAD_LOW: - /* avoid antenna B unless MIMO */ - if (tbl->action == IWL_LEGACY_SWITCH_ANTENNA2) - tbl->action = IWL_LEGACY_SWITCH_SISO; - break; - case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: - case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: - /* avoid antenna B and MIMO */ - valid_tx_ant = - first_antenna(priv->nvm_data->valid_tx_ant); - if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2 && - tbl->action != IWL_LEGACY_SWITCH_SISO) - tbl->action = IWL_LEGACY_SWITCH_SISO; - break; - default: - IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); - break; - } - - if (!iwl_ht_enabled(priv)) - /* stay in Legacy */ - tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; - else if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE && - tbl->action > IWL_LEGACY_SWITCH_SISO) - tbl->action = IWL_LEGACY_SWITCH_SISO; - - /* configure as 1x1 if bt full concurrency */ - if (priv->bt_full_concurrent) { - if (!iwl_ht_enabled(priv)) - tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; - else if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2) - tbl->action = IWL_LEGACY_SWITCH_SISO; - valid_tx_ant = - first_antenna(priv->nvm_data->valid_tx_ant); - } - - start_action = tbl->action; - for (; ;) { - lq_sta->action_counter++; - switch (tbl->action) { - case IWL_LEGACY_SWITCH_ANTENNA1: - case IWL_LEGACY_SWITCH_ANTENNA2: - IWL_DEBUG_RATE(priv, "LQ: Legacy toggle Antenna\n"); - - if ((tbl->action == IWL_LEGACY_SWITCH_ANTENNA1 && - tx_chains_num <= 1) || - (tbl->action == IWL_LEGACY_SWITCH_ANTENNA2 && - tx_chains_num <= 2)) - break; - - /* Don't change antenna if success has been great */ - if (window->success_ratio >= IWL_RS_GOOD_RATIO && - !priv->bt_full_concurrent && - priv->bt_traffic_load == - IWL_BT_COEX_TRAFFIC_LOAD_NONE) - break; - - /* Set up search table to try other antenna */ - memcpy(search_tbl, tbl, sz); - - if (rs_toggle_antenna(valid_tx_ant, - &search_tbl->current_rate, search_tbl)) { - update_search_tbl_counter = 1; - rs_set_expected_tpt_table(lq_sta, search_tbl); - goto out; - } - break; - case IWL_LEGACY_SWITCH_SISO: - IWL_DEBUG_RATE(priv, "LQ: Legacy switch to SISO\n"); - - /* Set up search table to try SISO */ - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - ret = rs_switch_to_siso(priv, lq_sta, conf, sta, - search_tbl, index); - if (!ret) { - lq_sta->action_counter = 0; - goto out; - } - - break; - case IWL_LEGACY_SWITCH_MIMO2_AB: - case IWL_LEGACY_SWITCH_MIMO2_AC: - case IWL_LEGACY_SWITCH_MIMO2_BC: - IWL_DEBUG_RATE(priv, "LQ: Legacy switch to MIMO2\n"); - - /* Set up search table to try MIMO */ - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - - if (tbl->action == IWL_LEGACY_SWITCH_MIMO2_AB) - search_tbl->ant_type = ANT_AB; - else if (tbl->action == IWL_LEGACY_SWITCH_MIMO2_AC) - search_tbl->ant_type = ANT_AC; - else - search_tbl->ant_type = ANT_BC; - - if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) - break; - - ret = rs_switch_to_mimo2(priv, lq_sta, conf, sta, - search_tbl, index); - if (!ret) { - lq_sta->action_counter = 0; - goto out; - } - break; - - case IWL_LEGACY_SWITCH_MIMO3_ABC: - IWL_DEBUG_RATE(priv, "LQ: Legacy switch to MIMO3\n"); - - /* Set up search table to try MIMO3 */ - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - - search_tbl->ant_type = ANT_ABC; - - if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) - break; - - ret = rs_switch_to_mimo3(priv, lq_sta, conf, sta, - search_tbl, index); - if (!ret) { - lq_sta->action_counter = 0; - goto out; - } - break; - } - tbl->action++; - if (tbl->action > IWL_LEGACY_SWITCH_MIMO3_ABC) - tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; - - if (tbl->action == start_action) - break; - - } - search_tbl->lq_type = LQ_NONE; - return 0; - -out: - lq_sta->search_better_tbl = 1; - tbl->action++; - if (tbl->action > IWL_LEGACY_SWITCH_MIMO3_ABC) - tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; - if (update_search_tbl_counter) - search_tbl->action = tbl->action; - return 0; - -} - -/* - * Try to switch to new modulation mode from SISO - */ -static int rs_move_siso_to_other(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, - struct ieee80211_conf *conf, - struct ieee80211_sta *sta, int index) -{ - u8 is_green = lq_sta->is_green; - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - struct iwl_scale_tbl_info *search_tbl = - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - struct iwl_rate_scale_data *window = &(tbl->win[index]); - struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); - u8 start_action; - u8 valid_tx_ant = priv->nvm_data->valid_tx_ant; - u8 tx_chains_num = priv->hw_params.tx_chains_num; - u8 update_search_tbl_counter = 0; - int ret; - - switch (priv->bt_traffic_load) { - case IWL_BT_COEX_TRAFFIC_LOAD_NONE: - /* nothing */ - break; - case IWL_BT_COEX_TRAFFIC_LOAD_LOW: - /* avoid antenna B unless MIMO */ - if (tbl->action == IWL_SISO_SWITCH_ANTENNA2) - tbl->action = IWL_SISO_SWITCH_MIMO2_AB; - break; - case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: - case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: - /* avoid antenna B and MIMO */ - valid_tx_ant = - first_antenna(priv->nvm_data->valid_tx_ant); - if (tbl->action != IWL_SISO_SWITCH_ANTENNA1) - tbl->action = IWL_SISO_SWITCH_ANTENNA1; - break; - default: - IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); - break; - } - - if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE && - tbl->action > IWL_SISO_SWITCH_ANTENNA2) { - /* stay in SISO */ - tbl->action = IWL_SISO_SWITCH_ANTENNA1; - } - - /* configure as 1x1 if bt full concurrency */ - if (priv->bt_full_concurrent) { - valid_tx_ant = - first_antenna(priv->nvm_data->valid_tx_ant); - if (tbl->action >= IWL_LEGACY_SWITCH_ANTENNA2) - tbl->action = IWL_SISO_SWITCH_ANTENNA1; - } - - start_action = tbl->action; - for (;;) { - lq_sta->action_counter++; - switch (tbl->action) { - case IWL_SISO_SWITCH_ANTENNA1: - case IWL_SISO_SWITCH_ANTENNA2: - IWL_DEBUG_RATE(priv, "LQ: SISO toggle Antenna\n"); - if ((tbl->action == IWL_SISO_SWITCH_ANTENNA1 && - tx_chains_num <= 1) || - (tbl->action == IWL_SISO_SWITCH_ANTENNA2 && - tx_chains_num <= 2)) - break; - - if (window->success_ratio >= IWL_RS_GOOD_RATIO && - !priv->bt_full_concurrent && - priv->bt_traffic_load == - IWL_BT_COEX_TRAFFIC_LOAD_NONE) - break; - - memcpy(search_tbl, tbl, sz); - if (rs_toggle_antenna(valid_tx_ant, - &search_tbl->current_rate, search_tbl)) { - update_search_tbl_counter = 1; - goto out; - } - break; - case IWL_SISO_SWITCH_MIMO2_AB: - case IWL_SISO_SWITCH_MIMO2_AC: - case IWL_SISO_SWITCH_MIMO2_BC: - IWL_DEBUG_RATE(priv, "LQ: SISO switch to MIMO2\n"); - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - - if (tbl->action == IWL_SISO_SWITCH_MIMO2_AB) - search_tbl->ant_type = ANT_AB; - else if (tbl->action == IWL_SISO_SWITCH_MIMO2_AC) - search_tbl->ant_type = ANT_AC; - else - search_tbl->ant_type = ANT_BC; - - if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) - break; - - ret = rs_switch_to_mimo2(priv, lq_sta, conf, sta, - search_tbl, index); - if (!ret) - goto out; - break; - case IWL_SISO_SWITCH_GI: - if (!tbl->is_ht40 && !(ht_cap->cap & - IEEE80211_HT_CAP_SGI_20)) - break; - if (tbl->is_ht40 && !(ht_cap->cap & - IEEE80211_HT_CAP_SGI_40)) - break; - - IWL_DEBUG_RATE(priv, "LQ: SISO toggle SGI/NGI\n"); - - memcpy(search_tbl, tbl, sz); - if (is_green) { - if (!tbl->is_SGI) - break; - else - IWL_ERR(priv, - "SGI was set in GF+SISO\n"); - } - search_tbl->is_SGI = !tbl->is_SGI; - rs_set_expected_tpt_table(lq_sta, search_tbl); - if (tbl->is_SGI) { - s32 tpt = lq_sta->last_tpt / 100; - if (tpt >= search_tbl->expected_tpt[index]) - break; - } - search_tbl->current_rate = - rate_n_flags_from_tbl(priv, search_tbl, - index, is_green); - update_search_tbl_counter = 1; - goto out; - case IWL_SISO_SWITCH_MIMO3_ABC: - IWL_DEBUG_RATE(priv, "LQ: SISO switch to MIMO3\n"); - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - search_tbl->ant_type = ANT_ABC; - - if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) - break; - - ret = rs_switch_to_mimo3(priv, lq_sta, conf, sta, - search_tbl, index); - if (!ret) - goto out; - break; - } - tbl->action++; - if (tbl->action > IWL_LEGACY_SWITCH_MIMO3_ABC) - tbl->action = IWL_SISO_SWITCH_ANTENNA1; - - if (tbl->action == start_action) - break; - } - search_tbl->lq_type = LQ_NONE; - return 0; - - out: - lq_sta->search_better_tbl = 1; - tbl->action++; - if (tbl->action > IWL_SISO_SWITCH_MIMO3_ABC) - tbl->action = IWL_SISO_SWITCH_ANTENNA1; - if (update_search_tbl_counter) - search_tbl->action = tbl->action; - - return 0; -} - -/* - * Try to switch to new modulation mode from MIMO2 - */ -static int rs_move_mimo2_to_other(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, - struct ieee80211_conf *conf, - struct ieee80211_sta *sta, int index) -{ - s8 is_green = lq_sta->is_green; - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - struct iwl_scale_tbl_info *search_tbl = - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - struct iwl_rate_scale_data *window = &(tbl->win[index]); - struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); - u8 start_action; - u8 valid_tx_ant = priv->nvm_data->valid_tx_ant; - u8 tx_chains_num = priv->hw_params.tx_chains_num; - u8 update_search_tbl_counter = 0; - int ret; - - switch (priv->bt_traffic_load) { - case IWL_BT_COEX_TRAFFIC_LOAD_NONE: - /* nothing */ - break; - case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: - case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: - /* avoid antenna B and MIMO */ - if (tbl->action != IWL_MIMO2_SWITCH_SISO_A) - tbl->action = IWL_MIMO2_SWITCH_SISO_A; - break; - case IWL_BT_COEX_TRAFFIC_LOAD_LOW: - /* avoid antenna B unless MIMO */ - if (tbl->action == IWL_MIMO2_SWITCH_SISO_B || - tbl->action == IWL_MIMO2_SWITCH_SISO_C) - tbl->action = IWL_MIMO2_SWITCH_SISO_A; - break; - default: - IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); - break; - } - - if ((iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE) && - (tbl->action < IWL_MIMO2_SWITCH_SISO_A || - tbl->action > IWL_MIMO2_SWITCH_SISO_C)) { - /* switch in SISO */ - tbl->action = IWL_MIMO2_SWITCH_SISO_A; - } - - /* configure as 1x1 if bt full concurrency */ - if (priv->bt_full_concurrent && - (tbl->action < IWL_MIMO2_SWITCH_SISO_A || - tbl->action > IWL_MIMO2_SWITCH_SISO_C)) - tbl->action = IWL_MIMO2_SWITCH_SISO_A; - - start_action = tbl->action; - for (;;) { - lq_sta->action_counter++; - switch (tbl->action) { - case IWL_MIMO2_SWITCH_ANTENNA1: - case IWL_MIMO2_SWITCH_ANTENNA2: - IWL_DEBUG_RATE(priv, "LQ: MIMO2 toggle Antennas\n"); - - if (tx_chains_num <= 2) - break; - - if (window->success_ratio >= IWL_RS_GOOD_RATIO) - break; - - memcpy(search_tbl, tbl, sz); - if (rs_toggle_antenna(valid_tx_ant, - &search_tbl->current_rate, search_tbl)) { - update_search_tbl_counter = 1; - goto out; - } - break; - case IWL_MIMO2_SWITCH_SISO_A: - case IWL_MIMO2_SWITCH_SISO_B: - case IWL_MIMO2_SWITCH_SISO_C: - IWL_DEBUG_RATE(priv, "LQ: MIMO2 switch to SISO\n"); - - /* Set up new search table for SISO */ - memcpy(search_tbl, tbl, sz); - - if (tbl->action == IWL_MIMO2_SWITCH_SISO_A) - search_tbl->ant_type = ANT_A; - else if (tbl->action == IWL_MIMO2_SWITCH_SISO_B) - search_tbl->ant_type = ANT_B; - else - search_tbl->ant_type = ANT_C; - - if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) - break; - - ret = rs_switch_to_siso(priv, lq_sta, conf, sta, - search_tbl, index); - if (!ret) - goto out; - - break; - - case IWL_MIMO2_SWITCH_GI: - if (!tbl->is_ht40 && !(ht_cap->cap & - IEEE80211_HT_CAP_SGI_20)) - break; - if (tbl->is_ht40 && !(ht_cap->cap & - IEEE80211_HT_CAP_SGI_40)) - break; - - IWL_DEBUG_RATE(priv, "LQ: MIMO2 toggle SGI/NGI\n"); - - /* Set up new search table for MIMO2 */ - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = !tbl->is_SGI; - rs_set_expected_tpt_table(lq_sta, search_tbl); - /* - * If active table already uses the fastest possible - * modulation (dual stream with short guard interval), - * and it's working well, there's no need to look - * for a better type of modulation! - */ - if (tbl->is_SGI) { - s32 tpt = lq_sta->last_tpt / 100; - if (tpt >= search_tbl->expected_tpt[index]) - break; - } - search_tbl->current_rate = - rate_n_flags_from_tbl(priv, search_tbl, - index, is_green); - update_search_tbl_counter = 1; - goto out; - - case IWL_MIMO2_SWITCH_MIMO3_ABC: - IWL_DEBUG_RATE(priv, "LQ: MIMO2 switch to MIMO3\n"); - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - search_tbl->ant_type = ANT_ABC; - - if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) - break; - - ret = rs_switch_to_mimo3(priv, lq_sta, conf, sta, - search_tbl, index); - if (!ret) - goto out; - - break; - } - tbl->action++; - if (tbl->action > IWL_MIMO2_SWITCH_MIMO3_ABC) - tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; - - if (tbl->action == start_action) - break; - } - search_tbl->lq_type = LQ_NONE; - return 0; - out: - lq_sta->search_better_tbl = 1; - tbl->action++; - if (tbl->action > IWL_MIMO2_SWITCH_MIMO3_ABC) - tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; - if (update_search_tbl_counter) - search_tbl->action = tbl->action; - - return 0; - -} - -/* - * Try to switch to new modulation mode from MIMO3 - */ -static int rs_move_mimo3_to_other(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, - struct ieee80211_conf *conf, - struct ieee80211_sta *sta, int index) -{ - s8 is_green = lq_sta->is_green; - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - struct iwl_scale_tbl_info *search_tbl = - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - struct iwl_rate_scale_data *window = &(tbl->win[index]); - struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); - u8 start_action; - u8 valid_tx_ant = priv->nvm_data->valid_tx_ant; - u8 tx_chains_num = priv->hw_params.tx_chains_num; - int ret; - u8 update_search_tbl_counter = 0; - - switch (priv->bt_traffic_load) { - case IWL_BT_COEX_TRAFFIC_LOAD_NONE: - /* nothing */ - break; - case IWL_BT_COEX_TRAFFIC_LOAD_HIGH: - case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS: - /* avoid antenna B and MIMO */ - if (tbl->action != IWL_MIMO3_SWITCH_SISO_A) - tbl->action = IWL_MIMO3_SWITCH_SISO_A; - break; - case IWL_BT_COEX_TRAFFIC_LOAD_LOW: - /* avoid antenna B unless MIMO */ - if (tbl->action == IWL_MIMO3_SWITCH_SISO_B || - tbl->action == IWL_MIMO3_SWITCH_SISO_C) - tbl->action = IWL_MIMO3_SWITCH_SISO_A; - break; - default: - IWL_ERR(priv, "Invalid BT load %d", priv->bt_traffic_load); - break; - } - - if ((iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE) && - (tbl->action < IWL_MIMO3_SWITCH_SISO_A || - tbl->action > IWL_MIMO3_SWITCH_SISO_C)) { - /* switch in SISO */ - tbl->action = IWL_MIMO3_SWITCH_SISO_A; - } - - /* configure as 1x1 if bt full concurrency */ - if (priv->bt_full_concurrent && - (tbl->action < IWL_MIMO3_SWITCH_SISO_A || - tbl->action > IWL_MIMO3_SWITCH_SISO_C)) - tbl->action = IWL_MIMO3_SWITCH_SISO_A; - - start_action = tbl->action; - for (;;) { - lq_sta->action_counter++; - switch (tbl->action) { - case IWL_MIMO3_SWITCH_ANTENNA1: - case IWL_MIMO3_SWITCH_ANTENNA2: - IWL_DEBUG_RATE(priv, "LQ: MIMO3 toggle Antennas\n"); - - if (tx_chains_num <= 3) - break; - - if (window->success_ratio >= IWL_RS_GOOD_RATIO) - break; - - memcpy(search_tbl, tbl, sz); - if (rs_toggle_antenna(valid_tx_ant, - &search_tbl->current_rate, search_tbl)) - goto out; - break; - case IWL_MIMO3_SWITCH_SISO_A: - case IWL_MIMO3_SWITCH_SISO_B: - case IWL_MIMO3_SWITCH_SISO_C: - IWL_DEBUG_RATE(priv, "LQ: MIMO3 switch to SISO\n"); - - /* Set up new search table for SISO */ - memcpy(search_tbl, tbl, sz); - - if (tbl->action == IWL_MIMO3_SWITCH_SISO_A) - search_tbl->ant_type = ANT_A; - else if (tbl->action == IWL_MIMO3_SWITCH_SISO_B) - search_tbl->ant_type = ANT_B; - else - search_tbl->ant_type = ANT_C; - - if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) - break; - - ret = rs_switch_to_siso(priv, lq_sta, conf, sta, - search_tbl, index); - if (!ret) - goto out; - - break; - - case IWL_MIMO3_SWITCH_MIMO2_AB: - case IWL_MIMO3_SWITCH_MIMO2_AC: - case IWL_MIMO3_SWITCH_MIMO2_BC: - IWL_DEBUG_RATE(priv, "LQ: MIMO3 switch to MIMO2\n"); - - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - if (tbl->action == IWL_MIMO3_SWITCH_MIMO2_AB) - search_tbl->ant_type = ANT_AB; - else if (tbl->action == IWL_MIMO3_SWITCH_MIMO2_AC) - search_tbl->ant_type = ANT_AC; - else - search_tbl->ant_type = ANT_BC; - - if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) - break; - - ret = rs_switch_to_mimo2(priv, lq_sta, conf, sta, - search_tbl, index); - if (!ret) - goto out; - - break; - - case IWL_MIMO3_SWITCH_GI: - if (!tbl->is_ht40 && !(ht_cap->cap & - IEEE80211_HT_CAP_SGI_20)) - break; - if (tbl->is_ht40 && !(ht_cap->cap & - IEEE80211_HT_CAP_SGI_40)) - break; - - IWL_DEBUG_RATE(priv, "LQ: MIMO3 toggle SGI/NGI\n"); - - /* Set up new search table for MIMO */ - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = !tbl->is_SGI; - rs_set_expected_tpt_table(lq_sta, search_tbl); - /* - * If active table already uses the fastest possible - * modulation (dual stream with short guard interval), - * and it's working well, there's no need to look - * for a better type of modulation! - */ - if (tbl->is_SGI) { - s32 tpt = lq_sta->last_tpt / 100; - if (tpt >= search_tbl->expected_tpt[index]) - break; - } - search_tbl->current_rate = - rate_n_flags_from_tbl(priv, search_tbl, - index, is_green); - update_search_tbl_counter = 1; - goto out; - } - tbl->action++; - if (tbl->action > IWL_MIMO3_SWITCH_GI) - tbl->action = IWL_MIMO3_SWITCH_ANTENNA1; - - if (tbl->action == start_action) - break; - } - search_tbl->lq_type = LQ_NONE; - return 0; - out: - lq_sta->search_better_tbl = 1; - tbl->action++; - if (tbl->action > IWL_MIMO3_SWITCH_GI) - tbl->action = IWL_MIMO3_SWITCH_ANTENNA1; - if (update_search_tbl_counter) - search_tbl->action = tbl->action; - - return 0; - -} - -/* - * Check whether we should continue using same modulation mode, or - * begin search for a new mode, based on: - * 1) # tx successes or failures while using this mode - * 2) # times calling this function - * 3) elapsed time in this mode (not used, for now) - */ -static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) -{ - struct iwl_scale_tbl_info *tbl; - int i; - int active_tbl; - int flush_interval_passed = 0; - struct iwl_priv *priv; - - priv = lq_sta->drv; - active_tbl = lq_sta->active_tbl; - - tbl = &(lq_sta->lq_info[active_tbl]); - - /* If we've been disallowing search, see if we should now allow it */ - if (lq_sta->stay_in_tbl) { - - /* Elapsed time using current modulation mode */ - if (lq_sta->flush_timer) - flush_interval_passed = - time_after(jiffies, - (unsigned long)(lq_sta->flush_timer + - IWL_RATE_SCALE_FLUSH_INTVL)); - - /* - * Check if we should allow search for new modulation mode. - * If many frames have failed or succeeded, or we've used - * this same modulation for a long time, allow search, and - * reset history stats that keep track of whether we should - * allow a new search. Also (below) reset all bitmaps and - * stats in active history. - */ - if (force_search || - (lq_sta->total_failed > lq_sta->max_failure_limit) || - (lq_sta->total_success > lq_sta->max_success_limit) || - ((!lq_sta->search_better_tbl) && (lq_sta->flush_timer) - && (flush_interval_passed))) { - IWL_DEBUG_RATE(priv, "LQ: stay is expired %d %d %d\n", - lq_sta->total_failed, - lq_sta->total_success, - flush_interval_passed); - - /* Allow search for new mode */ - lq_sta->stay_in_tbl = 0; /* only place reset */ - lq_sta->total_failed = 0; - lq_sta->total_success = 0; - lq_sta->flush_timer = 0; - - /* - * Else if we've used this modulation mode enough repetitions - * (regardless of elapsed time or success/failure), reset - * history bitmaps and rate-specific stats for all rates in - * active table. - */ - } else { - lq_sta->table_count++; - if (lq_sta->table_count >= - lq_sta->table_count_limit) { - lq_sta->table_count = 0; - - IWL_DEBUG_RATE(priv, "LQ: stay in table clear win\n"); - for (i = 0; i < IWL_RATE_COUNT; i++) - rs_rate_scale_clear_window( - &(tbl->win[i])); - } - } - - /* If transitioning to allow "search", reset all history - * bitmaps and stats in active table (this will become the new - * "search" table). */ - if (!lq_sta->stay_in_tbl) { - for (i = 0; i < IWL_RATE_COUNT; i++) - rs_rate_scale_clear_window(&(tbl->win[i])); - } - } -} - -/* - * setup rate table in uCode - */ -static void rs_update_rate_tbl(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct iwl_lq_sta *lq_sta, - struct iwl_scale_tbl_info *tbl, - int index, u8 is_green) -{ - u32 rate; - - /* Update uCode's rate table. */ - rate = rate_n_flags_from_tbl(priv, tbl, index, is_green); - rs_fill_link_cmd(priv, lq_sta, rate); - iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); -} - -/* - * Do rate scaling and search for new modulation mode. - */ -static void rs_rate_scale_perform(struct iwl_priv *priv, - struct sk_buff *skb, - struct ieee80211_sta *sta, - struct iwl_lq_sta *lq_sta) -{ - struct ieee80211_hw *hw = priv->hw; - struct ieee80211_conf *conf = &hw->conf; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - int low = IWL_RATE_INVALID; - int high = IWL_RATE_INVALID; - int index; - int i; - struct iwl_rate_scale_data *window = NULL; - int current_tpt = IWL_INVALID_VALUE; - int low_tpt = IWL_INVALID_VALUE; - int high_tpt = IWL_INVALID_VALUE; - u32 fail_count; - s8 scale_action = 0; - u16 rate_mask; - u8 update_lq = 0; - struct iwl_scale_tbl_info *tbl, *tbl1; - u16 rate_scale_index_msk = 0; - u8 is_green = 0; - u8 active_tbl = 0; - u8 done_search = 0; - u16 high_low; - s32 sr; - u8 tid = IWL_MAX_TID_COUNT; - struct iwl_tid_data *tid_data; - struct iwl_station_priv *sta_priv = (void *)sta->drv_priv; - struct iwl_rxon_context *ctx = sta_priv->ctx; - - IWL_DEBUG_RATE(priv, "rate scale calculate new rate for skb\n"); - - /* Send management frames and NO_ACK data using lowest rate. */ - /* TODO: this could probably be improved.. */ - if (!ieee80211_is_data(hdr->frame_control) || - info->flags & IEEE80211_TX_CTL_NO_ACK) - return; - - lq_sta->supp_rates = sta->supp_rates[lq_sta->band]; - - tid = rs_tl_add_packet(lq_sta, hdr); - if ((tid != IWL_MAX_TID_COUNT) && - (lq_sta->tx_agg_tid_en & (1 << tid))) { - tid_data = &priv->tid_data[lq_sta->lq.sta_id][tid]; - if (tid_data->agg.state == IWL_AGG_OFF) - lq_sta->is_agg = 0; - else - lq_sta->is_agg = 1; - } else - lq_sta->is_agg = 0; - - /* - * Select rate-scale / modulation-mode table to work with in - * the rest of this function: "search" if searching for better - * modulation mode, or "active" if doing rate scaling within a mode. - */ - if (!lq_sta->search_better_tbl) - active_tbl = lq_sta->active_tbl; - else - active_tbl = 1 - lq_sta->active_tbl; - - tbl = &(lq_sta->lq_info[active_tbl]); - if (is_legacy(tbl->lq_type)) - lq_sta->is_green = 0; - else - lq_sta->is_green = rs_use_green(sta); - is_green = lq_sta->is_green; - - /* current tx rate */ - index = lq_sta->last_txrate_idx; - - IWL_DEBUG_RATE(priv, "Rate scale index %d for type %d\n", index, - tbl->lq_type); - - /* rates available for this association, and for modulation mode */ - rate_mask = rs_get_supported_rates(lq_sta, hdr, tbl->lq_type); - - IWL_DEBUG_RATE(priv, "mask 0x%04X\n", rate_mask); - - /* mask with station rate restriction */ - if (is_legacy(tbl->lq_type)) { - if (lq_sta->band == IEEE80211_BAND_5GHZ) - /* supp_rates has no CCK bits in A mode */ - rate_scale_index_msk = (u16) (rate_mask & - (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE)); - else - rate_scale_index_msk = (u16) (rate_mask & - lq_sta->supp_rates); - - } else - rate_scale_index_msk = rate_mask; - - if (!rate_scale_index_msk) - rate_scale_index_msk = rate_mask; - - if (!((1 << index) & rate_scale_index_msk)) { - IWL_ERR(priv, "Current Rate is not valid\n"); - if (lq_sta->search_better_tbl) { - /* revert to active table if search table is not valid*/ - tbl->lq_type = LQ_NONE; - lq_sta->search_better_tbl = 0; - tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - /* get "active" rate info */ - index = iwl_hwrate_to_plcp_idx(tbl->current_rate); - rs_update_rate_tbl(priv, ctx, lq_sta, tbl, - index, is_green); - } - return; - } - - /* Get expected throughput table and history window for current rate */ - if (!tbl->expected_tpt) { - IWL_ERR(priv, "tbl->expected_tpt is NULL\n"); - return; - } - - /* force user max rate if set by user */ - if ((lq_sta->max_rate_idx != -1) && - (lq_sta->max_rate_idx < index)) { - index = lq_sta->max_rate_idx; - update_lq = 1; - window = &(tbl->win[index]); - goto lq_update; - } - - window = &(tbl->win[index]); - - /* - * If there is not enough history to calculate actual average - * throughput, keep analyzing results of more tx frames, without - * changing rate or mode (bypass most of the rest of this function). - * Set up new rate table in uCode only if old rate is not supported - * in current association (use new rate found above). - */ - fail_count = window->counter - window->success_counter; - if ((fail_count < IWL_RATE_MIN_FAILURE_TH) && - (window->success_counter < IWL_RATE_MIN_SUCCESS_TH)) { - IWL_DEBUG_RATE(priv, "LQ: still below TH. succ=%d total=%d " - "for index %d\n", - window->success_counter, window->counter, index); - - /* Can't calculate this yet; not enough history */ - window->average_tpt = IWL_INVALID_VALUE; - - /* Should we stay with this modulation mode, - * or search for a new one? */ - rs_stay_in_table(lq_sta, false); - - goto out; - } - /* Else we have enough samples; calculate estimate of - * actual average throughput */ - if (window->average_tpt != ((window->success_ratio * - tbl->expected_tpt[index] + 64) / 128)) { - IWL_ERR(priv, "expected_tpt should have been calculated by now\n"); - window->average_tpt = ((window->success_ratio * - tbl->expected_tpt[index] + 64) / 128); - } - - /* If we are searching for better modulation mode, check success. */ - if (lq_sta->search_better_tbl && - (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_MULTI)) { - /* If good success, continue using the "search" mode; - * no need to send new link quality command, since we're - * continuing to use the setup that we've been trying. */ - if (window->average_tpt > lq_sta->last_tpt) { - - IWL_DEBUG_RATE(priv, "LQ: SWITCHING TO NEW TABLE " - "suc=%d cur-tpt=%d old-tpt=%d\n", - window->success_ratio, - window->average_tpt, - lq_sta->last_tpt); - - if (!is_legacy(tbl->lq_type)) - lq_sta->enable_counter = 1; - - /* Swap tables; "search" becomes "active" */ - lq_sta->active_tbl = active_tbl; - current_tpt = window->average_tpt; - - /* Else poor success; go back to mode in "active" table */ - } else { - - IWL_DEBUG_RATE(priv, "LQ: GOING BACK TO THE OLD TABLE " - "suc=%d cur-tpt=%d old-tpt=%d\n", - window->success_ratio, - window->average_tpt, - lq_sta->last_tpt); - - /* Nullify "search" table */ - tbl->lq_type = LQ_NONE; - - /* Revert to "active" table */ - active_tbl = lq_sta->active_tbl; - tbl = &(lq_sta->lq_info[active_tbl]); - - /* Revert to "active" rate and throughput info */ - index = iwl_hwrate_to_plcp_idx(tbl->current_rate); - current_tpt = lq_sta->last_tpt; - - /* Need to set up a new rate table in uCode */ - update_lq = 1; - } - - /* Either way, we've made a decision; modulation mode - * search is done, allow rate adjustment next time. */ - lq_sta->search_better_tbl = 0; - done_search = 1; /* Don't switch modes below! */ - goto lq_update; - } - - /* (Else) not in search of better modulation mode, try for better - * starting rate, while staying in this mode. */ - high_low = rs_get_adjacent_rate(priv, index, rate_scale_index_msk, - tbl->lq_type); - low = high_low & 0xff; - high = (high_low >> 8) & 0xff; - - /* If user set max rate, dont allow higher than user constrain */ - if ((lq_sta->max_rate_idx != -1) && - (lq_sta->max_rate_idx < high)) - high = IWL_RATE_INVALID; - - sr = window->success_ratio; - - /* Collect measured throughputs for current and adjacent rates */ - current_tpt = window->average_tpt; - if (low != IWL_RATE_INVALID) - low_tpt = tbl->win[low].average_tpt; - if (high != IWL_RATE_INVALID) - high_tpt = tbl->win[high].average_tpt; - - scale_action = 0; - - /* Too many failures, decrease rate */ - if ((sr <= IWL_RATE_DECREASE_TH) || (current_tpt == 0)) { - IWL_DEBUG_RATE(priv, "decrease rate because of low success_ratio\n"); - scale_action = -1; - - /* No throughput measured yet for adjacent rates; try increase. */ - } else if ((low_tpt == IWL_INVALID_VALUE) && - (high_tpt == IWL_INVALID_VALUE)) { - - if (high != IWL_RATE_INVALID && sr >= IWL_RATE_INCREASE_TH) - scale_action = 1; - else if (low != IWL_RATE_INVALID) - scale_action = 0; - } - - /* Both adjacent throughputs are measured, but neither one has better - * throughput; we're using the best rate, don't change it! */ - else if ((low_tpt != IWL_INVALID_VALUE) && - (high_tpt != IWL_INVALID_VALUE) && - (low_tpt < current_tpt) && - (high_tpt < current_tpt)) - scale_action = 0; - - /* At least one adjacent rate's throughput is measured, - * and may have better performance. */ - else { - /* Higher adjacent rate's throughput is measured */ - if (high_tpt != IWL_INVALID_VALUE) { - /* Higher rate has better throughput */ - if (high_tpt > current_tpt && - sr >= IWL_RATE_INCREASE_TH) { - scale_action = 1; - } else { - scale_action = 0; - } - - /* Lower adjacent rate's throughput is measured */ - } else if (low_tpt != IWL_INVALID_VALUE) { - /* Lower rate has better throughput */ - if (low_tpt > current_tpt) { - IWL_DEBUG_RATE(priv, - "decrease rate because of low tpt\n"); - scale_action = -1; - } else if (sr >= IWL_RATE_INCREASE_TH) { - scale_action = 1; - } - } - } - - /* Sanity check; asked for decrease, but success rate or throughput - * has been good at old rate. Don't change it. */ - if ((scale_action == -1) && (low != IWL_RATE_INVALID) && - ((sr > IWL_RATE_HIGH_TH) || - (current_tpt > (100 * tbl->expected_tpt[low])))) - scale_action = 0; - if (!iwl_ht_enabled(priv) && !is_legacy(tbl->lq_type)) - scale_action = -1; - if (iwl_tx_ant_restriction(priv) != IWL_ANT_OK_MULTI && - (is_mimo2(tbl->lq_type) || is_mimo3(tbl->lq_type))) - scale_action = -1; - - if ((priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH) && - (is_mimo2(tbl->lq_type) || is_mimo3(tbl->lq_type))) { - if (lq_sta->last_bt_traffic > priv->bt_traffic_load) { - /* - * don't set scale_action, don't want to scale up if - * the rate scale doesn't otherwise think that is a - * good idea. - */ - } else if (lq_sta->last_bt_traffic <= priv->bt_traffic_load) { - scale_action = -1; - } - } - lq_sta->last_bt_traffic = priv->bt_traffic_load; - - if ((priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH) && - (is_mimo2(tbl->lq_type) || is_mimo3(tbl->lq_type))) { - /* search for a new modulation */ - rs_stay_in_table(lq_sta, true); - goto lq_update; - } - - switch (scale_action) { - case -1: - /* Decrease starting rate, update uCode's rate table */ - if (low != IWL_RATE_INVALID) { - update_lq = 1; - index = low; - } - - break; - case 1: - /* Increase starting rate, update uCode's rate table */ - if (high != IWL_RATE_INVALID) { - update_lq = 1; - index = high; - } - - break; - case 0: - /* No change */ - default: - break; - } - - IWL_DEBUG_RATE(priv, "choose rate scale index %d action %d low %d " - "high %d type %d\n", - index, scale_action, low, high, tbl->lq_type); - -lq_update: - /* Replace uCode's rate table for the destination station. */ - if (update_lq) - rs_update_rate_tbl(priv, ctx, lq_sta, tbl, index, is_green); - - if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_MULTI) { - /* Should we stay with this modulation mode, - * or search for a new one? */ - rs_stay_in_table(lq_sta, false); - } - /* - * Search for new modulation mode if we're: - * 1) Not changing rates right now - * 2) Not just finishing up a search - * 3) Allowing a new search - */ - if (!update_lq && !done_search && !lq_sta->stay_in_tbl && window->counter) { - /* Save current throughput to compare with "search" throughput*/ - lq_sta->last_tpt = current_tpt; - - /* Select a new "search" modulation mode to try. - * If one is found, set up the new "search" table. */ - if (is_legacy(tbl->lq_type)) - rs_move_legacy_other(priv, lq_sta, conf, sta, index); - else if (is_siso(tbl->lq_type)) - rs_move_siso_to_other(priv, lq_sta, conf, sta, index); - else if (is_mimo2(tbl->lq_type)) - rs_move_mimo2_to_other(priv, lq_sta, conf, sta, index); - else - rs_move_mimo3_to_other(priv, lq_sta, conf, sta, index); - - /* If new "search" mode was selected, set up in uCode table */ - if (lq_sta->search_better_tbl) { - /* Access the "search" table, clear its history. */ - tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - for (i = 0; i < IWL_RATE_COUNT; i++) - rs_rate_scale_clear_window(&(tbl->win[i])); - - /* Use new "search" start rate */ - index = iwl_hwrate_to_plcp_idx(tbl->current_rate); - - IWL_DEBUG_RATE(priv, "Switch current mcs: %X index: %d\n", - tbl->current_rate, index); - rs_fill_link_cmd(priv, lq_sta, tbl->current_rate); - iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); - } else - done_search = 1; - } - - if (done_search && !lq_sta->stay_in_tbl) { - /* If the "active" (non-search) mode was legacy, - * and we've tried switching antennas, - * but we haven't been able to try HT modes (not available), - * stay with best antenna legacy modulation for a while - * before next round of mode comparisons. */ - tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); - if (is_legacy(tbl1->lq_type) && !conf_is_ht(conf) && - lq_sta->action_counter > tbl1->max_search) { - IWL_DEBUG_RATE(priv, "LQ: STAY in legacy table\n"); - rs_set_stay_in_table(priv, 1, lq_sta); - } - - /* If we're in an HT mode, and all 3 mode switch actions - * have been tried and compared, stay in this best modulation - * mode for a while before next round of mode comparisons. */ - if (lq_sta->enable_counter && - (lq_sta->action_counter >= tbl1->max_search) && - iwl_ht_enabled(priv)) { - if ((lq_sta->last_tpt > IWL_AGG_TPT_THREHOLD) && - (lq_sta->tx_agg_tid_en & (1 << tid)) && - (tid != IWL_MAX_TID_COUNT)) { - u8 sta_id = lq_sta->lq.sta_id; - tid_data = &priv->tid_data[sta_id][tid]; - if (tid_data->agg.state == IWL_AGG_OFF) { - IWL_DEBUG_RATE(priv, - "try to aggregate tid %d\n", - tid); - rs_tl_turn_on_agg(priv, tid, - lq_sta, sta); - } - } - rs_set_stay_in_table(priv, 0, lq_sta); - } - } - -out: - tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, index, is_green); - lq_sta->last_txrate_idx = index; -} - -/** - * rs_initialize_lq - Initialize a station's hardware rate table - * - * The uCode's station table contains a table of fallback rates - * for automatic fallback during transmission. - * - * NOTE: This sets up a default set of values. These will be replaced later - * if the driver's iwl-agn-rs rate scaling algorithm is used, instead of - * rc80211_simple. - * - * NOTE: Run REPLY_ADD_STA command to set up station table entry, before - * calling this function (which runs REPLY_TX_LINK_QUALITY_CMD, - * which requires station table entry to exist). - */ -static void rs_initialize_lq(struct iwl_priv *priv, - struct ieee80211_sta *sta, - struct iwl_lq_sta *lq_sta) -{ - struct iwl_scale_tbl_info *tbl; - int rate_idx; - int i; - u32 rate; - u8 use_green = rs_use_green(sta); - u8 active_tbl = 0; - u8 valid_tx_ant; - struct iwl_station_priv *sta_priv; - struct iwl_rxon_context *ctx; - - if (!sta || !lq_sta) - return; - - sta_priv = (void *)sta->drv_priv; - ctx = sta_priv->ctx; - - i = lq_sta->last_txrate_idx; - - valid_tx_ant = priv->nvm_data->valid_tx_ant; - - if (!lq_sta->search_better_tbl) - active_tbl = lq_sta->active_tbl; - else - active_tbl = 1 - lq_sta->active_tbl; - - tbl = &(lq_sta->lq_info[active_tbl]); - - if ((i < 0) || (i >= IWL_RATE_COUNT)) - i = 0; - - rate = iwl_rates[i].plcp; - tbl->ant_type = first_antenna(valid_tx_ant); - rate |= tbl->ant_type << RATE_MCS_ANT_POS; - - if (i >= IWL_FIRST_CCK_RATE && i <= IWL_LAST_CCK_RATE) - rate |= RATE_MCS_CCK_MSK; - - rs_get_tbl_info_from_mcs(rate, priv->band, tbl, &rate_idx); - if (!rs_is_valid_ant(valid_tx_ant, tbl->ant_type)) - rs_toggle_antenna(valid_tx_ant, &rate, tbl); - - rate = rate_n_flags_from_tbl(priv, tbl, rate_idx, use_green); - tbl->current_rate = rate; - rs_set_expected_tpt_table(lq_sta, tbl); - rs_fill_link_cmd(NULL, lq_sta, rate); - priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; - iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_SYNC, true); -} - -static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, - struct ieee80211_tx_rate_control *txrc) -{ - - struct sk_buff *skb = txrc->skb; - struct ieee80211_supported_band *sband = txrc->sband; - struct iwl_op_mode *op_mode __maybe_unused = - (struct iwl_op_mode *)priv_r; - struct iwl_priv *priv __maybe_unused = IWL_OP_MODE_GET_DVM(op_mode); - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct iwl_lq_sta *lq_sta = priv_sta; - int rate_idx; - - IWL_DEBUG_RATE_LIMIT(priv, "rate scale calculate new rate for skb\n"); - - /* Get max rate if user set max rate */ - if (lq_sta) { - lq_sta->max_rate_idx = txrc->max_rate_idx; - if ((sband->band == IEEE80211_BAND_5GHZ) && - (lq_sta->max_rate_idx != -1)) - lq_sta->max_rate_idx += IWL_FIRST_OFDM_RATE; - if ((lq_sta->max_rate_idx < 0) || - (lq_sta->max_rate_idx >= IWL_RATE_COUNT)) - lq_sta->max_rate_idx = -1; - } - - /* Treat uninitialized rate scaling data same as non-existing. */ - if (lq_sta && !lq_sta->drv) { - IWL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); - priv_sta = NULL; - } - - /* Send management frames and NO_ACK data using lowest rate. */ - if (rate_control_send_low(sta, priv_sta, txrc)) - return; - - rate_idx = lq_sta->last_txrate_idx; - - if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) { - rate_idx -= IWL_FIRST_OFDM_RATE; - /* 6M and 9M shared same MCS index */ - rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0; - if (rs_extract_rate(lq_sta->last_rate_n_flags) >= - IWL_RATE_MIMO3_6M_PLCP) - rate_idx = rate_idx + (2 * MCS_INDEX_PER_STREAM); - else if (rs_extract_rate(lq_sta->last_rate_n_flags) >= - IWL_RATE_MIMO2_6M_PLCP) - rate_idx = rate_idx + MCS_INDEX_PER_STREAM; - info->control.rates[0].flags = IEEE80211_TX_RC_MCS; - if (lq_sta->last_rate_n_flags & RATE_MCS_SGI_MSK) - info->control.rates[0].flags |= IEEE80211_TX_RC_SHORT_GI; - if (lq_sta->last_rate_n_flags & RATE_MCS_DUP_MSK) - info->control.rates[0].flags |= IEEE80211_TX_RC_DUP_DATA; - if (lq_sta->last_rate_n_flags & RATE_MCS_HT40_MSK) - info->control.rates[0].flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; - if (lq_sta->last_rate_n_flags & RATE_MCS_GF_MSK) - info->control.rates[0].flags |= IEEE80211_TX_RC_GREEN_FIELD; - } else { - /* Check for invalid rates */ - if ((rate_idx < 0) || (rate_idx >= IWL_RATE_COUNT_LEGACY) || - ((sband->band == IEEE80211_BAND_5GHZ) && - (rate_idx < IWL_FIRST_OFDM_RATE))) - rate_idx = rate_lowest_index(sband, sta); - /* On valid 5 GHz rate, adjust index */ - else if (sband->band == IEEE80211_BAND_5GHZ) - rate_idx -= IWL_FIRST_OFDM_RATE; - info->control.rates[0].flags = 0; - } - info->control.rates[0].idx = rate_idx; - info->control.rates[0].count = 1; -} - -static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, - gfp_t gfp) -{ - struct iwl_station_priv *sta_priv = (struct iwl_station_priv *) sta->drv_priv; - struct iwl_op_mode *op_mode __maybe_unused = - (struct iwl_op_mode *)priv_rate; - struct iwl_priv *priv __maybe_unused = IWL_OP_MODE_GET_DVM(op_mode); - - IWL_DEBUG_RATE(priv, "create station rate scale window\n"); - - return &sta_priv->lq_sta; -} - -/* - * Called after adding a new station to initialize rate scaling - */ -void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_id) -{ - int i, j; - struct ieee80211_hw *hw = priv->hw; - struct ieee80211_conf *conf = &priv->hw->conf; - struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - struct iwl_station_priv *sta_priv; - struct iwl_lq_sta *lq_sta; - struct ieee80211_supported_band *sband; - unsigned long supp; /* must be unsigned long for for_each_set_bit */ - - sta_priv = (struct iwl_station_priv *) sta->drv_priv; - lq_sta = &sta_priv->lq_sta; - sband = hw->wiphy->bands[conf->chandef.chan->band]; - - - lq_sta->lq.sta_id = sta_id; - - for (j = 0; j < LQ_SIZE; j++) - for (i = 0; i < IWL_RATE_COUNT; i++) - rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); - - lq_sta->flush_timer = 0; - lq_sta->supp_rates = sta->supp_rates[sband->band]; - for (j = 0; j < LQ_SIZE; j++) - for (i = 0; i < IWL_RATE_COUNT; i++) - rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); - - IWL_DEBUG_RATE(priv, "LQ: *** rate scale station global init for station %d ***\n", - sta_id); - /* TODO: what is a good starting rate for STA? About middle? Maybe not - * the lowest or the highest rate.. Could consider using RSSI from - * previous packets? Need to have IEEE 802.1X auth succeed immediately - * after assoc.. */ - - lq_sta->is_dup = 0; - lq_sta->max_rate_idx = -1; - lq_sta->missed_rate_counter = IWL_MISSED_RATE_MAX; - lq_sta->is_green = rs_use_green(sta); - lq_sta->band = sband->band; - /* - * active legacy rates as per supported rates bitmap - */ - supp = sta->supp_rates[sband->band]; - lq_sta->active_legacy_rate = 0; - for_each_set_bit(i, &supp, BITS_PER_LONG) - lq_sta->active_legacy_rate |= BIT(sband->bitrates[i].hw_value); - - /* - * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), - * supp_rates[] does not; shift to convert format, force 9 MBits off. - */ - lq_sta->active_siso_rate = ht_cap->mcs.rx_mask[0] << 1; - lq_sta->active_siso_rate |= ht_cap->mcs.rx_mask[0] & 0x1; - lq_sta->active_siso_rate &= ~((u16)0x2); - lq_sta->active_siso_rate <<= IWL_FIRST_OFDM_RATE; - - /* Same here */ - lq_sta->active_mimo2_rate = ht_cap->mcs.rx_mask[1] << 1; - lq_sta->active_mimo2_rate |= ht_cap->mcs.rx_mask[1] & 0x1; - lq_sta->active_mimo2_rate &= ~((u16)0x2); - lq_sta->active_mimo2_rate <<= IWL_FIRST_OFDM_RATE; - - lq_sta->active_mimo3_rate = ht_cap->mcs.rx_mask[2] << 1; - lq_sta->active_mimo3_rate |= ht_cap->mcs.rx_mask[2] & 0x1; - lq_sta->active_mimo3_rate &= ~((u16)0x2); - lq_sta->active_mimo3_rate <<= IWL_FIRST_OFDM_RATE; - - IWL_DEBUG_RATE(priv, "SISO-RATE=%X MIMO2-RATE=%X MIMO3-RATE=%X\n", - lq_sta->active_siso_rate, - lq_sta->active_mimo2_rate, - lq_sta->active_mimo3_rate); - - /* These values will be overridden later */ - lq_sta->lq.general_params.single_stream_ant_msk = - first_antenna(priv->nvm_data->valid_tx_ant); - lq_sta->lq.general_params.dual_stream_ant_msk = - priv->nvm_data->valid_tx_ant & - ~first_antenna(priv->nvm_data->valid_tx_ant); - if (!lq_sta->lq.general_params.dual_stream_ant_msk) { - lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; - } else if (num_of_ant(priv->nvm_data->valid_tx_ant) == 2) { - lq_sta->lq.general_params.dual_stream_ant_msk = - priv->nvm_data->valid_tx_ant; - } - - /* as default allow aggregation for all tids */ - lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; - lq_sta->drv = priv; - - /* Set last_txrate_idx to lowest rate */ - lq_sta->last_txrate_idx = rate_lowest_index(sband, sta); - if (sband->band == IEEE80211_BAND_5GHZ) - lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; - lq_sta->is_agg = 0; -#ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE - priv->tm_fixed_rate = 0; -#endif -#ifdef CONFIG_MAC80211_DEBUGFS - lq_sta->dbg_fixed_rate = 0; -#endif - - rs_initialize_lq(priv, sta, lq_sta); -} - -static void rs_fill_link_cmd(struct iwl_priv *priv, - struct iwl_lq_sta *lq_sta, u32 new_rate) -{ - struct iwl_scale_tbl_info tbl_type; - int index = 0; - int rate_idx; - int repeat_rate = 0; - u8 ant_toggle_cnt = 0; - u8 use_ht_possible = 1; - u8 valid_tx_ant = 0; - struct iwl_station_priv *sta_priv = - container_of(lq_sta, struct iwl_station_priv, lq_sta); - struct iwl_link_quality_cmd *lq_cmd = &lq_sta->lq; - - /* Override starting rate (index 0) if needed for debug purposes */ - rs_dbgfs_set_mcs(lq_sta, &new_rate, index); - - /* Interpret new_rate (rate_n_flags) */ - rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, - &tbl_type, &rate_idx); - - if (priv && priv->bt_full_concurrent) { - /* 1x1 only */ - tbl_type.ant_type = - first_antenna(priv->nvm_data->valid_tx_ant); - } - - /* How many times should we repeat the initial rate? */ - if (is_legacy(tbl_type.lq_type)) { - ant_toggle_cnt = 1; - repeat_rate = IWL_NUMBER_TRY; - } else { - repeat_rate = min(IWL_HT_NUMBER_TRY, - LINK_QUAL_AGG_DISABLE_START_DEF - 1); - } - - lq_cmd->general_params.mimo_delimiter = - is_mimo(tbl_type.lq_type) ? 1 : 0; - - /* Fill 1st table entry (index 0) */ - lq_cmd->rs_table[index].rate_n_flags = cpu_to_le32(new_rate); - - if (num_of_ant(tbl_type.ant_type) == 1) { - lq_cmd->general_params.single_stream_ant_msk = - tbl_type.ant_type; - } else if (num_of_ant(tbl_type.ant_type) == 2) { - lq_cmd->general_params.dual_stream_ant_msk = - tbl_type.ant_type; - } /* otherwise we don't modify the existing value */ - - index++; - repeat_rate--; - if (priv) { - if (priv->bt_full_concurrent) - valid_tx_ant = ANT_A; - else - valid_tx_ant = priv->nvm_data->valid_tx_ant; - } - - /* Fill rest of rate table */ - while (index < LINK_QUAL_MAX_RETRY_NUM) { - /* Repeat initial/next rate. - * For legacy IWL_NUMBER_TRY == 1, this loop will not execute. - * For HT IWL_HT_NUMBER_TRY == 3, this executes twice. */ - while (repeat_rate > 0 && (index < LINK_QUAL_MAX_RETRY_NUM)) { - if (is_legacy(tbl_type.lq_type)) { - if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) - ant_toggle_cnt++; - else if (priv && - rs_toggle_antenna(valid_tx_ant, - &new_rate, &tbl_type)) - ant_toggle_cnt = 1; - } - - /* Override next rate if needed for debug purposes */ - rs_dbgfs_set_mcs(lq_sta, &new_rate, index); - - /* Fill next table entry */ - lq_cmd->rs_table[index].rate_n_flags = - cpu_to_le32(new_rate); - repeat_rate--; - index++; - } - - rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, &tbl_type, - &rate_idx); - - if (priv && priv->bt_full_concurrent) { - /* 1x1 only */ - tbl_type.ant_type = - first_antenna(priv->nvm_data->valid_tx_ant); - } - - /* Indicate to uCode which entries might be MIMO. - * If initial rate was MIMO, this will finally end up - * as (IWL_HT_NUMBER_TRY * 2), after 2nd pass, otherwise 0. */ - if (is_mimo(tbl_type.lq_type)) - lq_cmd->general_params.mimo_delimiter = index; - - /* Get next rate */ - new_rate = rs_get_lower_rate(lq_sta, &tbl_type, rate_idx, - use_ht_possible); - - /* How many times should we repeat the next rate? */ - if (is_legacy(tbl_type.lq_type)) { - if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) - ant_toggle_cnt++; - else if (priv && - rs_toggle_antenna(valid_tx_ant, - &new_rate, &tbl_type)) - ant_toggle_cnt = 1; - - repeat_rate = IWL_NUMBER_TRY; - } else { - repeat_rate = IWL_HT_NUMBER_TRY; - } - - /* Don't allow HT rates after next pass. - * rs_get_lower_rate() will change type to LQ_A or LQ_G. */ - use_ht_possible = 0; - - /* Override next rate if needed for debug purposes */ - rs_dbgfs_set_mcs(lq_sta, &new_rate, index); - - /* Fill next table entry */ - lq_cmd->rs_table[index].rate_n_flags = cpu_to_le32(new_rate); - - index++; - repeat_rate--; - } - - lq_cmd->agg_params.agg_frame_cnt_limit = - sta_priv->max_agg_bufsize ?: LINK_QUAL_AGG_FRAME_LIMIT_DEF; - lq_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; - - lq_cmd->agg_params.agg_time_limit = - cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF); - /* - * overwrite if needed, pass aggregation time limit - * to uCode in uSec - */ - if (priv && priv->cfg->bt_params && - priv->cfg->bt_params->agg_time_limit && - priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH) - lq_cmd->agg_params.agg_time_limit = - cpu_to_le16(priv->cfg->bt_params->agg_time_limit); -} - -static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) -{ - return hw->priv; -} -/* rate scale requires free function to be implemented */ -static void rs_free(void *priv_rate) -{ - return; -} - -static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta, - void *priv_sta) -{ - struct iwl_op_mode *op_mode __maybe_unused = priv_r; - struct iwl_priv *priv __maybe_unused = IWL_OP_MODE_GET_DVM(op_mode); - - IWL_DEBUG_RATE(priv, "enter\n"); - IWL_DEBUG_RATE(priv, "leave\n"); -} - -#ifdef CONFIG_MAC80211_DEBUGFS -static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, - u32 *rate_n_flags, int index) -{ - struct iwl_priv *priv; - u8 valid_tx_ant; - u8 ant_sel_tx; - - priv = lq_sta->drv; - valid_tx_ant = priv->nvm_data->valid_tx_ant; - if (lq_sta->dbg_fixed_rate) { - ant_sel_tx = - ((lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK) - >> RATE_MCS_ANT_POS); - if ((valid_tx_ant & ant_sel_tx) == ant_sel_tx) { - *rate_n_flags = lq_sta->dbg_fixed_rate; - IWL_DEBUG_RATE(priv, "Fixed rate ON\n"); - } else { - lq_sta->dbg_fixed_rate = 0; - IWL_ERR(priv, - "Invalid antenna selection 0x%X, Valid is 0x%X\n", - ant_sel_tx, valid_tx_ant); - IWL_DEBUG_RATE(priv, "Fixed rate OFF\n"); - } - } else { - IWL_DEBUG_RATE(priv, "Fixed rate OFF\n"); - } -} - -static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file, - const char __user *user_buf, size_t count, loff_t *ppos) -{ - struct iwl_lq_sta *lq_sta = file->private_data; - struct iwl_priv *priv; - char buf[64]; - size_t buf_size; - u32 parsed_rate; - - - priv = lq_sta->drv; - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - - if (sscanf(buf, "%x", &parsed_rate) == 1) - lq_sta->dbg_fixed_rate = parsed_rate; - else - lq_sta->dbg_fixed_rate = 0; - - rs_program_fix_rate(priv, lq_sta); - - return count; -} - -static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, - char __user *user_buf, size_t count, loff_t *ppos) -{ - char *buff; - int desc = 0; - int i = 0; - int index = 0; - ssize_t ret; - - struct iwl_lq_sta *lq_sta = file->private_data; - struct iwl_priv *priv; - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - - priv = lq_sta->drv; - buff = kmalloc(1024, GFP_KERNEL); - if (!buff) - return -ENOMEM; - - desc += sprintf(buff+desc, "sta_id %d\n", lq_sta->lq.sta_id); - desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n", - lq_sta->total_failed, lq_sta->total_success, - lq_sta->active_legacy_rate); - desc += sprintf(buff+desc, "fixed rate 0x%X\n", - lq_sta->dbg_fixed_rate); - desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n", - (priv->nvm_data->valid_tx_ant & ANT_A) ? "ANT_A," : "", - (priv->nvm_data->valid_tx_ant & ANT_B) ? "ANT_B," : "", - (priv->nvm_data->valid_tx_ant & ANT_C) ? "ANT_C" : ""); - desc += sprintf(buff+desc, "lq type %s\n", - (is_legacy(tbl->lq_type)) ? "legacy" : "HT"); - if (is_Ht(tbl->lq_type)) { - desc += sprintf(buff+desc, " %s", - (is_siso(tbl->lq_type)) ? "SISO" : - ((is_mimo2(tbl->lq_type)) ? "MIMO2" : "MIMO3")); - desc += sprintf(buff+desc, " %s", - (tbl->is_ht40) ? "40MHz" : "20MHz"); - desc += sprintf(buff+desc, " %s %s %s\n", (tbl->is_SGI) ? "SGI" : "", - (lq_sta->is_green) ? "GF enabled" : "", - (lq_sta->is_agg) ? "AGG on" : ""); - } - desc += sprintf(buff+desc, "last tx rate=0x%X\n", - lq_sta->last_rate_n_flags); - desc += sprintf(buff+desc, "general:" - "flags=0x%X mimo-d=%d s-ant0x%x d-ant=0x%x\n", - lq_sta->lq.general_params.flags, - lq_sta->lq.general_params.mimo_delimiter, - lq_sta->lq.general_params.single_stream_ant_msk, - lq_sta->lq.general_params.dual_stream_ant_msk); - - desc += sprintf(buff+desc, "agg:" - "time_limit=%d dist_start_th=%d frame_cnt_limit=%d\n", - le16_to_cpu(lq_sta->lq.agg_params.agg_time_limit), - lq_sta->lq.agg_params.agg_dis_start_th, - lq_sta->lq.agg_params.agg_frame_cnt_limit); - - desc += sprintf(buff+desc, - "Start idx [0]=0x%x [1]=0x%x [2]=0x%x [3]=0x%x\n", - lq_sta->lq.general_params.start_rate_index[0], - lq_sta->lq.general_params.start_rate_index[1], - lq_sta->lq.general_params.start_rate_index[2], - lq_sta->lq.general_params.start_rate_index[3]); - - for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { - index = iwl_hwrate_to_plcp_idx( - le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags)); - if (is_legacy(tbl->lq_type)) { - desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps\n", - i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags), - iwl_rate_mcs[index].mbps); - } else { - desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps (%s)\n", - i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags), - iwl_rate_mcs[index].mbps, iwl_rate_mcs[index].mcs); - } - } - - ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); - kfree(buff); - return ret; -} - -static const struct file_operations rs_sta_dbgfs_scale_table_ops = { - .write = rs_sta_dbgfs_scale_table_write, - .read = rs_sta_dbgfs_scale_table_read, - .open = simple_open, - .llseek = default_llseek, -}; -static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, - char __user *user_buf, size_t count, loff_t *ppos) -{ - char *buff; - int desc = 0; - int i, j; - ssize_t ret; - - struct iwl_lq_sta *lq_sta = file->private_data; - - buff = kmalloc(1024, GFP_KERNEL); - if (!buff) - return -ENOMEM; - - for (i = 0; i < LQ_SIZE; i++) { - desc += sprintf(buff+desc, - "%s type=%d SGI=%d HT40=%d DUP=%d GF=%d\n" - "rate=0x%X\n", - lq_sta->active_tbl == i ? "*" : "x", - lq_sta->lq_info[i].lq_type, - lq_sta->lq_info[i].is_SGI, - lq_sta->lq_info[i].is_ht40, - lq_sta->lq_info[i].is_dup, - lq_sta->is_green, - lq_sta->lq_info[i].current_rate); - for (j = 0; j < IWL_RATE_COUNT; j++) { - desc += sprintf(buff+desc, - "counter=%d success=%d %%=%d\n", - lq_sta->lq_info[i].win[j].counter, - lq_sta->lq_info[i].win[j].success_counter, - lq_sta->lq_info[i].win[j].success_ratio); - } - } - ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); - kfree(buff); - return ret; -} - -static const struct file_operations rs_sta_dbgfs_stats_table_ops = { - .read = rs_sta_dbgfs_stats_table_read, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file, - char __user *user_buf, size_t count, loff_t *ppos) -{ - struct iwl_lq_sta *lq_sta = file->private_data; - struct iwl_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; - char buff[120]; - int desc = 0; - - if (is_Ht(tbl->lq_type)) - desc += sprintf(buff+desc, - "Bit Rate= %d Mb/s\n", - tbl->expected_tpt[lq_sta->last_txrate_idx]); - else - desc += sprintf(buff+desc, - "Bit Rate= %d Mb/s\n", - iwl_rates[lq_sta->last_txrate_idx].ieee >> 1); - - return simple_read_from_buffer(user_buf, count, ppos, buff, desc); -} - -static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { - .read = rs_sta_dbgfs_rate_scale_data_read, - .open = simple_open, - .llseek = default_llseek, -}; - -static void rs_add_debugfs(void *priv, void *priv_sta, - struct dentry *dir) -{ - struct iwl_lq_sta *lq_sta = priv_sta; - lq_sta->rs_sta_dbgfs_scale_table_file = - debugfs_create_file("rate_scale_table", S_IRUSR | S_IWUSR, dir, - lq_sta, &rs_sta_dbgfs_scale_table_ops); - lq_sta->rs_sta_dbgfs_stats_table_file = - debugfs_create_file("rate_stats_table", S_IRUSR, dir, - lq_sta, &rs_sta_dbgfs_stats_table_ops); - lq_sta->rs_sta_dbgfs_rate_scale_data_file = - debugfs_create_file("rate_scale_data", S_IRUSR, dir, - lq_sta, &rs_sta_dbgfs_rate_scale_data_ops); - lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file = - debugfs_create_u8("tx_agg_tid_enable", S_IRUSR | S_IWUSR, dir, - &lq_sta->tx_agg_tid_en); - -} - -static void rs_remove_debugfs(void *priv, void *priv_sta) -{ - struct iwl_lq_sta *lq_sta = priv_sta; - debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); - debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); - debugfs_remove(lq_sta->rs_sta_dbgfs_rate_scale_data_file); - debugfs_remove(lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file); -} -#endif - -/* - * Initialization of rate scaling information is done by driver after - * the station is added. Since mac80211 calls this function before a - * station is added we ignore it. - */ -static void rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta) -{ -} -static struct rate_control_ops rs_ops = { - .module = NULL, - .name = RS_NAME, - .tx_status = rs_tx_status, - .get_rate = rs_get_rate, - .rate_init = rs_rate_init_stub, - .alloc = rs_alloc, - .free = rs_free, - .alloc_sta = rs_alloc_sta, - .free_sta = rs_free_sta, -#ifdef CONFIG_MAC80211_DEBUGFS - .add_sta_debugfs = rs_add_debugfs, - .remove_sta_debugfs = rs_remove_debugfs, -#endif -}; - -int iwlagn_rate_control_register(void) -{ - return ieee80211_rate_control_register(&rs_ops); -} - -void iwlagn_rate_control_unregister(void) -{ - ieee80211_rate_control_unregister(&rs_ops); -} - diff --git a/drivers/net/wireless/iwlwifi/dvm/rs.h b/drivers/net/wireless/iwlwifi/dvm/rs.h deleted file mode 100644 index 5d83cab22d62..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/rs.h +++ /dev/null @@ -1,433 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#ifndef __iwl_agn_rs_h__ -#define __iwl_agn_rs_h__ - -#include - -#include "iwl-config.h" - -#include "commands.h" - -struct iwl_rate_info { - u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ - u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */ - u8 plcp_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */ - u8 plcp_mimo3; /* uCode API: IWL_RATE_MIMO3_6M_PLCP, etc. */ - u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */ - u8 prev_ieee; /* previous rate in IEEE speeds */ - u8 next_ieee; /* next rate in IEEE speeds */ - u8 prev_rs; /* previous rate used in rs algo */ - u8 next_rs; /* next rate used in rs algo */ - u8 prev_rs_tgg; /* previous rate used in TGG rs algo */ - u8 next_rs_tgg; /* next rate used in TGG rs algo */ -}; - -/* - * These serve as indexes into - * struct iwl_rate_info iwl_rates[IWL_RATE_COUNT]; - */ -enum { - IWL_RATE_1M_INDEX = 0, - IWL_RATE_2M_INDEX, - IWL_RATE_5M_INDEX, - IWL_RATE_11M_INDEX, - IWL_RATE_6M_INDEX, - IWL_RATE_9M_INDEX, - IWL_RATE_12M_INDEX, - IWL_RATE_18M_INDEX, - IWL_RATE_24M_INDEX, - IWL_RATE_36M_INDEX, - IWL_RATE_48M_INDEX, - IWL_RATE_54M_INDEX, - IWL_RATE_60M_INDEX, - IWL_RATE_COUNT, /*FIXME:RS:change to IWL_RATE_INDEX_COUNT,*/ - IWL_RATE_COUNT_LEGACY = IWL_RATE_COUNT - 1, /* Excluding 60M */ - IWL_RATE_INVM_INDEX = IWL_RATE_COUNT, - IWL_RATE_INVALID = IWL_RATE_COUNT, -}; - -enum { - IWL_RATE_6M_INDEX_TABLE = 0, - IWL_RATE_9M_INDEX_TABLE, - IWL_RATE_12M_INDEX_TABLE, - IWL_RATE_18M_INDEX_TABLE, - IWL_RATE_24M_INDEX_TABLE, - IWL_RATE_36M_INDEX_TABLE, - IWL_RATE_48M_INDEX_TABLE, - IWL_RATE_54M_INDEX_TABLE, - IWL_RATE_1M_INDEX_TABLE, - IWL_RATE_2M_INDEX_TABLE, - IWL_RATE_5M_INDEX_TABLE, - IWL_RATE_11M_INDEX_TABLE, - IWL_RATE_INVM_INDEX_TABLE = IWL_RATE_INVM_INDEX - 1, -}; - -enum { - IWL_FIRST_OFDM_RATE = IWL_RATE_6M_INDEX, - IWL_LAST_OFDM_RATE = IWL_RATE_60M_INDEX, - IWL_FIRST_CCK_RATE = IWL_RATE_1M_INDEX, - IWL_LAST_CCK_RATE = IWL_RATE_11M_INDEX, -}; - -/* #define vs. enum to keep from defaulting to 'large integer' */ -#define IWL_RATE_6M_MASK (1 << IWL_RATE_6M_INDEX) -#define IWL_RATE_9M_MASK (1 << IWL_RATE_9M_INDEX) -#define IWL_RATE_12M_MASK (1 << IWL_RATE_12M_INDEX) -#define IWL_RATE_18M_MASK (1 << IWL_RATE_18M_INDEX) -#define IWL_RATE_24M_MASK (1 << IWL_RATE_24M_INDEX) -#define IWL_RATE_36M_MASK (1 << IWL_RATE_36M_INDEX) -#define IWL_RATE_48M_MASK (1 << IWL_RATE_48M_INDEX) -#define IWL_RATE_54M_MASK (1 << IWL_RATE_54M_INDEX) -#define IWL_RATE_60M_MASK (1 << IWL_RATE_60M_INDEX) -#define IWL_RATE_1M_MASK (1 << IWL_RATE_1M_INDEX) -#define IWL_RATE_2M_MASK (1 << IWL_RATE_2M_INDEX) -#define IWL_RATE_5M_MASK (1 << IWL_RATE_5M_INDEX) -#define IWL_RATE_11M_MASK (1 << IWL_RATE_11M_INDEX) - -/* uCode API values for legacy bit rates, both OFDM and CCK */ -enum { - IWL_RATE_6M_PLCP = 13, - IWL_RATE_9M_PLCP = 15, - IWL_RATE_12M_PLCP = 5, - IWL_RATE_18M_PLCP = 7, - IWL_RATE_24M_PLCP = 9, - IWL_RATE_36M_PLCP = 11, - IWL_RATE_48M_PLCP = 1, - IWL_RATE_54M_PLCP = 3, - IWL_RATE_60M_PLCP = 3,/*FIXME:RS:should be removed*/ - IWL_RATE_1M_PLCP = 10, - IWL_RATE_2M_PLCP = 20, - IWL_RATE_5M_PLCP = 55, - IWL_RATE_11M_PLCP = 110, - /*FIXME:RS:change to IWL_RATE_LEGACY_??M_PLCP */ - /*FIXME:RS:add IWL_RATE_LEGACY_INVM_PLCP = 0,*/ -}; - -/* uCode API values for OFDM high-throughput (HT) bit rates */ -enum { - IWL_RATE_SISO_6M_PLCP = 0, - IWL_RATE_SISO_12M_PLCP = 1, - IWL_RATE_SISO_18M_PLCP = 2, - IWL_RATE_SISO_24M_PLCP = 3, - IWL_RATE_SISO_36M_PLCP = 4, - IWL_RATE_SISO_48M_PLCP = 5, - IWL_RATE_SISO_54M_PLCP = 6, - IWL_RATE_SISO_60M_PLCP = 7, - IWL_RATE_MIMO2_6M_PLCP = 0x8, - IWL_RATE_MIMO2_12M_PLCP = 0x9, - IWL_RATE_MIMO2_18M_PLCP = 0xa, - IWL_RATE_MIMO2_24M_PLCP = 0xb, - IWL_RATE_MIMO2_36M_PLCP = 0xc, - IWL_RATE_MIMO2_48M_PLCP = 0xd, - IWL_RATE_MIMO2_54M_PLCP = 0xe, - IWL_RATE_MIMO2_60M_PLCP = 0xf, - IWL_RATE_MIMO3_6M_PLCP = 0x10, - IWL_RATE_MIMO3_12M_PLCP = 0x11, - IWL_RATE_MIMO3_18M_PLCP = 0x12, - IWL_RATE_MIMO3_24M_PLCP = 0x13, - IWL_RATE_MIMO3_36M_PLCP = 0x14, - IWL_RATE_MIMO3_48M_PLCP = 0x15, - IWL_RATE_MIMO3_54M_PLCP = 0x16, - IWL_RATE_MIMO3_60M_PLCP = 0x17, - IWL_RATE_SISO_INVM_PLCP, - IWL_RATE_MIMO2_INVM_PLCP = IWL_RATE_SISO_INVM_PLCP, - IWL_RATE_MIMO3_INVM_PLCP = IWL_RATE_SISO_INVM_PLCP, -}; - -/* MAC header values for bit rates */ -enum { - IWL_RATE_6M_IEEE = 12, - IWL_RATE_9M_IEEE = 18, - IWL_RATE_12M_IEEE = 24, - IWL_RATE_18M_IEEE = 36, - IWL_RATE_24M_IEEE = 48, - IWL_RATE_36M_IEEE = 72, - IWL_RATE_48M_IEEE = 96, - IWL_RATE_54M_IEEE = 108, - IWL_RATE_60M_IEEE = 120, - IWL_RATE_1M_IEEE = 2, - IWL_RATE_2M_IEEE = 4, - IWL_RATE_5M_IEEE = 11, - IWL_RATE_11M_IEEE = 22, -}; - -#define IWL_RATES_MASK ((1 << IWL_RATE_COUNT) - 1) - -#define IWL_INVALID_VALUE -1 - -#define IWL_MIN_RSSI_VAL -100 -#define IWL_MAX_RSSI_VAL 0 - -/* These values specify how many Tx frame attempts before - * searching for a new modulation mode */ -#define IWL_LEGACY_FAILURE_LIMIT 160 -#define IWL_LEGACY_SUCCESS_LIMIT 480 -#define IWL_LEGACY_TABLE_COUNT 160 - -#define IWL_NONE_LEGACY_FAILURE_LIMIT 400 -#define IWL_NONE_LEGACY_SUCCESS_LIMIT 4500 -#define IWL_NONE_LEGACY_TABLE_COUNT 1500 - -/* Success ratio (ACKed / attempted tx frames) values (perfect is 128 * 100) */ -#define IWL_RS_GOOD_RATIO 12800 /* 100% */ -#define IWL_RATE_SCALE_SWITCH 10880 /* 85% */ -#define IWL_RATE_HIGH_TH 10880 /* 85% */ -#define IWL_RATE_INCREASE_TH 6400 /* 50% */ -#define IWL_RATE_DECREASE_TH 1920 /* 15% */ - -/* possible actions when in legacy mode */ -#define IWL_LEGACY_SWITCH_ANTENNA1 0 -#define IWL_LEGACY_SWITCH_ANTENNA2 1 -#define IWL_LEGACY_SWITCH_SISO 2 -#define IWL_LEGACY_SWITCH_MIMO2_AB 3 -#define IWL_LEGACY_SWITCH_MIMO2_AC 4 -#define IWL_LEGACY_SWITCH_MIMO2_BC 5 -#define IWL_LEGACY_SWITCH_MIMO3_ABC 6 - -/* possible actions when in siso mode */ -#define IWL_SISO_SWITCH_ANTENNA1 0 -#define IWL_SISO_SWITCH_ANTENNA2 1 -#define IWL_SISO_SWITCH_MIMO2_AB 2 -#define IWL_SISO_SWITCH_MIMO2_AC 3 -#define IWL_SISO_SWITCH_MIMO2_BC 4 -#define IWL_SISO_SWITCH_GI 5 -#define IWL_SISO_SWITCH_MIMO3_ABC 6 - - -/* possible actions when in mimo mode */ -#define IWL_MIMO2_SWITCH_ANTENNA1 0 -#define IWL_MIMO2_SWITCH_ANTENNA2 1 -#define IWL_MIMO2_SWITCH_SISO_A 2 -#define IWL_MIMO2_SWITCH_SISO_B 3 -#define IWL_MIMO2_SWITCH_SISO_C 4 -#define IWL_MIMO2_SWITCH_GI 5 -#define IWL_MIMO2_SWITCH_MIMO3_ABC 6 - - -/* possible actions when in mimo3 mode */ -#define IWL_MIMO3_SWITCH_ANTENNA1 0 -#define IWL_MIMO3_SWITCH_ANTENNA2 1 -#define IWL_MIMO3_SWITCH_SISO_A 2 -#define IWL_MIMO3_SWITCH_SISO_B 3 -#define IWL_MIMO3_SWITCH_SISO_C 4 -#define IWL_MIMO3_SWITCH_MIMO2_AB 5 -#define IWL_MIMO3_SWITCH_MIMO2_AC 6 -#define IWL_MIMO3_SWITCH_MIMO2_BC 7 -#define IWL_MIMO3_SWITCH_GI 8 - - -#define IWL_MAX_11N_MIMO3_SEARCH IWL_MIMO3_SWITCH_GI -#define IWL_MAX_SEARCH IWL_MIMO2_SWITCH_MIMO3_ABC - -/*FIXME:RS:add possible actions for MIMO3*/ - -#define IWL_ACTION_LIMIT 3 /* # possible actions */ - -#define LQ_SIZE 2 /* 2 mode tables: "Active" and "Search" */ - -/* load per tid defines for A-MPDU activation */ -#define IWL_AGG_TPT_THREHOLD 0 -#define IWL_AGG_LOAD_THRESHOLD 10 -#define IWL_AGG_ALL_TID 0xff -#define TID_QUEUE_CELL_SPACING 50 /*mS */ -#define TID_QUEUE_MAX_SIZE 20 -#define TID_ROUND_VALUE 5 /* mS */ - -#define TID_MAX_TIME_DIFF ((TID_QUEUE_MAX_SIZE - 1) * TID_QUEUE_CELL_SPACING) -#define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y)) - -extern const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT]; - -enum iwl_table_type { - LQ_NONE, - LQ_G, /* legacy types */ - LQ_A, - LQ_SISO, /* high-throughput types */ - LQ_MIMO2, - LQ_MIMO3, - LQ_MAX, -}; - -#define is_legacy(tbl) (((tbl) == LQ_G) || ((tbl) == LQ_A)) -#define is_siso(tbl) ((tbl) == LQ_SISO) -#define is_mimo2(tbl) ((tbl) == LQ_MIMO2) -#define is_mimo3(tbl) ((tbl) == LQ_MIMO3) -#define is_mimo(tbl) (is_mimo2(tbl) || is_mimo3(tbl)) -#define is_Ht(tbl) (is_siso(tbl) || is_mimo(tbl)) -#define is_a_band(tbl) ((tbl) == LQ_A) -#define is_g_and(tbl) ((tbl) == LQ_G) - -#define IWL_MAX_MCS_DISPLAY_SIZE 12 - -struct iwl_rate_mcs_info { - char mbps[IWL_MAX_MCS_DISPLAY_SIZE]; - char mcs[IWL_MAX_MCS_DISPLAY_SIZE]; -}; - -/** - * struct iwl_rate_scale_data -- tx success history for one rate - */ -struct iwl_rate_scale_data { - u64 data; /* bitmap of successful frames */ - s32 success_counter; /* number of frames successful */ - s32 success_ratio; /* per-cent * 128 */ - s32 counter; /* number of frames attempted */ - s32 average_tpt; /* success ratio * expected throughput */ - unsigned long stamp; -}; - -/** - * struct iwl_scale_tbl_info -- tx params and success history for all rates - * - * There are two of these in struct iwl_lq_sta, - * one for "active", and one for "search". - */ -struct iwl_scale_tbl_info { - enum iwl_table_type lq_type; - u8 ant_type; - u8 is_SGI; /* 1 = short guard interval */ - u8 is_ht40; /* 1 = 40 MHz channel width */ - u8 is_dup; /* 1 = duplicated data streams */ - u8 action; /* change modulation; IWL_[LEGACY/SISO/MIMO]_SWITCH_* */ - u8 max_search; /* maximun number of tables we can search */ - s32 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */ - u32 current_rate; /* rate_n_flags, uCode API format */ - struct iwl_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */ -}; - -struct iwl_traffic_load { - unsigned long time_stamp; /* age of the oldest statistics */ - u32 packet_count[TID_QUEUE_MAX_SIZE]; /* packet count in this time - * slice */ - u32 total; /* total num of packets during the - * last TID_MAX_TIME_DIFF */ - u8 queue_count; /* number of queues that has - * been used since the last cleanup */ - u8 head; /* start of the circular buffer */ -}; - -/** - * struct iwl_lq_sta -- driver's rate scaling private structure - * - * Pointer to this gets passed back and forth between driver and mac80211. - */ -struct iwl_lq_sta { - u8 active_tbl; /* index of active table, range 0-1 */ - u8 enable_counter; /* indicates HT mode */ - u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */ - u8 search_better_tbl; /* 1: currently trying alternate mode */ - s32 last_tpt; - - /* The following determine when to search for a new mode */ - u32 table_count_limit; - u32 max_failure_limit; /* # failed frames before new search */ - u32 max_success_limit; /* # successful frames before new search */ - u32 table_count; - u32 total_failed; /* total failed frames, any/all rates */ - u32 total_success; /* total successful frames, any/all rates */ - u64 flush_timer; /* time staying in mode before new search */ - - u8 action_counter; /* # mode-switch actions tried */ - u8 is_green; - u8 is_dup; - enum ieee80211_band band; - - /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */ - u32 supp_rates; - u16 active_legacy_rate; - u16 active_siso_rate; - u16 active_mimo2_rate; - u16 active_mimo3_rate; - s8 max_rate_idx; /* Max rate set by user */ - u8 missed_rate_counter; - - struct iwl_link_quality_cmd lq; - struct iwl_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ - struct iwl_traffic_load load[IWL_MAX_TID_COUNT]; - u8 tx_agg_tid_en; -#ifdef CONFIG_MAC80211_DEBUGFS - struct dentry *rs_sta_dbgfs_scale_table_file; - struct dentry *rs_sta_dbgfs_stats_table_file; - struct dentry *rs_sta_dbgfs_rate_scale_data_file; - struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file; - u32 dbg_fixed_rate; -#endif - struct iwl_priv *drv; - - /* used to be in sta_info */ - int last_txrate_idx; - /* last tx rate_n_flags */ - u32 last_rate_n_flags; - /* packets destined for this STA are aggregated */ - u8 is_agg; - /* BT traffic this sta was last updated in */ - u8 last_bt_traffic; -}; - -static inline u8 num_of_ant(u8 mask) -{ - return !!((mask) & ANT_A) + - !!((mask) & ANT_B) + - !!((mask) & ANT_C); -} - -static inline u8 first_antenna(u8 mask) -{ - if (mask & ANT_A) - return ANT_A; - if (mask & ANT_B) - return ANT_B; - return ANT_C; -} - - -/* Initialize station's rate scaling information after adding station */ -extern void iwl_rs_rate_init(struct iwl_priv *priv, - struct ieee80211_sta *sta, u8 sta_id); - -/** - * iwl_rate_control_register - Register the rate control algorithm callbacks - * - * Since the rate control algorithm is hardware specific, there is no need - * or reason to place it as a stand alone module. The driver can call - * iwl_rate_control_register in order to register the rate control callbacks - * with the mac80211 subsystem. This should be performed prior to calling - * ieee80211_register_hw - * - */ -extern int iwlagn_rate_control_register(void); - -/** - * iwl_rate_control_unregister - Unregister the rate control callbacks - * - * This should be called after calling ieee80211_unregister_hw, but before - * the driver is unloaded. - */ -extern void iwlagn_rate_control_unregister(void); - -#endif /* __iwl_agn__rs__ */ diff --git a/drivers/net/wireless/iwlwifi/dvm/rx.c b/drivers/net/wireless/iwlwifi/dvm/rx.c deleted file mode 100644 index a4eed2055fdb..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/rx.c +++ /dev/null @@ -1,1151 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portionhelp of the ieee80211 subsystem header files. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#include -#include -#include -#include -#include -#include "iwl-io.h" -#include "dev.h" -#include "calib.h" -#include "agn.h" - -#define IWL_CMD_ENTRY(x) [x] = #x - -const char *iwl_dvm_cmd_strings[REPLY_MAX] = { - IWL_CMD_ENTRY(REPLY_ALIVE), - IWL_CMD_ENTRY(REPLY_ERROR), - IWL_CMD_ENTRY(REPLY_ECHO), - IWL_CMD_ENTRY(REPLY_RXON), - IWL_CMD_ENTRY(REPLY_RXON_ASSOC), - IWL_CMD_ENTRY(REPLY_QOS_PARAM), - IWL_CMD_ENTRY(REPLY_RXON_TIMING), - IWL_CMD_ENTRY(REPLY_ADD_STA), - IWL_CMD_ENTRY(REPLY_REMOVE_STA), - IWL_CMD_ENTRY(REPLY_REMOVE_ALL_STA), - IWL_CMD_ENTRY(REPLY_TXFIFO_FLUSH), - IWL_CMD_ENTRY(REPLY_WEPKEY), - IWL_CMD_ENTRY(REPLY_TX), - IWL_CMD_ENTRY(REPLY_LEDS_CMD), - IWL_CMD_ENTRY(REPLY_TX_LINK_QUALITY_CMD), - IWL_CMD_ENTRY(COEX_PRIORITY_TABLE_CMD), - IWL_CMD_ENTRY(COEX_MEDIUM_NOTIFICATION), - IWL_CMD_ENTRY(COEX_EVENT_CMD), - IWL_CMD_ENTRY(REPLY_QUIET_CMD), - IWL_CMD_ENTRY(REPLY_CHANNEL_SWITCH), - IWL_CMD_ENTRY(CHANNEL_SWITCH_NOTIFICATION), - IWL_CMD_ENTRY(REPLY_SPECTRUM_MEASUREMENT_CMD), - IWL_CMD_ENTRY(SPECTRUM_MEASURE_NOTIFICATION), - IWL_CMD_ENTRY(POWER_TABLE_CMD), - IWL_CMD_ENTRY(PM_SLEEP_NOTIFICATION), - IWL_CMD_ENTRY(PM_DEBUG_STATISTIC_NOTIFIC), - IWL_CMD_ENTRY(REPLY_SCAN_CMD), - IWL_CMD_ENTRY(REPLY_SCAN_ABORT_CMD), - IWL_CMD_ENTRY(SCAN_START_NOTIFICATION), - IWL_CMD_ENTRY(SCAN_RESULTS_NOTIFICATION), - IWL_CMD_ENTRY(SCAN_COMPLETE_NOTIFICATION), - IWL_CMD_ENTRY(BEACON_NOTIFICATION), - IWL_CMD_ENTRY(REPLY_TX_BEACON), - IWL_CMD_ENTRY(WHO_IS_AWAKE_NOTIFICATION), - IWL_CMD_ENTRY(QUIET_NOTIFICATION), - IWL_CMD_ENTRY(REPLY_TX_PWR_TABLE_CMD), - IWL_CMD_ENTRY(MEASURE_ABORT_NOTIFICATION), - IWL_CMD_ENTRY(REPLY_BT_CONFIG), - IWL_CMD_ENTRY(REPLY_STATISTICS_CMD), - IWL_CMD_ENTRY(STATISTICS_NOTIFICATION), - IWL_CMD_ENTRY(REPLY_CARD_STATE_CMD), - IWL_CMD_ENTRY(CARD_STATE_NOTIFICATION), - IWL_CMD_ENTRY(MISSED_BEACONS_NOTIFICATION), - IWL_CMD_ENTRY(REPLY_CT_KILL_CONFIG_CMD), - IWL_CMD_ENTRY(SENSITIVITY_CMD), - IWL_CMD_ENTRY(REPLY_PHY_CALIBRATION_CMD), - IWL_CMD_ENTRY(REPLY_RX_PHY_CMD), - IWL_CMD_ENTRY(REPLY_RX_MPDU_CMD), - IWL_CMD_ENTRY(REPLY_COMPRESSED_BA), - IWL_CMD_ENTRY(CALIBRATION_CFG_CMD), - IWL_CMD_ENTRY(CALIBRATION_RES_NOTIFICATION), - IWL_CMD_ENTRY(CALIBRATION_COMPLETE_NOTIFICATION), - IWL_CMD_ENTRY(REPLY_TX_POWER_DBM_CMD), - IWL_CMD_ENTRY(TEMPERATURE_NOTIFICATION), - IWL_CMD_ENTRY(TX_ANT_CONFIGURATION_CMD), - IWL_CMD_ENTRY(REPLY_BT_COEX_PROFILE_NOTIF), - IWL_CMD_ENTRY(REPLY_BT_COEX_PRIO_TABLE), - IWL_CMD_ENTRY(REPLY_BT_COEX_PROT_ENV), - IWL_CMD_ENTRY(REPLY_WIPAN_PARAMS), - IWL_CMD_ENTRY(REPLY_WIPAN_RXON), - IWL_CMD_ENTRY(REPLY_WIPAN_RXON_TIMING), - IWL_CMD_ENTRY(REPLY_WIPAN_RXON_ASSOC), - IWL_CMD_ENTRY(REPLY_WIPAN_QOS_PARAM), - IWL_CMD_ENTRY(REPLY_WIPAN_WEPKEY), - IWL_CMD_ENTRY(REPLY_WIPAN_P2P_CHANNEL_SWITCH), - IWL_CMD_ENTRY(REPLY_WIPAN_NOA_NOTIFICATION), - IWL_CMD_ENTRY(REPLY_WIPAN_DEACTIVATION_COMPLETE), - IWL_CMD_ENTRY(REPLY_WOWLAN_PATTERNS), - IWL_CMD_ENTRY(REPLY_WOWLAN_WAKEUP_FILTER), - IWL_CMD_ENTRY(REPLY_WOWLAN_TSC_RSC_PARAMS), - IWL_CMD_ENTRY(REPLY_WOWLAN_TKIP_PARAMS), - IWL_CMD_ENTRY(REPLY_WOWLAN_KEK_KCK_MATERIAL), - IWL_CMD_ENTRY(REPLY_WOWLAN_GET_STATUS), - IWL_CMD_ENTRY(REPLY_D3_CONFIG), -}; -#undef IWL_CMD_ENTRY - -/****************************************************************************** - * - * Generic RX handler implementations - * - ******************************************************************************/ - -static int iwlagn_rx_reply_error(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_error_resp *err_resp = (void *)pkt->data; - - IWL_ERR(priv, "Error Reply type 0x%08X cmd REPLY_ERROR (0x%02X) " - "seq 0x%04X ser 0x%08X\n", - le32_to_cpu(err_resp->error_type), - err_resp->cmd_id, - le16_to_cpu(err_resp->bad_cmd_seq_num), - le32_to_cpu(err_resp->error_info)); - return 0; -} - -static int iwlagn_rx_csa(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_csa_notification *csa = (void *)pkt->data; - /* - * MULTI-FIXME - * See iwlagn_mac_channel_switch. - */ - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - struct iwl_rxon_cmd *rxon = (void *)&ctx->active; - - if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) - return 0; - - if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) { - rxon->channel = csa->channel; - ctx->staging.channel = csa->channel; - IWL_DEBUG_11H(priv, "CSA notif: channel %d\n", - le16_to_cpu(csa->channel)); - iwl_chswitch_done(priv, true); - } else { - IWL_ERR(priv, "CSA notif (fail) : channel %d\n", - le16_to_cpu(csa->channel)); - iwl_chswitch_done(priv, false); - } - return 0; -} - - -static int iwlagn_rx_spectrum_measure_notif(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_spectrum_notification *report = (void *)pkt->data; - - if (!report->state) { - IWL_DEBUG_11H(priv, - "Spectrum Measure Notification: Start\n"); - return 0; - } - - memcpy(&priv->measure_report, report, sizeof(*report)); - priv->measurement_status |= MEASUREMENT_READY; - return 0; -} - -static int iwlagn_rx_pm_sleep_notif(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ -#ifdef CONFIG_IWLWIFI_DEBUG - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_sleep_notification *sleep = (void *)pkt->data; - IWL_DEBUG_RX(priv, "sleep mode: %d, src: %d\n", - sleep->pm_sleep_mode, sleep->pm_wakeup_src); -#endif - return 0; -} - -static int iwlagn_rx_pm_debug_statistics_notif(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - u32 __maybe_unused len = - le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; - IWL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled " - "notification for PM_DEBUG_STATISTIC_NOTIFIC:\n", len); - iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->data, len); - return 0; -} - -static int iwlagn_rx_beacon_notif(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwlagn_beacon_notif *beacon = (void *)pkt->data; -#ifdef CONFIG_IWLWIFI_DEBUG - u16 status = le16_to_cpu(beacon->beacon_notify_hdr.status.status); - u8 rate = iwl_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); - - IWL_DEBUG_RX(priv, "beacon status %#x, retries:%d ibssmgr:%d " - "tsf:0x%.8x%.8x rate:%d\n", - status & TX_STATUS_MSK, - beacon->beacon_notify_hdr.failure_frame, - le32_to_cpu(beacon->ibss_mgr_status), - le32_to_cpu(beacon->high_tsf), - le32_to_cpu(beacon->low_tsf), rate); -#endif - - priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status); - - return 0; -} - -/** - * iwl_good_plcp_health - checks for plcp error. - * - * When the plcp error is exceeding the thresholds, reset the radio - * to improve the throughput. - */ -static bool iwlagn_good_plcp_health(struct iwl_priv *priv, - struct statistics_rx_phy *cur_ofdm, - struct statistics_rx_ht_phy *cur_ofdm_ht, - unsigned int msecs) -{ - int delta; - int threshold = priv->plcp_delta_threshold; - - if (threshold == IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE) { - IWL_DEBUG_RADIO(priv, "plcp_err check disabled\n"); - return true; - } - - delta = le32_to_cpu(cur_ofdm->plcp_err) - - le32_to_cpu(priv->statistics.rx_ofdm.plcp_err) + - le32_to_cpu(cur_ofdm_ht->plcp_err) - - le32_to_cpu(priv->statistics.rx_ofdm_ht.plcp_err); - - /* Can be negative if firmware reset statistics */ - if (delta <= 0) - return true; - - if ((delta * 100 / msecs) > threshold) { - IWL_DEBUG_RADIO(priv, - "plcp health threshold %u delta %d msecs %u\n", - threshold, delta, msecs); - return false; - } - - return true; -} - -int iwl_force_rf_reset(struct iwl_priv *priv, bool external) -{ - struct iwl_rf_reset *rf_reset; - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return -EAGAIN; - - if (!iwl_is_any_associated(priv)) { - IWL_DEBUG_SCAN(priv, "force reset rejected: not associated\n"); - return -ENOLINK; - } - - rf_reset = &priv->rf_reset; - rf_reset->reset_request_count++; - if (!external && rf_reset->last_reset_jiffies && - time_after(rf_reset->last_reset_jiffies + - IWL_DELAY_NEXT_FORCE_RF_RESET, jiffies)) { - IWL_DEBUG_INFO(priv, "RF reset rejected\n"); - rf_reset->reset_reject_count++; - return -EAGAIN; - } - rf_reset->reset_success_count++; - rf_reset->last_reset_jiffies = jiffies; - - /* - * There is no easy and better way to force reset the radio, - * the only known method is switching channel which will force to - * reset and tune the radio. - * Use internal short scan (single channel) operation to should - * achieve this objective. - * Driver should reset the radio when number of consecutive missed - * beacon, or any other uCode error condition detected. - */ - IWL_DEBUG_INFO(priv, "perform radio reset.\n"); - iwl_internal_short_hw_scan(priv); - return 0; -} - - -static void iwlagn_recover_from_statistics(struct iwl_priv *priv, - struct statistics_rx_phy *cur_ofdm, - struct statistics_rx_ht_phy *cur_ofdm_ht, - struct statistics_tx *tx, - unsigned long stamp) -{ - unsigned int msecs; - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - msecs = jiffies_to_msecs(stamp - priv->rx_statistics_jiffies); - - /* Only gather statistics and update time stamp when not associated */ - if (!iwl_is_any_associated(priv)) - return; - - /* Do not check/recover when do not have enough statistics data */ - if (msecs < 99) - return; - - if (iwlwifi_mod_params.plcp_check && - !iwlagn_good_plcp_health(priv, cur_ofdm, cur_ofdm_ht, msecs)) - iwl_force_rf_reset(priv, false); -} - -/* Calculate noise level, based on measurements during network silence just - * before arriving beacon. This measurement can be done only if we know - * exactly when to expect beacons, therefore only when we're associated. */ -static void iwlagn_rx_calc_noise(struct iwl_priv *priv) -{ - struct statistics_rx_non_phy *rx_info; - int num_active_rx = 0; - int total_silence = 0; - int bcn_silence_a, bcn_silence_b, bcn_silence_c; - int last_rx_noise; - - rx_info = &priv->statistics.rx_non_phy; - - bcn_silence_a = - le32_to_cpu(rx_info->beacon_silence_rssi_a) & IN_BAND_FILTER; - bcn_silence_b = - le32_to_cpu(rx_info->beacon_silence_rssi_b) & IN_BAND_FILTER; - bcn_silence_c = - le32_to_cpu(rx_info->beacon_silence_rssi_c) & IN_BAND_FILTER; - - if (bcn_silence_a) { - total_silence += bcn_silence_a; - num_active_rx++; - } - if (bcn_silence_b) { - total_silence += bcn_silence_b; - num_active_rx++; - } - if (bcn_silence_c) { - total_silence += bcn_silence_c; - num_active_rx++; - } - - /* Average among active antennas */ - if (num_active_rx) - last_rx_noise = (total_silence / num_active_rx) - 107; - else - last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE; - - IWL_DEBUG_CALIB(priv, "inband silence a %u, b %u, c %u, dBm %d\n", - bcn_silence_a, bcn_silence_b, bcn_silence_c, - last_rx_noise); -} - -#ifdef CONFIG_IWLWIFI_DEBUGFS -/* - * based on the assumption of all statistics counter are in DWORD - * FIXME: This function is for debugging, do not deal with - * the case of counters roll-over. - */ -static void accum_stats(__le32 *prev, __le32 *cur, __le32 *delta, - __le32 *max_delta, __le32 *accum, int size) -{ - int i; - - for (i = 0; - i < size / sizeof(__le32); - i++, prev++, cur++, delta++, max_delta++, accum++) { - if (le32_to_cpu(*cur) > le32_to_cpu(*prev)) { - *delta = cpu_to_le32( - le32_to_cpu(*cur) - le32_to_cpu(*prev)); - le32_add_cpu(accum, le32_to_cpu(*delta)); - if (le32_to_cpu(*delta) > le32_to_cpu(*max_delta)) - *max_delta = *delta; - } - } -} - -static void -iwlagn_accumulative_statistics(struct iwl_priv *priv, - struct statistics_general_common *common, - struct statistics_rx_non_phy *rx_non_phy, - struct statistics_rx_phy *rx_ofdm, - struct statistics_rx_ht_phy *rx_ofdm_ht, - struct statistics_rx_phy *rx_cck, - struct statistics_tx *tx, - struct statistics_bt_activity *bt_activity) -{ -#define ACCUM(_name) \ - accum_stats((__le32 *)&priv->statistics._name, \ - (__le32 *)_name, \ - (__le32 *)&priv->delta_stats._name, \ - (__le32 *)&priv->max_delta_stats._name, \ - (__le32 *)&priv->accum_stats._name, \ - sizeof(*_name)); - - ACCUM(common); - ACCUM(rx_non_phy); - ACCUM(rx_ofdm); - ACCUM(rx_ofdm_ht); - ACCUM(rx_cck); - ACCUM(tx); - if (bt_activity) - ACCUM(bt_activity); -#undef ACCUM -} -#else -static inline void -iwlagn_accumulative_statistics(struct iwl_priv *priv, - struct statistics_general_common *common, - struct statistics_rx_non_phy *rx_non_phy, - struct statistics_rx_phy *rx_ofdm, - struct statistics_rx_ht_phy *rx_ofdm_ht, - struct statistics_rx_phy *rx_cck, - struct statistics_tx *tx, - struct statistics_bt_activity *bt_activity) -{ -} -#endif - -static int iwlagn_rx_statistics(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - unsigned long stamp = jiffies; - const int reg_recalib_period = 60; - int change; - struct iwl_rx_packet *pkt = rxb_addr(rxb); - u32 len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; - __le32 *flag; - struct statistics_general_common *common; - struct statistics_rx_non_phy *rx_non_phy; - struct statistics_rx_phy *rx_ofdm; - struct statistics_rx_ht_phy *rx_ofdm_ht; - struct statistics_rx_phy *rx_cck; - struct statistics_tx *tx; - struct statistics_bt_activity *bt_activity; - - len -= sizeof(struct iwl_cmd_header); /* skip header */ - - IWL_DEBUG_RX(priv, "Statistics notification received (%d bytes).\n", - len); - - spin_lock(&priv->statistics.lock); - - if (len == sizeof(struct iwl_bt_notif_statistics)) { - struct iwl_bt_notif_statistics *stats; - stats = (void *)&pkt->data; - flag = &stats->flag; - common = &stats->general.common; - rx_non_phy = &stats->rx.general.common; - rx_ofdm = &stats->rx.ofdm; - rx_ofdm_ht = &stats->rx.ofdm_ht; - rx_cck = &stats->rx.cck; - tx = &stats->tx; - bt_activity = &stats->general.activity; - -#ifdef CONFIG_IWLWIFI_DEBUGFS - /* handle this exception directly */ - priv->statistics.num_bt_kills = stats->rx.general.num_bt_kills; - le32_add_cpu(&priv->statistics.accum_num_bt_kills, - le32_to_cpu(stats->rx.general.num_bt_kills)); -#endif - } else if (len == sizeof(struct iwl_notif_statistics)) { - struct iwl_notif_statistics *stats; - stats = (void *)&pkt->data; - flag = &stats->flag; - common = &stats->general.common; - rx_non_phy = &stats->rx.general; - rx_ofdm = &stats->rx.ofdm; - rx_ofdm_ht = &stats->rx.ofdm_ht; - rx_cck = &stats->rx.cck; - tx = &stats->tx; - bt_activity = NULL; - } else { - WARN_ONCE(1, "len %d doesn't match BT (%zu) or normal (%zu)\n", - len, sizeof(struct iwl_bt_notif_statistics), - sizeof(struct iwl_notif_statistics)); - spin_unlock(&priv->statistics.lock); - return 0; - } - - change = common->temperature != priv->statistics.common.temperature || - (*flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK) != - (priv->statistics.flag & STATISTICS_REPLY_FLG_HT40_MODE_MSK); - - iwlagn_accumulative_statistics(priv, common, rx_non_phy, rx_ofdm, - rx_ofdm_ht, rx_cck, tx, bt_activity); - - iwlagn_recover_from_statistics(priv, rx_ofdm, rx_ofdm_ht, tx, stamp); - - priv->statistics.flag = *flag; - memcpy(&priv->statistics.common, common, sizeof(*common)); - memcpy(&priv->statistics.rx_non_phy, rx_non_phy, sizeof(*rx_non_phy)); - memcpy(&priv->statistics.rx_ofdm, rx_ofdm, sizeof(*rx_ofdm)); - memcpy(&priv->statistics.rx_ofdm_ht, rx_ofdm_ht, sizeof(*rx_ofdm_ht)); - memcpy(&priv->statistics.rx_cck, rx_cck, sizeof(*rx_cck)); - memcpy(&priv->statistics.tx, tx, sizeof(*tx)); -#ifdef CONFIG_IWLWIFI_DEBUGFS - if (bt_activity) - memcpy(&priv->statistics.bt_activity, bt_activity, - sizeof(*bt_activity)); -#endif - - priv->rx_statistics_jiffies = stamp; - - set_bit(STATUS_STATISTICS, &priv->status); - - /* Reschedule the statistics timer to occur in - * reg_recalib_period seconds to ensure we get a - * thermal update even if the uCode doesn't give - * us one */ - mod_timer(&priv->statistics_periodic, jiffies + - msecs_to_jiffies(reg_recalib_period * 1000)); - - if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) && - (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) { - iwlagn_rx_calc_noise(priv); - queue_work(priv->workqueue, &priv->run_time_calib_work); - } - if (priv->lib->temperature && change) - priv->lib->temperature(priv); - - spin_unlock(&priv->statistics.lock); - - return 0; -} - -static int iwlagn_rx_reply_statistics(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_notif_statistics *stats = (void *)pkt->data; - - if (le32_to_cpu(stats->flag) & UCODE_STATISTICS_CLEAR_MSK) { -#ifdef CONFIG_IWLWIFI_DEBUGFS - memset(&priv->accum_stats, 0, - sizeof(priv->accum_stats)); - memset(&priv->delta_stats, 0, - sizeof(priv->delta_stats)); - memset(&priv->max_delta_stats, 0, - sizeof(priv->max_delta_stats)); -#endif - IWL_DEBUG_RX(priv, "Statistics have been cleared\n"); - } - iwlagn_rx_statistics(priv, rxb, cmd); - return 0; -} - -/* Handle notification from uCode that card's power state is changing - * due to software, hardware, or critical temperature RFKILL */ -static int iwlagn_rx_card_state_notif(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_card_state_notif *card_state_notif = (void *)pkt->data; - u32 flags = le32_to_cpu(card_state_notif->flags); - unsigned long status = priv->status; - - IWL_DEBUG_RF_KILL(priv, "Card state received: HW:%s SW:%s CT:%s\n", - (flags & HW_CARD_DISABLED) ? "Kill" : "On", - (flags & SW_CARD_DISABLED) ? "Kill" : "On", - (flags & CT_CARD_DISABLED) ? - "Reached" : "Not reached"); - - if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED | - CT_CARD_DISABLED)) { - - iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_SET, - CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - - iwl_write_direct32(priv->trans, HBUS_TARG_MBX_C, - HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); - - if (!(flags & RXON_CARD_DISABLED)) { - iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_CLR, - CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - iwl_write_direct32(priv->trans, HBUS_TARG_MBX_C, - HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED); - } - if (flags & CT_CARD_DISABLED) - iwl_tt_enter_ct_kill(priv); - } - if (!(flags & CT_CARD_DISABLED)) - iwl_tt_exit_ct_kill(priv); - - if (flags & HW_CARD_DISABLED) - set_bit(STATUS_RF_KILL_HW, &priv->status); - else - clear_bit(STATUS_RF_KILL_HW, &priv->status); - - - if (!(flags & RXON_CARD_DISABLED)) - iwl_scan_cancel(priv); - - if ((test_bit(STATUS_RF_KILL_HW, &status) != - test_bit(STATUS_RF_KILL_HW, &priv->status))) - wiphy_rfkill_set_hw_state(priv->hw->wiphy, - test_bit(STATUS_RF_KILL_HW, &priv->status)); - return 0; -} - -static int iwlagn_rx_missed_beacon_notif(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) - -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_missed_beacon_notif *missed_beacon = (void *)pkt->data; - - if (le32_to_cpu(missed_beacon->consecutive_missed_beacons) > - priv->missed_beacon_threshold) { - IWL_DEBUG_CALIB(priv, - "missed bcn cnsq %d totl %d rcd %d expctd %d\n", - le32_to_cpu(missed_beacon->consecutive_missed_beacons), - le32_to_cpu(missed_beacon->total_missed_becons), - le32_to_cpu(missed_beacon->num_recvd_beacons), - le32_to_cpu(missed_beacon->num_expected_beacons)); - if (!test_bit(STATUS_SCANNING, &priv->status)) - iwl_init_sensitivity(priv); - } - return 0; -} - -/* Cache phy data (Rx signal strength, etc) for HT frame (REPLY_RX_PHY_CMD). - * This will be used later in iwl_rx_reply_rx() for REPLY_RX_MPDU_CMD. */ -static int iwlagn_rx_reply_rx_phy(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - - priv->last_phy_res_valid = true; - priv->ampdu_ref++; - memcpy(&priv->last_phy_res, pkt->data, - sizeof(struct iwl_rx_phy_res)); - return 0; -} - -/* - * returns non-zero if packet should be dropped - */ -static int iwlagn_set_decrypted_flag(struct iwl_priv *priv, - struct ieee80211_hdr *hdr, - u32 decrypt_res, - struct ieee80211_rx_status *stats) -{ - u16 fc = le16_to_cpu(hdr->frame_control); - - /* - * All contexts have the same setting here due to it being - * a module parameter, so OK to check any context. - */ - if (priv->contexts[IWL_RXON_CTX_BSS].active.filter_flags & - RXON_FILTER_DIS_DECRYPT_MSK) - return 0; - - if (!(fc & IEEE80211_FCTL_PROTECTED)) - return 0; - - IWL_DEBUG_RX(priv, "decrypt_res:0x%x\n", decrypt_res); - switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) { - case RX_RES_STATUS_SEC_TYPE_TKIP: - /* The uCode has got a bad phase 1 Key, pushes the packet. - * Decryption will be done in SW. */ - if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == - RX_RES_STATUS_BAD_KEY_TTAK) - break; - - case RX_RES_STATUS_SEC_TYPE_WEP: - if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == - RX_RES_STATUS_BAD_ICV_MIC) { - /* bad ICV, the packet is destroyed since the - * decryption is inplace, drop it */ - IWL_DEBUG_RX(priv, "Packet destroyed\n"); - return -1; - } - case RX_RES_STATUS_SEC_TYPE_CCMP: - if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == - RX_RES_STATUS_DECRYPT_OK) { - IWL_DEBUG_RX(priv, "hw decrypt successfully!!!\n"); - stats->flag |= RX_FLAG_DECRYPTED; - } - break; - - default: - break; - } - return 0; -} - -static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv, - struct ieee80211_hdr *hdr, - u16 len, - u32 ampdu_status, - struct iwl_rx_cmd_buffer *rxb, - struct ieee80211_rx_status *stats) -{ - struct sk_buff *skb; - __le16 fc = hdr->frame_control; - struct iwl_rxon_context *ctx; - unsigned int hdrlen, fraglen; - - /* We only process data packets if the interface is open */ - if (unlikely(!priv->is_open)) { - IWL_DEBUG_DROP_LIMIT(priv, - "Dropping packet while interface is not open.\n"); - return; - } - - /* In case of HW accelerated crypto and bad decryption, drop */ - if (!iwlwifi_mod_params.sw_crypto && - iwlagn_set_decrypted_flag(priv, hdr, ampdu_status, stats)) - return; - - /* Dont use dev_alloc_skb(), we'll have enough headroom once - * ieee80211_hdr pulled. - */ - skb = alloc_skb(128, GFP_ATOMIC); - if (!skb) { - IWL_ERR(priv, "alloc_skb failed\n"); - return; - } - /* If frame is small enough to fit in skb->head, pull it completely. - * If not, only pull ieee80211_hdr so that splice() or TCP coalesce - * are more efficient. - */ - hdrlen = (len <= skb_tailroom(skb)) ? len : sizeof(*hdr); - - memcpy(skb_put(skb, hdrlen), hdr, hdrlen); - fraglen = len - hdrlen; - - if (fraglen) { - int offset = (void *)hdr + hdrlen - - rxb_addr(rxb) + rxb_offset(rxb); - - skb_add_rx_frag(skb, 0, rxb_steal_page(rxb), offset, - fraglen, rxb->truesize); - } - - /* - * Wake any queues that were stopped due to a passive channel tx - * failure. This can happen because the regulatory enforcement in - * the device waits for a beacon before allowing transmission, - * sometimes even after already having transmitted frames for the - * association because the new RXON may reset the information. - */ - if (unlikely(ieee80211_is_beacon(fc) && priv->passive_no_rx)) { - for_each_context(priv, ctx) { - if (!ether_addr_equal(hdr->addr3, - ctx->active.bssid_addr)) - continue; - iwlagn_lift_passive_no_rx(priv); - } - } - - memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); - - ieee80211_rx_ni(priv->hw, skb); -} - -static u32 iwlagn_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in) -{ - u32 decrypt_out = 0; - - if ((decrypt_in & RX_RES_STATUS_STATION_FOUND) == - RX_RES_STATUS_STATION_FOUND) - decrypt_out |= (RX_RES_STATUS_STATION_FOUND | - RX_RES_STATUS_NO_STATION_INFO_MISMATCH); - - decrypt_out |= (decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK); - - /* packet was not encrypted */ - if ((decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK) == - RX_RES_STATUS_SEC_TYPE_NONE) - return decrypt_out; - - /* packet was encrypted with unknown alg */ - if ((decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK) == - RX_RES_STATUS_SEC_TYPE_ERR) - return decrypt_out; - - /* decryption was not done in HW */ - if ((decrypt_in & RX_MPDU_RES_STATUS_DEC_DONE_MSK) != - RX_MPDU_RES_STATUS_DEC_DONE_MSK) - return decrypt_out; - - switch (decrypt_in & RX_RES_STATUS_SEC_TYPE_MSK) { - - case RX_RES_STATUS_SEC_TYPE_CCMP: - /* alg is CCM: check MIC only */ - if (!(decrypt_in & RX_MPDU_RES_STATUS_MIC_OK)) - /* Bad MIC */ - decrypt_out |= RX_RES_STATUS_BAD_ICV_MIC; - else - decrypt_out |= RX_RES_STATUS_DECRYPT_OK; - - break; - - case RX_RES_STATUS_SEC_TYPE_TKIP: - if (!(decrypt_in & RX_MPDU_RES_STATUS_TTAK_OK)) { - /* Bad TTAK */ - decrypt_out |= RX_RES_STATUS_BAD_KEY_TTAK; - break; - } - /* fall through if TTAK OK */ - default: - if (!(decrypt_in & RX_MPDU_RES_STATUS_ICV_OK)) - decrypt_out |= RX_RES_STATUS_BAD_ICV_MIC; - else - decrypt_out |= RX_RES_STATUS_DECRYPT_OK; - break; - } - - IWL_DEBUG_RX(priv, "decrypt_in:0x%x decrypt_out = 0x%x\n", - decrypt_in, decrypt_out); - - return decrypt_out; -} - -/* Calc max signal level (dBm) among 3 possible receivers */ -static int iwlagn_calc_rssi(struct iwl_priv *priv, - struct iwl_rx_phy_res *rx_resp) -{ - /* data from PHY/DSP regarding signal strength, etc., - * contents are always there, not configurable by host - */ - struct iwlagn_non_cfg_phy *ncphy = - (struct iwlagn_non_cfg_phy *)rx_resp->non_cfg_phy_buf; - u32 val, rssi_a, rssi_b, rssi_c, max_rssi; - u8 agc; - - val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_AGC_IDX]); - agc = (val & IWLAGN_OFDM_AGC_MSK) >> IWLAGN_OFDM_AGC_BIT_POS; - - /* Find max rssi among 3 possible receivers. - * These values are measured by the digital signal processor (DSP). - * They should stay fairly constant even as the signal strength varies, - * if the radio's automatic gain control (AGC) is working right. - * AGC value (see below) will provide the "interesting" info. - */ - val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_RSSI_AB_IDX]); - rssi_a = (val & IWLAGN_OFDM_RSSI_INBAND_A_BITMSK) >> - IWLAGN_OFDM_RSSI_A_BIT_POS; - rssi_b = (val & IWLAGN_OFDM_RSSI_INBAND_B_BITMSK) >> - IWLAGN_OFDM_RSSI_B_BIT_POS; - val = le32_to_cpu(ncphy->non_cfg_phy[IWLAGN_RX_RES_RSSI_C_IDX]); - rssi_c = (val & IWLAGN_OFDM_RSSI_INBAND_C_BITMSK) >> - IWLAGN_OFDM_RSSI_C_BIT_POS; - - max_rssi = max_t(u32, rssi_a, rssi_b); - max_rssi = max_t(u32, max_rssi, rssi_c); - - IWL_DEBUG_STATS(priv, "Rssi In A %d B %d C %d Max %d AGC dB %d\n", - rssi_a, rssi_b, rssi_c, max_rssi, agc); - - /* dBm = max_rssi dB - agc dB - constant. - * Higher AGC (higher radio gain) means lower signal. */ - return max_rssi - agc - IWLAGN_RSSI_OFFSET; -} - -/* Called for REPLY_RX_MPDU_CMD */ -static int iwlagn_rx_reply_rx(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct ieee80211_hdr *header; - struct ieee80211_rx_status rx_status = {}; - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_rx_phy_res *phy_res; - __le32 rx_pkt_status; - struct iwl_rx_mpdu_res_start *amsdu; - u32 len; - u32 ampdu_status; - u32 rate_n_flags; - - if (!priv->last_phy_res_valid) { - IWL_ERR(priv, "MPDU frame without cached PHY data\n"); - return 0; - } - phy_res = &priv->last_phy_res; - amsdu = (struct iwl_rx_mpdu_res_start *)pkt->data; - header = (struct ieee80211_hdr *)(pkt->data + sizeof(*amsdu)); - len = le16_to_cpu(amsdu->byte_count); - rx_pkt_status = *(__le32 *)(pkt->data + sizeof(*amsdu) + len); - ampdu_status = iwlagn_translate_rx_status(priv, - le32_to_cpu(rx_pkt_status)); - - if ((unlikely(phy_res->cfg_phy_cnt > 20))) { - IWL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d\n", - phy_res->cfg_phy_cnt); - return 0; - } - - if (!(rx_pkt_status & RX_RES_STATUS_NO_CRC32_ERROR) || - !(rx_pkt_status & RX_RES_STATUS_NO_RXE_OVERFLOW)) { - IWL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n", - le32_to_cpu(rx_pkt_status)); - return 0; - } - - /* This will be used in several places later */ - rate_n_flags = le32_to_cpu(phy_res->rate_n_flags); - - /* rx_status carries information about the packet to mac80211 */ - rx_status.mactime = le64_to_cpu(phy_res->timestamp); - rx_status.band = (phy_res->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? - IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; - rx_status.freq = - ieee80211_channel_to_frequency(le16_to_cpu(phy_res->channel), - rx_status.band); - rx_status.rate_idx = - iwlagn_hwrate_to_mac80211_idx(rate_n_flags, rx_status.band); - rx_status.flag = 0; - - /* TSF isn't reliable. In order to allow smooth user experience, - * this W/A doesn't propagate it to the mac80211 */ - /*rx_status.flag |= RX_FLAG_MACTIME_START;*/ - - priv->ucode_beacon_time = le32_to_cpu(phy_res->beacon_time_stamp); - - /* Find max signal strength (dBm) among 3 antenna/receiver chains */ - rx_status.signal = iwlagn_calc_rssi(priv, phy_res); - - IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, TSF %llu\n", - rx_status.signal, (unsigned long long)rx_status.mactime); - - /* - * "antenna number" - * - * It seems that the antenna field in the phy flags value - * is actually a bit field. This is undefined by radiotap, - * it wants an actual antenna number but I always get "7" - * for most legacy frames I receive indicating that the - * same frame was received on all three RX chains. - * - * I think this field should be removed in favor of a - * new 802.11n radiotap field "RX chains" that is defined - * as a bitmask. - */ - rx_status.antenna = - (le16_to_cpu(phy_res->phy_flags) & RX_RES_PHY_FLAGS_ANTENNA_MSK) - >> RX_RES_PHY_FLAGS_ANTENNA_POS; - - /* set the preamble flag if appropriate */ - if (phy_res->phy_flags & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) - rx_status.flag |= RX_FLAG_SHORTPRE; - - if (phy_res->phy_flags & RX_RES_PHY_FLAGS_AGG_MSK) { - /* - * We know which subframes of an A-MPDU belong - * together since we get a single PHY response - * from the firmware for all of them - */ - rx_status.flag |= RX_FLAG_AMPDU_DETAILS; - rx_status.ampdu_reference = priv->ampdu_ref; - } - - /* Set up the HT phy flags */ - if (rate_n_flags & RATE_MCS_HT_MSK) - rx_status.flag |= RX_FLAG_HT; - if (rate_n_flags & RATE_MCS_HT40_MSK) - rx_status.flag |= RX_FLAG_40MHZ; - if (rate_n_flags & RATE_MCS_SGI_MSK) - rx_status.flag |= RX_FLAG_SHORT_GI; - if (rate_n_flags & RATE_MCS_GF_MSK) - rx_status.flag |= RX_FLAG_HT_GF; - - iwlagn_pass_packet_to_mac80211(priv, header, len, ampdu_status, - rxb, &rx_status); - return 0; -} - -static int iwlagn_rx_noa_notification(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_wipan_noa_data *new_data, *old_data; - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_wipan_noa_notification *noa_notif = (void *)pkt->data; - - /* no condition -- we're in softirq */ - old_data = rcu_dereference_protected(priv->noa_data, true); - - if (noa_notif->noa_active) { - u32 len = le16_to_cpu(noa_notif->noa_attribute.length); - u32 copylen = len; - - /* EID, len, OUI, subtype */ - len += 1 + 1 + 3 + 1; - /* P2P id, P2P length */ - len += 1 + 2; - copylen += 1 + 2; - - new_data = kmalloc(sizeof(*new_data) + len, GFP_ATOMIC); - if (new_data) { - new_data->length = len; - new_data->data[0] = WLAN_EID_VENDOR_SPECIFIC; - new_data->data[1] = len - 2; /* not counting EID, len */ - new_data->data[2] = (WLAN_OUI_WFA >> 16) & 0xff; - new_data->data[3] = (WLAN_OUI_WFA >> 8) & 0xff; - new_data->data[4] = (WLAN_OUI_WFA >> 0) & 0xff; - new_data->data[5] = WLAN_OUI_TYPE_WFA_P2P; - memcpy(&new_data->data[6], &noa_notif->noa_attribute, - copylen); - } - } else - new_data = NULL; - - rcu_assign_pointer(priv->noa_data, new_data); - - if (old_data) - kfree_rcu(old_data, rcu_head); - - return 0; -} - -/** - * iwl_setup_rx_handlers - Initialize Rx handler callbacks - * - * Setup the RX handlers for each of the reply types sent from the uCode - * to the host. - */ -void iwl_setup_rx_handlers(struct iwl_priv *priv) -{ - int (**handlers)(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); - - handlers = priv->rx_handlers; - - handlers[REPLY_ERROR] = iwlagn_rx_reply_error; - handlers[CHANNEL_SWITCH_NOTIFICATION] = iwlagn_rx_csa; - handlers[SPECTRUM_MEASURE_NOTIFICATION] = - iwlagn_rx_spectrum_measure_notif; - handlers[PM_SLEEP_NOTIFICATION] = iwlagn_rx_pm_sleep_notif; - handlers[PM_DEBUG_STATISTIC_NOTIFIC] = - iwlagn_rx_pm_debug_statistics_notif; - handlers[BEACON_NOTIFICATION] = iwlagn_rx_beacon_notif; - handlers[REPLY_ADD_STA] = iwl_add_sta_callback; - - handlers[REPLY_WIPAN_NOA_NOTIFICATION] = iwlagn_rx_noa_notification; - - /* - * The same handler is used for both the REPLY to a discrete - * statistics request from the host as well as for the periodic - * statistics notifications (after received beacons) from the uCode. - */ - handlers[REPLY_STATISTICS_CMD] = iwlagn_rx_reply_statistics; - handlers[STATISTICS_NOTIFICATION] = iwlagn_rx_statistics; - - iwl_setup_rx_scan_handlers(priv); - - handlers[CARD_STATE_NOTIFICATION] = iwlagn_rx_card_state_notif; - handlers[MISSED_BEACONS_NOTIFICATION] = - iwlagn_rx_missed_beacon_notif; - - /* Rx handlers */ - handlers[REPLY_RX_PHY_CMD] = iwlagn_rx_reply_rx_phy; - handlers[REPLY_RX_MPDU_CMD] = iwlagn_rx_reply_rx; - - /* block ack */ - handlers[REPLY_COMPRESSED_BA] = - iwlagn_rx_reply_compressed_ba; - - priv->rx_handlers[REPLY_TX] = iwlagn_rx_reply_tx; - - /* set up notification wait support */ - iwl_notification_wait_init(&priv->notif_wait); - - /* Set up BT Rx handlers */ - if (priv->cfg->bt_params) - iwlagn_bt_rx_handler_setup(priv); -} - -int iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - int err = 0; - - /* - * Do the notification wait before RX handlers so - * even if the RX handler consumes the RXB we have - * access to it in the notification wait entry. - */ - iwl_notification_wait_notify(&priv->notif_wait, pkt); - -#ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE - /* - * RX data may be forwarded to userspace in one - * of two cases: the user owns the fw through testmode or when - * the user requested to monitor the rx w/o affecting the regular flow. - * In these cases the iwl_test object will handle forwarding the rx - * data to user space. - * Note that if the ownership flag != IWL_OWNERSHIP_TM the flow - * continues. - */ - iwl_test_rx(&priv->tst, rxb); -#endif - - if (priv->ucode_owner != IWL_OWNERSHIP_TM) { - /* Based on type of command response or notification, - * handle those that need handling via function in - * rx_handlers table. See iwl_setup_rx_handlers() */ - if (priv->rx_handlers[pkt->hdr.cmd]) { - priv->rx_handlers_stats[pkt->hdr.cmd]++; - err = priv->rx_handlers[pkt->hdr.cmd] (priv, rxb, cmd); - } else { - /* No handling needed */ - IWL_DEBUG_RX(priv, "No handler needed for %s, 0x%02x\n", - iwl_dvm_get_cmd_string(pkt->hdr.cmd), - pkt->hdr.cmd); - } - } - return err; -} diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c deleted file mode 100644 index cd1ad0019185..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/rxon.c +++ /dev/null @@ -1,1575 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#include -#include "iwl-trans.h" -#include "iwl-modparams.h" -#include "dev.h" -#include "agn.h" -#include "calib.h" - -/* - * initialize rxon structure with default values from eeprom - */ -void iwl_connection_init_rx_config(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) -{ - memset(&ctx->staging, 0, sizeof(ctx->staging)); - - if (!ctx->vif) { - ctx->staging.dev_type = ctx->unused_devtype; - } else - switch (ctx->vif->type) { - case NL80211_IFTYPE_AP: - ctx->staging.dev_type = ctx->ap_devtype; - break; - - case NL80211_IFTYPE_STATION: - ctx->staging.dev_type = ctx->station_devtype; - ctx->staging.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; - break; - - case NL80211_IFTYPE_ADHOC: - ctx->staging.dev_type = ctx->ibss_devtype; - ctx->staging.flags = RXON_FLG_SHORT_PREAMBLE_MSK; - ctx->staging.filter_flags = RXON_FILTER_BCON_AWARE_MSK | - RXON_FILTER_ACCEPT_GRP_MSK; - break; - - case NL80211_IFTYPE_MONITOR: - ctx->staging.dev_type = RXON_DEV_TYPE_SNIFFER; - break; - - default: - IWL_ERR(priv, "Unsupported interface type %d\n", - ctx->vif->type); - break; - } - -#if 0 - /* TODO: Figure out when short_preamble would be set and cache from - * that */ - if (!hw_to_local(priv->hw)->short_preamble) - ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; - else - ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; -#endif - - ctx->staging.channel = - cpu_to_le16(priv->hw->conf.chandef.chan->hw_value); - priv->band = priv->hw->conf.chandef.chan->band; - - iwl_set_flags_for_band(priv, ctx, priv->band, ctx->vif); - - /* clear both MIX and PURE40 mode flag */ - ctx->staging.flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED | - RXON_FLG_CHANNEL_MODE_PURE_40); - if (ctx->vif) - memcpy(ctx->staging.node_addr, ctx->vif->addr, ETH_ALEN); - - ctx->staging.ofdm_ht_single_stream_basic_rates = 0xff; - ctx->staging.ofdm_ht_dual_stream_basic_rates = 0xff; - ctx->staging.ofdm_ht_triple_stream_basic_rates = 0xff; -} - -static int iwlagn_disable_bss(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct iwl_rxon_cmd *send) -{ - __le32 old_filter = send->filter_flags; - int ret; - - send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; - ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, - CMD_SYNC, sizeof(*send), send); - - send->filter_flags = old_filter; - - if (ret) - IWL_DEBUG_QUIET_RFKILL(priv, - "Error clearing ASSOC_MSK on BSS (%d)\n", ret); - - return ret; -} - -static int iwlagn_disable_pan(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct iwl_rxon_cmd *send) -{ - struct iwl_notification_wait disable_wait; - __le32 old_filter = send->filter_flags; - u8 old_dev_type = send->dev_type; - int ret; - static const u8 deactivate_cmd[] = { - REPLY_WIPAN_DEACTIVATION_COMPLETE - }; - - iwl_init_notification_wait(&priv->notif_wait, &disable_wait, - deactivate_cmd, ARRAY_SIZE(deactivate_cmd), - NULL, NULL); - - send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; - send->dev_type = RXON_DEV_TYPE_P2P; - ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, - CMD_SYNC, sizeof(*send), send); - - send->filter_flags = old_filter; - send->dev_type = old_dev_type; - - if (ret) { - IWL_ERR(priv, "Error disabling PAN (%d)\n", ret); - iwl_remove_notification(&priv->notif_wait, &disable_wait); - } else { - ret = iwl_wait_notification(&priv->notif_wait, - &disable_wait, HZ); - if (ret) - IWL_ERR(priv, "Timed out waiting for PAN disable\n"); - } - - return ret; -} - -static int iwlagn_disconn_pan(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct iwl_rxon_cmd *send) -{ - __le32 old_filter = send->filter_flags; - int ret; - - send->filter_flags &= ~RXON_FILTER_ASSOC_MSK; - ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, CMD_SYNC, - sizeof(*send), send); - - send->filter_flags = old_filter; - - return ret; -} - -static void iwlagn_update_qos(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) -{ - int ret; - - if (!ctx->is_active) - return; - - ctx->qos_data.def_qos_parm.qos_flags = 0; - - if (ctx->qos_data.qos_active) - ctx->qos_data.def_qos_parm.qos_flags |= - QOS_PARAM_FLG_UPDATE_EDCA_MSK; - - if (ctx->ht.enabled) - ctx->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK; - - IWL_DEBUG_INFO(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n", - ctx->qos_data.qos_active, - ctx->qos_data.def_qos_parm.qos_flags); - - ret = iwl_dvm_send_cmd_pdu(priv, ctx->qos_cmd, CMD_SYNC, - sizeof(struct iwl_qosparam_cmd), - &ctx->qos_data.def_qos_parm); - if (ret) - IWL_DEBUG_QUIET_RFKILL(priv, "Failed to update QoS\n"); -} - -static int iwlagn_update_beacon(struct iwl_priv *priv, - struct ieee80211_vif *vif) -{ - lockdep_assert_held(&priv->mutex); - - dev_kfree_skb(priv->beacon_skb); - priv->beacon_skb = ieee80211_beacon_get(priv->hw, vif); - if (!priv->beacon_skb) - return -ENOMEM; - return iwlagn_send_beacon_cmd(priv); -} - -static int iwlagn_send_rxon_assoc(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) -{ - int ret = 0; - struct iwl_rxon_assoc_cmd rxon_assoc; - const struct iwl_rxon_cmd *rxon1 = &ctx->staging; - const struct iwl_rxon_cmd *rxon2 = &ctx->active; - - if ((rxon1->flags == rxon2->flags) && - (rxon1->filter_flags == rxon2->filter_flags) && - (rxon1->cck_basic_rates == rxon2->cck_basic_rates) && - (rxon1->ofdm_ht_single_stream_basic_rates == - rxon2->ofdm_ht_single_stream_basic_rates) && - (rxon1->ofdm_ht_dual_stream_basic_rates == - rxon2->ofdm_ht_dual_stream_basic_rates) && - (rxon1->ofdm_ht_triple_stream_basic_rates == - rxon2->ofdm_ht_triple_stream_basic_rates) && - (rxon1->acquisition_data == rxon2->acquisition_data) && - (rxon1->rx_chain == rxon2->rx_chain) && - (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) { - IWL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n"); - return 0; - } - - rxon_assoc.flags = ctx->staging.flags; - rxon_assoc.filter_flags = ctx->staging.filter_flags; - rxon_assoc.ofdm_basic_rates = ctx->staging.ofdm_basic_rates; - rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates; - rxon_assoc.reserved1 = 0; - rxon_assoc.reserved2 = 0; - rxon_assoc.reserved3 = 0; - rxon_assoc.ofdm_ht_single_stream_basic_rates = - ctx->staging.ofdm_ht_single_stream_basic_rates; - rxon_assoc.ofdm_ht_dual_stream_basic_rates = - ctx->staging.ofdm_ht_dual_stream_basic_rates; - rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain; - rxon_assoc.ofdm_ht_triple_stream_basic_rates = - ctx->staging.ofdm_ht_triple_stream_basic_rates; - rxon_assoc.acquisition_data = ctx->staging.acquisition_data; - - ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_assoc_cmd, - CMD_ASYNC, sizeof(rxon_assoc), &rxon_assoc); - return ret; -} - -static u16 iwl_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) -{ - u16 new_val; - u16 beacon_factor; - - /* - * If mac80211 hasn't given us a beacon interval, program - * the default into the device (not checking this here - * would cause the adjustment below to return the maximum - * value, which may break PAN.) - */ - if (!beacon_val) - return DEFAULT_BEACON_INTERVAL; - - /* - * If the beacon interval we obtained from the peer - * is too large, we'll have to wake up more often - * (and in IBSS case, we'll beacon too much) - * - * For example, if max_beacon_val is 4096, and the - * requested beacon interval is 7000, we'll have to - * use 3500 to be able to wake up on the beacons. - * - * This could badly influence beacon detection stats. - */ - - beacon_factor = (beacon_val + max_beacon_val) / max_beacon_val; - new_val = beacon_val / beacon_factor; - - if (!new_val) - new_val = max_beacon_val; - - return new_val; -} - -static int iwl_send_rxon_timing(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) -{ - u64 tsf; - s32 interval_tm, rem; - struct ieee80211_conf *conf = NULL; - u16 beacon_int; - struct ieee80211_vif *vif = ctx->vif; - - conf = &priv->hw->conf; - - lockdep_assert_held(&priv->mutex); - - memset(&ctx->timing, 0, sizeof(struct iwl_rxon_time_cmd)); - - ctx->timing.timestamp = cpu_to_le64(priv->timestamp); - ctx->timing.listen_interval = cpu_to_le16(conf->listen_interval); - - beacon_int = vif ? vif->bss_conf.beacon_int : 0; - - /* - * TODO: For IBSS we need to get atim_window from mac80211, - * for now just always use 0 - */ - ctx->timing.atim_window = 0; - - if (ctx->ctxid == IWL_RXON_CTX_PAN && - (!ctx->vif || ctx->vif->type != NL80211_IFTYPE_STATION) && - iwl_is_associated(priv, IWL_RXON_CTX_BSS) && - priv->contexts[IWL_RXON_CTX_BSS].vif && - priv->contexts[IWL_RXON_CTX_BSS].vif->bss_conf.beacon_int) { - ctx->timing.beacon_interval = - priv->contexts[IWL_RXON_CTX_BSS].timing.beacon_interval; - beacon_int = le16_to_cpu(ctx->timing.beacon_interval); - } else if (ctx->ctxid == IWL_RXON_CTX_BSS && - iwl_is_associated(priv, IWL_RXON_CTX_PAN) && - priv->contexts[IWL_RXON_CTX_PAN].vif && - priv->contexts[IWL_RXON_CTX_PAN].vif->bss_conf.beacon_int && - (!iwl_is_associated_ctx(ctx) || !ctx->vif || - !ctx->vif->bss_conf.beacon_int)) { - ctx->timing.beacon_interval = - priv->contexts[IWL_RXON_CTX_PAN].timing.beacon_interval; - beacon_int = le16_to_cpu(ctx->timing.beacon_interval); - } else { - beacon_int = iwl_adjust_beacon_interval(beacon_int, - IWL_MAX_UCODE_BEACON_INTERVAL * TIME_UNIT); - ctx->timing.beacon_interval = cpu_to_le16(beacon_int); - } - - ctx->beacon_int = beacon_int; - - tsf = priv->timestamp; /* tsf is modifed by do_div: copy it */ - interval_tm = beacon_int * TIME_UNIT; - rem = do_div(tsf, interval_tm); - ctx->timing.beacon_init_val = cpu_to_le32(interval_tm - rem); - - ctx->timing.dtim_period = vif ? (vif->bss_conf.dtim_period ?: 1) : 1; - - IWL_DEBUG_ASSOC(priv, - "beacon interval %d beacon timer %d beacon tim %d\n", - le16_to_cpu(ctx->timing.beacon_interval), - le32_to_cpu(ctx->timing.beacon_init_val), - le16_to_cpu(ctx->timing.atim_window)); - - return iwl_dvm_send_cmd_pdu(priv, ctx->rxon_timing_cmd, - CMD_SYNC, sizeof(ctx->timing), &ctx->timing); -} - -static int iwlagn_rxon_disconn(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) -{ - int ret; - struct iwl_rxon_cmd *active = (void *)&ctx->active; - - if (ctx->ctxid == IWL_RXON_CTX_BSS) { - ret = iwlagn_disable_bss(priv, ctx, &ctx->staging); - } else { - ret = iwlagn_disable_pan(priv, ctx, &ctx->staging); - if (ret) - return ret; - if (ctx->vif) { - ret = iwl_send_rxon_timing(priv, ctx); - if (ret) { - IWL_ERR(priv, "Failed to send timing (%d)!\n", ret); - return ret; - } - ret = iwlagn_disconn_pan(priv, ctx, &ctx->staging); - } - } - if (ret) - return ret; - - /* - * Un-assoc RXON clears the station table and WEP - * keys, so we have to restore those afterwards. - */ - iwl_clear_ucode_stations(priv, ctx); - /* update -- might need P2P now */ - iwl_update_bcast_station(priv, ctx); - iwl_restore_stations(priv, ctx); - ret = iwl_restore_default_wep_keys(priv, ctx); - if (ret) { - IWL_ERR(priv, "Failed to restore WEP keys (%d)\n", ret); - return ret; - } - - memcpy(active, &ctx->staging, sizeof(*active)); - return 0; -} - -static int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) -{ - int ret; - s8 prev_tx_power; - bool defer; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - - if (priv->calib_disabled & IWL_TX_POWER_CALIB_DISABLED) - return 0; - - lockdep_assert_held(&priv->mutex); - - if (priv->tx_power_user_lmt == tx_power && !force) - return 0; - - if (tx_power < IWLAGN_TX_POWER_TARGET_POWER_MIN) { - IWL_WARN(priv, - "Requested user TXPOWER %d below lower limit %d.\n", - tx_power, - IWLAGN_TX_POWER_TARGET_POWER_MIN); - return -EINVAL; - } - - if (tx_power > DIV_ROUND_UP(priv->nvm_data->max_tx_pwr_half_dbm, 2)) { - IWL_WARN(priv, - "Requested user TXPOWER %d above upper limit %d.\n", - tx_power, priv->nvm_data->max_tx_pwr_half_dbm); - return -EINVAL; - } - - if (!iwl_is_ready_rf(priv)) - return -EIO; - - /* scan complete and commit_rxon use tx_power_next value, - * it always need to be updated for newest request */ - priv->tx_power_next = tx_power; - - /* do not set tx power when scanning or channel changing */ - defer = test_bit(STATUS_SCANNING, &priv->status) || - memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging)); - if (defer && !force) { - IWL_DEBUG_INFO(priv, "Deferring tx power set\n"); - return 0; - } - - prev_tx_power = priv->tx_power_user_lmt; - priv->tx_power_user_lmt = tx_power; - - ret = iwlagn_send_tx_power(priv); - - /* if fail to set tx_power, restore the orig. tx power */ - if (ret) { - priv->tx_power_user_lmt = prev_tx_power; - priv->tx_power_next = prev_tx_power; - } - return ret; -} - -static int iwlagn_rxon_connect(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) -{ - int ret; - struct iwl_rxon_cmd *active = (void *)&ctx->active; - - /* RXON timing must be before associated RXON */ - if (ctx->ctxid == IWL_RXON_CTX_BSS) { - ret = iwl_send_rxon_timing(priv, ctx); - if (ret) { - IWL_ERR(priv, "Failed to send timing (%d)!\n", ret); - return ret; - } - } - /* QoS info may be cleared by previous un-assoc RXON */ - iwlagn_update_qos(priv, ctx); - - /* - * We'll run into this code path when beaconing is - * enabled, but then we also need to send the beacon - * to the device. - */ - if (ctx->vif && (ctx->vif->type == NL80211_IFTYPE_AP)) { - ret = iwlagn_update_beacon(priv, ctx->vif); - if (ret) { - IWL_ERR(priv, - "Error sending required beacon (%d)!\n", - ret); - return ret; - } - } - - priv->start_calib = 0; - /* - * Apply the new configuration. - * - * Associated RXON doesn't clear the station table in uCode, - * so we don't need to restore stations etc. after this. - */ - ret = iwl_dvm_send_cmd_pdu(priv, ctx->rxon_cmd, CMD_SYNC, - sizeof(struct iwl_rxon_cmd), &ctx->staging); - if (ret) { - IWL_ERR(priv, "Error setting new RXON (%d)\n", ret); - return ret; - } - memcpy(active, &ctx->staging, sizeof(*active)); - - /* IBSS beacon needs to be sent after setting assoc */ - if (ctx->vif && (ctx->vif->type == NL80211_IFTYPE_ADHOC)) - if (iwlagn_update_beacon(priv, ctx->vif)) - IWL_ERR(priv, "Error sending IBSS beacon\n"); - iwl_init_sensitivity(priv); - - /* - * If we issue a new RXON command which required a tune then - * we must send a new TXPOWER command or we won't be able to - * Tx any frames. - * - * It's expected we set power here if channel is changing. - */ - ret = iwl_set_tx_power(priv, priv->tx_power_next, true); - if (ret) { - IWL_ERR(priv, "Error sending TX power (%d)\n", ret); - return ret; - } - - if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION && - priv->cfg->ht_params && priv->cfg->ht_params->smps_mode) - ieee80211_request_smps(ctx->vif, - priv->cfg->ht_params->smps_mode); - - return 0; -} - -int iwlagn_set_pan_params(struct iwl_priv *priv) -{ - struct iwl_wipan_params_cmd cmd; - struct iwl_rxon_context *ctx_bss, *ctx_pan; - int slot0 = 300, slot1 = 0; - int ret; - - if (priv->valid_contexts == BIT(IWL_RXON_CTX_BSS)) - return 0; - - BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); - - lockdep_assert_held(&priv->mutex); - - ctx_bss = &priv->contexts[IWL_RXON_CTX_BSS]; - ctx_pan = &priv->contexts[IWL_RXON_CTX_PAN]; - - /* - * If the PAN context is inactive, then we don't need - * to update the PAN parameters, the last thing we'll - * have done before it goes inactive is making the PAN - * parameters be WLAN-only. - */ - if (!ctx_pan->is_active) - return 0; - - memset(&cmd, 0, sizeof(cmd)); - - /* only 2 slots are currently allowed */ - cmd.num_slots = 2; - - cmd.slots[0].type = 0; /* BSS */ - cmd.slots[1].type = 1; /* PAN */ - - if (priv->hw_roc_setup) { - /* both contexts must be used for this to happen */ - slot1 = IWL_MIN_SLOT_TIME; - slot0 = 3000; - } else if (ctx_bss->vif && ctx_pan->vif) { - int bcnint = ctx_pan->beacon_int; - int dtim = ctx_pan->vif->bss_conf.dtim_period ?: 1; - - /* should be set, but seems unused?? */ - cmd.flags |= cpu_to_le16(IWL_WIPAN_PARAMS_FLG_SLOTTED_MODE); - - if (ctx_pan->vif->type == NL80211_IFTYPE_AP && - bcnint && - bcnint != ctx_bss->beacon_int) { - IWL_ERR(priv, - "beacon intervals don't match (%d, %d)\n", - ctx_bss->beacon_int, ctx_pan->beacon_int); - } else - bcnint = max_t(int, bcnint, - ctx_bss->beacon_int); - if (!bcnint) - bcnint = DEFAULT_BEACON_INTERVAL; - slot0 = bcnint / 2; - slot1 = bcnint - slot0; - - if (test_bit(STATUS_SCAN_HW, &priv->status) || - (!ctx_bss->vif->bss_conf.idle && - !ctx_bss->vif->bss_conf.assoc)) { - slot0 = dtim * bcnint * 3 - IWL_MIN_SLOT_TIME; - slot1 = IWL_MIN_SLOT_TIME; - } else if (!ctx_pan->vif->bss_conf.idle && - !ctx_pan->vif->bss_conf.assoc) { - slot1 = dtim * bcnint * 3 - IWL_MIN_SLOT_TIME; - slot0 = IWL_MIN_SLOT_TIME; - } - } else if (ctx_pan->vif) { - slot0 = 0; - slot1 = max_t(int, 1, ctx_pan->vif->bss_conf.dtim_period) * - ctx_pan->beacon_int; - slot1 = max_t(int, DEFAULT_BEACON_INTERVAL, slot1); - - if (test_bit(STATUS_SCAN_HW, &priv->status)) { - slot0 = slot1 * 3 - IWL_MIN_SLOT_TIME; - slot1 = IWL_MIN_SLOT_TIME; - } - } - - cmd.slots[0].width = cpu_to_le16(slot0); - cmd.slots[1].width = cpu_to_le16(slot1); - - ret = iwl_dvm_send_cmd_pdu(priv, REPLY_WIPAN_PARAMS, CMD_SYNC, - sizeof(cmd), &cmd); - if (ret) - IWL_ERR(priv, "Error setting PAN parameters (%d)\n", ret); - - return ret; -} - -static void _iwl_set_rxon_ht(struct iwl_priv *priv, - struct iwl_ht_config *ht_conf, - struct iwl_rxon_context *ctx) -{ - struct iwl_rxon_cmd *rxon = &ctx->staging; - - if (!ctx->ht.enabled) { - rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | - RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK | - RXON_FLG_HT40_PROT_MSK | - RXON_FLG_HT_PROT_MSK); - return; - } - - /* FIXME: if the definition of ht.protection changed, the "translation" - * will be needed for rxon->flags - */ - rxon->flags |= cpu_to_le32(ctx->ht.protection << - RXON_FLG_HT_OPERATING_MODE_POS); - - /* Set up channel bandwidth: - * 20 MHz only, 20/40 mixed or pure 40 if ht40 ok */ - /* clear the HT channel mode before set the mode */ - rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | - RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); - if (iwl_is_ht40_tx_allowed(priv, ctx, NULL)) { - /* pure ht40 */ - if (ctx->ht.protection == - IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) { - rxon->flags |= RXON_FLG_CHANNEL_MODE_PURE_40; - /* - * Note: control channel is opposite of extension - * channel - */ - switch (ctx->ht.extension_chan_offset) { - case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: - rxon->flags &= - ~RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK; - break; - case IEEE80211_HT_PARAM_CHA_SEC_BELOW: - rxon->flags |= - RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK; - break; - } - } else { - /* - * Note: control channel is opposite of extension - * channel - */ - switch (ctx->ht.extension_chan_offset) { - case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: - rxon->flags &= - ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); - rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED; - break; - case IEEE80211_HT_PARAM_CHA_SEC_BELOW: - rxon->flags |= RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK; - rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED; - break; - case IEEE80211_HT_PARAM_CHA_SEC_NONE: - default: - /* - * channel location only valid if in Mixed - * mode - */ - IWL_ERR(priv, - "invalid extension channel offset\n"); - break; - } - } - } else { - rxon->flags |= RXON_FLG_CHANNEL_MODE_LEGACY; - } - - iwlagn_set_rxon_chain(priv, ctx); - - IWL_DEBUG_ASSOC(priv, "rxon flags 0x%X operation mode :0x%X " - "extension channel offset 0x%x\n", - le32_to_cpu(rxon->flags), ctx->ht.protection, - ctx->ht.extension_chan_offset); -} - -void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf) -{ - struct iwl_rxon_context *ctx; - - for_each_context(priv, ctx) - _iwl_set_rxon_ht(priv, ht_conf, ctx); -} - -/** - * iwl_set_rxon_channel - Set the band and channel values in staging RXON - * @ch: requested channel as a pointer to struct ieee80211_channel - - * NOTE: Does not commit to the hardware; it sets appropriate bit fields - * in the staging RXON flag structure based on the ch->band - */ -void iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch, - struct iwl_rxon_context *ctx) -{ - enum ieee80211_band band = ch->band; - u16 channel = ch->hw_value; - - if ((le16_to_cpu(ctx->staging.channel) == channel) && - (priv->band == band)) - return; - - ctx->staging.channel = cpu_to_le16(channel); - if (band == IEEE80211_BAND_5GHZ) - ctx->staging.flags &= ~RXON_FLG_BAND_24G_MSK; - else - ctx->staging.flags |= RXON_FLG_BAND_24G_MSK; - - priv->band = band; - - IWL_DEBUG_INFO(priv, "Staging channel set to %d [%d]\n", channel, band); - -} - -void iwl_set_flags_for_band(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - enum ieee80211_band band, - struct ieee80211_vif *vif) -{ - if (band == IEEE80211_BAND_5GHZ) { - ctx->staging.flags &= - ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK - | RXON_FLG_CCK_MSK); - ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; - } else { - /* Copied from iwl_post_associate() */ - if (vif && vif->bss_conf.use_short_slot) - ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; - else - ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; - - ctx->staging.flags |= RXON_FLG_BAND_24G_MSK; - ctx->staging.flags |= RXON_FLG_AUTO_DETECT_MSK; - ctx->staging.flags &= ~RXON_FLG_CCK_MSK; - } -} - -static void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, int hw_decrypt) -{ - struct iwl_rxon_cmd *rxon = &ctx->staging; - - if (hw_decrypt) - rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; - else - rxon->filter_flags |= RXON_FILTER_DIS_DECRYPT_MSK; - -} - -/* validate RXON structure is valid */ -static int iwl_check_rxon_cmd(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) -{ - struct iwl_rxon_cmd *rxon = &ctx->staging; - u32 errors = 0; - - if (rxon->flags & RXON_FLG_BAND_24G_MSK) { - if (rxon->flags & RXON_FLG_TGJ_NARROW_BAND_MSK) { - IWL_WARN(priv, "check 2.4G: wrong narrow\n"); - errors |= BIT(0); - } - if (rxon->flags & RXON_FLG_RADAR_DETECT_MSK) { - IWL_WARN(priv, "check 2.4G: wrong radar\n"); - errors |= BIT(1); - } - } else { - if (!(rxon->flags & RXON_FLG_SHORT_SLOT_MSK)) { - IWL_WARN(priv, "check 5.2G: not short slot!\n"); - errors |= BIT(2); - } - if (rxon->flags & RXON_FLG_CCK_MSK) { - IWL_WARN(priv, "check 5.2G: CCK!\n"); - errors |= BIT(3); - } - } - if ((rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1) { - IWL_WARN(priv, "mac/bssid mcast!\n"); - errors |= BIT(4); - } - - /* make sure basic rates 6Mbps and 1Mbps are supported */ - if ((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0 && - (rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0) { - IWL_WARN(priv, "neither 1 nor 6 are basic\n"); - errors |= BIT(5); - } - - if (le16_to_cpu(rxon->assoc_id) > 2007) { - IWL_WARN(priv, "aid > 2007\n"); - errors |= BIT(6); - } - - if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) - == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK)) { - IWL_WARN(priv, "CCK and short slot\n"); - errors |= BIT(7); - } - - if ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) - == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK)) { - IWL_WARN(priv, "CCK and auto detect"); - errors |= BIT(8); - } - - if ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK | - RXON_FLG_TGG_PROTECT_MSK)) == - RXON_FLG_TGG_PROTECT_MSK) { - IWL_WARN(priv, "TGg but no auto-detect\n"); - errors |= BIT(9); - } - - if (rxon->channel == 0) { - IWL_WARN(priv, "zero channel is invalid\n"); - errors |= BIT(10); - } - - WARN(errors, "Invalid RXON (%#x), channel %d", - errors, le16_to_cpu(rxon->channel)); - - return errors ? -EINVAL : 0; -} - -/** - * iwl_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed - * @priv: staging_rxon is compared to active_rxon - * - * If the RXON structure is changing enough to require a new tune, - * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that - * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. - */ -static int iwl_full_rxon_required(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) -{ - const struct iwl_rxon_cmd *staging = &ctx->staging; - const struct iwl_rxon_cmd *active = &ctx->active; - -#define CHK(cond) \ - if ((cond)) { \ - IWL_DEBUG_INFO(priv, "need full RXON - " #cond "\n"); \ - return 1; \ - } - -#define CHK_NEQ(c1, c2) \ - if ((c1) != (c2)) { \ - IWL_DEBUG_INFO(priv, "need full RXON - " \ - #c1 " != " #c2 " - %d != %d\n", \ - (c1), (c2)); \ - return 1; \ - } - - /* These items are only settable from the full RXON command */ - CHK(!iwl_is_associated_ctx(ctx)); - CHK(!ether_addr_equal(staging->bssid_addr, active->bssid_addr)); - CHK(!ether_addr_equal(staging->node_addr, active->node_addr)); - CHK(!ether_addr_equal(staging->wlap_bssid_addr, - active->wlap_bssid_addr)); - CHK_NEQ(staging->dev_type, active->dev_type); - CHK_NEQ(staging->channel, active->channel); - CHK_NEQ(staging->air_propagation, active->air_propagation); - CHK_NEQ(staging->ofdm_ht_single_stream_basic_rates, - active->ofdm_ht_single_stream_basic_rates); - CHK_NEQ(staging->ofdm_ht_dual_stream_basic_rates, - active->ofdm_ht_dual_stream_basic_rates); - CHK_NEQ(staging->ofdm_ht_triple_stream_basic_rates, - active->ofdm_ht_triple_stream_basic_rates); - CHK_NEQ(staging->assoc_id, active->assoc_id); - - /* flags, filter_flags, ofdm_basic_rates, and cck_basic_rates can - * be updated with the RXON_ASSOC command -- however only some - * flag transitions are allowed using RXON_ASSOC */ - - /* Check if we are not switching bands */ - CHK_NEQ(staging->flags & RXON_FLG_BAND_24G_MSK, - active->flags & RXON_FLG_BAND_24G_MSK); - - /* Check if we are switching association toggle */ - CHK_NEQ(staging->filter_flags & RXON_FILTER_ASSOC_MSK, - active->filter_flags & RXON_FILTER_ASSOC_MSK); - -#undef CHK -#undef CHK_NEQ - - return 0; -} - -#ifdef CONFIG_IWLWIFI_DEBUG -void iwl_print_rx_config_cmd(struct iwl_priv *priv, - enum iwl_rxon_context_id ctxid) -{ - struct iwl_rxon_context *ctx = &priv->contexts[ctxid]; - struct iwl_rxon_cmd *rxon = &ctx->staging; - - IWL_DEBUG_RADIO(priv, "RX CONFIG:\n"); - iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); - IWL_DEBUG_RADIO(priv, "u16 channel: 0x%x\n", - le16_to_cpu(rxon->channel)); - IWL_DEBUG_RADIO(priv, "u32 flags: 0x%08X\n", - le32_to_cpu(rxon->flags)); - IWL_DEBUG_RADIO(priv, "u32 filter_flags: 0x%08x\n", - le32_to_cpu(rxon->filter_flags)); - IWL_DEBUG_RADIO(priv, "u8 dev_type: 0x%x\n", rxon->dev_type); - IWL_DEBUG_RADIO(priv, "u8 ofdm_basic_rates: 0x%02x\n", - rxon->ofdm_basic_rates); - IWL_DEBUG_RADIO(priv, "u8 cck_basic_rates: 0x%02x\n", - rxon->cck_basic_rates); - IWL_DEBUG_RADIO(priv, "u8[6] node_addr: %pM\n", rxon->node_addr); - IWL_DEBUG_RADIO(priv, "u8[6] bssid_addr: %pM\n", rxon->bssid_addr); - IWL_DEBUG_RADIO(priv, "u16 assoc_id: 0x%x\n", - le16_to_cpu(rxon->assoc_id)); -} -#endif - -static void iwl_calc_basic_rates(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) -{ - int lowest_present_ofdm = 100; - int lowest_present_cck = 100; - u8 cck = 0; - u8 ofdm = 0; - - if (ctx->vif) { - struct ieee80211_supported_band *sband; - unsigned long basic = ctx->vif->bss_conf.basic_rates; - int i; - - sband = priv->hw->wiphy->bands[priv->hw->conf.chandef.chan->band]; - - for_each_set_bit(i, &basic, BITS_PER_LONG) { - int hw = sband->bitrates[i].hw_value; - if (hw >= IWL_FIRST_OFDM_RATE) { - ofdm |= BIT(hw - IWL_FIRST_OFDM_RATE); - if (lowest_present_ofdm > hw) - lowest_present_ofdm = hw; - } else { - BUILD_BUG_ON(IWL_FIRST_CCK_RATE != 0); - - cck |= BIT(hw); - if (lowest_present_cck > hw) - lowest_present_cck = hw; - } - } - } - - /* - * Now we've got the basic rates as bitmaps in the ofdm and cck - * variables. This isn't sufficient though, as there might not - * be all the right rates in the bitmap. E.g. if the only basic - * rates are 5.5 Mbps and 11 Mbps, we still need to add 1 Mbps - * and 6 Mbps because the 802.11-2007 standard says in 9.6: - * - * [...] a STA responding to a received frame shall transmit - * its Control Response frame [...] at the highest rate in the - * BSSBasicRateSet parameter that is less than or equal to the - * rate of the immediately previous frame in the frame exchange - * sequence ([...]) and that is of the same modulation class - * ([...]) as the received frame. If no rate contained in the - * BSSBasicRateSet parameter meets these conditions, then the - * control frame sent in response to a received frame shall be - * transmitted at the highest mandatory rate of the PHY that is - * less than or equal to the rate of the received frame, and - * that is of the same modulation class as the received frame. - * - * As a consequence, we need to add all mandatory rates that are - * lower than all of the basic rates to these bitmaps. - */ - - if (IWL_RATE_24M_INDEX < lowest_present_ofdm) - ofdm |= IWL_RATE_24M_MASK >> IWL_FIRST_OFDM_RATE; - if (IWL_RATE_12M_INDEX < lowest_present_ofdm) - ofdm |= IWL_RATE_12M_MASK >> IWL_FIRST_OFDM_RATE; - /* 6M already there or needed so always add */ - ofdm |= IWL_RATE_6M_MASK >> IWL_FIRST_OFDM_RATE; - - /* - * CCK is a bit more complex with DSSS vs. HR/DSSS vs. ERP. - * Note, however: - * - if no CCK rates are basic, it must be ERP since there must - * be some basic rates at all, so they're OFDM => ERP PHY - * (or we're in 5 GHz, and the cck bitmap will never be used) - * - if 11M is a basic rate, it must be ERP as well, so add 5.5M - * - if 5.5M is basic, 1M and 2M are mandatory - * - if 2M is basic, 1M is mandatory - * - if 1M is basic, that's the only valid ACK rate. - * As a consequence, it's not as complicated as it sounds, just add - * any lower rates to the ACK rate bitmap. - */ - if (IWL_RATE_11M_INDEX < lowest_present_cck) - cck |= IWL_RATE_11M_MASK >> IWL_FIRST_CCK_RATE; - if (IWL_RATE_5M_INDEX < lowest_present_cck) - cck |= IWL_RATE_5M_MASK >> IWL_FIRST_CCK_RATE; - if (IWL_RATE_2M_INDEX < lowest_present_cck) - cck |= IWL_RATE_2M_MASK >> IWL_FIRST_CCK_RATE; - /* 1M already there or needed so always add */ - cck |= IWL_RATE_1M_MASK >> IWL_FIRST_CCK_RATE; - - IWL_DEBUG_RATE(priv, "Set basic rates cck:0x%.2x ofdm:0x%.2x\n", - cck, ofdm); - - /* "basic_rates" is a misnomer here -- should be called ACK rates */ - ctx->staging.cck_basic_rates = cck; - ctx->staging.ofdm_basic_rates = ofdm; -} - -/** - * iwlagn_commit_rxon - commit staging_rxon to hardware - * - * The RXON command in staging_rxon is committed to the hardware and - * the active_rxon structure is updated with the new data. This - * function correctly transitions out of the RXON_ASSOC_MSK state if - * a HW tune is required based on the RXON structure changes. - * - * The connect/disconnect flow should be as the following: - * - * 1. make sure send RXON command with association bit unset if not connect - * this should include the channel and the band for the candidate - * to be connected to - * 2. Add Station before RXON association with the AP - * 3. RXON_timing has to send before RXON for connection - * 4. full RXON command - associated bit set - * 5. use RXON_ASSOC command to update any flags changes - */ -int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) -{ - /* cast away the const for active_rxon in this function */ - struct iwl_rxon_cmd *active = (void *)&ctx->active; - bool new_assoc = !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK); - int ret; - - lockdep_assert_held(&priv->mutex); - - if (!iwl_is_alive(priv)) - return -EBUSY; - - /* This function hardcodes a bunch of dual-mode assumptions */ - BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); - - if (!ctx->is_active) - return 0; - - /* always get timestamp with Rx frame */ - ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK; - - /* recalculate basic rates */ - iwl_calc_basic_rates(priv, ctx); - - /* - * force CTS-to-self frames protection if RTS-CTS is not preferred - * one aggregation protection method - */ - if (!priv->hw_params.use_rts_for_aggregation) - ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; - - if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || - !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) - ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; - else - ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; - - iwl_print_rx_config_cmd(priv, ctx->ctxid); - ret = iwl_check_rxon_cmd(priv, ctx); - if (ret) { - IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); - return -EINVAL; - } - - /* - * receive commit_rxon request - * abort any previous channel switch if still in process - */ - if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) && - (priv->switch_channel != ctx->staging.channel)) { - IWL_DEBUG_11H(priv, "abort channel switch on %d\n", - le16_to_cpu(priv->switch_channel)); - iwl_chswitch_done(priv, false); - } - - /* - * If we don't need to send a full RXON, we can use - * iwl_rxon_assoc_cmd which is used to reconfigure filter - * and other flags for the current radio configuration. - */ - if (!iwl_full_rxon_required(priv, ctx)) { - ret = iwlagn_send_rxon_assoc(priv, ctx); - if (ret) { - IWL_ERR(priv, "Error setting RXON_ASSOC (%d)\n", ret); - return ret; - } - - memcpy(active, &ctx->staging, sizeof(*active)); - /* - * We do not commit tx power settings while channel changing, - * do it now if after settings changed. - */ - iwl_set_tx_power(priv, priv->tx_power_next, false); - - /* make sure we are in the right PS state */ - iwl_power_update_mode(priv, true); - - return 0; - } - - iwl_set_rxon_hwcrypto(priv, ctx, !iwlwifi_mod_params.sw_crypto); - - IWL_DEBUG_INFO(priv, - "Going to commit RXON\n" - " * with%s RXON_FILTER_ASSOC_MSK\n" - " * channel = %d\n" - " * bssid = %pM\n", - (new_assoc ? "" : "out"), - le16_to_cpu(ctx->staging.channel), - ctx->staging.bssid_addr); - - /* - * Always clear associated first, but with the correct config. - * This is required as for example station addition for the - * AP station must be done after the BSSID is set to correctly - * set up filters in the device. - */ - ret = iwlagn_rxon_disconn(priv, ctx); - if (ret) - return ret; - - ret = iwlagn_set_pan_params(priv); - if (ret) - return ret; - - if (new_assoc) - return iwlagn_rxon_connect(priv, ctx); - - return 0; -} - -void iwlagn_config_ht40(struct ieee80211_conf *conf, - struct iwl_rxon_context *ctx) -{ - if (conf_is_ht40_minus(conf)) { - ctx->ht.extension_chan_offset = - IEEE80211_HT_PARAM_CHA_SEC_BELOW; - ctx->ht.is_40mhz = true; - } else if (conf_is_ht40_plus(conf)) { - ctx->ht.extension_chan_offset = - IEEE80211_HT_PARAM_CHA_SEC_ABOVE; - ctx->ht.is_40mhz = true; - } else { - ctx->ht.extension_chan_offset = - IEEE80211_HT_PARAM_CHA_SEC_NONE; - ctx->ht.is_40mhz = false; - } -} - -int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_rxon_context *ctx; - struct ieee80211_conf *conf = &hw->conf; - struct ieee80211_channel *channel = conf->chandef.chan; - int ret = 0; - - IWL_DEBUG_MAC80211(priv, "enter: changed %#x\n", changed); - - mutex_lock(&priv->mutex); - - if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) { - IWL_DEBUG_MAC80211(priv, "leave - scanning\n"); - goto out; - } - - if (!iwl_is_ready(priv)) { - IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); - goto out; - } - - if (changed & (IEEE80211_CONF_CHANGE_SMPS | - IEEE80211_CONF_CHANGE_CHANNEL)) { - /* mac80211 uses static for non-HT which is what we want */ - priv->current_ht_config.smps = conf->smps_mode; - - /* - * Recalculate chain counts. - * - * If monitor mode is enabled then mac80211 will - * set up the SM PS mode to OFF if an HT channel is - * configured. - */ - for_each_context(priv, ctx) - iwlagn_set_rxon_chain(priv, ctx); - } - - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { - for_each_context(priv, ctx) { - /* Configure HT40 channels */ - if (ctx->ht.enabled != conf_is_ht(conf)) - ctx->ht.enabled = conf_is_ht(conf); - - if (ctx->ht.enabled) { - /* if HT40 is used, it should not change - * after associated except channel switch */ - if (!ctx->ht.is_40mhz || - !iwl_is_associated_ctx(ctx)) - iwlagn_config_ht40(conf, ctx); - } else - ctx->ht.is_40mhz = false; - - /* - * Default to no protection. Protection mode will - * later be set from BSS config in iwl_ht_conf - */ - ctx->ht.protection = IEEE80211_HT_OP_MODE_PROTECTION_NONE; - - /* if we are switching from ht to 2.4 clear flags - * from any ht related info since 2.4 does not - * support ht */ - if (le16_to_cpu(ctx->staging.channel) != - channel->hw_value) - ctx->staging.flags = 0; - - iwl_set_rxon_channel(priv, channel, ctx); - iwl_set_rxon_ht(priv, &priv->current_ht_config); - - iwl_set_flags_for_band(priv, ctx, channel->band, - ctx->vif); - } - - iwl_update_bcast_stations(priv); - } - - if (changed & (IEEE80211_CONF_CHANGE_PS | - IEEE80211_CONF_CHANGE_IDLE)) { - ret = iwl_power_update_mode(priv, false); - if (ret) - IWL_DEBUG_MAC80211(priv, "Error setting sleep level\n"); - } - - if (changed & IEEE80211_CONF_CHANGE_POWER) { - IWL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n", - priv->tx_power_user_lmt, conf->power_level); - - iwl_set_tx_power(priv, conf->power_level, false); - } - - for_each_context(priv, ctx) { - if (!memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) - continue; - iwlagn_commit_rxon(priv, ctx); - } - out: - mutex_unlock(&priv->mutex); - IWL_DEBUG_MAC80211(priv, "leave\n"); - - return ret; -} - -static void iwlagn_check_needed_chains(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct ieee80211_bss_conf *bss_conf) -{ - struct ieee80211_vif *vif = ctx->vif; - struct iwl_rxon_context *tmp; - struct ieee80211_sta *sta; - struct iwl_ht_config *ht_conf = &priv->current_ht_config; - struct ieee80211_sta_ht_cap *ht_cap; - bool need_multiple; - - lockdep_assert_held(&priv->mutex); - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - rcu_read_lock(); - sta = ieee80211_find_sta(vif, bss_conf->bssid); - if (!sta) { - /* - * If at all, this can only happen through a race - * when the AP disconnects us while we're still - * setting up the connection, in that case mac80211 - * will soon tell us about that. - */ - need_multiple = false; - rcu_read_unlock(); - break; - } - - ht_cap = &sta->ht_cap; - - need_multiple = true; - - /* - * If the peer advertises no support for receiving 2 and 3 - * stream MCS rates, it can't be transmitting them either. - */ - if (ht_cap->mcs.rx_mask[1] == 0 && - ht_cap->mcs.rx_mask[2] == 0) { - need_multiple = false; - } else if (!(ht_cap->mcs.tx_params & - IEEE80211_HT_MCS_TX_DEFINED)) { - /* If it can't TX MCS at all ... */ - need_multiple = false; - } else if (ht_cap->mcs.tx_params & - IEEE80211_HT_MCS_TX_RX_DIFF) { - int maxstreams; - - /* - * But if it can receive them, it might still not - * be able to transmit them, which is what we need - * to check here -- so check the number of streams - * it advertises for TX (if different from RX). - */ - - maxstreams = (ht_cap->mcs.tx_params & - IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK); - maxstreams >>= - IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT; - maxstreams += 1; - - if (maxstreams <= 1) - need_multiple = false; - } - - rcu_read_unlock(); - break; - case NL80211_IFTYPE_ADHOC: - /* currently */ - need_multiple = false; - break; - default: - /* only AP really */ - need_multiple = true; - break; - } - - ctx->ht_need_multiple_chains = need_multiple; - - if (!need_multiple) { - /* check all contexts */ - for_each_context(priv, tmp) { - if (!tmp->vif) - continue; - if (tmp->ht_need_multiple_chains) { - need_multiple = true; - break; - } - } - } - - ht_conf->single_chain_sufficient = !need_multiple; -} - -static void iwlagn_chain_noise_reset(struct iwl_priv *priv) -{ - struct iwl_chain_noise_data *data = &priv->chain_noise_data; - int ret; - - if (priv->calib_disabled & IWL_CHAIN_NOISE_CALIB_DISABLED) - return; - - if ((data->state == IWL_CHAIN_NOISE_ALIVE) && - iwl_is_any_associated(priv)) { - struct iwl_calib_chain_noise_reset_cmd cmd; - - /* clear data for chain noise calibration algorithm */ - data->chain_noise_a = 0; - data->chain_noise_b = 0; - data->chain_noise_c = 0; - data->chain_signal_a = 0; - data->chain_signal_b = 0; - data->chain_signal_c = 0; - data->beacon_count = 0; - - memset(&cmd, 0, sizeof(cmd)); - iwl_set_calib_hdr(&cmd.hdr, - priv->phy_calib_chain_noise_reset_cmd); - ret = iwl_dvm_send_cmd_pdu(priv, - REPLY_PHY_CALIBRATION_CMD, - CMD_SYNC, sizeof(cmd), &cmd); - if (ret) - IWL_ERR(priv, - "Could not send REPLY_PHY_CALIBRATION_CMD\n"); - data->state = IWL_CHAIN_NOISE_ACCUMULATE; - IWL_DEBUG_CALIB(priv, "Run chain_noise_calibrate\n"); - } -} - -void iwlagn_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changes) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); - int ret; - bool force = false; - - mutex_lock(&priv->mutex); - - if (changes & BSS_CHANGED_IDLE && bss_conf->idle) { - /* - * If we go idle, then clearly no "passive-no-rx" - * workaround is needed any more, this is a reset. - */ - iwlagn_lift_passive_no_rx(priv); - } - - if (unlikely(!iwl_is_ready(priv))) { - IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); - mutex_unlock(&priv->mutex); - return; - } - - if (unlikely(!ctx->vif)) { - IWL_DEBUG_MAC80211(priv, "leave - vif is NULL\n"); - mutex_unlock(&priv->mutex); - return; - } - - if (changes & BSS_CHANGED_BEACON_INT) - force = true; - - if (changes & BSS_CHANGED_QOS) { - ctx->qos_data.qos_active = bss_conf->qos; - iwlagn_update_qos(priv, ctx); - } - - ctx->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid); - if (vif->bss_conf.use_short_preamble) - ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; - else - ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; - - if (changes & BSS_CHANGED_ASSOC) { - if (bss_conf->assoc) { - priv->timestamp = bss_conf->sync_tsf; - ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - } else { - ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - - if (ctx->ctxid == IWL_RXON_CTX_BSS) - priv->have_rekey_data = false; - } - - iwlagn_bt_coex_rssi_monitor(priv); - } - - if (ctx->ht.enabled) { - ctx->ht.protection = bss_conf->ht_operation_mode & - IEEE80211_HT_OP_MODE_PROTECTION; - ctx->ht.non_gf_sta_present = !!(bss_conf->ht_operation_mode & - IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); - iwlagn_check_needed_chains(priv, ctx, bss_conf); - iwl_set_rxon_ht(priv, &priv->current_ht_config); - } - - iwlagn_set_rxon_chain(priv, ctx); - - if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ)) - ctx->staging.flags |= RXON_FLG_TGG_PROTECT_MSK; - else - ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; - - if (bss_conf->use_cts_prot) - ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; - else - ctx->staging.flags &= ~RXON_FLG_SELF_CTS_EN; - - memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); - - if (vif->type == NL80211_IFTYPE_AP || - vif->type == NL80211_IFTYPE_ADHOC) { - if (vif->bss_conf.enable_beacon) { - ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; - priv->beacon_ctx = ctx; - } else { - ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; - priv->beacon_ctx = NULL; - } - } - - /* - * If the ucode decides to do beacon filtering before - * association, it will lose beacons that are needed - * before sending frames out on passive channels. This - * causes association failures on those channels. Enable - * receiving beacons in such cases. - */ - - if (vif->type == NL80211_IFTYPE_STATION) { - if (!bss_conf->assoc) - ctx->staging.filter_flags |= RXON_FILTER_BCON_AWARE_MSK; - else - ctx->staging.filter_flags &= - ~RXON_FILTER_BCON_AWARE_MSK; - } - - if (force || memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) - iwlagn_commit_rxon(priv, ctx); - - if (changes & BSS_CHANGED_ASSOC && bss_conf->assoc) { - /* - * The chain noise calibration will enable PM upon - * completion. If calibration has already been run - * then we need to enable power management here. - */ - if (priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE) - iwl_power_update_mode(priv, false); - - /* Enable RX differential gain and sensitivity calibrations */ - iwlagn_chain_noise_reset(priv); - priv->start_calib = 1; - } - - if (changes & BSS_CHANGED_IBSS) { - ret = iwlagn_manage_ibss_station(priv, vif, - bss_conf->ibss_joined); - if (ret) - IWL_ERR(priv, "failed to %s IBSS station %pM\n", - bss_conf->ibss_joined ? "add" : "remove", - bss_conf->bssid); - } - - if (changes & BSS_CHANGED_BEACON && priv->beacon_ctx == ctx) { - if (iwlagn_update_beacon(priv, vif)) - IWL_ERR(priv, "Error updating beacon\n"); - } - - mutex_unlock(&priv->mutex); -} - -void iwlagn_post_scan(struct iwl_priv *priv) -{ - struct iwl_rxon_context *ctx; - - /* - * We do not commit power settings while scan is pending, - * do it now if the settings changed. - */ - iwl_power_set_mode(priv, &priv->power_data.sleep_cmd_next, false); - iwl_set_tx_power(priv, priv->tx_power_next, false); - - /* - * Since setting the RXON may have been deferred while - * performing the scan, fire one off if needed - */ - for_each_context(priv, ctx) - if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) - iwlagn_commit_rxon(priv, ctx); - - iwlagn_set_pan_params(priv); -} diff --git a/drivers/net/wireless/iwlwifi/dvm/scan.c b/drivers/net/wireless/iwlwifi/dvm/scan.c deleted file mode 100644 index d69b55866714..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/scan.c +++ /dev/null @@ -1,1188 +0,0 @@ -/****************************************************************************** - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - *****************************************************************************/ -#include -#include -#include -#include - -#include "dev.h" -#include "agn.h" - -/* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after - * sending probe req. This should be set long enough to hear probe responses - * from more than one AP. */ -#define IWL_ACTIVE_DWELL_TIME_24 (30) /* all times in msec */ -#define IWL_ACTIVE_DWELL_TIME_52 (20) - -#define IWL_ACTIVE_DWELL_FACTOR_24GHZ (3) -#define IWL_ACTIVE_DWELL_FACTOR_52GHZ (2) - -/* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel. - * Must be set longer than active dwell time. - * For the most reliable scan, set > AP beacon interval (typically 100msec). */ -#define IWL_PASSIVE_DWELL_TIME_24 (20) /* all times in msec */ -#define IWL_PASSIVE_DWELL_TIME_52 (10) -#define IWL_PASSIVE_DWELL_BASE (100) -#define IWL_CHANNEL_TUNE_TIME 5 -#define MAX_SCAN_CHANNEL 50 - -/* For reset radio, need minimal dwell time only */ -#define IWL_RADIO_RESET_DWELL_TIME 5 - -static int iwl_send_scan_abort(struct iwl_priv *priv) -{ - int ret; - struct iwl_host_cmd cmd = { - .id = REPLY_SCAN_ABORT_CMD, - .flags = CMD_SYNC | CMD_WANT_SKB, - }; - __le32 *status; - - /* Exit instantly with error when device is not ready - * to receive scan abort command or it does not perform - * hardware scan currently */ - if (!test_bit(STATUS_READY, &priv->status) || - !test_bit(STATUS_SCAN_HW, &priv->status) || - test_bit(STATUS_FW_ERROR, &priv->status)) - return -EIO; - - ret = iwl_dvm_send_cmd(priv, &cmd); - if (ret) - return ret; - - status = (void *)cmd.resp_pkt->data; - if (*status != CAN_ABORT_STATUS) { - /* The scan abort will return 1 for success or - * 2 for "failure". A failure condition can be - * due to simply not being in an active scan which - * can occur if we send the scan abort before we - * the microcode has notified us that a scan is - * completed. */ - IWL_DEBUG_SCAN(priv, "SCAN_ABORT ret %d.\n", - le32_to_cpu(*status)); - ret = -EIO; - } - - iwl_free_resp(&cmd); - return ret; -} - -static void iwl_complete_scan(struct iwl_priv *priv, bool aborted) -{ - /* check if scan was requested from mac80211 */ - if (priv->scan_request) { - IWL_DEBUG_SCAN(priv, "Complete scan in mac80211\n"); - ieee80211_scan_completed(priv->hw, aborted); - } - - if (priv->scan_type == IWL_SCAN_ROC) - iwl_scan_roc_expired(priv); - - priv->scan_type = IWL_SCAN_NORMAL; - priv->scan_vif = NULL; - priv->scan_request = NULL; -} - -static void iwl_process_scan_complete(struct iwl_priv *priv) -{ - bool aborted; - - lockdep_assert_held(&priv->mutex); - - if (!test_and_clear_bit(STATUS_SCAN_COMPLETE, &priv->status)) - return; - - IWL_DEBUG_SCAN(priv, "Completed scan.\n"); - - cancel_delayed_work(&priv->scan_check); - - aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->status); - if (aborted) - IWL_DEBUG_SCAN(priv, "Aborted scan completed.\n"); - - if (!test_and_clear_bit(STATUS_SCANNING, &priv->status)) { - IWL_DEBUG_SCAN(priv, "Scan already completed.\n"); - goto out_settings; - } - - if (priv->scan_type == IWL_SCAN_ROC) - iwl_scan_roc_expired(priv); - - if (priv->scan_type != IWL_SCAN_NORMAL && !aborted) { - int err; - - /* Check if mac80211 requested scan during our internal scan */ - if (priv->scan_request == NULL) - goto out_complete; - - /* If so request a new scan */ - err = iwl_scan_initiate(priv, priv->scan_vif, IWL_SCAN_NORMAL, - priv->scan_request->channels[0]->band); - if (err) { - IWL_DEBUG_SCAN(priv, - "failed to initiate pending scan: %d\n", err); - aborted = true; - goto out_complete; - } - - return; - } - -out_complete: - iwl_complete_scan(priv, aborted); - -out_settings: - /* Can we still talk to firmware ? */ - if (!iwl_is_ready_rf(priv)) - return; - - iwlagn_post_scan(priv); -} - -void iwl_force_scan_end(struct iwl_priv *priv) -{ - lockdep_assert_held(&priv->mutex); - - if (!test_bit(STATUS_SCANNING, &priv->status)) { - IWL_DEBUG_SCAN(priv, "Forcing scan end while not scanning\n"); - return; - } - - IWL_DEBUG_SCAN(priv, "Forcing scan end\n"); - clear_bit(STATUS_SCANNING, &priv->status); - clear_bit(STATUS_SCAN_HW, &priv->status); - clear_bit(STATUS_SCAN_ABORTING, &priv->status); - clear_bit(STATUS_SCAN_COMPLETE, &priv->status); - iwl_complete_scan(priv, true); -} - -static void iwl_do_scan_abort(struct iwl_priv *priv) -{ - int ret; - - lockdep_assert_held(&priv->mutex); - - if (!test_bit(STATUS_SCANNING, &priv->status)) { - IWL_DEBUG_SCAN(priv, "Not performing scan to abort\n"); - return; - } - - if (test_and_set_bit(STATUS_SCAN_ABORTING, &priv->status)) { - IWL_DEBUG_SCAN(priv, "Scan abort in progress\n"); - return; - } - - ret = iwl_send_scan_abort(priv); - if (ret) { - IWL_DEBUG_SCAN(priv, "Send scan abort failed %d\n", ret); - iwl_force_scan_end(priv); - } else - IWL_DEBUG_SCAN(priv, "Successfully send scan abort\n"); -} - -/** - * iwl_scan_cancel - Cancel any currently executing HW scan - */ -int iwl_scan_cancel(struct iwl_priv *priv) -{ - IWL_DEBUG_SCAN(priv, "Queuing abort scan\n"); - queue_work(priv->workqueue, &priv->abort_scan); - return 0; -} - -/** - * iwl_scan_cancel_timeout - Cancel any currently executing HW scan - * @ms: amount of time to wait (in milliseconds) for scan to abort - * - */ -void iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) -{ - unsigned long timeout = jiffies + msecs_to_jiffies(ms); - - lockdep_assert_held(&priv->mutex); - - IWL_DEBUG_SCAN(priv, "Scan cancel timeout\n"); - - iwl_do_scan_abort(priv); - - while (time_before_eq(jiffies, timeout)) { - if (!test_bit(STATUS_SCAN_HW, &priv->status)) - goto finished; - msleep(20); - } - - return; - - finished: - /* - * Now STATUS_SCAN_HW is clear. This means that the - * device finished, but the background work is going - * to execute at best as soon as we release the mutex. - * Since we need to be able to issue a new scan right - * after this function returns, run the complete here. - * The STATUS_SCAN_COMPLETE bit will then be cleared - * and prevent the background work from "completing" - * a possible new scan. - */ - iwl_process_scan_complete(priv); -} - -/* Service response to REPLY_SCAN_CMD (0x80) */ -static int iwl_rx_reply_scan(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ -#ifdef CONFIG_IWLWIFI_DEBUG - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_scanreq_notification *notif = (void *)pkt->data; - - IWL_DEBUG_SCAN(priv, "Scan request status = 0x%x\n", notif->status); -#endif - return 0; -} - -/* Service SCAN_START_NOTIFICATION (0x82) */ -static int iwl_rx_scan_start_notif(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_scanstart_notification *notif = (void *)pkt->data; - - priv->scan_start_tsf = le32_to_cpu(notif->tsf_low); - IWL_DEBUG_SCAN(priv, "Scan start: " - "%d [802.11%s] " - "(TSF: 0x%08X:%08X) - %d (beacon timer %u)\n", - notif->channel, - notif->band ? "bg" : "a", - le32_to_cpu(notif->tsf_high), - le32_to_cpu(notif->tsf_low), - notif->status, notif->beacon_timer); - - if (priv->scan_type == IWL_SCAN_ROC && - !priv->hw_roc_start_notified) { - ieee80211_ready_on_channel(priv->hw); - priv->hw_roc_start_notified = true; - } - - return 0; -} - -/* Service SCAN_RESULTS_NOTIFICATION (0x83) */ -static int iwl_rx_scan_results_notif(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ -#ifdef CONFIG_IWLWIFI_DEBUG - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_scanresults_notification *notif = (void *)pkt->data; - - IWL_DEBUG_SCAN(priv, "Scan ch.res: " - "%d [802.11%s] " - "probe status: %u:%u " - "(TSF: 0x%08X:%08X) - %d " - "elapsed=%lu usec\n", - notif->channel, - notif->band ? "bg" : "a", - notif->probe_status, notif->num_probe_not_sent, - le32_to_cpu(notif->tsf_high), - le32_to_cpu(notif->tsf_low), - le32_to_cpu(notif->statistics[0]), - le32_to_cpu(notif->tsf_low) - priv->scan_start_tsf); -#endif - return 0; -} - -/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ -static int iwl_rx_scan_complete_notif(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_scancomplete_notification *scan_notif = (void *)pkt->data; - - IWL_DEBUG_SCAN(priv, "Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", - scan_notif->scanned_channels, - scan_notif->tsf_low, - scan_notif->tsf_high, scan_notif->status); - - IWL_DEBUG_SCAN(priv, "Scan on %sGHz took %dms\n", - (priv->scan_band == IEEE80211_BAND_2GHZ) ? "2.4" : "5.2", - jiffies_to_msecs(jiffies - priv->scan_start)); - - /* - * When aborting, we run the scan completed background work inline - * and the background work must then do nothing. The SCAN_COMPLETE - * bit helps implement that logic and thus needs to be set before - * queueing the work. Also, since the scan abort waits for SCAN_HW - * to clear, we need to set SCAN_COMPLETE before clearing SCAN_HW - * to avoid a race there. - */ - set_bit(STATUS_SCAN_COMPLETE, &priv->status); - clear_bit(STATUS_SCAN_HW, &priv->status); - queue_work(priv->workqueue, &priv->scan_completed); - - if (priv->iw_mode != NL80211_IFTYPE_ADHOC && - iwl_advanced_bt_coexist(priv) && - priv->bt_status != scan_notif->bt_status) { - if (scan_notif->bt_status) { - /* BT on */ - if (!priv->bt_ch_announce) - priv->bt_traffic_load = - IWL_BT_COEX_TRAFFIC_LOAD_HIGH; - /* - * otherwise, no traffic load information provided - * no changes made - */ - } else { - /* BT off */ - priv->bt_traffic_load = - IWL_BT_COEX_TRAFFIC_LOAD_NONE; - } - priv->bt_status = scan_notif->bt_status; - queue_work(priv->workqueue, - &priv->bt_traffic_change_work); - } - return 0; -} - -void iwl_setup_rx_scan_handlers(struct iwl_priv *priv) -{ - /* scan handlers */ - priv->rx_handlers[REPLY_SCAN_CMD] = iwl_rx_reply_scan; - priv->rx_handlers[SCAN_START_NOTIFICATION] = iwl_rx_scan_start_notif; - priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] = - iwl_rx_scan_results_notif; - priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] = - iwl_rx_scan_complete_notif; -} - -static u16 iwl_get_active_dwell_time(struct iwl_priv *priv, - enum ieee80211_band band, u8 n_probes) -{ - if (band == IEEE80211_BAND_5GHZ) - return IWL_ACTIVE_DWELL_TIME_52 + - IWL_ACTIVE_DWELL_FACTOR_52GHZ * (n_probes + 1); - else - return IWL_ACTIVE_DWELL_TIME_24 + - IWL_ACTIVE_DWELL_FACTOR_24GHZ * (n_probes + 1); -} - -static u16 iwl_limit_dwell(struct iwl_priv *priv, u16 dwell_time) -{ - struct iwl_rxon_context *ctx; - int limits[NUM_IWL_RXON_CTX] = {}; - int n_active = 0; - u16 limit; - - BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2); - - /* - * If we're associated, we clamp the dwell time 98% - * of the beacon interval (minus 2 * channel tune time) - * If both contexts are active, we have to restrict to - * 1/2 of the minimum of them, because they might be in - * lock-step with the time inbetween only half of what - * time we'd have in each of them. - */ - for_each_context(priv, ctx) { - switch (ctx->staging.dev_type) { - case RXON_DEV_TYPE_P2P: - /* no timing constraints */ - continue; - case RXON_DEV_TYPE_ESS: - default: - /* timing constraints if associated */ - if (!iwl_is_associated_ctx(ctx)) - continue; - break; - case RXON_DEV_TYPE_CP: - case RXON_DEV_TYPE_2STA: - /* - * These seem to always have timers for TBTT - * active in uCode even when not associated yet. - */ - break; - } - - limits[n_active++] = ctx->beacon_int ?: IWL_PASSIVE_DWELL_BASE; - } - - switch (n_active) { - case 0: - return dwell_time; - case 2: - limit = (limits[1] * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; - limit /= 2; - dwell_time = min(limit, dwell_time); - /* fall through to limit further */ - case 1: - limit = (limits[0] * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; - limit /= n_active; - return min(limit, dwell_time); - default: - WARN_ON_ONCE(1); - return dwell_time; - } -} - -static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, - enum ieee80211_band band) -{ - u16 passive = (band == IEEE80211_BAND_2GHZ) ? - IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : - IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; - - return iwl_limit_dwell(priv, passive); -} - -/* Return valid, unused, channel for a passive scan to reset the RF */ -static u8 iwl_get_single_channel_number(struct iwl_priv *priv, - enum ieee80211_band band) -{ - struct ieee80211_supported_band *sband = priv->hw->wiphy->bands[band]; - struct iwl_rxon_context *ctx; - int i; - - for (i = 0; i < sband->n_channels; i++) { - bool busy = false; - - for_each_context(priv, ctx) { - busy = sband->channels[i].hw_value == - le16_to_cpu(ctx->staging.channel); - if (busy) - break; - } - - if (busy) - continue; - - if (!(sband->channels[i].flags & IEEE80211_CHAN_DISABLED)) - return sband->channels[i].hw_value; - } - - return 0; -} - -static int iwl_get_channel_for_reset_scan(struct iwl_priv *priv, - struct ieee80211_vif *vif, - enum ieee80211_band band, - struct iwl_scan_channel *scan_ch) -{ - const struct ieee80211_supported_band *sband; - u16 channel; - - sband = iwl_get_hw_mode(priv, band); - if (!sband) { - IWL_ERR(priv, "invalid band\n"); - return 0; - } - - channel = iwl_get_single_channel_number(priv, band); - if (channel) { - scan_ch->channel = cpu_to_le16(channel); - scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; - scan_ch->active_dwell = - cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME); - scan_ch->passive_dwell = - cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME); - /* Set txpower levels to defaults */ - scan_ch->dsp_atten = 110; - if (band == IEEE80211_BAND_5GHZ) - scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3; - else - scan_ch->tx_gain = ((1 << 5) | (5 << 3)); - return 1; - } - - IWL_ERR(priv, "no valid channel found\n"); - return 0; -} - -static int iwl_get_channels_for_scan(struct iwl_priv *priv, - struct ieee80211_vif *vif, - enum ieee80211_band band, - u8 is_active, u8 n_probes, - struct iwl_scan_channel *scan_ch) -{ - struct ieee80211_channel *chan; - const struct ieee80211_supported_band *sband; - u16 passive_dwell = 0; - u16 active_dwell = 0; - int added, i; - u16 channel; - - sband = iwl_get_hw_mode(priv, band); - if (!sband) - return 0; - - active_dwell = iwl_get_active_dwell_time(priv, band, n_probes); - passive_dwell = iwl_get_passive_dwell_time(priv, band); - - if (passive_dwell <= active_dwell) - passive_dwell = active_dwell + 1; - - for (i = 0, added = 0; i < priv->scan_request->n_channels; i++) { - chan = priv->scan_request->channels[i]; - - if (chan->band != band) - continue; - - channel = chan->hw_value; - scan_ch->channel = cpu_to_le16(channel); - - if (!is_active || (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)) - scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; - else - scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE; - - if (n_probes) - scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes); - - scan_ch->active_dwell = cpu_to_le16(active_dwell); - scan_ch->passive_dwell = cpu_to_le16(passive_dwell); - - /* Set txpower levels to defaults */ - scan_ch->dsp_atten = 110; - - /* NOTE: if we were doing 6Mb OFDM for scans we'd use - * power level: - * scan_ch->tx_gain = ((1 << 5) | (2 << 3)) | 3; - */ - if (band == IEEE80211_BAND_5GHZ) - scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3; - else - scan_ch->tx_gain = ((1 << 5) | (5 << 3)); - - IWL_DEBUG_SCAN(priv, "Scanning ch=%d prob=0x%X [%s %d]\n", - channel, le32_to_cpu(scan_ch->type), - (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ? - "ACTIVE" : "PASSIVE", - (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ? - active_dwell : passive_dwell); - - scan_ch++; - added++; - } - - IWL_DEBUG_SCAN(priv, "total channels to scan %d\n", added); - return added; -} - -/** - * iwl_fill_probe_req - fill in all required fields and IE for probe request - */ - -static u16 iwl_fill_probe_req(struct ieee80211_mgmt *frame, const u8 *ta, - const u8 *ies, int ie_len, const u8 *ssid, - u8 ssid_len, int left) -{ - int len = 0; - u8 *pos = NULL; - - /* Make sure there is enough space for the probe request, - * two mandatory IEs and the data */ - left -= 24; - if (left < 0) - return 0; - - frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); - eth_broadcast_addr(frame->da); - memcpy(frame->sa, ta, ETH_ALEN); - eth_broadcast_addr(frame->bssid); - frame->seq_ctrl = 0; - - len += 24; - - /* ...next IE... */ - pos = &frame->u.probe_req.variable[0]; - - /* fill in our SSID IE */ - left -= ssid_len + 2; - if (left < 0) - return 0; - *pos++ = WLAN_EID_SSID; - *pos++ = ssid_len; - if (ssid && ssid_len) { - memcpy(pos, ssid, ssid_len); - pos += ssid_len; - } - - len += ssid_len + 2; - - if (WARN_ON(left < ie_len)) - return len; - - if (ies && ie_len) { - memcpy(pos, ies, ie_len); - len += ie_len; - } - - return (u16)len; -} - -static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) -{ - struct iwl_host_cmd cmd = { - .id = REPLY_SCAN_CMD, - .len = { sizeof(struct iwl_scan_cmd), }, - .flags = CMD_SYNC, - }; - struct iwl_scan_cmd *scan; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - u32 rate_flags = 0; - u16 cmd_len = 0; - u16 rx_chain = 0; - enum ieee80211_band band; - u8 n_probes = 0; - u8 rx_ant = priv->nvm_data->valid_rx_ant; - u8 rate; - bool is_active = false; - int chan_mod; - u8 active_chains; - u8 scan_tx_antennas = priv->nvm_data->valid_tx_ant; - int ret; - int scan_cmd_size = sizeof(struct iwl_scan_cmd) + - MAX_SCAN_CHANNEL * sizeof(struct iwl_scan_channel) + - priv->fw->ucode_capa.max_probe_length; - const u8 *ssid = NULL; - u8 ssid_len = 0; - - if (WARN_ON(priv->scan_type == IWL_SCAN_NORMAL && - (!priv->scan_request || - priv->scan_request->n_channels > MAX_SCAN_CHANNEL))) - return -EINVAL; - - lockdep_assert_held(&priv->mutex); - - if (vif) - ctx = iwl_rxon_ctx_from_vif(vif); - - if (!priv->scan_cmd) { - priv->scan_cmd = kmalloc(scan_cmd_size, GFP_KERNEL); - if (!priv->scan_cmd) { - IWL_DEBUG_SCAN(priv, - "fail to allocate memory for scan\n"); - return -ENOMEM; - } - } - scan = priv->scan_cmd; - memset(scan, 0, scan_cmd_size); - - scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; - scan->quiet_time = IWL_ACTIVE_QUIET_TIME; - - if (priv->scan_type != IWL_SCAN_ROC && - iwl_is_any_associated(priv)) { - u16 interval = 0; - u32 extra; - u32 suspend_time = 100; - u32 scan_suspend_time = 100; - - IWL_DEBUG_INFO(priv, "Scanning while associated...\n"); - switch (priv->scan_type) { - case IWL_SCAN_ROC: - WARN_ON(1); - break; - case IWL_SCAN_RADIO_RESET: - interval = 0; - break; - case IWL_SCAN_NORMAL: - interval = vif->bss_conf.beacon_int; - break; - } - - scan->suspend_time = 0; - scan->max_out_time = cpu_to_le32(200 * 1024); - if (!interval) - interval = suspend_time; - - extra = (suspend_time / interval) << 22; - scan_suspend_time = (extra | - ((suspend_time % interval) * 1024)); - scan->suspend_time = cpu_to_le32(scan_suspend_time); - IWL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n", - scan_suspend_time, interval); - } else if (priv->scan_type == IWL_SCAN_ROC) { - scan->suspend_time = 0; - scan->max_out_time = 0; - scan->quiet_time = 0; - scan->quiet_plcp_th = 0; - } - - switch (priv->scan_type) { - case IWL_SCAN_RADIO_RESET: - IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n"); - /* - * Override quiet time as firmware checks that active - * dwell is >= quiet; since we use passive scan it'll - * not actually be used. - */ - scan->quiet_time = cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME); - break; - case IWL_SCAN_NORMAL: - if (priv->scan_request->n_ssids) { - int i, p = 0; - IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); - /* - * The highest priority SSID is inserted to the - * probe request template. - */ - ssid_len = priv->scan_request->ssids[0].ssid_len; - ssid = priv->scan_request->ssids[0].ssid; - - /* - * Invert the order of ssids, the firmware will invert - * it back. - */ - for (i = priv->scan_request->n_ssids - 1; i >= 1; i--) { - scan->direct_scan[p].id = WLAN_EID_SSID; - scan->direct_scan[p].len = - priv->scan_request->ssids[i].ssid_len; - memcpy(scan->direct_scan[p].ssid, - priv->scan_request->ssids[i].ssid, - priv->scan_request->ssids[i].ssid_len); - n_probes++; - p++; - } - is_active = true; - } else - IWL_DEBUG_SCAN(priv, "Start passive scan.\n"); - break; - case IWL_SCAN_ROC: - IWL_DEBUG_SCAN(priv, "Start ROC scan.\n"); - break; - } - - scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; - scan->tx_cmd.sta_id = ctx->bcast_sta_id; - scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; - - switch (priv->scan_band) { - case IEEE80211_BAND_2GHZ: - scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; - chan_mod = le32_to_cpu( - priv->contexts[IWL_RXON_CTX_BSS].active.flags & - RXON_FLG_CHANNEL_MODE_MSK) - >> RXON_FLG_CHANNEL_MODE_POS; - if ((priv->scan_request && priv->scan_request->no_cck) || - chan_mod == CHANNEL_MODE_PURE_40) { - rate = IWL_RATE_6M_PLCP; - } else { - rate = IWL_RATE_1M_PLCP; - rate_flags = RATE_MCS_CCK_MSK; - } - /* - * Internal scans are passive, so we can indiscriminately set - * the BT ignore flag on 2.4 GHz since it applies to TX only. - */ - if (priv->cfg->bt_params && - priv->cfg->bt_params->advanced_bt_coexist) - scan->tx_cmd.tx_flags |= TX_CMD_FLG_IGNORE_BT; - break; - case IEEE80211_BAND_5GHZ: - rate = IWL_RATE_6M_PLCP; - break; - default: - IWL_WARN(priv, "Invalid scan band\n"); - return -EIO; - } - - /* - * If active scanning is requested but a certain channel is - * marked passive, we can do active scanning if we detect - * transmissions. - * - * There is an issue with some firmware versions that triggers - * a sysassert on a "good CRC threshold" of zero (== disabled), - * on a radar channel even though this means that we should NOT - * send probes. - * - * The "good CRC threshold" is the number of frames that we - * need to receive during our dwell time on a channel before - * sending out probes -- setting this to a huge value will - * mean we never reach it, but at the same time work around - * the aforementioned issue. Thus use IWL_GOOD_CRC_TH_NEVER - * here instead of IWL_GOOD_CRC_TH_DISABLED. - * - * This was fixed in later versions along with some other - * scan changes, and the threshold behaves as a flag in those - * versions. - */ - if (priv->new_scan_threshold_behaviour) - scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT : - IWL_GOOD_CRC_TH_DISABLED; - else - scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT : - IWL_GOOD_CRC_TH_NEVER; - - band = priv->scan_band; - - if (band == IEEE80211_BAND_2GHZ && - priv->cfg->bt_params && - priv->cfg->bt_params->advanced_bt_coexist) { - /* transmit 2.4 GHz probes only on first antenna */ - scan_tx_antennas = first_antenna(scan_tx_antennas); - } - - priv->scan_tx_ant[band] = iwl_toggle_tx_ant(priv, - priv->scan_tx_ant[band], - scan_tx_antennas); - rate_flags |= iwl_ant_idx_to_flags(priv->scan_tx_ant[band]); - scan->tx_cmd.rate_n_flags = iwl_hw_set_rate_n_flags(rate, rate_flags); - - /* - * In power save mode while associated use one chain, - * otherwise use all chains - */ - if (test_bit(STATUS_POWER_PMI, &priv->status) && - !(priv->hw->conf.flags & IEEE80211_CONF_IDLE)) { - /* rx_ant has been set to all valid chains previously */ - active_chains = rx_ant & - ((u8)(priv->chain_noise_data.active_chains)); - if (!active_chains) - active_chains = rx_ant; - - IWL_DEBUG_SCAN(priv, "chain_noise_data.active_chains: %u\n", - priv->chain_noise_data.active_chains); - - rx_ant = first_antenna(active_chains); - } - if (priv->cfg->bt_params && - priv->cfg->bt_params->advanced_bt_coexist && - priv->bt_full_concurrent) { - /* operated as 1x1 in full concurrency mode */ - rx_ant = first_antenna(rx_ant); - } - - /* MIMO is not used here, but value is required */ - rx_chain |= - priv->nvm_data->valid_rx_ant << RXON_RX_CHAIN_VALID_POS; - rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS; - rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS; - rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS; - scan->rx_chain = cpu_to_le16(rx_chain); - switch (priv->scan_type) { - case IWL_SCAN_NORMAL: - cmd_len = iwl_fill_probe_req( - (struct ieee80211_mgmt *)scan->data, - vif->addr, - priv->scan_request->ie, - priv->scan_request->ie_len, - ssid, ssid_len, - scan_cmd_size - sizeof(*scan)); - break; - case IWL_SCAN_RADIO_RESET: - case IWL_SCAN_ROC: - /* use bcast addr, will not be transmitted but must be valid */ - cmd_len = iwl_fill_probe_req( - (struct ieee80211_mgmt *)scan->data, - iwl_bcast_addr, NULL, 0, - NULL, 0, - scan_cmd_size - sizeof(*scan)); - break; - default: - BUG(); - } - scan->tx_cmd.len = cpu_to_le16(cmd_len); - - scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | - RXON_FILTER_BCON_AWARE_MSK); - - switch (priv->scan_type) { - case IWL_SCAN_RADIO_RESET: - scan->channel_count = - iwl_get_channel_for_reset_scan(priv, vif, band, - (void *)&scan->data[cmd_len]); - break; - case IWL_SCAN_NORMAL: - scan->channel_count = - iwl_get_channels_for_scan(priv, vif, band, - is_active, n_probes, - (void *)&scan->data[cmd_len]); - break; - case IWL_SCAN_ROC: { - struct iwl_scan_channel *scan_ch; - int n_chan, i; - u16 dwell; - - dwell = iwl_limit_dwell(priv, priv->hw_roc_duration); - n_chan = DIV_ROUND_UP(priv->hw_roc_duration, dwell); - - scan->channel_count = n_chan; - - scan_ch = (void *)&scan->data[cmd_len]; - - for (i = 0; i < n_chan; i++) { - scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; - scan_ch->channel = - cpu_to_le16(priv->hw_roc_channel->hw_value); - - if (i == n_chan - 1) - dwell = priv->hw_roc_duration - i * dwell; - - scan_ch->active_dwell = - scan_ch->passive_dwell = cpu_to_le16(dwell); - - /* Set txpower levels to defaults */ - scan_ch->dsp_atten = 110; - - /* NOTE: if we were doing 6Mb OFDM for scans we'd use - * power level: - * scan_ch->tx_gain = ((1 << 5) | (2 << 3)) | 3; - */ - if (priv->hw_roc_channel->band == IEEE80211_BAND_5GHZ) - scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3; - else - scan_ch->tx_gain = ((1 << 5) | (5 << 3)); - - scan_ch++; - } - } - - break; - } - - if (scan->channel_count == 0) { - IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); - return -EIO; - } - - cmd.len[0] += le16_to_cpu(scan->tx_cmd.len) + - scan->channel_count * sizeof(struct iwl_scan_channel); - cmd.data[0] = scan; - cmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY; - scan->len = cpu_to_le16(cmd.len[0]); - - /* set scan bit here for PAN params */ - set_bit(STATUS_SCAN_HW, &priv->status); - - ret = iwlagn_set_pan_params(priv); - if (ret) { - clear_bit(STATUS_SCAN_HW, &priv->status); - return ret; - } - - ret = iwl_dvm_send_cmd(priv, &cmd); - if (ret) { - clear_bit(STATUS_SCAN_HW, &priv->status); - iwlagn_set_pan_params(priv); - } - - return ret; -} - -void iwl_init_scan_params(struct iwl_priv *priv) -{ - u8 ant_idx = fls(priv->nvm_data->valid_tx_ant) - 1; - if (!priv->scan_tx_ant[IEEE80211_BAND_5GHZ]) - priv->scan_tx_ant[IEEE80211_BAND_5GHZ] = ant_idx; - if (!priv->scan_tx_ant[IEEE80211_BAND_2GHZ]) - priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx; -} - -int __must_check iwl_scan_initiate(struct iwl_priv *priv, - struct ieee80211_vif *vif, - enum iwl_scan_type scan_type, - enum ieee80211_band band) -{ - int ret; - - lockdep_assert_held(&priv->mutex); - - cancel_delayed_work(&priv->scan_check); - - if (!iwl_is_ready_rf(priv)) { - IWL_WARN(priv, "Request scan called when driver not ready.\n"); - return -EIO; - } - - if (test_bit(STATUS_SCAN_HW, &priv->status)) { - IWL_DEBUG_SCAN(priv, - "Multiple concurrent scan requests in parallel.\n"); - return -EBUSY; - } - - if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { - IWL_DEBUG_SCAN(priv, "Scan request while abort pending.\n"); - return -EBUSY; - } - - IWL_DEBUG_SCAN(priv, "Starting %sscan...\n", - scan_type == IWL_SCAN_NORMAL ? "" : - scan_type == IWL_SCAN_ROC ? "remain-on-channel " : - "internal short "); - - set_bit(STATUS_SCANNING, &priv->status); - priv->scan_type = scan_type; - priv->scan_start = jiffies; - priv->scan_band = band; - - ret = iwlagn_request_scan(priv, vif); - if (ret) { - clear_bit(STATUS_SCANNING, &priv->status); - priv->scan_type = IWL_SCAN_NORMAL; - return ret; - } - - queue_delayed_work(priv->workqueue, &priv->scan_check, - IWL_SCAN_CHECK_WATCHDOG); - - return 0; -} - - -/* - * internal short scan, this function should only been called while associated. - * It will reset and tune the radio to prevent possible RF related problem - */ -void iwl_internal_short_hw_scan(struct iwl_priv *priv) -{ - queue_work(priv->workqueue, &priv->start_internal_scan); -} - -static void iwl_bg_start_internal_scan(struct work_struct *work) -{ - struct iwl_priv *priv = - container_of(work, struct iwl_priv, start_internal_scan); - - IWL_DEBUG_SCAN(priv, "Start internal scan\n"); - - mutex_lock(&priv->mutex); - - if (priv->scan_type == IWL_SCAN_RADIO_RESET) { - IWL_DEBUG_SCAN(priv, "Internal scan already in progress\n"); - goto unlock; - } - - if (test_bit(STATUS_SCANNING, &priv->status)) { - IWL_DEBUG_SCAN(priv, "Scan already in progress.\n"); - goto unlock; - } - - if (iwl_scan_initiate(priv, NULL, IWL_SCAN_RADIO_RESET, priv->band)) - IWL_DEBUG_SCAN(priv, "failed to start internal short scan\n"); - unlock: - mutex_unlock(&priv->mutex); -} - -static void iwl_bg_scan_check(struct work_struct *data) -{ - struct iwl_priv *priv = - container_of(data, struct iwl_priv, scan_check.work); - - IWL_DEBUG_SCAN(priv, "Scan check work\n"); - - /* Since we are here firmware does not finish scan and - * most likely is in bad shape, so we don't bother to - * send abort command, just force scan complete to mac80211 */ - mutex_lock(&priv->mutex); - iwl_force_scan_end(priv); - mutex_unlock(&priv->mutex); -} - -static void iwl_bg_abort_scan(struct work_struct *work) -{ - struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); - - IWL_DEBUG_SCAN(priv, "Abort scan work\n"); - - /* We keep scan_check work queued in case when firmware will not - * report back scan completed notification */ - mutex_lock(&priv->mutex); - iwl_scan_cancel_timeout(priv, 200); - mutex_unlock(&priv->mutex); -} - -static void iwl_bg_scan_completed(struct work_struct *work) -{ - struct iwl_priv *priv = - container_of(work, struct iwl_priv, scan_completed); - - mutex_lock(&priv->mutex); - iwl_process_scan_complete(priv); - mutex_unlock(&priv->mutex); -} - -void iwl_setup_scan_deferred_work(struct iwl_priv *priv) -{ - INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); - INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); - INIT_WORK(&priv->start_internal_scan, iwl_bg_start_internal_scan); - INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); -} - -void iwl_cancel_scan_deferred_work(struct iwl_priv *priv) -{ - cancel_work_sync(&priv->start_internal_scan); - cancel_work_sync(&priv->abort_scan); - cancel_work_sync(&priv->scan_completed); - - if (cancel_delayed_work_sync(&priv->scan_check)) { - mutex_lock(&priv->mutex); - iwl_force_scan_end(priv); - mutex_unlock(&priv->mutex); - } -} - -void iwl_scan_roc_expired(struct iwl_priv *priv) -{ - /* - * The status bit should be set here, to prevent a race - * where the atomic_read returns 1, but before the execution continues - * iwl_scan_offchannel_skb_status() checks if the status bit is set - */ - set_bit(STATUS_SCAN_ROC_EXPIRED, &priv->status); - - if (atomic_read(&priv->num_aux_in_flight) == 0) { - ieee80211_remain_on_channel_expired(priv->hw); - priv->hw_roc_channel = NULL; - schedule_delayed_work(&priv->hw_roc_disable_work, - 10 * HZ); - - clear_bit(STATUS_SCAN_ROC_EXPIRED, &priv->status); - } else { - IWL_DEBUG_SCAN(priv, "ROC done with %d frames in aux\n", - atomic_read(&priv->num_aux_in_flight)); - } -} - -void iwl_scan_offchannel_skb(struct iwl_priv *priv) -{ - WARN_ON(!priv->hw_roc_start_notified); - atomic_inc(&priv->num_aux_in_flight); -} - -void iwl_scan_offchannel_skb_status(struct iwl_priv *priv) -{ - if (atomic_dec_return(&priv->num_aux_in_flight) == 0 && - test_bit(STATUS_SCAN_ROC_EXPIRED, &priv->status)) { - IWL_DEBUG_SCAN(priv, "0 aux frames. Calling ROC expired\n"); - iwl_scan_roc_expired(priv); - } -} diff --git a/drivers/net/wireless/iwlwifi/dvm/sta.c b/drivers/net/wireless/iwlwifi/dvm/sta.c deleted file mode 100644 index c3c13ce96eb0..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/sta.c +++ /dev/null @@ -1,1477 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portions of the ieee80211 subsystem header files. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ -#include -#include -#include "iwl-trans.h" -#include "dev.h" -#include "agn.h" - -const u8 iwl_bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - -static int iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) -{ - lockdep_assert_held(&priv->sta_lock); - - if (sta_id >= IWLAGN_STATION_COUNT) { - IWL_ERR(priv, "invalid sta_id %u", sta_id); - return -EINVAL; - } - if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) - IWL_ERR(priv, "ACTIVATE a non DRIVER active station id %u " - "addr %pM\n", - sta_id, priv->stations[sta_id].sta.sta.addr); - - if (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE) { - IWL_DEBUG_ASSOC(priv, - "STA id %u addr %pM already present in uCode " - "(according to driver)\n", - sta_id, priv->stations[sta_id].sta.sta.addr); - } else { - priv->stations[sta_id].used |= IWL_STA_UCODE_ACTIVE; - IWL_DEBUG_ASSOC(priv, "Added STA id %u addr %pM to uCode\n", - sta_id, priv->stations[sta_id].sta.sta.addr); - } - return 0; -} - -static int iwl_process_add_sta_resp(struct iwl_priv *priv, - struct iwl_addsta_cmd *addsta, - struct iwl_rx_packet *pkt) -{ - struct iwl_add_sta_resp *add_sta_resp = (void *)pkt->data; - u8 sta_id = addsta->sta.sta_id; - int ret = -EIO; - - if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { - IWL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n", - pkt->hdr.flags); - return ret; - } - - IWL_DEBUG_INFO(priv, "Processing response for adding station %u\n", - sta_id); - - spin_lock_bh(&priv->sta_lock); - - switch (add_sta_resp->status) { - case ADD_STA_SUCCESS_MSK: - IWL_DEBUG_INFO(priv, "REPLY_ADD_STA PASSED\n"); - ret = iwl_sta_ucode_activate(priv, sta_id); - break; - case ADD_STA_NO_ROOM_IN_TABLE: - IWL_ERR(priv, "Adding station %d failed, no room in table.\n", - sta_id); - break; - case ADD_STA_NO_BLOCK_ACK_RESOURCE: - IWL_ERR(priv, "Adding station %d failed, no block ack " - "resource.\n", sta_id); - break; - case ADD_STA_MODIFY_NON_EXIST_STA: - IWL_ERR(priv, "Attempting to modify non-existing station %d\n", - sta_id); - break; - default: - IWL_DEBUG_ASSOC(priv, "Received REPLY_ADD_STA:(0x%08X)\n", - add_sta_resp->status); - break; - } - - IWL_DEBUG_INFO(priv, "%s station id %u addr %pM\n", - priv->stations[sta_id].sta.mode == - STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", - sta_id, priv->stations[sta_id].sta.sta.addr); - - /* - * XXX: The MAC address in the command buffer is often changed from - * the original sent to the device. That is, the MAC address - * written to the command buffer often is not the same MAC address - * read from the command buffer when the command returns. This - * issue has not yet been resolved and this debugging is left to - * observe the problem. - */ - IWL_DEBUG_INFO(priv, "%s station according to cmd buffer %pM\n", - priv->stations[sta_id].sta.mode == - STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", - addsta->sta.addr); - spin_unlock_bh(&priv->sta_lock); - - return ret; -} - -int iwl_add_sta_callback(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - - if (!cmd) - return 0; - - return iwl_process_add_sta_resp(priv, (void *)cmd->payload, pkt); -} - -int iwl_send_add_sta(struct iwl_priv *priv, - struct iwl_addsta_cmd *sta, u8 flags) -{ - int ret = 0; - struct iwl_host_cmd cmd = { - .id = REPLY_ADD_STA, - .flags = flags, - .data = { sta, }, - .len = { sizeof(*sta), }, - }; - u8 sta_id __maybe_unused = sta->sta.sta_id; - - IWL_DEBUG_INFO(priv, "Adding sta %u (%pM) %ssynchronously\n", - sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : ""); - - if (!(flags & CMD_ASYNC)) { - cmd.flags |= CMD_WANT_SKB; - might_sleep(); - } - - ret = iwl_dvm_send_cmd(priv, &cmd); - - if (ret || (flags & CMD_ASYNC)) - return ret; - /*else the command was successfully sent in SYNC mode, need to free - * the reply page */ - - iwl_free_resp(&cmd); - - if (cmd.handler_status) - IWL_ERR(priv, "%s - error in the CMD response %d", __func__, - cmd.handler_status); - - return cmd.handler_status; -} - -bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct ieee80211_sta *sta) -{ - if (!ctx->ht.enabled || !ctx->ht.is_40mhz) - return false; - -#ifdef CONFIG_IWLWIFI_DEBUGFS - if (priv->disable_ht40) - return false; -#endif - - /* special case for RXON */ - if (!sta) - return true; - - return sta->bandwidth >= IEEE80211_STA_RX_BW_40; -} - -static void iwl_sta_calc_ht_flags(struct iwl_priv *priv, - struct ieee80211_sta *sta, - struct iwl_rxon_context *ctx, - __le32 *flags, __le32 *mask) -{ - struct ieee80211_sta_ht_cap *sta_ht_inf = &sta->ht_cap; - - *mask = STA_FLG_RTS_MIMO_PROT_MSK | - STA_FLG_MIMO_DIS_MSK | - STA_FLG_HT40_EN_MSK | - STA_FLG_MAX_AGG_SIZE_MSK | - STA_FLG_AGG_MPDU_DENSITY_MSK; - *flags = 0; - - if (!sta || !sta_ht_inf->ht_supported) - return; - - IWL_DEBUG_INFO(priv, "STA %pM SM PS mode: %s\n", - sta->addr, - (sta->smps_mode == IEEE80211_SMPS_STATIC) ? - "static" : - (sta->smps_mode == IEEE80211_SMPS_DYNAMIC) ? - "dynamic" : "disabled"); - - switch (sta->smps_mode) { - case IEEE80211_SMPS_STATIC: - *flags |= STA_FLG_MIMO_DIS_MSK; - break; - case IEEE80211_SMPS_DYNAMIC: - *flags |= STA_FLG_RTS_MIMO_PROT_MSK; - break; - case IEEE80211_SMPS_OFF: - break; - default: - IWL_WARN(priv, "Invalid MIMO PS mode %d\n", sta->smps_mode); - break; - } - - *flags |= cpu_to_le32( - (u32)sta_ht_inf->ampdu_factor << STA_FLG_MAX_AGG_SIZE_POS); - - *flags |= cpu_to_le32( - (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); - - if (iwl_is_ht40_tx_allowed(priv, ctx, sta)) - *flags |= STA_FLG_HT40_EN_MSK; -} - -int iwl_sta_update_ht(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - struct ieee80211_sta *sta) -{ - u8 sta_id = iwl_sta_id(sta); - __le32 flags, mask; - struct iwl_addsta_cmd cmd; - - if (WARN_ON_ONCE(sta_id == IWL_INVALID_STATION)) - return -EINVAL; - - iwl_sta_calc_ht_flags(priv, sta, ctx, &flags, &mask); - - spin_lock_bh(&priv->sta_lock); - priv->stations[sta_id].sta.station_flags &= ~mask; - priv->stations[sta_id].sta.station_flags |= flags; - spin_unlock_bh(&priv->sta_lock); - - memset(&cmd, 0, sizeof(cmd)); - cmd.mode = STA_CONTROL_MODIFY_MSK; - cmd.station_flags_msk = mask; - cmd.station_flags = flags; - cmd.sta.sta_id = sta_id; - - return iwl_send_add_sta(priv, &cmd, CMD_SYNC); -} - -static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, - struct ieee80211_sta *sta, - struct iwl_rxon_context *ctx) -{ - __le32 flags, mask; - - iwl_sta_calc_ht_flags(priv, sta, ctx, &flags, &mask); - - lockdep_assert_held(&priv->sta_lock); - priv->stations[index].sta.station_flags &= ~mask; - priv->stations[index].sta.station_flags |= flags; -} - -/** - * iwl_prep_station - Prepare station information for addition - * - * should be called with sta_lock held - */ -u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - const u8 *addr, bool is_ap, struct ieee80211_sta *sta) -{ - struct iwl_station_entry *station; - int i; - u8 sta_id = IWL_INVALID_STATION; - - if (is_ap) - sta_id = ctx->ap_sta_id; - else if (is_broadcast_ether_addr(addr)) - sta_id = ctx->bcast_sta_id; - else - for (i = IWL_STA_ID; i < IWLAGN_STATION_COUNT; i++) { - if (ether_addr_equal(priv->stations[i].sta.sta.addr, - addr)) { - sta_id = i; - break; - } - - if (!priv->stations[i].used && - sta_id == IWL_INVALID_STATION) - sta_id = i; - } - - /* - * These two conditions have the same outcome, but keep them - * separate - */ - if (unlikely(sta_id == IWL_INVALID_STATION)) - return sta_id; - - /* - * uCode is not able to deal with multiple requests to add a - * station. Keep track if one is in progress so that we do not send - * another. - */ - if (priv->stations[sta_id].used & IWL_STA_UCODE_INPROGRESS) { - IWL_DEBUG_INFO(priv, "STA %d already in process of being " - "added.\n", sta_id); - return sta_id; - } - - if ((priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE) && - (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE) && - ether_addr_equal(priv->stations[sta_id].sta.sta.addr, addr)) { - IWL_DEBUG_ASSOC(priv, "STA %d (%pM) already added, not " - "adding again.\n", sta_id, addr); - return sta_id; - } - - station = &priv->stations[sta_id]; - station->used = IWL_STA_DRIVER_ACTIVE; - IWL_DEBUG_ASSOC(priv, "Add STA to driver ID %d: %pM\n", - sta_id, addr); - priv->num_stations++; - - /* Set up the REPLY_ADD_STA command to send to device */ - memset(&station->sta, 0, sizeof(struct iwl_addsta_cmd)); - memcpy(station->sta.sta.addr, addr, ETH_ALEN); - station->sta.mode = 0; - station->sta.sta.sta_id = sta_id; - station->sta.station_flags = ctx->station_flags; - station->ctxid = ctx->ctxid; - - if (sta) { - struct iwl_station_priv *sta_priv; - - sta_priv = (void *)sta->drv_priv; - sta_priv->ctx = ctx; - } - - /* - * OK to call unconditionally, since local stations (IBSS BSSID - * STA and broadcast STA) pass in a NULL sta, and mac80211 - * doesn't allow HT IBSS. - */ - iwl_set_ht_add_station(priv, sta_id, sta, ctx); - - return sta_id; - -} - -#define STA_WAIT_TIMEOUT (HZ/2) - -/** - * iwl_add_station_common - - */ -int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - const u8 *addr, bool is_ap, - struct ieee80211_sta *sta, u8 *sta_id_r) -{ - int ret = 0; - u8 sta_id; - struct iwl_addsta_cmd sta_cmd; - - *sta_id_r = 0; - spin_lock_bh(&priv->sta_lock); - sta_id = iwl_prep_station(priv, ctx, addr, is_ap, sta); - if (sta_id == IWL_INVALID_STATION) { - IWL_ERR(priv, "Unable to prepare station %pM for addition\n", - addr); - spin_unlock_bh(&priv->sta_lock); - return -EINVAL; - } - - /* - * uCode is not able to deal with multiple requests to add a - * station. Keep track if one is in progress so that we do not send - * another. - */ - if (priv->stations[sta_id].used & IWL_STA_UCODE_INPROGRESS) { - IWL_DEBUG_INFO(priv, "STA %d already in process of being " - "added.\n", sta_id); - spin_unlock_bh(&priv->sta_lock); - return -EEXIST; - } - - if ((priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE) && - (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { - IWL_DEBUG_ASSOC(priv, "STA %d (%pM) already added, not " - "adding again.\n", sta_id, addr); - spin_unlock_bh(&priv->sta_lock); - return -EEXIST; - } - - priv->stations[sta_id].used |= IWL_STA_UCODE_INPROGRESS; - memcpy(&sta_cmd, &priv->stations[sta_id].sta, - sizeof(struct iwl_addsta_cmd)); - spin_unlock_bh(&priv->sta_lock); - - /* Add station to device's station table */ - ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); - if (ret) { - spin_lock_bh(&priv->sta_lock); - IWL_ERR(priv, "Adding station %pM failed.\n", - priv->stations[sta_id].sta.sta.addr); - priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; - priv->stations[sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; - spin_unlock_bh(&priv->sta_lock); - } - *sta_id_r = sta_id; - return ret; -} - -/** - * iwl_sta_ucode_deactivate - deactivate ucode status for a station - */ -static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, u8 sta_id) -{ - lockdep_assert_held(&priv->sta_lock); - - /* Ucode must be active and driver must be non active */ - if ((priv->stations[sta_id].used & - (IWL_STA_UCODE_ACTIVE | IWL_STA_DRIVER_ACTIVE)) != - IWL_STA_UCODE_ACTIVE) - IWL_ERR(priv, "removed non active STA %u\n", sta_id); - - priv->stations[sta_id].used &= ~IWL_STA_UCODE_ACTIVE; - - memset(&priv->stations[sta_id], 0, sizeof(struct iwl_station_entry)); - IWL_DEBUG_ASSOC(priv, "Removed STA %u\n", sta_id); -} - -static int iwl_send_remove_station(struct iwl_priv *priv, - const u8 *addr, int sta_id, - bool temporary) -{ - struct iwl_rx_packet *pkt; - int ret; - struct iwl_rem_sta_cmd rm_sta_cmd; - - struct iwl_host_cmd cmd = { - .id = REPLY_REMOVE_STA, - .len = { sizeof(struct iwl_rem_sta_cmd), }, - .flags = CMD_SYNC, - .data = { &rm_sta_cmd, }, - }; - - memset(&rm_sta_cmd, 0, sizeof(rm_sta_cmd)); - rm_sta_cmd.num_sta = 1; - memcpy(&rm_sta_cmd.addr, addr, ETH_ALEN); - - cmd.flags |= CMD_WANT_SKB; - - ret = iwl_dvm_send_cmd(priv, &cmd); - - if (ret) - return ret; - - pkt = cmd.resp_pkt; - if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { - IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n", - pkt->hdr.flags); - ret = -EIO; - } - - if (!ret) { - struct iwl_rem_sta_resp *rem_sta_resp = (void *)pkt->data; - switch (rem_sta_resp->status) { - case REM_STA_SUCCESS_MSK: - if (!temporary) { - spin_lock_bh(&priv->sta_lock); - iwl_sta_ucode_deactivate(priv, sta_id); - spin_unlock_bh(&priv->sta_lock); - } - IWL_DEBUG_ASSOC(priv, "REPLY_REMOVE_STA PASSED\n"); - break; - default: - ret = -EIO; - IWL_ERR(priv, "REPLY_REMOVE_STA failed\n"); - break; - } - } - iwl_free_resp(&cmd); - - return ret; -} - -/** - * iwl_remove_station - Remove driver's knowledge of station. - */ -int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, - const u8 *addr) -{ - u8 tid; - - if (!iwl_is_ready(priv)) { - IWL_DEBUG_INFO(priv, - "Unable to remove station %pM, device not ready.\n", - addr); - /* - * It is typical for stations to be removed when we are - * going down. Return success since device will be down - * soon anyway - */ - return 0; - } - - IWL_DEBUG_ASSOC(priv, "Removing STA from driver:%d %pM\n", - sta_id, addr); - - if (WARN_ON(sta_id == IWL_INVALID_STATION)) - return -EINVAL; - - spin_lock_bh(&priv->sta_lock); - - if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) { - IWL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n", - addr); - goto out_err; - } - - if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { - IWL_DEBUG_INFO(priv, "Removing %pM but non UCODE active\n", - addr); - goto out_err; - } - - if (priv->stations[sta_id].used & IWL_STA_LOCAL) { - kfree(priv->stations[sta_id].lq); - priv->stations[sta_id].lq = NULL; - } - - for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++) - memset(&priv->tid_data[sta_id][tid], 0, - sizeof(priv->tid_data[sta_id][tid])); - - priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; - - priv->num_stations--; - - if (WARN_ON(priv->num_stations < 0)) - priv->num_stations = 0; - - spin_unlock_bh(&priv->sta_lock); - - return iwl_send_remove_station(priv, addr, sta_id, false); -out_err: - spin_unlock_bh(&priv->sta_lock); - return -EINVAL; -} - -void iwl_deactivate_station(struct iwl_priv *priv, const u8 sta_id, - const u8 *addr) -{ - u8 tid; - - if (!iwl_is_ready(priv)) { - IWL_DEBUG_INFO(priv, - "Unable to remove station %pM, device not ready.\n", - addr); - return; - } - - IWL_DEBUG_ASSOC(priv, "Deactivating STA: %pM (%d)\n", addr, sta_id); - - if (WARN_ON_ONCE(sta_id == IWL_INVALID_STATION)) - return; - - spin_lock_bh(&priv->sta_lock); - - WARN_ON_ONCE(!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)); - - for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++) - memset(&priv->tid_data[sta_id][tid], 0, - sizeof(priv->tid_data[sta_id][tid])); - - priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; - - priv->num_stations--; - - if (WARN_ON_ONCE(priv->num_stations < 0)) - priv->num_stations = 0; - - spin_unlock_bh(&priv->sta_lock); -} - -static void iwl_sta_fill_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - u8 sta_id, struct iwl_link_quality_cmd *link_cmd) -{ - int i, r; - u32 rate_flags = 0; - __le32 rate_n_flags; - - lockdep_assert_held(&priv->mutex); - - memset(link_cmd, 0, sizeof(*link_cmd)); - - /* Set up the rate scaling to start at selected rate, fall back - * all the way down to 1M in IEEE order, and then spin on 1M */ - if (priv->band == IEEE80211_BAND_5GHZ) - r = IWL_RATE_6M_INDEX; - else if (ctx && ctx->vif && ctx->vif->p2p) - r = IWL_RATE_6M_INDEX; - else - r = IWL_RATE_1M_INDEX; - - if (r >= IWL_FIRST_CCK_RATE && r <= IWL_LAST_CCK_RATE) - rate_flags |= RATE_MCS_CCK_MSK; - - rate_flags |= first_antenna(priv->nvm_data->valid_tx_ant) << - RATE_MCS_ANT_POS; - rate_n_flags = iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); - for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) - link_cmd->rs_table[i].rate_n_flags = rate_n_flags; - - link_cmd->general_params.single_stream_ant_msk = - first_antenna(priv->nvm_data->valid_tx_ant); - - link_cmd->general_params.dual_stream_ant_msk = - priv->nvm_data->valid_tx_ant & - ~first_antenna(priv->nvm_data->valid_tx_ant); - if (!link_cmd->general_params.dual_stream_ant_msk) { - link_cmd->general_params.dual_stream_ant_msk = ANT_AB; - } else if (num_of_ant(priv->nvm_data->valid_tx_ant) == 2) { - link_cmd->general_params.dual_stream_ant_msk = - priv->nvm_data->valid_tx_ant; - } - - link_cmd->agg_params.agg_dis_start_th = - LINK_QUAL_AGG_DISABLE_START_DEF; - link_cmd->agg_params.agg_time_limit = - cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF); - - link_cmd->sta_id = sta_id; -} - -/** - * iwl_clear_ucode_stations - clear ucode station table bits - * - * This function clears all the bits in the driver indicating - * which stations are active in the ucode. Call when something - * other than explicit station management would cause this in - * the ucode, e.g. unassociated RXON. - */ -void iwl_clear_ucode_stations(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) -{ - int i; - bool cleared = false; - - IWL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n"); - - spin_lock_bh(&priv->sta_lock); - for (i = 0; i < IWLAGN_STATION_COUNT; i++) { - if (ctx && ctx->ctxid != priv->stations[i].ctxid) - continue; - - if (priv->stations[i].used & IWL_STA_UCODE_ACTIVE) { - IWL_DEBUG_INFO(priv, - "Clearing ucode active for station %d\n", i); - priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; - cleared = true; - } - } - spin_unlock_bh(&priv->sta_lock); - - if (!cleared) - IWL_DEBUG_INFO(priv, - "No active stations found to be cleared\n"); -} - -/** - * iwl_restore_stations() - Restore driver known stations to device - * - * All stations considered active by driver, but not present in ucode, is - * restored. - * - * Function sleeps. - */ -void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx) -{ - struct iwl_addsta_cmd sta_cmd; - static const struct iwl_link_quality_cmd zero_lq = {}; - struct iwl_link_quality_cmd lq; - int i; - bool found = false; - int ret; - bool send_lq; - - if (!iwl_is_ready(priv)) { - IWL_DEBUG_INFO(priv, - "Not ready yet, not restoring any stations.\n"); - return; - } - - IWL_DEBUG_ASSOC(priv, "Restoring all known stations ... start.\n"); - spin_lock_bh(&priv->sta_lock); - for (i = 0; i < IWLAGN_STATION_COUNT; i++) { - if (ctx->ctxid != priv->stations[i].ctxid) - continue; - if ((priv->stations[i].used & IWL_STA_DRIVER_ACTIVE) && - !(priv->stations[i].used & IWL_STA_UCODE_ACTIVE)) { - IWL_DEBUG_ASSOC(priv, "Restoring sta %pM\n", - priv->stations[i].sta.sta.addr); - priv->stations[i].sta.mode = 0; - priv->stations[i].used |= IWL_STA_UCODE_INPROGRESS; - found = true; - } - } - - for (i = 0; i < IWLAGN_STATION_COUNT; i++) { - if ((priv->stations[i].used & IWL_STA_UCODE_INPROGRESS)) { - memcpy(&sta_cmd, &priv->stations[i].sta, - sizeof(struct iwl_addsta_cmd)); - send_lq = false; - if (priv->stations[i].lq) { - if (priv->wowlan) - iwl_sta_fill_lq(priv, ctx, i, &lq); - else - memcpy(&lq, priv->stations[i].lq, - sizeof(struct iwl_link_quality_cmd)); - - if (memcmp(&lq, &zero_lq, sizeof(lq))) - send_lq = true; - } - spin_unlock_bh(&priv->sta_lock); - ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); - if (ret) { - spin_lock_bh(&priv->sta_lock); - IWL_ERR(priv, "Adding station %pM failed.\n", - priv->stations[i].sta.sta.addr); - priv->stations[i].used &= - ~IWL_STA_DRIVER_ACTIVE; - priv->stations[i].used &= - ~IWL_STA_UCODE_INPROGRESS; - continue; - } - /* - * Rate scaling has already been initialized, send - * current LQ command - */ - if (send_lq) - iwl_send_lq_cmd(priv, ctx, &lq, - CMD_SYNC, true); - spin_lock_bh(&priv->sta_lock); - priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS; - } - } - - spin_unlock_bh(&priv->sta_lock); - if (!found) - IWL_DEBUG_INFO(priv, "Restoring all known stations .... " - "no stations to be restored.\n"); - else - IWL_DEBUG_INFO(priv, "Restoring all known stations .... " - "complete.\n"); -} - -int iwl_get_free_ucode_key_offset(struct iwl_priv *priv) -{ - int i; - - for (i = 0; i < priv->sta_key_max_num; i++) - if (!test_and_set_bit(i, &priv->ucode_key_table)) - return i; - - return WEP_INVALID_OFFSET; -} - -void iwl_dealloc_bcast_stations(struct iwl_priv *priv) -{ - int i; - - spin_lock_bh(&priv->sta_lock); - for (i = 0; i < IWLAGN_STATION_COUNT; i++) { - if (!(priv->stations[i].used & IWL_STA_BCAST)) - continue; - - priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; - priv->num_stations--; - if (WARN_ON(priv->num_stations < 0)) - priv->num_stations = 0; - kfree(priv->stations[i].lq); - priv->stations[i].lq = NULL; - } - spin_unlock_bh(&priv->sta_lock); -} - -#ifdef CONFIG_IWLWIFI_DEBUG -static void iwl_dump_lq_cmd(struct iwl_priv *priv, - struct iwl_link_quality_cmd *lq) -{ - int i; - IWL_DEBUG_RATE(priv, "lq station id 0x%x\n", lq->sta_id); - IWL_DEBUG_RATE(priv, "lq ant 0x%X 0x%X\n", - lq->general_params.single_stream_ant_msk, - lq->general_params.dual_stream_ant_msk); - - for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) - IWL_DEBUG_RATE(priv, "lq index %d 0x%X\n", - i, lq->rs_table[i].rate_n_flags); -} -#else -static inline void iwl_dump_lq_cmd(struct iwl_priv *priv, - struct iwl_link_quality_cmd *lq) -{ -} -#endif - -/** - * is_lq_table_valid() - Test one aspect of LQ cmd for validity - * - * It sometimes happens when a HT rate has been in use and we - * loose connectivity with AP then mac80211 will first tell us that the - * current channel is not HT anymore before removing the station. In such a - * scenario the RXON flags will be updated to indicate we are not - * communicating HT anymore, but the LQ command may still contain HT rates. - * Test for this to prevent driver from sending LQ command between the time - * RXON flags are updated and when LQ command is updated. - */ -static bool is_lq_table_valid(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct iwl_link_quality_cmd *lq) -{ - int i; - - if (ctx->ht.enabled) - return true; - - IWL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n", - ctx->active.channel); - for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { - if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & - RATE_MCS_HT_MSK) { - IWL_DEBUG_INFO(priv, - "index %d of LQ expects HT channel\n", - i); - return false; - } - } - return true; -} - -/** - * iwl_send_lq_cmd() - Send link quality command - * @init: This command is sent as part of station initialization right - * after station has been added. - * - * The link quality command is sent as the last step of station creation. - * This is the special case in which init is set and we call a callback in - * this case to clear the state indicating that station creation is in - * progress. - */ -int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - struct iwl_link_quality_cmd *lq, u8 flags, bool init) -{ - int ret = 0; - struct iwl_host_cmd cmd = { - .id = REPLY_TX_LINK_QUALITY_CMD, - .len = { sizeof(struct iwl_link_quality_cmd), }, - .flags = flags, - .data = { lq, }, - }; - - if (WARN_ON(lq->sta_id == IWL_INVALID_STATION)) - return -EINVAL; - - - spin_lock_bh(&priv->sta_lock); - if (!(priv->stations[lq->sta_id].used & IWL_STA_DRIVER_ACTIVE)) { - spin_unlock_bh(&priv->sta_lock); - return -EINVAL; - } - spin_unlock_bh(&priv->sta_lock); - - iwl_dump_lq_cmd(priv, lq); - if (WARN_ON(init && (cmd.flags & CMD_ASYNC))) - return -EINVAL; - - if (is_lq_table_valid(priv, ctx, lq)) - ret = iwl_dvm_send_cmd(priv, &cmd); - else - ret = -EINVAL; - - if (cmd.flags & CMD_ASYNC) - return ret; - - if (init) { - IWL_DEBUG_INFO(priv, "init LQ command complete, " - "clearing sta addition status for sta %d\n", - lq->sta_id); - spin_lock_bh(&priv->sta_lock); - priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; - spin_unlock_bh(&priv->sta_lock); - } - return ret; -} - - -static struct iwl_link_quality_cmd * -iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, - u8 sta_id) -{ - struct iwl_link_quality_cmd *link_cmd; - - link_cmd = kzalloc(sizeof(struct iwl_link_quality_cmd), GFP_KERNEL); - if (!link_cmd) { - IWL_ERR(priv, "Unable to allocate memory for LQ cmd.\n"); - return NULL; - } - - iwl_sta_fill_lq(priv, ctx, sta_id, link_cmd); - - return link_cmd; -} - -/* - * iwlagn_add_bssid_station - Add the special IBSS BSSID station - * - * Function sleeps. - */ -int iwlagn_add_bssid_station(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - const u8 *addr, u8 *sta_id_r) -{ - int ret; - u8 sta_id; - struct iwl_link_quality_cmd *link_cmd; - - if (sta_id_r) - *sta_id_r = IWL_INVALID_STATION; - - ret = iwl_add_station_common(priv, ctx, addr, 0, NULL, &sta_id); - if (ret) { - IWL_ERR(priv, "Unable to add station %pM\n", addr); - return ret; - } - - if (sta_id_r) - *sta_id_r = sta_id; - - spin_lock_bh(&priv->sta_lock); - priv->stations[sta_id].used |= IWL_STA_LOCAL; - spin_unlock_bh(&priv->sta_lock); - - /* Set up default rate scaling table in device's station table */ - link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id); - if (!link_cmd) { - IWL_ERR(priv, - "Unable to initialize rate scaling for station %pM.\n", - addr); - return -ENOMEM; - } - - ret = iwl_send_lq_cmd(priv, ctx, link_cmd, CMD_SYNC, true); - if (ret) - IWL_ERR(priv, "Link quality command failed (%d)\n", ret); - - spin_lock_bh(&priv->sta_lock); - priv->stations[sta_id].lq = link_cmd; - spin_unlock_bh(&priv->sta_lock); - - return 0; -} - -/* - * static WEP keys - * - * For each context, the device has a table of 4 static WEP keys - * (one for each key index) that is updated with the following - * commands. - */ - -static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - bool send_if_empty) -{ - int i, not_empty = 0; - u8 buff[sizeof(struct iwl_wep_cmd) + - sizeof(struct iwl_wep_key) * WEP_KEYS_MAX]; - struct iwl_wep_cmd *wep_cmd = (struct iwl_wep_cmd *)buff; - size_t cmd_size = sizeof(struct iwl_wep_cmd); - struct iwl_host_cmd cmd = { - .id = ctx->wep_key_cmd, - .data = { wep_cmd, }, - .flags = CMD_SYNC, - }; - - might_sleep(); - - memset(wep_cmd, 0, cmd_size + - (sizeof(struct iwl_wep_key) * WEP_KEYS_MAX)); - - for (i = 0; i < WEP_KEYS_MAX ; i++) { - wep_cmd->key[i].key_index = i; - if (ctx->wep_keys[i].key_size) { - wep_cmd->key[i].key_offset = i; - not_empty = 1; - } else { - wep_cmd->key[i].key_offset = WEP_INVALID_OFFSET; - } - - wep_cmd->key[i].key_size = ctx->wep_keys[i].key_size; - memcpy(&wep_cmd->key[i].key[3], ctx->wep_keys[i].key, - ctx->wep_keys[i].key_size); - } - - wep_cmd->global_key_type = WEP_KEY_WEP_TYPE; - wep_cmd->num_keys = WEP_KEYS_MAX; - - cmd_size += sizeof(struct iwl_wep_key) * WEP_KEYS_MAX; - - cmd.len[0] = cmd_size; - - if (not_empty || send_if_empty) - return iwl_dvm_send_cmd(priv, &cmd); - else - return 0; -} - -int iwl_restore_default_wep_keys(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) -{ - lockdep_assert_held(&priv->mutex); - - return iwl_send_static_wepkey_cmd(priv, ctx, false); -} - -int iwl_remove_default_wep_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct ieee80211_key_conf *keyconf) -{ - int ret; - - lockdep_assert_held(&priv->mutex); - - IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n", - keyconf->keyidx); - - memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0])); - if (iwl_is_rfkill(priv)) { - IWL_DEBUG_WEP(priv, - "Not sending REPLY_WEPKEY command due to RFKILL.\n"); - /* but keys in device are clear anyway so return success */ - return 0; - } - ret = iwl_send_static_wepkey_cmd(priv, ctx, 1); - IWL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n", - keyconf->keyidx, ret); - - return ret; -} - -int iwl_set_default_wep_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct ieee80211_key_conf *keyconf) -{ - int ret; - - lockdep_assert_held(&priv->mutex); - - if (keyconf->keylen != WEP_KEY_LEN_128 && - keyconf->keylen != WEP_KEY_LEN_64) { - IWL_DEBUG_WEP(priv, - "Bad WEP key length %d\n", keyconf->keylen); - return -EINVAL; - } - - keyconf->hw_key_idx = IWLAGN_HW_KEY_DEFAULT; - - ctx->wep_keys[keyconf->keyidx].key_size = keyconf->keylen; - memcpy(&ctx->wep_keys[keyconf->keyidx].key, &keyconf->key, - keyconf->keylen); - - ret = iwl_send_static_wepkey_cmd(priv, ctx, false); - IWL_DEBUG_WEP(priv, "Set default WEP key: len=%d idx=%d ret=%d\n", - keyconf->keylen, keyconf->keyidx, ret); - - return ret; -} - -/* - * dynamic (per-station) keys - * - * The dynamic keys are a little more complicated. The device has - * a key cache of up to STA_KEY_MAX_NUM/STA_KEY_MAX_NUM_PAN keys. - * These are linked to stations by a table that contains an index - * into the key table for each station/key index/{mcast,unicast}, - * i.e. it's basically an array of pointers like this: - * key_offset_t key_mapping[NUM_STATIONS][4][2]; - * (it really works differently, but you can think of it as such) - * - * The key uploading and linking happens in the same command, the - * add station command with STA_MODIFY_KEY_MASK. - */ - -static u8 iwlagn_key_sta_id(struct iwl_priv *priv, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; - - if (sta) - return iwl_sta_id(sta); - - /* - * The device expects GTKs for station interfaces to be - * installed as GTKs for the AP station. If we have no - * station ID, then use the ap_sta_id in that case. - */ - if (vif->type == NL80211_IFTYPE_STATION && vif_priv->ctx) - return vif_priv->ctx->ap_sta_id; - - return IWL_INVALID_STATION; -} - -static int iwlagn_send_sta_key(struct iwl_priv *priv, - struct ieee80211_key_conf *keyconf, - u8 sta_id, u32 tkip_iv32, u16 *tkip_p1k, - u32 cmd_flags) -{ - __le16 key_flags; - struct iwl_addsta_cmd sta_cmd; - int i; - - spin_lock_bh(&priv->sta_lock); - memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd)); - spin_unlock_bh(&priv->sta_lock); - - key_flags = cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); - key_flags |= STA_KEY_FLG_MAP_KEY_MSK; - - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_CCMP: - key_flags |= STA_KEY_FLG_CCMP; - memcpy(sta_cmd.key.key, keyconf->key, keyconf->keylen); - break; - case WLAN_CIPHER_SUITE_TKIP: - key_flags |= STA_KEY_FLG_TKIP; - sta_cmd.key.tkip_rx_tsc_byte2 = tkip_iv32; - for (i = 0; i < 5; i++) - sta_cmd.key.tkip_rx_ttak[i] = cpu_to_le16(tkip_p1k[i]); - memcpy(sta_cmd.key.key, keyconf->key, keyconf->keylen); - break; - case WLAN_CIPHER_SUITE_WEP104: - key_flags |= STA_KEY_FLG_KEY_SIZE_MSK; - /* fall through */ - case WLAN_CIPHER_SUITE_WEP40: - key_flags |= STA_KEY_FLG_WEP; - memcpy(&sta_cmd.key.key[3], keyconf->key, keyconf->keylen); - break; - default: - WARN_ON(1); - return -EINVAL; - } - - if (!(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE)) - key_flags |= STA_KEY_MULTICAST_MSK; - - /* key pointer (offset) */ - sta_cmd.key.key_offset = keyconf->hw_key_idx; - - sta_cmd.key.key_flags = key_flags; - sta_cmd.mode = STA_CONTROL_MODIFY_MSK; - sta_cmd.sta.modify_mask = STA_MODIFY_KEY_MASK; - - return iwl_send_add_sta(priv, &sta_cmd, cmd_flags); -} - -void iwl_update_tkip_key(struct iwl_priv *priv, - struct ieee80211_vif *vif, - struct ieee80211_key_conf *keyconf, - struct ieee80211_sta *sta, u32 iv32, u16 *phase1key) -{ - u8 sta_id = iwlagn_key_sta_id(priv, vif, sta); - - if (sta_id == IWL_INVALID_STATION) - return; - - if (iwl_scan_cancel(priv)) { - /* cancel scan failed, just live w/ bad key and rely - briefly on SW decryption */ - return; - } - - iwlagn_send_sta_key(priv, keyconf, sta_id, - iv32, phase1key, CMD_ASYNC); -} - -int iwl_remove_dynamic_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct ieee80211_key_conf *keyconf, - struct ieee80211_sta *sta) -{ - struct iwl_addsta_cmd sta_cmd; - u8 sta_id = iwlagn_key_sta_id(priv, ctx->vif, sta); - __le16 key_flags; - - /* if station isn't there, neither is the key */ - if (sta_id == IWL_INVALID_STATION) - return -ENOENT; - - spin_lock_bh(&priv->sta_lock); - memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd)); - if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) - sta_id = IWL_INVALID_STATION; - spin_unlock_bh(&priv->sta_lock); - - if (sta_id == IWL_INVALID_STATION) - return 0; - - lockdep_assert_held(&priv->mutex); - - ctx->key_mapping_keys--; - - IWL_DEBUG_WEP(priv, "Remove dynamic key: idx=%d sta=%d\n", - keyconf->keyidx, sta_id); - - if (!test_and_clear_bit(keyconf->hw_key_idx, &priv->ucode_key_table)) - IWL_ERR(priv, "offset %d not used in uCode key table.\n", - keyconf->hw_key_idx); - - key_flags = cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); - key_flags |= STA_KEY_FLG_MAP_KEY_MSK | STA_KEY_FLG_NO_ENC | - STA_KEY_FLG_INVALID; - - if (!(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE)) - key_flags |= STA_KEY_MULTICAST_MSK; - - sta_cmd.key.key_flags = key_flags; - sta_cmd.key.key_offset = keyconf->hw_key_idx; - sta_cmd.sta.modify_mask = STA_MODIFY_KEY_MASK; - sta_cmd.mode = STA_CONTROL_MODIFY_MSK; - - return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); -} - -int iwl_set_dynamic_key(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - struct ieee80211_key_conf *keyconf, - struct ieee80211_sta *sta) -{ - struct ieee80211_key_seq seq; - u16 p1k[5]; - int ret; - u8 sta_id = iwlagn_key_sta_id(priv, ctx->vif, sta); - const u8 *addr; - - if (sta_id == IWL_INVALID_STATION) - return -EINVAL; - - lockdep_assert_held(&priv->mutex); - - keyconf->hw_key_idx = iwl_get_free_ucode_key_offset(priv); - if (keyconf->hw_key_idx == WEP_INVALID_OFFSET) - return -ENOSPC; - - ctx->key_mapping_keys++; - - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_TKIP: - if (sta) - addr = sta->addr; - else /* station mode case only */ - addr = ctx->active.bssid_addr; - - /* pre-fill phase 1 key into device cache */ - ieee80211_get_key_rx_seq(keyconf, 0, &seq); - ieee80211_get_tkip_rx_p1k(keyconf, addr, seq.tkip.iv32, p1k); - ret = iwlagn_send_sta_key(priv, keyconf, sta_id, - seq.tkip.iv32, p1k, CMD_SYNC); - break; - case WLAN_CIPHER_SUITE_CCMP: - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - ret = iwlagn_send_sta_key(priv, keyconf, sta_id, - 0, NULL, CMD_SYNC); - break; - default: - IWL_ERR(priv, "Unknown cipher %x\n", keyconf->cipher); - ret = -EINVAL; - } - - if (ret) { - ctx->key_mapping_keys--; - clear_bit(keyconf->hw_key_idx, &priv->ucode_key_table); - } - - IWL_DEBUG_WEP(priv, "Set dynamic key: cipher=%x len=%d idx=%d sta=%pM ret=%d\n", - keyconf->cipher, keyconf->keylen, keyconf->keyidx, - sta ? sta->addr : NULL, ret); - - return ret; -} - -/** - * iwlagn_alloc_bcast_station - add broadcast station into driver's station table. - * - * This adds the broadcast station into the driver's station table - * and marks it driver active, so that it will be restored to the - * device at the next best time. - */ -int iwlagn_alloc_bcast_station(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) -{ - struct iwl_link_quality_cmd *link_cmd; - u8 sta_id; - - spin_lock_bh(&priv->sta_lock); - sta_id = iwl_prep_station(priv, ctx, iwl_bcast_addr, false, NULL); - if (sta_id == IWL_INVALID_STATION) { - IWL_ERR(priv, "Unable to prepare broadcast station\n"); - spin_unlock_bh(&priv->sta_lock); - - return -EINVAL; - } - - priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE; - priv->stations[sta_id].used |= IWL_STA_BCAST; - spin_unlock_bh(&priv->sta_lock); - - link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id); - if (!link_cmd) { - IWL_ERR(priv, - "Unable to initialize rate scaling for bcast station.\n"); - return -ENOMEM; - } - - spin_lock_bh(&priv->sta_lock); - priv->stations[sta_id].lq = link_cmd; - spin_unlock_bh(&priv->sta_lock); - - return 0; -} - -/** - * iwl_update_bcast_station - update broadcast station's LQ command - * - * Only used by iwlagn. Placed here to have all bcast station management - * code together. - */ -int iwl_update_bcast_station(struct iwl_priv *priv, - struct iwl_rxon_context *ctx) -{ - struct iwl_link_quality_cmd *link_cmd; - u8 sta_id = ctx->bcast_sta_id; - - link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id); - if (!link_cmd) { - IWL_ERR(priv, "Unable to initialize rate scaling for bcast station.\n"); - return -ENOMEM; - } - - spin_lock_bh(&priv->sta_lock); - if (priv->stations[sta_id].lq) - kfree(priv->stations[sta_id].lq); - else - IWL_DEBUG_INFO(priv, "Bcast station rate scaling has not been initialized yet.\n"); - priv->stations[sta_id].lq = link_cmd; - spin_unlock_bh(&priv->sta_lock); - - return 0; -} - -int iwl_update_bcast_stations(struct iwl_priv *priv) -{ - struct iwl_rxon_context *ctx; - int ret = 0; - - for_each_context(priv, ctx) { - ret = iwl_update_bcast_station(priv, ctx); - if (ret) - break; - } - - return ret; -} - -/** - * iwl_sta_tx_modify_enable_tid - Enable Tx for this TID in station table - */ -int iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid) -{ - struct iwl_addsta_cmd sta_cmd; - - lockdep_assert_held(&priv->mutex); - - /* Remove "disable" flag, to enable Tx for this TID */ - spin_lock_bh(&priv->sta_lock); - priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX; - priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid)); - priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); - spin_unlock_bh(&priv->sta_lock); - - return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); -} - -int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, - int tid, u16 ssn) -{ - int sta_id; - struct iwl_addsta_cmd sta_cmd; - - lockdep_assert_held(&priv->mutex); - - sta_id = iwl_sta_id(sta); - if (sta_id == IWL_INVALID_STATION) - return -ENXIO; - - spin_lock_bh(&priv->sta_lock); - priv->stations[sta_id].sta.station_flags_msk = 0; - priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK; - priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid; - priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn); - priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); - spin_unlock_bh(&priv->sta_lock); - - return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); -} - -int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, - int tid) -{ - int sta_id; - struct iwl_addsta_cmd sta_cmd; - - lockdep_assert_held(&priv->mutex); - - sta_id = iwl_sta_id(sta); - if (sta_id == IWL_INVALID_STATION) { - IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); - return -ENXIO; - } - - spin_lock_bh(&priv->sta_lock); - priv->stations[sta_id].sta.station_flags_msk = 0; - priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK; - priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid; - priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; - memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); - spin_unlock_bh(&priv->sta_lock); - - return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); -} - - - -void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt) -{ - struct iwl_addsta_cmd cmd = { - .mode = STA_CONTROL_MODIFY_MSK, - .station_flags = STA_FLG_PWR_SAVE_MSK, - .station_flags_msk = STA_FLG_PWR_SAVE_MSK, - .sta.sta_id = sta_id, - .sta.modify_mask = STA_MODIFY_SLEEP_TX_COUNT_MSK, - .sleep_tx_count = cpu_to_le16(cnt), - }; - - iwl_send_add_sta(priv, &cmd, CMD_ASYNC); -} diff --git a/drivers/net/wireless/iwlwifi/dvm/testmode.c b/drivers/net/wireless/iwlwifi/dvm/testmode.c deleted file mode 100644 index b89b9d9b9969..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/testmode.c +++ /dev/null @@ -1,471 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2010 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2010 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "iwl-debug.h" -#include "iwl-trans.h" -#include "dev.h" -#include "agn.h" -#include "iwl-test.h" -#include "iwl-testmode.h" - -static int iwl_testmode_send_cmd(struct iwl_op_mode *op_mode, - struct iwl_host_cmd *cmd) -{ - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - return iwl_dvm_send_cmd(priv, cmd); -} - -static bool iwl_testmode_valid_hw_addr(u32 addr) -{ - if (iwlagn_hw_valid_rtc_data_addr(addr)) - return true; - - if (IWLAGN_RTC_INST_LOWER_BOUND <= addr && - addr < IWLAGN_RTC_INST_UPPER_BOUND) - return true; - - return false; -} - -static u32 iwl_testmode_get_fw_ver(struct iwl_op_mode *op_mode) -{ - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - return priv->fw->ucode_ver; -} - -static struct sk_buff* -iwl_testmode_alloc_reply(struct iwl_op_mode *op_mode, int len) -{ - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - return cfg80211_testmode_alloc_reply_skb(priv->hw->wiphy, len); -} - -static int iwl_testmode_reply(struct iwl_op_mode *op_mode, struct sk_buff *skb) -{ - return cfg80211_testmode_reply(skb); -} - -static struct sk_buff *iwl_testmode_alloc_event(struct iwl_op_mode *op_mode, - int len) -{ - struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode); - return cfg80211_testmode_alloc_event_skb(priv->hw->wiphy, len, - GFP_ATOMIC); -} - -static void iwl_testmode_event(struct iwl_op_mode *op_mode, struct sk_buff *skb) -{ - return cfg80211_testmode_event(skb, GFP_ATOMIC); -} - -static struct iwl_test_ops tst_ops = { - .send_cmd = iwl_testmode_send_cmd, - .valid_hw_addr = iwl_testmode_valid_hw_addr, - .get_fw_ver = iwl_testmode_get_fw_ver, - .alloc_reply = iwl_testmode_alloc_reply, - .reply = iwl_testmode_reply, - .alloc_event = iwl_testmode_alloc_event, - .event = iwl_testmode_event, -}; - -void iwl_testmode_init(struct iwl_priv *priv) -{ - iwl_test_init(&priv->tst, priv->trans, &tst_ops); -} - -void iwl_testmode_free(struct iwl_priv *priv) -{ - iwl_test_free(&priv->tst); -} - -static int iwl_testmode_cfg_init_calib(struct iwl_priv *priv) -{ - struct iwl_notification_wait calib_wait; - static const u8 calib_complete[] = { - CALIBRATION_COMPLETE_NOTIFICATION - }; - int ret; - - iwl_init_notification_wait(&priv->notif_wait, &calib_wait, - calib_complete, ARRAY_SIZE(calib_complete), - NULL, NULL); - ret = iwl_init_alive_start(priv); - if (ret) { - IWL_ERR(priv, "Fail init calibration: %d\n", ret); - goto cfg_init_calib_error; - } - - ret = iwl_wait_notification(&priv->notif_wait, &calib_wait, 2 * HZ); - if (ret) - IWL_ERR(priv, "Error detecting" - " CALIBRATION_COMPLETE_NOTIFICATION: %d\n", ret); - return ret; - -cfg_init_calib_error: - iwl_remove_notification(&priv->notif_wait, &calib_wait); - return ret; -} - -/* - * This function handles the user application commands for driver. - * - * It retrieves command ID carried with IWL_TM_ATTR_COMMAND and calls to the - * handlers respectively. - * - * If it's an unknown commdn ID, -ENOSYS is replied; otherwise, the returned - * value of the actual command execution is replied to the user application. - * - * If there's any message responding to the user space, IWL_TM_ATTR_SYNC_RSP - * is used for carry the message while IWL_TM_ATTR_COMMAND must set to - * IWL_TM_CMD_DEV2APP_SYNC_RSP. - * - * @hw: ieee80211_hw object that represents the device - * @tb: gnl message fields from the user space - */ -static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - struct iwl_trans *trans = priv->trans; - struct sk_buff *skb; - unsigned char *rsp_data_ptr = NULL; - int status = 0, rsp_data_len = 0; - u32 inst_size = 0, data_size = 0; - const struct fw_img *img; - - switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { - case IWL_TM_CMD_APP2DEV_GET_DEVICENAME: - rsp_data_ptr = (unsigned char *)priv->cfg->name; - rsp_data_len = strlen(priv->cfg->name); - skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, - rsp_data_len + 20); - if (!skb) { - IWL_ERR(priv, "Memory allocation fail\n"); - return -ENOMEM; - } - if (nla_put_u32(skb, IWL_TM_ATTR_COMMAND, - IWL_TM_CMD_DEV2APP_SYNC_RSP) || - nla_put(skb, IWL_TM_ATTR_SYNC_RSP, - rsp_data_len, rsp_data_ptr)) - goto nla_put_failure; - status = cfg80211_testmode_reply(skb); - if (status < 0) - IWL_ERR(priv, "Error sending msg : %d\n", status); - break; - - case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW: - status = iwl_load_ucode_wait_alive(priv, IWL_UCODE_INIT); - if (status) - IWL_ERR(priv, "Error loading init ucode: %d\n", status); - break; - - case IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB: - iwl_testmode_cfg_init_calib(priv); - priv->ucode_loaded = false; - iwl_trans_stop_device(trans); - break; - - case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW: - status = iwl_load_ucode_wait_alive(priv, IWL_UCODE_REGULAR); - if (status) { - IWL_ERR(priv, - "Error loading runtime ucode: %d\n", status); - break; - } - status = iwl_alive_start(priv); - if (status) - IWL_ERR(priv, - "Error starting the device: %d\n", status); - break; - - case IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW: - iwl_scan_cancel_timeout(priv, 200); - priv->ucode_loaded = false; - iwl_trans_stop_device(trans); - status = iwl_load_ucode_wait_alive(priv, IWL_UCODE_WOWLAN); - if (status) { - IWL_ERR(priv, - "Error loading WOWLAN ucode: %d\n", status); - break; - } - status = iwl_alive_start(priv); - if (status) - IWL_ERR(priv, - "Error starting the device: %d\n", status); - break; - - case IWL_TM_CMD_APP2DEV_GET_EEPROM: - if (priv->eeprom_blob) { - skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, - priv->eeprom_blob_size + 20); - if (!skb) { - IWL_ERR(priv, "Memory allocation fail\n"); - return -ENOMEM; - } - if (nla_put_u32(skb, IWL_TM_ATTR_COMMAND, - IWL_TM_CMD_DEV2APP_EEPROM_RSP) || - nla_put(skb, IWL_TM_ATTR_EEPROM, - priv->eeprom_blob_size, - priv->eeprom_blob)) - goto nla_put_failure; - status = cfg80211_testmode_reply(skb); - if (status < 0) - IWL_ERR(priv, "Error sending msg : %d\n", - status); - } else - return -ENODATA; - break; - - case IWL_TM_CMD_APP2DEV_FIXRATE_REQ: - if (!tb[IWL_TM_ATTR_FIXRATE]) { - IWL_ERR(priv, "Missing fixrate setting\n"); - return -ENOMSG; - } - priv->tm_fixed_rate = nla_get_u32(tb[IWL_TM_ATTR_FIXRATE]); - break; - - case IWL_TM_CMD_APP2DEV_GET_FW_INFO: - skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, 20 + 8); - if (!skb) { - IWL_ERR(priv, "Memory allocation fail\n"); - return -ENOMEM; - } - if (!priv->ucode_loaded) { - IWL_ERR(priv, "No uCode has not been loaded\n"); - return -EINVAL; - } else { - img = &priv->fw->img[priv->cur_ucode]; - inst_size = img->sec[IWL_UCODE_SECTION_INST].len; - data_size = img->sec[IWL_UCODE_SECTION_DATA].len; - } - if (nla_put_u32(skb, IWL_TM_ATTR_FW_TYPE, priv->cur_ucode) || - nla_put_u32(skb, IWL_TM_ATTR_FW_INST_SIZE, inst_size) || - nla_put_u32(skb, IWL_TM_ATTR_FW_DATA_SIZE, data_size)) - goto nla_put_failure; - status = cfg80211_testmode_reply(skb); - if (status < 0) - IWL_ERR(priv, "Error sending msg : %d\n", status); - break; - - default: - IWL_ERR(priv, "Unknown testmode driver command ID\n"); - return -ENOSYS; - } - return status; - -nla_put_failure: - kfree_skb(skb); - return -EMSGSIZE; -} - -/* - * This function handles the user application switch ucode ownership. - * - * It retrieves the mandatory fields IWL_TM_ATTR_UCODE_OWNER and - * decide who the current owner of the uCode - * - * If the current owner is OWNERSHIP_TM, then the only host command - * can deliver to uCode is from testmode, all the other host commands - * will dropped. - * - * default driver is the owner of uCode in normal operational mode - * - * @hw: ieee80211_hw object that represents the device - * @tb: gnl message fields from the user space - */ -static int iwl_testmode_ownership(struct ieee80211_hw *hw, struct nlattr **tb) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - u8 owner; - - if (!tb[IWL_TM_ATTR_UCODE_OWNER]) { - IWL_ERR(priv, "Missing ucode owner\n"); - return -ENOMSG; - } - - owner = nla_get_u8(tb[IWL_TM_ATTR_UCODE_OWNER]); - if (owner == IWL_OWNERSHIP_DRIVER) { - priv->ucode_owner = owner; - iwl_test_enable_notifications(&priv->tst, false); - } else if (owner == IWL_OWNERSHIP_TM) { - priv->ucode_owner = owner; - iwl_test_enable_notifications(&priv->tst, true); - } else { - IWL_ERR(priv, "Invalid owner\n"); - return -EINVAL; - } - return 0; -} - -/* The testmode gnl message handler that takes the gnl message from the - * user space and parses it per the policy iwl_testmode_gnl_msg_policy, then - * invoke the corresponding handlers. - * - * This function is invoked when there is user space application sending - * gnl message through the testmode tunnel NL80211_CMD_TESTMODE regulated - * by nl80211. - * - * It retrieves the mandatory field, IWL_TM_ATTR_COMMAND, before - * dispatching it to the corresponding handler. - * - * If IWL_TM_ATTR_COMMAND is missing, -ENOMSG is replied to user application; - * -ENOSYS is replied to the user application if the command is unknown; - * Otherwise, the command is dispatched to the respective handler. - * - * @hw: ieee80211_hw object that represents the device - * @data: pointer to user space message - * @len: length in byte of @data - */ -int iwlagn_mac_testmode_cmd(struct ieee80211_hw *hw, void *data, int len) -{ - struct nlattr *tb[IWL_TM_ATTR_MAX]; - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - int result; - - result = iwl_test_parse(&priv->tst, tb, data, len); - if (result) - return result; - - /* in case multiple accesses to the device happens */ - mutex_lock(&priv->mutex); - switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { - case IWL_TM_CMD_APP2DEV_UCODE: - case IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32: - case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE32: - case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8: - case IWL_TM_CMD_APP2DEV_BEGIN_TRACE: - case IWL_TM_CMD_APP2DEV_END_TRACE: - case IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_READ: - case IWL_TM_CMD_APP2DEV_NOTIFICATIONS: - case IWL_TM_CMD_APP2DEV_GET_FW_VERSION: - case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: - case IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_WRITE: - result = iwl_test_handle_cmd(&priv->tst, tb); - break; - - case IWL_TM_CMD_APP2DEV_GET_DEVICENAME: - case IWL_TM_CMD_APP2DEV_LOAD_INIT_FW: - case IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB: - case IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW: - case IWL_TM_CMD_APP2DEV_GET_EEPROM: - case IWL_TM_CMD_APP2DEV_FIXRATE_REQ: - case IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW: - case IWL_TM_CMD_APP2DEV_GET_FW_INFO: - IWL_DEBUG_INFO(priv, "testmode cmd to driver\n"); - result = iwl_testmode_driver(hw, tb); - break; - - case IWL_TM_CMD_APP2DEV_OWNERSHIP: - IWL_DEBUG_INFO(priv, "testmode change uCode ownership\n"); - result = iwl_testmode_ownership(hw, tb); - break; - - default: - IWL_ERR(priv, "Unknown testmode command\n"); - result = -ENOSYS; - break; - } - mutex_unlock(&priv->mutex); - - if (result) - IWL_ERR(priv, "Test cmd failed result=%d\n", result); - return result; -} - -int iwlagn_mac_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *skb, - struct netlink_callback *cb, - void *data, int len) -{ - struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); - int result; - u32 cmd; - - if (cb->args[3]) { - /* offset by 1 since commands start at 0 */ - cmd = cb->args[3] - 1; - } else { - struct nlattr *tb[IWL_TM_ATTR_MAX]; - - result = iwl_test_parse(&priv->tst, tb, data, len); - if (result) - return result; - - cmd = nla_get_u32(tb[IWL_TM_ATTR_COMMAND]); - cb->args[3] = cmd + 1; - } - - /* in case multiple accesses to the device happens */ - mutex_lock(&priv->mutex); - result = iwl_test_dump(&priv->tst, cmd, skb, cb); - mutex_unlock(&priv->mutex); - return result; -} diff --git a/drivers/net/wireless/iwlwifi/dvm/tt.c b/drivers/net/wireless/iwlwifi/dvm/tt.c deleted file mode 100644 index 03f9bc01c0cc..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/tt.c +++ /dev/null @@ -1,691 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2013 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portions of the ieee80211 subsystem header files. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - *****************************************************************************/ - - -#include -#include -#include -#include -#include -#include "iwl-io.h" -#include "iwl-modparams.h" -#include "iwl-debug.h" -#include "agn.h" -#include "dev.h" -#include "commands.h" -#include "tt.h" - -/* default Thermal Throttling transaction table - * Current state | Throttling Down | Throttling Up - *============================================================================= - * Condition Nxt State Condition Nxt State Condition Nxt State - *----------------------------------------------------------------------------- - * IWL_TI_0 T >= 114 CT_KILL 114>T>=105 TI_1 N/A N/A - * IWL_TI_1 T >= 114 CT_KILL 114>T>=110 TI_2 T<=95 TI_0 - * IWL_TI_2 T >= 114 CT_KILL T<=100 TI_1 - * IWL_CT_KILL N/A N/A N/A N/A T<=95 TI_0 - *============================================================================= - */ -static const struct iwl_tt_trans tt_range_0[IWL_TI_STATE_MAX - 1] = { - {IWL_TI_0, IWL_ABSOLUTE_ZERO, 104}, - {IWL_TI_1, 105, CT_KILL_THRESHOLD - 1}, - {IWL_TI_CT_KILL, CT_KILL_THRESHOLD, IWL_ABSOLUTE_MAX} -}; -static const struct iwl_tt_trans tt_range_1[IWL_TI_STATE_MAX - 1] = { - {IWL_TI_0, IWL_ABSOLUTE_ZERO, 95}, - {IWL_TI_2, 110, CT_KILL_THRESHOLD - 1}, - {IWL_TI_CT_KILL, CT_KILL_THRESHOLD, IWL_ABSOLUTE_MAX} -}; -static const struct iwl_tt_trans tt_range_2[IWL_TI_STATE_MAX - 1] = { - {IWL_TI_1, IWL_ABSOLUTE_ZERO, 100}, - {IWL_TI_CT_KILL, CT_KILL_THRESHOLD, IWL_ABSOLUTE_MAX}, - {IWL_TI_CT_KILL, CT_KILL_THRESHOLD, IWL_ABSOLUTE_MAX} -}; -static const struct iwl_tt_trans tt_range_3[IWL_TI_STATE_MAX - 1] = { - {IWL_TI_0, IWL_ABSOLUTE_ZERO, CT_KILL_EXIT_THRESHOLD}, - {IWL_TI_CT_KILL, CT_KILL_EXIT_THRESHOLD + 1, IWL_ABSOLUTE_MAX}, - {IWL_TI_CT_KILL, CT_KILL_EXIT_THRESHOLD + 1, IWL_ABSOLUTE_MAX} -}; - -/* Advance Thermal Throttling default restriction table */ -static const struct iwl_tt_restriction restriction_range[IWL_TI_STATE_MAX] = { - {IWL_ANT_OK_MULTI, IWL_ANT_OK_MULTI, true }, - {IWL_ANT_OK_SINGLE, IWL_ANT_OK_MULTI, true }, - {IWL_ANT_OK_SINGLE, IWL_ANT_OK_SINGLE, false }, - {IWL_ANT_OK_NONE, IWL_ANT_OK_NONE, false } -}; - -bool iwl_tt_is_low_power_state(struct iwl_priv *priv) -{ - struct iwl_tt_mgmt *tt = &priv->thermal_throttle; - - if (tt->state >= IWL_TI_1) - return true; - return false; -} - -u8 iwl_tt_current_power_mode(struct iwl_priv *priv) -{ - struct iwl_tt_mgmt *tt = &priv->thermal_throttle; - - return tt->tt_power_mode; -} - -bool iwl_ht_enabled(struct iwl_priv *priv) -{ - struct iwl_tt_mgmt *tt = &priv->thermal_throttle; - struct iwl_tt_restriction *restriction; - - if (!priv->thermal_throttle.advanced_tt) - return true; - restriction = tt->restriction + tt->state; - return restriction->is_ht; -} - -static bool iwl_within_ct_kill_margin(struct iwl_priv *priv) -{ - s32 temp = priv->temperature; /* degrees CELSIUS except specified */ - bool within_margin = false; - - if (!priv->thermal_throttle.advanced_tt) - within_margin = ((temp + IWL_TT_CT_KILL_MARGIN) >= - CT_KILL_THRESHOLD_LEGACY) ? true : false; - else - within_margin = ((temp + IWL_TT_CT_KILL_MARGIN) >= - CT_KILL_THRESHOLD) ? true : false; - return within_margin; -} - -bool iwl_check_for_ct_kill(struct iwl_priv *priv) -{ - bool is_ct_kill = false; - - if (iwl_within_ct_kill_margin(priv)) { - iwl_tt_enter_ct_kill(priv); - is_ct_kill = true; - } - return is_ct_kill; -} - -enum iwl_antenna_ok iwl_tx_ant_restriction(struct iwl_priv *priv) -{ - struct iwl_tt_mgmt *tt = &priv->thermal_throttle; - struct iwl_tt_restriction *restriction; - - if (!priv->thermal_throttle.advanced_tt) - return IWL_ANT_OK_MULTI; - restriction = tt->restriction + tt->state; - return restriction->tx_stream; -} - -enum iwl_antenna_ok iwl_rx_ant_restriction(struct iwl_priv *priv) -{ - struct iwl_tt_mgmt *tt = &priv->thermal_throttle; - struct iwl_tt_restriction *restriction; - - if (!priv->thermal_throttle.advanced_tt) - return IWL_ANT_OK_MULTI; - restriction = tt->restriction + tt->state; - return restriction->rx_stream; -} - -#define CT_KILL_EXIT_DURATION (5) /* 5 seconds duration */ -#define CT_KILL_WAITING_DURATION (300) /* 300ms duration */ - -/* - * toggle the bit to wake up uCode and check the temperature - * if the temperature is below CT, uCode will stay awake and send card - * state notification with CT_KILL bit clear to inform Thermal Throttling - * Management to change state. Otherwise, uCode will go back to sleep - * without doing anything, driver should continue the 5 seconds timer - * to wake up uCode for temperature check until temperature drop below CT - */ -static void iwl_tt_check_exit_ct_kill(unsigned long data) -{ - struct iwl_priv *priv = (struct iwl_priv *)data; - struct iwl_tt_mgmt *tt = &priv->thermal_throttle; - unsigned long flags; - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - if (tt->state == IWL_TI_CT_KILL) { - if (priv->thermal_throttle.ct_kill_toggle) { - iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_CLR, - CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); - priv->thermal_throttle.ct_kill_toggle = false; - } else { - iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_SET, - CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); - priv->thermal_throttle.ct_kill_toggle = true; - } - iwl_read32(priv->trans, CSR_UCODE_DRV_GP1); - if (iwl_trans_grab_nic_access(priv->trans, false, &flags)) - iwl_trans_release_nic_access(priv->trans, &flags); - - /* Reschedule the ct_kill timer to occur in - * CT_KILL_EXIT_DURATION seconds to ensure we get a - * thermal update */ - IWL_DEBUG_TEMP(priv, "schedule ct_kill exit timer\n"); - mod_timer(&priv->thermal_throttle.ct_kill_exit_tm, - jiffies + CT_KILL_EXIT_DURATION * HZ); - } -} - -static void iwl_perform_ct_kill_task(struct iwl_priv *priv, - bool stop) -{ - if (stop) { - IWL_DEBUG_TEMP(priv, "Stop all queues\n"); - if (priv->mac80211_registered) - ieee80211_stop_queues(priv->hw); - IWL_DEBUG_TEMP(priv, - "Schedule 5 seconds CT_KILL Timer\n"); - mod_timer(&priv->thermal_throttle.ct_kill_exit_tm, - jiffies + CT_KILL_EXIT_DURATION * HZ); - } else { - IWL_DEBUG_TEMP(priv, "Wake all queues\n"); - if (priv->mac80211_registered) - ieee80211_wake_queues(priv->hw); - } -} - -static void iwl_tt_ready_for_ct_kill(unsigned long data) -{ - struct iwl_priv *priv = (struct iwl_priv *)data; - struct iwl_tt_mgmt *tt = &priv->thermal_throttle; - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - /* temperature timer expired, ready to go into CT_KILL state */ - if (tt->state != IWL_TI_CT_KILL) { - IWL_DEBUG_TEMP(priv, "entering CT_KILL state when " - "temperature timer expired\n"); - tt->state = IWL_TI_CT_KILL; - set_bit(STATUS_CT_KILL, &priv->status); - iwl_perform_ct_kill_task(priv, true); - } -} - -static void iwl_prepare_ct_kill_task(struct iwl_priv *priv) -{ - IWL_DEBUG_TEMP(priv, "Prepare to enter IWL_TI_CT_KILL\n"); - /* make request to retrieve statistics information */ - iwl_send_statistics_request(priv, CMD_SYNC, false); - /* Reschedule the ct_kill wait timer */ - mod_timer(&priv->thermal_throttle.ct_kill_waiting_tm, - jiffies + msecs_to_jiffies(CT_KILL_WAITING_DURATION)); -} - -#define IWL_MINIMAL_POWER_THRESHOLD (CT_KILL_THRESHOLD_LEGACY) -#define IWL_REDUCED_PERFORMANCE_THRESHOLD_2 (100) -#define IWL_REDUCED_PERFORMANCE_THRESHOLD_1 (90) - -/* - * Legacy thermal throttling - * 1) Avoid NIC destruction due to high temperatures - * Chip will identify dangerously high temperatures that can - * harm the device and will power down - * 2) Avoid the NIC power down due to high temperature - * Throttle early enough to lower the power consumption before - * drastic steps are needed - */ -static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp, bool force) -{ - struct iwl_tt_mgmt *tt = &priv->thermal_throttle; - enum iwl_tt_state old_state; - -#ifdef CONFIG_IWLWIFI_DEBUG - if ((tt->tt_previous_temp) && - (temp > tt->tt_previous_temp) && - ((temp - tt->tt_previous_temp) > - IWL_TT_INCREASE_MARGIN)) { - IWL_DEBUG_TEMP(priv, - "Temperature increase %d degree Celsius\n", - (temp - tt->tt_previous_temp)); - } -#endif - old_state = tt->state; - /* in Celsius */ - if (temp >= IWL_MINIMAL_POWER_THRESHOLD) - tt->state = IWL_TI_CT_KILL; - else if (temp >= IWL_REDUCED_PERFORMANCE_THRESHOLD_2) - tt->state = IWL_TI_2; - else if (temp >= IWL_REDUCED_PERFORMANCE_THRESHOLD_1) - tt->state = IWL_TI_1; - else - tt->state = IWL_TI_0; - -#ifdef CONFIG_IWLWIFI_DEBUG - tt->tt_previous_temp = temp; -#endif - /* stop ct_kill_waiting_tm timer */ - del_timer_sync(&priv->thermal_throttle.ct_kill_waiting_tm); - if (tt->state != old_state) { - switch (tt->state) { - case IWL_TI_0: - /* - * When the system is ready to go back to IWL_TI_0 - * we only have to call iwl_power_update_mode() to - * do so. - */ - break; - case IWL_TI_1: - tt->tt_power_mode = IWL_POWER_INDEX_3; - break; - case IWL_TI_2: - tt->tt_power_mode = IWL_POWER_INDEX_4; - break; - default: - tt->tt_power_mode = IWL_POWER_INDEX_5; - break; - } - mutex_lock(&priv->mutex); - if (old_state == IWL_TI_CT_KILL) - clear_bit(STATUS_CT_KILL, &priv->status); - if (tt->state != IWL_TI_CT_KILL && - iwl_power_update_mode(priv, true)) { - /* TT state not updated - * try again during next temperature read - */ - if (old_state == IWL_TI_CT_KILL) - set_bit(STATUS_CT_KILL, &priv->status); - tt->state = old_state; - IWL_ERR(priv, "Cannot update power mode, " - "TT state not updated\n"); - } else { - if (tt->state == IWL_TI_CT_KILL) { - if (force) { - set_bit(STATUS_CT_KILL, &priv->status); - iwl_perform_ct_kill_task(priv, true); - } else { - iwl_prepare_ct_kill_task(priv); - tt->state = old_state; - } - } else if (old_state == IWL_TI_CT_KILL && - tt->state != IWL_TI_CT_KILL) - iwl_perform_ct_kill_task(priv, false); - IWL_DEBUG_TEMP(priv, "Temperature state changed %u\n", - tt->state); - IWL_DEBUG_TEMP(priv, "Power Index change to %u\n", - tt->tt_power_mode); - } - mutex_unlock(&priv->mutex); - } -} - -/* - * Advance thermal throttling - * 1) Avoid NIC destruction due to high temperatures - * Chip will identify dangerously high temperatures that can - * harm the device and will power down - * 2) Avoid the NIC power down due to high temperature - * Throttle early enough to lower the power consumption before - * drastic steps are needed - * Actions include relaxing the power down sleep thresholds and - * decreasing the number of TX streams - * 3) Avoid throughput performance impact as much as possible - * - *============================================================================= - * Condition Nxt State Condition Nxt State Condition Nxt State - *----------------------------------------------------------------------------- - * IWL_TI_0 T >= 114 CT_KILL 114>T>=105 TI_1 N/A N/A - * IWL_TI_1 T >= 114 CT_KILL 114>T>=110 TI_2 T<=95 TI_0 - * IWL_TI_2 T >= 114 CT_KILL T<=100 TI_1 - * IWL_CT_KILL N/A N/A N/A N/A T<=95 TI_0 - *============================================================================= - */ -static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force) -{ - struct iwl_tt_mgmt *tt = &priv->thermal_throttle; - int i; - bool changed = false; - enum iwl_tt_state old_state; - struct iwl_tt_trans *transaction; - - old_state = tt->state; - for (i = 0; i < IWL_TI_STATE_MAX - 1; i++) { - /* based on the current TT state, - * find the curresponding transaction table - * each table has (IWL_TI_STATE_MAX - 1) entries - * tt->transaction + ((old_state * (IWL_TI_STATE_MAX - 1)) - * will advance to the correct table. - * then based on the current temperature - * find the next state need to transaction to - * go through all the possible (IWL_TI_STATE_MAX - 1) entries - * in the current table to see if transaction is needed - */ - transaction = tt->transaction + - ((old_state * (IWL_TI_STATE_MAX - 1)) + i); - if (temp >= transaction->tt_low && - temp <= transaction->tt_high) { -#ifdef CONFIG_IWLWIFI_DEBUG - if ((tt->tt_previous_temp) && - (temp > tt->tt_previous_temp) && - ((temp - tt->tt_previous_temp) > - IWL_TT_INCREASE_MARGIN)) { - IWL_DEBUG_TEMP(priv, - "Temperature increase %d " - "degree Celsius\n", - (temp - tt->tt_previous_temp)); - } - tt->tt_previous_temp = temp; -#endif - if (old_state != - transaction->next_state) { - changed = true; - tt->state = - transaction->next_state; - } - break; - } - } - /* stop ct_kill_waiting_tm timer */ - del_timer_sync(&priv->thermal_throttle.ct_kill_waiting_tm); - if (changed) { - if (tt->state >= IWL_TI_1) { - /* force PI = IWL_POWER_INDEX_5 in the case of TI > 0 */ - tt->tt_power_mode = IWL_POWER_INDEX_5; - - if (!iwl_ht_enabled(priv)) { - struct iwl_rxon_context *ctx; - - for_each_context(priv, ctx) { - struct iwl_rxon_cmd *rxon; - - rxon = &ctx->staging; - - /* disable HT */ - rxon->flags &= ~( - RXON_FLG_CHANNEL_MODE_MSK | - RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK | - RXON_FLG_HT40_PROT_MSK | - RXON_FLG_HT_PROT_MSK); - } - } else { - /* check HT capability and set - * according to the system HT capability - * in case get disabled before */ - iwl_set_rxon_ht(priv, &priv->current_ht_config); - } - - } else { - /* - * restore system power setting -- it will be - * recalculated automatically. - */ - - /* check HT capability and set - * according to the system HT capability - * in case get disabled before */ - iwl_set_rxon_ht(priv, &priv->current_ht_config); - } - mutex_lock(&priv->mutex); - if (old_state == IWL_TI_CT_KILL) - clear_bit(STATUS_CT_KILL, &priv->status); - if (tt->state != IWL_TI_CT_KILL && - iwl_power_update_mode(priv, true)) { - /* TT state not updated - * try again during next temperature read - */ - IWL_ERR(priv, "Cannot update power mode, " - "TT state not updated\n"); - if (old_state == IWL_TI_CT_KILL) - set_bit(STATUS_CT_KILL, &priv->status); - tt->state = old_state; - } else { - IWL_DEBUG_TEMP(priv, - "Thermal Throttling to new state: %u\n", - tt->state); - if (old_state != IWL_TI_CT_KILL && - tt->state == IWL_TI_CT_KILL) { - if (force) { - IWL_DEBUG_TEMP(priv, - "Enter IWL_TI_CT_KILL\n"); - set_bit(STATUS_CT_KILL, &priv->status); - iwl_perform_ct_kill_task(priv, true); - } else { - tt->state = old_state; - iwl_prepare_ct_kill_task(priv); - } - } else if (old_state == IWL_TI_CT_KILL && - tt->state != IWL_TI_CT_KILL) { - IWL_DEBUG_TEMP(priv, "Exit IWL_TI_CT_KILL\n"); - iwl_perform_ct_kill_task(priv, false); - } - } - mutex_unlock(&priv->mutex); - } -} - -/* Card State Notification indicated reach critical temperature - * if PSP not enable, no Thermal Throttling function will be performed - * just set the GP1 bit to acknowledge the event - * otherwise, go into IWL_TI_CT_KILL state - * since Card State Notification will not provide any temperature reading - * for Legacy mode - * so just pass the CT_KILL temperature to iwl_legacy_tt_handler() - * for advance mode - * pass CT_KILL_THRESHOLD+1 to make sure move into IWL_TI_CT_KILL state - */ -static void iwl_bg_ct_enter(struct work_struct *work) -{ - struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_enter); - struct iwl_tt_mgmt *tt = &priv->thermal_throttle; - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - if (!iwl_is_ready(priv)) - return; - - if (tt->state != IWL_TI_CT_KILL) { - IWL_ERR(priv, "Device reached critical temperature " - "- ucode going to sleep!\n"); - if (!priv->thermal_throttle.advanced_tt) - iwl_legacy_tt_handler(priv, - IWL_MINIMAL_POWER_THRESHOLD, - true); - else - iwl_advance_tt_handler(priv, - CT_KILL_THRESHOLD + 1, true); - } -} - -/* Card State Notification indicated out of critical temperature - * since Card State Notification will not provide any temperature reading - * so pass the IWL_REDUCED_PERFORMANCE_THRESHOLD_2 temperature - * to iwl_legacy_tt_handler() to get out of IWL_CT_KILL state - */ -static void iwl_bg_ct_exit(struct work_struct *work) -{ - struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_exit); - struct iwl_tt_mgmt *tt = &priv->thermal_throttle; - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - if (!iwl_is_ready(priv)) - return; - - /* stop ct_kill_exit_tm timer */ - del_timer_sync(&priv->thermal_throttle.ct_kill_exit_tm); - - if (tt->state == IWL_TI_CT_KILL) { - IWL_ERR(priv, - "Device temperature below critical" - "- ucode awake!\n"); - /* - * exit from CT_KILL state - * reset the current temperature reading - */ - priv->temperature = 0; - if (!priv->thermal_throttle.advanced_tt) - iwl_legacy_tt_handler(priv, - IWL_REDUCED_PERFORMANCE_THRESHOLD_2, - true); - else - iwl_advance_tt_handler(priv, CT_KILL_EXIT_THRESHOLD, - true); - } -} - -void iwl_tt_enter_ct_kill(struct iwl_priv *priv) -{ - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - IWL_DEBUG_TEMP(priv, "Queueing critical temperature enter.\n"); - queue_work(priv->workqueue, &priv->ct_enter); -} - -void iwl_tt_exit_ct_kill(struct iwl_priv *priv) -{ - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - IWL_DEBUG_TEMP(priv, "Queueing critical temperature exit.\n"); - queue_work(priv->workqueue, &priv->ct_exit); -} - -static void iwl_bg_tt_work(struct work_struct *work) -{ - struct iwl_priv *priv = container_of(work, struct iwl_priv, tt_work); - s32 temp = priv->temperature; /* degrees CELSIUS except specified */ - - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - if (!priv->thermal_throttle.advanced_tt) - iwl_legacy_tt_handler(priv, temp, false); - else - iwl_advance_tt_handler(priv, temp, false); -} - -void iwl_tt_handler(struct iwl_priv *priv) -{ - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) - return; - - IWL_DEBUG_TEMP(priv, "Queueing thermal throttling work.\n"); - queue_work(priv->workqueue, &priv->tt_work); -} - -/* Thermal throttling initialization - * For advance thermal throttling: - * Initialize Thermal Index and temperature threshold table - * Initialize thermal throttling restriction table - */ -void iwl_tt_initialize(struct iwl_priv *priv) -{ - struct iwl_tt_mgmt *tt = &priv->thermal_throttle; - int size = sizeof(struct iwl_tt_trans) * (IWL_TI_STATE_MAX - 1); - struct iwl_tt_trans *transaction; - - IWL_DEBUG_TEMP(priv, "Initialize Thermal Throttling\n"); - - memset(tt, 0, sizeof(struct iwl_tt_mgmt)); - - tt->state = IWL_TI_0; - init_timer(&priv->thermal_throttle.ct_kill_exit_tm); - priv->thermal_throttle.ct_kill_exit_tm.data = (unsigned long)priv; - priv->thermal_throttle.ct_kill_exit_tm.function = - iwl_tt_check_exit_ct_kill; - init_timer(&priv->thermal_throttle.ct_kill_waiting_tm); - priv->thermal_throttle.ct_kill_waiting_tm.data = - (unsigned long)priv; - priv->thermal_throttle.ct_kill_waiting_tm.function = - iwl_tt_ready_for_ct_kill; - /* setup deferred ct kill work */ - INIT_WORK(&priv->tt_work, iwl_bg_tt_work); - INIT_WORK(&priv->ct_enter, iwl_bg_ct_enter); - INIT_WORK(&priv->ct_exit, iwl_bg_ct_exit); - - if (priv->cfg->base_params->adv_thermal_throttle) { - IWL_DEBUG_TEMP(priv, "Advanced Thermal Throttling\n"); - tt->restriction = kcalloc(IWL_TI_STATE_MAX, - sizeof(struct iwl_tt_restriction), - GFP_KERNEL); - tt->transaction = kcalloc(IWL_TI_STATE_MAX * - (IWL_TI_STATE_MAX - 1), - sizeof(struct iwl_tt_trans), - GFP_KERNEL); - if (!tt->restriction || !tt->transaction) { - IWL_ERR(priv, "Fallback to Legacy Throttling\n"); - priv->thermal_throttle.advanced_tt = false; - kfree(tt->restriction); - tt->restriction = NULL; - kfree(tt->transaction); - tt->transaction = NULL; - } else { - transaction = tt->transaction + - (IWL_TI_0 * (IWL_TI_STATE_MAX - 1)); - memcpy(transaction, &tt_range_0[0], size); - transaction = tt->transaction + - (IWL_TI_1 * (IWL_TI_STATE_MAX - 1)); - memcpy(transaction, &tt_range_1[0], size); - transaction = tt->transaction + - (IWL_TI_2 * (IWL_TI_STATE_MAX - 1)); - memcpy(transaction, &tt_range_2[0], size); - transaction = tt->transaction + - (IWL_TI_CT_KILL * (IWL_TI_STATE_MAX - 1)); - memcpy(transaction, &tt_range_3[0], size); - size = sizeof(struct iwl_tt_restriction) * - IWL_TI_STATE_MAX; - memcpy(tt->restriction, - &restriction_range[0], size); - priv->thermal_throttle.advanced_tt = true; - } - } else { - IWL_DEBUG_TEMP(priv, "Legacy Thermal Throttling\n"); - priv->thermal_throttle.advanced_tt = false; - } -} - -/* cleanup thermal throttling management related memory and timer */ -void iwl_tt_exit(struct iwl_priv *priv) -{ - struct iwl_tt_mgmt *tt = &priv->thermal_throttle; - - /* stop ct_kill_exit_tm timer if activated */ - del_timer_sync(&priv->thermal_throttle.ct_kill_exit_tm); - /* stop ct_kill_waiting_tm timer if activated */ - del_timer_sync(&priv->thermal_throttle.ct_kill_waiting_tm); - cancel_work_sync(&priv->tt_work); - cancel_work_sync(&priv->ct_enter); - cancel_work_sync(&priv->ct_exit); - - if (priv->thermal_throttle.advanced_tt) { - /* free advance thermal throttling memory */ - kfree(tt->restriction); - tt->restriction = NULL; - kfree(tt->transaction); - tt->transaction = NULL; - } -} diff --git a/drivers/net/wireless/iwlwifi/dvm/tt.h b/drivers/net/wireless/iwlwifi/dvm/tt.h deleted file mode 100644 index 9356c4b908ca..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/tt.h +++ /dev/null @@ -1,128 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2013 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portions of the ieee80211 subsystem header files. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - *****************************************************************************/ -#ifndef __iwl_tt_setting_h__ -#define __iwl_tt_setting_h__ - -#include "commands.h" - -#define IWL_ABSOLUTE_ZERO 0 -#define IWL_ABSOLUTE_MAX 0xFFFFFFFF -#define IWL_TT_INCREASE_MARGIN 5 -#define IWL_TT_CT_KILL_MARGIN 3 - -enum iwl_antenna_ok { - IWL_ANT_OK_NONE, - IWL_ANT_OK_SINGLE, - IWL_ANT_OK_MULTI, -}; - -/* Thermal Throttling State Machine states */ -enum iwl_tt_state { - IWL_TI_0, /* normal temperature, system power state */ - IWL_TI_1, /* high temperature detect, low power state */ - IWL_TI_2, /* higher temperature detected, lower power state */ - IWL_TI_CT_KILL, /* critical temperature detected, lowest power state */ - IWL_TI_STATE_MAX -}; - -/** - * struct iwl_tt_restriction - Thermal Throttling restriction table - * @tx_stream: number of tx stream allowed - * @is_ht: ht enable/disable - * @rx_stream: number of rx stream allowed - * - * This table is used by advance thermal throttling management - * based on the current thermal throttling state, and determines - * the number of tx/rx streams and the status of HT operation. - */ -struct iwl_tt_restriction { - enum iwl_antenna_ok tx_stream; - enum iwl_antenna_ok rx_stream; - bool is_ht; -}; - -/** - * struct iwl_tt_trans - Thermal Throttling transaction table - * @next_state: next thermal throttling mode - * @tt_low: low temperature threshold to change state - * @tt_high: high temperature threshold to change state - * - * This is used by the advanced thermal throttling algorithm - * to determine the next thermal state to go based on the - * current temperature. - */ -struct iwl_tt_trans { - enum iwl_tt_state next_state; - u32 tt_low; - u32 tt_high; -}; - -/** - * struct iwl_tt_mgnt - Thermal Throttling Management structure - * @advanced_tt: advanced thermal throttle required - * @state: current Thermal Throttling state - * @tt_power_mode: Thermal Throttling power mode index - * being used to set power level when - * when thermal throttling state != IWL_TI_0 - * the tt_power_mode should set to different - * power mode based on the current tt state - * @tt_previous_temperature: last measured temperature - * @iwl_tt_restriction: ptr to restriction tbl, used by advance - * thermal throttling to determine how many tx/rx streams - * should be used in tt state; and can HT be enabled or not - * @iwl_tt_trans: ptr to adv trans table, used by advance thermal throttling - * state transaction - * @ct_kill_toggle: used to toggle the CSR bit when checking uCode temperature - * @ct_kill_exit_tm: timer to exit thermal kill - */ -struct iwl_tt_mgmt { - enum iwl_tt_state state; - bool advanced_tt; - u8 tt_power_mode; - bool ct_kill_toggle; -#ifdef CONFIG_IWLWIFI_DEBUG - s32 tt_previous_temp; -#endif - struct iwl_tt_restriction *restriction; - struct iwl_tt_trans *transaction; - struct timer_list ct_kill_exit_tm; - struct timer_list ct_kill_waiting_tm; -}; - -u8 iwl_tt_current_power_mode(struct iwl_priv *priv); -bool iwl_tt_is_low_power_state(struct iwl_priv *priv); -bool iwl_ht_enabled(struct iwl_priv *priv); -enum iwl_antenna_ok iwl_tx_ant_restriction(struct iwl_priv *priv); -enum iwl_antenna_ok iwl_rx_ant_restriction(struct iwl_priv *priv); -void iwl_tt_enter_ct_kill(struct iwl_priv *priv); -void iwl_tt_exit_ct_kill(struct iwl_priv *priv); -void iwl_tt_handler(struct iwl_priv *priv); -void iwl_tt_initialize(struct iwl_priv *priv); -void iwl_tt_exit(struct iwl_priv *priv); - -#endif /* __iwl_tt_setting_h__ */ diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c deleted file mode 100644 index 20e65d3cc3bd..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/tx.c +++ /dev/null @@ -1,1445 +0,0 @@ -/****************************************************************************** - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#include -#include -#include -#include -#include -#include "iwl-io.h" -#include "iwl-trans.h" -#include "iwl-agn-hw.h" -#include "dev.h" -#include "agn.h" - -static const u8 tid_to_ac[] = { - IEEE80211_AC_BE, - IEEE80211_AC_BK, - IEEE80211_AC_BK, - IEEE80211_AC_BE, - IEEE80211_AC_VI, - IEEE80211_AC_VI, - IEEE80211_AC_VO, - IEEE80211_AC_VO, -}; - -static void iwlagn_tx_cmd_protection(struct iwl_priv *priv, - struct ieee80211_tx_info *info, - __le16 fc, __le32 *tx_flags) -{ - if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS || - info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT || - info->flags & IEEE80211_TX_CTL_AMPDU) - *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK; -} - -/* - * handle build REPLY_TX command notification. - */ -static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv, - struct sk_buff *skb, - struct iwl_tx_cmd *tx_cmd, - struct ieee80211_tx_info *info, - struct ieee80211_hdr *hdr, u8 sta_id) -{ - __le16 fc = hdr->frame_control; - __le32 tx_flags = tx_cmd->tx_flags; - - tx_cmd->stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; - - if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) - tx_flags |= TX_CMD_FLG_ACK_MSK; - else - tx_flags &= ~TX_CMD_FLG_ACK_MSK; - - if (ieee80211_is_probe_resp(fc)) - tx_flags |= TX_CMD_FLG_TSF_MSK; - else if (ieee80211_is_back_req(fc)) - tx_flags |= TX_CMD_FLG_ACK_MSK | TX_CMD_FLG_IMM_BA_RSP_MASK; - else if (info->band == IEEE80211_BAND_2GHZ && - priv->cfg->bt_params && - priv->cfg->bt_params->advanced_bt_coexist && - (ieee80211_is_auth(fc) || ieee80211_is_assoc_req(fc) || - ieee80211_is_reassoc_req(fc) || - skb->protocol == cpu_to_be16(ETH_P_PAE))) - tx_flags |= TX_CMD_FLG_IGNORE_BT; - - - tx_cmd->sta_id = sta_id; - if (ieee80211_has_morefrags(fc)) - tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK; - - if (ieee80211_is_data_qos(fc)) { - u8 *qc = ieee80211_get_qos_ctl(hdr); - tx_cmd->tid_tspec = qc[0] & 0xf; - tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK; - } else { - tx_cmd->tid_tspec = IWL_TID_NON_QOS; - if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) - tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; - else - tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK; - } - - iwlagn_tx_cmd_protection(priv, info, fc, &tx_flags); - - tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK); - if (ieee80211_is_mgmt(fc)) { - if (ieee80211_is_assoc_req(fc) || ieee80211_is_reassoc_req(fc)) - tx_cmd->timeout.pm_frame_timeout = cpu_to_le16(3); - else - tx_cmd->timeout.pm_frame_timeout = cpu_to_le16(2); - } else { - tx_cmd->timeout.pm_frame_timeout = 0; - } - - tx_cmd->driver_txop = 0; - tx_cmd->tx_flags = tx_flags; - tx_cmd->next_frame_len = 0; -} - -static void iwlagn_tx_cmd_build_rate(struct iwl_priv *priv, - struct iwl_tx_cmd *tx_cmd, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - __le16 fc) -{ - u32 rate_flags; - int rate_idx; - u8 rts_retry_limit; - u8 data_retry_limit; - u8 rate_plcp; - - if (priv->wowlan) { - rts_retry_limit = IWLAGN_LOW_RETRY_LIMIT; - data_retry_limit = IWLAGN_LOW_RETRY_LIMIT; - } else { - /* Set retry limit on RTS packets */ - rts_retry_limit = IWLAGN_RTS_DFAULT_RETRY_LIMIT; - - /* Set retry limit on DATA packets and Probe Responses*/ - if (ieee80211_is_probe_resp(fc)) { - data_retry_limit = IWLAGN_MGMT_DFAULT_RETRY_LIMIT; - rts_retry_limit = - min(data_retry_limit, rts_retry_limit); - } else if (ieee80211_is_back_req(fc)) - data_retry_limit = IWLAGN_BAR_DFAULT_RETRY_LIMIT; - else - data_retry_limit = IWLAGN_DEFAULT_TX_RETRY; - } - - tx_cmd->data_retry_limit = data_retry_limit; - tx_cmd->rts_retry_limit = rts_retry_limit; - - /* DATA packets will use the uCode station table for rate/antenna - * selection */ - if (ieee80211_is_data(fc)) { - tx_cmd->initial_rate_index = 0; - tx_cmd->tx_flags |= TX_CMD_FLG_STA_RATE_MSK; -#ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE - if (priv->tm_fixed_rate) { - /* - * rate overwrite by testmode - * we not only send lq command to change rate - * we also re-enforce per data pkt base. - */ - tx_cmd->tx_flags &= ~TX_CMD_FLG_STA_RATE_MSK; - memcpy(&tx_cmd->rate_n_flags, &priv->tm_fixed_rate, - sizeof(tx_cmd->rate_n_flags)); - } -#endif - return; - } else if (ieee80211_is_back_req(fc)) - tx_cmd->tx_flags |= TX_CMD_FLG_STA_RATE_MSK; - - /** - * If the current TX rate stored in mac80211 has the MCS bit set, it's - * not really a TX rate. Thus, we use the lowest supported rate for - * this band. Also use the lowest supported rate if the stored rate - * index is invalid. - */ - rate_idx = info->control.rates[0].idx; - if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS || - (rate_idx < 0) || (rate_idx > IWL_RATE_COUNT_LEGACY)) - rate_idx = rate_lowest_index( - &priv->nvm_data->bands[info->band], sta); - /* For 5 GHZ band, remap mac80211 rate indices into driver indices */ - if (info->band == IEEE80211_BAND_5GHZ) - rate_idx += IWL_FIRST_OFDM_RATE; - /* Get PLCP rate for tx_cmd->rate_n_flags */ - rate_plcp = iwl_rates[rate_idx].plcp; - /* Zero out flags for this packet */ - rate_flags = 0; - - /* Set CCK flag as needed */ - if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE)) - rate_flags |= RATE_MCS_CCK_MSK; - - /* Set up antennas */ - if (priv->cfg->bt_params && - priv->cfg->bt_params->advanced_bt_coexist && - priv->bt_full_concurrent) { - /* operated as 1x1 in full concurrency mode */ - priv->mgmt_tx_ant = iwl_toggle_tx_ant(priv, priv->mgmt_tx_ant, - first_antenna(priv->nvm_data->valid_tx_ant)); - } else - priv->mgmt_tx_ant = iwl_toggle_tx_ant( - priv, priv->mgmt_tx_ant, - priv->nvm_data->valid_tx_ant); - rate_flags |= iwl_ant_idx_to_flags(priv->mgmt_tx_ant); - - /* Set the rate in the TX cmd */ - tx_cmd->rate_n_flags = iwl_hw_set_rate_n_flags(rate_plcp, rate_flags); -} - -static void iwlagn_tx_cmd_build_hwcrypto(struct iwl_priv *priv, - struct ieee80211_tx_info *info, - struct iwl_tx_cmd *tx_cmd, - struct sk_buff *skb_frag) -{ - struct ieee80211_key_conf *keyconf = info->control.hw_key; - - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_CCMP: - tx_cmd->sec_ctl = TX_CMD_SEC_CCM; - memcpy(tx_cmd->key, keyconf->key, keyconf->keylen); - if (info->flags & IEEE80211_TX_CTL_AMPDU) - tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK; - break; - - case WLAN_CIPHER_SUITE_TKIP: - tx_cmd->sec_ctl = TX_CMD_SEC_TKIP; - ieee80211_get_tkip_p2k(keyconf, skb_frag, tx_cmd->key); - break; - - case WLAN_CIPHER_SUITE_WEP104: - tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128; - /* fall through */ - case WLAN_CIPHER_SUITE_WEP40: - tx_cmd->sec_ctl |= (TX_CMD_SEC_WEP | - (keyconf->keyidx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT); - - memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen); - - IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption " - "with key %d\n", keyconf->keyidx); - break; - - default: - IWL_ERR(priv, "Unknown encode cipher %x\n", keyconf->cipher); - break; - } -} - -/** - * iwl_sta_id_or_broadcast - return sta_id or broadcast sta - * @context: the current context - * @sta: mac80211 station - * - * In certain circumstances mac80211 passes a station pointer - * that may be %NULL, for example during TX or key setup. In - * that case, we need to use the broadcast station, so this - * inline wraps that pattern. - */ -static int iwl_sta_id_or_broadcast(struct iwl_rxon_context *context, - struct ieee80211_sta *sta) -{ - int sta_id; - - if (!sta) - return context->bcast_sta_id; - - sta_id = iwl_sta_id(sta); - - /* - * mac80211 should not be passing a partially - * initialised station! - */ - WARN_ON(sta_id == IWL_INVALID_STATION); - - return sta_id; -} - -/* - * start REPLY_TX command process - */ -int iwlagn_tx_skb(struct iwl_priv *priv, - struct ieee80211_sta *sta, - struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct iwl_station_priv *sta_priv = NULL; - struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; - struct iwl_device_cmd *dev_cmd; - struct iwl_tx_cmd *tx_cmd; - __le16 fc; - u8 hdr_len; - u16 len, seq_number = 0; - u8 sta_id, tid = IWL_MAX_TID_COUNT; - bool is_agg = false, is_data_qos = false; - int txq_id; - - if (info->control.vif) - ctx = iwl_rxon_ctx_from_vif(info->control.vif); - - if (iwl_is_rfkill(priv)) { - IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n"); - goto drop_unlock_priv; - } - - fc = hdr->frame_control; - -#ifdef CONFIG_IWLWIFI_DEBUG - if (ieee80211_is_auth(fc)) - IWL_DEBUG_TX(priv, "Sending AUTH frame\n"); - else if (ieee80211_is_assoc_req(fc)) - IWL_DEBUG_TX(priv, "Sending ASSOC frame\n"); - else if (ieee80211_is_reassoc_req(fc)) - IWL_DEBUG_TX(priv, "Sending REASSOC frame\n"); -#endif - - if (unlikely(ieee80211_is_probe_resp(fc))) { - struct iwl_wipan_noa_data *noa_data = - rcu_dereference(priv->noa_data); - - if (noa_data && - pskb_expand_head(skb, 0, noa_data->length, - GFP_ATOMIC) == 0) { - memcpy(skb_put(skb, noa_data->length), - noa_data->data, noa_data->length); - hdr = (struct ieee80211_hdr *)skb->data; - } - } - - hdr_len = ieee80211_hdrlen(fc); - - /* For management frames use broadcast id to do not break aggregation */ - if (!ieee80211_is_data(fc)) - sta_id = ctx->bcast_sta_id; - else { - /* Find index into station table for destination station */ - sta_id = iwl_sta_id_or_broadcast(ctx, sta); - if (sta_id == IWL_INVALID_STATION) { - IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", - hdr->addr1); - goto drop_unlock_priv; - } - } - - if (sta) - sta_priv = (void *)sta->drv_priv; - - if (sta_priv && sta_priv->asleep && - (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)) { - /* - * This sends an asynchronous command to the device, - * but we can rely on it being processed before the - * next frame is processed -- and the next frame to - * this station is the one that will consume this - * counter. - * For now set the counter to just 1 since we do not - * support uAPSD yet. - * - * FIXME: If we get two non-bufferable frames one - * after the other, we might only send out one of - * them because this is racy. - */ - iwl_sta_modify_sleep_tx_count(priv, sta_id, 1); - } - - dev_cmd = iwl_trans_alloc_tx_cmd(priv->trans); - - if (unlikely(!dev_cmd)) - goto drop_unlock_priv; - - memset(dev_cmd, 0, sizeof(*dev_cmd)); - tx_cmd = (struct iwl_tx_cmd *) dev_cmd->payload; - - /* Total # bytes to be transmitted */ - len = (u16)skb->len; - tx_cmd->len = cpu_to_le16(len); - - if (info->control.hw_key) - iwlagn_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb); - - /* TODO need this for burst mode later on */ - iwlagn_tx_cmd_build_basic(priv, skb, tx_cmd, info, hdr, sta_id); - - iwlagn_tx_cmd_build_rate(priv, tx_cmd, info, sta, fc); - - memset(&info->status, 0, sizeof(info->status)); - - info->driver_data[0] = ctx; - info->driver_data[1] = dev_cmd; - /* From now on, we cannot access info->control */ - - spin_lock(&priv->sta_lock); - - if (ieee80211_is_data_qos(fc) && !ieee80211_is_qos_nullfunc(fc)) { - u8 *qc = NULL; - struct iwl_tid_data *tid_data; - qc = ieee80211_get_qos_ctl(hdr); - tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; - if (WARN_ON_ONCE(tid >= IWL_MAX_TID_COUNT)) - goto drop_unlock_sta; - tid_data = &priv->tid_data[sta_id][tid]; - - /* aggregation is on for this */ - if (info->flags & IEEE80211_TX_CTL_AMPDU && - tid_data->agg.state != IWL_AGG_ON) { - IWL_ERR(priv, "TX_CTL_AMPDU while not in AGG:" - " Tx flags = 0x%08x, agg.state = %d", - info->flags, tid_data->agg.state); - IWL_ERR(priv, "sta_id = %d, tid = %d seq_num = %d", - sta_id, tid, - IEEE80211_SEQ_TO_SN(tid_data->seq_number)); - goto drop_unlock_sta; - } - - /* We can receive packets from the stack in IWL_AGG_{ON,OFF} - * only. Check this here. - */ - if (WARN_ONCE(tid_data->agg.state != IWL_AGG_ON && - tid_data->agg.state != IWL_AGG_OFF, - "Tx while agg.state = %d", tid_data->agg.state)) - goto drop_unlock_sta; - - seq_number = tid_data->seq_number; - seq_number &= IEEE80211_SCTL_SEQ; - hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); - hdr->seq_ctrl |= cpu_to_le16(seq_number); - seq_number += 0x10; - - if (info->flags & IEEE80211_TX_CTL_AMPDU) - is_agg = true; - is_data_qos = true; - } - - /* Copy MAC header from skb into command buffer */ - memcpy(tx_cmd->hdr, hdr, hdr_len); - - txq_id = info->hw_queue; - - if (is_agg) - txq_id = priv->tid_data[sta_id][tid].agg.txq_id; - else if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { - /* - * The microcode will clear the more data - * bit in the last frame it transmits. - */ - hdr->frame_control |= - cpu_to_le16(IEEE80211_FCTL_MOREDATA); - } - - WARN_ON_ONCE(is_agg && - priv->queue_to_mac80211[txq_id] != info->hw_queue); - - IWL_DEBUG_TX(priv, "TX to [%d|%d] Q:%d - seq: 0x%x\n", sta_id, tid, - txq_id, seq_number); - - if (iwl_trans_tx(priv->trans, skb, dev_cmd, txq_id)) - goto drop_unlock_sta; - - if (is_data_qos && !ieee80211_has_morefrags(fc)) - priv->tid_data[sta_id][tid].seq_number = seq_number; - - spin_unlock(&priv->sta_lock); - - /* - * Avoid atomic ops if it isn't an associated client. - * Also, if this is a packet for aggregation, don't - * increase the counter because the ucode will stop - * aggregation queues when their respective station - * goes to sleep. - */ - if (sta_priv && sta_priv->client && !is_agg) - atomic_inc(&sta_priv->pending_frames); - - if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) - iwl_scan_offchannel_skb(priv); - - return 0; - -drop_unlock_sta: - if (dev_cmd) - iwl_trans_free_tx_cmd(priv->trans, dev_cmd); - spin_unlock(&priv->sta_lock); -drop_unlock_priv: - return -1; -} - -static int iwlagn_alloc_agg_txq(struct iwl_priv *priv, int mq) -{ - int q; - - for (q = IWLAGN_FIRST_AMPDU_QUEUE; - q < priv->cfg->base_params->num_of_queues; q++) { - if (!test_and_set_bit(q, priv->agg_q_alloc)) { - priv->queue_to_mac80211[q] = mq; - return q; - } - } - - return -ENOSPC; -} - -static void iwlagn_dealloc_agg_txq(struct iwl_priv *priv, int q) -{ - clear_bit(q, priv->agg_q_alloc); - priv->queue_to_mac80211[q] = IWL_INVALID_MAC80211_QUEUE; -} - -int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid) -{ - struct iwl_tid_data *tid_data; - int sta_id, txq_id; - enum iwl_agg_state agg_state; - - sta_id = iwl_sta_id(sta); - - if (sta_id == IWL_INVALID_STATION) { - IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); - return -ENXIO; - } - - spin_lock_bh(&priv->sta_lock); - - tid_data = &priv->tid_data[sta_id][tid]; - txq_id = tid_data->agg.txq_id; - - switch (tid_data->agg.state) { - case IWL_EMPTYING_HW_QUEUE_ADDBA: - /* - * This can happen if the peer stops aggregation - * again before we've had a chance to drain the - * queue we selected previously, i.e. before the - * session was really started completely. - */ - IWL_DEBUG_HT(priv, "AGG stop before setup done\n"); - goto turn_off; - case IWL_AGG_STARTING: - /* - * This can happen when the session is stopped before - * we receive ADDBA response - */ - IWL_DEBUG_HT(priv, "AGG stop before AGG became operational\n"); - goto turn_off; - case IWL_AGG_ON: - break; - default: - IWL_WARN(priv, - "Stopping AGG while state not ON or starting for %d on %d (%d)\n", - sta_id, tid, tid_data->agg.state); - spin_unlock_bh(&priv->sta_lock); - return 0; - } - - tid_data->agg.ssn = IEEE80211_SEQ_TO_SN(tid_data->seq_number); - - /* There are still packets for this RA / TID in the HW */ - if (!test_bit(txq_id, priv->agg_q_alloc)) { - IWL_DEBUG_TX_QUEUES(priv, - "stopping AGG on STA/TID %d/%d but hwq %d not used\n", - sta_id, tid, txq_id); - } else if (tid_data->agg.ssn != tid_data->next_reclaimed) { - IWL_DEBUG_TX_QUEUES(priv, - "Can't proceed: ssn %d, next_recl = %d\n", - tid_data->agg.ssn, - tid_data->next_reclaimed); - tid_data->agg.state = IWL_EMPTYING_HW_QUEUE_DELBA; - spin_unlock_bh(&priv->sta_lock); - return 0; - } - - IWL_DEBUG_TX_QUEUES(priv, "Can proceed: ssn = next_recl = %d\n", - tid_data->agg.ssn); -turn_off: - agg_state = tid_data->agg.state; - tid_data->agg.state = IWL_AGG_OFF; - - spin_unlock_bh(&priv->sta_lock); - - if (test_bit(txq_id, priv->agg_q_alloc)) { - /* - * If the transport didn't know that we wanted to start - * agreggation, don't tell it that we want to stop them. - * This can happen when we don't get the addBA response on - * time, or we hadn't time to drain the AC queues. - */ - if (agg_state == IWL_AGG_ON) - iwl_trans_txq_disable(priv->trans, txq_id); - else - IWL_DEBUG_TX_QUEUES(priv, "Don't disable tx agg: %d\n", - agg_state); - iwlagn_dealloc_agg_txq(priv, txq_id); - } - - ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); - - return 0; -} - -int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid, u16 *ssn) -{ - struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); - struct iwl_tid_data *tid_data; - int sta_id, txq_id, ret; - - IWL_DEBUG_HT(priv, "TX AGG request on ra = %pM tid = %d\n", - sta->addr, tid); - - sta_id = iwl_sta_id(sta); - if (sta_id == IWL_INVALID_STATION) { - IWL_ERR(priv, "Start AGG on invalid station\n"); - return -ENXIO; - } - if (unlikely(tid >= IWL_MAX_TID_COUNT)) - return -EINVAL; - - if (priv->tid_data[sta_id][tid].agg.state != IWL_AGG_OFF) { - IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n"); - return -ENXIO; - } - - txq_id = iwlagn_alloc_agg_txq(priv, ctx->ac_to_queue[tid_to_ac[tid]]); - if (txq_id < 0) { - IWL_DEBUG_TX_QUEUES(priv, - "No free aggregation queue for %pM/%d\n", - sta->addr, tid); - return txq_id; - } - - ret = iwl_sta_tx_modify_enable_tid(priv, sta_id, tid); - if (ret) - return ret; - - spin_lock_bh(&priv->sta_lock); - tid_data = &priv->tid_data[sta_id][tid]; - tid_data->agg.ssn = IEEE80211_SEQ_TO_SN(tid_data->seq_number); - tid_data->agg.txq_id = txq_id; - - *ssn = tid_data->agg.ssn; - - if (*ssn == tid_data->next_reclaimed) { - IWL_DEBUG_TX_QUEUES(priv, "Can proceed: ssn = next_recl = %d\n", - tid_data->agg.ssn); - tid_data->agg.state = IWL_AGG_STARTING; - ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); - } else { - IWL_DEBUG_TX_QUEUES(priv, "Can't proceed: ssn %d, " - "next_reclaimed = %d\n", - tid_data->agg.ssn, - tid_data->next_reclaimed); - tid_data->agg.state = IWL_EMPTYING_HW_QUEUE_ADDBA; - } - spin_unlock_bh(&priv->sta_lock); - - return ret; -} - -int iwlagn_tx_agg_flush(struct iwl_priv *priv, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid) -{ - struct iwl_tid_data *tid_data; - enum iwl_agg_state agg_state; - int sta_id, txq_id; - sta_id = iwl_sta_id(sta); - - /* - * First set the agg state to OFF to avoid calling - * ieee80211_stop_tx_ba_cb in iwlagn_check_ratid_empty. - */ - spin_lock_bh(&priv->sta_lock); - - tid_data = &priv->tid_data[sta_id][tid]; - txq_id = tid_data->agg.txq_id; - agg_state = tid_data->agg.state; - IWL_DEBUG_TX_QUEUES(priv, "Flush AGG: sta %d tid %d q %d state %d\n", - sta_id, tid, txq_id, tid_data->agg.state); - - tid_data->agg.state = IWL_AGG_OFF; - - spin_unlock_bh(&priv->sta_lock); - - if (iwlagn_txfifo_flush(priv, BIT(txq_id))) - IWL_ERR(priv, "Couldn't flush the AGG queue\n"); - - if (test_bit(txq_id, priv->agg_q_alloc)) { - /* - * If the transport didn't know that we wanted to start - * agreggation, don't tell it that we want to stop them. - * This can happen when we don't get the addBA response on - * time, or we hadn't time to drain the AC queues. - */ - if (agg_state == IWL_AGG_ON) - iwl_trans_txq_disable(priv->trans, txq_id); - else - IWL_DEBUG_TX_QUEUES(priv, "Don't disable tx agg: %d\n", - agg_state); - iwlagn_dealloc_agg_txq(priv, txq_id); - } - - return 0; -} - -int iwlagn_tx_agg_oper(struct iwl_priv *priv, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid, u8 buf_size) -{ - struct iwl_station_priv *sta_priv = (void *) sta->drv_priv; - struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); - int q, fifo; - u16 ssn; - - buf_size = min_t(int, buf_size, LINK_QUAL_AGG_FRAME_LIMIT_DEF); - - spin_lock_bh(&priv->sta_lock); - ssn = priv->tid_data[sta_priv->sta_id][tid].agg.ssn; - q = priv->tid_data[sta_priv->sta_id][tid].agg.txq_id; - priv->tid_data[sta_priv->sta_id][tid].agg.state = IWL_AGG_ON; - spin_unlock_bh(&priv->sta_lock); - - fifo = ctx->ac_to_fifo[tid_to_ac[tid]]; - - iwl_trans_txq_enable(priv->trans, q, fifo, sta_priv->sta_id, tid, - buf_size, ssn); - - /* - * If the limit is 0, then it wasn't initialised yet, - * use the default. We can do that since we take the - * minimum below, and we don't want to go above our - * default due to hardware restrictions. - */ - if (sta_priv->max_agg_bufsize == 0) - sta_priv->max_agg_bufsize = - LINK_QUAL_AGG_FRAME_LIMIT_DEF; - - /* - * Even though in theory the peer could have different - * aggregation reorder buffer sizes for different sessions, - * our ucode doesn't allow for that and has a global limit - * for each station. Therefore, use the minimum of all the - * aggregation sessions and our default value. - */ - sta_priv->max_agg_bufsize = - min(sta_priv->max_agg_bufsize, buf_size); - - if (priv->hw_params.use_rts_for_aggregation) { - /* - * switch to RTS/CTS if it is the prefer protection - * method for HT traffic - */ - - sta_priv->lq_sta.lq.general_params.flags |= - LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK; - } - priv->agg_tids_count++; - IWL_DEBUG_HT(priv, "priv->agg_tids_count = %u\n", - priv->agg_tids_count); - - sta_priv->lq_sta.lq.agg_params.agg_frame_cnt_limit = - sta_priv->max_agg_bufsize; - - IWL_DEBUG_HT(priv, "Tx aggregation enabled on ra = %pM tid = %d\n", - sta->addr, tid); - - return iwl_send_lq_cmd(priv, ctx, - &sta_priv->lq_sta.lq, CMD_ASYNC, false); -} - -static void iwlagn_check_ratid_empty(struct iwl_priv *priv, int sta_id, u8 tid) -{ - struct iwl_tid_data *tid_data = &priv->tid_data[sta_id][tid]; - enum iwl_rxon_context_id ctx; - struct ieee80211_vif *vif; - u8 *addr; - - lockdep_assert_held(&priv->sta_lock); - - addr = priv->stations[sta_id].sta.sta.addr; - ctx = priv->stations[sta_id].ctxid; - vif = priv->contexts[ctx].vif; - - switch (priv->tid_data[sta_id][tid].agg.state) { - case IWL_EMPTYING_HW_QUEUE_DELBA: - /* There are no packets for this RA / TID in the HW any more */ - if (tid_data->agg.ssn == tid_data->next_reclaimed) { - IWL_DEBUG_TX_QUEUES(priv, - "Can continue DELBA flow ssn = next_recl =" - " %d", tid_data->next_reclaimed); - iwl_trans_txq_disable(priv->trans, - tid_data->agg.txq_id); - iwlagn_dealloc_agg_txq(priv, tid_data->agg.txq_id); - tid_data->agg.state = IWL_AGG_OFF; - ieee80211_stop_tx_ba_cb_irqsafe(vif, addr, tid); - } - break; - case IWL_EMPTYING_HW_QUEUE_ADDBA: - /* There are no packets for this RA / TID in the HW any more */ - if (tid_data->agg.ssn == tid_data->next_reclaimed) { - IWL_DEBUG_TX_QUEUES(priv, - "Can continue ADDBA flow ssn = next_recl =" - " %d", tid_data->next_reclaimed); - tid_data->agg.state = IWL_AGG_STARTING; - ieee80211_start_tx_ba_cb_irqsafe(vif, addr, tid); - } - break; - default: - break; - } -} - -static void iwlagn_non_agg_tx_status(struct iwl_priv *priv, - struct iwl_rxon_context *ctx, - const u8 *addr1) -{ - struct ieee80211_sta *sta; - struct iwl_station_priv *sta_priv; - - rcu_read_lock(); - sta = ieee80211_find_sta(ctx->vif, addr1); - if (sta) { - sta_priv = (void *)sta->drv_priv; - /* avoid atomic ops if this isn't a client */ - if (sta_priv->client && - atomic_dec_return(&sta_priv->pending_frames) == 0) - ieee80211_sta_block_awake(priv->hw, sta, false); - } - rcu_read_unlock(); -} - -/** - * translate ucode response to mac80211 tx status control values - */ -static void iwlagn_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, - struct ieee80211_tx_info *info) -{ - struct ieee80211_tx_rate *r = &info->status.rates[0]; - - info->status.antenna = - ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS); - if (rate_n_flags & RATE_MCS_HT_MSK) - r->flags |= IEEE80211_TX_RC_MCS; - if (rate_n_flags & RATE_MCS_GF_MSK) - r->flags |= IEEE80211_TX_RC_GREEN_FIELD; - if (rate_n_flags & RATE_MCS_HT40_MSK) - r->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; - if (rate_n_flags & RATE_MCS_DUP_MSK) - r->flags |= IEEE80211_TX_RC_DUP_DATA; - if (rate_n_flags & RATE_MCS_SGI_MSK) - r->flags |= IEEE80211_TX_RC_SHORT_GI; - r->idx = iwlagn_hwrate_to_mac80211_idx(rate_n_flags, info->band); -} - -#ifdef CONFIG_IWLWIFI_DEBUG -const char *iwl_get_tx_fail_reason(u32 status) -{ -#define TX_STATUS_FAIL(x) case TX_STATUS_FAIL_ ## x: return #x -#define TX_STATUS_POSTPONE(x) case TX_STATUS_POSTPONE_ ## x: return #x - - switch (status & TX_STATUS_MSK) { - case TX_STATUS_SUCCESS: - return "SUCCESS"; - TX_STATUS_POSTPONE(DELAY); - TX_STATUS_POSTPONE(FEW_BYTES); - TX_STATUS_POSTPONE(BT_PRIO); - TX_STATUS_POSTPONE(QUIET_PERIOD); - TX_STATUS_POSTPONE(CALC_TTAK); - TX_STATUS_FAIL(INTERNAL_CROSSED_RETRY); - TX_STATUS_FAIL(SHORT_LIMIT); - TX_STATUS_FAIL(LONG_LIMIT); - TX_STATUS_FAIL(FIFO_UNDERRUN); - TX_STATUS_FAIL(DRAIN_FLOW); - TX_STATUS_FAIL(RFKILL_FLUSH); - TX_STATUS_FAIL(LIFE_EXPIRE); - TX_STATUS_FAIL(DEST_PS); - TX_STATUS_FAIL(HOST_ABORTED); - TX_STATUS_FAIL(BT_RETRY); - TX_STATUS_FAIL(STA_INVALID); - TX_STATUS_FAIL(FRAG_DROPPED); - TX_STATUS_FAIL(TID_DISABLE); - TX_STATUS_FAIL(FIFO_FLUSHED); - TX_STATUS_FAIL(INSUFFICIENT_CF_POLL); - TX_STATUS_FAIL(PASSIVE_NO_RX); - TX_STATUS_FAIL(NO_BEACON_ON_RADAR); - } - - return "UNKNOWN"; - -#undef TX_STATUS_FAIL -#undef TX_STATUS_POSTPONE -} -#endif /* CONFIG_IWLWIFI_DEBUG */ - -static void iwlagn_count_agg_tx_err_status(struct iwl_priv *priv, u16 status) -{ - status &= AGG_TX_STATUS_MSK; - - switch (status) { - case AGG_TX_STATE_UNDERRUN_MSK: - priv->reply_agg_tx_stats.underrun++; - break; - case AGG_TX_STATE_BT_PRIO_MSK: - priv->reply_agg_tx_stats.bt_prio++; - break; - case AGG_TX_STATE_FEW_BYTES_MSK: - priv->reply_agg_tx_stats.few_bytes++; - break; - case AGG_TX_STATE_ABORT_MSK: - priv->reply_agg_tx_stats.abort++; - break; - case AGG_TX_STATE_LAST_SENT_TTL_MSK: - priv->reply_agg_tx_stats.last_sent_ttl++; - break; - case AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK: - priv->reply_agg_tx_stats.last_sent_try++; - break; - case AGG_TX_STATE_LAST_SENT_BT_KILL_MSK: - priv->reply_agg_tx_stats.last_sent_bt_kill++; - break; - case AGG_TX_STATE_SCD_QUERY_MSK: - priv->reply_agg_tx_stats.scd_query++; - break; - case AGG_TX_STATE_TEST_BAD_CRC32_MSK: - priv->reply_agg_tx_stats.bad_crc32++; - break; - case AGG_TX_STATE_RESPONSE_MSK: - priv->reply_agg_tx_stats.response++; - break; - case AGG_TX_STATE_DUMP_TX_MSK: - priv->reply_agg_tx_stats.dump_tx++; - break; - case AGG_TX_STATE_DELAY_TX_MSK: - priv->reply_agg_tx_stats.delay_tx++; - break; - default: - priv->reply_agg_tx_stats.unknown++; - break; - } -} - -static inline u32 iwlagn_get_scd_ssn(struct iwlagn_tx_resp *tx_resp) -{ - return le32_to_cpup((__le32 *)&tx_resp->status + - tx_resp->frame_count) & IEEE80211_MAX_SN; -} - -static void iwl_rx_reply_tx_agg(struct iwl_priv *priv, - struct iwlagn_tx_resp *tx_resp) -{ - struct agg_tx_status *frame_status = &tx_resp->status; - int tid = (tx_resp->ra_tid & IWLAGN_TX_RES_TID_MSK) >> - IWLAGN_TX_RES_TID_POS; - int sta_id = (tx_resp->ra_tid & IWLAGN_TX_RES_RA_MSK) >> - IWLAGN_TX_RES_RA_POS; - struct iwl_ht_agg *agg = &priv->tid_data[sta_id][tid].agg; - u32 status = le16_to_cpu(tx_resp->status.status); - int i; - - WARN_ON(tid == IWL_TID_NON_QOS); - - if (agg->wait_for_ba) - IWL_DEBUG_TX_REPLY(priv, - "got tx response w/o block-ack\n"); - - agg->rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags); - agg->wait_for_ba = (tx_resp->frame_count > 1); - - /* - * If the BT kill count is non-zero, we'll get this - * notification again. - */ - if (tx_resp->bt_kill_count && tx_resp->frame_count == 1 && - priv->cfg->bt_params && - priv->cfg->bt_params->advanced_bt_coexist) { - IWL_DEBUG_COEX(priv, "receive reply tx w/ bt_kill\n"); - } - - if (tx_resp->frame_count == 1) - return; - - IWL_DEBUG_TX_REPLY(priv, "TXQ %d initial_rate 0x%x ssn %d frm_cnt %d\n", - agg->txq_id, - le32_to_cpu(tx_resp->rate_n_flags), - iwlagn_get_scd_ssn(tx_resp), tx_resp->frame_count); - - /* Construct bit-map of pending frames within Tx window */ - for (i = 0; i < tx_resp->frame_count; i++) { - u16 fstatus = le16_to_cpu(frame_status[i].status); - u8 retry_cnt = (fstatus & AGG_TX_TRY_MSK) >> AGG_TX_TRY_POS; - - if (status & AGG_TX_STATUS_MSK) - iwlagn_count_agg_tx_err_status(priv, fstatus); - - if (status & (AGG_TX_STATE_FEW_BYTES_MSK | - AGG_TX_STATE_ABORT_MSK)) - continue; - - if (status & AGG_TX_STATUS_MSK || retry_cnt > 1) - IWL_DEBUG_TX_REPLY(priv, - "%d: status %s (0x%04x), try-count (0x%01x)\n", - i, - iwl_get_agg_tx_fail_reason(fstatus), - fstatus & AGG_TX_STATUS_MSK, - retry_cnt); - } -} - -#ifdef CONFIG_IWLWIFI_DEBUG -#define AGG_TX_STATE_FAIL(x) case AGG_TX_STATE_ ## x: return #x - -const char *iwl_get_agg_tx_fail_reason(u16 status) -{ - status &= AGG_TX_STATUS_MSK; - switch (status) { - case AGG_TX_STATE_TRANSMITTED: - return "SUCCESS"; - AGG_TX_STATE_FAIL(UNDERRUN_MSK); - AGG_TX_STATE_FAIL(BT_PRIO_MSK); - AGG_TX_STATE_FAIL(FEW_BYTES_MSK); - AGG_TX_STATE_FAIL(ABORT_MSK); - AGG_TX_STATE_FAIL(LAST_SENT_TTL_MSK); - AGG_TX_STATE_FAIL(LAST_SENT_TRY_CNT_MSK); - AGG_TX_STATE_FAIL(LAST_SENT_BT_KILL_MSK); - AGG_TX_STATE_FAIL(SCD_QUERY_MSK); - AGG_TX_STATE_FAIL(TEST_BAD_CRC32_MSK); - AGG_TX_STATE_FAIL(RESPONSE_MSK); - AGG_TX_STATE_FAIL(DUMP_TX_MSK); - AGG_TX_STATE_FAIL(DELAY_TX_MSK); - } - - return "UNKNOWN"; -} -#endif /* CONFIG_IWLWIFI_DEBUG */ - -static void iwlagn_count_tx_err_status(struct iwl_priv *priv, u16 status) -{ - status &= TX_STATUS_MSK; - - switch (status) { - case TX_STATUS_POSTPONE_DELAY: - priv->reply_tx_stats.pp_delay++; - break; - case TX_STATUS_POSTPONE_FEW_BYTES: - priv->reply_tx_stats.pp_few_bytes++; - break; - case TX_STATUS_POSTPONE_BT_PRIO: - priv->reply_tx_stats.pp_bt_prio++; - break; - case TX_STATUS_POSTPONE_QUIET_PERIOD: - priv->reply_tx_stats.pp_quiet_period++; - break; - case TX_STATUS_POSTPONE_CALC_TTAK: - priv->reply_tx_stats.pp_calc_ttak++; - break; - case TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY: - priv->reply_tx_stats.int_crossed_retry++; - break; - case TX_STATUS_FAIL_SHORT_LIMIT: - priv->reply_tx_stats.short_limit++; - break; - case TX_STATUS_FAIL_LONG_LIMIT: - priv->reply_tx_stats.long_limit++; - break; - case TX_STATUS_FAIL_FIFO_UNDERRUN: - priv->reply_tx_stats.fifo_underrun++; - break; - case TX_STATUS_FAIL_DRAIN_FLOW: - priv->reply_tx_stats.drain_flow++; - break; - case TX_STATUS_FAIL_RFKILL_FLUSH: - priv->reply_tx_stats.rfkill_flush++; - break; - case TX_STATUS_FAIL_LIFE_EXPIRE: - priv->reply_tx_stats.life_expire++; - break; - case TX_STATUS_FAIL_DEST_PS: - priv->reply_tx_stats.dest_ps++; - break; - case TX_STATUS_FAIL_HOST_ABORTED: - priv->reply_tx_stats.host_abort++; - break; - case TX_STATUS_FAIL_BT_RETRY: - priv->reply_tx_stats.bt_retry++; - break; - case TX_STATUS_FAIL_STA_INVALID: - priv->reply_tx_stats.sta_invalid++; - break; - case TX_STATUS_FAIL_FRAG_DROPPED: - priv->reply_tx_stats.frag_drop++; - break; - case TX_STATUS_FAIL_TID_DISABLE: - priv->reply_tx_stats.tid_disable++; - break; - case TX_STATUS_FAIL_FIFO_FLUSHED: - priv->reply_tx_stats.fifo_flush++; - break; - case TX_STATUS_FAIL_INSUFFICIENT_CF_POLL: - priv->reply_tx_stats.insuff_cf_poll++; - break; - case TX_STATUS_FAIL_PASSIVE_NO_RX: - priv->reply_tx_stats.fail_hw_drop++; - break; - case TX_STATUS_FAIL_NO_BEACON_ON_RADAR: - priv->reply_tx_stats.sta_color_mismatch++; - break; - default: - priv->reply_tx_stats.unknown++; - break; - } -} - -static void iwlagn_set_tx_status(struct iwl_priv *priv, - struct ieee80211_tx_info *info, - struct iwlagn_tx_resp *tx_resp) -{ - u16 status = le16_to_cpu(tx_resp->status.status); - - info->flags &= ~IEEE80211_TX_CTL_AMPDU; - - info->status.rates[0].count = tx_resp->failure_frame + 1; - info->flags |= iwl_tx_status_to_mac80211(status); - iwlagn_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags), - info); - if (!iwl_is_tx_success(status)) - iwlagn_count_tx_err_status(priv, status); -} - -static void iwl_check_abort_status(struct iwl_priv *priv, - u8 frame_count, u32 status) -{ - if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) { - IWL_ERR(priv, "Tx flush command to flush out all frames\n"); - if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) - queue_work(priv->workqueue, &priv->tx_flush); - } -} - -int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - u16 sequence = le16_to_cpu(pkt->hdr.sequence); - int txq_id = SEQ_TO_QUEUE(sequence); - int cmd_index __maybe_unused = SEQ_TO_INDEX(sequence); - struct iwlagn_tx_resp *tx_resp = (void *)pkt->data; - struct ieee80211_hdr *hdr; - u32 status = le16_to_cpu(tx_resp->status.status); - u16 ssn = iwlagn_get_scd_ssn(tx_resp); - int tid; - int sta_id; - int freed; - struct ieee80211_tx_info *info; - struct sk_buff_head skbs; - struct sk_buff *skb; - struct iwl_rxon_context *ctx; - bool is_agg = (txq_id >= IWLAGN_FIRST_AMPDU_QUEUE); - bool is_offchannel_skb; - - tid = (tx_resp->ra_tid & IWLAGN_TX_RES_TID_MSK) >> - IWLAGN_TX_RES_TID_POS; - sta_id = (tx_resp->ra_tid & IWLAGN_TX_RES_RA_MSK) >> - IWLAGN_TX_RES_RA_POS; - - spin_lock_bh(&priv->sta_lock); - - if (is_agg) { - WARN_ON_ONCE(sta_id >= IWLAGN_STATION_COUNT || - tid >= IWL_MAX_TID_COUNT); - if (txq_id != priv->tid_data[sta_id][tid].agg.txq_id) - IWL_ERR(priv, "txq_id mismatch: %d %d\n", txq_id, - priv->tid_data[sta_id][tid].agg.txq_id); - iwl_rx_reply_tx_agg(priv, tx_resp); - } - - __skb_queue_head_init(&skbs); - - is_offchannel_skb = false; - - if (tx_resp->frame_count == 1) { - u16 next_reclaimed = le16_to_cpu(tx_resp->seq_ctl); - next_reclaimed = IEEE80211_SEQ_TO_SN(next_reclaimed + 0x10); - - if (is_agg) { - /* If this is an aggregation queue, we can rely on the - * ssn since the wifi sequence number corresponds to - * the index in the TFD ring (%256). - * The seq_ctl is the sequence control of the packet - * to which this Tx response relates. But if there is a - * hole in the bitmap of the BA we received, this Tx - * response may allow to reclaim the hole and all the - * subsequent packets that were already acked. - * In that case, seq_ctl != ssn, and the next packet - * to be reclaimed will be ssn and not seq_ctl. - */ - next_reclaimed = ssn; - } - - if (tid != IWL_TID_NON_QOS) { - priv->tid_data[sta_id][tid].next_reclaimed = - next_reclaimed; - IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d\n", - next_reclaimed); - } - - iwl_trans_reclaim(priv->trans, txq_id, ssn, &skbs); - - iwlagn_check_ratid_empty(priv, sta_id, tid); - freed = 0; - - /* process frames */ - skb_queue_walk(&skbs, skb) { - hdr = (struct ieee80211_hdr *)skb->data; - - if (!ieee80211_is_data_qos(hdr->frame_control)) - priv->last_seq_ctl = tx_resp->seq_ctl; - - info = IEEE80211_SKB_CB(skb); - ctx = info->driver_data[0]; - iwl_trans_free_tx_cmd(priv->trans, - info->driver_data[1]); - - memset(&info->status, 0, sizeof(info->status)); - - if (status == TX_STATUS_FAIL_PASSIVE_NO_RX && - ctx->vif && - ctx->vif->type == NL80211_IFTYPE_STATION) { - /* block and stop all queues */ - priv->passive_no_rx = true; - IWL_DEBUG_TX_QUEUES(priv, "stop all queues: " - "passive channel"); - ieee80211_stop_queues(priv->hw); - - IWL_DEBUG_TX_REPLY(priv, - "TXQ %d status %s (0x%08x) " - "rate_n_flags 0x%x retries %d\n", - txq_id, - iwl_get_tx_fail_reason(status), - status, - le32_to_cpu(tx_resp->rate_n_flags), - tx_resp->failure_frame); - - IWL_DEBUG_TX_REPLY(priv, - "FrameCnt = %d, idx=%d\n", - tx_resp->frame_count, cmd_index); - } - - /* check if BAR is needed */ - if (is_agg && !iwl_is_tx_success(status)) - info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; - iwlagn_set_tx_status(priv, IEEE80211_SKB_CB(skb), - tx_resp); - if (!is_agg) - iwlagn_non_agg_tx_status(priv, ctx, hdr->addr1); - - is_offchannel_skb = - (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN); - freed++; - } - - if (tid != IWL_TID_NON_QOS) { - priv->tid_data[sta_id][tid].next_reclaimed = - next_reclaimed; - IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d\n", - next_reclaimed); - } - - if (!is_agg && freed != 1) - IWL_ERR(priv, "Q: %d, freed %d\n", txq_id, freed); - - /* - * An offchannel frame can be send only on the AUX queue, where - * there is no aggregation (and reordering) so it only is single - * skb is expected to be processed. - */ - if (is_offchannel_skb && freed != 1) - IWL_ERR(priv, "OFFCHANNEL SKB freed %d\n", freed); - - IWL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x)\n", txq_id, - iwl_get_tx_fail_reason(status), status); - - IWL_DEBUG_TX_REPLY(priv, - "\t\t\t\tinitial_rate 0x%x retries %d, idx=%d ssn=%d seq_ctl=0x%x\n", - le32_to_cpu(tx_resp->rate_n_flags), - tx_resp->failure_frame, - SEQ_TO_INDEX(sequence), ssn, - le16_to_cpu(tx_resp->seq_ctl)); - } - - iwl_check_abort_status(priv, tx_resp->frame_count, status); - spin_unlock_bh(&priv->sta_lock); - - while (!skb_queue_empty(&skbs)) { - skb = __skb_dequeue(&skbs); - ieee80211_tx_status_ni(priv->hw, skb); - } - - if (is_offchannel_skb) - iwl_scan_offchannel_skb_status(priv); - - return 0; -} - -/** - * iwlagn_rx_reply_compressed_ba - Handler for REPLY_COMPRESSED_BA - * - * Handles block-acknowledge notification from device, which reports success - * of frames sent via aggregation. - */ -int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_compressed_ba_resp *ba_resp = (void *)pkt->data; - struct iwl_ht_agg *agg; - struct sk_buff_head reclaimed_skbs; - struct ieee80211_tx_info *info; - struct ieee80211_hdr *hdr; - struct sk_buff *skb; - int sta_id; - int tid; - int freed; - - /* "flow" corresponds to Tx queue */ - u16 scd_flow = le16_to_cpu(ba_resp->scd_flow); - - /* "ssn" is start of block-ack Tx window, corresponds to index - * (in Tx queue's circular buffer) of first TFD/frame in window */ - u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn); - - if (scd_flow >= priv->cfg->base_params->num_of_queues) { - IWL_ERR(priv, - "BUG_ON scd_flow is bigger than number of queues\n"); - return 0; - } - - sta_id = ba_resp->sta_id; - tid = ba_resp->tid; - agg = &priv->tid_data[sta_id][tid].agg; - - spin_lock_bh(&priv->sta_lock); - - if (unlikely(!agg->wait_for_ba)) { - if (unlikely(ba_resp->bitmap)) - IWL_ERR(priv, "Received BA when not expected\n"); - spin_unlock_bh(&priv->sta_lock); - return 0; - } - - if (unlikely(scd_flow != agg->txq_id)) { - /* - * FIXME: this is a uCode bug which need to be addressed, - * log the information and return for now. - * Since it is can possibly happen very often and in order - * not to fill the syslog, don't use IWL_ERR or IWL_WARN - */ - IWL_DEBUG_TX_QUEUES(priv, - "Bad queue mapping txq_id=%d, agg_txq[sta:%d,tid:%d]=%d\n", - scd_flow, sta_id, tid, agg->txq_id); - spin_unlock_bh(&priv->sta_lock); - return 0; - } - - __skb_queue_head_init(&reclaimed_skbs); - - /* Release all TFDs before the SSN, i.e. all TFDs in front of - * block-ack window (we assume that they've been successfully - * transmitted ... if not, it's too late anyway). */ - iwl_trans_reclaim(priv->trans, scd_flow, ba_resp_scd_ssn, - &reclaimed_skbs); - - IWL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, " - "sta_id = %d\n", - agg->wait_for_ba, - (u8 *) &ba_resp->sta_addr_lo32, - ba_resp->sta_id); - IWL_DEBUG_TX_REPLY(priv, "TID = %d, SeqCtl = %d, bitmap = 0x%llx, " - "scd_flow = %d, scd_ssn = %d sent:%d, acked:%d\n", - ba_resp->tid, le16_to_cpu(ba_resp->seq_ctl), - (unsigned long long)le64_to_cpu(ba_resp->bitmap), - scd_flow, ba_resp_scd_ssn, ba_resp->txed, - ba_resp->txed_2_done); - - /* Mark that the expected block-ack response arrived */ - agg->wait_for_ba = false; - - /* Sanity check values reported by uCode */ - if (ba_resp->txed_2_done > ba_resp->txed) { - IWL_DEBUG_TX_REPLY(priv, - "bogus sent(%d) and ack(%d) count\n", - ba_resp->txed, ba_resp->txed_2_done); - /* - * set txed_2_done = txed, - * so it won't impact rate scale - */ - ba_resp->txed = ba_resp->txed_2_done; - } - - priv->tid_data[sta_id][tid].next_reclaimed = ba_resp_scd_ssn; - - iwlagn_check_ratid_empty(priv, sta_id, tid); - freed = 0; - - skb_queue_walk(&reclaimed_skbs, skb) { - hdr = (struct ieee80211_hdr *)skb->data; - - if (ieee80211_is_data_qos(hdr->frame_control)) - freed++; - else - WARN_ON_ONCE(1); - - info = IEEE80211_SKB_CB(skb); - iwl_trans_free_tx_cmd(priv->trans, info->driver_data[1]); - - if (freed == 1) { - /* this is the first skb we deliver in this batch */ - /* put the rate scaling data there */ - info = IEEE80211_SKB_CB(skb); - memset(&info->status, 0, sizeof(info->status)); - info->flags |= IEEE80211_TX_STAT_ACK; - info->flags |= IEEE80211_TX_STAT_AMPDU; - info->status.ampdu_ack_len = ba_resp->txed_2_done; - info->status.ampdu_len = ba_resp->txed; - iwlagn_hwrate_to_tx_control(priv, agg->rate_n_flags, - info); - } - } - - spin_unlock_bh(&priv->sta_lock); - - while (!skb_queue_empty(&reclaimed_skbs)) { - skb = __skb_dequeue(&reclaimed_skbs); - ieee80211_tx_status_ni(priv->hw, skb); - } - - return 0; -} diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c deleted file mode 100644 index 0a1cdc5e856b..000000000000 --- a/drivers/net/wireless/iwlwifi/dvm/ucode.c +++ /dev/null @@ -1,463 +0,0 @@ -/****************************************************************************** - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#include -#include - -#include "iwl-io.h" -#include "iwl-agn-hw.h" -#include "iwl-trans.h" -#include "iwl-fh.h" -#include "iwl-op-mode.h" - -#include "dev.h" -#include "agn.h" -#include "calib.h" - -/****************************************************************************** - * - * uCode download functions - * - ******************************************************************************/ - -static inline const struct fw_img * -iwl_get_ucode_image(struct iwl_priv *priv, enum iwl_ucode_type ucode_type) -{ - if (ucode_type >= IWL_UCODE_TYPE_MAX) - return NULL; - - return &priv->fw->img[ucode_type]; -} - -/* - * Calibration - */ -static int iwl_set_Xtal_calib(struct iwl_priv *priv) -{ - struct iwl_calib_xtal_freq_cmd cmd; - __le16 *xtal_calib = priv->nvm_data->xtal_calib; - - iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD); - cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]); - cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]); - return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd)); -} - -static int iwl_set_temperature_offset_calib(struct iwl_priv *priv) -{ - struct iwl_calib_temperature_offset_cmd cmd; - - memset(&cmd, 0, sizeof(cmd)); - iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); - cmd.radio_sensor_offset = priv->nvm_data->raw_temperature; - if (!(cmd.radio_sensor_offset)) - cmd.radio_sensor_offset = DEFAULT_RADIO_SENSOR_OFFSET; - - IWL_DEBUG_CALIB(priv, "Radio sensor offset: %d\n", - le16_to_cpu(cmd.radio_sensor_offset)); - return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd)); -} - -static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv) -{ - struct iwl_calib_temperature_offset_v2_cmd cmd; - - memset(&cmd, 0, sizeof(cmd)); - iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); - cmd.radio_sensor_offset_high = priv->nvm_data->kelvin_temperature; - cmd.radio_sensor_offset_low = priv->nvm_data->raw_temperature; - if (!cmd.radio_sensor_offset_low) { - IWL_DEBUG_CALIB(priv, "no info in EEPROM, use default\n"); - cmd.radio_sensor_offset_low = DEFAULT_RADIO_SENSOR_OFFSET; - cmd.radio_sensor_offset_high = DEFAULT_RADIO_SENSOR_OFFSET; - } - cmd.burntVoltageRef = priv->nvm_data->calib_voltage; - - IWL_DEBUG_CALIB(priv, "Radio sensor offset high: %d\n", - le16_to_cpu(cmd.radio_sensor_offset_high)); - IWL_DEBUG_CALIB(priv, "Radio sensor offset low: %d\n", - le16_to_cpu(cmd.radio_sensor_offset_low)); - IWL_DEBUG_CALIB(priv, "Voltage Ref: %d\n", - le16_to_cpu(cmd.burntVoltageRef)); - - return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd)); -} - -static int iwl_send_calib_cfg(struct iwl_priv *priv) -{ - struct iwl_calib_cfg_cmd calib_cfg_cmd; - struct iwl_host_cmd cmd = { - .id = CALIBRATION_CFG_CMD, - .len = { sizeof(struct iwl_calib_cfg_cmd), }, - .data = { &calib_cfg_cmd, }, - }; - - memset(&calib_cfg_cmd, 0, sizeof(calib_cfg_cmd)); - calib_cfg_cmd.ucd_calib_cfg.once.is_enable = IWL_CALIB_INIT_CFG_ALL; - calib_cfg_cmd.ucd_calib_cfg.once.start = IWL_CALIB_INIT_CFG_ALL; - calib_cfg_cmd.ucd_calib_cfg.once.send_res = IWL_CALIB_INIT_CFG_ALL; - calib_cfg_cmd.ucd_calib_cfg.flags = - IWL_CALIB_CFG_FLAG_SEND_COMPLETE_NTFY_MSK; - - return iwl_dvm_send_cmd(priv, &cmd); -} - -int iwl_init_alive_start(struct iwl_priv *priv) -{ - int ret; - - if (priv->cfg->bt_params && - priv->cfg->bt_params->advanced_bt_coexist) { - /* - * Tell uCode we are ready to perform calibration - * need to perform this before any calibration - * no need to close the envlope since we are going - * to load the runtime uCode later. - */ - ret = iwl_send_bt_env(priv, IWL_BT_COEX_ENV_OPEN, - BT_COEX_PRIO_TBL_EVT_INIT_CALIB2); - if (ret) - return ret; - - } - - ret = iwl_send_calib_cfg(priv); - if (ret) - return ret; - - /** - * temperature offset calibration is only needed for runtime ucode, - * so prepare the value now. - */ - if (priv->cfg->need_temp_offset_calib) { - if (priv->cfg->temp_offset_v2) - return iwl_set_temperature_offset_calib_v2(priv); - else - return iwl_set_temperature_offset_calib(priv); - } - - return 0; -} - -static int iwl_send_wimax_coex(struct iwl_priv *priv) -{ - struct iwl_wimax_coex_cmd coex_cmd; - - /* coexistence is disabled */ - memset(&coex_cmd, 0, sizeof(coex_cmd)); - - return iwl_dvm_send_cmd_pdu(priv, - COEX_PRIORITY_TABLE_CMD, CMD_SYNC, - sizeof(coex_cmd), &coex_cmd); -} - -static const u8 iwl_bt_prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX] = { - ((BT_COEX_PRIO_TBL_PRIO_BYPASS << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | - (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), - ((BT_COEX_PRIO_TBL_PRIO_BYPASS << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | - (1 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), - ((BT_COEX_PRIO_TBL_PRIO_LOW << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | - (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), - ((BT_COEX_PRIO_TBL_PRIO_LOW << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | - (1 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), - ((BT_COEX_PRIO_TBL_PRIO_HIGH << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | - (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), - ((BT_COEX_PRIO_TBL_PRIO_HIGH << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | - (1 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), - ((BT_COEX_PRIO_TBL_PRIO_BYPASS << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | - (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), - ((BT_COEX_PRIO_TBL_PRIO_COEX_OFF << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | - (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), - ((BT_COEX_PRIO_TBL_PRIO_COEX_ON << IWL_BT_COEX_PRIO_TBL_PRIO_POS) | - (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)), - 0, 0, 0, 0, 0, 0, 0 -}; - -void iwl_send_prio_tbl(struct iwl_priv *priv) -{ - struct iwl_bt_coex_prio_table_cmd prio_tbl_cmd; - - memcpy(prio_tbl_cmd.prio_tbl, iwl_bt_prio_tbl, - sizeof(iwl_bt_prio_tbl)); - if (iwl_dvm_send_cmd_pdu(priv, - REPLY_BT_COEX_PRIO_TABLE, CMD_SYNC, - sizeof(prio_tbl_cmd), &prio_tbl_cmd)) - IWL_ERR(priv, "failed to send BT prio tbl command\n"); -} - -int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type) -{ - struct iwl_bt_coex_prot_env_cmd env_cmd; - int ret; - - env_cmd.action = action; - env_cmd.type = type; - ret = iwl_dvm_send_cmd_pdu(priv, - REPLY_BT_COEX_PROT_ENV, CMD_SYNC, - sizeof(env_cmd), &env_cmd); - if (ret) - IWL_ERR(priv, "failed to send BT env command\n"); - return ret; -} - -static const u8 iwlagn_default_queue_to_tx_fifo[] = { - IWL_TX_FIFO_VO, - IWL_TX_FIFO_VI, - IWL_TX_FIFO_BE, - IWL_TX_FIFO_BK, -}; - -static const u8 iwlagn_ipan_queue_to_tx_fifo[] = { - IWL_TX_FIFO_VO, - IWL_TX_FIFO_VI, - IWL_TX_FIFO_BE, - IWL_TX_FIFO_BK, - IWL_TX_FIFO_BK_IPAN, - IWL_TX_FIFO_BE_IPAN, - IWL_TX_FIFO_VI_IPAN, - IWL_TX_FIFO_VO_IPAN, - IWL_TX_FIFO_BE_IPAN, - IWL_TX_FIFO_UNUSED, - IWL_TX_FIFO_AUX, -}; - -static int iwl_alive_notify(struct iwl_priv *priv) -{ - const u8 *queue_to_txf; - u8 n_queues; - int ret; - int i; - - iwl_trans_fw_alive(priv->trans, 0); - - if (priv->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN && - priv->nvm_data->sku_cap_ipan_enable) { - n_queues = ARRAY_SIZE(iwlagn_ipan_queue_to_tx_fifo); - queue_to_txf = iwlagn_ipan_queue_to_tx_fifo; - } else { - n_queues = ARRAY_SIZE(iwlagn_default_queue_to_tx_fifo); - queue_to_txf = iwlagn_default_queue_to_tx_fifo; - } - - for (i = 0; i < n_queues; i++) - if (queue_to_txf[i] != IWL_TX_FIFO_UNUSED) - iwl_trans_ac_txq_enable(priv->trans, i, - queue_to_txf[i]); - - priv->passive_no_rx = false; - priv->transport_queue_stop = 0; - - ret = iwl_send_wimax_coex(priv); - if (ret) - return ret; - - if (!priv->cfg->no_xtal_calib) { - ret = iwl_set_Xtal_calib(priv); - if (ret) - return ret; - } - - return iwl_send_calib_results(priv); -} - -struct iwl_alive_data { - bool valid; - u8 subtype; -}; - -static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait, - struct iwl_rx_packet *pkt, void *data) -{ - struct iwl_priv *priv = - container_of(notif_wait, struct iwl_priv, notif_wait); - struct iwl_alive_data *alive_data = data; - struct iwl_alive_resp *palive; - - palive = (void *)pkt->data; - - IWL_DEBUG_FW(priv, "Alive ucode status 0x%08X revision " - "0x%01X 0x%01X\n", - palive->is_valid, palive->ver_type, - palive->ver_subtype); - - priv->device_pointers.error_event_table = - le32_to_cpu(palive->error_event_table_ptr); - priv->device_pointers.log_event_table = - le32_to_cpu(palive->log_event_table_ptr); - - alive_data->subtype = palive->ver_subtype; - alive_data->valid = palive->is_valid == UCODE_VALID_OK; - - return true; -} - -#define UCODE_ALIVE_TIMEOUT HZ -#define UCODE_CALIB_TIMEOUT (2*HZ) - -int iwl_load_ucode_wait_alive(struct iwl_priv *priv, - enum iwl_ucode_type ucode_type) -{ - struct iwl_notification_wait alive_wait; - struct iwl_alive_data alive_data; - const struct fw_img *fw; - int ret; - enum iwl_ucode_type old_type; - static const u8 alive_cmd[] = { REPLY_ALIVE }; - - old_type = priv->cur_ucode; - priv->cur_ucode = ucode_type; - fw = iwl_get_ucode_image(priv, ucode_type); - - priv->ucode_loaded = false; - - if (!fw) - return -EINVAL; - - iwl_init_notification_wait(&priv->notif_wait, &alive_wait, - alive_cmd, ARRAY_SIZE(alive_cmd), - iwl_alive_fn, &alive_data); - - ret = iwl_trans_start_fw(priv->trans, fw, false); - if (ret) { - priv->cur_ucode = old_type; - iwl_remove_notification(&priv->notif_wait, &alive_wait); - return ret; - } - - /* - * Some things may run in the background now, but we - * just wait for the ALIVE notification here. - */ - ret = iwl_wait_notification(&priv->notif_wait, &alive_wait, - UCODE_ALIVE_TIMEOUT); - if (ret) { - priv->cur_ucode = old_type; - return ret; - } - - if (!alive_data.valid) { - IWL_ERR(priv, "Loaded ucode is not valid!\n"); - priv->cur_ucode = old_type; - return -EIO; - } - - priv->ucode_loaded = true; - - if (ucode_type != IWL_UCODE_WOWLAN) { - /* delay a bit to give rfkill time to run */ - msleep(5); - } - - ret = iwl_alive_notify(priv); - if (ret) { - IWL_WARN(priv, - "Could not complete ALIVE transition: %d\n", ret); - priv->cur_ucode = old_type; - return ret; - } - - return 0; -} - -static bool iwlagn_wait_calib(struct iwl_notif_wait_data *notif_wait, - struct iwl_rx_packet *pkt, void *data) -{ - struct iwl_priv *priv = data; - struct iwl_calib_hdr *hdr; - int len; - - if (pkt->hdr.cmd != CALIBRATION_RES_NOTIFICATION) { - WARN_ON(pkt->hdr.cmd != CALIBRATION_COMPLETE_NOTIFICATION); - return true; - } - - hdr = (struct iwl_calib_hdr *)pkt->data; - len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; - - /* reduce the size by the length field itself */ - len -= sizeof(__le32); - - if (iwl_calib_set(priv, hdr, len)) - IWL_ERR(priv, "Failed to record calibration data %d\n", - hdr->op_code); - - return false; -} - -int iwl_run_init_ucode(struct iwl_priv *priv) -{ - struct iwl_notification_wait calib_wait; - static const u8 calib_complete[] = { - CALIBRATION_RES_NOTIFICATION, - CALIBRATION_COMPLETE_NOTIFICATION - }; - int ret; - - lockdep_assert_held(&priv->mutex); - - /* No init ucode required? Curious, but maybe ok */ - if (!priv->fw->img[IWL_UCODE_INIT].sec[0].len) - return 0; - - if (priv->init_ucode_run) - return 0; - - iwl_init_notification_wait(&priv->notif_wait, &calib_wait, - calib_complete, ARRAY_SIZE(calib_complete), - iwlagn_wait_calib, priv); - - /* Will also start the device */ - ret = iwl_load_ucode_wait_alive(priv, IWL_UCODE_INIT); - if (ret) - goto error; - - ret = iwl_init_alive_start(priv); - if (ret) - goto error; - - /* - * Some things may run in the background now, but we - * just wait for the calibration complete notification. - */ - ret = iwl_wait_notification(&priv->notif_wait, &calib_wait, - UCODE_CALIB_TIMEOUT); - if (!ret) - priv->init_ucode_run = true; - - goto out; - - error: - iwl_remove_notification(&priv->notif_wait, &calib_wait); - out: - /* Whatever happened, stop the device */ - iwl_trans_stop_device(priv->trans); - priv->ucode_loaded = false; - - return ret; -} diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c deleted file mode 100644 index c080ae3070b2..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ /dev/null @@ -1,140 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#include -#include -#include "iwl-config.h" -#include "iwl-csr.h" -#include "iwl-agn-hw.h" - -/* Highest firmware API version supported */ -#define IWL1000_UCODE_API_MAX 5 -#define IWL100_UCODE_API_MAX 5 - -/* Oldest version we won't warn about */ -#define IWL1000_UCODE_API_OK 5 -#define IWL100_UCODE_API_OK 5 - -/* Lowest firmware API version supported */ -#define IWL1000_UCODE_API_MIN 1 -#define IWL100_UCODE_API_MIN 5 - -/* EEPROM version */ -#define EEPROM_1000_TX_POWER_VERSION (4) -#define EEPROM_1000_EEPROM_VERSION (0x15C) - -#define IWL1000_FW_PRE "iwlwifi-1000-" -#define IWL1000_MODULE_FIRMWARE(api) IWL1000_FW_PRE __stringify(api) ".ucode" - -#define IWL100_FW_PRE "iwlwifi-100-" -#define IWL100_MODULE_FIRMWARE(api) IWL100_FW_PRE __stringify(api) ".ucode" - - -static const struct iwl_base_params iwl1000_base_params = { - .num_of_queues = IWLAGN_NUM_QUEUES, - .eeprom_size = OTP_LOW_IMAGE_SIZE, - .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL, - .max_ll_items = OTP_MAX_LL_ITEMS_1000, - .shadow_ram_support = false, - .led_compensation = 51, - .support_ct_kill_exit = true, - .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF, - .chain_noise_scale = 1000, - .wd_timeout = IWL_WATCHDOG_DISABLED, - .max_event_log_size = 128, -}; - -static const struct iwl_ht_params iwl1000_ht_params = { - .ht_greenfield_support = true, - .use_rts_for_aggregation = true, /* use rts/cts protection */ - .ht40_bands = BIT(IEEE80211_BAND_2GHZ), -}; - -static const struct iwl_eeprom_params iwl1000_eeprom_params = { - .regulatory_bands = { - EEPROM_REG_BAND_1_CHANNELS, - EEPROM_REG_BAND_2_CHANNELS, - EEPROM_REG_BAND_3_CHANNELS, - EEPROM_REG_BAND_4_CHANNELS, - EEPROM_REG_BAND_5_CHANNELS, - EEPROM_REG_BAND_24_HT40_CHANNELS, - EEPROM_REGULATORY_BAND_NO_HT40, - } -}; - -#define IWL_DEVICE_1000 \ - .fw_name_pre = IWL1000_FW_PRE, \ - .ucode_api_max = IWL1000_UCODE_API_MAX, \ - .ucode_api_ok = IWL1000_UCODE_API_OK, \ - .ucode_api_min = IWL1000_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_1000, \ - .max_inst_size = IWLAGN_RTC_INST_SIZE, \ - .max_data_size = IWLAGN_RTC_DATA_SIZE, \ - .nvm_ver = EEPROM_1000_EEPROM_VERSION, \ - .nvm_calib_ver = EEPROM_1000_TX_POWER_VERSION, \ - .base_params = &iwl1000_base_params, \ - .eeprom_params = &iwl1000_eeprom_params, \ - .led_mode = IWL_LED_BLINK - -const struct iwl_cfg iwl1000_bgn_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N 1000 BGN", - IWL_DEVICE_1000, - .ht_params = &iwl1000_ht_params, -}; - -const struct iwl_cfg iwl1000_bg_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N 1000 BG", - IWL_DEVICE_1000, -}; - -#define IWL_DEVICE_100 \ - .fw_name_pre = IWL100_FW_PRE, \ - .ucode_api_max = IWL100_UCODE_API_MAX, \ - .ucode_api_ok = IWL100_UCODE_API_OK, \ - .ucode_api_min = IWL100_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_100, \ - .max_inst_size = IWLAGN_RTC_INST_SIZE, \ - .max_data_size = IWLAGN_RTC_DATA_SIZE, \ - .nvm_ver = EEPROM_1000_EEPROM_VERSION, \ - .nvm_calib_ver = EEPROM_1000_TX_POWER_VERSION, \ - .base_params = &iwl1000_base_params, \ - .eeprom_params = &iwl1000_eeprom_params, \ - .led_mode = IWL_LED_RF_STATE, \ - .rx_with_siso_diversity = true - -const struct iwl_cfg iwl100_bgn_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N 100 BGN", - IWL_DEVICE_100, - .ht_params = &iwl1000_ht_params, -}; - -const struct iwl_cfg iwl100_bg_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N 100 BG", - IWL_DEVICE_100, -}; - -MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_OK)); -MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_OK)); diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c deleted file mode 100644 index a6ddd2f9fba0..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-2000.c +++ /dev/null @@ -1,242 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#include -#include -#include "iwl-config.h" -#include "iwl-agn-hw.h" -#include "dvm/commands.h" /* needed for BT for now */ - -/* Highest firmware API version supported */ -#define IWL2030_UCODE_API_MAX 6 -#define IWL2000_UCODE_API_MAX 6 -#define IWL105_UCODE_API_MAX 6 -#define IWL135_UCODE_API_MAX 6 - -/* Oldest version we won't warn about */ -#define IWL2030_UCODE_API_OK 6 -#define IWL2000_UCODE_API_OK 6 -#define IWL105_UCODE_API_OK 6 -#define IWL135_UCODE_API_OK 6 - -/* Lowest firmware API version supported */ -#define IWL2030_UCODE_API_MIN 5 -#define IWL2000_UCODE_API_MIN 5 -#define IWL105_UCODE_API_MIN 5 -#define IWL135_UCODE_API_MIN 5 - -/* EEPROM version */ -#define EEPROM_2000_TX_POWER_VERSION (6) -#define EEPROM_2000_EEPROM_VERSION (0x805) - - -#define IWL2030_FW_PRE "iwlwifi-2030-" -#define IWL2030_MODULE_FIRMWARE(api) IWL2030_FW_PRE __stringify(api) ".ucode" - -#define IWL2000_FW_PRE "iwlwifi-2000-" -#define IWL2000_MODULE_FIRMWARE(api) IWL2000_FW_PRE __stringify(api) ".ucode" - -#define IWL105_FW_PRE "iwlwifi-105-" -#define IWL105_MODULE_FIRMWARE(api) IWL105_FW_PRE __stringify(api) ".ucode" - -#define IWL135_FW_PRE "iwlwifi-135-" -#define IWL135_MODULE_FIRMWARE(api) IWL135_FW_PRE __stringify(api) ".ucode" - -static const struct iwl_base_params iwl2000_base_params = { - .eeprom_size = OTP_LOW_IMAGE_SIZE, - .num_of_queues = IWLAGN_NUM_QUEUES, - .pll_cfg_val = 0, - .max_ll_items = OTP_MAX_LL_ITEMS_2x00, - .shadow_ram_support = true, - .led_compensation = 51, - .adv_thermal_throttle = true, - .support_ct_kill_exit = true, - .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, - .chain_noise_scale = 1000, - .wd_timeout = IWL_DEF_WD_TIMEOUT, - .max_event_log_size = 512, - .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ - .hd_v2 = true, -}; - - -static const struct iwl_base_params iwl2030_base_params = { - .eeprom_size = OTP_LOW_IMAGE_SIZE, - .num_of_queues = IWLAGN_NUM_QUEUES, - .pll_cfg_val = 0, - .max_ll_items = OTP_MAX_LL_ITEMS_2x00, - .shadow_ram_support = true, - .led_compensation = 57, - .adv_thermal_throttle = true, - .support_ct_kill_exit = true, - .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, - .chain_noise_scale = 1000, - .wd_timeout = IWL_LONG_WD_TIMEOUT, - .max_event_log_size = 512, - .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ - .hd_v2 = true, -}; - -static const struct iwl_ht_params iwl2000_ht_params = { - .ht_greenfield_support = true, - .use_rts_for_aggregation = true, /* use rts/cts protection */ - .ht40_bands = BIT(IEEE80211_BAND_2GHZ), -}; - -static const struct iwl_bt_params iwl2030_bt_params = { - /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ - .advanced_bt_coexist = true, - .agg_time_limit = BT_AGG_THRESHOLD_DEF, - .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE, - .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT32, - .bt_sco_disable = true, - .bt_session_2 = true, -}; - -static const struct iwl_eeprom_params iwl20x0_eeprom_params = { - .regulatory_bands = { - EEPROM_REG_BAND_1_CHANNELS, - EEPROM_REG_BAND_2_CHANNELS, - EEPROM_REG_BAND_3_CHANNELS, - EEPROM_REG_BAND_4_CHANNELS, - EEPROM_REG_BAND_5_CHANNELS, - EEPROM_6000_REG_BAND_24_HT40_CHANNELS, - EEPROM_REGULATORY_BAND_NO_HT40, - }, - .enhanced_txpower = true, -}; - -#define IWL_DEVICE_2000 \ - .fw_name_pre = IWL2000_FW_PRE, \ - .ucode_api_max = IWL2000_UCODE_API_MAX, \ - .ucode_api_ok = IWL2000_UCODE_API_OK, \ - .ucode_api_min = IWL2000_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_2000, \ - .max_inst_size = IWL60_RTC_INST_SIZE, \ - .max_data_size = IWL60_RTC_DATA_SIZE, \ - .nvm_ver = EEPROM_2000_EEPROM_VERSION, \ - .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ - .base_params = &iwl2000_base_params, \ - .eeprom_params = &iwl20x0_eeprom_params, \ - .need_temp_offset_calib = true, \ - .temp_offset_v2 = true, \ - .led_mode = IWL_LED_RF_STATE - -const struct iwl_cfg iwl2000_2bgn_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N 2200 BGN", - IWL_DEVICE_2000, - .ht_params = &iwl2000_ht_params, -}; - -const struct iwl_cfg iwl2000_2bgn_d_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N 2200D BGN", - IWL_DEVICE_2000, - .ht_params = &iwl2000_ht_params, -}; - -#define IWL_DEVICE_2030 \ - .fw_name_pre = IWL2030_FW_PRE, \ - .ucode_api_max = IWL2030_UCODE_API_MAX, \ - .ucode_api_ok = IWL2030_UCODE_API_OK, \ - .ucode_api_min = IWL2030_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_2030, \ - .max_inst_size = IWL60_RTC_INST_SIZE, \ - .max_data_size = IWL60_RTC_DATA_SIZE, \ - .nvm_ver = EEPROM_2000_EEPROM_VERSION, \ - .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ - .base_params = &iwl2030_base_params, \ - .bt_params = &iwl2030_bt_params, \ - .eeprom_params = &iwl20x0_eeprom_params, \ - .need_temp_offset_calib = true, \ - .temp_offset_v2 = true, \ - .led_mode = IWL_LED_RF_STATE, \ - .adv_pm = true - -const struct iwl_cfg iwl2030_2bgn_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N 2230 BGN", - IWL_DEVICE_2030, - .ht_params = &iwl2000_ht_params, -}; - -#define IWL_DEVICE_105 \ - .fw_name_pre = IWL105_FW_PRE, \ - .ucode_api_max = IWL105_UCODE_API_MAX, \ - .ucode_api_ok = IWL105_UCODE_API_OK, \ - .ucode_api_min = IWL105_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_105, \ - .max_inst_size = IWL60_RTC_INST_SIZE, \ - .max_data_size = IWL60_RTC_DATA_SIZE, \ - .nvm_ver = EEPROM_2000_EEPROM_VERSION, \ - .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ - .base_params = &iwl2000_base_params, \ - .eeprom_params = &iwl20x0_eeprom_params, \ - .need_temp_offset_calib = true, \ - .temp_offset_v2 = true, \ - .led_mode = IWL_LED_RF_STATE, \ - .adv_pm = true, \ - .rx_with_siso_diversity = true - -const struct iwl_cfg iwl105_bgn_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N 105 BGN", - IWL_DEVICE_105, - .ht_params = &iwl2000_ht_params, -}; - -const struct iwl_cfg iwl105_bgn_d_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N 105D BGN", - IWL_DEVICE_105, - .ht_params = &iwl2000_ht_params, -}; - -#define IWL_DEVICE_135 \ - .fw_name_pre = IWL135_FW_PRE, \ - .ucode_api_max = IWL135_UCODE_API_MAX, \ - .ucode_api_ok = IWL135_UCODE_API_OK, \ - .ucode_api_min = IWL135_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_135, \ - .max_inst_size = IWL60_RTC_INST_SIZE, \ - .max_data_size = IWL60_RTC_DATA_SIZE, \ - .nvm_ver = EEPROM_2000_EEPROM_VERSION, \ - .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ - .base_params = &iwl2030_base_params, \ - .bt_params = &iwl2030_bt_params, \ - .eeprom_params = &iwl20x0_eeprom_params, \ - .need_temp_offset_calib = true, \ - .temp_offset_v2 = true, \ - .led_mode = IWL_LED_RF_STATE, \ - .adv_pm = true, \ - .rx_with_siso_diversity = true - -const struct iwl_cfg iwl135_bgn_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N 135 BGN", - IWL_DEVICE_135, - .ht_params = &iwl2000_ht_params, -}; - -MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_OK)); -MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_OK)); -MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_OK)); -MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_OK)); diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c deleted file mode 100644 index 403f3f224bf6..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ /dev/null @@ -1,179 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#include -#include -#include "iwl-config.h" -#include "iwl-agn-hw.h" -#include "iwl-csr.h" - -/* Highest firmware API version supported */ -#define IWL5000_UCODE_API_MAX 5 -#define IWL5150_UCODE_API_MAX 2 - -/* Oldest version we won't warn about */ -#define IWL5000_UCODE_API_OK 5 -#define IWL5150_UCODE_API_OK 2 - -/* Lowest firmware API version supported */ -#define IWL5000_UCODE_API_MIN 1 -#define IWL5150_UCODE_API_MIN 1 - -/* EEPROM versions */ -#define EEPROM_5000_TX_POWER_VERSION (4) -#define EEPROM_5000_EEPROM_VERSION (0x11A) -#define EEPROM_5050_TX_POWER_VERSION (4) -#define EEPROM_5050_EEPROM_VERSION (0x21E) - -#define IWL5000_FW_PRE "iwlwifi-5000-" -#define IWL5000_MODULE_FIRMWARE(api) IWL5000_FW_PRE __stringify(api) ".ucode" - -#define IWL5150_FW_PRE "iwlwifi-5150-" -#define IWL5150_MODULE_FIRMWARE(api) IWL5150_FW_PRE __stringify(api) ".ucode" - -static const struct iwl_base_params iwl5000_base_params = { - .eeprom_size = IWLAGN_EEPROM_IMG_SIZE, - .num_of_queues = IWLAGN_NUM_QUEUES, - .pll_cfg_val = CSR50_ANA_PLL_CFG_VAL, - .led_compensation = 51, - .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, - .chain_noise_scale = 1000, - .wd_timeout = IWL_WATCHDOG_DISABLED, - .max_event_log_size = 512, - .no_idle_support = true, -}; - -static const struct iwl_ht_params iwl5000_ht_params = { - .ht_greenfield_support = true, - .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ), -}; - -static const struct iwl_eeprom_params iwl5000_eeprom_params = { - .regulatory_bands = { - EEPROM_REG_BAND_1_CHANNELS, - EEPROM_REG_BAND_2_CHANNELS, - EEPROM_REG_BAND_3_CHANNELS, - EEPROM_REG_BAND_4_CHANNELS, - EEPROM_REG_BAND_5_CHANNELS, - EEPROM_REG_BAND_24_HT40_CHANNELS, - EEPROM_REG_BAND_52_HT40_CHANNELS - }, -}; - -#define IWL_DEVICE_5000 \ - .fw_name_pre = IWL5000_FW_PRE, \ - .ucode_api_max = IWL5000_UCODE_API_MAX, \ - .ucode_api_ok = IWL5000_UCODE_API_OK, \ - .ucode_api_min = IWL5000_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_5000, \ - .max_inst_size = IWLAGN_RTC_INST_SIZE, \ - .max_data_size = IWLAGN_RTC_DATA_SIZE, \ - .nvm_ver = EEPROM_5000_EEPROM_VERSION, \ - .nvm_calib_ver = EEPROM_5000_TX_POWER_VERSION, \ - .base_params = &iwl5000_base_params, \ - .eeprom_params = &iwl5000_eeprom_params, \ - .led_mode = IWL_LED_BLINK - -const struct iwl_cfg iwl5300_agn_cfg = { - .name = "Intel(R) Ultimate N WiFi Link 5300 AGN", - IWL_DEVICE_5000, - /* at least EEPROM 0x11A has wrong info */ - .valid_tx_ant = ANT_ABC, /* .cfg overwrite */ - .valid_rx_ant = ANT_ABC, /* .cfg overwrite */ - .ht_params = &iwl5000_ht_params, -}; - -const struct iwl_cfg iwl5100_bgn_cfg = { - .name = "Intel(R) WiFi Link 5100 BGN", - IWL_DEVICE_5000, - .valid_tx_ant = ANT_B, /* .cfg overwrite */ - .valid_rx_ant = ANT_AB, /* .cfg overwrite */ - .ht_params = &iwl5000_ht_params, -}; - -const struct iwl_cfg iwl5100_abg_cfg = { - .name = "Intel(R) WiFi Link 5100 ABG", - IWL_DEVICE_5000, - .valid_tx_ant = ANT_B, /* .cfg overwrite */ - .valid_rx_ant = ANT_AB, /* .cfg overwrite */ -}; - -const struct iwl_cfg iwl5100_agn_cfg = { - .name = "Intel(R) WiFi Link 5100 AGN", - IWL_DEVICE_5000, - .valid_tx_ant = ANT_B, /* .cfg overwrite */ - .valid_rx_ant = ANT_AB, /* .cfg overwrite */ - .ht_params = &iwl5000_ht_params, -}; - -const struct iwl_cfg iwl5350_agn_cfg = { - .name = "Intel(R) WiMAX/WiFi Link 5350 AGN", - .fw_name_pre = IWL5000_FW_PRE, - .ucode_api_max = IWL5000_UCODE_API_MAX, - .ucode_api_ok = IWL5000_UCODE_API_OK, - .ucode_api_min = IWL5000_UCODE_API_MIN, - .device_family = IWL_DEVICE_FAMILY_5000, - .max_inst_size = IWLAGN_RTC_INST_SIZE, - .max_data_size = IWLAGN_RTC_DATA_SIZE, - .nvm_ver = EEPROM_5050_EEPROM_VERSION, - .nvm_calib_ver = EEPROM_5050_TX_POWER_VERSION, - .base_params = &iwl5000_base_params, - .eeprom_params = &iwl5000_eeprom_params, - .ht_params = &iwl5000_ht_params, - .led_mode = IWL_LED_BLINK, - .internal_wimax_coex = true, -}; - -#define IWL_DEVICE_5150 \ - .fw_name_pre = IWL5150_FW_PRE, \ - .ucode_api_max = IWL5150_UCODE_API_MAX, \ - .ucode_api_ok = IWL5150_UCODE_API_OK, \ - .ucode_api_min = IWL5150_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_5150, \ - .max_inst_size = IWLAGN_RTC_INST_SIZE, \ - .max_data_size = IWLAGN_RTC_DATA_SIZE, \ - .nvm_ver = EEPROM_5050_EEPROM_VERSION, \ - .nvm_calib_ver = EEPROM_5050_TX_POWER_VERSION, \ - .base_params = &iwl5000_base_params, \ - .eeprom_params = &iwl5000_eeprom_params, \ - .no_xtal_calib = true, \ - .led_mode = IWL_LED_BLINK, \ - .internal_wimax_coex = true - -const struct iwl_cfg iwl5150_agn_cfg = { - .name = "Intel(R) WiMAX/WiFi Link 5150 AGN", - IWL_DEVICE_5150, - .ht_params = &iwl5000_ht_params, - -}; - -const struct iwl_cfg iwl5150_abg_cfg = { - .name = "Intel(R) WiMAX/WiFi Link 5150 ABG", - IWL_DEVICE_5150, -}; - -MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_OK)); -MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_OK)); diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c deleted file mode 100644 index 5282088d6c14..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ /dev/null @@ -1,408 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#include -#include -#include "iwl-config.h" -#include "iwl-agn-hw.h" -#include "dvm/commands.h" /* needed for BT for now */ - -/* Highest firmware API version supported */ -#define IWL6000_UCODE_API_MAX 6 -#define IWL6050_UCODE_API_MAX 5 -#define IWL6000G2_UCODE_API_MAX 6 -#define IWL6035_UCODE_API_MAX 6 - -/* Oldest version we won't warn about */ -#define IWL6000_UCODE_API_OK 4 -#define IWL6000G2_UCODE_API_OK 5 -#define IWL6050_UCODE_API_OK 5 -#define IWL6000G2B_UCODE_API_OK 6 -#define IWL6035_UCODE_API_OK 6 - -/* Lowest firmware API version supported */ -#define IWL6000_UCODE_API_MIN 4 -#define IWL6050_UCODE_API_MIN 4 -#define IWL6000G2_UCODE_API_MIN 5 -#define IWL6035_UCODE_API_MIN 6 - -/* EEPROM versions */ -#define EEPROM_6000_TX_POWER_VERSION (4) -#define EEPROM_6000_EEPROM_VERSION (0x423) -#define EEPROM_6050_TX_POWER_VERSION (4) -#define EEPROM_6050_EEPROM_VERSION (0x532) -#define EEPROM_6150_TX_POWER_VERSION (6) -#define EEPROM_6150_EEPROM_VERSION (0x553) -#define EEPROM_6005_TX_POWER_VERSION (6) -#define EEPROM_6005_EEPROM_VERSION (0x709) -#define EEPROM_6030_TX_POWER_VERSION (6) -#define EEPROM_6030_EEPROM_VERSION (0x709) -#define EEPROM_6035_TX_POWER_VERSION (6) -#define EEPROM_6035_EEPROM_VERSION (0x753) - -#define IWL6000_FW_PRE "iwlwifi-6000-" -#define IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE __stringify(api) ".ucode" - -#define IWL6050_FW_PRE "iwlwifi-6050-" -#define IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE __stringify(api) ".ucode" - -#define IWL6005_FW_PRE "iwlwifi-6000g2a-" -#define IWL6005_MODULE_FIRMWARE(api) IWL6005_FW_PRE __stringify(api) ".ucode" - -#define IWL6030_FW_PRE "iwlwifi-6000g2b-" -#define IWL6030_MODULE_FIRMWARE(api) IWL6030_FW_PRE __stringify(api) ".ucode" - -static const struct iwl_base_params iwl6000_base_params = { - .eeprom_size = OTP_LOW_IMAGE_SIZE, - .num_of_queues = IWLAGN_NUM_QUEUES, - .pll_cfg_val = 0, - .max_ll_items = OTP_MAX_LL_ITEMS_6x00, - .shadow_ram_support = true, - .led_compensation = 51, - .adv_thermal_throttle = true, - .support_ct_kill_exit = true, - .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, - .chain_noise_scale = 1000, - .wd_timeout = IWL_DEF_WD_TIMEOUT, - .max_event_log_size = 512, - .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ -}; - -static const struct iwl_base_params iwl6050_base_params = { - .eeprom_size = OTP_LOW_IMAGE_SIZE, - .num_of_queues = IWLAGN_NUM_QUEUES, - .pll_cfg_val = 0, - .max_ll_items = OTP_MAX_LL_ITEMS_6x50, - .shadow_ram_support = true, - .led_compensation = 51, - .adv_thermal_throttle = true, - .support_ct_kill_exit = true, - .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, - .chain_noise_scale = 1500, - .wd_timeout = IWL_DEF_WD_TIMEOUT, - .max_event_log_size = 1024, - .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ -}; - -static const struct iwl_base_params iwl6000_g2_base_params = { - .eeprom_size = OTP_LOW_IMAGE_SIZE, - .num_of_queues = IWLAGN_NUM_QUEUES, - .pll_cfg_val = 0, - .max_ll_items = OTP_MAX_LL_ITEMS_6x00, - .shadow_ram_support = true, - .led_compensation = 57, - .adv_thermal_throttle = true, - .support_ct_kill_exit = true, - .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, - .chain_noise_scale = 1000, - .wd_timeout = IWL_LONG_WD_TIMEOUT, - .max_event_log_size = 512, - .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ -}; - -static const struct iwl_ht_params iwl6000_ht_params = { - .ht_greenfield_support = true, - .use_rts_for_aggregation = true, /* use rts/cts protection */ - .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ), -}; - -static const struct iwl_bt_params iwl6000_bt_params = { - /* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */ - .advanced_bt_coexist = true, - .agg_time_limit = BT_AGG_THRESHOLD_DEF, - .bt_init_traffic_load = IWL_BT_COEX_TRAFFIC_LOAD_NONE, - .bt_prio_boost = IWLAGN_BT_PRIO_BOOST_DEFAULT, - .bt_sco_disable = true, -}; - -static const struct iwl_eeprom_params iwl6000_eeprom_params = { - .regulatory_bands = { - EEPROM_REG_BAND_1_CHANNELS, - EEPROM_REG_BAND_2_CHANNELS, - EEPROM_REG_BAND_3_CHANNELS, - EEPROM_REG_BAND_4_CHANNELS, - EEPROM_REG_BAND_5_CHANNELS, - EEPROM_6000_REG_BAND_24_HT40_CHANNELS, - EEPROM_REG_BAND_52_HT40_CHANNELS - }, - .enhanced_txpower = true, -}; - -#define IWL_DEVICE_6005 \ - .fw_name_pre = IWL6005_FW_PRE, \ - .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ - .ucode_api_ok = IWL6000G2_UCODE_API_OK, \ - .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_6005, \ - .max_inst_size = IWL60_RTC_INST_SIZE, \ - .max_data_size = IWL60_RTC_DATA_SIZE, \ - .nvm_ver = EEPROM_6005_EEPROM_VERSION, \ - .nvm_calib_ver = EEPROM_6005_TX_POWER_VERSION, \ - .base_params = &iwl6000_g2_base_params, \ - .eeprom_params = &iwl6000_eeprom_params, \ - .need_temp_offset_calib = true, \ - .led_mode = IWL_LED_RF_STATE - -const struct iwl_cfg iwl6005_2agn_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6205 AGN", - IWL_DEVICE_6005, - .ht_params = &iwl6000_ht_params, -}; - -const struct iwl_cfg iwl6005_2abg_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6205 ABG", - IWL_DEVICE_6005, -}; - -const struct iwl_cfg iwl6005_2bg_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6205 BG", - IWL_DEVICE_6005, -}; - -const struct iwl_cfg iwl6005_2agn_sff_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6205S AGN", - IWL_DEVICE_6005, - .ht_params = &iwl6000_ht_params, -}; - -const struct iwl_cfg iwl6005_2agn_d_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6205D AGN", - IWL_DEVICE_6005, - .ht_params = &iwl6000_ht_params, -}; - -const struct iwl_cfg iwl6005_2agn_mow1_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6206 AGN", - IWL_DEVICE_6005, - .ht_params = &iwl6000_ht_params, -}; - -const struct iwl_cfg iwl6005_2agn_mow2_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6207 AGN", - IWL_DEVICE_6005, - .ht_params = &iwl6000_ht_params, -}; - -#define IWL_DEVICE_6030 \ - .fw_name_pre = IWL6030_FW_PRE, \ - .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ - .ucode_api_ok = IWL6000G2B_UCODE_API_OK, \ - .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_6030, \ - .max_inst_size = IWL60_RTC_INST_SIZE, \ - .max_data_size = IWL60_RTC_DATA_SIZE, \ - .nvm_ver = EEPROM_6030_EEPROM_VERSION, \ - .nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ - .base_params = &iwl6000_g2_base_params, \ - .bt_params = &iwl6000_bt_params, \ - .eeprom_params = &iwl6000_eeprom_params, \ - .need_temp_offset_calib = true, \ - .led_mode = IWL_LED_RF_STATE, \ - .adv_pm = true \ - -const struct iwl_cfg iwl6030_2agn_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6230 AGN", - IWL_DEVICE_6030, - .ht_params = &iwl6000_ht_params, -}; - -const struct iwl_cfg iwl6030_2abg_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6230 ABG", - IWL_DEVICE_6030, -}; - -const struct iwl_cfg iwl6030_2bgn_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6230 BGN", - IWL_DEVICE_6030, - .ht_params = &iwl6000_ht_params, -}; - -const struct iwl_cfg iwl6030_2bg_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6230 BG", - IWL_DEVICE_6030, -}; - -#define IWL_DEVICE_6035 \ - .fw_name_pre = IWL6030_FW_PRE, \ - .ucode_api_max = IWL6035_UCODE_API_MAX, \ - .ucode_api_ok = IWL6035_UCODE_API_OK, \ - .ucode_api_min = IWL6035_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_6030, \ - .max_inst_size = IWL60_RTC_INST_SIZE, \ - .max_data_size = IWL60_RTC_DATA_SIZE, \ - .nvm_ver = EEPROM_6030_EEPROM_VERSION, \ - .nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ - .base_params = &iwl6000_g2_base_params, \ - .bt_params = &iwl6000_bt_params, \ - .eeprom_params = &iwl6000_eeprom_params, \ - .need_temp_offset_calib = true, \ - .led_mode = IWL_LED_RF_STATE, \ - .adv_pm = true - -const struct iwl_cfg iwl6035_2agn_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6235 AGN", - IWL_DEVICE_6035, - .ht_params = &iwl6000_ht_params, -}; - -const struct iwl_cfg iwl6035_2agn_sff_cfg = { - .name = "Intel(R) Centrino(R) Ultimate-N 6235 AGN", - IWL_DEVICE_6035, - .ht_params = &iwl6000_ht_params, -}; - -const struct iwl_cfg iwl1030_bgn_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N 1030 BGN", - IWL_DEVICE_6030, - .ht_params = &iwl6000_ht_params, -}; - -const struct iwl_cfg iwl1030_bg_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N 1030 BG", - IWL_DEVICE_6030, -}; - -const struct iwl_cfg iwl130_bgn_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N 130 BGN", - IWL_DEVICE_6030, - .ht_params = &iwl6000_ht_params, - .rx_with_siso_diversity = true, -}; - -const struct iwl_cfg iwl130_bg_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N 130 BG", - IWL_DEVICE_6030, - .rx_with_siso_diversity = true, -}; - -/* - * "i": Internal configuration, use internal Power Amplifier - */ -#define IWL_DEVICE_6000i \ - .fw_name_pre = IWL6000_FW_PRE, \ - .ucode_api_max = IWL6000_UCODE_API_MAX, \ - .ucode_api_ok = IWL6000_UCODE_API_OK, \ - .ucode_api_min = IWL6000_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_6000i, \ - .max_inst_size = IWL60_RTC_INST_SIZE, \ - .max_data_size = IWL60_RTC_DATA_SIZE, \ - .valid_tx_ant = ANT_BC, /* .cfg overwrite */ \ - .valid_rx_ant = ANT_BC, /* .cfg overwrite */ \ - .nvm_ver = EEPROM_6000_EEPROM_VERSION, \ - .nvm_calib_ver = EEPROM_6000_TX_POWER_VERSION, \ - .base_params = &iwl6000_base_params, \ - .eeprom_params = &iwl6000_eeprom_params, \ - .led_mode = IWL_LED_BLINK - -const struct iwl_cfg iwl6000i_2agn_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN", - IWL_DEVICE_6000i, - .ht_params = &iwl6000_ht_params, -}; - -const struct iwl_cfg iwl6000i_2abg_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6200 ABG", - IWL_DEVICE_6000i, -}; - -const struct iwl_cfg iwl6000i_2bg_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N 6200 BG", - IWL_DEVICE_6000i, -}; - -#define IWL_DEVICE_6050 \ - .fw_name_pre = IWL6050_FW_PRE, \ - .ucode_api_max = IWL6050_UCODE_API_MAX, \ - .ucode_api_min = IWL6050_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_6050, \ - .max_inst_size = IWL60_RTC_INST_SIZE, \ - .max_data_size = IWL60_RTC_DATA_SIZE, \ - .valid_tx_ant = ANT_AB, /* .cfg overwrite */ \ - .valid_rx_ant = ANT_AB, /* .cfg overwrite */ \ - .nvm_ver = EEPROM_6050_EEPROM_VERSION, \ - .nvm_calib_ver = EEPROM_6050_TX_POWER_VERSION, \ - .base_params = &iwl6050_base_params, \ - .eeprom_params = &iwl6000_eeprom_params, \ - .led_mode = IWL_LED_BLINK, \ - .internal_wimax_coex = true - -const struct iwl_cfg iwl6050_2agn_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 AGN", - IWL_DEVICE_6050, - .ht_params = &iwl6000_ht_params, -}; - -const struct iwl_cfg iwl6050_2abg_cfg = { - .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 ABG", - IWL_DEVICE_6050, -}; - -#define IWL_DEVICE_6150 \ - .fw_name_pre = IWL6050_FW_PRE, \ - .ucode_api_max = IWL6050_UCODE_API_MAX, \ - .ucode_api_min = IWL6050_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_6150, \ - .max_inst_size = IWL60_RTC_INST_SIZE, \ - .max_data_size = IWL60_RTC_DATA_SIZE, \ - .nvm_ver = EEPROM_6150_EEPROM_VERSION, \ - .nvm_calib_ver = EEPROM_6150_TX_POWER_VERSION, \ - .base_params = &iwl6050_base_params, \ - .eeprom_params = &iwl6000_eeprom_params, \ - .led_mode = IWL_LED_BLINK, \ - .internal_wimax_coex = true - -const struct iwl_cfg iwl6150_bgn_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BGN", - IWL_DEVICE_6150, - .ht_params = &iwl6000_ht_params, -}; - -const struct iwl_cfg iwl6150_bg_cfg = { - .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BG", - IWL_DEVICE_6150, -}; - -const struct iwl_cfg iwl6000_3agn_cfg = { - .name = "Intel(R) Centrino(R) Ultimate-N 6300 AGN", - .fw_name_pre = IWL6000_FW_PRE, - .ucode_api_max = IWL6000_UCODE_API_MAX, - .ucode_api_ok = IWL6000_UCODE_API_OK, - .ucode_api_min = IWL6000_UCODE_API_MIN, - .device_family = IWL_DEVICE_FAMILY_6000, - .max_inst_size = IWL60_RTC_INST_SIZE, - .max_data_size = IWL60_RTC_DATA_SIZE, - .nvm_ver = EEPROM_6000_EEPROM_VERSION, - .nvm_calib_ver = EEPROM_6000_TX_POWER_VERSION, - .base_params = &iwl6000_base_params, - .eeprom_params = &iwl6000_eeprom_params, - .ht_params = &iwl6000_ht_params, - .led_mode = IWL_LED_BLINK, -}; - -MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK)); -MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_OK)); -MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_OK)); -MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2B_UCODE_API_OK)); diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c deleted file mode 100644 index 822443c5a3b5..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-7000.c +++ /dev/null @@ -1,182 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#include -#include -#include "iwl-config.h" -#include "iwl-agn-hw.h" - -/* Highest firmware API version supported */ -#define IWL7260_UCODE_API_MAX 7 -#define IWL3160_UCODE_API_MAX 7 - -/* Oldest version we won't warn about */ -#define IWL7260_UCODE_API_OK 7 -#define IWL3160_UCODE_API_OK 7 - -/* Lowest firmware API version supported */ -#define IWL7260_UCODE_API_MIN 7 -#define IWL3160_UCODE_API_MIN 7 - -/* NVM versions */ -#define IWL7260_NVM_VERSION 0x0a1d -#define IWL7260_TX_POWER_VERSION 0xffff /* meaningless */ -#define IWL3160_NVM_VERSION 0x709 -#define IWL3160_TX_POWER_VERSION 0xffff /* meaningless */ - -#define IWL7260_FW_PRE "iwlwifi-7260-" -#define IWL7260_MODULE_FIRMWARE(api) IWL7260_FW_PRE __stringify(api) ".ucode" - -#define IWL3160_FW_PRE "iwlwifi-3160-" -#define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode" - -static const struct iwl_base_params iwl7000_base_params = { - .eeprom_size = OTP_LOW_IMAGE_SIZE, - .num_of_queues = IWLAGN_NUM_QUEUES, - .pll_cfg_val = 0, - .shadow_ram_support = true, - .led_compensation = 57, - .adv_thermal_throttle = true, - .support_ct_kill_exit = true, - .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, - .chain_noise_scale = 1000, - .wd_timeout = IWL_LONG_WD_TIMEOUT, - .max_event_log_size = 512, - .shadow_reg_enable = false, /* TODO: fix bugs using this feature */ -}; - -static const struct iwl_ht_params iwl7000_ht_params = { - .use_rts_for_aggregation = true, /* use rts/cts protection */ - .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ), -}; - -#define IWL_DEVICE_7000 \ - .ucode_api_max = IWL7260_UCODE_API_MAX, \ - .ucode_api_ok = IWL7260_UCODE_API_OK, \ - .ucode_api_min = IWL7260_UCODE_API_MIN, \ - .device_family = IWL_DEVICE_FAMILY_7000, \ - .max_inst_size = IWL60_RTC_INST_SIZE, \ - .max_data_size = IWL60_RTC_DATA_SIZE, \ - .base_params = &iwl7000_base_params, \ - /* TODO: .bt_params? */ \ - .need_temp_offset_calib = true, \ - .led_mode = IWL_LED_RF_STATE, \ - .adv_pm = true \ - - -const struct iwl_cfg iwl7260_2ac_cfg = { - .name = "Intel(R) Dual Band Wireless AC 7260", - .fw_name_pre = IWL7260_FW_PRE, - IWL_DEVICE_7000, - .ht_params = &iwl7000_ht_params, - .nvm_ver = IWL7260_NVM_VERSION, - .nvm_calib_ver = IWL7260_TX_POWER_VERSION, -}; - -const struct iwl_cfg iwl7260_2n_cfg = { - .name = "Intel(R) Dual Band Wireless N 7260", - .fw_name_pre = IWL7260_FW_PRE, - IWL_DEVICE_7000, - .ht_params = &iwl7000_ht_params, - .nvm_ver = IWL7260_NVM_VERSION, - .nvm_calib_ver = IWL7260_TX_POWER_VERSION, -}; - -const struct iwl_cfg iwl7260_n_cfg = { - .name = "Intel(R) Wireless N 7260", - .fw_name_pre = IWL7260_FW_PRE, - IWL_DEVICE_7000, - .ht_params = &iwl7000_ht_params, - .nvm_ver = IWL7260_NVM_VERSION, - .nvm_calib_ver = IWL7260_TX_POWER_VERSION, -}; - -const struct iwl_cfg iwl3160_2ac_cfg = { - .name = "Intel(R) Dual Band Wireless AC 3160", - .fw_name_pre = IWL3160_FW_PRE, - IWL_DEVICE_7000, - .ht_params = &iwl7000_ht_params, - .nvm_ver = IWL3160_NVM_VERSION, - .nvm_calib_ver = IWL3160_TX_POWER_VERSION, -}; - -const struct iwl_cfg iwl3160_2n_cfg = { - .name = "Intel(R) Dual Band Wireless N 3160", - .fw_name_pre = IWL3160_FW_PRE, - IWL_DEVICE_7000, - .ht_params = &iwl7000_ht_params, - .nvm_ver = IWL3160_NVM_VERSION, - .nvm_calib_ver = IWL3160_TX_POWER_VERSION, -}; - -const struct iwl_cfg iwl3160_n_cfg = { - .name = "Intel(R) Wireless N 3160", - .fw_name_pre = IWL3160_FW_PRE, - IWL_DEVICE_7000, - .ht_params = &iwl7000_ht_params, - .nvm_ver = IWL3160_NVM_VERSION, - .nvm_calib_ver = IWL3160_TX_POWER_VERSION, -}; - -MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); -MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hw.h b/drivers/net/wireless/iwlwifi/iwl-agn-hw.h deleted file mode 100644 index 6d73f943cefa..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-agn-hw.h +++ /dev/null @@ -1,119 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2007 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -/* - * Please use this file (iwl-agn-hw.h) only for hardware-related definitions. - */ - -#ifndef __iwl_agn_hw_h__ -#define __iwl_agn_hw_h__ - -#define IWLAGN_RTC_INST_LOWER_BOUND (0x000000) -#define IWLAGN_RTC_INST_UPPER_BOUND (0x020000) - -#define IWLAGN_RTC_DATA_LOWER_BOUND (0x800000) -#define IWLAGN_RTC_DATA_UPPER_BOUND (0x80C000) - -#define IWLAGN_RTC_INST_SIZE (IWLAGN_RTC_INST_UPPER_BOUND - \ - IWLAGN_RTC_INST_LOWER_BOUND) -#define IWLAGN_RTC_DATA_SIZE (IWLAGN_RTC_DATA_UPPER_BOUND - \ - IWLAGN_RTC_DATA_LOWER_BOUND) - -#define IWL60_RTC_INST_LOWER_BOUND (0x000000) -#define IWL60_RTC_INST_UPPER_BOUND (0x040000) -#define IWL60_RTC_DATA_LOWER_BOUND (0x800000) -#define IWL60_RTC_DATA_UPPER_BOUND (0x814000) -#define IWL60_RTC_INST_SIZE \ - (IWL60_RTC_INST_UPPER_BOUND - IWL60_RTC_INST_LOWER_BOUND) -#define IWL60_RTC_DATA_SIZE \ - (IWL60_RTC_DATA_UPPER_BOUND - IWL60_RTC_DATA_LOWER_BOUND) - -/* RSSI to dBm */ -#define IWLAGN_RSSI_OFFSET 44 - -#define IWLAGN_DEFAULT_TX_RETRY 15 -#define IWLAGN_MGMT_DFAULT_RETRY_LIMIT 3 -#define IWLAGN_RTS_DFAULT_RETRY_LIMIT 60 -#define IWLAGN_BAR_DFAULT_RETRY_LIMIT 60 -#define IWLAGN_LOW_RETRY_LIMIT 7 - -/* Limit range of txpower output target to be between these values */ -#define IWLAGN_TX_POWER_TARGET_POWER_MIN (0) /* 0 dBm: 1 milliwatt */ -#define IWLAGN_TX_POWER_TARGET_POWER_MAX (16) /* 16 dBm */ - -/* EEPROM */ -#define IWLAGN_EEPROM_IMG_SIZE 2048 -/* OTP */ -/* lower blocks contain EEPROM image and calibration data */ -#define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */ -/* high blocks contain PAPD data */ -#define OTP_HIGH_IMAGE_SIZE_6x00 (6 * 512 * sizeof(u16)) /* 6 KB */ -#define OTP_HIGH_IMAGE_SIZE_1000 (0x200 * sizeof(u16)) /* 1024 bytes */ -#define OTP_MAX_LL_ITEMS_1000 (3) /* OTP blocks for 1000 */ -#define OTP_MAX_LL_ITEMS_6x00 (4) /* OTP blocks for 6x00 */ -#define OTP_MAX_LL_ITEMS_6x50 (7) /* OTP blocks for 6x50 */ -#define OTP_MAX_LL_ITEMS_2x00 (4) /* OTP blocks for 2x00 */ - - -#define IWLAGN_NUM_QUEUES 20 - -#endif /* __iwl_agn_hw_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h b/drivers/net/wireless/iwlwifi/iwl-config.h deleted file mode 100644 index 44e3370ce343..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-config.h +++ /dev/null @@ -1,330 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2007 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#ifndef __IWL_CONFIG_H__ -#define __IWL_CONFIG_H__ - -#include -#include - - -enum iwl_device_family { - IWL_DEVICE_FAMILY_UNDEFINED, - IWL_DEVICE_FAMILY_1000, - IWL_DEVICE_FAMILY_100, - IWL_DEVICE_FAMILY_2000, - IWL_DEVICE_FAMILY_2030, - IWL_DEVICE_FAMILY_105, - IWL_DEVICE_FAMILY_135, - IWL_DEVICE_FAMILY_5000, - IWL_DEVICE_FAMILY_5150, - IWL_DEVICE_FAMILY_6000, - IWL_DEVICE_FAMILY_6000i, - IWL_DEVICE_FAMILY_6005, - IWL_DEVICE_FAMILY_6030, - IWL_DEVICE_FAMILY_6050, - IWL_DEVICE_FAMILY_6150, - IWL_DEVICE_FAMILY_7000, -}; - -/* - * LED mode - * IWL_LED_DEFAULT: use device default - * IWL_LED_RF_STATE: turn LED on/off based on RF state - * LED ON = RF ON - * LED OFF = RF OFF - * IWL_LED_BLINK: adjust led blink rate based on blink table - * IWL_LED_DISABLE: led disabled - */ -enum iwl_led_mode { - IWL_LED_DEFAULT, - IWL_LED_RF_STATE, - IWL_LED_BLINK, - IWL_LED_DISABLE, -}; - -/* - * This is the threshold value of plcp error rate per 100mSecs. It is - * used to set and check for the validity of plcp_delta. - */ -#define IWL_MAX_PLCP_ERR_THRESHOLD_MIN 1 -#define IWL_MAX_PLCP_ERR_THRESHOLD_DEF 50 -#define IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF 100 -#define IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF 200 -#define IWL_MAX_PLCP_ERR_THRESHOLD_MAX 255 -#define IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE 0 - -/* TX queue watchdog timeouts in mSecs */ -#define IWL_WATCHDOG_DISABLED 0 -#define IWL_DEF_WD_TIMEOUT 2000 -#define IWL_LONG_WD_TIMEOUT 10000 -#define IWL_MAX_WD_TIMEOUT 120000 - -/* Antenna presence definitions */ -#define ANT_NONE 0x0 -#define ANT_A BIT(0) -#define ANT_B BIT(1) -#define ANT_C BIT(2) -#define ANT_AB (ANT_A | ANT_B) -#define ANT_AC (ANT_A | ANT_C) -#define ANT_BC (ANT_B | ANT_C) -#define ANT_ABC (ANT_A | ANT_B | ANT_C) - - -/* - * @max_ll_items: max number of OTP blocks - * @shadow_ram_support: shadow support for OTP memory - * @led_compensation: compensate on the led on/off time per HW according - * to the deviation to achieve the desired led frequency. - * The detail algorithm is described in iwl-led.c - * @chain_noise_num_beacons: number of beacons used to compute chain noise - * @adv_thermal_throttle: support advance thermal throttle - * @support_ct_kill_exit: support ct kill exit condition - * @plcp_delta_threshold: plcp error rate threshold used to trigger - * radio tuning when there is a high receiving plcp error rate - * @chain_noise_scale: default chain noise scale used for gain computation - * @wd_timeout: TX queues watchdog timeout - * @max_event_log_size: size of event log buffer size for ucode event logging - * @shadow_reg_enable: HW shadow register support - * @hd_v2: v2 of enhanced sensitivity value, used for 2000 series and up - * @no_idle_support: do not support idle mode - */ -struct iwl_base_params { - int eeprom_size; - int num_of_queues; /* def: HW dependent */ - /* for iwl_pcie_apm_init() */ - u32 pll_cfg_val; - - const u16 max_ll_items; - const bool shadow_ram_support; - u16 led_compensation; - bool adv_thermal_throttle; - bool support_ct_kill_exit; - u8 plcp_delta_threshold; - s32 chain_noise_scale; - unsigned int wd_timeout; - u32 max_event_log_size; - const bool shadow_reg_enable; - const bool hd_v2; - const bool no_idle_support; -}; - -/* - * @advanced_bt_coexist: support advanced bt coexist - * @bt_init_traffic_load: specify initial bt traffic load - * @bt_prio_boost: default bt priority boost value - * @agg_time_limit: maximum number of uSec in aggregation - * @bt_sco_disable: uCode should not response to BT in SCO/ESCO mode - */ -struct iwl_bt_params { - bool advanced_bt_coexist; - u8 bt_init_traffic_load; - u32 bt_prio_boost; - u16 agg_time_limit; - bool bt_sco_disable; - bool bt_session_2; -}; - -/* - * @use_rts_for_aggregation: use rts/cts protection for HT traffic - * @ht40_bands: bitmap of bands (using %IEEE80211_BAND_*) that support HT40 - */ -struct iwl_ht_params { - enum ieee80211_smps_mode smps_mode; - const bool ht_greenfield_support; /* if used set to true */ - bool use_rts_for_aggregation; - u8 ht40_bands; -}; - -/* - * information on how to parse the EEPROM - */ -#define EEPROM_REG_BAND_1_CHANNELS 0x08 -#define EEPROM_REG_BAND_2_CHANNELS 0x26 -#define EEPROM_REG_BAND_3_CHANNELS 0x42 -#define EEPROM_REG_BAND_4_CHANNELS 0x5C -#define EEPROM_REG_BAND_5_CHANNELS 0x74 -#define EEPROM_REG_BAND_24_HT40_CHANNELS 0x82 -#define EEPROM_REG_BAND_52_HT40_CHANNELS 0x92 -#define EEPROM_6000_REG_BAND_24_HT40_CHANNELS 0x80 -#define EEPROM_REGULATORY_BAND_NO_HT40 0 - -struct iwl_eeprom_params { - const u8 regulatory_bands[7]; - bool enhanced_txpower; -}; - -/** - * struct iwl_cfg - * @name: Offical name of the device - * @fw_name_pre: Firmware filename prefix. The api version and extension - * (.ucode) will be added to filename before loading from disk. The - * filename is constructed as fw_name_pre.ucode. - * @ucode_api_max: Highest version of uCode API supported by driver. - * @ucode_api_ok: oldest version of the uCode API that is OK to load - * without a warning, for use in transitions - * @ucode_api_min: Lowest version of uCode API supported by driver. - * @max_inst_size: The maximal length of the fw inst section - * @max_data_size: The maximal length of the fw data section - * @valid_tx_ant: valid transmit antenna - * @valid_rx_ant: valid receive antenna - * @nvm_ver: NVM version - * @nvm_calib_ver: NVM calibration version - * @lib: pointer to the lib ops - * @base_params: pointer to basic parameters - * @ht_params: point to ht patameters - * @bt_params: pointer to bt parameters - * @need_temp_offset_calib: need to perform temperature offset calibration - * @no_xtal_calib: some devices do not need crystal calibration data, - * don't send it to those - * @led_mode: 0=blinking, 1=On(RF On)/Off(RF Off) - * @adv_pm: advance power management - * @rx_with_siso_diversity: 1x1 device with rx antenna diversity - * @internal_wimax_coex: internal wifi/wimax combo device - * @temp_offset_v2: support v2 of temperature offset calibration - * - * We enable the driver to be backward compatible wrt. hardware features. - * API differences in uCode shouldn't be handled here but through TLVs - * and/or the uCode API version instead. - */ -struct iwl_cfg { - /* params specific to an individual device within a device family */ - const char *name; - const char *fw_name_pre; - const unsigned int ucode_api_max; - const unsigned int ucode_api_ok; - const unsigned int ucode_api_min; - const enum iwl_device_family device_family; - const u32 max_data_size; - const u32 max_inst_size; - u8 valid_tx_ant; - u8 valid_rx_ant; - u16 nvm_ver; - u16 nvm_calib_ver; - /* params not likely to change within a device family */ - const struct iwl_base_params *base_params; - /* params likely to change within a device family */ - const struct iwl_ht_params *ht_params; - const struct iwl_bt_params *bt_params; - const struct iwl_eeprom_params *eeprom_params; - const bool need_temp_offset_calib; /* if used set to true */ - const bool no_xtal_calib; - enum iwl_led_mode led_mode; - const bool adv_pm; - const bool rx_with_siso_diversity; - const bool internal_wimax_coex; - const bool temp_offset_v2; -}; - -/* - * This list declares the config structures for all devices. - */ -extern const struct iwl_cfg iwl5300_agn_cfg; -extern const struct iwl_cfg iwl5100_agn_cfg; -extern const struct iwl_cfg iwl5350_agn_cfg; -extern const struct iwl_cfg iwl5100_bgn_cfg; -extern const struct iwl_cfg iwl5100_abg_cfg; -extern const struct iwl_cfg iwl5150_agn_cfg; -extern const struct iwl_cfg iwl5150_abg_cfg; -extern const struct iwl_cfg iwl6005_2agn_cfg; -extern const struct iwl_cfg iwl6005_2abg_cfg; -extern const struct iwl_cfg iwl6005_2bg_cfg; -extern const struct iwl_cfg iwl6005_2agn_sff_cfg; -extern const struct iwl_cfg iwl6005_2agn_d_cfg; -extern const struct iwl_cfg iwl6005_2agn_mow1_cfg; -extern const struct iwl_cfg iwl6005_2agn_mow2_cfg; -extern const struct iwl_cfg iwl1030_bgn_cfg; -extern const struct iwl_cfg iwl1030_bg_cfg; -extern const struct iwl_cfg iwl6030_2agn_cfg; -extern const struct iwl_cfg iwl6030_2abg_cfg; -extern const struct iwl_cfg iwl6030_2bgn_cfg; -extern const struct iwl_cfg iwl6030_2bg_cfg; -extern const struct iwl_cfg iwl6000i_2agn_cfg; -extern const struct iwl_cfg iwl6000i_2abg_cfg; -extern const struct iwl_cfg iwl6000i_2bg_cfg; -extern const struct iwl_cfg iwl6000_3agn_cfg; -extern const struct iwl_cfg iwl6050_2agn_cfg; -extern const struct iwl_cfg iwl6050_2abg_cfg; -extern const struct iwl_cfg iwl6150_bgn_cfg; -extern const struct iwl_cfg iwl6150_bg_cfg; -extern const struct iwl_cfg iwl1000_bgn_cfg; -extern const struct iwl_cfg iwl1000_bg_cfg; -extern const struct iwl_cfg iwl100_bgn_cfg; -extern const struct iwl_cfg iwl100_bg_cfg; -extern const struct iwl_cfg iwl130_bgn_cfg; -extern const struct iwl_cfg iwl130_bg_cfg; -extern const struct iwl_cfg iwl2000_2bgn_cfg; -extern const struct iwl_cfg iwl2000_2bgn_d_cfg; -extern const struct iwl_cfg iwl2030_2bgn_cfg; -extern const struct iwl_cfg iwl6035_2agn_cfg; -extern const struct iwl_cfg iwl6035_2agn_sff_cfg; -extern const struct iwl_cfg iwl105_bgn_cfg; -extern const struct iwl_cfg iwl105_bgn_d_cfg; -extern const struct iwl_cfg iwl135_bgn_cfg; -extern const struct iwl_cfg iwl7260_2ac_cfg; -extern const struct iwl_cfg iwl7260_2n_cfg; -extern const struct iwl_cfg iwl7260_n_cfg; -extern const struct iwl_cfg iwl3160_2ac_cfg; -extern const struct iwl_cfg iwl3160_2n_cfg; -extern const struct iwl_cfg iwl3160_n_cfg; - -#endif /* __IWL_CONFIG_H__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h deleted file mode 100644 index 20e845d4da04..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-csr.h +++ /dev/null @@ -1,475 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2005 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#ifndef __iwl_csr_h__ -#define __iwl_csr_h__ -/* - * CSR (control and status registers) - * - * CSR registers are mapped directly into PCI bus space, and are accessible - * whenever platform supplies power to device, even when device is in - * low power states due to driver-invoked device resets - * (e.g. CSR_RESET_REG_FLAG_SW_RESET) or uCode-driven power-saving modes. - * - * Use iwl_write32() and iwl_read32() family to access these registers; - * these provide simple PCI bus access, without waking up the MAC. - * Do not use iwl_write_direct32() family for these registers; - * no need to "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ. - * The MAC (uCode processor, etc.) does not need to be powered up for accessing - * the CSR registers. - * - * NOTE: Device does need to be awake in order to read this memory - * via CSR_EEPROM and CSR_OTP registers - */ -#define CSR_BASE (0x000) - -#define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */ -#define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */ -#define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */ -#define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */ -#define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack*/ -#define CSR_GPIO_IN (CSR_BASE+0x018) /* read external chip pins */ -#define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc*/ -#define CSR_GP_CNTRL (CSR_BASE+0x024) - -/* 2nd byte of CSR_INT_COALESCING, not accessible via iwl_write32()! */ -#define CSR_INT_PERIODIC_REG (CSR_BASE+0x005) - -/* - * Hardware revision info - * Bit fields: - * 31-16: Reserved - * 15-4: Type of device: see CSR_HW_REV_TYPE_xxx definitions - * 3-2: Revision step: 0 = A, 1 = B, 2 = C, 3 = D - * 1-0: "Dash" (-) value, as in A-1, etc. - */ -#define CSR_HW_REV (CSR_BASE+0x028) - -/* - * EEPROM and OTP (one-time-programmable) memory reads - * - * NOTE: Device must be awake, initialized via apm_ops.init(), - * in order to read. - */ -#define CSR_EEPROM_REG (CSR_BASE+0x02c) -#define CSR_EEPROM_GP (CSR_BASE+0x030) -#define CSR_OTP_GP_REG (CSR_BASE+0x034) - -#define CSR_GIO_REG (CSR_BASE+0x03C) -#define CSR_GP_UCODE_REG (CSR_BASE+0x048) -#define CSR_GP_DRIVER_REG (CSR_BASE+0x050) - -/* - * UCODE-DRIVER GP (general purpose) mailbox registers. - * SET/CLR registers set/clear bit(s) if "1" is written. - */ -#define CSR_UCODE_DRV_GP1 (CSR_BASE+0x054) -#define CSR_UCODE_DRV_GP1_SET (CSR_BASE+0x058) -#define CSR_UCODE_DRV_GP1_CLR (CSR_BASE+0x05c) -#define CSR_UCODE_DRV_GP2 (CSR_BASE+0x060) - -#define CSR_LED_REG (CSR_BASE+0x094) -#define CSR_DRAM_INT_TBL_REG (CSR_BASE+0x0A0) -#define CSR_MAC_SHADOW_REG_CTRL (CSR_BASE+0x0A8) /* 6000 and up */ - - -/* GIO Chicken Bits (PCI Express bus link power management) */ -#define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100) - -/* Analog phase-lock-loop configuration */ -#define CSR_ANA_PLL_CFG (CSR_BASE+0x20c) - -/* - * CSR Hardware Revision Workaround Register. Indicates hardware rev; - * "step" determines CCK backoff for txpower calculation. Used for 4965 only. - * See also CSR_HW_REV register. - * Bit fields: - * 3-2: 0 = A, 1 = B, 2 = C, 3 = D step - * 1-0: "Dash" (-) value, as in C-1, etc. - */ -#define CSR_HW_REV_WA_REG (CSR_BASE+0x22C) - -#define CSR_DBG_HPET_MEM_REG (CSR_BASE+0x240) -#define CSR_DBG_LINK_PWR_MGMT_REG (CSR_BASE+0x250) - -/* Bits for CSR_HW_IF_CONFIG_REG */ -#define CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH (0x00000003) -#define CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP (0x0000000C) -#define CSR_HW_IF_CONFIG_REG_MSK_BOARD_VER (0x000000C0) -#define CSR_HW_IF_CONFIG_REG_BIT_MAC_SI (0x00000100) -#define CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI (0x00000200) -#define CSR_HW_IF_CONFIG_REG_MSK_PHY_TYPE (0x00000C00) -#define CSR_HW_IF_CONFIG_REG_MSK_PHY_DASH (0x00003000) -#define CSR_HW_IF_CONFIG_REG_MSK_PHY_STEP (0x0000C000) - -#define CSR_HW_IF_CONFIG_REG_POS_MAC_DASH (0) -#define CSR_HW_IF_CONFIG_REG_POS_MAC_STEP (2) -#define CSR_HW_IF_CONFIG_REG_POS_BOARD_VER (6) -#define CSR_HW_IF_CONFIG_REG_POS_PHY_TYPE (10) -#define CSR_HW_IF_CONFIG_REG_POS_PHY_DASH (12) -#define CSR_HW_IF_CONFIG_REG_POS_PHY_STEP (14) - -#define CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A (0x00080000) -#define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000) -#define CSR_HW_IF_CONFIG_REG_BIT_NIC_READY (0x00400000) /* PCI_OWN_SEM */ -#define CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE (0x02000000) /* ME_OWN */ -#define CSR_HW_IF_CONFIG_REG_PREPARE (0x08000000) /* WAKE_ME */ - -#define CSR_INT_PERIODIC_DIS (0x00) /* disable periodic int*/ -#define CSR_INT_PERIODIC_ENA (0xFF) /* 255*32 usec ~ 8 msec*/ - -/* interrupt flags in INTA, set by uCode or hardware (e.g. dma), - * acknowledged (reset) by host writing "1" to flagged bits. */ -#define CSR_INT_BIT_FH_RX (1 << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */ -#define CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */ -#define CSR_INT_BIT_RX_PERIODIC (1 << 28) /* Rx periodic */ -#define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */ -#define CSR_INT_BIT_SCD (1 << 26) /* TXQ pointer advanced */ -#define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */ -#define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */ -#define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */ -#define CSR_INT_BIT_SW_RX (1 << 3) /* Rx, command responses */ -#define CSR_INT_BIT_WAKEUP (1 << 1) /* NIC controller waking up (pwr mgmt) */ -#define CSR_INT_BIT_ALIVE (1 << 0) /* uCode interrupts once it initializes */ - -#define CSR_INI_SET_MASK (CSR_INT_BIT_FH_RX | \ - CSR_INT_BIT_HW_ERR | \ - CSR_INT_BIT_FH_TX | \ - CSR_INT_BIT_SW_ERR | \ - CSR_INT_BIT_RF_KILL | \ - CSR_INT_BIT_SW_RX | \ - CSR_INT_BIT_WAKEUP | \ - CSR_INT_BIT_ALIVE) - -/* interrupt flags in FH (flow handler) (PCI busmaster DMA) */ -#define CSR_FH_INT_BIT_ERR (1 << 31) /* Error */ -#define CSR_FH_INT_BIT_HI_PRIOR (1 << 30) /* High priority Rx, bypass coalescing */ -#define CSR_FH_INT_BIT_RX_CHNL1 (1 << 17) /* Rx channel 1 */ -#define CSR_FH_INT_BIT_RX_CHNL0 (1 << 16) /* Rx channel 0 */ -#define CSR_FH_INT_BIT_TX_CHNL1 (1 << 1) /* Tx channel 1 */ -#define CSR_FH_INT_BIT_TX_CHNL0 (1 << 0) /* Tx channel 0 */ - -#define CSR_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \ - CSR_FH_INT_BIT_RX_CHNL1 | \ - CSR_FH_INT_BIT_RX_CHNL0) - -#define CSR_FH_INT_TX_MASK (CSR_FH_INT_BIT_TX_CHNL1 | \ - CSR_FH_INT_BIT_TX_CHNL0) - -/* GPIO */ -#define CSR_GPIO_IN_BIT_AUX_POWER (0x00000200) -#define CSR_GPIO_IN_VAL_VAUX_PWR_SRC (0x00000000) -#define CSR_GPIO_IN_VAL_VMAIN_PWR_SRC (0x00000200) - -/* RESET */ -#define CSR_RESET_REG_FLAG_NEVO_RESET (0x00000001) -#define CSR_RESET_REG_FLAG_FORCE_NMI (0x00000002) -#define CSR_RESET_REG_FLAG_SW_RESET (0x00000080) -#define CSR_RESET_REG_FLAG_MASTER_DISABLED (0x00000100) -#define CSR_RESET_REG_FLAG_STOP_MASTER (0x00000200) -#define CSR_RESET_LINK_PWR_MGMT_DISABLED (0x80000000) - -/* - * GP (general purpose) CONTROL REGISTER - * Bit fields: - * 27: HW_RF_KILL_SW - * Indicates state of (platform's) hardware RF-Kill switch - * 26-24: POWER_SAVE_TYPE - * Indicates current power-saving mode: - * 000 -- No power saving - * 001 -- MAC power-down - * 010 -- PHY (radio) power-down - * 011 -- Error - * 9-6: SYS_CONFIG - * Indicates current system configuration, reflecting pins on chip - * as forced high/low by device circuit board. - * 4: GOING_TO_SLEEP - * Indicates MAC is entering a power-saving sleep power-down. - * Not a good time to access device-internal resources. - * 3: MAC_ACCESS_REQ - * Host sets this to request and maintain MAC wakeup, to allow host - * access to device-internal resources. Host must wait for - * MAC_CLOCK_READY (and !GOING_TO_SLEEP) before accessing non-CSR - * device registers. - * 2: INIT_DONE - * Host sets this to put device into fully operational D0 power mode. - * Host resets this after SW_RESET to put device into low power mode. - * 0: MAC_CLOCK_READY - * Indicates MAC (ucode processor, etc.) is powered up and can run. - * Internal resources are accessible. - * NOTE: This does not indicate that the processor is actually running. - * NOTE: This does not indicate that device has completed - * init or post-power-down restore of internal SRAM memory. - * Use CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP as indication that - * SRAM is restored and uCode is in normal operation mode. - * Later devices (5xxx/6xxx/1xxx) use non-volatile SRAM, and - * do not need to save/restore it. - * NOTE: After device reset, this bit remains "0" until host sets - * INIT_DONE - */ -#define CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY (0x00000001) -#define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004) -#define CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ (0x00000008) -#define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010) - -#define CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN (0x00000001) - -#define CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x07000000) -#define CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000) -#define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000) - - -/* HW REV */ -#define CSR_HW_REV_DASH(_val) (((_val) & 0x0000003) >> 0) -#define CSR_HW_REV_STEP(_val) (((_val) & 0x000000C) >> 2) - -#define CSR_HW_REV_TYPE_MSK (0x000FFF0) -#define CSR_HW_REV_TYPE_5300 (0x0000020) -#define CSR_HW_REV_TYPE_5350 (0x0000030) -#define CSR_HW_REV_TYPE_5100 (0x0000050) -#define CSR_HW_REV_TYPE_5150 (0x0000040) -#define CSR_HW_REV_TYPE_1000 (0x0000060) -#define CSR_HW_REV_TYPE_6x00 (0x0000070) -#define CSR_HW_REV_TYPE_6x50 (0x0000080) -#define CSR_HW_REV_TYPE_6150 (0x0000084) -#define CSR_HW_REV_TYPE_6x05 (0x00000B0) -#define CSR_HW_REV_TYPE_6x30 CSR_HW_REV_TYPE_6x05 -#define CSR_HW_REV_TYPE_6x35 CSR_HW_REV_TYPE_6x05 -#define CSR_HW_REV_TYPE_2x30 (0x00000C0) -#define CSR_HW_REV_TYPE_2x00 (0x0000100) -#define CSR_HW_REV_TYPE_105 (0x0000110) -#define CSR_HW_REV_TYPE_135 (0x0000120) -#define CSR_HW_REV_TYPE_NONE (0x00001F0) - -/* EEPROM REG */ -#define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001) -#define CSR_EEPROM_REG_BIT_CMD (0x00000002) -#define CSR_EEPROM_REG_MSK_ADDR (0x0000FFFC) -#define CSR_EEPROM_REG_MSK_DATA (0xFFFF0000) - -/* EEPROM GP */ -#define CSR_EEPROM_GP_VALID_MSK (0x00000007) /* signature */ -#define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180) -#define CSR_EEPROM_GP_BAD_SIGNATURE_BOTH_EEP_AND_OTP (0x00000000) -#define CSR_EEPROM_GP_BAD_SIG_EEP_GOOD_SIG_OTP (0x00000001) -#define CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K (0x00000002) -#define CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K (0x00000004) - -/* One-time-programmable memory general purpose reg */ -#define CSR_OTP_GP_REG_DEVICE_SELECT (0x00010000) /* 0 - EEPROM, 1 - OTP */ -#define CSR_OTP_GP_REG_OTP_ACCESS_MODE (0x00020000) /* 0 - absolute, 1 - relative */ -#define CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK (0x00100000) /* bit 20 */ -#define CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK (0x00200000) /* bit 21 */ - -/* GP REG */ -#define CSR_GP_REG_POWER_SAVE_STATUS_MSK (0x03000000) /* bit 24/25 */ -#define CSR_GP_REG_NO_POWER_SAVE (0x00000000) -#define CSR_GP_REG_MAC_POWER_SAVE (0x01000000) -#define CSR_GP_REG_PHY_POWER_SAVE (0x02000000) -#define CSR_GP_REG_POWER_SAVE_ERROR (0x03000000) - - -/* CSR GIO */ -#define CSR_GIO_REG_VAL_L0S_ENABLED (0x00000002) - -/* - * UCODE-DRIVER GP (general purpose) mailbox register 1 - * Host driver and uCode write and/or read this register to communicate with - * each other. - * Bit fields: - * 4: UCODE_DISABLE - * Host sets this to request permanent halt of uCode, same as - * sending CARD_STATE command with "halt" bit set. - * 3: CT_KILL_EXIT - * Host sets this to request exit from CT_KILL state, i.e. host thinks - * device temperature is low enough to continue normal operation. - * 2: CMD_BLOCKED - * Host sets this during RF KILL power-down sequence (HW, SW, CT KILL) - * to release uCode to clear all Tx and command queues, enter - * unassociated mode, and power down. - * NOTE: Some devices also use HBUS_TARG_MBX_C register for this bit. - * 1: SW_BIT_RFKILL - * Host sets this when issuing CARD_STATE command to request - * device sleep. - * 0: MAC_SLEEP - * uCode sets this when preparing a power-saving power-down. - * uCode resets this when power-up is complete and SRAM is sane. - * NOTE: device saves internal SRAM data to host when powering down, - * and must restore this data after powering back up. - * MAC_SLEEP is the best indication that restore is complete. - * Later devices (5xxx/6xxx/1xxx) use non-volatile SRAM, and - * do not need to save/restore it. - */ -#define CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP (0x00000001) -#define CSR_UCODE_SW_BIT_RFKILL (0x00000002) -#define CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED (0x00000004) -#define CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT (0x00000008) -#define CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE (0x00000020) - -/* GP Driver */ -#define CSR_GP_DRIVER_REG_BIT_RADIO_SKU_MSK (0x00000003) -#define CSR_GP_DRIVER_REG_BIT_RADIO_SKU_3x3_HYB (0x00000000) -#define CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_HYB (0x00000001) -#define CSR_GP_DRIVER_REG_BIT_RADIO_SKU_2x2_IPA (0x00000002) -#define CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6 (0x00000004) -#define CSR_GP_DRIVER_REG_BIT_6050_1x2 (0x00000008) - -#define CSR_GP_DRIVER_REG_BIT_RADIO_IQ_INVER (0x00000080) - -/* GIO Chicken Bits (PCI Express bus link power management) */ -#define CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000) -#define CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER (0x20000000) - -/* LED */ -#define CSR_LED_BSM_CTRL_MSK (0xFFFFFFDF) -#define CSR_LED_REG_TURN_ON (0x60) -#define CSR_LED_REG_TURN_OFF (0x20) - -/* ANA_PLL */ -#define CSR50_ANA_PLL_CFG_VAL (0x00880300) - -/* HPET MEM debug */ -#define CSR_DBG_HPET_MEM_REG_VAL (0xFFFF0000) - -/* DRAM INT TABLE */ -#define CSR_DRAM_INT_TBL_ENABLE (1 << 31) -#define CSR_DRAM_INIT_TBL_WRAP_CHECK (1 << 27) - -/* - * HBUS (Host-side Bus) - * - * HBUS registers are mapped directly into PCI bus space, but are used - * to indirectly access device's internal memory or registers that - * may be powered-down. - * - * Use iwl_write_direct32()/iwl_read_direct32() family for these registers; - * host must "grab nic access" via CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ - * to make sure the MAC (uCode processor, etc.) is powered up for accessing - * internal resources. - * - * Do not use iwl_write32()/iwl_read32() family to access these registers; - * these provide only simple PCI bus access, without waking up the MAC. - */ -#define HBUS_BASE (0x400) - -/* - * Registers for accessing device's internal SRAM memory (e.g. SCD SRAM - * structures, error log, event log, verifying uCode load). - * First write to address register, then read from or write to data register - * to complete the job. Once the address register is set up, accesses to - * data registers auto-increment the address by one dword. - * Bit usage for address registers (read or write): - * 0-31: memory address within device - */ -#define HBUS_TARG_MEM_RADDR (HBUS_BASE+0x00c) -#define HBUS_TARG_MEM_WADDR (HBUS_BASE+0x010) -#define HBUS_TARG_MEM_WDAT (HBUS_BASE+0x018) -#define HBUS_TARG_MEM_RDAT (HBUS_BASE+0x01c) - -/* Mailbox C, used as workaround alternative to CSR_UCODE_DRV_GP1 mailbox */ -#define HBUS_TARG_MBX_C (HBUS_BASE+0x030) -#define HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED (0x00000004) - -/* - * Registers for accessing device's internal peripheral registers - * (e.g. SCD, BSM, etc.). First write to address register, - * then read from or write to data register to complete the job. - * Bit usage for address registers (read or write): - * 0-15: register address (offset) within device - * 24-25: (# bytes - 1) to read or write (e.g. 3 for dword) - */ -#define HBUS_TARG_PRPH_WADDR (HBUS_BASE+0x044) -#define HBUS_TARG_PRPH_RADDR (HBUS_BASE+0x048) -#define HBUS_TARG_PRPH_WDAT (HBUS_BASE+0x04c) -#define HBUS_TARG_PRPH_RDAT (HBUS_BASE+0x050) - -/* Used to enable DBGM */ -#define HBUS_TARG_TEST_REG (HBUS_BASE+0x05c) - -/* - * Per-Tx-queue write pointer (index, really!) - * Indicates index to next TFD that driver will fill (1 past latest filled). - * Bit usage: - * 0-7: queue write index - * 11-8: queue selector - */ -#define HBUS_TARG_WRPTR (HBUS_BASE+0x060) - -/********************************************************** - * CSR values - **********************************************************/ - /* - * host interrupt timeout value - * used with setting interrupt coalescing timer - * the CSR_INT_COALESCING is an 8 bit register in 32-usec unit - * - * default interrupt coalescing timer is 64 x 32 = 2048 usecs - * default interrupt coalescing calibration timer is 16 x 32 = 512 usecs - */ -#define IWL_HOST_INT_TIMEOUT_MAX (0xFF) -#define IWL_HOST_INT_TIMEOUT_DEF (0x40) -#define IWL_HOST_INT_TIMEOUT_MIN (0x0) -#define IWL_HOST_INT_CALIB_TIMEOUT_MAX (0xFF) -#define IWL_HOST_INT_CALIB_TIMEOUT_DEF (0x10) -#define IWL_HOST_INT_CALIB_TIMEOUT_MIN (0x0) - -#endif /* !__iwl_csr_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.c b/drivers/net/wireless/iwlwifi/iwl-debug.c deleted file mode 100644 index 8a44f594528d..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-debug.c +++ /dev/null @@ -1,138 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2007 - 2011 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#define DEBUG - -#include -#include -#include -#include "iwl-drv.h" -#include "iwl-debug.h" -#include "iwl-devtrace.h" - -#define __iwl_fn(fn) \ -void __iwl_ ##fn(struct device *dev, const char *fmt, ...) \ -{ \ - struct va_format vaf = { \ - .fmt = fmt, \ - }; \ - va_list args; \ - \ - va_start(args, fmt); \ - vaf.va = &args; \ - dev_ ##fn(dev, "%pV", &vaf); \ - trace_iwlwifi_ ##fn(&vaf); \ - va_end(args); \ -} - -__iwl_fn(warn) -IWL_EXPORT_SYMBOL(__iwl_warn); -__iwl_fn(info) -IWL_EXPORT_SYMBOL(__iwl_info); -__iwl_fn(crit) -IWL_EXPORT_SYMBOL(__iwl_crit); - -void __iwl_err(struct device *dev, bool rfkill_prefix, bool trace_only, - const char *fmt, ...) -{ - struct va_format vaf = { - .fmt = fmt, - }; - va_list args; - - va_start(args, fmt); - vaf.va = &args; - if (!trace_only) { - if (rfkill_prefix) - dev_err(dev, "(RFKILL) %pV", &vaf); - else - dev_err(dev, "%pV", &vaf); - } - trace_iwlwifi_err(&vaf); - va_end(args); -} -IWL_EXPORT_SYMBOL(__iwl_err); - -#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING) -void __iwl_dbg(struct device *dev, - u32 level, bool limit, const char *function, - const char *fmt, ...) -{ - struct va_format vaf = { - .fmt = fmt, - }; - va_list args; - - va_start(args, fmt); - vaf.va = &args; -#ifdef CONFIG_IWLWIFI_DEBUG - if (iwl_have_debug_level(level) && - (!limit || net_ratelimit())) - dev_dbg(dev, "%c %s %pV", in_interrupt() ? 'I' : 'U', - function, &vaf); -#endif - trace_iwlwifi_dbg(level, in_interrupt(), function, &vaf); - va_end(args); -} -IWL_EXPORT_SYMBOL(__iwl_dbg); -#endif diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h deleted file mode 100644 index 8cf5db7fb5c9..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ /dev/null @@ -1,187 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#ifndef __iwl_debug_h__ -#define __iwl_debug_h__ - -#include "iwl-modparams.h" - - -static inline bool iwl_have_debug_level(u32 level) -{ - return iwlwifi_mod_params.debug_level & level; -} - -void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace, - const char *fmt, ...) __printf(4, 5); -void __iwl_warn(struct device *dev, const char *fmt, ...) __printf(2, 3); -void __iwl_info(struct device *dev, const char *fmt, ...) __printf(2, 3); -void __iwl_crit(struct device *dev, const char *fmt, ...) __printf(2, 3); - -/* No matter what is m (priv, bus, trans), this will work */ -#define IWL_ERR(m, f, a...) __iwl_err((m)->dev, false, false, f, ## a) -#define IWL_ERR_DEV(d, f, a...) __iwl_err((d), false, false, f, ## a) -#define IWL_WARN(m, f, a...) __iwl_warn((m)->dev, f, ## a) -#define IWL_INFO(m, f, a...) __iwl_info((m)->dev, f, ## a) -#define IWL_CRIT(m, f, a...) __iwl_crit((m)->dev, f, ## a) - -#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING) -void __iwl_dbg(struct device *dev, - u32 level, bool limit, const char *function, - const char *fmt, ...) __printf(5, 6); -#else -__printf(5, 6) static inline void -__iwl_dbg(struct device *dev, - u32 level, bool limit, const char *function, - const char *fmt, ...) -{} -#endif - -#define iwl_print_hex_error(m, p, len) \ -do { \ - print_hex_dump(KERN_ERR, "iwl data: ", \ - DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ -} while (0) - -#define IWL_DEBUG(m, level, fmt, args...) \ - __iwl_dbg((m)->dev, level, false, __func__, fmt, ##args) -#define IWL_DEBUG_DEV(dev, level, fmt, args...) \ - __iwl_dbg((dev), level, false, __func__, fmt, ##args) -#define IWL_DEBUG_LIMIT(m, level, fmt, args...) \ - __iwl_dbg((m)->dev, level, true, __func__, fmt, ##args) - -#ifdef CONFIG_IWLWIFI_DEBUG -#define iwl_print_hex_dump(m, level, p, len) \ -do { \ - if (iwl_have_debug_level(level)) \ - print_hex_dump(KERN_DEBUG, "iwl data: ", \ - DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ -} while (0) -#else -#define iwl_print_hex_dump(m, level, p, len) -#endif /* CONFIG_IWLWIFI_DEBUG */ - -/* - * To use the debug system: - * - * If you are defining a new debug classification, simply add it to the #define - * list here in the form of - * - * #define IWL_DL_xxxx VALUE - * - * where xxxx should be the name of the classification (for example, WEP). - * - * You then need to either add a IWL_xxxx_DEBUG() macro definition for your - * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want - * to send output to that classification. - * - * The active debug levels can be accessed via files - * - * /sys/module/iwlwifi/parameters/debug - * when CONFIG_IWLWIFI_DEBUG=y. - * - * /sys/kernel/debug/phy0/iwlwifi/debug/debug_level - * when CONFIG_IWLWIFI_DEBUGFS=y. - * - */ - -/* 0x0000000F - 0x00000001 */ -#define IWL_DL_INFO 0x00000001 -#define IWL_DL_MAC80211 0x00000002 -#define IWL_DL_HCMD 0x00000004 -#define IWL_DL_STATE 0x00000008 -/* 0x000000F0 - 0x00000010 */ -#define IWL_DL_TE 0x00000020 -#define IWL_DL_EEPROM 0x00000040 -#define IWL_DL_RADIO 0x00000080 -/* 0x00000F00 - 0x00000100 */ -#define IWL_DL_POWER 0x00000100 -#define IWL_DL_TEMP 0x00000200 -#define IWL_DL_SCAN 0x00000800 -/* 0x0000F000 - 0x00001000 */ -#define IWL_DL_ASSOC 0x00001000 -#define IWL_DL_DROP 0x00002000 -#define IWL_DL_COEX 0x00008000 -/* 0x000F0000 - 0x00010000 */ -#define IWL_DL_FW 0x00010000 -#define IWL_DL_RF_KILL 0x00020000 -#define IWL_DL_FW_ERRORS 0x00040000 -#define IWL_DL_LED 0x00080000 -/* 0x00F00000 - 0x00100000 */ -#define IWL_DL_RATE 0x00100000 -#define IWL_DL_CALIB 0x00200000 -#define IWL_DL_WEP 0x00400000 -#define IWL_DL_TX 0x00800000 -/* 0x0F000000 - 0x01000000 */ -#define IWL_DL_RX 0x01000000 -#define IWL_DL_ISR 0x02000000 -#define IWL_DL_HT 0x04000000 -/* 0xF0000000 - 0x10000000 */ -#define IWL_DL_11H 0x10000000 -#define IWL_DL_STATS 0x20000000 -#define IWL_DL_TX_REPLY 0x40000000 -#define IWL_DL_TX_QUEUES 0x80000000 - -#define IWL_DEBUG_INFO(p, f, a...) IWL_DEBUG(p, IWL_DL_INFO, f, ## a) -#define IWL_DEBUG_MAC80211(p, f, a...) IWL_DEBUG(p, IWL_DL_MAC80211, f, ## a) -#define IWL_DEBUG_TEMP(p, f, a...) IWL_DEBUG(p, IWL_DL_TEMP, f, ## a) -#define IWL_DEBUG_SCAN(p, f, a...) IWL_DEBUG(p, IWL_DL_SCAN, f, ## a) -#define IWL_DEBUG_RX(p, f, a...) IWL_DEBUG(p, IWL_DL_RX, f, ## a) -#define IWL_DEBUG_TX(p, f, a...) IWL_DEBUG(p, IWL_DL_TX, f, ## a) -#define IWL_DEBUG_ISR(p, f, a...) IWL_DEBUG(p, IWL_DL_ISR, f, ## a) -#define IWL_DEBUG_LED(p, f, a...) IWL_DEBUG(p, IWL_DL_LED, f, ## a) -#define IWL_DEBUG_WEP(p, f, a...) IWL_DEBUG(p, IWL_DL_WEP, f, ## a) -#define IWL_DEBUG_HC(p, f, a...) IWL_DEBUG(p, IWL_DL_HCMD, f, ## a) -#define IWL_DEBUG_TE(p, f, a...) IWL_DEBUG(p, IWL_DL_TE, f, ## a) -#define IWL_DEBUG_EEPROM(d, f, a...) IWL_DEBUG_DEV(d, IWL_DL_EEPROM, f, ## a) -#define IWL_DEBUG_CALIB(p, f, a...) IWL_DEBUG(p, IWL_DL_CALIB, f, ## a) -#define IWL_DEBUG_FW(p, f, a...) IWL_DEBUG(p, IWL_DL_FW, f, ## a) -#define IWL_DEBUG_RF_KILL(p, f, a...) IWL_DEBUG(p, IWL_DL_RF_KILL, f, ## a) -#define IWL_DEBUG_FW_ERRORS(p, f, a...) IWL_DEBUG(p, IWL_DL_FW_ERRORS, f, ## a) -#define IWL_DEBUG_DROP(p, f, a...) IWL_DEBUG(p, IWL_DL_DROP, f, ## a) -#define IWL_DEBUG_DROP_LIMIT(p, f, a...) \ - IWL_DEBUG_LIMIT(p, IWL_DL_DROP, f, ## a) -#define IWL_DEBUG_COEX(p, f, a...) IWL_DEBUG(p, IWL_DL_COEX, f, ## a) -#define IWL_DEBUG_RATE(p, f, a...) IWL_DEBUG(p, IWL_DL_RATE, f, ## a) -#define IWL_DEBUG_RATE_LIMIT(p, f, a...) \ - IWL_DEBUG_LIMIT(p, IWL_DL_RATE, f, ## a) -#define IWL_DEBUG_ASSOC(p, f, a...) \ - IWL_DEBUG(p, IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) -#define IWL_DEBUG_ASSOC_LIMIT(p, f, a...) \ - IWL_DEBUG_LIMIT(p, IWL_DL_ASSOC | IWL_DL_INFO, f, ## a) -#define IWL_DEBUG_HT(p, f, a...) IWL_DEBUG(p, IWL_DL_HT, f, ## a) -#define IWL_DEBUG_STATS(p, f, a...) IWL_DEBUG(p, IWL_DL_STATS, f, ## a) -#define IWL_DEBUG_STATS_LIMIT(p, f, a...) \ - IWL_DEBUG_LIMIT(p, IWL_DL_STATS, f, ## a) -#define IWL_DEBUG_TX_REPLY(p, f, a...) IWL_DEBUG(p, IWL_DL_TX_REPLY, f, ## a) -#define IWL_DEBUG_TX_QUEUES(p, f, a...) IWL_DEBUG(p, IWL_DL_TX_QUEUES, f, ## a) -#define IWL_DEBUG_RADIO(p, f, a...) IWL_DEBUG(p, IWL_DL_RADIO, f, ## a) -#define IWL_DEBUG_POWER(p, f, a...) IWL_DEBUG(p, IWL_DL_POWER, f, ## a) -#define IWL_DEBUG_11H(p, f, a...) IWL_DEBUG(p, IWL_DL_11H, f, ## a) - -#endif diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.c b/drivers/net/wireless/iwlwifi/iwl-devtrace.c deleted file mode 100644 index 8f61c717f619..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-devtrace.c +++ /dev/null @@ -1,50 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#include - -/* sparse doesn't like tracepoint macros */ -#ifndef __CHECKER__ -#include "iwl-trans.h" - -#define CREATE_TRACE_POINTS -#include "iwl-devtrace.h" - -EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_iowrite8); -EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ioread32); -EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_iowrite32); -EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_rx); -EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_tx); -EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_event); -EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_error); -EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_cont_event); -EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_wrap_event); -EXPORT_TRACEPOINT_SYMBOL(iwlwifi_info); -EXPORT_TRACEPOINT_SYMBOL(iwlwifi_warn); -EXPORT_TRACEPOINT_SYMBOL(iwlwifi_crit); -EXPORT_TRACEPOINT_SYMBOL(iwlwifi_err); -EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dbg); -#endif diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.h b/drivers/net/wireless/iwlwifi/iwl-devtrace.h deleted file mode 100644 index 4491c1c72cc7..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-devtrace.h +++ /dev/null @@ -1,514 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ) -#include -#include -#include -#include "iwl-trans.h" -#if !defined(__IWLWIFI_DEVICE_TRACE) -static inline bool iwl_trace_data(struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (void *)skb->data; - - if (ieee80211_is_data(hdr->frame_control)) - return skb->protocol != cpu_to_be16(ETH_P_PAE); - return false; -} - -static inline size_t iwl_rx_trace_len(const struct iwl_trans *trans, - void *rxbuf, size_t len) -{ - struct iwl_cmd_header *cmd = (void *)((u8 *)rxbuf + sizeof(__le32)); - struct ieee80211_hdr *hdr; - - if (cmd->cmd != trans->rx_mpdu_cmd) - return len; - - hdr = (void *)((u8 *)cmd + sizeof(struct iwl_cmd_header) + - trans->rx_mpdu_cmd_hdr_size); - if (!ieee80211_is_data(hdr->frame_control)) - return len; - /* maybe try to identify EAPOL frames? */ - return sizeof(__le32) + sizeof(*cmd) + trans->rx_mpdu_cmd_hdr_size + - ieee80211_hdrlen(hdr->frame_control); -} -#endif - -#define __IWLWIFI_DEVICE_TRACE - -#include -#include -#include "iwl-trans.h" - - -#if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__) -#undef TRACE_EVENT -#define TRACE_EVENT(name, proto, ...) \ -static inline void trace_ ## name(proto) {} -#undef DECLARE_EVENT_CLASS -#define DECLARE_EVENT_CLASS(...) -#undef DEFINE_EVENT -#define DEFINE_EVENT(evt_class, name, proto, ...) \ -static inline void trace_ ## name(proto) {} -#endif - -#define DEV_ENTRY __string(dev, dev_name(dev)) -#define DEV_ASSIGN __assign_str(dev, dev_name(dev)) - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM iwlwifi_io - -TRACE_EVENT(iwlwifi_dev_ioread32, - TP_PROTO(const struct device *dev, u32 offs, u32 val), - TP_ARGS(dev, offs, val), - TP_STRUCT__entry( - DEV_ENTRY - __field(u32, offs) - __field(u32, val) - ), - TP_fast_assign( - DEV_ASSIGN; - __entry->offs = offs; - __entry->val = val; - ), - TP_printk("[%s] read io[%#x] = %#x", - __get_str(dev), __entry->offs, __entry->val) -); - -TRACE_EVENT(iwlwifi_dev_iowrite8, - TP_PROTO(const struct device *dev, u32 offs, u8 val), - TP_ARGS(dev, offs, val), - TP_STRUCT__entry( - DEV_ENTRY - __field(u32, offs) - __field(u8, val) - ), - TP_fast_assign( - DEV_ASSIGN; - __entry->offs = offs; - __entry->val = val; - ), - TP_printk("[%s] write io[%#x] = %#x)", - __get_str(dev), __entry->offs, __entry->val) -); - -TRACE_EVENT(iwlwifi_dev_iowrite32, - TP_PROTO(const struct device *dev, u32 offs, u32 val), - TP_ARGS(dev, offs, val), - TP_STRUCT__entry( - DEV_ENTRY - __field(u32, offs) - __field(u32, val) - ), - TP_fast_assign( - DEV_ASSIGN; - __entry->offs = offs; - __entry->val = val; - ), - TP_printk("[%s] write io[%#x] = %#x)", - __get_str(dev), __entry->offs, __entry->val) -); - -TRACE_EVENT(iwlwifi_dev_iowrite_prph32, - TP_PROTO(const struct device *dev, u32 offs, u32 val), - TP_ARGS(dev, offs, val), - TP_STRUCT__entry( - DEV_ENTRY - __field(u32, offs) - __field(u32, val) - ), - TP_fast_assign( - DEV_ASSIGN; - __entry->offs = offs; - __entry->val = val; - ), - TP_printk("[%s] write PRPH[%#x] = %#x)", - __get_str(dev), __entry->offs, __entry->val) -); - -TRACE_EVENT(iwlwifi_dev_ioread_prph32, - TP_PROTO(const struct device *dev, u32 offs, u32 val), - TP_ARGS(dev, offs, val), - TP_STRUCT__entry( - DEV_ENTRY - __field(u32, offs) - __field(u32, val) - ), - TP_fast_assign( - DEV_ASSIGN; - __entry->offs = offs; - __entry->val = val; - ), - TP_printk("[%s] read PRPH[%#x] = %#x", - __get_str(dev), __entry->offs, __entry->val) -); - -TRACE_EVENT(iwlwifi_dev_irq, - TP_PROTO(const struct device *dev), - TP_ARGS(dev), - TP_STRUCT__entry( - DEV_ENTRY - ), - TP_fast_assign( - DEV_ASSIGN; - ), - /* TP_printk("") doesn't compile */ - TP_printk("%d", 0) -); - -TRACE_EVENT(iwlwifi_dev_ict_read, - TP_PROTO(const struct device *dev, u32 index, u32 value), - TP_ARGS(dev, index, value), - TP_STRUCT__entry( - DEV_ENTRY - __field(u32, index) - __field(u32, value) - ), - TP_fast_assign( - DEV_ASSIGN; - __entry->index = index; - __entry->value = value; - ), - TP_printk("[%s] read ict[%d] = %#.8x", - __get_str(dev), __entry->index, __entry->value) -); - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM iwlwifi_ucode - -TRACE_EVENT(iwlwifi_dev_ucode_cont_event, - TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev), - TP_ARGS(dev, time, data, ev), - TP_STRUCT__entry( - DEV_ENTRY - - __field(u32, time) - __field(u32, data) - __field(u32, ev) - ), - TP_fast_assign( - DEV_ASSIGN; - __entry->time = time; - __entry->data = data; - __entry->ev = ev; - ), - TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u", - __get_str(dev), __entry->time, __entry->data, __entry->ev) -); - -TRACE_EVENT(iwlwifi_dev_ucode_wrap_event, - TP_PROTO(const struct device *dev, u32 wraps, u32 n_entry, u32 p_entry), - TP_ARGS(dev, wraps, n_entry, p_entry), - TP_STRUCT__entry( - DEV_ENTRY - - __field(u32, wraps) - __field(u32, n_entry) - __field(u32, p_entry) - ), - TP_fast_assign( - DEV_ASSIGN; - __entry->wraps = wraps; - __entry->n_entry = n_entry; - __entry->p_entry = p_entry; - ), - TP_printk("[%s] wraps=#%02d n=0x%X p=0x%X", - __get_str(dev), __entry->wraps, __entry->n_entry, - __entry->p_entry) -); - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM iwlwifi_msg - -#define MAX_MSG_LEN 110 - -DECLARE_EVENT_CLASS(iwlwifi_msg_event, - TP_PROTO(struct va_format *vaf), - TP_ARGS(vaf), - TP_STRUCT__entry( - __dynamic_array(char, msg, MAX_MSG_LEN) - ), - TP_fast_assign( - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), - MAX_MSG_LEN, vaf->fmt, - *vaf->va) >= MAX_MSG_LEN); - ), - TP_printk("%s", __get_str(msg)) -); - -DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_err, - TP_PROTO(struct va_format *vaf), - TP_ARGS(vaf) -); - -DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_warn, - TP_PROTO(struct va_format *vaf), - TP_ARGS(vaf) -); - -DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_info, - TP_PROTO(struct va_format *vaf), - TP_ARGS(vaf) -); - -DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_crit, - TP_PROTO(struct va_format *vaf), - TP_ARGS(vaf) -); - -TRACE_EVENT(iwlwifi_dbg, - TP_PROTO(u32 level, bool in_interrupt, const char *function, - struct va_format *vaf), - TP_ARGS(level, in_interrupt, function, vaf), - TP_STRUCT__entry( - __field(u32, level) - __field(u8, in_interrupt) - __string(function, function) - __dynamic_array(char, msg, MAX_MSG_LEN) - ), - TP_fast_assign( - __entry->level = level; - __entry->in_interrupt = in_interrupt; - __assign_str(function, function); - WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), - MAX_MSG_LEN, vaf->fmt, - *vaf->va) >= MAX_MSG_LEN); - ), - TP_printk("%s", __get_str(msg)) -); - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM iwlwifi_data - -TRACE_EVENT(iwlwifi_dev_tx_data, - TP_PROTO(const struct device *dev, - struct sk_buff *skb, - void *data, size_t data_len), - TP_ARGS(dev, skb, data, data_len), - TP_STRUCT__entry( - DEV_ENTRY - - __dynamic_array(u8, data, iwl_trace_data(skb) ? data_len : 0) - ), - TP_fast_assign( - DEV_ASSIGN; - if (iwl_trace_data(skb)) - memcpy(__get_dynamic_array(data), data, data_len); - ), - TP_printk("[%s] TX frame data", __get_str(dev)) -); - -TRACE_EVENT(iwlwifi_dev_rx_data, - TP_PROTO(const struct device *dev, - const struct iwl_trans *trans, - void *rxbuf, size_t len), - TP_ARGS(dev, trans, rxbuf, len), - TP_STRUCT__entry( - DEV_ENTRY - - __dynamic_array(u8, data, - len - iwl_rx_trace_len(trans, rxbuf, len)) - ), - TP_fast_assign( - size_t offs = iwl_rx_trace_len(trans, rxbuf, len); - DEV_ASSIGN; - if (offs < len) - memcpy(__get_dynamic_array(data), - ((u8 *)rxbuf) + offs, len - offs); - ), - TP_printk("[%s] RX frame data", __get_str(dev)) -); - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM iwlwifi - -TRACE_EVENT(iwlwifi_dev_hcmd, - TP_PROTO(const struct device *dev, - struct iwl_host_cmd *cmd, u16 total_size, - struct iwl_cmd_header *hdr), - TP_ARGS(dev, cmd, total_size, hdr), - TP_STRUCT__entry( - DEV_ENTRY - __dynamic_array(u8, hcmd, total_size) - __field(u32, flags) - ), - TP_fast_assign( - int i, offset = sizeof(*hdr); - - DEV_ASSIGN; - __entry->flags = cmd->flags; - memcpy(__get_dynamic_array(hcmd), hdr, sizeof(*hdr)); - - for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { - if (!cmd->len[i]) - continue; - memcpy((u8 *)__get_dynamic_array(hcmd) + offset, - cmd->data[i], cmd->len[i]); - offset += cmd->len[i]; - } - ), - TP_printk("[%s] hcmd %#.2x (%ssync)", - __get_str(dev), ((u8 *)__get_dynamic_array(hcmd))[0], - __entry->flags & CMD_ASYNC ? "a" : "") -); - -TRACE_EVENT(iwlwifi_dev_rx, - TP_PROTO(const struct device *dev, const struct iwl_trans *trans, - void *rxbuf, size_t len), - TP_ARGS(dev, trans, rxbuf, len), - TP_STRUCT__entry( - DEV_ENTRY - __dynamic_array(u8, rxbuf, iwl_rx_trace_len(trans, rxbuf, len)) - ), - TP_fast_assign( - DEV_ASSIGN; - memcpy(__get_dynamic_array(rxbuf), rxbuf, - iwl_rx_trace_len(trans, rxbuf, len)); - ), - TP_printk("[%s] RX cmd %#.2x", - __get_str(dev), ((u8 *)__get_dynamic_array(rxbuf))[4]) -); - -TRACE_EVENT(iwlwifi_dev_tx, - TP_PROTO(const struct device *dev, struct sk_buff *skb, - void *tfd, size_t tfdlen, - void *buf0, size_t buf0_len, - void *buf1, size_t buf1_len), - TP_ARGS(dev, skb, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len), - TP_STRUCT__entry( - DEV_ENTRY - - __field(size_t, framelen) - __dynamic_array(u8, tfd, tfdlen) - - /* - * Do not insert between or below these items, - * we want to keep the frame together (except - * for the possible padding). - */ - __dynamic_array(u8, buf0, buf0_len) - __dynamic_array(u8, buf1, iwl_trace_data(skb) ? 0 : buf1_len) - ), - TP_fast_assign( - DEV_ASSIGN; - __entry->framelen = buf0_len + buf1_len; - memcpy(__get_dynamic_array(tfd), tfd, tfdlen); - memcpy(__get_dynamic_array(buf0), buf0, buf0_len); - if (!iwl_trace_data(skb)) - memcpy(__get_dynamic_array(buf1), buf1, buf1_len); - ), - TP_printk("[%s] TX %.2x (%zu bytes)", - __get_str(dev), ((u8 *)__get_dynamic_array(buf0))[0], - __entry->framelen) -); - -TRACE_EVENT(iwlwifi_dev_ucode_error, - TP_PROTO(const struct device *dev, u32 desc, u32 tsf_low, - u32 data1, u32 data2, u32 line, u32 blink1, - u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time, - u32 gp1, u32 gp2, u32 gp3, u32 ucode_ver, u32 hw_ver, - u32 brd_ver), - TP_ARGS(dev, desc, tsf_low, data1, data2, line, - blink1, blink2, ilink1, ilink2, bcon_time, gp1, gp2, - gp3, ucode_ver, hw_ver, brd_ver), - TP_STRUCT__entry( - DEV_ENTRY - __field(u32, desc) - __field(u32, tsf_low) - __field(u32, data1) - __field(u32, data2) - __field(u32, line) - __field(u32, blink1) - __field(u32, blink2) - __field(u32, ilink1) - __field(u32, ilink2) - __field(u32, bcon_time) - __field(u32, gp1) - __field(u32, gp2) - __field(u32, gp3) - __field(u32, ucode_ver) - __field(u32, hw_ver) - __field(u32, brd_ver) - ), - TP_fast_assign( - DEV_ASSIGN; - __entry->desc = desc; - __entry->tsf_low = tsf_low; - __entry->data1 = data1; - __entry->data2 = data2; - __entry->line = line; - __entry->blink1 = blink1; - __entry->blink2 = blink2; - __entry->ilink1 = ilink1; - __entry->ilink2 = ilink2; - __entry->bcon_time = bcon_time; - __entry->gp1 = gp1; - __entry->gp2 = gp2; - __entry->gp3 = gp3; - __entry->ucode_ver = ucode_ver; - __entry->hw_ver = hw_ver; - __entry->brd_ver = brd_ver; - ), - TP_printk("[%s] #%02d %010u data 0x%08X 0x%08X line %u, " - "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X " - "bcon_tm %010u gp 0x%08X 0x%08X 0x%08X uCode 0x%08X " - "hw 0x%08X brd 0x%08X", - __get_str(dev), __entry->desc, __entry->tsf_low, - __entry->data1, - __entry->data2, __entry->line, __entry->blink1, - __entry->blink2, __entry->ilink1, __entry->ilink2, - __entry->bcon_time, __entry->gp1, __entry->gp2, - __entry->gp3, __entry->ucode_ver, __entry->hw_ver, - __entry->brd_ver) -); - -TRACE_EVENT(iwlwifi_dev_ucode_event, - TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev), - TP_ARGS(dev, time, data, ev), - TP_STRUCT__entry( - DEV_ENTRY - - __field(u32, time) - __field(u32, data) - __field(u32, ev) - ), - TP_fast_assign( - DEV_ASSIGN; - __entry->time = time; - __entry->data = data; - __entry->ev = ev; - ), - TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u", - __get_str(dev), __entry->time, __entry->data, __entry->ev) -); -#endif /* __IWLWIFI_DEVICE_TRACE */ - -#undef TRACE_INCLUDE_PATH -#define TRACE_INCLUDE_PATH . -#undef TRACE_INCLUDE_FILE -#define TRACE_INCLUDE_FILE iwl-devtrace -#include diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c deleted file mode 100644 index 40fed1f511e2..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-drv.c +++ /dev/null @@ -1,1276 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2007 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#include -#include -#include -#include -#include - -#include "iwl-drv.h" -#include "iwl-debug.h" -#include "iwl-trans.h" -#include "iwl-op-mode.h" -#include "iwl-agn-hw.h" -#include "iwl-fw.h" -#include "iwl-config.h" -#include "iwl-modparams.h" - -/* private includes */ -#include "iwl-fw-file.h" - -/****************************************************************************** - * - * module boiler plate - * - ******************************************************************************/ - -/* - * module name, copyright, version, etc. - */ -#define DRV_DESCRIPTION "Intel(R) Wireless WiFi driver for Linux" - -#ifdef CONFIG_IWLWIFI_DEBUG -#define VD "d" -#else -#define VD -#endif - -#define DRV_VERSION IWLWIFI_VERSION VD - -MODULE_DESCRIPTION(DRV_DESCRIPTION); -MODULE_VERSION(DRV_VERSION); -MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); -MODULE_LICENSE("GPL"); - -#ifdef CONFIG_IWLWIFI_DEBUGFS -static struct dentry *iwl_dbgfs_root; -#endif - -/** - * struct iwl_drv - drv common data - * @list: list of drv structures using this opmode - * @fw: the iwl_fw structure - * @op_mode: the running op_mode - * @trans: transport layer - * @dev: for debug prints only - * @cfg: configuration struct - * @fw_index: firmware revision to try loading - * @firmware_name: composite filename of ucode file to load - * @request_firmware_complete: the firmware has been obtained from user space - */ -struct iwl_drv { - struct list_head list; - struct iwl_fw fw; - - struct iwl_op_mode *op_mode; - struct iwl_trans *trans; - struct device *dev; - const struct iwl_cfg *cfg; - - int fw_index; /* firmware we're trying to load */ - char firmware_name[25]; /* name of firmware file to load */ - - struct completion request_firmware_complete; - -#ifdef CONFIG_IWLWIFI_DEBUGFS - struct dentry *dbgfs_drv; - struct dentry *dbgfs_trans; - struct dentry *dbgfs_op_mode; -#endif -}; - -enum { - DVM_OP_MODE = 0, - MVM_OP_MODE = 1, -}; - -/* Protects the table contents, i.e. the ops pointer & drv list */ -static struct mutex iwlwifi_opmode_table_mtx; -static struct iwlwifi_opmode_table { - const char *name; /* name: iwldvm, iwlmvm, etc */ - const struct iwl_op_mode_ops *ops; /* pointer to op_mode ops */ - struct list_head drv; /* list of devices using this op_mode */ -} iwlwifi_opmode_table[] = { /* ops set when driver is initialized */ - [DVM_OP_MODE] = { .name = "iwldvm", .ops = NULL }, - [MVM_OP_MODE] = { .name = "iwlmvm", .ops = NULL }, -}; - -/* - * struct fw_sec: Just for the image parsing proccess. - * For the fw storage we are using struct fw_desc. - */ -struct fw_sec { - const void *data; /* the sec data */ - size_t size; /* section size */ - u32 offset; /* offset of writing in the device */ -}; - -static void iwl_free_fw_desc(struct iwl_drv *drv, struct fw_desc *desc) -{ - vfree(desc->data); - desc->data = NULL; - desc->len = 0; -} - -static void iwl_free_fw_img(struct iwl_drv *drv, struct fw_img *img) -{ - int i; - for (i = 0; i < IWL_UCODE_SECTION_MAX; i++) - iwl_free_fw_desc(drv, &img->sec[i]); -} - -static void iwl_dealloc_ucode(struct iwl_drv *drv) -{ - int i; - for (i = 0; i < IWL_UCODE_TYPE_MAX; i++) - iwl_free_fw_img(drv, drv->fw.img + i); -} - -static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc, - struct fw_sec *sec) -{ - void *data; - - desc->data = NULL; - - if (!sec || !sec->size) - return -EINVAL; - - data = vmalloc(sec->size); - if (!data) - return -ENOMEM; - - desc->len = sec->size; - desc->offset = sec->offset; - memcpy(data, sec->data, desc->len); - desc->data = data; - - return 0; -} - -static void iwl_req_fw_callback(const struct firmware *ucode_raw, - void *context); - -#define UCODE_EXPERIMENTAL_INDEX 100 -#define UCODE_EXPERIMENTAL_TAG "exp" - -static int iwl_request_firmware(struct iwl_drv *drv, bool first) -{ - const char *name_pre = drv->cfg->fw_name_pre; - char tag[8]; - - if (first) { -#ifdef CONFIG_IWLWIFI_DEBUG_EXPERIMENTAL_UCODE - drv->fw_index = UCODE_EXPERIMENTAL_INDEX; - strcpy(tag, UCODE_EXPERIMENTAL_TAG); - } else if (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) { -#endif - drv->fw_index = drv->cfg->ucode_api_max; - sprintf(tag, "%d", drv->fw_index); - } else { - drv->fw_index--; - sprintf(tag, "%d", drv->fw_index); - } - - if (drv->fw_index < drv->cfg->ucode_api_min) { - IWL_ERR(drv, "no suitable firmware found!\n"); - return -ENOENT; - } - - sprintf(drv->firmware_name, "%s%s%s", name_pre, tag, ".ucode"); - - IWL_DEBUG_INFO(drv, "attempting to load firmware %s'%s'\n", - (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) - ? "EXPERIMENTAL " : "", - drv->firmware_name); - - return request_firmware_nowait(THIS_MODULE, 1, drv->firmware_name, - drv->trans->dev, - GFP_KERNEL, drv, iwl_req_fw_callback); -} - -struct fw_img_parsing { - struct fw_sec sec[IWL_UCODE_SECTION_MAX]; - int sec_counter; -}; - -/* - * struct fw_sec_parsing: to extract fw section and it's offset from tlv - */ -struct fw_sec_parsing { - __le32 offset; - const u8 data[]; -} __packed; - -/** - * struct iwl_tlv_calib_data - parse the default calib data from TLV - * - * @ucode_type: the uCode to which the following default calib relates. - * @calib: default calibrations. - */ -struct iwl_tlv_calib_data { - __le32 ucode_type; - struct iwl_tlv_calib_ctrl calib; -} __packed; - -struct iwl_firmware_pieces { - struct fw_img_parsing img[IWL_UCODE_TYPE_MAX]; - - u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr; - u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr; -}; - -/* - * These functions are just to extract uCode section data from the pieces - * structure. - */ -static struct fw_sec *get_sec(struct iwl_firmware_pieces *pieces, - enum iwl_ucode_type type, - int sec) -{ - return &pieces->img[type].sec[sec]; -} - -static void set_sec_data(struct iwl_firmware_pieces *pieces, - enum iwl_ucode_type type, - int sec, - const void *data) -{ - pieces->img[type].sec[sec].data = data; -} - -static void set_sec_size(struct iwl_firmware_pieces *pieces, - enum iwl_ucode_type type, - int sec, - size_t size) -{ - pieces->img[type].sec[sec].size = size; -} - -static size_t get_sec_size(struct iwl_firmware_pieces *pieces, - enum iwl_ucode_type type, - int sec) -{ - return pieces->img[type].sec[sec].size; -} - -static void set_sec_offset(struct iwl_firmware_pieces *pieces, - enum iwl_ucode_type type, - int sec, - u32 offset) -{ - pieces->img[type].sec[sec].offset = offset; -} - -/* - * Gets uCode section from tlv. - */ -static int iwl_store_ucode_sec(struct iwl_firmware_pieces *pieces, - const void *data, enum iwl_ucode_type type, - int size) -{ - struct fw_img_parsing *img; - struct fw_sec *sec; - struct fw_sec_parsing *sec_parse; - - if (WARN_ON(!pieces || !data || type >= IWL_UCODE_TYPE_MAX)) - return -1; - - sec_parse = (struct fw_sec_parsing *)data; - - img = &pieces->img[type]; - sec = &img->sec[img->sec_counter]; - - sec->offset = le32_to_cpu(sec_parse->offset); - sec->data = sec_parse->data; - sec->size = size - sizeof(sec_parse->offset); - - ++img->sec_counter; - - return 0; -} - -static int iwl_set_default_calib(struct iwl_drv *drv, const u8 *data) -{ - struct iwl_tlv_calib_data *def_calib = - (struct iwl_tlv_calib_data *)data; - u32 ucode_type = le32_to_cpu(def_calib->ucode_type); - if (ucode_type >= IWL_UCODE_TYPE_MAX) { - IWL_ERR(drv, "Wrong ucode_type %u for default calibration.\n", - ucode_type); - return -EINVAL; - } - drv->fw.default_calib[ucode_type].flow_trigger = - def_calib->calib.flow_trigger; - drv->fw.default_calib[ucode_type].event_trigger = - def_calib->calib.event_trigger; - - return 0; -} - -static int iwl_parse_v1_v2_firmware(struct iwl_drv *drv, - const struct firmware *ucode_raw, - struct iwl_firmware_pieces *pieces) -{ - struct iwl_ucode_header *ucode = (void *)ucode_raw->data; - u32 api_ver, hdr_size, build; - char buildstr[25]; - const u8 *src; - - drv->fw.ucode_ver = le32_to_cpu(ucode->ver); - api_ver = IWL_UCODE_API(drv->fw.ucode_ver); - - switch (api_ver) { - default: - hdr_size = 28; - if (ucode_raw->size < hdr_size) { - IWL_ERR(drv, "File size too small!\n"); - return -EINVAL; - } - build = le32_to_cpu(ucode->u.v2.build); - set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST, - le32_to_cpu(ucode->u.v2.inst_size)); - set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA, - le32_to_cpu(ucode->u.v2.data_size)); - set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST, - le32_to_cpu(ucode->u.v2.init_size)); - set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA, - le32_to_cpu(ucode->u.v2.init_data_size)); - src = ucode->u.v2.data; - break; - case 0: - case 1: - case 2: - hdr_size = 24; - if (ucode_raw->size < hdr_size) { - IWL_ERR(drv, "File size too small!\n"); - return -EINVAL; - } - build = 0; - set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST, - le32_to_cpu(ucode->u.v1.inst_size)); - set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA, - le32_to_cpu(ucode->u.v1.data_size)); - set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST, - le32_to_cpu(ucode->u.v1.init_size)); - set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA, - le32_to_cpu(ucode->u.v1.init_data_size)); - src = ucode->u.v1.data; - break; - } - - if (build) - sprintf(buildstr, " build %u%s", build, - (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) - ? " (EXP)" : ""); - else - buildstr[0] = '\0'; - - snprintf(drv->fw.fw_version, - sizeof(drv->fw.fw_version), - "%u.%u.%u.%u%s", - IWL_UCODE_MAJOR(drv->fw.ucode_ver), - IWL_UCODE_MINOR(drv->fw.ucode_ver), - IWL_UCODE_API(drv->fw.ucode_ver), - IWL_UCODE_SERIAL(drv->fw.ucode_ver), - buildstr); - - /* Verify size of file vs. image size info in file's header */ - - if (ucode_raw->size != hdr_size + - get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST) + - get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA) + - get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST) + - get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA)) { - - IWL_ERR(drv, - "uCode file size %d does not match expected size\n", - (int)ucode_raw->size); - return -EINVAL; - } - - - set_sec_data(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST, src); - src += get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST); - set_sec_offset(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST, - IWLAGN_RTC_INST_LOWER_BOUND); - set_sec_data(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA, src); - src += get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA); - set_sec_offset(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA, - IWLAGN_RTC_DATA_LOWER_BOUND); - set_sec_data(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST, src); - src += get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST); - set_sec_offset(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST, - IWLAGN_RTC_INST_LOWER_BOUND); - set_sec_data(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA, src); - src += get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA); - set_sec_offset(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA, - IWLAGN_RTC_DATA_LOWER_BOUND); - return 0; -} - -static int iwl_parse_tlv_firmware(struct iwl_drv *drv, - const struct firmware *ucode_raw, - struct iwl_firmware_pieces *pieces, - struct iwl_ucode_capabilities *capa) -{ - struct iwl_tlv_ucode_header *ucode = (void *)ucode_raw->data; - struct iwl_ucode_tlv *tlv; - size_t len = ucode_raw->size; - const u8 *data; - u32 tlv_len; - enum iwl_ucode_tlv_type tlv_type; - const u8 *tlv_data; - char buildstr[25]; - u32 build; - - if (len < sizeof(*ucode)) { - IWL_ERR(drv, "uCode has invalid length: %zd\n", len); - return -EINVAL; - } - - if (ucode->magic != cpu_to_le32(IWL_TLV_UCODE_MAGIC)) { - IWL_ERR(drv, "invalid uCode magic: 0X%x\n", - le32_to_cpu(ucode->magic)); - return -EINVAL; - } - - drv->fw.ucode_ver = le32_to_cpu(ucode->ver); - build = le32_to_cpu(ucode->build); - - if (build) - sprintf(buildstr, " build %u%s", build, - (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) - ? " (EXP)" : ""); - else - buildstr[0] = '\0'; - - snprintf(drv->fw.fw_version, - sizeof(drv->fw.fw_version), - "%u.%u.%u.%u%s", - IWL_UCODE_MAJOR(drv->fw.ucode_ver), - IWL_UCODE_MINOR(drv->fw.ucode_ver), - IWL_UCODE_API(drv->fw.ucode_ver), - IWL_UCODE_SERIAL(drv->fw.ucode_ver), - buildstr); - - data = ucode->data; - - len -= sizeof(*ucode); - - while (len >= sizeof(*tlv)) { - len -= sizeof(*tlv); - tlv = (void *)data; - - tlv_len = le32_to_cpu(tlv->length); - tlv_type = le32_to_cpu(tlv->type); - tlv_data = tlv->data; - - if (len < tlv_len) { - IWL_ERR(drv, "invalid TLV len: %zd/%u\n", - len, tlv_len); - return -EINVAL; - } - len -= ALIGN(tlv_len, 4); - data += sizeof(*tlv) + ALIGN(tlv_len, 4); - - switch (tlv_type) { - case IWL_UCODE_TLV_INST: - set_sec_data(pieces, IWL_UCODE_REGULAR, - IWL_UCODE_SECTION_INST, tlv_data); - set_sec_size(pieces, IWL_UCODE_REGULAR, - IWL_UCODE_SECTION_INST, tlv_len); - set_sec_offset(pieces, IWL_UCODE_REGULAR, - IWL_UCODE_SECTION_INST, - IWLAGN_RTC_INST_LOWER_BOUND); - break; - case IWL_UCODE_TLV_DATA: - set_sec_data(pieces, IWL_UCODE_REGULAR, - IWL_UCODE_SECTION_DATA, tlv_data); - set_sec_size(pieces, IWL_UCODE_REGULAR, - IWL_UCODE_SECTION_DATA, tlv_len); - set_sec_offset(pieces, IWL_UCODE_REGULAR, - IWL_UCODE_SECTION_DATA, - IWLAGN_RTC_DATA_LOWER_BOUND); - break; - case IWL_UCODE_TLV_INIT: - set_sec_data(pieces, IWL_UCODE_INIT, - IWL_UCODE_SECTION_INST, tlv_data); - set_sec_size(pieces, IWL_UCODE_INIT, - IWL_UCODE_SECTION_INST, tlv_len); - set_sec_offset(pieces, IWL_UCODE_INIT, - IWL_UCODE_SECTION_INST, - IWLAGN_RTC_INST_LOWER_BOUND); - break; - case IWL_UCODE_TLV_INIT_DATA: - set_sec_data(pieces, IWL_UCODE_INIT, - IWL_UCODE_SECTION_DATA, tlv_data); - set_sec_size(pieces, IWL_UCODE_INIT, - IWL_UCODE_SECTION_DATA, tlv_len); - set_sec_offset(pieces, IWL_UCODE_INIT, - IWL_UCODE_SECTION_DATA, - IWLAGN_RTC_DATA_LOWER_BOUND); - break; - case IWL_UCODE_TLV_BOOT: - IWL_ERR(drv, "Found unexpected BOOT ucode\n"); - break; - case IWL_UCODE_TLV_PROBE_MAX_LEN: - if (tlv_len != sizeof(u32)) - goto invalid_tlv_len; - capa->max_probe_length = - le32_to_cpup((__le32 *)tlv_data); - break; - case IWL_UCODE_TLV_PAN: - if (tlv_len) - goto invalid_tlv_len; - capa->flags |= IWL_UCODE_TLV_FLAGS_PAN; - break; - case IWL_UCODE_TLV_FLAGS: - /* must be at least one u32 */ - if (tlv_len < sizeof(u32)) - goto invalid_tlv_len; - /* and a proper number of u32s */ - if (tlv_len % sizeof(u32)) - goto invalid_tlv_len; - /* - * This driver only reads the first u32 as - * right now no more features are defined, - * if that changes then either the driver - * will not work with the new firmware, or - * it'll not take advantage of new features. - */ - capa->flags = le32_to_cpup((__le32 *)tlv_data); - break; - case IWL_UCODE_TLV_INIT_EVTLOG_PTR: - if (tlv_len != sizeof(u32)) - goto invalid_tlv_len; - pieces->init_evtlog_ptr = - le32_to_cpup((__le32 *)tlv_data); - break; - case IWL_UCODE_TLV_INIT_EVTLOG_SIZE: - if (tlv_len != sizeof(u32)) - goto invalid_tlv_len; - pieces->init_evtlog_size = - le32_to_cpup((__le32 *)tlv_data); - break; - case IWL_UCODE_TLV_INIT_ERRLOG_PTR: - if (tlv_len != sizeof(u32)) - goto invalid_tlv_len; - pieces->init_errlog_ptr = - le32_to_cpup((__le32 *)tlv_data); - break; - case IWL_UCODE_TLV_RUNT_EVTLOG_PTR: - if (tlv_len != sizeof(u32)) - goto invalid_tlv_len; - pieces->inst_evtlog_ptr = - le32_to_cpup((__le32 *)tlv_data); - break; - case IWL_UCODE_TLV_RUNT_EVTLOG_SIZE: - if (tlv_len != sizeof(u32)) - goto invalid_tlv_len; - pieces->inst_evtlog_size = - le32_to_cpup((__le32 *)tlv_data); - break; - case IWL_UCODE_TLV_RUNT_ERRLOG_PTR: - if (tlv_len != sizeof(u32)) - goto invalid_tlv_len; - pieces->inst_errlog_ptr = - le32_to_cpup((__le32 *)tlv_data); - break; - case IWL_UCODE_TLV_ENHANCE_SENS_TBL: - if (tlv_len) - goto invalid_tlv_len; - drv->fw.enhance_sensitivity_table = true; - break; - case IWL_UCODE_TLV_WOWLAN_INST: - set_sec_data(pieces, IWL_UCODE_WOWLAN, - IWL_UCODE_SECTION_INST, tlv_data); - set_sec_size(pieces, IWL_UCODE_WOWLAN, - IWL_UCODE_SECTION_INST, tlv_len); - set_sec_offset(pieces, IWL_UCODE_WOWLAN, - IWL_UCODE_SECTION_INST, - IWLAGN_RTC_INST_LOWER_BOUND); - break; - case IWL_UCODE_TLV_WOWLAN_DATA: - set_sec_data(pieces, IWL_UCODE_WOWLAN, - IWL_UCODE_SECTION_DATA, tlv_data); - set_sec_size(pieces, IWL_UCODE_WOWLAN, - IWL_UCODE_SECTION_DATA, tlv_len); - set_sec_offset(pieces, IWL_UCODE_WOWLAN, - IWL_UCODE_SECTION_DATA, - IWLAGN_RTC_DATA_LOWER_BOUND); - break; - case IWL_UCODE_TLV_PHY_CALIBRATION_SIZE: - if (tlv_len != sizeof(u32)) - goto invalid_tlv_len; - capa->standard_phy_calibration_size = - le32_to_cpup((__le32 *)tlv_data); - break; - case IWL_UCODE_TLV_SEC_RT: - iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR, - tlv_len); - drv->fw.mvm_fw = true; - break; - case IWL_UCODE_TLV_SEC_INIT: - iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT, - tlv_len); - drv->fw.mvm_fw = true; - break; - case IWL_UCODE_TLV_SEC_WOWLAN: - iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN, - tlv_len); - drv->fw.mvm_fw = true; - break; - case IWL_UCODE_TLV_DEF_CALIB: - if (tlv_len != sizeof(struct iwl_tlv_calib_data)) - goto invalid_tlv_len; - if (iwl_set_default_calib(drv, tlv_data)) - goto tlv_error; - break; - case IWL_UCODE_TLV_PHY_SKU: - if (tlv_len != sizeof(u32)) - goto invalid_tlv_len; - drv->fw.phy_config = le32_to_cpup((__le32 *)tlv_data); - break; - default: - IWL_DEBUG_INFO(drv, "unknown TLV: %d\n", tlv_type); - break; - } - } - - if (len) { - IWL_ERR(drv, "invalid TLV after parsing: %zd\n", len); - iwl_print_hex_dump(drv, IWL_DL_FW, (u8 *)data, len); - return -EINVAL; - } - - return 0; - - invalid_tlv_len: - IWL_ERR(drv, "TLV %d has invalid size: %u\n", tlv_type, tlv_len); - tlv_error: - iwl_print_hex_dump(drv, IWL_DL_FW, tlv_data, tlv_len); - - return -EINVAL; -} - -static int iwl_alloc_ucode(struct iwl_drv *drv, - struct iwl_firmware_pieces *pieces, - enum iwl_ucode_type type) -{ - int i; - for (i = 0; - i < IWL_UCODE_SECTION_MAX && get_sec_size(pieces, type, i); - i++) - if (iwl_alloc_fw_desc(drv, &(drv->fw.img[type].sec[i]), - get_sec(pieces, type, i))) - return -ENOMEM; - return 0; -} - -static int validate_sec_sizes(struct iwl_drv *drv, - struct iwl_firmware_pieces *pieces, - const struct iwl_cfg *cfg) -{ - IWL_DEBUG_INFO(drv, "f/w package hdr runtime inst size = %Zd\n", - get_sec_size(pieces, IWL_UCODE_REGULAR, - IWL_UCODE_SECTION_INST)); - IWL_DEBUG_INFO(drv, "f/w package hdr runtime data size = %Zd\n", - get_sec_size(pieces, IWL_UCODE_REGULAR, - IWL_UCODE_SECTION_DATA)); - IWL_DEBUG_INFO(drv, "f/w package hdr init inst size = %Zd\n", - get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST)); - IWL_DEBUG_INFO(drv, "f/w package hdr init data size = %Zd\n", - get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA)); - - /* Verify that uCode images will fit in card's SRAM. */ - if (get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST) > - cfg->max_inst_size) { - IWL_ERR(drv, "uCode instr len %Zd too large to fit in\n", - get_sec_size(pieces, IWL_UCODE_REGULAR, - IWL_UCODE_SECTION_INST)); - return -1; - } - - if (get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA) > - cfg->max_data_size) { - IWL_ERR(drv, "uCode data len %Zd too large to fit in\n", - get_sec_size(pieces, IWL_UCODE_REGULAR, - IWL_UCODE_SECTION_DATA)); - return -1; - } - - if (get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST) > - cfg->max_inst_size) { - IWL_ERR(drv, "uCode init instr len %Zd too large to fit in\n", - get_sec_size(pieces, IWL_UCODE_INIT, - IWL_UCODE_SECTION_INST)); - return -1; - } - - if (get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA) > - cfg->max_data_size) { - IWL_ERR(drv, "uCode init data len %Zd too large to fit in\n", - get_sec_size(pieces, IWL_UCODE_REGULAR, - IWL_UCODE_SECTION_DATA)); - return -1; - } - return 0; -} - -static struct iwl_op_mode * -_iwl_op_mode_start(struct iwl_drv *drv, struct iwlwifi_opmode_table *op) -{ - const struct iwl_op_mode_ops *ops = op->ops; - struct dentry *dbgfs_dir = NULL; - struct iwl_op_mode *op_mode = NULL; - -#ifdef CONFIG_IWLWIFI_DEBUGFS - drv->dbgfs_op_mode = debugfs_create_dir(op->name, - drv->dbgfs_drv); - if (!drv->dbgfs_op_mode) { - IWL_ERR(drv, - "failed to create opmode debugfs directory\n"); - return op_mode; - } - dbgfs_dir = drv->dbgfs_op_mode; -#endif - - op_mode = ops->start(drv->trans, drv->cfg, &drv->fw, dbgfs_dir); - -#ifdef CONFIG_IWLWIFI_DEBUGFS - if (!op_mode) { - debugfs_remove_recursive(drv->dbgfs_op_mode); - drv->dbgfs_op_mode = NULL; - } -#endif - - return op_mode; -} - -static void _iwl_op_mode_stop(struct iwl_drv *drv) -{ - /* op_mode can be NULL if its start failed */ - if (drv->op_mode) { - iwl_op_mode_stop(drv->op_mode); - drv->op_mode = NULL; - -#ifdef CONFIG_IWLWIFI_DEBUGFS - debugfs_remove_recursive(drv->dbgfs_op_mode); - drv->dbgfs_op_mode = NULL; -#endif - } -} - -/** - * iwl_req_fw_callback - callback when firmware was loaded - * - * If loaded successfully, copies the firmware into buffers - * for the card to fetch (via DMA). - */ -static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) -{ - struct iwl_drv *drv = context; - struct iwl_fw *fw = &drv->fw; - struct iwl_ucode_header *ucode; - struct iwlwifi_opmode_table *op; - int err; - struct iwl_firmware_pieces pieces; - const unsigned int api_max = drv->cfg->ucode_api_max; - unsigned int api_ok = drv->cfg->ucode_api_ok; - const unsigned int api_min = drv->cfg->ucode_api_min; - u32 api_ver; - int i; - bool load_module = false; - - fw->ucode_capa.max_probe_length = 200; - fw->ucode_capa.standard_phy_calibration_size = - IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE; - - if (!api_ok) - api_ok = api_max; - - memset(&pieces, 0, sizeof(pieces)); - - if (!ucode_raw) { - if (drv->fw_index <= api_ok) - IWL_ERR(drv, - "request for firmware file '%s' failed.\n", - drv->firmware_name); - goto try_again; - } - - IWL_DEBUG_INFO(drv, "Loaded firmware file '%s' (%zd bytes).\n", - drv->firmware_name, ucode_raw->size); - - /* Make sure that we got at least the API version number */ - if (ucode_raw->size < 4) { - IWL_ERR(drv, "File size way too small!\n"); - goto try_again; - } - - /* Data from ucode file: header followed by uCode images */ - ucode = (struct iwl_ucode_header *)ucode_raw->data; - - if (ucode->ver) - err = iwl_parse_v1_v2_firmware(drv, ucode_raw, &pieces); - else - err = iwl_parse_tlv_firmware(drv, ucode_raw, &pieces, - &fw->ucode_capa); - - if (err) - goto try_again; - - api_ver = IWL_UCODE_API(drv->fw.ucode_ver); - - /* - * api_ver should match the api version forming part of the - * firmware filename ... but we don't check for that and only rely - * on the API version read from firmware header from here on forward - */ - /* no api version check required for experimental uCode */ - if (drv->fw_index != UCODE_EXPERIMENTAL_INDEX) { - if (api_ver < api_min || api_ver > api_max) { - IWL_ERR(drv, - "Driver unable to support your firmware API. " - "Driver supports v%u, firmware is v%u.\n", - api_max, api_ver); - goto try_again; - } - - if (api_ver < api_ok) { - if (api_ok != api_max) - IWL_ERR(drv, "Firmware has old API version, " - "expected v%u through v%u, got v%u.\n", - api_ok, api_max, api_ver); - else - IWL_ERR(drv, "Firmware has old API version, " - "expected v%u, got v%u.\n", - api_max, api_ver); - IWL_ERR(drv, "New firmware can be obtained from " - "http://www.intellinuxwireless.org/.\n"); - } - } - - /* - * In mvm uCode there is no difference between data and instructions - * sections. - */ - if (!fw->mvm_fw && validate_sec_sizes(drv, &pieces, drv->cfg)) - goto try_again; - - /* Allocate ucode buffers for card's bus-master loading ... */ - - /* Runtime instructions and 2 copies of data: - * 1) unmodified from disk - * 2) backup cache for save/restore during power-downs */ - for (i = 0; i < IWL_UCODE_TYPE_MAX; i++) - if (iwl_alloc_ucode(drv, &pieces, i)) - goto out_free_fw; - - /* Now that we can no longer fail, copy information */ - - /* - * The (size - 16) / 12 formula is based on the information recorded - * for each event, which is of mode 1 (including timestamp) for all - * new microcodes that include this information. - */ - fw->init_evtlog_ptr = pieces.init_evtlog_ptr; - if (pieces.init_evtlog_size) - fw->init_evtlog_size = (pieces.init_evtlog_size - 16)/12; - else - fw->init_evtlog_size = - drv->cfg->base_params->max_event_log_size; - fw->init_errlog_ptr = pieces.init_errlog_ptr; - fw->inst_evtlog_ptr = pieces.inst_evtlog_ptr; - if (pieces.inst_evtlog_size) - fw->inst_evtlog_size = (pieces.inst_evtlog_size - 16)/12; - else - fw->inst_evtlog_size = - drv->cfg->base_params->max_event_log_size; - fw->inst_errlog_ptr = pieces.inst_errlog_ptr; - - /* - * figure out the offset of chain noise reset and gain commands - * base on the size of standard phy calibration commands table size - */ - if (fw->ucode_capa.standard_phy_calibration_size > - IWL_MAX_PHY_CALIBRATE_TBL_SIZE) - fw->ucode_capa.standard_phy_calibration_size = - IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE; - - /* We have our copies now, allow OS release its copies */ - release_firmware(ucode_raw); - - mutex_lock(&iwlwifi_opmode_table_mtx); - if (fw->mvm_fw) - op = &iwlwifi_opmode_table[MVM_OP_MODE]; - else - op = &iwlwifi_opmode_table[DVM_OP_MODE]; - - IWL_INFO(drv, "loaded firmware version %s op_mode %s\n", - drv->fw.fw_version, op->name); - - /* add this device to the list of devices using this op_mode */ - list_add_tail(&drv->list, &op->drv); - - if (op->ops) { - drv->op_mode = _iwl_op_mode_start(drv, op); - - if (!drv->op_mode) { - mutex_unlock(&iwlwifi_opmode_table_mtx); - goto out_unbind; - } - } else { - load_module = true; - } - mutex_unlock(&iwlwifi_opmode_table_mtx); - - /* - * Complete the firmware request last so that - * a driver unbind (stop) doesn't run while we - * are doing the start() above. - */ - complete(&drv->request_firmware_complete); - - /* - * Load the module last so we don't block anything - * else from proceeding if the module fails to load - * or hangs loading. - */ - if (load_module) { - err = request_module("%s", op->name); -#ifdef CONFIG_IWLWIFI_OPMODE_MODULAR - if (err) - IWL_ERR(drv, - "failed to load module %s (error %d), is dynamic loading enabled?\n", - op->name, err); -#endif - } - return; - - try_again: - /* try next, if any */ - release_firmware(ucode_raw); - if (iwl_request_firmware(drv, false)) - goto out_unbind; - return; - - out_free_fw: - IWL_ERR(drv, "failed to allocate pci memory\n"); - iwl_dealloc_ucode(drv); - release_firmware(ucode_raw); - out_unbind: - complete(&drv->request_firmware_complete); - device_release_driver(drv->trans->dev); -} - -struct iwl_drv *iwl_drv_start(struct iwl_trans *trans, - const struct iwl_cfg *cfg) -{ - struct iwl_drv *drv; - int ret; - - drv = kzalloc(sizeof(*drv), GFP_KERNEL); - if (!drv) - return NULL; - - drv->trans = trans; - drv->dev = trans->dev; - drv->cfg = cfg; - - init_completion(&drv->request_firmware_complete); - INIT_LIST_HEAD(&drv->list); - -#ifdef CONFIG_IWLWIFI_DEBUGFS - /* Create the device debugfs entries. */ - drv->dbgfs_drv = debugfs_create_dir(dev_name(trans->dev), - iwl_dbgfs_root); - - if (!drv->dbgfs_drv) { - IWL_ERR(drv, "failed to create debugfs directory\n"); - ret = -ENOMEM; - goto err_free_drv; - } - - /* Create transport layer debugfs dir */ - drv->trans->dbgfs_dir = debugfs_create_dir("trans", drv->dbgfs_drv); - - if (!drv->trans->dbgfs_dir) { - IWL_ERR(drv, "failed to create transport debugfs directory\n"); - ret = -ENOMEM; - goto err_free_dbgfs; - } -#endif - - ret = iwl_request_firmware(drv, true); - if (ret) { - IWL_ERR(trans, "Couldn't request the fw\n"); - goto err_fw; - } - - return drv; - -err_fw: -#ifdef CONFIG_IWLWIFI_DEBUGFS -err_free_dbgfs: - debugfs_remove_recursive(drv->dbgfs_drv); -err_free_drv: -#endif - kfree(drv); - - return ERR_PTR(ret); -} - -void iwl_drv_stop(struct iwl_drv *drv) -{ - wait_for_completion(&drv->request_firmware_complete); - - _iwl_op_mode_stop(drv); - - iwl_dealloc_ucode(drv); - - mutex_lock(&iwlwifi_opmode_table_mtx); - /* - * List is empty (this item wasn't added) - * when firmware loading failed -- in that - * case we can't remove it from any list. - */ - if (!list_empty(&drv->list)) - list_del(&drv->list); - mutex_unlock(&iwlwifi_opmode_table_mtx); - -#ifdef CONFIG_IWLWIFI_DEBUGFS - debugfs_remove_recursive(drv->dbgfs_drv); -#endif - - kfree(drv); -} - - -/* shared module parameters */ -struct iwl_mod_params iwlwifi_mod_params = { - .restart_fw = true, - .plcp_check = true, - .bt_coex_active = true, - .power_level = IWL_POWER_INDEX_1, - .bt_ch_announce = true, - .auto_agg = true, - .wd_disable = true, - /* the rest are 0 by default */ -}; -IWL_EXPORT_SYMBOL(iwlwifi_mod_params); - -int iwl_opmode_register(const char *name, const struct iwl_op_mode_ops *ops) -{ - int i; - struct iwl_drv *drv; - struct iwlwifi_opmode_table *op; - - mutex_lock(&iwlwifi_opmode_table_mtx); - for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++) { - op = &iwlwifi_opmode_table[i]; - if (strcmp(op->name, name)) - continue; - op->ops = ops; - /* TODO: need to handle exceptional case */ - list_for_each_entry(drv, &op->drv, list) - drv->op_mode = _iwl_op_mode_start(drv, op); - - mutex_unlock(&iwlwifi_opmode_table_mtx); - return 0; - } - mutex_unlock(&iwlwifi_opmode_table_mtx); - return -EIO; -} -IWL_EXPORT_SYMBOL(iwl_opmode_register); - -void iwl_opmode_deregister(const char *name) -{ - int i; - struct iwl_drv *drv; - - mutex_lock(&iwlwifi_opmode_table_mtx); - for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++) { - if (strcmp(iwlwifi_opmode_table[i].name, name)) - continue; - iwlwifi_opmode_table[i].ops = NULL; - - /* call the stop routine for all devices */ - list_for_each_entry(drv, &iwlwifi_opmode_table[i].drv, list) - _iwl_op_mode_stop(drv); - - mutex_unlock(&iwlwifi_opmode_table_mtx); - return; - } - mutex_unlock(&iwlwifi_opmode_table_mtx); -} -IWL_EXPORT_SYMBOL(iwl_opmode_deregister); - -static int __init iwl_drv_init(void) -{ - int i; - - mutex_init(&iwlwifi_opmode_table_mtx); - - for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++) - INIT_LIST_HEAD(&iwlwifi_opmode_table[i].drv); - - pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n"); - pr_info(DRV_COPYRIGHT "\n"); - -#ifdef CONFIG_IWLWIFI_DEBUGFS - /* Create the root of iwlwifi debugfs subsystem. */ - iwl_dbgfs_root = debugfs_create_dir(DRV_NAME, NULL); - - if (!iwl_dbgfs_root) - return -EFAULT; -#endif - - return iwl_pci_register_driver(); -} -module_init(iwl_drv_init); - -static void __exit iwl_drv_exit(void) -{ - iwl_pci_unregister_driver(); - -#ifdef CONFIG_IWLWIFI_DEBUGFS - debugfs_remove_recursive(iwl_dbgfs_root); -#endif -} -module_exit(iwl_drv_exit); - -#ifdef CONFIG_IWLWIFI_DEBUG -module_param_named(debug, iwlwifi_mod_params.debug_level, uint, - S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(debug, "debug output mask"); -#endif - -module_param_named(swcrypto, iwlwifi_mod_params.sw_crypto, int, S_IRUGO); -MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])"); -module_param_named(11n_disable, iwlwifi_mod_params.disable_11n, uint, S_IRUGO); -MODULE_PARM_DESC(11n_disable, - "disable 11n functionality, bitmap: 1: full, 2: agg TX, 4: agg RX"); -module_param_named(amsdu_size_8K, iwlwifi_mod_params.amsdu_size_8K, - int, S_IRUGO); -MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size (default 0)"); -module_param_named(fw_restart, iwlwifi_mod_params.restart_fw, bool, S_IRUGO); -MODULE_PARM_DESC(fw_restart, "restart firmware in case of error (default true)"); - -module_param_named(antenna_coupling, iwlwifi_mod_params.ant_coupling, - int, S_IRUGO); -MODULE_PARM_DESC(antenna_coupling, - "specify antenna coupling in dB (defualt: 0 dB)"); - -module_param_named(bt_ch_inhibition, iwlwifi_mod_params.bt_ch_announce, - bool, S_IRUGO); -MODULE_PARM_DESC(bt_ch_inhibition, - "Enable BT channel inhibition (default: enable)"); - -module_param_named(plcp_check, iwlwifi_mod_params.plcp_check, bool, S_IRUGO); -MODULE_PARM_DESC(plcp_check, "Check plcp health (default: 1 [enabled])"); - -module_param_named(wd_disable, iwlwifi_mod_params.wd_disable, int, S_IRUGO); -MODULE_PARM_DESC(wd_disable, - "Disable stuck queue watchdog timer 0=system default, " - "1=disable, 2=enable (default: 0)"); - -/* - * set bt_coex_active to true, uCode will do kill/defer - * every time the priority line is asserted (BT is sending signals on the - * priority line in the PCIx). - * set bt_coex_active to false, uCode will ignore the BT activity and - * perform the normal operation - * - * User might experience transmit issue on some platform due to WiFi/BT - * co-exist problem. The possible behaviors are: - * Able to scan and finding all the available AP - * Not able to associate with any AP - * On those platforms, WiFi communication can be restored by set - * "bt_coex_active" module parameter to "false" - * - * default: bt_coex_active = true (BT_COEX_ENABLE) - */ -module_param_named(bt_coex_active, iwlwifi_mod_params.bt_coex_active, - bool, S_IRUGO); -MODULE_PARM_DESC(bt_coex_active, "enable wifi/bt co-exist (default: enable)"); - -module_param_named(led_mode, iwlwifi_mod_params.led_mode, int, S_IRUGO); -MODULE_PARM_DESC(led_mode, "0=system default, " - "1=On(RF On)/Off(RF Off), 2=blinking, 3=Off (default: 0)"); - -module_param_named(power_save, iwlwifi_mod_params.power_save, - bool, S_IRUGO); -MODULE_PARM_DESC(power_save, - "enable WiFi power management (default: disable)"); - -module_param_named(power_level, iwlwifi_mod_params.power_level, - int, S_IRUGO); -MODULE_PARM_DESC(power_level, - "default power save level (range from 1 - 5, default: 1)"); - -module_param_named(auto_agg, iwlwifi_mod_params.auto_agg, - bool, S_IRUGO); -MODULE_PARM_DESC(auto_agg, - "enable agg w/o check traffic load (default: enable)"); diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.h b/drivers/net/wireless/iwlwifi/iwl-drv.h deleted file mode 100644 index 7d1450916308..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-drv.h +++ /dev/null @@ -1,141 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef __iwl_drv_h__ -#define __iwl_drv_h__ - -#include - -/* for all modules */ -#define DRV_NAME "iwlwifi" -#define IWLWIFI_VERSION "in-tree:" -#define DRV_COPYRIGHT "Copyright(c) 2003-2013 Intel Corporation" -#define DRV_AUTHOR "" - - -/** - * DOC: Driver system flows - drv component - * - * This component implements the system flows such as bus enumeration, bus - * removal. Bus dependent parts of system flows (such as iwl_pci_probe) are in - * bus specific files (transport files). This is the code that is common among - * different buses. - * - * This component is also in charge of managing the several implementations of - * the wifi flows: it will allow to have several fw API implementation. These - * different implementations will differ in the way they implement mac80211's - * handlers too. - - * The init flow wrt to the drv component looks like this: - * 1) The bus specific component is called from module_init - * 2) The bus specific component registers the bus driver - * 3) The bus driver calls the probe function - * 4) The bus specific component configures the bus - * 5) The bus specific component calls to the drv bus agnostic part - * (iwl_drv_start) - * 6) iwl_drv_start fetches the fw ASYNC, iwl_req_fw_callback - * 7) iwl_req_fw_callback parses the fw file - * 8) iwl_req_fw_callback starts the wifi implementation to matches the fw - */ - -struct iwl_drv; -struct iwl_trans; -struct iwl_cfg; -/** - * iwl_drv_start - start the drv - * - * @trans_ops: the ops of the transport - * @cfg: device specific constants / virtual functions - * - * starts the driver: fetches the firmware. This should be called by bus - * specific system flows implementations. For example, the bus specific probe - * function should do bus related operations only, and then call to this - * function. It returns the driver object or %NULL if an error occured. - */ -struct iwl_drv *iwl_drv_start(struct iwl_trans *trans, - const struct iwl_cfg *cfg); - -/** - * iwl_drv_stop - stop the drv - * - * @drv: - * - * Stop the driver. This should be called by bus specific system flows - * implementations. For example, the bus specific remove function should first - * call this function and then do the bus related operations only. - */ -void iwl_drv_stop(struct iwl_drv *drv); - -/* - * exported symbol management - * - * The driver can be split into multiple modules, in which case some symbols - * must be exported for the sub-modules. However, if it's not split and - * everything is built-in, then we can avoid that. - */ -#ifdef CONFIG_IWLWIFI_OPMODE_MODULAR -#define IWL_EXPORT_SYMBOL(sym) EXPORT_SYMBOL_GPL(sym) -#else -#define IWL_EXPORT_SYMBOL(sym) -#endif - -#endif /* __iwl_drv_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c deleted file mode 100644 index 600c9fdd7f71..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c +++ /dev/null @@ -1,932 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ -#include -#include -#include -#include "iwl-drv.h" -#include "iwl-modparams.h" -#include "iwl-eeprom-parse.h" - -/* EEPROM offset definitions */ - -/* indirect access definitions */ -#define ADDRESS_MSK 0x0000FFFF -#define INDIRECT_TYPE_MSK 0x000F0000 -#define INDIRECT_HOST 0x00010000 -#define INDIRECT_GENERAL 0x00020000 -#define INDIRECT_REGULATORY 0x00030000 -#define INDIRECT_CALIBRATION 0x00040000 -#define INDIRECT_PROCESS_ADJST 0x00050000 -#define INDIRECT_OTHERS 0x00060000 -#define INDIRECT_TXP_LIMIT 0x00070000 -#define INDIRECT_TXP_LIMIT_SIZE 0x00080000 -#define INDIRECT_ADDRESS 0x00100000 - -/* corresponding link offsets in EEPROM */ -#define EEPROM_LINK_HOST (2*0x64) -#define EEPROM_LINK_GENERAL (2*0x65) -#define EEPROM_LINK_REGULATORY (2*0x66) -#define EEPROM_LINK_CALIBRATION (2*0x67) -#define EEPROM_LINK_PROCESS_ADJST (2*0x68) -#define EEPROM_LINK_OTHERS (2*0x69) -#define EEPROM_LINK_TXP_LIMIT (2*0x6a) -#define EEPROM_LINK_TXP_LIMIT_SIZE (2*0x6b) - -/* General */ -#define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */ -#define EEPROM_SUBSYSTEM_ID (2*0x0A) /* 2 bytes */ -#define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */ -#define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */ -#define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */ -#define EEPROM_VERSION (2*0x44) /* 2 bytes */ -#define EEPROM_SKU_CAP (2*0x45) /* 2 bytes */ -#define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */ -#define EEPROM_RADIO_CONFIG (2*0x48) /* 2 bytes */ -#define EEPROM_NUM_MAC_ADDRESS (2*0x4C) /* 2 bytes */ - -/* calibration */ -struct iwl_eeprom_calib_hdr { - u8 version; - u8 pa_type; - __le16 voltage; -} __packed; - -#define EEPROM_CALIB_ALL (INDIRECT_ADDRESS | INDIRECT_CALIBRATION) -#define EEPROM_XTAL ((2*0x128) | EEPROM_CALIB_ALL) - -/* temperature */ -#define EEPROM_KELVIN_TEMPERATURE ((2*0x12A) | EEPROM_CALIB_ALL) -#define EEPROM_RAW_TEMPERATURE ((2*0x12B) | EEPROM_CALIB_ALL) - -/* SKU Capabilities (actual values from EEPROM definition) */ -enum eeprom_sku_bits { - EEPROM_SKU_CAP_BAND_24GHZ = BIT(4), - EEPROM_SKU_CAP_BAND_52GHZ = BIT(5), - EEPROM_SKU_CAP_11N_ENABLE = BIT(6), - EEPROM_SKU_CAP_AMT_ENABLE = BIT(7), - EEPROM_SKU_CAP_IPAN_ENABLE = BIT(8) -}; - -/* radio config bits (actual values from EEPROM definition) */ -#define EEPROM_RF_CFG_TYPE_MSK(x) (x & 0x3) /* bits 0-1 */ -#define EEPROM_RF_CFG_STEP_MSK(x) ((x >> 2) & 0x3) /* bits 2-3 */ -#define EEPROM_RF_CFG_DASH_MSK(x) ((x >> 4) & 0x3) /* bits 4-5 */ -#define EEPROM_RF_CFG_PNUM_MSK(x) ((x >> 6) & 0x3) /* bits 6-7 */ -#define EEPROM_RF_CFG_TX_ANT_MSK(x) ((x >> 8) & 0xF) /* bits 8-11 */ -#define EEPROM_RF_CFG_RX_ANT_MSK(x) ((x >> 12) & 0xF) /* bits 12-15 */ - - -/* - * EEPROM bands - * These are the channel numbers from each band in the order - * that they are stored in the EEPROM band information. Note - * that EEPROM bands aren't the same as mac80211 bands, and - * there are even special "ht40 bands" in the EEPROM. - */ -static const u8 iwl_eeprom_band_1[14] = { /* 2.4 GHz */ - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 -}; - -static const u8 iwl_eeprom_band_2[] = { /* 4915-5080MHz */ - 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16 -}; - -static const u8 iwl_eeprom_band_3[] = { /* 5170-5320MHz */ - 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 -}; - -static const u8 iwl_eeprom_band_4[] = { /* 5500-5700MHz */ - 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140 -}; - -static const u8 iwl_eeprom_band_5[] = { /* 5725-5825MHz */ - 145, 149, 153, 157, 161, 165 -}; - -static const u8 iwl_eeprom_band_6[] = { /* 2.4 ht40 channel */ - 1, 2, 3, 4, 5, 6, 7 -}; - -static const u8 iwl_eeprom_band_7[] = { /* 5.2 ht40 channel */ - 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157 -}; - -#define IWL_NUM_CHANNELS (ARRAY_SIZE(iwl_eeprom_band_1) + \ - ARRAY_SIZE(iwl_eeprom_band_2) + \ - ARRAY_SIZE(iwl_eeprom_band_3) + \ - ARRAY_SIZE(iwl_eeprom_band_4) + \ - ARRAY_SIZE(iwl_eeprom_band_5)) - -/* rate data (static) */ -static struct ieee80211_rate iwl_cfg80211_rates[] = { - { .bitrate = 1 * 10, .hw_value = 0, .hw_value_short = 0, }, - { .bitrate = 2 * 10, .hw_value = 1, .hw_value_short = 1, - .flags = IEEE80211_RATE_SHORT_PREAMBLE, }, - { .bitrate = 5.5 * 10, .hw_value = 2, .hw_value_short = 2, - .flags = IEEE80211_RATE_SHORT_PREAMBLE, }, - { .bitrate = 11 * 10, .hw_value = 3, .hw_value_short = 3, - .flags = IEEE80211_RATE_SHORT_PREAMBLE, }, - { .bitrate = 6 * 10, .hw_value = 4, .hw_value_short = 4, }, - { .bitrate = 9 * 10, .hw_value = 5, .hw_value_short = 5, }, - { .bitrate = 12 * 10, .hw_value = 6, .hw_value_short = 6, }, - { .bitrate = 18 * 10, .hw_value = 7, .hw_value_short = 7, }, - { .bitrate = 24 * 10, .hw_value = 8, .hw_value_short = 8, }, - { .bitrate = 36 * 10, .hw_value = 9, .hw_value_short = 9, }, - { .bitrate = 48 * 10, .hw_value = 10, .hw_value_short = 10, }, - { .bitrate = 54 * 10, .hw_value = 11, .hw_value_short = 11, }, -}; -#define RATES_24_OFFS 0 -#define N_RATES_24 ARRAY_SIZE(iwl_cfg80211_rates) -#define RATES_52_OFFS 4 -#define N_RATES_52 (N_RATES_24 - RATES_52_OFFS) - -/* EEPROM reading functions */ - -static u16 iwl_eeprom_query16(const u8 *eeprom, size_t eeprom_size, int offset) -{ - if (WARN_ON(offset + sizeof(u16) > eeprom_size)) - return 0; - return le16_to_cpup((__le16 *)(eeprom + offset)); -} - -static u32 eeprom_indirect_address(const u8 *eeprom, size_t eeprom_size, - u32 address) -{ - u16 offset = 0; - - if ((address & INDIRECT_ADDRESS) == 0) - return address; - - switch (address & INDIRECT_TYPE_MSK) { - case INDIRECT_HOST: - offset = iwl_eeprom_query16(eeprom, eeprom_size, - EEPROM_LINK_HOST); - break; - case INDIRECT_GENERAL: - offset = iwl_eeprom_query16(eeprom, eeprom_size, - EEPROM_LINK_GENERAL); - break; - case INDIRECT_REGULATORY: - offset = iwl_eeprom_query16(eeprom, eeprom_size, - EEPROM_LINK_REGULATORY); - break; - case INDIRECT_TXP_LIMIT: - offset = iwl_eeprom_query16(eeprom, eeprom_size, - EEPROM_LINK_TXP_LIMIT); - break; - case INDIRECT_TXP_LIMIT_SIZE: - offset = iwl_eeprom_query16(eeprom, eeprom_size, - EEPROM_LINK_TXP_LIMIT_SIZE); - break; - case INDIRECT_CALIBRATION: - offset = iwl_eeprom_query16(eeprom, eeprom_size, - EEPROM_LINK_CALIBRATION); - break; - case INDIRECT_PROCESS_ADJST: - offset = iwl_eeprom_query16(eeprom, eeprom_size, - EEPROM_LINK_PROCESS_ADJST); - break; - case INDIRECT_OTHERS: - offset = iwl_eeprom_query16(eeprom, eeprom_size, - EEPROM_LINK_OTHERS); - break; - default: - WARN_ON(1); - break; - } - - /* translate the offset from words to byte */ - return (address & ADDRESS_MSK) + (offset << 1); -} - -static const u8 *iwl_eeprom_query_addr(const u8 *eeprom, size_t eeprom_size, - u32 offset) -{ - u32 address = eeprom_indirect_address(eeprom, eeprom_size, offset); - - if (WARN_ON(address >= eeprom_size)) - return NULL; - - return &eeprom[address]; -} - -static int iwl_eeprom_read_calib(const u8 *eeprom, size_t eeprom_size, - struct iwl_nvm_data *data) -{ - struct iwl_eeprom_calib_hdr *hdr; - - hdr = (void *)iwl_eeprom_query_addr(eeprom, eeprom_size, - EEPROM_CALIB_ALL); - if (!hdr) - return -ENODATA; - data->calib_version = hdr->version; - data->calib_voltage = hdr->voltage; - - return 0; -} - -/** - * enum iwl_eeprom_channel_flags - channel flags in EEPROM - * @EEPROM_CHANNEL_VALID: channel is usable for this SKU/geo - * @EEPROM_CHANNEL_IBSS: usable as an IBSS channel - * @EEPROM_CHANNEL_ACTIVE: active scanning allowed - * @EEPROM_CHANNEL_RADAR: radar detection required - * @EEPROM_CHANNEL_WIDE: 20 MHz channel okay (?) - * @EEPROM_CHANNEL_DFS: dynamic freq selection candidate - */ -enum iwl_eeprom_channel_flags { - EEPROM_CHANNEL_VALID = BIT(0), - EEPROM_CHANNEL_IBSS = BIT(1), - EEPROM_CHANNEL_ACTIVE = BIT(3), - EEPROM_CHANNEL_RADAR = BIT(4), - EEPROM_CHANNEL_WIDE = BIT(5), - EEPROM_CHANNEL_DFS = BIT(7), -}; - -/** - * struct iwl_eeprom_channel - EEPROM channel data - * @flags: %EEPROM_CHANNEL_* flags - * @max_power_avg: max power (in dBm) on this channel, at most 31 dBm - */ -struct iwl_eeprom_channel { - u8 flags; - s8 max_power_avg; -} __packed; - - -enum iwl_eeprom_enhanced_txpwr_flags { - IWL_EEPROM_ENH_TXP_FL_VALID = BIT(0), - IWL_EEPROM_ENH_TXP_FL_BAND_52G = BIT(1), - IWL_EEPROM_ENH_TXP_FL_OFDM = BIT(2), - IWL_EEPROM_ENH_TXP_FL_40MHZ = BIT(3), - IWL_EEPROM_ENH_TXP_FL_HT_AP = BIT(4), - IWL_EEPROM_ENH_TXP_FL_RES1 = BIT(5), - IWL_EEPROM_ENH_TXP_FL_RES2 = BIT(6), - IWL_EEPROM_ENH_TXP_FL_COMMON_TYPE = BIT(7), -}; - -/** - * iwl_eeprom_enhanced_txpwr structure - * @flags: entry flags - * @channel: channel number - * @chain_a_max_pwr: chain a max power in 1/2 dBm - * @chain_b_max_pwr: chain b max power in 1/2 dBm - * @chain_c_max_pwr: chain c max power in 1/2 dBm - * @delta_20_in_40: 20-in-40 deltas (hi/lo) - * @mimo2_max_pwr: mimo2 max power in 1/2 dBm - * @mimo3_max_pwr: mimo3 max power in 1/2 dBm - * - * This structure presents the enhanced regulatory tx power limit layout - * in an EEPROM image. - */ -struct iwl_eeprom_enhanced_txpwr { - u8 flags; - u8 channel; - s8 chain_a_max; - s8 chain_b_max; - s8 chain_c_max; - u8 delta_20_in_40; - s8 mimo2_max; - s8 mimo3_max; -} __packed; - -static s8 iwl_get_max_txpwr_half_dbm(const struct iwl_nvm_data *data, - struct iwl_eeprom_enhanced_txpwr *txp) -{ - s8 result = 0; /* (.5 dBm) */ - - /* Take the highest tx power from any valid chains */ - if (data->valid_tx_ant & ANT_A && txp->chain_a_max > result) - result = txp->chain_a_max; - - if (data->valid_tx_ant & ANT_B && txp->chain_b_max > result) - result = txp->chain_b_max; - - if (data->valid_tx_ant & ANT_C && txp->chain_c_max > result) - result = txp->chain_c_max; - - if ((data->valid_tx_ant == ANT_AB || - data->valid_tx_ant == ANT_BC || - data->valid_tx_ant == ANT_AC) && txp->mimo2_max > result) - result = txp->mimo2_max; - - if (data->valid_tx_ant == ANT_ABC && txp->mimo3_max > result) - result = txp->mimo3_max; - - return result; -} - -#define EEPROM_TXP_OFFS (0x00 | INDIRECT_ADDRESS | INDIRECT_TXP_LIMIT) -#define EEPROM_TXP_ENTRY_LEN sizeof(struct iwl_eeprom_enhanced_txpwr) -#define EEPROM_TXP_SZ_OFFS (0x00 | INDIRECT_ADDRESS | INDIRECT_TXP_LIMIT_SIZE) - -#define TXP_CHECK_AND_PRINT(x) \ - ((txp->flags & IWL_EEPROM_ENH_TXP_FL_##x) ? # x " " : "") - -static void -iwl_eeprom_enh_txp_read_element(struct iwl_nvm_data *data, - struct iwl_eeprom_enhanced_txpwr *txp, - int n_channels, s8 max_txpower_avg) -{ - int ch_idx; - enum ieee80211_band band; - - band = txp->flags & IWL_EEPROM_ENH_TXP_FL_BAND_52G ? - IEEE80211_BAND_5GHZ : IEEE80211_BAND_2GHZ; - - for (ch_idx = 0; ch_idx < n_channels; ch_idx++) { - struct ieee80211_channel *chan = &data->channels[ch_idx]; - - /* update matching channel or from common data only */ - if (txp->channel != 0 && chan->hw_value != txp->channel) - continue; - - /* update matching band only */ - if (band != chan->band) - continue; - - if (chan->max_power < max_txpower_avg && - !(txp->flags & IWL_EEPROM_ENH_TXP_FL_40MHZ)) - chan->max_power = max_txpower_avg; - } -} - -static void iwl_eeprom_enhanced_txpower(struct device *dev, - struct iwl_nvm_data *data, - const u8 *eeprom, size_t eeprom_size, - int n_channels) -{ - struct iwl_eeprom_enhanced_txpwr *txp_array, *txp; - int idx, entries; - __le16 *txp_len; - s8 max_txp_avg_halfdbm; - - BUILD_BUG_ON(sizeof(struct iwl_eeprom_enhanced_txpwr) != 8); - - /* the length is in 16-bit words, but we want entries */ - txp_len = (__le16 *)iwl_eeprom_query_addr(eeprom, eeprom_size, - EEPROM_TXP_SZ_OFFS); - entries = le16_to_cpup(txp_len) * 2 / EEPROM_TXP_ENTRY_LEN; - - txp_array = (void *)iwl_eeprom_query_addr(eeprom, eeprom_size, - EEPROM_TXP_OFFS); - - for (idx = 0; idx < entries; idx++) { - txp = &txp_array[idx]; - /* skip invalid entries */ - if (!(txp->flags & IWL_EEPROM_ENH_TXP_FL_VALID)) - continue; - - IWL_DEBUG_EEPROM(dev, "%s %d:\t %s%s%s%s%s%s%s%s (0x%02x)\n", - (txp->channel && (txp->flags & - IWL_EEPROM_ENH_TXP_FL_COMMON_TYPE)) ? - "Common " : (txp->channel) ? - "Channel" : "Common", - (txp->channel), - TXP_CHECK_AND_PRINT(VALID), - TXP_CHECK_AND_PRINT(BAND_52G), - TXP_CHECK_AND_PRINT(OFDM), - TXP_CHECK_AND_PRINT(40MHZ), - TXP_CHECK_AND_PRINT(HT_AP), - TXP_CHECK_AND_PRINT(RES1), - TXP_CHECK_AND_PRINT(RES2), - TXP_CHECK_AND_PRINT(COMMON_TYPE), - txp->flags); - IWL_DEBUG_EEPROM(dev, - "\t\t chain_A: 0x%02x chain_B: 0X%02x chain_C: 0X%02x\n", - txp->chain_a_max, txp->chain_b_max, - txp->chain_c_max); - IWL_DEBUG_EEPROM(dev, - "\t\t MIMO2: 0x%02x MIMO3: 0x%02x High 20_on_40: 0x%02x Low 20_on_40: 0x%02x\n", - txp->mimo2_max, txp->mimo3_max, - ((txp->delta_20_in_40 & 0xf0) >> 4), - (txp->delta_20_in_40 & 0x0f)); - - max_txp_avg_halfdbm = iwl_get_max_txpwr_half_dbm(data, txp); - - iwl_eeprom_enh_txp_read_element(data, txp, n_channels, - DIV_ROUND_UP(max_txp_avg_halfdbm, 2)); - - if (max_txp_avg_halfdbm > data->max_tx_pwr_half_dbm) - data->max_tx_pwr_half_dbm = max_txp_avg_halfdbm; - } -} - -static void iwl_init_band_reference(const struct iwl_cfg *cfg, - const u8 *eeprom, size_t eeprom_size, - int eeprom_band, int *eeprom_ch_count, - const struct iwl_eeprom_channel **ch_info, - const u8 **eeprom_ch_array) -{ - u32 offset = cfg->eeprom_params->regulatory_bands[eeprom_band - 1]; - - offset |= INDIRECT_ADDRESS | INDIRECT_REGULATORY; - - *ch_info = (void *)iwl_eeprom_query_addr(eeprom, eeprom_size, offset); - - switch (eeprom_band) { - case 1: /* 2.4GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_1); - *eeprom_ch_array = iwl_eeprom_band_1; - break; - case 2: /* 4.9GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_2); - *eeprom_ch_array = iwl_eeprom_band_2; - break; - case 3: /* 5.2GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_3); - *eeprom_ch_array = iwl_eeprom_band_3; - break; - case 4: /* 5.5GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_4); - *eeprom_ch_array = iwl_eeprom_band_4; - break; - case 5: /* 5.7GHz band */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_5); - *eeprom_ch_array = iwl_eeprom_band_5; - break; - case 6: /* 2.4GHz ht40 channels */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_6); - *eeprom_ch_array = iwl_eeprom_band_6; - break; - case 7: /* 5 GHz ht40 channels */ - *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_7); - *eeprom_ch_array = iwl_eeprom_band_7; - break; - default: - *eeprom_ch_count = 0; - *eeprom_ch_array = NULL; - WARN_ON(1); - } -} - -#define CHECK_AND_PRINT(x) \ - ((eeprom_ch->flags & EEPROM_CHANNEL_##x) ? # x " " : "") - -static void iwl_mod_ht40_chan_info(struct device *dev, - struct iwl_nvm_data *data, int n_channels, - enum ieee80211_band band, u16 channel, - const struct iwl_eeprom_channel *eeprom_ch, - u8 clear_ht40_extension_channel) -{ - struct ieee80211_channel *chan = NULL; - int i; - - for (i = 0; i < n_channels; i++) { - if (data->channels[i].band != band) - continue; - if (data->channels[i].hw_value != channel) - continue; - chan = &data->channels[i]; - break; - } - - if (!chan) - return; - - IWL_DEBUG_EEPROM(dev, - "HT40 Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm): Ad-Hoc %ssupported\n", - channel, - band == IEEE80211_BAND_5GHZ ? "5.2" : "2.4", - CHECK_AND_PRINT(IBSS), - CHECK_AND_PRINT(ACTIVE), - CHECK_AND_PRINT(RADAR), - CHECK_AND_PRINT(WIDE), - CHECK_AND_PRINT(DFS), - eeprom_ch->flags, - eeprom_ch->max_power_avg, - ((eeprom_ch->flags & EEPROM_CHANNEL_IBSS) && - !(eeprom_ch->flags & EEPROM_CHANNEL_RADAR)) ? "" - : "not "); - - if (eeprom_ch->flags & EEPROM_CHANNEL_VALID) - chan->flags &= ~clear_ht40_extension_channel; -} - -#define CHECK_AND_PRINT_I(x) \ - ((eeprom_ch_info[ch_idx].flags & EEPROM_CHANNEL_##x) ? # x " " : "") - -static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, - struct iwl_nvm_data *data, - const u8 *eeprom, size_t eeprom_size) -{ - int band, ch_idx; - const struct iwl_eeprom_channel *eeprom_ch_info; - const u8 *eeprom_ch_array; - int eeprom_ch_count; - int n_channels = 0; - - /* - * Loop through the 5 EEPROM bands and add them to the parse list - */ - for (band = 1; band <= 5; band++) { - struct ieee80211_channel *channel; - - iwl_init_band_reference(cfg, eeprom, eeprom_size, band, - &eeprom_ch_count, &eeprom_ch_info, - &eeprom_ch_array); - - /* Loop through each band adding each of the channels */ - for (ch_idx = 0; ch_idx < eeprom_ch_count; ch_idx++) { - const struct iwl_eeprom_channel *eeprom_ch; - - eeprom_ch = &eeprom_ch_info[ch_idx]; - - if (!(eeprom_ch->flags & EEPROM_CHANNEL_VALID)) { - IWL_DEBUG_EEPROM(dev, - "Ch. %d Flags %x [%sGHz] - No traffic\n", - eeprom_ch_array[ch_idx], - eeprom_ch_info[ch_idx].flags, - (band != 1) ? "5.2" : "2.4"); - continue; - } - - channel = &data->channels[n_channels]; - n_channels++; - - channel->hw_value = eeprom_ch_array[ch_idx]; - channel->band = (band == 1) ? IEEE80211_BAND_2GHZ - : IEEE80211_BAND_5GHZ; - channel->center_freq = - ieee80211_channel_to_frequency( - channel->hw_value, channel->band); - - /* set no-HT40, will enable as appropriate later */ - channel->flags = IEEE80211_CHAN_NO_HT40; - - if (!(eeprom_ch->flags & EEPROM_CHANNEL_IBSS)) - channel->flags |= IEEE80211_CHAN_NO_IBSS; - - if (!(eeprom_ch->flags & EEPROM_CHANNEL_ACTIVE)) - channel->flags |= IEEE80211_CHAN_PASSIVE_SCAN; - - if (eeprom_ch->flags & EEPROM_CHANNEL_RADAR) - channel->flags |= IEEE80211_CHAN_RADAR; - - /* Initialize regulatory-based run-time data */ - channel->max_power = - eeprom_ch_info[ch_idx].max_power_avg; - IWL_DEBUG_EEPROM(dev, - "Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x %ddBm): Ad-Hoc %ssupported\n", - channel->hw_value, - (band != 1) ? "5.2" : "2.4", - CHECK_AND_PRINT_I(VALID), - CHECK_AND_PRINT_I(IBSS), - CHECK_AND_PRINT_I(ACTIVE), - CHECK_AND_PRINT_I(RADAR), - CHECK_AND_PRINT_I(WIDE), - CHECK_AND_PRINT_I(DFS), - eeprom_ch_info[ch_idx].flags, - eeprom_ch_info[ch_idx].max_power_avg, - ((eeprom_ch_info[ch_idx].flags & - EEPROM_CHANNEL_IBSS) && - !(eeprom_ch_info[ch_idx].flags & - EEPROM_CHANNEL_RADAR)) - ? "" : "not "); - } - } - - if (cfg->eeprom_params->enhanced_txpower) { - /* - * for newer device (6000 series and up) - * EEPROM contain enhanced tx power information - * driver need to process addition information - * to determine the max channel tx power limits - */ - iwl_eeprom_enhanced_txpower(dev, data, eeprom, eeprom_size, - n_channels); - } else { - /* All others use data from channel map */ - int i; - - data->max_tx_pwr_half_dbm = -128; - - for (i = 0; i < n_channels; i++) - data->max_tx_pwr_half_dbm = - max_t(s8, data->max_tx_pwr_half_dbm, - data->channels[i].max_power * 2); - } - - /* Check if we do have HT40 channels */ - if (cfg->eeprom_params->regulatory_bands[5] == - EEPROM_REGULATORY_BAND_NO_HT40 && - cfg->eeprom_params->regulatory_bands[6] == - EEPROM_REGULATORY_BAND_NO_HT40) - return n_channels; - - /* Two additional EEPROM bands for 2.4 and 5 GHz HT40 channels */ - for (band = 6; band <= 7; band++) { - enum ieee80211_band ieeeband; - - iwl_init_band_reference(cfg, eeprom, eeprom_size, band, - &eeprom_ch_count, &eeprom_ch_info, - &eeprom_ch_array); - - /* EEPROM band 6 is 2.4, band 7 is 5 GHz */ - ieeeband = (band == 6) ? IEEE80211_BAND_2GHZ - : IEEE80211_BAND_5GHZ; - - /* Loop through each band adding each of the channels */ - for (ch_idx = 0; ch_idx < eeprom_ch_count; ch_idx++) { - /* Set up driver's info for lower half */ - iwl_mod_ht40_chan_info(dev, data, n_channels, ieeeband, - eeprom_ch_array[ch_idx], - &eeprom_ch_info[ch_idx], - IEEE80211_CHAN_NO_HT40PLUS); - - /* Set up driver's info for upper half */ - iwl_mod_ht40_chan_info(dev, data, n_channels, ieeeband, - eeprom_ch_array[ch_idx] + 4, - &eeprom_ch_info[ch_idx], - IEEE80211_CHAN_NO_HT40MINUS); - } - } - - return n_channels; -} - -int iwl_init_sband_channels(struct iwl_nvm_data *data, - struct ieee80211_supported_band *sband, - int n_channels, enum ieee80211_band band) -{ - struct ieee80211_channel *chan = &data->channels[0]; - int n = 0, idx = 0; - - while (chan->band != band && idx < n_channels) - chan = &data->channels[++idx]; - - sband->channels = &data->channels[idx]; - - while (chan->band == band && idx < n_channels) { - chan = &data->channels[++idx]; - n++; - } - - sband->n_channels = n; - - return n; -} - -#define MAX_BIT_RATE_40_MHZ 150 /* Mbps */ -#define MAX_BIT_RATE_20_MHZ 72 /* Mbps */ - -void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg, - struct iwl_nvm_data *data, - struct ieee80211_sta_ht_cap *ht_info, - enum ieee80211_band band) -{ - int max_bit_rate = 0; - u8 rx_chains; - u8 tx_chains; - - tx_chains = hweight8(data->valid_tx_ant); - if (cfg->rx_with_siso_diversity) - rx_chains = 1; - else - rx_chains = hweight8(data->valid_rx_ant); - - if (!(data->sku_cap_11n_enable) || !cfg->ht_params) { - ht_info->ht_supported = false; - return; - } - - ht_info->ht_supported = true; - ht_info->cap = IEEE80211_HT_CAP_DSSSCCK40; - - if (iwlwifi_mod_params.amsdu_size_8K) - ht_info->cap |= IEEE80211_HT_CAP_MAX_AMSDU; - - ht_info->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; - ht_info->ampdu_density = IEEE80211_HT_MPDU_DENSITY_4; - - ht_info->mcs.rx_mask[0] = 0xFF; - if (rx_chains >= 2) - ht_info->mcs.rx_mask[1] = 0xFF; - if (rx_chains >= 3) - ht_info->mcs.rx_mask[2] = 0xFF; - - if (cfg->ht_params->ht_greenfield_support) - ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD; - ht_info->cap |= IEEE80211_HT_CAP_SGI_20; - - max_bit_rate = MAX_BIT_RATE_20_MHZ; - - if (cfg->ht_params->ht40_bands & BIT(band)) { - ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; - ht_info->cap |= IEEE80211_HT_CAP_SGI_40; - ht_info->mcs.rx_mask[4] = 0x01; - max_bit_rate = MAX_BIT_RATE_40_MHZ; - } - - /* Highest supported Rx data rate */ - max_bit_rate *= rx_chains; - WARN_ON(max_bit_rate & ~IEEE80211_HT_MCS_RX_HIGHEST_MASK); - ht_info->mcs.rx_highest = cpu_to_le16(max_bit_rate); - - /* Tx MCS capabilities */ - ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; - if (tx_chains != rx_chains) { - ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF; - ht_info->mcs.tx_params |= ((tx_chains - 1) << - IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT); - } -} - -static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg, - struct iwl_nvm_data *data, - const u8 *eeprom, size_t eeprom_size) -{ - int n_channels = iwl_init_channel_map(dev, cfg, data, - eeprom, eeprom_size); - int n_used = 0; - struct ieee80211_supported_band *sband; - - sband = &data->bands[IEEE80211_BAND_2GHZ]; - sband->band = IEEE80211_BAND_2GHZ; - sband->bitrates = &iwl_cfg80211_rates[RATES_24_OFFS]; - sband->n_bitrates = N_RATES_24; - n_used += iwl_init_sband_channels(data, sband, n_channels, - IEEE80211_BAND_2GHZ); - iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_2GHZ); - - sband = &data->bands[IEEE80211_BAND_5GHZ]; - sband->band = IEEE80211_BAND_5GHZ; - sband->bitrates = &iwl_cfg80211_rates[RATES_52_OFFS]; - sband->n_bitrates = N_RATES_52; - n_used += iwl_init_sband_channels(data, sband, n_channels, - IEEE80211_BAND_5GHZ); - iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_5GHZ); - - if (n_channels != n_used) - IWL_ERR_DEV(dev, "EEPROM: used only %d of %d channels\n", - n_used, n_channels); -} - -/* EEPROM data functions */ - -struct iwl_nvm_data * -iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg, - const u8 *eeprom, size_t eeprom_size) -{ - struct iwl_nvm_data *data; - const void *tmp; - u16 radio_cfg, sku; - - if (WARN_ON(!cfg || !cfg->eeprom_params)) - return NULL; - - data = kzalloc(sizeof(*data) + - sizeof(struct ieee80211_channel) * IWL_NUM_CHANNELS, - GFP_KERNEL); - if (!data) - return NULL; - - /* get MAC address(es) */ - tmp = iwl_eeprom_query_addr(eeprom, eeprom_size, EEPROM_MAC_ADDRESS); - if (!tmp) - goto err_free; - memcpy(data->hw_addr, tmp, ETH_ALEN); - data->n_hw_addrs = iwl_eeprom_query16(eeprom, eeprom_size, - EEPROM_NUM_MAC_ADDRESS); - - if (iwl_eeprom_read_calib(eeprom, eeprom_size, data)) - goto err_free; - - tmp = iwl_eeprom_query_addr(eeprom, eeprom_size, EEPROM_XTAL); - if (!tmp) - goto err_free; - memcpy(data->xtal_calib, tmp, sizeof(data->xtal_calib)); - - tmp = iwl_eeprom_query_addr(eeprom, eeprom_size, - EEPROM_RAW_TEMPERATURE); - if (!tmp) - goto err_free; - data->raw_temperature = *(__le16 *)tmp; - - tmp = iwl_eeprom_query_addr(eeprom, eeprom_size, - EEPROM_KELVIN_TEMPERATURE); - if (!tmp) - goto err_free; - data->kelvin_temperature = *(__le16 *)tmp; - data->kelvin_voltage = *((__le16 *)tmp + 1); - - radio_cfg = iwl_eeprom_query16(eeprom, eeprom_size, - EEPROM_RADIO_CONFIG); - data->radio_cfg_dash = EEPROM_RF_CFG_DASH_MSK(radio_cfg); - data->radio_cfg_pnum = EEPROM_RF_CFG_PNUM_MSK(radio_cfg); - data->radio_cfg_step = EEPROM_RF_CFG_STEP_MSK(radio_cfg); - data->radio_cfg_type = EEPROM_RF_CFG_TYPE_MSK(radio_cfg); - data->valid_rx_ant = EEPROM_RF_CFG_RX_ANT_MSK(radio_cfg); - data->valid_tx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg); - - sku = iwl_eeprom_query16(eeprom, eeprom_size, - EEPROM_SKU_CAP); - data->sku_cap_11n_enable = sku & EEPROM_SKU_CAP_11N_ENABLE; - data->sku_cap_amt_enable = sku & EEPROM_SKU_CAP_AMT_ENABLE; - data->sku_cap_band_24GHz_enable = sku & EEPROM_SKU_CAP_BAND_24GHZ; - data->sku_cap_band_52GHz_enable = sku & EEPROM_SKU_CAP_BAND_52GHZ; - data->sku_cap_ipan_enable = sku & EEPROM_SKU_CAP_IPAN_ENABLE; - if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_ALL) - data->sku_cap_11n_enable = false; - - data->nvm_version = iwl_eeprom_query16(eeprom, eeprom_size, - EEPROM_VERSION); - - /* check overrides (some devices have wrong EEPROM) */ - if (cfg->valid_tx_ant) - data->valid_tx_ant = cfg->valid_tx_ant; - if (cfg->valid_rx_ant) - data->valid_rx_ant = cfg->valid_rx_ant; - - if (!data->valid_tx_ant || !data->valid_rx_ant) { - IWL_ERR_DEV(dev, "invalid antennas (0x%x, 0x%x)\n", - data->valid_tx_ant, data->valid_rx_ant); - goto err_free; - } - - iwl_init_sbands(dev, cfg, data, eeprom, eeprom_size); - - return data; - err_free: - kfree(data); - return NULL; -} -IWL_EXPORT_SYMBOL(iwl_parse_eeprom_data); - -/* helper functions */ -int iwl_nvm_check_version(struct iwl_nvm_data *data, - struct iwl_trans *trans) -{ - if (data->nvm_version >= trans->cfg->nvm_ver || - data->calib_version >= trans->cfg->nvm_calib_ver) { - IWL_DEBUG_INFO(trans, "device EEPROM VER=0x%x, CALIB=0x%x\n", - data->nvm_version, data->calib_version); - return 0; - } - - IWL_ERR(trans, - "Unsupported (too old) EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n", - data->nvm_version, trans->cfg->nvm_ver, - data->calib_version, trans->cfg->nvm_calib_ver); - return -EINVAL; -} -IWL_EXPORT_SYMBOL(iwl_nvm_check_version); diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h deleted file mode 100644 index 37f115390b19..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h +++ /dev/null @@ -1,138 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ -#ifndef __iwl_eeprom_parse_h__ -#define __iwl_eeprom_parse_h__ - -#include -#include -#include "iwl-trans.h" - -struct iwl_nvm_data { - int n_hw_addrs; - u8 hw_addr[ETH_ALEN]; - - u8 calib_version; - __le16 calib_voltage; - - __le16 raw_temperature; - __le16 kelvin_temperature; - __le16 kelvin_voltage; - __le16 xtal_calib[2]; - - bool sku_cap_band_24GHz_enable; - bool sku_cap_band_52GHz_enable; - bool sku_cap_11n_enable; - bool sku_cap_amt_enable; - bool sku_cap_ipan_enable; - - u8 radio_cfg_type; - u8 radio_cfg_step; - u8 radio_cfg_dash; - u8 radio_cfg_pnum; - u8 valid_tx_ant, valid_rx_ant; - - u16 nvm_version; - s8 max_tx_pwr_half_dbm; - - struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; - struct ieee80211_channel channels[]; -}; - -/** - * iwl_parse_eeprom_data - parse EEPROM data and return values - * - * @dev: device pointer we're parsing for, for debug only - * @cfg: device configuration for parsing and overrides - * @eeprom: the EEPROM data - * @eeprom_size: length of the EEPROM data - * - * This function parses all EEPROM values we need and then - * returns a (newly allocated) struct containing all the - * relevant values for driver use. The struct must be freed - * later with iwl_free_nvm_data(). - */ -struct iwl_nvm_data * -iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg, - const u8 *eeprom, size_t eeprom_size); - -/** - * iwl_free_nvm_data - free NVM data - * @data: the data to free - */ -static inline void iwl_free_nvm_data(struct iwl_nvm_data *data) -{ - kfree(data); -} - -int iwl_nvm_check_version(struct iwl_nvm_data *data, - struct iwl_trans *trans); - -int iwl_init_sband_channels(struct iwl_nvm_data *data, - struct ieee80211_supported_band *sband, - int n_channels, enum ieee80211_band band); - -void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg, - struct iwl_nvm_data *data, - struct ieee80211_sta_ht_cap *ht_info, - enum ieee80211_band band); - -#endif /* __iwl_eeprom_parse_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom-read.c b/drivers/net/wireless/iwlwifi/iwl-eeprom-read.c deleted file mode 100644 index e5f2e362ab0b..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom-read.c +++ /dev/null @@ -1,464 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ -#include -#include -#include - -#include "iwl-drv.h" -#include "iwl-debug.h" -#include "iwl-eeprom-read.h" -#include "iwl-io.h" -#include "iwl-prph.h" -#include "iwl-csr.h" - -/* - * EEPROM access time values: - * - * Driver initiates EEPROM read by writing byte address << 1 to CSR_EEPROM_REG. - * Driver then polls CSR_EEPROM_REG for CSR_EEPROM_REG_READ_VALID_MSK (0x1). - * When polling, wait 10 uSec between polling loops, up to a maximum 5000 uSec. - * Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG. - */ -#define IWL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */ - -#define IWL_EEPROM_SEM_TIMEOUT 10 /* microseconds */ -#define IWL_EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ - - -/* - * The device's EEPROM semaphore prevents conflicts between driver and uCode - * when accessing the EEPROM; each access is a series of pulses to/from the - * EEPROM chip, not a single event, so even reads could conflict if they - * weren't arbitrated by the semaphore. - */ - -#define EEPROM_SEM_TIMEOUT 10 /* milliseconds */ -#define EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */ - -static int iwl_eeprom_acquire_semaphore(struct iwl_trans *trans) -{ - u16 count; - int ret; - - for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) { - /* Request semaphore */ - iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); - - /* See if we got it */ - ret = iwl_poll_bit(trans, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, - CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM, - EEPROM_SEM_TIMEOUT); - if (ret >= 0) { - IWL_DEBUG_EEPROM(trans->dev, - "Acquired semaphore after %d tries.\n", - count+1); - return ret; - } - } - - return ret; -} - -static void iwl_eeprom_release_semaphore(struct iwl_trans *trans) -{ - iwl_clear_bit(trans, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM); -} - -static int iwl_eeprom_verify_signature(struct iwl_trans *trans, bool nvm_is_otp) -{ - u32 gp = iwl_read32(trans, CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK; - - IWL_DEBUG_EEPROM(trans->dev, "EEPROM signature=0x%08x\n", gp); - - switch (gp) { - case CSR_EEPROM_GP_BAD_SIG_EEP_GOOD_SIG_OTP: - if (!nvm_is_otp) { - IWL_ERR(trans, "EEPROM with bad signature: 0x%08x\n", - gp); - return -ENOENT; - } - return 0; - case CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K: - case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K: - if (nvm_is_otp) { - IWL_ERR(trans, "OTP with bad signature: 0x%08x\n", gp); - return -ENOENT; - } - return 0; - case CSR_EEPROM_GP_BAD_SIGNATURE_BOTH_EEP_AND_OTP: - default: - IWL_ERR(trans, - "bad EEPROM/OTP signature, type=%s, EEPROM_GP=0x%08x\n", - nvm_is_otp ? "OTP" : "EEPROM", gp); - return -ENOENT; - } -} - -/****************************************************************************** - * - * OTP related functions - * -******************************************************************************/ - -static void iwl_set_otp_access_absolute(struct iwl_trans *trans) -{ - iwl_read32(trans, CSR_OTP_GP_REG); - - iwl_clear_bit(trans, CSR_OTP_GP_REG, - CSR_OTP_GP_REG_OTP_ACCESS_MODE); -} - -static int iwl_nvm_is_otp(struct iwl_trans *trans) -{ - u32 otpgp; - - /* OTP only valid for CP/PP and after */ - switch (trans->hw_rev & CSR_HW_REV_TYPE_MSK) { - case CSR_HW_REV_TYPE_NONE: - IWL_ERR(trans, "Unknown hardware type\n"); - return -EIO; - case CSR_HW_REV_TYPE_5300: - case CSR_HW_REV_TYPE_5350: - case CSR_HW_REV_TYPE_5100: - case CSR_HW_REV_TYPE_5150: - return 0; - default: - otpgp = iwl_read32(trans, CSR_OTP_GP_REG); - if (otpgp & CSR_OTP_GP_REG_DEVICE_SELECT) - return 1; - return 0; - } -} - -static int iwl_init_otp_access(struct iwl_trans *trans) -{ - int ret; - - /* Enable 40MHz radio clock */ - iwl_write32(trans, CSR_GP_CNTRL, - iwl_read32(trans, CSR_GP_CNTRL) | - CSR_GP_CNTRL_REG_FLAG_INIT_DONE); - - /* wait for clock to be ready */ - ret = iwl_poll_bit(trans, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, - CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, - 25000); - if (ret < 0) { - IWL_ERR(trans, "Time out access OTP\n"); - } else { - iwl_set_bits_prph(trans, APMG_PS_CTRL_REG, - APMG_PS_CTRL_VAL_RESET_REQ); - udelay(5); - iwl_clear_bits_prph(trans, APMG_PS_CTRL_REG, - APMG_PS_CTRL_VAL_RESET_REQ); - - /* - * CSR auto clock gate disable bit - - * this is only applicable for HW with OTP shadow RAM - */ - if (trans->cfg->base_params->shadow_ram_support) - iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, - CSR_RESET_LINK_PWR_MGMT_DISABLED); - } - return ret; -} - -static int iwl_read_otp_word(struct iwl_trans *trans, u16 addr, - __le16 *eeprom_data) -{ - int ret = 0; - u32 r; - u32 otpgp; - - iwl_write32(trans, CSR_EEPROM_REG, - CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); - ret = iwl_poll_bit(trans, CSR_EEPROM_REG, - CSR_EEPROM_REG_READ_VALID_MSK, - CSR_EEPROM_REG_READ_VALID_MSK, - IWL_EEPROM_ACCESS_TIMEOUT); - if (ret < 0) { - IWL_ERR(trans, "Time out reading OTP[%d]\n", addr); - return ret; - } - r = iwl_read32(trans, CSR_EEPROM_REG); - /* check for ECC errors: */ - otpgp = iwl_read32(trans, CSR_OTP_GP_REG); - if (otpgp & CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK) { - /* stop in this case */ - /* set the uncorrectable OTP ECC bit for acknowledgement */ - iwl_set_bit(trans, CSR_OTP_GP_REG, - CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK); - IWL_ERR(trans, "Uncorrectable OTP ECC error, abort OTP read\n"); - return -EINVAL; - } - if (otpgp & CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK) { - /* continue in this case */ - /* set the correctable OTP ECC bit for acknowledgement */ - iwl_set_bit(trans, CSR_OTP_GP_REG, - CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK); - IWL_ERR(trans, "Correctable OTP ECC error, continue read\n"); - } - *eeprom_data = cpu_to_le16(r >> 16); - return 0; -} - -/* - * iwl_is_otp_empty: check for empty OTP - */ -static bool iwl_is_otp_empty(struct iwl_trans *trans) -{ - u16 next_link_addr = 0; - __le16 link_value; - bool is_empty = false; - - /* locate the beginning of OTP link list */ - if (!iwl_read_otp_word(trans, next_link_addr, &link_value)) { - if (!link_value) { - IWL_ERR(trans, "OTP is empty\n"); - is_empty = true; - } - } else { - IWL_ERR(trans, "Unable to read first block of OTP list.\n"); - is_empty = true; - } - - return is_empty; -} - - -/* - * iwl_find_otp_image: find EEPROM image in OTP - * finding the OTP block that contains the EEPROM image. - * the last valid block on the link list (the block _before_ the last block) - * is the block we should read and used to configure the device. - * If all the available OTP blocks are full, the last block will be the block - * we should read and used to configure the device. - * only perform this operation if shadow RAM is disabled - */ -static int iwl_find_otp_image(struct iwl_trans *trans, - u16 *validblockaddr) -{ - u16 next_link_addr = 0, valid_addr; - __le16 link_value = 0; - int usedblocks = 0; - - /* set addressing mode to absolute to traverse the link list */ - iwl_set_otp_access_absolute(trans); - - /* checking for empty OTP or error */ - if (iwl_is_otp_empty(trans)) - return -EINVAL; - - /* - * start traverse link list - * until reach the max number of OTP blocks - * different devices have different number of OTP blocks - */ - do { - /* save current valid block address - * check for more block on the link list - */ - valid_addr = next_link_addr; - next_link_addr = le16_to_cpu(link_value) * sizeof(u16); - IWL_DEBUG_EEPROM(trans->dev, "OTP blocks %d addr 0x%x\n", - usedblocks, next_link_addr); - if (iwl_read_otp_word(trans, next_link_addr, &link_value)) - return -EINVAL; - if (!link_value) { - /* - * reach the end of link list, return success and - * set address point to the starting address - * of the image - */ - *validblockaddr = valid_addr; - /* skip first 2 bytes (link list pointer) */ - *validblockaddr += 2; - return 0; - } - /* more in the link list, continue */ - usedblocks++; - } while (usedblocks <= trans->cfg->base_params->max_ll_items); - - /* OTP has no valid blocks */ - IWL_DEBUG_EEPROM(trans->dev, "OTP has no valid blocks\n"); - return -EINVAL; -} - -/** - * iwl_read_eeprom - read EEPROM contents - * - * Load the EEPROM contents from adapter and return it - * and its size. - * - * NOTE: This routine uses the non-debug IO access functions. - */ -int iwl_read_eeprom(struct iwl_trans *trans, u8 **eeprom, size_t *eeprom_size) -{ - __le16 *e; - u32 gp = iwl_read32(trans, CSR_EEPROM_GP); - int sz; - int ret; - u16 addr; - u16 validblockaddr = 0; - u16 cache_addr = 0; - int nvm_is_otp; - - if (!eeprom || !eeprom_size) - return -EINVAL; - - nvm_is_otp = iwl_nvm_is_otp(trans); - if (nvm_is_otp < 0) - return nvm_is_otp; - - sz = trans->cfg->base_params->eeprom_size; - IWL_DEBUG_EEPROM(trans->dev, "NVM size = %d\n", sz); - - e = kmalloc(sz, GFP_KERNEL); - if (!e) - return -ENOMEM; - - ret = iwl_eeprom_verify_signature(trans, nvm_is_otp); - if (ret < 0) { - IWL_ERR(trans, "EEPROM not found, EEPROM_GP=0x%08x\n", gp); - goto err_free; - } - - /* Make sure driver (instead of uCode) is allowed to read EEPROM */ - ret = iwl_eeprom_acquire_semaphore(trans); - if (ret < 0) { - IWL_ERR(trans, "Failed to acquire EEPROM semaphore.\n"); - goto err_free; - } - - if (nvm_is_otp) { - ret = iwl_init_otp_access(trans); - if (ret) { - IWL_ERR(trans, "Failed to initialize OTP access.\n"); - goto err_unlock; - } - - iwl_write32(trans, CSR_EEPROM_GP, - iwl_read32(trans, CSR_EEPROM_GP) & - ~CSR_EEPROM_GP_IF_OWNER_MSK); - - iwl_set_bit(trans, CSR_OTP_GP_REG, - CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK | - CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK); - /* traversing the linked list if no shadow ram supported */ - if (!trans->cfg->base_params->shadow_ram_support) { - ret = iwl_find_otp_image(trans, &validblockaddr); - if (ret) - goto err_unlock; - } - for (addr = validblockaddr; addr < validblockaddr + sz; - addr += sizeof(u16)) { - __le16 eeprom_data; - - ret = iwl_read_otp_word(trans, addr, &eeprom_data); - if (ret) - goto err_unlock; - e[cache_addr / 2] = eeprom_data; - cache_addr += sizeof(u16); - } - } else { - /* eeprom is an array of 16bit values */ - for (addr = 0; addr < sz; addr += sizeof(u16)) { - u32 r; - - iwl_write32(trans, CSR_EEPROM_REG, - CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); - - ret = iwl_poll_bit(trans, CSR_EEPROM_REG, - CSR_EEPROM_REG_READ_VALID_MSK, - CSR_EEPROM_REG_READ_VALID_MSK, - IWL_EEPROM_ACCESS_TIMEOUT); - if (ret < 0) { - IWL_ERR(trans, - "Time out reading EEPROM[%d]\n", addr); - goto err_unlock; - } - r = iwl_read32(trans, CSR_EEPROM_REG); - e[addr / 2] = cpu_to_le16(r >> 16); - } - } - - IWL_DEBUG_EEPROM(trans->dev, "NVM Type: %s\n", - nvm_is_otp ? "OTP" : "EEPROM"); - - iwl_eeprom_release_semaphore(trans); - - *eeprom_size = sz; - *eeprom = (u8 *)e; - return 0; - - err_unlock: - iwl_eeprom_release_semaphore(trans); - err_free: - kfree(e); - - return ret; -} -IWL_EXPORT_SYMBOL(iwl_read_eeprom); diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom-read.h b/drivers/net/wireless/iwlwifi/iwl-eeprom-read.h deleted file mode 100644 index 8e941f8bd7d6..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom-read.h +++ /dev/null @@ -1,70 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef __iwl_eeprom_h__ -#define __iwl_eeprom_h__ - -#include "iwl-trans.h" - -int iwl_read_eeprom(struct iwl_trans *trans, u8 **eeprom, size_t *eeprom_size); - -#endif /* __iwl_eeprom_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h deleted file mode 100644 index 484d318245fb..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-fh.h +++ /dev/null @@ -1,540 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2005 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#ifndef __iwl_fh_h__ -#define __iwl_fh_h__ - -#include - -/****************************/ -/* Flow Handler Definitions */ -/****************************/ - -/** - * This I/O area is directly read/writable by driver (e.g. Linux uses writel()) - * Addresses are offsets from device's PCI hardware base address. - */ -#define FH_MEM_LOWER_BOUND (0x1000) -#define FH_MEM_UPPER_BOUND (0x2000) - -/** - * Keep-Warm (KW) buffer base address. - * - * Driver must allocate a 4KByte buffer that is for keeping the - * host DRAM powered on (via dummy accesses to DRAM) to maintain low-latency - * DRAM access when doing Txing or Rxing. The dummy accesses prevent host - * from going into a power-savings mode that would cause higher DRAM latency, - * and possible data over/under-runs, before all Tx/Rx is complete. - * - * Driver loads FH_KW_MEM_ADDR_REG with the physical address (bits 35:4) - * of the buffer, which must be 4K aligned. Once this is set up, the device - * automatically invokes keep-warm accesses when normal accesses might not - * be sufficient to maintain fast DRAM response. - * - * Bit fields: - * 31-0: Keep-warm buffer physical base address [35:4], must be 4K aligned - */ -#define FH_KW_MEM_ADDR_REG (FH_MEM_LOWER_BOUND + 0x97C) - - -/** - * TFD Circular Buffers Base (CBBC) addresses - * - * Device has 16 base pointer registers, one for each of 16 host-DRAM-resident - * circular buffers (CBs/queues) containing Transmit Frame Descriptors (TFDs) - * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04 - * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte - * aligned (address bits 0-7 must be 0). - * Later devices have 20 (5000 series) or 30 (higher) queues, but the registers - * for them are in different places. - * - * Bit fields in each pointer register: - * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned - */ -#define FH_MEM_CBBC_0_15_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) -#define FH_MEM_CBBC_0_15_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) -#define FH_MEM_CBBC_16_19_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBF0) -#define FH_MEM_CBBC_16_19_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) -#define FH_MEM_CBBC_20_31_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xB20) -#define FH_MEM_CBBC_20_31_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xB80) - -/* Find TFD CB base pointer for given queue */ -static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) -{ - if (chnl < 16) - return FH_MEM_CBBC_0_15_LOWER_BOUND + 4 * chnl; - if (chnl < 20) - return FH_MEM_CBBC_16_19_LOWER_BOUND + 4 * (chnl - 16); - WARN_ON_ONCE(chnl >= 32); - return FH_MEM_CBBC_20_31_LOWER_BOUND + 4 * (chnl - 20); -} - - -/** - * Rx SRAM Control and Status Registers (RSCSR) - * - * These registers provide handshake between driver and device for the Rx queue - * (this queue handles *all* command responses, notifications, Rx data, etc. - * sent from uCode to host driver). Unlike Tx, there is only one Rx - * queue, and only one Rx DMA/FIFO channel. Also unlike Tx, which can - * concatenate up to 20 DRAM buffers to form a Tx frame, each Receive Buffer - * Descriptor (RBD) points to only one Rx Buffer (RB); there is a 1:1 - * mapping between RBDs and RBs. - * - * Driver must allocate host DRAM memory for the following, and set the - * physical address of each into device registers: - * - * 1) Receive Buffer Descriptor (RBD) circular buffer (CB), typically with 256 - * entries (although any power of 2, up to 4096, is selectable by driver). - * Each entry (1 dword) points to a receive buffer (RB) of consistent size - * (typically 4K, although 8K or 16K are also selectable by driver). - * Driver sets up RB size and number of RBDs in the CB via Rx config - * register FH_MEM_RCSR_CHNL0_CONFIG_REG. - * - * Bit fields within one RBD: - * 27-0: Receive Buffer physical address bits [35:8], 256-byte aligned - * - * Driver sets physical address [35:8] of base of RBD circular buffer - * into FH_RSCSR_CHNL0_RBDCB_BASE_REG [27:0]. - * - * 2) Rx status buffer, 8 bytes, in which uCode indicates which Rx Buffers - * (RBs) have been filled, via a "write pointer", actually the index of - * the RB's corresponding RBD within the circular buffer. Driver sets - * physical address [35:4] into FH_RSCSR_CHNL0_STTS_WPTR_REG [31:0]. - * - * Bit fields in lower dword of Rx status buffer (upper dword not used - * by driver: - * 31-12: Not used by driver - * 11- 0: Index of last filled Rx buffer descriptor - * (device writes, driver reads this value) - * - * As the driver prepares Receive Buffers (RBs) for device to fill, driver must - * enter pointers to these RBs into contiguous RBD circular buffer entries, - * and update the device's "write" index register, - * FH_RSCSR_CHNL0_RBDCB_WPTR_REG. - * - * This "write" index corresponds to the *next* RBD that the driver will make - * available, i.e. one RBD past the tail of the ready-to-fill RBDs within - * the circular buffer. This value should initially be 0 (before preparing any - * RBs), should be 8 after preparing the first 8 RBs (for example), and must - * wrap back to 0 at the end of the circular buffer (but don't wrap before - * "read" index has advanced past 1! See below). - * NOTE: DEVICE EXPECTS THE WRITE INDEX TO BE INCREMENTED IN MULTIPLES OF 8. - * - * As the device fills RBs (referenced from contiguous RBDs within the circular - * buffer), it updates the Rx status buffer in host DRAM, 2) described above, - * to tell the driver the index of the latest filled RBD. The driver must - * read this "read" index from DRAM after receiving an Rx interrupt from device - * - * The driver must also internally keep track of a third index, which is the - * next RBD to process. When receiving an Rx interrupt, driver should process - * all filled but unprocessed RBs up to, but not including, the RB - * corresponding to the "read" index. For example, if "read" index becomes "1", - * driver may process the RB pointed to by RBD 0. Depending on volume of - * traffic, there may be many RBs to process. - * - * If read index == write index, device thinks there is no room to put new data. - * Due to this, the maximum number of filled RBs is 255, instead of 256. To - * be safe, make sure that there is a gap of at least 2 RBDs between "write" - * and "read" indexes; that is, make sure that there are no more than 254 - * buffers waiting to be filled. - */ -#define FH_MEM_RSCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBC0) -#define FH_MEM_RSCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) -#define FH_MEM_RSCSR_CHNL0 (FH_MEM_RSCSR_LOWER_BOUND) - -/** - * Physical base address of 8-byte Rx Status buffer. - * Bit fields: - * 31-0: Rx status buffer physical base address [35:4], must 16-byte aligned. - */ -#define FH_RSCSR_CHNL0_STTS_WPTR_REG (FH_MEM_RSCSR_CHNL0) - -/** - * Physical base address of Rx Buffer Descriptor Circular Buffer. - * Bit fields: - * 27-0: RBD CD physical base address [35:8], must be 256-byte aligned. - */ -#define FH_RSCSR_CHNL0_RBDCB_BASE_REG (FH_MEM_RSCSR_CHNL0 + 0x004) - -/** - * Rx write pointer (index, really!). - * Bit fields: - * 11-0: Index of driver's most recent prepared-to-be-filled RBD, + 1. - * NOTE: For 256-entry circular buffer, use only bits [7:0]. - */ -#define FH_RSCSR_CHNL0_RBDCB_WPTR_REG (FH_MEM_RSCSR_CHNL0 + 0x008) -#define FH_RSCSR_CHNL0_WPTR (FH_RSCSR_CHNL0_RBDCB_WPTR_REG) - -#define FW_RSCSR_CHNL0_RXDCB_RDPTR_REG (FH_MEM_RSCSR_CHNL0 + 0x00c) -#define FH_RSCSR_CHNL0_RDPTR FW_RSCSR_CHNL0_RXDCB_RDPTR_REG - -/** - * Rx Config/Status Registers (RCSR) - * Rx Config Reg for channel 0 (only channel used) - * - * Driver must initialize FH_MEM_RCSR_CHNL0_CONFIG_REG as follows for - * normal operation (see bit fields). - * - * Clearing FH_MEM_RCSR_CHNL0_CONFIG_REG to 0 turns off Rx DMA. - * Driver should poll FH_MEM_RSSR_RX_STATUS_REG for - * FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (bit 24) before continuing. - * - * Bit fields: - * 31-30: Rx DMA channel enable: '00' off/pause, '01' pause at end of frame, - * '10' operate normally - * 29-24: reserved - * 23-20: # RBDs in circular buffer = 2^value; use "8" for 256 RBDs (normal), - * min "5" for 32 RBDs, max "12" for 4096 RBDs. - * 19-18: reserved - * 17-16: size of each receive buffer; '00' 4K (normal), '01' 8K, - * '10' 12K, '11' 16K. - * 15-14: reserved - * 13-12: IRQ destination; '00' none, '01' host driver (normal operation) - * 11- 4: timeout for closing Rx buffer and interrupting host (units 32 usec) - * typical value 0x10 (about 1/2 msec) - * 3- 0: reserved - */ -#define FH_MEM_RCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) -#define FH_MEM_RCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xCC0) -#define FH_MEM_RCSR_CHNL0 (FH_MEM_RCSR_LOWER_BOUND) - -#define FH_MEM_RCSR_CHNL0_CONFIG_REG (FH_MEM_RCSR_CHNL0) -#define FH_MEM_RCSR_CHNL0_RBDCB_WPTR (FH_MEM_RCSR_CHNL0 + 0x8) -#define FH_MEM_RCSR_CHNL0_FLUSH_RB_REQ (FH_MEM_RCSR_CHNL0 + 0x10) - -#define FH_RCSR_CHNL0_RX_CONFIG_RB_TIMEOUT_MSK (0x00000FF0) /* bits 4-11 */ -#define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_MSK (0x00001000) /* bits 12 */ -#define FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MSK (0x00008000) /* bit 15 */ -#define FH_RCSR_CHNL0_RX_CONFIG_RB_SIZE_MSK (0x00030000) /* bits 16-17 */ -#define FH_RCSR_CHNL0_RX_CONFIG_RBDBC_SIZE_MSK (0x00F00000) /* bits 20-23 */ -#define FH_RCSR_CHNL0_RX_CONFIG_DMA_CHNL_EN_MSK (0xC0000000) /* bits 30-31*/ - -#define FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS (20) -#define FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS (4) -#define RX_RB_TIMEOUT (0x11) - -#define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_VAL (0x00000000) -#define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_EOF_VAL (0x40000000) -#define FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL (0x80000000) - -#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K (0x00000000) -#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K (0x00010000) -#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_12K (0x00020000) -#define FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_16K (0x00030000) - -#define FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY (0x00000004) -#define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000) -#define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000) - -/** - * Rx Shared Status Registers (RSSR) - * - * After stopping Rx DMA channel (writing 0 to - * FH_MEM_RCSR_CHNL0_CONFIG_REG), driver must poll - * FH_MEM_RSSR_RX_STATUS_REG until Rx channel is idle. - * - * Bit fields: - * 24: 1 = Channel 0 is idle - * - * FH_MEM_RSSR_SHARED_CTRL_REG and FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV - * contain default values that should not be altered by the driver. - */ -#define FH_MEM_RSSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xC40) -#define FH_MEM_RSSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xD00) - -#define FH_MEM_RSSR_SHARED_CTRL_REG (FH_MEM_RSSR_LOWER_BOUND) -#define FH_MEM_RSSR_RX_STATUS_REG (FH_MEM_RSSR_LOWER_BOUND + 0x004) -#define FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV\ - (FH_MEM_RSSR_LOWER_BOUND + 0x008) - -#define FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) - -#define FH_MEM_TFDIB_REG1_ADDR_BITSHIFT 28 - -/* TFDB Area - TFDs buffer table */ -#define FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK (0xFFFFFFFF) -#define FH_TFDIB_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x900) -#define FH_TFDIB_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x958) -#define FH_TFDIB_CTRL0_REG(_chnl) (FH_TFDIB_LOWER_BOUND + 0x8 * (_chnl)) -#define FH_TFDIB_CTRL1_REG(_chnl) (FH_TFDIB_LOWER_BOUND + 0x8 * (_chnl) + 0x4) - -/** - * Transmit DMA Channel Control/Status Registers (TCSR) - * - * Device has one configuration register for each of 8 Tx DMA/FIFO channels - * supported in hardware (don't confuse these with the 16 Tx queues in DRAM, - * which feed the DMA/FIFO channels); config regs are separated by 0x20 bytes. - * - * To use a Tx DMA channel, driver must initialize its - * FH_TCSR_CHNL_TX_CONFIG_REG(chnl) with: - * - * FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | - * FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL - * - * All other bits should be 0. - * - * Bit fields: - * 31-30: Tx DMA channel enable: '00' off/pause, '01' pause at end of frame, - * '10' operate normally - * 29- 4: Reserved, set to "0" - * 3: Enable internal DMA requests (1, normal operation), disable (0) - * 2- 0: Reserved, set to "0" - */ -#define FH_TCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xD00) -#define FH_TCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xE60) - -/* Find Control/Status reg for given Tx DMA/FIFO channel */ -#define FH_TCSR_CHNL_NUM (8) - -/* TCSR: tx_config register values */ -#define FH_TCSR_CHNL_TX_CONFIG_REG(_chnl) \ - (FH_TCSR_LOWER_BOUND + 0x20 * (_chnl)) -#define FH_TCSR_CHNL_TX_CREDIT_REG(_chnl) \ - (FH_TCSR_LOWER_BOUND + 0x20 * (_chnl) + 0x4) -#define FH_TCSR_CHNL_TX_BUF_STS_REG(_chnl) \ - (FH_TCSR_LOWER_BOUND + 0x20 * (_chnl) + 0x8) - -#define FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000) -#define FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRV (0x00000001) - -#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE (0x00000000) -#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE (0x00000008) - -#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_NOINT (0x00000000) -#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD (0x00100000) -#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) - -#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000) -#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_ENDTFD (0x00400000) -#define FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_IFTFD (0x00800000) - -#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) -#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE_EOF (0x40000000) -#define FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000) - -#define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_EMPTY (0x00000000) -#define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_WAIT (0x00002000) -#define FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00000003) - -#define FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM (20) -#define FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX (12) - -/** - * Tx Shared Status Registers (TSSR) - * - * After stopping Tx DMA channel (writing 0 to - * FH_TCSR_CHNL_TX_CONFIG_REG(chnl)), driver must poll - * FH_TSSR_TX_STATUS_REG until selected Tx channel is idle - * (channel's buffers empty | no pending requests). - * - * Bit fields: - * 31-24: 1 = Channel buffers empty (channel 7:0) - * 23-16: 1 = No pending requests (channel 7:0) - */ -#define FH_TSSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xEA0) -#define FH_TSSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xEC0) - -#define FH_TSSR_TX_STATUS_REG (FH_TSSR_LOWER_BOUND + 0x010) - -/** - * Bit fields for TSSR(Tx Shared Status & Control) error status register: - * 31: Indicates an address error when accessed to internal memory - * uCode/driver must write "1" in order to clear this flag - * 30: Indicates that Host did not send the expected number of dwords to FH - * uCode/driver must write "1" in order to clear this flag - * 16-9:Each status bit is for one channel. Indicates that an (Error) ActDMA - * command was received from the scheduler while the TRB was already full - * with previous command - * uCode/driver must write "1" in order to clear this flag - * 7-0: Each status bit indicates a channel's TxCredit error. When an error - * bit is set, it indicates that the FH has received a full indication - * from the RTC TxFIFO and the current value of the TxCredit counter was - * not equal to zero. This mean that the credit mechanism was not - * synchronized to the TxFIFO status - * uCode/driver must write "1" in order to clear this flag - */ -#define FH_TSSR_TX_ERROR_REG (FH_TSSR_LOWER_BOUND + 0x018) -#define FH_TSSR_TX_MSG_CONFIG_REG (FH_TSSR_LOWER_BOUND + 0x008) - -#define FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_chnl) ((1 << (_chnl)) << 16) - -/* Tx service channels */ -#define FH_SRVC_CHNL (9) -#define FH_SRVC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9C8) -#define FH_SRVC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) -#define FH_SRVC_CHNL_SRAM_ADDR_REG(_chnl) \ - (FH_SRVC_LOWER_BOUND + ((_chnl) - 9) * 0x4) - -#define FH_TX_CHICKEN_BITS_REG (FH_MEM_LOWER_BOUND + 0xE98) -#define FH_TX_TRB_REG(_chan) (FH_MEM_LOWER_BOUND + 0x958 + (_chan) * 4) - -/* Instruct FH to increment the retry count of a packet when - * it is brought from the memory to TX-FIFO - */ -#define FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN (0x00000002) - -#define RX_QUEUE_SIZE 256 -#define RX_QUEUE_MASK 255 -#define RX_QUEUE_SIZE_LOG 8 - -/* - * RX related structures and functions - */ -#define RX_FREE_BUFFERS 64 -#define RX_LOW_WATERMARK 8 - -/** - * struct iwl_rb_status - reseve buffer status - * host memory mapped FH registers - * @closed_rb_num [0:11] - Indicates the index of the RB which was closed - * @closed_fr_num [0:11] - Indicates the index of the RX Frame which was closed - * @finished_rb_num [0:11] - Indicates the index of the current RB - * in which the last frame was written to - * @finished_fr_num [0:11] - Indicates the index of the RX Frame - * which was transferred - */ -struct iwl_rb_status { - __le16 closed_rb_num; - __le16 closed_fr_num; - __le16 finished_rb_num; - __le16 finished_fr_nam; - __le32 __unused; -} __packed; - - -#define TFD_QUEUE_SIZE_MAX (256) -#define TFD_QUEUE_SIZE_BC_DUP (64) -#define TFD_QUEUE_BC_SIZE (TFD_QUEUE_SIZE_MAX + TFD_QUEUE_SIZE_BC_DUP) -#define IWL_TX_DMA_MASK DMA_BIT_MASK(36) -#define IWL_NUM_OF_TBS 20 - -static inline u8 iwl_get_dma_hi_addr(dma_addr_t addr) -{ - return (sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0) & 0xF; -} -/** - * struct iwl_tfd_tb transmit buffer descriptor within transmit frame descriptor - * - * This structure contains dma address and length of transmission address - * - * @lo: low [31:0] portion of the dma address of TX buffer - * every even is unaligned on 16 bit boundary - * @hi_n_len 0-3 [35:32] portion of dma - * 4-15 length of the tx buffer - */ -struct iwl_tfd_tb { - __le32 lo; - __le16 hi_n_len; -} __packed; - -/** - * struct iwl_tfd - * - * Transmit Frame Descriptor (TFD) - * - * @ __reserved1[3] reserved - * @ num_tbs 0-4 number of active tbs - * 5 reserved - * 6-7 padding (not used) - * @ tbs[20] transmit frame buffer descriptors - * @ __pad padding - * - * Each Tx queue uses a circular buffer of 256 TFDs stored in host DRAM. - * Both driver and device share these circular buffers, each of which must be - * contiguous 256 TFDs x 128 bytes-per-TFD = 32 KBytes - * - * Driver must indicate the physical address of the base of each - * circular buffer via the FH_MEM_CBBC_QUEUE registers. - * - * Each TFD contains pointer/size information for up to 20 data buffers - * in host DRAM. These buffers collectively contain the (one) frame described - * by the TFD. Each buffer must be a single contiguous block of memory within - * itself, but buffers may be scattered in host DRAM. Each buffer has max size - * of (4K - 4). The concatenates all of a TFD's buffers into a single - * Tx frame, up to 8 KBytes in size. - * - * A maximum of 255 (not 256!) TFDs may be on a queue waiting for Tx. - */ -struct iwl_tfd { - u8 __reserved1[3]; - u8 num_tbs; - struct iwl_tfd_tb tbs[IWL_NUM_OF_TBS]; - __le32 __pad; -} __packed; - -/* Keep Warm Size */ -#define IWL_KW_SIZE 0x1000 /* 4k */ - -/* Fixed (non-configurable) rx data from phy */ - -/** - * struct iwlagn_schedq_bc_tbl scheduler byte count table - * base physical address provided by SCD_DRAM_BASE_ADDR - * @tfd_offset 0-12 - tx command byte count - * 12-16 - station index - */ -struct iwlagn_scd_bc_tbl { - __le16 tfd_offset[TFD_QUEUE_BC_SIZE]; -} __packed; - -#endif /* !__iwl_fh_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-fw-file.h b/drivers/net/wireless/iwlwifi/iwl-fw-file.h deleted file mode 100644 index 8b6c6fd95ed0..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-fw-file.h +++ /dev/null @@ -1,156 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef __iwl_fw_file_h__ -#define __iwl_fw_file_h__ - -#include - -/* v1/v2 uCode file layout */ -struct iwl_ucode_header { - __le32 ver; /* major/minor/API/serial */ - union { - struct { - __le32 inst_size; /* bytes of runtime code */ - __le32 data_size; /* bytes of runtime data */ - __le32 init_size; /* bytes of init code */ - __le32 init_data_size; /* bytes of init data */ - __le32 boot_size; /* bytes of bootstrap code */ - u8 data[0]; /* in same order as sizes */ - } v1; - struct { - __le32 build; /* build number */ - __le32 inst_size; /* bytes of runtime code */ - __le32 data_size; /* bytes of runtime data */ - __le32 init_size; /* bytes of init code */ - __le32 init_data_size; /* bytes of init data */ - __le32 boot_size; /* bytes of bootstrap code */ - u8 data[0]; /* in same order as sizes */ - } v2; - } u; -}; - -/* - * new TLV uCode file layout - * - * The new TLV file format contains TLVs, that each specify - * some piece of data. - */ - -enum iwl_ucode_tlv_type { - IWL_UCODE_TLV_INVALID = 0, /* unused */ - IWL_UCODE_TLV_INST = 1, - IWL_UCODE_TLV_DATA = 2, - IWL_UCODE_TLV_INIT = 3, - IWL_UCODE_TLV_INIT_DATA = 4, - IWL_UCODE_TLV_BOOT = 5, - IWL_UCODE_TLV_PROBE_MAX_LEN = 6, /* a u32 value */ - IWL_UCODE_TLV_PAN = 7, - IWL_UCODE_TLV_RUNT_EVTLOG_PTR = 8, - IWL_UCODE_TLV_RUNT_EVTLOG_SIZE = 9, - IWL_UCODE_TLV_RUNT_ERRLOG_PTR = 10, - IWL_UCODE_TLV_INIT_EVTLOG_PTR = 11, - IWL_UCODE_TLV_INIT_EVTLOG_SIZE = 12, - IWL_UCODE_TLV_INIT_ERRLOG_PTR = 13, - IWL_UCODE_TLV_ENHANCE_SENS_TBL = 14, - IWL_UCODE_TLV_PHY_CALIBRATION_SIZE = 15, - IWL_UCODE_TLV_WOWLAN_INST = 16, - IWL_UCODE_TLV_WOWLAN_DATA = 17, - IWL_UCODE_TLV_FLAGS = 18, - IWL_UCODE_TLV_SEC_RT = 19, - IWL_UCODE_TLV_SEC_INIT = 20, - IWL_UCODE_TLV_SEC_WOWLAN = 21, - IWL_UCODE_TLV_DEF_CALIB = 22, - IWL_UCODE_TLV_PHY_SKU = 23, -}; - -struct iwl_ucode_tlv { - __le32 type; /* see above */ - __le32 length; /* not including type/length fields */ - u8 data[0]; -}; - -#define IWL_TLV_UCODE_MAGIC 0x0a4c5749 - -struct iwl_tlv_ucode_header { - /* - * The TLV style ucode header is distinguished from - * the v1/v2 style header by first four bytes being - * zero, as such is an invalid combination of - * major/minor/API/serial versions. - */ - __le32 zero; - __le32 magic; - u8 human_readable[64]; - __le32 ver; /* major/minor/API/serial */ - __le32 build; - __le64 ignore; - /* - * The data contained herein has a TLV layout, - * see above for the TLV header and types. - * Note that each TLV is padded to a length - * that is a multiple of 4 for alignment. - */ - u8 data[0]; -}; - -#endif /* __iwl_fw_file_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-fw.h b/drivers/net/wireless/iwlwifi/iwl-fw.h deleted file mode 100644 index c4c446d41eb0..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-fw.h +++ /dev/null @@ -1,218 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef __iwl_fw_h__ -#define __iwl_fw_h__ -#include -#include - -/** - * enum iwl_ucode_tlv_flag - ucode API flags - * @IWL_UCODE_TLV_FLAGS_PAN: This is PAN capable microcode; this previously - * was a separate TLV but moved here to save space. - * @IWL_UCODE_TLV_FLAGS_NEWSCAN: new uCode scan behaviour on hidden SSID, - * treats good CRC threshold as a boolean - * @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w). - * @IWL_UCODE_TLV_FLAGS_P2P: This uCode image supports P2P. - * @IWL_UCODE_TLV_FLAGS_DW_BC_TABLE: The SCD byte count table is in DWORDS - */ -enum iwl_ucode_tlv_flag { - IWL_UCODE_TLV_FLAGS_PAN = BIT(0), - IWL_UCODE_TLV_FLAGS_NEWSCAN = BIT(1), - IWL_UCODE_TLV_FLAGS_MFP = BIT(2), - IWL_UCODE_TLV_FLAGS_P2P = BIT(3), - IWL_UCODE_TLV_FLAGS_DW_BC_TABLE = BIT(4), -}; - -/* The default calibrate table size if not specified by firmware file */ -#define IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18 -#define IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE 19 -#define IWL_MAX_PHY_CALIBRATE_TBL_SIZE 253 - -/** - * enum iwl_ucode_type - * - * The type of ucode. - * - * @IWL_UCODE_REGULAR: Normal runtime ucode - * @IWL_UCODE_INIT: Initial ucode - * @IWL_UCODE_WOWLAN: Wake on Wireless enabled ucode - */ -enum iwl_ucode_type { - IWL_UCODE_REGULAR, - IWL_UCODE_INIT, - IWL_UCODE_WOWLAN, - IWL_UCODE_TYPE_MAX, -}; - -/* - * enumeration of ucode section. - * This enumeration is used for legacy tlv style (before 16.0 uCode). - */ -enum iwl_ucode_sec { - IWL_UCODE_SECTION_INST, - IWL_UCODE_SECTION_DATA, -}; -/* - * For 16.0 uCode and above, there is no differentiation between sections, - * just an offset to the HW address. - */ -#define IWL_UCODE_SECTION_MAX 4 - -struct iwl_ucode_capabilities { - u32 max_probe_length; - u32 standard_phy_calibration_size; - u32 flags; -}; - -/* one for each uCode image (inst/data, init/runtime/wowlan) */ -struct fw_desc { - const void *data; /* vmalloc'ed data */ - u32 len; /* size in bytes */ - u32 offset; /* offset in the device */ -}; - -struct fw_img { - struct fw_desc sec[IWL_UCODE_SECTION_MAX]; -}; - -/* uCode version contains 4 values: Major/Minor/API/Serial */ -#define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24) -#define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16) -#define IWL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8) -#define IWL_UCODE_SERIAL(ver) ((ver) & 0x000000FF) - -/* - * Calibration control struct. - * Sent as part of the phy configuration command. - * @flow_trigger: bitmap for which calibrations to perform according to - * flow triggers. - * @event_trigger: bitmap for which calibrations to perform according to - * event triggers. - */ -struct iwl_tlv_calib_ctrl { - __le32 flow_trigger; - __le32 event_trigger; -} __packed; - -enum iwl_fw_phy_cfg { - FW_PHY_CFG_RADIO_TYPE_POS = 0, - FW_PHY_CFG_RADIO_TYPE = 0x3 << FW_PHY_CFG_RADIO_TYPE_POS, - FW_PHY_CFG_RADIO_STEP_POS = 2, - FW_PHY_CFG_RADIO_STEP = 0x3 << FW_PHY_CFG_RADIO_STEP_POS, - FW_PHY_CFG_RADIO_DASH_POS = 4, - FW_PHY_CFG_RADIO_DASH = 0x3 << FW_PHY_CFG_RADIO_DASH_POS, - FW_PHY_CFG_TX_CHAIN_POS = 16, - FW_PHY_CFG_TX_CHAIN = 0xf << FW_PHY_CFG_TX_CHAIN_POS, - FW_PHY_CFG_RX_CHAIN_POS = 20, - FW_PHY_CFG_RX_CHAIN = 0xf << FW_PHY_CFG_RX_CHAIN_POS, -}; - -/** - * struct iwl_fw - variables associated with the firmware - * - * @ucode_ver: ucode version from the ucode file - * @fw_version: firmware version string - * @img: ucode image like ucode_rt, ucode_init, ucode_wowlan. - * @ucode_capa: capabilities parsed from the ucode file. - * @enhance_sensitivity_table: device can do enhanced sensitivity. - * @init_evtlog_ptr: event log offset for init ucode. - * @init_evtlog_size: event log size for init ucode. - * @init_errlog_ptr: error log offfset for init ucode. - * @inst_evtlog_ptr: event log offset for runtime ucode. - * @inst_evtlog_size: event log size for runtime ucode. - * @inst_errlog_ptr: error log offfset for runtime ucode. - * @mvm_fw: indicates this is MVM firmware - */ -struct iwl_fw { - u32 ucode_ver; - - char fw_version[ETHTOOL_FWVERS_LEN]; - - /* ucode images */ - struct fw_img img[IWL_UCODE_TYPE_MAX]; - - struct iwl_ucode_capabilities ucode_capa; - bool enhance_sensitivity_table; - - u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr; - u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr; - - struct iwl_tlv_calib_ctrl default_calib[IWL_UCODE_TYPE_MAX]; - u32 phy_config; - - bool mvm_fw; -}; - -static inline u8 iwl_fw_valid_tx_ant(const struct iwl_fw *fw) -{ - return (fw->phy_config & FW_PHY_CFG_TX_CHAIN) >> - FW_PHY_CFG_TX_CHAIN_POS; -} - -static inline u8 iwl_fw_valid_rx_ant(const struct iwl_fw *fw) -{ - return (fw->phy_config & FW_PHY_CFG_RX_CHAIN) >> - FW_PHY_CFG_RX_CHAIN_POS; -} - -#endif /* __iwl_fw_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c deleted file mode 100644 index 305c81f2c2b4..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-io.c +++ /dev/null @@ -1,168 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ -#include -#include -#include - -#include "iwl-drv.h" -#include "iwl-io.h" -#include "iwl-csr.h" -#include "iwl-debug.h" - -#define IWL_POLL_INTERVAL 10 /* microseconds */ - -int iwl_poll_bit(struct iwl_trans *trans, u32 addr, - u32 bits, u32 mask, int timeout) -{ - int t = 0; - - do { - if ((iwl_read32(trans, addr) & mask) == (bits & mask)) - return t; - udelay(IWL_POLL_INTERVAL); - t += IWL_POLL_INTERVAL; - } while (t < timeout); - - return -ETIMEDOUT; -} -IWL_EXPORT_SYMBOL(iwl_poll_bit); - -u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg) -{ - u32 value = 0x5a5a5a5a; - unsigned long flags; - if (iwl_trans_grab_nic_access(trans, false, &flags)) { - value = iwl_read32(trans, reg); - iwl_trans_release_nic_access(trans, &flags); - } - - return value; -} -IWL_EXPORT_SYMBOL(iwl_read_direct32); - -void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value) -{ - unsigned long flags; - - if (iwl_trans_grab_nic_access(trans, false, &flags)) { - iwl_write32(trans, reg, value); - iwl_trans_release_nic_access(trans, &flags); - } -} -IWL_EXPORT_SYMBOL(iwl_write_direct32); - -int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask, - int timeout) -{ - int t = 0; - - do { - if ((iwl_read_direct32(trans, addr) & mask) == mask) - return t; - udelay(IWL_POLL_INTERVAL); - t += IWL_POLL_INTERVAL; - } while (t < timeout); - - return -ETIMEDOUT; -} -IWL_EXPORT_SYMBOL(iwl_poll_direct_bit); - -static inline u32 __iwl_read_prph(struct iwl_trans *trans, u32 ofs) -{ - u32 val = iwl_trans_read_prph(trans, ofs); - trace_iwlwifi_dev_ioread_prph32(trans->dev, ofs, val); - return val; -} - -static inline void __iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val) -{ - trace_iwlwifi_dev_iowrite_prph32(trans->dev, ofs, val); - iwl_trans_write_prph(trans, ofs, val); -} - -u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs) -{ - unsigned long flags; - u32 val = 0x5a5a5a5a; - - if (iwl_trans_grab_nic_access(trans, false, &flags)) { - val = __iwl_read_prph(trans, ofs); - iwl_trans_release_nic_access(trans, &flags); - } - return val; -} -IWL_EXPORT_SYMBOL(iwl_read_prph); - -void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val) -{ - unsigned long flags; - - if (iwl_trans_grab_nic_access(trans, false, &flags)) { - __iwl_write_prph(trans, ofs, val); - iwl_trans_release_nic_access(trans, &flags); - } -} -IWL_EXPORT_SYMBOL(iwl_write_prph); - -void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask) -{ - unsigned long flags; - - if (iwl_trans_grab_nic_access(trans, false, &flags)) { - __iwl_write_prph(trans, ofs, - __iwl_read_prph(trans, ofs) | mask); - iwl_trans_release_nic_access(trans, &flags); - } -} -IWL_EXPORT_SYMBOL(iwl_set_bits_prph); - -void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, - u32 bits, u32 mask) -{ - unsigned long flags; - - if (iwl_trans_grab_nic_access(trans, false, &flags)) { - __iwl_write_prph(trans, ofs, - (__iwl_read_prph(trans, ofs) & mask) | bits); - iwl_trans_release_nic_access(trans, &flags); - } -} -IWL_EXPORT_SYMBOL(iwl_set_bits_mask_prph); - -void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask) -{ - unsigned long flags; - u32 val; - - if (iwl_trans_grab_nic_access(trans, false, &flags)) { - val = __iwl_read_prph(trans, ofs); - __iwl_write_prph(trans, ofs, (val & ~mask)); - iwl_trans_release_nic_access(trans, &flags); - } -} -IWL_EXPORT_SYMBOL(iwl_clear_bits_prph); diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h deleted file mode 100644 index fd9f5b97fff3..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-io.h +++ /dev/null @@ -1,80 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#ifndef __iwl_io_h__ -#define __iwl_io_h__ - -#include "iwl-devtrace.h" -#include "iwl-trans.h" - -static inline void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val) -{ - trace_iwlwifi_dev_iowrite8(trans->dev, ofs, val); - iwl_trans_write8(trans, ofs, val); -} - -static inline void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val) -{ - trace_iwlwifi_dev_iowrite32(trans->dev, ofs, val); - iwl_trans_write32(trans, ofs, val); -} - -static inline u32 iwl_read32(struct iwl_trans *trans, u32 ofs) -{ - u32 val = iwl_trans_read32(trans, ofs); - trace_iwlwifi_dev_ioread32(trans->dev, ofs, val); - return val; -} - -static inline void iwl_set_bit(struct iwl_trans *trans, u32 reg, u32 mask) -{ - iwl_trans_set_bits_mask(trans, reg, mask, mask); -} - -static inline void iwl_clear_bit(struct iwl_trans *trans, u32 reg, u32 mask) -{ - iwl_trans_set_bits_mask(trans, reg, mask, 0); -} - -int iwl_poll_bit(struct iwl_trans *trans, u32 addr, - u32 bits, u32 mask, int timeout); -int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask, - int timeout); - -u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg); -void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value); - - -u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs); -void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val); -void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); -void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, - u32 bits, u32 mask); -void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); - -#endif diff --git a/drivers/net/wireless/iwlwifi/iwl-modparams.h b/drivers/net/wireless/iwlwifi/iwl-modparams.h deleted file mode 100644 index d6f6c37c09fd..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-modparams.h +++ /dev/null @@ -1,124 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2007 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#ifndef __iwl_modparams_h__ -#define __iwl_modparams_h__ - -#include -#include -#include -#include - -extern struct iwl_mod_params iwlwifi_mod_params; - -enum iwl_power_level { - IWL_POWER_INDEX_1, - IWL_POWER_INDEX_2, - IWL_POWER_INDEX_3, - IWL_POWER_INDEX_4, - IWL_POWER_INDEX_5, - IWL_POWER_NUM -}; - -#define IWL_DISABLE_HT_ALL BIT(0) -#define IWL_DISABLE_HT_TXAGG BIT(1) -#define IWL_DISABLE_HT_RXAGG BIT(2) - -/** - * struct iwl_mod_params - * - * Holds the module parameters - * - * @sw_crypto: using hardware encryption, default = 0 - * @disable_11n: disable 11n capabilities, default = 0, - * use IWL_DISABLE_HT_* constants - * @amsdu_size_8K: enable 8K amsdu size, default = 0 - * @restart_fw: restart firmware, default = 1 - * @plcp_check: enable plcp health check, default = true - * @wd_disable: enable stuck queue check, default = 0 - * @bt_coex_active: enable bt coex, default = true - * @led_mode: system default, default = 0 - * @power_save: disable power save, default = false - * @power_level: power level, default = 1 - * @debug_level: levels are IWL_DL_* - * @ant_coupling: antenna coupling in dB, default = 0 - * @bt_ch_announce: BT channel inhibition, default = enable - * @auto_agg: enable agg. without check, default = true - */ -struct iwl_mod_params { - int sw_crypto; - unsigned int disable_11n; - int amsdu_size_8K; - bool restart_fw; - bool plcp_check; - int wd_disable; - bool bt_coex_active; - int led_mode; - bool power_save; - int power_level; - u32 debug_level; - int ant_coupling; - bool bt_ch_announce; - bool auto_agg; -}; - -#endif /* #__iwl_modparams_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-notif-wait.c b/drivers/net/wireless/iwlwifi/iwl-notif-wait.c deleted file mode 100644 index 940b8a9d5285..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-notif-wait.c +++ /dev/null @@ -1,191 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2007 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#include -#include - -#include "iwl-drv.h" -#include "iwl-notif-wait.h" - - -void iwl_notification_wait_init(struct iwl_notif_wait_data *notif_wait) -{ - spin_lock_init(¬if_wait->notif_wait_lock); - INIT_LIST_HEAD(¬if_wait->notif_waits); - init_waitqueue_head(¬if_wait->notif_waitq); -} -IWL_EXPORT_SYMBOL(iwl_notification_wait_init); - -void iwl_notification_wait_notify(struct iwl_notif_wait_data *notif_wait, - struct iwl_rx_packet *pkt) -{ - bool triggered = false; - - if (!list_empty(¬if_wait->notif_waits)) { - struct iwl_notification_wait *w; - - spin_lock(¬if_wait->notif_wait_lock); - list_for_each_entry(w, ¬if_wait->notif_waits, list) { - int i; - bool found = false; - - /* - * If it already finished (triggered) or has been - * aborted then don't evaluate it again to avoid races, - * Otherwise the function could be called again even - * though it returned true before - */ - if (w->triggered || w->aborted) - continue; - - for (i = 0; i < w->n_cmds; i++) { - if (w->cmds[i] == pkt->hdr.cmd) { - found = true; - break; - } - } - if (!found) - continue; - - if (!w->fn || w->fn(notif_wait, pkt, w->fn_data)) { - w->triggered = true; - triggered = true; - } - } - spin_unlock(¬if_wait->notif_wait_lock); - - } - - if (triggered) - wake_up_all(¬if_wait->notif_waitq); -} -IWL_EXPORT_SYMBOL(iwl_notification_wait_notify); - -void iwl_abort_notification_waits(struct iwl_notif_wait_data *notif_wait) -{ - struct iwl_notification_wait *wait_entry; - - spin_lock(¬if_wait->notif_wait_lock); - list_for_each_entry(wait_entry, ¬if_wait->notif_waits, list) - wait_entry->aborted = true; - spin_unlock(¬if_wait->notif_wait_lock); - - wake_up_all(¬if_wait->notif_waitq); -} -IWL_EXPORT_SYMBOL(iwl_abort_notification_waits); - -void -iwl_init_notification_wait(struct iwl_notif_wait_data *notif_wait, - struct iwl_notification_wait *wait_entry, - const u8 *cmds, int n_cmds, - bool (*fn)(struct iwl_notif_wait_data *notif_wait, - struct iwl_rx_packet *pkt, void *data), - void *fn_data) -{ - if (WARN_ON(n_cmds > MAX_NOTIF_CMDS)) - n_cmds = MAX_NOTIF_CMDS; - - wait_entry->fn = fn; - wait_entry->fn_data = fn_data; - wait_entry->n_cmds = n_cmds; - memcpy(wait_entry->cmds, cmds, n_cmds); - wait_entry->triggered = false; - wait_entry->aborted = false; - - spin_lock_bh(¬if_wait->notif_wait_lock); - list_add(&wait_entry->list, ¬if_wait->notif_waits); - spin_unlock_bh(¬if_wait->notif_wait_lock); -} -IWL_EXPORT_SYMBOL(iwl_init_notification_wait); - -int iwl_wait_notification(struct iwl_notif_wait_data *notif_wait, - struct iwl_notification_wait *wait_entry, - unsigned long timeout) -{ - int ret; - - ret = wait_event_timeout(notif_wait->notif_waitq, - wait_entry->triggered || wait_entry->aborted, - timeout); - - spin_lock_bh(¬if_wait->notif_wait_lock); - list_del(&wait_entry->list); - spin_unlock_bh(¬if_wait->notif_wait_lock); - - if (wait_entry->aborted) - return -EIO; - - /* return value is always >= 0 */ - if (ret <= 0) - return -ETIMEDOUT; - return 0; -} -IWL_EXPORT_SYMBOL(iwl_wait_notification); - -void iwl_remove_notification(struct iwl_notif_wait_data *notif_wait, - struct iwl_notification_wait *wait_entry) -{ - spin_lock_bh(¬if_wait->notif_wait_lock); - list_del(&wait_entry->list); - spin_unlock_bh(¬if_wait->notif_wait_lock); -} -IWL_EXPORT_SYMBOL(iwl_remove_notification); diff --git a/drivers/net/wireless/iwlwifi/iwl-notif-wait.h b/drivers/net/wireless/iwlwifi/iwl-notif-wait.h deleted file mode 100644 index 2e2f1c8c99f9..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-notif-wait.h +++ /dev/null @@ -1,138 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2007 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#ifndef __iwl_notif_wait_h__ -#define __iwl_notif_wait_h__ - -#include - -#include "iwl-trans.h" - -struct iwl_notif_wait_data { - struct list_head notif_waits; - spinlock_t notif_wait_lock; - wait_queue_head_t notif_waitq; -}; - -#define MAX_NOTIF_CMDS 5 - -/** - * struct iwl_notification_wait - notification wait entry - * @list: list head for global list - * @fn: Function called with the notification. If the function - * returns true, the wait is over, if it returns false then - * the waiter stays blocked. If no function is given, any - * of the listed commands will unblock the waiter. - * @cmds: command IDs - * @n_cmds: number of command IDs - * @triggered: waiter should be woken up - * @aborted: wait was aborted - * - * This structure is not used directly, to wait for a - * notification declare it on the stack, and call - * iwlagn_init_notification_wait() with appropriate - * parameters. Then do whatever will cause the ucode - * to notify the driver, and to wait for that then - * call iwlagn_wait_notification(). - * - * Each notification is one-shot. If at some point we - * need to support multi-shot notifications (which - * can't be allocated on the stack) we need to modify - * the code for them. - */ -struct iwl_notification_wait { - struct list_head list; - - bool (*fn)(struct iwl_notif_wait_data *notif_data, - struct iwl_rx_packet *pkt, void *data); - void *fn_data; - - u8 cmds[MAX_NOTIF_CMDS]; - u8 n_cmds; - bool triggered, aborted; -}; - - -/* caller functions */ -void iwl_notification_wait_init(struct iwl_notif_wait_data *notif_data); -void iwl_notification_wait_notify(struct iwl_notif_wait_data *notif_data, - struct iwl_rx_packet *pkt); -void iwl_abort_notification_waits(struct iwl_notif_wait_data *notif_data); - -/* user functions */ -void __acquires(wait_entry) -iwl_init_notification_wait(struct iwl_notif_wait_data *notif_data, - struct iwl_notification_wait *wait_entry, - const u8 *cmds, int n_cmds, - bool (*fn)(struct iwl_notif_wait_data *notif_data, - struct iwl_rx_packet *pkt, void *data), - void *fn_data); - -int __must_check __releases(wait_entry) -iwl_wait_notification(struct iwl_notif_wait_data *notif_data, - struct iwl_notification_wait *wait_entry, - unsigned long timeout); - -void __releases(wait_entry) -iwl_remove_notification(struct iwl_notif_wait_data *notif_data, - struct iwl_notification_wait *wait_entry); - -#endif /* __iwl_notif_wait_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c deleted file mode 100644 index 6199a0a597a6..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c +++ /dev/null @@ -1,393 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ -#include -#include -#include -#include "iwl-drv.h" -#include "iwl-modparams.h" -#include "iwl-nvm-parse.h" - -/* NVM offsets (in words) definitions */ -enum wkp_nvm_offsets { - /* NVM HW-Section offset (in words) definitions */ - HW_ADDR = 0x15, - -/* NVM SW-Section offset (in words) definitions */ - NVM_SW_SECTION = 0x1C0, - NVM_VERSION = 0, - RADIO_CFG = 1, - SKU = 2, - N_HW_ADDRS = 3, - NVM_CHANNELS = 0x1E0 - NVM_SW_SECTION, - -/* NVM calibration section offset (in words) definitions */ - NVM_CALIB_SECTION = 0x2B8, - XTAL_CALIB = 0x316 - NVM_CALIB_SECTION -}; - -/* SKU Capabilities (actual values from NVM definition) */ -enum nvm_sku_bits { - NVM_SKU_CAP_BAND_24GHZ = BIT(0), - NVM_SKU_CAP_BAND_52GHZ = BIT(1), - NVM_SKU_CAP_11N_ENABLE = BIT(2), -}; - -/* radio config bits (actual values from NVM definition) */ -#define NVM_RF_CFG_DASH_MSK(x) (x & 0x3) /* bits 0-1 */ -#define NVM_RF_CFG_STEP_MSK(x) ((x >> 2) & 0x3) /* bits 2-3 */ -#define NVM_RF_CFG_TYPE_MSK(x) ((x >> 4) & 0x3) /* bits 4-5 */ -#define NVM_RF_CFG_PNUM_MSK(x) ((x >> 6) & 0x3) /* bits 6-7 */ -#define NVM_RF_CFG_TX_ANT_MSK(x) ((x >> 8) & 0xF) /* bits 8-11 */ -#define NVM_RF_CFG_RX_ANT_MSK(x) ((x >> 12) & 0xF) /* bits 12-15 */ - -/* - * These are the channel numbers in the order that they are stored in the NVM - */ -static const u8 iwl_nvm_channels[] = { - /* 2.4 GHz */ - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - /* 5 GHz */ - 36, 40, 44 , 48, 52, 56, 60, 64, - 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, - 149, 153, 157, 161, 165 -}; - -#define IWL_NUM_CHANNELS ARRAY_SIZE(iwl_nvm_channels) -#define NUM_2GHZ_CHANNELS 14 -#define FIRST_2GHZ_HT_MINUS 5 -#define LAST_2GHZ_HT_PLUS 9 -#define LAST_5GHZ_HT 161 - - -/* rate data (static) */ -static struct ieee80211_rate iwl_cfg80211_rates[] = { - { .bitrate = 1 * 10, .hw_value = 0, .hw_value_short = 0, }, - { .bitrate = 2 * 10, .hw_value = 1, .hw_value_short = 1, - .flags = IEEE80211_RATE_SHORT_PREAMBLE, }, - { .bitrate = 5.5 * 10, .hw_value = 2, .hw_value_short = 2, - .flags = IEEE80211_RATE_SHORT_PREAMBLE, }, - { .bitrate = 11 * 10, .hw_value = 3, .hw_value_short = 3, - .flags = IEEE80211_RATE_SHORT_PREAMBLE, }, - { .bitrate = 6 * 10, .hw_value = 4, .hw_value_short = 4, }, - { .bitrate = 9 * 10, .hw_value = 5, .hw_value_short = 5, }, - { .bitrate = 12 * 10, .hw_value = 6, .hw_value_short = 6, }, - { .bitrate = 18 * 10, .hw_value = 7, .hw_value_short = 7, }, - { .bitrate = 24 * 10, .hw_value = 8, .hw_value_short = 8, }, - { .bitrate = 36 * 10, .hw_value = 9, .hw_value_short = 9, }, - { .bitrate = 48 * 10, .hw_value = 10, .hw_value_short = 10, }, - { .bitrate = 54 * 10, .hw_value = 11, .hw_value_short = 11, }, -}; -#define RATES_24_OFFS 0 -#define N_RATES_24 ARRAY_SIZE(iwl_cfg80211_rates) -#define RATES_52_OFFS 4 -#define N_RATES_52 (N_RATES_24 - RATES_52_OFFS) - -/** - * enum iwl_nvm_channel_flags - channel flags in NVM - * @NVM_CHANNEL_VALID: channel is usable for this SKU/geo - * @NVM_CHANNEL_IBSS: usable as an IBSS channel - * @NVM_CHANNEL_ACTIVE: active scanning allowed - * @NVM_CHANNEL_RADAR: radar detection required - * @NVM_CHANNEL_DFS: dynamic freq selection candidate - * @NVM_CHANNEL_WIDE: 20 MHz channel okay (?) - * @NVM_CHANNEL_40MHZ: 40 MHz channel okay (?) - * @NVM_CHANNEL_80MHZ: 80 MHz channel okay (?) - * @NVM_CHANNEL_160MHZ: 160 MHz channel okay (?) - */ -enum iwl_nvm_channel_flags { - NVM_CHANNEL_VALID = BIT(0), - NVM_CHANNEL_IBSS = BIT(1), - NVM_CHANNEL_ACTIVE = BIT(3), - NVM_CHANNEL_RADAR = BIT(4), - NVM_CHANNEL_DFS = BIT(7), - NVM_CHANNEL_WIDE = BIT(8), - NVM_CHANNEL_40MHZ = BIT(9), - NVM_CHANNEL_80MHZ = BIT(10), - NVM_CHANNEL_160MHZ = BIT(11), -}; - -#define CHECK_AND_PRINT_I(x) \ - ((ch_flags & NVM_CHANNEL_##x) ? # x " " : "") - -static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, - struct iwl_nvm_data *data, - const __le16 * const nvm_ch_flags) -{ - int ch_idx; - int n_channels = 0; - struct ieee80211_channel *channel; - u16 ch_flags; - bool is_5ghz; - - for (ch_idx = 0; ch_idx < IWL_NUM_CHANNELS; ch_idx++) { - ch_flags = __le16_to_cpup(nvm_ch_flags + ch_idx); - if (!(ch_flags & NVM_CHANNEL_VALID)) { - IWL_DEBUG_EEPROM(dev, - "Ch. %d Flags %x [%sGHz] - No traffic\n", - iwl_nvm_channels[ch_idx], - ch_flags, - (ch_idx >= NUM_2GHZ_CHANNELS) ? - "5.2" : "2.4"); - continue; - } - - channel = &data->channels[n_channels]; - n_channels++; - - channel->hw_value = iwl_nvm_channels[ch_idx]; - channel->band = (ch_idx < NUM_2GHZ_CHANNELS) ? - IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; - channel->center_freq = - ieee80211_channel_to_frequency( - channel->hw_value, channel->band); - - /* TODO: Need to be dependent to the NVM */ - channel->flags = IEEE80211_CHAN_NO_HT40; - if (ch_idx < NUM_2GHZ_CHANNELS && - (ch_flags & NVM_CHANNEL_40MHZ)) { - if (iwl_nvm_channels[ch_idx] <= LAST_2GHZ_HT_PLUS) - channel->flags &= ~IEEE80211_CHAN_NO_HT40PLUS; - if (iwl_nvm_channels[ch_idx] >= FIRST_2GHZ_HT_MINUS) - channel->flags &= ~IEEE80211_CHAN_NO_HT40MINUS; - } else if (iwl_nvm_channels[ch_idx] <= LAST_5GHZ_HT && - (ch_flags & NVM_CHANNEL_40MHZ)) { - if ((ch_idx - NUM_2GHZ_CHANNELS) % 2 == 0) - channel->flags &= ~IEEE80211_CHAN_NO_HT40PLUS; - else - channel->flags &= ~IEEE80211_CHAN_NO_HT40MINUS; - } - if (!(ch_flags & NVM_CHANNEL_80MHZ)) - channel->flags |= IEEE80211_CHAN_NO_80MHZ; - if (!(ch_flags & NVM_CHANNEL_160MHZ)) - channel->flags |= IEEE80211_CHAN_NO_160MHZ; - - if (!(ch_flags & NVM_CHANNEL_IBSS)) - channel->flags |= IEEE80211_CHAN_NO_IBSS; - - if (!(ch_flags & NVM_CHANNEL_ACTIVE)) - channel->flags |= IEEE80211_CHAN_PASSIVE_SCAN; - - if (ch_flags & NVM_CHANNEL_RADAR) - channel->flags |= IEEE80211_CHAN_RADAR; - - /* Initialize regulatory-based run-time data */ - - /* TODO: read the real value from the NVM */ - channel->max_power = 0; - is_5ghz = channel->band == IEEE80211_BAND_5GHZ; - IWL_DEBUG_EEPROM(dev, - "Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x %ddBm): Ad-Hoc %ssupported\n", - channel->hw_value, - is_5ghz ? "5.2" : "2.4", - CHECK_AND_PRINT_I(VALID), - CHECK_AND_PRINT_I(IBSS), - CHECK_AND_PRINT_I(ACTIVE), - CHECK_AND_PRINT_I(RADAR), - CHECK_AND_PRINT_I(WIDE), - CHECK_AND_PRINT_I(DFS), - ch_flags, - channel->max_power, - ((ch_flags & NVM_CHANNEL_IBSS) && - !(ch_flags & NVM_CHANNEL_RADAR)) - ? "" : "not "); - } - - return n_channels; -} - -static void iwl_init_vht_hw_capab(const struct iwl_cfg *cfg, - struct iwl_nvm_data *data, - struct ieee80211_sta_vht_cap *vht_cap) -{ - /* For now, assume new devices with NVM are VHT capable */ - - vht_cap->vht_supported = true; - - vht_cap->cap = IEEE80211_VHT_CAP_SHORT_GI_80 | - IEEE80211_VHT_CAP_RXSTBC_1 | - IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | - 7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT; - - if (iwlwifi_mod_params.amsdu_size_8K) - vht_cap->cap |= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991; - - vht_cap->vht_mcs.rx_mcs_map = - cpu_to_le16(IEEE80211_VHT_MCS_SUPPORT_0_9 << 0 | - IEEE80211_VHT_MCS_SUPPORT_0_9 << 2 | - IEEE80211_VHT_MCS_NOT_SUPPORTED << 4 | - IEEE80211_VHT_MCS_NOT_SUPPORTED << 6 | - IEEE80211_VHT_MCS_NOT_SUPPORTED << 8 | - IEEE80211_VHT_MCS_NOT_SUPPORTED << 10 | - IEEE80211_VHT_MCS_NOT_SUPPORTED << 12 | - IEEE80211_VHT_MCS_NOT_SUPPORTED << 14); - - if (data->valid_rx_ant == 1 || cfg->rx_with_siso_diversity) { - vht_cap->cap |= IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN | - IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; - /* this works because NOT_SUPPORTED == 3 */ - vht_cap->vht_mcs.rx_mcs_map |= - cpu_to_le16(IEEE80211_VHT_MCS_NOT_SUPPORTED << 2); - } - - vht_cap->vht_mcs.tx_mcs_map = vht_cap->vht_mcs.rx_mcs_map; -} - -static void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg, - struct iwl_nvm_data *data, const __le16 *nvm_sw) -{ - int n_channels = iwl_init_channel_map(dev, cfg, data, - &nvm_sw[NVM_CHANNELS]); - int n_used = 0; - struct ieee80211_supported_band *sband; - - sband = &data->bands[IEEE80211_BAND_2GHZ]; - sband->band = IEEE80211_BAND_2GHZ; - sband->bitrates = &iwl_cfg80211_rates[RATES_24_OFFS]; - sband->n_bitrates = N_RATES_24; - n_used += iwl_init_sband_channels(data, sband, n_channels, - IEEE80211_BAND_2GHZ); - iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_2GHZ); - - sband = &data->bands[IEEE80211_BAND_5GHZ]; - sband->band = IEEE80211_BAND_5GHZ; - sband->bitrates = &iwl_cfg80211_rates[RATES_52_OFFS]; - sband->n_bitrates = N_RATES_52; - n_used += iwl_init_sband_channels(data, sband, n_channels, - IEEE80211_BAND_5GHZ); - iwl_init_ht_hw_capab(cfg, data, &sband->ht_cap, IEEE80211_BAND_5GHZ); - iwl_init_vht_hw_capab(cfg, data, &sband->vht_cap); - - if (n_channels != n_used) - IWL_ERR_DEV(dev, "NVM: used only %d of %d channels\n", - n_used, n_channels); -} - -struct iwl_nvm_data * -iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg, - const __le16 *nvm_hw, const __le16 *nvm_sw, - const __le16 *nvm_calib) -{ - struct iwl_nvm_data *data; - u8 hw_addr[ETH_ALEN]; - u16 radio_cfg, sku; - - data = kzalloc(sizeof(*data) + - sizeof(struct ieee80211_channel) * IWL_NUM_CHANNELS, - GFP_KERNEL); - if (!data) - return NULL; - - data->nvm_version = le16_to_cpup(nvm_sw + NVM_VERSION); - - radio_cfg = le16_to_cpup(nvm_sw + RADIO_CFG); - data->radio_cfg_type = NVM_RF_CFG_TYPE_MSK(radio_cfg); - data->radio_cfg_step = NVM_RF_CFG_STEP_MSK(radio_cfg); - data->radio_cfg_dash = NVM_RF_CFG_DASH_MSK(radio_cfg); - data->radio_cfg_pnum = NVM_RF_CFG_PNUM_MSK(radio_cfg); - data->valid_tx_ant = NVM_RF_CFG_TX_ANT_MSK(radio_cfg); - data->valid_rx_ant = NVM_RF_CFG_RX_ANT_MSK(radio_cfg); - - sku = le16_to_cpup(nvm_sw + SKU); - data->sku_cap_band_24GHz_enable = sku & NVM_SKU_CAP_BAND_24GHZ; - data->sku_cap_band_52GHz_enable = sku & NVM_SKU_CAP_BAND_52GHZ; - data->sku_cap_11n_enable = sku & NVM_SKU_CAP_11N_ENABLE; - if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_ALL) - data->sku_cap_11n_enable = false; - - /* check overrides (some devices have wrong NVM) */ - if (cfg->valid_tx_ant) - data->valid_tx_ant = cfg->valid_tx_ant; - if (cfg->valid_rx_ant) - data->valid_rx_ant = cfg->valid_rx_ant; - - if (!data->valid_tx_ant || !data->valid_rx_ant) { - IWL_ERR_DEV(dev, "invalid antennas (0x%x, 0x%x)\n", - data->valid_tx_ant, data->valid_rx_ant); - kfree(data); - return NULL; - } - - data->n_hw_addrs = le16_to_cpup(nvm_sw + N_HW_ADDRS); - - data->xtal_calib[0] = *(nvm_calib + XTAL_CALIB); - data->xtal_calib[1] = *(nvm_calib + XTAL_CALIB + 1); - - /* The byte order is little endian 16 bit, meaning 214365 */ - memcpy(hw_addr, nvm_hw + HW_ADDR, ETH_ALEN); - data->hw_addr[0] = hw_addr[1]; - data->hw_addr[1] = hw_addr[0]; - data->hw_addr[2] = hw_addr[3]; - data->hw_addr[3] = hw_addr[2]; - data->hw_addr[4] = hw_addr[5]; - data->hw_addr[5] = hw_addr[4]; - - iwl_init_sbands(dev, cfg, data, nvm_sw); - - data->calib_version = 255; /* TODO: - this value will prevent some checks from - failing, we need to check if this - field is still needed, and if it does, - where is it in the NVM*/ - - return data; -} -IWL_EXPORT_SYMBOL(iwl_parse_nvm_data); diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.h b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.h deleted file mode 100644 index e57fb989661e..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.h +++ /dev/null @@ -1,80 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2008 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ -#ifndef __iwl_nvm_parse_h__ -#define __iwl_nvm_parse_h__ - -#include "iwl-eeprom-parse.h" - -/** - * iwl_parse_nvm_data - parse NVM data and return values - * - * This function parses all NVM values we need and then - * returns a (newly allocated) struct containing all the - * relevant values for driver use. The struct must be freed - * later with iwl_free_nvm_data(). - */ -struct iwl_nvm_data * -iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg, - const __le16 *nvm_hw, const __le16 *nvm_sw, - const __le16 *nvm_calib); - -#endif /* __iwl_nvm_parse_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-op-mode.h b/drivers/net/wireless/iwlwifi/iwl-op-mode.h deleted file mode 100644 index 98c7aa7346da..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-op-mode.h +++ /dev/null @@ -1,231 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2007 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#ifndef __iwl_op_mode_h__ -#define __iwl_op_mode_h__ - -#include - -struct iwl_op_mode; -struct iwl_trans; -struct sk_buff; -struct iwl_device_cmd; -struct iwl_rx_cmd_buffer; -struct iwl_fw; -struct iwl_cfg; - -/** - * DOC: Operational mode - what is it ? - * - * The operational mode (a.k.a. op_mode) is the layer that implements - * mac80211's handlers. It knows two APIs: mac80211's and the fw's. It uses - * the transport API to access the HW. The op_mode doesn't need to know how the - * underlying HW works, since the transport layer takes care of that. - * - * There can be several op_mode: i.e. different fw APIs will require two - * different op_modes. This is why the op_mode is virtualized. - */ - -/** - * DOC: Life cycle of the Operational mode - * - * The operational mode has a very simple life cycle. - * - * 1) The driver layer (iwl-drv.c) chooses the op_mode based on the - * capabilities advertized by the fw file (in TLV format). - * 2) The driver layer starts the op_mode (ops->start) - * 3) The op_mode registers registers mac80211 - * 4) The op_mode is governed by mac80211 - * 5) The driver layer stops the op_mode - */ - -/** - * struct iwl_op_mode_ops - op_mode specific operations - * - * The op_mode exports its ops so that external components can start it and - * interact with it. The driver layer typically calls the start and stop - * handlers, the transport layer calls the others. - * - * All the handlers MUST be implemented - * - * @start: start the op_mode. The transport layer is already allocated. - * May sleep - * @stop: stop the op_mode. Must free all the memory allocated. - * May sleep - * @rx: Rx notification to the op_mode. rxb is the Rx buffer itself. Cmd is the - * HCMD the this Rx responds to. - * This callback may sleep, it is called from a threaded IRQ handler. - * @queue_full: notifies that a HW queue is full. - * Must be atomic and called with BH disabled. - * @queue_not_full: notifies that a HW queue is not full any more. - * Must be atomic and called with BH disabled. - * @hw_rf_kill:notifies of a change in the HW rf kill switch. True means that - * the radio is killed. May sleep. - * @free_skb: allows the transport layer to free skbs that haven't been - * reclaimed by the op_mode. This can happen when the driver is freed and - * there are Tx packets pending in the transport layer. - * Must be atomic - * @nic_error: error notification. Must be atomic and must be called with BH - * disabled. - * @cmd_queue_full: Called when the command queue gets full. Must be atomic and - * called with BH disabled. - * @nic_config: configure NIC, called before firmware is started. - * May sleep - * @wimax_active: invoked when WiMax becomes active. May sleep - */ -struct iwl_op_mode_ops { - struct iwl_op_mode *(*start)(struct iwl_trans *trans, - const struct iwl_cfg *cfg, - const struct iwl_fw *fw, - struct dentry *dbgfs_dir); - void (*stop)(struct iwl_op_mode *op_mode); - int (*rx)(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); - void (*queue_full)(struct iwl_op_mode *op_mode, int queue); - void (*queue_not_full)(struct iwl_op_mode *op_mode, int queue); - void (*hw_rf_kill)(struct iwl_op_mode *op_mode, bool state); - void (*free_skb)(struct iwl_op_mode *op_mode, struct sk_buff *skb); - void (*nic_error)(struct iwl_op_mode *op_mode); - void (*cmd_queue_full)(struct iwl_op_mode *op_mode); - void (*nic_config)(struct iwl_op_mode *op_mode); - void (*wimax_active)(struct iwl_op_mode *op_mode); -}; - -int iwl_opmode_register(const char *name, const struct iwl_op_mode_ops *ops); -void iwl_opmode_deregister(const char *name); - -/** - * struct iwl_op_mode - operational mode - * - * This holds an implementation of the mac80211 / fw API. - * - * @ops - pointer to its own ops - */ -struct iwl_op_mode { - const struct iwl_op_mode_ops *ops; - const struct iwl_trans *trans; - - char op_mode_specific[0] __aligned(sizeof(void *)); -}; - -static inline void iwl_op_mode_stop(struct iwl_op_mode *op_mode) -{ - might_sleep(); - op_mode->ops->stop(op_mode); -} - -static inline int iwl_op_mode_rx(struct iwl_op_mode *op_mode, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - might_sleep(); - return op_mode->ops->rx(op_mode, rxb, cmd); -} - -static inline void iwl_op_mode_queue_full(struct iwl_op_mode *op_mode, - int queue) -{ - op_mode->ops->queue_full(op_mode, queue); -} - -static inline void iwl_op_mode_queue_not_full(struct iwl_op_mode *op_mode, - int queue) -{ - op_mode->ops->queue_not_full(op_mode, queue); -} - -static inline void iwl_op_mode_hw_rf_kill(struct iwl_op_mode *op_mode, - bool state) -{ - might_sleep(); - op_mode->ops->hw_rf_kill(op_mode, state); -} - -static inline void iwl_op_mode_free_skb(struct iwl_op_mode *op_mode, - struct sk_buff *skb) -{ - op_mode->ops->free_skb(op_mode, skb); -} - -static inline void iwl_op_mode_nic_error(struct iwl_op_mode *op_mode) -{ - op_mode->ops->nic_error(op_mode); -} - -static inline void iwl_op_mode_cmd_queue_full(struct iwl_op_mode *op_mode) -{ - op_mode->ops->cmd_queue_full(op_mode); -} - -static inline void iwl_op_mode_nic_config(struct iwl_op_mode *op_mode) -{ - might_sleep(); - op_mode->ops->nic_config(op_mode); -} - -static inline void iwl_op_mode_wimax_active(struct iwl_op_mode *op_mode) -{ - might_sleep(); - op_mode->ops->wimax_active(op_mode); -} - -#endif /* __iwl_op_mode_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-phy-db.c b/drivers/net/wireless/iwlwifi/iwl-phy-db.c deleted file mode 100644 index 25745daa0d5d..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-phy-db.c +++ /dev/null @@ -1,499 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2007 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#include -#include -#include - -#include "iwl-drv.h" -#include "iwl-phy-db.h" -#include "iwl-debug.h" -#include "iwl-op-mode.h" -#include "iwl-trans.h" - -#define CHANNEL_NUM_SIZE 4 /* num of channels in calib_ch size */ -#define IWL_NUM_PAPD_CH_GROUPS 4 -#define IWL_NUM_TXP_CH_GROUPS 9 - -struct iwl_phy_db_entry { - u16 size; - u8 *data; -}; - -/** - * struct iwl_phy_db - stores phy configuration and calibration data. - * - * @cfg: phy configuration. - * @calib_nch: non channel specific calibration data. - * @calib_ch: channel specific calibration data. - * @calib_ch_group_papd: calibration data related to papd channel group. - * @calib_ch_group_txp: calibration data related to tx power chanel group. - */ -struct iwl_phy_db { - struct iwl_phy_db_entry cfg; - struct iwl_phy_db_entry calib_nch; - struct iwl_phy_db_entry calib_ch; - struct iwl_phy_db_entry calib_ch_group_papd[IWL_NUM_PAPD_CH_GROUPS]; - struct iwl_phy_db_entry calib_ch_group_txp[IWL_NUM_TXP_CH_GROUPS]; - - u32 channel_num; - u32 channel_size; - - struct iwl_trans *trans; -}; - -enum iwl_phy_db_section_type { - IWL_PHY_DB_CFG = 1, - IWL_PHY_DB_CALIB_NCH, - IWL_PHY_DB_CALIB_CH, - IWL_PHY_DB_CALIB_CHG_PAPD, - IWL_PHY_DB_CALIB_CHG_TXP, - IWL_PHY_DB_MAX -}; - -#define PHY_DB_CMD 0x6c /* TEMP API - The actual is 0x8c */ - -/* - * phy db - configure operational ucode - */ -struct iwl_phy_db_cmd { - __le16 type; - __le16 length; - u8 data[]; -} __packed; - -/* for parsing of tx power channel group data that comes from the firmware*/ -struct iwl_phy_db_chg_txp { - __le32 space; - __le16 max_channel_idx; -} __packed; - -/* - * phy db - Receieve phy db chunk after calibrations - */ -struct iwl_calib_res_notif_phy_db { - __le16 type; - __le16 length; - u8 data[]; -} __packed; - -struct iwl_phy_db *iwl_phy_db_init(struct iwl_trans *trans) -{ - struct iwl_phy_db *phy_db = kzalloc(sizeof(struct iwl_phy_db), - GFP_KERNEL); - - if (!phy_db) - return phy_db; - - phy_db->trans = trans; - - /* TODO: add default values of the phy db. */ - return phy_db; -} -IWL_EXPORT_SYMBOL(iwl_phy_db_init); - -/* - * get phy db section: returns a pointer to a phy db section specified by - * type and channel group id. - */ -static struct iwl_phy_db_entry * -iwl_phy_db_get_section(struct iwl_phy_db *phy_db, - enum iwl_phy_db_section_type type, - u16 chg_id) -{ - if (!phy_db || type >= IWL_PHY_DB_MAX) - return NULL; - - switch (type) { - case IWL_PHY_DB_CFG: - return &phy_db->cfg; - case IWL_PHY_DB_CALIB_NCH: - return &phy_db->calib_nch; - case IWL_PHY_DB_CALIB_CH: - return &phy_db->calib_ch; - case IWL_PHY_DB_CALIB_CHG_PAPD: - if (chg_id >= IWL_NUM_PAPD_CH_GROUPS) - return NULL; - return &phy_db->calib_ch_group_papd[chg_id]; - case IWL_PHY_DB_CALIB_CHG_TXP: - if (chg_id >= IWL_NUM_TXP_CH_GROUPS) - return NULL; - return &phy_db->calib_ch_group_txp[chg_id]; - default: - return NULL; - } - return NULL; -} - -static void iwl_phy_db_free_section(struct iwl_phy_db *phy_db, - enum iwl_phy_db_section_type type, - u16 chg_id) -{ - struct iwl_phy_db_entry *entry = - iwl_phy_db_get_section(phy_db, type, chg_id); - if (!entry) - return; - - kfree(entry->data); - entry->data = NULL; - entry->size = 0; -} - -void iwl_phy_db_free(struct iwl_phy_db *phy_db) -{ - int i; - - if (!phy_db) - return; - - iwl_phy_db_free_section(phy_db, IWL_PHY_DB_CFG, 0); - iwl_phy_db_free_section(phy_db, IWL_PHY_DB_CALIB_NCH, 0); - iwl_phy_db_free_section(phy_db, IWL_PHY_DB_CALIB_CH, 0); - for (i = 0; i < IWL_NUM_PAPD_CH_GROUPS; i++) - iwl_phy_db_free_section(phy_db, IWL_PHY_DB_CALIB_CHG_PAPD, i); - for (i = 0; i < IWL_NUM_TXP_CH_GROUPS; i++) - iwl_phy_db_free_section(phy_db, IWL_PHY_DB_CALIB_CHG_TXP, i); - - kfree(phy_db); -} -IWL_EXPORT_SYMBOL(iwl_phy_db_free); - -int iwl_phy_db_set_section(struct iwl_phy_db *phy_db, struct iwl_rx_packet *pkt, - gfp_t alloc_ctx) -{ - struct iwl_calib_res_notif_phy_db *phy_db_notif = - (struct iwl_calib_res_notif_phy_db *)pkt->data; - enum iwl_phy_db_section_type type = le16_to_cpu(phy_db_notif->type); - u16 size = le16_to_cpu(phy_db_notif->length); - struct iwl_phy_db_entry *entry; - u16 chg_id = 0; - - if (!phy_db) - return -EINVAL; - - if (type == IWL_PHY_DB_CALIB_CHG_PAPD || - type == IWL_PHY_DB_CALIB_CHG_TXP) - chg_id = le16_to_cpup((__le16 *)phy_db_notif->data); - - entry = iwl_phy_db_get_section(phy_db, type, chg_id); - if (!entry) - return -EINVAL; - - kfree(entry->data); - entry->data = kmemdup(phy_db_notif->data, size, alloc_ctx); - if (!entry->data) { - entry->size = 0; - return -ENOMEM; - } - - entry->size = size; - - if (type == IWL_PHY_DB_CALIB_CH) { - phy_db->channel_num = - le32_to_cpup((__le32 *)phy_db_notif->data); - phy_db->channel_size = - (size - CHANNEL_NUM_SIZE) / phy_db->channel_num; - } - - IWL_DEBUG_INFO(phy_db->trans, - "%s(%d): [PHYDB]SET: Type %d , Size: %d\n", - __func__, __LINE__, type, size); - - return 0; -} -IWL_EXPORT_SYMBOL(iwl_phy_db_set_section); - -static int is_valid_channel(u16 ch_id) -{ - if (ch_id <= 14 || - (36 <= ch_id && ch_id <= 64 && ch_id % 4 == 0) || - (100 <= ch_id && ch_id <= 140 && ch_id % 4 == 0) || - (145 <= ch_id && ch_id <= 165 && ch_id % 4 == 1)) - return 1; - return 0; -} - -static u8 ch_id_to_ch_index(u16 ch_id) -{ - if (WARN_ON(!is_valid_channel(ch_id))) - return 0xff; - - if (ch_id <= 14) - return ch_id - 1; - if (ch_id <= 64) - return (ch_id + 20) / 4; - if (ch_id <= 140) - return (ch_id - 12) / 4; - return (ch_id - 13) / 4; -} - - -static u16 channel_id_to_papd(u16 ch_id) -{ - if (WARN_ON(!is_valid_channel(ch_id))) - return 0xff; - - if (1 <= ch_id && ch_id <= 14) - return 0; - if (36 <= ch_id && ch_id <= 64) - return 1; - if (100 <= ch_id && ch_id <= 140) - return 2; - return 3; -} - -static u16 channel_id_to_txp(struct iwl_phy_db *phy_db, u16 ch_id) -{ - struct iwl_phy_db_chg_txp *txp_chg; - int i; - u8 ch_index = ch_id_to_ch_index(ch_id); - if (ch_index == 0xff) - return 0xff; - - for (i = 0; i < IWL_NUM_TXP_CH_GROUPS; i++) { - txp_chg = (void *)phy_db->calib_ch_group_txp[i].data; - if (!txp_chg) - return 0xff; - /* - * Looking for the first channel group that its max channel is - * higher then wanted channel. - */ - if (le16_to_cpu(txp_chg->max_channel_idx) >= ch_index) - return i; - } - return 0xff; -} -static -int iwl_phy_db_get_section_data(struct iwl_phy_db *phy_db, - u32 type, u8 **data, u16 *size, u16 ch_id) -{ - struct iwl_phy_db_entry *entry; - u32 channel_num; - u32 channel_size; - u16 ch_group_id = 0; - u16 index; - - if (!phy_db) - return -EINVAL; - - /* find wanted channel group */ - if (type == IWL_PHY_DB_CALIB_CHG_PAPD) - ch_group_id = channel_id_to_papd(ch_id); - else if (type == IWL_PHY_DB_CALIB_CHG_TXP) - ch_group_id = channel_id_to_txp(phy_db, ch_id); - - entry = iwl_phy_db_get_section(phy_db, type, ch_group_id); - if (!entry) - return -EINVAL; - - if (type == IWL_PHY_DB_CALIB_CH) { - index = ch_id_to_ch_index(ch_id); - channel_num = phy_db->channel_num; - channel_size = phy_db->channel_size; - if (index >= channel_num) { - IWL_ERR(phy_db->trans, "Wrong channel number %d\n", - ch_id); - return -EINVAL; - } - *data = entry->data + CHANNEL_NUM_SIZE + index * channel_size; - *size = channel_size; - } else { - *data = entry->data; - *size = entry->size; - } - - IWL_DEBUG_INFO(phy_db->trans, - "%s(%d): [PHYDB] GET: Type %d , Size: %d\n", - __func__, __LINE__, type, *size); - - return 0; -} - -static int iwl_send_phy_db_cmd(struct iwl_phy_db *phy_db, u16 type, - u16 length, void *data) -{ - struct iwl_phy_db_cmd phy_db_cmd; - struct iwl_host_cmd cmd = { - .id = PHY_DB_CMD, - .flags = CMD_SYNC, - }; - - IWL_DEBUG_INFO(phy_db->trans, - "Sending PHY-DB hcmd of type %d, of length %d\n", - type, length); - - /* Set phy db cmd variables */ - phy_db_cmd.type = cpu_to_le16(type); - phy_db_cmd.length = cpu_to_le16(length); - - /* Set hcmd variables */ - cmd.data[0] = &phy_db_cmd; - cmd.len[0] = sizeof(struct iwl_phy_db_cmd); - cmd.data[1] = data; - cmd.len[1] = length; - cmd.dataflags[1] = IWL_HCMD_DFL_NOCOPY; - - return iwl_trans_send_cmd(phy_db->trans, &cmd); -} - -static int iwl_phy_db_send_all_channel_groups( - struct iwl_phy_db *phy_db, - enum iwl_phy_db_section_type type, - u8 max_ch_groups) -{ - u16 i; - int err; - struct iwl_phy_db_entry *entry; - - /* Send all the channel specific groups to operational fw */ - for (i = 0; i < max_ch_groups; i++) { - entry = iwl_phy_db_get_section(phy_db, - type, - i); - if (!entry) - return -EINVAL; - - /* Send the requested PHY DB section */ - err = iwl_send_phy_db_cmd(phy_db, - type, - entry->size, - entry->data); - if (err) { - IWL_ERR(phy_db->trans, - "Can't SEND phy_db section %d (%d), err %d", - type, i, err); - return err; - } - - IWL_DEBUG_INFO(phy_db->trans, - "Sent PHY_DB HCMD, type = %d num = %d", - type, i); - } - - return 0; -} - -int iwl_send_phy_db_data(struct iwl_phy_db *phy_db) -{ - u8 *data = NULL; - u16 size = 0; - int err; - - IWL_DEBUG_INFO(phy_db->trans, - "Sending phy db data and configuration to runtime image\n"); - - /* Send PHY DB CFG section */ - err = iwl_phy_db_get_section_data(phy_db, IWL_PHY_DB_CFG, - &data, &size, 0); - if (err) { - IWL_ERR(phy_db->trans, "Cannot get Phy DB cfg section\n"); - return err; - } - - err = iwl_send_phy_db_cmd(phy_db, IWL_PHY_DB_CFG, size, data); - if (err) { - IWL_ERR(phy_db->trans, - "Cannot send HCMD of Phy DB cfg section\n"); - return err; - } - - err = iwl_phy_db_get_section_data(phy_db, IWL_PHY_DB_CALIB_NCH, - &data, &size, 0); - if (err) { - IWL_ERR(phy_db->trans, - "Cannot get Phy DB non specific channel section\n"); - return err; - } - - err = iwl_send_phy_db_cmd(phy_db, IWL_PHY_DB_CALIB_NCH, size, data); - if (err) { - IWL_ERR(phy_db->trans, - "Cannot send HCMD of Phy DB non specific channel section\n"); - return err; - } - - /* Send all the TXP channel specific data */ - err = iwl_phy_db_send_all_channel_groups(phy_db, - IWL_PHY_DB_CALIB_CHG_PAPD, - IWL_NUM_PAPD_CH_GROUPS); - if (err) { - IWL_ERR(phy_db->trans, - "Cannot send channel specific PAPD groups"); - return err; - } - - /* Send all the TXP channel specific data */ - err = iwl_phy_db_send_all_channel_groups(phy_db, - IWL_PHY_DB_CALIB_CHG_TXP, - IWL_NUM_TXP_CH_GROUPS); - if (err) { - IWL_ERR(phy_db->trans, - "Cannot send channel specific TX power groups"); - return err; - } - - IWL_DEBUG_INFO(phy_db->trans, - "Finished sending phy db non channel data\n"); - return 0; -} -IWL_EXPORT_SYMBOL(iwl_send_phy_db_data); diff --git a/drivers/net/wireless/iwlwifi/iwl-phy-db.h b/drivers/net/wireless/iwlwifi/iwl-phy-db.h deleted file mode 100644 index ce983af79644..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-phy-db.h +++ /dev/null @@ -1,82 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2007 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#ifndef __IWL_PHYDB_H__ -#define __IWL_PHYDB_H__ - -#include - -#include "iwl-op-mode.h" -#include "iwl-trans.h" - -struct iwl_phy_db *iwl_phy_db_init(struct iwl_trans *trans); - -void iwl_phy_db_free(struct iwl_phy_db *phy_db); - -int iwl_phy_db_set_section(struct iwl_phy_db *phy_db, struct iwl_rx_packet *pkt, - gfp_t alloc_ctx); - - -int iwl_send_phy_db_data(struct iwl_phy_db *phy_db); - -#endif /* __IWL_PHYDB_H__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h deleted file mode 100644 index 386f2a7c87cb..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ /dev/null @@ -1,263 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2005 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef __iwl_prph_h__ -#define __iwl_prph_h__ - -/* - * Registers in this file are internal, not PCI bus memory mapped. - * Driver accesses these via HBUS_TARG_PRPH_* registers. - */ -#define PRPH_BASE (0x00000) -#define PRPH_END (0xFFFFF) - -/* APMG (power management) constants */ -#define APMG_BASE (PRPH_BASE + 0x3000) -#define APMG_CLK_CTRL_REG (APMG_BASE + 0x0000) -#define APMG_CLK_EN_REG (APMG_BASE + 0x0004) -#define APMG_CLK_DIS_REG (APMG_BASE + 0x0008) -#define APMG_PS_CTRL_REG (APMG_BASE + 0x000c) -#define APMG_PCIDEV_STT_REG (APMG_BASE + 0x0010) -#define APMG_RFKILL_REG (APMG_BASE + 0x0014) -#define APMG_RTC_INT_STT_REG (APMG_BASE + 0x001c) -#define APMG_RTC_INT_MSK_REG (APMG_BASE + 0x0020) -#define APMG_DIGITAL_SVR_REG (APMG_BASE + 0x0058) -#define APMG_ANALOG_SVR_REG (APMG_BASE + 0x006C) - -#define APMS_CLK_VAL_MRB_FUNC_MODE (0x00000001) -#define APMG_CLK_VAL_DMA_CLK_RQT (0x00000200) -#define APMG_CLK_VAL_BSM_CLK_RQT (0x00000800) - -#define APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS (0x00400000) -#define APMG_PS_CTRL_VAL_RESET_REQ (0x04000000) -#define APMG_PS_CTRL_MSK_PWR_SRC (0x03000000) -#define APMG_PS_CTRL_VAL_PWR_SRC_VMAIN (0x00000000) -#define APMG_PS_CTRL_VAL_PWR_SRC_VAUX (0x02000000) -#define APMG_SVR_VOLTAGE_CONFIG_BIT_MSK (0x000001E0) /* bit 8:5 */ -#define APMG_SVR_DIGITAL_VOLTAGE_1_32 (0x00000060) - -#define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800) - -/* Device system time */ -#define DEVICE_SYSTEM_TIME_REG 0xA0206C - -/** - * Tx Scheduler - * - * The Tx Scheduler selects the next frame to be transmitted, choosing TFDs - * (Transmit Frame Descriptors) from up to 16 circular Tx queues resident in - * host DRAM. It steers each frame's Tx command (which contains the frame - * data) into one of up to 7 prioritized Tx DMA FIFO channels within the - * device. A queue maps to only one (selectable by driver) Tx DMA channel, - * but one DMA channel may take input from several queues. - * - * Tx DMA FIFOs have dedicated purposes. - * - * For 5000 series and up, they are used differently - * (cf. iwl5000_default_queue_to_tx_fifo in iwl-5000.c): - * - * 0 -- EDCA BK (background) frames, lowest priority - * 1 -- EDCA BE (best effort) frames, normal priority - * 2 -- EDCA VI (video) frames, higher priority - * 3 -- EDCA VO (voice) and management frames, highest priority - * 4 -- unused - * 5 -- unused - * 6 -- unused - * 7 -- Commands - * - * Driver should normally map queues 0-6 to Tx DMA/FIFO channels 0-6. - * In addition, driver can map the remaining queues to Tx DMA/FIFO - * channels 0-3 to support 11n aggregation via EDCA DMA channels. - * - * The driver sets up each queue to work in one of two modes: - * - * 1) Scheduler-Ack, in which the scheduler automatically supports a - * block-ack (BA) window of up to 64 TFDs. In this mode, each queue - * contains TFDs for a unique combination of Recipient Address (RA) - * and Traffic Identifier (TID), that is, traffic of a given - * Quality-Of-Service (QOS) priority, destined for a single station. - * - * In scheduler-ack mode, the scheduler keeps track of the Tx status of - * each frame within the BA window, including whether it's been transmitted, - * and whether it's been acknowledged by the receiving station. The device - * automatically processes block-acks received from the receiving STA, - * and reschedules un-acked frames to be retransmitted (successful - * Tx completion may end up being out-of-order). - * - * The driver must maintain the queue's Byte Count table in host DRAM - * for this mode. - * This mode does not support fragmentation. - * - * 2) FIFO (a.k.a. non-Scheduler-ACK), in which each TFD is processed in order. - * The device may automatically retry Tx, but will retry only one frame - * at a time, until receiving ACK from receiving station, or reaching - * retry limit and giving up. - * - * The command queue (#4/#9) must use this mode! - * This mode does not require use of the Byte Count table in host DRAM. - * - * Driver controls scheduler operation via 3 means: - * 1) Scheduler registers - * 2) Shared scheduler data base in internal SRAM - * 3) Shared data in host DRAM - * - * Initialization: - * - * When loading, driver should allocate memory for: - * 1) 16 TFD circular buffers, each with space for (typically) 256 TFDs. - * 2) 16 Byte Count circular buffers in 16 KBytes contiguous memory - * (1024 bytes for each queue). - * - * After receiving "Alive" response from uCode, driver must initialize - * the scheduler (especially for queue #4/#9, the command queue, otherwise - * the driver can't issue commands!): - */ -#define SCD_MEM_LOWER_BOUND (0x0000) - -/** - * Max Tx window size is the max number of contiguous TFDs that the scheduler - * can keep track of at one time when creating block-ack chains of frames. - * Note that "64" matches the number of ack bits in a block-ack packet. - */ -#define SCD_WIN_SIZE 64 -#define SCD_FRAME_LIMIT 64 - -#define SCD_TXFIFO_POS_TID (0) -#define SCD_TXFIFO_POS_RA (4) -#define SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF) - -/* agn SCD */ -#define SCD_QUEUE_STTS_REG_POS_TXF (0) -#define SCD_QUEUE_STTS_REG_POS_ACTIVE (3) -#define SCD_QUEUE_STTS_REG_POS_WSL (4) -#define SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN (19) -#define SCD_QUEUE_STTS_REG_MSK (0x017F0000) - -#define SCD_QUEUE_CTX_REG1_CREDIT_POS (8) -#define SCD_QUEUE_CTX_REG1_CREDIT_MSK (0x00FFFF00) -#define SCD_QUEUE_CTX_REG1_SUPER_CREDIT_POS (24) -#define SCD_QUEUE_CTX_REG1_SUPER_CREDIT_MSK (0xFF000000) -#define SCD_QUEUE_CTX_REG2_WIN_SIZE_POS (0) -#define SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK (0x0000007F) -#define SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS (16) -#define SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK (0x007F0000) - -/* Context Data */ -#define SCD_CONTEXT_MEM_LOWER_BOUND (SCD_MEM_LOWER_BOUND + 0x600) -#define SCD_CONTEXT_MEM_UPPER_BOUND (SCD_MEM_LOWER_BOUND + 0x6A0) - -/* Tx status */ -#define SCD_TX_STTS_MEM_LOWER_BOUND (SCD_MEM_LOWER_BOUND + 0x6A0) -#define SCD_TX_STTS_MEM_UPPER_BOUND (SCD_MEM_LOWER_BOUND + 0x7E0) - -/* Translation Data */ -#define SCD_TRANS_TBL_MEM_LOWER_BOUND (SCD_MEM_LOWER_BOUND + 0x7E0) -#define SCD_TRANS_TBL_MEM_UPPER_BOUND (SCD_MEM_LOWER_BOUND + 0x808) - -#define SCD_CONTEXT_QUEUE_OFFSET(x)\ - (SCD_CONTEXT_MEM_LOWER_BOUND + ((x) * 8)) - -#define SCD_TX_STTS_QUEUE_OFFSET(x)\ - (SCD_TX_STTS_MEM_LOWER_BOUND + ((x) * 16)) - -#define SCD_TRANS_TBL_OFFSET_QUEUE(x) \ - ((SCD_TRANS_TBL_MEM_LOWER_BOUND + ((x) * 2)) & 0xfffc) - -#define SCD_BASE (PRPH_BASE + 0xa02c00) - -#define SCD_SRAM_BASE_ADDR (SCD_BASE + 0x0) -#define SCD_DRAM_BASE_ADDR (SCD_BASE + 0x8) -#define SCD_AIT (SCD_BASE + 0x0c) -#define SCD_TXFACT (SCD_BASE + 0x10) -#define SCD_ACTIVE (SCD_BASE + 0x14) -#define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8) -#define SCD_CHAINEXT_EN (SCD_BASE + 0x244) -#define SCD_AGGR_SEL (SCD_BASE + 0x248) -#define SCD_INTERRUPT_MASK (SCD_BASE + 0x108) - -static inline unsigned int SCD_QUEUE_WRPTR(unsigned int chnl) -{ - if (chnl < 20) - return SCD_BASE + 0x18 + chnl * 4; - WARN_ON_ONCE(chnl >= 32); - return SCD_BASE + 0x284 + (chnl - 20) * 4; -} - -static inline unsigned int SCD_QUEUE_RDPTR(unsigned int chnl) -{ - if (chnl < 20) - return SCD_BASE + 0x68 + chnl * 4; - WARN_ON_ONCE(chnl >= 32); - return SCD_BASE + 0x2B4 + (chnl - 20) * 4; -} - -static inline unsigned int SCD_QUEUE_STATUS_BITS(unsigned int chnl) -{ - if (chnl < 20) - return SCD_BASE + 0x10c + chnl * 4; - WARN_ON_ONCE(chnl >= 32); - return SCD_BASE + 0x384 + (chnl - 20) * 4; -} - -/*********************** END TX SCHEDULER *************************************/ - -#endif /* __iwl_prph_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-test.c b/drivers/net/wireless/iwlwifi/iwl-test.c deleted file mode 100644 index 5cfd55b86ed3..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-test.c +++ /dev/null @@ -1,852 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2010 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2010 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#include -#include - -#include "iwl-drv.h" -#include "iwl-io.h" -#include "iwl-fh.h" -#include "iwl-prph.h" -#include "iwl-trans.h" -#include "iwl-test.h" -#include "iwl-csr.h" -#include "iwl-testmode.h" - -/* - * Periphery registers absolute lower bound. This is used in order to - * differentiate registery access through HBUS_TARG_PRPH_* and - * HBUS_TARG_MEM_* accesses. - */ -#define IWL_ABS_PRPH_START (0xA00000) - -/* - * The TLVs used in the gnl message policy between the kernel module and - * user space application. iwl_testmode_gnl_msg_policy is to be carried - * through the NL80211_CMD_TESTMODE channel regulated by nl80211. - * See iwl-testmode.h - */ -static -struct nla_policy iwl_testmode_gnl_msg_policy[IWL_TM_ATTR_MAX] = { - [IWL_TM_ATTR_COMMAND] = { .type = NLA_U32, }, - - [IWL_TM_ATTR_UCODE_CMD_ID] = { .type = NLA_U8, }, - [IWL_TM_ATTR_UCODE_CMD_DATA] = { .type = NLA_UNSPEC, }, - - [IWL_TM_ATTR_REG_OFFSET] = { .type = NLA_U32, }, - [IWL_TM_ATTR_REG_VALUE8] = { .type = NLA_U8, }, - [IWL_TM_ATTR_REG_VALUE32] = { .type = NLA_U32, }, - - [IWL_TM_ATTR_SYNC_RSP] = { .type = NLA_UNSPEC, }, - [IWL_TM_ATTR_UCODE_RX_PKT] = { .type = NLA_UNSPEC, }, - - [IWL_TM_ATTR_EEPROM] = { .type = NLA_UNSPEC, }, - - [IWL_TM_ATTR_TRACE_ADDR] = { .type = NLA_UNSPEC, }, - [IWL_TM_ATTR_TRACE_DUMP] = { .type = NLA_UNSPEC, }, - [IWL_TM_ATTR_TRACE_SIZE] = { .type = NLA_U32, }, - - [IWL_TM_ATTR_FIXRATE] = { .type = NLA_U32, }, - - [IWL_TM_ATTR_UCODE_OWNER] = { .type = NLA_U8, }, - - [IWL_TM_ATTR_MEM_ADDR] = { .type = NLA_U32, }, - [IWL_TM_ATTR_BUFFER_SIZE] = { .type = NLA_U32, }, - [IWL_TM_ATTR_BUFFER_DUMP] = { .type = NLA_UNSPEC, }, - - [IWL_TM_ATTR_FW_VERSION] = { .type = NLA_U32, }, - [IWL_TM_ATTR_DEVICE_ID] = { .type = NLA_U32, }, - [IWL_TM_ATTR_FW_TYPE] = { .type = NLA_U32, }, - [IWL_TM_ATTR_FW_INST_SIZE] = { .type = NLA_U32, }, - [IWL_TM_ATTR_FW_DATA_SIZE] = { .type = NLA_U32, }, - - [IWL_TM_ATTR_ENABLE_NOTIFICATION] = {.type = NLA_FLAG, }, -}; - -static inline void iwl_test_trace_clear(struct iwl_test *tst) -{ - memset(&tst->trace, 0, sizeof(struct iwl_test_trace)); -} - -static void iwl_test_trace_stop(struct iwl_test *tst) -{ - if (!tst->trace.enabled) - return; - - if (tst->trace.cpu_addr && tst->trace.dma_addr) - dma_free_coherent(tst->trans->dev, - tst->trace.tsize, - tst->trace.cpu_addr, - tst->trace.dma_addr); - - iwl_test_trace_clear(tst); -} - -static inline void iwl_test_mem_clear(struct iwl_test *tst) -{ - memset(&tst->mem, 0, sizeof(struct iwl_test_mem)); -} - -static inline void iwl_test_mem_stop(struct iwl_test *tst) -{ - if (!tst->mem.in_read) - return; - - iwl_test_mem_clear(tst); -} - -/* - * Initializes the test object - * During the lifetime of the test object it is assumed that the transport is - * started. The test object should be stopped before the transport is stopped. - */ -void iwl_test_init(struct iwl_test *tst, struct iwl_trans *trans, - struct iwl_test_ops *ops) -{ - tst->trans = trans; - tst->ops = ops; - - iwl_test_trace_clear(tst); - iwl_test_mem_clear(tst); -} -EXPORT_SYMBOL_GPL(iwl_test_init); - -/* - * Stop the test object - */ -void iwl_test_free(struct iwl_test *tst) -{ - iwl_test_mem_stop(tst); - iwl_test_trace_stop(tst); -} -EXPORT_SYMBOL_GPL(iwl_test_free); - -static inline int iwl_test_send_cmd(struct iwl_test *tst, - struct iwl_host_cmd *cmd) -{ - return tst->ops->send_cmd(tst->trans->op_mode, cmd); -} - -static inline bool iwl_test_valid_hw_addr(struct iwl_test *tst, u32 addr) -{ - return tst->ops->valid_hw_addr(addr); -} - -static inline u32 iwl_test_fw_ver(struct iwl_test *tst) -{ - return tst->ops->get_fw_ver(tst->trans->op_mode); -} - -static inline struct sk_buff* -iwl_test_alloc_reply(struct iwl_test *tst, int len) -{ - return tst->ops->alloc_reply(tst->trans->op_mode, len); -} - -static inline int iwl_test_reply(struct iwl_test *tst, struct sk_buff *skb) -{ - return tst->ops->reply(tst->trans->op_mode, skb); -} - -static inline struct sk_buff* -iwl_test_alloc_event(struct iwl_test *tst, int len) -{ - return tst->ops->alloc_event(tst->trans->op_mode, len); -} - -static inline void -iwl_test_event(struct iwl_test *tst, struct sk_buff *skb) -{ - return tst->ops->event(tst->trans->op_mode, skb); -} - -/* - * This function handles the user application commands to the fw. The fw - * commands are sent in a synchronuous manner. In case that the user requested - * to get commands response, it is send to the user. - */ -static int iwl_test_fw_cmd(struct iwl_test *tst, struct nlattr **tb) -{ - struct iwl_host_cmd cmd; - struct iwl_rx_packet *pkt; - struct sk_buff *skb; - void *reply_buf; - u32 reply_len; - int ret; - bool cmd_want_skb; - - memset(&cmd, 0, sizeof(struct iwl_host_cmd)); - - if (!tb[IWL_TM_ATTR_UCODE_CMD_ID] || - !tb[IWL_TM_ATTR_UCODE_CMD_DATA]) { - IWL_ERR(tst->trans, "Missing fw command mandatory fields\n"); - return -ENOMSG; - } - - cmd.flags = CMD_ON_DEMAND | CMD_SYNC; - cmd_want_skb = nla_get_flag(tb[IWL_TM_ATTR_UCODE_CMD_SKB]); - if (cmd_want_skb) - cmd.flags |= CMD_WANT_SKB; - - cmd.id = nla_get_u8(tb[IWL_TM_ATTR_UCODE_CMD_ID]); - cmd.data[0] = nla_data(tb[IWL_TM_ATTR_UCODE_CMD_DATA]); - cmd.len[0] = nla_len(tb[IWL_TM_ATTR_UCODE_CMD_DATA]); - cmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY; - IWL_DEBUG_INFO(tst->trans, "test fw cmd=0x%x, flags 0x%x, len %d\n", - cmd.id, cmd.flags, cmd.len[0]); - - ret = iwl_test_send_cmd(tst, &cmd); - if (ret) { - IWL_ERR(tst->trans, "Failed to send hcmd\n"); - return ret; - } - if (!cmd_want_skb) - return ret; - - /* Handling return of SKB to the user */ - pkt = cmd.resp_pkt; - if (!pkt) { - IWL_ERR(tst->trans, "HCMD received a null response packet\n"); - return ret; - } - - reply_len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; - skb = iwl_test_alloc_reply(tst, reply_len + 20); - reply_buf = kmemdup(&pkt->hdr, reply_len, GFP_KERNEL); - if (!skb || !reply_buf) { - kfree_skb(skb); - kfree(reply_buf); - return -ENOMEM; - } - - /* The reply is in a page, that we cannot send to user space. */ - iwl_free_resp(&cmd); - - if (nla_put_u32(skb, IWL_TM_ATTR_COMMAND, - IWL_TM_CMD_DEV2APP_UCODE_RX_PKT) || - nla_put(skb, IWL_TM_ATTR_UCODE_RX_PKT, reply_len, reply_buf)) - goto nla_put_failure; - return iwl_test_reply(tst, skb); - -nla_put_failure: - IWL_DEBUG_INFO(tst->trans, "Failed creating NL attributes\n"); - kfree(reply_buf); - kfree_skb(skb); - return -ENOMSG; -} - -/* - * Handles the user application commands for register access. - */ -static int iwl_test_reg(struct iwl_test *tst, struct nlattr **tb) -{ - u32 ofs, val32, cmd; - u8 val8; - struct sk_buff *skb; - int status = 0; - struct iwl_trans *trans = tst->trans; - - if (!tb[IWL_TM_ATTR_REG_OFFSET]) { - IWL_ERR(trans, "Missing reg offset\n"); - return -ENOMSG; - } - - ofs = nla_get_u32(tb[IWL_TM_ATTR_REG_OFFSET]); - IWL_DEBUG_INFO(trans, "test reg access cmd offset=0x%x\n", ofs); - - cmd = nla_get_u32(tb[IWL_TM_ATTR_COMMAND]); - - /* - * Allow access only to FH/CSR/HBUS in direct mode. - * Since we don't have the upper bounds for the CSR and HBUS segments, - * we will use only the upper bound of FH for sanity check. - */ - if (ofs >= FH_MEM_UPPER_BOUND) { - IWL_ERR(trans, "offset out of segment (0x0 - 0x%x)\n", - FH_MEM_UPPER_BOUND); - return -EINVAL; - } - - switch (cmd) { - case IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32: - val32 = iwl_read_direct32(tst->trans, ofs); - IWL_DEBUG_INFO(trans, "32 value to read 0x%x\n", val32); - - skb = iwl_test_alloc_reply(tst, 20); - if (!skb) { - IWL_ERR(trans, "Memory allocation fail\n"); - return -ENOMEM; - } - if (nla_put_u32(skb, IWL_TM_ATTR_REG_VALUE32, val32)) - goto nla_put_failure; - status = iwl_test_reply(tst, skb); - if (status < 0) - IWL_ERR(trans, "Error sending msg : %d\n", status); - break; - - case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE32: - if (!tb[IWL_TM_ATTR_REG_VALUE32]) { - IWL_ERR(trans, "Missing value to write\n"); - return -ENOMSG; - } else { - val32 = nla_get_u32(tb[IWL_TM_ATTR_REG_VALUE32]); - IWL_DEBUG_INFO(trans, "32b write val=0x%x\n", val32); - iwl_write_direct32(tst->trans, ofs, val32); - } - break; - - case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8: - if (!tb[IWL_TM_ATTR_REG_VALUE8]) { - IWL_ERR(trans, "Missing value to write\n"); - return -ENOMSG; - } else { - val8 = nla_get_u8(tb[IWL_TM_ATTR_REG_VALUE8]); - IWL_DEBUG_INFO(trans, "8b write val=0x%x\n", val8); - iwl_write8(tst->trans, ofs, val8); - } - break; - - default: - IWL_ERR(trans, "Unknown test register cmd ID\n"); - return -ENOMSG; - } - - return status; - -nla_put_failure: - kfree_skb(skb); - return -EMSGSIZE; -} - -/* - * Handles the request to start FW tracing. Allocates of the trace buffer - * and sends a reply to user space with the address of the allocated buffer. - */ -static int iwl_test_trace_begin(struct iwl_test *tst, struct nlattr **tb) -{ - struct sk_buff *skb; - int status = 0; - - if (tst->trace.enabled) - return -EBUSY; - - if (!tb[IWL_TM_ATTR_TRACE_SIZE]) - tst->trace.size = TRACE_BUFF_SIZE_DEF; - else - tst->trace.size = - nla_get_u32(tb[IWL_TM_ATTR_TRACE_SIZE]); - - if (!tst->trace.size) - return -EINVAL; - - if (tst->trace.size < TRACE_BUFF_SIZE_MIN || - tst->trace.size > TRACE_BUFF_SIZE_MAX) - return -EINVAL; - - tst->trace.tsize = tst->trace.size + TRACE_BUFF_PADD; - tst->trace.cpu_addr = dma_alloc_coherent(tst->trans->dev, - tst->trace.tsize, - &tst->trace.dma_addr, - GFP_KERNEL); - if (!tst->trace.cpu_addr) - return -ENOMEM; - - tst->trace.enabled = true; - tst->trace.trace_addr = (u8 *)PTR_ALIGN(tst->trace.cpu_addr, 0x100); - - memset(tst->trace.trace_addr, 0x03B, tst->trace.size); - - skb = iwl_test_alloc_reply(tst, sizeof(tst->trace.dma_addr) + 20); - if (!skb) { - IWL_ERR(tst->trans, "Memory allocation fail\n"); - iwl_test_trace_stop(tst); - return -ENOMEM; - } - - if (nla_put(skb, IWL_TM_ATTR_TRACE_ADDR, - sizeof(tst->trace.dma_addr), - (u64 *)&tst->trace.dma_addr)) - goto nla_put_failure; - - status = iwl_test_reply(tst, skb); - if (status < 0) - IWL_ERR(tst->trans, "Error sending msg : %d\n", status); - - tst->trace.nchunks = DIV_ROUND_UP(tst->trace.size, - DUMP_CHUNK_SIZE); - - return status; - -nla_put_failure: - kfree_skb(skb); - if (nla_get_u32(tb[IWL_TM_ATTR_COMMAND]) == - IWL_TM_CMD_APP2DEV_BEGIN_TRACE) - iwl_test_trace_stop(tst); - return -EMSGSIZE; -} - -/* - * Handles indirect read from the periphery or the SRAM. The read is performed - * to a temporary buffer. The user space application should later issue a dump - */ -static int iwl_test_indirect_read(struct iwl_test *tst, u32 addr, u32 size) -{ - struct iwl_trans *trans = tst->trans; - unsigned long flags; - int i; - - if (size & 0x3) - return -EINVAL; - - tst->mem.size = size; - tst->mem.addr = kmalloc(tst->mem.size, GFP_KERNEL); - if (tst->mem.addr == NULL) - return -ENOMEM; - - /* Hard-coded periphery absolute address */ - if (IWL_ABS_PRPH_START <= addr && - addr < IWL_ABS_PRPH_START + PRPH_END) { - if (!iwl_trans_grab_nic_access(trans, false, &flags)) { - return -EIO; - } - iwl_write32(trans, HBUS_TARG_PRPH_RADDR, - addr | (3 << 24)); - for (i = 0; i < size; i += 4) - *(u32 *)(tst->mem.addr + i) = - iwl_read32(trans, HBUS_TARG_PRPH_RDAT); - iwl_trans_release_nic_access(trans, &flags); - } else { /* target memory (SRAM) */ - iwl_trans_read_mem(trans, addr, tst->mem.addr, - tst->mem.size / 4); - } - - tst->mem.nchunks = - DIV_ROUND_UP(tst->mem.size, DUMP_CHUNK_SIZE); - tst->mem.in_read = true; - return 0; - -} - -/* - * Handles indirect write to the periphery or SRAM. The is performed to a - * temporary buffer. - */ -static int iwl_test_indirect_write(struct iwl_test *tst, u32 addr, - u32 size, unsigned char *buf) -{ - struct iwl_trans *trans = tst->trans; - u32 val, i; - unsigned long flags; - - if (IWL_ABS_PRPH_START <= addr && - addr < IWL_ABS_PRPH_START + PRPH_END) { - /* Periphery writes can be 1-3 bytes long, or DWORDs */ - if (size < 4) { - memcpy(&val, buf, size); - if (!iwl_trans_grab_nic_access(trans, false, &flags)) - return -EIO; - iwl_write32(trans, HBUS_TARG_PRPH_WADDR, - (addr & 0x0000FFFF) | - ((size - 1) << 24)); - iwl_write32(trans, HBUS_TARG_PRPH_WDAT, val); - iwl_trans_release_nic_access(trans, &flags); - } else { - if (size % 4) - return -EINVAL; - for (i = 0; i < size; i += 4) - iwl_write_prph(trans, addr+i, - *(u32 *)(buf+i)); - } - } else if (iwl_test_valid_hw_addr(tst, addr)) { - iwl_trans_write_mem(trans, addr, buf, size / 4); - } else { - return -EINVAL; - } - return 0; -} - -/* - * Handles the user application commands for indirect read/write - * to/from the periphery or the SRAM. - */ -static int iwl_test_indirect_mem(struct iwl_test *tst, struct nlattr **tb) -{ - u32 addr, size, cmd; - unsigned char *buf; - - /* Both read and write should be blocked, for atomicity */ - if (tst->mem.in_read) - return -EBUSY; - - cmd = nla_get_u32(tb[IWL_TM_ATTR_COMMAND]); - if (!tb[IWL_TM_ATTR_MEM_ADDR]) { - IWL_ERR(tst->trans, "Error finding memory offset address\n"); - return -ENOMSG; - } - addr = nla_get_u32(tb[IWL_TM_ATTR_MEM_ADDR]); - if (!tb[IWL_TM_ATTR_BUFFER_SIZE]) { - IWL_ERR(tst->trans, "Error finding size for memory reading\n"); - return -ENOMSG; - } - size = nla_get_u32(tb[IWL_TM_ATTR_BUFFER_SIZE]); - - if (cmd == IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_READ) { - return iwl_test_indirect_read(tst, addr, size); - } else { - if (!tb[IWL_TM_ATTR_BUFFER_DUMP]) - return -EINVAL; - buf = (unsigned char *)nla_data(tb[IWL_TM_ATTR_BUFFER_DUMP]); - return iwl_test_indirect_write(tst, addr, size, buf); - } -} - -/* - * Enable notifications to user space - */ -static int iwl_test_notifications(struct iwl_test *tst, - struct nlattr **tb) -{ - tst->notify = nla_get_flag(tb[IWL_TM_ATTR_ENABLE_NOTIFICATION]); - return 0; -} - -/* - * Handles the request to get the device id - */ -static int iwl_test_get_dev_id(struct iwl_test *tst, struct nlattr **tb) -{ - u32 devid = tst->trans->hw_id; - struct sk_buff *skb; - int status; - - IWL_DEBUG_INFO(tst->trans, "hw version: 0x%x\n", devid); - - skb = iwl_test_alloc_reply(tst, 20); - if (!skb) { - IWL_ERR(tst->trans, "Memory allocation fail\n"); - return -ENOMEM; - } - - if (nla_put_u32(skb, IWL_TM_ATTR_DEVICE_ID, devid)) - goto nla_put_failure; - status = iwl_test_reply(tst, skb); - if (status < 0) - IWL_ERR(tst->trans, "Error sending msg : %d\n", status); - - return 0; - -nla_put_failure: - kfree_skb(skb); - return -EMSGSIZE; -} - -/* - * Handles the request to get the FW version - */ -static int iwl_test_get_fw_ver(struct iwl_test *tst, struct nlattr **tb) -{ - struct sk_buff *skb; - int status; - u32 ver = iwl_test_fw_ver(tst); - - IWL_DEBUG_INFO(tst->trans, "uCode version raw: 0x%x\n", ver); - - skb = iwl_test_alloc_reply(tst, 20); - if (!skb) { - IWL_ERR(tst->trans, "Memory allocation fail\n"); - return -ENOMEM; - } - - if (nla_put_u32(skb, IWL_TM_ATTR_FW_VERSION, ver)) - goto nla_put_failure; - - status = iwl_test_reply(tst, skb); - if (status < 0) - IWL_ERR(tst->trans, "Error sending msg : %d\n", status); - - return 0; - -nla_put_failure: - kfree_skb(skb); - return -EMSGSIZE; -} - -/* - * Parse the netlink message and validate that the IWL_TM_ATTR_CMD exists - */ -int iwl_test_parse(struct iwl_test *tst, struct nlattr **tb, - void *data, int len) -{ - int result; - - result = nla_parse(tb, IWL_TM_ATTR_MAX - 1, data, len, - iwl_testmode_gnl_msg_policy); - if (result) { - IWL_ERR(tst->trans, "Fail parse gnl msg: %d\n", result); - return result; - } - - /* IWL_TM_ATTR_COMMAND is absolutely mandatory */ - if (!tb[IWL_TM_ATTR_COMMAND]) { - IWL_ERR(tst->trans, "Missing testmode command type\n"); - return -ENOMSG; - } - return 0; -} -IWL_EXPORT_SYMBOL(iwl_test_parse); - -/* - * Handle test commands. - * Returns 1 for unknown commands (not handled by the test object); negative - * value in case of error. - */ -int iwl_test_handle_cmd(struct iwl_test *tst, struct nlattr **tb) -{ - int result; - - switch (nla_get_u32(tb[IWL_TM_ATTR_COMMAND])) { - case IWL_TM_CMD_APP2DEV_UCODE: - IWL_DEBUG_INFO(tst->trans, "test cmd to uCode\n"); - result = iwl_test_fw_cmd(tst, tb); - break; - - case IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32: - case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE32: - case IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8: - IWL_DEBUG_INFO(tst->trans, "test cmd to register\n"); - result = iwl_test_reg(tst, tb); - break; - - case IWL_TM_CMD_APP2DEV_BEGIN_TRACE: - IWL_DEBUG_INFO(tst->trans, "test uCode trace cmd to driver\n"); - result = iwl_test_trace_begin(tst, tb); - break; - - case IWL_TM_CMD_APP2DEV_END_TRACE: - iwl_test_trace_stop(tst); - result = 0; - break; - - case IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_READ: - case IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_WRITE: - IWL_DEBUG_INFO(tst->trans, "test indirect memory cmd\n"); - result = iwl_test_indirect_mem(tst, tb); - break; - - case IWL_TM_CMD_APP2DEV_NOTIFICATIONS: - IWL_DEBUG_INFO(tst->trans, "test notifications cmd\n"); - result = iwl_test_notifications(tst, tb); - break; - - case IWL_TM_CMD_APP2DEV_GET_FW_VERSION: - IWL_DEBUG_INFO(tst->trans, "test get FW ver cmd\n"); - result = iwl_test_get_fw_ver(tst, tb); - break; - - case IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: - IWL_DEBUG_INFO(tst->trans, "test Get device ID cmd\n"); - result = iwl_test_get_dev_id(tst, tb); - break; - - default: - IWL_DEBUG_INFO(tst->trans, "Unknown test command\n"); - result = 1; - break; - } - return result; -} -IWL_EXPORT_SYMBOL(iwl_test_handle_cmd); - -static int iwl_test_trace_dump(struct iwl_test *tst, struct sk_buff *skb, - struct netlink_callback *cb) -{ - int idx, length; - - if (!tst->trace.enabled || !tst->trace.trace_addr) - return -EFAULT; - - idx = cb->args[4]; - if (idx >= tst->trace.nchunks) - return -ENOENT; - - length = DUMP_CHUNK_SIZE; - if (((idx + 1) == tst->trace.nchunks) && - (tst->trace.size % DUMP_CHUNK_SIZE)) - length = tst->trace.size % - DUMP_CHUNK_SIZE; - - if (nla_put(skb, IWL_TM_ATTR_TRACE_DUMP, length, - tst->trace.trace_addr + (DUMP_CHUNK_SIZE * idx))) - goto nla_put_failure; - - cb->args[4] = ++idx; - return 0; - - nla_put_failure: - return -ENOBUFS; -} - -static int iwl_test_buffer_dump(struct iwl_test *tst, struct sk_buff *skb, - struct netlink_callback *cb) -{ - int idx, length; - - if (!tst->mem.in_read) - return -EFAULT; - - idx = cb->args[4]; - if (idx >= tst->mem.nchunks) { - iwl_test_mem_stop(tst); - return -ENOENT; - } - - length = DUMP_CHUNK_SIZE; - if (((idx + 1) == tst->mem.nchunks) && - (tst->mem.size % DUMP_CHUNK_SIZE)) - length = tst->mem.size % DUMP_CHUNK_SIZE; - - if (nla_put(skb, IWL_TM_ATTR_BUFFER_DUMP, length, - tst->mem.addr + (DUMP_CHUNK_SIZE * idx))) - goto nla_put_failure; - - cb->args[4] = ++idx; - return 0; - - nla_put_failure: - return -ENOBUFS; -} - -/* - * Handle dump commands. - * Returns 1 for unknown commands (not handled by the test object); negative - * value in case of error. - */ -int iwl_test_dump(struct iwl_test *tst, u32 cmd, struct sk_buff *skb, - struct netlink_callback *cb) -{ - int result; - - switch (cmd) { - case IWL_TM_CMD_APP2DEV_READ_TRACE: - IWL_DEBUG_INFO(tst->trans, "uCode trace cmd\n"); - result = iwl_test_trace_dump(tst, skb, cb); - break; - - case IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_DUMP: - IWL_DEBUG_INFO(tst->trans, "testmode sram dump cmd\n"); - result = iwl_test_buffer_dump(tst, skb, cb); - break; - - default: - result = 1; - break; - } - return result; -} -IWL_EXPORT_SYMBOL(iwl_test_dump); - -/* - * Multicast a spontaneous messages from the device to the user space. - */ -static void iwl_test_send_rx(struct iwl_test *tst, - struct iwl_rx_cmd_buffer *rxb) -{ - struct sk_buff *skb; - struct iwl_rx_packet *data; - int length; - - data = rxb_addr(rxb); - length = le32_to_cpu(data->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; - - /* the length doesn't include len_n_flags field, so add it manually */ - length += sizeof(__le32); - - skb = iwl_test_alloc_event(tst, length + 20); - if (skb == NULL) { - IWL_ERR(tst->trans, "Out of memory for message to user\n"); - return; - } - - if (nla_put_u32(skb, IWL_TM_ATTR_COMMAND, - IWL_TM_CMD_DEV2APP_UCODE_RX_PKT) || - nla_put(skb, IWL_TM_ATTR_UCODE_RX_PKT, length, data)) - goto nla_put_failure; - - iwl_test_event(tst, skb); - return; - -nla_put_failure: - kfree_skb(skb); - IWL_ERR(tst->trans, "Ouch, overran buffer, check allocation!\n"); -} - -/* - * Called whenever a Rx frames is recevied from the device. If notifications to - * the user space are requested, sends the frames to the user. - */ -void iwl_test_rx(struct iwl_test *tst, struct iwl_rx_cmd_buffer *rxb) -{ - if (tst->notify) - iwl_test_send_rx(tst, rxb); -} -IWL_EXPORT_SYMBOL(iwl_test_rx); diff --git a/drivers/net/wireless/iwlwifi/iwl-test.h b/drivers/net/wireless/iwlwifi/iwl-test.h deleted file mode 100644 index 8fbd21704840..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-test.h +++ /dev/null @@ -1,161 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2010 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2010 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#ifndef __IWL_TEST_H__ -#define __IWL_TEST_H__ - -#include -#include "iwl-trans.h" - -struct iwl_test_trace { - u32 size; - u32 tsize; - u32 nchunks; - u8 *cpu_addr; - u8 *trace_addr; - dma_addr_t dma_addr; - bool enabled; -}; - -struct iwl_test_mem { - u32 size; - u32 nchunks; - u8 *addr; - bool in_read; -}; - -/* - * struct iwl_test_ops: callback to the op mode - * - * The structure defines the callbacks that the op_mode should handle, - * inorder to handle logic that is out of the scope of iwl_test. The - * op_mode must set all the callbacks. - - * @send_cmd: handler that is used by the test object to request the - * op_mode to send a command to the fw. - * - * @valid_hw_addr: handler that is used by the test object to request the - * op_mode to check if the given address is a valid address. - * - * @get_fw_ver: handler used to get the FW version. - * - * @alloc_reply: handler used by the test object to request the op_mode - * to allocate an skb for sending a reply to the user, and initialize - * the skb. It is assumed that the test object only fills the required - * attributes. - * - * @reply: handler used by the test object to request the op_mode to reply - * to a request. The skb is an skb previously allocated by the the - * alloc_reply callback. - I - * @alloc_event: handler used by the test object to request the op_mode - * to allocate an skb for sending an event, and initialize - * the skb. It is assumed that the test object only fills the required - * attributes. - * - * @reply: handler used by the test object to request the op_mode to send - * an event. The skb is an skb previously allocated by the the - * alloc_event callback. - */ -struct iwl_test_ops { - int (*send_cmd)(struct iwl_op_mode *op_modes, - struct iwl_host_cmd *cmd); - bool (*valid_hw_addr)(u32 addr); - u32 (*get_fw_ver)(struct iwl_op_mode *op_mode); - - struct sk_buff *(*alloc_reply)(struct iwl_op_mode *op_mode, int len); - int (*reply)(struct iwl_op_mode *op_mode, struct sk_buff *skb); - struct sk_buff* (*alloc_event)(struct iwl_op_mode *op_mode, int len); - void (*event)(struct iwl_op_mode *op_mode, struct sk_buff *skb); -}; - -struct iwl_test { - struct iwl_trans *trans; - struct iwl_test_ops *ops; - struct iwl_test_trace trace; - struct iwl_test_mem mem; - bool notify; -}; - -void iwl_test_init(struct iwl_test *tst, struct iwl_trans *trans, - struct iwl_test_ops *ops); - -void iwl_test_free(struct iwl_test *tst); - -int iwl_test_parse(struct iwl_test *tst, struct nlattr **tb, - void *data, int len); - -int iwl_test_handle_cmd(struct iwl_test *tst, struct nlattr **tb); - -int iwl_test_dump(struct iwl_test *tst, u32 cmd, struct sk_buff *skb, - struct netlink_callback *cb); - -void iwl_test_rx(struct iwl_test *tst, struct iwl_rx_cmd_buffer *rxb); - -static inline void iwl_test_enable_notifications(struct iwl_test *tst, - bool enable) -{ - tst->notify = enable; -} - -#endif diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.h b/drivers/net/wireless/iwlwifi/iwl-testmode.h deleted file mode 100644 index 98f48a9afc98..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-testmode.h +++ /dev/null @@ -1,309 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2010 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2010 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#ifndef __IWL_TESTMODE_H__ -#define __IWL_TESTMODE_H__ - -#include - - -/* - * Commands from user space to kernel space(IWL_TM_CMD_ID_APP2DEV_XX) and - * from and kernel space to user space(IWL_TM_CMD_ID_DEV2APP_XX). - * The command ID is carried with IWL_TM_ATTR_COMMAND. - * - * @IWL_TM_CMD_APP2DEV_UCODE: - * commands from user application to the uCode, - * the actual uCode host command ID is carried with - * IWL_TM_ATTR_UCODE_CMD_ID - * - * @IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32: - * @IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE32: - * @IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8: - * commands from user applicaiton to access register - * - * @IWL_TM_CMD_APP2DEV_GET_DEVICENAME: retrieve device name - * @IWL_TM_CMD_APP2DEV_LOAD_INIT_FW: load initial uCode image - * @IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB: perform calibration - * @IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW: load runtime uCode image - * @IWL_TM_CMD_APP2DEV_GET_EEPROM: request EEPROM data - * @IWL_TM_CMD_APP2DEV_FIXRATE_REQ: set fix MCS - * commands fom user space for pure driver level operations - * - * @IWL_TM_CMD_APP2DEV_BEGIN_TRACE: - * @IWL_TM_CMD_APP2DEV_END_TRACE: - * @IWL_TM_CMD_APP2DEV_READ_TRACE: - * commands fom user space for uCode trace operations - * - * @IWL_TM_CMD_DEV2APP_SYNC_RSP: - * commands from kernel space to carry the synchronous response - * to user application - * @IWL_TM_CMD_DEV2APP_UCODE_RX_PKT: - * commands from kernel space to multicast the spontaneous messages - * to user application, or reply of host commands - * @IWL_TM_CMD_DEV2APP_EEPROM_RSP: - * commands from kernel space to carry the eeprom response - * to user application - * - * @IWL_TM_CMD_APP2DEV_OWNERSHIP: - * commands from user application to own change the ownership of the uCode - * if application has the ownership, the only host command from - * testmode will deliver to uCode. Default owner is driver - * - * @IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW: load Wake On Wireless LAN uCode image - * @IWL_TM_CMD_APP2DEV_GET_FW_VERSION: retrieve uCode version - * @IWL_TM_CMD_APP2DEV_GET_DEVICE_ID: retrieve ID information in device - * @IWL_TM_CMD_APP2DEV_GET_FW_INFO: - * retrieve information of existing loaded uCode image - * - * @IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_READ: - * @IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_DUMP: - * @IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_WRITE: - * Commands to read/write data from periphery or SRAM memory ranges. - * Fore reading, a READ command is sent from the userspace and the data - * is returned when the user calls a DUMP command. - * For writing, only a WRITE command is used. - * @IWL_TM_CMD_APP2DEV_NOTIFICATIONS: - * Command to enable/disable notifications (currently RX packets) from the - * driver to userspace. - */ -enum iwl_tm_cmd_t { - IWL_TM_CMD_APP2DEV_UCODE = 1, - IWL_TM_CMD_APP2DEV_DIRECT_REG_READ32 = 2, - IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE32 = 3, - IWL_TM_CMD_APP2DEV_DIRECT_REG_WRITE8 = 4, - IWL_TM_CMD_APP2DEV_GET_DEVICENAME = 5, - IWL_TM_CMD_APP2DEV_LOAD_INIT_FW = 6, - IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB = 7, - IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW = 8, - IWL_TM_CMD_APP2DEV_GET_EEPROM = 9, - IWL_TM_CMD_APP2DEV_FIXRATE_REQ = 10, - IWL_TM_CMD_APP2DEV_BEGIN_TRACE = 11, - IWL_TM_CMD_APP2DEV_END_TRACE = 12, - IWL_TM_CMD_APP2DEV_READ_TRACE = 13, - IWL_TM_CMD_DEV2APP_SYNC_RSP = 14, - IWL_TM_CMD_DEV2APP_UCODE_RX_PKT = 15, - IWL_TM_CMD_DEV2APP_EEPROM_RSP = 16, - IWL_TM_CMD_APP2DEV_OWNERSHIP = 17, - RESERVED_18 = 18, - RESERVED_19 = 19, - RESERVED_20 = 20, - RESERVED_21 = 21, - IWL_TM_CMD_APP2DEV_LOAD_WOWLAN_FW = 22, - IWL_TM_CMD_APP2DEV_GET_FW_VERSION = 23, - IWL_TM_CMD_APP2DEV_GET_DEVICE_ID = 24, - IWL_TM_CMD_APP2DEV_GET_FW_INFO = 25, - IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_READ = 26, - IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_DUMP = 27, - IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_WRITE = 28, - IWL_TM_CMD_APP2DEV_NOTIFICATIONS = 29, - IWL_TM_CMD_MAX = 30, -}; - -/* - * Atrribute filed in testmode command - * See enum iwl_tm_cmd_t. - * - * @IWL_TM_ATTR_NOT_APPLICABLE: - * The attribute is not applicable or invalid - * @IWL_TM_ATTR_COMMAND: - * From user space to kernel space: - * the command either destines to ucode, driver, or register; - * From kernel space to user space: - * the command either carries synchronous response, - * or the spontaneous message multicast from the device; - * - * @IWL_TM_ATTR_UCODE_CMD_ID: - * @IWL_TM_ATTR_UCODE_CMD_DATA: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_UCODE, - * The mandatory fields are : - * IWL_TM_ATTR_UCODE_CMD_ID for recognizable command ID; - * IWL_TM_ATTR_UCODE_CMD_DATA for the actual command payload - * to the ucode - * - * @IWL_TM_ATTR_REG_OFFSET: - * @IWL_TM_ATTR_REG_VALUE8: - * @IWL_TM_ATTR_REG_VALUE32: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_REG_XXX, - * The mandatory fields are: - * IWL_TM_ATTR_REG_OFFSET for the offset of the target register; - * IWL_TM_ATTR_REG_VALUE8 or IWL_TM_ATTR_REG_VALUE32 for value - * - * @IWL_TM_ATTR_SYNC_RSP: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_SYNC_RSP, - * The mandatory fields are: - * IWL_TM_ATTR_SYNC_RSP for the data content responding to the user - * application command - * - * @IWL_TM_ATTR_UCODE_RX_PKT: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_UCODE_RX_PKT, - * The mandatory fields are: - * IWL_TM_ATTR_UCODE_RX_PKT for the data content multicast to the user - * application - * - * @IWL_TM_ATTR_EEPROM: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_EEPROM, - * The mandatory fields are: - * IWL_TM_ATTR_EEPROM for the data content responging to the user - * application - * - * @IWL_TM_ATTR_TRACE_ADDR: - * @IWL_TM_ATTR_TRACE_SIZE: - * @IWL_TM_ATTR_TRACE_DUMP: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_XXX_TRACE, - * The mandatory fields are: - * IWL_TM_ATTR_MEM_TRACE_ADDR for the trace address - * IWL_TM_ATTR_MEM_TRACE_SIZE for the trace buffer size - * IWL_TM_ATTR_MEM_TRACE_DUMP for the trace dump - * - * @IWL_TM_ATTR_FIXRATE: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_FIXRATE_REQ, - * The mandatory fields are: - * IWL_TM_ATTR_FIXRATE for the fixed rate - * - * @IWL_TM_ATTR_UCODE_OWNER: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_OWNERSHIP, - * The mandatory fields are: - * IWL_TM_ATTR_UCODE_OWNER for the new owner - * - * @IWL_TM_ATTR_MEM_ADDR: - * @IWL_TM_ATTR_BUFFER_SIZE: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_READ - * or IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_WRITE. - * The mandatory fields are: - * IWL_TM_ATTR_MEM_ADDR for the address in SRAM/periphery to read/write - * IWL_TM_ATTR_BUFFER_SIZE for the buffer size of data to read/write. - * - * @IWL_TM_ATTR_BUFFER_DUMP: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_DUMP, - * IWL_TM_ATTR_BUFFER_DUMP is used for the data that was read. - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_INDIRECT_BUFFER_WRITE, - * this attribute contains the data to write. - * - * @IWL_TM_ATTR_FW_VERSION: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_GET_FW_VERSION, - * IWL_TM_ATTR_FW_VERSION for the uCode version - * - * @IWL_TM_ATTR_DEVICE_ID: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_GET_DEVICE_ID, - * IWL_TM_ATTR_DEVICE_ID for the device ID information - * - * @IWL_TM_ATTR_FW_TYPE: - * @IWL_TM_ATTR_FW_INST_SIZE: - * @IWL_TM_ATTR_FW_DATA_SIZE: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_GET_FW_INFO, - * The mandatory fields are: - * IWL_TM_ATTR_FW_TYPE for the uCode type (INIT/RUNTIME/...) - * IWL_TM_ATTR_FW_INST_SIZE for the size of instruction section - * IWL_TM_ATTR_FW_DATA_SIZE for the size of data section - * - * @IWL_TM_ATTR_UCODE_CMD_SKB: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_UCODE this flag - * indicates that the user wants to receive the response of the command - * in a reply SKB. If it's not present, the response is not returned. - * @IWL_TM_ATTR_ENABLE_NOTIFICATIONS: - * When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_NOTIFICATIONS, this - * flag enables (if present) or disables (if not) the forwarding - * to userspace. - */ -enum iwl_tm_attr_t { - IWL_TM_ATTR_NOT_APPLICABLE = 0, - IWL_TM_ATTR_COMMAND = 1, - IWL_TM_ATTR_UCODE_CMD_ID = 2, - IWL_TM_ATTR_UCODE_CMD_DATA = 3, - IWL_TM_ATTR_REG_OFFSET = 4, - IWL_TM_ATTR_REG_VALUE8 = 5, - IWL_TM_ATTR_REG_VALUE32 = 6, - IWL_TM_ATTR_SYNC_RSP = 7, - IWL_TM_ATTR_UCODE_RX_PKT = 8, - IWL_TM_ATTR_EEPROM = 9, - IWL_TM_ATTR_TRACE_ADDR = 10, - IWL_TM_ATTR_TRACE_SIZE = 11, - IWL_TM_ATTR_TRACE_DUMP = 12, - IWL_TM_ATTR_FIXRATE = 13, - IWL_TM_ATTR_UCODE_OWNER = 14, - IWL_TM_ATTR_MEM_ADDR = 15, - IWL_TM_ATTR_BUFFER_SIZE = 16, - IWL_TM_ATTR_BUFFER_DUMP = 17, - IWL_TM_ATTR_FW_VERSION = 18, - IWL_TM_ATTR_DEVICE_ID = 19, - IWL_TM_ATTR_FW_TYPE = 20, - IWL_TM_ATTR_FW_INST_SIZE = 21, - IWL_TM_ATTR_FW_DATA_SIZE = 22, - IWL_TM_ATTR_UCODE_CMD_SKB = 23, - IWL_TM_ATTR_ENABLE_NOTIFICATION = 24, - IWL_TM_ATTR_MAX = 25, -}; - -/* uCode trace buffer */ -#define TRACE_BUFF_SIZE_MAX 0x200000 -#define TRACE_BUFF_SIZE_MIN 0x20000 -#define TRACE_BUFF_SIZE_DEF TRACE_BUFF_SIZE_MIN -#define TRACE_BUFF_PADD 0x2000 - -/* Maximum data size of each dump it packet */ -#define DUMP_CHUNK_SIZE (PAGE_SIZE - 1024) - -/* Address offset of data segment in SRAM */ -#define SRAM_DATA_SEG_OFFSET 0x800000 - -#endif diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h deleted file mode 100644 index 72d2ecce0b8d..000000000000 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ /dev/null @@ -1,815 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2007 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#ifndef __iwl_trans_h__ -#define __iwl_trans_h__ - -#include -#include /* for page_address */ -#include - -#include "iwl-debug.h" -#include "iwl-config.h" -#include "iwl-fw.h" - -/** - * DOC: Transport layer - what is it ? - * - * The tranport layer is the layer that deals with the HW directly. It provides - * an abstraction of the underlying HW to the upper layer. The transport layer - * doesn't provide any policy, algorithm or anything of this kind, but only - * mechanisms to make the HW do something.It is not completely stateless but - * close to it. - * We will have an implementation for each different supported bus. - */ - -/** - * DOC: Life cycle of the transport layer - * - * The transport layer has a very precise life cycle. - * - * 1) A helper function is called during the module initialization and - * registers the bus driver's ops with the transport's alloc function. - * 2) Bus's probe calls to the transport layer's allocation functions. - * Of course this function is bus specific. - * 3) This allocation functions will spawn the upper layer which will - * register mac80211. - * - * 4) At some point (i.e. mac80211's start call), the op_mode will call - * the following sequence: - * start_hw - * start_fw - * - * 5) Then when finished (or reset): - * stop_fw (a.k.a. stop device for the moment) - * stop_hw - * - * 6) Eventually, the free function will be called. - */ - -/** - * DOC: Host command section - * - * A host command is a commaned issued by the upper layer to the fw. There are - * several versions of fw that have several APIs. The transport layer is - * completely agnostic to these differences. - * The transport does provide helper functionnality (i.e. SYNC / ASYNC mode), - */ -#define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f) -#define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8) -#define SEQ_TO_INDEX(s) ((s) & 0xff) -#define INDEX_TO_SEQ(i) ((i) & 0xff) -#define SEQ_RX_FRAME cpu_to_le16(0x8000) - -/** - * struct iwl_cmd_header - * - * This header format appears in the beginning of each command sent from the - * driver, and each response/notification received from uCode. - */ -struct iwl_cmd_header { - u8 cmd; /* Command ID: REPLY_RXON, etc. */ - u8 flags; /* 0:5 reserved, 6 abort, 7 internal */ - /* - * The driver sets up the sequence number to values of its choosing. - * uCode does not use this value, but passes it back to the driver - * when sending the response to each driver-originated command, so - * the driver can match the response to the command. Since the values - * don't get used by uCode, the driver may set up an arbitrary format. - * - * There is one exception: uCode sets bit 15 when it originates - * the response/notification, i.e. when the response/notification - * is not a direct response to a command sent by the driver. For - * example, uCode issues REPLY_RX when it sends a received frame - * to the driver; it is not a direct response to any driver command. - * - * The Linux driver uses the following format: - * - * 0:7 tfd index - position within TX queue - * 8:12 TX queue id - * 13:14 reserved - * 15 unsolicited RX or uCode-originated notification - */ - __le16 sequence; -} __packed; - -/* iwl_cmd_header flags value */ -#define IWL_CMD_FAILED_MSK 0x40 - - -#define FH_RSCSR_FRAME_SIZE_MSK 0x00003FFF /* bits 0-13 */ -#define FH_RSCSR_FRAME_INVALID 0x55550000 -#define FH_RSCSR_FRAME_ALIGN 0x40 - -struct iwl_rx_packet { - /* - * The first 4 bytes of the RX frame header contain both the RX frame - * size and some flags. - * Bit fields: - * 31: flag flush RB request - * 30: flag ignore TC (terminal counter) request - * 29: flag fast IRQ request - * 28-14: Reserved - * 13-00: RX frame size - */ - __le32 len_n_flags; - struct iwl_cmd_header hdr; - u8 data[]; -} __packed; - -/** - * enum CMD_MODE - how to send the host commands ? - * - * @CMD_SYNC: The caller will be stalled until the fw responds to the command - * @CMD_ASYNC: Return right away and don't want for the response - * @CMD_WANT_SKB: valid only with CMD_SYNC. The caller needs the buffer of the - * response. The caller needs to call iwl_free_resp when done. - * @CMD_ON_DEMAND: This command is sent by the test mode pipe. - */ -enum CMD_MODE { - CMD_SYNC = 0, - CMD_ASYNC = BIT(0), - CMD_WANT_SKB = BIT(1), - CMD_ON_DEMAND = BIT(2), -}; - -#define DEF_CMD_PAYLOAD_SIZE 320 - -/** - * struct iwl_device_cmd - * - * For allocation of the command and tx queues, this establishes the overall - * size of the largest command we send to uCode, except for commands that - * aren't fully copied and use other TFD space. - */ -struct iwl_device_cmd { - struct iwl_cmd_header hdr; /* uCode API */ - u8 payload[DEF_CMD_PAYLOAD_SIZE]; -} __packed; - -#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd)) - -/* - * number of transfer buffers (fragments) per transmit frame descriptor; - * this is just the driver's idea, the hardware supports 20 - */ -#define IWL_MAX_CMD_TBS_PER_TFD 2 - -/** - * struct iwl_hcmd_dataflag - flag for each one of the chunks of the command - * - * @IWL_HCMD_DFL_NOCOPY: By default, the command is copied to the host command's - * ring. The transport layer doesn't map the command's buffer to DMA, but - * rather copies it to an previously allocated DMA buffer. This flag tells - * the transport layer not to copy the command, but to map the existing - * buffer (that is passed in) instead. This saves the memcpy and allows - * commands that are bigger than the fixed buffer to be submitted. - * Note that a TFD entry after a NOCOPY one cannot be a normal copied one. - * @IWL_HCMD_DFL_DUP: Only valid without NOCOPY, duplicate the memory for this - * chunk internally and free it again after the command completes. This - * can (currently) be used only once per command. - * Note that a TFD entry after a DUP one cannot be a normal copied one. - */ -enum iwl_hcmd_dataflag { - IWL_HCMD_DFL_NOCOPY = BIT(0), - IWL_HCMD_DFL_DUP = BIT(1), -}; - -/** - * struct iwl_host_cmd - Host command to the uCode - * - * @data: array of chunks that composes the data of the host command - * @resp_pkt: response packet, if %CMD_WANT_SKB was set - * @_rx_page_order: (internally used to free response packet) - * @_rx_page_addr: (internally used to free response packet) - * @handler_status: return value of the handler of the command - * (put in setup_rx_handlers) - valid for SYNC mode only - * @flags: can be CMD_* - * @len: array of the lenths of the chunks in data - * @dataflags: IWL_HCMD_DFL_* - * @id: id of the host command - */ -struct iwl_host_cmd { - const void *data[IWL_MAX_CMD_TBS_PER_TFD]; - struct iwl_rx_packet *resp_pkt; - unsigned long _rx_page_addr; - u32 _rx_page_order; - int handler_status; - - u32 flags; - u16 len[IWL_MAX_CMD_TBS_PER_TFD]; - u8 dataflags[IWL_MAX_CMD_TBS_PER_TFD]; - u8 id; -}; - -static inline void iwl_free_resp(struct iwl_host_cmd *cmd) -{ - free_pages(cmd->_rx_page_addr, cmd->_rx_page_order); -} - -struct iwl_rx_cmd_buffer { - struct page *_page; - int _offset; - bool _page_stolen; - u32 _rx_page_order; - unsigned int truesize; -}; - -static inline void *rxb_addr(struct iwl_rx_cmd_buffer *r) -{ - return (void *)((unsigned long)page_address(r->_page) + r->_offset); -} - -static inline int rxb_offset(struct iwl_rx_cmd_buffer *r) -{ - return r->_offset; -} - -static inline struct page *rxb_steal_page(struct iwl_rx_cmd_buffer *r) -{ - r->_page_stolen = true; - get_page(r->_page); - return r->_page; -} - -static inline void iwl_free_rxb(struct iwl_rx_cmd_buffer *r) -{ - __free_pages(r->_page, r->_rx_page_order); -} - -#define MAX_NO_RECLAIM_CMDS 6 - -#define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) - -/* - * Maximum number of HW queues the transport layer - * currently supports - */ -#define IWL_MAX_HW_QUEUES 32 -#define IWL_MAX_TID_COUNT 8 -#define IWL_FRAME_LIMIT 64 - -/** - * enum iwl_wowlan_status - WoWLAN image/device status - * @IWL_D3_STATUS_ALIVE: firmware is still running after resume - * @IWL_D3_STATUS_RESET: device was reset while suspended - */ -enum iwl_d3_status { - IWL_D3_STATUS_ALIVE, - IWL_D3_STATUS_RESET, -}; - -/** - * struct iwl_trans_config - transport configuration - * - * @op_mode: pointer to the upper layer. - * @cmd_queue: the index of the command queue. - * Must be set before start_fw. - * @cmd_fifo: the fifo for host commands - * @no_reclaim_cmds: Some devices erroneously don't set the - * SEQ_RX_FRAME bit on some notifications, this is the - * list of such notifications to filter. Max length is - * %MAX_NO_RECLAIM_CMDS. - * @n_no_reclaim_cmds: # of commands in list - * @rx_buf_size_8k: 8 kB RX buffer size needed for A-MSDUs, - * if unset 4k will be the RX buffer size - * @bc_table_dword: set to true if the BC table expects the byte count to be - * in DWORD (as opposed to bytes) - * @queue_watchdog_timeout: time (in ms) after which queues - * are considered stuck and will trigger device restart - * @command_names: array of command names, must be 256 entries - * (one for each command); for debugging only - */ -struct iwl_trans_config { - struct iwl_op_mode *op_mode; - - u8 cmd_queue; - u8 cmd_fifo; - const u8 *no_reclaim_cmds; - int n_no_reclaim_cmds; - - bool rx_buf_size_8k; - bool bc_table_dword; - unsigned int queue_watchdog_timeout; - const char **command_names; -}; - -struct iwl_trans; - -/** - * struct iwl_trans_ops - transport specific operations - * - * All the handlers MUST be implemented - * - * @start_hw: starts the HW- from that point on, the HW can send interrupts - * May sleep - * @stop_hw: stops the HW- from that point on, the HW will be in low power but - * will still issue interrupt if the HW RF kill is triggered unless - * op_mode_leaving is true. - * May sleep - * @start_fw: allocates and inits all the resources for the transport - * layer. Also kick a fw image. - * May sleep - * @fw_alive: called when the fw sends alive notification. If the fw provides - * the SCD base address in SRAM, then provide it here, or 0 otherwise. - * May sleep - * @stop_device:stops the whole device (embedded CPU put to reset) - * May sleep - * @d3_suspend: put the device into the correct mode for WoWLAN during - * suspend. This is optional, if not implemented WoWLAN will not be - * supported. This callback may sleep. - * @d3_resume: resume the device after WoWLAN, enabling the opmode to - * talk to the WoWLAN image to get its status. This is optional, if not - * implemented WoWLAN will not be supported. This callback may sleep. - * @send_cmd:send a host command. Must return -ERFKILL if RFkill is asserted. - * If RFkill is asserted in the middle of a SYNC host command, it must - * return -ERFKILL straight away. - * May sleep only if CMD_SYNC is set - * @tx: send an skb - * Must be atomic - * @reclaim: free packet until ssn. Returns a list of freed packets. - * Must be atomic - * @txq_enable: setup a queue. To setup an AC queue, use the - * iwl_trans_ac_txq_enable wrapper. fw_alive must have been called before - * this one. The op_mode must not configure the HCMD queue. May sleep. - * @txq_disable: de-configure a Tx queue to send AMPDUs - * Must be atomic - * @wait_tx_queue_empty: wait until all tx queues are empty - * May sleep - * @dbgfs_register: add the dbgfs files under this directory. Files will be - * automatically deleted. - * @suspend: stop the device unless WoWLAN is configured - * @resume: resume activity of the device - * @write8: write a u8 to a register at offset ofs from the BAR - * @write32: write a u32 to a register at offset ofs from the BAR - * @read32: read a u32 register at offset ofs from the BAR - * @read_prph: read a DWORD from a periphery register - * @write_prph: write a DWORD to a periphery register - * @read_mem: read device's SRAM in DWORD - * @write_mem: write device's SRAM in DWORD. If %buf is %NULL, then the memory - * will be zeroed. - * @configure: configure parameters required by the transport layer from - * the op_mode. May be called several times before start_fw, can't be - * called after that. - * @set_pmi: set the power pmi state - * @grab_nic_access: wake the NIC to be able to access non-HBUS regs. - * Sleeping is not allowed between grab_nic_access and - * release_nic_access. - * @release_nic_access: let the NIC go to sleep. The "flags" parameter - * must be the same one that was sent before to the grab_nic_access. - * @set_bits_mask - set SRAM register according to value and mask. - */ -struct iwl_trans_ops { - - int (*start_hw)(struct iwl_trans *iwl_trans); - void (*stop_hw)(struct iwl_trans *iwl_trans, bool op_mode_leaving); - int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw, - bool run_in_rfkill); - void (*fw_alive)(struct iwl_trans *trans, u32 scd_addr); - void (*stop_device)(struct iwl_trans *trans); - - void (*d3_suspend)(struct iwl_trans *trans); - int (*d3_resume)(struct iwl_trans *trans, enum iwl_d3_status *status); - - int (*send_cmd)(struct iwl_trans *trans, struct iwl_host_cmd *cmd); - - int (*tx)(struct iwl_trans *trans, struct sk_buff *skb, - struct iwl_device_cmd *dev_cmd, int queue); - void (*reclaim)(struct iwl_trans *trans, int queue, int ssn, - struct sk_buff_head *skbs); - - void (*txq_enable)(struct iwl_trans *trans, int queue, int fifo, - int sta_id, int tid, int frame_limit, u16 ssn); - void (*txq_disable)(struct iwl_trans *trans, int queue); - - int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir); - int (*wait_tx_queue_empty)(struct iwl_trans *trans); -#ifdef CONFIG_PM_SLEEP - int (*suspend)(struct iwl_trans *trans); - int (*resume)(struct iwl_trans *trans); -#endif - void (*write8)(struct iwl_trans *trans, u32 ofs, u8 val); - void (*write32)(struct iwl_trans *trans, u32 ofs, u32 val); - u32 (*read32)(struct iwl_trans *trans, u32 ofs); - u32 (*read_prph)(struct iwl_trans *trans, u32 ofs); - void (*write_prph)(struct iwl_trans *trans, u32 ofs, u32 val); - int (*read_mem)(struct iwl_trans *trans, u32 addr, - void *buf, int dwords); - int (*write_mem)(struct iwl_trans *trans, u32 addr, - void *buf, int dwords); - void (*configure)(struct iwl_trans *trans, - const struct iwl_trans_config *trans_cfg); - void (*set_pmi)(struct iwl_trans *trans, bool state); - bool (*grab_nic_access)(struct iwl_trans *trans, bool silent, - unsigned long *flags); - void (*release_nic_access)(struct iwl_trans *trans, - unsigned long *flags); - void (*set_bits_mask)(struct iwl_trans *trans, u32 reg, u32 mask, - u32 value); -}; - -/** - * enum iwl_trans_state - state of the transport layer - * - * @IWL_TRANS_NO_FW: no fw has sent an alive response - * @IWL_TRANS_FW_ALIVE: a fw has sent an alive response - */ -enum iwl_trans_state { - IWL_TRANS_NO_FW = 0, - IWL_TRANS_FW_ALIVE = 1, -}; - -/** - * struct iwl_trans - transport common data - * - * @ops - pointer to iwl_trans_ops - * @op_mode - pointer to the op_mode - * @cfg - pointer to the configuration - * @dev - pointer to struct device * that represents the device - * @hw_id: a u32 with the ID of the device / subdevice. - * Set during transport allocation. - * @hw_id_str: a string with info about HW ID. Set during transport allocation. - * @pm_support: set to true in start_hw if link pm is supported - * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only. - * The user should use iwl_trans_{alloc,free}_tx_cmd. - * @dev_cmd_headroom: room needed for the transport's private use before the - * device_cmd for Tx - for internal use only - * The user should use iwl_trans_{alloc,free}_tx_cmd. - * @rx_mpdu_cmd: MPDU RX command ID, must be assigned by opmode before - * starting the firmware, used for tracing - * @rx_mpdu_cmd_hdr_size: used for tracing, amount of data before the - * start of the 802.11 header in the @rx_mpdu_cmd - */ -struct iwl_trans { - const struct iwl_trans_ops *ops; - struct iwl_op_mode *op_mode; - const struct iwl_cfg *cfg; - enum iwl_trans_state state; - - struct device *dev; - u32 hw_rev; - u32 hw_id; - char hw_id_str[52]; - - u8 rx_mpdu_cmd, rx_mpdu_cmd_hdr_size; - - bool pm_support; - - /* The following fields are internal only */ - struct kmem_cache *dev_cmd_pool; - size_t dev_cmd_headroom; - char dev_cmd_pool_name[50]; - - struct dentry *dbgfs_dir; - -#ifdef CONFIG_LOCKDEP - struct lockdep_map sync_cmd_lockdep_map; -#endif - - /* pointer to trans specific struct */ - /*Ensure that this pointer will always be aligned to sizeof pointer */ - char trans_specific[0] __aligned(sizeof(void *)); -}; - -static inline void iwl_trans_configure(struct iwl_trans *trans, - const struct iwl_trans_config *trans_cfg) -{ - trans->op_mode = trans_cfg->op_mode; - - trans->ops->configure(trans, trans_cfg); -} - -static inline int iwl_trans_start_hw(struct iwl_trans *trans) -{ - might_sleep(); - - return trans->ops->start_hw(trans); -} - -static inline void iwl_trans_stop_hw(struct iwl_trans *trans, - bool op_mode_leaving) -{ - might_sleep(); - - trans->ops->stop_hw(trans, op_mode_leaving); - - if (op_mode_leaving) - trans->op_mode = NULL; - - trans->state = IWL_TRANS_NO_FW; -} - -static inline void iwl_trans_fw_alive(struct iwl_trans *trans, u32 scd_addr) -{ - might_sleep(); - - trans->state = IWL_TRANS_FW_ALIVE; - - trans->ops->fw_alive(trans, scd_addr); -} - -static inline int iwl_trans_start_fw(struct iwl_trans *trans, - const struct fw_img *fw, - bool run_in_rfkill) -{ - might_sleep(); - - WARN_ON_ONCE(!trans->rx_mpdu_cmd); - - return trans->ops->start_fw(trans, fw, run_in_rfkill); -} - -static inline void iwl_trans_stop_device(struct iwl_trans *trans) -{ - might_sleep(); - - trans->ops->stop_device(trans); - - trans->state = IWL_TRANS_NO_FW; -} - -static inline void iwl_trans_d3_suspend(struct iwl_trans *trans) -{ - might_sleep(); - trans->ops->d3_suspend(trans); -} - -static inline int iwl_trans_d3_resume(struct iwl_trans *trans, - enum iwl_d3_status *status) -{ - might_sleep(); - return trans->ops->d3_resume(trans, status); -} - -static inline int iwl_trans_send_cmd(struct iwl_trans *trans, - struct iwl_host_cmd *cmd) -{ - int ret; - - if (trans->state != IWL_TRANS_FW_ALIVE) { - IWL_ERR(trans, "%s bad state = %d", __func__, trans->state); - return -EIO; - } - - if (!(cmd->flags & CMD_ASYNC)) - lock_map_acquire_read(&trans->sync_cmd_lockdep_map); - - ret = trans->ops->send_cmd(trans, cmd); - - if (!(cmd->flags & CMD_ASYNC)) - lock_map_release(&trans->sync_cmd_lockdep_map); - - return ret; -} - -static inline struct iwl_device_cmd * -iwl_trans_alloc_tx_cmd(struct iwl_trans *trans) -{ - u8 *dev_cmd_ptr = kmem_cache_alloc(trans->dev_cmd_pool, GFP_ATOMIC); - - if (unlikely(dev_cmd_ptr == NULL)) - return NULL; - - return (struct iwl_device_cmd *) - (dev_cmd_ptr + trans->dev_cmd_headroom); -} - -static inline void iwl_trans_free_tx_cmd(struct iwl_trans *trans, - struct iwl_device_cmd *dev_cmd) -{ - u8 *dev_cmd_ptr = (u8 *)dev_cmd - trans->dev_cmd_headroom; - - kmem_cache_free(trans->dev_cmd_pool, dev_cmd_ptr); -} - -static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb, - struct iwl_device_cmd *dev_cmd, int queue) -{ - WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE, - "%s bad state = %d", __func__, trans->state); - - return trans->ops->tx(trans, skb, dev_cmd, queue); -} - -static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue, - int ssn, struct sk_buff_head *skbs) -{ - WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE, - "%s bad state = %d", __func__, trans->state); - - trans->ops->reclaim(trans, queue, ssn, skbs); -} - -static inline void iwl_trans_txq_disable(struct iwl_trans *trans, int queue) -{ - WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE, - "%s bad state = %d", __func__, trans->state); - - trans->ops->txq_disable(trans, queue); -} - -static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue, - int fifo, int sta_id, int tid, - int frame_limit, u16 ssn) -{ - might_sleep(); - - WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE, - "%s bad state = %d", __func__, trans->state); - - trans->ops->txq_enable(trans, queue, fifo, sta_id, tid, - frame_limit, ssn); -} - -static inline void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue, - int fifo) -{ - iwl_trans_txq_enable(trans, queue, fifo, -1, - IWL_MAX_TID_COUNT, IWL_FRAME_LIMIT, 0); -} - -static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans) -{ - WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE, - "%s bad state = %d", __func__, trans->state); - - return trans->ops->wait_tx_queue_empty(trans); -} - -static inline int iwl_trans_dbgfs_register(struct iwl_trans *trans, - struct dentry *dir) -{ - return trans->ops->dbgfs_register(trans, dir); -} - -#ifdef CONFIG_PM_SLEEP -static inline int iwl_trans_suspend(struct iwl_trans *trans) -{ - return trans->ops->suspend(trans); -} - -static inline int iwl_trans_resume(struct iwl_trans *trans) -{ - return trans->ops->resume(trans); -} -#endif - -static inline void iwl_trans_write8(struct iwl_trans *trans, u32 ofs, u8 val) -{ - trans->ops->write8(trans, ofs, val); -} - -static inline void iwl_trans_write32(struct iwl_trans *trans, u32 ofs, u32 val) -{ - trans->ops->write32(trans, ofs, val); -} - -static inline u32 iwl_trans_read32(struct iwl_trans *trans, u32 ofs) -{ - return trans->ops->read32(trans, ofs); -} - -static inline u32 iwl_trans_read_prph(struct iwl_trans *trans, u32 ofs) -{ - return trans->ops->read_prph(trans, ofs); -} - -static inline void iwl_trans_write_prph(struct iwl_trans *trans, u32 ofs, - u32 val) -{ - return trans->ops->write_prph(trans, ofs, val); -} - -static inline int iwl_trans_read_mem(struct iwl_trans *trans, u32 addr, - void *buf, int dwords) -{ - return trans->ops->read_mem(trans, addr, buf, dwords); -} - -#define iwl_trans_read_mem_bytes(trans, addr, buf, bufsize) \ - do { \ - if (__builtin_constant_p(bufsize)) \ - BUILD_BUG_ON((bufsize) % sizeof(u32)); \ - iwl_trans_read_mem(trans, addr, buf, (bufsize) / sizeof(u32));\ - } while (0) - -static inline u32 iwl_trans_read_mem32(struct iwl_trans *trans, u32 addr) -{ - u32 value; - - if (WARN_ON(iwl_trans_read_mem(trans, addr, &value, 1))) - return 0xa5a5a5a5; - - return value; -} - -static inline int iwl_trans_write_mem(struct iwl_trans *trans, u32 addr, - void *buf, int dwords) -{ - return trans->ops->write_mem(trans, addr, buf, dwords); -} - -static inline u32 iwl_trans_write_mem32(struct iwl_trans *trans, u32 addr, - u32 val) -{ - return iwl_trans_write_mem(trans, addr, &val, 1); -} - -static inline void iwl_trans_set_pmi(struct iwl_trans *trans, bool state) -{ - trans->ops->set_pmi(trans, state); -} - -static inline void -iwl_trans_set_bits_mask(struct iwl_trans *trans, u32 reg, u32 mask, u32 value) -{ - trans->ops->set_bits_mask(trans, reg, mask, value); -} - -#define iwl_trans_grab_nic_access(trans, silent, flags) \ - __cond_lock(nic_access, \ - likely((trans)->ops->grab_nic_access(trans, silent, flags))) - -static inline void __releases(nic_access) -iwl_trans_release_nic_access(struct iwl_trans *trans, unsigned long *flags) -{ - trans->ops->release_nic_access(trans, flags); - __release(nic_access); -} - -/***************************************************** -* driver (transport) register/unregister functions -******************************************************/ -int __must_check iwl_pci_register_driver(void); -void iwl_pci_unregister_driver(void); - -static inline void trans_lockdep_init(struct iwl_trans *trans) -{ -#ifdef CONFIG_LOCKDEP - static struct lock_class_key __key; - - lockdep_init_map(&trans->sync_cmd_lockdep_map, "sync_cmd_lockdep_map", - &__key, 0); -#endif -} - -#endif /* __iwl_trans_h__ */ diff --git a/drivers/net/wireless/iwlwifi/mvm/Makefile b/drivers/net/wireless/iwlwifi/mvm/Makefile deleted file mode 100644 index 2acc44b40986..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -obj-$(CONFIG_IWLMVM) += iwlmvm.o -iwlmvm-y += fw.o mac80211.o nvm.o ops.o phy-ctxt.o mac-ctxt.o -iwlmvm-y += utils.o rx.o tx.o binding.o quota.o sta.o -iwlmvm-y += scan.o time-event.o rs.o -iwlmvm-y += power.o bt-coex.o -iwlmvm-y += led.o -iwlmvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o -iwlmvm-$(CONFIG_PM_SLEEP) += d3.o - -ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/../ diff --git a/drivers/net/wireless/iwlwifi/mvm/binding.c b/drivers/net/wireless/iwlwifi/mvm/binding.c deleted file mode 100644 index 93fd1457954b..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/binding.c +++ /dev/null @@ -1,197 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#include -#include "fw-api.h" -#include "mvm.h" - -struct iwl_mvm_iface_iterator_data { - struct ieee80211_vif *ignore_vif; - int idx; - - struct iwl_mvm_phy_ctxt *phyctxt; - - u16 ids[MAX_MACS_IN_BINDING]; - u16 colors[MAX_MACS_IN_BINDING]; -}; - -static int iwl_mvm_binding_cmd(struct iwl_mvm *mvm, u32 action, - struct iwl_mvm_iface_iterator_data *data) -{ - struct iwl_binding_cmd cmd; - struct iwl_mvm_phy_ctxt *phyctxt = data->phyctxt; - int i, ret; - u32 status; - - memset(&cmd, 0, sizeof(cmd)); - - cmd.id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(phyctxt->id, - phyctxt->color)); - cmd.action = cpu_to_le32(action); - cmd.phy = cpu_to_le32(FW_CMD_ID_AND_COLOR(phyctxt->id, - phyctxt->color)); - - for (i = 0; i < MAX_MACS_IN_BINDING; i++) - cmd.macs[i] = cpu_to_le32(FW_CTXT_INVALID); - for (i = 0; i < data->idx; i++) - cmd.macs[i] = cpu_to_le32(FW_CMD_ID_AND_COLOR(data->ids[i], - data->colors[i])); - - status = 0; - ret = iwl_mvm_send_cmd_pdu_status(mvm, BINDING_CONTEXT_CMD, - sizeof(cmd), &cmd, &status); - if (ret) { - IWL_ERR(mvm, "Failed to send binding (action:%d): %d\n", - action, ret); - return ret; - } - - if (status) { - IWL_ERR(mvm, "Binding command failed: %u\n", status); - ret = -EIO; - } - - return ret; -} - -static void iwl_mvm_iface_iterator(void *_data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct iwl_mvm_iface_iterator_data *data = _data; - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - if (vif == data->ignore_vif) - return; - - if (mvmvif->phy_ctxt != data->phyctxt) - return; - - if (WARN_ON_ONCE(data->idx >= MAX_MACS_IN_BINDING)) - return; - - data->ids[data->idx] = mvmvif->id; - data->colors[data->idx] = mvmvif->color; - data->idx++; -} - -static int iwl_mvm_binding_update(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct iwl_mvm_phy_ctxt *phyctxt, - bool add) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct iwl_mvm_iface_iterator_data data = { - .ignore_vif = vif, - .phyctxt = phyctxt, - }; - u32 action = FW_CTXT_ACTION_MODIFY; - - lockdep_assert_held(&mvm->mutex); - - ieee80211_iterate_active_interfaces_atomic(mvm->hw, - IEEE80211_IFACE_ITER_NORMAL, - iwl_mvm_iface_iterator, - &data); - - /* - * If there are no other interfaces yet we - * need to create a new binding. - */ - if (data.idx == 0) { - if (add) - action = FW_CTXT_ACTION_ADD; - else - action = FW_CTXT_ACTION_REMOVE; - } - - if (add) { - if (WARN_ON_ONCE(data.idx >= MAX_MACS_IN_BINDING)) - return -EINVAL; - - data.ids[data.idx] = mvmvif->id; - data.colors[data.idx] = mvmvif->color; - data.idx++; - } - - return iwl_mvm_binding_cmd(mvm, action, &data); -} - -int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - if (WARN_ON_ONCE(!mvmvif->phy_ctxt)) - return -EINVAL; - - return iwl_mvm_binding_update(mvm, vif, mvmvif->phy_ctxt, true); -} - -int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - if (WARN_ON_ONCE(!mvmvif->phy_ctxt)) - return -EINVAL; - - return iwl_mvm_binding_update(mvm, vif, mvmvif->phy_ctxt, false); -} diff --git a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c deleted file mode 100644 index 810bfa5f6de0..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c +++ /dev/null @@ -1,589 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#include - -#include "fw-api-bt-coex.h" -#include "iwl-modparams.h" -#include "mvm.h" -#include "iwl-debug.h" - -#define EVENT_PRIO_ANT(_evt, _prio, _shrd_ant) \ - [(_evt)] = (((_prio) << BT_COEX_PRIO_TBL_PRIO_POS) | \ - ((_shrd_ant) << BT_COEX_PRIO_TBL_SHRD_ANT_POS)) - -static const u8 iwl_bt_prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX] = { - EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_INIT_CALIB1, - BT_COEX_PRIO_TBL_PRIO_BYPASS, 0), - EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_INIT_CALIB2, - BT_COEX_PRIO_TBL_PRIO_BYPASS, 1), - EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW1, - BT_COEX_PRIO_TBL_PRIO_LOW, 0), - EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW2, - BT_COEX_PRIO_TBL_PRIO_LOW, 1), - EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH1, - BT_COEX_PRIO_TBL_PRIO_HIGH, 0), - EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH2, - BT_COEX_PRIO_TBL_PRIO_HIGH, 1), - EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_DTIM, - BT_COEX_PRIO_TBL_DISABLED, 0), - EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_SCAN52, - BT_COEX_PRIO_TBL_PRIO_COEX_OFF, 0), - EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_SCAN24, - BT_COEX_PRIO_TBL_PRIO_COEX_ON, 0), - EVENT_PRIO_ANT(BT_COEX_PRIO_TBL_EVT_IDLE, - BT_COEX_PRIO_TBL_PRIO_COEX_IDLE, 0), - 0, 0, 0, 0, 0, 0, -}; - -#undef EVENT_PRIO_ANT - -/* BT Antenna Coupling Threshold (dB) */ -#define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35) -#define IWL_BT_LOAD_FORCE_SISO_THRESHOLD (3) - -#define BT_ENABLE_REDUCED_TXPOWER_THRESHOLD (-62) -#define BT_DISABLE_REDUCED_TXPOWER_THRESHOLD (-65) -#define BT_REDUCED_TX_POWER_BIT BIT(7) - -static inline bool is_loose_coex(void) -{ - return iwlwifi_mod_params.ant_coupling > - IWL_BT_ANTENNA_COUPLING_THRESHOLD; -} - -int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm) -{ - return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_PRIO_TABLE, CMD_SYNC, - sizeof(struct iwl_bt_coex_prio_tbl_cmd), - &iwl_bt_prio_tbl); -} - -static int iwl_send_bt_env(struct iwl_mvm *mvm, u8 action, u8 type) -{ - struct iwl_bt_coex_prot_env_cmd env_cmd; - int ret; - - env_cmd.action = action; - env_cmd.type = type; - ret = iwl_mvm_send_cmd_pdu(mvm, BT_COEX_PROT_ENV, CMD_SYNC, - sizeof(env_cmd), &env_cmd); - if (ret) - IWL_ERR(mvm, "failed to send BT env command\n"); - return ret; -} - -enum iwl_bt_kill_msk { - BT_KILL_MSK_DEFAULT, - BT_KILL_MSK_SCO_HID_A2DP, - BT_KILL_MSK_REDUCED_TXPOW, - BT_KILL_MSK_MAX, -}; - -static const u32 iwl_bt_ack_kill_msk[BT_KILL_MSK_MAX] = { - [BT_KILL_MSK_DEFAULT] = 0xffff0000, - [BT_KILL_MSK_SCO_HID_A2DP] = 0xffffffff, - [BT_KILL_MSK_REDUCED_TXPOW] = 0, -}; - -static const u32 iwl_bt_cts_kill_msk[BT_KILL_MSK_MAX] = { - [BT_KILL_MSK_DEFAULT] = 0xffff0000, - [BT_KILL_MSK_SCO_HID_A2DP] = 0xffffffff, - [BT_KILL_MSK_REDUCED_TXPOW] = 0, -}; - -#define IWL_BT_DEFAULT_BOOST (0xf0f0f0f0) - -/* Tight Coex */ -static const __le32 iwl_tight_lookup[BT_COEX_LUT_SIZE] = { - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaeaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xcc00ff28), - cpu_to_le32(0x0000aaaa), - cpu_to_le32(0xcc00aaaa), - cpu_to_le32(0x0000aaaa), - cpu_to_le32(0xc0004000), - cpu_to_le32(0x00000000), - cpu_to_le32(0xf0005000), - cpu_to_le32(0xf0005000), -}; - -/* Loose Coex */ -static const __le32 iwl_loose_lookup[BT_COEX_LUT_SIZE] = { - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaeaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xcc00ff28), - cpu_to_le32(0x0000aaaa), - cpu_to_le32(0xcc00aaaa), - cpu_to_le32(0x0000aaaa), - cpu_to_le32(0x00000000), - cpu_to_le32(0x00000000), - cpu_to_le32(0xf0005000), - cpu_to_le32(0xf0005000), -}; - -/* Full concurrency */ -static const __le32 iwl_concurrent_lookup[BT_COEX_LUT_SIZE] = { - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0x00000000), - cpu_to_le32(0x00000000), - cpu_to_le32(0x00000000), - cpu_to_le32(0x00000000), -}; - -int iwl_send_bt_init_conf(struct iwl_mvm *mvm) -{ - struct iwl_bt_coex_cmd cmd = { - .max_kill = 5, - .bt3_time_t7_value = 1, - .bt3_prio_sample_time = 2, - .bt3_timer_t2_value = 0xc, - }; - int ret; - - cmd.flags = iwlwifi_mod_params.bt_coex_active ? - BT_COEX_NW : BT_COEX_DISABLE; - cmd.flags |= BT_CH_PRIMARY_EN | BT_SYNC_2_BT_DISABLE; - - cmd.valid_bit_msk = cpu_to_le16(BT_VALID_ENABLE | - BT_VALID_BT_PRIO_BOOST | - BT_VALID_MAX_KILL | - BT_VALID_3W_TMRS | - BT_VALID_KILL_ACK | - BT_VALID_KILL_CTS | - BT_VALID_REDUCED_TX_POWER | - BT_VALID_LUT); - - if (is_loose_coex()) - memcpy(&cmd.decision_lut, iwl_loose_lookup, - sizeof(iwl_tight_lookup)); - else - memcpy(&cmd.decision_lut, iwl_tight_lookup, - sizeof(iwl_tight_lookup)); - - cmd.bt_prio_boost = cpu_to_le32(IWL_BT_DEFAULT_BOOST); - cmd.kill_ack_msk = - cpu_to_le32(iwl_bt_ack_kill_msk[BT_KILL_MSK_DEFAULT]); - cmd.kill_cts_msk = - cpu_to_le32(iwl_bt_cts_kill_msk[BT_KILL_MSK_DEFAULT]); - - memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif)); - - /* go to CALIB state in internal BT-Coex state machine */ - ret = iwl_send_bt_env(mvm, BT_COEX_ENV_OPEN, - BT_COEX_PRIO_TBL_EVT_INIT_CALIB2); - if (ret) - return ret; - - ret = iwl_send_bt_env(mvm, BT_COEX_ENV_CLOSE, - BT_COEX_PRIO_TBL_EVT_INIT_CALIB2); - if (ret) - return ret; - - return iwl_mvm_send_cmd_pdu(mvm, BT_CONFIG, CMD_SYNC, - sizeof(cmd), &cmd); -} - -static int iwl_mvm_bt_udpate_ctrl_kill_msk(struct iwl_mvm *mvm, - bool reduced_tx_power) -{ - enum iwl_bt_kill_msk bt_kill_msk; - struct iwl_bt_coex_cmd cmd = {}; - struct iwl_bt_coex_profile_notif *notif = &mvm->last_bt_notif; - - lockdep_assert_held(&mvm->mutex); - - if (reduced_tx_power) { - /* Reduced Tx power has precedence on the type of the profile */ - bt_kill_msk = BT_KILL_MSK_REDUCED_TXPOW; - } else { - /* Low latency BT profile is active: give higher prio to BT */ - if (BT_MBOX_MSG(notif, 3, SCO_STATE) || - BT_MBOX_MSG(notif, 3, A2DP_STATE) || - BT_MBOX_MSG(notif, 3, SNIFF_STATE)) - bt_kill_msk = BT_KILL_MSK_SCO_HID_A2DP; - else - bt_kill_msk = BT_KILL_MSK_DEFAULT; - } - - IWL_DEBUG_COEX(mvm, - "Update kill_msk: %d - SCO %sactive A2DP %sactive SNIFF %sactive\n", - bt_kill_msk, - BT_MBOX_MSG(notif, 3, SCO_STATE) ? "" : "in", - BT_MBOX_MSG(notif, 3, A2DP_STATE) ? "" : "in", - BT_MBOX_MSG(notif, 3, SNIFF_STATE) ? "" : "in"); - - /* Don't send HCMD if there is no update */ - if (bt_kill_msk == mvm->bt_kill_msk) - return 0; - - mvm->bt_kill_msk = bt_kill_msk; - cmd.kill_ack_msk = cpu_to_le32(iwl_bt_ack_kill_msk[bt_kill_msk]); - cmd.kill_cts_msk = cpu_to_le32(iwl_bt_cts_kill_msk[bt_kill_msk]); - cmd.valid_bit_msk = cpu_to_le16(BT_VALID_KILL_ACK | BT_VALID_KILL_CTS); - - IWL_DEBUG_COEX(mvm, "bt_kill_msk = %d\n", bt_kill_msk); - return iwl_mvm_send_cmd_pdu(mvm, BT_CONFIG, CMD_SYNC, - sizeof(cmd), &cmd); -} - -static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, - bool enable) -{ - struct iwl_bt_coex_cmd cmd = { - .valid_bit_msk = cpu_to_le16(BT_VALID_REDUCED_TX_POWER), - .bt_reduced_tx_power = sta_id, - }; - struct ieee80211_sta *sta; - struct iwl_mvm_sta *mvmsta; - - /* This can happen if the station has been removed right now */ - if (sta_id == IWL_MVM_STATION_COUNT) - return 0; - - sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], - lockdep_is_held(&mvm->mutex)); - mvmsta = (void *)sta->drv_priv; - - /* nothing to do */ - if (mvmsta->bt_reduced_txpower == enable) - return 0; - - if (enable) - cmd.bt_reduced_tx_power |= BT_REDUCED_TX_POWER_BIT; - - IWL_DEBUG_COEX(mvm, "%sable reduced Tx Power for sta %d\n", - enable ? "en" : "dis", sta_id); - - mvmsta->bt_reduced_txpower = enable; - - /* Send ASYNC since this can be sent from an atomic context */ - return iwl_mvm_send_cmd_pdu(mvm, BT_CONFIG, CMD_ASYNC, - sizeof(cmd), &cmd); -} - -struct iwl_bt_iterator_data { - struct iwl_bt_coex_profile_notif *notif; - struct iwl_mvm *mvm; - u32 num_bss_ifaces; - bool reduced_tx_power; -}; - -static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct iwl_bt_iterator_data *data = _data; - struct iwl_mvm *mvm = data->mvm; - struct ieee80211_chanctx_conf *chanctx_conf; - enum ieee80211_smps_mode smps_mode; - enum ieee80211_band band; - int ave_rssi; - - if (vif->type != NL80211_IFTYPE_STATION) - return; - - rcu_read_lock(); - chanctx_conf = rcu_dereference(vif->chanctx_conf); - if (chanctx_conf && chanctx_conf->def.chan) - band = chanctx_conf->def.chan->band; - else - band = -1; - rcu_read_unlock(); - - smps_mode = IEEE80211_SMPS_AUTOMATIC; - - if (band != IEEE80211_BAND_2GHZ) { - ieee80211_request_smps(vif, smps_mode); - return; - } - - if (data->notif->bt_status) - smps_mode = IEEE80211_SMPS_DYNAMIC; - - if (data->notif->bt_traffic_load >= IWL_BT_LOAD_FORCE_SISO_THRESHOLD) - smps_mode = IEEE80211_SMPS_STATIC; - - IWL_DEBUG_COEX(data->mvm, - "mac %d: bt_status %d traffic_load %d smps_req %d\n", - mvmvif->id, data->notif->bt_status, - data->notif->bt_traffic_load, smps_mode); - - ieee80211_request_smps(vif, smps_mode); - - /* don't reduce the Tx power if in loose scheme */ - if (is_loose_coex()) - return; - - data->num_bss_ifaces++; - - /* reduced Txpower only if there are open BT connections, so ...*/ - if (!BT_MBOX_MSG(data->notif, 3, OPEN_CON_2)) { - /* ... cancel reduced Tx power ... */ - if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false)) - IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); - data->reduced_tx_power = false; - - /* ... and there is no need to get reports on RSSI any more. */ - ieee80211_disable_rssi_reports(vif); - return; - } - - ave_rssi = ieee80211_ave_rssi(vif); - - /* if the RSSI isn't valid, fake it is very low */ - if (!ave_rssi) - ave_rssi = -100; - if (ave_rssi > BT_ENABLE_REDUCED_TXPOWER_THRESHOLD) { - if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, true)) - IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); - - /* - * bt_kill_msk can be BT_KILL_MSK_REDUCED_TXPOW only if all the - * BSS / P2P clients have rssi above threshold. - * We set the bt_kill_msk to BT_KILL_MSK_REDUCED_TXPOW before - * the iteration, if one interface's rssi isn't good enough, - * bt_kill_msk will be set to default values. - */ - } else if (ave_rssi < BT_DISABLE_REDUCED_TXPOWER_THRESHOLD) { - if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false)) - IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); - - /* - * One interface hasn't rssi above threshold, bt_kill_msk must - * be set to default values. - */ - data->reduced_tx_power = false; - } - - /* Begin to monitor the RSSI: it may influence the reduced Tx power */ - ieee80211_enable_rssi_reports(vif, BT_DISABLE_REDUCED_TXPOWER_THRESHOLD, - BT_ENABLE_REDUCED_TXPOWER_THRESHOLD); -} - -static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm) -{ - struct iwl_bt_iterator_data data = { - .mvm = mvm, - .notif = &mvm->last_bt_notif, - .reduced_tx_power = true, - }; - - ieee80211_iterate_active_interfaces_atomic( - mvm->hw, IEEE80211_IFACE_ITER_NORMAL, - iwl_mvm_bt_notif_iterator, &data); - - /* - * If there are no BSS / P2P client interfaces, reduced Tx Power is - * irrelevant since it is based on the RSSI coming from the beacon. - * Use BT_KILL_MSK_DEFAULT in that case. - */ - data.reduced_tx_power = data.reduced_tx_power && data.num_bss_ifaces; - - if (iwl_mvm_bt_udpate_ctrl_kill_msk(mvm, data.reduced_tx_power)) - IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n"); -} - -/* upon association, the fw will send in BT Coex notification */ -int iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *dev_cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_bt_coex_profile_notif *notif = (void *)pkt->data; - - - IWL_DEBUG_COEX(mvm, "BT Coex Notification received\n"); - IWL_DEBUG_COEX(mvm, "\tBT %salive\n", notif->bt_status ? "" : "not "); - IWL_DEBUG_COEX(mvm, "\tBT open conn %d\n", notif->bt_open_conn); - IWL_DEBUG_COEX(mvm, "\tBT traffic load %d\n", notif->bt_traffic_load); - IWL_DEBUG_COEX(mvm, "\tBT agg traffic load %d\n", - notif->bt_agg_traffic_load); - IWL_DEBUG_COEX(mvm, "\tBT ci compliance %d\n", notif->bt_ci_compliance); - - /* remember this notification for future use: rssi fluctuations */ - memcpy(&mvm->last_bt_notif, notif, sizeof(mvm->last_bt_notif)); - - iwl_mvm_bt_coex_notif_handle(mvm); - - /* - * This is an async handler for a notification, returning anything other - * than 0 doesn't make sense even if HCMD failed. - */ - return 0; -} - -static void iwl_mvm_bt_rssi_iterator(void *_data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct iwl_mvm_vif *mvmvif = (void *)vif->drv_priv; - struct iwl_bt_iterator_data *data = _data; - struct iwl_mvm *mvm = data->mvm; - - struct ieee80211_sta *sta; - struct iwl_mvm_sta *mvmsta; - - if (vif->type != NL80211_IFTYPE_STATION || - mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT) - return; - - sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], - lockdep_is_held(&mvm->mutex)); - mvmsta = (void *)sta->drv_priv; - - /* - * This interface doesn't support reduced Tx power (because of low - * RSSI probably), then set bt_kill_msk to default values. - */ - if (!mvmsta->bt_reduced_txpower) - data->reduced_tx_power = false; - /* else - possibly leave it to BT_KILL_MSK_REDUCED_TXPOW */ -} - -void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - enum ieee80211_rssi_event rssi_event) -{ - struct iwl_mvm_vif *mvmvif = (void *)vif->drv_priv; - struct iwl_bt_iterator_data data = { - .mvm = mvm, - .reduced_tx_power = true, - }; - int ret; - - mutex_lock(&mvm->mutex); - - /* Rssi update while not associated ?! */ - if (WARN_ON_ONCE(mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT)) - goto out_unlock; - - /* No open connection - reports should be disabled */ - if (!BT_MBOX_MSG(&mvm->last_bt_notif, 3, OPEN_CON_2)) - goto out_unlock; - - IWL_DEBUG_COEX(mvm, "RSSI for %pM is now %s\n", vif->bss_conf.bssid, - rssi_event == RSSI_EVENT_HIGH ? "HIGH" : "LOW"); - - /* - * Check if rssi is good enough for reduced Tx power, but not in loose - * scheme. - */ - if (rssi_event == RSSI_EVENT_LOW || is_loose_coex()) - ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, - false); - else - ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, true); - - if (ret) - IWL_ERR(mvm, "couldn't send BT_CONFIG HCMD upon RSSI event\n"); - - ieee80211_iterate_active_interfaces_atomic( - mvm->hw, IEEE80211_IFACE_ITER_NORMAL, - iwl_mvm_bt_rssi_iterator, &data); - - /* - * If there are no BSS / P2P client interfaces, reduced Tx Power is - * irrelevant since it is based on the RSSI coming from the beacon. - * Use BT_KILL_MSK_DEFAULT in that case. - */ - data.reduced_tx_power = data.reduced_tx_power && data.num_bss_ifaces; - - if (iwl_mvm_bt_udpate_ctrl_kill_msk(mvm, data.reduced_tx_power)) - IWL_ERR(mvm, "Failed to update the ctrl_kill_msk\n"); - - out_unlock: - mutex_unlock(&mvm->mutex); -} - -void iwl_mvm_bt_coex_vif_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif) -{ - struct ieee80211_chanctx_conf *chanctx_conf; - enum ieee80211_band band; - - rcu_read_lock(); - chanctx_conf = rcu_dereference(vif->chanctx_conf); - if (chanctx_conf && chanctx_conf->def.chan) - band = chanctx_conf->def.chan->band; - else - band = -1; - rcu_read_unlock(); - - /* if we are in 2GHz we will get a notification from the fw */ - if (band == IEEE80211_BAND_2GHZ) - return; - - /* else, we can remove all the constraints */ - memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif)); - - iwl_mvm_bt_coex_notif_handle(mvm); -} diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c deleted file mode 100644 index 16bbdcc8627a..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/d3.c +++ /dev/null @@ -1,1266 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#include -#include -#include -#include -#include -#include "iwl-modparams.h" -#include "fw-api.h" -#include "mvm.h" - -void iwl_mvm_set_rekey_data(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct cfg80211_gtk_rekey_data *data) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - if (iwlwifi_mod_params.sw_crypto) - return; - - mutex_lock(&mvm->mutex); - - memcpy(mvmvif->rekey_data.kek, data->kek, NL80211_KEK_LEN); - memcpy(mvmvif->rekey_data.kck, data->kck, NL80211_KCK_LEN); - mvmvif->rekey_data.replay_ctr = - cpu_to_le64(be64_to_cpup((__be64 *)&data->replay_ctr)); - mvmvif->rekey_data.valid = true; - - mutex_unlock(&mvm->mutex); -} - -#if IS_ENABLED(CONFIG_IPV6) -void iwl_mvm_ipv6_addr_change(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct inet6_dev *idev) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct inet6_ifaddr *ifa; - int idx = 0; - - read_lock_bh(&idev->lock); - list_for_each_entry(ifa, &idev->addr_list, if_list) { - mvmvif->target_ipv6_addrs[idx] = ifa->addr; - idx++; - if (idx >= IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS) - break; - } - read_unlock_bh(&idev->lock); - - mvmvif->num_target_ipv6_addrs = idx; -} -#endif - -void iwl_mvm_set_default_unicast_key(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, int idx) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - mvmvif->tx_key_idx = idx; -} - -static void iwl_mvm_convert_p1k(u16 *p1k, __le16 *out) -{ - int i; - - for (i = 0; i < IWL_P1K_SIZE; i++) - out[i] = cpu_to_le16(p1k[i]); -} - -struct wowlan_key_data { - struct iwl_wowlan_rsc_tsc_params_cmd *rsc_tsc; - struct iwl_wowlan_tkip_params_cmd *tkip; - bool error, use_rsc_tsc, use_tkip; - int gtk_key_idx; -}; - -static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key, - void *_data) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct wowlan_key_data *data = _data; - struct aes_sc *aes_sc, *aes_tx_sc = NULL; - struct tkip_sc *tkip_sc, *tkip_tx_sc = NULL; - struct iwl_p1k_cache *rx_p1ks; - u8 *rx_mic_key; - struct ieee80211_key_seq seq; - u32 cur_rx_iv32 = 0; - u16 p1k[IWL_P1K_SIZE]; - int ret, i; - - mutex_lock(&mvm->mutex); - - switch (key->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: { /* hack it for now */ - struct { - struct iwl_mvm_wep_key_cmd wep_key_cmd; - struct iwl_mvm_wep_key wep_key; - } __packed wkc = { - .wep_key_cmd.mac_id_n_color = - cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, - mvmvif->color)), - .wep_key_cmd.num_keys = 1, - /* firmware sets STA_KEY_FLG_WEP_13BYTES */ - .wep_key_cmd.decryption_type = STA_KEY_FLG_WEP, - .wep_key.key_index = key->keyidx, - .wep_key.key_size = key->keylen, - }; - - /* - * This will fail -- the key functions don't set support - * pairwise WEP keys. However, that's better than silently - * failing WoWLAN. Or maybe not? - */ - if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) - break; - - memcpy(&wkc.wep_key.key[3], key->key, key->keylen); - if (key->keyidx == mvmvif->tx_key_idx) { - /* TX key must be at offset 0 */ - wkc.wep_key.key_offset = 0; - } else { - /* others start at 1 */ - data->gtk_key_idx++; - wkc.wep_key.key_offset = data->gtk_key_idx; - } - - ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, CMD_SYNC, - sizeof(wkc), &wkc); - data->error = ret != 0; - - mvm->ptk_ivlen = key->iv_len; - mvm->ptk_icvlen = key->icv_len; - mvm->gtk_ivlen = key->iv_len; - mvm->gtk_icvlen = key->icv_len; - - /* don't upload key again */ - goto out_unlock; - } - default: - data->error = true; - goto out_unlock; - case WLAN_CIPHER_SUITE_AES_CMAC: - /* - * Ignore CMAC keys -- the WoWLAN firmware doesn't support them - * but we also shouldn't abort suspend due to that. It does have - * support for the IGTK key renewal, but doesn't really use the - * IGTK for anything. This means we could spuriously wake up or - * be deauthenticated, but that was considered acceptable. - */ - goto out_unlock; - case WLAN_CIPHER_SUITE_TKIP: - if (sta) { - tkip_sc = data->rsc_tsc->all_tsc_rsc.tkip.unicast_rsc; - tkip_tx_sc = &data->rsc_tsc->all_tsc_rsc.tkip.tsc; - - rx_p1ks = data->tkip->rx_uni; - - ieee80211_get_key_tx_seq(key, &seq); - tkip_tx_sc->iv16 = cpu_to_le16(seq.tkip.iv16); - tkip_tx_sc->iv32 = cpu_to_le32(seq.tkip.iv32); - - ieee80211_get_tkip_p1k_iv(key, seq.tkip.iv32, p1k); - iwl_mvm_convert_p1k(p1k, data->tkip->tx.p1k); - - memcpy(data->tkip->mic_keys.tx, - &key->key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY], - IWL_MIC_KEY_SIZE); - - rx_mic_key = data->tkip->mic_keys.rx_unicast; - } else { - tkip_sc = - data->rsc_tsc->all_tsc_rsc.tkip.multicast_rsc; - rx_p1ks = data->tkip->rx_multi; - rx_mic_key = data->tkip->mic_keys.rx_mcast; - } - - /* - * For non-QoS this relies on the fact that both the uCode and - * mac80211 use TID 0 (as they need to to avoid replay attacks) - * for checking the IV in the frames. - */ - for (i = 0; i < IWL_NUM_RSC; i++) { - ieee80211_get_key_rx_seq(key, i, &seq); - tkip_sc[i].iv16 = cpu_to_le16(seq.tkip.iv16); - tkip_sc[i].iv32 = cpu_to_le32(seq.tkip.iv32); - /* wrapping isn't allowed, AP must rekey */ - if (seq.tkip.iv32 > cur_rx_iv32) - cur_rx_iv32 = seq.tkip.iv32; - } - - ieee80211_get_tkip_rx_p1k(key, vif->bss_conf.bssid, - cur_rx_iv32, p1k); - iwl_mvm_convert_p1k(p1k, rx_p1ks[0].p1k); - ieee80211_get_tkip_rx_p1k(key, vif->bss_conf.bssid, - cur_rx_iv32 + 1, p1k); - iwl_mvm_convert_p1k(p1k, rx_p1ks[1].p1k); - - memcpy(rx_mic_key, - &key->key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY], - IWL_MIC_KEY_SIZE); - - data->use_tkip = true; - data->use_rsc_tsc = true; - break; - case WLAN_CIPHER_SUITE_CCMP: - if (sta) { - u8 *pn = seq.ccmp.pn; - - aes_sc = data->rsc_tsc->all_tsc_rsc.aes.unicast_rsc; - aes_tx_sc = &data->rsc_tsc->all_tsc_rsc.aes.tsc; - - ieee80211_get_key_tx_seq(key, &seq); - aes_tx_sc->pn = cpu_to_le64((u64)pn[5] | - ((u64)pn[4] << 8) | - ((u64)pn[3] << 16) | - ((u64)pn[2] << 24) | - ((u64)pn[1] << 32) | - ((u64)pn[0] << 40)); - } else { - aes_sc = data->rsc_tsc->all_tsc_rsc.aes.multicast_rsc; - } - - /* - * For non-QoS this relies on the fact that both the uCode and - * mac80211 use TID 0 for checking the IV in the frames. - */ - for (i = 0; i < IWL_NUM_RSC; i++) { - u8 *pn = seq.ccmp.pn; - - ieee80211_get_key_rx_seq(key, i, &seq); - aes_sc->pn = cpu_to_le64((u64)pn[5] | - ((u64)pn[4] << 8) | - ((u64)pn[3] << 16) | - ((u64)pn[2] << 24) | - ((u64)pn[1] << 32) | - ((u64)pn[0] << 40)); - } - data->use_rsc_tsc = true; - break; - } - - /* - * The D3 firmware hardcodes the key offset 0 as the key it uses - * to transmit packets to the AP, i.e. the PTK. - */ - if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { - key->hw_key_idx = 0; - mvm->ptk_ivlen = key->iv_len; - mvm->ptk_icvlen = key->icv_len; - } else { - data->gtk_key_idx++; - key->hw_key_idx = data->gtk_key_idx; - mvm->gtk_ivlen = key->iv_len; - mvm->gtk_icvlen = key->icv_len; - } - - ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, true); - data->error = ret != 0; -out_unlock: - mutex_unlock(&mvm->mutex); -} - -static int iwl_mvm_send_patterns(struct iwl_mvm *mvm, - struct cfg80211_wowlan *wowlan) -{ - struct iwl_wowlan_patterns_cmd *pattern_cmd; - struct iwl_host_cmd cmd = { - .id = WOWLAN_PATTERNS, - .dataflags[0] = IWL_HCMD_DFL_NOCOPY, - .flags = CMD_SYNC, - }; - int i, err; - - if (!wowlan->n_patterns) - return 0; - - cmd.len[0] = sizeof(*pattern_cmd) + - wowlan->n_patterns * sizeof(struct iwl_wowlan_pattern); - - pattern_cmd = kmalloc(cmd.len[0], GFP_KERNEL); - if (!pattern_cmd) - return -ENOMEM; - - pattern_cmd->n_patterns = cpu_to_le32(wowlan->n_patterns); - - for (i = 0; i < wowlan->n_patterns; i++) { - int mask_len = DIV_ROUND_UP(wowlan->patterns[i].pattern_len, 8); - - memcpy(&pattern_cmd->patterns[i].mask, - wowlan->patterns[i].mask, mask_len); - memcpy(&pattern_cmd->patterns[i].pattern, - wowlan->patterns[i].pattern, - wowlan->patterns[i].pattern_len); - pattern_cmd->patterns[i].mask_size = mask_len; - pattern_cmd->patterns[i].pattern_size = - wowlan->patterns[i].pattern_len; - } - - cmd.data[0] = pattern_cmd; - err = iwl_mvm_send_cmd(mvm, &cmd); - kfree(pattern_cmd); - return err; -} - -static int iwl_mvm_send_proto_offload(struct iwl_mvm *mvm, - struct ieee80211_vif *vif) -{ - struct iwl_proto_offload_cmd cmd = {}; -#if IS_ENABLED(CONFIG_IPV6) - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - int i; - - if (mvmvif->num_target_ipv6_addrs) { - cmd.enabled |= cpu_to_le32(IWL_D3_PROTO_OFFLOAD_NS); - memcpy(cmd.ndp_mac_addr, vif->addr, ETH_ALEN); - } - - BUILD_BUG_ON(sizeof(cmd.target_ipv6_addr[i]) != - sizeof(mvmvif->target_ipv6_addrs[i])); - - for (i = 0; i < mvmvif->num_target_ipv6_addrs; i++) - memcpy(cmd.target_ipv6_addr[i], - &mvmvif->target_ipv6_addrs[i], - sizeof(cmd.target_ipv6_addr[i])); -#endif - - if (vif->bss_conf.arp_addr_cnt) { - cmd.enabled |= cpu_to_le32(IWL_D3_PROTO_OFFLOAD_ARP); - cmd.host_ipv4_addr = vif->bss_conf.arp_addr_list[0]; - memcpy(cmd.arp_mac_addr, vif->addr, ETH_ALEN); - } - - if (!cmd.enabled) - return 0; - - return iwl_mvm_send_cmd_pdu(mvm, PROT_OFFLOAD_CONFIG_CMD, CMD_SYNC, - sizeof(cmd), &cmd); -} - -enum iwl_mvm_tcp_packet_type { - MVM_TCP_TX_SYN, - MVM_TCP_RX_SYNACK, - MVM_TCP_TX_DATA, - MVM_TCP_RX_ACK, - MVM_TCP_RX_WAKE, - MVM_TCP_TX_FIN, -}; - -static __le16 pseudo_hdr_check(int len, __be32 saddr, __be32 daddr) -{ - __sum16 check = tcp_v4_check(len, saddr, daddr, 0); - return cpu_to_le16(be16_to_cpu((__force __be16)check)); -} - -static void iwl_mvm_build_tcp_packet(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct cfg80211_wowlan_tcp *tcp, - void *_pkt, u8 *mask, - __le16 *pseudo_hdr_csum, - enum iwl_mvm_tcp_packet_type ptype) -{ - struct { - struct ethhdr eth; - struct iphdr ip; - struct tcphdr tcp; - u8 data[]; - } __packed *pkt = _pkt; - u16 ip_tot_len = sizeof(struct iphdr) + sizeof(struct tcphdr); - int i; - - pkt->eth.h_proto = cpu_to_be16(ETH_P_IP), - pkt->ip.version = 4; - pkt->ip.ihl = 5; - pkt->ip.protocol = IPPROTO_TCP; - - switch (ptype) { - case MVM_TCP_TX_SYN: - case MVM_TCP_TX_DATA: - case MVM_TCP_TX_FIN: - memcpy(pkt->eth.h_dest, tcp->dst_mac, ETH_ALEN); - memcpy(pkt->eth.h_source, vif->addr, ETH_ALEN); - pkt->ip.ttl = 128; - pkt->ip.saddr = tcp->src; - pkt->ip.daddr = tcp->dst; - pkt->tcp.source = cpu_to_be16(tcp->src_port); - pkt->tcp.dest = cpu_to_be16(tcp->dst_port); - /* overwritten for TX SYN later */ - pkt->tcp.doff = sizeof(struct tcphdr) / 4; - pkt->tcp.window = cpu_to_be16(65000); - break; - case MVM_TCP_RX_SYNACK: - case MVM_TCP_RX_ACK: - case MVM_TCP_RX_WAKE: - memcpy(pkt->eth.h_dest, vif->addr, ETH_ALEN); - memcpy(pkt->eth.h_source, tcp->dst_mac, ETH_ALEN); - pkt->ip.saddr = tcp->dst; - pkt->ip.daddr = tcp->src; - pkt->tcp.source = cpu_to_be16(tcp->dst_port); - pkt->tcp.dest = cpu_to_be16(tcp->src_port); - break; - default: - WARN_ON(1); - return; - } - - switch (ptype) { - case MVM_TCP_TX_SYN: - /* firmware assumes 8 option bytes - 8 NOPs for now */ - memset(pkt->data, 0x01, 8); - ip_tot_len += 8; - pkt->tcp.doff = (sizeof(struct tcphdr) + 8) / 4; - pkt->tcp.syn = 1; - break; - case MVM_TCP_TX_DATA: - ip_tot_len += tcp->payload_len; - memcpy(pkt->data, tcp->payload, tcp->payload_len); - pkt->tcp.psh = 1; - pkt->tcp.ack = 1; - break; - case MVM_TCP_TX_FIN: - pkt->tcp.fin = 1; - pkt->tcp.ack = 1; - break; - case MVM_TCP_RX_SYNACK: - pkt->tcp.syn = 1; - pkt->tcp.ack = 1; - break; - case MVM_TCP_RX_ACK: - pkt->tcp.ack = 1; - break; - case MVM_TCP_RX_WAKE: - ip_tot_len += tcp->wake_len; - pkt->tcp.psh = 1; - pkt->tcp.ack = 1; - memcpy(pkt->data, tcp->wake_data, tcp->wake_len); - break; - } - - switch (ptype) { - case MVM_TCP_TX_SYN: - case MVM_TCP_TX_DATA: - case MVM_TCP_TX_FIN: - pkt->ip.tot_len = cpu_to_be16(ip_tot_len); - pkt->ip.check = ip_fast_csum(&pkt->ip, pkt->ip.ihl); - break; - case MVM_TCP_RX_WAKE: - for (i = 0; i < DIV_ROUND_UP(tcp->wake_len, 8); i++) { - u8 tmp = tcp->wake_mask[i]; - mask[i + 6] |= tmp << 6; - if (i + 1 < DIV_ROUND_UP(tcp->wake_len, 8)) - mask[i + 7] = tmp >> 2; - } - /* fall through for ethernet/IP/TCP headers mask */ - case MVM_TCP_RX_SYNACK: - case MVM_TCP_RX_ACK: - mask[0] = 0xff; /* match ethernet */ - /* - * match ethernet, ip.version, ip.ihl - * the ip.ihl half byte is really masked out by firmware - */ - mask[1] = 0x7f; - mask[2] = 0x80; /* match ip.protocol */ - mask[3] = 0xfc; /* match ip.saddr, ip.daddr */ - mask[4] = 0x3f; /* match ip.daddr, tcp.source, tcp.dest */ - mask[5] = 0x80; /* match tcp flags */ - /* leave rest (0 or set for MVM_TCP_RX_WAKE) */ - break; - }; - - *pseudo_hdr_csum = pseudo_hdr_check(ip_tot_len - sizeof(struct iphdr), - pkt->ip.saddr, pkt->ip.daddr); -} - -static int iwl_mvm_send_remote_wake_cfg(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct cfg80211_wowlan_tcp *tcp) -{ - struct iwl_wowlan_remote_wake_config *cfg; - struct iwl_host_cmd cmd = { - .id = REMOTE_WAKE_CONFIG_CMD, - .len = { sizeof(*cfg), }, - .dataflags = { IWL_HCMD_DFL_NOCOPY, }, - .flags = CMD_SYNC, - }; - int ret; - - if (!tcp) - return 0; - - cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); - if (!cfg) - return -ENOMEM; - cmd.data[0] = cfg; - - cfg->max_syn_retries = 10; - cfg->max_data_retries = 10; - cfg->tcp_syn_ack_timeout = 1; /* seconds */ - cfg->tcp_ack_timeout = 1; /* seconds */ - - /* SYN (TX) */ - iwl_mvm_build_tcp_packet( - mvm, vif, tcp, cfg->syn_tx.data, NULL, - &cfg->syn_tx.info.tcp_pseudo_header_checksum, - MVM_TCP_TX_SYN); - cfg->syn_tx.info.tcp_payload_length = 0; - - /* SYN/ACK (RX) */ - iwl_mvm_build_tcp_packet( - mvm, vif, tcp, cfg->synack_rx.data, cfg->synack_rx.rx_mask, - &cfg->synack_rx.info.tcp_pseudo_header_checksum, - MVM_TCP_RX_SYNACK); - cfg->synack_rx.info.tcp_payload_length = 0; - - /* KEEPALIVE/ACK (TX) */ - iwl_mvm_build_tcp_packet( - mvm, vif, tcp, cfg->keepalive_tx.data, NULL, - &cfg->keepalive_tx.info.tcp_pseudo_header_checksum, - MVM_TCP_TX_DATA); - cfg->keepalive_tx.info.tcp_payload_length = - cpu_to_le16(tcp->payload_len); - cfg->sequence_number_offset = tcp->payload_seq.offset; - /* length must be 0..4, the field is little endian */ - cfg->sequence_number_length = tcp->payload_seq.len; - cfg->initial_sequence_number = cpu_to_le32(tcp->payload_seq.start); - cfg->keepalive_interval = cpu_to_le16(tcp->data_interval); - if (tcp->payload_tok.len) { - cfg->token_offset = tcp->payload_tok.offset; - cfg->token_length = tcp->payload_tok.len; - cfg->num_tokens = - cpu_to_le16(tcp->tokens_size % tcp->payload_tok.len); - memcpy(cfg->tokens, tcp->payload_tok.token_stream, - tcp->tokens_size); - } else { - /* set tokens to max value to almost never run out */ - cfg->num_tokens = cpu_to_le16(65535); - } - - /* ACK (RX) */ - iwl_mvm_build_tcp_packet( - mvm, vif, tcp, cfg->keepalive_ack_rx.data, - cfg->keepalive_ack_rx.rx_mask, - &cfg->keepalive_ack_rx.info.tcp_pseudo_header_checksum, - MVM_TCP_RX_ACK); - cfg->keepalive_ack_rx.info.tcp_payload_length = 0; - - /* WAKEUP (RX) */ - iwl_mvm_build_tcp_packet( - mvm, vif, tcp, cfg->wake_rx.data, cfg->wake_rx.rx_mask, - &cfg->wake_rx.info.tcp_pseudo_header_checksum, - MVM_TCP_RX_WAKE); - cfg->wake_rx.info.tcp_payload_length = - cpu_to_le16(tcp->wake_len); - - /* FIN */ - iwl_mvm_build_tcp_packet( - mvm, vif, tcp, cfg->fin_tx.data, NULL, - &cfg->fin_tx.info.tcp_pseudo_header_checksum, - MVM_TCP_TX_FIN); - cfg->fin_tx.info.tcp_payload_length = 0; - - ret = iwl_mvm_send_cmd(mvm, &cmd); - kfree(cfg); - - return ret; -} - -struct iwl_d3_iter_data { - struct iwl_mvm *mvm; - struct ieee80211_vif *vif; - bool error; -}; - -static void iwl_mvm_d3_iface_iterator(void *_data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct iwl_d3_iter_data *data = _data; - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - if (vif->type != NL80211_IFTYPE_STATION || vif->p2p) - return; - - if (mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT) - return; - - if (data->vif) { - IWL_ERR(data->mvm, "More than one managed interface active!\n"); - data->error = true; - return; - } - - data->vif = vif; -} - -static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct ieee80211_sta *ap_sta) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct ieee80211_chanctx_conf *ctx; - u8 chains_static, chains_dynamic; - struct cfg80211_chan_def chandef; - int ret, i; - struct iwl_binding_cmd binding_cmd = {}; - struct iwl_time_quota_cmd quota_cmd = {}; - u32 status; - - /* add back the PHY */ - if (WARN_ON(!mvmvif->phy_ctxt)) - return -EINVAL; - - rcu_read_lock(); - ctx = rcu_dereference(vif->chanctx_conf); - if (WARN_ON(!ctx)) { - rcu_read_unlock(); - return -EINVAL; - } - chandef = ctx->def; - chains_static = ctx->rx_chains_static; - chains_dynamic = ctx->rx_chains_dynamic; - rcu_read_unlock(); - - ret = iwl_mvm_phy_ctxt_add(mvm, mvmvif->phy_ctxt, &chandef, - chains_static, chains_dynamic); - if (ret) - return ret; - - /* add back the MAC */ - mvmvif->uploaded = false; - - if (WARN_ON(!vif->bss_conf.assoc)) - return -EINVAL; - /* hack */ - vif->bss_conf.assoc = false; - ret = iwl_mvm_mac_ctxt_add(mvm, vif); - vif->bss_conf.assoc = true; - if (ret) - return ret; - - /* add back binding - XXX refactor? */ - binding_cmd.id_and_color = - cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->phy_ctxt->id, - mvmvif->phy_ctxt->color)); - binding_cmd.action = cpu_to_le32(FW_CTXT_ACTION_ADD); - binding_cmd.phy = - cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->phy_ctxt->id, - mvmvif->phy_ctxt->color)); - binding_cmd.macs[0] = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, - mvmvif->color)); - for (i = 1; i < MAX_MACS_IN_BINDING; i++) - binding_cmd.macs[i] = cpu_to_le32(FW_CTXT_INVALID); - - status = 0; - ret = iwl_mvm_send_cmd_pdu_status(mvm, BINDING_CONTEXT_CMD, - sizeof(binding_cmd), &binding_cmd, - &status); - if (ret) { - IWL_ERR(mvm, "Failed to add binding: %d\n", ret); - return ret; - } - - if (status) { - IWL_ERR(mvm, "Binding command failed: %u\n", status); - return -EIO; - } - - ret = iwl_mvm_sta_send_to_fw(mvm, ap_sta, false); - if (ret) - return ret; - rcu_assign_pointer(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], ap_sta); - - ret = iwl_mvm_mac_ctxt_changed(mvm, vif); - if (ret) - return ret; - - /* and some quota */ - quota_cmd.quotas[0].id_and_color = - cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->phy_ctxt->id, - mvmvif->phy_ctxt->color)); - quota_cmd.quotas[0].quota = cpu_to_le32(100); - quota_cmd.quotas[0].max_duration = cpu_to_le32(1000); - - for (i = 1; i < MAX_BINDINGS; i++) - quota_cmd.quotas[i].id_and_color = cpu_to_le32(FW_CTXT_INVALID); - - ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC, - sizeof(quota_cmd), "a_cmd); - if (ret) - IWL_ERR(mvm, "Failed to send quota: %d\n", ret); - - return 0; -} - -int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_d3_iter_data suspend_iter_data = { - .mvm = mvm, - }; - struct ieee80211_vif *vif; - struct iwl_mvm_vif *mvmvif; - struct ieee80211_sta *ap_sta; - struct iwl_mvm_sta *mvm_ap_sta; - struct iwl_wowlan_config_cmd wowlan_config_cmd = {}; - struct iwl_wowlan_kek_kck_material_cmd kek_kck_cmd = {}; - struct iwl_wowlan_tkip_params_cmd tkip_cmd = {}; - struct iwl_d3_manager_config d3_cfg_cmd = { - /* - * Program the minimum sleep time to 10 seconds, as many - * platforms have issues processing a wakeup signal while - * still being in the process of suspending. - */ - .min_sleep_time = cpu_to_le32(10 * 1000 * 1000), - }; - struct wowlan_key_data key_data = { - .use_rsc_tsc = false, - .tkip = &tkip_cmd, - .use_tkip = false, - }; - int ret, i; - u16 seq; - u8 old_aux_sta_id, old_ap_sta_id = IWL_MVM_STATION_COUNT; - - if (WARN_ON(!wowlan)) - return -EINVAL; - - key_data.rsc_tsc = kzalloc(sizeof(*key_data.rsc_tsc), GFP_KERNEL); - if (!key_data.rsc_tsc) - return -ENOMEM; - - mutex_lock(&mvm->mutex); - - old_aux_sta_id = mvm->aux_sta.sta_id; - - /* see if there's only a single BSS vif and it's associated */ - ieee80211_iterate_active_interfaces_atomic( - mvm->hw, IEEE80211_IFACE_ITER_NORMAL, - iwl_mvm_d3_iface_iterator, &suspend_iter_data); - - if (suspend_iter_data.error || !suspend_iter_data.vif) { - ret = 1; - goto out_noreset; - } - - vif = suspend_iter_data.vif; - mvmvif = iwl_mvm_vif_from_mac80211(vif); - - ap_sta = rcu_dereference_protected( - mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], - lockdep_is_held(&mvm->mutex)); - if (IS_ERR_OR_NULL(ap_sta)) { - ret = -EINVAL; - goto out_noreset; - } - - mvm_ap_sta = (struct iwl_mvm_sta *)ap_sta->drv_priv; - - /* - * The D3 firmware still hardcodes the AP station ID for the - * BSS we're associated with as 0. Store the real STA ID here - * and assign 0. When we leave this function, we'll restore - * the original value for the resume code. - */ - old_ap_sta_id = mvm_ap_sta->sta_id; - mvm_ap_sta->sta_id = 0; - mvmvif->ap_sta_id = 0; - - /* TODO: wowlan_config_cmd.wowlan_ba_teardown_tids */ - - wowlan_config_cmd.is_11n_connection = ap_sta->ht_cap.ht_supported; - - /* - * We know the last used seqno, and the uCode expects to know that - * one, it will increment before TX. - */ - seq = mvm_ap_sta->last_seq_ctl & IEEE80211_SCTL_SEQ; - wowlan_config_cmd.non_qos_seq = cpu_to_le16(seq); - - /* - * For QoS counters, we store the one to use next, so subtract 0x10 - * since the uCode will add 0x10 *before* using the value while we - * increment after using the value (i.e. store the next value to use). - */ - for (i = 0; i < IWL_MAX_TID_COUNT; i++) { - seq = mvm_ap_sta->tid_data[i].seq_number; - seq -= 0x10; - wowlan_config_cmd.qos_seq[i] = cpu_to_le16(seq); - } - - if (wowlan->disconnect) - wowlan_config_cmd.wakeup_filter |= - cpu_to_le32(IWL_WOWLAN_WAKEUP_BEACON_MISS | - IWL_WOWLAN_WAKEUP_LINK_CHANGE); - if (wowlan->magic_pkt) - wowlan_config_cmd.wakeup_filter |= - cpu_to_le32(IWL_WOWLAN_WAKEUP_MAGIC_PACKET); - if (wowlan->gtk_rekey_failure) - wowlan_config_cmd.wakeup_filter |= - cpu_to_le32(IWL_WOWLAN_WAKEUP_GTK_REKEY_FAIL); - if (wowlan->eap_identity_req) - wowlan_config_cmd.wakeup_filter |= - cpu_to_le32(IWL_WOWLAN_WAKEUP_EAP_IDENT_REQ); - if (wowlan->four_way_handshake) - wowlan_config_cmd.wakeup_filter |= - cpu_to_le32(IWL_WOWLAN_WAKEUP_4WAY_HANDSHAKE); - if (wowlan->n_patterns) - wowlan_config_cmd.wakeup_filter |= - cpu_to_le32(IWL_WOWLAN_WAKEUP_PATTERN_MATCH); - - if (wowlan->rfkill_release) - wowlan_config_cmd.wakeup_filter |= - cpu_to_le32(IWL_WOWLAN_WAKEUP_RF_KILL_DEASSERT); - - if (wowlan->tcp) { - /* - * Set the "link change" (really "link lost") flag as well - * since that implies losing the TCP connection. - */ - wowlan_config_cmd.wakeup_filter |= - cpu_to_le32(IWL_WOWLAN_WAKEUP_REMOTE_LINK_LOSS | - IWL_WOWLAN_WAKEUP_REMOTE_SIGNATURE_TABLE | - IWL_WOWLAN_WAKEUP_REMOTE_WAKEUP_PACKET | - IWL_WOWLAN_WAKEUP_LINK_CHANGE); - } - - iwl_mvm_cancel_scan(mvm); - - iwl_trans_stop_device(mvm->trans); - - /* - * Set the HW restart bit -- this is mostly true as we're - * going to load new firmware and reprogram that, though - * the reprogramming is going to be manual to avoid adding - * all the MACs that aren't support. - * We don't have to clear up everything though because the - * reprogramming is manual. When we resume, we'll actually - * go through a proper restart sequence again to switch - * back to the runtime firmware image. - */ - set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); - - /* We reprogram keys and shouldn't allocate new key indices */ - memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table)); - - mvm->ptk_ivlen = 0; - mvm->ptk_icvlen = 0; - mvm->ptk_ivlen = 0; - mvm->ptk_icvlen = 0; - - /* - * The D3 firmware still hardcodes the AP station ID for the - * BSS we're associated with as 0. As a result, we have to move - * the auxiliary station to ID 1 so the ID 0 remains free for - * the AP station for later. - * We set the sta_id to 1 here, and reset it to its previous - * value (that we stored above) later. - */ - mvm->aux_sta.sta_id = 1; - - ret = iwl_mvm_load_d3_fw(mvm); - if (ret) - goto out; - - ret = iwl_mvm_d3_reprogram(mvm, vif, ap_sta); - if (ret) - goto out; - - if (!iwlwifi_mod_params.sw_crypto) { - /* - * This needs to be unlocked due to lock ordering - * constraints. Since we're in the suspend path - * that isn't really a problem though. - */ - mutex_unlock(&mvm->mutex); - ieee80211_iter_keys(mvm->hw, vif, - iwl_mvm_wowlan_program_keys, - &key_data); - mutex_lock(&mvm->mutex); - if (key_data.error) { - ret = -EIO; - goto out; - } - - if (key_data.use_rsc_tsc) { - struct iwl_host_cmd rsc_tsc_cmd = { - .id = WOWLAN_TSC_RSC_PARAM, - .flags = CMD_SYNC, - .data[0] = key_data.rsc_tsc, - .dataflags[0] = IWL_HCMD_DFL_NOCOPY, - .len[0] = sizeof(*key_data.rsc_tsc), - }; - - ret = iwl_mvm_send_cmd(mvm, &rsc_tsc_cmd); - if (ret) - goto out; - } - - if (key_data.use_tkip) { - ret = iwl_mvm_send_cmd_pdu(mvm, - WOWLAN_TKIP_PARAM, - CMD_SYNC, sizeof(tkip_cmd), - &tkip_cmd); - if (ret) - goto out; - } - - if (mvmvif->rekey_data.valid) { - memset(&kek_kck_cmd, 0, sizeof(kek_kck_cmd)); - memcpy(kek_kck_cmd.kck, mvmvif->rekey_data.kck, - NL80211_KCK_LEN); - kek_kck_cmd.kck_len = cpu_to_le16(NL80211_KCK_LEN); - memcpy(kek_kck_cmd.kek, mvmvif->rekey_data.kek, - NL80211_KEK_LEN); - kek_kck_cmd.kek_len = cpu_to_le16(NL80211_KEK_LEN); - kek_kck_cmd.replay_ctr = mvmvif->rekey_data.replay_ctr; - - ret = iwl_mvm_send_cmd_pdu(mvm, - WOWLAN_KEK_KCK_MATERIAL, - CMD_SYNC, - sizeof(kek_kck_cmd), - &kek_kck_cmd); - if (ret) - goto out; - } - } - - ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_CONFIGURATION, - CMD_SYNC, sizeof(wowlan_config_cmd), - &wowlan_config_cmd); - if (ret) - goto out; - - ret = iwl_mvm_send_patterns(mvm, wowlan); - if (ret) - goto out; - - ret = iwl_mvm_send_proto_offload(mvm, vif); - if (ret) - goto out; - - ret = iwl_mvm_send_remote_wake_cfg(mvm, vif, wowlan->tcp); - if (ret) - goto out; - - /* must be last -- this switches firmware state */ - ret = iwl_mvm_send_cmd_pdu(mvm, D3_CONFIG_CMD, CMD_SYNC, - sizeof(d3_cfg_cmd), &d3_cfg_cmd); - if (ret) - goto out; - - clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); - - iwl_trans_d3_suspend(mvm->trans); - out: - mvm->aux_sta.sta_id = old_aux_sta_id; - mvm_ap_sta->sta_id = old_ap_sta_id; - mvmvif->ap_sta_id = old_ap_sta_id; - out_noreset: - kfree(key_data.rsc_tsc); - if (ret < 0) - ieee80211_restart_hw(mvm->hw); - - mutex_unlock(&mvm->mutex); - - return ret; -} - -static void iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, - struct ieee80211_vif *vif) -{ - u32 base = mvm->error_event_table; - struct error_table_start { - /* cf. struct iwl_error_event_table */ - u32 valid; - u32 error_id; - } err_info; - struct cfg80211_wowlan_wakeup wakeup = { - .pattern_idx = -1, - }; - struct cfg80211_wowlan_wakeup *wakeup_report = &wakeup; - struct iwl_host_cmd cmd = { - .id = WOWLAN_GET_STATUSES, - .flags = CMD_SYNC | CMD_WANT_SKB, - }; - struct iwl_wowlan_status *status; - u32 reasons; - int ret, len; - struct sk_buff *pkt = NULL; - - iwl_trans_read_mem_bytes(mvm->trans, base, - &err_info, sizeof(err_info)); - - if (err_info.valid) { - IWL_INFO(mvm, "error table is valid (%d)\n", - err_info.valid); - if (err_info.error_id == RF_KILL_INDICATOR_FOR_WOWLAN) { - wakeup.rfkill_release = true; - ieee80211_report_wowlan_wakeup(vif, &wakeup, - GFP_KERNEL); - } - return; - } - - /* only for tracing for now */ - ret = iwl_mvm_send_cmd_pdu(mvm, OFFLOADS_QUERY_CMD, CMD_SYNC, 0, NULL); - if (ret) - IWL_ERR(mvm, "failed to query offload statistics (%d)\n", ret); - - ret = iwl_mvm_send_cmd(mvm, &cmd); - if (ret) { - IWL_ERR(mvm, "failed to query status (%d)\n", ret); - return; - } - - /* RF-kill already asserted again... */ - if (!cmd.resp_pkt) - return; - - len = le32_to_cpu(cmd.resp_pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; - if (len - sizeof(struct iwl_cmd_header) < sizeof(*status)) { - IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); - goto out; - } - - status = (void *)cmd.resp_pkt->data; - - if (len - sizeof(struct iwl_cmd_header) != - sizeof(*status) + - ALIGN(le32_to_cpu(status->wake_packet_bufsize), 4)) { - IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); - goto out; - } - - reasons = le32_to_cpu(status->wakeup_reasons); - - if (reasons == IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS) { - wakeup_report = NULL; - goto report; - } - - if (reasons & IWL_WOWLAN_WAKEUP_BY_MAGIC_PACKET) - wakeup.magic_pkt = true; - - if (reasons & IWL_WOWLAN_WAKEUP_BY_PATTERN) - wakeup.pattern_idx = - le16_to_cpu(status->pattern_number); - - if (reasons & (IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_MISSED_BEACON | - IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_DEAUTH)) - wakeup.disconnect = true; - - if (reasons & IWL_WOWLAN_WAKEUP_BY_GTK_REKEY_FAILURE) - wakeup.gtk_rekey_failure = true; - - if (reasons & IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED) - wakeup.rfkill_release = true; - - if (reasons & IWL_WOWLAN_WAKEUP_BY_EAPOL_REQUEST) - wakeup.eap_identity_req = true; - - if (reasons & IWL_WOWLAN_WAKEUP_BY_FOUR_WAY_HANDSHAKE) - wakeup.four_way_handshake = true; - - if (reasons & IWL_WOWLAN_WAKEUP_BY_REM_WAKE_LINK_LOSS) - wakeup.tcp_connlost = true; - - if (reasons & IWL_WOWLAN_WAKEUP_BY_REM_WAKE_SIGNATURE_TABLE) - wakeup.tcp_nomoretokens = true; - - if (reasons & IWL_WOWLAN_WAKEUP_BY_REM_WAKE_WAKEUP_PACKET) - wakeup.tcp_match = true; - - if (status->wake_packet_bufsize) { - int pktsize = le32_to_cpu(status->wake_packet_bufsize); - int pktlen = le32_to_cpu(status->wake_packet_length); - const u8 *pktdata = status->wake_packet; - struct ieee80211_hdr *hdr = (void *)pktdata; - int truncated = pktlen - pktsize; - - /* this would be a firmware bug */ - if (WARN_ON_ONCE(truncated < 0)) - truncated = 0; - - if (ieee80211_is_data(hdr->frame_control)) { - int hdrlen = ieee80211_hdrlen(hdr->frame_control); - int ivlen = 0, icvlen = 4; /* also FCS */ - - pkt = alloc_skb(pktsize, GFP_KERNEL); - if (!pkt) - goto report; - - memcpy(skb_put(pkt, hdrlen), pktdata, hdrlen); - pktdata += hdrlen; - pktsize -= hdrlen; - - if (ieee80211_has_protected(hdr->frame_control)) { - if (is_multicast_ether_addr(hdr->addr1)) { - ivlen = mvm->gtk_ivlen; - icvlen += mvm->gtk_icvlen; - } else { - ivlen = mvm->ptk_ivlen; - icvlen += mvm->ptk_icvlen; - } - } - - /* if truncated, FCS/ICV is (partially) gone */ - if (truncated >= icvlen) { - icvlen = 0; - truncated -= icvlen; - } else { - icvlen -= truncated; - truncated = 0; - } - - pktsize -= ivlen + icvlen; - pktdata += ivlen; - - memcpy(skb_put(pkt, pktsize), pktdata, pktsize); - - if (ieee80211_data_to_8023(pkt, vif->addr, vif->type)) - goto report; - wakeup.packet = pkt->data; - wakeup.packet_present_len = pkt->len; - wakeup.packet_len = pkt->len - truncated; - wakeup.packet_80211 = false; - } else { - int fcslen = 4; - - if (truncated >= 4) { - truncated -= 4; - fcslen = 0; - } else { - fcslen -= truncated; - truncated = 0; - } - pktsize -= fcslen; - wakeup.packet = status->wake_packet; - wakeup.packet_present_len = pktsize; - wakeup.packet_len = pktlen - truncated; - wakeup.packet_80211 = true; - } - } - - report: - ieee80211_report_wowlan_wakeup(vif, wakeup_report, GFP_KERNEL); - kfree_skb(pkt); - - out: - iwl_free_resp(&cmd); -} - -int iwl_mvm_resume(struct ieee80211_hw *hw) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_d3_iter_data resume_iter_data = { - .mvm = mvm, - }; - struct ieee80211_vif *vif = NULL; - int ret; - enum iwl_d3_status d3_status; - - mutex_lock(&mvm->mutex); - - /* get the BSS vif pointer again */ - ieee80211_iterate_active_interfaces_atomic( - mvm->hw, IEEE80211_IFACE_ITER_NORMAL, - iwl_mvm_d3_iface_iterator, &resume_iter_data); - - if (WARN_ON(resume_iter_data.error || !resume_iter_data.vif)) - goto out_unlock; - - vif = resume_iter_data.vif; - - ret = iwl_trans_d3_resume(mvm->trans, &d3_status); - if (ret) - goto out_unlock; - - if (d3_status != IWL_D3_STATUS_ALIVE) { - IWL_INFO(mvm, "Device was reset during suspend\n"); - goto out_unlock; - } - - iwl_mvm_query_wakeup_reasons(mvm, vif); - - out_unlock: - mutex_unlock(&mvm->mutex); - - if (vif) - ieee80211_resume_disconnect(vif); - - /* return 1 to reconfigure the device */ - set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); - return 1; -} - -void iwl_mvm_set_wakeup(struct ieee80211_hw *hw, bool enabled) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - - device_set_wakeup_enable(mvm->trans->dev, enabled); -} diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c deleted file mode 100644 index 109dc8e437f5..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c +++ /dev/null @@ -1,619 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#include "mvm.h" -#include "sta.h" -#include "iwl-io.h" - -struct iwl_dbgfs_mvm_ctx { - struct iwl_mvm *mvm; - struct ieee80211_vif *vif; -}; - -static ssize_t iwl_dbgfs_tx_flush_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_mvm *mvm = file->private_data; - - char buf[16]; - int buf_size, ret; - u32 scd_q_msk; - - if (!mvm->ucode_loaded || mvm->cur_ucode != IWL_UCODE_REGULAR) - return -EIO; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - - if (sscanf(buf, "%x", &scd_q_msk) != 1) - return -EINVAL; - - IWL_ERR(mvm, "FLUSHING queues: scd_q_msk = 0x%x\n", scd_q_msk); - - mutex_lock(&mvm->mutex); - ret = iwl_mvm_flush_tx_path(mvm, scd_q_msk, true) ? : count; - mutex_unlock(&mvm->mutex); - - return ret; -} - -static ssize_t iwl_dbgfs_sta_drain_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_mvm *mvm = file->private_data; - struct ieee80211_sta *sta; - - char buf[8]; - int buf_size, sta_id, drain, ret; - - if (!mvm->ucode_loaded || mvm->cur_ucode != IWL_UCODE_REGULAR) - return -EIO; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - - if (sscanf(buf, "%d %d", &sta_id, &drain) != 2) - return -EINVAL; - if (sta_id < 0 || sta_id >= IWL_MVM_STATION_COUNT) - return -EINVAL; - if (drain < 0 || drain > 1) - return -EINVAL; - - mutex_lock(&mvm->mutex); - - sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], - lockdep_is_held(&mvm->mutex)); - if (IS_ERR_OR_NULL(sta)) - ret = -ENOENT; - else - ret = iwl_mvm_drain_sta(mvm, (void *)sta->drv_priv, drain) ? : - count; - - mutex_unlock(&mvm->mutex); - - return ret; -} - -static ssize_t iwl_dbgfs_sram_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_mvm *mvm = file->private_data; - const struct fw_img *img; - int ofs, len, pos = 0; - size_t bufsz, ret; - char *buf; - u8 *ptr; - - /* default is to dump the entire data segment */ - if (!mvm->dbgfs_sram_offset && !mvm->dbgfs_sram_len) { - mvm->dbgfs_sram_offset = 0x800000; - if (!mvm->ucode_loaded) - return -EINVAL; - img = &mvm->fw->img[mvm->cur_ucode]; - mvm->dbgfs_sram_len = img->sec[IWL_UCODE_SECTION_DATA].len; - } - len = mvm->dbgfs_sram_len; - - bufsz = len * 4 + 256; - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - ptr = kzalloc(len, GFP_KERNEL); - if (!ptr) { - kfree(buf); - return -ENOMEM; - } - - pos += scnprintf(buf + pos, bufsz - pos, "sram_len: 0x%x\n", len); - pos += scnprintf(buf + pos, bufsz - pos, "sram_offset: 0x%x\n", - mvm->dbgfs_sram_offset); - - iwl_trans_read_mem_bytes(mvm->trans, - mvm->dbgfs_sram_offset, - ptr, len); - for (ofs = 0; ofs < len; ofs += 16) { - pos += scnprintf(buf + pos, bufsz - pos, "0x%.4x ", ofs); - hex_dump_to_buffer(ptr + ofs, 16, 16, 1, buf + pos, - bufsz - pos, false); - pos += strlen(buf + pos); - if (bufsz - pos > 0) - buf[pos++] = '\n'; - } - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - - kfree(buf); - kfree(ptr); - - return ret; -} - -static ssize_t iwl_dbgfs_sram_write(struct file *file, - const char __user *user_buf, size_t count, - loff_t *ppos) -{ - struct iwl_mvm *mvm = file->private_data; - char buf[64]; - int buf_size; - u32 offset, len; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - - if (sscanf(buf, "%x,%x", &offset, &len) == 2) { - if ((offset & 0x3) || (len & 0x3)) - return -EINVAL; - mvm->dbgfs_sram_offset = offset; - mvm->dbgfs_sram_len = len; - } else { - mvm->dbgfs_sram_offset = 0; - mvm->dbgfs_sram_len = 0; - } - - return count; -} - -static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_mvm *mvm = file->private_data; - struct ieee80211_sta *sta; - char buf[400]; - int i, pos = 0, bufsz = sizeof(buf); - - mutex_lock(&mvm->mutex); - - for (i = 0; i < IWL_MVM_STATION_COUNT; i++) { - pos += scnprintf(buf + pos, bufsz - pos, "%.2d: ", i); - sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], - lockdep_is_held(&mvm->mutex)); - if (!sta) - pos += scnprintf(buf + pos, bufsz - pos, "N/A\n"); - else if (IS_ERR(sta)) - pos += scnprintf(buf + pos, bufsz - pos, "%ld\n", - PTR_ERR(sta)); - else - pos += scnprintf(buf + pos, bufsz - pos, "%pM\n", - sta->addr); - } - - mutex_unlock(&mvm->mutex); - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_power_down_allow_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_mvm *mvm = file->private_data; - char buf[8] = {}; - int allow; - - if (!mvm->ucode_loaded) - return -EIO; - - if (copy_from_user(buf, user_buf, sizeof(buf))) - return -EFAULT; - - if (sscanf(buf, "%d", &allow) != 1) - return -EINVAL; - - IWL_DEBUG_POWER(mvm, "%s device power down\n", - allow ? "allow" : "prevent"); - - /* - * TODO: Send REPLY_DEBUG_CMD (0xf0) when FW support it - */ - - return count; -} - -static ssize_t iwl_dbgfs_power_down_d3_allow_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_mvm *mvm = file->private_data; - char buf[8] = {}; - int allow; - - if (copy_from_user(buf, user_buf, sizeof(buf))) - return -EFAULT; - - if (sscanf(buf, "%d", &allow) != 1) - return -EINVAL; - - IWL_DEBUG_POWER(mvm, "%s device power down in d3\n", - allow ? "allow" : "prevent"); - - /* - * TODO: When WoWLAN FW alive notification happens, driver will send - * REPLY_DEBUG_CMD setting power_down_allow flag according to - * mvm->prevent_power_down_d3 - */ - mvm->prevent_power_down_d3 = !allow; - - return count; -} - -static ssize_t iwl_dbgfs_mac_params_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ieee80211_vif *vif = file->private_data; - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct iwl_mvm *mvm = mvmvif->dbgfs_data; - u8 ap_sta_id; - struct ieee80211_chanctx_conf *chanctx_conf; - char buf[512]; - int bufsz = sizeof(buf); - int pos = 0; - int i; - - mutex_lock(&mvm->mutex); - - ap_sta_id = mvmvif->ap_sta_id; - - pos += scnprintf(buf+pos, bufsz-pos, "mac id/color: %d / %d\n", - mvmvif->id, mvmvif->color); - pos += scnprintf(buf+pos, bufsz-pos, "bssid: %pM\n", - vif->bss_conf.bssid); - pos += scnprintf(buf+pos, bufsz-pos, "QoS:\n"); - for (i = 0; i < ARRAY_SIZE(mvmvif->queue_params); i++) { - pos += scnprintf(buf+pos, bufsz-pos, - "\t%d: txop:%d - cw_min:%d - cw_max = %d - aifs = %d upasd = %d\n", - i, mvmvif->queue_params[i].txop, - mvmvif->queue_params[i].cw_min, - mvmvif->queue_params[i].cw_max, - mvmvif->queue_params[i].aifs, - mvmvif->queue_params[i].uapsd); - } - - if (vif->type == NL80211_IFTYPE_STATION && - ap_sta_id != IWL_MVM_STATION_COUNT) { - struct ieee80211_sta *sta; - struct iwl_mvm_sta *mvm_sta; - - sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[ap_sta_id], - lockdep_is_held(&mvm->mutex)); - mvm_sta = (void *)sta->drv_priv; - pos += scnprintf(buf+pos, bufsz-pos, - "ap_sta_id %d - reduced Tx power %d\n", - ap_sta_id, mvm_sta->bt_reduced_txpower); - } - - rcu_read_lock(); - chanctx_conf = rcu_dereference(vif->chanctx_conf); - if (chanctx_conf) { - pos += scnprintf(buf+pos, bufsz-pos, - "idle rx chains %d, active rx chains: %d\n", - chanctx_conf->rx_chains_static, - chanctx_conf->rx_chains_dynamic); - } - rcu_read_unlock(); - - mutex_unlock(&mvm->mutex); - - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -#define BT_MBOX_MSG(_notif, _num, _field) \ - ((le32_to_cpu((_notif)->mbox_msg[(_num)]) & BT_MBOX##_num##_##_field)\ - >> BT_MBOX##_num##_##_field##_POS) - - -#define BT_MBOX_PRINT(_num, _field, _end) \ - pos += scnprintf(buf + pos, bufsz - pos, \ - "\t%s: %d%s", \ - #_field, \ - BT_MBOX_MSG(notif, _num, _field), \ - true ? "\n" : ", "); - -static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_mvm *mvm = file->private_data; - struct iwl_bt_coex_profile_notif *notif = &mvm->last_bt_notif; - char *buf; - int ret, pos = 0, bufsz = sizeof(char) * 1024; - - buf = kmalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - mutex_lock(&mvm->mutex); - - pos += scnprintf(buf+pos, bufsz-pos, "MBOX dw0:\n"); - - BT_MBOX_PRINT(0, LE_SLAVE_LAT, false); - BT_MBOX_PRINT(0, LE_PROF1, false); - BT_MBOX_PRINT(0, LE_PROF2, false); - BT_MBOX_PRINT(0, LE_PROF_OTHER, false); - BT_MBOX_PRINT(0, CHL_SEQ_N, false); - BT_MBOX_PRINT(0, INBAND_S, false); - BT_MBOX_PRINT(0, LE_MIN_RSSI, false); - BT_MBOX_PRINT(0, LE_SCAN, false); - BT_MBOX_PRINT(0, LE_ADV, false); - BT_MBOX_PRINT(0, LE_MAX_TX_POWER, false); - BT_MBOX_PRINT(0, OPEN_CON_1, true); - - pos += scnprintf(buf+pos, bufsz-pos, "MBOX dw1:\n"); - - BT_MBOX_PRINT(1, BR_MAX_TX_POWER, false); - BT_MBOX_PRINT(1, IP_SR, false); - BT_MBOX_PRINT(1, LE_MSTR, false); - BT_MBOX_PRINT(1, AGGR_TRFC_LD, false); - BT_MBOX_PRINT(1, MSG_TYPE, false); - BT_MBOX_PRINT(1, SSN, true); - - pos += scnprintf(buf+pos, bufsz-pos, "MBOX dw2:\n"); - - BT_MBOX_PRINT(2, SNIFF_ACT, false); - BT_MBOX_PRINT(2, PAG, false); - BT_MBOX_PRINT(2, INQUIRY, false); - BT_MBOX_PRINT(2, CONN, false); - BT_MBOX_PRINT(2, SNIFF_INTERVAL, false); - BT_MBOX_PRINT(2, DISC, false); - BT_MBOX_PRINT(2, SCO_TX_ACT, false); - BT_MBOX_PRINT(2, SCO_RX_ACT, false); - BT_MBOX_PRINT(2, ESCO_RE_TX, false); - BT_MBOX_PRINT(2, SCO_DURATION, true); - - pos += scnprintf(buf+pos, bufsz-pos, "MBOX dw3:\n"); - - BT_MBOX_PRINT(3, SCO_STATE, false); - BT_MBOX_PRINT(3, SNIFF_STATE, false); - BT_MBOX_PRINT(3, A2DP_STATE, false); - BT_MBOX_PRINT(3, ACL_STATE, false); - BT_MBOX_PRINT(3, MSTR_STATE, false); - BT_MBOX_PRINT(3, OBX_STATE, false); - BT_MBOX_PRINT(3, OPEN_CON_2, false); - BT_MBOX_PRINT(3, TRAFFIC_LOAD, false); - BT_MBOX_PRINT(3, CHL_SEQN_LSB, false); - BT_MBOX_PRINT(3, INBAND_P, false); - BT_MBOX_PRINT(3, MSG_TYPE_2, false); - BT_MBOX_PRINT(3, SSN_2, false); - BT_MBOX_PRINT(3, UPDATE_REQUEST, true); - - pos += scnprintf(buf+pos, bufsz-pos, "bt_status = %d\n", - notif->bt_status); - pos += scnprintf(buf+pos, bufsz-pos, "bt_open_conn = %d\n", - notif->bt_open_conn); - pos += scnprintf(buf+pos, bufsz-pos, "bt_traffic_load = %d\n", - notif->bt_traffic_load); - pos += scnprintf(buf+pos, bufsz-pos, "bt_agg_traffic_load = %d\n", - notif->bt_agg_traffic_load); - pos += scnprintf(buf+pos, bufsz-pos, "bt_ci_compliance = %d\n", - notif->bt_ci_compliance); - - mutex_unlock(&mvm->mutex); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - - return ret; -} -#undef BT_MBOX_PRINT - -static ssize_t iwl_dbgfs_fw_restart_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_mvm *mvm = file->private_data; - bool restart_fw = iwlwifi_mod_params.restart_fw; - int ret; - - iwlwifi_mod_params.restart_fw = true; - - mutex_lock(&mvm->mutex); - - /* take the return value to make compiler happy - it will fail anyway */ - ret = iwl_mvm_send_cmd_pdu(mvm, REPLY_ERROR, CMD_SYNC, 0, NULL); - - mutex_unlock(&mvm->mutex); - - iwlwifi_mod_params.restart_fw = restart_fw; - - return count; -} - -#define MVM_DEBUGFS_READ_FILE_OPS(name) \ -static const struct file_operations iwl_dbgfs_##name##_ops = { \ - .read = iwl_dbgfs_##name##_read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -} - -#define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name) \ -static const struct file_operations iwl_dbgfs_##name##_ops = { \ - .write = iwl_dbgfs_##name##_write, \ - .read = iwl_dbgfs_##name##_read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -#define MVM_DEBUGFS_WRITE_FILE_OPS(name) \ -static const struct file_operations iwl_dbgfs_##name##_ops = { \ - .write = iwl_dbgfs_##name##_write, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -#define MVM_DEBUGFS_ADD_FILE(name, parent, mode) do { \ - if (!debugfs_create_file(#name, mode, parent, mvm, \ - &iwl_dbgfs_##name##_ops)) \ - goto err; \ - } while (0) - -#define MVM_DEBUGFS_ADD_FILE_VIF(name, parent, mode) do { \ - if (!debugfs_create_file(#name, mode, parent, vif, \ - &iwl_dbgfs_##name##_ops)) \ - goto err; \ - } while (0) - -/* Device wide debugfs entries */ -MVM_DEBUGFS_WRITE_FILE_OPS(tx_flush); -MVM_DEBUGFS_WRITE_FILE_OPS(sta_drain); -MVM_DEBUGFS_READ_WRITE_FILE_OPS(sram); -MVM_DEBUGFS_READ_FILE_OPS(stations); -MVM_DEBUGFS_READ_FILE_OPS(bt_notif); -MVM_DEBUGFS_WRITE_FILE_OPS(power_down_allow); -MVM_DEBUGFS_WRITE_FILE_OPS(power_down_d3_allow); -MVM_DEBUGFS_WRITE_FILE_OPS(fw_restart); - -/* Interface specific debugfs entries */ -MVM_DEBUGFS_READ_FILE_OPS(mac_params); - -int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir) -{ - char buf[100]; - - mvm->debugfs_dir = dbgfs_dir; - - MVM_DEBUGFS_ADD_FILE(tx_flush, mvm->debugfs_dir, S_IWUSR); - MVM_DEBUGFS_ADD_FILE(sta_drain, mvm->debugfs_dir, S_IWUSR); - MVM_DEBUGFS_ADD_FILE(sram, mvm->debugfs_dir, S_IWUSR | S_IRUSR); - MVM_DEBUGFS_ADD_FILE(stations, dbgfs_dir, S_IRUSR); - MVM_DEBUGFS_ADD_FILE(bt_notif, dbgfs_dir, S_IRUSR); - MVM_DEBUGFS_ADD_FILE(power_down_allow, mvm->debugfs_dir, S_IWUSR); - MVM_DEBUGFS_ADD_FILE(power_down_d3_allow, mvm->debugfs_dir, S_IWUSR); - MVM_DEBUGFS_ADD_FILE(fw_restart, mvm->debugfs_dir, S_IWUSR); - - /* - * Create a symlink with mac80211. It will be removed when mac80211 - * exists (before the opmode exists which removes the target.) - */ - snprintf(buf, 100, "../../%s/%s", - dbgfs_dir->d_parent->d_parent->d_name.name, - dbgfs_dir->d_parent->d_name.name); - if (!debugfs_create_symlink("iwlwifi", mvm->hw->wiphy->debugfsdir, buf)) - goto err; - - return 0; -err: - IWL_ERR(mvm, "Can't create the mvm debugfs directory\n"); - return -ENOMEM; -} - -void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) -{ - struct dentry *dbgfs_dir = vif->debugfs_dir; - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - char buf[100]; - - if (!dbgfs_dir) - return; - - mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir); - mvmvif->dbgfs_data = mvm; - - if (!mvmvif->dbgfs_dir) { - IWL_ERR(mvm, "Failed to create debugfs directory under %s\n", - dbgfs_dir->d_name.name); - return; - } - - MVM_DEBUGFS_ADD_FILE_VIF(mac_params, mvmvif->dbgfs_dir, - S_IRUSR); - - /* - * Create symlink for convenience pointing to interface specific - * debugfs entries for the driver. For example, under - * /sys/kernel/debug/iwlwifi/0000\:02\:00.0/iwlmvm/ - * find - * netdev:wlan0 -> ../../../ieee80211/phy0/netdev:wlan0/iwlmvm/ - */ - snprintf(buf, 100, "../../../%s/%s/%s/%s", - dbgfs_dir->d_parent->d_parent->d_name.name, - dbgfs_dir->d_parent->d_name.name, - dbgfs_dir->d_name.name, - mvmvif->dbgfs_dir->d_name.name); - - mvmvif->dbgfs_slink = debugfs_create_symlink(dbgfs_dir->d_name.name, - mvm->debugfs_dir, buf); - if (!mvmvif->dbgfs_slink) - IWL_ERR(mvm, "Can't create debugfs symbolic link under %s\n", - dbgfs_dir->d_name.name); - return; -err: - IWL_ERR(mvm, "Can't create debugfs entity\n"); -} - -void iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - debugfs_remove(mvmvif->dbgfs_slink); - mvmvif->dbgfs_slink = NULL; - - debugfs_remove_recursive(mvmvif->dbgfs_dir); - mvmvif->dbgfs_dir = NULL; -} diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-bt-coex.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-bt-coex.h deleted file mode 100644 index 05c61d6f384e..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-bt-coex.h +++ /dev/null @@ -1,319 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef __fw_api_bt_coex_h__ -#define __fw_api_bt_coex_h__ - -#include -#include - -#define BITS(nb) (BIT(nb) - 1) - -/** - * enum iwl_bt_coex_flags - flags for BT_COEX command - * @BT_CH_PRIMARY_EN: - * @BT_CH_SECONDARY_EN: - * @BT_NOTIF_COEX_OFF: - * @BT_COEX_MODE_POS: - * @BT_COEX_MODE_MSK: - * @BT_COEX_DISABLE: - * @BT_COEX_2W: - * @BT_COEX_3W: - * @BT_COEX_NW: - * @BT_USE_DEFAULTS: - * @BT_SYNC_2_BT_DISABLE: - * @BT_COEX_CORUNNING_TBL_EN: - */ -enum iwl_bt_coex_flags { - BT_CH_PRIMARY_EN = BIT(0), - BT_CH_SECONDARY_EN = BIT(1), - BT_NOTIF_COEX_OFF = BIT(2), - BT_COEX_MODE_POS = 3, - BT_COEX_MODE_MSK = BITS(3) << BT_COEX_MODE_POS, - BT_COEX_DISABLE = 0x0 << BT_COEX_MODE_POS, - BT_COEX_2W = 0x1 << BT_COEX_MODE_POS, - BT_COEX_3W = 0x2 << BT_COEX_MODE_POS, - BT_COEX_NW = 0x3 << BT_COEX_MODE_POS, - BT_USE_DEFAULTS = BIT(6), - BT_SYNC_2_BT_DISABLE = BIT(7), - /* - * For future use - when the flags will be enlarged - * BT_COEX_CORUNNING_TBL_EN = BIT(8), - */ -}; - -/* - * indicates what has changed in the BT_COEX command. - */ -enum iwl_bt_coex_valid_bit_msk { - BT_VALID_ENABLE = BIT(0), - BT_VALID_BT_PRIO_BOOST = BIT(1), - BT_VALID_MAX_KILL = BIT(2), - BT_VALID_3W_TMRS = BIT(3), - BT_VALID_KILL_ACK = BIT(4), - BT_VALID_KILL_CTS = BIT(5), - BT_VALID_REDUCED_TX_POWER = BIT(6), - BT_VALID_LUT = BIT(7), - BT_VALID_WIFI_RX_SW_PRIO_BOOST = BIT(8), - BT_VALID_WIFI_TX_SW_PRIO_BOOST = BIT(9), - BT_VALID_MULTI_PRIO_LUT = BIT(10), - BT_VALID_TRM_KICK_FILTER = BIT(11), - BT_VALID_CORUN_LUT_20 = BIT(12), - BT_VALID_CORUN_LUT_40 = BIT(13), - BT_VALID_ANT_ISOLATION = BIT(14), - BT_VALID_ANT_ISOLATION_THRS = BIT(15), - /* - * For future use - when the valid flags will be enlarged - * BT_VALID_TXTX_DELTA_FREQ_THRS = BIT(16), - * BT_VALID_TXRX_MAX_FREQ_0 = BIT(17), - */ -}; - -/** - * enum iwl_bt_reduced_tx_power - allows to reduce txpower for WiFi frames. - * @BT_REDUCED_TX_POWER_CTL: reduce Tx power for control frames - * @BT_REDUCED_TX_POWER_DATA: reduce Tx power for data frames - * - * This mechanism allows to have BT and WiFi run concurrently. Since WiFi - * reduces its Tx power, it can work along with BT, hence reducing the amount - * of WiFi frames being killed by BT. - */ -enum iwl_bt_reduced_tx_power { - BT_REDUCED_TX_POWER_CTL = BIT(0), - BT_REDUCED_TX_POWER_DATA = BIT(1), -}; - -#define BT_COEX_LUT_SIZE (12) - -/** - * struct iwl_bt_coex_cmd - bt coex configuration command - * @flags:&enum iwl_bt_coex_flags - * @lead_time: - * @max_kill: - * @bt3_time_t7_value: - * @kill_ack_msk: - * @kill_cts_msk: - * @bt3_prio_sample_time: - * @bt3_timer_t2_value: - * @bt4_reaction_time: - * @decision_lut[12]: - * @bt_reduced_tx_power: enum %iwl_bt_reduced_tx_power - * @valid_bit_msk: enum %iwl_bt_coex_valid_bit_msk - * @bt_prio_boost: values for PTA boost register - * @wifi_tx_prio_boost: SW boost of wifi tx priority - * @wifi_rx_prio_boost: SW boost of wifi rx priority - * - * The structure is used for the BT_COEX command. - */ -struct iwl_bt_coex_cmd { - u8 flags; - u8 lead_time; - u8 max_kill; - u8 bt3_time_t7_value; - __le32 kill_ack_msk; - __le32 kill_cts_msk; - u8 bt3_prio_sample_time; - u8 bt3_timer_t2_value; - __le16 bt4_reaction_time; - __le32 decision_lut[BT_COEX_LUT_SIZE]; - u8 bt_reduced_tx_power; - u8 reserved; - __le16 valid_bit_msk; - __le32 bt_prio_boost; - u8 reserved2; - u8 wifi_tx_prio_boost; - __le16 wifi_rx_prio_boost; -} __packed; /* BT_COEX_CMD_API_S_VER_3 */ - -#define BT_MBOX(n_dw, _msg, _pos, _nbits) \ - BT_MBOX##n_dw##_##_msg##_POS = (_pos), \ - BT_MBOX##n_dw##_##_msg = BITS(_nbits) << BT_MBOX##n_dw##_##_msg##_POS - -enum iwl_bt_mxbox_dw0 { - BT_MBOX(0, LE_SLAVE_LAT, 0, 3), - BT_MBOX(0, LE_PROF1, 3, 1), - BT_MBOX(0, LE_PROF2, 4, 1), - BT_MBOX(0, LE_PROF_OTHER, 5, 1), - BT_MBOX(0, CHL_SEQ_N, 8, 4), - BT_MBOX(0, INBAND_S, 13, 1), - BT_MBOX(0, LE_MIN_RSSI, 16, 4), - BT_MBOX(0, LE_SCAN, 20, 1), - BT_MBOX(0, LE_ADV, 21, 1), - BT_MBOX(0, LE_MAX_TX_POWER, 24, 4), - BT_MBOX(0, OPEN_CON_1, 28, 2), -}; - -enum iwl_bt_mxbox_dw1 { - BT_MBOX(1, BR_MAX_TX_POWER, 0, 4), - BT_MBOX(1, IP_SR, 4, 1), - BT_MBOX(1, LE_MSTR, 5, 1), - BT_MBOX(1, AGGR_TRFC_LD, 8, 6), - BT_MBOX(1, MSG_TYPE, 16, 3), - BT_MBOX(1, SSN, 19, 2), -}; - -enum iwl_bt_mxbox_dw2 { - BT_MBOX(2, SNIFF_ACT, 0, 3), - BT_MBOX(2, PAG, 3, 1), - BT_MBOX(2, INQUIRY, 4, 1), - BT_MBOX(2, CONN, 5, 1), - BT_MBOX(2, SNIFF_INTERVAL, 8, 5), - BT_MBOX(2, DISC, 13, 1), - BT_MBOX(2, SCO_TX_ACT, 16, 2), - BT_MBOX(2, SCO_RX_ACT, 18, 2), - BT_MBOX(2, ESCO_RE_TX, 20, 2), - BT_MBOX(2, SCO_DURATION, 24, 6), -}; - -enum iwl_bt_mxbox_dw3 { - BT_MBOX(3, SCO_STATE, 0, 1), - BT_MBOX(3, SNIFF_STATE, 1, 1), - BT_MBOX(3, A2DP_STATE, 2, 1), - BT_MBOX(3, ACL_STATE, 3, 1), - BT_MBOX(3, MSTR_STATE, 4, 1), - BT_MBOX(3, OBX_STATE, 5, 1), - BT_MBOX(3, OPEN_CON_2, 8, 2), - BT_MBOX(3, TRAFFIC_LOAD, 10, 2), - BT_MBOX(3, CHL_SEQN_LSB, 12, 1), - BT_MBOX(3, INBAND_P, 13, 1), - BT_MBOX(3, MSG_TYPE_2, 16, 3), - BT_MBOX(3, SSN_2, 19, 2), - BT_MBOX(3, UPDATE_REQUEST, 21, 1), -}; - -#define BT_MBOX_MSG(_notif, _num, _field) \ - ((le32_to_cpu((_notif)->mbox_msg[(_num)]) & BT_MBOX##_num##_##_field)\ - >> BT_MBOX##_num##_##_field##_POS) - -/** - * struct iwl_bt_coex_profile_notif - notification about BT coex - * @mbox_msg: message from BT to WiFi - * @:bt_status: 0 - off, 1 - on - * @:bt_open_conn: number of BT connections open - * @:bt_traffic_load: load of BT traffic - * @:bt_agg_traffic_load: aggregated load of BT traffic - * @:bt_ci_compliance: 0 - no CI compliance, 1 - CI compliant - */ -struct iwl_bt_coex_profile_notif { - __le32 mbox_msg[4]; - u8 bt_status; - u8 bt_open_conn; - u8 bt_traffic_load; - u8 bt_agg_traffic_load; - u8 bt_ci_compliance; - u8 reserved[3]; -} __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_2 */ - -enum iwl_bt_coex_prio_table_event { - BT_COEX_PRIO_TBL_EVT_INIT_CALIB1 = 0, - BT_COEX_PRIO_TBL_EVT_INIT_CALIB2 = 1, - BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW1 = 2, - BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW2 = 3, - BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH1 = 4, - BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH2 = 5, - BT_COEX_PRIO_TBL_EVT_DTIM = 6, - BT_COEX_PRIO_TBL_EVT_SCAN52 = 7, - BT_COEX_PRIO_TBL_EVT_SCAN24 = 8, - BT_COEX_PRIO_TBL_EVT_IDLE = 9, - BT_COEX_PRIO_TBL_EVT_MAX = 16, -}; /* BT_COEX_PRIO_TABLE_EVENTS_API_E_VER_1 */ - -enum iwl_bt_coex_prio_table_prio { - BT_COEX_PRIO_TBL_DISABLED = 0, - BT_COEX_PRIO_TBL_PRIO_LOW = 1, - BT_COEX_PRIO_TBL_PRIO_HIGH = 2, - BT_COEX_PRIO_TBL_PRIO_BYPASS = 3, - BT_COEX_PRIO_TBL_PRIO_COEX_OFF = 4, - BT_COEX_PRIO_TBL_PRIO_COEX_ON = 5, - BT_COEX_PRIO_TBL_PRIO_COEX_IDLE = 6, - BT_COEX_PRIO_TBL_MAX = 8, -}; /* BT_COEX_PRIO_TABLE_PRIORITIES_API_E_VER_1 */ - -#define BT_COEX_PRIO_TBL_SHRD_ANT_POS (0) -#define BT_COEX_PRIO_TBL_PRIO_POS (1) -#define BT_COEX_PRIO_TBL_RESERVED_POS (4) - -/** - * struct iwl_bt_coex_prio_tbl_cmd - priority table for BT coex - * @prio_tbl: - */ -struct iwl_bt_coex_prio_tbl_cmd { - u8 prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX]; -} __packed; - -enum iwl_bt_coex_env_action { - BT_COEX_ENV_CLOSE = 0, - BT_COEX_ENV_OPEN = 1, -}; /* BT_COEX_PROT_ENV_ACTION_API_E_VER_1 */ - -/** - * struct iwl_bt_coex_prot_env_cmd - BT Protection Envelope - * @action: enum %iwl_bt_coex_env_action - * @type: enum %iwl_bt_coex_prio_table_event - */ -struct iwl_bt_coex_prot_env_cmd { - u8 action; /* 0 = closed, 1 = open */ - u8 type; /* 0 .. 15 */ - u8 reserved[2]; -} __packed; - -#endif /* __fw_api_bt_coex_h__ */ diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h deleted file mode 100644 index 6f8b2c16ae17..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h +++ /dev/null @@ -1,333 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef __fw_api_d3_h__ -#define __fw_api_d3_h__ - -/** - * enum iwl_d3_wakeup_flags - D3 manager wakeup flags - * @IWL_WAKEUP_D3_CONFIG_FW_ERROR: wake up on firmware sysassert - */ -enum iwl_d3_wakeup_flags { - IWL_WAKEUP_D3_CONFIG_FW_ERROR = BIT(0), -}; /* D3_MANAGER_WAKEUP_CONFIG_API_E_VER_3 */ - -/** - * struct iwl_d3_manager_config - D3 manager configuration command - * @min_sleep_time: minimum sleep time (in usec) - * @wakeup_flags: wakeup flags, see &enum iwl_d3_wakeup_flags - * @wakeup_host_timer: force wakeup after this many seconds - * - * The structure is used for the D3_CONFIG_CMD command. - */ -struct iwl_d3_manager_config { - __le32 min_sleep_time; - __le32 wakeup_flags; - __le32 wakeup_host_timer; -} __packed; /* D3_MANAGER_CONFIG_CMD_S_VER_4 */ - - -/* TODO: OFFLOADS_QUERY_API_S_VER_1 */ - -/** - * enum iwl_d3_proto_offloads - enabled protocol offloads - * @IWL_D3_PROTO_OFFLOAD_ARP: ARP data is enabled - * @IWL_D3_PROTO_OFFLOAD_NS: NS (Neighbor Solicitation) is enabled - */ -enum iwl_proto_offloads { - IWL_D3_PROTO_OFFLOAD_ARP = BIT(0), - IWL_D3_PROTO_OFFLOAD_NS = BIT(1), -}; - -#define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS 2 - -/** - * struct iwl_proto_offload_cmd - ARP/NS offload configuration - * @enabled: enable flags - * @remote_ipv4_addr: remote address to answer to (or zero if all) - * @host_ipv4_addr: our IPv4 address to respond to queries for - * @arp_mac_addr: our MAC address for ARP responses - * @remote_ipv6_addr: remote address to answer to (or zero if all) - * @solicited_node_ipv6_addr: broken -- solicited node address exists - * for each target address - * @target_ipv6_addr: our target addresses - * @ndp_mac_addr: neighbor soliciation response MAC address - */ -struct iwl_proto_offload_cmd { - __le32 enabled; - __be32 remote_ipv4_addr; - __be32 host_ipv4_addr; - u8 arp_mac_addr[ETH_ALEN]; - __le16 reserved1; - - u8 remote_ipv6_addr[16]; - u8 solicited_node_ipv6_addr[16]; - u8 target_ipv6_addr[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS][16]; - u8 ndp_mac_addr[ETH_ALEN]; - __le16 reserved2; -} __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_1 */ - - -/* - * WOWLAN_PATTERNS - */ -#define IWL_WOWLAN_MIN_PATTERN_LEN 16 -#define IWL_WOWLAN_MAX_PATTERN_LEN 128 - -struct iwl_wowlan_pattern { - u8 mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8]; - u8 pattern[IWL_WOWLAN_MAX_PATTERN_LEN]; - u8 mask_size; - u8 pattern_size; - __le16 reserved; -} __packed; /* WOWLAN_PATTERN_API_S_VER_1 */ - -#define IWL_WOWLAN_MAX_PATTERNS 20 - -struct iwl_wowlan_patterns_cmd { - __le32 n_patterns; - struct iwl_wowlan_pattern patterns[]; -} __packed; /* WOWLAN_PATTERN_ARRAY_API_S_VER_1 */ - -enum iwl_wowlan_wakeup_filters { - IWL_WOWLAN_WAKEUP_MAGIC_PACKET = BIT(0), - IWL_WOWLAN_WAKEUP_PATTERN_MATCH = BIT(1), - IWL_WOWLAN_WAKEUP_BEACON_MISS = BIT(2), - IWL_WOWLAN_WAKEUP_LINK_CHANGE = BIT(3), - IWL_WOWLAN_WAKEUP_GTK_REKEY_FAIL = BIT(4), - IWL_WOWLAN_WAKEUP_EAP_IDENT_REQ = BIT(5), - IWL_WOWLAN_WAKEUP_4WAY_HANDSHAKE = BIT(6), - IWL_WOWLAN_WAKEUP_ENABLE_NET_DETECT = BIT(7), - IWL_WOWLAN_WAKEUP_RF_KILL_DEASSERT = BIT(8), - IWL_WOWLAN_WAKEUP_REMOTE_LINK_LOSS = BIT(9), - IWL_WOWLAN_WAKEUP_REMOTE_SIGNATURE_TABLE = BIT(10), - /* BIT(11) reserved */ - IWL_WOWLAN_WAKEUP_REMOTE_WAKEUP_PACKET = BIT(12), -}; /* WOWLAN_WAKEUP_FILTER_API_E_VER_4 */ - -struct iwl_wowlan_config_cmd { - __le32 wakeup_filter; - __le16 non_qos_seq; - __le16 qos_seq[8]; - u8 wowlan_ba_teardown_tids; - u8 is_11n_connection; -} __packed; /* WOWLAN_CONFIG_API_S_VER_2 */ - -/* - * WOWLAN_TSC_RSC_PARAMS - */ -#define IWL_NUM_RSC 16 - -struct tkip_sc { - __le16 iv16; - __le16 pad; - __le32 iv32; -} __packed; /* TKIP_SC_API_U_VER_1 */ - -struct iwl_tkip_rsc_tsc { - struct tkip_sc unicast_rsc[IWL_NUM_RSC]; - struct tkip_sc multicast_rsc[IWL_NUM_RSC]; - struct tkip_sc tsc; -} __packed; /* TKIP_TSC_RSC_API_S_VER_1 */ - -struct aes_sc { - __le64 pn; -} __packed; /* TKIP_AES_SC_API_U_VER_1 */ - -struct iwl_aes_rsc_tsc { - struct aes_sc unicast_rsc[IWL_NUM_RSC]; - struct aes_sc multicast_rsc[IWL_NUM_RSC]; - struct aes_sc tsc; -} __packed; /* AES_TSC_RSC_API_S_VER_1 */ - -union iwl_all_tsc_rsc { - struct iwl_tkip_rsc_tsc tkip; - struct iwl_aes_rsc_tsc aes; -}; /* ALL_TSC_RSC_API_S_VER_2 */ - -struct iwl_wowlan_rsc_tsc_params_cmd { - union iwl_all_tsc_rsc all_tsc_rsc; -} __packed; /* ALL_TSC_RSC_API_S_VER_2 */ - -#define IWL_MIC_KEY_SIZE 8 -struct iwl_mic_keys { - u8 tx[IWL_MIC_KEY_SIZE]; - u8 rx_unicast[IWL_MIC_KEY_SIZE]; - u8 rx_mcast[IWL_MIC_KEY_SIZE]; -} __packed; /* MIC_KEYS_API_S_VER_1 */ - -#define IWL_P1K_SIZE 5 -struct iwl_p1k_cache { - __le16 p1k[IWL_P1K_SIZE]; -} __packed; - -#define IWL_NUM_RX_P1K_CACHE 2 - -struct iwl_wowlan_tkip_params_cmd { - struct iwl_mic_keys mic_keys; - struct iwl_p1k_cache tx; - struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE]; - struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE]; -} __packed; /* WOWLAN_TKIP_SETTING_API_S_VER_1 */ - -#define IWL_KCK_MAX_SIZE 32 -#define IWL_KEK_MAX_SIZE 32 - -struct iwl_wowlan_kek_kck_material_cmd { - u8 kck[IWL_KCK_MAX_SIZE]; - u8 kek[IWL_KEK_MAX_SIZE]; - __le16 kck_len; - __le16 kek_len; - __le64 replay_ctr; -} __packed; /* KEK_KCK_MATERIAL_API_S_VER_2 */ - -#define RF_KILL_INDICATOR_FOR_WOWLAN 0x87 - -enum iwl_wowlan_rekey_status { - IWL_WOWLAN_REKEY_POST_REKEY = 0, - IWL_WOWLAN_REKEY_WHILE_REKEY = 1, -}; /* WOWLAN_REKEY_STATUS_API_E_VER_1 */ - -enum iwl_wowlan_wakeup_reason { - IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS = 0, - IWL_WOWLAN_WAKEUP_BY_MAGIC_PACKET = BIT(0), - IWL_WOWLAN_WAKEUP_BY_PATTERN = BIT(1), - IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_MISSED_BEACON = BIT(2), - IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_DEAUTH = BIT(3), - IWL_WOWLAN_WAKEUP_BY_GTK_REKEY_FAILURE = BIT(4), - IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED = BIT(5), - IWL_WOWLAN_WAKEUP_BY_UCODE_ERROR = BIT(6), - IWL_WOWLAN_WAKEUP_BY_EAPOL_REQUEST = BIT(7), - IWL_WOWLAN_WAKEUP_BY_FOUR_WAY_HANDSHAKE = BIT(8), - IWL_WOWLAN_WAKEUP_BY_REM_WAKE_LINK_LOSS = BIT(9), - IWL_WOWLAN_WAKEUP_BY_REM_WAKE_SIGNATURE_TABLE = BIT(10), - /* BIT(11) reserved */ - IWL_WOWLAN_WAKEUP_BY_REM_WAKE_WAKEUP_PACKET = BIT(12), -}; /* WOWLAN_WAKE_UP_REASON_API_E_VER_2 */ - -struct iwl_wowlan_status { - __le64 replay_ctr; - __le16 pattern_number; - __le16 non_qos_seq_ctr; - __le16 qos_seq_ctr[8]; - __le32 wakeup_reasons; - __le32 rekey_status; - __le32 num_of_gtk_rekeys; - __le32 transmitted_ndps; - __le32 received_beacons; - __le32 wake_packet_length; - __le32 wake_packet_bufsize; - u8 wake_packet[]; /* can be truncated from _length to _bufsize */ -} __packed; /* WOWLAN_STATUSES_API_S_VER_4 */ - -#define IWL_WOWLAN_TCP_MAX_PACKET_LEN 64 -#define IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN 128 -#define IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS 2048 - -struct iwl_tcp_packet_info { - __le16 tcp_pseudo_header_checksum; - __le16 tcp_payload_length; -} __packed; /* TCP_PACKET_INFO_API_S_VER_2 */ - -struct iwl_tcp_packet { - struct iwl_tcp_packet_info info; - u8 rx_mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8]; - u8 data[IWL_WOWLAN_TCP_MAX_PACKET_LEN]; -} __packed; /* TCP_PROTOCOL_PACKET_API_S_VER_1 */ - -struct iwl_remote_wake_packet { - struct iwl_tcp_packet_info info; - u8 rx_mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8]; - u8 data[IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN]; -} __packed; /* TCP_PROTOCOL_PACKET_API_S_VER_1 */ - -struct iwl_wowlan_remote_wake_config { - __le32 connection_max_time; /* unused */ - /* TCP_PROTOCOL_CONFIG_API_S_VER_1 */ - u8 max_syn_retries; - u8 max_data_retries; - u8 tcp_syn_ack_timeout; - u8 tcp_ack_timeout; - - struct iwl_tcp_packet syn_tx; - struct iwl_tcp_packet synack_rx; - struct iwl_tcp_packet keepalive_ack_rx; - struct iwl_tcp_packet fin_tx; - - struct iwl_remote_wake_packet keepalive_tx; - struct iwl_remote_wake_packet wake_rx; - - /* REMOTE_WAKE_OFFSET_INFO_API_S_VER_1 */ - u8 sequence_number_offset; - u8 sequence_number_length; - u8 token_offset; - u8 token_length; - /* REMOTE_WAKE_PROTOCOL_PARAMS_API_S_VER_1 */ - __le32 initial_sequence_number; - __le16 keepalive_interval; - __le16 num_tokens; - u8 tokens[IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS]; -} __packed; /* REMOTE_WAKE_CONFIG_API_S_VER_2 */ - -/* TODO: NetDetect API */ - -#endif /* __fw_api_d3_h__ */ diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h deleted file mode 100644 index 98b1feb43d38..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-mac.h +++ /dev/null @@ -1,375 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef __fw_api_mac_h__ -#define __fw_api_mac_h__ - -/* - * The first MAC indices (starting from 0) - * are available to the driver, AUX follows - */ -#define MAC_INDEX_AUX 4 -#define MAC_INDEX_MIN_DRIVER 0 -#define NUM_MAC_INDEX_DRIVER MAC_INDEX_AUX - -enum iwl_ac { - AC_BK, - AC_BE, - AC_VI, - AC_VO, - AC_NUM, -}; - -/** - * enum iwl_mac_protection_flags - MAC context flags - * @MAC_PROT_FLG_TGG_PROTECT: 11g protection when transmitting OFDM frames, - * this will require CCK RTS/CTS2self. - * RTS/CTS will protect full burst time. - * @MAC_PROT_FLG_HT_PROT: enable HT protection - * @MAC_PROT_FLG_FAT_PROT: protect 40 MHz transmissions - * @MAC_PROT_FLG_SELF_CTS_EN: allow CTS2self - */ -enum iwl_mac_protection_flags { - MAC_PROT_FLG_TGG_PROTECT = BIT(3), - MAC_PROT_FLG_HT_PROT = BIT(23), - MAC_PROT_FLG_FAT_PROT = BIT(24), - MAC_PROT_FLG_SELF_CTS_EN = BIT(30), -}; - -#define MAC_FLG_SHORT_SLOT BIT(4) -#define MAC_FLG_SHORT_PREAMBLE BIT(5) - -/** - * enum iwl_mac_types - Supported MAC types - * @FW_MAC_TYPE_FIRST: lowest supported MAC type - * @FW_MAC_TYPE_AUX: Auxiliary MAC (internal) - * @FW_MAC_TYPE_LISTENER: monitor MAC type (?) - * @FW_MAC_TYPE_PIBSS: Pseudo-IBSS - * @FW_MAC_TYPE_IBSS: IBSS - * @FW_MAC_TYPE_BSS_STA: BSS (managed) station - * @FW_MAC_TYPE_P2P_DEVICE: P2P Device - * @FW_MAC_TYPE_P2P_STA: P2P client - * @FW_MAC_TYPE_GO: P2P GO - * @FW_MAC_TYPE_TEST: ? - * @FW_MAC_TYPE_MAX: highest support MAC type - */ -enum iwl_mac_types { - FW_MAC_TYPE_FIRST = 1, - FW_MAC_TYPE_AUX = FW_MAC_TYPE_FIRST, - FW_MAC_TYPE_LISTENER, - FW_MAC_TYPE_PIBSS, - FW_MAC_TYPE_IBSS, - FW_MAC_TYPE_BSS_STA, - FW_MAC_TYPE_P2P_DEVICE, - FW_MAC_TYPE_P2P_STA, - FW_MAC_TYPE_GO, - FW_MAC_TYPE_TEST, - FW_MAC_TYPE_MAX = FW_MAC_TYPE_TEST -}; /* MAC_CONTEXT_TYPE_API_E_VER_1 */ - -/** - * enum iwl_tsf_id - TSF hw timer ID - * @TSF_ID_A: use TSF A - * @TSF_ID_B: use TSF B - * @TSF_ID_C: use TSF C - * @TSF_ID_D: use TSF D - * @NUM_TSF_IDS: number of TSF timers available - */ -enum iwl_tsf_id { - TSF_ID_A = 0, - TSF_ID_B = 1, - TSF_ID_C = 2, - TSF_ID_D = 3, - NUM_TSF_IDS = 4, -}; /* TSF_ID_API_E_VER_1 */ - -/** - * struct iwl_mac_data_ap - configuration data for AP MAC context - * @beacon_time: beacon transmit time in system time - * @beacon_tsf: beacon transmit time in TSF - * @bi: beacon interval in TU - * @bi_reciprocal: 2^32 / bi - * @dtim_interval: dtim transmit time in TU - * @dtim_reciprocal: 2^32 / dtim_interval - * @mcast_qid: queue ID for multicast traffic - * @beacon_template: beacon template ID - */ -struct iwl_mac_data_ap { - __le32 beacon_time; - __le64 beacon_tsf; - __le32 bi; - __le32 bi_reciprocal; - __le32 dtim_interval; - __le32 dtim_reciprocal; - __le32 mcast_qid; - __le32 beacon_template; -} __packed; /* AP_MAC_DATA_API_S_VER_1 */ - -/** - * struct iwl_mac_data_ibss - configuration data for IBSS MAC context - * @beacon_time: beacon transmit time in system time - * @beacon_tsf: beacon transmit time in TSF - * @bi: beacon interval in TU - * @bi_reciprocal: 2^32 / bi - */ -struct iwl_mac_data_ibss { - __le32 beacon_time; - __le64 beacon_tsf; - __le32 bi; - __le32 bi_reciprocal; -} __packed; /* IBSS_MAC_DATA_API_S_VER_1 */ - -/** - * struct iwl_mac_data_sta - configuration data for station MAC context - * @is_assoc: 1 for associated state, 0 otherwise - * @dtim_time: DTIM arrival time in system time - * @dtim_tsf: DTIM arrival time in TSF - * @bi: beacon interval in TU, applicable only when associated - * @bi_reciprocal: 2^32 / bi , applicable only when associated - * @dtim_interval: DTIM interval in TU, applicable only when associated - * @dtim_reciprocal: 2^32 / dtim_interval , applicable only when associated - * @listen_interval: in beacon intervals, applicable only when associated - * @assoc_id: unique ID assigned by the AP during association - */ -struct iwl_mac_data_sta { - __le32 is_assoc; - __le32 dtim_time; - __le64 dtim_tsf; - __le32 bi; - __le32 bi_reciprocal; - __le32 dtim_interval; - __le32 dtim_reciprocal; - __le32 listen_interval; - __le32 assoc_id; - __le32 assoc_beacon_arrive_time; -} __packed; /* STA_MAC_DATA_API_S_VER_1 */ - -/** - * struct iwl_mac_data_go - configuration data for P2P GO MAC context - * @ap: iwl_mac_data_ap struct with most config data - * @ctwin: client traffic window in TU (period after TBTT when GO is present). - * 0 indicates that there is no CT window. - * @opp_ps_enabled: indicate that opportunistic PS allowed - */ -struct iwl_mac_data_go { - struct iwl_mac_data_ap ap; - __le32 ctwin; - __le32 opp_ps_enabled; -} __packed; /* GO_MAC_DATA_API_S_VER_1 */ - -/** - * struct iwl_mac_data_p2p_sta - configuration data for P2P client MAC context - * @sta: iwl_mac_data_sta struct with most config data - * @ctwin: client traffic window in TU (period after TBTT when GO is present). - * 0 indicates that there is no CT window. - */ -struct iwl_mac_data_p2p_sta { - struct iwl_mac_data_sta sta; - __le32 ctwin; -} __packed; /* P2P_STA_MAC_DATA_API_S_VER_1 */ - -/** - * struct iwl_mac_data_pibss - Pseudo IBSS config data - * @stats_interval: interval in TU between statistics notifications to host. - */ -struct iwl_mac_data_pibss { - __le32 stats_interval; -} __packed; /* PIBSS_MAC_DATA_API_S_VER_1 */ - -/* - * struct iwl_mac_data_p2p_dev - configuration data for the P2P Device MAC - * context. - * @is_disc_extended: if set to true, P2P Device discoverability is enabled on - * other channels as well. This should be to true only in case that the - * device is discoverable and there is an active GO. Note that setting this - * field when not needed, will increase the number of interrupts and have - * effect on the platform power, as this setting opens the Rx filters on - * all macs. - */ -struct iwl_mac_data_p2p_dev { - __le32 is_disc_extended; -} __packed; /* _P2P_DEV_MAC_DATA_API_S_VER_1 */ - -/** - * enum iwl_mac_filter_flags - MAC context filter flags - * @MAC_FILTER_IN_PROMISC: accept all data frames - * @MAC_FILTER_IN_CONTROL_AND_MGMT: pass all mangement and - * control frames to the host - * @MAC_FILTER_ACCEPT_GRP: accept multicast frames - * @MAC_FILTER_DIS_DECRYPT: don't decrypt unicast frames - * @MAC_FILTER_DIS_GRP_DECRYPT: don't decrypt multicast frames - * @MAC_FILTER_IN_BEACON: transfer foreign BSS's beacons to host - * (in station mode when associated) - * @MAC_FILTER_OUT_BCAST: filter out all broadcast frames - * @MAC_FILTER_IN_CRC32: extract FCS and append it to frames - * @MAC_FILTER_IN_PROBE_REQUEST: pass probe requests to host - */ -enum iwl_mac_filter_flags { - MAC_FILTER_IN_PROMISC = BIT(0), - MAC_FILTER_IN_CONTROL_AND_MGMT = BIT(1), - MAC_FILTER_ACCEPT_GRP = BIT(2), - MAC_FILTER_DIS_DECRYPT = BIT(3), - MAC_FILTER_DIS_GRP_DECRYPT = BIT(4), - MAC_FILTER_IN_BEACON = BIT(6), - MAC_FILTER_OUT_BCAST = BIT(8), - MAC_FILTER_IN_CRC32 = BIT(11), - MAC_FILTER_IN_PROBE_REQUEST = BIT(12), -}; - -/** - * enum iwl_mac_qos_flags - QoS flags - * @MAC_QOS_FLG_UPDATE_EDCA: ? - * @MAC_QOS_FLG_TGN: HT is enabled - * @MAC_QOS_FLG_TXOP_TYPE: ? - * - */ -enum iwl_mac_qos_flags { - MAC_QOS_FLG_UPDATE_EDCA = BIT(0), - MAC_QOS_FLG_TGN = BIT(1), - MAC_QOS_FLG_TXOP_TYPE = BIT(4), -}; - -/** - * struct iwl_ac_qos - QOS timing params for MAC_CONTEXT_CMD - * @cw_min: Contention window, start value in numbers of slots. - * Should be a power-of-2, minus 1. Device's default is 0x0f. - * @cw_max: Contention window, max value in numbers of slots. - * Should be a power-of-2, minus 1. Device's default is 0x3f. - * @aifsn: Number of slots in Arbitration Interframe Space (before - * performing random backoff timing prior to Tx). Device default 1. - * @fifos_mask: FIFOs used by this MAC for this AC - * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0. - * - * One instance of this config struct for each of 4 EDCA access categories - * in struct iwl_qosparam_cmd. - * - * Device will automatically increase contention window by (2*CW) + 1 for each - * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW - * value, to cap the CW value. - */ -struct iwl_ac_qos { - __le16 cw_min; - __le16 cw_max; - u8 aifsn; - u8 fifos_mask; - __le16 edca_txop; -} __packed; /* AC_QOS_API_S_VER_2 */ - -/** - * struct iwl_mac_ctx_cmd - command structure to configure MAC contexts - * ( MAC_CONTEXT_CMD = 0x28 ) - * @id_and_color: ID and color of the MAC - * @action: action to perform, one of FW_CTXT_ACTION_* - * @mac_type: one of FW_MAC_TYPE_* - * @tsd_id: TSF HW timer, one of TSF_ID_* - * @node_addr: MAC address - * @bssid_addr: BSSID - * @cck_rates: basic rates available for CCK - * @ofdm_rates: basic rates available for OFDM - * @protection_flags: combination of MAC_PROT_FLG_FLAG_* - * @cck_short_preamble: 0x20 for enabling short preamble, 0 otherwise - * @short_slot: 0x10 for enabling short slots, 0 otherwise - * @filter_flags: combination of MAC_FILTER_* - * @qos_flags: from MAC_QOS_FLG_* - * @ac: one iwl_mac_qos configuration for each AC - * @mac_specific: one of struct iwl_mac_data_*, according to mac_type - */ -struct iwl_mac_ctx_cmd { - /* COMMON_INDEX_HDR_API_S_VER_1 */ - __le32 id_and_color; - __le32 action; - /* MAC_CONTEXT_COMMON_DATA_API_S_VER_1 */ - __le32 mac_type; - __le32 tsf_id; - u8 node_addr[6]; - __le16 reserved_for_node_addr; - u8 bssid_addr[6]; - __le16 reserved_for_bssid_addr; - __le32 cck_rates; - __le32 ofdm_rates; - __le32 protection_flags; - __le32 cck_short_preamble; - __le32 short_slot; - __le32 filter_flags; - /* MAC_QOS_PARAM_API_S_VER_1 */ - __le32 qos_flags; - struct iwl_ac_qos ac[AC_NUM+1]; - /* MAC_CONTEXT_COMMON_DATA_API_S */ - union { - struct iwl_mac_data_ap ap; - struct iwl_mac_data_go go; - struct iwl_mac_data_sta sta; - struct iwl_mac_data_p2p_sta p2p_sta; - struct iwl_mac_data_p2p_dev p2p_dev; - struct iwl_mac_data_pibss pibss; - struct iwl_mac_data_ibss ibss; - }; -} __packed; /* MAC_CONTEXT_CMD_API_S_VER_1 */ - -static inline u32 iwl_mvm_reciprocal(u32 v) -{ - if (!v) - return 0; - return 0xFFFFFFFF / v; -} - -#endif /* __fw_api_mac_h__ */ diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h deleted file mode 100644 index 81fe45f46be7..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h +++ /dev/null @@ -1,120 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#ifndef __fw_api_power_h__ -#define __fw_api_power_h__ - -/* Power Management Commands, Responses, Notifications */ - -/** - * enum iwl_scan_flags - masks for power table command flags - * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off - * receiver and transmitter. '0' - does not allow. - * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management, - * '1' Driver enables PM (use rest of parameters) - * @POWER_FLAGS_SKIP_OVER_DTIM_MSK: '0' PM have to walk up every DTIM, - * '1' PM could sleep over DTIM till listen Interval. - * @POWER_FLAGS_ADVANCE_PM_ENA_MSK: Advanced PM (uAPSD) enable mask - * @POWER_FLAGS_LPRX_ENA_MSK: Low Power RX enable. -*/ -enum iwl_power_flags { - POWER_FLAGS_POWER_SAVE_ENA_MSK = BIT(0), - POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK = BIT(1), - POWER_FLAGS_SKIP_OVER_DTIM_MSK = BIT(2), - POWER_FLAGS_ADVANCE_PM_ENA_MSK = BIT(9), - POWER_FLAGS_LPRX_ENA_MSK = BIT(11), -}; - -#define IWL_POWER_VEC_SIZE 5 - -/** - * struct iwl_powertable_cmd - Power Table Command - * POWER_TABLE_CMD = 0x77 (command, has simple generic response) - * - * @flags: Power table command flags from POWER_FLAGS_* - * @keep_alive_seconds: Keep alive period in seconds. Default - 25 sec. - * Minimum allowed:- 3 * DTIM. Keep alive period must be - * set regardless of power scheme or current power state. - * FW use this value also when PM is disabled. - * @rx_data_timeout: Minimum time (usec) from last Rx packet for AM to - * PSM transition - legacy PM - * @tx_data_timeout: Minimum time (usec) from last Tx packet for AM to - * PSM transition - legacy PM - * @sleep_interval: not in use - * @keep_alive_beacons: not in use - * @lprx_rssi_threshold: Signal strength up to which LP RX can be enabled. - * Default: 80dbm - */ -struct iwl_powertable_cmd { - /* PM_POWER_TABLE_CMD_API_S_VER_5 */ - __le16 flags; - u8 keep_alive_seconds; - u8 debug_flags; - __le32 rx_data_timeout; - __le32 tx_data_timeout; - __le32 sleep_interval[IWL_POWER_VEC_SIZE]; - __le32 keep_alive_beacons; - __le32 lprx_rssi_threshold; -} __packed; - -#endif diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h deleted file mode 100644 index fdd33bc0a594..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-rs.h +++ /dev/null @@ -1,312 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef __fw_api_rs_h__ -#define __fw_api_rs_h__ - -#include "fw-api-mac.h" - -/* - * These serve as indexes into - * struct iwl_rate_info fw_rate_idx_to_plcp[IWL_RATE_COUNT]; - */ -enum { - IWL_RATE_1M_INDEX = 0, - IWL_FIRST_CCK_RATE = IWL_RATE_1M_INDEX, - IWL_RATE_2M_INDEX, - IWL_RATE_5M_INDEX, - IWL_RATE_11M_INDEX, - IWL_LAST_CCK_RATE = IWL_RATE_11M_INDEX, - IWL_RATE_6M_INDEX, - IWL_FIRST_OFDM_RATE = IWL_RATE_6M_INDEX, - IWL_RATE_9M_INDEX, - IWL_RATE_12M_INDEX, - IWL_RATE_18M_INDEX, - IWL_RATE_24M_INDEX, - IWL_RATE_36M_INDEX, - IWL_RATE_48M_INDEX, - IWL_RATE_54M_INDEX, - IWL_LAST_NON_HT_RATE = IWL_RATE_54M_INDEX, - IWL_RATE_60M_INDEX, - IWL_LAST_OFDM_RATE = IWL_RATE_60M_INDEX, - IWL_RATE_COUNT_LEGACY = IWL_LAST_NON_HT_RATE + 1, - IWL_RATE_COUNT, -}; - -#define IWL_RATE_BIT_MSK(r) BIT(IWL_RATE_##r##M_INDEX) - -/* fw API values for legacy bit rates, both OFDM and CCK */ -enum { - IWL_RATE_6M_PLCP = 13, - IWL_RATE_9M_PLCP = 15, - IWL_RATE_12M_PLCP = 5, - IWL_RATE_18M_PLCP = 7, - IWL_RATE_24M_PLCP = 9, - IWL_RATE_36M_PLCP = 11, - IWL_RATE_48M_PLCP = 1, - IWL_RATE_54M_PLCP = 3, - IWL_RATE_1M_PLCP = 10, - IWL_RATE_2M_PLCP = 20, - IWL_RATE_5M_PLCP = 55, - IWL_RATE_11M_PLCP = 110, -}; - -/* - * rate_n_flags bit fields - * - * The 32-bit value has different layouts in the low 8 bites depending on the - * format. There are three formats, HT, VHT and legacy (11abg, with subformats - * for CCK and OFDM). - * - * High-throughput (HT) rate format - * bit 8 is 1, bit 26 is 0, bit 9 is 0 (OFDM) - * Very High-throughput (VHT) rate format - * bit 8 is 0, bit 26 is 1, bit 9 is 0 (OFDM) - * Legacy OFDM rate format for bits 7:0 - * bit 8 is 0, bit 26 is 0, bit 9 is 0 (OFDM) - * Legacy CCK rate format for bits 7:0: - * bit 8 is 0, bit 26 is 0, bit 9 is 1 (CCK) - */ - -/* Bit 8: (1) HT format, (0) legacy or VHT format */ -#define RATE_MCS_HT_POS 8 -#define RATE_MCS_HT_MSK (1 << RATE_MCS_HT_POS) - -/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */ -#define RATE_MCS_CCK_POS 9 -#define RATE_MCS_CCK_MSK (1 << RATE_MCS_CCK_POS) - -/* Bit 26: (1) VHT format, (0) legacy format in bits 8:0 */ -#define RATE_MCS_VHT_POS 26 -#define RATE_MCS_VHT_MSK (1 << RATE_MCS_VHT_POS) - - -/* - * High-throughput (HT) rate format for bits 7:0 - * - * 2-0: MCS rate base - * 0) 6 Mbps - * 1) 12 Mbps - * 2) 18 Mbps - * 3) 24 Mbps - * 4) 36 Mbps - * 5) 48 Mbps - * 6) 54 Mbps - * 7) 60 Mbps - * 4-3: 0) Single stream (SISO) - * 1) Dual stream (MIMO) - * 2) Triple stream (MIMO) - * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data - * (bits 7-6 are zero) - * - * Together the low 5 bits work out to the MCS index because we don't - * support MCSes above 15/23, and 0-7 have one stream, 8-15 have two - * streams and 16-23 have three streams. We could also support MCS 32 - * which is the duplicate 20 MHz MCS (bit 5 set, all others zero.) - */ -#define RATE_HT_MCS_RATE_CODE_MSK 0x7 - -/* Bit 10: (1) Use Green Field preamble */ -#define RATE_HT_MCS_GF_POS 10 -#define RATE_HT_MCS_GF_MSK (1 << RATE_HT_MCS_GF_POS) - -#define RATE_HT_MCS_INDEX_MSK 0x3f - -/* - * Very High-throughput (VHT) rate format for bits 7:0 - * - * 3-0: VHT MCS (0-9) - * 5-4: number of streams - 1: - * 0) Single stream (SISO) - * 1) Dual stream (MIMO) - * 2) Triple stream (MIMO) - */ - -/* Bit 4-5: (0) SISO, (1) MIMO2 (2) MIMO3 */ -#define RATE_VHT_MCS_RATE_CODE_MSK 0xf -#define RATE_VHT_MCS_NSS_POS 4 -#define RATE_VHT_MCS_NSS_MSK (3 << RATE_VHT_MCS_NSS_POS) - -/* - * Legacy OFDM rate format for bits 7:0 - * - * 3-0: 0xD) 6 Mbps - * 0xF) 9 Mbps - * 0x5) 12 Mbps - * 0x7) 18 Mbps - * 0x9) 24 Mbps - * 0xB) 36 Mbps - * 0x1) 48 Mbps - * 0x3) 54 Mbps - * (bits 7-4 are 0) - * - * Legacy CCK rate format for bits 7:0: - * bit 8 is 0, bit 26 is 0, bit 9 is 1 (CCK): - * - * 6-0: 10) 1 Mbps - * 20) 2 Mbps - * 55) 5.5 Mbps - * 110) 11 Mbps - * (bit 7 is 0) - */ -#define RATE_LEGACY_RATE_MSK 0xff - - -/* - * Bit 11-12: (0) 20MHz, (1) 40MHz, (2) 80MHz, (3) 160MHz - * 0 and 1 are valid for HT and VHT, 2 and 3 only for VHT - */ -#define RATE_MCS_CHAN_WIDTH_POS 11 -#define RATE_MCS_CHAN_WIDTH_MSK (3 << RATE_MCS_CHAN_WIDTH_POS) -#define RATE_MCS_CHAN_WIDTH_20 (0 << RATE_MCS_CHAN_WIDTH_POS) -#define RATE_MCS_CHAN_WIDTH_40 (1 << RATE_MCS_CHAN_WIDTH_POS) -#define RATE_MCS_CHAN_WIDTH_80 (2 << RATE_MCS_CHAN_WIDTH_POS) -#define RATE_MCS_CHAN_WIDTH_160 (3 << RATE_MCS_CHAN_WIDTH_POS) - -/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */ -#define RATE_MCS_SGI_POS 13 -#define RATE_MCS_SGI_MSK (1 << RATE_MCS_SGI_POS) - -/* Bit 14-16: Antenna selection (1) Ant A, (2) Ant B, (4) Ant C */ -#define RATE_MCS_ANT_POS 14 -#define RATE_MCS_ANT_A_MSK (1 << RATE_MCS_ANT_POS) -#define RATE_MCS_ANT_B_MSK (2 << RATE_MCS_ANT_POS) -#define RATE_MCS_ANT_C_MSK (4 << RATE_MCS_ANT_POS) -#define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | \ - RATE_MCS_ANT_B_MSK) -#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | \ - RATE_MCS_ANT_C_MSK) -#define RATE_MCS_ANT_MSK RATE_MCS_ANT_ABC_MSK -#define RATE_MCS_ANT_NUM 3 - -/* Bit 17-18: (0) SS, (1) SS*2 */ -#define RATE_MCS_STBC_POS 17 -#define RATE_MCS_STBC_MSK (1 << RATE_MCS_STBC_POS) - -/* Bit 19: (0) Beamforming is off, (1) Beamforming is on */ -#define RATE_MCS_BF_POS 19 -#define RATE_MCS_BF_MSK (1 << RATE_MCS_BF_POS) - -/* Bit 20: (0) ZLF is off, (1) ZLF is on */ -#define RATE_MCS_ZLF_POS 20 -#define RATE_MCS_ZLF_MSK (1 << RATE_MCS_ZLF_POS) - -/* Bit 24-25: (0) 20MHz (no dup), (1) 2x20MHz, (2) 4x20MHz, 3 8x20MHz */ -#define RATE_MCS_DUP_POS 24 -#define RATE_MCS_DUP_MSK (3 << RATE_MCS_DUP_POS) - -/* Bit 27: (1) LDPC enabled, (0) LDPC disabled */ -#define RATE_MCS_LDPC_POS 27 -#define RATE_MCS_LDPC_MSK (1 << RATE_MCS_LDPC_POS) - - -/* Link Quality definitions */ - -/* # entries in rate scale table to support Tx retries */ -#define LQ_MAX_RETRY_NUM 16 - -/* Link quality command flags, only this one is available */ -#define LQ_FLAG_SET_STA_TLC_RTS_MSK BIT(0) - -/** - * struct iwl_lq_cmd - link quality command - * @sta_id: station to update - * @control: not used - * @flags: combination of LQ_FLAG_* - * @mimo_delim: the first SISO index in rs_table, which separates MIMO - * and SISO rates - * @single_stream_ant_msk: best antenna for SISO (can be dual in CDD). - * Should be ANT_[ABC] - * @dual_stream_ant_msk: best antennas for MIMO, combination of ANT_[ABC] - * @initial_rate_index: first index from rs_table per AC category - * @agg_time_limit: aggregation max time threshold in usec/100, meaning - * value of 100 is one usec. Range is 100 to 8000 - * @agg_disable_start_th: try-count threshold for starting aggregation. - * If a frame has higher try-count, it should not be selected for - * starting an aggregation sequence. - * @agg_frame_cnt_limit: max frame count in an aggregation. - * 0: no limit - * 1: no aggregation (one frame per aggregation) - * 2 - 0x3f: maximal number of frames (up to 3f == 63) - * @rs_table: array of rates for each TX try, each is rate_n_flags, - * meaning it is a combination of RATE_MCS_* and IWL_RATE_*_PLCP - * @bf_params: beam forming params, currently not used - */ -struct iwl_lq_cmd { - u8 sta_id; - u8 reserved1; - u16 control; - /* LINK_QUAL_GENERAL_PARAMS_API_S_VER_1 */ - u8 flags; - u8 mimo_delim; - u8 single_stream_ant_msk; - u8 dual_stream_ant_msk; - u8 initial_rate_index[AC_NUM]; - /* LINK_QUAL_AGG_PARAMS_API_S_VER_1 */ - __le16 agg_time_limit; - u8 agg_disable_start_th; - u8 agg_frame_cnt_limit; - __le32 reserved2; - __le32 rs_table[LQ_MAX_RETRY_NUM]; - __le32 bf_params; -}; /* LINK_QUALITY_CMD_API_S_VER_1 */ -#endif /* __fw_api_rs_h__ */ diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h deleted file mode 100644 index 365095a0c3b3..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h +++ /dev/null @@ -1,560 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#ifndef __fw_api_scan_h__ -#define __fw_api_scan_h__ - -#include "fw-api.h" - -/* Scan Commands, Responses, Notifications */ - -/* Masks for iwl_scan_channel.type flags */ -#define SCAN_CHANNEL_TYPE_ACTIVE BIT(0) -#define SCAN_CHANNEL_NARROW_BAND BIT(22) - -/* Max number of IEs for direct SSID scans in a command */ -#define PROBE_OPTION_MAX 20 - -/** - * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table - * @channel: band is selected by iwl_scan_cmd "flags" field - * @tx_gain: gain for analog radio - * @dsp_atten: gain for DSP - * @active_dwell: dwell time for active scan in TU, typically 5-50 - * @passive_dwell: dwell time for passive scan in TU, typically 20-500 - * @type: type is broken down to these bits: - * bit 0: 0 = passive, 1 = active - * bits 1-20: SSID direct bit map. If any of these bits is set then - * the corresponding SSID IE is transmitted in probe request - * (bit i adds IE in position i to the probe request) - * bit 22: channel width, 0 = regular, 1 = TGj narrow channel - * - * @iteration_count: - * @iteration_interval: - * This struct is used once for each channel in the scan list. - * Each channel can independently select: - * 1) SSID for directed active scans - * 2) Txpower setting (for rate specified within Tx command) - * 3) How long to stay on-channel (behavior may be modified by quiet_time, - * quiet_plcp_th, good_CRC_th) - * - * To avoid uCode errors, make sure the following are true (see comments - * under struct iwl_scan_cmd about max_out_time and quiet_time): - * 1) If using passive_dwell (i.e. passive_dwell != 0): - * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) - * 2) quiet_time <= active_dwell - * 3) If restricting off-channel time (i.e. max_out_time !=0): - * passive_dwell < max_out_time - * active_dwell < max_out_time - */ -struct iwl_scan_channel { - __le32 type; - __le16 channel; - __le16 iteration_count; - __le32 iteration_interval; - __le16 active_dwell; - __le16 passive_dwell; -} __packed; /* SCAN_CHANNEL_CONTROL_API_S_VER_1 */ - -/** - * struct iwl_ssid_ie - directed scan network information element - * - * Up to 20 of these may appear in REPLY_SCAN_CMD, - * selected by "type" bit field in struct iwl_scan_channel; - * each channel may select different ssids from among the 20 entries. - * SSID IEs get transmitted in reverse order of entry. - */ -struct iwl_ssid_ie { - u8 id; - u8 len; - u8 ssid[IEEE80211_MAX_SSID_LEN]; -} __packed; /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */ - -/** - * iwl_scan_flags - masks for scan command flags - *@SCAN_FLAGS_PERIODIC_SCAN: - *@SCAN_FLAGS_P2P_PUBLIC_ACTION_FRAME_TX: - *@SCAN_FLAGS_DELAYED_SCAN_LOWBAND: - *@SCAN_FLAGS_DELAYED_SCAN_HIGHBAND: - *@SCAN_FLAGS_FRAGMENTED_SCAN: - */ -enum iwl_scan_flags { - SCAN_FLAGS_PERIODIC_SCAN = BIT(0), - SCAN_FLAGS_P2P_PUBLIC_ACTION_FRAME_TX = BIT(1), - SCAN_FLAGS_DELAYED_SCAN_LOWBAND = BIT(2), - SCAN_FLAGS_DELAYED_SCAN_HIGHBAND = BIT(3), - SCAN_FLAGS_FRAGMENTED_SCAN = BIT(4), -}; - -/** - * enum iwl_scan_type - Scan types for scan command - * @SCAN_TYPE_FORCED: - * @SCAN_TYPE_BACKGROUND: - * @SCAN_TYPE_OS: - * @SCAN_TYPE_ROAMING: - * @SCAN_TYPE_ACTION: - * @SCAN_TYPE_DISCOVERY: - * @SCAN_TYPE_DISCOVERY_FORCED: - */ -enum iwl_scan_type { - SCAN_TYPE_FORCED = 0, - SCAN_TYPE_BACKGROUND = 1, - SCAN_TYPE_OS = 2, - SCAN_TYPE_ROAMING = 3, - SCAN_TYPE_ACTION = 4, - SCAN_TYPE_DISCOVERY = 5, - SCAN_TYPE_DISCOVERY_FORCED = 6, -}; /* SCAN_ACTIVITY_TYPE_E_VER_1 */ - -/* Maximal number of channels to scan */ -#define MAX_NUM_SCAN_CHANNELS 0x24 - -/** - * struct iwl_scan_cmd - scan request command - * ( SCAN_REQUEST_CMD = 0x80 ) - * @len: command length in bytes - * @scan_flags: scan flags from SCAN_FLAGS_* - * @channel_count: num of channels in channel list (1 - MAX_NUM_SCAN_CHANNELS) - * @quiet_time: in msecs, dwell this time for active scan on quiet channels - * @quiet_plcp_th: quiet PLCP threshold (channel is quiet if less than - * this number of packets were received (typically 1) - * @passive2active: is auto switching from passive to active allowed (0 or 1) - * @rxchain_sel_flags: RXON_RX_CHAIN_* - * @max_out_time: in usecs, max out of serving channel time - * @suspend_time: how long to pause scan when returning to service channel: - * bits 0-19: beacon interal in usecs (suspend before executing) - * bits 20-23: reserved - * bits 24-31: number of beacons (suspend between channels) - * @rxon_flags: RXON_FLG_* - * @filter_flags: RXON_FILTER_* - * @tx_cmd: for active scans (zero for passive), w/o payload, - * no RS so specify TX rate - * @direct_scan: direct scan SSIDs - * @type: one of SCAN_TYPE_* - * @repeats: how many time to repeat the scan - */ -struct iwl_scan_cmd { - __le16 len; - u8 scan_flags; - u8 channel_count; - __le16 quiet_time; - __le16 quiet_plcp_th; - __le16 passive2active; - __le16 rxchain_sel_flags; - __le32 max_out_time; - __le32 suspend_time; - /* RX_ON_FLAGS_API_S_VER_1 */ - __le32 rxon_flags; - __le32 filter_flags; - struct iwl_tx_cmd tx_cmd; - struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; - __le32 type; - __le32 repeats; - - /* - * Probe request frame, followed by channel list. - * - * Size of probe request frame is specified by byte count in tx_cmd. - * Channel list follows immediately after probe request frame. - * Number of channels in list is specified by channel_count. - * Each channel in list is of type: - * - * struct iwl_scan_channel channels[0]; - * - * NOTE: Only one band of channels can be scanned per pass. You - * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait - * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION) - * before requesting another scan. - */ - u8 data[0]; -} __packed; /* SCAN_REQUEST_FIXED_PART_API_S_VER_5 */ - -/* Response to scan request contains only status with one of these values */ -#define SCAN_RESPONSE_OK 0x1 -#define SCAN_RESPONSE_ERROR 0x2 - -/* - * SCAN_ABORT_CMD = 0x81 - * When scan abort is requested, the command has no fields except the common - * header. The response contains only a status with one of these values. - */ -#define SCAN_ABORT_POSSIBLE 0x1 -#define SCAN_ABORT_IGNORED 0x2 /* no pending scans */ - -/* TODO: complete documentation */ -#define SCAN_OWNER_STATUS 0x1 -#define MEASURE_OWNER_STATUS 0x2 - -/** - * struct iwl_scan_start_notif - notifies start of scan in the device - * ( SCAN_START_NOTIFICATION = 0x82 ) - * @tsf_low: TSF timer (lower half) in usecs - * @tsf_high: TSF timer (higher half) in usecs - * @beacon_timer: structured as follows: - * bits 0:19 - beacon interval in usecs - * bits 20:23 - reserved (0) - * bits 24:31 - number of beacons - * @channel: which channel is scanned - * @band: 0 for 5.2 GHz, 1 for 2.4 GHz - * @status: one of *_OWNER_STATUS - */ -struct iwl_scan_start_notif { - __le32 tsf_low; - __le32 tsf_high; - __le32 beacon_timer; - u8 channel; - u8 band; - u8 reserved[2]; - __le32 status; -} __packed; /* SCAN_START_NTF_API_S_VER_1 */ - -/* scan results probe_status first bit indicates success */ -#define SCAN_PROBE_STATUS_OK 0 -#define SCAN_PROBE_STATUS_TX_FAILED BIT(0) -/* error statuses combined with TX_FAILED */ -#define SCAN_PROBE_STATUS_FAIL_TTL BIT(1) -#define SCAN_PROBE_STATUS_FAIL_BT BIT(2) - -/* How many statistics are gathered for each channel */ -#define SCAN_RESULTS_STATISTICS 1 - -/** - * enum iwl_scan_complete_status - status codes for scan complete notifications - * @SCAN_COMP_STATUS_OK: scan completed successfully - * @SCAN_COMP_STATUS_ABORT: scan was aborted by user - * @SCAN_COMP_STATUS_ERR_SLEEP: sending null sleep packet failed - * @SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT: timeout before channel is ready - * @SCAN_COMP_STATUS_ERR_PROBE: sending probe request failed - * @SCAN_COMP_STATUS_ERR_WAKEUP: sending null wakeup packet failed - * @SCAN_COMP_STATUS_ERR_ANTENNAS: invalid antennas chosen at scan command - * @SCAN_COMP_STATUS_ERR_INTERNAL: internal error caused scan abort - * @SCAN_COMP_STATUS_ERR_COEX: medium was lost ot WiMax - * @SCAN_COMP_STATUS_P2P_ACTION_OK: P2P public action frame TX was successful - * (not an error!) - * @SCAN_COMP_STATUS_ITERATION_END: indicates end of one repeatition the driver - * asked for - * @SCAN_COMP_STATUS_ERR_ALLOC_TE: scan could not allocate time events -*/ -enum iwl_scan_complete_status { - SCAN_COMP_STATUS_OK = 0x1, - SCAN_COMP_STATUS_ABORT = 0x2, - SCAN_COMP_STATUS_ERR_SLEEP = 0x3, - SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT = 0x4, - SCAN_COMP_STATUS_ERR_PROBE = 0x5, - SCAN_COMP_STATUS_ERR_WAKEUP = 0x6, - SCAN_COMP_STATUS_ERR_ANTENNAS = 0x7, - SCAN_COMP_STATUS_ERR_INTERNAL = 0x8, - SCAN_COMP_STATUS_ERR_COEX = 0x9, - SCAN_COMP_STATUS_P2P_ACTION_OK = 0xA, - SCAN_COMP_STATUS_ITERATION_END = 0x0B, - SCAN_COMP_STATUS_ERR_ALLOC_TE = 0x0C, -}; - -/** - * struct iwl_scan_results_notif - scan results for one channel - * ( SCAN_RESULTS_NOTIFICATION = 0x83 ) - * @channel: which channel the results are from - * @band: 0 for 5.2 GHz, 1 for 2.4 GHz - * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request - * @num_probe_not_sent: # of request that weren't sent due to not enough time - * @duration: duration spent in channel, in usecs - * @statistics: statistics gathered for this channel - */ -struct iwl_scan_results_notif { - u8 channel; - u8 band; - u8 probe_status; - u8 num_probe_not_sent; - __le32 duration; - __le32 statistics[SCAN_RESULTS_STATISTICS]; -} __packed; /* SCAN_RESULT_NTF_API_S_VER_2 */ - -/** - * struct iwl_scan_complete_notif - notifies end of scanning (all channels) - * ( SCAN_COMPLETE_NOTIFICATION = 0x84 ) - * @scanned_channels: number of channels scanned (and number of valid results) - * @status: one of SCAN_COMP_STATUS_* - * @bt_status: BT on/off status - * @last_channel: last channel that was scanned - * @tsf_low: TSF timer (lower half) in usecs - * @tsf_high: TSF timer (higher half) in usecs - * @results: all scan results, only "scanned_channels" of them are valid - */ -struct iwl_scan_complete_notif { - u8 scanned_channels; - u8 status; - u8 bt_status; - u8 last_channel; - __le32 tsf_low; - __le32 tsf_high; - struct iwl_scan_results_notif results[MAX_NUM_SCAN_CHANNELS]; -} __packed; /* SCAN_COMPLETE_NTF_API_S_VER_2 */ - -/* scan offload */ -#define IWL_MAX_SCAN_CHANNELS 40 -#define IWL_SCAN_MAX_BLACKLIST_LEN 64 -#define IWL_SCAN_MAX_PROFILES 11 -#define SCAN_OFFLOAD_PROBE_REQ_SIZE 512 - -/* Default watchdog (in MS) for scheduled scan iteration */ -#define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000) - -#define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1) -#define CAN_ABORT_STATUS 1 - -#define IWL_FULL_SCAN_MULTIPLIER 5 -#define IWL_FAST_SCHED_SCAN_ITERATIONS 3 - -/** - * struct iwl_scan_offload_cmd - SCAN_REQUEST_FIXED_PART_API_S_VER_6 - * @scan_flags: see enum iwl_scan_flags - * @channel_count: channels in channel list - * @quiet_time: dwell time, in milisiconds, on quiet channel - * @quiet_plcp_th: quiet channel num of packets threshold - * @good_CRC_th: passive to active promotion threshold - * @rx_chain: RXON rx chain. - * @max_out_time: max uSec to be out of assoceated channel - * @suspend_time: pause scan this long when returning to service channel - * @flags: RXON flags - * @filter_flags: RXONfilter - * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz. - * @direct_scan: list of SSIDs for directed active scan - * @scan_type: see enum iwl_scan_type. - * @rep_count: repetition count for each scheduled scan iteration. - */ -struct iwl_scan_offload_cmd { - __le16 len; - u8 scan_flags; - u8 channel_count; - __le16 quiet_time; - __le16 quiet_plcp_th; - __le16 good_CRC_th; - __le16 rx_chain; - __le32 max_out_time; - __le32 suspend_time; - /* RX_ON_FLAGS_API_S_VER_1 */ - __le32 flags; - __le32 filter_flags; - struct iwl_tx_cmd tx_cmd[2]; - /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */ - struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; - __le32 scan_type; - __le32 rep_count; -} __packed; - -enum iwl_scan_offload_channel_flags { - IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE = BIT(0), - IWL_SCAN_OFFLOAD_CHANNEL_NARROW = BIT(22), - IWL_SCAN_OFFLOAD_CHANNEL_FULL = BIT(24), - IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL = BIT(25), -}; - -/** - * iwl_scan_channel_cfg - SCAN_CHANNEL_CFG_S - * @type: bitmap - see enum iwl_scan_offload_channel_flags. - * 0: passive (0) or active (1) scan. - * 1-20: directed scan to i'th ssid. - * 22: channel width configuation - 1 for narrow. - * 24: full scan. - * 25: partial scan. - * @channel_number: channel number 1-13 etc. - * @iter_count: repetition count for the channel. - * @iter_interval: interval between two innteration on one channel. - * @dwell_time: entry 0 - active scan, entry 1 - passive scan. - */ -struct iwl_scan_channel_cfg { - __le32 type[IWL_MAX_SCAN_CHANNELS]; - __le16 channel_number[IWL_MAX_SCAN_CHANNELS]; - __le16 iter_count[IWL_MAX_SCAN_CHANNELS]; - __le32 iter_interval[IWL_MAX_SCAN_CHANNELS]; - u8 dwell_time[IWL_MAX_SCAN_CHANNELS][2]; -} __packed; - -/** - * iwl_scan_offload_cfg - SCAN_OFFLOAD_CONFIG_API_S - * @scan_cmd: scan command fixed part - * @channel_cfg: scan channel configuration - * @data: probe request frames (one per band) - */ -struct iwl_scan_offload_cfg { - struct iwl_scan_offload_cmd scan_cmd; - struct iwl_scan_channel_cfg channel_cfg; - u8 data[0]; -} __packed; - -/** - * iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S - * @ssid: MAC address to filter out - * @reported_rssi: AP rssi reported to the host - */ -struct iwl_scan_offload_blacklist { - u8 ssid[ETH_ALEN]; - u8 reported_rssi; - u8 reserved; -} __packed; - -enum iwl_scan_offload_network_type { - IWL_NETWORK_TYPE_BSS = 1, - IWL_NETWORK_TYPE_IBSS = 2, - IWL_NETWORK_TYPE_ANY = 3, -}; - -enum iwl_scan_offload_band_selection { - IWL_SCAN_OFFLOAD_SELECT_2_4 = 0x4, - IWL_SCAN_OFFLOAD_SELECT_5_2 = 0x8, - IWL_SCAN_OFFLOAD_SELECT_ANY = 0xc, -}; - -/** - * iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S - * @ssid_index: index to ssid list in fixed part - * @unicast_cipher: encryption olgorithm to match - bitmap - * @aut_alg: authentication olgorithm to match - bitmap - * @network_type: enum iwl_scan_offload_network_type - * @band_selection: enum iwl_scan_offload_band_selection - */ -struct iwl_scan_offload_profile { - u8 ssid_index; - u8 unicast_cipher; - u8 auth_alg; - u8 network_type; - u8 band_selection; - u8 reserved[3]; -} __packed; - -/** - * iwl_scan_offload_profile_cfg - SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1 - * @blaclist: AP list to filter off from scan results - * @profiles: profiles to search for match - * @blacklist_len: length of blacklist - * @num_profiles: num of profiles in the list - */ -struct iwl_scan_offload_profile_cfg { - struct iwl_scan_offload_blacklist blacklist[IWL_SCAN_MAX_BLACKLIST_LEN]; - struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES]; - u8 blacklist_len; - u8 num_profiles; - u8 reserved[2]; -} __packed; - -/** - * iwl_scan_offload_schedule - schedule of scan offload - * @delay: delay between iterations, in seconds. - * @iterations: num of scan iterations - * @full_scan_mul: number of partial scans before each full scan - */ -struct iwl_scan_offload_schedule { - u16 delay; - u8 iterations; - u8 full_scan_mul; -} __packed; - -/* - * iwl_scan_offload_flags - * - * IWL_SCAN_OFFLOAD_FLAG_FILTER_SSID: filter mode - upload every beacon or match - * ssid list. - * IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL: add cached channels to partial scan. - * IWL_SCAN_OFFLOAD_FLAG_ENERGY_SCAN: use energy based scan before partial scan - * on A band. - */ -enum iwl_scan_offload_flags { - IWL_SCAN_OFFLOAD_FLAG_FILTER_SSID = BIT(0), - IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL = BIT(2), - IWL_SCAN_OFFLOAD_FLAG_ENERGY_SCAN = BIT(3), -}; - -/** - * iwl_scan_offload_req - scan offload request command - * @flags: bitmap - enum iwl_scan_offload_flags. - * @watchdog: maximum scan duration in TU. - * @delay: delay in seconds before first iteration. - * @schedule_line: scan offload schedule, for fast and regular scan. - */ -struct iwl_scan_offload_req { - __le16 flags; - __le16 watchdog; - __le16 delay; - __le16 reserved; - struct iwl_scan_offload_schedule schedule_line[2]; -} __packed; - -enum iwl_scan_offload_compleate_status { - IWL_SCAN_OFFLOAD_COMPLETED = 1, - IWL_SCAN_OFFLOAD_ABORTED = 2, -}; - -/** - * iwl_scan_offload_complete - SCAN_OFFLOAD_COMPLETE_NTF_API_S_VER_1 - * @last_schedule_line: last schedule line executed (fast or regular) - * @last_schedule_iteration: last scan iteration executed before scan abort - * @status: enum iwl_scan_offload_compleate_status - */ -struct iwl_scan_offload_complete { - u8 last_schedule_line; - u8 last_schedule_iteration; - u8 status; - u8 reserved; -} __packed; - -#endif diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-sta.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-sta.h deleted file mode 100644 index a30691a8a85b..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-sta.h +++ /dev/null @@ -1,380 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef __fw_api_sta_h__ -#define __fw_api_sta_h__ - -/** - * enum iwl_sta_flags - flags for the ADD_STA host command - * @STA_FLG_REDUCED_TX_PWR_CTRL: - * @STA_FLG_REDUCED_TX_PWR_DATA: - * @STA_FLG_FLG_ANT_MSK: Antenna selection - * @STA_FLG_PS: set if STA is in Power Save - * @STA_FLG_INVALID: set if STA is invalid - * @STA_FLG_DLP_EN: Direct Link Protocol is enabled - * @STA_FLG_SET_ALL_KEYS: the current key applies to all key IDs - * @STA_FLG_DRAIN_FLOW: drain flow - * @STA_FLG_PAN: STA is for PAN interface - * @STA_FLG_CLASS_AUTH: - * @STA_FLG_CLASS_ASSOC: - * @STA_FLG_CLASS_MIMO_PROT: - * @STA_FLG_MAX_AGG_SIZE_MSK: maximal size for A-MPDU - * @STA_FLG_AGG_MPDU_DENS_MSK: maximal MPDU density for Tx aggregation - * @STA_FLG_FAT_EN_MSK: support for channel width (for Tx). This flag is - * initialised by driver and can be updated by fw upon reception of - * action frames that can change the channel width. When cleared the fw - * will send all the frames in 20MHz even when FAT channel is requested. - * @STA_FLG_MIMO_EN_MSK: support for MIMO. This flag is initialised by the - * driver and can be updated by fw upon reception of action frames. - * @STA_FLG_MFP_EN: Management Frame Protection - */ -enum iwl_sta_flags { - STA_FLG_REDUCED_TX_PWR_CTRL = BIT(3), - STA_FLG_REDUCED_TX_PWR_DATA = BIT(6), - - STA_FLG_FLG_ANT_A = (1 << 4), - STA_FLG_FLG_ANT_B = (2 << 4), - STA_FLG_FLG_ANT_MSK = (STA_FLG_FLG_ANT_A | - STA_FLG_FLG_ANT_B), - - STA_FLG_PS = BIT(8), - STA_FLG_INVALID = BIT(9), - STA_FLG_DLP_EN = BIT(10), - STA_FLG_SET_ALL_KEYS = BIT(11), - STA_FLG_DRAIN_FLOW = BIT(12), - STA_FLG_PAN = BIT(13), - STA_FLG_CLASS_AUTH = BIT(14), - STA_FLG_CLASS_ASSOC = BIT(15), - STA_FLG_RTS_MIMO_PROT = BIT(17), - - STA_FLG_MAX_AGG_SIZE_SHIFT = 19, - STA_FLG_MAX_AGG_SIZE_8K = (0 << STA_FLG_MAX_AGG_SIZE_SHIFT), - STA_FLG_MAX_AGG_SIZE_16K = (1 << STA_FLG_MAX_AGG_SIZE_SHIFT), - STA_FLG_MAX_AGG_SIZE_32K = (2 << STA_FLG_MAX_AGG_SIZE_SHIFT), - STA_FLG_MAX_AGG_SIZE_64K = (3 << STA_FLG_MAX_AGG_SIZE_SHIFT), - STA_FLG_MAX_AGG_SIZE_128K = (4 << STA_FLG_MAX_AGG_SIZE_SHIFT), - STA_FLG_MAX_AGG_SIZE_256K = (5 << STA_FLG_MAX_AGG_SIZE_SHIFT), - STA_FLG_MAX_AGG_SIZE_512K = (6 << STA_FLG_MAX_AGG_SIZE_SHIFT), - STA_FLG_MAX_AGG_SIZE_1024K = (7 << STA_FLG_MAX_AGG_SIZE_SHIFT), - STA_FLG_MAX_AGG_SIZE_MSK = (7 << STA_FLG_MAX_AGG_SIZE_SHIFT), - - STA_FLG_AGG_MPDU_DENS_SHIFT = 23, - STA_FLG_AGG_MPDU_DENS_2US = (4 << STA_FLG_AGG_MPDU_DENS_SHIFT), - STA_FLG_AGG_MPDU_DENS_4US = (5 << STA_FLG_AGG_MPDU_DENS_SHIFT), - STA_FLG_AGG_MPDU_DENS_8US = (6 << STA_FLG_AGG_MPDU_DENS_SHIFT), - STA_FLG_AGG_MPDU_DENS_16US = (7 << STA_FLG_AGG_MPDU_DENS_SHIFT), - STA_FLG_AGG_MPDU_DENS_MSK = (7 << STA_FLG_AGG_MPDU_DENS_SHIFT), - - STA_FLG_FAT_EN_20MHZ = (0 << 26), - STA_FLG_FAT_EN_40MHZ = (1 << 26), - STA_FLG_FAT_EN_80MHZ = (2 << 26), - STA_FLG_FAT_EN_160MHZ = (3 << 26), - STA_FLG_FAT_EN_MSK = (3 << 26), - - STA_FLG_MIMO_EN_SISO = (0 << 28), - STA_FLG_MIMO_EN_MIMO2 = (1 << 28), - STA_FLG_MIMO_EN_MIMO3 = (2 << 28), - STA_FLG_MIMO_EN_MSK = (3 << 28), -}; - -/** - * enum iwl_sta_key_flag - key flags for the ADD_STA host command - * @STA_KEY_FLG_EN_MSK: mask for encryption algorithm - * @STA_KEY_FLG_WEP_KEY_MAP: wep is either a group key (0 - legacy WEP) or from - * station info array (1 - n 1X mode) - * @STA_KEY_FLG_KEYID_MSK: the index of the key - * @STA_KEY_NOT_VALID: key is invalid - * @STA_KEY_FLG_WEP_13BYTES: set for 13 bytes WEP key - * @STA_KEY_MULTICAST: set for multical key - * @STA_KEY_MFP: key is used for Management Frame Protection - */ -enum iwl_sta_key_flag { - STA_KEY_FLG_NO_ENC = (0 << 0), - STA_KEY_FLG_WEP = (1 << 0), - STA_KEY_FLG_CCM = (2 << 0), - STA_KEY_FLG_TKIP = (3 << 0), - STA_KEY_FLG_CMAC = (6 << 0), - STA_KEY_FLG_ENC_UNKNOWN = (7 << 0), - STA_KEY_FLG_EN_MSK = (7 << 0), - - STA_KEY_FLG_WEP_KEY_MAP = BIT(3), - STA_KEY_FLG_KEYID_POS = 8, - STA_KEY_FLG_KEYID_MSK = (3 << STA_KEY_FLG_KEYID_POS), - STA_KEY_NOT_VALID = BIT(11), - STA_KEY_FLG_WEP_13BYTES = BIT(12), - STA_KEY_MULTICAST = BIT(14), - STA_KEY_MFP = BIT(15), -}; - -/** - * enum iwl_sta_modify_flag - indicate to the fw what flag are being changed - * @STA_MODIFY_KEY: this command modifies %key - * @STA_MODIFY_TID_DISABLE_TX: this command modifies %tid_disable_tx - * @STA_MODIFY_TX_RATE: unused - * @STA_MODIFY_ADD_BA_TID: this command modifies %add_immediate_ba_tid - * @STA_MODIFY_REMOVE_BA_TID: this command modifies %remove_immediate_ba_tid - * @STA_MODIFY_SLEEPING_STA_TX_COUNT: this command modifies %sleep_tx_count - * @STA_MODIFY_PROT_TH: - * @STA_MODIFY_QUEUES: modify the queues used by this station - */ -enum iwl_sta_modify_flag { - STA_MODIFY_KEY = BIT(0), - STA_MODIFY_TID_DISABLE_TX = BIT(1), - STA_MODIFY_TX_RATE = BIT(2), - STA_MODIFY_ADD_BA_TID = BIT(3), - STA_MODIFY_REMOVE_BA_TID = BIT(4), - STA_MODIFY_SLEEPING_STA_TX_COUNT = BIT(5), - STA_MODIFY_PROT_TH = BIT(6), - STA_MODIFY_QUEUES = BIT(7), -}; - -#define STA_MODE_MODIFY 1 - -/** - * enum iwl_sta_sleep_flag - type of sleep of the station - * @STA_SLEEP_STATE_AWAKE: - * @STA_SLEEP_STATE_PS_POLL: - * @STA_SLEEP_STATE_UAPSD: - */ -enum iwl_sta_sleep_flag { - STA_SLEEP_STATE_AWAKE = 0, - STA_SLEEP_STATE_PS_POLL = BIT(0), - STA_SLEEP_STATE_UAPSD = BIT(1), -}; - -/* STA ID and color bits definitions */ -#define STA_ID_SEED (0x0f) -#define STA_ID_POS (0) -#define STA_ID_MSK (STA_ID_SEED << STA_ID_POS) - -#define STA_COLOR_SEED (0x7) -#define STA_COLOR_POS (4) -#define STA_COLOR_MSK (STA_COLOR_SEED << STA_COLOR_POS) - -#define STA_ID_N_COLOR_GET_COLOR(id_n_color) \ - (((id_n_color) & STA_COLOR_MSK) >> STA_COLOR_POS) -#define STA_ID_N_COLOR_GET_ID(id_n_color) \ - (((id_n_color) & STA_ID_MSK) >> STA_ID_POS) - -#define STA_KEY_MAX_NUM (16) -#define STA_KEY_IDX_INVALID (0xff) -#define STA_KEY_MAX_DATA_KEY_NUM (4) -#define IWL_MAX_GLOBAL_KEYS (4) -#define STA_KEY_LEN_WEP40 (5) -#define STA_KEY_LEN_WEP104 (13) - -/** - * struct iwl_mvm_keyinfo - key information - * @key_flags: type %iwl_sta_key_flag - * @tkip_rx_tsc_byte2: TSC[2] for key mix ph1 detection - * @tkip_rx_ttak: 10-byte unicast TKIP TTAK for Rx - * @key_offset: key offset in the fw's key table - * @key: 16-byte unicast decryption key - * @tx_secur_seq_cnt: initial RSC / PN needed for replay check - * @hw_tkip_mic_rx_key: byte: MIC Rx Key - used for TKIP only - * @hw_tkip_mic_tx_key: byte: MIC Tx Key - used for TKIP only - */ -struct iwl_mvm_keyinfo { - __le16 key_flags; - u8 tkip_rx_tsc_byte2; - u8 reserved1; - __le16 tkip_rx_ttak[5]; - u8 key_offset; - u8 reserved2; - u8 key[16]; - __le64 tx_secur_seq_cnt; - __le64 hw_tkip_mic_rx_key; - __le64 hw_tkip_mic_tx_key; -} __packed; - -/** - * struct iwl_mvm_add_sta_cmd - Add / modify a station in the fw's station table - * ( REPLY_ADD_STA = 0x18 ) - * @add_modify: 1: modify existing, 0: add new station - * @unicast_tx_key_id: unicast tx key id. Relevant only when unicast key sent - * @multicast_tx_key_id: multicast tx key id. Relevant only when multicast key - * sent - * @mac_id_n_color: the Mac context this station belongs to - * @addr[ETH_ALEN]: station's MAC address - * @sta_id: index of station in uCode's station table - * @modify_mask: STA_MODIFY_*, selects which parameters to modify vs. leave - * alone. 1 - modify, 0 - don't change. - * @key: look at %iwl_mvm_keyinfo - * @station_flags: look at %iwl_sta_flags - * @station_flags_msk: what of %station_flags have changed - * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable - * AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field. - * @add_immediate_ba_tid: tid for which to add block-ack support (Rx) - * Set %STA_MODIFY_ADD_BA_TID to use this field, and also set - * add_immediate_ba_ssn. - * @remove_immediate_ba_tid: tid for which to remove block-ack support (Rx) - * Set %STA_MODIFY_REMOVE_BA_TID to use this field - * @add_immediate_ba_ssn: ssn for the Rx block-ack session. Used together with - * add_immediate_ba_tid. - * @sleep_tx_count: number of packets to transmit to station even though it is - * asleep. Used to synchronise PS-poll and u-APSD responses while ucode - * keeps track of STA sleep state. - * @sleep_state_flags: Look at %iwl_sta_sleep_flag. - * @assoc_id: assoc_id to be sent in VHT PLCP (9-bit), for grp use 0, for AP - * mac-addr. - * @beamform_flags: beam forming controls - * @tfd_queue_msk: tfd queues used by this station - * - * The device contains an internal table of per-station information, with info - * on security keys, aggregation parameters, and Tx rates for initial Tx - * attempt and any retries (set by REPLY_TX_LINK_QUALITY_CMD). - * - * ADD_STA sets up the table entry for one station, either creating a new - * entry, or modifying a pre-existing one. - */ -struct iwl_mvm_add_sta_cmd { - u8 add_modify; - u8 unicast_tx_key_id; - u8 multicast_tx_key_id; - u8 reserved1; - __le32 mac_id_n_color; - u8 addr[ETH_ALEN]; - __le16 reserved2; - u8 sta_id; - u8 modify_mask; - __le16 reserved3; - struct iwl_mvm_keyinfo key; - __le32 station_flags; - __le32 station_flags_msk; - __le16 tid_disable_tx; - __le16 reserved4; - u8 add_immediate_ba_tid; - u8 remove_immediate_ba_tid; - __le16 add_immediate_ba_ssn; - __le16 sleep_tx_count; - __le16 sleep_state_flags; - __le16 assoc_id; - __le16 beamform_flags; - __le32 tfd_queue_msk; -} __packed; /* ADD_STA_CMD_API_S_VER_5 */ - -/** - * enum iwl_mvm_add_sta_rsp_status - status in the response to ADD_STA command - * @ADD_STA_SUCCESS: operation was executed successfully - * @ADD_STA_STATIONS_OVERLOAD: no room left in the fw's station table - * @ADD_STA_IMMEDIATE_BA_FAILURE: can't add Rx block ack session - * @ADD_STA_MODIFY_NON_EXISTING_STA: driver requested to modify a station that - * doesn't exist. - */ -enum iwl_mvm_add_sta_rsp_status { - ADD_STA_SUCCESS = 0x1, - ADD_STA_STATIONS_OVERLOAD = 0x2, - ADD_STA_IMMEDIATE_BA_FAILURE = 0x4, - ADD_STA_MODIFY_NON_EXISTING_STA = 0x8, -}; - -/** - * struct iwl_mvm_rm_sta_cmd - Add / modify a station in the fw's station table - * ( REMOVE_STA = 0x19 ) - * @sta_id: the station id of the station to be removed - */ -struct iwl_mvm_rm_sta_cmd { - u8 sta_id; - u8 reserved[3]; -} __packed; /* REMOVE_STA_CMD_API_S_VER_2 */ - -/** - * struct iwl_mvm_mgmt_mcast_key_cmd - * ( MGMT_MCAST_KEY = 0x1f ) - * @ctrl_flags: %iwl_sta_key_flag - * @IGTK: - * @K1: IGTK master key - * @K2: IGTK sub key - * @sta_id: station ID that support IGTK - * @key_id: - * @receive_seq_cnt: initial RSC/PN needed for replay check - */ -struct iwl_mvm_mgmt_mcast_key_cmd { - __le32 ctrl_flags; - u8 IGTK[16]; - u8 K1[16]; - u8 K2[16]; - __le32 key_id; - __le32 sta_id; - __le64 receive_seq_cnt; -} __packed; /* SEC_MGMT_MULTICAST_KEY_CMD_API_S_VER_1 */ - -struct iwl_mvm_wep_key { - u8 key_index; - u8 key_offset; - __le16 reserved1; - u8 key_size; - u8 reserved2[3]; - u8 key[16]; -} __packed; - -struct iwl_mvm_wep_key_cmd { - __le32 mac_id_n_color; - u8 num_keys; - u8 decryption_type; - u8 flags; - u8 reserved; - struct iwl_mvm_wep_key wep_key[0]; -} __packed; /* SEC_CURR_WEP_KEY_CMD_API_S_VER_2 */ - - -#endif /* __fw_api_sta_h__ */ diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h deleted file mode 100644 index 007a93b25bd7..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-tx.h +++ /dev/null @@ -1,586 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -#ifndef __fw_api_tx_h__ -#define __fw_api_tx_h__ - -/** - * enum iwl_tx_flags - bitmasks for tx_flags in TX command - * @TX_CMD_FLG_PROT_REQUIRE: use RTS or CTS-to-self to protect the frame - * @TX_CMD_FLG_ACK: expect ACK from receiving station - * @TX_CMD_FLG_STA_RATE: use RS table with initial index from the TX command. - * Otherwise, use rate_n_flags from the TX command - * @TX_CMD_FLG_BA: this frame is a block ack - * @TX_CMD_FLG_BAR: this frame is a BA request, immediate BAR is expected - * Must set TX_CMD_FLG_ACK with this flag. - * @TX_CMD_FLG_TXOP_PROT: protect frame with full TXOP protection - * @TX_CMD_FLG_VHT_NDPA: mark frame is NDPA for VHT beamformer sequence - * @TX_CMD_FLG_HT_NDPA: mark frame is NDPA for HT beamformer sequence - * @TX_CMD_FLG_CSI_FDBK2HOST: mark to send feedback to host (only if good CRC) - * @TX_CMD_FLG_BT_DIS: disable BT priority for this frame - * @TX_CMD_FLG_SEQ_CTL: set if FW should override the sequence control. - * Should be set for mgmt, non-QOS data, mcast, bcast and in scan command - * @TX_CMD_FLG_MORE_FRAG: this frame is non-last MPDU - * @TX_CMD_FLG_NEXT_FRAME: this frame includes information of the next frame - * @TX_CMD_FLG_TSF: FW should calculate and insert TSF in the frame - * Should be set for beacons and probe responses - * @TX_CMD_FLG_CALIB: activate PA TX power calibrations - * @TX_CMD_FLG_KEEP_SEQ_CTL: if seq_ctl is set, don't increase inner seq count - * @TX_CMD_FLG_AGG_START: allow this frame to start aggregation - * @TX_CMD_FLG_MH_PAD: driver inserted 2 byte padding after MAC header. - * Should be set for 26/30 length MAC headers - * @TX_CMD_FLG_RESP_TO_DRV: zero this if the response should go only to FW - * @TX_CMD_FLG_CCMP_AGG: this frame uses CCMP for aggregation acceleration - * @TX_CMD_FLG_TKIP_MIC_DONE: FW already performed TKIP MIC calculation - * @TX_CMD_FLG_CTS_ONLY: send CTS only, no data after that - * @TX_CMD_FLG_DUR: disable duration overwriting used in PS-Poll Assoc-id - * @TX_CMD_FLG_FW_DROP: FW should mark frame to be dropped - * @TX_CMD_FLG_EXEC_PAPD: execute PAPD - * @TX_CMD_FLG_PAPD_TYPE: 0 for reference power, 1 for nominal power - * @TX_CMD_FLG_HCCA_CHUNK: mark start of TSPEC chunk - */ -enum iwl_tx_flags { - TX_CMD_FLG_PROT_REQUIRE = BIT(0), - TX_CMD_FLG_ACK = BIT(3), - TX_CMD_FLG_STA_RATE = BIT(4), - TX_CMD_FLG_BA = BIT(5), - TX_CMD_FLG_BAR = BIT(6), - TX_CMD_FLG_TXOP_PROT = BIT(7), - TX_CMD_FLG_VHT_NDPA = BIT(8), - TX_CMD_FLG_HT_NDPA = BIT(9), - TX_CMD_FLG_CSI_FDBK2HOST = BIT(10), - TX_CMD_FLG_BT_DIS = BIT(12), - TX_CMD_FLG_SEQ_CTL = BIT(13), - TX_CMD_FLG_MORE_FRAG = BIT(14), - TX_CMD_FLG_NEXT_FRAME = BIT(15), - TX_CMD_FLG_TSF = BIT(16), - TX_CMD_FLG_CALIB = BIT(17), - TX_CMD_FLG_KEEP_SEQ_CTL = BIT(18), - TX_CMD_FLG_AGG_START = BIT(19), - TX_CMD_FLG_MH_PAD = BIT(20), - TX_CMD_FLG_RESP_TO_DRV = BIT(21), - TX_CMD_FLG_CCMP_AGG = BIT(22), - TX_CMD_FLG_TKIP_MIC_DONE = BIT(23), - TX_CMD_FLG_CTS_ONLY = BIT(24), - TX_CMD_FLG_DUR = BIT(25), - TX_CMD_FLG_FW_DROP = BIT(26), - TX_CMD_FLG_EXEC_PAPD = BIT(27), - TX_CMD_FLG_PAPD_TYPE = BIT(28), - TX_CMD_FLG_HCCA_CHUNK = BIT(31) -}; /* TX_FLAGS_BITS_API_S_VER_1 */ - -/* - * TX command security control - */ -#define TX_CMD_SEC_WEP 0x01 -#define TX_CMD_SEC_CCM 0x02 -#define TX_CMD_SEC_TKIP 0x03 -#define TX_CMD_SEC_WEP_KEY_IDX_POS 6 -#define TX_CMD_SEC_WEP_KEY_IDX_MSK 0xc0 -#define TX_CMD_SEC_KEY128 0x08 - -/* TODO: how does these values are OK with only 16 bit variable??? */ -/* - * TX command next frame info - * - * bits 0:2 - security control (TX_CMD_SEC_*) - * bit 3 - immediate ACK required - * bit 4 - rate is taken from STA table - * bit 5 - frame belongs to BA stream - * bit 6 - immediate BA response expected - * bit 7 - unused - * bits 8:15 - Station ID - * bits 16:31 - rate - */ -#define TX_CMD_NEXT_FRAME_ACK_MSK (0x8) -#define TX_CMD_NEXT_FRAME_STA_RATE_MSK (0x10) -#define TX_CMD_NEXT_FRAME_BA_MSK (0x20) -#define TX_CMD_NEXT_FRAME_IMM_BA_RSP_MSK (0x40) -#define TX_CMD_NEXT_FRAME_FLAGS_MSK (0xf8) -#define TX_CMD_NEXT_FRAME_STA_ID_MSK (0xff00) -#define TX_CMD_NEXT_FRAME_STA_ID_POS (8) -#define TX_CMD_NEXT_FRAME_RATE_MSK (0xffff0000) -#define TX_CMD_NEXT_FRAME_RATE_POS (16) - -/* - * TX command Frame life time in us - to be written in pm_frame_timeout - */ -#define TX_CMD_LIFE_TIME_INFINITE 0xFFFFFFFF -#define TX_CMD_LIFE_TIME_DEFAULT 2000000 /* 2000 ms*/ -#define TX_CMD_LIFE_TIME_PROBE_RESP 40000 /* 40 ms */ -#define TX_CMD_LIFE_TIME_EXPIRED_FRAME 0 - -/* - * TID for non QoS frames - to be written in tid_tspec - */ -#define IWL_TID_NON_QOS IWL_MAX_TID_COUNT - -/* - * Limits on the retransmissions - to be written in {data,rts}_retry_limit - */ -#define IWL_DEFAULT_TX_RETRY 15 -#define IWL_MGMT_DFAULT_RETRY_LIMIT 3 -#define IWL_RTS_DFAULT_RETRY_LIMIT 60 -#define IWL_BAR_DFAULT_RETRY_LIMIT 60 -#define IWL_LOW_RETRY_LIMIT 7 - -/* TODO: complete documentation for try_cnt and btkill_cnt */ -/** - * struct iwl_tx_cmd - TX command struct to FW - * ( TX_CMD = 0x1c ) - * @len: in bytes of the payload, see below for details - * @next_frame_len: same as len, but for next frame (0 if not applicable) - * Used for fragmentation and bursting, but not in 11n aggregation. - * @tx_flags: combination of TX_CMD_FLG_* - * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is - * cleared. Combination of RATE_MCS_* - * @sta_id: index of destination station in FW station table - * @sec_ctl: security control, TX_CMD_SEC_* - * @initial_rate_index: index into the the rate table for initial TX attempt. - * Applied if TX_CMD_FLG_STA_RATE_MSK is set, normally 0 for data frames. - * @key: security key - * @next_frame_flags: TX_CMD_SEC_* and TX_CMD_NEXT_FRAME_* - * @life_time: frame life time (usecs??) - * @dram_lsb_ptr: Physical address of scratch area in the command (try_cnt + - * btkill_cnd + reserved), first 32 bits. "0" disables usage. - * @dram_msb_ptr: upper bits of the scratch physical address - * @rts_retry_limit: max attempts for RTS - * @data_retry_limit: max attempts to send the data packet - * @tid_spec: TID/tspec - * @pm_frame_timeout: PM TX frame timeout - * @driver_txop: duration od EDCA TXOP, in 32-usec units. Set this if not - * specified by HCCA protocol - * - * The byte count (both len and next_frame_len) includes MAC header - * (24/26/30/32 bytes) - * + 2 bytes pad if 26/30 header size - * + 8 byte IV for CCM or TKIP (not used for WEP) - * + Data payload - * + 8-byte MIC (not used for CCM/WEP) - * It does not include post-MAC padding, i.e., - * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes. - * Range of len: 14-2342 bytes. - * - * After the struct fields the MAC header is placed, plus any padding, - * and then the actial payload. - */ -struct iwl_tx_cmd { - __le16 len; - __le16 next_frame_len; - __le32 tx_flags; - /* DRAM_SCRATCH_API_U_VER_1 */ - u8 try_cnt; - u8 btkill_cnt; - __le16 reserved; - __le32 rate_n_flags; - u8 sta_id; - u8 sec_ctl; - u8 initial_rate_index; - u8 reserved2; - u8 key[16]; - __le16 next_frame_flags; - __le16 reserved3; - __le32 life_time; - __le32 dram_lsb_ptr; - u8 dram_msb_ptr; - u8 rts_retry_limit; - u8 data_retry_limit; - u8 tid_tspec; - __le16 pm_frame_timeout; - __le16 driver_txop; - u8 payload[0]; - struct ieee80211_hdr hdr[0]; -} __packed; /* TX_CMD_API_S_VER_3 */ - -/* - * TX response related data - */ - -/* - * enum iwl_tx_status - status that is returned by the fw after attempts to Tx - * @TX_STATUS_SUCCESS: - * @TX_STATUS_DIRECT_DONE: - * @TX_STATUS_POSTPONE_DELAY: - * @TX_STATUS_POSTPONE_FEW_BYTES: - * @TX_STATUS_POSTPONE_BT_PRIO: - * @TX_STATUS_POSTPONE_QUIET_PERIOD: - * @TX_STATUS_POSTPONE_CALC_TTAK: - * @TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY: - * @TX_STATUS_FAIL_SHORT_LIMIT: - * @TX_STATUS_FAIL_LONG_LIMIT: - * @TX_STATUS_FAIL_UNDERRUN: - * @TX_STATUS_FAIL_DRAIN_FLOW: - * @TX_STATUS_FAIL_RFKILL_FLUSH: - * @TX_STATUS_FAIL_LIFE_EXPIRE: - * @TX_STATUS_FAIL_DEST_PS: - * @TX_STATUS_FAIL_HOST_ABORTED: - * @TX_STATUS_FAIL_BT_RETRY: - * @TX_STATUS_FAIL_STA_INVALID: - * @TX_TATUS_FAIL_FRAG_DROPPED: - * @TX_STATUS_FAIL_TID_DISABLE: - * @TX_STATUS_FAIL_FIFO_FLUSHED: - * @TX_STATUS_FAIL_SMALL_CF_POLL: - * @TX_STATUS_FAIL_FW_DROP: - * @TX_STATUS_FAIL_STA_COLOR_MISMATCH: mismatch between color of Tx cmd and - * STA table - * @TX_FRAME_STATUS_INTERNAL_ABORT: - * @TX_MODE_MSK: - * @TX_MODE_NO_BURST: - * @TX_MODE_IN_BURST_SEQ: - * @TX_MODE_FIRST_IN_BURST: - * @TX_QUEUE_NUM_MSK: - * - * Valid only if frame_count =1 - * TODO: complete documentation - */ -enum iwl_tx_status { - TX_STATUS_MSK = 0x000000ff, - TX_STATUS_SUCCESS = 0x01, - TX_STATUS_DIRECT_DONE = 0x02, - /* postpone TX */ - TX_STATUS_POSTPONE_DELAY = 0x40, - TX_STATUS_POSTPONE_FEW_BYTES = 0x41, - TX_STATUS_POSTPONE_BT_PRIO = 0x42, - TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43, - TX_STATUS_POSTPONE_CALC_TTAK = 0x44, - /* abort TX */ - TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81, - TX_STATUS_FAIL_SHORT_LIMIT = 0x82, - TX_STATUS_FAIL_LONG_LIMIT = 0x83, - TX_STATUS_FAIL_UNDERRUN = 0x84, - TX_STATUS_FAIL_DRAIN_FLOW = 0x85, - TX_STATUS_FAIL_RFKILL_FLUSH = 0x86, - TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, - TX_STATUS_FAIL_DEST_PS = 0x88, - TX_STATUS_FAIL_HOST_ABORTED = 0x89, - TX_STATUS_FAIL_BT_RETRY = 0x8a, - TX_STATUS_FAIL_STA_INVALID = 0x8b, - TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, - TX_STATUS_FAIL_TID_DISABLE = 0x8d, - TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e, - TX_STATUS_FAIL_SMALL_CF_POLL = 0x8f, - TX_STATUS_FAIL_FW_DROP = 0x90, - TX_STATUS_FAIL_STA_COLOR_MISMATCH = 0x91, - TX_STATUS_INTERNAL_ABORT = 0x92, - TX_MODE_MSK = 0x00000f00, - TX_MODE_NO_BURST = 0x00000000, - TX_MODE_IN_BURST_SEQ = 0x00000100, - TX_MODE_FIRST_IN_BURST = 0x00000200, - TX_QUEUE_NUM_MSK = 0x0001f000, - TX_NARROW_BW_MSK = 0x00060000, - TX_NARROW_BW_1DIV2 = 0x00020000, - TX_NARROW_BW_1DIV4 = 0x00040000, - TX_NARROW_BW_1DIV8 = 0x00060000, -}; - -/* - * enum iwl_tx_agg_status - TX aggregation status - * @AGG_TX_STATE_STATUS_MSK: - * @AGG_TX_STATE_TRANSMITTED: - * @AGG_TX_STATE_UNDERRUN: - * @AGG_TX_STATE_BT_PRIO: - * @AGG_TX_STATE_FEW_BYTES: - * @AGG_TX_STATE_ABORT: - * @AGG_TX_STATE_LAST_SENT_TTL: - * @AGG_TX_STATE_LAST_SENT_TRY_CNT: - * @AGG_TX_STATE_LAST_SENT_BT_KILL: - * @AGG_TX_STATE_SCD_QUERY: - * @AGG_TX_STATE_TEST_BAD_CRC32: - * @AGG_TX_STATE_RESPONSE: - * @AGG_TX_STATE_DUMP_TX: - * @AGG_TX_STATE_DELAY_TX: - * @AGG_TX_STATE_TRY_CNT_MSK: Retry count for 1st frame in aggregation (retries - * occur if tx failed for this frame when it was a member of a previous - * aggregation block). If rate scaling is used, retry count indicates the - * rate table entry used for all frames in the new agg. - *@ AGG_TX_STATE_SEQ_NUM_MSK: Command ID and sequence number of Tx command for - * this frame - * - * TODO: complete documentation - */ -enum iwl_tx_agg_status { - AGG_TX_STATE_STATUS_MSK = 0x00fff, - AGG_TX_STATE_TRANSMITTED = 0x000, - AGG_TX_STATE_UNDERRUN = 0x001, - AGG_TX_STATE_BT_PRIO = 0x002, - AGG_TX_STATE_FEW_BYTES = 0x004, - AGG_TX_STATE_ABORT = 0x008, - AGG_TX_STATE_LAST_SENT_TTL = 0x010, - AGG_TX_STATE_LAST_SENT_TRY_CNT = 0x020, - AGG_TX_STATE_LAST_SENT_BT_KILL = 0x040, - AGG_TX_STATE_SCD_QUERY = 0x080, - AGG_TX_STATE_TEST_BAD_CRC32 = 0x0100, - AGG_TX_STATE_RESPONSE = 0x1ff, - AGG_TX_STATE_DUMP_TX = 0x200, - AGG_TX_STATE_DELAY_TX = 0x400, - AGG_TX_STATE_TRY_CNT_POS = 12, - AGG_TX_STATE_TRY_CNT_MSK = 0xf << AGG_TX_STATE_TRY_CNT_POS, -}; - -#define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL| \ - AGG_TX_STATE_LAST_SENT_TRY_CNT| \ - AGG_TX_STATE_LAST_SENT_BT_KILL) - -/* - * The mask below describes a status where we are absolutely sure that the MPDU - * wasn't sent. For BA/Underrun we cannot be that sure. All we know that we've - * written the bytes to the TXE, but we know nothing about what the DSP did. - */ -#define AGG_TX_STAT_FRAME_NOT_SENT (AGG_TX_STATE_FEW_BYTES | \ - AGG_TX_STATE_ABORT | \ - AGG_TX_STATE_SCD_QUERY) - -/* - * REPLY_TX = 0x1c (response) - * - * This response may be in one of two slightly different formats, indicated - * by the frame_count field: - * - * 1) No aggregation (frame_count == 1). This reports Tx results for a single - * frame. Multiple attempts, at various bit rates, may have been made for - * this frame. - * - * 2) Aggregation (frame_count > 1). This reports Tx results for two or more - * frames that used block-acknowledge. All frames were transmitted at - * same rate. Rate scaling may have been used if first frame in this new - * agg block failed in previous agg block(s). - * - * Note that, for aggregation, ACK (block-ack) status is not delivered - * here; block-ack has not been received by the time the device records - * this status. - * This status relates to reasons the tx might have been blocked or aborted - * within the device, rather than whether it was received successfully by - * the destination station. - */ - -/** - * struct agg_tx_status - per packet TX aggregation status - * @status: enum iwl_tx_agg_status - * @sequence: Sequence # for this frame's Tx cmd (not SSN!) - */ -struct agg_tx_status { - __le16 status; - __le16 sequence; -} __packed; - -/* - * definitions for initial rate index field - * bits [3:0] initial rate index - * bits [6:4] rate table color, used for the initial rate - * bit-7 invalid rate indication - */ -#define TX_RES_INIT_RATE_INDEX_MSK 0x0f -#define TX_RES_RATE_TABLE_COLOR_MSK 0x70 -#define TX_RES_INV_RATE_INDEX_MSK 0x80 - -#define IWL_MVM_TX_RES_GET_TID(_ra_tid) ((_ra_tid) & 0x0f) -#define IWL_MVM_TX_RES_GET_RA(_ra_tid) ((_ra_tid) >> 4) - -/** - * struct iwl_mvm_tx_resp - notifies that fw is TXing a packet - * ( REPLY_TX = 0x1c ) - * @frame_count: 1 no aggregation, >1 aggregation - * @bt_kill_count: num of times blocked by bluetooth (unused for agg) - * @failure_rts: num of failures due to unsuccessful RTS - * @failure_frame: num failures due to no ACK (unused for agg) - * @initial_rate: for non-agg: rate of the successful Tx. For agg: rate of the - * Tx of all the batch. RATE_MCS_* - * @wireless_media_time: for non-agg: RTS + CTS + frame tx attempts time + ACK. - * for agg: RTS + CTS + aggregation tx time + block-ack time. - * in usec. - * @pa_status: tx power info - * @pa_integ_res_a: tx power info - * @pa_integ_res_b: tx power info - * @pa_integ_res_c: tx power info - * @measurement_req_id: tx power info - * @tfd_info: TFD information set by the FH - * @seq_ctl: sequence control from the Tx cmd - * @byte_cnt: byte count from the Tx cmd - * @tlc_info: TLC rate info - * @ra_tid: bits [3:0] = ra, bits [7:4] = tid - * @frame_ctrl: frame control - * @status: for non-agg: frame status TX_STATUS_* - * for agg: status of 1st frame, AGG_TX_STATE_*; other frame status fields - * follow this one, up to frame_count. - * - * After the array of statuses comes the SSN of the SCD. Look at - * %iwl_mvm_get_scd_ssn for more details. - */ -struct iwl_mvm_tx_resp { - u8 frame_count; - u8 bt_kill_count; - u8 failure_rts; - u8 failure_frame; - __le32 initial_rate; - __le16 wireless_media_time; - - u8 pa_status; - u8 pa_integ_res_a[3]; - u8 pa_integ_res_b[3]; - u8 pa_integ_res_c[3]; - __le16 measurement_req_id; - __le16 reserved; - - __le32 tfd_info; - __le16 seq_ctl; - __le16 byte_cnt; - u8 tlc_info; - u8 ra_tid; - __le16 frame_ctrl; - - struct agg_tx_status status; -} __packed; /* TX_RSP_API_S_VER_3 */ - -/** - * struct iwl_mvm_ba_notif - notifies about reception of BA - * ( BA_NOTIF = 0xc5 ) - * @sta_addr_lo32: lower 32 bits of the MAC address - * @sta_addr_hi16: upper 16 bits of the MAC address - * @sta_id: Index of recipient (BA-sending) station in fw's station table - * @tid: tid of the session - * @seq_ctl: - * @bitmap: the bitmap of the BA notification as seen in the air - * @scd_flow: the tx queue this BA relates to - * @scd_ssn: the index of the last contiguously sent packet - * @txed: number of Txed frames in this batch - * @txed_2_done: number of Acked frames in this batch - */ -struct iwl_mvm_ba_notif { - __le32 sta_addr_lo32; - __le16 sta_addr_hi16; - __le16 reserved; - - u8 sta_id; - u8 tid; - __le16 seq_ctl; - __le64 bitmap; - __le16 scd_flow; - __le16 scd_ssn; - u8 txed; - u8 txed_2_done; - __le16 reserved1; -} __packed; - -/* - * struct iwl_mac_beacon_cmd - beacon template command - * @tx: the tx commands associated with the beacon frame - * @template_id: currently equal to the mac context id of the coresponding - * mac. - * @tim_idx: the offset of the tim IE in the beacon - * @tim_size: the length of the tim IE - * @frame: the template of the beacon frame - */ -struct iwl_mac_beacon_cmd { - struct iwl_tx_cmd tx; - __le32 template_id; - __le32 tim_idx; - __le32 tim_size; - struct ieee80211_hdr frame[0]; -} __packed; - -struct iwl_beacon_notif { - struct iwl_mvm_tx_resp beacon_notify_hdr; - __le64 tsf; - __le32 ibss_mgr_status; -} __packed; - -/** - * enum iwl_dump_control - dump (flush) control flags - * @DUMP_TX_FIFO_FLUSH: Dump MSDUs until the the FIFO is empty - * and the TFD queues are empty. - */ -enum iwl_dump_control { - DUMP_TX_FIFO_FLUSH = BIT(1), -}; - -/** - * struct iwl_tx_path_flush_cmd -- queue/FIFO flush command - * @queues_ctl: bitmap of queues to flush - * @flush_ctl: control flags - * @reserved: reserved - */ -struct iwl_tx_path_flush_cmd { - __le32 queues_ctl; - __le16 flush_ctl; - __le16 reserved; -} __packed; /* TX_PATH_FLUSH_CMD_API_S_VER_1 */ - -/** - * iwl_mvm_get_scd_ssn - returns the SSN of the SCD - * @tx_resp: the Tx response from the fw (agg or non-agg) - * - * When the fw sends an AMPDU, it fetches the MPDUs one after the other. Since - * it can't know that everything will go well until the end of the AMPDU, it - * can't know in advance the number of MPDUs that will be sent in the current - * batch. This is why it writes the agg Tx response while it fetches the MPDUs. - * Hence, it can't know in advance what the SSN of the SCD will be at the end - * of the batch. This is why the SSN of the SCD is written at the end of the - * whole struct at a variable offset. This function knows how to cope with the - * variable offset and returns the SSN of the SCD. - */ -static inline u32 iwl_mvm_get_scd_ssn(struct iwl_mvm_tx_resp *tx_resp) -{ - return le32_to_cpup((__le32 *)&tx_resp->status + - tx_resp->frame_count) & 0xfff; -} - -#endif /* __fw_api_tx_h__ */ diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h deleted file mode 100644 index c6384555aab4..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h +++ /dev/null @@ -1,978 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#ifndef __fw_api_h__ -#define __fw_api_h__ - -#include "fw-api-rs.h" -#include "fw-api-tx.h" -#include "fw-api-sta.h" -#include "fw-api-mac.h" -#include "fw-api-power.h" -#include "fw-api-d3.h" -#include "fw-api-bt-coex.h" - -/* queue and FIFO numbers by usage */ -enum { - IWL_MVM_OFFCHANNEL_QUEUE = 8, - IWL_MVM_CMD_QUEUE = 9, - IWL_MVM_AUX_QUEUE = 15, - IWL_MVM_FIRST_AGG_QUEUE = 16, - IWL_MVM_NUM_QUEUES = 20, - IWL_MVM_LAST_AGG_QUEUE = IWL_MVM_NUM_QUEUES - 1, - IWL_MVM_CMD_FIFO = 7 -}; - -#define IWL_MVM_STATION_COUNT 16 - -/* commands */ -enum { - MVM_ALIVE = 0x1, - REPLY_ERROR = 0x2, - - INIT_COMPLETE_NOTIF = 0x4, - - /* PHY context commands */ - PHY_CONTEXT_CMD = 0x8, - DBG_CFG = 0x9, - - /* station table */ - ADD_STA = 0x18, - REMOVE_STA = 0x19, - - /* TX */ - TX_CMD = 0x1c, - TXPATH_FLUSH = 0x1e, - MGMT_MCAST_KEY = 0x1f, - - /* global key */ - WEP_KEY = 0x20, - - /* MAC and Binding commands */ - MAC_CONTEXT_CMD = 0x28, - TIME_EVENT_CMD = 0x29, /* both CMD and response */ - TIME_EVENT_NOTIFICATION = 0x2a, - BINDING_CONTEXT_CMD = 0x2b, - TIME_QUOTA_CMD = 0x2c, - - LQ_CMD = 0x4e, - - /* Calibration */ - TEMPERATURE_NOTIFICATION = 0x62, - CALIBRATION_CFG_CMD = 0x65, - CALIBRATION_RES_NOTIFICATION = 0x66, - CALIBRATION_COMPLETE_NOTIFICATION = 0x67, - RADIO_VERSION_NOTIFICATION = 0x68, - - /* Scan offload */ - SCAN_OFFLOAD_REQUEST_CMD = 0x51, - SCAN_OFFLOAD_ABORT_CMD = 0x52, - SCAN_OFFLOAD_COMPLETE = 0x6D, - SCAN_OFFLOAD_UPDATE_PROFILES_CMD = 0x6E, - SCAN_OFFLOAD_CONFIG_CMD = 0x6f, - - /* Phy */ - PHY_CONFIGURATION_CMD = 0x6a, - CALIB_RES_NOTIF_PHY_DB = 0x6b, - /* PHY_DB_CMD = 0x6c, */ - - /* Power */ - POWER_TABLE_CMD = 0x77, - - /* Scanning */ - SCAN_REQUEST_CMD = 0x80, - SCAN_ABORT_CMD = 0x81, - SCAN_START_NOTIFICATION = 0x82, - SCAN_RESULTS_NOTIFICATION = 0x83, - SCAN_COMPLETE_NOTIFICATION = 0x84, - - /* NVM */ - NVM_ACCESS_CMD = 0x88, - - SET_CALIB_DEFAULT_CMD = 0x8e, - - BEACON_NOTIFICATION = 0x90, - BEACON_TEMPLATE_CMD = 0x91, - TX_ANT_CONFIGURATION_CMD = 0x98, - BT_CONFIG = 0x9b, - STATISTICS_NOTIFICATION = 0x9d, - - /* RF-KILL commands and notifications */ - CARD_STATE_CMD = 0xa0, - CARD_STATE_NOTIFICATION = 0xa1, - - REPLY_RX_PHY_CMD = 0xc0, - REPLY_RX_MPDU_CMD = 0xc1, - BA_NOTIF = 0xc5, - - /* BT Coex */ - BT_COEX_PRIO_TABLE = 0xcc, - BT_COEX_PROT_ENV = 0xcd, - BT_PROFILE_NOTIFICATION = 0xce, - - REPLY_DEBUG_CMD = 0xf0, - DEBUG_LOG_MSG = 0xf7, - - MCAST_FILTER_CMD = 0xd0, - - /* D3 commands/notifications */ - D3_CONFIG_CMD = 0xd3, - PROT_OFFLOAD_CONFIG_CMD = 0xd4, - OFFLOADS_QUERY_CMD = 0xd5, - REMOTE_WAKE_CONFIG_CMD = 0xd6, - - /* for WoWLAN in particular */ - WOWLAN_PATTERNS = 0xe0, - WOWLAN_CONFIGURATION = 0xe1, - WOWLAN_TSC_RSC_PARAM = 0xe2, - WOWLAN_TKIP_PARAM = 0xe3, - WOWLAN_KEK_KCK_MATERIAL = 0xe4, - WOWLAN_GET_STATUSES = 0xe5, - WOWLAN_TX_POWER_PER_DB = 0xe6, - - /* and for NetDetect */ - NET_DETECT_CONFIG_CMD = 0x54, - NET_DETECT_PROFILES_QUERY_CMD = 0x56, - NET_DETECT_PROFILES_CMD = 0x57, - NET_DETECT_HOTSPOTS_CMD = 0x58, - NET_DETECT_HOTSPOTS_QUERY_CMD = 0x59, - - REPLY_MAX = 0xff, -}; - -/** - * struct iwl_cmd_response - generic response struct for most commands - * @status: status of the command asked, changes for each one - */ -struct iwl_cmd_response { - __le32 status; -}; - -/* - * struct iwl_tx_ant_cfg_cmd - * @valid: valid antenna configuration - */ -struct iwl_tx_ant_cfg_cmd { - __le32 valid; -} __packed; - -/* - * Calibration control struct. - * Sent as part of the phy configuration command. - * @flow_trigger: bitmap for which calibrations to perform according to - * flow triggers. - * @event_trigger: bitmap for which calibrations to perform according to - * event triggers. - */ -struct iwl_calib_ctrl { - __le32 flow_trigger; - __le32 event_trigger; -} __packed; - -/* This enum defines the bitmap of various calibrations to enable in both - * init ucode and runtime ucode through CALIBRATION_CFG_CMD. - */ -enum iwl_calib_cfg { - IWL_CALIB_CFG_XTAL_IDX = BIT(0), - IWL_CALIB_CFG_TEMPERATURE_IDX = BIT(1), - IWL_CALIB_CFG_VOLTAGE_READ_IDX = BIT(2), - IWL_CALIB_CFG_PAPD_IDX = BIT(3), - IWL_CALIB_CFG_TX_PWR_IDX = BIT(4), - IWL_CALIB_CFG_DC_IDX = BIT(5), - IWL_CALIB_CFG_BB_FILTER_IDX = BIT(6), - IWL_CALIB_CFG_LO_LEAKAGE_IDX = BIT(7), - IWL_CALIB_CFG_TX_IQ_IDX = BIT(8), - IWL_CALIB_CFG_TX_IQ_SKEW_IDX = BIT(9), - IWL_CALIB_CFG_RX_IQ_IDX = BIT(10), - IWL_CALIB_CFG_RX_IQ_SKEW_IDX = BIT(11), - IWL_CALIB_CFG_SENSITIVITY_IDX = BIT(12), - IWL_CALIB_CFG_CHAIN_NOISE_IDX = BIT(13), - IWL_CALIB_CFG_DISCONNECTED_ANT_IDX = BIT(14), - IWL_CALIB_CFG_ANT_COUPLING_IDX = BIT(15), - IWL_CALIB_CFG_DAC_IDX = BIT(16), - IWL_CALIB_CFG_ABS_IDX = BIT(17), - IWL_CALIB_CFG_AGC_IDX = BIT(18), -}; - -/* - * Phy configuration command. - */ -struct iwl_phy_cfg_cmd { - __le32 phy_cfg; - struct iwl_calib_ctrl calib_control; -} __packed; - -#define PHY_CFG_RADIO_TYPE (BIT(0) | BIT(1)) -#define PHY_CFG_RADIO_STEP (BIT(2) | BIT(3)) -#define PHY_CFG_RADIO_DASH (BIT(4) | BIT(5)) -#define PHY_CFG_PRODUCT_NUMBER (BIT(6) | BIT(7)) -#define PHY_CFG_TX_CHAIN_A BIT(8) -#define PHY_CFG_TX_CHAIN_B BIT(9) -#define PHY_CFG_TX_CHAIN_C BIT(10) -#define PHY_CFG_RX_CHAIN_A BIT(12) -#define PHY_CFG_RX_CHAIN_B BIT(13) -#define PHY_CFG_RX_CHAIN_C BIT(14) - - -/* Target of the NVM_ACCESS_CMD */ -enum { - NVM_ACCESS_TARGET_CACHE = 0, - NVM_ACCESS_TARGET_OTP = 1, - NVM_ACCESS_TARGET_EEPROM = 2, -}; - -/* Section types for NVM_ACCESS_CMD */ -enum { - NVM_SECTION_TYPE_HW = 0, - NVM_SECTION_TYPE_SW, - NVM_SECTION_TYPE_PAPD, - NVM_SECTION_TYPE_BT, - NVM_SECTION_TYPE_CALIBRATION, - NVM_SECTION_TYPE_PRODUCTION, - NVM_SECTION_TYPE_POST_FCS_CALIB, - NVM_NUM_OF_SECTIONS, -}; - -/** - * struct iwl_nvm_access_cmd_ver2 - Request the device to send an NVM section - * @op_code: 0 - read, 1 - write - * @target: NVM_ACCESS_TARGET_* - * @type: NVM_SECTION_TYPE_* - * @offset: offset in bytes into the section - * @length: in bytes, to read/write - * @data: if write operation, the data to write. On read its empty - */ -struct iwl_nvm_access_cmd { - u8 op_code; - u8 target; - __le16 type; - __le16 offset; - __le16 length; - u8 data[]; -} __packed; /* NVM_ACCESS_CMD_API_S_VER_2 */ - -/** - * struct iwl_nvm_access_resp_ver2 - response to NVM_ACCESS_CMD - * @offset: offset in bytes into the section - * @length: in bytes, either how much was written or read - * @type: NVM_SECTION_TYPE_* - * @status: 0 for success, fail otherwise - * @data: if read operation, the data returned. Empty on write. - */ -struct iwl_nvm_access_resp { - __le16 offset; - __le16 length; - __le16 type; - __le16 status; - u8 data[]; -} __packed; /* NVM_ACCESS_CMD_RESP_API_S_VER_2 */ - -/* MVM_ALIVE 0x1 */ - -/* alive response is_valid values */ -#define ALIVE_RESP_UCODE_OK BIT(0) -#define ALIVE_RESP_RFKILL BIT(1) - -/* alive response ver_type values */ -enum { - FW_TYPE_HW = 0, - FW_TYPE_PROT = 1, - FW_TYPE_AP = 2, - FW_TYPE_WOWLAN = 3, - FW_TYPE_TIMING = 4, - FW_TYPE_WIPAN = 5 -}; - -/* alive response ver_subtype values */ -enum { - FW_SUBTYPE_FULL_FEATURE = 0, - FW_SUBTYPE_BOOTSRAP = 1, /* Not valid */ - FW_SUBTYPE_REDUCED = 2, - FW_SUBTYPE_ALIVE_ONLY = 3, - FW_SUBTYPE_WOWLAN = 4, - FW_SUBTYPE_AP_SUBTYPE = 5, - FW_SUBTYPE_WIPAN = 6, - FW_SUBTYPE_INITIALIZE = 9 -}; - -#define IWL_ALIVE_STATUS_ERR 0xDEAD -#define IWL_ALIVE_STATUS_OK 0xCAFE - -#define IWL_ALIVE_FLG_RFKILL BIT(0) - -struct mvm_alive_resp { - __le16 status; - __le16 flags; - u8 ucode_minor; - u8 ucode_major; - __le16 id; - u8 api_minor; - u8 api_major; - u8 ver_subtype; - u8 ver_type; - u8 mac; - u8 opt; - __le16 reserved2; - __le32 timestamp; - __le32 error_event_table_ptr; /* SRAM address for error log */ - __le32 log_event_table_ptr; /* SRAM address for event log */ - __le32 cpu_register_ptr; - __le32 dbgm_config_ptr; - __le32 alive_counter_ptr; - __le32 scd_base_ptr; /* SRAM address for SCD */ -} __packed; /* ALIVE_RES_API_S_VER_1 */ - -/* Error response/notification */ -enum { - FW_ERR_UNKNOWN_CMD = 0x0, - FW_ERR_INVALID_CMD_PARAM = 0x1, - FW_ERR_SERVICE = 0x2, - FW_ERR_ARC_MEMORY = 0x3, - FW_ERR_ARC_CODE = 0x4, - FW_ERR_WATCH_DOG = 0x5, - FW_ERR_WEP_GRP_KEY_INDX = 0x10, - FW_ERR_WEP_KEY_SIZE = 0x11, - FW_ERR_OBSOLETE_FUNC = 0x12, - FW_ERR_UNEXPECTED = 0xFE, - FW_ERR_FATAL = 0xFF -}; - -/** - * struct iwl_error_resp - FW error indication - * ( REPLY_ERROR = 0x2 ) - * @error_type: one of FW_ERR_* - * @cmd_id: the command ID for which the error occured - * @bad_cmd_seq_num: sequence number of the erroneous command - * @error_service: which service created the error, applicable only if - * error_type = 2, otherwise 0 - * @timestamp: TSF in usecs. - */ -struct iwl_error_resp { - __le32 error_type; - u8 cmd_id; - u8 reserved1; - __le16 bad_cmd_seq_num; - __le32 error_service; - __le64 timestamp; -} __packed; - - -/* Common PHY, MAC and Bindings definitions */ - -#define MAX_MACS_IN_BINDING (3) -#define MAX_BINDINGS (4) -#define AUX_BINDING_INDEX (3) -#define MAX_PHYS (4) - -/* Used to extract ID and color from the context dword */ -#define FW_CTXT_ID_POS (0) -#define FW_CTXT_ID_MSK (0xff << FW_CTXT_ID_POS) -#define FW_CTXT_COLOR_POS (8) -#define FW_CTXT_COLOR_MSK (0xff << FW_CTXT_COLOR_POS) -#define FW_CTXT_INVALID (0xffffffff) - -#define FW_CMD_ID_AND_COLOR(_id, _color) ((_id << FW_CTXT_ID_POS) |\ - (_color << FW_CTXT_COLOR_POS)) - -/* Possible actions on PHYs, MACs and Bindings */ -enum { - FW_CTXT_ACTION_STUB = 0, - FW_CTXT_ACTION_ADD, - FW_CTXT_ACTION_MODIFY, - FW_CTXT_ACTION_REMOVE, - FW_CTXT_ACTION_NUM -}; /* COMMON_CONTEXT_ACTION_API_E_VER_1 */ - -/* Time Events */ - -/* Time Event types, according to MAC type */ -enum iwl_time_event_type { - /* BSS Station Events */ - TE_BSS_STA_AGGRESSIVE_ASSOC, - TE_BSS_STA_ASSOC, - TE_BSS_EAP_DHCP_PROT, - TE_BSS_QUIET_PERIOD, - - /* P2P Device Events */ - TE_P2P_DEVICE_DISCOVERABLE, - TE_P2P_DEVICE_LISTEN, - TE_P2P_DEVICE_ACTION_SCAN, - TE_P2P_DEVICE_FULL_SCAN, - - /* P2P Client Events */ - TE_P2P_CLIENT_AGGRESSIVE_ASSOC, - TE_P2P_CLIENT_ASSOC, - TE_P2P_CLIENT_QUIET_PERIOD, - - /* P2P GO Events */ - TE_P2P_GO_ASSOC_PROT, - TE_P2P_GO_REPETITIVE_NOA, - TE_P2P_GO_CT_WINDOW, - - /* WiDi Sync Events */ - TE_WIDI_TX_SYNC, - - TE_MAX -}; /* MAC_EVENT_TYPE_API_E_VER_1 */ - -/* Time Event dependencies: none, on another TE, or in a specific time */ -enum { - TE_INDEPENDENT = 0, - TE_DEP_OTHER = 1, - TE_DEP_TSF = 2, - TE_EVENT_SOCIOPATHIC = 4, -}; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */ -/* - * Supported Time event notifications configuration. - * A notification (both event and fragment) includes a status indicating weather - * the FW was able to schedule the event or not. For fragment start/end - * notification the status is always success. There is no start/end fragment - * notification for monolithic events. - * - * @TE_NOTIF_NONE: no notifications - * @TE_NOTIF_HOST_EVENT_START: request/receive notification on event start - * @TE_NOTIF_HOST_EVENT_END:request/receive notification on event end - * @TE_NOTIF_INTERNAL_EVENT_START: internal FW use - * @TE_NOTIF_INTERNAL_EVENT_END: internal FW use. - * @TE_NOTIF_HOST_FRAG_START: request/receive notification on frag start - * @TE_NOTIF_HOST_FRAG_END:request/receive notification on frag end - * @TE_NOTIF_INTERNAL_FRAG_START: internal FW use. - * @TE_NOTIF_INTERNAL_FRAG_END: internal FW use. - */ -enum { - TE_NOTIF_NONE = 0, - TE_NOTIF_HOST_EVENT_START = 0x1, - TE_NOTIF_HOST_EVENT_END = 0x2, - TE_NOTIF_INTERNAL_EVENT_START = 0x4, - TE_NOTIF_INTERNAL_EVENT_END = 0x8, - TE_NOTIF_HOST_FRAG_START = 0x10, - TE_NOTIF_HOST_FRAG_END = 0x20, - TE_NOTIF_INTERNAL_FRAG_START = 0x40, - TE_NOTIF_INTERNAL_FRAG_END = 0x80 -}; /* MAC_EVENT_ACTION_API_E_VER_2 */ - -/* - * @TE_FRAG_NONE: fragmentation of the time event is NOT allowed. - * @TE_FRAG_SINGLE: fragmentation of the time event is allowed, but only - * the first fragment is scheduled. - * @TE_FRAG_DUAL: fragmentation of the time event is allowed, but only - * the first 2 fragments are scheduled. - * @TE_FRAG_ENDLESS: fragmentation of the time event is allowed, and any number - * of fragments are valid. - * - * Other than the constant defined above, specifying a fragmentation value 'x' - * means that the event can be fragmented but only the first 'x' will be - * scheduled. - */ -enum { - TE_FRAG_NONE = 0, - TE_FRAG_SINGLE = 1, - TE_FRAG_DUAL = 2, - TE_FRAG_ENDLESS = 0xffffffff -}; - -/* Repeat the time event endlessly (until removed) */ -#define TE_REPEAT_ENDLESS (0xffffffff) -/* If a Time Event has bounded repetitions, this is the maximal value */ -#define TE_REPEAT_MAX_MSK (0x0fffffff) -/* If a Time Event can be fragmented, this is the max number of fragments */ -#define TE_FRAG_MAX_MSK (0x0fffffff) - -/** - * struct iwl_time_event_cmd - configuring Time Events - * ( TIME_EVENT_CMD = 0x29 ) - * @id_and_color: ID and color of the relevant MAC - * @action: action to perform, one of FW_CTXT_ACTION_* - * @id: this field has two meanings, depending on the action: - * If the action is ADD, then it means the type of event to add. - * For all other actions it is the unique event ID assigned when the - * event was added by the FW. - * @apply_time: When to start the Time Event (in GP2) - * @max_delay: maximum delay to event's start (apply time), in TU - * @depends_on: the unique ID of the event we depend on (if any) - * @interval: interval between repetitions, in TU - * @interval_reciprocal: 2^32 / interval - * @duration: duration of event in TU - * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS - * @dep_policy: one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF - * @is_present: 0 or 1, are we present or absent during the Time Event - * @max_frags: maximal number of fragments the Time Event can be divided to - * @notify: notifications using TE_NOTIF_* (whom to notify when) - */ -struct iwl_time_event_cmd { - /* COMMON_INDEX_HDR_API_S_VER_1 */ - __le32 id_and_color; - __le32 action; - __le32 id; - /* MAC_TIME_EVENT_DATA_API_S_VER_1 */ - __le32 apply_time; - __le32 max_delay; - __le32 dep_policy; - __le32 depends_on; - __le32 is_present; - __le32 max_frags; - __le32 interval; - __le32 interval_reciprocal; - __le32 duration; - __le32 repeat; - __le32 notify; -} __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_1 */ - -/** - * struct iwl_time_event_resp - response structure to iwl_time_event_cmd - * @status: bit 0 indicates success, all others specify errors - * @id: the Time Event type - * @unique_id: the unique ID assigned (in ADD) or given (others) to the TE - * @id_and_color: ID and color of the relevant MAC - */ -struct iwl_time_event_resp { - __le32 status; - __le32 id; - __le32 unique_id; - __le32 id_and_color; -} __packed; /* MAC_TIME_EVENT_RSP_API_S_VER_1 */ - -/** - * struct iwl_time_event_notif - notifications of time event start/stop - * ( TIME_EVENT_NOTIFICATION = 0x2a ) - * @timestamp: action timestamp in GP2 - * @session_id: session's unique id - * @unique_id: unique id of the Time Event itself - * @id_and_color: ID and color of the relevant MAC - * @action: one of TE_NOTIF_START or TE_NOTIF_END - * @status: true if scheduled, false otherwise (not executed) - */ -struct iwl_time_event_notif { - __le32 timestamp; - __le32 session_id; - __le32 unique_id; - __le32 id_and_color; - __le32 action; - __le32 status; -} __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */ - - -/* Bindings and Time Quota */ - -/** - * struct iwl_binding_cmd - configuring bindings - * ( BINDING_CONTEXT_CMD = 0x2b ) - * @id_and_color: ID and color of the relevant Binding - * @action: action to perform, one of FW_CTXT_ACTION_* - * @macs: array of MAC id and colors which belong to the binding - * @phy: PHY id and color which belongs to the binding - */ -struct iwl_binding_cmd { - /* COMMON_INDEX_HDR_API_S_VER_1 */ - __le32 id_and_color; - __le32 action; - /* BINDING_DATA_API_S_VER_1 */ - __le32 macs[MAX_MACS_IN_BINDING]; - __le32 phy; -} __packed; /* BINDING_CMD_API_S_VER_1 */ - -/* The maximal number of fragments in the FW's schedule session */ -#define IWL_MVM_MAX_QUOTA 128 - -/** - * struct iwl_time_quota_data - configuration of time quota per binding - * @id_and_color: ID and color of the relevant Binding - * @quota: absolute time quota in TU. The scheduler will try to divide the - * remainig quota (after Time Events) according to this quota. - * @max_duration: max uninterrupted context duration in TU - */ -struct iwl_time_quota_data { - __le32 id_and_color; - __le32 quota; - __le32 max_duration; -} __packed; /* TIME_QUOTA_DATA_API_S_VER_1 */ - -/** - * struct iwl_time_quota_cmd - configuration of time quota between bindings - * ( TIME_QUOTA_CMD = 0x2c ) - * @quotas: allocations per binding - */ -struct iwl_time_quota_cmd { - struct iwl_time_quota_data quotas[MAX_BINDINGS]; -} __packed; /* TIME_QUOTA_ALLOCATION_CMD_API_S_VER_1 */ - - -/* PHY context */ - -/* Supported bands */ -#define PHY_BAND_5 (0) -#define PHY_BAND_24 (1) - -/* Supported channel width, vary if there is VHT support */ -#define PHY_VHT_CHANNEL_MODE20 (0x0) -#define PHY_VHT_CHANNEL_MODE40 (0x1) -#define PHY_VHT_CHANNEL_MODE80 (0x2) -#define PHY_VHT_CHANNEL_MODE160 (0x3) - -/* - * Control channel position: - * For legacy set bit means upper channel, otherwise lower. - * For VHT - bit-2 marks if the control is lower/upper relative to center-freq - * bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0. - * center_freq - * | - * 40Mhz |_______|_______| - * 80Mhz |_______|_______|_______|_______| - * 160Mhz |_______|_______|_______|_______|_______|_______|_______|_______| - * code 011 010 001 000 | 100 101 110 111 - */ -#define PHY_VHT_CTRL_POS_1_BELOW (0x0) -#define PHY_VHT_CTRL_POS_2_BELOW (0x1) -#define PHY_VHT_CTRL_POS_3_BELOW (0x2) -#define PHY_VHT_CTRL_POS_4_BELOW (0x3) -#define PHY_VHT_CTRL_POS_1_ABOVE (0x4) -#define PHY_VHT_CTRL_POS_2_ABOVE (0x5) -#define PHY_VHT_CTRL_POS_3_ABOVE (0x6) -#define PHY_VHT_CTRL_POS_4_ABOVE (0x7) - -/* - * @band: PHY_BAND_* - * @channel: channel number - * @width: PHY_[VHT|LEGACY]_CHANNEL_* - * @ctrl channel: PHY_[VHT|LEGACY]_CTRL_* - */ -struct iwl_fw_channel_info { - u8 band; - u8 channel; - u8 width; - u8 ctrl_pos; -} __packed; - -#define PHY_RX_CHAIN_DRIVER_FORCE_POS (0) -#define PHY_RX_CHAIN_DRIVER_FORCE_MSK \ - (0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS) -#define PHY_RX_CHAIN_VALID_POS (1) -#define PHY_RX_CHAIN_VALID_MSK \ - (0x7 << PHY_RX_CHAIN_VALID_POS) -#define PHY_RX_CHAIN_FORCE_SEL_POS (4) -#define PHY_RX_CHAIN_FORCE_SEL_MSK \ - (0x7 << PHY_RX_CHAIN_FORCE_SEL_POS) -#define PHY_RX_CHAIN_FORCE_MIMO_SEL_POS (7) -#define PHY_RX_CHAIN_FORCE_MIMO_SEL_MSK \ - (0x7 << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS) -#define PHY_RX_CHAIN_CNT_POS (10) -#define PHY_RX_CHAIN_CNT_MSK \ - (0x3 << PHY_RX_CHAIN_CNT_POS) -#define PHY_RX_CHAIN_MIMO_CNT_POS (12) -#define PHY_RX_CHAIN_MIMO_CNT_MSK \ - (0x3 << PHY_RX_CHAIN_MIMO_CNT_POS) -#define PHY_RX_CHAIN_MIMO_FORCE_POS (14) -#define PHY_RX_CHAIN_MIMO_FORCE_MSK \ - (0x1 << PHY_RX_CHAIN_MIMO_FORCE_POS) - -/* TODO: fix the value, make it depend on firmware at runtime? */ -#define NUM_PHY_CTX 3 - -/* TODO: complete missing documentation */ -/** - * struct iwl_phy_context_cmd - config of the PHY context - * ( PHY_CONTEXT_CMD = 0x8 ) - * @id_and_color: ID and color of the relevant Binding - * @action: action to perform, one of FW_CTXT_ACTION_* - * @apply_time: 0 means immediate apply and context switch. - * other value means apply new params after X usecs - * @tx_param_color: ??? - * @channel_info: - * @txchain_info: ??? - * @rxchain_info: ??? - * @acquisition_data: ??? - * @dsp_cfg_flags: set to 0 - */ -struct iwl_phy_context_cmd { - /* COMMON_INDEX_HDR_API_S_VER_1 */ - __le32 id_and_color; - __le32 action; - /* PHY_CONTEXT_DATA_API_S_VER_1 */ - __le32 apply_time; - __le32 tx_param_color; - struct iwl_fw_channel_info ci; - __le32 txchain_info; - __le32 rxchain_info; - __le32 acquisition_data; - __le32 dsp_cfg_flags; -} __packed; /* PHY_CONTEXT_CMD_API_VER_1 */ - -#define IWL_RX_INFO_PHY_CNT 8 -#define IWL_RX_INFO_AGC_IDX 1 -#define IWL_RX_INFO_RSSI_AB_IDX 2 -#define IWL_OFDM_AGC_A_MSK 0x0000007f -#define IWL_OFDM_AGC_A_POS 0 -#define IWL_OFDM_AGC_B_MSK 0x00003f80 -#define IWL_OFDM_AGC_B_POS 7 -#define IWL_OFDM_AGC_CODE_MSK 0x3fe00000 -#define IWL_OFDM_AGC_CODE_POS 20 -#define IWL_OFDM_RSSI_INBAND_A_MSK 0x00ff -#define IWL_OFDM_RSSI_A_POS 0 -#define IWL_OFDM_RSSI_ALLBAND_A_MSK 0xff00 -#define IWL_OFDM_RSSI_ALLBAND_A_POS 8 -#define IWL_OFDM_RSSI_INBAND_B_MSK 0xff0000 -#define IWL_OFDM_RSSI_B_POS 16 -#define IWL_OFDM_RSSI_ALLBAND_B_MSK 0xff000000 -#define IWL_OFDM_RSSI_ALLBAND_B_POS 24 - -/** - * struct iwl_rx_phy_info - phy info - * (REPLY_RX_PHY_CMD = 0xc0) - * @non_cfg_phy_cnt: non configurable DSP phy data byte count - * @cfg_phy_cnt: configurable DSP phy data byte count - * @stat_id: configurable DSP phy data set ID - * @reserved1: - * @system_timestamp: GP2 at on air rise - * @timestamp: TSF at on air rise - * @beacon_time_stamp: beacon at on-air rise - * @phy_flags: general phy flags: band, modulation, ... - * @channel: channel number - * @non_cfg_phy_buf: for various implementations of non_cfg_phy - * @rate_n_flags: RATE_MCS_* - * @byte_count: frame's byte-count - * @frame_time: frame's time on the air, based on byte count and frame rate - * calculation - * @mac_active_msk: what MACs were active when the frame was received - * - * Before each Rx, the device sends this data. It contains PHY information - * about the reception of the packet. - */ -struct iwl_rx_phy_info { - u8 non_cfg_phy_cnt; - u8 cfg_phy_cnt; - u8 stat_id; - u8 reserved1; - __le32 system_timestamp; - __le64 timestamp; - __le32 beacon_time_stamp; - __le16 phy_flags; - __le16 channel; - __le32 non_cfg_phy[IWL_RX_INFO_PHY_CNT]; - __le32 rate_n_flags; - __le32 byte_count; - __le16 mac_active_msk; - __le16 frame_time; -} __packed; - -struct iwl_rx_mpdu_res_start { - __le16 byte_count; - __le16 reserved; -} __packed; - -/** - * enum iwl_rx_phy_flags - to parse %iwl_rx_phy_info phy_flags - * @RX_RES_PHY_FLAGS_BAND_24: true if the packet was received on 2.4 band - * @RX_RES_PHY_FLAGS_MOD_CCK: - * @RX_RES_PHY_FLAGS_SHORT_PREAMBLE: true if packet's preamble was short - * @RX_RES_PHY_FLAGS_NARROW_BAND: - * @RX_RES_PHY_FLAGS_ANTENNA: antenna on which the packet was received - * @RX_RES_PHY_FLAGS_AGG: set if the packet was part of an A-MPDU - * @RX_RES_PHY_FLAGS_OFDM_HT: The frame was an HT frame - * @RX_RES_PHY_FLAGS_OFDM_GF: The frame used GF preamble - * @RX_RES_PHY_FLAGS_OFDM_VHT: The frame was a VHT frame - */ -enum iwl_rx_phy_flags { - RX_RES_PHY_FLAGS_BAND_24 = BIT(0), - RX_RES_PHY_FLAGS_MOD_CCK = BIT(1), - RX_RES_PHY_FLAGS_SHORT_PREAMBLE = BIT(2), - RX_RES_PHY_FLAGS_NARROW_BAND = BIT(3), - RX_RES_PHY_FLAGS_ANTENNA = (0x7 << 4), - RX_RES_PHY_FLAGS_ANTENNA_POS = 4, - RX_RES_PHY_FLAGS_AGG = BIT(7), - RX_RES_PHY_FLAGS_OFDM_HT = BIT(8), - RX_RES_PHY_FLAGS_OFDM_GF = BIT(9), - RX_RES_PHY_FLAGS_OFDM_VHT = BIT(10), -}; - -/** - * enum iwl_mvm_rx_status - written by fw for each Rx packet - * @RX_MPDU_RES_STATUS_CRC_OK: CRC is fine - * @RX_MPDU_RES_STATUS_OVERRUN_OK: there was no RXE overflow - * @RX_MPDU_RES_STATUS_SRC_STA_FOUND: - * @RX_MPDU_RES_STATUS_KEY_VALID: - * @RX_MPDU_RES_STATUS_KEY_PARAM_OK: - * @RX_MPDU_RES_STATUS_ICV_OK: ICV is fine, if not, the packet is destroyed - * @RX_MPDU_RES_STATUS_MIC_OK: used for CCM alg only. TKIP MIC is checked - * in the driver. - * @RX_MPDU_RES_STATUS_TTAK_OK: TTAK is fine - * @RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR: valid for alg = CCM_CMAC or - * alg = CCM only. Checks replay attack for 11w frames. Relevant only if - * %RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME is set. - * @RX_MPDU_RES_STATUS_SEC_NO_ENC: this frame is not encrypted - * @RX_MPDU_RES_STATUS_SEC_WEP_ENC: this frame is encrypted using WEP - * @RX_MPDU_RES_STATUS_SEC_CCM_ENC: this frame is encrypted using CCM - * @RX_MPDU_RES_STATUS_SEC_TKIP_ENC: this frame is encrypted using TKIP - * @RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC: this frame is encrypted using CCM_CMAC - * @RX_MPDU_RES_STATUS_SEC_ENC_ERR: this frame couldn't be decrypted - * @RX_MPDU_RES_STATUS_SEC_ENC_MSK: bitmask of the encryption algorithm - * @RX_MPDU_RES_STATUS_DEC_DONE: this frame has been successfully decrypted - * @RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP: - * @RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP: - * @RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT: - * @RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME: this frame is an 11w management frame - * @RX_MPDU_RES_STATUS_HASH_INDEX_MSK: - * @RX_MPDU_RES_STATUS_STA_ID_MSK: - * @RX_MPDU_RES_STATUS_RRF_KILL: - * @RX_MPDU_RES_STATUS_FILTERING_MSK: - * @RX_MPDU_RES_STATUS2_FILTERING_MSK: - */ -enum iwl_mvm_rx_status { - RX_MPDU_RES_STATUS_CRC_OK = BIT(0), - RX_MPDU_RES_STATUS_OVERRUN_OK = BIT(1), - RX_MPDU_RES_STATUS_SRC_STA_FOUND = BIT(2), - RX_MPDU_RES_STATUS_KEY_VALID = BIT(3), - RX_MPDU_RES_STATUS_KEY_PARAM_OK = BIT(4), - RX_MPDU_RES_STATUS_ICV_OK = BIT(5), - RX_MPDU_RES_STATUS_MIC_OK = BIT(6), - RX_MPDU_RES_STATUS_TTAK_OK = BIT(7), - RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR = BIT(7), - RX_MPDU_RES_STATUS_SEC_NO_ENC = (0 << 8), - RX_MPDU_RES_STATUS_SEC_WEP_ENC = (1 << 8), - RX_MPDU_RES_STATUS_SEC_CCM_ENC = (2 << 8), - RX_MPDU_RES_STATUS_SEC_TKIP_ENC = (3 << 8), - RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC = (6 << 8), - RX_MPDU_RES_STATUS_SEC_ENC_ERR = (7 << 8), - RX_MPDU_RES_STATUS_SEC_ENC_MSK = (7 << 8), - RX_MPDU_RES_STATUS_DEC_DONE = BIT(11), - RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP = BIT(12), - RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP = BIT(13), - RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT = BIT(14), - RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME = BIT(15), - RX_MPDU_RES_STATUS_HASH_INDEX_MSK = (0x3F0000), - RX_MPDU_RES_STATUS_STA_ID_MSK = (0x1f000000), - RX_MPDU_RES_STATUS_RRF_KILL = BIT(29), - RX_MPDU_RES_STATUS_FILTERING_MSK = (0xc00000), - RX_MPDU_RES_STATUS2_FILTERING_MSK = (0xc0000000), -}; - -/** - * struct iwl_radio_version_notif - information on the radio version - * ( RADIO_VERSION_NOTIFICATION = 0x68 ) - * @radio_flavor: - * @radio_step: - * @radio_dash: - */ -struct iwl_radio_version_notif { - __le32 radio_flavor; - __le32 radio_step; - __le32 radio_dash; -} __packed; /* RADIO_VERSION_NOTOFICATION_S_VER_1 */ - -enum iwl_card_state_flags { - CARD_ENABLED = 0x00, - HW_CARD_DISABLED = 0x01, - SW_CARD_DISABLED = 0x02, - CT_KILL_CARD_DISABLED = 0x04, - HALT_CARD_DISABLED = 0x08, - CARD_DISABLED_MSK = 0x0f, - CARD_IS_RX_ON = 0x10, -}; - -/** - * struct iwl_radio_version_notif - information on the radio version - * ( CARD_STATE_NOTIFICATION = 0xa1 ) - * @flags: %iwl_card_state_flags - */ -struct iwl_card_state_notif { - __le32 flags; -} __packed; /* CARD_STATE_NTFY_API_S_VER_1 */ - -/** - * struct iwl_set_calib_default_cmd - set default value for calibration. - * ( SET_CALIB_DEFAULT_CMD = 0x8e ) - * @calib_index: the calibration to set value for - * @length: of data - * @data: the value to set for the calibration result - */ -struct iwl_set_calib_default_cmd { - __le16 calib_index; - __le16 length; - u8 data[0]; -} __packed; /* PHY_CALIB_OVERRIDE_VALUES_S */ - -#define MAX_PORT_ID_NUM 2 - -/** - * struct iwl_mcast_filter_cmd - configure multicast filter. - * @filter_own: Set 1 to filter out multicast packets sent by station itself - * @port_id: Multicast MAC addresses array specifier. This is a strange way - * to identify network interface adopted in host-device IF. - * It is used by FW as index in array of addresses. This array has - * MAX_PORT_ID_NUM members. - * @count: Number of MAC addresses in the array - * @pass_all: Set 1 to pass all multicast packets. - * @bssid: current association BSSID. - * @addr_list: Place holder for array of MAC addresses. - * IMPORTANT: add padding if necessary to ensure DWORD alignment. - */ -struct iwl_mcast_filter_cmd { - u8 filter_own; - u8 port_id; - u8 count; - u8 pass_all; - u8 bssid[6]; - u8 reserved[2]; - u8 addr_list[0]; -} __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */ - -#endif /* __fw_api_h__ */ diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c deleted file mode 100644 index e18c92dd60ec..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/fw.c +++ /dev/null @@ -1,528 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#include - -#include "iwl-trans.h" -#include "iwl-op-mode.h" -#include "iwl-fw.h" -#include "iwl-debug.h" -#include "iwl-csr.h" /* for iwl_mvm_rx_card_state_notif */ -#include "iwl-io.h" /* for iwl_mvm_rx_card_state_notif */ -#include "iwl-eeprom-parse.h" - -#include "mvm.h" -#include "iwl-phy-db.h" - -#define MVM_UCODE_ALIVE_TIMEOUT HZ -#define MVM_UCODE_CALIB_TIMEOUT (2*HZ) - -#define UCODE_VALID_OK cpu_to_le32(0x1) - -/* Default calibration values for WkP - set to INIT image w/o running */ -static const u8 wkp_calib_values_rx_iq_skew[] = { 0x00, 0x00, 0x01, 0x00 }; -static const u8 wkp_calib_values_tx_iq_skew[] = { 0x01, 0x00, 0x00, 0x00 }; - -struct iwl_calib_default_data { - u16 size; - void *data; -}; - -#define CALIB_SIZE_N_DATA(_buf) {.size = sizeof(_buf), .data = &_buf} - -static const struct iwl_calib_default_data wkp_calib_default_data[12] = { - [9] = CALIB_SIZE_N_DATA(wkp_calib_values_tx_iq_skew), - [11] = CALIB_SIZE_N_DATA(wkp_calib_values_rx_iq_skew), -}; - -struct iwl_mvm_alive_data { - bool valid; - u32 scd_base_addr; -}; - -static inline const struct fw_img * -iwl_get_ucode_image(struct iwl_mvm *mvm, enum iwl_ucode_type ucode_type) -{ - if (ucode_type >= IWL_UCODE_TYPE_MAX) - return NULL; - - return &mvm->fw->img[ucode_type]; -} - -static int iwl_send_tx_ant_cfg(struct iwl_mvm *mvm, u8 valid_tx_ant) -{ - struct iwl_tx_ant_cfg_cmd tx_ant_cmd = { - .valid = cpu_to_le32(valid_tx_ant), - }; - - IWL_DEBUG_FW(mvm, "select valid tx ant: %u\n", valid_tx_ant); - return iwl_mvm_send_cmd_pdu(mvm, TX_ANT_CONFIGURATION_CMD, CMD_SYNC, - sizeof(tx_ant_cmd), &tx_ant_cmd); -} - -static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait, - struct iwl_rx_packet *pkt, void *data) -{ - struct iwl_mvm *mvm = - container_of(notif_wait, struct iwl_mvm, notif_wait); - struct iwl_mvm_alive_data *alive_data = data; - struct mvm_alive_resp *palive; - - palive = (void *)pkt->data; - - mvm->error_event_table = le32_to_cpu(palive->error_event_table_ptr); - mvm->log_event_table = le32_to_cpu(palive->log_event_table_ptr); - alive_data->scd_base_addr = le32_to_cpu(palive->scd_base_ptr); - - alive_data->valid = le16_to_cpu(palive->status) == IWL_ALIVE_STATUS_OK; - IWL_DEBUG_FW(mvm, - "Alive ucode status 0x%04x revision 0x%01X 0x%01X flags 0x%01X\n", - le16_to_cpu(palive->status), palive->ver_type, - palive->ver_subtype, palive->flags); - - return true; -} - -static bool iwl_wait_phy_db_entry(struct iwl_notif_wait_data *notif_wait, - struct iwl_rx_packet *pkt, void *data) -{ - struct iwl_phy_db *phy_db = data; - - if (pkt->hdr.cmd != CALIB_RES_NOTIF_PHY_DB) { - WARN_ON(pkt->hdr.cmd != INIT_COMPLETE_NOTIF); - return true; - } - - WARN_ON(iwl_phy_db_set_section(phy_db, pkt, GFP_ATOMIC)); - - return false; -} - -static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm, - enum iwl_ucode_type ucode_type) -{ - struct iwl_notification_wait alive_wait; - struct iwl_mvm_alive_data alive_data; - const struct fw_img *fw; - int ret, i; - enum iwl_ucode_type old_type = mvm->cur_ucode; - static const u8 alive_cmd[] = { MVM_ALIVE }; - - mvm->cur_ucode = ucode_type; - fw = iwl_get_ucode_image(mvm, ucode_type); - - mvm->ucode_loaded = false; - - if (!fw) - return -EINVAL; - - iwl_init_notification_wait(&mvm->notif_wait, &alive_wait, - alive_cmd, ARRAY_SIZE(alive_cmd), - iwl_alive_fn, &alive_data); - - ret = iwl_trans_start_fw(mvm->trans, fw, ucode_type == IWL_UCODE_INIT); - if (ret) { - mvm->cur_ucode = old_type; - iwl_remove_notification(&mvm->notif_wait, &alive_wait); - return ret; - } - - /* - * Some things may run in the background now, but we - * just wait for the ALIVE notification here. - */ - ret = iwl_wait_notification(&mvm->notif_wait, &alive_wait, - MVM_UCODE_ALIVE_TIMEOUT); - if (ret) { - mvm->cur_ucode = old_type; - return ret; - } - - if (!alive_data.valid) { - IWL_ERR(mvm, "Loaded ucode is not valid!\n"); - mvm->cur_ucode = old_type; - return -EIO; - } - - iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr); - - /* - * Note: all the queues are enabled as part of the interface - * initialization, but in firmware restart scenarios they - * could be stopped, so wake them up. In firmware restart, - * mac80211 will have the queues stopped as well until the - * reconfiguration completes. During normal startup, they - * will be empty. - */ - - for (i = 0; i < IWL_MAX_HW_QUEUES; i++) { - if (i < IWL_MVM_FIRST_AGG_QUEUE && i != IWL_MVM_CMD_QUEUE) - mvm->queue_to_mac80211[i] = i; - else - mvm->queue_to_mac80211[i] = IWL_INVALID_MAC80211_QUEUE; - atomic_set(&mvm->queue_stop_count[i], 0); - } - - mvm->transport_queue_stop = 0; - - mvm->ucode_loaded = true; - - return 0; -} - -static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm) -{ - struct iwl_phy_cfg_cmd phy_cfg_cmd; - enum iwl_ucode_type ucode_type = mvm->cur_ucode; - - /* Set parameters */ - phy_cfg_cmd.phy_cfg = cpu_to_le32(mvm->fw->phy_config); - phy_cfg_cmd.calib_control.event_trigger = - mvm->fw->default_calib[ucode_type].event_trigger; - phy_cfg_cmd.calib_control.flow_trigger = - mvm->fw->default_calib[ucode_type].flow_trigger; - - IWL_DEBUG_INFO(mvm, "Sending Phy CFG command: 0x%x\n", - phy_cfg_cmd.phy_cfg); - - return iwl_mvm_send_cmd_pdu(mvm, PHY_CONFIGURATION_CMD, CMD_SYNC, - sizeof(phy_cfg_cmd), &phy_cfg_cmd); -} - -static int iwl_set_default_calibrations(struct iwl_mvm *mvm) -{ - u8 cmd_raw[16]; /* holds the variable size commands */ - struct iwl_set_calib_default_cmd *cmd = - (struct iwl_set_calib_default_cmd *)cmd_raw; - int ret, i; - - /* Setting default values for calibrations we don't run */ - for (i = 0; i < ARRAY_SIZE(wkp_calib_default_data); i++) { - u16 cmd_len; - - if (wkp_calib_default_data[i].size == 0) - continue; - - memset(cmd_raw, 0, sizeof(cmd_raw)); - cmd_len = wkp_calib_default_data[i].size + sizeof(cmd); - cmd->calib_index = cpu_to_le16(i); - cmd->length = cpu_to_le16(wkp_calib_default_data[i].size); - if (WARN_ONCE(cmd_len > sizeof(cmd_raw), - "Need to enlarge cmd_raw to %d\n", cmd_len)) - break; - memcpy(cmd->data, wkp_calib_default_data[i].data, - wkp_calib_default_data[i].size); - ret = iwl_mvm_send_cmd_pdu(mvm, SET_CALIB_DEFAULT_CMD, 0, - sizeof(*cmd) + - wkp_calib_default_data[i].size, - cmd); - if (ret) - return ret; - } - - return 0; -} - -int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) -{ - struct iwl_notification_wait calib_wait; - static const u8 init_complete[] = { - INIT_COMPLETE_NOTIF, - CALIB_RES_NOTIF_PHY_DB - }; - int ret; - - lockdep_assert_held(&mvm->mutex); - - if (mvm->init_ucode_run) - return 0; - - iwl_init_notification_wait(&mvm->notif_wait, - &calib_wait, - init_complete, - ARRAY_SIZE(init_complete), - iwl_wait_phy_db_entry, - mvm->phy_db); - - /* Will also start the device */ - ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_INIT); - if (ret) { - IWL_ERR(mvm, "Failed to start INIT ucode: %d\n", ret); - goto error; - } - - ret = iwl_send_bt_prio_tbl(mvm); - if (ret) - goto error; - - if (read_nvm) { - /* Read nvm */ - ret = iwl_nvm_init(mvm); - if (ret) { - IWL_ERR(mvm, "Failed to read NVM: %d\n", ret); - goto error; - } - } - - ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans); - WARN_ON(ret); - - /* Send TX valid antennas before triggering calibrations */ - ret = iwl_send_tx_ant_cfg(mvm, iwl_fw_valid_tx_ant(mvm->fw)); - if (ret) - goto error; - - /* need to set default values */ - ret = iwl_set_default_calibrations(mvm); - if (ret) - goto error; - - /* - * Send phy configurations command to init uCode - * to start the 16.0 uCode init image internal calibrations. - */ - ret = iwl_send_phy_cfg_cmd(mvm); - if (ret) { - IWL_ERR(mvm, "Failed to run INIT calibrations: %d\n", - ret); - goto error; - } - - /* - * Some things may run in the background now, but we - * just wait for the calibration complete notification. - */ - ret = iwl_wait_notification(&mvm->notif_wait, &calib_wait, - MVM_UCODE_CALIB_TIMEOUT); - if (!ret) - mvm->init_ucode_run = true; - goto out; - -error: - iwl_remove_notification(&mvm->notif_wait, &calib_wait); -out: - if (!iwlmvm_mod_params.init_dbg) { - iwl_trans_stop_device(mvm->trans); - } else if (!mvm->nvm_data) { - /* we want to debug INIT and we have no NVM - fake */ - mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) + - sizeof(struct ieee80211_channel) + - sizeof(struct ieee80211_rate), - GFP_KERNEL); - if (!mvm->nvm_data) - return -ENOMEM; - mvm->nvm_data->valid_rx_ant = 1; - mvm->nvm_data->valid_tx_ant = 1; - mvm->nvm_data->bands[0].channels = mvm->nvm_data->channels; - mvm->nvm_data->bands[0].n_channels = 1; - mvm->nvm_data->bands[0].n_bitrates = 1; - mvm->nvm_data->bands[0].bitrates = - (void *)mvm->nvm_data->channels + 1; - mvm->nvm_data->bands[0].bitrates->hw_value = 10; - } - - return ret; -} - -#define UCODE_CALIB_TIMEOUT (2*HZ) - -int iwl_mvm_up(struct iwl_mvm *mvm) -{ - int ret, i; - - lockdep_assert_held(&mvm->mutex); - - ret = iwl_trans_start_hw(mvm->trans); - if (ret) - return ret; - - /* If we were in RFKILL during module loading, load init ucode now */ - if (!mvm->init_ucode_run) { - ret = iwl_run_init_mvm_ucode(mvm, false); - if (ret && !iwlmvm_mod_params.init_dbg) { - IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret); - goto error; - } - } - - if (iwlmvm_mod_params.init_dbg) - return 0; - - ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR); - if (ret) { - IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret); - goto error; - } - - ret = iwl_send_tx_ant_cfg(mvm, iwl_fw_valid_tx_ant(mvm->fw)); - if (ret) - goto error; - - ret = iwl_send_bt_prio_tbl(mvm); - if (ret) - goto error; - - ret = iwl_send_bt_init_conf(mvm); - if (ret) - goto error; - - /* Send phy db control command and then phy db calibration*/ - ret = iwl_send_phy_db_data(mvm->phy_db); - if (ret) - goto error; - - ret = iwl_send_phy_cfg_cmd(mvm); - if (ret) - goto error; - - /* init the fw <-> mac80211 STA mapping */ - for (i = 0; i < IWL_MVM_STATION_COUNT; i++) - RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL); - - /* Add auxiliary station for scanning */ - ret = iwl_mvm_add_aux_sta(mvm); - if (ret) - goto error; - - IWL_DEBUG_INFO(mvm, "RT uCode started.\n"); - - return 0; - error: - iwl_trans_stop_device(mvm->trans); - return ret; -} - -int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm) -{ - int ret, i; - - lockdep_assert_held(&mvm->mutex); - - ret = iwl_trans_start_hw(mvm->trans); - if (ret) - return ret; - - ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_WOWLAN); - if (ret) { - IWL_ERR(mvm, "Failed to start WoWLAN firmware: %d\n", ret); - goto error; - } - - ret = iwl_send_tx_ant_cfg(mvm, iwl_fw_valid_tx_ant(mvm->fw)); - if (ret) - goto error; - - /* Send phy db control command and then phy db calibration*/ - ret = iwl_send_phy_db_data(mvm->phy_db); - if (ret) - goto error; - - ret = iwl_send_phy_cfg_cmd(mvm); - if (ret) - goto error; - - /* init the fw <-> mac80211 STA mapping */ - for (i = 0; i < IWL_MVM_STATION_COUNT; i++) - RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL); - - /* Add auxiliary station for scanning */ - ret = iwl_mvm_add_aux_sta(mvm); - if (ret) - goto error; - - return 0; - error: - iwl_trans_stop_device(mvm->trans); - return ret; -} - -int iwl_mvm_rx_card_state_notif(struct iwl_mvm *mvm, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_card_state_notif *card_state_notif = (void *)pkt->data; - u32 flags = le32_to_cpu(card_state_notif->flags); - - IWL_DEBUG_RF_KILL(mvm, "Card state received: HW:%s SW:%s CT:%s\n", - (flags & HW_CARD_DISABLED) ? "Kill" : "On", - (flags & SW_CARD_DISABLED) ? "Kill" : "On", - (flags & CT_KILL_CARD_DISABLED) ? - "Reached" : "Not reached"); - - return 0; -} - -int iwl_mvm_rx_radio_ver(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_radio_version_notif *radio_version = (void *)pkt->data; - - /* TODO: what to do with that? */ - IWL_DEBUG_INFO(mvm, - "Radio version: flavor: 0x%08x, step 0x%08x, dash 0x%08x\n", - le32_to_cpu(radio_version->radio_flavor), - le32_to_cpu(radio_version->radio_step), - le32_to_cpu(radio_version->radio_dash)); - return 0; -} diff --git a/drivers/net/wireless/iwlwifi/mvm/led.c b/drivers/net/wireless/iwlwifi/mvm/led.c deleted file mode 100644 index 2269a9e5cc67..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/led.c +++ /dev/null @@ -1,134 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#include -#include "iwl-io.h" -#include "iwl-csr.h" -#include "mvm.h" - -/* Set led register on */ -static void iwl_mvm_led_enable(struct iwl_mvm *mvm) -{ - iwl_write32(mvm->trans, CSR_LED_REG, CSR_LED_REG_TURN_ON); -} - -/* Set led register off */ -static void iwl_mvm_led_disable(struct iwl_mvm *mvm) -{ - iwl_write32(mvm->trans, CSR_LED_REG, CSR_LED_REG_TURN_OFF); -} - -static void iwl_led_brightness_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct iwl_mvm *mvm = container_of(led_cdev, struct iwl_mvm, led); - if (brightness > 0) - iwl_mvm_led_enable(mvm); - else - iwl_mvm_led_disable(mvm); -} - -int iwl_mvm_leds_init(struct iwl_mvm *mvm) -{ - int mode = iwlwifi_mod_params.led_mode; - int ret; - - switch (mode) { - case IWL_LED_DEFAULT: - case IWL_LED_RF_STATE: - mode = IWL_LED_RF_STATE; - break; - case IWL_LED_DISABLE: - IWL_INFO(mvm, "Led disabled\n"); - return 0; - default: - return -EINVAL; - }; - - mvm->led.name = kasprintf(GFP_KERNEL, "%s-led", - wiphy_name(mvm->hw->wiphy)); - mvm->led.brightness_set = iwl_led_brightness_set; - mvm->led.max_brightness = 1; - - if (mode == IWL_LED_RF_STATE) - mvm->led.default_trigger = - ieee80211_get_radio_led_name(mvm->hw); - - ret = led_classdev_register(mvm->trans->dev, &mvm->led); - if (ret) { - kfree(mvm->led.name); - IWL_INFO(mvm, "Failed to enable led\n"); - return ret; - } - - return 0; -} - -void iwl_mvm_leds_exit(struct iwl_mvm *mvm) -{ - if (iwlwifi_mod_params.led_mode == IWL_LED_DISABLE) - return; - - led_classdev_unregister(&mvm->led); - kfree(mvm->led.name); -} diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c deleted file mode 100644 index d8e858cc8dd9..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +++ /dev/null @@ -1,1050 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#include -#include -#include "iwl-io.h" -#include "iwl-prph.h" -#include "fw-api.h" -#include "mvm.h" - -const u8 iwl_mvm_ac_to_tx_fifo[] = { - IWL_MVM_TX_FIFO_BK, - IWL_MVM_TX_FIFO_BE, - IWL_MVM_TX_FIFO_VI, - IWL_MVM_TX_FIFO_VO, -}; - -struct iwl_mvm_mac_iface_iterator_data { - struct iwl_mvm *mvm; - struct ieee80211_vif *vif; - unsigned long available_mac_ids[BITS_TO_LONGS(NUM_MAC_INDEX_DRIVER)]; - unsigned long available_tsf_ids[BITS_TO_LONGS(NUM_TSF_IDS)]; - unsigned long used_hw_queues[BITS_TO_LONGS(IWL_MVM_FIRST_AGG_QUEUE)]; - enum iwl_tsf_id preferred_tsf; - bool found_vif; -}; - -static void iwl_mvm_mac_iface_iterator(void *_data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct iwl_mvm_mac_iface_iterator_data *data = _data; - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - u32 ac; - - /* Iterator may already find the interface being added -- skip it */ - if (vif == data->vif) { - data->found_vif = true; - return; - } - - /* Mark the queues used by the vif */ - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) - if (vif->hw_queue[ac] != IEEE80211_INVAL_HW_QUEUE) - __set_bit(vif->hw_queue[ac], data->used_hw_queues); - - if (vif->cab_queue != IEEE80211_INVAL_HW_QUEUE) - __set_bit(vif->cab_queue, data->used_hw_queues); - - /* - * Mark MAC IDs as used by clearing the available bit, and - * (below) mark TSFs as used if their existing use is not - * compatible with the new interface type. - * No locking or atomic bit operations are needed since the - * data is on the stack of the caller function. - */ - __clear_bit(mvmvif->id, data->available_mac_ids); - - /* - * The TSF is a hardware/firmware resource, there are 4 and - * the driver should assign and free them as needed. However, - * there are cases where 2 MACs should share the same TSF ID - * for the purpose of clock sync, an optimization to avoid - * clock drift causing overlapping TBTTs/DTIMs for a GO and - * client in the system. - * - * The firmware will decide according to the MAC type which - * will be the master and slave. Clients that need to sync - * with a remote station will be the master, and an AP or GO - * will be the slave. - * - * Depending on the new interface type it can be slaved to - * or become the master of an existing interface. - */ - switch (data->vif->type) { - case NL80211_IFTYPE_STATION: - /* - * The new interface is client, so if the existing one - * we're iterating is an AP, the TSF should be used to - * avoid drift between the new client and existing AP, - * the existing AP will get drift updates from the new - * client context in this case - */ - if (vif->type == NL80211_IFTYPE_AP) { - if (data->preferred_tsf == NUM_TSF_IDS && - test_bit(mvmvif->tsf_id, data->available_tsf_ids)) - data->preferred_tsf = mvmvif->tsf_id; - return; - } - break; - case NL80211_IFTYPE_AP: - /* - * The new interface is AP/GO, so should get drift - * updates from an existing client or use the same - * TSF as an existing GO. There's no drift between - * TSFs internally but if they used different TSFs - * then a new client MAC could update one of them - * and cause drift that way. - */ - if (vif->type == NL80211_IFTYPE_STATION || - vif->type == NL80211_IFTYPE_AP) { - if (data->preferred_tsf == NUM_TSF_IDS && - test_bit(mvmvif->tsf_id, data->available_tsf_ids)) - data->preferred_tsf = mvmvif->tsf_id; - return; - } - break; - default: - /* - * For all other interface types there's no need to - * take drift into account. Either they're exclusive - * like IBSS and monitor, or we don't care much about - * their TSF (like P2P Device), but we won't be able - * to share the TSF resource. - */ - break; - } - - /* - * Unless we exited above, we can't share the TSF resource - * that the virtual interface we're iterating over is using - * with the new one, so clear the available bit and if this - * was the preferred one, reset that as well. - */ - __clear_bit(mvmvif->tsf_id, data->available_tsf_ids); - - if (data->preferred_tsf == mvmvif->tsf_id) - data->preferred_tsf = NUM_TSF_IDS; -} - -/* - * Get the mask of the queus used by the vif - */ -u32 iwl_mvm_mac_get_queues_mask(struct iwl_mvm *mvm, - struct ieee80211_vif *vif) -{ - u32 qmask = 0, ac; - - if (vif->type == NL80211_IFTYPE_P2P_DEVICE) - return BIT(IWL_MVM_OFFCHANNEL_QUEUE); - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) - if (vif->hw_queue[ac] != IEEE80211_INVAL_HW_QUEUE) - qmask |= BIT(vif->hw_queue[ac]); - - return qmask; -} - -static int iwl_mvm_mac_ctxt_allocate_resources(struct iwl_mvm *mvm, - struct ieee80211_vif *vif) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct iwl_mvm_mac_iface_iterator_data data = { - .mvm = mvm, - .vif = vif, - .available_mac_ids = { (1 << NUM_MAC_INDEX_DRIVER) - 1 }, - .available_tsf_ids = { (1 << NUM_TSF_IDS) - 1 }, - /* no preference yet */ - .preferred_tsf = NUM_TSF_IDS, - .used_hw_queues = { - BIT(IWL_MVM_OFFCHANNEL_QUEUE) | - BIT(IWL_MVM_AUX_QUEUE) | - BIT(IWL_MVM_CMD_QUEUE) - }, - .found_vif = false, - }; - u32 ac; - int ret; - - /* - * Allocate a MAC ID and a TSF for this MAC, along with the queues - * and other resources. - */ - - /* - * Before the iterator, we start with all MAC IDs and TSFs available. - * - * During iteration, all MAC IDs are cleared that are in use by other - * virtual interfaces, and all TSF IDs are cleared that can't be used - * by this new virtual interface because they're used by an interface - * that can't share it with the new one. - * At the same time, we check if there's a preferred TSF in the case - * that we should share it with another interface. - */ - - /* Currently, MAC ID 0 should be used only for the managed vif */ - if (vif->type != NL80211_IFTYPE_STATION || vif->p2p) - __clear_bit(0, data.available_mac_ids); - - ieee80211_iterate_active_interfaces_atomic( - mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - iwl_mvm_mac_iface_iterator, &data); - - /* - * In the case we're getting here during resume, it's similar to - * firmware restart, and with RESUME_ALL the iterator will find - * the vif being added already. - * We don't want to reassign any IDs in either case since doing - * so would probably assign different IDs (as interfaces aren't - * necessarily added in the same order), but the old IDs were - * preserved anyway, so skip ID assignment for both resume and - * recovery. - */ - if (data.found_vif) - return 0; - - /* Therefore, in recovery, we can't get here */ - WARN_ON_ONCE(test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)); - - mvmvif->id = find_first_bit(data.available_mac_ids, - NUM_MAC_INDEX_DRIVER); - if (mvmvif->id == NUM_MAC_INDEX_DRIVER) { - IWL_ERR(mvm, "Failed to init MAC context - no free ID!\n"); - ret = -EIO; - goto exit_fail; - } - - if (data.preferred_tsf != NUM_TSF_IDS) - mvmvif->tsf_id = data.preferred_tsf; - else - mvmvif->tsf_id = find_first_bit(data.available_tsf_ids, - NUM_TSF_IDS); - if (mvmvif->tsf_id == NUM_TSF_IDS) { - IWL_ERR(mvm, "Failed to init MAC context - no free TSF!\n"); - ret = -EIO; - goto exit_fail; - } - - mvmvif->color = 0; - - INIT_LIST_HEAD(&mvmvif->time_event_data.list); - mvmvif->time_event_data.id = TE_MAX; - - /* No need to allocate data queues to P2P Device MAC.*/ - if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) - vif->hw_queue[ac] = IEEE80211_INVAL_HW_QUEUE; - - return 0; - } - - /* Find available queues, and allocate them to the ACs */ - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { - u8 queue = find_first_zero_bit(data.used_hw_queues, - IWL_MVM_FIRST_AGG_QUEUE); - - if (queue >= IWL_MVM_FIRST_AGG_QUEUE) { - IWL_ERR(mvm, "Failed to allocate queue\n"); - ret = -EIO; - goto exit_fail; - } - - __set_bit(queue, data.used_hw_queues); - vif->hw_queue[ac] = queue; - } - - /* Allocate the CAB queue for softAP and GO interfaces */ - if (vif->type == NL80211_IFTYPE_AP) { - u8 queue = find_first_zero_bit(data.used_hw_queues, - IWL_MVM_FIRST_AGG_QUEUE); - - if (queue >= IWL_MVM_FIRST_AGG_QUEUE) { - IWL_ERR(mvm, "Failed to allocate cab queue\n"); - ret = -EIO; - goto exit_fail; - } - - vif->cab_queue = queue; - } else { - vif->cab_queue = IEEE80211_INVAL_HW_QUEUE; - } - - mvmvif->bcast_sta.sta_id = IWL_MVM_STATION_COUNT; - mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT; - - return 0; - -exit_fail: - memset(mvmvif, 0, sizeof(struct iwl_mvm_vif)); - memset(vif->hw_queue, IEEE80211_INVAL_HW_QUEUE, sizeof(vif->hw_queue)); - vif->cab_queue = IEEE80211_INVAL_HW_QUEUE; - return ret; -} - -int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif) -{ - u32 ac; - int ret; - - lockdep_assert_held(&mvm->mutex); - - ret = iwl_mvm_mac_ctxt_allocate_resources(mvm, vif); - if (ret) - return ret; - - switch (vif->type) { - case NL80211_IFTYPE_P2P_DEVICE: - iwl_trans_ac_txq_enable(mvm->trans, IWL_MVM_OFFCHANNEL_QUEUE, - IWL_MVM_TX_FIFO_VO); - break; - case NL80211_IFTYPE_AP: - iwl_trans_ac_txq_enable(mvm->trans, vif->cab_queue, - IWL_MVM_TX_FIFO_MCAST); - /* fall through */ - default: - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) - iwl_trans_ac_txq_enable(mvm->trans, vif->hw_queue[ac], - iwl_mvm_ac_to_tx_fifo[ac]); - break; - } - - return 0; -} - -void iwl_mvm_mac_ctxt_release(struct iwl_mvm *mvm, struct ieee80211_vif *vif) -{ - int ac; - - lockdep_assert_held(&mvm->mutex); - - switch (vif->type) { - case NL80211_IFTYPE_P2P_DEVICE: - iwl_trans_txq_disable(mvm->trans, IWL_MVM_OFFCHANNEL_QUEUE); - break; - case NL80211_IFTYPE_AP: - iwl_trans_txq_disable(mvm->trans, vif->cab_queue); - /* fall through */ - default: - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) - iwl_trans_txq_disable(mvm->trans, vif->hw_queue[ac]); - } -} - -static void iwl_mvm_ack_rates(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - enum ieee80211_band band, - u8 *cck_rates, u8 *ofdm_rates) -{ - struct ieee80211_supported_band *sband; - unsigned long basic = vif->bss_conf.basic_rates; - int lowest_present_ofdm = 100; - int lowest_present_cck = 100; - u8 cck = 0; - u8 ofdm = 0; - int i; - - sband = mvm->hw->wiphy->bands[band]; - - for_each_set_bit(i, &basic, BITS_PER_LONG) { - int hw = sband->bitrates[i].hw_value; - if (hw >= IWL_FIRST_OFDM_RATE) { - ofdm |= BIT(hw - IWL_FIRST_OFDM_RATE); - if (lowest_present_ofdm > hw) - lowest_present_ofdm = hw; - } else { - BUILD_BUG_ON(IWL_FIRST_CCK_RATE != 0); - - cck |= BIT(hw); - if (lowest_present_cck > hw) - lowest_present_cck = hw; - } - } - - /* - * Now we've got the basic rates as bitmaps in the ofdm and cck - * variables. This isn't sufficient though, as there might not - * be all the right rates in the bitmap. E.g. if the only basic - * rates are 5.5 Mbps and 11 Mbps, we still need to add 1 Mbps - * and 6 Mbps because the 802.11-2007 standard says in 9.6: - * - * [...] a STA responding to a received frame shall transmit - * its Control Response frame [...] at the highest rate in the - * BSSBasicRateSet parameter that is less than or equal to the - * rate of the immediately previous frame in the frame exchange - * sequence ([...]) and that is of the same modulation class - * ([...]) as the received frame. If no rate contained in the - * BSSBasicRateSet parameter meets these conditions, then the - * control frame sent in response to a received frame shall be - * transmitted at the highest mandatory rate of the PHY that is - * less than or equal to the rate of the received frame, and - * that is of the same modulation class as the received frame. - * - * As a consequence, we need to add all mandatory rates that are - * lower than all of the basic rates to these bitmaps. - */ - - if (IWL_RATE_24M_INDEX < lowest_present_ofdm) - ofdm |= IWL_RATE_BIT_MSK(24) >> IWL_FIRST_OFDM_RATE; - if (IWL_RATE_12M_INDEX < lowest_present_ofdm) - ofdm |= IWL_RATE_BIT_MSK(12) >> IWL_FIRST_OFDM_RATE; - /* 6M already there or needed so always add */ - ofdm |= IWL_RATE_BIT_MSK(6) >> IWL_FIRST_OFDM_RATE; - - /* - * CCK is a bit more complex with DSSS vs. HR/DSSS vs. ERP. - * Note, however: - * - if no CCK rates are basic, it must be ERP since there must - * be some basic rates at all, so they're OFDM => ERP PHY - * (or we're in 5 GHz, and the cck bitmap will never be used) - * - if 11M is a basic rate, it must be ERP as well, so add 5.5M - * - if 5.5M is basic, 1M and 2M are mandatory - * - if 2M is basic, 1M is mandatory - * - if 1M is basic, that's the only valid ACK rate. - * As a consequence, it's not as complicated as it sounds, just add - * any lower rates to the ACK rate bitmap. - */ - if (IWL_RATE_11M_INDEX < lowest_present_cck) - cck |= IWL_RATE_BIT_MSK(11) >> IWL_FIRST_CCK_RATE; - if (IWL_RATE_5M_INDEX < lowest_present_cck) - cck |= IWL_RATE_BIT_MSK(5) >> IWL_FIRST_CCK_RATE; - if (IWL_RATE_2M_INDEX < lowest_present_cck) - cck |= IWL_RATE_BIT_MSK(2) >> IWL_FIRST_CCK_RATE; - /* 1M already there or needed so always add */ - cck |= IWL_RATE_BIT_MSK(1) >> IWL_FIRST_CCK_RATE; - - *cck_rates = cck; - *ofdm_rates = ofdm; -} - -static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct iwl_mac_ctx_cmd *cmd, - u32 action) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct ieee80211_chanctx_conf *chanctx; - u8 cck_ack_rates, ofdm_ack_rates; - int i; - - cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, - mvmvif->color)); - cmd->action = cpu_to_le32(action); - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - if (vif->p2p) - cmd->mac_type = cpu_to_le32(FW_MAC_TYPE_P2P_STA); - else - cmd->mac_type = cpu_to_le32(FW_MAC_TYPE_BSS_STA); - break; - case NL80211_IFTYPE_AP: - cmd->mac_type = cpu_to_le32(FW_MAC_TYPE_GO); - break; - case NL80211_IFTYPE_MONITOR: - cmd->mac_type = cpu_to_le32(FW_MAC_TYPE_LISTENER); - break; - case NL80211_IFTYPE_P2P_DEVICE: - cmd->mac_type = cpu_to_le32(FW_MAC_TYPE_P2P_DEVICE); - break; - case NL80211_IFTYPE_ADHOC: - cmd->mac_type = cpu_to_le32(FW_MAC_TYPE_IBSS); - break; - default: - WARN_ON_ONCE(1); - } - - cmd->tsf_id = cpu_to_le32(mvmvif->tsf_id); - - memcpy(cmd->node_addr, vif->addr, ETH_ALEN); - if (vif->bss_conf.bssid) - memcpy(cmd->bssid_addr, vif->bss_conf.bssid, ETH_ALEN); - else - eth_broadcast_addr(cmd->bssid_addr); - - rcu_read_lock(); - chanctx = rcu_dereference(vif->chanctx_conf); - iwl_mvm_ack_rates(mvm, vif, chanctx ? chanctx->def.chan->band - : IEEE80211_BAND_2GHZ, - &cck_ack_rates, &ofdm_ack_rates); - rcu_read_unlock(); - - cmd->cck_rates = cpu_to_le32((u32)cck_ack_rates); - cmd->ofdm_rates = cpu_to_le32((u32)ofdm_ack_rates); - - cmd->cck_short_preamble = - cpu_to_le32(vif->bss_conf.use_short_preamble ? - MAC_FLG_SHORT_PREAMBLE : 0); - cmd->short_slot = - cpu_to_le32(vif->bss_conf.use_short_slot ? - MAC_FLG_SHORT_SLOT : 0); - - for (i = 0; i < AC_NUM; i++) { - cmd->ac[i].cw_min = cpu_to_le16(mvmvif->queue_params[i].cw_min); - cmd->ac[i].cw_max = cpu_to_le16(mvmvif->queue_params[i].cw_max); - cmd->ac[i].aifsn = mvmvif->queue_params[i].aifs; - cmd->ac[i].edca_txop = - cpu_to_le16(mvmvif->queue_params[i].txop * 32); - cmd->ac[i].fifos_mask = BIT(iwl_mvm_ac_to_tx_fifo[i]); - } - - /* in AP mode, the MCAST FIFO takes the EDCA params from VO */ - if (vif->type == NL80211_IFTYPE_AP) - cmd->ac[AC_VO].fifos_mask |= BIT(IWL_MVM_TX_FIFO_MCAST); - - if (vif->bss_conf.qos) - cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA); - - /* Don't use cts to self as the fw doesn't support it currently. */ - if (vif->bss_conf.use_cts_prot) - cmd->protection_flags |= cpu_to_le32(MAC_PROT_FLG_TGG_PROTECT); - - /* - * I think that we should enable these 2 flags regardless the HT PROT - * fields in the HT IE, but I am not sure. Someone knows whom to ask?... - */ - if (vif->bss_conf.chandef.width != NL80211_CHAN_WIDTH_20_NOHT) { - cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_TGN); - cmd->protection_flags |= cpu_to_le32(MAC_PROT_FLG_HT_PROT | - MAC_PROT_FLG_FAT_PROT); - } - - cmd->filter_flags = cpu_to_le32(MAC_FILTER_ACCEPT_GRP); -} - -static int iwl_mvm_mac_ctxt_send_cmd(struct iwl_mvm *mvm, - struct iwl_mac_ctx_cmd *cmd) -{ - int ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, CMD_SYNC, - sizeof(*cmd), cmd); - if (ret) - IWL_ERR(mvm, "Failed to send MAC context (action:%d): %d\n", - le32_to_cpu(cmd->action), ret); - return ret; -} - -/* - * Fill the specific data for mac context of type station or p2p client - */ -static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct iwl_mac_data_sta *ctxt_sta, - bool force_assoc_off) -{ - /* We need the dtim_period to set the MAC as associated */ - if (vif->bss_conf.assoc && vif->bss_conf.dtim_period && - !force_assoc_off) { - u32 dtim_offs; - - /* - * The DTIM count counts down, so when it is N that means N - * more beacon intervals happen until the DTIM TBTT. Therefore - * add this to the current time. If that ends up being in the - * future, the firmware will handle it. - * - * Also note that the system_timestamp (which we get here as - * "sync_device_ts") and TSF timestamp aren't at exactly the - * same offset in the frame -- the TSF is at the first symbol - * of the TSF, the system timestamp is at signal acquisition - * time. This means there's an offset between them of at most - * a few hundred microseconds (24 * 8 bits + PLCP time gives - * 384us in the longest case), this is currently not relevant - * as the firmware wakes up around 2ms before the TBTT. - */ - dtim_offs = vif->bss_conf.sync_dtim_count * - vif->bss_conf.beacon_int; - /* convert TU to usecs */ - dtim_offs *= 1024; - - ctxt_sta->dtim_tsf = - cpu_to_le64(vif->bss_conf.sync_tsf + dtim_offs); - ctxt_sta->dtim_time = - cpu_to_le32(vif->bss_conf.sync_device_ts + dtim_offs); - - IWL_DEBUG_INFO(mvm, "DTIM TBTT is 0x%llx/0x%x, offset %d\n", - le64_to_cpu(ctxt_sta->dtim_tsf), - le32_to_cpu(ctxt_sta->dtim_time), - dtim_offs); - - ctxt_sta->is_assoc = cpu_to_le32(1); - } else { - ctxt_sta->is_assoc = cpu_to_le32(0); - } - - ctxt_sta->bi = cpu_to_le32(vif->bss_conf.beacon_int); - ctxt_sta->bi_reciprocal = - cpu_to_le32(iwl_mvm_reciprocal(vif->bss_conf.beacon_int)); - ctxt_sta->dtim_interval = cpu_to_le32(vif->bss_conf.beacon_int * - vif->bss_conf.dtim_period); - ctxt_sta->dtim_reciprocal = - cpu_to_le32(iwl_mvm_reciprocal(vif->bss_conf.beacon_int * - vif->bss_conf.dtim_period)); - - ctxt_sta->listen_interval = cpu_to_le32(mvm->hw->conf.listen_interval); - ctxt_sta->assoc_id = cpu_to_le32(vif->bss_conf.aid); -} - -static int iwl_mvm_mac_ctxt_cmd_station(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - u32 action) -{ - struct iwl_mac_ctx_cmd cmd = {}; - - WARN_ON(vif->type != NL80211_IFTYPE_STATION || vif->p2p); - - /* Fill the common data for all mac context types */ - iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); - - /* Allow beacons to pass through as long as we are not associated,or we - * do not have dtim period information */ - if (!vif->bss_conf.assoc || !vif->bss_conf.dtim_period) - cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON); - else - cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON); - - /* Fill the data specific for station mode */ - iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.sta, - action == FW_CTXT_ACTION_ADD); - - return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); -} - -static int iwl_mvm_mac_ctxt_cmd_p2p_client(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - u32 action) -{ - struct iwl_mac_ctx_cmd cmd = {}; - struct ieee80211_p2p_noa_attr *noa = &vif->bss_conf.p2p_noa_attr; - - WARN_ON(vif->type != NL80211_IFTYPE_STATION || !vif->p2p); - - /* Fill the common data for all mac context types */ - iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); - - /* Fill the data specific for station mode */ - iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta, - action == FW_CTXT_ACTION_ADD); - - cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow & - IEEE80211_P2P_OPPPS_CTWINDOW_MASK); - - return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); -} - -static int iwl_mvm_mac_ctxt_cmd_listener(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - u32 action) -{ - struct iwl_mac_ctx_cmd cmd = {}; - - WARN_ON(vif->type != NL80211_IFTYPE_MONITOR); - - iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); - - cmd.filter_flags = cpu_to_le32(MAC_FILTER_IN_PROMISC | - MAC_FILTER_IN_CONTROL_AND_MGMT | - MAC_FILTER_IN_BEACON | - MAC_FILTER_IN_PROBE_REQUEST); - - return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); -} - -struct iwl_mvm_go_iterator_data { - bool go_active; -}; - -static void iwl_mvm_go_iterator(void *_data, u8 *mac, struct ieee80211_vif *vif) -{ - struct iwl_mvm_go_iterator_data *data = _data; - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - if (vif->type == NL80211_IFTYPE_AP && vif->p2p && mvmvif->ap_active) - data->go_active = true; -} - -static int iwl_mvm_mac_ctxt_cmd_p2p_device(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - u32 action) -{ - struct iwl_mac_ctx_cmd cmd = {}; - struct iwl_mvm_go_iterator_data data = {}; - - WARN_ON(vif->type != NL80211_IFTYPE_P2P_DEVICE); - - iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); - - cmd.protection_flags |= cpu_to_le32(MAC_PROT_FLG_TGG_PROTECT); - - /* Override the filter flags to accept only probe requests */ - cmd.filter_flags = cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST); - - /* - * This flag should be set to true when the P2P Device is - * discoverable and there is at least another active P2P GO. Settings - * this flag will allow the P2P Device to be discoverable on other - * channels in addition to its listen channel. - * Note that this flag should not be set in other cases as it opens the - * Rx filters on all MAC and increases the number of interrupts. - */ - ieee80211_iterate_active_interfaces_atomic( - mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - iwl_mvm_go_iterator, &data); - - cmd.p2p_dev.is_disc_extended = cpu_to_le32(data.go_active ? 1 : 0); - return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); -} - -static void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm, - struct iwl_mac_beacon_cmd *beacon_cmd, - u8 *beacon, u32 frame_size) -{ - u32 tim_idx; - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)beacon; - - /* The index is relative to frame start but we start looking at the - * variable-length part of the beacon. */ - tim_idx = mgmt->u.beacon.variable - beacon; - - /* Parse variable-length elements of beacon to find WLAN_EID_TIM */ - while ((tim_idx < (frame_size - 2)) && - (beacon[tim_idx] != WLAN_EID_TIM)) - tim_idx += beacon[tim_idx+1] + 2; - - /* If TIM field was found, set variables */ - if ((tim_idx < (frame_size - 1)) && (beacon[tim_idx] == WLAN_EID_TIM)) { - beacon_cmd->tim_idx = cpu_to_le32(tim_idx); - beacon_cmd->tim_size = cpu_to_le32((u32)beacon[tim_idx+1]); - } else { - IWL_WARN(mvm, "Unable to find TIM Element in beacon\n"); - } -} - -static int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct sk_buff *beacon) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct iwl_host_cmd cmd = { - .id = BEACON_TEMPLATE_CMD, - .flags = CMD_ASYNC, - }; - struct iwl_mac_beacon_cmd beacon_cmd = {}; - struct ieee80211_tx_info *info; - u32 beacon_skb_len; - u32 rate; - - if (WARN_ON(!beacon)) - return -EINVAL; - - beacon_skb_len = beacon->len; - - /* TODO: for now the beacon template id is set to be the mac context id. - * Might be better to handle it as another resource ... */ - beacon_cmd.template_id = cpu_to_le32((u32)mvmvif->id); - - /* Set up TX command fields */ - beacon_cmd.tx.len = cpu_to_le16((u16)beacon_skb_len); - beacon_cmd.tx.sta_id = mvmvif->bcast_sta.sta_id; - beacon_cmd.tx.life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE); - beacon_cmd.tx.tx_flags = cpu_to_le32(TX_CMD_FLG_SEQ_CTL | - TX_CMD_FLG_BT_DIS | - TX_CMD_FLG_TSF); - - mvm->mgmt_last_antenna_idx = - iwl_mvm_next_antenna(mvm, iwl_fw_valid_tx_ant(mvm->fw), - mvm->mgmt_last_antenna_idx); - - beacon_cmd.tx.rate_n_flags = - cpu_to_le32(BIT(mvm->mgmt_last_antenna_idx) << - RATE_MCS_ANT_POS); - - info = IEEE80211_SKB_CB(beacon); - - if (info->band == IEEE80211_BAND_5GHZ || vif->p2p) { - rate = IWL_FIRST_OFDM_RATE; - } else { - rate = IWL_FIRST_CCK_RATE; - beacon_cmd.tx.rate_n_flags |= cpu_to_le32(RATE_MCS_CCK_MSK); - } - beacon_cmd.tx.rate_n_flags |= - cpu_to_le32(iwl_mvm_mac80211_idx_to_hwrate(rate)); - - /* Set up TX beacon command fields */ - iwl_mvm_mac_ctxt_set_tim(mvm, &beacon_cmd, - beacon->data, - beacon_skb_len); - - /* Submit command */ - cmd.len[0] = sizeof(beacon_cmd); - cmd.data[0] = &beacon_cmd; - cmd.dataflags[0] = 0; - cmd.len[1] = beacon_skb_len; - cmd.data[1] = beacon->data; - cmd.dataflags[1] = IWL_HCMD_DFL_DUP; - - return iwl_mvm_send_cmd(mvm, &cmd); -} - -/* The beacon template for the AP/GO context has changed and needs update */ -int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm, - struct ieee80211_vif *vif) -{ - struct sk_buff *beacon; - int ret; - - WARN_ON(vif->type != NL80211_IFTYPE_AP); - - beacon = ieee80211_beacon_get(mvm->hw, vif); - if (!beacon) - return -ENOMEM; - - ret = iwl_mvm_mac_ctxt_send_beacon(mvm, vif, beacon); - dev_kfree_skb(beacon); - return ret; -} - -/* - * Fill the specific data for mac context of type AP of P2P GO - */ -static void iwl_mvm_mac_ctxt_cmd_fill_ap(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct iwl_mac_data_ap *ctxt_ap, - bool add) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - ctxt_ap->bi = cpu_to_le32(vif->bss_conf.beacon_int); - ctxt_ap->bi_reciprocal = - cpu_to_le32(iwl_mvm_reciprocal(vif->bss_conf.beacon_int)); - ctxt_ap->dtim_interval = cpu_to_le32(vif->bss_conf.beacon_int * - vif->bss_conf.dtim_period); - ctxt_ap->dtim_reciprocal = - cpu_to_le32(iwl_mvm_reciprocal(vif->bss_conf.beacon_int * - vif->bss_conf.dtim_period)); - - ctxt_ap->mcast_qid = cpu_to_le32(vif->cab_queue); - - /* - * Only read the system time when the MAC is being added, when we - * just modify the MAC then we should keep the time -- the firmware - * can otherwise have a "jumping" TBTT. - */ - if (add) - mvmvif->ap_beacon_time = - iwl_read_prph(mvm->trans, DEVICE_SYSTEM_TIME_REG); - - ctxt_ap->beacon_time = cpu_to_le32(mvmvif->ap_beacon_time); - - ctxt_ap->beacon_tsf = 0; /* unused */ - - /* TODO: Assume that the beacon id == mac context id */ - ctxt_ap->beacon_template = cpu_to_le32(mvmvif->id); -} - -static int iwl_mvm_mac_ctxt_cmd_ap(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - u32 action) -{ - struct iwl_mac_ctx_cmd cmd = {}; - - WARN_ON(vif->type != NL80211_IFTYPE_AP || vif->p2p); - - /* Fill the common data for all mac context types */ - iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); - - /* Also enable probe requests to pass */ - cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST); - - /* Fill the data specific for ap mode */ - iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.ap, - action == FW_CTXT_ACTION_ADD); - - return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); -} - -static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - u32 action) -{ - struct iwl_mac_ctx_cmd cmd = {}; - struct ieee80211_p2p_noa_attr *noa = &vif->bss_conf.p2p_noa_attr; - - WARN_ON(vif->type != NL80211_IFTYPE_AP || !vif->p2p); - - /* Fill the common data for all mac context types */ - iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); - - /* Fill the data specific for GO mode */ - iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.go.ap, - action == FW_CTXT_ACTION_ADD); - - cmd.go.ctwin = cpu_to_le32(noa->oppps_ctwindow & - IEEE80211_P2P_OPPPS_CTWINDOW_MASK); - cmd.go.opp_ps_enabled = - cpu_to_le32(!!(noa->oppps_ctwindow & - IEEE80211_P2P_OPPPS_ENABLE_BIT)); - - return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); -} - -static int iwl_mvm_mac_ctx_send(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - u32 action) -{ - switch (vif->type) { - case NL80211_IFTYPE_STATION: - if (!vif->p2p) - return iwl_mvm_mac_ctxt_cmd_station(mvm, vif, - action); - else - return iwl_mvm_mac_ctxt_cmd_p2p_client(mvm, vif, - action); - break; - case NL80211_IFTYPE_AP: - if (!vif->p2p) - return iwl_mvm_mac_ctxt_cmd_ap(mvm, vif, action); - else - return iwl_mvm_mac_ctxt_cmd_go(mvm, vif, action); - break; - case NL80211_IFTYPE_MONITOR: - return iwl_mvm_mac_ctxt_cmd_listener(mvm, vif, action); - case NL80211_IFTYPE_P2P_DEVICE: - return iwl_mvm_mac_ctxt_cmd_p2p_device(mvm, vif, action); - default: - break; - } - - return -EOPNOTSUPP; -} - -int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - int ret; - - if (WARN_ONCE(mvmvif->uploaded, "Adding active MAC %pM/%d\n", - vif->addr, ieee80211_vif_type_p2p(vif))) - return -EIO; - - ret = iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_ADD); - if (ret) - return ret; - - mvmvif->uploaded = true; - return 0; -} - -int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - if (WARN_ONCE(!mvmvif->uploaded, "Changing inactive MAC %pM/%d\n", - vif->addr, ieee80211_vif_type_p2p(vif))) - return -EIO; - - return iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_MODIFY); -} - -int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct iwl_mac_ctx_cmd cmd; - int ret; - - if (WARN_ONCE(!mvmvif->uploaded, "Removing inactive MAC %pM/%d\n", - vif->addr, ieee80211_vif_type_p2p(vif))) - return -EIO; - - memset(&cmd, 0, sizeof(cmd)); - - cmd.id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, - mvmvif->color)); - cmd.action = cpu_to_le32(FW_CTXT_ACTION_REMOVE); - - ret = iwl_mvm_send_cmd_pdu(mvm, MAC_CONTEXT_CMD, CMD_SYNC, - sizeof(cmd), &cmd); - if (ret) { - IWL_ERR(mvm, "Failed to remove MAC context: %d\n", ret); - return ret; - } - - mvmvif->uploaded = false; - return 0; -} - -int iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_beacon_notif *beacon = (void *)pkt->data; - u16 status __maybe_unused = - le16_to_cpu(beacon->beacon_notify_hdr.status.status); - u32 rate __maybe_unused = - le32_to_cpu(beacon->beacon_notify_hdr.initial_rate); - - IWL_DEBUG_RX(mvm, "beacon status %#x retries:%d tsf:0x%16llX rate:%d\n", - status & TX_STATUS_MSK, - beacon->beacon_notify_hdr.failure_frame, - le64_to_cpu(beacon->tsf), - rate); - return 0; -} diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c deleted file mode 100644 index f7545e06ce2a..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ /dev/null @@ -1,1429 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "iwl-op-mode.h" -#include "iwl-io.h" -#include "mvm.h" -#include "sta.h" -#include "time-event.h" -#include "iwl-eeprom-parse.h" -#include "fw-api-scan.h" -#include "iwl-phy-db.h" - -static const struct ieee80211_iface_limit iwl_mvm_limits[] = { - { - .max = 1, - .types = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_AP), - }, - { - .max = 1, - .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_P2P_GO), - }, - { - .max = 1, - .types = BIT(NL80211_IFTYPE_P2P_DEVICE), - }, -}; - -static const struct ieee80211_iface_combination iwl_mvm_iface_combinations[] = { - { - .num_different_channels = 1, - .max_interfaces = 3, - .limits = iwl_mvm_limits, - .n_limits = ARRAY_SIZE(iwl_mvm_limits), - }, -}; - -#ifdef CONFIG_PM_SLEEP -static const struct nl80211_wowlan_tcp_data_token_feature -iwl_mvm_wowlan_tcp_token_feature = { - .min_len = 0, - .max_len = 255, - .bufsize = IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS, -}; - -static const struct wiphy_wowlan_tcp_support iwl_mvm_wowlan_tcp_support = { - .tok = &iwl_mvm_wowlan_tcp_token_feature, - .data_payload_max = IWL_WOWLAN_TCP_MAX_PACKET_LEN - - sizeof(struct ethhdr) - - sizeof(struct iphdr) - - sizeof(struct tcphdr), - .data_interval_max = 65535, /* __le16 in API */ - .wake_payload_max = IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN - - sizeof(struct ethhdr) - - sizeof(struct iphdr) - - sizeof(struct tcphdr), - .seq = true, -}; -#endif - -int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) -{ - struct ieee80211_hw *hw = mvm->hw; - int num_mac, ret, i; - - /* Tell mac80211 our characteristics */ - hw->flags = IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_SPECTRUM_MGMT | - IEEE80211_HW_REPORTS_TX_ACK_STATUS | - IEEE80211_HW_QUEUE_CONTROL | - IEEE80211_HW_WANT_MONITOR_VIF | - IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_SUPPORTS_DYNAMIC_PS | - IEEE80211_HW_AMPDU_AGGREGATION | - IEEE80211_HW_TIMING_BEACON_ONLY; - - hw->queues = IWL_MVM_FIRST_AGG_QUEUE; - hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE; - hw->rate_control_algorithm = "iwl-mvm-rs"; - - /* - * Enable 11w if advertised by firmware and software crypto - * is not enabled (as the firmware will interpret some mgmt - * packets, so enabling it with software crypto isn't safe) - */ - if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_MFP && - !iwlwifi_mod_params.sw_crypto) - hw->flags |= IEEE80211_HW_MFP_CAPABLE; - - hw->sta_data_size = sizeof(struct iwl_mvm_sta); - hw->vif_data_size = sizeof(struct iwl_mvm_vif); - hw->chanctx_data_size = sizeof(struct iwl_mvm_phy_ctxt); - - hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_P2P_GO) | - BIT(NL80211_IFTYPE_P2P_DEVICE); - - hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | - WIPHY_FLAG_DISABLE_BEACON_HINTS | - WIPHY_FLAG_IBSS_RSN; - - hw->wiphy->iface_combinations = iwl_mvm_iface_combinations; - hw->wiphy->n_iface_combinations = - ARRAY_SIZE(iwl_mvm_iface_combinations); - - hw->wiphy->max_remain_on_channel_duration = 10000; - hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; - - /* Extract MAC address */ - memcpy(mvm->addresses[0].addr, mvm->nvm_data->hw_addr, ETH_ALEN); - hw->wiphy->addresses = mvm->addresses; - hw->wiphy->n_addresses = 1; - - /* Extract additional MAC addresses if available */ - num_mac = (mvm->nvm_data->n_hw_addrs > 1) ? - min(IWL_MVM_MAX_ADDRESSES, mvm->nvm_data->n_hw_addrs) : 1; - - for (i = 1; i < num_mac; i++) { - memcpy(mvm->addresses[i].addr, mvm->addresses[i-1].addr, - ETH_ALEN); - mvm->addresses[i].addr[5]++; - hw->wiphy->n_addresses++; - } - - /* we create the 802.11 header and a max-length SSID element */ - hw->wiphy->max_scan_ie_len = - mvm->fw->ucode_capa.max_probe_length - 24 - 34; - hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; - - if (mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels) - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = - &mvm->nvm_data->bands[IEEE80211_BAND_2GHZ]; - if (mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels) - hw->wiphy->bands[IEEE80211_BAND_5GHZ] = - &mvm->nvm_data->bands[IEEE80211_BAND_5GHZ]; - - hw->wiphy->hw_version = mvm->trans->hw_id; - - if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM) - hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; - else - hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; - - hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | - NL80211_FEATURE_P2P_GO_OPPPS; - - mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; - -#ifdef CONFIG_PM_SLEEP - if (mvm->fw->img[IWL_UCODE_WOWLAN].sec[0].len && - mvm->trans->ops->d3_suspend && - mvm->trans->ops->d3_resume && - device_can_wakeup(mvm->trans->dev)) { - hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | - WIPHY_WOWLAN_DISCONNECT | - WIPHY_WOWLAN_EAP_IDENTITY_REQ | - WIPHY_WOWLAN_RFKILL_RELEASE; - if (!iwlwifi_mod_params.sw_crypto) - hw->wiphy->wowlan.flags |= - WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | - WIPHY_WOWLAN_GTK_REKEY_FAILURE | - WIPHY_WOWLAN_4WAY_HANDSHAKE; - - hw->wiphy->wowlan.n_patterns = IWL_WOWLAN_MAX_PATTERNS; - hw->wiphy->wowlan.pattern_min_len = IWL_WOWLAN_MIN_PATTERN_LEN; - hw->wiphy->wowlan.pattern_max_len = IWL_WOWLAN_MAX_PATTERN_LEN; - hw->wiphy->wowlan.tcp = &iwl_mvm_wowlan_tcp_support; - } -#endif - - ret = iwl_mvm_leds_init(mvm); - if (ret) - return ret; - - ret = ieee80211_register_hw(mvm->hw); - if (ret) - iwl_mvm_leds_exit(mvm); - - return ret; -} - -static void iwl_mvm_mac_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - - if (test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status)) { - IWL_DEBUG_DROP(mvm, "Dropping - RF KILL\n"); - goto drop; - } - - if (IEEE80211_SKB_CB(skb)->hw_queue == IWL_MVM_OFFCHANNEL_QUEUE && - !test_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status)) - goto drop; - - if (control->sta) { - if (iwl_mvm_tx_skb(mvm, skb, control->sta)) - goto drop; - return; - } - - if (iwl_mvm_tx_skb_non_sta(mvm, skb)) - goto drop; - return; - drop: - ieee80211_free_txskb(hw, skb); -} - -static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, u16 tid, - u16 *ssn, u8 buf_size) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - int ret; - - IWL_DEBUG_HT(mvm, "A-MPDU action on addr %pM tid %d: action %d\n", - sta->addr, tid, action); - - if (!(mvm->nvm_data->sku_cap_11n_enable)) - return -EACCES; - - mutex_lock(&mvm->mutex); - - switch (action) { - case IEEE80211_AMPDU_RX_START: - if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG) { - ret = -EINVAL; - break; - } - ret = iwl_mvm_sta_rx_agg(mvm, sta, tid, *ssn, true); - break; - case IEEE80211_AMPDU_RX_STOP: - ret = iwl_mvm_sta_rx_agg(mvm, sta, tid, 0, false); - break; - case IEEE80211_AMPDU_TX_START: - if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) { - ret = -EINVAL; - break; - } - ret = iwl_mvm_sta_tx_agg_start(mvm, vif, sta, tid, ssn); - break; - case IEEE80211_AMPDU_TX_STOP_CONT: - ret = iwl_mvm_sta_tx_agg_stop(mvm, vif, sta, tid); - break; - case IEEE80211_AMPDU_TX_STOP_FLUSH: - case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: - ret = iwl_mvm_sta_tx_agg_flush(mvm, vif, sta, tid); - break; - case IEEE80211_AMPDU_TX_OPERATIONAL: - ret = iwl_mvm_sta_tx_agg_oper(mvm, vif, sta, tid, buf_size); - break; - default: - WARN_ON_ONCE(1); - ret = -EINVAL; - break; - } - mutex_unlock(&mvm->mutex); - - return ret; -} - -static void iwl_mvm_cleanup_iterator(void *data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct iwl_mvm *mvm = data; - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - mvmvif->uploaded = false; - mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT; - - /* does this make sense at all? */ - mvmvif->color++; - - spin_lock_bh(&mvm->time_event_lock); - iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data); - spin_unlock_bh(&mvm->time_event_lock); - - if (vif->type != NL80211_IFTYPE_P2P_DEVICE) - mvmvif->phy_ctxt = NULL; -} - -static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) -{ - iwl_trans_stop_device(mvm->trans); - iwl_trans_stop_hw(mvm->trans, false); - - mvm->scan_status = IWL_MVM_SCAN_NONE; - - /* just in case one was running */ - ieee80211_remain_on_channel_expired(mvm->hw); - - ieee80211_iterate_active_interfaces_atomic( - mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - iwl_mvm_cleanup_iterator, mvm); - - memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table)); - memset(mvm->sta_drained, 0, sizeof(mvm->sta_drained)); - - ieee80211_wake_queues(mvm->hw); - - mvm->vif_count = 0; -} - -static int iwl_mvm_mac_start(struct ieee80211_hw *hw) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - int ret; - - mutex_lock(&mvm->mutex); - - /* Clean up some internal and mac80211 state on restart */ - if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) - iwl_mvm_restart_cleanup(mvm); - - ret = iwl_mvm_up(mvm); - mutex_unlock(&mvm->mutex); - - return ret; -} - -static void iwl_mvm_mac_restart_complete(struct ieee80211_hw *hw) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - int ret; - - mutex_lock(&mvm->mutex); - - clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); - ret = iwl_mvm_update_quotas(mvm, NULL); - if (ret) - IWL_ERR(mvm, "Failed to update quotas after restart (%d)\n", - ret); - - mutex_unlock(&mvm->mutex); -} - -static void iwl_mvm_mac_stop(struct ieee80211_hw *hw) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - - flush_work(&mvm->async_handlers_wk); - - mutex_lock(&mvm->mutex); - /* async_handlers_wk is now blocked */ - - /* - * The work item could be running or queued if the - * ROC time event stops just as we get here. - */ - cancel_work_sync(&mvm->roc_done_wk); - - iwl_trans_stop_device(mvm->trans); - iwl_trans_stop_hw(mvm->trans, false); - - iwl_mvm_async_handlers_purge(mvm); - /* async_handlers_list is empty and will stay empty: HW is stopped */ - - /* the fw is stopped, the aux sta is dead: clean up driver state */ - iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta); - - mutex_unlock(&mvm->mutex); - - /* - * The worker might have been waiting for the mutex, let it run and - * discover that its list is now empty. - */ - cancel_work_sync(&mvm->async_handlers_wk); -} - -static void iwl_mvm_pm_disable_iterator(void *data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct iwl_mvm *mvm = data; - int ret; - - ret = iwl_mvm_power_disable(mvm, vif); - if (ret) - IWL_ERR(mvm, "failed to disable power management\n"); -} - -static void iwl_mvm_power_update_iterator(void *data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct iwl_mvm *mvm = data; - - iwl_mvm_power_update_mode(mvm, vif); -} - -static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - int ret; - - /* - * Not much to do here. The stack will not allow interface - * types or combinations that we didn't advertise, so we - * don't really have to check the types. - */ - - mutex_lock(&mvm->mutex); - - /* Allocate resources for the MAC context, and add it the the fw */ - ret = iwl_mvm_mac_ctxt_init(mvm, vif); - if (ret) - goto out_unlock; - - /* - * The AP binding flow can be done only after the beacon - * template is configured (which happens only in the mac80211 - * start_ap() flow), and adding the broadcast station can happen - * only after the binding. - * In addition, since modifying the MAC before adding a bcast - * station is not allowed by the FW, delay the adding of MAC context to - * the point where we can also add the bcast station. - * In short: there's not much we can do at this point, other than - * allocating resources :) - */ - if (vif->type == NL80211_IFTYPE_AP) { - u32 qmask = iwl_mvm_mac_get_queues_mask(mvm, vif); - ret = iwl_mvm_allocate_int_sta(mvm, &mvmvif->bcast_sta, - qmask); - if (ret) { - IWL_ERR(mvm, "Failed to allocate bcast sta\n"); - goto out_release; - } - - goto out_unlock; - } - - /* - * TODO: remove this temporary code. - * Currently MVM FW supports power management only on single MAC. - * If new interface added, disable PM on existing interface. - * P2P device is a special case, since it is handled by FW similary to - * scan. If P2P deviced is added, PM remains enabled on existing - * interface. - * Note: the method below does not count the new interface being added - * at this moment. - */ - if (vif->type != NL80211_IFTYPE_P2P_DEVICE) - mvm->vif_count++; - if (mvm->vif_count > 1) { - IWL_DEBUG_MAC80211(mvm, - "Disable power on existing interfaces\n"); - ieee80211_iterate_active_interfaces_atomic( - mvm->hw, - IEEE80211_IFACE_ITER_NORMAL, - iwl_mvm_pm_disable_iterator, mvm); - } - - ret = iwl_mvm_mac_ctxt_add(mvm, vif); - if (ret) - goto out_release; - - /* - * Update power state on the new interface. Admittedly, based on - * mac80211 logics this power update will disable power management - */ - iwl_mvm_power_update_mode(mvm, vif); - - /* - * P2P_DEVICE interface does not have a channel context assigned to it, - * so a dedicated PHY context is allocated to it and the corresponding - * MAC context is bound to it at this stage. - */ - if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { - struct ieee80211_channel *chan; - struct cfg80211_chan_def chandef; - - mvmvif->phy_ctxt = &mvm->phy_ctxt_roc; - - /* - * The channel used here isn't relevant as it's - * going to be overwritten as part of the ROC flow. - * For now use the first channel we have. - */ - chan = &mvm->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->channels[0]; - cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT); - ret = iwl_mvm_phy_ctxt_add(mvm, mvmvif->phy_ctxt, - &chandef, 1, 1); - if (ret) - goto out_remove_mac; - - ret = iwl_mvm_binding_add_vif(mvm, vif); - if (ret) - goto out_remove_phy; - - ret = iwl_mvm_add_bcast_sta(mvm, vif, &mvmvif->bcast_sta); - if (ret) - goto out_unbind; - - /* Save a pointer to p2p device vif, so it can later be used to - * update the p2p device MAC when a GO is started/stopped */ - mvm->p2p_device_vif = vif; - } - - iwl_mvm_vif_dbgfs_register(mvm, vif); - goto out_unlock; - - out_unbind: - iwl_mvm_binding_remove_vif(mvm, vif); - out_remove_phy: - iwl_mvm_phy_ctxt_remove(mvm, mvmvif->phy_ctxt); - out_remove_mac: - mvmvif->phy_ctxt = NULL; - iwl_mvm_mac_ctxt_remove(mvm, vif); - out_release: - /* - * TODO: remove this temporary code. - * Currently MVM FW supports power management only on single MAC. - * Check if only one additional interface remains after releasing - * current one. Update power mode on the remaining interface. - */ - if (vif->type != NL80211_IFTYPE_P2P_DEVICE) - mvm->vif_count--; - IWL_DEBUG_MAC80211(mvm, "Currently %d interfaces active\n", - mvm->vif_count); - if (mvm->vif_count == 1) { - ieee80211_iterate_active_interfaces( - mvm->hw, IEEE80211_IFACE_ITER_NORMAL, - iwl_mvm_power_update_iterator, mvm); - } - iwl_mvm_mac_ctxt_release(mvm, vif); - out_unlock: - mutex_unlock(&mvm->mutex); - - return ret; -} - -static void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm, - struct ieee80211_vif *vif) -{ - u32 tfd_msk = 0, ac; - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) - if (vif->hw_queue[ac] != IEEE80211_INVAL_HW_QUEUE) - tfd_msk |= BIT(vif->hw_queue[ac]); - - if (vif->cab_queue != IEEE80211_INVAL_HW_QUEUE) - tfd_msk |= BIT(vif->cab_queue); - - if (tfd_msk) { - mutex_lock(&mvm->mutex); - iwl_mvm_flush_tx_path(mvm, tfd_msk, true); - mutex_unlock(&mvm->mutex); - } - - if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { - /* - * Flush the ROC worker which will flush the OFFCHANNEL queue. - * We assume here that all the packets sent to the OFFCHANNEL - * queue are sent in ROC session. - */ - flush_work(&mvm->roc_done_wk); - } else { - /* - * By now, all the AC queues are empty. The AGG queues are - * empty too. We already got all the Tx responses for all the - * packets in the queues. The drain work can have been - * triggered. Flush it. This work item takes the mutex, so kill - * it before we take it. - */ - flush_work(&mvm->sta_drained_wk); - } -} - -static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - iwl_mvm_prepare_mac_removal(mvm, vif); - - mutex_lock(&mvm->mutex); - - iwl_mvm_vif_dbgfs_clean(mvm, vif); - - /* - * For AP/GO interface, the tear down of the resources allocated to the - * interface is be handled as part of the stop_ap flow. - */ - if (vif->type == NL80211_IFTYPE_AP) { - iwl_mvm_dealloc_int_sta(mvm, &mvmvif->bcast_sta); - goto out_release; - } - - if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { - mvm->p2p_device_vif = NULL; - iwl_mvm_rm_bcast_sta(mvm, &mvmvif->bcast_sta); - iwl_mvm_binding_remove_vif(mvm, vif); - iwl_mvm_phy_ctxt_remove(mvm, mvmvif->phy_ctxt); - mvmvif->phy_ctxt = NULL; - } - - /* - * TODO: remove this temporary code. - * Currently MVM FW supports power management only on single MAC. - * Check if only one additional interface remains after removing - * current one. Update power mode on the remaining interface. - */ - if (mvm->vif_count && vif->type != NL80211_IFTYPE_P2P_DEVICE) - mvm->vif_count--; - IWL_DEBUG_MAC80211(mvm, "Currently %d interfaces active\n", - mvm->vif_count); - if (mvm->vif_count == 1) { - ieee80211_iterate_active_interfaces( - mvm->hw, IEEE80211_IFACE_ITER_NORMAL, - iwl_mvm_power_update_iterator, mvm); - } - - iwl_mvm_mac_ctxt_remove(mvm, vif); - -out_release: - iwl_mvm_mac_ctxt_release(mvm, vif); - mutex_unlock(&mvm->mutex); -} - -static int iwl_mvm_mac_config(struct ieee80211_hw *hw, u32 changed) -{ - return 0; -} - -static void iwl_mvm_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast) -{ - *total_flags = 0; -} - -static int iwl_mvm_configure_mcast_filter(struct iwl_mvm *mvm, - struct ieee80211_vif *vif) -{ - struct iwl_mcast_filter_cmd mcast_filter_cmd = { - .pass_all = 1, - }; - - memcpy(mcast_filter_cmd.bssid, vif->bss_conf.bssid, ETH_ALEN); - - return iwl_mvm_send_cmd_pdu(mvm, MCAST_FILTER_CMD, CMD_SYNC, - sizeof(mcast_filter_cmd), - &mcast_filter_cmd); -} - -static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changes) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - int ret; - - ret = iwl_mvm_mac_ctxt_changed(mvm, vif); - if (ret) - IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr); - - if (changes & BSS_CHANGED_ASSOC) { - if (bss_conf->assoc) { - /* add quota for this interface */ - ret = iwl_mvm_update_quotas(mvm, vif); - if (ret) { - IWL_ERR(mvm, "failed to update quotas\n"); - return; - } - iwl_mvm_bt_coex_vif_assoc(mvm, vif); - iwl_mvm_configure_mcast_filter(mvm, vif); - } else if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { - /* remove AP station now that the MAC is unassoc */ - ret = iwl_mvm_rm_sta_id(mvm, vif, mvmvif->ap_sta_id); - if (ret) - IWL_ERR(mvm, "failed to remove AP station\n"); - mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT; - /* remove quota for this interface */ - ret = iwl_mvm_update_quotas(mvm, NULL); - if (ret) - IWL_ERR(mvm, "failed to update quotas\n"); - } - } else if (changes & BSS_CHANGED_DTIM_PERIOD) { - /* - * We received a beacon _after_ association so - * remove the session protection. - */ - iwl_mvm_remove_time_event(mvm, mvmvif, - &mvmvif->time_event_data); - } else if (changes & BSS_CHANGED_PS) { - /* - * TODO: remove this temporary code. - * Currently MVM FW supports power management only on single - * MAC. Avoid power mode update if more than one interface - * is active. - */ - IWL_DEBUG_MAC80211(mvm, "Currently %d interfaces active\n", - mvm->vif_count); - if (mvm->vif_count == 1) { - ret = iwl_mvm_power_update_mode(mvm, vif); - if (ret) - IWL_ERR(mvm, "failed to update power mode\n"); - } - } -} - -static int iwl_mvm_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - int ret; - - mutex_lock(&mvm->mutex); - - /* Send the beacon template */ - ret = iwl_mvm_mac_ctxt_beacon_changed(mvm, vif); - if (ret) - goto out_unlock; - - /* Add the mac context */ - ret = iwl_mvm_mac_ctxt_add(mvm, vif); - if (ret) - goto out_unlock; - - /* Perform the binding */ - ret = iwl_mvm_binding_add_vif(mvm, vif); - if (ret) - goto out_remove; - - mvmvif->ap_active = true; - - /* Send the bcast station. At this stage the TBTT and DTIM time events - * are added and applied to the scheduler */ - ret = iwl_mvm_send_bcast_sta(mvm, vif, &mvmvif->bcast_sta); - if (ret) - goto out_unbind; - - ret = iwl_mvm_update_quotas(mvm, vif); - if (ret) - goto out_rm_bcast; - - /* Need to update the P2P Device MAC */ - if (vif->p2p && mvm->p2p_device_vif) - iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif); - - mutex_unlock(&mvm->mutex); - return 0; - -out_rm_bcast: - iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta); -out_unbind: - iwl_mvm_binding_remove_vif(mvm, vif); -out_remove: - iwl_mvm_mac_ctxt_remove(mvm, vif); -out_unlock: - mutex_unlock(&mvm->mutex); - return ret; -} - -static void iwl_mvm_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - iwl_mvm_prepare_mac_removal(mvm, vif); - - mutex_lock(&mvm->mutex); - - mvmvif->ap_active = false; - - /* Need to update the P2P Device MAC */ - if (vif->p2p && mvm->p2p_device_vif) - iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif); - - iwl_mvm_update_quotas(mvm, NULL); - iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta); - iwl_mvm_binding_remove_vif(mvm, vif); - iwl_mvm_mac_ctxt_remove(mvm, vif); - - mutex_unlock(&mvm->mutex); -} - -static void iwl_mvm_bss_info_changed_ap(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changes) -{ - /* Need to send a new beacon template to the FW */ - if (changes & BSS_CHANGED_BEACON) { - if (iwl_mvm_mac_ctxt_beacon_changed(mvm, vif)) - IWL_WARN(mvm, "Failed updating beacon data\n"); - } -} - -static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changes) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - - mutex_lock(&mvm->mutex); - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - iwl_mvm_bss_info_changed_station(mvm, vif, bss_conf, changes); - break; - case NL80211_IFTYPE_AP: - iwl_mvm_bss_info_changed_ap(mvm, vif, bss_conf, changes); - break; - default: - /* shouldn't happen */ - WARN_ON_ONCE(1); - } - - mutex_unlock(&mvm->mutex); -} - -static int iwl_mvm_mac_hw_scan(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct cfg80211_scan_request *req) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - int ret; - - if (req->n_channels == 0 || req->n_channels > MAX_NUM_SCAN_CHANNELS) - return -EINVAL; - - mutex_lock(&mvm->mutex); - - if (mvm->scan_status == IWL_MVM_SCAN_NONE) - ret = iwl_mvm_scan_request(mvm, vif, req); - else - ret = -EBUSY; - - mutex_unlock(&mvm->mutex); - - return ret; -} - -static void iwl_mvm_mac_cancel_hw_scan(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - - mutex_lock(&mvm->mutex); - - iwl_mvm_cancel_scan(mvm); - - mutex_unlock(&mvm->mutex); -} - -static void -iwl_mvm_mac_allow_buffered_frames(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u16 tid, - int num_frames, - enum ieee80211_frame_release_type reason, - bool more_data) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - - /* TODO: how do we tell the fw to send frames for a specific TID */ - - /* - * The fw will send EOSP notification when the last frame will be - * transmitted. - */ - iwl_mvm_sta_modify_sleep_tx_count(mvm, sta, reason, num_frames); -} - -static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum sta_notify_cmd cmd, - struct ieee80211_sta *sta) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; - - switch (cmd) { - case STA_NOTIFY_SLEEP: - if (atomic_read(&mvm->pending_frames[mvmsta->sta_id]) > 0) - ieee80211_sta_block_awake(hw, sta, true); - /* - * The fw updates the STA to be asleep. Tx packets on the Tx - * queues to this station will not be transmitted. The fw will - * send a Tx response with TX_STATUS_FAIL_DEST_PS. - */ - break; - case STA_NOTIFY_AWAKE: - if (WARN_ON(mvmsta->sta_id == IWL_MVM_STATION_COUNT)) - break; - iwl_mvm_sta_modify_ps_wake(mvm, sta); - break; - default: - break; - } -} - -static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - enum ieee80211_sta_state old_state, - enum ieee80211_sta_state new_state) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - int ret; - - IWL_DEBUG_MAC80211(mvm, "station %pM state change %d->%d\n", - sta->addr, old_state, new_state); - - /* this would be a mac80211 bug ... but don't crash */ - if (WARN_ON_ONCE(!mvmvif->phy_ctxt)) - return -EINVAL; - - /* if a STA is being removed, reuse its ID */ - flush_work(&mvm->sta_drained_wk); - - mutex_lock(&mvm->mutex); - if (old_state == IEEE80211_STA_NOTEXIST && - new_state == IEEE80211_STA_NONE) { - /* - * Firmware bug - it'll crash if the beacon interval is less - * than 16. We can't avoid connecting at all, so refuse the - * station state change, this will cause mac80211 to abandon - * attempts to connect to this AP, and eventually wpa_s will - * blacklist the AP... - */ - if (vif->type == NL80211_IFTYPE_STATION && - vif->bss_conf.beacon_int < 16) { - IWL_ERR(mvm, - "AP %pM beacon interval is %d, refusing due to firmware bug!\n", - sta->addr, vif->bss_conf.beacon_int); - ret = -EINVAL; - goto out_unlock; - } - ret = iwl_mvm_add_sta(mvm, vif, sta); - } else if (old_state == IEEE80211_STA_NONE && - new_state == IEEE80211_STA_AUTH) { - ret = 0; - } else if (old_state == IEEE80211_STA_AUTH && - new_state == IEEE80211_STA_ASSOC) { - ret = iwl_mvm_update_sta(mvm, vif, sta); - if (ret == 0) - iwl_mvm_rs_rate_init(mvm, sta, - mvmvif->phy_ctxt->channel->band); - } else if (old_state == IEEE80211_STA_ASSOC && - new_state == IEEE80211_STA_AUTHORIZED) { - ret = 0; - } else if (old_state == IEEE80211_STA_AUTHORIZED && - new_state == IEEE80211_STA_ASSOC) { - ret = 0; - } else if (old_state == IEEE80211_STA_ASSOC && - new_state == IEEE80211_STA_AUTH) { - ret = 0; - } else if (old_state == IEEE80211_STA_AUTH && - new_state == IEEE80211_STA_NONE) { - ret = 0; - } else if (old_state == IEEE80211_STA_NONE && - new_state == IEEE80211_STA_NOTEXIST) { - ret = iwl_mvm_rm_sta(mvm, vif, sta); - } else { - ret = -EIO; - } - out_unlock: - mutex_unlock(&mvm->mutex); - - return ret; -} - -static int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, u32 value) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - - mvm->rts_threshold = value; - - return 0; -} - -static int iwl_mvm_mac_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 ac, - const struct ieee80211_tx_queue_params *params) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - mvmvif->queue_params[ac] = *params; - - /* - * No need to update right away, we'll get BSS_CHANGED_QOS - * The exception is P2P_DEVICE interface which needs immediate update. - */ - if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { - int ret; - - mutex_lock(&mvm->mutex); - ret = iwl_mvm_mac_ctxt_changed(mvm, vif); - mutex_unlock(&mvm->mutex); - return ret; - } - return 0; -} - -static void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - u32 duration = min(IWL_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS, - 200 + vif->bss_conf.beacon_int); - u32 min_duration = min(IWL_MVM_TE_SESSION_PROTECTION_MIN_TIME_MS, - 100 + vif->bss_conf.beacon_int); - - if (WARN_ON_ONCE(vif->bss_conf.assoc)) - return; - - mutex_lock(&mvm->mutex); - /* Try really hard to protect the session and hear a beacon */ - iwl_mvm_protect_session(mvm, vif, duration, min_duration); - mutex_unlock(&mvm->mutex); -} - -static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, - enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - int ret; - - if (iwlwifi_mod_params.sw_crypto) { - IWL_DEBUG_MAC80211(mvm, "leave - hwcrypto disabled\n"); - return -EOPNOTSUPP; - } - - switch (key->cipher) { - case WLAN_CIPHER_SUITE_TKIP: - key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; - /* fall-through */ - case WLAN_CIPHER_SUITE_CCMP: - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - WARN_ON_ONCE(!(hw->flags & IEEE80211_HW_MFP_CAPABLE)); - break; - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - /* - * Support for TX only, at least for now, so accept - * the key and do nothing else. Then mac80211 will - * pass it for TX but we don't have to use it for RX. - */ - return 0; - default: - return -EOPNOTSUPP; - } - - mutex_lock(&mvm->mutex); - - switch (cmd) { - case SET_KEY: - if (vif->type == NL80211_IFTYPE_AP && !sta) { - /* GTK on AP interface is a TX-only key, return 0 */ - ret = 0; - key->hw_key_idx = STA_KEY_IDX_INVALID; - break; - } - - IWL_DEBUG_MAC80211(mvm, "set hwcrypto key\n"); - ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, false); - if (ret) { - IWL_WARN(mvm, "set key failed\n"); - /* - * can't add key for RX, but we don't need it - * in the device for TX so still return 0 - */ - key->hw_key_idx = STA_KEY_IDX_INVALID; - ret = 0; - } - - break; - case DISABLE_KEY: - if (key->hw_key_idx == STA_KEY_IDX_INVALID) { - ret = 0; - break; - } - - IWL_DEBUG_MAC80211(mvm, "disable hwcrypto key\n"); - ret = iwl_mvm_remove_sta_key(mvm, vif, sta, key); - break; - default: - ret = -EINVAL; - } - - mutex_unlock(&mvm->mutex); - return ret; -} - -static void iwl_mvm_mac_update_tkip_key(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_key_conf *keyconf, - struct ieee80211_sta *sta, - u32 iv32, u16 *phase1key) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - - iwl_mvm_update_tkip_key(mvm, vif, keyconf, sta, iv32, phase1key); -} - - -static int iwl_mvm_roc(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_channel *channel, - int duration, - enum ieee80211_roc_type type) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct cfg80211_chan_def chandef; - int ret; - - if (vif->type != NL80211_IFTYPE_P2P_DEVICE) { - IWL_ERR(mvm, "vif isn't a P2P_DEVICE: %d\n", vif->type); - return -EINVAL; - } - - IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value, - duration, type); - - mutex_lock(&mvm->mutex); - - cfg80211_chandef_create(&chandef, channel, NL80211_CHAN_NO_HT); - ret = iwl_mvm_phy_ctxt_changed(mvm, &mvm->phy_ctxt_roc, - &chandef, 1, 1); - - /* Schedule the time events */ - ret = iwl_mvm_start_p2p_roc(mvm, vif, duration, type); - - mutex_unlock(&mvm->mutex); - IWL_DEBUG_MAC80211(mvm, "leave\n"); - - return ret; -} - -static int iwl_mvm_cancel_roc(struct ieee80211_hw *hw) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - - IWL_DEBUG_MAC80211(mvm, "enter\n"); - - mutex_lock(&mvm->mutex); - iwl_mvm_stop_p2p_roc(mvm); - mutex_unlock(&mvm->mutex); - - IWL_DEBUG_MAC80211(mvm, "leave\n"); - return 0; -} - -static int iwl_mvm_add_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *ctx) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_phy_ctxt *phy_ctxt = (void *)ctx->drv_priv; - int ret; - - mutex_lock(&mvm->mutex); - - IWL_DEBUG_MAC80211(mvm, "Add PHY context\n"); - ret = iwl_mvm_phy_ctxt_add(mvm, phy_ctxt, &ctx->def, - ctx->rx_chains_static, - ctx->rx_chains_dynamic); - mutex_unlock(&mvm->mutex); - return ret; -} - -static void iwl_mvm_remove_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *ctx) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_phy_ctxt *phy_ctxt = (void *)ctx->drv_priv; - - mutex_lock(&mvm->mutex); - iwl_mvm_phy_ctxt_remove(mvm, phy_ctxt); - mutex_unlock(&mvm->mutex); -} - -static void iwl_mvm_change_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *ctx, - u32 changed) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_phy_ctxt *phy_ctxt = (void *)ctx->drv_priv; - - mutex_lock(&mvm->mutex); - iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &ctx->def, - ctx->rx_chains_static, - ctx->rx_chains_dynamic); - mutex_unlock(&mvm->mutex); -} - -static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_chanctx_conf *ctx) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_phy_ctxt *phyctx = (void *)ctx->drv_priv; - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - int ret; - - mutex_lock(&mvm->mutex); - - mvmvif->phy_ctxt = phyctx; - - switch (vif->type) { - case NL80211_IFTYPE_AP: - /* - * The AP binding flow is handled as part of the start_ap flow - * (in bss_info_changed). - */ - ret = 0; - goto out_unlock; - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_MONITOR: - break; - default: - ret = -EINVAL; - goto out_unlock; - } - - ret = iwl_mvm_binding_add_vif(mvm, vif); - if (ret) - goto out_unlock; - - /* - * Setting the quota at this stage is only required for monitor - * interfaces. For the other types, the bss_info changed flow - * will handle quota settings. - */ - if (vif->type == NL80211_IFTYPE_MONITOR) { - mvmvif->monitor_active = true; - ret = iwl_mvm_update_quotas(mvm, vif); - if (ret) - goto out_remove_binding; - } - - goto out_unlock; - - out_remove_binding: - iwl_mvm_binding_remove_vif(mvm, vif); - out_unlock: - mutex_unlock(&mvm->mutex); - if (ret) - mvmvif->phy_ctxt = NULL; - return ret; -} - -static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_chanctx_conf *ctx) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - - mutex_lock(&mvm->mutex); - - iwl_mvm_remove_time_event(mvm, mvmvif, &mvmvif->time_event_data); - - if (vif->type == NL80211_IFTYPE_AP) - goto out_unlock; - - switch (vif->type) { - case NL80211_IFTYPE_MONITOR: - mvmvif->monitor_active = false; - iwl_mvm_update_quotas(mvm, NULL); - break; - default: - break; - } - - iwl_mvm_binding_remove_vif(mvm, vif); -out_unlock: - mvmvif->phy_ctxt = NULL; - mutex_unlock(&mvm->mutex); -} - -static int iwl_mvm_set_tim(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - bool set) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; - - if (!mvm_sta || !mvm_sta->vif) { - IWL_ERR(mvm, "Station is not associated to a vif\n"); - return -EINVAL; - } - - return iwl_mvm_mac_ctxt_beacon_changed(mvm, mvm_sta->vif); -} - -static void iwl_mvm_mac_rssi_callback(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum ieee80211_rssi_event rssi_event) -{ - struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); - - iwl_mvm_bt_rssi_event(mvm, vif, rssi_event); -} - -struct ieee80211_ops iwl_mvm_hw_ops = { - .tx = iwl_mvm_mac_tx, - .ampdu_action = iwl_mvm_mac_ampdu_action, - .start = iwl_mvm_mac_start, - .restart_complete = iwl_mvm_mac_restart_complete, - .stop = iwl_mvm_mac_stop, - .add_interface = iwl_mvm_mac_add_interface, - .remove_interface = iwl_mvm_mac_remove_interface, - .config = iwl_mvm_mac_config, - .configure_filter = iwl_mvm_configure_filter, - .bss_info_changed = iwl_mvm_bss_info_changed, - .hw_scan = iwl_mvm_mac_hw_scan, - .cancel_hw_scan = iwl_mvm_mac_cancel_hw_scan, - .sta_state = iwl_mvm_mac_sta_state, - .sta_notify = iwl_mvm_mac_sta_notify, - .allow_buffered_frames = iwl_mvm_mac_allow_buffered_frames, - .set_rts_threshold = iwl_mvm_mac_set_rts_threshold, - .conf_tx = iwl_mvm_mac_conf_tx, - .mgd_prepare_tx = iwl_mvm_mac_mgd_prepare_tx, - .set_key = iwl_mvm_mac_set_key, - .update_tkip_key = iwl_mvm_mac_update_tkip_key, - .remain_on_channel = iwl_mvm_roc, - .cancel_remain_on_channel = iwl_mvm_cancel_roc, - .rssi_callback = iwl_mvm_mac_rssi_callback, - - .add_chanctx = iwl_mvm_add_chanctx, - .remove_chanctx = iwl_mvm_remove_chanctx, - .change_chanctx = iwl_mvm_change_chanctx, - .assign_vif_chanctx = iwl_mvm_assign_vif_chanctx, - .unassign_vif_chanctx = iwl_mvm_unassign_vif_chanctx, - - .start_ap = iwl_mvm_start_ap, - .stop_ap = iwl_mvm_stop_ap, - - .set_tim = iwl_mvm_set_tim, - -#ifdef CONFIG_PM_SLEEP - /* look at d3.c */ - .suspend = iwl_mvm_suspend, - .resume = iwl_mvm_resume, - .set_wakeup = iwl_mvm_set_wakeup, - .set_rekey_data = iwl_mvm_set_rekey_data, -#if IS_ENABLED(CONFIG_IPV6) - .ipv6_addr_change = iwl_mvm_ipv6_addr_change, -#endif - .set_default_unicast_key = iwl_mvm_set_default_unicast_key, -#endif -}; diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h deleted file mode 100644 index 80862319c42a..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ /dev/null @@ -1,538 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#ifndef __IWL_MVM_H__ -#define __IWL_MVM_H__ - -#include -#include -#include -#include - -#include "iwl-op-mode.h" -#include "iwl-trans.h" -#include "iwl-notif-wait.h" -#include "iwl-eeprom-parse.h" -#include "iwl-test.h" -#include "iwl-trans.h" -#include "sta.h" -#include "fw-api.h" - -#define IWL_INVALID_MAC80211_QUEUE 0xff -#define IWL_MVM_MAX_ADDRESSES 5 -/* RSSI offset for WkP */ -#define IWL_RSSI_OFFSET 50 - -enum iwl_mvm_tx_fifo { - IWL_MVM_TX_FIFO_BK = 0, - IWL_MVM_TX_FIFO_BE, - IWL_MVM_TX_FIFO_VI, - IWL_MVM_TX_FIFO_VO, - IWL_MVM_TX_FIFO_MCAST = 5, -}; - -extern struct ieee80211_ops iwl_mvm_hw_ops; -/** - * struct iwl_mvm_mod_params - module parameters for iwlmvm - * @init_dbg: if true, then the NIC won't be stopped if the INIT fw asserted. - * We will register to mac80211 to have testmode working. The NIC must not - * be up'ed after the INIT fw asserted. This is useful to be able to use - * proprietary tools over testmode to debug the INIT fw. - * @power_scheme: CAM(Continuous Active Mode)-1, BPS(Balanced Power - * Save)-2(default), LP(Low Power)-3 - */ -struct iwl_mvm_mod_params { - bool init_dbg; - int power_scheme; -}; -extern struct iwl_mvm_mod_params iwlmvm_mod_params; - -struct iwl_mvm_phy_ctxt { - u16 id; - u16 color; - - /* - * TODO: This should probably be removed. Currently here only for rate - * scaling algorithm - */ - struct ieee80211_channel *channel; -}; - -struct iwl_mvm_time_event_data { - struct ieee80211_vif *vif; - struct list_head list; - unsigned long end_jiffies; - u32 duration; - bool running; - u32 uid; - - /* - * The access to the 'id' field must be done when the - * mvm->time_event_lock is held, as it value is used to indicate - * if the te is in the time event list or not (when id == TE_MAX) - */ - u32 id; -}; - - /* Power management */ - -/** - * enum iwl_power_scheme - * @IWL_POWER_LEVEL_CAM - Continuously Active Mode - * @IWL_POWER_LEVEL_BPS - Balanced Power Save (default) - * @IWL_POWER_LEVEL_LP - Low Power - */ -enum iwl_power_scheme { - IWL_POWER_SCHEME_CAM = 1, - IWL_POWER_SCHEME_BPS, - IWL_POWER_SCHEME_LP -}; - -#define IWL_CONN_MAX_LISTEN_INTERVAL 70 - -/** - * struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context - * @id: between 0 and 3 - * @color: to solve races upon MAC addition and removal - * @ap_sta_id: the sta_id of the AP - valid only if VIF type is STA - * @uploaded: indicates the MAC context has been added to the device - * @ap_active: indicates that ap context is configured, and that the interface - * should get quota etc. - * @monitor_active: indicates that monitor context is configured, and that the - * interface should get quota etc. - * @queue_params: QoS params for this MAC - * @bcast_sta: station used for broadcast packets. Used by the following - * vifs: P2P_DEVICE, GO and AP. - * @beacon_skb: the skb used to hold the AP/GO beacon template - */ -struct iwl_mvm_vif { - u16 id; - u16 color; - u8 ap_sta_id; - - bool uploaded; - bool ap_active; - bool monitor_active; - - u32 ap_beacon_time; - - enum iwl_tsf_id tsf_id; - - /* - * QoS data from mac80211, need to store this here - * as mac80211 has a separate callback but we need - * to have the data for the MAC context - */ - struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS]; - struct iwl_mvm_time_event_data time_event_data; - - struct iwl_mvm_int_sta bcast_sta; - - /* - * Assigned while mac80211 has the interface in a channel context, - * or, for P2P Device, while it exists. - */ - struct iwl_mvm_phy_ctxt *phy_ctxt; - -#ifdef CONFIG_PM_SLEEP - /* WoWLAN GTK rekey data */ - struct { - u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN]; - __le64 replay_ctr; - bool valid; - } rekey_data; - - int tx_key_idx; - -#if IS_ENABLED(CONFIG_IPV6) - /* IPv6 addresses for WoWLAN */ - struct in6_addr target_ipv6_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS]; - int num_target_ipv6_addrs; -#endif -#endif - -#ifdef CONFIG_IWLWIFI_DEBUGFS - struct dentry *dbgfs_dir; - struct dentry *dbgfs_slink; - void *dbgfs_data; -#endif -}; - -static inline struct iwl_mvm_vif * -iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif) -{ - return (void *)vif->drv_priv; -} - -enum iwl_mvm_status { - IWL_MVM_STATUS_HW_RFKILL, - IWL_MVM_STATUS_ROC_RUNNING, - IWL_MVM_STATUS_IN_HW_RESTART, -}; - -enum iwl_scan_status { - IWL_MVM_SCAN_NONE, - IWL_MVM_SCAN_OS, -}; - -/** - * struct iwl_nvm_section - describes an NVM section in memory. - * - * This struct holds an NVM section read from the NIC using NVM_ACCESS_CMD, - * and saved for later use by the driver. Not all NVM sections are saved - * this way, only the needed ones. - */ -struct iwl_nvm_section { - u16 length; - const u8 *data; -}; - -struct iwl_mvm { - /* for logger access */ - struct device *dev; - - struct iwl_trans *trans; - const struct iwl_fw *fw; - const struct iwl_cfg *cfg; - struct iwl_phy_db *phy_db; - struct ieee80211_hw *hw; - - /* for protecting access to iwl_mvm */ - struct mutex mutex; - struct list_head async_handlers_list; - spinlock_t async_handlers_lock; - struct work_struct async_handlers_wk; - - struct work_struct roc_done_wk; - - unsigned long status; - - enum iwl_ucode_type cur_ucode; - bool ucode_loaded; - bool init_ucode_run; - u32 error_event_table; - u32 log_event_table; - - u32 ampdu_ref; - - struct iwl_notif_wait_data notif_wait; - - unsigned long transport_queue_stop; - u8 queue_to_mac80211[IWL_MAX_HW_QUEUES]; - atomic_t queue_stop_count[IWL_MAX_HW_QUEUES]; - - struct iwl_nvm_data *nvm_data; - /* NVM sections */ - struct iwl_nvm_section nvm_sections[NVM_NUM_OF_SECTIONS]; - - /* EEPROM MAC addresses */ - struct mac_address addresses[IWL_MVM_MAX_ADDRESSES]; - - /* data related to data path */ - struct iwl_rx_phy_info last_phy_info; - struct ieee80211_sta __rcu *fw_id_to_mac_id[IWL_MVM_STATION_COUNT]; - struct work_struct sta_drained_wk; - unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)]; - atomic_t pending_frames[IWL_MVM_STATION_COUNT]; - - /* configured by mac80211 */ - u32 rts_threshold; - - /* Scan status, cmd (pre-allocated) and auxiliary station */ - enum iwl_scan_status scan_status; - struct iwl_scan_cmd *scan_cmd; - - /* Internal station */ - struct iwl_mvm_int_sta aux_sta; - - u8 scan_last_antenna_idx; /* to toggle TX between antennas */ - u8 mgmt_last_antenna_idx; - -#ifdef CONFIG_IWLWIFI_DEBUGFS - struct dentry *debugfs_dir; - u32 dbgfs_sram_offset, dbgfs_sram_len; - bool prevent_power_down_d3; -#endif - - struct iwl_mvm_phy_ctxt phy_ctxt_roc; - - struct list_head time_event_list; - spinlock_t time_event_lock; - - /* - * A bitmap indicating the index of the key in use. The firmware - * can hold 16 keys at most. Reflect this fact. - */ - unsigned long fw_key_table[BITS_TO_LONGS(STA_KEY_MAX_NUM)]; - - /* - * This counter of created interfaces is referenced only in conjunction - * with FW limitation related to power management. Currently PM is - * supported only on a single interface. - * IMPORTANT: this variable counts all interfaces except P2P device. - */ - u8 vif_count; - - struct led_classdev led; - - struct ieee80211_vif *p2p_device_vif; - -#ifdef CONFIG_PM_SLEEP - int gtk_ivlen, gtk_icvlen, ptk_ivlen, ptk_icvlen; -#endif - - /* BT-Coex */ - u8 bt_kill_msk; - struct iwl_bt_coex_profile_notif last_bt_notif; -}; - -/* Extract MVM priv from op_mode and _hw */ -#define IWL_OP_MODE_GET_MVM(_iwl_op_mode) \ - ((struct iwl_mvm *)(_iwl_op_mode)->op_mode_specific) - -#define IWL_MAC80211_GET_MVM(_hw) \ - IWL_OP_MODE_GET_MVM((struct iwl_op_mode *)((_hw)->priv)) - -extern const u8 iwl_mvm_ac_to_tx_fifo[]; - -struct iwl_rate_info { - u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ - u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */ - u8 plcp_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */ - u8 plcp_mimo3; /* uCode API: IWL_RATE_MIMO3_6M_PLCP, etc. */ - u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */ -}; - -/****************** - * MVM Methods - ******************/ -/* uCode */ -int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm); - -/* Utils */ -int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags, - enum ieee80211_band band); -u8 iwl_mvm_mac80211_idx_to_hwrate(int rate_idx); -void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm); -u8 first_antenna(u8 mask); -u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx); - -/* Tx / Host Commands */ -int __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm, - struct iwl_host_cmd *cmd); -int __must_check iwl_mvm_send_cmd_pdu(struct iwl_mvm *mvm, u8 id, - u32 flags, u16 len, const void *data); -int __must_check iwl_mvm_send_cmd_status(struct iwl_mvm *mvm, - struct iwl_host_cmd *cmd, - u32 *status); -int __must_check iwl_mvm_send_cmd_pdu_status(struct iwl_mvm *mvm, u8 id, - u16 len, const void *data, - u32 *status); -int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb, - struct ieee80211_sta *sta); -int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb); -#ifdef CONFIG_IWLWIFI_DEBUG -const char *iwl_mvm_get_tx_fail_reason(u32 status); -#else -static inline const char *iwl_mvm_get_tx_fail_reason(u32 status) { return ""; } -#endif -int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk, bool sync); -void iwl_mvm_async_handlers_purge(struct iwl_mvm *mvm); - -/* Statistics */ -int iwl_mvm_rx_reply_statistics(struct iwl_mvm *mvm, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -int iwl_mvm_rx_statistics(struct iwl_mvm *mvm, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); - -/* NVM */ -int iwl_nvm_init(struct iwl_mvm *mvm); - -int iwl_mvm_up(struct iwl_mvm *mvm); -int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm); - -int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm); - -/* - * FW notifications / CMD responses handlers - * Convention: iwl_mvm_rx_ - */ -int iwl_mvm_rx_rx_phy_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -int iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -int iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -int iwl_mvm_rx_radio_ver(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -int iwl_mvm_rx_fw_error(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -int iwl_mvm_rx_card_state_notif(struct iwl_mvm *mvm, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -int iwl_mvm_rx_radio_ver(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); - -/* MVM PHY */ -int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, - struct cfg80211_chan_def *chandef, - u8 chains_static, u8 chains_dynamic); -int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, - struct cfg80211_chan_def *chandef, - u8 chains_static, u8 chains_dynamic); -void iwl_mvm_phy_ctxt_remove(struct iwl_mvm *mvm, - struct iwl_mvm_phy_ctxt *ctxt); - -/* MAC (virtual interface) programming */ -int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif); -void iwl_mvm_mac_ctxt_release(struct iwl_mvm *mvm, struct ieee80211_vif *vif); -int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif); -int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif); -int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif); -u32 iwl_mvm_mac_get_queues_mask(struct iwl_mvm *mvm, - struct ieee80211_vif *vif); -int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm, - struct ieee80211_vif *vif); -int iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); - -/* Bindings */ -int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); -int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif); - -/* Quota management */ -int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif); - -/* Scanning */ -int iwl_mvm_scan_request(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct cfg80211_scan_request *req); -int iwl_mvm_rx_scan_response(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -int iwl_mvm_rx_scan_complete(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -void iwl_mvm_cancel_scan(struct iwl_mvm *mvm); - -/* MVM debugfs */ -#ifdef CONFIG_IWLWIFI_DEBUGFS -int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir); -void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif); -void iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif); -#else -static inline int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, - struct dentry *dbgfs_dir) -{ - return 0; -} -static inline void -iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) -{ -} -static inline void -iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif) -{ -} -#endif /* CONFIG_IWLWIFI_DEBUGFS */ - -/* rate scaling */ -int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, - u8 flags, bool init); - -/* power managment */ -int iwl_mvm_power_update_mode(struct iwl_mvm *mvm, struct ieee80211_vif *vif); -int iwl_mvm_power_disable(struct iwl_mvm *mvm, struct ieee80211_vif *vif); -void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct iwl_powertable_cmd *cmd); - -int iwl_mvm_leds_init(struct iwl_mvm *mvm); -void iwl_mvm_leds_exit(struct iwl_mvm *mvm); - -/* D3 (WoWLAN, NetDetect) */ -int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); -int iwl_mvm_resume(struct ieee80211_hw *hw); -void iwl_mvm_set_wakeup(struct ieee80211_hw *hw, bool enabled); -void iwl_mvm_set_rekey_data(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct cfg80211_gtk_rekey_data *data); -void iwl_mvm_ipv6_addr_change(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct inet6_dev *idev); -void iwl_mvm_set_default_unicast_key(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, int idx); - -/* BT Coex */ -int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm); -int iwl_send_bt_init_conf(struct iwl_mvm *mvm); -int iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - enum ieee80211_rssi_event rssi_event); -void iwl_mvm_bt_coex_vif_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif); - -#endif /* __IWL_MVM_H__ */ diff --git a/drivers/net/wireless/iwlwifi/mvm/nvm.c b/drivers/net/wireless/iwlwifi/mvm/nvm.c deleted file mode 100644 index b8ec02f89acc..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/nvm.c +++ /dev/null @@ -1,238 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#include "iwl-trans.h" -#include "mvm.h" -#include "iwl-eeprom-parse.h" -#include "iwl-eeprom-read.h" -#include "iwl-nvm-parse.h" - -/* list of NVM sections we are allowed/need to read */ -static const int nvm_to_read[] = { - NVM_SECTION_TYPE_HW, - NVM_SECTION_TYPE_SW, - NVM_SECTION_TYPE_CALIBRATION, - NVM_SECTION_TYPE_PRODUCTION, -}; - -/* Default NVM size to read */ -#define IWL_NVM_DEFAULT_CHUNK_SIZE (2*1024); - -static inline void iwl_nvm_fill_read(struct iwl_nvm_access_cmd *cmd, - u16 offset, u16 length, u16 section) -{ - cmd->offset = cpu_to_le16(offset); - cmd->length = cpu_to_le16(length); - cmd->type = cpu_to_le16(section); -} - -static int iwl_nvm_read_chunk(struct iwl_mvm *mvm, u16 section, - u16 offset, u16 length, u8 *data) -{ - struct iwl_nvm_access_cmd nvm_access_cmd = {}; - struct iwl_nvm_access_resp *nvm_resp; - struct iwl_rx_packet *pkt; - struct iwl_host_cmd cmd = { - .id = NVM_ACCESS_CMD, - .flags = CMD_SYNC | CMD_WANT_SKB, - .data = { &nvm_access_cmd, }, - }; - int ret, bytes_read, offset_read; - u8 *resp_data; - - iwl_nvm_fill_read(&nvm_access_cmd, offset, length, section); - cmd.len[0] = sizeof(struct iwl_nvm_access_cmd); - - ret = iwl_mvm_send_cmd(mvm, &cmd); - if (ret) - return ret; - - pkt = cmd.resp_pkt; - if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { - IWL_ERR(mvm, "Bad return from NVM_ACCES_COMMAND (0x%08X)\n", - pkt->hdr.flags); - ret = -EIO; - goto exit; - } - - /* Extract NVM response */ - nvm_resp = (void *)pkt->data; - ret = le16_to_cpu(nvm_resp->status); - bytes_read = le16_to_cpu(nvm_resp->length); - offset_read = le16_to_cpu(nvm_resp->offset); - resp_data = nvm_resp->data; - if (ret) { - IWL_ERR(mvm, - "NVM access command failed with status %d (device: %s)\n", - ret, mvm->cfg->name); - ret = -EINVAL; - goto exit; - } - - if (offset_read != offset) { - IWL_ERR(mvm, "NVM ACCESS response with invalid offset %d\n", - offset_read); - ret = -EINVAL; - goto exit; - } - - /* Write data to NVM */ - memcpy(data + offset, resp_data, bytes_read); - ret = bytes_read; - -exit: - iwl_free_resp(&cmd); - return ret; -} - -/* - * Reads an NVM section completely. - * NICs prior to 7000 family doesn't have a real NVM, but just read - * section 0 which is the EEPROM. Because the EEPROM reading is unlimited - * by uCode, we need to manually check in this case that we don't - * overflow and try to read more than the EEPROM size. - * For 7000 family NICs, we supply the maximal size we can read, and - * the uCode fills the response with as much data as we can, - * without overflowing, so no check is needed. - */ -static int iwl_nvm_read_section(struct iwl_mvm *mvm, u16 section, - u8 *data) -{ - u16 length, offset = 0; - int ret; - - /* Set nvm section read length */ - length = IWL_NVM_DEFAULT_CHUNK_SIZE; - - ret = length; - - /* Read the NVM until exhausted (reading less than requested) */ - while (ret == length) { - ret = iwl_nvm_read_chunk(mvm, section, offset, length, data); - if (ret < 0) { - IWL_ERR(mvm, - "Cannot read NVM from section %d offset %d, length %d\n", - section, offset, length); - return ret; - } - offset += ret; - } - - IWL_INFO(mvm, "NVM section %d read completed\n", section); - return offset; -} - -static struct iwl_nvm_data * -iwl_parse_nvm_sections(struct iwl_mvm *mvm) -{ - struct iwl_nvm_section *sections = mvm->nvm_sections; - const __le16 *hw, *sw, *calib; - - /* Checking for required sections */ - if (!mvm->nvm_sections[NVM_SECTION_TYPE_SW].data || - !mvm->nvm_sections[NVM_SECTION_TYPE_HW].data) { - IWL_ERR(mvm, "Can't parse empty NVM sections\n"); - return NULL; - } - - if (WARN_ON(!mvm->cfg)) - return NULL; - - hw = (const __le16 *)sections[NVM_SECTION_TYPE_HW].data; - sw = (const __le16 *)sections[NVM_SECTION_TYPE_SW].data; - calib = (const __le16 *)sections[NVM_SECTION_TYPE_CALIBRATION].data; - return iwl_parse_nvm_data(mvm->trans->dev, mvm->cfg, hw, sw, calib); -} - -int iwl_nvm_init(struct iwl_mvm *mvm) -{ - int ret, i, section; - u8 *nvm_buffer, *temp; - - /* TODO: find correct NVM max size for a section */ - nvm_buffer = kmalloc(mvm->cfg->base_params->eeprom_size, - GFP_KERNEL); - if (!nvm_buffer) - return -ENOMEM; - for (i = 0; i < ARRAY_SIZE(nvm_to_read); i++) { - section = nvm_to_read[i]; - /* we override the constness for initial read */ - ret = iwl_nvm_read_section(mvm, section, nvm_buffer); - if (ret < 0) - break; - temp = kmemdup(nvm_buffer, ret, GFP_KERNEL); - if (!temp) { - ret = -ENOMEM; - break; - } - mvm->nvm_sections[section].data = temp; - mvm->nvm_sections[section].length = ret; - } - kfree(nvm_buffer); - if (ret < 0) - return ret; - - ret = 0; - mvm->nvm_data = iwl_parse_nvm_sections(mvm); - - return ret; -} diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c deleted file mode 100644 index b29c31a41594..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c +++ /dev/null @@ -1,677 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#include -#include - -#include "iwl-notif-wait.h" -#include "iwl-trans.h" -#include "iwl-op-mode.h" -#include "iwl-fw.h" -#include "iwl-debug.h" -#include "iwl-drv.h" -#include "iwl-modparams.h" -#include "mvm.h" -#include "iwl-phy-db.h" -#include "iwl-eeprom-parse.h" -#include "iwl-csr.h" -#include "iwl-io.h" -#include "iwl-prph.h" -#include "rs.h" -#include "fw-api-scan.h" -#include "time-event.h" - -/* - * module name, copyright, version, etc. - */ -#define DRV_DESCRIPTION "The new Intel(R) wireless AGN driver for Linux" - -#define DRV_VERSION IWLWIFI_VERSION - -MODULE_DESCRIPTION(DRV_DESCRIPTION); -MODULE_VERSION(DRV_VERSION); -MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR); -MODULE_LICENSE("GPL"); - -static const struct iwl_op_mode_ops iwl_mvm_ops; - -struct iwl_mvm_mod_params iwlmvm_mod_params = { - .power_scheme = IWL_POWER_SCHEME_BPS, - /* rest of fields are 0 by default */ -}; - -module_param_named(init_dbg, iwlmvm_mod_params.init_dbg, bool, S_IRUGO); -MODULE_PARM_DESC(init_dbg, - "set to true to debug an ASSERT in INIT fw (default: false"); -module_param_named(power_scheme, iwlmvm_mod_params.power_scheme, int, S_IRUGO); -MODULE_PARM_DESC(power_scheme, - "power management scheme: 1-active, 2-balanced, 3-low power, default: 2"); - -/* - * module init and exit functions - */ -static int __init iwl_mvm_init(void) -{ - int ret; - - ret = iwl_mvm_rate_control_register(); - if (ret) { - pr_err("Unable to register rate control algorithm: %d\n", ret); - return ret; - } - - ret = iwl_opmode_register("iwlmvm", &iwl_mvm_ops); - - if (ret) { - pr_err("Unable to register MVM op_mode: %d\n", ret); - iwl_mvm_rate_control_unregister(); - } - - return ret; -} -module_init(iwl_mvm_init); - -static void __exit iwl_mvm_exit(void) -{ - iwl_opmode_deregister("iwlmvm"); - iwl_mvm_rate_control_unregister(); -} -module_exit(iwl_mvm_exit); - -static void iwl_mvm_nic_config(struct iwl_op_mode *op_mode) -{ - struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); - u8 radio_cfg_type, radio_cfg_step, radio_cfg_dash; - u32 reg_val = 0; - - radio_cfg_type = (mvm->fw->phy_config & FW_PHY_CFG_RADIO_TYPE) >> - FW_PHY_CFG_RADIO_TYPE_POS; - radio_cfg_step = (mvm->fw->phy_config & FW_PHY_CFG_RADIO_STEP) >> - FW_PHY_CFG_RADIO_STEP_POS; - radio_cfg_dash = (mvm->fw->phy_config & FW_PHY_CFG_RADIO_DASH) >> - FW_PHY_CFG_RADIO_DASH_POS; - - /* SKU control */ - reg_val |= CSR_HW_REV_STEP(mvm->trans->hw_rev) << - CSR_HW_IF_CONFIG_REG_POS_MAC_STEP; - reg_val |= CSR_HW_REV_DASH(mvm->trans->hw_rev) << - CSR_HW_IF_CONFIG_REG_POS_MAC_DASH; - - /* radio configuration */ - reg_val |= radio_cfg_type << CSR_HW_IF_CONFIG_REG_POS_PHY_TYPE; - reg_val |= radio_cfg_step << CSR_HW_IF_CONFIG_REG_POS_PHY_STEP; - reg_val |= radio_cfg_dash << CSR_HW_IF_CONFIG_REG_POS_PHY_DASH; - - WARN_ON((radio_cfg_type << CSR_HW_IF_CONFIG_REG_POS_PHY_TYPE) & - ~CSR_HW_IF_CONFIG_REG_MSK_PHY_TYPE); - - /* silicon bits */ - reg_val |= CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI; - - iwl_trans_set_bits_mask(mvm->trans, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH | - CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP | - CSR_HW_IF_CONFIG_REG_MSK_PHY_TYPE | - CSR_HW_IF_CONFIG_REG_MSK_PHY_STEP | - CSR_HW_IF_CONFIG_REG_MSK_PHY_DASH | - CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI | - CSR_HW_IF_CONFIG_REG_BIT_MAC_SI, - reg_val); - - IWL_DEBUG_INFO(mvm, "Radio type=0x%x-0x%x-0x%x\n", radio_cfg_type, - radio_cfg_step, radio_cfg_dash); - - /* - * W/A : NIC is stuck in a reset state after Early PCIe power off - * (PCIe power is lost before PERST# is asserted), causing ME FW - * to lose ownership and not being able to obtain it back. - */ - iwl_set_bits_mask_prph(mvm->trans, APMG_PS_CTRL_REG, - APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS, - ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS); -} - -struct iwl_rx_handlers { - u8 cmd_id; - bool async; - int (*fn)(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -}; - -#define RX_HANDLER(_cmd_id, _fn, _async) \ - { .cmd_id = _cmd_id , .fn = _fn , .async = _async } - -/* - * Handlers for fw notifications - * Convention: RX_HANDLER(CMD_NAME, iwl_mvm_rx_CMD_NAME - * This list should be in order of frequency for performance purposes. - * - * The handler can be SYNC - this means that it will be called in the Rx path - * which can't acquire mvm->mutex. If the handler needs to hold mvm->mutex (and - * only in this case!), it should be set as ASYNC. In that case, it will be - * called from a worker with mvm->mutex held. - */ -static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = { - RX_HANDLER(REPLY_RX_MPDU_CMD, iwl_mvm_rx_rx_mpdu, false), - RX_HANDLER(REPLY_RX_PHY_CMD, iwl_mvm_rx_rx_phy_cmd, false), - RX_HANDLER(TX_CMD, iwl_mvm_rx_tx_cmd, false), - RX_HANDLER(BA_NOTIF, iwl_mvm_rx_ba_notif, false), - RX_HANDLER(TIME_EVENT_NOTIFICATION, iwl_mvm_rx_time_event_notif, false), - - RX_HANDLER(SCAN_REQUEST_CMD, iwl_mvm_rx_scan_response, false), - RX_HANDLER(SCAN_COMPLETE_NOTIFICATION, iwl_mvm_rx_scan_complete, false), - - RX_HANDLER(BT_PROFILE_NOTIFICATION, iwl_mvm_rx_bt_coex_notif, true), - RX_HANDLER(BEACON_NOTIFICATION, iwl_mvm_rx_beacon_notif, false), - - RX_HANDLER(RADIO_VERSION_NOTIFICATION, iwl_mvm_rx_radio_ver, false), - RX_HANDLER(CARD_STATE_NOTIFICATION, iwl_mvm_rx_card_state_notif, false), - - RX_HANDLER(REPLY_ERROR, iwl_mvm_rx_fw_error, false), -}; -#undef RX_HANDLER -#define CMD(x) [x] = #x - -static const char *iwl_mvm_cmd_strings[REPLY_MAX] = { - CMD(MVM_ALIVE), - CMD(REPLY_ERROR), - CMD(INIT_COMPLETE_NOTIF), - CMD(PHY_CONTEXT_CMD), - CMD(MGMT_MCAST_KEY), - CMD(TX_CMD), - CMD(TXPATH_FLUSH), - CMD(MAC_CONTEXT_CMD), - CMD(TIME_EVENT_CMD), - CMD(TIME_EVENT_NOTIFICATION), - CMD(BINDING_CONTEXT_CMD), - CMD(TIME_QUOTA_CMD), - CMD(RADIO_VERSION_NOTIFICATION), - CMD(SCAN_REQUEST_CMD), - CMD(SCAN_ABORT_CMD), - CMD(SCAN_START_NOTIFICATION), - CMD(SCAN_RESULTS_NOTIFICATION), - CMD(SCAN_COMPLETE_NOTIFICATION), - CMD(NVM_ACCESS_CMD), - CMD(PHY_CONFIGURATION_CMD), - CMD(CALIB_RES_NOTIF_PHY_DB), - CMD(SET_CALIB_DEFAULT_CMD), - CMD(CALIBRATION_COMPLETE_NOTIFICATION), - CMD(ADD_STA), - CMD(REMOVE_STA), - CMD(LQ_CMD), - CMD(SCAN_OFFLOAD_CONFIG_CMD), - CMD(SCAN_OFFLOAD_REQUEST_CMD), - CMD(SCAN_OFFLOAD_ABORT_CMD), - CMD(SCAN_OFFLOAD_COMPLETE), - CMD(SCAN_OFFLOAD_UPDATE_PROFILES_CMD), - CMD(POWER_TABLE_CMD), - CMD(WEP_KEY), - CMD(REPLY_RX_PHY_CMD), - CMD(REPLY_RX_MPDU_CMD), - CMD(BEACON_NOTIFICATION), - CMD(BEACON_TEMPLATE_CMD), - CMD(STATISTICS_NOTIFICATION), - CMD(TX_ANT_CONFIGURATION_CMD), - CMD(D3_CONFIG_CMD), - CMD(PROT_OFFLOAD_CONFIG_CMD), - CMD(OFFLOADS_QUERY_CMD), - CMD(REMOTE_WAKE_CONFIG_CMD), - CMD(WOWLAN_PATTERNS), - CMD(WOWLAN_CONFIGURATION), - CMD(WOWLAN_TSC_RSC_PARAM), - CMD(WOWLAN_TKIP_PARAM), - CMD(WOWLAN_KEK_KCK_MATERIAL), - CMD(WOWLAN_GET_STATUSES), - CMD(WOWLAN_TX_POWER_PER_DB), - CMD(NET_DETECT_CONFIG_CMD), - CMD(NET_DETECT_PROFILES_QUERY_CMD), - CMD(NET_DETECT_PROFILES_CMD), - CMD(NET_DETECT_HOTSPOTS_CMD), - CMD(NET_DETECT_HOTSPOTS_QUERY_CMD), - CMD(CARD_STATE_NOTIFICATION), - CMD(BT_COEX_PRIO_TABLE), - CMD(BT_COEX_PROT_ENV), - CMD(BT_PROFILE_NOTIFICATION), - CMD(BT_CONFIG), - CMD(MCAST_FILTER_CMD), -}; -#undef CMD - -/* this forward declaration can avoid to export the function */ -static void iwl_mvm_async_handlers_wk(struct work_struct *wk); - -static struct iwl_op_mode * -iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, - const struct iwl_fw *fw, struct dentry *dbgfs_dir) -{ - struct ieee80211_hw *hw; - struct iwl_op_mode *op_mode; - struct iwl_mvm *mvm; - struct iwl_trans_config trans_cfg = {}; - static const u8 no_reclaim_cmds[] = { - TX_CMD, - }; - int err, scan_size; - - /******************************** - * 1. Allocating and configuring HW data - ********************************/ - hw = ieee80211_alloc_hw(sizeof(struct iwl_op_mode) + - sizeof(struct iwl_mvm), - &iwl_mvm_hw_ops); - if (!hw) - return NULL; - - op_mode = hw->priv; - op_mode->ops = &iwl_mvm_ops; - op_mode->trans = trans; - - mvm = IWL_OP_MODE_GET_MVM(op_mode); - mvm->dev = trans->dev; - mvm->trans = trans; - mvm->cfg = cfg; - mvm->fw = fw; - mvm->hw = hw; - - mutex_init(&mvm->mutex); - spin_lock_init(&mvm->async_handlers_lock); - INIT_LIST_HEAD(&mvm->time_event_list); - INIT_LIST_HEAD(&mvm->async_handlers_list); - spin_lock_init(&mvm->time_event_lock); - - INIT_WORK(&mvm->async_handlers_wk, iwl_mvm_async_handlers_wk); - INIT_WORK(&mvm->roc_done_wk, iwl_mvm_roc_done_wk); - INIT_WORK(&mvm->sta_drained_wk, iwl_mvm_sta_drained_wk); - - SET_IEEE80211_DEV(mvm->hw, mvm->trans->dev); - - /* - * Populate the state variables that the transport layer needs - * to know about. - */ - trans_cfg.op_mode = op_mode; - trans_cfg.no_reclaim_cmds = no_reclaim_cmds; - trans_cfg.n_no_reclaim_cmds = ARRAY_SIZE(no_reclaim_cmds); - trans_cfg.rx_buf_size_8k = iwlwifi_mod_params.amsdu_size_8K; - - if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_DW_BC_TABLE) - trans_cfg.bc_table_dword = true; - - if (!iwlwifi_mod_params.wd_disable) - trans_cfg.queue_watchdog_timeout = cfg->base_params->wd_timeout; - else - trans_cfg.queue_watchdog_timeout = IWL_WATCHDOG_DISABLED; - - trans_cfg.command_names = iwl_mvm_cmd_strings; - - trans_cfg.cmd_queue = IWL_MVM_CMD_QUEUE; - trans_cfg.cmd_fifo = IWL_MVM_CMD_FIFO; - - snprintf(mvm->hw->wiphy->fw_version, - sizeof(mvm->hw->wiphy->fw_version), - "%s", fw->fw_version); - - /* Configure transport layer */ - iwl_trans_configure(mvm->trans, &trans_cfg); - - trans->rx_mpdu_cmd = REPLY_RX_MPDU_CMD; - trans->rx_mpdu_cmd_hdr_size = sizeof(struct iwl_rx_mpdu_res_start); - - /* set up notification wait support */ - iwl_notification_wait_init(&mvm->notif_wait); - - /* Init phy db */ - mvm->phy_db = iwl_phy_db_init(trans); - if (!mvm->phy_db) { - IWL_ERR(mvm, "Cannot init phy_db\n"); - goto out_free; - } - - IWL_INFO(mvm, "Detected %s, REV=0x%X\n", - mvm->cfg->name, mvm->trans->hw_rev); - - err = iwl_trans_start_hw(mvm->trans); - if (err) - goto out_free; - - mutex_lock(&mvm->mutex); - err = iwl_run_init_mvm_ucode(mvm, true); - mutex_unlock(&mvm->mutex); - if (err && !iwlmvm_mod_params.init_dbg) { - IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", err); - goto out_free; - } - - /* Stop the hw after the ALIVE and NVM has been read */ - if (!iwlmvm_mod_params.init_dbg) - iwl_trans_stop_hw(mvm->trans, false); - - scan_size = sizeof(struct iwl_scan_cmd) + - mvm->fw->ucode_capa.max_probe_length + - (MAX_NUM_SCAN_CHANNELS * sizeof(struct iwl_scan_channel)); - mvm->scan_cmd = kmalloc(scan_size, GFP_KERNEL); - if (!mvm->scan_cmd) - goto out_free; - - err = iwl_mvm_mac_setup_register(mvm); - if (err) - goto out_free; - - err = iwl_mvm_dbgfs_register(mvm, dbgfs_dir); - if (err) - goto out_unregister; - - return op_mode; - - out_unregister: - ieee80211_unregister_hw(mvm->hw); - out_free: - iwl_phy_db_free(mvm->phy_db); - kfree(mvm->scan_cmd); - iwl_trans_stop_hw(trans, true); - ieee80211_free_hw(mvm->hw); - return NULL; -} - -static void iwl_op_mode_mvm_stop(struct iwl_op_mode *op_mode) -{ - struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); - int i; - - iwl_mvm_leds_exit(mvm); - - ieee80211_unregister_hw(mvm->hw); - - kfree(mvm->scan_cmd); - - iwl_trans_stop_hw(mvm->trans, true); - - iwl_phy_db_free(mvm->phy_db); - mvm->phy_db = NULL; - - iwl_free_nvm_data(mvm->nvm_data); - for (i = 0; i < NVM_NUM_OF_SECTIONS; i++) - kfree(mvm->nvm_sections[i].data); - - ieee80211_free_hw(mvm->hw); -} - -struct iwl_async_handler_entry { - struct list_head list; - struct iwl_rx_cmd_buffer rxb; - int (*fn)(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); -}; - -void iwl_mvm_async_handlers_purge(struct iwl_mvm *mvm) -{ - struct iwl_async_handler_entry *entry, *tmp; - - spin_lock_bh(&mvm->async_handlers_lock); - list_for_each_entry_safe(entry, tmp, &mvm->async_handlers_list, list) { - iwl_free_rxb(&entry->rxb); - list_del(&entry->list); - kfree(entry); - } - spin_unlock_bh(&mvm->async_handlers_lock); -} - -static void iwl_mvm_async_handlers_wk(struct work_struct *wk) -{ - struct iwl_mvm *mvm = - container_of(wk, struct iwl_mvm, async_handlers_wk); - struct iwl_async_handler_entry *entry, *tmp; - struct list_head local_list; - - INIT_LIST_HEAD(&local_list); - - /* Ensure that we are not in stop flow (check iwl_mvm_mac_stop) */ - mutex_lock(&mvm->mutex); - - /* - * Sync with Rx path with a lock. Remove all the entries from this list, - * add them to a local one (lock free), and then handle them. - */ - spin_lock_bh(&mvm->async_handlers_lock); - list_splice_init(&mvm->async_handlers_list, &local_list); - spin_unlock_bh(&mvm->async_handlers_lock); - - list_for_each_entry_safe(entry, tmp, &local_list, list) { - if (entry->fn(mvm, &entry->rxb, NULL)) - IWL_WARN(mvm, - "returned value from ASYNC handlers are ignored\n"); - iwl_free_rxb(&entry->rxb); - list_del(&entry->list); - kfree(entry); - } - mutex_unlock(&mvm->mutex); -} - -static int iwl_mvm_rx_dispatch(struct iwl_op_mode *op_mode, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); - u8 i; - - /* - * Do the notification wait before RX handlers so - * even if the RX handler consumes the RXB we have - * access to it in the notification wait entry. - */ - iwl_notification_wait_notify(&mvm->notif_wait, pkt); - - for (i = 0; i < ARRAY_SIZE(iwl_mvm_rx_handlers); i++) { - const struct iwl_rx_handlers *rx_h = &iwl_mvm_rx_handlers[i]; - struct iwl_async_handler_entry *entry; - - if (rx_h->cmd_id != pkt->hdr.cmd) - continue; - - if (!rx_h->async) - return rx_h->fn(mvm, rxb, cmd); - - entry = kzalloc(sizeof(*entry), GFP_ATOMIC); - /* we can't do much... */ - if (!entry) - return 0; - - entry->rxb._page = rxb_steal_page(rxb); - entry->rxb._offset = rxb->_offset; - entry->rxb._rx_page_order = rxb->_rx_page_order; - entry->fn = rx_h->fn; - spin_lock(&mvm->async_handlers_lock); - list_add_tail(&entry->list, &mvm->async_handlers_list); - spin_unlock(&mvm->async_handlers_lock); - schedule_work(&mvm->async_handlers_wk); - break; - } - - return 0; -} - -static void iwl_mvm_stop_sw_queue(struct iwl_op_mode *op_mode, int queue) -{ - struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); - int mq = mvm->queue_to_mac80211[queue]; - - if (WARN_ON_ONCE(mq == IWL_INVALID_MAC80211_QUEUE)) - return; - - if (atomic_inc_return(&mvm->queue_stop_count[mq]) > 1) { - IWL_DEBUG_TX_QUEUES(mvm, - "queue %d (mac80211 %d) already stopped\n", - queue, mq); - return; - } - - set_bit(mq, &mvm->transport_queue_stop); - ieee80211_stop_queue(mvm->hw, mq); -} - -static void iwl_mvm_wake_sw_queue(struct iwl_op_mode *op_mode, int queue) -{ - struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); - int mq = mvm->queue_to_mac80211[queue]; - - if (WARN_ON_ONCE(mq == IWL_INVALID_MAC80211_QUEUE)) - return; - - if (atomic_dec_return(&mvm->queue_stop_count[mq]) > 0) { - IWL_DEBUG_TX_QUEUES(mvm, - "queue %d (mac80211 %d) already awake\n", - queue, mq); - return; - } - - clear_bit(mq, &mvm->transport_queue_stop); - - ieee80211_wake_queue(mvm->hw, mq); -} - -static void iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) -{ - struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); - - if (state) - set_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); - else - clear_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); - - wiphy_rfkill_set_hw_state(mvm->hw->wiphy, state); -} - -static void iwl_mvm_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb) -{ - struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); - struct ieee80211_tx_info *info; - - info = IEEE80211_SKB_CB(skb); - iwl_trans_free_tx_cmd(mvm->trans, info->driver_data[1]); - ieee80211_free_txskb(mvm->hw, skb); -} - -static void iwl_mvm_nic_restart(struct iwl_mvm *mvm) -{ - iwl_abort_notification_waits(&mvm->notif_wait); - - /* - * If we're restarting already, don't cycle restarts. - * If INIT fw asserted, it will likely fail again. - * If WoWLAN fw asserted, don't restart either, mac80211 - * can't recover this since we're already half suspended. - */ - if (test_and_set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { - IWL_ERR(mvm, "Firmware error during reconfiguration! Abort.\n"); - } else if (mvm->cur_ucode == IWL_UCODE_REGULAR && - iwlwifi_mod_params.restart_fw) { - /* - * This is a bit racy, but worst case we tell mac80211 about - * a stopped/aborted (sched) scan when that was already done - * which is not a problem. It is necessary to abort any scan - * here because mac80211 requires having the scan cleared - * before restarting. - * We'll reset the scan_status to NONE in restart cleanup in - * the next start() call from mac80211. - */ - switch (mvm->scan_status) { - case IWL_MVM_SCAN_NONE: - break; - case IWL_MVM_SCAN_OS: - ieee80211_scan_completed(mvm->hw, true); - break; - } - - ieee80211_restart_hw(mvm->hw); - } -} - -static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode) -{ - struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); - - iwl_mvm_dump_nic_error_log(mvm); - - iwl_mvm_nic_restart(mvm); -} - -static void iwl_mvm_cmd_queue_full(struct iwl_op_mode *op_mode) -{ - struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); - - WARN_ON(1); - iwl_mvm_nic_restart(mvm); -} - -static const struct iwl_op_mode_ops iwl_mvm_ops = { - .start = iwl_op_mode_mvm_start, - .stop = iwl_op_mode_mvm_stop, - .rx = iwl_mvm_rx_dispatch, - .queue_full = iwl_mvm_stop_sw_queue, - .queue_not_full = iwl_mvm_wake_sw_queue, - .hw_rf_kill = iwl_mvm_set_hw_rfkill_state, - .free_skb = iwl_mvm_free_skb, - .nic_error = iwl_mvm_nic_error, - .cmd_queue_full = iwl_mvm_cmd_queue_full, - .nic_config = iwl_mvm_nic_config, -}; diff --git a/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c deleted file mode 100644 index a28a1d1f23eb..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c +++ /dev/null @@ -1,286 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#include -#include "fw-api.h" -#include "mvm.h" - -/* Maps the driver specific channel width definition to the the fw values */ -static inline u8 iwl_mvm_get_channel_width(struct cfg80211_chan_def *chandef) -{ - switch (chandef->width) { - case NL80211_CHAN_WIDTH_20_NOHT: - case NL80211_CHAN_WIDTH_20: - return PHY_VHT_CHANNEL_MODE20; - case NL80211_CHAN_WIDTH_40: - return PHY_VHT_CHANNEL_MODE40; - case NL80211_CHAN_WIDTH_80: - return PHY_VHT_CHANNEL_MODE80; - case NL80211_CHAN_WIDTH_160: - return PHY_VHT_CHANNEL_MODE160; - default: - WARN(1, "Invalid channel width=%u", chandef->width); - return PHY_VHT_CHANNEL_MODE20; - } -} - -/* - * Maps the driver specific control channel position (relative to the center - * freq) definitions to the the fw values - */ -static inline u8 iwl_mvm_get_ctrl_pos(struct cfg80211_chan_def *chandef) -{ - switch (chandef->chan->center_freq - chandef->center_freq1) { - case -70: - return PHY_VHT_CTRL_POS_4_BELOW; - case -50: - return PHY_VHT_CTRL_POS_3_BELOW; - case -30: - return PHY_VHT_CTRL_POS_2_BELOW; - case -10: - return PHY_VHT_CTRL_POS_1_BELOW; - case 10: - return PHY_VHT_CTRL_POS_1_ABOVE; - case 30: - return PHY_VHT_CTRL_POS_2_ABOVE; - case 50: - return PHY_VHT_CTRL_POS_3_ABOVE; - case 70: - return PHY_VHT_CTRL_POS_4_ABOVE; - default: - WARN(1, "Invalid channel definition"); - case 0: - /* - * The FW is expected to check the control channel position only - * when in HT/VHT and the channel width is not 20MHz. Return - * this value as the default one. - */ - return PHY_VHT_CTRL_POS_1_BELOW; - } -} - -/* - * Construct the generic fields of the PHY context command - */ -static void iwl_mvm_phy_ctxt_cmd_hdr(struct iwl_mvm_phy_ctxt *ctxt, - struct iwl_phy_context_cmd *cmd, - u32 action, u32 apply_time) -{ - memset(cmd, 0, sizeof(struct iwl_phy_context_cmd)); - - cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(ctxt->id, - ctxt->color)); - cmd->action = cpu_to_le32(action); - cmd->apply_time = cpu_to_le32(apply_time); -} - -/* - * Add the phy configuration to the PHY context command - */ -static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm, - struct iwl_phy_context_cmd *cmd, - struct cfg80211_chan_def *chandef, - u8 chains_static, u8 chains_dynamic) -{ - u8 active_cnt, idle_cnt; - - /* Set the channel info data */ - cmd->ci.band = (chandef->chan->band == IEEE80211_BAND_2GHZ ? - PHY_BAND_24 : PHY_BAND_5); - - cmd->ci.channel = chandef->chan->hw_value; - cmd->ci.width = iwl_mvm_get_channel_width(chandef); - cmd->ci.ctrl_pos = iwl_mvm_get_ctrl_pos(chandef); - - /* Set rx the chains */ - idle_cnt = chains_static; - active_cnt = chains_dynamic; - - cmd->rxchain_info = cpu_to_le32(iwl_fw_valid_rx_ant(mvm->fw) << - PHY_RX_CHAIN_VALID_POS); - cmd->rxchain_info |= cpu_to_le32(idle_cnt << PHY_RX_CHAIN_CNT_POS); - cmd->rxchain_info |= cpu_to_le32(active_cnt << - PHY_RX_CHAIN_MIMO_CNT_POS); - - cmd->txchain_info = cpu_to_le32(iwl_fw_valid_tx_ant(mvm->fw)); -} - -/* - * Send a command to apply the current phy configuration. The command is send - * only if something in the configuration changed: in case that this is the - * first time that the phy configuration is applied or in case that the phy - * configuration changed from the previous apply. - */ -static int iwl_mvm_phy_ctxt_apply(struct iwl_mvm *mvm, - struct iwl_mvm_phy_ctxt *ctxt, - struct cfg80211_chan_def *chandef, - u8 chains_static, u8 chains_dynamic, - u32 action, u32 apply_time) -{ - struct iwl_phy_context_cmd cmd; - int ret; - - /* Set the command header fields */ - iwl_mvm_phy_ctxt_cmd_hdr(ctxt, &cmd, action, apply_time); - - /* Set the command data */ - iwl_mvm_phy_ctxt_cmd_data(mvm, &cmd, chandef, - chains_static, chains_dynamic); - - ret = iwl_mvm_send_cmd_pdu(mvm, PHY_CONTEXT_CMD, CMD_SYNC, - sizeof(struct iwl_phy_context_cmd), - &cmd); - if (ret) - IWL_ERR(mvm, "PHY ctxt cmd error. ret=%d\n", ret); - return ret; -} - - -struct phy_ctx_used_data { - unsigned long used[BITS_TO_LONGS(NUM_PHY_CTX)]; -}; - -static void iwl_mvm_phy_ctx_used_iter(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *ctx, - void *_data) -{ - struct phy_ctx_used_data *data = _data; - struct iwl_mvm_phy_ctxt *phy_ctxt = (void *)ctx->drv_priv; - - __set_bit(phy_ctxt->id, data->used); -} - -/* - * Send a command to add a PHY context based on the current HW configuration. - */ -int iwl_mvm_phy_ctxt_add(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, - struct cfg80211_chan_def *chandef, - u8 chains_static, u8 chains_dynamic) -{ - struct phy_ctx_used_data data = { - .used = { }, - }; - - /* - * If this is a regular PHY context (not the ROC one) - * skip the ROC PHY context's ID. - */ - if (ctxt != &mvm->phy_ctxt_roc) - __set_bit(mvm->phy_ctxt_roc.id, data.used); - - lockdep_assert_held(&mvm->mutex); - ctxt->color++; - - if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { - ieee80211_iter_chan_contexts_atomic( - mvm->hw, iwl_mvm_phy_ctx_used_iter, &data); - - ctxt->id = find_first_zero_bit(data.used, NUM_PHY_CTX); - if (WARN_ONCE(ctxt->id == NUM_PHY_CTX, - "Failed to init PHY context - no free ID!\n")) - return -EIO; - } - - ctxt->channel = chandef->chan; - return iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, - chains_static, chains_dynamic, - FW_CTXT_ACTION_ADD, 0); -} - -/* - * Send a command to modify the PHY context based on the current HW - * configuration. Note that the function does not check that the configuration - * changed. - */ -int iwl_mvm_phy_ctxt_changed(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt, - struct cfg80211_chan_def *chandef, - u8 chains_static, u8 chains_dynamic) -{ - lockdep_assert_held(&mvm->mutex); - - ctxt->channel = chandef->chan; - return iwl_mvm_phy_ctxt_apply(mvm, ctxt, chandef, - chains_static, chains_dynamic, - FW_CTXT_ACTION_MODIFY, 0); -} - -/* - * Send a command to the FW to remove the given phy context. - * Once the command is sent, regardless of success or failure, the context is - * marked as invalid - */ -void iwl_mvm_phy_ctxt_remove(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt) -{ - struct iwl_phy_context_cmd cmd; - int ret; - - lockdep_assert_held(&mvm->mutex); - - iwl_mvm_phy_ctxt_cmd_hdr(ctxt, &cmd, FW_CTXT_ACTION_REMOVE, 0); - ret = iwl_mvm_send_cmd_pdu(mvm, PHY_CONTEXT_CMD, CMD_SYNC, - sizeof(struct iwl_phy_context_cmd), - &cmd); - if (ret) - IWL_ERR(mvm, "Failed to send PHY remove: ctxt id=%d\n", - ctxt->id); -} diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c deleted file mode 100644 index ed77e437aac4..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/power.c +++ /dev/null @@ -1,180 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#include -#include -#include -#include - -#include - -#include "iwl-debug.h" -#include "mvm.h" -#include "iwl-modparams.h" -#include "fw-api-power.h" - -#define POWER_KEEP_ALIVE_PERIOD_SEC 25 - -static void iwl_mvm_power_log(struct iwl_mvm *mvm, - struct iwl_powertable_cmd *cmd) -{ - IWL_DEBUG_POWER(mvm, - "Sending power table command for power level %d, flags = 0x%X\n", - iwlmvm_mod_params.power_scheme, - le16_to_cpu(cmd->flags)); - IWL_DEBUG_POWER(mvm, "Keep alive = %u sec\n", cmd->keep_alive_seconds); - - if (cmd->flags & cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK)) { - IWL_DEBUG_POWER(mvm, "Rx timeout = %u usec\n", - le32_to_cpu(cmd->rx_data_timeout)); - IWL_DEBUG_POWER(mvm, "Tx timeout = %u usec\n", - le32_to_cpu(cmd->tx_data_timeout)); - IWL_DEBUG_POWER(mvm, "LP RX RSSI threshold = %u\n", - cmd->lprx_rssi_threshold); - } -} - -void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct iwl_powertable_cmd *cmd) -{ - struct ieee80211_hw *hw = mvm->hw; - struct ieee80211_chanctx_conf *chanctx_conf; - struct ieee80211_channel *chan; - int dtimper, dtimper_msec; - int keep_alive; - bool radar_detect = false; - - /* - * Regardless of power management state the driver must set - * keep alive period. FW will use it for sending keep alive NDPs - * immediately after association. - */ - cmd->keep_alive_seconds = POWER_KEEP_ALIVE_PERIOD_SEC; - - if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM) - return; - - cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK); - - if (!vif->bss_conf.ps) - return; - - cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK); - - dtimper = hw->conf.ps_dtim_period ?: 1; - - /* Check if radar detection is required on current channel */ - rcu_read_lock(); - chanctx_conf = rcu_dereference(vif->chanctx_conf); - WARN_ON(!chanctx_conf); - if (chanctx_conf) { - chan = chanctx_conf->def.chan; - radar_detect = chan->flags & IEEE80211_CHAN_RADAR; - } - rcu_read_unlock(); - - /* Check skip over DTIM conditions */ - if (!radar_detect && (dtimper <= 10) && - (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_LP)) - cmd->flags |= cpu_to_le16(POWER_FLAGS_SKIP_OVER_DTIM_MSK); - - /* Check that keep alive period is at least 3 * DTIM */ - dtimper_msec = dtimper * vif->bss_conf.beacon_int; - keep_alive = max_t(int, 3 * dtimper_msec, - MSEC_PER_SEC * cmd->keep_alive_seconds); - keep_alive = DIV_ROUND_UP(keep_alive, MSEC_PER_SEC); - cmd->keep_alive_seconds = keep_alive; - - cmd->rx_data_timeout = cpu_to_le32(100 * USEC_PER_MSEC); - cmd->tx_data_timeout = cpu_to_le32(100 * USEC_PER_MSEC); -} - -int iwl_mvm_power_update_mode(struct iwl_mvm *mvm, struct ieee80211_vif *vif) -{ - struct iwl_powertable_cmd cmd = {}; - - if (vif->type != NL80211_IFTYPE_STATION || vif->p2p) - return 0; - - iwl_mvm_power_build_cmd(mvm, vif, &cmd); - iwl_mvm_power_log(mvm, &cmd); - - return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_SYNC, - sizeof(cmd), &cmd); -} - -int iwl_mvm_power_disable(struct iwl_mvm *mvm, struct ieee80211_vif *vif) -{ - struct iwl_powertable_cmd cmd = {}; - - if (vif->type != NL80211_IFTYPE_STATION || vif->p2p) - return 0; - - if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM) - cmd.flags |= cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK); - - iwl_mvm_power_log(mvm, &cmd); - - return iwl_mvm_send_cmd_pdu(mvm, POWER_TABLE_CMD, CMD_ASYNC, - sizeof(cmd), &cmd); -} diff --git a/drivers/net/wireless/iwlwifi/mvm/quota.c b/drivers/net/wireless/iwlwifi/mvm/quota.c deleted file mode 100644 index a1e3e923ea3e..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/quota.c +++ /dev/null @@ -1,198 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#include -#include "fw-api.h" -#include "mvm.h" - -struct iwl_mvm_quota_iterator_data { - int n_interfaces[MAX_BINDINGS]; - int colors[MAX_BINDINGS]; - struct ieee80211_vif *new_vif; -}; - -static void iwl_mvm_quota_iterator(void *_data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct iwl_mvm_quota_iterator_data *data = _data; - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - u16 id; - - /* - * We'll account for the new interface (if any) below, - * skip it here in case we're not called from within - * the add_interface callback (otherwise it won't show - * up in iteration) - */ - if (vif == data->new_vif) - return; - - if (!mvmvif->phy_ctxt) - return; - - /* currently, PHY ID == binding ID */ - id = mvmvif->phy_ctxt->id; - - /* need at least one binding per PHY */ - BUILD_BUG_ON(NUM_PHY_CTX > MAX_BINDINGS); - - if (WARN_ON_ONCE(id >= MAX_BINDINGS)) - return; - - if (data->colors[id] < 0) - data->colors[id] = mvmvif->phy_ctxt->color; - else - WARN_ON_ONCE(data->colors[id] != mvmvif->phy_ctxt->color); - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - if (vif->bss_conf.assoc) - data->n_interfaces[id]++; - break; - case NL80211_IFTYPE_AP: - if (mvmvif->ap_active) - data->n_interfaces[id]++; - break; - case NL80211_IFTYPE_MONITOR: - if (mvmvif->monitor_active) - data->n_interfaces[id]++; - break; - case NL80211_IFTYPE_P2P_DEVICE: - break; - case NL80211_IFTYPE_ADHOC: - if (vif->bss_conf.ibss_joined) - data->n_interfaces[id]++; - break; - default: - WARN_ON_ONCE(1); - break; - } -} - -int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif) -{ - struct iwl_time_quota_cmd cmd; - int i, idx, ret, num_active_bindings, quota, quota_rem; - struct iwl_mvm_quota_iterator_data data = { - .n_interfaces = {}, - .colors = { -1, -1, -1, -1 }, - .new_vif = newvif, - }; - - /* update all upon completion */ - if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) - return 0; - - BUILD_BUG_ON(data.colors[MAX_BINDINGS - 1] != -1); - - lockdep_assert_held(&mvm->mutex); - - memset(&cmd, 0, sizeof(cmd)); - - ieee80211_iterate_active_interfaces_atomic( - mvm->hw, IEEE80211_IFACE_ITER_NORMAL, - iwl_mvm_quota_iterator, &data); - if (newvif) { - data.new_vif = NULL; - iwl_mvm_quota_iterator(&data, newvif->addr, newvif); - } - - /* - * The FW's scheduling session consists of - * IWL_MVM_MAX_QUOTA fragments. Divide these fragments - * equally between all the bindings that require quota - */ - num_active_bindings = 0; - for (i = 0; i < MAX_BINDINGS; i++) { - cmd.quotas[i].id_and_color = cpu_to_le32(FW_CTXT_INVALID); - if (data.n_interfaces[i] > 0) - num_active_bindings++; - } - - if (!num_active_bindings) - goto send_cmd; - - quota = IWL_MVM_MAX_QUOTA / num_active_bindings; - quota_rem = IWL_MVM_MAX_QUOTA % num_active_bindings; - - for (idx = 0, i = 0; i < MAX_BINDINGS; i++) { - if (data.n_interfaces[i] <= 0) - continue; - - cmd.quotas[idx].id_and_color = - cpu_to_le32(FW_CMD_ID_AND_COLOR(i, data.colors[i])); - cmd.quotas[idx].quota = cpu_to_le32(quota); - cmd.quotas[idx].max_duration = cpu_to_le32(IWL_MVM_MAX_QUOTA); - idx++; - } - - /* Give the remainder of the session to the first binding */ - le32_add_cpu(&cmd.quotas[0].quota, quota_rem); - -send_cmd: - ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC, - sizeof(cmd), &cmd); - if (ret) - IWL_ERR(mvm, "Failed to send quota: %d\n", ret); - return ret; -} diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c deleted file mode 100644 index b99fe3163866..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/rs.c +++ /dev/null @@ -1,3083 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2005 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include "rs.h" -#include "fw-api.h" -#include "sta.h" -#include "iwl-op-mode.h" -#include "mvm.h" - -#define RS_NAME "iwl-mvm-rs" - -#define NUM_TRY_BEFORE_ANT_TOGGLE 1 -#define IWL_NUMBER_TRY 1 -#define IWL_HT_NUMBER_TRY 3 - -#define IWL_RATE_MAX_WINDOW 62 /* # tx in history window */ -#define IWL_RATE_MIN_FAILURE_TH 6 /* min failures to calc tpt */ -#define IWL_RATE_MIN_SUCCESS_TH 8 /* min successes to calc tpt */ - -/* max allowed rate miss before sync LQ cmd */ -#define IWL_MISSED_RATE_MAX 15 -/* max time to accum history 2 seconds */ -#define IWL_RATE_SCALE_FLUSH_INTVL (3*HZ) - -static u8 rs_ht_to_legacy[] = { - IWL_RATE_6M_INDEX, IWL_RATE_6M_INDEX, - IWL_RATE_6M_INDEX, IWL_RATE_6M_INDEX, - IWL_RATE_6M_INDEX, - IWL_RATE_6M_INDEX, IWL_RATE_9M_INDEX, - IWL_RATE_12M_INDEX, IWL_RATE_18M_INDEX, - IWL_RATE_24M_INDEX, IWL_RATE_36M_INDEX, - IWL_RATE_48M_INDEX, IWL_RATE_54M_INDEX -}; - -static const u8 ant_toggle_lookup[] = { - /*ANT_NONE -> */ ANT_NONE, - /*ANT_A -> */ ANT_B, - /*ANT_B -> */ ANT_C, - /*ANT_AB -> */ ANT_BC, - /*ANT_C -> */ ANT_A, - /*ANT_AC -> */ ANT_AB, - /*ANT_BC -> */ ANT_AC, - /*ANT_ABC -> */ ANT_ABC, -}; - -#define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np) \ - [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP, \ - IWL_RATE_SISO_##s##M_PLCP, \ - IWL_RATE_MIMO2_##s##M_PLCP,\ - IWL_RATE_MIMO3_##s##M_PLCP,\ - IWL_RATE_##r##M_IEEE, \ - IWL_RATE_##ip##M_INDEX, \ - IWL_RATE_##in##M_INDEX, \ - IWL_RATE_##rp##M_INDEX, \ - IWL_RATE_##rn##M_INDEX, \ - IWL_RATE_##pp##M_INDEX, \ - IWL_RATE_##np##M_INDEX } - -/* - * Parameter order: - * rate, ht rate, prev rate, next rate, prev tgg rate, next tgg rate - * - * If there isn't a valid next or previous rate then INV is used which - * maps to IWL_RATE_INVALID - * - */ -static const struct iwl_rs_rate_info iwl_rates[IWL_RATE_COUNT] = { - IWL_DECLARE_RATE_INFO(1, INV, INV, 2, INV, 2, INV, 2), /* 1mbps */ - IWL_DECLARE_RATE_INFO(2, INV, 1, 5, 1, 5, 1, 5), /* 2mbps */ - IWL_DECLARE_RATE_INFO(5, INV, 2, 6, 2, 11, 2, 11), /*5.5mbps */ - IWL_DECLARE_RATE_INFO(11, INV, 9, 12, 9, 12, 5, 18), /* 11mbps */ - IWL_DECLARE_RATE_INFO(6, 6, 5, 9, 5, 11, 5, 11), /* 6mbps */ - IWL_DECLARE_RATE_INFO(9, 6, 6, 11, 6, 11, 5, 11), /* 9mbps */ - IWL_DECLARE_RATE_INFO(12, 12, 11, 18, 11, 18, 11, 18), /* 12mbps */ - IWL_DECLARE_RATE_INFO(18, 18, 12, 24, 12, 24, 11, 24), /* 18mbps */ - IWL_DECLARE_RATE_INFO(24, 24, 18, 36, 18, 36, 18, 36), /* 24mbps */ - IWL_DECLARE_RATE_INFO(36, 36, 24, 48, 24, 48, 24, 48), /* 36mbps */ - IWL_DECLARE_RATE_INFO(48, 48, 36, 54, 36, 54, 36, 54), /* 48mbps */ - IWL_DECLARE_RATE_INFO(54, 54, 48, INV, 48, INV, 48, INV),/* 54mbps */ - IWL_DECLARE_RATE_INFO(60, 60, 48, INV, 48, INV, 48, INV),/* 60mbps */ - /* FIXME:RS: ^^ should be INV (legacy) */ -}; - -static inline u8 rs_extract_rate(u32 rate_n_flags) -{ - /* also works for HT because bits 7:6 are zero there */ - return (u8)(rate_n_flags & RATE_LEGACY_RATE_MSK); -} - -static int iwl_hwrate_to_plcp_idx(u32 rate_n_flags) -{ - int idx = 0; - - /* HT rate format */ - if (rate_n_flags & RATE_MCS_HT_MSK) { - idx = rs_extract_rate(rate_n_flags); - - if (idx >= IWL_RATE_MIMO3_6M_PLCP) - idx = idx - IWL_RATE_MIMO3_6M_PLCP; - else if (idx >= IWL_RATE_MIMO2_6M_PLCP) - idx = idx - IWL_RATE_MIMO2_6M_PLCP; - - idx += IWL_FIRST_OFDM_RATE; - /* skip 9M not supported in ht*/ - if (idx >= IWL_RATE_9M_INDEX) - idx += 1; - if ((idx >= IWL_FIRST_OFDM_RATE) && (idx <= IWL_LAST_OFDM_RATE)) - return idx; - - /* legacy rate format, search for match in table */ - } else { - for (idx = 0; idx < ARRAY_SIZE(iwl_rates); idx++) - if (iwl_rates[idx].plcp == - rs_extract_rate(rate_n_flags)) - return idx; - } - - return -1; -} - -static void rs_rate_scale_perform(struct iwl_mvm *mvm, - struct sk_buff *skb, - struct ieee80211_sta *sta, - struct iwl_lq_sta *lq_sta); -static void rs_fill_link_cmd(struct iwl_mvm *mvm, - struct iwl_lq_sta *lq_sta, u32 rate_n_flags); -static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search); - - -#ifdef CONFIG_MAC80211_DEBUGFS -static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, - u32 *rate_n_flags, int index); -#else -static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, - u32 *rate_n_flags, int index) -{} -#endif - -/** - * The following tables contain the expected throughput metrics for all rates - * - * 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54, 60 MBits - * - * where invalid entries are zeros. - * - * CCK rates are only valid in legacy table and will only be used in G - * (2.4 GHz) band. - */ - -static s32 expected_tpt_legacy[IWL_RATE_COUNT] = { - 7, 13, 35, 58, 40, 57, 72, 98, 121, 154, 177, 186, 0 -}; - -static s32 expected_tpt_siso20MHz[4][IWL_RATE_COUNT] = { - {0, 0, 0, 0, 42, 0, 76, 102, 124, 159, 183, 193, 202}, /* Norm */ - {0, 0, 0, 0, 46, 0, 82, 110, 132, 168, 192, 202, 210}, /* SGI */ - {0, 0, 0, 0, 47, 0, 91, 133, 171, 242, 305, 334, 362}, /* AGG */ - {0, 0, 0, 0, 52, 0, 101, 145, 187, 264, 330, 361, 390}, /* AGG+SGI */ -}; - -static s32 expected_tpt_siso40MHz[4][IWL_RATE_COUNT] = { - {0, 0, 0, 0, 77, 0, 127, 160, 184, 220, 242, 250, 257}, /* Norm */ - {0, 0, 0, 0, 83, 0, 135, 169, 193, 229, 250, 257, 264}, /* SGI */ - {0, 0, 0, 0, 94, 0, 177, 249, 313, 423, 512, 550, 586}, /* AGG */ - {0, 0, 0, 0, 104, 0, 193, 270, 338, 454, 545, 584, 620}, /* AGG+SGI */ -}; - -static s32 expected_tpt_mimo2_20MHz[4][IWL_RATE_COUNT] = { - {0, 0, 0, 0, 74, 0, 123, 155, 179, 214, 236, 244, 251}, /* Norm */ - {0, 0, 0, 0, 81, 0, 131, 164, 188, 223, 243, 251, 257}, /* SGI */ - {0, 0, 0, 0, 89, 0, 167, 235, 296, 402, 488, 526, 560}, /* AGG */ - {0, 0, 0, 0, 97, 0, 182, 255, 320, 431, 520, 558, 593}, /* AGG+SGI*/ -}; - -static s32 expected_tpt_mimo2_40MHz[4][IWL_RATE_COUNT] = { - {0, 0, 0, 0, 123, 0, 182, 214, 235, 264, 279, 285, 289}, /* Norm */ - {0, 0, 0, 0, 131, 0, 191, 222, 242, 270, 284, 289, 293}, /* SGI */ - {0, 0, 0, 0, 171, 0, 305, 410, 496, 634, 731, 771, 805}, /* AGG */ - {0, 0, 0, 0, 186, 0, 329, 439, 527, 667, 764, 803, 838}, /* AGG+SGI */ -}; - -static s32 expected_tpt_mimo3_20MHz[4][IWL_RATE_COUNT] = { - {0, 0, 0, 0, 99, 0, 153, 186, 208, 239, 256, 263, 268}, /* Norm */ - {0, 0, 0, 0, 106, 0, 162, 194, 215, 246, 262, 268, 273}, /* SGI */ - {0, 0, 0, 0, 134, 0, 249, 346, 431, 574, 685, 732, 775}, /* AGG */ - {0, 0, 0, 0, 148, 0, 272, 376, 465, 614, 727, 775, 818}, /* AGG+SGI */ -}; - -static s32 expected_tpt_mimo3_40MHz[4][IWL_RATE_COUNT] = { - {0, 0, 0, 0, 152, 0, 211, 239, 255, 279, 290, 294, 297}, /* Norm */ - {0, 0, 0, 0, 160, 0, 219, 245, 261, 284, 294, 297, 300}, /* SGI */ - {0, 0, 0, 0, 254, 0, 443, 584, 695, 868, 984, 1030, 1070}, /* AGG */ - {0, 0, 0, 0, 277, 0, 478, 624, 737, 911, 1026, 1070, 1109}, /* AGG+SGI */ -}; - -/* mbps, mcs */ -static const struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { - { "1", "BPSK DSSS"}, - { "2", "QPSK DSSS"}, - {"5.5", "BPSK CCK"}, - { "11", "QPSK CCK"}, - { "6", "BPSK 1/2"}, - { "9", "BPSK 1/2"}, - { "12", "QPSK 1/2"}, - { "18", "QPSK 3/4"}, - { "24", "16QAM 1/2"}, - { "36", "16QAM 3/4"}, - { "48", "64QAM 2/3"}, - { "54", "64QAM 3/4"}, - { "60", "64QAM 5/6"}, -}; - -#define MCS_INDEX_PER_STREAM (8) - -static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window) -{ - window->data = 0; - window->success_counter = 0; - window->success_ratio = IWL_INVALID_VALUE; - window->counter = 0; - window->average_tpt = IWL_INVALID_VALUE; - window->stamp = 0; -} - -static inline u8 rs_is_valid_ant(u8 valid_antenna, u8 ant_type) -{ - return (ant_type & valid_antenna) == ant_type; -} - -/* - * removes the old data from the statistics. All data that is older than - * TID_MAX_TIME_DIFF, will be deleted. - */ -static void rs_tl_rm_old_stats(struct iwl_traffic_load *tl, u32 curr_time) -{ - /* The oldest age we want to keep */ - u32 oldest_time = curr_time - TID_MAX_TIME_DIFF; - - while (tl->queue_count && - (tl->time_stamp < oldest_time)) { - tl->total -= tl->packet_count[tl->head]; - tl->packet_count[tl->head] = 0; - tl->time_stamp += TID_QUEUE_CELL_SPACING; - tl->queue_count--; - tl->head++; - if (tl->head >= TID_QUEUE_MAX_SIZE) - tl->head = 0; - } -} - -/* - * increment traffic load value for tid and also remove - * any old values if passed the certain time period - */ -static u8 rs_tl_add_packet(struct iwl_lq_sta *lq_data, - struct ieee80211_hdr *hdr) -{ - u32 curr_time = jiffies_to_msecs(jiffies); - u32 time_diff; - s32 index; - struct iwl_traffic_load *tl = NULL; - u8 tid; - - if (ieee80211_is_data_qos(hdr->frame_control)) { - u8 *qc = ieee80211_get_qos_ctl(hdr); - tid = qc[0] & 0xf; - } else { - return IWL_MAX_TID_COUNT; - } - - if (unlikely(tid >= IWL_MAX_TID_COUNT)) - return IWL_MAX_TID_COUNT; - - tl = &lq_data->load[tid]; - - curr_time -= curr_time % TID_ROUND_VALUE; - - /* Happens only for the first packet. Initialize the data */ - if (!(tl->queue_count)) { - tl->total = 1; - tl->time_stamp = curr_time; - tl->queue_count = 1; - tl->head = 0; - tl->packet_count[0] = 1; - return IWL_MAX_TID_COUNT; - } - - time_diff = TIME_WRAP_AROUND(tl->time_stamp, curr_time); - index = time_diff / TID_QUEUE_CELL_SPACING; - - /* The history is too long: remove data that is older than */ - /* TID_MAX_TIME_DIFF */ - if (index >= TID_QUEUE_MAX_SIZE) - rs_tl_rm_old_stats(tl, curr_time); - - index = (tl->head + index) % TID_QUEUE_MAX_SIZE; - tl->packet_count[index] = tl->packet_count[index] + 1; - tl->total = tl->total + 1; - - if ((index + 1) > tl->queue_count) - tl->queue_count = index + 1; - - return tid; -} - -#ifdef CONFIG_MAC80211_DEBUGFS -/** - * Program the device to use fixed rate for frame transmit - * This is for debugging/testing only - * once the device start use fixed rate, we need to reload the module - * to being back the normal operation. - */ -static void rs_program_fix_rate(struct iwl_mvm *mvm, - struct iwl_lq_sta *lq_sta) -{ - lq_sta->active_legacy_rate = 0x0FFF; /* 1 - 54 MBits, includes CCK */ - lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ - lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ - lq_sta->active_mimo3_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ - - IWL_DEBUG_RATE(mvm, "sta_id %d rate 0x%X\n", - lq_sta->lq.sta_id, lq_sta->dbg_fixed_rate); - - if (lq_sta->dbg_fixed_rate) { - rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate); - iwl_mvm_send_lq_cmd(lq_sta->drv, &lq_sta->lq, CMD_ASYNC, false); - } -} -#endif - -/* - get the traffic load value for tid -*/ -static u32 rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid) -{ - u32 curr_time = jiffies_to_msecs(jiffies); - u32 time_diff; - s32 index; - struct iwl_traffic_load *tl = NULL; - - if (tid >= IWL_MAX_TID_COUNT) - return 0; - - tl = &(lq_data->load[tid]); - - curr_time -= curr_time % TID_ROUND_VALUE; - - if (!(tl->queue_count)) - return 0; - - time_diff = TIME_WRAP_AROUND(tl->time_stamp, curr_time); - index = time_diff / TID_QUEUE_CELL_SPACING; - - /* The history is too long: remove data that is older than */ - /* TID_MAX_TIME_DIFF */ - if (index >= TID_QUEUE_MAX_SIZE) - rs_tl_rm_old_stats(tl, curr_time); - - return tl->total; -} - -static int rs_tl_turn_on_agg_for_tid(struct iwl_mvm *mvm, - struct iwl_lq_sta *lq_data, u8 tid, - struct ieee80211_sta *sta) -{ - int ret = -EAGAIN; - u32 load; - - load = rs_tl_get_load(lq_data, tid); - - if ((iwlwifi_mod_params.auto_agg) || (load > IWL_AGG_LOAD_THRESHOLD)) { - IWL_DEBUG_HT(mvm, "Starting Tx agg: STA: %pM tid: %d\n", - sta->addr, tid); - ret = ieee80211_start_tx_ba_session(sta, tid, 5000); - if (ret == -EAGAIN) { - /* - * driver and mac80211 is out of sync - * this might be cause by reloading firmware - * stop the tx ba session here - */ - IWL_ERR(mvm, "Fail start Tx agg on tid: %d\n", - tid); - ieee80211_stop_tx_ba_session(sta, tid); - } - } else { - IWL_DEBUG_HT(mvm, - "Aggregation not enabled for tid %d because load = %u\n", - tid, load); - } - return ret; -} - -static void rs_tl_turn_on_agg(struct iwl_mvm *mvm, u8 tid, - struct iwl_lq_sta *lq_data, - struct ieee80211_sta *sta) -{ - if (tid < IWL_MAX_TID_COUNT) - rs_tl_turn_on_agg_for_tid(mvm, lq_data, tid, sta); - else - IWL_ERR(mvm, "tid exceeds max TID count: %d/%d\n", - tid, IWL_MAX_TID_COUNT); -} - -static inline int get_num_of_ant_from_rate(u32 rate_n_flags) -{ - return !!(rate_n_flags & RATE_MCS_ANT_A_MSK) + - !!(rate_n_flags & RATE_MCS_ANT_B_MSK) + - !!(rate_n_flags & RATE_MCS_ANT_C_MSK); -} - -/* - * Static function to get the expected throughput from an iwl_scale_tbl_info - * that wraps a NULL pointer check - */ -static s32 get_expected_tpt(struct iwl_scale_tbl_info *tbl, int rs_index) -{ - if (tbl->expected_tpt) - return tbl->expected_tpt[rs_index]; - return 0; -} - -/** - * rs_collect_tx_data - Update the success/failure sliding window - * - * We keep a sliding window of the last 62 packets transmitted - * at this rate. window->data contains the bitmask of successful - * packets. - */ -static int rs_collect_tx_data(struct iwl_scale_tbl_info *tbl, - int scale_index, int attempts, int successes) -{ - struct iwl_rate_scale_data *window = NULL; - static const u64 mask = (((u64)1) << (IWL_RATE_MAX_WINDOW - 1)); - s32 fail_count, tpt; - - if (scale_index < 0 || scale_index >= IWL_RATE_COUNT) - return -EINVAL; - - /* Select window for current tx bit rate */ - window = &(tbl->win[scale_index]); - - /* Get expected throughput */ - tpt = get_expected_tpt(tbl, scale_index); - - /* - * Keep track of only the latest 62 tx frame attempts in this rate's - * history window; anything older isn't really relevant any more. - * If we have filled up the sliding window, drop the oldest attempt; - * if the oldest attempt (highest bit in bitmap) shows "success", - * subtract "1" from the success counter (this is the main reason - * we keep these bitmaps!). - */ - while (attempts > 0) { - if (window->counter >= IWL_RATE_MAX_WINDOW) { - /* remove earliest */ - window->counter = IWL_RATE_MAX_WINDOW - 1; - - if (window->data & mask) { - window->data &= ~mask; - window->success_counter--; - } - } - - /* Increment frames-attempted counter */ - window->counter++; - - /* Shift bitmap by one frame to throw away oldest history */ - window->data <<= 1; - - /* Mark the most recent #successes attempts as successful */ - if (successes > 0) { - window->success_counter++; - window->data |= 0x1; - successes--; - } - - attempts--; - } - - /* Calculate current success ratio, avoid divide-by-0! */ - if (window->counter > 0) - window->success_ratio = 128 * (100 * window->success_counter) - / window->counter; - else - window->success_ratio = IWL_INVALID_VALUE; - - fail_count = window->counter - window->success_counter; - - /* Calculate average throughput, if we have enough history. */ - if ((fail_count >= IWL_RATE_MIN_FAILURE_TH) || - (window->success_counter >= IWL_RATE_MIN_SUCCESS_TH)) - window->average_tpt = (window->success_ratio * tpt + 64) / 128; - else - window->average_tpt = IWL_INVALID_VALUE; - - /* Tag this window as having been updated */ - window->stamp = jiffies; - - return 0; -} - -/* - * Fill uCode API rate_n_flags field, based on "search" or "active" table. - */ -/* FIXME:RS:remove this function and put the flags statically in the table */ -static u32 rate_n_flags_from_tbl(struct iwl_mvm *mvm, - struct iwl_scale_tbl_info *tbl, - int index, u8 use_green) -{ - u32 rate_n_flags = 0; - - if (is_legacy(tbl->lq_type)) { - rate_n_flags = iwl_rates[index].plcp; - if (index >= IWL_FIRST_CCK_RATE && index <= IWL_LAST_CCK_RATE) - rate_n_flags |= RATE_MCS_CCK_MSK; - } else if (is_Ht(tbl->lq_type)) { - if (index > IWL_LAST_OFDM_RATE) { - IWL_ERR(mvm, "Invalid HT rate index %d\n", index); - index = IWL_LAST_OFDM_RATE; - } - rate_n_flags = RATE_MCS_HT_MSK; - - if (is_siso(tbl->lq_type)) - rate_n_flags |= iwl_rates[index].plcp_siso; - else if (is_mimo2(tbl->lq_type)) - rate_n_flags |= iwl_rates[index].plcp_mimo2; - else - rate_n_flags |= iwl_rates[index].plcp_mimo3; - } else { - IWL_ERR(mvm, "Invalid tbl->lq_type %d\n", tbl->lq_type); - } - - rate_n_flags |= ((tbl->ant_type << RATE_MCS_ANT_POS) & - RATE_MCS_ANT_ABC_MSK); - - if (is_Ht(tbl->lq_type)) { - if (tbl->is_ht40) - rate_n_flags |= RATE_MCS_CHAN_WIDTH_40; - if (tbl->is_SGI) - rate_n_flags |= RATE_MCS_SGI_MSK; - - if (use_green) { - rate_n_flags |= RATE_HT_MCS_GF_MSK; - if (is_siso(tbl->lq_type) && tbl->is_SGI) { - rate_n_flags &= ~RATE_MCS_SGI_MSK; - IWL_ERR(mvm, "GF was set with SGI:SISO\n"); - } - } - } - return rate_n_flags; -} - -/* - * Interpret uCode API's rate_n_flags format, - * fill "search" or "active" tx mode table. - */ -static int rs_get_tbl_info_from_mcs(const u32 rate_n_flags, - enum ieee80211_band band, - struct iwl_scale_tbl_info *tbl, - int *rate_idx) -{ - u32 ant_msk = (rate_n_flags & RATE_MCS_ANT_ABC_MSK); - u8 num_of_ant = get_num_of_ant_from_rate(rate_n_flags); - u8 mcs; - - memset(tbl, 0, sizeof(struct iwl_scale_tbl_info)); - *rate_idx = iwl_hwrate_to_plcp_idx(rate_n_flags); - - if (*rate_idx == IWL_RATE_INVALID) { - *rate_idx = -1; - return -EINVAL; - } - tbl->is_SGI = 0; /* default legacy setup */ - tbl->is_ht40 = 0; - tbl->ant_type = (ant_msk >> RATE_MCS_ANT_POS); - tbl->lq_type = LQ_NONE; - tbl->max_search = IWL_MAX_SEARCH; - - /* legacy rate format */ - if (!(rate_n_flags & RATE_MCS_HT_MSK)) { - if (num_of_ant == 1) { - if (band == IEEE80211_BAND_5GHZ) - tbl->lq_type = LQ_A; - else - tbl->lq_type = LQ_G; - } - /* HT rate format */ - } else { - if (rate_n_flags & RATE_MCS_SGI_MSK) - tbl->is_SGI = 1; - - if (rate_n_flags & RATE_MCS_CHAN_WIDTH_40) /* TODO */ - tbl->is_ht40 = 1; - - mcs = rs_extract_rate(rate_n_flags); - - /* SISO */ - if (mcs <= IWL_RATE_SISO_60M_PLCP) { - if (num_of_ant == 1) - tbl->lq_type = LQ_SISO; /*else NONE*/ - /* MIMO2 */ - } else if (mcs <= IWL_RATE_MIMO2_60M_PLCP) { - if (num_of_ant == 2) - tbl->lq_type = LQ_MIMO2; - /* MIMO3 */ - } else { - if (num_of_ant == 3) { - tbl->max_search = IWL_MAX_11N_MIMO3_SEARCH; - tbl->lq_type = LQ_MIMO3; - } - } - } - return 0; -} - -/* switch to another antenna/antennas and return 1 */ -/* if no other valid antenna found, return 0 */ -static int rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags, - struct iwl_scale_tbl_info *tbl) -{ - u8 new_ant_type; - - if (!tbl->ant_type || tbl->ant_type > ANT_ABC) - return 0; - - if (!rs_is_valid_ant(valid_ant, tbl->ant_type)) - return 0; - - new_ant_type = ant_toggle_lookup[tbl->ant_type]; - - while ((new_ant_type != tbl->ant_type) && - !rs_is_valid_ant(valid_ant, new_ant_type)) - new_ant_type = ant_toggle_lookup[new_ant_type]; - - if (new_ant_type == tbl->ant_type) - return 0; - - tbl->ant_type = new_ant_type; - *rate_n_flags &= ~RATE_MCS_ANT_ABC_MSK; - *rate_n_flags |= new_ant_type << RATE_MCS_ANT_POS; - return 1; -} - -/** - * Green-field mode is valid if the station supports it and - * there are no non-GF stations present in the BSS. - */ -static bool rs_use_green(struct ieee80211_sta *sta) -{ - /* - * There's a bug somewhere in this code that causes the - * scaling to get stuck because GF+SGI can't be combined - * in SISO rates. Until we find that bug, disable GF, it - * has only limited benefit and we still interoperate with - * GF APs since we can always receive GF transmissions. - */ - return false; -} - -/** - * rs_get_supported_rates - get the available rates - * - * if management frame or broadcast frame only return - * basic available rates. - * - */ -static u16 rs_get_supported_rates(struct iwl_lq_sta *lq_sta, - struct ieee80211_hdr *hdr, - enum iwl_table_type rate_type) -{ - if (is_legacy(rate_type)) { - return lq_sta->active_legacy_rate; - } else { - if (is_siso(rate_type)) - return lq_sta->active_siso_rate; - else if (is_mimo2(rate_type)) - return lq_sta->active_mimo2_rate; - else - return lq_sta->active_mimo3_rate; - } -} - -static u16 rs_get_adjacent_rate(struct iwl_mvm *mvm, u8 index, u16 rate_mask, - int rate_type) -{ - u8 high = IWL_RATE_INVALID; - u8 low = IWL_RATE_INVALID; - - /* 802.11A or ht walks to the next literal adjacent rate in - * the rate table */ - if (is_a_band(rate_type) || !is_legacy(rate_type)) { - int i; - u32 mask; - - /* Find the previous rate that is in the rate mask */ - i = index - 1; - for (mask = (1 << i); i >= 0; i--, mask >>= 1) { - if (rate_mask & mask) { - low = i; - break; - } - } - - /* Find the next rate that is in the rate mask */ - i = index + 1; - for (mask = (1 << i); i < IWL_RATE_COUNT; i++, mask <<= 1) { - if (rate_mask & mask) { - high = i; - break; - } - } - - return (high << 8) | low; - } - - low = index; - while (low != IWL_RATE_INVALID) { - low = iwl_rates[low].prev_rs; - if (low == IWL_RATE_INVALID) - break; - if (rate_mask & (1 << low)) - break; - IWL_DEBUG_RATE(mvm, "Skipping masked lower rate: %d\n", low); - } - - high = index; - while (high != IWL_RATE_INVALID) { - high = iwl_rates[high].next_rs; - if (high == IWL_RATE_INVALID) - break; - if (rate_mask & (1 << high)) - break; - IWL_DEBUG_RATE(mvm, "Skipping masked higher rate: %d\n", high); - } - - return (high << 8) | low; -} - -static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta, - struct iwl_scale_tbl_info *tbl, - u8 scale_index, u8 ht_possible) -{ - s32 low; - u16 rate_mask; - u16 high_low; - u8 switch_to_legacy = 0; - u8 is_green = lq_sta->is_green; - struct iwl_mvm *mvm = lq_sta->drv; - - /* check if we need to switch from HT to legacy rates. - * assumption is that mandatory rates (1Mbps or 6Mbps) - * are always supported (spec demand) */ - if (!is_legacy(tbl->lq_type) && (!ht_possible || !scale_index)) { - switch_to_legacy = 1; - scale_index = rs_ht_to_legacy[scale_index]; - if (lq_sta->band == IEEE80211_BAND_5GHZ) - tbl->lq_type = LQ_A; - else - tbl->lq_type = LQ_G; - - if (num_of_ant(tbl->ant_type) > 1) - tbl->ant_type = - first_antenna(iwl_fw_valid_tx_ant(mvm->fw)); - - tbl->is_ht40 = 0; - tbl->is_SGI = 0; - tbl->max_search = IWL_MAX_SEARCH; - } - - rate_mask = rs_get_supported_rates(lq_sta, NULL, tbl->lq_type); - - /* Mask with station rate restriction */ - if (is_legacy(tbl->lq_type)) { - /* supp_rates has no CCK bits in A mode */ - if (lq_sta->band == IEEE80211_BAND_5GHZ) - rate_mask = (u16)(rate_mask & - (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE)); - else - rate_mask = (u16)(rate_mask & lq_sta->supp_rates); - } - - /* If we switched from HT to legacy, check current rate */ - if (switch_to_legacy && (rate_mask & (1 << scale_index))) { - low = scale_index; - goto out; - } - - high_low = rs_get_adjacent_rate(lq_sta->drv, scale_index, rate_mask, - tbl->lq_type); - low = high_low & 0xff; - - if (low == IWL_RATE_INVALID) - low = scale_index; - -out: - return rate_n_flags_from_tbl(lq_sta->drv, tbl, low, is_green); -} - -/* - * Simple function to compare two rate scale table types - */ -static bool table_type_matches(struct iwl_scale_tbl_info *a, - struct iwl_scale_tbl_info *b) -{ - return (a->lq_type == b->lq_type) && (a->ant_type == b->ant_type) && - (a->is_SGI == b->is_SGI); -} - -/* - * mac80211 sends us Tx status - */ -static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta, - struct sk_buff *skb) -{ - int legacy_success; - int retries; - int rs_index, mac_index, i; - struct iwl_lq_sta *lq_sta = priv_sta; - struct iwl_lq_cmd *table; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct iwl_op_mode *op_mode = (struct iwl_op_mode *)mvm_r; - struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - enum mac80211_rate_control_flags mac_flags; - u32 tx_rate; - struct iwl_scale_tbl_info tbl_type; - struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; - - IWL_DEBUG_RATE_LIMIT(mvm, - "get frame ack response, update rate scale window\n"); - - /* Treat uninitialized rate scaling data same as non-existing. */ - if (!lq_sta) { - IWL_DEBUG_RATE(mvm, "Station rate scaling not created yet.\n"); - return; - } else if (!lq_sta->drv) { - IWL_DEBUG_RATE(mvm, "Rate scaling not initialized yet.\n"); - return; - } - - if (!ieee80211_is_data(hdr->frame_control) || - info->flags & IEEE80211_TX_CTL_NO_ACK) - return; - - /* This packet was aggregated but doesn't carry status info */ - if ((info->flags & IEEE80211_TX_CTL_AMPDU) && - !(info->flags & IEEE80211_TX_STAT_AMPDU)) - return; - - /* - * Ignore this Tx frame response if its initial rate doesn't match - * that of latest Link Quality command. There may be stragglers - * from a previous Link Quality command, but we're no longer interested - * in those; they're either from the "active" mode while we're trying - * to check "search" mode, or a prior "search" mode after we've moved - * to a new "search" mode (which might become the new "active" mode). - */ - table = &lq_sta->lq; - tx_rate = le32_to_cpu(table->rs_table[0]); - rs_get_tbl_info_from_mcs(tx_rate, info->band, &tbl_type, &rs_index); - if (info->band == IEEE80211_BAND_5GHZ) - rs_index -= IWL_FIRST_OFDM_RATE; - mac_flags = info->status.rates[0].flags; - mac_index = info->status.rates[0].idx; - /* For HT packets, map MCS to PLCP */ - if (mac_flags & IEEE80211_TX_RC_MCS) { - /* Remove # of streams */ - mac_index &= RATE_HT_MCS_RATE_CODE_MSK; - if (mac_index >= (IWL_RATE_9M_INDEX - IWL_FIRST_OFDM_RATE)) - mac_index++; - /* - * mac80211 HT index is always zero-indexed; we need to move - * HT OFDM rates after CCK rates in 2.4 GHz band - */ - if (info->band == IEEE80211_BAND_2GHZ) - mac_index += IWL_FIRST_OFDM_RATE; - } - /* Here we actually compare this rate to the latest LQ command */ - if ((mac_index < 0) || - (tbl_type.is_SGI != !!(mac_flags & IEEE80211_TX_RC_SHORT_GI)) || - (tbl_type.is_ht40 != !!(mac_flags & IEEE80211_TX_RC_40_MHZ_WIDTH)) || - (tbl_type.ant_type != info->status.antenna) || - (!!(tx_rate & RATE_MCS_HT_MSK) != - !!(mac_flags & IEEE80211_TX_RC_MCS)) || - (!!(tx_rate & RATE_HT_MCS_GF_MSK) != - !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD)) || - (rs_index != mac_index)) { - IWL_DEBUG_RATE(mvm, - "initial rate %d does not match %d (0x%x)\n", - mac_index, rs_index, tx_rate); - /* - * Since rates mis-match, the last LQ command may have failed. - * After IWL_MISSED_RATE_MAX mis-matches, resync the uCode with - * ... driver. - */ - lq_sta->missed_rate_counter++; - if (lq_sta->missed_rate_counter > IWL_MISSED_RATE_MAX) { - lq_sta->missed_rate_counter = 0; - iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, CMD_ASYNC, false); - } - /* Regardless, ignore this status info for outdated rate */ - return; - } else - /* Rate did match, so reset the missed_rate_counter */ - lq_sta->missed_rate_counter = 0; - - /* Figure out if rate scale algorithm is in active or search table */ - if (table_type_matches(&tbl_type, - &(lq_sta->lq_info[lq_sta->active_tbl]))) { - curr_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - other_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); - } else if (table_type_matches( - &tbl_type, &lq_sta->lq_info[1 - lq_sta->active_tbl])) { - curr_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); - other_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - } else { - IWL_DEBUG_RATE(mvm, - "Neither active nor search matches tx rate\n"); - tmp_tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - IWL_DEBUG_RATE(mvm, "active- lq:%x, ant:%x, SGI:%d\n", - tmp_tbl->lq_type, tmp_tbl->ant_type, - tmp_tbl->is_SGI); - tmp_tbl = &(lq_sta->lq_info[1 - lq_sta->active_tbl]); - IWL_DEBUG_RATE(mvm, "search- lq:%x, ant:%x, SGI:%d\n", - tmp_tbl->lq_type, tmp_tbl->ant_type, - tmp_tbl->is_SGI); - IWL_DEBUG_RATE(mvm, "actual- lq:%x, ant:%x, SGI:%d\n", - tbl_type.lq_type, tbl_type.ant_type, - tbl_type.is_SGI); - /* - * no matching table found, let's by-pass the data collection - * and continue to perform rate scale to find the rate table - */ - rs_stay_in_table(lq_sta, true); - goto done; - } - - /* - * Updating the frame history depends on whether packets were - * aggregated. - * - * For aggregation, all packets were transmitted at the same rate, the - * first index into rate scale table. - */ - if (info->flags & IEEE80211_TX_STAT_AMPDU) { - tx_rate = le32_to_cpu(table->rs_table[0]); - rs_get_tbl_info_from_mcs(tx_rate, info->band, &tbl_type, - &rs_index); - rs_collect_tx_data(curr_tbl, rs_index, - info->status.ampdu_len, - info->status.ampdu_ack_len); - - /* Update success/fail counts if not searching for new mode */ - if (lq_sta->stay_in_tbl) { - lq_sta->total_success += info->status.ampdu_ack_len; - lq_sta->total_failed += (info->status.ampdu_len - - info->status.ampdu_ack_len); - } - } else { - /* - * For legacy, update frame history with for each Tx retry. - */ - retries = info->status.rates[0].count - 1; - /* HW doesn't send more than 15 retries */ - retries = min(retries, 15); - - /* The last transmission may have been successful */ - legacy_success = !!(info->flags & IEEE80211_TX_STAT_ACK); - /* Collect data for each rate used during failed TX attempts */ - for (i = 0; i <= retries; ++i) { - tx_rate = le32_to_cpu(table->rs_table[i]); - rs_get_tbl_info_from_mcs(tx_rate, info->band, - &tbl_type, &rs_index); - /* - * Only collect stats if retried rate is in the same RS - * table as active/search. - */ - if (table_type_matches(&tbl_type, curr_tbl)) - tmp_tbl = curr_tbl; - else if (table_type_matches(&tbl_type, other_tbl)) - tmp_tbl = other_tbl; - else - continue; - rs_collect_tx_data(tmp_tbl, rs_index, 1, - i < retries ? 0 : legacy_success); - } - - /* Update success/fail counts if not searching for new mode */ - if (lq_sta->stay_in_tbl) { - lq_sta->total_success += legacy_success; - lq_sta->total_failed += retries + (1 - legacy_success); - } - } - /* The last TX rate is cached in lq_sta; it's set in if/else above */ - lq_sta->last_rate_n_flags = tx_rate; -done: - /* See if there's a better rate or modulation mode to try. */ - if (sta && sta->supp_rates[sband->band]) - rs_rate_scale_perform(mvm, skb, sta, lq_sta); -} - -/* - * Begin a period of staying with a selected modulation mode. - * Set "stay_in_tbl" flag to prevent any mode switches. - * Set frame tx success limits according to legacy vs. high-throughput, - * and reset overall (spanning all rates) tx success history statistics. - * These control how long we stay using same modulation mode before - * searching for a new mode. - */ -static void rs_set_stay_in_table(struct iwl_mvm *mvm, u8 is_legacy, - struct iwl_lq_sta *lq_sta) -{ - IWL_DEBUG_RATE(mvm, "we are staying in the same table\n"); - lq_sta->stay_in_tbl = 1; /* only place this gets set */ - if (is_legacy) { - lq_sta->table_count_limit = IWL_LEGACY_TABLE_COUNT; - lq_sta->max_failure_limit = IWL_LEGACY_FAILURE_LIMIT; - lq_sta->max_success_limit = IWL_LEGACY_SUCCESS_LIMIT; - } else { - lq_sta->table_count_limit = IWL_NONE_LEGACY_TABLE_COUNT; - lq_sta->max_failure_limit = IWL_NONE_LEGACY_FAILURE_LIMIT; - lq_sta->max_success_limit = IWL_NONE_LEGACY_SUCCESS_LIMIT; - } - lq_sta->table_count = 0; - lq_sta->total_failed = 0; - lq_sta->total_success = 0; - lq_sta->flush_timer = jiffies; - lq_sta->action_counter = 0; -} - -/* - * Find correct throughput table for given mode of modulation - */ -static void rs_set_expected_tpt_table(struct iwl_lq_sta *lq_sta, - struct iwl_scale_tbl_info *tbl) -{ - /* Used to choose among HT tables */ - s32 (*ht_tbl_pointer)[IWL_RATE_COUNT]; - - /* Check for invalid LQ type */ - if (WARN_ON_ONCE(!is_legacy(tbl->lq_type) && !is_Ht(tbl->lq_type))) { - tbl->expected_tpt = expected_tpt_legacy; - return; - } - - /* Legacy rates have only one table */ - if (is_legacy(tbl->lq_type)) { - tbl->expected_tpt = expected_tpt_legacy; - return; - } - - /* Choose among many HT tables depending on number of streams - * (SISO/MIMO2/MIMO3), channel width (20/40), SGI, and aggregation - * status */ - if (is_siso(tbl->lq_type) && !tbl->is_ht40) - ht_tbl_pointer = expected_tpt_siso20MHz; - else if (is_siso(tbl->lq_type)) - ht_tbl_pointer = expected_tpt_siso40MHz; - else if (is_mimo2(tbl->lq_type) && !tbl->is_ht40) - ht_tbl_pointer = expected_tpt_mimo2_20MHz; - else if (is_mimo2(tbl->lq_type)) - ht_tbl_pointer = expected_tpt_mimo2_40MHz; - else if (is_mimo3(tbl->lq_type) && !tbl->is_ht40) - ht_tbl_pointer = expected_tpt_mimo3_20MHz; - else /* if (is_mimo3(tbl->lq_type)) <-- must be true */ - ht_tbl_pointer = expected_tpt_mimo3_40MHz; - - if (!tbl->is_SGI && !lq_sta->is_agg) /* Normal */ - tbl->expected_tpt = ht_tbl_pointer[0]; - else if (tbl->is_SGI && !lq_sta->is_agg) /* SGI */ - tbl->expected_tpt = ht_tbl_pointer[1]; - else if (!tbl->is_SGI && lq_sta->is_agg) /* AGG */ - tbl->expected_tpt = ht_tbl_pointer[2]; - else /* AGG+SGI */ - tbl->expected_tpt = ht_tbl_pointer[3]; -} - -/* - * Find starting rate for new "search" high-throughput mode of modulation. - * Goal is to find lowest expected rate (under perfect conditions) that is - * above the current measured throughput of "active" mode, to give new mode - * a fair chance to prove itself without too many challenges. - * - * This gets called when transitioning to more aggressive modulation - * (i.e. legacy to SISO or MIMO, or SISO to MIMO), as well as less aggressive - * (i.e. MIMO to SISO). When moving to MIMO, bit rate will typically need - * to decrease to match "active" throughput. When moving from MIMO to SISO, - * bit rate will typically need to increase, but not if performance was bad. - */ -static s32 rs_get_best_rate(struct iwl_mvm *mvm, - struct iwl_lq_sta *lq_sta, - struct iwl_scale_tbl_info *tbl, /* "search" */ - u16 rate_mask, s8 index) -{ - /* "active" values */ - struct iwl_scale_tbl_info *active_tbl = - &(lq_sta->lq_info[lq_sta->active_tbl]); - s32 active_sr = active_tbl->win[index].success_ratio; - s32 active_tpt = active_tbl->expected_tpt[index]; - - /* expected "search" throughput */ - s32 *tpt_tbl = tbl->expected_tpt; - - s32 new_rate, high, low, start_hi; - u16 high_low; - s8 rate = index; - - new_rate = high = low = start_hi = IWL_RATE_INVALID; - - while (1) { - high_low = rs_get_adjacent_rate(mvm, rate, rate_mask, - tbl->lq_type); - - low = high_low & 0xff; - high = (high_low >> 8) & 0xff; - - /* - * Lower the "search" bit rate, to give new "search" mode - * approximately the same throughput as "active" if: - * - * 1) "Active" mode has been working modestly well (but not - * great), and expected "search" throughput (under perfect - * conditions) at candidate rate is above the actual - * measured "active" throughput (but less than expected - * "active" throughput under perfect conditions). - * OR - * 2) "Active" mode has been working perfectly or very well - * and expected "search" throughput (under perfect - * conditions) at candidate rate is above expected - * "active" throughput (under perfect conditions). - */ - if ((((100 * tpt_tbl[rate]) > lq_sta->last_tpt) && - ((active_sr > IWL_RATE_DECREASE_TH) && - (active_sr <= IWL_RATE_HIGH_TH) && - (tpt_tbl[rate] <= active_tpt))) || - ((active_sr >= IWL_RATE_SCALE_SWITCH) && - (tpt_tbl[rate] > active_tpt))) { - /* (2nd or later pass) - * If we've already tried to raise the rate, and are - * now trying to lower it, use the higher rate. */ - if (start_hi != IWL_RATE_INVALID) { - new_rate = start_hi; - break; - } - - new_rate = rate; - - /* Loop again with lower rate */ - if (low != IWL_RATE_INVALID) - rate = low; - - /* Lower rate not available, use the original */ - else - break; - - /* Else try to raise the "search" rate to match "active" */ - } else { - /* (2nd or later pass) - * If we've already tried to lower the rate, and are - * now trying to raise it, use the lower rate. */ - if (new_rate != IWL_RATE_INVALID) - break; - - /* Loop again with higher rate */ - else if (high != IWL_RATE_INVALID) { - start_hi = high; - rate = high; - - /* Higher rate not available, use the original */ - } else { - new_rate = rate; - break; - } - } - } - - return new_rate; -} - -static bool iwl_is_ht40_tx_allowed(struct ieee80211_sta *sta) -{ - return sta->bandwidth >= IEEE80211_STA_RX_BW_40; -} - -/* - * Set up search table for MIMO2 - */ -static int rs_switch_to_mimo2(struct iwl_mvm *mvm, - struct iwl_lq_sta *lq_sta, - struct ieee80211_sta *sta, - struct iwl_scale_tbl_info *tbl, int index) -{ - u16 rate_mask; - s32 rate; - s8 is_green = lq_sta->is_green; - - if (!sta->ht_cap.ht_supported) - return -1; - - if (sta->smps_mode == IEEE80211_SMPS_STATIC) - return -1; - - /* Need both Tx chains/antennas to support MIMO */ - if (num_of_ant(iwl_fw_valid_tx_ant(mvm->fw)) < 2) - return -1; - - IWL_DEBUG_RATE(mvm, "LQ: try to switch to MIMO2\n"); - - tbl->lq_type = LQ_MIMO2; - tbl->action = 0; - tbl->max_search = IWL_MAX_SEARCH; - rate_mask = lq_sta->active_mimo2_rate; - - if (iwl_is_ht40_tx_allowed(sta)) - tbl->is_ht40 = 1; - else - tbl->is_ht40 = 0; - - rs_set_expected_tpt_table(lq_sta, tbl); - - rate = rs_get_best_rate(mvm, lq_sta, tbl, rate_mask, index); - - IWL_DEBUG_RATE(mvm, "LQ: MIMO2 best rate %d mask %X\n", - rate, rate_mask); - if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { - IWL_DEBUG_RATE(mvm, "Can't switch with index %d rate mask %x\n", - rate, rate_mask); - return -1; - } - tbl->current_rate = rate_n_flags_from_tbl(mvm, tbl, rate, is_green); - - IWL_DEBUG_RATE(mvm, "LQ: Switch to new mcs %X index is green %X\n", - tbl->current_rate, is_green); - return 0; -} - -/* - * Set up search table for MIMO3 - */ -static int rs_switch_to_mimo3(struct iwl_mvm *mvm, - struct iwl_lq_sta *lq_sta, - struct ieee80211_sta *sta, - struct iwl_scale_tbl_info *tbl, int index) -{ - u16 rate_mask; - s32 rate; - s8 is_green = lq_sta->is_green; - - if (!sta->ht_cap.ht_supported) - return -1; - - if (sta->smps_mode == IEEE80211_SMPS_STATIC) - return -1; - - /* Need both Tx chains/antennas to support MIMO */ - if (num_of_ant(iwl_fw_valid_tx_ant(mvm->fw)) < 3) - return -1; - - IWL_DEBUG_RATE(mvm, "LQ: try to switch to MIMO3\n"); - - tbl->lq_type = LQ_MIMO3; - tbl->action = 0; - tbl->max_search = IWL_MAX_11N_MIMO3_SEARCH; - rate_mask = lq_sta->active_mimo3_rate; - - if (iwl_is_ht40_tx_allowed(sta)) - tbl->is_ht40 = 1; - else - tbl->is_ht40 = 0; - - rs_set_expected_tpt_table(lq_sta, tbl); - - rate = rs_get_best_rate(mvm, lq_sta, tbl, rate_mask, index); - - IWL_DEBUG_RATE(mvm, "LQ: MIMO3 best rate %d mask %X\n", - rate, rate_mask); - if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { - IWL_DEBUG_RATE(mvm, "Can't switch with index %d rate mask %x\n", - rate, rate_mask); - return -1; - } - tbl->current_rate = rate_n_flags_from_tbl(mvm, tbl, rate, is_green); - - IWL_DEBUG_RATE(mvm, "LQ: Switch to new mcs %X index is green %X\n", - tbl->current_rate, is_green); - return 0; -} - -/* - * Set up search table for SISO - */ -static int rs_switch_to_siso(struct iwl_mvm *mvm, - struct iwl_lq_sta *lq_sta, - struct ieee80211_sta *sta, - struct iwl_scale_tbl_info *tbl, int index) -{ - u16 rate_mask; - u8 is_green = lq_sta->is_green; - s32 rate; - - if (!sta->ht_cap.ht_supported) - return -1; - - IWL_DEBUG_RATE(mvm, "LQ: try to switch to SISO\n"); - - tbl->lq_type = LQ_SISO; - tbl->action = 0; - tbl->max_search = IWL_MAX_SEARCH; - rate_mask = lq_sta->active_siso_rate; - - if (iwl_is_ht40_tx_allowed(sta)) - tbl->is_ht40 = 1; - else - tbl->is_ht40 = 0; - - if (is_green) - tbl->is_SGI = 0; /*11n spec: no SGI in SISO+Greenfield*/ - - rs_set_expected_tpt_table(lq_sta, tbl); - rate = rs_get_best_rate(mvm, lq_sta, tbl, rate_mask, index); - - IWL_DEBUG_RATE(mvm, "LQ: get best rate %d mask %X\n", rate, rate_mask); - if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { - IWL_DEBUG_RATE(mvm, - "can not switch with index %d rate mask %x\n", - rate, rate_mask); - return -1; - } - tbl->current_rate = rate_n_flags_from_tbl(mvm, tbl, rate, is_green); - IWL_DEBUG_RATE(mvm, "LQ: Switch to new mcs %X index is green %X\n", - tbl->current_rate, is_green); - return 0; -} - -/* - * Try to switch to new modulation mode from legacy - */ -static int rs_move_legacy_other(struct iwl_mvm *mvm, - struct iwl_lq_sta *lq_sta, - struct ieee80211_sta *sta, - int index) -{ - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - struct iwl_scale_tbl_info *search_tbl = - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - struct iwl_rate_scale_data *window = &(tbl->win[index]); - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); - u8 start_action; - u8 valid_tx_ant = iwl_fw_valid_tx_ant(mvm->fw); - u8 tx_chains_num = num_of_ant(valid_tx_ant); - int ret; - u8 update_search_tbl_counter = 0; - - start_action = tbl->action; - while (1) { - lq_sta->action_counter++; - switch (tbl->action) { - case IWL_LEGACY_SWITCH_ANTENNA1: - case IWL_LEGACY_SWITCH_ANTENNA2: - IWL_DEBUG_RATE(mvm, "LQ: Legacy toggle Antenna\n"); - - if ((tbl->action == IWL_LEGACY_SWITCH_ANTENNA1 && - tx_chains_num <= 1) || - (tbl->action == IWL_LEGACY_SWITCH_ANTENNA2 && - tx_chains_num <= 2)) - break; - - /* Don't change antenna if success has been great */ - if (window->success_ratio >= IWL_RS_GOOD_RATIO) - break; - - /* Set up search table to try other antenna */ - memcpy(search_tbl, tbl, sz); - - if (rs_toggle_antenna(valid_tx_ant, - &search_tbl->current_rate, - search_tbl)) { - update_search_tbl_counter = 1; - rs_set_expected_tpt_table(lq_sta, search_tbl); - goto out; - } - break; - case IWL_LEGACY_SWITCH_SISO: - IWL_DEBUG_RATE(mvm, "LQ: Legacy switch to SISO\n"); - - /* Set up search table to try SISO */ - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - ret = rs_switch_to_siso(mvm, lq_sta, sta, - search_tbl, index); - if (!ret) { - lq_sta->action_counter = 0; - goto out; - } - - break; - case IWL_LEGACY_SWITCH_MIMO2_AB: - case IWL_LEGACY_SWITCH_MIMO2_AC: - case IWL_LEGACY_SWITCH_MIMO2_BC: - IWL_DEBUG_RATE(mvm, "LQ: Legacy switch to MIMO2\n"); - - /* Set up search table to try MIMO */ - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - - if (tbl->action == IWL_LEGACY_SWITCH_MIMO2_AB) - search_tbl->ant_type = ANT_AB; - else if (tbl->action == IWL_LEGACY_SWITCH_MIMO2_AC) - search_tbl->ant_type = ANT_AC; - else - search_tbl->ant_type = ANT_BC; - - if (!rs_is_valid_ant(valid_tx_ant, - search_tbl->ant_type)) - break; - - ret = rs_switch_to_mimo2(mvm, lq_sta, sta, - search_tbl, index); - if (!ret) { - lq_sta->action_counter = 0; - goto out; - } - break; - - case IWL_LEGACY_SWITCH_MIMO3_ABC: - IWL_DEBUG_RATE(mvm, "LQ: Legacy switch to MIMO3\n"); - - /* Set up search table to try MIMO3 */ - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - - search_tbl->ant_type = ANT_ABC; - - if (!rs_is_valid_ant(valid_tx_ant, - search_tbl->ant_type)) - break; - - ret = rs_switch_to_mimo3(mvm, lq_sta, sta, - search_tbl, index); - if (!ret) { - lq_sta->action_counter = 0; - goto out; - } - break; - } - tbl->action++; - if (tbl->action > IWL_LEGACY_SWITCH_MIMO3_ABC) - tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; - - if (tbl->action == start_action) - break; - } - search_tbl->lq_type = LQ_NONE; - return 0; - -out: - lq_sta->search_better_tbl = 1; - tbl->action++; - if (tbl->action > IWL_LEGACY_SWITCH_MIMO3_ABC) - tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; - if (update_search_tbl_counter) - search_tbl->action = tbl->action; - return 0; -} - -/* - * Try to switch to new modulation mode from SISO - */ -static int rs_move_siso_to_other(struct iwl_mvm *mvm, - struct iwl_lq_sta *lq_sta, - struct ieee80211_sta *sta, int index) -{ - u8 is_green = lq_sta->is_green; - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - struct iwl_scale_tbl_info *search_tbl = - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - struct iwl_rate_scale_data *window = &(tbl->win[index]); - struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); - u8 start_action; - u8 valid_tx_ant = iwl_fw_valid_tx_ant(mvm->fw); - u8 tx_chains_num = num_of_ant(valid_tx_ant); - u8 update_search_tbl_counter = 0; - int ret; - - start_action = tbl->action; - while (1) { - lq_sta->action_counter++; - switch (tbl->action) { - case IWL_SISO_SWITCH_ANTENNA1: - case IWL_SISO_SWITCH_ANTENNA2: - IWL_DEBUG_RATE(mvm, "LQ: SISO toggle Antenna\n"); - if ((tbl->action == IWL_SISO_SWITCH_ANTENNA1 && - tx_chains_num <= 1) || - (tbl->action == IWL_SISO_SWITCH_ANTENNA2 && - tx_chains_num <= 2)) - break; - - if (window->success_ratio >= IWL_RS_GOOD_RATIO) - break; - - memcpy(search_tbl, tbl, sz); - if (rs_toggle_antenna(valid_tx_ant, - &search_tbl->current_rate, - search_tbl)) { - update_search_tbl_counter = 1; - goto out; - } - break; - case IWL_SISO_SWITCH_MIMO2_AB: - case IWL_SISO_SWITCH_MIMO2_AC: - case IWL_SISO_SWITCH_MIMO2_BC: - IWL_DEBUG_RATE(mvm, "LQ: SISO switch to MIMO2\n"); - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - - if (tbl->action == IWL_SISO_SWITCH_MIMO2_AB) - search_tbl->ant_type = ANT_AB; - else if (tbl->action == IWL_SISO_SWITCH_MIMO2_AC) - search_tbl->ant_type = ANT_AC; - else - search_tbl->ant_type = ANT_BC; - - if (!rs_is_valid_ant(valid_tx_ant, - search_tbl->ant_type)) - break; - - ret = rs_switch_to_mimo2(mvm, lq_sta, sta, - search_tbl, index); - if (!ret) - goto out; - break; - case IWL_SISO_SWITCH_GI: - if (!tbl->is_ht40 && !(ht_cap->cap & - IEEE80211_HT_CAP_SGI_20)) - break; - if (tbl->is_ht40 && !(ht_cap->cap & - IEEE80211_HT_CAP_SGI_40)) - break; - - IWL_DEBUG_RATE(mvm, "LQ: SISO toggle SGI/NGI\n"); - - memcpy(search_tbl, tbl, sz); - if (is_green) { - if (!tbl->is_SGI) - break; - else - IWL_ERR(mvm, - "SGI was set in GF+SISO\n"); - } - search_tbl->is_SGI = !tbl->is_SGI; - rs_set_expected_tpt_table(lq_sta, search_tbl); - if (tbl->is_SGI) { - s32 tpt = lq_sta->last_tpt / 100; - if (tpt >= search_tbl->expected_tpt[index]) - break; - } - search_tbl->current_rate = - rate_n_flags_from_tbl(mvm, search_tbl, - index, is_green); - update_search_tbl_counter = 1; - goto out; - case IWL_SISO_SWITCH_MIMO3_ABC: - IWL_DEBUG_RATE(mvm, "LQ: SISO switch to MIMO3\n"); - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - search_tbl->ant_type = ANT_ABC; - - if (!rs_is_valid_ant(valid_tx_ant, - search_tbl->ant_type)) - break; - - ret = rs_switch_to_mimo3(mvm, lq_sta, sta, - search_tbl, index); - if (!ret) - goto out; - break; - } - tbl->action++; - if (tbl->action > IWL_LEGACY_SWITCH_MIMO3_ABC) - tbl->action = IWL_SISO_SWITCH_ANTENNA1; - - if (tbl->action == start_action) - break; - } - search_tbl->lq_type = LQ_NONE; - return 0; - - out: - lq_sta->search_better_tbl = 1; - tbl->action++; - if (tbl->action > IWL_SISO_SWITCH_MIMO3_ABC) - tbl->action = IWL_SISO_SWITCH_ANTENNA1; - if (update_search_tbl_counter) - search_tbl->action = tbl->action; - - return 0; -} - -/* - * Try to switch to new modulation mode from MIMO2 - */ -static int rs_move_mimo2_to_other(struct iwl_mvm *mvm, - struct iwl_lq_sta *lq_sta, - struct ieee80211_sta *sta, int index) -{ - s8 is_green = lq_sta->is_green; - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - struct iwl_scale_tbl_info *search_tbl = - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - struct iwl_rate_scale_data *window = &(tbl->win[index]); - struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); - u8 start_action; - u8 valid_tx_ant = iwl_fw_valid_tx_ant(mvm->fw); - u8 tx_chains_num = num_of_ant(valid_tx_ant); - u8 update_search_tbl_counter = 0; - int ret; - - start_action = tbl->action; - while (1) { - lq_sta->action_counter++; - switch (tbl->action) { - case IWL_MIMO2_SWITCH_ANTENNA1: - case IWL_MIMO2_SWITCH_ANTENNA2: - IWL_DEBUG_RATE(mvm, "LQ: MIMO2 toggle Antennas\n"); - - if (tx_chains_num <= 2) - break; - - if (window->success_ratio >= IWL_RS_GOOD_RATIO) - break; - - memcpy(search_tbl, tbl, sz); - if (rs_toggle_antenna(valid_tx_ant, - &search_tbl->current_rate, - search_tbl)) { - update_search_tbl_counter = 1; - goto out; - } - break; - case IWL_MIMO2_SWITCH_SISO_A: - case IWL_MIMO2_SWITCH_SISO_B: - case IWL_MIMO2_SWITCH_SISO_C: - IWL_DEBUG_RATE(mvm, "LQ: MIMO2 switch to SISO\n"); - - /* Set up new search table for SISO */ - memcpy(search_tbl, tbl, sz); - - if (tbl->action == IWL_MIMO2_SWITCH_SISO_A) - search_tbl->ant_type = ANT_A; - else if (tbl->action == IWL_MIMO2_SWITCH_SISO_B) - search_tbl->ant_type = ANT_B; - else - search_tbl->ant_type = ANT_C; - - if (!rs_is_valid_ant(valid_tx_ant, - search_tbl->ant_type)) - break; - - ret = rs_switch_to_siso(mvm, lq_sta, sta, - search_tbl, index); - if (!ret) - goto out; - - break; - - case IWL_MIMO2_SWITCH_GI: - if (!tbl->is_ht40 && !(ht_cap->cap & - IEEE80211_HT_CAP_SGI_20)) - break; - if (tbl->is_ht40 && !(ht_cap->cap & - IEEE80211_HT_CAP_SGI_40)) - break; - - IWL_DEBUG_RATE(mvm, "LQ: MIMO2 toggle SGI/NGI\n"); - - /* Set up new search table for MIMO2 */ - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = !tbl->is_SGI; - rs_set_expected_tpt_table(lq_sta, search_tbl); - /* - * If active table already uses the fastest possible - * modulation (dual stream with short guard interval), - * and it's working well, there's no need to look - * for a better type of modulation! - */ - if (tbl->is_SGI) { - s32 tpt = lq_sta->last_tpt / 100; - if (tpt >= search_tbl->expected_tpt[index]) - break; - } - search_tbl->current_rate = - rate_n_flags_from_tbl(mvm, search_tbl, - index, is_green); - update_search_tbl_counter = 1; - goto out; - - case IWL_MIMO2_SWITCH_MIMO3_ABC: - IWL_DEBUG_RATE(mvm, "LQ: MIMO2 switch to MIMO3\n"); - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - search_tbl->ant_type = ANT_ABC; - - if (!rs_is_valid_ant(valid_tx_ant, - search_tbl->ant_type)) - break; - - ret = rs_switch_to_mimo3(mvm, lq_sta, sta, - search_tbl, index); - if (!ret) - goto out; - - break; - } - tbl->action++; - if (tbl->action > IWL_MIMO2_SWITCH_MIMO3_ABC) - tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; - - if (tbl->action == start_action) - break; - } - search_tbl->lq_type = LQ_NONE; - return 0; - out: - lq_sta->search_better_tbl = 1; - tbl->action++; - if (tbl->action > IWL_MIMO2_SWITCH_MIMO3_ABC) - tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; - if (update_search_tbl_counter) - search_tbl->action = tbl->action; - - return 0; -} - -/* - * Try to switch to new modulation mode from MIMO3 - */ -static int rs_move_mimo3_to_other(struct iwl_mvm *mvm, - struct iwl_lq_sta *lq_sta, - struct ieee80211_sta *sta, int index) -{ - s8 is_green = lq_sta->is_green; - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - struct iwl_scale_tbl_info *search_tbl = - &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - struct iwl_rate_scale_data *window = &(tbl->win[index]); - struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - u32 sz = (sizeof(struct iwl_scale_tbl_info) - - (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); - u8 start_action; - u8 valid_tx_ant = iwl_fw_valid_tx_ant(mvm->fw); - u8 tx_chains_num = num_of_ant(valid_tx_ant); - int ret; - u8 update_search_tbl_counter = 0; - - start_action = tbl->action; - while (1) { - lq_sta->action_counter++; - switch (tbl->action) { - case IWL_MIMO3_SWITCH_ANTENNA1: - case IWL_MIMO3_SWITCH_ANTENNA2: - IWL_DEBUG_RATE(mvm, "LQ: MIMO3 toggle Antennas\n"); - - if (tx_chains_num <= 3) - break; - - if (window->success_ratio >= IWL_RS_GOOD_RATIO) - break; - - memcpy(search_tbl, tbl, sz); - if (rs_toggle_antenna(valid_tx_ant, - &search_tbl->current_rate, - search_tbl)) - goto out; - break; - case IWL_MIMO3_SWITCH_SISO_A: - case IWL_MIMO3_SWITCH_SISO_B: - case IWL_MIMO3_SWITCH_SISO_C: - IWL_DEBUG_RATE(mvm, "LQ: MIMO3 switch to SISO\n"); - - /* Set up new search table for SISO */ - memcpy(search_tbl, tbl, sz); - - if (tbl->action == IWL_MIMO3_SWITCH_SISO_A) - search_tbl->ant_type = ANT_A; - else if (tbl->action == IWL_MIMO3_SWITCH_SISO_B) - search_tbl->ant_type = ANT_B; - else - search_tbl->ant_type = ANT_C; - - if (!rs_is_valid_ant(valid_tx_ant, - search_tbl->ant_type)) - break; - - ret = rs_switch_to_siso(mvm, lq_sta, sta, - search_tbl, index); - if (!ret) - goto out; - - break; - - case IWL_MIMO3_SWITCH_MIMO2_AB: - case IWL_MIMO3_SWITCH_MIMO2_AC: - case IWL_MIMO3_SWITCH_MIMO2_BC: - IWL_DEBUG_RATE(mvm, "LQ: MIMO3 switch to MIMO2\n"); - - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = 0; - if (tbl->action == IWL_MIMO3_SWITCH_MIMO2_AB) - search_tbl->ant_type = ANT_AB; - else if (tbl->action == IWL_MIMO3_SWITCH_MIMO2_AC) - search_tbl->ant_type = ANT_AC; - else - search_tbl->ant_type = ANT_BC; - - if (!rs_is_valid_ant(valid_tx_ant, - search_tbl->ant_type)) - break; - - ret = rs_switch_to_mimo2(mvm, lq_sta, sta, - search_tbl, index); - if (!ret) - goto out; - - break; - - case IWL_MIMO3_SWITCH_GI: - if (!tbl->is_ht40 && !(ht_cap->cap & - IEEE80211_HT_CAP_SGI_20)) - break; - if (tbl->is_ht40 && !(ht_cap->cap & - IEEE80211_HT_CAP_SGI_40)) - break; - - IWL_DEBUG_RATE(mvm, "LQ: MIMO3 toggle SGI/NGI\n"); - - /* Set up new search table for MIMO */ - memcpy(search_tbl, tbl, sz); - search_tbl->is_SGI = !tbl->is_SGI; - rs_set_expected_tpt_table(lq_sta, search_tbl); - /* - * If active table already uses the fastest possible - * modulation (dual stream with short guard interval), - * and it's working well, there's no need to look - * for a better type of modulation! - */ - if (tbl->is_SGI) { - s32 tpt = lq_sta->last_tpt / 100; - if (tpt >= search_tbl->expected_tpt[index]) - break; - } - search_tbl->current_rate = - rate_n_flags_from_tbl(mvm, search_tbl, - index, is_green); - update_search_tbl_counter = 1; - goto out; - } - tbl->action++; - if (tbl->action > IWL_MIMO3_SWITCH_GI) - tbl->action = IWL_MIMO3_SWITCH_ANTENNA1; - - if (tbl->action == start_action) - break; - } - search_tbl->lq_type = LQ_NONE; - return 0; - out: - lq_sta->search_better_tbl = 1; - tbl->action++; - if (tbl->action > IWL_MIMO3_SWITCH_GI) - tbl->action = IWL_MIMO3_SWITCH_ANTENNA1; - if (update_search_tbl_counter) - search_tbl->action = tbl->action; - - return 0; -} - -/* - * Check whether we should continue using same modulation mode, or - * begin search for a new mode, based on: - * 1) # tx successes or failures while using this mode - * 2) # times calling this function - * 3) elapsed time in this mode (not used, for now) - */ -static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) -{ - struct iwl_scale_tbl_info *tbl; - int i; - int active_tbl; - int flush_interval_passed = 0; - struct iwl_mvm *mvm; - - mvm = lq_sta->drv; - active_tbl = lq_sta->active_tbl; - - tbl = &(lq_sta->lq_info[active_tbl]); - - /* If we've been disallowing search, see if we should now allow it */ - if (lq_sta->stay_in_tbl) { - /* Elapsed time using current modulation mode */ - if (lq_sta->flush_timer) - flush_interval_passed = - time_after(jiffies, - (unsigned long)(lq_sta->flush_timer + - IWL_RATE_SCALE_FLUSH_INTVL)); - - /* - * Check if we should allow search for new modulation mode. - * If many frames have failed or succeeded, or we've used - * this same modulation for a long time, allow search, and - * reset history stats that keep track of whether we should - * allow a new search. Also (below) reset all bitmaps and - * stats in active history. - */ - if (force_search || - (lq_sta->total_failed > lq_sta->max_failure_limit) || - (lq_sta->total_success > lq_sta->max_success_limit) || - ((!lq_sta->search_better_tbl) && - (lq_sta->flush_timer) && (flush_interval_passed))) { - IWL_DEBUG_RATE(mvm, - "LQ: stay is expired %d %d %d\n", - lq_sta->total_failed, - lq_sta->total_success, - flush_interval_passed); - - /* Allow search for new mode */ - lq_sta->stay_in_tbl = 0; /* only place reset */ - lq_sta->total_failed = 0; - lq_sta->total_success = 0; - lq_sta->flush_timer = 0; - /* - * Else if we've used this modulation mode enough repetitions - * (regardless of elapsed time or success/failure), reset - * history bitmaps and rate-specific stats for all rates in - * active table. - */ - } else { - lq_sta->table_count++; - if (lq_sta->table_count >= - lq_sta->table_count_limit) { - lq_sta->table_count = 0; - - IWL_DEBUG_RATE(mvm, - "LQ: stay in table clear win\n"); - for (i = 0; i < IWL_RATE_COUNT; i++) - rs_rate_scale_clear_window( - &(tbl->win[i])); - } - } - - /* If transitioning to allow "search", reset all history - * bitmaps and stats in active table (this will become the new - * "search" table). */ - if (!lq_sta->stay_in_tbl) { - for (i = 0; i < IWL_RATE_COUNT; i++) - rs_rate_scale_clear_window(&(tbl->win[i])); - } - } -} - -/* - * setup rate table in uCode - */ -static void rs_update_rate_tbl(struct iwl_mvm *mvm, - struct iwl_lq_sta *lq_sta, - struct iwl_scale_tbl_info *tbl, - int index, u8 is_green) -{ - u32 rate; - - /* Update uCode's rate table. */ - rate = rate_n_flags_from_tbl(mvm, tbl, index, is_green); - rs_fill_link_cmd(mvm, lq_sta, rate); - iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, CMD_ASYNC, false); -} - -/* - * Do rate scaling and search for new modulation mode. - */ -static void rs_rate_scale_perform(struct iwl_mvm *mvm, - struct sk_buff *skb, - struct ieee80211_sta *sta, - struct iwl_lq_sta *lq_sta) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - int low = IWL_RATE_INVALID; - int high = IWL_RATE_INVALID; - int index; - int i; - struct iwl_rate_scale_data *window = NULL; - int current_tpt = IWL_INVALID_VALUE; - int low_tpt = IWL_INVALID_VALUE; - int high_tpt = IWL_INVALID_VALUE; - u32 fail_count; - s8 scale_action = 0; - u16 rate_mask; - u8 update_lq = 0; - struct iwl_scale_tbl_info *tbl, *tbl1; - u16 rate_scale_index_msk = 0; - u8 is_green = 0; - u8 active_tbl = 0; - u8 done_search = 0; - u16 high_low; - s32 sr; - u8 tid = IWL_MAX_TID_COUNT; - struct iwl_mvm_sta *sta_priv = (void *)sta->drv_priv; - struct iwl_mvm_tid_data *tid_data; - - IWL_DEBUG_RATE(mvm, "rate scale calculate new rate for skb\n"); - - /* Send management frames and NO_ACK data using lowest rate. */ - /* TODO: this could probably be improved.. */ - if (!ieee80211_is_data(hdr->frame_control) || - info->flags & IEEE80211_TX_CTL_NO_ACK) - return; - - lq_sta->supp_rates = sta->supp_rates[lq_sta->band]; - - tid = rs_tl_add_packet(lq_sta, hdr); - if ((tid != IWL_MAX_TID_COUNT) && - (lq_sta->tx_agg_tid_en & (1 << tid))) { - tid_data = &sta_priv->tid_data[tid]; - if (tid_data->state == IWL_AGG_OFF) - lq_sta->is_agg = 0; - else - lq_sta->is_agg = 1; - } else { - lq_sta->is_agg = 0; - } - - /* - * Select rate-scale / modulation-mode table to work with in - * the rest of this function: "search" if searching for better - * modulation mode, or "active" if doing rate scaling within a mode. - */ - if (!lq_sta->search_better_tbl) - active_tbl = lq_sta->active_tbl; - else - active_tbl = 1 - lq_sta->active_tbl; - - tbl = &(lq_sta->lq_info[active_tbl]); - if (is_legacy(tbl->lq_type)) - lq_sta->is_green = 0; - else - lq_sta->is_green = rs_use_green(sta); - is_green = lq_sta->is_green; - - /* current tx rate */ - index = lq_sta->last_txrate_idx; - - IWL_DEBUG_RATE(mvm, "Rate scale index %d for type %d\n", index, - tbl->lq_type); - - /* rates available for this association, and for modulation mode */ - rate_mask = rs_get_supported_rates(lq_sta, hdr, tbl->lq_type); - - IWL_DEBUG_RATE(mvm, "mask 0x%04X\n", rate_mask); - - /* mask with station rate restriction */ - if (is_legacy(tbl->lq_type)) { - if (lq_sta->band == IEEE80211_BAND_5GHZ) - /* supp_rates has no CCK bits in A mode */ - rate_scale_index_msk = (u16) (rate_mask & - (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE)); - else - rate_scale_index_msk = (u16) (rate_mask & - lq_sta->supp_rates); - - } else { - rate_scale_index_msk = rate_mask; - } - - if (!rate_scale_index_msk) - rate_scale_index_msk = rate_mask; - - if (!((1 << index) & rate_scale_index_msk)) { - IWL_ERR(mvm, "Current Rate is not valid\n"); - if (lq_sta->search_better_tbl) { - /* revert to active table if search table is not valid*/ - tbl->lq_type = LQ_NONE; - lq_sta->search_better_tbl = 0; - tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - /* get "active" rate info */ - index = iwl_hwrate_to_plcp_idx(tbl->current_rate); - rs_update_rate_tbl(mvm, lq_sta, tbl, index, is_green); - } - return; - } - - /* Get expected throughput table and history window for current rate */ - if (!tbl->expected_tpt) { - IWL_ERR(mvm, "tbl->expected_tpt is NULL\n"); - return; - } - - /* force user max rate if set by user */ - if ((lq_sta->max_rate_idx != -1) && - (lq_sta->max_rate_idx < index)) { - index = lq_sta->max_rate_idx; - update_lq = 1; - window = &(tbl->win[index]); - goto lq_update; - } - - window = &(tbl->win[index]); - - /* - * If there is not enough history to calculate actual average - * throughput, keep analyzing results of more tx frames, without - * changing rate or mode (bypass most of the rest of this function). - * Set up new rate table in uCode only if old rate is not supported - * in current association (use new rate found above). - */ - fail_count = window->counter - window->success_counter; - if ((fail_count < IWL_RATE_MIN_FAILURE_TH) && - (window->success_counter < IWL_RATE_MIN_SUCCESS_TH)) { - IWL_DEBUG_RATE(mvm, - "LQ: still below TH. succ=%d total=%d for index %d\n", - window->success_counter, window->counter, index); - - /* Can't calculate this yet; not enough history */ - window->average_tpt = IWL_INVALID_VALUE; - - /* Should we stay with this modulation mode, - * or search for a new one? */ - rs_stay_in_table(lq_sta, false); - - goto out; - } - /* Else we have enough samples; calculate estimate of - * actual average throughput */ - if (window->average_tpt != ((window->success_ratio * - tbl->expected_tpt[index] + 64) / 128)) { - IWL_ERR(mvm, - "expected_tpt should have been calculated by now\n"); - window->average_tpt = ((window->success_ratio * - tbl->expected_tpt[index] + 64) / 128); - } - - /* If we are searching for better modulation mode, check success. */ - if (lq_sta->search_better_tbl) { - /* If good success, continue using the "search" mode; - * no need to send new link quality command, since we're - * continuing to use the setup that we've been trying. */ - if (window->average_tpt > lq_sta->last_tpt) { - IWL_DEBUG_RATE(mvm, - "LQ: SWITCHING TO NEW TABLE suc=%d cur-tpt=%d old-tpt=%d\n", - window->success_ratio, - window->average_tpt, - lq_sta->last_tpt); - - if (!is_legacy(tbl->lq_type)) - lq_sta->enable_counter = 1; - - /* Swap tables; "search" becomes "active" */ - lq_sta->active_tbl = active_tbl; - current_tpt = window->average_tpt; - /* Else poor success; go back to mode in "active" table */ - } else { - IWL_DEBUG_RATE(mvm, - "LQ: GOING BACK TO THE OLD TABLE suc=%d cur-tpt=%d old-tpt=%d\n", - window->success_ratio, - window->average_tpt, - lq_sta->last_tpt); - - /* Nullify "search" table */ - tbl->lq_type = LQ_NONE; - - /* Revert to "active" table */ - active_tbl = lq_sta->active_tbl; - tbl = &(lq_sta->lq_info[active_tbl]); - - /* Revert to "active" rate and throughput info */ - index = iwl_hwrate_to_plcp_idx(tbl->current_rate); - current_tpt = lq_sta->last_tpt; - - /* Need to set up a new rate table in uCode */ - update_lq = 1; - } - - /* Either way, we've made a decision; modulation mode - * search is done, allow rate adjustment next time. */ - lq_sta->search_better_tbl = 0; - done_search = 1; /* Don't switch modes below! */ - goto lq_update; - } - - /* (Else) not in search of better modulation mode, try for better - * starting rate, while staying in this mode. */ - high_low = rs_get_adjacent_rate(mvm, index, rate_scale_index_msk, - tbl->lq_type); - low = high_low & 0xff; - high = (high_low >> 8) & 0xff; - - /* If user set max rate, dont allow higher than user constrain */ - if ((lq_sta->max_rate_idx != -1) && - (lq_sta->max_rate_idx < high)) - high = IWL_RATE_INVALID; - - sr = window->success_ratio; - - /* Collect measured throughputs for current and adjacent rates */ - current_tpt = window->average_tpt; - if (low != IWL_RATE_INVALID) - low_tpt = tbl->win[low].average_tpt; - if (high != IWL_RATE_INVALID) - high_tpt = tbl->win[high].average_tpt; - - scale_action = 0; - - /* Too many failures, decrease rate */ - if ((sr <= IWL_RATE_DECREASE_TH) || (current_tpt == 0)) { - IWL_DEBUG_RATE(mvm, - "decrease rate because of low success_ratio\n"); - scale_action = -1; - /* No throughput measured yet for adjacent rates; try increase. */ - } else if ((low_tpt == IWL_INVALID_VALUE) && - (high_tpt == IWL_INVALID_VALUE)) { - if (high != IWL_RATE_INVALID && sr >= IWL_RATE_INCREASE_TH) - scale_action = 1; - else if (low != IWL_RATE_INVALID) - scale_action = 0; - } - - /* Both adjacent throughputs are measured, but neither one has better - * throughput; we're using the best rate, don't change it! */ - else if ((low_tpt != IWL_INVALID_VALUE) && - (high_tpt != IWL_INVALID_VALUE) && - (low_tpt < current_tpt) && - (high_tpt < current_tpt)) - scale_action = 0; - - /* At least one adjacent rate's throughput is measured, - * and may have better performance. */ - else { - /* Higher adjacent rate's throughput is measured */ - if (high_tpt != IWL_INVALID_VALUE) { - /* Higher rate has better throughput */ - if (high_tpt > current_tpt && - sr >= IWL_RATE_INCREASE_TH) { - scale_action = 1; - } else { - scale_action = 0; - } - - /* Lower adjacent rate's throughput is measured */ - } else if (low_tpt != IWL_INVALID_VALUE) { - /* Lower rate has better throughput */ - if (low_tpt > current_tpt) { - IWL_DEBUG_RATE(mvm, - "decrease rate because of low tpt\n"); - scale_action = -1; - } else if (sr >= IWL_RATE_INCREASE_TH) { - scale_action = 1; - } - } - } - - /* Sanity check; asked for decrease, but success rate or throughput - * has been good at old rate. Don't change it. */ - if ((scale_action == -1) && (low != IWL_RATE_INVALID) && - ((sr > IWL_RATE_HIGH_TH) || - (current_tpt > (100 * tbl->expected_tpt[low])))) - scale_action = 0; - - switch (scale_action) { - case -1: - /* Decrease starting rate, update uCode's rate table */ - if (low != IWL_RATE_INVALID) { - update_lq = 1; - index = low; - } - - break; - case 1: - /* Increase starting rate, update uCode's rate table */ - if (high != IWL_RATE_INVALID) { - update_lq = 1; - index = high; - } - - break; - case 0: - /* No change */ - default: - break; - } - - IWL_DEBUG_RATE(mvm, - "choose rate scale index %d action %d low %d high %d type %d\n", - index, scale_action, low, high, tbl->lq_type); - -lq_update: - /* Replace uCode's rate table for the destination station. */ - if (update_lq) - rs_update_rate_tbl(mvm, lq_sta, tbl, index, is_green); - - rs_stay_in_table(lq_sta, false); - - /* - * Search for new modulation mode if we're: - * 1) Not changing rates right now - * 2) Not just finishing up a search - * 3) Allowing a new search - */ - if (!update_lq && !done_search && - !lq_sta->stay_in_tbl && window->counter) { - /* Save current throughput to compare with "search" throughput*/ - lq_sta->last_tpt = current_tpt; - - /* Select a new "search" modulation mode to try. - * If one is found, set up the new "search" table. */ - if (is_legacy(tbl->lq_type)) - rs_move_legacy_other(mvm, lq_sta, sta, index); - else if (is_siso(tbl->lq_type)) - rs_move_siso_to_other(mvm, lq_sta, sta, index); - else if (is_mimo2(tbl->lq_type)) - rs_move_mimo2_to_other(mvm, lq_sta, sta, index); - else - rs_move_mimo3_to_other(mvm, lq_sta, sta, index); - - /* If new "search" mode was selected, set up in uCode table */ - if (lq_sta->search_better_tbl) { - /* Access the "search" table, clear its history. */ - tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); - for (i = 0; i < IWL_RATE_COUNT; i++) - rs_rate_scale_clear_window(&(tbl->win[i])); - - /* Use new "search" start rate */ - index = iwl_hwrate_to_plcp_idx(tbl->current_rate); - - IWL_DEBUG_RATE(mvm, - "Switch current mcs: %X index: %d\n", - tbl->current_rate, index); - rs_fill_link_cmd(mvm, lq_sta, tbl->current_rate); - iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, CMD_ASYNC, false); - } else { - done_search = 1; - } - } - - if (done_search && !lq_sta->stay_in_tbl) { - /* If the "active" (non-search) mode was legacy, - * and we've tried switching antennas, - * but we haven't been able to try HT modes (not available), - * stay with best antenna legacy modulation for a while - * before next round of mode comparisons. */ - tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); - if (is_legacy(tbl1->lq_type) && !sta->ht_cap.ht_supported && - lq_sta->action_counter > tbl1->max_search) { - IWL_DEBUG_RATE(mvm, "LQ: STAY in legacy table\n"); - rs_set_stay_in_table(mvm, 1, lq_sta); - } - - /* If we're in an HT mode, and all 3 mode switch actions - * have been tried and compared, stay in this best modulation - * mode for a while before next round of mode comparisons. */ - if (lq_sta->enable_counter && - (lq_sta->action_counter >= tbl1->max_search)) { - if ((lq_sta->last_tpt > IWL_AGG_TPT_THREHOLD) && - (lq_sta->tx_agg_tid_en & (1 << tid)) && - (tid != IWL_MAX_TID_COUNT)) { - tid_data = &sta_priv->tid_data[tid]; - if (tid_data->state == IWL_AGG_OFF) { - IWL_DEBUG_RATE(mvm, - "try to aggregate tid %d\n", - tid); - rs_tl_turn_on_agg(mvm, tid, - lq_sta, sta); - } - } - rs_set_stay_in_table(mvm, 0, lq_sta); - } - } - -out: - tbl->current_rate = rate_n_flags_from_tbl(mvm, tbl, index, is_green); - lq_sta->last_txrate_idx = index; -} - -/** - * rs_initialize_lq - Initialize a station's hardware rate table - * - * The uCode's station table contains a table of fallback rates - * for automatic fallback during transmission. - * - * NOTE: This sets up a default set of values. These will be replaced later - * if the driver's iwl-agn-rs rate scaling algorithm is used, instead of - * rc80211_simple. - * - * NOTE: Run REPLY_ADD_STA command to set up station table entry, before - * calling this function (which runs REPLY_TX_LINK_QUALITY_CMD, - * which requires station table entry to exist). - */ -static void rs_initialize_lq(struct iwl_mvm *mvm, - struct ieee80211_sta *sta, - struct iwl_lq_sta *lq_sta, - enum ieee80211_band band) -{ - struct iwl_scale_tbl_info *tbl; - int rate_idx; - int i; - u32 rate; - u8 use_green = rs_use_green(sta); - u8 active_tbl = 0; - u8 valid_tx_ant; - - if (!sta || !lq_sta) - return; - - i = lq_sta->last_txrate_idx; - - valid_tx_ant = iwl_fw_valid_tx_ant(mvm->fw); - - if (!lq_sta->search_better_tbl) - active_tbl = lq_sta->active_tbl; - else - active_tbl = 1 - lq_sta->active_tbl; - - tbl = &(lq_sta->lq_info[active_tbl]); - - if ((i < 0) || (i >= IWL_RATE_COUNT)) - i = 0; - - rate = iwl_rates[i].plcp; - tbl->ant_type = first_antenna(valid_tx_ant); - rate |= tbl->ant_type << RATE_MCS_ANT_POS; - - if (i >= IWL_FIRST_CCK_RATE && i <= IWL_LAST_CCK_RATE) - rate |= RATE_MCS_CCK_MSK; - - rs_get_tbl_info_from_mcs(rate, band, tbl, &rate_idx); - if (!rs_is_valid_ant(valid_tx_ant, tbl->ant_type)) - rs_toggle_antenna(valid_tx_ant, &rate, tbl); - - rate = rate_n_flags_from_tbl(mvm, tbl, rate_idx, use_green); - tbl->current_rate = rate; - rs_set_expected_tpt_table(lq_sta, tbl); - rs_fill_link_cmd(NULL, lq_sta, rate); - /* TODO restore station should remember the lq cmd */ - iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, CMD_SYNC, true); -} - -static void rs_get_rate(void *mvm_r, struct ieee80211_sta *sta, void *mvm_sta, - struct ieee80211_tx_rate_control *txrc) -{ - struct sk_buff *skb = txrc->skb; - struct ieee80211_supported_band *sband = txrc->sband; - struct iwl_op_mode *op_mode __maybe_unused = - (struct iwl_op_mode *)mvm_r; - struct iwl_mvm *mvm __maybe_unused = IWL_OP_MODE_GET_MVM(op_mode); - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct iwl_lq_sta *lq_sta = mvm_sta; - int rate_idx; - - IWL_DEBUG_RATE_LIMIT(mvm, "rate scale calculate new rate for skb\n"); - - /* Get max rate if user set max rate */ - if (lq_sta) { - lq_sta->max_rate_idx = txrc->max_rate_idx; - if ((sband->band == IEEE80211_BAND_5GHZ) && - (lq_sta->max_rate_idx != -1)) - lq_sta->max_rate_idx += IWL_FIRST_OFDM_RATE; - if ((lq_sta->max_rate_idx < 0) || - (lq_sta->max_rate_idx >= IWL_RATE_COUNT)) - lq_sta->max_rate_idx = -1; - } - - /* Treat uninitialized rate scaling data same as non-existing. */ - if (lq_sta && !lq_sta->drv) { - IWL_DEBUG_RATE(mvm, "Rate scaling not initialized yet.\n"); - mvm_sta = NULL; - } - - /* Send management frames and NO_ACK data using lowest rate. */ - if (rate_control_send_low(sta, mvm_sta, txrc)) - return; - - rate_idx = lq_sta->last_txrate_idx; - - if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) { - rate_idx -= IWL_FIRST_OFDM_RATE; - /* 6M and 9M shared same MCS index */ - rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0; - if (rs_extract_rate(lq_sta->last_rate_n_flags) >= - IWL_RATE_MIMO3_6M_PLCP) - rate_idx = rate_idx + (2 * MCS_INDEX_PER_STREAM); - else if (rs_extract_rate(lq_sta->last_rate_n_flags) >= - IWL_RATE_MIMO2_6M_PLCP) - rate_idx = rate_idx + MCS_INDEX_PER_STREAM; - info->control.rates[0].flags = IEEE80211_TX_RC_MCS; - if (lq_sta->last_rate_n_flags & RATE_MCS_SGI_MSK) - info->control.rates[0].flags |= IEEE80211_TX_RC_SHORT_GI; - if (lq_sta->last_rate_n_flags & RATE_MCS_CHAN_WIDTH_40) /* TODO */ - info->control.rates[0].flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; - if (lq_sta->last_rate_n_flags & RATE_HT_MCS_GF_MSK) - info->control.rates[0].flags |= IEEE80211_TX_RC_GREEN_FIELD; - } else { - /* Check for invalid rates */ - if ((rate_idx < 0) || (rate_idx >= IWL_RATE_COUNT_LEGACY) || - ((sband->band == IEEE80211_BAND_5GHZ) && - (rate_idx < IWL_FIRST_OFDM_RATE))) - rate_idx = rate_lowest_index(sband, sta); - /* On valid 5 GHz rate, adjust index */ - else if (sband->band == IEEE80211_BAND_5GHZ) - rate_idx -= IWL_FIRST_OFDM_RATE; - info->control.rates[0].flags = 0; - } - info->control.rates[0].idx = rate_idx; - info->control.rates[0].count = 1; -} - -static void *rs_alloc_sta(void *mvm_rate, struct ieee80211_sta *sta, - gfp_t gfp) -{ - struct iwl_mvm_sta *sta_priv = (struct iwl_mvm_sta *)sta->drv_priv; - struct iwl_op_mode *op_mode __maybe_unused = - (struct iwl_op_mode *)mvm_rate; - struct iwl_mvm *mvm __maybe_unused = IWL_OP_MODE_GET_MVM(op_mode); - - IWL_DEBUG_RATE(mvm, "create station rate scale window\n"); - - return &sta_priv->lq_sta; -} - -/* - * Called after adding a new station to initialize rate scaling - */ -void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, - enum ieee80211_band band) -{ - int i, j; - struct ieee80211_hw *hw = mvm->hw; - struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; - struct iwl_mvm_sta *sta_priv; - struct iwl_lq_sta *lq_sta; - struct ieee80211_supported_band *sband; - unsigned long supp; /* must be unsigned long for for_each_set_bit */ - - sta_priv = (struct iwl_mvm_sta *)sta->drv_priv; - lq_sta = &sta_priv->lq_sta; - sband = hw->wiphy->bands[band]; - - lq_sta->lq.sta_id = sta_priv->sta_id; - - for (j = 0; j < LQ_SIZE; j++) - for (i = 0; i < IWL_RATE_COUNT; i++) - rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); - - lq_sta->flush_timer = 0; - lq_sta->supp_rates = sta->supp_rates[sband->band]; - for (j = 0; j < LQ_SIZE; j++) - for (i = 0; i < IWL_RATE_COUNT; i++) - rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); - - IWL_DEBUG_RATE(mvm, - "LQ: *** rate scale station global init for station %d ***\n", - sta_priv->sta_id); - /* TODO: what is a good starting rate for STA? About middle? Maybe not - * the lowest or the highest rate.. Could consider using RSSI from - * previous packets? Need to have IEEE 802.1X auth succeed immediately - * after assoc.. */ - - lq_sta->max_rate_idx = -1; - lq_sta->missed_rate_counter = IWL_MISSED_RATE_MAX; - lq_sta->is_green = rs_use_green(sta); - lq_sta->band = sband->band; - /* - * active legacy rates as per supported rates bitmap - */ - supp = sta->supp_rates[sband->band]; - lq_sta->active_legacy_rate = 0; - for_each_set_bit(i, &supp, BITS_PER_LONG) - lq_sta->active_legacy_rate |= BIT(sband->bitrates[i].hw_value); - - /* - * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), - * supp_rates[] does not; shift to convert format, force 9 MBits off. - */ - lq_sta->active_siso_rate = ht_cap->mcs.rx_mask[0] << 1; - lq_sta->active_siso_rate |= ht_cap->mcs.rx_mask[0] & 0x1; - lq_sta->active_siso_rate &= ~((u16)0x2); - lq_sta->active_siso_rate <<= IWL_FIRST_OFDM_RATE; - - /* Same here */ - lq_sta->active_mimo2_rate = ht_cap->mcs.rx_mask[1] << 1; - lq_sta->active_mimo2_rate |= ht_cap->mcs.rx_mask[1] & 0x1; - lq_sta->active_mimo2_rate &= ~((u16)0x2); - lq_sta->active_mimo2_rate <<= IWL_FIRST_OFDM_RATE; - - lq_sta->active_mimo3_rate = ht_cap->mcs.rx_mask[2] << 1; - lq_sta->active_mimo3_rate |= ht_cap->mcs.rx_mask[2] & 0x1; - lq_sta->active_mimo3_rate &= ~((u16)0x2); - lq_sta->active_mimo3_rate <<= IWL_FIRST_OFDM_RATE; - - IWL_DEBUG_RATE(mvm, - "SISO-RATE=%X MIMO2-RATE=%X MIMO3-RATE=%X\n", - lq_sta->active_siso_rate, - lq_sta->active_mimo2_rate, - lq_sta->active_mimo3_rate); - - /* These values will be overridden later */ - lq_sta->lq.single_stream_ant_msk = - first_antenna(iwl_fw_valid_tx_ant(mvm->fw)); - lq_sta->lq.dual_stream_ant_msk = - iwl_fw_valid_tx_ant(mvm->fw) & - ~first_antenna(iwl_fw_valid_tx_ant(mvm->fw)); - if (!lq_sta->lq.dual_stream_ant_msk) { - lq_sta->lq.dual_stream_ant_msk = ANT_AB; - } else if (num_of_ant(iwl_fw_valid_tx_ant(mvm->fw)) == 2) { - lq_sta->lq.dual_stream_ant_msk = - iwl_fw_valid_tx_ant(mvm->fw); - } - - /* as default allow aggregation for all tids */ - lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; - lq_sta->drv = mvm; - - /* Set last_txrate_idx to lowest rate */ - lq_sta->last_txrate_idx = rate_lowest_index(sband, sta); - if (sband->band == IEEE80211_BAND_5GHZ) - lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; - lq_sta->is_agg = 0; -#ifdef CONFIG_MAC80211_DEBUGFS - lq_sta->dbg_fixed_rate = 0; -#endif - - rs_initialize_lq(mvm, sta, lq_sta, band); -} - -static void rs_fill_link_cmd(struct iwl_mvm *mvm, - struct iwl_lq_sta *lq_sta, u32 new_rate) -{ - struct iwl_scale_tbl_info tbl_type; - int index = 0; - int rate_idx; - int repeat_rate = 0; - u8 ant_toggle_cnt = 0; - u8 use_ht_possible = 1; - u8 valid_tx_ant = 0; - struct iwl_lq_cmd *lq_cmd = &lq_sta->lq; - - /* Override starting rate (index 0) if needed for debug purposes */ - rs_dbgfs_set_mcs(lq_sta, &new_rate, index); - - /* Interpret new_rate (rate_n_flags) */ - rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, - &tbl_type, &rate_idx); - - /* How many times should we repeat the initial rate? */ - if (is_legacy(tbl_type.lq_type)) { - ant_toggle_cnt = 1; - repeat_rate = IWL_NUMBER_TRY; - } else { - repeat_rate = min(IWL_HT_NUMBER_TRY, - LINK_QUAL_AGG_DISABLE_START_DEF - 1); - } - - lq_cmd->mimo_delim = is_mimo(tbl_type.lq_type) ? 1 : 0; - - /* Fill 1st table entry (index 0) */ - lq_cmd->rs_table[index] = cpu_to_le32(new_rate); - - if (num_of_ant(tbl_type.ant_type) == 1) - lq_cmd->single_stream_ant_msk = tbl_type.ant_type; - else if (num_of_ant(tbl_type.ant_type) == 2) - lq_cmd->dual_stream_ant_msk = tbl_type.ant_type; - /* otherwise we don't modify the existing value */ - - index++; - repeat_rate--; - if (mvm) - valid_tx_ant = iwl_fw_valid_tx_ant(mvm->fw); - - /* Fill rest of rate table */ - while (index < LINK_QUAL_MAX_RETRY_NUM) { - /* Repeat initial/next rate. - * For legacy IWL_NUMBER_TRY == 1, this loop will not execute. - * For HT IWL_HT_NUMBER_TRY == 3, this executes twice. */ - while (repeat_rate > 0 && (index < LINK_QUAL_MAX_RETRY_NUM)) { - if (is_legacy(tbl_type.lq_type)) { - if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) - ant_toggle_cnt++; - else if (mvm && - rs_toggle_antenna(valid_tx_ant, - &new_rate, &tbl_type)) - ant_toggle_cnt = 1; - } - - /* Override next rate if needed for debug purposes */ - rs_dbgfs_set_mcs(lq_sta, &new_rate, index); - - /* Fill next table entry */ - lq_cmd->rs_table[index] = - cpu_to_le32(new_rate); - repeat_rate--; - index++; - } - - rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, &tbl_type, - &rate_idx); - - - /* Indicate to uCode which entries might be MIMO. - * If initial rate was MIMO, this will finally end up - * as (IWL_HT_NUMBER_TRY * 2), after 2nd pass, otherwise 0. */ - if (is_mimo(tbl_type.lq_type)) - lq_cmd->mimo_delim = index; - - /* Get next rate */ - new_rate = rs_get_lower_rate(lq_sta, &tbl_type, rate_idx, - use_ht_possible); - - /* How many times should we repeat the next rate? */ - if (is_legacy(tbl_type.lq_type)) { - if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) - ant_toggle_cnt++; - else if (mvm && - rs_toggle_antenna(valid_tx_ant, - &new_rate, &tbl_type)) - ant_toggle_cnt = 1; - - repeat_rate = IWL_NUMBER_TRY; - } else { - repeat_rate = IWL_HT_NUMBER_TRY; - } - - /* Don't allow HT rates after next pass. - * rs_get_lower_rate() will change type to LQ_A or LQ_G. */ - use_ht_possible = 0; - - /* Override next rate if needed for debug purposes */ - rs_dbgfs_set_mcs(lq_sta, &new_rate, index); - - /* Fill next table entry */ - lq_cmd->rs_table[index] = cpu_to_le32(new_rate); - - index++; - repeat_rate--; - } - - lq_cmd->agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_DEF; - lq_cmd->agg_disable_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; - - lq_cmd->agg_time_limit = - cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF); -} - -static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) -{ - return hw->priv; -} -/* rate scale requires free function to be implemented */ -static void rs_free(void *mvm_rate) -{ - return; -} - -static void rs_free_sta(void *mvm_r, struct ieee80211_sta *sta, - void *mvm_sta) -{ - struct iwl_op_mode *op_mode __maybe_unused = mvm_r; - struct iwl_mvm *mvm __maybe_unused = IWL_OP_MODE_GET_MVM(op_mode); - - IWL_DEBUG_RATE(mvm, "enter\n"); - IWL_DEBUG_RATE(mvm, "leave\n"); -} - -#ifdef CONFIG_MAC80211_DEBUGFS -static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, - u32 *rate_n_flags, int index) -{ - struct iwl_mvm *mvm; - u8 valid_tx_ant; - u8 ant_sel_tx; - - mvm = lq_sta->drv; - valid_tx_ant = iwl_fw_valid_tx_ant(mvm->fw); - if (lq_sta->dbg_fixed_rate) { - ant_sel_tx = - ((lq_sta->dbg_fixed_rate & RATE_MCS_ANT_ABC_MSK) - >> RATE_MCS_ANT_POS); - if ((valid_tx_ant & ant_sel_tx) == ant_sel_tx) { - *rate_n_flags = lq_sta->dbg_fixed_rate; - IWL_DEBUG_RATE(mvm, "Fixed rate ON\n"); - } else { - lq_sta->dbg_fixed_rate = 0; - IWL_ERR(mvm, - "Invalid antenna selection 0x%X, Valid is 0x%X\n", - ant_sel_tx, valid_tx_ant); - IWL_DEBUG_RATE(mvm, "Fixed rate OFF\n"); - } - } else { - IWL_DEBUG_RATE(mvm, "Fixed rate OFF\n"); - } -} - -static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file, - const char __user *user_buf, size_t count, loff_t *ppos) -{ - struct iwl_lq_sta *lq_sta = file->private_data; - struct iwl_mvm *mvm; - char buf[64]; - size_t buf_size; - u32 parsed_rate; - - - mvm = lq_sta->drv; - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - - if (sscanf(buf, "%x", &parsed_rate) == 1) - lq_sta->dbg_fixed_rate = parsed_rate; - else - lq_sta->dbg_fixed_rate = 0; - - rs_program_fix_rate(mvm, lq_sta); - - return count; -} - -static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, - char __user *user_buf, size_t count, loff_t *ppos) -{ - char *buff; - int desc = 0; - int i = 0; - int index = 0; - ssize_t ret; - - struct iwl_lq_sta *lq_sta = file->private_data; - struct iwl_mvm *mvm; - struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); - - mvm = lq_sta->drv; - buff = kmalloc(1024, GFP_KERNEL); - if (!buff) - return -ENOMEM; - - desc += sprintf(buff+desc, "sta_id %d\n", lq_sta->lq.sta_id); - desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n", - lq_sta->total_failed, lq_sta->total_success, - lq_sta->active_legacy_rate); - desc += sprintf(buff+desc, "fixed rate 0x%X\n", - lq_sta->dbg_fixed_rate); - desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n", - (iwl_fw_valid_tx_ant(mvm->fw) & ANT_A) ? "ANT_A," : "", - (iwl_fw_valid_tx_ant(mvm->fw) & ANT_B) ? "ANT_B," : "", - (iwl_fw_valid_tx_ant(mvm->fw) & ANT_C) ? "ANT_C" : ""); - desc += sprintf(buff+desc, "lq type %s\n", - (is_legacy(tbl->lq_type)) ? "legacy" : "HT"); - if (is_Ht(tbl->lq_type)) { - desc += sprintf(buff+desc, " %s", - (is_siso(tbl->lq_type)) ? "SISO" : - ((is_mimo2(tbl->lq_type)) ? "MIMO2" : "MIMO3")); - desc += sprintf(buff+desc, " %s", - (tbl->is_ht40) ? "40MHz" : "20MHz"); - desc += sprintf(buff+desc, " %s %s %s\n", - (tbl->is_SGI) ? "SGI" : "", - (lq_sta->is_green) ? "GF enabled" : "", - (lq_sta->is_agg) ? "AGG on" : ""); - } - desc += sprintf(buff+desc, "last tx rate=0x%X\n", - lq_sta->last_rate_n_flags); - desc += sprintf(buff+desc, - "general: flags=0x%X mimo-d=%d s-ant0x%x d-ant=0x%x\n", - lq_sta->lq.flags, - lq_sta->lq.mimo_delim, - lq_sta->lq.single_stream_ant_msk, - lq_sta->lq.dual_stream_ant_msk); - - desc += sprintf(buff+desc, - "agg: time_limit=%d dist_start_th=%d frame_cnt_limit=%d\n", - le16_to_cpu(lq_sta->lq.agg_time_limit), - lq_sta->lq.agg_disable_start_th, - lq_sta->lq.agg_frame_cnt_limit); - - desc += sprintf(buff+desc, - "Start idx [0]=0x%x [1]=0x%x [2]=0x%x [3]=0x%x\n", - lq_sta->lq.initial_rate_index[0], - lq_sta->lq.initial_rate_index[1], - lq_sta->lq.initial_rate_index[2], - lq_sta->lq.initial_rate_index[3]); - - for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { - index = iwl_hwrate_to_plcp_idx( - le32_to_cpu(lq_sta->lq.rs_table[i])); - if (is_legacy(tbl->lq_type)) { - desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps\n", - i, le32_to_cpu(lq_sta->lq.rs_table[i]), - iwl_rate_mcs[index].mbps); - } else { - desc += sprintf(buff+desc, - " rate[%d] 0x%X %smbps (%s)\n", - i, le32_to_cpu(lq_sta->lq.rs_table[i]), - iwl_rate_mcs[index].mbps, - iwl_rate_mcs[index].mcs); - } - } - - ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); - kfree(buff); - return ret; -} - -static const struct file_operations rs_sta_dbgfs_scale_table_ops = { - .write = rs_sta_dbgfs_scale_table_write, - .read = rs_sta_dbgfs_scale_table_read, - .open = simple_open, - .llseek = default_llseek, -}; -static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, - char __user *user_buf, size_t count, loff_t *ppos) -{ - char *buff; - int desc = 0; - int i, j; - ssize_t ret; - - struct iwl_lq_sta *lq_sta = file->private_data; - - buff = kmalloc(1024, GFP_KERNEL); - if (!buff) - return -ENOMEM; - - for (i = 0; i < LQ_SIZE; i++) { - desc += sprintf(buff+desc, - "%s type=%d SGI=%d HT40=%d DUP=0 GF=%d\n" - "rate=0x%X\n", - lq_sta->active_tbl == i ? "*" : "x", - lq_sta->lq_info[i].lq_type, - lq_sta->lq_info[i].is_SGI, - lq_sta->lq_info[i].is_ht40, - lq_sta->is_green, - lq_sta->lq_info[i].current_rate); - for (j = 0; j < IWL_RATE_COUNT; j++) { - desc += sprintf(buff+desc, - "counter=%d success=%d %%=%d\n", - lq_sta->lq_info[i].win[j].counter, - lq_sta->lq_info[i].win[j].success_counter, - lq_sta->lq_info[i].win[j].success_ratio); - } - } - ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); - kfree(buff); - return ret; -} - -static const struct file_operations rs_sta_dbgfs_stats_table_ops = { - .read = rs_sta_dbgfs_stats_table_read, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file, - char __user *user_buf, size_t count, loff_t *ppos) -{ - struct iwl_lq_sta *lq_sta = file->private_data; - struct iwl_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; - char buff[120]; - int desc = 0; - - if (is_Ht(tbl->lq_type)) - desc += sprintf(buff+desc, - "Bit Rate= %d Mb/s\n", - tbl->expected_tpt[lq_sta->last_txrate_idx]); - else - desc += sprintf(buff+desc, - "Bit Rate= %d Mb/s\n", - iwl_rates[lq_sta->last_txrate_idx].ieee >> 1); - - return simple_read_from_buffer(user_buf, count, ppos, buff, desc); -} - -static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { - .read = rs_sta_dbgfs_rate_scale_data_read, - .open = simple_open, - .llseek = default_llseek, -}; - -static void rs_add_debugfs(void *mvm, void *mvm_sta, struct dentry *dir) -{ - struct iwl_lq_sta *lq_sta = mvm_sta; - lq_sta->rs_sta_dbgfs_scale_table_file = - debugfs_create_file("rate_scale_table", S_IRUSR | S_IWUSR, dir, - lq_sta, &rs_sta_dbgfs_scale_table_ops); - lq_sta->rs_sta_dbgfs_stats_table_file = - debugfs_create_file("rate_stats_table", S_IRUSR, dir, - lq_sta, &rs_sta_dbgfs_stats_table_ops); - lq_sta->rs_sta_dbgfs_rate_scale_data_file = - debugfs_create_file("rate_scale_data", S_IRUSR, dir, - lq_sta, &rs_sta_dbgfs_rate_scale_data_ops); - lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file = - debugfs_create_u8("tx_agg_tid_enable", S_IRUSR | S_IWUSR, dir, - &lq_sta->tx_agg_tid_en); -} - -static void rs_remove_debugfs(void *mvm, void *mvm_sta) -{ - struct iwl_lq_sta *lq_sta = mvm_sta; - debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); - debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); - debugfs_remove(lq_sta->rs_sta_dbgfs_rate_scale_data_file); - debugfs_remove(lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file); -} -#endif - -/* - * Initialization of rate scaling information is done by driver after - * the station is added. Since mac80211 calls this function before a - * station is added we ignore it. - */ -static void rs_rate_init_stub(void *mvm_r, - struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *mvm_sta) -{ -} -static struct rate_control_ops rs_mvm_ops = { - .module = NULL, - .name = RS_NAME, - .tx_status = rs_tx_status, - .get_rate = rs_get_rate, - .rate_init = rs_rate_init_stub, - .alloc = rs_alloc, - .free = rs_free, - .alloc_sta = rs_alloc_sta, - .free_sta = rs_free_sta, -#ifdef CONFIG_MAC80211_DEBUGFS - .add_sta_debugfs = rs_add_debugfs, - .remove_sta_debugfs = rs_remove_debugfs, -#endif -}; - -int iwl_mvm_rate_control_register(void) -{ - return ieee80211_rate_control_register(&rs_mvm_ops); -} - -void iwl_mvm_rate_control_unregister(void) -{ - ieee80211_rate_control_unregister(&rs_mvm_ops); -} diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.h b/drivers/net/wireless/iwlwifi/mvm/rs.h deleted file mode 100644 index 219c6857cc0f..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/rs.h +++ /dev/null @@ -1,393 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#ifndef __rs_h__ -#define __rs_h__ - -#include - -#include "iwl-config.h" - -#include "fw-api.h" -#include "iwl-trans.h" - -struct iwl_rs_rate_info { - u8 plcp; /* uCode API: IWL_RATE_6M_PLCP, etc. */ - u8 plcp_siso; /* uCode API: IWL_RATE_SISO_6M_PLCP, etc. */ - u8 plcp_mimo2; /* uCode API: IWL_RATE_MIMO2_6M_PLCP, etc. */ - u8 plcp_mimo3; /* uCode API: IWL_RATE_MIMO3_6M_PLCP, etc. */ - u8 ieee; /* MAC header: IWL_RATE_6M_IEEE, etc. */ - u8 prev_ieee; /* previous rate in IEEE speeds */ - u8 next_ieee; /* next rate in IEEE speeds */ - u8 prev_rs; /* previous rate used in rs algo */ - u8 next_rs; /* next rate used in rs algo */ - u8 prev_rs_tgg; /* previous rate used in TGG rs algo */ - u8 next_rs_tgg; /* next rate used in TGG rs algo */ -}; - -#define IWL_RATE_60M_PLCP 3 - -enum { - IWL_RATE_INVM_INDEX = IWL_RATE_COUNT, - IWL_RATE_INVALID = IWL_RATE_COUNT, -}; - -#define LINK_QUAL_MAX_RETRY_NUM 16 - -enum { - IWL_RATE_6M_INDEX_TABLE = 0, - IWL_RATE_9M_INDEX_TABLE, - IWL_RATE_12M_INDEX_TABLE, - IWL_RATE_18M_INDEX_TABLE, - IWL_RATE_24M_INDEX_TABLE, - IWL_RATE_36M_INDEX_TABLE, - IWL_RATE_48M_INDEX_TABLE, - IWL_RATE_54M_INDEX_TABLE, - IWL_RATE_1M_INDEX_TABLE, - IWL_RATE_2M_INDEX_TABLE, - IWL_RATE_5M_INDEX_TABLE, - IWL_RATE_11M_INDEX_TABLE, - IWL_RATE_INVM_INDEX_TABLE = IWL_RATE_INVM_INDEX - 1, -}; - -/* #define vs. enum to keep from defaulting to 'large integer' */ -#define IWL_RATE_6M_MASK (1 << IWL_RATE_6M_INDEX) -#define IWL_RATE_9M_MASK (1 << IWL_RATE_9M_INDEX) -#define IWL_RATE_12M_MASK (1 << IWL_RATE_12M_INDEX) -#define IWL_RATE_18M_MASK (1 << IWL_RATE_18M_INDEX) -#define IWL_RATE_24M_MASK (1 << IWL_RATE_24M_INDEX) -#define IWL_RATE_36M_MASK (1 << IWL_RATE_36M_INDEX) -#define IWL_RATE_48M_MASK (1 << IWL_RATE_48M_INDEX) -#define IWL_RATE_54M_MASK (1 << IWL_RATE_54M_INDEX) -#define IWL_RATE_60M_MASK (1 << IWL_RATE_60M_INDEX) -#define IWL_RATE_1M_MASK (1 << IWL_RATE_1M_INDEX) -#define IWL_RATE_2M_MASK (1 << IWL_RATE_2M_INDEX) -#define IWL_RATE_5M_MASK (1 << IWL_RATE_5M_INDEX) -#define IWL_RATE_11M_MASK (1 << IWL_RATE_11M_INDEX) - - -/* uCode API values for OFDM high-throughput (HT) bit rates */ -enum { - IWL_RATE_SISO_6M_PLCP = 0, - IWL_RATE_SISO_12M_PLCP = 1, - IWL_RATE_SISO_18M_PLCP = 2, - IWL_RATE_SISO_24M_PLCP = 3, - IWL_RATE_SISO_36M_PLCP = 4, - IWL_RATE_SISO_48M_PLCP = 5, - IWL_RATE_SISO_54M_PLCP = 6, - IWL_RATE_SISO_60M_PLCP = 7, - IWL_RATE_MIMO2_6M_PLCP = 0x8, - IWL_RATE_MIMO2_12M_PLCP = 0x9, - IWL_RATE_MIMO2_18M_PLCP = 0xa, - IWL_RATE_MIMO2_24M_PLCP = 0xb, - IWL_RATE_MIMO2_36M_PLCP = 0xc, - IWL_RATE_MIMO2_48M_PLCP = 0xd, - IWL_RATE_MIMO2_54M_PLCP = 0xe, - IWL_RATE_MIMO2_60M_PLCP = 0xf, - IWL_RATE_MIMO3_6M_PLCP = 0x10, - IWL_RATE_MIMO3_12M_PLCP = 0x11, - IWL_RATE_MIMO3_18M_PLCP = 0x12, - IWL_RATE_MIMO3_24M_PLCP = 0x13, - IWL_RATE_MIMO3_36M_PLCP = 0x14, - IWL_RATE_MIMO3_48M_PLCP = 0x15, - IWL_RATE_MIMO3_54M_PLCP = 0x16, - IWL_RATE_MIMO3_60M_PLCP = 0x17, - IWL_RATE_SISO_INVM_PLCP, - IWL_RATE_MIMO2_INVM_PLCP = IWL_RATE_SISO_INVM_PLCP, - IWL_RATE_MIMO3_INVM_PLCP = IWL_RATE_SISO_INVM_PLCP, -}; - -/* MAC header values for bit rates */ -enum { - IWL_RATE_6M_IEEE = 12, - IWL_RATE_9M_IEEE = 18, - IWL_RATE_12M_IEEE = 24, - IWL_RATE_18M_IEEE = 36, - IWL_RATE_24M_IEEE = 48, - IWL_RATE_36M_IEEE = 72, - IWL_RATE_48M_IEEE = 96, - IWL_RATE_54M_IEEE = 108, - IWL_RATE_60M_IEEE = 120, - IWL_RATE_1M_IEEE = 2, - IWL_RATE_2M_IEEE = 4, - IWL_RATE_5M_IEEE = 11, - IWL_RATE_11M_IEEE = 22, -}; - -#define IWL_RATES_MASK ((1 << IWL_RATE_COUNT) - 1) - -#define IWL_INVALID_VALUE -1 - -#define IWL_MIN_RSSI_VAL -100 -#define IWL_MAX_RSSI_VAL 0 - -/* These values specify how many Tx frame attempts before - * searching for a new modulation mode */ -#define IWL_LEGACY_FAILURE_LIMIT 160 -#define IWL_LEGACY_SUCCESS_LIMIT 480 -#define IWL_LEGACY_TABLE_COUNT 160 - -#define IWL_NONE_LEGACY_FAILURE_LIMIT 400 -#define IWL_NONE_LEGACY_SUCCESS_LIMIT 4500 -#define IWL_NONE_LEGACY_TABLE_COUNT 1500 - -/* Success ratio (ACKed / attempted tx frames) values (perfect is 128 * 100) */ -#define IWL_RS_GOOD_RATIO 12800 /* 100% */ -#define IWL_RATE_SCALE_SWITCH 10880 /* 85% */ -#define IWL_RATE_HIGH_TH 10880 /* 85% */ -#define IWL_RATE_INCREASE_TH 6400 /* 50% */ -#define IWL_RATE_DECREASE_TH 1920 /* 15% */ - -/* possible actions when in legacy mode */ -#define IWL_LEGACY_SWITCH_ANTENNA1 0 -#define IWL_LEGACY_SWITCH_ANTENNA2 1 -#define IWL_LEGACY_SWITCH_SISO 2 -#define IWL_LEGACY_SWITCH_MIMO2_AB 3 -#define IWL_LEGACY_SWITCH_MIMO2_AC 4 -#define IWL_LEGACY_SWITCH_MIMO2_BC 5 -#define IWL_LEGACY_SWITCH_MIMO3_ABC 6 - -/* possible actions when in siso mode */ -#define IWL_SISO_SWITCH_ANTENNA1 0 -#define IWL_SISO_SWITCH_ANTENNA2 1 -#define IWL_SISO_SWITCH_MIMO2_AB 2 -#define IWL_SISO_SWITCH_MIMO2_AC 3 -#define IWL_SISO_SWITCH_MIMO2_BC 4 -#define IWL_SISO_SWITCH_GI 5 -#define IWL_SISO_SWITCH_MIMO3_ABC 6 - - -/* possible actions when in mimo mode */ -#define IWL_MIMO2_SWITCH_ANTENNA1 0 -#define IWL_MIMO2_SWITCH_ANTENNA2 1 -#define IWL_MIMO2_SWITCH_SISO_A 2 -#define IWL_MIMO2_SWITCH_SISO_B 3 -#define IWL_MIMO2_SWITCH_SISO_C 4 -#define IWL_MIMO2_SWITCH_GI 5 -#define IWL_MIMO2_SWITCH_MIMO3_ABC 6 - - -/* possible actions when in mimo3 mode */ -#define IWL_MIMO3_SWITCH_ANTENNA1 0 -#define IWL_MIMO3_SWITCH_ANTENNA2 1 -#define IWL_MIMO3_SWITCH_SISO_A 2 -#define IWL_MIMO3_SWITCH_SISO_B 3 -#define IWL_MIMO3_SWITCH_SISO_C 4 -#define IWL_MIMO3_SWITCH_MIMO2_AB 5 -#define IWL_MIMO3_SWITCH_MIMO2_AC 6 -#define IWL_MIMO3_SWITCH_MIMO2_BC 7 -#define IWL_MIMO3_SWITCH_GI 8 - - -#define IWL_MAX_11N_MIMO3_SEARCH IWL_MIMO3_SWITCH_GI -#define IWL_MAX_SEARCH IWL_MIMO2_SWITCH_MIMO3_ABC - -/*FIXME:RS:add possible actions for MIMO3*/ - -#define IWL_ACTION_LIMIT 3 /* # possible actions */ - -#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */ -#define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000) -#define LINK_QUAL_AGG_TIME_LIMIT_MIN (100) - -#define LINK_QUAL_AGG_DISABLE_START_DEF (3) -#define LINK_QUAL_AGG_DISABLE_START_MAX (255) -#define LINK_QUAL_AGG_DISABLE_START_MIN (0) - -#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (63) -#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63) -#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0) - -#define LQ_SIZE 2 /* 2 mode tables: "Active" and "Search" */ - -/* load per tid defines for A-MPDU activation */ -#define IWL_AGG_TPT_THREHOLD 0 -#define IWL_AGG_LOAD_THRESHOLD 10 -#define IWL_AGG_ALL_TID 0xff -#define TID_QUEUE_CELL_SPACING 50 /*mS */ -#define TID_QUEUE_MAX_SIZE 20 -#define TID_ROUND_VALUE 5 /* mS */ - -#define TID_MAX_TIME_DIFF ((TID_QUEUE_MAX_SIZE - 1) * TID_QUEUE_CELL_SPACING) -#define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y)) - -enum iwl_table_type { - LQ_NONE, - LQ_G, /* legacy types */ - LQ_A, - LQ_SISO, /* high-throughput types */ - LQ_MIMO2, - LQ_MIMO3, - LQ_MAX, -}; - -#define is_legacy(tbl) (((tbl) == LQ_G) || ((tbl) == LQ_A)) -#define is_siso(tbl) ((tbl) == LQ_SISO) -#define is_mimo2(tbl) ((tbl) == LQ_MIMO2) -#define is_mimo3(tbl) ((tbl) == LQ_MIMO3) -#define is_mimo(tbl) (is_mimo2(tbl) || is_mimo3(tbl)) -#define is_Ht(tbl) (is_siso(tbl) || is_mimo(tbl)) -#define is_a_band(tbl) ((tbl) == LQ_A) -#define is_g_and(tbl) ((tbl) == LQ_G) - -#define IWL_MAX_MCS_DISPLAY_SIZE 12 - -struct iwl_rate_mcs_info { - char mbps[IWL_MAX_MCS_DISPLAY_SIZE]; - char mcs[IWL_MAX_MCS_DISPLAY_SIZE]; -}; - -/** - * struct iwl_rate_scale_data -- tx success history for one rate - */ -struct iwl_rate_scale_data { - u64 data; /* bitmap of successful frames */ - s32 success_counter; /* number of frames successful */ - s32 success_ratio; /* per-cent * 128 */ - s32 counter; /* number of frames attempted */ - s32 average_tpt; /* success ratio * expected throughput */ - unsigned long stamp; -}; - -/** - * struct iwl_scale_tbl_info -- tx params and success history for all rates - * - * There are two of these in struct iwl_lq_sta, - * one for "active", and one for "search". - */ -struct iwl_scale_tbl_info { - enum iwl_table_type lq_type; - u8 ant_type; - u8 is_SGI; /* 1 = short guard interval */ - u8 is_ht40; /* 1 = 40 MHz channel width */ - u8 action; /* change modulation; IWL_[LEGACY/SISO/MIMO]_SWITCH_* */ - u8 max_search; /* maximun number of tables we can search */ - s32 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */ - u32 current_rate; /* rate_n_flags, uCode API format */ - struct iwl_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */ -}; - -struct iwl_traffic_load { - unsigned long time_stamp; /* age of the oldest statistics */ - u32 packet_count[TID_QUEUE_MAX_SIZE]; /* packet count in this time - * slice */ - u32 total; /* total num of packets during the - * last TID_MAX_TIME_DIFF */ - u8 queue_count; /* number of queues that has - * been used since the last cleanup */ - u8 head; /* start of the circular buffer */ -}; - -/** - * struct iwl_lq_sta -- driver's rate scaling private structure - * - * Pointer to this gets passed back and forth between driver and mac80211. - */ -struct iwl_lq_sta { - u8 active_tbl; /* index of active table, range 0-1 */ - u8 enable_counter; /* indicates HT mode */ - u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */ - u8 search_better_tbl; /* 1: currently trying alternate mode */ - s32 last_tpt; - - /* The following determine when to search for a new mode */ - u32 table_count_limit; - u32 max_failure_limit; /* # failed frames before new search */ - u32 max_success_limit; /* # successful frames before new search */ - u32 table_count; - u32 total_failed; /* total failed frames, any/all rates */ - u32 total_success; /* total successful frames, any/all rates */ - u64 flush_timer; /* time staying in mode before new search */ - - u8 action_counter; /* # mode-switch actions tried */ - u8 is_green; - enum ieee80211_band band; - - /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */ - u32 supp_rates; - u16 active_legacy_rate; - u16 active_siso_rate; - u16 active_mimo2_rate; - u16 active_mimo3_rate; - s8 max_rate_idx; /* Max rate set by user */ - u8 missed_rate_counter; - - struct iwl_lq_cmd lq; - struct iwl_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ - struct iwl_traffic_load load[IWL_MAX_TID_COUNT]; - u8 tx_agg_tid_en; -#ifdef CONFIG_MAC80211_DEBUGFS - struct dentry *rs_sta_dbgfs_scale_table_file; - struct dentry *rs_sta_dbgfs_stats_table_file; - struct dentry *rs_sta_dbgfs_rate_scale_data_file; - struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file; - u32 dbg_fixed_rate; -#endif - struct iwl_mvm *drv; - - /* used to be in sta_info */ - int last_txrate_idx; - /* last tx rate_n_flags */ - u32 last_rate_n_flags; - /* packets destined for this STA are aggregated */ - u8 is_agg; - /* BT traffic this sta was last updated in */ - u8 last_bt_traffic; -}; - -static inline u8 num_of_ant(u8 mask) -{ - return !!((mask) & ANT_A) + - !!((mask) & ANT_B) + - !!((mask) & ANT_C); -} - -/* Initialize station's rate scaling information after adding station */ -extern void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, - struct ieee80211_sta *sta, - enum ieee80211_band band); - -/** - * iwl_rate_control_register - Register the rate control algorithm callbacks - * - * Since the rate control algorithm is hardware specific, there is no need - * or reason to place it as a stand alone module. The driver can call - * iwl_rate_control_register in order to register the rate control callbacks - * with the mac80211 subsystem. This should be performed prior to calling - * ieee80211_register_hw - * - */ -extern int iwl_mvm_rate_control_register(void); - -/** - * iwl_rate_control_unregister - Unregister the rate control callbacks - * - * This should be called after calling ieee80211_unregister_hw, but before - * the driver is unloaded. - */ -extern void iwl_mvm_rate_control_unregister(void); - -#endif /* __rs__ */ diff --git a/drivers/net/wireless/iwlwifi/mvm/rx.c b/drivers/net/wireless/iwlwifi/mvm/rx.c deleted file mode 100644 index 4dfc21a3e83e..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/rx.c +++ /dev/null @@ -1,365 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ -#include "iwl-trans.h" - -#include "mvm.h" -#include "fw-api.h" - -/* - * iwl_mvm_rx_rx_phy_cmd - REPLY_RX_PHY_CMD handler - * - * Copies the phy information in mvm->last_phy_info, it will be used when the - * actual data will come from the fw in the next packet. - */ -int iwl_mvm_rx_rx_phy_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - - memcpy(&mvm->last_phy_info, pkt->data, sizeof(mvm->last_phy_info)); - mvm->ampdu_ref++; - return 0; -} - -/* - * iwl_mvm_pass_packet_to_mac80211 - builds the packet for mac80211 - * - * Adds the rxb to a new skb and give it to mac80211 - */ -static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm, - struct ieee80211_hdr *hdr, u16 len, - u32 ampdu_status, - struct iwl_rx_cmd_buffer *rxb, - struct ieee80211_rx_status *stats) -{ - struct sk_buff *skb; - unsigned int hdrlen, fraglen; - - /* Dont use dev_alloc_skb(), we'll have enough headroom once - * ieee80211_hdr pulled. - */ - skb = alloc_skb(128, GFP_ATOMIC); - if (!skb) { - IWL_ERR(mvm, "alloc_skb failed\n"); - return; - } - /* If frame is small enough to fit in skb->head, pull it completely. - * If not, only pull ieee80211_hdr so that splice() or TCP coalesce - * are more efficient. - */ - hdrlen = (len <= skb_tailroom(skb)) ? len : sizeof(*hdr); - - memcpy(skb_put(skb, hdrlen), hdr, hdrlen); - fraglen = len - hdrlen; - - if (fraglen) { - int offset = (void *)hdr + hdrlen - - rxb_addr(rxb) + rxb_offset(rxb); - - skb_add_rx_frag(skb, 0, rxb_steal_page(rxb), offset, - fraglen, rxb->truesize); - } - - memcpy(IEEE80211_SKB_RXCB(skb), stats, sizeof(*stats)); - - ieee80211_rx_ni(mvm->hw, skb); -} - -/* - * iwl_mvm_calc_rssi - calculate the rssi in dBm - * @phy_info: the phy information for the coming packet - */ -static int iwl_mvm_calc_rssi(struct iwl_mvm *mvm, - struct iwl_rx_phy_info *phy_info) -{ - int rssi_a, rssi_b, rssi_a_dbm, rssi_b_dbm, max_rssi_dbm; - int rssi_all_band_a, rssi_all_band_b; - u32 agc_a, agc_b, max_agc; - u32 val; - - /* Find max rssi among 2 possible receivers. - * These values are measured by the Digital Signal Processor (DSP). - * They should stay fairly constant even as the signal strength varies, - * if the radio's Automatic Gain Control (AGC) is working right. - * AGC value (see below) will provide the "interesting" info. - */ - val = le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_AGC_IDX]); - agc_a = (val & IWL_OFDM_AGC_A_MSK) >> IWL_OFDM_AGC_A_POS; - agc_b = (val & IWL_OFDM_AGC_B_MSK) >> IWL_OFDM_AGC_B_POS; - max_agc = max_t(u32, agc_a, agc_b); - - val = le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_RSSI_AB_IDX]); - rssi_a = (val & IWL_OFDM_RSSI_INBAND_A_MSK) >> IWL_OFDM_RSSI_A_POS; - rssi_b = (val & IWL_OFDM_RSSI_INBAND_B_MSK) >> IWL_OFDM_RSSI_B_POS; - rssi_all_band_a = (val & IWL_OFDM_RSSI_ALLBAND_A_MSK) >> - IWL_OFDM_RSSI_ALLBAND_A_POS; - rssi_all_band_b = (val & IWL_OFDM_RSSI_ALLBAND_B_MSK) >> - IWL_OFDM_RSSI_ALLBAND_B_POS; - - /* - * dBm = rssi dB - agc dB - constant. - * Higher AGC (higher radio gain) means lower signal. - */ - rssi_a_dbm = rssi_a - IWL_RSSI_OFFSET - agc_a; - rssi_b_dbm = rssi_b - IWL_RSSI_OFFSET - agc_b; - max_rssi_dbm = max_t(int, rssi_a_dbm, rssi_b_dbm); - - IWL_DEBUG_STATS(mvm, "Rssi In A %d B %d Max %d AGCA %d AGCB %d\n", - rssi_a_dbm, rssi_b_dbm, max_rssi_dbm, agc_a, agc_b); - - return max_rssi_dbm; -} - -/* - * iwl_mvm_set_mac80211_rx_flag - translate fw status to mac80211 format - * @mvm: the mvm object - * @hdr: 80211 header - * @stats: status in mac80211's format - * @rx_pkt_status: status coming from fw - * - * returns non 0 value if the packet should be dropped - */ -static u32 iwl_mvm_set_mac80211_rx_flag(struct iwl_mvm *mvm, - struct ieee80211_hdr *hdr, - struct ieee80211_rx_status *stats, - u32 rx_pkt_status) -{ - if (!ieee80211_has_protected(hdr->frame_control) || - (rx_pkt_status & RX_MPDU_RES_STATUS_SEC_ENC_MSK) == - RX_MPDU_RES_STATUS_SEC_NO_ENC) - return 0; - - /* packet was encrypted with unknown alg */ - if ((rx_pkt_status & RX_MPDU_RES_STATUS_SEC_ENC_MSK) == - RX_MPDU_RES_STATUS_SEC_ENC_ERR) - return 0; - - switch (rx_pkt_status & RX_MPDU_RES_STATUS_SEC_ENC_MSK) { - case RX_MPDU_RES_STATUS_SEC_CCM_ENC: - /* alg is CCM: check MIC only */ - if (!(rx_pkt_status & RX_MPDU_RES_STATUS_MIC_OK)) - return -1; - - stats->flag |= RX_FLAG_DECRYPTED; - IWL_DEBUG_WEP(mvm, "hw decrypted CCMP successfully\n"); - return 0; - - case RX_MPDU_RES_STATUS_SEC_TKIP_ENC: - /* Don't drop the frame and decrypt it in SW */ - if (!(rx_pkt_status & RX_MPDU_RES_STATUS_TTAK_OK)) - return 0; - /* fall through if TTAK OK */ - - case RX_MPDU_RES_STATUS_SEC_WEP_ENC: - if (!(rx_pkt_status & RX_MPDU_RES_STATUS_ICV_OK)) - return -1; - - stats->flag |= RX_FLAG_DECRYPTED; - return 0; - - default: - IWL_ERR(mvm, "Unhandled alg: 0x%x\n", rx_pkt_status); - } - - return 0; -} - -/* - * iwl_mvm_rx_rx_mpdu - REPLY_RX_MPDU_CMD handler - * - * Handles the actual data of the Rx packet from the fw - */ -int iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct ieee80211_hdr *hdr; - struct ieee80211_rx_status rx_status = {}; - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_rx_phy_info *phy_info; - struct iwl_rx_mpdu_res_start *rx_res; - u32 len; - u32 ampdu_status; - u32 rate_n_flags; - u32 rx_pkt_status; - - phy_info = &mvm->last_phy_info; - rx_res = (struct iwl_rx_mpdu_res_start *)pkt->data; - hdr = (struct ieee80211_hdr *)(pkt->data + sizeof(*rx_res)); - len = le16_to_cpu(rx_res->byte_count); - rx_pkt_status = le32_to_cpup((__le32 *) - (pkt->data + sizeof(*rx_res) + len)); - - memset(&rx_status, 0, sizeof(rx_status)); - - /* - * drop the packet if it has failed being decrypted by HW - */ - if (iwl_mvm_set_mac80211_rx_flag(mvm, hdr, &rx_status, rx_pkt_status)) { - IWL_DEBUG_DROP(mvm, "Bad decryption results 0x%08x\n", - rx_pkt_status); - return 0; - } - - if ((unlikely(phy_info->cfg_phy_cnt > 20))) { - IWL_DEBUG_DROP(mvm, "dsp size out of range [0,20]: %d\n", - phy_info->cfg_phy_cnt); - return 0; - } - - if (!(rx_pkt_status & RX_MPDU_RES_STATUS_CRC_OK) || - !(rx_pkt_status & RX_MPDU_RES_STATUS_OVERRUN_OK)) { - IWL_DEBUG_RX(mvm, "Bad CRC or FIFO: 0x%08X.\n", rx_pkt_status); - return 0; - } - - /* This will be used in several places later */ - rate_n_flags = le32_to_cpu(phy_info->rate_n_flags); - - /* rx_status carries information about the packet to mac80211 */ - rx_status.mactime = le64_to_cpu(phy_info->timestamp); - rx_status.device_timestamp = le32_to_cpu(phy_info->system_timestamp); - rx_status.band = - (phy_info->phy_flags & cpu_to_le16(RX_RES_PHY_FLAGS_BAND_24)) ? - IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; - rx_status.freq = - ieee80211_channel_to_frequency(le16_to_cpu(phy_info->channel), - rx_status.band); - /* - * TSF as indicated by the fw is at INA time, but mac80211 expects the - * TSF at the beginning of the MPDU. - */ - /*rx_status.flag |= RX_FLAG_MACTIME_MPDU;*/ - - /* Find max signal strength (dBm) among 3 antenna/receiver chains */ - rx_status.signal = iwl_mvm_calc_rssi(mvm, phy_info); - - IWL_DEBUG_STATS_LIMIT(mvm, "Rssi %d, TSF %llu\n", rx_status.signal, - (unsigned long long)rx_status.mactime); - - /* - * "antenna number" - * - * It seems that the antenna field in the phy flags value - * is actually a bit field. This is undefined by radiotap, - * it wants an actual antenna number but I always get "7" - * for most legacy frames I receive indicating that the - * same frame was received on all three RX chains. - * - * I think this field should be removed in favor of a - * new 802.11n radiotap field "RX chains" that is defined - * as a bitmask. - */ - rx_status.antenna = (le16_to_cpu(phy_info->phy_flags) & - RX_RES_PHY_FLAGS_ANTENNA) - >> RX_RES_PHY_FLAGS_ANTENNA_POS; - - /* set the preamble flag if appropriate */ - if (phy_info->phy_flags & cpu_to_le16(RX_RES_PHY_FLAGS_SHORT_PREAMBLE)) - rx_status.flag |= RX_FLAG_SHORTPRE; - - if (phy_info->phy_flags & cpu_to_le16(RX_RES_PHY_FLAGS_AGG)) { - /* - * We know which subframes of an A-MPDU belong - * together since we get a single PHY response - * from the firmware for all of them - */ - rx_status.flag |= RX_FLAG_AMPDU_DETAILS; - rx_status.ampdu_reference = mvm->ampdu_ref; - } - - /* Set up the HT phy flags */ - switch (rate_n_flags & RATE_MCS_CHAN_WIDTH_MSK) { - case RATE_MCS_CHAN_WIDTH_20: - break; - case RATE_MCS_CHAN_WIDTH_40: - rx_status.flag |= RX_FLAG_40MHZ; - break; - case RATE_MCS_CHAN_WIDTH_80: - rx_status.flag |= RX_FLAG_80MHZ; - break; - case RATE_MCS_CHAN_WIDTH_160: - rx_status.flag |= RX_FLAG_160MHZ; - break; - } - if (rate_n_flags & RATE_MCS_SGI_MSK) - rx_status.flag |= RX_FLAG_SHORT_GI; - if (rate_n_flags & RATE_HT_MCS_GF_MSK) - rx_status.flag |= RX_FLAG_HT_GF; - if (rate_n_flags & RATE_MCS_HT_MSK) { - rx_status.flag |= RX_FLAG_HT; - rx_status.rate_idx = rate_n_flags & RATE_HT_MCS_INDEX_MSK; - } else if (rate_n_flags & RATE_MCS_VHT_MSK) { - rx_status.vht_nss = - ((rate_n_flags & RATE_VHT_MCS_NSS_MSK) >> - RATE_VHT_MCS_NSS_POS) + 1; - rx_status.rate_idx = rate_n_flags & RATE_VHT_MCS_RATE_CODE_MSK; - rx_status.flag |= RX_FLAG_VHT; - } else { - rx_status.rate_idx = - iwl_mvm_legacy_rate_to_mac80211_idx(rate_n_flags, - rx_status.band); - } - - iwl_mvm_pass_packet_to_mac80211(mvm, hdr, len, ampdu_status, - rxb, &rx_status); - return 0; -} diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c deleted file mode 100644 index 8e1f6c095a9e..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ /dev/null @@ -1,441 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#include -#include - -#include "mvm.h" -#include "iwl-eeprom-parse.h" -#include "fw-api-scan.h" - -#define IWL_PLCP_QUIET_THRESH 1 -#define IWL_ACTIVE_QUIET_TIME 10 - -static inline __le16 iwl_mvm_scan_rx_chain(struct iwl_mvm *mvm) -{ - u16 rx_chain; - u8 rx_ant = iwl_fw_valid_rx_ant(mvm->fw); - - rx_chain = rx_ant << PHY_RX_CHAIN_VALID_POS; - rx_chain |= rx_ant << PHY_RX_CHAIN_FORCE_MIMO_SEL_POS; - rx_chain |= rx_ant << PHY_RX_CHAIN_FORCE_SEL_POS; - rx_chain |= 0x1 << PHY_RX_CHAIN_DRIVER_FORCE_POS; - return cpu_to_le16(rx_chain); -} - -static inline __le32 iwl_mvm_scan_max_out_time(struct ieee80211_vif *vif) -{ - if (vif->bss_conf.assoc) - return cpu_to_le32(200 * 1024); - else - return 0; -} - -static inline __le32 iwl_mvm_scan_suspend_time(struct ieee80211_vif *vif) -{ - if (vif->bss_conf.assoc) - return cpu_to_le32(vif->bss_conf.beacon_int); - else - return 0; -} - -static inline __le32 -iwl_mvm_scan_rxon_flags(struct cfg80211_scan_request *req) -{ - if (req->channels[0]->band == IEEE80211_BAND_2GHZ) - return cpu_to_le32(PHY_BAND_24); - else - return cpu_to_le32(PHY_BAND_5); -} - -static inline __le32 -iwl_mvm_scan_rate_n_flags(struct iwl_mvm *mvm, enum ieee80211_band band, - bool no_cck) -{ - u32 tx_ant; - - mvm->scan_last_antenna_idx = - iwl_mvm_next_antenna(mvm, iwl_fw_valid_tx_ant(mvm->fw), - mvm->scan_last_antenna_idx); - tx_ant = BIT(mvm->scan_last_antenna_idx) << RATE_MCS_ANT_POS; - - if (band == IEEE80211_BAND_2GHZ && !no_cck) - return cpu_to_le32(IWL_RATE_1M_PLCP | RATE_MCS_CCK_MSK | - tx_ant); - else - return cpu_to_le32(IWL_RATE_6M_PLCP | tx_ant); -} - -/* - * We insert the SSIDs in an inverted order, because the FW will - * invert it back. The most prioritized SSID, which is first in the - * request list, is not copied here, but inserted directly to the probe - * request. - */ -static void iwl_mvm_scan_fill_ssids(struct iwl_scan_cmd *cmd, - struct cfg80211_scan_request *req) -{ - int fw_idx, req_idx; - - for (req_idx = req->n_ssids - 1, fw_idx = 0; req_idx > 0; - req_idx--, fw_idx++) { - cmd->direct_scan[fw_idx].id = WLAN_EID_SSID; - cmd->direct_scan[fw_idx].len = req->ssids[req_idx].ssid_len; - memcpy(cmd->direct_scan[fw_idx].ssid, - req->ssids[req_idx].ssid, - req->ssids[req_idx].ssid_len); - } -} - -/* - * If req->n_ssids > 0, it means we should do an active scan. - * In case of active scan w/o directed scan, we receive a zero-length SSID - * just to notify that this scan is active and not passive. - * In order to notify the FW of the number of SSIDs we wish to scan (including - * the zero-length one), we need to set the corresponding bits in chan->type, - * one for each SSID, and set the active bit (first). - */ -static u16 iwl_mvm_get_active_dwell(enum ieee80211_band band, int n_ssids) -{ - if (band == IEEE80211_BAND_2GHZ) - return 30 + 3 * (n_ssids + 1); - return 20 + 2 * (n_ssids + 1); -} - -static u16 iwl_mvm_get_passive_dwell(enum ieee80211_band band) -{ - return band == IEEE80211_BAND_2GHZ ? 100 + 20 : 100 + 10; -} - -static void iwl_mvm_scan_fill_channels(struct iwl_scan_cmd *cmd, - struct cfg80211_scan_request *req) -{ - u16 passive_dwell = iwl_mvm_get_passive_dwell(req->channels[0]->band); - u16 active_dwell = iwl_mvm_get_active_dwell(req->channels[0]->band, - req->n_ssids); - struct iwl_scan_channel *chan = (struct iwl_scan_channel *) - (cmd->data + le16_to_cpu(cmd->tx_cmd.len)); - int i; - - for (i = 0; i < cmd->channel_count; i++) { - chan->channel = cpu_to_le16(req->channels[i]->hw_value); - chan->type = cpu_to_le32(BIT(req->n_ssids) - 1); - if (req->channels[i]->flags & IEEE80211_CHAN_PASSIVE_SCAN) - chan->type &= cpu_to_le32(~SCAN_CHANNEL_TYPE_ACTIVE); - chan->active_dwell = cpu_to_le16(active_dwell); - chan->passive_dwell = cpu_to_le16(passive_dwell); - chan->iteration_count = cpu_to_le16(1); - chan++; - } -} - -/* - * Fill in probe request with the following parameters: - * TA is our vif HW address, which mac80211 ensures we have. - * Packet is broadcasted, so this is both SA and DA. - * The probe request IE is made out of two: first comes the most prioritized - * SSID if a directed scan is requested. Second comes whatever extra - * information was given to us as the scan request IE. - */ -static u16 iwl_mvm_fill_probe_req(struct ieee80211_mgmt *frame, const u8 *ta, - int n_ssids, const u8 *ssid, int ssid_len, - const u8 *ie, int ie_len, - int left) -{ - int len = 0; - u8 *pos = NULL; - - /* Make sure there is enough space for the probe request, - * two mandatory IEs and the data */ - left -= 24; - if (left < 0) - return 0; - - frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); - eth_broadcast_addr(frame->da); - memcpy(frame->sa, ta, ETH_ALEN); - eth_broadcast_addr(frame->bssid); - frame->seq_ctrl = 0; - - len += 24; - - /* for passive scans, no need to fill anything */ - if (n_ssids == 0) - return (u16)len; - - /* points to the payload of the request */ - pos = &frame->u.probe_req.variable[0]; - - /* fill in our SSID IE */ - left -= ssid_len + 2; - if (left < 0) - return 0; - *pos++ = WLAN_EID_SSID; - *pos++ = ssid_len; - if (ssid && ssid_len) { /* ssid_len may be == 0 even if ssid is valid */ - memcpy(pos, ssid, ssid_len); - pos += ssid_len; - } - - len += ssid_len + 2; - - if (WARN_ON(left < ie_len)) - return len; - - if (ie && ie_len) { - memcpy(pos, ie, ie_len); - len += ie_len; - } - - return (u16)len; -} - -int iwl_mvm_scan_request(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct cfg80211_scan_request *req) -{ - struct iwl_host_cmd hcmd = { - .id = SCAN_REQUEST_CMD, - .len = { 0, }, - .data = { mvm->scan_cmd, }, - .flags = CMD_SYNC, - .dataflags = { IWL_HCMD_DFL_NOCOPY, }, - }; - struct iwl_scan_cmd *cmd = mvm->scan_cmd; - int ret; - u32 status; - int ssid_len = 0; - u8 *ssid = NULL; - - lockdep_assert_held(&mvm->mutex); - BUG_ON(mvm->scan_cmd == NULL); - - IWL_DEBUG_SCAN(mvm, "Handling mac80211 scan request\n"); - mvm->scan_status = IWL_MVM_SCAN_OS; - memset(cmd, 0, sizeof(struct iwl_scan_cmd) + - mvm->fw->ucode_capa.max_probe_length + - (MAX_NUM_SCAN_CHANNELS * sizeof(struct iwl_scan_channel))); - - cmd->channel_count = (u8)req->n_channels; - cmd->quiet_time = cpu_to_le16(IWL_ACTIVE_QUIET_TIME); - cmd->quiet_plcp_th = cpu_to_le16(IWL_PLCP_QUIET_THRESH); - cmd->rxchain_sel_flags = iwl_mvm_scan_rx_chain(mvm); - cmd->max_out_time = iwl_mvm_scan_max_out_time(vif); - cmd->suspend_time = iwl_mvm_scan_suspend_time(vif); - cmd->rxon_flags = iwl_mvm_scan_rxon_flags(req); - cmd->filter_flags = cpu_to_le32(MAC_FILTER_ACCEPT_GRP | - MAC_FILTER_IN_BEACON); - - if (vif->type == NL80211_IFTYPE_P2P_DEVICE) - cmd->type = cpu_to_le32(SCAN_TYPE_DISCOVERY_FORCED); - else - cmd->type = cpu_to_le32(SCAN_TYPE_FORCED); - - /* - * TODO: This is a WA due to a bug in the FW AUX framework that does not - * properly handle time events that fail to be scheduled - */ - cmd->type = cpu_to_le32(SCAN_TYPE_FORCED); - - cmd->repeats = cpu_to_le32(1); - - /* - * If the user asked for passive scan, don't change to active scan if - * you see any activity on the channel - remain passive. - */ - if (req->n_ssids > 0) { - cmd->passive2active = cpu_to_le16(1); - ssid = req->ssids[0].ssid; - ssid_len = req->ssids[0].ssid_len; - } else { - cmd->passive2active = 0; - } - - iwl_mvm_scan_fill_ssids(cmd, req); - - cmd->tx_cmd.tx_flags = cpu_to_le32(TX_CMD_FLG_SEQ_CTL); - cmd->tx_cmd.sta_id = mvm->aux_sta.sta_id; - cmd->tx_cmd.life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE); - cmd->tx_cmd.rate_n_flags = - iwl_mvm_scan_rate_n_flags(mvm, req->channels[0]->band, - req->no_cck); - - cmd->tx_cmd.len = - cpu_to_le16(iwl_mvm_fill_probe_req( - (struct ieee80211_mgmt *)cmd->data, - vif->addr, - req->n_ssids, ssid, ssid_len, - req->ie, req->ie_len, - mvm->fw->ucode_capa.max_probe_length)); - - iwl_mvm_scan_fill_channels(cmd, req); - - cmd->len = cpu_to_le16(sizeof(struct iwl_scan_cmd) + - le16_to_cpu(cmd->tx_cmd.len) + - (cmd->channel_count * sizeof(struct iwl_scan_channel))); - hcmd.len[0] = le16_to_cpu(cmd->len); - - status = SCAN_RESPONSE_OK; - ret = iwl_mvm_send_cmd_status(mvm, &hcmd, &status); - if (!ret && status == SCAN_RESPONSE_OK) { - IWL_DEBUG_SCAN(mvm, "Scan request was sent successfully\n"); - } else { - /* - * If the scan failed, it usually means that the FW was unable - * to allocate the time events. Warn on it, but maybe we - * should try to send the command again with different params. - */ - IWL_ERR(mvm, "Scan failed! status 0x%x ret %d\n", - status, ret); - mvm->scan_status = IWL_MVM_SCAN_NONE; - ret = -EIO; - } - return ret; -} - -int iwl_mvm_rx_scan_response(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_cmd_response *resp = (void *)pkt->data; - - IWL_DEBUG_SCAN(mvm, "Scan response received. status 0x%x\n", - le32_to_cpu(resp->status)); - return 0; -} - -int iwl_mvm_rx_scan_complete(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_scan_complete_notif *notif = (void *)pkt->data; - - IWL_DEBUG_SCAN(mvm, "Scan complete: status=0x%x scanned channels=%d\n", - notif->status, notif->scanned_channels); - - mvm->scan_status = IWL_MVM_SCAN_NONE; - ieee80211_scan_completed(mvm->hw, notif->status != SCAN_COMP_STATUS_OK); - - return 0; -} - -static bool iwl_mvm_scan_abort_notif(struct iwl_notif_wait_data *notif_wait, - struct iwl_rx_packet *pkt, void *data) -{ - struct iwl_mvm *mvm = - container_of(notif_wait, struct iwl_mvm, notif_wait); - struct iwl_scan_complete_notif *notif; - u32 *resp; - - switch (pkt->hdr.cmd) { - case SCAN_ABORT_CMD: - resp = (void *)pkt->data; - if (*resp == CAN_ABORT_STATUS) { - IWL_DEBUG_SCAN(mvm, - "Scan can be aborted, wait until completion\n"); - return false; - } - - IWL_DEBUG_SCAN(mvm, "Scan cannot be aborted, exit now: %d\n", - *resp); - return true; - - case SCAN_COMPLETE_NOTIFICATION: - notif = (void *)pkt->data; - IWL_DEBUG_SCAN(mvm, "Scan aborted: status 0x%x\n", - notif->status); - return true; - - default: - WARN_ON(1); - return false; - }; -} - -void iwl_mvm_cancel_scan(struct iwl_mvm *mvm) -{ - struct iwl_notification_wait wait_scan_abort; - static const u8 scan_abort_notif[] = { SCAN_ABORT_CMD, - SCAN_COMPLETE_NOTIFICATION }; - int ret; - - iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_abort, - scan_abort_notif, - ARRAY_SIZE(scan_abort_notif), - iwl_mvm_scan_abort_notif, NULL); - - ret = iwl_mvm_send_cmd_pdu(mvm, SCAN_ABORT_CMD, CMD_SYNC, 0, NULL); - if (ret) { - IWL_ERR(mvm, "Couldn't send SCAN_ABORT_CMD: %d\n", ret); - goto out_remove_notif; - } - - ret = iwl_wait_notification(&mvm->notif_wait, &wait_scan_abort, 1 * HZ); - if (ret) - IWL_ERR(mvm, "%s - failed on timeout\n", __func__); - - return; - -out_remove_notif: - iwl_remove_notification(&mvm->notif_wait, &wait_scan_abort); -} diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c deleted file mode 100644 index 68f0bbe1f381..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/sta.c +++ /dev/null @@ -1,1333 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#include - -#include "mvm.h" -#include "sta.h" - -static int iwl_mvm_find_free_sta_id(struct iwl_mvm *mvm) -{ - int sta_id; - - WARN_ON_ONCE(test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)); - - lockdep_assert_held(&mvm->mutex); - - /* Don't take rcu_read_lock() since we are protected by mvm->mutex */ - for (sta_id = 0; sta_id < IWL_MVM_STATION_COUNT; sta_id++) - if (!rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], - lockdep_is_held(&mvm->mutex))) - return sta_id; - return IWL_MVM_STATION_COUNT; -} - -/* send station add/update command to firmware */ -int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta, - bool update) -{ - struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; - struct iwl_mvm_add_sta_cmd add_sta_cmd; - int ret; - u32 status; - u32 agg_size = 0, mpdu_dens = 0; - - memset(&add_sta_cmd, 0, sizeof(add_sta_cmd)); - - add_sta_cmd.sta_id = mvm_sta->sta_id; - add_sta_cmd.mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color); - if (!update) { - add_sta_cmd.tfd_queue_msk = cpu_to_le32(mvm_sta->tfd_queue_msk); - memcpy(&add_sta_cmd.addr, sta->addr, ETH_ALEN); - } - add_sta_cmd.add_modify = update ? 1 : 0; - - add_sta_cmd.station_flags_msk |= cpu_to_le32(STA_FLG_FAT_EN_MSK | - STA_FLG_MIMO_EN_MSK); - - switch (sta->bandwidth) { - case IEEE80211_STA_RX_BW_160: - add_sta_cmd.station_flags |= cpu_to_le32(STA_FLG_FAT_EN_160MHZ); - /* fall through */ - case IEEE80211_STA_RX_BW_80: - add_sta_cmd.station_flags |= cpu_to_le32(STA_FLG_FAT_EN_80MHZ); - /* fall through */ - case IEEE80211_STA_RX_BW_40: - add_sta_cmd.station_flags |= cpu_to_le32(STA_FLG_FAT_EN_40MHZ); - /* fall through */ - case IEEE80211_STA_RX_BW_20: - if (sta->ht_cap.ht_supported) - add_sta_cmd.station_flags |= - cpu_to_le32(STA_FLG_FAT_EN_20MHZ); - break; - } - - switch (sta->rx_nss) { - case 1: - add_sta_cmd.station_flags |= cpu_to_le32(STA_FLG_MIMO_EN_SISO); - break; - case 2: - add_sta_cmd.station_flags |= cpu_to_le32(STA_FLG_MIMO_EN_MIMO2); - break; - case 3 ... 8: - add_sta_cmd.station_flags |= cpu_to_le32(STA_FLG_MIMO_EN_MIMO3); - break; - } - - switch (sta->smps_mode) { - case IEEE80211_SMPS_AUTOMATIC: - case IEEE80211_SMPS_NUM_MODES: - WARN_ON(1); - break; - case IEEE80211_SMPS_STATIC: - /* override NSS */ - add_sta_cmd.station_flags &= ~cpu_to_le32(STA_FLG_MIMO_EN_MSK); - add_sta_cmd.station_flags |= cpu_to_le32(STA_FLG_MIMO_EN_SISO); - break; - case IEEE80211_SMPS_DYNAMIC: - add_sta_cmd.station_flags |= cpu_to_le32(STA_FLG_RTS_MIMO_PROT); - break; - case IEEE80211_SMPS_OFF: - /* nothing */ - break; - } - - if (sta->ht_cap.ht_supported) { - add_sta_cmd.station_flags_msk |= - cpu_to_le32(STA_FLG_MAX_AGG_SIZE_MSK | - STA_FLG_AGG_MPDU_DENS_MSK); - - mpdu_dens = sta->ht_cap.ampdu_density; - } - - if (sta->vht_cap.vht_supported) { - agg_size = sta->vht_cap.cap & - IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK; - agg_size >>= - IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT; - } else if (sta->ht_cap.ht_supported) { - agg_size = sta->ht_cap.ampdu_factor; - } - - add_sta_cmd.station_flags |= - cpu_to_le32(agg_size << STA_FLG_MAX_AGG_SIZE_SHIFT); - add_sta_cmd.station_flags |= - cpu_to_le32(mpdu_dens << STA_FLG_AGG_MPDU_DENS_SHIFT); - - status = ADD_STA_SUCCESS; - ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(add_sta_cmd), - &add_sta_cmd, &status); - if (ret) - return ret; - - switch (status) { - case ADD_STA_SUCCESS: - IWL_DEBUG_ASSOC(mvm, "ADD_STA PASSED\n"); - break; - default: - ret = -EIO; - IWL_ERR(mvm, "ADD_STA failed\n"); - break; - } - - return ret; -} - -int iwl_mvm_add_sta(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; - int i, ret, sta_id; - - lockdep_assert_held(&mvm->mutex); - - if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) - sta_id = iwl_mvm_find_free_sta_id(mvm); - else - sta_id = mvm_sta->sta_id; - - if (WARN_ON_ONCE(sta_id == IWL_MVM_STATION_COUNT)) - return -ENOSPC; - - spin_lock_init(&mvm_sta->lock); - - mvm_sta->sta_id = sta_id; - mvm_sta->mac_id_n_color = FW_CMD_ID_AND_COLOR(mvmvif->id, - mvmvif->color); - mvm_sta->vif = vif; - mvm_sta->max_agg_bufsize = LINK_QUAL_AGG_FRAME_LIMIT_DEF; - - /* HW restart, don't assume the memory has been zeroed */ - atomic_set(&mvm->pending_frames[sta_id], 0); - mvm_sta->tid_disable_agg = 0; - mvm_sta->tfd_queue_msk = 0; - for (i = 0; i < IEEE80211_NUM_ACS; i++) - if (vif->hw_queue[i] != IEEE80211_INVAL_HW_QUEUE) - mvm_sta->tfd_queue_msk |= BIT(vif->hw_queue[i]); - - /* for HW restart - need to reset the seq_number etc... */ - memset(mvm_sta->tid_data, 0, sizeof(mvm_sta->tid_data)); - - ret = iwl_mvm_sta_send_to_fw(mvm, sta, false); - if (ret) - return ret; - - /* The first station added is the AP, the others are TDLS STAs */ - if (vif->type == NL80211_IFTYPE_STATION && - mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT) - mvmvif->ap_sta_id = sta_id; - - rcu_assign_pointer(mvm->fw_id_to_mac_id[sta_id], sta); - - return 0; -} - -int iwl_mvm_update_sta(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - return iwl_mvm_sta_send_to_fw(mvm, sta, true); -} - -int iwl_mvm_drain_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, - bool drain) -{ - struct iwl_mvm_add_sta_cmd cmd = {}; - int ret; - u32 status; - - lockdep_assert_held(&mvm->mutex); - - cmd.mac_id_n_color = cpu_to_le32(mvmsta->mac_id_n_color); - cmd.sta_id = mvmsta->sta_id; - cmd.add_modify = STA_MODE_MODIFY; - cmd.station_flags = drain ? cpu_to_le32(STA_FLG_DRAIN_FLOW) : 0; - cmd.station_flags_msk = cpu_to_le32(STA_FLG_DRAIN_FLOW); - - status = ADD_STA_SUCCESS; - ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd), - &cmd, &status); - if (ret) - return ret; - - switch (status) { - case ADD_STA_SUCCESS: - IWL_DEBUG_INFO(mvm, "Frames for staid %d will drained in fw\n", - mvmsta->sta_id); - break; - default: - ret = -EIO; - IWL_ERR(mvm, "Couldn't drain frames for staid %d\n", - mvmsta->sta_id); - break; - } - - return ret; -} - -/* - * Remove a station from the FW table. Before sending the command to remove - * the station validate that the station is indeed known to the driver (sanity - * only). - */ -static int iwl_mvm_rm_sta_common(struct iwl_mvm *mvm, u8 sta_id) -{ - struct ieee80211_sta *sta; - struct iwl_mvm_rm_sta_cmd rm_sta_cmd = { - .sta_id = sta_id, - }; - int ret; - - sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], - lockdep_is_held(&mvm->mutex)); - - /* Note: internal stations are marked as error values */ - if (!sta) { - IWL_ERR(mvm, "Invalid station id\n"); - return -EINVAL; - } - - ret = iwl_mvm_send_cmd_pdu(mvm, REMOVE_STA, CMD_SYNC, - sizeof(rm_sta_cmd), &rm_sta_cmd); - if (ret) { - IWL_ERR(mvm, "Failed to remove station. Id=%d\n", sta_id); - return ret; - } - - return 0; -} - -void iwl_mvm_sta_drained_wk(struct work_struct *wk) -{ - struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm, sta_drained_wk); - u8 sta_id; - - /* - * The mutex is needed because of the SYNC cmd, but not only: if the - * work would run concurrently with iwl_mvm_rm_sta, it would run before - * iwl_mvm_rm_sta sets the station as busy, and exit. Then - * iwl_mvm_rm_sta would set the station as busy, and nobody will clean - * that later. - */ - mutex_lock(&mvm->mutex); - - for_each_set_bit(sta_id, mvm->sta_drained, IWL_MVM_STATION_COUNT) { - int ret; - struct ieee80211_sta *sta = - rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], - lockdep_is_held(&mvm->mutex)); - - /* This station is in use */ - if (!IS_ERR(sta)) - continue; - - if (PTR_ERR(sta) == -EINVAL) { - IWL_ERR(mvm, "Drained sta %d, but it is internal?\n", - sta_id); - continue; - } - - if (!sta) { - IWL_ERR(mvm, "Drained sta %d, but it was NULL?\n", - sta_id); - continue; - } - - WARN_ON(PTR_ERR(sta) != -EBUSY); - /* This station was removed and we waited until it got drained, - * we can now proceed and remove it. - */ - ret = iwl_mvm_rm_sta_common(mvm, sta_id); - if (ret) { - IWL_ERR(mvm, - "Couldn't remove sta %d after it was drained\n", - sta_id); - continue; - } - rcu_assign_pointer(mvm->fw_id_to_mac_id[sta_id], NULL); - clear_bit(sta_id, mvm->sta_drained); - } - - mutex_unlock(&mvm->mutex); -} - -int iwl_mvm_rm_sta(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; - int ret; - - lockdep_assert_held(&mvm->mutex); - - if (vif->type == NL80211_IFTYPE_STATION && - mvmvif->ap_sta_id == mvm_sta->sta_id) { - /* flush its queues here since we are freeing mvm_sta */ - ret = iwl_mvm_flush_tx_path(mvm, mvm_sta->tfd_queue_msk, true); - - /* - * Put a non-NULL since the fw station isn't removed. - * It will be removed after the MAC will be set as - * unassoc. - */ - rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], - ERR_PTR(-EINVAL)); - - /* if we are associated - we can't remove the AP STA now */ - if (vif->bss_conf.assoc) - return ret; - - /* unassoc - go ahead - remove the AP STA now */ - mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT; - } - - /* - * Make sure that the tx response code sees the station as -EBUSY and - * calls the drain worker. - */ - spin_lock_bh(&mvm_sta->lock); - /* - * There are frames pending on the AC queues for this station. - * We need to wait until all the frames are drained... - */ - if (atomic_read(&mvm->pending_frames[mvm_sta->sta_id])) { - rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], - ERR_PTR(-EBUSY)); - spin_unlock_bh(&mvm_sta->lock); - ret = iwl_mvm_drain_sta(mvm, mvm_sta, true); - } else { - spin_unlock_bh(&mvm_sta->lock); - ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id); - rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], NULL); - } - - return ret; -} - -int iwl_mvm_rm_sta_id(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - u8 sta_id) -{ - int ret = iwl_mvm_rm_sta_common(mvm, sta_id); - - lockdep_assert_held(&mvm->mutex); - - rcu_assign_pointer(mvm->fw_id_to_mac_id[sta_id], NULL); - return ret; -} - -int iwl_mvm_allocate_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *sta, - u32 qmask) -{ - if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { - sta->sta_id = iwl_mvm_find_free_sta_id(mvm); - if (WARN_ON_ONCE(sta->sta_id == IWL_MVM_STATION_COUNT)) - return -ENOSPC; - } - - sta->tfd_queue_msk = qmask; - - /* put a non-NULL value so iterating over the stations won't stop */ - rcu_assign_pointer(mvm->fw_id_to_mac_id[sta->sta_id], ERR_PTR(-EINVAL)); - return 0; -} - -void iwl_mvm_dealloc_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *sta) -{ - rcu_assign_pointer(mvm->fw_id_to_mac_id[sta->sta_id], NULL); - memset(sta, 0, sizeof(struct iwl_mvm_int_sta)); - sta->sta_id = IWL_MVM_STATION_COUNT; -} - -static int iwl_mvm_add_int_sta_common(struct iwl_mvm *mvm, - struct iwl_mvm_int_sta *sta, - const u8 *addr, - u16 mac_id, u16 color) -{ - struct iwl_mvm_add_sta_cmd cmd; - int ret; - u32 status; - - lockdep_assert_held(&mvm->mutex); - - memset(&cmd, 0, sizeof(struct iwl_mvm_add_sta_cmd)); - cmd.sta_id = sta->sta_id; - cmd.mac_id_n_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mac_id, - color)); - - cmd.tfd_queue_msk = cpu_to_le32(sta->tfd_queue_msk); - - if (addr) - memcpy(cmd.addr, addr, ETH_ALEN); - - ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd), - &cmd, &status); - if (ret) - return ret; - - switch (status) { - case ADD_STA_SUCCESS: - IWL_DEBUG_INFO(mvm, "Internal station added.\n"); - return 0; - default: - ret = -EIO; - IWL_ERR(mvm, "Add internal station failed, status=0x%x\n", - status); - break; - } - return ret; -} - -int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm) -{ - int ret; - - lockdep_assert_held(&mvm->mutex); - - /* Add the aux station, but without any queues */ - ret = iwl_mvm_allocate_int_sta(mvm, &mvm->aux_sta, 0); - if (ret) - return ret; - - ret = iwl_mvm_add_int_sta_common(mvm, &mvm->aux_sta, NULL, - MAC_INDEX_AUX, 0); - - if (ret) - iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta); - return ret; -} - -/* - * Send the add station command for the vif's broadcast station. - * Assumes that the station was already allocated. - * - * @mvm: the mvm component - * @vif: the interface to which the broadcast station is added - * @bsta: the broadcast station to add. - */ -int iwl_mvm_send_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct iwl_mvm_int_sta *bsta) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - static const u8 baddr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - - lockdep_assert_held(&mvm->mutex); - - if (WARN_ON_ONCE(bsta->sta_id == IWL_MVM_STATION_COUNT)) - return -ENOSPC; - - return iwl_mvm_add_int_sta_common(mvm, bsta, baddr, - mvmvif->id, mvmvif->color); -} - -/* Send the FW a request to remove the station from it's internal data - * structures, but DO NOT remove the entry from the local data structures. */ -int iwl_mvm_send_rm_bcast_sta(struct iwl_mvm *mvm, - struct iwl_mvm_int_sta *bsta) -{ - int ret; - - lockdep_assert_held(&mvm->mutex); - - ret = iwl_mvm_rm_sta_common(mvm, bsta->sta_id); - if (ret) - IWL_WARN(mvm, "Failed sending remove station\n"); - return ret; -} - -/* Allocate a new station entry for the broadcast station to the given vif, - * and send it to the FW. - * Note that each P2P mac should have its own broadcast station. - * - * @mvm: the mvm component - * @vif: the interface to which the broadcast station is added - * @bsta: the broadcast station to add. */ -int iwl_mvm_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct iwl_mvm_int_sta *bsta) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - static const u8 baddr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - u32 qmask; - int ret; - - lockdep_assert_held(&mvm->mutex); - - qmask = iwl_mvm_mac_get_queues_mask(mvm, vif); - ret = iwl_mvm_allocate_int_sta(mvm, bsta, qmask); - if (ret) - return ret; - - ret = iwl_mvm_add_int_sta_common(mvm, bsta, baddr, - mvmvif->id, mvmvif->color); - - if (ret) - iwl_mvm_dealloc_int_sta(mvm, bsta); - return ret; -} - -/* - * Send the FW a request to remove the station from it's internal data - * structures, and in addition remove it from the local data structure. - */ -int iwl_mvm_rm_bcast_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *bsta) -{ - int ret; - - lockdep_assert_held(&mvm->mutex); - - ret = iwl_mvm_rm_sta_common(mvm, bsta->sta_id); - if (ret) - return ret; - - iwl_mvm_dealloc_int_sta(mvm, bsta); - return ret; -} - -int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, - int tid, u16 ssn, bool start) -{ - struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; - struct iwl_mvm_add_sta_cmd cmd = {}; - int ret; - u32 status; - - lockdep_assert_held(&mvm->mutex); - - cmd.mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color); - cmd.sta_id = mvm_sta->sta_id; - cmd.add_modify = STA_MODE_MODIFY; - if (start) { - cmd.add_immediate_ba_tid = (u8) tid; - cmd.add_immediate_ba_ssn = cpu_to_le16(ssn); - } else { - cmd.remove_immediate_ba_tid = (u8) tid; - } - cmd.modify_mask = start ? STA_MODIFY_ADD_BA_TID : - STA_MODIFY_REMOVE_BA_TID; - - status = ADD_STA_SUCCESS; - ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd), - &cmd, &status); - if (ret) - return ret; - - switch (status) { - case ADD_STA_SUCCESS: - IWL_DEBUG_INFO(mvm, "RX BA Session %sed in fw\n", - start ? "start" : "stopp"); - break; - case ADD_STA_IMMEDIATE_BA_FAILURE: - IWL_WARN(mvm, "RX BA Session refused by fw\n"); - ret = -ENOSPC; - break; - default: - ret = -EIO; - IWL_ERR(mvm, "RX BA Session failed %sing, status 0x%x\n", - start ? "start" : "stopp", status); - break; - } - - return ret; -} - -static int iwl_mvm_sta_tx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, - int tid, u8 queue, bool start) -{ - struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; - struct iwl_mvm_add_sta_cmd cmd = {}; - int ret; - u32 status; - - lockdep_assert_held(&mvm->mutex); - - if (start) { - mvm_sta->tfd_queue_msk |= BIT(queue); - mvm_sta->tid_disable_agg &= ~BIT(tid); - } else { - mvm_sta->tfd_queue_msk &= ~BIT(queue); - mvm_sta->tid_disable_agg |= BIT(tid); - } - - cmd.mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color); - cmd.sta_id = mvm_sta->sta_id; - cmd.add_modify = STA_MODE_MODIFY; - cmd.modify_mask = STA_MODIFY_QUEUES | STA_MODIFY_TID_DISABLE_TX; - cmd.tfd_queue_msk = cpu_to_le32(mvm_sta->tfd_queue_msk); - cmd.tid_disable_tx = cpu_to_le16(mvm_sta->tid_disable_agg); - - status = ADD_STA_SUCCESS; - ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd), - &cmd, &status); - if (ret) - return ret; - - switch (status) { - case ADD_STA_SUCCESS: - break; - default: - ret = -EIO; - IWL_ERR(mvm, "TX BA Session failed %sing, status 0x%x\n", - start ? "start" : "stopp", status); - break; - } - - return ret; -} - -static const u8 tid_to_ac[] = { - IEEE80211_AC_BE, - IEEE80211_AC_BK, - IEEE80211_AC_BK, - IEEE80211_AC_BE, - IEEE80211_AC_VI, - IEEE80211_AC_VI, - IEEE80211_AC_VO, - IEEE80211_AC_VO, -}; - -int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid, u16 *ssn) -{ - struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; - struct iwl_mvm_tid_data *tid_data; - int txq_id; - - if (WARN_ON_ONCE(tid >= IWL_MAX_TID_COUNT)) - return -EINVAL; - - if (mvmsta->tid_data[tid].state != IWL_AGG_OFF) { - IWL_ERR(mvm, "Start AGG when state is not IWL_AGG_OFF %d!\n", - mvmsta->tid_data[tid].state); - return -ENXIO; - } - - lockdep_assert_held(&mvm->mutex); - - for (txq_id = IWL_MVM_FIRST_AGG_QUEUE; - txq_id <= IWL_MVM_LAST_AGG_QUEUE; txq_id++) - if (mvm->queue_to_mac80211[txq_id] == - IWL_INVALID_MAC80211_QUEUE) - break; - - if (txq_id > IWL_MVM_LAST_AGG_QUEUE) { - IWL_ERR(mvm, "Failed to allocate agg queue\n"); - return -EIO; - } - - /* the new tx queue is still connected to the same mac80211 queue */ - mvm->queue_to_mac80211[txq_id] = vif->hw_queue[tid_to_ac[tid]]; - - spin_lock_bh(&mvmsta->lock); - tid_data = &mvmsta->tid_data[tid]; - tid_data->ssn = IEEE80211_SEQ_TO_SN(tid_data->seq_number); - tid_data->txq_id = txq_id; - *ssn = tid_data->ssn; - - IWL_DEBUG_TX_QUEUES(mvm, - "Start AGG: sta %d tid %d queue %d - ssn = %d, next_recl = %d\n", - mvmsta->sta_id, tid, txq_id, tid_data->ssn, - tid_data->next_reclaimed); - - if (tid_data->ssn == tid_data->next_reclaimed) { - tid_data->state = IWL_AGG_STARTING; - ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); - } else { - tid_data->state = IWL_EMPTYING_HW_QUEUE_ADDBA; - } - - spin_unlock_bh(&mvmsta->lock); - - return 0; -} - -int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid, u8 buf_size) -{ - struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; - struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; - int queue, fifo, ret; - u16 ssn; - - buf_size = min_t(int, buf_size, LINK_QUAL_AGG_FRAME_LIMIT_DEF); - - spin_lock_bh(&mvmsta->lock); - ssn = tid_data->ssn; - queue = tid_data->txq_id; - tid_data->state = IWL_AGG_ON; - tid_data->ssn = 0xffff; - spin_unlock_bh(&mvmsta->lock); - - fifo = iwl_mvm_ac_to_tx_fifo[tid_to_ac[tid]]; - - ret = iwl_mvm_sta_tx_agg(mvm, sta, tid, queue, true); - if (ret) - return -EIO; - - iwl_trans_txq_enable(mvm->trans, queue, fifo, mvmsta->sta_id, tid, - buf_size, ssn); - - /* - * Even though in theory the peer could have different - * aggregation reorder buffer sizes for different sessions, - * our ucode doesn't allow for that and has a global limit - * for each station. Therefore, use the minimum of all the - * aggregation sessions and our default value. - */ - mvmsta->max_agg_bufsize = - min(mvmsta->max_agg_bufsize, buf_size); - mvmsta->lq_sta.lq.agg_frame_cnt_limit = mvmsta->max_agg_bufsize; - - if (mvm->cfg->ht_params->use_rts_for_aggregation) { - /* - * switch to RTS/CTS if it is the prefer protection - * method for HT traffic - */ - mvmsta->lq_sta.lq.flags |= LQ_FLAG_SET_STA_TLC_RTS_MSK; - /* - * TODO: remove the TLC_RTS flag when we tear down the last - * AGG session (agg_tids_count in DVM) - */ - } - - IWL_DEBUG_HT(mvm, "Tx aggregation enabled on ra = %pM tid = %d\n", - sta->addr, tid); - - return iwl_mvm_send_lq_cmd(mvm, &mvmsta->lq_sta.lq, CMD_ASYNC, false); -} - -int iwl_mvm_sta_tx_agg_stop(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid) -{ - struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; - struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; - u16 txq_id; - int err; - - - /* - * If mac80211 is cleaning its state, then say that we finished since - * our state has been cleared anyway. - */ - if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { - ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); - return 0; - } - - spin_lock_bh(&mvmsta->lock); - - txq_id = tid_data->txq_id; - - IWL_DEBUG_TX_QUEUES(mvm, "Stop AGG: sta %d tid %d q %d state %d\n", - mvmsta->sta_id, tid, txq_id, tid_data->state); - - switch (tid_data->state) { - case IWL_AGG_ON: - tid_data->ssn = IEEE80211_SEQ_TO_SN(tid_data->seq_number); - - IWL_DEBUG_TX_QUEUES(mvm, - "ssn = %d, next_recl = %d\n", - tid_data->ssn, tid_data->next_reclaimed); - - /* There are still packets for this RA / TID in the HW */ - if (tid_data->ssn != tid_data->next_reclaimed) { - tid_data->state = IWL_EMPTYING_HW_QUEUE_DELBA; - err = 0; - break; - } - - tid_data->ssn = 0xffff; - iwl_trans_txq_disable(mvm->trans, txq_id); - /* fall through */ - case IWL_AGG_STARTING: - case IWL_EMPTYING_HW_QUEUE_ADDBA: - /* - * The agg session has been stopped before it was set up. This - * can happen when the AddBA timer times out for example. - */ - - /* No barriers since we are under mutex */ - lockdep_assert_held(&mvm->mutex); - mvm->queue_to_mac80211[txq_id] = IWL_INVALID_MAC80211_QUEUE; - - ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); - tid_data->state = IWL_AGG_OFF; - err = 0; - break; - default: - IWL_ERR(mvm, - "Stopping AGG while state not ON or starting for %d on %d (%d)\n", - mvmsta->sta_id, tid, tid_data->state); - IWL_ERR(mvm, - "\ttid_data->txq_id = %d\n", tid_data->txq_id); - err = -EINVAL; - } - - spin_unlock_bh(&mvmsta->lock); - - return err; -} - -int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid) -{ - struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; - struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; - u16 txq_id; - enum iwl_mvm_agg_state old_state; - - /* - * First set the agg state to OFF to avoid calling - * ieee80211_stop_tx_ba_cb in iwl_mvm_check_ratid_empty. - */ - spin_lock_bh(&mvmsta->lock); - txq_id = tid_data->txq_id; - IWL_DEBUG_TX_QUEUES(mvm, "Flush AGG: sta %d tid %d q %d state %d\n", - mvmsta->sta_id, tid, txq_id, tid_data->state); - old_state = tid_data->state; - tid_data->state = IWL_AGG_OFF; - spin_unlock_bh(&mvmsta->lock); - - if (old_state >= IWL_AGG_ON) { - if (iwl_mvm_flush_tx_path(mvm, BIT(txq_id), true)) - IWL_ERR(mvm, "Couldn't flush the AGG queue\n"); - - iwl_trans_txq_disable(mvm->trans, tid_data->txq_id); - } - - mvm->queue_to_mac80211[tid_data->txq_id] = - IWL_INVALID_MAC80211_QUEUE; - - return 0; -} - -static int iwl_mvm_set_fw_key_idx(struct iwl_mvm *mvm) -{ - int i; - - lockdep_assert_held(&mvm->mutex); - - i = find_first_zero_bit(mvm->fw_key_table, STA_KEY_MAX_NUM); - - if (i == STA_KEY_MAX_NUM) - return STA_KEY_IDX_INVALID; - - __set_bit(i, mvm->fw_key_table); - - return i; -} - -static u8 iwl_mvm_get_key_sta_id(struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct iwl_mvm_vif *mvmvif = (void *)vif->drv_priv; - - if (sta) { - struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; - - return mvm_sta->sta_id; - } - - /* - * The device expects GTKs for station interfaces to be - * installed as GTKs for the AP station. If we have no - * station ID, then use AP's station ID. - */ - if (vif->type == NL80211_IFTYPE_STATION && - mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) - return mvmvif->ap_sta_id; - - return IWL_MVM_STATION_COUNT; -} - -static int iwl_mvm_send_sta_key(struct iwl_mvm *mvm, - struct iwl_mvm_sta *mvm_sta, - struct ieee80211_key_conf *keyconf, - u8 sta_id, u32 tkip_iv32, u16 *tkip_p1k, - u32 cmd_flags) -{ - __le16 key_flags; - struct iwl_mvm_add_sta_cmd cmd = {}; - int ret, status; - u16 keyidx; - int i; - - keyidx = (keyconf->keyidx << STA_KEY_FLG_KEYID_POS) & - STA_KEY_FLG_KEYID_MSK; - key_flags = cpu_to_le16(keyidx); - key_flags |= cpu_to_le16(STA_KEY_FLG_WEP_KEY_MAP); - - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_TKIP: - key_flags |= cpu_to_le16(STA_KEY_FLG_TKIP); - cmd.key.tkip_rx_tsc_byte2 = tkip_iv32; - for (i = 0; i < 5; i++) - cmd.key.tkip_rx_ttak[i] = cpu_to_le16(tkip_p1k[i]); - memcpy(cmd.key.key, keyconf->key, keyconf->keylen); - break; - case WLAN_CIPHER_SUITE_CCMP: - key_flags |= cpu_to_le16(STA_KEY_FLG_CCM); - memcpy(cmd.key.key, keyconf->key, keyconf->keylen); - break; - default: - WARN_ON(1); - return -EINVAL; - } - - if (!(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE)) - key_flags |= cpu_to_le16(STA_KEY_MULTICAST); - - cmd.mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color); - cmd.key.key_offset = keyconf->hw_key_idx; - cmd.key.key_flags = key_flags; - cmd.add_modify = STA_MODE_MODIFY; - cmd.modify_mask = STA_MODIFY_KEY; - cmd.sta_id = sta_id; - - status = ADD_STA_SUCCESS; - if (cmd_flags == CMD_SYNC) - ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd), - &cmd, &status); - else - ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, CMD_ASYNC, - sizeof(cmd), &cmd); - - switch (status) { - case ADD_STA_SUCCESS: - IWL_DEBUG_WEP(mvm, "MODIFY_STA: set dynamic key passed\n"); - break; - default: - ret = -EIO; - IWL_ERR(mvm, "MODIFY_STA: set dynamic key failed\n"); - break; - } - - return ret; -} - -static int iwl_mvm_send_sta_igtk(struct iwl_mvm *mvm, - struct ieee80211_key_conf *keyconf, - u8 sta_id, bool remove_key) -{ - struct iwl_mvm_mgmt_mcast_key_cmd igtk_cmd = {}; - - /* verify the key details match the required command's expectations */ - if (WARN_ON((keyconf->cipher != WLAN_CIPHER_SUITE_AES_CMAC) || - (keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE) || - (keyconf->keyidx != 4 && keyconf->keyidx != 5))) - return -EINVAL; - - igtk_cmd.key_id = cpu_to_le32(keyconf->keyidx); - igtk_cmd.sta_id = cpu_to_le32(sta_id); - - if (remove_key) { - igtk_cmd.ctrl_flags |= cpu_to_le32(STA_KEY_NOT_VALID); - } else { - struct ieee80211_key_seq seq; - const u8 *pn; - - memcpy(igtk_cmd.IGTK, keyconf->key, keyconf->keylen); - ieee80211_aes_cmac_calculate_k1_k2(keyconf, - igtk_cmd.K1, igtk_cmd.K2); - ieee80211_get_key_rx_seq(keyconf, 0, &seq); - pn = seq.aes_cmac.pn; - igtk_cmd.receive_seq_cnt = cpu_to_le64(((u64) pn[5] << 0) | - ((u64) pn[4] << 8) | - ((u64) pn[3] << 16) | - ((u64) pn[2] << 24) | - ((u64) pn[1] << 32) | - ((u64) pn[0] << 40)); - } - - IWL_DEBUG_INFO(mvm, "%s igtk for sta %u\n", - remove_key ? "removing" : "installing", - igtk_cmd.sta_id); - - return iwl_mvm_send_cmd_pdu(mvm, MGMT_MCAST_KEY, CMD_SYNC, - sizeof(igtk_cmd), &igtk_cmd); -} - - -static inline u8 *iwl_mvm_get_mac_addr(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct iwl_mvm_vif *mvmvif = (void *)vif->drv_priv; - - if (sta) - return sta->addr; - - if (vif->type == NL80211_IFTYPE_STATION && - mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { - u8 sta_id = mvmvif->ap_sta_id; - sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], - lockdep_is_held(&mvm->mutex)); - return sta->addr; - } - - - return NULL; -} - -int iwl_mvm_set_sta_key(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *keyconf, - bool have_key_offset) -{ - struct iwl_mvm_sta *mvm_sta; - int ret; - u8 *addr, sta_id; - struct ieee80211_key_seq seq; - u16 p1k[5]; - - lockdep_assert_held(&mvm->mutex); - - /* Get the station id from the mvm local station table */ - sta_id = iwl_mvm_get_key_sta_id(vif, sta); - if (sta_id == IWL_MVM_STATION_COUNT) { - IWL_ERR(mvm, "Failed to find station id\n"); - return -EINVAL; - } - - if (keyconf->cipher == WLAN_CIPHER_SUITE_AES_CMAC) { - ret = iwl_mvm_send_sta_igtk(mvm, keyconf, sta_id, false); - goto end; - } - - /* - * It is possible that the 'sta' parameter is NULL, and thus - * there is a need to retrieve the sta from the local station table. - */ - if (!sta) { - sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], - lockdep_is_held(&mvm->mutex)); - if (IS_ERR_OR_NULL(sta)) { - IWL_ERR(mvm, "Invalid station id\n"); - return -EINVAL; - } - } - - mvm_sta = (struct iwl_mvm_sta *)sta->drv_priv; - if (WARN_ON_ONCE(mvm_sta->vif != vif)) - return -EINVAL; - - if (!have_key_offset) { - /* - * The D3 firmware hardcodes the PTK offset to 0, so we have to - * configure it there. As a result, this workaround exists to - * let the caller set the key offset (hw_key_idx), see d3.c. - */ - keyconf->hw_key_idx = iwl_mvm_set_fw_key_idx(mvm); - if (keyconf->hw_key_idx == STA_KEY_IDX_INVALID) - return -ENOSPC; - } - - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_TKIP: - addr = iwl_mvm_get_mac_addr(mvm, vif, sta); - /* get phase 1 key from mac80211 */ - ieee80211_get_key_rx_seq(keyconf, 0, &seq); - ieee80211_get_tkip_rx_p1k(keyconf, addr, seq.tkip.iv32, p1k); - ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, sta_id, - seq.tkip.iv32, p1k, CMD_SYNC); - break; - case WLAN_CIPHER_SUITE_CCMP: - ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, sta_id, - 0, NULL, CMD_SYNC); - break; - default: - IWL_ERR(mvm, "Unknown cipher %x\n", keyconf->cipher); - ret = -EINVAL; - } - - if (ret) - __clear_bit(keyconf->hw_key_idx, mvm->fw_key_table); - -end: - IWL_DEBUG_WEP(mvm, "key: cipher=%x len=%d idx=%d sta=%pM ret=%d\n", - keyconf->cipher, keyconf->keylen, keyconf->keyidx, - sta->addr, ret); - return ret; -} - -int iwl_mvm_remove_sta_key(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *keyconf) -{ - struct iwl_mvm_sta *mvm_sta; - struct iwl_mvm_add_sta_cmd cmd = {}; - __le16 key_flags; - int ret, status; - u8 sta_id; - - lockdep_assert_held(&mvm->mutex); - - /* Get the station id from the mvm local station table */ - sta_id = iwl_mvm_get_key_sta_id(vif, sta); - - IWL_DEBUG_WEP(mvm, "mvm remove dynamic key: idx=%d sta=%d\n", - keyconf->keyidx, sta_id); - - if (keyconf->cipher == WLAN_CIPHER_SUITE_AES_CMAC) - return iwl_mvm_send_sta_igtk(mvm, keyconf, sta_id, true); - - ret = __test_and_clear_bit(keyconf->hw_key_idx, mvm->fw_key_table); - if (!ret) { - IWL_ERR(mvm, "offset %d not used in fw key table.\n", - keyconf->hw_key_idx); - return -ENOENT; - } - - if (sta_id == IWL_MVM_STATION_COUNT) { - IWL_DEBUG_WEP(mvm, "station non-existent, early return.\n"); - return 0; - } - - /* - * It is possible that the 'sta' parameter is NULL, and thus - * there is a need to retrieve the sta from the local station table, - * for example when a GTK is removed (where the sta_id will then be - * the AP ID, and no station was passed by mac80211.) - */ - if (!sta) { - sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], - lockdep_is_held(&mvm->mutex)); - if (!sta) { - IWL_ERR(mvm, "Invalid station id\n"); - return -EINVAL; - } - } - - mvm_sta = (struct iwl_mvm_sta *)sta->drv_priv; - if (WARN_ON_ONCE(mvm_sta->vif != vif)) - return -EINVAL; - - key_flags = cpu_to_le16((keyconf->keyidx << STA_KEY_FLG_KEYID_POS) & - STA_KEY_FLG_KEYID_MSK); - key_flags |= cpu_to_le16(STA_KEY_FLG_NO_ENC | STA_KEY_FLG_WEP_KEY_MAP); - key_flags |= cpu_to_le16(STA_KEY_NOT_VALID); - - if (!(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE)) - key_flags |= cpu_to_le16(STA_KEY_MULTICAST); - - cmd.mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color); - cmd.key.key_flags = key_flags; - cmd.key.key_offset = keyconf->hw_key_idx; - cmd.sta_id = sta_id; - - cmd.modify_mask = STA_MODIFY_KEY; - cmd.add_modify = STA_MODE_MODIFY; - - status = ADD_STA_SUCCESS; - ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd), - &cmd, &status); - - switch (status) { - case ADD_STA_SUCCESS: - IWL_DEBUG_WEP(mvm, "MODIFY_STA: remove sta key passed\n"); - break; - default: - ret = -EIO; - IWL_ERR(mvm, "MODIFY_STA: remove sta key failed\n"); - break; - } - - return ret; -} - -void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_key_conf *keyconf, - struct ieee80211_sta *sta, u32 iv32, - u16 *phase1key) -{ - struct iwl_mvm_sta *mvm_sta; - u8 sta_id = iwl_mvm_get_key_sta_id(vif, sta); - - if (WARN_ON_ONCE(sta_id == IWL_MVM_STATION_COUNT)) - return; - - rcu_read_lock(); - - if (!sta) { - sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); - if (WARN_ON(IS_ERR_OR_NULL(sta))) { - rcu_read_unlock(); - return; - } - } - - mvm_sta = (void *)sta->drv_priv; - iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, sta_id, - iv32, phase1key, CMD_ASYNC); - rcu_read_unlock(); -} - -void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm, - struct ieee80211_sta *sta) -{ - struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; - struct iwl_mvm_add_sta_cmd cmd = { - .add_modify = STA_MODE_MODIFY, - .sta_id = mvmsta->sta_id, - .station_flags_msk = cpu_to_le32(STA_FLG_PS), - .mac_id_n_color = cpu_to_le32(mvmsta->mac_id_n_color), - }; - int ret; - - ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, CMD_ASYNC, sizeof(cmd), &cmd); - if (ret) - IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret); -} - -void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, - struct ieee80211_sta *sta, - enum ieee80211_frame_release_type reason, - u16 cnt) -{ - u16 sleep_state_flags = - (reason == IEEE80211_FRAME_RELEASE_UAPSD) ? - STA_SLEEP_STATE_UAPSD : STA_SLEEP_STATE_PS_POLL; - struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; - struct iwl_mvm_add_sta_cmd cmd = { - .add_modify = STA_MODE_MODIFY, - .sta_id = mvmsta->sta_id, - .modify_mask = STA_MODIFY_SLEEPING_STA_TX_COUNT, - .sleep_tx_count = cpu_to_le16(cnt), - .mac_id_n_color = cpu_to_le32(mvmsta->mac_id_n_color), - /* - * Same modify mask for sleep_tx_count and sleep_state_flags so - * we must set the sleep_state_flags too. - */ - .sleep_state_flags = cpu_to_le16(sleep_state_flags), - }; - int ret; - - /* TODO: somehow the fw doesn't seem to take PS_POLL into account */ - ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, CMD_ASYNC, sizeof(cmd), &cmd); - if (ret) - IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret); -} diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.h b/drivers/net/wireless/iwlwifi/mvm/sta.h deleted file mode 100644 index a4ddce77aaae..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/sta.h +++ /dev/null @@ -1,376 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#ifndef __sta_h__ -#define __sta_h__ - -#include -#include -#include - -#include "iwl-trans.h" /* for IWL_MAX_TID_COUNT */ -#include "fw-api.h" /* IWL_MVM_STATION_COUNT */ -#include "rs.h" - -struct iwl_mvm; - -/** - * DOC: station table - introduction - * - * The station table is a list of data structure that reprensent the stations. - * In STA/P2P client mode, the driver will hold one station for the AP/ GO. - * In GO/AP mode, the driver will have as many stations as associated clients. - * All these stations are reflected in the fw's station table. The driver - * keeps the fw's station table up to date with the ADD_STA command. Stations - * can be removed by the REMOVE_STA command. - * - * All the data related to a station is held in the structure %iwl_mvm_sta - * which is embed in the mac80211's %ieee80211_sta (in the drv_priv) area. - * This data includes the index of the station in the fw, per tid information - * (sequence numbers, Block-ack state machine, etc...). The stations are - * created and deleted by the %sta_state callback from %ieee80211_ops. - * - * The driver holds a map: %fw_id_to_mac_id that allows to fetch a - * %ieee80211_sta (and the %iwl_mvm_sta embedded into it) based on a fw - * station index. That way, the driver is able to get the tid related data in - * O(1) in time sensitive paths (Tx / Tx response / BA notification). These - * paths are triggered by the fw, and the driver needs to get a pointer to the - * %ieee80211 structure. This map helps to get that pointer quickly. - */ - -/** - * DOC: station table - locking - * - * As stated before, the station is created / deleted by mac80211's %sta_state - * callback from %ieee80211_ops which can sleep. The next paragraph explains - * the locking of a single stations, the next ones relates to the station - * table. - * - * The station holds the sequence number per tid. So this data needs to be - * accessed in the Tx path (which is softIRQ). It also holds the Block-Ack - * information (the state machine / and the logic that checks if the queues - * were drained), so it also needs to be accessible from the Tx response flow. - * In short, the station needs to be access from sleepable context as well as - * from tasklets, so the station itself needs a spinlock. - * - * The writers of %fw_id_to_mac_id map are serialized by the global mutex of - * the mvm op_mode. This is possible since %sta_state can sleep. - * The pointers in this map are RCU protected, hence we won't replace the - * station while we have Tx / Tx response / BA notification running. - * - * If a station is deleted while it still has packets in its A-MPDU queues, - * then the reclaim flow will notice that there is no station in the map for - * sta_id and it will dump the responses. - */ - -/** - * DOC: station table - internal stations - * - * The FW needs a few internal stations that are not reflected in - * mac80211, such as broadcast station in AP / GO mode, or AUX sta for - * scanning and P2P device (during the GO negotiation). - * For these kind of stations we have %iwl_mvm_int_sta struct which holds the - * data relevant for them from both %iwl_mvm_sta and %ieee80211_sta. - * Usually the data for these stations is static, so no locking is required, - * and no TID data as this is also not needed. - * One thing to note, is that these stations have an ID in the fw, but not - * in mac80211. In order to "reserve" them a sta_id in %fw_id_to_mac_id - * we fill ERR_PTR(EINVAL) in this mapping and all other dereferencing of - * pointers from this mapping need to check that the value is not error - * or NULL. - * - * Currently there is only one auxiliary station for scanning, initialized - * on init. - */ - -/** - * DOC: station table - AP Station in STA mode - * - * %iwl_mvm_vif includes the index of the AP station in the fw's STA table: - * %ap_sta_id. To get the point to the coresponsding %ieee80211_sta, - * &fw_id_to_mac_id can be used. Due to the way the fw works, we must not remove - * the AP station from the fw before setting the MAC context as unassociated. - * Hence, %fw_id_to_mac_id[%ap_sta_id] will be NULLed when the AP station is - * removed by mac80211, but the station won't be removed in the fw until the - * VIF is set as unassociated. Then, %ap_sta_id will be invalidated. - */ - -/** - * DOC: station table - Drain vs. Flush - * - * Flush means that all the frames in the SCD queue are dumped regardless the - * station to which they were sent. We do that when we disassociate and before - * we remove the STA of the AP. The flush can be done synchronously against the - * fw. - * Drain means that the fw will drop all the frames sent to a specific station. - * This is useful when a client (if we are IBSS / GO or AP) disassociates. In - * that case, we need to drain all the frames for that client from the AC queues - * that are shared with the other clients. Only then, we can remove the STA in - * the fw. In order to do so, we track the non-AMPDU packets for each station. - * If mac80211 removes a STA and if it still has non-AMPDU packets pending in - * the queues, we mark this station as %EBUSY in %fw_id_to_mac_id, and drop all - * the frames for this STA (%iwl_mvm_rm_sta). When the last frame is dropped - * (we know about it with its Tx response), we remove the station in fw and set - * it as %NULL in %fw_id_to_mac_id: this is the purpose of - * %iwl_mvm_sta_drained_wk. - */ - -/** - * DOC: station table - fw restart - * - * When the fw asserts, or we have any other issue that requires to reset the - * driver, we require mac80211 to reconfigure the driver. Since the private - * data of the stations is embed in mac80211's %ieee80211_sta, that data will - * not be zeroed and needs to be reinitialized manually. - * %IWL_MVM_STATUS_IN_HW_RESTART is set during restart and that will hint us - * that we must not allocate a new sta_id but reuse the previous one. This - * means that the stations being re-added after the reset will have the same - * place in the fw as before the reset. We do need to zero the %fw_id_to_mac_id - * map, since the stations aren't in the fw any more. Internal stations that - * are not added by mac80211 will be re-added in the init flow that is called - * after the restart: mac80211 call's %iwl_mvm_mac_start which calls to - * %iwl_mvm_up. - */ - -/** - * DOC: AP mode - PS - * - * When a station is asleep, the fw will set it as "asleep". All the - * non-aggregation frames to that station will be dropped by the fw - * (%TX_STATUS_FAIL_DEST_PS failure code). - * AMPDUs are in a separate queue that is stopped by the fw. We just need to - * let mac80211 know how many frames we have in these queues so that it can - * properly handle trigger frames. - * When the a trigger frame is received, mac80211 tells the driver to send - * frames from the AMPDU queues or AC queue depending on which queue are - * delivery-enabled and what TID has frames to transmit (Note that mac80211 has - * all the knowledege since all the non-agg frames are buffered / filtered, and - * the driver tells mac80211 about agg frames). The driver needs to tell the fw - * to let frames out even if the station is asleep. This is done by - * %iwl_mvm_sta_modify_sleep_tx_count. - * When we receive a frame from that station with PM bit unset, the - * driver needs to let the fw know that this station isn't alseep any more. - * This is done by %iwl_mvm_sta_modify_ps_wake. - * - * TODO - EOSP handling - */ - -/** - * enum iwl_mvm_agg_state - * - * The state machine of the BA agreement establishment / tear down. - * These states relate to a specific RA / TID. - * - * @IWL_AGG_OFF: aggregation is not used - * @IWL_AGG_STARTING: aggregation are starting (between start and oper) - * @IWL_AGG_ON: aggregation session is up - * @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the - * HW queue to be empty from packets for this RA /TID. - * @IWL_EMPTYING_HW_QUEUE_DELBA: tearing down a BA session - waiting for the - * HW queue to be empty from packets for this RA /TID. - */ -enum iwl_mvm_agg_state { - IWL_AGG_OFF = 0, - IWL_AGG_STARTING, - IWL_AGG_ON, - IWL_EMPTYING_HW_QUEUE_ADDBA, - IWL_EMPTYING_HW_QUEUE_DELBA, -}; - -/** - * struct iwl_mvm_tid_data - holds the states for each RA / TID - * @seq_number: the next WiFi sequence number to use - * @next_reclaimed: the WiFi sequence number of the next packet to be acked. - * This is basically (last acked packet++). - * @rate_n_flags: Rate at which Tx was attempted. Holds the data between the - * Tx response (TX_CMD), and the block ack notification (COMPRESSED_BA). - * @state: state of the BA agreement establishment / tear down. - * @txq_id: Tx queue used by the BA session - * @ssn: the first packet to be sent in AGG HW queue in Tx AGG start flow, or - * the first packet to be sent in legacy HW queue in Tx AGG stop flow. - * Basically when next_reclaimed reaches ssn, we can tell mac80211 that - * we are ready to finish the Tx AGG stop / start flow. - * @wait_for_ba: Expect block-ack before next Tx reply - */ -struct iwl_mvm_tid_data { - u16 seq_number; - u16 next_reclaimed; - /* The rest is Tx AGG related */ - u32 rate_n_flags; - enum iwl_mvm_agg_state state; - u16 txq_id; - u16 ssn; - bool wait_for_ba; -}; - -/** - * struct iwl_mvm_sta - representation of a station in the driver - * @sta_id: the index of the station in the fw (will be replaced by id_n_color) - * @tfd_queue_msk: the tfd queues used by the station - * @mac_id_n_color: the MAC context this station is linked to - * @tid_disable_agg: bitmap: if bit(tid) is set, the fw won't send ampdus for - * tid. - * @max_agg_bufsize: the maximal size of the AGG buffer for this station - * @bt_reduced_txpower: is reduced tx power enabled for this station - * @lock: lock to protect the whole struct. Since %tid_data is access from Tx - * and from Tx response flow, it needs a spinlock. - * @tid_data: per tid data. Look at %iwl_mvm_tid_data. - * - * When mac80211 creates a station it reserves some space (hw->sta_data_size) - * in the structure for use by driver. This structure is placed in that - * space. - * - */ -struct iwl_mvm_sta { - u32 sta_id; - u32 tfd_queue_msk; - u32 mac_id_n_color; - u16 tid_disable_agg; - u8 max_agg_bufsize; - bool bt_reduced_txpower; - spinlock_t lock; - struct iwl_mvm_tid_data tid_data[IWL_MAX_TID_COUNT]; - struct iwl_lq_sta lq_sta; - struct ieee80211_vif *vif; - -#ifdef CONFIG_PM_SLEEP - u16 last_seq_ctl; -#endif -}; - -/** - * struct iwl_mvm_int_sta - representation of an internal station (auxiliary or - * broadcast) - * @sta_id: the index of the station in the fw (will be replaced by id_n_color) - * @tfd_queue_msk: the tfd queues used by the station - */ -struct iwl_mvm_int_sta { - u32 sta_id; - u32 tfd_queue_msk; -}; - -int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta, - bool update); -int iwl_mvm_add_sta(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta); -int iwl_mvm_update_sta(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta); -int iwl_mvm_rm_sta(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta); -int iwl_mvm_rm_sta_id(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - u8 sta_id); -int iwl_mvm_set_sta_key(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key, - bool have_key_offset); -int iwl_mvm_remove_sta_key(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *keyconf); - -void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct ieee80211_key_conf *keyconf, - struct ieee80211_sta *sta, u32 iv32, - u16 *phase1key); - -/* AMPDU */ -int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, - int tid, u16 ssn, bool start); -int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid, u16 *ssn); -int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid, u8 buf_size); -int iwl_mvm_sta_tx_agg_stop(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid); -int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, u16 tid); - -int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm); -int iwl_mvm_allocate_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *sta, - u32 qmask); -void iwl_mvm_dealloc_int_sta(struct iwl_mvm *mvm, - struct iwl_mvm_int_sta *sta); -int iwl_mvm_send_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct iwl_mvm_int_sta *bsta); -int iwl_mvm_send_rm_bcast_sta(struct iwl_mvm *mvm, - struct iwl_mvm_int_sta *bsta); -int iwl_mvm_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - struct iwl_mvm_int_sta *bsta); -int iwl_mvm_rm_bcast_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *bsta); -void iwl_mvm_sta_drained_wk(struct work_struct *wk); -void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm, - struct ieee80211_sta *sta); -void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, - struct ieee80211_sta *sta, - enum ieee80211_frame_release_type reason, - u16 cnt); -int iwl_mvm_drain_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, - bool drain); - -#endif /* __sta_h__ */ diff --git a/drivers/net/wireless/iwlwifi/mvm/time-event.c b/drivers/net/wireless/iwlwifi/mvm/time-event.c deleted file mode 100644 index ad9bbca99213..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/time-event.c +++ /dev/null @@ -1,527 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#include -#include - -#include "iwl-notif-wait.h" -#include "iwl-trans.h" -#include "fw-api.h" -#include "time-event.h" -#include "mvm.h" -#include "iwl-io.h" -#include "iwl-prph.h" - -/* A TimeUnit is 1024 microsecond */ -#define TU_TO_JIFFIES(_tu) (usecs_to_jiffies((_tu) * 1024)) -#define MSEC_TO_TU(_msec) (_msec*1000/1024) - -/* - * For the high priority TE use a time event type that has similar priority to - * the FW's action scan priority. - */ -#define IWL_MVM_ROC_TE_TYPE_NORMAL TE_P2P_DEVICE_DISCOVERABLE -#define IWL_MVM_ROC_TE_TYPE_MGMT_TX TE_P2P_CLIENT_ASSOC - -void iwl_mvm_te_clear_data(struct iwl_mvm *mvm, - struct iwl_mvm_time_event_data *te_data) -{ - lockdep_assert_held(&mvm->time_event_lock); - - if (te_data->id == TE_MAX) - return; - - list_del(&te_data->list); - te_data->running = false; - te_data->uid = 0; - te_data->id = TE_MAX; - te_data->vif = NULL; -} - -void iwl_mvm_roc_done_wk(struct work_struct *wk) -{ - struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm, roc_done_wk); - - synchronize_net(); - - /* - * Flush the offchannel queue -- this is called when the time - * event finishes or is cancelled, so that frames queued for it - * won't get stuck on the queue and be transmitted in the next - * time event. - * We have to send the command asynchronously since this cannot - * be under the mutex for locking reasons, but that's not an - * issue as it will have to complete before the next command is - * executed, and a new time event means a new command. - */ - iwl_mvm_flush_tx_path(mvm, BIT(IWL_MVM_OFFCHANNEL_QUEUE), false); -} - -static void iwl_mvm_roc_finished(struct iwl_mvm *mvm) -{ - /* - * First, clear the ROC_RUNNING status bit. This will cause the TX - * path to drop offchannel transmissions. That would also be done - * by mac80211, but it is racy, in particular in the case that the - * time event actually completed in the firmware (which is handled - * in iwl_mvm_te_handle_notif). - */ - clear_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status); - - /* - * Of course, our status bit is just as racy as mac80211, so in - * addition, fire off the work struct which will drop all frames - * from the hardware queues that made it through the race. First - * it will of course synchronize the TX path to make sure that - * any *new* TX will be rejected. - */ - schedule_work(&mvm->roc_done_wk); -} - -/* - * Handles a FW notification for an event that is known to the driver. - * - * @mvm: the mvm component - * @te_data: the time event data - * @notif: the notification data corresponding the time event data. - */ -static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm, - struct iwl_mvm_time_event_data *te_data, - struct iwl_time_event_notif *notif) -{ - lockdep_assert_held(&mvm->time_event_lock); - - IWL_DEBUG_TE(mvm, "Handle time event notif - UID = 0x%x action %d\n", - le32_to_cpu(notif->unique_id), - le32_to_cpu(notif->action)); - - /* - * The FW sends the start/end time event notifications even for events - * that it fails to schedule. This is indicated in the status field of - * the notification. This happens in cases that the scheduler cannot - * find a schedule that can handle the event (for example requesting a - * P2P Device discoveribility, while there are other higher priority - * events in the system). - */ - WARN_ONCE(!le32_to_cpu(notif->status), - "Failed to schedule time event\n"); - - if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_END) { - IWL_DEBUG_TE(mvm, - "TE ended - current time %lu, estimated end %lu\n", - jiffies, te_data->end_jiffies); - - if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) { - ieee80211_remain_on_channel_expired(mvm->hw); - iwl_mvm_roc_finished(mvm); - } - - /* - * By now, we should have finished association - * and know the dtim period. - */ - if (te_data->vif->type == NL80211_IFTYPE_STATION && - (!te_data->vif->bss_conf.assoc || - !te_data->vif->bss_conf.dtim_period)) { - IWL_ERR(mvm, - "No assocation and the time event is over already...\n"); - ieee80211_connection_loss(te_data->vif); - } - - iwl_mvm_te_clear_data(mvm, te_data); - } else if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_START) { - te_data->running = true; - te_data->end_jiffies = jiffies + - TU_TO_JIFFIES(te_data->duration); - - if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) { - set_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status); - ieee80211_ready_on_channel(mvm->hw); - } - } else { - IWL_WARN(mvm, "Got TE with unknown action\n"); - } -} - -/* - * The Rx handler for time event notifications - */ -int iwl_mvm_rx_time_event_notif(struct iwl_mvm *mvm, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_time_event_notif *notif = (void *)pkt->data; - struct iwl_mvm_time_event_data *te_data, *tmp; - - IWL_DEBUG_TE(mvm, "Time event notification - UID = 0x%x action %d\n", - le32_to_cpu(notif->unique_id), - le32_to_cpu(notif->action)); - - spin_lock_bh(&mvm->time_event_lock); - list_for_each_entry_safe(te_data, tmp, &mvm->time_event_list, list) { - if (le32_to_cpu(notif->unique_id) == te_data->uid) - iwl_mvm_te_handle_notif(mvm, te_data, notif); - } - spin_unlock_bh(&mvm->time_event_lock); - - return 0; -} - -static bool iwl_mvm_time_event_response(struct iwl_notif_wait_data *notif_wait, - struct iwl_rx_packet *pkt, void *data) -{ - struct iwl_mvm *mvm = - container_of(notif_wait, struct iwl_mvm, notif_wait); - struct iwl_mvm_time_event_data *te_data = data; - struct iwl_time_event_resp *resp; - int resp_len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; - - if (WARN_ON(pkt->hdr.cmd != TIME_EVENT_CMD)) - return true; - - if (WARN_ON_ONCE(resp_len != sizeof(pkt->hdr) + sizeof(*resp))) { - IWL_ERR(mvm, "Invalid TIME_EVENT_CMD response\n"); - return true; - } - - resp = (void *)pkt->data; - - /* we should never get a response to another TIME_EVENT_CMD here */ - if (WARN_ON_ONCE(le32_to_cpu(resp->id) != te_data->id)) - return false; - - te_data->uid = le32_to_cpu(resp->unique_id); - IWL_DEBUG_TE(mvm, "TIME_EVENT_CMD response - UID = 0x%x\n", - te_data->uid); - return true; -} - -static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - struct iwl_mvm_time_event_data *te_data, - struct iwl_time_event_cmd *te_cmd) -{ - static const u8 time_event_response[] = { TIME_EVENT_CMD }; - struct iwl_notification_wait wait_time_event; - int ret; - - lockdep_assert_held(&mvm->mutex); - - IWL_DEBUG_TE(mvm, "Add new TE, duration %d TU\n", - le32_to_cpu(te_cmd->duration)); - - spin_lock_bh(&mvm->time_event_lock); - if (WARN_ON(te_data->id != TE_MAX)) { - spin_unlock_bh(&mvm->time_event_lock); - return -EIO; - } - te_data->vif = vif; - te_data->duration = le32_to_cpu(te_cmd->duration); - te_data->id = le32_to_cpu(te_cmd->id); - list_add_tail(&te_data->list, &mvm->time_event_list); - spin_unlock_bh(&mvm->time_event_lock); - - /* - * Use a notification wait, which really just processes the - * command response and doesn't wait for anything, in order - * to be able to process the response and get the UID inside - * the RX path. Using CMD_WANT_SKB doesn't work because it - * stores the buffer and then wakes up this thread, by which - * time another notification (that the time event started) - * might already be processed unsuccessfully. - */ - iwl_init_notification_wait(&mvm->notif_wait, &wait_time_event, - time_event_response, - ARRAY_SIZE(time_event_response), - iwl_mvm_time_event_response, te_data); - - ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC, - sizeof(*te_cmd), te_cmd); - if (ret) { - IWL_ERR(mvm, "Couldn't send TIME_EVENT_CMD: %d\n", ret); - iwl_remove_notification(&mvm->notif_wait, &wait_time_event); - goto out_clear_te; - } - - /* No need to wait for anything, so just pass 1 (0 isn't valid) */ - ret = iwl_wait_notification(&mvm->notif_wait, &wait_time_event, 1); - /* should never fail */ - WARN_ON_ONCE(ret); - - if (ret) { - out_clear_te: - spin_lock_bh(&mvm->time_event_lock); - iwl_mvm_te_clear_data(mvm, te_data); - spin_unlock_bh(&mvm->time_event_lock); - } - return ret; -} - -void iwl_mvm_protect_session(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - u32 duration, u32 min_duration) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; - struct iwl_time_event_cmd time_cmd = {}; - - lockdep_assert_held(&mvm->mutex); - - if (te_data->running && - time_after(te_data->end_jiffies, - jiffies + TU_TO_JIFFIES(min_duration))) { - IWL_DEBUG_TE(mvm, "We have enough time in the current TE: %u\n", - jiffies_to_msecs(te_data->end_jiffies - jiffies)); - return; - } - - if (te_data->running) { - IWL_DEBUG_TE(mvm, "extend 0x%x: only %u ms left\n", - te_data->uid, - jiffies_to_msecs(te_data->end_jiffies - jiffies)); - /* - * we don't have enough time - * cancel the current TE and issue a new one - * Of course it would be better to remove the old one only - * when the new one is added, but we don't care if we are off - * channel for a bit. All we need to do, is not to return - * before we actually begin to be on the channel. - */ - iwl_mvm_stop_session_protection(mvm, vif); - } - - time_cmd.action = cpu_to_le32(FW_CTXT_ACTION_ADD); - time_cmd.id_and_color = - cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); - time_cmd.id = cpu_to_le32(TE_BSS_STA_AGGRESSIVE_ASSOC); - - time_cmd.apply_time = - cpu_to_le32(iwl_read_prph(mvm->trans, DEVICE_SYSTEM_TIME_REG)); - - time_cmd.dep_policy = TE_INDEPENDENT; - time_cmd.is_present = cpu_to_le32(1); - time_cmd.max_frags = cpu_to_le32(TE_FRAG_NONE); - time_cmd.max_delay = cpu_to_le32(500); - /* TODO: why do we need to interval = bi if it is not periodic? */ - time_cmd.interval = cpu_to_le32(1); - time_cmd.interval_reciprocal = cpu_to_le32(iwl_mvm_reciprocal(1)); - time_cmd.duration = cpu_to_le32(duration); - time_cmd.repeat = cpu_to_le32(1); - time_cmd.notify = cpu_to_le32(TE_NOTIF_HOST_EVENT_START | - TE_NOTIF_HOST_EVENT_END); - - iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); -} - -/* - * Explicit request to remove a time event. The removal of a time event needs to - * be synchronized with the flow of a time event's end notification, which also - * removes the time event from the op mode data structures. - */ -void iwl_mvm_remove_time_event(struct iwl_mvm *mvm, - struct iwl_mvm_vif *mvmvif, - struct iwl_mvm_time_event_data *te_data) -{ - struct iwl_time_event_cmd time_cmd = {}; - u32 id, uid; - int ret; - - /* - * It is possible that by the time we got to this point the time - * event was already removed. - */ - spin_lock_bh(&mvm->time_event_lock); - - /* Save time event uid before clearing its data */ - uid = te_data->uid; - id = te_data->id; - - /* - * The clear_data function handles time events that were already removed - */ - iwl_mvm_te_clear_data(mvm, te_data); - spin_unlock_bh(&mvm->time_event_lock); - - /* - * It is possible that by the time we try to remove it, the time event - * has already ended and removed. In such a case there is no need to - * send a removal command. - */ - if (id == TE_MAX) { - IWL_DEBUG_TE(mvm, "TE 0x%x has already ended\n", uid); - return; - } - - /* When we remove a TE, the UID is to be set in the id field */ - time_cmd.id = cpu_to_le32(uid); - time_cmd.action = cpu_to_le32(FW_CTXT_ACTION_REMOVE); - time_cmd.id_and_color = - cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); - - IWL_DEBUG_TE(mvm, "Removing TE 0x%x\n", le32_to_cpu(time_cmd.id)); - ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, CMD_SYNC, - sizeof(time_cmd), &time_cmd); - if (WARN_ON(ret)) - return; -} - -void iwl_mvm_stop_session_protection(struct iwl_mvm *mvm, - struct ieee80211_vif *vif) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; - - lockdep_assert_held(&mvm->mutex); - iwl_mvm_remove_time_event(mvm, mvmvif, te_data); -} - -int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - int duration, enum ieee80211_roc_type type) -{ - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); - struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; - struct iwl_time_event_cmd time_cmd = {}; - - lockdep_assert_held(&mvm->mutex); - if (te_data->running) { - IWL_WARN(mvm, "P2P_DEVICE remain on channel already running\n"); - return -EBUSY; - } - - /* - * Flush the done work, just in case it's still pending, so that - * the work it does can complete and we can accept new frames. - */ - flush_work(&mvm->roc_done_wk); - - time_cmd.action = cpu_to_le32(FW_CTXT_ACTION_ADD); - time_cmd.id_and_color = - cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); - - switch (type) { - case IEEE80211_ROC_TYPE_NORMAL: - time_cmd.id = cpu_to_le32(IWL_MVM_ROC_TE_TYPE_NORMAL); - break; - case IEEE80211_ROC_TYPE_MGMT_TX: - time_cmd.id = cpu_to_le32(IWL_MVM_ROC_TE_TYPE_MGMT_TX); - break; - default: - WARN_ONCE(1, "Got an invalid ROC type\n"); - return -EINVAL; - } - - time_cmd.apply_time = cpu_to_le32(0); - time_cmd.dep_policy = cpu_to_le32(TE_INDEPENDENT); - time_cmd.is_present = cpu_to_le32(1); - time_cmd.interval = cpu_to_le32(1); - - /* - * The P2P Device TEs can have lower priority than other events - * that are being scheduled by the driver/fw, and thus it might not be - * scheduled. To improve the chances of it being scheduled, allow them - * to be fragmented, and in addition allow them to be delayed. - */ - time_cmd.max_frags = cpu_to_le32(MSEC_TO_TU(duration)/20); - time_cmd.max_delay = cpu_to_le32(MSEC_TO_TU(duration/2)); - time_cmd.duration = cpu_to_le32(MSEC_TO_TU(duration)); - time_cmd.repeat = cpu_to_le32(1); - time_cmd.notify = cpu_to_le32(TE_NOTIF_HOST_EVENT_START | - TE_NOTIF_HOST_EVENT_END); - - return iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); -} - -void iwl_mvm_stop_p2p_roc(struct iwl_mvm *mvm) -{ - struct iwl_mvm_vif *mvmvif; - struct iwl_mvm_time_event_data *te_data; - - lockdep_assert_held(&mvm->mutex); - - /* - * Iterate over the list of time events and find the time event that is - * associated with a P2P_DEVICE interface. - * This assumes that a P2P_DEVICE interface can have only a single time - * event at any given time and this time event coresponds to a ROC - * request - */ - mvmvif = NULL; - spin_lock_bh(&mvm->time_event_lock); - list_for_each_entry(te_data, &mvm->time_event_list, list) { - if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) { - mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); - break; - } - } - spin_unlock_bh(&mvm->time_event_lock); - - if (!mvmvif) { - IWL_WARN(mvm, "P2P_DEVICE no remain on channel event\n"); - return; - } - - iwl_mvm_remove_time_event(mvm, mvmvif, te_data); - - iwl_mvm_roc_finished(mvm); -} diff --git a/drivers/net/wireless/iwlwifi/mvm/time-event.h b/drivers/net/wireless/iwlwifi/mvm/time-event.h deleted file mode 100644 index f86c51065ed3..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/time-event.h +++ /dev/null @@ -1,215 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#ifndef __time_event_h__ -#define __time_event_h__ - -#include "fw-api.h" - -#include "mvm.h" - -/** - * DOC: Time Events - what is it? - * - * Time Events are a fw feature that allows the driver to control the presence - * of the device on the channel. Since the fw supports multiple channels - * concurrently, the fw may choose to jump to another channel at any time. - * In order to make sure that the fw is on a specific channel at a certain time - * and for a certain duration, the driver needs to issue a time event. - * - * The simplest example is for BSS association. The driver issues a time event, - * waits for it to start, and only then tells mac80211 that we can start the - * association. This way, we make sure that the association will be done - * smoothly and won't be interrupted by channel switch decided within the fw. - */ - - /** - * DOC: The flow against the fw - * - * When the driver needs to make sure we are in a certain channel, at a certain - * time and for a certain duration, it sends a Time Event. The flow against the - * fw goes like this: - * 1) Driver sends a TIME_EVENT_CMD to the fw - * 2) Driver gets the response for that command. This response contains the - * Unique ID (UID) of the event. - * 3) The fw sends notification when the event starts. - * - * Of course the API provides various options that allow to cover parameters - * of the flow. - * What is the duration of the event? - * What is the start time of the event? - * Is there an end-time for the event? - * How much can the event be delayed? - * Can the event be split? - * If yes what is the maximal number of chunks? - * etc... - */ - -/** - * DOC: Abstraction to the driver - * - * In order to simplify the use of time events to the rest of the driver, - * we abstract the use of time events. This component provides the functions - * needed by the driver. - */ - -#define IWL_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS 500 -#define IWL_MVM_TE_SESSION_PROTECTION_MIN_TIME_MS 400 - -/** - * iwl_mvm_protect_session - start / extend the session protection. - * @mvm: the mvm component - * @vif: the virtual interface for which the session is issued - * @duration: the duration of the session in TU. - * @min_duration: will start a new session if the current session will end - * in less than min_duration. - * - * This function can be used to start a session protection which means that the - * fw will stay on the channel for %duration_ms milliseconds. This function - * will block (sleep) until the session starts. This function can also be used - * to extend a currently running session. - * This function is meant to be used for BSS association for example, where we - * want to make sure that the fw stays on the channel during the association. - */ -void iwl_mvm_protect_session(struct iwl_mvm *mvm, - struct ieee80211_vif *vif, - u32 duration, u32 min_duration); - -/** - * iwl_mvm_stop_session_protection - cancel the session protection. - * @mvm: the mvm component - * @vif: the virtual interface for which the session is issued - * - * This functions cancels the session protection which is an act of good - * citizenship. If it is not needed any more it should be cancelled because - * the other bindings wait for the medium during that time. - * This funtions doesn't sleep. - */ -void iwl_mvm_stop_session_protection(struct iwl_mvm *mvm, - struct ieee80211_vif *vif); - -/* - * iwl_mvm_rx_time_event_notif - handles %TIME_EVENT_NOTIFICATION. - */ -int iwl_mvm_rx_time_event_notif(struct iwl_mvm *mvm, - struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd); - -/** - * iwl_mvm_start_p2p_roc - start remain on channel for p2p device functionlity - * @mvm: the mvm component - * @vif: the virtual interface for which the roc is requested. It is assumed - * that the vif type is NL80211_IFTYPE_P2P_DEVICE - * @duration: the requested duration in millisecond for the fw to be on the - * channel that is bound to the vif. - * @type: the remain on channel request type - * - * This function can be used to issue a remain on channel session, - * which means that the fw will stay in the channel for the request %duration - * milliseconds. The function is async, meaning that it only issues the ROC - * request but does not wait for it to start. Once the FW is ready to serve the - * ROC request, it will issue a notification to the driver that it is on the - * requested channel. Once the FW completes the ROC request it will issue - * another notification to the driver. - */ -int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, - int duration, enum ieee80211_roc_type type); - -/** - * iwl_mvm_stop_p2p_roc - stop remain on channel for p2p device functionlity - * @mvm: the mvm component - * - * This function can be used to cancel an ongoing ROC session. - * The function is async, it will instruct the FW to stop serving the ROC - * session, but will not wait for the actual stopping of the session. - */ -void iwl_mvm_stop_p2p_roc(struct iwl_mvm *mvm); - -/** - * iwl_mvm_remove_time_event - general function to clean up of time event - * @mvm: the mvm component - * @vif: the vif to which the time event belongs - * @te_data: the time event data that corresponds to that time event - * - * This function can be used to cancel a time event regardless its type. - * It is useful for cleaning up time events running before removing an - * interface. - */ -void iwl_mvm_remove_time_event(struct iwl_mvm *mvm, - struct iwl_mvm_vif *mvmvif, - struct iwl_mvm_time_event_data *te_data); - -/** - * iwl_mvm_te_clear_data - remove time event from list - * @mvm: the mvm component - * @te_data: the time event data to remove - * - * This function is mostly internal, it is made available here only - * for firmware restart purposes. - */ -void iwl_mvm_te_clear_data(struct iwl_mvm *mvm, - struct iwl_mvm_time_event_data *te_data); - -void iwl_mvm_roc_done_wk(struct work_struct *wk); - -#endif /* __time_event_h__ */ diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c deleted file mode 100644 index a2e6112e91e9..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ /dev/null @@ -1,939 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#include -#include - -#include "iwl-trans.h" -#include "iwl-eeprom-parse.h" -#include "mvm.h" -#include "sta.h" - -/* - * Sets most of the Tx cmd's fields - */ -static void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb, - struct iwl_tx_cmd *tx_cmd, - struct ieee80211_tx_info *info, u8 sta_id) -{ - struct ieee80211_hdr *hdr = (void *)skb->data; - __le16 fc = hdr->frame_control; - u32 tx_flags = le32_to_cpu(tx_cmd->tx_flags); - u32 len = skb->len + FCS_LEN; - - if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) - tx_flags |= TX_CMD_FLG_ACK; - else - tx_flags &= ~TX_CMD_FLG_ACK; - - if (ieee80211_is_probe_resp(fc)) - tx_flags |= TX_CMD_FLG_TSF; - else if (ieee80211_is_back_req(fc)) - tx_flags |= TX_CMD_FLG_ACK | TX_CMD_FLG_BAR; - - /* High prio packet (wrt. BT coex) if it is EAPOL, MCAST or MGMT */ - if (info->band == IEEE80211_BAND_2GHZ && - (skb->protocol == cpu_to_be16(ETH_P_PAE) || - is_multicast_ether_addr(hdr->addr1) || - ieee80211_is_back_req(fc) || - ieee80211_is_mgmt(fc))) - tx_flags |= TX_CMD_FLG_BT_DIS; - - if (ieee80211_has_morefrags(fc)) - tx_flags |= TX_CMD_FLG_MORE_FRAG; - - if (ieee80211_is_data_qos(fc)) { - u8 *qc = ieee80211_get_qos_ctl(hdr); - tx_cmd->tid_tspec = qc[0] & 0xf; - tx_flags &= ~TX_CMD_FLG_SEQ_CTL; - } else { - tx_cmd->tid_tspec = IWL_TID_NON_QOS; - if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) - tx_flags |= TX_CMD_FLG_SEQ_CTL; - else - tx_flags &= ~TX_CMD_FLG_SEQ_CTL; - } - - if (ieee80211_is_mgmt(fc)) { - if (ieee80211_is_assoc_req(fc) || ieee80211_is_reassoc_req(fc)) - tx_cmd->pm_frame_timeout = cpu_to_le16(3); - else - tx_cmd->pm_frame_timeout = cpu_to_le16(2); - - /* The spec allows Action frames in A-MPDU, we don't support - * it - */ - WARN_ON_ONCE(info->flags & IEEE80211_TX_CTL_AMPDU); - } else { - tx_cmd->pm_frame_timeout = 0; - } - - if (info->flags & IEEE80211_TX_CTL_AMPDU) - tx_flags |= TX_CMD_FLG_PROT_REQUIRE; - - if (ieee80211_is_data(fc) && len > mvm->rts_threshold && - !is_multicast_ether_addr(ieee80211_get_DA(hdr))) - tx_flags |= TX_CMD_FLG_PROT_REQUIRE; - - tx_cmd->driver_txop = 0; - tx_cmd->tx_flags = cpu_to_le32(tx_flags); - /* Total # bytes to be transmitted */ - tx_cmd->len = cpu_to_le16((u16)skb->len); - tx_cmd->next_frame_len = 0; - tx_cmd->life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE); - tx_cmd->sta_id = sta_id; -} - -/* - * Sets the fields in the Tx cmd that are rate related - */ -static void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, - struct iwl_tx_cmd *tx_cmd, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - __le16 fc) -{ - u32 rate_flags; - int rate_idx; - u8 rate_plcp; - - /* Set retry limit on RTS packets */ - tx_cmd->rts_retry_limit = IWL_RTS_DFAULT_RETRY_LIMIT; - - /* Set retry limit on DATA packets and Probe Responses*/ - if (ieee80211_is_probe_resp(fc)) { - tx_cmd->data_retry_limit = IWL_MGMT_DFAULT_RETRY_LIMIT; - tx_cmd->rts_retry_limit = - min(tx_cmd->data_retry_limit, tx_cmd->rts_retry_limit); - } else if (ieee80211_is_back_req(fc)) { - tx_cmd->data_retry_limit = IWL_BAR_DFAULT_RETRY_LIMIT; - } else { - tx_cmd->data_retry_limit = IWL_DEFAULT_TX_RETRY; - } - - /* - * for data packets, rate info comes from the table inside he fw. This - * table is controlled by LINK_QUALITY commands - */ - - if (ieee80211_is_data(fc) && sta) { - tx_cmd->initial_rate_index = 0; - tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE); - return; - } else if (ieee80211_is_back_req(fc)) { - tx_cmd->tx_flags |= - cpu_to_le32(TX_CMD_FLG_ACK | TX_CMD_FLG_BAR); - } - - /* HT rate doesn't make sense for a non data frame */ - WARN_ONCE(info->control.rates[0].flags & IEEE80211_TX_RC_MCS, - "Got an HT rate for a non data frame 0x%x\n", - info->control.rates[0].flags); - - rate_idx = info->control.rates[0].idx; - /* if the rate isn't a well known legacy rate, take the lowest one */ - if (rate_idx < 0 || rate_idx > IWL_RATE_COUNT_LEGACY) - rate_idx = rate_lowest_index( - &mvm->nvm_data->bands[info->band], sta); - - /* For 5 GHZ band, remap mac80211 rate indices into driver indices */ - if (info->band == IEEE80211_BAND_5GHZ) - rate_idx += IWL_FIRST_OFDM_RATE; - - /* For 2.4 GHZ band, check that there is no need to remap */ - BUILD_BUG_ON(IWL_FIRST_CCK_RATE != 0); - - /* Get PLCP rate for tx_cmd->rate_n_flags */ - rate_plcp = iwl_mvm_mac80211_idx_to_hwrate(rate_idx); - - mvm->mgmt_last_antenna_idx = - iwl_mvm_next_antenna(mvm, iwl_fw_valid_tx_ant(mvm->fw), - mvm->mgmt_last_antenna_idx); - rate_flags = BIT(mvm->mgmt_last_antenna_idx) << RATE_MCS_ANT_POS; - - /* Set CCK flag as needed */ - if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE)) - rate_flags |= RATE_MCS_CCK_MSK; - - /* Set the rate in the TX cmd */ - tx_cmd->rate_n_flags = cpu_to_le32((u32)rate_plcp | rate_flags); -} - -/* - * Sets the fields in the Tx cmd that are crypto related - */ -static void iwl_mvm_set_tx_cmd_crypto(struct iwl_mvm *mvm, - struct ieee80211_tx_info *info, - struct iwl_tx_cmd *tx_cmd, - struct sk_buff *skb_frag) -{ - struct ieee80211_key_conf *keyconf = info->control.hw_key; - - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_CCMP: - tx_cmd->sec_ctl = TX_CMD_SEC_CCM; - memcpy(tx_cmd->key, keyconf->key, keyconf->keylen); - if (info->flags & IEEE80211_TX_CTL_AMPDU) - tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_CCMP_AGG); - break; - - case WLAN_CIPHER_SUITE_TKIP: - tx_cmd->sec_ctl = TX_CMD_SEC_TKIP; - ieee80211_get_tkip_p2k(keyconf, skb_frag, tx_cmd->key); - break; - - case WLAN_CIPHER_SUITE_WEP104: - tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128; - /* fall through */ - case WLAN_CIPHER_SUITE_WEP40: - tx_cmd->sec_ctl |= TX_CMD_SEC_WEP | - ((keyconf->keyidx << TX_CMD_SEC_WEP_KEY_IDX_POS) & - TX_CMD_SEC_WEP_KEY_IDX_MSK); - - memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen); - break; - default: - IWL_ERR(mvm, "Unknown encode cipher %x\n", keyconf->cipher); - break; - } -} - -/* - * Allocates and sets the Tx cmd the driver data pointers in the skb - */ -static struct iwl_device_cmd * -iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb, - struct ieee80211_sta *sta, u8 sta_id) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct iwl_device_cmd *dev_cmd; - struct iwl_tx_cmd *tx_cmd; - - dev_cmd = iwl_trans_alloc_tx_cmd(mvm->trans); - - if (unlikely(!dev_cmd)) - return NULL; - - memset(dev_cmd, 0, sizeof(*dev_cmd)); - tx_cmd = (struct iwl_tx_cmd *)dev_cmd->payload; - - if (info->control.hw_key) - iwl_mvm_set_tx_cmd_crypto(mvm, info, tx_cmd, skb); - - iwl_mvm_set_tx_cmd(mvm, skb, tx_cmd, info, sta_id); - - iwl_mvm_set_tx_cmd_rate(mvm, tx_cmd, info, sta, hdr->frame_control); - - memset(&info->status, 0, sizeof(info->status)); - - info->driver_data[0] = NULL; - info->driver_data[1] = dev_cmd; - - return dev_cmd; -} - -int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct iwl_device_cmd *dev_cmd; - struct iwl_tx_cmd *tx_cmd; - u8 sta_id; - - if (WARN_ON_ONCE(info->flags & IEEE80211_TX_CTL_AMPDU)) - return -1; - - if (WARN_ON_ONCE(info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM && - (!info->control.vif || - info->hw_queue != info->control.vif->cab_queue))) - return -1; - - /* - * If the interface on which frame is sent is the P2P_DEVICE - * or an AP/GO interface use the broadcast station associated - * with it; otherwise use the AUX station. - */ - if (info->control.vif && - (info->control.vif->type == NL80211_IFTYPE_P2P_DEVICE || - info->control.vif->type == NL80211_IFTYPE_AP)) { - struct iwl_mvm_vif *mvmvif = - iwl_mvm_vif_from_mac80211(info->control.vif); - sta_id = mvmvif->bcast_sta.sta_id; - } else { - sta_id = mvm->aux_sta.sta_id; - } - - IWL_DEBUG_TX(mvm, "station Id %d, queue=%d\n", sta_id, info->hw_queue); - - dev_cmd = iwl_mvm_set_tx_params(mvm, skb, NULL, sta_id); - if (!dev_cmd) - return -1; - - /* From now on, we cannot access info->control */ - tx_cmd = (struct iwl_tx_cmd *)dev_cmd->payload; - - /* Copy MAC header from skb into command buffer */ - memcpy(tx_cmd->hdr, hdr, ieee80211_hdrlen(hdr->frame_control)); - - if (iwl_trans_tx(mvm->trans, skb, dev_cmd, info->hw_queue)) { - iwl_trans_free_tx_cmd(mvm->trans, dev_cmd); - return -1; - } - - return 0; -} - -/* - * Sets the fields in the Tx cmd that are crypto related - */ -int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb, - struct ieee80211_sta *sta) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct iwl_mvm_sta *mvmsta; - struct iwl_device_cmd *dev_cmd; - struct iwl_tx_cmd *tx_cmd; - __le16 fc; - u16 seq_number = 0; - u8 tid = IWL_MAX_TID_COUNT; - u8 txq_id = info->hw_queue; - bool is_data_qos = false, is_ampdu = false; - - mvmsta = (void *)sta->drv_priv; - fc = hdr->frame_control; - - if (WARN_ON_ONCE(!mvmsta)) - return -1; - - if (WARN_ON_ONCE(mvmsta->sta_id == IWL_MVM_STATION_COUNT)) - return -1; - - dev_cmd = iwl_mvm_set_tx_params(mvm, skb, sta, mvmsta->sta_id); - if (!dev_cmd) - goto drop; - - tx_cmd = (struct iwl_tx_cmd *)dev_cmd->payload; - /* From now on, we cannot access info->control */ - - spin_lock(&mvmsta->lock); - - if (ieee80211_is_data_qos(fc) && !ieee80211_is_qos_nullfunc(fc)) { - u8 *qc = NULL; - qc = ieee80211_get_qos_ctl(hdr); - tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; - if (WARN_ON_ONCE(tid >= IWL_MAX_TID_COUNT)) - goto drop_unlock_sta; - - seq_number = mvmsta->tid_data[tid].seq_number; - seq_number &= IEEE80211_SCTL_SEQ; - hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); - hdr->seq_ctrl |= cpu_to_le16(seq_number); - seq_number += 0x10; - is_data_qos = true; - is_ampdu = info->flags & IEEE80211_TX_CTL_AMPDU; - } - - /* Copy MAC header from skb into command buffer */ - memcpy(tx_cmd->hdr, hdr, ieee80211_hdrlen(fc)); - - WARN_ON_ONCE(info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM); - - if (is_ampdu) { - if (WARN_ON_ONCE(mvmsta->tid_data[tid].state != IWL_AGG_ON)) - goto drop_unlock_sta; - txq_id = mvmsta->tid_data[tid].txq_id; - } - - IWL_DEBUG_TX(mvm, "TX to [%d|%d] Q:%d - seq: 0x%x\n", mvmsta->sta_id, - tid, txq_id, seq_number); - - /* NOTE: aggregation will need changes here (for txq id) */ - if (iwl_trans_tx(mvm->trans, skb, dev_cmd, txq_id)) - goto drop_unlock_sta; - - if (is_data_qos && !ieee80211_has_morefrags(fc)) - mvmsta->tid_data[tid].seq_number = seq_number; - - spin_unlock(&mvmsta->lock); - - if (txq_id < IWL_MVM_FIRST_AGG_QUEUE) - atomic_inc(&mvm->pending_frames[mvmsta->sta_id]); - - return 0; - -drop_unlock_sta: - iwl_trans_free_tx_cmd(mvm->trans, dev_cmd); - spin_unlock(&mvmsta->lock); -drop: - return -1; -} - -static void iwl_mvm_check_ratid_empty(struct iwl_mvm *mvm, - struct ieee80211_sta *sta, u8 tid) -{ - struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; - struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; - struct ieee80211_vif *vif = mvmsta->vif; - - lockdep_assert_held(&mvmsta->lock); - - if (tid_data->ssn != tid_data->next_reclaimed) - return; - - switch (tid_data->state) { - case IWL_EMPTYING_HW_QUEUE_ADDBA: - IWL_DEBUG_TX_QUEUES(mvm, - "Can continue addBA flow ssn = next_recl = %d\n", - tid_data->next_reclaimed); - tid_data->state = IWL_AGG_STARTING; - ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); - break; - - case IWL_EMPTYING_HW_QUEUE_DELBA: - IWL_DEBUG_TX_QUEUES(mvm, - "Can continue DELBA flow ssn = next_recl = %d\n", - tid_data->next_reclaimed); - iwl_trans_txq_disable(mvm->trans, tid_data->txq_id); - tid_data->state = IWL_AGG_OFF; - /* - * we can't hold the mutex - but since we are after a sequence - * point (call to iwl_trans_txq_disable), so we don't even need - * a memory barrier. - */ - mvm->queue_to_mac80211[tid_data->txq_id] = - IWL_INVALID_MAC80211_QUEUE; - ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); - break; - - default: - break; - } -} - -#ifdef CONFIG_IWLWIFI_DEBUG -const char *iwl_mvm_get_tx_fail_reason(u32 status) -{ -#define TX_STATUS_FAIL(x) case TX_STATUS_FAIL_ ## x: return #x -#define TX_STATUS_POSTPONE(x) case TX_STATUS_POSTPONE_ ## x: return #x - - switch (status & TX_STATUS_MSK) { - case TX_STATUS_SUCCESS: - return "SUCCESS"; - TX_STATUS_POSTPONE(DELAY); - TX_STATUS_POSTPONE(FEW_BYTES); - TX_STATUS_POSTPONE(BT_PRIO); - TX_STATUS_POSTPONE(QUIET_PERIOD); - TX_STATUS_POSTPONE(CALC_TTAK); - TX_STATUS_FAIL(INTERNAL_CROSSED_RETRY); - TX_STATUS_FAIL(SHORT_LIMIT); - TX_STATUS_FAIL(LONG_LIMIT); - TX_STATUS_FAIL(UNDERRUN); - TX_STATUS_FAIL(DRAIN_FLOW); - TX_STATUS_FAIL(RFKILL_FLUSH); - TX_STATUS_FAIL(LIFE_EXPIRE); - TX_STATUS_FAIL(DEST_PS); - TX_STATUS_FAIL(HOST_ABORTED); - TX_STATUS_FAIL(BT_RETRY); - TX_STATUS_FAIL(STA_INVALID); - TX_STATUS_FAIL(FRAG_DROPPED); - TX_STATUS_FAIL(TID_DISABLE); - TX_STATUS_FAIL(FIFO_FLUSHED); - TX_STATUS_FAIL(SMALL_CF_POLL); - TX_STATUS_FAIL(FW_DROP); - TX_STATUS_FAIL(STA_COLOR_MISMATCH); - } - - return "UNKNOWN"; - -#undef TX_STATUS_FAIL -#undef TX_STATUS_POSTPONE -} -#endif /* CONFIG_IWLWIFI_DEBUG */ - -/** - * translate ucode response to mac80211 tx status control values - */ -static void iwl_mvm_hwrate_to_tx_control(u32 rate_n_flags, - struct ieee80211_tx_info *info) -{ - struct ieee80211_tx_rate *r = &info->status.rates[0]; - - info->status.antenna = - ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS); - if (rate_n_flags & RATE_HT_MCS_GF_MSK) - r->flags |= IEEE80211_TX_RC_GREEN_FIELD; - switch (rate_n_flags & RATE_MCS_CHAN_WIDTH_MSK) { - case RATE_MCS_CHAN_WIDTH_20: - break; - case RATE_MCS_CHAN_WIDTH_40: - r->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; - break; - case RATE_MCS_CHAN_WIDTH_80: - r->flags |= IEEE80211_TX_RC_80_MHZ_WIDTH; - break; - case RATE_MCS_CHAN_WIDTH_160: - r->flags |= IEEE80211_TX_RC_160_MHZ_WIDTH; - break; - } - if (rate_n_flags & RATE_MCS_SGI_MSK) - r->flags |= IEEE80211_TX_RC_SHORT_GI; - if (rate_n_flags & RATE_MCS_HT_MSK) { - r->flags |= IEEE80211_TX_RC_MCS; - r->idx = rate_n_flags & RATE_HT_MCS_INDEX_MSK; - } else if (rate_n_flags & RATE_MCS_VHT_MSK) { - ieee80211_rate_set_vht( - r, rate_n_flags & RATE_VHT_MCS_RATE_CODE_MSK, - ((rate_n_flags & RATE_VHT_MCS_NSS_MSK) >> - RATE_VHT_MCS_NSS_POS) + 1); - r->flags |= IEEE80211_TX_RC_VHT_MCS; - } else { - r->idx = iwl_mvm_legacy_rate_to_mac80211_idx(rate_n_flags, - info->band); - } -} - -static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, - struct iwl_rx_packet *pkt) -{ - struct ieee80211_sta *sta; - u16 sequence = le16_to_cpu(pkt->hdr.sequence); - int txq_id = SEQ_TO_QUEUE(sequence); - struct iwl_mvm_tx_resp *tx_resp = (void *)pkt->data; - int sta_id = IWL_MVM_TX_RES_GET_RA(tx_resp->ra_tid); - int tid = IWL_MVM_TX_RES_GET_TID(tx_resp->ra_tid); - u32 status = le16_to_cpu(tx_resp->status.status); - u16 ssn = iwl_mvm_get_scd_ssn(tx_resp); - struct iwl_mvm_sta *mvmsta; - struct sk_buff_head skbs; - u8 skb_freed = 0; - u16 next_reclaimed, seq_ctl; - - __skb_queue_head_init(&skbs); - - seq_ctl = le16_to_cpu(tx_resp->seq_ctl); - - /* we can free until ssn % q.n_bd not inclusive */ - iwl_trans_reclaim(mvm->trans, txq_id, ssn, &skbs); - - while (!skb_queue_empty(&skbs)) { - struct sk_buff *skb = __skb_dequeue(&skbs); - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - skb_freed++; - - iwl_trans_free_tx_cmd(mvm->trans, info->driver_data[1]); - - memset(&info->status, 0, sizeof(info->status)); - - info->flags &= ~IEEE80211_TX_CTL_AMPDU; - - /* inform mac80211 about what happened with the frame */ - switch (status & TX_STATUS_MSK) { - case TX_STATUS_SUCCESS: - case TX_STATUS_DIRECT_DONE: - info->flags |= IEEE80211_TX_STAT_ACK; - break; - case TX_STATUS_FAIL_DEST_PS: - info->flags |= IEEE80211_TX_STAT_TX_FILTERED; - break; - default: - break; - } - - info->status.rates[0].count = tx_resp->failure_frame + 1; - iwl_mvm_hwrate_to_tx_control(le32_to_cpu(tx_resp->initial_rate), - info); - - /* Single frame failure in an AMPDU queue => send BAR */ - if (txq_id >= IWL_MVM_FIRST_AGG_QUEUE && - !(info->flags & IEEE80211_TX_STAT_ACK)) - info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; - - /* W/A FW bug: seq_ctl is wrong when the status isn't success */ - if (status != TX_STATUS_SUCCESS) { - struct ieee80211_hdr *hdr = (void *)skb->data; - seq_ctl = le16_to_cpu(hdr->seq_ctrl); - } - - ieee80211_tx_status_ni(mvm->hw, skb); - } - - if (txq_id >= IWL_MVM_FIRST_AGG_QUEUE) { - /* If this is an aggregation queue, we use the ssn since: - * ssn = wifi seq_num % 256. - * The seq_ctl is the sequence control of the packet to which - * this Tx response relates. But if there is a hole in the - * bitmap of the BA we received, this Tx response may allow to - * reclaim the hole and all the subsequent packets that were - * already acked. In that case, seq_ctl != ssn, and the next - * packet to be reclaimed will be ssn and not seq_ctl. In that - * case, several packets will be reclaimed even if - * frame_count = 1. - * - * The ssn is the index (% 256) of the latest packet that has - * treated (acked / dropped) + 1. - */ - next_reclaimed = ssn; - } else { - /* The next packet to be reclaimed is the one after this one */ - next_reclaimed = IEEE80211_SEQ_TO_SN(seq_ctl + 0x10); - } - - IWL_DEBUG_TX_REPLY(mvm, - "TXQ %d status %s (0x%08x)\n", - txq_id, iwl_mvm_get_tx_fail_reason(status), status); - - IWL_DEBUG_TX_REPLY(mvm, - "\t\t\t\tinitial_rate 0x%x retries %d, idx=%d ssn=%d next_reclaimed=0x%x seq_ctl=0x%x\n", - le32_to_cpu(tx_resp->initial_rate), - tx_resp->failure_frame, SEQ_TO_INDEX(sequence), - ssn, next_reclaimed, seq_ctl); - - rcu_read_lock(); - - sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); - - if (!IS_ERR_OR_NULL(sta)) { - mvmsta = (void *)sta->drv_priv; - - if (tid != IWL_TID_NON_QOS) { - struct iwl_mvm_tid_data *tid_data = - &mvmsta->tid_data[tid]; - - spin_lock_bh(&mvmsta->lock); - tid_data->next_reclaimed = next_reclaimed; - IWL_DEBUG_TX_REPLY(mvm, "Next reclaimed packet:%d\n", - next_reclaimed); - iwl_mvm_check_ratid_empty(mvm, sta, tid); - spin_unlock_bh(&mvmsta->lock); - } - -#ifdef CONFIG_PM_SLEEP - mvmsta->last_seq_ctl = seq_ctl; -#endif - } else { - sta = NULL; - mvmsta = NULL; - } - - /* - * If the txq is not an AMPDU queue, there is no chance we freed - * several skbs. Check that out... - */ - if (txq_id < IWL_MVM_FIRST_AGG_QUEUE && !WARN_ON(skb_freed > 1) && - atomic_sub_and_test(skb_freed, &mvm->pending_frames[sta_id])) { - if (mvmsta) { - /* - * If there are no pending frames for this STA, notify - * mac80211 that this station can go to sleep in its - * STA table. - */ - if (mvmsta->vif->type == NL80211_IFTYPE_AP) - ieee80211_sta_block_awake(mvm->hw, sta, false); - /* - * We might very well have taken mvmsta pointer while - * the station was being removed. The remove flow might - * have seen a pending_frame (because we didn't take - * the lock) even if now the queues are drained. So make - * really sure now that this the station is not being - * removed. If it is, run the drain worker to remove it. - */ - spin_lock_bh(&mvmsta->lock); - sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); - if (IS_ERR_OR_NULL(sta)) { - /* - * Station disappeared in the meantime: - * so we are draining. - */ - set_bit(sta_id, mvm->sta_drained); - schedule_work(&mvm->sta_drained_wk); - } - spin_unlock_bh(&mvmsta->lock); - } else if (!mvmsta) { - /* Tx response without STA, so we are draining */ - set_bit(sta_id, mvm->sta_drained); - schedule_work(&mvm->sta_drained_wk); - } - } - - rcu_read_unlock(); -} - -#ifdef CONFIG_IWLWIFI_DEBUG -#define AGG_TX_STATE_(x) case AGG_TX_STATE_ ## x: return #x -static const char *iwl_get_agg_tx_status(u16 status) -{ - switch (status & AGG_TX_STATE_STATUS_MSK) { - AGG_TX_STATE_(TRANSMITTED); - AGG_TX_STATE_(UNDERRUN); - AGG_TX_STATE_(BT_PRIO); - AGG_TX_STATE_(FEW_BYTES); - AGG_TX_STATE_(ABORT); - AGG_TX_STATE_(LAST_SENT_TTL); - AGG_TX_STATE_(LAST_SENT_TRY_CNT); - AGG_TX_STATE_(LAST_SENT_BT_KILL); - AGG_TX_STATE_(SCD_QUERY); - AGG_TX_STATE_(TEST_BAD_CRC32); - AGG_TX_STATE_(RESPONSE); - AGG_TX_STATE_(DUMP_TX); - AGG_TX_STATE_(DELAY_TX); - } - - return "UNKNOWN"; -} - -static void iwl_mvm_rx_tx_cmd_agg_dbg(struct iwl_mvm *mvm, - struct iwl_rx_packet *pkt) -{ - struct iwl_mvm_tx_resp *tx_resp = (void *)pkt->data; - struct agg_tx_status *frame_status = &tx_resp->status; - int i; - - for (i = 0; i < tx_resp->frame_count; i++) { - u16 fstatus = le16_to_cpu(frame_status[i].status); - - IWL_DEBUG_TX_REPLY(mvm, - "status %s (0x%04x), try-count (%d) seq (0x%x)\n", - iwl_get_agg_tx_status(fstatus), - fstatus & AGG_TX_STATE_STATUS_MSK, - (fstatus & AGG_TX_STATE_TRY_CNT_MSK) >> - AGG_TX_STATE_TRY_CNT_POS, - le16_to_cpu(frame_status[i].sequence)); - } -} -#else -static void iwl_mvm_rx_tx_cmd_agg_dbg(struct iwl_mvm *mvm, - struct iwl_rx_packet *pkt) -{} -#endif /* CONFIG_IWLWIFI_DEBUG */ - -static void iwl_mvm_rx_tx_cmd_agg(struct iwl_mvm *mvm, - struct iwl_rx_packet *pkt) -{ - struct iwl_mvm_tx_resp *tx_resp = (void *)pkt->data; - int sta_id = IWL_MVM_TX_RES_GET_RA(tx_resp->ra_tid); - int tid = IWL_MVM_TX_RES_GET_TID(tx_resp->ra_tid); - u16 sequence = le16_to_cpu(pkt->hdr.sequence); - struct ieee80211_sta *sta; - - if (WARN_ON_ONCE(SEQ_TO_QUEUE(sequence) < IWL_MVM_FIRST_AGG_QUEUE)) - return; - - if (WARN_ON_ONCE(tid == IWL_TID_NON_QOS)) - return; - - iwl_mvm_rx_tx_cmd_agg_dbg(mvm, pkt); - - rcu_read_lock(); - - sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); - - if (!WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) { - struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; - mvmsta->tid_data[tid].rate_n_flags = - le32_to_cpu(tx_resp->initial_rate); - } - - rcu_read_unlock(); -} - -int iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_mvm_tx_resp *tx_resp = (void *)pkt->data; - - if (tx_resp->frame_count == 1) - iwl_mvm_rx_tx_cmd_single(mvm, pkt); - else - iwl_mvm_rx_tx_cmd_agg(mvm, pkt); - - return 0; -} - -int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_mvm_ba_notif *ba_notif = (void *)pkt->data; - struct sk_buff_head reclaimed_skbs; - struct iwl_mvm_tid_data *tid_data; - struct ieee80211_tx_info *info; - struct ieee80211_sta *sta; - struct iwl_mvm_sta *mvmsta; - struct ieee80211_hdr *hdr; - struct sk_buff *skb; - int sta_id, tid, freed; - - /* "flow" corresponds to Tx queue */ - u16 scd_flow = le16_to_cpu(ba_notif->scd_flow); - - /* "ssn" is start of block-ack Tx window, corresponds to index - * (in Tx queue's circular buffer) of first TFD/frame in window */ - u16 ba_resp_scd_ssn = le16_to_cpu(ba_notif->scd_ssn); - - sta_id = ba_notif->sta_id; - tid = ba_notif->tid; - - rcu_read_lock(); - - sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); - - /* Reclaiming frames for a station that has been deleted ? */ - if (WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) { - rcu_read_unlock(); - return 0; - } - - mvmsta = (void *)sta->drv_priv; - tid_data = &mvmsta->tid_data[tid]; - - if (WARN_ONCE(tid_data->txq_id != scd_flow, "Q %d, tid %d, flow %d", - tid_data->txq_id, tid, scd_flow)) { - rcu_read_unlock(); - return 0; - } - - spin_lock_bh(&mvmsta->lock); - - __skb_queue_head_init(&reclaimed_skbs); - - /* - * Release all TFDs before the SSN, i.e. all TFDs in front of - * block-ack window (we assume that they've been successfully - * transmitted ... if not, it's too late anyway). - */ - iwl_trans_reclaim(mvm->trans, scd_flow, ba_resp_scd_ssn, - &reclaimed_skbs); - - IWL_DEBUG_TX_REPLY(mvm, - "BA_NOTIFICATION Received from %pM, sta_id = %d\n", - (u8 *)&ba_notif->sta_addr_lo32, - ba_notif->sta_id); - IWL_DEBUG_TX_REPLY(mvm, - "TID = %d, SeqCtl = %d, bitmap = 0x%llx, scd_flow = %d, scd_ssn = %d sent:%d, acked:%d\n", - ba_notif->tid, le16_to_cpu(ba_notif->seq_ctl), - (unsigned long long)le64_to_cpu(ba_notif->bitmap), - scd_flow, ba_resp_scd_ssn, ba_notif->txed, - ba_notif->txed_2_done); - - tid_data->next_reclaimed = ba_resp_scd_ssn; - - iwl_mvm_check_ratid_empty(mvm, sta, tid); - - freed = 0; - - skb_queue_walk(&reclaimed_skbs, skb) { - hdr = (struct ieee80211_hdr *)skb->data; - - if (ieee80211_is_data_qos(hdr->frame_control)) - freed++; - else - WARN_ON_ONCE(1); - - info = IEEE80211_SKB_CB(skb); - iwl_trans_free_tx_cmd(mvm->trans, info->driver_data[1]); - - if (freed == 1) { - /* this is the first skb we deliver in this batch */ - /* put the rate scaling data there */ - info = IEEE80211_SKB_CB(skb); - memset(&info->status, 0, sizeof(info->status)); - info->flags |= IEEE80211_TX_STAT_ACK; - info->flags |= IEEE80211_TX_STAT_AMPDU; - info->status.ampdu_ack_len = ba_notif->txed_2_done; - info->status.ampdu_len = ba_notif->txed; - iwl_mvm_hwrate_to_tx_control(tid_data->rate_n_flags, - info); - } - } - - spin_unlock_bh(&mvmsta->lock); - - rcu_read_unlock(); - - while (!skb_queue_empty(&reclaimed_skbs)) { - skb = __skb_dequeue(&reclaimed_skbs); - ieee80211_tx_status_ni(mvm->hw, skb); - } - - return 0; -} - -int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk, bool sync) -{ - int ret; - struct iwl_tx_path_flush_cmd flush_cmd = { - .queues_ctl = cpu_to_le32(tfd_msk), - .flush_ctl = cpu_to_le16(DUMP_TX_FIFO_FLUSH), - }; - - u32 flags = sync ? CMD_SYNC : CMD_ASYNC; - - ret = iwl_mvm_send_cmd_pdu(mvm, TXPATH_FLUSH, flags, - sizeof(flush_cmd), &flush_cmd); - if (ret) - IWL_ERR(mvm, "Failed to send flush command (%d)\n", ret); - return ret; -} diff --git a/drivers/net/wireless/iwlwifi/mvm/utils.c b/drivers/net/wireless/iwlwifi/mvm/utils.c deleted file mode 100644 index 687b34e387ac..000000000000 --- a/drivers/net/wireless/iwlwifi/mvm/utils.c +++ /dev/null @@ -1,473 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2012 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#include - -#include "iwl-debug.h" -#include "iwl-io.h" - -#include "mvm.h" -#include "fw-api-rs.h" - -/* - * Will return 0 even if the cmd failed when RFKILL is asserted unless - * CMD_WANT_SKB is set in cmd->flags. - */ -int iwl_mvm_send_cmd(struct iwl_mvm *mvm, struct iwl_host_cmd *cmd) -{ - int ret; - - /* - * Synchronous commands from this op-mode must hold - * the mutex, this ensures we don't try to send two - * (or more) synchronous commands at a time. - */ - if (!(cmd->flags & CMD_ASYNC)) - lockdep_assert_held(&mvm->mutex); - - ret = iwl_trans_send_cmd(mvm->trans, cmd); - - /* - * If the caller wants the SKB, then don't hide any problems, the - * caller might access the response buffer which will be NULL if - * the command failed. - */ - if (cmd->flags & CMD_WANT_SKB) - return ret; - - /* Silently ignore failures if RFKILL is asserted */ - if (!ret || ret == -ERFKILL) - return 0; - return ret; -} - -int iwl_mvm_send_cmd_pdu(struct iwl_mvm *mvm, u8 id, - u32 flags, u16 len, const void *data) -{ - struct iwl_host_cmd cmd = { - .id = id, - .len = { len, }, - .data = { data, }, - .flags = flags, - }; - - return iwl_mvm_send_cmd(mvm, &cmd); -} - -/* - * We assume that the caller set the status to the sucess value - */ -int iwl_mvm_send_cmd_status(struct iwl_mvm *mvm, struct iwl_host_cmd *cmd, - u32 *status) -{ - struct iwl_rx_packet *pkt; - struct iwl_cmd_response *resp; - int ret, resp_len; - - lockdep_assert_held(&mvm->mutex); - - /* - * Only synchronous commands can wait for status, - * we use WANT_SKB so the caller can't. - */ - if (WARN_ONCE(cmd->flags & (CMD_ASYNC | CMD_WANT_SKB), - "cmd flags %x", cmd->flags)) - return -EINVAL; - - cmd->flags |= CMD_SYNC | CMD_WANT_SKB; - - ret = iwl_trans_send_cmd(mvm->trans, cmd); - if (ret == -ERFKILL) { - /* - * The command failed because of RFKILL, don't update - * the status, leave it as success and return 0. - */ - return 0; - } else if (ret) { - return ret; - } - - pkt = cmd->resp_pkt; - /* Can happen if RFKILL is asserted */ - if (!pkt) { - ret = 0; - goto out_free_resp; - } - - if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { - ret = -EIO; - goto out_free_resp; - } - - resp_len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; - if (WARN_ON_ONCE(resp_len != sizeof(pkt->hdr) + sizeof(*resp))) { - ret = -EIO; - goto out_free_resp; - } - - resp = (void *)pkt->data; - *status = le32_to_cpu(resp->status); - out_free_resp: - iwl_free_resp(cmd); - return ret; -} - -/* - * We assume that the caller set the status to the sucess value - */ -int iwl_mvm_send_cmd_pdu_status(struct iwl_mvm *mvm, u8 id, u16 len, - const void *data, u32 *status) -{ - struct iwl_host_cmd cmd = { - .id = id, - .len = { len, }, - .data = { data, }, - }; - - return iwl_mvm_send_cmd_status(mvm, &cmd, status); -} - -#define IWL_DECLARE_RATE_INFO(r) \ - [IWL_RATE_##r##M_INDEX] = IWL_RATE_##r##M_PLCP - -/* - * Translate from fw_rate_index (IWL_RATE_XXM_INDEX) to PLCP - */ -static const u8 fw_rate_idx_to_plcp[IWL_RATE_COUNT] = { - IWL_DECLARE_RATE_INFO(1), - IWL_DECLARE_RATE_INFO(2), - IWL_DECLARE_RATE_INFO(5), - IWL_DECLARE_RATE_INFO(11), - IWL_DECLARE_RATE_INFO(6), - IWL_DECLARE_RATE_INFO(9), - IWL_DECLARE_RATE_INFO(12), - IWL_DECLARE_RATE_INFO(18), - IWL_DECLARE_RATE_INFO(24), - IWL_DECLARE_RATE_INFO(36), - IWL_DECLARE_RATE_INFO(48), - IWL_DECLARE_RATE_INFO(54), -}; - -int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags, - enum ieee80211_band band) -{ - int rate = rate_n_flags & RATE_LEGACY_RATE_MSK; - int idx; - int band_offset = 0; - - /* Legacy rate format, search for match in table */ - if (band == IEEE80211_BAND_5GHZ) - band_offset = IWL_FIRST_OFDM_RATE; - for (idx = band_offset; idx < IWL_RATE_COUNT_LEGACY; idx++) - if (fw_rate_idx_to_plcp[idx] == rate) - return idx - band_offset; - - return -1; -} - -u8 iwl_mvm_mac80211_idx_to_hwrate(int rate_idx) -{ - /* Get PLCP rate for tx_cmd->rate_n_flags */ - return fw_rate_idx_to_plcp[rate_idx]; -} - -int iwl_mvm_rx_fw_error(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - struct iwl_device_cmd *cmd) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_error_resp *err_resp = (void *)pkt->data; - - IWL_ERR(mvm, "FW Error notification: type 0x%08X cmd_id 0x%02X\n", - le32_to_cpu(err_resp->error_type), err_resp->cmd_id); - IWL_ERR(mvm, "FW Error notification: seq 0x%04X service 0x%08X\n", - le16_to_cpu(err_resp->bad_cmd_seq_num), - le32_to_cpu(err_resp->error_service)); - IWL_ERR(mvm, "FW Error notification: timestamp 0x%16llX\n", - le64_to_cpu(err_resp->timestamp)); - return 0; -} - -/* - * Returns the first antenna as ANT_[ABC], as defined in iwl-config.h. - * The parameter should also be a combination of ANT_[ABC]. - */ -u8 first_antenna(u8 mask) -{ - BUILD_BUG_ON(ANT_A != BIT(0)); /* using ffs is wrong if not */ - if (WARN_ON_ONCE(!mask)) /* ffs will return 0 if mask is zeroed */ - return BIT(0); - return BIT(ffs(mask) - 1); -} - -/* - * Toggles between TX antennas to send the probe request on. - * Receives the bitmask of valid TX antennas and the *index* used - * for the last TX, and returns the next valid *index* to use. - * In order to set it in the tx_cmd, must do BIT(idx). - */ -u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx) -{ - u8 ind = last_idx; - int i; - - for (i = 0; i < RATE_MCS_ANT_NUM; i++) { - ind = (ind + 1) % RATE_MCS_ANT_NUM; - if (valid & BIT(ind)) - return ind; - } - - WARN_ONCE(1, "Failed to toggle between antennas 0x%x", valid); - return last_idx; -} - -static struct { - char *name; - u8 num; -} advanced_lookup[] = { - { "NMI_INTERRUPT_WDG", 0x34 }, - { "SYSASSERT", 0x35 }, - { "UCODE_VERSION_MISMATCH", 0x37 }, - { "BAD_COMMAND", 0x38 }, - { "NMI_INTERRUPT_DATA_ACTION_PT", 0x3C }, - { "FATAL_ERROR", 0x3D }, - { "NMI_TRM_HW_ERR", 0x46 }, - { "NMI_INTERRUPT_TRM", 0x4C }, - { "NMI_INTERRUPT_BREAK_POINT", 0x54 }, - { "NMI_INTERRUPT_WDG_RXF_FULL", 0x5C }, - { "NMI_INTERRUPT_WDG_NO_RBD_RXF_FULL", 0x64 }, - { "NMI_INTERRUPT_HOST", 0x66 }, - { "NMI_INTERRUPT_ACTION_PT", 0x7C }, - { "NMI_INTERRUPT_UNKNOWN", 0x84 }, - { "NMI_INTERRUPT_INST_ACTION_PT", 0x86 }, - { "ADVANCED_SYSASSERT", 0 }, -}; - -static const char *desc_lookup(u32 num) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(advanced_lookup) - 1; i++) - if (advanced_lookup[i].num == num) - return advanced_lookup[i].name; - - /* No entry matches 'num', so it is the last: ADVANCED_SYSASSERT */ - return advanced_lookup[i].name; -} - -/* - * Note: This structure is read from the device with IO accesses, - * and the reading already does the endian conversion. As it is - * read with u32-sized accesses, any members with a different size - * need to be ordered correctly though! - */ -struct iwl_error_event_table { - u32 valid; /* (nonzero) valid, (0) log is empty */ - u32 error_id; /* type of error */ - u32 pc; /* program counter */ - u32 blink1; /* branch link */ - u32 blink2; /* branch link */ - u32 ilink1; /* interrupt link */ - u32 ilink2; /* interrupt link */ - u32 data1; /* error-specific data */ - u32 data2; /* error-specific data */ - u32 data3; /* error-specific data */ - u32 bcon_time; /* beacon timer */ - u32 tsf_low; /* network timestamp function timer */ - u32 tsf_hi; /* network timestamp function timer */ - u32 gp1; /* GP1 timer register */ - u32 gp2; /* GP2 timer register */ - u32 gp3; /* GP3 timer register */ - u32 ucode_ver; /* uCode version */ - u32 hw_ver; /* HW Silicon version */ - u32 brd_ver; /* HW board version */ - u32 log_pc; /* log program counter */ - u32 frame_ptr; /* frame pointer */ - u32 stack_ptr; /* stack pointer */ - u32 hcmd; /* last host command header */ - u32 isr0; /* isr status register LMPM_NIC_ISR0: - * rxtx_flag */ - u32 isr1; /* isr status register LMPM_NIC_ISR1: - * host_flag */ - u32 isr2; /* isr status register LMPM_NIC_ISR2: - * enc_flag */ - u32 isr3; /* isr status register LMPM_NIC_ISR3: - * time_flag */ - u32 isr4; /* isr status register LMPM_NIC_ISR4: - * wico interrupt */ - u32 isr_pref; /* isr status register LMPM_NIC_PREF_STAT */ - u32 wait_event; /* wait event() caller address */ - u32 l2p_control; /* L2pControlField */ - u32 l2p_duration; /* L2pDurationField */ - u32 l2p_mhvalid; /* L2pMhValidBits */ - u32 l2p_addr_match; /* L2pAddrMatchStat */ - u32 lmpm_pmg_sel; /* indicate which clocks are turned on - * (LMPM_PMG_SEL) */ - u32 u_timestamp; /* indicate when the date and time of the - * compilation */ - u32 flow_handler; /* FH read/write pointers, RX credit */ -} __packed; - -#define ERROR_START_OFFSET (1 * sizeof(u32)) -#define ERROR_ELEM_SIZE (7 * sizeof(u32)) - -void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm) -{ - struct iwl_trans *trans = mvm->trans; - struct iwl_error_event_table table; - u32 base; - - base = mvm->error_event_table; - if (mvm->cur_ucode == IWL_UCODE_INIT) { - if (!base) - base = mvm->fw->init_errlog_ptr; - } else { - if (!base) - base = mvm->fw->inst_errlog_ptr; - } - - if (base < 0x800000 || base >= 0x80C000) { - IWL_ERR(mvm, - "Not valid error log pointer 0x%08X for %s uCode\n", - base, - (mvm->cur_ucode == IWL_UCODE_INIT) - ? "Init" : "RT"); - return; - } - - iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table)); - - if (ERROR_START_OFFSET <= table.valid * ERROR_ELEM_SIZE) { - IWL_ERR(trans, "Start IWL Error Log Dump:\n"); - IWL_ERR(trans, "Status: 0x%08lX, count: %d\n", - mvm->status, table.valid); - } - - trace_iwlwifi_dev_ucode_error(trans->dev, table.error_id, table.tsf_low, - table.data1, table.data2, table.data3, - table.blink1, table.blink2, table.ilink1, - table.ilink2, table.bcon_time, table.gp1, - table.gp2, table.gp3, table.ucode_ver, - table.hw_ver, table.brd_ver); - IWL_ERR(mvm, "0x%08X | %-28s\n", table.error_id, - desc_lookup(table.error_id)); - IWL_ERR(mvm, "0x%08X | uPc\n", table.pc); - IWL_ERR(mvm, "0x%08X | branchlink1\n", table.blink1); - IWL_ERR(mvm, "0x%08X | branchlink2\n", table.blink2); - IWL_ERR(mvm, "0x%08X | interruptlink1\n", table.ilink1); - IWL_ERR(mvm, "0x%08X | interruptlink2\n", table.ilink2); - IWL_ERR(mvm, "0x%08X | data1\n", table.data1); - IWL_ERR(mvm, "0x%08X | data2\n", table.data2); - IWL_ERR(mvm, "0x%08X | data3\n", table.data3); - IWL_ERR(mvm, "0x%08X | beacon time\n", table.bcon_time); - IWL_ERR(mvm, "0x%08X | tsf low\n", table.tsf_low); - IWL_ERR(mvm, "0x%08X | tsf hi\n", table.tsf_hi); - IWL_ERR(mvm, "0x%08X | time gp1\n", table.gp1); - IWL_ERR(mvm, "0x%08X | time gp2\n", table.gp2); - IWL_ERR(mvm, "0x%08X | time gp3\n", table.gp3); - IWL_ERR(mvm, "0x%08X | uCode version\n", table.ucode_ver); - IWL_ERR(mvm, "0x%08X | hw version\n", table.hw_ver); - IWL_ERR(mvm, "0x%08X | board version\n", table.brd_ver); - IWL_ERR(mvm, "0x%08X | hcmd\n", table.hcmd); - IWL_ERR(mvm, "0x%08X | isr0\n", table.isr0); - IWL_ERR(mvm, "0x%08X | isr1\n", table.isr1); - IWL_ERR(mvm, "0x%08X | isr2\n", table.isr2); - IWL_ERR(mvm, "0x%08X | isr3\n", table.isr3); - IWL_ERR(mvm, "0x%08X | isr4\n", table.isr4); - IWL_ERR(mvm, "0x%08X | isr_pref\n", table.isr_pref); - IWL_ERR(mvm, "0x%08X | wait_event\n", table.wait_event); - IWL_ERR(mvm, "0x%08X | l2p_control\n", table.l2p_control); - IWL_ERR(mvm, "0x%08X | l2p_duration\n", table.l2p_duration); - IWL_ERR(mvm, "0x%08X | l2p_mhvalid\n", table.l2p_mhvalid); - IWL_ERR(mvm, "0x%08X | l2p_addr_match\n", table.l2p_addr_match); - IWL_ERR(mvm, "0x%08X | lmpm_pmg_sel\n", table.lmpm_pmg_sel); - IWL_ERR(mvm, "0x%08X | timestamp\n", table.u_timestamp); - IWL_ERR(mvm, "0x%08X | flow_handler\n", table.flow_handler); -} - -/** - * iwl_mvm_send_lq_cmd() - Send link quality command - * @init: This command is sent as part of station initialization right - * after station has been added. - * - * The link quality command is sent as the last step of station creation. - * This is the special case in which init is set and we call a callback in - * this case to clear the state indicating that station creation is in - * progress. - */ -int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq, - u8 flags, bool init) -{ - struct iwl_host_cmd cmd = { - .id = LQ_CMD, - .len = { sizeof(struct iwl_lq_cmd), }, - .flags = flags, - .data = { lq, }, - }; - - if (WARN_ON(lq->sta_id == IWL_MVM_STATION_COUNT)) - return -EINVAL; - - if (WARN_ON(init && (cmd.flags & CMD_ASYNC))) - return -EINVAL; - - return iwl_mvm_send_cmd(mvm, &cmd); -} diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c deleted file mode 100644 index b53e5c3f403b..000000000000 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ /dev/null @@ -1,467 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2007 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include - -#include "iwl-trans.h" -#include "iwl-drv.h" -#include "internal.h" - -#define IWL_PCI_DEVICE(dev, subdev, cfg) \ - .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \ - .subvendor = PCI_ANY_ID, .subdevice = (subdev), \ - .driver_data = (kernel_ulong_t)&(cfg) - -/* Hardware specific file defines the PCI IDs table for that hardware module */ -static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { - {IWL_PCI_DEVICE(0x4232, 0x1201, iwl5100_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1301, iwl5100_agn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1204, iwl5100_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1304, iwl5100_agn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1205, iwl5100_bgn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1305, iwl5100_bgn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1206, iwl5100_abg_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1306, iwl5100_abg_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1221, iwl5100_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1321, iwl5100_agn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1224, iwl5100_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1324, iwl5100_agn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1225, iwl5100_bgn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1325, iwl5100_bgn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1226, iwl5100_abg_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4232, 0x1326, iwl5100_abg_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4237, 0x1211, iwl5100_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4237, 0x1311, iwl5100_agn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4237, 0x1214, iwl5100_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4237, 0x1314, iwl5100_agn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4237, 0x1215, iwl5100_bgn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4237, 0x1315, iwl5100_bgn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4237, 0x1216, iwl5100_abg_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4237, 0x1316, iwl5100_abg_cfg)}, /* Half Mini Card */ - -/* 5300 Series WiFi */ - {IWL_PCI_DEVICE(0x4235, 0x1021, iwl5300_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4235, 0x1121, iwl5300_agn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4235, 0x1024, iwl5300_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4235, 0x1124, iwl5300_agn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4235, 0x1001, iwl5300_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4235, 0x1101, iwl5300_agn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4235, 0x1004, iwl5300_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4235, 0x1104, iwl5300_agn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4236, 0x1011, iwl5300_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4236, 0x1111, iwl5300_agn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x4236, 0x1014, iwl5300_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x4236, 0x1114, iwl5300_agn_cfg)}, /* Half Mini Card */ - -/* 5350 Series WiFi/WiMax */ - {IWL_PCI_DEVICE(0x423A, 0x1001, iwl5350_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x423A, 0x1021, iwl5350_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x423B, 0x1011, iwl5350_agn_cfg)}, /* Mini Card */ - -/* 5150 Series Wifi/WiMax */ - {IWL_PCI_DEVICE(0x423C, 0x1201, iwl5150_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x423C, 0x1301, iwl5150_agn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x423C, 0x1206, iwl5150_abg_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x423C, 0x1306, iwl5150_abg_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x423C, 0x1221, iwl5150_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x423C, 0x1321, iwl5150_agn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x423C, 0x1326, iwl5150_abg_cfg)}, /* Half Mini Card */ - - {IWL_PCI_DEVICE(0x423D, 0x1211, iwl5150_agn_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x423D, 0x1311, iwl5150_agn_cfg)}, /* Half Mini Card */ - {IWL_PCI_DEVICE(0x423D, 0x1216, iwl5150_abg_cfg)}, /* Mini Card */ - {IWL_PCI_DEVICE(0x423D, 0x1316, iwl5150_abg_cfg)}, /* Half Mini Card */ - -/* 6x00 Series */ - {IWL_PCI_DEVICE(0x422B, 0x1101, iwl6000_3agn_cfg)}, - {IWL_PCI_DEVICE(0x422B, 0x1108, iwl6000_3agn_cfg)}, - {IWL_PCI_DEVICE(0x422B, 0x1121, iwl6000_3agn_cfg)}, - {IWL_PCI_DEVICE(0x422B, 0x1128, iwl6000_3agn_cfg)}, - {IWL_PCI_DEVICE(0x422C, 0x1301, iwl6000i_2agn_cfg)}, - {IWL_PCI_DEVICE(0x422C, 0x1306, iwl6000i_2abg_cfg)}, - {IWL_PCI_DEVICE(0x422C, 0x1307, iwl6000i_2bg_cfg)}, - {IWL_PCI_DEVICE(0x422C, 0x1321, iwl6000i_2agn_cfg)}, - {IWL_PCI_DEVICE(0x422C, 0x1326, iwl6000i_2abg_cfg)}, - {IWL_PCI_DEVICE(0x4238, 0x1111, iwl6000_3agn_cfg)}, - {IWL_PCI_DEVICE(0x4238, 0x1118, iwl6000_3agn_cfg)}, - {IWL_PCI_DEVICE(0x4239, 0x1311, iwl6000i_2agn_cfg)}, - {IWL_PCI_DEVICE(0x4239, 0x1316, iwl6000i_2abg_cfg)}, - -/* 6x05 Series */ - {IWL_PCI_DEVICE(0x0082, 0x1301, iwl6005_2agn_cfg)}, - {IWL_PCI_DEVICE(0x0082, 0x1306, iwl6005_2abg_cfg)}, - {IWL_PCI_DEVICE(0x0082, 0x1307, iwl6005_2bg_cfg)}, - {IWL_PCI_DEVICE(0x0082, 0x1308, iwl6005_2agn_cfg)}, - {IWL_PCI_DEVICE(0x0082, 0x1321, iwl6005_2agn_cfg)}, - {IWL_PCI_DEVICE(0x0082, 0x1326, iwl6005_2abg_cfg)}, - {IWL_PCI_DEVICE(0x0082, 0x1328, iwl6005_2agn_cfg)}, - {IWL_PCI_DEVICE(0x0085, 0x1311, iwl6005_2agn_cfg)}, - {IWL_PCI_DEVICE(0x0085, 0x1318, iwl6005_2agn_cfg)}, - {IWL_PCI_DEVICE(0x0085, 0x1316, iwl6005_2abg_cfg)}, - {IWL_PCI_DEVICE(0x0082, 0xC020, iwl6005_2agn_sff_cfg)}, - {IWL_PCI_DEVICE(0x0085, 0xC220, iwl6005_2agn_sff_cfg)}, - {IWL_PCI_DEVICE(0x0085, 0xC228, iwl6005_2agn_sff_cfg)}, - {IWL_PCI_DEVICE(0x0082, 0x4820, iwl6005_2agn_d_cfg)}, - {IWL_PCI_DEVICE(0x0082, 0x1304, iwl6005_2agn_mow1_cfg)},/* low 5GHz active */ - {IWL_PCI_DEVICE(0x0082, 0x1305, iwl6005_2agn_mow2_cfg)},/* high 5GHz active */ - -/* 6x30 Series */ - {IWL_PCI_DEVICE(0x008A, 0x5305, iwl1030_bgn_cfg)}, - {IWL_PCI_DEVICE(0x008A, 0x5307, iwl1030_bg_cfg)}, - {IWL_PCI_DEVICE(0x008A, 0x5325, iwl1030_bgn_cfg)}, - {IWL_PCI_DEVICE(0x008A, 0x5327, iwl1030_bg_cfg)}, - {IWL_PCI_DEVICE(0x008B, 0x5315, iwl1030_bgn_cfg)}, - {IWL_PCI_DEVICE(0x008B, 0x5317, iwl1030_bg_cfg)}, - {IWL_PCI_DEVICE(0x0090, 0x5211, iwl6030_2agn_cfg)}, - {IWL_PCI_DEVICE(0x0090, 0x5215, iwl6030_2bgn_cfg)}, - {IWL_PCI_DEVICE(0x0090, 0x5216, iwl6030_2abg_cfg)}, - {IWL_PCI_DEVICE(0x0091, 0x5201, iwl6030_2agn_cfg)}, - {IWL_PCI_DEVICE(0x0091, 0x5205, iwl6030_2bgn_cfg)}, - {IWL_PCI_DEVICE(0x0091, 0x5206, iwl6030_2abg_cfg)}, - {IWL_PCI_DEVICE(0x0091, 0x5207, iwl6030_2bg_cfg)}, - {IWL_PCI_DEVICE(0x0091, 0x5221, iwl6030_2agn_cfg)}, - {IWL_PCI_DEVICE(0x0091, 0x5225, iwl6030_2bgn_cfg)}, - {IWL_PCI_DEVICE(0x0091, 0x5226, iwl6030_2abg_cfg)}, - -/* 6x50 WiFi/WiMax Series */ - {IWL_PCI_DEVICE(0x0087, 0x1301, iwl6050_2agn_cfg)}, - {IWL_PCI_DEVICE(0x0087, 0x1306, iwl6050_2abg_cfg)}, - {IWL_PCI_DEVICE(0x0087, 0x1321, iwl6050_2agn_cfg)}, - {IWL_PCI_DEVICE(0x0087, 0x1326, iwl6050_2abg_cfg)}, - {IWL_PCI_DEVICE(0x0089, 0x1311, iwl6050_2agn_cfg)}, - {IWL_PCI_DEVICE(0x0089, 0x1316, iwl6050_2abg_cfg)}, - -/* 6150 WiFi/WiMax Series */ - {IWL_PCI_DEVICE(0x0885, 0x1305, iwl6150_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0885, 0x1307, iwl6150_bg_cfg)}, - {IWL_PCI_DEVICE(0x0885, 0x1325, iwl6150_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0885, 0x1327, iwl6150_bg_cfg)}, - {IWL_PCI_DEVICE(0x0886, 0x1315, iwl6150_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0886, 0x1317, iwl6150_bg_cfg)}, - -/* 1000 Series WiFi */ - {IWL_PCI_DEVICE(0x0083, 0x1205, iwl1000_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0083, 0x1305, iwl1000_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0083, 0x1225, iwl1000_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0083, 0x1325, iwl1000_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0084, 0x1215, iwl1000_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0084, 0x1315, iwl1000_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0083, 0x1206, iwl1000_bg_cfg)}, - {IWL_PCI_DEVICE(0x0083, 0x1306, iwl1000_bg_cfg)}, - {IWL_PCI_DEVICE(0x0083, 0x1226, iwl1000_bg_cfg)}, - {IWL_PCI_DEVICE(0x0083, 0x1326, iwl1000_bg_cfg)}, - {IWL_PCI_DEVICE(0x0084, 0x1216, iwl1000_bg_cfg)}, - {IWL_PCI_DEVICE(0x0084, 0x1316, iwl1000_bg_cfg)}, - -/* 100 Series WiFi */ - {IWL_PCI_DEVICE(0x08AE, 0x1005, iwl100_bgn_cfg)}, - {IWL_PCI_DEVICE(0x08AE, 0x1007, iwl100_bg_cfg)}, - {IWL_PCI_DEVICE(0x08AF, 0x1015, iwl100_bgn_cfg)}, - {IWL_PCI_DEVICE(0x08AF, 0x1017, iwl100_bg_cfg)}, - {IWL_PCI_DEVICE(0x08AE, 0x1025, iwl100_bgn_cfg)}, - {IWL_PCI_DEVICE(0x08AE, 0x1027, iwl100_bg_cfg)}, - -/* 130 Series WiFi */ - {IWL_PCI_DEVICE(0x0896, 0x5005, iwl130_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0896, 0x5007, iwl130_bg_cfg)}, - {IWL_PCI_DEVICE(0x0897, 0x5015, iwl130_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0897, 0x5017, iwl130_bg_cfg)}, - {IWL_PCI_DEVICE(0x0896, 0x5025, iwl130_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0896, 0x5027, iwl130_bg_cfg)}, - -/* 2x00 Series */ - {IWL_PCI_DEVICE(0x0890, 0x4022, iwl2000_2bgn_cfg)}, - {IWL_PCI_DEVICE(0x0891, 0x4222, iwl2000_2bgn_cfg)}, - {IWL_PCI_DEVICE(0x0890, 0x4422, iwl2000_2bgn_cfg)}, - {IWL_PCI_DEVICE(0x0890, 0x4822, iwl2000_2bgn_d_cfg)}, - -/* 2x30 Series */ - {IWL_PCI_DEVICE(0x0887, 0x4062, iwl2030_2bgn_cfg)}, - {IWL_PCI_DEVICE(0x0888, 0x4262, iwl2030_2bgn_cfg)}, - {IWL_PCI_DEVICE(0x0887, 0x4462, iwl2030_2bgn_cfg)}, - -/* 6x35 Series */ - {IWL_PCI_DEVICE(0x088E, 0x4060, iwl6035_2agn_cfg)}, - {IWL_PCI_DEVICE(0x088E, 0x406A, iwl6035_2agn_sff_cfg)}, - {IWL_PCI_DEVICE(0x088F, 0x4260, iwl6035_2agn_cfg)}, - {IWL_PCI_DEVICE(0x088F, 0x426A, iwl6035_2agn_sff_cfg)}, - {IWL_PCI_DEVICE(0x088E, 0x4460, iwl6035_2agn_cfg)}, - {IWL_PCI_DEVICE(0x088E, 0x446A, iwl6035_2agn_sff_cfg)}, - {IWL_PCI_DEVICE(0x088E, 0x4860, iwl6035_2agn_cfg)}, - {IWL_PCI_DEVICE(0x088F, 0x5260, iwl6035_2agn_cfg)}, - -/* 105 Series */ - {IWL_PCI_DEVICE(0x0894, 0x0022, iwl105_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0895, 0x0222, iwl105_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0894, 0x0422, iwl105_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0894, 0x0822, iwl105_bgn_d_cfg)}, - -/* 135 Series */ - {IWL_PCI_DEVICE(0x0892, 0x0062, iwl135_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0893, 0x0262, iwl135_bgn_cfg)}, - {IWL_PCI_DEVICE(0x0892, 0x0462, iwl135_bgn_cfg)}, - -/* 7000 Series */ - {IWL_PCI_DEVICE(0x08B1, 0x4070, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4072, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4170, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4060, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x406A, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4160, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4062, iwl7260_n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4162, iwl7260_n_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0x4270, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0x4272, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0x4260, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0x426A, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0x4262, iwl7260_n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4470, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4472, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4460, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x446A, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4462, iwl7260_n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4870, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x486E, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4570, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4560, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0x4370, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0x4360, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x5070, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4020, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x402A, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0x4220, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0x4420, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC070, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC072, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC170, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC060, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC06A, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC160, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC062, iwl7260_n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC162, iwl7260_n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC770, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC760, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0xC270, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0xC272, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0xC260, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0xC26A, iwl7260_n_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0xC262, iwl7260_n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC470, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC472, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC460, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC462, iwl7260_n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC570, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC560, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0xC370, iwl7260_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC360, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC020, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC02A, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B2, 0xC220, iwl7260_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B1, 0xC420, iwl7260_2n_cfg)}, - -/* 3160 Series */ - {IWL_PCI_DEVICE(0x08B3, 0x0070, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x0072, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x0170, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x0172, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x0060, iwl3160_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x0062, iwl3160_n_cfg)}, - {IWL_PCI_DEVICE(0x08B4, 0x0270, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B4, 0x0272, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x0470, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x0472, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B4, 0x0370, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x8070, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x8072, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x8170, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x8172, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x8060, iwl3160_2n_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x8062, iwl3160_n_cfg)}, - {IWL_PCI_DEVICE(0x08B4, 0x8270, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x8470, iwl3160_2ac_cfg)}, - {IWL_PCI_DEVICE(0x08B3, 0x8570, iwl3160_2ac_cfg)}, - - {0} -}; -MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); - -/* PCI registers */ -#define PCI_CFG_RETRY_TIMEOUT 0x041 - -static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); - struct iwl_trans *iwl_trans; - struct iwl_trans_pcie *trans_pcie; - int ret; - - iwl_trans = iwl_trans_pcie_alloc(pdev, ent, cfg); - if (iwl_trans == NULL) - return -ENOMEM; - - pci_set_drvdata(pdev, iwl_trans); - - trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans); - trans_pcie->drv = iwl_drv_start(iwl_trans, cfg); - - if (IS_ERR_OR_NULL(trans_pcie->drv)) { - ret = PTR_ERR(trans_pcie->drv); - goto out_free_trans; - } - - /* register transport layer debugfs here */ - ret = iwl_trans_dbgfs_register(iwl_trans, iwl_trans->dbgfs_dir); - if (ret) - goto out_free_drv; - - return 0; - -out_free_drv: - iwl_drv_stop(trans_pcie->drv); -out_free_trans: - iwl_trans_pcie_free(iwl_trans); - pci_set_drvdata(pdev, NULL); - return ret; -} - -static void iwl_pci_remove(struct pci_dev *pdev) -{ - struct iwl_trans *trans = pci_get_drvdata(pdev); - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - iwl_drv_stop(trans_pcie->drv); - iwl_trans_pcie_free(trans); - - pci_set_drvdata(pdev, NULL); -} - -#ifdef CONFIG_PM_SLEEP - -static int iwl_pci_suspend(struct device *device) -{ - struct pci_dev *pdev = to_pci_dev(device); - struct iwl_trans *iwl_trans = pci_get_drvdata(pdev); - - /* Before you put code here, think about WoWLAN. You cannot check here - * whether WoWLAN is enabled or not, and your code will run even if - * WoWLAN is enabled - don't kill the NIC, someone may need it in Sx. - */ - - return iwl_trans_suspend(iwl_trans); -} - -static int iwl_pci_resume(struct device *device) -{ - struct pci_dev *pdev = to_pci_dev(device); - struct iwl_trans *iwl_trans = pci_get_drvdata(pdev); - - /* Before you put code here, think about WoWLAN. You cannot check here - * whether WoWLAN is enabled or not, and your code will run even if - * WoWLAN is enabled - the NIC may be alive. - */ - - /* - * We disable the RETRY_TIMEOUT register (0x41) to keep - * PCI Tx retries from interfering with C3 CPU state. - */ - pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); - - return iwl_trans_resume(iwl_trans); -} - -static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume); - -#define IWL_PM_OPS (&iwl_dev_pm_ops) - -#else - -#define IWL_PM_OPS NULL - -#endif - -static struct pci_driver iwl_pci_driver = { - .name = DRV_NAME, - .id_table = iwl_hw_card_ids, - .probe = iwl_pci_probe, - .remove = iwl_pci_remove, - .driver.pm = IWL_PM_OPS, -}; - -int __must_check iwl_pci_register_driver(void) -{ - int ret; - ret = pci_register_driver(&iwl_pci_driver); - if (ret) - pr_err("Unable to initialize PCI module\n"); - - return ret; -} - -void iwl_pci_unregister_driver(void) -{ - pci_unregister_driver(&iwl_pci_driver); -} diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h deleted file mode 100644 index 148843e7f34f..000000000000 --- a/drivers/net/wireless/iwlwifi/pcie/internal.h +++ /dev/null @@ -1,479 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portions of the ieee80211 subsystem header files. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ -#ifndef __iwl_trans_int_pcie_h__ -#define __iwl_trans_int_pcie_h__ - -#include -#include -#include -#include -#include -#include - -#include "iwl-fh.h" -#include "iwl-csr.h" -#include "iwl-trans.h" -#include "iwl-debug.h" -#include "iwl-io.h" -#include "iwl-op-mode.h" - -struct iwl_host_cmd; - -/*This file includes the declaration that are internal to the - * trans_pcie layer */ - -struct iwl_rx_mem_buffer { - dma_addr_t page_dma; - struct page *page; - struct list_head list; -}; - -/** - * struct isr_statistics - interrupt statistics - * - */ -struct isr_statistics { - u32 hw; - u32 sw; - u32 err_code; - u32 sch; - u32 alive; - u32 rfkill; - u32 ctkill; - u32 wakeup; - u32 rx; - u32 tx; - u32 unhandled; -}; - -/** - * struct iwl_rxq - Rx queue - * @bd: driver's pointer to buffer of receive buffer descriptors (rbd) - * @bd_dma: bus address of buffer of receive buffer descriptors (rbd) - * @pool: - * @queue: - * @read: Shared index to newest available Rx buffer - * @write: Shared index to oldest written Rx packet - * @free_count: Number of pre-allocated buffers in rx_free - * @write_actual: - * @rx_free: list of free SKBs for use - * @rx_used: List of Rx buffers with no SKB - * @need_update: flag to indicate we need to update read/write index - * @rb_stts: driver's pointer to receive buffer status - * @rb_stts_dma: bus address of receive buffer status - * @lock: - * - * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers - */ -struct iwl_rxq { - __le32 *bd; - dma_addr_t bd_dma; - struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; - struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; - u32 read; - u32 write; - u32 free_count; - u32 write_actual; - struct list_head rx_free; - struct list_head rx_used; - int need_update; - struct iwl_rb_status *rb_stts; - dma_addr_t rb_stts_dma; - spinlock_t lock; -}; - -struct iwl_dma_ptr { - dma_addr_t dma; - void *addr; - size_t size; -}; - -/** - * iwl_queue_inc_wrap - increment queue index, wrap back to beginning - * @index -- current index - * @n_bd -- total number of entries in queue (must be power of 2) - */ -static inline int iwl_queue_inc_wrap(int index, int n_bd) -{ - return ++index & (n_bd - 1); -} - -/** - * iwl_queue_dec_wrap - decrement queue index, wrap back to end - * @index -- current index - * @n_bd -- total number of entries in queue (must be power of 2) - */ -static inline int iwl_queue_dec_wrap(int index, int n_bd) -{ - return --index & (n_bd - 1); -} - -struct iwl_cmd_meta { - /* only for SYNC commands, iff the reply skb is wanted */ - struct iwl_host_cmd *source; - u32 flags; -}; - -/* - * Generic queue structure - * - * Contains common data for Rx and Tx queues. - * - * Note the difference between n_bd and n_window: the hardware - * always assumes 256 descriptors, so n_bd is always 256 (unless - * there might be HW changes in the future). For the normal TX - * queues, n_window, which is the size of the software queue data - * is also 256; however, for the command queue, n_window is only - * 32 since we don't need so many commands pending. Since the HW - * still uses 256 BDs for DMA though, n_bd stays 256. As a result, - * the software buffers (in the variables @meta, @txb in struct - * iwl_txq) only have 32 entries, while the HW buffers (@tfds in - * the same struct) have 256. - * This means that we end up with the following: - * HW entries: | 0 | ... | N * 32 | ... | N * 32 + 31 | ... | 255 | - * SW entries: | 0 | ... | 31 | - * where N is a number between 0 and 7. This means that the SW - * data is a window overlayed over the HW queue. - */ -struct iwl_queue { - int n_bd; /* number of BDs in this queue */ - int write_ptr; /* 1-st empty entry (index) host_w*/ - int read_ptr; /* last used entry (index) host_r*/ - /* use for monitoring and recovering the stuck queue */ - dma_addr_t dma_addr; /* physical addr for BD's */ - int n_window; /* safe queue window */ - u32 id; - int low_mark; /* low watermark, resume queue if free - * space more than this */ - int high_mark; /* high watermark, stop queue if free - * space less than this */ -}; - -#define TFD_TX_CMD_SLOTS 256 -#define TFD_CMD_SLOTS 32 - -/* - * The FH will write back to the first TB only, so we need - * to copy some data into the buffer regardless of whether - * it should be mapped or not. This indicates how big the - * first TB must be to include the scratch buffer. Since - * the scratch is 4 bytes at offset 12, it's 16 now. If we - * make it bigger then allocations will be bigger and copy - * slower, so that's probably not useful. - */ -#define IWL_HCMD_SCRATCHBUF_SIZE 16 - -struct iwl_pcie_txq_entry { - struct iwl_device_cmd *cmd; - struct sk_buff *skb; - /* buffer to free after command completes */ - const void *free_buf; - struct iwl_cmd_meta meta; -}; - -struct iwl_pcie_txq_scratch_buf { - struct iwl_cmd_header hdr; - u8 buf[8]; - __le32 scratch; -}; - -/** - * struct iwl_txq - Tx Queue for DMA - * @q: generic Rx/Tx queue descriptor - * @tfds: transmit frame descriptors (DMA memory) - * @scratchbufs: start of command headers, including scratch buffers, for - * the writeback -- this is DMA memory and an array holding one buffer - * for each command on the queue - * @scratchbufs_dma: DMA address for the scratchbufs start - * @entries: transmit entries (driver state) - * @lock: queue lock - * @stuck_timer: timer that fires if queue gets stuck - * @trans_pcie: pointer back to transport (for timer) - * @need_update: indicates need to update read/write index - * @active: stores if queue is active - * - * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame - * descriptors) and required locking structures. - */ -struct iwl_txq { - struct iwl_queue q; - struct iwl_tfd *tfds; - struct iwl_pcie_txq_scratch_buf *scratchbufs; - dma_addr_t scratchbufs_dma; - struct iwl_pcie_txq_entry *entries; - spinlock_t lock; - struct timer_list stuck_timer; - struct iwl_trans_pcie *trans_pcie; - u8 need_update; - u8 active; -}; - -static inline dma_addr_t -iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx) -{ - return txq->scratchbufs_dma + - sizeof(struct iwl_pcie_txq_scratch_buf) * idx; -} - -/** - * struct iwl_trans_pcie - PCIe transport specific data - * @rxq: all the RX queue data - * @rx_replenish: work that will be called when buffers need to be allocated - * @drv - pointer to iwl_drv - * @trans: pointer to the generic transport area - * @scd_base_addr: scheduler sram base address in SRAM - * @scd_bc_tbls: pointer to the byte count table of the scheduler - * @kw: keep warm address - * @pci_dev: basic pci-network driver stuff - * @hw_base: pci hardware address support - * @ucode_write_complete: indicates that the ucode has been copied. - * @ucode_write_waitq: wait queue for uCode load - * @status - transport specific status flags - * @cmd_queue - command queue number - * @rx_buf_size_8k: 8 kB RX buffer size - * @bc_table_dword: true if the BC table expects DWORD (as opposed to bytes) - * @rx_page_order: page order for receive buffer size - * @wd_timeout: queue watchdog timeout (jiffies) - * @reg_lock: protect hw register access - */ -struct iwl_trans_pcie { - struct iwl_rxq rxq; - struct work_struct rx_replenish; - struct iwl_trans *trans; - struct iwl_drv *drv; - - /* INT ICT Table */ - __le32 *ict_tbl; - dma_addr_t ict_tbl_dma; - int ict_index; - u32 inta; - bool use_ict; - struct isr_statistics isr_stats; - - spinlock_t irq_lock; - u32 inta_mask; - u32 scd_base_addr; - struct iwl_dma_ptr scd_bc_tbls; - struct iwl_dma_ptr kw; - - struct iwl_txq *txq; - unsigned long queue_used[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)]; - unsigned long queue_stopped[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)]; - - /* PCI bus related data */ - struct pci_dev *pci_dev; - void __iomem *hw_base; - - bool ucode_write_complete; - wait_queue_head_t ucode_write_waitq; - wait_queue_head_t wait_command_queue; - - unsigned long status; - u8 cmd_queue; - u8 cmd_fifo; - u8 n_no_reclaim_cmds; - u8 no_reclaim_cmds[MAX_NO_RECLAIM_CMDS]; - - bool rx_buf_size_8k; - bool bc_table_dword; - u32 rx_page_order; - - const char **command_names; - - /* queue watchdog */ - unsigned long wd_timeout; - - /*protect hw register */ - spinlock_t reg_lock; -}; - -/** - * enum iwl_pcie_status: status of the PCIe transport - * @STATUS_HCMD_ACTIVE: a SYNC command is being processed - * @STATUS_DEVICE_ENABLED: APM is enabled - * @STATUS_TPOWER_PMI: the device might be asleep (need to wake it up) - * @STATUS_INT_ENABLED: interrupts are enabled - * @STATUS_RFKILL: the HW RFkill switch is in KILL position - * @STATUS_FW_ERROR: the fw is in error state - */ -enum iwl_pcie_status { - STATUS_HCMD_ACTIVE, - STATUS_DEVICE_ENABLED, - STATUS_TPOWER_PMI, - STATUS_INT_ENABLED, - STATUS_RFKILL, - STATUS_FW_ERROR, -}; - -#define IWL_TRANS_GET_PCIE_TRANS(_iwl_trans) \ - ((struct iwl_trans_pcie *) ((_iwl_trans)->trans_specific)) - -static inline struct iwl_trans * -iwl_trans_pcie_get_trans(struct iwl_trans_pcie *trans_pcie) -{ - return container_of((void *)trans_pcie, struct iwl_trans, - trans_specific); -} - -/* - * Convention: trans API functions: iwl_trans_pcie_XXX - * Other functions: iwl_pcie_XXX - */ -struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, - const struct pci_device_id *ent, - const struct iwl_cfg *cfg); -void iwl_trans_pcie_free(struct iwl_trans *trans); - -/***************************************************** -* RX -******************************************************/ -int iwl_pcie_rx_init(struct iwl_trans *trans); -irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id); -int iwl_pcie_rx_stop(struct iwl_trans *trans); -void iwl_pcie_rx_free(struct iwl_trans *trans); - -/***************************************************** -* ICT - interrupt handling -******************************************************/ -irqreturn_t iwl_pcie_isr_ict(int irq, void *data); -int iwl_pcie_alloc_ict(struct iwl_trans *trans); -void iwl_pcie_free_ict(struct iwl_trans *trans); -void iwl_pcie_reset_ict(struct iwl_trans *trans); -void iwl_pcie_disable_ict(struct iwl_trans *trans); - -/***************************************************** -* TX / HCMD -******************************************************/ -int iwl_pcie_tx_init(struct iwl_trans *trans); -void iwl_pcie_tx_start(struct iwl_trans *trans, u32 scd_base_addr); -int iwl_pcie_tx_stop(struct iwl_trans *trans); -void iwl_pcie_tx_free(struct iwl_trans *trans); -void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo, - int sta_id, int tid, int frame_limit, u16 ssn); -void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int queue); -int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, - struct iwl_device_cmd *dev_cmd, int txq_id); -void iwl_pcie_txq_inc_wr_ptr(struct iwl_trans *trans, struct iwl_txq *txq); -int iwl_trans_pcie_send_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd); -void iwl_pcie_hcmd_complete(struct iwl_trans *trans, - struct iwl_rx_cmd_buffer *rxb, int handler_status); -void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, - struct sk_buff_head *skbs); -void iwl_trans_pcie_tx_reset(struct iwl_trans *trans); - -/***************************************************** -* Error handling -******************************************************/ -int iwl_pcie_dump_fh(struct iwl_trans *trans, char **buf); -void iwl_pcie_dump_csr(struct iwl_trans *trans); - -/***************************************************** -* Helpers -******************************************************/ -static inline void iwl_disable_interrupts(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - clear_bit(STATUS_INT_ENABLED, &trans_pcie->status); - - /* disable interrupts from uCode/NIC to host */ - iwl_write32(trans, CSR_INT_MASK, 0x00000000); - - /* acknowledge/clear/reset any interrupts still pending - * from uCode or flow handler (Rx/Tx DMA) */ - iwl_write32(trans, CSR_INT, 0xffffffff); - iwl_write32(trans, CSR_FH_INT_STATUS, 0xffffffff); - IWL_DEBUG_ISR(trans, "Disabled interrupts\n"); -} - -static inline void iwl_enable_interrupts(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - IWL_DEBUG_ISR(trans, "Enabling interrupts\n"); - set_bit(STATUS_INT_ENABLED, &trans_pcie->status); - iwl_write32(trans, CSR_INT_MASK, trans_pcie->inta_mask); -} - -static inline void iwl_enable_rfkill_int(struct iwl_trans *trans) -{ - IWL_DEBUG_ISR(trans, "Enabling rfkill interrupt\n"); - iwl_write32(trans, CSR_INT_MASK, CSR_INT_BIT_RF_KILL); -} - -static inline void iwl_wake_queue(struct iwl_trans *trans, - struct iwl_txq *txq) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - if (test_and_clear_bit(txq->q.id, trans_pcie->queue_stopped)) { - IWL_DEBUG_TX_QUEUES(trans, "Wake hwq %d\n", txq->q.id); - iwl_op_mode_queue_not_full(trans->op_mode, txq->q.id); - } -} - -static inline void iwl_stop_queue(struct iwl_trans *trans, - struct iwl_txq *txq) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - if (!test_and_set_bit(txq->q.id, trans_pcie->queue_stopped)) { - iwl_op_mode_queue_full(trans->op_mode, txq->q.id); - IWL_DEBUG_TX_QUEUES(trans, "Stop hwq %d\n", txq->q.id); - } else - IWL_DEBUG_TX_QUEUES(trans, "hwq %d already stopped\n", - txq->q.id); -} - -static inline bool iwl_queue_used(const struct iwl_queue *q, int i) -{ - return q->write_ptr >= q->read_ptr ? - (i >= q->read_ptr && i < q->write_ptr) : - !(i < q->read_ptr && i >= q->write_ptr); -} - -static inline u8 get_cmd_index(struct iwl_queue *q, u32 index) -{ - return index & (q->n_window - 1); -} - -static inline const char *get_cmd_string(struct iwl_trans_pcie *trans_pcie, - u8 cmd) -{ - if (!trans_pcie->command_names || !trans_pcie->command_names[cmd]) - return "UNKNOWN"; - return trans_pcie->command_names[cmd]; -} - -static inline bool iwl_is_rfkill_set(struct iwl_trans *trans) -{ - return !(iwl_read32(trans, CSR_GP_CNTRL) & - CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); -} - -#endif /* __iwl_trans_int_pcie_h__ */ diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c deleted file mode 100644 index 567e67ad1f61..000000000000 --- a/drivers/net/wireless/iwlwifi/pcie/rx.c +++ /dev/null @@ -1,1306 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portions of the ieee80211 subsystem header files. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ -#include -#include -#include - -#include "iwl-prph.h" -#include "iwl-io.h" -#include "internal.h" -#include "iwl-op-mode.h" - -/****************************************************************************** - * - * RX path functions - * - ******************************************************************************/ - -/* - * Rx theory of operation - * - * Driver allocates a circular buffer of Receive Buffer Descriptors (RBDs), - * each of which point to Receive Buffers to be filled by the NIC. These get - * used not only for Rx frames, but for any command response or notification - * from the NIC. The driver and NIC manage the Rx buffers by means - * of indexes into the circular buffer. - * - * Rx Queue Indexes - * The host/firmware share two index registers for managing the Rx buffers. - * - * The READ index maps to the first position that the firmware may be writing - * to -- the driver can read up to (but not including) this position and get - * good data. - * The READ index is managed by the firmware once the card is enabled. - * - * The WRITE index maps to the last position the driver has read from -- the - * position preceding WRITE is the last slot the firmware can place a packet. - * - * The queue is empty (no good data) if WRITE = READ - 1, and is full if - * WRITE = READ. - * - * During initialization, the host sets up the READ queue position to the first - * INDEX position, and WRITE to the last (READ - 1 wrapped) - * - * When the firmware places a packet in a buffer, it will advance the READ index - * and fire the RX interrupt. The driver can then query the READ index and - * process as many packets as possible, moving the WRITE index forward as it - * resets the Rx queue buffers with new memory. - * - * The management in the driver is as follows: - * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When - * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled - * to replenish the iwl->rxq->rx_free. - * + In iwl_pcie_rx_replenish (scheduled) if 'processed' != 'read' then the - * iwl->rxq is replenished and the READ INDEX is updated (updating the - * 'processed' and 'read' driver indexes as well) - * + A received packet is processed and handed to the kernel network stack, - * detached from the iwl->rxq. The driver 'processed' index is updated. - * + The Host/Firmware iwl->rxq is replenished at irq thread time from the - * rx_free list. If there are no allocated buffers in iwl->rxq->rx_free, - * the READ INDEX is not incremented and iwl->status(RX_STALLED) is set. - * If there were enough free buffers and RX_STALLED is set it is cleared. - * - * - * Driver sequence: - * - * iwl_rxq_alloc() Allocates rx_free - * iwl_pcie_rx_replenish() Replenishes rx_free list from rx_used, and calls - * iwl_pcie_rxq_restock - * iwl_pcie_rxq_restock() Moves available buffers from rx_free into Rx - * queue, updates firmware pointers, and updates - * the WRITE index. If insufficient rx_free buffers - * are available, schedules iwl_pcie_rx_replenish - * - * -- enable interrupts -- - * ISR - iwl_rx() Detach iwl_rx_mem_buffers from pool up to the - * READ INDEX, detaching the SKB from the pool. - * Moves the packet buffer from queue to rx_used. - * Calls iwl_pcie_rxq_restock to refill any empty - * slots. - * ... - * - */ - -/* - * iwl_rxq_space - Return number of free slots available in queue. - */ -static int iwl_rxq_space(const struct iwl_rxq *q) -{ - int s = q->read - q->write; - if (s <= 0) - s += RX_QUEUE_SIZE; - /* keep some buffer to not confuse full and empty queue */ - s -= 2; - if (s < 0) - s = 0; - return s; -} - -/* - * iwl_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr - */ -static inline __le32 iwl_pcie_dma_addr2rbd_ptr(dma_addr_t dma_addr) -{ - return cpu_to_le32((u32)(dma_addr >> 8)); -} - -/* - * iwl_pcie_rx_stop - stops the Rx DMA - */ -int iwl_pcie_rx_stop(struct iwl_trans *trans) -{ - iwl_write_direct32(trans, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); - return iwl_poll_direct_bit(trans, FH_MEM_RSSR_RX_STATUS_REG, - FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000); -} - -/* - * iwl_pcie_rxq_inc_wr_ptr - Update the write pointer for the RX queue - */ -static void iwl_pcie_rxq_inc_wr_ptr(struct iwl_trans *trans, struct iwl_rxq *q) -{ - unsigned long flags; - u32 reg; - - spin_lock_irqsave(&q->lock, flags); - - if (q->need_update == 0) - goto exit_unlock; - - if (trans->cfg->base_params->shadow_reg_enable) { - /* shadow register enabled */ - /* Device expects a multiple of 8 */ - q->write_actual = (q->write & ~0x7); - iwl_write32(trans, FH_RSCSR_CHNL0_WPTR, q->write_actual); - } else { - struct iwl_trans_pcie *trans_pcie = - IWL_TRANS_GET_PCIE_TRANS(trans); - - /* If power-saving is in use, make sure device is awake */ - if (test_bit(STATUS_TPOWER_PMI, &trans_pcie->status)) { - reg = iwl_read32(trans, CSR_UCODE_DRV_GP1); - - if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { - IWL_DEBUG_INFO(trans, - "Rx queue requesting wakeup," - " GP1 = 0x%x\n", reg); - iwl_set_bit(trans, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - goto exit_unlock; - } - - q->write_actual = (q->write & ~0x7); - iwl_write_direct32(trans, FH_RSCSR_CHNL0_WPTR, - q->write_actual); - - /* Else device is assumed to be awake */ - } else { - /* Device expects a multiple of 8 */ - q->write_actual = (q->write & ~0x7); - iwl_write_direct32(trans, FH_RSCSR_CHNL0_WPTR, - q->write_actual); - } - } - q->need_update = 0; - - exit_unlock: - spin_unlock_irqrestore(&q->lock, flags); -} - -/* - * iwl_pcie_rxq_restock - refill RX queue from pre-allocated pool - * - * If there are slots in the RX queue that need to be restocked, - * and we have free pre-allocated buffers, fill the ranks as much - * as we can, pulling from rx_free. - * - * This moves the 'write' index forward to catch up with 'processed', and - * also updates the memory address in the firmware to reference the new - * target buffer. - */ -static void iwl_pcie_rxq_restock(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_rxq *rxq = &trans_pcie->rxq; - struct iwl_rx_mem_buffer *rxb; - unsigned long flags; - - /* - * If the device isn't enabled - not need to try to add buffers... - * This can happen when we stop the device and still have an interrupt - * pending. We stop the APM before we sync the interrupts because we - * have to (see comment there). On the other hand, since the APM is - * stopped, we cannot access the HW (in particular not prph). - * So don't try to restock if the APM has been already stopped. - */ - if (!test_bit(STATUS_DEVICE_ENABLED, &trans_pcie->status)) - return; - - spin_lock_irqsave(&rxq->lock, flags); - while ((iwl_rxq_space(rxq) > 0) && (rxq->free_count)) { - /* The overwritten rxb must be a used one */ - rxb = rxq->queue[rxq->write]; - BUG_ON(rxb && rxb->page); - - /* Get next free Rx buffer, remove from free list */ - rxb = list_first_entry(&rxq->rx_free, struct iwl_rx_mem_buffer, - list); - list_del(&rxb->list); - - /* Point to Rx buffer via next RBD in circular buffer */ - rxq->bd[rxq->write] = iwl_pcie_dma_addr2rbd_ptr(rxb->page_dma); - rxq->queue[rxq->write] = rxb; - rxq->write = (rxq->write + 1) & RX_QUEUE_MASK; - rxq->free_count--; - } - spin_unlock_irqrestore(&rxq->lock, flags); - /* If the pre-allocated buffer pool is dropping low, schedule to - * refill it */ - if (rxq->free_count <= RX_LOW_WATERMARK) - schedule_work(&trans_pcie->rx_replenish); - - /* If we've added more space for the firmware to place data, tell it. - * Increment device's write pointer in multiples of 8. */ - if (rxq->write_actual != (rxq->write & ~0x7)) { - spin_lock_irqsave(&rxq->lock, flags); - rxq->need_update = 1; - spin_unlock_irqrestore(&rxq->lock, flags); - iwl_pcie_rxq_inc_wr_ptr(trans, rxq); - } -} - -/* - * iwl_pcie_rxq_alloc_rbs - allocate a page for each used RBD - * - * A used RBD is an Rx buffer that has been given to the stack. To use it again - * a page must be allocated and the RBD must point to the page. This function - * doesn't change the HW pointer but handles the list of pages that is used by - * iwl_pcie_rxq_restock. The latter function will update the HW to use the newly - * allocated buffers. - */ -static void iwl_pcie_rxq_alloc_rbs(struct iwl_trans *trans, gfp_t priority) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_rxq *rxq = &trans_pcie->rxq; - struct iwl_rx_mem_buffer *rxb; - struct page *page; - unsigned long flags; - gfp_t gfp_mask = priority; - - while (1) { - spin_lock_irqsave(&rxq->lock, flags); - if (list_empty(&rxq->rx_used)) { - spin_unlock_irqrestore(&rxq->lock, flags); - return; - } - spin_unlock_irqrestore(&rxq->lock, flags); - - if (rxq->free_count > RX_LOW_WATERMARK) - gfp_mask |= __GFP_NOWARN; - - if (trans_pcie->rx_page_order > 0) - gfp_mask |= __GFP_COMP; - - /* Alloc a new receive buffer */ - page = alloc_pages(gfp_mask, trans_pcie->rx_page_order); - if (!page) { - if (net_ratelimit()) - IWL_DEBUG_INFO(trans, "alloc_pages failed, " - "order: %d\n", - trans_pcie->rx_page_order); - - if ((rxq->free_count <= RX_LOW_WATERMARK) && - net_ratelimit()) - IWL_CRIT(trans, "Failed to alloc_pages with %s." - "Only %u free buffers remaining.\n", - priority == GFP_ATOMIC ? - "GFP_ATOMIC" : "GFP_KERNEL", - rxq->free_count); - /* We don't reschedule replenish work here -- we will - * call the restock method and if it still needs - * more buffers it will schedule replenish */ - return; - } - - spin_lock_irqsave(&rxq->lock, flags); - - if (list_empty(&rxq->rx_used)) { - spin_unlock_irqrestore(&rxq->lock, flags); - __free_pages(page, trans_pcie->rx_page_order); - return; - } - rxb = list_first_entry(&rxq->rx_used, struct iwl_rx_mem_buffer, - list); - list_del(&rxb->list); - spin_unlock_irqrestore(&rxq->lock, flags); - - BUG_ON(rxb->page); - rxb->page = page; - /* Get physical address of the RB */ - rxb->page_dma = - dma_map_page(trans->dev, page, 0, - PAGE_SIZE << trans_pcie->rx_page_order, - DMA_FROM_DEVICE); - if (dma_mapping_error(trans->dev, rxb->page_dma)) { - rxb->page = NULL; - spin_lock_irqsave(&rxq->lock, flags); - list_add(&rxb->list, &rxq->rx_used); - spin_unlock_irqrestore(&rxq->lock, flags); - __free_pages(page, trans_pcie->rx_page_order); - return; - } - /* dma address must be no more than 36 bits */ - BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36)); - /* and also 256 byte aligned! */ - BUG_ON(rxb->page_dma & DMA_BIT_MASK(8)); - - spin_lock_irqsave(&rxq->lock, flags); - - list_add_tail(&rxb->list, &rxq->rx_free); - rxq->free_count++; - - spin_unlock_irqrestore(&rxq->lock, flags); - } -} - -static void iwl_pcie_rxq_free_rbs(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_rxq *rxq = &trans_pcie->rxq; - int i; - - /* Fill the rx_used queue with _all_ of the Rx buffers */ - for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) { - /* In the reset function, these buffers may have been allocated - * to an SKB, so we need to unmap and free potential storage */ - if (rxq->pool[i].page != NULL) { - dma_unmap_page(trans->dev, rxq->pool[i].page_dma, - PAGE_SIZE << trans_pcie->rx_page_order, - DMA_FROM_DEVICE); - __free_pages(rxq->pool[i].page, - trans_pcie->rx_page_order); - rxq->pool[i].page = NULL; - } - list_add_tail(&rxq->pool[i].list, &rxq->rx_used); - } -} - -/* - * iwl_pcie_rx_replenish - Move all used buffers from rx_used to rx_free - * - * When moving to rx_free an page is allocated for the slot. - * - * Also restock the Rx queue via iwl_pcie_rxq_restock. - * This is called as a scheduled work item (except for during initialization) - */ -static void iwl_pcie_rx_replenish(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - unsigned long flags; - - iwl_pcie_rxq_alloc_rbs(trans, GFP_KERNEL); - - spin_lock_irqsave(&trans_pcie->irq_lock, flags); - iwl_pcie_rxq_restock(trans); - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); -} - -static void iwl_pcie_rx_replenish_now(struct iwl_trans *trans) -{ - iwl_pcie_rxq_alloc_rbs(trans, GFP_ATOMIC); - - iwl_pcie_rxq_restock(trans); -} - -static void iwl_pcie_rx_replenish_work(struct work_struct *data) -{ - struct iwl_trans_pcie *trans_pcie = - container_of(data, struct iwl_trans_pcie, rx_replenish); - - iwl_pcie_rx_replenish(trans_pcie->trans); -} - -static int iwl_pcie_rx_alloc(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_rxq *rxq = &trans_pcie->rxq; - struct device *dev = trans->dev; - - memset(&trans_pcie->rxq, 0, sizeof(trans_pcie->rxq)); - - spin_lock_init(&rxq->lock); - - if (WARN_ON(rxq->bd || rxq->rb_stts)) - return -EINVAL; - - /* Allocate the circular buffer of Read Buffer Descriptors (RBDs) */ - rxq->bd = dma_zalloc_coherent(dev, sizeof(__le32) * RX_QUEUE_SIZE, - &rxq->bd_dma, GFP_KERNEL); - if (!rxq->bd) - goto err_bd; - - /*Allocate the driver's pointer to receive buffer status */ - rxq->rb_stts = dma_zalloc_coherent(dev, sizeof(*rxq->rb_stts), - &rxq->rb_stts_dma, GFP_KERNEL); - if (!rxq->rb_stts) - goto err_rb_stts; - - return 0; - -err_rb_stts: - dma_free_coherent(dev, sizeof(__le32) * RX_QUEUE_SIZE, - rxq->bd, rxq->bd_dma); - rxq->bd_dma = 0; - rxq->bd = NULL; -err_bd: - return -ENOMEM; -} - -static void iwl_pcie_rx_hw_init(struct iwl_trans *trans, struct iwl_rxq *rxq) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - u32 rb_size; - const u32 rfdnlog = RX_QUEUE_SIZE_LOG; /* 256 RBDs */ - - if (trans_pcie->rx_buf_size_8k) - rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_8K; - else - rb_size = FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K; - - /* Stop Rx DMA */ - iwl_write_direct32(trans, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0); - /* reset and flush pointers */ - iwl_write_direct32(trans, FH_MEM_RCSR_CHNL0_RBDCB_WPTR, 0); - iwl_write_direct32(trans, FH_MEM_RCSR_CHNL0_FLUSH_RB_REQ, 0); - iwl_write_direct32(trans, FH_RSCSR_CHNL0_RDPTR, 0); - - /* Reset driver's Rx queue write index */ - iwl_write_direct32(trans, FH_RSCSR_CHNL0_RBDCB_WPTR_REG, 0); - - /* Tell device where to find RBD circular buffer in DRAM */ - iwl_write_direct32(trans, FH_RSCSR_CHNL0_RBDCB_BASE_REG, - (u32)(rxq->bd_dma >> 8)); - - /* Tell device where in DRAM to update its Rx status */ - iwl_write_direct32(trans, FH_RSCSR_CHNL0_STTS_WPTR_REG, - rxq->rb_stts_dma >> 4); - - /* Enable Rx DMA - * FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY is set because of HW bug in - * the credit mechanism in 5000 HW RX FIFO - * Direct rx interrupts to hosts - * Rx buffer size 4 or 8k - * RB timeout 0x10 - * 256 RBDs - */ - iwl_write_direct32(trans, FH_MEM_RCSR_CHNL0_CONFIG_REG, - FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL | - FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY | - FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL | - rb_size| - (RX_RB_TIMEOUT << FH_RCSR_RX_CONFIG_REG_IRQ_RBTH_POS)| - (rfdnlog << FH_RCSR_RX_CONFIG_RBDCB_SIZE_POS)); - - /* Set interrupt coalescing timer to default (2048 usecs) */ - iwl_write8(trans, CSR_INT_COALESCING, IWL_HOST_INT_TIMEOUT_DEF); -} - -int iwl_pcie_rx_init(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_rxq *rxq = &trans_pcie->rxq; - int i, err; - unsigned long flags; - - if (!rxq->bd) { - err = iwl_pcie_rx_alloc(trans); - if (err) - return err; - } - - spin_lock_irqsave(&rxq->lock, flags); - INIT_LIST_HEAD(&rxq->rx_free); - INIT_LIST_HEAD(&rxq->rx_used); - - INIT_WORK(&trans_pcie->rx_replenish, - iwl_pcie_rx_replenish_work); - - iwl_pcie_rxq_free_rbs(trans); - - for (i = 0; i < RX_QUEUE_SIZE; i++) - rxq->queue[i] = NULL; - - /* Set us so that we have processed and used all buffers, but have - * not restocked the Rx queue with fresh buffers */ - rxq->read = rxq->write = 0; - rxq->write_actual = 0; - rxq->free_count = 0; - memset(rxq->rb_stts, 0, sizeof(*rxq->rb_stts)); - spin_unlock_irqrestore(&rxq->lock, flags); - - iwl_pcie_rx_replenish(trans); - - iwl_pcie_rx_hw_init(trans, rxq); - - spin_lock_irqsave(&trans_pcie->irq_lock, flags); - rxq->need_update = 1; - iwl_pcie_rxq_inc_wr_ptr(trans, rxq); - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); - - return 0; -} - -void iwl_pcie_rx_free(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_rxq *rxq = &trans_pcie->rxq; - unsigned long flags; - - /*if rxq->bd is NULL, it means that nothing has been allocated, - * exit now */ - if (!rxq->bd) { - IWL_DEBUG_INFO(trans, "Free NULL rx context\n"); - return; - } - - cancel_work_sync(&trans_pcie->rx_replenish); - - spin_lock_irqsave(&rxq->lock, flags); - iwl_pcie_rxq_free_rbs(trans); - spin_unlock_irqrestore(&rxq->lock, flags); - - dma_free_coherent(trans->dev, sizeof(__le32) * RX_QUEUE_SIZE, - rxq->bd, rxq->bd_dma); - rxq->bd_dma = 0; - rxq->bd = NULL; - - if (rxq->rb_stts) - dma_free_coherent(trans->dev, - sizeof(struct iwl_rb_status), - rxq->rb_stts, rxq->rb_stts_dma); - else - IWL_DEBUG_INFO(trans, "Free rxq->rb_stts which is NULL\n"); - rxq->rb_stts_dma = 0; - rxq->rb_stts = NULL; -} - -static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans, - struct iwl_rx_mem_buffer *rxb) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_rxq *rxq = &trans_pcie->rxq; - struct iwl_txq *txq = &trans_pcie->txq[trans_pcie->cmd_queue]; - unsigned long flags; - bool page_stolen = false; - int max_len = PAGE_SIZE << trans_pcie->rx_page_order; - u32 offset = 0; - - if (WARN_ON(!rxb)) - return; - - dma_unmap_page(trans->dev, rxb->page_dma, max_len, DMA_FROM_DEVICE); - - while (offset + sizeof(u32) + sizeof(struct iwl_cmd_header) < max_len) { - struct iwl_rx_packet *pkt; - struct iwl_device_cmd *cmd; - u16 sequence; - bool reclaim; - int index, cmd_index, err, len; - struct iwl_rx_cmd_buffer rxcb = { - ._offset = offset, - ._rx_page_order = trans_pcie->rx_page_order, - ._page = rxb->page, - ._page_stolen = false, - .truesize = max_len, - }; - - pkt = rxb_addr(&rxcb); - - if (pkt->len_n_flags == cpu_to_le32(FH_RSCSR_FRAME_INVALID)) - break; - - IWL_DEBUG_RX(trans, "cmd at offset %d: %s (0x%.2x)\n", - rxcb._offset, get_cmd_string(trans_pcie, pkt->hdr.cmd), - pkt->hdr.cmd); - - len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK; - len += sizeof(u32); /* account for status word */ - trace_iwlwifi_dev_rx(trans->dev, trans, pkt, len); - trace_iwlwifi_dev_rx_data(trans->dev, trans, pkt, len); - - /* Reclaim a command buffer only if this packet is a response - * to a (driver-originated) command. - * If the packet (e.g. Rx frame) originated from uCode, - * there is no command buffer to reclaim. - * Ucode should set SEQ_RX_FRAME bit if ucode-originated, - * but apparently a few don't get set; catch them here. */ - reclaim = !(pkt->hdr.sequence & SEQ_RX_FRAME); - if (reclaim) { - int i; - - for (i = 0; i < trans_pcie->n_no_reclaim_cmds; i++) { - if (trans_pcie->no_reclaim_cmds[i] == - pkt->hdr.cmd) { - reclaim = false; - break; - } - } - } - - sequence = le16_to_cpu(pkt->hdr.sequence); - index = SEQ_TO_INDEX(sequence); - cmd_index = get_cmd_index(&txq->q, index); - - if (reclaim) - cmd = txq->entries[cmd_index].cmd; - else - cmd = NULL; - - err = iwl_op_mode_rx(trans->op_mode, &rxcb, cmd); - - if (reclaim) { - kfree(txq->entries[cmd_index].free_buf); - txq->entries[cmd_index].free_buf = NULL; - } - - /* - * After here, we should always check rxcb._page_stolen, - * if it is true then one of the handlers took the page. - */ - - if (reclaim) { - /* Invoke any callbacks, transfer the buffer to caller, - * and fire off the (possibly) blocking - * iwl_trans_send_cmd() - * as we reclaim the driver command queue */ - if (!rxcb._page_stolen) - iwl_pcie_hcmd_complete(trans, &rxcb, err); - else - IWL_WARN(trans, "Claim null rxb?\n"); - } - - page_stolen |= rxcb._page_stolen; - offset += ALIGN(len, FH_RSCSR_FRAME_ALIGN); - } - - /* page was stolen from us -- free our reference */ - if (page_stolen) { - __free_pages(rxb->page, trans_pcie->rx_page_order); - rxb->page = NULL; - } - - /* Reuse the page if possible. For notification packets and - * SKBs that fail to Rx correctly, add them back into the - * rx_free list for reuse later. */ - spin_lock_irqsave(&rxq->lock, flags); - if (rxb->page != NULL) { - rxb->page_dma = - dma_map_page(trans->dev, rxb->page, 0, - PAGE_SIZE << trans_pcie->rx_page_order, - DMA_FROM_DEVICE); - if (dma_mapping_error(trans->dev, rxb->page_dma)) { - /* - * free the page(s) as well to not break - * the invariant that the items on the used - * list have no page(s) - */ - __free_pages(rxb->page, trans_pcie->rx_page_order); - rxb->page = NULL; - list_add_tail(&rxb->list, &rxq->rx_used); - } else { - list_add_tail(&rxb->list, &rxq->rx_free); - rxq->free_count++; - } - } else - list_add_tail(&rxb->list, &rxq->rx_used); - spin_unlock_irqrestore(&rxq->lock, flags); -} - -/* - * iwl_pcie_rx_handle - Main entry function for receiving responses from fw - */ -static void iwl_pcie_rx_handle(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_rxq *rxq = &trans_pcie->rxq; - u32 r, i; - u8 fill_rx = 0; - u32 count = 8; - int total_empty; - - /* uCode's read index (stored in shared DRAM) indicates the last Rx - * buffer that the driver may process (last buffer filled by ucode). */ - r = le16_to_cpu(ACCESS_ONCE(rxq->rb_stts->closed_rb_num)) & 0x0FFF; - i = rxq->read; - - /* Rx interrupt, but nothing sent from uCode */ - if (i == r) - IWL_DEBUG_RX(trans, "HW = SW = %d\n", r); - - /* calculate total frames need to be restock after handling RX */ - total_empty = r - rxq->write_actual; - if (total_empty < 0) - total_empty += RX_QUEUE_SIZE; - - if (total_empty > (RX_QUEUE_SIZE / 2)) - fill_rx = 1; - - while (i != r) { - struct iwl_rx_mem_buffer *rxb; - - rxb = rxq->queue[i]; - rxq->queue[i] = NULL; - - IWL_DEBUG_RX(trans, "rxbuf: HW = %d, SW = %d (%p)\n", - r, i, rxb); - iwl_pcie_rx_handle_rb(trans, rxb); - - i = (i + 1) & RX_QUEUE_MASK; - /* If there are a lot of unused frames, - * restock the Rx queue so ucode wont assert. */ - if (fill_rx) { - count++; - if (count >= 8) { - rxq->read = i; - iwl_pcie_rx_replenish_now(trans); - count = 0; - } - } - } - - /* Backtrack one entry */ - rxq->read = i; - if (fill_rx) - iwl_pcie_rx_replenish_now(trans); - else - iwl_pcie_rxq_restock(trans); -} - -/* - * iwl_pcie_irq_handle_error - called for HW or SW error interrupt from card - */ -static void iwl_pcie_irq_handle_error(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - /* W/A for WiFi/WiMAX coex and WiMAX own the RF */ - if (trans->cfg->internal_wimax_coex && - (!(iwl_read_prph(trans, APMG_CLK_CTRL_REG) & - APMS_CLK_VAL_MRB_FUNC_MODE) || - (iwl_read_prph(trans, APMG_PS_CTRL_REG) & - APMG_PS_CTRL_VAL_RESET_REQ))) { - clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); - iwl_op_mode_wimax_active(trans->op_mode); - wake_up(&trans_pcie->wait_command_queue); - return; - } - - iwl_pcie_dump_csr(trans); - iwl_pcie_dump_fh(trans, NULL); - - set_bit(STATUS_FW_ERROR, &trans_pcie->status); - clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); - wake_up(&trans_pcie->wait_command_queue); - - local_bh_disable(); - iwl_op_mode_nic_error(trans->op_mode); - local_bh_enable(); -} - -irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) -{ - struct iwl_trans *trans = dev_id; - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct isr_statistics *isr_stats = &trans_pcie->isr_stats; - u32 inta = 0; - u32 handled = 0; - unsigned long flags; - u32 i; -#ifdef CONFIG_IWLWIFI_DEBUG - u32 inta_mask; -#endif - - lock_map_acquire(&trans->sync_cmd_lockdep_map); - - spin_lock_irqsave(&trans_pcie->irq_lock, flags); - - /* Ack/clear/reset pending uCode interrupts. - * Note: Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS, - */ - /* There is a hardware bug in the interrupt mask function that some - * interrupts (i.e. CSR_INT_BIT_SCD) can still be generated even if - * they are disabled in the CSR_INT_MASK register. Furthermore the - * ICT interrupt handling mechanism has another bug that might cause - * these unmasked interrupts fail to be detected. We workaround the - * hardware bugs here by ACKing all the possible interrupts so that - * interrupt coalescing can still be achieved. - */ - iwl_write32(trans, CSR_INT, - trans_pcie->inta | ~trans_pcie->inta_mask); - - inta = trans_pcie->inta; - -#ifdef CONFIG_IWLWIFI_DEBUG - if (iwl_have_debug_level(IWL_DL_ISR)) { - /* just for debug */ - inta_mask = iwl_read32(trans, CSR_INT_MASK); - IWL_DEBUG_ISR(trans, "inta 0x%08x, enabled 0x%08x\n", - inta, inta_mask); - } -#endif - - /* saved interrupt in inta variable now we can reset trans_pcie->inta */ - trans_pcie->inta = 0; - - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); - - /* Now service all interrupt bits discovered above. */ - if (inta & CSR_INT_BIT_HW_ERR) { - IWL_ERR(trans, "Hardware error detected. Restarting.\n"); - - /* Tell the device to stop sending interrupts */ - iwl_disable_interrupts(trans); - - isr_stats->hw++; - iwl_pcie_irq_handle_error(trans); - - handled |= CSR_INT_BIT_HW_ERR; - - goto out; - } - -#ifdef CONFIG_IWLWIFI_DEBUG - if (iwl_have_debug_level(IWL_DL_ISR)) { - /* NIC fires this, but we don't use it, redundant with WAKEUP */ - if (inta & CSR_INT_BIT_SCD) { - IWL_DEBUG_ISR(trans, "Scheduler finished to transmit " - "the frame/frames.\n"); - isr_stats->sch++; - } - - /* Alive notification via Rx interrupt will do the real work */ - if (inta & CSR_INT_BIT_ALIVE) { - IWL_DEBUG_ISR(trans, "Alive interrupt\n"); - isr_stats->alive++; - } - } -#endif - /* Safely ignore these bits for debug checks below */ - inta &= ~(CSR_INT_BIT_SCD | CSR_INT_BIT_ALIVE); - - /* HW RF KILL switch toggled */ - if (inta & CSR_INT_BIT_RF_KILL) { - bool hw_rfkill; - - hw_rfkill = iwl_is_rfkill_set(trans); - IWL_WARN(trans, "RF_KILL bit toggled to %s.\n", - hw_rfkill ? "disable radio" : "enable radio"); - - isr_stats->rfkill++; - - iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); - if (hw_rfkill) { - set_bit(STATUS_RFKILL, &trans_pcie->status); - if (test_and_clear_bit(STATUS_HCMD_ACTIVE, - &trans_pcie->status)) - IWL_DEBUG_RF_KILL(trans, - "Rfkill while SYNC HCMD in flight\n"); - wake_up(&trans_pcie->wait_command_queue); - } else { - clear_bit(STATUS_RFKILL, &trans_pcie->status); - } - - handled |= CSR_INT_BIT_RF_KILL; - } - - /* Chip got too hot and stopped itself */ - if (inta & CSR_INT_BIT_CT_KILL) { - IWL_ERR(trans, "Microcode CT kill error detected.\n"); - isr_stats->ctkill++; - handled |= CSR_INT_BIT_CT_KILL; - } - - /* Error detected by uCode */ - if (inta & CSR_INT_BIT_SW_ERR) { - IWL_ERR(trans, "Microcode SW error detected. " - " Restarting 0x%X.\n", inta); - isr_stats->sw++; - iwl_pcie_irq_handle_error(trans); - handled |= CSR_INT_BIT_SW_ERR; - } - - /* uCode wakes up after power-down sleep */ - if (inta & CSR_INT_BIT_WAKEUP) { - IWL_DEBUG_ISR(trans, "Wakeup interrupt\n"); - iwl_pcie_rxq_inc_wr_ptr(trans, &trans_pcie->rxq); - for (i = 0; i < trans->cfg->base_params->num_of_queues; i++) - iwl_pcie_txq_inc_wr_ptr(trans, &trans_pcie->txq[i]); - - isr_stats->wakeup++; - - handled |= CSR_INT_BIT_WAKEUP; - } - - /* All uCode command responses, including Tx command responses, - * Rx "responses" (frame-received notification), and other - * notifications from uCode come through here*/ - if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX | - CSR_INT_BIT_RX_PERIODIC)) { - IWL_DEBUG_ISR(trans, "Rx interrupt\n"); - if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { - handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); - iwl_write32(trans, CSR_FH_INT_STATUS, - CSR_FH_INT_RX_MASK); - } - if (inta & CSR_INT_BIT_RX_PERIODIC) { - handled |= CSR_INT_BIT_RX_PERIODIC; - iwl_write32(trans, - CSR_INT, CSR_INT_BIT_RX_PERIODIC); - } - /* Sending RX interrupt require many steps to be done in the - * the device: - * 1- write interrupt to current index in ICT table. - * 2- dma RX frame. - * 3- update RX shared data to indicate last write index. - * 4- send interrupt. - * This could lead to RX race, driver could receive RX interrupt - * but the shared data changes does not reflect this; - * periodic interrupt will detect any dangling Rx activity. - */ - - /* Disable periodic interrupt; we use it as just a one-shot. */ - iwl_write8(trans, CSR_INT_PERIODIC_REG, - CSR_INT_PERIODIC_DIS); - - iwl_pcie_rx_handle(trans); - - /* - * Enable periodic interrupt in 8 msec only if we received - * real RX interrupt (instead of just periodic int), to catch - * any dangling Rx interrupt. If it was just the periodic - * interrupt, there was no dangling Rx activity, and no need - * to extend the periodic interrupt; one-shot is enough. - */ - if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) - iwl_write8(trans, CSR_INT_PERIODIC_REG, - CSR_INT_PERIODIC_ENA); - - isr_stats->rx++; - } - - /* This "Tx" DMA channel is used only for loading uCode */ - if (inta & CSR_INT_BIT_FH_TX) { - iwl_write32(trans, CSR_FH_INT_STATUS, CSR_FH_INT_TX_MASK); - IWL_DEBUG_ISR(trans, "uCode load interrupt\n"); - isr_stats->tx++; - handled |= CSR_INT_BIT_FH_TX; - /* Wake up uCode load routine, now that load is complete */ - trans_pcie->ucode_write_complete = true; - wake_up(&trans_pcie->ucode_write_waitq); - } - - if (inta & ~handled) { - IWL_ERR(trans, "Unhandled INTA bits 0x%08x\n", inta & ~handled); - isr_stats->unhandled++; - } - - if (inta & ~(trans_pcie->inta_mask)) { - IWL_WARN(trans, "Disabled INTA bits 0x%08x were pending\n", - inta & ~trans_pcie->inta_mask); - } - - /* Re-enable all interrupts */ - /* only Re-enable if disabled by irq */ - if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status)) - iwl_enable_interrupts(trans); - /* Re-enable RF_KILL if it occurred */ - else if (handled & CSR_INT_BIT_RF_KILL) - iwl_enable_rfkill_int(trans); - -out: - lock_map_release(&trans->sync_cmd_lockdep_map); - return IRQ_HANDLED; -} - -/****************************************************************************** - * - * ICT functions - * - ******************************************************************************/ - -/* a device (PCI-E) page is 4096 bytes long */ -#define ICT_SHIFT 12 -#define ICT_SIZE (1 << ICT_SHIFT) -#define ICT_COUNT (ICT_SIZE / sizeof(u32)) - -/* Free dram table */ -void iwl_pcie_free_ict(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - if (trans_pcie->ict_tbl) { - dma_free_coherent(trans->dev, ICT_SIZE, - trans_pcie->ict_tbl, - trans_pcie->ict_tbl_dma); - trans_pcie->ict_tbl = NULL; - trans_pcie->ict_tbl_dma = 0; - } -} - -/* - * allocate dram shared table, it is an aligned memory - * block of ICT_SIZE. - * also reset all data related to ICT table interrupt. - */ -int iwl_pcie_alloc_ict(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - trans_pcie->ict_tbl = - dma_alloc_coherent(trans->dev, ICT_SIZE, - &trans_pcie->ict_tbl_dma, - GFP_KERNEL); - if (!trans_pcie->ict_tbl) - return -ENOMEM; - - /* just an API sanity check ... it is guaranteed to be aligned */ - if (WARN_ON(trans_pcie->ict_tbl_dma & (ICT_SIZE - 1))) { - iwl_pcie_free_ict(trans); - return -EINVAL; - } - - IWL_DEBUG_ISR(trans, "ict dma addr %Lx\n", - (unsigned long long)trans_pcie->ict_tbl_dma); - - IWL_DEBUG_ISR(trans, "ict vir addr %p\n", trans_pcie->ict_tbl); - - /* reset table and index to all 0 */ - memset(trans_pcie->ict_tbl, 0, ICT_SIZE); - trans_pcie->ict_index = 0; - - /* add periodic RX interrupt */ - trans_pcie->inta_mask |= CSR_INT_BIT_RX_PERIODIC; - return 0; -} - -/* Device is going up inform it about using ICT interrupt table, - * also we need to tell the driver to start using ICT interrupt. - */ -void iwl_pcie_reset_ict(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - u32 val; - unsigned long flags; - - if (!trans_pcie->ict_tbl) - return; - - spin_lock_irqsave(&trans_pcie->irq_lock, flags); - iwl_disable_interrupts(trans); - - memset(trans_pcie->ict_tbl, 0, ICT_SIZE); - - val = trans_pcie->ict_tbl_dma >> ICT_SHIFT; - - val |= CSR_DRAM_INT_TBL_ENABLE; - val |= CSR_DRAM_INIT_TBL_WRAP_CHECK; - - IWL_DEBUG_ISR(trans, "CSR_DRAM_INT_TBL_REG =0x%x\n", val); - - iwl_write32(trans, CSR_DRAM_INT_TBL_REG, val); - trans_pcie->use_ict = true; - trans_pcie->ict_index = 0; - iwl_write32(trans, CSR_INT, trans_pcie->inta_mask); - iwl_enable_interrupts(trans); - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); -} - -/* Device is going down disable ict interrupt usage */ -void iwl_pcie_disable_ict(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - unsigned long flags; - - spin_lock_irqsave(&trans_pcie->irq_lock, flags); - trans_pcie->use_ict = false; - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); -} - -/* legacy (non-ICT) ISR. Assumes that trans_pcie->irq_lock is held */ -static irqreturn_t iwl_pcie_isr(int irq, void *data) -{ - struct iwl_trans *trans = data; - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - u32 inta, inta_mask; -#ifdef CONFIG_IWLWIFI_DEBUG - u32 inta_fh; -#endif - - lockdep_assert_held(&trans_pcie->irq_lock); - - trace_iwlwifi_dev_irq(trans->dev); - - /* Disable (but don't clear!) interrupts here to avoid - * back-to-back ISRs and sporadic interrupts from our NIC. - * If we have something to service, the irq thread will re-enable ints. - * If we *don't* have something, we'll re-enable before leaving here. */ - inta_mask = iwl_read32(trans, CSR_INT_MASK); - iwl_write32(trans, CSR_INT_MASK, 0x00000000); - - /* Discover which interrupts are active/pending */ - inta = iwl_read32(trans, CSR_INT); - - if (inta & (~inta_mask)) { - IWL_DEBUG_ISR(trans, - "We got a masked interrupt (0x%08x)...Ack and ignore\n", - inta & (~inta_mask)); - iwl_write32(trans, CSR_INT, inta & (~inta_mask)); - inta &= inta_mask; - } - - /* Ignore interrupt if there's nothing in NIC to service. - * This may be due to IRQ shared with another device, - * or due to sporadic interrupts thrown from our NIC. */ - if (!inta) { - IWL_DEBUG_ISR(trans, "Ignore interrupt, inta == 0\n"); - goto none; - } - - if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) { - /* Hardware disappeared. It might have already raised - * an interrupt */ - IWL_WARN(trans, "HARDWARE GONE?? INTA == 0x%08x\n", inta); - return IRQ_HANDLED; - } - -#ifdef CONFIG_IWLWIFI_DEBUG - if (iwl_have_debug_level(IWL_DL_ISR)) { - inta_fh = iwl_read32(trans, CSR_FH_INT_STATUS); - IWL_DEBUG_ISR(trans, "ISR inta 0x%08x, enabled 0x%08x, " - "fh 0x%08x\n", inta, inta_mask, inta_fh); - } -#endif - - trans_pcie->inta |= inta; - /* the thread will service interrupts and re-enable them */ - if (likely(inta)) - return IRQ_WAKE_THREAD; - else if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) && - !trans_pcie->inta) - iwl_enable_interrupts(trans); - return IRQ_HANDLED; - -none: - /* re-enable interrupts here since we don't have anything to service. */ - /* only Re-enable if disabled by irq and no schedules tasklet. */ - if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) && - !trans_pcie->inta) - iwl_enable_interrupts(trans); - - return IRQ_NONE; -} - -/* interrupt handler using ict table, with this interrupt driver will - * stop using INTA register to get device's interrupt, reading this register - * is expensive, device will write interrupts in ICT dram table, increment - * index then will fire interrupt to driver, driver will OR all ICT table - * entries from current index up to table entry with 0 value. the result is - * the interrupt we need to service, driver will set the entries back to 0 and - * set index. - */ -irqreturn_t iwl_pcie_isr_ict(int irq, void *data) -{ - struct iwl_trans *trans = data; - struct iwl_trans_pcie *trans_pcie; - u32 inta, inta_mask; - u32 val = 0; - u32 read; - unsigned long flags; - - if (!trans) - return IRQ_NONE; - - trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - spin_lock_irqsave(&trans_pcie->irq_lock, flags); - - /* dram interrupt table not set yet, - * use legacy interrupt. - */ - if (unlikely(!trans_pcie->use_ict)) { - irqreturn_t ret = iwl_pcie_isr(irq, data); - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); - return ret; - } - - trace_iwlwifi_dev_irq(trans->dev); - - /* Disable (but don't clear!) interrupts here to avoid - * back-to-back ISRs and sporadic interrupts from our NIC. - * If we have something to service, the tasklet will re-enable ints. - * If we *don't* have something, we'll re-enable before leaving here. - */ - inta_mask = iwl_read32(trans, CSR_INT_MASK); - iwl_write32(trans, CSR_INT_MASK, 0x00000000); - - /* Ignore interrupt if there's nothing in NIC to service. - * This may be due to IRQ shared with another device, - * or due to sporadic interrupts thrown from our NIC. */ - read = le32_to_cpu(trans_pcie->ict_tbl[trans_pcie->ict_index]); - trace_iwlwifi_dev_ict_read(trans->dev, trans_pcie->ict_index, read); - if (!read) { - IWL_DEBUG_ISR(trans, "Ignore interrupt, inta == 0\n"); - goto none; - } - - /* - * Collect all entries up to the first 0, starting from ict_index; - * note we already read at ict_index. - */ - do { - val |= read; - IWL_DEBUG_ISR(trans, "ICT index %d value 0x%08X\n", - trans_pcie->ict_index, read); - trans_pcie->ict_tbl[trans_pcie->ict_index] = 0; - trans_pcie->ict_index = - iwl_queue_inc_wrap(trans_pcie->ict_index, ICT_COUNT); - - read = le32_to_cpu(trans_pcie->ict_tbl[trans_pcie->ict_index]); - trace_iwlwifi_dev_ict_read(trans->dev, trans_pcie->ict_index, - read); - } while (read); - - /* We should not get this value, just ignore it. */ - if (val == 0xffffffff) - val = 0; - - /* - * this is a w/a for a h/w bug. the h/w bug may cause the Rx bit - * (bit 15 before shifting it to 31) to clear when using interrupt - * coalescing. fortunately, bits 18 and 19 stay set when this happens - * so we use them to decide on the real state of the Rx bit. - * In order words, bit 15 is set if bit 18 or bit 19 are set. - */ - if (val & 0xC0000) - val |= 0x8000; - - inta = (0xff & val) | ((0xff00 & val) << 16); - IWL_DEBUG_ISR(trans, "ISR inta 0x%08x, enabled 0x%08x ict 0x%08x\n", - inta, inta_mask, val); - - inta &= trans_pcie->inta_mask; - trans_pcie->inta |= inta; - - /* iwl_pcie_tasklet() will service interrupts and re-enable them */ - if (likely(inta)) { - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); - return IRQ_WAKE_THREAD; - } else if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) && - !trans_pcie->inta) { - /* Allow interrupt if was disabled by this handler and - * no tasklet was schedules, We should not enable interrupt, - * tasklet will enable it. - */ - iwl_enable_interrupts(trans); - } - - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); - return IRQ_HANDLED; - - none: - /* re-enable interrupts here since we don't have anything to service. - * only Re-enable if disabled by irq. - */ - if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) && - !trans_pcie->inta) - iwl_enable_interrupts(trans); - - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); - return IRQ_NONE; -} diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c deleted file mode 100644 index aeb70e13137a..000000000000 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ /dev/null @@ -1,1591 +0,0 @@ -/****************************************************************************** - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2007 - 2013 Intel 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 - * - * The full GNU General Public License is included in this distribution - * in the file called COPYING. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - * BSD LICENSE - * - * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - *****************************************************************************/ -#include -#include -#include -#include -#include -#include -#include - -#include "iwl-drv.h" -#include "iwl-trans.h" -#include "iwl-csr.h" -#include "iwl-prph.h" -#include "iwl-agn-hw.h" -#include "internal.h" - -static void __iwl_trans_pcie_set_bits_mask(struct iwl_trans *trans, - u32 reg, u32 mask, u32 value) -{ - u32 v; - -#ifdef CONFIG_IWLWIFI_DEBUG - WARN_ON_ONCE(value & ~mask); -#endif - - v = iwl_read32(trans, reg); - v &= ~mask; - v |= value; - iwl_write32(trans, reg, v); -} - -static inline void __iwl_trans_pcie_clear_bit(struct iwl_trans *trans, - u32 reg, u32 mask) -{ - __iwl_trans_pcie_set_bits_mask(trans, reg, mask, 0); -} - -static inline void __iwl_trans_pcie_set_bit(struct iwl_trans *trans, - u32 reg, u32 mask) -{ - __iwl_trans_pcie_set_bits_mask(trans, reg, mask, mask); -} - -static void iwl_pcie_set_pwr(struct iwl_trans *trans, bool vaux) -{ - if (vaux && pci_pme_capable(to_pci_dev(trans->dev), PCI_D3cold)) - iwl_set_bits_mask_prph(trans, APMG_PS_CTRL_REG, - APMG_PS_CTRL_VAL_PWR_SRC_VAUX, - ~APMG_PS_CTRL_MSK_PWR_SRC); - else - iwl_set_bits_mask_prph(trans, APMG_PS_CTRL_REG, - APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, - ~APMG_PS_CTRL_MSK_PWR_SRC); -} - -/* PCI registers */ -#define PCI_CFG_RETRY_TIMEOUT 0x041 - -static void iwl_pcie_apm_config(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - u16 lctl; - - /* - * HW bug W/A for instability in PCIe bus L0S->L1 transition. - * Check if BIOS (or OS) enabled L1-ASPM on this device. - * If so (likely), disable L0S, so device moves directly L0->L1; - * costs negligible amount of power savings. - * If not (unlikely), enable L0S, so there is at least some - * power savings, even without L1. - */ - pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL, &lctl); - if (lctl & PCI_EXP_LNKCTL_ASPM_L1) { - /* L1-ASPM enabled; disable(!) L0S */ - iwl_set_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); - dev_info(trans->dev, "L1 Enabled; Disabling L0S\n"); - } else { - /* L1-ASPM disabled; enable(!) L0S */ - iwl_clear_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); - dev_info(trans->dev, "L1 Disabled; Enabling L0S\n"); - } - trans->pm_support = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S); -} - -/* - * Start up NIC's basic functionality after it has been reset - * (e.g. after platform boot, or shutdown via iwl_pcie_apm_stop()) - * NOTE: This does not load uCode nor start the embedded processor - */ -static int iwl_pcie_apm_init(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - int ret = 0; - IWL_DEBUG_INFO(trans, "Init card's basic functions\n"); - - /* - * Use "set_bit" below rather than "write", to preserve any hardware - * bits already set by default after reset. - */ - - /* Disable L0S exit timer (platform NMI Work/Around) */ - iwl_set_bit(trans, CSR_GIO_CHICKEN_BITS, - CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); - - /* - * Disable L0s without affecting L1; - * don't wait for ICH L0s (ICH bug W/A) - */ - iwl_set_bit(trans, CSR_GIO_CHICKEN_BITS, - CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX); - - /* Set FH wait threshold to maximum (HW error during stress W/A) */ - iwl_set_bit(trans, CSR_DBG_HPET_MEM_REG, CSR_DBG_HPET_MEM_REG_VAL); - - /* - * Enable HAP INTA (interrupt from management bus) to - * wake device's PCI Express link L1a -> L0s - */ - iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A); - - iwl_pcie_apm_config(trans); - - /* Configure analog phase-lock-loop before activating to D0A */ - if (trans->cfg->base_params->pll_cfg_val) - iwl_set_bit(trans, CSR_ANA_PLL_CFG, - trans->cfg->base_params->pll_cfg_val); - - /* - * Set "initialization complete" bit to move adapter from - * D0U* --> D0A* (powered-up active) state. - */ - iwl_set_bit(trans, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); - - /* - * Wait for clock stabilization; once stabilized, access to - * device-internal resources is supported, e.g. iwl_write_prph() - * and accesses to uCode SRAM. - */ - ret = iwl_poll_bit(trans, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, - CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); - if (ret < 0) { - IWL_DEBUG_INFO(trans, "Failed to init the card\n"); - goto out; - } - - /* - * Enable DMA clock and wait for it to stabilize. - * - * Write to "CLK_EN_REG"; "1" bits enable clocks, while "0" bits - * do not disable clocks. This preserves any hardware bits already - * set by default in "CLK_CTRL_REG" after reset. - */ - iwl_write_prph(trans, APMG_CLK_EN_REG, APMG_CLK_VAL_DMA_CLK_RQT); - udelay(20); - - /* Disable L1-Active */ - iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG, - APMG_PCIDEV_STT_VAL_L1_ACT_DIS); - - set_bit(STATUS_DEVICE_ENABLED, &trans_pcie->status); - -out: - return ret; -} - -static int iwl_pcie_apm_stop_master(struct iwl_trans *trans) -{ - int ret = 0; - - /* stop device's busmaster DMA activity */ - iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); - - ret = iwl_poll_bit(trans, CSR_RESET, - CSR_RESET_REG_FLAG_MASTER_DISABLED, - CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); - if (ret) - IWL_WARN(trans, "Master Disable Timed Out, 100 usec\n"); - - IWL_DEBUG_INFO(trans, "stop master\n"); - - return ret; -} - -static void iwl_pcie_apm_stop(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - IWL_DEBUG_INFO(trans, "Stop card, put in low power state\n"); - - clear_bit(STATUS_DEVICE_ENABLED, &trans_pcie->status); - - /* Stop device's DMA activity */ - iwl_pcie_apm_stop_master(trans); - - /* Reset the entire device */ - iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); - - udelay(10); - - /* - * Clear "initialization complete" bit to move adapter from - * D0A* (powered-up Active) --> D0U* (Uninitialized) state. - */ - iwl_clear_bit(trans, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_INIT_DONE); -} - -static int iwl_pcie_nic_init(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - unsigned long flags; - - /* nic_init */ - spin_lock_irqsave(&trans_pcie->irq_lock, flags); - iwl_pcie_apm_init(trans); - - /* Set interrupt coalescing calibration timer to default (512 usecs) */ - iwl_write8(trans, CSR_INT_COALESCING, IWL_HOST_INT_CALIB_TIMEOUT_DEF); - - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); - - iwl_pcie_set_pwr(trans, false); - - iwl_op_mode_nic_config(trans->op_mode); - - /* Allocate the RX queue, or reset if it is already allocated */ - iwl_pcie_rx_init(trans); - - /* Allocate or reset and init all Tx and Command queues */ - if (iwl_pcie_tx_init(trans)) - return -ENOMEM; - - if (trans->cfg->base_params->shadow_reg_enable) { - /* enable shadow regs in HW */ - iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL, 0x800FFFFF); - IWL_DEBUG_INFO(trans, "Enabling shadow registers in device\n"); - } - - return 0; -} - -#define HW_READY_TIMEOUT (50) - -/* Note: returns poll_bit return value, which is >= 0 if success */ -static int iwl_pcie_set_hw_ready(struct iwl_trans *trans) -{ - int ret; - - iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_BIT_NIC_READY); - - /* See if we got it */ - ret = iwl_poll_bit(trans, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, - CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, - HW_READY_TIMEOUT); - - IWL_DEBUG_INFO(trans, "hardware%s ready\n", ret < 0 ? " not" : ""); - return ret; -} - -/* Note: returns standard 0/-ERROR code */ -static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) -{ - int ret; - int t = 0; - - IWL_DEBUG_INFO(trans, "iwl_trans_prepare_card_hw enter\n"); - - ret = iwl_pcie_set_hw_ready(trans); - /* If the card is ready, exit 0 */ - if (ret >= 0) - return 0; - - /* If HW is not ready, prepare the conditions to check again */ - iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, - CSR_HW_IF_CONFIG_REG_PREPARE); - - do { - ret = iwl_pcie_set_hw_ready(trans); - if (ret >= 0) - return 0; - - usleep_range(200, 1000); - t += 200; - } while (t < 150000); - - return ret; -} - -/* - * ucode - */ -static int iwl_pcie_load_firmware_chunk(struct iwl_trans *trans, u32 dst_addr, - dma_addr_t phy_addr, u32 byte_cnt) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - int ret; - - trans_pcie->ucode_write_complete = false; - - iwl_write_direct32(trans, - FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), - FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE); - - iwl_write_direct32(trans, - FH_SRVC_CHNL_SRAM_ADDR_REG(FH_SRVC_CHNL), - dst_addr); - - iwl_write_direct32(trans, - FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL), - phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK); - - iwl_write_direct32(trans, - FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), - (iwl_get_dma_hi_addr(phy_addr) - << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt); - - iwl_write_direct32(trans, - FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL), - 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM | - 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX | - FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID); - - iwl_write_direct32(trans, - FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL), - FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | - FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE | - FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD); - - ret = wait_event_timeout(trans_pcie->ucode_write_waitq, - trans_pcie->ucode_write_complete, 5 * HZ); - if (!ret) { - IWL_ERR(trans, "Failed to load firmware chunk!\n"); - return -ETIMEDOUT; - } - - return 0; -} - -static int iwl_pcie_load_section(struct iwl_trans *trans, u8 section_num, - const struct fw_desc *section) -{ - u8 *v_addr; - dma_addr_t p_addr; - u32 offset; - int ret = 0; - - IWL_DEBUG_FW(trans, "[%d] uCode section being loaded...\n", - section_num); - - v_addr = dma_alloc_coherent(trans->dev, PAGE_SIZE, &p_addr, GFP_KERNEL); - if (!v_addr) - return -ENOMEM; - - for (offset = 0; offset < section->len; offset += PAGE_SIZE) { - u32 copy_size; - - copy_size = min_t(u32, PAGE_SIZE, section->len - offset); - - memcpy(v_addr, (u8 *)section->data + offset, copy_size); - ret = iwl_pcie_load_firmware_chunk(trans, - section->offset + offset, - p_addr, copy_size); - if (ret) { - IWL_ERR(trans, - "Could not load the [%d] uCode section\n", - section_num); - break; - } - } - - dma_free_coherent(trans->dev, PAGE_SIZE, v_addr, p_addr); - return ret; -} - -static int iwl_pcie_load_given_ucode(struct iwl_trans *trans, - const struct fw_img *image) -{ - int i, ret = 0; - - for (i = 0; i < IWL_UCODE_SECTION_MAX; i++) { - if (!image->sec[i].data) - break; - - ret = iwl_pcie_load_section(trans, i, &image->sec[i]); - if (ret) - return ret; - } - - /* Remove all resets to allow NIC to operate */ - iwl_write32(trans, CSR_RESET, 0); - - return 0; -} - -static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, - const struct fw_img *fw, bool run_in_rfkill) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - int ret; - bool hw_rfkill; - - /* This may fail if AMT took ownership of the device */ - if (iwl_pcie_prepare_card_hw(trans)) { - IWL_WARN(trans, "Exit HW not ready\n"); - return -EIO; - } - - clear_bit(STATUS_FW_ERROR, &trans_pcie->status); - - iwl_enable_rfkill_int(trans); - - /* If platform's RF_KILL switch is NOT set to KILL */ - hw_rfkill = iwl_is_rfkill_set(trans); - if (hw_rfkill) - set_bit(STATUS_RFKILL, &trans_pcie->status); - else - clear_bit(STATUS_RFKILL, &trans_pcie->status); - iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); - if (hw_rfkill && !run_in_rfkill) - return -ERFKILL; - - iwl_write32(trans, CSR_INT, 0xFFFFFFFF); - - ret = iwl_pcie_nic_init(trans); - if (ret) { - IWL_ERR(trans, "Unable to init nic\n"); - return ret; - } - - /* make sure rfkill handshake bits are cleared */ - iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, - CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); - - /* clear (again), then enable host interrupts */ - iwl_write32(trans, CSR_INT, 0xFFFFFFFF); - iwl_enable_interrupts(trans); - - /* really make sure rfkill handshake bits are cleared */ - iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); - - /* Load the given image to the HW */ - return iwl_pcie_load_given_ucode(trans, fw); -} - -static void iwl_trans_pcie_fw_alive(struct iwl_trans *trans, u32 scd_addr) -{ - iwl_pcie_reset_ict(trans); - iwl_pcie_tx_start(trans, scd_addr); -} - -static void iwl_trans_pcie_stop_device(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - unsigned long flags; - - /* tell the device to stop sending interrupts */ - spin_lock_irqsave(&trans_pcie->irq_lock, flags); - iwl_disable_interrupts(trans); - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); - - /* device going down, Stop using ICT table */ - iwl_pcie_disable_ict(trans); - - /* - * If a HW restart happens during firmware loading, - * then the firmware loading might call this function - * and later it might be called again due to the - * restart. So don't process again if the device is - * already dead. - */ - if (test_bit(STATUS_DEVICE_ENABLED, &trans_pcie->status)) { - iwl_pcie_tx_stop(trans); - iwl_pcie_rx_stop(trans); - - /* Power-down device's busmaster DMA clocks */ - iwl_write_prph(trans, APMG_CLK_DIS_REG, - APMG_CLK_VAL_DMA_CLK_RQT); - udelay(5); - } - - /* Make sure (redundant) we've released our request to stay awake */ - iwl_clear_bit(trans, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - - /* Stop the device, and put it in low power state */ - iwl_pcie_apm_stop(trans); - - /* Upon stop, the APM issues an interrupt if HW RF kill is set. - * Clean again the interrupt here - */ - spin_lock_irqsave(&trans_pcie->irq_lock, flags); - iwl_disable_interrupts(trans); - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); - - iwl_enable_rfkill_int(trans); - - /* stop and reset the on-board processor */ - iwl_write32(trans, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET); - - /* clear all status bits */ - clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); - clear_bit(STATUS_INT_ENABLED, &trans_pcie->status); - clear_bit(STATUS_DEVICE_ENABLED, &trans_pcie->status); - clear_bit(STATUS_TPOWER_PMI, &trans_pcie->status); - clear_bit(STATUS_RFKILL, &trans_pcie->status); -} - -static void iwl_trans_pcie_d3_suspend(struct iwl_trans *trans) -{ - /* let the ucode operate on its own */ - iwl_write32(trans, CSR_UCODE_DRV_GP1_SET, - CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE); - - iwl_disable_interrupts(trans); - iwl_pcie_disable_ict(trans); - - iwl_clear_bit(trans, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - iwl_clear_bit(trans, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_INIT_DONE); - - /* - * reset TX queues -- some of their registers reset during S3 - * so if we don't reset everything here the D3 image would try - * to execute some invalid memory upon resume - */ - iwl_trans_pcie_tx_reset(trans); - - iwl_pcie_set_pwr(trans, true); -} - -static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans, - enum iwl_d3_status *status) -{ - u32 val; - int ret; - - iwl_pcie_set_pwr(trans, false); - - val = iwl_read32(trans, CSR_RESET); - if (val & CSR_RESET_REG_FLAG_NEVO_RESET) { - *status = IWL_D3_STATUS_RESET; - return 0; - } - - /* - * Also enables interrupts - none will happen as the device doesn't - * know we're waking it up, only when the opmode actually tells it - * after this call. - */ - iwl_pcie_reset_ict(trans); - - iwl_set_bit(trans, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - iwl_set_bit(trans, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); - - ret = iwl_poll_bit(trans, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, - CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, - 25000); - if (ret) { - IWL_ERR(trans, "Failed to resume the device (mac ready)\n"); - return ret; - } - - iwl_trans_pcie_tx_reset(trans); - - ret = iwl_pcie_rx_init(trans); - if (ret) { - IWL_ERR(trans, "Failed to resume the device (RX reset)\n"); - return ret; - } - - iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, - CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE); - - *status = IWL_D3_STATUS_ALIVE; - return 0; -} - -static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - bool hw_rfkill; - int err; - - err = iwl_pcie_prepare_card_hw(trans); - if (err) { - IWL_ERR(trans, "Error while preparing HW: %d\n", err); - return err; - } - - iwl_pcie_apm_init(trans); - - /* From now on, the op_mode will be kept updated about RF kill state */ - iwl_enable_rfkill_int(trans); - - hw_rfkill = iwl_is_rfkill_set(trans); - if (hw_rfkill) - set_bit(STATUS_RFKILL, &trans_pcie->status); - else - clear_bit(STATUS_RFKILL, &trans_pcie->status); - iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); - - return 0; -} - -static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans, - bool op_mode_leaving) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - bool hw_rfkill; - unsigned long flags; - - spin_lock_irqsave(&trans_pcie->irq_lock, flags); - iwl_disable_interrupts(trans); - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); - - iwl_pcie_apm_stop(trans); - - spin_lock_irqsave(&trans_pcie->irq_lock, flags); - iwl_disable_interrupts(trans); - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); - - iwl_pcie_disable_ict(trans); - - if (!op_mode_leaving) { - /* - * Even if we stop the HW, we still want the RF kill - * interrupt - */ - iwl_enable_rfkill_int(trans); - - /* - * Check again since the RF kill state may have changed while - * all the interrupts were disabled, in this case we couldn't - * receive the RF kill interrupt and update the state in the - * op_mode. - */ - hw_rfkill = iwl_is_rfkill_set(trans); - if (hw_rfkill) - set_bit(STATUS_RFKILL, &trans_pcie->status); - else - clear_bit(STATUS_RFKILL, &trans_pcie->status); - iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); - } -} - -static void iwl_trans_pcie_write8(struct iwl_trans *trans, u32 ofs, u8 val) -{ - writeb(val, IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs); -} - -static void iwl_trans_pcie_write32(struct iwl_trans *trans, u32 ofs, u32 val) -{ - writel(val, IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs); -} - -static u32 iwl_trans_pcie_read32(struct iwl_trans *trans, u32 ofs) -{ - return readl(IWL_TRANS_GET_PCIE_TRANS(trans)->hw_base + ofs); -} - -static u32 iwl_trans_pcie_read_prph(struct iwl_trans *trans, u32 reg) -{ - iwl_trans_pcie_write32(trans, HBUS_TARG_PRPH_RADDR, - ((reg & 0x000FFFFF) | (3 << 24))); - return iwl_trans_pcie_read32(trans, HBUS_TARG_PRPH_RDAT); -} - -static void iwl_trans_pcie_write_prph(struct iwl_trans *trans, u32 addr, - u32 val) -{ - iwl_trans_pcie_write32(trans, HBUS_TARG_PRPH_WADDR, - ((addr & 0x000FFFFF) | (3 << 24))); - iwl_trans_pcie_write32(trans, HBUS_TARG_PRPH_WDAT, val); -} - -static void iwl_trans_pcie_configure(struct iwl_trans *trans, - const struct iwl_trans_config *trans_cfg) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - trans_pcie->cmd_queue = trans_cfg->cmd_queue; - trans_pcie->cmd_fifo = trans_cfg->cmd_fifo; - if (WARN_ON(trans_cfg->n_no_reclaim_cmds > MAX_NO_RECLAIM_CMDS)) - trans_pcie->n_no_reclaim_cmds = 0; - else - trans_pcie->n_no_reclaim_cmds = trans_cfg->n_no_reclaim_cmds; - if (trans_pcie->n_no_reclaim_cmds) - memcpy(trans_pcie->no_reclaim_cmds, trans_cfg->no_reclaim_cmds, - trans_pcie->n_no_reclaim_cmds * sizeof(u8)); - - trans_pcie->rx_buf_size_8k = trans_cfg->rx_buf_size_8k; - if (trans_pcie->rx_buf_size_8k) - trans_pcie->rx_page_order = get_order(8 * 1024); - else - trans_pcie->rx_page_order = get_order(4 * 1024); - - trans_pcie->wd_timeout = - msecs_to_jiffies(trans_cfg->queue_watchdog_timeout); - - trans_pcie->command_names = trans_cfg->command_names; - trans_pcie->bc_table_dword = trans_cfg->bc_table_dword; -} - -void iwl_trans_pcie_free(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - synchronize_irq(trans_pcie->pci_dev->irq); - - iwl_pcie_tx_free(trans); - iwl_pcie_rx_free(trans); - - free_irq(trans_pcie->pci_dev->irq, trans); - iwl_pcie_free_ict(trans); - - pci_disable_msi(trans_pcie->pci_dev); - iounmap(trans_pcie->hw_base); - pci_release_regions(trans_pcie->pci_dev); - pci_disable_device(trans_pcie->pci_dev); - kmem_cache_destroy(trans->dev_cmd_pool); - - kfree(trans); -} - -static void iwl_trans_pcie_set_pmi(struct iwl_trans *trans, bool state) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - if (state) - set_bit(STATUS_TPOWER_PMI, &trans_pcie->status); - else - clear_bit(STATUS_TPOWER_PMI, &trans_pcie->status); -} - -#ifdef CONFIG_PM_SLEEP -static int iwl_trans_pcie_suspend(struct iwl_trans *trans) -{ - return 0; -} - -static int iwl_trans_pcie_resume(struct iwl_trans *trans) -{ - bool hw_rfkill; - - iwl_enable_rfkill_int(trans); - - hw_rfkill = iwl_is_rfkill_set(trans); - iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); - - return 0; -} -#endif /* CONFIG_PM_SLEEP */ - -static bool iwl_trans_pcie_grab_nic_access(struct iwl_trans *trans, bool silent, - unsigned long *flags) -{ - int ret; - struct iwl_trans_pcie *pcie_trans = IWL_TRANS_GET_PCIE_TRANS(trans); - spin_lock_irqsave(&pcie_trans->reg_lock, *flags); - - /* this bit wakes up the NIC */ - __iwl_trans_pcie_set_bit(trans, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - - /* - * These bits say the device is running, and should keep running for - * at least a short while (at least as long as MAC_ACCESS_REQ stays 1), - * but they do not indicate that embedded SRAM is restored yet; - * 3945 and 4965 have volatile SRAM, and must save/restore contents - * to/from host DRAM when sleeping/waking for power-saving. - * Each direction takes approximately 1/4 millisecond; with this - * overhead, it's a good idea to grab and hold MAC_ACCESS_REQUEST if a - * series of register accesses are expected (e.g. reading Event Log), - * to keep device from sleeping. - * - * CSR_UCODE_DRV_GP1 register bit MAC_SLEEP == 0 indicates that - * SRAM is okay/restored. We don't check that here because this call - * is just for hardware register access; but GP1 MAC_SLEEP check is a - * good idea before accessing 3945/4965 SRAM (e.g. reading Event Log). - * - * 5000 series and later (including 1000 series) have non-volatile SRAM, - * and do not save/restore SRAM when power cycling. - */ - ret = iwl_poll_bit(trans, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, - (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | - CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 15000); - if (unlikely(ret < 0)) { - iwl_write32(trans, CSR_RESET, CSR_RESET_REG_FLAG_FORCE_NMI); - if (!silent) { - u32 val = iwl_read32(trans, CSR_GP_CNTRL); - WARN_ONCE(1, - "Timeout waiting for hardware access (CSR_GP_CNTRL 0x%08x)\n", - val); - spin_unlock_irqrestore(&pcie_trans->reg_lock, *flags); - return false; - } - } - - /* - * Fool sparse by faking we release the lock - sparse will - * track nic_access anyway. - */ - __release(&pcie_trans->reg_lock); - return true; -} - -static void iwl_trans_pcie_release_nic_access(struct iwl_trans *trans, - unsigned long *flags) -{ - struct iwl_trans_pcie *pcie_trans = IWL_TRANS_GET_PCIE_TRANS(trans); - - lockdep_assert_held(&pcie_trans->reg_lock); - - /* - * Fool sparse by faking we acquiring the lock - sparse will - * track nic_access anyway. - */ - __acquire(&pcie_trans->reg_lock); - - __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - /* - * Above we read the CSR_GP_CNTRL register, which will flush - * any previous writes, but we need the write that clears the - * MAC_ACCESS_REQ bit to be performed before any other writes - * scheduled on different CPUs (after we drop reg_lock). - */ - mmiowb(); - spin_unlock_irqrestore(&pcie_trans->reg_lock, *flags); -} - -static int iwl_trans_pcie_read_mem(struct iwl_trans *trans, u32 addr, - void *buf, int dwords) -{ - unsigned long flags; - int offs, ret = 0; - u32 *vals = buf; - - if (iwl_trans_grab_nic_access(trans, false, &flags)) { - iwl_write32(trans, HBUS_TARG_MEM_RADDR, addr); - for (offs = 0; offs < dwords; offs++) - vals[offs] = iwl_read32(trans, HBUS_TARG_MEM_RDAT); - iwl_trans_release_nic_access(trans, &flags); - } else { - ret = -EBUSY; - } - return ret; -} - -static int iwl_trans_pcie_write_mem(struct iwl_trans *trans, u32 addr, - void *buf, int dwords) -{ - unsigned long flags; - int offs, ret = 0; - u32 *vals = buf; - - if (iwl_trans_grab_nic_access(trans, false, &flags)) { - iwl_write32(trans, HBUS_TARG_MEM_WADDR, addr); - for (offs = 0; offs < dwords; offs++) - iwl_write32(trans, HBUS_TARG_MEM_WDAT, - vals ? vals[offs] : 0); - iwl_trans_release_nic_access(trans, &flags); - } else { - ret = -EBUSY; - } - return ret; -} - -#define IWL_FLUSH_WAIT_MS 2000 - -static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_txq *txq; - struct iwl_queue *q; - int cnt; - unsigned long now = jiffies; - u32 scd_sram_addr; - u8 buf[16]; - int ret = 0; - - /* waiting for all the tx frames complete might take a while */ - for (cnt = 0; cnt < trans->cfg->base_params->num_of_queues; cnt++) { - if (cnt == trans_pcie->cmd_queue) - continue; - txq = &trans_pcie->txq[cnt]; - q = &txq->q; - while (q->read_ptr != q->write_ptr && !time_after(jiffies, - now + msecs_to_jiffies(IWL_FLUSH_WAIT_MS))) - msleep(1); - - if (q->read_ptr != q->write_ptr) { - IWL_ERR(trans, - "fail to flush all tx fifo queues Q %d\n", cnt); - ret = -ETIMEDOUT; - break; - } - } - - if (!ret) - return 0; - - IWL_ERR(trans, "Current SW read_ptr %d write_ptr %d\n", - txq->q.read_ptr, txq->q.write_ptr); - - scd_sram_addr = trans_pcie->scd_base_addr + - SCD_TX_STTS_QUEUE_OFFSET(txq->q.id); - iwl_trans_read_mem_bytes(trans, scd_sram_addr, buf, sizeof(buf)); - - iwl_print_hex_error(trans, buf, sizeof(buf)); - - for (cnt = 0; cnt < FH_TCSR_CHNL_NUM; cnt++) - IWL_ERR(trans, "FH TRBs(%d) = 0x%08x\n", cnt, - iwl_read_direct32(trans, FH_TX_TRB_REG(cnt))); - - for (cnt = 0; cnt < trans->cfg->base_params->num_of_queues; cnt++) { - u32 status = iwl_read_prph(trans, SCD_QUEUE_STATUS_BITS(cnt)); - u8 fifo = (status >> SCD_QUEUE_STTS_REG_POS_TXF) & 0x7; - bool active = !!(status & BIT(SCD_QUEUE_STTS_REG_POS_ACTIVE)); - u32 tbl_dw = - iwl_trans_read_mem32(trans, trans_pcie->scd_base_addr + - SCD_TRANS_TBL_OFFSET_QUEUE(cnt)); - - if (cnt & 0x1) - tbl_dw = (tbl_dw & 0xFFFF0000) >> 16; - else - tbl_dw = tbl_dw & 0x0000FFFF; - - IWL_ERR(trans, - "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", - cnt, active ? "" : "in", fifo, tbl_dw, - iwl_read_prph(trans, - SCD_QUEUE_RDPTR(cnt)) & (txq->q.n_bd - 1), - iwl_read_prph(trans, SCD_QUEUE_WRPTR(cnt))); - } - - return ret; -} - -static void iwl_trans_pcie_set_bits_mask(struct iwl_trans *trans, u32 reg, - u32 mask, u32 value) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - unsigned long flags; - - spin_lock_irqsave(&trans_pcie->reg_lock, flags); - __iwl_trans_pcie_set_bits_mask(trans, reg, mask, value); - spin_unlock_irqrestore(&trans_pcie->reg_lock, flags); -} - -static const char *get_fh_string(int cmd) -{ -#define IWL_CMD(x) case x: return #x - switch (cmd) { - IWL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG); - IWL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG); - IWL_CMD(FH_RSCSR_CHNL0_WPTR); - IWL_CMD(FH_MEM_RCSR_CHNL0_CONFIG_REG); - IWL_CMD(FH_MEM_RSSR_SHARED_CTRL_REG); - IWL_CMD(FH_MEM_RSSR_RX_STATUS_REG); - IWL_CMD(FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV); - IWL_CMD(FH_TSSR_TX_STATUS_REG); - IWL_CMD(FH_TSSR_TX_ERROR_REG); - default: - return "UNKNOWN"; - } -#undef IWL_CMD -} - -int iwl_pcie_dump_fh(struct iwl_trans *trans, char **buf) -{ - int i; - static const u32 fh_tbl[] = { - FH_RSCSR_CHNL0_STTS_WPTR_REG, - FH_RSCSR_CHNL0_RBDCB_BASE_REG, - FH_RSCSR_CHNL0_WPTR, - FH_MEM_RCSR_CHNL0_CONFIG_REG, - FH_MEM_RSSR_SHARED_CTRL_REG, - FH_MEM_RSSR_RX_STATUS_REG, - FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV, - FH_TSSR_TX_STATUS_REG, - FH_TSSR_TX_ERROR_REG - }; - -#ifdef CONFIG_IWLWIFI_DEBUGFS - if (buf) { - int pos = 0; - size_t bufsz = ARRAY_SIZE(fh_tbl) * 48 + 40; - - *buf = kmalloc(bufsz, GFP_KERNEL); - if (!*buf) - return -ENOMEM; - - pos += scnprintf(*buf + pos, bufsz - pos, - "FH register values:\n"); - - for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) - pos += scnprintf(*buf + pos, bufsz - pos, - " %34s: 0X%08x\n", - get_fh_string(fh_tbl[i]), - iwl_read_direct32(trans, fh_tbl[i])); - - return pos; - } -#endif - - IWL_ERR(trans, "FH register values:\n"); - for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) - IWL_ERR(trans, " %34s: 0X%08x\n", - get_fh_string(fh_tbl[i]), - iwl_read_direct32(trans, fh_tbl[i])); - - return 0; -} - -static const char *get_csr_string(int cmd) -{ -#define IWL_CMD(x) case x: return #x - switch (cmd) { - IWL_CMD(CSR_HW_IF_CONFIG_REG); - IWL_CMD(CSR_INT_COALESCING); - IWL_CMD(CSR_INT); - IWL_CMD(CSR_INT_MASK); - IWL_CMD(CSR_FH_INT_STATUS); - IWL_CMD(CSR_GPIO_IN); - IWL_CMD(CSR_RESET); - IWL_CMD(CSR_GP_CNTRL); - IWL_CMD(CSR_HW_REV); - IWL_CMD(CSR_EEPROM_REG); - IWL_CMD(CSR_EEPROM_GP); - IWL_CMD(CSR_OTP_GP_REG); - IWL_CMD(CSR_GIO_REG); - IWL_CMD(CSR_GP_UCODE_REG); - IWL_CMD(CSR_GP_DRIVER_REG); - IWL_CMD(CSR_UCODE_DRV_GP1); - IWL_CMD(CSR_UCODE_DRV_GP2); - IWL_CMD(CSR_LED_REG); - IWL_CMD(CSR_DRAM_INT_TBL_REG); - IWL_CMD(CSR_GIO_CHICKEN_BITS); - IWL_CMD(CSR_ANA_PLL_CFG); - IWL_CMD(CSR_HW_REV_WA_REG); - IWL_CMD(CSR_DBG_HPET_MEM_REG); - default: - return "UNKNOWN"; - } -#undef IWL_CMD -} - -void iwl_pcie_dump_csr(struct iwl_trans *trans) -{ - int i; - static const u32 csr_tbl[] = { - CSR_HW_IF_CONFIG_REG, - CSR_INT_COALESCING, - CSR_INT, - CSR_INT_MASK, - CSR_FH_INT_STATUS, - CSR_GPIO_IN, - CSR_RESET, - CSR_GP_CNTRL, - CSR_HW_REV, - CSR_EEPROM_REG, - CSR_EEPROM_GP, - CSR_OTP_GP_REG, - CSR_GIO_REG, - CSR_GP_UCODE_REG, - CSR_GP_DRIVER_REG, - CSR_UCODE_DRV_GP1, - CSR_UCODE_DRV_GP2, - CSR_LED_REG, - CSR_DRAM_INT_TBL_REG, - CSR_GIO_CHICKEN_BITS, - CSR_ANA_PLL_CFG, - CSR_HW_REV_WA_REG, - CSR_DBG_HPET_MEM_REG - }; - IWL_ERR(trans, "CSR values:\n"); - IWL_ERR(trans, "(2nd byte of CSR_INT_COALESCING is " - "CSR_INT_PERIODIC_REG)\n"); - for (i = 0; i < ARRAY_SIZE(csr_tbl); i++) { - IWL_ERR(trans, " %25s: 0X%08x\n", - get_csr_string(csr_tbl[i]), - iwl_read32(trans, csr_tbl[i])); - } -} - -#ifdef CONFIG_IWLWIFI_DEBUGFS -/* create and remove of files */ -#define DEBUGFS_ADD_FILE(name, parent, mode) do { \ - if (!debugfs_create_file(#name, mode, parent, trans, \ - &iwl_dbgfs_##name##_ops)) \ - goto err; \ -} while (0) - -/* file operation */ -#define DEBUGFS_READ_FUNC(name) \ -static ssize_t iwl_dbgfs_##name##_read(struct file *file, \ - char __user *user_buf, \ - size_t count, loff_t *ppos); - -#define DEBUGFS_WRITE_FUNC(name) \ -static ssize_t iwl_dbgfs_##name##_write(struct file *file, \ - const char __user *user_buf, \ - size_t count, loff_t *ppos); - -#define DEBUGFS_READ_FILE_OPS(name) \ - DEBUGFS_READ_FUNC(name); \ -static const struct file_operations iwl_dbgfs_##name##_ops = { \ - .read = iwl_dbgfs_##name##_read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -#define DEBUGFS_WRITE_FILE_OPS(name) \ - DEBUGFS_WRITE_FUNC(name); \ -static const struct file_operations iwl_dbgfs_##name##_ops = { \ - .write = iwl_dbgfs_##name##_write, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -#define DEBUGFS_READ_WRITE_FILE_OPS(name) \ - DEBUGFS_READ_FUNC(name); \ - DEBUGFS_WRITE_FUNC(name); \ -static const struct file_operations iwl_dbgfs_##name##_ops = { \ - .write = iwl_dbgfs_##name##_write, \ - .read = iwl_dbgfs_##name##_read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -static ssize_t iwl_dbgfs_tx_queue_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_trans *trans = file->private_data; - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_txq *txq; - struct iwl_queue *q; - char *buf; - int pos = 0; - int cnt; - int ret; - size_t bufsz; - - bufsz = sizeof(char) * 64 * trans->cfg->base_params->num_of_queues; - - if (!trans_pcie->txq) - return -EAGAIN; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - for (cnt = 0; cnt < trans->cfg->base_params->num_of_queues; cnt++) { - txq = &trans_pcie->txq[cnt]; - q = &txq->q; - pos += scnprintf(buf + pos, bufsz - pos, - "hwq %.2d: read=%u write=%u use=%d stop=%d\n", - cnt, q->read_ptr, q->write_ptr, - !!test_bit(cnt, trans_pcie->queue_used), - !!test_bit(cnt, trans_pcie->queue_stopped)); - } - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t iwl_dbgfs_rx_queue_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_trans *trans = file->private_data; - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_rxq *rxq = &trans_pcie->rxq; - char buf[256]; - int pos = 0; - const size_t bufsz = sizeof(buf); - - pos += scnprintf(buf + pos, bufsz - pos, "read: %u\n", - rxq->read); - pos += scnprintf(buf + pos, bufsz - pos, "write: %u\n", - rxq->write); - pos += scnprintf(buf + pos, bufsz - pos, "free_count: %u\n", - rxq->free_count); - if (rxq->rb_stts) { - pos += scnprintf(buf + pos, bufsz - pos, "closed_rb_num: %u\n", - le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF); - } else { - pos += scnprintf(buf + pos, bufsz - pos, - "closed_rb_num: Not Allocated\n"); - } - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); -} - -static ssize_t iwl_dbgfs_interrupt_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_trans *trans = file->private_data; - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct isr_statistics *isr_stats = &trans_pcie->isr_stats; - - int pos = 0; - char *buf; - int bufsz = 24 * 64; /* 24 items * 64 char per item */ - ssize_t ret; - - buf = kzalloc(bufsz, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - pos += scnprintf(buf + pos, bufsz - pos, - "Interrupt Statistics Report:\n"); - - pos += scnprintf(buf + pos, bufsz - pos, "HW Error:\t\t\t %u\n", - isr_stats->hw); - pos += scnprintf(buf + pos, bufsz - pos, "SW Error:\t\t\t %u\n", - isr_stats->sw); - if (isr_stats->sw || isr_stats->hw) { - pos += scnprintf(buf + pos, bufsz - pos, - "\tLast Restarting Code: 0x%X\n", - isr_stats->err_code); - } -#ifdef CONFIG_IWLWIFI_DEBUG - pos += scnprintf(buf + pos, bufsz - pos, "Frame transmitted:\t\t %u\n", - isr_stats->sch); - pos += scnprintf(buf + pos, bufsz - pos, "Alive interrupt:\t\t %u\n", - isr_stats->alive); -#endif - pos += scnprintf(buf + pos, bufsz - pos, - "HW RF KILL switch toggled:\t %u\n", isr_stats->rfkill); - - pos += scnprintf(buf + pos, bufsz - pos, "CT KILL:\t\t\t %u\n", - isr_stats->ctkill); - - pos += scnprintf(buf + pos, bufsz - pos, "Wakeup Interrupt:\t\t %u\n", - isr_stats->wakeup); - - pos += scnprintf(buf + pos, bufsz - pos, - "Rx command responses:\t\t %u\n", isr_stats->rx); - - pos += scnprintf(buf + pos, bufsz - pos, "Tx/FH interrupt:\t\t %u\n", - isr_stats->tx); - - pos += scnprintf(buf + pos, bufsz - pos, "Unexpected INTA:\t\t %u\n", - isr_stats->unhandled); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); - kfree(buf); - return ret; -} - -static ssize_t iwl_dbgfs_interrupt_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_trans *trans = file->private_data; - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct isr_statistics *isr_stats = &trans_pcie->isr_stats; - - char buf[8]; - int buf_size; - u32 reset_flag; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%x", &reset_flag) != 1) - return -EFAULT; - if (reset_flag == 0) - memset(isr_stats, 0, sizeof(*isr_stats)); - - return count; -} - -static ssize_t iwl_dbgfs_csr_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_trans *trans = file->private_data; - char buf[8]; - int buf_size; - int csr; - - memset(buf, 0, sizeof(buf)); - buf_size = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - if (sscanf(buf, "%d", &csr) != 1) - return -EFAULT; - - iwl_pcie_dump_csr(trans); - - return count; -} - -static ssize_t iwl_dbgfs_fh_reg_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct iwl_trans *trans = file->private_data; - char *buf = NULL; - int pos = 0; - ssize_t ret = -EFAULT; - - ret = pos = iwl_pcie_dump_fh(trans, &buf); - if (buf) { - ret = simple_read_from_buffer(user_buf, - count, ppos, buf, pos); - kfree(buf); - } - - return ret; -} - -DEBUGFS_READ_WRITE_FILE_OPS(interrupt); -DEBUGFS_READ_FILE_OPS(fh_reg); -DEBUGFS_READ_FILE_OPS(rx_queue); -DEBUGFS_READ_FILE_OPS(tx_queue); -DEBUGFS_WRITE_FILE_OPS(csr); - -/* - * Create the debugfs files and directories - * - */ -static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, - struct dentry *dir) -{ - DEBUGFS_ADD_FILE(rx_queue, dir, S_IRUSR); - DEBUGFS_ADD_FILE(tx_queue, dir, S_IRUSR); - DEBUGFS_ADD_FILE(interrupt, dir, S_IWUSR | S_IRUSR); - DEBUGFS_ADD_FILE(csr, dir, S_IWUSR); - DEBUGFS_ADD_FILE(fh_reg, dir, S_IRUSR); - return 0; - -err: - IWL_ERR(trans, "failed to create the trans debugfs entry\n"); - return -ENOMEM; -} -#else -static int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans, - struct dentry *dir) -{ - return 0; -} -#endif /*CONFIG_IWLWIFI_DEBUGFS */ - -static const struct iwl_trans_ops trans_ops_pcie = { - .start_hw = iwl_trans_pcie_start_hw, - .stop_hw = iwl_trans_pcie_stop_hw, - .fw_alive = iwl_trans_pcie_fw_alive, - .start_fw = iwl_trans_pcie_start_fw, - .stop_device = iwl_trans_pcie_stop_device, - - .d3_suspend = iwl_trans_pcie_d3_suspend, - .d3_resume = iwl_trans_pcie_d3_resume, - - .send_cmd = iwl_trans_pcie_send_hcmd, - - .tx = iwl_trans_pcie_tx, - .reclaim = iwl_trans_pcie_reclaim, - - .txq_disable = iwl_trans_pcie_txq_disable, - .txq_enable = iwl_trans_pcie_txq_enable, - - .dbgfs_register = iwl_trans_pcie_dbgfs_register, - - .wait_tx_queue_empty = iwl_trans_pcie_wait_txq_empty, - -#ifdef CONFIG_PM_SLEEP - .suspend = iwl_trans_pcie_suspend, - .resume = iwl_trans_pcie_resume, -#endif - .write8 = iwl_trans_pcie_write8, - .write32 = iwl_trans_pcie_write32, - .read32 = iwl_trans_pcie_read32, - .read_prph = iwl_trans_pcie_read_prph, - .write_prph = iwl_trans_pcie_write_prph, - .read_mem = iwl_trans_pcie_read_mem, - .write_mem = iwl_trans_pcie_write_mem, - .configure = iwl_trans_pcie_configure, - .set_pmi = iwl_trans_pcie_set_pmi, - .grab_nic_access = iwl_trans_pcie_grab_nic_access, - .release_nic_access = iwl_trans_pcie_release_nic_access, - .set_bits_mask = iwl_trans_pcie_set_bits_mask, -}; - -struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, - const struct pci_device_id *ent, - const struct iwl_cfg *cfg) -{ - struct iwl_trans_pcie *trans_pcie; - struct iwl_trans *trans; - u16 pci_cmd; - int err; - - trans = kzalloc(sizeof(struct iwl_trans) + - sizeof(struct iwl_trans_pcie), GFP_KERNEL); - - if (!trans) - return NULL; - - trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - trans->ops = &trans_ops_pcie; - trans->cfg = cfg; - trans_lockdep_init(trans); - trans_pcie->trans = trans; - spin_lock_init(&trans_pcie->irq_lock); - spin_lock_init(&trans_pcie->reg_lock); - init_waitqueue_head(&trans_pcie->ucode_write_waitq); - - if (pci_enable_device(pdev)) { - err = -ENODEV; - goto out_no_pci; - } - - /* W/A - seems to solve weird behavior. We need to remove this if we - * don't want to stay in L1 all the time. This wastes a lot of power */ - pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 | - PCIE_LINK_STATE_CLKPM); - - pci_set_master(pdev); - - err = pci_set_dma_mask(pdev, DMA_BIT_MASK(36)); - if (!err) - err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(36)); - if (err) { - err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); - if (!err) - err = pci_set_consistent_dma_mask(pdev, - DMA_BIT_MASK(32)); - /* both attempts failed: */ - if (err) { - dev_err(&pdev->dev, "No suitable DMA available\n"); - goto out_pci_disable_device; - } - } - - err = pci_request_regions(pdev, DRV_NAME); - if (err) { - dev_err(&pdev->dev, "pci_request_regions failed\n"); - goto out_pci_disable_device; - } - - trans_pcie->hw_base = pci_ioremap_bar(pdev, 0); - if (!trans_pcie->hw_base) { - dev_err(&pdev->dev, "pci_ioremap_bar failed\n"); - err = -ENODEV; - goto out_pci_release_regions; - } - - /* We disable the RETRY_TIMEOUT register (0x41) to keep - * PCI Tx retries from interfering with C3 CPU state */ - pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); - - err = pci_enable_msi(pdev); - if (err) { - dev_err(&pdev->dev, "pci_enable_msi failed(0X%x)\n", err); - /* enable rfkill interrupt: hw bug w/a */ - pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd); - if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { - pci_cmd &= ~PCI_COMMAND_INTX_DISABLE; - pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); - } - } - - trans->dev = &pdev->dev; - trans_pcie->pci_dev = pdev; - trans->hw_rev = iwl_read32(trans, CSR_HW_REV); - trans->hw_id = (pdev->device << 16) + pdev->subsystem_device; - snprintf(trans->hw_id_str, sizeof(trans->hw_id_str), - "PCI ID: 0x%04X:0x%04X", pdev->device, pdev->subsystem_device); - - /* Initialize the wait queue for commands */ - init_waitqueue_head(&trans_pcie->wait_command_queue); - - snprintf(trans->dev_cmd_pool_name, sizeof(trans->dev_cmd_pool_name), - "iwl_cmd_pool:%s", dev_name(trans->dev)); - - trans->dev_cmd_headroom = 0; - trans->dev_cmd_pool = - kmem_cache_create(trans->dev_cmd_pool_name, - sizeof(struct iwl_device_cmd) - + trans->dev_cmd_headroom, - sizeof(void *), - SLAB_HWCACHE_ALIGN, - NULL); - - if (!trans->dev_cmd_pool) - goto out_pci_disable_msi; - - trans_pcie->inta_mask = CSR_INI_SET_MASK; - - if (iwl_pcie_alloc_ict(trans)) - goto out_free_cmd_pool; - - if (request_threaded_irq(pdev->irq, iwl_pcie_isr_ict, - iwl_pcie_irq_handler, - IRQF_SHARED, DRV_NAME, trans)) { - IWL_ERR(trans, "Error allocating IRQ %d\n", pdev->irq); - goto out_free_ict; - } - - return trans; - -out_free_ict: - iwl_pcie_free_ict(trans); -out_free_cmd_pool: - kmem_cache_destroy(trans->dev_cmd_pool); -out_pci_disable_msi: - pci_disable_msi(pdev); -out_pci_release_regions: - pci_release_regions(pdev); -out_pci_disable_device: - pci_disable_device(pdev); -out_no_pci: - kfree(trans); - return NULL; -} diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c deleted file mode 100644 index 48acfc620191..000000000000 --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ /dev/null @@ -1,1745 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2013 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portions of the ieee80211 subsystem header files. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ -#include -#include -#include - -#include "iwl-debug.h" -#include "iwl-csr.h" -#include "iwl-prph.h" -#include "iwl-io.h" -#include "iwl-op-mode.h" -#include "internal.h" -/* FIXME: need to abstract out TX command (once we know what it looks like) */ -#include "dvm/commands.h" - -#define IWL_TX_CRC_SIZE 4 -#define IWL_TX_DELIMITER_SIZE 4 - -/*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** - * DMA services - * - * Theory of operation - * - * A Tx or Rx queue resides in host DRAM, and is comprised of a circular buffer - * of buffer descriptors, each of which points to one or more data buffers for - * the device to read from or fill. Driver and device exchange status of each - * queue via "read" and "write" pointers. Driver keeps minimum of 2 empty - * entries in each circular buffer, to protect against confusing empty and full - * queue states. - * - * The device reads or writes the data in the queues via the device's several - * DMA/FIFO channels. Each queue is mapped to a single DMA channel. - * - * For Tx queue, there are low mark and high mark limits. If, after queuing - * the packet for Tx, free space become < low mark, Tx queue stopped. When - * reclaiming packets (on 'tx done IRQ), if free space become > high mark, - * Tx queue resumed. - * - ***************************************************/ -static int iwl_queue_space(const struct iwl_queue *q) -{ - int s = q->read_ptr - q->write_ptr; - - if (q->read_ptr > q->write_ptr) - s -= q->n_bd; - - if (s <= 0) - s += q->n_window; - /* keep some reserve to not confuse empty and full situations */ - s -= 2; - if (s < 0) - s = 0; - return s; -} - -/* - * iwl_queue_init - Initialize queue's high/low-water and read/write indexes - */ -static int iwl_queue_init(struct iwl_queue *q, int count, int slots_num, u32 id) -{ - q->n_bd = count; - q->n_window = slots_num; - q->id = id; - - /* count must be power-of-two size, otherwise iwl_queue_inc_wrap - * and iwl_queue_dec_wrap are broken. */ - if (WARN_ON(!is_power_of_2(count))) - return -EINVAL; - - /* slots_num must be power-of-two size, otherwise - * get_cmd_index is broken. */ - if (WARN_ON(!is_power_of_2(slots_num))) - return -EINVAL; - - q->low_mark = q->n_window / 4; - if (q->low_mark < 4) - q->low_mark = 4; - - q->high_mark = q->n_window / 8; - if (q->high_mark < 2) - q->high_mark = 2; - - q->write_ptr = 0; - q->read_ptr = 0; - - return 0; -} - -static int iwl_pcie_alloc_dma_ptr(struct iwl_trans *trans, - struct iwl_dma_ptr *ptr, size_t size) -{ - if (WARN_ON(ptr->addr)) - return -EINVAL; - - ptr->addr = dma_alloc_coherent(trans->dev, size, - &ptr->dma, GFP_KERNEL); - if (!ptr->addr) - return -ENOMEM; - ptr->size = size; - return 0; -} - -static void iwl_pcie_free_dma_ptr(struct iwl_trans *trans, - struct iwl_dma_ptr *ptr) -{ - if (unlikely(!ptr->addr)) - return; - - dma_free_coherent(trans->dev, ptr->size, ptr->addr, ptr->dma); - memset(ptr, 0, sizeof(*ptr)); -} - -static void iwl_pcie_txq_stuck_timer(unsigned long data) -{ - struct iwl_txq *txq = (void *)data; - struct iwl_queue *q = &txq->q; - struct iwl_trans_pcie *trans_pcie = txq->trans_pcie; - struct iwl_trans *trans = iwl_trans_pcie_get_trans(trans_pcie); - u32 scd_sram_addr = trans_pcie->scd_base_addr + - SCD_TX_STTS_QUEUE_OFFSET(txq->q.id); - u8 buf[16]; - int i; - - spin_lock(&txq->lock); - /* check if triggered erroneously */ - if (txq->q.read_ptr == txq->q.write_ptr) { - spin_unlock(&txq->lock); - return; - } - spin_unlock(&txq->lock); - - IWL_ERR(trans, "Queue %d stuck for %u ms.\n", txq->q.id, - jiffies_to_msecs(trans_pcie->wd_timeout)); - IWL_ERR(trans, "Current SW read_ptr %d write_ptr %d\n", - txq->q.read_ptr, txq->q.write_ptr); - - iwl_trans_read_mem_bytes(trans, scd_sram_addr, buf, sizeof(buf)); - - iwl_print_hex_error(trans, buf, sizeof(buf)); - - for (i = 0; i < FH_TCSR_CHNL_NUM; i++) - IWL_ERR(trans, "FH TRBs(%d) = 0x%08x\n", i, - iwl_read_direct32(trans, FH_TX_TRB_REG(i))); - - for (i = 0; i < trans->cfg->base_params->num_of_queues; i++) { - u32 status = iwl_read_prph(trans, SCD_QUEUE_STATUS_BITS(i)); - u8 fifo = (status >> SCD_QUEUE_STTS_REG_POS_TXF) & 0x7; - bool active = !!(status & BIT(SCD_QUEUE_STTS_REG_POS_ACTIVE)); - u32 tbl_dw = - iwl_trans_read_mem32(trans, - trans_pcie->scd_base_addr + - SCD_TRANS_TBL_OFFSET_QUEUE(i)); - - if (i & 0x1) - tbl_dw = (tbl_dw & 0xFFFF0000) >> 16; - else - tbl_dw = tbl_dw & 0x0000FFFF; - - IWL_ERR(trans, - "Q %d is %sactive and mapped to fifo %d ra_tid 0x%04x [%d,%d]\n", - i, active ? "" : "in", fifo, tbl_dw, - iwl_read_prph(trans, - SCD_QUEUE_RDPTR(i)) & (txq->q.n_bd - 1), - iwl_read_prph(trans, SCD_QUEUE_WRPTR(i))); - } - - for (i = q->read_ptr; i != q->write_ptr; - i = iwl_queue_inc_wrap(i, q->n_bd)) - IWL_ERR(trans, "scratch %d = 0x%08x\n", i, - le32_to_cpu(txq->scratchbufs[i].scratch)); - - iwl_op_mode_nic_error(trans->op_mode); -} - -/* - * iwl_pcie_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array - */ -static void iwl_pcie_txq_update_byte_cnt_tbl(struct iwl_trans *trans, - struct iwl_txq *txq, u16 byte_cnt) -{ - struct iwlagn_scd_bc_tbl *scd_bc_tbl; - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - int write_ptr = txq->q.write_ptr; - int txq_id = txq->q.id; - u8 sec_ctl = 0; - u8 sta_id = 0; - u16 len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; - __le16 bc_ent; - struct iwl_tx_cmd *tx_cmd = - (void *) txq->entries[txq->q.write_ptr].cmd->payload; - - scd_bc_tbl = trans_pcie->scd_bc_tbls.addr; - - WARN_ON(len > 0xFFF || write_ptr >= TFD_QUEUE_SIZE_MAX); - - sta_id = tx_cmd->sta_id; - sec_ctl = tx_cmd->sec_ctl; - - switch (sec_ctl & TX_CMD_SEC_MSK) { - case TX_CMD_SEC_CCM: - len += CCMP_MIC_LEN; - break; - case TX_CMD_SEC_TKIP: - len += TKIP_ICV_LEN; - break; - case TX_CMD_SEC_WEP: - len += WEP_IV_LEN + WEP_ICV_LEN; - break; - } - - if (trans_pcie->bc_table_dword) - len = DIV_ROUND_UP(len, 4); - - bc_ent = cpu_to_le16(len | (sta_id << 12)); - - scd_bc_tbl[txq_id].tfd_offset[write_ptr] = bc_ent; - - if (write_ptr < TFD_QUEUE_SIZE_BC_DUP) - scd_bc_tbl[txq_id]. - tfd_offset[TFD_QUEUE_SIZE_MAX + write_ptr] = bc_ent; -} - -static void iwl_pcie_txq_inval_byte_cnt_tbl(struct iwl_trans *trans, - struct iwl_txq *txq) -{ - struct iwl_trans_pcie *trans_pcie = - IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwlagn_scd_bc_tbl *scd_bc_tbl = trans_pcie->scd_bc_tbls.addr; - int txq_id = txq->q.id; - int read_ptr = txq->q.read_ptr; - u8 sta_id = 0; - __le16 bc_ent; - struct iwl_tx_cmd *tx_cmd = - (void *)txq->entries[txq->q.read_ptr].cmd->payload; - - WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX); - - if (txq_id != trans_pcie->cmd_queue) - sta_id = tx_cmd->sta_id; - - bc_ent = cpu_to_le16(1 | (sta_id << 12)); - scd_bc_tbl[txq_id].tfd_offset[read_ptr] = bc_ent; - - if (read_ptr < TFD_QUEUE_SIZE_BC_DUP) - scd_bc_tbl[txq_id]. - tfd_offset[TFD_QUEUE_SIZE_MAX + read_ptr] = bc_ent; -} - -/* - * iwl_pcie_txq_inc_wr_ptr - Send new write index to hardware - */ -void iwl_pcie_txq_inc_wr_ptr(struct iwl_trans *trans, struct iwl_txq *txq) -{ - u32 reg = 0; - int txq_id = txq->q.id; - - if (txq->need_update == 0) - return; - - if (trans->cfg->base_params->shadow_reg_enable) { - /* shadow register enabled */ - iwl_write32(trans, HBUS_TARG_WRPTR, - txq->q.write_ptr | (txq_id << 8)); - } else { - struct iwl_trans_pcie *trans_pcie = - IWL_TRANS_GET_PCIE_TRANS(trans); - /* if we're trying to save power */ - if (test_bit(STATUS_TPOWER_PMI, &trans_pcie->status)) { - /* wake up nic if it's powered down ... - * uCode will wake up, and interrupt us again, so next - * time we'll skip this part. */ - reg = iwl_read32(trans, CSR_UCODE_DRV_GP1); - - if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { - IWL_DEBUG_INFO(trans, - "Tx queue %d requesting wakeup," - " GP1 = 0x%x\n", txq_id, reg); - iwl_set_bit(trans, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - return; - } - - IWL_DEBUG_TX(trans, "Q:%d WR: 0x%x\n", txq_id, - txq->q.write_ptr); - - iwl_write_direct32(trans, HBUS_TARG_WRPTR, - txq->q.write_ptr | (txq_id << 8)); - - /* - * else not in power-save mode, - * uCode will never sleep when we're - * trying to tx (during RFKILL, we're not trying to tx). - */ - } else - iwl_write32(trans, HBUS_TARG_WRPTR, - txq->q.write_ptr | (txq_id << 8)); - } - txq->need_update = 0; -} - -static inline dma_addr_t iwl_pcie_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx) -{ - struct iwl_tfd_tb *tb = &tfd->tbs[idx]; - - dma_addr_t addr = get_unaligned_le32(&tb->lo); - if (sizeof(dma_addr_t) > sizeof(u32)) - addr |= - ((dma_addr_t)(le16_to_cpu(tb->hi_n_len) & 0xF) << 16) << 16; - - return addr; -} - -static inline u16 iwl_pcie_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx) -{ - struct iwl_tfd_tb *tb = &tfd->tbs[idx]; - - return le16_to_cpu(tb->hi_n_len) >> 4; -} - -static inline void iwl_pcie_tfd_set_tb(struct iwl_tfd *tfd, u8 idx, - dma_addr_t addr, u16 len) -{ - struct iwl_tfd_tb *tb = &tfd->tbs[idx]; - u16 hi_n_len = len << 4; - - put_unaligned_le32(addr, &tb->lo); - if (sizeof(dma_addr_t) > sizeof(u32)) - hi_n_len |= ((addr >> 16) >> 16) & 0xF; - - tb->hi_n_len = cpu_to_le16(hi_n_len); - - tfd->num_tbs = idx + 1; -} - -static inline u8 iwl_pcie_tfd_get_num_tbs(struct iwl_tfd *tfd) -{ - return tfd->num_tbs & 0x1f; -} - -static void iwl_pcie_tfd_unmap(struct iwl_trans *trans, - struct iwl_cmd_meta *meta, - struct iwl_tfd *tfd) -{ - int i; - int num_tbs; - - /* Sanity check on number of chunks */ - num_tbs = iwl_pcie_tfd_get_num_tbs(tfd); - - if (num_tbs >= IWL_NUM_OF_TBS) { - IWL_ERR(trans, "Too many chunks: %i\n", num_tbs); - /* @todo issue fatal error, it is quite serious situation */ - return; - } - - /* first TB is never freed - it's the scratchbuf data */ - - for (i = 1; i < num_tbs; i++) - dma_unmap_single(trans->dev, iwl_pcie_tfd_tb_get_addr(tfd, i), - iwl_pcie_tfd_tb_get_len(tfd, i), - DMA_TO_DEVICE); - - tfd->num_tbs = 0; -} - -/* - * iwl_pcie_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr] - * @trans - transport private data - * @txq - tx queue - * @dma_dir - the direction of the DMA mapping - * - * Does NOT advance any TFD circular buffer read/write indexes - * Does NOT free the TFD itself (which is within circular buffer) - */ -static void iwl_pcie_txq_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq) -{ - struct iwl_tfd *tfd_tmp = txq->tfds; - - /* rd_ptr is bounded by n_bd and idx is bounded by n_window */ - int rd_ptr = txq->q.read_ptr; - int idx = get_cmd_index(&txq->q, rd_ptr); - - lockdep_assert_held(&txq->lock); - - /* We have only q->n_window txq->entries, but we use q->n_bd tfds */ - iwl_pcie_tfd_unmap(trans, &txq->entries[idx].meta, &tfd_tmp[rd_ptr]); - - /* free SKB */ - if (txq->entries) { - struct sk_buff *skb; - - skb = txq->entries[idx].skb; - - /* Can be called from irqs-disabled context - * If skb is not NULL, it means that the whole queue is being - * freed and that the queue is not empty - free the skb - */ - if (skb) { - iwl_op_mode_free_skb(trans->op_mode, skb); - txq->entries[idx].skb = NULL; - } - } -} - -static int iwl_pcie_txq_build_tfd(struct iwl_trans *trans, struct iwl_txq *txq, - dma_addr_t addr, u16 len, u8 reset) -{ - struct iwl_queue *q; - struct iwl_tfd *tfd, *tfd_tmp; - u32 num_tbs; - - q = &txq->q; - tfd_tmp = txq->tfds; - tfd = &tfd_tmp[q->write_ptr]; - - if (reset) - memset(tfd, 0, sizeof(*tfd)); - - num_tbs = iwl_pcie_tfd_get_num_tbs(tfd); - - /* Each TFD can point to a maximum 20 Tx buffers */ - if (num_tbs >= IWL_NUM_OF_TBS) { - IWL_ERR(trans, "Error can not send more than %d chunks\n", - IWL_NUM_OF_TBS); - return -EINVAL; - } - - if (WARN_ON(addr & ~DMA_BIT_MASK(36))) - return -EINVAL; - - if (unlikely(addr & ~IWL_TX_DMA_MASK)) - IWL_ERR(trans, "Unaligned address = %llx\n", - (unsigned long long)addr); - - iwl_pcie_tfd_set_tb(tfd, num_tbs, addr, len); - - return 0; -} - -static int iwl_pcie_txq_alloc(struct iwl_trans *trans, - struct iwl_txq *txq, int slots_num, - u32 txq_id) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX; - size_t scratchbuf_sz; - int i; - - if (WARN_ON(txq->entries || txq->tfds)) - return -EINVAL; - - setup_timer(&txq->stuck_timer, iwl_pcie_txq_stuck_timer, - (unsigned long)txq); - txq->trans_pcie = trans_pcie; - - txq->q.n_window = slots_num; - - txq->entries = kcalloc(slots_num, - sizeof(struct iwl_pcie_txq_entry), - GFP_KERNEL); - - if (!txq->entries) - goto error; - - if (txq_id == trans_pcie->cmd_queue) - for (i = 0; i < slots_num; i++) { - txq->entries[i].cmd = - kmalloc(sizeof(struct iwl_device_cmd), - GFP_KERNEL); - if (!txq->entries[i].cmd) - goto error; - } - - /* Circular buffer of transmit frame descriptors (TFDs), - * shared with device */ - txq->tfds = dma_alloc_coherent(trans->dev, tfd_sz, - &txq->q.dma_addr, GFP_KERNEL); - if (!txq->tfds) - goto error; - - BUILD_BUG_ON(IWL_HCMD_SCRATCHBUF_SIZE != sizeof(*txq->scratchbufs)); - BUILD_BUG_ON(offsetof(struct iwl_pcie_txq_scratch_buf, scratch) != - sizeof(struct iwl_cmd_header) + - offsetof(struct iwl_tx_cmd, scratch)); - - scratchbuf_sz = sizeof(*txq->scratchbufs) * slots_num; - - txq->scratchbufs = dma_alloc_coherent(trans->dev, scratchbuf_sz, - &txq->scratchbufs_dma, - GFP_KERNEL); - if (!txq->scratchbufs) - goto err_free_tfds; - - txq->q.id = txq_id; - - return 0; -err_free_tfds: - dma_free_coherent(trans->dev, tfd_sz, txq->tfds, txq->q.dma_addr); -error: - if (txq->entries && txq_id == trans_pcie->cmd_queue) - for (i = 0; i < slots_num; i++) - kfree(txq->entries[i].cmd); - kfree(txq->entries); - txq->entries = NULL; - - return -ENOMEM; - -} - -static int iwl_pcie_txq_init(struct iwl_trans *trans, struct iwl_txq *txq, - int slots_num, u32 txq_id) -{ - int ret; - - txq->need_update = 0; - - /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise - * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */ - BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); - - /* Initialize queue's high/low-water marks, and head/tail indexes */ - ret = iwl_queue_init(&txq->q, TFD_QUEUE_SIZE_MAX, slots_num, - txq_id); - if (ret) - return ret; - - spin_lock_init(&txq->lock); - - /* - * Tell nic where to find circular buffer of Tx Frame Descriptors for - * given Tx queue, and enable the DMA channel used for that queue. - * Circular buffer (TFD queue in DRAM) physical base address */ - iwl_write_direct32(trans, FH_MEM_CBBC_QUEUE(txq_id), - txq->q.dma_addr >> 8); - - return 0; -} - -/* - * iwl_pcie_txq_unmap - Unmap any remaining DMA mappings and free skb's - */ -static void iwl_pcie_txq_unmap(struct iwl_trans *trans, int txq_id) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_txq *txq = &trans_pcie->txq[txq_id]; - struct iwl_queue *q = &txq->q; - - if (!q->n_bd) - return; - - spin_lock_bh(&txq->lock); - while (q->write_ptr != q->read_ptr) { - IWL_DEBUG_TX_REPLY(trans, "Q %d Free %d\n", - txq_id, q->read_ptr); - iwl_pcie_txq_free_tfd(trans, txq); - q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd); - } - txq->active = false; - spin_unlock_bh(&txq->lock); - - /* just in case - this queue may have been stopped */ - iwl_wake_queue(trans, txq); -} - -/* - * iwl_pcie_txq_free - Deallocate DMA queue. - * @txq: Transmit queue to deallocate. - * - * Empty queue by removing and destroying all BD's. - * Free all buffers. - * 0-fill, but do not free "txq" descriptor structure. - */ -static void iwl_pcie_txq_free(struct iwl_trans *trans, int txq_id) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_txq *txq = &trans_pcie->txq[txq_id]; - struct device *dev = trans->dev; - int i; - - if (WARN_ON(!txq)) - return; - - iwl_pcie_txq_unmap(trans, txq_id); - - /* De-alloc array of command/tx buffers */ - if (txq_id == trans_pcie->cmd_queue) - for (i = 0; i < txq->q.n_window; i++) { - kfree(txq->entries[i].cmd); - kfree(txq->entries[i].free_buf); - } - - /* De-alloc circular buffer of TFDs */ - if (txq->q.n_bd) { - dma_free_coherent(dev, sizeof(struct iwl_tfd) * - txq->q.n_bd, txq->tfds, txq->q.dma_addr); - txq->q.dma_addr = 0; - - dma_free_coherent(dev, - sizeof(*txq->scratchbufs) * txq->q.n_window, - txq->scratchbufs, txq->scratchbufs_dma); - } - - kfree(txq->entries); - txq->entries = NULL; - - del_timer_sync(&txq->stuck_timer); - - /* 0-fill queue descriptor structure */ - memset(txq, 0, sizeof(*txq)); -} - -/* - * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask - */ -static void iwl_pcie_txq_set_sched(struct iwl_trans *trans, u32 mask) -{ - struct iwl_trans_pcie __maybe_unused *trans_pcie = - IWL_TRANS_GET_PCIE_TRANS(trans); - - iwl_write_prph(trans, SCD_TXFACT, mask); -} - -void iwl_pcie_tx_start(struct iwl_trans *trans, u32 scd_base_addr) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - int nq = trans->cfg->base_params->num_of_queues; - int chan; - u32 reg_val; - int clear_dwords = (SCD_TRANS_TBL_OFFSET_QUEUE(nq) - - SCD_CONTEXT_MEM_LOWER_BOUND) / sizeof(u32); - - /* make sure all queue are not stopped/used */ - memset(trans_pcie->queue_stopped, 0, sizeof(trans_pcie->queue_stopped)); - memset(trans_pcie->queue_used, 0, sizeof(trans_pcie->queue_used)); - - trans_pcie->scd_base_addr = - iwl_read_prph(trans, SCD_SRAM_BASE_ADDR); - - WARN_ON(scd_base_addr != 0 && - scd_base_addr != trans_pcie->scd_base_addr); - - /* reset context data, TX status and translation data */ - iwl_trans_write_mem(trans, trans_pcie->scd_base_addr + - SCD_CONTEXT_MEM_LOWER_BOUND, - NULL, clear_dwords); - - iwl_write_prph(trans, SCD_DRAM_BASE_ADDR, - trans_pcie->scd_bc_tbls.dma >> 10); - - /* The chain extension of the SCD doesn't work well. This feature is - * enabled by default by the HW, so we need to disable it manually. - */ - iwl_write_prph(trans, SCD_CHAINEXT_EN, 0); - - iwl_trans_ac_txq_enable(trans, trans_pcie->cmd_queue, - trans_pcie->cmd_fifo); - - /* Activate all Tx DMA/FIFO channels */ - iwl_pcie_txq_set_sched(trans, IWL_MASK(0, 7)); - - /* Enable DMA channel */ - for (chan = 0; chan < FH_TCSR_CHNL_NUM; chan++) - iwl_write_direct32(trans, FH_TCSR_CHNL_TX_CONFIG_REG(chan), - FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | - FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE); - - /* Update FH chicken bits */ - reg_val = iwl_read_direct32(trans, FH_TX_CHICKEN_BITS_REG); - iwl_write_direct32(trans, FH_TX_CHICKEN_BITS_REG, - reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); - - /* Enable L1-Active */ - iwl_clear_bits_prph(trans, APMG_PCIDEV_STT_REG, - APMG_PCIDEV_STT_VAL_L1_ACT_DIS); -} - -void iwl_trans_pcie_tx_reset(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - int txq_id; - - for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues; - txq_id++) { - struct iwl_txq *txq = &trans_pcie->txq[txq_id]; - - iwl_write_direct32(trans, FH_MEM_CBBC_QUEUE(txq_id), - txq->q.dma_addr >> 8); - iwl_pcie_txq_unmap(trans, txq_id); - txq->q.read_ptr = 0; - txq->q.write_ptr = 0; - } - - /* Tell NIC where to find the "keep warm" buffer */ - iwl_write_direct32(trans, FH_KW_MEM_ADDR_REG, - trans_pcie->kw.dma >> 4); - - iwl_pcie_tx_start(trans, trans_pcie->scd_base_addr); -} - -/* - * iwl_pcie_tx_stop - Stop all Tx DMA channels - */ -int iwl_pcie_tx_stop(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - int ch, txq_id, ret; - unsigned long flags; - - /* Turn off all Tx DMA fifos */ - spin_lock_irqsave(&trans_pcie->irq_lock, flags); - - iwl_pcie_txq_set_sched(trans, 0); - - /* Stop each Tx DMA channel, and wait for it to be idle */ - for (ch = 0; ch < FH_TCSR_CHNL_NUM; ch++) { - iwl_write_direct32(trans, - FH_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0); - ret = iwl_poll_direct_bit(trans, FH_TSSR_TX_STATUS_REG, - FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(ch), 1000); - if (ret < 0) - IWL_ERR(trans, - "Failing on timeout while stopping DMA channel %d [0x%08x]\n", - ch, - iwl_read_direct32(trans, - FH_TSSR_TX_STATUS_REG)); - } - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); - - if (!trans_pcie->txq) { - IWL_WARN(trans, - "Stopping tx queues that aren't allocated...\n"); - return 0; - } - - /* Unmap DMA from host system and free skb's */ - for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues; - txq_id++) - iwl_pcie_txq_unmap(trans, txq_id); - - return 0; -} - -/* - * iwl_trans_tx_free - Free TXQ Context - * - * Destroy all TX DMA queues and structures - */ -void iwl_pcie_tx_free(struct iwl_trans *trans) -{ - int txq_id; - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - /* Tx queues */ - if (trans_pcie->txq) { - for (txq_id = 0; - txq_id < trans->cfg->base_params->num_of_queues; txq_id++) - iwl_pcie_txq_free(trans, txq_id); - } - - kfree(trans_pcie->txq); - trans_pcie->txq = NULL; - - iwl_pcie_free_dma_ptr(trans, &trans_pcie->kw); - - iwl_pcie_free_dma_ptr(trans, &trans_pcie->scd_bc_tbls); -} - -/* - * iwl_pcie_tx_alloc - allocate TX context - * Allocate all Tx DMA structures and initialize them - */ -static int iwl_pcie_tx_alloc(struct iwl_trans *trans) -{ - int ret; - int txq_id, slots_num; - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - u16 scd_bc_tbls_size = trans->cfg->base_params->num_of_queues * - sizeof(struct iwlagn_scd_bc_tbl); - - /*It is not allowed to alloc twice, so warn when this happens. - * We cannot rely on the previous allocation, so free and fail */ - if (WARN_ON(trans_pcie->txq)) { - ret = -EINVAL; - goto error; - } - - ret = iwl_pcie_alloc_dma_ptr(trans, &trans_pcie->scd_bc_tbls, - scd_bc_tbls_size); - if (ret) { - IWL_ERR(trans, "Scheduler BC Table allocation failed\n"); - goto error; - } - - /* Alloc keep-warm buffer */ - ret = iwl_pcie_alloc_dma_ptr(trans, &trans_pcie->kw, IWL_KW_SIZE); - if (ret) { - IWL_ERR(trans, "Keep Warm allocation failed\n"); - goto error; - } - - trans_pcie->txq = kcalloc(trans->cfg->base_params->num_of_queues, - sizeof(struct iwl_txq), GFP_KERNEL); - if (!trans_pcie->txq) { - IWL_ERR(trans, "Not enough memory for txq\n"); - ret = ENOMEM; - goto error; - } - - /* Alloc and init all Tx queues, including the command queue (#4/#9) */ - for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues; - txq_id++) { - slots_num = (txq_id == trans_pcie->cmd_queue) ? - TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; - ret = iwl_pcie_txq_alloc(trans, &trans_pcie->txq[txq_id], - slots_num, txq_id); - if (ret) { - IWL_ERR(trans, "Tx %d queue alloc failed\n", txq_id); - goto error; - } - } - - return 0; - -error: - iwl_pcie_tx_free(trans); - - return ret; -} -int iwl_pcie_tx_init(struct iwl_trans *trans) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - int ret; - int txq_id, slots_num; - unsigned long flags; - bool alloc = false; - - if (!trans_pcie->txq) { - ret = iwl_pcie_tx_alloc(trans); - if (ret) - goto error; - alloc = true; - } - - spin_lock_irqsave(&trans_pcie->irq_lock, flags); - - /* Turn off all Tx DMA fifos */ - iwl_write_prph(trans, SCD_TXFACT, 0); - - /* Tell NIC where to find the "keep warm" buffer */ - iwl_write_direct32(trans, FH_KW_MEM_ADDR_REG, - trans_pcie->kw.dma >> 4); - - spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); - - /* Alloc and init all Tx queues, including the command queue (#4/#9) */ - for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues; - txq_id++) { - slots_num = (txq_id == trans_pcie->cmd_queue) ? - TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; - ret = iwl_pcie_txq_init(trans, &trans_pcie->txq[txq_id], - slots_num, txq_id); - if (ret) { - IWL_ERR(trans, "Tx %d queue init failed\n", txq_id); - goto error; - } - } - - return 0; -error: - /*Upon error, free only if we allocated something */ - if (alloc) - iwl_pcie_tx_free(trans); - return ret; -} - -static inline void iwl_pcie_txq_progress(struct iwl_trans_pcie *trans_pcie, - struct iwl_txq *txq) -{ - if (!trans_pcie->wd_timeout) - return; - - /* - * if empty delete timer, otherwise move timer forward - * since we're making progress on this queue - */ - if (txq->q.read_ptr == txq->q.write_ptr) - del_timer(&txq->stuck_timer); - else - mod_timer(&txq->stuck_timer, jiffies + trans_pcie->wd_timeout); -} - -/* Frees buffers until index _not_ inclusive */ -void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, - struct sk_buff_head *skbs) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_txq *txq = &trans_pcie->txq[txq_id]; - /* n_bd is usually 256 => n_bd - 1 = 0xff */ - int tfd_num = ssn & (txq->q.n_bd - 1); - struct iwl_queue *q = &txq->q; - int last_to_free; - - /* This function is not meant to release cmd queue*/ - if (WARN_ON(txq_id == trans_pcie->cmd_queue)) - return; - - spin_lock_bh(&txq->lock); - - if (!txq->active) { - IWL_DEBUG_TX_QUEUES(trans, "Q %d inactive - ignoring idx %d\n", - txq_id, ssn); - goto out; - } - - if (txq->q.read_ptr == tfd_num) - goto out; - - IWL_DEBUG_TX_REPLY(trans, "[Q %d] %d -> %d (%d)\n", - txq_id, txq->q.read_ptr, tfd_num, ssn); - - /*Since we free until index _not_ inclusive, the one before index is - * the last we will free. This one must be used */ - last_to_free = iwl_queue_dec_wrap(tfd_num, q->n_bd); - - if (!iwl_queue_used(q, last_to_free)) { - IWL_ERR(trans, - "%s: Read index for DMA queue txq id (%d), last_to_free %d is out of range [0-%d] %d %d.\n", - __func__, txq_id, last_to_free, q->n_bd, - q->write_ptr, q->read_ptr); - goto out; - } - - if (WARN_ON(!skb_queue_empty(skbs))) - goto out; - - for (; - q->read_ptr != tfd_num; - q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { - - if (WARN_ON_ONCE(txq->entries[txq->q.read_ptr].skb == NULL)) - continue; - - __skb_queue_tail(skbs, txq->entries[txq->q.read_ptr].skb); - - txq->entries[txq->q.read_ptr].skb = NULL; - - iwl_pcie_txq_inval_byte_cnt_tbl(trans, txq); - - iwl_pcie_txq_free_tfd(trans, txq); - } - - iwl_pcie_txq_progress(trans_pcie, txq); - - if (iwl_queue_space(&txq->q) > txq->q.low_mark) - iwl_wake_queue(trans, txq); -out: - spin_unlock_bh(&txq->lock); -} - -/* - * iwl_pcie_cmdq_reclaim - Reclaim TX command queue entries already Tx'd - * - * When FW advances 'R' index, all entries between old and new 'R' index - * need to be reclaimed. As result, some free space forms. If there is - * enough free space (> low mark), wake the stack that feeds us. - */ -static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_txq *txq = &trans_pcie->txq[txq_id]; - struct iwl_queue *q = &txq->q; - int nfreed = 0; - - lockdep_assert_held(&txq->lock); - - if ((idx >= q->n_bd) || (!iwl_queue_used(q, idx))) { - IWL_ERR(trans, - "%s: Read index for DMA queue txq id (%d), index %d is out of range [0-%d] %d %d.\n", - __func__, txq_id, idx, q->n_bd, - q->write_ptr, q->read_ptr); - return; - } - - for (idx = iwl_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; - q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { - - if (nfreed++ > 0) { - IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", - idx, q->write_ptr, q->read_ptr); - iwl_op_mode_nic_error(trans->op_mode); - } - } - - iwl_pcie_txq_progress(trans_pcie, txq); -} - -static int iwl_pcie_txq_set_ratid_map(struct iwl_trans *trans, u16 ra_tid, - u16 txq_id) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - u32 tbl_dw_addr; - u32 tbl_dw; - u16 scd_q2ratid; - - scd_q2ratid = ra_tid & SCD_QUEUE_RA_TID_MAP_RATID_MSK; - - tbl_dw_addr = trans_pcie->scd_base_addr + - SCD_TRANS_TBL_OFFSET_QUEUE(txq_id); - - tbl_dw = iwl_trans_read_mem32(trans, tbl_dw_addr); - - if (txq_id & 0x1) - tbl_dw = (scd_q2ratid << 16) | (tbl_dw & 0x0000FFFF); - else - tbl_dw = scd_q2ratid | (tbl_dw & 0xFFFF0000); - - iwl_trans_write_mem32(trans, tbl_dw_addr, tbl_dw); - - return 0; -} - -static inline void iwl_pcie_txq_set_inactive(struct iwl_trans *trans, - u16 txq_id) -{ - /* Simply stop the queue, but don't change any configuration; - * the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */ - iwl_write_prph(trans, - SCD_QUEUE_STATUS_BITS(txq_id), - (0 << SCD_QUEUE_STTS_REG_POS_ACTIVE)| - (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); -} - -void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo, - int sta_id, int tid, int frame_limit, u16 ssn) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - if (test_and_set_bit(txq_id, trans_pcie->queue_used)) - WARN_ONCE(1, "queue %d already used - expect issues", txq_id); - - /* Stop this Tx queue before configuring it */ - iwl_pcie_txq_set_inactive(trans, txq_id); - - /* Set this queue as a chain-building queue unless it is CMD queue */ - if (txq_id != trans_pcie->cmd_queue) - iwl_set_bits_prph(trans, SCD_QUEUECHAIN_SEL, BIT(txq_id)); - - /* If this queue is mapped to a certain station: it is an AGG queue */ - if (sta_id >= 0) { - u16 ra_tid = BUILD_RAxTID(sta_id, tid); - - /* Map receiver-address / traffic-ID to this queue */ - iwl_pcie_txq_set_ratid_map(trans, ra_tid, txq_id); - - /* enable aggregations for the queue */ - iwl_set_bits_prph(trans, SCD_AGGR_SEL, BIT(txq_id)); - } else { - /* - * disable aggregations for the queue, this will also make the - * ra_tid mapping configuration irrelevant since it is now a - * non-AGG queue. - */ - iwl_clear_bits_prph(trans, SCD_AGGR_SEL, BIT(txq_id)); - } - - /* Place first TFD at index corresponding to start sequence number. - * Assumes that ssn_idx is valid (!= 0xFFF) */ - trans_pcie->txq[txq_id].q.read_ptr = (ssn & 0xff); - trans_pcie->txq[txq_id].q.write_ptr = (ssn & 0xff); - - iwl_write_direct32(trans, HBUS_TARG_WRPTR, - (ssn & 0xff) | (txq_id << 8)); - iwl_write_prph(trans, SCD_QUEUE_RDPTR(txq_id), ssn); - - /* Set up Tx window size and frame limit for this queue */ - iwl_trans_write_mem32(trans, trans_pcie->scd_base_addr + - SCD_CONTEXT_QUEUE_OFFSET(txq_id), 0); - iwl_trans_write_mem32(trans, trans_pcie->scd_base_addr + - SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32), - ((frame_limit << SCD_QUEUE_CTX_REG2_WIN_SIZE_POS) & - SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK) | - ((frame_limit << SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) & - SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK)); - - /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */ - iwl_write_prph(trans, SCD_QUEUE_STATUS_BITS(txq_id), - (1 << SCD_QUEUE_STTS_REG_POS_ACTIVE) | - (fifo << SCD_QUEUE_STTS_REG_POS_TXF) | - (1 << SCD_QUEUE_STTS_REG_POS_WSL) | - SCD_QUEUE_STTS_REG_MSK); - trans_pcie->txq[txq_id].active = true; - IWL_DEBUG_TX_QUEUES(trans, "Activate queue %d on FIFO %d WrPtr: %d\n", - txq_id, fifo, ssn & 0xff); -} - -void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int txq_id) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - u32 stts_addr = trans_pcie->scd_base_addr + - SCD_TX_STTS_QUEUE_OFFSET(txq_id); - static const u32 zero_val[4] = {}; - - if (!test_and_clear_bit(txq_id, trans_pcie->queue_used)) { - WARN_ONCE(1, "queue %d not used", txq_id); - return; - } - - iwl_pcie_txq_set_inactive(trans, txq_id); - - iwl_trans_write_mem(trans, stts_addr, (void *)zero_val, - ARRAY_SIZE(zero_val)); - - iwl_pcie_txq_unmap(trans, txq_id); - - IWL_DEBUG_TX_QUEUES(trans, "Deactivate queue %d\n", txq_id); -} - -/*************** HOST COMMAND QUEUE FUNCTIONS *****/ - -/* - * iwl_pcie_enqueue_hcmd - enqueue a uCode command - * @priv: device private data point - * @cmd: a point to the ucode command structure - * - * The function returns < 0 values to indicate the operation is - * failed. On success, it turns the index (> 0) of command in the - * command queue. - */ -static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, - struct iwl_host_cmd *cmd) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_txq *txq = &trans_pcie->txq[trans_pcie->cmd_queue]; - struct iwl_queue *q = &txq->q; - struct iwl_device_cmd *out_cmd; - struct iwl_cmd_meta *out_meta; - void *dup_buf = NULL; - dma_addr_t phys_addr; - int idx; - u16 copy_size, cmd_size, scratch_size; - bool had_nocopy = false; - int i; - u32 cmd_pos; - const u8 *cmddata[IWL_MAX_CMD_TBS_PER_TFD]; - u16 cmdlen[IWL_MAX_CMD_TBS_PER_TFD]; - - copy_size = sizeof(out_cmd->hdr); - cmd_size = sizeof(out_cmd->hdr); - - /* need one for the header if the first is NOCOPY */ - BUILD_BUG_ON(IWL_MAX_CMD_TBS_PER_TFD > IWL_NUM_OF_TBS - 1); - - for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { - cmddata[i] = cmd->data[i]; - cmdlen[i] = cmd->len[i]; - - if (!cmd->len[i]) - continue; - - /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ - if (copy_size < IWL_HCMD_SCRATCHBUF_SIZE) { - int copy = IWL_HCMD_SCRATCHBUF_SIZE - copy_size; - - if (copy > cmdlen[i]) - copy = cmdlen[i]; - cmdlen[i] -= copy; - cmddata[i] += copy; - copy_size += copy; - } - - if (cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY) { - had_nocopy = true; - if (WARN_ON(cmd->dataflags[i] & IWL_HCMD_DFL_DUP)) { - idx = -EINVAL; - goto free_dup_buf; - } - } else if (cmd->dataflags[i] & IWL_HCMD_DFL_DUP) { - /* - * This is also a chunk that isn't copied - * to the static buffer so set had_nocopy. - */ - had_nocopy = true; - - /* only allowed once */ - if (WARN_ON(dup_buf)) { - idx = -EINVAL; - goto free_dup_buf; - } - - dup_buf = kmemdup(cmddata[i], cmdlen[i], - GFP_ATOMIC); - if (!dup_buf) - return -ENOMEM; - } else { - /* NOCOPY must not be followed by normal! */ - if (WARN_ON(had_nocopy)) { - idx = -EINVAL; - goto free_dup_buf; - } - copy_size += cmdlen[i]; - } - cmd_size += cmd->len[i]; - } - - /* - * If any of the command structures end up being larger than - * the TFD_MAX_PAYLOAD_SIZE and they aren't dynamically - * allocated into separate TFDs, then we will need to - * increase the size of the buffers. - */ - if (WARN(copy_size > TFD_MAX_PAYLOAD_SIZE, - "Command %s (%#x) is too large (%d bytes)\n", - get_cmd_string(trans_pcie, cmd->id), cmd->id, copy_size)) { - idx = -EINVAL; - goto free_dup_buf; - } - - spin_lock_bh(&txq->lock); - - if (iwl_queue_space(q) < ((cmd->flags & CMD_ASYNC) ? 2 : 1)) { - spin_unlock_bh(&txq->lock); - - IWL_ERR(trans, "No space in command queue\n"); - iwl_op_mode_cmd_queue_full(trans->op_mode); - idx = -ENOSPC; - goto free_dup_buf; - } - - idx = get_cmd_index(q, q->write_ptr); - out_cmd = txq->entries[idx].cmd; - out_meta = &txq->entries[idx].meta; - - memset(out_meta, 0, sizeof(*out_meta)); /* re-initialize to NULL */ - if (cmd->flags & CMD_WANT_SKB) - out_meta->source = cmd; - - /* set up the header */ - - out_cmd->hdr.cmd = cmd->id; - out_cmd->hdr.flags = 0; - out_cmd->hdr.sequence = - cpu_to_le16(QUEUE_TO_SEQ(trans_pcie->cmd_queue) | - INDEX_TO_SEQ(q->write_ptr)); - - /* and copy the data that needs to be copied */ - cmd_pos = offsetof(struct iwl_device_cmd, payload); - copy_size = sizeof(out_cmd->hdr); - for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { - int copy = 0; - - if (!cmd->len[i]) - continue; - - /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ - if (copy_size < IWL_HCMD_SCRATCHBUF_SIZE) { - copy = IWL_HCMD_SCRATCHBUF_SIZE - copy_size; - - if (copy > cmd->len[i]) - copy = cmd->len[i]; - } - - /* copy everything if not nocopy/dup */ - if (!(cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | - IWL_HCMD_DFL_DUP))) - copy = cmd->len[i]; - - if (copy) { - memcpy((u8 *)out_cmd + cmd_pos, cmd->data[i], copy); - cmd_pos += copy; - copy_size += copy; - } - } - - IWL_DEBUG_HC(trans, - "Sending command %s (#%x), seq: 0x%04X, %d bytes at %d[%d]:%d\n", - get_cmd_string(trans_pcie, out_cmd->hdr.cmd), - out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), - cmd_size, q->write_ptr, idx, trans_pcie->cmd_queue); - - /* start the TFD with the scratchbuf */ - scratch_size = min_t(int, copy_size, IWL_HCMD_SCRATCHBUF_SIZE); - memcpy(&txq->scratchbufs[q->write_ptr], &out_cmd->hdr, scratch_size); - iwl_pcie_txq_build_tfd(trans, txq, - iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr), - scratch_size, 1); - - /* map first command fragment, if any remains */ - if (copy_size > scratch_size) { - phys_addr = dma_map_single(trans->dev, - ((u8 *)&out_cmd->hdr) + scratch_size, - copy_size - scratch_size, - DMA_TO_DEVICE); - if (dma_mapping_error(trans->dev, phys_addr)) { - iwl_pcie_tfd_unmap(trans, out_meta, - &txq->tfds[q->write_ptr]); - idx = -ENOMEM; - goto out; - } - - iwl_pcie_txq_build_tfd(trans, txq, phys_addr, - copy_size - scratch_size, 0); - } - - /* map the remaining (adjusted) nocopy/dup fragments */ - for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { - const void *data = cmddata[i]; - - if (!cmdlen[i]) - continue; - if (!(cmd->dataflags[i] & (IWL_HCMD_DFL_NOCOPY | - IWL_HCMD_DFL_DUP))) - continue; - if (cmd->dataflags[i] & IWL_HCMD_DFL_DUP) - data = dup_buf; - phys_addr = dma_map_single(trans->dev, (void *)data, - cmdlen[i], DMA_TO_DEVICE); - if (dma_mapping_error(trans->dev, phys_addr)) { - iwl_pcie_tfd_unmap(trans, out_meta, - &txq->tfds[q->write_ptr]); - idx = -ENOMEM; - goto out; - } - - iwl_pcie_txq_build_tfd(trans, txq, phys_addr, cmdlen[i], 0); - } - - out_meta->flags = cmd->flags; - if (WARN_ON_ONCE(txq->entries[idx].free_buf)) - kfree(txq->entries[idx].free_buf); - txq->entries[idx].free_buf = dup_buf; - - txq->need_update = 1; - - trace_iwlwifi_dev_hcmd(trans->dev, cmd, cmd_size, &out_cmd->hdr); - - /* start timer if queue currently empty */ - if (q->read_ptr == q->write_ptr && trans_pcie->wd_timeout) - mod_timer(&txq->stuck_timer, jiffies + trans_pcie->wd_timeout); - - /* Increment and update queue's write index */ - q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); - iwl_pcie_txq_inc_wr_ptr(trans, txq); - - out: - spin_unlock_bh(&txq->lock); - free_dup_buf: - if (idx < 0) - kfree(dup_buf); - return idx; -} - -/* - * iwl_pcie_hcmd_complete - Pull unused buffers off the queue and reclaim them - * @rxb: Rx buffer to reclaim - * @handler_status: return value of the handler of the command - * (put in setup_rx_handlers) - * - * If an Rx buffer has an async callback associated with it the callback - * will be executed. The attached skb (if present) will only be freed - * if the callback returns 1 - */ -void iwl_pcie_hcmd_complete(struct iwl_trans *trans, - struct iwl_rx_cmd_buffer *rxb, int handler_status) -{ - struct iwl_rx_packet *pkt = rxb_addr(rxb); - u16 sequence = le16_to_cpu(pkt->hdr.sequence); - int txq_id = SEQ_TO_QUEUE(sequence); - int index = SEQ_TO_INDEX(sequence); - int cmd_index; - struct iwl_device_cmd *cmd; - struct iwl_cmd_meta *meta; - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct iwl_txq *txq = &trans_pcie->txq[trans_pcie->cmd_queue]; - - /* If a Tx command is being handled and it isn't in the actual - * command queue then there a command routing bug has been introduced - * in the queue management code. */ - if (WARN(txq_id != trans_pcie->cmd_queue, - "wrong command queue %d (should be %d), sequence 0x%X readp=%d writep=%d\n", - txq_id, trans_pcie->cmd_queue, sequence, - trans_pcie->txq[trans_pcie->cmd_queue].q.read_ptr, - trans_pcie->txq[trans_pcie->cmd_queue].q.write_ptr)) { - iwl_print_hex_error(trans, pkt, 32); - return; - } - - spin_lock_bh(&txq->lock); - - cmd_index = get_cmd_index(&txq->q, index); - cmd = txq->entries[cmd_index].cmd; - meta = &txq->entries[cmd_index].meta; - - iwl_pcie_tfd_unmap(trans, meta, &txq->tfds[index]); - - /* Input error checking is done when commands are added to queue. */ - if (meta->flags & CMD_WANT_SKB) { - struct page *p = rxb_steal_page(rxb); - - meta->source->resp_pkt = pkt; - meta->source->_rx_page_addr = (unsigned long)page_address(p); - meta->source->_rx_page_order = trans_pcie->rx_page_order; - meta->source->handler_status = handler_status; - } - - iwl_pcie_cmdq_reclaim(trans, txq_id, index); - - if (!(meta->flags & CMD_ASYNC)) { - if (!test_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status)) { - IWL_WARN(trans, - "HCMD_ACTIVE already clear for command %s\n", - get_cmd_string(trans_pcie, cmd->hdr.cmd)); - } - clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); - IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n", - get_cmd_string(trans_pcie, cmd->hdr.cmd)); - wake_up(&trans_pcie->wait_command_queue); - } - - meta->flags = 0; - - spin_unlock_bh(&txq->lock); -} - -#define HOST_COMPLETE_TIMEOUT (2 * HZ) - -static int iwl_pcie_send_hcmd_async(struct iwl_trans *trans, - struct iwl_host_cmd *cmd) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - int ret; - - /* An asynchronous command can not expect an SKB to be set. */ - if (WARN_ON(cmd->flags & CMD_WANT_SKB)) - return -EINVAL; - - ret = iwl_pcie_enqueue_hcmd(trans, cmd); - if (ret < 0) { - IWL_ERR(trans, - "Error sending %s: enqueue_hcmd failed: %d\n", - get_cmd_string(trans_pcie, cmd->id), ret); - return ret; - } - return 0; -} - -static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans, - struct iwl_host_cmd *cmd) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - int cmd_idx; - int ret; - - IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n", - get_cmd_string(trans_pcie, cmd->id)); - - if (WARN_ON(test_and_set_bit(STATUS_HCMD_ACTIVE, - &trans_pcie->status))) { - IWL_ERR(trans, "Command %s: a command is already active!\n", - get_cmd_string(trans_pcie, cmd->id)); - return -EIO; - } - - IWL_DEBUG_INFO(trans, "Setting HCMD_ACTIVE for command %s\n", - get_cmd_string(trans_pcie, cmd->id)); - - cmd_idx = iwl_pcie_enqueue_hcmd(trans, cmd); - if (cmd_idx < 0) { - ret = cmd_idx; - clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); - IWL_ERR(trans, - "Error sending %s: enqueue_hcmd failed: %d\n", - get_cmd_string(trans_pcie, cmd->id), ret); - return ret; - } - - ret = wait_event_timeout(trans_pcie->wait_command_queue, - !test_bit(STATUS_HCMD_ACTIVE, - &trans_pcie->status), - HOST_COMPLETE_TIMEOUT); - if (!ret) { - if (test_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status)) { - struct iwl_txq *txq = - &trans_pcie->txq[trans_pcie->cmd_queue]; - struct iwl_queue *q = &txq->q; - - IWL_ERR(trans, - "Error sending %s: time out after %dms.\n", - get_cmd_string(trans_pcie, cmd->id), - jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); - - IWL_ERR(trans, - "Current CMD queue read_ptr %d write_ptr %d\n", - q->read_ptr, q->write_ptr); - - clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); - IWL_DEBUG_INFO(trans, - "Clearing HCMD_ACTIVE for command %s\n", - get_cmd_string(trans_pcie, cmd->id)); - ret = -ETIMEDOUT; - goto cancel; - } - } - - if (test_bit(STATUS_FW_ERROR, &trans_pcie->status)) { - IWL_ERR(trans, "FW error in SYNC CMD %s\n", - get_cmd_string(trans_pcie, cmd->id)); - ret = -EIO; - goto cancel; - } - - if (test_bit(STATUS_RFKILL, &trans_pcie->status)) { - IWL_DEBUG_RF_KILL(trans, "RFKILL in SYNC CMD... no rsp\n"); - ret = -ERFKILL; - goto cancel; - } - - if ((cmd->flags & CMD_WANT_SKB) && !cmd->resp_pkt) { - IWL_ERR(trans, "Error: Response NULL in '%s'\n", - get_cmd_string(trans_pcie, cmd->id)); - ret = -EIO; - goto cancel; - } - - return 0; - -cancel: - if (cmd->flags & CMD_WANT_SKB) { - /* - * Cancel the CMD_WANT_SKB flag for the cmd in the - * TX cmd queue. Otherwise in case the cmd comes - * in later, it will possibly set an invalid - * address (cmd->meta.source). - */ - trans_pcie->txq[trans_pcie->cmd_queue]. - entries[cmd_idx].meta.flags &= ~CMD_WANT_SKB; - } - - if (cmd->resp_pkt) { - iwl_free_resp(cmd); - cmd->resp_pkt = NULL; - } - - return ret; -} - -int iwl_trans_pcie_send_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - - if (test_bit(STATUS_FW_ERROR, &trans_pcie->status)) - return -EIO; - - if (test_bit(STATUS_RFKILL, &trans_pcie->status)) { - IWL_DEBUG_RF_KILL(trans, "Dropping CMD 0x%x: RF KILL\n", - cmd->id); - return -ERFKILL; - } - - if (cmd->flags & CMD_ASYNC) - return iwl_pcie_send_hcmd_async(trans, cmd); - - /* We still can fail on RFKILL that can be asserted while we wait */ - return iwl_pcie_send_hcmd_sync(trans, cmd); -} - -int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, - struct iwl_device_cmd *dev_cmd, int txq_id) -{ - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct iwl_tx_cmd *tx_cmd = (struct iwl_tx_cmd *)dev_cmd->payload; - struct iwl_cmd_meta *out_meta; - struct iwl_txq *txq; - struct iwl_queue *q; - dma_addr_t tb0_phys, tb1_phys, scratch_phys; - void *tb1_addr; - u16 len, tb1_len, tb2_len; - u8 wait_write_ptr = 0; - __le16 fc = hdr->frame_control; - u8 hdr_len = ieee80211_hdrlen(fc); - u16 __maybe_unused wifi_seq; - - txq = &trans_pcie->txq[txq_id]; - q = &txq->q; - - if (unlikely(!test_bit(txq_id, trans_pcie->queue_used))) { - WARN_ON_ONCE(1); - return -EINVAL; - } - - spin_lock(&txq->lock); - - /* In AGG mode, the index in the ring must correspond to the WiFi - * sequence number. This is a HW requirements to help the SCD to parse - * the BA. - * Check here that the packets are in the right place on the ring. - */ -#ifdef CONFIG_IWLWIFI_DEBUG - wifi_seq = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); - WARN_ONCE((iwl_read_prph(trans, SCD_AGGR_SEL) & BIT(txq_id)) && - ((wifi_seq & 0xff) != q->write_ptr), - "Q: %d WiFi Seq %d tfdNum %d", - txq_id, wifi_seq, q->write_ptr); -#endif - - /* Set up driver data for this TFD */ - txq->entries[q->write_ptr].skb = skb; - txq->entries[q->write_ptr].cmd = dev_cmd; - - dev_cmd->hdr.cmd = REPLY_TX; - dev_cmd->hdr.sequence = - cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | - INDEX_TO_SEQ(q->write_ptr))); - - tb0_phys = iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr); - scratch_phys = tb0_phys + sizeof(struct iwl_cmd_header) + - offsetof(struct iwl_tx_cmd, scratch); - - tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); - tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys); - - /* Set up first empty entry in queue's array of Tx/cmd buffers */ - out_meta = &txq->entries[q->write_ptr].meta; - - /* - * The second TB (tb1) points to the remainder of the TX command - * and the 802.11 header - dword aligned size - * (This calculation modifies the TX command, so do it before the - * setup of the first TB) - */ - len = sizeof(struct iwl_tx_cmd) + sizeof(struct iwl_cmd_header) + - hdr_len - IWL_HCMD_SCRATCHBUF_SIZE; - tb1_len = (len + 3) & ~3; - - /* Tell NIC about any 2-byte padding after MAC header */ - if (tb1_len != len) - tx_cmd->tx_flags |= TX_CMD_FLG_MH_PAD_MSK; - - /* The first TB points to the scratchbuf data - min_copy bytes */ - memcpy(&txq->scratchbufs[q->write_ptr], &dev_cmd->hdr, - IWL_HCMD_SCRATCHBUF_SIZE); - iwl_pcie_txq_build_tfd(trans, txq, tb0_phys, - IWL_HCMD_SCRATCHBUF_SIZE, 1); - - /* there must be data left over for TB1 or this code must be changed */ - BUILD_BUG_ON(sizeof(struct iwl_tx_cmd) < IWL_HCMD_SCRATCHBUF_SIZE); - - /* map the data for TB1 */ - tb1_addr = ((u8 *)&dev_cmd->hdr) + IWL_HCMD_SCRATCHBUF_SIZE; - tb1_phys = dma_map_single(trans->dev, tb1_addr, tb1_len, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(trans->dev, tb1_phys))) - goto out_err; - iwl_pcie_txq_build_tfd(trans, txq, tb1_phys, tb1_len, 0); - - /* - * Set up TFD's third entry to point directly to remainder - * of skb, if any (802.11 null frames have no payload). - */ - tb2_len = skb->len - hdr_len; - if (tb2_len > 0) { - dma_addr_t tb2_phys = dma_map_single(trans->dev, - skb->data + hdr_len, - tb2_len, DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(trans->dev, tb2_phys))) { - iwl_pcie_tfd_unmap(trans, out_meta, - &txq->tfds[q->write_ptr]); - goto out_err; - } - iwl_pcie_txq_build_tfd(trans, txq, tb2_phys, tb2_len, 0); - } - - /* Set up entry for this TFD in Tx byte-count array */ - iwl_pcie_txq_update_byte_cnt_tbl(trans, txq, le16_to_cpu(tx_cmd->len)); - - trace_iwlwifi_dev_tx(trans->dev, skb, - &txq->tfds[txq->q.write_ptr], - sizeof(struct iwl_tfd), - &dev_cmd->hdr, IWL_HCMD_SCRATCHBUF_SIZE + tb1_len, - skb->data + hdr_len, tb2_len); - trace_iwlwifi_dev_tx_data(trans->dev, skb, - skb->data + hdr_len, tb2_len); - - if (!ieee80211_has_morefrags(fc)) { - txq->need_update = 1; - } else { - wait_write_ptr = 1; - txq->need_update = 0; - } - - /* start timer if queue currently empty */ - if (txq->need_update && q->read_ptr == q->write_ptr && - trans_pcie->wd_timeout) - mod_timer(&txq->stuck_timer, jiffies + trans_pcie->wd_timeout); - - /* Tell device the write index *just past* this latest filled TFD */ - q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); - iwl_pcie_txq_inc_wr_ptr(trans, txq); - - /* - * At this point the frame is "transmitted" successfully - * and we will get a TX status notification eventually, - * regardless of the value of ret. "ret" only indicates - * whether or not we should update the write pointer. - */ - if (iwl_queue_space(q) < q->high_mark) { - if (wait_write_ptr) { - txq->need_update = 1; - iwl_pcie_txq_inc_wr_ptr(trans, txq); - } else { - iwl_stop_queue(trans, txq); - } - } - spin_unlock(&txq->lock); - return 0; -out_err: - spin_unlock(&txq->lock); - return -1; -} diff --git a/drivers/net/wireless/libertas/Kconfig b/drivers/net/wireless/libertas/Kconfig deleted file mode 100644 index 0485c9957575..000000000000 --- a/drivers/net/wireless/libertas/Kconfig +++ /dev/null @@ -1,45 +0,0 @@ -config LIBERTAS - tristate "Marvell 8xxx Libertas WLAN driver support" - depends on CFG80211 - select WIRELESS_EXT - select WEXT_SPY - select LIB80211 - select FW_LOADER - ---help--- - A library for Marvell Libertas 8xxx devices. - -config LIBERTAS_USB - tristate "Marvell Libertas 8388 USB 802.11b/g cards" - depends on LIBERTAS && USB - ---help--- - A driver for Marvell Libertas 8388 USB devices. - -config LIBERTAS_CS - tristate "Marvell Libertas 8385 CompactFlash 802.11b/g cards" - depends on LIBERTAS && PCMCIA - ---help--- - A driver for Marvell Libertas 8385 CompactFlash devices. - -config LIBERTAS_SDIO - tristate "Marvell Libertas 8385/8686/8688 SDIO 802.11b/g cards" - depends on LIBERTAS && MMC - ---help--- - A driver for Marvell Libertas 8385/8686/8688 SDIO devices. - -config LIBERTAS_SPI - tristate "Marvell Libertas 8686 SPI 802.11b/g cards" - depends on LIBERTAS && SPI - ---help--- - A driver for Marvell Libertas 8686 SPI devices. - -config LIBERTAS_DEBUG - bool "Enable full debugging output in the Libertas module." - depends on LIBERTAS - ---help--- - Debugging support. - -config LIBERTAS_MESH - bool "Enable mesh support" - depends on LIBERTAS - help - This enables Libertas' MESH support, used by e.g. the OLPC people. diff --git a/drivers/net/wireless/libertas/LICENSE b/drivers/net/wireless/libertas/LICENSE deleted file mode 100644 index 8862742213b9..000000000000 --- a/drivers/net/wireless/libertas/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ - Copyright (c) 2003-2006, Marvell International Ltd. - 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., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - diff --git a/drivers/net/wireless/libertas/Makefile b/drivers/net/wireless/libertas/Makefile deleted file mode 100644 index eac72f7bd341..000000000000 --- a/drivers/net/wireless/libertas/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -libertas-y += cfg.o -libertas-y += cmd.o -libertas-y += cmdresp.o -libertas-y += debugfs.o -libertas-y += ethtool.o -libertas-y += main.o -libertas-y += rx.o -libertas-y += tx.o -libertas-y += firmware.o -libertas-$(CONFIG_LIBERTAS_MESH) += mesh.o - -usb8xxx-objs += if_usb.o -libertas_cs-objs += if_cs.o -libertas_sdio-objs += if_sdio.o -libertas_spi-objs += if_spi.o - -obj-$(CONFIG_LIBERTAS) += libertas.o -obj-$(CONFIG_LIBERTAS_USB) += usb8xxx.o -obj-$(CONFIG_LIBERTAS_CS) += libertas_cs.o -obj-$(CONFIG_LIBERTAS_SDIO) += libertas_sdio.o -obj-$(CONFIG_LIBERTAS_SPI) += libertas_spi.o diff --git a/drivers/net/wireless/libertas/README b/drivers/net/wireless/libertas/README deleted file mode 100644 index 91f2ca90c70f..000000000000 --- a/drivers/net/wireless/libertas/README +++ /dev/null @@ -1,240 +0,0 @@ -================================================================================ - README for Libertas - - (c) Copyright © 2003-2006, Marvell International Ltd. - All Rights Reserved - - This software file (the "File") is distributed by Marvell International - Ltd. under the terms of the GNU General Public License Version 2, June 1991 - (the "License"). You may use, redistribute and/or modify this File in - accordance with the terms and conditions of the License, a copy of which - is available along with the File in the license.txt file or by writing to - the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 or on the worldwide web at http://www.gnu.org/licenses/gpl.txt. - - THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - ARE EXPRESSLY DISCLAIMED. The License provides additional details about - this warranty disclaimer. -================================================================================ - -===================== -DRIVER LOADING -===================== - - o. Copy the firmware image (e.g. usb8388.bin) to /lib/firmware/ - - o. Load driver by using the following command: - - insmod usb8388.ko [fw_name=usb8388.bin] - -========================= -ETHTOOL -========================= - - -Use the -i option to retrieve version information from the driver. - -# ethtool -i eth0 -driver: libertas -version: COMM-USB8388-318.p4 -firmware-version: 5.110.7 -bus-info: - -Use the -e option to read the EEPROM contents of the card. - - Usage: - ethtool -e ethX [raw on|off] [offset N] [length N] - - -e retrieves and prints an EEPROM dump for the specified ethernet - device. When raw is enabled, then it dumps the raw EEPROM data - to stdout. The length and offset parameters allow dumping cer- - tain portions of the EEPROM. Default is to dump the entire EEP- - ROM. - -# ethtool -e eth0 offset 0 length 16 -Offset Values ------- ------ -0x0000 38 33 30 58 00 00 34 f4 00 00 10 00 00 c4 17 00 - -======================== -DEBUGFS COMMANDS -======================== - -those commands are used via debugfs interface - -=========== -rdmac -rdbbp -rdrf - These commands are used to read the MAC, BBP and RF registers from the - card. These commands take one parameter that specifies the offset - location that is to be read. This parameter must be specified in - hexadecimal (its possible to precede preceding the number with a "0x"). - - Path: /sys/kernel/debug/libertas_wireless/ethX/registers/ - - Usage: - echo "0xa123" > rdmac ; cat rdmac - echo "0xa123" > rdbbp ; cat rdbbp - echo "0xa123" > rdrf ; cat rdrf -wrmac -wrbbp -wrrf - These commands are used to write the MAC, BBP and RF registers in the - card. These commands take two parameters that specify the offset - location and the value that is to be written. This parameters must - be specified in hexadecimal (its possible to precede the number - with a "0x"). - - Usage: - echo "0xa123 0xaa" > wrmac - echo "0xa123 0xaa" > wrbbp - echo "0xa123 0xaa" > wrrf - -sleepparams - This command is used to set the sleepclock configurations - - Path: /sys/kernel/debug/libertas_wireless/ethX/ - - Usage: - cat sleepparams: reads the current sleepclock configuration - - echo "p1 p2 p3 p4 p5 p6" > sleepparams: writes the sleepclock configuration. - - where: - p1 is Sleep clock error in ppm (0-65535) - p2 is Wakeup offset in usec (0-65535) - p3 is Clock stabilization time in usec (0-65535) - p4 is Control periodic calibration (0-2) - p5 is Control the use of external sleep clock (0-2) - p6 is reserved for debug (0-65535) - -subscribed_events - - The subscribed_events directory contains the interface for the - subscribed events API. - - Path: /sys/kernel/debug/libertas_wireless/ethX/subscribed_events/ - - Each event is represented by a filename. Each filename consists of the - following three fields: - Value Frequency Subscribed - - To read the current values for a given event, do: - cat event - To set the current values, do: - echo "60 2 1" > event - - Frequency field specifies the reporting frequency for this event. - If it is set to 0, then the event is reported only once, and then - automatically unsubscribed. If it is set to 1, then the event is - reported every time it occurs. If it is set to N, then the event is - reported every Nth time it occurs. - - beacon_missed - Value field specifies the number of consecutive missing beacons which - triggers the LINK_LOSS event. This event is generated only once after - which the firmware resets its state. At initialization, the LINK_LOSS - event is subscribed by default. The default value of MissedBeacons is - 60. - - failure_count - Value field specifies the consecutive failure count threshold which - triggers the generation of the MAX_FAIL event. Once this event is - generated, the consecutive failure count is reset to 0. - At initialization, the MAX_FAIL event is NOT subscribed by - default. - - high_rssi - This event is generated when the average received RSSI in beacons goes - above a threshold, specified by Value. - - low_rssi - This event is generated when the average received RSSI in beacons goes - below a threshold, specified by Value. - - high_snr - This event is generated when the average received SNR in beacons goes - above a threshold, specified by Value. - - low_snr - This event is generated when the average received SNR in beacons goes - below a threshold, specified by Value. - -extscan - This command is used to do a specific scan. - - Path: /sys/kernel/debug/libertas_wireless/ethX/ - - Usage: echo "SSID" > extscan - - Example: - echo "LINKSYS-AP" > extscan - - To see the results of use getscantable command. - -getscantable - - Display the current contents of the driver scan table (ie. get the - scan results). - - Path: /sys/kernel/debug/libertas_wireless/ethX/ - - Usage: - cat getscantable - -setuserscan - Initiate a customized scan and retrieve the results - - - Path: /sys/kernel/debug/libertas_wireless/ethX/ - - Usage: - echo "[ARGS]" > setuserscan - - where [ARGS]: - - bssid=xx:xx:xx:xx:xx:xx specify a BSSID filter for the scan - ssid="[SSID]" specify a SSID filter for the scan - keep=[0 or 1] keep the previous scan results (1), discard (0) - dur=[scan time] time to scan for each channel in milliseconds - type=[1,2,3] BSS type: 1 (Infra), 2(Adhoc), 3(Any) - - Any combination of the above arguments can be supplied on the command - line. If dur tokens are absent, the driver default setting will be used. - The bssid and ssid fields, if blank, will produce an unfiltered scan. - The type field will default to 3 (Any) and the keep field will default - to 0 (Discard). - - Examples: - 1) Perform a passive scan on all channels for 20 ms per channel: - echo "dur=20" > setuserscan - - 2) Perform an active scan for a specific SSID: - echo "ssid="TestAP"" > setuserscan - - 3) Scan all available channels (B/G, A bands) for a specific BSSID, keep - the current scan table intact, update existing or append new scan data: - echo "bssid=00:50:43:20:12:82 keep=1" > setuserscan - - 4) Scan for all infrastructure networks. - Keep the previous scan table intact. Update any duplicate BSSID/SSID - matches with the new scan data: - echo "type=1 keep=1" > setuserscan - - All entries in the scan table (not just the new scan data when keep=1) - will be displayed upon completion by use of the getscantable ioctl. - -hostsleep - This command is used to enable/disable host sleep. - Note: Host sleep parameters should be configured using - "ethtool -s ethX wol X" command before enabling host sleep. - - Path: /sys/kernel/debug/libertas_wireless/ethX/ - - Usage: - cat hostsleep: reads the current hostsleep state - echo "1" > hostsleep : enable host sleep. - echo "0" > hostsleep : disable host sleep - diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c deleted file mode 100644 index 116f4aba08d6..000000000000 --- a/drivers/net/wireless/libertas/cfg.c +++ /dev/null @@ -1,2223 +0,0 @@ -/* - * Implement cfg80211 ("iw") support. - * - * Copyright (C) 2009 M&N Solutions GmbH, 61191 Rosbach, Germany - * Holger Schurig - * - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include - -#include "decl.h" -#include "cfg.h" -#include "cmd.h" -#include "mesh.h" - - -#define CHAN2G(_channel, _freq, _flags) { \ - .band = IEEE80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ -} - -static struct ieee80211_channel lbs_2ghz_channels[] = { - CHAN2G(1, 2412, 0), - CHAN2G(2, 2417, 0), - CHAN2G(3, 2422, 0), - CHAN2G(4, 2427, 0), - CHAN2G(5, 2432, 0), - CHAN2G(6, 2437, 0), - CHAN2G(7, 2442, 0), - CHAN2G(8, 2447, 0), - CHAN2G(9, 2452, 0), - CHAN2G(10, 2457, 0), - CHAN2G(11, 2462, 0), - CHAN2G(12, 2467, 0), - CHAN2G(13, 2472, 0), - CHAN2G(14, 2484, 0), -}; - -#define RATETAB_ENT(_rate, _hw_value, _flags) { \ - .bitrate = (_rate), \ - .hw_value = (_hw_value), \ - .flags = (_flags), \ -} - - -/* Table 6 in section 3.2.1.1 */ -static struct ieee80211_rate lbs_rates[] = { - RATETAB_ENT(10, 0, 0), - RATETAB_ENT(20, 1, 0), - RATETAB_ENT(55, 2, 0), - RATETAB_ENT(110, 3, 0), - RATETAB_ENT(60, 9, 0), - RATETAB_ENT(90, 6, 0), - RATETAB_ENT(120, 7, 0), - RATETAB_ENT(180, 8, 0), - RATETAB_ENT(240, 9, 0), - RATETAB_ENT(360, 10, 0), - RATETAB_ENT(480, 11, 0), - RATETAB_ENT(540, 12, 0), -}; - -static struct ieee80211_supported_band lbs_band_2ghz = { - .channels = lbs_2ghz_channels, - .n_channels = ARRAY_SIZE(lbs_2ghz_channels), - .bitrates = lbs_rates, - .n_bitrates = ARRAY_SIZE(lbs_rates), -}; - - -static const u32 cipher_suites[] = { - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, -}; - -/* Time to stay on the channel */ -#define LBS_DWELL_PASSIVE 100 -#define LBS_DWELL_ACTIVE 40 - - -/*************************************************************************** - * Misc utility functions - * - * TLVs are Marvell specific. They are very similar to IEs, they have the - * same structure: type, length, data*. The only difference: for IEs, the - * type and length are u8, but for TLVs they're __le16. - */ - -/* - * Convert NL80211's auth_type to the one from Libertas, see chapter 5.9.1 - * in the firmware spec - */ -static int lbs_auth_to_authtype(enum nl80211_auth_type auth_type) -{ - int ret = -ENOTSUPP; - - switch (auth_type) { - case NL80211_AUTHTYPE_OPEN_SYSTEM: - case NL80211_AUTHTYPE_SHARED_KEY: - ret = auth_type; - break; - case NL80211_AUTHTYPE_AUTOMATIC: - ret = NL80211_AUTHTYPE_OPEN_SYSTEM; - break; - case NL80211_AUTHTYPE_NETWORK_EAP: - ret = 0x80; - break; - default: - /* silence compiler */ - break; - } - return ret; -} - - -/* - * Various firmware commands need the list of supported rates, but with - * the hight-bit set for basic rates - */ -static int lbs_add_rates(u8 *rates) -{ - size_t i; - - for (i = 0; i < ARRAY_SIZE(lbs_rates); i++) { - u8 rate = lbs_rates[i].bitrate / 5; - if (rate == 0x02 || rate == 0x04 || - rate == 0x0b || rate == 0x16) - rate |= 0x80; - rates[i] = rate; - } - return ARRAY_SIZE(lbs_rates); -} - - -/*************************************************************************** - * TLV utility functions - * - * TLVs are Marvell specific. They are very similar to IEs, they have the - * same structure: type, length, data*. The only difference: for IEs, the - * type and length are u8, but for TLVs they're __le16. - */ - - -/* - * Add ssid TLV - */ -#define LBS_MAX_SSID_TLV_SIZE \ - (sizeof(struct mrvl_ie_header) \ - + IEEE80211_MAX_SSID_LEN) - -static int lbs_add_ssid_tlv(u8 *tlv, const u8 *ssid, int ssid_len) -{ - struct mrvl_ie_ssid_param_set *ssid_tlv = (void *)tlv; - - /* - * TLV-ID SSID 00 00 - * length 06 00 - * ssid 4d 4e 54 45 53 54 - */ - ssid_tlv->header.type = cpu_to_le16(TLV_TYPE_SSID); - ssid_tlv->header.len = cpu_to_le16(ssid_len); - memcpy(ssid_tlv->ssid, ssid, ssid_len); - return sizeof(ssid_tlv->header) + ssid_len; -} - - -/* - * Add channel list TLV (section 8.4.2) - * - * Actual channel data comes from priv->wdev->wiphy->channels. - */ -#define LBS_MAX_CHANNEL_LIST_TLV_SIZE \ - (sizeof(struct mrvl_ie_header) \ - + (LBS_SCAN_BEFORE_NAP * sizeof(struct chanscanparamset))) - -static int lbs_add_channel_list_tlv(struct lbs_private *priv, u8 *tlv, - int last_channel, int active_scan) -{ - int chanscanparamsize = sizeof(struct chanscanparamset) * - (last_channel - priv->scan_channel); - - struct mrvl_ie_header *header = (void *) tlv; - - /* - * TLV-ID CHANLIST 01 01 - * length 0e 00 - * channel 00 01 00 00 00 64 00 - * radio type 00 - * channel 01 - * scan type 00 - * min scan time 00 00 - * max scan time 64 00 - * channel 2 00 02 00 00 00 64 00 - * - */ - - header->type = cpu_to_le16(TLV_TYPE_CHANLIST); - header->len = cpu_to_le16(chanscanparamsize); - tlv += sizeof(struct mrvl_ie_header); - - /* lbs_deb_scan("scan: channels %d to %d\n", priv->scan_channel, - last_channel); */ - memset(tlv, 0, chanscanparamsize); - - while (priv->scan_channel < last_channel) { - struct chanscanparamset *param = (void *) tlv; - - param->radiotype = CMD_SCAN_RADIO_TYPE_BG; - param->channumber = - priv->scan_req->channels[priv->scan_channel]->hw_value; - if (active_scan) { - param->maxscantime = cpu_to_le16(LBS_DWELL_ACTIVE); - } else { - param->chanscanmode.passivescan = 1; - param->maxscantime = cpu_to_le16(LBS_DWELL_PASSIVE); - } - tlv += sizeof(struct chanscanparamset); - priv->scan_channel++; - } - return sizeof(struct mrvl_ie_header) + chanscanparamsize; -} - - -/* - * Add rates TLV - * - * The rates are in lbs_bg_rates[], but for the 802.11b - * rates the high bit is set. We add this TLV only because - * there's a firmware which otherwise doesn't report all - * APs in range. - */ -#define LBS_MAX_RATES_TLV_SIZE \ - (sizeof(struct mrvl_ie_header) \ - + (ARRAY_SIZE(lbs_rates))) - -/* Adds a TLV with all rates the hardware supports */ -static int lbs_add_supported_rates_tlv(u8 *tlv) -{ - size_t i; - struct mrvl_ie_rates_param_set *rate_tlv = (void *)tlv; - - /* - * TLV-ID RATES 01 00 - * length 0e 00 - * rates 82 84 8b 96 0c 12 18 24 30 48 60 6c - */ - rate_tlv->header.type = cpu_to_le16(TLV_TYPE_RATES); - tlv += sizeof(rate_tlv->header); - i = lbs_add_rates(tlv); - tlv += i; - rate_tlv->header.len = cpu_to_le16(i); - return sizeof(rate_tlv->header) + i; -} - -/* Add common rates from a TLV and return the new end of the TLV */ -static u8 * -add_ie_rates(u8 *tlv, const u8 *ie, int *nrates) -{ - int hw, ap, ap_max = ie[1]; - u8 hw_rate; - - /* Advance past IE header */ - ie += 2; - - lbs_deb_hex(LBS_DEB_ASSOC, "AP IE Rates", (u8 *) ie, ap_max); - - for (hw = 0; hw < ARRAY_SIZE(lbs_rates); hw++) { - hw_rate = lbs_rates[hw].bitrate / 5; - for (ap = 0; ap < ap_max; ap++) { - if (hw_rate == (ie[ap] & 0x7f)) { - *tlv++ = ie[ap]; - *nrates = *nrates + 1; - } - } - } - return tlv; -} - -/* - * Adds a TLV with all rates the hardware *and* BSS supports. - */ -static int lbs_add_common_rates_tlv(u8 *tlv, struct cfg80211_bss *bss) -{ - struct mrvl_ie_rates_param_set *rate_tlv = (void *)tlv; - const u8 *rates_eid, *ext_rates_eid; - int n = 0; - - rcu_read_lock(); - rates_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SUPP_RATES); - ext_rates_eid = ieee80211_bss_get_ie(bss, WLAN_EID_EXT_SUPP_RATES); - - /* - * 01 00 TLV_TYPE_RATES - * 04 00 len - * 82 84 8b 96 rates - */ - rate_tlv->header.type = cpu_to_le16(TLV_TYPE_RATES); - tlv += sizeof(rate_tlv->header); - - /* Add basic rates */ - if (rates_eid) { - tlv = add_ie_rates(tlv, rates_eid, &n); - - /* Add extended rates, if any */ - if (ext_rates_eid) - tlv = add_ie_rates(tlv, ext_rates_eid, &n); - } else { - lbs_deb_assoc("assoc: bss had no basic rate IE\n"); - /* Fallback: add basic 802.11b rates */ - *tlv++ = 0x82; - *tlv++ = 0x84; - *tlv++ = 0x8b; - *tlv++ = 0x96; - n = 4; - } - rcu_read_unlock(); - - rate_tlv->header.len = cpu_to_le16(n); - return sizeof(rate_tlv->header) + n; -} - - -/* - * Add auth type TLV. - * - * This is only needed for newer firmware (V9 and up). - */ -#define LBS_MAX_AUTH_TYPE_TLV_SIZE \ - sizeof(struct mrvl_ie_auth_type) - -static int lbs_add_auth_type_tlv(u8 *tlv, enum nl80211_auth_type auth_type) -{ - struct mrvl_ie_auth_type *auth = (void *) tlv; - - /* - * 1f 01 TLV_TYPE_AUTH_TYPE - * 01 00 len - * 01 auth type - */ - auth->header.type = cpu_to_le16(TLV_TYPE_AUTH_TYPE); - auth->header.len = cpu_to_le16(sizeof(*auth)-sizeof(auth->header)); - auth->auth = cpu_to_le16(lbs_auth_to_authtype(auth_type)); - return sizeof(*auth); -} - - -/* - * Add channel (phy ds) TLV - */ -#define LBS_MAX_CHANNEL_TLV_SIZE \ - sizeof(struct mrvl_ie_header) - -static int lbs_add_channel_tlv(u8 *tlv, u8 channel) -{ - struct mrvl_ie_ds_param_set *ds = (void *) tlv; - - /* - * 03 00 TLV_TYPE_PHY_DS - * 01 00 len - * 06 channel - */ - ds->header.type = cpu_to_le16(TLV_TYPE_PHY_DS); - ds->header.len = cpu_to_le16(sizeof(*ds)-sizeof(ds->header)); - ds->channel = channel; - return sizeof(*ds); -} - - -/* - * Add (empty) CF param TLV of the form: - */ -#define LBS_MAX_CF_PARAM_TLV_SIZE \ - sizeof(struct mrvl_ie_header) - -static int lbs_add_cf_param_tlv(u8 *tlv) -{ - struct mrvl_ie_cf_param_set *cf = (void *)tlv; - - /* - * 04 00 TLV_TYPE_CF - * 06 00 len - * 00 cfpcnt - * 00 cfpperiod - * 00 00 cfpmaxduration - * 00 00 cfpdurationremaining - */ - cf->header.type = cpu_to_le16(TLV_TYPE_CF); - cf->header.len = cpu_to_le16(sizeof(*cf)-sizeof(cf->header)); - return sizeof(*cf); -} - -/* - * Add WPA TLV - */ -#define LBS_MAX_WPA_TLV_SIZE \ - (sizeof(struct mrvl_ie_header) \ - + 128 /* TODO: I guessed the size */) - -static int lbs_add_wpa_tlv(u8 *tlv, const u8 *ie, u8 ie_len) -{ - size_t tlv_len; - - /* - * We need just convert an IE to an TLV. IEs use u8 for the header, - * u8 type - * u8 len - * u8[] data - * but TLVs use __le16 instead: - * __le16 type - * __le16 len - * u8[] data - */ - *tlv++ = *ie++; - *tlv++ = 0; - tlv_len = *tlv++ = *ie++; - *tlv++ = 0; - while (tlv_len--) - *tlv++ = *ie++; - /* the TLV is two bytes larger than the IE */ - return ie_len + 2; -} - -/* - * Set Channel - */ - -static int lbs_cfg_set_monitor_channel(struct wiphy *wiphy, - struct cfg80211_chan_def *chandef) -{ - struct lbs_private *priv = wiphy_priv(wiphy); - int ret = -ENOTSUPP; - - lbs_deb_enter_args(LBS_DEB_CFG80211, "freq %d, type %d", - chandef->chan->center_freq, - cfg80211_get_chandef_type(chandef)); - - if (cfg80211_get_chandef_type(chandef) != NL80211_CHAN_NO_HT) - goto out; - - ret = lbs_set_channel(priv, chandef->chan->hw_value); - - out: - lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); - return ret; -} - -static int lbs_cfg_set_mesh_channel(struct wiphy *wiphy, - struct net_device *netdev, - struct ieee80211_channel *channel) -{ - struct lbs_private *priv = wiphy_priv(wiphy); - int ret = -ENOTSUPP; - - lbs_deb_enter_args(LBS_DEB_CFG80211, "iface %s freq %d", - netdev_name(netdev), channel->center_freq); - - if (netdev != priv->mesh_dev) - goto out; - - ret = lbs_mesh_set_channel(priv, channel->hw_value); - - out: - lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); - return ret; -} - - - -/* - * Scanning - */ - -/* - * When scanning, the firmware doesn't send a nul packet with the power-safe - * bit to the AP. So we cannot stay away from our current channel too long, - * otherwise we loose data. So take a "nap" while scanning every other - * while. - */ -#define LBS_SCAN_BEFORE_NAP 4 - - -/* - * When the firmware reports back a scan-result, it gives us an "u8 rssi", - * which isn't really an RSSI, as it becomes larger when moving away from - * the AP. Anyway, we need to convert that into mBm. - */ -#define LBS_SCAN_RSSI_TO_MBM(rssi) \ - ((-(int)rssi + 3)*100) - -static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy, - struct cmd_header *resp) -{ - struct cfg80211_bss *bss; - struct cmd_ds_802_11_scan_rsp *scanresp = (void *)resp; - int bsssize; - const u8 *pos; - const u8 *tsfdesc; - int tsfsize; - int i; - int ret = -EILSEQ; - - lbs_deb_enter(LBS_DEB_CFG80211); - - bsssize = get_unaligned_le16(&scanresp->bssdescriptsize); - - lbs_deb_scan("scan response: %d BSSs (%d bytes); resp size %d bytes\n", - scanresp->nr_sets, bsssize, le16_to_cpu(resp->size)); - - if (scanresp->nr_sets == 0) { - ret = 0; - goto done; - } - - /* - * The general layout of the scan response is described in chapter - * 5.7.1. Basically we have a common part, then any number of BSS - * descriptor sections. Finally we have section with the same number - * of TSFs. - * - * cmd_ds_802_11_scan_rsp - * cmd_header - * pos_size - * nr_sets - * bssdesc 1 - * bssid - * rssi - * timestamp - * intvl - * capa - * IEs - * bssdesc 2 - * bssdesc n - * MrvlIEtypes_TsfFimestamp_t - * TSF for BSS 1 - * TSF for BSS 2 - * TSF for BSS n - */ - - pos = scanresp->bssdesc_and_tlvbuffer; - - lbs_deb_hex(LBS_DEB_SCAN, "SCAN_RSP", scanresp->bssdesc_and_tlvbuffer, - scanresp->bssdescriptsize); - - tsfdesc = pos + bsssize; - tsfsize = 4 + 8 * scanresp->nr_sets; - lbs_deb_hex(LBS_DEB_SCAN, "SCAN_TSF", (u8 *) tsfdesc, tsfsize); - - /* Validity check: we expect a Marvell-Local TLV */ - i = get_unaligned_le16(tsfdesc); - tsfdesc += 2; - if (i != TLV_TYPE_TSFTIMESTAMP) { - lbs_deb_scan("scan response: invalid TSF Timestamp %d\n", i); - goto done; - } - - /* - * Validity check: the TLV holds TSF values with 8 bytes each, so - * the size in the TLV must match the nr_sets value - */ - i = get_unaligned_le16(tsfdesc); - tsfdesc += 2; - if (i / 8 != scanresp->nr_sets) { - lbs_deb_scan("scan response: invalid number of TSF timestamp " - "sets (expected %d got %d)\n", scanresp->nr_sets, - i / 8); - goto done; - } - - for (i = 0; i < scanresp->nr_sets; i++) { - const u8 *bssid; - const u8 *ie; - int left; - int ielen; - int rssi; - u16 intvl; - u16 capa; - int chan_no = -1; - const u8 *ssid = NULL; - u8 ssid_len = 0; - DECLARE_SSID_BUF(ssid_buf); - - int len = get_unaligned_le16(pos); - pos += 2; - - /* BSSID */ - bssid = pos; - pos += ETH_ALEN; - /* RSSI */ - rssi = *pos++; - /* Packet time stamp */ - pos += 8; - /* Beacon interval */ - intvl = get_unaligned_le16(pos); - pos += 2; - /* Capabilities */ - capa = get_unaligned_le16(pos); - pos += 2; - - /* To find out the channel, we must parse the IEs */ - ie = pos; - /* - * 6+1+8+2+2: size of BSSID, RSSI, time stamp, beacon - * interval, capabilities - */ - ielen = left = len - (6 + 1 + 8 + 2 + 2); - while (left >= 2) { - u8 id, elen; - id = *pos++; - elen = *pos++; - left -= 2; - if (elen > left || elen == 0) { - lbs_deb_scan("scan response: invalid IE fmt\n"); - goto done; - } - - if (id == WLAN_EID_DS_PARAMS) - chan_no = *pos; - if (id == WLAN_EID_SSID) { - ssid = pos; - ssid_len = elen; - } - left -= elen; - pos += elen; - } - - /* No channel, no luck */ - if (chan_no != -1) { - struct wiphy *wiphy = priv->wdev->wiphy; - int freq = ieee80211_channel_to_frequency(chan_no, - IEEE80211_BAND_2GHZ); - struct ieee80211_channel *channel = - ieee80211_get_channel(wiphy, freq); - - lbs_deb_scan("scan: %pM, capa %04x, chan %2d, %s, " - "%d dBm\n", - bssid, capa, chan_no, - print_ssid(ssid_buf, ssid, ssid_len), - LBS_SCAN_RSSI_TO_MBM(rssi)/100); - - if (channel && - !(channel->flags & IEEE80211_CHAN_DISABLED)) { - bss = cfg80211_inform_bss(wiphy, channel, - bssid, get_unaligned_le64(tsfdesc), - capa, intvl, ie, ielen, - LBS_SCAN_RSSI_TO_MBM(rssi), - GFP_KERNEL); - cfg80211_put_bss(wiphy, bss); - } - } else - lbs_deb_scan("scan response: missing BSS channel IE\n"); - - tsfdesc += 8; - } - ret = 0; - - done: - lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); - return ret; -} - - -/* - * Our scan command contains a TLV, consting of a SSID TLV, a channel list - * TLV and a rates TLV. Determine the maximum size of them: - */ -#define LBS_SCAN_MAX_CMD_SIZE \ - (sizeof(struct cmd_ds_802_11_scan) \ - + LBS_MAX_SSID_TLV_SIZE \ - + LBS_MAX_CHANNEL_LIST_TLV_SIZE \ - + LBS_MAX_RATES_TLV_SIZE) - -/* - * Assumes priv->scan_req is initialized and valid - * Assumes priv->scan_channel is initialized - */ -static void lbs_scan_worker(struct work_struct *work) -{ - struct lbs_private *priv = - container_of(work, struct lbs_private, scan_work.work); - struct cmd_ds_802_11_scan *scan_cmd; - u8 *tlv; /* pointer into our current, growing TLV storage area */ - int last_channel; - int running, carrier; - - lbs_deb_enter(LBS_DEB_SCAN); - - scan_cmd = kzalloc(LBS_SCAN_MAX_CMD_SIZE, GFP_KERNEL); - if (scan_cmd == NULL) - goto out_no_scan_cmd; - - /* prepare fixed part of scan command */ - scan_cmd->bsstype = CMD_BSS_TYPE_ANY; - - /* stop network while we're away from our main channel */ - running = !netif_queue_stopped(priv->dev); - carrier = netif_carrier_ok(priv->dev); - if (running) - netif_stop_queue(priv->dev); - if (carrier) - netif_carrier_off(priv->dev); - - /* prepare fixed part of scan command */ - tlv = scan_cmd->tlvbuffer; - - /* add SSID TLV */ - if (priv->scan_req->n_ssids && priv->scan_req->ssids[0].ssid_len > 0) - tlv += lbs_add_ssid_tlv(tlv, - priv->scan_req->ssids[0].ssid, - priv->scan_req->ssids[0].ssid_len); - - /* add channel TLVs */ - last_channel = priv->scan_channel + LBS_SCAN_BEFORE_NAP; - if (last_channel > priv->scan_req->n_channels) - last_channel = priv->scan_req->n_channels; - tlv += lbs_add_channel_list_tlv(priv, tlv, last_channel, - priv->scan_req->n_ssids); - - /* add rates TLV */ - tlv += lbs_add_supported_rates_tlv(tlv); - - if (priv->scan_channel < priv->scan_req->n_channels) { - cancel_delayed_work(&priv->scan_work); - if (netif_running(priv->dev)) - queue_delayed_work(priv->work_thread, &priv->scan_work, - msecs_to_jiffies(300)); - } - - /* This is the final data we are about to send */ - scan_cmd->hdr.size = cpu_to_le16(tlv - (u8 *)scan_cmd); - lbs_deb_hex(LBS_DEB_SCAN, "SCAN_CMD", (void *)scan_cmd, - sizeof(*scan_cmd)); - lbs_deb_hex(LBS_DEB_SCAN, "SCAN_TLV", scan_cmd->tlvbuffer, - tlv - scan_cmd->tlvbuffer); - - __lbs_cmd(priv, CMD_802_11_SCAN, &scan_cmd->hdr, - le16_to_cpu(scan_cmd->hdr.size), - lbs_ret_scan, 0); - - if (priv->scan_channel >= priv->scan_req->n_channels) { - /* Mark scan done */ - cancel_delayed_work(&priv->scan_work); - lbs_scan_done(priv); - } - - /* Restart network */ - if (carrier) - netif_carrier_on(priv->dev); - if (running && !priv->tx_pending_len) - netif_wake_queue(priv->dev); - - kfree(scan_cmd); - - /* Wake up anything waiting on scan completion */ - if (priv->scan_req == NULL) { - lbs_deb_scan("scan: waking up waiters\n"); - wake_up_all(&priv->scan_q); - } - - out_no_scan_cmd: - lbs_deb_leave(LBS_DEB_SCAN); -} - -static void _internal_start_scan(struct lbs_private *priv, bool internal, - struct cfg80211_scan_request *request) -{ - lbs_deb_enter(LBS_DEB_CFG80211); - - lbs_deb_scan("scan: ssids %d, channels %d, ie_len %zd\n", - request->n_ssids, request->n_channels, request->ie_len); - - priv->scan_channel = 0; - priv->scan_req = request; - priv->internal_scan = internal; - - queue_delayed_work(priv->work_thread, &priv->scan_work, - msecs_to_jiffies(50)); - - lbs_deb_leave(LBS_DEB_CFG80211); -} - -/* - * Clean up priv->scan_req. Should be used to handle the allocation details. - */ -void lbs_scan_done(struct lbs_private *priv) -{ - WARN_ON(!priv->scan_req); - - if (priv->internal_scan) - kfree(priv->scan_req); - else - cfg80211_scan_done(priv->scan_req, false); - - priv->scan_req = NULL; -} - -static int lbs_cfg_scan(struct wiphy *wiphy, - struct cfg80211_scan_request *request) -{ - struct lbs_private *priv = wiphy_priv(wiphy); - int ret = 0; - - lbs_deb_enter(LBS_DEB_CFG80211); - - if (priv->scan_req || delayed_work_pending(&priv->scan_work)) { - /* old scan request not yet processed */ - ret = -EAGAIN; - goto out; - } - - _internal_start_scan(priv, false, request); - - if (priv->surpriseremoved) - ret = -EIO; - - out: - lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); - return ret; -} - - - - -/* - * Events - */ - -void lbs_send_disconnect_notification(struct lbs_private *priv) -{ - lbs_deb_enter(LBS_DEB_CFG80211); - - cfg80211_disconnected(priv->dev, - 0, - NULL, 0, - GFP_KERNEL); - - lbs_deb_leave(LBS_DEB_CFG80211); -} - -void lbs_send_mic_failureevent(struct lbs_private *priv, u32 event) -{ - lbs_deb_enter(LBS_DEB_CFG80211); - - cfg80211_michael_mic_failure(priv->dev, - priv->assoc_bss, - event == MACREG_INT_CODE_MIC_ERR_MULTICAST ? - NL80211_KEYTYPE_GROUP : - NL80211_KEYTYPE_PAIRWISE, - -1, - NULL, - GFP_KERNEL); - - lbs_deb_leave(LBS_DEB_CFG80211); -} - - - - -/* - * Connect/disconnect - */ - - -/* - * This removes all WEP keys - */ -static int lbs_remove_wep_keys(struct lbs_private *priv) -{ - struct cmd_ds_802_11_set_wep cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CFG80211); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.keyindex = cpu_to_le16(priv->wep_tx_key); - cmd.action = cpu_to_le16(CMD_ACT_REMOVE); - - ret = lbs_cmd_with_response(priv, CMD_802_11_SET_WEP, &cmd); - - lbs_deb_leave(LBS_DEB_CFG80211); - return ret; -} - -/* - * Set WEP keys - */ -static int lbs_set_wep_keys(struct lbs_private *priv) -{ - struct cmd_ds_802_11_set_wep cmd; - int i; - int ret; - - lbs_deb_enter(LBS_DEB_CFG80211); - - /* - * command 13 00 - * size 50 00 - * sequence xx xx - * result 00 00 - * action 02 00 ACT_ADD - * transmit key 00 00 - * type for key 1 01 WEP40 - * type for key 2 00 - * type for key 3 00 - * type for key 4 00 - * key 1 39 39 39 39 39 00 00 00 - * 00 00 00 00 00 00 00 00 - * key 2 00 00 00 00 00 00 00 00 - * 00 00 00 00 00 00 00 00 - * key 3 00 00 00 00 00 00 00 00 - * 00 00 00 00 00 00 00 00 - * key 4 00 00 00 00 00 00 00 00 - */ - if (priv->wep_key_len[0] || priv->wep_key_len[1] || - priv->wep_key_len[2] || priv->wep_key_len[3]) { - /* Only set wep keys if we have at least one of them */ - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.keyindex = cpu_to_le16(priv->wep_tx_key); - cmd.action = cpu_to_le16(CMD_ACT_ADD); - - for (i = 0; i < 4; i++) { - switch (priv->wep_key_len[i]) { - case WLAN_KEY_LEN_WEP40: - cmd.keytype[i] = CMD_TYPE_WEP_40_BIT; - break; - case WLAN_KEY_LEN_WEP104: - cmd.keytype[i] = CMD_TYPE_WEP_104_BIT; - break; - default: - cmd.keytype[i] = 0; - break; - } - memcpy(cmd.keymaterial[i], priv->wep_key[i], - priv->wep_key_len[i]); - } - - ret = lbs_cmd_with_response(priv, CMD_802_11_SET_WEP, &cmd); - } else { - /* Otherwise remove all wep keys */ - ret = lbs_remove_wep_keys(priv); - } - - lbs_deb_leave(LBS_DEB_CFG80211); - return ret; -} - - -/* - * Enable/Disable RSN status - */ -static int lbs_enable_rsn(struct lbs_private *priv, int enable) -{ - struct cmd_ds_802_11_enable_rsn cmd; - int ret; - - lbs_deb_enter_args(LBS_DEB_CFG80211, "%d", enable); - - /* - * cmd 2f 00 - * size 0c 00 - * sequence xx xx - * result 00 00 - * action 01 00 ACT_SET - * enable 01 00 - */ - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - cmd.enable = cpu_to_le16(enable); - - ret = lbs_cmd_with_response(priv, CMD_802_11_ENABLE_RSN, &cmd); - - lbs_deb_leave(LBS_DEB_CFG80211); - return ret; -} - - -/* - * Set WPA/WPA key material - */ - -/* - * like "struct cmd_ds_802_11_key_material", but with cmd_header. Once we - * get rid of WEXT, this should go into host.h - */ - -struct cmd_key_material { - struct cmd_header hdr; - - __le16 action; - struct MrvlIEtype_keyParamSet param; -} __packed; - -static int lbs_set_key_material(struct lbs_private *priv, - int key_type, - int key_info, - u8 *key, u16 key_len) -{ - struct cmd_key_material cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CFG80211); - - /* - * Example for WPA (TKIP): - * - * cmd 5e 00 - * size 34 00 - * sequence xx xx - * result 00 00 - * action 01 00 - * TLV type 00 01 key param - * length 00 26 - * key type 01 00 TKIP - * key info 06 00 UNICAST | ENABLED - * key len 20 00 - * key 32 bytes - */ - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - cmd.param.type = cpu_to_le16(TLV_TYPE_KEY_MATERIAL); - cmd.param.length = cpu_to_le16(sizeof(cmd.param) - 4); - cmd.param.keytypeid = cpu_to_le16(key_type); - cmd.param.keyinfo = cpu_to_le16(key_info); - cmd.param.keylen = cpu_to_le16(key_len); - if (key && key_len) - memcpy(cmd.param.key, key, key_len); - - ret = lbs_cmd_with_response(priv, CMD_802_11_KEY_MATERIAL, &cmd); - - lbs_deb_leave(LBS_DEB_CFG80211); - return ret; -} - - -/* - * Sets the auth type (open, shared, etc) in the firmware. That - * we use CMD_802_11_AUTHENTICATE is misleading, this firmware - * command doesn't send an authentication frame at all, it just - * stores the auth_type. - */ -static int lbs_set_authtype(struct lbs_private *priv, - struct cfg80211_connect_params *sme) -{ - struct cmd_ds_802_11_authenticate cmd; - int ret; - - lbs_deb_enter_args(LBS_DEB_CFG80211, "%d", sme->auth_type); - - /* - * cmd 11 00 - * size 19 00 - * sequence xx xx - * result 00 00 - * BSS id 00 13 19 80 da 30 - * auth type 00 - * reserved 00 00 00 00 00 00 00 00 00 00 - */ - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - if (sme->bssid) - memcpy(cmd.bssid, sme->bssid, ETH_ALEN); - /* convert auth_type */ - ret = lbs_auth_to_authtype(sme->auth_type); - if (ret < 0) - goto done; - - cmd.authtype = ret; - ret = lbs_cmd_with_response(priv, CMD_802_11_AUTHENTICATE, &cmd); - - done: - lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); - return ret; -} - - -/* - * Create association request - */ -#define LBS_ASSOC_MAX_CMD_SIZE \ - (sizeof(struct cmd_ds_802_11_associate) \ - - 512 /* cmd_ds_802_11_associate.iebuf */ \ - + LBS_MAX_SSID_TLV_SIZE \ - + LBS_MAX_CHANNEL_TLV_SIZE \ - + LBS_MAX_CF_PARAM_TLV_SIZE \ - + LBS_MAX_AUTH_TYPE_TLV_SIZE \ - + LBS_MAX_WPA_TLV_SIZE) - -static int lbs_associate(struct lbs_private *priv, - struct cfg80211_bss *bss, - struct cfg80211_connect_params *sme) -{ - struct cmd_ds_802_11_associate_response *resp; - struct cmd_ds_802_11_associate *cmd = kzalloc(LBS_ASSOC_MAX_CMD_SIZE, - GFP_KERNEL); - const u8 *ssid_eid; - size_t len, resp_ie_len; - int status; - int ret; - u8 *pos = &(cmd->iebuf[0]); - u8 *tmp; - - lbs_deb_enter(LBS_DEB_CFG80211); - - if (!cmd) { - ret = -ENOMEM; - goto done; - } - - /* - * cmd 50 00 - * length 34 00 - * sequence xx xx - * result 00 00 - * BSS id 00 13 19 80 da 30 - * capabilities 11 00 - * listen interval 0a 00 - * beacon interval 00 00 - * DTIM period 00 - * TLVs xx (up to 512 bytes) - */ - cmd->hdr.command = cpu_to_le16(CMD_802_11_ASSOCIATE); - - /* Fill in static fields */ - memcpy(cmd->bssid, bss->bssid, ETH_ALEN); - cmd->listeninterval = cpu_to_le16(MRVDRV_DEFAULT_LISTEN_INTERVAL); - cmd->capability = cpu_to_le16(bss->capability); - - /* add SSID TLV */ - rcu_read_lock(); - ssid_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SSID); - if (ssid_eid) - pos += lbs_add_ssid_tlv(pos, ssid_eid + 2, ssid_eid[1]); - else - lbs_deb_assoc("no SSID\n"); - rcu_read_unlock(); - - /* add DS param TLV */ - if (bss->channel) - pos += lbs_add_channel_tlv(pos, bss->channel->hw_value); - else - lbs_deb_assoc("no channel\n"); - - /* add (empty) CF param TLV */ - pos += lbs_add_cf_param_tlv(pos); - - /* add rates TLV */ - tmp = pos + 4; /* skip Marvell IE header */ - pos += lbs_add_common_rates_tlv(pos, bss); - lbs_deb_hex(LBS_DEB_ASSOC, "Common Rates", tmp, pos - tmp); - - /* add auth type TLV */ - if (MRVL_FW_MAJOR_REV(priv->fwrelease) >= 9) - pos += lbs_add_auth_type_tlv(pos, sme->auth_type); - - /* add WPA/WPA2 TLV */ - if (sme->ie && sme->ie_len) - pos += lbs_add_wpa_tlv(pos, sme->ie, sme->ie_len); - - len = (sizeof(*cmd) - sizeof(cmd->iebuf)) + - (u16)(pos - (u8 *) &cmd->iebuf); - cmd->hdr.size = cpu_to_le16(len); - - lbs_deb_hex(LBS_DEB_ASSOC, "ASSOC_CMD", (u8 *) cmd, - le16_to_cpu(cmd->hdr.size)); - - /* store for later use */ - memcpy(priv->assoc_bss, bss->bssid, ETH_ALEN); - - ret = lbs_cmd_with_response(priv, CMD_802_11_ASSOCIATE, cmd); - if (ret) - goto done; - - /* generate connect message to cfg80211 */ - - resp = (void *) cmd; /* recast for easier field access */ - status = le16_to_cpu(resp->statuscode); - - /* Older FW versions map the IEEE 802.11 Status Code in the association - * response to the following values returned in resp->statuscode: - * - * IEEE Status Code Marvell Status Code - * 0 -> 0x0000 ASSOC_RESULT_SUCCESS - * 13 -> 0x0004 ASSOC_RESULT_AUTH_REFUSED - * 14 -> 0x0004 ASSOC_RESULT_AUTH_REFUSED - * 15 -> 0x0004 ASSOC_RESULT_AUTH_REFUSED - * 16 -> 0x0004 ASSOC_RESULT_AUTH_REFUSED - * others -> 0x0003 ASSOC_RESULT_REFUSED - * - * Other response codes: - * 0x0001 -> ASSOC_RESULT_INVALID_PARAMETERS (unused) - * 0x0002 -> ASSOC_RESULT_TIMEOUT (internal timer expired waiting for - * association response from the AP) - */ - if (MRVL_FW_MAJOR_REV(priv->fwrelease) <= 8) { - switch (status) { - case 0: - break; - case 1: - lbs_deb_assoc("invalid association parameters\n"); - status = WLAN_STATUS_CAPS_UNSUPPORTED; - break; - case 2: - lbs_deb_assoc("timer expired while waiting for AP\n"); - status = WLAN_STATUS_AUTH_TIMEOUT; - break; - case 3: - lbs_deb_assoc("association refused by AP\n"); - status = WLAN_STATUS_ASSOC_DENIED_UNSPEC; - break; - case 4: - lbs_deb_assoc("authentication refused by AP\n"); - status = WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION; - break; - default: - lbs_deb_assoc("association failure %d\n", status); - /* v5 OLPC firmware does return the AP status code if - * it's not one of the values above. Let that through. - */ - break; - } - } - - lbs_deb_assoc("status %d, statuscode 0x%04x, capability 0x%04x, " - "aid 0x%04x\n", status, le16_to_cpu(resp->statuscode), - le16_to_cpu(resp->capability), le16_to_cpu(resp->aid)); - - resp_ie_len = le16_to_cpu(resp->hdr.size) - - sizeof(resp->hdr) - - 6; - cfg80211_connect_result(priv->dev, - priv->assoc_bss, - sme->ie, sme->ie_len, - resp->iebuf, resp_ie_len, - status, - GFP_KERNEL); - - if (status == 0) { - /* TODO: get rid of priv->connect_status */ - priv->connect_status = LBS_CONNECTED; - netif_carrier_on(priv->dev); - if (!priv->tx_pending_len) - netif_tx_wake_all_queues(priv->dev); - } - - kfree(cmd); -done: - lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); - return ret; -} - -static struct cfg80211_scan_request * -_new_connect_scan_req(struct wiphy *wiphy, struct cfg80211_connect_params *sme) -{ - struct cfg80211_scan_request *creq = NULL; - int i, n_channels = 0; - enum ieee80211_band band; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - if (wiphy->bands[band]) - n_channels += wiphy->bands[band]->n_channels; - } - - creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) + - n_channels * sizeof(void *), - GFP_ATOMIC); - if (!creq) - return NULL; - - /* SSIDs come after channels */ - creq->ssids = (void *)&creq->channels[n_channels]; - creq->n_channels = n_channels; - creq->n_ssids = 1; - - /* Scan all available channels */ - i = 0; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - int j; - - if (!wiphy->bands[band]) - continue; - - for (j = 0; j < wiphy->bands[band]->n_channels; j++) { - /* ignore disabled channels */ - if (wiphy->bands[band]->channels[j].flags & - IEEE80211_CHAN_DISABLED) - continue; - - creq->channels[i] = &wiphy->bands[band]->channels[j]; - i++; - } - } - if (i) { - /* Set real number of channels specified in creq->channels[] */ - creq->n_channels = i; - - /* Scan for the SSID we're going to connect to */ - memcpy(creq->ssids[0].ssid, sme->ssid, sme->ssid_len); - creq->ssids[0].ssid_len = sme->ssid_len; - } else { - /* No channels found... */ - kfree(creq); - creq = NULL; - } - - return creq; -} - -static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_connect_params *sme) -{ - struct lbs_private *priv = wiphy_priv(wiphy); - struct cfg80211_bss *bss = NULL; - int ret = 0; - u8 preamble = RADIO_PREAMBLE_SHORT; - - if (dev == priv->mesh_dev) - return -EOPNOTSUPP; - - lbs_deb_enter(LBS_DEB_CFG80211); - - if (!sme->bssid) { - struct cfg80211_scan_request *creq; - - /* - * Scan for the requested network after waiting for existing - * scans to finish. - */ - lbs_deb_assoc("assoc: waiting for existing scans\n"); - wait_event_interruptible_timeout(priv->scan_q, - (priv->scan_req == NULL), - (15 * HZ)); - - creq = _new_connect_scan_req(wiphy, sme); - if (!creq) { - ret = -EINVAL; - goto done; - } - - lbs_deb_assoc("assoc: scanning for compatible AP\n"); - _internal_start_scan(priv, true, creq); - - lbs_deb_assoc("assoc: waiting for scan to complete\n"); - wait_event_interruptible_timeout(priv->scan_q, - (priv->scan_req == NULL), - (15 * HZ)); - lbs_deb_assoc("assoc: scanning competed\n"); - } - - /* Find the BSS we want using available scan results */ - bss = cfg80211_get_bss(wiphy, sme->channel, sme->bssid, - sme->ssid, sme->ssid_len, - WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); - if (!bss) { - wiphy_err(wiphy, "assoc: bss %pM not in scan results\n", - sme->bssid); - ret = -ENOENT; - goto done; - } - lbs_deb_assoc("trying %pM\n", bss->bssid); - lbs_deb_assoc("cipher 0x%x, key index %d, key len %d\n", - sme->crypto.cipher_group, - sme->key_idx, sme->key_len); - - /* As this is a new connection, clear locally stored WEP keys */ - priv->wep_tx_key = 0; - memset(priv->wep_key, 0, sizeof(priv->wep_key)); - memset(priv->wep_key_len, 0, sizeof(priv->wep_key_len)); - - /* set/remove WEP keys */ - switch (sme->crypto.cipher_group) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - /* Store provided WEP keys in priv-> */ - priv->wep_tx_key = sme->key_idx; - priv->wep_key_len[sme->key_idx] = sme->key_len; - memcpy(priv->wep_key[sme->key_idx], sme->key, sme->key_len); - /* Set WEP keys and WEP mode */ - lbs_set_wep_keys(priv); - priv->mac_control |= CMD_ACT_MAC_WEP_ENABLE; - lbs_set_mac_control(priv); - /* No RSN mode for WEP */ - lbs_enable_rsn(priv, 0); - break; - case 0: /* there's no WLAN_CIPHER_SUITE_NONE definition */ - /* - * If we don't have no WEP, no WPA and no WPA2, - * we remove all keys like in the WPA/WPA2 setup, - * we just don't set RSN. - * - * Therefore: fall-through - */ - case WLAN_CIPHER_SUITE_TKIP: - case WLAN_CIPHER_SUITE_CCMP: - /* Remove WEP keys and WEP mode */ - lbs_remove_wep_keys(priv); - priv->mac_control &= ~CMD_ACT_MAC_WEP_ENABLE; - lbs_set_mac_control(priv); - - /* clear the WPA/WPA2 keys */ - lbs_set_key_material(priv, - KEY_TYPE_ID_WEP, /* doesn't matter */ - KEY_INFO_WPA_UNICAST, - NULL, 0); - lbs_set_key_material(priv, - KEY_TYPE_ID_WEP, /* doesn't matter */ - KEY_INFO_WPA_MCAST, - NULL, 0); - /* RSN mode for WPA/WPA2 */ - lbs_enable_rsn(priv, sme->crypto.cipher_group != 0); - break; - default: - wiphy_err(wiphy, "unsupported cipher group 0x%x\n", - sme->crypto.cipher_group); - ret = -ENOTSUPP; - goto done; - } - - ret = lbs_set_authtype(priv, sme); - if (ret == -ENOTSUPP) { - wiphy_err(wiphy, "unsupported authtype 0x%x\n", sme->auth_type); - goto done; - } - - lbs_set_radio(priv, preamble, 1); - - /* Do the actual association */ - ret = lbs_associate(priv, bss, sme); - - done: - if (bss) - cfg80211_put_bss(wiphy, bss); - lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); - return ret; -} - -int lbs_disconnect(struct lbs_private *priv, u16 reason) -{ - struct cmd_ds_802_11_deauthenticate cmd; - int ret; - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - /* Mildly ugly to use a locally store my own BSSID ... */ - memcpy(cmd.macaddr, &priv->assoc_bss, ETH_ALEN); - cmd.reasoncode = cpu_to_le16(reason); - - ret = lbs_cmd_with_response(priv, CMD_802_11_DEAUTHENTICATE, &cmd); - if (ret) - return ret; - - cfg80211_disconnected(priv->dev, - reason, - NULL, 0, - GFP_KERNEL); - priv->connect_status = LBS_DISCONNECTED; - - return 0; -} - -static int lbs_cfg_disconnect(struct wiphy *wiphy, struct net_device *dev, - u16 reason_code) -{ - struct lbs_private *priv = wiphy_priv(wiphy); - - if (dev == priv->mesh_dev) - return -EOPNOTSUPP; - - lbs_deb_enter_args(LBS_DEB_CFG80211, "reason_code %d", reason_code); - - /* store for lbs_cfg_ret_disconnect() */ - priv->disassoc_reason = reason_code; - - return lbs_disconnect(priv, reason_code); -} - -static int lbs_cfg_set_default_key(struct wiphy *wiphy, - struct net_device *netdev, - u8 key_index, bool unicast, - bool multicast) -{ - struct lbs_private *priv = wiphy_priv(wiphy); - - if (netdev == priv->mesh_dev) - return -EOPNOTSUPP; - - lbs_deb_enter(LBS_DEB_CFG80211); - - if (key_index != priv->wep_tx_key) { - lbs_deb_assoc("set_default_key: to %d\n", key_index); - priv->wep_tx_key = key_index; - lbs_set_wep_keys(priv); - } - - return 0; -} - - -static int lbs_cfg_add_key(struct wiphy *wiphy, struct net_device *netdev, - u8 idx, bool pairwise, const u8 *mac_addr, - struct key_params *params) -{ - struct lbs_private *priv = wiphy_priv(wiphy); - u16 key_info; - u16 key_type; - int ret = 0; - - if (netdev == priv->mesh_dev) - return -EOPNOTSUPP; - - lbs_deb_enter(LBS_DEB_CFG80211); - - lbs_deb_assoc("add_key: cipher 0x%x, mac_addr %pM\n", - params->cipher, mac_addr); - lbs_deb_assoc("add_key: key index %d, key len %d\n", - idx, params->key_len); - if (params->key_len) - lbs_deb_hex(LBS_DEB_CFG80211, "KEY", - params->key, params->key_len); - - lbs_deb_assoc("add_key: seq len %d\n", params->seq_len); - if (params->seq_len) - lbs_deb_hex(LBS_DEB_CFG80211, "SEQ", - params->seq, params->seq_len); - - switch (params->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - /* actually compare if something has changed ... */ - if ((priv->wep_key_len[idx] != params->key_len) || - memcmp(priv->wep_key[idx], - params->key, params->key_len) != 0) { - priv->wep_key_len[idx] = params->key_len; - memcpy(priv->wep_key[idx], - params->key, params->key_len); - lbs_set_wep_keys(priv); - } - break; - case WLAN_CIPHER_SUITE_TKIP: - case WLAN_CIPHER_SUITE_CCMP: - key_info = KEY_INFO_WPA_ENABLED | ((idx == 0) - ? KEY_INFO_WPA_UNICAST - : KEY_INFO_WPA_MCAST); - key_type = (params->cipher == WLAN_CIPHER_SUITE_TKIP) - ? KEY_TYPE_ID_TKIP - : KEY_TYPE_ID_AES; - lbs_set_key_material(priv, - key_type, - key_info, - params->key, params->key_len); - break; - default: - wiphy_err(wiphy, "unhandled cipher 0x%x\n", params->cipher); - ret = -ENOTSUPP; - break; - } - - return ret; -} - - -static int lbs_cfg_del_key(struct wiphy *wiphy, struct net_device *netdev, - u8 key_index, bool pairwise, const u8 *mac_addr) -{ - - lbs_deb_enter(LBS_DEB_CFG80211); - - lbs_deb_assoc("del_key: key_idx %d, mac_addr %pM\n", - key_index, mac_addr); - -#ifdef TODO - struct lbs_private *priv = wiphy_priv(wiphy); - /* - * I think can keep this a NO-OP, because: - - * - we clear all keys whenever we do lbs_cfg_connect() anyway - * - neither "iw" nor "wpa_supplicant" won't call this during - * an ongoing connection - * - TODO: but I have to check if this is still true when - * I set the AP to periodic re-keying - * - we've not kzallec() something when we've added a key at - * lbs_cfg_connect() or lbs_cfg_add_key(). - * - * This causes lbs_cfg_del_key() only called at disconnect time, - * where we'd just waste time deleting a key that is not going - * to be used anyway. - */ - if (key_index < 3 && priv->wep_key_len[key_index]) { - priv->wep_key_len[key_index] = 0; - lbs_set_wep_keys(priv); - } -#endif - - return 0; -} - - -/* - * Get station - */ - -static int lbs_cfg_get_station(struct wiphy *wiphy, struct net_device *dev, - u8 *mac, struct station_info *sinfo) -{ - struct lbs_private *priv = wiphy_priv(wiphy); - s8 signal, noise; - int ret; - size_t i; - - lbs_deb_enter(LBS_DEB_CFG80211); - - sinfo->filled |= STATION_INFO_TX_BYTES | - STATION_INFO_TX_PACKETS | - STATION_INFO_RX_BYTES | - STATION_INFO_RX_PACKETS; - sinfo->tx_bytes = priv->dev->stats.tx_bytes; - sinfo->tx_packets = priv->dev->stats.tx_packets; - sinfo->rx_bytes = priv->dev->stats.rx_bytes; - sinfo->rx_packets = priv->dev->stats.rx_packets; - - /* Get current RSSI */ - ret = lbs_get_rssi(priv, &signal, &noise); - if (ret == 0) { - sinfo->signal = signal; - sinfo->filled |= STATION_INFO_SIGNAL; - } - - /* Convert priv->cur_rate from hw_value to NL80211 value */ - for (i = 0; i < ARRAY_SIZE(lbs_rates); i++) { - if (priv->cur_rate == lbs_rates[i].hw_value) { - sinfo->txrate.legacy = lbs_rates[i].bitrate; - sinfo->filled |= STATION_INFO_TX_BITRATE; - break; - } - } - - return 0; -} - - - - -/* - * Change interface - */ - -static int lbs_change_intf(struct wiphy *wiphy, struct net_device *dev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -{ - struct lbs_private *priv = wiphy_priv(wiphy); - int ret = 0; - - if (dev == priv->mesh_dev) - return -EOPNOTSUPP; - - switch (type) { - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_ADHOC: - break; - default: - return -EOPNOTSUPP; - } - - lbs_deb_enter(LBS_DEB_CFG80211); - - if (priv->iface_running) - ret = lbs_set_iface_type(priv, type); - - if (!ret) - priv->wdev->iftype = type; - - lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); - return ret; -} - - - -/* - * IBSS (Ad-Hoc) - */ - -/* - * The firmware needs the following bits masked out of the beacon-derived - * capability field when associating/joining to a BSS: - * 9 (QoS), 11 (APSD), 12 (unused), 14 (unused), 15 (unused) - */ -#define CAPINFO_MASK (~(0xda00)) - - -static void lbs_join_post(struct lbs_private *priv, - struct cfg80211_ibss_params *params, - u8 *bssid, u16 capability) -{ - u8 fake_ie[2 + IEEE80211_MAX_SSID_LEN + /* ssid */ - 2 + 4 + /* basic rates */ - 2 + 1 + /* DS parameter */ - 2 + 2 + /* atim */ - 2 + 8]; /* extended rates */ - u8 *fake = fake_ie; - struct cfg80211_bss *bss; - - lbs_deb_enter(LBS_DEB_CFG80211); - - /* - * For cfg80211_inform_bss, we'll need a fake IE, as we can't get - * the real IE from the firmware. So we fabricate a fake IE based on - * what the firmware actually sends (sniffed with wireshark). - */ - /* Fake SSID IE */ - *fake++ = WLAN_EID_SSID; - *fake++ = params->ssid_len; - memcpy(fake, params->ssid, params->ssid_len); - fake += params->ssid_len; - /* Fake supported basic rates IE */ - *fake++ = WLAN_EID_SUPP_RATES; - *fake++ = 4; - *fake++ = 0x82; - *fake++ = 0x84; - *fake++ = 0x8b; - *fake++ = 0x96; - /* Fake DS channel IE */ - *fake++ = WLAN_EID_DS_PARAMS; - *fake++ = 1; - *fake++ = params->chandef.chan->hw_value; - /* Fake IBSS params IE */ - *fake++ = WLAN_EID_IBSS_PARAMS; - *fake++ = 2; - *fake++ = 0; /* ATIM=0 */ - *fake++ = 0; - /* Fake extended rates IE, TODO: don't add this for 802.11b only, - * but I don't know how this could be checked */ - *fake++ = WLAN_EID_EXT_SUPP_RATES; - *fake++ = 8; - *fake++ = 0x0c; - *fake++ = 0x12; - *fake++ = 0x18; - *fake++ = 0x24; - *fake++ = 0x30; - *fake++ = 0x48; - *fake++ = 0x60; - *fake++ = 0x6c; - lbs_deb_hex(LBS_DEB_CFG80211, "IE", fake_ie, fake - fake_ie); - - bss = cfg80211_inform_bss(priv->wdev->wiphy, - params->chandef.chan, - bssid, - 0, - capability, - params->beacon_interval, - fake_ie, fake - fake_ie, - 0, GFP_KERNEL); - cfg80211_put_bss(priv->wdev->wiphy, bss); - - memcpy(priv->wdev->ssid, params->ssid, params->ssid_len); - priv->wdev->ssid_len = params->ssid_len; - - cfg80211_ibss_joined(priv->dev, bssid, GFP_KERNEL); - - /* TODO: consider doing this at MACREG_INT_CODE_LINK_SENSED time */ - priv->connect_status = LBS_CONNECTED; - netif_carrier_on(priv->dev); - if (!priv->tx_pending_len) - netif_wake_queue(priv->dev); - - lbs_deb_leave(LBS_DEB_CFG80211); -} - -static int lbs_ibss_join_existing(struct lbs_private *priv, - struct cfg80211_ibss_params *params, - struct cfg80211_bss *bss) -{ - const u8 *rates_eid; - struct cmd_ds_802_11_ad_hoc_join cmd; - u8 preamble = RADIO_PREAMBLE_SHORT; - int ret = 0; - - lbs_deb_enter(LBS_DEB_CFG80211); - - /* TODO: set preamble based on scan result */ - ret = lbs_set_radio(priv, preamble, 1); - if (ret) - goto out; - - /* - * Example CMD_802_11_AD_HOC_JOIN command: - * - * command 2c 00 CMD_802_11_AD_HOC_JOIN - * size 65 00 - * sequence xx xx - * result 00 00 - * bssid 02 27 27 97 2f 96 - * ssid 49 42 53 53 00 00 00 00 - * 00 00 00 00 00 00 00 00 - * 00 00 00 00 00 00 00 00 - * 00 00 00 00 00 00 00 00 - * type 02 CMD_BSS_TYPE_IBSS - * beacon period 64 00 - * dtim period 00 - * timestamp 00 00 00 00 00 00 00 00 - * localtime 00 00 00 00 00 00 00 00 - * IE DS 03 - * IE DS len 01 - * IE DS channel 01 - * reserveed 00 00 00 00 - * IE IBSS 06 - * IE IBSS len 02 - * IE IBSS atim 00 00 - * reserved 00 00 00 00 - * capability 02 00 - * rates 82 84 8b 96 0c 12 18 24 30 48 60 6c 00 - * fail timeout ff 00 - * probe delay 00 00 - */ - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - - memcpy(cmd.bss.bssid, bss->bssid, ETH_ALEN); - memcpy(cmd.bss.ssid, params->ssid, params->ssid_len); - cmd.bss.type = CMD_BSS_TYPE_IBSS; - cmd.bss.beaconperiod = cpu_to_le16(params->beacon_interval); - cmd.bss.ds.header.id = WLAN_EID_DS_PARAMS; - cmd.bss.ds.header.len = 1; - cmd.bss.ds.channel = params->chandef.chan->hw_value; - cmd.bss.ibss.header.id = WLAN_EID_IBSS_PARAMS; - cmd.bss.ibss.header.len = 2; - cmd.bss.ibss.atimwindow = 0; - cmd.bss.capability = cpu_to_le16(bss->capability & CAPINFO_MASK); - - /* set rates to the intersection of our rates and the rates in the - bss */ - rcu_read_lock(); - rates_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SUPP_RATES); - if (!rates_eid) { - lbs_add_rates(cmd.bss.rates); - } else { - int hw, i; - u8 rates_max = rates_eid[1]; - u8 *rates = cmd.bss.rates; - for (hw = 0; hw < ARRAY_SIZE(lbs_rates); hw++) { - u8 hw_rate = lbs_rates[hw].bitrate / 5; - for (i = 0; i < rates_max; i++) { - if (hw_rate == (rates_eid[i+2] & 0x7f)) { - u8 rate = rates_eid[i+2]; - if (rate == 0x02 || rate == 0x04 || - rate == 0x0b || rate == 0x16) - rate |= 0x80; - *rates++ = rate; - } - } - } - } - rcu_read_unlock(); - - /* Only v8 and below support setting this */ - if (MRVL_FW_MAJOR_REV(priv->fwrelease) <= 8) { - cmd.failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); - cmd.probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME); - } - ret = lbs_cmd_with_response(priv, CMD_802_11_AD_HOC_JOIN, &cmd); - if (ret) - goto out; - - /* - * This is a sample response to CMD_802_11_AD_HOC_JOIN: - * - * response 2c 80 - * size 09 00 - * sequence xx xx - * result 00 00 - * reserved 00 - */ - lbs_join_post(priv, params, bss->bssid, bss->capability); - - out: - lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); - return ret; -} - - - -static int lbs_ibss_start_new(struct lbs_private *priv, - struct cfg80211_ibss_params *params) -{ - struct cmd_ds_802_11_ad_hoc_start cmd; - struct cmd_ds_802_11_ad_hoc_result *resp = - (struct cmd_ds_802_11_ad_hoc_result *) &cmd; - u8 preamble = RADIO_PREAMBLE_SHORT; - int ret = 0; - u16 capability; - - lbs_deb_enter(LBS_DEB_CFG80211); - - ret = lbs_set_radio(priv, preamble, 1); - if (ret) - goto out; - - /* - * Example CMD_802_11_AD_HOC_START command: - * - * command 2b 00 CMD_802_11_AD_HOC_START - * size b1 00 - * sequence xx xx - * result 00 00 - * ssid 54 45 53 54 00 00 00 00 - * 00 00 00 00 00 00 00 00 - * 00 00 00 00 00 00 00 00 - * 00 00 00 00 00 00 00 00 - * bss type 02 - * beacon period 64 00 - * dtim period 00 - * IE IBSS 06 - * IE IBSS len 02 - * IE IBSS atim 00 00 - * reserved 00 00 00 00 - * IE DS 03 - * IE DS len 01 - * IE DS channel 01 - * reserved 00 00 00 00 - * probe delay 00 00 - * capability 02 00 - * rates 82 84 8b 96 (basic rates with have bit 7 set) - * 0c 12 18 24 30 48 60 6c - * padding 100 bytes - */ - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - memcpy(cmd.ssid, params->ssid, params->ssid_len); - cmd.bsstype = CMD_BSS_TYPE_IBSS; - cmd.beaconperiod = cpu_to_le16(params->beacon_interval); - cmd.ibss.header.id = WLAN_EID_IBSS_PARAMS; - cmd.ibss.header.len = 2; - cmd.ibss.atimwindow = 0; - cmd.ds.header.id = WLAN_EID_DS_PARAMS; - cmd.ds.header.len = 1; - cmd.ds.channel = params->chandef.chan->hw_value; - /* Only v8 and below support setting probe delay */ - if (MRVL_FW_MAJOR_REV(priv->fwrelease) <= 8) - cmd.probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME); - /* TODO: mix in WLAN_CAPABILITY_PRIVACY */ - capability = WLAN_CAPABILITY_IBSS; - cmd.capability = cpu_to_le16(capability); - lbs_add_rates(cmd.rates); - - - ret = lbs_cmd_with_response(priv, CMD_802_11_AD_HOC_START, &cmd); - if (ret) - goto out; - - /* - * This is a sample response to CMD_802_11_AD_HOC_JOIN: - * - * response 2b 80 - * size 14 00 - * sequence xx xx - * result 00 00 - * reserved 00 - * bssid 02 2b 7b 0f 86 0e - */ - lbs_join_post(priv, params, resp->bssid, capability); - - out: - lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); - return ret; -} - - -static int lbs_join_ibss(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ibss_params *params) -{ - struct lbs_private *priv = wiphy_priv(wiphy); - int ret = 0; - struct cfg80211_bss *bss; - DECLARE_SSID_BUF(ssid_buf); - - if (dev == priv->mesh_dev) - return -EOPNOTSUPP; - - lbs_deb_enter(LBS_DEB_CFG80211); - - if (!params->chandef.chan) { - ret = -ENOTSUPP; - goto out; - } - - ret = lbs_set_channel(priv, params->chandef.chan->hw_value); - if (ret) - goto out; - - /* Search if someone is beaconing. This assumes that the - * bss list is populated already */ - bss = cfg80211_get_bss(wiphy, params->chandef.chan, params->bssid, - params->ssid, params->ssid_len, - WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); - - if (bss) { - ret = lbs_ibss_join_existing(priv, params, bss); - cfg80211_put_bss(wiphy, bss); - } else - ret = lbs_ibss_start_new(priv, params); - - - out: - lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); - return ret; -} - - -static int lbs_leave_ibss(struct wiphy *wiphy, struct net_device *dev) -{ - struct lbs_private *priv = wiphy_priv(wiphy); - struct cmd_ds_802_11_ad_hoc_stop cmd; - int ret = 0; - - if (dev == priv->mesh_dev) - return -EOPNOTSUPP; - - lbs_deb_enter(LBS_DEB_CFG80211); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - ret = lbs_cmd_with_response(priv, CMD_802_11_AD_HOC_STOP, &cmd); - - /* TODO: consider doing this at MACREG_INT_CODE_ADHOC_BCN_LOST time */ - lbs_mac_event_disconnected(priv); - - lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); - return ret; -} - - - - -/* - * Initialization - */ - -static struct cfg80211_ops lbs_cfg80211_ops = { - .set_monitor_channel = lbs_cfg_set_monitor_channel, - .libertas_set_mesh_channel = lbs_cfg_set_mesh_channel, - .scan = lbs_cfg_scan, - .connect = lbs_cfg_connect, - .disconnect = lbs_cfg_disconnect, - .add_key = lbs_cfg_add_key, - .del_key = lbs_cfg_del_key, - .set_default_key = lbs_cfg_set_default_key, - .get_station = lbs_cfg_get_station, - .change_virtual_intf = lbs_change_intf, - .join_ibss = lbs_join_ibss, - .leave_ibss = lbs_leave_ibss, -}; - - -/* - * At this time lbs_private *priv doesn't even exist, so we just allocate - * memory and don't initialize the wiphy further. This is postponed until we - * can talk to the firmware and happens at registration time in - * lbs_cfg_wiphy_register(). - */ -struct wireless_dev *lbs_cfg_alloc(struct device *dev) -{ - int ret = 0; - struct wireless_dev *wdev; - - lbs_deb_enter(LBS_DEB_CFG80211); - - wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); - if (!wdev) - return ERR_PTR(-ENOMEM); - - wdev->wiphy = wiphy_new(&lbs_cfg80211_ops, sizeof(struct lbs_private)); - if (!wdev->wiphy) { - dev_err(dev, "cannot allocate wiphy\n"); - ret = -ENOMEM; - goto err_wiphy_new; - } - - lbs_deb_leave(LBS_DEB_CFG80211); - return wdev; - - err_wiphy_new: - kfree(wdev); - lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); - return ERR_PTR(ret); -} - - -static void lbs_cfg_set_regulatory_hint(struct lbs_private *priv) -{ - struct region_code_mapping { - const char *cn; - int code; - }; - - /* Section 5.17.2 */ - static const struct region_code_mapping regmap[] = { - {"US ", 0x10}, /* US FCC */ - {"CA ", 0x20}, /* Canada */ - {"EU ", 0x30}, /* ETSI */ - {"ES ", 0x31}, /* Spain */ - {"FR ", 0x32}, /* France */ - {"JP ", 0x40}, /* Japan */ - }; - size_t i; - - lbs_deb_enter(LBS_DEB_CFG80211); - - for (i = 0; i < ARRAY_SIZE(regmap); i++) - if (regmap[i].code == priv->regioncode) { - regulatory_hint(priv->wdev->wiphy, regmap[i].cn); - break; - } - - lbs_deb_leave(LBS_DEB_CFG80211); -} - -static void lbs_reg_notifier(struct wiphy *wiphy, - struct regulatory_request *request) -{ - struct lbs_private *priv = wiphy_priv(wiphy); - - lbs_deb_enter_args(LBS_DEB_CFG80211, "cfg80211 regulatory domain " - "callback for domain %c%c\n", request->alpha2[0], - request->alpha2[1]); - - memcpy(priv->country_code, request->alpha2, sizeof(request->alpha2)); - if (lbs_iface_active(priv)) - lbs_set_11d_domain_info(priv); - - lbs_deb_leave(LBS_DEB_CFG80211); -} - -/* - * This function get's called after lbs_setup_firmware() determined the - * firmware capabities. So we can setup the wiphy according to our - * hardware/firmware. - */ -int lbs_cfg_register(struct lbs_private *priv) -{ - struct wireless_dev *wdev = priv->wdev; - int ret; - - lbs_deb_enter(LBS_DEB_CFG80211); - - wdev->wiphy->max_scan_ssids = 1; - wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - - wdev->wiphy->interface_modes = - BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC); - if (lbs_rtap_supported(priv)) - wdev->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); - if (lbs_mesh_activated(priv)) - wdev->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MESH_POINT); - - wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &lbs_band_2ghz; - - /* - * We could check priv->fwcapinfo && FW_CAPINFO_WPA, but I have - * never seen a firmware without WPA - */ - wdev->wiphy->cipher_suites = cipher_suites; - wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); - wdev->wiphy->reg_notifier = lbs_reg_notifier; - - ret = wiphy_register(wdev->wiphy); - if (ret < 0) - pr_err("cannot register wiphy device\n"); - - priv->wiphy_registered = true; - - ret = register_netdev(priv->dev); - if (ret) - pr_err("cannot register network device\n"); - - INIT_DELAYED_WORK(&priv->scan_work, lbs_scan_worker); - - lbs_cfg_set_regulatory_hint(priv); - - lbs_deb_leave_args(LBS_DEB_CFG80211, "ret %d", ret); - return ret; -} - -void lbs_scan_deinit(struct lbs_private *priv) -{ - lbs_deb_enter(LBS_DEB_CFG80211); - cancel_delayed_work_sync(&priv->scan_work); -} - - -void lbs_cfg_free(struct lbs_private *priv) -{ - struct wireless_dev *wdev = priv->wdev; - - lbs_deb_enter(LBS_DEB_CFG80211); - - if (!wdev) - return; - - if (priv->wiphy_registered) - wiphy_unregister(wdev->wiphy); - - if (wdev->wiphy) - wiphy_free(wdev->wiphy); - - kfree(wdev); -} diff --git a/drivers/net/wireless/libertas/cfg.h b/drivers/net/wireless/libertas/cfg.h deleted file mode 100644 index 10995f59fe34..000000000000 --- a/drivers/net/wireless/libertas/cfg.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __LBS_CFG80211_H__ -#define __LBS_CFG80211_H__ - -struct device; -struct lbs_private; -struct regulatory_request; -struct wiphy; - -struct wireless_dev *lbs_cfg_alloc(struct device *dev); -int lbs_cfg_register(struct lbs_private *priv); -void lbs_cfg_free(struct lbs_private *priv); - -void lbs_send_disconnect_notification(struct lbs_private *priv); -void lbs_send_mic_failureevent(struct lbs_private *priv, u32 event); - -void lbs_scan_done(struct lbs_private *priv); -void lbs_scan_deinit(struct lbs_private *priv); -int lbs_disconnect(struct lbs_private *priv, u16 reason); - -#endif diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c deleted file mode 100644 index aaa297315c47..000000000000 --- a/drivers/net/wireless/libertas/cmd.c +++ /dev/null @@ -1,1724 +0,0 @@ -/* - * This file contains the handling of command. - * It prepares command and sends it to firmware when it is ready. - */ - -#include -#include -#include -#include -#include -#include - -#include "decl.h" -#include "cfg.h" -#include "cmd.h" - -#define CAL_NF(nf) ((s32)(-(s32)(nf))) -#define CAL_RSSI(snr, nf) ((s32)((s32)(snr) + CAL_NF(nf))) - -/** - * lbs_cmd_copyback - Simple callback that copies response back into command - * - * @priv: A pointer to &struct lbs_private structure - * @extra: A pointer to the original command structure for which - * 'resp' is a response - * @resp: A pointer to the command response - * - * returns: 0 on success, error on failure - */ -int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra, - struct cmd_header *resp) -{ - struct cmd_header *buf = (void *)extra; - uint16_t copy_len; - - copy_len = min(le16_to_cpu(buf->size), le16_to_cpu(resp->size)); - memcpy(buf, resp, copy_len); - return 0; -} -EXPORT_SYMBOL_GPL(lbs_cmd_copyback); - -/** - * lbs_cmd_async_callback - Simple callback that ignores the result. - * Use this if you just want to send a command to the hardware, but don't - * care for the result. - * - * @priv: ignored - * @extra: ignored - * @resp: ignored - * - * returns: 0 for success - */ -static int lbs_cmd_async_callback(struct lbs_private *priv, unsigned long extra, - struct cmd_header *resp) -{ - return 0; -} - - -/** - * is_command_allowed_in_ps - tests if a command is allowed in Power Save mode - * - * @cmd: the command ID - * - * returns: 1 if allowed, 0 if not allowed - */ -static u8 is_command_allowed_in_ps(u16 cmd) -{ - switch (cmd) { - case CMD_802_11_RSSI: - return 1; - case CMD_802_11_HOST_SLEEP_CFG: - return 1; - default: - break; - } - return 0; -} - -/** - * lbs_update_hw_spec - Updates the hardware details like MAC address - * and regulatory region - * - * @priv: A pointer to &struct lbs_private structure - * - * returns: 0 on success, error on failure - */ -int lbs_update_hw_spec(struct lbs_private *priv) -{ - struct cmd_ds_get_hw_spec cmd; - int ret = -1; - u32 i; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - memcpy(cmd.permanentaddr, priv->current_addr, ETH_ALEN); - ret = lbs_cmd_with_response(priv, CMD_GET_HW_SPEC, &cmd); - if (ret) - goto out; - - priv->fwcapinfo = le32_to_cpu(cmd.fwcapinfo); - - /* The firmware release is in an interesting format: the patch - * level is in the most significant nibble ... so fix that: */ - priv->fwrelease = le32_to_cpu(cmd.fwrelease); - priv->fwrelease = (priv->fwrelease << 8) | - (priv->fwrelease >> 24 & 0xff); - - /* Some firmware capabilities: - * CF card firmware 5.0.16p0: cap 0x00000303 - * USB dongle firmware 5.110.17p2: cap 0x00000303 - */ - netdev_info(priv->dev, "%pM, fw %u.%u.%up%u, cap 0x%08x\n", - cmd.permanentaddr, - priv->fwrelease >> 24 & 0xff, - priv->fwrelease >> 16 & 0xff, - priv->fwrelease >> 8 & 0xff, - priv->fwrelease & 0xff, - priv->fwcapinfo); - lbs_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n", - cmd.hwifversion, cmd.version); - - /* Clamp region code to 8-bit since FW spec indicates that it should - * only ever be 8-bit, even though the field size is 16-bit. Some firmware - * returns non-zero high 8 bits here. - * - * Firmware version 4.0.102 used in CF8381 has region code shifted. We - * need to check for this problem and handle it properly. - */ - if (MRVL_FW_MAJOR_REV(priv->fwrelease) == MRVL_FW_V4) - priv->regioncode = (le16_to_cpu(cmd.regioncode) >> 8) & 0xFF; - else - priv->regioncode = le16_to_cpu(cmd.regioncode) & 0xFF; - - for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { - /* use the region code to search for the index */ - if (priv->regioncode == lbs_region_code_to_index[i]) - break; - } - - /* if it's unidentified region code, use the default (USA) */ - if (i >= MRVDRV_MAX_REGION_CODE) { - priv->regioncode = 0x10; - netdev_info(priv->dev, - "unidentified region code; using the default (USA)\n"); - } - - if (priv->current_addr[0] == 0xff) - memmove(priv->current_addr, cmd.permanentaddr, ETH_ALEN); - - if (!priv->copied_hwaddr) { - memcpy(priv->dev->dev_addr, priv->current_addr, ETH_ALEN); - if (priv->mesh_dev) - memcpy(priv->mesh_dev->dev_addr, - priv->current_addr, ETH_ALEN); - priv->copied_hwaddr = 1; - } - -out: - lbs_deb_leave(LBS_DEB_CMD); - return ret; -} - -static int lbs_ret_host_sleep_cfg(struct lbs_private *priv, unsigned long dummy, - struct cmd_header *resp) -{ - lbs_deb_enter(LBS_DEB_CMD); - if (priv->is_host_sleep_activated) { - priv->is_host_sleep_configured = 0; - if (priv->psstate == PS_STATE_FULL_POWER) { - priv->is_host_sleep_activated = 0; - wake_up_interruptible(&priv->host_sleep_q); - } - } else { - priv->is_host_sleep_configured = 1; - } - lbs_deb_leave(LBS_DEB_CMD); - return 0; -} - -int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, - struct wol_config *p_wol_config) -{ - struct cmd_ds_host_sleep cmd_config; - int ret; - - /* - * Certain firmware versions do not support EHS_REMOVE_WAKEUP command - * and the card will return a failure. Since we need to be - * able to reset the mask, in those cases we set a 0 mask instead. - */ - if (criteria == EHS_REMOVE_WAKEUP && !priv->ehs_remove_supported) - criteria = 0; - - cmd_config.hdr.size = cpu_to_le16(sizeof(cmd_config)); - cmd_config.criteria = cpu_to_le32(criteria); - cmd_config.gpio = priv->wol_gpio; - cmd_config.gap = priv->wol_gap; - - if (p_wol_config != NULL) - memcpy((uint8_t *)&cmd_config.wol_conf, (uint8_t *)p_wol_config, - sizeof(struct wol_config)); - else - cmd_config.wol_conf.action = CMD_ACT_ACTION_NONE; - - ret = __lbs_cmd(priv, CMD_802_11_HOST_SLEEP_CFG, &cmd_config.hdr, - le16_to_cpu(cmd_config.hdr.size), - lbs_ret_host_sleep_cfg, 0); - if (!ret) { - if (p_wol_config) - memcpy((uint8_t *) p_wol_config, - (uint8_t *)&cmd_config.wol_conf, - sizeof(struct wol_config)); - } else { - netdev_info(priv->dev, "HOST_SLEEP_CFG failed %d\n", ret); - } - - return ret; -} -EXPORT_SYMBOL_GPL(lbs_host_sleep_cfg); - -/** - * lbs_set_ps_mode - Sets the Power Save mode - * - * @priv: A pointer to &struct lbs_private structure - * @cmd_action: The Power Save operation (PS_MODE_ACTION_ENTER_PS or - * PS_MODE_ACTION_EXIT_PS) - * @block: Whether to block on a response or not - * - * returns: 0 on success, error on failure - */ -int lbs_set_ps_mode(struct lbs_private *priv, u16 cmd_action, bool block) -{ - struct cmd_ds_802_11_ps_mode cmd; - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(cmd_action); - - if (cmd_action == PS_MODE_ACTION_ENTER_PS) { - lbs_deb_cmd("PS_MODE: action ENTER_PS\n"); - cmd.multipledtim = cpu_to_le16(1); /* Default DTIM multiple */ - } else if (cmd_action == PS_MODE_ACTION_EXIT_PS) { - lbs_deb_cmd("PS_MODE: action EXIT_PS\n"); - } else { - /* We don't handle CONFIRM_SLEEP here because it needs to - * be fastpathed to the firmware. - */ - lbs_deb_cmd("PS_MODE: unknown action 0x%X\n", cmd_action); - ret = -EOPNOTSUPP; - goto out; - } - - if (block) - ret = lbs_cmd_with_response(priv, CMD_802_11_PS_MODE, &cmd); - else - lbs_cmd_async(priv, CMD_802_11_PS_MODE, &cmd.hdr, sizeof (cmd)); - -out: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, - struct sleep_params *sp) -{ - struct cmd_ds_802_11_sleep_params cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CMD); - - if (cmd_action == CMD_ACT_GET) { - memset(&cmd, 0, sizeof(cmd)); - } else { - cmd.error = cpu_to_le16(sp->sp_error); - cmd.offset = cpu_to_le16(sp->sp_offset); - cmd.stabletime = cpu_to_le16(sp->sp_stabletime); - cmd.calcontrol = sp->sp_calcontrol; - cmd.externalsleepclk = sp->sp_extsleepclk; - cmd.reserved = cpu_to_le16(sp->sp_reserved); - } - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(cmd_action); - - ret = lbs_cmd_with_response(priv, CMD_802_11_SLEEP_PARAMS, &cmd); - - if (!ret) { - lbs_deb_cmd("error 0x%x, offset 0x%x, stabletime 0x%x, " - "calcontrol 0x%x extsleepclk 0x%x\n", - le16_to_cpu(cmd.error), le16_to_cpu(cmd.offset), - le16_to_cpu(cmd.stabletime), cmd.calcontrol, - cmd.externalsleepclk); - - sp->sp_error = le16_to_cpu(cmd.error); - sp->sp_offset = le16_to_cpu(cmd.offset); - sp->sp_stabletime = le16_to_cpu(cmd.stabletime); - sp->sp_calcontrol = cmd.calcontrol; - sp->sp_extsleepclk = cmd.externalsleepclk; - sp->sp_reserved = le16_to_cpu(cmd.reserved); - } - - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return 0; -} - -static int lbs_wait_for_ds_awake(struct lbs_private *priv) -{ - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - if (priv->is_deep_sleep) { - if (!wait_event_interruptible_timeout(priv->ds_awake_q, - !priv->is_deep_sleep, (10 * HZ))) { - netdev_err(priv->dev, "ds_awake_q: timer expired\n"); - ret = -1; - } - } - - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep) -{ - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - if (deep_sleep) { - if (priv->is_deep_sleep != 1) { - lbs_deb_cmd("deep sleep: sleep\n"); - BUG_ON(!priv->enter_deep_sleep); - ret = priv->enter_deep_sleep(priv); - if (!ret) { - netif_stop_queue(priv->dev); - netif_carrier_off(priv->dev); - } - } else { - netdev_err(priv->dev, "deep sleep: already enabled\n"); - } - } else { - if (priv->is_deep_sleep) { - lbs_deb_cmd("deep sleep: wakeup\n"); - BUG_ON(!priv->exit_deep_sleep); - ret = priv->exit_deep_sleep(priv); - if (!ret) { - ret = lbs_wait_for_ds_awake(priv); - if (ret) - netdev_err(priv->dev, - "deep sleep: wakeup failed\n"); - } - } - } - - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -static int lbs_ret_host_sleep_activate(struct lbs_private *priv, - unsigned long dummy, - struct cmd_header *cmd) -{ - lbs_deb_enter(LBS_DEB_FW); - priv->is_host_sleep_activated = 1; - wake_up_interruptible(&priv->host_sleep_q); - lbs_deb_leave(LBS_DEB_FW); - return 0; -} - -int lbs_set_host_sleep(struct lbs_private *priv, int host_sleep) -{ - struct cmd_header cmd; - int ret = 0; - uint32_t criteria = EHS_REMOVE_WAKEUP; - - lbs_deb_enter(LBS_DEB_CMD); - - if (host_sleep) { - if (priv->is_host_sleep_activated != 1) { - memset(&cmd, 0, sizeof(cmd)); - ret = lbs_host_sleep_cfg(priv, priv->wol_criteria, - (struct wol_config *)NULL); - if (ret) { - netdev_info(priv->dev, - "Host sleep configuration failed: %d\n", - ret); - return ret; - } - if (priv->psstate == PS_STATE_FULL_POWER) { - ret = __lbs_cmd(priv, - CMD_802_11_HOST_SLEEP_ACTIVATE, - &cmd, - sizeof(cmd), - lbs_ret_host_sleep_activate, 0); - if (ret) - netdev_info(priv->dev, - "HOST_SLEEP_ACTIVATE failed: %d\n", - ret); - } - - if (!wait_event_interruptible_timeout( - priv->host_sleep_q, - priv->is_host_sleep_activated, - (10 * HZ))) { - netdev_err(priv->dev, - "host_sleep_q: timer expired\n"); - ret = -1; - } - } else { - netdev_err(priv->dev, "host sleep: already enabled\n"); - } - } else { - if (priv->is_host_sleep_activated) - ret = lbs_host_sleep_cfg(priv, criteria, - (struct wol_config *)NULL); - } - - return ret; -} - -/** - * lbs_set_snmp_mib - Set an SNMP MIB value - * - * @priv: A pointer to &struct lbs_private structure - * @oid: The OID to set in the firmware - * @val: Value to set the OID to - * - * returns: 0 on success, error on failure - */ -int lbs_set_snmp_mib(struct lbs_private *priv, u32 oid, u16 val) -{ - struct cmd_ds_802_11_snmp_mib cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof (cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - cmd.oid = cpu_to_le16((u16) oid); - - switch (oid) { - case SNMP_MIB_OID_BSS_TYPE: - cmd.bufsize = cpu_to_le16(sizeof(u8)); - cmd.value[0] = val; - break; - case SNMP_MIB_OID_11D_ENABLE: - case SNMP_MIB_OID_FRAG_THRESHOLD: - case SNMP_MIB_OID_RTS_THRESHOLD: - case SNMP_MIB_OID_SHORT_RETRY_LIMIT: - case SNMP_MIB_OID_LONG_RETRY_LIMIT: - cmd.bufsize = cpu_to_le16(sizeof(u16)); - *((__le16 *)(&cmd.value)) = cpu_to_le16(val); - break; - default: - lbs_deb_cmd("SNMP_CMD: (set) unhandled OID 0x%x\n", oid); - ret = -EINVAL; - goto out; - } - - lbs_deb_cmd("SNMP_CMD: (set) oid 0x%x, oid size 0x%x, value 0x%x\n", - le16_to_cpu(cmd.oid), le16_to_cpu(cmd.bufsize), val); - - ret = lbs_cmd_with_response(priv, CMD_802_11_SNMP_MIB, &cmd); - -out: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -/** - * lbs_get_snmp_mib - Get an SNMP MIB value - * - * @priv: A pointer to &struct lbs_private structure - * @oid: The OID to retrieve from the firmware - * @out_val: Location for the returned value - * - * returns: 0 on success, error on failure - */ -int lbs_get_snmp_mib(struct lbs_private *priv, u32 oid, u16 *out_val) -{ - struct cmd_ds_802_11_snmp_mib cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof (cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_GET); - cmd.oid = cpu_to_le16(oid); - - ret = lbs_cmd_with_response(priv, CMD_802_11_SNMP_MIB, &cmd); - if (ret) - goto out; - - switch (le16_to_cpu(cmd.bufsize)) { - case sizeof(u8): - *out_val = cmd.value[0]; - break; - case sizeof(u16): - *out_val = le16_to_cpu(*((__le16 *)(&cmd.value))); - break; - default: - lbs_deb_cmd("SNMP_CMD: (get) unhandled OID 0x%x size %d\n", - oid, le16_to_cpu(cmd.bufsize)); - break; - } - -out: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -/** - * lbs_get_tx_power - Get the min, max, and current TX power - * - * @priv: A pointer to &struct lbs_private structure - * @curlevel: Current power level in dBm - * @minlevel: Minimum supported power level in dBm (optional) - * @maxlevel: Maximum supported power level in dBm (optional) - * - * returns: 0 on success, error on failure - */ -int lbs_get_tx_power(struct lbs_private *priv, s16 *curlevel, s16 *minlevel, - s16 *maxlevel) -{ - struct cmd_ds_802_11_rf_tx_power cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_GET); - - ret = lbs_cmd_with_response(priv, CMD_802_11_RF_TX_POWER, &cmd); - if (ret == 0) { - *curlevel = le16_to_cpu(cmd.curlevel); - if (minlevel) - *minlevel = cmd.minlevel; - if (maxlevel) - *maxlevel = cmd.maxlevel; - } - - lbs_deb_leave(LBS_DEB_CMD); - return ret; -} - -/** - * lbs_set_tx_power - Set the TX power - * - * @priv: A pointer to &struct lbs_private structure - * @dbm: The desired power level in dBm - * - * returns: 0 on success, error on failure - */ -int lbs_set_tx_power(struct lbs_private *priv, s16 dbm) -{ - struct cmd_ds_802_11_rf_tx_power cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - cmd.curlevel = cpu_to_le16(dbm); - - lbs_deb_cmd("SET_RF_TX_POWER: %d dBm\n", dbm); - - ret = lbs_cmd_with_response(priv, CMD_802_11_RF_TX_POWER, &cmd); - - lbs_deb_leave(LBS_DEB_CMD); - return ret; -} - -/** - * lbs_set_monitor_mode - Enable or disable monitor mode - * (only implemented on OLPC usb8388 FW) - * - * @priv: A pointer to &struct lbs_private structure - * @enable: 1 to enable monitor mode, 0 to disable - * - * returns: 0 on success, error on failure - */ -int lbs_set_monitor_mode(struct lbs_private *priv, int enable) -{ - struct cmd_ds_802_11_monitor_mode cmd; - int ret; - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - if (enable) - cmd.mode = cpu_to_le16(0x1); - - lbs_deb_cmd("SET_MONITOR_MODE: %d\n", enable); - - ret = lbs_cmd_with_response(priv, CMD_802_11_MONITOR_MODE, &cmd); - if (ret == 0) { - priv->dev->type = enable ? ARPHRD_IEEE80211_RADIOTAP : - ARPHRD_ETHER; - } - - lbs_deb_leave(LBS_DEB_CMD); - return ret; -} - -/** - * lbs_get_channel - Get the radio channel - * - * @priv: A pointer to &struct lbs_private structure - * - * returns: The channel on success, error on failure - */ -static int lbs_get_channel(struct lbs_private *priv) -{ - struct cmd_ds_802_11_rf_channel cmd; - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_GET); - - ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, &cmd); - if (ret) - goto out; - - ret = le16_to_cpu(cmd.channel); - lbs_deb_cmd("current radio channel is %d\n", ret); - -out: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -int lbs_update_channel(struct lbs_private *priv) -{ - int ret; - - /* the channel in f/w could be out of sync; get the current channel */ - lbs_deb_enter(LBS_DEB_ASSOC); - - ret = lbs_get_channel(priv); - if (ret > 0) { - priv->channel = ret; - ret = 0; - } - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - -/** - * lbs_set_channel - Set the radio channel - * - * @priv: A pointer to &struct lbs_private structure - * @channel: The desired channel, or 0 to clear a locked channel - * - * returns: 0 on success, error on failure - */ -int lbs_set_channel(struct lbs_private *priv, u8 channel) -{ - struct cmd_ds_802_11_rf_channel cmd; -#ifdef DEBUG - u8 old_channel = priv->channel; -#endif - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_SET); - cmd.channel = cpu_to_le16(channel); - - ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, &cmd); - if (ret) - goto out; - - priv->channel = (uint8_t) le16_to_cpu(cmd.channel); - lbs_deb_cmd("channel switch from %d to %d\n", old_channel, - priv->channel); - -out: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -/** - * lbs_get_rssi - Get current RSSI and noise floor - * - * @priv: A pointer to &struct lbs_private structure - * @rssi: On successful return, signal level in mBm - * @nf: On successful return, Noise floor - * - * returns: The channel on success, error on failure - */ -int lbs_get_rssi(struct lbs_private *priv, s8 *rssi, s8 *nf) -{ - struct cmd_ds_802_11_rssi cmd; - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - BUG_ON(rssi == NULL); - BUG_ON(nf == NULL); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - /* Average SNR over last 8 beacons */ - cmd.n_or_snr = cpu_to_le16(8); - - ret = lbs_cmd_with_response(priv, CMD_802_11_RSSI, &cmd); - if (ret == 0) { - *nf = CAL_NF(le16_to_cpu(cmd.nf)); - *rssi = CAL_RSSI(le16_to_cpu(cmd.n_or_snr), le16_to_cpu(cmd.nf)); - } - - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -/** - * lbs_set_11d_domain_info - Send regulatory and 802.11d domain information - * to the firmware - * - * @priv: pointer to &struct lbs_private - * - * returns: 0 on success, error code on failure -*/ -int lbs_set_11d_domain_info(struct lbs_private *priv) -{ - struct wiphy *wiphy = priv->wdev->wiphy; - struct ieee80211_supported_band **bands = wiphy->bands; - struct cmd_ds_802_11d_domain_info cmd; - struct mrvl_ie_domain_param_set *domain = &cmd.domain; - struct ieee80211_country_ie_triplet *t; - enum ieee80211_band band; - struct ieee80211_channel *ch; - u8 num_triplet = 0; - u8 num_parsed_chan = 0; - u8 first_channel = 0, next_chan = 0, max_pwr = 0; - u8 i, flag = 0; - size_t triplet_size; - int ret = 0; - - lbs_deb_enter(LBS_DEB_11D); - if (!priv->country_code[0]) - goto out; - - memset(&cmd, 0, sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - - lbs_deb_11d("Setting country code '%c%c'\n", - priv->country_code[0], priv->country_code[1]); - - domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN); - - /* Set country code */ - domain->country_code[0] = priv->country_code[0]; - domain->country_code[1] = priv->country_code[1]; - domain->country_code[2] = ' '; - - /* Now set up the channel triplets; firmware is somewhat picky here - * and doesn't validate channel numbers and spans; hence it would - * interpret a triplet of (36, 4, 20) as channels 36, 37, 38, 39. Since - * the last 3 aren't valid channels, the driver is responsible for - * splitting that up into 4 triplet pairs of (36, 1, 20) + (40, 1, 20) - * etc. - */ - for (band = 0; - (band < IEEE80211_NUM_BANDS) && (num_triplet < MAX_11D_TRIPLETS); - band++) { - - if (!bands[band]) - continue; - - for (i = 0; - (i < bands[band]->n_channels) && (num_triplet < MAX_11D_TRIPLETS); - i++) { - ch = &bands[band]->channels[i]; - if (ch->flags & IEEE80211_CHAN_DISABLED) - continue; - - if (!flag) { - flag = 1; - next_chan = first_channel = (u32) ch->hw_value; - max_pwr = ch->max_power; - num_parsed_chan = 1; - continue; - } - - if ((ch->hw_value == next_chan + 1) && - (ch->max_power == max_pwr)) { - /* Consolidate adjacent channels */ - next_chan++; - num_parsed_chan++; - } else { - /* Add this triplet */ - lbs_deb_11d("11D triplet (%d, %d, %d)\n", - first_channel, num_parsed_chan, - max_pwr); - t = &domain->triplet[num_triplet]; - t->chans.first_channel = first_channel; - t->chans.num_channels = num_parsed_chan; - t->chans.max_power = max_pwr; - num_triplet++; - flag = 0; - } - } - - if (flag) { - /* Add last triplet */ - lbs_deb_11d("11D triplet (%d, %d, %d)\n", first_channel, - num_parsed_chan, max_pwr); - t = &domain->triplet[num_triplet]; - t->chans.first_channel = first_channel; - t->chans.num_channels = num_parsed_chan; - t->chans.max_power = max_pwr; - num_triplet++; - } - } - - lbs_deb_11d("# triplets %d\n", num_triplet); - - /* Set command header sizes */ - triplet_size = num_triplet * sizeof(struct ieee80211_country_ie_triplet); - domain->header.len = cpu_to_le16(sizeof(domain->country_code) + - triplet_size); - - lbs_deb_hex(LBS_DEB_11D, "802.11D domain param set", - (u8 *) &cmd.domain.country_code, - le16_to_cpu(domain->header.len)); - - cmd.hdr.size = cpu_to_le16(sizeof(cmd.hdr) + - sizeof(cmd.action) + - sizeof(cmd.domain.header) + - sizeof(cmd.domain.country_code) + - triplet_size); - - ret = lbs_cmd_with_response(priv, CMD_802_11D_DOMAIN_INFO, &cmd); - -out: - lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret); - return ret; -} - -/** - * lbs_get_reg - Read a MAC, Baseband, or RF register - * - * @priv: pointer to &struct lbs_private - * @reg: register command, one of CMD_MAC_REG_ACCESS, - * CMD_BBP_REG_ACCESS, or CMD_RF_REG_ACCESS - * @offset: byte offset of the register to get - * @value: on success, the value of the register at 'offset' - * - * returns: 0 on success, error code on failure -*/ -int lbs_get_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 *value) -{ - struct cmd_ds_reg_access cmd; - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - BUG_ON(value == NULL); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_GET); - cmd.offset = cpu_to_le16(offset); - - if (reg != CMD_MAC_REG_ACCESS && - reg != CMD_BBP_REG_ACCESS && - reg != CMD_RF_REG_ACCESS) { - ret = -EINVAL; - goto out; - } - - ret = lbs_cmd_with_response(priv, reg, &cmd); - if (!ret) { - if (reg == CMD_BBP_REG_ACCESS || reg == CMD_RF_REG_ACCESS) - *value = cmd.value.bbp_rf; - else if (reg == CMD_MAC_REG_ACCESS) - *value = le32_to_cpu(cmd.value.mac); - } - -out: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -/** - * lbs_set_reg - Write a MAC, Baseband, or RF register - * - * @priv: pointer to &struct lbs_private - * @reg: register command, one of CMD_MAC_REG_ACCESS, - * CMD_BBP_REG_ACCESS, or CMD_RF_REG_ACCESS - * @offset: byte offset of the register to set - * @value: the value to write to the register at 'offset' - * - * returns: 0 on success, error code on failure -*/ -int lbs_set_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 value) -{ - struct cmd_ds_reg_access cmd; - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - cmd.offset = cpu_to_le16(offset); - - if (reg == CMD_BBP_REG_ACCESS || reg == CMD_RF_REG_ACCESS) - cmd.value.bbp_rf = (u8) (value & 0xFF); - else if (reg == CMD_MAC_REG_ACCESS) - cmd.value.mac = cpu_to_le32(value); - else { - ret = -EINVAL; - goto out; - } - - ret = lbs_cmd_with_response(priv, reg, &cmd); - -out: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -static void lbs_queue_cmd(struct lbs_private *priv, - struct cmd_ctrl_node *cmdnode) -{ - unsigned long flags; - int addtail = 1; - - lbs_deb_enter(LBS_DEB_HOST); - - if (!cmdnode) { - lbs_deb_host("QUEUE_CMD: cmdnode is NULL\n"); - goto done; - } - if (!cmdnode->cmdbuf->size) { - lbs_deb_host("DNLD_CMD: cmd size is zero\n"); - goto done; - } - cmdnode->result = 0; - - /* Exit_PS command needs to be queued in the header always. */ - if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) { - struct cmd_ds_802_11_ps_mode *psm = (void *) &cmdnode->cmdbuf; - - if (psm->action == cpu_to_le16(PS_MODE_ACTION_EXIT_PS)) { - if (priv->psstate != PS_STATE_FULL_POWER) - addtail = 0; - } - } - - if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_WAKEUP_CONFIRM) - addtail = 0; - - spin_lock_irqsave(&priv->driver_lock, flags); - - if (addtail) - list_add_tail(&cmdnode->list, &priv->cmdpendingq); - else - list_add(&cmdnode->list, &priv->cmdpendingq); - - spin_unlock_irqrestore(&priv->driver_lock, flags); - - lbs_deb_host("QUEUE_CMD: inserted command 0x%04x into cmdpendingq\n", - le16_to_cpu(cmdnode->cmdbuf->command)); - -done: - lbs_deb_leave(LBS_DEB_HOST); -} - -static void lbs_submit_command(struct lbs_private *priv, - struct cmd_ctrl_node *cmdnode) -{ - unsigned long flags; - struct cmd_header *cmd; - uint16_t cmdsize; - uint16_t command; - int timeo = 3 * HZ; - int ret; - - lbs_deb_enter(LBS_DEB_HOST); - - cmd = cmdnode->cmdbuf; - - spin_lock_irqsave(&priv->driver_lock, flags); - priv->seqnum++; - cmd->seqnum = cpu_to_le16(priv->seqnum); - priv->cur_cmd = cmdnode; - spin_unlock_irqrestore(&priv->driver_lock, flags); - - cmdsize = le16_to_cpu(cmd->size); - command = le16_to_cpu(cmd->command); - - /* These commands take longer */ - if (command == CMD_802_11_SCAN || command == CMD_802_11_ASSOCIATE) - timeo = 5 * HZ; - - lbs_deb_cmd("DNLD_CMD: command 0x%04x, seq %d, size %d\n", - command, le16_to_cpu(cmd->seqnum), cmdsize); - lbs_deb_hex(LBS_DEB_CMD, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize); - - ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); - - if (ret) { - netdev_info(priv->dev, "DNLD_CMD: hw_host_to_card failed: %d\n", - ret); - /* Reset dnld state machine, report failure */ - priv->dnld_sent = DNLD_RES_RECEIVED; - lbs_complete_command(priv, cmdnode, ret); - } - - if (command == CMD_802_11_DEEP_SLEEP) { - if (priv->is_auto_deep_sleep_enabled) { - priv->wakeup_dev_required = 1; - priv->dnld_sent = 0; - } - priv->is_deep_sleep = 1; - lbs_complete_command(priv, cmdnode, 0); - } else { - /* Setup the timer after transmit command */ - mod_timer(&priv->command_timer, jiffies + timeo); - } - - lbs_deb_leave(LBS_DEB_HOST); -} - -/* - * This function inserts command node to cmdfreeq - * after cleans it. Requires priv->driver_lock held. - */ -static void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, - struct cmd_ctrl_node *cmdnode) -{ - lbs_deb_enter(LBS_DEB_HOST); - - if (!cmdnode) - goto out; - - cmdnode->callback = NULL; - cmdnode->callback_arg = 0; - - memset(cmdnode->cmdbuf, 0, LBS_CMD_BUFFER_SIZE); - - list_add_tail(&cmdnode->list, &priv->cmdfreeq); - out: - lbs_deb_leave(LBS_DEB_HOST); -} - -static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv, - struct cmd_ctrl_node *ptempcmd) -{ - unsigned long flags; - - spin_lock_irqsave(&priv->driver_lock, flags); - __lbs_cleanup_and_insert_cmd(priv, ptempcmd); - spin_unlock_irqrestore(&priv->driver_lock, flags); -} - -void __lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, - int result) -{ - /* - * Normally, commands are removed from cmdpendingq before being - * submitted. However, we can arrive here on alternative codepaths - * where the command is still pending. Make sure the command really - * isn't part of a list at this point. - */ - list_del_init(&cmd->list); - - cmd->result = result; - cmd->cmdwaitqwoken = 1; - wake_up(&cmd->cmdwait_q); - - if (!cmd->callback || cmd->callback == lbs_cmd_async_callback) - __lbs_cleanup_and_insert_cmd(priv, cmd); - priv->cur_cmd = NULL; - wake_up(&priv->waitq); -} - -void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, - int result) -{ - unsigned long flags; - spin_lock_irqsave(&priv->driver_lock, flags); - __lbs_complete_command(priv, cmd, result); - spin_unlock_irqrestore(&priv->driver_lock, flags); -} - -int lbs_set_radio(struct lbs_private *priv, u8 preamble, u8 radio_on) -{ - struct cmd_ds_802_11_radio_control cmd; - int ret = -EINVAL; - - lbs_deb_enter(LBS_DEB_CMD); - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - - /* Only v8 and below support setting the preamble */ - if (priv->fwrelease < 0x09000000) { - switch (preamble) { - case RADIO_PREAMBLE_SHORT: - case RADIO_PREAMBLE_AUTO: - case RADIO_PREAMBLE_LONG: - cmd.control = cpu_to_le16(preamble); - break; - default: - goto out; - } - } - - if (radio_on) - cmd.control |= cpu_to_le16(0x1); - else { - cmd.control &= cpu_to_le16(~0x1); - priv->txpower_cur = 0; - } - - lbs_deb_cmd("RADIO_CONTROL: radio %s, preamble %d\n", - radio_on ? "ON" : "OFF", preamble); - - priv->radio_on = radio_on; - - ret = lbs_cmd_with_response(priv, CMD_802_11_RADIO_CONTROL, &cmd); - -out: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -void lbs_set_mac_control(struct lbs_private *priv) -{ - struct cmd_ds_mac_control cmd; - - lbs_deb_enter(LBS_DEB_CMD); - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(priv->mac_control); - cmd.reserved = 0; - - lbs_cmd_async(priv, CMD_MAC_CONTROL, &cmd.hdr, sizeof(cmd)); - - lbs_deb_leave(LBS_DEB_CMD); -} - -int lbs_set_mac_control_sync(struct lbs_private *priv) -{ - struct cmd_ds_mac_control cmd; - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(priv->mac_control); - cmd.reserved = 0; - ret = lbs_cmd_with_response(priv, CMD_MAC_CONTROL, &cmd); - - lbs_deb_leave(LBS_DEB_CMD); - return ret; -} - -/** - * lbs_allocate_cmd_buffer - allocates the command buffer and links - * it to command free queue - * - * @priv: A pointer to &struct lbs_private structure - * - * returns: 0 for success or -1 on error - */ -int lbs_allocate_cmd_buffer(struct lbs_private *priv) -{ - int ret = 0; - u32 bufsize; - u32 i; - struct cmd_ctrl_node *cmdarray; - - lbs_deb_enter(LBS_DEB_HOST); - - /* Allocate and initialize the command array */ - bufsize = sizeof(struct cmd_ctrl_node) * LBS_NUM_CMD_BUFFERS; - if (!(cmdarray = kzalloc(bufsize, GFP_KERNEL))) { - lbs_deb_host("ALLOC_CMD_BUF: tempcmd_array is NULL\n"); - ret = -1; - goto done; - } - priv->cmd_array = cmdarray; - - /* Allocate and initialize each command buffer in the command array */ - for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { - cmdarray[i].cmdbuf = kzalloc(LBS_CMD_BUFFER_SIZE, GFP_KERNEL); - if (!cmdarray[i].cmdbuf) { - lbs_deb_host("ALLOC_CMD_BUF: ptempvirtualaddr is NULL\n"); - ret = -1; - goto done; - } - } - - for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { - init_waitqueue_head(&cmdarray[i].cmdwait_q); - lbs_cleanup_and_insert_cmd(priv, &cmdarray[i]); - } - ret = 0; - -done: - lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); - return ret; -} - -/** - * lbs_free_cmd_buffer - free the command buffer - * - * @priv: A pointer to &struct lbs_private structure - * - * returns: 0 for success - */ -int lbs_free_cmd_buffer(struct lbs_private *priv) -{ - struct cmd_ctrl_node *cmdarray; - unsigned int i; - - lbs_deb_enter(LBS_DEB_HOST); - - /* need to check if cmd array is allocated or not */ - if (priv->cmd_array == NULL) { - lbs_deb_host("FREE_CMD_BUF: cmd_array is NULL\n"); - goto done; - } - - cmdarray = priv->cmd_array; - - /* Release shared memory buffers */ - for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { - if (cmdarray[i].cmdbuf) { - kfree(cmdarray[i].cmdbuf); - cmdarray[i].cmdbuf = NULL; - } - } - - /* Release cmd_ctrl_node */ - if (priv->cmd_array) { - kfree(priv->cmd_array); - priv->cmd_array = NULL; - } - -done: - lbs_deb_leave(LBS_DEB_HOST); - return 0; -} - -/** - * lbs_get_free_cmd_node - gets a free command node if available in - * command free queue - * - * @priv: A pointer to &struct lbs_private structure - * - * returns: A pointer to &cmd_ctrl_node structure on success - * or %NULL on error - */ -static struct cmd_ctrl_node *lbs_get_free_cmd_node(struct lbs_private *priv) -{ - struct cmd_ctrl_node *tempnode; - unsigned long flags; - - lbs_deb_enter(LBS_DEB_HOST); - - if (!priv) - return NULL; - - spin_lock_irqsave(&priv->driver_lock, flags); - - if (!list_empty(&priv->cmdfreeq)) { - tempnode = list_first_entry(&priv->cmdfreeq, - struct cmd_ctrl_node, list); - list_del_init(&tempnode->list); - } else { - lbs_deb_host("GET_CMD_NODE: cmd_ctrl_node is not available\n"); - tempnode = NULL; - } - - spin_unlock_irqrestore(&priv->driver_lock, flags); - - lbs_deb_leave(LBS_DEB_HOST); - return tempnode; -} - -/** - * lbs_execute_next_command - execute next command in command - * pending queue. Will put firmware back to PS mode if applicable. - * - * @priv: A pointer to &struct lbs_private structure - * - * returns: 0 on success or -1 on error - */ -int lbs_execute_next_command(struct lbs_private *priv) -{ - struct cmd_ctrl_node *cmdnode = NULL; - struct cmd_header *cmd; - unsigned long flags; - int ret = 0; - - /* Debug group is LBS_DEB_THREAD and not LBS_DEB_HOST, because the - * only caller to us is lbs_thread() and we get even when a - * data packet is received */ - lbs_deb_enter(LBS_DEB_THREAD); - - spin_lock_irqsave(&priv->driver_lock, flags); - - if (priv->cur_cmd) { - netdev_alert(priv->dev, - "EXEC_NEXT_CMD: already processing command!\n"); - spin_unlock_irqrestore(&priv->driver_lock, flags); - ret = -1; - goto done; - } - - if (!list_empty(&priv->cmdpendingq)) { - cmdnode = list_first_entry(&priv->cmdpendingq, - struct cmd_ctrl_node, list); - } - - spin_unlock_irqrestore(&priv->driver_lock, flags); - - if (cmdnode) { - cmd = cmdnode->cmdbuf; - - if (is_command_allowed_in_ps(le16_to_cpu(cmd->command))) { - if ((priv->psstate == PS_STATE_SLEEP) || - (priv->psstate == PS_STATE_PRE_SLEEP)) { - lbs_deb_host( - "EXEC_NEXT_CMD: cannot send cmd 0x%04x in psstate %d\n", - le16_to_cpu(cmd->command), - priv->psstate); - ret = -1; - goto done; - } - lbs_deb_host("EXEC_NEXT_CMD: OK to send command " - "0x%04x in psstate %d\n", - le16_to_cpu(cmd->command), priv->psstate); - } else if (priv->psstate != PS_STATE_FULL_POWER) { - /* - * 1. Non-PS command: - * Queue it. set needtowakeup to TRUE if current state - * is SLEEP, otherwise call send EXIT_PS. - * 2. PS command but not EXIT_PS: - * Ignore it. - * 3. PS command EXIT_PS: - * Set needtowakeup to TRUE if current state is SLEEP, - * otherwise send this command down to firmware - * immediately. - */ - if (cmd->command != cpu_to_le16(CMD_802_11_PS_MODE)) { - /* Prepare to send Exit PS, - * this non PS command will be sent later */ - if ((priv->psstate == PS_STATE_SLEEP) - || (priv->psstate == PS_STATE_PRE_SLEEP) - ) { - /* w/ new scheme, it will not reach here. - since it is blocked in main_thread. */ - priv->needtowakeup = 1; - } else { - lbs_set_ps_mode(priv, - PS_MODE_ACTION_EXIT_PS, - false); - } - - ret = 0; - goto done; - } else { - /* - * PS command. Ignore it if it is not Exit_PS. - * otherwise send it down immediately. - */ - struct cmd_ds_802_11_ps_mode *psm = (void *)&cmd[1]; - - lbs_deb_host( - "EXEC_NEXT_CMD: PS cmd, action 0x%02x\n", - psm->action); - if (psm->action != - cpu_to_le16(PS_MODE_ACTION_EXIT_PS)) { - lbs_deb_host( - "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); - lbs_complete_command(priv, cmdnode, 0); - - ret = 0; - goto done; - } - - if ((priv->psstate == PS_STATE_SLEEP) || - (priv->psstate == PS_STATE_PRE_SLEEP)) { - lbs_deb_host( - "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); - lbs_complete_command(priv, cmdnode, 0); - priv->needtowakeup = 1; - - ret = 0; - goto done; - } - - lbs_deb_host( - "EXEC_NEXT_CMD: sending EXIT_PS\n"); - } - } - spin_lock_irqsave(&priv->driver_lock, flags); - list_del_init(&cmdnode->list); - spin_unlock_irqrestore(&priv->driver_lock, flags); - lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n", - le16_to_cpu(cmd->command)); - lbs_submit_command(priv, cmdnode); - } else { - /* - * check if in power save mode, if yes, put the device back - * to PS mode - */ -#ifdef TODO - /* - * This was the old code for libertas+wext. Someone that - * understands this beast should re-code it in a sane way. - * - * I actually don't understand why this is related to WPA - * and to connection status, shouldn't powering should be - * independ of such things? - */ - if ((priv->psmode != LBS802_11POWERMODECAM) && - (priv->psstate == PS_STATE_FULL_POWER) && - ((priv->connect_status == LBS_CONNECTED) || - lbs_mesh_connected(priv))) { - if (priv->secinfo.WPAenabled || - priv->secinfo.WPA2enabled) { - /* check for valid WPA group keys */ - if (priv->wpa_mcast_key.len || - priv->wpa_unicast_key.len) { - lbs_deb_host( - "EXEC_NEXT_CMD: WPA enabled and GTK_SET" - " go back to PS_SLEEP"); - lbs_set_ps_mode(priv, - PS_MODE_ACTION_ENTER_PS, - false); - } - } else { - lbs_deb_host( - "EXEC_NEXT_CMD: cmdpendingq empty, " - "go back to PS_SLEEP"); - lbs_set_ps_mode(priv, PS_MODE_ACTION_ENTER_PS, - false); - } - } -#endif - } - - ret = 0; -done: - lbs_deb_leave(LBS_DEB_THREAD); - return ret; -} - -static void lbs_send_confirmsleep(struct lbs_private *priv) -{ - unsigned long flags; - int ret; - - lbs_deb_enter(LBS_DEB_HOST); - lbs_deb_hex(LBS_DEB_HOST, "sleep confirm", (u8 *) &confirm_sleep, - sizeof(confirm_sleep)); - - ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) &confirm_sleep, - sizeof(confirm_sleep)); - if (ret) { - netdev_alert(priv->dev, "confirm_sleep failed\n"); - goto out; - } - - spin_lock_irqsave(&priv->driver_lock, flags); - - /* We don't get a response on the sleep-confirmation */ - priv->dnld_sent = DNLD_RES_RECEIVED; - - if (priv->is_host_sleep_configured) { - priv->is_host_sleep_activated = 1; - wake_up_interruptible(&priv->host_sleep_q); - } - - /* If nothing to do, go back to sleep (?) */ - if (!kfifo_len(&priv->event_fifo) && !priv->resp_len[priv->resp_idx]) - priv->psstate = PS_STATE_SLEEP; - - spin_unlock_irqrestore(&priv->driver_lock, flags); - -out: - lbs_deb_leave(LBS_DEB_HOST); -} - -/** - * lbs_ps_confirm_sleep - checks condition and prepares to - * send sleep confirm command to firmware if ok - * - * @priv: A pointer to &struct lbs_private structure - * - * returns: n/a - */ -void lbs_ps_confirm_sleep(struct lbs_private *priv) -{ - unsigned long flags =0; - int allowed = 1; - - lbs_deb_enter(LBS_DEB_HOST); - - spin_lock_irqsave(&priv->driver_lock, flags); - if (priv->dnld_sent) { - allowed = 0; - lbs_deb_host("dnld_sent was set\n"); - } - - /* In-progress command? */ - if (priv->cur_cmd) { - allowed = 0; - lbs_deb_host("cur_cmd was set\n"); - } - - /* Pending events or command responses? */ - if (kfifo_len(&priv->event_fifo) || priv->resp_len[priv->resp_idx]) { - allowed = 0; - lbs_deb_host("pending events or command responses\n"); - } - spin_unlock_irqrestore(&priv->driver_lock, flags); - - if (allowed) { - lbs_deb_host("sending lbs_ps_confirm_sleep\n"); - lbs_send_confirmsleep(priv); - } else { - lbs_deb_host("sleep confirm has been delayed\n"); - } - - lbs_deb_leave(LBS_DEB_HOST); -} - - -/** - * lbs_set_tpc_cfg - Configures the transmission power control functionality - * - * @priv: A pointer to &struct lbs_private structure - * @enable: Transmission power control enable - * @p0: Power level when link quality is good (dBm). - * @p1: Power level when link quality is fair (dBm). - * @p2: Power level when link quality is poor (dBm). - * @usesnr: Use Signal to Noise Ratio in TPC - * - * returns: 0 on success - */ -int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1, - int8_t p2, int usesnr) -{ - struct cmd_ds_802_11_tpc_cfg cmd; - int ret; - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - cmd.enable = !!enable; - cmd.usesnr = !!usesnr; - cmd.P0 = p0; - cmd.P1 = p1; - cmd.P2 = p2; - - ret = lbs_cmd_with_response(priv, CMD_802_11_TPC_CFG, &cmd); - - return ret; -} - -/** - * lbs_set_power_adapt_cfg - Configures the power adaptation settings - * - * @priv: A pointer to &struct lbs_private structure - * @enable: Power adaptation enable - * @p0: Power level for 1, 2, 5.5 and 11 Mbps (dBm). - * @p1: Power level for 6, 9, 12, 18, 22, 24 and 36 Mbps (dBm). - * @p2: Power level for 48 and 54 Mbps (dBm). - * - * returns: 0 on Success - */ - -int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0, - int8_t p1, int8_t p2) -{ - struct cmd_ds_802_11_pa_cfg cmd; - int ret; - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - cmd.enable = !!enable; - cmd.P0 = p0; - cmd.P1 = p1; - cmd.P2 = p2; - - ret = lbs_cmd_with_response(priv, CMD_802_11_PA_CFG , &cmd); - - return ret; -} - - -struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, - uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, - int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), - unsigned long callback_arg) -{ - struct cmd_ctrl_node *cmdnode; - - lbs_deb_enter(LBS_DEB_HOST); - - if (priv->surpriseremoved) { - lbs_deb_host("PREP_CMD: card removed\n"); - cmdnode = ERR_PTR(-ENOENT); - goto done; - } - - /* No commands are allowed in Deep Sleep until we toggle the GPIO - * to wake up the card and it has signaled that it's ready. - */ - if (!priv->is_auto_deep_sleep_enabled) { - if (priv->is_deep_sleep) { - lbs_deb_cmd("command not allowed in deep sleep\n"); - cmdnode = ERR_PTR(-EBUSY); - goto done; - } - } - - cmdnode = lbs_get_free_cmd_node(priv); - if (cmdnode == NULL) { - lbs_deb_host("PREP_CMD: cmdnode is NULL\n"); - - /* Wake up main thread to execute next command */ - wake_up(&priv->waitq); - cmdnode = ERR_PTR(-ENOBUFS); - goto done; - } - - cmdnode->callback = callback; - cmdnode->callback_arg = callback_arg; - - /* Copy the incoming command to the buffer */ - memcpy(cmdnode->cmdbuf, in_cmd, in_cmd_size); - - /* Set command, clean result, move to buffer */ - cmdnode->cmdbuf->command = cpu_to_le16(command); - cmdnode->cmdbuf->size = cpu_to_le16(in_cmd_size); - cmdnode->cmdbuf->result = 0; - - lbs_deb_host("PREP_CMD: command 0x%04x\n", command); - - cmdnode->cmdwaitqwoken = 0; - lbs_queue_cmd(priv, cmdnode); - wake_up(&priv->waitq); - - done: - lbs_deb_leave_args(LBS_DEB_HOST, "ret %p", cmdnode); - return cmdnode; -} - -void lbs_cmd_async(struct lbs_private *priv, uint16_t command, - struct cmd_header *in_cmd, int in_cmd_size) -{ - lbs_deb_enter(LBS_DEB_CMD); - __lbs_cmd_async(priv, command, in_cmd, in_cmd_size, - lbs_cmd_async_callback, 0); - lbs_deb_leave(LBS_DEB_CMD); -} - -int __lbs_cmd(struct lbs_private *priv, uint16_t command, - struct cmd_header *in_cmd, int in_cmd_size, - int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), - unsigned long callback_arg) -{ - struct cmd_ctrl_node *cmdnode; - unsigned long flags; - int ret = 0; - - lbs_deb_enter(LBS_DEB_HOST); - - cmdnode = __lbs_cmd_async(priv, command, in_cmd, in_cmd_size, - callback, callback_arg); - if (IS_ERR(cmdnode)) { - ret = PTR_ERR(cmdnode); - goto done; - } - - might_sleep(); - - /* - * Be careful with signals here. A signal may be received as the system - * goes into suspend or resume. We do not want this to interrupt the - * command, so we perform an uninterruptible sleep. - */ - wait_event(cmdnode->cmdwait_q, cmdnode->cmdwaitqwoken); - - spin_lock_irqsave(&priv->driver_lock, flags); - ret = cmdnode->result; - if (ret) - netdev_info(priv->dev, "PREP_CMD: command 0x%04x failed: %d\n", - command, ret); - - __lbs_cleanup_and_insert_cmd(priv, cmdnode); - spin_unlock_irqrestore(&priv->driver_lock, flags); - -done: - lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); - return ret; -} -EXPORT_SYMBOL_GPL(__lbs_cmd); diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h deleted file mode 100644 index 4279e8ab95f2..000000000000 --- a/drivers/net/wireless/libertas/cmd.h +++ /dev/null @@ -1,140 +0,0 @@ -/* Copyright (C) 2007, Red Hat, Inc. */ - -#ifndef _LBS_CMD_H_ -#define _LBS_CMD_H_ - -#include - -#include "host.h" -#include "dev.h" - - -/* Command & response transfer between host and card */ - -struct cmd_ctrl_node { - struct list_head list; - int result; - /* command response */ - int (*callback)(struct lbs_private *, - unsigned long, - struct cmd_header *); - unsigned long callback_arg; - /* command data */ - struct cmd_header *cmdbuf; - /* wait queue */ - u16 cmdwaitqwoken; - wait_queue_head_t cmdwait_q; -}; - - -/* lbs_cmd() infers the size of the buffer to copy data back into, from - the size of the target of the pointer. Since the command to be sent - may often be smaller, that size is set in cmd->size by the caller.*/ -#define lbs_cmd(priv, cmdnr, cmd, cb, cb_arg) ({ \ - uint16_t __sz = le16_to_cpu((cmd)->hdr.size); \ - (cmd)->hdr.size = cpu_to_le16(sizeof(*(cmd))); \ - __lbs_cmd(priv, cmdnr, &(cmd)->hdr, __sz, cb, cb_arg); \ -}) - -#define lbs_cmd_with_response(priv, cmdnr, cmd) \ - lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd)) - -void lbs_cmd_async(struct lbs_private *priv, uint16_t command, - struct cmd_header *in_cmd, int in_cmd_size); - -int __lbs_cmd(struct lbs_private *priv, uint16_t command, - struct cmd_header *in_cmd, int in_cmd_size, - int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), - unsigned long callback_arg); - -struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, - uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, - int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), - unsigned long callback_arg); - -int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra, - struct cmd_header *resp); - -int lbs_allocate_cmd_buffer(struct lbs_private *priv); -int lbs_free_cmd_buffer(struct lbs_private *priv); - -int lbs_execute_next_command(struct lbs_private *priv); -void __lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, - int result); -void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, - int result); -int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len); - - -/* From cmdresp.c */ - -void lbs_mac_event_disconnected(struct lbs_private *priv); - - - -/* Events */ - -int lbs_process_event(struct lbs_private *priv, u32 event); - - -/* Actual commands */ - -int lbs_update_hw_spec(struct lbs_private *priv); - -int lbs_set_channel(struct lbs_private *priv, u8 channel); - -int lbs_update_channel(struct lbs_private *priv); - -int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, - struct wol_config *p_wol_config); - -int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, - struct sleep_params *sp); - -void lbs_ps_confirm_sleep(struct lbs_private *priv); - -int lbs_set_radio(struct lbs_private *priv, u8 preamble, u8 radio_on); - -void lbs_set_mac_control(struct lbs_private *priv); -int lbs_set_mac_control_sync(struct lbs_private *priv); - -int lbs_get_tx_power(struct lbs_private *priv, s16 *curlevel, s16 *minlevel, - s16 *maxlevel); - -int lbs_set_snmp_mib(struct lbs_private *priv, u32 oid, u16 val); - -int lbs_get_snmp_mib(struct lbs_private *priv, u32 oid, u16 *out_val); - - -/* Commands only used in wext.c, assoc. and scan.c */ - -int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0, - int8_t p1, int8_t p2); - -int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1, - int8_t p2, int usesnr); - -int lbs_set_data_rate(struct lbs_private *priv, u8 rate); - -int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv, - uint16_t cmd_action); - -int lbs_set_tx_power(struct lbs_private *priv, s16 dbm); - -int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep); - -int lbs_set_host_sleep(struct lbs_private *priv, int host_sleep); - -int lbs_set_monitor_mode(struct lbs_private *priv, int enable); - -int lbs_get_rssi(struct lbs_private *priv, s8 *snr, s8 *nf); - -int lbs_set_11d_domain_info(struct lbs_private *priv); - -int lbs_get_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 *value); - -int lbs_set_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 value); - -int lbs_set_ps_mode(struct lbs_private *priv, u16 cmd_action, bool block); - -#endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c deleted file mode 100644 index 178b222b3ce1..000000000000 --- a/drivers/net/wireless/libertas/cmdresp.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * This file contains the handling of command - * responses as well as events generated by firmware. - */ - -#include -#include -#include -#include -#include -#include - -#include "cfg.h" -#include "cmd.h" - -/** - * lbs_mac_event_disconnected - handles disconnect event. It - * reports disconnect to upper layer, clean tx/rx packets, - * reset link state etc. - * - * @priv: A pointer to struct lbs_private structure - * - * returns: n/a - */ -void lbs_mac_event_disconnected(struct lbs_private *priv) -{ - if (priv->connect_status != LBS_CONNECTED) - return; - - lbs_deb_enter(LBS_DEB_ASSOC); - - /* - * Cisco AP sends EAP failure and de-auth in less than 0.5 ms. - * It causes problem in the Supplicant - */ - msleep_interruptible(1000); - - if (priv->wdev->iftype == NL80211_IFTYPE_STATION) - lbs_send_disconnect_notification(priv); - - /* report disconnect to upper layer */ - netif_stop_queue(priv->dev); - netif_carrier_off(priv->dev); - - /* Free Tx and Rx packets */ - kfree_skb(priv->currenttxskb); - priv->currenttxskb = NULL; - priv->tx_pending_len = 0; - - priv->connect_status = LBS_DISCONNECTED; - - if (priv->psstate != PS_STATE_FULL_POWER) { - /* make firmware to exit PS mode */ - lbs_deb_cmd("disconnected, so exit PS mode\n"); - lbs_set_ps_mode(priv, PS_MODE_ACTION_EXIT_PS, false); - } - lbs_deb_leave(LBS_DEB_ASSOC); -} - -int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len) -{ - uint16_t respcmd, curcmd; - struct cmd_header *resp; - int ret = 0; - unsigned long flags; - uint16_t result; - - lbs_deb_enter(LBS_DEB_HOST); - - mutex_lock(&priv->lock); - spin_lock_irqsave(&priv->driver_lock, flags); - - if (!priv->cur_cmd) { - lbs_deb_host("CMD_RESP: cur_cmd is NULL\n"); - ret = -1; - spin_unlock_irqrestore(&priv->driver_lock, flags); - goto done; - } - - resp = (void *)data; - curcmd = le16_to_cpu(priv->cur_cmd->cmdbuf->command); - respcmd = le16_to_cpu(resp->command); - result = le16_to_cpu(resp->result); - - lbs_deb_cmd("CMD_RESP: response 0x%04x, seq %d, size %d\n", - respcmd, le16_to_cpu(resp->seqnum), len); - lbs_deb_hex(LBS_DEB_CMD, "CMD_RESP", (void *) resp, len); - - if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) { - netdev_info(priv->dev, - "Received CMD_RESP with invalid sequence %d (expected %d)\n", - le16_to_cpu(resp->seqnum), - le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum)); - spin_unlock_irqrestore(&priv->driver_lock, flags); - ret = -1; - goto done; - } - if (respcmd != CMD_RET(curcmd) && - respcmd != CMD_RET_802_11_ASSOCIATE && curcmd != CMD_802_11_ASSOCIATE) { - netdev_info(priv->dev, "Invalid CMD_RESP %x to command %x!\n", - respcmd, curcmd); - spin_unlock_irqrestore(&priv->driver_lock, flags); - ret = -1; - goto done; - } - - if (resp->result == cpu_to_le16(0x0004)) { - /* 0x0004 means -EAGAIN. Drop the response, let it time out - and be resubmitted */ - netdev_info(priv->dev, - "Firmware returns DEFER to command %x. Will let it time out...\n", - le16_to_cpu(resp->command)); - spin_unlock_irqrestore(&priv->driver_lock, flags); - ret = -1; - goto done; - } - - /* Now we got response from FW, cancel the command timer */ - del_timer(&priv->command_timer); - priv->cmd_timed_out = 0; - - if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { - struct cmd_ds_802_11_ps_mode *psmode = (void *) &resp[1]; - u16 action = le16_to_cpu(psmode->action); - - lbs_deb_host( - "CMD_RESP: PS_MODE cmd reply result 0x%x, action 0x%x\n", - result, action); - - if (result) { - lbs_deb_host("CMD_RESP: PS command failed with 0x%x\n", - result); - /* - * We should not re-try enter-ps command in - * ad-hoc mode. It takes place in - * lbs_execute_next_command(). - */ - if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR && - action == PS_MODE_ACTION_ENTER_PS) - priv->psmode = LBS802_11POWERMODECAM; - } else if (action == PS_MODE_ACTION_ENTER_PS) { - priv->needtowakeup = 0; - priv->psstate = PS_STATE_AWAKE; - - lbs_deb_host("CMD_RESP: ENTER_PS command response\n"); - if (priv->connect_status != LBS_CONNECTED) { - /* - * When Deauth Event received before Enter_PS command - * response, We need to wake up the firmware. - */ - lbs_deb_host( - "disconnected, invoking lbs_ps_wakeup\n"); - - spin_unlock_irqrestore(&priv->driver_lock, flags); - mutex_unlock(&priv->lock); - lbs_set_ps_mode(priv, PS_MODE_ACTION_EXIT_PS, - false); - mutex_lock(&priv->lock); - spin_lock_irqsave(&priv->driver_lock, flags); - } - } else if (action == PS_MODE_ACTION_EXIT_PS) { - priv->needtowakeup = 0; - priv->psstate = PS_STATE_FULL_POWER; - lbs_deb_host("CMD_RESP: EXIT_PS command response\n"); - } else { - lbs_deb_host("CMD_RESP: PS action 0x%X\n", action); - } - - __lbs_complete_command(priv, priv->cur_cmd, result); - spin_unlock_irqrestore(&priv->driver_lock, flags); - - ret = 0; - goto done; - } - - /* If the command is not successful, cleanup and return failure */ - if ((result != 0 || !(respcmd & 0x8000))) { - lbs_deb_host("CMD_RESP: error 0x%04x in command reply 0x%04x\n", - result, respcmd); - /* - * Handling errors here - */ - switch (respcmd) { - case CMD_RET(CMD_GET_HW_SPEC): - case CMD_RET(CMD_802_11_RESET): - lbs_deb_host("CMD_RESP: reset failed\n"); - break; - - } - __lbs_complete_command(priv, priv->cur_cmd, result); - spin_unlock_irqrestore(&priv->driver_lock, flags); - - ret = -1; - goto done; - } - - spin_unlock_irqrestore(&priv->driver_lock, flags); - - if (priv->cur_cmd && priv->cur_cmd->callback) { - ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg, - resp); - } - - spin_lock_irqsave(&priv->driver_lock, flags); - - if (priv->cur_cmd) { - /* Clean up and Put current command back to cmdfreeq */ - __lbs_complete_command(priv, priv->cur_cmd, result); - } - spin_unlock_irqrestore(&priv->driver_lock, flags); - -done: - mutex_unlock(&priv->lock); - lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); - return ret; -} - -int lbs_process_event(struct lbs_private *priv, u32 event) -{ - int ret = 0; - struct cmd_header cmd; - - lbs_deb_enter(LBS_DEB_CMD); - - switch (event) { - case MACREG_INT_CODE_LINK_SENSED: - lbs_deb_cmd("EVENT: link sensed\n"); - break; - - case MACREG_INT_CODE_DEAUTHENTICATED: - lbs_deb_cmd("EVENT: deauthenticated\n"); - lbs_mac_event_disconnected(priv); - break; - - case MACREG_INT_CODE_DISASSOCIATED: - lbs_deb_cmd("EVENT: disassociated\n"); - lbs_mac_event_disconnected(priv); - break; - - case MACREG_INT_CODE_LINK_LOST_NO_SCAN: - lbs_deb_cmd("EVENT: link lost\n"); - lbs_mac_event_disconnected(priv); - break; - - case MACREG_INT_CODE_PS_SLEEP: - lbs_deb_cmd("EVENT: ps sleep\n"); - - /* handle unexpected PS SLEEP event */ - if (priv->psstate == PS_STATE_FULL_POWER) { - lbs_deb_cmd( - "EVENT: in FULL POWER mode, ignoreing PS_SLEEP\n"); - break; - } - priv->psstate = PS_STATE_PRE_SLEEP; - - lbs_ps_confirm_sleep(priv); - - break; - - case MACREG_INT_CODE_HOST_AWAKE: - lbs_deb_cmd("EVENT: host awake\n"); - if (priv->reset_deep_sleep_wakeup) - priv->reset_deep_sleep_wakeup(priv); - priv->is_deep_sleep = 0; - lbs_cmd_async(priv, CMD_802_11_WAKEUP_CONFIRM, &cmd, - sizeof(cmd)); - priv->is_host_sleep_activated = 0; - wake_up_interruptible(&priv->host_sleep_q); - break; - - case MACREG_INT_CODE_DEEP_SLEEP_AWAKE: - if (priv->reset_deep_sleep_wakeup) - priv->reset_deep_sleep_wakeup(priv); - lbs_deb_cmd("EVENT: ds awake\n"); - priv->is_deep_sleep = 0; - priv->wakeup_dev_required = 0; - wake_up_interruptible(&priv->ds_awake_q); - break; - - case MACREG_INT_CODE_PS_AWAKE: - lbs_deb_cmd("EVENT: ps awake\n"); - /* handle unexpected PS AWAKE event */ - if (priv->psstate == PS_STATE_FULL_POWER) { - lbs_deb_cmd( - "EVENT: In FULL POWER mode - ignore PS AWAKE\n"); - break; - } - - priv->psstate = PS_STATE_AWAKE; - - if (priv->needtowakeup) { - /* - * wait for the command processing to finish - * before resuming sending - * priv->needtowakeup will be set to FALSE - * in lbs_ps_wakeup() - */ - lbs_deb_cmd("waking up ...\n"); - lbs_set_ps_mode(priv, PS_MODE_ACTION_EXIT_PS, false); - } - break; - - case MACREG_INT_CODE_MIC_ERR_UNICAST: - lbs_deb_cmd("EVENT: UNICAST MIC ERROR\n"); - lbs_send_mic_failureevent(priv, event); - break; - - case MACREG_INT_CODE_MIC_ERR_MULTICAST: - lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n"); - lbs_send_mic_failureevent(priv, event); - break; - - case MACREG_INT_CODE_MIB_CHANGED: - lbs_deb_cmd("EVENT: MIB CHANGED\n"); - break; - case MACREG_INT_CODE_INIT_DONE: - lbs_deb_cmd("EVENT: INIT DONE\n"); - break; - case MACREG_INT_CODE_ADHOC_BCN_LOST: - lbs_deb_cmd("EVENT: ADHOC beacon lost\n"); - break; - case MACREG_INT_CODE_RSSI_LOW: - netdev_alert(priv->dev, "EVENT: rssi low\n"); - break; - case MACREG_INT_CODE_SNR_LOW: - netdev_alert(priv->dev, "EVENT: snr low\n"); - break; - case MACREG_INT_CODE_MAX_FAIL: - netdev_alert(priv->dev, "EVENT: max fail\n"); - break; - case MACREG_INT_CODE_RSSI_HIGH: - netdev_alert(priv->dev, "EVENT: rssi high\n"); - break; - case MACREG_INT_CODE_SNR_HIGH: - netdev_alert(priv->dev, "EVENT: snr high\n"); - break; - - case MACREG_INT_CODE_MESH_AUTO_STARTED: - /* Ignore spurious autostart events */ - netdev_info(priv->dev, "EVENT: MESH_AUTO_STARTED (ignoring)\n"); - break; - - default: - netdev_alert(priv->dev, "EVENT: unknown event id %d\n", event); - break; - } - - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c deleted file mode 100644 index cc6a0a586f0b..000000000000 --- a/drivers/net/wireless/libertas/debugfs.c +++ /dev/null @@ -1,990 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "decl.h" -#include "cmd.h" -#include "debugfs.h" - -static struct dentry *lbs_dir; -static char *szStates[] = { - "Connected", - "Disconnected" -}; - -#ifdef PROC_DEBUG -static void lbs_debug_init(struct lbs_private *priv); -#endif - -static ssize_t write_file_dummy(struct file *file, const char __user *buf, - size_t count, loff_t *ppos) -{ - return -EINVAL; -} - -static const size_t len = PAGE_SIZE; - -static ssize_t lbs_dev_info(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - size_t pos = 0; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - ssize_t res; - if (!buf) - return -ENOMEM; - - pos += snprintf(buf+pos, len-pos, "state = %s\n", - szStates[priv->connect_status]); - pos += snprintf(buf+pos, len-pos, "region_code = %02x\n", - (u32) priv->regioncode); - - res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - - free_page(addr); - return res; -} - -static ssize_t lbs_sleepparams_write(struct file *file, - const char __user *user_buf, size_t count, - loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t buf_size, ret; - struct sleep_params sp; - int p1, p2, p3, p4, p5, p6; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - if (!buf) - return -ENOMEM; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, user_buf, buf_size)) { - ret = -EFAULT; - goto out_unlock; - } - ret = sscanf(buf, "%d %d %d %d %d %d", &p1, &p2, &p3, &p4, &p5, &p6); - if (ret != 6) { - ret = -EINVAL; - goto out_unlock; - } - sp.sp_error = p1; - sp.sp_offset = p2; - sp.sp_stabletime = p3; - sp.sp_calcontrol = p4; - sp.sp_extsleepclk = p5; - sp.sp_reserved = p6; - - ret = lbs_cmd_802_11_sleep_params(priv, CMD_ACT_SET, &sp); - if (!ret) - ret = count; - else if (ret > 0) - ret = -EINVAL; - -out_unlock: - free_page(addr); - return ret; -} - -static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t ret; - size_t pos = 0; - struct sleep_params sp; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - if (!buf) - return -ENOMEM; - - ret = lbs_cmd_802_11_sleep_params(priv, CMD_ACT_GET, &sp); - if (ret) - goto out_unlock; - - pos += snprintf(buf, len, "%d %d %d %d %d %d\n", sp.sp_error, - sp.sp_offset, sp.sp_stabletime, - sp.sp_calcontrol, sp.sp_extsleepclk, - sp.sp_reserved); - - ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - -out_unlock: - free_page(addr); - return ret; -} - -static ssize_t lbs_host_sleep_write(struct file *file, - const char __user *user_buf, size_t count, - loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t buf_size, ret; - int host_sleep; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - if (!buf) - return -ENOMEM; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, user_buf, buf_size)) { - ret = -EFAULT; - goto out_unlock; - } - ret = sscanf(buf, "%d", &host_sleep); - if (ret != 1) { - ret = -EINVAL; - goto out_unlock; - } - - if (host_sleep == 0) - ret = lbs_set_host_sleep(priv, 0); - else if (host_sleep == 1) { - if (priv->wol_criteria == EHS_REMOVE_WAKEUP) { - netdev_info(priv->dev, - "wake parameters not configured\n"); - ret = -EINVAL; - goto out_unlock; - } - ret = lbs_set_host_sleep(priv, 1); - } else { - netdev_err(priv->dev, "invalid option\n"); - ret = -EINVAL; - } - - if (!ret) - ret = count; - -out_unlock: - free_page(addr); - return ret; -} - -static ssize_t lbs_host_sleep_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t ret; - size_t pos = 0; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - if (!buf) - return -ENOMEM; - - pos += snprintf(buf, len, "%d\n", priv->is_host_sleep_activated); - - ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - - free_page(addr); - return ret; -} - -/* - * When calling CMD_802_11_SUBSCRIBE_EVENT with CMD_ACT_GET, me might - * get a bunch of vendor-specific TLVs (a.k.a. IEs) back from the - * firmware. Here's an example: - * 04 01 02 00 00 00 05 01 02 00 00 00 06 01 02 00 - * 00 00 07 01 02 00 3c 00 00 00 00 00 00 00 03 03 - * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - * - * The 04 01 is the TLV type (here TLV_TYPE_RSSI_LOW), 02 00 is the length, - * 00 00 are the data bytes of this TLV. For this TLV, their meaning is - * defined in mrvlietypes_thresholds - * - * This function searches in this TLV data chunk for a given TLV type - * and returns a pointer to the first data byte of the TLV, or to NULL - * if the TLV hasn't been found. - */ -static void *lbs_tlv_find(uint16_t tlv_type, const uint8_t *tlv, uint16_t size) -{ - struct mrvl_ie_header *tlv_h; - uint16_t length; - ssize_t pos = 0; - - while (pos < size) { - tlv_h = (struct mrvl_ie_header *) tlv; - if (!tlv_h->len) - return NULL; - if (tlv_h->type == cpu_to_le16(tlv_type)) - return tlv_h; - length = le16_to_cpu(tlv_h->len) + sizeof(*tlv_h); - pos += length; - tlv += length; - } - return NULL; -} - - -static ssize_t lbs_threshold_read(uint16_t tlv_type, uint16_t event_mask, - struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct cmd_ds_802_11_subscribe_event *subscribed; - struct mrvl_ie_thresholds *got; - struct lbs_private *priv = file->private_data; - ssize_t ret = 0; - size_t pos = 0; - char *buf; - u8 value; - u8 freq; - int events = 0; - - buf = (char *)get_zeroed_page(GFP_KERNEL); - if (!buf) - return -ENOMEM; - - subscribed = kzalloc(sizeof(*subscribed), GFP_KERNEL); - if (!subscribed) { - ret = -ENOMEM; - goto out_page; - } - - subscribed->hdr.size = cpu_to_le16(sizeof(*subscribed)); - subscribed->action = cpu_to_le16(CMD_ACT_GET); - - ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, subscribed); - if (ret) - goto out_cmd; - - got = lbs_tlv_find(tlv_type, subscribed->tlv, sizeof(subscribed->tlv)); - if (got) { - value = got->value; - freq = got->freq; - events = le16_to_cpu(subscribed->events); - - pos += snprintf(buf, len, "%d %d %d\n", value, freq, - !!(events & event_mask)); - } - - ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - - out_cmd: - kfree(subscribed); - - out_page: - free_page((unsigned long)buf); - return ret; -} - - -static ssize_t lbs_threshold_write(uint16_t tlv_type, uint16_t event_mask, - struct file *file, - const char __user *userbuf, size_t count, - loff_t *ppos) -{ - struct cmd_ds_802_11_subscribe_event *events; - struct mrvl_ie_thresholds *tlv; - struct lbs_private *priv = file->private_data; - ssize_t buf_size; - int value, freq, new_mask; - uint16_t curr_mask; - char *buf; - int ret; - - buf = (char *)get_zeroed_page(GFP_KERNEL); - if (!buf) - return -ENOMEM; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - ret = -EFAULT; - goto out_page; - } - ret = sscanf(buf, "%d %d %d", &value, &freq, &new_mask); - if (ret != 3) { - ret = -EINVAL; - goto out_page; - } - events = kzalloc(sizeof(*events), GFP_KERNEL); - if (!events) { - ret = -ENOMEM; - goto out_page; - } - - events->hdr.size = cpu_to_le16(sizeof(*events)); - events->action = cpu_to_le16(CMD_ACT_GET); - - ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, events); - if (ret) - goto out_events; - - curr_mask = le16_to_cpu(events->events); - - if (new_mask) - new_mask = curr_mask | event_mask; - else - new_mask = curr_mask & ~event_mask; - - /* Now everything is set and we can send stuff down to the firmware */ - - tlv = (void *)events->tlv; - - events->action = cpu_to_le16(CMD_ACT_SET); - events->events = cpu_to_le16(new_mask); - tlv->header.type = cpu_to_le16(tlv_type); - tlv->header.len = cpu_to_le16(sizeof(*tlv) - sizeof(tlv->header)); - tlv->value = value; - if (tlv_type != TLV_TYPE_BCNMISS) - tlv->freq = freq; - - /* The command header, the action, the event mask, and one TLV */ - events->hdr.size = cpu_to_le16(sizeof(events->hdr) + 4 + sizeof(*tlv)); - - ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, events); - - if (!ret) - ret = count; - out_events: - kfree(events); - out_page: - free_page((unsigned long)buf); - return ret; -} - - -static ssize_t lbs_lowrssi_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_read(TLV_TYPE_RSSI_LOW, CMD_SUBSCRIBE_RSSI_LOW, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_lowrssi_write(struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_write(TLV_TYPE_RSSI_LOW, CMD_SUBSCRIBE_RSSI_LOW, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_lowsnr_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_read(TLV_TYPE_SNR_LOW, CMD_SUBSCRIBE_SNR_LOW, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_lowsnr_write(struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_write(TLV_TYPE_SNR_LOW, CMD_SUBSCRIBE_SNR_LOW, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_failcount_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_read(TLV_TYPE_FAILCOUNT, CMD_SUBSCRIBE_FAILCOUNT, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_failcount_write(struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_write(TLV_TYPE_FAILCOUNT, CMD_SUBSCRIBE_FAILCOUNT, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_highrssi_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_read(TLV_TYPE_RSSI_HIGH, CMD_SUBSCRIBE_RSSI_HIGH, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_highrssi_write(struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_write(TLV_TYPE_RSSI_HIGH, CMD_SUBSCRIBE_RSSI_HIGH, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_highsnr_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_read(TLV_TYPE_SNR_HIGH, CMD_SUBSCRIBE_SNR_HIGH, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_highsnr_write(struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_write(TLV_TYPE_SNR_HIGH, CMD_SUBSCRIBE_SNR_HIGH, - file, userbuf, count, ppos); -} - -static ssize_t lbs_bcnmiss_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_read(TLV_TYPE_BCNMISS, CMD_SUBSCRIBE_BCNMISS, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_bcnmiss_write(struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_write(TLV_TYPE_BCNMISS, CMD_SUBSCRIBE_BCNMISS, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t pos = 0; - int ret; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - u32 val = 0; - - if (!buf) - return -ENOMEM; - - ret = lbs_get_reg(priv, CMD_MAC_REG_ACCESS, priv->mac_offset, &val); - mdelay(10); - if (!ret) { - pos = snprintf(buf, len, "MAC[0x%x] = 0x%08x\n", - priv->mac_offset, val); - ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - } - free_page(addr); - return ret; -} - -static ssize_t lbs_rdmac_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t res, buf_size; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - if (!buf) - return -ENOMEM; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - priv->mac_offset = simple_strtoul(buf, NULL, 16); - res = count; -out_unlock: - free_page(addr); - return res; -} - -static ssize_t lbs_wrmac_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - - struct lbs_private *priv = file->private_data; - ssize_t res, buf_size; - u32 offset, value; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - if (!buf) - return -ENOMEM; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - res = sscanf(buf, "%x %x", &offset, &value); - if (res != 2) { - res = -EFAULT; - goto out_unlock; - } - - res = lbs_set_reg(priv, CMD_MAC_REG_ACCESS, offset, value); - mdelay(10); - - if (!res) - res = count; -out_unlock: - free_page(addr); - return res; -} - -static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t pos = 0; - int ret; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - u32 val; - - if (!buf) - return -ENOMEM; - - ret = lbs_get_reg(priv, CMD_BBP_REG_ACCESS, priv->bbp_offset, &val); - mdelay(10); - if (!ret) { - pos = snprintf(buf, len, "BBP[0x%x] = 0x%08x\n", - priv->bbp_offset, val); - ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - } - free_page(addr); - - return ret; -} - -static ssize_t lbs_rdbbp_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t res, buf_size; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - if (!buf) - return -ENOMEM; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - priv->bbp_offset = simple_strtoul(buf, NULL, 16); - res = count; -out_unlock: - free_page(addr); - return res; -} - -static ssize_t lbs_wrbbp_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - - struct lbs_private *priv = file->private_data; - ssize_t res, buf_size; - u32 offset, value; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - if (!buf) - return -ENOMEM; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - res = sscanf(buf, "%x %x", &offset, &value); - if (res != 2) { - res = -EFAULT; - goto out_unlock; - } - - res = lbs_set_reg(priv, CMD_BBP_REG_ACCESS, offset, value); - mdelay(10); - - if (!res) - res = count; -out_unlock: - free_page(addr); - return res; -} - -static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t pos = 0; - int ret; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - u32 val; - - if (!buf) - return -ENOMEM; - - ret = lbs_get_reg(priv, CMD_RF_REG_ACCESS, priv->rf_offset, &val); - mdelay(10); - if (!ret) { - pos = snprintf(buf, len, "RF[0x%x] = 0x%08x\n", - priv->rf_offset, val); - ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - } - free_page(addr); - - return ret; -} - -static ssize_t lbs_rdrf_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t res, buf_size; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - if (!buf) - return -ENOMEM; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - priv->rf_offset = simple_strtoul(buf, NULL, 16); - res = count; -out_unlock: - free_page(addr); - return res; -} - -static ssize_t lbs_wrrf_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - - struct lbs_private *priv = file->private_data; - ssize_t res, buf_size; - u32 offset, value; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - if (!buf) - return -ENOMEM; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - res = sscanf(buf, "%x %x", &offset, &value); - if (res != 2) { - res = -EFAULT; - goto out_unlock; - } - - res = lbs_set_reg(priv, CMD_RF_REG_ACCESS, offset, value); - mdelay(10); - - if (!res) - res = count; -out_unlock: - free_page(addr); - return res; -} - -#define FOPS(fread, fwrite) { \ - .owner = THIS_MODULE, \ - .open = simple_open, \ - .read = (fread), \ - .write = (fwrite), \ - .llseek = generic_file_llseek, \ -} - -struct lbs_debugfs_files { - const char *name; - umode_t perm; - struct file_operations fops; -}; - -static const struct lbs_debugfs_files debugfs_files[] = { - { "info", 0444, FOPS(lbs_dev_info, write_file_dummy), }, - { "sleepparams", 0644, FOPS(lbs_sleepparams_read, - lbs_sleepparams_write), }, - { "hostsleep", 0644, FOPS(lbs_host_sleep_read, - lbs_host_sleep_write), }, -}; - -static const struct lbs_debugfs_files debugfs_events_files[] = { - {"low_rssi", 0644, FOPS(lbs_lowrssi_read, - lbs_lowrssi_write), }, - {"low_snr", 0644, FOPS(lbs_lowsnr_read, - lbs_lowsnr_write), }, - {"failure_count", 0644, FOPS(lbs_failcount_read, - lbs_failcount_write), }, - {"beacon_missed", 0644, FOPS(lbs_bcnmiss_read, - lbs_bcnmiss_write), }, - {"high_rssi", 0644, FOPS(lbs_highrssi_read, - lbs_highrssi_write), }, - {"high_snr", 0644, FOPS(lbs_highsnr_read, - lbs_highsnr_write), }, -}; - -static const struct lbs_debugfs_files debugfs_regs_files[] = { - {"rdmac", 0644, FOPS(lbs_rdmac_read, lbs_rdmac_write), }, - {"wrmac", 0600, FOPS(NULL, lbs_wrmac_write), }, - {"rdbbp", 0644, FOPS(lbs_rdbbp_read, lbs_rdbbp_write), }, - {"wrbbp", 0600, FOPS(NULL, lbs_wrbbp_write), }, - {"rdrf", 0644, FOPS(lbs_rdrf_read, lbs_rdrf_write), }, - {"wrrf", 0600, FOPS(NULL, lbs_wrrf_write), }, -}; - -void lbs_debugfs_init(void) -{ - if (!lbs_dir) - lbs_dir = debugfs_create_dir("lbs_wireless", NULL); -} - -void lbs_debugfs_remove(void) -{ - if (lbs_dir) - debugfs_remove(lbs_dir); -} - -void lbs_debugfs_init_one(struct lbs_private *priv, struct net_device *dev) -{ - int i; - const struct lbs_debugfs_files *files; - if (!lbs_dir) - goto exit; - - priv->debugfs_dir = debugfs_create_dir(dev->name, lbs_dir); - if (!priv->debugfs_dir) - goto exit; - - for (i=0; idebugfs_files[i] = debugfs_create_file(files->name, - files->perm, - priv->debugfs_dir, - priv, - &files->fops); - } - - priv->events_dir = debugfs_create_dir("subscribed_events", priv->debugfs_dir); - if (!priv->events_dir) - goto exit; - - for (i=0; idebugfs_events_files[i] = debugfs_create_file(files->name, - files->perm, - priv->events_dir, - priv, - &files->fops); - } - - priv->regs_dir = debugfs_create_dir("registers", priv->debugfs_dir); - if (!priv->regs_dir) - goto exit; - - for (i=0; idebugfs_regs_files[i] = debugfs_create_file(files->name, - files->perm, - priv->regs_dir, - priv, - &files->fops); - } - -#ifdef PROC_DEBUG - lbs_debug_init(priv); -#endif -exit: - return; -} - -void lbs_debugfs_remove_one(struct lbs_private *priv) -{ - int i; - - for(i=0; idebugfs_regs_files[i]); - - debugfs_remove(priv->regs_dir); - - for(i=0; idebugfs_events_files[i]); - - debugfs_remove(priv->events_dir); -#ifdef PROC_DEBUG - debugfs_remove(priv->debugfs_debug); -#endif - for(i=0; idebugfs_files[i]); - debugfs_remove(priv->debugfs_dir); -} - - - -/* debug entry */ - -#ifdef PROC_DEBUG - -#define item_size(n) (FIELD_SIZEOF(struct lbs_private, n)) -#define item_addr(n) (offsetof(struct lbs_private, n)) - - -struct debug_data { - char name[32]; - u32 size; - size_t addr; -}; - -/* To debug any member of struct lbs_private, simply add one line here. - */ -static struct debug_data items[] = { - {"psmode", item_size(psmode), item_addr(psmode)}, - {"psstate", item_size(psstate), item_addr(psstate)}, -}; - -static int num_of_items = ARRAY_SIZE(items); - -/** - * lbs_debugfs_read - proc read function - * - * @file: file to read - * @userbuf: pointer to buffer - * @count: number of bytes to read - * @ppos: read data starting position - * - * returns: amount of data read or negative error code - */ -static ssize_t lbs_debugfs_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - int val = 0; - size_t pos = 0; - ssize_t res; - char *p; - int i; - struct debug_data *d; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - if (!buf) - return -ENOMEM; - - p = buf; - - d = file->private_data; - - for (i = 0; i < num_of_items; i++) { - if (d[i].size == 1) - val = *((u8 *) d[i].addr); - else if (d[i].size == 2) - val = *((u16 *) d[i].addr); - else if (d[i].size == 4) - val = *((u32 *) d[i].addr); - else if (d[i].size == 8) - val = *((u64 *) d[i].addr); - - pos += sprintf(p + pos, "%s=%d\n", d[i].name, val); - } - - res = simple_read_from_buffer(userbuf, count, ppos, p, pos); - - free_page(addr); - return res; -} - -/** - * lbs_debugfs_write - proc write function - * - * @f: file pointer - * @buf: pointer to data buffer - * @cnt: data number to write - * @ppos: file position - * - * returns: amount of data written - */ -static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf, - size_t cnt, loff_t *ppos) -{ - int r, i; - char *pdata; - char *p; - char *p0; - char *p1; - char *p2; - struct debug_data *d = f->private_data; - - if (cnt == 0) - return 0; - - pdata = kmalloc(cnt + 1, GFP_KERNEL); - if (pdata == NULL) - return 0; - - if (copy_from_user(pdata, buf, cnt)) { - lbs_deb_debugfs("Copy from user failed\n"); - kfree(pdata); - return 0; - } - pdata[cnt] = '\0'; - - p0 = pdata; - for (i = 0; i < num_of_items; i++) { - do { - p = strstr(p0, d[i].name); - if (p == NULL) - break; - p1 = strchr(p, '\n'); - if (p1 == NULL) - break; - p0 = p1++; - p2 = strchr(p, '='); - if (!p2) - break; - p2++; - r = simple_strtoul(p2, NULL, 0); - if (d[i].size == 1) - *((u8 *) d[i].addr) = (u8) r; - else if (d[i].size == 2) - *((u16 *) d[i].addr) = (u16) r; - else if (d[i].size == 4) - *((u32 *) d[i].addr) = (u32) r; - else if (d[i].size == 8) - *((u64 *) d[i].addr) = (u64) r; - break; - } while (1); - } - kfree(pdata); - - return (ssize_t)cnt; -} - -static const struct file_operations lbs_debug_fops = { - .owner = THIS_MODULE, - .open = simple_open, - .write = lbs_debugfs_write, - .read = lbs_debugfs_read, - .llseek = default_llseek, -}; - -/** - * lbs_debug_init - create debug proc file - * - * @priv: pointer to &struct lbs_private - * - * returns: N/A - */ -static void lbs_debug_init(struct lbs_private *priv) -{ - int i; - - if (!priv->debugfs_dir) - return; - - for (i = 0; i < num_of_items; i++) - items[i].addr += (size_t) priv; - - priv->debugfs_debug = debugfs_create_file("debug", 0644, - priv->debugfs_dir, &items[0], - &lbs_debug_fops); -} -#endif diff --git a/drivers/net/wireless/libertas/debugfs.h b/drivers/net/wireless/libertas/debugfs.h deleted file mode 100644 index f2b9c7ffe0fd..000000000000 --- a/drivers/net/wireless/libertas/debugfs.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _LBS_DEBUGFS_H_ -#define _LBS_DEBUGFS_H_ - -void lbs_debugfs_init(void); -void lbs_debugfs_remove(void); - -void lbs_debugfs_init_one(struct lbs_private *priv, struct net_device *dev); -void lbs_debugfs_remove_one(struct lbs_private *priv); - -#endif diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h deleted file mode 100644 index 84a3aa7ac570..000000000000 --- a/drivers/net/wireless/libertas/decl.h +++ /dev/null @@ -1,82 +0,0 @@ - -/* - * This file contains declaration referring to - * functions defined in other source files - */ - -#ifndef _LBS_DECL_H_ -#define _LBS_DECL_H_ - -#include -#include -#include - -/* Should be terminated by a NULL entry */ -struct lbs_fw_table { - int model; - const char *helper; - const char *fwname; -}; - -struct lbs_private; -typedef void (*lbs_fw_cb)(struct lbs_private *priv, int ret, - const struct firmware *helper, const struct firmware *mainfw); - -struct lbs_private; -struct sk_buff; -struct net_device; -struct cmd_ds_command; - - -/* ethtool.c */ -extern const struct ethtool_ops lbs_ethtool_ops; - - -/* tx.c */ -void lbs_send_tx_feedback(struct lbs_private *priv, u32 try_count); -netdev_tx_t lbs_hard_start_xmit(struct sk_buff *skb, - struct net_device *dev); - -/* rx.c */ -int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *); - - -/* main.c */ -struct lbs_private *lbs_add_card(void *card, struct device *dmdev); -void lbs_remove_card(struct lbs_private *priv); -int lbs_start_card(struct lbs_private *priv); -void lbs_stop_card(struct lbs_private *priv); -void lbs_host_to_card_done(struct lbs_private *priv); - -int lbs_start_iface(struct lbs_private *priv); -int lbs_stop_iface(struct lbs_private *priv); -int lbs_set_iface_type(struct lbs_private *priv, enum nl80211_iftype type); - -int lbs_rtap_supported(struct lbs_private *priv); - -int lbs_set_mac_address(struct net_device *dev, void *addr); -void lbs_set_multicast_list(struct net_device *dev); -void lbs_update_mcast(struct lbs_private *priv); - -int lbs_suspend(struct lbs_private *priv); -int lbs_resume(struct lbs_private *priv); - -void lbs_queue_event(struct lbs_private *priv, u32 event); -void lbs_notify_command_response(struct lbs_private *priv, u8 resp_idx); - -int lbs_enter_auto_deep_sleep(struct lbs_private *priv); -int lbs_exit_auto_deep_sleep(struct lbs_private *priv); - -u32 lbs_fw_index_to_data_rate(u8 index); -u8 lbs_data_rate_to_fw_index(u32 rate); - -int lbs_get_firmware(struct device *dev, u32 card_model, - const struct lbs_fw_table *fw_table, - const struct firmware **helper, - const struct firmware **mainfw); -int lbs_get_firmware_async(struct lbs_private *priv, struct device *device, - u32 card_model, const struct lbs_fw_table *fw_table, - lbs_fw_cb callback); -void lbs_wait_for_firmware_load(struct lbs_private *priv); - -#endif diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h deleted file mode 100644 index ab966f08024a..000000000000 --- a/drivers/net/wireless/libertas/defs.h +++ /dev/null @@ -1,393 +0,0 @@ -/* - * This header file contains global constant/enum definitions, - * global variable declaration. - */ -#ifndef _LBS_DEFS_H_ -#define _LBS_DEFS_H_ - -#include - -#ifdef CONFIG_LIBERTAS_DEBUG -#define DEBUG -#define PROC_DEBUG -#endif - -#ifndef DRV_NAME -#define DRV_NAME "libertas" -#endif - - -#define LBS_DEB_ENTER 0x00000001 -#define LBS_DEB_LEAVE 0x00000002 -#define LBS_DEB_MAIN 0x00000004 -#define LBS_DEB_NET 0x00000008 -#define LBS_DEB_MESH 0x00000010 -#define LBS_DEB_WEXT 0x00000020 -#define LBS_DEB_IOCTL 0x00000040 -#define LBS_DEB_SCAN 0x00000080 -#define LBS_DEB_ASSOC 0x00000100 -#define LBS_DEB_JOIN 0x00000200 -#define LBS_DEB_11D 0x00000400 -#define LBS_DEB_DEBUGFS 0x00000800 -#define LBS_DEB_ETHTOOL 0x00001000 -#define LBS_DEB_HOST 0x00002000 -#define LBS_DEB_CMD 0x00004000 -#define LBS_DEB_RX 0x00008000 -#define LBS_DEB_TX 0x00010000 -#define LBS_DEB_USB 0x00020000 -#define LBS_DEB_CS 0x00040000 -#define LBS_DEB_FW 0x00080000 -#define LBS_DEB_THREAD 0x00100000 -#define LBS_DEB_HEX 0x00200000 -#define LBS_DEB_SDIO 0x00400000 -#define LBS_DEB_SYSFS 0x00800000 -#define LBS_DEB_SPI 0x01000000 -#define LBS_DEB_CFG80211 0x02000000 - -extern unsigned int lbs_debug; - -#ifdef DEBUG -#define LBS_DEB_LL(grp, grpnam, fmt, args...) \ -do { if ((lbs_debug & (grp)) == (grp)) \ - printk(KERN_DEBUG DRV_NAME grpnam "%s: " fmt, \ - in_interrupt() ? " (INT)" : "", ## args); } while (0) -#else -#define LBS_DEB_LL(grp, grpnam, fmt, args...) do {} while (0) -#endif - -#define lbs_deb_enter(grp) \ - LBS_DEB_LL(grp | LBS_DEB_ENTER, " enter", "%s()\n", __func__); -#define lbs_deb_enter_args(grp, fmt, args...) \ - LBS_DEB_LL(grp | LBS_DEB_ENTER, " enter", "%s(" fmt ")\n", __func__, ## args); -#define lbs_deb_leave(grp) \ - LBS_DEB_LL(grp | LBS_DEB_LEAVE, " leave", "%s()\n", __func__); -#define lbs_deb_leave_args(grp, fmt, args...) \ - LBS_DEB_LL(grp | LBS_DEB_LEAVE, " leave", "%s(), " fmt "\n", \ - __func__, ##args); -#define lbs_deb_main(fmt, args...) LBS_DEB_LL(LBS_DEB_MAIN, " main", fmt, ##args) -#define lbs_deb_net(fmt, args...) LBS_DEB_LL(LBS_DEB_NET, " net", fmt, ##args) -#define lbs_deb_mesh(fmt, args...) LBS_DEB_LL(LBS_DEB_MESH, " mesh", fmt, ##args) -#define lbs_deb_wext(fmt, args...) LBS_DEB_LL(LBS_DEB_WEXT, " wext", fmt, ##args) -#define lbs_deb_ioctl(fmt, args...) LBS_DEB_LL(LBS_DEB_IOCTL, " ioctl", fmt, ##args) -#define lbs_deb_scan(fmt, args...) LBS_DEB_LL(LBS_DEB_SCAN, " scan", fmt, ##args) -#define lbs_deb_assoc(fmt, args...) LBS_DEB_LL(LBS_DEB_ASSOC, " assoc", fmt, ##args) -#define lbs_deb_join(fmt, args...) LBS_DEB_LL(LBS_DEB_JOIN, " join", fmt, ##args) -#define lbs_deb_11d(fmt, args...) LBS_DEB_LL(LBS_DEB_11D, " 11d", fmt, ##args) -#define lbs_deb_debugfs(fmt, args...) LBS_DEB_LL(LBS_DEB_DEBUGFS, " debugfs", fmt, ##args) -#define lbs_deb_ethtool(fmt, args...) LBS_DEB_LL(LBS_DEB_ETHTOOL, " ethtool", fmt, ##args) -#define lbs_deb_host(fmt, args...) LBS_DEB_LL(LBS_DEB_HOST, " host", fmt, ##args) -#define lbs_deb_cmd(fmt, args...) LBS_DEB_LL(LBS_DEB_CMD, " cmd", fmt, ##args) -#define lbs_deb_rx(fmt, args...) LBS_DEB_LL(LBS_DEB_RX, " rx", fmt, ##args) -#define lbs_deb_tx(fmt, args...) LBS_DEB_LL(LBS_DEB_TX, " tx", fmt, ##args) -#define lbs_deb_fw(fmt, args...) LBS_DEB_LL(LBS_DEB_FW, " fw", fmt, ##args) -#define lbs_deb_usb(fmt, args...) LBS_DEB_LL(LBS_DEB_USB, " usb", fmt, ##args) -#define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, " usbd", "%s:" fmt, dev_name(dev), ##args) -#define lbs_deb_cs(fmt, args...) LBS_DEB_LL(LBS_DEB_CS, " cs", fmt, ##args) -#define lbs_deb_thread(fmt, args...) LBS_DEB_LL(LBS_DEB_THREAD, " thread", fmt, ##args) -#define lbs_deb_sdio(fmt, args...) LBS_DEB_LL(LBS_DEB_SDIO, " sdio", fmt, ##args) -#define lbs_deb_sysfs(fmt, args...) LBS_DEB_LL(LBS_DEB_SYSFS, " sysfs", fmt, ##args) -#define lbs_deb_spi(fmt, args...) LBS_DEB_LL(LBS_DEB_SPI, " spi", fmt, ##args) -#define lbs_deb_cfg80211(fmt, args...) LBS_DEB_LL(LBS_DEB_CFG80211, " cfg80211", fmt, ##args) - -#ifdef DEBUG -static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len) -{ - int i = 0; - - if (len && - (lbs_debug & LBS_DEB_HEX) && - (lbs_debug & grp)) - { - for (i = 1; i <= len; i++) { - if ((i & 0xf) == 1) { - if (i != 1) - printk("\n"); - printk(DRV_NAME " %s: ", prompt); - } - printk("%02x ", (u8) * buf); - buf++; - } - printk("\n"); - } -} -#else -#define lbs_deb_hex(grp,prompt,buf,len) do {} while (0) -#endif - - - -/* Buffer Constants */ - -/* The size of SQ memory PPA, DPA are 8 DWORDs, that keep the physical - * addresses of TxPD buffers. Station has only 8 TxPD available, Whereas - * driver has more local TxPDs. Each TxPD on the host memory is associated - * with a Tx control node. The driver maintains 8 RxPD descriptors for - * station firmware to store Rx packet information. - * - * Current version of MAC has a 32x6 multicast address buffer. - * - * 802.11b can have up to 14 channels, the driver keeps the - * BSSID(MAC address) of each APs or Ad hoc stations it has sensed. - */ - -#define MRVDRV_MAX_MULTICAST_LIST_SIZE 32 -#define LBS_NUM_CMD_BUFFERS 10 -#define LBS_CMD_BUFFER_SIZE (2 * 1024) -#define MRVDRV_MAX_CHANNEL_SIZE 14 -#define MRVDRV_ASSOCIATION_TIME_OUT 255 -#define MRVDRV_SNAP_HEADER_LEN 8 - -#define LBS_UPLD_SIZE 2312 -#define DEV_NAME_LEN 32 - -/* Wake criteria for HOST_SLEEP_CFG command */ -#define EHS_WAKE_ON_BROADCAST_DATA 0x0001 -#define EHS_WAKE_ON_UNICAST_DATA 0x0002 -#define EHS_WAKE_ON_MAC_EVENT 0x0004 -#define EHS_WAKE_ON_MULTICAST_DATA 0x0008 -#define EHS_REMOVE_WAKEUP 0xFFFFFFFF -/* Wake rules for Host_Sleep_CFG command */ -#define WOL_RULE_NET_TYPE_INFRA_OR_IBSS 0x00 -#define WOL_RULE_NET_TYPE_MESH 0x10 -#define WOL_RULE_ADDR_TYPE_BCAST 0x01 -#define WOL_RULE_ADDR_TYPE_MCAST 0x08 -#define WOL_RULE_ADDR_TYPE_UCAST 0x02 -#define WOL_RULE_OP_AND 0x01 -#define WOL_RULE_OP_OR 0x02 -#define WOL_RULE_OP_INVALID 0xFF -#define WOL_RESULT_VALID_CMD 0 -#define WOL_RESULT_NOSPC_ERR 1 -#define WOL_RESULT_EEXIST_ERR 2 - -/* Misc constants */ -/* This section defines 802.11 specific contants */ - -#define MRVDRV_MAX_BSS_DESCRIPTS 16 -#define MRVDRV_MAX_REGION_CODE 6 - -#define MRVDRV_DEFAULT_LISTEN_INTERVAL 10 - -#define MRVDRV_CHANNELS_PER_SCAN 4 -#define MRVDRV_MAX_CHANNELS_PER_SCAN 14 - -#define MRVDRV_MIN_BEACON_INTERVAL 20 -#define MRVDRV_MAX_BEACON_INTERVAL 1000 -#define MRVDRV_BEACON_INTERVAL 100 - -#define MARVELL_MESH_IE_LENGTH 9 - -/* - * Values used to populate the struct mrvl_mesh_ie. The only time you need this - * is when enabling the mesh using CMD_MESH_CONFIG. - */ -#define MARVELL_MESH_IE_TYPE 4 -#define MARVELL_MESH_IE_SUBTYPE 0 -#define MARVELL_MESH_IE_VERSION 0 -#define MARVELL_MESH_PROTO_ID_HWMP 0 -#define MARVELL_MESH_METRIC_ID 0 -#define MARVELL_MESH_CAPABILITY 0 - -/* INT status Bit Definition */ -#define MRVDRV_TX_DNLD_RDY 0x0001 -#define MRVDRV_RX_UPLD_RDY 0x0002 -#define MRVDRV_CMD_DNLD_RDY 0x0004 -#define MRVDRV_CMD_UPLD_RDY 0x0008 -#define MRVDRV_CARDEVENT 0x0010 - -/* Automatic TX control default levels */ -#define POW_ADAPT_DEFAULT_P0 13 -#define POW_ADAPT_DEFAULT_P1 15 -#define POW_ADAPT_DEFAULT_P2 18 -#define TPC_DEFAULT_P0 5 -#define TPC_DEFAULT_P1 10 -#define TPC_DEFAULT_P2 13 - -/* TxPD status */ - -/* - * Station firmware use TxPD status field to report final Tx transmit - * result, Bit masks are used to present combined situations. - */ - -#define MRVDRV_TxPD_POWER_MGMT_NULL_PACKET 0x01 -#define MRVDRV_TxPD_POWER_MGMT_LAST_PACKET 0x08 - -/* Tx mesh flag */ -/* - * Currently we are using normal WDS flag as mesh flag. - * TODO: change to proper mesh flag when MAC understands it. - */ -#define TxPD_CONTROL_WDS_FRAME (1<<17) -#define TxPD_MESH_FRAME TxPD_CONTROL_WDS_FRAME - -/* Mesh interface ID */ -#define MESH_IFACE_ID 0x0001 -/* Mesh id should be in bits 14-13-12 */ -#define MESH_IFACE_BIT_OFFSET 0x000c -/* Mesh enable bit in FW capability */ -#define MESH_CAPINFO_ENABLE_MASK (1<<16) - -/* FW definition from Marvell v4 */ -#define MRVL_FW_V4 (0x04) -/* FW definition from Marvell v5 */ -#define MRVL_FW_V5 (0x05) -/* FW definition from Marvell v10 */ -#define MRVL_FW_V10 (0x0a) -/* FW major revision definition */ -#define MRVL_FW_MAJOR_REV(x) ((x)>>24) - -/* RxPD status */ - -#define MRVDRV_RXPD_STATUS_OK 0x0001 - -/* RxPD status - Received packet types */ -/* Rx mesh flag */ -/* - * Currently we are using normal WDS flag as mesh flag. - * TODO: change to proper mesh flag when MAC understands it. - */ -#define RxPD_CONTROL_WDS_FRAME (0x40) -#define RxPD_MESH_FRAME RxPD_CONTROL_WDS_FRAME - -/* RSSI-related defines */ -/* - * RSSI constants are used to implement 802.11 RSSI threshold - * indication. if the Rx packet signal got too weak for 5 consecutive - * times, miniport driver (driver) will report this event to wrapper - */ - -#define MRVDRV_NF_DEFAULT_SCAN_VALUE (-96) - -/* RTS/FRAG related defines */ -#define MRVDRV_RTS_MIN_VALUE 0 -#define MRVDRV_RTS_MAX_VALUE 2347 -#define MRVDRV_FRAG_MIN_VALUE 256 -#define MRVDRV_FRAG_MAX_VALUE 2346 - -/* This is for firmware specific length */ -#define EXTRA_LEN 36 - -#define MRVDRV_ETH_TX_PACKET_BUFFER_SIZE \ - (ETH_FRAME_LEN + sizeof(struct txpd) + EXTRA_LEN) - -#define MRVDRV_ETH_RX_PACKET_BUFFER_SIZE \ - (ETH_FRAME_LEN + sizeof(struct rxpd) \ - + MRVDRV_SNAP_HEADER_LEN + EXTRA_LEN) - -#define CMD_F_HOSTCMD (1 << 0) -#define FW_CAPINFO_WPA (1 << 0) -#define FW_CAPINFO_PS (1 << 1) -#define FW_CAPINFO_FIRMWARE_UPGRADE (1 << 13) -#define FW_CAPINFO_BOOT2_UPGRADE (1<<14) -#define FW_CAPINFO_PERSISTENT_CONFIG (1<<15) - -#define KEY_LEN_WPA_AES 16 -#define KEY_LEN_WPA_TKIP 32 -#define KEY_LEN_WEP_104 13 -#define KEY_LEN_WEP_40 5 - -#define RF_ANTENNA_1 0x1 -#define RF_ANTENNA_2 0x2 -#define RF_ANTENNA_AUTO 0xFFFF - -#define BAND_B (0x01) -#define BAND_G (0x02) -#define ALL_802_11_BANDS (BAND_B | BAND_G) - -#define MAX_RATES 14 - -#define MAX_LEDS 8 - -/* Global Variable Declaration */ -extern const char lbs_driver_version[]; -extern u16 lbs_region_code_to_index[MRVDRV_MAX_REGION_CODE]; - - -/* ENUM definition */ -/* SNRNF_TYPE */ -enum SNRNF_TYPE { - TYPE_BEACON = 0, - TYPE_RXPD, - MAX_TYPE_B -}; - -/* SNRNF_DATA */ -enum SNRNF_DATA { - TYPE_NOAVG = 0, - TYPE_AVG, - MAX_TYPE_AVG -}; - -/* LBS_802_11_POWER_MODE */ -enum LBS_802_11_POWER_MODE { - LBS802_11POWERMODECAM, - LBS802_11POWERMODEMAX_PSP, - LBS802_11POWERMODEFAST_PSP, - /* not a real mode, defined as an upper bound */ - LBS802_11POWEMODEMAX -}; - -/* PS_STATE */ -enum PS_STATE { - PS_STATE_FULL_POWER, - PS_STATE_AWAKE, - PS_STATE_PRE_SLEEP, - PS_STATE_SLEEP -}; - -/* DNLD_STATE */ -enum DNLD_STATE { - DNLD_RES_RECEIVED, - DNLD_DATA_SENT, - DNLD_CMD_SENT, - DNLD_BOOTCMD_SENT, -}; - -/* LBS_MEDIA_STATE */ -enum LBS_MEDIA_STATE { - LBS_CONNECTED, - LBS_DISCONNECTED -}; - -/* LBS_802_11_PRIVACY_FILTER */ -enum LBS_802_11_PRIVACY_FILTER { - LBS802_11PRIVFILTERACCEPTALL, - LBS802_11PRIVFILTER8021XWEP -}; - -/* mv_ms_type */ -enum mv_ms_type { - MVMS_DAT = 0, - MVMS_CMD = 1, - MVMS_TXDONE = 2, - MVMS_EVENT -}; - -/* KEY_TYPE_ID */ -enum KEY_TYPE_ID { - KEY_TYPE_ID_WEP = 0, - KEY_TYPE_ID_TKIP, - KEY_TYPE_ID_AES -}; - -/* KEY_INFO_WPA (applies to both TKIP and AES/CCMP) */ -enum KEY_INFO_WPA { - KEY_INFO_WPA_MCAST = 0x01, - KEY_INFO_WPA_UNICAST = 0x02, - KEY_INFO_WPA_ENABLED = 0x04 -}; - -/* Default values for fwt commands. */ -#define FWT_DEFAULT_METRIC 0 -#define FWT_DEFAULT_DIR 1 -/* Default Rate, 11Mbps */ -#define FWT_DEFAULT_RATE 3 -#define FWT_DEFAULT_SSN 0xffffffff -#define FWT_DEFAULT_DSN 0 -#define FWT_DEFAULT_HOPCOUNT 0 -#define FWT_DEFAULT_TTL 0 -#define FWT_DEFAULT_EXPIRATION 0 -#define FWT_DEFAULT_SLEEPMODE 0 -#define FWT_DEFAULT_SNR 0 - -#endif diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h deleted file mode 100644 index 6bd1608992b0..000000000000 --- a/drivers/net/wireless/libertas/dev.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - * This file contains definitions and data structures specific - * to Marvell 802.11 NIC. It contains the Device Information - * structure struct lbs_private.. - */ -#ifndef _LBS_DEV_H_ -#define _LBS_DEV_H_ - -#include "defs.h" -#include "decl.h" -#include "host.h" - -#include - -/* sleep_params */ -struct sleep_params { - uint16_t sp_error; - uint16_t sp_offset; - uint16_t sp_stabletime; - uint8_t sp_calcontrol; - uint8_t sp_extsleepclk; - uint16_t sp_reserved; -}; - -/* Mesh statistics */ -struct lbs_mesh_stats { - u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */ - u32 fwd_unicast_cnt; /* Fwd: Unicast counter */ - u32 fwd_drop_ttl; /* Fwd: TTL zero */ - u32 fwd_drop_rbt; /* Fwd: Recently Broadcasted */ - u32 fwd_drop_noroute; /* Fwd: No route to Destination */ - u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */ - u32 drop_blind; /* Rx: Dropped by blinding table */ - u32 tx_failed_cnt; /* Tx: Failed transmissions */ -}; - -/* Private structure for the MV device */ -struct lbs_private { - - /* Basic networking */ - struct net_device *dev; - u32 connect_status; - struct work_struct mcast_work; - u32 nr_of_multicastmacaddr; - u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN]; - - /* CFG80211 */ - struct wireless_dev *wdev; - bool wiphy_registered; - struct cfg80211_scan_request *scan_req; - u8 assoc_bss[ETH_ALEN]; - u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; - u8 disassoc_reason; - - /* Mesh */ - struct net_device *mesh_dev; /* Virtual device */ -#ifdef CONFIG_LIBERTAS_MESH - struct lbs_mesh_stats mstats; - uint16_t mesh_tlv; - u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1]; - u8 mesh_ssid_len; - u8 mesh_channel; -#endif - - /* Debugfs */ - struct dentry *debugfs_dir; - struct dentry *debugfs_debug; - struct dentry *debugfs_files[6]; - struct dentry *events_dir; - struct dentry *debugfs_events_files[6]; - struct dentry *regs_dir; - struct dentry *debugfs_regs_files[6]; - - /* Hardware debugging */ - u32 mac_offset; - u32 bbp_offset; - u32 rf_offset; - - /* Power management */ - u16 psmode; - u32 psstate; - u8 needtowakeup; - - /* Deep sleep */ - int is_deep_sleep; - int deep_sleep_required; - int is_auto_deep_sleep_enabled; - int wakeup_dev_required; - int is_activity_detected; - int auto_deep_sleep_timeout; /* in ms */ - wait_queue_head_t ds_awake_q; - struct timer_list auto_deepsleep_timer; - - /* Host sleep*/ - int is_host_sleep_configured; - int is_host_sleep_activated; - wait_queue_head_t host_sleep_q; - - /* Hardware access */ - void *card; - bool iface_running; - u8 fw_ready; - u8 surpriseremoved; - u8 setup_fw_on_resume; - int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb); - void (*reset_card) (struct lbs_private *priv); - int (*power_save) (struct lbs_private *priv); - int (*power_restore) (struct lbs_private *priv); - int (*enter_deep_sleep) (struct lbs_private *priv); - int (*exit_deep_sleep) (struct lbs_private *priv); - int (*reset_deep_sleep_wakeup) (struct lbs_private *priv); - - /* Adapter info (from EEPROM) */ - u32 fwrelease; - u32 fwcapinfo; - u16 regioncode; - u8 current_addr[ETH_ALEN]; - u8 copied_hwaddr; - - /* Command download */ - u8 dnld_sent; - /* bit0 1/0=data_sent/data_tx_done, - bit1 1/0=cmd_sent/cmd_tx_done, - all other bits reserved 0 */ - u16 seqnum; - struct cmd_ctrl_node *cmd_array; - struct cmd_ctrl_node *cur_cmd; - struct list_head cmdfreeq; /* free command buffers */ - struct list_head cmdpendingq; /* pending command buffers */ - struct timer_list command_timer; - int cmd_timed_out; - - /* Command responses sent from the hardware to the driver */ - u8 resp_idx; - u8 resp_buf[2][LBS_UPLD_SIZE]; - u32 resp_len[2]; - - /* Events sent from hardware to driver */ - struct kfifo event_fifo; - - /* thread to service interrupts */ - struct task_struct *main_thread; - wait_queue_head_t waitq; - struct workqueue_struct *work_thread; - - /* Encryption stuff */ - u8 authtype_auto; - u8 wep_tx_key; - u8 wep_key[4][WLAN_KEY_LEN_WEP104]; - u8 wep_key_len[4]; - - /* Wake On LAN */ - uint32_t wol_criteria; - uint8_t wol_gpio; - uint8_t wol_gap; - bool ehs_remove_supported; - - /* Transmitting */ - int tx_pending_len; /* -1 while building packet */ - u8 tx_pending_buf[LBS_UPLD_SIZE]; - /* protected by hard_start_xmit serialization */ - u8 txretrycount; - struct sk_buff *currenttxskb; - struct timer_list tx_lockup_timer; - - /* Locks */ - struct mutex lock; - spinlock_t driver_lock; - - /* NIC/link operation characteristics */ - u16 mac_control; - u8 radio_on; - u8 cur_rate; - u8 channel; - s16 txpower_cur; - s16 txpower_min; - s16 txpower_max; - - /* Scanning */ - struct delayed_work scan_work; - int scan_channel; - /* Queue of things waiting for scan completion */ - wait_queue_head_t scan_q; - /* Whether the scan was initiated internally and not by cfg80211 */ - bool internal_scan; - - /* Firmware load */ - u32 fw_model; - wait_queue_head_t fw_waitq; - struct device *fw_device; - const struct firmware *helper_fw; - const struct lbs_fw_table *fw_table; - const struct lbs_fw_table *fw_iter; - lbs_fw_cb fw_callback; -}; - -extern struct cmd_confirm_sleep confirm_sleep; - -/* Check if there is an interface active. */ -static inline int lbs_iface_active(struct lbs_private *priv) -{ - int r; - - r = netif_running(priv->dev); - if (priv->mesh_dev) - r |= netif_running(priv->mesh_dev); - - return r; -} - -#endif diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c deleted file mode 100644 index f955b2d66ed6..000000000000 --- a/drivers/net/wireless/libertas/ethtool.c +++ /dev/null @@ -1,120 +0,0 @@ -#include -#include -#include -#include - -#include "decl.h" -#include "cmd.h" -#include "mesh.h" - - -static void lbs_ethtool_get_drvinfo(struct net_device *dev, - struct ethtool_drvinfo *info) -{ - struct lbs_private *priv = dev->ml_priv; - - snprintf(info->fw_version, sizeof(info->fw_version), - "%u.%u.%u.p%u", - priv->fwrelease >> 24 & 0xff, - priv->fwrelease >> 16 & 0xff, - priv->fwrelease >> 8 & 0xff, - priv->fwrelease & 0xff); - strlcpy(info->driver, "libertas", sizeof(info->driver)); - strlcpy(info->version, lbs_driver_version, sizeof(info->version)); -} - -/* - * All 8388 parts have 16KiB EEPROM size at the time of writing. - * In case that changes this needs fixing. - */ -#define LBS_EEPROM_LEN 16384 - -static int lbs_ethtool_get_eeprom_len(struct net_device *dev) -{ - return LBS_EEPROM_LEN; -} - -static int lbs_ethtool_get_eeprom(struct net_device *dev, - struct ethtool_eeprom *eeprom, u8 * bytes) -{ - struct lbs_private *priv = dev->ml_priv; - struct cmd_ds_802_11_eeprom_access cmd; - int ret; - - lbs_deb_enter(LBS_DEB_ETHTOOL); - - if (eeprom->offset + eeprom->len > LBS_EEPROM_LEN || - eeprom->len > LBS_EEPROM_READ_LEN) { - ret = -EINVAL; - goto out; - } - - cmd.hdr.size = cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) - - LBS_EEPROM_READ_LEN + eeprom->len); - cmd.action = cpu_to_le16(CMD_ACT_GET); - cmd.offset = cpu_to_le16(eeprom->offset); - cmd.len = cpu_to_le16(eeprom->len); - ret = lbs_cmd_with_response(priv, CMD_802_11_EEPROM_ACCESS, &cmd); - if (!ret) - memcpy(bytes, cmd.value, eeprom->len); - -out: - lbs_deb_leave_args(LBS_DEB_ETHTOOL, "ret %d", ret); - return ret; -} - -static void lbs_ethtool_get_wol(struct net_device *dev, - struct ethtool_wolinfo *wol) -{ - struct lbs_private *priv = dev->ml_priv; - - wol->supported = WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY; - - if (priv->wol_criteria == EHS_REMOVE_WAKEUP) - return; - - if (priv->wol_criteria & EHS_WAKE_ON_UNICAST_DATA) - wol->wolopts |= WAKE_UCAST; - if (priv->wol_criteria & EHS_WAKE_ON_MULTICAST_DATA) - wol->wolopts |= WAKE_MCAST; - if (priv->wol_criteria & EHS_WAKE_ON_BROADCAST_DATA) - wol->wolopts |= WAKE_BCAST; - if (priv->wol_criteria & EHS_WAKE_ON_MAC_EVENT) - wol->wolopts |= WAKE_PHY; -} - -static int lbs_ethtool_set_wol(struct net_device *dev, - struct ethtool_wolinfo *wol) -{ - struct lbs_private *priv = dev->ml_priv; - - if (wol->wolopts & ~(WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY)) - return -EOPNOTSUPP; - - priv->wol_criteria = 0; - if (wol->wolopts & WAKE_UCAST) - priv->wol_criteria |= EHS_WAKE_ON_UNICAST_DATA; - if (wol->wolopts & WAKE_MCAST) - priv->wol_criteria |= EHS_WAKE_ON_MULTICAST_DATA; - if (wol->wolopts & WAKE_BCAST) - priv->wol_criteria |= EHS_WAKE_ON_BROADCAST_DATA; - if (wol->wolopts & WAKE_PHY) - priv->wol_criteria |= EHS_WAKE_ON_MAC_EVENT; - if (wol->wolopts == 0) - priv->wol_criteria |= EHS_REMOVE_WAKEUP; - return 0; -} - -const struct ethtool_ops lbs_ethtool_ops = { - .get_drvinfo = lbs_ethtool_get_drvinfo, - .get_eeprom = lbs_ethtool_get_eeprom, - .get_eeprom_len = lbs_ethtool_get_eeprom_len, -#ifdef CONFIG_LIBERTAS_MESH - .get_sset_count = lbs_mesh_ethtool_get_sset_count, - .get_ethtool_stats = lbs_mesh_ethtool_get_stats, - .get_strings = lbs_mesh_ethtool_get_strings, -#endif - .get_wol = lbs_ethtool_get_wol, - .set_wol = lbs_ethtool_set_wol, -}; - diff --git a/drivers/net/wireless/libertas/firmware.c b/drivers/net/wireless/libertas/firmware.c deleted file mode 100644 index c0f9e7e862f6..000000000000 --- a/drivers/net/wireless/libertas/firmware.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Firmware loading and handling functions. - */ - -#include -#include -#include - -#include "dev.h" -#include "decl.h" - -static void load_next_firmware_from_table(struct lbs_private *private); - -static void lbs_fw_loaded(struct lbs_private *priv, int ret, - const struct firmware *helper, const struct firmware *mainfw) -{ - unsigned long flags; - - lbs_deb_fw("firmware load complete, code %d\n", ret); - - /* User must free helper/mainfw */ - priv->fw_callback(priv, ret, helper, mainfw); - - spin_lock_irqsave(&priv->driver_lock, flags); - priv->fw_callback = NULL; - wake_up(&priv->fw_waitq); - spin_unlock_irqrestore(&priv->driver_lock, flags); -} - -static void do_load_firmware(struct lbs_private *priv, const char *name, - void (*cb)(const struct firmware *fw, void *context)) -{ - int ret; - - lbs_deb_fw("Requesting %s\n", name); - ret = request_firmware_nowait(THIS_MODULE, true, name, - priv->fw_device, GFP_KERNEL, priv, cb); - if (ret) { - lbs_deb_fw("request_firmware_nowait error %d\n", ret); - lbs_fw_loaded(priv, ret, NULL, NULL); - } -} - -static void main_firmware_cb(const struct firmware *firmware, void *context) -{ - struct lbs_private *priv = context; - - if (!firmware) { - /* Failed to find firmware: try next table entry */ - load_next_firmware_from_table(priv); - return; - } - - /* Firmware found! */ - lbs_fw_loaded(priv, 0, priv->helper_fw, firmware); -} - -static void helper_firmware_cb(const struct firmware *firmware, void *context) -{ - struct lbs_private *priv = context; - - if (!firmware) { - /* Failed to find firmware: try next table entry */ - load_next_firmware_from_table(priv); - return; - } - - /* Firmware found! */ - if (priv->fw_iter->fwname) { - priv->helper_fw = firmware; - do_load_firmware(priv, priv->fw_iter->fwname, main_firmware_cb); - } else { - /* No main firmware needed for this helper --> success! */ - lbs_fw_loaded(priv, 0, firmware, NULL); - } -} - -static void load_next_firmware_from_table(struct lbs_private *priv) -{ - const struct lbs_fw_table *iter; - - if (!priv->fw_iter) - iter = priv->fw_table; - else - iter = ++priv->fw_iter; - - if (priv->helper_fw) { - release_firmware(priv->helper_fw); - priv->helper_fw = NULL; - } - -next: - if (!iter->helper) { - /* End of table hit. */ - lbs_fw_loaded(priv, -ENOENT, NULL, NULL); - return; - } - - if (iter->model != priv->fw_model) { - iter++; - goto next; - } - - priv->fw_iter = iter; - do_load_firmware(priv, iter->helper, helper_firmware_cb); -} - -void lbs_wait_for_firmware_load(struct lbs_private *priv) -{ - wait_event(priv->fw_waitq, priv->fw_callback == NULL); -} - -/** - * lbs_get_firmware_async - Retrieves firmware asynchronously. Can load - * either a helper firmware and a main firmware (2-stage), or just the helper. - * - * @priv: Pointer to lbs_private instance - * @dev: A pointer to &device structure - * @card_model: Bus-specific card model ID used to filter firmware table - * elements - * @fw_table: Table of firmware file names and device model numbers - * terminated by an entry with a NULL helper name - * @callback: User callback to invoke when firmware load succeeds or fails. - */ -int lbs_get_firmware_async(struct lbs_private *priv, struct device *device, - u32 card_model, const struct lbs_fw_table *fw_table, - lbs_fw_cb callback) -{ - unsigned long flags; - - spin_lock_irqsave(&priv->driver_lock, flags); - if (priv->fw_callback) { - lbs_deb_fw("firmware load already in progress\n"); - spin_unlock_irqrestore(&priv->driver_lock, flags); - return -EBUSY; - } - - priv->fw_device = device; - priv->fw_callback = callback; - priv->fw_table = fw_table; - priv->fw_iter = NULL; - priv->fw_model = card_model; - spin_unlock_irqrestore(&priv->driver_lock, flags); - - lbs_deb_fw("Starting async firmware load\n"); - load_next_firmware_from_table(priv); - return 0; -} -EXPORT_SYMBOL_GPL(lbs_get_firmware_async); - -/** - * lbs_get_firmware - Retrieves two-stage firmware - * - * @dev: A pointer to &device structure - * @card_model: Bus-specific card model ID used to filter firmware table - * elements - * @fw_table: Table of firmware file names and device model numbers - * terminated by an entry with a NULL helper name - * @helper: On success, the helper firmware; caller must free - * @mainfw: On success, the main firmware; caller must free - * - * Deprecated: use lbs_get_firmware_async() instead. - * - * returns: 0 on success, non-zero on failure - */ -int lbs_get_firmware(struct device *dev, u32 card_model, - const struct lbs_fw_table *fw_table, - const struct firmware **helper, - const struct firmware **mainfw) -{ - const struct lbs_fw_table *iter; - int ret; - - BUG_ON(helper == NULL); - BUG_ON(mainfw == NULL); - - /* Search for firmware to use from the table. */ - iter = fw_table; - while (iter && iter->helper) { - if (iter->model != card_model) - goto next; - - if (*helper == NULL) { - ret = request_firmware(helper, iter->helper, dev); - if (ret) - goto next; - - /* If the device has one-stage firmware (ie cf8305) and - * we've got it then we don't need to bother with the - * main firmware. - */ - if (iter->fwname == NULL) - return 0; - } - - if (*mainfw == NULL) { - ret = request_firmware(mainfw, iter->fwname, dev); - if (ret) { - /* Clear the helper to ensure we don't have - * mismatched firmware pairs. - */ - release_firmware(*helper); - *helper = NULL; - } - } - - if (*helper && *mainfw) - return 0; - - next: - iter++; - } - - /* Failed */ - release_firmware(*helper); - *helper = NULL; - release_firmware(*mainfw); - *mainfw = NULL; - - return -ENOENT; -} -EXPORT_SYMBOL_GPL(lbs_get_firmware); diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h deleted file mode 100644 index 96726f79a1dd..000000000000 --- a/drivers/net/wireless/libertas/host.h +++ /dev/null @@ -1,978 +0,0 @@ -/* - * This file function prototypes, data structure - * and definitions for all the host/station commands - */ - -#ifndef _LBS_HOST_H_ -#define _LBS_HOST_H_ - -#include "types.h" -#include "defs.h" - -#define DEFAULT_AD_HOC_CHANNEL 6 - -#define CMD_OPTION_WAITFORRSP 0x0002 - -/* Host command IDs */ - -/* - * Return command are almost always the same as the host command, but with - * bit 15 set high. There are a few exceptions, though... - */ -#define CMD_RET(cmd) (0x8000 | cmd) - -/* Return command convention exceptions: */ -#define CMD_RET_802_11_ASSOCIATE 0x8012 - -/* Command codes */ -#define CMD_GET_HW_SPEC 0x0003 -#define CMD_EEPROM_UPDATE 0x0004 -#define CMD_802_11_RESET 0x0005 -#define CMD_802_11_SCAN 0x0006 -#define CMD_802_11_GET_LOG 0x000b -#define CMD_MAC_MULTICAST_ADR 0x0010 -#define CMD_802_11_AUTHENTICATE 0x0011 -#define CMD_802_11_EEPROM_ACCESS 0x0059 -#define CMD_802_11_ASSOCIATE 0x0050 -#define CMD_802_11_SET_WEP 0x0013 -#define CMD_802_11_GET_STAT 0x0014 -#define CMD_802_3_GET_STAT 0x0015 -#define CMD_802_11_SNMP_MIB 0x0016 -#define CMD_MAC_REG_MAP 0x0017 -#define CMD_BBP_REG_MAP 0x0018 -#define CMD_MAC_REG_ACCESS 0x0019 -#define CMD_BBP_REG_ACCESS 0x001a -#define CMD_RF_REG_ACCESS 0x001b -#define CMD_802_11_RADIO_CONTROL 0x001c -#define CMD_802_11_RF_CHANNEL 0x001d -#define CMD_802_11_RF_TX_POWER 0x001e -#define CMD_802_11_RSSI 0x001f -#define CMD_802_11_RF_ANTENNA 0x0020 -#define CMD_802_11_PS_MODE 0x0021 -#define CMD_802_11_DATA_RATE 0x0022 -#define CMD_RF_REG_MAP 0x0023 -#define CMD_802_11_DEAUTHENTICATE 0x0024 -#define CMD_802_11_REASSOCIATE 0x0025 -#define CMD_MAC_CONTROL 0x0028 -#define CMD_802_11_AD_HOC_START 0x002b -#define CMD_802_11_AD_HOC_JOIN 0x002c -#define CMD_802_11_QUERY_TKIP_REPLY_CNTRS 0x002e -#define CMD_802_11_ENABLE_RSN 0x002f -#define CMD_802_11_SET_AFC 0x003c -#define CMD_802_11_GET_AFC 0x003d -#define CMD_802_11_DEEP_SLEEP 0x003e -#define CMD_802_11_AD_HOC_STOP 0x0040 -#define CMD_802_11_HOST_SLEEP_CFG 0x0043 -#define CMD_802_11_WAKEUP_CONFIRM 0x0044 -#define CMD_802_11_HOST_SLEEP_ACTIVATE 0x0045 -#define CMD_802_11_BEACON_STOP 0x0049 -#define CMD_802_11_MAC_ADDRESS 0x004d -#define CMD_802_11_LED_GPIO_CTRL 0x004e -#define CMD_802_11_BAND_CONFIG 0x0058 -#define CMD_GSPI_BUS_CONFIG 0x005a -#define CMD_802_11D_DOMAIN_INFO 0x005b -#define CMD_802_11_KEY_MATERIAL 0x005e -#define CMD_802_11_SLEEP_PARAMS 0x0066 -#define CMD_802_11_INACTIVITY_TIMEOUT 0x0067 -#define CMD_802_11_SLEEP_PERIOD 0x0068 -#define CMD_802_11_TPC_CFG 0x0072 -#define CMD_802_11_PA_CFG 0x0073 -#define CMD_802_11_FW_WAKE_METHOD 0x0074 -#define CMD_802_11_SUBSCRIBE_EVENT 0x0075 -#define CMD_802_11_RATE_ADAPT_RATESET 0x0076 -#define CMD_802_11_TX_RATE_QUERY 0x007f -#define CMD_GET_TSF 0x0080 -#define CMD_BT_ACCESS 0x0087 -#define CMD_FWT_ACCESS 0x0095 -#define CMD_802_11_MONITOR_MODE 0x0098 -#define CMD_MESH_ACCESS 0x009b -#define CMD_MESH_CONFIG_OLD 0x00a3 -#define CMD_MESH_CONFIG 0x00ac -#define CMD_SET_BOOT2_VER 0x00a5 -#define CMD_FUNC_INIT 0x00a9 -#define CMD_FUNC_SHUTDOWN 0x00aa -#define CMD_802_11_BEACON_CTRL 0x00b0 - -/* For the IEEE Power Save */ -#define PS_MODE_ACTION_ENTER_PS 0x0030 -#define PS_MODE_ACTION_EXIT_PS 0x0031 -#define PS_MODE_ACTION_SLEEP_CONFIRMED 0x0034 - -#define CMD_ENABLE_RSN 0x0001 -#define CMD_DISABLE_RSN 0x0000 - -#define CMD_ACT_GET 0x0000 -#define CMD_ACT_SET 0x0001 - -/* Define action or option for CMD_802_11_SET_WEP */ -#define CMD_ACT_ADD 0x0002 -#define CMD_ACT_REMOVE 0x0004 - -#define CMD_TYPE_WEP_40_BIT 0x01 -#define CMD_TYPE_WEP_104_BIT 0x02 - -#define CMD_NUM_OF_WEP_KEYS 4 - -#define CMD_WEP_KEY_INDEX_MASK 0x3fff - -/* Define action or option for CMD_802_11_SCAN */ -#define CMD_BSS_TYPE_BSS 0x0001 -#define CMD_BSS_TYPE_IBSS 0x0002 -#define CMD_BSS_TYPE_ANY 0x0003 - -/* Define action or option for CMD_802_11_SCAN */ -#define CMD_SCAN_TYPE_ACTIVE 0x0000 -#define CMD_SCAN_TYPE_PASSIVE 0x0001 - -#define CMD_SCAN_RADIO_TYPE_BG 0 - -#define CMD_SCAN_PROBE_DELAY_TIME 0 - -/* Define action or option for CMD_MAC_CONTROL */ -#define CMD_ACT_MAC_RX_ON 0x0001 -#define CMD_ACT_MAC_TX_ON 0x0002 -#define CMD_ACT_MAC_LOOPBACK_ON 0x0004 -#define CMD_ACT_MAC_WEP_ENABLE 0x0008 -#define CMD_ACT_MAC_INT_ENABLE 0x0010 -#define CMD_ACT_MAC_MULTICAST_ENABLE 0x0020 -#define CMD_ACT_MAC_BROADCAST_ENABLE 0x0040 -#define CMD_ACT_MAC_PROMISCUOUS_ENABLE 0x0080 -#define CMD_ACT_MAC_ALL_MULTICAST_ENABLE 0x0100 -#define CMD_ACT_MAC_STRICT_PROTECTION_ENABLE 0x0400 - -/* Event flags for CMD_802_11_SUBSCRIBE_EVENT */ -#define CMD_SUBSCRIBE_RSSI_LOW 0x0001 -#define CMD_SUBSCRIBE_SNR_LOW 0x0002 -#define CMD_SUBSCRIBE_FAILCOUNT 0x0004 -#define CMD_SUBSCRIBE_BCNMISS 0x0008 -#define CMD_SUBSCRIBE_RSSI_HIGH 0x0010 -#define CMD_SUBSCRIBE_SNR_HIGH 0x0020 - -#define RADIO_PREAMBLE_LONG 0x00 -#define RADIO_PREAMBLE_SHORT 0x02 -#define RADIO_PREAMBLE_AUTO 0x04 - -/* Define action or option for CMD_802_11_RF_CHANNEL */ -#define CMD_OPT_802_11_RF_CHANNEL_GET 0x00 -#define CMD_OPT_802_11_RF_CHANNEL_SET 0x01 - -/* Define action or option for CMD_802_11_DATA_RATE */ -#define CMD_ACT_SET_TX_AUTO 0x0000 -#define CMD_ACT_SET_TX_FIX_RATE 0x0001 -#define CMD_ACT_GET_TX_RATE 0x0002 - -/* Options for CMD_802_11_FW_WAKE_METHOD */ -#define CMD_WAKE_METHOD_UNCHANGED 0x0000 -#define CMD_WAKE_METHOD_COMMAND_INT 0x0001 -#define CMD_WAKE_METHOD_GPIO 0x0002 - -/* Object IDs for CMD_802_11_SNMP_MIB */ -#define SNMP_MIB_OID_BSS_TYPE 0x0000 -#define SNMP_MIB_OID_OP_RATE_SET 0x0001 -#define SNMP_MIB_OID_BEACON_PERIOD 0x0002 /* Reserved on v9+ */ -#define SNMP_MIB_OID_DTIM_PERIOD 0x0003 /* Reserved on v9+ */ -#define SNMP_MIB_OID_ASSOC_TIMEOUT 0x0004 /* Reserved on v9+ */ -#define SNMP_MIB_OID_RTS_THRESHOLD 0x0005 -#define SNMP_MIB_OID_SHORT_RETRY_LIMIT 0x0006 -#define SNMP_MIB_OID_LONG_RETRY_LIMIT 0x0007 -#define SNMP_MIB_OID_FRAG_THRESHOLD 0x0008 -#define SNMP_MIB_OID_11D_ENABLE 0x0009 -#define SNMP_MIB_OID_11H_ENABLE 0x000A - -/* Define action or option for CMD_BT_ACCESS */ -enum cmd_bt_access_opts { - /* The bt commands start at 5 instead of 1 because the old dft commands - * are mapped to 1-4. These old commands are no longer maintained and - * should not be called. - */ - CMD_ACT_BT_ACCESS_ADD = 5, - CMD_ACT_BT_ACCESS_DEL, - CMD_ACT_BT_ACCESS_LIST, - CMD_ACT_BT_ACCESS_RESET, - CMD_ACT_BT_ACCESS_SET_INVERT, - CMD_ACT_BT_ACCESS_GET_INVERT -}; - -/* Define action or option for CMD_FWT_ACCESS */ -enum cmd_fwt_access_opts { - CMD_ACT_FWT_ACCESS_ADD = 1, - CMD_ACT_FWT_ACCESS_DEL, - CMD_ACT_FWT_ACCESS_LOOKUP, - CMD_ACT_FWT_ACCESS_LIST, - CMD_ACT_FWT_ACCESS_LIST_ROUTE, - CMD_ACT_FWT_ACCESS_LIST_NEIGHBOR, - CMD_ACT_FWT_ACCESS_RESET, - CMD_ACT_FWT_ACCESS_CLEANUP, - CMD_ACT_FWT_ACCESS_TIME, -}; - -/* Define action or option for CMD_802_11_HOST_SLEEP_CFG */ -enum cmd_wol_cfg_opts { - CMD_ACT_ACTION_NONE = 0, - CMD_ACT_SET_WOL_RULE, - CMD_ACT_GET_WOL_RULE, - CMD_ACT_RESET_WOL_RULE, -}; - -/* Define action or option for CMD_MESH_ACCESS */ -enum cmd_mesh_access_opts { - CMD_ACT_MESH_GET_TTL = 1, - CMD_ACT_MESH_SET_TTL, - CMD_ACT_MESH_GET_STATS, - CMD_ACT_MESH_GET_ANYCAST, - CMD_ACT_MESH_SET_ANYCAST, - CMD_ACT_MESH_SET_LINK_COSTS, - CMD_ACT_MESH_GET_LINK_COSTS, - CMD_ACT_MESH_SET_BCAST_RATE, - CMD_ACT_MESH_GET_BCAST_RATE, - CMD_ACT_MESH_SET_RREQ_DELAY, - CMD_ACT_MESH_GET_RREQ_DELAY, - CMD_ACT_MESH_SET_ROUTE_EXP, - CMD_ACT_MESH_GET_ROUTE_EXP, - CMD_ACT_MESH_SET_AUTOSTART_ENABLED, - CMD_ACT_MESH_GET_AUTOSTART_ENABLED, - CMD_ACT_MESH_SET_GET_PRB_RSP_LIMIT = 17, -}; - -/* Define actions and types for CMD_MESH_CONFIG */ -enum cmd_mesh_config_actions { - CMD_ACT_MESH_CONFIG_STOP = 0, - CMD_ACT_MESH_CONFIG_START, - CMD_ACT_MESH_CONFIG_SET, - CMD_ACT_MESH_CONFIG_GET, -}; - -enum cmd_mesh_config_types { - CMD_TYPE_MESH_SET_BOOTFLAG = 1, - CMD_TYPE_MESH_SET_BOOTTIME, - CMD_TYPE_MESH_SET_DEF_CHANNEL, - CMD_TYPE_MESH_SET_MESH_IE, - CMD_TYPE_MESH_GET_DEFAULTS, - CMD_TYPE_MESH_GET_MESH_IE, /* GET_DEFAULTS is superset of GET_MESHIE */ -}; - -/* Card Event definition */ -#define MACREG_INT_CODE_TX_PPA_FREE 0 -#define MACREG_INT_CODE_TX_DMA_DONE 1 -#define MACREG_INT_CODE_LINK_LOST_W_SCAN 2 -#define MACREG_INT_CODE_LINK_LOST_NO_SCAN 3 -#define MACREG_INT_CODE_LINK_SENSED 4 -#define MACREG_INT_CODE_CMD_FINISHED 5 -#define MACREG_INT_CODE_MIB_CHANGED 6 -#define MACREG_INT_CODE_INIT_DONE 7 -#define MACREG_INT_CODE_DEAUTHENTICATED 8 -#define MACREG_INT_CODE_DISASSOCIATED 9 -#define MACREG_INT_CODE_PS_AWAKE 10 -#define MACREG_INT_CODE_PS_SLEEP 11 -#define MACREG_INT_CODE_MIC_ERR_MULTICAST 13 -#define MACREG_INT_CODE_MIC_ERR_UNICAST 14 -#define MACREG_INT_CODE_WM_AWAKE 15 -#define MACREG_INT_CODE_DEEP_SLEEP_AWAKE 16 -#define MACREG_INT_CODE_ADHOC_BCN_LOST 17 -#define MACREG_INT_CODE_HOST_AWAKE 18 -#define MACREG_INT_CODE_STOP_TX 19 -#define MACREG_INT_CODE_START_TX 20 -#define MACREG_INT_CODE_CHANNEL_SWITCH 21 -#define MACREG_INT_CODE_MEASUREMENT_RDY 22 -#define MACREG_INT_CODE_WMM_CHANGE 23 -#define MACREG_INT_CODE_BG_SCAN_REPORT 24 -#define MACREG_INT_CODE_RSSI_LOW 25 -#define MACREG_INT_CODE_SNR_LOW 26 -#define MACREG_INT_CODE_MAX_FAIL 27 -#define MACREG_INT_CODE_RSSI_HIGH 28 -#define MACREG_INT_CODE_SNR_HIGH 29 -#define MACREG_INT_CODE_MESH_AUTO_STARTED 35 -#define MACREG_INT_CODE_FIRMWARE_READY 48 - - -/* 802.11-related definitions */ - -/* TxPD descriptor */ -struct txpd { - /* union to cope up with later FW revisions */ - union { - /* Current Tx packet status */ - __le32 tx_status; - struct { - /* BSS type: client, AP, etc. */ - u8 bss_type; - /* BSS number */ - u8 bss_num; - /* Reserved */ - __le16 reserved; - } bss; - } u; - /* Tx control */ - __le32 tx_control; - __le32 tx_packet_location; - /* Tx packet length */ - __le16 tx_packet_length; - /* First 2 byte of destination MAC address */ - u8 tx_dest_addr_high[2]; - /* Last 4 byte of destination MAC address */ - u8 tx_dest_addr_low[4]; - /* Pkt Priority */ - u8 priority; - /* Pkt Trasnit Power control */ - u8 powermgmt; - /* Amount of time the packet has been queued (units = 2ms) */ - u8 pktdelay_2ms; - /* reserved */ - u8 reserved1; -} __packed; - -/* RxPD Descriptor */ -struct rxpd { - /* union to cope up with later FW revisions */ - union { - /* Current Rx packet status */ - __le16 status; - struct { - /* BSS type: client, AP, etc. */ - u8 bss_type; - /* BSS number */ - u8 bss_num; - } __packed bss; - } __packed u; - - /* SNR */ - u8 snr; - - /* Tx control */ - u8 rx_control; - - /* Pkt length */ - __le16 pkt_len; - - /* Noise Floor */ - u8 nf; - - /* Rx Packet Rate */ - u8 rx_rate; - - /* Pkt addr */ - __le32 pkt_ptr; - - /* Next Rx RxPD addr */ - __le32 next_rxpd_ptr; - - /* Pkt Priority */ - u8 priority; - u8 reserved[3]; -} __packed; - -struct cmd_header { - __le16 command; - __le16 size; - __le16 seqnum; - __le16 result; -} __packed; - -/* Generic structure to hold all key types. */ -struct enc_key { - u16 len; - u16 flags; /* KEY_INFO_* from defs.h */ - u16 type; /* KEY_TYPE_* from defs.h */ - u8 key[32]; -}; - -/* lbs_offset_value */ -struct lbs_offset_value { - u32 offset; - u32 value; -} __packed; - -#define MAX_11D_TRIPLETS 83 - -struct mrvl_ie_domain_param_set { - struct mrvl_ie_header header; - - u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; - struct ieee80211_country_ie_triplet triplet[MAX_11D_TRIPLETS]; -} __packed; - -struct cmd_ds_802_11d_domain_info { - struct cmd_header hdr; - - __le16 action; - struct mrvl_ie_domain_param_set domain; -} __packed; - -/* - * Define data structure for CMD_GET_HW_SPEC - * This structure defines the response for the GET_HW_SPEC command - */ -struct cmd_ds_get_hw_spec { - struct cmd_header hdr; - - /* HW Interface version number */ - __le16 hwifversion; - /* HW version number */ - __le16 version; - /* Max number of TxPD FW can handle */ - __le16 nr_txpd; - /* Max no of Multicast address */ - __le16 nr_mcast_adr; - /* MAC address */ - u8 permanentaddr[6]; - - /* region Code */ - __le16 regioncode; - - /* Number of antenna used */ - __le16 nr_antenna; - - /* FW release number, example 0x01030304 = 2.3.4p1 */ - __le32 fwrelease; - - /* Base Address of TxPD queue */ - __le32 wcb_base; - /* Read Pointer of RxPd queue */ - __le32 rxpd_rdptr; - - /* Write Pointer of RxPd queue */ - __le32 rxpd_wrptr; - - /*FW/HW capability */ - __le32 fwcapinfo; -} __packed; - -struct cmd_ds_802_11_subscribe_event { - struct cmd_header hdr; - - __le16 action; - __le16 events; - - /* A TLV to the CMD_802_11_SUBSCRIBE_EVENT command can contain a - * number of TLVs. From the v5.1 manual, those TLVs would add up to - * 40 bytes. However, future firmware might add additional TLVs, so I - * bump this up a bit. - */ - uint8_t tlv[128]; -} __packed; - -/* - * This scan handle Country Information IE(802.11d compliant) - * Define data structure for CMD_802_11_SCAN - */ -struct cmd_ds_802_11_scan { - struct cmd_header hdr; - - uint8_t bsstype; - uint8_t bssid[ETH_ALEN]; - uint8_t tlvbuffer[0]; -} __packed; - -struct cmd_ds_802_11_scan_rsp { - struct cmd_header hdr; - - __le16 bssdescriptsize; - uint8_t nr_sets; - uint8_t bssdesc_and_tlvbuffer[0]; -} __packed; - -struct cmd_ds_802_11_get_log { - struct cmd_header hdr; - - __le32 mcasttxframe; - __le32 failed; - __le32 retry; - __le32 multiretry; - __le32 framedup; - __le32 rtssuccess; - __le32 rtsfailure; - __le32 ackfailure; - __le32 rxfrag; - __le32 mcastrxframe; - __le32 fcserror; - __le32 txframe; - __le32 wepundecryptable; -} __packed; - -struct cmd_ds_mac_control { - struct cmd_header hdr; - __le16 action; - u16 reserved; -} __packed; - -struct cmd_ds_mac_multicast_adr { - struct cmd_header hdr; - __le16 action; - __le16 nr_of_adrs; - u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE]; -} __packed; - -struct cmd_ds_802_11_authenticate { - struct cmd_header hdr; - - u8 bssid[ETH_ALEN]; - u8 authtype; - u8 reserved[10]; -} __packed; - -struct cmd_ds_802_11_deauthenticate { - struct cmd_header hdr; - - u8 macaddr[ETH_ALEN]; - __le16 reasoncode; -} __packed; - -struct cmd_ds_802_11_associate { - struct cmd_header hdr; - - u8 bssid[6]; - __le16 capability; - __le16 listeninterval; - __le16 bcnperiod; - u8 dtimperiod; - u8 iebuf[512]; /* Enough for required and most optional IEs */ -} __packed; - -struct cmd_ds_802_11_associate_response { - struct cmd_header hdr; - - __le16 capability; - __le16 statuscode; - __le16 aid; - u8 iebuf[512]; -} __packed; - -struct cmd_ds_802_11_set_wep { - struct cmd_header hdr; - - /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */ - __le16 action; - - /* key Index selected for Tx */ - __le16 keyindex; - - /* 40, 128bit or TXWEP */ - uint8_t keytype[4]; - uint8_t keymaterial[4][16]; -} __packed; - -struct cmd_ds_802_11_snmp_mib { - struct cmd_header hdr; - - __le16 action; - __le16 oid; - __le16 bufsize; - u8 value[128]; -} __packed; - -struct cmd_ds_reg_access { - struct cmd_header hdr; - - __le16 action; - __le16 offset; - union { - u8 bbp_rf; /* for BBP and RF registers */ - __le32 mac; /* for MAC registers */ - } value; -} __packed; - -struct cmd_ds_802_11_radio_control { - struct cmd_header hdr; - - __le16 action; - __le16 control; -} __packed; - -struct cmd_ds_802_11_beacon_control { - struct cmd_header hdr; - - __le16 action; - __le16 beacon_enable; - __le16 beacon_period; -} __packed; - -struct cmd_ds_802_11_sleep_params { - struct cmd_header hdr; - - /* ACT_GET/ACT_SET */ - __le16 action; - - /* Sleep clock error in ppm */ - __le16 error; - - /* Wakeup offset in usec */ - __le16 offset; - - /* Clock stabilization time in usec */ - __le16 stabletime; - - /* control periodic calibration */ - uint8_t calcontrol; - - /* control the use of external sleep clock */ - uint8_t externalsleepclk; - - /* reserved field, should be set to zero */ - __le16 reserved; -} __packed; - -struct cmd_ds_802_11_rf_channel { - struct cmd_header hdr; - - __le16 action; - __le16 channel; - __le16 rftype; /* unused */ - __le16 reserved; /* unused */ - u8 channellist[32]; /* unused */ -} __packed; - -struct cmd_ds_802_11_rssi { - struct cmd_header hdr; - - /* - * request: number of beacons (N) to average the SNR and NF over - * response: SNR of most recent beacon - */ - __le16 n_or_snr; - - /* - * The following fields are only set in the response. - * In the request these are reserved and should be set to 0. - */ - __le16 nf; /* most recent beacon noise floor */ - __le16 avg_snr; /* average SNR weighted by N from request */ - __le16 avg_nf; /* average noise floor weighted by N from request */ -} __packed; - -struct cmd_ds_802_11_mac_address { - struct cmd_header hdr; - - __le16 action; - u8 macadd[ETH_ALEN]; -} __packed; - -struct cmd_ds_802_11_rf_tx_power { - struct cmd_header hdr; - - __le16 action; - __le16 curlevel; - s8 maxlevel; - s8 minlevel; -} __packed; - -/* MONITOR_MODE only exists in OLPC v5 firmware */ -struct cmd_ds_802_11_monitor_mode { - struct cmd_header hdr; - - __le16 action; - __le16 mode; -} __packed; - -struct cmd_ds_set_boot2_ver { - struct cmd_header hdr; - - __le16 action; - __le16 version; -} __packed; - -struct cmd_ds_802_11_fw_wake_method { - struct cmd_header hdr; - - __le16 action; - __le16 method; -} __packed; - -struct cmd_ds_802_11_ps_mode { - struct cmd_header hdr; - - __le16 action; - - /* - * Interval for keepalive in PS mode: - * 0x0000 = don't change - * 0x001E = firmware default - * 0xFFFF = disable - */ - __le16 nullpktinterval; - - /* - * Number of DTIM intervals to wake up for: - * 0 = don't change - * 1 = firmware default - * 5 = max - */ - __le16 multipledtim; - - __le16 reserved; - __le16 locallisteninterval; - - /* - * AdHoc awake period (FW v9+ only): - * 0 = don't change - * 1 = always awake (IEEE standard behavior) - * 2 - 31 = sleep for (n - 1) periods and awake for 1 period - * 32 - 254 = invalid - * 255 = sleep at each ATIM - */ - __le16 adhoc_awake_period; -} __packed; - -struct cmd_confirm_sleep { - struct cmd_header hdr; - - __le16 action; - __le16 nullpktinterval; - __le16 multipledtim; - __le16 reserved; - __le16 locallisteninterval; -} __packed; - -struct cmd_ds_802_11_data_rate { - struct cmd_header hdr; - - __le16 action; - __le16 reserved; - u8 rates[MAX_RATES]; -} __packed; - -struct cmd_ds_802_11_rate_adapt_rateset { - struct cmd_header hdr; - __le16 action; - __le16 enablehwauto; - __le16 bitmap; -} __packed; - -struct cmd_ds_802_11_ad_hoc_start { - struct cmd_header hdr; - - u8 ssid[IEEE80211_MAX_SSID_LEN]; - u8 bsstype; - __le16 beaconperiod; - u8 dtimperiod; /* Reserved on v9 and later */ - struct ieee_ie_ibss_param_set ibss; - u8 reserved1[4]; - struct ieee_ie_ds_param_set ds; - u8 reserved2[4]; - __le16 probedelay; /* Reserved on v9 and later */ - __le16 capability; - u8 rates[MAX_RATES]; - u8 tlv_memory_size_pad[100]; -} __packed; - -struct cmd_ds_802_11_ad_hoc_result { - struct cmd_header hdr; - - u8 pad[3]; - u8 bssid[ETH_ALEN]; -} __packed; - -struct adhoc_bssdesc { - u8 bssid[ETH_ALEN]; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - u8 type; - __le16 beaconperiod; - u8 dtimperiod; - __le64 timestamp; - __le64 localtime; - struct ieee_ie_ds_param_set ds; - u8 reserved1[4]; - struct ieee_ie_ibss_param_set ibss; - u8 reserved2[4]; - __le16 capability; - u8 rates[MAX_RATES]; - - /* - * DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the - * Adhoc join command and will cause a binary layout mismatch with - * the firmware - */ -} __packed; - -struct cmd_ds_802_11_ad_hoc_join { - struct cmd_header hdr; - - struct adhoc_bssdesc bss; - __le16 failtimeout; /* Reserved on v9 and later */ - __le16 probedelay; /* Reserved on v9 and later */ -} __packed; - -struct cmd_ds_802_11_ad_hoc_stop { - struct cmd_header hdr; -} __packed; - -struct cmd_ds_802_11_enable_rsn { - struct cmd_header hdr; - - __le16 action; - __le16 enable; -} __packed; - -struct MrvlIEtype_keyParamSet { - /* type ID */ - __le16 type; - - /* length of Payload */ - __le16 length; - - /* type of key: WEP=0, TKIP=1, AES=2 */ - __le16 keytypeid; - - /* key control Info specific to a keytypeid */ - __le16 keyinfo; - - /* length of key */ - __le16 keylen; - - /* key material of size keylen */ - u8 key[32]; -} __packed; - -#define MAX_WOL_RULES 16 - -struct host_wol_rule { - uint8_t rule_no; - uint8_t rule_ops; - __le16 sig_offset; - __le16 sig_length; - __le16 reserve; - __be32 sig_mask; - __be32 signature; -} __packed; - -struct wol_config { - uint8_t action; - uint8_t pattern; - uint8_t no_rules_in_cmd; - uint8_t result; - struct host_wol_rule rule[MAX_WOL_RULES]; -} __packed; - -struct cmd_ds_host_sleep { - struct cmd_header hdr; - __le32 criteria; - uint8_t gpio; - uint16_t gap; - struct wol_config wol_conf; -} __packed; - - - -struct cmd_ds_802_11_key_material { - struct cmd_header hdr; - - __le16 action; - struct MrvlIEtype_keyParamSet keyParamSet[2]; -} __packed; - -struct cmd_ds_802_11_eeprom_access { - struct cmd_header hdr; - __le16 action; - __le16 offset; - __le16 len; - /* firmware says it returns a maximum of 20 bytes */ -#define LBS_EEPROM_READ_LEN 20 - u8 value[LBS_EEPROM_READ_LEN]; -} __packed; - -struct cmd_ds_802_11_tpc_cfg { - struct cmd_header hdr; - - __le16 action; - uint8_t enable; - int8_t P0; - int8_t P1; - int8_t P2; - uint8_t usesnr; -} __packed; - - -struct cmd_ds_802_11_pa_cfg { - struct cmd_header hdr; - - __le16 action; - uint8_t enable; - int8_t P0; - int8_t P1; - int8_t P2; -} __packed; - - -struct cmd_ds_802_11_led_ctrl { - struct cmd_header hdr; - - __le16 action; - __le16 numled; - u8 data[256]; -} __packed; - -/* Automatic Frequency Control */ -struct cmd_ds_802_11_afc { - struct cmd_header hdr; - - __le16 afc_auto; - union { - struct { - __le16 threshold; - __le16 period; - }; - struct { - __le16 timing_offset; /* signed */ - __le16 carrier_offset; /* signed */ - }; - }; -} __packed; - -struct cmd_tx_rate_query { - __le16 txrate; -} __packed; - -struct cmd_ds_get_tsf { - __le64 tsfvalue; -} __packed; - -struct cmd_ds_bt_access { - struct cmd_header hdr; - - __le16 action; - __le32 id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; -} __packed; - -struct cmd_ds_fwt_access { - struct cmd_header hdr; - - __le16 action; - __le32 id; - u8 valid; - u8 da[ETH_ALEN]; - u8 dir; - u8 ra[ETH_ALEN]; - __le32 ssn; - __le32 dsn; - __le32 metric; - u8 rate; - u8 hopcount; - u8 ttl; - __le32 expiration; - u8 sleepmode; - __le32 snr; - __le32 references; - u8 prec[ETH_ALEN]; -} __packed; - -struct cmd_ds_mesh_config { - struct cmd_header hdr; - - __le16 action; - __le16 channel; - __le16 type; - __le16 length; - u8 data[128]; /* last position reserved */ -} __packed; - -struct cmd_ds_mesh_access { - struct cmd_header hdr; - - __le16 action; - __le32 data[32]; /* last position reserved */ -} __packed; - -/* Number of stats counters returned by the firmware */ -#define MESH_STATS_NUM 8 -#endif diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c deleted file mode 100644 index c94dd6802672..000000000000 --- a/drivers/net/wireless/libertas/if_cs.c +++ /dev/null @@ -1,1009 +0,0 @@ -/* - - Driver for the Marvell 8385 based compact flash WLAN cards. - - (C) 2007 by Holger Schurig - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#define DRV_NAME "libertas_cs" - -#include "decl.h" -#include "defs.h" -#include "dev.h" - - -/********************************************************************/ -/* Module stuff */ -/********************************************************************/ - -MODULE_AUTHOR("Holger Schurig "); -MODULE_DESCRIPTION("Driver for Marvell 83xx compact flash WLAN cards"); -MODULE_LICENSE("GPL"); - - - -/********************************************************************/ -/* Data structures */ -/********************************************************************/ - -struct if_cs_card { - struct pcmcia_device *p_dev; - struct lbs_private *priv; - void __iomem *iobase; - bool align_regs; - u32 model; -}; - - -enum { - MODEL_UNKNOWN = 0x00, - MODEL_8305 = 0x01, - MODEL_8381 = 0x02, - MODEL_8385 = 0x03 -}; - -static const struct lbs_fw_table fw_table[] = { - { MODEL_8305, "libertas/cf8305.bin", NULL }, - { MODEL_8305, "libertas_cs_helper.fw", NULL }, - { MODEL_8381, "libertas/cf8381_helper.bin", "libertas/cf8381.bin" }, - { MODEL_8381, "libertas_cs_helper.fw", "libertas_cs.fw" }, - { MODEL_8385, "libertas/cf8385_helper.bin", "libertas/cf8385.bin" }, - { MODEL_8385, "libertas_cs_helper.fw", "libertas_cs.fw" }, - { 0, NULL, NULL } -}; -MODULE_FIRMWARE("libertas/cf8305.bin"); -MODULE_FIRMWARE("libertas/cf8381_helper.bin"); -MODULE_FIRMWARE("libertas/cf8381.bin"); -MODULE_FIRMWARE("libertas/cf8385_helper.bin"); -MODULE_FIRMWARE("libertas/cf8385.bin"); -MODULE_FIRMWARE("libertas_cs_helper.fw"); -MODULE_FIRMWARE("libertas_cs.fw"); - - -/********************************************************************/ -/* Hardware access */ -/********************************************************************/ - -/* This define enables wrapper functions which allow you - to dump all register accesses. You normally won't this, - except for development */ -/* #define DEBUG_IO */ - -#ifdef DEBUG_IO -static int debug_output = 0; -#else -/* This way the compiler optimizes the printk's away */ -#define debug_output 0 -#endif - -static inline unsigned int if_cs_read8(struct if_cs_card *card, uint reg) -{ - unsigned int val = ioread8(card->iobase + reg); - if (debug_output) - printk(KERN_INFO "inb %08x<%02x\n", reg, val); - return val; -} -static inline unsigned int if_cs_read16(struct if_cs_card *card, uint reg) -{ - unsigned int val = ioread16(card->iobase + reg); - if (debug_output) - printk(KERN_INFO "inw %08x<%04x\n", reg, val); - return val; -} -static inline void if_cs_read16_rep( - struct if_cs_card *card, - uint reg, - void *buf, - unsigned long count) -{ - if (debug_output) - printk(KERN_INFO "insw %08x<(0x%lx words)\n", - reg, count); - ioread16_rep(card->iobase + reg, buf, count); -} - -static inline void if_cs_write8(struct if_cs_card *card, uint reg, u8 val) -{ - if (debug_output) - printk(KERN_INFO "outb %08x>%02x\n", reg, val); - iowrite8(val, card->iobase + reg); -} - -static inline void if_cs_write16(struct if_cs_card *card, uint reg, u16 val) -{ - if (debug_output) - printk(KERN_INFO "outw %08x>%04x\n", reg, val); - iowrite16(val, card->iobase + reg); -} - -static inline void if_cs_write16_rep( - struct if_cs_card *card, - uint reg, - const void *buf, - unsigned long count) -{ - if (debug_output) - printk(KERN_INFO "outsw %08x>(0x%lx words)\n", - reg, count); - iowrite16_rep(card->iobase + reg, buf, count); -} - - -/* - * I know that polling/delaying is frowned upon. However, this procedure - * with polling is needed while downloading the firmware. At this stage, - * the hardware does unfortunately not create any interrupts. - * - * Fortunately, this function is never used once the firmware is in - * the card. :-) - * - * As a reference, see the "Firmware Specification v5.1", page 18 - * and 19. I did not follow their suggested timing to the word, - * but this works nice & fast anyway. - */ -static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 reg) -{ - int i; - - for (i = 0; i < 100000; i++) { - u8 val = if_cs_read8(card, addr); - if (val == reg) - return 0; - udelay(5); - } - return -ETIME; -} - - - -/* - * First the bitmasks for the host/card interrupt/status registers: - */ -#define IF_CS_BIT_TX 0x0001 -#define IF_CS_BIT_RX 0x0002 -#define IF_CS_BIT_COMMAND 0x0004 -#define IF_CS_BIT_RESP 0x0008 -#define IF_CS_BIT_EVENT 0x0010 -#define IF_CS_BIT_MASK 0x001f - - - -/* - * It's not really clear to me what the host status register is for. It - * needs to be set almost in union with "host int cause". The following - * bits from above are used: - * - * IF_CS_BIT_TX driver downloaded a data packet - * IF_CS_BIT_RX driver got a data packet - * IF_CS_BIT_COMMAND driver downloaded a command - * IF_CS_BIT_RESP not used (has some meaning with powerdown) - * IF_CS_BIT_EVENT driver read a host event - */ -#define IF_CS_HOST_STATUS 0x00000000 - -/* - * With the host int cause register can the host (that is, Linux) cause - * an interrupt in the firmware, to tell the firmware about those events: - * - * IF_CS_BIT_TX a data packet has been downloaded - * IF_CS_BIT_RX a received data packet has retrieved - * IF_CS_BIT_COMMAND a firmware block or a command has been downloaded - * IF_CS_BIT_RESP not used (has some meaning with powerdown) - * IF_CS_BIT_EVENT a host event (link lost etc) has been retrieved - */ -#define IF_CS_HOST_INT_CAUSE 0x00000002 - -/* - * The host int mask register is used to enable/disable interrupt. However, - * I have the suspicion that disabled interrupts are lost. - */ -#define IF_CS_HOST_INT_MASK 0x00000004 - -/* - * Used to send or receive data packets: - */ -#define IF_CS_WRITE 0x00000016 -#define IF_CS_WRITE_LEN 0x00000014 -#define IF_CS_READ 0x00000010 -#define IF_CS_READ_LEN 0x00000024 - -/* - * Used to send commands (and to send firmware block) and to - * receive command responses: - */ -#define IF_CS_CMD 0x0000001A -#define IF_CS_CMD_LEN 0x00000018 -#define IF_CS_RESP 0x00000012 -#define IF_CS_RESP_LEN 0x00000030 - -/* - * The card status registers shows what the card/firmware actually - * accepts: - * - * IF_CS_BIT_TX you may send a data packet - * IF_CS_BIT_RX you may retrieve a data packet - * IF_CS_BIT_COMMAND you may send a command - * IF_CS_BIT_RESP you may retrieve a command response - * IF_CS_BIT_EVENT the card has a event for use (link lost, snr low etc) - * - * When reading this register several times, you will get back the same - * results --- with one exception: the IF_CS_BIT_EVENT clear itself - * automatically. - * - * Not that we don't rely on BIT_RX,_BIT_RESP or BIT_EVENT because - * we handle this via the card int cause register. - */ -#define IF_CS_CARD_STATUS 0x00000020 -#define IF_CS_CARD_STATUS_MASK 0x7f00 - -/* - * The card int cause register is used by the card/firmware to notify us - * about the following events: - * - * IF_CS_BIT_TX a data packet has successfully been sentx - * IF_CS_BIT_RX a data packet has been received and can be retrieved - * IF_CS_BIT_COMMAND not used - * IF_CS_BIT_RESP the firmware has a command response for us - * IF_CS_BIT_EVENT the card has a event for use (link lost, snr low etc) - */ -#define IF_CS_CARD_INT_CAUSE 0x00000022 - -/* - * This is used to for handshaking with the card's bootloader/helper image - * to synchronize downloading of firmware blocks. - */ -#define IF_CS_SQ_READ_LOW 0x00000028 -#define IF_CS_SQ_HELPER_OK 0x10 - -/* - * The scratch register tells us ... - * - * IF_CS_SCRATCH_BOOT_OK the bootloader runs - * IF_CS_SCRATCH_HELPER_OK the helper firmware already runs - */ -#define IF_CS_SCRATCH 0x0000003F -#define IF_CS_SCRATCH_BOOT_OK 0x00 -#define IF_CS_SCRATCH_HELPER_OK 0x5a - -/* - * Used to detect ancient chips: - */ -#define IF_CS_PRODUCT_ID 0x0000001C -#define IF_CS_CF8385_B1_REV 0x12 -#define IF_CS_CF8381_B3_REV 0x04 -#define IF_CS_CF8305_B1_REV 0x03 - -/* - * Used to detect other cards than CF8385 since their revisions of silicon - * doesn't match those from CF8385, eg. CF8381 B3 works with this driver. - */ -#define CF8305_MANFID 0x02db -#define CF8305_CARDID 0x8103 -#define CF8381_MANFID 0x02db -#define CF8381_CARDID 0x6064 -#define CF8385_MANFID 0x02df -#define CF8385_CARDID 0x8103 - -/* - * FIXME: just use the 'driver_info' field of 'struct pcmcia_device_id' when - * that gets fixed. Currently there's no way to access it from the probe hook. - */ -static inline u32 get_model(u16 manf_id, u16 card_id) -{ - /* NOTE: keep in sync with if_cs_ids */ - if (manf_id == CF8305_MANFID && card_id == CF8305_CARDID) - return MODEL_8305; - else if (manf_id == CF8381_MANFID && card_id == CF8381_CARDID) - return MODEL_8381; - else if (manf_id == CF8385_MANFID && card_id == CF8385_CARDID) - return MODEL_8385; - return MODEL_UNKNOWN; -} - -/********************************************************************/ -/* I/O and interrupt handling */ -/********************************************************************/ - -static inline void if_cs_enable_ints(struct if_cs_card *card) -{ - lbs_deb_enter(LBS_DEB_CS); - if_cs_write16(card, IF_CS_HOST_INT_MASK, 0); -} - -static inline void if_cs_disable_ints(struct if_cs_card *card) -{ - lbs_deb_enter(LBS_DEB_CS); - if_cs_write16(card, IF_CS_HOST_INT_MASK, IF_CS_BIT_MASK); -} - -/* - * Called from if_cs_host_to_card to send a command to the hardware - */ -static int if_cs_send_cmd(struct lbs_private *priv, u8 *buf, u16 nb) -{ - struct if_cs_card *card = (struct if_cs_card *)priv->card; - int ret = -1; - int loops = 0; - - lbs_deb_enter(LBS_DEB_CS); - if_cs_disable_ints(card); - - /* Is hardware ready? */ - while (1) { - u16 status = if_cs_read16(card, IF_CS_CARD_STATUS); - if (status & IF_CS_BIT_COMMAND) - break; - if (++loops > 100) { - netdev_err(priv->dev, "card not ready for commands\n"); - goto done; - } - mdelay(1); - } - - if_cs_write16(card, IF_CS_CMD_LEN, nb); - - if_cs_write16_rep(card, IF_CS_CMD, buf, nb / 2); - /* Are we supposed to transfer an odd amount of bytes? */ - if (nb & 1) - if_cs_write8(card, IF_CS_CMD, buf[nb-1]); - - /* "Assert the download over interrupt command in the Host - * status register" */ - if_cs_write16(card, IF_CS_HOST_STATUS, IF_CS_BIT_COMMAND); - - /* "Assert the download over interrupt command in the Card - * interrupt case register" */ - if_cs_write16(card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_COMMAND); - ret = 0; - -done: - if_cs_enable_ints(card); - lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); - return ret; -} - -/* - * Called from if_cs_host_to_card to send a data to the hardware - */ -static void if_cs_send_data(struct lbs_private *priv, u8 *buf, u16 nb) -{ - struct if_cs_card *card = (struct if_cs_card *)priv->card; - u16 status; - - lbs_deb_enter(LBS_DEB_CS); - if_cs_disable_ints(card); - - status = if_cs_read16(card, IF_CS_CARD_STATUS); - BUG_ON((status & IF_CS_BIT_TX) == 0); - - if_cs_write16(card, IF_CS_WRITE_LEN, nb); - - /* write even number of bytes, then odd byte if necessary */ - if_cs_write16_rep(card, IF_CS_WRITE, buf, nb / 2); - if (nb & 1) - if_cs_write8(card, IF_CS_WRITE, buf[nb-1]); - - if_cs_write16(card, IF_CS_HOST_STATUS, IF_CS_BIT_TX); - if_cs_write16(card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_TX); - if_cs_enable_ints(card); - - lbs_deb_leave(LBS_DEB_CS); -} - -/* - * Get the command result out of the card. - */ -static int if_cs_receive_cmdres(struct lbs_private *priv, u8 *data, u32 *len) -{ - unsigned long flags; - int ret = -1; - u16 status; - - lbs_deb_enter(LBS_DEB_CS); - - /* is hardware ready? */ - status = if_cs_read16(priv->card, IF_CS_CARD_STATUS); - if ((status & IF_CS_BIT_RESP) == 0) { - netdev_err(priv->dev, "no cmd response in card\n"); - *len = 0; - goto out; - } - - *len = if_cs_read16(priv->card, IF_CS_RESP_LEN); - if ((*len == 0) || (*len > LBS_CMD_BUFFER_SIZE)) { - netdev_err(priv->dev, - "card cmd buffer has invalid # of bytes (%d)\n", - *len); - goto out; - } - - /* read even number of bytes, then odd byte if necessary */ - if_cs_read16_rep(priv->card, IF_CS_RESP, data, *len/sizeof(u16)); - if (*len & 1) - data[*len-1] = if_cs_read8(priv->card, IF_CS_RESP); - - /* This is a workaround for a firmware that reports too much - * bytes */ - *len -= 8; - ret = 0; - - /* Clear this flag again */ - spin_lock_irqsave(&priv->driver_lock, flags); - priv->dnld_sent = DNLD_RES_RECEIVED; - spin_unlock_irqrestore(&priv->driver_lock, flags); - -out: - lbs_deb_leave_args(LBS_DEB_CS, "ret %d, len %d", ret, *len); - return ret; -} - -static struct sk_buff *if_cs_receive_data(struct lbs_private *priv) -{ - struct sk_buff *skb = NULL; - u16 len; - u8 *data; - - lbs_deb_enter(LBS_DEB_CS); - - len = if_cs_read16(priv->card, IF_CS_READ_LEN); - if (len == 0 || len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) { - netdev_err(priv->dev, - "card data buffer has invalid # of bytes (%d)\n", - len); - priv->dev->stats.rx_dropped++; - goto dat_err; - } - - skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + 2); - if (!skb) - goto out; - skb_put(skb, len); - skb_reserve(skb, 2);/* 16 byte align */ - data = skb->data; - - /* read even number of bytes, then odd byte if necessary */ - if_cs_read16_rep(priv->card, IF_CS_READ, data, len/sizeof(u16)); - if (len & 1) - data[len-1] = if_cs_read8(priv->card, IF_CS_READ); - -dat_err: - if_cs_write16(priv->card, IF_CS_HOST_STATUS, IF_CS_BIT_RX); - if_cs_write16(priv->card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_RX); - -out: - lbs_deb_leave_args(LBS_DEB_CS, "ret %p", skb); - return skb; -} - -static irqreturn_t if_cs_interrupt(int irq, void *data) -{ - struct if_cs_card *card = data; - struct lbs_private *priv = card->priv; - u16 cause; - - lbs_deb_enter(LBS_DEB_CS); - - /* Ask card interrupt cause register if there is something for us */ - cause = if_cs_read16(card, IF_CS_CARD_INT_CAUSE); - lbs_deb_cs("cause 0x%04x\n", cause); - - if (cause == 0) { - /* Not for us */ - return IRQ_NONE; - } - - if (cause == 0xffff) { - /* Read in junk, the card has probably been removed */ - card->priv->surpriseremoved = 1; - return IRQ_HANDLED; - } - - if (cause & IF_CS_BIT_RX) { - struct sk_buff *skb; - lbs_deb_cs("rx packet\n"); - skb = if_cs_receive_data(priv); - if (skb) - lbs_process_rxed_packet(priv, skb); - } - - if (cause & IF_CS_BIT_TX) { - lbs_deb_cs("tx done\n"); - lbs_host_to_card_done(priv); - } - - if (cause & IF_CS_BIT_RESP) { - unsigned long flags; - u8 i; - - lbs_deb_cs("cmd resp\n"); - spin_lock_irqsave(&priv->driver_lock, flags); - i = (priv->resp_idx == 0) ? 1 : 0; - spin_unlock_irqrestore(&priv->driver_lock, flags); - - BUG_ON(priv->resp_len[i]); - if_cs_receive_cmdres(priv, priv->resp_buf[i], - &priv->resp_len[i]); - - spin_lock_irqsave(&priv->driver_lock, flags); - lbs_notify_command_response(priv, i); - spin_unlock_irqrestore(&priv->driver_lock, flags); - } - - if (cause & IF_CS_BIT_EVENT) { - u16 status = if_cs_read16(priv->card, IF_CS_CARD_STATUS); - if_cs_write16(priv->card, IF_CS_HOST_INT_CAUSE, - IF_CS_BIT_EVENT); - lbs_queue_event(priv, (status & IF_CS_CARD_STATUS_MASK) >> 8); - } - - /* Clear interrupt cause */ - if_cs_write16(card, IF_CS_CARD_INT_CAUSE, cause & IF_CS_BIT_MASK); - - lbs_deb_leave(LBS_DEB_CS); - return IRQ_HANDLED; -} - - - - -/********************************************************************/ -/* Firmware */ -/********************************************************************/ - -/* - * Tries to program the helper firmware. - * - * Return 0 on success - */ -static int if_cs_prog_helper(struct if_cs_card *card, const struct firmware *fw) -{ - int ret = 0; - int sent = 0; - u8 scratch; - - lbs_deb_enter(LBS_DEB_CS); - - /* - * This is the only place where an unaligned register access happens on - * the CF8305 card, therefore for the sake of speed of the driver, we do - * the alignment correction here. - */ - if (card->align_regs) - scratch = if_cs_read16(card, IF_CS_SCRATCH) >> 8; - else - scratch = if_cs_read8(card, IF_CS_SCRATCH); - - /* "If the value is 0x5a, the firmware is already - * downloaded successfully" - */ - if (scratch == IF_CS_SCRATCH_HELPER_OK) - goto done; - - /* "If the value is != 00, it is invalid value of register */ - if (scratch != IF_CS_SCRATCH_BOOT_OK) { - ret = -ENODEV; - goto done; - } - - lbs_deb_cs("helper size %td\n", fw->size); - - /* "Set the 5 bytes of the helper image to 0" */ - /* Not needed, this contains an ARM branch instruction */ - - for (;;) { - /* "the number of bytes to send is 256" */ - int count = 256; - int remain = fw->size - sent; - - if (remain < count) - count = remain; - - /* - * "write the number of bytes to be sent to the I/O Command - * write length register" - */ - if_cs_write16(card, IF_CS_CMD_LEN, count); - - /* "write this to I/O Command port register as 16 bit writes */ - if (count) - if_cs_write16_rep(card, IF_CS_CMD, - &fw->data[sent], - count >> 1); - - /* - * "Assert the download over interrupt command in the Host - * status register" - */ - if_cs_write8(card, IF_CS_HOST_STATUS, IF_CS_BIT_COMMAND); - - /* - * "Assert the download over interrupt command in the Card - * interrupt case register" - */ - if_cs_write16(card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_COMMAND); - - /* - * "The host polls the Card Status register ... for 50 ms before - * declaring a failure" - */ - ret = if_cs_poll_while_fw_download(card, IF_CS_CARD_STATUS, - IF_CS_BIT_COMMAND); - if (ret < 0) { - pr_err("can't download helper at 0x%x, ret %d\n", - sent, ret); - goto done; - } - - if (count == 0) - break; - - sent += count; - } - -done: - lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); - return ret; -} - - -static int if_cs_prog_real(struct if_cs_card *card, const struct firmware *fw) -{ - int ret = 0; - int retry = 0; - int len = 0; - int sent; - - lbs_deb_enter(LBS_DEB_CS); - - lbs_deb_cs("fw size %td\n", fw->size); - - ret = if_cs_poll_while_fw_download(card, IF_CS_SQ_READ_LOW, - IF_CS_SQ_HELPER_OK); - if (ret < 0) { - pr_err("helper firmware doesn't answer\n"); - goto done; - } - - for (sent = 0; sent < fw->size; sent += len) { - len = if_cs_read16(card, IF_CS_SQ_READ_LOW); - if (len & 1) { - retry++; - pr_info("odd, need to retry this firmware block\n"); - } else { - retry = 0; - } - - if (retry > 20) { - pr_err("could not download firmware\n"); - ret = -ENODEV; - goto done; - } - if (retry) { - sent -= len; - } - - - if_cs_write16(card, IF_CS_CMD_LEN, len); - - if_cs_write16_rep(card, IF_CS_CMD, - &fw->data[sent], - (len+1) >> 1); - if_cs_write8(card, IF_CS_HOST_STATUS, IF_CS_BIT_COMMAND); - if_cs_write16(card, IF_CS_HOST_INT_CAUSE, IF_CS_BIT_COMMAND); - - ret = if_cs_poll_while_fw_download(card, IF_CS_CARD_STATUS, - IF_CS_BIT_COMMAND); - if (ret < 0) { - pr_err("can't download firmware at 0x%x\n", sent); - goto done; - } - } - - ret = if_cs_poll_while_fw_download(card, IF_CS_SCRATCH, 0x5a); - if (ret < 0) - pr_err("firmware download failed\n"); - -done: - lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); - return ret; -} - -static void if_cs_prog_firmware(struct lbs_private *priv, int ret, - const struct firmware *helper, - const struct firmware *mainfw) -{ - struct if_cs_card *card = priv->card; - - if (ret) { - pr_err("failed to find firmware (%d)\n", ret); - return; - } - - /* Load the firmware */ - ret = if_cs_prog_helper(card, helper); - if (ret == 0 && (card->model != MODEL_8305)) - ret = if_cs_prog_real(card, mainfw); - if (ret) - goto out; - - /* Now actually get the IRQ */ - ret = request_irq(card->p_dev->irq, if_cs_interrupt, - IRQF_SHARED, DRV_NAME, card); - if (ret) { - pr_err("error in request_irq\n"); - goto out; - } - - /* - * Clear any interrupt cause that happened while sending - * firmware/initializing card - */ - if_cs_write16(card, IF_CS_CARD_INT_CAUSE, IF_CS_BIT_MASK); - if_cs_enable_ints(card); - - /* And finally bring the card up */ - priv->fw_ready = 1; - if (lbs_start_card(priv) != 0) { - pr_err("could not activate card\n"); - free_irq(card->p_dev->irq, card); - } - -out: - release_firmware(helper); - release_firmware(mainfw); -} - - -/********************************************************************/ -/* Callback functions for libertas.ko */ -/********************************************************************/ - -/* Send commands or data packets to the card */ -static int if_cs_host_to_card(struct lbs_private *priv, - u8 type, - u8 *buf, - u16 nb) -{ - int ret = -1; - - lbs_deb_enter_args(LBS_DEB_CS, "type %d, bytes %d", type, nb); - - switch (type) { - case MVMS_DAT: - priv->dnld_sent = DNLD_DATA_SENT; - if_cs_send_data(priv, buf, nb); - ret = 0; - break; - case MVMS_CMD: - priv->dnld_sent = DNLD_CMD_SENT; - ret = if_cs_send_cmd(priv, buf, nb); - break; - default: - netdev_err(priv->dev, "%s: unsupported type %d\n", - __func__, type); - } - - lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); - return ret; -} - - -static void if_cs_release(struct pcmcia_device *p_dev) -{ - struct if_cs_card *card = p_dev->priv; - - lbs_deb_enter(LBS_DEB_CS); - - free_irq(p_dev->irq, card); - pcmcia_disable_device(p_dev); - if (card->iobase) - ioport_unmap(card->iobase); - - lbs_deb_leave(LBS_DEB_CS); -} - - -static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data) -{ - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - - if (p_dev->resource[1]->end) { - pr_err("wrong CIS (check number of IO windows)\n"); - return -ENODEV; - } - - /* This reserves IO space but doesn't actually enable it */ - return pcmcia_request_io(p_dev); -} - -static int if_cs_probe(struct pcmcia_device *p_dev) -{ - int ret = -ENOMEM; - unsigned int prod_id; - struct lbs_private *priv; - struct if_cs_card *card; - - lbs_deb_enter(LBS_DEB_CS); - - card = kzalloc(sizeof(struct if_cs_card), GFP_KERNEL); - if (!card) - goto out; - - card->p_dev = p_dev; - p_dev->priv = card; - - p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; - - if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { - pr_err("error in pcmcia_loop_config\n"); - goto out1; - } - - /* - * Allocate an interrupt line. Note that this does not assign - * a handler to the interrupt, unless the 'Handler' member of - * the irq structure is initialized. - */ - if (!p_dev->irq) - goto out1; - - /* Initialize io access */ - card->iobase = ioport_map(p_dev->resource[0]->start, - resource_size(p_dev->resource[0])); - if (!card->iobase) { - pr_err("error in ioport_map\n"); - ret = -EIO; - goto out1; - } - - ret = pcmcia_enable_device(p_dev); - if (ret) { - pr_err("error in pcmcia_enable_device\n"); - goto out2; - } - - /* Finally, report what we've done */ - lbs_deb_cs("irq %d, io %pR", p_dev->irq, p_dev->resource[0]); - - /* - * Most of the libertas cards can do unaligned register access, but some - * weird ones cannot. That's especially true for the CF8305 card. - */ - card->align_regs = false; - - card->model = get_model(p_dev->manf_id, p_dev->card_id); - if (card->model == MODEL_UNKNOWN) { - pr_err("unsupported manf_id 0x%04x / card_id 0x%04x\n", - p_dev->manf_id, p_dev->card_id); - goto out2; - } - - /* Check if we have a current silicon */ - prod_id = if_cs_read8(card, IF_CS_PRODUCT_ID); - if (card->model == MODEL_8305) { - card->align_regs = true; - if (prod_id < IF_CS_CF8305_B1_REV) { - pr_err("8305 rev B0 and older are not supported\n"); - ret = -ENODEV; - goto out2; - } - } - - if ((card->model == MODEL_8381) && prod_id < IF_CS_CF8381_B3_REV) { - pr_err("8381 rev B2 and older are not supported\n"); - ret = -ENODEV; - goto out2; - } - - if ((card->model == MODEL_8385) && prod_id < IF_CS_CF8385_B1_REV) { - pr_err("8385 rev B0 and older are not supported\n"); - ret = -ENODEV; - goto out2; - } - - /* Make this card known to the libertas driver */ - priv = lbs_add_card(card, &p_dev->dev); - if (!priv) { - ret = -ENOMEM; - goto out2; - } - - /* Set up fields in lbs_private */ - card->priv = priv; - priv->card = card; - priv->hw_host_to_card = if_cs_host_to_card; - priv->enter_deep_sleep = NULL; - priv->exit_deep_sleep = NULL; - priv->reset_deep_sleep_wakeup = NULL; - - /* Get firmware */ - ret = lbs_get_firmware_async(priv, &p_dev->dev, card->model, fw_table, - if_cs_prog_firmware); - if (ret) { - pr_err("failed to find firmware (%d)\n", ret); - goto out3; - } - - goto out; - -out3: - lbs_remove_card(priv); -out2: - ioport_unmap(card->iobase); -out1: - pcmcia_disable_device(p_dev); -out: - lbs_deb_leave_args(LBS_DEB_CS, "ret %d", ret); - return ret; -} - - -static void if_cs_detach(struct pcmcia_device *p_dev) -{ - struct if_cs_card *card = p_dev->priv; - - lbs_deb_enter(LBS_DEB_CS); - - lbs_stop_card(card->priv); - lbs_remove_card(card->priv); - if_cs_disable_ints(card); - if_cs_release(p_dev); - kfree(card); - - lbs_deb_leave(LBS_DEB_CS); -} - - - -/********************************************************************/ -/* Module initialization */ -/********************************************************************/ - -static const struct pcmcia_device_id if_cs_ids[] = { - PCMCIA_DEVICE_MANF_CARD(CF8305_MANFID, CF8305_CARDID), - PCMCIA_DEVICE_MANF_CARD(CF8381_MANFID, CF8381_CARDID), - PCMCIA_DEVICE_MANF_CARD(CF8385_MANFID, CF8385_CARDID), - /* NOTE: keep in sync with get_model() */ - PCMCIA_DEVICE_NULL, -}; -MODULE_DEVICE_TABLE(pcmcia, if_cs_ids); - -static struct pcmcia_driver lbs_driver = { - .owner = THIS_MODULE, - .name = DRV_NAME, - .probe = if_cs_probe, - .remove = if_cs_detach, - .id_table = if_cs_ids, -}; -module_pcmcia_driver(lbs_driver); diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c deleted file mode 100644 index 45578335e420..000000000000 --- a/drivers/net/wireless/libertas/if_sdio.c +++ /dev/null @@ -1,1457 +0,0 @@ -/* - * linux/drivers/net/wireless/libertas/if_sdio.c - * - * Copyright 2007-2008 Pierre Ossman - * - * Inspired by if_cs.c, Copyright 2007 Holger Schurig - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This hardware has more or less no CMD53 support, so all registers - * must be accessed using sdio_readb()/sdio_writeb(). - * - * Transfers must be in one transaction or the firmware goes bonkers. - * This means that the transfer must either be small enough to do a - * byte based transfer or it must be padded to a multiple of the - * current block size. - * - * As SDIO is still new to the kernel, it is unfortunately common with - * bugs in the host controllers related to that. One such bug is that - * controllers cannot do transfers that aren't a multiple of 4 bytes. - * If you don't have time to fix the host controller driver, you can - * work around the problem by modifying if_sdio_host_to_card() and - * if_sdio_card_to_host() to pad the data. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "host.h" -#include "decl.h" -#include "defs.h" -#include "dev.h" -#include "cmd.h" -#include "if_sdio.h" - -static void if_sdio_interrupt(struct sdio_func *func); - -/* The if_sdio_remove() callback function is called when - * user removes this module from kernel space or ejects - * the card from the slot. The driver handles these 2 cases - * differently for SD8688 combo chip. - * If the user is removing the module, the FUNC_SHUTDOWN - * command for SD8688 is sent to the firmware. - * If the card is removed, there is no need to send this command. - * - * The variable 'user_rmmod' is used to distinguish these two - * scenarios. This flag is initialized as FALSE in case the card - * is removed, and will be set to TRUE for module removal when - * module_exit function is called. - */ -static u8 user_rmmod; - -static const struct sdio_device_id if_sdio_ids[] = { - { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, - SDIO_DEVICE_ID_MARVELL_LIBERTAS) }, - { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, - SDIO_DEVICE_ID_MARVELL_8688WLAN) }, - { /* end: all zeroes */ }, -}; - -MODULE_DEVICE_TABLE(sdio, if_sdio_ids); - -#define MODEL_8385 0x04 -#define MODEL_8686 0x0b -#define MODEL_8688 0x10 - -static const struct lbs_fw_table fw_table[] = { - { MODEL_8385, "libertas/sd8385_helper.bin", "libertas/sd8385.bin" }, - { MODEL_8385, "sd8385_helper.bin", "sd8385.bin" }, - { MODEL_8686, "libertas/sd8686_v9_helper.bin", "libertas/sd8686_v9.bin" }, - { MODEL_8686, "libertas/sd8686_v8_helper.bin", "libertas/sd8686_v8.bin" }, - { MODEL_8686, "sd8686_helper.bin", "sd8686.bin" }, - { MODEL_8688, "libertas/sd8688_helper.bin", "libertas/sd8688.bin" }, - { MODEL_8688, "sd8688_helper.bin", "sd8688.bin" }, - { 0, NULL, NULL } -}; -MODULE_FIRMWARE("libertas/sd8385_helper.bin"); -MODULE_FIRMWARE("libertas/sd8385.bin"); -MODULE_FIRMWARE("sd8385_helper.bin"); -MODULE_FIRMWARE("sd8385.bin"); -MODULE_FIRMWARE("libertas/sd8686_v9_helper.bin"); -MODULE_FIRMWARE("libertas/sd8686_v9.bin"); -MODULE_FIRMWARE("libertas/sd8686_v8_helper.bin"); -MODULE_FIRMWARE("libertas/sd8686_v8.bin"); -MODULE_FIRMWARE("sd8686_helper.bin"); -MODULE_FIRMWARE("sd8686.bin"); -MODULE_FIRMWARE("libertas/sd8688_helper.bin"); -MODULE_FIRMWARE("libertas/sd8688.bin"); -MODULE_FIRMWARE("sd8688_helper.bin"); -MODULE_FIRMWARE("sd8688.bin"); - -struct if_sdio_packet { - struct if_sdio_packet *next; - u16 nb; - u8 buffer[0] __attribute__((aligned(4))); -}; - -struct if_sdio_card { - struct sdio_func *func; - struct lbs_private *priv; - - int model; - unsigned long ioport; - unsigned int scratch_reg; - bool started; - wait_queue_head_t pwron_waitq; - - u8 buffer[65536] __attribute__((aligned(4))); - - spinlock_t lock; - struct if_sdio_packet *packets; - - struct workqueue_struct *workqueue; - struct work_struct packet_worker; - - u8 rx_unit; -}; - -static void if_sdio_finish_power_on(struct if_sdio_card *card); -static int if_sdio_power_off(struct if_sdio_card *card); - -/********************************************************************/ -/* I/O */ -/********************************************************************/ - -/* - * For SD8385/SD8686, this function reads firmware status after - * the image is downloaded, or reads RX packet length when - * interrupt (with IF_SDIO_H_INT_UPLD bit set) is received. - * For SD8688, this function reads firmware status only. - */ -static u16 if_sdio_read_scratch(struct if_sdio_card *card, int *err) -{ - int ret; - u16 scratch; - - scratch = sdio_readb(card->func, card->scratch_reg, &ret); - if (!ret) - scratch |= sdio_readb(card->func, card->scratch_reg + 1, - &ret) << 8; - - if (err) - *err = ret; - - if (ret) - return 0xffff; - - return scratch; -} - -static u8 if_sdio_read_rx_unit(struct if_sdio_card *card) -{ - int ret; - u8 rx_unit; - - rx_unit = sdio_readb(card->func, IF_SDIO_RX_UNIT, &ret); - - if (ret) - rx_unit = 0; - - return rx_unit; -} - -static u16 if_sdio_read_rx_len(struct if_sdio_card *card, int *err) -{ - int ret; - u16 rx_len; - - switch (card->model) { - case MODEL_8385: - case MODEL_8686: - rx_len = if_sdio_read_scratch(card, &ret); - break; - case MODEL_8688: - default: /* for newer chipsets */ - rx_len = sdio_readb(card->func, IF_SDIO_RX_LEN, &ret); - if (!ret) - rx_len <<= card->rx_unit; - else - rx_len = 0xffff; /* invalid length */ - - break; - } - - if (err) - *err = ret; - - return rx_len; -} - -static int if_sdio_handle_cmd(struct if_sdio_card *card, - u8 *buffer, unsigned size) -{ - struct lbs_private *priv = card->priv; - int ret; - unsigned long flags; - u8 i; - - lbs_deb_enter(LBS_DEB_SDIO); - - if (size > LBS_CMD_BUFFER_SIZE) { - lbs_deb_sdio("response packet too large (%d bytes)\n", - (int)size); - ret = -E2BIG; - goto out; - } - - spin_lock_irqsave(&priv->driver_lock, flags); - - i = (priv->resp_idx == 0) ? 1 : 0; - BUG_ON(priv->resp_len[i]); - priv->resp_len[i] = size; - memcpy(priv->resp_buf[i], buffer, size); - lbs_notify_command_response(priv, i); - - spin_unlock_irqrestore(&card->priv->driver_lock, flags); - - ret = 0; - -out: - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - return ret; -} - -static int if_sdio_handle_data(struct if_sdio_card *card, - u8 *buffer, unsigned size) -{ - int ret; - struct sk_buff *skb; - char *data; - - lbs_deb_enter(LBS_DEB_SDIO); - - if (size > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) { - lbs_deb_sdio("response packet too large (%d bytes)\n", - (int)size); - ret = -E2BIG; - goto out; - } - - skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + NET_IP_ALIGN); - if (!skb) { - ret = -ENOMEM; - goto out; - } - - skb_reserve(skb, NET_IP_ALIGN); - - data = skb_put(skb, size); - - memcpy(data, buffer, size); - - lbs_process_rxed_packet(card->priv, skb); - - ret = 0; - -out: - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; -} - -static int if_sdio_handle_event(struct if_sdio_card *card, - u8 *buffer, unsigned size) -{ - int ret; - u32 event; - - lbs_deb_enter(LBS_DEB_SDIO); - - if (card->model == MODEL_8385) { - event = sdio_readb(card->func, IF_SDIO_EVENT, &ret); - if (ret) - goto out; - - /* right shift 3 bits to get the event id */ - event >>= 3; - } else { - if (size < 4) { - lbs_deb_sdio("event packet too small (%d bytes)\n", - (int)size); - ret = -EINVAL; - goto out; - } - event = buffer[3] << 24; - event |= buffer[2] << 16; - event |= buffer[1] << 8; - event |= buffer[0] << 0; - } - - lbs_queue_event(card->priv, event & 0xFF); - ret = 0; - -out: - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; -} - -static int if_sdio_wait_status(struct if_sdio_card *card, const u8 condition) -{ - u8 status; - unsigned long timeout; - int ret = 0; - - timeout = jiffies + HZ; - while (1) { - status = sdio_readb(card->func, IF_SDIO_STATUS, &ret); - if (ret) - return ret; - if ((status & condition) == condition) - break; - if (time_after(jiffies, timeout)) - return -ETIMEDOUT; - mdelay(1); - } - return ret; -} - -static int if_sdio_card_to_host(struct if_sdio_card *card) -{ - int ret; - u16 size, type, chunk; - - lbs_deb_enter(LBS_DEB_SDIO); - - size = if_sdio_read_rx_len(card, &ret); - if (ret) - goto out; - - if (size < 4) { - lbs_deb_sdio("invalid packet size (%d bytes) from firmware\n", - (int)size); - ret = -EINVAL; - goto out; - } - - ret = if_sdio_wait_status(card, IF_SDIO_IO_RDY); - if (ret) - goto out; - - /* - * The transfer must be in one transaction or the firmware - * goes suicidal. There's no way to guarantee that for all - * controllers, but we can at least try. - */ - chunk = sdio_align_size(card->func, size); - - ret = sdio_readsb(card->func, card->buffer, card->ioport, chunk); - if (ret) - goto out; - - chunk = card->buffer[0] | (card->buffer[1] << 8); - type = card->buffer[2] | (card->buffer[3] << 8); - - lbs_deb_sdio("packet of type %d and size %d bytes\n", - (int)type, (int)chunk); - - if (chunk > size) { - lbs_deb_sdio("packet fragment (%d > %d)\n", - (int)chunk, (int)size); - ret = -EINVAL; - goto out; - } - - if (chunk < size) { - lbs_deb_sdio("packet fragment (%d < %d)\n", - (int)chunk, (int)size); - } - - switch (type) { - case MVMS_CMD: - ret = if_sdio_handle_cmd(card, card->buffer + 4, chunk - 4); - if (ret) - goto out; - break; - case MVMS_DAT: - ret = if_sdio_handle_data(card, card->buffer + 4, chunk - 4); - if (ret) - goto out; - break; - case MVMS_EVENT: - ret = if_sdio_handle_event(card, card->buffer + 4, chunk - 4); - if (ret) - goto out; - break; - default: - lbs_deb_sdio("invalid type (%d) from firmware\n", - (int)type); - ret = -EINVAL; - goto out; - } - -out: - if (ret) - pr_err("problem fetching packet from firmware\n"); - - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; -} - -static void if_sdio_host_to_card_worker(struct work_struct *work) -{ - struct if_sdio_card *card; - struct if_sdio_packet *packet; - int ret; - unsigned long flags; - - lbs_deb_enter(LBS_DEB_SDIO); - - card = container_of(work, struct if_sdio_card, packet_worker); - - while (1) { - spin_lock_irqsave(&card->lock, flags); - packet = card->packets; - if (packet) - card->packets = packet->next; - spin_unlock_irqrestore(&card->lock, flags); - - if (!packet) - break; - - sdio_claim_host(card->func); - - ret = if_sdio_wait_status(card, IF_SDIO_IO_RDY); - if (ret == 0) { - ret = sdio_writesb(card->func, card->ioport, - packet->buffer, packet->nb); - } - - if (ret) - pr_err("error %d sending packet to firmware\n", ret); - - sdio_release_host(card->func); - - kfree(packet); - } - - lbs_deb_leave(LBS_DEB_SDIO); -} - -/********************************************************************/ -/* Firmware */ -/********************************************************************/ - -#define FW_DL_READY_STATUS (IF_SDIO_IO_RDY | IF_SDIO_DL_RDY) - -static int if_sdio_prog_helper(struct if_sdio_card *card, - const struct firmware *fw) -{ - int ret; - unsigned long timeout; - u8 *chunk_buffer; - u32 chunk_size; - const u8 *firmware; - size_t size; - - lbs_deb_enter(LBS_DEB_SDIO); - - chunk_buffer = kzalloc(64, GFP_KERNEL); - if (!chunk_buffer) { - ret = -ENOMEM; - goto out; - } - - sdio_claim_host(card->func); - - ret = sdio_set_block_size(card->func, 32); - if (ret) - goto release; - - firmware = fw->data; - size = fw->size; - - while (size) { - ret = if_sdio_wait_status(card, FW_DL_READY_STATUS); - if (ret) - goto release; - - /* On some platforms (like Davinci) the chip needs more time - * between helper blocks. - */ - mdelay(2); - - chunk_size = min(size, (size_t)60); - - *((__le32*)chunk_buffer) = cpu_to_le32(chunk_size); - memcpy(chunk_buffer + 4, firmware, chunk_size); -/* - lbs_deb_sdio("sending %d bytes chunk\n", chunk_size); -*/ - ret = sdio_writesb(card->func, card->ioport, - chunk_buffer, 64); - if (ret) - goto release; - - firmware += chunk_size; - size -= chunk_size; - } - - /* an empty block marks the end of the transfer */ - memset(chunk_buffer, 0, 4); - ret = sdio_writesb(card->func, card->ioport, chunk_buffer, 64); - if (ret) - goto release; - - lbs_deb_sdio("waiting for helper to boot...\n"); - - /* wait for the helper to boot by looking at the size register */ - timeout = jiffies + HZ; - while (1) { - u16 req_size; - - req_size = sdio_readb(card->func, IF_SDIO_RD_BASE, &ret); - if (ret) - goto release; - - req_size |= sdio_readb(card->func, IF_SDIO_RD_BASE + 1, &ret) << 8; - if (ret) - goto release; - - if (req_size != 0) - break; - - if (time_after(jiffies, timeout)) { - ret = -ETIMEDOUT; - goto release; - } - - msleep(10); - } - - ret = 0; - -release: - sdio_release_host(card->func); - kfree(chunk_buffer); - -out: - if (ret) - pr_err("failed to load helper firmware\n"); - - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - return ret; -} - -static int if_sdio_prog_real(struct if_sdio_card *card, - const struct firmware *fw) -{ - int ret; - unsigned long timeout; - u8 *chunk_buffer; - u32 chunk_size; - const u8 *firmware; - size_t size, req_size; - - lbs_deb_enter(LBS_DEB_SDIO); - - chunk_buffer = kzalloc(512, GFP_KERNEL); - if (!chunk_buffer) { - ret = -ENOMEM; - goto out; - } - - sdio_claim_host(card->func); - - ret = sdio_set_block_size(card->func, 32); - if (ret) - goto release; - - firmware = fw->data; - size = fw->size; - - while (size) { - timeout = jiffies + HZ; - while (1) { - ret = if_sdio_wait_status(card, FW_DL_READY_STATUS); - if (ret) - goto release; - - req_size = sdio_readb(card->func, IF_SDIO_RD_BASE, - &ret); - if (ret) - goto release; - - req_size |= sdio_readb(card->func, IF_SDIO_RD_BASE + 1, - &ret) << 8; - if (ret) - goto release; - - /* - * For SD8688 wait until the length is not 0, 1 or 2 - * before downloading the first FW block, - * since BOOT code writes the register to indicate the - * helper/FW download winner, - * the value could be 1 or 2 (Func1 or Func2). - */ - if ((size != fw->size) || (req_size > 2)) - break; - if (time_after(jiffies, timeout)) { - ret = -ETIMEDOUT; - goto release; - } - mdelay(1); - } - -/* - lbs_deb_sdio("firmware wants %d bytes\n", (int)req_size); -*/ - if (req_size == 0) { - lbs_deb_sdio("firmware helper gave up early\n"); - ret = -EIO; - goto release; - } - - if (req_size & 0x01) { - lbs_deb_sdio("firmware helper signalled error\n"); - ret = -EIO; - goto release; - } - - if (req_size > size) - req_size = size; - - while (req_size) { - chunk_size = min(req_size, (size_t)512); - - memcpy(chunk_buffer, firmware, chunk_size); -/* - lbs_deb_sdio("sending %d bytes (%d bytes) chunk\n", - chunk_size, (chunk_size + 31) / 32 * 32); -*/ - ret = sdio_writesb(card->func, card->ioport, - chunk_buffer, roundup(chunk_size, 32)); - if (ret) - goto release; - - firmware += chunk_size; - size -= chunk_size; - req_size -= chunk_size; - } - } - - ret = 0; - - lbs_deb_sdio("waiting for firmware to boot...\n"); - - /* wait for the firmware to boot */ - timeout = jiffies + HZ; - while (1) { - u16 scratch; - - scratch = if_sdio_read_scratch(card, &ret); - if (ret) - goto release; - - if (scratch == IF_SDIO_FIRMWARE_OK) - break; - - if (time_after(jiffies, timeout)) { - ret = -ETIMEDOUT; - goto release; - } - - msleep(10); - } - - ret = 0; - -release: - sdio_release_host(card->func); - kfree(chunk_buffer); - -out: - if (ret) - pr_err("failed to load firmware\n"); - - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - return ret; -} - -static void if_sdio_do_prog_firmware(struct lbs_private *priv, int ret, - const struct firmware *helper, - const struct firmware *mainfw) -{ - struct if_sdio_card *card = priv->card; - - if (ret) { - pr_err("failed to find firmware (%d)\n", ret); - return; - } - - ret = if_sdio_prog_helper(card, helper); - if (ret) - goto out; - - lbs_deb_sdio("Helper firmware loaded\n"); - - ret = if_sdio_prog_real(card, mainfw); - if (ret) - goto out; - - lbs_deb_sdio("Firmware loaded\n"); - if_sdio_finish_power_on(card); - -out: - release_firmware(helper); - release_firmware(mainfw); -} - -static int if_sdio_prog_firmware(struct if_sdio_card *card) -{ - int ret; - u16 scratch; - - lbs_deb_enter(LBS_DEB_SDIO); - - /* - * Disable interrupts - */ - sdio_claim_host(card->func); - sdio_writeb(card->func, 0x00, IF_SDIO_H_INT_MASK, &ret); - sdio_release_host(card->func); - - sdio_claim_host(card->func); - scratch = if_sdio_read_scratch(card, &ret); - sdio_release_host(card->func); - - lbs_deb_sdio("firmware status = %#x\n", scratch); - lbs_deb_sdio("scratch ret = %d\n", ret); - - if (ret) - goto out; - - - /* - * The manual clearly describes that FEDC is the right code to use - * to detect firmware presence, but for SD8686 it is not that simple. - * Scratch is also used to store the RX packet length, so we lose - * the FEDC value early on. So we use a non-zero check in order - * to validate firmware presence. - * Additionally, the SD8686 in the Gumstix always has the high scratch - * bit set, even when the firmware is not loaded. So we have to - * exclude that from the test. - */ - if (scratch == IF_SDIO_FIRMWARE_OK) { - lbs_deb_sdio("firmware already loaded\n"); - if_sdio_finish_power_on(card); - return 0; - } else if ((card->model == MODEL_8686) && (scratch & 0x7fff)) { - lbs_deb_sdio("firmware may be running\n"); - if_sdio_finish_power_on(card); - return 0; - } - - ret = lbs_get_firmware_async(card->priv, &card->func->dev, card->model, - fw_table, if_sdio_do_prog_firmware); - -out: - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - return ret; -} - -/********************************************************************/ -/* Power management */ -/********************************************************************/ - -/* Finish power on sequence (after firmware is loaded) */ -static void if_sdio_finish_power_on(struct if_sdio_card *card) -{ - struct sdio_func *func = card->func; - struct lbs_private *priv = card->priv; - int ret; - - sdio_claim_host(func); - sdio_set_block_size(card->func, IF_SDIO_BLOCK_SIZE); - - /* - * Get rx_unit if the chip is SD8688 or newer. - * SD8385 & SD8686 do not have rx_unit. - */ - if ((card->model != MODEL_8385) - && (card->model != MODEL_8686)) - card->rx_unit = if_sdio_read_rx_unit(card); - else - card->rx_unit = 0; - - /* - * Set up the interrupt handler late. - * - * If we set it up earlier, the (buggy) hardware generates a spurious - * interrupt, even before the interrupt has been enabled, with - * CCCR_INTx = 0. - * - * We register the interrupt handler late so that we can handle any - * spurious interrupts, and also to avoid generation of that known - * spurious interrupt in the first place. - */ - ret = sdio_claim_irq(func, if_sdio_interrupt); - if (ret) - goto release; - - /* - * Enable interrupts now that everything is set up - */ - sdio_writeb(func, 0x0f, IF_SDIO_H_INT_MASK, &ret); - if (ret) - goto release_irq; - - sdio_release_host(func); - - /* Set fw_ready before queuing any commands so that - * lbs_thread won't block from sending them to firmware. - */ - priv->fw_ready = 1; - - /* - * FUNC_INIT is required for SD8688 WLAN/BT multiple functions - */ - if (card->model == MODEL_8688) { - struct cmd_header cmd; - - memset(&cmd, 0, sizeof(cmd)); - - lbs_deb_sdio("send function INIT command\n"); - if (__lbs_cmd(priv, CMD_FUNC_INIT, &cmd, sizeof(cmd), - lbs_cmd_copyback, (unsigned long) &cmd)) - netdev_alert(priv->dev, "CMD_FUNC_INIT cmd failed\n"); - } - - wake_up(&card->pwron_waitq); - - if (!card->started) { - ret = lbs_start_card(priv); - if_sdio_power_off(card); - if (ret == 0) { - card->started = true; - /* Tell PM core that we don't need the card to be - * powered now */ - pm_runtime_put_noidle(&func->dev); - } - } - - return; - -release_irq: - sdio_release_irq(func); -release: - sdio_release_host(func); -} - -static int if_sdio_power_on(struct if_sdio_card *card) -{ - struct sdio_func *func = card->func; - struct mmc_host *host = func->card->host; - int ret; - - sdio_claim_host(func); - - ret = sdio_enable_func(func); - if (ret) - goto release; - - /* For 1-bit transfers to the 8686 model, we need to enable the - * interrupt flag in the CCCR register. Set the MMC_QUIRK_LENIENT_FN0 - * bit to allow access to non-vendor registers. */ - if ((card->model == MODEL_8686) && - (host->caps & MMC_CAP_SDIO_IRQ) && - (host->ios.bus_width == MMC_BUS_WIDTH_1)) { - u8 reg; - - func->card->quirks |= MMC_QUIRK_LENIENT_FN0; - reg = sdio_f0_readb(func, SDIO_CCCR_IF, &ret); - if (ret) - goto disable; - - reg |= SDIO_BUS_ECSI; - sdio_f0_writeb(func, reg, SDIO_CCCR_IF, &ret); - if (ret) - goto disable; - } - - card->ioport = sdio_readb(func, IF_SDIO_IOPORT, &ret); - if (ret) - goto disable; - - card->ioport |= sdio_readb(func, IF_SDIO_IOPORT + 1, &ret) << 8; - if (ret) - goto disable; - - card->ioport |= sdio_readb(func, IF_SDIO_IOPORT + 2, &ret) << 16; - if (ret) - goto disable; - - sdio_release_host(func); - ret = if_sdio_prog_firmware(card); - if (ret) { - sdio_disable_func(func); - return ret; - } - - return 0; - -disable: - sdio_disable_func(func); -release: - sdio_release_host(func); - return ret; -} - -static int if_sdio_power_off(struct if_sdio_card *card) -{ - struct sdio_func *func = card->func; - struct lbs_private *priv = card->priv; - - priv->fw_ready = 0; - - sdio_claim_host(func); - sdio_release_irq(func); - sdio_disable_func(func); - sdio_release_host(func); - return 0; -} - - -/*******************************************************************/ -/* Libertas callbacks */ -/*******************************************************************/ - -static int if_sdio_host_to_card(struct lbs_private *priv, - u8 type, u8 *buf, u16 nb) -{ - int ret; - struct if_sdio_card *card; - struct if_sdio_packet *packet, *cur; - u16 size; - unsigned long flags; - - lbs_deb_enter_args(LBS_DEB_SDIO, "type %d, bytes %d", type, nb); - - card = priv->card; - - if (nb > (65536 - sizeof(struct if_sdio_packet) - 4)) { - ret = -EINVAL; - goto out; - } - - /* - * The transfer must be in one transaction or the firmware - * goes suicidal. There's no way to guarantee that for all - * controllers, but we can at least try. - */ - size = sdio_align_size(card->func, nb + 4); - - packet = kzalloc(sizeof(struct if_sdio_packet) + size, - GFP_ATOMIC); - if (!packet) { - ret = -ENOMEM; - goto out; - } - - packet->next = NULL; - packet->nb = size; - - /* - * SDIO specific header. - */ - packet->buffer[0] = (nb + 4) & 0xff; - packet->buffer[1] = ((nb + 4) >> 8) & 0xff; - packet->buffer[2] = type; - packet->buffer[3] = 0; - - memcpy(packet->buffer + 4, buf, nb); - - spin_lock_irqsave(&card->lock, flags); - - if (!card->packets) - card->packets = packet; - else { - cur = card->packets; - while (cur->next) - cur = cur->next; - cur->next = packet; - } - - switch (type) { - case MVMS_CMD: - priv->dnld_sent = DNLD_CMD_SENT; - break; - case MVMS_DAT: - priv->dnld_sent = DNLD_DATA_SENT; - break; - default: - lbs_deb_sdio("unknown packet type %d\n", (int)type); - } - - spin_unlock_irqrestore(&card->lock, flags); - - queue_work(card->workqueue, &card->packet_worker); - - ret = 0; - -out: - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; -} - -static int if_sdio_enter_deep_sleep(struct lbs_private *priv) -{ - int ret = -1; - struct cmd_header cmd; - - memset(&cmd, 0, sizeof(cmd)); - - lbs_deb_sdio("send DEEP_SLEEP command\n"); - ret = __lbs_cmd(priv, CMD_802_11_DEEP_SLEEP, &cmd, sizeof(cmd), - lbs_cmd_copyback, (unsigned long) &cmd); - if (ret) - netdev_err(priv->dev, "DEEP_SLEEP cmd failed\n"); - - mdelay(200); - return ret; -} - -static int if_sdio_exit_deep_sleep(struct lbs_private *priv) -{ - struct if_sdio_card *card = priv->card; - int ret = -1; - - lbs_deb_enter(LBS_DEB_SDIO); - sdio_claim_host(card->func); - - sdio_writeb(card->func, HOST_POWER_UP, CONFIGURATION_REG, &ret); - if (ret) - netdev_err(priv->dev, "sdio_writeb failed!\n"); - - sdio_release_host(card->func); - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - return ret; -} - -static int if_sdio_reset_deep_sleep_wakeup(struct lbs_private *priv) -{ - struct if_sdio_card *card = priv->card; - int ret = -1; - - lbs_deb_enter(LBS_DEB_SDIO); - sdio_claim_host(card->func); - - sdio_writeb(card->func, 0, CONFIGURATION_REG, &ret); - if (ret) - netdev_err(priv->dev, "sdio_writeb failed!\n"); - - sdio_release_host(card->func); - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - return ret; - -} - -static struct mmc_host *reset_host; - -static void if_sdio_reset_card_worker(struct work_struct *work) -{ - /* - * The actual reset operation must be run outside of lbs_thread. This - * is because mmc_remove_host() will cause the device to be instantly - * destroyed, and the libertas driver then needs to end lbs_thread, - * leading to a deadlock. - * - * We run it in a workqueue totally independent from the if_sdio_card - * instance for that reason. - */ - - pr_info("Resetting card..."); - mmc_remove_host(reset_host); - mmc_add_host(reset_host); -} -static DECLARE_WORK(card_reset_work, if_sdio_reset_card_worker); - -static void if_sdio_reset_card(struct lbs_private *priv) -{ - struct if_sdio_card *card = priv->card; - - if (work_pending(&card_reset_work)) - return; - - reset_host = card->func->card->host; - schedule_work(&card_reset_work); -} - -static int if_sdio_power_save(struct lbs_private *priv) -{ - struct if_sdio_card *card = priv->card; - int ret; - - flush_workqueue(card->workqueue); - - ret = if_sdio_power_off(card); - - /* Let runtime PM know the card is powered off */ - pm_runtime_put_sync(&card->func->dev); - - return ret; -} - -static int if_sdio_power_restore(struct lbs_private *priv) -{ - struct if_sdio_card *card = priv->card; - int r; - - /* Make sure the card will not be powered off by runtime PM */ - pm_runtime_get_sync(&card->func->dev); - - r = if_sdio_power_on(card); - if (r) - return r; - - wait_event(card->pwron_waitq, priv->fw_ready); - return 0; -} - - -/*******************************************************************/ -/* SDIO callbacks */ -/*******************************************************************/ - -static void if_sdio_interrupt(struct sdio_func *func) -{ - int ret; - struct if_sdio_card *card; - u8 cause; - - lbs_deb_enter(LBS_DEB_SDIO); - - card = sdio_get_drvdata(func); - - cause = sdio_readb(card->func, IF_SDIO_H_INT_STATUS, &ret); - if (ret || !cause) - goto out; - - lbs_deb_sdio("interrupt: 0x%X\n", (unsigned)cause); - - sdio_writeb(card->func, ~cause, IF_SDIO_H_INT_STATUS, &ret); - if (ret) - goto out; - - /* - * Ignore the define name, this really means the card has - * successfully received the command. - */ - card->priv->is_activity_detected = 1; - if (cause & IF_SDIO_H_INT_DNLD) - lbs_host_to_card_done(card->priv); - - - if (cause & IF_SDIO_H_INT_UPLD) { - ret = if_sdio_card_to_host(card); - if (ret) - goto out; - } - - ret = 0; - -out: - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); -} - -static int if_sdio_probe(struct sdio_func *func, - const struct sdio_device_id *id) -{ - struct if_sdio_card *card; - struct lbs_private *priv; - int ret, i; - unsigned int model; - struct if_sdio_packet *packet; - - lbs_deb_enter(LBS_DEB_SDIO); - - for (i = 0;i < func->card->num_info;i++) { - if (sscanf(func->card->info[i], - "802.11 SDIO ID: %x", &model) == 1) - break; - if (sscanf(func->card->info[i], - "ID: %x", &model) == 1) - break; - if (!strcmp(func->card->info[i], "IBIS Wireless SDIO Card")) { - model = MODEL_8385; - break; - } - } - - if (i == func->card->num_info) { - pr_err("unable to identify card model\n"); - return -ENODEV; - } - - card = kzalloc(sizeof(struct if_sdio_card), GFP_KERNEL); - if (!card) - return -ENOMEM; - - card->func = func; - card->model = model; - - switch (card->model) { - case MODEL_8385: - card->scratch_reg = IF_SDIO_SCRATCH_OLD; - break; - case MODEL_8686: - card->scratch_reg = IF_SDIO_SCRATCH; - break; - case MODEL_8688: - default: /* for newer chipsets */ - card->scratch_reg = IF_SDIO_FW_STATUS; - break; - } - - spin_lock_init(&card->lock); - card->workqueue = create_workqueue("libertas_sdio"); - INIT_WORK(&card->packet_worker, if_sdio_host_to_card_worker); - init_waitqueue_head(&card->pwron_waitq); - - /* Check if we support this card */ - for (i = 0; i < ARRAY_SIZE(fw_table); i++) { - if (card->model == fw_table[i].model) - break; - } - if (i == ARRAY_SIZE(fw_table)) { - pr_err("unknown card model 0x%x\n", card->model); - ret = -ENODEV; - goto free; - } - - sdio_set_drvdata(func, card); - - lbs_deb_sdio("class = 0x%X, vendor = 0x%X, " - "device = 0x%X, model = 0x%X, ioport = 0x%X\n", - func->class, func->vendor, func->device, - model, (unsigned)card->ioport); - - - priv = lbs_add_card(card, &func->dev); - if (!priv) { - ret = -ENOMEM; - goto free; - } - - card->priv = priv; - - priv->card = card; - priv->hw_host_to_card = if_sdio_host_to_card; - priv->enter_deep_sleep = if_sdio_enter_deep_sleep; - priv->exit_deep_sleep = if_sdio_exit_deep_sleep; - priv->reset_deep_sleep_wakeup = if_sdio_reset_deep_sleep_wakeup; - priv->reset_card = if_sdio_reset_card; - priv->power_save = if_sdio_power_save; - priv->power_restore = if_sdio_power_restore; - - ret = if_sdio_power_on(card); - if (ret) - goto err_activate_card; - -out: - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; - -err_activate_card: - flush_workqueue(card->workqueue); - lbs_remove_card(priv); -free: - destroy_workqueue(card->workqueue); - while (card->packets) { - packet = card->packets; - card->packets = card->packets->next; - kfree(packet); - } - - kfree(card); - - goto out; -} - -static void if_sdio_remove(struct sdio_func *func) -{ - struct if_sdio_card *card; - struct if_sdio_packet *packet; - - lbs_deb_enter(LBS_DEB_SDIO); - - card = sdio_get_drvdata(func); - - /* Undo decrement done above in if_sdio_probe */ - pm_runtime_get_noresume(&func->dev); - - if (user_rmmod && (card->model == MODEL_8688)) { - /* - * FUNC_SHUTDOWN is required for SD8688 WLAN/BT - * multiple functions - */ - struct cmd_header cmd; - - memset(&cmd, 0, sizeof(cmd)); - - lbs_deb_sdio("send function SHUTDOWN command\n"); - if (__lbs_cmd(card->priv, CMD_FUNC_SHUTDOWN, - &cmd, sizeof(cmd), lbs_cmd_copyback, - (unsigned long) &cmd)) - pr_alert("CMD_FUNC_SHUTDOWN cmd failed\n"); - } - - - lbs_deb_sdio("call remove card\n"); - lbs_stop_card(card->priv); - lbs_remove_card(card->priv); - - flush_workqueue(card->workqueue); - destroy_workqueue(card->workqueue); - - while (card->packets) { - packet = card->packets; - card->packets = card->packets->next; - kfree(packet); - } - - kfree(card); - lbs_deb_leave(LBS_DEB_SDIO); -} - -static int if_sdio_suspend(struct device *dev) -{ - struct sdio_func *func = dev_to_sdio_func(dev); - int ret; - struct if_sdio_card *card = sdio_get_drvdata(func); - - mmc_pm_flag_t flags = sdio_get_host_pm_caps(func); - - /* If we're powered off anyway, just let the mmc layer remove the - * card. */ - if (!lbs_iface_active(card->priv)) - return -ENOSYS; - - dev_info(dev, "%s: suspend: PM flags = 0x%x\n", - sdio_func_id(func), flags); - - /* If we aren't being asked to wake on anything, we should bail out - * and let the SD stack power down the card. - */ - if (card->priv->wol_criteria == EHS_REMOVE_WAKEUP) { - dev_info(dev, "Suspend without wake params -- powering down card\n"); - return -ENOSYS; - } - - if (!(flags & MMC_PM_KEEP_POWER)) { - dev_err(dev, "%s: cannot remain alive while host is suspended\n", - sdio_func_id(func)); - return -ENOSYS; - } - - ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); - if (ret) - return ret; - - ret = lbs_suspend(card->priv); - if (ret) - return ret; - - return sdio_set_host_pm_flags(func, MMC_PM_WAKE_SDIO_IRQ); -} - -static int if_sdio_resume(struct device *dev) -{ - struct sdio_func *func = dev_to_sdio_func(dev); - struct if_sdio_card *card = sdio_get_drvdata(func); - int ret; - - dev_info(dev, "%s: resume: we're back\n", sdio_func_id(func)); - - ret = lbs_resume(card->priv); - - return ret; -} - -static const struct dev_pm_ops if_sdio_pm_ops = { - .suspend = if_sdio_suspend, - .resume = if_sdio_resume, -}; - -static struct sdio_driver if_sdio_driver = { - .name = "libertas_sdio", - .id_table = if_sdio_ids, - .probe = if_sdio_probe, - .remove = if_sdio_remove, - .drv = { - .pm = &if_sdio_pm_ops, - }, -}; - -/*******************************************************************/ -/* Module functions */ -/*******************************************************************/ - -static int __init if_sdio_init_module(void) -{ - int ret = 0; - - lbs_deb_enter(LBS_DEB_SDIO); - - printk(KERN_INFO "libertas_sdio: Libertas SDIO driver\n"); - printk(KERN_INFO "libertas_sdio: Copyright Pierre Ossman\n"); - - ret = sdio_register_driver(&if_sdio_driver); - - /* Clear the flag in case user removes the card. */ - user_rmmod = 0; - - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; -} - -static void __exit if_sdio_exit_module(void) -{ - lbs_deb_enter(LBS_DEB_SDIO); - - /* Set the flag as user is removing this module. */ - user_rmmod = 1; - - cancel_work_sync(&card_reset_work); - - sdio_unregister_driver(&if_sdio_driver); - - lbs_deb_leave(LBS_DEB_SDIO); -} - -module_init(if_sdio_init_module); -module_exit(if_sdio_exit_module); - -MODULE_DESCRIPTION("Libertas SDIO WLAN Driver"); -MODULE_AUTHOR("Pierre Ossman"); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/libertas/if_sdio.h b/drivers/net/wireless/libertas/if_sdio.h deleted file mode 100644 index 62fda3592f67..000000000000 --- a/drivers/net/wireless/libertas/if_sdio.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * linux/drivers/net/wireless/libertas/if_sdio.h - * - * Copyright 2007 Pierre Ossman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - */ - -#ifndef _LBS_IF_SDIO_H -#define _LBS_IF_SDIO_H - -#define IF_SDIO_IOPORT 0x00 - -#define IF_SDIO_H_INT_MASK 0x04 -#define IF_SDIO_H_INT_OFLOW 0x08 -#define IF_SDIO_H_INT_UFLOW 0x04 -#define IF_SDIO_H_INT_DNLD 0x02 -#define IF_SDIO_H_INT_UPLD 0x01 - -#define IF_SDIO_H_INT_STATUS 0x05 -#define IF_SDIO_H_INT_RSR 0x06 -#define IF_SDIO_H_INT_STATUS2 0x07 - -#define IF_SDIO_RD_BASE 0x10 - -#define IF_SDIO_STATUS 0x20 -#define IF_SDIO_IO_RDY 0x08 -#define IF_SDIO_CIS_RDY 0x04 -#define IF_SDIO_UL_RDY 0x02 -#define IF_SDIO_DL_RDY 0x01 - -#define IF_SDIO_C_INT_MASK 0x24 -#define IF_SDIO_C_INT_STATUS 0x28 -#define IF_SDIO_C_INT_RSR 0x2C - -#define IF_SDIO_SCRATCH 0x34 -#define IF_SDIO_SCRATCH_OLD 0x80fe -#define IF_SDIO_FW_STATUS 0x40 -#define IF_SDIO_FIRMWARE_OK 0xfedc - -#define IF_SDIO_RX_LEN 0x42 -#define IF_SDIO_RX_UNIT 0x43 - -#define IF_SDIO_EVENT 0x80fc - -#define IF_SDIO_BLOCK_SIZE 256 -#define CONFIGURATION_REG 0x03 -#define HOST_POWER_UP (0x1U << 1) -#endif diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c deleted file mode 100644 index 4bb6574f4073..000000000000 --- a/drivers/net/wireless/libertas/if_spi.c +++ /dev/null @@ -1,1324 +0,0 @@ -/* - * linux/drivers/net/wireless/libertas/if_spi.c - * - * Driver for Marvell SPI WLAN cards. - * - * Copyright 2008 Analog Devices Inc. - * - * Authors: - * Andrey Yurovsky - * Colin McCabe - * - * Inspired by if_sdio.c, Copyright 2007-2008 Pierre Ossman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "host.h" -#include "decl.h" -#include "defs.h" -#include "dev.h" -#include "if_spi.h" - -struct if_spi_packet { - struct list_head list; - u16 blen; - u8 buffer[0] __attribute__((aligned(4))); -}; - -struct if_spi_card { - struct spi_device *spi; - struct lbs_private *priv; - struct libertas_spi_platform_data *pdata; - - /* The card ID and card revision, as reported by the hardware. */ - u16 card_id; - u8 card_rev; - - /* The last time that we initiated an SPU operation */ - unsigned long prev_xfer_time; - - int use_dummy_writes; - unsigned long spu_port_delay; - unsigned long spu_reg_delay; - - /* Handles all SPI communication (except for FW load) */ - struct workqueue_struct *workqueue; - struct work_struct packet_work; - struct work_struct resume_work; - - u8 cmd_buffer[IF_SPI_CMD_BUF_SIZE]; - - /* A buffer of incoming packets from libertas core. - * Since we can't sleep in hw_host_to_card, we have to buffer - * them. */ - struct list_head cmd_packet_list; - struct list_head data_packet_list; - - /* Protects cmd_packet_list and data_packet_list */ - spinlock_t buffer_lock; - - /* True is card suspended */ - u8 suspended; -}; - -static void free_if_spi_card(struct if_spi_card *card) -{ - struct list_head *cursor, *next; - struct if_spi_packet *packet; - - list_for_each_safe(cursor, next, &card->cmd_packet_list) { - packet = container_of(cursor, struct if_spi_packet, list); - list_del(&packet->list); - kfree(packet); - } - list_for_each_safe(cursor, next, &card->data_packet_list) { - packet = container_of(cursor, struct if_spi_packet, list); - list_del(&packet->list); - kfree(packet); - } - spi_set_drvdata(card->spi, NULL); - kfree(card); -} - -#define MODEL_8385 0x04 -#define MODEL_8686 0x0b -#define MODEL_8688 0x10 - -static const struct lbs_fw_table fw_table[] = { - { MODEL_8385, "libertas/gspi8385_helper.bin", "libertas/gspi8385.bin" }, - { MODEL_8385, "libertas/gspi8385_hlp.bin", "libertas/gspi8385.bin" }, - { MODEL_8686, "libertas/gspi8686_v9_helper.bin", "libertas/gspi8686_v9.bin" }, - { MODEL_8686, "libertas/gspi8686_hlp.bin", "libertas/gspi8686.bin" }, - { MODEL_8688, "libertas/gspi8688_helper.bin", "libertas/gspi8688.bin" }, - { 0, NULL, NULL } -}; -MODULE_FIRMWARE("libertas/gspi8385_helper.bin"); -MODULE_FIRMWARE("libertas/gspi8385_hlp.bin"); -MODULE_FIRMWARE("libertas/gspi8385.bin"); -MODULE_FIRMWARE("libertas/gspi8686_v9_helper.bin"); -MODULE_FIRMWARE("libertas/gspi8686_v9.bin"); -MODULE_FIRMWARE("libertas/gspi8686_hlp.bin"); -MODULE_FIRMWARE("libertas/gspi8686.bin"); -MODULE_FIRMWARE("libertas/gspi8688_helper.bin"); -MODULE_FIRMWARE("libertas/gspi8688.bin"); - - -/* - * SPI Interface Unit Routines - * - * The SPU sits between the host and the WLAN module. - * All communication with the firmware is through SPU transactions. - * - * First we have to put a SPU register name on the bus. Then we can - * either read from or write to that register. - * - */ - -static void spu_transaction_init(struct if_spi_card *card) -{ - if (!time_after(jiffies, card->prev_xfer_time + 1)) { - /* Unfortunately, the SPU requires a delay between successive - * transactions. If our last transaction was more than a jiffy - * ago, we have obviously already delayed enough. - * If not, we have to busy-wait to be on the safe side. */ - ndelay(400); - } -} - -static void spu_transaction_finish(struct if_spi_card *card) -{ - card->prev_xfer_time = jiffies; -} - -/* - * Write out a byte buffer to an SPI register, - * using a series of 16-bit transfers. - */ -static int spu_write(struct if_spi_card *card, u16 reg, const u8 *buf, int len) -{ - int err = 0; - __le16 reg_out = cpu_to_le16(reg | IF_SPI_WRITE_OPERATION_MASK); - struct spi_message m; - struct spi_transfer reg_trans; - struct spi_transfer data_trans; - - spi_message_init(&m); - memset(®_trans, 0, sizeof(reg_trans)); - memset(&data_trans, 0, sizeof(data_trans)); - - /* You must give an even number of bytes to the SPU, even if it - * doesn't care about the last one. */ - BUG_ON(len & 0x1); - - spu_transaction_init(card); - - /* write SPU register index */ - reg_trans.tx_buf = ®_out; - reg_trans.len = sizeof(reg_out); - - data_trans.tx_buf = buf; - data_trans.len = len; - - spi_message_add_tail(®_trans, &m); - spi_message_add_tail(&data_trans, &m); - - err = spi_sync(card->spi, &m); - spu_transaction_finish(card); - return err; -} - -static inline int spu_write_u16(struct if_spi_card *card, u16 reg, u16 val) -{ - __le16 buff; - - buff = cpu_to_le16(val); - return spu_write(card, reg, (u8 *)&buff, sizeof(u16)); -} - -static inline int spu_reg_is_port_reg(u16 reg) -{ - switch (reg) { - case IF_SPI_IO_RDWRPORT_REG: - case IF_SPI_CMD_RDWRPORT_REG: - case IF_SPI_DATA_RDWRPORT_REG: - return 1; - default: - return 0; - } -} - -static int spu_read(struct if_spi_card *card, u16 reg, u8 *buf, int len) -{ - unsigned int delay; - int err = 0; - __le16 reg_out = cpu_to_le16(reg | IF_SPI_READ_OPERATION_MASK); - struct spi_message m; - struct spi_transfer reg_trans; - struct spi_transfer dummy_trans; - struct spi_transfer data_trans; - - /* - * You must take an even number of bytes from the SPU, even if you - * don't care about the last one. - */ - BUG_ON(len & 0x1); - - spu_transaction_init(card); - - spi_message_init(&m); - memset(®_trans, 0, sizeof(reg_trans)); - memset(&dummy_trans, 0, sizeof(dummy_trans)); - memset(&data_trans, 0, sizeof(data_trans)); - - /* write SPU register index */ - reg_trans.tx_buf = ®_out; - reg_trans.len = sizeof(reg_out); - spi_message_add_tail(®_trans, &m); - - delay = spu_reg_is_port_reg(reg) ? card->spu_port_delay : - card->spu_reg_delay; - if (card->use_dummy_writes) { - /* Clock in dummy cycles while the SPU fills the FIFO */ - dummy_trans.len = delay / 8; - spi_message_add_tail(&dummy_trans, &m); - } else { - /* Busy-wait while the SPU fills the FIFO */ - reg_trans.delay_usecs = - DIV_ROUND_UP((100 + (delay * 10)), 1000); - } - - /* read in data */ - data_trans.rx_buf = buf; - data_trans.len = len; - spi_message_add_tail(&data_trans, &m); - - err = spi_sync(card->spi, &m); - spu_transaction_finish(card); - return err; -} - -/* Read 16 bits from an SPI register */ -static inline int spu_read_u16(struct if_spi_card *card, u16 reg, u16 *val) -{ - __le16 buf; - int ret; - - ret = spu_read(card, reg, (u8 *)&buf, sizeof(buf)); - if (ret == 0) - *val = le16_to_cpup(&buf); - return ret; -} - -/* - * Read 32 bits from an SPI register. - * The low 16 bits are read first. - */ -static int spu_read_u32(struct if_spi_card *card, u16 reg, u32 *val) -{ - __le32 buf; - int err; - - err = spu_read(card, reg, (u8 *)&buf, sizeof(buf)); - if (!err) - *val = le32_to_cpup(&buf); - return err; -} - -/* - * Keep reading 16 bits from an SPI register until you get the correct result. - * - * If mask = 0, the correct result is any non-zero number. - * If mask != 0, the correct result is any number where - * number & target_mask == target - * - * Returns -ETIMEDOUT if a second passes without the correct result. - */ -static int spu_wait_for_u16(struct if_spi_card *card, u16 reg, - u16 target_mask, u16 target) -{ - int err; - unsigned long timeout = jiffies + 5*HZ; - while (1) { - u16 val; - err = spu_read_u16(card, reg, &val); - if (err) - return err; - if (target_mask) { - if ((val & target_mask) == target) - return 0; - } else { - if (val) - return 0; - } - udelay(100); - if (time_after(jiffies, timeout)) { - pr_err("%s: timeout with val=%02x, target_mask=%02x, target=%02x\n", - __func__, val, target_mask, target); - return -ETIMEDOUT; - } - } -} - -/* - * Read 16 bits from an SPI register until you receive a specific value. - * Returns -ETIMEDOUT if a 4 tries pass without success. - */ -static int spu_wait_for_u32(struct if_spi_card *card, u32 reg, u32 target) -{ - int err, try; - for (try = 0; try < 4; ++try) { - u32 val = 0; - err = spu_read_u32(card, reg, &val); - if (err) - return err; - if (val == target) - return 0; - mdelay(100); - } - return -ETIMEDOUT; -} - -static int spu_set_interrupt_mode(struct if_spi_card *card, - int suppress_host_int, - int auto_int) -{ - int err = 0; - - /* - * We can suppress a host interrupt by clearing the appropriate - * bit in the "host interrupt status mask" register - */ - if (suppress_host_int) { - err = spu_write_u16(card, IF_SPI_HOST_INT_STATUS_MASK_REG, 0); - if (err) - return err; - } else { - err = spu_write_u16(card, IF_SPI_HOST_INT_STATUS_MASK_REG, - IF_SPI_HISM_TX_DOWNLOAD_RDY | - IF_SPI_HISM_RX_UPLOAD_RDY | - IF_SPI_HISM_CMD_DOWNLOAD_RDY | - IF_SPI_HISM_CARDEVENT | - IF_SPI_HISM_CMD_UPLOAD_RDY); - if (err) - return err; - } - - /* - * If auto-interrupts are on, the completion of certain transactions - * will trigger an interrupt automatically. If auto-interrupts - * are off, we need to set the "Card Interrupt Cause" register to - * trigger a card interrupt. - */ - if (auto_int) { - err = spu_write_u16(card, IF_SPI_HOST_INT_CTRL_REG, - IF_SPI_HICT_TX_DOWNLOAD_OVER_AUTO | - IF_SPI_HICT_RX_UPLOAD_OVER_AUTO | - IF_SPI_HICT_CMD_DOWNLOAD_OVER_AUTO | - IF_SPI_HICT_CMD_UPLOAD_OVER_AUTO); - if (err) - return err; - } else { - err = spu_write_u16(card, IF_SPI_HOST_INT_STATUS_MASK_REG, 0); - if (err) - return err; - } - return err; -} - -static int spu_get_chip_revision(struct if_spi_card *card, - u16 *card_id, u8 *card_rev) -{ - int err = 0; - u32 dev_ctrl; - err = spu_read_u32(card, IF_SPI_DEVICEID_CTRL_REG, &dev_ctrl); - if (err) - return err; - *card_id = IF_SPI_DEVICEID_CTRL_REG_TO_CARD_ID(dev_ctrl); - *card_rev = IF_SPI_DEVICEID_CTRL_REG_TO_CARD_REV(dev_ctrl); - return err; -} - -static int spu_set_bus_mode(struct if_spi_card *card, u16 mode) -{ - int err = 0; - u16 rval; - /* set bus mode */ - err = spu_write_u16(card, IF_SPI_SPU_BUS_MODE_REG, mode); - if (err) - return err; - /* Check that we were able to read back what we just wrote. */ - err = spu_read_u16(card, IF_SPI_SPU_BUS_MODE_REG, &rval); - if (err) - return err; - if ((rval & 0xF) != mode) { - pr_err("Can't read bus mode register\n"); - return -EIO; - } - return 0; -} - -static int spu_init(struct if_spi_card *card, int use_dummy_writes) -{ - int err = 0; - u32 delay; - - /* - * We have to start up in timed delay mode so that we can safely - * read the Delay Read Register. - */ - card->use_dummy_writes = 0; - err = spu_set_bus_mode(card, - IF_SPI_BUS_MODE_SPI_CLOCK_PHASE_RISING | - IF_SPI_BUS_MODE_DELAY_METHOD_TIMED | - IF_SPI_BUS_MODE_16_BIT_ADDRESS_16_BIT_DATA); - if (err) - return err; - card->spu_port_delay = 1000; - card->spu_reg_delay = 1000; - err = spu_read_u32(card, IF_SPI_DELAY_READ_REG, &delay); - if (err) - return err; - card->spu_port_delay = delay & 0x0000ffff; - card->spu_reg_delay = (delay & 0xffff0000) >> 16; - - /* If dummy clock delay mode has been requested, switch to it now */ - if (use_dummy_writes) { - card->use_dummy_writes = 1; - err = spu_set_bus_mode(card, - IF_SPI_BUS_MODE_SPI_CLOCK_PHASE_RISING | - IF_SPI_BUS_MODE_DELAY_METHOD_DUMMY_CLOCK | - IF_SPI_BUS_MODE_16_BIT_ADDRESS_16_BIT_DATA); - if (err) - return err; - } - - lbs_deb_spi("Initialized SPU unit. " - "spu_port_delay=0x%04lx, spu_reg_delay=0x%04lx\n", - card->spu_port_delay, card->spu_reg_delay); - return err; -} - -/* - * Firmware Loading - */ - -static int if_spi_prog_helper_firmware(struct if_spi_card *card, - const struct firmware *firmware) -{ - int err = 0; - int bytes_remaining; - const u8 *fw; - u8 temp[HELPER_FW_LOAD_CHUNK_SZ]; - - lbs_deb_enter(LBS_DEB_SPI); - - err = spu_set_interrupt_mode(card, 1, 0); - if (err) - goto out; - - bytes_remaining = firmware->size; - fw = firmware->data; - - /* Load helper firmware image */ - while (bytes_remaining > 0) { - /* - * Scratch pad 1 should contain the number of bytes we - * want to download to the firmware - */ - err = spu_write_u16(card, IF_SPI_SCRATCH_1_REG, - HELPER_FW_LOAD_CHUNK_SZ); - if (err) - goto out; - - err = spu_wait_for_u16(card, IF_SPI_HOST_INT_STATUS_REG, - IF_SPI_HIST_CMD_DOWNLOAD_RDY, - IF_SPI_HIST_CMD_DOWNLOAD_RDY); - if (err) - goto out; - - /* - * Feed the data into the command read/write port reg - * in chunks of 64 bytes - */ - memset(temp, 0, sizeof(temp)); - memcpy(temp, fw, - min(bytes_remaining, HELPER_FW_LOAD_CHUNK_SZ)); - mdelay(10); - err = spu_write(card, IF_SPI_CMD_RDWRPORT_REG, - temp, HELPER_FW_LOAD_CHUNK_SZ); - if (err) - goto out; - - /* Interrupt the boot code */ - err = spu_write_u16(card, IF_SPI_HOST_INT_STATUS_REG, 0); - if (err) - goto out; - err = spu_write_u16(card, IF_SPI_CARD_INT_CAUSE_REG, - IF_SPI_CIC_CMD_DOWNLOAD_OVER); - if (err) - goto out; - bytes_remaining -= HELPER_FW_LOAD_CHUNK_SZ; - fw += HELPER_FW_LOAD_CHUNK_SZ; - } - - /* - * Once the helper / single stage firmware download is complete, - * write 0 to scratch pad 1 and interrupt the - * bootloader. This completes the helper download. - */ - err = spu_write_u16(card, IF_SPI_SCRATCH_1_REG, FIRMWARE_DNLD_OK); - if (err) - goto out; - err = spu_write_u16(card, IF_SPI_HOST_INT_STATUS_REG, 0); - if (err) - goto out; - err = spu_write_u16(card, IF_SPI_CARD_INT_CAUSE_REG, - IF_SPI_CIC_CMD_DOWNLOAD_OVER); -out: - if (err) - pr_err("failed to load helper firmware (err=%d)\n", err); - lbs_deb_leave_args(LBS_DEB_SPI, "err %d", err); - return err; -} - -/* - * Returns the length of the next packet the firmware expects us to send. - * Sets crc_err if the previous transfer had a CRC error. - */ -static int if_spi_prog_main_firmware_check_len(struct if_spi_card *card, - int *crc_err) -{ - u16 len; - int err = 0; - - /* - * wait until the host interrupt status register indicates - * that we are ready to download - */ - err = spu_wait_for_u16(card, IF_SPI_HOST_INT_STATUS_REG, - IF_SPI_HIST_CMD_DOWNLOAD_RDY, - IF_SPI_HIST_CMD_DOWNLOAD_RDY); - if (err) { - pr_err("timed out waiting for host_int_status\n"); - return err; - } - - /* Ask the device how many bytes of firmware it wants. */ - err = spu_read_u16(card, IF_SPI_SCRATCH_1_REG, &len); - if (err) - return err; - - if (len > IF_SPI_CMD_BUF_SIZE) { - pr_err("firmware load device requested a larger transfer than we are prepared to handle (len = %d)\n", - len); - return -EIO; - } - if (len & 0x1) { - lbs_deb_spi("%s: crc error\n", __func__); - len &= ~0x1; - *crc_err = 1; - } else - *crc_err = 0; - - return len; -} - -static int if_spi_prog_main_firmware(struct if_spi_card *card, - const struct firmware *firmware) -{ - struct lbs_private *priv = card->priv; - int len, prev_len; - int bytes, crc_err = 0, err = 0; - const u8 *fw; - u16 num_crc_errs; - - lbs_deb_enter(LBS_DEB_SPI); - - err = spu_set_interrupt_mode(card, 1, 0); - if (err) - goto out; - - err = spu_wait_for_u16(card, IF_SPI_SCRATCH_1_REG, 0, 0); - if (err) { - netdev_err(priv->dev, - "%s: timed out waiting for initial scratch reg = 0\n", - __func__); - goto out; - } - - num_crc_errs = 0; - prev_len = 0; - bytes = firmware->size; - fw = firmware->data; - while ((len = if_spi_prog_main_firmware_check_len(card, &crc_err))) { - if (len < 0) { - err = len; - goto out; - } - if (bytes < 0) { - /* - * If there are no more bytes left, we would normally - * expect to have terminated with len = 0 - */ - netdev_err(priv->dev, - "Firmware load wants more bytes than we have to offer.\n"); - break; - } - if (crc_err) { - /* Previous transfer failed. */ - if (++num_crc_errs > MAX_MAIN_FW_LOAD_CRC_ERR) { - pr_err("Too many CRC errors encountered in firmware load.\n"); - err = -EIO; - goto out; - } - } else { - /* Previous transfer succeeded. Advance counters. */ - bytes -= prev_len; - fw += prev_len; - } - if (bytes < len) { - memset(card->cmd_buffer, 0, len); - memcpy(card->cmd_buffer, fw, bytes); - } else - memcpy(card->cmd_buffer, fw, len); - - err = spu_write_u16(card, IF_SPI_HOST_INT_STATUS_REG, 0); - if (err) - goto out; - err = spu_write(card, IF_SPI_CMD_RDWRPORT_REG, - card->cmd_buffer, len); - if (err) - goto out; - err = spu_write_u16(card, IF_SPI_CARD_INT_CAUSE_REG , - IF_SPI_CIC_CMD_DOWNLOAD_OVER); - if (err) - goto out; - prev_len = len; - } - if (bytes > prev_len) { - pr_err("firmware load wants fewer bytes than we have to offer\n"); - } - - /* Confirm firmware download */ - err = spu_wait_for_u32(card, IF_SPI_SCRATCH_4_REG, - SUCCESSFUL_FW_DOWNLOAD_MAGIC); - if (err) { - pr_err("failed to confirm the firmware download\n"); - goto out; - } - -out: - if (err) - pr_err("failed to load firmware (err=%d)\n", err); - lbs_deb_leave_args(LBS_DEB_SPI, "err %d", err); - return err; -} - -/* - * SPI Transfer Thread - * - * The SPI worker handles all SPI transfers, so there is no need for a lock. - */ - -/* Move a command from the card to the host */ -static int if_spi_c2h_cmd(struct if_spi_card *card) -{ - struct lbs_private *priv = card->priv; - unsigned long flags; - int err = 0; - u16 len; - u8 i; - - /* - * We need a buffer big enough to handle whatever people send to - * hw_host_to_card - */ - BUILD_BUG_ON(IF_SPI_CMD_BUF_SIZE < LBS_CMD_BUFFER_SIZE); - BUILD_BUG_ON(IF_SPI_CMD_BUF_SIZE < LBS_UPLD_SIZE); - - /* - * It's just annoying if the buffer size isn't a multiple of 4, because - * then we might have len < IF_SPI_CMD_BUF_SIZE but - * ALIGN(len, 4) > IF_SPI_CMD_BUF_SIZE - */ - BUILD_BUG_ON(IF_SPI_CMD_BUF_SIZE % 4 != 0); - - lbs_deb_enter(LBS_DEB_SPI); - - /* How many bytes are there to read? */ - err = spu_read_u16(card, IF_SPI_SCRATCH_2_REG, &len); - if (err) - goto out; - if (!len) { - netdev_err(priv->dev, "%s: error: card has no data for host\n", - __func__); - err = -EINVAL; - goto out; - } else if (len > IF_SPI_CMD_BUF_SIZE) { - netdev_err(priv->dev, - "%s: error: response packet too large: %d bytes, but maximum is %d\n", - __func__, len, IF_SPI_CMD_BUF_SIZE); - err = -EINVAL; - goto out; - } - - /* Read the data from the WLAN module into our command buffer */ - err = spu_read(card, IF_SPI_CMD_RDWRPORT_REG, - card->cmd_buffer, ALIGN(len, 4)); - if (err) - goto out; - - spin_lock_irqsave(&priv->driver_lock, flags); - i = (priv->resp_idx == 0) ? 1 : 0; - BUG_ON(priv->resp_len[i]); - priv->resp_len[i] = len; - memcpy(priv->resp_buf[i], card->cmd_buffer, len); - lbs_notify_command_response(priv, i); - spin_unlock_irqrestore(&priv->driver_lock, flags); - -out: - if (err) - netdev_err(priv->dev, "%s: err=%d\n", __func__, err); - lbs_deb_leave(LBS_DEB_SPI); - return err; -} - -/* Move data from the card to the host */ -static int if_spi_c2h_data(struct if_spi_card *card) -{ - struct lbs_private *priv = card->priv; - struct sk_buff *skb; - char *data; - u16 len; - int err = 0; - - lbs_deb_enter(LBS_DEB_SPI); - - /* How many bytes are there to read? */ - err = spu_read_u16(card, IF_SPI_SCRATCH_1_REG, &len); - if (err) - goto out; - if (!len) { - netdev_err(priv->dev, "%s: error: card has no data for host\n", - __func__); - err = -EINVAL; - goto out; - } else if (len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) { - netdev_err(priv->dev, - "%s: error: card has %d bytes of data, but our maximum skb size is %zu\n", - __func__, len, MRVDRV_ETH_RX_PACKET_BUFFER_SIZE); - err = -EINVAL; - goto out; - } - - /* TODO: should we allocate a smaller skb if we have less data? */ - skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE); - if (!skb) { - err = -ENOBUFS; - goto out; - } - skb_reserve(skb, IPFIELD_ALIGN_OFFSET); - data = skb_put(skb, len); - - /* Read the data from the WLAN module into our skb... */ - err = spu_read(card, IF_SPI_DATA_RDWRPORT_REG, data, ALIGN(len, 4)); - if (err) - goto free_skb; - - /* pass the SKB to libertas */ - err = lbs_process_rxed_packet(card->priv, skb); - if (err) - goto free_skb; - - /* success */ - goto out; - -free_skb: - dev_kfree_skb(skb); -out: - if (err) - netdev_err(priv->dev, "%s: err=%d\n", __func__, err); - lbs_deb_leave(LBS_DEB_SPI); - return err; -} - -/* Move data or a command from the host to the card. */ -static void if_spi_h2c(struct if_spi_card *card, - struct if_spi_packet *packet, int type) -{ - struct lbs_private *priv = card->priv; - int err = 0; - u16 int_type, port_reg; - - switch (type) { - case MVMS_DAT: - int_type = IF_SPI_CIC_TX_DOWNLOAD_OVER; - port_reg = IF_SPI_DATA_RDWRPORT_REG; - break; - case MVMS_CMD: - int_type = IF_SPI_CIC_CMD_DOWNLOAD_OVER; - port_reg = IF_SPI_CMD_RDWRPORT_REG; - break; - default: - netdev_err(priv->dev, "can't transfer buffer of type %d\n", - type); - err = -EINVAL; - goto out; - } - - /* Write the data to the card */ - err = spu_write(card, port_reg, packet->buffer, packet->blen); - if (err) - goto out; - -out: - kfree(packet); - - if (err) - netdev_err(priv->dev, "%s: error %d\n", __func__, err); -} - -/* Inform the host about a card event */ -static void if_spi_e2h(struct if_spi_card *card) -{ - int err = 0; - u32 cause; - struct lbs_private *priv = card->priv; - - err = spu_read_u32(card, IF_SPI_SCRATCH_3_REG, &cause); - if (err) - goto out; - - /* re-enable the card event interrupt */ - spu_write_u16(card, IF_SPI_HOST_INT_STATUS_REG, - ~IF_SPI_HICU_CARD_EVENT); - - /* generate a card interrupt */ - spu_write_u16(card, IF_SPI_CARD_INT_CAUSE_REG, IF_SPI_CIC_HOST_EVENT); - - lbs_queue_event(priv, cause & 0xff); -out: - if (err) - netdev_err(priv->dev, "%s: error %d\n", __func__, err); -} - -static void if_spi_host_to_card_worker(struct work_struct *work) -{ - int err; - struct if_spi_card *card; - u16 hiStatus; - unsigned long flags; - struct if_spi_packet *packet; - struct lbs_private *priv; - - card = container_of(work, struct if_spi_card, packet_work); - priv = card->priv; - - lbs_deb_enter(LBS_DEB_SPI); - - /* - * Read the host interrupt status register to see what we - * can do. - */ - err = spu_read_u16(card, IF_SPI_HOST_INT_STATUS_REG, - &hiStatus); - if (err) { - netdev_err(priv->dev, "I/O error\n"); - goto err; - } - - if (hiStatus & IF_SPI_HIST_CMD_UPLOAD_RDY) { - err = if_spi_c2h_cmd(card); - if (err) - goto err; - } - if (hiStatus & IF_SPI_HIST_RX_UPLOAD_RDY) { - err = if_spi_c2h_data(card); - if (err) - goto err; - } - - /* - * workaround: in PS mode, the card does not set the Command - * Download Ready bit, but it sets TX Download Ready. - */ - if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY || - (card->priv->psstate != PS_STATE_FULL_POWER && - (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY))) { - /* - * This means two things. First of all, - * if there was a previous command sent, the card has - * successfully received it. - * Secondly, it is now ready to download another - * command. - */ - lbs_host_to_card_done(card->priv); - - /* Do we have any command packets from the host to send? */ - packet = NULL; - spin_lock_irqsave(&card->buffer_lock, flags); - if (!list_empty(&card->cmd_packet_list)) { - packet = (struct if_spi_packet *)(card-> - cmd_packet_list.next); - list_del(&packet->list); - } - spin_unlock_irqrestore(&card->buffer_lock, flags); - - if (packet) - if_spi_h2c(card, packet, MVMS_CMD); - } - if (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY) { - /* Do we have any data packets from the host to send? */ - packet = NULL; - spin_lock_irqsave(&card->buffer_lock, flags); - if (!list_empty(&card->data_packet_list)) { - packet = (struct if_spi_packet *)(card-> - data_packet_list.next); - list_del(&packet->list); - } - spin_unlock_irqrestore(&card->buffer_lock, flags); - - if (packet) - if_spi_h2c(card, packet, MVMS_DAT); - } - if (hiStatus & IF_SPI_HIST_CARD_EVENT) - if_spi_e2h(card); - -err: - if (err) - netdev_err(priv->dev, "%s: got error %d\n", __func__, err); - - lbs_deb_leave(LBS_DEB_SPI); -} - -/* - * Host to Card - * - * Called from Libertas to transfer some data to the WLAN device - * We can't sleep here. - */ -static int if_spi_host_to_card(struct lbs_private *priv, - u8 type, u8 *buf, u16 nb) -{ - int err = 0; - unsigned long flags; - struct if_spi_card *card = priv->card; - struct if_spi_packet *packet; - u16 blen; - - lbs_deb_enter_args(LBS_DEB_SPI, "type %d, bytes %d", type, nb); - - if (nb == 0) { - netdev_err(priv->dev, "%s: invalid size requested: %d\n", - __func__, nb); - err = -EINVAL; - goto out; - } - blen = ALIGN(nb, 4); - packet = kzalloc(sizeof(struct if_spi_packet) + blen, GFP_ATOMIC); - if (!packet) { - err = -ENOMEM; - goto out; - } - packet->blen = blen; - memcpy(packet->buffer, buf, nb); - memset(packet->buffer + nb, 0, blen - nb); - - switch (type) { - case MVMS_CMD: - priv->dnld_sent = DNLD_CMD_SENT; - spin_lock_irqsave(&card->buffer_lock, flags); - list_add_tail(&packet->list, &card->cmd_packet_list); - spin_unlock_irqrestore(&card->buffer_lock, flags); - break; - case MVMS_DAT: - priv->dnld_sent = DNLD_DATA_SENT; - spin_lock_irqsave(&card->buffer_lock, flags); - list_add_tail(&packet->list, &card->data_packet_list); - spin_unlock_irqrestore(&card->buffer_lock, flags); - break; - default: - kfree(packet); - netdev_err(priv->dev, "can't transfer buffer of type %d\n", - type); - err = -EINVAL; - break; - } - - /* Queue spi xfer work */ - queue_work(card->workqueue, &card->packet_work); -out: - lbs_deb_leave_args(LBS_DEB_SPI, "err=%d", err); - return err; -} - -/* - * Host Interrupts - * - * Service incoming interrupts from the WLAN device. We can't sleep here, so - * don't try to talk on the SPI bus, just queue the SPI xfer work. - */ -static irqreturn_t if_spi_host_interrupt(int irq, void *dev_id) -{ - struct if_spi_card *card = dev_id; - - queue_work(card->workqueue, &card->packet_work); - - return IRQ_HANDLED; -} - -/* - * SPI callbacks - */ - -static int if_spi_init_card(struct if_spi_card *card) -{ - struct lbs_private *priv = card->priv; - int err, i; - u32 scratch; - const struct firmware *helper = NULL; - const struct firmware *mainfw = NULL; - - lbs_deb_enter(LBS_DEB_SPI); - - err = spu_init(card, card->pdata->use_dummy_writes); - if (err) - goto out; - err = spu_get_chip_revision(card, &card->card_id, &card->card_rev); - if (err) - goto out; - - err = spu_read_u32(card, IF_SPI_SCRATCH_4_REG, &scratch); - if (err) - goto out; - if (scratch == SUCCESSFUL_FW_DOWNLOAD_MAGIC) - lbs_deb_spi("Firmware is already loaded for " - "Marvell WLAN 802.11 adapter\n"); - else { - /* Check if we support this card */ - for (i = 0; i < ARRAY_SIZE(fw_table); i++) { - if (card->card_id == fw_table[i].model) - break; - } - if (i == ARRAY_SIZE(fw_table)) { - netdev_err(priv->dev, "Unsupported chip_id: 0x%02x\n", - card->card_id); - err = -ENODEV; - goto out; - } - - err = lbs_get_firmware(&card->spi->dev, card->card_id, - &fw_table[0], &helper, &mainfw); - if (err) { - netdev_err(priv->dev, "failed to find firmware (%d)\n", - err); - goto out; - } - - lbs_deb_spi("Initializing FW for Marvell WLAN 802.11 adapter " - "(chip_id = 0x%04x, chip_rev = 0x%02x) " - "attached to SPI bus_num %d, chip_select %d. " - "spi->max_speed_hz=%d\n", - card->card_id, card->card_rev, - card->spi->master->bus_num, - card->spi->chip_select, - card->spi->max_speed_hz); - err = if_spi_prog_helper_firmware(card, helper); - if (err) - goto out; - err = if_spi_prog_main_firmware(card, mainfw); - if (err) - goto out; - lbs_deb_spi("loaded FW for Marvell WLAN 802.11 adapter\n"); - } - - err = spu_set_interrupt_mode(card, 0, 1); - if (err) - goto out; - -out: - release_firmware(helper); - release_firmware(mainfw); - - lbs_deb_leave_args(LBS_DEB_SPI, "err %d\n", err); - - return err; -} - -static void if_spi_resume_worker(struct work_struct *work) -{ - struct if_spi_card *card; - - card = container_of(work, struct if_spi_card, resume_work); - - if (card->suspended) { - if (card->pdata->setup) - card->pdata->setup(card->spi); - - /* Init card ... */ - if_spi_init_card(card); - - enable_irq(card->spi->irq); - - /* And resume it ... */ - lbs_resume(card->priv); - - card->suspended = 0; - } -} - -static int if_spi_probe(struct spi_device *spi) -{ - struct if_spi_card *card; - struct lbs_private *priv = NULL; - struct libertas_spi_platform_data *pdata = spi->dev.platform_data; - int err = 0; - - lbs_deb_enter(LBS_DEB_SPI); - - if (!pdata) { - err = -EINVAL; - goto out; - } - - if (pdata->setup) { - err = pdata->setup(spi); - if (err) - goto out; - } - - /* Allocate card structure to represent this specific device */ - card = kzalloc(sizeof(struct if_spi_card), GFP_KERNEL); - if (!card) { - err = -ENOMEM; - goto teardown; - } - spi_set_drvdata(spi, card); - card->pdata = pdata; - card->spi = spi; - card->prev_xfer_time = jiffies; - - INIT_LIST_HEAD(&card->cmd_packet_list); - INIT_LIST_HEAD(&card->data_packet_list); - spin_lock_init(&card->buffer_lock); - - /* Initialize the SPI Interface Unit */ - - /* Firmware load */ - err = if_spi_init_card(card); - if (err) - goto free_card; - - /* - * Register our card with libertas. - * This will call alloc_etherdev. - */ - priv = lbs_add_card(card, &spi->dev); - if (!priv) { - err = -ENOMEM; - goto free_card; - } - card->priv = priv; - priv->setup_fw_on_resume = 1; - priv->card = card; - priv->hw_host_to_card = if_spi_host_to_card; - priv->enter_deep_sleep = NULL; - priv->exit_deep_sleep = NULL; - priv->reset_deep_sleep_wakeup = NULL; - priv->fw_ready = 1; - - /* Initialize interrupt handling stuff. */ - card->workqueue = create_workqueue("libertas_spi"); - INIT_WORK(&card->packet_work, if_spi_host_to_card_worker); - INIT_WORK(&card->resume_work, if_spi_resume_worker); - - err = request_irq(spi->irq, if_spi_host_interrupt, - IRQF_TRIGGER_FALLING, "libertas_spi", card); - if (err) { - pr_err("can't get host irq line-- request_irq failed\n"); - goto terminate_workqueue; - } - - /* - * Start the card. - * This will call register_netdev, and we'll start - * getting interrupts... - */ - err = lbs_start_card(priv); - if (err) - goto release_irq; - - lbs_deb_spi("Finished initializing WLAN module.\n"); - - /* successful exit */ - goto out; - -release_irq: - free_irq(spi->irq, card); -terminate_workqueue: - flush_workqueue(card->workqueue); - destroy_workqueue(card->workqueue); - lbs_remove_card(priv); /* will call free_netdev */ -free_card: - free_if_spi_card(card); -teardown: - if (pdata->teardown) - pdata->teardown(spi); -out: - lbs_deb_leave_args(LBS_DEB_SPI, "err %d\n", err); - return err; -} - -static int libertas_spi_remove(struct spi_device *spi) -{ - struct if_spi_card *card = spi_get_drvdata(spi); - struct lbs_private *priv = card->priv; - - lbs_deb_spi("libertas_spi_remove\n"); - lbs_deb_enter(LBS_DEB_SPI); - - cancel_work_sync(&card->resume_work); - - lbs_stop_card(priv); - lbs_remove_card(priv); /* will call free_netdev */ - - free_irq(spi->irq, card); - flush_workqueue(card->workqueue); - destroy_workqueue(card->workqueue); - if (card->pdata->teardown) - card->pdata->teardown(spi); - free_if_spi_card(card); - lbs_deb_leave(LBS_DEB_SPI); - return 0; -} - -static int if_spi_suspend(struct device *dev) -{ - struct spi_device *spi = to_spi_device(dev); - struct if_spi_card *card = spi_get_drvdata(spi); - - if (!card->suspended) { - lbs_suspend(card->priv); - flush_workqueue(card->workqueue); - disable_irq(spi->irq); - - if (card->pdata->teardown) - card->pdata->teardown(spi); - card->suspended = 1; - } - - return 0; -} - -static int if_spi_resume(struct device *dev) -{ - struct spi_device *spi = to_spi_device(dev); - struct if_spi_card *card = spi_get_drvdata(spi); - - /* Schedule delayed work */ - schedule_work(&card->resume_work); - - return 0; -} - -static const struct dev_pm_ops if_spi_pm_ops = { - .suspend = if_spi_suspend, - .resume = if_spi_resume, -}; - -static struct spi_driver libertas_spi_driver = { - .probe = if_spi_probe, - .remove = libertas_spi_remove, - .driver = { - .name = "libertas_spi", - .owner = THIS_MODULE, - .pm = &if_spi_pm_ops, - }, -}; - -/* - * Module functions - */ - -static int __init if_spi_init_module(void) -{ - int ret = 0; - lbs_deb_enter(LBS_DEB_SPI); - printk(KERN_INFO "libertas_spi: Libertas SPI driver\n"); - ret = spi_register_driver(&libertas_spi_driver); - lbs_deb_leave(LBS_DEB_SPI); - return ret; -} - -static void __exit if_spi_exit_module(void) -{ - lbs_deb_enter(LBS_DEB_SPI); - spi_unregister_driver(&libertas_spi_driver); - lbs_deb_leave(LBS_DEB_SPI); -} - -module_init(if_spi_init_module); -module_exit(if_spi_exit_module); - -MODULE_DESCRIPTION("Libertas SPI WLAN Driver"); -MODULE_AUTHOR("Andrey Yurovsky , " - "Colin McCabe "); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("spi:libertas_spi"); diff --git a/drivers/net/wireless/libertas/if_spi.h b/drivers/net/wireless/libertas/if_spi.h deleted file mode 100644 index e450e31fd11d..000000000000 --- a/drivers/net/wireless/libertas/if_spi.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - * linux/drivers/net/wireless/libertas/if_spi.c - * - * Driver for Marvell SPI WLAN cards. - * - * Copyright 2008 Analog Devices Inc. - * - * Authors: - * Andrey Yurovsky - * Colin McCabe - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - */ - -#ifndef _LBS_IF_SPI_H_ -#define _LBS_IF_SPI_H_ - -#define IPFIELD_ALIGN_OFFSET 2 -#define IF_SPI_CMD_BUF_SIZE 2400 - -/***************** Firmware *****************/ - -#define IF_SPI_FW_NAME_MAX 30 - -#define MAX_MAIN_FW_LOAD_CRC_ERR 10 - -/* Chunk size when loading the helper firmware */ -#define HELPER_FW_LOAD_CHUNK_SZ 64 - -/* Value to write to indicate end of helper firmware dnld */ -#define FIRMWARE_DNLD_OK 0x0000 - -/* Value to check once the main firmware is downloaded */ -#define SUCCESSFUL_FW_DOWNLOAD_MAGIC 0x88888888 - -/***************** SPI Interface Unit *****************/ -/* Masks used in SPI register read/write operations */ -#define IF_SPI_READ_OPERATION_MASK 0x0 -#define IF_SPI_WRITE_OPERATION_MASK 0x8000 - -/* SPI register offsets. 4-byte aligned. */ -#define IF_SPI_DEVICEID_CTRL_REG 0x00 /* DeviceID controller reg */ -#define IF_SPI_IO_READBASE_REG 0x04 /* Read I/O base reg */ -#define IF_SPI_IO_WRITEBASE_REG 0x08 /* Write I/O base reg */ -#define IF_SPI_IO_RDWRPORT_REG 0x0C /* Read/Write I/O port reg */ - -#define IF_SPI_CMD_READBASE_REG 0x10 /* Read command base reg */ -#define IF_SPI_CMD_WRITEBASE_REG 0x14 /* Write command base reg */ -#define IF_SPI_CMD_RDWRPORT_REG 0x18 /* Read/Write command port reg */ - -#define IF_SPI_DATA_READBASE_REG 0x1C /* Read data base reg */ -#define IF_SPI_DATA_WRITEBASE_REG 0x20 /* Write data base reg */ -#define IF_SPI_DATA_RDWRPORT_REG 0x24 /* Read/Write data port reg */ - -#define IF_SPI_SCRATCH_1_REG 0x28 /* Scratch reg 1 */ -#define IF_SPI_SCRATCH_2_REG 0x2C /* Scratch reg 2 */ -#define IF_SPI_SCRATCH_3_REG 0x30 /* Scratch reg 3 */ -#define IF_SPI_SCRATCH_4_REG 0x34 /* Scratch reg 4 */ - -#define IF_SPI_TX_FRAME_SEQ_NUM_REG 0x38 /* Tx frame sequence number reg */ -#define IF_SPI_TX_FRAME_STATUS_REG 0x3C /* Tx frame status reg */ - -#define IF_SPI_HOST_INT_CTRL_REG 0x40 /* Host interrupt controller reg */ - -#define IF_SPI_CARD_INT_CAUSE_REG 0x44 /* Card interrupt cause reg */ -#define IF_SPI_CARD_INT_STATUS_REG 0x48 /* Card interrupt status reg */ -#define IF_SPI_CARD_INT_EVENT_MASK_REG 0x4C /* Card interrupt event mask */ -#define IF_SPI_CARD_INT_STATUS_MASK_REG 0x50 /* Card interrupt status mask */ - -#define IF_SPI_CARD_INT_RESET_SELECT_REG 0x54 /* Card interrupt reset select */ - -#define IF_SPI_HOST_INT_CAUSE_REG 0x58 /* Host interrupt cause reg */ -#define IF_SPI_HOST_INT_STATUS_REG 0x5C /* Host interrupt status reg */ -#define IF_SPI_HOST_INT_EVENT_MASK_REG 0x60 /* Host interrupt event mask */ -#define IF_SPI_HOST_INT_STATUS_MASK_REG 0x64 /* Host interrupt status mask */ -#define IF_SPI_HOST_INT_RESET_SELECT_REG 0x68 /* Host interrupt reset select */ - -#define IF_SPI_DELAY_READ_REG 0x6C /* Delay read reg */ -#define IF_SPI_SPU_BUS_MODE_REG 0x70 /* SPU BUS mode reg */ - -/***************** IF_SPI_DEVICEID_CTRL_REG *****************/ -#define IF_SPI_DEVICEID_CTRL_REG_TO_CARD_ID(dc) ((dc & 0xffff0000)>>16) -#define IF_SPI_DEVICEID_CTRL_REG_TO_CARD_REV(dc) (dc & 0x000000ff) - -/***************** IF_SPI_HOST_INT_CTRL_REG *****************/ -/* Host Interrupt Control bit : Wake up */ -#define IF_SPI_HICT_WAKE_UP (1<<0) -/* Host Interrupt Control bit : WLAN ready */ -#define IF_SPI_HICT_WLAN_READY (1<<1) -/*#define IF_SPI_HICT_FIFO_FIRST_HALF_EMPTY (1<<2) */ -/*#define IF_SPI_HICT_FIFO_SECOND_HALF_EMPTY (1<<3) */ -/*#define IF_SPI_HICT_IRQSRC_WLAN (1<<4) */ -/* Host Interrupt Control bit : Tx auto download */ -#define IF_SPI_HICT_TX_DOWNLOAD_OVER_AUTO (1<<5) -/* Host Interrupt Control bit : Rx auto upload */ -#define IF_SPI_HICT_RX_UPLOAD_OVER_AUTO (1<<6) -/* Host Interrupt Control bit : Command auto download */ -#define IF_SPI_HICT_CMD_DOWNLOAD_OVER_AUTO (1<<7) -/* Host Interrupt Control bit : Command auto upload */ -#define IF_SPI_HICT_CMD_UPLOAD_OVER_AUTO (1<<8) - -/***************** IF_SPI_CARD_INT_CAUSE_REG *****************/ -/* Card Interrupt Case bit : Tx download over */ -#define IF_SPI_CIC_TX_DOWNLOAD_OVER (1<<0) -/* Card Interrupt Case bit : Rx upload over */ -#define IF_SPI_CIC_RX_UPLOAD_OVER (1<<1) -/* Card Interrupt Case bit : Command download over */ -#define IF_SPI_CIC_CMD_DOWNLOAD_OVER (1<<2) -/* Card Interrupt Case bit : Host event */ -#define IF_SPI_CIC_HOST_EVENT (1<<3) -/* Card Interrupt Case bit : Command upload over */ -#define IF_SPI_CIC_CMD_UPLOAD_OVER (1<<4) -/* Card Interrupt Case bit : Power down */ -#define IF_SPI_CIC_POWER_DOWN (1<<5) - -/***************** IF_SPI_CARD_INT_STATUS_REG *****************/ -#define IF_SPI_CIS_TX_DOWNLOAD_OVER (1<<0) -#define IF_SPI_CIS_RX_UPLOAD_OVER (1<<1) -#define IF_SPI_CIS_CMD_DOWNLOAD_OVER (1<<2) -#define IF_SPI_CIS_HOST_EVENT (1<<3) -#define IF_SPI_CIS_CMD_UPLOAD_OVER (1<<4) -#define IF_SPI_CIS_POWER_DOWN (1<<5) - -/***************** IF_SPI_HOST_INT_CAUSE_REG *****************/ -#define IF_SPI_HICU_TX_DOWNLOAD_RDY (1<<0) -#define IF_SPI_HICU_RX_UPLOAD_RDY (1<<1) -#define IF_SPI_HICU_CMD_DOWNLOAD_RDY (1<<2) -#define IF_SPI_HICU_CARD_EVENT (1<<3) -#define IF_SPI_HICU_CMD_UPLOAD_RDY (1<<4) -#define IF_SPI_HICU_IO_WR_FIFO_OVERFLOW (1<<5) -#define IF_SPI_HICU_IO_RD_FIFO_UNDERFLOW (1<<6) -#define IF_SPI_HICU_DATA_WR_FIFO_OVERFLOW (1<<7) -#define IF_SPI_HICU_DATA_RD_FIFO_UNDERFLOW (1<<8) -#define IF_SPI_HICU_CMD_WR_FIFO_OVERFLOW (1<<9) -#define IF_SPI_HICU_CMD_RD_FIFO_UNDERFLOW (1<<10) - -/***************** IF_SPI_HOST_INT_STATUS_REG *****************/ -/* Host Interrupt Status bit : Tx download ready */ -#define IF_SPI_HIST_TX_DOWNLOAD_RDY (1<<0) -/* Host Interrupt Status bit : Rx upload ready */ -#define IF_SPI_HIST_RX_UPLOAD_RDY (1<<1) -/* Host Interrupt Status bit : Command download ready */ -#define IF_SPI_HIST_CMD_DOWNLOAD_RDY (1<<2) -/* Host Interrupt Status bit : Card event */ -#define IF_SPI_HIST_CARD_EVENT (1<<3) -/* Host Interrupt Status bit : Command upload ready */ -#define IF_SPI_HIST_CMD_UPLOAD_RDY (1<<4) -/* Host Interrupt Status bit : I/O write FIFO overflow */ -#define IF_SPI_HIST_IO_WR_FIFO_OVERFLOW (1<<5) -/* Host Interrupt Status bit : I/O read FIFO underflow */ -#define IF_SPI_HIST_IO_RD_FIFO_UNDRFLOW (1<<6) -/* Host Interrupt Status bit : Data write FIFO overflow */ -#define IF_SPI_HIST_DATA_WR_FIFO_OVERFLOW (1<<7) -/* Host Interrupt Status bit : Data read FIFO underflow */ -#define IF_SPI_HIST_DATA_RD_FIFO_UNDERFLOW (1<<8) -/* Host Interrupt Status bit : Command write FIFO overflow */ -#define IF_SPI_HIST_CMD_WR_FIFO_OVERFLOW (1<<9) -/* Host Interrupt Status bit : Command read FIFO underflow */ -#define IF_SPI_HIST_CMD_RD_FIFO_UNDERFLOW (1<<10) - -/***************** IF_SPI_HOST_INT_STATUS_MASK_REG *****************/ -/* Host Interrupt Status Mask bit : Tx download ready */ -#define IF_SPI_HISM_TX_DOWNLOAD_RDY (1<<0) -/* Host Interrupt Status Mask bit : Rx upload ready */ -#define IF_SPI_HISM_RX_UPLOAD_RDY (1<<1) -/* Host Interrupt Status Mask bit : Command download ready */ -#define IF_SPI_HISM_CMD_DOWNLOAD_RDY (1<<2) -/* Host Interrupt Status Mask bit : Card event */ -#define IF_SPI_HISM_CARDEVENT (1<<3) -/* Host Interrupt Status Mask bit : Command upload ready */ -#define IF_SPI_HISM_CMD_UPLOAD_RDY (1<<4) -/* Host Interrupt Status Mask bit : I/O write FIFO overflow */ -#define IF_SPI_HISM_IO_WR_FIFO_OVERFLOW (1<<5) -/* Host Interrupt Status Mask bit : I/O read FIFO underflow */ -#define IF_SPI_HISM_IO_RD_FIFO_UNDERFLOW (1<<6) -/* Host Interrupt Status Mask bit : Data write FIFO overflow */ -#define IF_SPI_HISM_DATA_WR_FIFO_OVERFLOW (1<<7) -/* Host Interrupt Status Mask bit : Data write FIFO underflow */ -#define IF_SPI_HISM_DATA_RD_FIFO_UNDERFLOW (1<<8) -/* Host Interrupt Status Mask bit : Command write FIFO overflow */ -#define IF_SPI_HISM_CMD_WR_FIFO_OVERFLOW (1<<9) -/* Host Interrupt Status Mask bit : Command write FIFO underflow */ -#define IF_SPI_HISM_CMD_RD_FIFO_UNDERFLOW (1<<10) - -/***************** IF_SPI_SPU_BUS_MODE_REG *****************/ -/* SCK edge on which the WLAN module outputs data on MISO */ -#define IF_SPI_BUS_MODE_SPI_CLOCK_PHASE_FALLING 0x8 -#define IF_SPI_BUS_MODE_SPI_CLOCK_PHASE_RISING 0x0 - -/* In a SPU read operation, there is a delay between writing the SPU - * register name and getting back data from the WLAN module. - * This can be specified in terms of nanoseconds or in terms of dummy - * clock cycles which the master must output before receiving a response. */ -#define IF_SPI_BUS_MODE_DELAY_METHOD_DUMMY_CLOCK 0x4 -#define IF_SPI_BUS_MODE_DELAY_METHOD_TIMED 0x0 - -/* Some different modes of SPI operation */ -#define IF_SPI_BUS_MODE_8_BIT_ADDRESS_16_BIT_DATA 0x00 -#define IF_SPI_BUS_MODE_8_BIT_ADDRESS_32_BIT_DATA 0x01 -#define IF_SPI_BUS_MODE_16_BIT_ADDRESS_16_BIT_DATA 0x02 -#define IF_SPI_BUS_MODE_16_BIT_ADDRESS_32_BIT_DATA 0x03 - -#endif diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c deleted file mode 100644 index 27980778d992..000000000000 --- a/drivers/net/wireless/libertas/if_usb.c +++ /dev/null @@ -1,1021 +0,0 @@ -/* - * This file contains functions used in USB interface module. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_OLPC -#include -#endif - -#define DRV_NAME "usb8xxx" - -#include "host.h" -#include "decl.h" -#include "defs.h" -#include "dev.h" -#include "cmd.h" -#include "if_usb.h" - -#define INSANEDEBUG 0 -#define lbs_deb_usb2(...) do { if (INSANEDEBUG) lbs_deb_usbd(__VA_ARGS__); } while (0) - -#define MESSAGE_HEADER_LEN 4 - -MODULE_FIRMWARE("libertas/usb8388_v9.bin"); -MODULE_FIRMWARE("libertas/usb8388_v5.bin"); -MODULE_FIRMWARE("libertas/usb8388.bin"); -MODULE_FIRMWARE("libertas/usb8682.bin"); -MODULE_FIRMWARE("usb8388.bin"); - -enum { - MODEL_UNKNOWN = 0x0, - MODEL_8388 = 0x1, - MODEL_8682 = 0x2 -}; - -/* table of firmware file names */ -static const struct lbs_fw_table fw_table[] = { - { MODEL_8388, "libertas/usb8388_olpc.bin", NULL }, - { MODEL_8388, "libertas/usb8388_v9.bin", NULL }, - { MODEL_8388, "libertas/usb8388_v5.bin", NULL }, - { MODEL_8388, "libertas/usb8388.bin", NULL }, - { MODEL_8388, "usb8388.bin", NULL }, - { MODEL_8682, "libertas/usb8682.bin", NULL } -}; - -static struct usb_device_id if_usb_table[] = { - /* Enter the device signature inside */ - { USB_DEVICE(0x1286, 0x2001), .driver_info = MODEL_8388 }, - { USB_DEVICE(0x05a3, 0x8388), .driver_info = MODEL_8388 }, - {} /* Terminating entry */ -}; - -MODULE_DEVICE_TABLE(usb, if_usb_table); - -static void if_usb_receive(struct urb *urb); -static void if_usb_receive_fwload(struct urb *urb); -static void if_usb_prog_firmware(struct lbs_private *priv, int ret, - const struct firmware *fw, - const struct firmware *unused); -static int if_usb_host_to_card(struct lbs_private *priv, uint8_t type, - uint8_t *payload, uint16_t nb); -static int usb_tx_block(struct if_usb_card *cardp, uint8_t *payload, - uint16_t nb); -static void if_usb_free(struct if_usb_card *cardp); -static int if_usb_submit_rx_urb(struct if_usb_card *cardp); -static int if_usb_reset_device(struct if_usb_card *cardp); - -/** - * if_usb_write_bulk_callback - callback function to handle the status - * of the URB - * @urb: pointer to &urb structure - * returns: N/A - */ -static void if_usb_write_bulk_callback(struct urb *urb) -{ - struct if_usb_card *cardp = (struct if_usb_card *) urb->context; - - /* handle the transmission complete validations */ - - if (urb->status == 0) { - struct lbs_private *priv = cardp->priv; - - lbs_deb_usb2(&urb->dev->dev, "URB status is successful\n"); - lbs_deb_usb2(&urb->dev->dev, "Actual length transmitted %d\n", - urb->actual_length); - - /* Boot commands such as UPDATE_FW and UPDATE_BOOT2 are not - * passed up to the lbs level. - */ - if (priv && priv->dnld_sent != DNLD_BOOTCMD_SENT) - lbs_host_to_card_done(priv); - } else { - /* print the failure status number for debug */ - pr_info("URB in failure status: %d\n", urb->status); - } -} - -/** - * if_usb_free - free tx/rx urb, skb and rx buffer - * @cardp: pointer to &if_usb_card - * returns: N/A - */ -static void if_usb_free(struct if_usb_card *cardp) -{ - lbs_deb_enter(LBS_DEB_USB); - - /* Unlink tx & rx urb */ - usb_kill_urb(cardp->tx_urb); - usb_kill_urb(cardp->rx_urb); - - usb_free_urb(cardp->tx_urb); - cardp->tx_urb = NULL; - - usb_free_urb(cardp->rx_urb); - cardp->rx_urb = NULL; - - kfree(cardp->ep_out_buf); - cardp->ep_out_buf = NULL; - - lbs_deb_leave(LBS_DEB_USB); -} - -static void if_usb_setup_firmware(struct lbs_private *priv) -{ - struct if_usb_card *cardp = priv->card; - struct cmd_ds_set_boot2_ver b2_cmd; - struct cmd_ds_802_11_fw_wake_method wake_method; - - b2_cmd.hdr.size = cpu_to_le16(sizeof(b2_cmd)); - b2_cmd.action = 0; - b2_cmd.version = cardp->boot2_version; - - if (lbs_cmd_with_response(priv, CMD_SET_BOOT2_VER, &b2_cmd)) - lbs_deb_usb("Setting boot2 version failed\n"); - - priv->wol_gpio = 2; /* Wake via GPIO2... */ - priv->wol_gap = 20; /* ... after 20ms */ - lbs_host_sleep_cfg(priv, EHS_WAKE_ON_UNICAST_DATA, - (struct wol_config *) NULL); - - wake_method.hdr.size = cpu_to_le16(sizeof(wake_method)); - wake_method.action = cpu_to_le16(CMD_ACT_GET); - if (lbs_cmd_with_response(priv, CMD_802_11_FW_WAKE_METHOD, &wake_method)) { - netdev_info(priv->dev, "Firmware does not seem to support PS mode\n"); - priv->fwcapinfo &= ~FW_CAPINFO_PS; - } else { - if (le16_to_cpu(wake_method.method) == CMD_WAKE_METHOD_COMMAND_INT) { - lbs_deb_usb("Firmware seems to support PS with wake-via-command\n"); - } else { - /* The versions which boot up this way don't seem to - work even if we set it to the command interrupt */ - priv->fwcapinfo &= ~FW_CAPINFO_PS; - netdev_info(priv->dev, - "Firmware doesn't wake via command interrupt; disabling PS mode\n"); - } - } -} - -static void if_usb_fw_timeo(unsigned long priv) -{ - struct if_usb_card *cardp = (void *)priv; - - if (cardp->fwdnldover) { - lbs_deb_usb("Download complete, no event. Assuming success\n"); - } else { - pr_err("Download timed out\n"); - cardp->surprise_removed = 1; - } - wake_up(&cardp->fw_wq); -} - -#ifdef CONFIG_OLPC -static void if_usb_reset_olpc_card(struct lbs_private *priv) -{ - printk(KERN_CRIT "Resetting OLPC wireless via EC...\n"); - olpc_ec_cmd(0x25, NULL, 0, NULL, 0); -} -#endif - -/** - * if_usb_probe - sets the configuration values - * @intf: &usb_interface pointer - * @id: pointer to usb_device_id - * returns: 0 on success, error code on failure - */ -static int if_usb_probe(struct usb_interface *intf, - const struct usb_device_id *id) -{ - struct usb_device *udev; - struct usb_host_interface *iface_desc; - struct usb_endpoint_descriptor *endpoint; - struct lbs_private *priv; - struct if_usb_card *cardp; - int r = -ENOMEM; - int i; - - udev = interface_to_usbdev(intf); - - cardp = kzalloc(sizeof(struct if_usb_card), GFP_KERNEL); - if (!cardp) - goto error; - - setup_timer(&cardp->fw_timeout, if_usb_fw_timeo, (unsigned long)cardp); - init_waitqueue_head(&cardp->fw_wq); - - cardp->udev = udev; - cardp->model = (uint32_t) id->driver_info; - iface_desc = intf->cur_altsetting; - - lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X" - " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n", - le16_to_cpu(udev->descriptor.bcdUSB), - udev->descriptor.bDeviceClass, - udev->descriptor.bDeviceSubClass, - udev->descriptor.bDeviceProtocol); - - for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { - endpoint = &iface_desc->endpoint[i].desc; - if (usb_endpoint_is_bulk_in(endpoint)) { - cardp->ep_in_size = le16_to_cpu(endpoint->wMaxPacketSize); - cardp->ep_in = usb_endpoint_num(endpoint); - - lbs_deb_usbd(&udev->dev, "in_endpoint = %d\n", cardp->ep_in); - lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n", cardp->ep_in_size); - - } else if (usb_endpoint_is_bulk_out(endpoint)) { - cardp->ep_out_size = le16_to_cpu(endpoint->wMaxPacketSize); - cardp->ep_out = usb_endpoint_num(endpoint); - - lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n", cardp->ep_out); - lbs_deb_usbd(&udev->dev, "Bulk out size is %d\n", cardp->ep_out_size); - } - } - if (!cardp->ep_out_size || !cardp->ep_in_size) { - lbs_deb_usbd(&udev->dev, "Endpoints not found\n"); - goto dealloc; - } - if (!(cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL))) { - lbs_deb_usbd(&udev->dev, "Rx URB allocation failed\n"); - goto dealloc; - } - if (!(cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL))) { - lbs_deb_usbd(&udev->dev, "Tx URB allocation failed\n"); - goto dealloc; - } - cardp->ep_out_buf = kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE, GFP_KERNEL); - if (!cardp->ep_out_buf) { - lbs_deb_usbd(&udev->dev, "Could not allocate buffer\n"); - goto dealloc; - } - - if (!(priv = lbs_add_card(cardp, &intf->dev))) - goto err_add_card; - - cardp->priv = priv; - - priv->hw_host_to_card = if_usb_host_to_card; - priv->enter_deep_sleep = NULL; - priv->exit_deep_sleep = NULL; - priv->reset_deep_sleep_wakeup = NULL; -#ifdef CONFIG_OLPC - if (machine_is_olpc()) - priv->reset_card = if_usb_reset_olpc_card; -#endif - - cardp->boot2_version = udev->descriptor.bcdDevice; - - usb_get_dev(udev); - usb_set_intfdata(intf, cardp); - - r = lbs_get_firmware_async(priv, &udev->dev, cardp->model, - fw_table, if_usb_prog_firmware); - if (r) - goto err_get_fw; - - return 0; - -err_get_fw: - lbs_remove_card(priv); -err_add_card: - if_usb_reset_device(cardp); -dealloc: - if_usb_free(cardp); - -error: - return r; -} - -/** - * if_usb_disconnect - free resource and cleanup - * @intf: USB interface structure - * returns: N/A - */ -static void if_usb_disconnect(struct usb_interface *intf) -{ - struct if_usb_card *cardp = usb_get_intfdata(intf); - struct lbs_private *priv = cardp->priv; - - lbs_deb_enter(LBS_DEB_MAIN); - - cardp->surprise_removed = 1; - - if (priv) { - lbs_stop_card(priv); - lbs_remove_card(priv); - } - - /* Unlink and free urb */ - if_usb_free(cardp); - - usb_set_intfdata(intf, NULL); - usb_put_dev(interface_to_usbdev(intf)); - - lbs_deb_leave(LBS_DEB_MAIN); -} - -/** - * if_usb_send_fw_pkt - download FW - * @cardp: pointer to &struct if_usb_card - * returns: 0 - */ -static int if_usb_send_fw_pkt(struct if_usb_card *cardp) -{ - struct fwdata *fwdata = cardp->ep_out_buf; - const uint8_t *firmware = cardp->fw->data; - - /* If we got a CRC failure on the last block, back - up and retry it */ - if (!cardp->CRC_OK) { - cardp->totalbytes = cardp->fwlastblksent; - cardp->fwseqnum--; - } - - lbs_deb_usb2(&cardp->udev->dev, "totalbytes = %d\n", - cardp->totalbytes); - - /* struct fwdata (which we sent to the card) has an - extra __le32 field in between the header and the data, - which is not in the struct fwheader in the actual - firmware binary. Insert the seqnum in the middle... */ - memcpy(&fwdata->hdr, &firmware[cardp->totalbytes], - sizeof(struct fwheader)); - - cardp->fwlastblksent = cardp->totalbytes; - cardp->totalbytes += sizeof(struct fwheader); - - memcpy(fwdata->data, &firmware[cardp->totalbytes], - le32_to_cpu(fwdata->hdr.datalength)); - - lbs_deb_usb2(&cardp->udev->dev, "Data length = %d\n", - le32_to_cpu(fwdata->hdr.datalength)); - - fwdata->seqnum = cpu_to_le32(++cardp->fwseqnum); - cardp->totalbytes += le32_to_cpu(fwdata->hdr.datalength); - - usb_tx_block(cardp, cardp->ep_out_buf, sizeof(struct fwdata) + - le32_to_cpu(fwdata->hdr.datalength)); - - if (fwdata->hdr.dnldcmd == cpu_to_le32(FW_HAS_DATA_TO_RECV)) { - lbs_deb_usb2(&cardp->udev->dev, "There are data to follow\n"); - lbs_deb_usb2(&cardp->udev->dev, "seqnum = %d totalbytes = %d\n", - cardp->fwseqnum, cardp->totalbytes); - } else if (fwdata->hdr.dnldcmd == cpu_to_le32(FW_HAS_LAST_BLOCK)) { - lbs_deb_usb2(&cardp->udev->dev, "Host has finished FW downloading\n"); - lbs_deb_usb2(&cardp->udev->dev, "Donwloading FW JUMP BLOCK\n"); - - cardp->fwfinalblk = 1; - } - - lbs_deb_usb2(&cardp->udev->dev, "Firmware download done; size %d\n", - cardp->totalbytes); - - return 0; -} - -static int if_usb_reset_device(struct if_usb_card *cardp) -{ - struct cmd_header *cmd = cardp->ep_out_buf + 4; - int ret; - - lbs_deb_enter(LBS_DEB_USB); - - *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST); - - cmd->command = cpu_to_le16(CMD_802_11_RESET); - cmd->size = cpu_to_le16(sizeof(cmd)); - cmd->result = cpu_to_le16(0); - cmd->seqnum = cpu_to_le16(0x5a5a); - usb_tx_block(cardp, cardp->ep_out_buf, 4 + sizeof(struct cmd_header)); - - msleep(100); - ret = usb_reset_device(cardp->udev); - msleep(100); - -#ifdef CONFIG_OLPC - if (ret && machine_is_olpc()) - if_usb_reset_olpc_card(NULL); -#endif - - lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret); - - return ret; -} - -/** - * usb_tx_block - transfer the data to the device - * @cardp: pointer to &struct if_usb_card - * @payload: pointer to payload data - * @nb: data length - * returns: 0 for success or negative error code - */ -static int usb_tx_block(struct if_usb_card *cardp, uint8_t *payload, uint16_t nb) -{ - int ret; - - /* check if device is removed */ - if (cardp->surprise_removed) { - lbs_deb_usbd(&cardp->udev->dev, "Device removed\n"); - ret = -ENODEV; - goto tx_ret; - } - - usb_fill_bulk_urb(cardp->tx_urb, cardp->udev, - usb_sndbulkpipe(cardp->udev, - cardp->ep_out), - payload, nb, if_usb_write_bulk_callback, cardp); - - cardp->tx_urb->transfer_flags |= URB_ZERO_PACKET; - - if ((ret = usb_submit_urb(cardp->tx_urb, GFP_ATOMIC))) { - lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb failed: %d\n", ret); - } else { - lbs_deb_usb2(&cardp->udev->dev, "usb_submit_urb success\n"); - ret = 0; - } - -tx_ret: - return ret; -} - -static int __if_usb_submit_rx_urb(struct if_usb_card *cardp, - void (*callbackfn)(struct urb *urb)) -{ - struct sk_buff *skb; - int ret = -1; - - if (!(skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE))) { - pr_err("No free skb\n"); - goto rx_ret; - } - - cardp->rx_skb = skb; - - /* Fill the receive configuration URB and initialise the Rx call back */ - usb_fill_bulk_urb(cardp->rx_urb, cardp->udev, - usb_rcvbulkpipe(cardp->udev, cardp->ep_in), - skb->data + IPFIELD_ALIGN_OFFSET, - MRVDRV_ETH_RX_PACKET_BUFFER_SIZE, callbackfn, - cardp); - - cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET; - - lbs_deb_usb2(&cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb); - if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) { - lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB failed: %d\n", ret); - kfree_skb(skb); - cardp->rx_skb = NULL; - ret = -1; - } else { - lbs_deb_usb2(&cardp->udev->dev, "Submit Rx URB success\n"); - ret = 0; - } - -rx_ret: - return ret; -} - -static int if_usb_submit_rx_urb_fwload(struct if_usb_card *cardp) -{ - return __if_usb_submit_rx_urb(cardp, &if_usb_receive_fwload); -} - -static int if_usb_submit_rx_urb(struct if_usb_card *cardp) -{ - return __if_usb_submit_rx_urb(cardp, &if_usb_receive); -} - -static void if_usb_receive_fwload(struct urb *urb) -{ - struct if_usb_card *cardp = urb->context; - struct sk_buff *skb = cardp->rx_skb; - struct fwsyncheader *syncfwheader; - struct bootcmdresp bootcmdresp; - - if (urb->status) { - lbs_deb_usbd(&cardp->udev->dev, - "URB status is failed during fw load\n"); - kfree_skb(skb); - return; - } - - if (cardp->fwdnldover) { - __le32 *tmp = (__le32 *)(skb->data + IPFIELD_ALIGN_OFFSET); - - if (tmp[0] == cpu_to_le32(CMD_TYPE_INDICATION) && - tmp[1] == cpu_to_le32(MACREG_INT_CODE_FIRMWARE_READY)) { - pr_info("Firmware ready event received\n"); - wake_up(&cardp->fw_wq); - } else { - lbs_deb_usb("Waiting for confirmation; got %x %x\n", - le32_to_cpu(tmp[0]), le32_to_cpu(tmp[1])); - if_usb_submit_rx_urb_fwload(cardp); - } - kfree_skb(skb); - return; - } - if (cardp->bootcmdresp <= 0) { - memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET, - sizeof(bootcmdresp)); - - if (le16_to_cpu(cardp->udev->descriptor.bcdDevice) < 0x3106) { - kfree_skb(skb); - if_usb_submit_rx_urb_fwload(cardp); - cardp->bootcmdresp = BOOT_CMD_RESP_OK; - lbs_deb_usbd(&cardp->udev->dev, - "Received valid boot command response\n"); - return; - } - if (bootcmdresp.magic != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) { - if (bootcmdresp.magic == cpu_to_le32(CMD_TYPE_REQUEST) || - bootcmdresp.magic == cpu_to_le32(CMD_TYPE_DATA) || - bootcmdresp.magic == cpu_to_le32(CMD_TYPE_INDICATION)) { - if (!cardp->bootcmdresp) - pr_info("Firmware already seems alive; resetting\n"); - cardp->bootcmdresp = -1; - } else { - pr_info("boot cmd response wrong magic number (0x%x)\n", - le32_to_cpu(bootcmdresp.magic)); - } - } else if ((bootcmdresp.cmd != BOOT_CMD_FW_BY_USB) && - (bootcmdresp.cmd != BOOT_CMD_UPDATE_FW) && - (bootcmdresp.cmd != BOOT_CMD_UPDATE_BOOT2)) { - pr_info("boot cmd response cmd_tag error (%d)\n", - bootcmdresp.cmd); - } else if (bootcmdresp.result != BOOT_CMD_RESP_OK) { - pr_info("boot cmd response result error (%d)\n", - bootcmdresp.result); - } else { - cardp->bootcmdresp = 1; - lbs_deb_usbd(&cardp->udev->dev, - "Received valid boot command response\n"); - } - kfree_skb(skb); - if_usb_submit_rx_urb_fwload(cardp); - return; - } - - syncfwheader = kmemdup(skb->data + IPFIELD_ALIGN_OFFSET, - sizeof(struct fwsyncheader), GFP_ATOMIC); - if (!syncfwheader) { - lbs_deb_usbd(&cardp->udev->dev, "Failure to allocate syncfwheader\n"); - kfree_skb(skb); - return; - } - - if (!syncfwheader->cmd) { - lbs_deb_usb2(&cardp->udev->dev, "FW received Blk with correct CRC\n"); - lbs_deb_usb2(&cardp->udev->dev, "FW received Blk seqnum = %d\n", - le32_to_cpu(syncfwheader->seqnum)); - cardp->CRC_OK = 1; - } else { - lbs_deb_usbd(&cardp->udev->dev, "FW received Blk with CRC error\n"); - cardp->CRC_OK = 0; - } - - kfree_skb(skb); - - /* Give device 5s to either write firmware to its RAM or eeprom */ - mod_timer(&cardp->fw_timeout, jiffies + (HZ*5)); - - if (cardp->fwfinalblk) { - cardp->fwdnldover = 1; - goto exit; - } - - if_usb_send_fw_pkt(cardp); - - exit: - if_usb_submit_rx_urb_fwload(cardp); - - kfree(syncfwheader); -} - -#define MRVDRV_MIN_PKT_LEN 30 - -static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb, - struct if_usb_card *cardp, - struct lbs_private *priv) -{ - if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + MESSAGE_HEADER_LEN - || recvlength < MRVDRV_MIN_PKT_LEN) { - lbs_deb_usbd(&cardp->udev->dev, "Packet length is Invalid\n"); - kfree_skb(skb); - return; - } - - skb_reserve(skb, IPFIELD_ALIGN_OFFSET); - skb_put(skb, recvlength); - skb_pull(skb, MESSAGE_HEADER_LEN); - - lbs_process_rxed_packet(priv, skb); -} - -static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff, - struct sk_buff *skb, - struct if_usb_card *cardp, - struct lbs_private *priv) -{ - u8 i; - - if (recvlength > LBS_CMD_BUFFER_SIZE) { - lbs_deb_usbd(&cardp->udev->dev, - "The receive buffer is too large\n"); - kfree_skb(skb); - return; - } - - BUG_ON(!in_interrupt()); - - spin_lock(&priv->driver_lock); - - i = (priv->resp_idx == 0) ? 1 : 0; - BUG_ON(priv->resp_len[i]); - priv->resp_len[i] = (recvlength - MESSAGE_HEADER_LEN); - memcpy(priv->resp_buf[i], recvbuff + MESSAGE_HEADER_LEN, - priv->resp_len[i]); - kfree_skb(skb); - lbs_notify_command_response(priv, i); - - spin_unlock(&priv->driver_lock); - - lbs_deb_usbd(&cardp->udev->dev, - "Wake up main thread to handle cmd response\n"); -} - -/** - * if_usb_receive - read the packet into the upload buffer, - * wake up the main thread and initialise the Rx callack - * - * @urb: pointer to &struct urb - * returns: N/A - */ -static void if_usb_receive(struct urb *urb) -{ - struct if_usb_card *cardp = urb->context; - struct sk_buff *skb = cardp->rx_skb; - struct lbs_private *priv = cardp->priv; - int recvlength = urb->actual_length; - uint8_t *recvbuff = NULL; - uint32_t recvtype = 0; - __le32 *pkt = (__le32 *)(skb->data + IPFIELD_ALIGN_OFFSET); - uint32_t event; - - lbs_deb_enter(LBS_DEB_USB); - - if (recvlength) { - if (urb->status) { - lbs_deb_usbd(&cardp->udev->dev, "RX URB failed: %d\n", - urb->status); - kfree_skb(skb); - goto setup_for_next; - } - - recvbuff = skb->data + IPFIELD_ALIGN_OFFSET; - recvtype = le32_to_cpu(pkt[0]); - lbs_deb_usbd(&cardp->udev->dev, - "Recv length = 0x%x, Recv type = 0x%X\n", - recvlength, recvtype); - } else if (urb->status) { - kfree_skb(skb); - goto rx_exit; - } - - switch (recvtype) { - case CMD_TYPE_DATA: - process_cmdtypedata(recvlength, skb, cardp, priv); - break; - - case CMD_TYPE_REQUEST: - process_cmdrequest(recvlength, recvbuff, skb, cardp, priv); - break; - - case CMD_TYPE_INDICATION: - /* Event handling */ - event = le32_to_cpu(pkt[1]); - lbs_deb_usbd(&cardp->udev->dev, "**EVENT** 0x%X\n", event); - kfree_skb(skb); - - /* Icky undocumented magic special case */ - if (event & 0xffff0000) { - u32 trycount = (event & 0xffff0000) >> 16; - - lbs_send_tx_feedback(priv, trycount); - } else - lbs_queue_event(priv, event & 0xFF); - break; - - default: - lbs_deb_usbd(&cardp->udev->dev, "Unknown command type 0x%X\n", - recvtype); - kfree_skb(skb); - break; - } - -setup_for_next: - if_usb_submit_rx_urb(cardp); -rx_exit: - lbs_deb_leave(LBS_DEB_USB); -} - -/** - * if_usb_host_to_card - downloads data to FW - * @priv: pointer to &struct lbs_private structure - * @type: type of data - * @payload: pointer to data buffer - * @nb: number of bytes - * returns: 0 for success or negative error code - */ -static int if_usb_host_to_card(struct lbs_private *priv, uint8_t type, - uint8_t *payload, uint16_t nb) -{ - struct if_usb_card *cardp = priv->card; - - lbs_deb_usbd(&cardp->udev->dev,"*** type = %u\n", type); - lbs_deb_usbd(&cardp->udev->dev,"size after = %d\n", nb); - - if (type == MVMS_CMD) { - *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST); - priv->dnld_sent = DNLD_CMD_SENT; - } else { - *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_DATA); - priv->dnld_sent = DNLD_DATA_SENT; - } - - memcpy((cardp->ep_out_buf + MESSAGE_HEADER_LEN), payload, nb); - - return usb_tx_block(cardp, cardp->ep_out_buf, nb + MESSAGE_HEADER_LEN); -} - -/** - * if_usb_issue_boot_command - issues Boot command to the Boot2 code - * @cardp: pointer to &if_usb_card - * @ivalue: 1:Boot from FW by USB-Download - * 2:Boot from FW in EEPROM - * returns: 0 for success or negative error code - */ -static int if_usb_issue_boot_command(struct if_usb_card *cardp, int ivalue) -{ - struct bootcmd *bootcmd = cardp->ep_out_buf; - - /* Prepare command */ - bootcmd->magic = cpu_to_le32(BOOT_CMD_MAGIC_NUMBER); - bootcmd->cmd = ivalue; - memset(bootcmd->pad, 0, sizeof(bootcmd->pad)); - - /* Issue command */ - usb_tx_block(cardp, cardp->ep_out_buf, sizeof(*bootcmd)); - - return 0; -} - - -/** - * check_fwfile_format - check the validity of Boot2/FW image - * - * @data: pointer to image - * @totlen: image length - * returns: 0 (good) or 1 (failure) - */ -static int check_fwfile_format(const uint8_t *data, uint32_t totlen) -{ - uint32_t bincmd, exit; - uint32_t blksize, offset, len; - int ret; - - ret = 1; - exit = len = 0; - - do { - struct fwheader *fwh = (void *)data; - - bincmd = le32_to_cpu(fwh->dnldcmd); - blksize = le32_to_cpu(fwh->datalength); - switch (bincmd) { - case FW_HAS_DATA_TO_RECV: - offset = sizeof(struct fwheader) + blksize; - data += offset; - len += offset; - if (len >= totlen) - exit = 1; - break; - case FW_HAS_LAST_BLOCK: - exit = 1; - ret = 0; - break; - default: - exit = 1; - break; - } - } while (!exit); - - if (ret) - pr_err("firmware file format check FAIL\n"); - else - lbs_deb_fw("firmware file format check PASS\n"); - - return ret; -} - -static void if_usb_prog_firmware(struct lbs_private *priv, int ret, - const struct firmware *fw, - const struct firmware *unused) -{ - struct if_usb_card *cardp = priv->card; - int i = 0; - static int reset_count = 10; - - lbs_deb_enter(LBS_DEB_USB); - - if (ret) { - pr_err("failed to find firmware (%d)\n", ret); - goto done; - } - - cardp->fw = fw; - if (check_fwfile_format(cardp->fw->data, cardp->fw->size)) { - ret = -EINVAL; - goto release_fw; - } - - /* Cancel any pending usb business */ - usb_kill_urb(cardp->rx_urb); - usb_kill_urb(cardp->tx_urb); - - cardp->fwlastblksent = 0; - cardp->fwdnldover = 0; - cardp->totalbytes = 0; - cardp->fwfinalblk = 0; - cardp->bootcmdresp = 0; - -restart: - if (if_usb_submit_rx_urb_fwload(cardp) < 0) { - lbs_deb_usbd(&cardp->udev->dev, "URB submission is failed\n"); - ret = -EIO; - goto release_fw; - } - - cardp->bootcmdresp = 0; - do { - int j = 0; - i++; - if_usb_issue_boot_command(cardp, BOOT_CMD_FW_BY_USB); - /* wait for command response */ - do { - j++; - msleep_interruptible(100); - } while (cardp->bootcmdresp == 0 && j < 10); - } while (cardp->bootcmdresp == 0 && i < 5); - - if (cardp->bootcmdresp == BOOT_CMD_RESP_NOT_SUPPORTED) { - /* Return to normal operation */ - ret = -EOPNOTSUPP; - usb_kill_urb(cardp->rx_urb); - usb_kill_urb(cardp->tx_urb); - if (if_usb_submit_rx_urb(cardp) < 0) - ret = -EIO; - goto release_fw; - } else if (cardp->bootcmdresp <= 0) { - if (--reset_count >= 0) { - if_usb_reset_device(cardp); - goto restart; - } - ret = -EIO; - goto release_fw; - } - - i = 0; - - cardp->totalbytes = 0; - cardp->fwlastblksent = 0; - cardp->CRC_OK = 1; - cardp->fwdnldover = 0; - cardp->fwseqnum = -1; - cardp->totalbytes = 0; - cardp->fwfinalblk = 0; - - /* Send the first firmware packet... */ - if_usb_send_fw_pkt(cardp); - - /* ... and wait for the process to complete */ - wait_event_interruptible(cardp->fw_wq, cardp->surprise_removed || cardp->fwdnldover); - - del_timer_sync(&cardp->fw_timeout); - usb_kill_urb(cardp->rx_urb); - - if (!cardp->fwdnldover) { - pr_info("failed to load fw, resetting device!\n"); - if (--reset_count >= 0) { - if_usb_reset_device(cardp); - goto restart; - } - - pr_info("FW download failure, time = %d ms\n", i * 100); - ret = -EIO; - goto release_fw; - } - - cardp->priv->fw_ready = 1; - if_usb_submit_rx_urb(cardp); - - if (lbs_start_card(priv)) - goto release_fw; - - if_usb_setup_firmware(priv); - - /* - * EHS_REMOVE_WAKEUP is not supported on all versions of the firmware. - */ - priv->wol_criteria = EHS_REMOVE_WAKEUP; - if (lbs_host_sleep_cfg(priv, priv->wol_criteria, NULL)) - priv->ehs_remove_supported = false; - - release_fw: - release_firmware(cardp->fw); - cardp->fw = NULL; - - done: - lbs_deb_leave(LBS_DEB_USB); -} - - -#ifdef CONFIG_PM -static int if_usb_suspend(struct usb_interface *intf, pm_message_t message) -{ - struct if_usb_card *cardp = usb_get_intfdata(intf); - struct lbs_private *priv = cardp->priv; - int ret; - - lbs_deb_enter(LBS_DEB_USB); - - if (priv->psstate != PS_STATE_FULL_POWER) { - ret = -1; - goto out; - } - -#ifdef CONFIG_OLPC - if (machine_is_olpc()) { - if (priv->wol_criteria == EHS_REMOVE_WAKEUP) - olpc_ec_wakeup_clear(EC_SCI_SRC_WLAN); - else - olpc_ec_wakeup_set(EC_SCI_SRC_WLAN); - } -#endif - - ret = lbs_suspend(priv); - if (ret) - goto out; - - /* Unlink tx & rx urb */ - usb_kill_urb(cardp->tx_urb); - usb_kill_urb(cardp->rx_urb); - - out: - lbs_deb_leave(LBS_DEB_USB); - return ret; -} - -static int if_usb_resume(struct usb_interface *intf) -{ - struct if_usb_card *cardp = usb_get_intfdata(intf); - struct lbs_private *priv = cardp->priv; - - lbs_deb_enter(LBS_DEB_USB); - - if_usb_submit_rx_urb(cardp); - - lbs_resume(priv); - - lbs_deb_leave(LBS_DEB_USB); - return 0; -} -#else -#define if_usb_suspend NULL -#define if_usb_resume NULL -#endif - -static struct usb_driver if_usb_driver = { - .name = DRV_NAME, - .probe = if_usb_probe, - .disconnect = if_usb_disconnect, - .id_table = if_usb_table, - .suspend = if_usb_suspend, - .resume = if_usb_resume, - .reset_resume = if_usb_resume, - .disable_hub_initiated_lpm = 1, -}; - -module_usb_driver(if_usb_driver); - -MODULE_DESCRIPTION("8388 USB WLAN Driver"); -MODULE_AUTHOR("Marvell International Ltd. and Red Hat, Inc."); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h deleted file mode 100644 index 6e42eac331de..000000000000 --- a/drivers/net/wireless/libertas/if_usb.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef _LBS_IF_USB_H -#define _LBS_IF_USB_H - -#include -#include - -struct lbs_private; - -/* - * This file contains definition for USB interface. - */ -#define CMD_TYPE_REQUEST 0xF00DFACE -#define CMD_TYPE_DATA 0xBEADC0DE -#define CMD_TYPE_INDICATION 0xBEEFFACE - -#define IPFIELD_ALIGN_OFFSET 2 - -#define BOOT_CMD_FW_BY_USB 0x01 -#define BOOT_CMD_FW_IN_EEPROM 0x02 -#define BOOT_CMD_UPDATE_BOOT2 0x03 -#define BOOT_CMD_UPDATE_FW 0x04 -#define BOOT_CMD_MAGIC_NUMBER 0x4C56524D /* LVRM */ - -struct bootcmd -{ - __le32 magic; - uint8_t cmd; - uint8_t pad[11]; -}; - -#define BOOT_CMD_RESP_OK 0x0001 -#define BOOT_CMD_RESP_FAIL 0x0000 -#define BOOT_CMD_RESP_NOT_SUPPORTED 0x0002 - -struct bootcmdresp -{ - __le32 magic; - uint8_t cmd; - uint8_t result; - uint8_t pad[2]; -}; - -/* USB card description structure*/ -struct if_usb_card { - struct usb_device *udev; - uint32_t model; /* MODEL_* */ - struct urb *rx_urb, *tx_urb; - struct lbs_private *priv; - - struct sk_buff *rx_skb; - - uint8_t ep_in; - uint8_t ep_out; - - /* bootcmdresp == 0 means command is pending - * bootcmdresp < 0 means error - * bootcmdresp > 0 is a BOOT_CMD_RESP_* from firmware - */ - int8_t bootcmdresp; - - int ep_in_size; - - void *ep_out_buf; - int ep_out_size; - - const struct firmware *fw; - struct timer_list fw_timeout; - wait_queue_head_t fw_wq; - uint32_t fwseqnum; - uint32_t totalbytes; - uint32_t fwlastblksent; - uint8_t CRC_OK; - uint8_t fwdnldover; - uint8_t fwfinalblk; - uint8_t surprise_removed; - - __le16 boot2_version; -}; - -/* fwheader */ -struct fwheader { - __le32 dnldcmd; - __le32 baseaddr; - __le32 datalength; - __le32 CRC; -}; - -#define FW_MAX_DATA_BLK_SIZE 600 -/* FWData */ -struct fwdata { - struct fwheader hdr; - __le32 seqnum; - uint8_t data[0]; -}; - -/* fwsyncheader */ -struct fwsyncheader { - __le32 cmd; - __le32 seqnum; -}; - -#define FW_HAS_DATA_TO_RECV 0x00000001 -#define FW_HAS_LAST_BLOCK 0x00000004 - - -#endif diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c deleted file mode 100644 index 0c02f0483d1f..000000000000 --- a/drivers/net/wireless/libertas/main.c +++ /dev/null @@ -1,1225 +0,0 @@ -/* - * This file contains the major functions in WLAN - * driver. It includes init, exit, open, close and main - * thread etc.. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "host.h" -#include "decl.h" -#include "dev.h" -#include "cfg.h" -#include "debugfs.h" -#include "cmd.h" -#include "mesh.h" - -#define DRIVER_RELEASE_VERSION "323.p0" -const char lbs_driver_version[] = "COMM-USB8388-" DRIVER_RELEASE_VERSION -#ifdef DEBUG - "-dbg" -#endif - ""; - - -/* Module parameters */ -unsigned int lbs_debug; -EXPORT_SYMBOL_GPL(lbs_debug); -module_param_named(libertas_debug, lbs_debug, int, 0644); - -unsigned int lbs_disablemesh; -EXPORT_SYMBOL_GPL(lbs_disablemesh); -module_param_named(libertas_disablemesh, lbs_disablemesh, int, 0644); - - -/* - * This global structure is used to send the confirm_sleep command as - * fast as possible down to the firmware. - */ -struct cmd_confirm_sleep confirm_sleep; - - -/* - * the table to keep region code - */ -u16 lbs_region_code_to_index[MRVDRV_MAX_REGION_CODE] = - { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 }; - -/* - * FW rate table. FW refers to rates by their index in this table, not by the - * rate value itself. Values of 0x00 are - * reserved positions. - */ -static u8 fw_data_rates[MAX_RATES] = - { 0x02, 0x04, 0x0B, 0x16, 0x00, 0x0C, 0x12, - 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x00 -}; - -/** - * lbs_fw_index_to_data_rate - use index to get the data rate - * - * @idx: The index of data rate - * returns: data rate or 0 - */ -u32 lbs_fw_index_to_data_rate(u8 idx) -{ - if (idx >= sizeof(fw_data_rates)) - idx = 0; - return fw_data_rates[idx]; -} - -/** - * lbs_data_rate_to_fw_index - use rate to get the index - * - * @rate: data rate - * returns: index or 0 - */ -u8 lbs_data_rate_to_fw_index(u32 rate) -{ - u8 i; - - if (!rate) - return 0; - - for (i = 0; i < sizeof(fw_data_rates); i++) { - if (rate == fw_data_rates[i]) - return i; - } - return 0; -} - -int lbs_set_iface_type(struct lbs_private *priv, enum nl80211_iftype type) -{ - int ret = 0; - - switch (type) { - case NL80211_IFTYPE_MONITOR: - ret = lbs_set_monitor_mode(priv, 1); - break; - case NL80211_IFTYPE_STATION: - if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) - ret = lbs_set_monitor_mode(priv, 0); - if (!ret) - ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 1); - break; - case NL80211_IFTYPE_ADHOC: - if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) - ret = lbs_set_monitor_mode(priv, 0); - if (!ret) - ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 2); - break; - default: - ret = -ENOTSUPP; - } - return ret; -} - -int lbs_start_iface(struct lbs_private *priv) -{ - struct cmd_ds_802_11_mac_address cmd; - int ret; - - if (priv->power_restore) { - ret = priv->power_restore(priv); - if (ret) - return ret; - } - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - memcpy(cmd.macadd, priv->current_addr, ETH_ALEN); - - ret = lbs_cmd_with_response(priv, CMD_802_11_MAC_ADDRESS, &cmd); - if (ret) { - lbs_deb_net("set MAC address failed\n"); - goto err; - } - - ret = lbs_set_iface_type(priv, priv->wdev->iftype); - if (ret) { - lbs_deb_net("set iface type failed\n"); - goto err; - } - - ret = lbs_set_11d_domain_info(priv); - if (ret) { - lbs_deb_net("set 11d domain info failed\n"); - goto err; - } - - lbs_update_channel(priv); - - priv->iface_running = true; - return 0; - -err: - if (priv->power_save) - priv->power_save(priv); - return ret; -} - -/** - * lbs_dev_open - open the ethX interface - * - * @dev: A pointer to &net_device structure - * returns: 0 or -EBUSY if monitor mode active - */ -static int lbs_dev_open(struct net_device *dev) -{ - struct lbs_private *priv = dev->ml_priv; - int ret = 0; - - lbs_deb_enter(LBS_DEB_NET); - if (!priv->iface_running) { - ret = lbs_start_iface(priv); - if (ret) - goto out; - } - - spin_lock_irq(&priv->driver_lock); - - netif_carrier_off(dev); - - if (!priv->tx_pending_len) - netif_wake_queue(dev); - - spin_unlock_irq(&priv->driver_lock); - -out: - lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); - return ret; -} - -static bool lbs_command_queue_empty(struct lbs_private *priv) -{ - unsigned long flags; - bool ret; - spin_lock_irqsave(&priv->driver_lock, flags); - ret = priv->cur_cmd == NULL && list_empty(&priv->cmdpendingq); - spin_unlock_irqrestore(&priv->driver_lock, flags); - return ret; -} - -int lbs_stop_iface(struct lbs_private *priv) -{ - unsigned long flags; - int ret = 0; - - lbs_deb_enter(LBS_DEB_MAIN); - - spin_lock_irqsave(&priv->driver_lock, flags); - priv->iface_running = false; - kfree_skb(priv->currenttxskb); - priv->currenttxskb = NULL; - priv->tx_pending_len = 0; - spin_unlock_irqrestore(&priv->driver_lock, flags); - - cancel_work_sync(&priv->mcast_work); - del_timer_sync(&priv->tx_lockup_timer); - - /* Disable command processing, and wait for all commands to complete */ - lbs_deb_main("waiting for commands to complete\n"); - wait_event(priv->waitq, lbs_command_queue_empty(priv)); - lbs_deb_main("all commands completed\n"); - - if (priv->power_save) - ret = priv->power_save(priv); - - lbs_deb_leave(LBS_DEB_MAIN); - return ret; -} - -/** - * lbs_eth_stop - close the ethX interface - * - * @dev: A pointer to &net_device structure - * returns: 0 - */ -static int lbs_eth_stop(struct net_device *dev) -{ - struct lbs_private *priv = dev->ml_priv; - - lbs_deb_enter(LBS_DEB_NET); - - if (priv->connect_status == LBS_CONNECTED) - lbs_disconnect(priv, WLAN_REASON_DEAUTH_LEAVING); - - spin_lock_irq(&priv->driver_lock); - netif_stop_queue(dev); - spin_unlock_irq(&priv->driver_lock); - - lbs_update_mcast(priv); - cancel_delayed_work_sync(&priv->scan_work); - if (priv->scan_req) - lbs_scan_done(priv); - - netif_carrier_off(priv->dev); - - if (!lbs_iface_active(priv)) - lbs_stop_iface(priv); - - lbs_deb_leave(LBS_DEB_NET); - return 0; -} - -void lbs_host_to_card_done(struct lbs_private *priv) -{ - unsigned long flags; - - lbs_deb_enter(LBS_DEB_THREAD); - - spin_lock_irqsave(&priv->driver_lock, flags); - del_timer(&priv->tx_lockup_timer); - - priv->dnld_sent = DNLD_RES_RECEIVED; - - /* Wake main thread if commands are pending */ - if (!priv->cur_cmd || priv->tx_pending_len > 0) { - if (!priv->wakeup_dev_required) - wake_up(&priv->waitq); - } - - spin_unlock_irqrestore(&priv->driver_lock, flags); - lbs_deb_leave(LBS_DEB_THREAD); -} -EXPORT_SYMBOL_GPL(lbs_host_to_card_done); - -int lbs_set_mac_address(struct net_device *dev, void *addr) -{ - int ret = 0; - struct lbs_private *priv = dev->ml_priv; - struct sockaddr *phwaddr = addr; - - lbs_deb_enter(LBS_DEB_NET); - - /* - * Can only set MAC address when all interfaces are down, to be written - * to the hardware when one of them is brought up. - */ - if (lbs_iface_active(priv)) - return -EBUSY; - - /* In case it was called from the mesh device */ - dev = priv->dev; - - memcpy(priv->current_addr, phwaddr->sa_data, ETH_ALEN); - memcpy(dev->dev_addr, phwaddr->sa_data, ETH_ALEN); - if (priv->mesh_dev) - memcpy(priv->mesh_dev->dev_addr, phwaddr->sa_data, ETH_ALEN); - - lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); - return ret; -} - - -static inline int mac_in_list(unsigned char *list, int list_len, - unsigned char *mac) -{ - while (list_len) { - if (!memcmp(list, mac, ETH_ALEN)) - return 1; - list += ETH_ALEN; - list_len--; - } - return 0; -} - - -static int lbs_add_mcast_addrs(struct cmd_ds_mac_multicast_adr *cmd, - struct net_device *dev, int nr_addrs) -{ - int i = nr_addrs; - struct netdev_hw_addr *ha; - int cnt; - - if ((dev->flags & (IFF_UP|IFF_MULTICAST)) != (IFF_UP|IFF_MULTICAST)) - return nr_addrs; - - netif_addr_lock_bh(dev); - cnt = netdev_mc_count(dev); - netdev_for_each_mc_addr(ha, dev) { - if (mac_in_list(cmd->maclist, nr_addrs, ha->addr)) { - lbs_deb_net("mcast address %s:%pM skipped\n", dev->name, - ha->addr); - cnt--; - continue; - } - - if (i == MRVDRV_MAX_MULTICAST_LIST_SIZE) - break; - memcpy(&cmd->maclist[6*i], ha->addr, ETH_ALEN); - lbs_deb_net("mcast address %s:%pM added to filter\n", dev->name, - ha->addr); - i++; - cnt--; - } - netif_addr_unlock_bh(dev); - if (cnt) - return -EOVERFLOW; - - return i; -} - -void lbs_update_mcast(struct lbs_private *priv) -{ - struct cmd_ds_mac_multicast_adr mcast_cmd; - int dev_flags = 0; - int nr_addrs; - int old_mac_control = priv->mac_control; - - lbs_deb_enter(LBS_DEB_NET); - - if (netif_running(priv->dev)) - dev_flags |= priv->dev->flags; - if (priv->mesh_dev && netif_running(priv->mesh_dev)) - dev_flags |= priv->mesh_dev->flags; - - if (dev_flags & IFF_PROMISC) { - priv->mac_control |= CMD_ACT_MAC_PROMISCUOUS_ENABLE; - priv->mac_control &= ~(CMD_ACT_MAC_ALL_MULTICAST_ENABLE | - CMD_ACT_MAC_MULTICAST_ENABLE); - goto out_set_mac_control; - } else if (dev_flags & IFF_ALLMULTI) { - do_allmulti: - priv->mac_control |= CMD_ACT_MAC_ALL_MULTICAST_ENABLE; - priv->mac_control &= ~(CMD_ACT_MAC_PROMISCUOUS_ENABLE | - CMD_ACT_MAC_MULTICAST_ENABLE); - goto out_set_mac_control; - } - - /* Once for priv->dev, again for priv->mesh_dev if it exists */ - nr_addrs = lbs_add_mcast_addrs(&mcast_cmd, priv->dev, 0); - if (nr_addrs >= 0 && priv->mesh_dev) - nr_addrs = lbs_add_mcast_addrs(&mcast_cmd, priv->mesh_dev, nr_addrs); - if (nr_addrs < 0) - goto do_allmulti; - - if (nr_addrs) { - int size = offsetof(struct cmd_ds_mac_multicast_adr, - maclist[6*nr_addrs]); - - mcast_cmd.action = cpu_to_le16(CMD_ACT_SET); - mcast_cmd.hdr.size = cpu_to_le16(size); - mcast_cmd.nr_of_adrs = cpu_to_le16(nr_addrs); - - lbs_cmd_async(priv, CMD_MAC_MULTICAST_ADR, &mcast_cmd.hdr, size); - - priv->mac_control |= CMD_ACT_MAC_MULTICAST_ENABLE; - } else - priv->mac_control &= ~CMD_ACT_MAC_MULTICAST_ENABLE; - - priv->mac_control &= ~(CMD_ACT_MAC_PROMISCUOUS_ENABLE | - CMD_ACT_MAC_ALL_MULTICAST_ENABLE); - out_set_mac_control: - if (priv->mac_control != old_mac_control) - lbs_set_mac_control(priv); - - lbs_deb_leave(LBS_DEB_NET); -} - -static void lbs_set_mcast_worker(struct work_struct *work) -{ - struct lbs_private *priv = container_of(work, struct lbs_private, mcast_work); - lbs_update_mcast(priv); -} - -void lbs_set_multicast_list(struct net_device *dev) -{ - struct lbs_private *priv = dev->ml_priv; - - schedule_work(&priv->mcast_work); -} - -/** - * lbs_thread - handles the major jobs in the LBS driver. - * It handles all events generated by firmware, RX data received - * from firmware and TX data sent from kernel. - * - * @data: A pointer to &lbs_thread structure - * returns: 0 - */ -static int lbs_thread(void *data) -{ - struct net_device *dev = data; - struct lbs_private *priv = dev->ml_priv; - wait_queue_t wait; - - lbs_deb_enter(LBS_DEB_THREAD); - - init_waitqueue_entry(&wait, current); - - for (;;) { - int shouldsleep; - u8 resp_idx; - - lbs_deb_thread("1: currenttxskb %p, dnld_sent %d\n", - priv->currenttxskb, priv->dnld_sent); - - add_wait_queue(&priv->waitq, &wait); - set_current_state(TASK_INTERRUPTIBLE); - spin_lock_irq(&priv->driver_lock); - - if (kthread_should_stop()) - shouldsleep = 0; /* Bye */ - else if (priv->surpriseremoved) - shouldsleep = 1; /* We need to wait until we're _told_ to die */ - else if (priv->psstate == PS_STATE_SLEEP) - shouldsleep = 1; /* Sleep mode. Nothing we can do till it wakes */ - else if (priv->cmd_timed_out) - shouldsleep = 0; /* Command timed out. Recover */ - else if (!priv->fw_ready) - shouldsleep = 1; /* Firmware not ready. We're waiting for it */ - else if (priv->dnld_sent) - shouldsleep = 1; /* Something is en route to the device already */ - else if (priv->tx_pending_len > 0) - shouldsleep = 0; /* We've a packet to send */ - else if (priv->resp_len[priv->resp_idx]) - shouldsleep = 0; /* We have a command response */ - else if (priv->cur_cmd) - shouldsleep = 1; /* Can't send a command; one already running */ - else if (!list_empty(&priv->cmdpendingq) && - !(priv->wakeup_dev_required)) - shouldsleep = 0; /* We have a command to send */ - else if (kfifo_len(&priv->event_fifo)) - shouldsleep = 0; /* We have an event to process */ - else - shouldsleep = 1; /* No command */ - - if (shouldsleep) { - lbs_deb_thread("sleeping, connect_status %d, " - "psmode %d, psstate %d\n", - priv->connect_status, - priv->psmode, priv->psstate); - spin_unlock_irq(&priv->driver_lock); - schedule(); - } else - spin_unlock_irq(&priv->driver_lock); - - lbs_deb_thread("2: currenttxskb %p, dnld_send %d\n", - priv->currenttxskb, priv->dnld_sent); - - set_current_state(TASK_RUNNING); - remove_wait_queue(&priv->waitq, &wait); - - lbs_deb_thread("3: currenttxskb %p, dnld_sent %d\n", - priv->currenttxskb, priv->dnld_sent); - - if (kthread_should_stop()) { - lbs_deb_thread("break from main thread\n"); - break; - } - - if (priv->surpriseremoved) { - lbs_deb_thread("adapter removed; waiting to die...\n"); - continue; - } - - lbs_deb_thread("4: currenttxskb %p, dnld_sent %d\n", - priv->currenttxskb, priv->dnld_sent); - - /* Process any pending command response */ - spin_lock_irq(&priv->driver_lock); - resp_idx = priv->resp_idx; - if (priv->resp_len[resp_idx]) { - spin_unlock_irq(&priv->driver_lock); - lbs_process_command_response(priv, - priv->resp_buf[resp_idx], - priv->resp_len[resp_idx]); - spin_lock_irq(&priv->driver_lock); - priv->resp_len[resp_idx] = 0; - } - spin_unlock_irq(&priv->driver_lock); - - /* Process hardware events, e.g. card removed, link lost */ - spin_lock_irq(&priv->driver_lock); - while (kfifo_len(&priv->event_fifo)) { - u32 event; - - if (kfifo_out(&priv->event_fifo, - (unsigned char *) &event, sizeof(event)) != - sizeof(event)) - break; - spin_unlock_irq(&priv->driver_lock); - lbs_process_event(priv, event); - spin_lock_irq(&priv->driver_lock); - } - spin_unlock_irq(&priv->driver_lock); - - if (priv->wakeup_dev_required) { - lbs_deb_thread("Waking up device...\n"); - /* Wake up device */ - if (priv->exit_deep_sleep(priv)) - lbs_deb_thread("Wakeup device failed\n"); - continue; - } - - /* command timeout stuff */ - if (priv->cmd_timed_out && priv->cur_cmd) { - struct cmd_ctrl_node *cmdnode = priv->cur_cmd; - - netdev_info(dev, "Timeout submitting command 0x%04x\n", - le16_to_cpu(cmdnode->cmdbuf->command)); - lbs_complete_command(priv, cmdnode, -ETIMEDOUT); - - /* Reset card, but only when it isn't in the process - * of being shutdown anyway. */ - if (!dev->dismantle && priv->reset_card) - priv->reset_card(priv); - } - priv->cmd_timed_out = 0; - - if (!priv->fw_ready) - continue; - - /* Check if we need to confirm Sleep Request received previously */ - if (priv->psstate == PS_STATE_PRE_SLEEP && - !priv->dnld_sent && !priv->cur_cmd) { - if (priv->connect_status == LBS_CONNECTED) { - lbs_deb_thread("pre-sleep, currenttxskb %p, " - "dnld_sent %d, cur_cmd %p\n", - priv->currenttxskb, priv->dnld_sent, - priv->cur_cmd); - - lbs_ps_confirm_sleep(priv); - } else { - /* workaround for firmware sending - * deauth/linkloss event immediately - * after sleep request; remove this - * after firmware fixes it - */ - priv->psstate = PS_STATE_AWAKE; - netdev_alert(dev, - "ignore PS_SleepConfirm in non-connected state\n"); - } - } - - /* The PS state is changed during processing of Sleep Request - * event above - */ - if ((priv->psstate == PS_STATE_SLEEP) || - (priv->psstate == PS_STATE_PRE_SLEEP)) - continue; - - if (priv->is_deep_sleep) - continue; - - /* Execute the next command */ - if (!priv->dnld_sent && !priv->cur_cmd) - lbs_execute_next_command(priv); - - spin_lock_irq(&priv->driver_lock); - if (!priv->dnld_sent && priv->tx_pending_len > 0) { - int ret = priv->hw_host_to_card(priv, MVMS_DAT, - priv->tx_pending_buf, - priv->tx_pending_len); - if (ret) { - lbs_deb_tx("host_to_card failed %d\n", ret); - priv->dnld_sent = DNLD_RES_RECEIVED; - } else { - mod_timer(&priv->tx_lockup_timer, - jiffies + (HZ * 5)); - } - priv->tx_pending_len = 0; - if (!priv->currenttxskb) { - /* We can wake the queues immediately if we aren't - waiting for TX feedback */ - if (priv->connect_status == LBS_CONNECTED) - netif_wake_queue(priv->dev); - if (priv->mesh_dev && - netif_running(priv->mesh_dev)) - netif_wake_queue(priv->mesh_dev); - } - } - spin_unlock_irq(&priv->driver_lock); - } - - del_timer(&priv->command_timer); - del_timer(&priv->tx_lockup_timer); - del_timer(&priv->auto_deepsleep_timer); - - lbs_deb_leave(LBS_DEB_THREAD); - return 0; -} - -/** - * lbs_setup_firmware - gets the HW spec from the firmware and sets - * some basic parameters - * - * @priv: A pointer to &struct lbs_private structure - * returns: 0 or -1 - */ -static int lbs_setup_firmware(struct lbs_private *priv) -{ - int ret = -1; - s16 curlevel = 0, minlevel = 0, maxlevel = 0; - - lbs_deb_enter(LBS_DEB_FW); - - /* Read MAC address from firmware */ - memset(priv->current_addr, 0xff, ETH_ALEN); - ret = lbs_update_hw_spec(priv); - if (ret) - goto done; - - /* Read power levels if available */ - ret = lbs_get_tx_power(priv, &curlevel, &minlevel, &maxlevel); - if (ret == 0) { - priv->txpower_cur = curlevel; - priv->txpower_min = minlevel; - priv->txpower_max = maxlevel; - } - - /* Send cmd to FW to enable 11D function */ - ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_11D_ENABLE, 1); - if (ret) - goto done; - - ret = lbs_set_mac_control_sync(priv); -done: - lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); - return ret; -} - -int lbs_suspend(struct lbs_private *priv) -{ - int ret; - - lbs_deb_enter(LBS_DEB_FW); - - if (priv->is_deep_sleep) { - ret = lbs_set_deep_sleep(priv, 0); - if (ret) { - netdev_err(priv->dev, - "deep sleep cancellation failed: %d\n", ret); - return ret; - } - priv->deep_sleep_required = 1; - } - - ret = lbs_set_host_sleep(priv, 1); - - netif_device_detach(priv->dev); - if (priv->mesh_dev) - netif_device_detach(priv->mesh_dev); - - lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); - return ret; -} -EXPORT_SYMBOL_GPL(lbs_suspend); - -int lbs_resume(struct lbs_private *priv) -{ - int ret; - - lbs_deb_enter(LBS_DEB_FW); - - ret = lbs_set_host_sleep(priv, 0); - - netif_device_attach(priv->dev); - if (priv->mesh_dev) - netif_device_attach(priv->mesh_dev); - - if (priv->deep_sleep_required) { - priv->deep_sleep_required = 0; - ret = lbs_set_deep_sleep(priv, 1); - if (ret) - netdev_err(priv->dev, - "deep sleep activation failed: %d\n", ret); - } - - if (priv->setup_fw_on_resume) - ret = lbs_setup_firmware(priv); - - lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); - return ret; -} -EXPORT_SYMBOL_GPL(lbs_resume); - -/** - * lbs_cmd_timeout_handler - handles the timeout of command sending. - * It will re-send the same command again. - * - * @data: &struct lbs_private pointer - */ -static void lbs_cmd_timeout_handler(unsigned long data) -{ - struct lbs_private *priv = (struct lbs_private *)data; - unsigned long flags; - - lbs_deb_enter(LBS_DEB_CMD); - spin_lock_irqsave(&priv->driver_lock, flags); - - if (!priv->cur_cmd) - goto out; - - netdev_info(priv->dev, "command 0x%04x timed out\n", - le16_to_cpu(priv->cur_cmd->cmdbuf->command)); - - priv->cmd_timed_out = 1; - - /* - * If the device didn't even acknowledge the command, reset the state - * so that we don't block all future commands due to this one timeout. - */ - if (priv->dnld_sent == DNLD_CMD_SENT) - priv->dnld_sent = DNLD_RES_RECEIVED; - - wake_up(&priv->waitq); -out: - spin_unlock_irqrestore(&priv->driver_lock, flags); - lbs_deb_leave(LBS_DEB_CMD); -} - -/** - * lbs_tx_lockup_handler - handles the timeout of the passing of TX frames - * to the hardware. This is known to frequently happen with SD8686 when - * waking up after a Wake-on-WLAN-triggered resume. - * - * @data: &struct lbs_private pointer - */ -static void lbs_tx_lockup_handler(unsigned long data) -{ - struct lbs_private *priv = (struct lbs_private *)data; - unsigned long flags; - - lbs_deb_enter(LBS_DEB_TX); - spin_lock_irqsave(&priv->driver_lock, flags); - - netdev_info(priv->dev, "TX lockup detected\n"); - if (priv->reset_card) - priv->reset_card(priv); - - priv->dnld_sent = DNLD_RES_RECEIVED; - wake_up_interruptible(&priv->waitq); - - spin_unlock_irqrestore(&priv->driver_lock, flags); - lbs_deb_leave(LBS_DEB_TX); -} - -/** - * auto_deepsleep_timer_fn - put the device back to deep sleep mode when - * timer expires and no activity (command, event, data etc.) is detected. - * @data: &struct lbs_private pointer - * returns: N/A - */ -static void auto_deepsleep_timer_fn(unsigned long data) -{ - struct lbs_private *priv = (struct lbs_private *)data; - - lbs_deb_enter(LBS_DEB_CMD); - - if (priv->is_activity_detected) { - priv->is_activity_detected = 0; - } else { - if (priv->is_auto_deep_sleep_enabled && - (!priv->wakeup_dev_required) && - (priv->connect_status != LBS_CONNECTED)) { - struct cmd_header cmd; - - lbs_deb_main("Entering auto deep sleep mode...\n"); - memset(&cmd, 0, sizeof(cmd)); - cmd.size = cpu_to_le16(sizeof(cmd)); - lbs_cmd_async(priv, CMD_802_11_DEEP_SLEEP, &cmd, - sizeof(cmd)); - } - } - mod_timer(&priv->auto_deepsleep_timer , jiffies + - (priv->auto_deep_sleep_timeout * HZ)/1000); - lbs_deb_leave(LBS_DEB_CMD); -} - -int lbs_enter_auto_deep_sleep(struct lbs_private *priv) -{ - lbs_deb_enter(LBS_DEB_SDIO); - - priv->is_auto_deep_sleep_enabled = 1; - if (priv->is_deep_sleep) - priv->wakeup_dev_required = 1; - mod_timer(&priv->auto_deepsleep_timer , - jiffies + (priv->auto_deep_sleep_timeout * HZ)/1000); - - lbs_deb_leave(LBS_DEB_SDIO); - return 0; -} - -int lbs_exit_auto_deep_sleep(struct lbs_private *priv) -{ - lbs_deb_enter(LBS_DEB_SDIO); - - priv->is_auto_deep_sleep_enabled = 0; - priv->auto_deep_sleep_timeout = 0; - del_timer(&priv->auto_deepsleep_timer); - - lbs_deb_leave(LBS_DEB_SDIO); - return 0; -} - -static int lbs_init_adapter(struct lbs_private *priv) -{ - int ret; - - lbs_deb_enter(LBS_DEB_MAIN); - - memset(priv->current_addr, 0xff, ETH_ALEN); - - priv->connect_status = LBS_DISCONNECTED; - priv->channel = DEFAULT_AD_HOC_CHANNEL; - priv->mac_control = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON; - priv->radio_on = 1; - priv->psmode = LBS802_11POWERMODECAM; - priv->psstate = PS_STATE_FULL_POWER; - priv->is_deep_sleep = 0; - priv->is_auto_deep_sleep_enabled = 0; - priv->deep_sleep_required = 0; - priv->wakeup_dev_required = 0; - init_waitqueue_head(&priv->ds_awake_q); - init_waitqueue_head(&priv->scan_q); - priv->authtype_auto = 1; - priv->is_host_sleep_configured = 0; - priv->is_host_sleep_activated = 0; - init_waitqueue_head(&priv->host_sleep_q); - init_waitqueue_head(&priv->fw_waitq); - mutex_init(&priv->lock); - - setup_timer(&priv->command_timer, lbs_cmd_timeout_handler, - (unsigned long)priv); - setup_timer(&priv->tx_lockup_timer, lbs_tx_lockup_handler, - (unsigned long)priv); - setup_timer(&priv->auto_deepsleep_timer, auto_deepsleep_timer_fn, - (unsigned long)priv); - - INIT_LIST_HEAD(&priv->cmdfreeq); - INIT_LIST_HEAD(&priv->cmdpendingq); - - spin_lock_init(&priv->driver_lock); - - /* Allocate the command buffers */ - if (lbs_allocate_cmd_buffer(priv)) { - pr_err("Out of memory allocating command buffers\n"); - ret = -ENOMEM; - goto out; - } - priv->resp_idx = 0; - priv->resp_len[0] = priv->resp_len[1] = 0; - - /* Create the event FIFO */ - ret = kfifo_alloc(&priv->event_fifo, sizeof(u32) * 16, GFP_KERNEL); - if (ret) { - pr_err("Out of memory allocating event FIFO buffer\n"); - goto out; - } - -out: - lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); - - return ret; -} - -static void lbs_free_adapter(struct lbs_private *priv) -{ - lbs_deb_enter(LBS_DEB_MAIN); - - lbs_free_cmd_buffer(priv); - kfifo_free(&priv->event_fifo); - del_timer(&priv->command_timer); - del_timer(&priv->tx_lockup_timer); - del_timer(&priv->auto_deepsleep_timer); - - lbs_deb_leave(LBS_DEB_MAIN); -} - -static const struct net_device_ops lbs_netdev_ops = { - .ndo_open = lbs_dev_open, - .ndo_stop = lbs_eth_stop, - .ndo_start_xmit = lbs_hard_start_xmit, - .ndo_set_mac_address = lbs_set_mac_address, - .ndo_set_rx_mode = lbs_set_multicast_list, - .ndo_change_mtu = eth_change_mtu, - .ndo_validate_addr = eth_validate_addr, -}; - -/** - * lbs_add_card - adds the card. It will probe the - * card, allocate the lbs_priv and initialize the device. - * - * @card: A pointer to card - * @dmdev: A pointer to &struct device - * returns: A pointer to &struct lbs_private structure - */ -struct lbs_private *lbs_add_card(void *card, struct device *dmdev) -{ - struct net_device *dev; - struct wireless_dev *wdev; - struct lbs_private *priv = NULL; - - lbs_deb_enter(LBS_DEB_MAIN); - - /* Allocate an Ethernet device and register it */ - wdev = lbs_cfg_alloc(dmdev); - if (IS_ERR(wdev)) { - pr_err("cfg80211 init failed\n"); - goto done; - } - - wdev->iftype = NL80211_IFTYPE_STATION; - priv = wdev_priv(wdev); - priv->wdev = wdev; - - if (lbs_init_adapter(priv)) { - pr_err("failed to initialize adapter structure\n"); - goto err_wdev; - } - - dev = alloc_netdev(0, "wlan%d", ether_setup); - if (!dev) { - dev_err(dmdev, "no memory for network device instance\n"); - goto err_adapter; - } - - dev->ieee80211_ptr = wdev; - dev->ml_priv = priv; - SET_NETDEV_DEV(dev, dmdev); - wdev->netdev = dev; - priv->dev = dev; - - dev->netdev_ops = &lbs_netdev_ops; - dev->watchdog_timeo = 5 * HZ; - dev->ethtool_ops = &lbs_ethtool_ops; - dev->flags |= IFF_BROADCAST | IFF_MULTICAST; - - priv->card = card; - - strcpy(dev->name, "wlan%d"); - - lbs_deb_thread("Starting main thread...\n"); - init_waitqueue_head(&priv->waitq); - priv->main_thread = kthread_run(lbs_thread, dev, "lbs_main"); - if (IS_ERR(priv->main_thread)) { - lbs_deb_thread("Error creating main thread.\n"); - goto err_ndev; - } - - priv->work_thread = create_singlethread_workqueue("lbs_worker"); - INIT_WORK(&priv->mcast_work, lbs_set_mcast_worker); - - priv->wol_criteria = EHS_REMOVE_WAKEUP; - priv->wol_gpio = 0xff; - priv->wol_gap = 20; - priv->ehs_remove_supported = true; - - goto done; - - err_ndev: - free_netdev(dev); - - err_adapter: - lbs_free_adapter(priv); - - err_wdev: - lbs_cfg_free(priv); - - priv = NULL; - -done: - lbs_deb_leave_args(LBS_DEB_MAIN, "priv %p", priv); - return priv; -} -EXPORT_SYMBOL_GPL(lbs_add_card); - - -void lbs_remove_card(struct lbs_private *priv) -{ - struct net_device *dev = priv->dev; - - lbs_deb_enter(LBS_DEB_MAIN); - - lbs_remove_mesh(priv); - - if (priv->wiphy_registered) - lbs_scan_deinit(priv); - - lbs_wait_for_firmware_load(priv); - - /* worker thread destruction blocks on the in-flight command which - * should have been cleared already in lbs_stop_card(). - */ - lbs_deb_main("destroying worker thread\n"); - destroy_workqueue(priv->work_thread); - lbs_deb_main("done destroying worker thread\n"); - - if (priv->psmode == LBS802_11POWERMODEMAX_PSP) { - priv->psmode = LBS802_11POWERMODECAM; - lbs_set_ps_mode(priv, PS_MODE_ACTION_EXIT_PS, true); - } - - if (priv->is_deep_sleep) { - priv->is_deep_sleep = 0; - wake_up_interruptible(&priv->ds_awake_q); - } - - priv->is_host_sleep_configured = 0; - priv->is_host_sleep_activated = 0; - wake_up_interruptible(&priv->host_sleep_q); - - /* Stop the thread servicing the interrupts */ - priv->surpriseremoved = 1; - kthread_stop(priv->main_thread); - - lbs_free_adapter(priv); - lbs_cfg_free(priv); - free_netdev(dev); - - lbs_deb_leave(LBS_DEB_MAIN); -} -EXPORT_SYMBOL_GPL(lbs_remove_card); - - -int lbs_rtap_supported(struct lbs_private *priv) -{ - if (MRVL_FW_MAJOR_REV(priv->fwrelease) == MRVL_FW_V5) - return 1; - - /* newer firmware use a capability mask */ - return ((MRVL_FW_MAJOR_REV(priv->fwrelease) >= MRVL_FW_V10) && - (priv->fwcapinfo & MESH_CAPINFO_ENABLE_MASK)); -} - - -int lbs_start_card(struct lbs_private *priv) -{ - struct net_device *dev = priv->dev; - int ret = -1; - - lbs_deb_enter(LBS_DEB_MAIN); - - /* poke the firmware */ - ret = lbs_setup_firmware(priv); - if (ret) - goto done; - - if (!lbs_disablemesh) - lbs_init_mesh(priv); - else - pr_info("%s: mesh disabled\n", dev->name); - - if (lbs_cfg_register(priv)) { - pr_err("cannot register device\n"); - goto done; - } - - if (lbs_mesh_activated(priv)) - lbs_start_mesh(priv); - - lbs_debugfs_init_one(priv, dev); - - netdev_info(dev, "Marvell WLAN 802.11 adapter\n"); - - ret = 0; - -done: - lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); - return ret; -} -EXPORT_SYMBOL_GPL(lbs_start_card); - - -void lbs_stop_card(struct lbs_private *priv) -{ - struct net_device *dev; - - lbs_deb_enter(LBS_DEB_MAIN); - - if (!priv) - goto out; - dev = priv->dev; - - /* If the netdev isn't registered, it means that lbs_start_card() was - * never called so we have nothing to do here. */ - if (dev->reg_state != NETREG_REGISTERED) - goto out; - - netif_stop_queue(dev); - netif_carrier_off(dev); - - lbs_debugfs_remove_one(priv); - lbs_deinit_mesh(priv); - unregister_netdev(dev); - -out: - lbs_deb_leave(LBS_DEB_MAIN); -} -EXPORT_SYMBOL_GPL(lbs_stop_card); - - -void lbs_queue_event(struct lbs_private *priv, u32 event) -{ - unsigned long flags; - - lbs_deb_enter(LBS_DEB_THREAD); - spin_lock_irqsave(&priv->driver_lock, flags); - - if (priv->psstate == PS_STATE_SLEEP) - priv->psstate = PS_STATE_AWAKE; - - kfifo_in(&priv->event_fifo, (unsigned char *) &event, sizeof(u32)); - - wake_up(&priv->waitq); - - spin_unlock_irqrestore(&priv->driver_lock, flags); - lbs_deb_leave(LBS_DEB_THREAD); -} -EXPORT_SYMBOL_GPL(lbs_queue_event); - -void lbs_notify_command_response(struct lbs_private *priv, u8 resp_idx) -{ - lbs_deb_enter(LBS_DEB_THREAD); - - if (priv->psstate == PS_STATE_SLEEP) - priv->psstate = PS_STATE_AWAKE; - - /* Swap buffers by flipping the response index */ - BUG_ON(resp_idx > 1); - priv->resp_idx = resp_idx; - - wake_up(&priv->waitq); - - lbs_deb_leave(LBS_DEB_THREAD); -} -EXPORT_SYMBOL_GPL(lbs_notify_command_response); - -static int __init lbs_init_module(void) -{ - lbs_deb_enter(LBS_DEB_MAIN); - memset(&confirm_sleep, 0, sizeof(confirm_sleep)); - confirm_sleep.hdr.command = cpu_to_le16(CMD_802_11_PS_MODE); - confirm_sleep.hdr.size = cpu_to_le16(sizeof(confirm_sleep)); - confirm_sleep.action = cpu_to_le16(PS_MODE_ACTION_SLEEP_CONFIRMED); - lbs_debugfs_init(); - lbs_deb_leave(LBS_DEB_MAIN); - return 0; -} - -static void __exit lbs_exit_module(void) -{ - lbs_deb_enter(LBS_DEB_MAIN); - lbs_debugfs_remove(); - lbs_deb_leave(LBS_DEB_MAIN); -} - -module_init(lbs_init_module); -module_exit(lbs_exit_module); - -MODULE_DESCRIPTION("Libertas WLAN Driver Library"); -MODULE_AUTHOR("Marvell International Ltd."); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c deleted file mode 100644 index 3e81264db81e..000000000000 --- a/drivers/net/wireless/libertas/mesh.c +++ /dev/null @@ -1,1188 +0,0 @@ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "mesh.h" -#include "decl.h" -#include "cmd.h" - - -static int lbs_add_mesh(struct lbs_private *priv); - -/*************************************************************************** - * Mesh command handling - */ - -static int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, - struct cmd_ds_mesh_access *cmd) -{ - int ret; - - lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action); - - cmd->hdr.command = cpu_to_le16(CMD_MESH_ACCESS); - cmd->hdr.size = cpu_to_le16(sizeof(*cmd)); - cmd->hdr.result = 0; - - cmd->action = cpu_to_le16(cmd_action); - - ret = lbs_cmd_with_response(priv, CMD_MESH_ACCESS, cmd); - - lbs_deb_leave(LBS_DEB_CMD); - return ret; -} - -static int __lbs_mesh_config_send(struct lbs_private *priv, - struct cmd_ds_mesh_config *cmd, - uint16_t action, uint16_t type) -{ - int ret; - u16 command = CMD_MESH_CONFIG_OLD; - - lbs_deb_enter(LBS_DEB_CMD); - - /* - * Command id is 0xac for v10 FW along with mesh interface - * id in bits 14-13-12. - */ - if (priv->mesh_tlv == TLV_TYPE_MESH_ID) - command = CMD_MESH_CONFIG | - (MESH_IFACE_ID << MESH_IFACE_BIT_OFFSET); - - cmd->hdr.command = cpu_to_le16(command); - cmd->hdr.size = cpu_to_le16(sizeof(struct cmd_ds_mesh_config)); - cmd->hdr.result = 0; - - cmd->type = cpu_to_le16(type); - cmd->action = cpu_to_le16(action); - - ret = lbs_cmd_with_response(priv, command, cmd); - - lbs_deb_leave(LBS_DEB_CMD); - return ret; -} - -static int lbs_mesh_config_send(struct lbs_private *priv, - struct cmd_ds_mesh_config *cmd, - uint16_t action, uint16_t type) -{ - int ret; - - if (!(priv->fwcapinfo & FW_CAPINFO_PERSISTENT_CONFIG)) - return -EOPNOTSUPP; - - ret = __lbs_mesh_config_send(priv, cmd, action, type); - return ret; -} - -/* This function is the CMD_MESH_CONFIG legacy function. It only handles the - * START and STOP actions. The extended actions supported by CMD_MESH_CONFIG - * are all handled by preparing a struct cmd_ds_mesh_config and passing it to - * lbs_mesh_config_send. - */ -static int lbs_mesh_config(struct lbs_private *priv, uint16_t action, - uint16_t chan) -{ - struct cmd_ds_mesh_config cmd; - struct mrvl_meshie *ie; - DECLARE_SSID_BUF(ssid); - - memset(&cmd, 0, sizeof(cmd)); - cmd.channel = cpu_to_le16(chan); - ie = (struct mrvl_meshie *)cmd.data; - - switch (action) { - case CMD_ACT_MESH_CONFIG_START: - ie->id = WLAN_EID_VENDOR_SPECIFIC; - ie->val.oui[0] = 0x00; - ie->val.oui[1] = 0x50; - ie->val.oui[2] = 0x43; - ie->val.type = MARVELL_MESH_IE_TYPE; - ie->val.subtype = MARVELL_MESH_IE_SUBTYPE; - ie->val.version = MARVELL_MESH_IE_VERSION; - ie->val.active_protocol_id = MARVELL_MESH_PROTO_ID_HWMP; - ie->val.active_metric_id = MARVELL_MESH_METRIC_ID; - ie->val.mesh_capability = MARVELL_MESH_CAPABILITY; - ie->val.mesh_id_len = priv->mesh_ssid_len; - memcpy(ie->val.mesh_id, priv->mesh_ssid, priv->mesh_ssid_len); - ie->len = sizeof(struct mrvl_meshie_val) - - IEEE80211_MAX_SSID_LEN + priv->mesh_ssid_len; - cmd.length = cpu_to_le16(sizeof(struct mrvl_meshie_val)); - break; - case CMD_ACT_MESH_CONFIG_STOP: - break; - default: - return -1; - } - lbs_deb_cmd("mesh config action %d type %x channel %d SSID %s\n", - action, priv->mesh_tlv, chan, - print_ssid(ssid, priv->mesh_ssid, priv->mesh_ssid_len)); - - return __lbs_mesh_config_send(priv, &cmd, action, priv->mesh_tlv); -} - -int lbs_mesh_set_channel(struct lbs_private *priv, u8 channel) -{ - priv->mesh_channel = channel; - return lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, channel); -} - -static uint16_t lbs_mesh_get_channel(struct lbs_private *priv) -{ - return priv->mesh_channel ?: 1; -} - -/*************************************************************************** - * Mesh sysfs support - */ - -/* - * Attributes exported through sysfs - */ - -/** - * lbs_anycast_get - Get function for sysfs attribute anycast_mask - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer where data will be returned - */ -static ssize_t lbs_anycast_get(struct device *dev, - struct device_attribute *attr, char * buf) -{ - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - struct cmd_ds_mesh_access mesh_access; - int ret; - - memset(&mesh_access, 0, sizeof(mesh_access)); - - ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_ANYCAST, &mesh_access); - if (ret) - return ret; - - return snprintf(buf, 12, "0x%X\n", le32_to_cpu(mesh_access.data[0])); -} - -/** - * lbs_anycast_set - Set function for sysfs attribute anycast_mask - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer that contains new attribute value - * @count: size of buffer - */ -static ssize_t lbs_anycast_set(struct device *dev, - struct device_attribute *attr, const char * buf, size_t count) -{ - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - struct cmd_ds_mesh_access mesh_access; - uint32_t datum; - int ret; - - memset(&mesh_access, 0, sizeof(mesh_access)); - sscanf(buf, "%x", &datum); - mesh_access.data[0] = cpu_to_le32(datum); - - ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_ANYCAST, &mesh_access); - if (ret) - return ret; - - return strlen(buf); -} - -/** - * lbs_prb_rsp_limit_get - Get function for sysfs attribute prb_rsp_limit - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer where data will be returned - */ -static ssize_t lbs_prb_rsp_limit_get(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - struct cmd_ds_mesh_access mesh_access; - int ret; - u32 retry_limit; - - memset(&mesh_access, 0, sizeof(mesh_access)); - mesh_access.data[0] = cpu_to_le32(CMD_ACT_GET); - - ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_GET_PRB_RSP_LIMIT, - &mesh_access); - if (ret) - return ret; - - retry_limit = le32_to_cpu(mesh_access.data[1]); - return snprintf(buf, 10, "%d\n", retry_limit); -} - -/** - * lbs_prb_rsp_limit_set - Set function for sysfs attribute prb_rsp_limit - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer that contains new attribute value - * @count: size of buffer - */ -static ssize_t lbs_prb_rsp_limit_set(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -{ - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - struct cmd_ds_mesh_access mesh_access; - int ret; - unsigned long retry_limit; - - memset(&mesh_access, 0, sizeof(mesh_access)); - mesh_access.data[0] = cpu_to_le32(CMD_ACT_SET); - - if (!strict_strtoul(buf, 10, &retry_limit)) - return -ENOTSUPP; - if (retry_limit > 15) - return -ENOTSUPP; - - mesh_access.data[1] = cpu_to_le32(retry_limit); - - ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_GET_PRB_RSP_LIMIT, - &mesh_access); - if (ret) - return ret; - - return strlen(buf); -} - -/** - * lbs_mesh_get - Get function for sysfs attribute mesh - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer where data will be returned - */ -static ssize_t lbs_mesh_get(struct device *dev, - struct device_attribute *attr, char * buf) -{ - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - return snprintf(buf, 5, "0x%X\n", !!priv->mesh_dev); -} - -/** - * lbs_mesh_set - Set function for sysfs attribute mesh - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer that contains new attribute value - * @count: size of buffer - */ -static ssize_t lbs_mesh_set(struct device *dev, - struct device_attribute *attr, const char * buf, size_t count) -{ - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - int enable; - - sscanf(buf, "%x", &enable); - enable = !!enable; - if (enable == !!priv->mesh_dev) - return count; - - if (enable) - lbs_add_mesh(priv); - else - lbs_remove_mesh(priv); - - return count; -} - -/* - * lbs_mesh attribute to be exported per ethX interface - * through sysfs (/sys/class/net/ethX/lbs_mesh) - */ -static DEVICE_ATTR(lbs_mesh, 0644, lbs_mesh_get, lbs_mesh_set); - -/* - * anycast_mask attribute to be exported per mshX interface - * through sysfs (/sys/class/net/mshX/anycast_mask) - */ -static DEVICE_ATTR(anycast_mask, 0644, lbs_anycast_get, lbs_anycast_set); - -/* - * prb_rsp_limit attribute to be exported per mshX interface - * through sysfs (/sys/class/net/mshX/prb_rsp_limit) - */ -static DEVICE_ATTR(prb_rsp_limit, 0644, lbs_prb_rsp_limit_get, - lbs_prb_rsp_limit_set); - -static struct attribute *lbs_mesh_sysfs_entries[] = { - &dev_attr_anycast_mask.attr, - &dev_attr_prb_rsp_limit.attr, - NULL, -}; - -static const struct attribute_group lbs_mesh_attr_group = { - .attrs = lbs_mesh_sysfs_entries, -}; - - -/*************************************************************************** - * Persistent configuration support - */ - -static int mesh_get_default_parameters(struct device *dev, - struct mrvl_mesh_defaults *defs) -{ - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - struct cmd_ds_mesh_config cmd; - int ret; - - memset(&cmd, 0, sizeof(struct cmd_ds_mesh_config)); - ret = lbs_mesh_config_send(priv, &cmd, CMD_ACT_MESH_CONFIG_GET, - CMD_TYPE_MESH_GET_DEFAULTS); - - if (ret) - return -EOPNOTSUPP; - - memcpy(defs, &cmd.data[0], sizeof(struct mrvl_mesh_defaults)); - - return 0; -} - -/** - * bootflag_get - Get function for sysfs attribute bootflag - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer where data will be returned - */ -static ssize_t bootflag_get(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct mrvl_mesh_defaults defs; - int ret; - - ret = mesh_get_default_parameters(dev, &defs); - - if (ret) - return ret; - - return snprintf(buf, 12, "%d\n", le32_to_cpu(defs.bootflag)); -} - -/** - * bootflag_set - Set function for sysfs attribute bootflag - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer that contains new attribute value - * @count: size of buffer - */ -static ssize_t bootflag_set(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - struct cmd_ds_mesh_config cmd; - uint32_t datum; - int ret; - - memset(&cmd, 0, sizeof(cmd)); - ret = sscanf(buf, "%d", &datum); - if ((ret != 1) || (datum > 1)) - return -EINVAL; - - *((__le32 *)&cmd.data[0]) = cpu_to_le32(!!datum); - cmd.length = cpu_to_le16(sizeof(uint32_t)); - ret = lbs_mesh_config_send(priv, &cmd, CMD_ACT_MESH_CONFIG_SET, - CMD_TYPE_MESH_SET_BOOTFLAG); - if (ret) - return ret; - - return strlen(buf); -} - -/** - * boottime_get - Get function for sysfs attribute boottime - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer where data will be returned - */ -static ssize_t boottime_get(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct mrvl_mesh_defaults defs; - int ret; - - ret = mesh_get_default_parameters(dev, &defs); - - if (ret) - return ret; - - return snprintf(buf, 12, "%d\n", defs.boottime); -} - -/** - * boottime_set - Set function for sysfs attribute boottime - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer that contains new attribute value - * @count: size of buffer - */ -static ssize_t boottime_set(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -{ - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - struct cmd_ds_mesh_config cmd; - uint32_t datum; - int ret; - - memset(&cmd, 0, sizeof(cmd)); - ret = sscanf(buf, "%d", &datum); - if ((ret != 1) || (datum > 255)) - return -EINVAL; - - /* A too small boot time will result in the device booting into - * standalone (no-host) mode before the host can take control of it, - * so the change will be hard to revert. This may be a desired - * feature (e.g to configure a very fast boot time for devices that - * will not be attached to a host), but dangerous. So I'm enforcing a - * lower limit of 20 seconds: remove and recompile the driver if this - * does not work for you. - */ - datum = (datum < 20) ? 20 : datum; - cmd.data[0] = datum; - cmd.length = cpu_to_le16(sizeof(uint8_t)); - ret = lbs_mesh_config_send(priv, &cmd, CMD_ACT_MESH_CONFIG_SET, - CMD_TYPE_MESH_SET_BOOTTIME); - if (ret) - return ret; - - return strlen(buf); -} - -/** - * channel_get - Get function for sysfs attribute channel - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer where data will be returned - */ -static ssize_t channel_get(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct mrvl_mesh_defaults defs; - int ret; - - ret = mesh_get_default_parameters(dev, &defs); - - if (ret) - return ret; - - return snprintf(buf, 12, "%d\n", le16_to_cpu(defs.channel)); -} - -/** - * channel_set - Set function for sysfs attribute channel - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer that contains new attribute value - * @count: size of buffer - */ -static ssize_t channel_set(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - struct cmd_ds_mesh_config cmd; - uint32_t datum; - int ret; - - memset(&cmd, 0, sizeof(cmd)); - ret = sscanf(buf, "%d", &datum); - if (ret != 1 || datum < 1 || datum > 11) - return -EINVAL; - - *((__le16 *)&cmd.data[0]) = cpu_to_le16(datum); - cmd.length = cpu_to_le16(sizeof(uint16_t)); - ret = lbs_mesh_config_send(priv, &cmd, CMD_ACT_MESH_CONFIG_SET, - CMD_TYPE_MESH_SET_DEF_CHANNEL); - if (ret) - return ret; - - return strlen(buf); -} - -/** - * mesh_id_get - Get function for sysfs attribute mesh_id - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer where data will be returned - */ -static ssize_t mesh_id_get(struct device *dev, struct device_attribute *attr, - char *buf) -{ - struct mrvl_mesh_defaults defs; - int ret; - - ret = mesh_get_default_parameters(dev, &defs); - - if (ret) - return ret; - - if (defs.meshie.val.mesh_id_len > IEEE80211_MAX_SSID_LEN) { - dev_err(dev, "inconsistent mesh ID length\n"); - defs.meshie.val.mesh_id_len = IEEE80211_MAX_SSID_LEN; - } - - memcpy(buf, defs.meshie.val.mesh_id, defs.meshie.val.mesh_id_len); - buf[defs.meshie.val.mesh_id_len] = '\n'; - buf[defs.meshie.val.mesh_id_len + 1] = '\0'; - - return defs.meshie.val.mesh_id_len + 1; -} - -/** - * mesh_id_set - Set function for sysfs attribute mesh_id - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer that contains new attribute value - * @count: size of buffer - */ -static ssize_t mesh_id_set(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct cmd_ds_mesh_config cmd; - struct mrvl_mesh_defaults defs; - struct mrvl_meshie *ie; - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - int len; - int ret; - - if (count < 2 || count > IEEE80211_MAX_SSID_LEN + 1) - return -EINVAL; - - memset(&cmd, 0, sizeof(struct cmd_ds_mesh_config)); - ie = (struct mrvl_meshie *) &cmd.data[0]; - - /* fetch all other Information Element parameters */ - ret = mesh_get_default_parameters(dev, &defs); - - cmd.length = cpu_to_le16(sizeof(struct mrvl_meshie)); - - /* transfer IE elements */ - memcpy(ie, &defs.meshie, sizeof(struct mrvl_meshie)); - - len = count - 1; - memcpy(ie->val.mesh_id, buf, len); - /* SSID len */ - ie->val.mesh_id_len = len; - /* IE len */ - ie->len = sizeof(struct mrvl_meshie_val) - IEEE80211_MAX_SSID_LEN + len; - - ret = lbs_mesh_config_send(priv, &cmd, CMD_ACT_MESH_CONFIG_SET, - CMD_TYPE_MESH_SET_MESH_IE); - if (ret) - return ret; - - return strlen(buf); -} - -/** - * protocol_id_get - Get function for sysfs attribute protocol_id - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer where data will be returned - */ -static ssize_t protocol_id_get(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct mrvl_mesh_defaults defs; - int ret; - - ret = mesh_get_default_parameters(dev, &defs); - - if (ret) - return ret; - - return snprintf(buf, 5, "%d\n", defs.meshie.val.active_protocol_id); -} - -/** - * protocol_id_set - Set function for sysfs attribute protocol_id - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer that contains new attribute value - * @count: size of buffer - */ -static ssize_t protocol_id_set(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -{ - struct cmd_ds_mesh_config cmd; - struct mrvl_mesh_defaults defs; - struct mrvl_meshie *ie; - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - uint32_t datum; - int ret; - - memset(&cmd, 0, sizeof(cmd)); - ret = sscanf(buf, "%d", &datum); - if ((ret != 1) || (datum > 255)) - return -EINVAL; - - /* fetch all other Information Element parameters */ - ret = mesh_get_default_parameters(dev, &defs); - - cmd.length = cpu_to_le16(sizeof(struct mrvl_meshie)); - - /* transfer IE elements */ - ie = (struct mrvl_meshie *) &cmd.data[0]; - memcpy(ie, &defs.meshie, sizeof(struct mrvl_meshie)); - /* update protocol id */ - ie->val.active_protocol_id = datum; - - ret = lbs_mesh_config_send(priv, &cmd, CMD_ACT_MESH_CONFIG_SET, - CMD_TYPE_MESH_SET_MESH_IE); - if (ret) - return ret; - - return strlen(buf); -} - -/** - * metric_id_get - Get function for sysfs attribute metric_id - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer where data will be returned - */ -static ssize_t metric_id_get(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct mrvl_mesh_defaults defs; - int ret; - - ret = mesh_get_default_parameters(dev, &defs); - - if (ret) - return ret; - - return snprintf(buf, 5, "%d\n", defs.meshie.val.active_metric_id); -} - -/** - * metric_id_set - Set function for sysfs attribute metric_id - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer that contains new attribute value - * @count: size of buffer - */ -static ssize_t metric_id_set(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct cmd_ds_mesh_config cmd; - struct mrvl_mesh_defaults defs; - struct mrvl_meshie *ie; - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - uint32_t datum; - int ret; - - memset(&cmd, 0, sizeof(cmd)); - ret = sscanf(buf, "%d", &datum); - if ((ret != 1) || (datum > 255)) - return -EINVAL; - - /* fetch all other Information Element parameters */ - ret = mesh_get_default_parameters(dev, &defs); - - cmd.length = cpu_to_le16(sizeof(struct mrvl_meshie)); - - /* transfer IE elements */ - ie = (struct mrvl_meshie *) &cmd.data[0]; - memcpy(ie, &defs.meshie, sizeof(struct mrvl_meshie)); - /* update metric id */ - ie->val.active_metric_id = datum; - - ret = lbs_mesh_config_send(priv, &cmd, CMD_ACT_MESH_CONFIG_SET, - CMD_TYPE_MESH_SET_MESH_IE); - if (ret) - return ret; - - return strlen(buf); -} - -/** - * capability_get - Get function for sysfs attribute capability - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer where data will be returned - */ -static ssize_t capability_get(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct mrvl_mesh_defaults defs; - int ret; - - ret = mesh_get_default_parameters(dev, &defs); - - if (ret) - return ret; - - return snprintf(buf, 5, "%d\n", defs.meshie.val.mesh_capability); -} - -/** - * capability_set - Set function for sysfs attribute capability - * @dev: the &struct device - * @attr: device attributes - * @buf: buffer that contains new attribute value - * @count: size of buffer - */ -static ssize_t capability_set(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct cmd_ds_mesh_config cmd; - struct mrvl_mesh_defaults defs; - struct mrvl_meshie *ie; - struct lbs_private *priv = to_net_dev(dev)->ml_priv; - uint32_t datum; - int ret; - - memset(&cmd, 0, sizeof(cmd)); - ret = sscanf(buf, "%d", &datum); - if ((ret != 1) || (datum > 255)) - return -EINVAL; - - /* fetch all other Information Element parameters */ - ret = mesh_get_default_parameters(dev, &defs); - - cmd.length = cpu_to_le16(sizeof(struct mrvl_meshie)); - - /* transfer IE elements */ - ie = (struct mrvl_meshie *) &cmd.data[0]; - memcpy(ie, &defs.meshie, sizeof(struct mrvl_meshie)); - /* update value */ - ie->val.mesh_capability = datum; - - ret = lbs_mesh_config_send(priv, &cmd, CMD_ACT_MESH_CONFIG_SET, - CMD_TYPE_MESH_SET_MESH_IE); - if (ret) - return ret; - - return strlen(buf); -} - - -static DEVICE_ATTR(bootflag, 0644, bootflag_get, bootflag_set); -static DEVICE_ATTR(boottime, 0644, boottime_get, boottime_set); -static DEVICE_ATTR(channel, 0644, channel_get, channel_set); -static DEVICE_ATTR(mesh_id, 0644, mesh_id_get, mesh_id_set); -static DEVICE_ATTR(protocol_id, 0644, protocol_id_get, protocol_id_set); -static DEVICE_ATTR(metric_id, 0644, metric_id_get, metric_id_set); -static DEVICE_ATTR(capability, 0644, capability_get, capability_set); - -static struct attribute *boot_opts_attrs[] = { - &dev_attr_bootflag.attr, - &dev_attr_boottime.attr, - &dev_attr_channel.attr, - NULL -}; - -static const struct attribute_group boot_opts_group = { - .name = "boot_options", - .attrs = boot_opts_attrs, -}; - -static struct attribute *mesh_ie_attrs[] = { - &dev_attr_mesh_id.attr, - &dev_attr_protocol_id.attr, - &dev_attr_metric_id.attr, - &dev_attr_capability.attr, - NULL -}; - -static const struct attribute_group mesh_ie_group = { - .name = "mesh_ie", - .attrs = mesh_ie_attrs, -}; - -static void lbs_persist_config_init(struct net_device *dev) -{ - int ret; - ret = sysfs_create_group(&(dev->dev.kobj), &boot_opts_group); - ret = sysfs_create_group(&(dev->dev.kobj), &mesh_ie_group); -} - -static void lbs_persist_config_remove(struct net_device *dev) -{ - sysfs_remove_group(&(dev->dev.kobj), &boot_opts_group); - sysfs_remove_group(&(dev->dev.kobj), &mesh_ie_group); -} - - -/*************************************************************************** - * Initializing and starting, stopping mesh - */ - -/* - * Check mesh FW version and appropriately send the mesh start - * command - */ -int lbs_init_mesh(struct lbs_private *priv) -{ - int ret = 0; - - lbs_deb_enter(LBS_DEB_MESH); - - /* Determine mesh_fw_ver from fwrelease and fwcapinfo */ - /* 5.0.16p0 9.0.0.p0 is known to NOT support any mesh */ - /* 5.110.22 have mesh command with 0xa3 command id */ - /* 10.0.0.p0 FW brings in mesh config command with different id */ - /* Check FW version MSB and initialize mesh_fw_ver */ - if (MRVL_FW_MAJOR_REV(priv->fwrelease) == MRVL_FW_V5) { - /* Enable mesh, if supported, and work out which TLV it uses. - 0x100 + 291 is an unofficial value used in 5.110.20.pXX - 0x100 + 37 is the official value used in 5.110.21.pXX - but we check them in that order because 20.pXX doesn't - give an error -- it just silently fails. */ - - /* 5.110.20.pXX firmware will fail the command if the channel - doesn't match the existing channel. But only if the TLV - is correct. If the channel is wrong, _BOTH_ versions will - give an error to 0x100+291, and allow 0x100+37 to succeed. - It's just that 5.110.20.pXX will not have done anything - useful */ - - priv->mesh_tlv = TLV_TYPE_OLD_MESH_ID; - if (lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, 1)) { - priv->mesh_tlv = TLV_TYPE_MESH_ID; - if (lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, 1)) - priv->mesh_tlv = 0; - } - } else - if ((MRVL_FW_MAJOR_REV(priv->fwrelease) >= MRVL_FW_V10) && - (priv->fwcapinfo & MESH_CAPINFO_ENABLE_MASK)) { - /* 10.0.0.pXX new firmwares should succeed with TLV - * 0x100+37; Do not invoke command with old TLV. - */ - priv->mesh_tlv = TLV_TYPE_MESH_ID; - if (lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, 1)) - priv->mesh_tlv = 0; - } - - /* Stop meshing until interface is brought up */ - lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_STOP, 1); - - if (priv->mesh_tlv) { - sprintf(priv->mesh_ssid, "mesh"); - priv->mesh_ssid_len = 4; - ret = 1; - } - - lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret); - return ret; -} - -void lbs_start_mesh(struct lbs_private *priv) -{ - lbs_add_mesh(priv); - - if (device_create_file(&priv->dev->dev, &dev_attr_lbs_mesh)) - netdev_err(priv->dev, "cannot register lbs_mesh attribute\n"); -} - -int lbs_deinit_mesh(struct lbs_private *priv) -{ - struct net_device *dev = priv->dev; - int ret = 0; - - lbs_deb_enter(LBS_DEB_MESH); - - if (priv->mesh_tlv) { - device_remove_file(&dev->dev, &dev_attr_lbs_mesh); - ret = 1; - } - - lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret); - return ret; -} - - -/** - * lbs_mesh_stop - close the mshX interface - * - * @dev: A pointer to &net_device structure - * returns: 0 - */ -static int lbs_mesh_stop(struct net_device *dev) -{ - struct lbs_private *priv = dev->ml_priv; - - lbs_deb_enter(LBS_DEB_MESH); - lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_STOP, - lbs_mesh_get_channel(priv)); - - spin_lock_irq(&priv->driver_lock); - - netif_stop_queue(dev); - netif_carrier_off(dev); - - spin_unlock_irq(&priv->driver_lock); - - lbs_update_mcast(priv); - if (!lbs_iface_active(priv)) - lbs_stop_iface(priv); - - lbs_deb_leave(LBS_DEB_MESH); - return 0; -} - -/** - * lbs_mesh_dev_open - open the mshX interface - * - * @dev: A pointer to &net_device structure - * returns: 0 or -EBUSY if monitor mode active - */ -static int lbs_mesh_dev_open(struct net_device *dev) -{ - struct lbs_private *priv = dev->ml_priv; - int ret = 0; - - lbs_deb_enter(LBS_DEB_NET); - if (!priv->iface_running) { - ret = lbs_start_iface(priv); - if (ret) - goto out; - } - - spin_lock_irq(&priv->driver_lock); - - if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) { - ret = -EBUSY; - spin_unlock_irq(&priv->driver_lock); - goto out; - } - - netif_carrier_on(dev); - - if (!priv->tx_pending_len) - netif_wake_queue(dev); - - spin_unlock_irq(&priv->driver_lock); - - ret = lbs_mesh_config(priv, CMD_ACT_MESH_CONFIG_START, - lbs_mesh_get_channel(priv)); - -out: - lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); - return ret; -} - -static const struct net_device_ops mesh_netdev_ops = { - .ndo_open = lbs_mesh_dev_open, - .ndo_stop = lbs_mesh_stop, - .ndo_start_xmit = lbs_hard_start_xmit, - .ndo_set_mac_address = lbs_set_mac_address, - .ndo_set_rx_mode = lbs_set_multicast_list, -}; - -/** - * lbs_add_mesh - add mshX interface - * - * @priv: A pointer to the &struct lbs_private structure - * returns: 0 if successful, -X otherwise - */ -static int lbs_add_mesh(struct lbs_private *priv) -{ - struct net_device *mesh_dev = NULL; - struct wireless_dev *mesh_wdev; - int ret = 0; - - lbs_deb_enter(LBS_DEB_MESH); - - /* Allocate a virtual mesh device */ - mesh_wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); - if (!mesh_wdev) { - lbs_deb_mesh("init mshX wireless device failed\n"); - ret = -ENOMEM; - goto done; - } - - mesh_dev = alloc_netdev(0, "msh%d", ether_setup); - if (!mesh_dev) { - lbs_deb_mesh("init mshX device failed\n"); - ret = -ENOMEM; - goto err_free_wdev; - } - - mesh_wdev->iftype = NL80211_IFTYPE_MESH_POINT; - mesh_wdev->wiphy = priv->wdev->wiphy; - mesh_wdev->netdev = mesh_dev; - - mesh_dev->ml_priv = priv; - mesh_dev->ieee80211_ptr = mesh_wdev; - priv->mesh_dev = mesh_dev; - - mesh_dev->netdev_ops = &mesh_netdev_ops; - mesh_dev->ethtool_ops = &lbs_ethtool_ops; - memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, ETH_ALEN); - - SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); - - mesh_dev->flags |= IFF_BROADCAST | IFF_MULTICAST; - /* Register virtual mesh interface */ - ret = register_netdev(mesh_dev); - if (ret) { - pr_err("cannot register mshX virtual interface\n"); - goto err_free_netdev; - } - - ret = sysfs_create_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group); - if (ret) - goto err_unregister; - - lbs_persist_config_init(mesh_dev); - - /* Everything successful */ - ret = 0; - goto done; - -err_unregister: - unregister_netdev(mesh_dev); - -err_free_netdev: - free_netdev(mesh_dev); - -err_free_wdev: - kfree(mesh_wdev); - -done: - lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret); - return ret; -} - -void lbs_remove_mesh(struct lbs_private *priv) -{ - struct net_device *mesh_dev; - - mesh_dev = priv->mesh_dev; - if (!mesh_dev) - return; - - lbs_deb_enter(LBS_DEB_MESH); - netif_stop_queue(mesh_dev); - netif_carrier_off(mesh_dev); - sysfs_remove_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group); - lbs_persist_config_remove(mesh_dev); - unregister_netdev(mesh_dev); - priv->mesh_dev = NULL; - kfree(mesh_dev->ieee80211_ptr); - free_netdev(mesh_dev); - lbs_deb_leave(LBS_DEB_MESH); -} - - -/*************************************************************************** - * Sending and receiving - */ -struct net_device *lbs_mesh_set_dev(struct lbs_private *priv, - struct net_device *dev, struct rxpd *rxpd) -{ - if (priv->mesh_dev) { - if (priv->mesh_tlv == TLV_TYPE_OLD_MESH_ID) { - if (rxpd->rx_control & RxPD_MESH_FRAME) - dev = priv->mesh_dev; - } else if (priv->mesh_tlv == TLV_TYPE_MESH_ID) { - if (rxpd->u.bss.bss_num == MESH_IFACE_ID) - dev = priv->mesh_dev; - } - } - return dev; -} - - -void lbs_mesh_set_txpd(struct lbs_private *priv, - struct net_device *dev, struct txpd *txpd) -{ - if (dev == priv->mesh_dev) { - if (priv->mesh_tlv == TLV_TYPE_OLD_MESH_ID) - txpd->tx_control |= cpu_to_le32(TxPD_MESH_FRAME); - else if (priv->mesh_tlv == TLV_TYPE_MESH_ID) - txpd->u.bss.bss_num = MESH_IFACE_ID; - } -} - - -/*************************************************************************** - * Ethtool related - */ - -static const char * const mesh_stat_strings[] = { - "drop_duplicate_bcast", - "drop_ttl_zero", - "drop_no_fwd_route", - "drop_no_buffers", - "fwded_unicast_cnt", - "fwded_bcast_cnt", - "drop_blind_table", - "tx_failed_cnt" -}; - -void lbs_mesh_ethtool_get_stats(struct net_device *dev, - struct ethtool_stats *stats, uint64_t *data) -{ - struct lbs_private *priv = dev->ml_priv; - struct cmd_ds_mesh_access mesh_access; - int ret; - - lbs_deb_enter(LBS_DEB_ETHTOOL); - - /* Get Mesh Statistics */ - ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_STATS, &mesh_access); - - if (ret) { - memset(data, 0, MESH_STATS_NUM*(sizeof(uint64_t))); - return; - } - - priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]); - priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]); - priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]); - priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]); - priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]); - priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]); - priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]); - priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]); - - data[0] = priv->mstats.fwd_drop_rbt; - data[1] = priv->mstats.fwd_drop_ttl; - data[2] = priv->mstats.fwd_drop_noroute; - data[3] = priv->mstats.fwd_drop_nobuf; - data[4] = priv->mstats.fwd_unicast_cnt; - data[5] = priv->mstats.fwd_bcast_cnt; - data[6] = priv->mstats.drop_blind; - data[7] = priv->mstats.tx_failed_cnt; - - lbs_deb_enter(LBS_DEB_ETHTOOL); -} - -int lbs_mesh_ethtool_get_sset_count(struct net_device *dev, int sset) -{ - struct lbs_private *priv = dev->ml_priv; - - if (sset == ETH_SS_STATS && dev == priv->mesh_dev) - return MESH_STATS_NUM; - - return -EOPNOTSUPP; -} - -void lbs_mesh_ethtool_get_strings(struct net_device *dev, - uint32_t stringset, uint8_t *s) -{ - int i; - - lbs_deb_enter(LBS_DEB_ETHTOOL); - - switch (stringset) { - case ETH_SS_STATS: - for (i = 0; i < MESH_STATS_NUM; i++) { - memcpy(s + i * ETH_GSTRING_LEN, - mesh_stat_strings[i], - ETH_GSTRING_LEN); - } - break; - } - lbs_deb_enter(LBS_DEB_ETHTOOL); -} diff --git a/drivers/net/wireless/libertas/mesh.h b/drivers/net/wireless/libertas/mesh.h deleted file mode 100644 index 6603f341c874..000000000000 --- a/drivers/net/wireless/libertas/mesh.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Contains all definitions needed for the Libertas' MESH implementation. - */ -#ifndef _LBS_MESH_H_ -#define _LBS_MESH_H_ - - -#include -#include - -#include "host.h" -#include "dev.h" - -#ifdef CONFIG_LIBERTAS_MESH - -struct net_device; - -int lbs_init_mesh(struct lbs_private *priv); -void lbs_start_mesh(struct lbs_private *priv); -int lbs_deinit_mesh(struct lbs_private *priv); - -void lbs_remove_mesh(struct lbs_private *priv); - -static inline bool lbs_mesh_activated(struct lbs_private *priv) -{ - /* Mesh SSID is only programmed after successful init */ - return priv->mesh_ssid_len != 0; -} - -int lbs_mesh_set_channel(struct lbs_private *priv, u8 channel); - -/* Sending / Receiving */ - -struct rxpd; -struct txpd; - -struct net_device *lbs_mesh_set_dev(struct lbs_private *priv, - struct net_device *dev, struct rxpd *rxpd); -void lbs_mesh_set_txpd(struct lbs_private *priv, - struct net_device *dev, struct txpd *txpd); - - -/* Command handling */ - -struct cmd_ds_command; -struct cmd_ds_mesh_access; -struct cmd_ds_mesh_config; - - -/* Ethtool statistics */ - -struct ethtool_stats; - -void lbs_mesh_ethtool_get_stats(struct net_device *dev, - struct ethtool_stats *stats, uint64_t *data); -int lbs_mesh_ethtool_get_sset_count(struct net_device *dev, int sset); -void lbs_mesh_ethtool_get_strings(struct net_device *dev, - uint32_t stringset, uint8_t *s); - - -#else - -#define lbs_init_mesh(priv) -#define lbs_deinit_mesh(priv) -#define lbs_start_mesh(priv) -#define lbs_add_mesh(priv) -#define lbs_remove_mesh(priv) -#define lbs_mesh_set_dev(priv, dev, rxpd) (dev) -#define lbs_mesh_set_txpd(priv, dev, txpd) -#define lbs_mesh_set_channel(priv, channel) (0) -#define lbs_mesh_activated(priv) (false) - -#endif - - - -#endif diff --git a/drivers/net/wireless/libertas/radiotap.h b/drivers/net/wireless/libertas/radiotap.h deleted file mode 100644 index b3c8ea6d610e..000000000000 --- a/drivers/net/wireless/libertas/radiotap.h +++ /dev/null @@ -1,44 +0,0 @@ -#include - -struct tx_radiotap_hdr { - struct ieee80211_radiotap_header hdr; - u8 rate; - u8 txpower; - u8 rts_retries; - u8 data_retries; -} __packed; - -#define TX_RADIOTAP_PRESENT ( \ - (1 << IEEE80211_RADIOTAP_RATE) | \ - (1 << IEEE80211_RADIOTAP_DBM_TX_POWER) | \ - (1 << IEEE80211_RADIOTAP_RTS_RETRIES) | \ - (1 << IEEE80211_RADIOTAP_DATA_RETRIES) | \ - 0) - -#define IEEE80211_FC_VERSION_MASK 0x0003 -#define IEEE80211_FC_TYPE_MASK 0x000c -#define IEEE80211_FC_TYPE_MGT 0x0000 -#define IEEE80211_FC_TYPE_CTL 0x0004 -#define IEEE80211_FC_TYPE_DATA 0x0008 -#define IEEE80211_FC_SUBTYPE_MASK 0x00f0 -#define IEEE80211_FC_TOFROMDS_MASK 0x0300 -#define IEEE80211_FC_TODS_MASK 0x0100 -#define IEEE80211_FC_FROMDS_MASK 0x0200 -#define IEEE80211_FC_NODS 0x0000 -#define IEEE80211_FC_TODS 0x0100 -#define IEEE80211_FC_FROMDS 0x0200 -#define IEEE80211_FC_DSTODS 0x0300 - -struct rx_radiotap_hdr { - struct ieee80211_radiotap_header hdr; - u8 flags; - u8 rate; - u8 antsignal; -} __packed; - -#define RX_RADIOTAP_PRESENT ( \ - (1 << IEEE80211_RADIOTAP_FLAGS) | \ - (1 << IEEE80211_RADIOTAP_RATE) | \ - (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) |\ - 0) - diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c deleted file mode 100644 index c7366b07b568..000000000000 --- a/drivers/net/wireless/libertas/rx.c +++ /dev/null @@ -1,284 +0,0 @@ -/* - * This file contains the handling of RX in wlan driver. - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include - -#include "defs.h" -#include "host.h" -#include "radiotap.h" -#include "decl.h" -#include "dev.h" -#include "mesh.h" - -struct eth803hdr { - u8 dest_addr[6]; - u8 src_addr[6]; - u16 h803_len; -} __packed; - -struct rfc1042hdr { - u8 llc_dsap; - u8 llc_ssap; - u8 llc_ctrl; - u8 snap_oui[3]; - u16 snap_type; -} __packed; - -struct rxpackethdr { - struct eth803hdr eth803_hdr; - struct rfc1042hdr rfc1042_hdr; -} __packed; - -struct rx80211packethdr { - struct rxpd rx_pd; - void *eth80211_hdr; -} __packed; - -static int process_rxed_802_11_packet(struct lbs_private *priv, - struct sk_buff *skb); - -/** - * lbs_process_rxed_packet - processes received packet and forwards it - * to kernel/upper layer - * - * @priv: A pointer to &struct lbs_private - * @skb: A pointer to skb which includes the received packet - * returns: 0 or -1 - */ -int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) -{ - int ret = 0; - struct net_device *dev = priv->dev; - struct rxpackethdr *p_rx_pkt; - struct rxpd *p_rx_pd; - int hdrchop; - struct ethhdr *p_ethhdr; - static const u8 rfc1042_eth_hdr[] = { - 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 - }; - - lbs_deb_enter(LBS_DEB_RX); - - BUG_ON(!skb); - - skb->ip_summed = CHECKSUM_NONE; - - if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) - return process_rxed_802_11_packet(priv, skb); - - p_rx_pd = (struct rxpd *) skb->data; - p_rx_pkt = (struct rxpackethdr *) ((u8 *)p_rx_pd + - le32_to_cpu(p_rx_pd->pkt_ptr)); - - dev = lbs_mesh_set_dev(priv, dev, p_rx_pd); - - lbs_deb_hex(LBS_DEB_RX, "RX Data: Before chop rxpd", skb->data, - min_t(unsigned int, skb->len, 100)); - - if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { - lbs_deb_rx("rx err: frame received with bad length\n"); - dev->stats.rx_length_errors++; - ret = 0; - dev_kfree_skb(skb); - goto done; - } - - lbs_deb_rx("rx data: skb->len - pkt_ptr = %d-%zd = %zd\n", - skb->len, (size_t)le32_to_cpu(p_rx_pd->pkt_ptr), - skb->len - (size_t)le32_to_cpu(p_rx_pd->pkt_ptr)); - - lbs_deb_hex(LBS_DEB_RX, "RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr, - sizeof(p_rx_pkt->eth803_hdr.dest_addr)); - lbs_deb_hex(LBS_DEB_RX, "RX Data: Src", p_rx_pkt->eth803_hdr.src_addr, - sizeof(p_rx_pkt->eth803_hdr.src_addr)); - - if (memcmp(&p_rx_pkt->rfc1042_hdr, - rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr)) == 0) { - /* - * Replace the 803 header and rfc1042 header (llc/snap) with an - * EthernetII header, keep the src/dst and snap_type (ethertype) - * - * The firmware only passes up SNAP frames converting - * all RX Data from 802.11 to 802.2/LLC/SNAP frames. - * - * To create the Ethernet II, just move the src, dst address right - * before the snap_type. - */ - p_ethhdr = (struct ethhdr *) - ((u8 *) &p_rx_pkt->eth803_hdr - + sizeof(p_rx_pkt->eth803_hdr) + sizeof(p_rx_pkt->rfc1042_hdr) - - sizeof(p_rx_pkt->eth803_hdr.dest_addr) - - sizeof(p_rx_pkt->eth803_hdr.src_addr) - - sizeof(p_rx_pkt->rfc1042_hdr.snap_type)); - - memcpy(p_ethhdr->h_source, p_rx_pkt->eth803_hdr.src_addr, - sizeof(p_ethhdr->h_source)); - memcpy(p_ethhdr->h_dest, p_rx_pkt->eth803_hdr.dest_addr, - sizeof(p_ethhdr->h_dest)); - - /* Chop off the rxpd + the excess memory from the 802.2/llc/snap header - * that was removed - */ - hdrchop = (u8 *)p_ethhdr - (u8 *)p_rx_pd; - } else { - lbs_deb_hex(LBS_DEB_RX, "RX Data: LLC/SNAP", - (u8 *) &p_rx_pkt->rfc1042_hdr, - sizeof(p_rx_pkt->rfc1042_hdr)); - - /* Chop off the rxpd */ - hdrchop = (u8 *)&p_rx_pkt->eth803_hdr - (u8 *)p_rx_pd; - } - - /* Chop off the leading header bytes so the skb points to the start of - * either the reconstructed EthII frame or the 802.2/llc/snap frame - */ - skb_pull(skb, hdrchop); - - priv->cur_rate = lbs_fw_index_to_data_rate(p_rx_pd->rx_rate); - - lbs_deb_rx("rx data: size of actual packet %d\n", skb->len); - dev->stats.rx_bytes += skb->len; - dev->stats.rx_packets++; - - skb->protocol = eth_type_trans(skb, dev); - if (in_interrupt()) - netif_rx(skb); - else - netif_rx_ni(skb); - - ret = 0; -done: - lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret); - return ret; -} -EXPORT_SYMBOL_GPL(lbs_process_rxed_packet); - -/** - * convert_mv_rate_to_radiotap - converts Tx/Rx rates from Marvell WLAN format - * (see Table 2 in Section 3.1) to IEEE80211_RADIOTAP_RATE units (500 Kb/s) - * - * @rate: Input rate - * returns: Output Rate (0 if invalid) - */ -static u8 convert_mv_rate_to_radiotap(u8 rate) -{ - switch (rate) { - case 0: /* 1 Mbps */ - return 2; - case 1: /* 2 Mbps */ - return 4; - case 2: /* 5.5 Mbps */ - return 11; - case 3: /* 11 Mbps */ - return 22; - /* case 4: reserved */ - case 5: /* 6 Mbps */ - return 12; - case 6: /* 9 Mbps */ - return 18; - case 7: /* 12 Mbps */ - return 24; - case 8: /* 18 Mbps */ - return 36; - case 9: /* 24 Mbps */ - return 48; - case 10: /* 36 Mbps */ - return 72; - case 11: /* 48 Mbps */ - return 96; - case 12: /* 54 Mbps */ - return 108; - } - pr_alert("Invalid Marvell WLAN rate %i\n", rate); - return 0; -} - -/** - * process_rxed_802_11_packet - processes a received 802.11 packet and forwards - * it to kernel/upper layer - * - * @priv: A pointer to &struct lbs_private - * @skb: A pointer to skb which includes the received packet - * returns: 0 or -1 - */ -static int process_rxed_802_11_packet(struct lbs_private *priv, - struct sk_buff *skb) -{ - int ret = 0; - struct net_device *dev = priv->dev; - struct rx80211packethdr *p_rx_pkt; - struct rxpd *prxpd; - struct rx_radiotap_hdr radiotap_hdr; - struct rx_radiotap_hdr *pradiotap_hdr; - - lbs_deb_enter(LBS_DEB_RX); - - p_rx_pkt = (struct rx80211packethdr *) skb->data; - prxpd = &p_rx_pkt->rx_pd; - - /* lbs_deb_hex(LBS_DEB_RX, "RX Data: Before chop rxpd", skb->data, min(skb->len, 100)); */ - - if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { - lbs_deb_rx("rx err: frame received with bad length\n"); - dev->stats.rx_length_errors++; - ret = -EINVAL; - kfree_skb(skb); - goto done; - } - - lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n", - skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); - - /* create the exported radio header */ - - /* radiotap header */ - memset(&radiotap_hdr, 0, sizeof(radiotap_hdr)); - /* XXX must check radiotap_hdr.hdr.it_pad for pad */ - radiotap_hdr.hdr.it_len = cpu_to_le16 (sizeof(struct rx_radiotap_hdr)); - radiotap_hdr.hdr.it_present = cpu_to_le32 (RX_RADIOTAP_PRESENT); - radiotap_hdr.rate = convert_mv_rate_to_radiotap(prxpd->rx_rate); - /* XXX must check no carryout */ - radiotap_hdr.antsignal = prxpd->snr + prxpd->nf; - - /* chop the rxpd */ - skb_pull(skb, sizeof(struct rxpd)); - - /* add space for the new radio header */ - if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) && - pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0, GFP_ATOMIC)) { - netdev_alert(dev, "%s: couldn't pskb_expand_head\n", __func__); - ret = -ENOMEM; - kfree_skb(skb); - goto done; - } - - pradiotap_hdr = (void *)skb_push(skb, sizeof(struct rx_radiotap_hdr)); - memcpy(pradiotap_hdr, &radiotap_hdr, sizeof(struct rx_radiotap_hdr)); - - priv->cur_rate = lbs_fw_index_to_data_rate(prxpd->rx_rate); - - lbs_deb_rx("rx data: size of actual packet %d\n", skb->len); - dev->stats.rx_bytes += skb->len; - dev->stats.rx_packets++; - - skb->protocol = eth_type_trans(skb, priv->dev); - - if (in_interrupt()) - netif_rx(skb); - else - netif_rx_ni(skb); - - ret = 0; - -done: - lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret); - return ret; -} diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c deleted file mode 100644 index c025f9c18282..000000000000 --- a/drivers/net/wireless/libertas/tx.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * This file contains the handling of TX in wlan driver. - */ -#include -#include -#include -#include -#include -#include - -#include "host.h" -#include "radiotap.h" -#include "decl.h" -#include "defs.h" -#include "dev.h" -#include "mesh.h" - -/** - * convert_radiotap_rate_to_mv - converts Tx/Rx rates from IEEE80211_RADIOTAP_RATE - * units (500 Kb/s) into Marvell WLAN format (see Table 8 in Section 3.2.1) - * - * @rate: Input rate - * returns: Output Rate (0 if invalid) - */ -static u32 convert_radiotap_rate_to_mv(u8 rate) -{ - switch (rate) { - case 2: /* 1 Mbps */ - return 0 | (1 << 4); - case 4: /* 2 Mbps */ - return 1 | (1 << 4); - case 11: /* 5.5 Mbps */ - return 2 | (1 << 4); - case 22: /* 11 Mbps */ - return 3 | (1 << 4); - case 12: /* 6 Mbps */ - return 4 | (1 << 4); - case 18: /* 9 Mbps */ - return 5 | (1 << 4); - case 24: /* 12 Mbps */ - return 6 | (1 << 4); - case 36: /* 18 Mbps */ - return 7 | (1 << 4); - case 48: /* 24 Mbps */ - return 8 | (1 << 4); - case 72: /* 36 Mbps */ - return 9 | (1 << 4); - case 96: /* 48 Mbps */ - return 10 | (1 << 4); - case 108: /* 54 Mbps */ - return 11 | (1 << 4); - } - return 0; -} - -/** - * lbs_hard_start_xmit - checks the conditions and sends packet to IF - * layer if everything is ok - * - * @skb: A pointer to skb which includes TX packet - * @dev: A pointer to the &struct net_device - * returns: 0 or -1 - */ -netdev_tx_t lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) -{ - unsigned long flags; - struct lbs_private *priv = dev->ml_priv; - struct txpd *txpd; - char *p802x_hdr; - uint16_t pkt_len; - netdev_tx_t ret = NETDEV_TX_OK; - - lbs_deb_enter(LBS_DEB_TX); - - /* We need to protect against the queues being restarted before - we get round to stopping them */ - spin_lock_irqsave(&priv->driver_lock, flags); - - if (priv->surpriseremoved) - goto free; - - if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { - lbs_deb_tx("tx err: skb length %d 0 or > %zd\n", - skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); - /* We'll never manage to send this one; drop it and return 'OK' */ - - dev->stats.tx_dropped++; - dev->stats.tx_errors++; - goto free; - } - - - netif_stop_queue(priv->dev); - if (priv->mesh_dev) - netif_stop_queue(priv->mesh_dev); - - if (priv->tx_pending_len) { - /* This can happen if packets come in on the mesh and eth - device simultaneously -- there's no mutual exclusion on - hard_start_xmit() calls between devices. */ - lbs_deb_tx("Packet on %s while busy\n", dev->name); - ret = NETDEV_TX_BUSY; - goto unlock; - } - - priv->tx_pending_len = -1; - spin_unlock_irqrestore(&priv->driver_lock, flags); - - lbs_deb_hex(LBS_DEB_TX, "TX Data", skb->data, min_t(unsigned int, skb->len, 100)); - - txpd = (void *)priv->tx_pending_buf; - memset(txpd, 0, sizeof(struct txpd)); - - p802x_hdr = skb->data; - pkt_len = skb->len; - - if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) { - struct tx_radiotap_hdr *rtap_hdr = (void *)skb->data; - - /* set txpd fields from the radiotap header */ - txpd->tx_control = cpu_to_le32(convert_radiotap_rate_to_mv(rtap_hdr->rate)); - - /* skip the radiotap header */ - p802x_hdr += sizeof(*rtap_hdr); - pkt_len -= sizeof(*rtap_hdr); - - /* copy destination address from 802.11 header */ - memcpy(txpd->tx_dest_addr_high, p802x_hdr + 4, ETH_ALEN); - } else { - /* copy destination address from 802.3 header */ - memcpy(txpd->tx_dest_addr_high, p802x_hdr, ETH_ALEN); - } - - txpd->tx_packet_length = cpu_to_le16(pkt_len); - txpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd)); - - lbs_mesh_set_txpd(priv, dev, txpd); - - lbs_deb_hex(LBS_DEB_TX, "txpd", (u8 *) &txpd, sizeof(struct txpd)); - - lbs_deb_hex(LBS_DEB_TX, "Tx Data", (u8 *) p802x_hdr, le16_to_cpu(txpd->tx_packet_length)); - - memcpy(&txpd[1], p802x_hdr, le16_to_cpu(txpd->tx_packet_length)); - - spin_lock_irqsave(&priv->driver_lock, flags); - priv->tx_pending_len = pkt_len + sizeof(struct txpd); - - lbs_deb_tx("%s lined up packet\n", __func__); - - dev->stats.tx_packets++; - dev->stats.tx_bytes += skb->len; - - if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) { - /* Keep the skb to echo it back once Tx feedback is - received from FW */ - skb_orphan(skb); - - /* Keep the skb around for when we get feedback */ - priv->currenttxskb = skb; - } else { - free: - dev_kfree_skb_any(skb); - } - - unlock: - spin_unlock_irqrestore(&priv->driver_lock, flags); - wake_up(&priv->waitq); - - lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); - return ret; -} - -/** - * lbs_send_tx_feedback - sends to the host the last transmitted packet, - * filling the radiotap headers with transmission information. - * - * @priv: A pointer to &struct lbs_private structure - * @try_count: A 32-bit value containing transmission retry status. - * - * returns: void - */ -void lbs_send_tx_feedback(struct lbs_private *priv, u32 try_count) -{ - struct tx_radiotap_hdr *radiotap_hdr; - - if (priv->wdev->iftype != NL80211_IFTYPE_MONITOR || - priv->currenttxskb == NULL) - return; - - radiotap_hdr = (struct tx_radiotap_hdr *)priv->currenttxskb->data; - - radiotap_hdr->data_retries = try_count ? - (1 + priv->txretrycount - try_count) : 0; - - priv->currenttxskb->protocol = eth_type_trans(priv->currenttxskb, - priv->dev); - netif_rx(priv->currenttxskb); - - priv->currenttxskb = NULL; - - if (priv->connect_status == LBS_CONNECTED) - netif_wake_queue(priv->dev); - - if (priv->mesh_dev && netif_running(priv->mesh_dev)) - netif_wake_queue(priv->mesh_dev); -} -EXPORT_SYMBOL_GPL(lbs_send_tx_feedback); diff --git a/drivers/net/wireless/libertas/types.h b/drivers/net/wireless/libertas/types.h deleted file mode 100644 index cf1d9b047ee6..000000000000 --- a/drivers/net/wireless/libertas/types.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * This header file contains definition for global types - */ -#ifndef _LBS_TYPES_H_ -#define _LBS_TYPES_H_ - -#include -#include -#include - -struct ieee_ie_header { - u8 id; - u8 len; -} __packed; - -struct ieee_ie_cf_param_set { - struct ieee_ie_header header; - - u8 cfpcnt; - u8 cfpperiod; - __le16 cfpmaxduration; - __le16 cfpdurationremaining; -} __packed; - - -struct ieee_ie_ibss_param_set { - struct ieee_ie_header header; - - __le16 atimwindow; -} __packed; - -union ieee_ss_param_set { - struct ieee_ie_cf_param_set cf; - struct ieee_ie_ibss_param_set ibss; -} __packed; - -struct ieee_ie_fh_param_set { - struct ieee_ie_header header; - - __le16 dwelltime; - u8 hopset; - u8 hoppattern; - u8 hopindex; -} __packed; - -struct ieee_ie_ds_param_set { - struct ieee_ie_header header; - - u8 channel; -} __packed; - -union ieee_phy_param_set { - struct ieee_ie_fh_param_set fh; - struct ieee_ie_ds_param_set ds; -} __packed; - -/* TLV type ID definition */ -#define PROPRIETARY_TLV_BASE_ID 0x0100 - -/* Terminating TLV type */ -#define MRVL_TERMINATE_TLV_ID 0xffff - -#define TLV_TYPE_SSID 0x0000 -#define TLV_TYPE_RATES 0x0001 -#define TLV_TYPE_PHY_FH 0x0002 -#define TLV_TYPE_PHY_DS 0x0003 -#define TLV_TYPE_CF 0x0004 -#define TLV_TYPE_IBSS 0x0006 - -#define TLV_TYPE_DOMAIN 0x0007 - -#define TLV_TYPE_POWER_CAPABILITY 0x0021 - -#define TLV_TYPE_KEY_MATERIAL (PROPRIETARY_TLV_BASE_ID + 0) -#define TLV_TYPE_CHANLIST (PROPRIETARY_TLV_BASE_ID + 1) -#define TLV_TYPE_NUMPROBES (PROPRIETARY_TLV_BASE_ID + 2) -#define TLV_TYPE_RSSI_LOW (PROPRIETARY_TLV_BASE_ID + 4) -#define TLV_TYPE_SNR_LOW (PROPRIETARY_TLV_BASE_ID + 5) -#define TLV_TYPE_FAILCOUNT (PROPRIETARY_TLV_BASE_ID + 6) -#define TLV_TYPE_BCNMISS (PROPRIETARY_TLV_BASE_ID + 7) -#define TLV_TYPE_LED_GPIO (PROPRIETARY_TLV_BASE_ID + 8) -#define TLV_TYPE_LEDBEHAVIOR (PROPRIETARY_TLV_BASE_ID + 9) -#define TLV_TYPE_PASSTHROUGH (PROPRIETARY_TLV_BASE_ID + 10) -#define TLV_TYPE_REASSOCAP (PROPRIETARY_TLV_BASE_ID + 11) -#define TLV_TYPE_POWER_TBL_2_4GHZ (PROPRIETARY_TLV_BASE_ID + 12) -#define TLV_TYPE_POWER_TBL_5GHZ (PROPRIETARY_TLV_BASE_ID + 13) -#define TLV_TYPE_BCASTPROBE (PROPRIETARY_TLV_BASE_ID + 14) -#define TLV_TYPE_NUMSSID_PROBE (PROPRIETARY_TLV_BASE_ID + 15) -#define TLV_TYPE_WMMQSTATUS (PROPRIETARY_TLV_BASE_ID + 16) -#define TLV_TYPE_CRYPTO_DATA (PROPRIETARY_TLV_BASE_ID + 17) -#define TLV_TYPE_WILDCARDSSID (PROPRIETARY_TLV_BASE_ID + 18) -#define TLV_TYPE_TSFTIMESTAMP (PROPRIETARY_TLV_BASE_ID + 19) -#define TLV_TYPE_RSSI_HIGH (PROPRIETARY_TLV_BASE_ID + 22) -#define TLV_TYPE_SNR_HIGH (PROPRIETARY_TLV_BASE_ID + 23) -#define TLV_TYPE_AUTH_TYPE (PROPRIETARY_TLV_BASE_ID + 31) -#define TLV_TYPE_MESH_ID (PROPRIETARY_TLV_BASE_ID + 37) -#define TLV_TYPE_OLD_MESH_ID (PROPRIETARY_TLV_BASE_ID + 291) - -/* TLV related data structures */ -struct mrvl_ie_header { - __le16 type; - __le16 len; -} __packed; - -struct mrvl_ie_data { - struct mrvl_ie_header header; - u8 Data[1]; -} __packed; - -struct mrvl_ie_rates_param_set { - struct mrvl_ie_header header; - u8 rates[1]; -} __packed; - -struct mrvl_ie_ssid_param_set { - struct mrvl_ie_header header; - u8 ssid[1]; -} __packed; - -struct mrvl_ie_wildcard_ssid_param_set { - struct mrvl_ie_header header; - u8 MaxSsidlength; - u8 ssid[1]; -} __packed; - -struct chanscanmode { -#ifdef __BIG_ENDIAN_BITFIELD - u8 reserved_2_7:6; - u8 disablechanfilt:1; - u8 passivescan:1; -#else - u8 passivescan:1; - u8 disablechanfilt:1; - u8 reserved_2_7:6; -#endif -} __packed; - -struct chanscanparamset { - u8 radiotype; - u8 channumber; - struct chanscanmode chanscanmode; - __le16 minscantime; - __le16 maxscantime; -} __packed; - -struct mrvl_ie_chanlist_param_set { - struct mrvl_ie_header header; - struct chanscanparamset chanscanparam[1]; -} __packed; - -struct mrvl_ie_cf_param_set { - struct mrvl_ie_header header; - u8 cfpcnt; - u8 cfpperiod; - __le16 cfpmaxduration; - __le16 cfpdurationremaining; -} __packed; - -struct mrvl_ie_ds_param_set { - struct mrvl_ie_header header; - u8 channel; -} __packed; - -struct mrvl_ie_rsn_param_set { - struct mrvl_ie_header header; - u8 rsnie[1]; -} __packed; - -struct mrvl_ie_tsf_timestamp { - struct mrvl_ie_header header; - __le64 tsftable[1]; -} __packed; - -/* v9 and later firmware only */ -struct mrvl_ie_auth_type { - struct mrvl_ie_header header; - __le16 auth; -} __packed; - -/* Local Power capability */ -struct mrvl_ie_power_capability { - struct mrvl_ie_header header; - s8 minpower; - s8 maxpower; -} __packed; - -/* used in CMD_802_11_SUBSCRIBE_EVENT for SNR, RSSI and Failure */ -struct mrvl_ie_thresholds { - struct mrvl_ie_header header; - u8 value; - u8 freq; -} __packed; - -struct mrvl_ie_beacons_missed { - struct mrvl_ie_header header; - u8 beaconmissed; - u8 reserved; -} __packed; - -struct mrvl_ie_num_probes { - struct mrvl_ie_header header; - __le16 numprobes; -} __packed; - -struct mrvl_ie_bcast_probe { - struct mrvl_ie_header header; - __le16 bcastprobe; -} __packed; - -struct mrvl_ie_num_ssid_probe { - struct mrvl_ie_header header; - __le16 numssidprobe; -} __packed; - -struct led_pin { - u8 led; - u8 pin; -} __packed; - -struct mrvl_ie_ledgpio { - struct mrvl_ie_header header; - struct led_pin ledpin[1]; -} __packed; - -struct led_bhv { - uint8_t firmwarestate; - uint8_t led; - uint8_t ledstate; - uint8_t ledarg; -} __packed; - - -struct mrvl_ie_ledbhv { - struct mrvl_ie_header header; - struct led_bhv ledbhv[1]; -} __packed; - -/* - * Meant to be packed as the value member of a struct ieee80211_info_element. - * Note that the len member of the ieee80211_info_element varies depending on - * the mesh_id_len - */ -struct mrvl_meshie_val { - uint8_t oui[3]; - uint8_t type; - uint8_t subtype; - uint8_t version; - uint8_t active_protocol_id; - uint8_t active_metric_id; - uint8_t mesh_capability; - uint8_t mesh_id_len; - uint8_t mesh_id[IEEE80211_MAX_SSID_LEN]; -} __packed; - -struct mrvl_meshie { - u8 id, len; - struct mrvl_meshie_val val; -} __packed; - -struct mrvl_mesh_defaults { - __le32 bootflag; - uint8_t boottime; - uint8_t reserved; - __le16 channel; - struct mrvl_meshie meshie; -} __packed; - -#endif diff --git a/drivers/net/wireless/libertas_tf/Makefile b/drivers/net/wireless/libertas_tf/Makefile deleted file mode 100644 index ff5544d6ac9d..000000000000 --- a/drivers/net/wireless/libertas_tf/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -libertas_tf-objs := main.o cmd.o - -libertas_tf_usb-objs += if_usb.o - -obj-$(CONFIG_LIBERTAS_THINFIRM) += libertas_tf.o -obj-$(CONFIG_LIBERTAS_THINFIRM_USB) += libertas_tf_usb.o diff --git a/drivers/net/wireless/libertas_tf/cmd.c b/drivers/net/wireless/libertas_tf/cmd.c deleted file mode 100644 index 909ac3685010..000000000000 --- a/drivers/net/wireless/libertas_tf/cmd.c +++ /dev/null @@ -1,807 +0,0 @@ -/* - * Copyright (C) 2008, cozybit Inc. - * Copyright (C) 2003-2006, Marvell International Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include - -#include "libertas_tf.h" - -static const struct channel_range channel_ranges[] = { - { LBTF_REGDOMAIN_US, 1, 12 }, - { LBTF_REGDOMAIN_CA, 1, 12 }, - { LBTF_REGDOMAIN_EU, 1, 14 }, - { LBTF_REGDOMAIN_JP, 1, 14 }, - { LBTF_REGDOMAIN_SP, 1, 14 }, - { LBTF_REGDOMAIN_FR, 1, 14 }, -}; - -static u16 lbtf_region_code_to_index[MRVDRV_MAX_REGION_CODE] = -{ - LBTF_REGDOMAIN_US, LBTF_REGDOMAIN_CA, LBTF_REGDOMAIN_EU, - LBTF_REGDOMAIN_SP, LBTF_REGDOMAIN_FR, LBTF_REGDOMAIN_JP, -}; - -static struct cmd_ctrl_node *lbtf_get_cmd_ctrl_node(struct lbtf_private *priv); - - -/** - * lbtf_cmd_copyback - Simple callback that copies response back into command - * - * @priv A pointer to struct lbtf_private structure - * @extra A pointer to the original command structure for which - * 'resp' is a response - * @resp A pointer to the command response - * - * Returns: 0 on success, error on failure - */ -int lbtf_cmd_copyback(struct lbtf_private *priv, unsigned long extra, - struct cmd_header *resp) -{ - struct cmd_header *buf = (void *)extra; - uint16_t copy_len; - - copy_len = min(le16_to_cpu(buf->size), le16_to_cpu(resp->size)); - memcpy(buf, resp, copy_len); - return 0; -} -EXPORT_SYMBOL_GPL(lbtf_cmd_copyback); - -#define CHAN_TO_IDX(chan) ((chan) - 1) - -static void lbtf_geo_init(struct lbtf_private *priv) -{ - const struct channel_range *range = channel_ranges; - u8 ch; - int i; - - for (i = 0; i < ARRAY_SIZE(channel_ranges); i++) - if (channel_ranges[i].regdomain == priv->regioncode) { - range = &channel_ranges[i]; - break; - } - - for (ch = priv->range.start; ch < priv->range.end; ch++) - priv->channels[CHAN_TO_IDX(ch)].flags = 0; -} - -/** - * lbtf_update_hw_spec: Updates the hardware details. - * - * @priv A pointer to struct lbtf_private structure - * - * Returns: 0 on success, error on failure - */ -int lbtf_update_hw_spec(struct lbtf_private *priv) -{ - struct cmd_ds_get_hw_spec cmd; - int ret = -1; - u32 i; - - lbtf_deb_enter(LBTF_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - memcpy(cmd.permanentaddr, priv->current_addr, ETH_ALEN); - ret = lbtf_cmd_with_response(priv, CMD_GET_HW_SPEC, &cmd); - if (ret) - goto out; - - priv->fwcapinfo = le32_to_cpu(cmd.fwcapinfo); - - /* The firmware release is in an interesting format: the patch - * level is in the most significant nibble ... so fix that: */ - priv->fwrelease = le32_to_cpu(cmd.fwrelease); - priv->fwrelease = (priv->fwrelease << 8) | - (priv->fwrelease >> 24 & 0xff); - - printk(KERN_INFO "libertastf: %pM, fw %u.%u.%up%u, cap 0x%08x\n", - cmd.permanentaddr, - priv->fwrelease >> 24 & 0xff, - priv->fwrelease >> 16 & 0xff, - priv->fwrelease >> 8 & 0xff, - priv->fwrelease & 0xff, - priv->fwcapinfo); - lbtf_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n", - cmd.hwifversion, cmd.version); - - /* Clamp region code to 8-bit since FW spec indicates that it should - * only ever be 8-bit, even though the field size is 16-bit. Some - * firmware returns non-zero high 8 bits here. - */ - priv->regioncode = le16_to_cpu(cmd.regioncode) & 0xFF; - - for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { - /* use the region code to search for the index */ - if (priv->regioncode == lbtf_region_code_to_index[i]) - break; - } - - /* if it's unidentified region code, use the default (USA) */ - if (i >= MRVDRV_MAX_REGION_CODE) { - priv->regioncode = 0x10; - pr_info("unidentified region code; using the default (USA)\n"); - } - - if (priv->current_addr[0] == 0xff) - memmove(priv->current_addr, cmd.permanentaddr, ETH_ALEN); - - SET_IEEE80211_PERM_ADDR(priv->hw, priv->current_addr); - - lbtf_geo_init(priv); -out: - lbtf_deb_leave(LBTF_DEB_CMD); - return ret; -} - -/** - * lbtf_set_channel: Set the radio channel - * - * @priv A pointer to struct lbtf_private structure - * @channel The desired channel, or 0 to clear a locked channel - * - * Returns: 0 on success, error on failure - */ -int lbtf_set_channel(struct lbtf_private *priv, u8 channel) -{ - int ret = 0; - struct cmd_ds_802_11_rf_channel cmd; - - lbtf_deb_enter(LBTF_DEB_CMD); - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_SET); - cmd.channel = cpu_to_le16(channel); - - ret = lbtf_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, &cmd); - lbtf_deb_leave_args(LBTF_DEB_CMD, "ret %d", ret); - return ret; -} - -int lbtf_beacon_set(struct lbtf_private *priv, struct sk_buff *beacon) -{ - struct cmd_ds_802_11_beacon_set cmd; - int size; - - lbtf_deb_enter(LBTF_DEB_CMD); - - if (beacon->len > MRVL_MAX_BCN_SIZE) { - lbtf_deb_leave_args(LBTF_DEB_CMD, "ret %d", -1); - return -1; - } - size = sizeof(cmd) - sizeof(cmd.beacon) + beacon->len; - cmd.hdr.size = cpu_to_le16(size); - cmd.len = cpu_to_le16(beacon->len); - memcpy(cmd.beacon, (u8 *) beacon->data, beacon->len); - - lbtf_cmd_async(priv, CMD_802_11_BEACON_SET, &cmd.hdr, size); - - lbtf_deb_leave_args(LBTF_DEB_CMD, "ret %d", 0); - return 0; -} - -int lbtf_beacon_ctrl(struct lbtf_private *priv, bool beacon_enable, - int beacon_int) -{ - struct cmd_ds_802_11_beacon_control cmd; - lbtf_deb_enter(LBTF_DEB_CMD); - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - cmd.beacon_enable = cpu_to_le16(beacon_enable); - cmd.beacon_period = cpu_to_le16(beacon_int); - - lbtf_cmd_async(priv, CMD_802_11_BEACON_CTRL, &cmd.hdr, sizeof(cmd)); - - lbtf_deb_leave(LBTF_DEB_CMD); - return 0; -} - -static void lbtf_queue_cmd(struct lbtf_private *priv, - struct cmd_ctrl_node *cmdnode) -{ - unsigned long flags; - lbtf_deb_enter(LBTF_DEB_HOST); - - if (!cmdnode) { - lbtf_deb_host("QUEUE_CMD: cmdnode is NULL\n"); - goto qcmd_done; - } - - if (!cmdnode->cmdbuf->size) { - lbtf_deb_host("DNLD_CMD: cmd size is zero\n"); - goto qcmd_done; - } - - cmdnode->result = 0; - spin_lock_irqsave(&priv->driver_lock, flags); - list_add_tail(&cmdnode->list, &priv->cmdpendingq); - spin_unlock_irqrestore(&priv->driver_lock, flags); - - lbtf_deb_host("QUEUE_CMD: inserted command 0x%04x into cmdpendingq\n", - le16_to_cpu(cmdnode->cmdbuf->command)); - -qcmd_done: - lbtf_deb_leave(LBTF_DEB_HOST); -} - -static void lbtf_submit_command(struct lbtf_private *priv, - struct cmd_ctrl_node *cmdnode) -{ - unsigned long flags; - struct cmd_header *cmd; - uint16_t cmdsize; - uint16_t command; - int timeo = 5 * HZ; - int ret; - - lbtf_deb_enter(LBTF_DEB_HOST); - - cmd = cmdnode->cmdbuf; - - spin_lock_irqsave(&priv->driver_lock, flags); - priv->cur_cmd = cmdnode; - cmdsize = le16_to_cpu(cmd->size); - command = le16_to_cpu(cmd->command); - - lbtf_deb_cmd("DNLD_CMD: command 0x%04x, seq %d, size %d\n", - command, le16_to_cpu(cmd->seqnum), cmdsize); - lbtf_deb_hex(LBTF_DEB_CMD, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize); - - ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); - spin_unlock_irqrestore(&priv->driver_lock, flags); - - if (ret) { - pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret); - /* Let the timer kick in and retry, and potentially reset - the whole thing if the condition persists */ - timeo = HZ; - } - - /* Setup the timer after transmit command */ - mod_timer(&priv->command_timer, jiffies + timeo); - - lbtf_deb_leave(LBTF_DEB_HOST); -} - -/** - * This function inserts command node to cmdfreeq - * after cleans it. Requires priv->driver_lock held. - */ -static void __lbtf_cleanup_and_insert_cmd(struct lbtf_private *priv, - struct cmd_ctrl_node *cmdnode) -{ - lbtf_deb_enter(LBTF_DEB_HOST); - - if (!cmdnode) - goto cl_ins_out; - - cmdnode->callback = NULL; - cmdnode->callback_arg = 0; - - memset(cmdnode->cmdbuf, 0, LBS_CMD_BUFFER_SIZE); - - list_add_tail(&cmdnode->list, &priv->cmdfreeq); - -cl_ins_out: - lbtf_deb_leave(LBTF_DEB_HOST); -} - -static void lbtf_cleanup_and_insert_cmd(struct lbtf_private *priv, - struct cmd_ctrl_node *ptempcmd) -{ - unsigned long flags; - - spin_lock_irqsave(&priv->driver_lock, flags); - __lbtf_cleanup_and_insert_cmd(priv, ptempcmd); - spin_unlock_irqrestore(&priv->driver_lock, flags); -} - -void lbtf_complete_command(struct lbtf_private *priv, struct cmd_ctrl_node *cmd, - int result) -{ - cmd->result = result; - cmd->cmdwaitqwoken = 1; - wake_up_interruptible(&cmd->cmdwait_q); - - if (!cmd->callback) - __lbtf_cleanup_and_insert_cmd(priv, cmd); - priv->cur_cmd = NULL; -} - -int lbtf_cmd_set_mac_multicast_addr(struct lbtf_private *priv) -{ - struct cmd_ds_mac_multicast_addr cmd; - - lbtf_deb_enter(LBTF_DEB_CMD); - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - - cmd.nr_of_adrs = cpu_to_le16((u16) priv->nr_of_multicastmacaddr); - - lbtf_deb_cmd("MULTICAST_ADR: setting %d addresses\n", cmd.nr_of_adrs); - - memcpy(cmd.maclist, priv->multicastlist, - priv->nr_of_multicastmacaddr * ETH_ALEN); - - lbtf_cmd_async(priv, CMD_MAC_MULTICAST_ADR, &cmd.hdr, sizeof(cmd)); - - lbtf_deb_leave(LBTF_DEB_CMD); - return 0; -} - -void lbtf_set_mode(struct lbtf_private *priv, enum lbtf_mode mode) -{ - struct cmd_ds_set_mode cmd; - lbtf_deb_enter(LBTF_DEB_WEXT); - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.mode = cpu_to_le16(mode); - lbtf_deb_wext("Switching to mode: 0x%x\n", mode); - lbtf_cmd_async(priv, CMD_802_11_SET_MODE, &cmd.hdr, sizeof(cmd)); - - lbtf_deb_leave(LBTF_DEB_WEXT); -} - -void lbtf_set_bssid(struct lbtf_private *priv, bool activate, const u8 *bssid) -{ - struct cmd_ds_set_bssid cmd; - lbtf_deb_enter(LBTF_DEB_CMD); - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.activate = activate ? 1 : 0; - if (activate) - memcpy(cmd.bssid, bssid, ETH_ALEN); - - lbtf_cmd_async(priv, CMD_802_11_SET_BSSID, &cmd.hdr, sizeof(cmd)); - lbtf_deb_leave(LBTF_DEB_CMD); -} - -int lbtf_set_mac_address(struct lbtf_private *priv, uint8_t *mac_addr) -{ - struct cmd_ds_802_11_mac_address cmd; - lbtf_deb_enter(LBTF_DEB_CMD); - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - - memcpy(cmd.macadd, mac_addr, ETH_ALEN); - - lbtf_cmd_async(priv, CMD_802_11_MAC_ADDRESS, &cmd.hdr, sizeof(cmd)); - lbtf_deb_leave(LBTF_DEB_CMD); - return 0; -} - -int lbtf_set_radio_control(struct lbtf_private *priv) -{ - int ret = 0; - struct cmd_ds_802_11_radio_control cmd; - - lbtf_deb_enter(LBTF_DEB_CMD); - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - - switch (priv->preamble) { - case CMD_TYPE_SHORT_PREAMBLE: - cmd.control = cpu_to_le16(SET_SHORT_PREAMBLE); - break; - - case CMD_TYPE_LONG_PREAMBLE: - cmd.control = cpu_to_le16(SET_LONG_PREAMBLE); - break; - - case CMD_TYPE_AUTO_PREAMBLE: - default: - cmd.control = cpu_to_le16(SET_AUTO_PREAMBLE); - break; - } - - if (priv->radioon) - cmd.control |= cpu_to_le16(TURN_ON_RF); - else - cmd.control &= cpu_to_le16(~TURN_ON_RF); - - lbtf_deb_cmd("RADIO_SET: radio %d, preamble %d\n", priv->radioon, - priv->preamble); - - ret = lbtf_cmd_with_response(priv, CMD_802_11_RADIO_CONTROL, &cmd); - - lbtf_deb_leave_args(LBTF_DEB_CMD, "ret %d", ret); - return ret; -} - -void lbtf_set_mac_control(struct lbtf_private *priv) -{ - struct cmd_ds_mac_control cmd; - lbtf_deb_enter(LBTF_DEB_CMD); - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(priv->mac_control); - cmd.reserved = 0; - - lbtf_cmd_async(priv, CMD_MAC_CONTROL, - &cmd.hdr, sizeof(cmd)); - - lbtf_deb_leave(LBTF_DEB_CMD); -} - -/** - * lbtf_allocate_cmd_buffer - Allocates cmd buffer, links it to free cmd queue - * - * @priv A pointer to struct lbtf_private structure - * - * Returns: 0 on success. - */ -int lbtf_allocate_cmd_buffer(struct lbtf_private *priv) -{ - int ret = 0; - u32 bufsize; - u32 i; - struct cmd_ctrl_node *cmdarray; - - lbtf_deb_enter(LBTF_DEB_HOST); - - /* Allocate and initialize the command array */ - bufsize = sizeof(struct cmd_ctrl_node) * LBS_NUM_CMD_BUFFERS; - cmdarray = kzalloc(bufsize, GFP_KERNEL); - if (!cmdarray) { - lbtf_deb_host("ALLOC_CMD_BUF: tempcmd_array is NULL\n"); - ret = -1; - goto done; - } - priv->cmd_array = cmdarray; - - /* Allocate and initialize each command buffer in the command array */ - for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { - cmdarray[i].cmdbuf = kzalloc(LBS_CMD_BUFFER_SIZE, GFP_KERNEL); - if (!cmdarray[i].cmdbuf) { - lbtf_deb_host("ALLOC_CMD_BUF: ptempvirtualaddr is NULL\n"); - ret = -1; - goto done; - } - } - - for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { - init_waitqueue_head(&cmdarray[i].cmdwait_q); - lbtf_cleanup_and_insert_cmd(priv, &cmdarray[i]); - } - - ret = 0; - -done: - lbtf_deb_leave_args(LBTF_DEB_HOST, "ret %d", ret); - return ret; -} - -/** - * lbtf_free_cmd_buffer - Frees the cmd buffer. - * - * @priv A pointer to struct lbtf_private structure - * - * Returns: 0 - */ -int lbtf_free_cmd_buffer(struct lbtf_private *priv) -{ - struct cmd_ctrl_node *cmdarray; - unsigned int i; - - lbtf_deb_enter(LBTF_DEB_HOST); - - /* need to check if cmd array is allocated or not */ - if (priv->cmd_array == NULL) { - lbtf_deb_host("FREE_CMD_BUF: cmd_array is NULL\n"); - goto done; - } - - cmdarray = priv->cmd_array; - - /* Release shared memory buffers */ - for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { - kfree(cmdarray[i].cmdbuf); - cmdarray[i].cmdbuf = NULL; - } - - /* Release cmd_ctrl_node */ - kfree(priv->cmd_array); - priv->cmd_array = NULL; - -done: - lbtf_deb_leave(LBTF_DEB_HOST); - return 0; -} - -/** - * lbtf_get_cmd_ctrl_node - Gets free cmd node from free cmd queue. - * - * @priv A pointer to struct lbtf_private structure - * - * Returns: pointer to a struct cmd_ctrl_node or NULL if none available. - */ -static struct cmd_ctrl_node *lbtf_get_cmd_ctrl_node(struct lbtf_private *priv) -{ - struct cmd_ctrl_node *tempnode; - unsigned long flags; - - lbtf_deb_enter(LBTF_DEB_HOST); - - if (!priv) - return NULL; - - spin_lock_irqsave(&priv->driver_lock, flags); - - if (!list_empty(&priv->cmdfreeq)) { - tempnode = list_first_entry(&priv->cmdfreeq, - struct cmd_ctrl_node, list); - list_del(&tempnode->list); - } else { - lbtf_deb_host("GET_CMD_NODE: cmd_ctrl_node is not available\n"); - tempnode = NULL; - } - - spin_unlock_irqrestore(&priv->driver_lock, flags); - - lbtf_deb_leave(LBTF_DEB_HOST); - return tempnode; -} - -/** - * lbtf_execute_next_command: execute next command in cmd pending queue. - * - * @priv A pointer to struct lbtf_private structure - * - * Returns: 0 on success. - */ -int lbtf_execute_next_command(struct lbtf_private *priv) -{ - struct cmd_ctrl_node *cmdnode = NULL; - struct cmd_header *cmd; - unsigned long flags; - int ret = 0; - - /* Debug group is lbtf_deb_THREAD and not lbtf_deb_HOST, because the - * only caller to us is lbtf_thread() and we get even when a - * data packet is received */ - lbtf_deb_enter(LBTF_DEB_THREAD); - - spin_lock_irqsave(&priv->driver_lock, flags); - - if (priv->cur_cmd) { - pr_alert("EXEC_NEXT_CMD: already processing command!\n"); - spin_unlock_irqrestore(&priv->driver_lock, flags); - ret = -1; - goto done; - } - - if (!list_empty(&priv->cmdpendingq)) { - cmdnode = list_first_entry(&priv->cmdpendingq, - struct cmd_ctrl_node, list); - } - - if (cmdnode) { - cmd = cmdnode->cmdbuf; - - list_del(&cmdnode->list); - lbtf_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n", - le16_to_cpu(cmd->command)); - spin_unlock_irqrestore(&priv->driver_lock, flags); - lbtf_submit_command(priv, cmdnode); - } else - spin_unlock_irqrestore(&priv->driver_lock, flags); - - ret = 0; -done: - lbtf_deb_leave(LBTF_DEB_THREAD); - return ret; -} - -static struct cmd_ctrl_node *__lbtf_cmd_async(struct lbtf_private *priv, - uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, - int (*callback)(struct lbtf_private *, unsigned long, - struct cmd_header *), - unsigned long callback_arg) -{ - struct cmd_ctrl_node *cmdnode; - - lbtf_deb_enter(LBTF_DEB_HOST); - - if (priv->surpriseremoved) { - lbtf_deb_host("PREP_CMD: card removed\n"); - cmdnode = ERR_PTR(-ENOENT); - goto done; - } - - cmdnode = lbtf_get_cmd_ctrl_node(priv); - if (cmdnode == NULL) { - lbtf_deb_host("PREP_CMD: cmdnode is NULL\n"); - - /* Wake up main thread to execute next command */ - queue_work(lbtf_wq, &priv->cmd_work); - cmdnode = ERR_PTR(-ENOBUFS); - goto done; - } - - cmdnode->callback = callback; - cmdnode->callback_arg = callback_arg; - - /* Copy the incoming command to the buffer */ - memcpy(cmdnode->cmdbuf, in_cmd, in_cmd_size); - - /* Set sequence number, clean result, move to buffer */ - priv->seqnum++; - cmdnode->cmdbuf->command = cpu_to_le16(command); - cmdnode->cmdbuf->size = cpu_to_le16(in_cmd_size); - cmdnode->cmdbuf->seqnum = cpu_to_le16(priv->seqnum); - cmdnode->cmdbuf->result = 0; - - lbtf_deb_host("PREP_CMD: command 0x%04x\n", command); - - cmdnode->cmdwaitqwoken = 0; - lbtf_queue_cmd(priv, cmdnode); - queue_work(lbtf_wq, &priv->cmd_work); - - done: - lbtf_deb_leave_args(LBTF_DEB_HOST, "ret %p", cmdnode); - return cmdnode; -} - -void lbtf_cmd_async(struct lbtf_private *priv, uint16_t command, - struct cmd_header *in_cmd, int in_cmd_size) -{ - lbtf_deb_enter(LBTF_DEB_CMD); - __lbtf_cmd_async(priv, command, in_cmd, in_cmd_size, NULL, 0); - lbtf_deb_leave(LBTF_DEB_CMD); -} - -int __lbtf_cmd(struct lbtf_private *priv, uint16_t command, - struct cmd_header *in_cmd, int in_cmd_size, - int (*callback)(struct lbtf_private *, - unsigned long, struct cmd_header *), - unsigned long callback_arg) -{ - struct cmd_ctrl_node *cmdnode; - unsigned long flags; - int ret = 0; - - lbtf_deb_enter(LBTF_DEB_HOST); - - cmdnode = __lbtf_cmd_async(priv, command, in_cmd, in_cmd_size, - callback, callback_arg); - if (IS_ERR(cmdnode)) { - ret = PTR_ERR(cmdnode); - goto done; - } - - might_sleep(); - ret = wait_event_interruptible(cmdnode->cmdwait_q, - cmdnode->cmdwaitqwoken); - if (ret) { - pr_info("PREP_CMD: command 0x%04x interrupted by signal: %d\n", - command, ret); - goto done; - } - - spin_lock_irqsave(&priv->driver_lock, flags); - ret = cmdnode->result; - if (ret) - pr_info("PREP_CMD: command 0x%04x failed: %d\n", - command, ret); - - __lbtf_cleanup_and_insert_cmd(priv, cmdnode); - spin_unlock_irqrestore(&priv->driver_lock, flags); - -done: - lbtf_deb_leave_args(LBTF_DEB_HOST, "ret %d", ret); - return ret; -} -EXPORT_SYMBOL_GPL(__lbtf_cmd); - -/* Call holding driver_lock */ -void lbtf_cmd_response_rx(struct lbtf_private *priv) -{ - priv->cmd_response_rxed = 1; - queue_work(lbtf_wq, &priv->cmd_work); -} -EXPORT_SYMBOL_GPL(lbtf_cmd_response_rx); - -int lbtf_process_rx_command(struct lbtf_private *priv) -{ - uint16_t respcmd, curcmd; - struct cmd_header *resp; - int ret = 0; - unsigned long flags; - uint16_t result; - - lbtf_deb_enter(LBTF_DEB_CMD); - - mutex_lock(&priv->lock); - spin_lock_irqsave(&priv->driver_lock, flags); - - if (!priv->cur_cmd) { - ret = -1; - spin_unlock_irqrestore(&priv->driver_lock, flags); - goto done; - } - - resp = (void *)priv->cmd_resp_buff; - curcmd = le16_to_cpu(priv->cur_cmd->cmdbuf->command); - respcmd = le16_to_cpu(resp->command); - result = le16_to_cpu(resp->result); - - if (net_ratelimit()) - pr_info("libertastf: cmd response 0x%04x, seq %d, size %d\n", - respcmd, le16_to_cpu(resp->seqnum), - le16_to_cpu(resp->size)); - - if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) { - spin_unlock_irqrestore(&priv->driver_lock, flags); - ret = -1; - goto done; - } - if (respcmd != CMD_RET(curcmd)) { - spin_unlock_irqrestore(&priv->driver_lock, flags); - ret = -1; - goto done; - } - - if (resp->result == cpu_to_le16(0x0004)) { - /* 0x0004 means -EAGAIN. Drop the response, let it time out - and be resubmitted */ - spin_unlock_irqrestore(&priv->driver_lock, flags); - ret = -1; - goto done; - } - - /* Now we got response from FW, cancel the command timer */ - del_timer(&priv->command_timer); - priv->cmd_timed_out = 0; - if (priv->nr_retries) - priv->nr_retries = 0; - - /* If the command is not successful, cleanup and return failure */ - if ((result != 0 || !(respcmd & 0x8000))) { - /* - * Handling errors here - */ - switch (respcmd) { - case CMD_RET(CMD_GET_HW_SPEC): - case CMD_RET(CMD_802_11_RESET): - pr_info("libertastf: reset failed\n"); - break; - - } - lbtf_complete_command(priv, priv->cur_cmd, result); - spin_unlock_irqrestore(&priv->driver_lock, flags); - - ret = -1; - goto done; - } - - spin_unlock_irqrestore(&priv->driver_lock, flags); - - if (priv->cur_cmd && priv->cur_cmd->callback) { - ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg, - resp); - } - spin_lock_irqsave(&priv->driver_lock, flags); - - if (priv->cur_cmd) { - /* Clean up and Put current command back to cmdfreeq */ - lbtf_complete_command(priv, priv->cur_cmd, result); - } - spin_unlock_irqrestore(&priv->driver_lock, flags); - -done: - mutex_unlock(&priv->lock); - lbtf_deb_leave_args(LBTF_DEB_CMD, "ret %d", ret); - return ret; -} diff --git a/drivers/net/wireless/libertas_tf/deb_defs.h b/drivers/net/wireless/libertas_tf/deb_defs.h deleted file mode 100644 index 4bd3dc5adf7c..000000000000 --- a/drivers/net/wireless/libertas_tf/deb_defs.h +++ /dev/null @@ -1,104 +0,0 @@ -/** - * This header file contains global constant/enum definitions, - * global variable declaration. - */ -#ifndef _LBS_DEB_DEFS_H_ -#define _LBS_DEB_DEFS_H_ - -#ifndef DRV_NAME -#define DRV_NAME "libertas_tf" -#endif - -#include - -#ifdef CONFIG_LIBERTAS_THINFIRM_DEBUG -#define DEBUG -#define PROC_DEBUG -#endif - -#define LBTF_DEB_ENTER 0x00000001 -#define LBTF_DEB_LEAVE 0x00000002 -#define LBTF_DEB_MAIN 0x00000004 -#define LBTF_DEB_NET 0x00000008 -#define LBTF_DEB_MESH 0x00000010 -#define LBTF_DEB_WEXT 0x00000020 -#define LBTF_DEB_IOCTL 0x00000040 -#define LBTF_DEB_SCAN 0x00000080 -#define LBTF_DEB_ASSOC 0x00000100 -#define LBTF_DEB_JOIN 0x00000200 -#define LBTF_DEB_11D 0x00000400 -#define LBTF_DEB_DEBUGFS 0x00000800 -#define LBTF_DEB_ETHTOOL 0x00001000 -#define LBTF_DEB_HOST 0x00002000 -#define LBTF_DEB_CMD 0x00004000 -#define LBTF_DEB_RX 0x00008000 -#define LBTF_DEB_TX 0x00010000 -#define LBTF_DEB_USB 0x00020000 -#define LBTF_DEB_CS 0x00040000 -#define LBTF_DEB_FW 0x00080000 -#define LBTF_DEB_THREAD 0x00100000 -#define LBTF_DEB_HEX 0x00200000 -#define LBTF_DEB_SDIO 0x00400000 -#define LBTF_DEB_MACOPS 0x00800000 - -extern unsigned int lbtf_debug; - - -#ifdef DEBUG -#define LBTF_DEB_LL(grp, grpnam, fmt, args...) \ -do { if ((lbtf_debug & (grp)) == (grp)) \ - printk(KERN_DEBUG DRV_NAME grpnam "%s: " fmt, \ - in_interrupt() ? " (INT)" : "", ## args); } while (0) -#else -#define LBTF_DEB_LL(grp, grpnam, fmt, args...) do {} while (0) -#endif - -#define lbtf_deb_enter(grp) \ - LBTF_DEB_LL(grp | LBTF_DEB_ENTER, " enter", "%s()\n", __func__); -#define lbtf_deb_enter_args(grp, fmt, args...) \ - LBTF_DEB_LL(grp | LBTF_DEB_ENTER, " enter", "%s(" fmt ")\n", __func__, ## args); -#define lbtf_deb_leave(grp) \ - LBTF_DEB_LL(grp | LBTF_DEB_LEAVE, " leave", "%s()\n", __func__); -#define lbtf_deb_leave_args(grp, fmt, args...) \ - LBTF_DEB_LL(grp | LBTF_DEB_LEAVE, " leave", "%s(), " fmt "\n", \ - __func__, ##args); -#define lbtf_deb_main(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MAIN, " main", fmt, ##args) -#define lbtf_deb_net(fmt, args...) LBTF_DEB_LL(LBTF_DEB_NET, " net", fmt, ##args) -#define lbtf_deb_mesh(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MESH, " mesh", fmt, ##args) -#define lbtf_deb_wext(fmt, args...) LBTF_DEB_LL(LBTF_DEB_WEXT, " wext", fmt, ##args) -#define lbtf_deb_ioctl(fmt, args...) LBTF_DEB_LL(LBTF_DEB_IOCTL, " ioctl", fmt, ##args) -#define lbtf_deb_scan(fmt, args...) LBTF_DEB_LL(LBTF_DEB_SCAN, " scan", fmt, ##args) -#define lbtf_deb_assoc(fmt, args...) LBTF_DEB_LL(LBTF_DEB_ASSOC, " assoc", fmt, ##args) -#define lbtf_deb_join(fmt, args...) LBTF_DEB_LL(LBTF_DEB_JOIN, " join", fmt, ##args) -#define lbtf_deb_11d(fmt, args...) LBTF_DEB_LL(LBTF_DEB_11D, " 11d", fmt, ##args) -#define lbtf_deb_debugfs(fmt, args...) LBTF_DEB_LL(LBTF_DEB_DEBUGFS, " debugfs", fmt, ##args) -#define lbtf_deb_ethtool(fmt, args...) LBTF_DEB_LL(LBTF_DEB_ETHTOOL, " ethtool", fmt, ##args) -#define lbtf_deb_host(fmt, args...) LBTF_DEB_LL(LBTF_DEB_HOST, " host", fmt, ##args) -#define lbtf_deb_cmd(fmt, args...) LBTF_DEB_LL(LBTF_DEB_CMD, " cmd", fmt, ##args) -#define lbtf_deb_rx(fmt, args...) LBTF_DEB_LL(LBTF_DEB_RX, " rx", fmt, ##args) -#define lbtf_deb_tx(fmt, args...) LBTF_DEB_LL(LBTF_DEB_TX, " tx", fmt, ##args) -#define lbtf_deb_fw(fmt, args...) LBTF_DEB_LL(LBTF_DEB_FW, " fw", fmt, ##args) -#define lbtf_deb_usb(fmt, args...) LBTF_DEB_LL(LBTF_DEB_USB, " usb", fmt, ##args) -#define lbtf_deb_usbd(dev, fmt, args...) LBTF_DEB_LL(LBTF_DEB_USB, " usbd", "%s:" fmt, dev_name(dev), ##args) -#define lbtf_deb_cs(fmt, args...) LBTF_DEB_LL(LBTF_DEB_CS, " cs", fmt, ##args) -#define lbtf_deb_thread(fmt, args...) LBTF_DEB_LL(LBTF_DEB_THREAD, " thread", fmt, ##args) -#define lbtf_deb_sdio(fmt, args...) LBTF_DEB_LL(LBTF_DEB_SDIO, " thread", fmt, ##args) -#define lbtf_deb_macops(fmt, args...) LBTF_DEB_LL(LBTF_DEB_MACOPS, " thread", fmt, ##args) - -#ifdef DEBUG -static inline void lbtf_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len) -{ - char newprompt[32]; - - if (len && - (lbtf_debug & LBTF_DEB_HEX) && - (lbtf_debug & grp)) { - snprintf(newprompt, sizeof(newprompt), DRV_NAME " %s: ", prompt); - print_hex_dump_bytes(prompt, DUMP_PREFIX_NONE, buf, len); - } -} -#else -#define lbtf_deb_hex(grp, prompt, buf, len) do {} while (0) -#endif - -#endif diff --git a/drivers/net/wireless/libertas_tf/if_usb.c b/drivers/net/wireless/libertas_tf/if_usb.c deleted file mode 100644 index d576dd6665d3..000000000000 --- a/drivers/net/wireless/libertas_tf/if_usb.c +++ /dev/null @@ -1,930 +0,0 @@ -/* - * Copyright (C) 2008, cozybit Inc. - * Copyright (C) 2003-2006, Marvell International Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - */ -#define DRV_NAME "lbtf_usb" - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include "libertas_tf.h" -#include "if_usb.h" - -#include -#include -#include -#include -#include -#include - -#define INSANEDEBUG 0 -#define lbtf_deb_usb2(...) do { if (INSANEDEBUG) lbtf_deb_usbd(__VA_ARGS__); } while (0) - -#define MESSAGE_HEADER_LEN 4 - -static char *lbtf_fw_name = "lbtf_usb.bin"; -module_param_named(fw_name, lbtf_fw_name, charp, 0644); - -MODULE_FIRMWARE("lbtf_usb.bin"); - -static struct usb_device_id if_usb_table[] = { - /* Enter the device signature inside */ - { USB_DEVICE(0x1286, 0x2001) }, - { USB_DEVICE(0x05a3, 0x8388) }, - {} /* Terminating entry */ -}; - -MODULE_DEVICE_TABLE(usb, if_usb_table); - -static void if_usb_receive(struct urb *urb); -static void if_usb_receive_fwload(struct urb *urb); -static int if_usb_prog_firmware(struct if_usb_card *cardp); -static int if_usb_host_to_card(struct lbtf_private *priv, uint8_t type, - uint8_t *payload, uint16_t nb); -static int usb_tx_block(struct if_usb_card *cardp, uint8_t *payload, - uint16_t nb, u8 data); -static void if_usb_free(struct if_usb_card *cardp); -static int if_usb_submit_rx_urb(struct if_usb_card *cardp); -static int if_usb_reset_device(struct if_usb_card *cardp); - -/** - * if_usb_wrike_bulk_callback - call back to handle URB status - * - * @param urb pointer to urb structure - */ -static void if_usb_write_bulk_callback(struct urb *urb) -{ - if (urb->status != 0) { - /* print the failure status number for debug */ - pr_info("URB in failure status: %d\n", urb->status); - } else { - lbtf_deb_usb2(&urb->dev->dev, "URB status is successful\n"); - lbtf_deb_usb2(&urb->dev->dev, "Actual length transmitted %d\n", - urb->actual_length); - } -} - -/** - * if_usb_free - free tx/rx urb, skb and rx buffer - * - * @param cardp pointer if_usb_card - */ -static void if_usb_free(struct if_usb_card *cardp) -{ - lbtf_deb_enter(LBTF_DEB_USB); - - /* Unlink tx & rx urb */ - usb_kill_urb(cardp->tx_urb); - usb_kill_urb(cardp->rx_urb); - usb_kill_urb(cardp->cmd_urb); - - usb_free_urb(cardp->tx_urb); - cardp->tx_urb = NULL; - - usb_free_urb(cardp->rx_urb); - cardp->rx_urb = NULL; - - usb_free_urb(cardp->cmd_urb); - cardp->cmd_urb = NULL; - - kfree(cardp->ep_out_buf); - cardp->ep_out_buf = NULL; - - lbtf_deb_leave(LBTF_DEB_USB); -} - -static void if_usb_setup_firmware(struct lbtf_private *priv) -{ - struct if_usb_card *cardp = priv->card; - struct cmd_ds_set_boot2_ver b2_cmd; - - lbtf_deb_enter(LBTF_DEB_USB); - - if_usb_submit_rx_urb(cardp); - b2_cmd.hdr.size = cpu_to_le16(sizeof(b2_cmd)); - b2_cmd.action = 0; - b2_cmd.version = cardp->boot2_version; - - if (lbtf_cmd_with_response(priv, CMD_SET_BOOT2_VER, &b2_cmd)) - lbtf_deb_usb("Setting boot2 version failed\n"); - - lbtf_deb_leave(LBTF_DEB_USB); -} - -static void if_usb_fw_timeo(unsigned long priv) -{ - struct if_usb_card *cardp = (void *)priv; - - lbtf_deb_enter(LBTF_DEB_USB); - if (!cardp->fwdnldover) { - /* Download timed out */ - cardp->priv->surpriseremoved = 1; - pr_err("Download timed out\n"); - } else { - lbtf_deb_usb("Download complete, no event. Assuming success\n"); - } - wake_up(&cardp->fw_wq); - lbtf_deb_leave(LBTF_DEB_USB); -} - -/** - * if_usb_probe - sets the configuration values - * - * @ifnum interface number - * @id pointer to usb_device_id - * - * Returns: 0 on success, error code on failure - */ -static int if_usb_probe(struct usb_interface *intf, - const struct usb_device_id *id) -{ - struct usb_device *udev; - struct usb_host_interface *iface_desc; - struct usb_endpoint_descriptor *endpoint; - struct lbtf_private *priv; - struct if_usb_card *cardp; - int i; - - lbtf_deb_enter(LBTF_DEB_USB); - udev = interface_to_usbdev(intf); - - cardp = kzalloc(sizeof(struct if_usb_card), GFP_KERNEL); - if (!cardp) - goto error; - - setup_timer(&cardp->fw_timeout, if_usb_fw_timeo, (unsigned long)cardp); - init_waitqueue_head(&cardp->fw_wq); - - cardp->udev = udev; - iface_desc = intf->cur_altsetting; - - lbtf_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X" - " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n", - le16_to_cpu(udev->descriptor.bcdUSB), - udev->descriptor.bDeviceClass, - udev->descriptor.bDeviceSubClass, - udev->descriptor.bDeviceProtocol); - - for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { - endpoint = &iface_desc->endpoint[i].desc; - if (usb_endpoint_is_bulk_in(endpoint)) { - cardp->ep_in_size = - le16_to_cpu(endpoint->wMaxPacketSize); - cardp->ep_in = usb_endpoint_num(endpoint); - - lbtf_deb_usbd(&udev->dev, "in_endpoint = %d\n", - cardp->ep_in); - lbtf_deb_usbd(&udev->dev, "Bulk in size is %d\n", - cardp->ep_in_size); - } else if (usb_endpoint_is_bulk_out(endpoint)) { - cardp->ep_out_size = - le16_to_cpu(endpoint->wMaxPacketSize); - cardp->ep_out = usb_endpoint_num(endpoint); - - lbtf_deb_usbd(&udev->dev, "out_endpoint = %d\n", - cardp->ep_out); - lbtf_deb_usbd(&udev->dev, "Bulk out size is %d\n", - cardp->ep_out_size); - } - } - if (!cardp->ep_out_size || !cardp->ep_in_size) { - lbtf_deb_usbd(&udev->dev, "Endpoints not found\n"); - /* Endpoints not found */ - goto dealloc; - } - - cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!cardp->rx_urb) { - lbtf_deb_usbd(&udev->dev, "Rx URB allocation failed\n"); - goto dealloc; - } - - cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!cardp->tx_urb) { - lbtf_deb_usbd(&udev->dev, "Tx URB allocation failed\n"); - goto dealloc; - } - - cardp->cmd_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!cardp->cmd_urb) { - lbtf_deb_usbd(&udev->dev, "Cmd URB allocation failed\n"); - goto dealloc; - } - - cardp->ep_out_buf = kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE, - GFP_KERNEL); - if (!cardp->ep_out_buf) { - lbtf_deb_usbd(&udev->dev, "Could not allocate buffer\n"); - goto dealloc; - } - - priv = lbtf_add_card(cardp, &udev->dev); - if (!priv) - goto dealloc; - - cardp->priv = priv; - - priv->hw_host_to_card = if_usb_host_to_card; - priv->hw_prog_firmware = if_usb_prog_firmware; - priv->hw_reset_device = if_usb_reset_device; - cardp->boot2_version = udev->descriptor.bcdDevice; - - usb_get_dev(udev); - usb_set_intfdata(intf, cardp); - - return 0; - -dealloc: - if_usb_free(cardp); -error: -lbtf_deb_leave(LBTF_DEB_MAIN); - return -ENOMEM; -} - -/** - * if_usb_disconnect - free resource and cleanup - * - * @intf USB interface structure - */ -static void if_usb_disconnect(struct usb_interface *intf) -{ - struct if_usb_card *cardp = usb_get_intfdata(intf); - struct lbtf_private *priv = cardp->priv; - - lbtf_deb_enter(LBTF_DEB_MAIN); - - if_usb_reset_device(cardp); - - if (priv) - lbtf_remove_card(priv); - - /* Unlink and free urb */ - if_usb_free(cardp); - - usb_set_intfdata(intf, NULL); - usb_put_dev(interface_to_usbdev(intf)); - - lbtf_deb_leave(LBTF_DEB_MAIN); -} - -/** - * if_usb_send_fw_pkt - This function downloads the FW - * - * @priv pointer to struct lbtf_private - * - * Returns: 0 - */ -static int if_usb_send_fw_pkt(struct if_usb_card *cardp) -{ - struct fwdata *fwdata = cardp->ep_out_buf; - u8 *firmware = (u8 *) cardp->fw->data; - - lbtf_deb_enter(LBTF_DEB_FW); - - /* If we got a CRC failure on the last block, back - up and retry it */ - if (!cardp->CRC_OK) { - cardp->totalbytes = cardp->fwlastblksent; - cardp->fwseqnum--; - } - - lbtf_deb_usb2(&cardp->udev->dev, "totalbytes = %d\n", - cardp->totalbytes); - - /* struct fwdata (which we sent to the card) has an - extra __le32 field in between the header and the data, - which is not in the struct fwheader in the actual - firmware binary. Insert the seqnum in the middle... */ - memcpy(&fwdata->hdr, &firmware[cardp->totalbytes], - sizeof(struct fwheader)); - - cardp->fwlastblksent = cardp->totalbytes; - cardp->totalbytes += sizeof(struct fwheader); - - memcpy(fwdata->data, &firmware[cardp->totalbytes], - le32_to_cpu(fwdata->hdr.datalength)); - - lbtf_deb_usb2(&cardp->udev->dev, "Data length = %d\n", - le32_to_cpu(fwdata->hdr.datalength)); - - fwdata->seqnum = cpu_to_le32(++cardp->fwseqnum); - cardp->totalbytes += le32_to_cpu(fwdata->hdr.datalength); - - usb_tx_block(cardp, cardp->ep_out_buf, sizeof(struct fwdata) + - le32_to_cpu(fwdata->hdr.datalength), 0); - - if (fwdata->hdr.dnldcmd == cpu_to_le32(FW_HAS_DATA_TO_RECV)) { - lbtf_deb_usb2(&cardp->udev->dev, "There are data to follow\n"); - lbtf_deb_usb2(&cardp->udev->dev, - "seqnum = %d totalbytes = %d\n", - cardp->fwseqnum, cardp->totalbytes); - } else if (fwdata->hdr.dnldcmd == cpu_to_le32(FW_HAS_LAST_BLOCK)) { - lbtf_deb_usb2(&cardp->udev->dev, - "Host has finished FW downloading\n"); - lbtf_deb_usb2(&cardp->udev->dev, "Donwloading FW JUMP BLOCK\n"); - - /* Host has finished FW downloading - * Donwloading FW JUMP BLOCK - */ - cardp->fwfinalblk = 1; - } - - lbtf_deb_usb2(&cardp->udev->dev, "Firmware download done; size %d\n", - cardp->totalbytes); - - lbtf_deb_leave(LBTF_DEB_FW); - return 0; -} - -static int if_usb_reset_device(struct if_usb_card *cardp) -{ - struct cmd_ds_802_11_reset *cmd = cardp->ep_out_buf + 4; - int ret; - - lbtf_deb_enter(LBTF_DEB_USB); - - *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST); - - cmd->hdr.command = cpu_to_le16(CMD_802_11_RESET); - cmd->hdr.size = cpu_to_le16(sizeof(struct cmd_ds_802_11_reset)); - cmd->hdr.result = cpu_to_le16(0); - cmd->hdr.seqnum = cpu_to_le16(0x5a5a); - cmd->action = cpu_to_le16(CMD_ACT_HALT); - usb_tx_block(cardp, cardp->ep_out_buf, - 4 + sizeof(struct cmd_ds_802_11_reset), 0); - - msleep(100); - ret = usb_reset_device(cardp->udev); - msleep(100); - - lbtf_deb_leave_args(LBTF_DEB_USB, "ret %d", ret); - - return ret; -} -EXPORT_SYMBOL_GPL(if_usb_reset_device); - -/** - * usb_tx_block - transfer data to the device - * - * @priv pointer to struct lbtf_private - * @payload pointer to payload data - * @nb data length - * @data non-zero for data, zero for commands - * - * Returns: 0 on success, nonzero otherwise. - */ -static int usb_tx_block(struct if_usb_card *cardp, uint8_t *payload, - uint16_t nb, u8 data) -{ - int ret = -1; - struct urb *urb; - - lbtf_deb_enter(LBTF_DEB_USB); - /* check if device is removed */ - if (cardp->priv->surpriseremoved) { - lbtf_deb_usbd(&cardp->udev->dev, "Device removed\n"); - goto tx_ret; - } - - if (data) - urb = cardp->tx_urb; - else - urb = cardp->cmd_urb; - - usb_fill_bulk_urb(urb, cardp->udev, - usb_sndbulkpipe(cardp->udev, - cardp->ep_out), - payload, nb, if_usb_write_bulk_callback, cardp); - - urb->transfer_flags |= URB_ZERO_PACKET; - - if (usb_submit_urb(urb, GFP_ATOMIC)) { - lbtf_deb_usbd(&cardp->udev->dev, - "usb_submit_urb failed: %d\n", ret); - goto tx_ret; - } - - lbtf_deb_usb2(&cardp->udev->dev, "usb_submit_urb success\n"); - - ret = 0; - -tx_ret: - lbtf_deb_leave(LBTF_DEB_USB); - return ret; -} - -static int __if_usb_submit_rx_urb(struct if_usb_card *cardp, - void (*callbackfn)(struct urb *urb)) -{ - struct sk_buff *skb; - int ret = -1; - - lbtf_deb_enter(LBTF_DEB_USB); - - skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE); - if (!skb) { - pr_err("No free skb\n"); - lbtf_deb_leave(LBTF_DEB_USB); - return -1; - } - - cardp->rx_skb = skb; - - /* Fill the receive configuration URB and initialise the Rx call back */ - usb_fill_bulk_urb(cardp->rx_urb, cardp->udev, - usb_rcvbulkpipe(cardp->udev, cardp->ep_in), - skb_tail_pointer(skb), - MRVDRV_ETH_RX_PACKET_BUFFER_SIZE, callbackfn, cardp); - - cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET; - - lbtf_deb_usb2(&cardp->udev->dev, "Pointer for rx_urb %p\n", - cardp->rx_urb); - ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC); - if (ret) { - lbtf_deb_usbd(&cardp->udev->dev, - "Submit Rx URB failed: %d\n", ret); - kfree_skb(skb); - cardp->rx_skb = NULL; - lbtf_deb_leave(LBTF_DEB_USB); - return -1; - } else { - lbtf_deb_usb2(&cardp->udev->dev, "Submit Rx URB success\n"); - lbtf_deb_leave(LBTF_DEB_USB); - return 0; - } -} - -static int if_usb_submit_rx_urb_fwload(struct if_usb_card *cardp) -{ - return __if_usb_submit_rx_urb(cardp, &if_usb_receive_fwload); -} - -static int if_usb_submit_rx_urb(struct if_usb_card *cardp) -{ - return __if_usb_submit_rx_urb(cardp, &if_usb_receive); -} - -static void if_usb_receive_fwload(struct urb *urb) -{ - struct if_usb_card *cardp = urb->context; - struct sk_buff *skb = cardp->rx_skb; - struct fwsyncheader *syncfwheader; - struct bootcmdresp bcmdresp; - - lbtf_deb_enter(LBTF_DEB_USB); - if (urb->status) { - lbtf_deb_usbd(&cardp->udev->dev, - "URB status is failed during fw load\n"); - kfree_skb(skb); - lbtf_deb_leave(LBTF_DEB_USB); - return; - } - - if (cardp->fwdnldover) { - __le32 *tmp = (__le32 *)(skb->data); - - if (tmp[0] == cpu_to_le32(CMD_TYPE_INDICATION) && - tmp[1] == cpu_to_le32(MACREG_INT_CODE_FIRMWARE_READY)) { - /* Firmware ready event received */ - pr_info("Firmware ready event received\n"); - wake_up(&cardp->fw_wq); - } else { - lbtf_deb_usb("Waiting for confirmation; got %x %x\n", - le32_to_cpu(tmp[0]), le32_to_cpu(tmp[1])); - if_usb_submit_rx_urb_fwload(cardp); - } - kfree_skb(skb); - lbtf_deb_leave(LBTF_DEB_USB); - return; - } - if (cardp->bootcmdresp <= 0) { - memcpy(&bcmdresp, skb->data, sizeof(bcmdresp)); - - if (le16_to_cpu(cardp->udev->descriptor.bcdDevice) < 0x3106) { - kfree_skb(skb); - if_usb_submit_rx_urb_fwload(cardp); - cardp->bootcmdresp = 1; - /* Received valid boot command response */ - lbtf_deb_usbd(&cardp->udev->dev, - "Received valid boot command response\n"); - lbtf_deb_leave(LBTF_DEB_USB); - return; - } - if (bcmdresp.magic != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) { - if (bcmdresp.magic == cpu_to_le32(CMD_TYPE_REQUEST) || - bcmdresp.magic == cpu_to_le32(CMD_TYPE_DATA) || - bcmdresp.magic == cpu_to_le32(CMD_TYPE_INDICATION)) { - if (!cardp->bootcmdresp) - pr_info("Firmware already seems alive; resetting\n"); - cardp->bootcmdresp = -1; - } else { - pr_info("boot cmd response wrong magic number (0x%x)\n", - le32_to_cpu(bcmdresp.magic)); - } - } else if (bcmdresp.cmd != BOOT_CMD_FW_BY_USB) { - pr_info("boot cmd response cmd_tag error (%d)\n", - bcmdresp.cmd); - } else if (bcmdresp.result != BOOT_CMD_RESP_OK) { - pr_info("boot cmd response result error (%d)\n", - bcmdresp.result); - } else { - cardp->bootcmdresp = 1; - lbtf_deb_usbd(&cardp->udev->dev, - "Received valid boot command response\n"); - } - - kfree_skb(skb); - if_usb_submit_rx_urb_fwload(cardp); - lbtf_deb_leave(LBTF_DEB_USB); - return; - } - - syncfwheader = kmemdup(skb->data, sizeof(struct fwsyncheader), - GFP_ATOMIC); - if (!syncfwheader) { - lbtf_deb_usbd(&cardp->udev->dev, - "Failure to allocate syncfwheader\n"); - kfree_skb(skb); - lbtf_deb_leave(LBTF_DEB_USB); - return; - } - - if (!syncfwheader->cmd) { - lbtf_deb_usb2(&cardp->udev->dev, - "FW received Blk with correct CRC\n"); - lbtf_deb_usb2(&cardp->udev->dev, - "FW received Blk seqnum = %d\n", - le32_to_cpu(syncfwheader->seqnum)); - cardp->CRC_OK = 1; - } else { - lbtf_deb_usbd(&cardp->udev->dev, - "FW received Blk with CRC error\n"); - cardp->CRC_OK = 0; - } - - kfree_skb(skb); - - /* reschedule timer for 200ms hence */ - mod_timer(&cardp->fw_timeout, jiffies + (HZ/5)); - - if (cardp->fwfinalblk) { - cardp->fwdnldover = 1; - goto exit; - } - - if_usb_send_fw_pkt(cardp); - - exit: - if_usb_submit_rx_urb_fwload(cardp); - - kfree(syncfwheader); - - lbtf_deb_leave(LBTF_DEB_USB); -} - -#define MRVDRV_MIN_PKT_LEN 30 - -static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb, - struct if_usb_card *cardp, - struct lbtf_private *priv) -{ - if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + MESSAGE_HEADER_LEN - || recvlength < MRVDRV_MIN_PKT_LEN) { - lbtf_deb_usbd(&cardp->udev->dev, "Packet length is Invalid\n"); - kfree_skb(skb); - return; - } - - skb_put(skb, recvlength); - skb_pull(skb, MESSAGE_HEADER_LEN); - lbtf_rx(priv, skb); -} - -static inline void process_cmdrequest(int recvlength, uint8_t *recvbuff, - struct sk_buff *skb, - struct if_usb_card *cardp, - struct lbtf_private *priv) -{ - if (recvlength > LBS_CMD_BUFFER_SIZE) { - lbtf_deb_usbd(&cardp->udev->dev, - "The receive buffer is too large\n"); - kfree_skb(skb); - return; - } - - BUG_ON(!in_interrupt()); - - spin_lock(&priv->driver_lock); - memcpy(priv->cmd_resp_buff, recvbuff + MESSAGE_HEADER_LEN, - recvlength - MESSAGE_HEADER_LEN); - kfree_skb(skb); - lbtf_cmd_response_rx(priv); - spin_unlock(&priv->driver_lock); -} - -/** - * if_usb_receive - read data received from the device. - * - * @urb pointer to struct urb - */ -static void if_usb_receive(struct urb *urb) -{ - struct if_usb_card *cardp = urb->context; - struct sk_buff *skb = cardp->rx_skb; - struct lbtf_private *priv = cardp->priv; - int recvlength = urb->actual_length; - uint8_t *recvbuff = NULL; - uint32_t recvtype = 0; - __le32 *pkt = (__le32 *) skb->data; - - lbtf_deb_enter(LBTF_DEB_USB); - - if (recvlength) { - if (urb->status) { - lbtf_deb_usbd(&cardp->udev->dev, "RX URB failed: %d\n", - urb->status); - kfree_skb(skb); - goto setup_for_next; - } - - recvbuff = skb->data; - recvtype = le32_to_cpu(pkt[0]); - lbtf_deb_usbd(&cardp->udev->dev, - "Recv length = 0x%x, Recv type = 0x%X\n", - recvlength, recvtype); - } else if (urb->status) { - kfree_skb(skb); - lbtf_deb_leave(LBTF_DEB_USB); - return; - } - - switch (recvtype) { - case CMD_TYPE_DATA: - process_cmdtypedata(recvlength, skb, cardp, priv); - break; - - case CMD_TYPE_REQUEST: - process_cmdrequest(recvlength, recvbuff, skb, cardp, priv); - break; - - case CMD_TYPE_INDICATION: - { - /* Event cause handling */ - u32 event_cause = le32_to_cpu(pkt[1]); - lbtf_deb_usbd(&cardp->udev->dev, "**EVENT** 0x%X\n", - event_cause); - - /* Icky undocumented magic special case */ - if (event_cause & 0xffff0000) { - u16 tmp; - u8 retrycnt; - u8 failure; - - tmp = event_cause >> 16; - retrycnt = tmp & 0x00ff; - failure = (tmp & 0xff00) >> 8; - lbtf_send_tx_feedback(priv, retrycnt, failure); - } else if (event_cause == LBTF_EVENT_BCN_SENT) - lbtf_bcn_sent(priv); - else - lbtf_deb_usbd(&cardp->udev->dev, - "Unsupported notification %d received\n", - event_cause); - kfree_skb(skb); - break; - } - default: - lbtf_deb_usbd(&cardp->udev->dev, - "libertastf: unknown command type 0x%X\n", recvtype); - kfree_skb(skb); - break; - } - -setup_for_next: - if_usb_submit_rx_urb(cardp); - lbtf_deb_leave(LBTF_DEB_USB); -} - -/** - * if_usb_host_to_card - Download data to the device - * - * @priv pointer to struct lbtf_private structure - * @type type of data - * @buf pointer to data buffer - * @len number of bytes - * - * Returns: 0 on success, nonzero otherwise - */ -static int if_usb_host_to_card(struct lbtf_private *priv, uint8_t type, - uint8_t *payload, uint16_t nb) -{ - struct if_usb_card *cardp = priv->card; - u8 data = 0; - - lbtf_deb_usbd(&cardp->udev->dev, "*** type = %u\n", type); - lbtf_deb_usbd(&cardp->udev->dev, "size after = %d\n", nb); - - if (type == MVMS_CMD) { - *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_REQUEST); - } else { - *(__le32 *)cardp->ep_out_buf = cpu_to_le32(CMD_TYPE_DATA); - data = 1; - } - - memcpy((cardp->ep_out_buf + MESSAGE_HEADER_LEN), payload, nb); - - return usb_tx_block(cardp, cardp->ep_out_buf, nb + MESSAGE_HEADER_LEN, - data); -} - -/** - * if_usb_issue_boot_command - Issue boot command to Boot2. - * - * @ivalue 1 boots from FW by USB-Download, 2 boots from FW in EEPROM. - * - * Returns: 0 - */ -static int if_usb_issue_boot_command(struct if_usb_card *cardp, int ivalue) -{ - struct bootcmd *bootcmd = cardp->ep_out_buf; - - /* Prepare command */ - bootcmd->magic = cpu_to_le32(BOOT_CMD_MAGIC_NUMBER); - bootcmd->cmd = ivalue; - memset(bootcmd->pad, 0, sizeof(bootcmd->pad)); - - /* Issue command */ - usb_tx_block(cardp, cardp->ep_out_buf, sizeof(*bootcmd), 0); - - return 0; -} - - -/** - * check_fwfile_format - Check the validity of Boot2/FW image. - * - * @data pointer to image - * @totlen image length - * - * Returns: 0 if the image is valid, nonzero otherwise. - */ -static int check_fwfile_format(const u8 *data, u32 totlen) -{ - u32 bincmd, exit; - u32 blksize, offset, len; - int ret; - - ret = 1; - exit = len = 0; - - do { - struct fwheader *fwh = (void *) data; - - bincmd = le32_to_cpu(fwh->dnldcmd); - blksize = le32_to_cpu(fwh->datalength); - switch (bincmd) { - case FW_HAS_DATA_TO_RECV: - offset = sizeof(struct fwheader) + blksize; - data += offset; - len += offset; - if (len >= totlen) - exit = 1; - break; - case FW_HAS_LAST_BLOCK: - exit = 1; - ret = 0; - break; - default: - exit = 1; - break; - } - } while (!exit); - - if (ret) - pr_err("firmware file format check FAIL\n"); - else - lbtf_deb_fw("firmware file format check PASS\n"); - - return ret; -} - - -static int if_usb_prog_firmware(struct if_usb_card *cardp) -{ - int i = 0; - static int reset_count = 10; - int ret = 0; - - lbtf_deb_enter(LBTF_DEB_USB); - - kparam_block_sysfs_write(fw_name); - ret = request_firmware(&cardp->fw, lbtf_fw_name, &cardp->udev->dev); - if (ret < 0) { - pr_err("request_firmware() failed with %#x\n", ret); - pr_err("firmware %s not found\n", lbtf_fw_name); - kparam_unblock_sysfs_write(fw_name); - goto done; - } - kparam_unblock_sysfs_write(fw_name); - - if (check_fwfile_format(cardp->fw->data, cardp->fw->size)) - goto release_fw; - -restart: - if (if_usb_submit_rx_urb_fwload(cardp) < 0) { - lbtf_deb_usbd(&cardp->udev->dev, "URB submission is failed\n"); - ret = -1; - goto release_fw; - } - - cardp->bootcmdresp = 0; - do { - int j = 0; - i++; - /* Issue Boot command = 1, Boot from Download-FW */ - if_usb_issue_boot_command(cardp, BOOT_CMD_FW_BY_USB); - /* wait for command response */ - do { - j++; - msleep_interruptible(100); - } while (cardp->bootcmdresp == 0 && j < 10); - } while (cardp->bootcmdresp == 0 && i < 5); - - if (cardp->bootcmdresp <= 0) { - if (--reset_count >= 0) { - if_usb_reset_device(cardp); - goto restart; - } - return -1; - } - - i = 0; - - cardp->totalbytes = 0; - cardp->fwlastblksent = 0; - cardp->CRC_OK = 1; - cardp->fwdnldover = 0; - cardp->fwseqnum = -1; - cardp->totalbytes = 0; - cardp->fwfinalblk = 0; - - /* Send the first firmware packet... */ - if_usb_send_fw_pkt(cardp); - - /* ... and wait for the process to complete */ - wait_event_interruptible(cardp->fw_wq, cardp->priv->surpriseremoved || - cardp->fwdnldover); - - del_timer_sync(&cardp->fw_timeout); - usb_kill_urb(cardp->rx_urb); - - if (!cardp->fwdnldover) { - pr_info("failed to load fw, resetting device!\n"); - if (--reset_count >= 0) { - if_usb_reset_device(cardp); - goto restart; - } - - pr_info("FW download failure, time = %d ms\n", i * 100); - ret = -1; - goto release_fw; - } - - cardp->priv->fw_ready = 1; - - release_fw: - release_firmware(cardp->fw); - cardp->fw = NULL; - - if_usb_setup_firmware(cardp->priv); - - done: - lbtf_deb_leave_args(LBTF_DEB_USB, "ret %d", ret); - return ret; -} -EXPORT_SYMBOL_GPL(if_usb_prog_firmware); - - -#define if_usb_suspend NULL -#define if_usb_resume NULL - -static struct usb_driver if_usb_driver = { - .name = DRV_NAME, - .probe = if_usb_probe, - .disconnect = if_usb_disconnect, - .id_table = if_usb_table, - .suspend = if_usb_suspend, - .resume = if_usb_resume, - .disable_hub_initiated_lpm = 1, -}; - -module_usb_driver(if_usb_driver); - -MODULE_DESCRIPTION("8388 USB WLAN Thinfirm Driver"); -MODULE_AUTHOR("Cozybit Inc."); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/libertas_tf/if_usb.h b/drivers/net/wireless/libertas_tf/if_usb.h deleted file mode 100644 index 6fa5b3f59efe..000000000000 --- a/drivers/net/wireless/libertas_tf/if_usb.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2008, cozybit Inc. - * Copyright (C) 2003-2006, Marvell International Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - */ -#include -#include - -struct lbtf_private; - -/** - * This file contains definition for USB interface. - */ -#define CMD_TYPE_REQUEST 0xF00DFACE -#define CMD_TYPE_DATA 0xBEADC0DE -#define CMD_TYPE_INDICATION 0xBEEFFACE - -#define BOOT_CMD_FW_BY_USB 0x01 -#define BOOT_CMD_FW_IN_EEPROM 0x02 -#define BOOT_CMD_UPDATE_BOOT2 0x03 -#define BOOT_CMD_UPDATE_FW 0x04 -#define BOOT_CMD_MAGIC_NUMBER 0x4C56524D /* LVRM */ - -struct bootcmd { - __le32 magic; - uint8_t cmd; - uint8_t pad[11]; -}; - -#define BOOT_CMD_RESP_OK 0x0001 -#define BOOT_CMD_RESP_FAIL 0x0000 - -struct bootcmdresp { - __le32 magic; - uint8_t cmd; - uint8_t result; - uint8_t pad[2]; -}; - -/** USB card description structure*/ -struct if_usb_card { - struct usb_device *udev; - struct urb *rx_urb, *tx_urb, *cmd_urb; - struct lbtf_private *priv; - - struct sk_buff *rx_skb; - - uint8_t ep_in; - uint8_t ep_out; - - int8_t bootcmdresp; - - int ep_in_size; - - void *ep_out_buf; - int ep_out_size; - - const struct firmware *fw; - struct timer_list fw_timeout; - wait_queue_head_t fw_wq; - uint32_t fwseqnum; - uint32_t totalbytes; - uint32_t fwlastblksent; - uint8_t CRC_OK; - uint8_t fwdnldover; - uint8_t fwfinalblk; - - __le16 boot2_version; -}; - -/** fwheader */ -struct fwheader { - __le32 dnldcmd; - __le32 baseaddr; - __le32 datalength; - __le32 CRC; -}; - -#define FW_MAX_DATA_BLK_SIZE 600 -/** FWData */ -struct fwdata { - struct fwheader hdr; - __le32 seqnum; - uint8_t data[0]; -}; - -/** fwsyncheader */ -struct fwsyncheader { - __le32 cmd; - __le32 seqnum; -}; - -#define FW_HAS_DATA_TO_RECV 0x00000001 -#define FW_HAS_LAST_BLOCK 0x00000004 diff --git a/drivers/net/wireless/libertas_tf/libertas_tf.h b/drivers/net/wireless/libertas_tf/libertas_tf.h deleted file mode 100644 index ad77b92d0b41..000000000000 --- a/drivers/net/wireless/libertas_tf/libertas_tf.h +++ /dev/null @@ -1,519 +0,0 @@ -/* - * Copyright (C) 2008, cozybit Inc. - * Copyright (C) 2007, Red Hat, Inc. - * Copyright (C) 2003-2006, Marvell International Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - */ -#include -#include -#include -#include - -#include "deb_defs.h" - -#ifndef DRV_NAME -#define DRV_NAME "libertas_tf" -#endif - -#define MRVL_DEFAULT_RETRIES 9 -#define MRVL_PER_PACKET_RATE 0x10 -#define MRVL_MAX_BCN_SIZE 440 -#define CMD_OPTION_WAITFORRSP 0x0002 - -/* Return command are almost always the same as the host command, but with - * bit 15 set high. There are a few exceptions, though... - */ -#define CMD_RET(cmd) (0x8000 | cmd) - -/* Command codes */ -#define CMD_GET_HW_SPEC 0x0003 -#define CMD_802_11_RESET 0x0005 -#define CMD_MAC_MULTICAST_ADR 0x0010 -#define CMD_802_11_RADIO_CONTROL 0x001c -#define CMD_802_11_RF_CHANNEL 0x001d -#define CMD_802_11_RF_TX_POWER 0x001e -#define CMD_MAC_CONTROL 0x0028 -#define CMD_802_11_MAC_ADDRESS 0x004d -#define CMD_SET_BOOT2_VER 0x00a5 -#define CMD_802_11_BEACON_CTRL 0x00b0 -#define CMD_802_11_BEACON_SET 0x00cb -#define CMD_802_11_SET_MODE 0x00cc -#define CMD_802_11_SET_BSSID 0x00cd - -#define CMD_ACT_GET 0x0000 -#define CMD_ACT_SET 0x0001 - -/* Define action or option for CMD_802_11_RESET */ -#define CMD_ACT_HALT 0x0003 - -/* Define action or option for CMD_MAC_CONTROL */ -#define CMD_ACT_MAC_RX_ON 0x0001 -#define CMD_ACT_MAC_TX_ON 0x0002 -#define CMD_ACT_MAC_MULTICAST_ENABLE 0x0020 -#define CMD_ACT_MAC_BROADCAST_ENABLE 0x0040 -#define CMD_ACT_MAC_PROMISCUOUS_ENABLE 0x0080 -#define CMD_ACT_MAC_ALL_MULTICAST_ENABLE 0x0100 - -/* Define action or option for CMD_802_11_RADIO_CONTROL */ -#define CMD_TYPE_AUTO_PREAMBLE 0x0001 -#define CMD_TYPE_SHORT_PREAMBLE 0x0002 -#define CMD_TYPE_LONG_PREAMBLE 0x0003 - -#define TURN_ON_RF 0x01 -#define RADIO_ON 0x01 -#define RADIO_OFF 0x00 - -#define SET_AUTO_PREAMBLE 0x05 -#define SET_SHORT_PREAMBLE 0x03 -#define SET_LONG_PREAMBLE 0x01 - -/* Define action or option for CMD_802_11_RF_CHANNEL */ -#define CMD_OPT_802_11_RF_CHANNEL_GET 0x00 -#define CMD_OPT_802_11_RF_CHANNEL_SET 0x01 - -/* Codes for CMD_802_11_SET_MODE */ -enum lbtf_mode { - LBTF_PASSIVE_MODE, - LBTF_STA_MODE, - LBTF_AP_MODE, -}; - -/** Card Event definition */ -#define MACREG_INT_CODE_FIRMWARE_READY 48 -/** Buffer Constants */ - -/* The size of SQ memory PPA, DPA are 8 DWORDs, that keep the physical -* addresses of TxPD buffers. Station has only 8 TxPD available, Whereas -* driver has more local TxPDs. Each TxPD on the host memory is associated -* with a Tx control node. The driver maintains 8 RxPD descriptors for -* station firmware to store Rx packet information. -* -* Current version of MAC has a 32x6 multicast address buffer. -* -* 802.11b can have up to 14 channels, the driver keeps the -* BSSID(MAC address) of each APs or Ad hoc stations it has sensed. -*/ - -#define MRVDRV_MAX_MULTICAST_LIST_SIZE 32 -#define LBS_NUM_CMD_BUFFERS 10 -#define LBS_CMD_BUFFER_SIZE (2 * 1024) -#define MRVDRV_MAX_CHANNEL_SIZE 14 -#define MRVDRV_SNAP_HEADER_LEN 8 - -#define LBS_UPLD_SIZE 2312 -#define DEV_NAME_LEN 32 - -/** Misc constants */ -/* This section defines 802.11 specific contants */ - -#define MRVDRV_MAX_REGION_CODE 6 -/** - * the table to keep region code - */ -#define LBTF_REGDOMAIN_US 0x10 -#define LBTF_REGDOMAIN_CA 0x20 -#define LBTF_REGDOMAIN_EU 0x30 -#define LBTF_REGDOMAIN_SP 0x31 -#define LBTF_REGDOMAIN_FR 0x32 -#define LBTF_REGDOMAIN_JP 0x40 - -#define SBI_EVENT_CAUSE_SHIFT 3 - -/** RxPD status */ - -#define MRVDRV_RXPD_STATUS_OK 0x0001 - - -/* This is for firmware specific length */ -#define EXTRA_LEN 36 - -#define MRVDRV_ETH_TX_PACKET_BUFFER_SIZE \ - (ETH_FRAME_LEN + sizeof(struct txpd) + EXTRA_LEN) - -#define MRVDRV_ETH_RX_PACKET_BUFFER_SIZE \ - (ETH_FRAME_LEN + sizeof(struct rxpd) \ - + MRVDRV_SNAP_HEADER_LEN + EXTRA_LEN) - -#define CMD_F_HOSTCMD (1 << 0) -#define FW_CAPINFO_WPA (1 << 0) - -#define RF_ANTENNA_1 0x1 -#define RF_ANTENNA_2 0x2 -#define RF_ANTENNA_AUTO 0xFFFF - -#define LBTF_EVENT_BCN_SENT 55 - -/** Global Variable Declaration */ -/** mv_ms_type */ -enum mv_ms_type { - MVMS_DAT = 0, - MVMS_CMD = 1, - MVMS_TXDONE = 2, - MVMS_EVENT -}; - -extern struct workqueue_struct *lbtf_wq; - -struct lbtf_private; - -struct lbtf_offset_value { - u32 offset; - u32 value; -}; - -struct channel_range { - u8 regdomain; - u8 start; - u8 end; /* exclusive (channel must be less than end) */ -}; - -struct if_usb_card; - -/** Private structure for the MV device */ -struct lbtf_private { - void *card; - struct ieee80211_hw *hw; - - /* Command response buffer */ - u8 cmd_resp_buff[LBS_UPLD_SIZE]; - /* Download sent: - bit0 1/0=data_sent/data_tx_done, - bit1 1/0=cmd_sent/cmd_tx_done, - all other bits reserved 0 */ - struct ieee80211_vif *vif; - - struct work_struct cmd_work; - struct work_struct tx_work; - /** Hardware access */ - int (*hw_host_to_card) (struct lbtf_private *priv, u8 type, u8 *payload, u16 nb); - int (*hw_prog_firmware) (struct if_usb_card *cardp); - int (*hw_reset_device) (struct if_usb_card *cardp); - - - /** Wlan adapter data structure*/ - /** STATUS variables */ - u32 fwrelease; - u32 fwcapinfo; - /* protected with big lock */ - - struct mutex lock; - - /** command-related variables */ - u16 seqnum; - /* protected by big lock */ - - struct cmd_ctrl_node *cmd_array; - /** Current command */ - struct cmd_ctrl_node *cur_cmd; - /** command Queues */ - /** Free command buffers */ - struct list_head cmdfreeq; - /** Pending command buffers */ - struct list_head cmdpendingq; - - /** spin locks */ - spinlock_t driver_lock; - - /** Timers */ - struct timer_list command_timer; - int nr_retries; - int cmd_timed_out; - - u8 cmd_response_rxed; - - /** capability Info used in Association, start, join */ - u16 capability; - - /** MAC address information */ - u8 current_addr[ETH_ALEN]; - u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN]; - u32 nr_of_multicastmacaddr; - int cur_freq; - - struct sk_buff *skb_to_tx; - struct sk_buff *tx_skb; - - /** NIC Operation characteristics */ - u16 mac_control; - u16 regioncode; - struct channel_range range; - - u8 radioon; - u32 preamble; - - struct ieee80211_channel channels[14]; - struct ieee80211_rate rates[12]; - struct ieee80211_supported_band band; - struct lbtf_offset_value offsetvalue; - - u8 fw_ready; - u8 surpriseremoved; - struct sk_buff_head bc_ps_buf; - - /* Most recently reported noise in dBm */ - s8 noise; -}; - -/* 802.11-related definitions */ - -/* TxPD descriptor */ -struct txpd { - /* Current Tx packet status */ - __le32 tx_status; - /* Tx control */ - __le32 tx_control; - __le32 tx_packet_location; - /* Tx packet length */ - __le16 tx_packet_length; - /* First 2 byte of destination MAC address */ - u8 tx_dest_addr_high[2]; - /* Last 4 byte of destination MAC address */ - u8 tx_dest_addr_low[4]; - /* Pkt Priority */ - u8 priority; - /* Pkt Trasnit Power control */ - u8 powermgmt; - /* Time the packet has been queued in the driver (units = 2ms) */ - u8 pktdelay_2ms; - /* reserved */ - u8 reserved1; -}; - -/* RxPD Descriptor */ -struct rxpd { - /* Current Rx packet status */ - __le16 status; - - /* SNR */ - u8 snr; - - /* Tx control */ - u8 rx_control; - - /* Pkt length */ - __le16 pkt_len; - - /* Noise Floor */ - u8 nf; - - /* Rx Packet Rate */ - u8 rx_rate; - - /* Pkt addr */ - __le32 pkt_ptr; - - /* Next Rx RxPD addr */ - __le32 next_rxpd_ptr; - - /* Pkt Priority */ - u8 priority; - u8 reserved[3]; -}; - -struct cmd_header { - __le16 command; - __le16 size; - __le16 seqnum; - __le16 result; -} __packed; - -struct cmd_ctrl_node { - struct list_head list; - int result; - /* command response */ - int (*callback)(struct lbtf_private *, - unsigned long, struct cmd_header *); - unsigned long callback_arg; - /* command data */ - struct cmd_header *cmdbuf; - /* wait queue */ - u16 cmdwaitqwoken; - wait_queue_head_t cmdwait_q; -}; - -/* - * Define data structure for CMD_GET_HW_SPEC - * This structure defines the response for the GET_HW_SPEC command - */ -struct cmd_ds_get_hw_spec { - struct cmd_header hdr; - - /* HW Interface version number */ - __le16 hwifversion; - /* HW version number */ - __le16 version; - /* Max number of TxPD FW can handle */ - __le16 nr_txpd; - /* Max no of Multicast address */ - __le16 nr_mcast_adr; - /* MAC address */ - u8 permanentaddr[6]; - - /* region Code */ - __le16 regioncode; - - /* Number of antenna used */ - __le16 nr_antenna; - - /* FW release number, example 0x01030304 = 2.3.4p1 */ - __le32 fwrelease; - - /* Base Address of TxPD queue */ - __le32 wcb_base; - /* Read Pointer of RxPd queue */ - __le32 rxpd_rdptr; - - /* Write Pointer of RxPd queue */ - __le32 rxpd_wrptr; - - /*FW/HW capability */ - __le32 fwcapinfo; -} __packed; - -struct cmd_ds_mac_control { - struct cmd_header hdr; - __le16 action; - u16 reserved; -}; - -struct cmd_ds_802_11_mac_address { - struct cmd_header hdr; - - __le16 action; - uint8_t macadd[ETH_ALEN]; -}; - -struct cmd_ds_mac_multicast_addr { - struct cmd_header hdr; - - __le16 action; - __le16 nr_of_adrs; - u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE]; -}; - -struct cmd_ds_set_mode { - struct cmd_header hdr; - - __le16 mode; -}; - -struct cmd_ds_set_bssid { - struct cmd_header hdr; - - u8 bssid[6]; - u8 activate; -}; - -struct cmd_ds_802_11_radio_control { - struct cmd_header hdr; - - __le16 action; - __le16 control; -}; - - -struct cmd_ds_802_11_rf_channel { - struct cmd_header hdr; - - __le16 action; - __le16 channel; - __le16 rftype; /* unused */ - __le16 reserved; /* unused */ - u8 channellist[32]; /* unused */ -}; - -struct cmd_ds_set_boot2_ver { - struct cmd_header hdr; - - __le16 action; - __le16 version; -}; - -struct cmd_ds_802_11_reset { - struct cmd_header hdr; - - __le16 action; -}; - -struct cmd_ds_802_11_beacon_control { - struct cmd_header hdr; - - __le16 action; - __le16 beacon_enable; - __le16 beacon_period; -}; - -struct cmd_ds_802_11_beacon_set { - struct cmd_header hdr; - - __le16 len; - u8 beacon[MRVL_MAX_BCN_SIZE]; -}; - -struct lbtf_private; -struct cmd_ctrl_node; - -/** Function Prototype Declaration */ -void lbtf_set_mac_control(struct lbtf_private *priv); - -int lbtf_free_cmd_buffer(struct lbtf_private *priv); - -int lbtf_allocate_cmd_buffer(struct lbtf_private *priv); -int lbtf_execute_next_command(struct lbtf_private *priv); -int lbtf_set_radio_control(struct lbtf_private *priv); -int lbtf_update_hw_spec(struct lbtf_private *priv); -int lbtf_cmd_set_mac_multicast_addr(struct lbtf_private *priv); -void lbtf_set_mode(struct lbtf_private *priv, enum lbtf_mode mode); -void lbtf_set_bssid(struct lbtf_private *priv, bool activate, const u8 *bssid); -int lbtf_set_mac_address(struct lbtf_private *priv, uint8_t *mac_addr); - -int lbtf_set_channel(struct lbtf_private *priv, u8 channel); - -int lbtf_beacon_set(struct lbtf_private *priv, struct sk_buff *beacon); -int lbtf_beacon_ctrl(struct lbtf_private *priv, bool beacon_enable, - int beacon_int); - - -int lbtf_process_rx_command(struct lbtf_private *priv); -void lbtf_complete_command(struct lbtf_private *priv, struct cmd_ctrl_node *cmd, - int result); -void lbtf_cmd_response_rx(struct lbtf_private *priv); - -/* main.c */ -struct chan_freq_power *lbtf_get_region_cfp_table(u8 region, - int *cfp_no); -struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev); -int lbtf_remove_card(struct lbtf_private *priv); -int lbtf_start_card(struct lbtf_private *priv); -int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb); -void lbtf_send_tx_feedback(struct lbtf_private *priv, u8 retrycnt, u8 fail); -void lbtf_bcn_sent(struct lbtf_private *priv); - -/* support functions for cmd.c */ -/* lbtf_cmd() infers the size of the buffer to copy data back into, from - the size of the target of the pointer. Since the command to be sent - may often be smaller, that size is set in cmd->size by the caller.*/ -#define lbtf_cmd(priv, cmdnr, cmd, cb, cb_arg) ({ \ - uint16_t __sz = le16_to_cpu((cmd)->hdr.size); \ - (cmd)->hdr.size = cpu_to_le16(sizeof(*(cmd))); \ - __lbtf_cmd(priv, cmdnr, &(cmd)->hdr, __sz, cb, cb_arg); \ -}) - -#define lbtf_cmd_with_response(priv, cmdnr, cmd) \ - lbtf_cmd(priv, cmdnr, cmd, lbtf_cmd_copyback, (unsigned long) (cmd)) - -void lbtf_cmd_async(struct lbtf_private *priv, uint16_t command, - struct cmd_header *in_cmd, int in_cmd_size); - -int __lbtf_cmd(struct lbtf_private *priv, uint16_t command, - struct cmd_header *in_cmd, int in_cmd_size, - int (*callback)(struct lbtf_private *, unsigned long, - struct cmd_header *), - unsigned long callback_arg); - -int lbtf_cmd_copyback(struct lbtf_private *priv, unsigned long extra, - struct cmd_header *resp); diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c deleted file mode 100644 index 088de9d25c39..000000000000 --- a/drivers/net/wireless/libertas_tf/main.c +++ /dev/null @@ -1,769 +0,0 @@ -/* - * Copyright (C) 2008, cozybit Inc. - * Copyright (C) 2003-2006, Marvell International Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - */ -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include - -#include -#include -#include "libertas_tf.h" - -#define DRIVER_RELEASE_VERSION "004.p0" -/* thinfirm version: 5.132.X.pX */ -#define LBTF_FW_VER_MIN 0x05840300 -#define LBTF_FW_VER_MAX 0x0584ffff -#define QOS_CONTROL_LEN 2 - -/* Module parameters */ -unsigned int lbtf_debug; -EXPORT_SYMBOL_GPL(lbtf_debug); -module_param_named(libertas_tf_debug, lbtf_debug, int, 0644); - -static const char lbtf_driver_version[] = "THINFIRM-USB8388-" DRIVER_RELEASE_VERSION -#ifdef DEBUG - "-dbg" -#endif - ""; - -struct workqueue_struct *lbtf_wq; - -static const struct ieee80211_channel lbtf_channels[] = { - { .center_freq = 2412, .hw_value = 1 }, - { .center_freq = 2417, .hw_value = 2 }, - { .center_freq = 2422, .hw_value = 3 }, - { .center_freq = 2427, .hw_value = 4 }, - { .center_freq = 2432, .hw_value = 5 }, - { .center_freq = 2437, .hw_value = 6 }, - { .center_freq = 2442, .hw_value = 7 }, - { .center_freq = 2447, .hw_value = 8 }, - { .center_freq = 2452, .hw_value = 9 }, - { .center_freq = 2457, .hw_value = 10 }, - { .center_freq = 2462, .hw_value = 11 }, - { .center_freq = 2467, .hw_value = 12 }, - { .center_freq = 2472, .hw_value = 13 }, - { .center_freq = 2484, .hw_value = 14 }, -}; - -/* This table contains the hardware specific values for the modulation rates. */ -static const struct ieee80211_rate lbtf_rates[] = { - { .bitrate = 10, - .hw_value = 0, }, - { .bitrate = 20, - .hw_value = 1, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 55, - .hw_value = 2, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 110, - .hw_value = 3, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 60, - .hw_value = 5, - .flags = 0 }, - { .bitrate = 90, - .hw_value = 6, - .flags = 0 }, - { .bitrate = 120, - .hw_value = 7, - .flags = 0 }, - { .bitrate = 180, - .hw_value = 8, - .flags = 0 }, - { .bitrate = 240, - .hw_value = 9, - .flags = 0 }, - { .bitrate = 360, - .hw_value = 10, - .flags = 0 }, - { .bitrate = 480, - .hw_value = 11, - .flags = 0 }, - { .bitrate = 540, - .hw_value = 12, - .flags = 0 }, -}; - -static void lbtf_cmd_work(struct work_struct *work) -{ - struct lbtf_private *priv = container_of(work, struct lbtf_private, - cmd_work); - - lbtf_deb_enter(LBTF_DEB_CMD); - - spin_lock_irq(&priv->driver_lock); - /* command response? */ - if (priv->cmd_response_rxed) { - priv->cmd_response_rxed = 0; - spin_unlock_irq(&priv->driver_lock); - lbtf_process_rx_command(priv); - spin_lock_irq(&priv->driver_lock); - } - - if (priv->cmd_timed_out && priv->cur_cmd) { - struct cmd_ctrl_node *cmdnode = priv->cur_cmd; - - if (++priv->nr_retries > 10) { - lbtf_complete_command(priv, cmdnode, - -ETIMEDOUT); - priv->nr_retries = 0; - } else { - priv->cur_cmd = NULL; - - /* Stick it back at the _top_ of the pending - * queue for immediate resubmission */ - list_add(&cmdnode->list, &priv->cmdpendingq); - } - } - priv->cmd_timed_out = 0; - spin_unlock_irq(&priv->driver_lock); - - if (!priv->fw_ready) { - lbtf_deb_leave_args(LBTF_DEB_CMD, "fw not ready"); - return; - } - - /* Execute the next command */ - if (!priv->cur_cmd) - lbtf_execute_next_command(priv); - - lbtf_deb_leave(LBTF_DEB_CMD); -} - -/** - * lbtf_setup_firmware: initialize firmware. - * - * @priv A pointer to struct lbtf_private structure - * - * Returns: 0 on success. - */ -static int lbtf_setup_firmware(struct lbtf_private *priv) -{ - int ret = -1; - - lbtf_deb_enter(LBTF_DEB_FW); - /* - * Read priv address from HW - */ - memset(priv->current_addr, 0xff, ETH_ALEN); - ret = lbtf_update_hw_spec(priv); - if (ret) { - ret = -1; - goto done; - } - - lbtf_set_mac_control(priv); - lbtf_set_radio_control(priv); - - ret = 0; -done: - lbtf_deb_leave_args(LBTF_DEB_FW, "ret: %d", ret); - return ret; -} - -/** - * This function handles the timeout of command sending. - * It will re-send the same command again. - */ -static void command_timer_fn(unsigned long data) -{ - struct lbtf_private *priv = (struct lbtf_private *)data; - unsigned long flags; - lbtf_deb_enter(LBTF_DEB_CMD); - - spin_lock_irqsave(&priv->driver_lock, flags); - - if (!priv->cur_cmd) { - printk(KERN_DEBUG "libertastf: command timer expired; " - "no pending command\n"); - goto out; - } - - printk(KERN_DEBUG "libertas: command %x timed out\n", - le16_to_cpu(priv->cur_cmd->cmdbuf->command)); - - priv->cmd_timed_out = 1; - queue_work(lbtf_wq, &priv->cmd_work); -out: - spin_unlock_irqrestore(&priv->driver_lock, flags); - lbtf_deb_leave(LBTF_DEB_CMD); -} - -static int lbtf_init_adapter(struct lbtf_private *priv) -{ - lbtf_deb_enter(LBTF_DEB_MAIN); - memset(priv->current_addr, 0xff, ETH_ALEN); - mutex_init(&priv->lock); - - priv->vif = NULL; - setup_timer(&priv->command_timer, command_timer_fn, - (unsigned long)priv); - - INIT_LIST_HEAD(&priv->cmdfreeq); - INIT_LIST_HEAD(&priv->cmdpendingq); - - spin_lock_init(&priv->driver_lock); - - /* Allocate the command buffers */ - if (lbtf_allocate_cmd_buffer(priv)) - return -1; - - lbtf_deb_leave(LBTF_DEB_MAIN); - return 0; -} - -static void lbtf_free_adapter(struct lbtf_private *priv) -{ - lbtf_deb_enter(LBTF_DEB_MAIN); - lbtf_free_cmd_buffer(priv); - del_timer(&priv->command_timer); - lbtf_deb_leave(LBTF_DEB_MAIN); -} - -static void lbtf_op_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct lbtf_private *priv = hw->priv; - - priv->skb_to_tx = skb; - queue_work(lbtf_wq, &priv->tx_work); - /* - * queue will be restarted when we receive transmission feedback if - * there are no buffered multicast frames to send - */ - ieee80211_stop_queues(priv->hw); -} - -static void lbtf_tx_work(struct work_struct *work) -{ - struct lbtf_private *priv = container_of(work, struct lbtf_private, - tx_work); - unsigned int len; - struct ieee80211_tx_info *info; - struct txpd *txpd; - struct sk_buff *skb = NULL; - int err; - - lbtf_deb_enter(LBTF_DEB_MACOPS | LBTF_DEB_TX); - - if ((priv->vif->type == NL80211_IFTYPE_AP) && - (!skb_queue_empty(&priv->bc_ps_buf))) - skb = skb_dequeue(&priv->bc_ps_buf); - else if (priv->skb_to_tx) { - skb = priv->skb_to_tx; - priv->skb_to_tx = NULL; - } else { - lbtf_deb_leave(LBTF_DEB_MACOPS | LBTF_DEB_TX); - return; - } - - len = skb->len; - info = IEEE80211_SKB_CB(skb); - txpd = (struct txpd *) skb_push(skb, sizeof(struct txpd)); - - if (priv->surpriseremoved) { - dev_kfree_skb_any(skb); - lbtf_deb_leave(LBTF_DEB_MACOPS | LBTF_DEB_TX); - return; - } - - memset(txpd, 0, sizeof(struct txpd)); - /* Activate per-packet rate selection */ - txpd->tx_control |= cpu_to_le32(MRVL_PER_PACKET_RATE | - ieee80211_get_tx_rate(priv->hw, info)->hw_value); - - /* copy destination address from 802.11 header */ - memcpy(txpd->tx_dest_addr_high, skb->data + sizeof(struct txpd) + 4, - ETH_ALEN); - txpd->tx_packet_length = cpu_to_le16(len); - txpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd)); - lbtf_deb_hex(LBTF_DEB_TX, "TX Data", skb->data, min_t(unsigned int, skb->len, 100)); - BUG_ON(priv->tx_skb); - spin_lock_irq(&priv->driver_lock); - priv->tx_skb = skb; - err = priv->hw_host_to_card(priv, MVMS_DAT, skb->data, skb->len); - spin_unlock_irq(&priv->driver_lock); - if (err) { - dev_kfree_skb_any(skb); - priv->tx_skb = NULL; - pr_err("TX error: %d", err); - } - lbtf_deb_leave(LBTF_DEB_MACOPS | LBTF_DEB_TX); -} - -static int lbtf_op_start(struct ieee80211_hw *hw) -{ - struct lbtf_private *priv = hw->priv; - void *card = priv->card; - int ret = -1; - - lbtf_deb_enter(LBTF_DEB_MACOPS); - - if (!priv->fw_ready) - /* Upload firmware */ - if (priv->hw_prog_firmware(card)) - goto err_prog_firmware; - - /* poke the firmware */ - priv->capability = WLAN_CAPABILITY_SHORT_PREAMBLE; - priv->radioon = RADIO_ON; - priv->mac_control = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON; - ret = lbtf_setup_firmware(priv); - if (ret) - goto err_prog_firmware; - - if ((priv->fwrelease < LBTF_FW_VER_MIN) || - (priv->fwrelease > LBTF_FW_VER_MAX)) { - ret = -1; - goto err_prog_firmware; - } - - printk(KERN_INFO "libertastf: Marvell WLAN 802.11 thinfirm adapter\n"); - lbtf_deb_leave(LBTF_DEB_MACOPS); - return 0; - -err_prog_firmware: - priv->hw_reset_device(card); - lbtf_deb_leave_args(LBTF_DEB_MACOPS, "error programing fw; ret=%d", ret); - return ret; -} - -static void lbtf_op_stop(struct ieee80211_hw *hw) -{ - struct lbtf_private *priv = hw->priv; - unsigned long flags; - struct sk_buff *skb; - - struct cmd_ctrl_node *cmdnode; - - lbtf_deb_enter(LBTF_DEB_MACOPS); - - /* Flush pending command nodes */ - spin_lock_irqsave(&priv->driver_lock, flags); - list_for_each_entry(cmdnode, &priv->cmdpendingq, list) { - cmdnode->result = -ENOENT; - cmdnode->cmdwaitqwoken = 1; - wake_up_interruptible(&cmdnode->cmdwait_q); - } - - spin_unlock_irqrestore(&priv->driver_lock, flags); - cancel_work_sync(&priv->cmd_work); - cancel_work_sync(&priv->tx_work); - while ((skb = skb_dequeue(&priv->bc_ps_buf))) - dev_kfree_skb_any(skb); - priv->radioon = RADIO_OFF; - lbtf_set_radio_control(priv); - - lbtf_deb_leave(LBTF_DEB_MACOPS); -} - -static int lbtf_op_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct lbtf_private *priv = hw->priv; - lbtf_deb_enter(LBTF_DEB_MACOPS); - if (priv->vif != NULL) - return -EOPNOTSUPP; - - priv->vif = vif; - switch (vif->type) { - case NL80211_IFTYPE_MESH_POINT: - case NL80211_IFTYPE_AP: - lbtf_set_mode(priv, LBTF_AP_MODE); - break; - case NL80211_IFTYPE_STATION: - lbtf_set_mode(priv, LBTF_STA_MODE); - break; - default: - priv->vif = NULL; - return -EOPNOTSUPP; - } - lbtf_set_mac_address(priv, (u8 *) vif->addr); - lbtf_deb_leave(LBTF_DEB_MACOPS); - return 0; -} - -static void lbtf_op_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct lbtf_private *priv = hw->priv; - lbtf_deb_enter(LBTF_DEB_MACOPS); - - if (priv->vif->type == NL80211_IFTYPE_AP || - priv->vif->type == NL80211_IFTYPE_MESH_POINT) - lbtf_beacon_ctrl(priv, 0, 0); - lbtf_set_mode(priv, LBTF_PASSIVE_MODE); - lbtf_set_bssid(priv, 0, NULL); - priv->vif = NULL; - lbtf_deb_leave(LBTF_DEB_MACOPS); -} - -static int lbtf_op_config(struct ieee80211_hw *hw, u32 changed) -{ - struct lbtf_private *priv = hw->priv; - struct ieee80211_conf *conf = &hw->conf; - lbtf_deb_enter(LBTF_DEB_MACOPS); - - if (conf->chandef.chan->center_freq != priv->cur_freq) { - priv->cur_freq = conf->chandef.chan->center_freq; - lbtf_set_channel(priv, conf->chandef.chan->hw_value); - } - lbtf_deb_leave(LBTF_DEB_MACOPS); - return 0; -} - -static u64 lbtf_op_prepare_multicast(struct ieee80211_hw *hw, - struct netdev_hw_addr_list *mc_list) -{ - struct lbtf_private *priv = hw->priv; - int i; - struct netdev_hw_addr *ha; - int mc_count = netdev_hw_addr_list_count(mc_list); - - if (!mc_count || mc_count > MRVDRV_MAX_MULTICAST_LIST_SIZE) - return mc_count; - - priv->nr_of_multicastmacaddr = mc_count; - i = 0; - netdev_hw_addr_list_for_each(ha, mc_list) - memcpy(&priv->multicastlist[i++], ha->addr, ETH_ALEN); - - return mc_count; -} - -#define SUPPORTED_FIF_FLAGS (FIF_PROMISC_IN_BSS | FIF_ALLMULTI) -static void lbtf_op_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *new_flags, - u64 multicast) -{ - struct lbtf_private *priv = hw->priv; - int old_mac_control = priv->mac_control; - - lbtf_deb_enter(LBTF_DEB_MACOPS); - - changed_flags &= SUPPORTED_FIF_FLAGS; - *new_flags &= SUPPORTED_FIF_FLAGS; - - if (!changed_flags) { - lbtf_deb_leave(LBTF_DEB_MACOPS); - return; - } - - if (*new_flags & (FIF_PROMISC_IN_BSS)) - priv->mac_control |= CMD_ACT_MAC_PROMISCUOUS_ENABLE; - else - priv->mac_control &= ~CMD_ACT_MAC_PROMISCUOUS_ENABLE; - if (*new_flags & (FIF_ALLMULTI) || - multicast > MRVDRV_MAX_MULTICAST_LIST_SIZE) { - priv->mac_control |= CMD_ACT_MAC_ALL_MULTICAST_ENABLE; - priv->mac_control &= ~CMD_ACT_MAC_MULTICAST_ENABLE; - } else if (multicast) { - priv->mac_control |= CMD_ACT_MAC_MULTICAST_ENABLE; - priv->mac_control &= ~CMD_ACT_MAC_ALL_MULTICAST_ENABLE; - lbtf_cmd_set_mac_multicast_addr(priv); - } else { - priv->mac_control &= ~(CMD_ACT_MAC_MULTICAST_ENABLE | - CMD_ACT_MAC_ALL_MULTICAST_ENABLE); - if (priv->nr_of_multicastmacaddr) { - priv->nr_of_multicastmacaddr = 0; - lbtf_cmd_set_mac_multicast_addr(priv); - } - } - - - if (priv->mac_control != old_mac_control) - lbtf_set_mac_control(priv); - - lbtf_deb_leave(LBTF_DEB_MACOPS); -} - -static void lbtf_op_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changes) -{ - struct lbtf_private *priv = hw->priv; - struct sk_buff *beacon; - lbtf_deb_enter(LBTF_DEB_MACOPS); - - if (changes & (BSS_CHANGED_BEACON | BSS_CHANGED_BEACON_INT)) { - switch (priv->vif->type) { - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_MESH_POINT: - beacon = ieee80211_beacon_get(hw, vif); - if (beacon) { - lbtf_beacon_set(priv, beacon); - kfree_skb(beacon); - lbtf_beacon_ctrl(priv, 1, - bss_conf->beacon_int); - } - break; - default: - break; - } - } - - if (changes & BSS_CHANGED_BSSID) { - bool activate = !is_zero_ether_addr(bss_conf->bssid); - lbtf_set_bssid(priv, activate, bss_conf->bssid); - } - - if (changes & BSS_CHANGED_ERP_PREAMBLE) { - if (bss_conf->use_short_preamble) - priv->preamble = CMD_TYPE_SHORT_PREAMBLE; - else - priv->preamble = CMD_TYPE_LONG_PREAMBLE; - lbtf_set_radio_control(priv); - } - - lbtf_deb_leave(LBTF_DEB_MACOPS); -} - -static int lbtf_op_get_survey(struct ieee80211_hw *hw, int idx, - struct survey_info *survey) -{ - struct lbtf_private *priv = hw->priv; - struct ieee80211_conf *conf = &hw->conf; - - if (idx != 0) - return -ENOENT; - - survey->channel = conf->chandef.chan; - survey->filled = SURVEY_INFO_NOISE_DBM; - survey->noise = priv->noise; - - return 0; -} - -static const struct ieee80211_ops lbtf_ops = { - .tx = lbtf_op_tx, - .start = lbtf_op_start, - .stop = lbtf_op_stop, - .add_interface = lbtf_op_add_interface, - .remove_interface = lbtf_op_remove_interface, - .config = lbtf_op_config, - .prepare_multicast = lbtf_op_prepare_multicast, - .configure_filter = lbtf_op_configure_filter, - .bss_info_changed = lbtf_op_bss_info_changed, - .get_survey = lbtf_op_get_survey, -}; - -int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb) -{ - struct ieee80211_rx_status stats; - struct rxpd *prxpd; - int need_padding; - unsigned int flags; - struct ieee80211_hdr *hdr; - - lbtf_deb_enter(LBTF_DEB_RX); - - prxpd = (struct rxpd *) skb->data; - - memset(&stats, 0, sizeof(stats)); - if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) - stats.flag |= RX_FLAG_FAILED_FCS_CRC; - stats.freq = priv->cur_freq; - stats.band = IEEE80211_BAND_2GHZ; - stats.signal = prxpd->snr; - priv->noise = prxpd->nf; - /* Marvell rate index has a hole at value 4 */ - if (prxpd->rx_rate > 4) - --prxpd->rx_rate; - stats.rate_idx = prxpd->rx_rate; - skb_pull(skb, sizeof(struct rxpd)); - - hdr = (struct ieee80211_hdr *)skb->data; - flags = le32_to_cpu(*(__le32 *)(skb->data + 4)); - - need_padding = ieee80211_is_data_qos(hdr->frame_control); - need_padding ^= ieee80211_has_a4(hdr->frame_control); - need_padding ^= ieee80211_is_data_qos(hdr->frame_control) && - (*ieee80211_get_qos_ctl(hdr) & - IEEE80211_QOS_CTL_A_MSDU_PRESENT); - - if (need_padding) { - memmove(skb->data + 2, skb->data, skb->len); - skb_reserve(skb, 2); - } - - memcpy(IEEE80211_SKB_RXCB(skb), &stats, sizeof(stats)); - - lbtf_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n", - skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); - lbtf_deb_hex(LBTF_DEB_RX, "RX Data", skb->data, - min_t(unsigned int, skb->len, 100)); - - ieee80211_rx_irqsafe(priv->hw, skb); - - lbtf_deb_leave(LBTF_DEB_RX); - return 0; -} -EXPORT_SYMBOL_GPL(lbtf_rx); - -/** - * lbtf_add_card: Add and initialize the card, no fw upload yet. - * - * @card A pointer to card - * - * Returns: pointer to struct lbtf_priv. - */ -struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev) -{ - struct ieee80211_hw *hw; - struct lbtf_private *priv = NULL; - - lbtf_deb_enter(LBTF_DEB_MAIN); - - hw = ieee80211_alloc_hw(sizeof(struct lbtf_private), &lbtf_ops); - if (!hw) - goto done; - - priv = hw->priv; - if (lbtf_init_adapter(priv)) - goto err_init_adapter; - - priv->hw = hw; - priv->card = card; - priv->tx_skb = NULL; - - hw->queues = 1; - hw->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING; - hw->extra_tx_headroom = sizeof(struct txpd); - memcpy(priv->channels, lbtf_channels, sizeof(lbtf_channels)); - memcpy(priv->rates, lbtf_rates, sizeof(lbtf_rates)); - priv->band.n_bitrates = ARRAY_SIZE(lbtf_rates); - priv->band.bitrates = priv->rates; - priv->band.n_channels = ARRAY_SIZE(lbtf_channels); - priv->band.channels = priv->channels; - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band; - hw->wiphy->interface_modes = - BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC); - skb_queue_head_init(&priv->bc_ps_buf); - - SET_IEEE80211_DEV(hw, dmdev); - - INIT_WORK(&priv->cmd_work, lbtf_cmd_work); - INIT_WORK(&priv->tx_work, lbtf_tx_work); - if (ieee80211_register_hw(hw)) - goto err_init_adapter; - - goto done; - -err_init_adapter: - lbtf_free_adapter(priv); - ieee80211_free_hw(hw); - priv = NULL; - -done: - lbtf_deb_leave_args(LBTF_DEB_MAIN, "priv %p", priv); - return priv; -} -EXPORT_SYMBOL_GPL(lbtf_add_card); - - -int lbtf_remove_card(struct lbtf_private *priv) -{ - struct ieee80211_hw *hw = priv->hw; - - lbtf_deb_enter(LBTF_DEB_MAIN); - - priv->surpriseremoved = 1; - del_timer(&priv->command_timer); - lbtf_free_adapter(priv); - priv->hw = NULL; - ieee80211_unregister_hw(hw); - ieee80211_free_hw(hw); - - lbtf_deb_leave(LBTF_DEB_MAIN); - return 0; -} -EXPORT_SYMBOL_GPL(lbtf_remove_card); - -void lbtf_send_tx_feedback(struct lbtf_private *priv, u8 retrycnt, u8 fail) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(priv->tx_skb); - - ieee80211_tx_info_clear_status(info); - /* - * Commented out, otherwise we never go beyond 1Mbit/s using mac80211 - * default pid rc algorithm. - * - * info->status.retry_count = MRVL_DEFAULT_RETRIES - retrycnt; - */ - if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) && !fail) - info->flags |= IEEE80211_TX_STAT_ACK; - skb_pull(priv->tx_skb, sizeof(struct txpd)); - ieee80211_tx_status_irqsafe(priv->hw, priv->tx_skb); - priv->tx_skb = NULL; - if (!priv->skb_to_tx && skb_queue_empty(&priv->bc_ps_buf)) - ieee80211_wake_queues(priv->hw); - else - queue_work(lbtf_wq, &priv->tx_work); -} -EXPORT_SYMBOL_GPL(lbtf_send_tx_feedback); - -void lbtf_bcn_sent(struct lbtf_private *priv) -{ - struct sk_buff *skb = NULL; - - if (priv->vif->type != NL80211_IFTYPE_AP) - return; - - if (skb_queue_empty(&priv->bc_ps_buf)) { - bool tx_buff_bc = false; - - while ((skb = ieee80211_get_buffered_bc(priv->hw, priv->vif))) { - skb_queue_tail(&priv->bc_ps_buf, skb); - tx_buff_bc = true; - } - if (tx_buff_bc) { - ieee80211_stop_queues(priv->hw); - queue_work(lbtf_wq, &priv->tx_work); - } - } - - skb = ieee80211_beacon_get(priv->hw, priv->vif); - - if (skb) { - lbtf_beacon_set(priv, skb); - kfree_skb(skb); - } -} -EXPORT_SYMBOL_GPL(lbtf_bcn_sent); - -static int __init lbtf_init_module(void) -{ - lbtf_deb_enter(LBTF_DEB_MAIN); - lbtf_wq = create_workqueue("libertastf"); - if (lbtf_wq == NULL) { - printk(KERN_ERR "libertastf: couldn't create workqueue\n"); - return -ENOMEM; - } - lbtf_deb_leave(LBTF_DEB_MAIN); - return 0; -} - -static void __exit lbtf_exit_module(void) -{ - lbtf_deb_enter(LBTF_DEB_MAIN); - destroy_workqueue(lbtf_wq); - lbtf_deb_leave(LBTF_DEB_MAIN); -} - -module_init(lbtf_init_module); -module_exit(lbtf_exit_module); - -MODULE_DESCRIPTION("Libertas WLAN Thinfirm Driver Library"); -MODULE_AUTHOR("Cozybit Inc."); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c deleted file mode 100644 index cb34c7895f2a..000000000000 --- a/drivers/net/wireless/mac80211_hwsim.c +++ /dev/null @@ -1,2582 +0,0 @@ -/* - * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211 - * Copyright (c) 2008, Jouni Malinen - * Copyright (c) 2011, Javier Lopez - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -/* - * TODO: - * - Add TSF sync and fix IBSS beacon transmission by adding - * competition for "air time" at TBTT - * - RX filtering based on filter configuration (data->rx_filter) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "mac80211_hwsim.h" - -#define WARN_QUEUE 100 -#define MAX_QUEUE 200 - -MODULE_AUTHOR("Jouni Malinen"); -MODULE_DESCRIPTION("Software simulator of 802.11 radio(s) for mac80211"); -MODULE_LICENSE("GPL"); - -static u32 wmediumd_portid; - -static int radios = 2; -module_param(radios, int, 0444); -MODULE_PARM_DESC(radios, "Number of simulated radios"); - -static int channels = 1; -module_param(channels, int, 0444); -MODULE_PARM_DESC(channels, "Number of concurrent channels"); - -static bool paged_rx = false; -module_param(paged_rx, bool, 0644); -MODULE_PARM_DESC(paged_rx, "Use paged SKBs for RX instead of linear ones"); - -static bool rctbl = false; -module_param(rctbl, bool, 0444); -MODULE_PARM_DESC(rctbl, "Handle rate control table"); - -/** - * enum hwsim_regtest - the type of regulatory tests we offer - * - * These are the different values you can use for the regtest - * module parameter. This is useful to help test world roaming - * and the driver regulatory_hint() call and combinations of these. - * If you want to do specific alpha2 regulatory domain tests simply - * use the userspace regulatory request as that will be respected as - * well without the need of this module parameter. This is designed - * only for testing the driver regulatory request, world roaming - * and all possible combinations. - * - * @HWSIM_REGTEST_DISABLED: No regulatory tests are performed, - * this is the default value. - * @HWSIM_REGTEST_DRIVER_REG_FOLLOW: Used for testing the driver regulatory - * hint, only one driver regulatory hint will be sent as such the - * secondary radios are expected to follow. - * @HWSIM_REGTEST_DRIVER_REG_ALL: Used for testing the driver regulatory - * request with all radios reporting the same regulatory domain. - * @HWSIM_REGTEST_DIFF_COUNTRY: Used for testing the drivers calling - * different regulatory domains requests. Expected behaviour is for - * an intersection to occur but each device will still use their - * respective regulatory requested domains. Subsequent radios will - * use the resulting intersection. - * @HWSIM_REGTEST_WORLD_ROAM: Used for testing the world roaming. We accomplish - * this by using a custom beacon-capable regulatory domain for the first - * radio. All other device world roam. - * @HWSIM_REGTEST_CUSTOM_WORLD: Used for testing the custom world regulatory - * domain requests. All radios will adhere to this custom world regulatory - * domain. - * @HWSIM_REGTEST_CUSTOM_WORLD_2: Used for testing 2 custom world regulatory - * domain requests. The first radio will adhere to the first custom world - * regulatory domain, the second one to the second custom world regulatory - * domain. All other devices will world roam. - * @HWSIM_REGTEST_STRICT_FOLLOW_: Used for testing strict regulatory domain - * settings, only the first radio will send a regulatory domain request - * and use strict settings. The rest of the radios are expected to follow. - * @HWSIM_REGTEST_STRICT_ALL: Used for testing strict regulatory domain - * settings. All radios will adhere to this. - * @HWSIM_REGTEST_STRICT_AND_DRIVER_REG: Used for testing strict regulatory - * domain settings, combined with secondary driver regulatory domain - * settings. The first radio will get a strict regulatory domain setting - * using the first driver regulatory request and the second radio will use - * non-strict settings using the second driver regulatory request. All - * other devices should follow the intersection created between the - * first two. - * @HWSIM_REGTEST_ALL: Used for testing every possible mix. You will need - * at least 6 radios for a complete test. We will test in this order: - * 1 - driver custom world regulatory domain - * 2 - second custom world regulatory domain - * 3 - first driver regulatory domain request - * 4 - second driver regulatory domain request - * 5 - strict regulatory domain settings using the third driver regulatory - * domain request - * 6 and on - should follow the intersection of the 3rd, 4rth and 5th radio - * regulatory requests. - */ -enum hwsim_regtest { - HWSIM_REGTEST_DISABLED = 0, - HWSIM_REGTEST_DRIVER_REG_FOLLOW = 1, - HWSIM_REGTEST_DRIVER_REG_ALL = 2, - HWSIM_REGTEST_DIFF_COUNTRY = 3, - HWSIM_REGTEST_WORLD_ROAM = 4, - HWSIM_REGTEST_CUSTOM_WORLD = 5, - HWSIM_REGTEST_CUSTOM_WORLD_2 = 6, - HWSIM_REGTEST_STRICT_FOLLOW = 7, - HWSIM_REGTEST_STRICT_ALL = 8, - HWSIM_REGTEST_STRICT_AND_DRIVER_REG = 9, - HWSIM_REGTEST_ALL = 10, -}; - -/* Set to one of the HWSIM_REGTEST_* values above */ -static int regtest = HWSIM_REGTEST_DISABLED; -module_param(regtest, int, 0444); -MODULE_PARM_DESC(regtest, "The type of regulatory test we want to run"); - -static const char *hwsim_alpha2s[] = { - "FI", - "AL", - "US", - "DE", - "JP", - "AL", -}; - -static const struct ieee80211_regdomain hwsim_world_regdom_custom_01 = { - .n_reg_rules = 4, - .alpha2 = "99", - .reg_rules = { - REG_RULE(2412-10, 2462+10, 40, 0, 20, 0), - REG_RULE(2484-10, 2484+10, 40, 0, 20, 0), - REG_RULE(5150-10, 5240+10, 40, 0, 30, 0), - REG_RULE(5745-10, 5825+10, 40, 0, 30, 0), - } -}; - -static const struct ieee80211_regdomain hwsim_world_regdom_custom_02 = { - .n_reg_rules = 2, - .alpha2 = "99", - .reg_rules = { - REG_RULE(2412-10, 2462+10, 40, 0, 20, 0), - REG_RULE(5725-10, 5850+10, 40, 0, 30, - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS), - } -}; - -struct hwsim_vif_priv { - u32 magic; - u8 bssid[ETH_ALEN]; - bool assoc; - u16 aid; -}; - -#define HWSIM_VIF_MAGIC 0x69537748 - -static inline void hwsim_check_magic(struct ieee80211_vif *vif) -{ - struct hwsim_vif_priv *vp = (void *)vif->drv_priv; - WARN(vp->magic != HWSIM_VIF_MAGIC, - "Invalid VIF (%p) magic %#x, %pM, %d/%d\n", - vif, vp->magic, vif->addr, vif->type, vif->p2p); -} - -static inline void hwsim_set_magic(struct ieee80211_vif *vif) -{ - struct hwsim_vif_priv *vp = (void *)vif->drv_priv; - vp->magic = HWSIM_VIF_MAGIC; -} - -static inline void hwsim_clear_magic(struct ieee80211_vif *vif) -{ - struct hwsim_vif_priv *vp = (void *)vif->drv_priv; - vp->magic = 0; -} - -struct hwsim_sta_priv { - u32 magic; -}; - -#define HWSIM_STA_MAGIC 0x6d537749 - -static inline void hwsim_check_sta_magic(struct ieee80211_sta *sta) -{ - struct hwsim_sta_priv *sp = (void *)sta->drv_priv; - WARN_ON(sp->magic != HWSIM_STA_MAGIC); -} - -static inline void hwsim_set_sta_magic(struct ieee80211_sta *sta) -{ - struct hwsim_sta_priv *sp = (void *)sta->drv_priv; - sp->magic = HWSIM_STA_MAGIC; -} - -static inline void hwsim_clear_sta_magic(struct ieee80211_sta *sta) -{ - struct hwsim_sta_priv *sp = (void *)sta->drv_priv; - sp->magic = 0; -} - -struct hwsim_chanctx_priv { - u32 magic; -}; - -#define HWSIM_CHANCTX_MAGIC 0x6d53774a - -static inline void hwsim_check_chanctx_magic(struct ieee80211_chanctx_conf *c) -{ - struct hwsim_chanctx_priv *cp = (void *)c->drv_priv; - WARN_ON(cp->magic != HWSIM_CHANCTX_MAGIC); -} - -static inline void hwsim_set_chanctx_magic(struct ieee80211_chanctx_conf *c) -{ - struct hwsim_chanctx_priv *cp = (void *)c->drv_priv; - cp->magic = HWSIM_CHANCTX_MAGIC; -} - -static inline void hwsim_clear_chanctx_magic(struct ieee80211_chanctx_conf *c) -{ - struct hwsim_chanctx_priv *cp = (void *)c->drv_priv; - cp->magic = 0; -} - -static struct class *hwsim_class; - -static struct net_device *hwsim_mon; /* global monitor netdev */ - -#define CHAN2G(_freq) { \ - .band = IEEE80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_freq), \ - .max_power = 20, \ -} - -#define CHAN5G(_freq) { \ - .band = IEEE80211_BAND_5GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_freq), \ - .max_power = 20, \ -} - -static const struct ieee80211_channel hwsim_channels_2ghz[] = { - CHAN2G(2412), /* Channel 1 */ - CHAN2G(2417), /* Channel 2 */ - CHAN2G(2422), /* Channel 3 */ - CHAN2G(2427), /* Channel 4 */ - CHAN2G(2432), /* Channel 5 */ - CHAN2G(2437), /* Channel 6 */ - CHAN2G(2442), /* Channel 7 */ - CHAN2G(2447), /* Channel 8 */ - CHAN2G(2452), /* Channel 9 */ - CHAN2G(2457), /* Channel 10 */ - CHAN2G(2462), /* Channel 11 */ - CHAN2G(2467), /* Channel 12 */ - CHAN2G(2472), /* Channel 13 */ - CHAN2G(2484), /* Channel 14 */ -}; - -static const struct ieee80211_channel hwsim_channels_5ghz[] = { - CHAN5G(5180), /* Channel 36 */ - CHAN5G(5200), /* Channel 40 */ - CHAN5G(5220), /* Channel 44 */ - CHAN5G(5240), /* Channel 48 */ - - CHAN5G(5260), /* Channel 52 */ - CHAN5G(5280), /* Channel 56 */ - CHAN5G(5300), /* Channel 60 */ - CHAN5G(5320), /* Channel 64 */ - - CHAN5G(5500), /* Channel 100 */ - CHAN5G(5520), /* Channel 104 */ - CHAN5G(5540), /* Channel 108 */ - CHAN5G(5560), /* Channel 112 */ - CHAN5G(5580), /* Channel 116 */ - CHAN5G(5600), /* Channel 120 */ - CHAN5G(5620), /* Channel 124 */ - CHAN5G(5640), /* Channel 128 */ - CHAN5G(5660), /* Channel 132 */ - CHAN5G(5680), /* Channel 136 */ - CHAN5G(5700), /* Channel 140 */ - - CHAN5G(5745), /* Channel 149 */ - CHAN5G(5765), /* Channel 153 */ - CHAN5G(5785), /* Channel 157 */ - CHAN5G(5805), /* Channel 161 */ - CHAN5G(5825), /* Channel 165 */ -}; - -static const struct ieee80211_rate hwsim_rates[] = { - { .bitrate = 10 }, - { .bitrate = 20, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 55, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 110, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 60 }, - { .bitrate = 90 }, - { .bitrate = 120 }, - { .bitrate = 180 }, - { .bitrate = 240 }, - { .bitrate = 360 }, - { .bitrate = 480 }, - { .bitrate = 540 } -}; - -static spinlock_t hwsim_radio_lock; -static struct list_head hwsim_radios; - -struct mac80211_hwsim_data { - struct list_head list; - struct ieee80211_hw *hw; - struct device *dev; - struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; - struct ieee80211_channel channels_2ghz[ARRAY_SIZE(hwsim_channels_2ghz)]; - struct ieee80211_channel channels_5ghz[ARRAY_SIZE(hwsim_channels_5ghz)]; - struct ieee80211_rate rates[ARRAY_SIZE(hwsim_rates)]; - - struct mac_address addresses[2]; - - struct ieee80211_channel *tmp_chan; - struct delayed_work roc_done; - struct delayed_work hw_scan; - struct cfg80211_scan_request *hw_scan_request; - struct ieee80211_vif *hw_scan_vif; - int scan_chan_idx; - - struct ieee80211_channel *channel; - u64 beacon_int /* beacon interval in us */; - unsigned int rx_filter; - bool started, idle, scanning; - struct mutex mutex; - struct tasklet_hrtimer beacon_timer; - enum ps_mode { - PS_DISABLED, PS_ENABLED, PS_AUTO_POLL, PS_MANUAL_POLL - } ps; - bool ps_poll_pending; - struct dentry *debugfs; - struct dentry *debugfs_ps; - - struct sk_buff_head pending; /* packets pending */ - /* - * Only radios in the same group can communicate together (the - * channel has to match too). Each bit represents a group. A - * radio can be in more then one group. - */ - u64 group; - struct dentry *debugfs_group; - - int power_level; - - /* difference between this hw's clock and the real clock, in usecs */ - s64 tsf_offset; - s64 bcn_delta; - /* absolute beacon transmission time. Used to cover up "tx" delay. */ - u64 abs_bcn_ts; -}; - - -struct hwsim_radiotap_hdr { - struct ieee80211_radiotap_header hdr; - __le64 rt_tsft; - u8 rt_flags; - u8 rt_rate; - __le16 rt_channel; - __le16 rt_chbitmask; -} __packed; - -/* MAC80211_HWSIM netlinf family */ -static struct genl_family hwsim_genl_family = { - .id = GENL_ID_GENERATE, - .hdrsize = 0, - .name = "MAC80211_HWSIM", - .version = 1, - .maxattr = HWSIM_ATTR_MAX, -}; - -/* MAC80211_HWSIM netlink policy */ - -static struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = { - [HWSIM_ATTR_ADDR_RECEIVER] = { .type = NLA_UNSPEC, - .len = 6*sizeof(u8) }, - [HWSIM_ATTR_ADDR_TRANSMITTER] = { .type = NLA_UNSPEC, - .len = 6*sizeof(u8) }, - [HWSIM_ATTR_FRAME] = { .type = NLA_BINARY, - .len = IEEE80211_MAX_DATA_LEN }, - [HWSIM_ATTR_FLAGS] = { .type = NLA_U32 }, - [HWSIM_ATTR_RX_RATE] = { .type = NLA_U32 }, - [HWSIM_ATTR_SIGNAL] = { .type = NLA_U32 }, - [HWSIM_ATTR_TX_INFO] = { .type = NLA_UNSPEC, - .len = IEEE80211_TX_MAX_RATES*sizeof( - struct hwsim_tx_rate)}, - [HWSIM_ATTR_COOKIE] = { .type = NLA_U64 }, -}; - -static netdev_tx_t hwsim_mon_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - /* TODO: allow packet injection */ - dev_kfree_skb(skb); - return NETDEV_TX_OK; -} - -static inline u64 mac80211_hwsim_get_tsf_raw(void) -{ - return ktime_to_us(ktime_get_real()); -} - -static __le64 __mac80211_hwsim_get_tsf(struct mac80211_hwsim_data *data) -{ - u64 now = mac80211_hwsim_get_tsf_raw(); - return cpu_to_le64(now + data->tsf_offset); -} - -static u64 mac80211_hwsim_get_tsf(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct mac80211_hwsim_data *data = hw->priv; - return le64_to_cpu(__mac80211_hwsim_get_tsf(data)); -} - -static void mac80211_hwsim_set_tsf(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u64 tsf) -{ - struct mac80211_hwsim_data *data = hw->priv; - u64 now = mac80211_hwsim_get_tsf(hw, vif); - u32 bcn_int = data->beacon_int; - s64 delta = tsf - now; - - data->tsf_offset += delta; - /* adjust after beaconing with new timestamp at old TBTT */ - data->bcn_delta = do_div(delta, bcn_int); -} - -static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, - struct sk_buff *tx_skb, - struct ieee80211_channel *chan) -{ - struct mac80211_hwsim_data *data = hw->priv; - struct sk_buff *skb; - struct hwsim_radiotap_hdr *hdr; - u16 flags; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb); - struct ieee80211_rate *txrate = ieee80211_get_tx_rate(hw, info); - - if (!netif_running(hwsim_mon)) - return; - - skb = skb_copy_expand(tx_skb, sizeof(*hdr), 0, GFP_ATOMIC); - if (skb == NULL) - return; - - hdr = (struct hwsim_radiotap_hdr *) skb_push(skb, sizeof(*hdr)); - hdr->hdr.it_version = PKTHDR_RADIOTAP_VERSION; - hdr->hdr.it_pad = 0; - hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr)); - hdr->hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) | - (1 << IEEE80211_RADIOTAP_RATE) | - (1 << IEEE80211_RADIOTAP_TSFT) | - (1 << IEEE80211_RADIOTAP_CHANNEL)); - hdr->rt_tsft = __mac80211_hwsim_get_tsf(data); - hdr->rt_flags = 0; - hdr->rt_rate = txrate->bitrate / 5; - hdr->rt_channel = cpu_to_le16(chan->center_freq); - flags = IEEE80211_CHAN_2GHZ; - if (txrate->flags & IEEE80211_RATE_ERP_G) - flags |= IEEE80211_CHAN_OFDM; - else - flags |= IEEE80211_CHAN_CCK; - hdr->rt_chbitmask = cpu_to_le16(flags); - - skb->dev = hwsim_mon; - skb_set_mac_header(skb, 0); - skb->ip_summed = CHECKSUM_UNNECESSARY; - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = htons(ETH_P_802_2); - memset(skb->cb, 0, sizeof(skb->cb)); - netif_rx(skb); -} - - -static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, - const u8 *addr) -{ - struct sk_buff *skb; - struct hwsim_radiotap_hdr *hdr; - u16 flags; - struct ieee80211_hdr *hdr11; - - if (!netif_running(hwsim_mon)) - return; - - skb = dev_alloc_skb(100); - if (skb == NULL) - return; - - hdr = (struct hwsim_radiotap_hdr *) skb_put(skb, sizeof(*hdr)); - hdr->hdr.it_version = PKTHDR_RADIOTAP_VERSION; - hdr->hdr.it_pad = 0; - hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr)); - hdr->hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) | - (1 << IEEE80211_RADIOTAP_CHANNEL)); - hdr->rt_flags = 0; - hdr->rt_rate = 0; - hdr->rt_channel = cpu_to_le16(chan->center_freq); - flags = IEEE80211_CHAN_2GHZ; - hdr->rt_chbitmask = cpu_to_le16(flags); - - hdr11 = (struct ieee80211_hdr *) skb_put(skb, 10); - hdr11->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | - IEEE80211_STYPE_ACK); - hdr11->duration_id = cpu_to_le16(0); - memcpy(hdr11->addr1, addr, ETH_ALEN); - - skb->dev = hwsim_mon; - skb_set_mac_header(skb, 0); - skb->ip_summed = CHECKSUM_UNNECESSARY; - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = htons(ETH_P_802_2); - memset(skb->cb, 0, sizeof(skb->cb)); - netif_rx(skb); -} - - -static bool hwsim_ps_rx_ok(struct mac80211_hwsim_data *data, - struct sk_buff *skb) -{ - switch (data->ps) { - case PS_DISABLED: - return true; - case PS_ENABLED: - return false; - case PS_AUTO_POLL: - /* TODO: accept (some) Beacons by default and other frames only - * if pending PS-Poll has been sent */ - return true; - case PS_MANUAL_POLL: - /* Allow unicast frames to own address if there is a pending - * PS-Poll */ - if (data->ps_poll_pending && - memcmp(data->hw->wiphy->perm_addr, skb->data + 4, - ETH_ALEN) == 0) { - data->ps_poll_pending = false; - return true; - } - return false; - } - - return true; -} - - -struct mac80211_hwsim_addr_match_data { - bool ret; - const u8 *addr; -}; - -static void mac80211_hwsim_addr_iter(void *data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct mac80211_hwsim_addr_match_data *md = data; - if (memcmp(mac, md->addr, ETH_ALEN) == 0) - md->ret = true; -} - - -static bool mac80211_hwsim_addr_match(struct mac80211_hwsim_data *data, - const u8 *addr) -{ - struct mac80211_hwsim_addr_match_data md; - - if (memcmp(addr, data->hw->wiphy->perm_addr, ETH_ALEN) == 0) - return true; - - md.ret = false; - md.addr = addr; - ieee80211_iterate_active_interfaces_atomic(data->hw, - IEEE80211_IFACE_ITER_NORMAL, - mac80211_hwsim_addr_iter, - &md); - - return md.ret; -} - -static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, - struct sk_buff *my_skb, - int dst_portid) -{ - struct sk_buff *skb; - struct mac80211_hwsim_data *data = hw->priv; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) my_skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(my_skb); - void *msg_head; - unsigned int hwsim_flags = 0; - int i; - struct hwsim_tx_rate tx_attempts[IEEE80211_TX_MAX_RATES]; - - if (data->ps != PS_DISABLED) - hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); - /* If the queue contains MAX_QUEUE skb's drop some */ - if (skb_queue_len(&data->pending) >= MAX_QUEUE) { - /* Droping until WARN_QUEUE level */ - while (skb_queue_len(&data->pending) >= WARN_QUEUE) - skb_dequeue(&data->pending); - } - - skb = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_ATOMIC); - if (skb == NULL) - goto nla_put_failure; - - msg_head = genlmsg_put(skb, 0, 0, &hwsim_genl_family, 0, - HWSIM_CMD_FRAME); - if (msg_head == NULL) { - printk(KERN_DEBUG "mac80211_hwsim: problem with msg_head\n"); - goto nla_put_failure; - } - - if (nla_put(skb, HWSIM_ATTR_ADDR_TRANSMITTER, - sizeof(struct mac_address), data->addresses[1].addr)) - goto nla_put_failure; - - /* We get the skb->data */ - if (nla_put(skb, HWSIM_ATTR_FRAME, my_skb->len, my_skb->data)) - goto nla_put_failure; - - /* We get the flags for this transmission, and we translate them to - wmediumd flags */ - - if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) - hwsim_flags |= HWSIM_TX_CTL_REQ_TX_STATUS; - - if (info->flags & IEEE80211_TX_CTL_NO_ACK) - hwsim_flags |= HWSIM_TX_CTL_NO_ACK; - - if (nla_put_u32(skb, HWSIM_ATTR_FLAGS, hwsim_flags)) - goto nla_put_failure; - - /* We get the tx control (rate and retries) info*/ - - for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { - tx_attempts[i].idx = info->status.rates[i].idx; - tx_attempts[i].count = info->status.rates[i].count; - } - - if (nla_put(skb, HWSIM_ATTR_TX_INFO, - sizeof(struct hwsim_tx_rate)*IEEE80211_TX_MAX_RATES, - tx_attempts)) - goto nla_put_failure; - - /* We create a cookie to identify this skb */ - if (nla_put_u64(skb, HWSIM_ATTR_COOKIE, (unsigned long) my_skb)) - goto nla_put_failure; - - genlmsg_end(skb, msg_head); - genlmsg_unicast(&init_net, skb, dst_portid); - - /* Enqueue the packet */ - skb_queue_tail(&data->pending, my_skb); - return; - -nla_put_failure: - printk(KERN_DEBUG "mac80211_hwsim: error occurred in %s\n", __func__); -} - -static bool hwsim_chans_compat(struct ieee80211_channel *c1, - struct ieee80211_channel *c2) -{ - if (!c1 || !c2) - return false; - - return c1->center_freq == c2->center_freq; -} - -struct tx_iter_data { - struct ieee80211_channel *channel; - bool receive; -}; - -static void mac80211_hwsim_tx_iter(void *_data, u8 *addr, - struct ieee80211_vif *vif) -{ - struct tx_iter_data *data = _data; - - if (!vif->chanctx_conf) - return; - - if (!hwsim_chans_compat(data->channel, - rcu_dereference(vif->chanctx_conf)->def.chan)) - return; - - data->receive = true; -} - -static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw, - struct sk_buff *skb, - struct ieee80211_channel *chan) -{ - struct mac80211_hwsim_data *data = hw->priv, *data2; - bool ack = false; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_rx_status rx_status; - u64 now; - - memset(&rx_status, 0, sizeof(rx_status)); - rx_status.flag |= RX_FLAG_MACTIME_START; - rx_status.freq = chan->center_freq; - rx_status.band = chan->band; - if (info->control.rates[0].flags & IEEE80211_TX_RC_VHT_MCS) { - rx_status.rate_idx = - ieee80211_rate_get_vht_mcs(&info->control.rates[0]); - rx_status.vht_nss = - ieee80211_rate_get_vht_nss(&info->control.rates[0]); - rx_status.flag |= RX_FLAG_VHT; - } else { - rx_status.rate_idx = info->control.rates[0].idx; - if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS) - rx_status.flag |= RX_FLAG_HT; - } - if (info->control.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) - rx_status.flag |= RX_FLAG_40MHZ; - if (info->control.rates[0].flags & IEEE80211_TX_RC_SHORT_GI) - rx_status.flag |= RX_FLAG_SHORT_GI; - /* TODO: simulate real signal strength (and optional packet loss) */ - rx_status.signal = data->power_level - 50; - - if (data->ps != PS_DISABLED) - hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); - - /* release the skb's source info */ - skb_orphan(skb); - skb_dst_drop(skb); - skb->mark = 0; - secpath_reset(skb); - nf_reset(skb); - - /* - * Get absolute mactime here so all HWs RX at the "same time", and - * absolute TX time for beacon mactime so the timestamp matches. - * Giving beacons a different mactime than non-beacons looks messy, but - * it helps the Toffset be exact and a ~10us mactime discrepancy - * probably doesn't really matter. - */ - if (ieee80211_is_beacon(hdr->frame_control) || - ieee80211_is_probe_resp(hdr->frame_control)) - now = data->abs_bcn_ts; - else - now = mac80211_hwsim_get_tsf_raw(); - - /* Copy skb to all enabled radios that are on the current frequency */ - spin_lock(&hwsim_radio_lock); - list_for_each_entry(data2, &hwsim_radios, list) { - struct sk_buff *nskb; - struct tx_iter_data tx_iter_data = { - .receive = false, - .channel = chan, - }; - - if (data == data2) - continue; - - if (!data2->started || (data2->idle && !data2->tmp_chan) || - !hwsim_ps_rx_ok(data2, skb)) - continue; - - if (!(data->group & data2->group)) - continue; - - if (!hwsim_chans_compat(chan, data2->tmp_chan) && - !hwsim_chans_compat(chan, data2->channel)) { - ieee80211_iterate_active_interfaces_atomic( - data2->hw, IEEE80211_IFACE_ITER_NORMAL, - mac80211_hwsim_tx_iter, &tx_iter_data); - if (!tx_iter_data.receive) - continue; - } - - /* - * reserve some space for our vendor and the normal - * radiotap header, since we're copying anyway - */ - if (skb->len < PAGE_SIZE && paged_rx) { - struct page *page = alloc_page(GFP_ATOMIC); - - if (!page) - continue; - - nskb = dev_alloc_skb(128); - if (!nskb) { - __free_page(page); - continue; - } - - memcpy(page_address(page), skb->data, skb->len); - skb_add_rx_frag(nskb, 0, page, 0, skb->len, skb->len); - } else { - nskb = skb_copy(skb, GFP_ATOMIC); - if (!nskb) - continue; - } - - if (mac80211_hwsim_addr_match(data2, hdr->addr1)) - ack = true; - - rx_status.mactime = now + data2->tsf_offset; -#if 0 - /* - * Don't enable this code by default as the OUI 00:00:00 - * is registered to Xerox so we shouldn't use it here, it - * might find its way into pcap files. - * Note that this code requires the headroom in the SKB - * that was allocated earlier. - */ - rx_status.vendor_radiotap_oui[0] = 0x00; - rx_status.vendor_radiotap_oui[1] = 0x00; - rx_status.vendor_radiotap_oui[2] = 0x00; - rx_status.vendor_radiotap_subns = 127; - /* - * Radiotap vendor namespaces can (and should) also be - * split into fields by using the standard radiotap - * presence bitmap mechanism. Use just BIT(0) here for - * the presence bitmap. - */ - rx_status.vendor_radiotap_bitmap = BIT(0); - /* We have 8 bytes of (dummy) data */ - rx_status.vendor_radiotap_len = 8; - /* For testing, also require it to be aligned */ - rx_status.vendor_radiotap_align = 8; - /* push the data */ - memcpy(skb_push(nskb, 8), "ABCDEFGH", 8); -#endif - - memcpy(IEEE80211_SKB_RXCB(nskb), &rx_status, sizeof(rx_status)); - ieee80211_rx_irqsafe(data2->hw, nskb); - } - spin_unlock(&hwsim_radio_lock); - - return ack; -} - -static void mac80211_hwsim_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct mac80211_hwsim_data *data = hw->priv; - struct ieee80211_tx_info *txi = IEEE80211_SKB_CB(skb); - struct ieee80211_chanctx_conf *chanctx_conf; - struct ieee80211_channel *channel; - bool ack; - u32 _portid; - - if (WARN_ON(skb->len < 10)) { - /* Should not happen; just a sanity check for addr1 use */ - dev_kfree_skb(skb); - return; - } - - if (channels == 1) { - channel = data->channel; - } else if (txi->hw_queue == 4) { - channel = data->tmp_chan; - } else { - chanctx_conf = rcu_dereference(txi->control.vif->chanctx_conf); - if (chanctx_conf) - channel = chanctx_conf->def.chan; - else - channel = NULL; - } - - if (WARN(!channel, "TX w/o channel - queue = %d\n", txi->hw_queue)) { - dev_kfree_skb(skb); - return; - } - - if (data->idle && !data->tmp_chan) { - wiphy_debug(hw->wiphy, "Trying to TX when idle - reject\n"); - dev_kfree_skb(skb); - return; - } - - if (txi->control.vif) - hwsim_check_magic(txi->control.vif); - if (control->sta) - hwsim_check_sta_magic(control->sta); - - if (rctbl) - ieee80211_get_tx_rates(txi->control.vif, control->sta, skb, - txi->control.rates, - ARRAY_SIZE(txi->control.rates)); - - txi->rate_driver_data[0] = channel; - mac80211_hwsim_monitor_rx(hw, skb, channel); - - /* wmediumd mode check */ - _portid = ACCESS_ONCE(wmediumd_portid); - - if (_portid) - return mac80211_hwsim_tx_frame_nl(hw, skb, _portid); - - /* NO wmediumd detected, perfect medium simulation */ - ack = mac80211_hwsim_tx_frame_no_nl(hw, skb, channel); - - if (ack && skb->len >= 16) { - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - mac80211_hwsim_monitor_ack(channel, hdr->addr2); - } - - ieee80211_tx_info_clear_status(txi); - - /* frame was transmitted at most favorable rate at first attempt */ - txi->control.rates[0].count = 1; - txi->control.rates[1].idx = -1; - - if (!(txi->flags & IEEE80211_TX_CTL_NO_ACK) && ack) - txi->flags |= IEEE80211_TX_STAT_ACK; - ieee80211_tx_status_irqsafe(hw, skb); -} - - -static int mac80211_hwsim_start(struct ieee80211_hw *hw) -{ - struct mac80211_hwsim_data *data = hw->priv; - wiphy_debug(hw->wiphy, "%s\n", __func__); - data->started = true; - return 0; -} - - -static void mac80211_hwsim_stop(struct ieee80211_hw *hw) -{ - struct mac80211_hwsim_data *data = hw->priv; - data->started = false; - tasklet_hrtimer_cancel(&data->beacon_timer); - wiphy_debug(hw->wiphy, "%s\n", __func__); -} - - -static int mac80211_hwsim_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - wiphy_debug(hw->wiphy, "%s (type=%d mac_addr=%pM)\n", - __func__, ieee80211_vif_type_p2p(vif), - vif->addr); - hwsim_set_magic(vif); - - vif->cab_queue = 0; - vif->hw_queue[IEEE80211_AC_VO] = 0; - vif->hw_queue[IEEE80211_AC_VI] = 1; - vif->hw_queue[IEEE80211_AC_BE] = 2; - vif->hw_queue[IEEE80211_AC_BK] = 3; - - return 0; -} - - -static int mac80211_hwsim_change_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum nl80211_iftype newtype, - bool newp2p) -{ - newtype = ieee80211_iftype_p2p(newtype, newp2p); - wiphy_debug(hw->wiphy, - "%s (old type=%d, new type=%d, mac_addr=%pM)\n", - __func__, ieee80211_vif_type_p2p(vif), - newtype, vif->addr); - hwsim_check_magic(vif); - - /* - * interface may change from non-AP to AP in - * which case this needs to be set up again - */ - vif->cab_queue = 0; - - return 0; -} - -static void mac80211_hwsim_remove_interface( - struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - wiphy_debug(hw->wiphy, "%s (type=%d mac_addr=%pM)\n", - __func__, ieee80211_vif_type_p2p(vif), - vif->addr); - hwsim_check_magic(vif); - hwsim_clear_magic(vif); -} - -static void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, - struct sk_buff *skb, - struct ieee80211_channel *chan) -{ - u32 _pid = ACCESS_ONCE(wmediumd_portid); - - if (rctbl) { - struct ieee80211_tx_info *txi = IEEE80211_SKB_CB(skb); - ieee80211_get_tx_rates(txi->control.vif, NULL, skb, - txi->control.rates, - ARRAY_SIZE(txi->control.rates)); - } - - mac80211_hwsim_monitor_rx(hw, skb, chan); - - if (_pid) - return mac80211_hwsim_tx_frame_nl(hw, skb, _pid); - - mac80211_hwsim_tx_frame_no_nl(hw, skb, chan); - dev_kfree_skb(skb); -} - -static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac, - struct ieee80211_vif *vif) -{ - struct mac80211_hwsim_data *data = arg; - struct ieee80211_hw *hw = data->hw; - struct ieee80211_tx_info *info; - struct ieee80211_rate *txrate; - struct ieee80211_mgmt *mgmt; - struct sk_buff *skb; - - hwsim_check_magic(vif); - - if (vif->type != NL80211_IFTYPE_AP && - vif->type != NL80211_IFTYPE_MESH_POINT && - vif->type != NL80211_IFTYPE_ADHOC) - return; - - skb = ieee80211_beacon_get(hw, vif); - if (skb == NULL) - return; - info = IEEE80211_SKB_CB(skb); - if (rctbl) - ieee80211_get_tx_rates(vif, NULL, skb, - info->control.rates, - ARRAY_SIZE(info->control.rates)); - - txrate = ieee80211_get_tx_rate(hw, info); - - mgmt = (struct ieee80211_mgmt *) skb->data; - /* fake header transmission time */ - data->abs_bcn_ts = mac80211_hwsim_get_tsf_raw(); - mgmt->u.beacon.timestamp = cpu_to_le64(data->abs_bcn_ts + - data->tsf_offset + - 24 * 8 * 10 / txrate->bitrate); - - mac80211_hwsim_tx_frame(hw, skb, - rcu_dereference(vif->chanctx_conf)->def.chan); -} - -static enum hrtimer_restart -mac80211_hwsim_beacon(struct hrtimer *timer) -{ - struct mac80211_hwsim_data *data = - container_of(timer, struct mac80211_hwsim_data, - beacon_timer.timer); - struct ieee80211_hw *hw = data->hw; - u64 bcn_int = data->beacon_int; - ktime_t next_bcn; - - if (!data->started) - goto out; - - ieee80211_iterate_active_interfaces_atomic( - hw, IEEE80211_IFACE_ITER_NORMAL, - mac80211_hwsim_beacon_tx, data); - - /* beacon at new TBTT + beacon interval */ - if (data->bcn_delta) { - bcn_int -= data->bcn_delta; - data->bcn_delta = 0; - } - - next_bcn = ktime_add(hrtimer_get_expires(timer), - ns_to_ktime(bcn_int * 1000)); - tasklet_hrtimer_start(&data->beacon_timer, next_bcn, HRTIMER_MODE_ABS); -out: - return HRTIMER_NORESTART; -} - -static const char * const hwsim_chanwidths[] = { - [NL80211_CHAN_WIDTH_20_NOHT] = "noht", - [NL80211_CHAN_WIDTH_20] = "ht20", - [NL80211_CHAN_WIDTH_40] = "ht40", - [NL80211_CHAN_WIDTH_80] = "vht80", - [NL80211_CHAN_WIDTH_80P80] = "vht80p80", - [NL80211_CHAN_WIDTH_160] = "vht160", -}; - -static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed) -{ - struct mac80211_hwsim_data *data = hw->priv; - struct ieee80211_conf *conf = &hw->conf; - static const char *smps_modes[IEEE80211_SMPS_NUM_MODES] = { - [IEEE80211_SMPS_AUTOMATIC] = "auto", - [IEEE80211_SMPS_OFF] = "off", - [IEEE80211_SMPS_STATIC] = "static", - [IEEE80211_SMPS_DYNAMIC] = "dynamic", - }; - - if (conf->chandef.chan) - wiphy_debug(hw->wiphy, - "%s (freq=%d(%d - %d)/%s idle=%d ps=%d smps=%s)\n", - __func__, - conf->chandef.chan->center_freq, - conf->chandef.center_freq1, - conf->chandef.center_freq2, - hwsim_chanwidths[conf->chandef.width], - !!(conf->flags & IEEE80211_CONF_IDLE), - !!(conf->flags & IEEE80211_CONF_PS), - smps_modes[conf->smps_mode]); - else - wiphy_debug(hw->wiphy, - "%s (freq=0 idle=%d ps=%d smps=%s)\n", - __func__, - !!(conf->flags & IEEE80211_CONF_IDLE), - !!(conf->flags & IEEE80211_CONF_PS), - smps_modes[conf->smps_mode]); - - data->idle = !!(conf->flags & IEEE80211_CONF_IDLE); - - data->channel = conf->chandef.chan; - - WARN_ON(data->channel && channels > 1); - - data->power_level = conf->power_level; - if (!data->started || !data->beacon_int) - tasklet_hrtimer_cancel(&data->beacon_timer); - else if (!hrtimer_is_queued(&data->beacon_timer.timer)) { - u64 tsf = mac80211_hwsim_get_tsf(hw, NULL); - u32 bcn_int = data->beacon_int; - u64 until_tbtt = bcn_int - do_div(tsf, bcn_int); - - tasklet_hrtimer_start(&data->beacon_timer, - ns_to_ktime(until_tbtt * 1000), - HRTIMER_MODE_REL); - } - - return 0; -} - - -static void mac80211_hwsim_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *total_flags,u64 multicast) -{ - struct mac80211_hwsim_data *data = hw->priv; - - wiphy_debug(hw->wiphy, "%s\n", __func__); - - data->rx_filter = 0; - if (*total_flags & FIF_PROMISC_IN_BSS) - data->rx_filter |= FIF_PROMISC_IN_BSS; - if (*total_flags & FIF_ALLMULTI) - data->rx_filter |= FIF_ALLMULTI; - - *total_flags = data->rx_filter; -} - -static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *info, - u32 changed) -{ - struct hwsim_vif_priv *vp = (void *)vif->drv_priv; - struct mac80211_hwsim_data *data = hw->priv; - - hwsim_check_magic(vif); - - wiphy_debug(hw->wiphy, "%s(changed=0x%x)\n", __func__, changed); - - if (changed & BSS_CHANGED_BSSID) { - wiphy_debug(hw->wiphy, "%s: BSSID changed: %pM\n", - __func__, info->bssid); - memcpy(vp->bssid, info->bssid, ETH_ALEN); - } - - if (changed & BSS_CHANGED_ASSOC) { - wiphy_debug(hw->wiphy, " ASSOC: assoc=%d aid=%d\n", - info->assoc, info->aid); - vp->assoc = info->assoc; - vp->aid = info->aid; - } - - if (changed & BSS_CHANGED_BEACON_INT) { - wiphy_debug(hw->wiphy, " BCNINT: %d\n", info->beacon_int); - data->beacon_int = info->beacon_int * 1024; - } - - if (changed & BSS_CHANGED_BEACON_ENABLED) { - wiphy_debug(hw->wiphy, " BCN EN: %d\n", info->enable_beacon); - if (data->started && - !hrtimer_is_queued(&data->beacon_timer.timer) && - info->enable_beacon) { - u64 tsf, until_tbtt; - u32 bcn_int; - if (WARN_ON(!data->beacon_int)) - data->beacon_int = 1000 * 1024; - tsf = mac80211_hwsim_get_tsf(hw, vif); - bcn_int = data->beacon_int; - until_tbtt = bcn_int - do_div(tsf, bcn_int); - tasklet_hrtimer_start(&data->beacon_timer, - ns_to_ktime(until_tbtt * 1000), - HRTIMER_MODE_REL); - } else if (!info->enable_beacon) - tasklet_hrtimer_cancel(&data->beacon_timer); - } - - if (changed & BSS_CHANGED_ERP_CTS_PROT) { - wiphy_debug(hw->wiphy, " ERP_CTS_PROT: %d\n", - info->use_cts_prot); - } - - if (changed & BSS_CHANGED_ERP_PREAMBLE) { - wiphy_debug(hw->wiphy, " ERP_PREAMBLE: %d\n", - info->use_short_preamble); - } - - if (changed & BSS_CHANGED_ERP_SLOT) { - wiphy_debug(hw->wiphy, " ERP_SLOT: %d\n", info->use_short_slot); - } - - if (changed & BSS_CHANGED_HT) { - wiphy_debug(hw->wiphy, " HT: op_mode=0x%x\n", - info->ht_operation_mode); - } - - if (changed & BSS_CHANGED_BASIC_RATES) { - wiphy_debug(hw->wiphy, " BASIC_RATES: 0x%llx\n", - (unsigned long long) info->basic_rates); - } - - if (changed & BSS_CHANGED_TXPOWER) - wiphy_debug(hw->wiphy, " TX Power: %d dBm\n", info->txpower); -} - -static int mac80211_hwsim_sta_add(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - hwsim_check_magic(vif); - hwsim_set_sta_magic(sta); - - return 0; -} - -static int mac80211_hwsim_sta_remove(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - hwsim_check_magic(vif); - hwsim_clear_sta_magic(sta); - - return 0; -} - -static void mac80211_hwsim_sta_notify(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum sta_notify_cmd cmd, - struct ieee80211_sta *sta) -{ - hwsim_check_magic(vif); - - switch (cmd) { - case STA_NOTIFY_SLEEP: - case STA_NOTIFY_AWAKE: - /* TODO: make good use of these flags */ - break; - default: - WARN(1, "Invalid sta notify: %d\n", cmd); - break; - } -} - -static int mac80211_hwsim_set_tim(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - bool set) -{ - hwsim_check_sta_magic(sta); - return 0; -} - -static int mac80211_hwsim_conf_tx( - struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - wiphy_debug(hw->wiphy, - "%s (queue=%d txop=%d cw_min=%d cw_max=%d aifs=%d)\n", - __func__, queue, - params->txop, params->cw_min, - params->cw_max, params->aifs); - return 0; -} - -static int mac80211_hwsim_get_survey( - struct ieee80211_hw *hw, int idx, - struct survey_info *survey) -{ - struct ieee80211_conf *conf = &hw->conf; - - wiphy_debug(hw->wiphy, "%s (idx=%d)\n", __func__, idx); - - if (idx != 0) - return -ENOENT; - - /* Current channel */ - survey->channel = conf->chandef.chan; - - /* - * Magically conjured noise level --- this is only ok for simulated hardware. - * - * A real driver which cannot determine the real channel noise MUST NOT - * report any noise, especially not a magically conjured one :-) - */ - survey->filled = SURVEY_INFO_NOISE_DBM; - survey->noise = -92; - - return 0; -} - -#ifdef CONFIG_NL80211_TESTMODE -/* - * This section contains example code for using netlink - * attributes with the testmode command in nl80211. - */ - -/* These enums need to be kept in sync with userspace */ -enum hwsim_testmode_attr { - __HWSIM_TM_ATTR_INVALID = 0, - HWSIM_TM_ATTR_CMD = 1, - HWSIM_TM_ATTR_PS = 2, - - /* keep last */ - __HWSIM_TM_ATTR_AFTER_LAST, - HWSIM_TM_ATTR_MAX = __HWSIM_TM_ATTR_AFTER_LAST - 1 -}; - -enum hwsim_testmode_cmd { - HWSIM_TM_CMD_SET_PS = 0, - HWSIM_TM_CMD_GET_PS = 1, - HWSIM_TM_CMD_STOP_QUEUES = 2, - HWSIM_TM_CMD_WAKE_QUEUES = 3, -}; - -static const struct nla_policy hwsim_testmode_policy[HWSIM_TM_ATTR_MAX + 1] = { - [HWSIM_TM_ATTR_CMD] = { .type = NLA_U32 }, - [HWSIM_TM_ATTR_PS] = { .type = NLA_U32 }, -}; - -static int hwsim_fops_ps_write(void *dat, u64 val); - -static int mac80211_hwsim_testmode_cmd(struct ieee80211_hw *hw, - void *data, int len) -{ - struct mac80211_hwsim_data *hwsim = hw->priv; - struct nlattr *tb[HWSIM_TM_ATTR_MAX + 1]; - struct sk_buff *skb; - int err, ps; - - err = nla_parse(tb, HWSIM_TM_ATTR_MAX, data, len, - hwsim_testmode_policy); - if (err) - return err; - - if (!tb[HWSIM_TM_ATTR_CMD]) - return -EINVAL; - - switch (nla_get_u32(tb[HWSIM_TM_ATTR_CMD])) { - case HWSIM_TM_CMD_SET_PS: - if (!tb[HWSIM_TM_ATTR_PS]) - return -EINVAL; - ps = nla_get_u32(tb[HWSIM_TM_ATTR_PS]); - return hwsim_fops_ps_write(hwsim, ps); - case HWSIM_TM_CMD_GET_PS: - skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, - nla_total_size(sizeof(u32))); - if (!skb) - return -ENOMEM; - if (nla_put_u32(skb, HWSIM_TM_ATTR_PS, hwsim->ps)) - goto nla_put_failure; - return cfg80211_testmode_reply(skb); - case HWSIM_TM_CMD_STOP_QUEUES: - ieee80211_stop_queues(hw); - return 0; - case HWSIM_TM_CMD_WAKE_QUEUES: - ieee80211_wake_queues(hw); - return 0; - default: - return -EOPNOTSUPP; - } - - nla_put_failure: - kfree_skb(skb); - return -ENOBUFS; -} -#endif - -static int mac80211_hwsim_ampdu_action(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, u16 tid, u16 *ssn, - u8 buf_size) -{ - switch (action) { - case IEEE80211_AMPDU_TX_START: - ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); - break; - case IEEE80211_AMPDU_TX_STOP_CONT: - case IEEE80211_AMPDU_TX_STOP_FLUSH: - case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: - ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); - break; - case IEEE80211_AMPDU_TX_OPERATIONAL: - break; - case IEEE80211_AMPDU_RX_START: - case IEEE80211_AMPDU_RX_STOP: - break; - default: - return -EOPNOTSUPP; - } - - return 0; -} - -static void mac80211_hwsim_flush(struct ieee80211_hw *hw, u32 queues, bool drop) -{ - /* Not implemented, queues only on kernel side */ -} - -static void hw_scan_work(struct work_struct *work) -{ - struct mac80211_hwsim_data *hwsim = - container_of(work, struct mac80211_hwsim_data, hw_scan.work); - struct cfg80211_scan_request *req = hwsim->hw_scan_request; - int dwell, i; - - mutex_lock(&hwsim->mutex); - if (hwsim->scan_chan_idx >= req->n_channels) { - wiphy_debug(hwsim->hw->wiphy, "hw scan complete\n"); - ieee80211_scan_completed(hwsim->hw, false); - hwsim->hw_scan_request = NULL; - hwsim->hw_scan_vif = NULL; - hwsim->tmp_chan = NULL; - mutex_unlock(&hwsim->mutex); - return; - } - - wiphy_debug(hwsim->hw->wiphy, "hw scan %d MHz\n", - req->channels[hwsim->scan_chan_idx]->center_freq); - - hwsim->tmp_chan = req->channels[hwsim->scan_chan_idx]; - if (hwsim->tmp_chan->flags & IEEE80211_CHAN_PASSIVE_SCAN || - !req->n_ssids) { - dwell = 120; - } else { - dwell = 30; - /* send probes */ - for (i = 0; i < req->n_ssids; i++) { - struct sk_buff *probe; - - probe = ieee80211_probereq_get(hwsim->hw, - hwsim->hw_scan_vif, - req->ssids[i].ssid, - req->ssids[i].ssid_len, - req->ie_len); - if (!probe) - continue; - - if (req->ie_len) - memcpy(skb_put(probe, req->ie_len), req->ie, - req->ie_len); - - local_bh_disable(); - mac80211_hwsim_tx_frame(hwsim->hw, probe, - hwsim->tmp_chan); - local_bh_enable(); - } - } - ieee80211_queue_delayed_work(hwsim->hw, &hwsim->hw_scan, - msecs_to_jiffies(dwell)); - hwsim->scan_chan_idx++; - mutex_unlock(&hwsim->mutex); -} - -static int mac80211_hwsim_hw_scan(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct cfg80211_scan_request *req) -{ - struct mac80211_hwsim_data *hwsim = hw->priv; - - mutex_lock(&hwsim->mutex); - if (WARN_ON(hwsim->tmp_chan || hwsim->hw_scan_request)) { - mutex_unlock(&hwsim->mutex); - return -EBUSY; - } - hwsim->hw_scan_request = req; - hwsim->hw_scan_vif = vif; - hwsim->scan_chan_idx = 0; - mutex_unlock(&hwsim->mutex); - - wiphy_debug(hw->wiphy, "hwsim hw_scan request\n"); - - ieee80211_queue_delayed_work(hwsim->hw, &hwsim->hw_scan, 0); - - return 0; -} - -static void mac80211_hwsim_cancel_hw_scan(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct mac80211_hwsim_data *hwsim = hw->priv; - - wiphy_debug(hw->wiphy, "hwsim cancel_hw_scan\n"); - - cancel_delayed_work_sync(&hwsim->hw_scan); - - mutex_lock(&hwsim->mutex); - ieee80211_scan_completed(hwsim->hw, true); - hwsim->tmp_chan = NULL; - hwsim->hw_scan_request = NULL; - hwsim->hw_scan_vif = NULL; - mutex_unlock(&hwsim->mutex); -} - -static void mac80211_hwsim_sw_scan(struct ieee80211_hw *hw) -{ - struct mac80211_hwsim_data *hwsim = hw->priv; - - mutex_lock(&hwsim->mutex); - - if (hwsim->scanning) { - printk(KERN_DEBUG "two hwsim sw_scans detected!\n"); - goto out; - } - - printk(KERN_DEBUG "hwsim sw_scan request, prepping stuff\n"); - hwsim->scanning = true; - -out: - mutex_unlock(&hwsim->mutex); -} - -static void mac80211_hwsim_sw_scan_complete(struct ieee80211_hw *hw) -{ - struct mac80211_hwsim_data *hwsim = hw->priv; - - mutex_lock(&hwsim->mutex); - - printk(KERN_DEBUG "hwsim sw_scan_complete\n"); - hwsim->scanning = false; - - mutex_unlock(&hwsim->mutex); -} - -static void hw_roc_done(struct work_struct *work) -{ - struct mac80211_hwsim_data *hwsim = - container_of(work, struct mac80211_hwsim_data, roc_done.work); - - mutex_lock(&hwsim->mutex); - ieee80211_remain_on_channel_expired(hwsim->hw); - hwsim->tmp_chan = NULL; - mutex_unlock(&hwsim->mutex); - - wiphy_debug(hwsim->hw->wiphy, "hwsim ROC expired\n"); -} - -static int mac80211_hwsim_roc(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_channel *chan, - int duration, - enum ieee80211_roc_type type) -{ - struct mac80211_hwsim_data *hwsim = hw->priv; - - mutex_lock(&hwsim->mutex); - if (WARN_ON(hwsim->tmp_chan || hwsim->hw_scan_request)) { - mutex_unlock(&hwsim->mutex); - return -EBUSY; - } - - hwsim->tmp_chan = chan; - mutex_unlock(&hwsim->mutex); - - wiphy_debug(hw->wiphy, "hwsim ROC (%d MHz, %d ms)\n", - chan->center_freq, duration); - - ieee80211_ready_on_channel(hw); - - ieee80211_queue_delayed_work(hw, &hwsim->roc_done, - msecs_to_jiffies(duration)); - return 0; -} - -static int mac80211_hwsim_croc(struct ieee80211_hw *hw) -{ - struct mac80211_hwsim_data *hwsim = hw->priv; - - cancel_delayed_work_sync(&hwsim->roc_done); - - mutex_lock(&hwsim->mutex); - hwsim->tmp_chan = NULL; - mutex_unlock(&hwsim->mutex); - - wiphy_debug(hw->wiphy, "hwsim ROC canceled\n"); - - return 0; -} - -static int mac80211_hwsim_add_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *ctx) -{ - hwsim_set_chanctx_magic(ctx); - wiphy_debug(hw->wiphy, - "add channel context control: %d MHz/width: %d/cfreqs:%d/%d MHz\n", - ctx->def.chan->center_freq, ctx->def.width, - ctx->def.center_freq1, ctx->def.center_freq2); - return 0; -} - -static void mac80211_hwsim_remove_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *ctx) -{ - wiphy_debug(hw->wiphy, - "remove channel context control: %d MHz/width: %d/cfreqs:%d/%d MHz\n", - ctx->def.chan->center_freq, ctx->def.width, - ctx->def.center_freq1, ctx->def.center_freq2); - hwsim_check_chanctx_magic(ctx); - hwsim_clear_chanctx_magic(ctx); -} - -static void mac80211_hwsim_change_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *ctx, - u32 changed) -{ - hwsim_check_chanctx_magic(ctx); - wiphy_debug(hw->wiphy, - "change channel context control: %d MHz/width: %d/cfreqs:%d/%d MHz\n", - ctx->def.chan->center_freq, ctx->def.width, - ctx->def.center_freq1, ctx->def.center_freq2); -} - -static int mac80211_hwsim_assign_vif_chanctx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_chanctx_conf *ctx) -{ - hwsim_check_magic(vif); - hwsim_check_chanctx_magic(ctx); - - return 0; -} - -static void mac80211_hwsim_unassign_vif_chanctx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_chanctx_conf *ctx) -{ - hwsim_check_magic(vif); - hwsim_check_chanctx_magic(ctx); -} - -static struct ieee80211_ops mac80211_hwsim_ops = -{ - .tx = mac80211_hwsim_tx, - .start = mac80211_hwsim_start, - .stop = mac80211_hwsim_stop, - .add_interface = mac80211_hwsim_add_interface, - .change_interface = mac80211_hwsim_change_interface, - .remove_interface = mac80211_hwsim_remove_interface, - .config = mac80211_hwsim_config, - .configure_filter = mac80211_hwsim_configure_filter, - .bss_info_changed = mac80211_hwsim_bss_info_changed, - .sta_add = mac80211_hwsim_sta_add, - .sta_remove = mac80211_hwsim_sta_remove, - .sta_notify = mac80211_hwsim_sta_notify, - .set_tim = mac80211_hwsim_set_tim, - .conf_tx = mac80211_hwsim_conf_tx, - .get_survey = mac80211_hwsim_get_survey, - CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd) - .ampdu_action = mac80211_hwsim_ampdu_action, - .sw_scan_start = mac80211_hwsim_sw_scan, - .sw_scan_complete = mac80211_hwsim_sw_scan_complete, - .flush = mac80211_hwsim_flush, - .get_tsf = mac80211_hwsim_get_tsf, - .set_tsf = mac80211_hwsim_set_tsf, -}; - - -static void mac80211_hwsim_free(void) -{ - struct list_head tmplist, *i, *tmp; - struct mac80211_hwsim_data *data, *tmpdata; - - INIT_LIST_HEAD(&tmplist); - - spin_lock_bh(&hwsim_radio_lock); - list_for_each_safe(i, tmp, &hwsim_radios) - list_move(i, &tmplist); - spin_unlock_bh(&hwsim_radio_lock); - - list_for_each_entry_safe(data, tmpdata, &tmplist, list) { - debugfs_remove(data->debugfs_group); - debugfs_remove(data->debugfs_ps); - debugfs_remove(data->debugfs); - ieee80211_unregister_hw(data->hw); - device_release_driver(data->dev); - device_unregister(data->dev); - ieee80211_free_hw(data->hw); - } - class_destroy(hwsim_class); -} - -static struct platform_driver mac80211_hwsim_driver = { - .driver = { - .name = "mac80211_hwsim", - .owner = THIS_MODULE, - }, -}; - -static const struct net_device_ops hwsim_netdev_ops = { - .ndo_start_xmit = hwsim_mon_xmit, - .ndo_change_mtu = eth_change_mtu, - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, -}; - -static void hwsim_mon_setup(struct net_device *dev) -{ - dev->netdev_ops = &hwsim_netdev_ops; - dev->destructor = free_netdev; - ether_setup(dev); - dev->tx_queue_len = 0; - dev->type = ARPHRD_IEEE80211_RADIOTAP; - memset(dev->dev_addr, 0, ETH_ALEN); - dev->dev_addr[0] = 0x12; -} - - -static void hwsim_send_ps_poll(void *dat, u8 *mac, struct ieee80211_vif *vif) -{ - struct mac80211_hwsim_data *data = dat; - struct hwsim_vif_priv *vp = (void *)vif->drv_priv; - struct sk_buff *skb; - struct ieee80211_pspoll *pspoll; - - if (!vp->assoc) - return; - - wiphy_debug(data->hw->wiphy, - "%s: send PS-Poll to %pM for aid %d\n", - __func__, vp->bssid, vp->aid); - - skb = dev_alloc_skb(sizeof(*pspoll)); - if (!skb) - return; - pspoll = (void *) skb_put(skb, sizeof(*pspoll)); - pspoll->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | - IEEE80211_STYPE_PSPOLL | - IEEE80211_FCTL_PM); - pspoll->aid = cpu_to_le16(0xc000 | vp->aid); - memcpy(pspoll->bssid, vp->bssid, ETH_ALEN); - memcpy(pspoll->ta, mac, ETH_ALEN); - - rcu_read_lock(); - mac80211_hwsim_tx_frame(data->hw, skb, - rcu_dereference(vif->chanctx_conf)->def.chan); - rcu_read_unlock(); -} - -static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac, - struct ieee80211_vif *vif, int ps) -{ - struct hwsim_vif_priv *vp = (void *)vif->drv_priv; - struct sk_buff *skb; - struct ieee80211_hdr *hdr; - - if (!vp->assoc) - return; - - wiphy_debug(data->hw->wiphy, - "%s: send data::nullfunc to %pM ps=%d\n", - __func__, vp->bssid, ps); - - skb = dev_alloc_skb(sizeof(*hdr)); - if (!skb) - return; - hdr = (void *) skb_put(skb, sizeof(*hdr) - ETH_ALEN); - hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA | - IEEE80211_STYPE_NULLFUNC | - (ps ? IEEE80211_FCTL_PM : 0)); - hdr->duration_id = cpu_to_le16(0); - memcpy(hdr->addr1, vp->bssid, ETH_ALEN); - memcpy(hdr->addr2, mac, ETH_ALEN); - memcpy(hdr->addr3, vp->bssid, ETH_ALEN); - - rcu_read_lock(); - mac80211_hwsim_tx_frame(data->hw, skb, - rcu_dereference(vif->chanctx_conf)->def.chan); - rcu_read_unlock(); -} - - -static void hwsim_send_nullfunc_ps(void *dat, u8 *mac, - struct ieee80211_vif *vif) -{ - struct mac80211_hwsim_data *data = dat; - hwsim_send_nullfunc(data, mac, vif, 1); -} - - -static void hwsim_send_nullfunc_no_ps(void *dat, u8 *mac, - struct ieee80211_vif *vif) -{ - struct mac80211_hwsim_data *data = dat; - hwsim_send_nullfunc(data, mac, vif, 0); -} - - -static int hwsim_fops_ps_read(void *dat, u64 *val) -{ - struct mac80211_hwsim_data *data = dat; - *val = data->ps; - return 0; -} - -static int hwsim_fops_ps_write(void *dat, u64 val) -{ - struct mac80211_hwsim_data *data = dat; - enum ps_mode old_ps; - - if (val != PS_DISABLED && val != PS_ENABLED && val != PS_AUTO_POLL && - val != PS_MANUAL_POLL) - return -EINVAL; - - old_ps = data->ps; - data->ps = val; - - if (val == PS_MANUAL_POLL) { - ieee80211_iterate_active_interfaces(data->hw, - IEEE80211_IFACE_ITER_NORMAL, - hwsim_send_ps_poll, data); - data->ps_poll_pending = true; - } else if (old_ps == PS_DISABLED && val != PS_DISABLED) { - ieee80211_iterate_active_interfaces(data->hw, - IEEE80211_IFACE_ITER_NORMAL, - hwsim_send_nullfunc_ps, - data); - } else if (old_ps != PS_DISABLED && val == PS_DISABLED) { - ieee80211_iterate_active_interfaces(data->hw, - IEEE80211_IFACE_ITER_NORMAL, - hwsim_send_nullfunc_no_ps, - data); - } - - return 0; -} - -DEFINE_SIMPLE_ATTRIBUTE(hwsim_fops_ps, hwsim_fops_ps_read, hwsim_fops_ps_write, - "%llu\n"); - - -static int hwsim_fops_group_read(void *dat, u64 *val) -{ - struct mac80211_hwsim_data *data = dat; - *val = data->group; - return 0; -} - -static int hwsim_fops_group_write(void *dat, u64 val) -{ - struct mac80211_hwsim_data *data = dat; - data->group = val; - return 0; -} - -DEFINE_SIMPLE_ATTRIBUTE(hwsim_fops_group, - hwsim_fops_group_read, hwsim_fops_group_write, - "%llx\n"); - -static struct mac80211_hwsim_data *get_hwsim_data_ref_from_addr( - struct mac_address *addr) -{ - struct mac80211_hwsim_data *data; - bool _found = false; - - spin_lock_bh(&hwsim_radio_lock); - list_for_each_entry(data, &hwsim_radios, list) { - if (memcmp(data->addresses[1].addr, addr, - sizeof(struct mac_address)) == 0) { - _found = true; - break; - } - } - spin_unlock_bh(&hwsim_radio_lock); - - if (!_found) - return NULL; - - return data; -} - -static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2, - struct genl_info *info) -{ - - struct ieee80211_hdr *hdr; - struct mac80211_hwsim_data *data2; - struct ieee80211_tx_info *txi; - struct hwsim_tx_rate *tx_attempts; - unsigned long ret_skb_ptr; - struct sk_buff *skb, *tmp; - struct mac_address *src; - unsigned int hwsim_flags; - - int i; - bool found = false; - - if (!info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER] || - !info->attrs[HWSIM_ATTR_FLAGS] || - !info->attrs[HWSIM_ATTR_COOKIE] || - !info->attrs[HWSIM_ATTR_TX_INFO]) - goto out; - - src = (struct mac_address *)nla_data( - info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER]); - hwsim_flags = nla_get_u32(info->attrs[HWSIM_ATTR_FLAGS]); - - ret_skb_ptr = nla_get_u64(info->attrs[HWSIM_ATTR_COOKIE]); - - data2 = get_hwsim_data_ref_from_addr(src); - - if (data2 == NULL) - goto out; - - /* look for the skb matching the cookie passed back from user */ - skb_queue_walk_safe(&data2->pending, skb, tmp) { - if ((unsigned long)skb == ret_skb_ptr) { - skb_unlink(skb, &data2->pending); - found = true; - break; - } - } - - /* not found */ - if (!found) - goto out; - - /* Tx info received because the frame was broadcasted on user space, - so we get all the necessary info: tx attempts and skb control buff */ - - tx_attempts = (struct hwsim_tx_rate *)nla_data( - info->attrs[HWSIM_ATTR_TX_INFO]); - - /* now send back TX status */ - txi = IEEE80211_SKB_CB(skb); - - ieee80211_tx_info_clear_status(txi); - - for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { - txi->status.rates[i].idx = tx_attempts[i].idx; - txi->status.rates[i].count = tx_attempts[i].count; - /*txi->status.rates[i].flags = 0;*/ - } - - txi->status.ack_signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]); - - if (!(hwsim_flags & HWSIM_TX_CTL_NO_ACK) && - (hwsim_flags & HWSIM_TX_STAT_ACK)) { - if (skb->len >= 16) { - hdr = (struct ieee80211_hdr *) skb->data; - mac80211_hwsim_monitor_ack(txi->rate_driver_data[0], - hdr->addr2); - } - txi->flags |= IEEE80211_TX_STAT_ACK; - } - ieee80211_tx_status_irqsafe(data2->hw, skb); - return 0; -out: - return -EINVAL; - -} - -static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, - struct genl_info *info) -{ - - struct mac80211_hwsim_data *data2; - struct ieee80211_rx_status rx_status; - struct mac_address *dst; - int frame_data_len; - char *frame_data; - struct sk_buff *skb = NULL; - - if (!info->attrs[HWSIM_ATTR_ADDR_RECEIVER] || - !info->attrs[HWSIM_ATTR_FRAME] || - !info->attrs[HWSIM_ATTR_RX_RATE] || - !info->attrs[HWSIM_ATTR_SIGNAL]) - goto out; - - dst = (struct mac_address *)nla_data( - info->attrs[HWSIM_ATTR_ADDR_RECEIVER]); - - frame_data_len = nla_len(info->attrs[HWSIM_ATTR_FRAME]); - frame_data = (char *)nla_data(info->attrs[HWSIM_ATTR_FRAME]); - - /* Allocate new skb here */ - skb = alloc_skb(frame_data_len, GFP_KERNEL); - if (skb == NULL) - goto err; - - if (frame_data_len <= IEEE80211_MAX_DATA_LEN) { - /* Copy the data */ - memcpy(skb_put(skb, frame_data_len), frame_data, - frame_data_len); - } else - goto err; - - data2 = get_hwsim_data_ref_from_addr(dst); - - if (data2 == NULL) - goto out; - - /* check if radio is configured properly */ - - if (data2->idle || !data2->started) - goto out; - - /*A frame is received from user space*/ - memset(&rx_status, 0, sizeof(rx_status)); - rx_status.freq = data2->channel->center_freq; - rx_status.band = data2->channel->band; - rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); - rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]); - - memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); - ieee80211_rx_irqsafe(data2->hw, skb); - - return 0; -err: - printk(KERN_DEBUG "mac80211_hwsim: error occurred in %s\n", __func__); - goto out; -out: - dev_kfree_skb(skb); - return -EINVAL; -} - -static int hwsim_register_received_nl(struct sk_buff *skb_2, - struct genl_info *info) -{ - if (info == NULL) - goto out; - - wmediumd_portid = info->snd_portid; - - printk(KERN_DEBUG "mac80211_hwsim: received a REGISTER, " - "switching to wmediumd mode with pid %d\n", info->snd_portid); - - return 0; -out: - printk(KERN_DEBUG "mac80211_hwsim: error occurred in %s\n", __func__); - return -EINVAL; -} - -/* Generic Netlink operations array */ -static struct genl_ops hwsim_ops[] = { - { - .cmd = HWSIM_CMD_REGISTER, - .policy = hwsim_genl_policy, - .doit = hwsim_register_received_nl, - .flags = GENL_ADMIN_PERM, - }, - { - .cmd = HWSIM_CMD_FRAME, - .policy = hwsim_genl_policy, - .doit = hwsim_cloned_frame_received_nl, - }, - { - .cmd = HWSIM_CMD_TX_INFO_FRAME, - .policy = hwsim_genl_policy, - .doit = hwsim_tx_info_frame_received_nl, - }, -}; - -static int mac80211_hwsim_netlink_notify(struct notifier_block *nb, - unsigned long state, - void *_notify) -{ - struct netlink_notify *notify = _notify; - - if (state != NETLINK_URELEASE) - return NOTIFY_DONE; - - if (notify->portid == wmediumd_portid) { - printk(KERN_INFO "mac80211_hwsim: wmediumd released netlink" - " socket, switching to perfect channel medium\n"); - wmediumd_portid = 0; - } - return NOTIFY_DONE; - -} - -static struct notifier_block hwsim_netlink_notifier = { - .notifier_call = mac80211_hwsim_netlink_notify, -}; - -static int hwsim_init_netlink(void) -{ - int rc; - - /* userspace test API hasn't been adjusted for multi-channel */ - if (channels > 1) - return 0; - - printk(KERN_INFO "mac80211_hwsim: initializing netlink\n"); - - rc = genl_register_family_with_ops(&hwsim_genl_family, - hwsim_ops, ARRAY_SIZE(hwsim_ops)); - if (rc) - goto failure; - - rc = netlink_register_notifier(&hwsim_netlink_notifier); - if (rc) - goto failure; - - return 0; - -failure: - printk(KERN_DEBUG "mac80211_hwsim: error occurred in %s\n", __func__); - return -EINVAL; -} - -static void hwsim_exit_netlink(void) -{ - int ret; - - /* userspace test API hasn't been adjusted for multi-channel */ - if (channels > 1) - return; - - printk(KERN_INFO "mac80211_hwsim: closing netlink\n"); - /* unregister the notifier */ - netlink_unregister_notifier(&hwsim_netlink_notifier); - /* unregister the family */ - ret = genl_unregister_family(&hwsim_genl_family); - if (ret) - printk(KERN_DEBUG "mac80211_hwsim: " - "unregister family %i\n", ret); -} - -static const struct ieee80211_iface_limit hwsim_if_limits[] = { - { .max = 1, .types = BIT(NL80211_IFTYPE_ADHOC) }, - { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_P2P_CLIENT) | -#ifdef CONFIG_MAC80211_MESH - BIT(NL80211_IFTYPE_MESH_POINT) | -#endif - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_P2P_GO) }, - { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_DEVICE) }, -}; - -static struct ieee80211_iface_combination hwsim_if_comb = { - .limits = hwsim_if_limits, - .n_limits = ARRAY_SIZE(hwsim_if_limits), - .max_interfaces = 2048, - .num_different_channels = 1, -}; - -static int __init init_mac80211_hwsim(void) -{ - int i, err = 0; - u8 addr[ETH_ALEN]; - struct mac80211_hwsim_data *data; - struct ieee80211_hw *hw; - enum ieee80211_band band; - - if (radios < 1 || radios > 100) - return -EINVAL; - - if (channels < 1) - return -EINVAL; - - if (channels > 1) { - hwsim_if_comb.num_different_channels = channels; - mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan; - mac80211_hwsim_ops.cancel_hw_scan = - mac80211_hwsim_cancel_hw_scan; - mac80211_hwsim_ops.sw_scan_start = NULL; - mac80211_hwsim_ops.sw_scan_complete = NULL; - mac80211_hwsim_ops.remain_on_channel = - mac80211_hwsim_roc; - mac80211_hwsim_ops.cancel_remain_on_channel = - mac80211_hwsim_croc; - mac80211_hwsim_ops.add_chanctx = - mac80211_hwsim_add_chanctx; - mac80211_hwsim_ops.remove_chanctx = - mac80211_hwsim_remove_chanctx; - mac80211_hwsim_ops.change_chanctx = - mac80211_hwsim_change_chanctx; - mac80211_hwsim_ops.assign_vif_chanctx = - mac80211_hwsim_assign_vif_chanctx; - mac80211_hwsim_ops.unassign_vif_chanctx = - mac80211_hwsim_unassign_vif_chanctx; - } - - spin_lock_init(&hwsim_radio_lock); - INIT_LIST_HEAD(&hwsim_radios); - - err = platform_driver_register(&mac80211_hwsim_driver); - if (err) - return err; - - hwsim_class = class_create(THIS_MODULE, "mac80211_hwsim"); - if (IS_ERR(hwsim_class)) { - err = PTR_ERR(hwsim_class); - goto failed_unregister_driver; - } - - memset(addr, 0, ETH_ALEN); - addr[0] = 0x02; - - for (i = 0; i < radios; i++) { - printk(KERN_DEBUG "mac80211_hwsim: Initializing radio %d\n", - i); - hw = ieee80211_alloc_hw(sizeof(*data), &mac80211_hwsim_ops); - if (!hw) { - printk(KERN_DEBUG "mac80211_hwsim: ieee80211_alloc_hw " - "failed\n"); - err = -ENOMEM; - goto failed; - } - data = hw->priv; - data->hw = hw; - - data->dev = device_create(hwsim_class, NULL, 0, hw, - "hwsim%d", i); - if (IS_ERR(data->dev)) { - printk(KERN_DEBUG - "mac80211_hwsim: device_create failed (%ld)\n", - PTR_ERR(data->dev)); - err = -ENOMEM; - goto failed_drvdata; - } - data->dev->driver = &mac80211_hwsim_driver.driver; - err = device_bind_driver(data->dev); - if (err != 0) { - printk(KERN_DEBUG - "mac80211_hwsim: device_bind_driver failed (%d)\n", - err); - goto failed_hw; - } - - skb_queue_head_init(&data->pending); - - SET_IEEE80211_DEV(hw, data->dev); - addr[3] = i >> 8; - addr[4] = i; - memcpy(data->addresses[0].addr, addr, ETH_ALEN); - memcpy(data->addresses[1].addr, addr, ETH_ALEN); - data->addresses[1].addr[0] |= 0x40; - hw->wiphy->n_addresses = 2; - hw->wiphy->addresses = data->addresses; - - hw->wiphy->iface_combinations = &hwsim_if_comb; - hw->wiphy->n_iface_combinations = 1; - - if (channels > 1) { - hw->wiphy->max_scan_ssids = 255; - hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; - hw->wiphy->max_remain_on_channel_duration = 1000; - } - - INIT_DELAYED_WORK(&data->roc_done, hw_roc_done); - INIT_DELAYED_WORK(&data->hw_scan, hw_scan_work); - - hw->channel_change_time = 1; - hw->queues = 5; - hw->offchannel_tx_hw_queue = 4; - hw->wiphy->interface_modes = - BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_P2P_GO) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_MESH_POINT) | - BIT(NL80211_IFTYPE_P2P_DEVICE); - - hw->flags = IEEE80211_HW_MFP_CAPABLE | - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_SUPPORTS_STATIC_SMPS | - IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | - IEEE80211_HW_AMPDU_AGGREGATION | - IEEE80211_HW_WANT_MONITOR_VIF | - IEEE80211_HW_QUEUE_CONTROL; - if (rctbl) - hw->flags |= IEEE80211_HW_SUPPORTS_RC_TABLE; - - hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS | - WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; - - /* ask mac80211 to reserve space for magic */ - hw->vif_data_size = sizeof(struct hwsim_vif_priv); - hw->sta_data_size = sizeof(struct hwsim_sta_priv); - hw->chanctx_data_size = sizeof(struct hwsim_chanctx_priv); - - memcpy(data->channels_2ghz, hwsim_channels_2ghz, - sizeof(hwsim_channels_2ghz)); - memcpy(data->channels_5ghz, hwsim_channels_5ghz, - sizeof(hwsim_channels_5ghz)); - memcpy(data->rates, hwsim_rates, sizeof(hwsim_rates)); - - for (band = IEEE80211_BAND_2GHZ; band < IEEE80211_NUM_BANDS; band++) { - struct ieee80211_supported_band *sband = &data->bands[band]; - switch (band) { - case IEEE80211_BAND_2GHZ: - sband->channels = data->channels_2ghz; - sband->n_channels = - ARRAY_SIZE(hwsim_channels_2ghz); - sband->bitrates = data->rates; - sband->n_bitrates = ARRAY_SIZE(hwsim_rates); - break; - case IEEE80211_BAND_5GHZ: - sband->channels = data->channels_5ghz; - sband->n_channels = - ARRAY_SIZE(hwsim_channels_5ghz); - sband->bitrates = data->rates + 4; - sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4; - break; - default: - continue; - } - - sband->ht_cap.ht_supported = true; - sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | - IEEE80211_HT_CAP_GRN_FLD | - IEEE80211_HT_CAP_SGI_40 | - IEEE80211_HT_CAP_DSSSCCK40; - sband->ht_cap.ampdu_factor = 0x3; - sband->ht_cap.ampdu_density = 0x6; - memset(&sband->ht_cap.mcs, 0, - sizeof(sband->ht_cap.mcs)); - sband->ht_cap.mcs.rx_mask[0] = 0xff; - sband->ht_cap.mcs.rx_mask[1] = 0xff; - sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; - - hw->wiphy->bands[band] = sband; - - sband->vht_cap.vht_supported = true; - sband->vht_cap.cap = - IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 | - IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ | - IEEE80211_VHT_CAP_RXLDPC | - IEEE80211_VHT_CAP_SHORT_GI_80 | - IEEE80211_VHT_CAP_SHORT_GI_160 | - IEEE80211_VHT_CAP_TXSTBC | - IEEE80211_VHT_CAP_RXSTBC_1 | - IEEE80211_VHT_CAP_RXSTBC_2 | - IEEE80211_VHT_CAP_RXSTBC_3 | - IEEE80211_VHT_CAP_RXSTBC_4 | - IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK; - sband->vht_cap.vht_mcs.rx_mcs_map = - cpu_to_le16(IEEE80211_VHT_MCS_SUPPORT_0_8 << 0 | - IEEE80211_VHT_MCS_SUPPORT_0_8 << 2 | - IEEE80211_VHT_MCS_SUPPORT_0_9 << 4 | - IEEE80211_VHT_MCS_SUPPORT_0_8 << 6 | - IEEE80211_VHT_MCS_SUPPORT_0_8 << 8 | - IEEE80211_VHT_MCS_SUPPORT_0_9 << 10 | - IEEE80211_VHT_MCS_SUPPORT_0_9 << 12 | - IEEE80211_VHT_MCS_SUPPORT_0_8 << 14); - sband->vht_cap.vht_mcs.tx_mcs_map = - sband->vht_cap.vht_mcs.rx_mcs_map; - } - /* By default all radios are belonging to the first group */ - data->group = 1; - mutex_init(&data->mutex); - - /* Enable frame retransmissions for lossy channels */ - hw->max_rates = 4; - hw->max_rate_tries = 11; - - /* Work to be done prior to ieee80211_register_hw() */ - switch (regtest) { - case HWSIM_REGTEST_DISABLED: - case HWSIM_REGTEST_DRIVER_REG_FOLLOW: - case HWSIM_REGTEST_DRIVER_REG_ALL: - case HWSIM_REGTEST_DIFF_COUNTRY: - /* - * Nothing to be done for driver regulatory domain - * hints prior to ieee80211_register_hw() - */ - break; - case HWSIM_REGTEST_WORLD_ROAM: - if (i == 0) { - hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; - wiphy_apply_custom_regulatory(hw->wiphy, - &hwsim_world_regdom_custom_01); - } - break; - case HWSIM_REGTEST_CUSTOM_WORLD: - hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; - wiphy_apply_custom_regulatory(hw->wiphy, - &hwsim_world_regdom_custom_01); - break; - case HWSIM_REGTEST_CUSTOM_WORLD_2: - if (i == 0) { - hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; - wiphy_apply_custom_regulatory(hw->wiphy, - &hwsim_world_regdom_custom_01); - } else if (i == 1) { - hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; - wiphy_apply_custom_regulatory(hw->wiphy, - &hwsim_world_regdom_custom_02); - } - break; - case HWSIM_REGTEST_STRICT_ALL: - hw->wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; - break; - case HWSIM_REGTEST_STRICT_FOLLOW: - case HWSIM_REGTEST_STRICT_AND_DRIVER_REG: - if (i == 0) - hw->wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; - break; - case HWSIM_REGTEST_ALL: - if (i == 0) { - hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; - wiphy_apply_custom_regulatory(hw->wiphy, - &hwsim_world_regdom_custom_01); - } else if (i == 1) { - hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; - wiphy_apply_custom_regulatory(hw->wiphy, - &hwsim_world_regdom_custom_02); - } else if (i == 4) - hw->wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; - break; - default: - break; - } - - /* give the regulatory workqueue a chance to run */ - if (regtest) - schedule_timeout_interruptible(1); - err = ieee80211_register_hw(hw); - if (err < 0) { - printk(KERN_DEBUG "mac80211_hwsim: " - "ieee80211_register_hw failed (%d)\n", err); - goto failed_hw; - } - - /* Work to be done after to ieee80211_register_hw() */ - switch (regtest) { - case HWSIM_REGTEST_WORLD_ROAM: - case HWSIM_REGTEST_DISABLED: - break; - case HWSIM_REGTEST_DRIVER_REG_FOLLOW: - if (!i) - regulatory_hint(hw->wiphy, hwsim_alpha2s[0]); - break; - case HWSIM_REGTEST_DRIVER_REG_ALL: - case HWSIM_REGTEST_STRICT_ALL: - regulatory_hint(hw->wiphy, hwsim_alpha2s[0]); - break; - case HWSIM_REGTEST_DIFF_COUNTRY: - if (i < ARRAY_SIZE(hwsim_alpha2s)) - regulatory_hint(hw->wiphy, hwsim_alpha2s[i]); - break; - case HWSIM_REGTEST_CUSTOM_WORLD: - case HWSIM_REGTEST_CUSTOM_WORLD_2: - /* - * Nothing to be done for custom world regulatory - * domains after to ieee80211_register_hw - */ - break; - case HWSIM_REGTEST_STRICT_FOLLOW: - if (i == 0) - regulatory_hint(hw->wiphy, hwsim_alpha2s[0]); - break; - case HWSIM_REGTEST_STRICT_AND_DRIVER_REG: - if (i == 0) - regulatory_hint(hw->wiphy, hwsim_alpha2s[0]); - else if (i == 1) - regulatory_hint(hw->wiphy, hwsim_alpha2s[1]); - break; - case HWSIM_REGTEST_ALL: - if (i == 2) - regulatory_hint(hw->wiphy, hwsim_alpha2s[0]); - else if (i == 3) - regulatory_hint(hw->wiphy, hwsim_alpha2s[1]); - else if (i == 4) - regulatory_hint(hw->wiphy, hwsim_alpha2s[2]); - break; - default: - break; - } - - wiphy_debug(hw->wiphy, "hwaddr %pm registered\n", - hw->wiphy->perm_addr); - - data->debugfs = debugfs_create_dir("hwsim", - hw->wiphy->debugfsdir); - data->debugfs_ps = debugfs_create_file("ps", 0666, - data->debugfs, data, - &hwsim_fops_ps); - data->debugfs_group = debugfs_create_file("group", 0666, - data->debugfs, data, - &hwsim_fops_group); - - tasklet_hrtimer_init(&data->beacon_timer, - mac80211_hwsim_beacon, - CLOCK_REALTIME, HRTIMER_MODE_ABS); - - list_add_tail(&data->list, &hwsim_radios); - } - - hwsim_mon = alloc_netdev(0, "hwsim%d", hwsim_mon_setup); - if (hwsim_mon == NULL) - goto failed; - - rtnl_lock(); - - err = dev_alloc_name(hwsim_mon, hwsim_mon->name); - if (err < 0) - goto failed_mon; - - - err = register_netdevice(hwsim_mon); - if (err < 0) - goto failed_mon; - - rtnl_unlock(); - - err = hwsim_init_netlink(); - if (err < 0) - goto failed_nl; - - return 0; - -failed_nl: - printk(KERN_DEBUG "mac_80211_hwsim: failed initializing netlink\n"); - return err; - -failed_mon: - rtnl_unlock(); - free_netdev(hwsim_mon); - mac80211_hwsim_free(); - return err; - -failed_hw: - device_unregister(data->dev); -failed_drvdata: - ieee80211_free_hw(hw); -failed: - mac80211_hwsim_free(); -failed_unregister_driver: - platform_driver_unregister(&mac80211_hwsim_driver); - return err; -} -module_init(init_mac80211_hwsim); - -static void __exit exit_mac80211_hwsim(void) -{ - printk(KERN_DEBUG "mac80211_hwsim: unregister radios\n"); - - hwsim_exit_netlink(); - - mac80211_hwsim_free(); - unregister_netdev(hwsim_mon); - platform_driver_unregister(&mac80211_hwsim_driver); -} -module_exit(exit_mac80211_hwsim); diff --git a/drivers/net/wireless/mac80211_hwsim.h b/drivers/net/wireless/mac80211_hwsim.h deleted file mode 100644 index afaad5a443b6..000000000000 --- a/drivers/net/wireless/mac80211_hwsim.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211 - * Copyright (c) 2008, Jouni Malinen - * Copyright (c) 2011, Javier Lopez - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef __MAC80211_HWSIM_H -#define __MAC80211_HWSIM_H - -/** - * enum hwsim_tx_control_flags - flags to describe transmission info/status - * - * These flags are used to give the wmediumd extra information in order to - * modify its behavior for each frame - * - * @HWSIM_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame. - * @HWSIM_TX_CTL_NO_ACK: tell the wmediumd not to wait for an ack - * @HWSIM_TX_STAT_ACK: Frame was acknowledged - * - */ -enum hwsim_tx_control_flags { - HWSIM_TX_CTL_REQ_TX_STATUS = BIT(0), - HWSIM_TX_CTL_NO_ACK = BIT(1), - HWSIM_TX_STAT_ACK = BIT(2), -}; - -/** - * DOC: Frame transmission/registration support - * - * Frame transmission and registration support exists to allow userspace - * entities such as wmediumd to receive and process all broadcasted - * frames from a mac80211_hwsim radio device. - * - * This allow user space applications to decide if the frame should be - * dropped or not and implement a wireless medium simulator at user space. - * - * Registration is done by sending a register message to the driver and - * will be automatically unregistered if the user application doesn't - * responds to sent frames. - * Once registered the user application has to take responsibility of - * broadcasting the frames to all listening mac80211_hwsim radio - * interfaces. - * - * For more technical details, see the corresponding command descriptions - * below. - */ - -/** - * enum hwsim_commands - supported hwsim commands - * - * @HWSIM_CMD_UNSPEC: unspecified command to catch errors - * - * @HWSIM_CMD_REGISTER: request to register and received all broadcasted - * frames by any mac80211_hwsim radio device. - * @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user - * space, uses: - * %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_ADDR_RECEIVER, - * %HWSIM_ATTR_FRAME, %HWSIM_ATTR_FLAGS, %HWSIM_ATTR_RX_RATE, - * %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE - * @HWSIM_CMD_TX_INFO_FRAME: Transmission info report from user space to - * kernel, uses: - * %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_FLAGS, - * %HWSIM_ATTR_TX_INFO, %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE - * @__HWSIM_CMD_MAX: enum limit - */ -enum { - HWSIM_CMD_UNSPEC, - HWSIM_CMD_REGISTER, - HWSIM_CMD_FRAME, - HWSIM_CMD_TX_INFO_FRAME, - __HWSIM_CMD_MAX, -}; -#define HWSIM_CMD_MAX (_HWSIM_CMD_MAX - 1) - -/** - * enum hwsim_attrs - hwsim netlink attributes - * - * @HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors - * - * @HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that - * the frame is broadcasted to - * @HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that - * the frame was broadcasted from - * @HWSIM_ATTR_FRAME: Data array - * @HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process - properly the frame at user space - * @HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user - space - * @HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user - space - * @HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array - * @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame - * @__HWSIM_ATTR_MAX: enum limit - */ - - -enum { - HWSIM_ATTR_UNSPEC, - HWSIM_ATTR_ADDR_RECEIVER, - HWSIM_ATTR_ADDR_TRANSMITTER, - HWSIM_ATTR_FRAME, - HWSIM_ATTR_FLAGS, - HWSIM_ATTR_RX_RATE, - HWSIM_ATTR_SIGNAL, - HWSIM_ATTR_TX_INFO, - HWSIM_ATTR_COOKIE, - __HWSIM_ATTR_MAX, -}; -#define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1) - -/** - * struct hwsim_tx_rate - rate selection/status - * - * @idx: rate index to attempt to send with - * @count: number of tries in this rate before going to the next rate - * - * A value of -1 for @idx indicates an invalid rate and, if used - * in an array of retry rates, that no more rates should be tried. - * - * When used for transmit status reporting, the driver should - * always report the rate and number of retries used. - * - */ -struct hwsim_tx_rate { - s8 idx; - u8 count; -} __packed; - -#endif /* __MAC80211_HWSIM_H */ diff --git a/drivers/net/wireless/mt5931/Kconfig b/drivers/net/wireless/mt5931/Kconfig deleted file mode 100755 index 4835b1783d8e..000000000000 --- a/drivers/net/wireless/mt5931/Kconfig +++ /dev/null @@ -1,19 +0,0 @@ - config MT5931 - depends on WLAN_80211 && MMC - select WIRELESS_EXT - select WEXT_PRIV - select CFG80211 - select NL80211_TESTMODE - bool "MediaTek MT5931 WiFi" - ---help--- - MediaTek MT5931 WiFi - - config MT5931_MT6622 - depends on WLAN_80211 && MMC - select WIRELESS_EXT - select WEXT_PRIV - select CFG80211 - select NL80211_TESTMODE - bool "MediaTek MT5931 & MT6622 WiFi Bluetooth Combo" - ---help--- - MediaTek MT5931 & MT6622 WiFi Bluetooth Combo diff --git a/drivers/net/wireless/mt5931/Makefile b/drivers/net/wireless/mt5931/Makefile deleted file mode 100755 index eaf16c44529c..000000000000 --- a/drivers/net/wireless/mt5931/Makefile +++ /dev/null @@ -1,150 +0,0 @@ -# --------------------------------------------------- -# Compile Options -# --------------------------------------------------- - -#include $(MTK_PATH_BUILD)/Makefile -#ccflags-y += -DLINUX -DMT6620 -ccflags-y += -DLINUX -DMT5931 ##mark skynine modify DMT6620-->DMT5931 - -ifeq ($(MTK_WAPI_SUPPORT), yes) - ccflags-y += -DCFG_SUPPORT_WAPI=1 -else - ccflags-y += -DCFG_SUPPORT_WAPI=0 -endif - -ifeq ($(HAVE_XLOG_FEATURE), yes) - ccflags-y += -DCFG_SUPPORT_XLOG=1 -else - ccflags-y += -DCFG_SUPPORT_XLOG=0 -endif - -ifeq ($(HAVE_AEE_FEATURE), yes) - ccflags-y += -DCFG_SUPPORT_AEE=1 -else - ccflags-y += -DCFG_SUPPORT_AEE=0 -endif - -#ifeq ($(CONFIG_MTK_COMBO_WIFI_HIF_SDIO1), y) -# ccflags-y += -D_HIF_SDIO=1 -#endif - -#MODULE_NAME := wlan_mt6620 -MODULE_NAME := wlan ##mark skynine modify MT6620-->MT5931 - -ccflags-y += -D_HIF_SDIO=1 - -ccflags-y += -DRSSI_ENHANCE=1 - -ccflags-y += -DDBG=0 -ccflags-y += -I$(src)/os -I$(src)/os/linux/include -I$(src)/os/linux/hif/sdio/include -ccflags-y += -I$(src)/include -I$(src)/include/nic -I$(src)/include/mgmt - -#obj-$(CONFIG_MTK_COMBO_WIFI) += $(MODULE_NAME).o -#obj-$(CONFIG_MT5931) += $(MODULE_NAME).o -#obj-y += $(MODULE_NAME).o - -# --------------------------------------------------- -# Directory List -# --------------------------------------------------- -COMMON_DIR := common/ -OS_DIR := os/linux/ -HIF_DIR := os/linux/hif/sdio/ -NIC_DIR := nic/ -MGMT_DIR := mgmt/ - - -# --------------------------------------------------- -# Objects List -# --------------------------------------------------- - -COMMON_OBJS := $(COMMON_DIR)dump.o \ - $(COMMON_DIR)wlan_lib.o \ - $(COMMON_DIR)wlan_oid.o \ - $(COMMON_DIR)wlan_bow.o - -NIC_OBJS := $(NIC_DIR)nic.o \ - $(NIC_DIR)nic_tx.o \ - $(NIC_DIR)nic_rx.o \ - $(NIC_DIR)nic_pwr_mgt.o \ - $(NIC_DIR)cmd_buf.o \ - $(NIC_DIR)que_mgt.o \ - $(NIC_DIR)nic_cmd_event.o - -OS_OBJS := $(OS_DIR)gl_init.o \ - $(OS_DIR)gl_kal.o \ - $(OS_DIR)gl_bow.o \ - $(OS_DIR)gl_wext.o \ - $(OS_DIR)gl_wext_priv.o \ - $(OS_DIR)gl_rst.o \ - $(OS_DIR)gl_cfg80211.o \ - $(OS_DIR)platform.o - -MGMT_OBJS := $(MGMT_DIR)ais_fsm.o \ - $(MGMT_DIR)aaa_fsm.o \ - $(MGMT_DIR)assoc.o \ - $(MGMT_DIR)auth.o \ - $(MGMT_DIR)bss.o \ - $(MGMT_DIR)cnm.o \ - $(MGMT_DIR)cnm_timer.o \ - $(MGMT_DIR)cnm_mem.o \ - $(MGMT_DIR)hem_mbox.o \ - $(MGMT_DIR)mib.o \ - $(MGMT_DIR)privacy.o \ - $(MGMT_DIR)rate.o \ - $(MGMT_DIR)rlm.o \ - $(MGMT_DIR)rlm_domain.o \ - $(MGMT_DIR)rlm_obss.o \ - $(MGMT_DIR)rlm_protection.o \ - $(MGMT_DIR)rsn.o \ - $(MGMT_DIR)saa_fsm.o \ - $(MGMT_DIR)scan.o \ - $(MGMT_DIR)scan_fsm.o \ - $(MGMT_DIR)sec_fsm.o \ - $(MGMT_DIR)swcr.o \ - $(MGMT_DIR)roaming_fsm.o - -# --------------------------------------------------- -# P2P Objects List -# --------------------------------------------------- - -COMMON_OBJS += $(COMMON_DIR)wlan_p2p.o - -NIC_OBJS += $(NIC_DIR)p2p_nic.o - -OS_OBJS += $(OS_DIR)gl_p2p.o \ - $(OS_DIR)gl_p2p_cfg80211.o \ - $(OS_DIR)gl_p2p_init.o \ - $(OS_DIR)gl_p2p_kal.o - -MGMT_OBJS += $(MGMT_DIR)p2p_assoc.o \ - $(MGMT_DIR)p2p_bss.o \ - $(MGMT_DIR)p2p_fsm.o \ - $(MGMT_DIR)p2p_func.o \ - $(MGMT_DIR)p2p_rlm.o \ - $(MGMT_DIR)p2p_rlm_obss.o \ - $(MGMT_DIR)p2p_scan.o \ - $(MGMT_DIR)p2p_ie.o \ - $(MGMT_DIR)p2p_state.o - - -ifeq ($(MTK_WAPI_SUPPORT), yes) -MGMT_OBJS += $(MGMT_DIR)wapi.o -endif - -ifeq ($(WLAN_PROC), y) -OS_OBJS += gl_proc.o -endif - -HIF_OBJS := $(HIF_DIR)arm.o \ - $(HIF_DIR)sdio.o - -obj-y += $(COMMON_OBJS) -obj-y += $(NIC_OBJS) -obj-y += $(OS_OBJS) -obj-y += $(HIF_OBJS) -obj-y += $(MGMT_OBJS) - - -clean: - rm $(HIF_OBJS) $(OS_OBJS) $(NIC_OBJS) $(MGMT_OBJS) $(COMMON_OBJS) - diff --git a/drivers/net/wireless/mt5931/Makefile.module b/drivers/net/wireless/mt5931/Makefile.module deleted file mode 100755 index 1645ae2424a6..000000000000 --- a/drivers/net/wireless/mt5931/Makefile.module +++ /dev/null @@ -1,152 +0,0 @@ -# --------------------------------------------------- -# Compile Options -# --------------------------------------------------- - -#include $(MTK_PATH_BUILD)/Makefile -#ccflags-y += -DLINUX -DMT6620 -ccflags-y += -DLINUX -DMT5931 ##mark skynine modify DMT6620-->DMT5931 - -ifeq ($(MTK_WAPI_SUPPORT), yes) - ccflags-y += -DCFG_SUPPORT_WAPI=1 -else - ccflags-y += -DCFG_SUPPORT_WAPI=0 -endif - -ifeq ($(HAVE_XLOG_FEATURE), yes) - ccflags-y += -DCFG_SUPPORT_XLOG=1 -else - ccflags-y += -DCFG_SUPPORT_XLOG=0 -endif - -ifeq ($(HAVE_AEE_FEATURE), yes) - ccflags-y += -DCFG_SUPPORT_AEE=1 -else - ccflags-y += -DCFG_SUPPORT_AEE=0 -endif - -#ifeq ($(CONFIG_MTK_COMBO_WIFI_HIF_SDIO1), y) -# ccflags-y += -D_HIF_SDIO=1 -#endif - -#MODULE_NAME := wlan_mt6620 -MODULE_NAME := wlan - -ccflags-y += -D_HIF_SDIO=1 - -ccflags-y += -DDBG=0 -ccflags-y += -I$(src)/os -I$(src)/os/linux/include -I$(src)/os/linux/hif/sdio/include -ccflags-y += -I$(src)/include -I$(src)/include/nic -I$(src)/include/mgmt - -#obj-$(CONFIG_MTK_COMBO_WIFI) += $(MODULE_NAME).o -#obj-$(CONFIG_MT5931) += $(MODULE_NAME).o -obj-m += $(MODULE_NAME).o - -# --------------------------------------------------- -# Directory List -# --------------------------------------------------- -COMMON_DIR := common/ -OS_DIR := os/linux/ -HIF_DIR := os/linux/hif/sdio/ -NIC_DIR := nic/ -MGMT_DIR := mgmt/ - - -# --------------------------------------------------- -# Objects List -# --------------------------------------------------- - -COMMON_OBJS := $(COMMON_DIR)dump.o \ - $(COMMON_DIR)wlan_lib.o \ - $(COMMON_DIR)wlan_oid.o \ - $(COMMON_DIR)wlan_bow.o - -NIC_OBJS := $(NIC_DIR)nic.o \ - $(NIC_DIR)nic_tx.o \ - $(NIC_DIR)nic_rx.o \ - $(NIC_DIR)nic_pwr_mgt.o \ - $(NIC_DIR)cmd_buf.o \ - $(NIC_DIR)que_mgt.o \ - $(NIC_DIR)nic_cmd_event.o - -OS_OBJS := $(OS_DIR)gl_init.o \ - $(OS_DIR)gl_kal.o \ - $(OS_DIR)gl_bow.o \ - $(OS_DIR)gl_wext.o \ - $(OS_DIR)gl_wext_priv.o \ - $(OS_DIR)gl_rst.o \ - $(OS_DIR)gl_cfg80211.o \ - $(OS_DIR)platform.o - -MGMT_OBJS := $(MGMT_DIR)ais_fsm.o \ - $(MGMT_DIR)aaa_fsm.o \ - $(MGMT_DIR)assoc.o \ - $(MGMT_DIR)auth.o \ - $(MGMT_DIR)bss.o \ - $(MGMT_DIR)cnm.o \ - $(MGMT_DIR)cnm_timer.o \ - $(MGMT_DIR)cnm_mem.o \ - $(MGMT_DIR)hem_mbox.o \ - $(MGMT_DIR)mib.o \ - $(MGMT_DIR)privacy.o \ - $(MGMT_DIR)rate.o \ - $(MGMT_DIR)rlm.o \ - $(MGMT_DIR)rlm_domain.o \ - $(MGMT_DIR)rlm_obss.o \ - $(MGMT_DIR)rlm_protection.o \ - $(MGMT_DIR)rsn.o \ - $(MGMT_DIR)saa_fsm.o \ - $(MGMT_DIR)scan.o \ - $(MGMT_DIR)scan_fsm.o \ - $(MGMT_DIR)sec_fsm.o \ - $(MGMT_DIR)swcr.o \ - $(MGMT_DIR)roaming_fsm.o - -# --------------------------------------------------- -# P2P Objects List -# --------------------------------------------------- - -COMMON_OBJS += $(COMMON_DIR)wlan_p2p.o - -NIC_OBJS += $(NIC_DIR)p2p_nic.o - -OS_OBJS += $(OS_DIR)gl_p2p.o \ - $(OS_DIR)gl_p2p_cfg80211.o \ - $(OS_DIR)gl_p2p_init.o \ - $(OS_DIR)gl_p2p_kal.o - -MGMT_OBJS += $(MGMT_DIR)p2p_assoc.o \ - $(MGMT_DIR)p2p_bss.o \ - $(MGMT_DIR)p2p_fsm.o \ - $(MGMT_DIR)p2p_func.o \ - $(MGMT_DIR)p2p_rlm.o \ - $(MGMT_DIR)p2p_rlm_obss.o \ - $(MGMT_DIR)p2p_scan.o \ - $(MGMT_DIR)p2p_ie.o \ - $(MGMT_DIR)p2p_state.o - - -ifeq ($(MTK_WAPI_SUPPORT), yes) -MGMT_OBJS += $(MGMT_DIR)wapi.o -endif - -ifeq ($(WLAN_PROC), y) -OS_OBJS += gl_proc.o -endif - -HIF_OBJS := $(HIF_DIR)arm.o \ - $(HIF_DIR)sdio.o - -$(MODULE_NAME)-y += $(COMMON_OBJS) -$(MODULE_NAME)-y += $(NIC_OBJS) -$(MODULE_NAME)-y += $(OS_OBJS) -$(MODULE_NAME)-y += $(HIF_OBJS) -$(MODULE_NAME)-y += $(MGMT_OBJS) - -KERNEL_DIR = /home/hwg/rk2928_kernel_M7000HC/kernel - -all: - make -C $(KERNEL_DIR) M=`pwd` modules - -clean: - rm $(HIF_OBJS) $(OS_OBJS) $(NIC_OBJS) $(MGMT_OBJS) $(COMMON_OBJS) - diff --git a/drivers/net/wireless/mt5931/common/dump.c b/drivers/net/wireless/mt5931/common/dump.c deleted file mode 100755 index 95f2d7f25b76..000000000000 --- a/drivers/net/wireless/mt5931/common/dump.c +++ /dev/null @@ -1,539 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/common/dump.c#1 $ -*/ - -/*! \file "dump.c" - \brief Provide memory dump function for debugging. - - Provide memory dump function for debugging. -*/ - - - -/* -** $Log: dump.c $ - * - * 11 24 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * Adjust code for DBG and CONFIG_XLOG. - * - * 11 10 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * Using the new XLOG define for dum Memory. - * - * 11 03 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * Add dumpMemory8 at XLOG support. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 19:58:51 GMT mtk01426 -** Init develop -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#if DBG -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to dump a segment of memory in bytes. -* -* \param[in] pucStartAddr Pointer to the starting address of the memory to be dumped. -* \param[in] u4Length Length of the memory to be dumped. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -dumpMemory8 ( - IN PUINT_8 pucStartAddr, - IN UINT_32 u4Length - ) -{ - ASSERT(pucStartAddr); - - LOG_FUNC("DUMP8 ADDRESS: %08lx, Length: %ld\n", (UINT_32)pucStartAddr, u4Length); - - while (u4Length > 0) { - if (u4Length >= 16) { - LOG_FUNC("(%08lx) %02x %02x %02x %02x %02x %02x %02x %02x - %02x %02x %02x %02x %02x %02x %02x %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8], pucStartAddr[ 9], pucStartAddr[10], pucStartAddr[11], - pucStartAddr[12], pucStartAddr[13], pucStartAddr[14], pucStartAddr[15]); - u4Length -= 16; - pucStartAddr += 16; - } - else { - switch (u4Length) { - case 1: - LOG_FUNC("(%08lx) %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0]); - break; - case 2: - LOG_FUNC("(%08lx) %02x %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1]); - break; - case 3: - LOG_FUNC("(%08lx) %02x %02x %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2]); - break; - case 4: - LOG_FUNC("(%08lx) %02x %02x %02x %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3]); - break; - case 5: - LOG_FUNC("(%08lx) %02x %02x %02x %02x %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4]); - break; - case 6: - LOG_FUNC("(%08lx) %02x %02x %02x %02x %02x %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5]); - break; - case 7: - LOG_FUNC("(%08lx) %02x %02x %02x %02x %02x %02x %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6]); - break; - case 8: - LOG_FUNC("(%08lx) %02x %02x %02x %02x %02x %02x %02x %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7]); - break; - case 9: - LOG_FUNC("(%08lx) %02x %02x %02x %02x %02x %02x %02x %02x - %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8]); - break; - case 10: - LOG_FUNC("(%08lx) %02x %02x %02x %02x %02x %02x %02x %02x - %02x %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8], pucStartAddr[ 9]); - break; - case 11: - LOG_FUNC("(%08lx) %02x %02x %02x %02x %02x %02x %02x %02x - %02x %02x %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8], pucStartAddr[ 9], pucStartAddr[10]); - break; - case 12: - LOG_FUNC("(%08lx) %02x %02x %02x %02x %02x %02x %02x %02x - %02x %02x %02x %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8], pucStartAddr[ 9], pucStartAddr[10], pucStartAddr[11]); - break; - case 13: - LOG_FUNC("(%08lx) %02x %02x %02x %02x %02x %02x %02x %02x - %02x %02x %02x %02x %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8], pucStartAddr[ 9], pucStartAddr[10], pucStartAddr[11], - pucStartAddr[12]); - break; - case 14: - LOG_FUNC("(%08lx) %02x %02x %02x %02x %02x %02x %02x %02x - %02x %02x %02x %02x %02x %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8], pucStartAddr[ 9], pucStartAddr[10], pucStartAddr[11], - pucStartAddr[12], pucStartAddr[13]); - break; - case 15: - LOG_FUNC("(%08lx) %02x %02x %02x %02x %02x %02x %02x %02x - %02x %02x %02x %02x %02x %02x %02x\n", - (UINT_32)pucStartAddr, - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8], pucStartAddr[ 9], pucStartAddr[10], pucStartAddr[11], - pucStartAddr[12], pucStartAddr[13], pucStartAddr[14]); - break; - default: - break; - } - u4Length = 0; - } - } - - LOG_FUNC("\n"); - - return; -} /* end of dumpMemory8() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to dump a segment of memory in double words. -* -* \param[in] pucStartAddr Pointer to the starting address of the memory to be dumped. -* \param[in] u4Length Length of the memory to be dumped. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -dumpMemory32 ( - IN PUINT_32 pu4StartAddr, - IN UINT_32 u4Length) -{ - PUINT_8 pucAddr; - - - ASSERT(pu4StartAddr); - - LOG_FUNC("DUMP32 ADDRESS: %08lx, Length: %ld\n", (UINT_32)pu4StartAddr, u4Length); - - if (IS_NOT_ALIGN_4((UINT_32)pu4StartAddr)) { - UINT_32 u4ProtrudeLen = sizeof(UINT_32) - ((UINT_32)pu4StartAddr % 4); - - - u4ProtrudeLen = ((u4Length < u4ProtrudeLen) ? u4Length: u4ProtrudeLen); - LOG_FUNC("pu4StartAddr is not at DW boundary.\n"); - pucAddr = (PUINT_8) &pu4StartAddr[0]; - - switch (u4ProtrudeLen) { - case 1: - LOG_FUNC("(%08lx) %02x------\n", - (UINT_32)pu4StartAddr, - pucAddr[0]); - break; - case 2: - LOG_FUNC("(%08lx) %02x%02x----\n", - (UINT_32)pu4StartAddr, - pucAddr[1], pucAddr[0]); - break; - case 3: - LOG_FUNC("(%08lx) %02x%02x%02x--\n", - (UINT_32)pu4StartAddr, - pucAddr[2], pucAddr[1], pucAddr[0]); - break; - default: - break; - } - - u4Length -= u4ProtrudeLen; - pu4StartAddr = (PUINT_32)((UINT_32)pu4StartAddr + u4ProtrudeLen); - } - - while (u4Length > 0) { - if (u4Length >= 16) { - LOG_FUNC("(%08lx) %08lx %08lx %08lx %08lx\n", - (UINT_32)pu4StartAddr, - pu4StartAddr[0], pu4StartAddr[1], pu4StartAddr[2], pu4StartAddr[3]); - pu4StartAddr += 4; - u4Length -= 16; - } - else { - switch (u4Length) { - case 1: - pucAddr = (PUINT_8) &pu4StartAddr[0]; - LOG_FUNC("(%08lx) ------%02x\n", - (UINT_32)pu4StartAddr, - pucAddr[0]); - break; - case 2: - pucAddr = (PUINT_8) &pu4StartAddr[0]; - LOG_FUNC("(%08lx) ----%02x%02x\n", - (UINT_32)pu4StartAddr, - pucAddr[1], pucAddr[0]); - break; - case 3: - pucAddr = (PUINT_8) &pu4StartAddr[0]; - LOG_FUNC("(%08lx) --%02x%02x%02x\n", - (UINT_32)pu4StartAddr, - pucAddr[2], pucAddr[1], pucAddr[0]); - break; - case 4: - LOG_FUNC("(%08lx) %08lx\n", - (UINT_32)pu4StartAddr, - pu4StartAddr[0]); - break; - case 5: - pucAddr = (PUINT_8) &pu4StartAddr[1]; - LOG_FUNC("(%08lx) %08lx ------%02x\n", - (UINT_32)pu4StartAddr, - pu4StartAddr[0], - pucAddr[0]); - break; - case 6: - pucAddr = (PUINT_8) &pu4StartAddr[1]; - LOG_FUNC("(%08lx) %08lx ----%02x%02x\n", - (UINT_32)pu4StartAddr, - pu4StartAddr[0], - pucAddr[1], pucAddr[0]); - break; - case 7: - pucAddr = (PUINT_8) &pu4StartAddr[1]; - LOG_FUNC("(%08lx) %08lx --%02x%02x%02x\n", - (UINT_32)pu4StartAddr, - pu4StartAddr[0], - pucAddr[2], pucAddr[1], pucAddr[0]); - break; - case 8: - LOG_FUNC("(%08lx) %08lx %08lx\n", - (UINT_32)pu4StartAddr, - pu4StartAddr[0], pu4StartAddr[1]); - break; - case 9: - pucAddr = (PUINT_8) &pu4StartAddr[2]; - LOG_FUNC("(%08lx) %08lx %08lx ------%02x\n", - (UINT_32)pu4StartAddr, - pu4StartAddr[0], pu4StartAddr[1], - pucAddr[0]); - break; - case 10: - pucAddr = (PUINT_8) &pu4StartAddr[2]; - LOG_FUNC("(%08lx) %08lx %08lx ----%02x%02x\n", - (UINT_32)pu4StartAddr, - pu4StartAddr[0], pu4StartAddr[1], - pucAddr[1], pucAddr[0]); - break; - case 11: - pucAddr = (PUINT_8) &pu4StartAddr[2]; - LOG_FUNC("(%08lx) %08lx %08lx --%02x%02x%02x\n", - (UINT_32)pu4StartAddr, - pu4StartAddr[0], pu4StartAddr[1], - pucAddr[2], pucAddr[1], pucAddr[0]); - break; - case 12: - LOG_FUNC("(%08lx) %08lx %08lx %08lx\n", - (UINT_32)pu4StartAddr, - pu4StartAddr[0], pu4StartAddr[1], pu4StartAddr[2]); - break; - case 13: - pucAddr = (PUINT_8) &pu4StartAddr[3]; - LOG_FUNC("(%08lx) %08lx %08lx %08lx ------%02x\n", - (UINT_32)pu4StartAddr, - pu4StartAddr[0], pu4StartAddr[1], pu4StartAddr[2], - pucAddr[0]); - break; - case 14: - pucAddr = (PUINT_8) &pu4StartAddr[3]; - LOG_FUNC("(%08lx) %08lx %08lx %08lx ----%02x%02x\n", - (UINT_32)pu4StartAddr, - pu4StartAddr[0], pu4StartAddr[1], pu4StartAddr[2], - pucAddr[1], pucAddr[0]); - break; - case 15: - pucAddr = (PUINT_8) &pu4StartAddr[3]; - LOG_FUNC("(%08lx) %08lx %08lx %08lx --%02x%02x%02x\n", - (UINT_32)pu4StartAddr, - pu4StartAddr[0], pu4StartAddr[1], pu4StartAddr[2], - pucAddr[2], pucAddr[1], pucAddr[0]); - break; - default: - break; - } - u4Length = 0; - } - } - - return; -} /* end of dumpMemory32() */ -#elif CFG_SUPPORT_XLOG - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to dump a segment of memory in bytes. -* -* \param[in] pucStartAddr Pointer to the starting address of the memory to be dumped. -* \param[in] u4Length Length of the memory to be dumped. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -dumpMemory8 ( - IN UINT_32 log_level, - IN PUINT_8 pucStartAddr, - IN UINT_32 u4Length - ) -{ - ASSERT(pucStartAddr); - - if (log_level == ANDROID_LOG_ERROR) { - xlog_printk(ANDROID_LOG_ERROR, XLOG_TAG, "DUMP8 ADDRESS: %08lx, Length: %ld\n", (UINT_32)pucStartAddr, u4Length); - } - else if (log_level == ANDROID_LOG_WARN) { - xlog_printk(ANDROID_LOG_WARN, XLOG_TAG, "DUMP8 ADDRESS: %08lx, Length: %ld\n", (UINT_32)pucStartAddr, u4Length); - } - else if (log_level == ANDROID_LOG_INFO) { - xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, "DUMP8 ADDRESS: %08lx, Length: %ld\n", (UINT_32)pucStartAddr, u4Length); - } - else if (log_level == ANDROID_LOG_DEBUG) { - xlog_printk(ANDROID_LOG_DEBUG, XLOG_TAG, "DUMP8 ADDRESS: %08lx, Length: %ld\n", (UINT_32)pucStartAddr, u4Length); - } - else if (log_level == ANDROID_LOG_VERBOSE) { - xlog_printk(ANDROID_LOG_VERBOSE, XLOG_TAG, "DUMP8 ADDRESS: %08lx, Length: %ld\n", (UINT_32)pucStartAddr, u4Length); - } - - while (u4Length > 0) { - if (u4Length >= 16) { - XLOG_FUNC(log_level, "%02x %02x %02x %02x %02x %02x %02x %02x - %02x %02x %02x %02x %02x %02x %02x %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8], pucStartAddr[ 9], pucStartAddr[10], pucStartAddr[11], - pucStartAddr[12], pucStartAddr[13], pucStartAddr[14], pucStartAddr[15]); - u4Length -= 16; - pucStartAddr += 16; - } - else { - switch (u4Length) { - case 1: - XLOG_FUNC(log_level, "%02x\n", - pucStartAddr[ 0]); - break; - case 2: - XLOG_FUNC(log_level, "%02x %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1]); - break; - case 3: - XLOG_FUNC(log_level, "%02x %02x %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2]); - break; - case 4: - XLOG_FUNC(log_level, "%02x %02x %02x %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3]); - break; - case 5: - XLOG_FUNC(log_level, "%02x %02x %02x %02x %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4]); - break; - case 6: - XLOG_FUNC(log_level, "%02x %02x %02x %02x %02x %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5]); - break; - case 7: - XLOG_FUNC(log_level, "%02x %02x %02x %02x %02x %02x %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6]); - break; - case 8: - XLOG_FUNC(log_level, "%02x %02x %02x %02x %02x %02x %02x %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7]); - break; - case 9: - XLOG_FUNC(log_level, "%02x %02x %02x %02x %02x %02x %02x %02x - %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8]); - break; - case 10: - XLOG_FUNC(log_level, "%02x %02x %02x %02x %02x %02x %02x %02x - %02x %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8], pucStartAddr[ 9]); - break; - case 11: - XLOG_FUNC(log_level, "%02x %02x %02x %02x %02x %02x %02x %02x - %02x %02x %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8], pucStartAddr[ 9], pucStartAddr[10]); - break; - case 12: - XLOG_FUNC(log_level, "%02x %02x %02x %02x %02x %02x %02x %02x - %02x %02x %02x %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8], pucStartAddr[ 9], pucStartAddr[10], pucStartAddr[11]); - break; - case 13: - XLOG_FUNC(log_level, "%02x %02x %02x %02x %02x %02x %02x %02x - %02x %02x %02x %02x %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8], pucStartAddr[ 9], pucStartAddr[10], pucStartAddr[11], - pucStartAddr[12]); - break; - case 14: - XLOG_FUNC(log_level, "%02x %02x %02x %02x %02x %02x %02x %02x - %02x %02x %02x %02x %02x %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8], pucStartAddr[ 9], pucStartAddr[10], pucStartAddr[11], - pucStartAddr[12], pucStartAddr[13]); - break; - case 15: - XLOG_FUNC(log_level, "%02x %02x %02x %02x %02x %02x %02x %02x - %02x %02x %02x %02x %02x %02x %02x\n", - pucStartAddr[ 0], pucStartAddr[ 1], pucStartAddr[ 2], pucStartAddr[ 3], - pucStartAddr[ 4], pucStartAddr[ 5], pucStartAddr[ 6], pucStartAddr[ 7], - pucStartAddr[ 8], pucStartAddr[ 9], pucStartAddr[10], pucStartAddr[11], - pucStartAddr[12], pucStartAddr[13], pucStartAddr[14]); - break; - default: - break; - } - u4Length = 0; - } - } - - - return; -} /* end of dumpMemory8() */ -#endif /* DBG */ - - diff --git a/drivers/net/wireless/mt5931/common/wlan_bow.c b/drivers/net/wireless/mt5931/common/wlan_bow.c deleted file mode 100755 index 41b179dde04e..000000000000 --- a/drivers/net/wireless/mt5931/common/wlan_bow.c +++ /dev/null @@ -1,3898 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/common/wlan_bow.c#1 $ -*/ - -/*! \file wlan_bow.c - \brief This file contains the 802.11 PAL commands processing routines for - MediaTek Inc. 802.11 Wireless LAN Adapters. -*/ - - - -/* -** $Log: wlan_bow.c $ - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 01 16 2012 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Support BOW for 5GHz band. - * - * 01 09 2012 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * [ALPS00110632] [Rose][LCA42][Cross Feature][Bluetooth]The "KE" pops up after the device reboots automatically.(once) - * - * Fix bow link disconnected event dereference. - * - * 09 29 2011 cm.chang - * NULL - * Change the function prototype of rlmDomainGetChnlList() - * - * 07 06 2011 terry.wu - * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment - * Improve BoW connection establishment speed. - * - * 06 23 2011 cp.wu - * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module - * change parameter name from PeerAddr to BSSID - * - * 06 21 2011 terry.wu - * NULL - * Fix BoW KE. - * - * 06 20 2011 terry.wu - * NULL - * Add BoW Rate Limitation. - * - * 06 20 2011 cp.wu - * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module - * 1. specify target's BSSID when requesting channel privilege. - * 2. pass BSSID information to firmware domain - * - * 06 17 2011 terry.wu - * NULL - * Add BoW 11N support. - * - * 06 07 2011 cp.wu - * [WCXRP00000681] [MT5931][Firmware] HIF code size reduction - * aware more compile options. - * - * 05 25 2011 terry.wu - * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment - * Add BoW Cancel Scan Request and Turn On deactive network function. - * - * 05 23 2011 terry.wu - * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment - * Add some BoW error handling. - * - * 05 22 2011 terry.wu - * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment - * . - * - * 05 22 2011 terry.wu - * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment - * Only reply probe response to its peer or mached SSID for BoW AP. - * - * 05 22 2011 terry.wu - * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment - * Add BoW SAA retry and disable disconnect event when AAA fail . - * - * 05 21 2011 terry.wu - * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment - * Protect BoW connection establishment. - * - * 05 17 2011 terry.wu - * [WCXRP00000730] [MT6620 Wi-Fi][BoW] Send deauth while disconnecting - * Send deauth while disconnecting BoW link. - * - * 05 17 2011 terry.wu - * [WCXRP00000707] [MT6620 Wi-Fi][Driver] Fix BoW Multiple Physical Link connect/disconnect issue - * Fix wrong StaRec state of BoW . - * - * 05 06 2011 terry.wu - * [WCXRP00000707] [MT6620 Wi-Fi][Driver] Fix BoW Multiple Physical Link connect/disconnect issue - * Fix BoW Multiple Physical Link connect/disconnect issue. - * - * 05 03 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Use kalMemAlloc to allocate event buffer for kalIndicateBOWEvent. - * - * 04 15 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Fix prAssocRspSwRfb casting. - * - * 04 15 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add BOW short range mode. - * - * 04 12 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add WMM IE for BOW initiator data. - * - * 04 10 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Change Link disconnection event procedure for hotspot and change skb length check to 1514 bytes. - * - * 04 09 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Change Link connection event procedure and change skb length check to 1512 bytes. - * - * 03 28 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Simplify link disconnected routine, remove link disconnected other routine. - * - * 03 27 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Support multiple physical link. - * - * 03 27 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add new feature - multiple physical link support. - * - * 02 22 2011 wh.su - * [WCXRP00000486] [MT6620 Wi-Fi][BOW] Fixed the bow send frame but not encrypted issue - * fixed the BOW packet sending without encrypted issue. - * - * 02 21 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Fix BOW link disconnection bug. - * - * 02 16 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add bowNotifyAllLinkDisconnected interface and change channel grant procedure for bow starting. - * - * 02 11 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Update BOW channel granted function. - * - * 02 10 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Fix kernel API change issue. - * Before ALPS 2.2 (2.2 included), kfifo_alloc() is - * struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, spinlock_t *lock); - * After ALPS 2.3, kfifo_alloc() is changed to - * int kfifo_alloc(struct kfifo *fifo, unsigned int size, gfp_t gfp_mask); - * - * 02 09 2011 cp.wu - * [WCXRP00000430] [MT6620 Wi-Fi][Firmware][Driver] Create V1.2 branch for MT6620E1 and MT6620E3 - * create V1.2 driver branch based on label MT6620_WIFI_DRIVER_V1_2_110209_1031 - * with BOW and P2P enabled as default - * - * 02 08 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Replace kfifo_get and kfifo_put with kfifo_out and kfifo_in. - * Update BOW get MAC status, remove returning event for AIS network type. - * - * 01 26 2011 cm.chang - * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument - * . - * - * 01 11 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Update BOW Activity Report structure and bug fix. - * - * 01 10 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Update BOW to support multiple physical link. - * - * 12 08 2010 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Support concurrent networks. - * - * 12 07 2010 cm.chang - * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk - * 1. BSSINFO include RLM parameter - * 2. free all sta records when network is disconnected - * - * 11 11 2010 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Fix BoW timer assert issue. - * - * 10 18 2010 chinghwa.yu - * [WCXRP00000110] [MT6620 Wi-Fi] [Driver] Fix BoW Connected event size - * Fix for event returnning Band. - * - * 10 18 2010 chinghwa.yu - * [WCXRP00000110] [MT6620 Wi-Fi] [Driver] Fix BoW Connected event size - * Fix wrong BoW event size. - * - * 10 04 2010 cp.wu - * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by ENUM_NETWORK_TYPE_INDEX_T only - * remove ENUM_NETWORK_TYPE_T definitions - * - * 09 27 2010 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000065] Update BoW design and settings - * Update BCM/BoW design and settings. - * - * 09 16 2010 chinghwa.yu - * NULL - * Fix bowResponderScanDone error when prBssDesc is NULL. - * - * 09 14 2010 chinghwa.yu - * NULL - * Add bowRunEventAAAComplete. - * - * 09 14 2010 cp.wu - * NULL - * indicate correct AIS network information for PAL. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 08 24 2010 chinghwa.yu - * NULL - * Initialize nicActivateNetwork(prAdapter as soon as bow is starting.. - * - * 08 24 2010 chinghwa.yu - * NULL - * Update BOW for the 1st time. - * - * 08 23 2010 cp.wu - * NULL - * revise constant definitions to be matched with implementation (original cmd-event definition is deprecated) - * - * 07 30 2010 cp.wu - * NULL - * 1) BoW wrapper: use definitions instead of hard-coded constant for error code - * 2) AIS-FSM: eliminate use of desired RF parameters, use prTargetBssDesc instead - * 3) add handling for RX_PKT_DESTINATION_HOST_WITH_FORWARD for GO-broadcast frames - * - * 07 15 2010 cp.wu - * - * sync. bluetooth-over-Wi-Fi interface to driver interface document v0.2.6. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 25 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add API in que_mgt to retrieve sta-rec index for security frames. - * - * 06 24 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 802.1x and bluetooth-over-Wi-Fi security frames are now delievered to firmware via command path instead of data path. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * 1) add timeout handler mechanism for pending command packets - * 2) add p2p add/removal key - * - * 05 13 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add NULL OID implementation for WOL-related OIDs. - * - * 05 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * 1) all BT physical handles shares the same RSSI/Link Quality. - * 2) simplify BT command composing - * - * 04 28 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * change prefix for data structure used to communicate with 802.11 PAL - * to avoid ambiguous naming with firmware interface - * - * 04 27 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add multiple physical link support - * - * 04 14 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * information buffer for query oid/ioctl is now buffered in prCmdInfo - * instead of glue-layer variable to improve multiple oid/ioctl capability - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * 2) command sequence number is now increased atomically - * * 3) private data could be hold and taken use for other purpose -** -*/ - -/****************************************************************************** -* C O M P I L E R F L A G S -******************************************************************************* -*/ - -/****************************************************************************** -* E X T E R N A L R E F E R E N C E S -******************************************************************************* -*/ -#include "precomp.h" - -#if CFG_ENABLE_BT_OVER_WIFI - -#if CFG_BOW_TEST -extern UINT_32 g_arBowRevPalPacketTime[32]; -#endif - - -/****************************************************************************** -* C O N S T A N T S -******************************************************************************* -*/ - -/****************************************************************************** -* D A T A T Y P E S -******************************************************************************* -*/ - -/****************************************************************************** -* P U B L I C D A T A -******************************************************************************* -*/ - -static UINT_32 g_u4LinkCount = 0; -static UINT_32 g_u4Beaconing = 0; -static BOW_TABLE_T arBowTable[CFG_BOW_PHYSICAL_LINK_NUM]; - -/****************************************************************************** -* P R I V A T E D A T A -******************************************************************************* -*/ - -const BOW_CMD_T arBowCmdTable[] = { - {BOW_CMD_ID_GET_MAC_STATUS, bowCmdGetMacStatus}, - {BOW_CMD_ID_SETUP_CONNECTION, bowCmdSetupConnection}, - {BOW_CMD_ID_DESTROY_CONNECTION, bowCmdDestroyConnection}, - {BOW_CMD_ID_SET_PTK, bowCmdSetPTK}, - {BOW_CMD_ID_READ_RSSI, bowCmdReadRSSI}, - {BOW_CMD_ID_READ_LINK_QUALITY, bowCmdReadLinkQuality}, - {BOW_CMD_ID_SHORT_RANGE_MODE, bowCmdShortRangeMode}, - {BOW_CMD_ID_GET_CHANNEL_LIST, bowCmdGetChannelList}, -}; - -/****************************************************************************** -* M A C R O S -******************************************************************************* -*/ - -/****************************************************************************** -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************* -*/ - -/****************************************************************************** -* F U N C T I O N S -******************************************************************************* -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief command packet generation utility -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] ucCID Command ID -* \param[in] fgSetQuery Set or Query -* \param[in] fgNeedResp Need for response -* \param[in] pfCmdDoneHandler Function pointer when command is done -* \param[in] u4SetQueryInfoLen The length of the set/query buffer -* \param[in] pucInfoBuffer Pointer to set/query buffer -* -* -* \retval WLAN_STATUS_PENDING -* \retval WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSendSetQueryBowCmd ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucCID, - IN BOOLEAN fgSetQuery, - IN BOOLEAN fgNeedResp, - IN PFN_CMD_DONE_HANDLER pfCmdDoneHandler, - IN PFN_CMD_TIMEOUT_HANDLER pfCmdTimeoutHandler, - IN UINT_32 u4SetQueryInfoLen, - IN PUINT_8 pucInfoBuffer, - IN UINT_8 ucSeqNumber - ) -{ - P_GLUE_INFO_T prGlueInfo; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - UINT_8 ucCmdSeqNum; - - ASSERT(prAdapter); - - prGlueInfo = prAdapter->prGlueInfo; - ASSERT(prGlueInfo); - - DBGLOG(REQ, TRACE, ("Command ID = 0x%08X\n", ucCID)); - - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, (CMD_HDR_SIZE + u4SetQueryInfoLen)); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - DBGLOG(REQ, TRACE, ("ucCmdSeqNum =%d\n", ucCmdSeqNum)); - - // Setup common CMD Info Packet - prCmdInfo->eCmdType = COMMAND_TYPE_NETWORK_IOCTL; - prCmdInfo->eNetworkType = NETWORK_TYPE_BOW_INDEX; - prCmdInfo->u2InfoBufLen = (UINT_16)(CMD_HDR_SIZE + u4SetQueryInfoLen); - prCmdInfo->pfCmdDoneHandler = pfCmdDoneHandler; - prCmdInfo->pfCmdTimeoutHandler = pfCmdTimeoutHandler; - prCmdInfo->fgIsOid = FALSE; - prCmdInfo->ucCID = ucCID; - prCmdInfo->fgSetQuery = fgSetQuery; - prCmdInfo->fgNeedResp = fgNeedResp; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = u4SetQueryInfoLen; - prCmdInfo->pvInformationBuffer = NULL; - prCmdInfo->u4InformationBufferLength = 0; - prCmdInfo->u4PrivateData = (UINT_32) ucSeqNumber; - - // Setup WIFI_CMD_T (no payload) - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - if(u4SetQueryInfoLen > 0 && pucInfoBuffer != NULL) { - kalMemCopy(prWifiCmd->aucBuffer, pucInfoBuffer, u4SetQueryInfoLen); - } - - // insert into prCmdQueue - kalEnqueueCommand(prGlueInfo, (P_QUE_ENTRY_T)prCmdInfo); - - // wakeup txServiceThread later - GLUE_SET_EVENT(prGlueInfo); - return WLAN_STATUS_PENDING; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to dispatch command coming from 802.11 PAL -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmd Pointer to the buffer that holds the command -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanbowHandleCommand( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ) -{ - WLAN_STATUS retval = WLAN_STATUS_FAILURE; - UINT_16 i; - - ASSERT(prAdapter); - - for (i = 0; i < sizeof(arBowCmdTable) / sizeof(BOW_CMD_T); i++) { - if ((arBowCmdTable[i].uCmdID == prCmd->rHeader.ucCommandId) && - arBowCmdTable[i].pfCmdHandle) { - retval = arBowCmdTable[i].pfCmdHandle(prAdapter, prCmd); - break; - } - } - - return retval; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is command handler for BOW_CMD_ID_GET_MAC_STATUS -* coming from 802.11 PAL -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmd Pointer to the buffer that holds the command -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bowCmdGetMacStatus( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ) -{ - P_AMPC_EVENT prEvent; - P_BOW_MAC_STATUS prMacStatus; - UINT_8 idx = 0; - UINT_8 ucPrimaryChannel; - ENUM_BAND_T eBand; - ENUM_CHNL_EXT_T eBssSCO; - UINT_8 ucNumOfChannel = 0;//MAX_BOW_NUMBER_OF_CHANNEL; - - RF_CHANNEL_INFO_T aucChannelList[MAX_BOW_NUMBER_OF_CHANNEL]; - - ASSERT(prAdapter); - - //3 <1> If LinkCount != 0 -> OK (optional) - - eBand = BAND_2G4; - eBssSCO = CHNL_EXT_SCN; - - // fill event header - prEvent = (P_AMPC_EVENT) kalMemAlloc((sizeof(AMPC_EVENT) + sizeof(BOW_MAC_STATUS)), VIR_MEM_TYPE); - - prEvent->rHeader.ucEventId = BOW_EVENT_ID_MAC_STATUS; - prEvent->rHeader.ucSeqNumber = prCmd->rHeader.ucSeqNumber; - prEvent->rHeader.u2PayloadLength = sizeof(BOW_MAC_STATUS); - - // fill event body - prMacStatus = (P_BOW_MAC_STATUS)(prEvent->aucPayload); - kalMemZero(prMacStatus, sizeof(BOW_MAC_STATUS)); - - //3 <2> Call CNM to decide if BOW available. - if (cnmBowIsPermitted(prAdapter)) - { - prMacStatus->ucAvailability = TRUE; - } - else - { - prMacStatus->ucAvailability = FALSE; - } - - memcpy(prMacStatus->aucMacAddr, prAdapter->rWifiVar.aucDeviceAddress, PARAM_MAC_ADDR_LEN); - - if (cnmPreferredChannel(prAdapter, &eBand, &ucPrimaryChannel, &eBssSCO)) - { -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowCmdGetMacStatus, Get preferred channel.\n")); -#endif - - prMacStatus->ucNumOfChannel = 1; - prMacStatus->arChannelList[0].ucChannelBand = eBand; - prMacStatus->arChannelList[0].ucChannelNum = ucPrimaryChannel; - } - else - { -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowCmdGetMacStatus, Get channel list. Current number of channel, %d.\n", ucNumOfChannel)); -#endif - - rlmDomainGetChnlList(prAdapter, BAND_2G4, MAX_BOW_NUMBER_OF_CHANNEL_2G4, &ucNumOfChannel, aucChannelList); - - if (ucNumOfChannel > 0) { - for (idx = 0; idx < ucNumOfChannel/*MAX_BOW_NUMBER_OF_CHANNEL_2G4*/; idx++) - { - prMacStatus->arChannelList[idx].ucChannelBand = aucChannelList[idx].eBand; - prMacStatus->arChannelList[idx].ucChannelNum = aucChannelList[idx].ucChannelNum; - } - - prMacStatus->ucNumOfChannel = ucNumOfChannel; - } - - rlmDomainGetChnlList(prAdapter, BAND_5G, MAX_BOW_NUMBER_OF_CHANNEL_5G, &ucNumOfChannel, aucChannelList); - - if (ucNumOfChannel > 0) { - for (idx = 0; idx < ucNumOfChannel/*MAX_BOW_NUMBER_OF_CHANNEL_5G*/; idx++) - { - prMacStatus->arChannelList[prMacStatus->ucNumOfChannel + idx].ucChannelBand = aucChannelList[idx].eBand; - prMacStatus->arChannelList[prMacStatus->ucNumOfChannel + idx].ucChannelNum = aucChannelList[idx].ucChannelNum; - } - - prMacStatus->ucNumOfChannel = prMacStatus->ucNumOfChannel + ucNumOfChannel; - - } - } - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("ucNumOfChannel, eBand, aucChannelList, %x, %x, %x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x.\n", - ucNumOfChannel, - aucChannelList[0].eBand, - aucChannelList[0].ucChannelNum, - aucChannelList[1].ucChannelNum, - aucChannelList[2].ucChannelNum, - aucChannelList[3].ucChannelNum, - aucChannelList[4].ucChannelNum, - aucChannelList[5].ucChannelNum, - aucChannelList[6].ucChannelNum, - aucChannelList[7].ucChannelNum, - aucChannelList[8].ucChannelNum, - aucChannelList[9].ucChannelNum, - aucChannelList[10].ucChannelNum, - aucChannelList[11].ucChannelNum, - aucChannelList[12].ucChannelNum, - aucChannelList[13].ucChannelNum, - aucChannelList[14].ucChannelNum, - aucChannelList[15].ucChannelNum, - aucChannelList[16].ucChannelNum, - aucChannelList[17].ucChannelNum)); - - DBGLOG(BOW, EVENT, ("prMacStatus->ucNumOfChannel, eBand, prMacStatus->arChannelList, %x, %x, %x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x.\n", - prMacStatus->ucNumOfChannel, - prMacStatus->arChannelList[0].ucChannelBand, - prMacStatus->arChannelList[0].ucChannelNum, - prMacStatus->arChannelList[1].ucChannelNum, - prMacStatus->arChannelList[2].ucChannelNum, - prMacStatus->arChannelList[3].ucChannelNum, - prMacStatus->arChannelList[4].ucChannelNum, - prMacStatus->arChannelList[5].ucChannelNum, - prMacStatus->arChannelList[6].ucChannelNum, - prMacStatus->arChannelList[7].ucChannelNum, - prMacStatus->arChannelList[8].ucChannelNum, - prMacStatus->arChannelList[9].ucChannelNum, - prMacStatus->arChannelList[10].ucChannelNum, - prMacStatus->arChannelList[11].ucChannelNum, - prMacStatus->arChannelList[12].ucChannelNum, - prMacStatus->arChannelList[13].ucChannelNum, - prMacStatus->arChannelList[14].ucChannelNum, - prMacStatus->arChannelList[15].ucChannelNum, - prMacStatus->arChannelList[16].ucChannelNum, - prMacStatus->arChannelList[17].ucChannelNum)); - - DBGLOG(BOW, EVENT, ("prMacStatus->ucNumOfChannel, %x.\n", prMacStatus->ucNumOfChannel)); - DBGLOG(BOW, EVENT, ("prMacStatus->arChannelList[0].ucChannelBand, %x.\n", prMacStatus->arChannelList[0].ucChannelBand)); - DBGLOG(BOW, EVENT, ("prMacStatus->arChannelList[0].ucChannelNum, %x.\n", prMacStatus->arChannelList[0].ucChannelNum)); - DBGLOG(BOW, EVENT, ("prMacStatus->ucAvailability, %x.\n", prMacStatus->ucAvailability)); - DBGLOG(BOW, EVENT, ("prMacStatus->aucMacAddr, %x:%x:%x:%x:%x:%x.\n", - prMacStatus->aucMacAddr[0], - prMacStatus->aucMacAddr[1], - prMacStatus->aucMacAddr[2], - prMacStatus->aucMacAddr[3], - prMacStatus->aucMacAddr[4], - prMacStatus->aucMacAddr[5])); -#endif - - kalIndicateBOWEvent(prAdapter->prGlueInfo, prEvent); - - kalMemFree(prEvent, VIR_MEM_TYPE, (sizeof(AMPC_EVENT) + sizeof(BOW_MAC_STATUS))); - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is command handler for BOW_CMD_ID_SETUP_CONNECTION -* coming from 802.11 PAL -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmd Pointer to the buffer that holds the command -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bowCmdSetupConnection( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ) -{ - P_BOW_SETUP_CONNECTION prBowSetupConnection; - CMD_BT_OVER_WIFI rCmdBtOverWifi; - P_BOW_FSM_INFO_T prBowFsmInfo; - BOW_TABLE_T rBowTable; - - UINT_8 ucBowTableIdx = 0; - - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - prBowSetupConnection = (P_BOW_SETUP_CONNECTION) &(prCmd->aucPayload[0]); - - // parameter size check - if(prCmd->rHeader.u2PayloadLength != sizeof(BOW_SETUP_CONNECTION)) - { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_INVALID); - return WLAN_STATUS_INVALID_LENGTH; - } - - //3 <1> If ucLinkCount >= 4 -> Fail. - if (g_u4LinkCount >= CFG_BOW_PHYSICAL_LINK_NUM) - { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_UNACCEPTED); - return WLAN_STATUS_NOT_ACCEPTED; - } - - //3 <2> Call CNM, check if BOW is available. - if (!cnmBowIsPermitted(prAdapter)) - { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_UNACCEPTED); - return WLAN_STATUS_NOT_ACCEPTED; - } - - //3 <3> Lookup BOW Table, if Peer MAC address exist and valid -> Fail. - if (bowCheckBowTableIfVaild(prAdapter, prBowSetupConnection->aucPeerAddress)) - { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_UNACCEPTED); - return WLAN_STATUS_NOT_ACCEPTED; - } - - if(EQUAL_MAC_ADDR(prBowSetupConnection->aucPeerAddress, prAdapter->rWifiVar.aucDeviceAddress)) - { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_INVALID); - return WLAN_STATUS_NOT_ACCEPTED; - } - - - // fill CMD_BT_OVER_WIFI - rCmdBtOverWifi.ucAction = BOW_SETUP_CMD; - rCmdBtOverWifi.ucChannelNum = prBowSetupConnection->ucChannelNum; - COPY_MAC_ADDR(rCmdBtOverWifi.rPeerAddr, prBowSetupConnection->aucPeerAddress); - rCmdBtOverWifi.u2BeaconInterval = prBowSetupConnection->u2BeaconInterval; - rCmdBtOverWifi.ucTimeoutDiscovery = prBowSetupConnection->ucTimeoutDiscovery; - rCmdBtOverWifi.ucTimeoutInactivity = prBowSetupConnection->ucTimeoutInactivity; - rCmdBtOverWifi.ucRole = prBowSetupConnection->ucRole; - rCmdBtOverWifi.PAL_Capabilities = prBowSetupConnection->ucPAL_Capabilities; - rCmdBtOverWifi.cMaxTxPower = prBowSetupConnection->cMaxTxPower; - - if (prBowSetupConnection->ucChannelNum > 14) { - rCmdBtOverWifi.ucChannelBand = BAND_5G; - } - else { - rCmdBtOverWifi.ucChannelBand = BAND_2G4; - } - - COPY_MAC_ADDR(prBowFsmInfo->aucPeerAddress, prBowSetupConnection->aucPeerAddress); - -#if CFG_BOW_PHYSICAL_LINK_NUM > 1 - /*Channel check for supporting multiple physical link*/ - if(g_u4LinkCount > 0) { - if (prBowSetupConnection->ucChannelNum != prBowFsmInfo->ucPrimaryChannel) { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_UNACCEPTED); - return WLAN_STATUS_NOT_ACCEPTED; - } - } -#endif - - prBowFsmInfo->ucPrimaryChannel = prBowSetupConnection->ucChannelNum; - prBowFsmInfo->eBand = rCmdBtOverWifi.ucChannelBand; - prBowFsmInfo->u2BeaconInterval = prBowSetupConnection->u2BeaconInterval; - prBowFsmInfo->ucRole = prBowSetupConnection->ucRole; - - if (prBowSetupConnection->ucPAL_Capabilities > 0) - { - prBowFsmInfo->fgSupportQoS = TRUE; - } - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowCmdSetupConnection.\n")); - DBGLOG(BOW, EVENT, ("rCmdBtOverWifi Channel Number - 0x%x.\n", rCmdBtOverWifi.ucChannelNum)); - DBGLOG(BOW, EVENT, ("rCmdBtOverWifi Peer address - %x:%x:%x:%x:%x:%x.\n", rCmdBtOverWifi.rPeerAddr[0], - rCmdBtOverWifi.rPeerAddr[1], - rCmdBtOverWifi.rPeerAddr[2], - rCmdBtOverWifi.rPeerAddr[3], - rCmdBtOverWifi.rPeerAddr[4], - rCmdBtOverWifi.rPeerAddr[5])); - DBGLOG(BOW, EVENT, ("rCmdBtOverWifi Beacon interval - 0x%x.\n", rCmdBtOverWifi.u2BeaconInterval)); - DBGLOG(BOW, EVENT, ("rCmdBtOverWifi Timeout activity - 0x%x.\n", rCmdBtOverWifi.ucTimeoutDiscovery)); - DBGLOG(BOW, EVENT, ("rCmdBtOverWifi Timeout inactivity - 0x%x.\n", rCmdBtOverWifi.ucTimeoutInactivity)); - DBGLOG(BOW, EVENT, ("rCmdBtOverWifi Role - 0x%x.\n", rCmdBtOverWifi.ucRole)); - DBGLOG(BOW, EVENT, ("rCmdBtOverWifi PAL capability - 0x%x.\n", rCmdBtOverWifi.PAL_Capabilities)); - DBGLOG(BOW, EVENT, ("rCmdBtOverWifi Max Tx power - 0x%x.\n", rCmdBtOverWifi.cMaxTxPower)); -#endif - - //3 <4> Get a free BOW entry, mark as Valid, fill in Peer MAC address, LinkCount += 1, state == Starting. - if (!bowGetBowTableFreeEntry(prAdapter, &ucBowTableIdx)) - { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_UNACCEPTED); - return WLAN_STATUS_NOT_ACCEPTED; - } - - prBowFsmInfo->prTargetBssDesc = NULL; - - COPY_MAC_ADDR(rBowTable.aucPeerAddress, prBowSetupConnection->aucPeerAddress); - //owTable.eState = BOW_DEVICE_STATE_ACQUIRING_CHANNEL; - rBowTable.fgIsValid = TRUE; - rBowTable.ucAcquireID = prBowFsmInfo->ucSeqNumOfChReq; - //rBowTable.ucRole = prBowSetupConnection->ucRole; - //rBowTable.ucChannelNum = prBowSetupConnection->ucChannelNum; - bowSetBowTableContent(prAdapter, ucBowTableIdx, &rBowTable); - - kalSetBowRole(prAdapter->prGlueInfo, rCmdBtOverWifi.ucRole, prBowSetupConnection->aucPeerAddress); - - GLUE_INC_REF_CNT(g_u4LinkCount); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowStarting, g_u4LinkCount, %x.\n", g_u4LinkCount)); -#endif - - if (g_u4LinkCount == 1) - { -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowStarting, cnmTimerInitTimer.\n")); - DBGLOG(BOW, EVENT, ("prBowFsmInfo->u2BeaconInterval, %d.\n", prBowFsmInfo->u2BeaconInterval)); -#endif - cnmTimerInitTimer(prAdapter, - &prBowFsmInfo->rStartingBeaconTimer, - (PFN_MGMT_TIMEOUT_FUNC)bowSendBeacon, - (UINT_32)NULL); - - cnmTimerInitTimer(prAdapter, - &prBowFsmInfo->rChGrantedTimer, - (PFN_MGMT_TIMEOUT_FUNC)bowChGrantedTimeout, - (UINT_32)NULL); - - //Reset Global Variable - g_u4Beaconing = 0; - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowCmdSetupConnection, g_u4LinkCount, %x.\n", g_u4LinkCount)); - DBGLOG(BOW, EVENT, ("kalInitBowDevice, bow0\n")); -#endif -#if CFG_BOW_SEPARATE_DATA_PATH - kalInitBowDevice(prAdapter->prGlueInfo, BOWDEVNAME); -#endif - - /*Active BoW Network*/ - SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_BOW_INDEX); - SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_BOW_INDEX); - nicActivateNetwork(prAdapter, NETWORK_TYPE_BOW_INDEX); - - } - - if(rCmdBtOverWifi.ucRole == BOW_INITIATOR) { - bowSetBowTableState(prAdapter, prBowSetupConnection->aucPeerAddress, BOW_DEVICE_STATE_ACQUIRING_CHANNEL); - bowRequestCh(prAdapter); - } else { - bowSetBowTableState(prAdapter, prBowSetupConnection->aucPeerAddress, BOW_DEVICE_STATE_SCANNING); - bowResponderScan(prAdapter); - } - - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_SUCCESS); - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is command handler for BOW_CMD_ID_DESTROY_CONNECTION -* coming from 802.11 PAL -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmd Pointer to the buffer that holds the command -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bowCmdDestroyConnection( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ) -{ - P_BOW_DESTROY_CONNECTION prBowDestroyConnection; - CMD_BT_OVER_WIFI rCmdBtOverWifi; - P_BOW_FSM_INFO_T prBowFsmInfo; -#if CFG_BOW_TEST - UINT_8 ucIdx; -#endif - - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - - //3 <1> If LinkCount == 0 ->Fail (Optional) - if (g_u4LinkCount == 0) - { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_UNACCEPTED); - return WLAN_STATUS_NOT_ACCEPTED; - } - - // parameter size check - if(prCmd->rHeader.u2PayloadLength != sizeof(BOW_DESTROY_CONNECTION)) - { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_UNACCEPTED); - return WLAN_STATUS_INVALID_LENGTH; - } - - //3 <2> Lookup BOW table, check if is not exist (Valid and Peer MAC address) -> Fail - prBowDestroyConnection = (P_BOW_DESTROY_CONNECTION) &(prCmd->aucPayload[0]); - - if (!bowCheckBowTableIfVaild(prAdapter, prBowDestroyConnection->aucPeerAddress)) - { -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowCmdDestroyConnection, bowCheckIfVaild, not accepted.\n")); -#endif - return WLAN_STATUS_NOT_ACCEPTED; - } - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowCmdDestroyConnection, destroy Peer address - %x:%x:%x:%x:%x:%x.\n", prBowDestroyConnection->aucPeerAddress[0], - prBowDestroyConnection->aucPeerAddress[1], - prBowDestroyConnection->aucPeerAddress[2], - prBowDestroyConnection->aucPeerAddress[3], - prBowDestroyConnection->aucPeerAddress[4], - prBowDestroyConnection->aucPeerAddress[5])); -#endif - - // fill CMD_BT_OVER_WIFI - rCmdBtOverWifi.ucAction = 2; - COPY_MAC_ADDR(rCmdBtOverWifi.rPeerAddr, prBowDestroyConnection->aucPeerAddress); - COPY_MAC_ADDR(prBowFsmInfo->aucPeerAddress, prBowDestroyConnection->aucPeerAddress); -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowCmdDestroyConnection, rCmdBtOverWifi.rPeerAddr - %x:%x:%x:%x:%x:%x.\n", rCmdBtOverWifi.rPeerAddr[0], - rCmdBtOverWifi.rPeerAddr[1], - rCmdBtOverWifi.rPeerAddr[2], - rCmdBtOverWifi.rPeerAddr[3], - rCmdBtOverWifi.rPeerAddr[4], - rCmdBtOverWifi.rPeerAddr[5])); -#endif - -#if CFG_BOW_TEST - for (ucIdx = 0; ucIdx < 11; ucIdx++) - { - DBGLOG(BOW, EVENT, ("BoW receiving PAL packet delta time vs packet number -- %d ms vs %x.\n", ucIdx, g_arBowRevPalPacketTime[ucIdx])); - } -#endif - - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_SUCCESS); - - return wlanoidSendSetQueryBowCmd(prAdapter, - CMD_ID_CMD_BT_OVER_WIFI, - TRUE, - FALSE, - wlanbowCmdEventLinkDisconnected, - wlanbowCmdTimeoutHandler, - sizeof(CMD_BT_OVER_WIFI), - (PUINT_8) &rCmdBtOverWifi, - prCmd->rHeader.ucSeqNumber - ); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is command handler for BOW_CMD_ID_SET_PTK -* coming from 802.11 PAL -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmd Pointer to the buffer that holds the command -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bowCmdSetPTK( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ) -{ - P_BOW_SET_PTK prBowSetPTK; - CMD_802_11_KEY rCmdKey; - - ASSERT(prAdapter); - - // parameter size check - if(prCmd->rHeader.u2PayloadLength != sizeof(BOW_SET_PTK)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - prBowSetPTK = (P_BOW_SET_PTK) &(prCmd->aucPayload[0]); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("prBowSetPTK->aucPeerAddress, %x:%x:%x:%x:%x:%x.\n", - prBowSetPTK->aucPeerAddress[0], - prBowSetPTK->aucPeerAddress[1], - prBowSetPTK->aucPeerAddress[2], - prBowSetPTK->aucPeerAddress[3], - prBowSetPTK->aucPeerAddress[4], - prBowSetPTK->aucPeerAddress[5])); - - DBGLOG(BOW, EVENT, ("rCmdKey.ucIsAuthenticator, %x.\n", kalGetBowRole(prAdapter->prGlueInfo, prBowSetPTK->aucPeerAddress))); -#endif - - if (!bowCheckBowTableIfVaild(prAdapter, prBowSetPTK->aucPeerAddress)) - { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_UNACCEPTED); - - return WLAN_STATUS_NOT_ACCEPTED; - } - - if (bowGetBowTableState(prAdapter, prBowSetPTK->aucPeerAddress) != BOW_DEVICE_STATE_CONNECTED) - { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_FAILURE); - - return WLAN_STATUS_NOT_ACCEPTED; - } - - // fill CMD_802_11_KEY - rCmdKey.ucAddRemove = 1; // add - rCmdKey.ucTxKey = 1; - rCmdKey.ucKeyType = 1; - rCmdKey.ucIsAuthenticator = kalGetBowRole(prAdapter->prGlueInfo, prBowSetPTK->aucPeerAddress); - COPY_MAC_ADDR(rCmdKey.aucPeerAddr, prBowSetPTK->aucPeerAddress); - rCmdKey.ucNetType = NETWORK_TYPE_BOW_INDEX; // BT Over Wi-Fi - rCmdKey.ucAlgorithmId = CIPHER_SUITE_CCMP; // AES - rCmdKey.ucKeyId = 0; - rCmdKey.ucKeyLen = 16; // AES = 128bit - kalMemCopy(rCmdKey.aucKeyMaterial, prBowSetPTK->aucTemporalKey, 16); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("prBowSetPTK->aucTemporalKey, %x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x.\n", - prBowSetPTK->aucTemporalKey[0], - prBowSetPTK->aucTemporalKey[1], - prBowSetPTK->aucTemporalKey[2], - prBowSetPTK->aucTemporalKey[3], - prBowSetPTK->aucTemporalKey[4], - prBowSetPTK->aucTemporalKey[5], - prBowSetPTK->aucTemporalKey[6], - prBowSetPTK->aucTemporalKey[7], - prBowSetPTK->aucTemporalKey[8], - prBowSetPTK->aucTemporalKey[9], - prBowSetPTK->aucTemporalKey[10], - prBowSetPTK->aucTemporalKey[11], - prBowSetPTK->aucTemporalKey[12], - prBowSetPTK->aucTemporalKey[13], - prBowSetPTK->aucTemporalKey[14], - prBowSetPTK->aucTemporalKey[15])); - - DBGLOG(BOW, EVENT, ("rCmdKey.aucKeyMaterial, %x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x.\n", - rCmdKey.aucKeyMaterial[0], - rCmdKey.aucKeyMaterial[1], - rCmdKey.aucKeyMaterial[2], - rCmdKey.aucKeyMaterial[3], - rCmdKey.aucKeyMaterial[4], - rCmdKey.aucKeyMaterial[5], - rCmdKey.aucKeyMaterial[6], - rCmdKey.aucKeyMaterial[7], - rCmdKey.aucKeyMaterial[8], - rCmdKey.aucKeyMaterial[9], - rCmdKey.aucKeyMaterial[10], - rCmdKey.aucKeyMaterial[11], - rCmdKey.aucKeyMaterial[12], - rCmdKey.aucKeyMaterial[13], - rCmdKey.aucKeyMaterial[14], - rCmdKey.aucKeyMaterial[15])); -#endif - - return wlanoidSendSetQueryBowCmd(prAdapter, - CMD_ID_ADD_REMOVE_KEY, - TRUE, - FALSE, - wlanbowCmdEventSetCommon, - wlanbowCmdTimeoutHandler, - sizeof(CMD_802_11_KEY), - (PUINT_8) &rCmdKey, - prCmd->rHeader.ucSeqNumber - ); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is command handler for BOW_CMD_ID_READ_RSSI -* coming from 802.11 PAL -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmd Pointer to the buffer that holds the command -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bowCmdReadRSSI( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ) -{ - P_BOW_READ_RSSI prBowReadRSSI; - - ASSERT(prAdapter); - - // parameter size check - if(prCmd->rHeader.u2PayloadLength != sizeof(BOW_READ_RSSI)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - prBowReadRSSI = (P_BOW_READ_RSSI) &(prCmd->aucPayload[0]); - - return wlanoidSendSetQueryBowCmd(prAdapter, - CMD_ID_GET_LINK_QUALITY, - FALSE, - TRUE, - wlanbowCmdEventReadRssi, - wlanbowCmdTimeoutHandler, - 0, - NULL, - prCmd->rHeader.ucSeqNumber - ); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is command handler for BOW_CMD_ID_READ_LINK_QUALITY -* coming from 802.11 PAL -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmd Pointer to the buffer that holds the command -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bowCmdReadLinkQuality( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ) -{ - P_BOW_READ_LINK_QUALITY prBowReadLinkQuality; - - ASSERT(prAdapter); - - // parameter size check - if(prCmd->rHeader.u2PayloadLength != sizeof(P_BOW_READ_LINK_QUALITY)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - prBowReadLinkQuality = (P_BOW_READ_LINK_QUALITY) &(prCmd->aucPayload[0]); - - return wlanoidSendSetQueryBowCmd(prAdapter, - CMD_ID_GET_LINK_QUALITY, - FALSE, - TRUE, - wlanbowCmdEventReadLinkQuality, - wlanbowCmdTimeoutHandler, - 0, - NULL, - prCmd->rHeader.ucSeqNumber - ); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is command handler for BOW_CMD_ID_SHORT_RANGE_MODE -* coming from 802.11 PAL -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmd Pointer to the buffer that holds the command -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bowCmdShortRangeMode( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ) -{ - P_BOW_SHORT_RANGE_MODE prBowShortRangeMode; - CMD_TX_PWR_T rTxPwrParam; - - ASSERT(prAdapter); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowCmdShortRangeMode.\n")); -#endif - - prBowShortRangeMode = (P_BOW_SHORT_RANGE_MODE) &(prCmd->aucPayload[0]); - - // parameter size check - if(prCmd->rHeader.u2PayloadLength != sizeof(BOW_SHORT_RANGE_MODE)) { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_UNACCEPTED); - return WLAN_STATUS_INVALID_LENGTH; - } - - if (!bowCheckBowTableIfVaild(prAdapter, prBowShortRangeMode->aucPeerAddress)) - { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_UNACCEPTED); - return WLAN_STATUS_NOT_ACCEPTED; - } - - if (bowGetBowTableState(prAdapter, prBowShortRangeMode->aucPeerAddress) != BOW_DEVICE_STATE_CONNECTED) - { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_FAILURE); - return WLAN_STATUS_NOT_ACCEPTED; - } - - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("prBowShortRangeMode->aucPeerAddress, %x:%x:%x:%x:%x:%x.\n", - prBowShortRangeMode->aucPeerAddress[0], - prBowShortRangeMode->aucPeerAddress[1], - prBowShortRangeMode->aucPeerAddress[2], - prBowShortRangeMode->aucPeerAddress[3], - prBowShortRangeMode->aucPeerAddress[4], - prBowShortRangeMode->aucPeerAddress[5])); -#endif - - rTxPwrParam.cTxPwr2G4Cck = (prBowShortRangeMode->cTxPower << 1); - - rTxPwrParam.cTxPwr2G4OFDM_BPSK = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr2G4OFDM_QPSK = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr2G4OFDM_16QAM = (prBowShortRangeMode->cTxPower << 1); - - rTxPwrParam.cTxPwr2G4OFDM_48Mbps = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr2G4OFDM_54Mbps = (prBowShortRangeMode->cTxPower << 1); - - rTxPwrParam.cTxPwr2G4HT20_BPSK = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr2G4HT20_QPSK = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr2G4HT20_16QAM = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr2G4HT20_MCS5 = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr2G4HT20_MCS6 = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr2G4HT20_MCS7 = (prBowShortRangeMode->cTxPower << 1); - - rTxPwrParam.cTxPwr2G4HT40_BPSK = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr2G4HT40_QPSK = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr2G4HT40_16QAM = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr2G4HT40_MCS5 = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr2G4HT40_MCS6 = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr2G4HT40_MCS7 = (prBowShortRangeMode->cTxPower << 1); - - rTxPwrParam.cTxPwr5GOFDM_BPSK = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GOFDM_QPSK = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GOFDM_16QAM = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GOFDM_48Mbps = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GOFDM_54Mbps = (prBowShortRangeMode->cTxPower << 1); - - rTxPwrParam.cTxPwr5GHT20_BPSK = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GHT20_QPSK = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GHT20_16QAM = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GHT20_MCS5 = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GHT20_MCS6 = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GHT20_MCS7 = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GHT40_BPSK = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GHT40_QPSK = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GHT40_16QAM = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GHT40_MCS5 = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GHT40_MCS6 = (prBowShortRangeMode->cTxPower << 1); - rTxPwrParam.cTxPwr5GHT40_MCS7 = (prBowShortRangeMode->cTxPower << 1); - - if (nicUpdateTxPower(prAdapter, &rTxPwrParam) == WLAN_STATUS_SUCCESS) - { -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowCmdShortRangeMode, %x.\n", WLAN_STATUS_SUCCESS)); -#endif - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_SUCCESS); - return WLAN_STATUS_SUCCESS; - } - else - { - wlanbowCmdEventSetStatus(prAdapter, prCmd, BOWCMD_STATUS_FAILURE); - return WLAN_STATUS_FAILURE; - } - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is command handler for BOW_CMD_ID_GET_CHANNEL_LIST -* coming from 802.11 PAL -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmd Pointer to the buffer that holds the command -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bowCmdGetChannelList( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ) -{ - ASSERT(prAdapter); - - // not supported yet - return WLAN_STATUS_FAILURE; -} - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is generic command done handler -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmdInfo Pointer to the buffer that holds the command info -* \param[in] pucEventBuf Pointer to the set buffer OR event buffer -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanbowCmdEventSetStatus( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd, - IN UINT_8 ucEventBuf - ) -{ - P_AMPC_EVENT prEvent; - P_BOW_COMMAND_STATUS prBowCmdStatus; - - ASSERT(prAdapter); - - // fill event header - prEvent = (P_AMPC_EVENT) kalMemAlloc((sizeof(AMPC_EVENT) + sizeof(BOW_COMMAND_STATUS)), VIR_MEM_TYPE); - prEvent->rHeader.ucEventId = BOW_EVENT_ID_COMMAND_STATUS; - prEvent->rHeader.ucSeqNumber = prCmd->rHeader.ucSeqNumber; - prEvent->rHeader.u2PayloadLength = sizeof(BOW_COMMAND_STATUS); - - // fill event body - prBowCmdStatus = (P_BOW_COMMAND_STATUS)(prEvent->aucPayload); - kalMemZero(prBowCmdStatus, sizeof(BOW_COMMAND_STATUS)); - - prBowCmdStatus->ucStatus = ucEventBuf; - - kalIndicateBOWEvent(prAdapter->prGlueInfo, prEvent); - - kalMemFree(prEvent, VIR_MEM_TYPE, (sizeof(AMPC_EVENT) + sizeof(BOW_COMMAND_STATUS))); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is generic command done handler -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmdInfo Pointer to the buffer that holds the command info -* \param[in] pucEventBuf Pointer to the set buffer OR event buffer -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanbowCmdEventSetCommon( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_AMPC_EVENT prEvent; - P_BOW_COMMAND_STATUS prBowCmdStatus; - - ASSERT(prAdapter); - - // fill event header - prEvent = (P_AMPC_EVENT) kalMemAlloc((sizeof(AMPC_EVENT) + sizeof(BOW_COMMAND_STATUS)), VIR_MEM_TYPE); - prEvent->rHeader.ucEventId = BOW_EVENT_ID_COMMAND_STATUS; - prEvent->rHeader.ucSeqNumber = (UINT_8) prCmdInfo->u4PrivateData; - prEvent->rHeader.u2PayloadLength = sizeof(BOW_COMMAND_STATUS); - - // fill event body - prBowCmdStatus = (P_BOW_COMMAND_STATUS)(prEvent->aucPayload); - kalMemZero(prBowCmdStatus, sizeof(BOW_COMMAND_STATUS)); - - prBowCmdStatus->ucStatus = BOWCMD_STATUS_SUCCESS; - - kalIndicateBOWEvent(prAdapter->prGlueInfo, prEvent); - - kalMemFree(prEvent, VIR_MEM_TYPE, (sizeof(AMPC_EVENT) + sizeof(BOW_COMMAND_STATUS))); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief command done handler for CMD_ID_CMD_BT_OVER_WIFI -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmdInfo Pointer to the buffer that holds the command info -* \param[in] pucEventBuf Pointer to the set buffer OR event buffer -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanbowCmdEventLinkConnected( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_AMPC_EVENT prEvent; - P_BOW_LINK_CONNECTED prBowLinkConnected; - P_BOW_FSM_INFO_T prBowFsmInfo; - P_BSS_INFO_T prBssInfo; - - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - - // fill event header - prEvent = (P_AMPC_EVENT) kalMemAlloc((sizeof(AMPC_EVENT) + sizeof(BOW_LINK_CONNECTED)), VIR_MEM_TYPE); - prEvent->rHeader.ucEventId = BOW_EVENT_ID_LINK_CONNECTED; - prEvent->rHeader.ucSeqNumber = (UINT_8) prCmdInfo->u4PrivateData; - prEvent->rHeader.u2PayloadLength = sizeof(BOW_LINK_CONNECTED); - - // fill event body - prBowLinkConnected = (P_BOW_LINK_CONNECTED)(prEvent->aucPayload); - kalMemZero(prBowLinkConnected, sizeof(BOW_LINK_CONNECTED)); - prBowLinkConnected->rChannel.ucChannelNum = prBssInfo->ucPrimaryChannel; - prBowLinkConnected->rChannel.ucChannelBand = prBssInfo->eBand; - COPY_MAC_ADDR(prBowLinkConnected->aucPeerAddress, prBowFsmInfo->aucPeerAddress); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("prEvent->rHeader.ucEventId, 0x%x\n", prEvent->rHeader.ucEventId)); - DBGLOG(BOW, EVENT, ("prEvent->rHeader.ucSeqNumber, 0x%x\n", prEvent->rHeader.ucSeqNumber)); - DBGLOG(BOW, EVENT, ("prEvent->rHeader.u2PayloadLength, 0x%x\n", prEvent->rHeader.u2PayloadLength)); - DBGLOG(BOW, EVENT, ("prBowLinkConnected->rChannel.ucChannelNum, 0x%x\n", prBowLinkConnected->rChannel.ucChannelNum)); - DBGLOG(BOW, EVENT, ("prBowLinkConnected->rChannel.ucChannelBand, 0x%x\n", prBowLinkConnected->rChannel.ucChannelBand)); - DBGLOG(BOW, EVENT, ("wlanbowCmdEventLinkConnected, prBowFsmInfo->aucPeerAddress, %x:%x:%x:%x:%x:%x.\n", - prBowFsmInfo->aucPeerAddress[0], - prBowFsmInfo->aucPeerAddress[1], - prBowFsmInfo->aucPeerAddress[2], - prBowFsmInfo->aucPeerAddress[3], - prBowFsmInfo->aucPeerAddress[4], - prBowFsmInfo->aucPeerAddress[5])); - DBGLOG(BOW, EVENT, ("wlanbowCmdEventLinkConnected, prBowLinkConnected->aucPeerAddress, %x:%x:%x:%x:%x:%x.\n", - prBowLinkConnected->aucPeerAddress[0], - prBowLinkConnected->aucPeerAddress[1], - prBowLinkConnected->aucPeerAddress[2], - prBowLinkConnected->aucPeerAddress[3], - prBowLinkConnected->aucPeerAddress[4], - prBowLinkConnected->aucPeerAddress[5])); - DBGLOG(BOW, EVENT, ("wlanbowCmdEventLinkConnected, g_u4LinkCount, %x.\n", g_u4LinkCount)); -#endif - - /*Indicate Event to PAL*/ - kalIndicateBOWEvent(prAdapter->prGlueInfo, prEvent); - kalMemFree(prEvent, VIR_MEM_TYPE, (sizeof(AMPC_EVENT) + sizeof(BOW_LINK_CONNECTED))); - - /*Release channel if granted*/ - if(prBowFsmInfo->fgIsChannelGranted) { - cnmTimerStopTimer(prAdapter, &prBowFsmInfo->rChGrantedTimer); - //bowReleaseCh(prAdapter); - /*Requested, not granted yet*/ - } else if(prBowFsmInfo->fgIsChannelRequested) { - prBowFsmInfo->fgIsChannelRequested = FALSE; - } - - /* set to connected status*/ - bowSetBowTableState(prAdapter, prBowFsmInfo->aucPeerAddress, BOW_DEVICE_STATE_CONNECTED); - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief command done handler for CMD_ID_CMD_BT_OVER_WIFI -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmdInfo Pointer to the buffer that holds the command info -* \param[in] pucEventBuf Pointer to the set buffer OR event buffer -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanbowCmdEventLinkDisconnected( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_AMPC_EVENT prEvent; - P_BOW_LINK_DISCONNECTED prBowLinkDisconnected; - P_BOW_FSM_INFO_T prBowFsmInfo; - BOW_TABLE_T rBowTable; - UINT_8 ucBowTableIdx; - ENUM_BOW_DEVICE_STATE eFsmState; - BOOL fgSendDeauth = FALSE; - - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - eFsmState = bowGetBowTableState(prAdapter, prBowFsmInfo->aucPeerAddress); - - if(eFsmState == BOW_DEVICE_STATE_DISCONNECTED) { - /*do nothing*/ - return; - } - /*Cancel scan*/ - else if(eFsmState == BOW_DEVICE_STATE_SCANNING && - !(prBowFsmInfo->fgIsChannelRequested)) { - bowResponderCancelScan(prAdapter, FALSE); - bowSetBowTableState(prAdapter, prBowFsmInfo->aucPeerAddress, BOW_DEVICE_STATE_DISCONNECTING); - return; - } - - // fill event header - prEvent = (P_AMPC_EVENT) kalMemAlloc((sizeof(AMPC_EVENT) + sizeof(BOW_LINK_DISCONNECTED)), VIR_MEM_TYPE); - prEvent->rHeader.ucEventId = BOW_EVENT_ID_LINK_DISCONNECTED; - if ((prCmdInfo->u4PrivateData)) - { - prEvent->rHeader.ucSeqNumber = (UINT_8) prCmdInfo->u4PrivateData; - } - else - { - prEvent->rHeader.ucSeqNumber = 0; - } - - prEvent->rHeader.u2PayloadLength = sizeof(BOW_LINK_DISCONNECTED); - - // fill event body - prBowLinkDisconnected = (P_BOW_LINK_DISCONNECTED)(prEvent->aucPayload); - kalMemZero(prBowLinkDisconnected, sizeof(BOW_LINK_DISCONNECTED)); - prBowLinkDisconnected->ucReason = 0x0; - COPY_MAC_ADDR(prBowLinkDisconnected->aucPeerAddress, prBowFsmInfo->aucPeerAddress); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("prEvent->rHeader.ucEventId, 0x%x\n", prEvent->rHeader.ucEventId)); - DBGLOG(BOW, EVENT, ("prEvent->rHeader.ucSeqNumber, 0x%x\n", prEvent->rHeader.ucSeqNumber)); - DBGLOG(BOW, EVENT, ("prEvent->rHeader.u2PayloadLength, 0x%x\n", prEvent->rHeader.u2PayloadLength)); - - DBGLOG(BOW, EVENT, ("wlanbowCmdEventLinkDisconnected, prBowFsmInfo->aucPeerAddress, %x:%x:%x:%x:%x:%x.\n", - prBowFsmInfo->aucPeerAddress[0], - prBowFsmInfo->aucPeerAddress[1], - prBowFsmInfo->aucPeerAddress[2], - prBowFsmInfo->aucPeerAddress[3], - prBowFsmInfo->aucPeerAddress[4], - prBowFsmInfo->aucPeerAddress[5])); - - DBGLOG(BOW, EVENT, ("wlanbowCmdEventLinkDisconnected, prBowLinkDisconnected->aucPeerAddress, %x:%x:%x:%x:%x:%x.\n", - prBowLinkDisconnected->aucPeerAddress[0], - prBowLinkDisconnected->aucPeerAddress[1], - prBowLinkDisconnected->aucPeerAddress[2], - prBowLinkDisconnected->aucPeerAddress[3], - prBowLinkDisconnected->aucPeerAddress[4], - prBowLinkDisconnected->aucPeerAddress[5])); - - DBGLOG(BOW, EVENT, ("wlanbowCmdEventLinkDisconnected, g_u4LinkCount, %x.\n", g_u4LinkCount)); -#endif - - /*Indicate BoW event to PAL*/ -#if 0 - kalIndicateBOWEvent(prAdapter->prGlueInfo, prEvent); - kalMemFree(prEvent, VIR_MEM_TYPE, (sizeof(AMPC_EVENT) + sizeof(BOW_LINK_DISCONNECTED))); -#endif - - // set to disconnected status - prBowFsmInfo->prTargetStaRec = cnmGetStaRecByAddress(prAdapter, NETWORK_TYPE_BOW_INDEX, prBowLinkDisconnected->aucPeerAddress); - - /*Release channel if granted*/ - if(prBowFsmInfo->fgIsChannelGranted) { - cnmTimerStopTimer(prAdapter, &prBowFsmInfo->rChGrantedTimer); - bowReleaseCh(prAdapter); - /*Requested, not granted yet*/ - } else if(prBowFsmInfo->fgIsChannelRequested) { - prBowFsmInfo->fgIsChannelRequested = FALSE; - //bowReleaseCh(prAdapter); - } - -#if 1 - /*Send Deauth to connected peer*/ - if (eFsmState == BOW_DEVICE_STATE_CONNECTED && - (prBowFsmInfo->prTargetStaRec->ucStaState == STA_STATE_3)) - { - fgSendDeauth = TRUE; -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("wlanbowCmdEventLinkDisconnected, bowGetBowTableState, %x.\n", bowGetBowTableState(prAdapter, prBowLinkDisconnected->aucPeerAddress))); -#endif - authSendDeauthFrame(prAdapter, - prBowFsmInfo->prTargetStaRec, - (P_SW_RFB_T)NULL, - REASON_CODE_DEAUTH_LEAVING_BSS, - (PFN_TX_DONE_HANDLER)bowDisconnectLink); - } -#endif - -#if 0 - //3 <3>Stop this link; flush Tx; send deAuthentication -> abort. SAA, AAA. need to check BOW table state == Connected. - if (prAdapter->prGlueInfo->i4TxPendingFrameNum > 0) { - kalFlushPendingTxPackets(prAdapter->prGlueInfo); - } - - /* flush pending security frames */ - if (prAdapter->prGlueInfo->i4TxPendingSecurityFrameNum > 0) { - kalClearSecurityFrames(prAdapter->prGlueInfo); - } -#endif - - /*Update BoW table*/ - bowGetBowTableEntryByPeerAddress(prAdapter, prBowLinkDisconnected->aucPeerAddress, &ucBowTableIdx); - rBowTable.fgIsValid = FALSE; - rBowTable.eState = BOW_DEVICE_STATE_DISCONNECTED; - bowSetBowTableContent(prAdapter, ucBowTableIdx, &rBowTable); - - /*Indicate BoW event to PAL*/ - kalIndicateBOWEvent(prAdapter->prGlueInfo, prEvent); - kalMemFree(prEvent, VIR_MEM_TYPE, (sizeof(AMPC_EVENT) + sizeof(BOW_LINK_DISCONNECTED))); - - /*Decrease link count*/ - GLUE_DEC_REF_CNT(g_u4LinkCount); - - /*If no need to send deauth, DO disconnect now*/ - /*If need to send deauth, DO disconnect at deauth Tx done*/ - if(!fgSendDeauth){ - bowDisconnectLink(prAdapter, NULL, TX_RESULT_SUCCESS); - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief command done handler for CMD_ID_CMD_BT_OVER_WIFI -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmdInfo Pointer to the buffer that holds the command info -* \param[in] pucEventBuf Pointer to the set buffer OR event buffer -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanbowCmdEventSetSetupConnection ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_AMPC_EVENT prEvent; - P_BOW_COMMAND_STATUS prBowCmdStatus; - P_WIFI_CMD_T prWifiCmd; - P_CMD_BT_OVER_WIFI prCmdBtOverWifi; - P_BOW_FSM_INFO_T prBowFsmInfo; - - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - - // restore original command for rPeerAddr - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prCmdBtOverWifi = (P_CMD_BT_OVER_WIFI)(prWifiCmd->aucBuffer); - - // fill event header - prEvent = (P_AMPC_EVENT) kalMemAlloc((sizeof(AMPC_EVENT) + sizeof(BOW_COMMAND_STATUS)), VIR_MEM_TYPE); - prEvent->rHeader.ucEventId = BOW_EVENT_ID_COMMAND_STATUS; - prEvent->rHeader.ucSeqNumber = (UINT_8) prCmdInfo->u4PrivateData; - prEvent->rHeader.u2PayloadLength = sizeof(BOW_COMMAND_STATUS); - - // fill event body - prBowCmdStatus = (P_BOW_COMMAND_STATUS)(prEvent->aucPayload); - kalMemZero(prBowCmdStatus, sizeof(BOW_COMMAND_STATUS)); - prBowCmdStatus->ucStatus = BOWCMD_STATUS_SUCCESS; - - /*Indicate BoW event to PAL*/ - kalIndicateBOWEvent(prAdapter->prGlueInfo, prEvent); - kalMemFree(prEvent, VIR_MEM_TYPE, (sizeof(AMPC_EVENT) + sizeof(BOW_COMMAND_STATUS))); - - // set to starting status - kalSetBowState(prAdapter->prGlueInfo, - BOW_DEVICE_STATE_STARTING, - prCmdBtOverWifi->rPeerAddr); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is the command done handler for BOW_CMD_ID_READ_LINK_QUALITY -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmdInfo Pointer to the buffer that holds the command info -* \param[in] pucEventBuf Pointer to the set buffer OR event buffer -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanbowCmdEventReadLinkQuality ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_EVENT_LINK_QUALITY prLinkQuality; - P_AMPC_EVENT prEvent; - P_BOW_LINK_QUALITY prBowLinkQuality; - - ASSERT(prAdapter); - - prLinkQuality = (P_EVENT_LINK_QUALITY)pucEventBuf; - - // fill event header - prEvent = (P_AMPC_EVENT) kalMemAlloc((sizeof(AMPC_EVENT) + sizeof(BOW_LINK_QUALITY)), VIR_MEM_TYPE); - prEvent->rHeader.ucEventId = BOW_EVENT_ID_LINK_QUALITY; - prEvent->rHeader.ucSeqNumber = (UINT_8) prCmdInfo->u4PrivateData; - prEvent->rHeader.u2PayloadLength = sizeof(BOW_LINK_QUALITY); - - // fill event body - prBowLinkQuality = (P_BOW_LINK_QUALITY)(prEvent->aucPayload); - kalMemZero(prBowLinkQuality, sizeof(BOW_LINK_QUALITY)); - prBowLinkQuality->ucLinkQuality = (UINT_8)prLinkQuality->cLinkQuality; - - kalIndicateBOWEvent(prAdapter->prGlueInfo, prEvent); - - kalMemFree(prEvent, VIR_MEM_TYPE, (sizeof(AMPC_EVENT) + sizeof(BOW_LINK_QUALITY))); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is the command done handler for BOW_CMD_ID_READ_RSSI -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmdInfo Pointer to the buffer that holds the command info -* \param[in] pucEventBuf Pointer to the set buffer OR event buffer -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanbowCmdEventReadRssi ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_EVENT_LINK_QUALITY prLinkQuality; - P_AMPC_EVENT prEvent; - P_BOW_RSSI prBowRssi; - - ASSERT(prAdapter); - - prLinkQuality = (P_EVENT_LINK_QUALITY)pucEventBuf; - - // fill event header - prEvent = (P_AMPC_EVENT) kalMemAlloc((sizeof(AMPC_EVENT) + sizeof(BOW_LINK_QUALITY)), VIR_MEM_TYPE); - prEvent->rHeader.ucEventId = BOW_EVENT_ID_RSSI; - prEvent->rHeader.ucSeqNumber = (UINT_8) prCmdInfo->u4PrivateData; - prEvent->rHeader.u2PayloadLength = sizeof(BOW_RSSI); - - // fill event body - prBowRssi = (P_BOW_RSSI)(prEvent->aucPayload); - kalMemZero(prBowRssi, sizeof(BOW_RSSI)); - prBowRssi->cRssi = (INT_8) prLinkQuality->cRssi; - - kalIndicateBOWEvent(prAdapter->prGlueInfo, prEvent); - - kalMemFree(prEvent, VIR_MEM_TYPE, (sizeof(AMPC_EVENT) + sizeof(BOW_LINK_QUALITY))); - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is the default command timeout handler -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] prCmdInfo Pointer to the buffer that holds the command info -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanbowCmdTimeoutHandler ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ) -{ - P_AMPC_EVENT prEvent; - P_BOW_COMMAND_STATUS prBowCmdStatus; - - ASSERT(prAdapter); - - // fill event header - prEvent = (P_AMPC_EVENT) kalMemAlloc((sizeof(AMPC_EVENT) + sizeof(BOW_COMMAND_STATUS)), VIR_MEM_TYPE); - prEvent->rHeader.ucEventId = BOW_EVENT_ID_COMMAND_STATUS; - prEvent->rHeader.ucSeqNumber = (UINT_8) prCmdInfo->u4PrivateData; - prEvent->rHeader.u2PayloadLength = sizeof(BOW_COMMAND_STATUS); - - // fill event body - prBowCmdStatus = (P_BOW_COMMAND_STATUS)(prEvent->aucPayload); - kalMemZero(prBowCmdStatus, sizeof(BOW_COMMAND_STATUS)); - - prBowCmdStatus->ucStatus = BOWCMD_STATUS_TIMEOUT; // timeout - - kalIndicateBOWEvent(prAdapter->prGlueInfo, prEvent); - - kalMemFree(prEvent, VIR_MEM_TYPE, (sizeof(AMPC_EVENT) + sizeof(BOW_COMMAND_STATUS))); - - return; -} - - -VOID -bowStopping( - IN P_ADAPTER_T prAdapter - ) -{ - P_BOW_FSM_INFO_T prBowFsmInfo; - P_BSS_INFO_T prBowBssInfo; - - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - prBowBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowStoping.\n")); - DBGLOG(BOW, EVENT, ("bowStoping, SSID %s.\n", prBowBssInfo->aucSSID)); - DBGLOG(BOW, EVENT, ("bowStoping, prBowBssInfo->aucBSSID, %x:%x:%x:%x:%x:%x.\n", - prBowBssInfo->aucBSSID[0], - prBowBssInfo->aucBSSID[1], - prBowBssInfo->aucBSSID[2], - prBowBssInfo->aucBSSID[3], - prBowBssInfo->aucBSSID[4], - prBowBssInfo->aucBSSID[5])); - DBGLOG(BOW, EVENT, ("bowStoping, prBssInfo->aucOwnMacAddr, %x:%x:%x:%x:%x:%x.\n", - prBowBssInfo->aucOwnMacAddr[0], - prBowBssInfo->aucOwnMacAddr[1], - prBowBssInfo->aucOwnMacAddr[2], - prBowBssInfo->aucOwnMacAddr[3], - prBowBssInfo->aucOwnMacAddr[4], - prBowBssInfo->aucOwnMacAddr[5])); - DBGLOG(BOW, EVENT, ("bowStoping, prAdapter->rWifiVar.aucDeviceAddress, %x:%x:%x:%x:%x:%x.\n", - prAdapter->rWifiVar.aucDeviceAddress[0], - prAdapter->rWifiVar.aucDeviceAddress[1], - prAdapter->rWifiVar.aucDeviceAddress[2], - prAdapter->rWifiVar.aucDeviceAddress[3], - prAdapter->rWifiVar.aucDeviceAddress[4], - prAdapter->rWifiVar.aucDeviceAddress[5])); - DBGLOG(BOW, EVENT, ("bowStopping, g_u4LinkCount, %x.\n", g_u4LinkCount)); - DBGLOG(BOW, EVENT, ("prBowFsmInfo->aucPeerAddress, %x:%x:%x:%x:%x:%x.\n", prBowFsmInfo->aucPeerAddress[0], - prBowFsmInfo->aucPeerAddress[1], - prBowFsmInfo->aucPeerAddress[2], - prBowFsmInfo->aucPeerAddress[3], - prBowFsmInfo->aucPeerAddress[4], - prBowFsmInfo->aucPeerAddress[5])); - kalPrint("BoW Stoping,[%d,%d]\n", g_u4LinkCount, g_u4Beaconing); -#endif - - if (g_u4LinkCount == 0) - { - /*Stop beaconing*/ - GLUE_DEC_REF_CNT(g_u4Beaconing); - - /*Deactive BoW network*/ - //prBowBssInfo->fgIsNetActive = FALSE; - //prBowBssInfo->fgIsBeaconActivated = FALSE; - nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_BOW_INDEX); - bowChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED); - nicUpdateBss(prAdapter, NETWORK_TYPE_BOW_INDEX); - /*temp solution for FW hal_pwr_mgt.c#3037 ASSERT*/ - nicDeactivateNetwork(prAdapter, NETWORK_TYPE_BOW_INDEX); - SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_BOW_INDEX); - UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_BOW_INDEX); - - } - - return; -} - - -VOID -bowStarting( - IN P_ADAPTER_T prAdapter - ) -{ - P_BOW_FSM_INFO_T prBowFsmInfo; - P_BSS_INFO_T prBssInfo; - - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - - if (g_u4LinkCount == 1) - { -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("BoW Starting.\n")); - DBGLOG(BOW, EVENT, ("BoW channel granted.\n")); -#endif - -#if 0 - /*Active BoW Network*/ - SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_BOW_INDEX); - SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_BOW_INDEX); - nicActivateNetwork(prAdapter, NETWORK_TYPE_BOW_INDEX); -#endif - - //3 <1> Update BSS_INFO_T per Network Basis - //4 <1.1> Setup Operation Mode - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - prBssInfo->ucNetTypeIndex = NETWORK_TYPE_BOW_INDEX; - prBssInfo->eCurrentOPMode = OP_MODE_BOW; - - //4 <1.2> Setup SSID - COPY_MAC_ADDR(prBssInfo->aucOwnMacAddr, prAdapter->rWifiVar.aucDeviceAddress); - COPY_MAC_ADDR(prBssInfo->aucBSSID, prAdapter->rWifiVar.aucDeviceAddress); - prBssInfo->ucSSIDLen = BOW_SSID_LEN; - bowAssignSsid(prBssInfo->aucSSID, prBssInfo->aucOwnMacAddr); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("SSID %s.\n", prBssInfo->aucSSID)); - DBGLOG(BOW, EVENT, ("prBssInfo->aucBSSID, %x:%x:%x:%x:%x:%x.\n", - prBssInfo->aucBSSID[0], - prBssInfo->aucBSSID[1], - prBssInfo->aucBSSID[2], - prBssInfo->aucBSSID[3], - prBssInfo->aucBSSID[4], - prBssInfo->aucBSSID[5])); - DBGLOG(BOW, EVENT, ("prBssInfo->aucOwnMacAddr, %x:%x:%x:%x:%x:%x.\n", - prBssInfo->aucOwnMacAddr[0], - prBssInfo->aucOwnMacAddr[1], - prBssInfo->aucOwnMacAddr[2], - prBssInfo->aucOwnMacAddr[3], - prBssInfo->aucOwnMacAddr[4], - prBssInfo->aucOwnMacAddr[5])); - DBGLOG(BOW, EVENT, ("prAdapter->rWifiVar.aucDeviceAddress, %x:%x:%x:%x:%x:%x.\n", - prAdapter->rWifiVar.aucDeviceAddress[0], - prAdapter->rWifiVar.aucDeviceAddress[1], - prAdapter->rWifiVar.aucDeviceAddress[2], - prAdapter->rWifiVar.aucDeviceAddress[3], - prAdapter->rWifiVar.aucDeviceAddress[4], - prAdapter->rWifiVar.aucDeviceAddress[5])); -#endif - - //4 <1.3> Clear current AP's STA_RECORD_T and current AID - prBssInfo->prStaRecOfAP = (P_STA_RECORD_T)NULL; - prBssInfo->u2AssocId = 0; - - //4 <1.4> Setup Channel, Band and Phy Attributes - prBssInfo->ucPrimaryChannel = prBowFsmInfo->ucPrimaryChannel; - if (prBowFsmInfo->eBand == BAND_2G4) - { - prBssInfo->eBand = BAND_2G4; - } - else - { - prBssInfo->eBand = BAND_5G; - } - -#if CFG_BOW_SUPPORT_11N - prBssInfo->ucPhyTypeSet = prAdapter->rWifiVar.ucAvailablePhyTypeSet & PHY_TYPE_SET_802_11BGN; /* Depend on eBand */ - prBssInfo->ucConfigAdHocAPMode = AP_MODE_MIXED_11BG; /* Depend on eCurrentOPMode and ucPhyTypeSet */ - - prBssInfo->ucNonHTBasicPhyType = (UINT_8) - rNonHTApModeAttributes[prBssInfo->ucConfigAdHocAPMode].ePhyTypeIndex; - prBssInfo->u2BSSBasicRateSet = - rNonHTApModeAttributes[prBssInfo->ucConfigAdHocAPMode].u2BSSBasicRateSet; - - prBssInfo->u2OperationalRateSet = - rNonHTPhyAttributes[prBssInfo->ucNonHTBasicPhyType].u2SupportedRateSet; - - rateGetDataRatesFromRateSet(prBssInfo->u2OperationalRateSet, - prBssInfo->u2BSSBasicRateSet, - prBssInfo->aucAllSupportedRates, - &prBssInfo->ucAllSupportedRatesLen); - -#else - if (prBssInfo->eBand == BAND_2G4) - { - prBssInfo->ucPhyTypeSet = PHY_TYPE_SET_802_11BG; /* Depend on eBand */ - prBssInfo->ucConfigAdHocAPMode = AP_MODE_MIXED_11BG; /* Depend on eCurrentOPMode and ucPhyTypeSet */ - - prBssInfo->u2BSSBasicRateSet = BASIC_RATE_SET_ERP; //RATE_SET_ERP; - prBssInfo->u2OperationalRateSet = RATE_SET_ERP; - prBssInfo->ucNonHTBasicPhyType = PHY_TYPE_ERP_INDEX; - } - else - { - //prBssInfo->ucPhyTypeSet = PHY_TYPE_SET_802_11BG; /* Depend on eBand */ - //prBssInfo->ucConfigAdHocAPMode = AP_MODE_MIXED_11BG; /* Depend on eCurrentOPMode and ucPhyTypeSet */ - prBssInfo->ucPhyTypeSet = PHY_TYPE_SET_802_11A; /* Depend on eBand */ - prBssInfo->ucConfigAdHocAPMode = AP_MODE_11A; /* Depend on eCurrentOPMode and ucPhyTypeSet */ - - //prBssInfo->u2BSSBasicRateSet = BASIC_RATE_SET_ERP; //RATE_SET_ERP; - //prBssInfo->u2OperationalRateSet = RATE_SET_ERP; - - prBssInfo->u2BSSBasicRateSet = BASIC_RATE_SET_OFDM; //RATE_SET_ERP; - prBssInfo->u2OperationalRateSet = RATE_SET_OFDM; - prBssInfo->ucNonHTBasicPhyType = PHY_TYPE_OFDM_INDEX; - } - - -#endif - prBssInfo->fgErpProtectMode = FALSE; - - //4 <1.5> Setup MIB for current BSS - prBssInfo->u2BeaconInterval = prBowFsmInfo->u2BeaconInterval; - prBssInfo->ucDTIMPeriod = DOT11_DTIM_PERIOD_DEFAULT; - prBssInfo->u2ATIMWindow = 0; - prBssInfo->ucBeaconTimeoutCount = 0; - if (prBowFsmInfo->fgSupportQoS) - { - prAdapter->rWifiVar.fgSupportQoS = TRUE; - prBssInfo->fgIsQBSS = TRUE; - } - - - //3 <2> Update BSS_INFO_T common part -#if CFG_SUPPORT_AAA - bssInitForAP(prAdapter, prBssInfo, TRUE); - nicQmUpdateWmmParms(prAdapter, NETWORK_TYPE_BOW_INDEX); -#endif /* CFG_SUPPORT_AAA */ - prBssInfo->fgIsNetActive = TRUE; - prBssInfo->fgIsBeaconActivated = TRUE; - - //3 <3> Set MAC HW - - //4 <2> Initiate BSS_INFO_T - common part - BOW_BSS_INFO_INIT(prAdapter, NETWORK_TYPE_BOW_INDEX); -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("prBowFsmInfo->aucPeerAddress, %x:%x:%x:%x:%x:%x.\n", prBowFsmInfo->aucPeerAddress[0], - prBowFsmInfo->aucPeerAddress[1], - prBowFsmInfo->aucPeerAddress[2], - prBowFsmInfo->aucPeerAddress[3], - prBowFsmInfo->aucPeerAddress[4], - prBowFsmInfo->aucPeerAddress[5])); -#endif - - //4 <3.1> use command packets to inform firmware - rlmBssInitForAPandIbss(prAdapter, prBssInfo); - nicUpdateBss(prAdapter, NETWORK_TYPE_BOW_INDEX); - - //4 <3.2> Update AdHoc PM parameter - nicPmIndicateBssCreated(prAdapter, NETWORK_TYPE_BOW_INDEX); - - //4 <3.1> Reset HW TSF Update Mode and Beacon Mode - - //4 <3.2> Setup BSSID - // TODO: rxmSetRxFilterBSSID0 -// rxmSetRxFilterBSSID0(prBssInfo->ucHwBssidId, prBssInfo->aucBSSID); - - //4 <3.3> Setup RX Filter to accept Probe Request - // TODO: f get/set RX filter. - -#if 0 - { - UINT_32 u4RxFilter; - if (halMacRxGetRxFilters(&u4RxFilter)== HAL_STATUS_SUCCESS) { - - u4RxFilter &= ~BIT(RXFILTER_DROP_PROBE_REQ); - - halMacRxSetRxFilters(u4RxFilter); - } - } -#endif - } - - /*Update BoW Table*/ - bowSetBowTableState(prAdapter, prBowFsmInfo->aucPeerAddress, BOW_DEVICE_STATE_STARTING); - -#if CFG_BOW_TEST - kalPrint("BoW Starting,[%d,%d]\n", g_u4LinkCount, g_u4Beaconing); - DBGLOG(BOW, EVENT, ("bowStarting, g_u4LinkCount, %x.\n", g_u4LinkCount)); -#endif - - /*Start beaconing*/ - if (g_u4Beaconing < 1) - { - GLUE_INC_REF_CNT(g_u4Beaconing); - bssSendBeaconProbeResponse(prAdapter, NETWORK_TYPE_BOW_INDEX, NULL, 0); - cnmTimerStartTimer(prAdapter, &prBowFsmInfo->rStartingBeaconTimer, prBowFsmInfo->u2BeaconInterval); - } - -#if 0 - /*Responder: Start to scan Initiator*/ - if (prBowFsmInfo->ucRole == BOW_RESPONDER) - { -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowStarting responder, start scan result searching.\n")); -#endif - cnmTimerStopTimer(prAdapter, &prBowFsmInfo->rChGrantedTimer); - bowReleaseCh(prAdapter); - bowResponderScan(prAdapter); - } - /*Initiator: Request channel, wait for responder*/ - else { - //bowRequestCh(prAdapter); - } -#endif - return; -} - -VOID -bowAssignSsid ( - IN PUINT_8 pucSsid, - IN PUINT_8 puOwnMacAddr - ) -{ - UINT_8 i; - UINT_8 aucSSID[]=BOW_WILDCARD_SSID; - - kalMemCopy(pucSsid, aucSSID, BOW_WILDCARD_SSID_LEN); - - for (i = 0; i < 6; i++) - { - pucSsid[(3 * i) + 3] = 0x2D; - if ((*(puOwnMacAddr + i) >> 4) < 0xA) - { - *(pucSsid + (3 * i) + 4) = (*(puOwnMacAddr + i) >> 4) + 0x30; - } - else - { - *(pucSsid + (3 * i) + 4) = (*(puOwnMacAddr + i) >> 4) + 0x57; - } - - if ((*(puOwnMacAddr + i) & 0x0F) < 0xA) - { - pucSsid[(3 * i) + 5] = (*(puOwnMacAddr + i) & 0x0F) + 0x30; - } - else - { - pucSsid[(3 * i) + 5] = (*(puOwnMacAddr + i) & 0x0F) + 0x57; - } - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will validate the Rx Probe Request Frame and then return -* result to BSS to indicate if need to send the corresponding Probe Response -* Frame if the specified conditions were matched. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[out] pu4ControlFlags Control flags for replying the Probe Response -* -* @retval TRUE Reply the Probe Response -* @retval FALSE Don't reply the Probe Response -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -bowValidateProbeReq( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_32 pu4ControlFlags - ) -{ - P_WLAN_MAC_MGMT_HEADER_T prMgtHdr; - P_BOW_FSM_INFO_T prBowFsmInfo; - P_BSS_INFO_T prBssInfo; - P_IE_SSID_T prIeSsid = (P_IE_SSID_T)NULL; - PUINT_8 pucIE; - UINT_16 u2IELength; - UINT_16 u2Offset = 0; - BOOLEAN fgReplyProbeResp = FALSE; - - ASSERT(prSwRfb); - ASSERT(pu4ControlFlags); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - - -#if 0//CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowValidateProbeReq.\n")); -#endif - - //4 <1> Parse Probe Req IE and Get IE ptr (SSID, Supported Rate IE, ...) - prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)prSwRfb->pvHeader; - - u2IELength = prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen; - pucIE = (PUINT_8)((UINT_32)prSwRfb->pvHeader + prSwRfb->u2HeaderLen); - - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - if (ELEM_ID_SSID == IE_ID(pucIE)) { - if ((!prIeSsid) && - (IE_LEN(pucIE) <= ELEM_MAX_LEN_SSID)) { - prIeSsid = (P_IE_SSID_T)pucIE; - } - break; - } - } /* end of IE_FOR_EACH */ - - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - if (ELEM_ID_SSID == IE_ID(pucIE)) { - if ((!prIeSsid) && - (IE_LEN(pucIE) <= ELEM_MAX_LEN_SSID)) { - prIeSsid = (P_IE_SSID_T)pucIE; - } - break; - } - } /* end of IE_FOR_EACH */ - - //4 <2> Check network conditions - /*If BoW AP is beaconing*/ - if (prBssInfo->eCurrentOPMode == OP_MODE_BOW && - g_u4Beaconing > 0) { - - /*Check the probe requset sender is our peer*/ - if(bowCheckBowTableIfVaild(prAdapter, prMgtHdr->aucSrcAddr)) { - fgReplyProbeResp = TRUE; - } - /*Check the probe request target SSID is our SSID*/ - else if ((prIeSsid) && - EQUAL_SSID(prBssInfo->aucSSID, prBssInfo->ucSSIDLen, - prIeSsid->aucSSID, prIeSsid->ucLength)) { - fgReplyProbeResp = TRUE; - } - else { - fgReplyProbeResp = FALSE; - } - } - - return fgReplyProbeResp; - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indicate an Event of "Media Disconnect" to HOST -* -* @param[in] u4Param Unused timer parameter -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bowSendBeacon( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Param - ) -{ - P_BOW_FSM_INFO_T prBowFsmInfo; - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - - if ((g_u4Beaconing != 0) && (g_u4LinkCount > 0) && (g_u4LinkCount < CFG_BOW_PHYSICAL_LINK_NUM)) - { - //Send beacon - bssSendBeaconProbeResponse(prAdapter, NETWORK_TYPE_BOW_INDEX, NULL, 0); - cnmTimerStartTimer(prAdapter, &prBowFsmInfo->rStartingBeaconTimer, prBowFsmInfo->u2BeaconInterval); - } -#if CFG_BOW_TEST - else { - kalPrint("BoW Send Beacon,[%d,%d]\n", g_u4LinkCount, g_u4Beaconing); - } -#endif -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indicate an Event of "Media Disconnect" to HOST -* -* @param[in] u4Param Unused timer parameter -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bowResponderScan( - IN P_ADAPTER_T prAdapter - ) -{ - P_BOW_FSM_INFO_T prBowFsmInfo; - P_MSG_SCN_SCAN_REQ prScanReqMsg; - P_BSS_INFO_T prBssInfo; - - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowResponderScan.\n")); - kalPrint("BOW SCAN [REQ:%d]\n", prBowFsmInfo->ucSeqNumOfScanReq+1); -#endif - - prScanReqMsg = (P_MSG_SCN_SCAN_REQ)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_SCN_SCAN_REQ)); - - if (!prScanReqMsg) - { - ASSERT(0); // Can't trigger SCAN FSM - return; - } - - /*Fill scan message*/ - prScanReqMsg->rMsgHdr.eMsgId = MID_BOW_SCN_SCAN_REQ; - prScanReqMsg->ucSeqNum = ++prBowFsmInfo->ucSeqNumOfScanReq; - prScanReqMsg->ucNetTypeIndex = (UINT_8)NETWORK_TYPE_BOW_INDEX; - prScanReqMsg->eScanType = SCAN_TYPE_ACTIVE_SCAN; - prScanReqMsg->ucSSIDType = SCAN_REQ_SSID_SPECIFIED; - prScanReqMsg->ucSSIDLength = BOW_SSID_LEN; - bowAssignSsid(prScanReqMsg->aucSSID, prBowFsmInfo->aucPeerAddress); - prScanReqMsg->ucChannelListNum = 1; - - if (prBowFsmInfo->eBand == BAND_2G4) - { - prScanReqMsg->eScanChannel = SCAN_CHANNEL_SPECIFIED; - prScanReqMsg->arChnlInfoList[0].eBand = BAND_2G4; - } - else - { - prScanReqMsg->eScanChannel = SCAN_CHANNEL_5G; - prScanReqMsg->arChnlInfoList[0].eBand = BAND_5G; - } - - prScanReqMsg->arChnlInfoList[0].ucChannelNum = prBowFsmInfo->ucPrimaryChannel; - prScanReqMsg->u2IELen = 0; - - /*Send scan message*/ - mboxSendMsg(prAdapter, MBOX_ID_0, (P_MSG_HDR_T) prScanReqMsg, MSG_SEND_METHOD_BUF); - - /*Change state to SCANNING*/ - bowSetBowTableState(prAdapter, prBowFsmInfo->aucPeerAddress, BOW_DEVICE_STATE_SCANNING); - - //prBowFsmInfo->fgTryScan = FALSE; /* Will enable background sleep for infrastructure */ - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -bowResponderScanDone( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_SCN_SCAN_DONE prScanDoneMsg; - P_BOW_FSM_INFO_T prBowFsmInfo; - P_BSS_DESC_T prBssDesc; - UINT_8 ucSeqNumOfCompMsg; - P_CONNECTION_SETTINGS_T prConnSettings; - ENUM_BOW_DEVICE_STATE eFsmState; - ENUM_SCAN_STATUS eScanStatus; - - ASSERT(prAdapter); - ASSERT(prMsgHdr); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - prScanDoneMsg = (P_MSG_SCN_SCAN_DONE) prMsgHdr; - eFsmState = bowGetBowTableState(prAdapter, prBowFsmInfo->aucPeerAddress); - - ASSERT(prScanDoneMsg->ucNetTypeIndex == NETWORK_TYPE_BOW_INDEX); - - ucSeqNumOfCompMsg = prScanDoneMsg->ucSeqNum; - eScanStatus = prScanDoneMsg->eScanStatus; - - cnmMemFree(prAdapter, prMsgHdr); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowResponderScanDone.\n")); - kalPrint("BOW SCAN [DONE:%d]\n", ucSeqNumOfCompMsg); -#endif - - if( eScanStatus == SCAN_STATUS_CANCELLED) { -#if CFG_BOW_TEST - kalPrint("BOW SCAN [CANCELLED:%d]\n", ucSeqNumOfCompMsg); -#endif - if(eFsmState == BOW_DEVICE_STATE_DISCONNECTING) { - wlanoidSendSetQueryBowCmd(prAdapter, - CMD_ID_CMD_BT_OVER_WIFI, - TRUE, - FALSE, - wlanbowCmdEventLinkDisconnected, - wlanbowCmdTimeoutHandler, - 0, - NULL, - 0 - ); - } - return; - } - else if(eFsmState == BOW_DEVICE_STATE_DISCONNECTED) { - //bowDisconnectLink(prAdapter, NULL, TX_RESULT_SUCCESS); - return; - } - else if (ucSeqNumOfCompMsg != prBowFsmInfo->ucSeqNumOfScanReq) - { - DBGLOG(BOW, EVENT, ("Sequence no. of BOW Responder scan done is not matched.\n")); - return; - } - else - { - prConnSettings->fgIsScanReqIssued = FALSE; - prBssDesc = scanSearchBssDescByBssid(prAdapter, prBowFsmInfo->aucPeerAddress); -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("End scan result searching.\n")); -#endif - - /*Initiator is FOUND*/ - if (prBssDesc != NULL)// (prBssDesc->aucBSSID != NULL)) - { -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("Search Bow Peer address - %x:%x:%x:%x:%x:%x.\n", prBssDesc->aucBSSID[0], - prBssDesc->aucBSSID[1], - prBssDesc->aucBSSID[2], - prBssDesc->aucBSSID[3], - prBssDesc->aucBSSID[4], - prBssDesc->aucBSSID[5])); - DBGLOG(BOW, EVENT, ("Starting to join initiator.\n")); -#endif - /*Set target BssDesc*/ - prBowFsmInfo->prTargetBssDesc = prBssDesc; - /*Request channel to do JOIN*/ - bowSetBowTableState(prAdapter, prBowFsmInfo->aucPeerAddress, BOW_DEVICE_STATE_ACQUIRING_CHANNEL); - bowRequestCh(prAdapter); - } - /*Initiator is NOT FOUND*/ - else - { - /*Scan again, until PAL timeout*/ - bowResponderScan(prAdapter); -#if 0 - wlanoidSendSetQueryBowCmd(prAdapter, - CMD_ID_CMD_BT_OVER_WIFI, - TRUE, - FALSE, - wlanbowCmdEventLinkDisconnected, - wlanbowCmdTimeoutHandler, - 0, - NULL, - 0 - ); -#endif - } - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Function for cancelling scan request. There is another option to extend channel privilige -* for another purpose. -* -* @param fgIsChannelExtention - Keep the channel previlege, but can cancel scan timer. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bowResponderCancelScan ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsChannelExtention - ) -{ - - P_MSG_SCN_SCAN_CANCEL prScanCancel = (P_MSG_SCN_SCAN_CANCEL)NULL; - P_BOW_FSM_INFO_T prBowFsmInfo = (P_BOW_FSM_INFO_T)NULL; - - DEBUGFUNC("bowResponderCancelScan()"); - - do { - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - - if (TRUE) { -#if CFG_BOW_TEST - kalPrint("BOW SCAN [CANCEL:%d]\n", prBowFsmInfo->ucSeqNumOfScanReq); -#endif - /* There is a channel privilege on hand. */ - - DBGLOG(P2P, TRACE, ("BOW Cancel Scan\n")); - - prScanCancel = (P_MSG_SCN_SCAN_CANCEL)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_SCN_SCAN_CANCEL)); - if (!prScanCancel) { - /* Buffer not enough, can not cancel scan request. */ - DBGLOG(P2P, TRACE, ("Buffer not enough, can not cancel scan.\n")); - ASSERT(FALSE); - break; - } - - prScanCancel->rMsgHdr.eMsgId = MID_BOW_SCN_SCAN_CANCEL; - prScanCancel->ucNetTypeIndex = NETWORK_TYPE_BOW_INDEX; - prScanCancel->ucSeqNum = prBowFsmInfo->ucSeqNumOfScanReq; -#if CFG_ENABLE_WIFI_DIRECT - prScanCancel->fgIsChannelExt = fgIsChannelExtention; -#endif - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prScanCancel, - MSG_SEND_METHOD_BUF); - - } - - } while (FALSE); - -} /* bowResponderCancelScan */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Initialization of JOIN STATE -* -* @param[in] prBssDesc The pointer of BSS_DESC_T which is the BSS we will try to join with. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bowResponderJoin( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ) -{ - P_BOW_FSM_INFO_T prBowFsmInfo; - P_BSS_INFO_T prBssInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - P_STA_RECORD_T prStaRec; - P_MSG_JOIN_REQ_T prJoinReqMsg; - - ASSERT(prBssDesc); - ASSERT(prAdapter); - - DBGLOG(BOW, EVENT, ("Starting bowResponderJoin.\n")); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - //4 <1> We are going to connect to this BSS. - prBssDesc->fgIsConnecting = TRUE; - bowSetBowTableState(prAdapter, prBowFsmInfo->aucPeerAddress, BOW_DEVICE_STATE_CONNECTING); - - //4 <2> Setup corresponding STA_RECORD_T - /*Support First JOIN and retry*/ - prStaRec = bssCreateStaRecFromBssDesc( - prAdapter, - STA_TYPE_BOW_AP, - NETWORK_TYPE_BOW_INDEX, - prBssDesc); - - prBowFsmInfo->prTargetStaRec = prStaRec; - - //4 <3> Update ucAvailableAuthTypes which we can choice during SAA - prStaRec->fgIsReAssoc = FALSE; - prBowFsmInfo->ucAvailableAuthTypes = (UINT_8)AUTH_TYPE_OPEN_SYSTEM; - prStaRec->ucTxAuthAssocRetryLimit = TX_AUTH_ASSOCI_RETRY_LIMIT; - - - //4 <4> Use an appropriate Authentication Algorithm Number among the ucAvailableAuthTypes - if (prBowFsmInfo->ucAvailableAuthTypes & - (UINT_8)AUTH_TYPE_OPEN_SYSTEM) { - - DBGLOG(BOW, LOUD, ("JOIN INIT: Try to do Authentication with AuthType == OPEN_SYSTEM.\n")); - prBowFsmInfo->ucAvailableAuthTypes &= - ~(UINT_8)AUTH_TYPE_OPEN_SYSTEM; - - prStaRec->ucAuthAlgNum = (UINT_8)AUTH_ALGORITHM_NUM_OPEN_SYSTEM; - } - else { - ASSERT(0); - } - - //4 <4.1> sync. to firmware domain - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - - //4 <5> Overwrite Connection Setting for eConnectionPolicy - if (prBssDesc->ucSSIDLen) { - COPY_SSID(prConnSettings->aucSSID, - prConnSettings->ucSSIDLen, - prBssDesc->aucSSID, - prBssDesc->ucSSIDLen); -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowResponderJoin, SSID %s.\n", prBssDesc->aucSSID)); - DBGLOG(BOW, EVENT, ("bowResponderJoin, SSID %s.\n", prConnSettings->aucSSID)); -#endif - } - - //4 <6> Send a Msg to trigger SAA to start JOIN process. - prJoinReqMsg = (P_MSG_JOIN_REQ_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_JOIN_REQ_T)); - if (!prJoinReqMsg) { - - ASSERT(0); // Can't trigger SAA FSM - return; - } - - prJoinReqMsg->rMsgHdr.eMsgId = MID_BOW_SAA_FSM_START; - prJoinReqMsg->ucSeqNum = ++prBowFsmInfo->ucSeqNumOfReqMsg; - prJoinReqMsg->prStaRec = prStaRec; - - prBssInfo->prStaRecOfAP = prStaRec; - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("prStaRec->eStaType, %x.\n", prStaRec->eStaType)); - printk("BoW trigger SAA ["MACSTR"]\n", MAC2STR(prStaRec->aucMacAddr)); -#endif - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prJoinReqMsg, - MSG_SEND_METHOD_BUF); - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will handle the Join Complete Event from SAA FSM for BOW FSM -* -* @param[in] prMsgHdr Message of Join Complete of SAA FSM. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bowFsmRunEventJoinComplete( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_JOIN_COMP_T prJoinCompMsg; - P_BOW_FSM_INFO_T prBowFsmInfo; - P_STA_RECORD_T prStaRec; - P_SW_RFB_T prAssocRspSwRfb; - P_BSS_INFO_T prBssInfo; - P_WLAN_ASSOC_RSP_FRAME_T prAssocRspFrame = (P_WLAN_ASSOC_RSP_FRAME_T) NULL; - UINT_16 u2IELength; - PUINT_8 pucIE; - P_BSS_INFO_T prBowBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - - ASSERT(prAdapter); - ASSERT(prMsgHdr); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - prJoinCompMsg = (P_MSG_JOIN_COMP_T)prMsgHdr; - prStaRec = prJoinCompMsg->prStaRec; - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("Start bowfsmRunEventJoinComplete.\n")); - DBGLOG(BOW, EVENT, ("bowfsmRunEventJoinComplete ptr check\n")); - DBGLOG(BOW, EVENT, ("prMsgHdr %x\n", prMsgHdr)); - DBGLOG(BOW, EVENT, ("prAdapter %x\n", prAdapter)); - DBGLOG(BOW, EVENT, ("prBowFsmInfo %x\n", prBowFsmInfo)); - DBGLOG(BOW, EVENT, ("prStaRec %x\n", prStaRec)); -#endif - - ASSERT(prStaRec); - ASSERT(prBowFsmInfo); - - // Check SEQ NUM - if (prJoinCompMsg->ucSeqNum == prBowFsmInfo->ucSeqNumOfReqMsg) { - COPY_MAC_ADDR(prBowFsmInfo->aucPeerAddress, prStaRec->aucMacAddr); - - //4 <1> JOIN was successful - if (prJoinCompMsg->rJoinStatus == WLAN_STATUS_SUCCESS) { - prAssocRspSwRfb = prJoinCompMsg->prSwRfb; - prAssocRspFrame = (P_WLAN_ASSOC_RSP_FRAME_T) prAssocRspSwRfb->pvHeader; - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - - u2IELength = (UINT_16) ((prAssocRspSwRfb->u2PacketLen - prAssocRspSwRfb->u2HeaderLen) - - (OFFSET_OF(WLAN_ASSOC_RSP_FRAME_T, aucInfoElem[0]) - WLAN_MAC_MGMT_HEADER_LEN)); - pucIE = prAssocRspFrame->aucInfoElem; - - prStaRec->eStaType = STA_TYPE_BOW_AP; - prStaRec->u2DesiredNonHTRateSet &= prBowBssInfo->u2OperationalRateSet; - prStaRec->ucDesiredPhyTypeSet = prStaRec->ucPhyTypeSet & prBowBssInfo->ucPhyTypeSet; -#if CFG_BOW_RATE_LIMITATION - //4 <1.2>Update Rate Set - /*Limit Rate Set to 24M, 48M, 54M */ - prStaRec->u2DesiredNonHTRateSet &= (RATE_SET_BIT_24M | - RATE_SET_BIT_48M | - RATE_SET_BIT_54M); - /*If peer cannot support the above rate set, fix on the avaliable highest rate*/ - if(prStaRec->u2DesiredNonHTRateSet == 0) { - UINT_8 ucHighestRateIndex; - if (rateGetHighestRateIndexFromRateSet(prBowBssInfo->u2OperationalRateSet, &ucHighestRateIndex)) { - prStaRec->u2DesiredNonHTRateSet = BIT(ucHighestRateIndex); - } - } -#endif - - //4 <1.1> Change FW's Media State immediately. - bowChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED); - - mqmProcessAssocRsp(prAdapter, prAssocRspSwRfb, pucIE, u2IELength); - - //4 <1.2> Update HT information and set channel - /* Record HT related parameters in rStaRec and rBssInfo - * Note: it shall be called before nicUpdateBss() - */ -#if CFG_BOW_SUPPORT_11N - rlmProcessAssocRsp(prAdapter, prAssocRspSwRfb, pucIE, u2IELength); -#endif - - //4 <1.3> Update BSS_INFO_T - nicUpdateBss(prAdapter, NETWORK_TYPE_BOW_INDEX); -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("Finish bowUpdateBssInfoForJOIN.\n")); -#endif - //4 <1.4> Activate current AP's STA_RECORD_T in Driver. - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowFsmRunEventJoinComplete, qmActivateStaRec.\n")); -#endif - - //4 <1.7> Set the Next State of BOW FSM - wlanoidSendSetQueryBowCmd(prAdapter, - CMD_ID_CMD_BT_OVER_WIFI, - TRUE, - FALSE, - wlanbowCmdEventLinkConnected, - wlanbowCmdTimeoutHandler, - 0, - NULL, - 0 - ); - } - //4 <2> JOIN was not successful - else - { - /*Retry*/ - bowResponderJoin(prAdapter, prBowFsmInfo->prTargetBssDesc); -#if 0 - wlanoidSendSetQueryBowCmd(prAdapter, - CMD_ID_CMD_BT_OVER_WIFI, - TRUE, - FALSE, - wlanbowCmdEventLinkDisconnected, - wlanbowCmdTimeoutHandler, - 0, - NULL, - 0 - ); -#endif -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("Start bowfsmRunEventJoinComplete -- Join failed.\n")); - printk("BoW trigger SAA REJOIN\n"); -#endif - } - } - - cnmMemFree(prAdapter, prMsgHdr); - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indicate the Media State to HOST -* -* @param[in] eConnectionState Current Media State -* @param[in] fgDelayIndication Set TRUE for postponing the Disconnect Indication. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bowIndicationOfMediaStateToHost ( - IN P_ADAPTER_T prAdapter, - IN ENUM_PARAM_MEDIA_STATE_T eConnectionState, - IN BOOLEAN fgDelayIndication - ) -{ - EVENT_CONNECTION_STATUS rEventConnStatus; - P_CONNECTION_SETTINGS_T prConnSettings; - P_BSS_INFO_T prBssInfo; - P_BOW_FSM_INFO_T prBowFsmInfo; - - - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - - // NOTE(Kevin): Move following line to bowChangeMediaState() macro per CM's request. - //prBowBssInfo->eConnectionState = eConnectionState; - - /* For indicating the Disconnect Event only if current media state is - * disconnected and we didn't do indication yet. - */ - if (prBssInfo->eConnectionState == PARAM_MEDIA_STATE_DISCONNECTED) { - if (prBssInfo->eConnectionStateIndicated == eConnectionState) { - return; - } - } - - if (!fgDelayIndication) { - //4 <0> Cancel Delay Timer - cnmTimerStopTimer(prAdapter, &prBowFsmInfo->rIndicationOfDisconnectTimer); - - //4 <1> Fill EVENT_CONNECTION_STATUS - rEventConnStatus.ucMediaStatus = (UINT_8)eConnectionState; - - if (eConnectionState == PARAM_MEDIA_STATE_CONNECTED) { - rEventConnStatus.ucReasonOfDisconnect = DISCONNECT_REASON_CODE_RESERVED; - - if (prBssInfo->eCurrentOPMode == OP_MODE_BOW) { - rEventConnStatus.ucInfraMode = (UINT_8)NET_TYPE_INFRA; - rEventConnStatus.u2AID = prBssInfo->u2AssocId; - rEventConnStatus.u2ATIMWindow = 0; - } - else if (prBssInfo->eCurrentOPMode == OP_MODE_IBSS) { - rEventConnStatus.ucInfraMode = (UINT_8)NET_TYPE_IBSS; - rEventConnStatus.u2AID = 0; - rEventConnStatus.u2ATIMWindow = prBssInfo->u2ATIMWindow; - } - else { - ASSERT(0); - } - - COPY_SSID(rEventConnStatus.aucSsid, - rEventConnStatus.ucSsidLen, - prConnSettings->aucSSID, - prConnSettings->ucSSIDLen); - - COPY_MAC_ADDR(rEventConnStatus.aucBssid, prBssInfo->aucBSSID); - - rEventConnStatus.u2BeaconPeriod = prBssInfo->u2BeaconInterval; - rEventConnStatus.u4FreqInKHz = nicChannelNum2Freq(prBssInfo->ucPrimaryChannel); - - switch (prBssInfo->ucNonHTBasicPhyType) { - case PHY_TYPE_HR_DSSS_INDEX: - rEventConnStatus.ucNetworkType = (UINT_8)PARAM_NETWORK_TYPE_DS; - break; - - case PHY_TYPE_ERP_INDEX: - rEventConnStatus.ucNetworkType = (UINT_8)PARAM_NETWORK_TYPE_OFDM24; - break; - - case PHY_TYPE_OFDM_INDEX: - rEventConnStatus.ucNetworkType = (UINT_8)PARAM_NETWORK_TYPE_OFDM5; - break; - - default: - ASSERT(0); - rEventConnStatus.ucNetworkType = (UINT_8)PARAM_NETWORK_TYPE_DS; - break; - } - } - else { - #if CFG_PRIVACY_MIGRATION - /* Clear the pmkid cache while media disconnect */ - secClearPmkid(prAdapter); - #endif - - rEventConnStatus.ucReasonOfDisconnect = prBssInfo->ucReasonOfDisconnect; - - } - - //4 <2> Indication - nicMediaStateChange(prAdapter, NETWORK_TYPE_BOW_INDEX, &rEventConnStatus); - prBssInfo->eConnectionStateIndicated = eConnectionState; - } - else { - /* NOTE: Only delay the Indication of Disconnect Event */ - ASSERT(eConnectionState == PARAM_MEDIA_STATE_DISCONNECTED); - - DBGLOG(BOW, INFO, ("Postpone the indication of Disconnect for %d seconds\n", - prConnSettings->ucDelayTimeOfDisconnectEvent)); - - cnmTimerStartTimer(prAdapter, - &prBowFsmInfo->rIndicationOfDisconnectTimer, - SEC_TO_MSEC(prConnSettings->ucDelayTimeOfDisconnectEvent)); - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indiate the Event of Tx Fail of AAA Module. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bowRunEventAAATxFail ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - P_BSS_INFO_T prBssInfo; - - ASSERT(prAdapter); - ASSERT(prStaRec); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowRunEventAAATxFail , bssRemoveStaRecFromClientList.\n")); - printk("BoW AAA TxFail, target state %d\n", prStaRec->ucStaState+1); -#endif - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - bssRemoveStaRecFromClientList(prAdapter, prBssInfo, prStaRec); - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indiate the Event of Successful Completion of AAA Module. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bowRunEventAAAComplete ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - P_BOW_FSM_INFO_T prBowFsmInfo; - - ASSERT(prStaRec); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowRunEventAAAComplete, cnmStaRecChangeState, STA_STATE_3.\n")); - printk("BoW AAA complete ["MACSTR"]\n", MAC2STR(prStaRec->aucMacAddr)); -#endif - - /*Update BssInfo to connected*/ - bowChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED); - nicUpdateBss(prAdapter, NETWORK_TYPE_BOW_INDEX); - - /*Update StaRec to State3*/ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); - - /*Connected*/ - wlanoidSendSetQueryBowCmd(prAdapter, - CMD_ID_CMD_BT_OVER_WIFI, - TRUE, - FALSE, - wlanbowCmdEventLinkConnected, - wlanbowCmdTimeoutHandler, - 0, - NULL, - 0 - ); - - return WLAN_STATUS_SUCCESS; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will handle RxDeauth -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ - -WLAN_STATUS -bowRunEventRxDeAuth ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prSwRfb - ) -{ - P_BSS_INFO_T prBowBssInfo; - P_BOW_FSM_INFO_T prBowFsmInfo; - ENUM_BOW_DEVICE_STATE eFsmState; - - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - prBowBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - - if(!IS_STA_IN_BOW(prStaRec)) { - return WLAN_STATUS_NOT_ACCEPTED; - } - - eFsmState = bowGetBowTableState(prAdapter, prStaRec->aucMacAddr); - - if(eFsmState == BOW_DEVICE_STATE_DISCONNECTED) { - /*do nothing*/ - return WLAN_STATUS_NOT_ACCEPTED; - } - - if (prStaRec->ucStaState > STA_STATE_1) { - - if (STA_STATE_3 == prStaRec->ucStaState) { - //P_MSG_AIS_ABORT_T prAisAbortMsg; - - /* NOTE(Kevin): Change state immediately to avoid starvation of - * MSG buffer because of too many deauth frames before changing - * the STA state. - */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - } - - COPY_MAC_ADDR(prBowFsmInfo->aucPeerAddress, prStaRec->aucMacAddr); - - wlanoidSendSetQueryBowCmd(prAdapter, - CMD_ID_CMD_BT_OVER_WIFI, - TRUE, - FALSE, - wlanbowCmdEventLinkDisconnected, - wlanbowCmdTimeoutHandler, - 0, - NULL, - 0 - ); - - return WLAN_STATUS_SUCCESS; - } - - return WLAN_STATUS_NOT_ACCEPTED; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function handle BoW Link disconnect. -* -* \param[in] pMsduInfo Pointer to the Msdu Info -* \param[in] rStatus The Tx done status -* -* \return - -* -* \note after receive deauth frame, callback function call this -*/ -/*----------------------------------------------------------------------------*/ -VOID -bowDisconnectLink ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ) -{ - P_BOW_FSM_INFO_T prBowFsmInfo; - P_STA_RECORD_T prStaRec; - - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - - /*Free target StaRec*/ - if(prMsduInfo) { - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - } - else { - prStaRec = prBowFsmInfo->prTargetStaRec; - } - - if(prStaRec) { - //cnmStaRecFree(prAdapter, prStaRec, TRUE); - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - } - kalPrint("bowDisconnectLink\n"); - /*No one connected*/ - if (g_u4LinkCount == 0 && g_u4Beaconing != 0) - { - cnmTimerStopTimer(prAdapter, &prBowFsmInfo->rStartingBeaconTimer); - bowStopping(prAdapter); - kalPrint("bowStopping\n"); - /*Restore TxPower from Short range mode*/ -#if CFG_SUPPORT_NVRAM && 0 - wlanLoadManufactureData(prAdapter, kalGetConfiguration(prAdapter->prGlueInfo)); -#endif - /*Uninit BoW Interface*/ -#if CFG_BOW_SEPARATE_DATA_PATH - kalUninitBowDevice(prAdapter->prGlueInfo); -#endif - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will validate the Rx Assoc Req Frame and then return -* the status code to AAA to indicate if need to perform following actions -* when the specified conditions were matched. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[out] pu2StatusCode The Status Code of Validation Result -* -* @retval TRUE Reply the Assoc Resp -* @retval FALSE Don't reply the Assoc Resp -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -bowValidateAssocReq ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_16 pu2StatusCode - ) -{ - BOOLEAN fgReplyAssocResp = FALSE; - P_BSS_INFO_T prBowBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - P_BOW_FSM_INFO_T prBowFsmInfo; - P_WLAN_ASSOC_REQ_FRAME_T prAssocReqFrame = (P_WLAN_ASSOC_REQ_FRAME_T)NULL; - OS_SYSTIME rCurrentTime; - static OS_SYSTIME rLastRejectAssocTime = 0; - - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - prAssocReqFrame = (P_WLAN_ASSOC_REQ_FRAME_T) prSwRfb->pvHeader; - *pu2StatusCode = STATUS_CODE_REQ_DECLINED; - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowValidateAssocReq, prBowFsmInfo->aucPeerAddress, %x:%x:%x:%x:%x:%x.\n", - prBowFsmInfo->aucPeerAddress[0], - prBowFsmInfo->aucPeerAddress[1], - prBowFsmInfo->aucPeerAddress[2], - prBowFsmInfo->aucPeerAddress[3], - prBowFsmInfo->aucPeerAddress[4], - prBowFsmInfo->aucPeerAddress[5])); - DBGLOG(BOW, EVENT, ("bowValidateAssocReq, prAssocReqFrame->aucSrcAddr, %x:%x:%x:%x:%x:%x.\n", - prAssocReqFrame->aucSrcAddr[0], - prAssocReqFrame->aucSrcAddr[1], - prAssocReqFrame->aucSrcAddr[2], - prAssocReqFrame->aucSrcAddr[3], - prAssocReqFrame->aucSrcAddr[4], - prAssocReqFrame->aucSrcAddr[5])); -#endif - - /*Assoc Accept*/ - while(EQUAL_MAC_ADDR(prAssocReqFrame->aucSrcAddr, prBowFsmInfo->aucPeerAddress)) { -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowValidateAssocReq, return wlanbowCmdEventLinkConnected.\n")); -#endif - /*Update StaRec*/ - prStaRec = cnmGetStaRecByAddress(prAdapter, - (UINT_8) NETWORK_TYPE_BOW_INDEX, - prAssocReqFrame->aucSrcAddr); - prStaRec->eStaType = STA_TYPE_BOW_CLIENT; - prStaRec->u2DesiredNonHTRateSet &= prBowBssInfo->u2OperationalRateSet; - prStaRec->ucDesiredPhyTypeSet = prStaRec->ucPhyTypeSet & prBowBssInfo->ucPhyTypeSet; - -#if CFG_BOW_RATE_LIMITATION - /*Limit Rate Set to 24M, 48M, 54M */ - prStaRec->u2DesiredNonHTRateSet &= (RATE_SET_BIT_24M | - RATE_SET_BIT_48M | - RATE_SET_BIT_54M); - /*If peer cannot support the above rate set, fix on the avaliable highest rate*/ - if(prStaRec->u2DesiredNonHTRateSet == 0) { - UINT_8 ucHighestRateIndex; - if (rateGetHighestRateIndexFromRateSet(prBowBssInfo->u2OperationalRateSet, &ucHighestRateIndex)) { - prStaRec->u2DesiredNonHTRateSet = BIT(ucHighestRateIndex); - } else { - /*If no avaliable rate is found, DECLINE the association*/ - *pu2StatusCode = STATUS_CODE_ASSOC_DENIED_RATE_NOT_SUPPORTED; - break; - } - } -#endif - prStaRec->ucNetTypeIndex = NETWORK_TYPE_BOW_INDEX; - - /*Undpate BssInfo to FW*/ - bowChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED); - nicUpdateBss(prAdapter, NETWORK_TYPE_BOW_INDEX); - - /*reply successful*/ - *pu2StatusCode = STATUS_CODE_SUCCESSFUL; - fgReplyAssocResp = TRUE; - break; - } - - /*Reject Assoc*/ - if(*pu2StatusCode != STATUS_CODE_SUCCESSFUL) { - /*Reply Assoc with reject every 5s*/ - rCurrentTime = kalGetTimeTick(); - if(CHECK_FOR_TIMEOUT(rCurrentTime, rLastRejectAssocTime, MSEC_TO_SYSTIME(5000)) || - rLastRejectAssocTime == 0 - ) { - fgReplyAssocResp = TRUE; - rLastRejectAssocTime = rCurrentTime; - } - } - - return fgReplyAssocResp; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will validate the Rx Auth Frame and then return -* the status code to AAA to indicate if need to perform following actions -* when the specified conditions were matched. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[in] pprStaRec Pointer to pointer of STA_RECORD_T structure. -* @param[out] pu2StatusCode The Status Code of Validation Result -* -* @retval TRUE Reply the Auth -* @retval FALSE Don't reply the Auth -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -bowValidateAuth ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN PP_STA_RECORD_T pprStaRec, - OUT PUINT_16 pu2StatusCode - ) -{ - BOOLEAN fgReplyAuth = FALSE; - P_BSS_INFO_T prBowBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - P_BOW_FSM_INFO_T prBowFsmInfo; - P_WLAN_AUTH_FRAME_T prAuthFrame = (P_WLAN_AUTH_FRAME_T)NULL; - OS_SYSTIME rCurrentTime; - static OS_SYSTIME rLastRejectAuthTime = 0; - - /* TODO(Kevin): Call BoW functions to check .. - 1. Check we are BoW now. - 2. Check we can accept connection from thsi peer - 3. Check Black List here. - */ - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - prAuthFrame = (P_WLAN_AUTH_FRAME_T) prSwRfb->pvHeader; - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowValidateAuth, prBowFsmInfo->aucPeerAddress, %x:%x:%x:%x:%x:%x.\n", - prBowFsmInfo->aucPeerAddress[0], - prBowFsmInfo->aucPeerAddress[1], - prBowFsmInfo->aucPeerAddress[2], - prBowFsmInfo->aucPeerAddress[3], - prBowFsmInfo->aucPeerAddress[4], - prBowFsmInfo->aucPeerAddress[5])); - DBGLOG(BOW, EVENT, ("bowValidateAuth, prAuthFrame->aucSrcAddr, %x:%x:%x:%x:%x:%x.\n", - prAuthFrame->aucSrcAddr[0], - prAuthFrame->aucSrcAddr[1], - prAuthFrame->aucSrcAddr[2], - prAuthFrame->aucSrcAddr[3], - prAuthFrame->aucSrcAddr[4], - prAuthFrame->aucSrcAddr[5])); -#endif - - prStaRec = cnmGetStaRecByAddress(prAdapter, - (UINT_8) NETWORK_TYPE_BOW_INDEX, - prAuthFrame->aucSrcAddr); - if (!prStaRec) { -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowValidateAuth, cnmStaRecAlloc.\n")); -#endif - prStaRec = cnmStaRecAlloc(prAdapter, - (UINT_8) NETWORK_TYPE_BOW_INDEX); - - /* TODO(Kevin): Error handling of allocation of STA_RECORD_T for - * exhausted case and do removal of unused STA_RECORD_T. - */ - ASSERT(prStaRec); - COPY_MAC_ADDR(prStaRec->aucMacAddr, prAuthFrame->aucSrcAddr); - prSwRfb->ucStaRecIdx = prStaRec->ucIndex; - prBowBssInfo->prStaRecOfAP = prStaRec; - - /* NOTE(Kevin): Better to change state here, not at TX Done */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowValidateAuth, cnmStaRecChangeState.\n")); -#endif - } - else - { - prSwRfb->ucStaRecIdx = prStaRec->ucIndex; -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowValidateAuth, prStaRec->ucIndex, %x.\n", prStaRec->ucIndex)); -#endif - bssRemoveStaRecFromClientList(prAdapter, prBowBssInfo, prStaRec); - } - - if (EQUAL_MAC_ADDR(prAuthFrame->aucSrcAddr, prBowFsmInfo->aucPeerAddress)) { - - prStaRec->eStaType = STA_TYPE_BOW_CLIENT; - prStaRec->ucNetTypeIndex = NETWORK_TYPE_BOW_INDEX; -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowValidateAuth, prStaRec->eStaType, %x.\n", prStaRec->eStaType)); - DBGLOG(BOW, EVENT, ("bowValidateAuth, prStaRec->ucNetTypeIndex, %x.\n", prStaRec->ucNetTypeIndex)); -#endif - /* Update Station Record - Status/Reason Code */ - prStaRec->u2StatusCode = STATUS_CODE_SUCCESSFUL; - prStaRec->ucJoinFailureCount = 0; - *pprStaRec = prStaRec; - *pu2StatusCode = STATUS_CODE_SUCCESSFUL; - fgReplyAuth = TRUE; - } - else { - cnmStaRecFree(prAdapter, prStaRec, FALSE); - *pu2StatusCode = STATUS_CODE_REQ_DECLINED; - - /*Reply auth with reject every 5s*/ - rCurrentTime = kalGetTimeTick(); - if(CHECK_FOR_TIMEOUT(rCurrentTime, rLastRejectAuthTime, MSEC_TO_SYSTIME(5000)) || - rLastRejectAuthTime == 0 - ) { - fgReplyAuth = TRUE; - rLastRejectAuthTime = rCurrentTime; - } - } - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowValidateAuth, fgReplyAuth, %x.\n", fgReplyAuth)); -#endif - return fgReplyAuth; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is invoked when CNM granted channel privilege -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -bowRunEventChGrant ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_BSS_INFO_T prBowBssInfo; - P_BOW_FSM_INFO_T prBowFsmInfo; - P_MSG_CH_GRANT_T prMsgChGrant; - UINT_8 ucTokenID; - UINT_32 u4GrantInterval; - ENUM_BOW_DEVICE_STATE eFsmState; - - ASSERT(prAdapter); - ASSERT(prMsgHdr); - - prBowBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - prMsgChGrant = (P_MSG_CH_GRANT_T)prMsgHdr; - ucTokenID = prMsgChGrant->ucTokenID; - u4GrantInterval = prMsgChGrant->u4GrantInterval; - - /* 1. free message */ - cnmMemFree(prAdapter, prMsgHdr); - prBowFsmInfo->fgIsChannelGranted = TRUE; - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("Entering bowRunEventChGrant.\n")); -#endif - - eFsmState = bowGetBowTableState(prAdapter, prBowFsmInfo->aucPeerAddress); - - /*Release channel*/ - if((!prBowFsmInfo->fgIsChannelRequested) || - (prBowFsmInfo->ucSeqNumOfChReq != ucTokenID) || - (eFsmState == BOW_DEVICE_STATE_DISCONNECTED) || - (eFsmState == BOW_DEVICE_STATE_DISCONNECTING)){ -#if CFG_BOW_TEST - printk("BoW Channel [GIVE UP:%d]\n", ucTokenID); - printk("[Requested:%d][ucSeqNumOfChReq:%d][eFsmState:%d]\n", - prBowFsmInfo->fgIsChannelRequested, prBowFsmInfo->ucSeqNumOfChReq, eFsmState); -#endif - bowReleaseCh(prAdapter); - return; - } - - /* 2. channel privilege has been approved */ - prBowFsmInfo->u4ChGrantedInterval = u4GrantInterval; - -#if 0 - cnmTimerStartTimer(prAdapter, - &prBowFsmInfo->rChGrantedTimer, - prBowFsmInfo->u4ChGrantedInterval - BOW_JOIN_CH_GRANT_THRESHOLD); -#else - cnmTimerStartTimer(prAdapter, - &prBowFsmInfo->rChGrantedTimer, - BOW_JOIN_CH_REQUEST_INTERVAL - BOW_JOIN_CH_GRANT_THRESHOLD); -#endif - - /* 3.2 set local variable to indicate join timer is ticking */ - prBowFsmInfo->fgIsInfraChannelFinished = FALSE; - -#if CFG_BOW_TEST - printk("BoW Channel [GRANTED:%d].\n", ucTokenID); -#endif - - if(eFsmState == BOW_DEVICE_STATE_ACQUIRING_CHANNEL) { - bowStarting(prAdapter); - bowReleaseCh(prAdapter); - if(prBowFsmInfo->ucRole == BOW_RESPONDER) { - bowResponderJoin(prAdapter, prBowFsmInfo->prTargetBssDesc); - } - } - else { - /*update bssinfo*/ - nicUpdateBss(prAdapter, NETWORK_TYPE_BOW_INDEX); - bowReleaseCh(prAdapter); - } - - return; -} /* end of aisFsmRunEventChGrant() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is to inform CNM for channel privilege requesting -* has been released -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -bowRequestCh ( - IN P_ADAPTER_T prAdapter - ) -{ - P_BOW_FSM_INFO_T prBowFsmInfo; - P_MSG_CH_REQ_T prMsgChReq; - - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - - if (prBowFsmInfo->fgIsChannelGranted == FALSE) - { - -#if CFG_BOW_TEST - printk("BoW channel [REQUEST:%d], %d, %d.\n", prBowFsmInfo->ucSeqNumOfChReq+1, prBowFsmInfo->ucPrimaryChannel, prBowFsmInfo->eBand); -#endif - prMsgChReq = (P_MSG_CH_REQ_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_CH_REQ_T)); - - if (!prMsgChReq) { - ASSERT(0); // Can't indicate CNM for channel acquiring - return; - } - - prMsgChReq->rMsgHdr.eMsgId = MID_MNY_CNM_CH_REQ; - prMsgChReq->ucNetTypeIndex = NETWORK_TYPE_BOW_INDEX; - prMsgChReq->ucTokenID = ++prBowFsmInfo->ucSeqNumOfChReq; - prMsgChReq->eReqType = CH_REQ_TYPE_JOIN; -#if 0 - prMsgChReq->u4MaxInterval = BOW_JOIN_CH_REQUEST_INTERVAL; -#else - prMsgChReq->u4MaxInterval = 1; -#endif - prMsgChReq->ucPrimaryChannel = prBowFsmInfo->ucPrimaryChannel; //prBowFsmInfo->prTargetBssDesc->ucChannelNum; - prMsgChReq->eRfSco = CHNL_EXT_SCN; //prBowFsmInfo->prTargetBssDesc->eSco; - prMsgChReq->eRfBand = prBowFsmInfo->eBand; //prBowFsmInfo->prTargetBssDesc->eBand; - COPY_MAC_ADDR(prMsgChReq->aucBSSID, prBowFsmInfo->aucPeerAddress); - - - prBowFsmInfo->fgIsChannelRequested = TRUE; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prMsgChReq, - MSG_SEND_METHOD_BUF); - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is to inform BOW that channel privilege is granted -* has been released -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -bowReleaseCh ( - IN P_ADAPTER_T prAdapter - ) -{ - P_BOW_FSM_INFO_T prBowFsmInfo; - P_MSG_CH_ABORT_T prMsgChAbort; - - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - - if(prBowFsmInfo->fgIsChannelGranted != FALSE || prBowFsmInfo->fgIsChannelRequested != FALSE) - { -#if CFG_BOW_TEST - printk("BoW channel [RELEASE:%d] %d, %d.\n", prBowFsmInfo->ucSeqNumOfChReq, prBowFsmInfo->ucPrimaryChannel, prBowFsmInfo->eBand); -#endif - - prBowFsmInfo->fgIsChannelRequested = FALSE; - prBowFsmInfo->fgIsChannelGranted = FALSE; - - /* 1. return channel privilege to CNM immediately */ - prMsgChAbort = (P_MSG_CH_ABORT_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_CH_ABORT_T)); - if (!prMsgChAbort) { - ASSERT(0); // Can't release Channel to CNM - return; - } - - prMsgChAbort->rMsgHdr.eMsgId = MID_MNY_CNM_CH_ABORT; - prMsgChAbort->ucNetTypeIndex = NETWORK_TYPE_BOW_INDEX; - prMsgChAbort->ucTokenID = prBowFsmInfo->ucSeqNumOfChReq; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prMsgChAbort, - MSG_SEND_METHOD_BUF); - } - - return; -} /* end of aisFsmReleaseCh() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indicate an Event of "Media Disconnect" to HOST -* -* @param[in] u4Param Unused timer parameter -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bowChGrantedTimeout( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Param - ) -{ - P_BOW_FSM_INFO_T prBowFsmInfo; - ENUM_BOW_DEVICE_STATE eFsmState; - - ASSERT(prAdapter); - - prBowFsmInfo = &(prAdapter->rWifiVar.rBowFsmInfo); - -#if CFG_BOW_TEST - printk("BoW Channel [TIMEOUT]\n"); -#endif -#if 1 - //bowReleaseCh(prAdapter); - eFsmState = bowGetBowTableState(prAdapter, prBowFsmInfo->aucPeerAddress); - - /*If connecting is not completed, request CH again*/ - if((eFsmState == BOW_DEVICE_STATE_CONNECTING) || - (eFsmState == BOW_DEVICE_STATE_STARTING)) - { - bowRequestCh(prAdapter); - } -#endif -} - - -BOOLEAN -bowNotifyAllLinkDisconnected ( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_8 ucBowTableIdx = 0; - CMD_INFO_T rCmdInfo; - - ASSERT(prAdapter); - - kalMemZero(&rCmdInfo, sizeof(CMD_INFO_T)); - - while (ucBowTableIdx < CFG_BOW_PHYSICAL_LINK_NUM) - { - if (arBowTable[ucBowTableIdx].fgIsValid) - { - COPY_MAC_ADDR(prAdapter->rWifiVar.rBowFsmInfo.aucPeerAddress, arBowTable[ucBowTableIdx].aucPeerAddress); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowNotifyAllLinkDisconnected, arBowTable[%x].aucPeerAddress, %x:%x:%x:%x:%x:%x.\n", ucBowTableIdx, - arBowTable[ucBowTableIdx].aucPeerAddress[0], - arBowTable[ucBowTableIdx].aucPeerAddress[1], - arBowTable[ucBowTableIdx].aucPeerAddress[2], - arBowTable[ucBowTableIdx].aucPeerAddress[3], - arBowTable[ucBowTableIdx].aucPeerAddress[4], - arBowTable[ucBowTableIdx].aucPeerAddress[5])); - DBGLOG(BOW, EVENT, ("bowNotifyAllLinkDisconnected, arBowTable[%x].fgIsValid, %x.\n", ucBowTableIdx, arBowTable[ucBowTableIdx].fgIsValid)); -#endif -#if 1 - wlanoidSendSetQueryBowCmd(prAdapter, - CMD_ID_CMD_BT_OVER_WIFI, - TRUE, - FALSE, - wlanbowCmdEventLinkDisconnected, - wlanbowCmdTimeoutHandler, - 0, - NULL, - 0 - ); -#else - wlanbowCmdEventLinkDisconnected(prAdapter, &rCmdInfo, NULL); -#endif - } - - ucBowTableIdx += 1; - } - - return TRUE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to retrieve Bluetooth-over-Wi-Fi state from glue layer -* -* \param[in] -* prGlueInfo -* rPeerAddr -* \return -* ENUM_BOW_DEVICE_STATE -*/ -/*----------------------------------------------------------------------------*/ - -BOOLEAN -bowCheckBowTableIfVaild( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucPeerAddress[6] - ) -{ - UINT_8 idx; - - KAL_SPIN_LOCK_DECLARATION(); - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - for(idx = 0 ; idx < CFG_BOW_PHYSICAL_LINK_NUM ; idx++) - { - if( arBowTable[idx].fgIsValid && - EQUAL_MAC_ADDR(arBowTable[idx].aucPeerAddress, aucPeerAddress)) - { - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("kalCheckBowifVaild, aucPeerAddress %x, %x:%x:%x:%x:%x:%x.\n", idx, - aucPeerAddress[0], - aucPeerAddress[1], - aucPeerAddress[2], - aucPeerAddress[3], - aucPeerAddress[4], - aucPeerAddress[5])); - - DBGLOG(BOW, EVENT, ("kalCheckBowifVaild, arBowTable[idx].aucPeerAddress %x, %x:%x:%x:%x:%x:%x.\n", idx, - arBowTable[idx].aucPeerAddress[0], - arBowTable[idx].aucPeerAddress[1], - arBowTable[idx].aucPeerAddress[2], - arBowTable[idx].aucPeerAddress[3], - arBowTable[idx].aucPeerAddress[4], - arBowTable[idx].aucPeerAddress[5])); - - DBGLOG(BOW, EVENT, ("kalCheckBowifVaild, arBowTable[idx].fgIsValid, %x, %x.\n", idx, arBowTable[idx].fgIsValid)); - -#endif - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - return TRUE; - } - } - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - return FALSE; -} - -BOOLEAN -bowGetBowTableContent( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucBowTableIdx, - OUT P_BOW_TABLE_T prBowTable - ) -{ - KAL_SPIN_LOCK_DECLARATION(); - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - if (arBowTable[ucBowTableIdx].fgIsValid) - { - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowGetBowTableContent, arBowTable[idx].fgIsValid, %x, %x.\n", ucBowTableIdx, arBowTable[ucBowTableIdx].fgIsValid)); - printk("GET State [%d]\n", arBowTable[ucBowTableIdx].eState); -#endif - prBowTable = &(arBowTable[ucBowTableIdx]); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - return TRUE; - } - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - return FALSE; -} - - -BOOLEAN -bowSetBowTableContent( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucBowTableIdx, - IN P_BOW_TABLE_T prBowTable - ) -{ - KAL_SPIN_LOCK_DECLARATION(); - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - COPY_MAC_ADDR(arBowTable[ucBowTableIdx].aucPeerAddress, prBowTable->aucPeerAddress); - arBowTable[ucBowTableIdx].eState = prBowTable->eState; - arBowTable[ucBowTableIdx].fgIsValid = prBowTable->fgIsValid; - arBowTable[ucBowTableIdx].ucAcquireID = prBowTable->ucAcquireID; - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - kalSetBowState(prAdapter->prGlueInfo, prBowTable->eState, prBowTable->aucPeerAddress); - //kalSetBowRole(prAdapter->prGlueInfo, prBowTable->ucRole, prBowTable->aucPeerAddress); - -#if CFG_BOW_TEST - printk("SET State [%d]\n", arBowTable[ucBowTableIdx].eState); - DBGLOG(BOW, EVENT, ("kalCheckBowifVaild, arBowTable[ucBowTableIdx].fgIsValid, %x, %x.\n", ucBowTableIdx, arBowTable[ucBowTableIdx].fgIsValid)); -#endif - - return TRUE; - -} - - -BOOLEAN -bowGetBowTableEntryByPeerAddress( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucPeerAddress[6], - OUT PUINT_8 pucBowTableIdx - ) -{ - UINT_8 idx; - - KAL_SPIN_LOCK_DECLARATION(); - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - for(idx = 0 ; idx < CFG_BOW_PHYSICAL_LINK_NUM ; idx++) - { - if( arBowTable[idx].fgIsValid && - EQUAL_MAC_ADDR(arBowTable[idx].aucPeerAddress, aucPeerAddress)) - { - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("kalCheckBowifVaild, aucPeerAddress %x, %x:%x:%x:%x:%x:%x.\n", idx, - aucPeerAddress[0], - aucPeerAddress[1], - aucPeerAddress[2], - aucPeerAddress[3], - aucPeerAddress[4], - aucPeerAddress[5])); - DBGLOG(BOW, EVENT, ("kalCheckBowifVaild, arBowTable[idx].aucPeerAddress %x, %x:%x:%x:%x:%x:%x.\n", idx, - arBowTable[idx].aucPeerAddress[0], - arBowTable[idx].aucPeerAddress[1], - arBowTable[idx].aucPeerAddress[2], - arBowTable[idx].aucPeerAddress[3], - arBowTable[idx].aucPeerAddress[4], - arBowTable[idx].aucPeerAddress[5])); - DBGLOG(BOW, EVENT, ("kalCheckBowifVaild, arBowTable[idx].fgIsValid, %x, %x.\n", idx, arBowTable[idx].fgIsValid)); -#endif - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - *pucBowTableIdx = idx; - - return TRUE; - } - } - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - return FALSE; -} - - -BOOLEAN -bowGetBowTableFreeEntry( - IN P_ADAPTER_T prAdapter, - OUT PUINT_8 pucBowTableIdx - ) -{ - UINT_8 idx; - - KAL_SPIN_LOCK_DECLARATION(); - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - for(idx = 0 ; idx < CFG_BOW_PHYSICAL_LINK_NUM ; idx++) - { - if(!arBowTable[idx].fgIsValid) - { -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowGetBowTableFreeEntry, arBowTable[idx].fgIsValid, %x, %x.\n", idx, arBowTable[idx].fgIsValid)); -#endif - *pucBowTableIdx = idx; - arBowTable[idx].fgIsValid = TRUE; - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - return TRUE; - } - } - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - return FALSE; -} - - -ENUM_BOW_DEVICE_STATE -bowGetBowTableState( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucPeerAddress[6] - ) -{ - UINT_8 idx; - - KAL_SPIN_LOCK_DECLARATION(); - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - for(idx = 0 ; idx < CFG_BOW_PHYSICAL_LINK_NUM ; idx++) - { - if( arBowTable[idx].fgIsValid && - EQUAL_MAC_ADDR(arBowTable[idx].aucPeerAddress, aucPeerAddress)) - { -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("bowGetState, aucPeerAddress %x, %x:%x:%x:%x:%x:%x.\n", idx, - aucPeerAddress[0], - aucPeerAddress[1], - aucPeerAddress[2], - aucPeerAddress[3], - aucPeerAddress[4], - aucPeerAddress[5])); - DBGLOG(BOW, EVENT, ("bowGetState, arBowTable[idx].aucPeerAddress %x, %x:%x:%x:%x:%x:%x.\n", idx, - arBowTable[idx].aucPeerAddress[0], - arBowTable[idx].aucPeerAddress[1], - arBowTable[idx].aucPeerAddress[2], - arBowTable[idx].aucPeerAddress[3], - arBowTable[idx].aucPeerAddress[4], - arBowTable[idx].aucPeerAddress[5])); - DBGLOG(BOW, EVENT, ("bowGetState, arBowTable[idx].fgIsValid, %x, %x.\n", idx, arBowTable[idx].fgIsValid)); - DBGLOG(BOW, EVENT, ("bowGetState, arBowTable[idx].eState;, %x, %x.\n", idx, arBowTable[idx].eState)); - printk("GET State [%d]\n", arBowTable[idx].eState); -#endif - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - return arBowTable[idx].eState; - } - } - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - return BOW_DEVICE_STATE_DISCONNECTED; -} - - -BOOLEAN -bowSetBowTableState( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucPeerAddress[6], - IN ENUM_BOW_DEVICE_STATE eState - ) -{ - UINT_8 ucBowTableIdx; - - if(bowGetBowTableEntryByPeerAddress(prAdapter, aucPeerAddress, &ucBowTableIdx)) { - KAL_SPIN_LOCK_DECLARATION(); - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - arBowTable[ucBowTableIdx].eState = eState; -#if CFG_BOW_TEST - printk("SET State [%d]\n", eState); -#endif - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_BOW_TABLE); - - kalSetBowState(prAdapter->prGlueInfo, eState, aucPeerAddress); - return TRUE; - } - return FALSE; -} - - -#endif - diff --git a/drivers/net/wireless/mt5931/common/wlan_lib.c b/drivers/net/wireless/mt5931/common/wlan_lib.c deleted file mode 100755 index 76bead149da0..000000000000 --- a/drivers/net/wireless/mt5931/common/wlan_lib.c +++ /dev/null @@ -1,5536 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/common/wlan_lib.c#2 $ -*/ -/*! \file wlan_lib.c - \brief Internal driver stack will export the required procedures here for GLUE Layer. - - This file contains all routines which are exported from MediaTek 802.11 Wireless - LAN driver stack to GLUE Layer. -*/ - - -/* -** $Log: wlan_lib.c $ -** -** 08 15 2012 eason.tsai -** [ALPS00338170] [Need Patch] [Volunteer Patch] modify build warning -** fix build waring for codechange - * - * 07 13 2012 cp.wu - * [WCXRP00001259] [MT6620 Wi-Fi][Driver][Firmware] Send a signal to firmware for termination after SDIO error has happened - * [driver domain] add force reset by host-to-device interrupt mechanism - * - * 06 11 2012 cp.wu - * [WCXRP00001252] [MT6620 Wi-Fi][Driver] Add debug message while encountering firmware response timeout - * output message while timeout event occurs - * - * 06 11 2012 eason.tsai - * NULL - * change from binay to hex code - * - * 06 08 2012 eason.tsai - * NULL - * Nvram context covert from 6620 to 6628 for old 6620 meta tool - * - * 05 11 2012 cp.wu - * [WCXRP00001237] [MT6620 Wi-Fi][Driver] Show MAC address and MAC address source for ACS's convenience - * show MAC address & source while initiliazation - * - * 03 29 2012 eason.tsai - * [WCXRP00001216] [MT6628 Wi-Fi][Driver]add conditional define - * add conditional define. - * - * 03 04 2012 eason.tsai - * NULL - * modify the cal fail report code. - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 01 16 2012 cp.wu - * [WCXRP00001169] [MT6620 Wi-Fi][Driver] API and behavior modification for preferred band configuration with corresponding network configuration - * correct scan result removing policy. - * - * 01 16 2012 cp.wu - * [MT6620 Wi-Fi][Driver] API and behavior modification for preferred band configuration with corresponding network configuration - * add wlanSetPreferBandByNetwork() for glue layer to invoke for setting preferred band configuration corresponding to network type. - * - * 01 05 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the related ioctl / wlan oid function to set the Tx power cfg. - * - * 11 28 2011 cp.wu - * [WCXRP00001125] [MT6620 Wi-Fi][Firmware] Strengthen Wi-Fi power off sequence to have a clearroom environment when returining to ROM code - * 1. Due to firmware now stops HIF DMA for powering off, do not try to receive any packet from firmware - * 2. Take use of prAdapter->fgIsEnterD3ReqIssued for tracking whether it is powering off or not - * - * 11 14 2011 cm.chang - * [WCXRP00001104] [All Wi-Fi][FW] Show init process by HW mail-box register - * Show FW initial ID when timeout to wait for ready bit - * - * 11 11 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * modify the xlog related code. - * - * 10 18 2011 cp.wu - * [WCXRP00001022] [MT6628 Driver][Firmware Download] Add multi section independent download functionality - * when powering off, always clear pending interrupts, then wait for RDY to be de-asserted - * - * 10 14 2011 cp.wu - * [WCXRP00001022] [MT6628 Driver][Firmware Download] Add multi section independent download functionality - * shorten the packet length for firmware download if no more than 2048 bytes. - * - * 10 03 2011 cp.wu - * [WCXRP00001022] [MT6628 Driver][Firmware Download] Add multi section independent download functionality - * add firmware download path in divided scatters. - * - * 10 03 2011 cp.wu - * [MT6628 Driver][Firmware Download] Add multi section independent download functionality - * add firmware downloading aggregated path. - * - * 09 30 2011 cm.chang - * [WCXRP00001020] [MT6620 Wi-Fi][Driver] Handle secondary channel offset of AP in 5GHz band - * . - * - * 09 20 2011 cp.wu - * [WCXRP00000994] [MT6620 Wi-Fi][Driver] dump message for bus error and reset bus error flag while re-initialized - * 1. always show error message for SDIO bus errors. - * 2. reset bus error flag when re-initialization - * - * 08 26 2011 cm.chang - * [WCXRP00000952] [MT5931 Wi-Fi][FW] Handshake with BWCS before DPD/TX power calibration - * Fix compiling error for WinXP MT5931 driver - * - * 08 25 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings - * Add BWCS Sync ready for WinXP. - * - * 08 25 2011 chinghwa.yu - * [WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add DFS switch. - * - * 08 24 2011 chinghwa.yu - * [WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Update RDD test mode cases. - * - * 08 19 2011 cp.wu - * [WCXRP00000702] [MT5931][Driver] Modify initialization sequence for E1 ASIC - * escape from normal path if any error is occured. - * - * 08 15 2011 cp.wu - * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree - * reuse firmware download logic of MT6620 for MT6628. - * - * 08 15 2011 cp.wu - * [WCXRP00000913] [MT6620 Wi-Fi] create repository of source code dedicated for MT6620 E6 ASIC - * support to load different firmware image for E3/E4/E5 and E6 ASIC on win32 platforms. - * - * 08 02 2011 yuche.tsai - * [WCXRP00000896] [Volunteer Patch][WiFi Direct][Driver] GO with multiple client, TX deauth to a disconnecting device issue. - * Fix GO send deauth frame issue. - * - * 07 22 2011 jeffrey.chang - * [WCXRP00000864] [MT5931] Add command to adjust OSC stable time - * modify driver to set OSC stable time after f/w download - * - * 07 18 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add CMD/Event for RDD and BWCS. - * - * 06 24 2011 cp.wu - * [WCXRP00000812] [MT6620 Wi-Fi][Driver] not show NVRAM when there is no valid MAC address in NVRAM content - * if there is no valid address in chip, generate a new one from driver domain instead of firmware domain due to sufficient randomness - * - * 06 23 2011 cp.wu - * [WCXRP00000812] [MT6620 Wi-Fi][Driver] not show NVRAM when there is no valid MAC address in NVRAM content - * check with firmware for valid MAC address. - * - * 06 20 2011 cp.wu - * [WCXRP00000702] [MT5931][Driver] Modify initialization sequence for E1 ASIC - * disable whole-chip resetting mechanism due to the need of further ECO to work as expected. - * - * 05 31 2011 cp.wu - * [WCXRP00000749] [MT6620 Wi-Fi][Driver] Add band edge tx power control to Wi-Fi NVRAM - * changed to use non-zero checking for valid bit in NVRAM content - * - * 05 27 2011 cp.wu - * [WCXRP00000749] [MT6620 Wi-Fi][Driver] Add band edge tx power control to Wi-Fi NVRAM - * invoke CMD_ID_SET_EDGE_TXPWR_LIMIT when there is valid data exist in NVRAM content. - * - * 05 18 2011 cp.wu - * [WCXRP00000734] [MT6620 Wi-Fi][Driver] Pass PHY_PARAM in NVRAM to firmware domain - * pass PHY_PARAM in NVRAM from driver to firmware. - * - * 05 11 2011 cp.wu - * [WCXRP00000718] [MT6620 Wi-Fi] modify the behavior of setting tx power - * correct assertion. - * - * 05 11 2011 cp.wu - * [WCXRP00000718] [MT6620 Wi-Fi] modify the behavior of setting tx power - * ACPI APIs migrate to wlan_lib.c for glue layer to invoke. - * - * 05 11 2011 cm.chang - * [WCXRP00000717] [MT5931 Wi-Fi][Driver] Handle wrong NVRAM content about AP bandwidth setting - * . - * - * 05 05 2011 cp.wu - * [WCXRP00000702] [MT5931][Driver] Modify initialization sequence for E1 ASIC - * change delay from 100ms to 120ms upon DE's suggestion. - * - * 05 05 2011 cp.wu - * [WCXRP00000702] [MT5931][Driver] Modify initialization sequence for E1 ASIC - * add delay after whole-chip resetting for MT5931 E1 ASIC. - * - * 04 22 2011 cp.wu - * [WCXRP00000598] [MT6620 Wi-Fi][Driver] Implementation of interface for communicating with user space process for RESET_START and RESET_END events - * skip power-off handshaking when RESET indication is received. - * - * 04 22 2011 george.huang - * [WCXRP00000621] [MT6620 Wi-Fi][Driver] Support P2P supplicant to set power mode - * . - * - * 04 18 2011 cp.wu - * [WCXRP00000636] [WHQL][MT5931 Driver] 2c_PMHibernate (hang on 2h) - * 1) add API for glue layer to query ACPI state - * 2) Windows glue should not access to hardware after switched into D3 state - * - * 04 15 2011 cp.wu - * [WCXRP00000654] [MT6620 Wi-Fi][Driver] Add loop termination criterion for wlanAdapterStop(). - * add loop termination criteria for wlanAdapterStop(). - * - * 04 12 2011 eddie.chen - * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma - * Fix the sta index in processing security frame - * Simple flow control for TC4 to avoid mgt frames for PS STA to occupy the TC4 - * Add debug message. - * - * 04 12 2011 cp.wu - * [WCXRP00000631] [MT6620 Wi-Fi][Driver] Add an API for QM to retrieve current TC counter value and processing frame dropping cases for TC4 path - * 1. add nicTxGetResource() API for QM to make decisions. - * 2. if management frames is decided by QM for dropping, the call back is invoked to indicate such a case. - * - * 04 06 2011 cp.wu - * [WCXRP00000616] [MT6620 Wi-Fi][Driver] Free memory to pool and kernel in case any unexpected failure happend inside wlanAdapterStart - * invoke nicReleaseAdapterMemory() as failure handling in case wlanAdapterStart() failed unexpectedly - * - * 03 29 2011 wh.su - * [WCXRP00000248] [MT6620 Wi-Fi][FW]Fixed the Klockwork error - * fixed the kclocwork error. - * - * 03 15 2011 cp.wu - * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous memory consumption - * 1. deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK - * 2. Use common coalescing buffer for both TX/RX directions - * - * - * 03 10 2011 cp.wu - * [WCXRP00000532] [MT6620 Wi-Fi][Driver] Migrate NVRAM configuration procedures from MT6620 E2 to MT6620 E3 - * deprecate configuration used by MT6620 E2 - * - * 03 07 2011 terry.wu - * [WCXRP00000521] [MT6620 Wi-Fi][Driver] Remove non-standard debug message - * Toggle non-standard debug messages to comments. - * - * 02 25 2011 cp.wu - * [WCXRP00000496] [MT5931][Driver] Apply host-triggered chip reset before initializing firmware download procedures - * apply host-triggered chip reset mechanism before initializing firmware download procedures. - * - * 02 17 2011 eddie.chen - * [WCXRP00000458] [MT6620 Wi-Fi][Driver] BOW Concurrent - ProbeResp was exist in other channel - * 1) Chnage GetFrameAction decision when BSS is absent. - * 2) Check channel and resource in processing ProbeRequest - * - * 02 16 2011 cm.chang - * [WCXRP00000447] [MT6620 Wi-Fi][FW] Support new NVRAM update mechanism - * . - * - * 02 01 2011 george.huang - * [WCXRP00000333] [MT5931][FW] support SRAM power control drivers - * init variable for CTIA. - * - * 01 27 2011 george.huang - * [WCXRP00000355] [MT6620 Wi-Fi] Set WMM-PS related setting with qualifying AP capability - * Support current measure mode, assigned by registry (XP only). - * - * 01 24 2011 cp.wu - * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving - * 1. add an extra counter for tracking pending forward frames. - * 2. notify TX service thread as well when there is pending forward frame - * 3. correct build errors leaded by introduction of Wi-Fi direct separation module - * - * 01 12 2011 cm.chang - * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting - * User-defined bandwidth is for 2.4G and 5G individually - * - * 01 10 2011 cp.wu - * [WCXRP00000351] [MT6620 Wi-Fi][Driver] remove from scanning result in OID handling layer when the corresponding BSS is disconnected due to beacon timeout - * remove from scanning result when the BSS is disconnected due to beacon timeout. - * - * 01 04 2011 cp.wu - * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands - * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure - * - * 12 31 2010 cp.wu - * [WCXRP00000327] [MT6620 Wi-Fi][Driver] Improve HEC WHQA 6972 workaround coverage in driver side - * while being unloaded, clear all pending interrupt then set LP-own to firmware - * - * 12 31 2010 cp.wu - * [WCXRP00000335] [MT6620 Wi-Fi][Driver] change to use milliseconds sleep instead of delay to avoid blocking to system scheduling - * change to use msleep() and shorten waiting interval to reduce blocking to other task while Wi-Fi driver is being loaded - * - * 12 28 2010 cp.wu - * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release - * report EEPROM used flag via NIC_CAPABILITY - * - * 12 28 2010 cp.wu - * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release - * integrate with 'EEPROM used' flag for reporting correct capability to Engineer Mode/META and other tools - * - * 12 22 2010 eddie.chen - * [WCXRP00000218] [MT6620 Wi-Fi][Driver] Add auto rate window control in registry - * Remove controling auto rate from initial setting. The initial setting is defined by FW code. - * - * 12 15 2010 cp.wu - * NULL - * sync. with ALPS code by enabling interrupt just before leaving wlanAdapterStart() - * - * 12 08 2010 yuche.tsai - * [WCXRP00000245] [MT6620][Driver] Invitation & Provision Discovery Feature Check-in - * Change Param name for invitation connection. - * - * 12 07 2010 cm.chang - * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant - * 1. Country code is from NVRAM or supplicant - * 2. Change band definition in CMD/EVENT. - * - * 11 03 2010 cp.wu - * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection - * 1) use 8 buffers for MT5931 which is equipped with less memory - * 2) modify MT5931 debug level to TRACE when download is successful - * - * 11 02 2010 cp.wu - * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection - * for MT5931, adapter initialization is done *after* firmware is downloaded. - * - * 11 02 2010 cp.wu - * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection - * correct MT5931 firmware download procedure: - * MT5931 will download firmware first then acquire LP-OWN - * - * 11 02 2010 cp.wu - * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection - * 1) update MT5931 firmware encryption tool. (using 64-bytes unit) - * 2) update MT5931 firmware download procedure - * - * 11 01 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module - * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead - * 2) Remove CNM CH-RECOVER event handling - * 3) cfg read/write API renamed with kal prefix for unified naming rules. - * - * 11 01 2010 yarco.yang - * [WCXRP00000149] [MT6620 WI-Fi][Driver]Fine tune performance on MT6516 platform - * Add code to run WlanIST in SDIO callback. - * - * 10 27 2010 george.huang - * [WCXRP00000127] [MT6620 Wi-Fi][Driver] Add a registry to disable Beacon Timeout function for SQA test by using E1 EVB - * Support registry option for disable beacon lost detection. - * - * 10 26 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW] Support NIC capability query command - * 1) update NVRAM content template to ver 1.02 - * 2) add compile option for querying NIC capability (default: off) - * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting - * 4) correct auto-rate compiler error under linux (treat warning as error) - * 5) simplify usage of NVRAM and REG_INFO_T - * 6) add version checking between driver and firmware - * - * 10 26 2010 eddie.chen - * [WCXRP00000134] [MT6620 Wi-Fi][Driver] Add a registry to enable auto rate for SQA test by using E1 EVB - * Add auto rate parameter in registry. - * - * 10 25 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * add option for enable/disable TX PWR gain adjustment (default: off) - * - * 10 18 2010 cp.wu - * [WCXRP00000117] [MT6620 Wi-Fi][Driver] Add logic for suspending driver when MT6620 is not responding anymore - * 1. when wlanAdapterStop() failed to send POWER CTRL command to firmware, do not poll for ready bit dis-assertion - * 2. shorten polling count for shorter response time - * 3. if bad I/O operation is detected during TX resource polling, then further operation is aborted as well - * - * 10 18 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android - * complete implementation of Android NVRAM access - * - * 10 15 2010 cp.wu - * [WCXRP00000103] [MT6620 Wi-Fi][Driver] Driver crashed when using WZC to connect to AP#B with connection with AP#A - * bugfix: always reset pointer to IEbuf to zero when keeping scanning result for the connected AP - * - * 10 08 2010 cp.wu - * [WCXRP00000084] [MT6620 Wi-Fi][Driver][FW] Add fixed rate support for distance test - * adding fixed rate support for distance test. (from registry setting) - * - * 10 07 2010 cp.wu - * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection - * add firmware download for MT5931. - * - * 10 06 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * divide a single function into 2 part to surpress a weird compiler warning from gcc-4.4.0 - * - * 10 06 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * code reorganization to improve isolation between GLUE and CORE layers. - * - * 10 05 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * load manufacture data when CFG_SUPPORT_NVRAM is set to 1 - * - * 10 04 2010 cp.wu - * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by ENUM_NETWORK_TYPE_INDEX_T only - * remove ENUM_NETWORK_TYPE_T definitions - * - * 09 29 2010 wh.su - * [WCXRP00000072] [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue - * [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue. - * - * 09 24 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * eliminate unused variables which lead gcc to argue - * - * 09 24 2010 cp.wu - * [WCXRP00000057] [MT6620 Wi-Fi][Driver] Modify online scan to a run-time switchable feature - * Modify online scan as a run-time adjustable option (for Windows, in registry) - * - * 09 23 2010 cp.wu - * [WCXRP00000051] [MT6620 Wi-Fi][Driver] WHQL test fail in MAC address changed item - * use firmware reported mac address right after wlanAdapterStart() as permanent address - * - * 09 23 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * eliminate reference of CFG_RESPONSE_MAX_PKT_SIZE - * - * 09 21 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * Do a complete reset with STA-REC null checking for RF test re-entry - * - * 09 21 2010 kevin.huang - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * Eliminate Linux Compile Warning - * - * 09 13 2010 cp.wu - * NULL - * acquire & release power control in oid handing wrapper. - * - * 09 09 2010 cp.wu - * NULL - * move IE to buffer head when the IE pointer is not pointed at head. - * - * 09 08 2010 cp.wu - * NULL - * use static memory pool for storing IEs of scanning result. - * - * 09 01 2010 cp.wu - * NULL - * HIFSYS Clock Source Workaround - * - * 09 01 2010 wh.su - * NULL - * adding the wapi support for integration test. - * - * 09 01 2010 cp.wu - * NULL - * move HIF CR initialization from where after sdioSetupCardFeature() to wlanAdapterStart() - * - * 08 30 2010 cp.wu - * NULL - * eliminate klockwork errors - * - * 08 26 2010 yuche.tsai - * NULL - * Add AT GO test configure mode under WinXP. - * Please enable 1. CFG_ENABLE_WIFI_DIRECT, 2. CFG_TEST_WIFI_DIRECT_GO, 3. CFG_SUPPORT_AAA - * - * 08 25 2010 george.huang - * NULL - * update OID/ registry control path for PM related settings - * - * 08 24 2010 cp.wu - * NULL - * 1) initialize variable for enabling short premable/short time slot. - * 2) add compile option for disabling online scan - * - * 08 13 2010 cp.wu - * NULL - * correction issue: desired phy type not initialized as ABGN mode. - * - * 08 12 2010 cp.wu - * NULL - * [AIS-FSM] honor registry setting for adhoc running mode. (A/B/G) - * - * 08 10 2010 cm.chang - * NULL - * Support EEPROM read/write in RF test mode - * - * 08 03 2010 cp.wu - * NULL - * surpress compilation warning. - * - * 08 03 2010 cp.wu - * NULL - * Centralize mgmt/system service procedures into independent calls. - * - * 07 30 2010 cp.wu - * NULL - * 1) BoW wrapper: use definitions instead of hard-coded constant for error code - * 2) AIS-FSM: eliminate use of desired RF parameters, use prTargetBssDesc instead - * 3) add handling for RX_PKT_DESTINATION_HOST_WITH_FORWARD for GO-broadcast frames - * - * 07 29 2010 cp.wu - * NULL - * eliminate u4FreqInKHz usage, combined into rConnections.ucAdHoc* - * - * 07 28 2010 cp.wu - * NULL - * 1) eliminate redundant variable eOPMode in prAdapter->rWlanInfo - * 2) change nicMediaStateChange() API prototype - * - * 07 21 2010 cp.wu - * - * 1) change BG_SCAN to ONLINE_SCAN for consistent term - * 2) only clear scanning result when scan is permitted to do - * - * 07 19 2010 cm.chang - * - * Set RLM parameters and enable CNM channel manager - * - * 07 19 2010 jeffrey.chang - * - * Linux port modification - * - * 07 13 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * Reduce unnecessary type casting - * - * 07 13 2010 cp.wu - * - * use multiple queues to keep 1x/MMPDU/CMD's strict order even when there is incoming 1x frames. - * - * 07 13 2010 cp.wu - * - * 1) MMPDUs are now sent to MT6620 by CMD queue for keeping strict order of 1X/MMPDU/CMD packets - * 2) integrate with qmGetFrameAction() for deciding which MMPDU/1X could pass checking for sending - * 2) enhance CMD_INFO_T descriptor number from 10 to 32 to avoid descriptor underflow under concurrent network operation - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 05 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) ignore RSN checking when RSN is not turned on. - * 2) set STA-REC deactivation callback as NULL - * 3) add variable initialization API based on PHY configuration - * - * 07 02 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) for event packet, no need to fill RFB. - * 2) when wlanAdapterStart() failed, no need to initialize state machines - * 3) after Beacon/ProbeResp parsing, corresponding BSS_DESC_T should be marked as IE-parsed - * - * 07 01 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Support sync command of STA_REC - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add scan uninitialization procedure - * - * 06 25 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add API in que_mgt to retrieve sta-rec index for security frames. - * - * 06 24 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 802.1x and bluetooth-over-Wi-Fi security frames are now delievered to firmware via command path instead of data path. - * - * 06 23 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Merge g_arStaRec[] into adapter->arStaRec[] - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * initialize mbox & ais_fsm in wlanAdapterStart() - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * change MAC address updating logic. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * simplify timer usage. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) eliminate CFG_CMD_EVENT_VERSION_0_9 - * 2) when disconnected, indicate nic directly (no event is needed) - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * cnm_timer has been migrated. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 28 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * disable interrupt then send power control command packet. - * - * 05 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) when stopping adapter, wait til RDY bit has been cleaerd. - * 2) set TASK_OFFLOAD as driver-core OIDs - * - * 05 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS - * 2) buffer statistics data for 2 seconds - * 3) use default value for adhoc parameters instead of 0 - * - * 05 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) do not take timeout mechanism for power mode oids - * 2) retrieve network type from connection status - * 3) after disassciation, set radio state to off - * 4) TCP option over IPv6 is supported - * - * 05 17 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add CFG_STARTUP_DEBUG for debugging starting up issue. - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * 1) add timeout handler mechanism for pending command packets - * 2) add p2p add/removal key - * - * 04 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * surpress compiler warning - * - * 04 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * roll-back to rev.60. - * - * 04 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) remove redundant firmware image unloading - * 2) use compile-time macros to separate logic related to accquiring own - * - * 04 16 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * treat BUS access failure as kind of card removal. - * - * 04 14 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * always set fw-own before driver is unloaded. - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * 2) command sequence number is now increased atomically - * * * 3) private data could be hold and taken use for other purpose - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * finish non-glue layer access to glue variables - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * rWlanInfo should be placed at adapter rather than glue due to most operations - * are done in adapter layer. - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * ePowerCtrl is not necessary as a glue variable. - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * add timeout check in the kalOidComplete - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * improve none-glue code portability - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * improve none-glue code portability - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * code refine: fgTestMode should be at adapter rather than glue due to the device/fw is also involved - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) for some OID, never do timeout expiration - * 2) add 2 kal API for later integration - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) eliminate unused definitions - * 2) ready bit will be polled for limited iteration - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * kalOidComplete is not necessary in linux - * - * 04 01 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * change to use pass-in prRegInfo instead of accessing prGlueInfo directly - * - * 04 01 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * change to use WIFI_TCM_ALWAYS_ON as firmware image - * - * 04 01 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * . - * - * 03 31 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * modify the wapi related code for new driver's design. - * - * 03 30 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * adding none-glue code portability - * - * 03 30 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * adding non-glue code portability - * - * 03 29 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * improve non-glue code portability - * - * 03 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * firmware download load adress & start address are now configured from config.h - * due to the different configurations on FPGA and ASIC - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * [WPD00003826] Initial import for Linux port - * initial import for Linux port - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port - * - * 03 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * only send CMD_NIC_POWER_CTRL in wlanAdapterStop() when card is not removed and is not in D3 state - * - * 03 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * always send CMD_NIC_POWER_CTRL packet when nic is being halted - * - * 03 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) add ACPI D0/D3 state switching support - * 2) use more formal way to handle interrupt when the status is retrieved from enhanced RX response - * -* 03 12 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add two option for ACK and ENCRYPTION for firmware download - * - * 03 11 2010 cp.wu - * [WPD00003821][BUG] Host driver stops processing RX packets from HIF RX0 - * add RX starvation warning debug message controlled by CFG_HIF_RX_STARVATION_WARNING - * - * 03 08 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) add another spin-lock to protect MsduInfoList due to it might be accessed by different thread. - * 2) change own-back acquiring procedure to wait for up to 16.67 seconds - * - * 03 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * when starting adapter, read local adminsitrated address from registry and send to firmware via CMD_BASIC_CONFIG. - * - * 03 02 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) the use of prPendingOid revised, all accessing are now protected by spin lock - * 2) ensure wlanReleasePendingOid will clear all command queues - * - * 03 02 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add mutex to avoid multiple access to qmTxQueue simultaneously. - * - * 03 01 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add command/event definitions for initial states - * - * 02 24 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Added code for QM_TEST_MODE - * - * 02 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct function name .. - * - * 02 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * separate wlanProcesQueuePacket() into 2 APIs upon request - * - * 02 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add new API: wlanProcessQueuedPackets() - * - * 02 11 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct wlanAdapterStart - * - * 02 11 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. add logic for firmware download - * 2. firmware image filename and start/load address are now retrieved from registry - * - * 02 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement host-side firmware download logic - * - * 02 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) remove unused function in nic_rx.c [which has been handled in que_mgt.c] - * 2) firmware image length is now retrieved via NdisFileOpen - * 3) firmware image is not structured by (P_IMG_SEC_HDR_T) anymore - * 4) nicRxWaitResponse() revised - * 5) another set of TQ counter default value is added for fw-download state - * 6) Wi-Fi load address is now retrieved from registry too - * - * 02 09 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address - * 2. follow MSDN defined behavior when associates to another AP - * 3. for firmware download, packet size could be up to 2048 bytes - * - * 02 08 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * prepare for implementing fw download logic - * - * 02 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * wlanoidSetFrequency is now implemented by RF test command. - * - * 02 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * QueryRssi is no longer w/o hardware access, it is now implemented by command/event handling loop - * - * 02 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. clear prPendingCmdInfo properly - * 2. while allocating memory for cmdinfo, no need to add extra 4 bytes. - * - * 01 28 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * allow MCR read/write OIDs in RF test mode - * - * 01 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) implement timeout mechanism when OID is pending for longer than 1 second - * 2) allow OID_802_11_CONFIGURATION to be executed when RF test mode is turned on - * - * 01 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. eliminate improper variable in rHifInfo - * 2. block TX/ordinary OID when RF test mode is engaged - * 3. wait until firmware finish operation when entering into and leaving from RF test mode - * 4. correct some HAL implementation - * - * 01 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Under WinXP with SDIO, use prGlueInfo->rHifInfo.pvInformationBuffer instead of prGlueInfo->pvInformationBuffer -** \main\maintrunk.MT6620WiFiDriver_Prj\36 2009-12-10 16:54:36 GMT mtk02752 -** code clean -** \main\maintrunk.MT6620WiFiDriver_Prj\35 2009-12-09 20:04:59 GMT mtk02752 -** only report as connected when CFG_HIF_EMULATION_TEST is set to 1 -** \main\maintrunk.MT6620WiFiDriver_Prj\34 2009-12-08 17:39:41 GMT mtk02752 -** wlanoidRftestQueryAutoTest could be executed without touching hardware -** \main\maintrunk.MT6620WiFiDriver_Prj\33 2009-12-03 16:10:26 GMT mtk01461 -** Add debug message -** \main\maintrunk.MT6620WiFiDriver_Prj\32 2009-12-02 22:05:33 GMT mtk02752 -** kalOidComplete() will decrease i4OidPendingCount -** \main\maintrunk.MT6620WiFiDriver_Prj\31 2009-12-01 23:02:36 GMT mtk02752 -** remove unnecessary spinlock -** \main\maintrunk.MT6620WiFiDriver_Prj\30 2009-12-01 22:50:38 GMT mtk02752 -** use TC4 for command, maintein i4OidPendingCount -** \main\maintrunk.MT6620WiFiDriver_Prj\29 2009-11-27 12:45:34 GMT mtk02752 -** prCmdInfo should be freed when invoking wlanReleasePendingOid() to clear pending oid -** \main\maintrunk.MT6620WiFiDriver_Prj\28 2009-11-24 19:55:51 GMT mtk02752 -** wlanSendPacket & wlanRetransmitOfPendingFrames is only used in old data path -** \main\maintrunk.MT6620WiFiDriver_Prj\27 2009-11-23 17:59:55 GMT mtk02752 -** clear prPendingOID inside wlanSendCommand() when the OID didn't need to be replied. -** \main\maintrunk.MT6620WiFiDriver_Prj\26 2009-11-23 14:45:29 GMT mtk02752 -** add another version of wlanSendCommand() for command-sending only without blocking for response -** \main\maintrunk.MT6620WiFiDriver_Prj\25 2009-11-17 22:40:44 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\24 2009-11-11 10:14:56 GMT mtk01084 -** modify place to invoke wlanIst -** \main\maintrunk.MT6620WiFiDriver_Prj\23 2009-10-30 18:17:07 GMT mtk01084 -** fix compiler warning -** \main\maintrunk.MT6620WiFiDriver_Prj\22 2009-10-29 19:46:15 GMT mtk01084 -** invoke interrupt process routine -** \main\maintrunk.MT6620WiFiDriver_Prj\21 2009-10-13 21:58:24 GMT mtk01084 -** modify for new HW architecture -** \main\maintrunk.MT6620WiFiDriver_Prj\20 2009-09-09 17:26:01 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\19 2009-05-20 12:21:27 GMT mtk01461 -** Add SeqNum check when process Event Packet -** \main\maintrunk.MT6620WiFiDriver_Prj\18 2009-05-19 10:38:44 GMT mtk01461 -** Add wlanReleasePendingOid() for mpReset() if there is a pending OID and no available TX resource to send it. -** \main\maintrunk.MT6620WiFiDriver_Prj\17 2009-04-29 15:41:34 GMT mtk01461 -** Add handle of EVENT of CMD Result in wlanSendCommand() -** \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-04-22 09:11:23 GMT mtk01461 -** Fix wlanSendCommand() for Driver Domain CR -** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-04-21 09:33:56 GMT mtk01461 -** Update wlanSendCommand() for Driver Domain Response and handle Event Packet, wlanQuery/SetInformation() for enqueue CMD_INFO_T -** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-04-17 20:00:08 GMT mtk01461 -** Update wlanImageSectionDownload for optimized CMD process -** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-04-14 20:50:51 GMT mtk01426 -** Fixed compile error -** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-04-13 16:38:40 GMT mtk01084 -** add wifi start function -** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-04-13 14:26:44 GMT mtk01084 -** modify a parameter about FW download length -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-04-10 21:53:42 GMT mtk01461 -** Update wlanSendCommand() -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-04-08 16:51:04 GMT mtk01084 -** Update for the image download part -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-04-01 10:32:47 GMT mtk01461 -** Add wlanSendLeftClusteredFrames() for SDIO_TX_ENHANCE -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-03-23 21:44:13 GMT mtk01461 -** Refine TC assignment for WmmAssoc flag -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-03-23 16:51:57 GMT mtk01084 -** modify the input argument of caller to RECLAIM_POWER_CONTROL_TO_PM() -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-03-23 00:27:13 GMT mtk01461 -** Add reference code of FW Image Download -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-19 18:32:37 GMT mtk01084 -** update for basic power management functions -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-16 09:09:08 GMT mtk01461 -** Update TX PATH API -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 16:28:45 GMT mtk01426 -** Init develop -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" -#include "mgmt/ais_fsm.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -/* 6.1.1.2 Interpretation of priority parameter in MAC service primitives */ -/* Static convert the Priority Parameter/TID(User Priority/TS Identifier) to Traffic Class */ -const UINT_8 aucPriorityParam2TC[] = { - TC1_INDEX, - TC0_INDEX, - TC0_INDEX, - TC1_INDEX, - TC2_INDEX, - TC2_INDEX, - TC3_INDEX, - TC3_INDEX -}; - -#if QM_TEST_MODE -extern QUE_MGT_T g_rQM; -#endif -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef struct _CODE_MAPPING_T { - UINT_32 u4RegisterValue; - INT_32 u4TxpowerOffset; -} CODE_MAPPING_T, *P_CODE_MAPPING_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ -BOOLEAN fgIsBusAccessFailed = FALSE; - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#define SIGNED_EXTEND(n, _sValue) \ - (((_sValue) & BIT((n)-1)) ? ((_sValue) | BITS(n,31)) : \ - ((_sValue) & ~BITS(n,31))) - -// TODO: Check -/* OID set handlers without the need to access HW register */ -PFN_OID_HANDLER_FUNC apfnOidSetHandlerWOHwAccess[] = { - wlanoidSetChannel, - wlanoidSetBeaconInterval, - wlanoidSetAtimWindow, - wlanoidSetFrequency, -}; - -// TODO: Check -/* OID query handlers without the need to access HW register */ -PFN_OID_HANDLER_FUNC apfnOidQueryHandlerWOHwAccess[] = { - wlanoidQueryBssid, - wlanoidQuerySsid, - wlanoidQueryInfrastructureMode, - wlanoidQueryAuthMode, - wlanoidQueryEncryptionStatus, - wlanoidQueryPmkid, - wlanoidQueryNetworkTypeInUse, - wlanoidQueryBssidList, - wlanoidQueryAcpiDevicePowerState, - wlanoidQuerySupportedRates, - wlanoidQueryDesiredRates, - wlanoidQuery802dot11PowerSaveProfile, - wlanoidQueryBeaconInterval, - wlanoidQueryAtimWindow, - wlanoidQueryFrequency, -}; - -/* OID set handlers allowed in RF test mode */ -PFN_OID_HANDLER_FUNC apfnOidSetHandlerAllowedInRFTest[] = { - wlanoidRftestSetTestMode, - wlanoidRftestSetAbortTestMode, - wlanoidRftestSetAutoTest, - wlanoidSetMcrWrite, - wlanoidSetEepromWrite -}; - -/* OID query handlers allowed in RF test mode */ -PFN_OID_HANDLER_FUNC apfnOidQueryHandlerAllowedInRFTest[] = { - wlanoidRftestQueryAutoTest, - wlanoidQueryMcrRead, - wlanoidQueryEepromRead -} -; - -PFN_OID_HANDLER_FUNC apfnOidWOTimeoutCheck[] = { - wlanoidRftestSetTestMode, - wlanoidRftestSetAbortTestMode, - wlanoidSetAcpiDevicePowerState, -}; - - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is a private routine, which is used to check if HW access is needed -* for the OID query/ set handlers. -* -* \param[IN] pfnOidHandler Pointer to the OID handler. -* \param[IN] fgSetInfo It is a Set information handler. -* -* \retval TRUE This function needs HW access -* \retval FALSE This function does not need HW access -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wlanIsHandlerNeedHwAccess ( - IN PFN_OID_HANDLER_FUNC pfnOidHandler, - IN BOOLEAN fgSetInfo - ) -{ - PFN_OID_HANDLER_FUNC* apfnOidHandlerWOHwAccess; - UINT_32 i; - UINT_32 u4NumOfElem; - - if (fgSetInfo) { - apfnOidHandlerWOHwAccess = apfnOidSetHandlerWOHwAccess; - u4NumOfElem = sizeof(apfnOidSetHandlerWOHwAccess) / sizeof(PFN_OID_HANDLER_FUNC); - } - else { - apfnOidHandlerWOHwAccess = apfnOidQueryHandlerWOHwAccess; - u4NumOfElem = sizeof(apfnOidQueryHandlerWOHwAccess) / sizeof(PFN_OID_HANDLER_FUNC); - } - - for (i = 0; i < u4NumOfElem; i++) { - if (apfnOidHandlerWOHwAccess[i] == pfnOidHandler) { - return FALSE; - } - } - - return TRUE; -} /* wlanIsHandlerNeedHwAccess */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set flag for later handling card -* ejected event. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* -* \return (none) -* -* \note When surprised removal happens, Glue layer should invoke this -* function to notify WPDD not to do any hw access. -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanCardEjected ( - IN P_ADAPTER_T prAdapter - ) -{ - DEBUGFUNC("wlanCardEjected"); - //INITLOG(("\n")); - - ASSERT(prAdapter); - - /* mark that the card is being ejected, NDIS will shut us down soon */ - nicTxRelease(prAdapter); - -} /* wlanCardEjected */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Create adapter object -* -* \param prAdapter This routine is call to allocate the driver software objects. -* If fails, return NULL. -* \retval NULL If it fails, NULL is returned. -* \retval NOT NULL If the adapter was initialized successfully. -*/ -/*----------------------------------------------------------------------------*/ -P_ADAPTER_T -wlanAdapterCreate ( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - P_ADAPTER_T prAdpater = (P_ADAPTER_T)NULL; - - DEBUGFUNC("wlanAdapterCreate"); - - do { - prAdpater = (P_ADAPTER_T) kalMemAlloc(sizeof(ADAPTER_T), VIR_MEM_TYPE); - - if (!prAdpater) { - DBGLOG(INIT, ERROR, ("Allocate ADAPTER memory ==> FAILED\n")); - break; - } - -#if QM_TEST_MODE - g_rQM.prAdapter = prAdpater; -#endif - kalMemZero(prAdpater, sizeof(ADAPTER_T)); - prAdpater->prGlueInfo = prGlueInfo; - - } while(FALSE); - - return prAdpater; -} /* wlanAdapterCreate */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Destroy adapter object -* -* \param prAdapter This routine is call to destroy the driver software objects. -* If fails, return NULL. -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanAdapterDestroy ( - IN P_ADAPTER_T prAdapter - ) -{ - - if (!prAdapter) { - return; - } - - kalMemFree(prAdapter, VIR_MEM_TYPE, sizeof(ADAPTER_T)); - - return; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Initialize the adapter. The sequence is -* 1. Disable interrupt -* 2. Read adapter configuration from EEPROM and registry, verify chip ID. -* 3. Create NIC Tx/Rx resource. -* 4. Initialize the chip -* 5. Initialize the protocol -* 6. Enable Interrupt -* -* \param prAdapter Pointer of Adapter Data Structure -* -* \retval WLAN_STATUS_SUCCESS: Success -* \retval WLAN_STATUS_FAILURE: Failed -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanAdapterStart ( - IN P_ADAPTER_T prAdapter, - IN P_REG_INFO_T prRegInfo, - IN PVOID pvFwImageMapFile, - IN UINT_32 u4FwImageFileLength - ) -{ - WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS; - UINT_32 i, u4Value = 0; - UINT_32 u4WHISR = 0; - UINT_8 aucTxCount[8]; -#if CFG_ENABLE_FW_DOWNLOAD - UINT_32 u4FwLoadAddr, u4ImgSecSize; - #if CFG_ENABLE_FW_DIVIDED_DOWNLOAD - UINT_32 j; - P_FIRMWARE_DIVIDED_DOWNLOAD_T prFwHead; - BOOLEAN fgValidHead; - const UINT_32 u4CRCOffset = offsetof(FIRMWARE_DIVIDED_DOWNLOAD_T, u4NumOfEntries); - #endif -#endif -#if (defined(MT5931) && (!CFG_SUPPORT_BCM_BWCS)) - PARAM_PTA_IPC_T rBwcsPta; - UINT_32 u4SetInfoLen; -#endif - - ASSERT(prAdapter); - - DEBUGFUNC("wlanAdapterStart"); - - //4 <0> Reset variables in ADAPTER_T - prAdapter->fgIsFwOwn = TRUE; - prAdapter->fgIsEnterD3ReqIssued = FALSE; - - QUEUE_INITIALIZE(&(prAdapter->rPendingCmdQueue)); - - /* Initialize rWlanInfo */ - kalMemSet(&(prAdapter->rWlanInfo), 0, sizeof(WLAN_INFO_T)); - - //4 <0.1> reset fgIsBusAccessFailed - fgIsBusAccessFailed = FALSE; - - do { - if ( (u4Status = nicAllocateAdapterMemory(prAdapter)) != WLAN_STATUS_SUCCESS ) { - DBGLOG(INIT, ERROR, ("nicAllocateAdapterMemory Error!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - - prAdapter->u4OsPacketFilter = PARAM_PACKET_FILTER_SUPPORTED; - -#if defined(MT6620) || defined(MT6628) - DBGLOG(INIT, TRACE, ("wlanAdapterStart(): Acquiring LP-OWN\n")); - ACQUIRE_POWER_CONTROL_FROM_PM(prAdapter); - #if !CFG_ENABLE_FULL_PM - nicpmSetDriverOwn(prAdapter); - #endif - - if(prAdapter->fgIsFwOwn == TRUE) { - DBGLOG(INIT, ERROR, ("nicpmSetDriverOwn() failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - - //4 <1> Initialize the Adapter - if ( (u4Status = nicInitializeAdapter(prAdapter)) != WLAN_STATUS_SUCCESS ) { - DBGLOG(INIT, ERROR, ("nicInitializeAdapter failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } -#endif - - //4 <2> Initialize System Service (MGMT Memory pool and STA_REC) - nicInitSystemService(prAdapter); - - //4 <3> Initialize Tx - nicTxInitialize(prAdapter); - wlanDefTxPowerCfg(prAdapter); - - //4 <4> Initialize Rx - nicRxInitialize(prAdapter); - -#if CFG_ENABLE_FW_DOWNLOAD - #if defined(MT6620) || defined(MT6628) - if (pvFwImageMapFile) { - /* 1. disable interrupt, download is done by polling mode only */ - nicDisableInterrupt(prAdapter); - - /* 2. Initialize Tx Resource to fw download state */ - nicTxInitResetResource(prAdapter); - - /* 3. FW download here */ - u4FwLoadAddr = prRegInfo->u4LoadAddress; - - #if CFG_ENABLE_FW_DIVIDED_DOWNLOAD - // 3a. parse file header for decision of divided firmware download or not - prFwHead = (P_FIRMWARE_DIVIDED_DOWNLOAD_T)pvFwImageMapFile; - - if(prFwHead->u4Signature == MTK_WIFI_SIGNATURE && - prFwHead->u4CRC == wlanCRC32((PUINT_8)pvFwImageMapFile + u4CRCOffset, u4FwImageFileLength - u4CRCOffset)) { - fgValidHead = TRUE; - } - else { - fgValidHead = FALSE; - } - - /* 3b. engage divided firmware downloading */ - if(fgValidHead == TRUE) { - for(i = 0 ; i < prFwHead->u4NumOfEntries ; i++) { - #if CFG_ENABLE_FW_DOWNLOAD_AGGREGATION - if(wlanImageSectionDownloadAggregated(prAdapter, - prFwHead->arSection[i].u4DestAddr, - prFwHead->arSection[i].u4Length, - (PUINT_8)pvFwImageMapFile + prFwHead->arSection[i].u4Offset) != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, ERROR, ("Firmware scatter download failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - } - #else - for(j = 0 ; j < prFwHead->arSection[i].u4Length ; j += CMD_PKT_SIZE_FOR_IMAGE) { - if(j + CMD_PKT_SIZE_FOR_IMAGE < prFwHead->arSection[i].u4Length) - u4ImgSecSize = CMD_PKT_SIZE_FOR_IMAGE; - else - u4ImgSecSize = prFwHead->arSection[i].u4Length - j; - - if(wlanImageSectionDownload(prAdapter, - prFwHead->arSection[i].u4DestAddr + j, - u4ImgSecSize, - (PUINT_8)pvFwImageMapFile + prFwHead->arSection[i].u4Offset + j) != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, ERROR, ("Firmware scatter download failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - } - #endif - - /* escape from loop if any pending error occurs */ - if(u4Status == WLAN_STATUS_FAILURE) { - break; - } - } - } - else - #endif - #if CFG_ENABLE_FW_DOWNLOAD_AGGREGATION - if(wlanImageSectionDownloadAggregated(prAdapter, - u4FwLoadAddr, - u4FwImageFileLength, - (PUINT_8)pvFwImageMapFile) != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, ERROR, ("Firmware scatter download failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - } - #else - for (i = 0; i < u4FwImageFileLength ; i += CMD_PKT_SIZE_FOR_IMAGE) { - if(i + CMD_PKT_SIZE_FOR_IMAGE < u4FwImageFileLength) - u4ImgSecSize = CMD_PKT_SIZE_FOR_IMAGE; - else - u4ImgSecSize = u4FwImageFileLength - i; - - if(wlanImageSectionDownload(prAdapter, - u4FwLoadAddr + i, - u4ImgSecSize, - (PUINT_8)pvFwImageMapFile + i) != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, ERROR, ("Firmware scatter download failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - } - #endif - - if(u4Status != WLAN_STATUS_SUCCESS) { - break; - } - - #if !CFG_ENABLE_FW_DOWNLOAD_ACK - // Send INIT_CMD_ID_QUERY_PENDING_ERROR command and wait for response - if(wlanImageQueryStatus(prAdapter) != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, ERROR, ("Firmware download failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - #endif - } - else { - DBGLOG(INIT, ERROR, ("No Firmware found!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - - /* 4. send Wi-Fi Start command */ - #if CFG_OVERRIDE_FW_START_ADDRESS - wlanConfigWifiFunc(prAdapter, - TRUE, - prRegInfo->u4StartAddress); - #else - wlanConfigWifiFunc(prAdapter, - FALSE, - 0); - #endif - #elif defined(MT5931) - if (pvFwImageMapFile) { - DBGLOG(INIT, TRACE, ("Download Address: 0x%08X\n", prRegInfo->u4LoadAddress)); - DBGLOG(INIT, TRACE, ("Firmware Length: 0x%08X\n", u4FwImageFileLength)); - - do { -#if CFG_SUPPORT_WHOLE_CHIP_RESET -#define RESET_RDY_INTERVAL (120) - - /* 1.0 whole-chip reset except HIFSYS */ - HAL_MCR_WR(prAdapter, MCR_WMCSR, WMCSR_CHIP_RST); - HAL_MCR_WR(prAdapter, MCR_WMCSR, 0); - - /* 1.0.1 delay for EEIF ready */ - kalMsleep(RESET_RDY_INTERVAL); -#endif - - /* 1.1 wait for INIT_RDY */ - i = 0; - while(1) { - HAL_MCR_RD(prAdapter, MCR_WMCSR, &u4Value); - - if (u4Value & WMCSR_INI_RDY) { - DBGLOG(INIT, TRACE, ("INIT-RDY detected\n")); - break; - } - else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - u4Status = WLAN_STATUS_FAILURE; - break; - } - else if(i >= CFG_RESPONSE_POLLING_TIMEOUT) { - DBGLOG(INIT, ERROR, ("Waiting for Init Ready bit: Timeout\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - else { - i++; - kalMsleep(10); - } - } - - if(u4Status != WLAN_STATUS_SUCCESS) { - break; - } - - /* 1.2 set KSEL/FLEN */ - HAL_MCR_WR(prAdapter, MCR_FWCFG, u4FwImageFileLength >> 6); - - /* 1.3 enable FWDL_EN */ - HAL_MCR_WR(prAdapter, MCR_WMCSR, WMCSR_FWDLEN); - - /* 1.4 wait for PLL_RDY */ - i = 0; - while(1) { - HAL_MCR_RD(prAdapter, MCR_WMCSR, &u4Value); - - if (u4Value & WMCSR_PLLRDY) { - DBGLOG(INIT, TRACE, ("PLL-RDY detected\n")); - break; - } - else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - u4Status = WLAN_STATUS_FAILURE; - break; - } - else if(i >= CFG_RESPONSE_POLLING_TIMEOUT) { - DBGLOG(INIT, ERROR, ("Waiting for PLL Ready bit: Timeout\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - else { - i++; - kalMsleep(10); - } - } - - if(u4Status != WLAN_STATUS_SUCCESS) { - break; - } - - /* 2.1 turn on HIFSYS firmware download mode */ - HAL_MCR_WR(prAdapter, MCR_FWDLSR, FWDLSR_FWDL_MODE); - - /* 2.2 set starting address */ - u4FwLoadAddr = prRegInfo->u4LoadAddress; - HAL_MCR_WR(prAdapter, MCR_FWDLDSAR, u4FwLoadAddr); - - /* 3. upload firmware */ - for (i = 0; i < u4FwImageFileLength ; i += CMD_PKT_SIZE_FOR_IMAGE) { - if(i + CMD_PKT_SIZE_FOR_IMAGE < u4FwImageFileLength) - u4ImgSecSize = CMD_PKT_SIZE_FOR_IMAGE; - else - u4ImgSecSize = u4FwImageFileLength - i; - - if(wlanImageSectionDownload(prAdapter, - u4FwLoadAddr + i, - u4ImgSecSize, - (PUINT_8)pvFwImageMapFile + i) != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, ERROR, ("Firmware scatter download failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - } - - if(u4Status != WLAN_STATUS_SUCCESS) { - break; - } - - /* 4.1 poll FWDL_OK & FWDL_FAIL bits */ - i = 0; - while(1) { - HAL_MCR_RD(prAdapter, MCR_WMCSR, &u4Value); - - if (u4Value & WMCSR_DL_OK) { - DBGLOG(INIT, TRACE, ("DL_OK detected\n")); - break; - } - else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE - || (u4Value & WMCSR_DL_FAIL)) { - DBGLOG(INIT, ERROR, ("DL_FAIL detected: 0x%08X\n", u4Value)); - u4Status = WLAN_STATUS_FAILURE; - break; - } - else if(i >= CFG_RESPONSE_POLLING_TIMEOUT) { - DBGLOG(INIT, ERROR, ("Waiting for DL_OK/DL_FAIL bit: Timeout\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - else { - i++; - kalMsleep(10); - } - } - - if(u4Status != WLAN_STATUS_SUCCESS) { - break; - } - - /* 4.2 turn off HIFSYS download mode */ - HAL_MCR_WR(prAdapter, MCR_FWDLSR, 0); - - } while (FALSE); - - if(u4Status != WLAN_STATUS_SUCCESS) { - break; - } - - /* 5. disable interrupt */ - nicDisableInterrupt(prAdapter); - } - else { - DBGLOG(INIT, ERROR, ("No Firmware found!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - #endif -#endif - - DBGLOG(INIT, TRACE, ("wlanAdapterStart(): Waiting for Ready bit..\n")); - //4 <5> check Wi-Fi FW asserts ready bit - i = 0; - while(1) { - HAL_MCR_RD(prAdapter, MCR_WCIR, &u4Value); - - if (u4Value & WCIR_WLAN_READY) { - DBGLOG(INIT, TRACE, ("Ready bit asserted\n")); - break; - } - else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - u4Status = WLAN_STATUS_FAILURE; - break; - } - else if(i >= CFG_RESPONSE_POLLING_TIMEOUT) { - UINT_32 u4MailBox0; - - nicGetMailbox(prAdapter, 0, &u4MailBox0); - DBGLOG(INIT, ERROR, ("Waiting for Ready bit: Timeout, ID=%d\n", - (u4MailBox0 & 0x0000FFFF))); - u4Status = WLAN_STATUS_FAILURE; - break; - } - else { - i++; - kalMsleep(10); - } - } - -#if defined(MT5931) - // Acquire LP-OWN - DBGLOG(INIT, TRACE, ("wlanAdapterStart(): Acquiring LP-OWN\n")); - ACQUIRE_POWER_CONTROL_FROM_PM(prAdapter); - #if !CFG_ENABLE_FULL_PM - nicpmSetDriverOwn(prAdapter); - #endif - - if(prAdapter->fgIsFwOwn == TRUE) { - DBGLOG(INIT, ERROR, ("nicpmSetDriverOwn() failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - - //4 <1> Initialize the Adapter - if ( (u4Status = nicInitializeAdapter(prAdapter)) != WLAN_STATUS_SUCCESS ) { - DBGLOG(INIT, ERROR, ("nicInitializeAdapter failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - - /* post initialization for MT5931 due to some CR is only accessible after driver own */ - nicRxPostInitialize(prAdapter); -#endif - - if(u4Status == WLAN_STATUS_SUCCESS) { - // 1. reset interrupt status - HAL_READ_INTR_STATUS(prAdapter, 4, (PUINT_8)&u4WHISR); - if(HAL_IS_TX_DONE_INTR(u4WHISR)) { - HAL_READ_TX_RELEASED_COUNT(prAdapter, aucTxCount); - } - - /* 2. reset TX Resource for normal operation */ - nicTxResetResource(prAdapter); - -#if CFG_SUPPORT_OSC_SETTING && defined(MT5931) - wlanSetMcuOscStableTime(prAdapter, 0); -#endif - - /* 3. query for permanent address by polling */ - wlanQueryPermanentAddress(prAdapter); - -#if (CFG_SUPPORT_NIC_CAPABILITY == 1) - /* 4. query for NIC capability */ - wlanQueryNicCapability(prAdapter); -#endif - - /* 5. Override network address */ - wlanUpdateNetworkAddress(prAdapter); - - /* 6. indicate disconnection as default status */ - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_DISCONNECT, - NULL, - 0); - } - - RECLAIM_POWER_CONTROL_TO_PM(prAdapter, FALSE); - - if(u4Status != WLAN_STATUS_SUCCESS) { - break; - } - - /* OID timeout timer initialize */ - cnmTimerInitTimer(prAdapter, - &prAdapter->rOidTimeoutTimer, - (PFN_MGMT_TIMEOUT_FUNC)wlanReleasePendingOid, - (UINT_32)NULL); - - /* Power state initialization */ - prAdapter->fgWiFiInSleepyState = FALSE; - prAdapter->rAcpiState = ACPI_STATE_D0; - - /* Online scan option */ - if(prRegInfo->fgDisOnlineScan == 0) { - prAdapter->fgEnOnlineScan = TRUE; - } - else { - prAdapter->fgEnOnlineScan = FALSE; - } - - /* Beacon lost detection option */ - if(prRegInfo->fgDisBcnLostDetection != 0) { - prAdapter->fgDisBcnLostDetection = TRUE; - } - - /* Load compile time constant */ - prAdapter->rWlanInfo.u2BeaconPeriod = CFG_INIT_ADHOC_BEACON_INTERVAL; - prAdapter->rWlanInfo.u2AtimWindow = CFG_INIT_ADHOC_ATIM_WINDOW; - -#if 1// set PM parameters - prAdapter->fgEnArpFilter = prRegInfo->fgEnArpFilter; - prAdapter->u4PsCurrentMeasureEn = prRegInfo->u4PsCurrentMeasureEn; - - prAdapter->u4UapsdAcBmp = prRegInfo->u4UapsdAcBmp; - - prAdapter->u4MaxSpLen = prRegInfo->u4MaxSpLen; - - DBGLOG(INIT, TRACE, ("[1] fgEnArpFilter:0x%x, u4UapsdAcBmp:0x%x, u4MaxSpLen:0x%x", - prAdapter->fgEnArpFilter, - prAdapter->u4UapsdAcBmp, - prAdapter->u4MaxSpLen)); - - prAdapter->fgEnCtiaPowerMode = FALSE; - -#endif - - /* MGMT Initialization */ - nicInitMGMT(prAdapter, prRegInfo); - - /* Enable WZC Disassociation */ - prAdapter->rWifiVar.fgSupportWZCDisassociation = TRUE; - - /* Apply Rate Setting */ - if((ENUM_REGISTRY_FIXED_RATE_T)(prRegInfo->u4FixedRate) < FIXED_RATE_NUM) { - prAdapter->rWifiVar.eRateSetting = (ENUM_REGISTRY_FIXED_RATE_T)(prRegInfo->u4FixedRate); - } - else { - prAdapter->rWifiVar.eRateSetting = FIXED_RATE_NONE; - } - - if(prAdapter->rWifiVar.eRateSetting == FIXED_RATE_NONE) { - /* Enable Auto (Long/Short) Preamble */ - prAdapter->rWifiVar.ePreambleType = PREAMBLE_TYPE_AUTO; - } - else if((prAdapter->rWifiVar.eRateSetting >= FIXED_RATE_MCS0_20M_400NS && - prAdapter->rWifiVar.eRateSetting <= FIXED_RATE_MCS7_20M_400NS) - || (prAdapter->rWifiVar.eRateSetting >= FIXED_RATE_MCS0_40M_400NS && - prAdapter->rWifiVar.eRateSetting <= FIXED_RATE_MCS32_400NS)) { - /* Force Short Preamble */ - prAdapter->rWifiVar.ePreambleType = PREAMBLE_TYPE_SHORT; - } - else { - /* Force Long Preamble */ - prAdapter->rWifiVar.ePreambleType = PREAMBLE_TYPE_LONG; - } - - /* Disable Hidden SSID Join */ - prAdapter->rWifiVar.fgEnableJoinToHiddenSSID = FALSE; - - /* Enable Short Slot Time */ - prAdapter->rWifiVar.fgIsShortSlotTimeOptionEnable = TRUE; - - /* configure available PHY type set */ - nicSetAvailablePhyTypeSet(prAdapter); - -#if 1// set PM parameters - { -#if CFG_SUPPORT_PWR_MGT - prAdapter->u4PowerMode = prRegInfo->u4PowerMode; - prAdapter->rWlanInfo.arPowerSaveMode[NETWORK_TYPE_P2P_INDEX].ucNetTypeIndex = NETWORK_TYPE_P2P_INDEX; - prAdapter->rWlanInfo.arPowerSaveMode[NETWORK_TYPE_P2P_INDEX].ucPsProfile = ENUM_PSP_FAST_SWITCH; -#else - prAdapter->u4PowerMode = ENUM_PSP_CONTINUOUS_ACTIVE; -#endif - {/*CR:WCNAE00007101*/ - struct net_device *prDev = prAdapter->prGlueInfo->prDevHandler; - - if (prDev != NULL) { - glBusSetIrq(prDev, NULL, prAdapter->prGlueInfo ); - } - else { - printk(KERN_INFO "Skip glBusSetIrq because of the prDev\n"); - } - } - nicConfigPowerSaveProfile( - prAdapter, - NETWORK_TYPE_AIS_INDEX, //FIXIT - prAdapter->u4PowerMode, - FALSE); - } - -#endif - -#if CFG_SUPPORT_NVRAM - /* load manufacture data */ - wlanLoadManufactureData(prAdapter, prRegInfo); -#endif - -#if (defined(MT5931) && (!CFG_SUPPORT_BCM_BWCS)) - //Enable DPD calibration. - rBwcsPta.u.aucBTPParams[0] = 0x00; - rBwcsPta.u.aucBTPParams[1] = 0x01; - rBwcsPta.u.aucBTPParams[2] = 0x00; - rBwcsPta.u.aucBTPParams[3] = 0x80; - - wlanoidSetBT(prAdapter, - (PVOID)&rBwcsPta, - sizeof(PARAM_PTA_IPC_T), - &u4SetInfoLen); -#endif - -#if 0 - /* Update Auto rate parameters in FW */ - nicRlmArUpdateParms(prAdapter, - prRegInfo->u4ArSysParam0, - prRegInfo->u4ArSysParam1, - prRegInfo->u4ArSysParam2, - prRegInfo->u4ArSysParam3); -#endif - - -#if (MT6620_E1_ASIC_HIFSYS_WORKAROUND == 1) - /* clock gating workaround */ - prAdapter->fgIsClockGatingEnabled = FALSE; -#endif - - } while(FALSE); - - if(u4Status == WLAN_STATUS_SUCCESS) { - // restore to hardware default - HAL_SET_INTR_STATUS_READ_CLEAR(prAdapter); - HAL_SET_MAILBOX_READ_CLEAR(prAdapter, FALSE); - - /* Enable interrupt */ - nicEnableInterrupt(prAdapter); - - } - else { - // release allocated memory - nicReleaseAdapterMemory(prAdapter); - } - - return u4Status; -} /* wlanAdapterStart */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Uninitialize the adapter -* -* \param prAdapter Pointer of Adapter Data Structure -* -* \retval WLAN_STATUS_SUCCESS: Success -* \retval WLAN_STATUS_FAILURE: Failed -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanAdapterStop ( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 i, u4Value = 0; - WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS; - - ASSERT(prAdapter); - -#if (MT6620_E1_ASIC_HIFSYS_WORKAROUND == 1) - if(prAdapter->fgIsClockGatingEnabled == TRUE) { - nicDisableClockGating(prAdapter); - } -#endif - - /* MGMT - unitialization */ - nicUninitMGMT(prAdapter); - - if(prAdapter->rAcpiState == ACPI_STATE_D0 && -#if (CFG_CHIP_RESET_SUPPORT == 1) - kalIsResetting() == FALSE && -#endif - kalIsCardRemoved(prAdapter->prGlueInfo) == FALSE) { - - /* 0. Disable interrupt, this can be done without Driver own */ - nicDisableInterrupt(prAdapter); - - ACQUIRE_POWER_CONTROL_FROM_PM(prAdapter); - - /* 1. Set CMD to FW to tell WIFI to stop (enter power off state) */ - if(prAdapter->fgIsFwOwn == FALSE && - wlanSendNicPowerCtrlCmd(prAdapter, 1) == WLAN_STATUS_SUCCESS) { - /* 2. Clear pending interrupt */ - i = 0; - while(i < CFG_IST_LOOP_COUNT && nicProcessIST(prAdapter) != WLAN_STATUS_NOT_INDICATING) { - i++; - }; - - /* 3. Wait til RDY bit has been cleaerd */ - i = 0; - while(1) { - HAL_MCR_RD(prAdapter, MCR_WCIR, &u4Value); - - if ((u4Value & WCIR_WLAN_READY) == 0) - break; - else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE - || i >= CFG_RESPONSE_POLLING_TIMEOUT) { - break; - } - else { - i++; - kalMsleep(10); - } - } - } - - /* 4. Set Onwership to F/W */ - nicpmSetFWOwn(prAdapter, FALSE); - -#if CFG_FORCE_RESET_UNDER_BUS_ERROR - if(HAL_TEST_FLAG(prAdapter, ADAPTER_FLAG_HW_ERR) == TRUE) { - /* force acquire firmware own */ - kalDevRegWrite(prAdapter->prGlueInfo, MCR_WHLPCR, WHLPCR_FW_OWN_REQ_CLR); - - /* delay for 10ms */ - kalMdelay(10); - - /* force firmware reset via software interrupt */ - kalDevRegWrite(prAdapter->prGlueInfo, MCR_WSICR, WSICR_H2D_SW_INT_SET); - - /* force release firmware own */ - kalDevRegWrite(prAdapter->prGlueInfo, MCR_WHLPCR, WHLPCR_FW_OWN_REQ_SET); - } -#endif - - RECLAIM_POWER_CONTROL_TO_PM(prAdapter, FALSE); - } - - nicRxUninitialize(prAdapter); - - nicTxRelease(prAdapter); - - /* System Service Uninitialization */ - nicUninitSystemService(prAdapter); - - nicReleaseAdapterMemory(prAdapter); - -#if defined(_HIF_SPI) - /* Note: restore the SPI Mode Select from 32 bit to default */ - nicRestoreSpiDefMode(prAdapter); -#endif - - return u4Status; -} /* wlanAdapterStop */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is called by ISR (interrupt). -* -* \param prAdapter Pointer of Adapter Data Structure -* -* \retval TRUE: NIC's interrupt -* \retval FALSE: Not NIC's interrupt -*/ -/*----------------------------------------------------------------------------*/ -BOOL -wlanISR ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgGlobalIntrCtrl - ) -{ - ASSERT(prAdapter); - - if (fgGlobalIntrCtrl) { - nicDisableInterrupt(prAdapter); - - //wlanIST(prAdapter); - } - - return TRUE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is called by IST (task_let). -* -* \param prAdapter Pointer of Adapter Data Structure -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanIST ( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - ACQUIRE_POWER_CONTROL_FROM_PM(prAdapter); - - nicProcessIST(prAdapter); - - nicEnableInterrupt(prAdapter); - - RECLAIM_POWER_CONTROL_TO_PM(prAdapter, FALSE); - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will check command queue to find out if any could be dequeued -* and/or send to HIF to MT6620 -* -* \param prAdapter Pointer of Adapter Data Structure -* \param prCmdQue Pointer of Command Queue (in Glue Layer) -* -* \retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanProcessCommandQueue ( - IN P_ADAPTER_T prAdapter, - IN P_QUE_T prCmdQue - ) -{ - WLAN_STATUS rStatus; - QUE_T rTempCmdQue, rMergeCmdQue, rStandInCmdQue; - P_QUE_T prTempCmdQue, prMergeCmdQue, prStandInCmdQue; - P_QUE_ENTRY_T prQueueEntry; - P_CMD_INFO_T prCmdInfo; - P_MSDU_INFO_T prMsduInfo; - ENUM_FRAME_ACTION_T eFrameAction = FRAME_ACTION_DROP_PKT; - - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - ASSERT(prCmdQue); - - prTempCmdQue = &rTempCmdQue; - prMergeCmdQue = &rMergeCmdQue; - prStandInCmdQue = &rStandInCmdQue; - - QUEUE_INITIALIZE(prTempCmdQue); - QUEUE_INITIALIZE(prMergeCmdQue); - QUEUE_INITIALIZE(prStandInCmdQue); - - //4 <1> Move whole list of CMD_INFO to temp queue - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_QUE); - QUEUE_MOVE_ALL(prTempCmdQue, prCmdQue); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_QUE); - - //4 <2> Dequeue from head and check it is able to be sent - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - while(prQueueEntry) { - prCmdInfo = (P_CMD_INFO_T)prQueueEntry; - - switch(prCmdInfo->eCmdType) { - case COMMAND_TYPE_GENERAL_IOCTL: - case COMMAND_TYPE_NETWORK_IOCTL: - /* command packet will be always sent */ - eFrameAction = FRAME_ACTION_TX_PKT; - break; - - case COMMAND_TYPE_SECURITY_FRAME: - /* inquire with QM */ - eFrameAction = qmGetFrameAction(prAdapter, - prCmdInfo->eNetworkType, - prCmdInfo->ucStaRecIndex, - NULL, - FRAME_TYPE_802_1X); - break; - - case COMMAND_TYPE_MANAGEMENT_FRAME: - /* inquire with QM */ - prMsduInfo = (P_MSDU_INFO_T)(prCmdInfo->prPacket); - - eFrameAction = qmGetFrameAction(prAdapter, - prMsduInfo->ucNetworkType, - prMsduInfo->ucStaRecIndex, - prMsduInfo, - FRAME_TYPE_MMPDU); - break; - - default: - ASSERT(0); - break; - } - - //4 <3> handling upon dequeue result - if(eFrameAction == FRAME_ACTION_DROP_PKT) { - wlanReleaseCommand(prAdapter, prCmdInfo); - } - else if(eFrameAction == FRAME_ACTION_QUEUE_PKT) { - QUEUE_INSERT_TAIL(prMergeCmdQue, prQueueEntry); - } - else if(eFrameAction == FRAME_ACTION_TX_PKT) { - //4 <4> Send the command - rStatus = wlanSendCommand(prAdapter, prCmdInfo); - - if(rStatus == WLAN_STATUS_RESOURCES) { - // no more TC4 resource for further transmission - QUEUE_INSERT_TAIL(prMergeCmdQue, prQueueEntry); - break; - } - else if(rStatus == WLAN_STATUS_PENDING) { - // command packet which needs further handling upon response - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_PENDING); - QUEUE_INSERT_TAIL(&(prAdapter->rPendingCmdQueue), prQueueEntry); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_PENDING); - } - else { - P_CMD_INFO_T prCmdInfo = (P_CMD_INFO_T)prQueueEntry; - - if (rStatus == WLAN_STATUS_SUCCESS) { - if (prCmdInfo->pfCmdDoneHandler) { - prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo, prCmdInfo->pucInfoBuffer); - } - } - else { - if (prCmdInfo->fgIsOid) { - kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, prCmdInfo->u4SetInfoLen, rStatus); - } - } - - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - } - } - else { - ASSERT(0); - } - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - } - - //4 <3> Merge back to original queue - //4 <3.1> Merge prMergeCmdQue & prTempCmdQue - QUEUE_CONCATENATE_QUEUES(prMergeCmdQue, prTempCmdQue); - - //4 <3.2> Move prCmdQue to prStandInQue, due to prCmdQue might differ due to incoming 802.1X frames - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_QUE); - QUEUE_MOVE_ALL(prStandInCmdQue, prCmdQue); - - //4 <3.3> concatenate prStandInQue to prMergeCmdQue - QUEUE_CONCATENATE_QUEUES(prMergeCmdQue, prStandInCmdQue); - - //4 <3.4> then move prMergeCmdQue to prCmdQue - QUEUE_MOVE_ALL(prCmdQue, prMergeCmdQue); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_QUE); - - return WLAN_STATUS_SUCCESS; -} /* end of wlanProcessCommandQueue() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will take CMD_INFO_T which carry some informations of -* incoming OID and notify the NIC_TX to send CMD. -* -* \param prAdapter Pointer of Adapter Data Structure -* \param prCmdInfo Pointer of P_CMD_INFO_T -* -* \retval WLAN_STATUS_SUCCESS : CMD was written to HIF and be freed(CMD Done) immediately. -* \retval WLAN_STATUS_RESOURCE : No resource for current command, need to wait for previous -* frame finishing their transmission. -* \retval WLAN_STATUS_FAILURE : Get failure while access HIF or been rejected. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanSendCommand ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ) -{ - P_TX_CTRL_T prTxCtrl; - UINT_8 ucTC; /* "Traffic Class" SW(Driver) resource classification */ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - prTxCtrl = &prAdapter->rTxCtrl; - - //DbgPrint("wlanSendCommand()\n"); - // - // -#if DBG && 0 - LOG_FUNC("wlanSendCommand()\n"); - LOG_FUNC("CmdType %u NetworkType %u StaRecIndex %u Oid %u CID 0x%x SetQuery %u NeedResp %u CmdSeqNum %u\n", - prCmdInfo->eCmdType, - prCmdInfo->eNetworkType, - prCmdInfo->ucStaRecIndex, - prCmdInfo->fgIsOid, - prCmdInfo->ucCID, - prCmdInfo->fgSetQuery, - prCmdInfo->fgNeedResp, - prCmdInfo->ucCmdSeqNum); -#endif - -#if (MT6620_E1_ASIC_HIFSYS_WORKAROUND == 1) - if(prAdapter->fgIsClockGatingEnabled == TRUE) { - nicDisableClockGating(prAdapter); - } -#endif - - do { - // <0> card removal check - if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - rStatus = WLAN_STATUS_FAILURE; - break; - } - - // <1> Normal case of sending CMD Packet - if (!prCmdInfo->fgDriverDomainMCR) { - // <1.1> Assign Traffic Class(TC) = TC4. - ucTC = TC4_INDEX; - - // <1.2> Check if pending packet or resource was exhausted - if ((rStatus = nicTxAcquireResource(prAdapter, ucTC)) == WLAN_STATUS_RESOURCES) { - DbgPrint("NO Resource:%d\n", ucTC); - break; - } - - // <1.3> Forward CMD_INFO_T to NIC Layer - rStatus = nicTxCmd(prAdapter, prCmdInfo, ucTC); - - // <1.4> Set Pending in response to Query Command/Need Response - if (rStatus == WLAN_STATUS_SUCCESS) { - if ((!prCmdInfo->fgSetQuery) || (prCmdInfo->fgNeedResp)) { - rStatus = WLAN_STATUS_PENDING; - } - } - } - // <2> Special case for access Driver Domain MCR - else { - P_CMD_ACCESS_REG prCmdAccessReg; - prCmdAccessReg = (P_CMD_ACCESS_REG)(prCmdInfo->pucInfoBuffer + CMD_HDR_SIZE); - - if (prCmdInfo->fgSetQuery) { - HAL_MCR_WR(prAdapter, - (prCmdAccessReg->u4Address & BITS(2,31)), //address is in DWORD unit - prCmdAccessReg->u4Data); - } - else { - P_CMD_ACCESS_REG prEventAccessReg; - UINT_32 u4Address; - - u4Address = prCmdAccessReg->u4Address; - prEventAccessReg = (P_CMD_ACCESS_REG)prCmdInfo->pucInfoBuffer; - prEventAccessReg->u4Address = u4Address; - - HAL_MCR_RD(prAdapter, - prEventAccessReg->u4Address & BITS(2,31), //address is in DWORD unit - &prEventAccessReg->u4Data); - } - } - - } - while (FALSE); - -#if (MT6620_E1_ASIC_HIFSYS_WORKAROUND == 1) - if(prAdapter->fgIsClockGatingEnabled == FALSE) { - nicEnableClockGating(prAdapter); - } -#endif - - return rStatus; -} /* end of wlanSendCommand() */ - - -/*----------------------------------------------------------------------------*/ -/*! - * \brief This function will release thd CMD_INFO upon its attribution - * - * \param prAdapter Pointer of Adapter Data Structure - * \param prCmdInfo Pointer of CMD_INFO_T - * - * \return (none) - */ -/*----------------------------------------------------------------------------*/ -VOID -wlanReleaseCommand ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ) -{ - P_TX_CTRL_T prTxCtrl; - P_MSDU_INFO_T prMsduInfo; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prTxCtrl = &prAdapter->rTxCtrl; - - switch(prCmdInfo->eCmdType) { - case COMMAND_TYPE_GENERAL_IOCTL: - case COMMAND_TYPE_NETWORK_IOCTL: - if (prCmdInfo->fgIsOid) { - kalOidComplete(prAdapter->prGlueInfo, - prCmdInfo->fgSetQuery, - prCmdInfo->u4SetInfoLen, - WLAN_STATUS_FAILURE); - } - break; - - case COMMAND_TYPE_SECURITY_FRAME: - kalSecurityFrameSendComplete(prAdapter->prGlueInfo, - prCmdInfo->prPacket, - WLAN_STATUS_FAILURE); - break; - - case COMMAND_TYPE_MANAGEMENT_FRAME: - prMsduInfo = (P_MSDU_INFO_T)prCmdInfo->prPacket; - - /* invoke callbacks */ - if(prMsduInfo->pfTxDoneHandler != NULL) { - prMsduInfo->pfTxDoneHandler(prAdapter, prMsduInfo, TX_RESULT_DROPPED_IN_DRIVER); - } - - GLUE_DEC_REF_CNT(prTxCtrl->i4TxMgmtPendingNum); - cnmMgtPktFree(prAdapter, prMsduInfo); - break; - - default: - ASSERT(0); - break; - } - - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - -} /* end of wlanReleaseCommand() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will search the CMD Queue to look for the pending OID and -* compelete it immediately when system request a reset. -* -* \param prAdapter ointer of Adapter Data Structure -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanReleasePendingOid ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Data - ) -{ - P_QUE_T prCmdQue; - QUE_T rTempCmdQue; - P_QUE_T prTempCmdQue = &rTempCmdQue; - P_QUE_ENTRY_T prQueueEntry = (P_QUE_ENTRY_T)NULL; - P_CMD_INFO_T prCmdInfo = (P_CMD_INFO_T)NULL; - - KAL_SPIN_LOCK_DECLARATION(); - - DEBUGFUNC("wlanReleasePendingOid"); - - ASSERT(prAdapter); - - DBGLOG(INIT, ERROR, ("OID Timeout! Releasing pending OIDs ..\n")); - - do { - // 1: Clear Pending OID in prAdapter->rPendingCmdQueue - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_PENDING); - - prCmdQue = &prAdapter->rPendingCmdQueue; - QUEUE_MOVE_ALL(prTempCmdQue, prCmdQue); - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - while (prQueueEntry) { - prCmdInfo = (P_CMD_INFO_T)prQueueEntry; - - if (prCmdInfo->fgIsOid) { - if (prCmdInfo->pfCmdTimeoutHandler) { - prCmdInfo->pfCmdTimeoutHandler(prAdapter, prCmdInfo); - } - else - kalOidComplete(prAdapter->prGlueInfo, - prCmdInfo->fgSetQuery, - 0, - WLAN_STATUS_FAILURE); - - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - } - else { - QUEUE_INSERT_TAIL(prCmdQue, prQueueEntry); - } - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - } - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_PENDING); - - // 2: Clear pending OID in glue layer command queue - kalOidCmdClearance(prAdapter->prGlueInfo); - - // 3: Clear pending OID queued in pvOidEntry with REQ_FLAG_OID set - kalOidClearance(prAdapter->prGlueInfo); - - } while(FALSE); - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will search the CMD Queue to look for the pending CMD/OID for specific -* NETWORK TYPE and compelete it immediately when system request a reset. -* -* \param prAdapter ointer of Adapter Data Structure -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanReleasePendingCMDbyNetwork ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkType - ) -{ - P_QUE_T prCmdQue; - QUE_T rTempCmdQue; - P_QUE_T prTempCmdQue = &rTempCmdQue; - P_QUE_ENTRY_T prQueueEntry = (P_QUE_ENTRY_T)NULL; - P_CMD_INFO_T prCmdInfo = (P_CMD_INFO_T)NULL; - - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - do { - // 1: Clear Pending OID in prAdapter->rPendingCmdQueue - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_PENDING); - - prCmdQue = &prAdapter->rPendingCmdQueue; - QUEUE_MOVE_ALL(prTempCmdQue, prCmdQue); - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - while (prQueueEntry) { - prCmdInfo = (P_CMD_INFO_T)prQueueEntry; - - DBGLOG(P2P, TRACE, ("Pending CMD for Network Type:%d \n", prCmdInfo->eNetworkType)); - - if (prCmdInfo->eNetworkType == eNetworkType) { - if (prCmdInfo->pfCmdTimeoutHandler) { - prCmdInfo->pfCmdTimeoutHandler(prAdapter, prCmdInfo); - } - else - kalOidComplete(prAdapter->prGlueInfo, - prCmdInfo->fgSetQuery, - 0, - WLAN_STATUS_FAILURE); - - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - } - else { - QUEUE_INSERT_TAIL(prCmdQue, prQueueEntry); - } - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - } - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_PENDING); - - - } while(FALSE); - - return; -} /* wlanReleasePendingCMDbyNetwork */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Return the packet buffer and reallocate one to the RFB -* -* \param prAdapter Pointer of Adapter Data Structure -* \param pvPacket Pointer of returned packet -* -* \retval WLAN_STATUS_SUCCESS: Success -* \retval WLAN_STATUS_FAILURE: Failed -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanReturnPacket ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvPacket - ) -{ - P_RX_CTRL_T prRxCtrl; - P_SW_RFB_T prSwRfb = NULL; - KAL_SPIN_LOCK_DECLARATION(); - - DEBUGFUNC("wlanReturnPacket"); - - ASSERT(prAdapter); - - prRxCtrl = &prAdapter->rRxCtrl; - ASSERT(prRxCtrl); - - if (pvPacket) { - kalPacketFree(prAdapter->prGlueInfo, pvPacket); - RX_ADD_CNT(prRxCtrl, RX_DATA_RETURNED_COUNT, 1); -#if CFG_NATIVE_802_11 - if (GLUE_TEST_FLAG(prAdapter->prGlueInfo, GLUE_FLAG_HALT)) { - } -#endif - } - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - QUEUE_REMOVE_HEAD(&prRxCtrl->rIndicatedRfbList, prSwRfb, P_SW_RFB_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - if (!prSwRfb){ - ASSERT(0); - return; - } - - if (nicRxSetupRFB(prAdapter, prSwRfb)){ - ASSERT(0); - return; - } - nicRxReturnRFB(prAdapter, prSwRfb); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is a required function that returns information about -* the capabilities and status of the driver and/or its network adapter. -* -* \param[IN] prAdapter Pointer to the Adapter structure. -* \param[IN] pfnOidQryHandler Function pointer for the OID query handler. -* \param[IN] pvInfoBuf Points to a buffer for return the query information. -* \param[IN] u4QueryBufferLen Specifies the number of bytes at pvInfoBuf. -* \param[OUT] pu4QueryInfoLen Points to the number of bytes it written or is needed. -* -* \retval WLAN_STATUS_xxx Different WLAN_STATUS code returned by different handlers. -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanQueryInformation ( - IN P_ADAPTER_T prAdapter, - IN PFN_OID_HANDLER_FUNC pfnOidQryHandler, - IN PVOID pvInfoBuf, - IN UINT_32 u4InfoBufLen, - OUT PUINT_32 pu4QryInfoLen - ) -{ - WLAN_STATUS status = WLAN_STATUS_FAILURE; - - ASSERT(prAdapter); - ASSERT(pu4QryInfoLen); - - // ignore any OID request after connected, under PS current measurement mode - if (prAdapter->u4PsCurrentMeasureEn && - (prAdapter->prGlueInfo->eParamMediaStateIndicated == PARAM_MEDIA_STATE_CONNECTED)) { - return WLAN_STATUS_SUCCESS; // note: return WLAN_STATUS_FAILURE or WLAN_STATUS_SUCCESS for blocking OIDs during current measurement ?? - } - -#if 1 - /* most OID handler will just queue a command packet */ - status = pfnOidQryHandler(prAdapter, - pvInfoBuf, - u4InfoBufLen, - pu4QryInfoLen); -#else - if (wlanIsHandlerNeedHwAccess(pfnOidQryHandler, FALSE)) { - ACQUIRE_POWER_CONTROL_FROM_PM(prAdapter); - - /* Reset sleepy state */ - if(prAdapter->fgWiFiInSleepyState == TRUE) { - prAdapter->fgWiFiInSleepyState = FALSE; - } - - status = pfnOidQryHandler(prAdapter, - pvInfoBuf, - u4InfoBufLen, - pu4QryInfoLen); - - RECLAIM_POWER_CONTROL_TO_PM(prAdapter, FALSE); - } - else { - status = pfnOidQryHandler(prAdapter, - pvInfoBuf, - u4InfoBufLen, - pu4QryInfoLen); - } -#endif - - return status; - -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is a required function that allows bound protocol drivers, -* or NDIS, to request changes in the state information that the miniport -* maintains for particular object identifiers, such as changes in multicast -* addresses. -* -* \param[IN] prAdapter Pointer to the Glue info structure. -* \param[IN] pfnOidSetHandler Points to the OID set handlers. -* \param[IN] pvInfoBuf Points to a buffer containing the OID-specific data for the set. -* \param[IN] u4InfoBufLen Specifies the number of bytes at prSetBuffer. -* \param[OUT] pu4SetInfoLen Points to the number of bytes it read or is needed. -* -* \retval WLAN_STATUS_xxx Different WLAN_STATUS code returned by different handlers. -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanSetInformation ( - IN P_ADAPTER_T prAdapter, - IN PFN_OID_HANDLER_FUNC pfnOidSetHandler, - IN PVOID pvInfoBuf, - IN UINT_32 u4InfoBufLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS status = WLAN_STATUS_FAILURE; - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - // ignore any OID request after connected, under PS current measurement mode - if (prAdapter->u4PsCurrentMeasureEn && - (prAdapter->prGlueInfo->eParamMediaStateIndicated == PARAM_MEDIA_STATE_CONNECTED)) { - return WLAN_STATUS_SUCCESS; // note: return WLAN_STATUS_FAILURE or WLAN_STATUS_SUCCESS for blocking OIDs during current measurement ?? - } - -#if 1 - /* most OID handler will just queue a command packet - * for power state transition OIDs, handler will acquire power control by itself - */ - status = pfnOidSetHandler(prAdapter, - pvInfoBuf, - u4InfoBufLen, - pu4SetInfoLen); -#else - if (wlanIsHandlerNeedHwAccess(pfnOidSetHandler, TRUE)) { - ACQUIRE_POWER_CONTROL_FROM_PM(prAdapter); - - /* Reset sleepy state */ - if(prAdapter->fgWiFiInSleepyState == TRUE) { - prAdapter->fgWiFiInSleepyState = FALSE; - } - - status = pfnOidSetHandler(prAdapter, - pvInfoBuf, - u4InfoBufLen, - pu4SetInfoLen); - - RECLAIM_POWER_CONTROL_TO_PM(prAdapter, FALSE); - } - else { - status = pfnOidSetHandler(prAdapter, - pvInfoBuf, - u4InfoBufLen, - pu4SetInfoLen); - } -#endif - - return status; -} - - -#if CFG_SUPPORT_WAPI -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is a used to query driver's config wapi mode or not -* -* \param[IN] prAdapter Pointer to the Glue info structure. -* -* \retval TRUE for use wapi mode -* -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wlanQueryWapiMode ( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - return prAdapter->rWifiVar.rConnSettings.fgWapiMode; -} -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is called to set RX filter to Promiscuous Mode. -* -* \param[IN] prAdapter Pointer to the Adapter structure. -* \param[IN] fgEnablePromiscuousMode Enable/ disable RX Promiscuous Mode. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanSetPromiscuousMode ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgEnablePromiscuousMode - ) -{ - ASSERT(prAdapter); - -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is called to set RX filter to allow to receive -* broadcast address packets. -* -* \param[IN] prAdapter Pointer to the Adapter structure. -* \param[IN] fgEnableBroadcast Enable/ disable broadcast packet to be received. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanRxSetBroadcast ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgEnableBroadcast - ) -{ - ASSERT(prAdapter); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is called to send out CMD_NIC_POWER_CTRL command packet -* -* \param[IN] prAdapter Pointer to the Adapter structure. -* \param[IN] ucPowerMode refer to CMD/EVENT document -* -* \return WLAN_STATUS_SUCCESS -* \return WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanSendNicPowerCtrlCmd ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucPowerMode - ) -{ - WLAN_STATUS status = WLAN_STATUS_SUCCESS; - P_GLUE_INFO_T prGlueInfo; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - UINT_8 ucTC, ucCmdSeqNum; - - ASSERT(prAdapter); - - prGlueInfo = prAdapter->prGlueInfo; - - /* 1. Prepare CMD */ - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, (CMD_HDR_SIZE + sizeof(CMD_NIC_POWER_CTRL))); - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - /* 2.1 increase command sequence number */ - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - DBGLOG(REQ, TRACE, ("ucCmdSeqNum =%d\n", ucCmdSeqNum)); - - /* 2.2 Setup common CMD Info Packet */ - prCmdInfo->eCmdType = COMMAND_TYPE_GENERAL_IOCTL; - prCmdInfo->u2InfoBufLen = (UINT_16)(CMD_HDR_SIZE + sizeof(CMD_NIC_POWER_CTRL)); - prCmdInfo->pfCmdDoneHandler = NULL; - prCmdInfo->pfCmdTimeoutHandler = NULL; - prCmdInfo->fgIsOid = TRUE; - prCmdInfo->ucCID = CMD_ID_NIC_POWER_CTRL; - prCmdInfo->fgSetQuery = TRUE; - prCmdInfo->fgNeedResp = FALSE; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = sizeof(CMD_NIC_POWER_CTRL); - - /* 2.3 Setup WIFI_CMD_T */ - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - kalMemZero(prWifiCmd->aucBuffer, sizeof(CMD_NIC_POWER_CTRL)); - ((P_CMD_NIC_POWER_CTRL)(prWifiCmd->aucBuffer))->ucPowerMode = ucPowerMode; - - /* 3. Issue CMD for entering specific power mode */ - ucTC = TC4_INDEX; - - while(1) { - // 3.0 Removal check - if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - status = WLAN_STATUS_FAILURE; - break; - } - - // 3.1 Acquire TX Resource - if (nicTxAcquireResource(prAdapter, ucTC) == WLAN_STATUS_RESOURCES) { - if (nicTxPollingResource(prAdapter, ucTC) != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, ERROR,("Fail to get TX resource return within timeout\n")); - status = WLAN_STATUS_FAILURE; - break; - } - else { - continue; - } - } - - // 3.2 Send CMD Info Packet - if (nicTxCmd(prAdapter, prCmdInfo, ucTC) != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, ERROR,("Fail to transmit CMD_NIC_POWER_CTRL command\n")); - status = WLAN_STATUS_FAILURE; - } - - break; - }; - - // 4. Free CMD Info Packet. - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - - // 5. Add flag - if(ucPowerMode == 1) { - prAdapter->fgIsEnterD3ReqIssued = TRUE; - } - - return status; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is called to check if it is RF test mode and -* the OID is allowed to be called or not -* -* \param[IN] prAdapter Pointer to the Adapter structure. -* \param[IN] fgEnableBroadcast Enable/ disable broadcast packet to be received. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wlanIsHandlerAllowedInRFTest ( - IN PFN_OID_HANDLER_FUNC pfnOidHandler, - IN BOOLEAN fgSetInfo - ) -{ - PFN_OID_HANDLER_FUNC* apfnOidHandlerAllowedInRFTest; - UINT_32 i; - UINT_32 u4NumOfElem; - - if (fgSetInfo) { - apfnOidHandlerAllowedInRFTest = apfnOidSetHandlerAllowedInRFTest; - u4NumOfElem = sizeof(apfnOidSetHandlerAllowedInRFTest) / sizeof(PFN_OID_HANDLER_FUNC); - } - else { - apfnOidHandlerAllowedInRFTest = apfnOidQueryHandlerAllowedInRFTest; - u4NumOfElem = sizeof(apfnOidQueryHandlerAllowedInRFTest) / sizeof(PFN_OID_HANDLER_FUNC); - } - - for (i = 0; i < u4NumOfElem; i++) { - if (apfnOidHandlerAllowedInRFTest[i] == pfnOidHandler) { - return TRUE; - } - } - - return FALSE; -} - -#if CFG_ENABLE_FW_DOWNLOAD - #if CFG_ENABLE_FW_DOWNLOAD_AGGREGATION -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to download FW image in an aggregated way -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanImageSectionDownloadAggregated ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4DestAddr, - IN UINT_32 u4ImgSecSize, - IN PUINT_8 pucImgSecBuf - ) -{ - #if defined(MT6620) || defined(MT6628) - P_CMD_INFO_T prCmdInfo; - P_INIT_HIF_TX_HEADER_T prInitHifTxHeader; - P_INIT_CMD_DOWNLOAD_BUF prInitCmdDownloadBuf; - UINT_8 ucTC, ucCmdSeqNum; - WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS; - PUINT_8 pucOutputBuf = (PUINT_8)NULL; /* Pointer to Transmit Data Structure Frame */ - UINT_32 u4PktCnt, u4Offset, u4Length; - UINT_32 u4TotalLength; - - ASSERT(prAdapter); - ASSERT(pucImgSecBuf); - - pucOutputBuf = prAdapter->rTxCtrl.pucTxCoalescingBufPtr; - - DEBUGFUNC("wlanImageSectionDownloadAggregated"); - - if (u4ImgSecSize == 0) { - return WLAN_STATUS_SUCCESS; - } - - // 1. Allocate CMD Info Packet and Pre-fill Headers - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, - sizeof(INIT_HIF_TX_HEADER_T) + sizeof(INIT_CMD_DOWNLOAD_BUF) + CMD_PKT_SIZE_FOR_IMAGE); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - prCmdInfo->u2InfoBufLen = - sizeof(INIT_HIF_TX_HEADER_T) + sizeof(INIT_CMD_DOWNLOAD_BUF) + CMD_PKT_SIZE_FOR_IMAGE; - - // 2. Use TC0's resource to download image. (only TC0 is allowed) - ucTC = TC0_INDEX; - - // 3. Setup common CMD Info Packet - prInitHifTxHeader = (P_INIT_HIF_TX_HEADER_T)(prCmdInfo->pucInfoBuffer); - prInitHifTxHeader->ucEtherTypeOffset = 0; - prInitHifTxHeader->ucCSflags = 0; - prInitHifTxHeader->rInitWifiCmd.ucCID = INIT_CMD_ID_DOWNLOAD_BUF; - - // 4. Setup CMD_DOWNLOAD_BUF - prInitCmdDownloadBuf = (P_INIT_CMD_DOWNLOAD_BUF)(prInitHifTxHeader->rInitWifiCmd.aucBuffer); - prInitCmdDownloadBuf->u4DataMode = 0 - #if CFG_ENABLE_FW_ENCRYPTION - | DOWNLOAD_BUF_ENCRYPTION_MODE - #endif - ; - - // 5.0 reset loop control variable - u4TotalLength = 0; - u4Offset = u4PktCnt = 0; - - // 5.1 main loop for maximize transmission count per access - while(u4Offset < u4ImgSecSize) { - if(nicTxAcquireResource(prAdapter, ucTC) == WLAN_STATUS_SUCCESS) { - // 5.1.1 calculate u4Length - if(u4Offset + CMD_PKT_SIZE_FOR_IMAGE < u4ImgSecSize) { - u4Length = CMD_PKT_SIZE_FOR_IMAGE; - } - else { - u4Length = u4ImgSecSize - u4Offset; - } - - // 5.1.1 increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - prInitHifTxHeader->rInitWifiCmd.ucSeqNum = ucCmdSeqNum; - - // 5.1.2 update HIF TX hardware header - prInitHifTxHeader->u2TxByteCount = ALIGN_4(sizeof(INIT_HIF_TX_HEADER_T) + sizeof(INIT_CMD_DOWNLOAD_BUF) + (UINT_16)u4Length); - - // 5.1.3 fill command header - prInitCmdDownloadBuf->u4Address = u4DestAddr + u4Offset; - prInitCmdDownloadBuf->u4Length = u4Length; - prInitCmdDownloadBuf->u4CRC32 = wlanCRC32(pucImgSecBuf + u4Offset, u4Length); - - // 5.1.4.1 copy header to coalescing buffer - kalMemCopy(pucOutputBuf + u4TotalLength, - (PVOID)prCmdInfo->pucInfoBuffer, - sizeof(INIT_HIF_TX_HEADER_T) + sizeof(INIT_CMD_DOWNLOAD_BUF)); - - // 5.1.4.2 copy payload to coalescing buffer - kalMemCopy(pucOutputBuf + u4TotalLength + sizeof(INIT_HIF_TX_HEADER_T) + sizeof(INIT_CMD_DOWNLOAD_BUF), - pucImgSecBuf + u4Offset, - u4Length); - - // 5.1.4.3 update length and other variables - u4TotalLength += ALIGN_4(sizeof(INIT_HIF_TX_HEADER_T) + sizeof(INIT_CMD_DOWNLOAD_BUF) + u4Length); - u4Offset += u4Length; - u4PktCnt++; - - if(u4Offset < u4ImgSecSize) { - continue; - } - } - else if(u4PktCnt == 0) { - /* no resource, so get some back */ - if (nicTxPollingResource(prAdapter, ucTC) != WLAN_STATUS_SUCCESS) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR,("Fail to get TX resource return within timeout\n")); - break; - } - } - - if(u4PktCnt != 0) { - // start transmission - HAL_WRITE_TX_PORT(prAdapter, - 0, - u4TotalLength, - (PUINT_8)pucOutputBuf, - prAdapter->u4CoalescingBufCachedSize); - - // reset varaibles - u4PktCnt = 0; - u4TotalLength = 0; - } - } - - // 8. Free CMD Info Packet. - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - - return u4Status; - - #else - #error "Only MT6620/MT6628 supports firmware download in an aggregated way" - - return WLAN_STATUS_FAILURE; - - #endif -} - - #endif -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to download FW image. -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanImageSectionDownload ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4DestAddr, - IN UINT_32 u4ImgSecSize, - IN PUINT_8 pucImgSecBuf - ) -{ - #if defined(MT6620) || defined(MT6628) - - P_CMD_INFO_T prCmdInfo; - P_INIT_HIF_TX_HEADER_T prInitHifTxHeader; - P_INIT_CMD_DOWNLOAD_BUF prInitCmdDownloadBuf; - UINT_8 ucTC, ucCmdSeqNum; - WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS; - - ASSERT(prAdapter); - ASSERT(pucImgSecBuf); - ASSERT(u4ImgSecSize <= CMD_PKT_SIZE_FOR_IMAGE); - - DEBUGFUNC("wlanImageSectionDownload"); - - if (u4ImgSecSize == 0) { - return WLAN_STATUS_SUCCESS; - } - - // 1. Allocate CMD Info Packet and its Buffer. - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, - sizeof(INIT_HIF_TX_HEADER_T) + sizeof(INIT_CMD_DOWNLOAD_BUF) + u4ImgSecSize); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - prCmdInfo->u2InfoBufLen = - sizeof(INIT_HIF_TX_HEADER_T) + sizeof(INIT_CMD_DOWNLOAD_BUF) + (UINT_16)u4ImgSecSize; - - // 2. Use TC0's resource to download image. (only TC0 is allowed) - ucTC = TC0_INDEX; - - // 3. increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - - // 4. Setup common CMD Info Packet - prInitHifTxHeader = (P_INIT_HIF_TX_HEADER_T)(prCmdInfo->pucInfoBuffer); - prInitHifTxHeader->rInitWifiCmd.ucCID = INIT_CMD_ID_DOWNLOAD_BUF; - prInitHifTxHeader->rInitWifiCmd.ucSeqNum = ucCmdSeqNum; - - // 5. Setup CMD_DOWNLOAD_BUF - prInitCmdDownloadBuf = (P_INIT_CMD_DOWNLOAD_BUF)(prInitHifTxHeader->rInitWifiCmd.aucBuffer); - prInitCmdDownloadBuf->u4Address = u4DestAddr; - prInitCmdDownloadBuf->u4Length = u4ImgSecSize; - prInitCmdDownloadBuf->u4CRC32 = wlanCRC32(pucImgSecBuf, u4ImgSecSize); - prInitCmdDownloadBuf->u4DataMode = 0 - #if CFG_ENABLE_FW_DOWNLOAD_ACK - | DOWNLOAD_BUF_ACK_OPTION // ACK needed - #endif - #if CFG_ENABLE_FW_ENCRYPTION - | DOWNLOAD_BUF_ENCRYPTION_MODE - #endif - ; - kalMemCopy(prInitCmdDownloadBuf->aucBuffer, pucImgSecBuf, u4ImgSecSize); - - // 6. Send FW_Download command - while(1) { - // 6.1 Acquire TX Resource - if (nicTxAcquireResource(prAdapter, ucTC) == WLAN_STATUS_RESOURCES) { - if (nicTxPollingResource(prAdapter, ucTC) != WLAN_STATUS_SUCCESS) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR,("Fail to get TX resource return within timeout\n")); - break; - } - else { - continue; - } - } - - // 6.2 Send CMD Info Packet - if (nicTxInitCmd(prAdapter, prCmdInfo, ucTC) != WLAN_STATUS_SUCCESS) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR,("Fail to transmit image download command\n")); - } - - break; - }; - - #if CFG_ENABLE_FW_DOWNLOAD_ACK - // 7. Wait for INIT_EVENT_ID_CMD_RESULT - u4Status = wlanImageSectionDownloadStatus(prAdapter, ucCmdSeqNum); - #endif - - // 8. Free CMD Info Packet. - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - - return u4Status; - - #elif defined(MT5931) - - UINT_32 i, u4Value; - P_HIF_HW_TX_HEADER_T prHifTxHeader; - - WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS; - - ASSERT(prAdapter); - ASSERT(pucImgSecBuf); - ASSERT(u4ImgSecSize <= CMD_PKT_SIZE_FOR_IMAGE); - - DEBUGFUNC("wlanImageSectionDownload"); - DBGLOG(INIT, TRACE, ("Destination: 0x%08X / Length: 0x%08X\n", u4DestAddr, u4ImgSecSize)); - - if (u4ImgSecSize == 0) { - return WLAN_STATUS_SUCCESS; - } - - // 1. Use TX coalescing buffer - prHifTxHeader = (P_HIF_HW_TX_HEADER_T) prAdapter->pucCoalescingBufCached; - - // 2. Setup HIF_TX_HEADER - prHifTxHeader->u2TxByteCount = (UINT_16)(ALIGN_4(sizeof(HIF_HW_TX_HEADER_T) + u4ImgSecSize)); - prHifTxHeader->ucEtherTypeOffset = 0; - prHifTxHeader->ucCSflags = 0; - - // 3. Copy payload - kalMemCopy(prHifTxHeader->aucBuffer, pucImgSecBuf, u4ImgSecSize); - - // 3.1 add 4-bytes zero tail - kalMemZero(&(prHifTxHeader->aucBuffer[ALIGN_4(u4ImgSecSize)]), sizeof(HIF_HW_TX_HEADER_T)); - - // 4. Poll til FWDL_RDY = 1 - i = 0; - while(1) { - HAL_MCR_RD(prAdapter, MCR_FWDLSR, &u4Value); - - if (u4Value & FWDLSR_FWDL_RDY) { - DBGLOG(INIT, TRACE, ("FWDL_RDY detected\n")); - break; - } - else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - u4Status = WLAN_STATUS_FAILURE; - break; - } - else if(i >= CFG_RESPONSE_POLLING_TIMEOUT) { - DBGLOG(INIT, ERROR, ("Waiting for FWDL_RDY: Timeout (0x%08X)\n", u4Value)); - u4Status = WLAN_STATUS_FAILURE; - break; - } - else { - i++; - kalMsleep(10); - } - } - - // 5. Send firmware - HAL_PORT_WR(prAdapter, - MCR_FWDLDR, - prHifTxHeader->u2TxByteCount, - (PUINT_8)prHifTxHeader, - prAdapter->u4CoalescingBufCachedSize); - - return u4Status; - - #endif -} - -#if !CFG_ENABLE_FW_DOWNLOAD_ACK -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to confirm previously firmware download is done without error -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanImageQueryStatus( - IN P_ADAPTER_T prAdapter - ) -{ - P_CMD_INFO_T prCmdInfo; - P_INIT_HIF_TX_HEADER_T prInitHifTxHeader; - UINT_8 aucBuffer[sizeof(INIT_HIF_RX_HEADER_T) + sizeof(INIT_EVENT_PENDING_ERROR)]; - UINT_32 u4RxPktLength; - P_INIT_HIF_RX_HEADER_T prInitHifRxHeader; - P_INIT_EVENT_PENDING_ERROR prEventPendingError; - WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS; - UINT_8 ucTC, ucCmdSeqNum; - - ASSERT(prAdapter); - - DEBUGFUNC("wlanImageQueryStatus"); - - // 1. Allocate CMD Info Packet and it Buffer. - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, sizeof(INIT_HIF_TX_HEADER_T)); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - kalMemZero(prCmdInfo, sizeof(INIT_HIF_TX_HEADER_T)); - prCmdInfo->u2InfoBufLen = sizeof(INIT_HIF_TX_HEADER_T); - - // 2. Use TC0's resource to download image. (only TC0 is allowed) - ucTC = TC0_INDEX; - - // 3. increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - - // 4. Setup common CMD Info Packet - prInitHifTxHeader = (P_INIT_HIF_TX_HEADER_T)(prCmdInfo->pucInfoBuffer); - prInitHifTxHeader->rInitWifiCmd.ucCID = INIT_CMD_ID_QUERY_PENDING_ERROR; - prInitHifTxHeader->rInitWifiCmd.ucSeqNum = ucCmdSeqNum; - - // 5. Send command - while(1) { - // 5.1 Acquire TX Resource - if (nicTxAcquireResource(prAdapter, ucTC) == WLAN_STATUS_RESOURCES) { - if (nicTxPollingResource(prAdapter, ucTC) != WLAN_STATUS_SUCCESS) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR,("Fail to get TX resource return within timeout\n")); - break; - } - else { - continue; - } - } - - // 5.2 Send CMD Info Packet - if (nicTxInitCmd(prAdapter, prCmdInfo, ucTC) != WLAN_STATUS_SUCCESS) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR,("Fail to transmit image download command\n")); - } - - break; - }; - - // 6. Wait for INIT_EVENT_ID_PENDING_ERROR - do { - if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR, ("Bus error(%d)/Card removed(%d)\n", fgIsBusAccessFailed, kalIsCardRemoved(prAdapter->prGlueInfo))); - } - else if(nicRxWaitResponse(prAdapter, - 0, - aucBuffer, - sizeof(INIT_HIF_RX_HEADER_T) + sizeof(INIT_EVENT_PENDING_ERROR), - &u4RxPktLength) != WLAN_STATUS_SUCCESS) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR, ("No RX response\n")); - } - else { - prInitHifRxHeader = (P_INIT_HIF_RX_HEADER_T) aucBuffer; - - // EID / SeqNum check - if(prInitHifRxHeader->rInitWifiEvent.ucEID != INIT_EVENT_ID_PENDING_ERROR) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR, ("EVENT-ID Mismatch: %d\n", prInitHifRxHeader->rInitWifiEvent.ucEID)); - } - else if(prInitHifRxHeader->rInitWifiEvent.ucSeqNum != ucCmdSeqNum) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR, ("SEQ-NUM Mismatch: %d (expected: %d)\n", prInitHifRxHeader->rInitWifiEvent.ucSeqNum, ucCmdSeqNum)); - } - else { - prEventPendingError = (P_INIT_EVENT_PENDING_ERROR) (prInitHifRxHeader->rInitWifiEvent.aucBuffer); - if(prEventPendingError->ucStatus != 0) { // 0 for download success - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR, ("ERROR CODE: %d\n", prEventCmdResult->ucStatus)); - } - else { - u4Status = WLAN_STATUS_SUCCESS; - } - } - } - } while (FALSE); - - // 7. Free CMD Info Packet. - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - - return u4Status; -} - - -#else -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to confirm the status of -* previously downloaded firmware scatter -* -* @param prAdapter Pointer to the Adapter structure. -* ucCmdSeqNum Sequence number of previous firmware scatter -* -* @return WLAN_STATUS_SUCCESS -* WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanImageSectionDownloadStatus ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucCmdSeqNum - ) -{ - UINT_8 aucBuffer[sizeof(INIT_HIF_RX_HEADER_T) + sizeof(INIT_EVENT_CMD_RESULT)]; - P_INIT_HIF_RX_HEADER_T prInitHifRxHeader; - P_INIT_EVENT_CMD_RESULT prEventCmdResult; - UINT_32 u4RxPktLength; - WLAN_STATUS u4Status; - - ASSERT(prAdapter); - - do { - if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR, ("Bus error(%d)/Card removed(%d)\n", fgIsBusAccessFailed, kalIsCardRemoved(prAdapter->prGlueInfo))); - } - else if(nicRxWaitResponse(prAdapter, - 0, - aucBuffer, - sizeof(INIT_HIF_RX_HEADER_T) + sizeof(INIT_EVENT_CMD_RESULT), - &u4RxPktLength) != WLAN_STATUS_SUCCESS) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR, ("No RX response\n")); - } - else { - prInitHifRxHeader = (P_INIT_HIF_RX_HEADER_T) aucBuffer; - - // EID / SeqNum check - if(prInitHifRxHeader->rInitWifiEvent.ucEID != INIT_EVENT_ID_CMD_RESULT) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR, ("EVENT-ID Mismatch: %d\n", prInitHifRxHeader->rInitWifiEvent.ucEID)); - } - else if(prInitHifRxHeader->rInitWifiEvent.ucSeqNum != ucCmdSeqNum) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR, ("SEQ-NUM Mismatch: %d\n", prInitHifRxHeader->rInitWifiEvent.ucSeqNum)); - } - else { - prEventCmdResult = (P_INIT_EVENT_CMD_RESULT) (prInitHifRxHeader->rInitWifiEvent.aucBuffer); - if(prEventCmdResult->ucStatus != 0) { // 0 for download success - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR, ("ERROR CODE: %d\n", prEventCmdResult->ucStatus)); - } - else { - u4Status = WLAN_STATUS_SUCCESS; - } - } - } - } while (FALSE); - - return u4Status; -} - - -#endif -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to start FW normal operation. -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanConfigWifiFunc ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgEnable, - IN UINT_32 u4StartAddress - ) -{ - P_CMD_INFO_T prCmdInfo; - P_INIT_HIF_TX_HEADER_T prInitHifTxHeader; - P_INIT_CMD_WIFI_START prInitCmdWifiStart; - UINT_8 ucTC, ucCmdSeqNum; - WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS; - - ASSERT(prAdapter); - - DEBUGFUNC("wlanConfigWifiFunc"); - - // 1. Allocate CMD Info Packet and its Buffer. - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, - sizeof(INIT_HIF_TX_HEADER_T) + sizeof(INIT_CMD_WIFI_START)); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - kalMemZero(prCmdInfo, sizeof(INIT_HIF_TX_HEADER_T) + sizeof(INIT_CMD_WIFI_START)); - prCmdInfo->u2InfoBufLen = - sizeof(INIT_HIF_TX_HEADER_T) + sizeof(INIT_CMD_WIFI_START); - - // 2. Always use TC0 - ucTC = TC0_INDEX; - - // 3. increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - - // 4. Setup common CMD Info Packet - prInitHifTxHeader = (P_INIT_HIF_TX_HEADER_T)(prCmdInfo->pucInfoBuffer); - prInitHifTxHeader->rInitWifiCmd.ucCID = INIT_CMD_ID_WIFI_START; - prInitHifTxHeader->rInitWifiCmd.ucSeqNum = ucCmdSeqNum; - - prInitCmdWifiStart = (P_INIT_CMD_WIFI_START)(prInitHifTxHeader->rInitWifiCmd.aucBuffer); - prInitCmdWifiStart->u4Override = (fgEnable == TRUE ? 1 : 0); - prInitCmdWifiStart->u4Address = u4StartAddress; - - // 5. Seend WIFI start command - while(1) { - // 5.1 Acquire TX Resource - if (nicTxAcquireResource(prAdapter, ucTC) == WLAN_STATUS_RESOURCES) { - if (nicTxPollingResource(prAdapter, ucTC) != WLAN_STATUS_SUCCESS) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR,("Fail to get TX resource return within timeout\n")); - break; - } - else { - continue; - } - } - - // 5.2 Send CMD Info Packet - if (nicTxInitCmd(prAdapter, prCmdInfo, ucTC) != WLAN_STATUS_SUCCESS) { - u4Status = WLAN_STATUS_FAILURE; - DBGLOG(INIT, ERROR,("Fail to transmit WIFI start command\n")); - } - - break; - }; - - // 6. Free CMD Info Packet. - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - - return u4Status; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to generate CRC32 checksum -* -* @param buf Pointer to the data. -* @param len data length -* -* @return crc32 value -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 wlanCRC32( - PUINT_8 buf, - UINT_32 len) -{ - UINT_32 i, crc32 = 0xFFFFFFFF; - const UINT_32 crc32_ccitt_table[256] = { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, - 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, - 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, - 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, - 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, - 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, - 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, - 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, - 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, - 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, - 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, - 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, - 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, - 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, - 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, - 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, - 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, - 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, - 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, - 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, - 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, - 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, - 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, - 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, - 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, - 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, - 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, - 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, - 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, - 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, - 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, - 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, - 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, - 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, - 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, - 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, - 0x2d02ef8d }; - - for (i = 0; i < len; i++) - crc32 = crc32_ccitt_table[(crc32 ^ buf[i]) & 0xff] ^ (crc32 >> 8); - - return ( ~crc32 ); -} -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to process queued RX packets -* -* @param prAdapter Pointer to the Adapter structure. -* prSwRfbListHead Pointer to head of RX packets link list -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanProcessQueuedSwRfb ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfbListHead - ) -{ - P_SW_RFB_T prSwRfb, prNextSwRfb; - P_TX_CTRL_T prTxCtrl; - P_RX_CTRL_T prRxCtrl; - - ASSERT(prAdapter); - ASSERT(prSwRfbListHead); - - prTxCtrl = &prAdapter->rTxCtrl; - prRxCtrl = &prAdapter->rRxCtrl; - - prSwRfb = prSwRfbListHead; - - do { - // save next first - prNextSwRfb = (P_SW_RFB_T)QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T)prSwRfb); - - switch(prSwRfb->eDst) { - case RX_PKT_DESTINATION_HOST: - nicRxProcessPktWithoutReorder(prAdapter, prSwRfb); - break; - - case RX_PKT_DESTINATION_FORWARD: - nicRxProcessForwardPkt(prAdapter, prSwRfb); - break; - - case RX_PKT_DESTINATION_HOST_WITH_FORWARD: - nicRxProcessGOBroadcastPkt(prAdapter, prSwRfb); - break; - - case RX_PKT_DESTINATION_NULL: - nicRxReturnRFB(prAdapter, prSwRfb); - break; - - default: - break; - } - -#if CFG_HIF_RX_STARVATION_WARNING - prRxCtrl->u4DequeuedCnt++; -#endif - prSwRfb = prNextSwRfb; - } while(prSwRfb); - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to purge queued TX packets -* by indicating failure to OS and returned to free list -* -* @param prAdapter Pointer to the Adapter structure. -* prMsduInfoListHead Pointer to head of TX packets link list -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanProcessQueuedMsduInfo ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfoListHead - ) -{ - ASSERT(prAdapter); - ASSERT(prMsduInfoListHead); - - nicTxFreeMsduInfoPacket(prAdapter, prMsduInfoListHead); - nicTxReturnMsduInfo(prAdapter, prMsduInfoListHead); - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to check if the OID handler needs timeout -* -* @param prAdapter Pointer to the Adapter structure. -* pfnOidHandler Pointer to the OID handler -* -* @return TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wlanoidTimeoutCheck ( - IN P_ADAPTER_T prAdapter, - IN PFN_OID_HANDLER_FUNC pfnOidHandler - ) -{ - PFN_OID_HANDLER_FUNC* apfnOidHandlerWOTimeoutCheck; - UINT_32 i; - UINT_32 u4NumOfElem; - - apfnOidHandlerWOTimeoutCheck = apfnOidWOTimeoutCheck; - u4NumOfElem = sizeof(apfnOidWOTimeoutCheck) / sizeof(PFN_OID_HANDLER_FUNC); - - for (i = 0; i < u4NumOfElem; i++) { - if (apfnOidHandlerWOTimeoutCheck[i] == pfnOidHandler) { - return FALSE; - } - } - - // set timer if need timeout check - //cnmTimerStartTimer(prAdapter, - // &(prAdapter->rOidTimeoutTimer), - // 1000); - cnmTimerStartTimer(prAdapter, - &(prAdapter->rOidTimeoutTimer), - 2000); - - return TRUE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to clear any pending OID timeout check -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanoidClearTimeoutCheck ( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - cnmTimerStopTimer(prAdapter, &(prAdapter->rOidTimeoutTimer)); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to set up the MCUSYS's OSC stable time -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ - -#if CFG_SUPPORT_OSC_SETTING && defined(MT5931) -WLAN_STATUS -wlanSetMcuOscStableTime ( - IN P_ADAPTER_T prAdapter, - IN UINT_16 u2OscStableTime - ) -{ - UINT_8 ucCmdSeqNum = 0; - P_CMD_INFO_T prCmdInfo = NULL; - P_WIFI_CMD_T prWifiCmd = NULL; - P_CMD_MCU_LP_PARAM_T prMcuSetOscCmd = NULL; - WLAN_STATUS status = WLAN_STATUS_SUCCESS; - - ASSERT(prAdapter); - - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, - CMD_HDR_SIZE + sizeof(CMD_MCU_LP_PARAM_T)); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - - // compose CMD_MCU_LP_PARAM_T cmd pkt - prCmdInfo->eCmdType = COMMAND_TYPE_GENERAL_IOCTL; - prCmdInfo->u2InfoBufLen = CMD_HDR_SIZE + sizeof(CMD_MCU_LP_PARAM_T); - prCmdInfo->pfCmdDoneHandler = NULL; - prCmdInfo->pfCmdTimeoutHandler = NULL; - prCmdInfo->fgIsOid = FALSE; - prCmdInfo->ucCID = CMD_ID_SET_OSC; - prCmdInfo->fgSetQuery = TRUE; - prCmdInfo->fgNeedResp = FALSE; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = sizeof(CMD_MCU_LP_PARAM_T); - - // Setup WIFI_CMD_T - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - // configure CMD_MCU_LP_PARAM_T - prMcuSetOscCmd = (P_CMD_MCU_LP_PARAM_T)(prWifiCmd->aucBuffer); - prMcuSetOscCmd->u2OscStableTime = u2OscStableTime; - - status = wlanSendCommand(prAdapter, prCmdInfo); - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - - return status; -} -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to update network address in firmware domain -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return WLAN_STATUS_FAILURE The request could not be processed -* WLAN_STATUS_PENDING The request has been queued for later processing -* WLAN_STATUS_SUCCESS The request has been processed -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanUpdateNetworkAddress ( - IN P_ADAPTER_T prAdapter - ) -{ - const UINT_8 aucZeroMacAddr[] = NULL_MAC_ADDR; - PARAM_MAC_ADDRESS rMacAddr; - UINT_8 ucCmdSeqNum; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - P_CMD_BASIC_CONFIG prCmdBasicConfig; - UINT_32 u4SysTime; - - DEBUGFUNC("wlanUpdateNetworkAddress"); - - ASSERT(prAdapter); - - if(kalRetrieveNetworkAddress(prAdapter->prGlueInfo, &rMacAddr) == FALSE - || IS_BMCAST_MAC_ADDR(rMacAddr) - || EQUAL_MAC_ADDR(aucZeroMacAddr, rMacAddr)) { - // eFUSE has a valid address, don't do anything - if(prAdapter->fgIsEmbbededMacAddrValid == TRUE) { -#if CFG_SHOW_MACADDR_SOURCE - DBGLOG(INIT, INFO, ("Using embedded MAC address")); -#endif - return WLAN_STATUS_SUCCESS; - } - else { -#if CFG_SHOW_MACADDR_SOURCE - DBGLOG(INIT, INFO, ("Using dynamically generated MAC address")); -#endif - // dynamic generate - u4SysTime = (UINT_32) kalGetTimeTick(); - - rMacAddr[0] = 0x00; - rMacAddr[1] = 0x08; - rMacAddr[2] = 0x22; - - kalMemCopy(&rMacAddr[3], &u4SysTime, 3); - } - } - else { -#if CFG_SHOW_MACADDR_SOURCE - DBGLOG(INIT, INFO, ("Using host-supplied MAC address")); -#endif - } - - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, - CMD_HDR_SIZE + sizeof(CMD_BASIC_CONFIG)); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - - // compose CMD_BUILD_CONNECTION cmd pkt - prCmdInfo->eCmdType = COMMAND_TYPE_GENERAL_IOCTL; - prCmdInfo->u2InfoBufLen = CMD_HDR_SIZE + sizeof(CMD_BASIC_CONFIG); - prCmdInfo->pfCmdDoneHandler = NULL; - prCmdInfo->pfCmdTimeoutHandler = NULL; - prCmdInfo->fgIsOid = FALSE; - prCmdInfo->ucCID = CMD_ID_BASIC_CONFIG; - prCmdInfo->fgSetQuery = TRUE; - prCmdInfo->fgNeedResp = FALSE; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = sizeof(CMD_BASIC_CONFIG); - - // Setup WIFI_CMD_T - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - // configure CMD_BASIC_CONFIG - prCmdBasicConfig = (P_CMD_BASIC_CONFIG)(prWifiCmd->aucBuffer); - kalMemCopy(&(prCmdBasicConfig->rMyMacAddr), &rMacAddr, PARAM_MAC_ADDR_LEN); - prCmdBasicConfig->ucNative80211 = 0; - prCmdBasicConfig->rCsumOffload.u2RxChecksum = 0; - prCmdBasicConfig->rCsumOffload.u2TxChecksum = 0; - -#if CFG_TCP_IP_CHKSUM_OFFLOAD - if(prAdapter->u4CSUMFlags & CSUM_OFFLOAD_EN_TX_TCP) - prCmdBasicConfig->rCsumOffload.u2TxChecksum |= BIT(2); - - if(prAdapter->u4CSUMFlags & CSUM_OFFLOAD_EN_TX_UDP) - prCmdBasicConfig->rCsumOffload.u2TxChecksum |= BIT(1); - - if(prAdapter->u4CSUMFlags & CSUM_OFFLOAD_EN_TX_IP) - prCmdBasicConfig->rCsumOffload.u2TxChecksum |= BIT(0); - - if(prAdapter->u4CSUMFlags & CSUM_OFFLOAD_EN_RX_TCP) - prCmdBasicConfig->rCsumOffload.u2RxChecksum |= BIT(2); - - if(prAdapter->u4CSUMFlags & CSUM_OFFLOAD_EN_RX_UDP) - prCmdBasicConfig->rCsumOffload.u2RxChecksum |= BIT(1); - - if(prAdapter->u4CSUMFlags & (CSUM_OFFLOAD_EN_RX_IPv4 | CSUM_OFFLOAD_EN_RX_IPv6)) - prCmdBasicConfig->rCsumOffload.u2RxChecksum |= BIT(0); -#endif - - if(wlanSendCommand(prAdapter, prCmdInfo) == WLAN_STATUS_RESOURCES) { - prCmdInfo->pfCmdDoneHandler = nicCmdEventQueryAddress; - kalEnqueueCommand(prAdapter->prGlueInfo, (P_QUE_ENTRY_T)prCmdInfo); - - return WLAN_STATUS_PENDING; - } - else { - nicCmdEventQueryAddress(prAdapter, prCmdInfo, (PUINT_8)prCmdBasicConfig); - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - - return WLAN_STATUS_SUCCESS; - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to check if the device is in RF test mode -* -* @param pfnOidHandler Pointer to the OID handler -* -* @return TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wlanQueryTestMode( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - return prAdapter->fgTestMode; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to identify 802.1x and Bluetooth-over-Wi-Fi -* security frames, and queued into command queue for strict ordering -* due to 802.1x frames before add-key OIDs are not to be encrypted -* -* @param prAdapter Pointer of Adapter Data Structure -* @param prPacket Pointer of native packet -* -* @return TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wlanProcessSecurityFrame( - IN P_ADAPTER_T prAdapter, - IN P_NATIVE_PACKET prPacket - ) -{ - UINT_8 ucPriorityParam; - UINT_8 aucEthDestAddr[PARAM_MAC_ADDR_LEN]; - BOOLEAN fgIs1x = FALSE; - BOOLEAN fgIsPAL = FALSE; - UINT_32 u4PacketLen; - ULONG u4SysTime; - UINT_8 ucNetworkType; - P_CMD_INFO_T prCmdInfo; - - ASSERT(prAdapter); - ASSERT(prPacket); - - if (kalQoSFrameClassifierAndPacketInfo(prAdapter->prGlueInfo, - prPacket, - &ucPriorityParam, - &u4PacketLen, - aucEthDestAddr, - &fgIs1x, - &fgIsPAL, - &ucNetworkType) == TRUE) { - if(fgIs1x == FALSE) { - return FALSE; - } - else { - KAL_SPIN_LOCK_DECLARATION(); - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE); - QUEUE_REMOVE_HEAD(&prAdapter->rFreeCmdList, prCmdInfo, P_CMD_INFO_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE); - - DBGLOG(RSN, INFO, ("T1X len=%d\n", u4PacketLen)); - - if (prCmdInfo) { - P_STA_RECORD_T prStaRec; - // fill arrival time - u4SysTime = (OS_SYSTIME)kalGetTimeTick(); - GLUE_SET_PKT_ARRIVAL_TIME(prPacket, u4SysTime); - - kalMemZero(prCmdInfo, sizeof(CMD_INFO_T)); - - prCmdInfo->eCmdType = COMMAND_TYPE_SECURITY_FRAME; - prCmdInfo->u2InfoBufLen = (UINT_16)u4PacketLen; - prCmdInfo->pucInfoBuffer = NULL; - prCmdInfo->prPacket = prPacket; -#if 0 - prCmdInfo->ucStaRecIndex = qmGetStaRecIdx(prAdapter, - aucEthDestAddr, - (ENUM_NETWORK_TYPE_INDEX_T)ucNetworkType); -#endif - prStaRec = cnmGetStaRecByAddress(prAdapter, - (ENUM_NETWORK_TYPE_INDEX_T)ucNetworkType, - aucEthDestAddr); - if(prStaRec) { - prCmdInfo->ucStaRecIndex = prStaRec->ucIndex; - } - else { - prCmdInfo->ucStaRecIndex = STA_REC_INDEX_NOT_FOUND; - } - - prCmdInfo->eNetworkType = (ENUM_NETWORK_TYPE_INDEX_T)ucNetworkType; - prCmdInfo->pfCmdDoneHandler = wlanSecurityFrameTxDone; - prCmdInfo->pfCmdTimeoutHandler = wlanSecurityFrameTxTimeout; - prCmdInfo->fgIsOid = FALSE; - prCmdInfo->fgSetQuery = TRUE; - prCmdInfo->fgNeedResp = FALSE; - - kalEnqueueCommand(prAdapter->prGlueInfo, (P_QUE_ENTRY_T)prCmdInfo); - - return TRUE; - } - else { - ASSERT(0); - return FALSE; - } - } - } - else { - return FALSE; - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called when 802.1x or Bluetooth-over-Wi-Fi -* security frames has been sent to firmware -* -* @param prAdapter Pointer of Adapter Data Structure -* @param prCmdInfo Pointer of CMD_INFO_T -* @param pucEventBuf meaningless, only for API compatibility -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanSecurityFrameTxDone( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - ASSERT(prAdapter); - ASSERT(prCmdInfo); - if (prCmdInfo->eNetworkType == NETWORK_TYPE_AIS_INDEX && - prAdapter->rWifiVar.rAisSpecificBssInfo.fgCounterMeasure) { - P_STA_RECORD_T prSta = cnmGetStaRecByIndex(prAdapter, prCmdInfo->ucStaRecIndex); - if (prSta) { - kalMsleep(10); - secFsmEventEapolTxDone(prAdapter, prSta, TX_RESULT_SUCCESS); - } - } - - kalSecurityFrameSendComplete(prAdapter->prGlueInfo, - prCmdInfo->prPacket, - WLAN_STATUS_SUCCESS); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called when 802.1x or Bluetooth-over-Wi-Fi -* security frames has failed sending to firmware -* -* @param prAdapter Pointer of Adapter Data Structure -* @param prCmdInfo Pointer of CMD_INFO_T -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanSecurityFrameTxTimeout( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ) -{ - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - kalSecurityFrameSendComplete(prAdapter->prGlueInfo, - prCmdInfo->prPacket, - WLAN_STATUS_FAILURE); -} - -void sortAvgRssi(void); -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called before AIS is starting a new scan -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanClearScanningResult( - IN P_ADAPTER_T prAdapter - ) -{ - BOOLEAN fgKeepCurrOne = FALSE; - UINT_32 i; - - ASSERT(prAdapter); - -#if RSSI_ENHANCE - sortAvgRssi(); -#endif - - // clear scanning result - if(kalGetMediaStateIndicated(prAdapter->prGlueInfo) == PARAM_MEDIA_STATE_CONNECTED) { - for(i = 0 ; i < prAdapter->rWlanInfo.u4ScanResultNum ; i++) { - if(EQUAL_MAC_ADDR(prAdapter->rWlanInfo.rCurrBssId.arMacAddress, - prAdapter->rWlanInfo.arScanResult[i].arMacAddress)) { - fgKeepCurrOne = TRUE; - - if(i != 0) { - // copy structure - kalMemCopy(&(prAdapter->rWlanInfo.arScanResult[0]), - &(prAdapter->rWlanInfo.arScanResult[i]), - OFFSET_OF(PARAM_BSSID_EX_T, aucIEs)); - } - - if(prAdapter->rWlanInfo.arScanResult[i].u4IELength > 0) { - if(prAdapter->rWlanInfo.apucScanResultIEs[i] != &(prAdapter->rWlanInfo.aucScanIEBuf[0])) { - // move IEs to head - kalMemCopy(prAdapter->rWlanInfo.aucScanIEBuf, - prAdapter->rWlanInfo.apucScanResultIEs[i], - prAdapter->rWlanInfo.arScanResult[i].u4IELength); - } - - // modify IE pointer - prAdapter->rWlanInfo.apucScanResultIEs[0] = &(prAdapter->rWlanInfo.aucScanIEBuf[0]); - } - else { - prAdapter->rWlanInfo.apucScanResultIEs[0] = NULL; - } - - break; - } - } - } - - if(fgKeepCurrOne == TRUE) { - prAdapter->rWlanInfo.u4ScanResultNum = 1; - prAdapter->rWlanInfo.u4ScanIEBufferUsage = - ALIGN_4(prAdapter->rWlanInfo.arScanResult[0].u4IELength); - } - else { - prAdapter->rWlanInfo.u4ScanResultNum = 0; - prAdapter->rWlanInfo.u4ScanIEBufferUsage = 0; - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called when AIS received a beacon timeout event -* -* @param prAdapter Pointer of Adapter Data Structure -* @param arBSSID MAC address of the specified BSS -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanClearBssInScanningResult( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 arBSSID - ) -{ - UINT_32 i, j, u4IELength = 0, u4IEMoveLength; - PUINT_8 pucIEPtr; - - ASSERT(prAdapter); - - // clear scanning result - i = 0; - while(1) { - if(i >= prAdapter->rWlanInfo.u4ScanResultNum) { - break; - } - - if(EQUAL_MAC_ADDR(arBSSID, prAdapter->rWlanInfo.arScanResult[i].arMacAddress)) { - // backup current IE length - u4IELength = ALIGN_4(prAdapter->rWlanInfo.arScanResult[i].u4IELength); - pucIEPtr = prAdapter->rWlanInfo.apucScanResultIEs[i]; - - // removed from middle - for(j = i + 1 ; j < prAdapter->rWlanInfo.u4ScanResultNum ; j++) { - kalMemCopy(&(prAdapter->rWlanInfo.arScanResult[j-1]), - &(prAdapter->rWlanInfo.arScanResult[j]), - OFFSET_OF(PARAM_BSSID_EX_T, aucIEs)); - - prAdapter->rWlanInfo.apucScanResultIEs[j-1] = - prAdapter->rWlanInfo.apucScanResultIEs[j]; - } - - prAdapter->rWlanInfo.u4ScanResultNum--; - - // remove IE buffer if needed := move rest of IE buffer - if(u4IELength > 0) { - u4IEMoveLength = prAdapter->rWlanInfo.u4ScanIEBufferUsage - - (((UINT_32)pucIEPtr) + u4IELength - ((UINT_32)(&(prAdapter->rWlanInfo.aucScanIEBuf[0])))); - - kalMemCopy(pucIEPtr, - (PUINT_8)(((UINT_32)pucIEPtr) + u4IELength), - u4IEMoveLength); - - prAdapter->rWlanInfo.u4ScanIEBufferUsage -= u4IELength; - - // correction of pointers to IE buffer - for(j = 0 ; j < prAdapter->rWlanInfo.u4ScanResultNum ; j++) { - if(prAdapter->rWlanInfo.apucScanResultIEs[j] > pucIEPtr) { - prAdapter->rWlanInfo.apucScanResultIEs[j] = - (PUINT_8)((UINT_32)(prAdapter->rWlanInfo.apucScanResultIEs[j]) - u4IELength); - } - } - } - } - - i++; - } - - return; -} - - -#if CFG_TEST_WIFI_DIRECT_GO -VOID -wlanEnableP2pFunction ( - IN P_ADAPTER_T prAdapter - ) -{ -#if 0 - P_MSG_P2P_FUNCTION_SWITCH_T prMsgFuncSwitch = (P_MSG_P2P_FUNCTION_SWITCH_T)NULL; - - prMsgFuncSwitch = (P_MSG_P2P_FUNCTION_SWITCH_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_P2P_FUNCTION_SWITCH_T)); - if (!prMsgFuncSwitch) { - ASSERT(FALSE); - return; - } - - - prMsgFuncSwitch->rMsgHdr.eMsgId = MID_MNY_P2P_FUN_SWITCH; - prMsgFuncSwitch->fgIsFuncOn = TRUE; - - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prMsgFuncSwitch, - MSG_SEND_METHOD_BUF); -#endif - return; -} - -VOID -wlanEnableATGO ( - IN P_ADAPTER_T prAdapter - ) -{ - - P_MSG_P2P_CONNECTION_REQUEST_T prMsgConnReq = (P_MSG_P2P_CONNECTION_REQUEST_T)NULL; - UINT_8 aucTargetDeviceID[MAC_ADDR_LEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - - prMsgConnReq = (P_MSG_P2P_CONNECTION_REQUEST_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_P2P_CONNECTION_REQUEST_T)); - if (!prMsgConnReq) { - ASSERT(FALSE); - return; - } - - prMsgConnReq->rMsgHdr.eMsgId = MID_MNY_P2P_CONNECTION_REQ; - - /*=====Param Modified for test=====*/ - COPY_MAC_ADDR(prMsgConnReq->aucDeviceID, aucTargetDeviceID); - prMsgConnReq->fgIsTobeGO = TRUE; - prMsgConnReq->fgIsPersistentGroup = FALSE; - - /*=====Param Modified for test=====*/ - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prMsgConnReq, - MSG_SEND_METHOD_BUF); - - return; -} -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to retrieve permanent address from firmware -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return WLAN_STATUS_SUCCESS -* WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanQueryPermanentAddress( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_8 ucCmdSeqNum; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - UINT_32 u4RxPktLength; - UINT_8 aucBuffer[sizeof(WIFI_EVENT_T) + sizeof(EVENT_BASIC_CONFIG)]; - P_HIF_RX_HEADER_T prHifRxHdr; - P_WIFI_EVENT_T prEvent; - P_EVENT_BASIC_CONFIG prEventBasicConfig; - - ASSERT(prAdapter); - - DEBUGFUNC("wlanQueryPermanentAddress"); - - // 1. Allocate CMD Info Packet and its Buffer - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, CMD_HDR_SIZE + sizeof(CMD_BASIC_CONFIG)); - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - - // compose CMD_BUILD_CONNECTION cmd pkt - prCmdInfo->eCmdType = COMMAND_TYPE_GENERAL_IOCTL; - prCmdInfo->u2InfoBufLen = CMD_HDR_SIZE + sizeof(CMD_BASIC_CONFIG); - prCmdInfo->pfCmdDoneHandler = NULL; - prCmdInfo->fgIsOid = FALSE; - prCmdInfo->ucCID = CMD_ID_BASIC_CONFIG; - prCmdInfo->fgSetQuery = FALSE; - prCmdInfo->fgNeedResp = TRUE; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = sizeof(CMD_BASIC_CONFIG); - - // Setup WIFI_CMD_T - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - wlanSendCommand(prAdapter, prCmdInfo); - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - - if(nicRxWaitResponse(prAdapter, - 1, - aucBuffer, - sizeof(WIFI_EVENT_T) + sizeof(EVENT_BASIC_CONFIG), - &u4RxPktLength) != WLAN_STATUS_SUCCESS) { - return WLAN_STATUS_FAILURE; - } - - // header checking .. - prHifRxHdr = (P_HIF_RX_HEADER_T)aucBuffer; - if(prHifRxHdr->u2PacketType != HIF_RX_PKT_TYPE_EVENT) { - return WLAN_STATUS_FAILURE; - } - - prEvent = (P_WIFI_EVENT_T)aucBuffer; - if(prEvent->ucEID != EVENT_ID_BASIC_CONFIG) { - return WLAN_STATUS_FAILURE; - } - - prEventBasicConfig = (P_EVENT_BASIC_CONFIG)(prEvent->aucBuffer); - - COPY_MAC_ADDR(prAdapter->rWifiVar.aucPermanentAddress, &(prEventBasicConfig->rMyMacAddr)); - COPY_MAC_ADDR(prAdapter->rWifiVar.aucMacAddress, &(prEventBasicConfig->rMyMacAddr)); - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to retrieve NIC capability from firmware -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return WLAN_STATUS_SUCCESS -* WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanQueryNicCapability( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_8 ucCmdSeqNum; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - UINT_32 u4RxPktLength; - UINT_8 aucBuffer[sizeof(WIFI_EVENT_T) + sizeof(EVENT_NIC_CAPABILITY)]; - P_HIF_RX_HEADER_T prHifRxHdr; - P_WIFI_EVENT_T prEvent; - P_EVENT_NIC_CAPABILITY prEventNicCapability; - - ASSERT(prAdapter); - - DEBUGFUNC("wlanQueryNicCapability"); - - // 1. Allocate CMD Info Packet and its Buffer - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, CMD_HDR_SIZE + sizeof(EVENT_NIC_CAPABILITY)); - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - - // compose CMD_BUILD_CONNECTION cmd pkt - prCmdInfo->eCmdType = COMMAND_TYPE_GENERAL_IOCTL; - prCmdInfo->u2InfoBufLen = CMD_HDR_SIZE + sizeof(EVENT_NIC_CAPABILITY); - prCmdInfo->pfCmdDoneHandler = NULL; - prCmdInfo->fgIsOid = FALSE; - prCmdInfo->ucCID = CMD_ID_GET_NIC_CAPABILITY; - prCmdInfo->fgSetQuery = FALSE; - prCmdInfo->fgNeedResp = TRUE; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = 0; - - // Setup WIFI_CMD_T - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - wlanSendCommand(prAdapter, prCmdInfo); - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - - if(nicRxWaitResponse(prAdapter, - 1, - aucBuffer, - sizeof(WIFI_EVENT_T) + sizeof(EVENT_NIC_CAPABILITY), - &u4RxPktLength) != WLAN_STATUS_SUCCESS) { - return WLAN_STATUS_FAILURE; - } - - // header checking .. - prHifRxHdr = (P_HIF_RX_HEADER_T)aucBuffer; - if(prHifRxHdr->u2PacketType != HIF_RX_PKT_TYPE_EVENT) { - return WLAN_STATUS_FAILURE; - } - - prEvent = (P_WIFI_EVENT_T)aucBuffer; - if(prEvent->ucEID != EVENT_ID_NIC_CAPABILITY) { - return WLAN_STATUS_FAILURE; - } - - prEventNicCapability = (P_EVENT_NIC_CAPABILITY)(prEvent->aucBuffer); - - prAdapter->rVerInfo.u2FwProductID = prEventNicCapability->u2ProductID; - prAdapter->rVerInfo.u2FwOwnVersion = prEventNicCapability->u2FwVersion; - prAdapter->rVerInfo.u2FwPeerVersion = prEventNicCapability->u2DriverVersion; - prAdapter->fgIsHw5GBandDisabled = (BOOLEAN)prEventNicCapability->ucHw5GBandDisabled; - prAdapter->fgIsEepromUsed = (BOOLEAN)prEventNicCapability->ucEepromUsed; - prAdapter->fgIsEfuseValid = (BOOLEAN)prEventNicCapability->ucEfuseValid; - prAdapter->fgIsEmbbededMacAddrValid = (BOOLEAN)prEventNicCapability->ucMacAddrValid; - - -#if CFG_ENABLE_CAL_LOG - DBGLOG(INIT, INFO, (" RF CAL FAIL = (%d),BB CAL FAIL = (%d)\n", - prEventNicCapability->ucRfCalFail ,prEventNicCapability->ucBbCalFail )); -#endif - return WLAN_STATUS_SUCCESS; -} - -#ifdef MT6628 -static INT_32 wlanChangeCodeWord(INT_32 au4Input){ - - UINT_16 i; -#if TXPWR_USE_PDSLOPE - CODE_MAPPING_T arCodeTable[] = { - {0X100, -40}, - {0X104, -35}, - {0X128, -30}, - {0X14C, -25}, - {0X170, -20}, - {0X194, -15}, - {0X1B8, -10}, - {0X1DC, - 5}, - {0 , 0}, - {0X24 , 5}, - {0X48 , 10}, - {0X6C , 15}, - {0X90 , 20}, - {0XB4 , 25}, - {0XD8 , 30}, - {0XFC , 35}, - {0XFF , 40}, - - }; -#else - CODE_MAPPING_T arCodeTable[] = { - {0X100, 0x80}, - {0X104, 0x80}, - {0X128, 0x80}, - {0X14C, 0x80}, - {0X170, 0x80}, - {0X194, 0x94}, - {0X1B8, 0XB8}, - {0X1DC, 0xDC}, - {0 , 0}, - {0X24 , 0x24}, - {0X48 , 0x48}, - {0X6C , 0x6c}, - {0X90 , 0x7F}, - {0XB4 , 0x7F}, - {0XD8 , 0x7F}, - {0XFC , 0x7F}, - {0XFF , 0x7F}, - - }; -#endif - - for (i = 0; i < sizeof(arCodeTable) / sizeof(CODE_MAPPING_T); i++) { - - if (arCodeTable[i].u4RegisterValue == au4Input){ - return arCodeTable[i] .u4TxpowerOffset; - } - } - - - return 0; -} -#endif -#if TXPWR_USE_PDSLOPE - -/*----------------------------------------------------------------------------*/ -/*! -* @brief -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return WLAN_STATUS_SUCCESS -* WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanQueryPdMcr( - IN P_ADAPTER_T prAdapter, - P_PARAM_MCR_RW_STRUC_T prMcrRdInfo - ) -{ - UINT_8 ucCmdSeqNum; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - UINT_32 u4RxPktLength; - UINT_8 aucBuffer[sizeof(WIFI_EVENT_T) + sizeof(CMD_ACCESS_REG)]; - P_HIF_RX_HEADER_T prHifRxHdr; - P_WIFI_EVENT_T prEvent; - P_CMD_ACCESS_REG prCmdMcrQuery; - ASSERT(prAdapter); - - - // 1. Allocate CMD Info Packet and its Buffer - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, CMD_HDR_SIZE + sizeof(CMD_ACCESS_REG)); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - - // compose CMD_BUILD_CONNECTION cmd pkt - prCmdInfo->eCmdType = COMMAND_TYPE_GENERAL_IOCTL; - prCmdInfo->u2InfoBufLen = (UINT_16)(CMD_HDR_SIZE + sizeof(CMD_ACCESS_REG)); - prCmdInfo->pfCmdDoneHandler = NULL; - prCmdInfo->pfCmdTimeoutHandler = nicOidCmdTimeoutCommon; - prCmdInfo->fgIsOid = FALSE; - prCmdInfo->ucCID = CMD_ID_ACCESS_REG; - prCmdInfo->fgSetQuery = FALSE; - prCmdInfo->fgNeedResp = TRUE; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = sizeof(CMD_ACCESS_REG); - - // Setup WIFI_CMD_T - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - kalMemCopy(prWifiCmd->aucBuffer, prMcrRdInfo, sizeof(CMD_ACCESS_REG)); - - wlanSendCommand(prAdapter, prCmdInfo); - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - - if(nicRxWaitResponse(prAdapter, - 1, - aucBuffer, - sizeof(WIFI_EVENT_T) + sizeof(CMD_ACCESS_REG), - &u4RxPktLength) != WLAN_STATUS_SUCCESS) { - return WLAN_STATUS_FAILURE; - } - - // header checking .. - prHifRxHdr = (P_HIF_RX_HEADER_T)aucBuffer; - if(prHifRxHdr->u2PacketType != HIF_RX_PKT_TYPE_EVENT) { - return WLAN_STATUS_FAILURE; - } - - - prEvent = (P_WIFI_EVENT_T)aucBuffer; - - if(prEvent->ucEID != EVENT_ID_ACCESS_REG) { - return WLAN_STATUS_FAILURE; - } - - prCmdMcrQuery = (P_CMD_ACCESS_REG)(prEvent->aucBuffer); - prMcrRdInfo->u4McrOffset = prCmdMcrQuery->u4Address; - prMcrRdInfo->u4McrData = prCmdMcrQuery->u4Data; - - return WLAN_STATUS_SUCCESS; -} - -static INT_32 wlanIntRound(INT_32 au4Input) -{ - - - if (au4Input >= 0){ - if((au4Input%10) == 5){ - au4Input = au4Input + 5; - return au4Input; - } - } - - if (au4Input < 0){ - if((au4Input%10) == -5){ - au4Input = au4Input - 5; - return au4Input; - } - } - - return au4Input; -} - -static INT_32 wlanCal6628EfuseForm(IN P_ADAPTER_T prAdapter,INT_32 au4Input){ - - PARAM_MCR_RW_STRUC_T rMcrRdInfo; - INT_32 au4PdSlope,au4TxPwrOffset,au4TxPwrOffset_Round; - INT_8 auTxPwrOffset_Round; - - rMcrRdInfo.u4McrOffset = 0x60205c68; - rMcrRdInfo.u4McrData = 0; - au4TxPwrOffset = au4Input; - wlanQueryPdMcr(prAdapter,&rMcrRdInfo); - - au4PdSlope = (rMcrRdInfo.u4McrData) & BITS(0,6); - au4TxPwrOffset_Round = wlanIntRound((au4TxPwrOffset*au4PdSlope))/10; - - au4TxPwrOffset_Round = -au4TxPwrOffset_Round; - - if(au4TxPwrOffset_Round < -128) { - au4TxPwrOffset_Round = 128; - } - else if (au4TxPwrOffset_Round < 0){ - au4TxPwrOffset_Round += 256; - } - else if (au4TxPwrOffset_Round > 127){ - au4TxPwrOffset_Round = 127; - } - - auTxPwrOffset_Round = (UINT8) au4TxPwrOffset_Round ; - - return au4TxPwrOffset_Round; -} - -#endif - -#ifdef MT6628 -static VOID wlanChangeNvram6620to6628(PUINT_8 pucEFUSE){ - - - #define EFUSE_CH_OFFSET1_L_MASK_6620 BITS(0,8) - #define EFUSE_CH_OFFSET1_L_SHIFT_6620 0 - #define EFUSE_CH_OFFSET1_M_MASK_6620 BITS(9,17) - #define EFUSE_CH_OFFSET1_M_SHIFT_6620 9 - #define EFUSE_CH_OFFSET1_H_MASK_6620 BITS(18,26) - #define EFUSE_CH_OFFSET1_H_SHIFT_6620 18 - #define EFUSE_CH_OFFSET1_VLD_MASK_6620 BIT(27) - #define EFUSE_CH_OFFSET1_VLD_SHIFT_6620 27 - - #define EFUSE_CH_OFFSET1_L_MASK_5931 BITS(0,7) - #define EFUSE_CH_OFFSET1_L_SHIFT_5931 0 - #define EFUSE_CH_OFFSET1_M_MASK_5931 BITS(8,15) - #define EFUSE_CH_OFFSET1_M_SHIFT_5931 8 - #define EFUSE_CH_OFFSET1_H_MASK_5931 BITS(16,23) - #define EFUSE_CH_OFFSET1_H_SHIFT_5931 16 - #define EFUSE_CH_OFFSET1_VLD_MASK_5931 BIT(24) - #define EFUSE_CH_OFFSET1_VLD_SHIFT_5931 24 - #define EFUSE_ALL_CH_OFFSET1_MASK_5931 BITS(25,27) - #define EFUSE_ALL_CH_OFFSET1_SHIFT_5931 25 - - - - - INT_32 au4ChOffset; - INT_16 au2ChOffsetL,au2ChOffsetM,au2ChOffsetH; - - - au4ChOffset = *(UINT_32*)(pucEFUSE + 72); - - if((au4ChOffset & EFUSE_CH_OFFSET1_VLD_MASK_6620) && ((*(UINT_32*)(pucEFUSE + 28)) == 0)) { - - - au2ChOffsetL = ((au4ChOffset & EFUSE_CH_OFFSET1_L_MASK_6620) >> - EFUSE_CH_OFFSET1_L_SHIFT_6620); - - au2ChOffsetM = ((au4ChOffset & EFUSE_CH_OFFSET1_M_MASK_6620) >> - EFUSE_CH_OFFSET1_M_SHIFT_6620); - - au2ChOffsetH = ((au4ChOffset & EFUSE_CH_OFFSET1_H_MASK_6620) >> - EFUSE_CH_OFFSET1_H_SHIFT_6620); - - au2ChOffsetL = wlanChangeCodeWord(au2ChOffsetL); - au2ChOffsetM = wlanChangeCodeWord(au2ChOffsetM); - au2ChOffsetH = wlanChangeCodeWord(au2ChOffsetH); - - au4ChOffset = 0; - au4ChOffset |= *(UINT_32*)(pucEFUSE + 72) - >> (EFUSE_CH_OFFSET1_VLD_SHIFT_6620 - EFUSE_CH_OFFSET1_VLD_SHIFT_5931 )& EFUSE_CH_OFFSET1_VLD_MASK_5931 ; - - - - au4ChOffset |= ((((UINT_32)au2ChOffsetL) << EFUSE_CH_OFFSET1_L_SHIFT_5931) & EFUSE_CH_OFFSET1_L_MASK_5931); - au4ChOffset |= ((((UINT_32)au2ChOffsetM) << EFUSE_CH_OFFSET1_M_SHIFT_5931) & EFUSE_CH_OFFSET1_M_MASK_5931); - au4ChOffset |= ((((UINT_32)au2ChOffsetH) << EFUSE_CH_OFFSET1_H_SHIFT_5931) & EFUSE_CH_OFFSET1_H_MASK_5931); - - *((INT_32 *)((pucEFUSE + 28))) = au4ChOffset ; - - - - } - -} -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to load manufacture data from NVRAM -* if available and valid -* -* @param prAdapter Pointer of Adapter Data Structure -* @param prRegInfo Pointer of REG_INFO_T -* -* @return WLAN_STATUS_SUCCESS -* WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanLoadManufactureData ( - IN P_ADAPTER_T prAdapter, - IN P_REG_INFO_T prRegInfo - ) -{ -#if CFG_SUPPORT_RDD_TEST_MODE - CMD_RDD_CH_T rRddParam; -#endif - - ASSERT(prAdapter); - - /* 1. Version Check */ - kalGetConfigurationVersion(prAdapter->prGlueInfo, - &(prAdapter->rVerInfo.u2Part1CfgOwnVersion), - &(prAdapter->rVerInfo.u2Part1CfgPeerVersion), - &(prAdapter->rVerInfo.u2Part2CfgOwnVersion), - &(prAdapter->rVerInfo.u2Part2CfgPeerVersion)); - -#if (CFG_SW_NVRAM_VERSION_CHECK == 1) - if(CFG_DRV_OWN_VERSION < prAdapter->rVerInfo.u2Part1CfgPeerVersion - || CFG_DRV_OWN_VERSION < prAdapter->rVerInfo.u2Part2CfgPeerVersion - || prAdapter->rVerInfo.u2Part1CfgOwnVersion < CFG_DRV_PEER_VERSION - || prAdapter->rVerInfo.u2Part2CfgOwnVersion < CFG_DRV_PEER_VERSION) { - return WLAN_STATUS_FAILURE; - } -#endif - - // MT6620 E1/E2 would be ignored directly - if(prAdapter->rVerInfo.u2Part1CfgOwnVersion == 0x0001) { - prRegInfo->ucTxPwrValid = 1; - } - else { - /* 2. Load TX power gain parameters if valid */ - if(prRegInfo->ucTxPwrValid != 0) { - // send to F/W - nicUpdateTxPower(prAdapter, (P_CMD_TX_PWR_T)(&(prRegInfo->rTxPwr))); - } - } - - /* 3. Check if needs to support 5GHz */ - if(prRegInfo->ucEnable5GBand) { - // check if it is disabled by hardware - if(prAdapter->fgIsHw5GBandDisabled - || prRegInfo->ucSupport5GBand == 0) { - prAdapter->fgEnable5GBand = FALSE; - } - else { - prAdapter->fgEnable5GBand = TRUE; - } - } - else { - prAdapter->fgEnable5GBand = FALSE; - } - - /* 4. Send EFUSE data */ -#if defined(MT6628) - wlanChangeNvram6620to6628(prRegInfo->aucEFUSE); -#endif - - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_PHY_PARAM, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_PHY_PARAM_T), - (PUINT_8)(prRegInfo->aucEFUSE), - NULL, - 0); - -#if CFG_SUPPORT_RDD_TEST_MODE - rRddParam.ucRddTestMode = (UINT_8) prRegInfo->u4RddTestMode; - rRddParam.ucRddShutCh = (UINT_8) prRegInfo->u4RddShutFreq; - rRddParam.ucRddStartCh = (UINT_8) nicFreq2ChannelNum(prRegInfo->u4RddStartFreq); - rRddParam.ucRddStopCh = (UINT_8) nicFreq2ChannelNum(prRegInfo->u4RddStopFreq); - rRddParam.ucRddDfs = (UINT_8) prRegInfo->u4RddDfs; - prAdapter->ucRddStatus = 0; - nicUpdateRddTestMode(prAdapter, (P_CMD_RDD_CH_T)(&rRddParam)); -#endif - - /* 5. Get 16-bits Country Code and Bandwidth */ - prAdapter->rWifiVar.rConnSettings.u2CountryCode = - (((UINT_16) prRegInfo->au2CountryCode[0]) << 8) | - (((UINT_16) prRegInfo->au2CountryCode[1]) & BITS(0,7)); - -#if 0 /* Bandwidth control will be controlled by GUI. 20110930 - * So ignore the setting from registry/NVRAM - */ - prAdapter->rWifiVar.rConnSettings.uc2G4BandwidthMode = - prRegInfo->uc2G4BwFixed20M ? CONFIG_BW_20M : CONFIG_BW_20_40M; - prAdapter->rWifiVar.rConnSettings.uc5GBandwidthMode = - prRegInfo->uc5GBwFixed20M ? CONFIG_BW_20M : CONFIG_BW_20_40M; -#endif - - /* 6. Set domain and channel information to chip */ - rlmDomainSendCmd(prAdapter, FALSE); - - /* 7. set band edge tx power if available */ - if(prRegInfo->fg2G4BandEdgePwrUsed) { - CMD_EDGE_TXPWR_LIMIT_T rCmdEdgeTxPwrLimit; - - rCmdEdgeTxPwrLimit.cBandEdgeMaxPwrCCK - = prRegInfo->cBandEdgeMaxPwrCCK; - rCmdEdgeTxPwrLimit.cBandEdgeMaxPwrOFDM20 - = prRegInfo->cBandEdgeMaxPwrOFDM20; - rCmdEdgeTxPwrLimit.cBandEdgeMaxPwrOFDM40 - = prRegInfo->cBandEdgeMaxPwrOFDM40; - - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_EDGE_TXPWR_LIMIT, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_EDGE_TXPWR_LIMIT_T), - (PUINT_8)&rCmdEdgeTxPwrLimit, - NULL, - 0); - } - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to check -* Media Stream Mode is set to non-default value or not, -* and clear to default value if above criteria is met -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return TRUE -* The media stream mode was non-default value and has been reset -* FALSE -* The media stream mode is default value -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wlanResetMediaStreamMode( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - if(prAdapter->rWlanInfo.eLinkAttr.ucMediaStreamMode != 0) { - prAdapter->rWlanInfo.eLinkAttr.ucMediaStreamMode = 0; - - return TRUE; - } - else { - return FALSE; - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to check if any pending timer has expired -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanTimerTimeoutCheck( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - cnmTimerDoTimeOutCheck(prAdapter); - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to check if any pending mailbox message -* to be handled -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanProcessMboxMessage( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 i; - - ASSERT(prAdapter); - - for(i = 0 ; i < MBOX_ID_TOTAL_NUM ; i++) { - mboxRcvAllMsg(prAdapter , (ENUM_MBOX_ID_T)i); - } - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to enqueue a single TX packet into CORE -* -* @param prAdapter Pointer of Adapter Data Structure -* prNativePacket Pointer of Native Packet -* -* @return WLAN_STATUS_SUCCESS -* WLAN_STATUS_RESOURCES -* WLAN_STATUS_INVALID_PACKET -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanEnqueueTxPacket ( - IN P_ADAPTER_T prAdapter, - IN P_NATIVE_PACKET prNativePacket - ) -{ - P_TX_CTRL_T prTxCtrl; - P_MSDU_INFO_T prMsduInfo; - - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - prTxCtrl = &prAdapter->rTxCtrl; - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST); - QUEUE_REMOVE_HEAD(&prTxCtrl->rFreeMsduInfoList, prMsduInfo, P_MSDU_INFO_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST); - - if(prMsduInfo == NULL) { - return WLAN_STATUS_RESOURCES; - } - else { - prMsduInfo->eSrc = TX_PACKET_OS; - - if(nicTxFillMsduInfo(prAdapter, - prMsduInfo, - prNativePacket) == FALSE) { // packet is not extractable - kalSendComplete(prAdapter->prGlueInfo, - prNativePacket, - WLAN_STATUS_INVALID_PACKET); - - nicTxReturnMsduInfo(prAdapter, prMsduInfo); - - return WLAN_STATUS_INVALID_PACKET; - } - else { - // enqueue to QM - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - - return WLAN_STATUS_SUCCESS; - } - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to flush pending TX packets in CORE -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanFlushTxPendingPackets( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - return nicTxFlush(prAdapter); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief this function sends pending MSDU_INFO_T to MT6620 -* -* @param prAdapter Pointer to the Adapter structure. -* @param pfgHwAccess Pointer for tracking LP-OWN status -* -* @retval WLAN_STATUS_SUCCESS Reset is done successfully. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanTxPendingPackets ( - IN P_ADAPTER_T prAdapter, - IN OUT PBOOLEAN pfgHwAccess - ) -{ - P_TX_CTRL_T prTxCtrl; - P_MSDU_INFO_T prMsduInfo; - - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - prTxCtrl = &prAdapter->rTxCtrl; - - ASSERT(pfgHwAccess); - - // <1> dequeue packet by txDequeuTxPackets() - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_QM_TX_QUEUE); - prMsduInfo = qmDequeueTxPackets(prAdapter, &prTxCtrl->rTc); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_QM_TX_QUEUE); - - if(prMsduInfo != NULL) { - if(kalIsCardRemoved(prAdapter->prGlueInfo) == FALSE) { - /* <2> Acquire LP-OWN if necessary */ - if(*pfgHwAccess == FALSE) { - *pfgHwAccess = TRUE; - - wlanAcquirePowerControl(prAdapter); - } - -#if (MT6620_E1_ASIC_HIFSYS_WORKAROUND == 1) - if(prAdapter->fgIsClockGatingEnabled == TRUE) { - nicDisableClockGating(prAdapter); - } -#endif - // <3> send packets - nicTxMsduInfoList(prAdapter, prMsduInfo); - - // <4> update TC by txAdjustTcQuotas() - nicTxAdjustTcq(prAdapter); - } - else { - wlanProcessQueuedMsduInfo(prAdapter, prMsduInfo); - } - } - -#if (MT6620_E1_ASIC_HIFSYS_WORKAROUND == 1) - if(prAdapter->fgIsClockGatingEnabled == FALSE) { - nicEnableClockGating(prAdapter); - } -#endif - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to acquire power control from firmware -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanAcquirePowerControl( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - ACQUIRE_POWER_CONTROL_FROM_PM(prAdapter); - - /* Reset sleepy state */ - if(prAdapter->fgWiFiInSleepyState == TRUE) { - prAdapter->fgWiFiInSleepyState = FALSE; - } - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to release power control to firmware -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanReleasePowerControl( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - RECLAIM_POWER_CONTROL_TO_PM(prAdapter, FALSE); - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to report currently pending TX frames count -* (command packets are not included) -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return number of pending TX frames -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -wlanGetTxPendingFrameCount ( - IN P_ADAPTER_T prAdapter - ) -{ - P_TX_CTRL_T prTxCtrl; - UINT_32 u4Num; - - ASSERT(prAdapter); - prTxCtrl = &prAdapter->rTxCtrl; - - u4Num = kalGetTxPendingFrameCount(prAdapter->prGlueInfo) + (UINT_32)(prTxCtrl->i4PendingFwdFrameCount); - - return u4Num; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is to report current ACPI state -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return ACPI_STATE_D0 Normal Operation Mode -* ACPI_STATE_D3 Suspend Mode -*/ -/*----------------------------------------------------------------------------*/ -ENUM_ACPI_STATE_T -wlanGetAcpiState ( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - return prAdapter->rAcpiState; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is to update current ACPI state only -* -* @param prAdapter Pointer of Adapter Data Structure -* @param ePowerState ACPI_STATE_D0 Normal Operation Mode -* ACPI_STATE_D3 Suspend Mode -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanSetAcpiState ( - IN P_ADAPTER_T prAdapter, - IN ENUM_ACPI_STATE_T ePowerState - ) -{ - ASSERT(prAdapter); - ASSERT(ePowerState <= ACPI_STATE_D3); - - prAdapter->rAcpiState = ePowerState; - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is to query ECO version from HIFSYS CR -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return zero Unable to retrieve ECO version information -* non-zero ECO version (1-based) -*/ -/*----------------------------------------------------------------------------*/ -UINT_8 -wlanGetEcoVersion( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - if(nicVerifyChipID(prAdapter) == TRUE) { - return (prAdapter->ucRevID + 1); - } - else { - return 0; - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is to setting the default Tx Power configuration -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return zero Unable to retrieve ECO version information -* non-zero ECO version (1-based) -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanDefTxPowerCfg ( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_8 i; - P_GLUE_INFO_T prGlueInfo = prAdapter->prGlueInfo; - P_SET_TXPWR_CTRL_T prTxpwr; - - ASSERT(prGlueInfo); - - prTxpwr = &prGlueInfo->rTxPwr; - - prTxpwr->c2GLegacyStaPwrOffset = 0; - prTxpwr->c2GHotspotPwrOffset = 0; - prTxpwr->c2GP2pPwrOffset = 0; - prTxpwr->c2GBowPwrOffset = 0; - prTxpwr->c5GLegacyStaPwrOffset = 0; - prTxpwr->c5GHotspotPwrOffset = 0; - prTxpwr->c5GP2pPwrOffset = 0; - prTxpwr->c5GBowPwrOffset = 0; - prTxpwr->ucConcurrencePolicy = 0; - for (i=0; i<3;i++) - prTxpwr->acReserved1[i] = 0; - - for (i=0; i<14;i++) - prTxpwr->acTxPwrLimit2G[i] = 63; - - for (i=0; i<4;i++) - prTxpwr->acTxPwrLimit5G[i] = 63; - - for (i=0; i<2;i++) - prTxpwr->acReserved2[i] = 0; - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is to -* set preferred band configuration corresponding to network type -* -* @param prAdapter Pointer of Adapter Data Structure -* @param eBand Given band -* @param eNetTypeIndex Given Network Type -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanSetPreferBandByNetwork ( - IN P_ADAPTER_T prAdapter, - IN ENUM_BAND_T eBand, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ) -{ - ASSERT(prAdapter); - ASSERT(eBand <= BAND_NUM); - ASSERT(eNetTypeIndex <= NETWORK_TYPE_INDEX_NUM); - - /* 1. set prefer band according to network type */ - prAdapter->aePreferBand[eNetTypeIndex] = eBand; - - /* 2. remove buffered BSS descriptors correspondingly */ - if(eBand == BAND_2G4) { - scanRemoveBssDescByBandAndNetwork(prAdapter, BAND_5G, eNetTypeIndex); - } - else if(eBand == BAND_5G) { - scanRemoveBssDescByBandAndNetwork(prAdapter, BAND_2G4, eNetTypeIndex); - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is to -* get channel information corresponding to specified network type -* -* @param prAdapter Pointer of Adapter Data Structure -* @param eNetTypeIndex Given Network Type -* -* @return channel number -*/ -/*----------------------------------------------------------------------------*/ -UINT_8 -wlanGetChannelNumberByNetwork ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ) -{ - P_BSS_INFO_T prBssInfo; - - ASSERT(prAdapter); - ASSERT(eNetTypeIndex <= NETWORK_TYPE_INDEX_NUM); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[eNetTypeIndex]); - - return prBssInfo->ucPrimaryChannel; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is to -* check unconfigured system properties and generate related message on -* scan list to notify users -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanCheckSystemConfiguration ( - IN P_ADAPTER_T prAdapter - ) -{ -#if (CFG_NVRAM_EXISTENCE_CHECK == 1) || (CFG_SW_NVRAM_VERSION_CHECK == 1) - const UINT_8 aucZeroMacAddr[] = NULL_MAC_ADDR; - const UINT_8 aucBCAddr[] = BC_MAC_ADDR; - BOOLEAN fgIsConfExist = TRUE; - BOOLEAN fgGenErrMsg = FALSE; - P_REG_INFO_T prRegInfo = NULL; - P_WLAN_BEACON_FRAME_T prBeacon = NULL; - P_IE_SSID_T prSsid = NULL; - UINT_32 u4ErrCode = 0; - UINT_8 aucErrMsg[32]; - PARAM_SSID_T rSsid; - PARAM_802_11_CONFIG_T rConfiguration; - PARAM_RATES_EX rSupportedRates; -#endif - - DEBUGFUNC("wlanCheckSystemConfiguration"); - - ASSERT(prAdapter); - -#if (CFG_NVRAM_EXISTENCE_CHECK == 1) - if(kalIsConfigurationExist(prAdapter->prGlueInfo) == FALSE) { - fgIsConfExist = FALSE; - fgGenErrMsg = TRUE; - } -#endif - -#if (CFG_SW_NVRAM_VERSION_CHECK == 1) - prRegInfo = kalGetConfiguration(prAdapter->prGlueInfo); - - if(fgIsConfExist == TRUE && - (CFG_DRV_OWN_VERSION < prAdapter->rVerInfo.u2Part1CfgPeerVersion - || CFG_DRV_OWN_VERSION < prAdapter->rVerInfo.u2Part2CfgPeerVersion - || prAdapter->rVerInfo.u2Part1CfgOwnVersion < CFG_DRV_PEER_VERSION - || prAdapter->rVerInfo.u2Part2CfgOwnVersion < CFG_DRV_PEER_VERSION /* NVRAM */ - || CFG_DRV_OWN_VERSION < prAdapter->rVerInfo.u2FwPeerVersion - || prAdapter->rVerInfo.u2FwOwnVersion < CFG_DRV_PEER_VERSION - || (prAdapter->fgIsEmbbededMacAddrValid == FALSE && - (IS_BMCAST_MAC_ADDR(prRegInfo->aucMacAddr) - || EQUAL_MAC_ADDR(aucZeroMacAddr, prRegInfo->aucMacAddr))) - || prRegInfo->ucTxPwrValid == 0)) { - fgGenErrMsg = TRUE; - } -#endif - - if(fgGenErrMsg == TRUE) { - prBeacon = cnmMemAlloc(prAdapter, RAM_TYPE_BUF, sizeof(WLAN_BEACON_FRAME_T) + sizeof(IE_SSID_T)); - - // initialization - kalMemZero(prBeacon, sizeof(WLAN_BEACON_FRAME_T) + sizeof(IE_SSID_T)); - - // prBeacon initialization - prBeacon->u2FrameCtrl = MAC_FRAME_BEACON; - COPY_MAC_ADDR(prBeacon->aucDestAddr, aucBCAddr); - COPY_MAC_ADDR(prBeacon->aucSrcAddr, aucZeroMacAddr); - COPY_MAC_ADDR(prBeacon->aucBSSID, aucZeroMacAddr); - prBeacon->u2BeaconInterval = 100; - prBeacon->u2CapInfo = CAP_INFO_ESS; - - // prSSID initialization - prSsid = (P_IE_SSID_T)(&prBeacon->aucInfoElem[0]); - prSsid->ucId = ELEM_ID_SSID; - - // rConfiguration initialization - rConfiguration.u4Length = sizeof(PARAM_802_11_CONFIG_T); - rConfiguration.u4BeaconPeriod = 100; - rConfiguration.u4ATIMWindow = 1; - rConfiguration.u4DSConfig = 2412; - rConfiguration.rFHConfig.u4Length = sizeof(PARAM_802_11_CONFIG_FH_T); - - // rSupportedRates initialization - kalMemZero(rSupportedRates, sizeof(PARAM_RATES_EX)); - } - -#if (CFG_NVRAM_EXISTENCE_CHECK == 1) - #define NVRAM_ERR_MSG "NVRAM WARNING: Err = 0x01" - if(kalIsConfigurationExist(prAdapter->prGlueInfo) == FALSE) { - COPY_SSID(prSsid->aucSSID, - prSsid->ucLength, - NVRAM_ERR_MSG, - strlen(NVRAM_ERR_MSG)); - - kalIndicateBssInfo(prAdapter->prGlueInfo, - (PUINT_8)prBeacon, - OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem) + OFFSET_OF(IE_SSID_T, aucSSID) + prSsid->ucLength, - 1, - 0); - - COPY_SSID(rSsid.aucSsid, rSsid.u4SsidLen, NVRAM_ERR_MSG, strlen(NVRAM_ERR_MSG)); - nicAddScanResult(prAdapter, - prBeacon->aucBSSID, - &rSsid, - 0, - 0, - PARAM_NETWORK_TYPE_FH, - &rConfiguration, - NET_TYPE_INFRA, - rSupportedRates, - OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem) + OFFSET_OF(IE_SSID_T, aucSSID) + prSsid->ucLength - WLAN_MAC_MGMT_HEADER_LEN, - (PUINT_8)((UINT_32)(prBeacon) + WLAN_MAC_MGMT_HEADER_LEN)); - } -#endif - -#if (CFG_SW_NVRAM_VERSION_CHECK == 1) - #define VER_ERR_MSG "NVRAM WARNING: Err = 0x%02X" - if(fgIsConfExist == TRUE) { - if((CFG_DRV_OWN_VERSION < prAdapter->rVerInfo.u2Part1CfgPeerVersion - || CFG_DRV_OWN_VERSION < prAdapter->rVerInfo.u2Part2CfgPeerVersion - || prAdapter->rVerInfo.u2Part1CfgOwnVersion < CFG_DRV_PEER_VERSION - || prAdapter->rVerInfo.u2Part2CfgOwnVersion < CFG_DRV_PEER_VERSION /* NVRAM */ - || CFG_DRV_OWN_VERSION < prAdapter->rVerInfo.u2FwPeerVersion - || prAdapter->rVerInfo.u2FwOwnVersion < CFG_DRV_PEER_VERSION)) { - u4ErrCode |= NVRAM_ERROR_VERSION_MISMATCH; - } - - - if(prRegInfo->ucTxPwrValid == 0) { - u4ErrCode |= NVRAM_ERROR_INVALID_TXPWR; - } - - if(prAdapter->fgIsEmbbededMacAddrValid == FALSE && - (IS_BMCAST_MAC_ADDR(prRegInfo->aucMacAddr) || EQUAL_MAC_ADDR(aucZeroMacAddr, prRegInfo->aucMacAddr))) { - u4ErrCode |= NVRAM_ERROR_INVALID_MAC_ADDR; - } - - if(u4ErrCode != 0) { - sprintf(aucErrMsg, VER_ERR_MSG, (unsigned int)u4ErrCode); - COPY_SSID(prSsid->aucSSID, - prSsid->ucLength, - aucErrMsg, - strlen(aucErrMsg)); - - kalIndicateBssInfo(prAdapter->prGlueInfo, - (PUINT_8)prBeacon, - OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem) + OFFSET_OF(IE_SSID_T, aucSSID) + prSsid->ucLength, - 1, - 0); - - COPY_SSID(rSsid.aucSsid, rSsid.u4SsidLen, NVRAM_ERR_MSG, strlen(NVRAM_ERR_MSG)); - nicAddScanResult(prAdapter, - prBeacon->aucBSSID, - &rSsid, - 0, - 0, - PARAM_NETWORK_TYPE_FH, - &rConfiguration, - NET_TYPE_INFRA, - rSupportedRates, - OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem) + OFFSET_OF(IE_SSID_T, aucSSID) + prSsid->ucLength - WLAN_MAC_MGMT_HEADER_LEN, - (PUINT_8)((UINT_32)(prBeacon) + WLAN_MAC_MGMT_HEADER_LEN)); - } - } -#endif - - if(fgGenErrMsg == TRUE) { - cnmMemFree(prAdapter, prBeacon); - } - - return WLAN_STATUS_SUCCESS; -} - diff --git a/drivers/net/wireless/mt5931/common/wlan_oid.c b/drivers/net/wireless/mt5931/common/wlan_oid.c deleted file mode 100755 index b0ae362ffc9f..000000000000 --- a/drivers/net/wireless/mt5931/common/wlan_oid.c +++ /dev/null @@ -1,10979 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/common/wlan_oid.c#5 $ -*/ - -/*! \file wlanoid.c - \brief This file contains the WLAN OID processing routines of Windows driver for - MediaTek Inc. 802.11 Wireless LAN Adapters. -*/ - - - -/* -** $Log: wlan_oid.c $ -** -** 07 19 2012 yuche.tsai -** NULL -** Code update for JB. - * - * 07 17 2012 yuche.tsai - * NULL - * Let netdev bring up. - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 01 06 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * using the wlanSendSetQueryCmd to set the tx power control cmd. - * - * 01 06 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * change the set tx power cmd name. - * - * 01 05 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the related ioctl / wlan oid function to set the Tx power cfg. - * - * 12 20 2011 cp.wu - * [WCXRP00001144] [MT6620 Wi-Fi][Driver][Firmware] Add RF_FUNC_ID for exposing device and related version information - * add driver implementations for RF_AT_FUNCID_FW_INFO & RF_AT_FUNCID_DRV_INFO - * to expose version information - * - * 12 05 2011 cp.wu - * [WCXRP00001131] [MT6620 Wi-Fi][Driver][AIS] Implement connect-by-BSSID path - * add CONNECT_BY_BSSID policy - * - * 11 22 2011 cp.wu - * [WCXRP00001120] [MT6620 Wi-Fi][Driver] Modify roaming to AIS state transition from synchronous to asynchronous approach to avoid incomplete state termination - * 1. change RDD related compile option brace position. - * 2. when roaming is triggered, ask AIS to transit immediately only when AIS is in Normal TR state without join timeout timer ticking - * 3. otherwise, insert AIS_REQUEST into pending request queue - * - * 11 21 2011 cp.wu - * [WCXRP00001118] [MT6620 Wi-Fi][Driver] Corner case protections to pass Monkey testing - * 1. wlanoidQueryBssIdList might be passed with a non-zero length but a NULL pointer of buffer - * add more checking for such cases - * - * 2. kalSendComplete() might be invoked with a packet belongs to P2P network right after P2P is unregistered. - * add some tweaking to protect such cases because that net device has become invalid. - * - * 11 15 2011 cm.chang - * NULL - * Fix compiling warning - * - * 11 11 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * modify the xlog related code. - * - * 11 11 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * add debug counters of bb and ar for xlog. - * - * 11 10 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * change the debug module level. - * - * 11 09 2011 george.huang - * [WCXRP00000871] [MT6620 Wi-Fi][FW] Include additional wakeup condition, which is by consequent DTIM unicast indication - * add XLOG for Set PS mode entry - * - * 11 08 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * check if CFG_SUPPORT_SWCR is defined to aoid compiler error. - * - * 11 07 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * add debug counters and periodically dump counters for debugging. - * - * 11 03 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * change the DBGLOG for "\n" and "\r\n". LABEL to LOUD for XLOG - * - * 11 02 2011 chinghwa.yu - * [WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add RDD certification features. - * - * 10 21 2011 eddie.chen - * [WCXRP00001051] [MT6620 Wi-Fi][Driver/Fw] Adjust the STA aging timeout - * Add switch to ignore the STA aging timeout. - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 09 15 2011 tsaiyuan.hsu - * [WCXRP00000938] [MT6620 Wi-Fi][FW] add system config for CTIA - * correct fifo full control from query to set operation for CTIA. - * - * 08 31 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * . - * - * 08 17 2011 tsaiyuan.hsu - * [WCXRP00000938] [MT6620 Wi-Fi][FW] add system config for CTIA - * add system config for CTIA. - * - * 08 15 2011 george.huang - * [MT6620 Wi-Fi][FW] handle TSF drift for connection detection - * . - * - * 07 28 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings - * Add BWCS cmd and event. - * - * 07 18 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add CMD/Event for RDD and BWCS. - * - * 07 11 2011 wh.su - * [WCXRP00000849] [MT6620 Wi-Fi][Driver] Remove some of the WAPI define for make sure the value is initialize, for customer not enable WAPI - * For make sure wapi initial value is set. - * - * 06 23 2011 cp.wu - * [WCXRP00000812] [MT6620 Wi-Fi][Driver] not show NVRAM when there is no valid MAC address in NVRAM content - * check with firmware for valid MAC address. - * - * 05 02 2011 eddie.chen - * [WCXRP00000373] [MT6620 Wi-Fi][FW] SW debug control - * Fix compile warning. - * - * 04 29 2011 george.huang - * [WCXRP00000684] [MT6620 Wi-Fi][Driver] Support P2P setting ARP filter - * . - * - * 04 27 2011 george.huang - * [WCXRP00000684] [MT6620 Wi-Fi][Driver] Support P2P setting ARP filter - * add more debug message - * - * 04 26 2011 eddie.chen - * [WCXRP00000373] [MT6620 Wi-Fi][FW] SW debug control - * Add rx path profiling. - * - * 04 12 2011 eddie.chen - * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma - * Fix the sta index in processing security frame - * Simple flow control for TC4 to avoid mgt frames for PS STA to occupy the TC4 - * Add debug message. - * - * 04 08 2011 george.huang - * [WCXRP00000621] [MT6620 Wi-Fi][Driver] Support P2P supplicant to set power mode - * separate settings of P2P and AIS - * - * 03 31 2011 puff.wen - * NULL - * . - * - * 03 29 2011 puff.wen - * NULL - * Add chennel switch for stress test - * - * 03 29 2011 cp.wu - * [WCXRP00000604] [MT6620 Wi-Fi][Driver] Surpress Klockwork Warning - * surpress klock warning with code path rewritten - * - * 03 24 2011 wh.su - * [WCXRP00000595] [MT6620 Wi-Fi][Driver] at CTIA indicate disconnect to make the ps profile can apply - * use disconnect event instead of ais abort for CTIA testing. - * - * 03 23 2011 george.huang - * [WCXRP00000586] [MT6620 Wi-Fi][FW] Modify for blocking absence request right after connected - * revise for CTIA power mode setting - * - * 03 22 2011 george.huang - * [WCXRP00000504] [MT6620 Wi-Fi][FW] Support Sigma CAPI for power saving related command - * link with supplicant commands - * - * 03 17 2011 chinglan.wang - * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature - * . - * - * 03 17 2011 yarco.yang - * [WCXRP00000569] [MT6620 Wi-Fi][F/W][Driver] Set multicast address support current network usage - * . - * - * 03 15 2011 george.huang - * [WCXRP00000557] [MT6620 Wi-Fi] Support current consumption test mode commands - * Support current consumption measurement mode command - * - * 03 15 2011 eddie.chen - * [WCXRP00000554] [MT6620 Wi-Fi][DRV] Add sw control debug counter - * Add sw debug counter for QM. - * - * 03 10 2011 cp.wu - * [WCXRP00000532] [MT6620 Wi-Fi][Driver] Migrate NVRAM configuration procedures from MT6620 E2 to MT6620 E3 - * deprecate configuration used by MT6620 E2 - * - * 03 07 2011 terry.wu - * [WCXRP00000521] [MT6620 Wi-Fi][Driver] Remove non-standard debug message - * Toggle non-standard debug messages to comments. - * - * 03 04 2011 cp.wu - * [WCXRP00000515] [MT6620 Wi-Fi][Driver] Surpress compiler warning which is identified by GNU compiler collection - * surpress compile warning occured when compiled by GNU compiler collection. - * - * 03 03 2011 wh.su - * [WCXRP00000510] [MT6620 Wi-Fi] [Driver] Fixed the CTIA enter test mode issue - * fixed the enter ctia test mode issue. - * - * 03 02 2011 george.huang - * [WCXRP00000504] [MT6620 Wi-Fi][FW] Support Sigma CAPI for power saving related command - * Update sigma CAPI for U-APSD setting - * - * 03 02 2011 george.huang - * [WCXRP00000504] [MT6620 Wi-Fi][FW] Support Sigma CAPI for power saving related command - * Support UAPSD/OppPS/NoA parameter setting - * - * 03 02 2011 cp.wu - * [WCXRP00000503] [MT6620 Wi-Fi][Driver] Take RCPI brought by association response as initial RSSI right after connection is built. - * use RCPI brought by ASSOC-RESP after connection is built as initial RCPI to avoid using a uninitialized MAC-RX RCPI. - * - * 01 27 2011 george.huang - * [WCXRP00000400] [MT6620 Wi-Fi] support CTIA power mode setting - * Support CTIA power mode setting. - * - * 01 26 2011 wh.su - * [WCXRP00000396] [MT6620 Wi-Fi][Driver] Support Sw Ctrl ioctl at linux - * adding the SW cmd ioctl support, use set/get structure ioctl. - * - * 01 25 2011 cp.wu - * [WCXRP00000394] [MT6620 Wi-Fi][Driver] Count space needed for generating error message in scanning list into buffer size checking - * when doing size prechecking, check illegal MAC address as well - * - * 01 20 2011 eddie.chen - * [WCXRP00000374] [MT6620 Wi-Fi][DRV] SW debug control - * Add Oid for sw control debug command - * - * 01 15 2011 puff.wen - * NULL - * Add Stress test - * - * 01 12 2011 cp.wu - * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module - * check if allow to switch to IBSS mode via concurrent module before setting to IBSS mode - * - * 01 12 2011 cm.chang - * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting - * User-defined bandwidth is for 2.4G and 5G individually - * - * 01 04 2011 cp.wu - * [WCXRP00000342] [MT6620 Wi-Fi][Driver] show error code in scanning list when MAC address is not correctly configured in NVRAM - * show error code 0x10 when MAC address in NVRAM is not configured correctly. - * - * 01 04 2011 cp.wu - * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands - * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure - * - * 12 28 2010 george.huang - * [WCXRP00000232] [MT5931 Wi-Fi][FW] Modifications for updated HW power on sequence and related design - * support WMM-PS U-APSD AC assignment. - * - * 12 28 2010 cp.wu - * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release - * report EEPROM used flag via NIC_CAPABILITY - * - * 12 28 2010 cp.wu - * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release - * integrate with 'EEPROM used' flag for reporting correct capability to Engineer Mode/META and other tools - * - * 12 16 2010 cp.wu - * [WCXRP00000268] [MT6620 Wi-Fi][Driver] correction for WHQL failed items - * correction for OID_802_11_NETWORK_TYPES_SUPPORTED handlers - * - * 12 13 2010 cp.wu - * [WCXRP00000256] [MT6620 Wi-Fi][Driver] Eliminate potential issues which is identified by Klockwork - * suppress warning reported by Klockwork. - * - * 12 07 2010 cm.chang - * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk - * 1. BSSINFO include RLM parameter - * 2. free all sta records when network is disconnected - * - * 12 07 2010 cm.chang - * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant - * 1. Country code is from NVRAM or supplicant - * 2. Change band definition in CMD/EVENT. - * - * 11 30 2010 cp.wu - * [WCXRP00000213] [MT6620 Wi-Fi][Driver] Implement scanning with specified SSID for wpa_supplicant with ap_scan=1 - * . - * - * 11 26 2010 cp.wu - * [WCXRP00000209] [MT6620 Wi-Fi][Driver] Modify NVRAM checking mechanism to warning only with necessary data field checking - * 1. NVRAM error is now treated as warning only, thus normal operation is still available but extra scan result used to indicate user is attached - * 2. DPD and TX-PWR are needed fields from now on, if these 2 fields are not availble then warning message is shown - * - * 11 25 2010 cp.wu - * [WCXRP00000208] [MT6620 Wi-Fi][Driver] Add scanning with specified SSID to AIS FSM - * add scanning with specified SSID facility to AIS-FSM - * - * 11 21 2010 wh.su - * [WCXRP00000192] [MT6620 Wi-Fi][Driver] Fixed fail trying to build connection with Security AP while enable WAPI message check - * Not set the wapi mode while the wapi assoc info set non-wapi ie. - * - * 11 05 2010 wh.su - * [WCXRP00000165] [MT6620 Wi-Fi] [Pre-authentication] Assoc req rsn ie use wrong pmkid value - * fixed the.pmkid value mismatch issue - * - * 11 01 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module - * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead - * 2) Remove CNM CH-RECOVER event handling - * 3) cfg read/write API renamed with kal prefix for unified naming rules. - * - * 10 26 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW] Support NIC capability query command - * 1) update NVRAM content template to ver 1.02 - * 2) add compile option for querying NIC capability (default: off) - * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting - * 4) correct auto-rate compiler error under linux (treat warning as error) - * 5) simplify usage of NVRAM and REG_INFO_T - * 6) add version checking between driver and firmware - * - * 10 22 2010 cp.wu - * [WCXRP00000122] [MT6620 Wi-Fi][Driver] Preparation for YuSu source tree integration - * dos2unix conversion. - * - * 10 20 2010 cp.wu - * [WCXRP00000117] [MT6620 Wi-Fi][Driver] Add logic for suspending driver when MT6620 is not responding anymore - * use OID_CUSTOM_TEST_MODE as indication for driver reset - * by dropping pending TX packets - * - * 10 18 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android - * complete implementation of Android NVRAM access - * - * 10 06 2010 yuche.tsai - * NULL - * Update SLT 5G Test Channel Set. - * - * 10 06 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * code reorganization to improve isolation between GLUE and CORE layers. - * - * 10 06 2010 yuche.tsai - * NULL - * Update For SLT 5G Test Channel Selection Rule. - * - * 10 05 2010 cp.wu - * [WCXRP00000075] [MT6620 Wi-Fi][Driver] Fill query buffer for OID_802_11_BSSID_LIST in 4-bytes aligned form - * Query buffer size needs to be enlarged due to result is filled in 4-bytes alignment boundary - * - * 10 05 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * 1) add NVRAM access API - * 2) fake scanning result when NVRAM doesn't exist and/or version mismatch. (off by compiler option) - * 3) add OID implementation for NVRAM read/write service - * - * 10 04 2010 cp.wu - * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by ENUM_NETWORK_TYPE_INDEX_T only - * remove ENUM_NETWORK_TYPE_T definitions - * - * 10 04 2010 cp.wu - * [WCXRP00000075] [MT6620 Wi-Fi][Driver] Fill query buffer for OID_802_11_BSSID_LIST in 4-bytes aligned form - * Extend result length to multiples of 4-bytes - * - * 09 24 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * eliminate unused variables which lead gcc to argue - * - * 09 24 2010 cp.wu - * [WCXRP00000057] [MT6620 Wi-Fi][Driver] Modify online scan to a run-time switchable feature - * Modify online scan as a run-time adjustable option (for Windows, in registry) - * - * 09 23 2010 cp.wu - * [WCXRP00000051] [MT6620 Wi-Fi][Driver] WHQL test fail in MAC address changed item - * use firmware reported mac address right after wlanAdapterStart() as permanent address - * - * 09 23 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * add skeleton for NVRAM integration - * - * 09 08 2010 cp.wu - * NULL - * use static memory pool for storing IEs of scanning result. - * - * 09 07 2010 yuche.tsai - * NULL - * Update SLT due to API change of SCAN module. - * - * 09 06 2010 cp.wu - * NULL - * Androi/Linux: return current operating channel information - * - * 09 06 2010 cp.wu - * NULL - * 1) initialize for correct parameter even for disassociation. - * 2) AIS-FSM should have a limit on trials to build connection - * - * 09 03 2010 yuche.tsai - * NULL - * Refine SLT IO control handler. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 09 01 2010 wh.su - * NULL - * adding the wapi support for integration test. - * - * 08 30 2010 chinglan.wang - * NULL - * Modify the rescan condition. - * - * 08 29 2010 yuche.tsai - * NULL - * Finish SLT TX/RX & Rate Changing Support. - * - * 08 27 2010 chinglan.wang - * NULL - * Update configuration for MT6620_E1_PRE_ALPHA_1832_0827_2010 - * - * 08 25 2010 george.huang - * NULL - * update OID/ registry control path for PM related settings - * - * 08 24 2010 cp.wu - * NULL - * 1) initialize variable for enabling short premable/short time slot. - * 2) add compile option for disabling online scan - * - * 08 16 2010 george.huang - * NULL - * . - * - * 08 16 2010 george.huang - * NULL - * upate params defined in CMD_SET_NETWORK_ADDRESS_LIST - * - * 08 04 2010 cp.wu - * NULL - * fix for check build WHQL testing: - * 1) do not assert query buffer if indicated buffer length is zero - * 2) sdio.c has bugs which cause freeing same pointer twice - * - * 08 04 2010 cp.wu - * NULL - * revert changelist #15371, efuse read/write access will be done by RF test approach - * - * 08 04 2010 cp.wu - * NULL - * add OID definitions for EFUSE read/write access. - * - * 08 04 2010 george.huang - * NULL - * handle change PS mode OID/ CMD - * - * 08 04 2010 cp.wu - * NULL - * add an extra parameter to rftestQueryATInfo 'cause it's necessary to pass u4FuncData for query request. - * - * 08 04 2010 cp.wu - * NULL - * bypass u4FuncData for RF-Test query request as well. - * - * 08 04 2010 yarco.yang - * NULL - * Add TX_AMPDU and ADDBA_REJECT command - * - * 08 03 2010 cp.wu - * NULL - * surpress compilation warning. - * - * 08 02 2010 george.huang - * NULL - * add WMM-PS test related OID/ CMD handlers - * - * 07 29 2010 cp.wu - * NULL - * eliminate u4FreqInKHz usage, combined into rConnections.ucAdHoc* - * - * 07 28 2010 cp.wu - * NULL - * 1) eliminate redundant variable eOPMode in prAdapter->rWlanInfo - * 2) change nicMediaStateChange() API prototype - * - * 07 26 2010 cp.wu - * - * re-commit code logic being overwriten. - * - * 07 24 2010 wh.su - * - * .support the Wi-Fi RSN - * - * 07 21 2010 cp.wu - * - * 1) change BG_SCAN to ONLINE_SCAN for consistent term - * 2) only clear scanning result when scan is permitted to do - * - * 07 20 2010 cp.wu - * - * 1) [AIS] when new scan is issued, clear currently available scanning result except the connected one - * 2) refine disconnection behaviour when issued during BG-SCAN process - * - * 07 19 2010 wh.su - * - * modify the auth and encry status variable. - * - * 07 16 2010 cp.wu - * - * remove work-around in case SCN is not available. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 05 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) change fake BSS_DESC from channel 6 to channel 1 due to channel switching is not done yet. - * 2) after MAC address is queried from firmware, all related variables in driver domain should be updated as well - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * AIS-FSM integration with CNM channel request messages - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * implementation of DRV-SCN and related mailbox message handling. - * - * 06 29 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) sync to. CMD/EVENT document v0.03 - * 2) simplify DTIM period parsing in scan.c only, bss.c no longer parses it again. - * 3) send command packet to indicate FW-PM after - * a) 1st beacon is received after AIS has connected to an AP - * b) IBSS-ALONE has been created - * c) IBSS-MERGE has occured - * - * 06 25 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add API in que_mgt to retrieve sta-rec index for security frames. - * - * 06 24 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 802.1x and bluetooth-over-Wi-Fi security frames are now delievered to firmware via command path instead of data path. - * - * 06 23 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) add SCN compilation option. - * 2) when SCN is not turned on, BSSID_SCAN will generate a fake entry for 1st connection - * - * 06 23 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * implement SCAN-REQUEST oid as mailbox message dispatching. - * - * 06 23 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * integrate . - * - * 06 22 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) add command warpper for STA-REC/BSS-INFO sync. - * 2) enhance command packet sending procedure for non-oid part - * 3) add command packet definitions for STA-REC/BSS-INFO sync. - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * remove duplicate variable for migration. - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * adding the compiling flag for oid pmkid. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * enable RX management frame handling. - * - * 06 18 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * migration the security related function from firmware. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) eliminate CFG_CMD_EVENT_VERSION_0_9 - * 2) when disconnected, indicate nic directly (no event is needed) - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge wlan_def.h. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge wifi_var.h, precomp.h, cnm_timer.h (data type only) - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 06 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * move timer callback to glue layer. - * - * 05 28 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * simplify cmd packet sending for RF test and MCR access OIDs - * - * 05 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * disable radio even when STA is not associated. - * - * 05 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct 2 OID behaviour to meet WHQL requirement. - * - * 05 26 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * 1) Modify set mac address code - * 2) remove power managment macro - * - * 05 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct BSSID_LIST oid when radio if turned off. - * - * 05 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) when acquiring LP-own, write for clr-own with lower frequency compared to read poll - * 2) correct address list parsing - * - * 05 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * disable wlanoidSetNetworkAddress() temporally. - * - * 05 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * some OIDs should be DRIVER_CORE instead of GLUE_EXTENSION - * - * 05 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) disable NETWORK_LAYER_ADDRESSES handling temporally. - * 2) finish statistics OIDs - * - * 05 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * change OID behavior to meet WHQL requirement. - * - * 05 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS - * 2) buffer statistics data for 2 seconds - * 3) use default value for adhoc parameters instead of 0 - * - * 05 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) do not take timeout mechanism for power mode oids - * 2) retrieve network type from connection status - * 3) after disassciation, set radio state to off - * 4) TCP option over IPv6 is supported - * - * 05 18 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement Wakeup-on-LAN except firmware integration part - * - * 05 17 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct wlanoidSet802dot11PowerSaveProfile implementation. - * - * 05 17 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) enable CMD/EVENT ver 0.9 definition. - * 2) abandon use of ENUM_MEDIA_STATE - * - * 05 17 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct OID_802_11_DISASSOCIATE handling. - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * 1) add timeout handler mechanism for pending command packets - * 2) add p2p add/removal key - * - * 05 14 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * Add dissassocation support for wpa supplicant - * - * 05 14 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct return value. - * - * 05 13 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add NULL OID implementation for WOL-related OIDs. - * - * 05 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * for disassociation, still use parameter with current setting. - * - * 05 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * for disassociation, generate a WZC-compatible invalid SSID. - * - * 05 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * associate to illegal SSID when handling OID_802_11_DISASSOCIATE - * - * 04 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * reserve field of privacy filter and RTS threshold setting. - * - * 04 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * surpress compiler warning - * - * 04 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * . - * - * 04 22 2010 cp.wu - * [WPD00003830]add OID_802_11_PRIVACY_FILTER support - * enable RX filter OID - * - * 04 19 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * Add ioctl of power management - * - * 04 14 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * information buffer for query oid/ioctl is now buffered in prCmdInfo - * * instead of glue-layer variable to improve multiple oid/ioctl capability - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * 2) command sequence number is now increased atomically - * * * * 3) private data could be hold and taken use for other purpose - * - * 04 12 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct OID_802_11_CONFIGURATION query for infrastructure mode. - * - * 04 09 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * 1) remove unused spin lock declaration - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * finish non-glue layer access to glue variables - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * rWlanInfo should be placed at adapter rather than glue due to most operations - * * are done in adapter layer. - * - * 04 07 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * (1)improve none-glue code portability - * (2) disable set Multicast address during atomic context - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access to prGlueInfo->eParamMediaStateIndicated from non-glue layer - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * ePowerCtrl is not necessary as a glue variable. - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access to prGlueInfo->rWlanInfo.eLinkAttr.ucMediaStreamMode from non-glue layer. - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * improve none-glue code portability - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * code refine: fgTestMode should be at adapter rather than glue due to the device/fw is also involved - * - * 04 01 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * . - * - * 03 31 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * modify the wapi related code for new driver's design. - * - * 03 30 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * statistics information OIDs are now handled by querying from firmware domain - * - * 03 28 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * improve glue code portability - * - * 03 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * indicate media stream mode after set is done - * - * 03 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add a temporary flag for integration with CMD/EVENT v0.9. - * - * 03 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) correct OID_802_11_CONFIGURATION with frequency setting behavior. - * the frequency is used for adhoc connection only - * 2) update with SD1 v0.9 CMD/EVENT documentation - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * [WPD00003826] Initial import for Linux port - * initial import for Linux port - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port - * - * 03 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * generate information for OID_GEN_RCV_OK & OID_GEN_XMIT_OK - * - * - * 03 22 2010 cp.wu - * [WPD00003824][MT6620 Wi-Fi][New Feature] Add support of large scan list - * Implement feature needed by CR: WPD00003824: refining association command by pasting scanning result - * - * 03 19 2010 wh.su - * [WPD00003820][MT6620 Wi-Fi] Modify the code for meet the WHQL test - * adding the check for pass WHQL test item. - * - * 03 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) add ACPI D0/D3 state switching support - * * 2) use more formal way to handle interrupt when the status is retrieved from enhanced RX response - * -* 03 16 2010 wh.su - * [WPD00003820][MT6620 Wi-Fi] Modify the code for meet the WHQL test - * fixed some whql pre-test fail case. - * - * 03 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement custom OID: EEPROM read/write access - * - * 03 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement OID_802_3_MULTICAST_LIST oid handling - * - * 03 02 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) the use of prPendingOid revised, all accessing are now protected by spin lock - * * 2) ensure wlanReleasePendingOid will clear all command queues - * - * 02 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * send CMD_ID_INFRASTRUCTURE when handling OID_802_11_INFRASTRUCTURE_MODE set. - * - * 02 24 2010 wh.su - * [WPD00003820][MT6620 Wi-Fi] Modify the code for meet the WHQL test - * Don't needed to check the auth mode, WHQL testing not specific at auth wpa2. - * - * 02 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * do not check SSID validity anymore. - * - * 02 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add checksum offloading support. - * - * 02 09 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address - * * 2. follow MSDN defined behavior when associates to another AP - * * 3. for firmware download, packet size could be up to 2048 bytes - * - * 02 09 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * move ucCmdSeqNum as instance variable - * - * 02 04 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * when OID_CUSTOM_OID_INTERFACE_VERSION is queried, do modify connection states - * - * 01 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) implement timeout mechanism when OID is pending for longer than 1 second - * * 2) allow OID_802_11_CONFIGURATION to be executed when RF test mode is turned on - * - * 01 27 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * . - * - * 01 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. eliminate improper variable in rHifInfo - * * 2. block TX/ordinary OID when RF test mode is engaged - * * 3. wait until firmware finish operation when entering into and leaving from RF test mode - * * 4. correct some HAL implementation - * - * 01 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement following 802.11 OIDs: - * OID_802_11_RSSI, - * OID_802_11_RSSI_TRIGGER, - * OID_802_11_STATISTICS, - * OID_802_11_DISASSOCIATE, - * OID_802_11_POWER_MODE - * - * 01 21 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement OID_802_11_MEDIA_STREAM_MODE - * - * 01 21 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement OID_802_11_SUPPORTED_RATES / OID_802_11_DESIRED_RATES - * - * 01 21 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * do not fill ucJoinOnly currently - * - * 01 14 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * enable to connect to ad-hoc network - * - * 01 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * .implement Set/Query BeaconInterval/AtimWindow - * - * 01 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * .Set/Get AT Info is not blocked even when driver is not in fg test mode - * - * 12 30 2009 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) According to CMD/EVENT documentation v0.8, - * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used, - * and result is retrieved by get ATInfo instead - * 2) add 4 counter for recording aggregation statistics - * - * 12 28 2009 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate redundant variables for connection_state -** \main\maintrunk.MT6620WiFiDriver_Prj\32 2009-12-16 22:13:36 GMT mtk02752 -** change hard-coded MAC address to match with FW (temporally) -** \main\maintrunk.MT6620WiFiDriver_Prj\31 2009-12-10 16:49:50 GMT mtk02752 -** code clean -** \main\maintrunk.MT6620WiFiDriver_Prj\30 2009-12-08 17:38:49 GMT mtk02752 -** + add OID for RF test -** * MCR RD/WR are modified to match with cmd/event definition -** \main\maintrunk.MT6620WiFiDriver_Prj\29 2009-12-08 11:32:20 GMT mtk02752 -** add skeleton for RF test implementation -** \main\maintrunk.MT6620WiFiDriver_Prj\28 2009-12-03 16:43:24 GMT mtk01461 -** Modify query SCAN list oid by adding prEventScanResult -** -** \main\maintrunk.MT6620WiFiDriver_Prj\27 2009-12-03 16:39:27 GMT mtk01461 -** Sync CMD data structure in set ssid oid -** \main\maintrunk.MT6620WiFiDriver_Prj\26 2009-12-03 16:28:22 GMT mtk01461 -** Add invalid check of set SSID oid and fix query scan list oid -** \main\maintrunk.MT6620WiFiDriver_Prj\25 2009-11-30 17:33:08 GMT mtk02752 -** implement wlanoidSetInfrastructureMode/wlanoidQueryInfrastructureMode -** \main\maintrunk.MT6620WiFiDriver_Prj\24 2009-11-30 10:53:49 GMT mtk02752 -** 1st DW of WIFI_CMD_T is shared with HIF_TX_HEADER_T -** \main\maintrunk.MT6620WiFiDriver_Prj\23 2009-11-30 09:22:48 GMT mtk02752 -** correct wifi cmd length mismatch -** \main\maintrunk.MT6620WiFiDriver_Prj\22 2009-11-25 21:34:33 GMT mtk02752 -** sync EVENT_SCAN_RESULT_T with firmware -** \main\maintrunk.MT6620WiFiDriver_Prj\21 2009-11-25 21:03:27 GMT mtk02752 -** implement wlanoidQueryBssidList() -** \main\maintrunk.MT6620WiFiDriver_Prj\20 2009-11-25 18:17:17 GMT mtk02752 -** refine GL_WLAN_INFO_T for buffering scan result -** \main\maintrunk.MT6620WiFiDriver_Prj\19 2009-11-23 20:28:51 GMT mtk02752 -** some OID will be set to WLAN_STATUS_PENDING until it is sent via wlanSendCommand() -** \main\maintrunk.MT6620WiFiDriver_Prj\18 2009-11-23 17:56:36 GMT mtk02752 -** implement wlanoidSetBssidListScan(), wlanoidSetBssid() and wlanoidSetSsid() -** -** \main\maintrunk.MT6620WiFiDriver_Prj\17 2009-11-13 17:20:53 GMT mtk02752 -** add Set BSSID/SSID path but disabled temporally due to FW is not ready yet -** \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-11-13 12:28:58 GMT mtk02752 -** add wlanoidSetBssidListScan -> cmd_info path -** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-11-09 22:48:07 GMT mtk01084 -** modify test cases entry -** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-11-04 14:10:58 GMT mtk01084 -** add new test interfaces -** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-10-30 18:17:10 GMT mtk01084 -** fix compiler warning -** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-10-29 19:46:26 GMT mtk01084 -** add test functions -** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-10-23 16:07:56 GMT mtk01084 -** include new file -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-10-13 21:58:29 GMT mtk01084 -** modify for new HW architecture -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-10-02 13:48:49 GMT mtk01725 -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-09-09 17:26:04 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-04-21 12:09:50 GMT mtk01461 -** Update for MCR Write OID -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-21 09:35:18 GMT mtk01461 -** Update wlanoidQueryMcrRead() for composing CMD_INFO_T -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-04-17 18:09:51 GMT mtk01426 -** Remove kalIndicateStatusAndComplete() in wlanoidQueryOidInterfaceVersion() -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-04-14 15:51:50 GMT mtk01426 -** Add MCR read/write support -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-19 18:32:40 GMT mtk01084 -** update for basic power management functions -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:06:31 GMT mtk01426 -** Init for develop -** -*/ - -/****************************************************************************** -* C O M P I L E R F L A G S -******************************************************************************* -*/ - -/****************************************************************************** -* E X T E R N A L R E F E R E N C E S -******************************************************************************* -*/ -#include "precomp.h" -#include "mgmt/rsn.h" - -#include - -/****************************************************************************** -* C O N S T A N T S -******************************************************************************* -*/ -#define NVRAM_ERROR_VERSION_MISMATCH BIT(1) -#define NVRAM_ERROR_INVALID_TXPWR BIT(2) -#define NVRAM_ERROR_INVALID_DPD BIT(3) -#define NVRAM_ERROR_INVALID_MAC_ADDR BIT(4) - -/****************************************************************************** -* D A T A T Y P E S -******************************************************************************* -*/ - -/****************************************************************************** -* P U B L I C D A T A -******************************************************************************* -*/ -#if DBG -extern UINT_8 aucDebugModule[DBG_MODULE_NUM]; -extern UINT_32 u4DebugModule; -UINT_32 u4DebugModuleTemp; -#endif /* DBG */ - -#if RSSI_ENHANCE -int numOfTblRssi; -TABLE_RSSI mTABLE_RSSI[MAX_SCAN_RSSI_NUM]; -int mTblRssiStatus[MAX_SCAN_RSSI_NUM]; - -void initScanRssiHistory(void) -{ - int i; - numOfTblRssi = 0; - memset(mTABLE_RSSI, 0, MAX_SCAN_RSSI_NUM*sizeof(TABLE_RSSI)); - for(i = 0; i < MAX_SCAN_RSSI_NUM; i++) { - mTblRssiStatus[i] = 0; - } -} -#endif - -/****************************************************************************** -* P R I V A T E D A T A -******************************************************************************* -*/ - -/****************************************************************************** -* M A C R O S -******************************************************************************* -*/ - -/****************************************************************************** -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************* -*/ -extern int sprintf(char * buf, const char * fmt, ...); - -/****************************************************************************** -* F U N C T I O N S -******************************************************************************* -*/ -#if CFG_ENABLE_STATISTICS_BUFFERING -static BOOLEAN -IsBufferedStatisticsUsable( - P_ADAPTER_T prAdapter) -{ - ASSERT(prAdapter); - - if(prAdapter->fgIsStatValid == TRUE && - (kalGetTimeTick() - prAdapter->rStatUpdateTime) <= CFG_STATISTICS_VALID_CYCLE) - return TRUE; - else - return FALSE; -} -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the supported physical layer network -* type that can be used by the driver. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryNetworkTypesSupported ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - UINT_32 u4NumItem = 0; - ENUM_PARAM_NETWORK_TYPE_T eSupportedNetworks[PARAM_NETWORK_TYPE_NUM]; - PPARAM_NETWORK_TYPE_LIST prSupported; - - /* The array of all physical layer network subtypes that the driver supports. */ - - DEBUGFUNC("wlanoidQueryNetworkTypesSupported"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - /* Init. */ - for (u4NumItem = 0; u4NumItem < PARAM_NETWORK_TYPE_NUM ; u4NumItem++) { - eSupportedNetworks[u4NumItem] = 0; - } - - u4NumItem = 0; - - eSupportedNetworks[u4NumItem] = PARAM_NETWORK_TYPE_DS; - u4NumItem ++; - - eSupportedNetworks[u4NumItem] = PARAM_NETWORK_TYPE_OFDM24; - u4NumItem ++; - - *pu4QueryInfoLen = - (UINT_32)OFFSET_OF(PARAM_NETWORK_TYPE_LIST, eNetworkType) + - (u4NumItem * sizeof(ENUM_PARAM_NETWORK_TYPE_T)); - - if (u4QueryBufferLen < *pu4QueryInfoLen) { - return WLAN_STATUS_INVALID_LENGTH; - } - - prSupported = (PPARAM_NETWORK_TYPE_LIST)pvQueryBuffer; - prSupported->NumberOfItems = u4NumItem; - kalMemCopy(prSupported->eNetworkType, - eSupportedNetworks, - u4NumItem * sizeof(ENUM_PARAM_NETWORK_TYPE_T)); - - DBGLOG(REQ, TRACE, ("NDIS supported network type list: %ld\n", - prSupported->NumberOfItems)); - DBGLOG_MEM8(REQ, INFO, prSupported, *pu4QueryInfoLen); - - return WLAN_STATUS_SUCCESS; -} /* wlanoidQueryNetworkTypesSupported */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the current physical layer network -* type used by the driver. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the -* call failed due to invalid length of the query -* buffer, returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryNetworkTypeInUse ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - // TODO: need to check the OID handler content again!! - - ENUM_PARAM_NETWORK_TYPE_T rCurrentNetworkTypeInUse = PARAM_NETWORK_TYPE_OFDM24; - - DEBUGFUNC("wlanoidQueryNetworkTypeInUse"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - if (u4QueryBufferLen < sizeof(ENUM_PARAM_NETWORK_TYPE_T)) { - *pu4QueryInfoLen = sizeof(ENUM_PARAM_NETWORK_TYPE_T); - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - - if (kalGetMediaStateIndicated(prAdapter->prGlueInfo) == PARAM_MEDIA_STATE_CONNECTED) { - rCurrentNetworkTypeInUse = - (ENUM_PARAM_NETWORK_TYPE_T)(prAdapter->rWlanInfo.ucNetworkType); - } - else { - rCurrentNetworkTypeInUse = - (ENUM_PARAM_NETWORK_TYPE_T)(prAdapter->rWlanInfo.ucNetworkTypeInUse); - } - - *(P_ENUM_PARAM_NETWORK_TYPE_T)pvQueryBuffer = rCurrentNetworkTypeInUse; - *pu4QueryInfoLen = sizeof(ENUM_PARAM_NETWORK_TYPE_T); - - DBGLOG(REQ, TRACE, ("Network type in use: %d\n", rCurrentNetworkTypeInUse)); - - return WLAN_STATUS_SUCCESS; -} /* wlanoidQueryNetworkTypeInUse */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set the physical layer network type used -* by the driver. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns the -* amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS The given network type is supported and accepted. -* \retval WLAN_STATUS_INVALID_DATA The given network type is not in the -* supported list. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetNetworkTypeInUse ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - // TODO: need to check the OID handler content again!! - - ENUM_PARAM_NETWORK_TYPE_T eNewNetworkType; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - DEBUGFUNC("wlanoidSetNetworkTypeInUse"); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - if (u4SetBufferLen < sizeof(ENUM_PARAM_NETWORK_TYPE_T)) { - *pu4SetInfoLen = sizeof(ENUM_PARAM_NETWORK_TYPE_T); - return WLAN_STATUS_INVALID_LENGTH; - } - - eNewNetworkType = *(P_ENUM_PARAM_NETWORK_TYPE_T)pvSetBuffer; - *pu4SetInfoLen = sizeof(ENUM_PARAM_NETWORK_TYPE_T); - - DBGLOG(REQ, - INFO, - ("New network type: %d mode\n", eNewNetworkType)); - - switch (eNewNetworkType) { - - case PARAM_NETWORK_TYPE_DS: - prAdapter->rWlanInfo.ucNetworkTypeInUse = (UINT_8) PARAM_NETWORK_TYPE_DS; - break; - - case PARAM_NETWORK_TYPE_OFDM5: - prAdapter->rWlanInfo.ucNetworkTypeInUse = (UINT_8) PARAM_NETWORK_TYPE_OFDM5; - break; - - case PARAM_NETWORK_TYPE_OFDM24: - prAdapter->rWlanInfo.ucNetworkTypeInUse = (UINT_8) PARAM_NETWORK_TYPE_OFDM24; - break; - - case PARAM_NETWORK_TYPE_AUTOMODE: - prAdapter->rWlanInfo.ucNetworkTypeInUse = (UINT_8) PARAM_NETWORK_TYPE_AUTOMODE; - break; - - case PARAM_NETWORK_TYPE_FH: - DBGLOG(REQ, INFO, ("Not support network type: %d\n", eNewNetworkType)); - rStatus = WLAN_STATUS_NOT_SUPPORTED; - break; - - default: - DBGLOG(REQ, INFO, ("Unknown network type: %d\n", eNewNetworkType)); - rStatus = WLAN_STATUS_INVALID_DATA; - break; - } - - /* Verify if we support the new network type. */ - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, WARN, ("Unknown network type: %d\n", eNewNetworkType)); - } - - return rStatus; -} /* wlanoidSetNetworkTypeInUse */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the current BSSID. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryBssid ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - - DEBUGFUNC("wlanoidQueryBssid"); - - ASSERT(prAdapter); - - if (u4QueryBufferLen < MAC_ADDR_LEN) { - ASSERT(pu4QueryInfoLen); - *pu4QueryInfoLen = MAC_ADDR_LEN; - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - ASSERT(u4QueryBufferLen >= MAC_ADDR_LEN); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - if(kalGetMediaStateIndicated(prAdapter->prGlueInfo) == PARAM_MEDIA_STATE_CONNECTED) { - kalMemCopy(pvQueryBuffer, prAdapter->rWlanInfo.rCurrBssId.arMacAddress, MAC_ADDR_LEN); - } - else if(prAdapter->rWifiVar.rConnSettings.eOPMode == NET_TYPE_IBSS) { - PARAM_MAC_ADDRESS aucTemp; /*!< BSSID */ - COPY_MAC_ADDR(aucTemp, prAdapter->rWlanInfo.rCurrBssId.arMacAddress); - aucTemp[0] &= ~BIT(0); - aucTemp[1] |= BIT(1); - COPY_MAC_ADDR(pvQueryBuffer, aucTemp); - } - else { - rStatus = WLAN_STATUS_ADAPTER_NOT_READY; - } - - *pu4QueryInfoLen = MAC_ADDR_LEN; - return rStatus; -} /* wlanoidQueryBssid */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the list of all BSSIDs detected by -* the driver. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryBssidList ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ -#if (CFG_NVRAM_EXISTENCE_CHECK == 1) || (CFG_SW_NVRAM_VERSION_CHECK == 1) - const UINT_8 aucZeroMacAddr[] = NULL_MAC_ADDR; - BOOLEAN fgIsConfExist = TRUE; - P_REG_INFO_T prRegInfo; -#endif - - P_GLUE_INFO_T prGlueInfo; - UINT_32 i,j, u4BssidListExLen; - P_PARAM_BSSID_LIST_EX_T prList; - P_PARAM_BSSID_EX_T prBssidEx; - PUINT_8 cp; - BOOLEAN bInitial = TRUE; - - DEBUGFUNC("wlanoidQueryBssidList"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - - if(!pvQueryBuffer) { - return WLAN_STATUS_INVALID_DATA; - } - } - - prGlueInfo = prAdapter->prGlueInfo; - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in qeury BSSID list! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - u4BssidListExLen = 0; - - if(prAdapter->fgIsRadioOff == FALSE) { - for(i = 0 ; i < prAdapter->rWlanInfo.u4ScanResultNum ; i++) { - u4BssidListExLen += ALIGN_4(prAdapter->rWlanInfo.arScanResult[i].u4Length); - } - } - -#if (CFG_NVRAM_EXISTENCE_CHECK == 1) - if(kalIsConfigurationExist(prAdapter->prGlueInfo) == FALSE) { - fgIsConfExist = FALSE; - u4BssidListExLen += OFFSET_OF(PARAM_BSSID_EX_T, aucIEs); - } -#endif - -#if (CFG_SW_NVRAM_VERSION_CHECK == 1) - prRegInfo = kalGetConfiguration(prGlueInfo); - - if(fgIsConfExist == TRUE && - (CFG_DRV_OWN_VERSION < prAdapter->rVerInfo.u2Part1CfgPeerVersion - || CFG_DRV_OWN_VERSION < prAdapter->rVerInfo.u2Part2CfgPeerVersion - || prAdapter->rVerInfo.u2Part1CfgOwnVersion < CFG_DRV_PEER_VERSION - || prAdapter->rVerInfo.u2Part2CfgOwnVersion < CFG_DRV_PEER_VERSION /* NVRAM */ - || CFG_DRV_OWN_VERSION < prAdapter->rVerInfo.u2FwPeerVersion - || prAdapter->rVerInfo.u2FwOwnVersion < CFG_DRV_PEER_VERSION - || (prAdapter->fgIsEmbbededMacAddrValid == FALSE && - (IS_BMCAST_MAC_ADDR(prRegInfo->aucMacAddr) - || EQUAL_MAC_ADDR(aucZeroMacAddr, prRegInfo->aucMacAddr))) - || prRegInfo->ucTxPwrValid == 0)) { - u4BssidListExLen += OFFSET_OF(PARAM_BSSID_EX_T, aucIEs); - } -#endif - - if(u4BssidListExLen) { - u4BssidListExLen += 4; // u4NumberOfItems. - } - else { - u4BssidListExLen = sizeof(PARAM_BSSID_LIST_EX_T); - } - - *pu4QueryInfoLen = u4BssidListExLen; - - if (u4QueryBufferLen < *pu4QueryInfoLen) { - return WLAN_STATUS_INVALID_LENGTH; - } - - /* Clear the buffer */ - kalMemZero(pvQueryBuffer, u4BssidListExLen); - - prList = (P_PARAM_BSSID_LIST_EX_T) pvQueryBuffer; - cp = (PUINT_8)&prList->arBssid[0]; - - - if(prAdapter->fgIsRadioOff == FALSE && prAdapter->rWlanInfo.u4ScanResultNum > 0) { - // fill up for each entry - for(i = 0 ; i < prAdapter->rWlanInfo.u4ScanResultNum ; i++) { - prBssidEx = (P_PARAM_BSSID_EX_T)cp; - - // copy structure - kalMemCopy(prBssidEx, - &(prAdapter->rWlanInfo.arScanResult[i]), - OFFSET_OF(PARAM_BSSID_EX_T, aucIEs)); - -#if RSSI_ENHANCE - bInitial = TRUE; - -// printk(KERN_INFO "%s::first prAdapter->rWlanInfo.arScanResult[i].AvgRssiX8 = %d, prBssidEx->rRssi= %d\n", __func__, prAdapter->rWlanInfo.arScanResult[i].AvgRssiX8, prBssidEx->rRssi); - for(j=0;jrWlanInfo.u4ScanResultNum;j++) - { - if(EQUAL_MAC_ADDR(&(prAdapter->rWlanInfo.arScanResult[i].arMacAddress), mTABLE_RSSI[j].arMacAddress)) - { - bInitial = FALSE; - prBssidEx->AvgRssiX8 = mTABLE_RSSI[j].AvgRssiX8; - prBssidEx->AvgRssi = mTABLE_RSSI[j].AvgRssi; - break; - } - } - - if (bInitial) - { - prBssidEx->AvgRssiX8 = prBssidEx->rRssi << 3; - prBssidEx->AvgRssi = prBssidEx->rRssi; - //printk(KERN_INFO "%s:: bInitial --- prBssidEx->AvgRssiX8 = %d, prBssidEx->AvgRssi = %d, prBssidEx->rRssi= %d\n", __func__, prBssidEx->AvgRssiX8, prBssidEx->AvgRssi, prBssidEx->rRssi); - } else { - prBssidEx->AvgRssiX8 = (prBssidEx->AvgRssiX8 - prBssidEx->AvgRssi) + prBssidEx->rRssi; - //printk(KERN_INFO "%s:: prBssidEx->AvgRssiX8 = %d, prBssidEx->AvgRssi = %d, prBssidEx->rRssi= %d\n", __func__, prBssidEx->AvgRssiX8, prBssidEx->AvgRssi, prBssidEx->rRssi); - } - - prBssidEx->AvgRssi = prBssidEx->AvgRssiX8 >> 3; - //prBssidEx->AvgRssi +=8; - prBssidEx->rRssi = prBssidEx->AvgRssi + 10; - prAdapter->rWlanInfo.arScanResult[i].rRssi = prBssidEx->AvgRssi; -#endif - /*For WHQL test, Rssi should be in range -10 ~ -200 dBm*/ - if(prBssidEx->rRssi > PARAM_WHQL_RSSI_MAX_DBM) { - prBssidEx->rRssi = PARAM_WHQL_RSSI_MAX_DBM; - } - - if(prAdapter->rWlanInfo.arScanResult[i].u4IELength > 0) { - // copy IEs - kalMemCopy(prBssidEx->aucIEs, - prAdapter->rWlanInfo.apucScanResultIEs[i], - prAdapter->rWlanInfo.arScanResult[i].u4IELength); - } - - // 4-bytes alignement - prBssidEx->u4Length = ALIGN_4(prBssidEx->u4Length); - - cp += prBssidEx->u4Length; - prList->u4NumberOfItems++; - } -#if RSSI_ENHANCE - for(i = 0 ; i < prAdapter->rWlanInfo.u4ScanResultNum ; i++) - { - COPY_MAC_ADDR(mTABLE_RSSI[i].arMacAddress,prAdapter->rWlanInfo.arScanResult[i].arMacAddress); - mTABLE_RSSI[i].AvgRssi = prAdapter->rWlanInfo.arScanResult[i].rRssi; - mTABLE_RSSI[i].AvgRssiX8= prAdapter->rWlanInfo.arScanResult[i].rRssi << 3; - } - for(i = prAdapter->rWlanInfo.u4ScanResultNum ; i < MAX_SCAN_RSSI_NUM ; i++) - { - mTABLE_RSSI[i].arMacAddress[0]=0; - mTABLE_RSSI[i].arMacAddress[1]=0; - mTABLE_RSSI[i].arMacAddress[2]=0; - mTABLE_RSSI[i].arMacAddress[3]=0; - mTABLE_RSSI[i].arMacAddress[4]=0; - mTABLE_RSSI[i].arMacAddress[5]=0; - } -#endif - } - -#if (CFG_NVRAM_EXISTENCE_CHECK == 1) - #define NVRAM_ERR_MSG "NVRAM WARNING: Err = 0x01" - if(kalIsConfigurationExist(prAdapter->prGlueInfo) == FALSE) { - prBssidEx = (P_PARAM_BSSID_EX_T)cp; - - /* generate fake result as error message */ - i = prAdapter->rWlanInfo.u4ScanResultNum; - - // zero - kalMemZero(prBssidEx, OFFSET_OF(PARAM_BSSID_EX_T, aucIEs)); - - // then fill buffer - COPY_MAC_ADDR(prBssidEx->arMacAddress, aucZeroMacAddr); - COPY_SSID(prBssidEx->rSsid.aucSsid, - prBssidEx->rSsid.u4SsidLen, - NVRAM_ERR_MSG, - strlen(NVRAM_ERR_MSG)); - prBssidEx->u4Privacy = 0; - prBssidEx->rRssi = 0; - prBssidEx->eNetworkTypeInUse = PARAM_NETWORK_TYPE_FH; - prBssidEx->rConfiguration.u4Length = sizeof(PARAM_802_11_CONFIG_T); - prBssidEx->rConfiguration.u4BeaconPeriod = 100; - prBssidEx->rConfiguration.u4ATIMWindow = 1; - prBssidEx->rConfiguration.u4DSConfig = 2412000; - prBssidEx->rConfiguration.rFHConfig.u4Length = sizeof(PARAM_802_11_CONFIG_FH_T); - prBssidEx->eOpMode = BSS_TYPE_INFRASTRUCTURE; - prBssidEx->u4IELength = 0; - - /* move to next entry */ - prBssidEx->u4Length = OFFSET_OF(PARAM_BSSID_EX_T, aucIEs); - cp += prBssidEx->u4Length; - prList->u4NumberOfItems++; - } -#endif - -#if (CFG_SW_NVRAM_VERSION_CHECK == 1) - #define VER_ERR_MSG "NVRAM WARNING: Err = 0x%02X" - if(fgIsConfExist == TRUE) { - UINT_32 u4ErrCode = 0; - - if((CFG_DRV_OWN_VERSION < prAdapter->rVerInfo.u2Part1CfgPeerVersion - || CFG_DRV_OWN_VERSION < prAdapter->rVerInfo.u2Part2CfgPeerVersion - || prAdapter->rVerInfo.u2Part1CfgOwnVersion < CFG_DRV_PEER_VERSION - || prAdapter->rVerInfo.u2Part2CfgOwnVersion < CFG_DRV_PEER_VERSION /* NVRAM */ - || CFG_DRV_OWN_VERSION < prAdapter->rVerInfo.u2FwPeerVersion - || prAdapter->rVerInfo.u2FwOwnVersion < CFG_DRV_PEER_VERSION)) { - u4ErrCode |= NVRAM_ERROR_VERSION_MISMATCH; - } - - - if(prRegInfo->ucTxPwrValid == 0) { - u4ErrCode |= NVRAM_ERROR_INVALID_TXPWR; - } - - if(prAdapter->fgIsEmbbededMacAddrValid == FALSE && - (IS_BMCAST_MAC_ADDR(prRegInfo->aucMacAddr) || EQUAL_MAC_ADDR(aucZeroMacAddr, prRegInfo->aucMacAddr))) { - u4ErrCode |= NVRAM_ERROR_INVALID_MAC_ADDR; - } - - if(u4ErrCode != 0) { - UINT_8 aucErrMsg[32]; - prBssidEx = (P_PARAM_BSSID_EX_T)cp; - - // zero - kalMemZero(prBssidEx, OFFSET_OF(PARAM_BSSID_EX_T, aucIEs)); - - // then fill buffer - COPY_MAC_ADDR(prBssidEx->arMacAddress, aucZeroMacAddr); - - sprintf(aucErrMsg, VER_ERR_MSG, (unsigned int)u4ErrCode); - COPY_SSID(prBssidEx->rSsid.aucSsid, - prBssidEx->rSsid.u4SsidLen, - aucErrMsg, - strlen(aucErrMsg)); - - prBssidEx->u4Privacy = 0; - prBssidEx->rRssi = 0; - prBssidEx->eNetworkTypeInUse = PARAM_NETWORK_TYPE_FH; - prBssidEx->rConfiguration.u4Length = sizeof(PARAM_802_11_CONFIG_T); - prBssidEx->rConfiguration.u4BeaconPeriod = 100; - prBssidEx->rConfiguration.u4ATIMWindow = 1; - prBssidEx->rConfiguration.u4DSConfig = 2412000; - prBssidEx->rConfiguration.rFHConfig.u4Length = sizeof(PARAM_802_11_CONFIG_FH_T); - prBssidEx->eOpMode = BSS_TYPE_INFRASTRUCTURE; - prBssidEx->u4IELength = 0; - - /* move to next entry */ - prBssidEx->u4Length = OFFSET_OF(PARAM_BSSID_EX_T, aucIEs); - cp += prBssidEx->u4Length; - prList->u4NumberOfItems++; - } - } -#endif - - return WLAN_STATUS_SUCCESS; -} /* wlanoidQueryBssidList */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to request the driver to perform -* scanning. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetBssidListScan ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_SSID_T prSsid; - PARAM_SSID_T rSsid; - - DEBUGFUNC("wlanoidSetBssidListScan()"); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set BSSID list scan! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - ASSERT(pu4SetInfoLen); - *pu4SetInfoLen = 0; - - if (prAdapter->fgIsRadioOff) { - DBGLOG(REQ, WARN, ("Return from BSSID list scan! (radio off). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_SUCCESS; - } - - if(pvSetBuffer != NULL && u4SetBufferLen != 0) { - COPY_SSID(rSsid.aucSsid, - rSsid.u4SsidLen, - pvSetBuffer, - u4SetBufferLen); - prSsid = &rSsid; - } - else { - prSsid = NULL; - } - -#if CFG_SUPPORT_RDD_TEST_MODE - if (prAdapter->prGlueInfo->rRegInfo.u4RddTestMode) { - if((prAdapter->fgEnOnlineScan == TRUE) && (prAdapter->ucRddStatus)){ - if (kalGetMediaStateIndicated(prAdapter->prGlueInfo) != PARAM_MEDIA_STATE_CONNECTED){ - aisFsmScanRequest(prAdapter, prSsid, NULL, 0); - } - } - } - else -#endif - { - if(prAdapter->fgEnOnlineScan == TRUE) { - aisFsmScanRequest(prAdapter, prSsid, NULL, 0); - } - else if(kalGetMediaStateIndicated(prAdapter->prGlueInfo) != PARAM_MEDIA_STATE_CONNECTED) { - aisFsmScanRequest(prAdapter, prSsid, NULL, 0); - } - } - - return WLAN_STATUS_SUCCESS; -} /* wlanoidSetBssidListScan */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to request the driver to perform -* scanning with attaching information elements(IEs) specified from user space -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetBssidListScanExt ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_SCAN_REQUEST_EXT_T prScanRequest; - P_PARAM_SSID_T prSsid; - PUINT_8 pucIe; - UINT_32 u4IeLength; - - DEBUGFUNC("wlanoidSetBssidListScanExt()"); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set BSSID list scan! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - ASSERT(pu4SetInfoLen); - *pu4SetInfoLen = 0; - - if(u4SetBufferLen != sizeof(PARAM_SCAN_REQUEST_EXT_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - if (prAdapter->fgIsRadioOff) { - DBGLOG(REQ, WARN, ("Return from BSSID list scan! (radio off). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_SUCCESS; - } - - if(pvSetBuffer != NULL && u4SetBufferLen != 0) { - prScanRequest = (P_PARAM_SCAN_REQUEST_EXT_T)pvSetBuffer; - prSsid = &(prScanRequest->rSsid); - pucIe = prScanRequest->pucIE; - u4IeLength = prScanRequest->u4IELength; - } - else { - prScanRequest = NULL; - prSsid = NULL; - pucIe = NULL; - u4IeLength = 0; - } - -#if CFG_SUPPORT_RDD_TEST_MODE - if (prAdapter->prGlueInfo->rRegInfo.u4RddTestMode) { - if((prAdapter->fgEnOnlineScan == TRUE) && (prAdapter->ucRddStatus)){ - if (kalGetMediaStateIndicated(prAdapter->prGlueInfo) != PARAM_MEDIA_STATE_CONNECTED){ - aisFsmScanRequest(prAdapter, prSsid, pucIe, u4IeLength); - } - } - } - else -#endif - { - if(prAdapter->fgEnOnlineScan == TRUE) { - aisFsmScanRequest(prAdapter, prSsid, pucIe, u4IeLength); - } - else if(kalGetMediaStateIndicated(prAdapter->prGlueInfo) != PARAM_MEDIA_STATE_CONNECTED) { - aisFsmScanRequest(prAdapter, prSsid, pucIe, u4IeLength); - } - } - - return WLAN_STATUS_SUCCESS; -} /* wlanoidSetBssidListScanWithIE */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine will initiate the join procedure to attempt to associate -* with the specified BSSID. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_INVALID_DATA -* \retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetBssid ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_GLUE_INFO_T prGlueInfo; - P_UINT_8 pAddr; - UINT_32 i; - INT_32 i4Idx = -1; - P_MSG_AIS_ABORT_T prAisAbortMsg; - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = MAC_ADDR_LEN;; - if (u4SetBufferLen != MAC_ADDR_LEN){ - *pu4SetInfoLen = MAC_ADDR_LEN; - return WLAN_STATUS_INVALID_LENGTH; - } - else if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set ssid! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - prGlueInfo = prAdapter->prGlueInfo; - pAddr = (P_UINT_8)pvSetBuffer; - - // re-association check - if(kalGetMediaStateIndicated(prGlueInfo) == PARAM_MEDIA_STATE_CONNECTED) { - if(EQUAL_MAC_ADDR(prAdapter->rWlanInfo.rCurrBssId.arMacAddress, pAddr)) { - kalSetMediaStateIndicated(prGlueInfo, PARAM_MEDIA_STATE_TO_BE_INDICATED); - } - else { - kalIndicateStatusAndComplete(prGlueInfo, - WLAN_STATUS_MEDIA_DISCONNECT, - NULL, - 0); - } - } - - // check if any scanned result matchs with the BSSID - for(i = 0 ; i < prAdapter->rWlanInfo.u4ScanResultNum ; i++) { - if(EQUAL_MAC_ADDR(prAdapter->rWlanInfo.arScanResult[i].arMacAddress, pAddr)) { - i4Idx = (INT_32)i; - break; - } - } - - /* prepare message to AIS */ - if (prAdapter->rWifiVar.rConnSettings.eOPMode == NET_TYPE_IBSS - || prAdapter->rWifiVar.rConnSettings.eOPMode == NET_TYPE_DEDICATED_IBSS) { - /* IBSS */ /* beacon period */ - prAdapter->rWifiVar.rConnSettings.u2BeaconPeriod = prAdapter->rWlanInfo.u2BeaconPeriod; - prAdapter->rWifiVar.rConnSettings.u2AtimWindow = prAdapter->rWlanInfo.u2AtimWindow; - } - - /* Set Connection Request Issued Flag */ - prAdapter->rWifiVar.rConnSettings.fgIsConnReqIssued = TRUE; - prAdapter->rWifiVar.rConnSettings.eConnectionPolicy = CONNECT_BY_BSSID; - - /* Send AIS Abort Message */ - prAisAbortMsg = (P_MSG_AIS_ABORT_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_AIS_ABORT_T)); - if (!prAisAbortMsg) { - ASSERT(0); - return WLAN_STATUS_FAILURE; - } - - prAisAbortMsg->rMsgHdr.eMsgId = MID_OID_AIS_FSM_JOIN_REQ; - prAisAbortMsg->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_NEW_CONNECTION; - - if (EQUAL_MAC_ADDR(prAdapter->rWifiVar.rConnSettings.aucBSSID, pAddr)) { - prAisAbortMsg->fgDelayIndication = TRUE; - } - else { - /* Update the information to CONNECTION_SETTINGS_T */ - prAdapter->rWifiVar.rConnSettings.ucSSIDLen = 0; - prAdapter->rWifiVar.rConnSettings.aucSSID[0] = '\0'; - - COPY_MAC_ADDR(prAdapter->rWifiVar.rConnSettings.aucBSSID, pAddr); - prAisAbortMsg->fgDelayIndication = FALSE; - } - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prAisAbortMsg, - MSG_SEND_METHOD_BUF); - - return WLAN_STATUS_SUCCESS; -} /* end of wlanoidSetBssid() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine will initiate the join procedure to attempt -* to associate with the new SSID. If the previous scanning -* result is aged, we will scan the channels at first. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_DATA -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetSsid ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_GLUE_INFO_T prGlueInfo; - P_PARAM_SSID_T pParamSsid; - UINT_32 i; - INT_32 i4Idx = -1, i4MaxRSSI = INT_MIN; - P_MSG_AIS_ABORT_T prAisAbortMsg; - BOOLEAN fgIsValidSsid = TRUE; - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - /* MSDN: - * Powering on the radio if the radio is powered off through a setting of OID_802_11_DISASSOCIATE - */ - if(prAdapter->fgIsRadioOff == TRUE) { - prAdapter->fgIsRadioOff = FALSE; - } - - if(u4SetBufferLen < sizeof(PARAM_SSID_T) || u4SetBufferLen > sizeof(PARAM_SSID_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - else if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set ssid! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - pParamSsid = (P_PARAM_SSID_T) pvSetBuffer; - - if (pParamSsid->u4SsidLen > 32) { - return WLAN_STATUS_INVALID_LENGTH; - } - - prGlueInfo = prAdapter->prGlueInfo; - - // prepare for CMD_BUILD_CONNECTION & CMD_GET_CONNECTION_STATUS - // re-association check - if(kalGetMediaStateIndicated(prGlueInfo) == PARAM_MEDIA_STATE_CONNECTED) { - if(EQUAL_SSID(prAdapter->rWlanInfo.rCurrBssId.rSsid.aucSsid, - prAdapter->rWlanInfo.rCurrBssId.rSsid.u4SsidLen, - pParamSsid->aucSsid, - pParamSsid->u4SsidLen)) { - kalSetMediaStateIndicated(prGlueInfo, PARAM_MEDIA_STATE_TO_BE_INDICATED); - } - else { - kalIndicateStatusAndComplete(prGlueInfo, - WLAN_STATUS_MEDIA_DISCONNECT, - NULL, - 0); - } - } - - // check if any scanned result matchs with the SSID - for(i = 0 ; i < prAdapter->rWlanInfo.u4ScanResultNum ; i++) { - PUINT_8 aucSsid = prAdapter->rWlanInfo.arScanResult[i].rSsid.aucSsid; - UINT_8 ucSsidLength = (UINT_8) prAdapter->rWlanInfo.arScanResult[i].rSsid.u4SsidLen; - INT_32 i4RSSI = prAdapter->rWlanInfo.arScanResult[i].rRssi; - - if(EQUAL_SSID(aucSsid, ucSsidLength, pParamSsid->aucSsid, pParamSsid->u4SsidLen) && - i4RSSI >= i4MaxRSSI) { - i4Idx = (INT_32)i; - i4MaxRSSI = i4RSSI; - } - } - - /* prepare message to AIS */ - if (prAdapter->rWifiVar.rConnSettings.eOPMode == NET_TYPE_IBSS - || prAdapter->rWifiVar.rConnSettings.eOPMode == NET_TYPE_DEDICATED_IBSS) { - /* IBSS */ /* beacon period */ - prAdapter->rWifiVar.rConnSettings.u2BeaconPeriod = prAdapter->rWlanInfo.u2BeaconPeriod; - prAdapter->rWifiVar.rConnSettings.u2AtimWindow = prAdapter->rWlanInfo.u2AtimWindow; - } - - if (prAdapter->rWifiVar.fgSupportWZCDisassociation) { - if (pParamSsid->u4SsidLen == ELEM_MAX_LEN_SSID) { - fgIsValidSsid = FALSE; - - for (i = 0; i < ELEM_MAX_LEN_SSID; i++) { - if ( !((0 < pParamSsid->aucSsid[i]) && (pParamSsid->aucSsid[i] <= 0x1F)) ) { - fgIsValidSsid = TRUE; - break; - } - } - } - } - - /* Set Connection Request Issued Flag */ - if (fgIsValidSsid) { - prAdapter->rWifiVar.rConnSettings.fgIsConnReqIssued = TRUE; - - if(pParamSsid->u4SsidLen) { - prAdapter->rWifiVar.rConnSettings.eConnectionPolicy = CONNECT_BY_SSID_BEST_RSSI; - } - else { - // wildcard SSID - prAdapter->rWifiVar.rConnSettings.eConnectionPolicy = CONNECT_BY_SSID_ANY; - } - } - else { - prAdapter->rWifiVar.rConnSettings.fgIsConnReqIssued = FALSE; - } - - /* Send AIS Abort Message */ - prAisAbortMsg = (P_MSG_AIS_ABORT_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_AIS_ABORT_T)); - if (!prAisAbortMsg) { - ASSERT(0); - return WLAN_STATUS_FAILURE; - } - - prAisAbortMsg->rMsgHdr.eMsgId = MID_OID_AIS_FSM_JOIN_REQ; - prAisAbortMsg->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_NEW_CONNECTION; - - if (EQUAL_SSID(prAdapter->rWifiVar.rConnSettings.aucSSID, - prAdapter->rWifiVar.rConnSettings.ucSSIDLen, - pParamSsid->aucSsid, - pParamSsid->u4SsidLen)) { - prAisAbortMsg->fgDelayIndication = TRUE; - } - else { - /* Update the information to CONNECTION_SETTINGS_T */ - COPY_SSID(prAdapter->rWifiVar.rConnSettings.aucSSID, - prAdapter->rWifiVar.rConnSettings.ucSSIDLen, - pParamSsid->aucSsid, - (UINT_8)pParamSsid->u4SsidLen); - - prAisAbortMsg->fgDelayIndication = FALSE; - } - DBGLOG(SCN, INFO, ("SSID %s\n", prAdapter->rWifiVar.rConnSettings.aucSSID)); - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prAisAbortMsg, - MSG_SEND_METHOD_BUF); - - return WLAN_STATUS_SUCCESS; - -} /* end of wlanoidSetSsid() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the currently associated SSID. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQuerySsid ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - P_PARAM_SSID_T prAssociatedSsid; - - DEBUGFUNC("wlanoidQuerySsid"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(PARAM_SSID_T); - - /* Check for query buffer length */ - if (u4QueryBufferLen < *pu4QueryInfoLen) { - DBGLOG(REQ, WARN, ("Invalid length %lu\n", u4QueryBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - - prAssociatedSsid = (P_PARAM_SSID_T)pvQueryBuffer; - - kalMemZero(prAssociatedSsid->aucSsid, sizeof(prAssociatedSsid->aucSsid)); - - if (kalGetMediaStateIndicated(prAdapter->prGlueInfo) == PARAM_MEDIA_STATE_CONNECTED) { - prAssociatedSsid->u4SsidLen = prAdapter->rWlanInfo.rCurrBssId.rSsid.u4SsidLen; - - if (prAssociatedSsid->u4SsidLen) { - kalMemCopy(prAssociatedSsid->aucSsid, - prAdapter->rWlanInfo.rCurrBssId.rSsid.aucSsid, - prAssociatedSsid->u4SsidLen); - } - } - else { - prAssociatedSsid->u4SsidLen = 0; - - DBGLOG(REQ, TRACE, ("Null SSID\n")); - } - - return WLAN_STATUS_SUCCESS; -} /* wlanoidQuerySsid */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the current 802.11 network type. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryInfrastructureMode ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryInfrastructureMode"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - - *pu4QueryInfoLen = sizeof(ENUM_PARAM_OP_MODE_T); - - if (u4QueryBufferLen < sizeof(ENUM_PARAM_OP_MODE_T)) { - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *(P_ENUM_PARAM_OP_MODE_T)pvQueryBuffer = prAdapter->rWifiVar.rConnSettings.eOPMode; - - /* - ** According to OID_802_11_INFRASTRUCTURE_MODE - ** If there is no prior OID_802_11_INFRASTRUCTURE_MODE, - ** NDIS_STATUS_ADAPTER_NOT_READY shall be returned. - */ -#if DBG - switch (*(P_ENUM_PARAM_OP_MODE_T)pvQueryBuffer) { - case NET_TYPE_IBSS: - DBGLOG(REQ, INFO, ("IBSS mode\n")); - break; - case NET_TYPE_INFRA: - DBGLOG(REQ, INFO, ("Infrastructure mode\n")); - break; - default: - DBGLOG(REQ, INFO, ("Automatic mode\n")); - } -#endif - - return WLAN_STATUS_SUCCESS; -} /* wlanoidQueryInfrastructureMode */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set mode to infrastructure or -* IBSS, or automatic switch between the two. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed due to invalid -* length of the set buffer, returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_DATA -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetInfrastructureMode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_GLUE_INFO_T prGlueInfo; - ENUM_PARAM_OP_MODE_T eOpMode; - - DEBUGFUNC("wlanoidSetInfrastructureMode"); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - prGlueInfo = prAdapter->prGlueInfo; - - if (u4SetBufferLen < sizeof(ENUM_PARAM_OP_MODE_T)) - return WLAN_STATUS_BUFFER_TOO_SHORT; - - *pu4SetInfoLen = sizeof(ENUM_PARAM_OP_MODE_T); - - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set infrastructure mode! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - eOpMode = *(P_ENUM_PARAM_OP_MODE_T)pvSetBuffer; - /* Verify the new infrastructure mode. */ - if (eOpMode >= NET_TYPE_NUM) { - DBGLOG(REQ, TRACE, ("Invalid mode value %d\n", eOpMode)); - return WLAN_STATUS_INVALID_DATA; - } - - /* check if possible to switch to AdHoc mode */ - if(eOpMode == NET_TYPE_IBSS || eOpMode == NET_TYPE_DEDICATED_IBSS) { - if(cnmAisIbssIsPermitted(prAdapter) == FALSE) { - DBGLOG(REQ, TRACE, ("Mode value %d unallowed\n", eOpMode)); - return WLAN_STATUS_FAILURE; - } - } - - /* Save the new infrastructure mode setting. */ - prAdapter->rWifiVar.rConnSettings.eOPMode = eOpMode; - - /* Clean up the Tx key flag */ - prAdapter->rWifiVar.rAisSpecificBssInfo.fgTransmitKeyExist = FALSE; - - prAdapter->rWifiVar.rConnSettings.fgWapiMode = FALSE; -#if CFG_SUPPORT_WAPI - prAdapter->prGlueInfo->u2WapiAssocInfoIESz = 0; - kalMemZero(&prAdapter->prGlueInfo->aucWapiAssocInfoIEs, 42); -#endif - -#if CFG_SUPPORT_802_11W - prAdapter->rWifiVar.rAisSpecificBssInfo.fgMgmtProtection = FALSE; - prAdapter->rWifiVar.rAisSpecificBssInfo.fgBipKeyInstalled = FALSE; -#endif - -#if CFG_SUPPORT_WPS2 - kalMemZero(&prAdapter->prGlueInfo->aucWSCAssocInfoIE, 200); - prAdapter->prGlueInfo->u2WSCAssocInfoIELen = 0; -#endif - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_INFRASTRUCTURE, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvSetBuffer, - u4SetBufferLen - ); - -} /* wlanoidSetInfrastructureMode */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the current 802.11 authentication -* mode. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryAuthMode ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryAuthMode"); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - *pu4QueryInfoLen = sizeof(ENUM_PARAM_AUTH_MODE_T); - - if (u4QueryBufferLen < sizeof(ENUM_PARAM_AUTH_MODE_T)) { - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - *(P_ENUM_PARAM_AUTH_MODE_T)pvQueryBuffer = prAdapter->rWifiVar.rConnSettings.eAuthMode; - -#if DBG - switch (*(P_ENUM_PARAM_AUTH_MODE_T)pvQueryBuffer) { - case AUTH_MODE_OPEN: - DBGLOG(REQ, INFO, ("Current auth mode: Open\n")); - break; - - case AUTH_MODE_SHARED: - DBGLOG(REQ, INFO, ("Current auth mode: Shared\n")); - break; - - case AUTH_MODE_AUTO_SWITCH: - DBGLOG(REQ, INFO, ("Current auth mode: Auto-switch\n")); - break; - - case AUTH_MODE_WPA: - DBGLOG(REQ, INFO, ("Current auth mode: WPA\n")); - break; - - case AUTH_MODE_WPA_PSK: - DBGLOG(REQ, INFO, ("Current auth mode: WPA PSK\n")); - break; - - case AUTH_MODE_WPA_NONE: - DBGLOG(REQ, INFO, ("Current auth mode: WPA None\n")); - break; - - case AUTH_MODE_WPA2: - DBGLOG(REQ, INFO, ("Current auth mode: WPA2\n")); - break; - - case AUTH_MODE_WPA2_PSK: - DBGLOG(REQ, INFO, ("Current auth mode: WPA2 PSK\n")); - break; - - default: - DBGLOG(REQ, INFO, ("Current auth mode: %d\n", - *(P_ENUM_PARAM_AUTH_MODE_T)pvQueryBuffer)); - } -#endif - return WLAN_STATUS_SUCCESS; -} /* wlanoidQueryAuthMode */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set the IEEE 802.11 authentication mode -* to the driver. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_DATA -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_NOT_ACCEPTED -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetAuthMode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_GLUE_INFO_T prGlueInfo; - UINT_32 i, u4AkmSuite; - P_DOT11_RSNA_CONFIG_AUTHENTICATION_SUITES_ENTRY prEntry; - - DEBUGFUNC("wlanoidSetAuthMode"); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - ASSERT(pvSetBuffer); - - prGlueInfo = prAdapter->prGlueInfo; - - *pu4SetInfoLen = sizeof(ENUM_PARAM_AUTH_MODE_T); - - if (u4SetBufferLen < sizeof(ENUM_PARAM_AUTH_MODE_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - /* RF Test */ - //if (IS_ARB_IN_RFTEST_STATE(prAdapter)) { - // return WLAN_STATUS_SUCCESS; - //} - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set Authentication mode! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - /* Check if the new authentication mode is valid. */ - if (*(P_ENUM_PARAM_AUTH_MODE_T)pvSetBuffer >= AUTH_MODE_NUM) { - DBGLOG(REQ, TRACE, ("Invalid auth mode %d\n", - *(P_ENUM_PARAM_AUTH_MODE_T)pvSetBuffer)); - return WLAN_STATUS_INVALID_DATA; - } - - switch (*(P_ENUM_PARAM_AUTH_MODE_T)pvSetBuffer) { - case AUTH_MODE_WPA: - case AUTH_MODE_WPA_PSK: - case AUTH_MODE_WPA2: - case AUTH_MODE_WPA2_PSK: - /* infrastructure mode only */ - if (prAdapter->rWifiVar.rConnSettings.eOPMode != NET_TYPE_INFRA) { - return WLAN_STATUS_NOT_ACCEPTED; - } - break; - - case AUTH_MODE_WPA_NONE: - /* ad hoc mode only */ - if (prAdapter->rWifiVar.rConnSettings.eOPMode != NET_TYPE_IBSS) { - return WLAN_STATUS_NOT_ACCEPTED; - } - break; - - default: - ; - } - - /* Save the new authentication mode. */ - prAdapter->rWifiVar.rConnSettings.eAuthMode = *(P_ENUM_PARAM_AUTH_MODE_T)pvSetBuffer; - -#if DBG - switch (prAdapter->rWifiVar.rConnSettings.eAuthMode) { - case AUTH_MODE_OPEN: - DBGLOG(RSN, TRACE, ("New auth mode: open\n")); - break; - - case AUTH_MODE_SHARED: - DBGLOG(RSN, TRACE, ("New auth mode: shared\n")); - break; - - case AUTH_MODE_AUTO_SWITCH: - DBGLOG(RSN, TRACE, ("New auth mode: auto-switch\n")); - break; - - case AUTH_MODE_WPA: - DBGLOG(RSN, TRACE, ("New auth mode: WPA\n")); - break; - - case AUTH_MODE_WPA_PSK: - DBGLOG(RSN, TRACE, ("New auth mode: WPA PSK\n")); - break; - - case AUTH_MODE_WPA_NONE: - DBGLOG(RSN, TRACE, ("New auth mode: WPA None\n")); - break; - - case AUTH_MODE_WPA2: - DBGLOG(RSN, TRACE, ("New auth mode: WPA2\n")); - break; - - case AUTH_MODE_WPA2_PSK: - DBGLOG(RSN, TRACE, ("New auth mode: WPA2 PSK\n")); - break; - - default: - DBGLOG(RSN, TRACE, ("New auth mode: unknown (%d)\n", - prAdapter->rWifiVar.rConnSettings.eAuthMode)); - } -#endif - - if (prAdapter->rWifiVar.rConnSettings.eAuthMode >= AUTH_MODE_WPA) { - switch(prAdapter->rWifiVar.rConnSettings.eAuthMode) { - case AUTH_MODE_WPA: - u4AkmSuite = WPA_AKM_SUITE_802_1X; - break; - - case AUTH_MODE_WPA_PSK: - u4AkmSuite = WPA_AKM_SUITE_PSK; - break; - - case AUTH_MODE_WPA_NONE: - u4AkmSuite = WPA_AKM_SUITE_NONE; - break; - - case AUTH_MODE_WPA2: - u4AkmSuite = RSN_AKM_SUITE_802_1X; - break; - - case AUTH_MODE_WPA2_PSK: - u4AkmSuite = RSN_AKM_SUITE_PSK; - break; - - default: - u4AkmSuite = 0; - } - } - else { - u4AkmSuite = 0; - } - - /* Enable the specific AKM suite only. */ - for (i = 0; i < MAX_NUM_SUPPORTED_AKM_SUITES; i++) { - prEntry = &prAdapter->rMib.dot11RSNAConfigAuthenticationSuitesTable[i]; - - if (prEntry->dot11RSNAConfigAuthenticationSuite == u4AkmSuite) { - prEntry->dot11RSNAConfigAuthenticationSuiteEnabled = TRUE; - } - else { - prEntry->dot11RSNAConfigAuthenticationSuiteEnabled = FALSE; - } -#if CFG_SUPPORT_802_11W - if (kalGetMfpSetting(prAdapter->prGlueInfo) != RSN_AUTH_MFP_DISABLED) { - if ((u4AkmSuite == RSN_AKM_SUITE_PSK) && - prEntry->dot11RSNAConfigAuthenticationSuite == RSN_AKM_SUITE_PSK_SHA256) { - DBGLOG(RSN, TRACE, ("Enable RSN_AKM_SUITE_PSK_SHA256 AKM support\n")); - prEntry->dot11RSNAConfigAuthenticationSuiteEnabled = TRUE; - - } - if ((u4AkmSuite == RSN_AKM_SUITE_802_1X) && - prEntry->dot11RSNAConfigAuthenticationSuite == RSN_AKM_SUITE_802_1X_SHA256) { - DBGLOG(RSN, TRACE, ("Enable RSN_AKM_SUITE_802_1X_SHA256 AKM support\n")); - prEntry->dot11RSNAConfigAuthenticationSuiteEnabled = TRUE; - } - } -#endif - } - - - return WLAN_STATUS_SUCCESS; - -} /* wlanoidSetAuthMode */ - - -#if 0 -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the current 802.11 privacy filter -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryPrivacyFilter ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryPrivacyFilter"); - - ASSERT(prAdapter); - - ASSERT(pvQueryBuffer); - ASSERT(pu4QueryInfoLen); - - *pu4QueryInfoLen = sizeof(ENUM_PARAM_PRIVACY_FILTER_T); - - if (u4QueryBufferLen < sizeof(ENUM_PARAM_PRIVACY_FILTER_T)) { - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - *(P_ENUM_PARAM_PRIVACY_FILTER_T)pvQueryBuffer = prAdapter->rWlanInfo.ePrivacyFilter; - -#if DBG - switch (*(P_ENUM_PARAM_PRIVACY_FILTER_T)pvQueryBuffer) { - case PRIVACY_FILTER_ACCEPT_ALL: - DBGLOG(REQ, INFO, ("Current privacy mode: open mode\n")); - break; - - case PRIVACY_FILTER_8021xWEP: - DBGLOG(REQ, INFO, ("Current privacy mode: filtering mode\n")); - break; - - default: - DBGLOG(REQ, INFO, ("Current auth mode: %d\n", - *(P_ENUM_PARAM_AUTH_MODE_T)pvQueryBuffer)); - } -#endif - return WLAN_STATUS_SUCCESS; -} /* wlanoidQueryPrivacyFilter */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set the IEEE 802.11 privacy filter -* to the driver. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_DATA -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_NOT_ACCEPTED -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetPrivacyFilter ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_GLUE_INFO_T prGlueInfo; - - DEBUGFUNC("wlanoidSetPrivacyFilter"); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - ASSERT(pvSetBuffer); - - prGlueInfo = prAdapter->prGlueInfo; - - *pu4SetInfoLen = sizeof(ENUM_PARAM_PRIVACY_FILTER_T); - - if (u4SetBufferLen < sizeof(ENUM_PARAM_PRIVACY_FILTER_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set Authentication mode! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - /* Check if the new authentication mode is valid. */ - if (*(P_ENUM_PARAM_PRIVACY_FILTER_T)pvSetBuffer >= PRIVACY_FILTER_NUM) { - DBGLOG(REQ, TRACE, ("Invalid privacy filter %d\n", - *(P_ENUM_PARAM_PRIVACY_FILTER_T)pvSetBuffer)); - return WLAN_STATUS_INVALID_DATA; - } - - switch (*(P_ENUM_PARAM_PRIVACY_FILTER_T)pvSetBuffer) { - default: - break; - } - - /* Save the new authentication mode. */ - prAdapter->rWlanInfo.ePrivacyFilter = *(ENUM_PARAM_PRIVACY_FILTER_T)pvSetBuffer; - - return WLAN_STATUS_SUCCESS; - -} /* wlanoidSetPrivacyFilter */ -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to reload the available default settings for -* the specified type field. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_INVALID_DATA -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetReloadDefaults ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - ENUM_PARAM_NETWORK_TYPE_T eNetworkType; - UINT_32 u4Len; - UINT_8 ucCmdSeqNum; - - - DEBUGFUNC("wlanoidSetReloadDefaults"); - - ASSERT(prAdapter); - - ASSERT(pu4SetInfoLen); - *pu4SetInfoLen = sizeof(PARAM_RELOAD_DEFAULTS); - - //if (IS_ARB_IN_RFTEST_STATE(prAdapter)) { - // return WLAN_STATUS_SUCCESS; - //} - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set Reload default! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - ASSERT(pvSetBuffer); - /* Verify the available reload options and reload the settings. */ - switch (*(P_PARAM_RELOAD_DEFAULTS)pvSetBuffer) { - case ENUM_RELOAD_WEP_KEYS: - /* Reload available default WEP keys from the permanent - storage. */ - prAdapter->rWifiVar.rConnSettings.eAuthMode = AUTH_MODE_OPEN; - prAdapter->rWifiVar.rConnSettings.eEncStatus = ENUM_ENCRYPTION1_KEY_ABSENT;//ENUM_ENCRYPTION_DISABLED; - { - P_GLUE_INFO_T prGlueInfo; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - P_CMD_802_11_KEY prCmdKey; - UINT_8 aucBCAddr[] = BC_MAC_ADDR; - - prGlueInfo = prAdapter->prGlueInfo; - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, (CMD_HDR_SIZE + sizeof(CMD_802_11_KEY))); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - - // compose CMD_802_11_KEY cmd pkt - prCmdInfo->eCmdType = COMMAND_TYPE_NETWORK_IOCTL; - prCmdInfo->eNetworkType = NETWORK_TYPE_AIS_INDEX; - prCmdInfo->u2InfoBufLen = CMD_HDR_SIZE + sizeof(CMD_802_11_KEY); - prCmdInfo->pfCmdDoneHandler = nicCmdEventSetCommon; - prCmdInfo->pfCmdTimeoutHandler = nicOidCmdTimeoutCommon; - prCmdInfo->fgIsOid = TRUE; - prCmdInfo->ucCID = CMD_ID_ADD_REMOVE_KEY; - prCmdInfo->fgSetQuery = TRUE; - prCmdInfo->fgNeedResp = FALSE; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = sizeof(PARAM_REMOVE_KEY_T); - prCmdInfo->pvInformationBuffer = pvSetBuffer; - prCmdInfo->u4InformationBufferLength = u4SetBufferLen; - - // Setup WIFI_CMD_T - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - prCmdKey = (P_CMD_802_11_KEY)(prWifiCmd->aucBuffer); - - kalMemZero((PUINT_8)prCmdKey, sizeof(CMD_802_11_KEY)); - - prCmdKey->ucAddRemove = 0; /* Remove */ - prCmdKey->ucKeyId = 0;//(UINT_8)(prRemovedKey->u4KeyIndex & 0x000000ff); - kalMemCopy(prCmdKey->aucPeerAddr, aucBCAddr, MAC_ADDR_LEN); - - ASSERT(prCmdKey->ucKeyId < MAX_KEY_NUM); - - prCmdKey->ucKeyType = 0; - - // insert into prCmdQueue - kalEnqueueCommand(prGlueInfo, (P_QUE_ENTRY_T)prCmdInfo); - - // wakeup txServiceThread later - GLUE_SET_EVENT(prGlueInfo); - - return WLAN_STATUS_PENDING; - } - - break; - - default: - DBGLOG(REQ, TRACE, ("Invalid reload option %d\n", - *(P_PARAM_RELOAD_DEFAULTS)pvSetBuffer)); - rStatus = WLAN_STATUS_INVALID_DATA; - } - - /* OID_802_11_RELOAD_DEFAULTS requiest to reset to auto mode */ - eNetworkType = PARAM_NETWORK_TYPE_AUTOMODE; - wlanoidSetNetworkTypeInUse(prAdapter, &eNetworkType, sizeof(eNetworkType), &u4Len); - - return rStatus; -} /* wlanoidSetReloadDefaults */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set a WEP key to the driver. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_INVALID_DATA -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -*/ -/*----------------------------------------------------------------------------*/ -#ifdef LINUX -UINT_8 keyBuffer[sizeof(PARAM_KEY_T) + 16 /* LEGACY_KEY_MAX_LEN*/]; -UINT_8 aucBCAddr[] = BC_MAC_ADDR; -#endif -WLAN_STATUS -wlanoidSetAddWep ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - #ifndef LINUX - UINT_8 keyBuffer[sizeof(PARAM_KEY_T) + 16 /* LEGACY_KEY_MAX_LEN*/]; - UINT_8 aucBCAddr[] = BC_MAC_ADDR; - #endif - P_PARAM_WEP_T prNewWepKey; - P_PARAM_KEY_T prParamKey = (P_PARAM_KEY_T)keyBuffer; - UINT_32 u4KeyId, u4SetLen; - - DEBUGFUNC("wlanoidSetAddWep"); - - ASSERT(prAdapter); - - *pu4SetInfoLen = OFFSET_OF(PARAM_WEP_T, aucKeyMaterial); - - if (u4SetBufferLen < OFFSET_OF(PARAM_WEP_T, aucKeyMaterial)) { - ASSERT(pu4SetInfoLen); - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set add WEP! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - prNewWepKey = (P_PARAM_WEP_T)pvSetBuffer; - - /* Verify the total buffer for minimum length. */ - if (u4SetBufferLen < OFFSET_OF(PARAM_WEP_T, aucKeyMaterial) + prNewWepKey->u4KeyLength) { - DBGLOG(REQ, WARN, ("Invalid total buffer length (%d) than minimum length (%d)\n", - (UINT_8)u4SetBufferLen, - (UINT_8)OFFSET_OF(PARAM_WEP_T, aucKeyMaterial))); - - *pu4SetInfoLen = OFFSET_OF(PARAM_WEP_T, aucKeyMaterial); - return WLAN_STATUS_INVALID_DATA; - } - - /* Verify the key structure length. */ - if (prNewWepKey->u4Length > u4SetBufferLen) { - DBGLOG(REQ, WARN, ("Invalid key structure length (%d) greater than total buffer length (%d)\n", - (UINT_8)prNewWepKey->u4Length, - (UINT_8)u4SetBufferLen)); - - *pu4SetInfoLen = u4SetBufferLen; - return WLAN_STATUS_INVALID_DATA; - } - - /* Verify the key material length for maximum key material length:16 */ - if (prNewWepKey->u4KeyLength > 16 /* LEGACY_KEY_MAX_LEN */) { - DBGLOG(REQ, WARN, ("Invalid key material length (%d) greater than maximum key material length (16)\n", - (UINT_8)prNewWepKey->u4KeyLength)); - - *pu4SetInfoLen = u4SetBufferLen; - return WLAN_STATUS_INVALID_DATA; - } - - *pu4SetInfoLen = u4SetBufferLen; - - u4KeyId = prNewWepKey->u4KeyIndex & BITS(0,29) /* WEP_KEY_ID_FIELD */; - - /* Verify whether key index is valid or not, current version - driver support only 4 global WEP keys setting by this OID */ - if (u4KeyId > MAX_KEY_NUM - 1) { - DBGLOG(REQ, ERROR, ("Error, invalid WEP key ID: %d\n", (UINT_8)u4KeyId)); - return WLAN_STATUS_INVALID_DATA; - } - - prParamKey->u4KeyIndex = u4KeyId; - - /* Transmit key */ - if (prNewWepKey->u4KeyIndex & IS_TRANSMIT_KEY) { - prParamKey->u4KeyIndex |= IS_TRANSMIT_KEY; - } - - /* Per client key */ - if (prNewWepKey->u4KeyIndex & IS_UNICAST_KEY) { - prParamKey->u4KeyIndex |= IS_UNICAST_KEY; - } - - prParamKey->u4KeyLength = prNewWepKey->u4KeyLength; - - kalMemCopy(prParamKey->arBSSID, aucBCAddr, MAC_ADDR_LEN); - - kalMemCopy(prParamKey->aucKeyMaterial, - prNewWepKey->aucKeyMaterial, - prNewWepKey->u4KeyLength); - - prParamKey->u4Length = OFFSET_OF(PARAM_KEY_T, aucKeyMaterial) + prNewWepKey->u4KeyLength; - - wlanoidSetAddKey(prAdapter, - (PVOID)prParamKey, - prParamKey->u4Length, - &u4SetLen); - - return WLAN_STATUS_PENDING; -} /* wlanoidSetAddWep */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to request the driver to remove the WEP key -* at the specified key index. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_DATA -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetRemoveWep ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - UINT_32 u4KeyId, u4SetLen; - PARAM_REMOVE_KEY_T rRemoveKey; - UINT_8 aucBCAddr[] = BC_MAC_ADDR; - - DEBUGFUNC("wlanoidSetRemoveWep"); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_KEY_INDEX); - - if (u4SetBufferLen < sizeof(PARAM_KEY_INDEX)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - u4KeyId = *(PUINT_32)pvSetBuffer; - - /* Dump PARAM_WEP content. */ - DBGLOG(REQ, INFO, ("Set: Dump PARAM_KEY_INDEX content\n")); - DBGLOG(REQ, INFO, ("Index : 0x%08lx\n", u4KeyId)); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set remove WEP! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - if (u4KeyId & IS_TRANSMIT_KEY) { - /* Bit 31 should not be set */ - DBGLOG(REQ, ERROR, ("Invalid WEP key index: 0x%08lx\n", u4KeyId)); - return WLAN_STATUS_INVALID_DATA; - } - - u4KeyId &= BITS(0,7); - - /* Verify whether key index is valid or not. Current version - driver support only 4 global WEP keys. */ - if (u4KeyId > MAX_KEY_NUM - 1) { - DBGLOG(REQ, ERROR, ("invalid WEP key ID %lu\n", u4KeyId)); - return WLAN_STATUS_INVALID_DATA; - } - - rRemoveKey.u4Length = sizeof(PARAM_REMOVE_KEY_T); - rRemoveKey.u4KeyIndex = *(PUINT_32)pvSetBuffer; - - kalMemCopy(rRemoveKey.arBSSID, aucBCAddr, MAC_ADDR_LEN); - - wlanoidSetRemoveKey(prAdapter, - (PVOID)&rRemoveKey, - sizeof(PARAM_REMOVE_KEY_T), - &u4SetLen); - - return WLAN_STATUS_PENDING; -} /* wlanoidSetRemoveWep */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set a key to the driver. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_INVALID_DATA -* -* \note The setting buffer PARAM_KEY_T, which is set by NDIS, is unpacked. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetAddKey ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_GLUE_INFO_T prGlueInfo; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - P_PARAM_KEY_T prNewKey; - P_CMD_802_11_KEY prCmdKey; - UINT_8 ucCmdSeqNum; - - DEBUGFUNC("wlanoidSetAddKey"); - DBGLOG(REQ, LOUD, ("\n")); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set add key! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - prNewKey = (P_PARAM_KEY_T) pvSetBuffer; - - /* Verify the key structure length. */ - if (prNewKey->u4Length > u4SetBufferLen) { - DBGLOG(REQ, WARN, ("Invalid key structure length (%d) greater than total buffer length (%d)\n", - (UINT_8)prNewKey->u4Length, - (UINT_8)u4SetBufferLen)); - - *pu4SetInfoLen = u4SetBufferLen; - return WLAN_STATUS_INVALID_LENGTH; - } - - /* Verify the key material length for key material buffer */ - if (prNewKey->u4KeyLength > prNewKey->u4Length - OFFSET_OF(PARAM_KEY_T, aucKeyMaterial)) { - DBGLOG(REQ, WARN, ("Invalid key material length (%d)\n", (UINT_8)prNewKey->u4KeyLength)); - *pu4SetInfoLen = u4SetBufferLen; - return WLAN_STATUS_INVALID_DATA; - } - - /* Exception check */ - if (prNewKey->u4KeyIndex & 0x0fffff00) { - return WLAN_STATUS_INVALID_DATA; - } - - /* Exception check, pairwise key must with transmit bit enabled */ - if ((prNewKey->u4KeyIndex & BITS(30,31)) == IS_UNICAST_KEY) { - return WLAN_STATUS_INVALID_DATA; - } - - if (!(prNewKey->u4KeyLength == WEP_40_LEN || prNewKey->u4KeyLength == WEP_104_LEN || - prNewKey->u4KeyLength == CCMP_KEY_LEN || prNewKey->u4KeyLength == TKIP_KEY_LEN)) - { - return WLAN_STATUS_INVALID_DATA; - } - - /* Exception check, pairwise key must with transmit bit enabled */ - if ((prNewKey->u4KeyIndex & BITS(30,31)) == BITS(30,31)) { - if (((prNewKey->u4KeyIndex & 0xff) != 0) || - ((prNewKey->arBSSID[0] == 0xff) && (prNewKey->arBSSID[1] == 0xff) && (prNewKey->arBSSID[2] == 0xff) && - (prNewKey->arBSSID[3] == 0xff) && (prNewKey->arBSSID[4] == 0xff) && (prNewKey->arBSSID[5] == 0xff))) { - return WLAN_STATUS_INVALID_DATA; - } - } - - *pu4SetInfoLen = u4SetBufferLen; - - /* Dump PARAM_KEY content. */ - DBGLOG(REQ, TRACE, ("Set: Dump PARAM_KEY content\n")); - DBGLOG(REQ, TRACE, ("Length : 0x%08lx\n", prNewKey->u4Length)); - DBGLOG(REQ, TRACE, ("Key Index : 0x%08lx\n", prNewKey->u4KeyIndex)); - DBGLOG(REQ, TRACE, ("Key Length: 0x%08lx\n", prNewKey->u4KeyLength)); - DBGLOG(REQ, TRACE, ("BSSID:\n")); - DBGLOG_MEM8(REQ, TRACE, prNewKey->arBSSID, sizeof(PARAM_MAC_ADDRESS)); - DBGLOG(REQ, TRACE, ("Key RSC:\n")); - DBGLOG_MEM8(REQ, TRACE, &prNewKey->rKeyRSC, sizeof(PARAM_KEY_RSC)); - DBGLOG(REQ, TRACE, ("Key Material:\n")); - DBGLOG_MEM8(REQ, TRACE, prNewKey->aucKeyMaterial, prNewKey->u4KeyLength); - - if (prAdapter->rWifiVar.rConnSettings.eAuthMode < AUTH_MODE_WPA) { - /* Todo:: Store the legacy wep key for OID_802_11_RELOAD_DEFAULTS */ - } - - if (prNewKey->u4KeyIndex & IS_TRANSMIT_KEY) - prAdapter->rWifiVar.rAisSpecificBssInfo.fgTransmitKeyExist = TRUE; - - prGlueInfo = prAdapter->prGlueInfo; - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, (CMD_HDR_SIZE + sizeof(CMD_802_11_KEY))); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - DBGLOG(REQ, INFO, ("ucCmdSeqNum = %d\n", ucCmdSeqNum)); - - // compose CMD_802_11_KEY cmd pkt - prCmdInfo->eCmdType = COMMAND_TYPE_NETWORK_IOCTL; - prCmdInfo->eNetworkType = NETWORK_TYPE_AIS_INDEX; - prCmdInfo->u2InfoBufLen = CMD_HDR_SIZE + sizeof(CMD_802_11_KEY); - prCmdInfo->pfCmdDoneHandler = nicCmdEventSetCommon; - prCmdInfo->pfCmdTimeoutHandler = nicOidCmdTimeoutCommon; - prCmdInfo->fgIsOid = TRUE; - prCmdInfo->ucCID = CMD_ID_ADD_REMOVE_KEY; - prCmdInfo->fgSetQuery = TRUE; - prCmdInfo->fgNeedResp = FALSE; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = u4SetBufferLen; - prCmdInfo->pvInformationBuffer = pvSetBuffer; - prCmdInfo->u4InformationBufferLength = u4SetBufferLen; - - // Setup WIFI_CMD_T - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - prCmdKey = (P_CMD_802_11_KEY)(prWifiCmd->aucBuffer); - - kalMemZero(prCmdKey, sizeof(CMD_802_11_KEY)); - - prCmdKey->ucAddRemove = 1; /* Add */ - - prCmdKey->ucTxKey = ((prNewKey->u4KeyIndex & IS_TRANSMIT_KEY) == IS_TRANSMIT_KEY) ? 1 : 0; - prCmdKey->ucKeyType = ((prNewKey->u4KeyIndex & IS_UNICAST_KEY) == IS_UNICAST_KEY) ? 1 : 0; - prCmdKey->ucIsAuthenticator = ((prNewKey->u4KeyIndex & IS_AUTHENTICATOR) == IS_AUTHENTICATOR) ? 1 : 0; - - kalMemCopy(prCmdKey->aucPeerAddr, (PUINT_8)prNewKey->arBSSID, MAC_ADDR_LEN); - - prCmdKey->ucNetType = 0; /* AIS */ - - prCmdKey->ucKeyId = (UINT_8)(prNewKey->u4KeyIndex & 0xff); - - /* Note: adjust the key length for WPA-None */ - prCmdKey->ucKeyLen = (UINT_8)prNewKey->u4KeyLength; - - kalMemCopy(prCmdKey->aucKeyMaterial, (PUINT_8)prNewKey->aucKeyMaterial, prCmdKey->ucKeyLen); - - if (prNewKey->u4KeyLength == 5) { - prCmdKey->ucAlgorithmId = CIPHER_SUITE_WEP40; - } - else if (prNewKey->u4KeyLength == 13) { - prCmdKey->ucAlgorithmId = CIPHER_SUITE_WEP104; - } - else if (prNewKey->u4KeyLength == 16) { - if (prAdapter->rWifiVar.rConnSettings.eAuthMode < AUTH_MODE_WPA) - prCmdKey->ucAlgorithmId = CIPHER_SUITE_WEP128; - else { -#if CFG_SUPPORT_802_11W - if (prCmdKey->ucKeyId >= 4) { - prCmdKey->ucAlgorithmId = CIPHER_SUITE_BIP; - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo; - - prAisSpecBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - prAisSpecBssInfo->fgBipKeyInstalled = TRUE; - } - else -#endif - prCmdKey->ucAlgorithmId = CIPHER_SUITE_CCMP; - } - } - else if (prNewKey->u4KeyLength == 32) { - if (prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA_NONE) { - if (prAdapter->rWifiVar.rConnSettings.eEncStatus == ENUM_ENCRYPTION2_ENABLED) { - prCmdKey->ucAlgorithmId = CIPHER_SUITE_TKIP; - } - else if (prAdapter->rWifiVar.rConnSettings.eEncStatus == ENUM_ENCRYPTION3_ENABLED) { - prCmdKey->ucAlgorithmId = CIPHER_SUITE_CCMP; - prCmdKey->ucKeyLen = CCMP_KEY_LEN; - } - } - else { - if (rsnCheckPmkidCandicate(prAdapter)) { - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo; - - prAisSpecBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - DBGLOG(RSN, TRACE, ("Add key: Prepare a timer to indicate candidate PMKID Candidate\n")); - cnmTimerStopTimer(prAdapter, &prAisSpecBssInfo->rPreauthenticationTimer); - cnmTimerStartTimer(prAdapter, &prAisSpecBssInfo->rPreauthenticationTimer, - SEC_TO_MSEC(WAIT_TIME_IND_PMKID_CANDICATE_SEC)); - } - prCmdKey->ucAlgorithmId = CIPHER_SUITE_TKIP; - } - } - - // insert into prCmdQueue - kalEnqueueCommand(prGlueInfo, (P_QUE_ENTRY_T)prCmdInfo); - - // wakeup txServiceThread later - GLUE_SET_EVENT(prGlueInfo); - - return WLAN_STATUS_PENDING; -} /* wlanoidSetAddKey */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to request the driver to remove the key at -* the specified key index. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_DATA -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetRemoveKey ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_GLUE_INFO_T prGlueInfo; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - P_PARAM_REMOVE_KEY_T prRemovedKey; - P_CMD_802_11_KEY prCmdKey; - UINT_8 ucCmdSeqNum; - - DEBUGFUNC("wlanoidSetRemoveKey"); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_REMOVE_KEY_T); - - if (u4SetBufferLen < sizeof(PARAM_REMOVE_KEY_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set remove key! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - ASSERT(pvSetBuffer); - prRemovedKey = (P_PARAM_REMOVE_KEY_T)pvSetBuffer; - - /* Dump PARAM_REMOVE_KEY content. */ - DBGLOG(REQ, INFO, ("Set: Dump PARAM_REMOVE_KEY content\n")); - DBGLOG(REQ, INFO, ("Length : 0x%08lx\n", prRemovedKey->u4Length)); - DBGLOG(REQ, INFO, ("Key Index : 0x%08lx\n", prRemovedKey->u4KeyIndex)); - DBGLOG(REQ, INFO, ("BSSID:\n")); - DBGLOG_MEM8(REQ, INFO, prRemovedKey->arBSSID, MAC_ADDR_LEN); - - /* Check bit 31: this bit should always 0 */ - if (prRemovedKey->u4KeyIndex & IS_TRANSMIT_KEY) { - /* Bit 31 should not be set */ - DBGLOG(REQ, ERROR, ("invalid key index: 0x%08lx\n", - prRemovedKey->u4KeyIndex)); - return WLAN_STATUS_INVALID_DATA; - } - - /* Check bits 8 ~ 29 should always be 0 */ - if (prRemovedKey->u4KeyIndex & BITS(8, 29)) { - /* Bit 31 should not be set */ - DBGLOG(REQ, ERROR, ("invalid key index: 0x%08lx\n", - prRemovedKey->u4KeyIndex)); - return WLAN_STATUS_INVALID_DATA; - } - - /* Clean up the Tx key flag */ - if (prRemovedKey->u4KeyIndex & IS_UNICAST_KEY) { - prAdapter->rWifiVar.rAisSpecificBssInfo.fgTransmitKeyExist = FALSE; - } - - prGlueInfo = prAdapter->prGlueInfo; - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, (CMD_HDR_SIZE + sizeof(CMD_802_11_KEY))); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - - // compose CMD_802_11_KEY cmd pkt - prCmdInfo->eCmdType = COMMAND_TYPE_NETWORK_IOCTL; - prCmdInfo->eNetworkType = NETWORK_TYPE_AIS_INDEX; - prCmdInfo->u2InfoBufLen = CMD_HDR_SIZE + sizeof(CMD_802_11_KEY); - prCmdInfo->pfCmdDoneHandler = nicCmdEventSetCommon; - prCmdInfo->pfCmdTimeoutHandler = nicOidCmdTimeoutCommon; - prCmdInfo->fgIsOid = TRUE; - prCmdInfo->ucCID = CMD_ID_ADD_REMOVE_KEY; - prCmdInfo->fgSetQuery = TRUE; - prCmdInfo->fgNeedResp = FALSE; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = sizeof(PARAM_REMOVE_KEY_T); - prCmdInfo->pvInformationBuffer = pvSetBuffer; - prCmdInfo->u4InformationBufferLength = u4SetBufferLen; - - // Setup WIFI_CMD_T - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - prCmdKey = (P_CMD_802_11_KEY)(prWifiCmd->aucBuffer); - - kalMemZero((PUINT_8)prCmdKey, sizeof(CMD_802_11_KEY)); - - prCmdKey->ucAddRemove = 0; /* Remove */ - prCmdKey->ucKeyId = (UINT_8)(prRemovedKey->u4KeyIndex & 0x000000ff); - kalMemCopy(prCmdKey->aucPeerAddr, (PUINT_8)prRemovedKey->arBSSID, MAC_ADDR_LEN); - -#if CFG_SUPPORT_802_11W - ASSERT(prCmdKey->ucKeyId < MAX_KEY_NUM + 2); -#else - //ASSERT(prCmdKey->ucKeyId < MAX_KEY_NUM); -#endif - - if (prRemovedKey->u4KeyIndex & IS_UNICAST_KEY) { - prCmdKey->ucKeyType = 1; - } - - // insert into prCmdQueue - kalEnqueueCommand(prGlueInfo, (P_QUE_ENTRY_T)prCmdInfo); - - // wakeup txServiceThread later - GLUE_SET_EVENT(prGlueInfo); - - return WLAN_STATUS_PENDING; -} /* wlanoidSetRemoveKey */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the current encryption status. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryEncryptionStatus ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - BOOLEAN fgTransmitKeyAvailable = TRUE; - ENUM_PARAM_ENCRYPTION_STATUS_T eEncStatus = 0; - - DEBUGFUNC("wlanoidQueryEncryptionStatus"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(ENUM_PARAM_ENCRYPTION_STATUS_T); - - fgTransmitKeyAvailable = prAdapter->rWifiVar.rAisSpecificBssInfo.fgTransmitKeyExist; - - switch (prAdapter->rWifiVar.rConnSettings.eEncStatus) { - case ENUM_ENCRYPTION3_ENABLED: - if (fgTransmitKeyAvailable) { - eEncStatus = ENUM_ENCRYPTION3_ENABLED; - } - else { - eEncStatus = ENUM_ENCRYPTION3_KEY_ABSENT; - } - break; - - case ENUM_ENCRYPTION2_ENABLED: - if (fgTransmitKeyAvailable) { - eEncStatus = ENUM_ENCRYPTION2_ENABLED; - break; - } - else { - eEncStatus = ENUM_ENCRYPTION2_KEY_ABSENT; - } - break; - - case ENUM_ENCRYPTION1_ENABLED: - if (fgTransmitKeyAvailable) { - eEncStatus = ENUM_ENCRYPTION1_ENABLED; - } - else { - eEncStatus = ENUM_ENCRYPTION1_KEY_ABSENT; - } - break; - - case ENUM_ENCRYPTION_DISABLED: - eEncStatus = ENUM_ENCRYPTION_DISABLED; - break; - - default: - DBGLOG(REQ, ERROR, ("Unknown Encryption Status Setting:%d\n", - prAdapter->rWifiVar.rConnSettings.eEncStatus)); - } - -#if DBG - DBGLOG(REQ, INFO, - ("Encryption status: %d Return:%d\n", - prAdapter->rWifiVar.rConnSettings.eEncStatus, - eEncStatus)); -#endif - - *(P_ENUM_PARAM_ENCRYPTION_STATUS_T)pvQueryBuffer = eEncStatus; - - return WLAN_STATUS_SUCCESS; -} /* wlanoidQueryEncryptionStatus */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set the encryption status to the driver. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_NOT_SUPPORTED -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetEncryptionStatus ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_GLUE_INFO_T prGlueInfo; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - ENUM_PARAM_ENCRYPTION_STATUS_T eEewEncrypt; - - DEBUGFUNC("wlanoidSetEncryptionStatus"); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - prGlueInfo = prAdapter->prGlueInfo; - - *pu4SetInfoLen = sizeof(ENUM_PARAM_ENCRYPTION_STATUS_T); - - //if (IS_ARB_IN_RFTEST_STATE(prAdapter)) { - // return WLAN_STATUS_SUCCESS; - //} - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set encryption status! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - eEewEncrypt = *(P_ENUM_PARAM_ENCRYPTION_STATUS_T)pvSetBuffer; - DBGLOG(REQ, TRACE, ("ENCRYPTION_STATUS %d\n", eEewEncrypt)); - - switch (eEewEncrypt) { - case ENUM_ENCRYPTION_DISABLED: /* Disable WEP, TKIP, AES */ - DBGLOG(RSN, TRACE, ("Disable Encryption\n")); - secSetCipherSuite(prAdapter, - CIPHER_FLAG_WEP40 | - CIPHER_FLAG_WEP104 | - CIPHER_FLAG_WEP128); - break; - - case ENUM_ENCRYPTION1_ENABLED: /* Enable WEP. Disable TKIP, AES */ - DBGLOG(RSN, TRACE, ("Enable Encryption1\n")); - secSetCipherSuite(prAdapter, - CIPHER_FLAG_WEP40 | - CIPHER_FLAG_WEP104 | - CIPHER_FLAG_WEP128); - break; - - case ENUM_ENCRYPTION2_ENABLED: /* Enable WEP, TKIP. Disable AES */ - secSetCipherSuite(prAdapter, - CIPHER_FLAG_WEP40 | - CIPHER_FLAG_WEP104 | - CIPHER_FLAG_WEP128 | - CIPHER_FLAG_TKIP); - DBGLOG(RSN, TRACE, ("Enable Encryption2\n")); - break; - - case ENUM_ENCRYPTION3_ENABLED: /* Enable WEP, TKIP, AES */ - secSetCipherSuite(prAdapter, - CIPHER_FLAG_WEP40 | - CIPHER_FLAG_WEP104 | - CIPHER_FLAG_WEP128 | - CIPHER_FLAG_TKIP | - CIPHER_FLAG_CCMP); - DBGLOG(RSN, TRACE, ("Enable Encryption3\n")); - break; - - default: - DBGLOG(RSN, WARN, ("Unacceptible encryption status: %d\n", - *(P_ENUM_PARAM_ENCRYPTION_STATUS_T)pvSetBuffer)); - - rStatus = WLAN_STATUS_NOT_SUPPORTED; - } - - if (rStatus == WLAN_STATUS_SUCCESS) { - /* Save the new encryption status. */ - prAdapter->rWifiVar.rConnSettings.eEncStatus = - *(P_ENUM_PARAM_ENCRYPTION_STATUS_T)pvSetBuffer; - } - - return rStatus; -} /* wlanoidSetEncryptionStatus */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to test the driver. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_INVALID_DATA -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetTest ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_802_11_TEST_T prTest; - PVOID pvTestData; - PVOID pvStatusBuffer; - UINT_32 u4StatusBufferSize; - - DEBUGFUNC("wlanoidSetTest"); - - ASSERT(prAdapter); - - ASSERT(pu4SetInfoLen); - ASSERT(pvSetBuffer); - - *pu4SetInfoLen = u4SetBufferLen; - - prTest = (P_PARAM_802_11_TEST_T)pvSetBuffer; - - DBGLOG(REQ, TRACE, ("Test - Type %ld\n", prTest->u4Type)); - - switch (prTest->u4Type) { - case 1: /* Type 1: generate an authentication event */ - pvTestData = (PVOID)&prTest->u.AuthenticationEvent; - pvStatusBuffer = (PVOID)prAdapter->aucIndicationEventBuffer; - u4StatusBufferSize = prTest->u4Length - 8; - break; - - case 2: /* Type 2: generate an RSSI status indication */ - pvTestData = (PVOID)&prTest->u.RssiTrigger; - pvStatusBuffer = (PVOID)&prAdapter->rWlanInfo.rCurrBssId.rRssi; - u4StatusBufferSize = sizeof(PARAM_RSSI); - break; - - default: - return WLAN_STATUS_INVALID_DATA; - } - - ASSERT(u4StatusBufferSize <= 180); - if (u4StatusBufferSize > 180) { - return WLAN_STATUS_INVALID_LENGTH; - } - - /* Get the contents of the StatusBuffer from the test structure. */ - kalMemCopy(pvStatusBuffer, pvTestData, u4StatusBufferSize); - - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_SPECIFIC_INDICATION, - pvStatusBuffer, - u4StatusBufferSize); - - return WLAN_STATUS_SUCCESS; -} /* wlanoidSetTest */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the driver's WPA2 status. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryCapability ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - P_PARAM_CAPABILITY_T prCap; - P_PARAM_AUTH_ENCRYPTION_T prAuthenticationEncryptionSupported; - - DEBUGFUNC("wlanoidQueryCapability"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = 4 * sizeof(UINT_32) + 14 * sizeof(PARAM_AUTH_ENCRYPTION_T); - - if (u4QueryBufferLen < *pu4QueryInfoLen) { - return WLAN_STATUS_INVALID_LENGTH; - } - - prCap = (P_PARAM_CAPABILITY_T)pvQueryBuffer; - - prCap->u4Length = *pu4QueryInfoLen; - prCap->u4Version = 2; /* WPA2 */ - prCap->u4NoOfPMKIDs = CFG_MAX_PMKID_CACHE; - prCap->u4NoOfAuthEncryptPairsSupported = 14; - - prAuthenticationEncryptionSupported = - &prCap->arAuthenticationEncryptionSupported[0]; - - // fill 14 entries of supported settings - prAuthenticationEncryptionSupported[0].eAuthModeSupported = - AUTH_MODE_OPEN; - - prAuthenticationEncryptionSupported[0].eEncryptStatusSupported = - ENUM_ENCRYPTION_DISABLED; - - prAuthenticationEncryptionSupported[1].eAuthModeSupported = - AUTH_MODE_OPEN; - prAuthenticationEncryptionSupported[1].eEncryptStatusSupported = - ENUM_ENCRYPTION1_ENABLED; - - prAuthenticationEncryptionSupported[2].eAuthModeSupported = - AUTH_MODE_SHARED; - prAuthenticationEncryptionSupported[2].eEncryptStatusSupported = - ENUM_ENCRYPTION_DISABLED; - - prAuthenticationEncryptionSupported[3].eAuthModeSupported = - AUTH_MODE_SHARED; - prAuthenticationEncryptionSupported[3].eEncryptStatusSupported = - ENUM_ENCRYPTION1_ENABLED; - - prAuthenticationEncryptionSupported[4].eAuthModeSupported = - AUTH_MODE_WPA; - prAuthenticationEncryptionSupported[4].eEncryptStatusSupported = - ENUM_ENCRYPTION2_ENABLED; - - prAuthenticationEncryptionSupported[5].eAuthModeSupported = - AUTH_MODE_WPA; - prAuthenticationEncryptionSupported[5].eEncryptStatusSupported = - ENUM_ENCRYPTION3_ENABLED; - - prAuthenticationEncryptionSupported[6].eAuthModeSupported = - AUTH_MODE_WPA_PSK; - prAuthenticationEncryptionSupported[6].eEncryptStatusSupported = - ENUM_ENCRYPTION2_ENABLED; - - prAuthenticationEncryptionSupported[7].eAuthModeSupported = - AUTH_MODE_WPA_PSK; - prAuthenticationEncryptionSupported[7].eEncryptStatusSupported = - ENUM_ENCRYPTION3_ENABLED; - - prAuthenticationEncryptionSupported[8].eAuthModeSupported = - AUTH_MODE_WPA_NONE; - prAuthenticationEncryptionSupported[8].eEncryptStatusSupported = - ENUM_ENCRYPTION2_ENABLED; - - prAuthenticationEncryptionSupported[9].eAuthModeSupported = - AUTH_MODE_WPA_NONE; - prAuthenticationEncryptionSupported[9].eEncryptStatusSupported = - ENUM_ENCRYPTION3_ENABLED; - - prAuthenticationEncryptionSupported[10].eAuthModeSupported = - AUTH_MODE_WPA2; - prAuthenticationEncryptionSupported[10].eEncryptStatusSupported = - ENUM_ENCRYPTION2_ENABLED; - - prAuthenticationEncryptionSupported[11].eAuthModeSupported = - AUTH_MODE_WPA2; - prAuthenticationEncryptionSupported[11].eEncryptStatusSupported = - ENUM_ENCRYPTION3_ENABLED; - - prAuthenticationEncryptionSupported[12].eAuthModeSupported = - AUTH_MODE_WPA2_PSK; - prAuthenticationEncryptionSupported[12].eEncryptStatusSupported = - ENUM_ENCRYPTION2_ENABLED; - - prAuthenticationEncryptionSupported[13].eAuthModeSupported = - AUTH_MODE_WPA2_PSK; - prAuthenticationEncryptionSupported[13].eEncryptStatusSupported = - ENUM_ENCRYPTION3_ENABLED; - - return WLAN_STATUS_SUCCESS; - -} /* wlanoidQueryCapability */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the PMKID in the PMK cache. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryPmkid ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - UINT_32 i; - P_PARAM_PMKID_T prPmkid; - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo; - - DEBUGFUNC("wlanoidQueryPmkid"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - prAisSpecBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - - *pu4QueryInfoLen = OFFSET_OF(PARAM_PMKID_T, arBSSIDInfo) + - prAisSpecBssInfo->u4PmkidCacheCount * sizeof(PARAM_BSSID_INFO_T); - - if (u4QueryBufferLen < *pu4QueryInfoLen) { - return WLAN_STATUS_INVALID_LENGTH; - } - - prPmkid = (P_PARAM_PMKID_T)pvQueryBuffer; - - prPmkid->u4Length = *pu4QueryInfoLen; - prPmkid->u4BSSIDInfoCount = prAisSpecBssInfo->u4PmkidCacheCount; - - for (i = 0; i < prAisSpecBssInfo->u4PmkidCacheCount; i++) { - kalMemCopy(prPmkid->arBSSIDInfo[i].arBSSID, - prAisSpecBssInfo->arPmkidCache[i].rBssidInfo.arBSSID, - sizeof(PARAM_MAC_ADDRESS)); - kalMemCopy(prPmkid->arBSSIDInfo[i].arPMKID, - prAisSpecBssInfo->arPmkidCache[i].rBssidInfo.arPMKID, - sizeof(PARAM_PMKID_VALUE)); - } - - return WLAN_STATUS_SUCCESS; - -} /* wlanoidQueryPmkid */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set the PMKID to the PMK cache in the driver. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -* \retval WLAN_STATUS_INVALID_DATA -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetPmkid ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - UINT_32 i, j; - P_PARAM_PMKID_T prPmkid; - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo; - - DEBUGFUNC("wlanoidSetPmkid"); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = u4SetBufferLen; - - /* It's possibble BSSIDInfoCount is zero, because OS wishes to clean PMKID */ - if (u4SetBufferLen < OFFSET_OF(PARAM_PMKID_T, arBSSIDInfo)) { - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - ASSERT(pvSetBuffer); - prPmkid = (P_PARAM_PMKID_T)pvSetBuffer; - - if (u4SetBufferLen < - ((prPmkid->u4BSSIDInfoCount * sizeof(PARAM_BSSID_INFO_T)) + - OFFSET_OF(PARAM_PMKID_T, arBSSIDInfo))) { - return WLAN_STATUS_INVALID_DATA; - } - - if (prPmkid->u4BSSIDInfoCount > CFG_MAX_PMKID_CACHE) { - return WLAN_STATUS_INVALID_DATA; - } - - DBGLOG(REQ, INFO, ("Count %lu\n", prPmkid->u4BSSIDInfoCount)); - - prAisSpecBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - - /* This OID replace everything in the PMKID cache. */ - if (prPmkid->u4BSSIDInfoCount == 0) { - prAisSpecBssInfo->u4PmkidCacheCount = 0; - kalMemZero(prAisSpecBssInfo->arPmkidCache, sizeof(PMKID_ENTRY_T) * CFG_MAX_PMKID_CACHE); - } - if ((prAisSpecBssInfo->u4PmkidCacheCount + prPmkid->u4BSSIDInfoCount > CFG_MAX_PMKID_CACHE)) { - prAisSpecBssInfo->u4PmkidCacheCount = 0; - kalMemZero(prAisSpecBssInfo->arPmkidCache, sizeof(PMKID_ENTRY_T) * CFG_MAX_PMKID_CACHE); - } - - /* - The driver can only clear its PMKID cache whenever it make a media disconnect - indication. Otherwise, it must change the PMKID cache only when set through this OID. - */ -#if CFG_RSN_MIGRATION - for (i = 0; i < prPmkid->u4BSSIDInfoCount; i++) { - /* Search for desired BSSID. If desired BSSID is found, - then set the PMKID */ - if (!rsnSearchPmkidEntry(prAdapter, - (PUINT_8)prPmkid->arBSSIDInfo[i].arBSSID, - &j)) { - /* No entry found for the specified BSSID, so add one entry */ - if (prAisSpecBssInfo->u4PmkidCacheCount < CFG_MAX_PMKID_CACHE - 1) { - j = prAisSpecBssInfo->u4PmkidCacheCount; - kalMemCopy(prAisSpecBssInfo->arPmkidCache[j].rBssidInfo.arBSSID, - prPmkid->arBSSIDInfo[i].arBSSID, - sizeof(PARAM_MAC_ADDRESS)); - prAisSpecBssInfo->u4PmkidCacheCount++; - } - else { - j = CFG_MAX_PMKID_CACHE; - } - } - - if (j < CFG_MAX_PMKID_CACHE) { - kalMemCopy(prAisSpecBssInfo->arPmkidCache[j].rBssidInfo.arPMKID, - prPmkid->arBSSIDInfo[i].arPMKID, - sizeof(PARAM_PMKID_VALUE)); - DBGLOG(RSN, TRACE, ("Add BSSID "MACSTR" idx=%d PMKID value "MACSTR"\n", - MAC2STR(prAisSpecBssInfo->arPmkidCache[j].rBssidInfo.arBSSID),j, MAC2STR(prAisSpecBssInfo->arPmkidCache[j].rBssidInfo.arPMKID))); - prAisSpecBssInfo->arPmkidCache[j].fgPmkidExist = TRUE; - } - } -#endif - return WLAN_STATUS_SUCCESS; - -} /* wlanoidSetPmkid */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the set of supported data rates that -* the radio is capable of running -* -* \param[in] prAdapter Pointer to the Adapter structure -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query -* \param[in] u4QueryBufferLen The length of the query buffer -* \param[out] pu4QueryInfoLen If the call is successful, returns the number -* of bytes written into the query buffer. If the -* call failed due to invalid length of the query -* buffer, returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQuerySupportedRates ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - PARAM_RATES eRate = { - // BSSBasicRateSet for 802.11n Non-HT rates - 0x8C, // 6M - 0x92, // 9M - 0x98, // 12M - 0xA4, // 18M - 0xB0, // 24M - 0xC8, // 36M - 0xE0, // 48M - 0xEC // 54M - }; - - DEBUGFUNC("wlanoidQuerySupportedRates"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(PARAM_RATES_EX); - - if (u4QueryBufferLen < *pu4QueryInfoLen ) { - DBGLOG(REQ, WARN, ("Invalid length %ld\n", u4QueryBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - - kalMemCopy(pvQueryBuffer, - (PVOID)&eRate, - sizeof(PARAM_RATES)); - - return WLAN_STATUS_SUCCESS; -} /* end of wlanoidQuerySupportedRates() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query current desired rates. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryDesiredRates ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryDesiredRates"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(PARAM_RATES_EX); - - if (u4QueryBufferLen < *pu4QueryInfoLen ) { - DBGLOG(REQ, WARN, ("Invalid length %ld\n", u4QueryBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - - kalMemCopy(pvQueryBuffer, - (PVOID)&(prAdapter->rWlanInfo.eDesiredRates), - sizeof(PARAM_RATES)); - - return WLAN_STATUS_SUCCESS; - -} /* end of wlanoidQueryDesiredRates() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to Set the desired rates. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_INVALID_DATA -* \retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetDesiredRates ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - UINT_32 i; - DEBUGFUNC("wlanoidSetDesiredRates"); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - if (u4SetBufferLen < sizeof(PARAM_RATES)) { - DBGLOG(REQ, WARN, ("Invalid length %ld\n", u4SetBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - - *pu4SetInfoLen = sizeof(PARAM_RATES); - - if (u4SetBufferLen < sizeof(PARAM_RATES)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - kalMemCopy((PVOID)&(prAdapter->rWlanInfo.eDesiredRates), - pvSetBuffer, - sizeof(PARAM_RATES)); - - prAdapter->rWlanInfo.eLinkAttr.ucDesiredRateLen = PARAM_MAX_LEN_RATES; - for (i = 0 ; i < PARAM_MAX_LEN_RATES ; i++) { - prAdapter->rWlanInfo.eLinkAttr.u2DesiredRate[i] = - (UINT_16) (prAdapter->rWlanInfo.eDesiredRates[i]); - } - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_LINK_ATTRIB, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_LINK_ATTRIB), - (PUINT_8)&(prAdapter->rWlanInfo.eLinkAttr), - pvSetBuffer, - u4SetBufferLen - ); - -} /* end of wlanoidSetDesiredRates() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the maximum frame size in bytes, -* not including the header. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the -* call failed due to invalid length of the query -* buffer, returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryMaxFrameSize ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryMaxFrameSize"); - - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - - if (u4QueryBufferLen < sizeof(UINT_32)) { - *pu4QueryInfoLen = sizeof(UINT_32); - return WLAN_STATUS_INVALID_LENGTH; - } - - *(PUINT_32)pvQueryBuffer = ETHERNET_MAX_PKT_SZ - ETHERNET_HEADER_SZ; - *pu4QueryInfoLen = sizeof(UINT_32); - - return WLAN_STATUS_SUCCESS; -} /* wlanoidQueryMaxFrameSize */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the maximum total packet length -* in bytes. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryMaxTotalSize ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryMaxTotalSize"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - if (u4QueryBufferLen < sizeof(UINT_32)) { - *pu4QueryInfoLen = sizeof(UINT_32); - return WLAN_STATUS_INVALID_LENGTH; - } - - *(PUINT_32)pvQueryBuffer = ETHERNET_MAX_PKT_SZ; - *pu4QueryInfoLen = sizeof(UINT_32); - - return WLAN_STATUS_SUCCESS; -} /* wlanoidQueryMaxTotalSize */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the vendor ID of the NIC. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryVendorId ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ -#if DBG - PUINT_8 cp; -#endif - DEBUGFUNC("wlanoidQueryVendorId"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - if (u4QueryBufferLen < sizeof(UINT_32)) { - *pu4QueryInfoLen = sizeof(UINT_32); - return WLAN_STATUS_INVALID_LENGTH; - } - - kalMemCopy(pvQueryBuffer, prAdapter->aucMacAddress, 3); - *((PUINT_8)pvQueryBuffer + 3) = 1; - *pu4QueryInfoLen = sizeof(UINT_32); - -#if DBG - cp = (PUINT_8)pvQueryBuffer; - DBGLOG(REQ, LOUD, ("Vendor ID=%02x-%02x-%02x-%02x\n", cp[0], cp[1], cp[2], cp[3])); -#endif - - return WLAN_STATUS_SUCCESS; -} /* wlanoidQueryVendorId */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the current RSSI value. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call failed due to invalid length of -* the query buffer, returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -* \retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryRssi ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryRssi"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(PARAM_RSSI); - - /* Check for query buffer length */ - if (u4QueryBufferLen < *pu4QueryInfoLen) { - DBGLOG(REQ, WARN, ("Too short length %ld\n", u4QueryBufferLen)); - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - if (kalGetMediaStateIndicated(prAdapter->prGlueInfo) == PARAM_MEDIA_STATE_DISCONNECTED) { - return WLAN_STATUS_ADAPTER_NOT_READY; - } - else if (prAdapter->fgIsLinkQualityValid == TRUE && - (kalGetTimeTick() - prAdapter->rLinkQualityUpdateTime) <= CFG_LINK_QUALITY_VALID_PERIOD) { - PARAM_RSSI rRssi; - - rRssi = (PARAM_RSSI)prAdapter->rLinkQuality.cRssi; // ranged from (-128 ~ 30) in unit of dBm - if(rRssi > PARAM_WHQL_RSSI_MAX_DBM) - rRssi = PARAM_WHQL_RSSI_MAX_DBM; - else if(rRssi < PARAM_WHQL_RSSI_MIN_DBM) - rRssi = PARAM_WHQL_RSSI_MIN_DBM; - - kalMemCopy(pvQueryBuffer, &rRssi, sizeof(PARAM_RSSI)); - return WLAN_STATUS_SUCCESS; - } - - #ifdef LINUX - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_LINK_QUALITY, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryLinkQuality, - nicOidCmdTimeoutCommon, - *pu4QueryInfoLen, - pvQueryBuffer, - pvQueryBuffer, - u4QueryBufferLen - ); - #else - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_LINK_QUALITY, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryLinkQuality, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvQueryBuffer, - u4QueryBufferLen - ); - - #endif -} /* end of wlanoidQueryRssi() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the current RSSI trigger value. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call failed due to invalid length of -* the query buffer, returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryRssiTrigger ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryRssiTrigger"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - - if(prAdapter->rWlanInfo.eRssiTriggerType == ENUM_RSSI_TRIGGER_NONE) - return WLAN_STATUS_ADAPTER_NOT_READY; - - *pu4QueryInfoLen = sizeof(PARAM_RSSI); - - /* Check for query buffer length */ - if (u4QueryBufferLen < *pu4QueryInfoLen) { - DBGLOG(REQ, WARN, ("Too short length %ld\n", u4QueryBufferLen)); - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - *(PARAM_RSSI *) pvQueryBuffer = prAdapter->rWlanInfo.rRssiTriggerValue; - DBGLOG(REQ, INFO, ("RSSI trigger: %ld dBm\n", *(PARAM_RSSI *) pvQueryBuffer)); - - return WLAN_STATUS_SUCCESS; -} /* wlanoidQueryRssiTrigger */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set a trigger value of the RSSI event. -* -* \param[in] prAdapter Pointer to the Adapter structure -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns the -* amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetRssiTrigger ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - PARAM_RSSI rRssiTriggerValue; - DEBUGFUNC("wlanoidSetRssiTrigger"); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - - *pu4SetInfoLen = sizeof(PARAM_RSSI); - rRssiTriggerValue = *(PARAM_RSSI *) pvSetBuffer; - - if(rRssiTriggerValue > PARAM_WHQL_RSSI_MAX_DBM - || rRssiTriggerValue < PARAM_WHQL_RSSI_MIN_DBM) - return - - /* Save the RSSI trigger value to the Adapter structure */ - prAdapter->rWlanInfo.rRssiTriggerValue = rRssiTriggerValue; - - /* If the RSSI trigger value is equal to the current RSSI value, the - * indication triggers immediately. We need to indicate the protocol - * that an RSSI status indication event triggers. */ - if (rRssiTriggerValue == (PARAM_RSSI)(prAdapter->rLinkQuality.cRssi)) { - prAdapter->rWlanInfo.eRssiTriggerType = ENUM_RSSI_TRIGGER_TRIGGERED; - - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_SPECIFIC_INDICATION, - (PVOID) &prAdapter->rWlanInfo.rRssiTriggerValue, sizeof(PARAM_RSSI)); - } - else if(rRssiTriggerValue < (PARAM_RSSI)(prAdapter->rLinkQuality.cRssi)) - prAdapter->rWlanInfo.eRssiTriggerType = ENUM_RSSI_TRIGGER_GREATER; - else if(rRssiTriggerValue > (PARAM_RSSI)(prAdapter->rLinkQuality.cRssi)) - prAdapter->rWlanInfo.eRssiTriggerType = ENUM_RSSI_TRIGGER_LESS; - - return WLAN_STATUS_SUCCESS; -} /* wlanoidSetRssiTrigger */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set a suggested value for the number of -* bytes of received packet data that will be indicated to the protocol -* driver. We just accept the set and ignore this value. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetCurrentLookahead ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - DEBUGFUNC("wlanoidSetCurrentLookahead"); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - if (u4SetBufferLen < sizeof(UINT_32)) { - *pu4SetInfoLen = sizeof(UINT_32); - return WLAN_STATUS_INVALID_LENGTH; - } - - *pu4SetInfoLen = sizeof(UINT_32); - return WLAN_STATUS_SUCCESS; -} /* wlanoidSetCurrentLookahead */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the number of frames that the driver -* receives but does not indicate to the protocols due to errors. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuf A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryRcvError ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryRcvError"); - DBGLOG(REQ, LOUD, ("\n")); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in query receive error! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - *pu4QueryInfoLen = sizeof(UINT_32); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - else if (u4QueryBufferLen < sizeof(UINT_32) - || (u4QueryBufferLen > sizeof(UINT_32) && u4QueryBufferLen < sizeof(UINT_64))) { - *pu4QueryInfoLen = sizeof(UINT_64); - return WLAN_STATUS_INVALID_LENGTH; - } - -#if CFG_ENABLE_STATISTICS_BUFFERING - if(IsBufferedStatisticsUsable(prAdapter) == TRUE) { - // @FIXME, RX_ERROR_DROP_COUNT/RX_FIFO_FULL_DROP_COUNT is not calculated - if(u4QueryBufferLen == sizeof(UINT_32)) { - *pu4QueryInfoLen = sizeof(UINT_32); - *(PUINT_32) pvQueryBuffer = (UINT_32) prAdapter->rStatStruct.rFCSErrorCount.QuadPart; - } - else { - *pu4QueryInfoLen = sizeof(UINT_64); - *(PUINT_64) pvQueryBuffer = (UINT_64) prAdapter->rStatStruct.rFCSErrorCount.QuadPart; - } - - return WLAN_STATUS_SUCCESS; - } - else -#endif - { - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_STATISTICS, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryRecvError, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvQueryBuffer, - u4QueryBufferLen - ); - } -} /* wlanoidQueryRcvError */ - - -/*----------------------------------------------------------------------------*/ -/*! \brief This routine is called to query the number of frames that the NIC -* cannot receive due to lack of NIC receive buffer space. -* -* \param[in] pvAdapter Pointer to the Adapter structure -* \param[in] pvQueryBuf A pointer to the buffer that holds the result of the -* query buffer -* \param[in] u4QueryBufLen The length of the query buffer -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS If success; -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryRcvNoBuffer ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryRcvNoBuffer"); - DBGLOG(REQ, LOUD, ("\n")); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in query receive error! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - *pu4QueryInfoLen = sizeof(UINT_32); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - else if (u4QueryBufferLen < sizeof(UINT_32) - || (u4QueryBufferLen > sizeof(UINT_32) && u4QueryBufferLen < sizeof(UINT_64))) { - *pu4QueryInfoLen = sizeof(UINT_64); - return WLAN_STATUS_INVALID_LENGTH; - } - -#if CFG_ENABLE_STATISTICS_BUFFERING - if(IsBufferedStatisticsUsable(prAdapter) == TRUE) { - if(u4QueryBufferLen == sizeof(UINT_32)) { - *pu4QueryInfoLen = sizeof(UINT_32); - *(PUINT_32) pvQueryBuffer = (UINT_32) 0; //@FIXME - } - else { - *pu4QueryInfoLen = sizeof(UINT_64); - *(PUINT_64) pvQueryBuffer = (UINT_64) 0; //@FIXME - } - - return WLAN_STATUS_SUCCESS; - } - else -#endif - { - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_STATISTICS, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryRecvNoBuffer, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvQueryBuffer, - u4QueryBufferLen - ); - } -} /* wlanoidQueryRcvNoBuffer */ - - -/*----------------------------------------------------------------------------*/ -/*! \brief This routine is called to query the number of frames that the NIC -* received and it is CRC error. -* -* \param[in] pvAdapter Pointer to the Adapter structure -* \param[in] pvQueryBuf A pointer to the buffer that holds the result of the -* query buffer -* \param[in] u4QueryBufLen The length of the query buffer -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS If success; -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryRcvCrcError ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryRcvCrcError"); - DBGLOG(REQ, LOUD, ("\n")); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in query receive error! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - *pu4QueryInfoLen = sizeof(UINT_32); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - else if (u4QueryBufferLen < sizeof(UINT_32) - || (u4QueryBufferLen > sizeof(UINT_32) && u4QueryBufferLen < sizeof(UINT_64))) { - *pu4QueryInfoLen = sizeof(UINT_64); - return WLAN_STATUS_INVALID_LENGTH; - } -#if CFG_ENABLE_STATISTICS_BUFFERING - if(IsBufferedStatisticsUsable(prAdapter) == TRUE) { - if(u4QueryBufferLen == sizeof(UINT_32)) { - *pu4QueryInfoLen = sizeof(UINT_32); - *(PUINT_32) pvQueryBuffer = (UINT_32) prAdapter->rStatStruct.rFCSErrorCount.QuadPart; - } - else { - *pu4QueryInfoLen = sizeof(UINT_64); - *(PUINT_64) pvQueryBuffer = (UINT_64) prAdapter->rStatStruct.rFCSErrorCount.QuadPart; - } - - return WLAN_STATUS_SUCCESS; - } - else -#endif - { - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_STATISTICS, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryRecvCrcError, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvQueryBuffer, - u4QueryBufferLen - ); - } -} /* wlanoidQueryRcvCrcError */ - - -/*----------------------------------------------------------------------------*/ -/*! \brief This routine is called to query the current 802.11 statistics. -* -* \param[in] pvAdapter Pointer to the Adapter structure -* \param[in] pvQueryBuf A pointer to the buffer that holds the result of the -* query buffer -* \param[in] u4QueryBufLen The length of the query buffer -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryStatistics ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryStatistics"); - DBGLOG(REQ, LOUD, ("\n")); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - *pu4QueryInfoLen = sizeof(PARAM_802_11_STATISTICS_STRUCT_T); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in query receive error! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - *pu4QueryInfoLen = sizeof(UINT_32); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - else if (u4QueryBufferLen < sizeof(PARAM_802_11_STATISTICS_STRUCT_T)) { - DBGLOG(REQ, WARN, ("Too short length %ld\n", u4QueryBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - -#if CFG_ENABLE_STATISTICS_BUFFERING - if(IsBufferedStatisticsUsable(prAdapter) == TRUE) { - P_PARAM_802_11_STATISTICS_STRUCT_T prStatistics; - - *pu4QueryInfoLen = sizeof(PARAM_802_11_STATISTICS_STRUCT_T); - prStatistics = (P_PARAM_802_11_STATISTICS_STRUCT_T) pvQueryBuffer; - - prStatistics->u4Length = sizeof(PARAM_802_11_STATISTICS_STRUCT_T); - prStatistics->rTransmittedFragmentCount - = prAdapter->rStatStruct.rTransmittedFragmentCount; - prStatistics->rMulticastTransmittedFrameCount - = prAdapter->rStatStruct.rMulticastTransmittedFrameCount; - prStatistics->rFailedCount - = prAdapter->rStatStruct.rFailedCount; - prStatistics->rRetryCount - = prAdapter->rStatStruct.rRetryCount; - prStatistics->rMultipleRetryCount - = prAdapter->rStatStruct.rMultipleRetryCount; - prStatistics->rRTSSuccessCount - = prAdapter->rStatStruct.rRTSSuccessCount; - prStatistics->rRTSFailureCount - = prAdapter->rStatStruct.rRTSFailureCount; - prStatistics->rACKFailureCount - = prAdapter->rStatStruct.rACKFailureCount; - prStatistics->rFrameDuplicateCount - = prAdapter->rStatStruct.rFrameDuplicateCount; - prStatistics->rReceivedFragmentCount - = prAdapter->rStatStruct.rReceivedFragmentCount; - prStatistics->rMulticastReceivedFrameCount - = prAdapter->rStatStruct.rMulticastReceivedFrameCount; - prStatistics->rFCSErrorCount - = prAdapter->rStatStruct.rFCSErrorCount; - prStatistics->rTKIPLocalMICFailures.QuadPart - = 0; - prStatistics->rTKIPICVErrors.QuadPart - = 0; - prStatistics->rTKIPCounterMeasuresInvoked.QuadPart - = 0; - prStatistics->rTKIPReplays.QuadPart - = 0; - prStatistics->rCCMPFormatErrors.QuadPart - = 0; - prStatistics->rCCMPReplays.QuadPart - = 0; - prStatistics->rCCMPDecryptErrors.QuadPart - = 0; - prStatistics->rFourWayHandshakeFailures.QuadPart - = 0; - prStatistics->rWEPUndecryptableCount.QuadPart - = 0; - prStatistics->rWEPICVErrorCount.QuadPart - = 0; - prStatistics->rDecryptSuccessCount.QuadPart - = 0; - prStatistics->rDecryptFailureCount.QuadPart - = 0; - - return WLAN_STATUS_SUCCESS; - } - else -#endif - { - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_STATISTICS, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryStatistics, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvQueryBuffer, - u4QueryBufferLen - ); - } -} /* wlanoidQueryStatistics */ - - -/*----------------------------------------------------------------------------*/ -/*! \brief This routine is called to query current media streaming status. -* -* \param[in] pvAdapter Pointer to the Adapter structure -* \param[in] pvQueryBuf A pointer to the buffer that holds the result of the -* query buffer -* \param[in] u4QueryBufLen The length of the query buffer -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryMediaStreamMode( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryMediaStreamMode"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(ENUM_MEDIA_STREAM_MODE); - - if (u4QueryBufferLen < *pu4QueryInfoLen ) { - DBGLOG(REQ, WARN, ("Invalid length %ld\n", u4QueryBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - - *(P_ENUM_MEDIA_STREAM_MODE)pvQueryBuffer = - prAdapter->rWlanInfo.eLinkAttr.ucMediaStreamMode == 0 ? - ENUM_MEDIA_STREAM_OFF : ENUM_MEDIA_STREAM_ON; - - return WLAN_STATUS_SUCCESS; - -} /* wlanoidQueryMediaStreamMode */ - -/*----------------------------------------------------------------------------*/ -/*! \brief This routine is called to enter media streaming mode or exit media streaming mode -* -* \param[in] pvAdapter Pointer to the Adapter structure -* \param[in] pvQueryBuf A pointer to the buffer that holds the result of the -* query buffer -* \param[in] u4QueryBufLen The length of the query buffer -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetMediaStreamMode( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - ENUM_MEDIA_STREAM_MODE eStreamMode; - - DEBUGFUNC("wlanoidSetMediaStreamMode"); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - if (u4SetBufferLen < sizeof(ENUM_MEDIA_STREAM_MODE)) { - DBGLOG(REQ, WARN, ("Invalid length %ld\n", u4SetBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - - *pu4SetInfoLen = sizeof(ENUM_MEDIA_STREAM_MODE); - - eStreamMode = *(P_ENUM_MEDIA_STREAM_MODE)pvSetBuffer; - - if(eStreamMode == ENUM_MEDIA_STREAM_OFF) - prAdapter->rWlanInfo.eLinkAttr.ucMediaStreamMode = 0; - else - prAdapter->rWlanInfo.eLinkAttr.ucMediaStreamMode = 1; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_LINK_ATTRIB, - TRUE, - FALSE, - TRUE, - nicCmdEventSetMediaStreamMode, - nicOidCmdTimeoutCommon, - sizeof(CMD_LINK_ATTRIB), - (PUINT_8)&(prAdapter->rWlanInfo.eLinkAttr), - pvSetBuffer, - u4SetBufferLen - ); -} /* wlanoidSetMediaStreamMode */ - -/*----------------------------------------------------------------------------*/ -/*! \brief This routine is called to query the permanent MAC address of the NIC. -* -* \param[in] pvAdapter Pointer to the Adapter structure -* \param[in] pvQueryBuf A pointer to the buffer that holds the result of the -* query buffer -* \param[in] u4QueryBufLen The length of the query buffer -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryPermanentAddr ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryPermanentAddr"); - DBGLOG(INIT, LOUD, ("\n")); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - if (u4QueryBufferLen < MAC_ADDR_LEN) { - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - COPY_MAC_ADDR(pvQueryBuffer, prAdapter->rWifiVar.aucPermanentAddress); - *pu4QueryInfoLen = MAC_ADDR_LEN; - - return WLAN_STATUS_SUCCESS; -} /* wlanoidQueryPermanentAddr */ - - -/*----------------------------------------------------------------------------*/ -/*! \brief This routine is called to query the MAC address the NIC is currently using. -* -* \param[in] pvAdapter Pointer to the Adapter structure -* \param[in] pvQueryBuf A pointer to the buffer that holds the result of the -* query buffer -* \param[in] u4QueryBufLen The length of the query buffer -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryCurrentAddr ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - CMD_BASIC_CONFIG rCmdBasicConfig; - - DEBUGFUNC("wlanoidQueryCurrentAddr"); - DBGLOG(INIT, LOUD, ("\n")); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - if (u4QueryBufferLen < MAC_ADDR_LEN) { - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - kalMemZero(&rCmdBasicConfig, sizeof(CMD_BASIC_CONFIG)); - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_BASIC_CONFIG, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryAddress, - nicOidCmdTimeoutCommon, - sizeof(CMD_BASIC_CONFIG), - (PUINT_8)&rCmdBasicConfig, - pvQueryBuffer, - u4QueryBufferLen - ); - -} /* wlanoidQueryCurrentAddr */ - - -/*----------------------------------------------------------------------------*/ -/*! \brief This routine is called to query NIC link speed. -* -* \param[in] pvAdapter Pointer to the Adapter structure -* \param[in] pvQueryBuf A pointer to the buffer that holds the result of the -* query buffer -* \param[in] u4QueryBufLen The length of the query buffer -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryLinkSpeed( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryLinkSpeed"); - - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(UINT_32); - - if (u4QueryBufferLen < sizeof(UINT_32)) { - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - if (kalGetMediaStateIndicated(prAdapter->prGlueInfo) != PARAM_MEDIA_STATE_CONNECTED) { - *(PUINT_32)pvQueryBuffer = 10000; // change to unit of 100bps - return WLAN_STATUS_SUCCESS; - } - else if (prAdapter->fgIsLinkRateValid == TRUE && - (kalGetTimeTick() - prAdapter->rLinkRateUpdateTime) <= CFG_LINK_QUALITY_VALID_PERIOD) { - *(PUINT_32)pvQueryBuffer = prAdapter->rLinkQuality.u2LinkSpeed * 5000; // change to unit of 100bps - return WLAN_STATUS_SUCCESS; - } - else { - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_LINK_QUALITY, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryLinkSpeed, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvQueryBuffer, - u4QueryBufferLen - ); - } -} /* end of wlanoidQueryLinkSpeed() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query MCR value. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuf A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryMcrRead ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - P_PARAM_CUSTOM_MCR_RW_STRUC_T prMcrRdInfo; - CMD_ACCESS_REG rCmdAccessReg; - - DEBUGFUNC("wlanoidQueryMcrRead"); - DBGLOG(INIT, LOUD,("\n")); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(PARAM_CUSTOM_MCR_RW_STRUC_T); - - if (u4QueryBufferLen < sizeof(PARAM_CUSTOM_MCR_RW_STRUC_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - prMcrRdInfo = (P_PARAM_CUSTOM_MCR_RW_STRUC_T)pvQueryBuffer; - - /* 0x9000 - 0x9EFF reserved for FW */ -#if CFG_SUPPORT_SWCR - if((prMcrRdInfo->u4McrOffset >>16) == 0x9F00) { - swCrReadWriteCmd(prAdapter, - SWCR_READ, - (UINT_16) (prMcrRdInfo->u4McrOffset & BITS(0,15)), - &prMcrRdInfo->u4McrData); - return WLAN_STATUS_SUCCESS; - } -#endif /* CFG_SUPPORT_SWCR */ - - /* Check if access F/W Domain MCR (due to WiFiSYS is placed from 0x6000-0000*/ - if (prMcrRdInfo->u4McrOffset & 0xFFFF0000){ - // fill command - rCmdAccessReg.u4Address = prMcrRdInfo->u4McrOffset; - rCmdAccessReg.u4Data = 0; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_ACCESS_REG, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryMcrRead, - nicOidCmdTimeoutCommon, - sizeof(CMD_ACCESS_REG), - (PUINT_8)&rCmdAccessReg, - pvQueryBuffer, - u4QueryBufferLen - ); - } - else { - HAL_MCR_RD(prAdapter, - prMcrRdInfo->u4McrOffset & BITS(2,31), //address is in DWORD unit - &prMcrRdInfo->u4McrData); - - DBGLOG(INIT, TRACE, ("MCR Read: Offset = %#08lx, Data = %#08lx\n", - prMcrRdInfo->u4McrOffset, prMcrRdInfo->u4McrData)); - return WLAN_STATUS_SUCCESS; - } -} /* end of wlanoidQueryMcrRead() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to write MCR and enable specific function. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetMcrWrite ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_CUSTOM_MCR_RW_STRUC_T prMcrWrInfo; - CMD_ACCESS_REG rCmdAccessReg; - -#if CFG_STRESS_TEST_SUPPORT - P_AIS_FSM_INFO_T prAisFsmInfo; - P_BSS_INFO_T prBssInfo = &(prAdapter->rWifiVar.arBssInfo[(NETWORK_TYPE_AIS_INDEX)]); - P_STA_RECORD_T prStaRec = prBssInfo->prStaRecOfAP; - UINT_32 u4McrOffset, u4McrData; -#endif - - DEBUGFUNC("wlanoidSetMcrWrite"); - DBGLOG(INIT, LOUD,("\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_CUSTOM_MCR_RW_STRUC_T); - - if (u4SetBufferLen < sizeof(PARAM_CUSTOM_MCR_RW_STRUC_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - - prMcrWrInfo = (P_PARAM_CUSTOM_MCR_RW_STRUC_T)pvSetBuffer; - - /* 0x9000 - 0x9EFF reserved for FW */ - /* 0xFFFE reserved for FW */ - - // -- Puff Stress Test Begin -#if CFG_STRESS_TEST_SUPPORT - - // 0xFFFFFFFE for Control Rate - if (prMcrWrInfo->u4McrOffset == 0xFFFFFFFE){ - if(prMcrWrInfo->u4McrData < FIXED_RATE_NUM && prMcrWrInfo->u4McrData > 0){ - prAdapter->rWifiVar.eRateSetting = (ENUM_REGISTRY_FIXED_RATE_T)(prMcrWrInfo->u4McrData); - } - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); - DEBUGFUNC("[Stress Test]Complete Rate is Changed...\n"); - DBGLOG(INIT, TRACE, ("[Stress Test] Rate is Changed to index %d...\n", prAdapter->rWifiVar.eRateSetting)); - } - - // 0xFFFFFFFD for Switch Channel - else if (prMcrWrInfo->u4McrOffset == 0xFFFFFFFD){ - if(prMcrWrInfo->u4McrData <= 11 && prMcrWrInfo->u4McrData >= 1){ - prBssInfo->ucPrimaryChannel = prMcrWrInfo->u4McrData; - } - nicUpdateBss(prAdapter, prBssInfo->ucNetTypeIndex); - DBGLOG(INIT, TRACE, ("[Stress Test] Channel is switched to %d ...\n", prBssInfo->ucPrimaryChannel)); - - return WLAN_STATUS_SUCCESS; - } - - // 0xFFFFFFFFC for Control RF Band and SCO - else if(prMcrWrInfo->u4McrOffset == 0xFFFFFFFC){ - // Band - if(prMcrWrInfo->u4McrData & 0x80000000){ - //prBssInfo->eBand = BAND_5G; - //prBssInfo->ucPrimaryChannel = 52; // Bond to Channel 52 - } else { - prBssInfo->eBand = BAND_2G4; - prBssInfo->ucPrimaryChannel = 8; // Bond to Channel 6 - } - - // Bandwidth - if(prMcrWrInfo->u4McrData & 0x00010000){ - prStaRec->u2HtCapInfo |= HT_CAP_INFO_SUP_CHNL_WIDTH; - prStaRec->ucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - - if(prMcrWrInfo->u4McrData == 0x00010002){ - prBssInfo->eBssSCO = CHNL_EXT_SCB; // U20 - prBssInfo->ucPrimaryChannel += 2; - } else if (prMcrWrInfo->u4McrData == 0x00010001){ - prBssInfo->eBssSCO = CHNL_EXT_SCA; // L20 - prBssInfo->ucPrimaryChannel -= 2; - } else { - prBssInfo->eBssSCO = CHNL_EXT_SCA; // 40 - } - } - - if(prMcrWrInfo->u4McrData & 0x00000000){ - prStaRec->u2HtCapInfo &= ~HT_CAP_INFO_SUP_CHNL_WIDTH; - prBssInfo->eBssSCO = CHNL_EXT_SCN; - } - rlmBssInitForAPandIbss(prAdapter, prBssInfo); - } - - // 0xFFFFFFFB for HT Capability - else if (prMcrWrInfo->u4McrOffset == 0xFFFFFFFB){ - /* Enable HT Capability */ - if(prMcrWrInfo->u4McrData & 0x00000001){ - prStaRec->u2HtCapInfo |= HT_CAP_INFO_HT_GF; - DEBUGFUNC("[Stress Test]Enable HT capability...\n"); - }else{ - prStaRec->u2HtCapInfo &= (~HT_CAP_INFO_HT_GF); - DEBUGFUNC("[Stress Test]Disable HT capability...\n"); - } - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); - } - - // 0xFFFFFFFA for Enable Random Rx Reset - else if (prMcrWrInfo->u4McrOffset == 0xFFFFFFFA){ - rCmdAccessReg.u4Address = prMcrWrInfo->u4McrOffset; - rCmdAccessReg.u4Data = prMcrWrInfo->u4McrData; - - return wlanSendSetQueryCmd( - prAdapter, - CMD_ID_RANDOM_RX_RESET_EN, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_ACCESS_REG), - (PUINT_8)&rCmdAccessReg, - pvSetBuffer, - u4SetBufferLen - ); - } - - // 0xFFFFFFF9 for Disable Random Rx Reset - else if (prMcrWrInfo->u4McrOffset == 0xFFFFFFF9){ - rCmdAccessReg.u4Address = prMcrWrInfo->u4McrOffset; - rCmdAccessReg.u4Data = prMcrWrInfo->u4McrData; - - return wlanSendSetQueryCmd( - prAdapter, - CMD_ID_RANDOM_RX_RESET_DE, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_ACCESS_REG), - (PUINT_8)&rCmdAccessReg, - pvSetBuffer, - u4SetBufferLen - ); - } - - // 0xFFFFFFF8 for Enable SAPP - else if (prMcrWrInfo->u4McrOffset == 0xFFFFFFF8){ - rCmdAccessReg.u4Address = prMcrWrInfo->u4McrOffset; - rCmdAccessReg.u4Data = prMcrWrInfo->u4McrData; - - return wlanSendSetQueryCmd( - prAdapter, - CMD_ID_SAPP_EN, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_ACCESS_REG), - (PUINT_8)&rCmdAccessReg, - pvSetBuffer, - u4SetBufferLen - ); - } - - // 0xFFFFFFF7 for Disable SAPP - else if (prMcrWrInfo->u4McrOffset == 0xFFFFFFF7){ - rCmdAccessReg.u4Address = prMcrWrInfo->u4McrOffset; - rCmdAccessReg.u4Data = prMcrWrInfo->u4McrData; - - return wlanSendSetQueryCmd( - prAdapter, - CMD_ID_SAPP_DE, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_ACCESS_REG), - (PUINT_8)&rCmdAccessReg, - pvSetBuffer, - u4SetBufferLen - ); - } - - else -#endif - // -- Puff Stress Test End - - - /* Check if access F/W Domain MCR */ - if (prMcrWrInfo->u4McrOffset & 0xFFFF0000){ - - /* 0x9000 - 0x9EFF reserved for FW */ -#if CFG_SUPPORT_SWCR - if((prMcrWrInfo->u4McrOffset >> 16) == 0x9F00) { - swCrReadWriteCmd(prAdapter, - SWCR_WRITE, - (UINT_16) (prMcrWrInfo->u4McrOffset & BITS(0,15)), - &prMcrWrInfo->u4McrData); - return WLAN_STATUS_SUCCESS; - } -#endif /* CFG_SUPPORT_SWCR */ - - - #if 1 - // low power test special command - if (prMcrWrInfo->u4McrOffset == 0x11111110){ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - //DbgPrint("Enter test mode\n"); - prAdapter->fgTestMode = TRUE; - return rStatus; - } - if (prMcrWrInfo->u4McrOffset == 0x11111111){ - //DbgPrint("nicpmSetAcpiPowerD3\n"); - - nicpmSetAcpiPowerD3(prAdapter); - kalDevSetPowerState(prAdapter->prGlueInfo, (UINT_32)ParamDeviceStateD3); - return WLAN_STATUS_SUCCESS; - } - if (prMcrWrInfo->u4McrOffset == 0x11111112){ - - //DbgPrint("LP enter sleep\n"); - - // fill command - rCmdAccessReg.u4Address = prMcrWrInfo->u4McrOffset; - rCmdAccessReg.u4Data = prMcrWrInfo->u4McrData; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_ACCESS_REG, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_ACCESS_REG), - (PUINT_8)&rCmdAccessReg, - pvSetBuffer, - u4SetBufferLen - ); - } -#endif - - #if 1 - // low power test special command - if (prMcrWrInfo->u4McrOffset == 0x11111110){ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - //DbgPrint("Enter test mode\n"); - prAdapter->fgTestMode = TRUE; - return rStatus; - } - if (prMcrWrInfo->u4McrOffset == 0x11111111){ - //DbgPrint("nicpmSetAcpiPowerD3\n"); - - nicpmSetAcpiPowerD3(prAdapter); - kalDevSetPowerState(prAdapter->prGlueInfo, (UINT_32)ParamDeviceStateD3); - return WLAN_STATUS_SUCCESS; - } - if (prMcrWrInfo->u4McrOffset == 0x11111112){ - - //DbgPrint("LP enter sleep\n"); - - // fill command - rCmdAccessReg.u4Address = prMcrWrInfo->u4McrOffset; - rCmdAccessReg.u4Data = prMcrWrInfo->u4McrData; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_ACCESS_REG, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_ACCESS_REG), - (PUINT_8)&rCmdAccessReg, - pvSetBuffer, - u4SetBufferLen - ); - } - -#endif - // fill command - rCmdAccessReg.u4Address = prMcrWrInfo->u4McrOffset; - rCmdAccessReg.u4Data = prMcrWrInfo->u4McrData; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_ACCESS_REG, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_ACCESS_REG), - (PUINT_8)&rCmdAccessReg, - pvSetBuffer, - u4SetBufferLen - ); - } - else { - HAL_MCR_WR(prAdapter, - (prMcrWrInfo->u4McrOffset & BITS(2,31)), //address is in DWORD unit - prMcrWrInfo->u4McrData); - - DBGLOG(INIT, TRACE, ("MCR Write: Offset = %#08lx, Data = %#08lx\n", - prMcrWrInfo->u4McrOffset, prMcrWrInfo->u4McrData)); - - return WLAN_STATUS_SUCCESS; - } -} /* wlanoidSetMcrWrite */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query SW CTRL -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuf A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQuerySwCtrlRead ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - P_PARAM_CUSTOM_SW_CTRL_STRUC_T prSwCtrlInfo; - WLAN_STATUS rWlanStatus; - UINT_16 u2Id, u2SubId; - UINT_32 u4Data; - - CMD_SW_DBG_CTRL_T rCmdSwCtrl; - - DEBUGFUNC("wlanoidQuerySwCtrlRead"); - DBGLOG(INIT, LOUD,("\n")); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(PARAM_CUSTOM_SW_CTRL_STRUC_T); - - if (u4QueryBufferLen < sizeof(PARAM_CUSTOM_SW_CTRL_STRUC_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - prSwCtrlInfo = (P_PARAM_CUSTOM_SW_CTRL_STRUC_T)pvQueryBuffer; - - u2Id = (UINT_16)(prSwCtrlInfo->u4Id >> 16); - u2SubId = (UINT_16)(prSwCtrlInfo->u4Id & BITS(0,15)); - u4Data = 0; - rWlanStatus = WLAN_STATUS_SUCCESS; - - switch(u2Id) { - /* 0x9000 - 0x9EFF reserved for FW */ - /* 0xFFFE reserved for FW */ - -#if CFG_SUPPORT_SWCR - case 0x9F00: - swCrReadWriteCmd(prAdapter, - SWCR_READ/* Read */, - (UINT_16) u2SubId , - &u4Data); - break; -#endif /* CFG_SUPPORT_SWCR */ - - case 0xFFFF: - { - u4Data = 0x5AA56620; - } - break; - - case 0x9000: - default: - { - rCmdSwCtrl.u4Id = prSwCtrlInfo->u4Id; - rCmdSwCtrl.u4Data = 0; - rWlanStatus = wlanSendSetQueryCmd(prAdapter, - CMD_ID_SW_DBG_CTRL, - FALSE, - TRUE, - TRUE, - nicCmdEventQuerySwCtrlRead, - nicOidCmdTimeoutCommon, - sizeof(CMD_SW_DBG_CTRL_T), - (PUINT_8)&rCmdSwCtrl, - pvQueryBuffer, - u4QueryBufferLen - ); - } - } /* switch(u2Id)*/ - - prSwCtrlInfo->u4Data = u4Data; - - return rWlanStatus; - -} - /* end of wlanoidQuerySwCtrlRead() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to write SW CTRL -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetSwCtrlWrite ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_CUSTOM_SW_CTRL_STRUC_T prSwCtrlInfo; - CMD_SW_DBG_CTRL_T rCmdSwCtrl; - WLAN_STATUS rWlanStatus; - UINT_16 u2Id, u2SubId; - UINT_32 u4Data; - - DEBUGFUNC("wlanoidSetSwCtrlWrite"); - DBGLOG(INIT, LOUD,("\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_CUSTOM_SW_CTRL_STRUC_T); - - if (u4SetBufferLen < sizeof(PARAM_CUSTOM_SW_CTRL_STRUC_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - - prSwCtrlInfo = (P_PARAM_CUSTOM_SW_CTRL_STRUC_T)pvSetBuffer; - - u2Id = (UINT_16)(prSwCtrlInfo->u4Id >> 16); - u2SubId = (UINT_16)(prSwCtrlInfo->u4Id & BITS(0,15)); - u4Data = prSwCtrlInfo->u4Data; - rWlanStatus = WLAN_STATUS_SUCCESS; - - switch(u2Id) { - - /* 0x9000 - 0x9EFF reserved for FW */ - /* 0xFFFE reserved for FW */ - -#if CFG_SUPPORT_SWCR - case 0x9F00: - swCrReadWriteCmd(prAdapter, - SWCR_WRITE, - (UINT_16) u2SubId, - &u4Data); - break; -#endif /* CFG_SUPPORT_SWCR */ - - case 0x1000: - if (u2SubId == 0x8000) { - // CTIA power save mode setting (code: 0x10008000) - prAdapter->u4CtiaPowerMode = u4Data; - prAdapter->fgEnCtiaPowerMode = TRUE; - - // - { - PARAM_POWER_MODE ePowerMode; - - if (prAdapter->u4CtiaPowerMode == 0) { - // force to keep in CAM mode - ePowerMode = Param_PowerModeCAM; - } else if (prAdapter->u4CtiaPowerMode == 1) { - ePowerMode = Param_PowerModeMAX_PSP; - } else { - ePowerMode = Param_PowerModeFast_PSP; - } - - nicConfigPowerSaveProfile( - prAdapter, - NETWORK_TYPE_AIS_INDEX, - ePowerMode, - TRUE); - } - } - break; - case 0x1001: - if(u2SubId == 0x0) { - prAdapter->fgEnOnlineScan = (BOOLEAN)u4Data; - } - else if(u2SubId == 0x1) { - prAdapter->fgDisBcnLostDetection = (BOOLEAN)u4Data; - } - else if(u2SubId == 0x2) { - prAdapter->rWifiVar.fgSupportUAPSD = (BOOLEAN)u4Data; - } - else if(u2SubId == 0x3) { - prAdapter->u4UapsdAcBmp = u4Data & BITS(0,15); - prAdapter->rWifiVar.arBssInfo[u4Data>>16].rPmProfSetupInfo.ucBmpDeliveryAC = (UINT_8)prAdapter->u4UapsdAcBmp; - prAdapter->rWifiVar.arBssInfo[u4Data>>16].rPmProfSetupInfo.ucBmpTriggerAC = (UINT_8)prAdapter->u4UapsdAcBmp; - } - else if(u2SubId == 0x4) { - prAdapter->fgDisStaAgingTimeoutDetection = (BOOLEAN)u4Data; - } - else if(u2SubId == 0x5) { - prAdapter->rWifiVar.rConnSettings.uc2G4BandwidthMode = (UINT_8)u4Data; - } - - - break; - -#if CFG_SUPPORT_SWCR - case 0x1002: - if(u2SubId == 0x0) { - if (u4Data) { - u4Data = BIT(HIF_RX_PKT_TYPE_MANAGEMENT); - } - swCrFrameCheckEnable(prAdapter, u4Data); - } - else if(u2SubId == 0x1) { - BOOLEAN fgIsEnable; - UINT_8 ucType; - UINT_32 u4Timeout; - - fgIsEnable = (BOOLEAN)(u4Data & 0xff); - ucType = 0;//((u4Data>>4) & 0xf); - u4Timeout = ((u4Data>>8) & 0xff); - swCrDebugCheckEnable(prAdapter, fgIsEnable, ucType, u4Timeout); - } - break; -#endif - -#if CFG_SUPPORT_802_11W - case 0x2000: - DBGLOG(RSN, INFO, ("802.11w test 0x%x\n", u2SubId)); - if (u2SubId == 0x0) { - rsnStartSaQuery(prAdapter); - } - if (u2SubId == 0x1) { - rsnStopSaQuery(prAdapter); - } - if (u2SubId == 0x2) { - rsnSaQueryRequest(prAdapter, NULL); - } - if (u2SubId == 0x3) { - P_BSS_INFO_T prBssInfo = &(prAdapter->rWifiVar.arBssInfo[(NETWORK_TYPE_AIS_INDEX)]); - authSendDeauthFrame(prAdapter, prBssInfo->prStaRecOfAP , NULL, 7, NULL); - } - /* wext_set_mode */ - /* - if (u2SubId == 0x3) { - prAdapter->prGlueInfo->rWpaInfo.u4Mfp = RSN_AUTH_MFP_DISABLED; - } - if (u2SubId == 0x4) { - //prAdapter->rWifiVar.rAisSpecificBssInfo.fgMgmtProtection = TRUE; - prAdapter->prGlueInfo->rWpaInfo.u4Mfp = RSN_AUTH_MFP_OPTIONAL; - } - if (u2SubId == 0x5) { - //prAdapter->rWifiVar.rAisSpecificBssInfo.fgMgmtProtection = TRUE; - prAdapter->prGlueInfo->rWpaInfo.u4Mfp = RSN_AUTH_MFP_REQUIRED; - } - */ - break; -#endif - case 0xFFFF: - { - CMD_ACCESS_REG rCmdAccessReg; -#if 1 //CFG_MT6573_SMT_TEST - if (u2SubId == 0x0123) { - - DBGLOG(HAL, INFO, ("set smt fixed rate: %d \n", u4Data)); - - if((ENUM_REGISTRY_FIXED_RATE_T)(u4Data) < FIXED_RATE_NUM) { - prAdapter->rWifiVar.eRateSetting = (ENUM_REGISTRY_FIXED_RATE_T)(u4Data); - } - else { - prAdapter->rWifiVar.eRateSetting = FIXED_RATE_NONE; - } - - if(prAdapter->rWifiVar.eRateSetting == FIXED_RATE_NONE) { - /* Enable Auto (Long/Short) Preamble */ - prAdapter->rWifiVar.ePreambleType = PREAMBLE_TYPE_AUTO; - } - else if((prAdapter->rWifiVar.eRateSetting >= FIXED_RATE_MCS0_20M_400NS && - prAdapter->rWifiVar.eRateSetting <= FIXED_RATE_MCS7_20M_400NS) - || (prAdapter->rWifiVar.eRateSetting >= FIXED_RATE_MCS0_40M_400NS && - prAdapter->rWifiVar.eRateSetting <= FIXED_RATE_MCS32_400NS)) { - /* Force Short Preamble */ - prAdapter->rWifiVar.ePreambleType = PREAMBLE_TYPE_SHORT; - } - else { - /* Force Long Preamble */ - prAdapter->rWifiVar.ePreambleType = PREAMBLE_TYPE_LONG; - } - - /* abort to re-connect */ -#if 1 - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_DISCONNECT, - NULL, - 0); -#else - aisBssBeaconTimeout(prAdapter); -#endif - - return WLAN_STATUS_SUCCESS; - - } - else if (u2SubId == 0x1234) { - // 1. Disable On-Lin Scan - prAdapter->fgEnOnlineScan = FALSE; - - // 3. Disable FIFO FULL no ack - rCmdAccessReg.u4Address = 0x60140028; - rCmdAccessReg.u4Data = 0x904; - wlanSendSetQueryCmd(prAdapter, - CMD_ID_ACCESS_REG, - TRUE, //FALSE, - FALSE, //TRUE, - FALSE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_ACCESS_REG), - (PUINT_8)&rCmdAccessReg, - pvSetBuffer, - 0 - ); - - // 4. Disable Roaming - rCmdSwCtrl.u4Id = 0x90000204; - rCmdSwCtrl.u4Data = 0x0; - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SW_DBG_CTRL, - TRUE, - FALSE, - FALSE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_SW_DBG_CTRL_T), - (PUINT_8)&rCmdSwCtrl, - pvSetBuffer, - u4SetBufferLen - ); - - rCmdSwCtrl.u4Id = 0x90000200; - rCmdSwCtrl.u4Data = 0x820000; - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SW_DBG_CTRL, - TRUE, - FALSE, - FALSE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_SW_DBG_CTRL_T), - (PUINT_8)&rCmdSwCtrl, - pvSetBuffer, - u4SetBufferLen - ); - - // Disalbe auto tx power - // - rCmdSwCtrl.u4Id = 0xa0100003; - rCmdSwCtrl.u4Data = 0x0; - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SW_DBG_CTRL, - TRUE, - FALSE, - FALSE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_SW_DBG_CTRL_T), - (PUINT_8)&rCmdSwCtrl, - pvSetBuffer, - u4SetBufferLen - ); - - - - // 2. Keep at CAM mode - { - PARAM_POWER_MODE ePowerMode; - - prAdapter->u4CtiaPowerMode = 0; - prAdapter->fgEnCtiaPowerMode = TRUE; - - ePowerMode = Param_PowerModeCAM; - rWlanStatus = nicConfigPowerSaveProfile( - prAdapter, - NETWORK_TYPE_AIS_INDEX, - ePowerMode, - TRUE); - } - - // 5. Disable Beacon Timeout Detection - prAdapter->fgDisBcnLostDetection = TRUE; - } - else if (u2SubId == 0x1235) { - - // 1. Enaable On-Lin Scan - prAdapter->fgEnOnlineScan = TRUE; - - // 3. Enable FIFO FULL no ack - rCmdAccessReg.u4Address = 0x60140028; - rCmdAccessReg.u4Data = 0x905; - wlanSendSetQueryCmd(prAdapter, - CMD_ID_ACCESS_REG, - TRUE, //FALSE, - FALSE, //TRUE, - FALSE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_ACCESS_REG), - (PUINT_8)&rCmdAccessReg, - pvSetBuffer, - 0 - ); - - // 4. Enable Roaming - rCmdSwCtrl.u4Id = 0x90000204; - rCmdSwCtrl.u4Data = 0x1; - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SW_DBG_CTRL, - TRUE, - FALSE, - FALSE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_SW_DBG_CTRL_T), - (PUINT_8)&rCmdSwCtrl, - pvSetBuffer, - u4SetBufferLen - ); - - rCmdSwCtrl.u4Id = 0x90000200; - rCmdSwCtrl.u4Data = 0x820000; - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SW_DBG_CTRL, - TRUE, - FALSE, - FALSE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_SW_DBG_CTRL_T), - (PUINT_8)&rCmdSwCtrl, - pvSetBuffer, - u4SetBufferLen - ); - - // Enable auto tx power - // - - rCmdSwCtrl.u4Id = 0xa0100003; - rCmdSwCtrl.u4Data = 0x1; - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SW_DBG_CTRL, - TRUE, - FALSE, - FALSE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_SW_DBG_CTRL_T), - (PUINT_8)&rCmdSwCtrl, - pvSetBuffer, - u4SetBufferLen - ); - - - // 2. Keep at Fast PS - { - PARAM_POWER_MODE ePowerMode; - - prAdapter->u4CtiaPowerMode = 2; - prAdapter->fgEnCtiaPowerMode = TRUE; - - ePowerMode = Param_PowerModeFast_PSP; - rWlanStatus = nicConfigPowerSaveProfile( - prAdapter, - NETWORK_TYPE_AIS_INDEX, - ePowerMode, - TRUE); - } - - // 5. Enable Beacon Timeout Detection - prAdapter->fgDisBcnLostDetection = FALSE; - } -#endif - } - break; - - case 0x9000: - default: - { - rCmdSwCtrl.u4Id = prSwCtrlInfo->u4Id; - rCmdSwCtrl.u4Data = prSwCtrlInfo->u4Data; - rWlanStatus = wlanSendSetQueryCmd(prAdapter, - CMD_ID_SW_DBG_CTRL, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_SW_DBG_CTRL_T), - (PUINT_8)&rCmdSwCtrl, - pvSetBuffer, - u4SetBufferLen - ); - } - } /* switch(u2Id) */ - - return rWlanStatus; -} - /* wlanoidSetSwCtrlWrite */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query EEPROM value. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuf A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryEepromRead ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - P_PARAM_CUSTOM_EEPROM_RW_STRUC_T prEepromRwInfo; - CMD_ACCESS_EEPROM rCmdAccessEeprom; - - DEBUGFUNC("wlanoidQueryEepromRead"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(PARAM_CUSTOM_EEPROM_RW_STRUC_T); - - if (u4QueryBufferLen < sizeof(PARAM_CUSTOM_EEPROM_RW_STRUC_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - prEepromRwInfo = (P_PARAM_CUSTOM_EEPROM_RW_STRUC_T)pvQueryBuffer; - - kalMemZero(&rCmdAccessEeprom, sizeof(CMD_ACCESS_EEPROM)); - rCmdAccessEeprom.u2Offset = prEepromRwInfo->ucEepromIndex; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_ACCESS_EEPROM, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryEepromRead, - nicOidCmdTimeoutCommon, - sizeof(CMD_ACCESS_EEPROM), - (PUINT_8)&rCmdAccessEeprom, - pvQueryBuffer, - u4QueryBufferLen - ); - -} /* wlanoidQueryEepromRead */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to write EEPROM value. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetEepromWrite ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_CUSTOM_EEPROM_RW_STRUC_T prEepromRwInfo; - CMD_ACCESS_EEPROM rCmdAccessEeprom; - - DEBUGFUNC("wlanoidSetEepromWrite"); - DBGLOG(INIT, LOUD,("\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_CUSTOM_EEPROM_RW_STRUC_T); - - if (u4SetBufferLen < sizeof(PARAM_CUSTOM_EEPROM_RW_STRUC_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - - prEepromRwInfo = (P_PARAM_CUSTOM_EEPROM_RW_STRUC_T)pvSetBuffer; - - kalMemZero(&rCmdAccessEeprom, sizeof(CMD_ACCESS_EEPROM)); - rCmdAccessEeprom.u2Offset = prEepromRwInfo->ucEepromIndex; - rCmdAccessEeprom.u2Data = prEepromRwInfo->u2EepromData; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_ACCESS_EEPROM, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_ACCESS_EEPROM), - (PUINT_8)&rCmdAccessEeprom, - pvSetBuffer, - u4SetBufferLen - ); - -} /* wlanoidSetEepromWrite */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the number of the successfully transmitted -* packets. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuf A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryXmitOk ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryXmitOk"); - DBGLOG(REQ, LOUD, ("\n")); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in query receive error! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - *pu4QueryInfoLen = sizeof(UINT_32); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - else if (u4QueryBufferLen < sizeof(UINT_32) - || (u4QueryBufferLen > sizeof(UINT_32) && u4QueryBufferLen < sizeof(UINT_64))) { - *pu4QueryInfoLen = sizeof(UINT_64); - return WLAN_STATUS_INVALID_LENGTH; - } - -#if CFG_ENABLE_STATISTICS_BUFFERING - if(IsBufferedStatisticsUsable(prAdapter) == TRUE) { - if(u4QueryBufferLen == sizeof(UINT_32)) { - *pu4QueryInfoLen = sizeof(UINT_32); - *(PUINT_32) pvQueryBuffer = (UINT_32) prAdapter->rStatStruct.rTransmittedFragmentCount.QuadPart; - } - else { - *pu4QueryInfoLen = sizeof(UINT_64); - *(PUINT_64) pvQueryBuffer = (UINT_64) prAdapter->rStatStruct.rTransmittedFragmentCount.QuadPart; - } - - return WLAN_STATUS_SUCCESS; - } - else -#endif - { - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_STATISTICS, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryXmitOk, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvQueryBuffer, - u4QueryBufferLen - ); - } -} /* wlanoidQueryXmitOk */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the number of the successfully received -* packets. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuf A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryRcvOk ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryRcvOk"); - DBGLOG(REQ, LOUD, ("\n")); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in query receive error! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - *pu4QueryInfoLen = sizeof(UINT_32); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - else if (u4QueryBufferLen < sizeof(UINT_32) - || (u4QueryBufferLen > sizeof(UINT_32) && u4QueryBufferLen < sizeof(UINT_64))) { - *pu4QueryInfoLen = sizeof(UINT_64); - return WLAN_STATUS_INVALID_LENGTH; - } - -#if CFG_ENABLE_STATISTICS_BUFFERING - if(IsBufferedStatisticsUsable(prAdapter) == TRUE) { - if(u4QueryBufferLen == sizeof(UINT_32)) { - *pu4QueryInfoLen = sizeof(UINT_32); - *(PUINT_32) pvQueryBuffer = (UINT_32) prAdapter->rStatStruct.rReceivedFragmentCount.QuadPart; - } - else { - *pu4QueryInfoLen = sizeof(UINT_64); - *(PUINT_64) pvQueryBuffer = (UINT_64) prAdapter->rStatStruct.rReceivedFragmentCount.QuadPart; - } - - return WLAN_STATUS_SUCCESS; - } - else -#endif - { - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_STATISTICS, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryRecvOk, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvQueryBuffer, - u4QueryBufferLen - ); - } -} /* wlanoidQueryRcvOk */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the number of frames that the driver -* fails to transmit. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuf A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryXmitError ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryXmitError"); - DBGLOG(REQ, LOUD, ("\n")); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in query receive error! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - *pu4QueryInfoLen = sizeof(UINT_32); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - else if (u4QueryBufferLen < sizeof(UINT_32) - || (u4QueryBufferLen > sizeof(UINT_32) && u4QueryBufferLen < sizeof(UINT_64))) { - *pu4QueryInfoLen = sizeof(UINT_64); - return WLAN_STATUS_INVALID_LENGTH; - } - -#if CFG_ENABLE_STATISTICS_BUFFERING - if(IsBufferedStatisticsUsable(prAdapter) == TRUE) { - if(u4QueryBufferLen == sizeof(UINT_32)) { - *pu4QueryInfoLen = sizeof(UINT_32); - *(PUINT_32) pvQueryBuffer = (UINT_32) prAdapter->rStatStruct.rFailedCount.QuadPart; - } - else { - *pu4QueryInfoLen = sizeof(UINT_64); - *(PUINT_64) pvQueryBuffer = (UINT_64) prAdapter->rStatStruct.rFailedCount.QuadPart; - } - - return WLAN_STATUS_SUCCESS; - } - else -#endif - { - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_STATISTICS, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryXmitError, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvQueryBuffer, - u4QueryBufferLen - ); - } -} /* wlanoidQueryXmitError */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the number of frames successfully -* transmitted after exactly one collision. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuf A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryXmitOneCollision ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryXmitOneCollision"); - DBGLOG(REQ, LOUD, ("\n")); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in query receive error! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - *pu4QueryInfoLen = sizeof(UINT_32); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - else if (u4QueryBufferLen < sizeof(UINT_32) - || (u4QueryBufferLen > sizeof(UINT_32) && u4QueryBufferLen < sizeof(UINT_64))) { - *pu4QueryInfoLen = sizeof(UINT_64); - return WLAN_STATUS_INVALID_LENGTH; - } - -#if CFG_ENABLE_STATISTICS_BUFFERING - if(IsBufferedStatisticsUsable(prAdapter) == TRUE) { - if(u4QueryBufferLen == sizeof(UINT_32)) { - *pu4QueryInfoLen = sizeof(UINT_32); - *(PUINT_32) pvQueryBuffer = (UINT_32) - (prAdapter->rStatStruct.rMultipleRetryCount.QuadPart - prAdapter->rStatStruct.rRetryCount.QuadPart); - } - else { - *pu4QueryInfoLen = sizeof(UINT_64); - *(PUINT_64) pvQueryBuffer = (UINT_64) - (prAdapter->rStatStruct.rMultipleRetryCount.QuadPart - prAdapter->rStatStruct.rRetryCount.QuadPart); - } - - return WLAN_STATUS_SUCCESS; - } - else -#endif - { - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_STATISTICS, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryXmitOneCollision, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvQueryBuffer, - u4QueryBufferLen - ); - } -} /* wlanoidQueryXmitOneCollision */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the number of frames successfully -* transmitted after more than one collision. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuf A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryXmitMoreCollisions ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryXmitMoreCollisions"); - DBGLOG(REQ, LOUD, ("\n")); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in query receive error! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - *pu4QueryInfoLen = sizeof(UINT_32); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - else if (u4QueryBufferLen < sizeof(UINT_32) - || (u4QueryBufferLen > sizeof(UINT_32) && u4QueryBufferLen < sizeof(UINT_64))) { - *pu4QueryInfoLen = sizeof(UINT_64); - return WLAN_STATUS_INVALID_LENGTH; - } - -#if CFG_ENABLE_STATISTICS_BUFFERING - if(IsBufferedStatisticsUsable(prAdapter) == TRUE) { - if(u4QueryBufferLen == sizeof(UINT_32)) { - *pu4QueryInfoLen = sizeof(UINT_32); - *(PUINT_32) pvQueryBuffer = (UINT_32) (prAdapter->rStatStruct.rMultipleRetryCount.QuadPart); - } - else { - *pu4QueryInfoLen = sizeof(UINT_64); - *(PUINT_64) pvQueryBuffer = (UINT_64) (prAdapter->rStatStruct.rMultipleRetryCount.QuadPart); - } - - return WLAN_STATUS_SUCCESS; - } - else -#endif - { - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_STATISTICS, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryXmitMoreCollisions, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvQueryBuffer, - u4QueryBufferLen - ); - } -} /* wlanoidQueryXmitMoreCollisions */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the number of frames -* not transmitted due to excessive collisions. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryXmitMaxCollisions ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryXmitMaxCollisions"); - DBGLOG(REQ, LOUD, ("\n")); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in query receive error! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - *pu4QueryInfoLen = sizeof(UINT_32); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - else if (u4QueryBufferLen < sizeof(UINT_32) - || (u4QueryBufferLen > sizeof(UINT_32) && u4QueryBufferLen < sizeof(UINT_64))) { - *pu4QueryInfoLen = sizeof(UINT_64); - return WLAN_STATUS_INVALID_LENGTH; - } - -#if CFG_ENABLE_STATISTICS_BUFFERING - if(IsBufferedStatisticsUsable(prAdapter) == TRUE) { - if(u4QueryBufferLen == sizeof(UINT_32)) { - *pu4QueryInfoLen = sizeof(UINT_32); - *(PUINT_32) pvQueryBuffer = (UINT_32) prAdapter->rStatStruct.rFailedCount.QuadPart; - } - else { - *pu4QueryInfoLen = sizeof(UINT_64); - *(PUINT_64) pvQueryBuffer = (UINT_64) prAdapter->rStatStruct.rFailedCount.QuadPart; - } - - return WLAN_STATUS_SUCCESS; - } - else -#endif - { - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_STATISTICS, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryXmitMaxCollisions, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvQueryBuffer, - u4QueryBufferLen - ); - } -} /* wlanoidQueryXmitMaxCollisions */ - - -#define MTK_CUSTOM_OID_INTERFACE_VERSION 0x00006620 // for WPDWifi DLL -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query current the OID interface version, -* which is the interface between the application and driver. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryOidInterfaceVersion ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen) -{ - DEBUGFUNC("wlanoidQueryOidInterfaceVersion"); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - *(PUINT_32) pvQueryBuffer = MTK_CUSTOM_OID_INTERFACE_VERSION ; - *pu4QueryInfoLen = sizeof(UINT_32); - - DBGLOG(REQ, WARN, ("Custom OID interface version: %#08lX\n", - *(PUINT_32) pvQueryBuffer)); - - return WLAN_STATUS_SUCCESS; -} /* wlanoidQueryOidInterfaceVersion */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query current Multicast Address List. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryMulticastList( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ -#ifndef LINUX - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_MAC_MCAST_ADDR, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryMcastAddr, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvQueryBuffer, - u4QueryBufferLen - ); -#else - return WLAN_STATUS_SUCCESS; -#endif -} /* end of wlanoidQueryMulticastList() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set Multicast Address List. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_MULTICAST_FULL -*/ -/*----------------------------------------------------------------------------*/ - WLAN_STATUS - wlanoidSetMulticastList( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) - { - UINT_8 ucNetTypeIndex = NETWORK_TYPE_AIS_INDEX; /* Caller should provide this information */ - CMD_MAC_MCAST_ADDR rCmdMacMcastAddr; - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - /* The data must be a multiple of the Ethernet address size. */ - if ((u4SetBufferLen % MAC_ADDR_LEN)) { - DBGLOG(REQ, WARN, ("Invalid MC list length %ld\n", u4SetBufferLen)); - - *pu4SetInfoLen = (((u4SetBufferLen + MAC_ADDR_LEN) - 1) / - MAC_ADDR_LEN) * MAC_ADDR_LEN; - - return WLAN_STATUS_INVALID_LENGTH; - } - - *pu4SetInfoLen = u4SetBufferLen; - - /* Verify if we can support so many multicast addresses. */ - if ((u4SetBufferLen / MAC_ADDR_LEN) > MAX_NUM_GROUP_ADDR) { - DBGLOG(REQ, WARN, ("Too many MC addresses\n")); - - return WLAN_STATUS_MULTICAST_FULL; - } - - /* NOTE(Kevin): Windows may set u4SetBufferLen == 0 && - * pvSetBuffer == NULL to clear exist Multicast List. - */ - if (u4SetBufferLen) { - ASSERT(pvSetBuffer); - } - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set multicast list! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - rCmdMacMcastAddr.u4NumOfGroupAddr = u4SetBufferLen / MAC_ADDR_LEN; - rCmdMacMcastAddr.ucNetTypeIndex = ucNetTypeIndex; - kalMemCopy(rCmdMacMcastAddr.arAddress, pvSetBuffer, u4SetBufferLen); - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_MAC_MCAST_ADDR, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_MAC_MCAST_ADDR), - (PUINT_8)&rCmdMacMcastAddr, - pvSetBuffer, - u4SetBufferLen - ); -} /* end of wlanoidSetMulticastList() */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set Packet Filter. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_NOT_SUPPORTED -* \retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetCurrentPacketFilter ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - UINT_32 u4NewPacketFilter; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - - DEBUGFUNC("wlanoidSetCurrentPacketFilter"); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - if (u4SetBufferLen < sizeof(UINT_32)) { - *pu4SetInfoLen = sizeof(UINT_32); - return WLAN_STATUS_INVALID_LENGTH; - } - ASSERT(pvSetBuffer); - - /* Set the new packet filter. */ - u4NewPacketFilter = *(PUINT_32) pvSetBuffer; - - DBGLOG(REQ, INFO, ("New packet filter: %#08lx\n", u4NewPacketFilter)); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set current packet filter! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - do { - /* Verify the bits of the new packet filter. If any bits are set that - we don't support, leave. */ - if (u4NewPacketFilter & ~(PARAM_PACKET_FILTER_SUPPORTED)) { - rStatus = WLAN_STATUS_NOT_SUPPORTED; - break; - } - -#if DBG - /* Need to enable or disable promiscuous support depending on the new - filter. */ - if (u4NewPacketFilter & PARAM_PACKET_FILTER_PROMISCUOUS) { - DBGLOG(REQ, INFO, ("Enable promiscuous mode\n")); - } - else { - DBGLOG(REQ, INFO, ("Disable promiscuous mode\n")); - } - - if (u4NewPacketFilter & PARAM_PACKET_FILTER_ALL_MULTICAST) { - DBGLOG(REQ, INFO, ("Enable all-multicast mode\n")); - } - else if (u4NewPacketFilter & PARAM_PACKET_FILTER_MULTICAST) { - DBGLOG(REQ, INFO, ("Enable multicast\n")); - } - else { - DBGLOG(REQ, INFO, ("Disable multicast\n")); - } - - if (u4NewPacketFilter & PARAM_PACKET_FILTER_BROADCAST) { - DBGLOG(REQ, INFO, ("Enable Broadcast\n")); - } - else { - DBGLOG(REQ, INFO, ("Disable Broadcast\n")); - } -#endif - } while (FALSE); - - if(rStatus == WLAN_STATUS_SUCCESS) { - // Store the packet filter - - prAdapter->u4OsPacketFilter &= PARAM_PACKET_FILTER_P2P_MASK; - prAdapter->u4OsPacketFilter |= u4NewPacketFilter; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_RX_FILTER, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(UINT_32), - (PUINT_8)&prAdapter->u4OsPacketFilter, - pvSetBuffer, - u4SetBufferLen - ); - } - else { - return rStatus; - } -} /* wlanoidSetCurrentPacketFilter */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query current packet filter. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryCurrentPacketFilter ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryCurrentPacketFilter"); - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - - *pu4QueryInfoLen = sizeof(UINT_32); - - if (u4QueryBufferLen >= sizeof(UINT_32)) { - ASSERT(pvQueryBuffer); - *(PUINT_32) pvQueryBuffer = prAdapter->u4OsPacketFilter; - } - - return WLAN_STATUS_SUCCESS; -} /* wlanoidQueryCurrentPacketFilter */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query ACPI device power state. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryAcpiDevicePowerState ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ -#if DBG - PPARAM_DEVICE_POWER_STATE prPowerState; -#endif - - DEBUGFUNC("wlanoidQueryAcpiDevicePowerState"); - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(PARAM_DEVICE_POWER_STATE); - -#if DBG - prPowerState = (PPARAM_DEVICE_POWER_STATE) pvQueryBuffer; - switch (*prPowerState) { - case ParamDeviceStateD0: - DBGLOG(REQ, INFO, ("Query Power State: D0\n")); - break; - case ParamDeviceStateD1: - DBGLOG(REQ, INFO, ("Query Power State: D1\n")); - break; - case ParamDeviceStateD2: - DBGLOG(REQ, INFO, ("Query Power State: D2\n")); - break; - case ParamDeviceStateD3: - DBGLOG(REQ, INFO, ("Query Power State: D3\n")); - break; - default: - break; - } -#endif - - /* Since we will disconnect the newwork, therefore we do not - need to check queue empty */ - *(PPARAM_DEVICE_POWER_STATE) pvQueryBuffer = ParamDeviceStateD3; - //WARNLOG(("Ready to transition to D3\n")); - return WLAN_STATUS_SUCCESS; - -} /* pwrmgtQueryPower */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set ACPI device power state. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetAcpiDevicePowerState ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - PPARAM_DEVICE_POWER_STATE prPowerState; - BOOLEAN fgRetValue = TRUE; - - DEBUGFUNC("wlanoidSetAcpiDevicePowerState"); - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_DEVICE_POWER_STATE); - - ASSERT(pvSetBuffer); - prPowerState = (PPARAM_DEVICE_POWER_STATE) pvSetBuffer; - switch (*prPowerState) { - case ParamDeviceStateD0: - DBGLOG(REQ, INFO, ("Set Power State: D0\n")); - kalDevSetPowerState(prAdapter->prGlueInfo, (UINT_32)ParamDeviceStateD0); - fgRetValue = nicpmSetAcpiPowerD0(prAdapter); - break; - case ParamDeviceStateD1: - DBGLOG(REQ, INFO, ("Set Power State: D1\n")); - /* no break here */ - case ParamDeviceStateD2: - DBGLOG(REQ, INFO, ("Set Power State: D2\n")); - /* no break here */ - case ParamDeviceStateD3: - DBGLOG(REQ, INFO, ("Set Power State: D3\n")); - fgRetValue = nicpmSetAcpiPowerD3(prAdapter); - kalDevSetPowerState(prAdapter->prGlueInfo, (UINT_32)ParamDeviceStateD3); - break; - default: - break; - } - - if(fgRetValue == TRUE) - return WLAN_STATUS_SUCCESS; - else - return WLAN_STATUS_FAILURE; -} /* end of wlanoidSetAcpiDevicePowerState() */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the current fragmentation threshold. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryFragThreshold ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryFragThreshold"); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - DBGLOG(REQ, LOUD, ("\n")); - -#if CFG_TX_FRAGMENT - - return WLAN_STATUS_SUCCESS; - -#else - - return WLAN_STATUS_NOT_SUPPORTED; -#endif /* CFG_TX_FRAGMENT */ - -} /* end of wlanoidQueryFragThreshold() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set a new fragmentation threshold to the -* driver. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_DATA -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetFragThreshold ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ -#if CFG_TX_FRAGMENT - - return WLAN_STATUS_SUCCESS; - -#else - - return WLAN_STATUS_NOT_SUPPORTED; -#endif /* CFG_TX_FRAGMENT */ - -} /* end of wlanoidSetFragThreshold() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the current RTS threshold. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryRtsThreshold ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryRtsThreshold"); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - DBGLOG(REQ, LOUD, ("\n")); - - if (u4QueryBufferLen < sizeof(PARAM_RTS_THRESHOLD)) { - *pu4QueryInfoLen = sizeof(PARAM_RTS_THRESHOLD); - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - *((PARAM_RTS_THRESHOLD *)pvQueryBuffer) = prAdapter->rWlanInfo.eRtsThreshold; - - return WLAN_STATUS_SUCCESS; - -} /* wlanoidQueryRtsThreshold */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set a new RTS threshold to the driver. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_DATA -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetRtsThreshold ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - PARAM_RTS_THRESHOLD *prRtsThreshold; - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_RTS_THRESHOLD); - if (u4SetBufferLen < sizeof(PARAM_RTS_THRESHOLD)) { - DBGLOG(REQ, WARN, ("Invalid length %ld\n", u4SetBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - - prRtsThreshold = (PARAM_RTS_THRESHOLD *)pvSetBuffer; - *prRtsThreshold = prAdapter->rWlanInfo.eRtsThreshold; - - return WLAN_STATUS_SUCCESS; - -} /* wlanoidSetRtsThreshold */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to turn radio off. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetDisassociate ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_MSG_AIS_ABORT_T prAisAbortMsg; - - DEBUGFUNC("wlanoidSetDisassociate"); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = 0; - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set disassociate! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - /* prepare message to AIS */ - prAdapter->rWifiVar.rConnSettings.fgIsConnReqIssued = FALSE; - - /* Send AIS Abort Message */ - prAisAbortMsg = (P_MSG_AIS_ABORT_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_AIS_ABORT_T)); - if (!prAisAbortMsg) { - ASSERT(0); - return WLAN_STATUS_FAILURE; - } - - prAisAbortMsg->rMsgHdr.eMsgId = MID_OID_AIS_FSM_JOIN_REQ; - prAisAbortMsg->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_NEW_CONNECTION; - prAisAbortMsg->fgDelayIndication = FALSE; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prAisAbortMsg, - MSG_SEND_METHOD_BUF); - - /* indicate for disconnection */ - if (kalGetMediaStateIndicated(prAdapter->prGlueInfo) == PARAM_MEDIA_STATE_CONNECTED) { - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_DISCONNECT, - NULL, - 0); - } - -#if !defined(LINUX) - prAdapter->fgIsRadioOff = TRUE; -#endif - - return WLAN_STATUS_SUCCESS; -} /* wlanoidSetDisassociate */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to query the power save profile. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuf A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \return WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQuery802dot11PowerSaveProfile ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQuery802dot11PowerSaveProfile"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - - if (u4QueryBufferLen!=0) { - ASSERT(pvQueryBuffer); - -// *(PPARAM_POWER_MODE) pvQueryBuffer = (PARAM_POWER_MODE)(prAdapter->rWlanInfo.ePowerSaveMode.ucPsProfile); - *(PPARAM_POWER_MODE) pvQueryBuffer = (PARAM_POWER_MODE)(prAdapter->rWlanInfo.arPowerSaveMode[NETWORK_TYPE_AIS_INDEX].ucPsProfile); - *pu4QueryInfoLen = sizeof(PARAM_POWER_MODE); - - // hack for CTIA power mode setting function - if (prAdapter->fgEnCtiaPowerMode) { - // set to non-zero value (to prevent MMI query 0, before it intends to set 0, which will skip its following state machine) - *(PPARAM_POWER_MODE) pvQueryBuffer = (PARAM_POWER_MODE)2; - } - } - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to set the power save profile. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSet802dot11PowerSaveProfile ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS status; - PARAM_POWER_MODE ePowerMode; - DEBUGFUNC("wlanoidSet802dot11PowerSaveProfile"); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_POWER_MODE); - if (u4SetBufferLen < sizeof(PARAM_POWER_MODE)) { - DBGLOG(REQ, WARN, ("Invalid length %ld\n", u4SetBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - else if (*(PPARAM_POWER_MODE) pvSetBuffer >= Param_PowerModeMax) { - //WARNLOG(("Invalid power mode %d\n", - //*(PPARAM_POWER_MODE) pvSetBuffer)); - return WLAN_STATUS_INVALID_DATA; - } - - ePowerMode = *(PPARAM_POWER_MODE) pvSetBuffer; - - if (prAdapter->fgEnCtiaPowerMode) { - if (ePowerMode == Param_PowerModeCAM) { - - } else { - // User setting to PS mode (Param_PowerModeMAX_PSP or Param_PowerModeFast_PSP) - - if (prAdapter->u4CtiaPowerMode == 0) { - // force to keep in CAM mode - ePowerMode = Param_PowerModeCAM; - } else if (prAdapter->u4CtiaPowerMode == 1) { - ePowerMode = Param_PowerModeMAX_PSP; - } else if (prAdapter->u4CtiaPowerMode == 2) { - ePowerMode = Param_PowerModeFast_PSP; - } - } - } - - status = nicConfigPowerSaveProfile( - prAdapter, - NETWORK_TYPE_AIS_INDEX, - ePowerMode, - TRUE); - - switch (ePowerMode) { - case Param_PowerModeCAM: - DBGLOG(INIT, INFO, ("Set Wi-Fi PS mode to CAM (%d)\n", ePowerMode)); - break; - case Param_PowerModeMAX_PSP: - DBGLOG(INIT, INFO, ("Set Wi-Fi PS mode to MAX PS (%d)\n", ePowerMode)); - break; - case Param_PowerModeFast_PSP: - DBGLOG(INIT, INFO, ("Set Wi-Fi PS mode to FAST PS (%d)\n", ePowerMode)); - break; - default: - DBGLOG(INIT, INFO, ("invalid Wi-Fi PS mode setting (%d)\n", ePowerMode)); - break; - } - - return status; - -} /* end of wlanoidSetAcpiDevicePowerStateMode() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query current status of AdHoc Mode. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryAdHocMode ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - return WLAN_STATUS_SUCCESS; -} /* end of wlanoidQueryAdHocMode() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set AdHoc Mode. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_INVALID_DATA -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetAdHocMode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - return WLAN_STATUS_SUCCESS; -} /* end of wlanoidSetAdHocMode() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query RF frequency. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryFrequency ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryFrequency"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - if (u4QueryBufferLen < sizeof(UINT_32)) { - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - if (prAdapter->rWifiVar.rConnSettings.eOPMode == NET_TYPE_INFRA) { - if (kalGetMediaStateIndicated(prAdapter->prGlueInfo) == PARAM_MEDIA_STATE_CONNECTED) { - *(PUINT_32)pvQueryBuffer = - nicChannelNum2Freq(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX].ucPrimaryChannel); - } - else { - *(PUINT_32)pvQueryBuffer = 0; - } - } - else { - *(PUINT_32)pvQueryBuffer = - nicChannelNum2Freq(prAdapter->rWifiVar.rConnSettings.ucAdHocChannelNum); - } - - return WLAN_STATUS_SUCCESS; -} /* end of wlanoidQueryFrequency() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set RF frequency by User Settings. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_INVALID_DATA -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetFrequency ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - PUINT_32 pu4FreqInKHz; - - DEBUGFUNC("wlanoidSetFrequency"); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(UINT_32); - - if (u4SetBufferLen < sizeof(UINT_32)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - pu4FreqInKHz = (PUINT_32)pvSetBuffer; - - prAdapter->rWifiVar.rConnSettings.ucAdHocChannelNum - = (UINT_8)nicFreq2ChannelNum(*pu4FreqInKHz); - prAdapter->rWifiVar.rConnSettings.eAdHocBand - = *pu4FreqInKHz < 5000000 ? BAND_2G4 : BAND_5G; - - return WLAN_STATUS_SUCCESS; -} /* end of wlanoidSetFrequency() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set 802.11 channel of the radio frequency. -* This is a proprietary function call to Lunux currently. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_INVALID_DATA -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetChannel ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - ASSERT(0); //// - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the Beacon Interval from User Settings. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryBeaconInterval ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryBeaconInterval"); - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(UINT_32); - - if (u4QueryBufferLen < sizeof(UINT_32)) { - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - if (kalGetMediaStateIndicated(prAdapter->prGlueInfo) == PARAM_MEDIA_STATE_CONNECTED) { - if (prAdapter->rWifiVar.rConnSettings.eOPMode == NET_TYPE_INFRA) { - *(PUINT_32)pvQueryBuffer = - prAdapter->rWlanInfo.rCurrBssId.rConfiguration.u4BeaconPeriod; - } - else { - *(PUINT_32)pvQueryBuffer = - (UINT_32) prAdapter->rWlanInfo.u2BeaconPeriod; - } - } - else { - if (prAdapter->rWifiVar.rConnSettings.eOPMode == NET_TYPE_INFRA) { - *(PUINT_32)pvQueryBuffer = 0; - } - else { - *(PUINT_32)pvQueryBuffer = - (UINT_32) prAdapter->rWlanInfo.u2BeaconPeriod; - } - } - - return WLAN_STATUS_SUCCESS; -} /* end of wlanoidQueryBeaconInterval() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set the Beacon Interval to User Settings. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_INVALID_DATA -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetBeaconInterval ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - PUINT_32 pu4BeaconInterval; - - DEBUGFUNC("wlanoidSetBeaconInterval"); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(UINT_32); - if (u4SetBufferLen < sizeof(UINT_32)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - pu4BeaconInterval = (PUINT_32)pvSetBuffer; - - if ((*pu4BeaconInterval < DOT11_BEACON_PERIOD_MIN) || - (*pu4BeaconInterval > DOT11_BEACON_PERIOD_MAX)) { - DBGLOG(REQ, TRACE, ("Invalid Beacon Interval = %ld\n", *pu4BeaconInterval)); - return WLAN_STATUS_INVALID_DATA; - } - - prAdapter->rWlanInfo.u2BeaconPeriod = (UINT_16)*pu4BeaconInterval; - - DBGLOG(REQ, INFO, ("Set beacon interval: %d\n", - prAdapter->rWlanInfo.u2BeaconPeriod)); - - - return WLAN_STATUS_SUCCESS; -} /* end of wlanoidSetBeaconInterval() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the ATIM window from User Settings. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryAtimWindow ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryAtimWindow"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(UINT_32); - - if (u4QueryBufferLen < sizeof(UINT_32)) { - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - if (prAdapter->rWifiVar.rConnSettings.eOPMode == NET_TYPE_INFRA) { - *(PUINT_32)pvQueryBuffer = 0; - } - else { - *(PUINT_32)pvQueryBuffer = - (UINT_32) prAdapter->rWlanInfo.u2AtimWindow; - } - - return WLAN_STATUS_SUCCESS; - -} /* end of wlanoidQueryAtimWindow() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set the ATIM window to User Settings. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_INVALID_DATA -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetAtimWindow ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - PUINT_32 pu4AtimWindow; - - DEBUGFUNC("wlanoidSetAtimWindow"); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(UINT_32); - - if (u4SetBufferLen < sizeof(UINT_32)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - pu4AtimWindow = (PUINT_32)pvSetBuffer; - - prAdapter->rWlanInfo.u2AtimWindow = (UINT_16)*pu4AtimWindow; - - return WLAN_STATUS_SUCCESS; -} /* end of wlanoidSetAtimWindow() */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to Set the MAC address which is currently used by the NIC. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_INVALID_DATA -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetCurrentAddr ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - ASSERT(0); //// - - return WLAN_STATUS_SUCCESS; -} /* end of wlanoidSetCurrentAddr() */ - - -#if CFG_TCP_IP_CHKSUM_OFFLOAD -/*----------------------------------------------------------------------------*/ -/*! -* \brief Setting the checksum offload function. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetCSUMOffload ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - UINT_32 i, u4CSUMFlags; - CMD_BASIC_CONFIG rCmdBasicConfig; - - DEBUGFUNC("wlanoidSetCSUMOffload"); - DBGLOG(INIT, LOUD, ("\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(UINT_32); - - if (u4SetBufferLen < sizeof(UINT_32)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - u4CSUMFlags = *(PUINT_32)pvSetBuffer; - - kalMemZero(&rCmdBasicConfig, sizeof(CMD_BASIC_CONFIG)); - - for(i = 0 ; i < 6 ; i++) { // set to broadcast address for not-specified - rCmdBasicConfig.rMyMacAddr[i] = 0xff; - } - - rCmdBasicConfig.ucNative80211 = 0; //@FIXME: for Vista - - if(u4CSUMFlags & CSUM_OFFLOAD_EN_TX_TCP) - rCmdBasicConfig.rCsumOffload.u2TxChecksum |= BIT(2); - - if(u4CSUMFlags & CSUM_OFFLOAD_EN_TX_UDP) - rCmdBasicConfig.rCsumOffload.u2TxChecksum |= BIT(1); - - if(u4CSUMFlags & CSUM_OFFLOAD_EN_TX_IP) - rCmdBasicConfig.rCsumOffload.u2TxChecksum |= BIT(0); - - if(u4CSUMFlags & CSUM_OFFLOAD_EN_RX_TCP) - rCmdBasicConfig.rCsumOffload.u2RxChecksum |= BIT(2); - - if(u4CSUMFlags & CSUM_OFFLOAD_EN_RX_UDP) - rCmdBasicConfig.rCsumOffload.u2RxChecksum |= BIT(1); - - if(u4CSUMFlags & (CSUM_OFFLOAD_EN_RX_IPv4 | CSUM_OFFLOAD_EN_RX_IPv6)) - rCmdBasicConfig.rCsumOffload.u2RxChecksum |= BIT(0); - - prAdapter->u4CSUMFlags = u4CSUMFlags; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_BASIC_CONFIG, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_BASIC_CONFIG), - (PUINT_8)&rCmdBasicConfig, - pvSetBuffer, - u4SetBufferLen - ); -} -#endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Setting the IP address for pattern search function. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \return WLAN_STATUS_SUCCESS -* \return WLAN_STATUS_ADAPTER_NOT_READY -* \return WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetNetworkAddress( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 i, j; - P_CMD_SET_NETWORK_ADDRESS_LIST prCmdNetworkAddressList; - P_PARAM_NETWORK_ADDRESS_LIST prNetworkAddressList = (P_PARAM_NETWORK_ADDRESS_LIST)pvSetBuffer; - P_PARAM_NETWORK_ADDRESS prNetworkAddress; - P_PARAM_NETWORK_ADDRESS_IP prNetAddrIp; - UINT_32 u4IpAddressCount, u4CmdSize; - PUINT_8 pucBuf = (PUINT_8)pvSetBuffer; - - DEBUGFUNC("wlanoidSetNetworkAddress"); - DBGLOG(INIT, LOUD, ("\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = 4; - - if (u4SetBufferLen < sizeof(PARAM_NETWORK_ADDRESS_LIST)) { - return WLAN_STATUS_INVALID_DATA; - } - - *pu4SetInfoLen = 0; - u4IpAddressCount = 0; - - prNetworkAddress = prNetworkAddressList->arAddress; - for ( i = 0 ; i < prNetworkAddressList->u4AddressCount ; i++) { - if (prNetworkAddress->u2AddressType == PARAM_PROTOCOL_ID_TCP_IP && - prNetworkAddress->u2AddressLength == sizeof(PARAM_NETWORK_ADDRESS_IP)) { - u4IpAddressCount++; - } - - prNetworkAddress = (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prNetworkAddress + - (UINT_32) (prNetworkAddress->u2AddressLength + OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress))); - } - - // construct payload of command packet - u4CmdSize = OFFSET_OF(CMD_SET_NETWORK_ADDRESS_LIST, arNetAddress) + - sizeof(IPV4_NETWORK_ADDRESS) * u4IpAddressCount; - if (u4IpAddressCount == 0) { - u4CmdSize = sizeof(CMD_SET_NETWORK_ADDRESS_LIST); - } - - prCmdNetworkAddressList = (P_CMD_SET_NETWORK_ADDRESS_LIST) kalMemAlloc(u4CmdSize, VIR_MEM_TYPE); - - if(prCmdNetworkAddressList == NULL) - return WLAN_STATUS_FAILURE; - - // fill P_CMD_SET_NETWORK_ADDRESS_LIST - prCmdNetworkAddressList->ucNetTypeIndex = NETWORK_TYPE_AIS_INDEX; - - /* only to set IP address to FW once ARP filter is enabled */ - if (prAdapter->fgEnArpFilter) { - prCmdNetworkAddressList->ucAddressCount = (UINT_8)u4IpAddressCount; - prNetworkAddress = prNetworkAddressList->arAddress; - - DBGLOG(REQ, INFO, ("u4IpAddressCount (%d)\n", u4IpAddressCount)); - - for (i = 0, j = 0 ; i < prNetworkAddressList->u4AddressCount ; i++) { - if (prNetworkAddress->u2AddressType == PARAM_PROTOCOL_ID_TCP_IP && - prNetworkAddress->u2AddressLength == sizeof(PARAM_NETWORK_ADDRESS_IP)) { - prNetAddrIp = (P_PARAM_NETWORK_ADDRESS_IP)prNetworkAddress->aucAddress; - - kalMemCopy(prCmdNetworkAddressList->arNetAddress[j].aucIpAddr, - &(prNetAddrIp->in_addr), - sizeof(UINT_32)); - - j++; - - pucBuf = (PUINT_8)&prNetAddrIp->in_addr; - DBGLOG(REQ, INFO, ("prNetAddrIp->in_addr:%d:%d:%d:%d\n", pucBuf[0], pucBuf[1],pucBuf[2],pucBuf[3])); - } - - prNetworkAddress = (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prNetworkAddress + - (UINT_32) (prNetworkAddress->u2AddressLength + OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress))); - } - - } else { - prCmdNetworkAddressList->ucAddressCount = 0; - } - - rStatus = wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_IP_ADDRESS, - TRUE, - FALSE, - TRUE, - nicCmdEventSetIpAddress, - nicOidCmdTimeoutCommon, - u4CmdSize, - (PUINT_8)prCmdNetworkAddressList, - pvSetBuffer, - u4SetBufferLen - ); - - kalMemFree(prCmdNetworkAddressList, VIR_MEM_TYPE, u4CmdSize); - return rStatus; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Set driver to switch into RF test mode -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set, -* should be NULL -* \param[in] u4SetBufferLen The length of the set buffer, should be 0 -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \return WLAN_STATUS_SUCCESS -* \return WLAN_STATUS_ADAPTER_NOT_READY -* \return WLAN_STATUS_INVALID_DATA -* \return WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidRftestSetTestMode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rStatus; - CMD_TEST_CTRL_T rCmdTestCtrl; - - DEBUGFUNC("wlanoidRftestSetTestMode"); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = 0; - - if(u4SetBufferLen == 0) { - if(prAdapter->fgTestMode == FALSE) { - // switch to RF Test mode - rCmdTestCtrl.ucAction = 0; // Switch mode - rCmdTestCtrl.u.u4OpMode = 1; // RF test mode - - rStatus = wlanSendSetQueryCmd(prAdapter, - CMD_ID_TEST_MODE, - TRUE, - FALSE, - TRUE, - nicCmdEventEnterRfTest, - nicOidCmdEnterRFTestTimeout, - sizeof(CMD_TEST_CTRL_T), - (PUINT_8)&rCmdTestCtrl, - pvSetBuffer, - u4SetBufferLen); - } - else { - // already in test mode .. - rStatus = WLAN_STATUS_SUCCESS; - } - } - else { - rStatus = WLAN_STATUS_INVALID_DATA; - } - - return rStatus; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Set driver to switch into normal operation mode from RF test mode -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set -* should be NULL -* \param[in] u4SetBufferLen The length of the set buffer, should be 0 -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \return WLAN_STATUS_SUCCESS -* \return WLAN_STATUS_ADAPTER_NOT_READY -* \return WLAN_STATUS_INVALID_DATA -* \return WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidRftestSetAbortTestMode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rStatus; - CMD_TEST_CTRL_T rCmdTestCtrl; - - DEBUGFUNC("wlanoidRftestSetTestMode"); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = 0; - - if(u4SetBufferLen == 0) { - if(prAdapter->fgTestMode == TRUE) { - // switch to normal mode - rCmdTestCtrl.ucAction = 0; // Switch mode - rCmdTestCtrl.u.u4OpMode = 0; // normal mode - - rStatus = wlanSendSetQueryCmd(prAdapter, - CMD_ID_TEST_MODE, - TRUE, - FALSE, - TRUE, - nicCmdEventLeaveRfTest, - nicOidCmdTimeoutCommon, - sizeof(CMD_TEST_CTRL_T), - (PUINT_8)&rCmdTestCtrl, - pvSetBuffer, - u4SetBufferLen); - } - else { - // already in normal mode .. - rStatus = WLAN_STATUS_SUCCESS; - } - } - else { - rStatus = WLAN_STATUS_INVALID_DATA; - } - - return rStatus; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief query for RF test parameter -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_BUFFER_TOO_SHORT -* \retval WLAN_STATUS_NOT_SUPPORTED -* \retval WLAN_STATUS_NOT_ACCEPTED -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidRftestQueryAutoTest ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - P_PARAM_MTK_WIFI_TEST_STRUC_T prRfATInfo; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - - DEBUGFUNC("wlanoidRftestQueryAutoTest"); - - ASSERT(prAdapter); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - ASSERT(pu4QueryInfoLen); - - *pu4QueryInfoLen = sizeof(PARAM_MTK_WIFI_TEST_STRUC_T); - - if (u4QueryBufferLen != sizeof(PARAM_MTK_WIFI_TEST_STRUC_T)) { - DBGLOG(REQ, ERROR, ("Invalid data. QueryBufferLen: %ld.\n", - u4QueryBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - - prRfATInfo = (P_PARAM_MTK_WIFI_TEST_STRUC_T)pvQueryBuffer; - rStatus = rftestQueryATInfo(prAdapter, - prRfATInfo->u4FuncIndex, - prRfATInfo->u4FuncData, - pvQueryBuffer, - u4QueryBufferLen); - - return rStatus; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Set RF test parameter -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \return WLAN_STATUS_SUCCESS -* \return WLAN_STATUS_ADAPTER_NOT_READY -* \return WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidRftestSetAutoTest ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_MTK_WIFI_TEST_STRUC_T prRfATInfo; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - - DEBUGFUNC("wlanoidRftestSetAutoTest"); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_MTK_WIFI_TEST_STRUC_T); - - if (u4SetBufferLen != sizeof(PARAM_MTK_WIFI_TEST_STRUC_T)) { - DBGLOG(REQ, ERROR, ("Invalid data. SetBufferLen: %ld.\n", - u4SetBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - - prRfATInfo = (P_PARAM_MTK_WIFI_TEST_STRUC_T)pvSetBuffer; - rStatus = rftestSetATInfo(prAdapter, prRfATInfo->u4FuncIndex, prRfATInfo->u4FuncData); - - return rStatus; -} - -/* RF test OID set handler */ -WLAN_STATUS -rftestSetATInfo ( - IN P_ADAPTER_T prAdapter, - UINT_32 u4FuncIndex, - UINT_32 u4FuncData - ) -{ - P_GLUE_INFO_T prGlueInfo; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - P_CMD_TEST_CTRL_T pCmdTestCtrl; - UINT_8 ucCmdSeqNum; - - ASSERT(prAdapter); - - prGlueInfo = prAdapter->prGlueInfo; - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, (CMD_HDR_SIZE + sizeof(CMD_TEST_CTRL_T))); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - - // Setup common CMD Info Packet - prCmdInfo->eCmdType = COMMAND_TYPE_GENERAL_IOCTL; - prCmdInfo->u2InfoBufLen = CMD_HDR_SIZE + sizeof(CMD_TEST_CTRL_T); - prCmdInfo->pfCmdDoneHandler = nicCmdEventSetCommon; - prCmdInfo->pfCmdTimeoutHandler = nicOidCmdTimeoutCommon; - prCmdInfo->fgIsOid = TRUE; - prCmdInfo->ucCID = CMD_ID_TEST_MODE; - prCmdInfo->fgSetQuery = TRUE; - prCmdInfo->fgNeedResp = FALSE; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = sizeof(CMD_TEST_CTRL_T); - prCmdInfo->pvInformationBuffer = NULL; - prCmdInfo->u4InformationBufferLength = 0; - - // Setup WIFI_CMD_T (payload = CMD_TEST_CTRL_T) - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - pCmdTestCtrl = (P_CMD_TEST_CTRL_T)(prWifiCmd->aucBuffer); - pCmdTestCtrl->ucAction = 1; // Set ATInfo - pCmdTestCtrl->u.rRfATInfo.u4FuncIndex = u4FuncIndex; - pCmdTestCtrl->u.rRfATInfo.u4FuncData = u4FuncData; - - // insert into prCmdQueue - kalEnqueueCommand(prGlueInfo, (P_QUE_ENTRY_T)prCmdInfo); - - // wakeup txServiceThread later - GLUE_SET_EVENT(prAdapter->prGlueInfo); - - return WLAN_STATUS_PENDING; -} - -WLAN_STATUS -rftestQueryATInfo( - IN P_ADAPTER_T prAdapter, - UINT_32 u4FuncIndex, - UINT_32 u4FuncData, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen - ) -{ - P_GLUE_INFO_T prGlueInfo; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - P_CMD_TEST_CTRL_T pCmdTestCtrl; - UINT_8 ucCmdSeqNum; - P_EVENT_TEST_STATUS prTestStatus; - - ASSERT(prAdapter); - - prGlueInfo = prAdapter->prGlueInfo; - - if(u4FuncIndex == RF_AT_FUNCID_FW_INFO) { - /* driver implementation */ - prTestStatus = (P_EVENT_TEST_STATUS)pvQueryBuffer; - - prTestStatus->rATInfo.u4FuncData = - (prAdapter->rVerInfo.u2FwProductID << 16) | (prAdapter->rVerInfo.u2FwOwnVersion); - u4QueryBufferLen = sizeof(EVENT_TEST_STATUS); - - return WLAN_STATUS_SUCCESS; - } - else if(u4FuncIndex == RF_AT_FUNCID_DRV_INFO) { - /* driver implementation */ - prTestStatus = (P_EVENT_TEST_STATUS)pvQueryBuffer; - - prTestStatus->rATInfo.u4FuncData = CFG_DRV_OWN_VERSION; - u4QueryBufferLen = sizeof(EVENT_TEST_STATUS); - - return WLAN_STATUS_SUCCESS; - } - else { - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, (CMD_HDR_SIZE + sizeof(CMD_TEST_CTRL_T))); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - - // Setup common CMD Info Packet - prCmdInfo->eCmdType = COMMAND_TYPE_GENERAL_IOCTL; - prCmdInfo->u2InfoBufLen = CMD_HDR_SIZE + sizeof(CMD_TEST_CTRL_T); - prCmdInfo->pfCmdDoneHandler = nicCmdEventQueryRfTestATInfo; - prCmdInfo->pfCmdTimeoutHandler = nicOidCmdTimeoutCommon; - prCmdInfo->fgIsOid = TRUE; - prCmdInfo->ucCID = CMD_ID_TEST_MODE; - prCmdInfo->fgSetQuery = FALSE; - prCmdInfo->fgNeedResp = TRUE; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = sizeof(CMD_TEST_CTRL_T); - prCmdInfo->pvInformationBuffer = pvQueryBuffer; - prCmdInfo->u4InformationBufferLength = u4QueryBufferLen; - - // Setup WIFI_CMD_T (payload = CMD_TEST_CTRL_T) - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - pCmdTestCtrl = (P_CMD_TEST_CTRL_T)(prWifiCmd->aucBuffer); - pCmdTestCtrl->ucAction = 2; // Get ATInfo - pCmdTestCtrl->u.rRfATInfo.u4FuncIndex = u4FuncIndex; - pCmdTestCtrl->u.rRfATInfo.u4FuncData = u4FuncData; - - // insert into prCmdQueue - kalEnqueueCommand(prGlueInfo, (P_QUE_ENTRY_T)prCmdInfo); - - // wakeup txServiceThread later - GLUE_SET_EVENT(prAdapter->prGlueInfo); - - return WLAN_STATUS_PENDING; - } -} - -WLAN_STATUS -rftestSetFrequency( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4FreqInKHz, - IN PUINT_32 pu4SetInfoLen - ) -{ - CMD_TEST_CTRL_T rCmdTestCtrl; - - ASSERT(prAdapter); - - rCmdTestCtrl.ucAction = 5; // Set Channel Frequency - rCmdTestCtrl.u.u4ChannelFreq = u4FreqInKHz; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_TEST_MODE, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_TEST_CTRL_T), - (PUINT_8)&rCmdTestCtrl, - NULL, - 0); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief command packet generation utility -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] ucCID Command ID -* \param[in] fgSetQuery Set or Query -* \param[in] fgNeedResp Need for response -* \param[in] pfCmdDoneHandler Function pointer when command is done -* \param[in] u4SetQueryInfoLen The length of the set/query buffer -* \param[in] pucInfoBuffer Pointer to set/query buffer -* -* -* \retval WLAN_STATUS_PENDING -* \retval WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanSendSetQueryCmd ( - IN P_ADAPTER_T prAdapter, - UINT_8 ucCID, - BOOLEAN fgSetQuery, - BOOLEAN fgNeedResp, - BOOLEAN fgIsOid, - PFN_CMD_DONE_HANDLER pfCmdDoneHandler, - PFN_CMD_TIMEOUT_HANDLER pfCmdTimeoutHandler, - UINT_32 u4SetQueryInfoLen, - PUINT_8 pucInfoBuffer, - OUT PVOID pvSetQueryBuffer, - IN UINT_32 u4SetQueryBufferLen - ) -{ - P_GLUE_INFO_T prGlueInfo; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - UINT_8 ucCmdSeqNum; - - prGlueInfo = prAdapter->prGlueInfo; - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, (CMD_HDR_SIZE + u4SetQueryInfoLen)); - - DEBUGFUNC("wlanSendSetQueryCmd"); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - DBGLOG(REQ, TRACE, ("ucCmdSeqNum =%d\n", ucCmdSeqNum)); - - // Setup common CMD Info Packet - prCmdInfo->eCmdType = COMMAND_TYPE_NETWORK_IOCTL; - prCmdInfo->eNetworkType = NETWORK_TYPE_AIS_INDEX; - prCmdInfo->u2InfoBufLen = (UINT_16)(CMD_HDR_SIZE + u4SetQueryInfoLen); - prCmdInfo->pfCmdDoneHandler = pfCmdDoneHandler; - prCmdInfo->pfCmdTimeoutHandler = pfCmdTimeoutHandler; - prCmdInfo->fgIsOid = fgIsOid; - prCmdInfo->ucCID = ucCID; - prCmdInfo->fgSetQuery = fgSetQuery; - prCmdInfo->fgNeedResp = fgNeedResp; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = u4SetQueryInfoLen; - prCmdInfo->pvInformationBuffer = pvSetQueryBuffer; - prCmdInfo->u4InformationBufferLength = u4SetQueryBufferLen; - - // Setup WIFI_CMD_T (no payload) - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - if(u4SetQueryInfoLen > 0 && pucInfoBuffer != NULL) { - kalMemCopy(prWifiCmd->aucBuffer, pucInfoBuffer, u4SetQueryInfoLen); - } - - // insert into prCmdQueue - kalEnqueueCommand(prGlueInfo, (P_QUE_ENTRY_T)prCmdInfo); - - // wakeup txServiceThread later - GLUE_SET_EVENT(prGlueInfo); - return WLAN_STATUS_PENDING; -} - - - -#if CFG_SUPPORT_WAPI -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called by WAPI ui to set wapi mode, which is needed to info the the driver -* to operation at WAPI mode while driver initialize. -* -* \param[in] prAdapter Pointer to the Adapter structure -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set -* \param[in] u4SetBufferLen The length of the set buffer -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed due to invalid length of -* the set buffer, returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_DATA If new setting value is wrong. -* \retval WLAN_STATUS_INVALID_LENGTH -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetWapiMode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - DEBUGFUNC("wlanoidSetWapiMode"); - DBGLOG(REQ, LOUD, ("\r\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - ASSERT(pvSetBuffer); - - /* Todo:: For support WAPI and Wi-Fi at same driver, use the set wapi assoc ie at the check point */ - /* The Adapter Connection setting fgUseWapi will cleat whil oid set mode (infra), */ - /* And set fgUseWapi True while set wapi assoc ie */ - /* policay selection, add key all depend on this flag, */ - /* The fgUseWapi may remove later */ - if (*(PUINT_32)pvSetBuffer) { - prAdapter->fgUseWapi = TRUE; - } - else { - prAdapter->fgUseWapi = FALSE; - } - -#if 0 - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, (CMD_HDR_SIZE + 4)); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - - // compose CMD_BUILD_CONNECTION cmd pkt - prCmdInfo->eCmdType = COMMAND_TYPE_NETWORK_IOCTL; - prCmdInfo->eNetworkType = NETWORK_TYPE_AIS_INDEX; - prCmdInfo->u2InfoBufLen = CMD_HDR_SIZE + 4; - prCmdInfo->pfCmdDoneHandler = nicCmdEventSetCommon; - prCmdInfo->pfCmdTimeoutHandler = NULL; - prCmdInfo->fgIsOid = TRUE; - prCmdInfo->ucCID = CMD_ID_WAPI_MODE; - prCmdInfo->fgSetQuery = TRUE; - prCmdInfo->fgNeedResp = FALSE; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = u4SetBufferLen; - prCmdInfo->pvInformationBuffer = pvSetBuffer; - prCmdInfo->u4InformationBufferLength = u4SetBufferLen; - - // Setup WIFI_CMD_T - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - cp = (PUINT_8)(prWifiCmd->aucBuffer); - - kalMemCopy(cp, (PUINT_8)pvSetBuffer, 4); - - // insert into prCmdQueue - kalEnqueueCommand(prGlueInfo, (P_QUE_ENTRY_T)prCmdInfo); - - // wakeup txServiceThread later - GLUE_SET_EVENT(prGlueInfo); - - return WLAN_STATUS_PENDING; -#else - return WLAN_STATUS_SUCCESS; -#endif -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called by WAPI to set the assoc info, which is needed to add to -* Association request frame while join WAPI AP. -* -* \param[in] prAdapter Pointer to the Adapter structure -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set -* \param[in] u4SetBufferLen The length of the set buffer -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed due to invalid length of -* the set buffer, returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_DATA If new setting value is wrong. -* \retval WLAN_STATUS_INVALID_LENGTH -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetWapiAssocInfo ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_WAPI_INFO_ELEM_T prWapiInfo; - PUINT_8 cp; - UINT_16 u2AuthSuiteCount = 0; - UINT_16 u2PairSuiteCount = 0; - UINT_32 u4AuthKeyMgtSuite = 0; - UINT_32 u4PairSuite = 0; - UINT_32 u4GroupSuite = 0; - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - DEBUGFUNC("wlanoidSetWapiAssocInfo"); - DBGLOG(REQ, LOUD, ("\r\n")); - - if (u4SetBufferLen < 20 /* From EID to Group cipher */) { - prAdapter->rWifiVar.rConnSettings.fgWapiMode = FALSE; - return WLAN_STATUS_INVALID_LENGTH; - } - - prAdapter->rWifiVar.rConnSettings.fgWapiMode = TRUE; - - //if (prWapiInfo->ucElemId != ELEM_ID_WAPI) - // DBGLOG(SEC, TRACE, ("Not WAPI IE ?!\n")); - - //if (prWapiInfo->ucLength < 18) - // return WLAN_STATUS_INVALID_LENGTH; - - *pu4SetInfoLen = u4SetBufferLen; - - prWapiInfo = (P_WAPI_INFO_ELEM_T)pvSetBuffer; - - if (prWapiInfo->ucElemId != ELEM_ID_WAPI) { - DBGLOG(SEC, TRACE, ("Not WAPI IE ?! u4SetBufferLen = %d\n", u4SetBufferLen)); - prAdapter->rWifiVar.rConnSettings.fgWapiMode = FALSE; - return WLAN_STATUS_INVALID_LENGTH; - } - - if (prWapiInfo->ucLength < 18) - return WLAN_STATUS_INVALID_LENGTH; - - /* Skip Version check */ - cp = (PUINT_8)&prWapiInfo->u2AuthKeyMgtSuiteCount; - - WLAN_GET_FIELD_16(cp, &u2AuthSuiteCount); - - if (u2AuthSuiteCount>1) - return WLAN_STATUS_INVALID_LENGTH; - - cp += 2; - WLAN_GET_FIELD_32(cp, &u4AuthKeyMgtSuite); - - DBGLOG(SEC, TRACE, ("WAPI: Assoc Info auth mgt suite [%d]: %02x-%02x-%02x-%02x\n", - u2AuthSuiteCount, - (UCHAR) (u4AuthKeyMgtSuite & 0x000000FF), - (UCHAR) ((u4AuthKeyMgtSuite >> 8) & 0x000000FF), - (UCHAR) ((u4AuthKeyMgtSuite >> 16) & 0x000000FF), - (UCHAR) ((u4AuthKeyMgtSuite >> 24) & 0x000000FF))); - - if (u4AuthKeyMgtSuite != WAPI_AKM_SUITE_802_1X && - u4AuthKeyMgtSuite != WAPI_AKM_SUITE_PSK) - ASSERT(FALSE); - - cp += 4; - WLAN_GET_FIELD_16(cp, &u2PairSuiteCount); - if (u2PairSuiteCount>1) - return WLAN_STATUS_INVALID_LENGTH; - - cp += 2; - WLAN_GET_FIELD_32(cp, &u4PairSuite); - DBGLOG(SEC, TRACE, ("WAPI: Assoc Info pairwise cipher suite [%d]: %02x-%02x-%02x-%02x\n", - u2PairSuiteCount, - (UCHAR) (u4PairSuite & 0x000000FF), - (UCHAR) ((u4PairSuite >> 8) & 0x000000FF), - (UCHAR) ((u4PairSuite >> 16) & 0x000000FF), - (UCHAR) ((u4PairSuite >> 24) & 0x000000FF))); - - if (u4PairSuite != WAPI_CIPHER_SUITE_WPI) - ASSERT(FALSE); - - cp += 4; - WLAN_GET_FIELD_32(cp, &u4GroupSuite); - DBGLOG(SEC, TRACE, ("WAPI: Assoc Info group cipher suite : %02x-%02x-%02x-%02x\n", - (UCHAR) (u4GroupSuite & 0x000000FF), - (UCHAR) ((u4GroupSuite >> 8) & 0x000000FF), - (UCHAR) ((u4GroupSuite >> 16) & 0x000000FF), - (UCHAR) ((u4GroupSuite >> 24) & 0x000000FF))); - - if (u4GroupSuite != WAPI_CIPHER_SUITE_WPI) - ASSERT(FALSE); - - prAdapter->rWifiVar.rConnSettings.u4WapiSelectedAKMSuite = u4AuthKeyMgtSuite; - prAdapter->rWifiVar.rConnSettings.u4WapiSelectedPairwiseCipher = u4PairSuite; - prAdapter->rWifiVar.rConnSettings.u4WapiSelectedGroupCipher = u4GroupSuite; - - kalMemCopy(prAdapter->prGlueInfo->aucWapiAssocInfoIEs, pvSetBuffer, u4SetBufferLen); - prAdapter->prGlueInfo->u2WapiAssocInfoIESz = (UINT_16)u4SetBufferLen; - DBGLOG(SEC, TRACE, ("Assoc Info IE sz %ld\n", u4SetBufferLen)); - - return WLAN_STATUS_SUCCESS; - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set the wpi key to the driver. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_INVALID_DATA -* -* \note The setting buffer P_PARAM_WPI_KEY, which is set by NDIS, is unpacked. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetWapiKey ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_GLUE_INFO_T prGlueInfo; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - P_PARAM_WPI_KEY_T prNewKey; - P_CMD_802_11_KEY prCmdKey; - PUINT_8 pc; - UINT_8 ucCmdSeqNum; - - DEBUGFUNC("wlanoidSetWapiKey"); - DBGLOG(REQ, LOUD, ("\r\n")); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set add key! (Adapter not ready). ACPI=D%d, Radio=%d\r\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - prNewKey = (P_PARAM_WPI_KEY_T) pvSetBuffer; - - DBGLOG_MEM8(REQ, TRACE, (PUINT_8)pvSetBuffer, 560); - pc = (PUINT_8)pvSetBuffer; - - *pu4SetInfoLen = u4SetBufferLen; - - /* Exception check */ - if (prNewKey->ucKeyID != 0x1 || - prNewKey->ucKeyID != 0x0) { - prNewKey->ucKeyID = prNewKey->ucKeyID & BIT(0); - //DBGLOG(SEC, INFO, ("Invalid WAPI key ID (%d)\r\n", prNewKey->ucKeyID)); - } - - /* Dump P_PARAM_WPI_KEY_T content. */ - DBGLOG(REQ, TRACE, ("Set: Dump P_PARAM_WPI_KEY_T content\r\n")); - DBGLOG(REQ, TRACE, ("TYPE : %d\r\n", prNewKey->eKeyType)); - DBGLOG(REQ, TRACE, ("Direction : %d\r\n", prNewKey->eDirection)); - DBGLOG(REQ, TRACE, ("KeyID : %d\r\n", prNewKey->ucKeyID)); - DBGLOG(REQ, TRACE, ("AddressIndex:\r\n")); - DBGLOG_MEM8(REQ, TRACE, prNewKey->aucAddrIndex, 12); - prNewKey->u4LenWPIEK = 16; - - DBGLOG_MEM8(REQ, TRACE, (PUINT_8)prNewKey->aucWPIEK, (UINT_8)prNewKey->u4LenWPIEK); - prNewKey->u4LenWPICK = 16; - - DBGLOG(REQ, TRACE, ("CK Key(%d):\r\n", (UINT_8)prNewKey->u4LenWPICK)); - DBGLOG_MEM8(REQ, TRACE, (PUINT_8)prNewKey->aucWPICK, (UINT_8)prNewKey->u4LenWPICK); - DBGLOG(REQ, TRACE, ("PN:\r\n")); - if (prNewKey->eKeyType == 0){ - prNewKey->aucPN[0] = 0x5c; - prNewKey->aucPN[1] = 0x36; - prNewKey->aucPN[2] = 0x5c; - prNewKey->aucPN[3] = 0x36; - prNewKey->aucPN[4] = 0x5c; - prNewKey->aucPN[5] = 0x36; - prNewKey->aucPN[6] = 0x5c; - prNewKey->aucPN[7] = 0x36; - prNewKey->aucPN[8] = 0x5c; - prNewKey->aucPN[9] = 0x36; - prNewKey->aucPN[10] = 0x5c; - prNewKey->aucPN[11] = 0x36; - prNewKey->aucPN[12] = 0x5c; - prNewKey->aucPN[13] = 0x36; - prNewKey->aucPN[14] = 0x5c; - prNewKey->aucPN[15] = 0x36; - } - - DBGLOG_MEM8(REQ, TRACE, (PUINT_8)prNewKey->aucPN, 16); - - prGlueInfo = prAdapter->prGlueInfo; - - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, (CMD_HDR_SIZE + u4SetBufferLen)); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - - // compose CMD_ID_ADD_REMOVE_KEY cmd pkt - prCmdInfo->eCmdType = COMMAND_TYPE_NETWORK_IOCTL; - prCmdInfo->eNetworkType = NETWORK_TYPE_AIS_INDEX; - prCmdInfo->u2InfoBufLen = CMD_HDR_SIZE + sizeof(CMD_802_11_KEY); - prCmdInfo->pfCmdDoneHandler = nicCmdEventSetCommon; - prCmdInfo->pfCmdTimeoutHandler = nicOidCmdTimeoutCommon; - prCmdInfo->fgIsOid = TRUE; - prCmdInfo->ucCID = CMD_ID_ADD_REMOVE_KEY; - prCmdInfo->fgSetQuery = TRUE; - prCmdInfo->fgNeedResp = FALSE; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = u4SetBufferLen; - prCmdInfo->pvInformationBuffer = pvSetBuffer; - prCmdInfo->u4InformationBufferLength = u4SetBufferLen; - - // Setup WIFI_CMD_T - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - prCmdKey = (P_CMD_802_11_KEY)(prWifiCmd->aucBuffer); - - kalMemZero(prCmdKey, sizeof(CMD_802_11_KEY)); - - prCmdKey->ucAddRemove = 1; /* Add */ - - if (prNewKey->eKeyType == ENUM_WPI_PAIRWISE_KEY) { - prCmdKey->ucTxKey = 1; - prCmdKey->ucKeyType = 1; - } - - kalMemCopy(prCmdKey->aucPeerAddr, (PUINT_8)prNewKey->aucAddrIndex, MAC_ADDR_LEN); - - prCmdKey->ucNetType = 0; /* AIS */ - - prCmdKey->ucKeyId = prNewKey->ucKeyID; - - prCmdKey->ucKeyLen = 32; - - prCmdKey->ucAlgorithmId = CIPHER_SUITE_WPI; - - kalMemCopy(prCmdKey->aucKeyMaterial, (PUINT_8)prNewKey->aucWPIEK, 16); - - kalMemCopy(prCmdKey->aucKeyMaterial+16, (PUINT_8)prNewKey->aucWPICK, 16); - - kalMemCopy(prCmdKey->aucKeyRsc, (PUINT_8)prNewKey->aucPN, 16); - - // insert into prCmdQueue - kalEnqueueCommand(prGlueInfo, (P_QUE_ENTRY_T)prCmdInfo); - - // wakeup txServiceThread later - GLUE_SET_EVENT(prGlueInfo); - - return WLAN_STATUS_PENDING; -} /* wlanoidSetAddKey */ -#endif - - -#if CFG_SUPPORT_WPS2 -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called by WSC to set the assoc info, which is needed to add to -* Association request frame while join WPS AP. -* -* \param[in] prAdapter Pointer to the Adapter structure -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set -* \param[in] u4SetBufferLen The length of the set buffer -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed due to invalid length of -* the set buffer, returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_DATA If new setting value is wrong. -* \retval WLAN_STATUS_INVALID_LENGTH -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetWSCAssocInfo ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - DEBUGFUNC("wlanoidSetWSCAssocInfo"); - DBGLOG(REQ, LOUD, ("\r\n")); - - if(u4SetBufferLen == 0) - return WLAN_STATUS_INVALID_LENGTH; - - *pu4SetInfoLen = u4SetBufferLen; - - kalMemCopy(prAdapter->prGlueInfo->aucWSCAssocInfoIE, pvSetBuffer, u4SetBufferLen); - prAdapter->prGlueInfo->u2WSCAssocInfoIELen = (UINT_16)u4SetBufferLen; - DBGLOG(SEC, TRACE, ("Assoc Info IE sz %ld\n", u4SetBufferLen)); - - return WLAN_STATUS_SUCCESS; - -} -#endif - - -#if CFG_ENABLE_WAKEUP_ON_LAN -WLAN_STATUS -wlanoidSetAddWakeupPattern ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_PM_PACKET_PATTERN prPacketPattern; - - DEBUGFUNC("wlanoidSetAddWakeupPattern"); - DBGLOG(REQ, LOUD, ("\r\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_PM_PACKET_PATTERN); - - if (u4SetBufferLen < sizeof(PARAM_PM_PACKET_PATTERN)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - - prPacketPattern = (P_PARAM_PM_PACKET_PATTERN) pvSetBuffer; - - /* FIXME: - * Send the struct to firmware */ - - return WLAN_STATUS_FAILURE; -} - - -WLAN_STATUS -wlanoidSetRemoveWakeupPattern ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_PM_PACKET_PATTERN prPacketPattern; - - DEBUGFUNC("wlanoidSetAddWakeupPattern"); - DBGLOG(REQ, LOUD, ("\r\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_PM_PACKET_PATTERN); - - if (u4SetBufferLen < sizeof(PARAM_PM_PACKET_PATTERN)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - - prPacketPattern = (P_PARAM_PM_PACKET_PATTERN) pvSetBuffer; - - /* FIXME: - * Send the struct to firmware */ - - return WLAN_STATUS_FAILURE; -} - - -WLAN_STATUS -wlanoidQueryEnableWakeup ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - PUINT_32 pu4WakeupEventEnable; - - DEBUGFUNC("wlanoidQueryEnableWakeup"); - DBGLOG(REQ, LOUD, ("\r\n")); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(UINT_32); - - if (u4QueryBufferLen < sizeof(UINT_32)) { - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - pu4WakeupEventEnable = (PUINT_32)pvQueryBuffer; - - *pu4WakeupEventEnable = prAdapter->u4WakeupEventEnable; - - return WLAN_STATUS_SUCCESS; -} - -WLAN_STATUS -wlanoidSetEnableWakeup ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - PUINT_32 pu4WakeupEventEnable; - - DEBUGFUNC("wlanoidSetEnableWakup"); - DBGLOG(REQ, LOUD, ("\r\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(UINT_32); - - if (u4SetBufferLen < sizeof(UINT_32)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - - pu4WakeupEventEnable = (PUINT_32)pvSetBuffer; - prAdapter->u4WakeupEventEnable = *pu4WakeupEventEnable; - - /* FIXME: - * Send Command Event for setting wakeup-pattern / Magic Packet to firmware - * */ - - return WLAN_STATUS_FAILURE; -} -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to configure PS related settings for WMM-PS test. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetWiFiWmmPsTest ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_CUSTOM_WMM_PS_TEST_STRUC_T prWmmPsTestInfo; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - CMD_SET_WMM_PS_TEST_STRUC_T rSetWmmPsTestParam; - UINT_16 u2CmdBufLen; - P_PM_PROFILE_SETUP_INFO_T prPmProfSetupInfo; - P_BSS_INFO_T prBssInfo; - - DEBUGFUNC("wlanoidSetWiFiWmmPsTest"); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - - *pu4SetInfoLen = sizeof(PARAM_CUSTOM_WMM_PS_TEST_STRUC_T); - - prWmmPsTestInfo = (P_PARAM_CUSTOM_WMM_PS_TEST_STRUC_T) pvSetBuffer; - - rSetWmmPsTestParam.ucNetTypeIndex = NETWORK_TYPE_AIS_INDEX; - rSetWmmPsTestParam.bmfgApsdEnAc = prWmmPsTestInfo->bmfgApsdEnAc; - rSetWmmPsTestParam.ucIsEnterPsAtOnce = prWmmPsTestInfo->ucIsEnterPsAtOnce; - rSetWmmPsTestParam.ucIsDisableUcTrigger = prWmmPsTestInfo->ucIsDisableUcTrigger; - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[rSetWmmPsTestParam.ucNetTypeIndex]); - prPmProfSetupInfo = &prBssInfo->rPmProfSetupInfo; - prPmProfSetupInfo->ucBmpDeliveryAC = (rSetWmmPsTestParam.bmfgApsdEnAc >> 4) & BITS(0, 3); - prPmProfSetupInfo->ucBmpTriggerAC = rSetWmmPsTestParam.bmfgApsdEnAc & BITS(0, 3); - - u2CmdBufLen = sizeof(CMD_SET_WMM_PS_TEST_STRUC_T); - -#if 0 - /* it will apply the disable trig or not immediately */ - if (prPmInfo->ucWmmPsDisableUcPoll && prPmInfo->ucWmmPsConnWithTrig) { -// NIC_PM_WMM_PS_DISABLE_UC_TRIG(prAdapter, TRUE); - } - else { -// NIC_PM_WMM_PS_DISABLE_UC_TRIG(prAdapter, FALSE); - } -#endif - - rStatus = wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_WMM_PS_TEST_PARMS, - TRUE, - FALSE, - TRUE, - NULL, // TODO? - NULL, - u2CmdBufLen, - (PUINT_8)&rSetWmmPsTestParam, - NULL, - 0); - - - return rStatus; -} /* wlanoidSetWiFiWmmPsTest */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to configure enable/disable TX A-MPDU feature. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetTxAmpdu ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - CMD_TX_AMPDU_T rTxAmpdu; - UINT_16 u2CmdBufLen; - PBOOLEAN pfgEnable; - - DEBUGFUNC("wlanoidSetTxAmpdu"); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - - *pu4SetInfoLen = sizeof(BOOLEAN); - - pfgEnable = (PBOOLEAN) pvSetBuffer; - - rTxAmpdu.fgEnable = *pfgEnable; - - u2CmdBufLen = sizeof(CMD_TX_AMPDU_T); - - rStatus = wlanSendSetQueryCmd(prAdapter, - CMD_ID_TX_AMPDU, - TRUE, - FALSE, - TRUE, - NULL, - NULL, - u2CmdBufLen, - (PUINT_8)&rTxAmpdu, - NULL, - 0); - - - return rStatus; -} /* wlanoidSetTxAmpdu */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to configure reject/accept ADDBA Request. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetAddbaReject( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - CMD_ADDBA_REJECT_T rAddbaReject; - UINT_16 u2CmdBufLen; - PBOOLEAN pfgEnable; - - DEBUGFUNC("wlanoidSetAddbaReject"); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - - *pu4SetInfoLen = sizeof(BOOLEAN); - - pfgEnable = (PBOOLEAN) pvSetBuffer; - - rAddbaReject.fgEnable = *pfgEnable; - - u2CmdBufLen = sizeof(CMD_ADDBA_REJECT_T); - - rStatus = wlanSendSetQueryCmd(prAdapter, - CMD_ID_ADDBA_REJECT, - TRUE, - FALSE, - TRUE, - NULL, - NULL, - u2CmdBufLen, - (PUINT_8)&rAddbaReject, - NULL, - 0); - - - return rStatus; -} /* wlanoidSetAddbaReject */ - - -#if CFG_SLT_SUPPORT - -WLAN_STATUS -wlanoidQuerySLTStatus ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - P_PARAM_MTK_SLT_TEST_STRUC_T prMtkSltInfo = (P_PARAM_MTK_SLT_TEST_STRUC_T)NULL; - P_SLT_INFO_T prSltInfo = (P_SLT_INFO_T)NULL; - - DEBUGFUNC("wlanoidQuerySLTStatus"); - DBGLOG(REQ, LOUD, ("\r\n")); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - - *pu4QueryInfoLen = sizeof(PARAM_MTK_SLT_TEST_STRUC_T); - - if (u4QueryBufferLen < sizeof(PARAM_MTK_SLT_TEST_STRUC_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvQueryBuffer); - - prMtkSltInfo = (P_PARAM_MTK_SLT_TEST_STRUC_T)pvQueryBuffer; - - prSltInfo = &(prAdapter->rWifiVar.rSltInfo); - - switch (prMtkSltInfo->rSltFuncIdx) { - case ENUM_MTK_SLT_FUNC_LP_SET: - { - P_PARAM_MTK_SLT_LP_TEST_STRUC_T prLpSetting = (P_PARAM_MTK_SLT_LP_TEST_STRUC_T)NULL; - - ASSERT(prMtkSltInfo->u4FuncInfoLen == sizeof(PARAM_MTK_SLT_LP_TEST_STRUC_T)); - - prLpSetting = (P_PARAM_MTK_SLT_LP_TEST_STRUC_T)&prMtkSltInfo->unFuncInfoContent; - - prLpSetting->u4BcnRcvNum = prSltInfo->u4BeaconReceiveCnt; - } - break; - default: - // TBD... - break; - } - - return rWlanStatus; -} /* wlanoidQuerySLTStatus */ - -WLAN_STATUS -wlanoidUpdateSLTMode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - P_PARAM_MTK_SLT_TEST_STRUC_T prMtkSltInfo = (P_PARAM_MTK_SLT_TEST_STRUC_T)NULL; - P_SLT_INFO_T prSltInfo = (P_SLT_INFO_T)NULL; - P_BSS_DESC_T prBssDesc = (P_BSS_DESC_T)NULL; - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - P_BSS_INFO_T prBssInfo = (P_BSS_INFO_T)NULL; - - /* 1. Action: Update or Initial Set - * 2. Role. - * 3. Target MAC address. - * 4. RF BW & Rate Settings - */ - - DEBUGFUNC("wlanoidUpdateSLTMode"); - DBGLOG(REQ, LOUD, ("\r\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_MTK_SLT_TEST_STRUC_T); - - if (u4SetBufferLen < sizeof(PARAM_MTK_SLT_TEST_STRUC_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - - prMtkSltInfo = (P_PARAM_MTK_SLT_TEST_STRUC_T) pvSetBuffer; - - prSltInfo = &(prAdapter->rWifiVar.rSltInfo); - prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]; - - switch (prMtkSltInfo->rSltFuncIdx) { - case ENUM_MTK_SLT_FUNC_INITIAL: /* Initialize */ - { - P_PARAM_MTK_SLT_INITIAL_STRUC_T prMtkSltInit = (P_PARAM_MTK_SLT_INITIAL_STRUC_T)NULL; - - ASSERT(prMtkSltInfo->u4FuncInfoLen == sizeof(PARAM_MTK_SLT_INITIAL_STRUC_T)); - - prMtkSltInit = (P_PARAM_MTK_SLT_INITIAL_STRUC_T)&prMtkSltInfo->unFuncInfoContent; - - if (prSltInfo->prPseudoStaRec != NULL) { - /* The driver has been initialized. */ - prSltInfo->prPseudoStaRec = NULL; - } - - - prSltInfo->prPseudoBssDesc = scanSearchExistingBssDesc(prAdapter, - BSS_TYPE_IBSS, - prMtkSltInit->aucTargetMacAddr, - prMtkSltInit->aucTargetMacAddr); - - prSltInfo->u2SiteID = prMtkSltInit->u2SiteID; - - /* Bandwidth 2.4G: Channel 1~14 - * Bandwidth 5G: *36, 40, 44, 48, 52, 56, 60, 64, - * *100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, - * 149, 153, *157, 161, - * 184, 188, 192, 196, 200, 204, 208, 212, *216 - */ - prSltInfo->ucChannel2G4 = 1 + (prSltInfo->u2SiteID % 4) * 5; - - switch (prSltInfo->ucChannel2G4) { - case 1: - prSltInfo->ucChannel5G = 36; - break; - case 6: - prSltInfo->ucChannel5G = 52; - break; - case 11: - prSltInfo->ucChannel5G = 104; - break; - case 16: - prSltInfo->ucChannel2G4 = 14; - prSltInfo->ucChannel5G = 161; - break; - default: - ASSERT(FALSE); - } - - if (prSltInfo->prPseudoBssDesc == NULL) { - do { - prSltInfo->prPseudoBssDesc = scanAllocateBssDesc(prAdapter); - - if (prSltInfo->prPseudoBssDesc == NULL) { - rWlanStatus = WLAN_STATUS_FAILURE; - break; - } - else { - prBssDesc = prSltInfo->prPseudoBssDesc; - } - } while (FALSE); - } - else { - prBssDesc = prSltInfo->prPseudoBssDesc; - } - - if (prBssDesc) { - prBssDesc->eBSSType = BSS_TYPE_IBSS; - - COPY_MAC_ADDR(prBssDesc->aucSrcAddr, prMtkSltInit->aucTargetMacAddr); - COPY_MAC_ADDR(prBssDesc->aucBSSID, prBssInfo->aucOwnMacAddr); - - prBssDesc->u2BeaconInterval = 100; - prBssDesc->u2ATIMWindow = 0; - prBssDesc->ucDTIMPeriod = 1; - - prBssDesc->u2IELength = 0; - - prBssDesc->fgIsERPPresent = TRUE; - prBssDesc->fgIsHTPresent = TRUE; - - prBssDesc->u2OperationalRateSet = BIT(RATE_36M_INDEX); - prBssDesc->u2BSSBasicRateSet = BIT(RATE_36M_INDEX); - prBssDesc->fgIsUnknownBssBasicRate = FALSE; - - prBssDesc->fgIsLargerTSF = TRUE; - - prBssDesc->eBand = BAND_2G4; - - prBssDesc->ucChannelNum = prSltInfo->ucChannel2G4; - - prBssDesc->ucPhyTypeSet = PHY_TYPE_SET_802_11ABGN; - - GET_CURRENT_SYSTIME(&prBssDesc->rUpdateTime); - } - } - break; - case ENUM_MTK_SLT_FUNC_RATE_SET: /* Update RF Settings. */ - if (prSltInfo->prPseudoStaRec == NULL) { - rWlanStatus = WLAN_STATUS_FAILURE; - } - else { - P_PARAM_MTK_SLT_TR_TEST_STRUC_T prTRSetting = (P_PARAM_MTK_SLT_TR_TEST_STRUC_T)NULL; - - ASSERT(prMtkSltInfo->u4FuncInfoLen == sizeof(PARAM_MTK_SLT_TR_TEST_STRUC_T)); - - prStaRec = prSltInfo->prPseudoStaRec; - prTRSetting = (P_PARAM_MTK_SLT_TR_TEST_STRUC_T)&prMtkSltInfo->unFuncInfoContent; - - if (prTRSetting->rNetworkType == PARAM_NETWORK_TYPE_OFDM5) { - prBssInfo->eBand = BAND_5G; - prBssInfo->ucPrimaryChannel = prSltInfo->ucChannel5G; - } - if (prTRSetting->rNetworkType == PARAM_NETWORK_TYPE_OFDM24) { - prBssInfo->eBand = BAND_2G4; - prBssInfo->ucPrimaryChannel = prSltInfo->ucChannel2G4; - } - - if ((prTRSetting->u4FixedRate & FIXED_BW_DL40) != 0) { - /* RF 40 */ - prStaRec->u2HtCapInfo |= HT_CAP_INFO_SUP_CHNL_WIDTH; /* It would controls RFBW capability in WTBL. */ - prStaRec->ucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; /* This controls RF BW, RF BW would be 40 only if - * 1. PHY_TYPE_BIT_HT is TRUE. - * 2. SCO is SCA/SCB. - */ - - /* U20/L20 Control. */ - switch (prTRSetting->u4FixedRate & 0xC000) { - case FIXED_EXT_CHNL_U20: - prBssInfo->eBssSCO = CHNL_EXT_SCB; // +2 - if (prTRSetting->rNetworkType == PARAM_NETWORK_TYPE_OFDM5) { - prBssInfo->ucPrimaryChannel += 2; - } - else { - if (prBssInfo->ucPrimaryChannel <5) { - prBssInfo->ucPrimaryChannel = 8; // For channel 1, testing L20 at channel 8. - } - } - break; - case FIXED_EXT_CHNL_L20: - default: /* 40M */ - prBssInfo->eBssSCO = CHNL_EXT_SCA; // -2 - if (prTRSetting->rNetworkType == PARAM_NETWORK_TYPE_OFDM5) { - prBssInfo->ucPrimaryChannel -= 2; - } - else { - if (prBssInfo->ucPrimaryChannel > 10) { - prBssInfo->ucPrimaryChannel = 3; // For channel 11 / 14. testing U20 at channel 3. - } - } - break; - } - } - else { - /* RF 20 */ - prStaRec->u2HtCapInfo &= ~HT_CAP_INFO_SUP_CHNL_WIDTH; - prBssInfo->eBssSCO = CHNL_EXT_SCN; - } - - prBssInfo->fgErpProtectMode = FALSE; - prBssInfo->eHtProtectMode = HT_PROTECT_MODE_NONE; - prBssInfo->eGfOperationMode = GF_MODE_NORMAL; - - nicUpdateBss(prAdapter, prBssInfo->ucNetTypeIndex); - - prStaRec->u2HtCapInfo &= ~(HT_CAP_INFO_SHORT_GI_20M | HT_CAP_INFO_SHORT_GI_40M); - - switch (prTRSetting->u4FixedRate & 0xFF) { - case RATE_OFDM_54M: - prStaRec->u2DesiredNonHTRateSet = BIT(RATE_54M_INDEX); - break; - case RATE_OFDM_48M: - prStaRec->u2DesiredNonHTRateSet = BIT(RATE_48M_INDEX); - break; - case RATE_OFDM_36M: - prStaRec->u2DesiredNonHTRateSet = BIT(RATE_36M_INDEX); - break; - case RATE_OFDM_24M: - prStaRec->u2DesiredNonHTRateSet = BIT(RATE_24M_INDEX); - break; - case RATE_OFDM_6M: - prStaRec->u2DesiredNonHTRateSet = BIT(RATE_6M_INDEX); - break; - case RATE_CCK_11M_LONG: - prStaRec->u2DesiredNonHTRateSet = BIT(RATE_11M_INDEX); - break; - case RATE_CCK_1M_LONG: - prStaRec->u2DesiredNonHTRateSet = BIT(RATE_1M_INDEX); - break; - case RATE_GF_MCS_0: - prStaRec->u2DesiredNonHTRateSet = BIT(RATE_HT_PHY_INDEX); - prStaRec->u2HtCapInfo |= HT_CAP_INFO_HT_GF; - break; - case RATE_MM_MCS_7: - prStaRec->u2DesiredNonHTRateSet = BIT(RATE_HT_PHY_INDEX); - prStaRec->u2HtCapInfo &= ~HT_CAP_INFO_HT_GF; -#if 0 // Only for Current Measurement Mode. - prStaRec->u2HtCapInfo |= (HT_CAP_INFO_SHORT_GI_20M | HT_CAP_INFO_SHORT_GI_40M); -#endif - break; - case RATE_GF_MCS_7: - prStaRec->u2DesiredNonHTRateSet = BIT(RATE_HT_PHY_INDEX); - prStaRec->u2HtCapInfo |= HT_CAP_INFO_HT_GF; - break; - default: - prStaRec->u2DesiredNonHTRateSet = BIT(RATE_36M_INDEX); - break; - } - - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); - - } - break; - case ENUM_MTK_SLT_FUNC_LP_SET: /* Reset LP Test Result. */ - { - P_PARAM_MTK_SLT_LP_TEST_STRUC_T prLpSetting = (P_PARAM_MTK_SLT_LP_TEST_STRUC_T)NULL; - - ASSERT(prMtkSltInfo->u4FuncInfoLen == sizeof(PARAM_MTK_SLT_LP_TEST_STRUC_T)); - - prLpSetting = (P_PARAM_MTK_SLT_LP_TEST_STRUC_T)&prMtkSltInfo->unFuncInfoContent; - - if (prSltInfo->prPseudoBssDesc == NULL) { - /* Please initial SLT Mode first. */ - break; - } - else { - prBssDesc = prSltInfo->prPseudoBssDesc; - } - - switch (prLpSetting->rLpTestMode) { - case ENUM_MTK_LP_TEST_NORMAL: - /* In normal mode, we would use target MAC address to be the BSSID. */ - COPY_MAC_ADDR(prBssDesc->aucBSSID, prBssInfo->aucOwnMacAddr); - prSltInfo->fgIsDUT = FALSE; - break; - case ENUM_MTK_LP_TEST_GOLDEN_SAMPLE: - /* 1. Lower AIFS of BCN queue. - * 2. Fixed Random Number tobe 0. - */ - prSltInfo->fgIsDUT = FALSE; - /* In LP test mode, we would use MAC address of Golden Sample to be the BSSID. */ - COPY_MAC_ADDR(prBssDesc->aucBSSID, prBssInfo->aucOwnMacAddr); - break; - case ENUM_MTK_LP_TEST_DUT: - /* 1. Enter Sleep Mode. - * 2. Fix random number a large value & enlarge AIFN of BCN queue. - */ - COPY_MAC_ADDR(prBssDesc->aucBSSID, prBssDesc->aucSrcAddr); - prSltInfo->u4BeaconReceiveCnt = 0; - prSltInfo->fgIsDUT = TRUE; - break; - } - - } - - break; - default: - break; - } - - - - - return WLAN_STATUS_FAILURE; - - - return rWlanStatus; -} /* wlanoidUpdateSLTMode */ -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query NVRAM value. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuf A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryNvramRead ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - P_PARAM_CUSTOM_NVRAM_RW_STRUCT_T prNvramRwInfo; - UINT_16 u2Data; - BOOLEAN fgStatus; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - - DEBUGFUNC("wlanoidQueryNvramRead"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(PARAM_CUSTOM_NVRAM_RW_STRUCT_T); - - if (u4QueryBufferLen < sizeof(PARAM_CUSTOM_NVRAM_RW_STRUCT_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - prNvramRwInfo = (P_PARAM_CUSTOM_NVRAM_RW_STRUCT_T)pvQueryBuffer; - - if(prNvramRwInfo->ucEepromMethod == PARAM_EEPROM_READ_METHOD_READ) { - fgStatus = kalCfgDataRead16(prAdapter->prGlueInfo, - prNvramRwInfo->ucEepromIndex << 1, /* change to byte offset */ - &u2Data); - - if(fgStatus) { - prNvramRwInfo->u2EepromData = u2Data; - DBGLOG(REQ, INFO, ("NVRAM Read: index=%#X, data=%#02X\r\n", - prNvramRwInfo->ucEepromIndex, u2Data)); - } - else{ - DBGLOG(REQ, ERROR, ("NVRAM Read Failed: index=%#x.\r\n", - prNvramRwInfo->ucEepromIndex)); - rStatus = WLAN_STATUS_FAILURE; - } - } - else if (prNvramRwInfo->ucEepromMethod == PARAM_EEPROM_READ_METHOD_GETSIZE) { - prNvramRwInfo->u2EepromData = CFG_FILE_WIFI_REC_SIZE; - DBGLOG(REQ, INFO, ("EEPROM size =%d\r\n", prNvramRwInfo->u2EepromData)); - } - - *pu4QueryInfoLen = sizeof(PARAM_CUSTOM_EEPROM_RW_STRUC_T); - - return rStatus; -} /* wlanoidQueryNvramRead */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to write NVRAM value. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetNvramWrite ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_CUSTOM_NVRAM_RW_STRUCT_T prNvramRwInfo; - BOOLEAN fgStatus; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - - - DEBUGFUNC("wlanoidSetNvramWrite"); - DBGLOG(INIT, LOUD,("\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_CUSTOM_NVRAM_RW_STRUCT_T); - - if (u4SetBufferLen < sizeof(PARAM_CUSTOM_NVRAM_RW_STRUCT_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - - prNvramRwInfo = (P_PARAM_CUSTOM_NVRAM_RW_STRUCT_T)pvSetBuffer; - - fgStatus = kalCfgDataWrite16(prAdapter->prGlueInfo, - prNvramRwInfo->ucEepromIndex << 1, /* change to byte offset */ - prNvramRwInfo->u2EepromData - ); - - if(fgStatus == FALSE){ - DBGLOG(REQ, ERROR, ("NVRAM Write Failed.\r\n")); - rStatus = WLAN_STATUS_FAILURE; - } - - return rStatus; -} /* wlanoidSetNvramWrite */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to get the config data source type. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryCfgSrcType( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - ASSERT(prAdapter); - - *pu4QueryInfoLen = sizeof(ENUM_CFG_SRC_TYPE_T); - - if(kalIsConfigurationExist(prAdapter->prGlueInfo) == TRUE) { - *(P_ENUM_CFG_SRC_TYPE_T)pvQueryBuffer = CFG_SRC_TYPE_NVRAM; - } - else { - *(P_ENUM_CFG_SRC_TYPE_T)pvQueryBuffer = CFG_SRC_TYPE_EEPROM; - } - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to get the config data source type. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryEepromType( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - ASSERT(prAdapter); - - *pu4QueryInfoLen = sizeof(P_ENUM_EEPROM_TYPE_T); - -#if CFG_SUPPORT_NIC_CAPABILITY - if(prAdapter->fgIsEepromUsed == TRUE) { - *( P_ENUM_EEPROM_TYPE_T )pvQueryBuffer = EEPROM_TYPE_PRESENT; - } - else { - *( P_ENUM_EEPROM_TYPE_T )pvQueryBuffer = EEPROM_TYPE_NO; - } -#else - *( P_ENUM_EEPROM_TYPE_T )pvQueryBuffer = EEPROM_TYPE_NO; -#endif - - return WLAN_STATUS_SUCCESS; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to get the config data source type. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetCountryCode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - PUINT_8 pucCountry; - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(u4SetBufferLen == 2); - - *pu4SetInfoLen = 2; - - pucCountry = pvSetBuffer; - - prAdapter->rWifiVar.rConnSettings.u2CountryCode = - (((UINT_16) pucCountry[0]) << 8) | ((UINT_16) pucCountry[1]) ; - - prAdapter->prDomainInfo = NULL; /* Force to re-search country code */ - rlmDomainSendCmd(prAdapter, TRUE); - - return WLAN_STATUS_SUCCESS; -} - -#if 0 -WLAN_STATUS -wlanoidSetNoaParam ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_CUSTOM_NOA_PARAM_STRUC_T prNoaParam; - CMD_CUSTOM_NOA_PARAM_STRUC_T rCmdNoaParam; - - DEBUGFUNC("wlanoidSetNoaParam"); - DBGLOG(INIT, LOUD,("\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_CUSTOM_NOA_PARAM_STRUC_T); - - if (u4SetBufferLen < sizeof(PARAM_CUSTOM_NOA_PARAM_STRUC_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - - prNoaParam = (P_PARAM_CUSTOM_NOA_PARAM_STRUC_T)pvSetBuffer; - - kalMemZero(&rCmdNoaParam, sizeof(CMD_CUSTOM_NOA_PARAM_STRUC_T)); - rCmdNoaParam.u4NoaDurationMs = prNoaParam->u4NoaDurationMs; - rCmdNoaParam.u4NoaIntervalMs = prNoaParam->u4NoaIntervalMs; - rCmdNoaParam.u4NoaCount = prNoaParam->u4NoaCount; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_NOA_PARAM, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_CUSTOM_NOA_PARAM_STRUC_T), - (PUINT_8)&rCmdNoaParam, - pvSetBuffer, - u4SetBufferLen - ); -} - -WLAN_STATUS -wlanoidSetOppPsParam ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_CUSTOM_OPPPS_PARAM_STRUC_T prOppPsParam; - CMD_CUSTOM_OPPPS_PARAM_STRUC_T rCmdOppPsParam; - - DEBUGFUNC("wlanoidSetOppPsParam"); - DBGLOG(INIT, LOUD,("\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_CUSTOM_OPPPS_PARAM_STRUC_T); - - if (u4SetBufferLen < sizeof(PARAM_CUSTOM_OPPPS_PARAM_STRUC_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - - prOppPsParam = (P_PARAM_CUSTOM_OPPPS_PARAM_STRUC_T)pvSetBuffer; - - kalMemZero(&rCmdOppPsParam, sizeof(CMD_CUSTOM_OPPPS_PARAM_STRUC_T)); - rCmdOppPsParam.u4CTwindowMs = prOppPsParam->u4CTwindowMs; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_OPPPS_PARAM, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_CUSTOM_OPPPS_PARAM_STRUC_T), - (PUINT_8)&rCmdOppPsParam, - pvSetBuffer, - u4SetBufferLen - ); -} - -WLAN_STATUS -wlanoidSetUApsdParam ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_CUSTOM_UAPSD_PARAM_STRUC_T prUapsdParam; - CMD_CUSTOM_UAPSD_PARAM_STRUC_T rCmdUapsdParam; - P_PM_PROFILE_SETUP_INFO_T prPmProfSetupInfo; - P_BSS_INFO_T prBssInfo; - - - DEBUGFUNC("wlanoidSetUApsdParam"); - DBGLOG(INIT, LOUD,("\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_CUSTOM_UAPSD_PARAM_STRUC_T); - - if (u4SetBufferLen < sizeof(PARAM_CUSTOM_UAPSD_PARAM_STRUC_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - prPmProfSetupInfo = &prBssInfo->rPmProfSetupInfo; - - prUapsdParam = (P_PARAM_CUSTOM_UAPSD_PARAM_STRUC_T)pvSetBuffer; - - kalMemZero(&rCmdUapsdParam, sizeof(CMD_CUSTOM_OPPPS_PARAM_STRUC_T)); - rCmdUapsdParam.fgEnAPSD = prUapsdParam->fgEnAPSD; - prAdapter->rWifiVar.fgSupportUAPSD = prUapsdParam->fgEnAPSD; - - rCmdUapsdParam.fgEnAPSD_AcBe = prUapsdParam->fgEnAPSD_AcBe; - rCmdUapsdParam.fgEnAPSD_AcBk = prUapsdParam->fgEnAPSD_AcBk; - rCmdUapsdParam.fgEnAPSD_AcVo = prUapsdParam->fgEnAPSD_AcVo; - rCmdUapsdParam.fgEnAPSD_AcVi = prUapsdParam->fgEnAPSD_AcVi; - prPmProfSetupInfo->ucBmpDeliveryAC = - ((prUapsdParam->fgEnAPSD_AcBe << 0) | - (prUapsdParam->fgEnAPSD_AcBk << 1) | - (prUapsdParam->fgEnAPSD_AcVi << 2) | - (prUapsdParam->fgEnAPSD_AcVo << 3)); - prPmProfSetupInfo->ucBmpTriggerAC = - ((prUapsdParam->fgEnAPSD_AcBe << 0) | - (prUapsdParam->fgEnAPSD_AcBk << 1) | - (prUapsdParam->fgEnAPSD_AcVi << 2) | - (prUapsdParam->fgEnAPSD_AcVo << 3)); - - rCmdUapsdParam.ucMaxSpLen = prUapsdParam->ucMaxSpLen; - prPmProfSetupInfo->ucUapsdSp = prUapsdParam->ucMaxSpLen; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_UAPSD_PARAM, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_CUSTOM_OPPPS_PARAM_STRUC_T), - (PUINT_8)&rCmdUapsdParam, - pvSetBuffer, - u4SetBufferLen - ); -} -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set BT profile or BT information and the -* driver will set the built-in PTA configuration into chip. -* -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetBT ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - - P_PTA_IPC_T prPtaIpc; - - DEBUGFUNC("wlanoidSetBT.\n"); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PTA_IPC_T); - if (u4SetBufferLen != sizeof(PTA_IPC_T)) { - WARNLOG(("Invalid length %ld\n", u4SetBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail to set BT profile because of ACPI_D3\n")); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - ASSERT(pvSetBuffer); - prPtaIpc = (P_PTA_IPC_T)pvSetBuffer; - -#if CFG_SUPPORT_BCM && CFG_SUPPORT_BCM_BWCS && CFG_SUPPORT_BCM_BWCS_DEBUG - printk(KERN_INFO DRV_NAME "BCM BWCS CMD: BWCS CMD = %02x%02x%02x%02x\n", - prPtaIpc->u.aucBTPParams[0], prPtaIpc->u.aucBTPParams[1], prPtaIpc->u.aucBTPParams[2], prPtaIpc->u.aucBTPParams[3]); - - printk(KERN_INFO DRV_NAME "BCM BWCS CMD: aucBTPParams[0] = %02x, aucBTPParams[1] = %02x, aucBTPParams[2] = %02x, aucBTPParams[3] = %02x.\n", - prPtaIpc->u.aucBTPParams[0], - prPtaIpc->u.aucBTPParams[1], - prPtaIpc->u.aucBTPParams[2], - prPtaIpc->u.aucBTPParams[3]); -#endif - - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_BWCS, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(PTA_IPC_T), - (PUINT_8)prPtaIpc, - NULL, - 0); - - return WLAN_STATUS_SUCCESS; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query current BT profile and BTCR values -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvQueryBuffer Pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryBT ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ -// P_PARAM_PTA_IPC_T prPtaIpc; -// UINT_32 u4QueryBuffLen; - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(PTA_IPC_T); - - /* Check for query buffer length */ - if (u4QueryBufferLen != sizeof(PTA_IPC_T)) { - DBGLOG(REQ, WARN, ("Invalid length %lu\n", u4QueryBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvQueryBuffer); -// prPtaIpc = (P_PTA_IPC_T)pvQueryBuffer; -// prPtaIpc->ucCmd = BT_CMD_PROFILE; -// prPtaIpc->ucLen = sizeof(prPtaIpc->u); -// nicPtaGetProfile(prAdapter, (PUINT_8)&prPtaIpc->u, &u4QueryBuffLen); - - return WLAN_STATUS_SUCCESS; -} - -#if 0 -WLAN_STATUS -wlanoidQueryBtSingleAntenna ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - P_PTA_INFO_T prPtaInfo; - PUINT_32 pu4SingleAntenna; - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(UINT_32); - - /* Check for query buffer length */ - if (u4QueryBufferLen != sizeof(UINT_32)) { - DBGLOG(REQ, WARN, ("Invalid length %lu\n", u4QueryBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvQueryBuffer); - - prPtaInfo = &prAdapter->rPtaInfo; - pu4SingleAntenna = (PUINT_32)pvQueryBuffer; - - if(prPtaInfo->fgSingleAntenna) { - //printk(KERN_WARNING DRV_NAME"Q Single Ant = 1\r\n"); - *pu4SingleAntenna = 1; - } else { - //printk(KERN_WARNING DRV_NAME"Q Single Ant = 0\r\n"); - *pu4SingleAntenna = 0; - } - - return WLAN_STATUS_SUCCESS; -} - - -WLAN_STATUS -wlanoidSetBtSingleAntenna ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - - PUINT_32 pu4SingleAntenna; - UINT_32 u4SingleAntenna; - P_PTA_INFO_T prPtaInfo; - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - prPtaInfo = &prAdapter->rPtaInfo; - - *pu4SetInfoLen = sizeof(UINT_32); - if (u4SetBufferLen != sizeof(UINT_32)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - if (IS_ARB_IN_RFTEST_STATE(prAdapter)) { - return WLAN_STATUS_SUCCESS; - } - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail to set antenna because of ACPI_D3\n")); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - ASSERT(pvSetBuffer); - pu4SingleAntenna = (PUINT_32)pvSetBuffer; - u4SingleAntenna = *pu4SingleAntenna; - - if (u4SingleAntenna == 0) { - //printk(KERN_WARNING DRV_NAME"Set Single Ant = 0\r\n"); - prPtaInfo->fgSingleAntenna = FALSE; - } else { - //printk(KERN_WARNING DRV_NAME"Set Single Ant = 1\r\n"); - prPtaInfo->fgSingleAntenna = TRUE; - } - ptaFsmRunEventSetConfig(prAdapter, &prPtaInfo->rPtaParam); - - return WLAN_STATUS_SUCCESS; -} - - -#if CFG_SUPPORT_BCM && CFG_SUPPORT_BCM_BWCS -WLAN_STATUS -wlanoidQueryPta ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - P_PTA_INFO_T prPtaInfo; - PUINT_32 pu4Pta; - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(UINT_32); - - /* Check for query buffer length */ - if (u4QueryBufferLen != sizeof(UINT_32)) { - DBGLOG(REQ, WARN, ("Invalid length %lu\n", u4QueryBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvQueryBuffer); - - prPtaInfo = &prAdapter->rPtaInfo; - pu4Pta = (PUINT_32)pvQueryBuffer; - - if(prPtaInfo->fgEnabled) { - //printk(KERN_WARNING DRV_NAME"PTA = 1\r\n"); - *pu4Pta = 1; - } else { - //printk(KERN_WARNING DRV_NAME"PTA = 0\r\n"); - *pu4Pta = 0; - } - - return WLAN_STATUS_SUCCESS; -} - - -WLAN_STATUS -wlanoidSetPta ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - PUINT_32 pu4PtaCtrl; - UINT_32 u4PtaCtrl; - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(UINT_32); - if (u4SetBufferLen != sizeof(UINT_32)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - if (IS_ARB_IN_RFTEST_STATE(prAdapter)) { - return WLAN_STATUS_SUCCESS; - } - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail to set BT setting because of ACPI_D3\n")); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - ASSERT(pvSetBuffer); - pu4PtaCtrl = (PUINT_32)pvSetBuffer; - u4PtaCtrl = *pu4PtaCtrl; - - if (u4PtaCtrl == 0) { - //printk(KERN_WARNING DRV_NAME"Set Pta= 0\r\n"); - nicPtaSetFunc(prAdapter, FALSE); - } else { - //printk(KERN_WARNING DRV_NAME"Set Pta= 1\r\n"); - nicPtaSetFunc(prAdapter, TRUE); - } - - return WLAN_STATUS_SUCCESS; -} -#endif - -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set Tx power profile. -* -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetTxPower ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - //P_SET_TXPWR_CTRL_T pTxPwr = (P_SET_TXPWR_CTRL_T)pvSetBuffer; - //UINT_32 i; - WLAN_STATUS rStatus; - - DEBUGFUNC("wlanoidSetTxPower"); - DBGLOG(REQ, LOUD, ("\r\n")); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - -#if 0 - printk("c2GLegacyStaPwrOffset=%d\n", pTxPwr->c2GLegacyStaPwrOffset); - printk("c2GHotspotPwrOffset=%d\n", pTxPwr->c2GHotspotPwrOffset); - printk("c2GP2pPwrOffset=%d\n", pTxPwr->c2GP2pPwrOffset); - printk("c2GBowPwrOffset=%d\n", pTxPwr->c2GBowPwrOffset); - printk("c5GLegacyStaPwrOffset=%d\n", pTxPwr->c5GLegacyStaPwrOffset); - printk("c5GHotspotPwrOffset=%d\n", pTxPwr->c5GHotspotPwrOffset); - printk("c5GP2pPwrOffset=%d\n", pTxPwr->c5GP2pPwrOffset); - printk("c5GBowPwrOffset=%d\n", pTxPwr->c5GBowPwrOffset); - printk("ucConcurrencePolicy=%d\n", pTxPwr->ucConcurrencePolicy); - - for (i=0; i<14;i++) - printk("acTxPwrLimit2G[%d]=%d\n", i, pTxPwr->acTxPwrLimit2G[i]); - - for (i=0; i<4;i++) - printk("acTxPwrLimit5G[%d]=%d\n", i, pTxPwr->acTxPwrLimit5G[i]); -#endif - - rStatus = wlanSendSetQueryCmd ( - prAdapter, /* prAdapter */ - CMD_ID_SET_TXPWR_CTRL, /* ucCID */ - TRUE, /* fgSetQuery */ - FALSE, /* fgNeedResp */ - TRUE, /* fgIsOid */ - NULL, /* pfCmdDoneHandler*/ - NULL, /* pfCmdTimeoutHandler */ - u4SetBufferLen, /* u4SetQueryInfoLen */ - (PUINT_8) pvSetBuffer, /* pucInfoBuffer */ - NULL, /* pvSetQueryBuffer */ - 0 /* u4SetQueryBufferLen */ - ); - - ASSERT(rStatus == WLAN_STATUS_PENDING); - - return rStatus; - -} - -WLAN_STATUS -wlanSendMemDumpCmd ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen - ) -{ - P_PARAM_CUSTOM_MEM_DUMP_STRUC_T prMemDumpInfo; - P_CMD_DUMP_MEM prCmdDumpMem; - CMD_DUMP_MEM rCmdDumpMem; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4MemSize = PARAM_MEM_DUMP_MAX_SIZE; - - UINT_32 u4RemainLeng = 0; - UINT_32 u4CurAddr = 0; - UINT_8 ucFragNum = 0; - - prCmdDumpMem = &rCmdDumpMem; - prMemDumpInfo = (P_PARAM_CUSTOM_MEM_DUMP_STRUC_T)pvQueryBuffer; - - u4RemainLeng = prMemDumpInfo->u4RemainLength; - u4CurAddr = prMemDumpInfo->u4Address + prMemDumpInfo->u4Length; - ucFragNum = prMemDumpInfo->ucFragNum + 1; - - /* Query. If request length is larger than max length, do it as ping pong. - * Send a command and wait for a event. Send next command while the event is received. - * - */ - do{ - UINT_32 u4CurLeng = 0; - - if(u4RemainLeng > u4MemSize) { - u4CurLeng = u4MemSize; - u4RemainLeng -= u4MemSize; - } else { - u4CurLeng = u4RemainLeng; - u4RemainLeng = 0; - } - - prCmdDumpMem->u4Address = u4CurAddr; - prCmdDumpMem->u4Length = u4CurLeng; - prCmdDumpMem->u4RemainLength = u4RemainLeng; - prCmdDumpMem->ucFragNum = ucFragNum; - - DBGLOG(REQ, TRACE, ("[%d] 0x%X, len %d, remain len %d\n", - ucFragNum, - prCmdDumpMem->u4Address, - prCmdDumpMem->u4Length, - prCmdDumpMem->u4RemainLength)); - - rStatus = wlanSendSetQueryCmd(prAdapter, - CMD_ID_DUMP_MEM, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryMemDump, - nicOidCmdTimeoutCommon, - sizeof(CMD_DUMP_MEM), - (PUINT_8)prCmdDumpMem, - pvQueryBuffer, - u4QueryBufferLen - ); - - }while(FALSE); - - return rStatus; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to dump memory. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuf A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryMemDump ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - P_PARAM_CUSTOM_MEM_DUMP_STRUC_T prMemDumpInfo; - - DEBUGFUNC("wlanoidQueryMemDump"); - DBGLOG(INIT, LOUD,("\n")); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(UINT_32); - - prMemDumpInfo = (P_PARAM_CUSTOM_MEM_DUMP_STRUC_T)pvQueryBuffer; - DBGLOG(REQ, TRACE, ("Dump 0x%X, len %d\n", prMemDumpInfo->u4Address, prMemDumpInfo->u4Length)); - - prMemDumpInfo->u4RemainLength = prMemDumpInfo->u4Length; - prMemDumpInfo->u4Length = 0; - prMemDumpInfo->ucFragNum = 0; - - return wlanSendMemDumpCmd( - prAdapter, - pvQueryBuffer, - u4QueryBufferLen); - -} /* end of wlanoidQueryMcrRead() */ - - -#if CFG_ENABLE_WIFI_DIRECT -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to set the p2p mode. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetP2pMode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS status; - P_PARAM_CUSTOM_P2P_SET_STRUC_T prSetP2P = (P_PARAM_CUSTOM_P2P_SET_STRUC_T)NULL; - //P_MSG_P2P_NETDEV_REGISTER_T prP2pNetdevRegMsg = (P_MSG_P2P_NETDEV_REGISTER_T)NULL; - DEBUGFUNC("wlanoidSetP2pMode"); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_CUSTOM_P2P_SET_STRUC_T); - if (u4SetBufferLen < sizeof(PARAM_CUSTOM_P2P_SET_STRUC_T)) { - DBGLOG(REQ, WARN, ("Invalid length %ld\n", u4SetBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - - prSetP2P = (P_PARAM_CUSTOM_P2P_SET_STRUC_T) pvSetBuffer; - - printk("Set P2P enable[%ld] mode[%ld]\n", prSetP2P->u4Enable, prSetP2P->u4Mode); - - /* - * enable = 1, mode = 0 => init P2P network - * enable = 1, mode = 1 => init Soft AP network - * enable = 0 => uninit P2P/AP network - */ - - if (prSetP2P->u4Enable) { - p2pSetMode((prSetP2P->u4Mode == 1)?TRUE:FALSE); - - if (p2pLaunch(prAdapter->prGlueInfo)) { - ASSERT(prAdapter->fgIsP2PRegistered); - } - - } - else { - if (prAdapter->fgIsP2PRegistered) { - p2pRemove(prAdapter->prGlueInfo); - } - - } - - -#if 0 - prP2pNetdevRegMsg = (P_MSG_P2P_NETDEV_REGISTER_T)cnmMemAlloc( - prAdapter, - RAM_TYPE_MSG, - (sizeof(MSG_P2P_NETDEV_REGISTER_T))); - - if (prP2pNetdevRegMsg == NULL) { - ASSERT(FALSE); - status = WLAN_STATUS_RESOURCES; - return status; - } - - - prP2pNetdevRegMsg->rMsgHdr.eMsgId = MID_MNY_P2P_NET_DEV_REGISTER; - prP2pNetdevRegMsg->fgIsEnable = (prSetP2P->u4Enable == 1)?TRUE:FALSE; - prP2pNetdevRegMsg->ucMode = (UINT_8)prSetP2P->u4Mode; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prP2pNetdevRegMsg, - MSG_SEND_METHOD_BUF); -#endif - - return status; - -} -#endif - - diff --git a/drivers/net/wireless/mt5931/common/wlan_p2p.c b/drivers/net/wireless/mt5931/common/wlan_p2p.c deleted file mode 100755 index be51207a7f16..000000000000 --- a/drivers/net/wireless/mt5931/common/wlan_p2p.c +++ /dev/null @@ -1,1811 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/common/wlan_p2p.c#8 $ -*/ - -/*! \file wlan_bow.c - \brief This file contains the Wi-Fi Direct commands processing routines for - MediaTek Inc. 802.11 Wireless LAN Adapters. -*/ - - - -/* -** $Log: wlan_p2p.c $ - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 11 24 2011 yuche.tsai - * NULL - * Fix P2P IOCTL of multicast address bug, add low power driver stop control. - * - * 11 22 2011 yuche.tsai - * NULL - * Update RSSI link quality of P2P Network query method. (Bug fix) - * - * 11 19 2011 yuche.tsai - * NULL - * Add RSSI support for P2P network. - * - * 11 08 2011 yuche.tsai - * [WCXRP00001094] [Volunteer Patch][Driver] Driver version & supplicant version query & set support for service discovery version check. - * Add support for driver version query & p2p supplicant verseion set. - * For new service discovery mechanism sync. - * - * 10 18 2011 yuche.tsai - * [WCXRP00001045] [WiFi Direct][Driver] Check 2.1 branch. - * Support Channle Query. - * - * 10 18 2011 yuche.tsai - * [WCXRP00001045] [WiFi Direct][Driver] Check 2.1 branch. - * New 2.1 branch - - * - * 08 23 2011 yuche.tsai - * NULL - * Fix Multicast Issue of P2P. - * - * 04 27 2011 george.huang - * [WCXRP00000684] [MT6620 Wi-Fi][Driver] Support P2P setting ARP filter - * Support P2P ARP filter setting on early suspend/ late resume - * - * 04 08 2011 george.huang - * [WCXRP00000621] [MT6620 Wi-Fi][Driver] Support P2P supplicant to set power mode - * separate settings of P2P and AIS - * - * 03 22 2011 george.huang - * [WCXRP00000504] [MT6620 Wi-Fi][FW] Support Sigma CAPI for power saving related command - * link with supplicant commands - * - * 03 17 2011 wh.su - * [WCXRP00000571] [MT6620 Wi-Fi] [Driver] Not check the p2p role during set key - * Skip the p2p role for adding broadcast key issue. - * - * 03 16 2011 wh.su - * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done - * fixed compiling error while enable dbg. - * - * 03 08 2011 yuche.tsai - * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue[WCXRP00000509] [Volunteer Patch][MT6620][Driver] Kernal panic when remove p2p module. - * . - * - * 03 07 2011 terry.wu - * [WCXRP00000521] [MT6620 Wi-Fi][Driver] Remove non-standard debug message - * Toggle non-standard debug messages to comments. - * - * 03 07 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * rename the define to anti_pviracy. - * - * 03 05 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * add the code to get the check rsponse and indicate to app. - * - * 03 02 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * Add Security check related code. - * - * 03 02 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Fix SD Request Query Length issue. - * - * 03 02 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Service Discovery Request. - * - * 03 01 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Update Service Discovery Wlan OID related function. - * - * 03 01 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Update Service Discovery Related wlanoid function. - * - * 02 09 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Add Service Discovery Indication Related code. - * - * 01 26 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Add Service Discovery Function. - * - * 01 05 2011 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * ioctl implementations for P2P Service Discovery - * - * 01 04 2011 cp.wu - * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands - * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure - * - * 12 22 2010 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * 1. header file restructure for more clear module isolation - * 2. add function interface definition for implementing Service Discovery callbacks - * - * 10 04 2010 cp.wu - * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by ENUM_NETWORK_TYPE_INDEX_T only - * remove ENUM_NETWORK_TYPE_T definitions - * - * 09 28 2010 wh.su - * NULL - * [WCXRP00000069][MT6620 Wi-Fi][Driver] Fix some code for phase 1 P2P Demo. - * - * 09 21 2010 kevin.huang - * [WCXRP00000054] [MT6620 Wi-Fi][Driver] Restructure driver for second Interface - * Isolate P2P related function for Hardware Software Bundle - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 23 2010 cp.wu - * NULL - * revise constant definitions to be matched with implementation (original cmd-event definition is deprecated) - * - * 08 16 2010 cp.wu - * NULL - * add subroutines for P2P to set multicast list. - * - * 08 16 2010 george.huang - * NULL - * . - * - * 08 16 2010 george.huang - * NULL - * support wlanoidSetP2pPowerSaveProfile() in P2P - * - * 08 16 2010 george.huang - * NULL - * Support wlanoidSetNetworkAddress() for P2P - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 25 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add API in que_mgt to retrieve sta-rec index for security frames. - * - * 06 24 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 802.1x and bluetooth-over-Wi-Fi security frames are now delievered to firmware via command path instead of data path. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * 1) add timeout handler mechanism for pending command packets - * 2) add p2p add/removal key - * -** -*/ - -/****************************************************************************** -* C O M P I L E R F L A G S -******************************************************************************* -*/ - -/****************************************************************************** -* E X T E R N A L R E F E R E N C E S -******************************************************************************* -*/ -#include "precomp.h" - -/****************************************************************************** -* C O N S T A N T S -******************************************************************************* -*/ - -/****************************************************************************** -* D A T A T Y P E S -******************************************************************************* -*/ - -/****************************************************************************** -* P U B L I C D A T A -******************************************************************************* -*/ - -/****************************************************************************** -* P R I V A T E D A T A -******************************************************************************* -*/ - -/****************************************************************************** -* M A C R O S -******************************************************************************* -*/ - -/****************************************************************************** -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************* -*/ - -/****************************************************************************** -* F U N C T I O N S -******************************************************************************* -*/ -/*----------------------------------------------------------------------------*/ -/*! -* \brief command packet generation utility -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] ucCID Command ID -* \param[in] fgSetQuery Set or Query -* \param[in] fgNeedResp Need for response -* \param[in] pfCmdDoneHandler Function pointer when command is done -* \param[in] u4SetQueryInfoLen The length of the set/query buffer -* \param[in] pucInfoBuffer Pointer to set/query buffer -* -* -* \retval WLAN_STATUS_PENDING -* \retval WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSendSetQueryP2PCmd ( - IN P_ADAPTER_T prAdapter, - UINT_8 ucCID, - BOOLEAN fgSetQuery, - BOOLEAN fgNeedResp, - BOOLEAN fgIsOid, - PFN_CMD_DONE_HANDLER pfCmdDoneHandler, - PFN_CMD_TIMEOUT_HANDLER pfCmdTimeoutHandler, - UINT_32 u4SetQueryInfoLen, - PUINT_8 pucInfoBuffer, - OUT PVOID pvSetQueryBuffer, - IN UINT_32 u4SetQueryBufferLen - ) -{ - P_GLUE_INFO_T prGlueInfo; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - UINT_8 ucCmdSeqNum; - - ASSERT(prAdapter); - - prGlueInfo = prAdapter->prGlueInfo; - ASSERT(prGlueInfo); - - DEBUGFUNC("wlanoidSendSetQueryP2PCmd"); - DBGLOG(REQ, TRACE, ("Command ID = 0x%08X\n", ucCID)); - - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, (CMD_HDR_SIZE + u4SetQueryInfoLen)); - - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - DBGLOG(REQ, TRACE, ("ucCmdSeqNum =%d\n", ucCmdSeqNum)); - - // Setup common CMD Info Packet - prCmdInfo->eCmdType = COMMAND_TYPE_NETWORK_IOCTL; - prCmdInfo->eNetworkType = NETWORK_TYPE_P2P_INDEX; - prCmdInfo->u2InfoBufLen = (UINT_16)(CMD_HDR_SIZE + u4SetQueryInfoLen); - prCmdInfo->pfCmdDoneHandler = pfCmdDoneHandler; - prCmdInfo->pfCmdTimeoutHandler = pfCmdTimeoutHandler; - prCmdInfo->fgIsOid = fgIsOid; - prCmdInfo->ucCID = ucCID; - prCmdInfo->fgSetQuery = fgSetQuery; - prCmdInfo->fgNeedResp = fgNeedResp; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = u4SetQueryInfoLen; - prCmdInfo->pvInformationBuffer = pvSetQueryBuffer; - prCmdInfo->u4InformationBufferLength = u4SetQueryBufferLen; - - // Setup WIFI_CMD_T (no payload) - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - if(u4SetQueryInfoLen > 0 && pucInfoBuffer != NULL) { - kalMemCopy(prWifiCmd->aucBuffer, pucInfoBuffer, u4SetQueryInfoLen); - } - - // insert into prCmdQueue - kalEnqueueCommand(prGlueInfo, (P_QUE_ENTRY_T)prCmdInfo); - - // wakeup txServiceThread later - GLUE_SET_EVENT(prGlueInfo); - return WLAN_STATUS_PENDING; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set a key to Wi-Fi Direct driver -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_INVALID_DATA -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetAddP2PKey( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - CMD_802_11_KEY rCmdKey; - P_PARAM_KEY_T prNewKey; - - DEBUGFUNC("wlanoidSetAddP2PKey"); - DBGLOG(REQ, INFO, ("\n")); - - ASSERT(prAdapter); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - prNewKey = (P_PARAM_KEY_T) pvSetBuffer; - - /* Verify the key structure length. */ - if (prNewKey->u4Length > u4SetBufferLen) { - DBGLOG(REQ, WARN, ("Invalid key structure length (%d) greater than total buffer length (%d)\n", - (UINT_8)prNewKey->u4Length, - (UINT_8)u4SetBufferLen)); - - *pu4SetInfoLen = u4SetBufferLen; - return WLAN_STATUS_INVALID_LENGTH; - } - /* Verify the key material length for key material buffer */ - else if (prNewKey->u4KeyLength > prNewKey->u4Length - OFFSET_OF(PARAM_KEY_T, aucKeyMaterial)) { - DBGLOG(REQ, WARN, ("Invalid key material length (%d)\n", (UINT_8)prNewKey->u4KeyLength)); - *pu4SetInfoLen = u4SetBufferLen; - return WLAN_STATUS_INVALID_DATA; - } - /* Exception check */ - else if (prNewKey->u4KeyIndex & 0x0fffff00) { - return WLAN_STATUS_INVALID_DATA; - } - /* Exception check, pairwise key must with transmit bit enabled */ - else if ((prNewKey->u4KeyIndex & BITS(30,31)) == IS_UNICAST_KEY) { - return WLAN_STATUS_INVALID_DATA; - } - else if (!(prNewKey->u4KeyLength == CCMP_KEY_LEN) && !(prNewKey->u4KeyLength == TKIP_KEY_LEN)) { - return WLAN_STATUS_INVALID_DATA; - } - /* Exception check, pairwise key must with transmit bit enabled */ - else if ((prNewKey->u4KeyIndex & BITS(30,31)) == BITS(30,31)) { - if (((prNewKey->u4KeyIndex & 0xff) != 0) || - ((prNewKey->arBSSID[0] == 0xff) && (prNewKey->arBSSID[1] == 0xff) && (prNewKey->arBSSID[2] == 0xff) && - (prNewKey->arBSSID[3] == 0xff) && (prNewKey->arBSSID[4] == 0xff) && (prNewKey->arBSSID[5] == 0xff))) { - return WLAN_STATUS_INVALID_DATA; - } - } - - *pu4SetInfoLen = u4SetBufferLen; - - // fill CMD_802_11_KEY - kalMemZero(&rCmdKey, sizeof(CMD_802_11_KEY)); - rCmdKey.ucAddRemove = 1; /* add */ - rCmdKey.ucTxKey = ((prNewKey->u4KeyIndex & IS_TRANSMIT_KEY) == IS_TRANSMIT_KEY) ? 1 : 0; - rCmdKey.ucKeyType = ((prNewKey->u4KeyIndex & IS_UNICAST_KEY) == IS_UNICAST_KEY) ? 1 : 0; - if(kalP2PGetRole(prAdapter->prGlueInfo) == 1) { /* group client */ - rCmdKey.ucIsAuthenticator = 0; - } - else { /* group owner */ - rCmdKey.ucIsAuthenticator = 1; - } - COPY_MAC_ADDR(rCmdKey.aucPeerAddr, prNewKey->arBSSID); - rCmdKey.ucNetType = NETWORK_TYPE_P2P_INDEX; - if(prNewKey->u4KeyLength == CCMP_KEY_LEN) - rCmdKey.ucAlgorithmId = CIPHER_SUITE_CCMP; // AES - else if(prNewKey->u4KeyLength == TKIP_KEY_LEN) - rCmdKey.ucAlgorithmId = CIPHER_SUITE_TKIP; // TKIP - rCmdKey.ucKeyId = (UINT_8)(prNewKey->u4KeyIndex & 0xff); - rCmdKey.ucKeyLen = (UINT_8)prNewKey->u4KeyLength; - kalMemCopy(rCmdKey.aucKeyMaterial, (PUINT_8)prNewKey->aucKeyMaterial, rCmdKey.ucKeyLen); - - return wlanoidSendSetQueryP2PCmd(prAdapter, - CMD_ID_ADD_REMOVE_KEY, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - NULL, - sizeof(CMD_802_11_KEY), - (PUINT_8)&rCmdKey, - pvSetBuffer, - u4SetBufferLen - ); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to request Wi-Fi Direct driver to remove keys -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_DATA -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_INVALID_DATA -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetRemoveP2PKey( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - CMD_802_11_KEY rCmdKey; - P_PARAM_REMOVE_KEY_T prRemovedKey; - - DEBUGFUNC("wlanoidSetRemoveP2PKey"); - ASSERT(prAdapter); - - if (u4SetBufferLen < sizeof(PARAM_REMOVE_KEY_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - prRemovedKey = (P_PARAM_REMOVE_KEY_T)pvSetBuffer; - - /* Check bit 31: this bit should always 0 */ - if (prRemovedKey->u4KeyIndex & IS_TRANSMIT_KEY) { - /* Bit 31 should not be set */ - DBGLOG(REQ, ERROR, ("invalid key index: 0x%08lx\n", - prRemovedKey->u4KeyIndex)); - return WLAN_STATUS_INVALID_DATA; - } - - /* Check bits 8 ~ 29 should always be 0 */ - if (prRemovedKey->u4KeyIndex & BITS(8, 29)) { - /* Bit 31 should not be set */ - DBGLOG(REQ, ERROR, ("invalid key index: 0x%08lx\n", - prRemovedKey->u4KeyIndex)); - return WLAN_STATUS_INVALID_DATA; - } - - /* There should not be any key operation for P2P Device */ - if(kalP2PGetRole(prAdapter->prGlueInfo) == 0) { - // return WLAN_STATUS_NOT_ACCEPTED; - } - - kalMemZero((PUINT_8)&rCmdKey, sizeof(CMD_802_11_KEY)); - - rCmdKey.ucAddRemove = 0; // remove - if(kalP2PGetRole(prAdapter->prGlueInfo) == 1) { /* group client */ - rCmdKey.ucIsAuthenticator = 0; - } - else { /* group owner */ - rCmdKey.ucIsAuthenticator = 1; - } - kalMemCopy(rCmdKey.aucPeerAddr, (PUINT_8)prRemovedKey->arBSSID, MAC_ADDR_LEN); - rCmdKey.ucNetType = NETWORK_TYPE_P2P_INDEX; - rCmdKey.ucKeyId = (UINT_8)(prRemovedKey->u4KeyIndex & 0x000000ff); - - return wlanoidSendSetQueryP2PCmd(prAdapter, - CMD_ID_ADD_REMOVE_KEY, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - NULL, - sizeof(CMD_802_11_KEY), - (PUINT_8)&rCmdKey, - pvSetBuffer, - u4SetBufferLen - ); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Setting the IP address for pattern search function. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \return WLAN_STATUS_SUCCESS -* \return WLAN_STATUS_ADAPTER_NOT_READY -* \return WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetP2pNetworkAddress( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 i, j; - P_CMD_SET_NETWORK_ADDRESS_LIST prCmdNetworkAddressList; - P_PARAM_NETWORK_ADDRESS_LIST prNetworkAddressList = (P_PARAM_NETWORK_ADDRESS_LIST)pvSetBuffer; - P_PARAM_NETWORK_ADDRESS prNetworkAddress; - P_PARAM_NETWORK_ADDRESS_IP prNetAddrIp; - UINT_32 u4IpAddressCount, u4CmdSize; - - DEBUGFUNC("wlanoidSetP2pNetworkAddress"); - DBGLOG(INIT, TRACE, ("\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = 4; - - if (u4SetBufferLen < sizeof(PARAM_NETWORK_ADDRESS_LIST)) { - return WLAN_STATUS_INVALID_DATA; - } - - *pu4SetInfoLen = 0; - u4IpAddressCount = 0; - - prNetworkAddress = prNetworkAddressList->arAddress; - for ( i = 0 ; i < prNetworkAddressList->u4AddressCount ; i++) { - if (prNetworkAddress->u2AddressType == PARAM_PROTOCOL_ID_TCP_IP && - prNetworkAddress->u2AddressLength == sizeof(PARAM_NETWORK_ADDRESS_IP)) { - u4IpAddressCount++; - } - - prNetworkAddress = (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prNetworkAddress + - (UINT_32) (prNetworkAddress->u2AddressLength + OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress))); - } - - // construct payload of command packet - u4CmdSize = OFFSET_OF(CMD_SET_NETWORK_ADDRESS_LIST, arNetAddress) + - sizeof(IPV4_NETWORK_ADDRESS) * u4IpAddressCount; - - prCmdNetworkAddressList = (P_CMD_SET_NETWORK_ADDRESS_LIST) kalMemAlloc(u4CmdSize, VIR_MEM_TYPE); - - if(prCmdNetworkAddressList == NULL) - return WLAN_STATUS_FAILURE; - - // fill P_CMD_SET_NETWORK_ADDRESS_LIST - prCmdNetworkAddressList->ucNetTypeIndex = NETWORK_TYPE_P2P_INDEX; - prCmdNetworkAddressList->ucAddressCount = (UINT_8)u4IpAddressCount; - prNetworkAddress = prNetworkAddressList->arAddress; - for (i = 0, j = 0 ; i < prNetworkAddressList->u4AddressCount ; i++) { - if (prNetworkAddress->u2AddressType == PARAM_PROTOCOL_ID_TCP_IP && - prNetworkAddress->u2AddressLength == sizeof(PARAM_NETWORK_ADDRESS_IP)) { - prNetAddrIp = (P_PARAM_NETWORK_ADDRESS_IP)prNetworkAddress->aucAddress; - - kalMemCopy(prCmdNetworkAddressList->arNetAddress[j].aucIpAddr, - &(prNetAddrIp->in_addr), - sizeof(UINT_32)); - - j++; - } - - prNetworkAddress = (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prNetworkAddress + - (UINT_32) (prNetworkAddress->u2AddressLength + OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress))); - } - - rStatus = wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_IP_ADDRESS, - TRUE, - FALSE, - TRUE, - nicCmdEventSetIpAddress, - nicOidCmdTimeoutCommon, - u4CmdSize, - (PUINT_8)prCmdNetworkAddressList, - pvSetBuffer, - u4SetBufferLen - ); - - kalMemFree(prCmdNetworkAddressList, VIR_MEM_TYPE, u4CmdSize); - return rStatus; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to query the power save profile. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuf A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \return WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidQueryP2pPowerSaveProfile ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryP2pPowerSaveProfile"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - - if (u4QueryBufferLen!=0) { - ASSERT(pvQueryBuffer); - - *(PPARAM_POWER_MODE) pvQueryBuffer = (PARAM_POWER_MODE)(prAdapter->rWlanInfo.arPowerSaveMode[NETWORK_TYPE_P2P_INDEX].ucPsProfile); - *pu4QueryInfoLen = sizeof(PARAM_POWER_MODE); - } - - return WLAN_STATUS_SUCCESS; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to set the power save profile. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetP2pPowerSaveProfile ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS status; - PARAM_POWER_MODE ePowerMode; - DEBUGFUNC("wlanoidSetP2pPowerSaveProfile"); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_POWER_MODE); - if (u4SetBufferLen < sizeof(PARAM_POWER_MODE)) { - DBGLOG(REQ, WARN, ("Invalid length %ld\n", u4SetBufferLen)); - return WLAN_STATUS_INVALID_LENGTH; - } - else if (*(PPARAM_POWER_MODE) pvSetBuffer >= Param_PowerModeMax) { - WARNLOG(("Invalid power mode %d\n", - *(PPARAM_POWER_MODE) pvSetBuffer)); - return WLAN_STATUS_INVALID_DATA; - } - - ePowerMode = *(PPARAM_POWER_MODE) pvSetBuffer; - - if (prAdapter->fgEnCtiaPowerMode) { - if (ePowerMode == Param_PowerModeCAM) { - - } else { - // User setting to PS mode (Param_PowerModeMAX_PSP or Param_PowerModeFast_PSP) - - if (prAdapter->u4CtiaPowerMode == 0) { - // force to keep in CAM mode - ePowerMode = Param_PowerModeCAM; - } else if (prAdapter->u4CtiaPowerMode == 1) { - ePowerMode = Param_PowerModeMAX_PSP; - } else if (prAdapter->u4CtiaPowerMode == 2) { - ePowerMode = Param_PowerModeFast_PSP; - } - } - } - - status = nicConfigPowerSaveProfile( - prAdapter, - NETWORK_TYPE_P2P_INDEX, - ePowerMode, - TRUE); - return status; -} /* end of wlanoidSetP2pPowerSaveProfile() */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to set the power save profile. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetP2pSetNetworkAddress ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 i, j; - P_CMD_SET_NETWORK_ADDRESS_LIST prCmdNetworkAddressList; - P_PARAM_NETWORK_ADDRESS_LIST prNetworkAddressList = (P_PARAM_NETWORK_ADDRESS_LIST)pvSetBuffer; - P_PARAM_NETWORK_ADDRESS prNetworkAddress; - P_PARAM_NETWORK_ADDRESS_IP prNetAddrIp; - UINT_32 u4IpAddressCount, u4CmdSize; - PUINT_8 pucBuf = (PUINT_8)pvSetBuffer; - - DEBUGFUNC("wlanoidSetP2pSetNetworkAddress"); - DBGLOG(INIT, TRACE, ("\n")); - printk("wlanoidSetP2pSetNetworkAddress (%d)\n", (INT_16)u4SetBufferLen); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = 4; - - if (u4SetBufferLen < sizeof(PARAM_NETWORK_ADDRESS_LIST)) { - return WLAN_STATUS_INVALID_DATA; - } - - *pu4SetInfoLen = 0; - u4IpAddressCount = 0; - - prNetworkAddress = prNetworkAddressList->arAddress; - for ( i = 0 ; i < prNetworkAddressList->u4AddressCount ; i++) { - if (prNetworkAddress->u2AddressType == PARAM_PROTOCOL_ID_TCP_IP && - prNetworkAddress->u2AddressLength == sizeof(PARAM_NETWORK_ADDRESS_IP)) { - u4IpAddressCount++; - } - - prNetworkAddress = (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prNetworkAddress + - (UINT_32) (prNetworkAddress->u2AddressLength + OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress))); - } - - // construct payload of command packet - u4CmdSize = OFFSET_OF(CMD_SET_NETWORK_ADDRESS_LIST, arNetAddress) + - sizeof(IPV4_NETWORK_ADDRESS) * u4IpAddressCount; - - if (u4IpAddressCount == 0) { - u4CmdSize = sizeof(CMD_SET_NETWORK_ADDRESS_LIST); - } - - prCmdNetworkAddressList = (P_CMD_SET_NETWORK_ADDRESS_LIST) kalMemAlloc(u4CmdSize, VIR_MEM_TYPE); - - if(prCmdNetworkAddressList == NULL) - return WLAN_STATUS_FAILURE; - - // fill P_CMD_SET_NETWORK_ADDRESS_LIST - prCmdNetworkAddressList->ucNetTypeIndex = NETWORK_TYPE_P2P_INDEX; - - /* only to set IP address to FW once ARP filter is enabled */ - if (prAdapter->fgEnArpFilter) { - prCmdNetworkAddressList->ucAddressCount = (UINT_8)u4IpAddressCount; - prNetworkAddress = prNetworkAddressList->arAddress; - - printk("u4IpAddressCount (%ld) \n", (INT_32)u4IpAddressCount); - for (i = 0, j = 0 ; i < prNetworkAddressList->u4AddressCount ; i++) { - if (prNetworkAddress->u2AddressType == PARAM_PROTOCOL_ID_TCP_IP && - prNetworkAddress->u2AddressLength == sizeof(PARAM_NETWORK_ADDRESS_IP)) { - prNetAddrIp = (P_PARAM_NETWORK_ADDRESS_IP)prNetworkAddress->aucAddress; - - kalMemCopy(prCmdNetworkAddressList->arNetAddress[j].aucIpAddr, - &(prNetAddrIp->in_addr), - sizeof(UINT_32)); - - j++; - - pucBuf = (PUINT_8)&prNetAddrIp->in_addr; - printk("prNetAddrIp->in_addr:%d:%d:%d:%d\n", (UINT_8)pucBuf[0], (UINT_8)pucBuf[1], (UINT_8)pucBuf[2], (UINT_8)pucBuf[3]); - } - - prNetworkAddress = (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prNetworkAddress + - (UINT_32) (prNetworkAddress->u2AddressLength + OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress))); - } - - } else { - prCmdNetworkAddressList->ucAddressCount = 0; - } - - rStatus = wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_IP_ADDRESS, - TRUE, - FALSE, - TRUE, - nicCmdEventSetIpAddress, - nicOidCmdTimeoutCommon, - u4CmdSize, - (PUINT_8)prCmdNetworkAddressList, - pvSetBuffer, - u4SetBufferLen - ); - - kalMemFree(prCmdNetworkAddressList, VIR_MEM_TYPE, u4CmdSize); - return rStatus; -} /* end of wlanoidSetP2pSetNetworkAddress() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set Multicast Address List. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_MULTICAST_FULL -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetP2PMulticastList( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - CMD_MAC_MCAST_ADDR rCmdMacMcastAddr; - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - /* The data must be a multiple of the Ethernet address size. */ - if ((u4SetBufferLen % MAC_ADDR_LEN)) { - DBGLOG(REQ, WARN, ("Invalid MC list length %ld\n", u4SetBufferLen)); - - *pu4SetInfoLen = (((u4SetBufferLen + MAC_ADDR_LEN) - 1) / - MAC_ADDR_LEN) * MAC_ADDR_LEN; - - return WLAN_STATUS_INVALID_LENGTH; - } - - *pu4SetInfoLen = u4SetBufferLen; - - /* Verify if we can support so many multicast addresses. */ - if ((u4SetBufferLen / MAC_ADDR_LEN) > MAX_NUM_GROUP_ADDR) { - DBGLOG(REQ, WARN, ("Too many MC addresses\n")); - - return WLAN_STATUS_MULTICAST_FULL; - } - - /* NOTE(Kevin): Windows may set u4SetBufferLen == 0 && - * pvSetBuffer == NULL to clear exist Multicast List. - */ - if (u4SetBufferLen) { - ASSERT(pvSetBuffer); - } - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set multicast list! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - rCmdMacMcastAddr.u4NumOfGroupAddr = u4SetBufferLen / MAC_ADDR_LEN; - rCmdMacMcastAddr.ucNetTypeIndex = NETWORK_TYPE_P2P_INDEX; - kalMemCopy(rCmdMacMcastAddr.arAddress, pvSetBuffer, u4SetBufferLen); - - return wlanoidSendSetQueryP2PCmd(prAdapter, - CMD_ID_MAC_MCAST_ADDR, - TRUE, - FALSE, - FALSE, // This CMD response is no need to complete the OID. Or the event would unsync. - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_MAC_MCAST_ADDR), - (PUINT_8)&rCmdMacMcastAddr, - pvSetBuffer, - u4SetBufferLen - ); - -} /* end of wlanoidSetP2PMulticastList() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to send GAS frame for P2P Service Discovery Request -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_MULTICAST_FULL -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSendP2PSDRequest( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - if (u4SetBufferLen) { - ASSERT(pvSetBuffer); - } - - if (u4SetBufferLen < sizeof(PARAM_P2P_SEND_SD_REQUEST)) { - *pu4SetInfoLen = sizeof(PARAM_P2P_SEND_SD_REQUEST); - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - -// rWlanStatus = p2pFsmRunEventSDRequest(prAdapter, (P_PARAM_P2P_SEND_SD_REQUEST)pvSetBuffer); - - return rWlanStatus; -} /* end of wlanoidSendP2PSDRequest() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to send GAS frame for P2P Service Discovery Response -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_MULTICAST_FULL -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSendP2PSDResponse( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - if (u4SetBufferLen) { - ASSERT(pvSetBuffer); - } - - if (u4SetBufferLen < sizeof(PARAM_P2P_SEND_SD_RESPONSE)) { - *pu4SetInfoLen = sizeof(PARAM_P2P_SEND_SD_RESPONSE); - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - -// rWlanStatus = p2pFsmRunEventSDResponse(prAdapter, (P_PARAM_P2P_SEND_SD_RESPONSE)pvSetBuffer); - - return rWlanStatus; -} /* end of wlanoidGetP2PSDRequest() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to get GAS frame for P2P Service Discovery Request -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_MULTICAST_FULL -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidGetP2PSDRequest( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - PUINT_8 pucPacketBuffer = NULL, pucTA = NULL; -// PUINT_8 pucChannelNum = NULL; - PUINT_16 pu2PacketLength = NULL; - P_WLAN_MAC_HEADER_T prWlanHdr = (P_WLAN_MAC_HEADER_T)NULL; - UINT_8 ucVersionNum = 0; -// UINT_8 ucChannelNum = 0, ucSeqNum = 0; - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - if (u4QueryBufferLen < sizeof(PARAM_P2P_GET_SD_REQUEST)) { - *pu4QueryInfoLen = sizeof(PARAM_P2P_GET_SD_REQUEST); - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - DBGLOG(P2P, TRACE, ("Get Service Discovery Request\n")); -#if 0 - if ((ucVersionNum = p2pFuncGetVersionNumOfSD(prAdapter)) == 0) { - P_PARAM_P2P_GET_SD_REQUEST prP2pGetSdReq = (P_PARAM_P2P_GET_SD_REQUEST)pvQueryBuffer; - - pucPacketBuffer = prP2pGetSdReq->aucPacketContent; - pu2PacketLength = &prP2pGetSdReq->u2PacketLength; - pucTA = &prP2pGetSdReq->rTransmitterAddr; - } - else { - P_PARAM_P2P_GET_SD_REQUEST_EX prP2pGetSdReqEx = (P_PARAM_P2P_GET_SD_REQUEST_EX)NULL; - - prP2pGetSdReqEx = (P_PARAM_P2P_GET_SD_REQUEST)pvQueryBuffer; - pucPacketBuffer = prP2pGetSdReqEx->aucPacketContent; - pu2PacketLength = &prP2pGetSdReqEx->u2PacketLength; - pucTA = &prP2pGetSdReqEx->rTransmitterAddr; - pucChannelNum = &prP2pGetSdReqEx->ucChannelNum; - ucSeqNum = prP2pGetSdReqEx->ucSeqNum; - } - - - rWlanStatus = p2pFuncGetServiceDiscoveryFrame(prAdapter, - pucPacketBuffer, - (u4QueryBufferLen - sizeof(PARAM_P2P_GET_SD_REQUEST)), - (PUINT_32)pu2PacketLength, - pucChannelNum, - ucSeqNum); -#else - *pu4QueryInfoLen = 0; - return rWlanStatus; -#endif - - prWlanHdr = (P_WLAN_MAC_HEADER_T)pucPacketBuffer; - - kalMemCopy(pucTA, prWlanHdr->aucAddr2, MAC_ADDR_LEN); - - if (pu4QueryInfoLen) { - if (ucVersionNum == 0) { - *pu4QueryInfoLen = (UINT_32)(sizeof(PARAM_P2P_GET_SD_REQUEST) + (*pu2PacketLength)); - } - else { - *pu4QueryInfoLen = (UINT_32)(sizeof(PARAM_P2P_GET_SD_REQUEST_EX) + (*pu2PacketLength)); - } - - } - - return rWlanStatus; -} /* end of wlanoidGetP2PSDRequest() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to get GAS frame for P2P Service Discovery Response -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_MULTICAST_FULL -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidGetP2PSDResponse( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - P_WLAN_MAC_HEADER_T prWlanHdr = (P_WLAN_MAC_HEADER_T)NULL; - //UINT_8 ucSeqNum = 0, - UINT_8 ucVersionNum = 0; - PUINT_8 pucPacketContent = (PUINT_8)NULL, pucTA = (PUINT_8)NULL; - PUINT_16 pu2PacketLength = (PUINT_16)NULL; - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - if (u4QueryBufferLen < sizeof(PARAM_P2P_GET_SD_RESPONSE)) { - *pu4QueryInfoLen = sizeof(PARAM_P2P_GET_SD_RESPONSE); - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - DBGLOG(P2P, TRACE, ("Get Service Discovery Response\n")); - -#if 0 - if ((ucVersionNum = p2pFuncGetVersionNumOfSD(prAdapter)) == 0) { - P_PARAM_P2P_GET_SD_RESPONSE prP2pGetSdRsp = (P_PARAM_P2P_GET_SD_RESPONSE)NULL; - - prP2pGetSdRsp = (P_PARAM_P2P_GET_SD_REQUEST)pvQueryBuffer; - pucPacketContent = prP2pGetSdRsp->aucPacketContent; - pucTA = &prP2pGetSdRsp->rTransmitterAddr; - pu2PacketLength = &prP2pGetSdRsp->u2PacketLength; - } - else { - P_PARAM_P2P_GET_SD_RESPONSE_EX prP2pGetSdRspEx = (P_PARAM_P2P_GET_SD_RESPONSE_EX)NULL; - - prP2pGetSdRspEx = (P_PARAM_P2P_GET_SD_RESPONSE_EX)pvQueryBuffer; - pucPacketContent = prP2pGetSdRspEx->aucPacketContent; - pucTA = &prP2pGetSdRspEx->rTransmitterAddr; - pu2PacketLength = &prP2pGetSdRspEx->u2PacketLength; - ucSeqNum = prP2pGetSdRspEx->ucSeqNum; - } - - -// rWlanStatus = p2pFuncGetServiceDiscoveryFrame(prAdapter, -// pucPacketContent, -// (u4QueryBufferLen - sizeof(PARAM_P2P_GET_SD_RESPONSE)), -// (PUINT_32)pu2PacketLength, -// NULL, -// ucSeqNum); -#else - *pu4QueryInfoLen = 0; - return rWlanStatus; -#endif - prWlanHdr = (P_WLAN_MAC_HEADER_T)pucPacketContent; - - kalMemCopy(pucTA, prWlanHdr->aucAddr2, MAC_ADDR_LEN); - - - if (pu4QueryInfoLen) { - if (ucVersionNum == 0) { - *pu4QueryInfoLen = (UINT_32)(sizeof(PARAM_P2P_GET_SD_RESPONSE) + *pu2PacketLength); - } - else { - *pu4QueryInfoLen = (UINT_32)(sizeof(PARAM_P2P_GET_SD_RESPONSE_EX) + *pu2PacketLength); - } - } - - return rWlanStatus; -} /* end of wlanoidGetP2PSDResponse() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to terminate P2P Service Discovery Phase -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_MULTICAST_FULL -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetP2PTerminateSDPhase( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - P_PARAM_P2P_TERMINATE_SD_PHASE prP2pTerminateSD = (P_PARAM_P2P_TERMINATE_SD_PHASE)NULL; - UINT_8 aucNullAddr[] = NULL_MAC_ADDR; - - do { - if ((prAdapter == NULL) || (pu4SetInfoLen == NULL)) { - break; - } - - - if ((u4SetBufferLen) && (pvSetBuffer == NULL)) { - break; - } - - if (u4SetBufferLen < sizeof(PARAM_P2P_TERMINATE_SD_PHASE)) { - *pu4SetInfoLen = sizeof(PARAM_P2P_TERMINATE_SD_PHASE); - rWlanStatus = WLAN_STATUS_BUFFER_TOO_SHORT; - break; - } - - prP2pTerminateSD = (P_PARAM_P2P_TERMINATE_SD_PHASE)pvSetBuffer; - - if (EQUAL_MAC_ADDR(prP2pTerminateSD->rPeerAddr, aucNullAddr)) { - DBGLOG(P2P, TRACE, ("Service Discovery Version 2.0\n")); -// p2pFuncSetVersionNumOfSD(prAdapter, 2); - } - - //rWlanStatus = p2pFsmRunEventSDAbort(prAdapter); - - } while (FALSE); - - - - - - return rWlanStatus; -} /* end of wlanoidSetP2PTerminateSDPhase() */ - - -#if CFG_SUPPORT_ANTI_PIRACY -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_MULTICAST_FULL -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetSecCheckRequest( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - if (u4SetBufferLen) { - ASSERT(pvSetBuffer); - } - - return wlanoidSendSetQueryP2PCmd(prAdapter, - CMD_ID_SEC_CHECK, - FALSE, - TRUE, - TRUE, - NULL, - nicOidCmdTimeoutCommon, - u4SetBufferLen, - (PUINT_8)pvSetBuffer, - pvSetBuffer, - u4SetBufferLen - ); - -} /* end of wlanoidSetSecCheckRequest() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[out] pvQueryBuffer A pointer to the buffer that holds the result of -* the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_ADAPTER_NOT_READY -* \retval WLAN_STATUS_MULTICAST_FULL -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidGetSecCheckResponse( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - //P_WLAN_MAC_HEADER_T prWlanHdr = (P_WLAN_MAC_HEADER_T)NULL; - P_GLUE_INFO_T prGlueInfo; - - prGlueInfo = prAdapter->prGlueInfo; - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - if (u4QueryBufferLen > 256) { - u4QueryBufferLen = 256; - } - - *pu4QueryInfoLen = u4QueryBufferLen; - - #if DBG - DBGLOG_MEM8(SEC, LOUD, prGlueInfo->prP2PInfo->aucSecCheckRsp, u4QueryBufferLen); - #endif - kalMemCopy((PUINT_8)(pvQueryBuffer + OFFSET_OF(IW_P2P_TRANSPORT_STRUCT, aucBuffer)), prGlueInfo->prP2PInfo->aucSecCheckRsp, u4QueryBufferLen); - - return rWlanStatus; -} /* end of wlanoidGetSecCheckResponse() */ -#endif - -WLAN_STATUS -wlanoidSetNoaParam ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_CUSTOM_NOA_PARAM_STRUC_T prNoaParam; - CMD_CUSTOM_NOA_PARAM_STRUC_T rCmdNoaParam; - - DEBUGFUNC("wlanoidSetNoaParam"); - DBGLOG(INIT, TRACE,("\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_CUSTOM_NOA_PARAM_STRUC_T); - - if (u4SetBufferLen < sizeof(PARAM_CUSTOM_NOA_PARAM_STRUC_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - - prNoaParam = (P_PARAM_CUSTOM_NOA_PARAM_STRUC_T)pvSetBuffer; - - kalMemZero(&rCmdNoaParam, sizeof(CMD_CUSTOM_NOA_PARAM_STRUC_T)); - rCmdNoaParam.u4NoaDurationMs = prNoaParam->u4NoaDurationMs; - rCmdNoaParam.u4NoaIntervalMs = prNoaParam->u4NoaIntervalMs; - rCmdNoaParam.u4NoaCount = prNoaParam->u4NoaCount; - -#if 0 - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_NOA_PARAM, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_CUSTOM_NOA_PARAM_STRUC_T), - (PUINT_8)&rCmdNoaParam, - pvSetBuffer, - u4SetBufferLen - ); -#else - return wlanoidSendSetQueryP2PCmd(prAdapter, - CMD_ID_SET_NOA_PARAM, - TRUE, - FALSE, - TRUE, - NULL, - nicOidCmdTimeoutCommon, - sizeof(CMD_CUSTOM_NOA_PARAM_STRUC_T), - (PUINT_8)&rCmdNoaParam, - pvSetBuffer, - u4SetBufferLen - ); - -#endif - -} - -WLAN_STATUS -wlanoidSetOppPsParam ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_CUSTOM_OPPPS_PARAM_STRUC_T prOppPsParam; - CMD_CUSTOM_OPPPS_PARAM_STRUC_T rCmdOppPsParam; - - DEBUGFUNC("wlanoidSetOppPsParam"); - DBGLOG(INIT, TRACE,("\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_CUSTOM_OPPPS_PARAM_STRUC_T); - - if (u4SetBufferLen < sizeof(PARAM_CUSTOM_OPPPS_PARAM_STRUC_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - - prOppPsParam = (P_PARAM_CUSTOM_OPPPS_PARAM_STRUC_T)pvSetBuffer; - - kalMemZero(&rCmdOppPsParam, sizeof(CMD_CUSTOM_OPPPS_PARAM_STRUC_T)); - rCmdOppPsParam.u4CTwindowMs = prOppPsParam->u4CTwindowMs; - -#if 0 - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_OPPPS_PARAM, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_CUSTOM_OPPPS_PARAM_STRUC_T), - (PUINT_8)&rCmdOppPsParam, - pvSetBuffer, - u4SetBufferLen - ); -#else - return wlanoidSendSetQueryP2PCmd(prAdapter, - CMD_ID_SET_NOA_PARAM, - TRUE, - FALSE, - TRUE, - NULL, - nicOidCmdTimeoutCommon, - sizeof(CMD_CUSTOM_OPPPS_PARAM_STRUC_T), - (PUINT_8)&rCmdOppPsParam, - pvSetBuffer, - u4SetBufferLen - ); - -#endif - -} - -WLAN_STATUS -wlanoidSetUApsdParam ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - P_PARAM_CUSTOM_UAPSD_PARAM_STRUC_T prUapsdParam; - CMD_CUSTOM_UAPSD_PARAM_STRUC_T rCmdUapsdParam; - P_PM_PROFILE_SETUP_INFO_T prPmProfSetupInfo; - P_BSS_INFO_T prBssInfo; - - - DEBUGFUNC("wlanoidSetUApsdParam"); - DBGLOG(INIT, TRACE,("\n")); - - ASSERT(prAdapter); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_CUSTOM_UAPSD_PARAM_STRUC_T); - - if (u4SetBufferLen < sizeof(PARAM_CUSTOM_UAPSD_PARAM_STRUC_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvSetBuffer); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - prPmProfSetupInfo = &prBssInfo->rPmProfSetupInfo; - - prUapsdParam = (P_PARAM_CUSTOM_UAPSD_PARAM_STRUC_T)pvSetBuffer; - - kalMemZero(&rCmdUapsdParam, sizeof(CMD_CUSTOM_OPPPS_PARAM_STRUC_T)); - rCmdUapsdParam.fgEnAPSD = prUapsdParam->fgEnAPSD; - prAdapter->rWifiVar.fgSupportUAPSD = prUapsdParam->fgEnAPSD; - - rCmdUapsdParam.fgEnAPSD_AcBe = prUapsdParam->fgEnAPSD_AcBe; - rCmdUapsdParam.fgEnAPSD_AcBk = prUapsdParam->fgEnAPSD_AcBk; - rCmdUapsdParam.fgEnAPSD_AcVo = prUapsdParam->fgEnAPSD_AcVo; - rCmdUapsdParam.fgEnAPSD_AcVi = prUapsdParam->fgEnAPSD_AcVi; - prPmProfSetupInfo->ucBmpDeliveryAC = - ((prUapsdParam->fgEnAPSD_AcBe << 0) | - (prUapsdParam->fgEnAPSD_AcBk << 1) | - (prUapsdParam->fgEnAPSD_AcVi << 2) | - (prUapsdParam->fgEnAPSD_AcVo << 3)); - prPmProfSetupInfo->ucBmpTriggerAC = - ((prUapsdParam->fgEnAPSD_AcBe << 0) | - (prUapsdParam->fgEnAPSD_AcBk << 1) | - (prUapsdParam->fgEnAPSD_AcVi << 2) | - (prUapsdParam->fgEnAPSD_AcVo << 3)); - - rCmdUapsdParam.ucMaxSpLen = prUapsdParam->ucMaxSpLen; - prPmProfSetupInfo->ucUapsdSp = prUapsdParam->ucMaxSpLen; - -#if 0 - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_UAPSD_PARAM, - TRUE, - FALSE, - TRUE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(CMD_CUSTOM_OPPPS_PARAM_STRUC_T), - (PUINT_8)&rCmdUapsdParam, - pvSetBuffer, - u4SetBufferLen - ); - #else - return wlanoidSendSetQueryP2PCmd(prAdapter, - CMD_ID_SET_UAPSD_PARAM, - TRUE, - FALSE, - TRUE, - NULL, - nicOidCmdTimeoutCommon, - sizeof(CMD_CUSTOM_OPPPS_PARAM_STRUC_T), - (PUINT_8)&rCmdUapsdParam, - pvSetBuffer, - u4SetBufferLen - ); - -#endif -} - - - -WLAN_STATUS -wlanoidQueryP2pOpChannel ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - - WLAN_STATUS rResult = WLAN_STATUS_FAILURE; -// PUINT_8 pucOpChnl = (PUINT_8)pvQueryBuffer; - - do { - if ((prAdapter == NULL) || (pu4QueryInfoLen == NULL)) { - break; - } - - - if ((u4QueryBufferLen) && (pvQueryBuffer == NULL)) { - break; - } - - if (u4QueryBufferLen < sizeof(UINT_8)) { - *pu4QueryInfoLen = sizeof(UINT_8); - rResult = WLAN_STATUS_BUFFER_TOO_SHORT; - break; - } - -#if 0 - if (!p2pFuncGetCurrentOpChnl(prAdapter, pucOpChnl)) { - rResult = WLAN_STATUS_INVALID_DATA; - break; - } -#else - rResult = WLAN_STATUS_INVALID_DATA; - break; -#endif - - *pu4QueryInfoLen = sizeof(UINT_8); - rResult = WLAN_STATUS_SUCCESS; - - } while (FALSE); - - return rResult; -} /* wlanoidQueryP2pOpChannel */ - -WLAN_STATUS -wlanoidQueryP2pVersion ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - WLAN_STATUS rResult = WLAN_STATUS_FAILURE; -// PUINT_8 pucVersionNum = (PUINT_8)pvQueryBuffer; - - do { - if ((prAdapter == NULL) || (pu4QueryInfoLen == NULL)) { - break; - } - - - if ((u4QueryBufferLen) && (pvQueryBuffer == NULL)) { - break; - } - - if (u4QueryBufferLen < sizeof(UINT_8)) { - *pu4QueryInfoLen = sizeof(UINT_8); - rResult = WLAN_STATUS_BUFFER_TOO_SHORT; - break; - } - - } while (FALSE); - - return rResult; -} /* wlanoidQueryP2pVersion */ - -WLAN_STATUS -wlanoidSetP2pSupplicantVersion ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rResult = WLAN_STATUS_FAILURE; - UINT_8 ucVersionNum; - - do { - if ((prAdapter == NULL) || (pu4SetInfoLen == NULL)) { - - rResult = WLAN_STATUS_INVALID_DATA; - break; - } - - if ((u4SetBufferLen) && (pvSetBuffer == NULL)) { - rResult = WLAN_STATUS_INVALID_DATA; - break; - } - - *pu4SetInfoLen = sizeof(UINT_8); - - if (u4SetBufferLen < sizeof(UINT_8)) { - rResult = WLAN_STATUS_INVALID_LENGTH; - break; - } - - - ucVersionNum = *((PUINT_8)pvSetBuffer); - - - rResult = WLAN_STATUS_SUCCESS; - } while (FALSE); - - return rResult; -} /* wlanoidSetP2pSupplicantVersion */ - -#if CFG_SUPPORT_P2P_RSSI_QUERY -WLAN_STATUS -wlanoidQueryP2pRssi ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - DEBUGFUNC("wlanoidQueryP2pRssi"); - - ASSERT(prAdapter); - ASSERT(pu4QueryInfoLen); - if (u4QueryBufferLen) { - ASSERT(pvQueryBuffer); - } - - *pu4QueryInfoLen = sizeof(PARAM_RSSI); - - /* Check for query buffer length */ - if (u4QueryBufferLen < *pu4QueryInfoLen) { - DBGLOG(REQ, WARN, ("Too short length %ld\n", u4QueryBufferLen)); - return WLAN_STATUS_BUFFER_TOO_SHORT; - } - - if (prAdapter->fgIsP2pLinkQualityValid == TRUE && - (kalGetTimeTick() - prAdapter->rP2pLinkQualityUpdateTime) <= CFG_LINK_QUALITY_VALID_PERIOD) { - PARAM_RSSI rRssi; - - rRssi = (PARAM_RSSI)prAdapter->rP2pLinkQuality.cRssi; // ranged from (-128 ~ 30) in unit of dBm - - if(rRssi > PARAM_WHQL_RSSI_MAX_DBM) - rRssi = PARAM_WHQL_RSSI_MAX_DBM; - else if(rRssi < PARAM_WHQL_RSSI_MIN_DBM) - rRssi = PARAM_WHQL_RSSI_MIN_DBM; - - kalMemCopy(pvQueryBuffer, &rRssi, sizeof(PARAM_RSSI)); - return WLAN_STATUS_SUCCESS; - } - - #ifdef LINUX - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_LINK_QUALITY, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryLinkQuality, - nicOidCmdTimeoutCommon, - *pu4QueryInfoLen, - pvQueryBuffer, - pvQueryBuffer, - u4QueryBufferLen - ); - #else - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_GET_LINK_QUALITY, - FALSE, - TRUE, - TRUE, - nicCmdEventQueryLinkQuality, - nicOidCmdTimeoutCommon, - 0, - NULL, - pvQueryBuffer, - u4QueryBufferLen - ); - - #endif -} /* wlanoidQueryP2pRssi */ -#endif - - diff --git a/drivers/net/wireless/mt5931/firmware_5931/WIFI_RAM_CODE b/drivers/net/wireless/mt5931/firmware_5931/WIFI_RAM_CODE deleted file mode 100755 index 2634f8392130ab95f1acfefe875cdfe8a56237ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 139776 zcmb4JL#!wOuD!Nx+qP}{UE8*8+qP}nwr$(@&w4hKzigWJB&R27ityiOsb^f3;gxnP zNW)xyMIm-e8(RZE{ouH7i)2~sD0=Wn7o+zXF&<%GLlO;4LfC0NIDL$#tBcFU+kkmx5wLDyMVj)gyB3)+f1u5{+wM6{ zG7T!y6*r3!=MvB9VO)-DCa9o;Mq~LrnN0A3 zkxT4q6v2*57=AnQI_xkt-P+bx<%;p*;q=kp7ER@>G*fPHFn7gM zu*F|yJf~^z1k=pUSX*jYU0Rw1o;c!H9lO5ZJm{AIASmfwG*5pFh<{X{Tvlx0bN}CZ zdbVv?&<$grWrgJNGYXeY|9|6&Zdt^%Fb}ZIoIMu{r!2JpmmY#r{tAm3U&1*6I>?K> z?jp549>|1f%*h3Sl+soeW%>V?9!OC+Xu!8zC%oxL_2mnXhX22MfcC*uZ+(o;nuOj~ z!!e4%{a^gjlar$3k^&1$vj{nhn$4R3fAP3d#)F=q#S~IXz)-)a%})Lo-qJu|f_o8C z-cG|VU5ogNBH#`IaT>sdsEftn!rF*1TR^^y6_C)#^;9w#A96#S$bZ`yafTO5&uf=O z-Y34_^>T6l?XMyDF-UvsN!{rnM*8R#)KC?Ql|;LndWn|9_2xl(FV2S;(gS&^7Lw=1 zb@peq`}VRwGac;_(0n*daueXCxKBGF1`i}d)QYbRZSLskBWRzkYOiSsYd$GPAPTSr zX2$#b7d?Y?#QRwSkJX~;5^bx^+;nm|rG-(lkca`_8^%C4kj`AU0}Z%<>A|-pAu=xUGZiB_=4@XmVCRoY#Ui&R>i^=E1pK_V|l1o=FwGlWBC!kb(aka?3`_Rn>eJ- z{?Zw?rGQ2Qet5I`)SaA&avIwBA|XWE_BcU76&}LC&gH4Cjf5;}02s_YZIdk?0VCWa zi+*`-;2}efTf@V0x_%kEiQ11RY@H9c+LI^peA9;mo43-|_6|!%A-C4g`TTr6t7jAF z1`2A{IrOcr&R9-!ntOvn?T2pzjMg){bu>3XEAtnM*!cPn6qq02?Qwvns3*U)uJbzw z9Ro<6_W(S+6Vt$4BIGO6jX|-vCX6~qTb*y{1v9Vd**UnIh5ZdYd*-g&Dk;0{skKVn z$NV?@=LCcLjwo5@=OjMFth@xp6cCqOv2ex7aEn2S`)-?#6!<*wQn6nqpLGR@4!bE$ zQ9x6GIgQ90>-eMk;cCj}0Qoir)8L%$ddBiGQmKe5xM0F-dTLV=bc)a0tg6y-6G~;m z5yp;R)L5XlgiqlLz2P;&pmQ-2Rs~fqNEae-5IGmu zV0TT#1+U^-o^WJN3a3Rf{(DgY0U=`?wi5qY|8d?;LpCjZY15w?0N^6uem_Gwq#s;< z>Er`s_UyyeU?16fFc>ln4VnB4l~^1lFem*;D>bLDB}&7AX>d>21DiBTzgsc`Se(5; zK}7VCj@if8fpXJH<0&$0?I9(RWWP44%_M5A8~GoZ|k%gH;;?6h%iv zdueb`l7?ovCJR;U+EI4xyr5)v6X$mK6uX)QY&dh)W<#Thou{$aR>GPNr_e)=X?5(_ z(8%4^MOV%Cq|uSGV+NZF$`&cZ-#rzDJ5;FZv5` zzbWgdL}b-*yPgag?*NfNnJWz)=+ijBqCE0R>`nm5;8rWHB{n1fiwwfSBg9+eGnXhi zh?K(Ofu1af^^!%lhlruLuI!DbVKZRf zQInHxCe8W7AV^vS!8F}*3_+MP#Bf{UBTm1iBCd^`-*K&3}k1?tQVe4(9ODRXTDMi@7_U_Qzm}k3@`LB9wfjlc?7va5O z6AGD#hldRoyJ^O0J=_%$YZc9%ug8f*+i*sOnUo$_RBE$;u67P_@;oqC;W>>OMEj*^ zuHH15*gRv1;MFW1H?wh>bc(;{l!SbrTZo3wa=2$vKXG?Pd5z*x%&(ZkccazPP_+sl zh+LTLpG+y=P_!E^=1OolPx4>F^@8)YZ9@SlHMh^L&F+z0K?lA-7!yr?!IMIzD2XOr z04RR(Rw{93*RIqiMHwVQj9~W>jkKoJ9>X#91q1-%b~$;6Y1bNlehpTKbPy7n zIV{+VwCV@6Q}9nx3wM8k=3+3+HkByj+b)uNFIQNmXZ0WSDE8QJX7krpwl7Sy!}vNY zZKX%@wvfbK>xShLL-DT+D2B87ApPMsI0Pm0zy$=?VOd8# zeuN+*?R^)hx<7rk%=LToV3*;}B%o=d@?u77&TZI%in*_md$pnbyRPZMBz_cqS}TW9qtdHH;yxEFtM|rZddHe@2JOj1mdF% z7WzV_;w;|YG=F=L6=QGrA8SHNJ+|h@q*AULn`56tB?dz_WU55NDZZoa6(TGOGK+rwBi$_kzs3yjF;6Uq^d>w`20ED z@wZWeBemA~uub!-j};^g`?~5X5uTBzU;*Z;%jFz$mRrt!C4uqsOPigrajKH3WSI{- z7G=kQ@;XuNOzex;@(nxp!d(jNG2tDOr2^6%W#Y!qJ+%Rlj#L6qo~WbM2`Gp|tHEN9 zR(v|(f~_86?l)5~W9_74a8nl}1ic0FfI~VwZLb+*5ccGZNd0 zB}jHPj~1u(idPh91=bFkyy^~>VB=$oVV1Y_~-C{Tx^y|~Afa>&`S zT)t>qGmQa;xoRel24(c2k=K&ARE7t#Og{rHViO<=%-A09ry4(i4rD2%c<+D^|CSx! zzb?1&@hVgg$sGQyTNNfg_-Y+cc2Iuw_oUNvq)~lU%%}(7DO>{iB7VWrHM+{YcMDCo zS7J(!{M<|}vz1H7@T4L=pyCU;5%U?e{XA0fylIxQ408LnKUap9MWf;#SsZgZ%5;%&i zxNfner}0ADfnpj@wAGnUXS)bLun#&UmL6rMypcw^z5*xadrry~JhBTeZ~%TEAmo1H zaTtA9pC@O(orwBv`x3*5f#LHpV!qsyW*$btxTnw5avrd)A-pa!czwCDH_YXZ(kdC9 zVF6~9F5)Q)i|s_tYzs@8g~E!eNz-9v`D$w@9n8URUn?}BZW3CL;;|knz6CeT@D3Ih z`w%~XAZu3ku89*eqnO^M;IFX)Z|QZ<>YYlyse>zr`Fa0G7lbu=8rAsS%%5KocY>K$7ON%#Y8*0{$KL4ymi;!>DLn$u01wC@~Q;dB;ms1ZP>SheRQErbjo_CjY!<5k&eoU?E@Dp&3 zUqu>(&>UZWk_rmilSwpgSYD0jf8?FSS?P|RAz?b=6>0T+N9XvE;WZ&gp?nrB4RYqzN$d9Oty$p(&>WLV-s_}?g zd#uv6rKRU;>CwH!YoL zzQW9oFM>J+yV)Ajprys5DFsYhmhh-6VF17m>Fl{B>J2pbWaA+%SiXe@)VTl=R5%Si zGaNw{!`(3i-Kih8Ip9ei823L#%|Vj7S#BRc%2&^zbUgtskFlu-oAmh$s%GG1UBuz& zJouk4&So2dDibU8{6nRP#hV-DRLMznQ(tFe^?xQt=BVv^9_O`pb~78RclMUCZY?8p z^WS9jS%R+OBzuqR2t;>jJ`u0pVs}GJzVn46N@dS>!maTfbAUP*&t|*63xe`5G{oSQ;zt82C(CM~2>$ zT+_~qMkpwWGdmn2&Y`Z{EfeML_6ZWs_QYwTltXCHiWa^xJS#RwF28Om&eBM2MdhNNee)YUt{;5Q7?o8^fRq=8W-~B zLawP~0iOQEctUWnAv{$P2={&1xc9G#@Oe&O81iA!sf?|Qa~JVIt5pFm@5)qSEs^;$ zrS~*TFSSRQ(9)Ux%D8hXr5&cK{JvmZ2bEz7hv)tl&ejf&LBh&bLQ0TrLajL3tGo_D zs)^LFJzZPT<6&}17mL|0D1hVed4F(Ox&dd)O!6s6k#JS- zC{!_ePlDs9*}=RmVe@}f)jjNgHS9O{@OT@{S5~XRSPz@w0TasgNTb%n0Tht#{MDl5fVPf?NE4inq{If|01CJ z?F}d%R<{*-)w%Rpu}wVF^-0N9WLKtUCog<(LQdiKDZeWH$p)}bL`$Y0v0qrD-Q&*Gu+gk9Y@;QxM2yVYIIY*sI@zV?NyR}J||px9k+7EWfZn+`d$|TUy_nxrp zXTWamvP%`^6f}=Pj`+LOK2QZ7}j?Y}~YUGUT8P4M^%} zJrqgyX4k+k`5h)eT$at4e1~?eR@jL(HVon(=C63d-&nLUH_CZQz3nIw_H|qb zf{StP=TF&)h4)kb#rjf$E?}UCiBy5}&B2uP4<7PT4m2^(`Mp}&5?VzX_mt-al}99E z5IYIo^gM3Lq07#@1VQyBr;!@K&&X0!;rg_Ht(>Q|yrhGFVF@Us2GA-u{o$av~Lzh;FPkH*sY$2qN4N&9&935Kok}OZ5 z5b{b~J`A6;Atcy73<(xp^1|>$wGM>1m=;z)zbN)#NhCFKcG0-8KA~Ed>Nd?c-wmOB zsh-;|d=>GAl7{CjDa-Kf zh@4RuhRYxrnE3u`#;Q_*KeSBySNvMi$kGTotM%pED5o2vU(}0&{nVK=$oMKV<-FG- zmZtcdutpqm^M5xZ4!s>y;IRW*21K=Er5o0&QtUa~@y<2;tku3nlg znLS77WY?n#&5m+t$OpJ1+8lFNNo0>K)~`QYTmHi)Y@zR(xsGXjyv~}aVnsJr>-gV% zNoMH$LDXAGAjnqOGVErK{Wo9Chtr9u1VS>nNk^yP8|l-><}PfPWeTWYN7iG&3WpnBbvDzMkSMiFNQDTUChaD^ zI@sWQOW)r@Lz>r6KJVm9ggS10J_#VtH^4&I0wz9MCaNM@n(yCy zI%nvo18}X)WaF!>oI$5S=FppEyq(o=CsjEYBmJ%<)qtvq$g~j*Dom@q8lIz9D}$V268

lv2`PQ0*-`vZdm~=!0L~QOJEJa)fK= zv=LsxZB0%{B+4wN^!J_MgNhvLLi*Y)AZ(F);l$jpp|N9B+P>t>{V58BpFN+typeNI zsFg_Vn?}*hTT)r?yE=QL@`0*mUqT!{CC2<~Vs@Sb%5X5!U>{cAKO?%P!`#CWAB|-a zyaDJE*EeZYOsOTsbBiinGo}f*DiaR(VxvKvJ8s-OPDF0j-CG<%>3k&tO)k*ZhV;j& z6<*pGt#x<{ztlC+f3_V&C2*s#KkVU`8mVa$^l?o4yV9Mk@DURQa1|uCu>wHhPkqem zF!PL+elHmVQ{O5!NeHTSpb(8SJuD2ufD`3^c@B7;IgATS#IwPu^0J9>6m7}Tmd$M< z%#(*5Zj~T`0PA5Z++*xLu5uiNbIP4&KWN=Q!7ldVNKVUw%s7D?`h6aHB=ZNKl$%Qa z@(m{R6r}{!-RT2Z`9YpM#t*9EC+}v%yL+W=;{Dq75DY2RhvSRXz*K(=iLk;Id?D;c zQx1&ZqzAEf0EnL;%8jN3_B;yk-kNRbY)9y^H3;475hf<)XQ6ulCq&n9cO1_e)T=Xi ziep&zzxHrn``un>fE7U_!`8ZN?3vN}2Ia@`jH{3x5}|Kd%OiPZ;MU3JJ8I_6l{uwd zPK$yBki(el*-&zFF?OO-BqTBuX}Ydad^0cEIKt;;l;nK0)~l7RC~~ROBD_Bx9~|Q% zO2TdbCq*E8!V}_wj%8^78xK)&a@amW=QOO(Gpf%h^DfXE+l<*# zcV(9^cV4hw5(2NjNj^QV2IfDR&VW?_w{|CF$=r zZNcd!jL)`rp)RZNw?P>!VA++CBWHCjai|x}>f837hdQx!q3}<~%tT@q1Y1Lc4hX_y z@lUFY9TU7fy>_!CA)RxivvS3q$N7rEk=o#Hvc2S2Nic(Y7>s3T82i_!i+`}ON)n10 zkS3nG22FPA-2@=P7V#%mni@JY;2{3GR7cR}>%$rBf;fbQRQe!qd{89$VnN43N+|07kB!wyUbcWG|clSdzIU>HX1+nCk~FF zS?HITnn42y=u{7K)nyEw&_M-n=l`{E!1BM5I$msE0&@DS4XVC?#C*p+T<4xlZ$8*J zK({FrB{Z&xVZ|yV02x2mv7>FR)hp=T48Y589M;pBHxq+#GQ z>3XF{4z`I#gf%u?&hvBPXigoP;G8jNdM}d6)w^Y1|*jffmLPJ4jYY9Q-yUde1-4o(2uG`!iFy--fh0oi0cQ=1G zyTyG!XNyzq>#W7h%Q*$KS}|UyZ1T6u+U9$#?@rW9nb)i=qKKWm1wl2pAm$&5UgPJA zZ2gjK1a9&UcKmwclRQHq0&R;M3d+}jQ}TA`#Gumqvj{KA+n&glR?B0~9?y|Tt5r@b zKCUwYKV?XTxFwwiNNdGJR9X{&o4CZ%UVn%ewt)1sHOI=1HsCoqMc#kO|>N-)~vVqn+}D-a^KeK=5J zMsWcG3rN$s$Lp+766l_$NNja>{3t)JuKsiW7;PNK-TF@U!IeqAVrdWeUR;+D5!|lL z7AGxd3^}Kj*QS2oN$>rq&={x{;cslpVD79Jp{WDcsnO zy)s8SBUbCO+l?`H`$Q&soDc|J!7NsGak}Rr$CWP#&Vk~eb)aIu4^Xhoc|DMzgZ!S( z$UK-m|9Gm6T)rlSYi;2YV_h(Ba@fR0k$mTg)rAj zzih{JvK6#{sE#>!mHv}YH_;8?&X*Tzue&O64(VK+$7c2Uh`{jaq@izwf0?bAs^p)e0BJ)dtwp?X59zrLfe^n>zAcmp!N zX^?qG+?`?MLTlOr5~8c02b48UaGu}l_)lOgxV$eo+~de|e-TKaz|!T5?_0IkBLJG_ z`P(=9Q$5d)7@L%YQY#Bobl)3BY#moC4MU?%d@7`-NcfXxa4B++JQf&bG`ZzbQG}-N zDTPIO{=fDM8;B3)e#TQM(SMUuXmZ-N#78J||BUD7|LICf5$8_%!L5UKHc%u=8wmqU z??rphS_I+y;ztme_^9{g{Buxl;4mIKca#^I+pK3eL+P`1VsE}<DTE~~S4ORe z)@BRnu_64Xb1HR8s%d)<%cnDwt#v?rG@_`VOp&Po{f%L~FED~a;J;(m(N_L(prz{d z^x_lEY*HU;c?M#(Re=G#X@m~3q632B@3Kc%PhNdc+N%s^0s+HXhTleYKuToVD4Guo zjy;2H&t$iQsv*(1%5JkQzA)(T&_e2DJth~>JiIRd<9NXXuL1Q!(8$gWKcK>EUwzR)fGBvWqwT(nQLE-!2uUy} z0fBQ|fjr&dX^Ky1zn^v*FG3A!SM%$6gHK&|?l*^=W8Z6B z9>n0kdOp%TgxvWKTVm<$esRyEt}aRq&?YhRy`D*%6XTj`EMy!~frlV3+g7N(TH`4t z{J;acFBdjMVoF6A%{I+%vJPj6@*AbsEHdXMR2@d9o`(K;ASaUUQ<2`JLA`-|@f0Y) z=GxN)vdj%Pi#~Z^pP3#5)`{WWo}yzCEt3yVCR_GH1a?HyjyE#xbkD6FcA2;l#P=we zJcntX`tH49^6Xr*z~PQ1q5(BB(5aM+t*)E!M1`^|H}W&2Efy%o3^*fKWKAK{)muCH zw77vT+u3IR#sR@QMR#WiwJ%(Uk&D?4+8$H@=zf9AKu)KHnEBcE_obSgJBNxtjSH=_ zR4N+xW*|b5vj6NuUfZ*i)z>~!EfZzgzIp%CO)QCD(Uy&3(O0e|Q(Oc1;_suDJXgQ6 z2;^!T_=YutI@hf{EfV!_@*yFFnbUwTSUZ0ZOs3DoJO7+jN6XE*QSTVdU=#+<#8%CdpLExu z8nReydho)3gl|fc8Oh9qiI9``EN(wHVad!wmKMDrQ2+cR0$Nb7#gt+Ugo0c4TNTBv zkNB?Tk*U1YR&!#qY`D@D6x4Q(S2qur0L5R(hNU-K%Np=9dsP8@u{zd78+wp^`b@R? zy89m$b0H!UOwBq(lk8YSiG4FtQPwr`0FIT@c_ucge4pP(;{|P^s)Lrb6n_jS*n&<7uyskMq^W^mk zl&2ek!cwN44@Gif|HCH85yX%gP9XR)v--;zZDr3Xm5j!M)2f;xr-S?@aC}|T$oR0z zcuH98-xd7KRH#NXSFzkHM~c3BTSM;UUox&QyXva6aJQVZvP1u)qhV)bW2qx}3uJCY zXlf;#n7odMz2I{wAB~zy^)AFm%7a}wb39VaCn{avHaAP5*KmpFWl!Zlab(XuE!Slh z?BNl1;{qNMkQ#Vm)vh-W&lr&nDGW&ArjqSKY1#t)%D+@&1G|3sri<+7 zXj^BM3D|@}ir7@WY5qlkhl1q9rD2ZGtwFY}w>;mZMtc+G(RV6*MNs+nN8 z11Ng7p+U>sp?v}>GPZB3^$SI29*teU5rb^OsdB7&s8kAYf@qtNGPQ4l74Op*n}cLb!eMQTZS zuq;)>W?~$5-zA@@HEw|xtYbG$tUuPCAd2~CS2<0C({A3GsJD&V{fpcPB zCk!mFwp0k9P^*VXBtJ7r&WS!kQJLjUp4!m6-TnZlZBPM#Mgv9eI;!Zx|z`XKV0iZ{fzAG_{E8D5w;zv&Oab zAFAmml{XAirQLQnrB;`!Z9S7FYXORL0lsq8`9?H`+`o4I6!gJQfVOrJl0xT$_{9a8 zGXzNTE;0sFTXl{{-k?v4VTsBV4jQos-(a5WUl9in5ThDL{ciU@_anM+vgAV0ni>G|-g)w287-f&{{i?!CK*aCTfE z;4|eW+h#&eMo%boM2LtJaD7WD9bp`82Xc2wkubfp#|(}Y1bT8yTOr^G<+6u46t~)j z%aT&Q4OId@he!o{%-4v_{65Il3}w!oPJAi4wjmfocw~i!j5(C24+{w3d1dCPXyzcc+un$89uo(Ld zy2Y|JJU7za@ny`#`@g5aB9hf(XVD^yOFK+;y==>pd&Bx(?1k}?HN^33s+O<%T&eoa z<-5Yt`7ft61TLretDYv?LrKY321`B^Nc<7}XoFLASVN=ct8|=0Xb#V={ywp#0Ts}= zTzC3@C^=&22LQss*7bm#g;c(8hGrLCtnVd~o3ZuZse3dk%=^+7346hg1ZozY4hq^k zxZnLhlkIC;sqfx)T7vjrSQ~VGXCyE@)l<$p#NjrZoHompsV@{Sci0*x74@5+V@wyOU4MeF=?;>1V zX?a0~Cp2NZC^N8=31r1M1pYe88iwBQs#2kg6pS(hHwe-zd9orrNaE3|k2Dttbs*FJ z)M{HR(dulD^W*w;5gIsztl(hZkEWYJYk0OYGgZ2|UY@)-0`SfvN+nFH7PkEXmtBDJ zbq1fRHLp26wBXmvIzOW!)C|nmP_@k^`|+ut@S6t=CzSxYHC^Y)T*hZ+0=70N}ql}Xa`s9? zM2qhVoIbrbX5{*Luccr`!U$Y{7woF6W?gu~BUge7x#Arn%PDWCHPBvqWI8^x6pr7c z&J8%x_O{{Fy0bLVId4p49-8piouZmNlU+61)A+o9!QlbNN)Z6z?Fm&T<_87pfXytF zN&OT<)Q$R0&MO_|auD+zgVUUseum;TN!vR>>8ha+H||=kodQo0UHdwvragurv))Jg z4yQ4+LzN=O@8f29mO-uFv1`aun|q+vZ)a92E&WVu*rB@Kjj6EK0?fVLd=>n_KT@&m zLW;lR4HSpICw)}}zI+A^E9VKixe+CfL}LcD|9o9@%_3r4m5e|Z^1u&6f$U~%)!_+i z5dfx_i`z6m61L4nX0e`5iCrE?#+lso8)2`}IqIGrBJl=A4aZia;d}rq7JpI+ zJsmb?E<~z==r9({NDXe)i%Ae^&e&}_%t5smqudr4dCZr;f?Bc!8T+$ofS^$2W>p}-L@!iQVO>7If; zeN0tkhax0WXX&Km{yX2I`x0SYMFJBWDs9a-;PQStI@HvWcVA;_m%cn?GX@^<6f8An zbDC%6wlRg|z1Luh)9mLnM+l{5o>ElWv=smKXni>YH+X!p`VhCT(V%G~{7nkHpjKD9NSj+8^ z$C*vqZTPDH#TmIpN9sU@03=OTA0o*@i^7~n>7_x!<*d=bp-10i1TM1g_rEPWR(%aZ z(tRnc9azN189SFuz5T+f#w+=bUY5h3Z9D&okTCfehHMYQvYq-t~KJhyFHg}#_D;Gti3P8j#j&nX# zlf9OZ9eV&IR8dt+v>ZzbZCY7bkzon|r9J2O=uF`k;O0@j{QxBdnaBDn@{R?Tip}ia z5717pP<0?wktg_*Lnhb=;n8tCw>?L~EdbI5A@Byz`6Ri4M5>NQ>Pf$3%L+sX(@5wv+g@p30&e)aH0I{ygT@pU@u3sldH2Pj_*yHguF zcKT6Z{~Pc>gBj`neCmYPSvK zcl%EO?~wXNhSpr>u}J#Yk}|!Jhax8&c7m^*G(gR%dET)Osb#Ot2}zbi$?%Qo$|@Y@ z(9L<@crG0{s&{PLzR!?ECdg>(MTZiB)&c0M=tUgfL?}!`PDs1z{P64at&l+9|FjcH zFQazt3fiUIi|c8jhTzxN-K!eh3iOp29@Q1f^1L5#=ZgR2#y@^EU$=|a?<*H`gjYei zx{AHW9Ks9B2Axtp%R#m;IkUW+SEa{uy~p$f^16y8%2y*t5GCO=C5L&Yii zSh2{ORUFOOlj{k{i}1yk;s2xL+8Xls%eg`Q52PMi7#Zq52J4EvE_ncMcmm zKeQ*kQQLp{b9*J7Sz!yAw3PG!mGt(W;vT@F!H|M3-p`bAi9tMJFLbG-TQu6SghE?f5zq8(UY7@?vdTOdZ&8oqMV%%n^i?HfL85diArF?vN z> zkfFWw_r1^$6lBU4J*7O7j!u*u0C_adp*sN=@b!AhDBwUv%f6m)HaVR?lQkrWKzraw z<4joRx~O7jj%IA2lUF?+j69<5#b(<_u_w zbeT19ViYp2rj4QgdZ!GV8NnF}w|H&rEc5pzxiI3UzfT^&jbV#8Y9Uo_xQF)MU$#z{ z8G{V07%<$W#XVVdEjid+t!}B&rgrd0i99$8>Qh1RBQNN@-<+c`GmbQzvOO4VbD+pj zI{bC;n4Y_0EaiXQ5g)T)y3%G_Xn%$HWISw4{_@N!W5p}yE=LiO?GML@oMejicJl@5w4_gbB<8QE8pUf ziuZoPhdhq=V|x5N%kbHzqNoQjV<#sU>BqYlPvOhoS1B!TnFq`Oi-S0laZYHW zx&#z;kDcr1zxiB=&tE|LcJLszu~iCINaO=Aq8~Er4dNrFu{H)Ox>{v&W7$lVrmS|$ zi|rqWeVZoYGcv?aCV7Q_lc=OG>Ba(q@8f_swd!56m6jgN+~{<++QaXO#jz%(VNewk z+H=06?;VLW*8)zT;6S^+wDt~x_Wwf2V0D7oF1em!@hjV3hc#7;nzJX%%x^Czo z=8BH*@drzWskyw;p9Xf;BLsug>$~OH7c~Wxg)QBngM`Y!#WwX;!;s{`o7{uAqG{JM z8lpcZ-s+5VJV~&d64IM5)f*WMAAym)@7$!?>iL_H^{2PdK`x7_C}*#pcHrXvar6kZ zEg?Bp*F4`T+|vn(h#iT5Vz4y)Rta@QST;LKm#%!|l2R~$ic>K(Ca7fOQ~Eg5k_Gm; z**xwUjrYjvL31%tLXIa&+N=_;KP!;_`tp`Q^S5EG`c?GM)6VQ$JPZd~%OD6!XFIQb z=QK85TTREG0vvC_rYj!CN@zm+)Eb>on~QRNKScnums*94yCcDrM7u^oMBGT1OMtIc z@&}gQn*V9zY_b$(-U+#0^e9)|!HLZI5a|Q-kc09t0LcwEhk+K*G-iS895aTg3*E&9&F?ml>VlNd{UpsXGl zi|MLN%J!q~^JETt{5cGq4CmzR$mqGCs}E8SXf-W|m#PFG#LkxK5ncHEfy6r^d8|(f zYHUzC)KPosLIABjO~h3)rj(Ij4CJ@62%dcuq9$D`^*2NXioB=hB!Dvk89q~xVvkMy zJ{iJ~XRsPJ1+wio3R>psOxyTn*;dm6jW}UOi#AWaFsx}BPA+Ot1P4{G*j&|3>5Td zmaJEx9!5P-uQ$arcJQPu%^gG2CUQTTC~Ix|5?qn~uxpWx71FaJ4p3{%Bln-Df~W1< z6DldPr_QQ>EwLajrgi3pL4Di{$&69X6J`jOm*y*C{b4O5wiH*d%T6KcI;gb-Ot%8B zYU^IRzQlRc?i_A1_93$Wt<*suJ>ho;;{P+J_obbtZFZer<6o*D(DQg4hiU_mp#xb- z0q&zZl@!Dy8qpTB@YohriCK+j55haYb`WeZJXvj%j2_Kw0s}KVaTD)sl@MDD)fKtJ z(0KCMTkBfGroOkES~ssznZ3RysWUAwz{Rnro>eQkIMcKg(%|PUSpX7d{y-S}yCt*> zZPUehpdPftmbmel;B4dj}8niMs4TPoHF(+ zfmXrwWB_s~c@LWnxL==r81c9M;lzlV4i2NJLbT0&uMvA)YK8z_Y{p~2T@Sfl4`2?Q z3Ha7qIzLo1#MiS>_lOAvnj~MHh5b#H{6jumY&_AY;W{TW%)%w-t$bS|;6mpd+T?;2 z*qI2#Mlwb#9u+$=(Rb6h-o=FHI7%6lWox->uuseZz=3KtEE>!~$mTKtYMY}3Re`6^ zXp37uP}0D3Djoe&aFB=)2FVY?`wN4`#9(vnrD@!(s5k zIY>xEZf>szP6K_WaAL!b&M^`-Bp1}@g^~AJmMAYa4cLewY0BOP^aI1I;C{cK*hhH1MML9 z@c~l;0jf(l{YFo#oA#BXTS#NB@RY{!bvzJU`0PUtg#=@{ge(O)41Lv5q6QR>rcI zA8zk=9x6G9d+h`&m;1cPxCdeMRd2N6c?UFk_f#}?#46nS$X8DiuTIe{I3UFg>DUMx zWKTYY)3+_2NM7e!B5W8*$6^BK1otwh4nRvb2XlbpGu*kMC`_Z47I|<>IqD7;5@;Zo z)wJ4nLcv-YSlqV`&1MM~IgD|UcFc<}>XaGCxp!;wt%Sy3K&~Q2(+_f(rBC0@boA0f zpc~oBxuY9sfnlo%ARLetmz9uvcJOs=By_z?_`W4XW;y-Mg(V>&hQc^Gy@JiP6x+J-HD~Q6rJ+mXjO)0nL<77N znJ_?hok&$76T&R_Pr0zcjv){fP(fS!UWH4XkVCJNAh@F*#)L(Zdz#o`9>Vt-Tsf;c zvW0@gco5^M5+TsAAgB|qp1t5QnX~iiwK!FijHu`uHyjfpx1~M3ymHqTAh2EwnMTL1 zopxDOmL&PZ0ha$&oQ-*HkLwb?!b4BNP#C-uY!Jpl;a$I$sru3%(Qp%_kV$)ogv7P@ zf6Y+Qm>m72uw@FY7NGcyN)H(cDj(ep>HU(6};dh@0(kSqW70 zbTv6$)Ab7uBJxd%Y}XDl+2){=XT5}gsE~&?g~u@|%xXt4@&Ou9-y#|BuiHlP#2~PJ zODml8k2S4lDQBjL?e7iw$}n{nGCkv+3lhjS7Z>T*G>Z6yF#w8~t>$($7|(bI zbc;W|3fl%Syx}eSZGzAEK5tA)qSBLVVg}rm@z7B1IRwLX8UY5gAFJ!B^0QZtQ1qtYo7^6N^g8_>~j;W^a9jqssJ zmL=YAVNI!$%H{PRob*$yQGIKq({<~u2}ksLO>qD;N2jGIl@VKIq5rPMc()I|M0@u~ zN|B@r^KQBXMRZP7Uxufhvgv#oR@Up~MZ?VK?%}M3jch(LdtS=0cRc2T6Q9~L5V+iQ zSK>IRwLX7>c76?prE`S@!+>9jYf#+!5Osu7@Or&fll7iR9T?arMoOodj& zQggr-M9!mRrd7i{tPBgXN4yWKmL{yVu=-teg|gc{-;5fZ_Lb|mTHIfv%Z(~ z(w!GF@B=?=O`^Q$pGxxo>_pe;Uml2+kPX0kK3q<*;&_d}pD% zsawVU^3yi-H>wNf;TWm!N4*nGukac7I84FZmh;f(#zhnjr_n9OpXAATZfUER!A2!U zA|@o*`DolTyHLR^;R!3{=KnBO1U(9gYAT7`Ni;JAA2mc^hXYmk<()3QPSRi5a z-8$i#q9#ozoAk+Lb`DA-M3^`nqFqccu zM+l}?KDU<4Li7D>XsWQ19ITaq0-9}F5l(6>_ zfG@Wj5uMXdbl+j-*=v@GXSy9cY9l&%470_Wa-%hF)mc?ssP0Z_cg5aCnknGn02D!% zRRIfqcFtM)zFenH7yHgA%=eWAYkXGHvOATnAFv^}?;iDqfS;X5@4k@i+h9kACeM?K zw{Euk7rTGtoz*>-3tqT1-5eqH7U5%+%FT`F#THlMRp;Uw9vw!h-oH}vAiidd+9g$~ znqo`ZQEsmdb(&-1^DW3Bk%7wymU|BYFmheeS|xhnW)^6c&$BDKQ89V+Sm&0q@`eBT zN6@O=f>et>>I5uAIRhza*y|ztzYtBpO)#LK{)*pO4ztfTcY|Nqb=en&95F<1#7_qk zwl=AS8iXJ}qVDL*hGQz-H8OKYqcDGC<9NNalFK`9fX`-&{}7XBxkE8zMgbU=pxC z$%7D1Jm?Ed?G*ZVS)kv|FYriTK#hXoz1bitO15W~cI$?sRwyNNJXa_R`mWDp68WEG zHA4Q=RzBE>Ntmm#b^`;VGX!HCTE~F$R+b%3NMud~GA~u;eE>0@Ve<@o22A+T>Y(TC z2N3x03*P3S>8WnRp@oLItG$TN&d~t)N#B0jDp{x+1$1bp87MC>u$m#i0Zr+5q=Wbx zGStFHsTU}%PkccK11_jRwZ?7qlM)8*|ELWIiL38fU(d4ZG z@{dov+TZ4St6Lu`o7HQ#HzvBA!vdlST1K#Jwq1%2l-Wp^HLeD}`X(I2iq~(XR%c)$ zWW^hXMe8=>dhci%oL4~W8ZAl(be#239cLlCNcYTI?S!1LDt)+b!(j7}bsKZsgr%T! zz|_`<;Jrl)U&*PXhSl0Y37M`E#d|Ui8*Mg{m3t}mTQ#wTxltMb65{KtsZZ#(v(j*Qyz$+W z_I#d8CXvwXA5s%rKwq+mGxW0|?H;JXRu9=eC60%4zCopaS9it)Up@z}(TU5WJf<5j zq7~Gs{$#UV17y-&R~|S>hP8BP6oCGz+@HeGT)-@NDTHC4XHCOHVPLK_l)6^%rS{QK zXsw-hw;+#JoTKx4S%pg2+s_`fcKk~v4&%)CbWn0CPqbZ|Nv_#435&JR_c1ftF$I&B zC|DAnSqX)R7uI67QbI{;k1+zUEImNOG8&~-K;>gg_l+wO9PHFAPfoMMM7&D}c`%oGVR?Y_`&&x2?$ zD$s^XP0-6bxw(Ba1NssfmIDUnnkKY#ut;jYr08<|sKHA4`P8G-unx)a_)N9bY68N2 zyEMor+%(AW$TFF|{=ct8* zrXLuzLee<@lkQ<_co)E&HnCV)@eUzWBn^hVYIN>>cI?HKb$vD$C&_*JcSX4p8@>h= zRFCwHX%VmoG|0jx!E5CUm?l-qo$@VpVB}eZzi?bEiAr&*>h^ioAd+KY_9y&AdM9H zmqgtkhy)R1<181C%f7ngQ4;V@M0yE4$`&~avq8;OYV`Vycr3C1eB)AkB#ak=;rEsz z3+V+)g5-D30^#Nit}vvJIv&;7dsYTR@+=hj%I7zr5TlWNr4#darn(?OC!Psh@E2NU zZ;mW?jn?qG`*&+$!v~-071<@M8l$;fIT-1I5H-3sDZvJ+rseK{3Vs>TG&52)~Rj2?X}S^2Gr^bof$p;g#b;Y6+MC{mt-W^tINE_sOTE`l~Efh}SpPFm!6 z>n|SYsI;=kMgI8gA@t;b0v5$84W2OkIXezqIY>i-R)vHq7g%X5l*X;Bb5f;rpOj1k z#sFa#x2`Fr*_|Hk3~(t(&{sXbWuHvCj`$5|HiZB5O8w{A`D4;(Ux+C;btZ5~%wiI~ zE!0}yPV#fF5m9h241%L`m$*Lx?41+F#_j3#fguy+%<*tYm2!OaPW%P04Q9c3*zsPk zG}{+4rATm&_du&r*C>6vZsN=E2SmQ1#e$5Quqxb;Y|rrS7$YEi|A@YF6uv4bPDtOw8SI{Lk^XpShQqCfH4nyq&cU4X z)HrybPB^A$p!dj0_hG8;_~SJ%FmpXI6>qdVNIBYiN4`^u z-+-M)0J+2K8l#0SY$Nz3g6v(gz3sgond%E!q9^Yu%l@W$h?QNF4vK*%5E*s9N`?Si zgYd%Mq{t`w;xAGOZnWQleqz86vsKI0SwvcGwbA!He~%ocA0W%#|IZ+#fmS0i9vPy1o^<(n(^*g3ME8SRM{QR8^%gcFGFsr ztUvW6KpL06VABx9ae#Do_B;Xn67DSi}%*8wD|n_<%2}se@+3<2TwS zHo#9^6-i&E$)U-4pMM(rFlyDZmrScl`MZ4hjb5yvgO0}yEE zRC~^B&`pt;Xc(XU4Yx;_@&UziMk8gSpNZ9-UyT3`&*G+vp%6(7c=OwIj6GLvc~r57 zNa55H63~GP&u_D4E|~#o65-Nrvcrdsjxu!of2WJvCCh(-TLbX*s>ldEdbD(XCxI^U zj%Wl&bey8L(nbI+a8aFtGdvA6Bd1+P``oB~Pd0vUknoV8#hAOVGANch;E~z0(|qkO zha|jznrj9vgKfe#1Qqpbx|KpFKZ?xx6I#z*ey$wqF9cFK($BFmhGp=bQHW@2DNwkS zT97Plh+}QeI5?VNo(r}bHz#HmI26dOSHcxeG6jKBlDHpjr} zgRU)JZa4)hs|u~$!J*9NQt|4+P9jW)#c-jum^%{Q*8FKwb}7lF;@e)F;)aZ3EAjMQ z%!d*X@oM7+T8`xl8g@zDnwGLMd`}+uCp^Ub&ygyx=9oaMDwc9(&~0@%w1;*+PBk9S z3HQ@$E=)iX1d+9aYD!e{cmAw=&|fh{9sBTFRPkIB;q;BjcE!jOz~Za_hcX3+7Z>Kc z($&FYxzx+W$&qEa@@?Koosdoe=+jr~R38(xZt_?Kk z4R>aW58iD6O=zez(4FK6Bqq9W167T1KcXjIR41aj_UDUG@k(RQQ3{qg`SA}w-K(h{ zp3Akc{&FVg{COg#|9di55A)qj;c{bKcivL0>9(2_c-10Xx#ip!Ae-P$uKSG(h6+V} z75Hd$$ulRg|I}|=>M%7dhX{-Ix36-+O?1w4c}vuW@K7feZMjsQpQ|dMsY`IW70M3N z-#ejCJT`;cAyE<&Qq`SEZ;O(Tp%2?^;*?7;1BoJ&l)q&gVC&xbXH~@4XOpRJ9V_qt z=0>y^TB5krggW$Re66N`1lGHzR8%0ys? zNW;>_UaE2W6Ml4pf-KB@kSkbB39J(26kKy6A>IpnwzrQ@?&f)7=vu8oGD^Fyy*<9% zcI`ti@sgMWI^Qs1t|&z53ye=<`nLR9ej>?)WRzoH$%Hq`4AbV>#hHZjN1qqAcF3wZ zXC7*khQQa>?Zv!Fl4Y3cRz09@l-6L8YS2OTWw1Bv!7WI@G&Z-EBgIBdP!*|u_81ZI zW!VE@UR(lGyN$=a)!`RjM3Gz&^>1yk;k?1?&}s9nh4ebk3WXw-X+F--;*|B zIagMs&7s=HE#g)21hMKi`_CfH^e#Og9smk!n#W@$e7+?*$Hocd<4j5M%py>}op$?6 z@I`2cj02jS{Vu(L?(%XtAQLB`4C{4&JJ>W>xzwf*mPA)5KsIBPd86r-KJ@g8pbS@;<8HY zw%(PC#wKhI!bFc)2|Khhbep1tW~DO0L_la6^TAZ^D27xvgZ3^zq?cWf-@8xHV5gDh zAsT!DviAbpRu_?Tpq2zqU`PQ@?9xT+K92uua{ruqql&C;K{hhmWZUP<0CIcy848K3 zaGOKqJ_1J1!9Xe^+(M3FWK?wwJeJ`Bx`F^uX!)3UZR2`tj#$%%Go8zZB1g0KriBT_ zmSy>r)#&wteH3Zw^&gPa1gwcgudhd6Ax1Ah3gl*PAHh`*S!B;=%{IIf-0F@@g-lwS z38MN5x-k<4%;5hyrZRw7h+%iV%-$+X69o4wusrhojdd}tR@)2y4$cSZ znb(ss7&k2Cv_S~_>@WOMIw5dSy^_16p+_o)ajPO=kAKLM$nYtFdUl2O@u(<_D1QB! z{iV^E*18}-^T?!VY4=<fJN1ozj8`1b2VDcpfJGh-nuA-p4p)?Kbdv(102hSx z7HtnOiMKy2UL&$~NL_y7>nZ@?TW zxYad@g@+}onYmxP)AOf?+R(@nxz|XS&UM&i7}z0C8XE@t(6q?7Oo)GJ3$2SIg^%j zS>w9%?OU9q4fEll*l3*nrlH$I3s&+6S~puVB0&# z)U3Gw&~q*ix9sVf>&?Xi?iX0i%lw_<6_TSOoCihXBZBE}%w%st8iZMtS6?OseszESnAAWc43 z9u4Dr2Insa`QB!91`UizbQB97ezf5*|MPhsT71%x@;!`0b6!D&%Ip|(z=vL8ZPj!D z*hiWW1}rff*^x|bUH40OhUdq{Mdkd7NFaO!o`47Y!pC`|o1&OBX1+68<6V*ek#Yz? z9iG*g7%Ar4K1YSI^DU+LRO(tyCYKs=)Og-dg}uF`5o?t9QGUaq5U<_z6_tS*&L7hx zkZC(P_`lS)Chyu+5F=%rHHkc(Ro#|LW~;&2lw%5y-)OiL=&9+eDHB%9CK*DlG2ex? z`O!(aAr0s^7*33*KqEp=7yVJ^zJEVW8ezh_+!MWe zfNJ1DSReWJY4(F@8ZTRy?;@Ze00tGyZ_OHoq@-V1r4HpRQG#u5Z~7p$VC3FqcORdG zEztWwjS{xry*L+BLh|FdR;TL%oRP=nN`U1}vi>Uuko*D|AM-tFGl? zz`#IR{C9J7W~`!HvaDUT*2_}ie#y^L3t9eCT@MPH)4y?(k=Pp&dDm8@s$A^KJTmC6 zC*P%z(h?!Q;FkRK~$YqbEgGWG5KIufek2)Cq)7Wr(H-T89oZXqWPwd~#y8p4QH)Uv)@+8J6rf1cBj!9U^4@Qvx)KF^zvw=f*6L=X*`aU$r zu*DPAsWQE>{6U{i9gve2abUyUkUS{aD7aPx$m#4eddaaVw3i2hxq2GO9-+yw4DL&(uZ%evvv6iVRvA>sg?+GP zDy9)f?x=x33km?CAe&$Zk*5ZD!<>#}^_AkMzM%l=)pv`7bC;BCJI61Wv?n5+FMo`SN}Uk!<4hgQc~IS$ zF>Y<;Ui$87Se3aFHr507gy5M|*}9OixUEw#Y7}wO`FSd;iET0q0)Dj}8KEMQ^Jc9P&Sf)U|z`SjGkUd7w%5+}3WEeTfO(NA;|? z%*;C*2_1jX@kRgitjX2pOsI8@FlSlJxuPm2(X2F)uQ_fsF7g9IWHV8ZBG3y{z-2fN zBkc4(@a3v4c*eyOg5rPmRpmi~T>*=?*hqbq{aN8OV#HUFgSQuWufsBD?0Zv?fW={7 zin#;LZ-v0Mw6X%>8+$HsWvrO%iP6Ipv)X7)8>6i#*KiluMR`BuM#hR&!(Btjuc=_@ zn&W!*{GH`-CV7SVCz@j0Gxjk53ftB$uA)1bnaD%%3}-J{SBt%&N)mO8bRLu8AgSi zQ7K`ex9sD6B0l8gJq4hK#uuUju;RPhXT*V%xSddcxXvphWWR!)X%rCht&M2u?^|pV zXTsTJ=pg{=5B^cb>e)X zVJs`eiR*HdfCTiaxL!A24rZqZFp>26jFD5nW?+Qrsgv(fK|dcJfw%EtB!*``})BzPf z6mx&do?{|bUUh{-TnFGGI|MKDjgyDQQX1V|RC9?pc>_MXqSS^-vR0{6Kb^b*P@_TX z8Mm|Lrbi-d+M;vbtrC;bniPp@-udR&7mvbMJKWWh6`$c{R`3USP@a@T1Ta2p+@S2} z$pVF<A$LmVGh@eIx zW^mqhqE??Lh5Sh(RD_RJk!*L{%x5?>zHXCW@D|yFbI#(s9P|Js$$PIEA>s>aEQhkM z7NE-Kd8A<3fIl|J8n&@?iULISXPNs!+s5x9HQ$~q_`#!@lvE@jo6<&8snStUN|%O` ze6Yn=90$V(ouKW2nogtiP0;o|e_yH%vj>*jx;)Iv4h^~YAL~nk5*}1`h2P~YBLWH~ zU%B(CL~{0DrHjiD?6oB3e5bE?tKh47V8p2u%2=k}$@=RJ)0+`T6Qq}okRw-8o=YMU zSIc&mT zgwf#cGlz`>773;bemR%~%iMRAqy{(6`JRquw4!8gH1sv2wdTaF{?6|Z6nE%9wt^_K zUD(P#S+c8u3eDWy;c!2wB+Tt&N}Awrsgt-Zvpu%e&*@0Ekn4W_LvIskDeoC7o8%Q7 z7tb+S)9(~xcIrFbW9LBN?pkg{A4xY0}SK#q39YY z&?325!UZ23Bw%3FgABzDi_a2k%U|gEp8kblB0VrdCmu^bPo(TT``4*b_UiG6C_)>vth!u`l0>5!wSBYXicCFm3?i8LNA8*-N z!~L_TN`s= zTgz$9B5J%3@IDGRx5X45MNTo1se;VDNUa~*`TEZe_5%#GQY(+i1zpE$5MnJJw?$<3 zON$%=_YmFVAr_#t*7`W0Bd?z6MCCmN*jmEb(B`S2Al;cW1k!*koDDmzFd8E6TL`GD z_=ck}X%@4h7=<*FDdvZ{%u3$UH_bpf^nVoEYBXV%NiBd+Mb0qN*IfcBDvj%7`gHK` zdN5lzYx2Wt0-OKUZg>T?9CU%oOXCJtb-)Osa9;g(J3eL8?jcnzP`Mn+2eF#nEM&=) zUaZC?F0GDQHZS+mIakpsl9&-T46MrA56~RJd|YDq78$%f2KzB%Npj7{+fj5?sC2I_ zY4NIbuncOCBcpbxWl`UeK1k|x+B?r)zp%)O)t#OrDU$uu&(p8);T5{kmkM{{AexfF zrx5<}F;g@;#}#XGr=OcV-NO84Qp74g1Idj-YWiVTNl&3d1i4_GyZ!rR`+?xD$5gW0 zj^8QafiWpT6}eHmDJH{DlUBwzZ?XpAU_C)-a-T@g|8n`cI{E(;>W(ry=|27@P%X9~ zLu+VekX*-PC09y0ai)Qs@?SahR)1MbBWifQYoboe6_b8DhmhoULSj8nRr;f|-@3h5$NWPAU0&eE%ExW{v}ca`lg$i)T{S>k!zv_5K(cJeG>M zxs-t_iK?%**2O{gB~xq;FWbP~qD?TF$( zrXPnIcPofhUo_~AH*2yBB6+=1C~BsyTO_*N4@MFp4$ZdYgiW@rg_BCHv>~^@^p;)l<-SCXH&x)Q3(YPe9y+c~te-W1USN5GafCQch-VH37 zfxx#OrfEVX+m!@|n(?0;OyUdHAvX*Q0n3>R%)eUgzZXoxJ7+fa7f38WNixp+SQZlA ztZyvu14v{fAA^6w#){4gbSa|;5KF-CFl(-5|M!q-DflBtqNfy!p#ZOtouP-uAv)t- zonJ2|5CR9+iF}@)OugpRfSa!I0!*V4q)ltg6+EXm?n45QVmaU!18o~}P@+RrL=!AB zV2Xv1aztcRR$tw#?A{vG%2&yzj7N~G&)O8til=hJNaPPZ?PqU%DXw-OwkxTlx*3Q& z{0^yeNXtFPvIpfvSDS;K+GU7gYPh;wC4YKGH3`OVnaAgQYS(*%w<> zW00Sn=Hv7VZGnn$ZH>`f7G;>RYpk79FeMA%oRWXun86^@e~I8p3VT>Z zUrYsXD4{rk=5oxW^ZwLT`s(avlb3mqKFNx{LngkztazNVr83=q=?g%1eK<0~TP zhoW*=O%F6)X$t`2CQAF~WqHH6^wzosvkAv6h`kC7ZK`_mDVkJ%{;iH{&sF7NybIpL%x1J5K~ zGpKPG<#OF%Yl2D4>8a2q|0XJAjwG~VOEFZoSr05aU&vuf* zyG!kZ?XmFhcyAYRvu1kV@CO^tPXdoFLl!G^(As9rIH7>HEW9k{7Oxv8cY#A@&@Tx$ zUb6G@Hc)Yz^a04j9bya~2FcFR9B-x52a|)kM~5vqkM8!beUy&T3Akj6oN{Ln;}XLz zFl=o|H)Dh0eXm&}*n^(%yr8B|!gB`LCclG~0fKSeLulkqUofrgA7j)JoDRe722*gv zNA>Rs$-e6if?u6MBry>3P2R3m$+r9`ZDQTrkPtc@KnO1qX2ZtiQ%!d&YJ+m4p8yl} zbQNzkOLPT>96OrXX1W=~o&7?NV&&r~*DwuS%Y!~kwEZ4)as)e=Ek3Nu6H30DF&!kX zE=!A)E;uXg8;BYYlZi?~=wkUPwtW<^B{aO#8-#yC2!a(YoWcWqa)XGQ&a^W-4Inko zynlpx3i%E7Ms2vfy}JT05ur`!!=#(jlf!X|)#B>bvg9H6X`-W#zS8qDOpCGEH4eGP zD^>OJARh`>s?paE3pdZ#M~tHVk4&uU-juBnLnCVX-dYfZ?uwzo^|td4;84mQcb|rY+jzzcpwS^rydB zvn?LRChRbI+t=OJ^to_Vg>B=bl`tI8cNdj0Q&AQ`ZoBE zCLDTf;yaZc)Mo7G5X=Z;b`0%wFMsS44^aj&P_T@=r9RL3pdV^Is zFg)ba)Kcbt)hdUJ;QUodg?2#cuF)&Kqjl49i9KTW>PNM>jIA6LRjz@LcRh|%CZlOd zdh@F@C@>E{V9zfZG&@Kum*3;i0}IzscXH;Yj7$q5G1B7?cd$(falYt@0|?(o5@ek5 zJQYFKex3=`VGMf_FA!+wOYBl12}5eUv?V+Z9o6ylA@u^68QXu{vQh{bG4&Z1o`kx5 z50YLZ54!IiSj%2!0&mPRo{L$ew;H=KDf~@szBMy;S7&av+D3bTp2h(7z+OaJ+-sEv zCj1BYBS-#gr*yeMRII!VzS{^F76ra{2IG0Gr`;cDvN^mYN}w!Zl+s|tk)9=Mtb4Jl zJ62-(BJ!d7$DcjIM5}hZG`Ut_;vXkye|08~tjkwHBn{RD`W{YEhoYe=vGi+BWJqe? zCQ_j1%0c@2cnVec2Rj2QDwR^OVld_~IdHLdU)x)qG2~5!mcX&+Zt(?IhU5A$)-6{U zu|coz2ZUN}aX10lKzPM5EriJ=zLXnE_Ilcp+vo>HMNnDyxEYxkPDmp7L$H~@BinJw za<>y2jGQ+J5ywa&SydKP7hsi@ZP@)7l66;T<=@H}xQG))l)X#MUK&eI=WH#KDbv1L z-KQ}Ir5qRDYbAGk628(Up12Ub4l>hY+dX&9hUhj(B)u8^I7AJC< z?^|n`DnFG2@MfC3o-&bkZ7@}XD}fyU9>#T8-s*K)p$OY>aAFen_{eCv9v)78MlhEpLgG%CC4oy^*dT=8@iH*y@F2?X8hq43wG1Cw_wCbU=z2-BqJa zZ``aS1b!}ZkH5-u+2Ee;S4+PqM?_v;Wckb_dg{y8GR5IoC~KZctTP>&*C4x|25j51k7q@<^ONH|Yow`TFr9r_hB`JT9N(1oy{X zH_58!Kh9JnrkwaQjPV=xQu+n;mPqwNq6=+C-xWT9#(_jwt$6_+!%_KHXF??gE#Xii z9bb`py3P-{@-ia%Wv4sJ=a3L5%q*Guz41?^31%T6GdoLDIeUB-R}!~G#}($NzNXs) zN49fNZ0Fi(S*!_(i$&(4I0#x5{0t`${FQ-Dyt(rxVt_fkNnIC6-u+@fO%9yIJh}LZ zz34XjG#T|7t9Y%6ORAWXcEsgkdMo~{@_gkVov+o7hm|rHlE&{of*fz5>aGvUt9Od? zl1$T#EHyA+zbn3rxz^p?^i}*}F$)n`64XO@-#;|$y}Fi*@ym+?Vr!odU(2PYb% z;&C~X=I!Lve?fP=b-PmW>6(O#R3&|KiZFq~8ICNyn=?r=59)co6aA>*84(%jw&Uo*9X~?1=roGxD3XE4wa&kVF|{QLX7tv z-4TOu^!E2yr$dB{@bZuT6Os9SyFkkRIlOBC|H*bdZB#%DT%E_r%BU*RkN%;q9oOxP zYI^F)4xanVAWq&{njlZqAD$wgr#dJp14nhWYEk32VG1&{nv+Vx)ULN;y)uVzE z{yQO>!Lj~+nz+3a8Yt$L&2h)!W|SbR4$2rQXlarmmWS5hO^|#RuQJvk?zv>5+@R5h z?fO(r^6QC)j@@mkb;h$$N&g%LViFKTTGT6hR4f|Uklv5k7w)lPGZLGYAa+kaR(F}? zGH9hx9^tynpR%Jj;gR;LRJv#6&&cL7VZnANmiM*?OGGDrWbz9r!tI@oDarqy9P@Y%yWHY*rqreR#?Wh#4XMglD9Fd zMndcvR>w(dGJA{Ms7$zo7!{5n6W`qU)KY0sr5^|?%jc64CTBVI9~e$ymsf@mPfyKX zjnob(+1UU$S$!jm540~J&bXx9C%gspbRi90Vv79n%{rP`oF$w3lRP-G8|cl zUDrn4a_ot+drL=k@Dthj@tT74^s zp!8H@O~~?Z{PM^`#(q0XItO5fQtF^uH$+o8>Dx!nzeBD#|uURA{s^86eB$`H@{;)fhsvg7wR)!k|JASTgw zmi&QfC_k+@&&1!aG}|d?3Qrv;*N- zX@}L&=?|I0P%0~pe6>W*qKgX}8;1_I6kuh&{A7Q;yU{k^XBwFDx|=3M-Rv}Dt$`SH zdHAXp?Z0DWRE9LzKRCDPQC4cLiJF+_?4FIX<5rKn^%^2-j7va3e|qMvUdh1S{n$BoEVs$M-RiE@6Q(!C~kSAKbkzf&1(2`^5uIZT{Dez%LvGguPz> z3c$dqsVI?Oiqm5z-TMdOo-I`zu*=xM^OmnE%l6a8VAs#tmLJG6q!iD4l(hOf@6bed zHc0njOv)?#3@GeodHknrhK3?zOh26oY{o3v0#hZlYu`@cw6E;J=GwXa@!MZwTeUiL zjwP&_4fKjqn|IW>vv}f)xiugl!*@rFtpg32-NL8Gm*xJtP3v4NT{}yDrO<6SNa33Y z+e5I`eA>Gpo0WtC+cw{}#-s-sie=R1iS^3uOc$sfwOnF<6dPKJM+&ZCGY>BcTkw55 z@vdoLV=g*$Y{_!FT`zdVZ&F$2Hx(*{p~rYqEtL>m|W_Lt) zqz|Gi(zYR*nOKtWJ-BEMml^&Mz#5q55q2H{g687A$vKHEQhb0~tTagBjm>8_wshJV z*@6SG!T?gU)9fC2)W3iO-~SnA=3%pGgicCBLzalkN*H47eGpfBC_JV{eqH=;EZ;x5#4(z4cFFIMOXHN*yNp%lHuEn2rl^ z9~fT`h~c#3r9C>Az?OucFau&`6g(0W#-CJ;`ka!FHTh(Vx{*mp>&i}%C|XQAYq{1Z z9Y%bz@H}wLxn~NiyIJ@d&~48z^q8gbg4vRy(~E=d+f_URkoY__EEFyx zr7)MZF`k!n*#T#}P;A&q@q%#0ty+koOfHmV?hm`<8TN8w!8-))!>euapmuNV0rwi3c+ndq?O&r=cERC6=ZGk?AhyHQ`-JJ)U_3Sef~WP0qF9W zsE@9p1wd0{75%j&x+Vx1XuDC8MUlYURcSwIM6E1TiBQ?JM+7#XJYs>-aAGxT9wjKh z{wjQ-oOvJ2!XmGZeW}nP@8{k{#z@QBQo1x$#O@VC5`jNatT`T5ohDfi2z)%m<7B~# zUn+bx45;M&heEFL3GQMAv%h%|_ch~YOY43m9$S0<3IL2O$%ZAK+QlLx0Af19*nTci zJd+>emd7OS<-3R=noXNyxdGwUF%bb|>gtwAzW))vu+`X#>l@ItPE@G)3v=U(k0(mi z;}=)Lx`$5G@T@=+ZOmei0x$7jdwFnf`uMQyIME8rZ#ct4rS$+|-*HGz4smc4r!@`8 z`Z#lbQBEEQ`jC&XEHWjoNK%hAgJ^rORVeCYfL4w!q7YwbOusJRVygkCLzbvfH(1Jk zfzx*cSNRh1tMuF_sYLsY!Ba!i;{RHIWH$rUYiF9Kj;uxrh1iHp~+Mi8F(D<2%FLU~t zdqWLgk#>T_391F(tQ3Waa_>&a_cqLhez;Rt_|XP%JSCp9ng|*_atx}ejoq*TTU&*_ z@kZY0Q=LSdV1U195JzG`pY(G)xMiC4rUnUx2@$u9HbWVIKY1E_bbkCQHH9@RbuD-mkVl*;#VaF;o@1=NWkV5>=}`vxWO#@3V!nxdG=|sYJ!Cz$-<|(SljF z$JzLpPBT%k3cL#ha@Y!gv=Z}6p@wBh=hgh5gJP-ks2 z9PGUH@e`FWX6ts}oQI(Dm8lowxKs7^r+Y;xM#8-d@BY@3=4^IZJF-uO7I67RZwuq! zWiRy2(|xUxR>XJH`(i_fsgU>TgntXuYCMDz9ZX9wjWhX%g<>Kg!dzLUXwC>{anAPd z#dbkAF|wFC7%jKcm#|x}7onG2v~`X!xYnF`m5#CnFo#jt*&Y^r)H#pUcKTNfHlRY1 zQ8=ViEXS3_a;X=deZ*)h`uOX;#9XJ+lePrW8aTTMd~2&>EnR|Iu+=9qRIcK?@qj4xL8mwQ&D!qOM>lT12UiM2F<+Yt#lWy?GPV!uIX0nZ zm;Y1v3GAY|$RW0eBpMetpaZ?A95k5d4W2!16MBn$925+hhqcc&QWn%f9b@(q2Tvu2 zwMTmDfB;lLtG{TtM4fX+IBvMk@(iBVhpdK_w(+YOy&wBN07KiHzXEx76uQDyvkJmu zZi^!jQga)j{aXw79b!!o)WDlCU*6dScMal@g>O^mXOHXAAP^fdLjXG1Bp(QfyHo)R zPQLNHt#LIfY{-aT%N&hQ)pGi<$V-_xSHKwNjtZuWM!JAqp0MWs9{`CZ0m(CQ9v{Qo zaR}X|Qcz{_=SvGl`1Z~d>o461f$njFkXF1Qx#E<Ni6Rdrj7>V#1!e*C-7V65kYALzi^!s}X-5X>aHrAax$*DRkrz|AmAlogjei3?S;N zZHq*<0(o`c;2k^$rbU`KQ@6*}q1i(0r+@W7#0@)aJDK+yk6z3sb9K0|%$aiaTcx}R zx%}=^s~-ORq&E1~HB8z{07dp7_#KB8Tw1^&tpYPHpnU{xWR#xjYi|OJ-ZvTbW9#aOfzB2@MBFI%bK$(!ugw}6Fzqqc zVlx*!^g+>r!ka3dQzq6o;Zd#Hi^q{h~M{_B+7hwIee?NoB28M%VqN>JBs5%?Hg07mw#l@ zRr#tC?djJeZPdGwz?jTI`(7iD>yg`B!ZgdL=b#O0ZxA!s+negqdyeOS@Q)&wr8dw` z=19YjykP={297;oXP+w8%G8qTZcD={iz1g)Bf>Q(?bV`y8xg?mc{3K7SdPWDN9v`Y z7+j?jfJNk1m0KMM{Dbc$3oICwL!2wgy#GRC$9?&2nKhe}j*9T3yDdpU8UoBd#vc?o z(Cw>OIW%ki?$+arxo;VwT6+F1XEa>@*pX2Qjtr3nDlfu*c|-4KV-}%l0K2_!iG;tI z6&W3qT2bhD*r1A;RfEQiEikoYi>Lkco>28^MljJ_)UVx-d6)h8D1cTb$bAEYM96^k z%Bs0I!i(nM50YfpdYrDi{fu-Lb3&X3Xr2%V|~Q z(!(GZ)qhd_TMm{ol$ashtg}^_bnCI{Av-*dFb7Xrje3#Z8thq>r9cAynvi9838bL0 zdcm227sP31NZJBhsr4|S!kZfPY$hTYCC|uT%^o7Qv$Kap#nL{|1Q4oa$Nn~X4{XG~ zZz;e@A>Z|B(nTPI$L4idE2GMQzA1tK$h^pCqh9Vp12LRxKpjZiLsWzLzh*TYr#8Hf zk%UKT6E;rs!eV45VQ@?Ca0$iPzkKkv`PX-pa&ccnsuL1j3qfBYZGBwBNt*m1eHB)W zb5~y!O(O9fHhY$l0Gnv z*+V$?n~+&;8IqPq%!ookdEo6y&n7%!(_t7_pZWhquL zDUW&+X;;1;LHC24NoW;i)<&f3?Hw;&LJm6UXryS#V!*;#_A04~-mTJTkCTpVVRgtn z8#1Faloo~>Q#*#)j-bD7q#@BBwpqTSA>q2q7f{i~4U3zNl0g}BA$$IyzJ)o#&&Y!^kNEcYtO@MW@pRz|*(e$CGghnwa zvTmkbx${O)Jb2ZX*#@Lvtg4qwH*T%rYmJJMM5RL_JRS6dU}29HZY24j$iROvq9VL3 zi6mZWWRXMJ%*Y75eIe^w$OQJxy@i5!P7Ug))rRyHN;e`&uZ4D|kjbA3zl*bKLsHGD zZ6gnh;f-5-hi($@ju7*nagU;5i6^mxzs2)E_ullvxLu~1DKve_^`ZDdK< z473^24>bi1nCg&IA}bX1>?&z1$jGw+n60`Oq!^?LA36h%^u(W=iz|2;sRczIjNs(F zksR_6KUC{p-B=CW#k_SULxHtg#gBAD)dHfya*Jq%X=MIgS3)-STI1_L7i2_yADMot zd?$hFJVpRF54eqnp3d}~o#EJ+w++v_(Od>kSN(GZ*?+MtYk2PWz?ua=_Z`%e zT6@BGr96930(dRcJE9?hsKXa5A0l^|XJ%x+B{d4o6tzl8C@0N{z`e^B|9x?kAtdZ~ zu}!YaLcZVm>NAiEP*Zw>gm)BwA=kjw4U=bV;lB@nD00ZOh4rY!+3@9+blWP(hFsM_ zclIfwV`LaP zR&V1=gDTvhn9c1WML192vQWxd#|xH0oc5iG-RCp0qNN5G%9O!))@&bD4Y8ezY`9`O z2+`Xcz0`4K(gU4s&F|!}7tJd?Fs2BXV`*=h2^+73`RgPjQ#%!fXaJ9=3&$oIAPL?jP1l~nHG;i{YjAjSXM(+AQmc>muc9S0S`lJ!-Jl-}L zr7v{?e-jOkRItG8;6)ycs!Y!*6tVn?YT;&p-JVs+kR?e$;Z1?2-v5DZ^Dy(R0Ks~G z%{$kOPt9v;S?^07K0c#={F=>b>UMRDE&r;Grv_1!T_qLXBx{H1 zTEUmFDr3JJ;amt;qqZ$fTdvXSh}MQDDh#M8G}?n%5xDqq;%FTg_n)4b8PjnplB0(h z>7&KHb>EI1A~}32?3vA)YiPqc#?cT-t@P$?#Ry`apz`gdQ)EUP^b10>qe)9oiVT}q zb#HH#Wxl*89eJ@t7QAuE6%1i(YSJa`VVnQ1W3sO(|B4cO0(1p#Yr7>(W}dX6%}m?+ zn+7)dz2E)ONOJQE^XB3rdr4D7_6?p^dcS)EvFB%*G|IU8FZKe&e` z){R?OlebV`jRoijwrQjfrT&)62ap>tIdN7C9vI>A23Q5=XqwpBP8vz&UuhI>lXz-% zG!o9)Hqp}MxE3m%!q{OfBkCBns1H>j^7yPdUULg@{$v`^iV}}Z52pC_cf_a~xvP8_ z5RBJY6!52^H(wjnrBa(9Ul>g`uG9in=5q?<{OmZ?VhUS4E>vWV+(wzRKWgW|LMy&q zzN@ONZbw|-ghEICI$Or+Ytn2wxL3gjNQH1CHLW@>%u%s_zm%~b09d#X8EH1(wJ1?W zhfNwENlI05cp1X)M#EYXJ=zRxsbA*?Ovzf>zOVZ_L@sM|ra_jSeKV~`;|%^<;Ks9@ z+ocP&c=Ogreid$XPkkq9mNS#vtxtaTf0R<;58&2$u5f-WI$<0iny)!U3%2W_Z^W~3 zm=;T#Iww~=)O&n%^Q;$tN_7TrmYQncQK#~y>Kfkt!N-{Psda$hNRPeAN8AlikX=pB z=yFeW??FFNuDOR58|*kl$?Rs)>xsVSChAagLydh3{p_lsSv@Y+erj8MZR~Hr-Qz8> z@Pjl6M~u1rT@Xy#5$VXdtk}C3tY65Yh-GJw0KO!bl$(*A7Dw+eTE0PNB*-Mvk!L)emZj4k^+^(MX38FMf1>+5%;I$;ZXm zQhHb@rfI+aD5cnlBZs8{PqM_6kGijoSMzG%>I%f)*d|OG@X@4kDcG5jjSApiRi9wi zf8G)iF`!If96Vh#+4S#K=X%sgnp7+w^J#%(a06P0x7D-G5oQdxzE6;|1S8H1N!eMRLQwf&V7DzCp4KNFE$t48&3ozHrj;@ zZlOWvY50kg7c+ePK&ia`{>n`+W6!427%S4q-EPZB6Bd2h=nNMlez?qWRO(T!gINY| zbA-Az-DQ^aJrb9}ze9&ETp56VXl+IL-B2ZDY1kMUn(m*Adc0Hu?2I~FB;k3--iMm>O}>b!Sf>`d0Ry>H{_^4l@0 zF@r@IzPN;Fn76UkMYBNn+Ye9<1Wu?}N?))>3V&3jYwL`aFFrOe?Ru&(NXtb+61CD! zBDP~d#~D5jbsF^oVl;aBd@YY^{r?L(qKr((Jd$BPT>T_xQ>f+9M;9|j%K2fn2OwEW5gX%?rw#tC}m*ivgEw5EI6L+p!XP}wGJ*)LB_d&(xE z3i_(k91uv^%Z#cVp+A{CF4ChVRb4UQ_*r( z@(<4jLzV=@-z@Gp%tT1tC~)tKYH&?7V`vI zEILS1M1@*trRm%t5;*Yts@LZuwq?l} zg}dm!-kye`E?a|4zz-P`K^u`C(uucK#sJ>A-8QROHlsyVh&-OBY#|iM!(DMRYXZLo zWb*LW&4jAnyW-MjuE~PCgq*ffRL=MLY$P0s5eX0jDmMHD7l;a%KVR zs+%x2?=um?RAKph75oDwub8LTW7#*Ipn{aBu$YqL-i$>~Lg_ppm^htTo@ScgQF~09h)yVI2ivjnho~`*t9f|oG!?cNXD{ z*i)LWeqr~T1}%6R6P7DX3#e4KqjE0HtY|M4t3ST%2}sHvX28(lD!s}c-J#N6-o(5; zk+Jk<9Sz8X9b@6u$Moy)hv?Pk_@%yen7aB=@vuz@sJ}I8t1VSu##W6+@ozQ}8daH<3NBmXH%0oYdPtnZAh(0om~IzP&ncLZY2p- z9H`zBx6cdiC}#q#Xwmlh^dnq%#n;aoD}64rR*Q7*Dk5761VSrkh4~nXk9;u(-TFG{ zO`l!}p^;qyo+|WRD&Goj>JF-yKrm}or_w&}y)=ExWRk1s(Zr-o!y8KVOUW$0AlnXU zNq$*a^Cn&MDlOd0)O-KY;lj&p$%$*eEQ`2Uv@`L&J?=$CG8d}$W4*g35eJR(HKiUo zZ4#atWQL(G0F0y%n$_;$ePH(}6bTr`uXZG_z>A7L^S<(o^lNm#oIm_3=8|g!Gc&jhFhwIl zdDZe?HQkyj%d#%dNq^e8cu4E-TJtR)0?byYnLE-Y^-`S%RRphSxSOV`QJVtl>qq9p zzxH+IhQPD`)KqR28K;p%ffsd<7Q zOhXWM+>Ax#3+ocEU`s%R+~Hi{=c^Fx}Q@@0# z8^I~2?FK7r0*7%95%yhfh1WH)I;ROdf!K>a)?j^ZDj+3xNI)oz7}f@ zX1lNjD_m*jmHGq;$2Qy6_BOX*WG7_ffcbio47grB#cldwV}zH6B$UHXzto<9} zm=tmw-(S9fZgB0A=f@~`8AwM8D41>`?=UnNj;%RS0^VNd?cGkVW4D0leuco{N8p8~ z{0>{_T%X)@ZheUOsj0xxdAx6`RcCl&6_|~2>hHT4DvQ`u=UStEUJ#?fPe;DiWaDA| z+s6oq%t4HmfZ%{A6r4ElkV_S z1|m>r6eTeN|0}D(lkUEj?0@1-v0;;WeO9Vn)2^P+gONf(0tk4ZuzSR&CRAuh`)EER z`7O{-vL%kJwDkwmx3F&PF>oo-%-F(?yg=LfFlrbmh8%M=9O~0ROhxe7B&;}- zW*8$qJ>(v1&Qq&3sL2+zWp_Ii8EMGtmGO9v*kYWb(Vf8Pb9(Y9=<2Ou8)-gb*) zr3I|cfFjngZV*D$F!#09*Vj^xJWEth6j(vn8i-kvHqogQ%pEeTB1jA~R5}=^2|a;M zY2lfyn9*r&dZ66?w9*u{N2= zzhT2FwO?w&4GV{6UlpPQYSy19ysjd=a?E!ST@l?~w~Zd#bwb7VRVerr$8emG zR<8%t0awfpnU-z)q%v&)XOw{1<70WOKV{2AJBzf?K@$+^JwGm*E%hJj;O72#Z8wiM zUi1Y?T)()7H<@ewN8F{w=yB7Z?3M;kH3^iFjWb4WXhwJBCds-a!~u>9QDA)_viL@p>u#`b z7fkwj+}LpJ4k{n}I^MtlUT6M0>3JmXIpLq}=0PiRichBjZft<-7{#USAbav(lp53H zfGFlw7r;))Bj`9!!U_|pldNmWp}6?t534JSjoZoY@!4HE@VwW2CNrVFu&7k5AA1?E-GFnPa1frZ`?}5AMU6JKc?hOI(n7*%8udSkU+yZ1dCz2(uJY^D(Ni z#Mr{N;XI6;SysMnnR6 zER9s)l~Ocay#fMbodl&A;zD#*;@v5^F(AR7>J3x-)YgBG2`j)!~nGb zwe6MgD+#M6yg;qe|aLYo!GqR-m)xy@}KF>i!ypXrwrjE1%6=0**;RXH8$g1 zoo-%-F(?yg=LfFlrbmg>dLj58WHr-o1nE#JK^YBGFY$a}w*= z)I$nAG;ww>eJf7_3zA9}@j(Bg4fFX#am~tq^Gm?RPeY)$O<3je@Q;2k+Cjc(pIe2Ti|dRRPL zESfMWK~m~j_2m2VJ1)-cPdV&&z`52JQUEEu9lKX%X@^5uyg!0TTdW@KB*8;z=t%s2 z{!6~Sfn+RH(WK5)*P{;A8@sfY)B*#`M_Wp(8FickMo5~o*_x4>+i3o})%E?(s<$O? zGFTiFh({iec^O_DUL@It+>V)ZqH(V~!rV8=4w8bW+O+ z4!|$3VkQz#70i1}O6MH+>2z9l9&w2yY-;TO_};$^;9bYkLBZ_xx}^?NX_W&FN~kdp zCyKDZ-_=fY9K7T;;F-;s1wm3Z$NUWl94kp46I>NsO`YImD=5I;d4K~ zhk7NIDiDC%rvoP-;!@?kATtlho@kjC3pZmiwG?%KF#Or816SAAyvHRtuI2cx-k+4n zphQd5HBL}0P&nAi_mZ-^bq%Ent({Oer`4)$eD_QmYwwH+jY!{4yLp;+vgjrE7sK!5612Q2lk%qM*`VDRA~o7jt9C|@ zb^Ad>KN54xUU-_d z)A%2#HnttXf@S87;?n7RpsDH1RmSImE{&BtPF=cGQoqsx8%l^H`}A_cs|1VF7tu2` zbp^5~v+_SSyl04BV;`p;8m^?+k(G3aC-p8C3-DNolr^L=uYd$>==+lSiW{1V_BpI+ zj3F$MmN&-3YG?MmD??O9kE$jd{4go6G-C$1Ml>j_)o(_xpje!{MqQV%dY?dgU?!q- zcOVJi7&q-z9_ThhUvL|SL5Vu0gMX!aEtNwWrMtXr7JHmp0o9tm?CBXz4i}ITRZEf& z+&o40yZIP6C6!u|ToQGWczDh&Zfrcfj}OoVF0Y$Mh;Z6d)q@<|DpO&D^`M)rS7US6 zvd)Vgrk`qRv%y@5MUr_90S2sG1$ZvvJA>>uS9%gw=ls(Ol+Dcc46HF|2m=bbI@X_M zC6JqUxCXjC@etxO{2iblsUzlk66ky9vkT)U0a__|7yqkAENf;I049*vay^~`&bl7{ z#CW5DGhAW%^&IP6+s-niSv1dsRoN5XcQ-Qfc3PDdF8jn~n6oPiR&;mc5xl+uX~$OU zbSr|v|6)D$5#;-}(D}sYUg#cQ(Rg=)8y6txjEQrAO-4_(#8^8NFAEE`m$0+Wscy{4K2PzdQvY ze;?pV86B`+$4=F!#Y0-Yk4@sI5kFpJham}=MmQ{c#9__4mtJcDBEYkuFQ%17Dx^RI zwqX(vhup8!wY)UXX|LTOi(Uy6*LJZxHf!~Hb`DlzfF3vv9A}UaL`i%(AHaUTB+J3P z_N*{TYp{YqHgo2_?f>E|;#WNs4C}fpdA{K82s9H*zqy!vkRN1VztAxoy|$|lCis2- zfRlIY>Sat{j@-GUAW^7iKAB@iTaDfyXiMZ)>+&RMo%5+e>GJCp&;HCOcO>6#K>~W& zdyPXIBt9(gOQgE!|3DmM8l9ybZ$7_$d3<>(?eR~(P&&?mkV4daYOrz{i_IuR2djN? z|KbM+#wN}ifeNZ@y&Nan3RdS0LyT0vw)6!kBRVnMO>2neYAsfjVT5IR}CaM zxLtxKdXoFI6p;({+$D~m*R0Z}rZsL;cp4Y~S=q=W5Y(hY?50G@ zh@5S|TX(ktFOZ7cQBepYn3}1l>JW)C1khK7zaw*4IGt@0E7Y*_2eot+{atUl+p%`E zO0*7VdmLu@601bMi4nwjOV!`X)P-tBtp;C<*?aX}TqhNaaApb?s=|mjD)B9wv#7jna*=TDbk1$td5$jHKQ5Cf;%;! zSNVNG>wc(^ObwS_cLXU?ZagFiYP8KUq#N(NpNeRxGUIgvI<@8Y4>=#xL+{;xp8V+k zmSE_B)HD?AO|0wkao=s5oYedRSAX1s0C4%&vmUypwY?36xTOcu1$#nm z2#`zV^w&aRAX!X+b*v8yZH%nJjEj_ANOj7kCo~I|#46abQe5aYJ;6>tvcvv)HKDe3 zo04W=9b~V5hQZGC3=|!sGXNlnVhh9sQ-&AJ{{CY$02el@0m_(o!N`x8H;ieB1!=8a_eBm6B?px#c->rFP>%B(8VZ^=eQOl8 z_>UWMH9b1i{{~y9L0T_yei8luQ=OYcyUwx|3rZoYur8I#f|!S`H6h0Qrdoqj0O-gj zlr<-Da1cO-W${x-bZ9KSkouoitSS9}vyjcS|=gIfS`(yeY z1L4HyND8=eb7vDdgZ8q>sP?Cnr`{wW!bfbA;zxX)mmTm#p=h~{I1VQB7MDlrozqjA zo+SgL)$|K=?DQ1&>tm9(Y5EBl`wSpCrPoR-CEyx^rXpB@hgAgqu$O}@jxgyjL9;KD zQHN%AibOhcoCfn zY{to63u1$DJgyTC?VXbuuEc5AZX7cLG_Aq0ll8Xhb)B~5I+xNcO!xJM&^p8R?duqD zi))2;$lvd?Wq;7`bo{?ieN1{JX-+{dXZBrL`4pMoCp5Ky=^|q(lUm1&v-t{CJgUg$ zheZ7wYiyo)a|yTgLEtmDlq6JErGh4G;RkFkWxLS@Qcr`}P$kdfIMrkeRB{&rhi=cG zN}&x3p;kLKqd>sr5wh82IF3k{7_j7b)NKn?^7}_PNZz5NspopxSGWYyN^OSVia8kI!T1VJdxu_WTV)IZ(ReSJH*8uWU%54WrU8LRKjfbr!~*vB!TW zdyH4~BB!TxzIU-jG1gbZy?zX`X3h65&}W^yw`@+8Fx2q7{=~PSX-uXR`)yOUmpF3T; zVV4+;Xi?H}^a`Hk01&ewrz!7o;6(K#$q0HK_rhp3TB9jo zPluZ)rt?Rij>KH3{yp~6Qfl9tNE8noZJU~2Q|l0%a)M=7*HwtR>RcQsO4;k(E`?$1 zJF50(UmvE-=7kuC48@La_V(4vV=^&sNZMs8-Ltlckv>#wTkn%5y{cy%S``8%t_!6v zTEzLJQNpz6^};N}P;|8U2Zwz3s=Whnfm!UzW+q!oZSuc%`2&&um@kclMx@PCnhX8R zu20>p0qof!e{S5}JNT;&DllO@E6@N(%+D*kd|QKZ+w7!+UCDW$TVqWx`y<1UrCDWY zd?T&pP4o7polY`IiFSJB>{E=K7x6sW-Uh6%0M$nh64wxWJgd*YZxno1E(ao2y~(_< z*kn&o(Lv^L=_CMkO#GCldfB^w$Nlt>?=HXgJ#@BwHMaiZ6b~WQO3TxvEQ1((;kaz* zisx&$n`FiOZKjAzb&I=qD#H-JD<3AR9=tnHX&U{7#V1yF69H7h`ncnfsF4+E{SQMk z*sI}QtS0{#Cq)!+;yK3r#9iyM(_bGF*|Hbo1;Iu5$;bx5H5rAqSU_p~MqD_mjz)l* z1Mmm-&D=MpIX9RjD$o(gCF-K7o*(d0Q`pGQpBiN6Gm*R+IwJV#^Y^9j%RBlw+0);F zvNb>KyH#7d0$~+_0djM7DJV-$@ANg{r32`a7A63u(QqNO5ChL6oJn3GW$E1R#K9!x5G4z~?SWimXHs;S zSV$Go{R-j3%fueeeJyUrM*%1kCu!;$ z&SY~!sE~_|7R#yBp1R<}RY{sc`2^AK)cdxs6avH)6Fp<*kSzI3K(ve%=_fb<8)MVg2VbvYWzC z4q#Mb;{=NxnC&uKl>C%;11eU7$w*rD5E&T;5`5O~*}zlpolQT%Cokusy0RL=4xT%2V~DTs_HJBh;Ak5nEMO;cP)ZxpBm zl4nAPuCE1qbMV-B`D2vRJ+fXRT7?d$E9W?uaBfA-cdL7pAZT_~hBEM9w089MRpUA3zR_@j%Tk%&VaWirW(&Bq1l(8(6Vcm^gP z4>cCd>;Xw66lAS{n23Aj4%!G+30(KYsN&rrQOk0FRWWppwT_g=n{~^QSJ*MbkRn#r zrU1TN;?VyckHfbx5K7<|4bcn%X8EW#x2_3$H+?6JW9e5^(d(KSxkdsElJ#3JQ=l9uuZ*@#Sp`oO^rY@v>F<>PQytNW3@Zh} zyXHvwHa;>e{;0IoOp~rE1Nv7)tU=IL_0CW1;&xg^!hL%?b?xJ?;z<3*e1nyCC=28n zQ09A6Z@;r3`(1W?KMSBcJ`$cYAsAXKVr)@hx#>sH+*e)&zlQ4sZfDumKeXdZ7u_TH z@FpgTO-}f5?m0tS{D-=PhI3oHDPfs8ukX4HquTlf*Ia@(@Ndw|h4O)Hzh9X~-Q%dQ zOr-pf%^3O(ZYJ;7G!bnaUC7_iq00^uJ?56LNiHLD`Yb*4}DOeCXbAEDko}Q*O zkEI^1fGWdC8JncNCC^E`^LB4@9GQhN5&1Msm~T9x4;$Oay6PHPCp5t9cj7k{QOu0r zP`V=I_;&t&3)eskPy)M$U>#QsH8XVp1~SPB^XLcGt&!1yo*OG(mQxldkww!hhQjRn zM=5IZa#-Lf0v=UOsx##2nnUGHw92R&QJQjkn-LHu63g1YS9aKUdJ zP1D5Zm25cWq+qz>PY$!2O)SC%6goBjUb1j*|H-c(g8Ab?42hj;*Y23vM7~a4X&b)QPS>ho)SeO}N+uJW7T|ODjDZ4wy5x^GS=#b%O z6Fxd3YgkUj*w1c?TTfO5P`#>OXv5lq&GrG5u&T4f@%Bdgf;mUXTWTvThwqlg2-^G$ z_d3E1??}VZHkDP)D$?mvxNV+(SGF4$j%r9)?^y}!^$G-shuG?e3Ptyz@t;S!Fzb;M zWmKi{iJwK7{mTm~pE$Q(z81?xG^+{r5K;<6r{$0^(o+=}%x|V&ar`xlBCCP2U@hOL zESCfk5_kfR^tLD?t5%F0o(U`H7e7UUUMo$xbaW+U>pwZ_Chc1``Ke4n75mHcz%pBzsVbZ!NtqsM>HS1|g= zQHH3>eW`W}P-UZYW2?#K2+Wn)#>H$09Opf1+xC7LD`bv+VNkS3ikRRx*4A@x>(AXi zjYhbcq7cySL{s{55Xz{!>r)A72*!;Mo+LgiX}Ng2_iIgGvk1cl$x-ZrnUbFlAr;Ib zulIgyS^7Ka6LAqKO>0+uL1ntRrsO*=^yy}vmz^Zg+o)QHT52$DwrM*Zuz^P1|JGU} zKI2aCIUfBK4W`^r`ieEv?lTNJl%&E*cDJ)$>Ui+{K`5|XVlrl_U>|*3Rj&DJK3G+p z9$o$kij0-Y`VeR%VI3$C3Y1DLdntVScmO3ajsaL_;`re!Xsl{m3?uQ>ASl<}tw_kG z^7ty7gJxe#_Dvh0Ph2o`gs?CLphCZE`=v$lO&G^QdFo- zY{y9*hEh?vXEW|$i)$}k)Vt4Vec$PbsYWtPSsx9lSe3Ppm-}pbrb`DbU9i5Z!kui0 z1U06I-_77gFKe?H*>DBlY>$M`>cL2i2k=DEzkLJE6I~Sn?WQs_|Eip}($77q%6*=rLU4krr55BVhnCGY@wn@VjX>zRHc8*EZ{FP7Ja9_3(tK`RaWRR--B z_UFT&j7WzoQ#Z=OJ(oIsceL5-jv<6YVh21{a0X2K%OlFyEbN|`#Tl#H78BN3xAYBA zl3T7AdbcTwbiyExe{`!IH}Jp+xUrZmd@j8w_Zi zT6l3`%%3FfwMHixIazYT({?m5>V^$jaq+?+Gx7ecRGZX|&O%*8%Wuu$5JCAzHQBQ< z(C8Wlg$@JX1@Jw5euscd@}K)!Z_xDwa?l&wT=ul^WDe}06b<)$ridsz+?CY-u!hk{ zGN&K_tQIc(*JoZ^G%@VAp>C@i_{3M!S>iEyw`YdYj*4}$bIoGwJRsf)z8%#8{!kk{<4IIOs z;ptF)KV66u{$`}_-pukBXc*gOxN(59#O{iyn{**b@IK2-oHBD)5H`{gS;3r>Ztgi{ zi{+K7$dg44n-MrU8@ZdY=2#bMi-8)fF z9o$?7Sr>Ue<)xfWw-qAJ+-x}jsf5)7C$F3SURpIurMQ6%&U^MkWPl-p8zC>V`k&(GI6oy z#ws)E9Sz_VA)NT9usC*|CdPZX;o)|hpuTHCNEy-riM~PObG_o3PSRd~^4;u9f3i6a zDuOHGJvBQR5fM#1-%M^cMa@&fWrE=WC@kl4j^|pI<{HIl7TZ^44%xI)@#x-`|MD}H zvJa(XG1fW2vxUq#_m>JIBCk9)N>hz7!kQOXlm@u$6g_aVP_ZLk$BRd886t<05$t2= zbuhtDQ)(${dqioQ`mnbEExl)of*>l$KeUaKv$hy$KZ9u}c|4 zN5Wwwi4FA-bscbs4>0cK5^D=vhV-<1d_+!rS;{X~|cOwU?T>HYEDHhk+WdFRx^%=BS!{KP{_u zHhDhe-IR2Ov}~pW+`qE$5+07(4q;3-aaKuxwijGwkNH0d>7DrRUP;w1JX|`0~yY3=8%Uoo@O;kV? z#W%GDBY$pG1Cjt)@0;KbdR1g%2*_J9Sx>U&vjJs>GzJr=>TK4zs{!m_nQLJ&sfE4% z8PWqj8=P;o#9=l|Ui-6`0DNJG?$4Qf&fDMvxGk2UcQ=#~nu;?JYWJX?=VheTXq;({ zCjNKA$E5buGVdqp!)www%h0?42f1LoKO!1Qw3TevDyPr3ApUlOod=}*AV{|6)S65W zP|>F%!kmLepv(-H6}&j@0CWq1}7tNf~a>Jxp`!F;Oz z5C)qohK{S2p6<^6HR){Xi1=WAY;+d;-*Osfl%~y~@8Pu*W;ssqnj$N-w{Fq>qiG%6HyKwIbNUSgaBDCTg z-+a!O0PA@Jjy~f{0Ceb;Wd}_CYyig|d)dijGdeeNzgS| z4xeZF{Ly$xS)aCU(MC2xOgLhSIA%gw9t8-w4MAk-9lgl?2% zv^E}uFobP7$20*QmmF7=56WX$ZF+3s*qzrA7uh@-0H z#$-W)j=SRuL%d-Uj}k?vV=ZX(g-P-LWw4xLq5QfZWIwPZr&Pw%mH?z5i_+9QNuMqX z-D>yNnAoLR^Y)|mf1~(2@&V?V@*kkez(+95ymjl?oi9!t5nM%e>@zH(H3*Y%ug1sK zFQdi)x_@xG|RA#u^+8nSc2q$B-6%ou{1BjQcX< z-Tkb$S=x45H(LD66*y?mqT?)G1d%Sxb zgPD=~0~GT(F#-FGVKKK$;>n&oU;I{;vrg@cy{+e>Pv242p-}knIQNQnKPLKjlAl8p z#Ev2hw^cjd#cpG5(ELX+ycc8Qd71pf=H`QX4UadvJ6mjc3WIe?#;MRf+41hZoeQP`n`?}f1li` zebhSYETg}{>uPXvt~3Vx!JZfPF=5-8;Z4^56MoGHi3nf1jxNYD=g4=WyW!72yhGQM zj!KOXhvSRJ?Tm5e(|Yz(!?w6|t0UVmI6~cv5ao*>OBm<3;v-JhuPUk%)Z8w>^CrlZ zb`H!j&qH}!R4C_u9T}BuQqq6etu_~e^vB(e*$IO{d1O1`E-5t_Lo5{*?dJe+K##wB zREqLv`@p+ZG>jeiG kQ2uB-tw+G^9ax);w?6ypCVAnd8s4iMx^spZ>JV zn;S!n1}*)SVu4s@B)+;+vf!88V?!Zt?jEq6)Z>>fN01#yXr+$`SM*1wG}QE);PefU z*#<#rL|!m>nuxdAGWaL235UNQ3bI42`TH@L5ADSBL^4z=&T~n9d!ZRaCF_0JJoQ>%DKS}OH5R`02`vQ`31)rZXo5gDJ0;Lh zrV`L5_6}Vi_-*PyN@05#a5kxBiviIlmfSs_y-(Hn&RsHG25}x+<|?~xlOAMNh6Men4xe7wq-eZj4m&9q0x2nl90+*<%4U{BEeOWzA`qB1ZC_ zyy-C11DlxX-=d65>;~eq>x%(doMm>MtL-HAp+;lKo4qeJ4wLc~iqZM&XAIioFR}0v zL2qL&U*WxmVv7%9{L5(Q(2>k0eyz>6hgoNA7j4AVBIL5D$28imNgHQr>qL`C%2AUb znBFK`!VZxz(_*e-s8Ph#@*^k0WG0+ z)U%eZ=v5Fso_RoOpadnR557Ks9TdbA#N?I=wV9r)7c%bn>Qg7Q4EK_84 zx3<*0l{p9VZyJNBZ~8GpFA8Yb80&%iA2%*O8`AGdj6@^U*d-}tntm$_7I@XGOwJR! zK#<dC!u#GNRE{T zC>ek543Wf+UwSUzfke|9Jp}pA1+m)m;?B>QAp9R_%c>~tCp5Sn{G~#1GfRbV#BjN( z*rE{blAY$+$=R12{95r+NhSYZ8wNoTfy0yQ>@45Iq|?jC@a8#vi44gxLyUwG9zX<| za$JZqxM(#m5&AVlF)y8RPBFE{o%o60PsX~M3`g4kdpW`!jtHU(I8^F5JF|w7kz}KY z<~I;Hi15$RKsXWtOMlH=v|Z9qj|*hMvN(U#`uKXCatN{+Ym46?m_t{r9Tp~2W;Js~ z`U$1fUgO4-q~tXOo&%C!XMQO~)-b3)5-IwtK#QwvoI9F!bSdO!uV~Q`kVWR^RKgt4 z378+1!Ji}wFXfUtv)W8ABRF@tEkgC_JVh;8gT(+Zi=YWS2XL&ezqM{>;|5fUbRG1I z0jigO9yK5YRIT*zAao{n(igxUXdsob{+2I2UCKj@!+B`%F_4Oo<+Q(4w}>^)Bmtq< zVuZ6`p>X-K&jx)9HshS-&&t}Ghq+#^$|=*bkRwr8B#umth`{YeH9&=>We|cLlI@z zb$Rdrm%XxM(Akdp&w=)Zhb+%^Y((E#;4ss~Sv@gS%5(Z*E`DC)=4gHnLGsxt}JHZ5g3Aa+t5~bwHmd#qX?o^6l~gg0+%Kup?+Cvp`0Nt!RPb zBsWOfSF9rA`@1U8Kh?AiJUwiGn0MOTaf__D`K| z7ZX}(7muHKjZeSxS9iV3(Wb+dL*6xFKg3q~rV8yom(PNE97ebqH2|a}q}yz=rH^kB zV?DY$tG3^pBn;j8%UvK!j(;k!@3^af%adyW`qi2`u`1c)30hu-IjUbs$|tu}yR>Wm z^7f{^Vv^A^L@%9kHIP|ym+DG%J|c$XA^4e#O?#)(HH8rtdk|IBs|8oa6H5E}p8Hej z%kbSYl~xSef|#H(vdKTA*y@#Qytxwp-fumHfMhu))r*!7<~qTUJT{{ACf8Mv@N6b z+fX`8Or)7iL2yeWum_IStDOgi%m7Kn1=h+k@8LQATowJdh;H?H2=zXDqm)#+q<;DX z{W_#5ld}F4%px*6Df=0|<2IY{tWPF0HV{wDDyM*DMpa=_c%9md?M0YGM}X*27-R$! zG|CN(klTiHUAy&JjA2aa?6GX*{ov@>dU+sRrgA{bxk-6}nW>gi6=0@xYq<~8lq;NO zA+?iGTLtjlpzuGXi5cXoM8XVPk5k+b42Y3Ru_iF>#0v@yr`g#8cO*e$7y3-x<%7qQ z8n6MjGJdN`fk&FjE#S|aUlSu$T+-0nZCBmzLfIC@BVt2U%R@~6UWs$&W90o$5E-kc zi-hNtX*$N7V)IxVt?Y^@Y3IA-+~aT@pv_#;kWO53xqSibpMi}A5$o5)&EC`TI0&6kWWBj!&rw5Xcv5XJ8Va(@k17Xuhbi&@Jm#<2d_M{5$bchmYpQgQ51$+Is8a?QPuVhV7B^dABvbqP#BLps_U6$ zm5|6q!Ls0lp0MMCP&g@R5I5Lcnf>i7O~28X?$a{+#k$*xxV<-gWL(Z9IH6(!v*@;j zu40Lz&RRVG>>@u}VRIiLu#YjOM%+v1rW>p%;0O0j)zBHa1AAvSj}BCbF;v-q=QG3Q z*9t(m;;1;YaS-UNKu|{>UNJSuNN5Ulu1a0)apgg`t5Zo8AP0&KdF`eMl0+@e(Dg~E zih7e;GZW?jF7f_flGmjpS7PjiVd~aa2zpho1VkU`p&ZTc>Rs&*!k&suD{y0*Q@Dm; zh`Sa5(>e;*QmIyswm-L!?W_g9eQoC+60-tGekT>_pIN7%Q6FWW)m2srpS5j=4%qwr z(75wQ=9f@wvg4Due$@YLvWFq)fZ7cdG%-(cFO7wmlevXC8Y%c5)yqmN6LlZexd0+w zDy%KLJ(&fMD;fgw+LwN-e=bA4`nMOLLh>8_sk4*)#7>s+yUOLXVmF%0FaQO9$qP1& zB??7|J0BYDi&y}|PQ}5|IYBxZ1AJ%zX`5SV@9Eur=9^Twuumvp&z)0@TppR*0CbA1 z#K|_z{Y7ZI4X;+DD+n~J{XNrre}R?#4ZAU6dy=qRn71VUL1L3>*SGUOu{K@acXgGQXAC2WyEyesQ3s_f-t84U9{4GItskc_x z2YddF5yrKR(hb_Ks;@Ca7Mq&D@klxp0Etn~kaka4;s0s1E;y47SW+?@)H=H%YpL^% z@6S{6J}{r!)z1f%ZZf;+5kUc%|Ubh%vS6wRFjK8*I4jyE*j#=TFOQ;wvxz6cNiZphpjvb7X zTO8*Oh1Usm1CJ`&!2{D!3mObc`1z7hyP9E`&F#5n6IjQcQpC}{iC{$PJk;ZY)kW3#p&EPlL=7q1 zQe0z|Cv&kTF6qm_G7uNCRBK8;l(GQMzcQD&Ev&i!ZQ z*SoDa)cV%p4tJh8^q$>zooXtTFUC@=b)3>IoL{R)mdI{`wDY!<=O$W-Mjf?5%~s3>kLF`qq>dBb`sn_Oi^1NZ{`d6WnDtndb>8-bUjfDj%R`a29_>u>S3ZK21))8qPly?3KmMYL8`Rm__ zPRq|AQxyN3_@$Pm@u`+u;U>%Ooom*=`1Usl;rmb{uyrAi2zhp@e8Iq~>RV+&odTvd;Q^}$wf7RQK!%N&_bV>jZv)Op{)tBYq_i!I97US3v)&)a$+E1(_TF8Vn_#1mkD?F0UEw0 z=czZuEiOz`zBqJ-e?THg5^#u;%k%r<35s!8^CFDyx?DKhhUK0|dqLr4l!<}s#TJ27 z_ENN=o%g=I(Gjx62xn;@v@icRiQpm1MkW0a%~XQn3E56X;#u~__IaA0nha|_N1nV$ zh0bjc!8X*Fd2}L-0*&Huu-UsJ4E24mq$Y?za6~|WpgAWUGaO-LqlA`Hy~#T@pj=LQ(YFA_|zz&%2*48nh1qs`_8^(=T@7 z4^|@iMcM~2Q2M}w9;uB~zXd zS>|>BGe&A9?t*GJPn^Qo%=Q%r$eLYkuHUW$hSbwb)6%G|uY?cOb~jCCOt@=d)AC3#rBNPc6-KDTAI?}FNBHrMjs+405zpEa zJOt0|2%!8HLWr03#Gs9KQ-g$@#N)CQ29+>u7D^1ioH&}O?uE&RjsL28D>aQq@(W6S z&;o&Q7-D2^`F7#Qqnv-xNZVCzM>{7CKXz+)kZ}bRR9VJJknluIV?9{>aHlJ#mA>EwG$M zkVRUt2tIAlT2nwP^iK^CX?&Udq8iptFUsVmi9jp;n=vb=htb#`9wLDw&=-R1mL$&A zKEAc!5a#KwC~fhqSlFj5Dd9QRdWQ~FLmZ=e1?5LHBn_=Rw$q_>d#V)HvTei(Skf8;nKL*#p=^gW^ zVO_l#Mga*0@%zZ!U24}}r@$O^FO0RJG~?by-4Z(p=2zH@iwCVjMTUNJp(F?2z3I&+ z-$T^Agqrz6I}wsMoIv~J-VJETyIj3p2-;N>2Wr2QC{5Joc=EmyLyA*fQ}SQ0$8^Gt zuYT87XY0!CVLK+OYzY7Kpu<}SW;m4sgX3qDw^i3Dhr97_W^naj1q;~-lxLaTON68R zfTeAM~K@AVA8oJYy}w`cFZ-(kA5@q5mFrLrKN z2}fM-JxxE%1_^9WjE3>|X0#ltlgZNYC*`@Y@VKs|uKf16HsWu|={N0yyEjf=xwv-y z=qe^}F%eH_E1QARu3M5x9qeGNYq4O}qZ&4x9Zc?PkaK%Zo3@3aB_GN?&HhuwSpr_Y zriVSvu|JOxv$|PiSmcLmm(npCTWb-XQeRRiC7y2I3I8(Sr84gV!oD zeCj8qttOdzeZfq3A<=`|&m8Ow>qBBYfxqIQJGUf8mpjAK4Cfp$XB_+bs76K_-4}`M z!tlH!Gl(j&JTGBsS%N8vJU~2j>%%QZ`@)%GLy=U}#6^aFW9w|JAdp8@M=5=8Q-7MT zm&{aHh0A&au_YPGJ?Ac$#8$TJ!hZQ$TkfYzYvWU~lIgnkcIP)# z2gC$=o9P#43R}n_dfO4@rNirF7ghfqKd@7@&OVkgr`#8l=lc=4t5fM7p-fyMfF&4H zNml5ON*|dXj8`$euv%Vm*j*y^)3BXZ*^Eg^0smU?*;hwkZUNi;Q!yKv{(=!3FruN8 z92*HD_(%$W@75EjNTQs>uK8I3&iNXO;2Degb?nlN1@szwLc!t23x0_{*9FK8f z2C$%uEc8rgzS-=Jovpr25~Klm`VY>zqD<7zDkh?brc6R>0BF+tc_nKe09y0S7mgNL zPBumV&v%~qj`an7+OYF?B{H}78;yOIwT)1#$tv(M7bG*+v3j-LqL6fCbrP#f>pnju z`9EtzU=gtu&u$Q{&=_~l+yH{4j?WZl&1YjHfwC|FL!#hlQx`DPa^u|j@L-k?xcz5m z@#!Yay9y5$5A!qrnn%qk`cxgQrKsA_Ubri4@tNw`Y8;<3w*sF^$CEC?1^JwB4rdZ^!BbVQrI0%nCM^I6BM(SbhU) z5LlBZzuPk|_C*x-H__hI0(3omH}lw&y3zCfx2deT;`h;^{kx+~ zfK^(#rOxuf4%HalJ6uZUWyztC^geiT3t8$N_hk)VDSgShlpg%NJNZ&m?R_)yYi7H) zNFy{i&v{cwdFN(IpaJ2r<$z#;Ky}`|eC;1pNhqlm`lnw!0B}1xVOXy;;3z4G#oV{) z>gzAKG}%mW=8oxz`xA2-3#lb1nnONwM$oPDJ$_{3_LIXsT&!)Xg%NYMpt7Hw+SMza z1BB;Uniy@lQR5$Itp}_mDoNw&INDlmw!`#R9HDkrDX+Pj2h!9T9_9VlBoG}vS&k`Y zIB$g%u?UEle9g`HLlKo^JOCAVMn7J1b*v&WI=|GacqWz{_bkMbPNZG;;=wq3&Q5aiI-q}eTn#dSbnK?PY)#VrW!lk7w9L_RO?8dvJNq6 zsbTeCuQFbi6)qTVD2Fyv&cT6HP>Ajyw)|6XY8>4^s~cp1jS**#{$>HI4^1Wo6U~!o zTVsG#cDFVjRPdjAiDSD0$CS2X^0wv{%E=P$^;Wc;5v}b4k}iVni4ed5Eh`FEskNXx ztce2_o^uzo^`HFgiGRt(1bd>Z2y;GUWHJj~cy~f0gw#kiss(BV6|>Qc_DUj;nbWx+=tlt#*`L|MQe6c=ghINlG$~eEk%p&CG_@W5&3H zX3Q~)%Ai)nP;XKjAK_s;oUurQ81UIr8k9$gF+OgT0rc6r3G7EkHGq+sq{36SWT-i7B32swHqki2kg)JUdvM%_1S59r*-53?ly_UK+3*;C2qkFrT&0bLsc! zZXY|De|xhYYJTdnmH5yeGH$ysr>%m*z#;(^4h4O+2xGK`WLJ(2szLo|s#bymPO?~3 zZ(&6l|F;9GcfGtq@$4^CGcgKm@iLcrqJ=tY^w@UgpClZsf$L2c1o8$mXZ<#^oTB4I zI%jfAf>sm5Ll|yJBL$Y?z!ybT$SG+3cy-KU2TyK8P!PY>Z~^E?VQ}ui(W0}kYB+6^ zm%l=Ao7}B-gM+mjR zZk2qdg;#pwhm>Fh8Kf)0zbY=sf_2UcRvZg0Jd*TX&&4*~!*7i+P@#V3<8|L8gaQ?K z=Jr66cei|tw^g3vnUdatfM9c=x^yUPe*$$ARb%zU#E+L9hQC`p7p&D3T7h zcw?PR)Hlqwk76)^fRC9H#mn1M3G6A1wsAoI;zF=WmVj<*lishkVWKEKe~eEwmi%6 zi_DX?{eG%LRi^K@{YCfpwK#s`A1`O9HokqApCZ>|6J(@G9E*7IN$48sbbx(_lW%Fo zTjY9H`VxTRqFdAeCQU#|N}l%k8&Wt@S9YelkDoqh_{Y~xi^tGmfnlr)y)9aiD-!%? z=rc~x26<-#i^Gc1!Ugp9mUyxJ|6n;hWdlIhsUz7sPOHtYSFuFF{E+dh9WvxmSu1+l z7hJ0s9K{KP!a=iF!;@iE1y)S{`2Gb7J{eOQQ=KdX{xl6!6s-wrbWZ|6q!=%vnxxF0 zw9kVR@<~)WOPoC=P+&V8pQwwh*J|h+?vJu&7Rw$pU)ymvH$Xz4W@!d4J~F||SJj0( zxRF7CbI35|~#EfEP5HL(3LKVhIM%8sJIeF}JKdQ65 zqekc$A`KA1&ky#7#GT#Z(x%=#MGN)+HA+}YDaq^w%0g#V9=TCbNy#Jwkv$WJt1(Qh}hA%4$x z1RU1?e_B09(=|ITwLf9^#v=slGmq=UNn|`;LRLO%V=*n;`p|mib@lx-A8Zi+YB0GM+PUI=f(Bbt6jH%*F!_kf(;{h_No=zBe4ZLMo8gQfF_;;++-neoU`! z*hIcxqL`r&SW4dFj)QND*tilbExK|=(6)!0TQ^4FZ+l075?&WewF>R3zw<`pBCS@PkbNS2oZ>hyRI2GD-`GNn7d8A@|o z3CGg;XW>VpIs6{x&gZcmZ;hFT%JAcX>JQE;GaBv}Vw0%oU70Ml=sQ)O8s{!Fplfrg z1GTDEEYQhb5>$@pd&px#JdZAFD9fGvwutBpB3p7!Qf>sMI60SN?i%)4{)fX~O)JM7 z`w-zv%+~pZ0TM@v#!reRcxT%+`)NK>`n&Ubf_iax9l6<~V2tJT$^9-AFm}KtkZBii zXe|n1kd^MdnjbWqWEmiu5oyNF^YB@#dF01*0#RzFC73+7lxzRQc9QS>*1WAzv24S> z)3_>sk`s!{1L|GiwgvoKQBFT67bQEx*AlAAUUCbR)IY?Yrpq1zm5YaH7K9Avd^xJU z&>FFB$MA@*EJ)<85ehrS!L-6h5}w}D7z`s;x;i+E)K)?zzg_&-&NAr4vPzgosjew{ zdeO1@-TwaQ3ps66)yS!et9N@x7c7|~+yUu_(!IsS)@xFty&tDx14cil%6YD;aWt1$ zP;CyJz*J6itt_cMQ+_c~eot&}3LqrJ#!zVHfLhje#6$0si2g;~C#ATcIqDQfVEn?W zms2(SnMx8QU>*RQn6+t&(`J$njiVwU#Rx%nW%yH+xpU_V=*ky_nvvKxnhC6*(;$n; z0qY;vy%6koe2gV!8wX;vb)uO2FQeX*+C~SanhI6N7pzqlMk0nUdVX!R*P#>S?BoPyex{U0h&lGaV|h zs`LC8nycc+nVhwEkM)7I9=teOwFWY!Om0*d4LSjR5qO^&Lrj#UzKs;TiGD=^id$~N zX&~R0nv+(=t>n8Ar3+d_<>{oJ1?vl1MpihM7$JxjOC5ribu`CXW@ofvq=*hB#8fag zL@?s0?>Yf}5qO^&Lrj#UzKs;Ti9od{WEhffyr-f&7yGX_Oz47v1DS?iDVN1|f0f!& z^Yh)tleYw!ci)WHKF+xddJ6L~M2#DK<#M8wHIn_(ZcsW#zkTb&3rzeV+iA$57< zWy0xEby6UjmI7yslwqJA&SeYpMm|Mqdjlq~w5;Vg%g=&+Zx!R{6q60GR1qS)2to+( z`~~Q&*rgevM)cxxH7l`cQw!J8D;&}CkZu|o3aduP7eFl+rejt6wJlB5^Z+3DoKH|5 zqE1+g4H)5?*(@23&9{i%m~mBqWI|SBv<*=MELH{?i#6%G+#3d`M9m3*KMXD)Ln3_8 z?7{EZ(Tx^BN35`PMW&{l3*3kQ9QWz-?AQt;l3mvt+o^b@ucu>x{jFZlsZ@|tY0T6p`}HkH&DTD;d1^ zd_UdXFoIt^6*&LM6e5MNq}8B>%DhIiB#$!XSW+FywQ~E%`a`?oWhqB#N$k5ln#EZ3 zyMxY+xK;$LoAjsdeEpM3`ZR!(aflkyb$Kx=WB@CmJ8s}LK_ZP$lJw_|G;#jks2Qs^ zL-7sFVr-+LmQ`mz_`IObOsvLd%n7lV!&vOSk06Og|8Hh`OcCQ&102-a5v~ant?*;r z;0Fc!1|;71OeRrI$B9luzou<`Mp*lhUiPaSdTFsp5DjD$AwskQ=rE>44@Aw7_ zhqhef=OW3pi(WV@t+&A7!2nu$2Gd;Fe5xbyb(CGI`NB@!6XywO%!Ck+#fUb8^FCBw%n7HWj;*fM?U=4gmYF+ zga)5&>oTaJHNGB=pMFzI2B|Zca!$n{2Zp|G7giwUSlRC?ogk2biP}*Hi_-S9#5)2UoDN zCE;QQ_lRdSr-rl7k+qZPie!4rrJ;fWZw3LiS#w0sP>xyhT5o^=dqxq9qGCBVjK(w- zr|gEI8XWC^d_-21J%+DDbzbCrVWnX(b?kO!(kObhz@$I4P_h-^je_!vJCU_7%S3au zWgI1}5Lkq0)WV{;=$@(Gnx%xe9Ww&d!j%qZV`eNzR)4SP7SAHk_Y*+uf;qpZ4o>BO z1Vd3FtNokU$>D!Yj({oROUzT>^(3(|R}4Y0{l`Up3;~Y+tsZyj`lkHYrZtm+N-Er6 z!Oa=bLq!H3t9+vlXySUo{aJVA$hz5I75(a|C`(v$#Lf+u>ArxH=rr$*0$#S;ez2Mynp-qGs^WFnC#Wld^5& ze@W3nEUtu|36h#v*KRWKI>s=#p~_%1%4ZTz6PtW&T$(WkAtJvg(3@+ZfL1v?hYfu* z_T#V~l|LYk`sslCla^SlarnMMs1OYsXp&4rGc-Y=WJY6j4 zW-y}8Q50yp(saCBFIaD^R$SVeOV!seXmY`Ka^ysYOZ+J&uq{d<67_T z|MB~P6d;?3;jhosc?PWeS#yQ*3f4o#^5ta3xaL;84ZbUpdA<_xMTA1$EjvM}>r2`z zY8?D;N{y=DW^#vHZrB!+8|p;76rd+c74l2y#EhiJcQwx~6my(hZHC?)rz*l?02fhq zk~pai3Swe^OHm_N0S%RD4()sISRSK?^UpVNhP*bZ*d3a)n7mOZP?LscVXfVv=z(7m$^mIu1utfu1F1 zuYR~-{_zGxzQIjBcq+6gB%T**kl5nDS*{p+iFVEVycKHC`rK%Vir%*&r{O=nagQ!YLdmlLQ^b*%ozc7WtSa`1(%X4?PpkB zL%^kzJ3iO$1#_xYTiU9W?Td?hiz3vX!#(*3l7*2ZsXK*IDU(7jw!Np=FlyPtJ%d@8 z8$Ho@yqIIno<-j!_zqjzqj0bf=H36ShfDh@1jFd6&$zX|4Ji`|lT0ygalKAM*A)oYEOq@Ah}K z1Y)2(2z-y7j|Q!17oz$OKKgO1M1-n!?mShCS{awDTiBAfbbpp*4PjXTEJov8v#fnA z*i9x617n>8H{hcZa|`%x?f`^mdkglgoMnn9wsu~y%rF{NCO5{7yydpQ!1LA#A#W6t zhsF=^$cbFCYO8_7j2s z`ap9HeQKnVtNlI>tcnB_dA27kn9Kgu(TXOvT3}n|_g0`*VaO0HBDp}x806m0dn&ke z`7*-T)_CI*@bfB`YJc(0!iJf{=DD}m)q#%l~OkT=FdgzVT|y%9P2=RpB`Cmd0(Lsyoh9IAu8>hY`B7tt`(Xx z)3Rr{d-gq;2AAP@cy;1GY?PAyRJuriD(GAhQPAV!B(SE8H1bWmVw>amFuh>XCJh7p z8$o~b^8^~J)~nk}O1?1nm*zug5}!U(2ee2Em`-#Jmp@+~&xGx=Wy`$*9x{ZqGZdYr)zeTZ=jpzM5U;4c+rPE&o_QIxc)YjdHe@g%hhoEo?3kdC zBeFmXhDP9PtNi$#C}#46TYi^TT|jcgp3vXK{u0*oWo$!cDlOG`EThuWv-X599!yCm z_1j5;6t)87IWnyrB0I%|T{iK}9Q0OX`4OTXDiN2Okyg|?AtXXxWA@9r;s?&o|B#R| zttwYV9a>I9kk7J-5||mRthIS>!v{wj5%-dM5o1kig~&+TIt||Qcp=MuOVEZ3k2!$M zV`Cr1O=D)&Cc$i{DSez=VSP(nPJoLKi_yd|q>LN(jHYBle}x%|MEa^N>Dk!?wUi+O zEgvUWb!}MJO0xk9&B+SXc``Sd$iXE;oH$8>(>i`$nVEUr3sEYi-SRy~VoT*HpwA*V zG&(*y9S#VMH^j}UWs8;ppXkIp64N#?`$QdN4Pd`_SmT+EO6HCXC`7^+3-bRAu4zF!_1TgG zI}G#vHg)-Kk7Z~7pT}TIUfs6yz1OkcyP>VleNbie{x{9wfU5rIw*b5g-VjpLnM_x) z4gm?d2TP5PyLCBu^-1sxZ!nyoRs3ddfa6%THKoFdX32}ihP|A1ni*(9L7fYU$g@Z) z`6*3ra={IXJj4-uG2%I2rL1js0d(sS9iQxVcDj{H&Qbx7sNp#^gy$NUM^~t1Waxnk zgEYV7@;8#I*DHSHhxGZ4Y3uN9`<^ee*XryU zncL&E4KLa;LIl5KXftmc1YEmjs7EV$2lSIC9a6FS%~3(D2IJ3D@2_VN(F)l@G_7V& z_WY@l0ev#~YDk7__{1lF%(;AS*o0{PTr37v}*ywSTK`h12M58i_n{oR$WIobbH zp&E9hKZ;-Kyow`V=-gg$fH3xCuwvLCTtb^jwPF51Som6+x%-5mejqP%VoG_)n?#m7 z1Xva9)3=Mgz8W3Ab9(O0o$utDzV^RIPO=R4+Bo9j)i&%{(ZdL!$KPL)QE49>iEAsT;QgSfypW!+oPp9 z3UlfbG%r@Zh|>E4NzrT9TGRie7OvT zK)=T7h?b=Q!7mgVa{FW24V_sGwWR%PLjE{(uj_03wNHZ=MMl&X)It5yEvsoPiY1oD`dLJuLA0#-$~Nm*K=rJ+7tM@yEp@ONqFUdD#H)o3T<&)d|79D-4RG8hJ_M z>$b)U57b8w!j@F!^*qxS=mr@8Z50Y+r(Nv!@c31H*v=L0*eo3*9;!teSPURXDk0x==O(wRV%i#wc%rEq3Or~bEhIa{a@)s(RrhMAj&e&y#_ z0`2ZDI*&8K(P^ryqZ47QSwb5J**;u&h zR)S<&32yAPFfRVRngLy6iPqHP9&&x7mWpE=4Uoj7kKioenBZ22@foyL-lK)aS4%Eg z%?pc&8UL8igg77wQPs^8L=m)~+z=#X%z|m#>K3fD$p|GWmxI%`mO_sTVPJd$lgv97 z!7gOmY%l&SL5sSB`7$=ZW$o_L(0Pr574q+8cs6Eo|^!i(fa!9h8 zs7DRuTF2KV01Z;D$C?@gO(U>Gj=K+%DAsjuI2j3O>G;a2QEdInK59l8F$tF0Iq=fD z-Viu=Z#lk46Dz8>-e`i8V)*Z3d|4a?@+M)?1lyfoE)GiP69KA*qk@(ws!#6=4$dT$%Oi#EaNBDi8;dhc-Y`I&b zHOLYdF0v>aLaXtm%&T|dABjHGWDOiOx@l4u$xF8XOiLPyJ6-Z)k*iogCR=iyKExt-sRr}F< zgu(E4?2fIpNFWmWd*;^MbZ_+=NO_V*QV<$HzN3xt?@&19XOqm4xL9YfH~*8Ua#S5u z(A=~s?O_rV)Uy;x>nY^l)!^?R{u;2;z2bqSf89_q*yQBK=R7a52b~CpiZRs)&McQo z7S@s9PNOzuG|@2&#bCNbFv9b>t$?xBj84b)Q|I~H<8KVJz&^Es-vD<7{OYtqEti4a=*Aqj)4rH$Fmi&4Z<(I@c|IREFQft83hSWvPjHOiOk{tb&{4 z6)D~<9?rv>G89t)B|zH0=h7XjP7Kld<-NFNgw%uD794O{)G{p&FQxrx#Vs?11&I40 z-G~{1oee&!RwRuT7*D-ukd4LIZ*RWbdXUoJ9y)R}Jn;7C_J7-%G-X7v|ue%>N>Lzf#oiH!SkJ6e0ap!BY^5VNL+ zZgsb@#J~A!PS~@hXJ+WOOfDi6Q&<1{`xqnO+@*)7n87NJT=5dmW?LInprVFFLWY$&wAJ}m~lR?Ao;hBsOM{Q3^V(y z^kLc6VrX#J{qIbTGG#J)pFKbyNw-P=J@PTU%v@OA1NTa*Jdp8|mktFwT`;cnfSEZ* ztycd)Jt@oXw$uc8YCp5ND}Ru((pJq|WG_c#-YufQ`Xj{|TrT4AxP7!2H7C znZVRM{!yJX%M9NtH~&o)CxbUC2$dSKCQ%taZ20Nvip8ziOM60`o;+wBfriy3536rc z2>RUT>=0Q1n@IDPYwW3%J-GZR-bkIaIp4WGc}dJaEtBF%sl z(g|XQ|L})sVGO~^dJu?9*xC=_RqX7Fa&q=5sMkT4;WVSsfk*$ca}RB?bK$zT#i$n% z^QZ-DJ|};o+ppZw#+N&c3O>hgu!Ze@`a~f`T3%$TfMdjST}^hAUr0)I15P%Fkdh~J z3#4O-l#PL)^+*tINgE_16yGNr^~7^%w9nR4s{5-v9#wVJ2nWRvk?7wBFBWvujjLoo|qxMp(6wY zJ|LgWWf__;u;`Fe=OM*y5nwo(tHTD-#u#dUoPqReHXL4HT3@lsNJW$M9%}KXPn={n zk$`bM=vIR-D$18cDKvP63YejEbQg@_-H{NP+sIWH)F@py|G{N4ku^=kcnrog?cXvu zjraVm;Ks~uFUHG*f2*QCcJ!bn?RM|60{=S^_=TZyxH$j1lS0CHQ zmPi<(Z9?{XEy2RLoKebgP{7QW9#@?XHOl$(R${_~1%>R<4?W|E)~4X^M5} zCVKi968k_ZD?!1`WvQD_acyrRHzl72-{D zn|6GAhWW?|{$i&4N*PdKDq7tmb1udVP4F7AA{Wx0HUFBPW`+qV5J@d@n6OF1xcNC9 zIlPdwDfTHvhNRr29CHAHQJb8?vTWa}WsL$^tV?I^%Is$ePn|v-dc0_Y!`fOUs*y8P zN`_8*d}g(j5f%}RX`$u_4Cfxwfc5^|U}DR<#{3LCc8lRU&pJ~6x5 zznSq>)udHl@ZSUM-ZkHj!3+&iuw?Omi3OlEpiW#nOrwA0v;M0v+Y|D03;7WuHg;7y zX*{nvt615fOUmuZ?$WbcoJVfQ-6~Z06NR%Im3~F89N`e#7=Y8G8?CX0{}|90ph=N{ zoikB2d|+`edz+R6syZdi{^H}2$t#_-n!a2W@pR1qY@ud6{n{Uq0|Nbrc1_@zDfFRK zAo&o7HI<{qBUZAd6z=}`%H6=&Y`=-ry1t=-9krayn!#MljM)%{cQb)ZXBgKcAqX}2 ze5Y0OScWB&%R+-;Fb;*>Bad;z)YZK1@XaAJF3(3veGvlf>8TDfT7$!niiONNp zwC@Z9LQEMeq7;RK+>e6@umE#EMbvEotwbh^%%<@LcUg`d@Qd{2L^Yw^M@;EueySGWrmtTub2Wd~2Hg*ui+CeWIgMM7J% z+tA{}(Pt>czEN5uKK5J1xzrl?}*Xe@Lpo)t9Sd%e2sgpl8_o98tjlnHVAhI@Pel=my?yp4YNn*^4%4;M^dD*~zW^dz0UVS{if+z7 zUXbD}d$qQQg(Z|n#Dk@u5cmA(WyDQ?h?nvoOB!V(=5wgwtOka|ysutA+t zCES+C%E+`*c&@(0$sQZ)5NL3_6bUI6Vl+bJ4K0SX{8vWD{F z`Rx3Wa2>IieJ}7QJzZ5d)&uMR-KbBez}zdFmvPhz;8H(e5daI0-CTOY-%!d-ZINI+ zecLp#VW=wvV-M~HDoY2O$5R%_j_#YZV6;Y%{Ednw(A?{%hM_Xlmtd3LMKcdFLR^v% zA|JcTqd85bCjl9(-l43b0Ij`u5F1w7RFRxbBDNoRB4}#gYXG9H-n~AH)HN+a`d}jK zTZLGwdU79T%V<#kS!1-aZu`bA_149&jJ-(2Lwj6f(U$Zp)W^|wrsK}wna4mo4n{WQku(8ZGy;Qv=e{SOr;rQQiz}8>FF8}RWGvllrP^w z61izPOu^OMiUJp`gK>}|d2tldvh?8z^>l8cq2x4S5TS3DDdym z9dj2~wJJ@UeUD{Sj_orsbS0uyHx=aCZBnf|E-=#akx&#PuTz#Cf0jZ3*z~7xoN-90 zZVdivDrm2VpKx%=W5P^W6Z|%P-_|I~eqY;qF@rircB+eQu*zL32XME%g)!34coNS4+gC&8NcjxJS%TF*u*D9LdK<^ z{J;5^#B4k;P4`(_$cXj4ufo`|!X+?22#LY52^P9Gx1Fy#R;x=KQpA*ZYPn2REOh|Qg!lRlLBik z&yHPq3UmMG)L5o`YjHpz%2asAy&n%|BB!jfmZ$%8wOQSl(c?3x8ZaC+1e)S2_-)$0@xd zo!_)ST0BhOPM|yZAl(xj#fuO)s~~LREsI7$9~{F{yJ|w5!6kWLtmW%49O_YHNAu?Y zr%Fe@=!yWj9&!mPV!2~gQf7q0)BgtHPw?~FNGFstZ6hHj!xR&jm<5A`9_aK)ThD#^tsRM#UtP-tJ?yJ$%gHICW!a` z>$&>%V?eSi96~c0c-%E_QGGxd@mzEju5QCzKh`zO48P~z6R==AexqyK0egHjtr(p! z9C6@D8NH%IOmr(Mu+ALO*N&$#-`uBN$yiOY?ywKga*EV9p>3drl3-&Ea^uh;6ywTy zxENlO;U5EhWJZJuE3@HsEsN9dJOt;O&ciDdHPLk&8jjstGY~YMRy1pFdZ9X6|w? zQYr?B*IN7A{K)L*X;SN)dseFl;r}A@;hGc0Q@pW$NwWO?%aM$>tz~gt$L@7;zMsem zz|Xqa=Y5V9*oDWkWDv*bg2!PtFIGcoUZ(rb@f&R?#lS=VCUr5<7VNwl9%KPbJ}<$h z#GV?R2z!_b^pG$z(Hw5vy|q& z#S{>uJL0I0R~0q=9f93$=J^0cy@q9ixL=XVWr>q*=)3_dpSuNpNaUUiBOPeW2*bj{sM zyjbb5z^Fq1>&VL^eU+WtI4$>UE1v27>D$1ac|OX1L3H`{z;qfUa<5HYG5|PZ0mbw9 zxLvt}uK3g?_rw6VmKPsvOoWt`Yu)}K4A~f`+rqP|m9HC2tzhdD{3Trc)UoTUsy$+jM+J3jDUoiY&B( z1x0J2SW+WgoS?cFEI(sWEg9}COuw3ExtCPVMMl*~UkKQu@eG_b8hqs$M3k?MhyIH$ z836LrfqS#{R3-2*1YYsG07Gl+<9R@@lL(&jJrARyZcurnZK;}|3Quj01W}ArGcyM$ zw=MoUmk=P)=r+vRpu+O=45blCF9<#yu5FjJGOjBqvX!Am)1-THaD%CF!eIjBDeN&m z?IaHl#*f7ck@FDYh?@KeEmc9g8)YzMx(9GD)zp^r4xN6$D_NIhjmMDBip@cY!WtAM zqIdd%E^m1cF4~qwGHWoGj?>6}?d~Rms#ph0$p zeRJUOSb!BC;_OipBl7z4Nz?f=qR>%`MSdGO_M8`XcAYN2|DuL0&a7;eGl9}Jj6EK1 zvBXx+Az*CV6_!DG!ecAwtnBCSIyyTi@iu%k6CsopWQugeUrL`rt=DVEFP&7JSd4>+l(#PlU4Qk?-;KxkWu#L+#a2mb06&CYt6K$D&~ z*U2((utX|sbH~AAoq+|yyJ}y0i3{5%=s14gf6L&FE`}1+C~*|&=n{n2Y)epSNV?yZ zG*G*GZ~oQQ0l4HB27$WG)kI@2r+d4>X#&6OS6hHH>({yIsvGg+S6_-2FKZp6^E}!# zwYkm$lSPn@(bwj{;ppm;_OB)cuYCU?APkXt9-k!BoWKHz_hYB1(rUQoGAaSAJvXGT z@%G1*N*Y5e!&2wtJYYp#M(=U*F_f4kx`lm=$Vi;hgI(=_aFn|qpF&!0V{A;YEELQN zE+2BFrEEMY-rQ#<-89+ps|wU(L2*_&RFbkz7K{wb_!*&TPaJ#+zQ=PQ52U_MY6Z>~ za2xh!I`kpFTJe~iMY0GloHU#gV0P`tD_l!WjfIauGEGD2$R|u#ntt_*L(krgpp(33 zKHpJ=F{N;JS&b2t7JEX`O5M2gH*Bh z7Y-C+4JS^Y$KMlaBKC)>xDM%pB=gW3SU)j8FlGEGI4OLGMT{r--C?}8=Y zAD*H6ZWBx5zN6G$Z2$6gkw7V=995W>EY*s?2)$Bj{Z(Dp>Y6v{OI?dyS{E;};D6QX zr0j=8s1%BBCzIf?()bi(QY)ImlgVY&zHNh$x)OantpH|MyaPc`++(vnbYfZv;x=Fw ze(S9@+L&zGi?_?H3wC?41naZ1iR-(JG@(Shh99(&ea-&ur~F8F0Vld>>H#7MPxIHu zLxW+g+&%zOFE$N60`!M*t@C?3gZS`%2^7N(^&P1-MEK9UFwa|R_0%_V^Ez0AwKuyA z&J0jw%6;HIeBY^DO@gbPdx6UAv!7AV4besFL25NeVlq=srcgB-ISin_lRd{HYsg*J zOd&WZ{_(7eri!P#8Z}KE6D!bYv`j#!8L2e}{H8->u_p%5#y{yT$;Ji3gh_=?N>R|l z8>E$urSQ3E2|N7T>{lKCs*i4Wa4fd)BMNe2$#tp*t=YjISt`7j=2j3}0Z~q8&SiO7 zNb{NfPByhSLD~h0fTBg^OHCBK$91gr>ifz(uf$~i!T*f+FW$4MIWaM=B~BkL6VF155>_`fauRXmKS@zqbZM@mxUR0u8+3WuAcs7b_QEE<&g+{mo_Fv=;O5kXFBF}3=V z2@F6aDX8UYp5E5c_=N6e9NAnd_xq4h-=Y%H12+iJ2{f5rU}Fp;*ssioXPh|-mMiZ& zkH%6KAw4xta_aT|wzF86TX2__?}473DyBE;qK$~M*%X;kID4!O`_8KuVmh$V#an&o z3#V%&@l;)(h;C`fz5pj!#54vhb;sV~WOJYHeH&!eEKsdsF^)PxTd1#CY9THaWbJ^z z;sg@XMNn0*2w2e|RC38zX_=_jJSKk*KPn>VYGn^Ajf`E1)Fv^m448Uvo^I!hrgK}> zzq-*StQkgue1Y%MjeH>J>|>Z0SajSlkI-lWKw42nsS_{hcv^Nv;^IpYPOx#Q&u7#G z{W|_z)3KyfNFy_}quKyzPI14|6 zZ%k<`@v5~=k*fs~s^iPnJLNeh78Rg0VuqaP#A5zNI4CBM?OP6)2}5in2|%hn$be}K z#wxUlI2C;>1E?o_>#J5>{X!^EF|t6DP6?$%_X#2|?@`6;&at;~ytA~d!S=lMLUIny zH2s^OpPR09hcKURJ3Y4M`0dKt@`O$B%!b`Sah^MRNAuK99q^9fq7LICvZ6?m7wtiq zKNaOPLg7<6{`tEKH`Y~{9(Y;9#G}(|d8$8|v27C(Ij7X-!{uglh~rOg5TOffZ99Cc zAs_@x8gkZ?mGI|#y~>I?6P$s4xfzC03uR`fSe|m?UD2OX_(MHXnrfeUlz~Hrl(ho#|^-m zDzt}J%cazyWtYt4t?u&~&b=<+(S=T(8k4Tq>NF|*Je$Tj+ZvK+@CJaE@UltY zc{oWejgL1~Fu_V^jw1so`#U=dWS_IE-z&O4O8CbdCmvYVOmP}vEArSsbs(q|ry+L} z`K7k6dI!Mu&ICQw6^r_QARx#$HDq?H-{*$ysYT8cUu*7yR1;?LWzb=9ClMU$Y-Fj8s zM9-Cw1<;^NYO` zO{_S44#8TF6-2c~h6oZ|MsfRxO4y~~+)fHohaCaf&Zl(|e~9D6gAd02?jh;tXN!>; z4T~h9LBsS6wU^_=GyP6|SWig?T29#yn?zf991kCMQk!z+`0p%^$PVl`zL3r+eaBoB32vEc(R@_i#|>;25JT}@ZWG0C~aI|}s0s5{X@7e%Mg z{h?q}{iY?q= zc>Gen)g!is-L>cA6Uzqm?ESJ~SDZCF3kWV`ds=#@rSCIXl|C$RjQO}mss>CfG8CKt z!m53#)dk$4C%o-~pIuZkNfM1RiBq>J70d75o8}16glknj z@y~HV@%n41hOID(8>YQ(v$x~OS^<>dY)na(p#-m{*7w6@YVJ};H^=5md&piU=SExI zN&$;#LWE7fn6^k=JU5F)jD{a&_A(}n=^C}v%nO_R>I^Q&cU?0j%(-^$<4XaXNH6`} z{pm(A5y!}($(J{$QPx|ZVs)b0%=h-^5Ezzs!PaW142;^L2YM4Xp_^i7P?KRU9dUa% zA!6p^^#a?>=De%&%TJi=HZ{+udRC@nTGdF!90_vdZUG-KD=noi6(A_zBayr%Y&Aqn zqw^!7WO0dpnrk$V9$wMNp<{0*CT0FrO!yh`=QZPvSTG(-t5sq=_p{ppEdkkkE0J2#I zmCKfQjQQ!Z&5RF&$2(SU-c?s0pcLBGBSH~(k36A z>!`Yx1jy|`tdbZlcZm8O6G)fVZxY9|>Eh%VwAGTuM^c#3vJN==LyxuzP8T-lKHr{A zF|N4vYyG3MAgMXtMt6+$t*zTr*wWa(R4d;`wJUH|e`pVc4F-UV_X!15ag;81!?I?t z)}t$Jy`)n0QFiMsu%P8FW&7yc;UcePaY)*KqVJ@{PjA>I-N; z_%t8Tb-)sj_Kx7ccKT$IiudnfhHXFkL9RXhWvh)6uQv=@LaLu}tQ0W*EEc2$g@sle zaO5STu3RqN>>A<`ISQ9Pyu2f9eyDH~f0qM~!VbcNfWr_?9)T|$5vI?FDQP%UOjY() z+%WB&!1!ZdUF+2Ko34Uyrq-Xuah~17^ATn;5>Cz_8m@ zaJCtoWM@aRB=n)Jk`oTvJe9$sX-R7qaf0!#bdO2RHYJbPM)p0)K~kB+d7l7@$qfZn zGcrPc9yzglDrh;+sQT~S)v1S3XHy<#suUkYa&uPwCqekUkDB&*D z>-I{`%&Hpr9S;lM+nuRwz$Ql_jzinr@qBfQ(nU#+i{H=p;Sgv;91IqByF@b1Kk}ou z(>}}WCo5Si80RvHFM)`@&R$_70?ZxZ{0rZ0)3Q|55~@=QCLSoq zB1Z?F`c8y~D}p$hQhnBkR6Kq}BAA1~2ntc<4YaeXdG;VYnR;0G(6#~YO*-*mNHghI zC=%ovT*)B?E$QPwmIhX53~YExJnIbUgM?Vip2pI_fzY_2QZ-!K;-A}H2H$I+OXGn}&h`^arC?K)!g&PdE6GBowTi~4AKJ@3^PsH*_ zJs1Zwj+Lh*fC{3%?cnIcpi@CE)|*GH^*)O|Z&P+w8!*Y%IS6s^nHvM9C@mhhrP zRbKN_Fyi4!;KHPMmah|^pIys%b2ct4L_uur$FAkzM;amHM>t|3t4Y8Q>AN(Qkk@B8KPae%+wx8wuE%~rU zFsZngvIBwcwu~w27hb=|1Z?woZ~C5SLDOAehUk-~L_4{0ODLF;)&G?~AX zzqK*bpm<1o%wA`HE}`2yD3_Ef&m0RDas7kp6r^n19ZhxT!i_COPIvxk0zOOXpuvdv z&h6()HV0#r2P=J#Y!m0@X?+WRXTVCMKV<6MrbS|b>J}+bWpgUDWF8l72%Cx1Ue=-U z>GM-6n+l8nNbsQ?sWF=b!nahA>TMxFt^0No*ar!=rFd62t>OK>;up174CR0f^d}L6 ze~5O(XSsF6vLW!F;WLG+fpxRbv^_brVi*tu&*u6_e5is}Dt$Q)VelgPXH zMIy8`BAAi!5gfM(N%CGgi3)W3O9`p`mjmyeZAJFgc}s-Xf52zk@4H|n(!Y=3u@v7t z590tLl-%Lw(&ARJHcu513DJpG3yn|csYKBKXE@46-dDbJAb_p>_PqHb(7Dt8f&$g6 z1#(_oUp<%~47&d*R$SIahV2&)VE5$m5>u+rc+;7PfDyag$Dhcdzn2j8@f0LOM+nvh zGa>rSTErqcQ!^J5zb8ECZe%GcaNFc)9yPfL~I<(;gv&XVa8Mw!uC1ei%Ip}!knx4#ITRM zk2?qhr&dpGtAl5S#~ym0Hrs4H@(o|?X3-6#5+83Td+N_FC&Nu|p0p)7)Dayc2U5UW zJTFoxl(b$JGXUa88Pe?32$>UBz-!YhlJzQ5Zd<0GQ51J?L?X!MM~k`z_!u*r-K+-H@$M{2?l)?EJI zIW*f3T^*k`($SFhefS;0t-aq0T{aU%2wpN)u;G8sglWLwST*9{b}waa9W5n3x$Feq zY$#v?&f3D5B{Itim0|BveM3hGnv0xh0vJb8yHV2nKuYM#*|bi{Le7-%!)9be6j10B z*suZe0m?oABH@7mTvb8Jz}O=VW2A2I71sIRBm?AsOUU)Y^Ob=VyG~3`N{jF8Hcr0d z%~M1j*;=nfMRbEXx_V=v)BM1^CNwP1fSsyncfm@*dGZosUT4E7qp0fe@Y@xONwQKD zg*he0%XO>ucAjVhamW0uTQ}78F+;q~(E}RB+w6 zr?B)m*ocvrI>&sl2Ee+qj47F8rYSlF5i+pKbm*-VV8ZfqIWPVdVsz;}`Il)65v?D+% zB1e^~p61R1oA6)NaKvI1br&ZL%xUmc|M;Dw4NOsxXg#qv+megNxjn(Y;^)y6B{5dF zW+H>+#4D}7Qd&w=`w>bz9uSofEP$+bWH@I$p(#huT`W7{{v5jD12_-~X;gA9Z}H{l zKsk-o>-*oT^-C{Rb>q-YZRgB)za|q?{ir>^_XS@3E01wV5$f+g$b~3-&I4}>X@35S z;O$Z}pDPURqJ#>MSt;Mv^?+9K^v~gZwEyG^ zd_UKJC7-K2)dw;QbLyJ%@lwZ>P@}fj!;3aSO!yzRRA{qfs*uSSF22y?ydA`iwjruw z>dHx$$v2kq|DR^t7@K`+Q;6~Zcv*p1C{7Zqc`6A#Y!&(@X7()PJfzrBBYWhMbO_@2 zS_dNVf}hqi$L&Firz%6QU&p_(H`_wNM$N*qLZ}Vv4ELfv|M|X4)@M@F9hT464lf43 zQ^5+-xMp)pwf>2% ztf3IFuq+YGBghFN>0UKfbJ4S!*1_iaQmghR@&u6<(Fn%;;=$sz>YJj!L_`3dyYv3Z zl|6hz8BUUYsF#U(2cMjby&mepE4cYXb932Zr0a6op&99<%8pnYUMRXj4&{^3x3<48NYLF@UD{JOOQ5&IMg5u`1Q`0 zdk%vb-%yycK|Mxaw5XAZpTUntO}vJjg1xb?IxQYiDVJkg(uDqqi!?*}vunxm0#1Qa zmfuii)W3$-?Nl@sp}*E@E8&o?F;tEDkx)^F*^)>mE`Z0%^v&h>GMzhZe-mSrcHI4b z6_12W574#Bu(gOxnCc-ROV6S*_@I;CT+)ZI{*~U{&eW6Ol;L3P;-Kldj^vzwdF zTi!@%Tw0--sH`iat*a(BeE4KV4fdOqDjEb5oCT;u?UThzJuPC%yztB=eA#Ex$px@6 z)4LdVX4UkMUV?;F?xD~5SEK(e0w|fX$35Kg^W0dZ;@;R6h12reO69SU?Py~@ubCpI zrxG|SYfz&D#yr!x&t0H_GOBoAT{(Wv`ZjhuEf2zTN_KQ4D6tFat=X)Wy0 zF*9Lh&=XmgqAh1+BnyYVzv(a<1GA>`I;~;MuAynMUyk7ZSp+U}lb!8Em+>{iL4=sp zW`U9Sr9fg3n!6;>W89I>QVryv(h&5TEHz_-Nl0-`375@B6xSaIdiBF+CI#utILPsmz-AZwap!2xaMr?n9#cAoMvyhW=I|k3jueS ztq#{|;@qZ%#3TDB=izICYIF4~Erm877N*QBAWN=?(ep=hQxXvMjNy8!N9YsXU7o;r zQZTzSnoWtFvlGxqw)QpeRK?8>@IieMOC?KJDN_LGtfV`e_Hb%wT%k)NvshQRT4RN( zn5X6CxO&)aPbD5<3%erXy9a29h@2(r{93QE_OfT6FhWR10XCmXHZ|&fNRN#Rpn06< zs3gPQcpzgxp3_raTq=xqC!InSx=cmF;gfcdlcU=DViLb|%vImemI6M^b%=Y+`HId} zb$_u4VR-BhhL5C+$Lv)zv1#TC7@HQI2ZFIQ15P{vvvRocfg5C!VY|6wUvW>q?al7Y zcW>(U5R0odSU9P?`O;M0{w3?%#rr0=@9%4MMQYqy{6U_aBtfnOx2^ofyWKKX11Q^b z>7f`FnVjd&wNE3C8}GM2h+GPv7hjfQ>J@rtCxJU7zR9tVR<{c-#0z4OuFyiiv9vd^ zST<&__AJc6>5R;bVAAC!9ZC2`dh)G%>AXTAZ0&J! zFr~_?$w$;S1@tRZtrZY%e=sXj0C||y?Rv;e0_x!I=T)DBBeK0k>1|~jn6DgWW8@3$ zeWl8or5)(#C`clALRE^UUh6yC#Ph8P8&YC#$>!4*$xIOf1qXmpAco|bA9zU@Xj-O~ zHbU4zj5|>OWibVn7|;omyGt7+_naFIVK|)`9Dg{<)z4Jk?yG6TmBSZ7%(jfE>=3s!v!N3KpEn75T~W!wmDC*dIC56zaqPpCEDpvCoI^)7mY|K!EI&Ez z8{GHIOo70!<%FJqR5wMwM)Fqhw_)h}6K5SUmW(Yv(tH7-8Ll`HQh_Nr0Ii^^TEczE)j%PZ@$p4LAoDb`2OJE6a!FU`v-wm*~ zZ%Y^`0f7+aD; zfc?9n-v&gxwKDNR3(5Hm-UN|qzBvw23lMRejk@9uyf==q-kj8NTc7J>-`_%h23qfr z_v0LLffpVFYeohx#n_R~2nWA)Je=55rB$R4DC=B%C&&o$``h32U+FthN&sK>?6{7u zx^K{^%QpW-t6=x2n!R?V?>|EY{5MnXJxhNC4HT!-KC8p8DXu&YHbx-GPCXlB=wvHV zHVc?l%lVG3(3ID!BK+W}`x3}{DBi;&Cz!E7=O$KCxqg`*dAc!pNxjVLyFYTK0Jj&g zw!>;N=>iblFWMs!_}!{O8txX~@tlC((1`aYb#gT;*ed=8XWS9M6T>8rMBVFIN4zmy z@@-joNUQ0j`&}rMkq0un89en!4C>7YP$<%QJOy#U;u-K6^ze&Pz;NxpIEdo#KM&`I0`x z*g?5Ix9bM zlD@Zn;=V;?E&Z*@eFfFCO4wt8(+Cw+7iB>RqzNeNtTTl_UNJ|M*dk>%7{W!q+jc`; zs4lXhe5Yz)a?Tz7+V9HBU0QF=>32#>W&s9|@UQ}Cw+DM3Yyv~S5(w%vWajySWUJcn z9_SChVx*dV(aaUb5a}lN4TMhTMVOHNOnVcg@04W!Y!*1%eABkRuYOR*O^J0rQ4RVy zD8etKNkuHt^&Nu8u1;)@p$WFw)6zt3ps_(>6~!KCE5a0-e5%aRv^ZPwLdrM+dn3Eq zA-6ZYnQm^ot}|hXymM7m2LET;tN*7!2ol_U2-Uqma)Edv@^|fV1^$z(A5*sc`Ix(t zFe7$K=_4?;GYns!hfaaLsvqKGy3^Nhx?Umxfa;Ni{I6bp zi{3IF`8lI|5L@VE`%aw6ZA(3PafQe%e?|hF-#A}2P9a~T5YM`mG-!`eRw{W%==Z>) zO|EJKEnq5}IzeQyIUBfNLc$bFZoeZ{yJt;9A2ThorBnor#6N zNVWUQVq=?TIELGWRdidifZ&Y(f7!JGU46J)DH9j@CS4hV;WG`2eImgWw5V&zR}M%AV9!-a_8oEi>>doDD{EUyI1sf91Mz!TACh8i{KD6qJ)@RYr!THFc{F%L0rG0Ujzyd+_%2ZkPr*5Mcb@Q_yJTsJhP~o_6j{e^Pj}l3#|`tL@3dJKz%P zHc{zK)w<0v8Mc#tDF=82-lFwKptPN~reWlWwAv_t3P^y7-`-GTA!j2DNi0?6d{>hd z_}VB`%*tCTfu_o3oyD^qfh(Ut^C$~ye-LK!!NDYu?Z-Gr8Fh{PgaO;=j>-o>UC&g^ zTz7fSY`y%G!8oPJq!}kan4EP@{x>qr?f6-vJJ)h%6b37nS_MzhqY{g5Y7^~kT`Clc z=WF(~WvC_lv>C!ZTG#c$8TN5>_A^bL+)Dg$p9?8Jd=2ZjSHpy{wZ|>`Sr3P|3n^kl zp5!OZ3BnXIxV>R#0BO&_yx=)4P)IOiKS1;#rR~+ zWD(Uv;6_O$G~0(kAmKBlAk^Iqfc0w;RA!LgjyUH-`$f``gKJbPA4aARq(s|y^yANAbbYDHWUuTx0AGeh^3scZr-;qI5R&vtEPXdOe z*eg^U5=)SJ4Oi?Hs`0{E8ZVXS!Om%JeSB)g?A$}Lp&!Z~uBTU>&99rD(B?AOrA=6l z2j9@HyJZ+0Tc_l0YtMS*AF1*ek~vuexQx2Q89RX&+QEsGZh#J4N>WuR@0PSjqHlRM zb3suSWvK0vW+A`1lXDbt{dJ(iDYixP(FNtn-+1&jg9LRQH@AVSTbvW=+-Xw>7?=Qs zYWD>4Qg@sPA}YMjCkGifeP+=#KpTF^=8a%5;d|I(81O=I<)K2VFJM7kFao0t?0P*s z44R_w?|7wAjoIlU><+ZSC8FNhkxf|8WkiHX7W7#LD82l)t@7p$6xVYc=or?&(%KUG zPLyCTq)VHw!bvJYtX7kwwlDI9#Zo|3oj0PGjH)o!q2SIe=xH7)r-`iv2L||8Cz5M9 zU)yl$4F_O%csa*yw1JunO_#;!qmFUU7d>nVxoS2=Nv2HDE4yG&8l(Q;GF&X9ftlW(^sC7auom)Z$#vk)`6hz61t}M`bl92w?`z0=Dxk=L@1V$Dzm#>ss@3 z%0c!8zM|p2&BjPGpv&1Y|X!Vem=x(kWyiS0?-* zQ#b$$HEgcA@J0rxNgXD_9UT4$@x61M0xl^eIAv4+y>X{t-;$$qfk^1xO8fb>Gga?a_ zH|!V@+%KDdhZBRZ&=8EH86O_e>$|I`KRiTgr1%wFS4lLZ$EdTYS>c#MQcUiR=ttTo zudYSTa@#T3JNNIT44>>`#B^OIxkCC9C_!wUolfHb%8UeyyEoH+#71rIV)|~`9bSu2 z)20t-BHm#7xV}+p^y2htzwd3^{n3J~1LT4N$DsVia^@>D8^-+7ox2t9x&W2OP>^Jg zj&d>d(XH7FmyUe^%^Bn~f#wm@{lsCInxJSo(hiJvWnC_rMt_Q!CF3FoMP||(0q3g_ zHs0ld3KRM%h-S5zm4sd}{yr>y#3V>lt@O*wZ@z@p8!)TNhZ5#j&BeY~t?h$) z_QE9iDIz$E?uEmK)F|vi4U?#q?NN`1JHdt$lJ&Eb`=5&phT%=<9{^4hJK8OSxBOuk z~jlPU8Mp+;)6?%Ct4RZg1jn3|u}O%eW0f)DH)U_Kq* zXCK7sJBK+>6=lP&VVrrSbZUr@P&4WwsCb1vdvhIPa&ILN%f zCvzP{v>y=APpvCc;ZaRhRGX6>*G*e#*hE)IU7Bj*AigR_w3VjroK%2u=F}>K-sfbE^_tOe(XWSeJ?<*yW^e|_xt63)(&bD1f4fV&h`|BjD&^ z7UTheP86BWM8Q%{$+UxlKS*kCF%YjNBhVUxl|jdfz^VR6yk zG%q`0a}E)+9X6s9GdeI1e?- zr5*t6l(nDS7YneIN&H#P}G`~h4R{x_7FL{q7$rO(9ln1%J?1=is0KC491fqMrhh|05Dtb3Q;0_2Pz(XsT6 z2zudHIjG*iAQV7_2W+<L*pP$I2& zfy8+fxNs24r1YV3`ZDb5sRh&E^uxtm#cOSn z{3f{s{~kA8Z4YC|#q-VxHA)rAa*Df7El$D!d%pvGYWRU;-nDOjN)FZ))1QU+@_MPk z$g~$@s=VA@*Fnb1#@+YQ6vN1;wT{nfc8kLImJx&1;mPTDk6Lf?S~p?mGfY^_Cm+Q& zNsNui!T2{WoCNC=W3tN;R}Sf19!KV(Sd{%qy*mTM3m6_z(CREj9#cr-%O<<%%C zF0w`f!r3-*h`vNNr5kTfjFC36uDlrrZpM5T?)Q&Xe5q{)DcsO*J$;XHd0g0t#fNC2 ztt1{udJ3miT_s(^9;x((n!jCk$&h-V%RO`}Kwi zENl`-|0T}xFVzB1?UI)BmXKZn43*jKxJE3*pWB776^>S>W|(=%S@d3j(><<+zZeTOrZ%rJjR~ zd#AU(N-f`9O2xBmzvgEGm~ZThRoV=q>4q%}_`-?Zunc;;>^nJC`~2(8&GPlmlSpW4 zf(Zp#+MXO8oXk<7p)JpM+=f7&^JT<+2+s-ZcSO2U5N1Xn8lc}R@^IJPDk zR1MXU$*cj^>Fcz~_oWj(O3+_bre&7tHG}BuNERCg|J>zW^WXwluD_M0Jij6q*``&F zP0o>ZSJn@I0k-pE|!;FOZ0Ga$G{ zTS2=T2>$u%qb3Uaq;KnRi^aBUMK??;9WdfcjJMp!tJ(+H2tK5NAEA zPHU6pCvm8$=9e>>H**R5fYo#YNtu&J8M@Wq7m>TW|IRB*Ds8HF)0k!Yc*C)x$w1^z z=Gp`*Fj&-Cw3zddPkE=z^7`11KGFu+eJxvfa(IA-i3Rm$1}+s<@OFn7xpkO?%`Mx@ zrWE2{CZ1GOICPSx?2vp*NpG3Ui5ehGo`tf@7{PI^J}2Q{I$~fQX$#Ei{(rWvCc*4O zEdZnTsmGm=uGo~FvBy4B8}xy#u#sH{#$#-HaVKfi-JunR?=#)!p2`3UjAG?>MeP%h8ODUj7T=A`sg&|YVy&?y! z2#vaLj!Cj6mc#m3;B!8h4O>>CE$7DG7Uogg-cucWaSx9@8x*qwo6dgv%%;Vep+U6*|c=G+S>T2o~EP@eC@81c#u$);oy7gt060rT)Ifa*&fA zN14pTkDWlvowp-Y4^@ELsK7TMrbxx&X>>X1&rEGI?7%MRGAr@xey!m}vRECKxk0?i zdYG(BB(OwDA~Nw#(BY2;c~1pet?Fe+A?S92M3uposScl7@mBlBVK&|Xtoif9w!(us zJgqH~-j@(r;5wD~UJ)3c5{DahWDA>;|Ij{|@HZ|^aYU2YbeWF3*C{9SzF={AI(4 zYi7O3A}-bhF>s<^W=lK|177ND8bI;^qcmz&cakDVHeq4TM`>ez4jIqWuLNlO(FI!( zW0mZDYi+D+@tw)S78}ONkA1^~=@E!q(u|{fW;+nLpMY-JVln)(XxU}_-+Z!~Ue_qC zy6euFgA)`NNR@VFNj)HU8MEEo9 zaHa`gcT}xp6TOaNR%&MZ#iuixL3juU(>L-cdK29s&a1oIRaC_jNH<00;WsXzFQi%E z3#G7}9n}(XXFT}#r@|mj6ib6x=M7roDDg?sVWKS$w+w3b!ql6==i=~h|r5`-#?IxEKwQaM)hI1K`WOr z9hlJgroYSUj!{%eUmuLMd#nGVGObXF=gG_M7plIxM5Ssc+Ff}_;-7-5MGlYF8=E*q z7`)t3!S37-8|-J;3pH}aS_K*L$`F)yeE8-Y}-qDt`S))_zgVY)Fo;%Mqo0gK^bBqWR`=I7yL z)$7fPn2mM|FVqd~J8w>w6>nLQ0+d{k{i1kcA>b|F=ysJ@xXBkp{qb`fr843Ap-d^Ny<#o&Iu}?L$^_K zZxhZoR`4Fb6ZthE>Bo||!^kD#OH6X|gD`uptD_w@pYY>MPu_`MM`v(`L?FH-+i^3j z?a6s!2r>m$pn_1*B#5fdh-<%19+qh?Jg!+SneOGnS;U6LF)%} zGp@dU#paWoFr;2`Z;0oZ&RD4-jf~rc(+fQk(PKUk_h8Y zs6(BqgBKAx+KZi^vYb(SA>X_)^lq=~gtM=ybFPqg#Qww7huxDAmIBGZ%9<9(uA2A6 z)cXri4}&>Tj>;khtbCY>Op8>qvZ=U0yvLuX@A^&MEa=~m+%qz>qEAO-PLKHnPHR^7 zKr*=4XRs&hoecZi39Zc=(yJJ|0^+XGPz;EI3(u%*k&M85CPM!LI+!!+SXm{9WutqC zV~a?C*SaAx0yl=Fm1~UEiV5*6n$nqQZWsgO-~`X1g+tUoMB9RBc>c6j+yta&PcX zj|8f+L>ozRy~2G4N`kut5apQlEp0;`qY3QS_G+cR-}@g;zo@@6uEsMp7b6O<6x2q$ zf5saerb2`HjFs(av5Oj=qXl4+K5_&E40^s&Zrl4RD@mqxM51_g5iu@ z@Yj+kG*|0Q0r~#M-$7L6^1IVS3fK@BdZi;Lb?AEYJxz1Us8by3yG~NNE|1@R3y&#G zRfKS%%K&y<|5#{<*dyY352QUB*y5b0T6&^{dIV@Bh z_Ff%;=1J`gYgaOO5!XRH?l4D*VLI{Rb)28Rh zzf#VAJ+R8XHASv_I8AtTfu?vl0*URO=oDNva(lmoBSjNI?*4MSavxQ=X#B^ca{LV0 zMVtFL-|H7R0pHl|S;CDQvVVYZP?jI~L<63HAhq``sOp;jq@hu@?Meju6Q6M>cvJdr zWc@MCod~%b;%?FR#eES@u*m-~!20nL{B?f+vNMm? z4-RF_6(exuLFx$3H$oCD)1GR@T?8WKO&h+_W_VeRX$rVgyHLgEpRb~9R6d;@Z_Yn# zy4QDLr|Cihl&fn#T&AhQXCO1Twh%*3h+|`tsDL)pIqZK`>cn9+-V&J|v z(AG-b?oe3Mi;UZmPER;4yx^U%`qk<{kKs?M|G&uQFS$^w6(cp5(hF#DOy>go_rIod z79B10BH|^s|1D>ZNiG>YMn3>kH?w;g$OafPnLU+MR8X4!HH6>KDNZ!6R`m3x-k^o? zIv~>Vie9h}ROT~1EHumZ+gIBA_QH$N(4P%pm~ni$PzeF>WapX2OI*<)#8{R0`f?u2 zC5rZU(8Xv4`h_qxNDVgFT*v@GJ6Ccq>=Y`$r0xH7z$AHn^ndOo%d&F>x3GZ_`Fh|X z@rHX~rPm6@1S)Zd!{$~JwQU6LMi0;bkJhYRz)=ssHEKFRnP{8Khq6!EC4^K8?(EMQ zbzp6ElJB67AsGMAe&+HcateF>=u4HL7bKZJ+UHS+&GmbuHhxwxn^mCd*+LVgABW%7 zw;$#)xwk-58^LG&SZ{KY;AR+!4Nj=z=3_MfHCJou)(w{%+6cO3d^q zu@E(@EIhIRbEB{kr`#J`{ZJ@-0aQo?BvV4D=3Eh_aPaK5CUC^n`K&h-yYEBAGgmVb zDRss#n<>{iIVtv}5w&$ViBRROa-0T7N!u9WahR@5+zjy&9|C~kohEFvrRJ_D5PWn< zy1|aKsBq2=QdI|+#GrEUL|JDihl)H7?WJE6Rt((lRFt#JTRWz{WyYwugnw{Tf#W~SI5uR zVlO@T`x?(6!8!O`PJx^%hL7O>HZ}38k45s({zHCChT}3#YC`}qPHTb0mB|aX{<%EV zF2D@dxbGn>m2L$&87L+z#)Jf-ei0jxqTcu`nX8{UHD#mDMC+o5=|4&wzQ@im5;ww0 z($IT$!Mb@Vx!pwZgA|R~L9PAc;=BQTlvE(>9fD)R>4KLerofsTV5>gG;~5kmY9z%Y z+M<@2NiDgqGTk>CaYedT4JTG@CX~Cv(0c2VBp$=S=coU%oDXO~8)kZT_-CO4wK~eC zs&SOJaA~WSBURI6Gl2y8*gmwhmv51BFZ}5|E$Pd7L0V6v8nnF5E{N2!n?>J9ppYFM zDK$Ev=nZ^hOJI>IiwH2fb!dhqLT{k16c+>QwZltoMhE1pR-iieQDi0dB%EhyH428Z zjf@$3{UX*zThP*589v4U{5;+z&B>6G0UAiCqjCNH7#H~a zqL@9SjT&4w%DU3ucE@w8caQ~z7&|5v+Ro=(&ZG|ysjy9eh*|lv^hTQXEe^*Es?9;s zEb9O^iTwe>AKCB4FH zz^TvDN9rb!Lo$E}k4w1rzW43VjvNmhR4RE37c?134*2(kd+On6lOXWTq=$q806Otf z-92+T8t_-J>VOsvL2ift%+fLyaYcboRiw{pG1z(f7!M54= zO*{)C@g>Os4e~O#5)>6p;$j%Z>uZZKBawaS&suV)8b`NL2NQyP@1F`kB>=o8ntaA! zZU{vRjX%#3QZksCN{dvWs{*7^|ugd+_!idB`r%wE$%Ar3^W zE>A#kgd`DgRMwVzs|{SKu4&!FkCg6iUilU=O}i4(7!2fz?s?pea+Om0<*NhXl37twayCTzX|Mn@4P z%w$Sc4uqI<1b<0%!-2*x4%k$s(}s}FQx&&1!jX{C7C z5AgA+>s)_SRp))FL%caFkXc3BnlsqCXNRXp-x@9(Vqly&`nZ$(Pr7wQW;#)cp)KJ% z?dmm%kWcbFd~Yrn2HA9v&{m@qj}_zE(cSwt#{Yn5t*#Ld!Bbe}ROvdezck!GLum6R zPCvmLf&AAJe=cdYbz6&-IcP``l0FDbDJG@6*nDAGb7|cRDK~b@p0xP9UnAb~<4KJs zVZYnRw`kIwfgAsFj=1-2kcK1Im))owtXmb9V}(Gj^c-x{umO4)))&o@BL^)qIlyfj z0f_@9v@JMn!67}2)apc5XMBbvwKoY07-BD-H^uSc5_4;MPo=p!>CYBAS?!SV=0VN5 zkrAGvuOBY?Lw1B9DgpC34)}*be+5@U$!6a@-3`8H`EBXM`cNeDr>nFl;NGpwtL~&h zN6;*{!nj}t?VT5qu0Ydfg77Q#dmE7a>ME4rK&GPmRqh_06)F+D14C628e3Q=5_9?x zh{{P|Fr^Crl1s~Is*ovEOxKkPU|HBTJOf%hU89M>pOT&S2teQ%#OcI?f^f19yh9k7 zLpLvD__~9%XGCjMI^^|Kd}r~^8XoowjT9y zH^zX?aWGj)i`KX>BM0w<_o_pjlYFw!B~k}mkUyEW(}LQgpD@)PSGN>IEn^dCNA&_q zX6VbOAQw0SOv`sRG5c+_NIq$r&t2oGpg(TeAjW*k)Y8Hmjpr0ffABoiu@0Fc`(FA9 zwKQUND}XP5vr4qEdy)`(YRncfqi#fE&KT*zpUMw^QbCy%VepVgxJc?Y;XTIj54#Wk z-;1*ap_rft*a^ddl6a7=fp-|a@D6xobcIs1hMo!A2VC9A7VPof31;?fyfIMf}ep+Am~1SPA0J`fLiL4octoR7TFa?2->w%$A^LSTzVC)1I>?LgX{jXBi-btpj}dX`GClrNlOs(*rt+M8wM zD%!k++tRUjH>XxYa(aVemC-CuDN)!wP?YH~i-6t~*=FDPMf9Xdl=oNj?$$@`E?6Ex z)v;Lr)p(;I?@+jpX0?@Owh$ir9jEv=_;s#ivbL-gEf}HaFipKpBU2U>w@ZiHaDh4U zBycW#^Xg*;Mgm5a|2R8qa=Cx!kVj4rFyjj>B03>6IM!+di5qp0jW~LwTepktH+&Cn zJ;h>}J~WWum&T_9#kNcX?}8Q2{Bn$FGJM#;NK{JeZaXOo2E0`%!iMYn9dl4x=eGCs zmH*WKSB)--lu)(W&4t47r-$Dc+Z_co$c>Y0kd=sRg-E5!H)X|@eZ8@TavX7*vs!J@ z9ILJnb?BOr_tpWfJB{xK(0}XM8_gJByqtHSZ4%0>w^n?)#`J&eZ;MaIASfQSGsIsA zmgCG53ke8`ka2kx&4Edmu&RE(AeifcW1Dh@lszS~J9jl`>_M?-BuP#Yp;1Kytbem_ z;YP)I?ezIObHnby|Ke!bhRx6&f4xwB@=t$N>P#*I-eOhKacU`lh+4no+xZj=NIjjI z|G!{6EL5=J^Gz2nHc!q$)iBLVfS{1t6)%~LAQ%^G(9_XNQGXF$kJe3Lw)&Cu{BX+e zcS(BmC@+h13n{pcXCk@)*yuRFpF|GcVU=&rDPO2k@Q-H}#shY6@>@hp9ZGSdmGkUsI4l;plL#Q>8g!JqEOkt_W3#mn1!&+LsVMjDU@oNnx37-u9@O0miF_`VvWRiq2^bnFX;S3*LRV zKTs&UeZWqnX;*@r)Wh&}N8f>@GjUzw0B{es8%HFsG}C@-<~A7phrY_N=jHd#55Xs{NbZ>7KNF+wLOPSaevBiVsV=aP952WPN6lP7&mUH?u$2#8j6 zUqm!aj+Qcow`PD7h*^=XYzByqq=2=hV3{^!DNLW?<}*GxHL^+JsdIpe?cw~3Go*M4QBTE z6*JYgyi9YI8o4noV#d5*XSQ(Nt)anJo71l3p!ND8(c*jjI$KtqzUBkaXXduNR8@o7 zg@{j|^9}8pxM-|4BW>N-qA29_R6i=Ny3igWhET^cIs(2ezXSXs|M%3ccnu4^ z66`B-p&D%M^#{jnK-~{+>;b;0#ne$0Quym3x7R;g&Nha+iTD=V^FYqvT^~^H?bZRx zV59Tacj!`sw*EK>enmrAs*6&qNc5SVZ|`qxrnQmdsf3?zGAr$z5gMPxo?@v*boU64 zG$5t>$@nr*o~VS4Lq4swwZi4w9Uk>A`2T|=l866Sa@?_*Lt;W^=QNto4KR(pd)C6n zHyS=8956m_nsCk8!Z?&kWLbqLz-J{`gf2+R^|KXTbnb~h`|Jy@zwt)cHSTa`vh^P? zFM<@&zsgN)7{lEBpV@nhJ8D!5aQZxVJ(c*W13h=2F%TEkyOIGv8Iz&y%dlU% zKj`wmGvHLa-znjd^_HnpFhKcx{8aKZvEG~a1Tv~fACoG;mw2&0M)q8pm~YdbgYZho zSs2bq?;1sQQYKntneEA`_HAWhbwAI8Tj-|lQv)pe>Wwh~zUT~!ISIcz!Z~;+Uo+vA zXlmfPQF0OoTf2Bo6z^cBhC;4Z$u@M+jGK>5YzVQX?gjn+t;`)RU$tRDPATHK%AART zWj^r)INcAjR8<*ApDRo1>r>)i$kiRQ+~r--NH@$7>A=Efv)aB$!d+O>YYDAaxn|=B z5YxLq5E+UH2%*8CFUJ9m(&k6q)7(?WjMQQ>437h*@Hn3T?F0dWKZXE1uIttKb`Ex$ zVMx!07v*m>*AN80h$$+~qb09Ls&xum@SUO30k<++kA+bt zZ0YhJ)#kw0OUH7iElrHwR)n22+$ zbVoH+t&!dt1!KCUA_0wX{wll#JTd-mc)Lbh1Wv=;6`-BvXP)0uAnL;~ydgfik{A;$ z%e&0EuQPaoM@Sdjq<6xm1pr@!iAYYFv9lE0TXO45^~6Nia({`Vs_zz68s;R!i|W;7 z7^KV7ZRx+U4fG<&3!k9`yk27PdGSh>kX;ck4RblkA1_Ut&8~041GQTRZoe7g88LcCBvZ{Lx4PzbP z85&7@I~DLs#3#D|2=tr&b#hw~PDq`2kOWs~rMaDCx^e_*1p*lhy>T3=MD6DF5E8Wj zul|)+B^yHK`I$3Q*B?uLabi zC=^St-QMS0Y8%FE8#iDI2@X`Gc%U~J-<51se3teHIov)@o6l~j$KWN0s}l!| zSIA)Z`L3t$UGVdk;C!N{S5Cxm3>4Yx1&wch^~rqIuFx0CAq3fa{+ec2qrSq*E80`q zbHB#X@=r>wlmG>3sJ)5 z-OQ>~#Q3GVDYRV=roE-UVmz|DXQxtOo>&$M$H*$d9ni?H!N-0L9i|u2QX5(6x|RUC zBA-N|Do2B;%0~cu0zOO0In|s1aOL=UK3%#3*{Nmh8SIyl$Gy2OfHRQIyQSoNRA||L zeQ@C@J``}X@fvndM6qj_eIF;}8FZisD2`M$bwkZ?N_y6nDZg8$djkUef6pnxZYP$9 zdBW#lu#w7UDisopBP^o*^Q4P{Nsq3*)!laDOmS#h$v1vwOK+TW$(RHbfxhETy?e_* zD#7+QPTp*=PF92e(INP;yUIhR3BoYml2Gpb;u$I8TeoExf{HsJtr;QymLMZmLG;O3 zjk{;s+X1VC2oz6g2H-XzX|uY#czX8v!PmC$8H+MPwUuH*h1^wWIjiep^gB9cybrC-@ebRP z7s?RJ+ahO%iI*(eWvn+fmzPSvz@Bnv*=j!;TQ}{N5LZ)8=I17Tfw&(_CTvI2N7R}O zXAid!)|ct_+<58C6vL1+(yWcTq^twhT~;V}NU-aKh|WFDnGcn7;=#Z|;}-=#1weg6 zcI%MNc+>5+^oE{qzLU1iPRMZ!-8cd z-fQ6uw(9{0U)CD|9JcKMKDf!gU`h4!@(i z^G17M^6m@Y;L=OsO&cue+Sg9djf2K(vhEk}V8f-p{lfAd|AS_=*EH2;KtDlreLL`y z>)#{(V7NK;av^%=`pC6iF-POqK^>{yE#E#&cb+nH`EHRyv<-y5q5;GM0NTBpQ&7C_ zaM2fFN|IVI_@|C+Y9Hcmdz7%Ow3`jX$;~=%TQx8zyO8MY0lsua)dbwDqWh}bueYNXnIg#xWl;$b5pP( zG`ty}NA6&*o94+BGhLN~IFg*ocL>iJpIhvU_pD|YSm}B@oo3s1KJk~bJ`dr?eRyGd6>k+!QDXH^)f&Fd zRIbr1x?fuPzOx4X9xxRS>-hQ$E115kwdz}+2fMBs(!jWjbGu}A4r-IezLAUR!7q$< z1>{4p&)UA8h(=s@Q*H@(&se-#QkU+CPJbbeCJ(8c-_!?Xa!in1;tyxwaV>7D*a5Dx1$4gHE8l>YQ0IC zNg*7nI*~#r=a(Itr-sMl-|eF156+JUXUPvkj%KA4Q%>Cb$pWZY`2##H*cOe7GnJ<8 zETb}YymDI!xIe*6bf8)Cq7RnD3;w=0{BAoEvZ(2Jyg2O@r;9Ik|2e}^H3ZZHaTpX? zfZ|a7Zf8+E#4iiaWC9+9$$_wjAWWgu%xV0GeA>%f9@Xo@K8PaUkuTMQ=1jm0EMr#* zdjvACJ&`YlkTDH|8#+di>S3^TWkcF*y1YL+c%4ley+zih94oGymAsfh!X)1;G_wjT zlRA!=pgJIYgwUflC+20nC|3^jQLKRM)Ew4vlF*t0 z{d#@@-D+qgc;h3x&6WgnYvcTeWC@&U_?JXV@;6j%N^P+HiCJ6ymm zuNFHEfGL>^U7ZvoB)s`LFny99@K@9S$+sk=W1JikgI+o5?nKFljvQq7RCVOTfUNqC zBt^$Xbx>CC)(v5s#Ty=ja=n*` zrJ(Cuu-ojT@FK~QVOwTUOe6zq>jv*_0PQ`L1gNP_`nTuw*~4bjH<=Zr2F+Lx zW(VZxqUW6Ha=q9%rBit*3476Fk-Ck5;i_>E4-9p}AK2;I2jV@hx_MjNYW2%{*@6n2 z7&kpXox@!0_Z-Cwam_xFspiBm6YlT56#mR)bjvUgRn#sGN|=NOywAtVMN{5_t0qmA z=5$B8-S3&Eju#}zhx`nMMvo(n)>V56U|2;bmpZ53K1ME>3?<79ksATnbqxI9y)< zh?f8@Tnu>_JQ+kqfSMRP6^Wtl{(_8^Q{b!#{yvhC8tze7qkVB|#Ay6$UL`l5-}A5= zY)ZtsE~5p8^`#)Vf5b=pW-M)QUz`8Y?g$=Y6~=9n`DIUkJ!6gchu6_`&P3^yX?QA$ zIo*7nat`r09P+@F(MuF^hi`WaAH7SEkNkR_p=fLF{mBAC8dkNrLf1i#7v#H_(l9||ZC4u3CTuX!XRLb3IXyeaj+OtOoIrG|?km>rhJuG_GuN)8kMESk<`vN=w3r`2M zk^E1)#XV0WfGCE z;!EtEhDX=CFI@$nwhLBkc7@^s|H|Cl>^!tijy4;uEIb8?Ct;!5fkl0-s{ZSMR)XTr zh#duW`ARzMU}b_=@iyn*f|$t6aki-A$dfp&HDELm-MTd8r`BMX!7*m`Xen#HUF&3; z4n4bxcaJi1^7cyIhl*DUg}D2ji44*XoQw639+>*HYgBh1JLpvZzXQE{A3>bZ5pNZz z>ISV@iy8~*N3`Inzpd7OvOal=0_=GODQ{qS8XPQZ2mTra27b_s%SqHxpd)A6x?W`$ z^fba0SW+4ey(s&aY?GF55o}7r%XkoRy>Ia07hFzFGwCRApQbh0k;N4AB=P}OGo*e- zPsRQCxDU{7lGy=6t;sOwpJsXjK4Pih&?e92-S{ zi80?;pN=|A2eWbCY8_)j`C4aSFo4vlJ8s!w%k5RH%HQ)PG$AHRs3 zvLAitiaOhRUJM#CA{ZAPu~UI&+*~ma4dOvqUi>pwr6;!hIOKNDL4d6|0GIXY41{Hf zJ@5st<#x-Y{RBQ>4^-!=b%TLB^N8Ij?-EdO7X2%4_k1{ZU5YCA?WNJ?ee#40@*T1Rl95rKEJKU zY!J&%voYP&8w@!{0LO4I3>XudOX0n?p9Q{v5p1BdI$U6I0uI(CcnsQN>N_$OOJ3Y~ z!*z++H;(dHM99_*E^!IhH8Gu|+u$fHyspY00(Mjn;#!dkpu!Twspj*PTV`v=(9Fp- zvheb-YJiX@uFZbldsS5o@>6LK2ylr+P>)oh6!@p>?hiM2#49Isipnu7$ArqsS`pD> z{1IXqN@uY>KQe%E3%n1D6BpPp*uHXkDRkHVJ|eTTapwJlJ(GjT^G1r#D8lW=h9@gO zpH}fM2DOhoNt+wwH_ZPj5!;pDLVeOy1J1Nu`E)lCajGsBZt-^z(S86!YM~RQX6G{$ z&QMqeQoxHInLITQsHTjLPG1Wu%>`Rb)#rNlkw@0eBq+~Em|U%ATm=DVPH12Gnc7gI zCgs#T7f&&pAR{uT*jW-0YX3mz>nvjOk7SR3Xw_{2M7r9h#k`!_s*}PftCGir5T(k> z+(IW!x3%Ocz;rnpor&~wR-LVL{ZfT{O_*;R{!o*STD3$B-pf-%4rX{3I0m;b{ksk$ zJn+)Y(%@8yIev>>jfMXM3t#F@BAk9_(gc_zBBm~}q24`Y!$5TBxtX8B26HW(rie=- z8V3407!kfr#3WQLCSLuBc$>=xgbmiMbrf z;m4cu3}%Kmq{eSJ=+^Z)?9;+Yx6PBwn~E?C*+O<3KTKraxs?dkw&e-B>p!>_HpiqY zS=#H(mlCRmJ7*W~H7i1Ig&DX6ne00X!&q) zih5~{3uhh+LwQbOigsU%(lpsYkd=5&fV$17evuqfhUnr7!1;QW@iSNx=IkNpg!JZM zkNh~FN#s#S7C0K-00W_ocn^n$RptmR^+{_d9?iBn*4IC?>e7qOy~!wp9U^*VV;mNl zfSpdB4dvxRQeZaTB|9)jpl)$kK1?kSc~HWvtP3_RJ`{srXZ=Xo#dn{;=2ly%E(bmU zKmWcYh^t+RdU1pq@=v+$mfdP0CLM+|s28Frxs~ElGYE!(3td6tF4u`QBEc z`@yER#{NCx&D0PtW>(@(qY4Dakh6ZZOM}}BeeRtMq8K}=->GWiO8|Zd+~yFO^B5EH z3kjpPAsWE)5Kn0f0*kF_>n~Sk)WupaH~}#ADQHU#vf~swtwMDCkI67pexXy_@yz(x z+CidA%SjQ&HEV}tkuQz%sCbS+4~kCWnjN4~euS2AAWSwxhQe3VmSMGaV@!|>+b-hNr86}6N@SzzPRS0 zXV5-zfNpns1SsS~^Zf5V!=Mh@sK^7;1HmqXTZoa^9m>O?rHE}-*Tl30%fp&FcG<(G zq>A87yGYyJ$)3qIF!Hhx+Vg-0P4U_o z;9{qD+q&GBc-0q<+U>l9M8wdb32ZosdghkH`$EUg$)3qIF!Hhx+Vg-0P4U`U@Rr<6 zZY`?vy8(mI9o}k(GL}L4+V(PygDl4!BZIK~7}i3fL&8!TucL_R#&{c9JEY_>lw0xZ z9wiDYOTQ;k-Ck@~*J%!KP74pn)IK0OHrj%^fFu8S+^SzMBpomsuuVyY9N>NnvAGe~ zc4|jKdB!j)J|_FPX%+Wsq76o}L@H^>R8&Fbx=>RnGq)T<2$kl)D6FO`@d>6(5e$W> z@Q|ad!1Ek~t_tk)S>wh?;djy2!)1x0Hk9J zqdvVEE>TS8PZ>Gg$vP^-;`Zya?(|g77BWi=xo-_n0nvJQnTRNo)zsTt4z6e*#RL{E z&+RLx_P+ByHfy}kn$8gbU#Vn;khCr2d}P!wy4YC+HgJ^JAET2>Yoz)5{&-80KLNR{ zArBxr48Jzv|D%s1Z__XR*i%sK#eN9ea$txoj4%Jd2z>sH-85uYfwV=32PK{gs`_{v!9khpm*D|42qif&S-z)l1*`__dIvD{^t7cyra|4>%fl~P4V&}a4#7l!+3po>&fLp^?u{ro+*OW#ES}ENjE&WaZr~WC#PT2bqNeDwgsf!k${6 zx-k@ECY&W;L6!hZ4}O3e{;p;={s#h86C8D5Rhj$VK={qnln@qqP;pROoPiqmC~b zR+HyrjSl?LJ>r7Y_7l>lxI;tJ>b4&2 zARWh#)@xHDlT%LLgIwA9%A#+DH4a{gdCvD=jy|yc2IVCWF6H;-FFx9&)bUJUVp3tS zzqhcsbQSEeT{ECBop*X>jygi=mrIKExW9EeUU+ZQ;4fYuXxJMTk3(hT;pC`E8RXW@GsM>bH1lzDrd4FRPH$Db>cBVk_uydX zyDS&PvA9`Q3YbnCUO)~)T>y_ZbLyWS4vza8;|9IqHuZnG07qys$6`579GXXi{<%lA zrf@$CL4S}1G4NsrCRE?WrN_eL$zv5$|25$^jFzT*b7B$fsarn<4Kozn zpUbaKJlP_WwF#yc0U83CMrn>HV-$@R8Bt<={$LvJu^^UaO`koV;RPaoAWB@IN&SDx zLs{&-Ly#~`6Rp{{?S9*~ZQHhO+qP}nwr$(CJ>P8q^=#(GT~<_76rvUxnJ3Tl3^u>L zzS2EOqebw*`mx12AkF^6ZwXr)@%$kJdhyO}emt|VcNLYUqAUhy#E|=MZZI^)O)5Ay z&a|tgT73{S>Ue%O9xSXE$2Yh&-N8vO`!N@2R3*SR(o`IDqAVt09}ea!UcA3I=Y9WM?VtI4e+;gBg?^NGu2AjuwZxKu2L0qlY{BI9vp z!wIsYp7*VdW*FB`JLfYMa^CPYS`hr;23e#@^hEFtCxw=0KWlg0svQ7?O8eCaT9^`33FDxNlGXx9jyi|s#F&E$ojO7bb!jT)i94?~womSg@t6rKgsVTS z%#iN&K4fKwe4wG`JnUiNlXch8^jC8WH|6A$6jc{x1Isn-5(&Shsx@}QEMwo2C%Krr z)WnWibV0Z-4BBCURAN|Cwi*%nMzGd98w3dF{1AJ$8r_Hqh7b)be-X=Z;n9ry1`R~Q z_IK}epVcOCHlVF;etU1Mt%03=?1=yc{jQrnd^9v-=INJ+-*8bE$Z=V4iy&F^2)-{nyrFn z>fTNTD>xil!moCebN;#N;2dv<6D_XaE@O)&Rnc{VJ~!Iwhw5q_HpG2@kG9^QLhoXQ zyzp>86OV1Af^oHpx356^n@9MA;ZZJ&Fi{{zL+K;=z7=qj!`ws@p;+?%X8-1nV4b3oV89=U!lu! z6@X<&;mzYe_(IswF z%xK3RqS%1Dq$WtcO|yPoxlzDh5gA#(<_`@j8S>=rEh16p> z_wD|0*%g3k5hUg^=|jI>UZ$b72#)Ug3I6vs{&48Wlr>fzGn-o*HZA2iJ=NT@XJsU- zJL(vNO!6mUB@3dYe<)M#9sa?|i2$OdwonIn+=lG&G~Z}6N29uiWe7>n zkwpUeG;#+a=Et(JTI*fp=glXcq@NV2Ca!>mfAK6Mxm>S$(_FU_Puyoy!sJxEh5y&d%8ZzW2{BP|2WmKVdVd3la<*7k;oZNRXLiDVbi3=^Tm2eirf|vp(x#ejZ3x-r%qT*R)VQ+<*mXfk+quuB@U-u;A)j z0BmqpNL@_GqaVP&<-$Y=W;I10JABFMH#a}EvuYrR<9>>udD@AozE!>(!lYmP&icl* z{)6U}(-TGI9rC$|Khm1I?j|);Am)34Y?4xPNQ^4LK%LYgGiWqKiPq4x9y6~f%Tgp? zDWSqvLee2hv0v2dN`j_MqE7G_RFl|Z;~>f3r4`iBHZZTAP_`T%$|2)%ktg;J z#p5dIK)>lB*0=ZbSx%4s*TQx7*Gzl4#HJD&M|G$pl)N!#ziR*_EFsBYF=~Ei+bl#} zx{Q2n%>H1r?$L#zkK_>Gz7%jEl0q3G8tY`k_^fcBG~LT5g7SZ`0B-`$!pqeVdg2Y+ zJ-4C?k7UZ1jzh0)=D(?lPhAaJjZ^yQiP&y*kgP#Gni1L0$NpYB%}*TiP?lQoquIM_ z1P?f(mEP-?juBe~iUMm&=JV;4NR53`>9<;`&uhmV?=?2c!(rg~tV=?0&+(6}3FCFh z&Cd9_wy3D?sr-EO9qh@2oAeV2d7MX1wLu7W2@i>!=KCB*{B z4NBibTx#POP~u2V$f#yEdbl|S=jR5-P8=|3C!cfM=*PBwXgJ=} z|AO8Ks2jZ;sJqN?pUrC_ji&c^e*%Ia?A#wFjSp-Md7y6eyt=#rm$X?E%k<(`)cJLC zV-Ej^r40D|sOaWR8Ua|m(|%1HTLU`@;bN-Dl0=Wnhat!=jw?Yo3Ky9@U`zD4_MYjp z;lAoB;;J7Oq3R(ASn-1liplRdQ0|ITWBkVPT0_ z84{GMlAe!N`@Pb5qo;$FJsncpGALqWpHMs@j-*OsCBQ!F_+h_?;9uuNBeb*)At~m0xBqN-p5qS9$Bl3`_8aL3u3yRlP-Z5Of48 zBbGpfmZo~TW#_q5>6^J+_79J;=1}sEr?QTdCrtwHCoGl)h1n zSa+O{b#wR>Bs7m}iMS=;SP%<}u&G{B4=NVYIFITlsGic*I%M?QB*C!(C0N?E?$=_N zmo&ESyGPsq^i4P@;-sEjHOuTmz?6KE)$>!7){{@!Re8yXh4&2B$f^ zGI29<^~(r8Y4)~)I30kKtu?E|1S`*8iSm=f8I=+LM#YIFvX%uj zG~G3=3bjt|E0}s`hmMWPinb&PB0<~-Th5DSKJ#~w+M8&v)SDuucVzQ`u~0et7etr= z{^*%{)ebgKN!T_y3r_VAAdLEYy+Z-Vfn3qy+R62$fcU*sqh@Ww{G;}5d}f6uVe^vH zXMo$B{Ahc4n1M7Mxq&S`vHR6{Fm7}9etu1AqRJ()M#);9VV?qqUyU`|gF<%IXwp$t z?JLsg9%)|Iea73*Nzy@spHpoG3|-Rlrfdlql5?%PJk@uEloDxF2b8?7697%c<~k-q zJ*Lgm;hxCj^xJ|mMXjOVikki5zdk1C%6+7(D&VV$pBI-P*FxjO4k#8Ilu#~@BI9Ac z+$S&W0UZdS3m7&j=BeU9R)f~u2vvuD88nD0yzkDG$=iyW%WIn= z=p{r1=MnNUupw7X2(FOs57A&~p1|SMuPB%U4;Uw^buCl_8eZcZlYi$lLs5P d>R z6vT))A;5htU{BbXhy(Fyf>j3p&U1c(WKlWFmsw_4lhG z&K^&RNYBW3!*M7?!CR{`da%cBeWz^q6=MZ(XE-;W7_jI4j!2y{HV6FesS6a6s+ z{sfk6O7%lIBKmvLv)NYkkCB*o0x>)UlnHFI=_tzaVQ=~sdC6_(gw$ga(iA76zo~FH z9^bsy4ELPj6n_ly1fS5Fi z&}auzgZO!h^K_xM$kxz@tVF6{+Zjx&MjmP-8<64W;T8>5wI)Cb_@S-4W1{SVDJoq4 zK(8T(J=a3bH3qIf|0qGL!pZ$d6Htr@%KV);? zgUY$zK*TF?e}p*}3qEv2ou$-f8FlILAz!5ezTaEdP(g%w*f^$z@M2S#*x0@YiWz~- zp(D9}5Fmd?zWACj*_jFsKZyD|jtGBw^$L^0H5V@*r6DThKZd4aB6o#m1h&XtW~+~Q z63C`Zltua$IK!gt4<|@D!Mq>G12HlHzGmi{`8MTma+0~&Uqhnj+3`RamAze-^;Z}* zM>$@E4JxJ+z+&mR-6QH|8d~Jkc_zp7^E^G+lgA2L1dFq=AcNIcMIx$mt)m=u=grZ{ zG4F>v^gh>&!>BosrTC@u0K*^8bi~y5EyGb$e`>S*o)Cp;5;IntFN zSQs&{OyNo1AJ}vW&*lanFcCg|h^X=LOK=0T*~*riBETtzsX`Ym0{jAV8j>KNf1?_K zmWapO`!?3Jy0$C0zfZ=;xvnA=3(L8U7n)5sm?EOTGavHf$@ZrSg7W{Ryx;RQ*l>P> z5y}jt1eLrhVr96L%m($>q~?40=*2a5)d#Qaxb+aQ3Ovn6+`x(lrn=QvAt0s74xzxj zmX%1R_bNRHXudUxL8d$~`ABOl-*cbGdqY{LW?cY%f0(z!#H?D~u`$917!B|Nrrf5w z)Ymyx(ZK)%+gbm4$h5o{+@zOl12gpJQ5Ah%@{=)lU30hGsAn56UWj+quNLE5n6kMk zp5WS@)D*#Iz*7cB&j-^d!Mz^pN=rNRTb+O}C7W_zxT`53@T>?O`)Dt`P~!KH`Eoo4 zk>bFv${jMl;!L@_T=Xx}m%`4gz6~Mxs>wnGm&|mDO)J3keb9%+36D{31&sE{C}EA< z4@O^3(8Y`ZDz!obWqgDn4HarP{FG^}!FV65MRzARbCTga3=%u0&5?`Ug>ypuT7_u( zmCuSf$>Z1gG|oYM&Kd8^aw@xY0i3#%j?~*zH?`C%U%nnkncewMfp%Z^zPa>NbpcHc#1Gx{MpY@nI1nBGv=D&=9yxQzQuSsAlLu$jT!otrYiy}LB8 zn&?1KJtFTa+s;U>%>_hc$feeZ$DDJb9Eb+(jnHyG@pQ5=%Kz&W_((xb+hChT7wc_4 zD<7DhN^?wkNI3GNj}$44Aa3m=SLbl-glC-Iquu-nhLEItyIvrXTEpL%P^Mqmm{v+OUX;-8(_^e48jdaiXIv%X?h8%t>@kgm7PSEA* z9Wo0RjI^G=cuE0{Lct$V85$158p;D1fCPa|yZ%4s@NBDSMOaFJTRJxuSs-!fS-s5| zW;{KULQd8BaG5;Him-%Dv&50^Ak(J+$C}(if3;jo?o8_>V`T9Q=?;?itbfGQW2sPY zDRwd}n#0^B&vubp|J=>he{&;?J_+R`vn5a>t@_Qc2Z8hZq3@ZpI69cxLiCehuPZ@Qz(!P>wICK+SGZ9EhLnzlro68 ze~@4J*5thOVzb=Kp9DdW_Ht0=n}ST~0)_WJiz5~!<>HA(MXoSsriMTuJas=m6(>HA zxVAtujsAhYwLb-vG0zjGNWdXU(D-B1a|DhSUqI=LnWw1~nv0MWdjj40W0trL8?$E- z)Im;{UyA6dwAE@cElbxU6)@?eUNsM`E&xFXDR@(O#7&lwT7OAJwHBoHMfyMvx;h5C z9pF)w+6AF$`cLlUS;dxj4*$P|p;EzCuE`Lk4X4gsOkP&BTGW`Ws7^0`fZ~JDfD`$} za=JYiMej0c^ejw0Wq?eC(b)P^lXdycBxzs;B0kLlPn_|(0&_!ZwU`4)eI2ZP z-#NSbFR+8d-gWDopW;IBq0xUTX!v?jWQ6!9v{XgZ8tpdr$5%jM2-#_i5p|1G4WMXm zX762lbE-_W9(_u{YSo=(_I{%*4>`o101GwHH@HtD*2T^UsTE*j+9{-aA4H)foo*Inp~f7AYHLF+hDh|HTk*n)GAQEwD$-q zjHR>3Plz2vC4D^KhL5+*EbuhEIdG?nJ*&wr1d+nsIdard5}-WBcRi4wqQfq1@ZoNU zE(E}az44=poMg2&UAN@Yap7q4nOLkTdPE71>E_*GIL#}SV4Yq*A@~OOYr2LH*AZ&g z1YO_kj{yqU)!}KrE(~?Y-XH?(+(g&fB7&RiT8|Z=kviHlgvn#svkAV}7QHa3xT9A3 zlS~)DE%rPoBjVpB;lWT%UkAvlNqf7m0g#RO8s91kD=m-ptr>LaV4j&E;*=LRY0Ut( zN&6?b1QOeS`vk`sP|2eCFz8V|B>29p03_pn<8P93-(|bH!TH`Ek*c> zmV`P;(hzd7HViGyGGk7g&<9RYjy0ABj13nUq=ZhDSF_cEVW9@On%eRi&6`~CScQbx zotgSA@2C{$`ApcT2KiGI_1c?NR3k4>HZpH&*R4sH;?PiEmF<@bahy%0tky1x&*u}` zd9SfgfUP{$mpp-Lvcio1PJN|y<;i4O4L4gS56dT%6WAyXy9 z9jHkY`cE~-`saLJk5Y6jfo=7JboY5=6fjp5Ai=fv6SxsPyOPilEzp#ukph3g!fG@C zY|@!mcmMhefIz-quihh4+*AqL@w_byN6m#;%u!W?Zb^{{PPTWBD4M&t14&ap!EUp_ zV)H)@AC3>sY$KP8%Lt49$E~Wv#lF5=W>mA>a9FynN(Z^}_nNP`9@8`5=FAjr)+ieE z4dF3^`92bq;ARCwM-f2Uh+U$+N(j6{4(e`!e7EF79iN!9$dt#u6fYhdwt1mr+e|{~ zi}r8xUDrE2UoTexYFy|O4aE3)kcPVDhQJ&ssruBj_xdpi2FplLB!Hem(^3tt3}x9( zCwp^pM1rYj&z}T|HcX1Vv*kbBw@l?)jzzm5$q#TPGNE~*!D0WcAri)Btjd&jcFBZ< zOseU{|K~&))E*P>>(6pol7Z)J?VP>OPCnkXLb7Bf_ZW9;3D?Kmb5J+ZM6g3z@kRyq z{I;%NA-~e4qur5?MduxBFX1lw$BBcOM92c^F=aAdKWkn`^)L;X9eo}!;>ERd8n+@8 zHF1&xU1@=k=HU6aTV7gO@wvl_^!tSiX(24lt@Woff)SFWqR|7=(Xg+&L7Eb?oBoc- ztsRV6F3IRfx*nfAJ==x)s&kDUrZu2`J(F9oVE z1SYq$G?TWF$fs*Sm@34@Ll=>-86Up^xE+I666{*$MX+_VQw*lh7SUxpnOVBt0*i{8 z@D!1M_CHfMfri-cq6oXXy;`zr_o_VaGyGCG6k5cl-mg0a5~BW}`K{%0xTl@h*vcsz z>YJ;*0EK}6onLeDpVo_Q^)wx$8oNJXKDWv%_l9Mvh(=RPovh10cC>CvhYckM+rHK$ zKozT0)U(-dS6+OBYkI%D2}G8^`8&nc);#^vi0CPelPB`#GM~doo++Gzsui12AOc~Q zbkZeR>hUxG~x5ADy^8b;uHZ0>g=O;^!)pYcO zM6_gEe7Islg{mh#O@i#!g!Ddd7qCc z8zw2}7aY&dQqqF13I?)v>zhUAeN_+JW4%Xs%kRGE{-dX|qc$qPX`L)=B=0~D;RIOq zLLHfHxv|Jdp5p?aBnylf`@%jFuFJ(f=yX5*Y>k?QZb2ww+}9EEcD!H#4~-O{LyFt+ zSLB-eA+10SPlH1wfL%=<9LAc0zJAC3b@$Cr;z!(^TGo6!2akFXow~LkyjN z-Zz@HZ6Roa?l<&{C=~h0H5O2ti4psdky+ox${G@0UX*3eo{QukM?s@iqICL=>v4M& zGG$e|WmB88W%}^`P%5CP&+OIrR8P!(9zQj~U*hZXpTBqnAl%IT{Z`;DFfal03sLNFGSi1=Q+qyVV@XqjE~AaWl$gE~ve~=6 z^$)`Wl<|eZ&P8jqJK$*>zbxBo8lVv;%xID3sTYp4OTmif;m~g>6eAr|^g=(aCuF~S z=c`CX85$vBbDQmKxdB&kRWG?0Dcg4)8N%JE^@)}PY=sm-x@#F72(c!<%{a~i$8$gG z8-4624ajg<7i<`KHI{>KfX2H>mcF?!9;tQ6-4{1yiA7fBX>T>6<(uws$vRMnI6U6Y5WE?$F}D&Im_7sm&eg(6hRyIVmW51vbO=hGZqC(bFV8rfB>A>})hDK^KN=_! zg6G4iT7U0(A`04sZDa4S+e>;H?GQ|g7fTql2u(pdTWcV$+>`Qz7Bg|NGHiaY5 z8yB6u4B|bDqV_v^jktt76&BmUX@E2_t!8A05NEz$aKA~g2e7i`c@;{pp#oIt$YF8*!h(xA^3z9^RtcD#xDd*jK6_P+=fpucW*dcgEY#)XL}S(!rNl-&T+|JWtI^@ zFs|UINt`js7bGm~Es9>KWrb*E2d5QR-9j0-n3Uz-ZF);ij8011RIws2T17;k%R`i~ zyLuD^^f1x7AH4c#26d~ZdGr+zek>R$Q=cEC2?0fp zHo|bMu6lU>%D2yMQqnYe1=e8DA$j2MNq;oZR?M!Jz|W<%609X`m6g_Dj1Iqqgh$Jx#lPq zSo$+eH-J3VCHvGP%OOK%Ohxlt7k3i3a8}AFOII_Y>lpkC4&FMxL9$8{l^2}YUN`d& zJNegA`P79uIIK(M=3eRUeGq+C_A6Z+oF9T!$Fr>U<&YxstF{Zw3YQ`O^OT8aZws{F z$B)wikkx&+XmyY!EczIL#I#$x6YaOo{Ij6Mrh|y%pzuwi$tmy(;rj^%gM}=Ke0`a! z&CMtuF*zuO^$&Occ13t1!cmeB$4Mu*J#BR zdhe7m-l@bG5OkAvJa}8!18l9lyh>cKo{76Co`Q+ekb{+oJs5XAw-|L_fef;1VMqWQ z^`TDyBTa{j^L|)nA-iF`fWALfL<$ekK|;%PZPyb{9Y2Vv7V8IcF7}vU4C6SFlS)2A z!L#kDWv{r(_SvNkTqF7Glo7%CX;5c-)zO}jg!YTX`kL}wRZRl4&xcje4MnjJv=in9 z`X_fb$o7@A{e+LS1B&4>`aGs87S*=!7}t8trIxKglUs}=2#A>@FvBg`Bg(76)kEM# z;gv?z+^H!%`|s(ZXt^i-+0Ba8e6aOEZ*1hHYxGx@q8STfq!HwhvEH(>qp3mA8DRt` zQxsdm1^(!$eU8gg8w2+(Lse_Q*$zU`)l6bA^mfdCQw|6wjP<-7kLnSamP~i^*SQHl zG1!sN7cS-Ab|?>5cVaFYiu(E2Q{YG{njv>SRpzbFc8^b?3wgwU=?YDF0?2ZR(2Dno zE-E_~Zv6eBUlCnTEgCS>xJTew?066p17-RQ^vgVJOm^SOEedlqufKR^STI{};sOY7 zDX18=YaV~OZQpUjI`*-|9AMfSr;Kt~zik*+wtuAPtLfH8Q0DBjOkMB9U$uaBs>^x$ zJYif#uz1s=alEwY)~F`VCL*R@$HH1#f`(rsoS9&Iz(G)B3Wuce)xTM>_jkM%5uR14K5T#%)FRy293``e zBOs#AwgWdyTia|Pb2sAm!cHR6WU&t~2{FnFp1x;rmu1dsxMGVH`i}2F#?kEQ=74SA zf?dqLnbE7p2Z?$RMzM#FD$2>)M^Ne+6VwktS{e{qwH)h=w~4$_F5VHjT{hCsNyNi% zD9I!B#Y6<7AUHjnQvR145uFsng`H&J4vPs%CWW1zrR712t$GAA{^-OMUH`H5Ql*Q) z7i@-slR6mtT5e+Sa~+!_q7xT1@K9N|W4MuK_98tvRkBfIyZ{{^(H=ya*312n?bOXg zgSW1)W@QU7^;6kGqN){8r4XtfJ~)(Rop?LQcrCi+lPrE);V8DpPz5A5ZVDZ{iJ#Qx zw?Yq#A=D83OWG~%H6DQMhiYDii%2KH?4YE_~ulF2Qa zXk4u55)ht&_*GxP|`ccksxpQ4vKpmor()EEnr zb8;KZL!I2%sw(X>|1t+Uz(nykxU16DQYK+_t9X*&BIl^F8oK%K4`EalGxzsTZ)t-@ z1A8}i0M<<|TgoGW^?$u7-M@id@Prxk5Fk`!P?;es?F`<`w-frjG)De;rrfp6l(G2E zYo{bnKau)9N8Z*Y;wA_xw;LsPmR{>FQRO;09-cPGVkN<*Jc4|$*1==D^)mpPJQ7~DAB}VY{Q40S(0aRcZuwA zp#C@SoHSuIP4@3!D6)L^T$f*kv(*!YyOk)k|m(bvOC6fr~c3f)9#u1Mb#o|JgEQ&MY`uC^%ornLi9^EfYI;#E}PTL7$dY=nK)SaY`4ZS;wV%Q{Ot5Z zP?3F++K$&3eLMV=8B%(PW!E zAJ_qZb)zHIdvoMHux7fCw^->X6FWT1M}#8iV&N88Wf{D}{AYU{@Nzl8HXhPfvfXfk zxNyJ-9{)++O;wmZ<>ZCk^8V_;B!FzQ{lag?jlD+U=FAGH&w#umB!q%x25yB9G#!RTn9E$h_LPXy01@oTGy~)q zOJ08rgDw3cw>5&}oE0F_lq1QDAv}Y2LKzT|81ZGseW7oG=fW1)K)cNz<0O4bPHTJC z;$|izaX4tp&4Xm{KKJ$ye%2C*1sjZs!p2HL+B+oUI;Rtg;~E zU{=S(q~l_BO{;`He7z!PcrY0Sktn^@!^dOZg{76&&g%c9^~vW+QgJp5 zsP5@KbMOgEIUSe_%P<1fjHf_hrcKx;ci|9 zu${0Y$!K<6@=osz_iNe9brcf|ZMfmQY zmqTW7LBJ4<&JzUoyq7t6nXW|u=mr=*(5p7p3E^&ARK_;t9VQ9?a_K$DoFmSzr?=a< zYT}t}-_st?uXxVFV=Eckvh?h0jtl#NKNIh3VdYgD9{#S06m4EZD7O^CDOJxdJDSLI zRNGg#j^wp7tXklMrlcYs%l(R6;LmMRJE6ry@Dd9MA1~Wy1D(zU>0%zR2^l#s@I`~N zC)YXxTyA`SGk*W@RaNAp+U;oy0$p*f6*$@I#!7Ui9@W zWpSwvx^PyAB}n)uT(Fv!X&fb`gT73kD-lQIuc`leQ_e!?vectRc#zMT9D2|>#5{}5 zyTje5@CggOn(AabIJ|5-?|~f(Vz%r<)#KZT*v3*T->?r(bH}aX^&qMZ?VL#C<+K=k z2Y7K&Ws|KNF^kblj`($m*d6)>%)BU9>sRA=~=ryLRHgI_iT) zFrzF@z-=nsFZniC?B3qBk)(x-5+|tMMT!M-N>5=fP>F0c(!B1KPnjhZU7}1G<=iii z!;Sz5HL0-g!9lTlHEAm6^*xwBL{Pw7#svd_`ZI-o1$w@NT-~b@jMMp66Sv)od6}~% zT%B{`U(x)0Y2NG>Pe&Oy3*k4L{jmdpB$ZuqffrfpL>m3GOK|!#Ud%Ev^{;YLq*2t5 z0<(!Jpo517ubUGqPtn5;&M59lTDjG8yfx25P9sK@?6gL6XpR9IX7FIV_S4bZKb3Lr z%WE=2r_gA9Z@9f~DL4!va$1(`R!_o1HMdug_i8FlBydDP>q_PM)>f!+ptCMCpQc*p zP7c_@(^UbDp)W@ISpkRiUbU?8y#2uvuC7vS*wTzoG_Pwfp(`V0NAp23q^cW^=F4#> z9~Dt>vq+0PWWFM+?Uy6yG=O_FmqZ{>2D5XhULL4QhZe6Is+XEySZvVOEoti8PnES( z9i&X>m*)S@ivJIUWq&Z zGcL&Qv=i#JN^g?4`=>($_GBK2I1HgL2jKbOSTw_$8bTBbGf@ad_y`)X6KMgCRUaij zE-Wb{dY6$b`YMOX;Pn-o2odTmyoB6+#Cb27Nc9InrZkKb zy0~YvURCGBI=&-e+-9U}QsgQvAo(RIjmkgGw8kLs!O%dbu{67_DNZZ6hp@I)22EZO zjT&b_tFXJt*8vZ5ZFjDELcZ4Q?M|U2GzTuweOr)l%Dc%!S{*jn81HJKD5{iW5)~Cn z1#%E5fJZXUxNB1{Boq@rOC@lX`YBHd`Mw|`rASGN*kDm5*-rZ`Wz$oXXcRu=swtZ& z@8HZi%=d&<0J0nJu2Zt{KPsoAJmPR%iMrSxXAXYEcG|6mBlW=Ej1H;~WCPncw@w1T ztxWGLPWYt^(QXV!DjqHgBE6hjLFpmD2GYow_Ppt9V6#lE=U>XWRfI>|+NZtNV1DYF zkmMQYgPU~&4W+z%ns+P?0g2_?YPb#&)P(hg!Y6jXNq0aVtUV1U`eEB>H zuxQ_gukHEpaa5f5i)Y%brp@4?)Q3N@u4-quGpa84kAjW@$*Y@&CyIxBv!bW%u<=?- z#-v;fi;fMeF5JDPwrO(z9`sj2a~PW~lv=`SPi&fz%(rNCxYpXFx}WvhVc`?^N8BdB zpiX;dqYSv%{q#uRYirU1ayTZ{-)98lKOa8fQE6~!@sB!*ckm^bfnU((J6YMoJguf$ zbhh%J5b2nvbFuAq+(VP@f9bxDSu5-<1>-yAC>hYPTgTYRcb>r>8}1_A@<)_*-pPlQ z?J#a_&qbp1V)kxCm@KcQ7GwG~UBqsP2Wkm5q1j9faA2_S8L}C&r_oI)m)mbPtDCSv zO#3>;+=1M}6{DkI(GMCvW$9DmTpJbgtnJP*O26-B(czrYei{BeH8mzSK$>8~X3(UF zSxOL>4(vN!D$vEe(G-1|O?}w{Qdy-$yyewcGs+77SSJ~3zc?BzJ4|GVOu0Q2M&?!j zK;l@~(oMY)SxU=u!FI=5Cbo!P$swi)K<-O|>U-lu)U&A`+SDnP>cKnw$+HK^A@^(m z;95xRM#C%U>4Zv#WVDw$#_B;@V}rHH+dI7E@u>*^$zLB=JT4-u)HKeOxF$XoHmvkYKHwHoH&8NbiZ}y zl2|Dnd#NZh-w?D|>!wc{qNaK@%A|%biWAJ7ogHa8&$e}=9-&;LwkfH2_;rA+0dFkT zETK%^TkpdNk_9poZ0g;+L!wlT{`$T#E8FUP#AW6en?T<50C~8#V7m|ErM;vch1RP< z7yIE2XY?GOrL!~LLAFF7BmMkCxXINSC355(m|)*25C$U!i@(mugL#Q0C2NsCO0?#s z@1n@sEoa${n=%#?tiI*}{w)HUmeN)GkQ{F3&u~AFNvoQ8BJzSHxjD~c%||eIcHoWG z(&BJfanJ_){L{{-+T}F3p09W^$X5czbu8og>`tR$@WB7EXguXanYcuvdTXS~3{xvP zQ+kB9dXG{BnPPriqPP#7p>p!dX(yyJFRGU^dwj0u;q3^Zetc7}?BuR(Y2#XFPS}IJDNqIQLedn%geto*)z`M9#cl7Bk~LkKYCyh{dPKCZO#01@Q@r zxatFy-8I*`B#!1NBCm7mHL!K8L$Xyzqj4|s$KOXW0%(F0M!<{7*%Ji)AH{1_`qz<8 z@dn@^{l1`+o1unHJ($%da{20z^EZo;)!f$;<6Tc&6#|XSoK@h_%G&lHIF{>Nh~vPh zlnYh^1G3^hE0eTmLzT6=0roK=Fzyh9d@e^0+K?^lxPpnEi(>4=2b$Q{2%dD12zqx2 zKi7;JT4V5}5osuNx)dphunK#VLiqa0yVF{ngF*e&|t?hh<5-lohsLIA4 zmIQ{YnMTSxg{0@KZ>fz4o(+0e6cXOTffw^}G*H6MGr_%5(Sm;3d=Jf>KQ}Wl8D`huS77D??^HnM$S=K(IDgdYJ`RsjYxCiJ})oV##WgY zO?SZp3iu~BryfX87xE0J)jT5FG+*0{bEKCCI!j=?t_ni&%rk{{DmPz$ zW9yHzQ5BDz?bJW8Q5vWY5&=wv(&T<0ti>zLMeA6Kf6i$|txg(gU0Hd~hlnWo6)2>2 zs4IqSp`2H@?1hmu-$xsYD=?qMg@g4&0W!t7u+-gCvUw_4nxnD>-UUo`ScK*TKFJAZ z+ar$MoqL~{R8a_Z4!6mH+u&9PW(9v}&a)$HM*DCZ6Q<7U7hQs>fC~7f)UH#FBZ{@r zAa9QBPAQ&}vihT5PUuO{;C?}%F7U31P+q^eP_05kEwZt=^L8FznOae77RuJ&lgKZF znWONnh^TS_=5}FU4b?C)D1BXikx(mD?4O0Ex%g}OWqlX_DF`bL>{i2cpw1C(Ly1r& zyl}JwMoXxvI^-Ii`*ksKc#JXL$>5c(KT6JKJx2nWVK%5a%tvGUUwDSee~ zAiTuQP@j49D+S_c_$Hk;1vt&d9<_jd48Is^g+HT4cOl{K-LvLtHoLQ1odGrOBr=4A zh52$dvpt{;9WJ<;jH@yJfKX?)`3bZ1)>$ngsdsMhuOEXs>NeZlf>I9!latyKA z7v8p%5U}uxe;rnv`18}pL)OaV9ya@~%kW#61rcZ&({r3>RvQpKQ${6-^|gDAj{D`r z$?2?bDTGS_@YkVgtxjbxi6(av#Yu{1bHBqujyCP3ut|)y)7C}pT^ARntqd=)UA1b7 z^-bH^UF!&L@Rajap{jDjQQ0u@N@G3T6y8)?S3(}~uuM<>Yl2;0Cd(=Q_JDTn_p}h# zI$czR)^u?4^mBKy&b|b$B=Ce)$KaKh^BsxjtH}oEkcD4|euMYo723%y*~Pi3$f5s5 zXbtmSg2ji*19JMC&wy~QIRz8RqBB=Q9NKDX9f=|J!zdJmuWd6_SUtB7xbR+P4ZBNV zq5pvZ>Aom;6aB{HV4eX@kq20;#j$`*x{}zCdklryXd++Hp{3%J(ci~~*DH|zb=9jK zgu2A)KF0jrLsB#--2`v>|J#_Z)t&s5M=MPE7b80{pn-5g^49gV`hGm_4{BCW>5Zxq zQa(@YY#>!&3&f)VGeY)%?IQuXpx;`ul%emGek%(a44tskFE#>0UU?r>-CrLA47q-o^Zv zizV}XQvhOS|32tuUl>jU3m-z&A08~FvI#&?<_FXmo?4ZZE+KN zn^@l9qa)#Glc3I{;nr=>2VrdrXdWtpjLM%Br`iR^IaHh$p7?t?s-57mfqe8b4n;~m zZ&F_XS`R}OnumGzkl$|-L2RW0hi=B5X3JAToWT@HgAjp~Px1%EJjTuVP6?B_`3vBrN7U&7OvP!G`)^+nkK(#g1fNMulq2A_SPVfjgD=RT zPa$7w1U47gca?<_)lgVI==}o!kQ=nw(E*+mz~PqKh9Uk54QfX*qtRDWABJH3IV+!L z2Y6aNit-J_x11`CdZROA=>Dxx9MBxJP7`j{j9NR9+}er=os@JptW^d}3>*u-#RLjiq-WQYW zX$-1^iAUVMx3oq-x3PU2f|PqGZ%*ej{mBF!JB|$qn2iVji9fiBu4GGsVZ?Lva$);Q zt;vMCGBO$Lz687mBe#U`y9LR#bbk71nWD{nR5t+@VPl(!$`ZRnfMjV>&l@a|Z08?> z`X%3V%VbU@RpQl^5{t%Pfm4`C2p=?-nfG~x8xE)fhB!ugi}xUm{s86XOZb_-m21i5 zz#-ctf@(D9KCqHq0Q`J!Y2pjtEAL7%5>|HQFp|VG&}=)Ob1L)D96Y5;1W=_KmUu0V zh{wq!nrio?f1|Mv-vF1MwhgUY`Tjrby+f=pJR2>#ZQHhuciXmY+qP}nwr$(CZR>vH ze|B=u@C;Ydq)nRUY5Oe1TwXgO$_E602Q9Fl&tjDBv+BDQ79=>U2-$JQH~o+R`eW_4 zl`)j)d{@4K+X}Kxx*s}P;HSTAItv&u*pg*=(1|TPLnn3Ugf$s|%E108wpdrIr50I% zqc6XX7of%tvq+R<)ES=mS2BKd2oLOpYBmYB3p2W0l^szuztAtjJYi@_5!)tkhSt>{@XRq_uJk3{#>3oygM$#RC>>gxcRaOSt#^CS2o=vOkR`FsOTQ-i zqS};N1K;9bnFEtbM%uzuVtK7Z_7$j=>ehxAr|X<0PAT23z}%%?=8!Yw`kIpL(Cq?rRgM^P9L++*wvNh{y^3u*IK8*T@5#7H;B<15LUPzx#J} zh}z@}bGCszp5vffP>eUM4h)K5@(5YeTp0NPZkI5*kw?67lM^O#1fwxxW3lFgHJIl!D9-|fM6wLDuLqK^{b)YbwihXhzhX!VpcF8zF+U0o^+VKWj+&A&S*w@of8ji>y((_P>LWGum-%2bM^@H6haBlpnJ2wrh# z%F+fTI$<9B*kjN8w*bwyFaG3>l9G(x{oO$u6=~Niyo8 zZ1-?D<2-sZp*Baget4@O-yaegD{Rs8z9$4pL{AI4rIL!ITL|`5s`CSDIGeb@TC2q4 zaU8`pBVJ0{+=GY%+zoD?s=f^}#s&0pWE2qGA;5q0-eix(Qv~(pd~KXt}2q zMTs<`@rGsjjr?WdJzVU$6~@3c!CGs+9KWzO=7^5)plQ11>#Qi;6jTd$cEDNftVf0N z7>r+cd}-jr{q$x-(Wk{zW|(!hpU8*;Xf~4L;K~QAmwkkl@ilVk+@(hZIR$y`EmR@X zL2$(ltRu`ku(8-PtDPsaCx)#^RT?>iToZP^;*VuI&cUjxYp(`&O}-wGYCi#2xU)}K zkQRQRG%6mq5jg{D$5ZZ17f#BAa@RfMu>T66F$Y#b&Hx9RN%ADDQCck=D+EP6N`wAV z%_8rlEexu{u+OJ?YoH~TXHeGa0-3p=(>GQOZ4g%GoMGZr@Yf(&zC%52yr~P8__`-h z1V7qXen2@U4(7pnBC*E0u%T17yN>?&Q^lW6)hL`-6<|zKZUIfC6WWcM51 zfs2$~Sr5PU8R}dcuR!ZdB0eLWkY4hW@=_3 zG5e3{I+ppnmSfrf3u%VTXjM;=gwW2ldb;*;1G>-J+*0J7r;Jw@2HUHJ)3R|n$zhD- z@1*!XF&HF1oYT=&QOc`le*O39rWULjb!;=ak*CahIKQs-2vo z+kgOmPhs#u?goy5je7>3exhK!3n><^YfPqQv9iLO=bqivye;O@W7X?=+Z}%TO|HEK zMCs#s*QQ8~cB$6BZ}^sFNhQ{2#F9+lb?QV58<^HVMaYpP3o$nE7%9|MtMt6o0+Yc- zpI39N@~$wHM*VwfcK8zOe&p-~*oHyp{ISc#N%ByC#gu-vA2f>>-`K1)H3$TA9zd+^ zFll;Yvg13YK^8;Gj7cf0Dl#H%RPtxAk&5^=)_w8Pr-<8aUou52oM~D4?F;ZDPfSl2 z?kQd`^)HLw@C3^PMeDuzUkoTnX@5|kdt2|o_-gJ0eYac;ya9-4HKAqG!dI4qsl|<} zJkSF?Q`G`mWcHa2dGNpZHw1p5_Xjd_FUt-Cvncmib4etq3Eht>6bjR;ei(~d1i-PS zpJcu@Z@sA024ZYP5+a|itO2|C_e7!*)8T$gepY%^(TrZug6=0NGUOkgwKWr|9A3*} z_}#NS+vU-|yn=T#7Tc;ofo;fX>Fng~(icWYlz1m4-Vf#3zvi)9%-*E3znVGM8=ds; z$B>cqRC)4EW9V<@TVh+MP={7T{|~MdB}s(8e2_Tg4Feyf_GTziXbhq}XHzF%O9VXf ze_-DQrWP(=(q^Y!22D`0P2T!J)l!t?$-uY+jQ!oUMpAe(pcq3r{%>WL-k+QGi8d0U ziY>Kz~oE29Fy&>X1XM=i8r=j-#PSg7Tz0Jq&npd-u!9 zFU3}s!84J~XTMbydo*p$>N(kOnl}TBu(3>9Y%U%E*V34UCtuI4oRYJwJ{8X~!Wdv` z$;)sE414^YJk{+&yU2x;?+WMOl+RlTFFluOdegH~%P?O2|64C}=s98(t;5k(GnT){ zSLfBE**lHCQmCc^*+2v@_iXN>e!Rb=VVBOX)tRCWvj#b?!TzSlom198BR4=oI3v@| zHF!!u9@ECziV+B)R+-zt5Gst!AQ%faMluKYel})NDc;)Q1{8#G9hTu{-q(mi@W!9c z$cML=4(#r7*l?}A!j_M_?L-VE)ACAh&YM##^w`gu)tilYLXbA;UfY-U$fk3SkP&KK zfItcaLRiSTL8n>Bjyi7TlV~8Aep)HogowdICCGVX%uRUMh1lkgqheJ9SjQ$Qv0#Lc z@fj8_Uk7vlbUvu-9EHNO)?{+HNxD%R%Rte9!%jLp0ePW!5^*Rk^b2LL8T0}=K7`)) z=?*l@hUB&YzQ^SdU~p*_aAIT0MKkJ!Ef6L0LJX}U7mQn>86w^`2oXh_>}1|-;-dU* zmGm3U5z&rX3dWkzN6{7u36a(M6l1QZ2@x<5@095MO?l3=RusVG(4i?f6j<~@S3kqV z_nr_>-0G?RcYRFig8Mb)Pw@Af+WFd?REhmBD3ra15lh)G%Tt9y}(7~r9z^bjyU@SDS<;X9nFl=+dYErYNuG%69_ zp1%19NU%}Z5v-9E>PD@&$^g)g4F-_1$1a&%_BgW}V8(V6$QP@`Q3PvC3(qi_t&7rl zA@UjUZQ&^V`>~Y%(2iOKz!kIm+iN&_S1HeiHQvR_9s<5-O(8+3^2U7g z03JAaa2<0gn?5prv#*Mr?1G1#%d)c{o1g2yz|_JjX+21W8)||TR>@0SO6Wjy+owd3 zxsrO;#O$1bz|=wGCLTqoiU

g{dsDdSciS_VyqCY}B1;WKxT=O4-EShk?0*Rd;|= z>5+YzRf_Oj(6-vH3FOf4-U*2Qki{)IDv<6UzQX@|KK>v6zx$sj!DNa*9Kn6i+al=$M2+#Em(>}F=_xkvCHPY>t&-xul$L4*Da z;p1Mf(9#~1#=i@UlMYP)173+@!Atw3s{Meo|E(#6x=4`6dX(O8iMche>YnJ-T$+>R5s5nwsis5%{ z|01`dc9y{gWl|R(+YI%)oihuNb!3EtI({g;fRwB3BleEl8OU`s>ru0V4oPi97@mTv z`>V^u0DYA2SIS=j?Iom-EyPS&Eb=?t=V~wM3>KN&+^&ks&-!O0v-!cmPccubHS4CFZpJN^_c9OG_^h1MiDNlq!+i2EB6R36TfmeDw?wV>M1@OsqEi^fRriMa3?TBz#;Ai z=p1F~$r_PtaEaEmuF>%zDRSsY7G41S+}uy(I1&E*Rj6zhqpN@dk6fD2%7!Uz8V*4( z@rg6NyuM>V7$Y0Mbj{xu`DC3tKzW{HW?!-?W%L#yF8t$L=1#qOzBYo?wl3&W^^r`f__{r%%B{UJ9KG42X!LSprAARjI&?wl=7CGhL$m>3YBAN z?#$mm%yjP7iT;9_f5fJ|90zh~07HDPzI5Cnx9 z^#ZY^L`K=K?upf-Cb;ZhX7cf4a4=h#KfU@abk5u0BXynQE^3r*4uW z=Z5F&zy#2qbB4(yigD(vG^@}qwKJu_E6J8x8(}W!pE$FpQ8uS9sHlz$FGxw(ud0P& zKvgO|;^BHDKSPdi+m=*l!(iQx1)DbM6(j}|Wh8yZpOXtQ;YOqS3AaoLUe(H|Ul~_a ziy-yF$3p=w1B~8pW@0ky=3h}Z#A){c9fF%vk<59wR?3jQ4}{7rvrk2mj{3=GnvcAK z6#F1cLC0>qdxO<*T5!;G?bvb4_SNka&t8m0VThpT(qFO(r%)lsR(TsvSh=Ql%X9?R zH-|tV{CLrou_;JpLt6s?-P*FgSL!N0?&+%rGs8>B<4a_Fx<4RKUNoY)e!DeSJi@it;b07ToACnOx1lqnqZ4SvBO~QBl>Th&V&iKzVJScFtopr5aF%AS&j%{ zYb8w{UaPCGN0Fm@q`H;W2C3H7qQdsi)`;zNDn9qNT7T&ge4~cZ6sURxhC7->8AINK z;cDp;vD#Bo?);^~#0?iIYXP*0^AsDoaEH3S?(c^e^=wniN_;e1m1KC6N?Zz_F@U2*cbeC{W3^+4a&cE<0w?6%QJZL19UkA94`%*V z7vu-x#g_E|eSNzr1~GR*uz|=9ek6iir)1?*^GX`sUpYaekZ=3|JNpsiA-O4Z1JT?t zaQ*k*rDgA3aG=|Aouu{umQPiq*ryO9!3r~;=6|?ga9r*&w zUgUwMi{!CC&61+Ff*-+ z#V&L*-jXk~AF8vu`zib;negG&i7=@@_EKJtGuSq=$yf-xEH#e#LnX2r;3tv?*?7YY zbI=0^9X)xyBA2oS#l9mhbm0DP5CwIQ>Wa*F+HfUIXg6N%R8hM&dhObvQuKnaHPsVX z-Mb}zp;R=IGFwrOSN|`EFq=j+;su@;jSr947?6twoeEPP<(;kw3qq68npX02V(uEK z>M-g1y^`L98iRnkhk=ZIVGIo)d-1U_&EO6w;}nVJCSumuf0v=f&;WlV*6*taTX~I< zueY1Av3S4{QoW8sZ21TAc}p%c?6j>Sv2o5wPD#QtuI^g4|q*2pz~ zS9`OfEv8JAlX!C(FjA1U%!GDKaVDYFKzlr7Y)Xs=I;&r}jNi5c+}!BCbJ3yy2C@qh zbqhK&3qi4RPJ!q^FTpMMhLKN^1ZLSx2%aL|aUS`~dCdrb+6ctJgy8J)IY(Y~&q1$) z&>dZ^z*(_YdGPKoP_}W7KY`5HKI!TWXqym-{s=1*3oOg#ocWo-c!=qZ^@5_~ZwZ4f zdGt^MuxpSFt<{hm`;ueYKp%RB(1gMErhAy9~E z+BK{{P_S%5F+=YQFJoM_^y5XpClS(cCgsI^ zU4@F~Q!mD1Nk#3g80!>M@om{F2V7wn%9OkO^_@xsS zE)HBI4sJDX)0uIw2J~lq-(7N5#9YdhpVTFJX@>;?*cqf!<5cBm;y_^#~@x*4TGg_+bDE* z*p~ke{7klnEcEBUnuG5CG6DECg(U3lFJ>4q0^~$P^!J#+5Y!C%2~m^vf~vmyxWQeK z<#(qei@_yW%4;ne+K`SMSQJImx(~)V}N+r$n(?ig{gqVcUF0FlcBic4bGHs zl9Z!@fOZ_rDeN>!y>Z&KYTuf&w(&eB ze2)6+ac~L3q!oIg@8mfdL|3bmEA+C2X7oT1Glm-tfnW?@cn?eovCAQFso-%gO>%;32ll^oCo+T7tjZo3EYZevT+H z^pb5*P2s}14Vx()NS0MCrpC^&2p3mK%B7GVW;Z#-rN%;-%ZoWhT-xhNB*!`1@n#(u z&|FlL)u_q$BAM*KA<{FkxnN{GdJPMWiEzBMU$G<$g9wNCySYL_+S;2W%Qt-k88k8J z)hl2da4`^586e-WPid|79l$}sCNPOgcWFdWHSA?(&p>^hp&%!lc1_CM8w52fgG~3%QR)Ltv zsj5zc1R8@H8X%-Ln1OAz0D>1Zbvf+ImD8)iQ4-0v^x(|%{v%>BBrnjR7(F3g(B29R zjU6|EE})_dj`k0EN~OZ>LM|d^C?7eF?fTDNcCXjaGG)os%HxO!hqH)guy(Yu!=giy zu_nrBJ>iu9)cH(3(f_Aj2bMlIMU0`C%8KGW>~s`nElqM0-s z5>{odnf9$}+cUI8RFgZm)J)PVtH_O%CR2|y?VNEI9(KH$u; zUYwuok}=&szTcV1>*abEABMw4L{~m*;P1@O67r@aI6TvseDCH;ppy_HBrDEIJd%@> z?SRxmNZHm!&`GQWpaCskb)p!a*zCFEm}~IiaL}8s_ZaW3#qmV^-YNCa^y}etQZi43 zl_-R&=BLO);~3$mULc0fI~cw`ppp4l2AZEPNRy*rAS6O-C+j@cXyULlr#Qg;b~{%~ z2Lf7*_lONCVTBRgI3)_;Q;OB{HT1Ypa zVqXO&E)sAoS#R5u=+*^1H-aSTwXf>Ul`4 z*}yYYGBE#mqRnfB$vRYmSpiOGg0D`0UucYpaQu%`91-B`7e`zJctw)vY}V2BptCe% zD1}|eLwUZ*`IKzw^5QeYruI`3v-yKLT_0}~l8W%4A{t~AT zc-a}1JnIjU$;4(a_yM7^Dxa}zh zeP=(%{=0(TpE`NYQH|Q%qy^)47NJ02Ee060j7bFLZn@N^H@$^tp3<{)JPNa9GM1EC z{2*?wRYXX`E;;@wSq0`y|6DRMNSAUB6*B28wj3bKY(|hAr5@;W%GX$!y>_6@mvkDYPF&5IuFmbrplTjpA)Ieh&&HXtdSm*LBuP+D zQ=GnI6be0=+i?PpUx3ZAJ=aoRc9e#{0`Qlk9 z&ggj1$^&8A_<|asu=|76Rcq|cv*%Je4+DlDWk$HKM`EXu<{`&MMctXW5-^1P8k`i* zwr!~Wi(8S8X9E>)kMlw%>Yl-s@2?GNOgbnL`!}HnN#%Xf=-56qO>tto&bA%Tf)Mv) z0BIJWdOysTvAnJLn|gT?x$hTF+4!K8^2JC>Te%9o&CBI3sotm=u&HMqvHKILG<2<5 zDT%WZ8RhHNEHiD$wJt=3QwdkbzN>+`4z!~MEpoRVp7%(UJgz4;pG8b}g}^@;PX7)O z4~do)FskszOlbNzNNjqypq8bP3v{EH?(5N?EE`$ zzGX`L<9dyqLPt&MkdDK}%cq#yyEYy0EibUezg2Yz2Sl(GL zn!|xsT@3s;6nZJ?1te~|FQWf+`%-lgzT%Oj>xiD-V8VgL+;l3tYCWC475z9@k=sfM zZGX}%M};mhhDiy&hxV$)+id@JLx_oMRc+r|A)>RePs9eiNg7X3PFw*w#EwXBmKbg)^&3i(=*p49NF#R7to-{&pr*vRUc=7L-d`SS=lJ+Go1>M3rf733kW>= zw=T4QN`xO6#f-m{sGr|%S?7*@1(%|xq5Vn?ED;i~d+O7%j_ir5XCWgBAjOQ@&Ds^G z0E9kAafg&^z@Q`@qb$R%1@(RJ-KyP|^i>&4Yj@ zl2o0J2Gq|#kIr1!$9R7P1Fp&t?o5WtjP8ss28(WBm$zjJb+NCtR(w1Oq|j-FgK)%m zUlKwW>=ai5s^{5TM(e@v9vB@-h=W2lOkpPyy&67! zdo(GbVgf-s>Qf)rGD9n2*V$^zpP^jyX!}of=j2IQf^`EveNp3u4U#nBDuIOU^T?mj z{)}Irn4iq>p#@S(JowW}d~;RxwflYkb1R!Cnx7!*h%Yhi zAx?~^U-tKrS^P(1Hi6yY5lcH93g1uG1>|!A1(udKfRSCJKcu5<_T+tKm5IexVM1Dl zfLi5*$X1mDGdYJJG&iZ8%T0+j8FAVJat)o1)_c-07w3G1cq8Lt5KS);W=tVQf{HlJ zj$GMwzgtcuV(5_Zl^Z^gY|X{7B6;?|s&d$)?>HOEe z!so)q!xI57U&C-y6dy+*>S4?MiG7P+IN~+Xid{AE?6Z?Ru4dxEz{r2>ZW5S0Ti@}` z-#g3@3MH|LFV4|2#GiTD&93tUTE3DQSWtTI@Onr))KAahw&XiYb9F&?Z9 zkB|P=H&LMDmg6i3>4Tam+?QE z9k;-jpI3l#@sGRZaJ{Db@5+nP-x?$CM!Cnv*I(lYM)+brY5WS{5a8Z^dN6+@w{oI$JUrv zO5Xu%P(KN3Dn2A?697KIRB0x$G&2crm04lVglD4gk5p8=(Bs!c9TY-50le}) zhxy`=+usJA1^_W1aI`~YO&^GXlYs~DbjP@oy7gpjS4@>FQ$?Pin?V|DXZ9N_PXB1l zoaYDQFsmqY@p+UK%YsWd@+(N>7_X6`aY5tO?S@Dr40Zr==CR+=Ve#c5%SsXUG`5O7K zy5Zvp+%^pYGdriHFY#6^xwr5>@>rtkW6njOH*O`j61XO(D4&Dqf*EHawX~Zu?@|Bp z1vo8T52LqUf03rVU0x0@;;mu$zC%ptVG4Ai2!VZALP|v>@gL!ccd~=fX+GFzCIYY2 zMOs>N3th^=v0q&U3*#cyB*m0$EqhNo-u-%v8xD+_A^Xq317Zmw_^nu`ibLM379_)v z&!WvmG0eKJ339`|WiY^%kKovjJhv5%%}G`FdB$9==)&@PiRh)N`rq(GRqBb&Y%A&> z)vqH_NnwaV9*IR&~~b{zh`{5P^2&BF{d}zC$4)}LxYOl1mm21P{#Hb z3p|63PkOjQ-SsZvmYwsvC%J!w0o@)>s(8{SAo(1g^&svRB|5m&=eWFlcDm_XXEEe@ULSG6)L!rK2n%e^Oi=EBzbTQ}qV{zvO=H`cdP& z?UB(W-NU*i0zJ_;VodzhXTF?e-k_U5qD_dc7?*?=ay>*dH=$OSk| z&7o+N@Kpl~RLZ03`Qd+dYmY2y%P~314QA$PTY3aF!%E(*$&fn7A4Owmmk;PKgh>Z~ z#Gs+Zk3Da)g*g=&_o$>$TS}ryUfPRAaW*p(ZNI|Ix3I%B6DJbQ)kY?ruW2IqF0)2O zjnu7VZ)t{*_Mm_zYrH6*^N`Yx9?Kp2C@`*}K<~+*iNaf$$ZTxk9Czd64_}KoZ9X

2XFY{rY|M{^YSH-3Dr|MuaESFL<0WOYXWKCnj~6KPNW7(x zNrda%emTUx(rqNa9;nL{jPrR##{rAK3t2B%TLu~YXkg!f@ho&9(JBYaRo^e2Uh!Ii z*$e5DAUNKaq8=E0CiQUqODdS)upn5YvGPCQE+e5!!IGSRZmLuNsYY2LPqERsZA(bd zPSASCNU&BT+TrW)o5OD)Vq5)_kG~Apg)poRoAa`^u7{xFSK55=*w?&zrWnIf?T;nz z4XQBi6`eP_AoZuXv3&<4Fq)wTW*xuc>(#C_y*wTRfv8^$av;_6#J%{>h0JJyo73oE zuhRsjJiMawF%`a0=gIR3Z#^V@If7&ybEfxe2PRe!Co2-S)P&w%HdXWD-IZ_X%lCdE zL5#~^adbIn#?*9J*@puv@$~_TxGQm&7>pY|0%&Q1eklB9eNYMFXkt5a<9P0fD^4Bl&gMW z>ZyIR6;GZpf6K@YmQ}KJu@2IxbDc#VK22}vV7|kQ-$a5xrt->^$Eo+Rg`tTAV>J&| z60TC>WB@$krH{M#eB!1M`=bH=k>lel5S2oeqn$K6JnKK+&)_GrXogz-c>K(xH%PO% zph#=KWKMyFDh}*+IPo}YtXV3mb`+QikbW{3z^_~Qclb`vmA4@Hthl?8TbpDf8`>b3 zz0?ATvF2>D0=gp2(IfgkMkbiAF1;BeVspsNL|9PC_VxflPD$Pmh4uxGFk|DUaey=VMWv20g zp#9i_!9G}LV4xl|NeJda^;~!^le+NQjemHfh?QbB9LfuFurO|^O%*^6Q4Q3ghH><} z(FgPxn>Iw-7A%I-98C8rKP3Gm41eV+R$DaMOXMxBRH>BDr+^*x&HX zwY1SRbVt2fKU37*)edF5Z`MWJJAp8sX@WiW(W20+(3KL?1xtO3?UHy8CGxcyT-Ps_dpVgvUtT zA$6xP^1KF(ynKt?E)A3OAhPQKQtMdu-D1{xiY0G_^m$+3DVWtDPUk{f8==ajBu`i_ zX60y7e>Dxjb)9&eG=brV;MHPbB8^_fv2`)dsHJEPC*iM8Mc#4yGN=4LX~JDF$DQ8S z22$`Y+}pdgN8c>ZZ?_0&U6BI+6D7z#ANT1K+&-Y8Z9h93drKdV3Ge8+Hcj#B#Ai`WeY zEBw!K4l|JK&-B^IzVgxtM8_2|ar&vU0BZ|qI6(r5(6m7m?LE85~mDjXWY&US-AOV!d$REivo=a;Z&q>p(!`_Mn|UGsKciP&`I z^x4b?*^MJRoX#0n^r6i<169-}b{Rcd2ccfP&%%-P$TlVjxS?&}TCbW4*o1rWmhUAk zi@5(ff;;D|&`U13(<|{$yah+8n+>%LAll!WDI_w>Jw*J`fl>6%FVugq`EUh12niPfEPC2WtUsf*#0e7eV2}gL6F;OA z8BH~ucI|cG^>xAB+Rw_0uFmo3&)mJWy$~ob#%AJ2c~9K!(spo3dE{MkrK+ykTsU8p zhxS}Of3VIlA8fW_1V^?;bPh7z&Az!yfgA~GF^&Bno>S(DH!4%XqhVDRuwFUd zlup-1x>NvNz80eRSpjh;c zX*GxR?q}FaQ4EKOVI?UawU`PWY!JMBEkc&%;VD^DveX#kr{pUqj=6zR+IaRh*46U4 zJxNu80HIZn`#2Z&Ce87XA7nRM*GV;pVa|I#Qt6YtBBvI*CoAznP1)r-v zlSaavvJM>OkEwMyg=}$pZ`J3hNFS7KxjO8uJ^Ph%LNrvsgmAwNl?_zjtA0`Ze_9_t zdjSZ+6Wen&V^ZoK;xLp~_Q6Hyfn2%c_xqo(;_JIiJarR`17OD{2tle4LW0BjKHU{t*&s(|~ zPcm6|$+jik9t?Qxh@$&)q=nD6DR2!O`RIA~uMFzDe#)~){Rwt^QIODV*e(ZbK(}7!xG}Qd+ z!qDC0CQD~`^!KE>KV?Q|;$YmG-@7sl=JuMbTX)M$?W zxeUWWSF_qgT@8VvW=oT6gPb zuSZ}|YVw>;6kmEIM^dZqobopFnDC?%>6f~BeEK-(eCZ8y(QtRtba2HlGM*zyj=HIdObQR6pr_1 z%)=&sGE{)SQ3AzK|ALWYG9d)|=a)3&M#-l}B{8DXhrS5xfD-7g;q}iLL^A(4^}H}) zO~|HwJ=5UeT-!Xsa}N;d5s<#A+eAG4AwnYX`EXmu?Lzk?JazHY>i&dy!>+ML^%>;B zAtiKGuvwxybFF=S@nA9}VDd#Da-k4Y;YsmO-uDHGiM%AXC3c!eD^pW0tslR+s4};) z&CXi3g$(X^c)#^(g8|3n%eKm2GMrhAMUkXPWW|+5UuqmT&o9Xp)>DI8rTNcBimS4U zO#?w$f77KNh@@9fP^F!X!_eX6M+Gc&Re2lsS5>-v-;qv-euH}w^xR3@8h71YEfX|hBm^Wr{!z#0NjorxskFUI&dx0f{X7i`u2SXWIGDU zcHfc&T1wvH+yQhX(Lj=G;HjC0eq0qo+nmMdPfh^zkS4NOS8NJHK3F*Uw z+YZ3+M4Tw-ETVj_)}BJ%xY3%kL}Q@Qp9@O1*Th>ksrH%{;`j}xP2`t+1nl(-3F_z% z=s{CwjCEq)XVcRtPOhw&b*nKlT2MQKLrO_gq~~bTlkX@6{KxHah=`z4Eb&I2|MM7S z1@Rmjmr%9UL5?u`v?V0YgWMR)AJI70&8Q`WCTn%mTtRVABy^3Ik?)s|G*aM7lq0zY z&eZ$g??W;}Ex)KCTO&(Wfu07b~STEtz)k$2DcHjgll%{@}sA z+Ob|1_Oom(wtMM3>`L?riA;kPwaaTYzGti4zSLf3vS+W;$4O`mW4)g-AW=xLud(|N ztH{GRWB(R05HRlPDVjFN*GUT4vMJ=N%!cAIp(cB7tyPpP(6c+KlQuk=)zOsBpO15E z&{%x#QRecEdiL@oB2`ZD`l&UT9wVq49`U78YdiBn2WG+xH}n;UhbPlDu*0fs4v25M z!6K@s2^APehq=#b6DfA3<)UY4%arvDiE8qR^Yq`)Ro$;)U=DG=a|pgR8Jd#cKAO>7 zlZ11De|GQ~?TOFfY4A$;+%Vzg0;^Afp%t+M&m@+O$I>~4s!)t{1srBx<_$rbw)r>t zfeCGhpdg7t7Q`+){mM5*=m6}Cv1PT9jvr&TflWX}+e78@Y8Dd37ZcZAp;!|SI9y5u zzfk`s>l1?3WIEE_u%YI1?R$VEBSmuimYxkO^Dh&d6i~;$v2lOHsy9(?Lcg$;?hv^& zr=W#he<71EU@?kTC~!=3n(5PB{X88Ue+Va1)^D91!T2^-*0ymJnmqt8EGaxH2MpZT zJ@MBzenBwEpNSc#>(1C`QMDE>)_=LgG?fq<3HI*GNz3>Fxosq?-kzA;lMhg(_LB zq_!TE(LO8TMs>LZTM=j)nfYr4JDs+kSrR)1-n z@L^p@463V7NgV>8v3CHhLf?u@Q*FW}8c^f-*8fTU>j+2!Xeg8PG!q@ju{yq4(UF!+{Gz(5G4IHFkNpN5HPYbK9xu{t>0&>d< zX??GBEbuD^MD>b2{>X?QiZu1sLA+0wh1+fCL|Gd^TG3@_X6yY@#Fy@~oZPVZ*vu*a zQbLL2OdO+g&-s^z$iv-ttF-ZU(IrGQm{+Z!1raD+uVKJD5c+U}J$()ftoMm$Zah%o zC=y@$!6xV1z%ZY00`#`iM?PC0YY)npgPkqprs9coy6`6H70UBrG*#|vuNSM8I)_kJ zbZyhD%4HaajRztf$kkLvnL(e8s1sVX3hq_>I!Xc=;K{Ve0L?O>MYpSrX;D3R(Z6F| z_Mt7ekTDi`(as64yY{u%6+S~`omL@JS%@< z5f)>&jUAHpI}e`o?Nv`VnhS2IS=Gh1u|xrYAG?E|R`{jz#HOeYvp*XJm<0N-lY0u? zgXB~4GloMjhDD|m$5GC7&f}2F9@FUYHcN@sZPLtG7UWQZpNGblo7a`K#gn9gn~AY< z3a^LTv^G6RVh~A9-Nj%=F&F#l(hDg2nfL-VTS?IA%QmGgbszV|X2__#m+}6q!+p~3 zHoW20wccn>j)ZHq*FNAX5`%V+U3Ay5;goTBVed5Lxbxm*boR#BQ5(%$x25IgW$9-< zUHEwK!lX7y{Bt&2S7-KPN7tV$f%#;R>1dNwRL|YKu9L`WlLm#9fCsbbWR(M$`8RR8 z8utGM3J}MjzxTvmo@0}G-I^!ew@HOvDH=mS*fC8h4?02Nzm%DO>C1F=-9M4hl9=H7UtzT+;Aub(7ZY|OuD=F&u-er8-MD{OYmBoY{A>jy=ShF) zdh1f>f>yxB&a$OPm@9wmKENeazC`+zfXNHR#|C?$mPauJ;hW@Z#>HdrG}7XctH`p&t>0YBj^zlbo~0br^|PBknxD6-K@R()|;jxxli1{2$Ecf;h3 zA@A9!Ou1LY>T8cYThZ-b960*1CUj4RDl6mSg8~kYDVkp3y%Hj2t1_&)*B`1MIZod^ z5B1PUcL^2(jB^CZH+F(m=PD}h-kg#~-F2HC|AF~LrWsKJ<4n%JXV~b+h>E*5ZrT%Osc9Z1nJX<}nUKAh&l{W?4g-xgi4FB?m9sEQKMWTdP zO}8!P?b8P(#3jYb6k|33L!7p5=wHX{&YooM@uES=aLedFw!|ynm=S-*-MmMbq%?_L zS02b_*XPTWC&ZXVpGP`~*8?u+-z69&CL@SOgHo7j%qGnK&nt_ ztE)d!Dx7I~Fmh!3*ScEoglcGjHVDB`(X$cJSYk0<)}T{R)u6x8%N}fN6bNu~L#c#Y zU>2SD>HiXMR>}Us>hU9P&e$+mr-vNlKa@>JqK{D|2J!|w>j{oaku(LxTwJe>UyU&Q zEp$74&!P)~zgW`LeuQF=x24=RnydX=Dip)i_V71@xhqkv8NJi=CVbUF6B;Saf+;ks z^Hvq!*9b9GC={qXM=Tcfyo2&YP486=QP5|3oy;v>rGIgI*XPTWC&ZXVpGP`~*8?u+ z9Ptd)9Trto@I2$%$PqKxaR#F3X=7)T0ItmoE3JuuGHVfzO@)$d7kePILi5D>P486= zQP5|3oy;v>rGIgIq2{(M_!6KL9zolk6?%5gU$l+~5DS+ApM7c2bC7YO78bg$D&|&n7C|1bPIQO;k2cF%i z?F3P1116bJhAN$e^K5Ra2MEeOMbRJ)8O@b1M>?a~9drJIyQD0;B$+u$%8-_oAuyQ) zx#eN~^sT#%dO~I^e{g!=<)4sOW+@uYrrFYsdoD)e6!UlKS%9jKHet#h

iY-7ct@#70iHT~1D zlRw)vLKuNH_H@7eW4^@$VNQ&&YhOGb=+oK5M_X3{o;QgyOlhP z3oz4RaLz7KKxeO|+dRgcTf7h6my$-#!G3RFl*7I_)`q)5ZF(hKscO4Q#}3Q0Ner^6 z!t`1Z>R-Y0{A7T%k^9T~h-Q0>K=!BuBzE_r)tmO$-DUk8=!vH^)pA{L*j`nd7Q|>l zYPM$^!pxu&p7rQXm_aNr`AHb}-(b<-+=VlV_};s$NYDu8_hAHD2$!SYj*3lzEV#}} zb(5m*mK0j5Q?Z#Q9NNUYdj22k)VQIxa%61Wj+oLB_k$D!Zj#&awXN0j2DwU z>usVC4P6?haq+Ub7;^Xs=|U`P{U|Kly$Lolq~cLLCOmPl=;X72gSa9zq0(Sq(|7@; zvQ)T@`*2E4-!j2;ClEZ}{?w~OC?NhTsfI*-+i#d0h)R4_6xgRD6sfu0r|>hRuW#4eM{3ycjuy|x>p`g3J2(8zqj4>zCMiy1)Na}x=_b+i+onjdm zIGJ|Xh3d{aZ8nI(smLm;1*hXEE5)%|c8UB4C$kGk884PJA2+JV8|kg25lDO%N~a)j zY)3cpr@+DVI(>sOY^Ku9Zy>!oI0nD(go7nyj@Xg%eUBg9vtHyOrGz~|sz{;|Qy{+=|v!FNMsq%I^|0{qBaZ_bkUJ%|RE!i61 z`A^Mys1jgznw(!K79Te*aiSM0PU|~`15sYU!lH=|-kP{u-@2-#az{$lbFR^VPL@h- zcXb3q_1AFTbxf>Hb$f}(p>#=FUtec(ljYy*?Qy*M7OkE5{N|lE(TvWe^*_OxY~I6eNrqR z%RjiU6ygp?yQG>y$|P+_88GwzBtukX1KUVWSnD`ShkRYDX*DPFbv;R~s+VX#IE!t+A z-jx#btjC}-$*AW}VTin5-%_zbp<;>9ibmB=(vrt z#X%80G=qVFMBUpKBK{VpFQCU9xt0HFM7@fB>U3es6?#qAZ62$T=@_)0APs2V&mnBq;LO*tCtp`P~Ektu{sMjJN=suX|$e~ zH&2`Dc%XqXiN-=b7QjI7lmK`9Obt7+Z?I=*@4oP49H0a5q|LDfh?R*!KOpT;*5$z5 zi{7!qAUomzs^!G!B5csOAbGGSZ=td(%_fLYOJmBL3=nRzC1hXMN1#6{;oOW-1rQo_ z?&K#~*dYX%)x<(ekHlNfD^&EahL8~CX@q(ZxoRzVJ0!Akm(HTa@OgUDwR!bx^!eE|T6!D(@KlMN5Wfrx!9BJyM8COBfW|#1{ zBine@+ax(mehK(n7X*h5HfJ=f`{}ZOW{svJ>;0j2318=d8zn2wF;PG?fzEf9SoHyf zP8j*@l@~6D@mYu${5Do}d#iTjvcr19&uI&q-iM9B(=TKU(K4Xwc2<+;(K({(!T?Ed8e0f!3Px3reXuCE zq6*r}jK$rN^_icUCjI?3+Tbtd!SfTK{8!z0#s{Zla@FQoSfg_fd9od%<7V#9(hlLb zaha`jW|SZA)U9h|@5__`K3qJ?N-oi|I&F8N698HFwf(_lGD_Ru3S(jlC~*VvD&&GSR2=2Uw>u=7RQwK#7hyUU#KguOp#X$TP;KZRd)0TqhV22QT?gz76 z0Mxfpo*3*kH@(H%lv9Z^y~vspm8+pAO5e3odE~l(buRHT0)O7nq^}&&<-rO(^(_K{ zKOZbp(y}PQPrW(_Nh^~3K*0?cN^}pn{JA!_4M(A^4pz=(8!L>}zmE4hcDwERDI|vMd7A!4>CF^v`(CX?M!Q;ya3f<)_xs4)_%z1`M&u7V z3*B?YzwSoDYV+946rXqn>|8`-q4*owmK^ya;5{43_EAjn;b7G*h5n>tmcD9@yDzd~ zN+ap4oa$%ukr6Lx--ywYvFnVr_+LImzI#LRbFud;qddLdIa!~TAq^zhtk_&`8KkR{ zf8pR8{FLmW6fZWAH??R}@;pRJ&7?bg-rD)GvZv?gCUAxYlcx^7+u|)|73A%SXm9z} zhrYH4i{eQ0uatMF5%&j#b6s|euXsV7ZNoEsB&82ii+CTOuUMyJt5Yb6C0MsVycAJE zfp8vZRBb2RX1O;eIqSYnmGD-aOo48dhjp;9{mp{FX)*y@==e2 zXJSIG!;#fgxL%Y#gKBpYO!4nd*E6hNhc$g!yq$b=ieo{q!8OfVuY95Msk~TrgL;~Q z5Gi@>DA0*V4*+tJJ$@{caSXN-mH9(Gz(k%i4nR@u`By`Qr!hTazPdhYxz138a2$GwaJsVF}e{h30y&I$|0z*VGIXFVD^srowH4 zgp}paMs+&3?_?D&2r6-(6u^zE`huHsOXsllApi>c&K-LhcYrO$Xqk44FPL~14*X6x z7oZX;WvMJ{Y^ljQgcKmXaxY24hnE^yTxrt8&mT>HjZR(-b~^~+HZPbq9Qse14B0AQ zC-j_Mocn}$Iwx>5U6P|_l0t;sBmVHOlY=!n&Wz>D#!{7B11)f8NLTORqmio*j58?C z#?xf`C=&MisF&vk)vd3P>UimFEaPI4!Y=vaq)h9(%x;8E1))@~U30PIw`x2uVmydd zXoHXuD(hF`ZJaSF2=E29!Ygf4lHG>qXimd;-G^1%`Qjw_m|6sDSX{rX4(`-0N=_7% zp5^X3wDVowhw^38MtA{iHU7mWlpKgMz2_HfY|$Cfy}4;}o}=pEcX%1*pp2S`_y>3_rRsTSqH~o}vBjD~ zEBW;CE2Vc9b2q5k=QqSE|}X?w^NPecPiT^>4IMe_cyP0r-QK_fNuCV*OlvXQOXOzy~eX& z*?!jlhjp%k*(N$$f_z>;zqxak)z`tY`LgSMU|EGvt8Q)rlC7CY#n0ZDCn~3^wQd)U z*kEEI?sd-F16|7CTY=1~Cvbfy%?BY07U%Uw5d99>s5vcOm`6{1PJwgEu#Y9;L3o!l zHOlqQ{C+WjF>F1+=?7<@_`1>$)(yl(V<5)6F+$@9f|7M9Ij% zx2UJhXvHzca~6xUT%VK@tJkfGdeeDP*wDkQJE?s!_+EHRfr!|_isctDd#Xo->j)4N zg=aXZM{UJo9<92KV2$V!Qwh7OYhy!>C7D-{*^6wf(z_w~8H@s5OW`5Pclr=r3f0fh zM-@4iL%U3`+6$Hdm@t;9Qd#!WIOMuMF`#|=7$ptGaIDx#%-xT`nY!nCD<)Qtp&u9xNZV5s;nzb(;E6({y#mj-CFzj}M&J(j;b zTpc;a+he|<4CZRS;VxM`?){@lHSfhH6?gRks6IjK)S< z;v2Ty;@Qd|KdaQVi($9+$oR4DcG<4fo_B)oHMDA8=U`wc@<N$x}d|9(y560kx}y8a@}vNY!{NI`|DuJO7zx>2cu@xv_r6#D&bVJ2q;Y2&jp&ebUx!$vRhIA&jBO}F9?8FT#YZ)RI zmuZsFcy3DBpee_{(rboVTk0}Z+d~kYqz7QZ#zj}K>d9|;qiBYe|68^UHHmn%y}(>w zw)bPAAqW<-ni)q+pnEiu;FnEK0oc?JFKD2AL+#h^KzpG)*>FvXB_MDVLMSC&7f z)@3BKv{&-k9KJF*k?=7eg-nOaO~pfOdvY4lE80tfr|=z5Shy^7UL!p=E)&mriN$M?ApG84Xgz(jK%b#> zV1jIFr zoQlL6-GvZw83CPgJ)(p(wu`An?-Nq?c4taEF=WMeACYe50iwC#+>^lpTuRA;=8nJ}nQz`s0=MGE0?*J#G5V$$rU n8=M@1Z-xbG$waMS#hDU>NS(a1yuCnO8x{3LprB3rcHV3Nmaa6s diff --git a/drivers/net/wireless/mt5931/include/CFG_Wifi_File.h b/drivers/net/wireless/mt5931/include/CFG_Wifi_File.h deleted file mode 100755 index dd1fce8d7bf5..000000000000 --- a/drivers/net/wireless/mt5931/include/CFG_Wifi_File.h +++ /dev/null @@ -1,251 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/CFG_Wifi_File.h#1 $ -*/ - -/*! \file CFG_Wifi_File.h - \brief Collection of NVRAM structure used for YuSu project - - In this file we collect all compiler flags and detail the driver behavior if - enable/disable such switch or adjust numeric parameters. -*/ - - - -/* -** $Log: CFG_Wifi_File.h $ - * - * 09 08 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * Use new fields ucChannelListMap and ucChannelListIndex in NVRAM - * - * 08 31 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * . - * - * 08 15 2011 cp.wu - * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree - * add MT6628-specific definitions. - * - * 08 09 2011 cp.wu - * [WCXRP00000702] [MT5931][Driver] Modify initialization sequence for E1 ASIC[WCXRP00000913] [MT6620 Wi-Fi] create repository of source code dedicated for MT6620 E6 ASIC - * add CCK-DSSS TX-PWR control field in NVRAM and CMD definition for MT5931-MP - * - * 05 27 2011 cp.wu - * [WCXRP00000749] [MT6620 Wi-Fi][Driver] Add band edge tx power control to Wi-Fi NVRAM - * update NVRAM data structure definition. - * - * 03 10 2011 cp.wu - * [WCXRP00000532] [MT6620 Wi-Fi][Driver] Migrate NVRAM configuration procedures from MT6620 E2 to MT6620 E3 - * deprecate configuration used by MT6620 E2 - * - * 10 26 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW] Support NIC capability query command - * 1) update NVRAM content template to ver 1.02 - * 2) add compile option for querying NIC capability (default: off) - * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting - * 4) correct auto-rate compiler error under linux (treat warning as error) - * 5) simplify usage of NVRAM and REG_INFO_T - * 6) add version checking between driver and firmware - * - * 10 25 2010 cp.wu - * [WCXRP00000133] [MT6620 Wi-Fi] [FW][Driver] Change TX power offset band definition - * follow-up for CMD_5G_PWR_OFFSET_T definition change - * - * 10 05 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * 1) add NVRAM access API - * 2) fake scanning result when NVRAM doesn't exist and/or version mismatch. (off by compiler option) - * 3) add OID implementation for NVRAM read/write service - * - * 09 23 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * add skeleton for NVRAM integration - * -*/ - -#ifndef _CFG_WIFI_FILE_H -#define _CFG_WIFI_FILE_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_typedef.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ -// duplicated from nic_cmd_event.h to avoid header dependency -typedef struct _TX_PWR_PARAM_T { - INT_8 cTxPwr2G4Cck; /* signed, in unit of 0.5dBm */ -#if defined(MT6620) - INT_8 acReserved[3]; -#elif defined(MT5931) || defined(MT6628) - INT_8 cTxPwr2G4Dsss; /* signed, in unit of 0.5dBm */ - INT_8 acReserved[2]; -#else - #error "No valid definition!" -#endif - - INT_8 cTxPwr2G4OFDM_BPSK; - INT_8 cTxPwr2G4OFDM_QPSK; - INT_8 cTxPwr2G4OFDM_16QAM; - INT_8 cTxPwr2G4OFDM_Reserved; - INT_8 cTxPwr2G4OFDM_48Mbps; - INT_8 cTxPwr2G4OFDM_54Mbps; - - INT_8 cTxPwr2G4HT20_BPSK; - INT_8 cTxPwr2G4HT20_QPSK; - INT_8 cTxPwr2G4HT20_16QAM; - INT_8 cTxPwr2G4HT20_MCS5; - INT_8 cTxPwr2G4HT20_MCS6; - INT_8 cTxPwr2G4HT20_MCS7; - - INT_8 cTxPwr2G4HT40_BPSK; - INT_8 cTxPwr2G4HT40_QPSK; - INT_8 cTxPwr2G4HT40_16QAM; - INT_8 cTxPwr2G4HT40_MCS5; - INT_8 cTxPwr2G4HT40_MCS6; - INT_8 cTxPwr2G4HT40_MCS7; - - INT_8 cTxPwr5GOFDM_BPSK; - INT_8 cTxPwr5GOFDM_QPSK; - INT_8 cTxPwr5GOFDM_16QAM; - INT_8 cTxPwr5GOFDM_Reserved; - INT_8 cTxPwr5GOFDM_48Mbps; - INT_8 cTxPwr5GOFDM_54Mbps; - - INT_8 cTxPwr5GHT20_BPSK; - INT_8 cTxPwr5GHT20_QPSK; - INT_8 cTxPwr5GHT20_16QAM; - INT_8 cTxPwr5GHT20_MCS5; - INT_8 cTxPwr5GHT20_MCS6; - INT_8 cTxPwr5GHT20_MCS7; - - INT_8 cTxPwr5GHT40_BPSK; - INT_8 cTxPwr5GHT40_QPSK; - INT_8 cTxPwr5GHT40_16QAM; - INT_8 cTxPwr5GHT40_MCS5; - INT_8 cTxPwr5GHT40_MCS6; - INT_8 cTxPwr5GHT40_MCS7; -} TX_PWR_PARAM_T, *P_TX_PWR_PARAM_T; - -typedef struct _PWR_5G_OFFSET_T { - INT_8 cOffsetBand0; /* 4.915-4.980G */ - INT_8 cOffsetBand1; /* 5.000-5.080G */ - INT_8 cOffsetBand2; /* 5.160-5.180G */ - INT_8 cOffsetBand3; /* 5.200-5.280G */ - INT_8 cOffsetBand4; /* 5.300-5.340G */ - INT_8 cOffsetBand5; /* 5.500-5.580G */ - INT_8 cOffsetBand6; /* 5.600-5.680G */ - INT_8 cOffsetBand7; /* 5.700-5.825G */ -} PWR_5G_OFFSET_T, *P_PWR_5G_OFFSET_T; - -typedef struct _PWR_PARAM_T { - UINT_32 au4Data[28]; - UINT_32 u4RefValue1; - UINT_32 u4RefValue2; -} PWR_PARAM_T, *P_PWR_PARAM_T; - -typedef struct _MT6620_CFG_PARAM_STRUCT { - /* 256 bytes of MP data */ - UINT_16 u2Part1OwnVersion; - UINT_16 u2Part1PeerVersion; - UINT_8 aucMacAddress[6]; - UINT_8 aucCountryCode[2]; - TX_PWR_PARAM_T rTxPwr; - UINT_8 aucEFUSE[144]; - UINT_8 ucTxPwrValid; - UINT_8 ucSupport5GBand; - UINT_8 fg2G4BandEdgePwrUsed; - INT_8 cBandEdgeMaxPwrCCK; - INT_8 cBandEdgeMaxPwrOFDM20; - INT_8 cBandEdgeMaxPwrOFDM40; - - UINT_8 ucRegChannelListMap; - UINT_8 ucRegChannelListIndex; - UINT_8 aucRegSubbandInfo[36]; - - UINT_8 aucReserved2[256-240]; - - /* 256 bytes of function data */ - UINT_16 u2Part2OwnVersion; - UINT_16 u2Part2PeerVersion; - UINT_8 uc2G4BwFixed20M; - UINT_8 uc5GBwFixed20M; - UINT_8 ucEnable5GBand; - UINT_8 aucPreTailReserved; - UINT_8 aucTailReserved[256-8]; -} MT6620_CFG_PARAM_STRUCT, *P_MT6620_CFG_PARAM_STRUCT, - WIFI_CFG_PARAM_STRUCT, *P_WIFI_CFG_PARAM_STRUCT; - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#ifndef DATA_STRUC_INSPECTING_ASSERT -#define DATA_STRUC_INSPECTING_ASSERT(expr) \ - switch (0) {case 0: case (expr): default:;} -#endif - -#define CFG_FILE_WIFI_REC_SIZE sizeof(WIFI_CFG_PARAM_STRUCT) - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#ifndef _lint -/* We don't have to call following function to inspect the data structure. - * It will check automatically while at compile time. - * We'll need this to guarantee the same member order in different structures - * to simply handling effort in some functions. - */ -__KAL_INLINE__ VOID -nvramOffsetCheck ( - VOID - ) -{ - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, u2Part2OwnVersion) == 256); - - DATA_STRUC_INSPECTING_ASSERT( - sizeof(WIFI_CFG_PARAM_STRUCT) == 512); - - DATA_STRUC_INSPECTING_ASSERT( - (OFFSET_OF(WIFI_CFG_PARAM_STRUCT, aucEFUSE) & 0x0001) == 0); - - DATA_STRUC_INSPECTING_ASSERT( - (OFFSET_OF(WIFI_CFG_PARAM_STRUCT, aucRegSubbandInfo) & 0x0001) == 0); -} -#endif - -#endif /* _CFG_WIFI_FILE_H */ - - diff --git a/drivers/net/wireless/mt5931/include/config.h b/drivers/net/wireless/mt5931/include/config.h deleted file mode 100755 index 8b28eb5a4793..000000000000 --- a/drivers/net/wireless/mt5931/include/config.h +++ /dev/null @@ -1,1525 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/config.h#2 $ -*/ - -/*! \file "config.h" - \brief This file includes the various configurable parameters for customers - - This file ncludes the configurable parameters except the paramters indicate the turning-on/off of some features -*/ - - - -/* -** $Log: config.h $ - * - * 07 13 2012 cp.wu - * [WCXRP00001259] [MT6620 Wi-Fi][Driver][Firmware] Send a signal to firmware for termination after SDIO error has happened - * [driver domain] add force reset by host-to-device interrupt mechanism - * - * 06 13 2012 yuche.tsai - * NULL - * Update maintrunk driver. - * Add support for driver compose assoc request frame. - * - * 06 05 2012 tsaiyuan.hsu - * [WCXRP00001249] [ALPS.ICS] Daily build warning on "wlan/mgmt/swcr.c#1" - * resolve build waring for "WNM_UNIT_TEST not defined".. - * - * 06 04 2012 cp.wu - * [WCXRP00001245] [MT6620 Wi-Fi][Driver][Firmware] NPS Software Development - * discussed with WH, privacy bit in associate response is not necessary to be checked, and identified as association failure when mismatching with beacon/probe response - * - * 05 11 2012 cp.wu - * [WCXRP00001237] [MT6620 Wi-Fi][Driver] Show MAC address and MAC address source for ACS's convenience - * show MAC address & source while initiliazation - * - * 04 20 2012 cp.wu - * [WCXRP00000913] [MT6620 Wi-Fi] create repository of source code dedicated for MT6620 E6 ASIC - * correct macro - * - * 04 12 2012 terry.wu - * NULL - * Add AEE message support - * 1) Show AEE warning(red screen) if SDIO access error occurs - * - * 03 29 2012 eason.tsai - * [WCXRP00001216] [MT6628 Wi-Fi][Driver]add conditional define - * add conditional define. - * - * 03 02 2012 terry.wu - * NULL - * Enable CFG80211 Support. - * - * 01 05 2012 tsaiyuan.hsu - * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v - * add timing measurement support for 802.11v. - * - * 11 23 2011 cp.wu - * [WCXRP00001123] [MT6620 Wi-Fi][Driver] Add option to disable beacon content change detection - * add compile option to disable beacon content change detection. - * - * 11 18 2011 yuche.tsai - * NULL - * CONFIG P2P support RSSI query, default turned off. - * - * 10 28 2011 cp.wu - * [MT6620 Wi-Fi][Win32 Driver] Enable 5GHz support as default - * enable 5GHz as default for DaVinci trunk and V2.1 driver release . - * - * 10 18 2011 cp.wu - * [WCXRP00001022] [MT6628 Driver][Firmware Download] Add multi section independent download functionality - * surpress compiler warning for MT6628 build - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 10 03 2011 cp.wu - * [WCXRP00001022] [MT6628 Driver][Firmware Download] Add multi section independent download functionality - * enable divided firmware downloading. - * - * 10 03 2011 cp.wu - * [WCXRP00001022] [MT6628 Driver][Firmware Download] Add multi section independent download functionality - * add firmware download path in divided scatters. - * - * 10 03 2011 cp.wu - * [MT6628 Driver][Firmware Download] Add multi section independent download functionality - * add firmware downloading aggregated path. - * - * 09 28 2011 tsaiyuan.hsu - * [WCXRP00000900] [MT5931 Wi-Fi] Improve balance of TX and RX - * enlarge window size only by 4. - * - * 08 15 2011 cp.wu - * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree - * reuse firmware download logic of MT6620 for MT6628. - * - * 08 15 2011 cp.wu - * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree - * add MT6628-specific definitions. - * - * 08 15 2011 cp.wu - * [WCXRP00000913] [MT6620 Wi-Fi] create repository of source code dedicated for MT6620 E6 ASIC - * support to load different firmware image for E3/E4/E5 and E6 ASIC on win32 platforms. - * - * 08 12 2011 cp.wu - * [WCXRP00000913] [MT6620 Wi-Fi] create repository of source code dedicated for MT6620 E6 ASIC - * load WIFI_RAM_CODE_E6 for MT6620 E6 ASIC. - * - * 08 09 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings - * Add BWCS definition for MT6620. - * - * 07 28 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings - * Add BWCS cmd and event. - * - * 07 22 2011 jeffrey.chang - * [WCXRP00000864] [MT5931] Add command to adjust OSC stable time - * modify driver to set OSC stable time after f/w download - * - * 07 18 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add CMD/Event for RDD and BWCS. - * - * 07 05 2011 yuche.tsai - * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue - * Refine compile flag. - * - * 07 05 2011 yuche.tsai - * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue - * Add wifi direct connection enhancement method I, II & VI. - * - * 06 24 2011 cp.wu - * [WCXRP00000702] [MT5931][Driver] Modify initialization sequence for E1 ASIC[WCXRP00000812] [MT6620 Wi-Fi][Driver] not show NVRAM when there is no valid MAC address in NVRAM content - * increase RX buffer number to have a 2:1 ping-pong ratio - * - * 06 23 2011 eddie.chen - * [WCXRP00000810] [MT5931][DRV/FW] Adjust TxRx Buffer number and Rx buffer size - * 1. Different TX RX buffer - * 2. Enlarge RX buffer and increase the number 8->11 - * 3. Seperate the WINSZIE and RX buffer number - * 4. Fix RX maximum size in MAC - * - * 06 20 2011 terry.wu - * NULL - * Add BoW Rate Limitation. - * - * 06 17 2011 terry.wu - * NULL - * . - * - * 06 17 2011 terry.wu - * NULL - * Add BoW 11N support. - * - * 06 07 2011 yuche.tsai - * [WCXRP00000763] [Volunteer Patch][MT6620][Driver] RX Service Discovery Frame under AP mode Issue - * Add compile flag for persistent group support. - * - * 06 01 2011 cm.chang - * [WCXRP00000756] [MT6620 Wi-Fi][Driver] 1. AIS follow channel of BOW 2. Provide legal channel function - * Limit AIS to fixed channel same with BOW - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 04 14 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * Enable RX STBC capability - * - * 04 11 2011 george.huang - * [WCXRP00000628] [MT6620 Wi-Fi][FW][Driver] Modify U-APSD setting to default OFF - * . - * - * 04 08 2011 pat.lu - * [WCXRP00000623] [MT6620 Wi-Fi][Driver] use ARCH define to distinguish PC Linux driver - * Use CONFIG_X86 instead of PC_LINUX_DRIVER_USE option to have proper compile settting for PC Linux driver - * - * 04 08 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * 1. correction: RX aggregation is not limited to SDIO but for all host interface options - * 2. add forward declarations for DBG-only symbols - * - * 04 06 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * 1. do not check for pvData inside wlanNetCreate() due to it is NULL for eHPI port - * 2. update perm_addr as well for MAC address - * 3. not calling check_mem_region() anymore for eHPI - * 4. correct MSC_CS macro for 0-based notation - * - * 04 01 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * 1. simplify config.h due to aggregation options could be also applied for eHPI/SPI interface - * 2. use spin-lock instead of semaphore for protecting eHPI access because of possible access from ISR - * 3. request_irq() API has some changes between linux kernel 2.6.12 and 2.6.26 - * - * 03 29 2011 cp.wu - * [WCXRP00000598] [MT6620 Wi-Fi][Driver] Implementation of interface for communicating with user space process for RESET_START and RESET_END events - * implement kernel-to-userspace communication via generic netlink socket for whole-chip resetting mechanism - * - * 03 22 2011 pat.lu - * [WCXRP00000592] [MT6620 Wi-Fi][Driver] Support PC Linux Environment Driver Build - * Add a compiler option "PC_LINUX_DRIVER_USE" for building driver in PC Linux environment. - * - * 03 18 2011 wh.su - * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done - * enable the Anti_piracy check at driver . - * - * 03 17 2011 tsaiyuan.hsu - * [WCXRP00000517] [MT6620 Wi-Fi][Driver][FW] Fine Tune Performance of Roaming - * enable roaming feature. - * - * 03 17 2011 chinglan.wang - * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature - * . - * - * 03 15 2011 cp.wu - * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous memory consumption - * 1. deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK - * 2. Use common coalescing buffer for both TX/RX directions - * - * - * 03 15 2011 eddie.chen - * [WCXRP00000554] [MT6620 Wi-Fi][DRV] Add sw control debug counter - * Add sw debug counter for QM. - * - * 03 07 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * rename the define to anti_pviracy. - * - * 03 06 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Sync BOW Driver to latest person development branch version.. - * - * 03 02 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * Add security check code. - * - * 03 01 2011 george.huang - * [WCXRP00000495] [MT6620 Wi-Fi][FW] Support pattern filter for unwanted ARP frames - * Fix compile issue - * - * 02 25 2011 george.huang - * [WCXRP00000497] [MT6620 Wi-Fi][FW] Change default UAPSD AC assignment - * Assign all AC default to be U-APSD enabled. - * - * 02 14 2011 wh.su - * [WCXRP00000432] [MT6620 Wi-Fi][Driver] Add STA privacy check at hotspot mode - * Let the privacy check at hotspot mode default enable. - * - * 02 09 2011 wh.su - * [WCXRP00000432] [MT6620 Wi-Fi][Driver] Add STA privacy check at hotspot mode - * adding the code for check STA privacy bit at AP mode, . - * - * 02 08 2011 cp.wu - * [WCXRP00000427] [MT6620 Wi-Fi][Driver] Modify veresion information to match with release revision number - * change version number to v1.2.0.0 for preparing v1.2 software package release. - * - * 02 01 2011 yarco.yang - * [WCXRP00000417] [MT6620 Driver] Chnage CFG_HANDLE_IST_IN_SDIO_CALLBACK from 1 to 0 for Interoperability - * . - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * - * 01 19 2011 wh.su - * [WCXRP00000370] [MT6620 Wi-Fi][Driver] Disable Rx RDG for workaround pre-N ccmp issue - * Not announce support Rx RDG for wokaround pre-N ccmp construct AAD issue.. - * - * 01 15 2011 puff.wen - * NULL - * Add Stress test - * - * 01 12 2011 cp.wu - * [WCXRP00000356] [MT6620 Wi-Fi][Driver] fill mac header length for security frames 'cause hardware header translation needs such information - * fill mac header length information for 802.1x frames. - * - * 01 11 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Support BOW only for Linux. - * - * 01 10 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Enable BOW and 4 physical links. - * - * 01 08 2011 yuche.tsai - * [WCXRP00000345] [MT6620][Volunteer Patch] P2P may issue a SSID specified scan request, but the SSID length is still invalid. - * Modify CFG_SLT_SUPPORT default value. - * - * 01 08 2011 yuche.tsai - * [WCXRP00000341] [MT6620][SLT] Create Branch for SLT SW. - * Update configure flag. - * - * 12 28 2010 cp.wu - * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release - * report EEPROM used flag via NIC_CAPABILITY - * - * 12 28 2010 cp.wu - * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release - * integrate with 'EEPROM used' flag for reporting correct capability to Engineer Mode/META and other tools - * - * 12 15 2010 yuche.tsai - * NULL - * Update SLT Descriptor number configure in driver. - * - * 12 13 2010 chinglan.wang - * NULL - * Add WPS 1.0 feature flag to enable the WPS 1.0 function. - * - * 11 23 2010 george.huang - * [WCXRP00000127] [MT6620 Wi-Fi][Driver] Add a registry to disable Beacon Timeout function for SQA test by using E1 EVB - * Enable PM function by default - * - * 11 15 2010 wh.su - * [WCXRP00000171] [MT6620 Wi-Fi][Driver] Add message check code same behavior as mt5921 - * use config.mk WAPI config define. - * - * 11 08 2010 wh.su - * [WCXRP00000171] [MT6620 Wi-Fi][Driver] Add message check code same behavior as mt5921 - * use the config.mk define. - * - * 11 01 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module - * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead - * 2) Remove CNM CH-RECOVER event handling - * 3) cfg read/write API renamed with kal prefix for unified naming rules. - * - * 11 01 2010 yarco.yang - * [WCXRP00000149] [MT6620 WI-Fi][Driver]Fine tune performance on MT6516 platform - * Add code to run WlanIST in SDIO callback. - * - * 10 26 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW] Support NIC capability query command - * 1) update NVRAM content template to ver 1.02 - * 2) add compile option for querying NIC capability (default: off) - * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting - * 4) correct auto-rate compiler error under linux (treat warning as error) - * 5) simplify usage of NVRAM and REG_INFO_T - * 6) add version checking between driver and firmware - * - * 10 25 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * add option for enable/disable TX PWR gain adjustment (default: off) - * - * 10 20 2010 wh.su - * [WCXRP00000067] [MT6620 Wi-Fi][Driver] Support the android+ WAPI function - * enable the WAPI compiling flag as default - * - * 10 19 2010 cp.wu - * [WCXRP00000122] [MT6620 Wi-Fi][Driver] Preparation for YuSu source tree integration - * remove HIF_SDIO_ONE flags because the settings could be merged for runtime detection instead of compile-time. - * - * 10 18 2010 cp.wu - * [WCXRP00000117] [MT6620 Wi-Fi][Driver] Add logic for suspending driver when MT6620 is not responding anymore - * 1. when wlanAdapterStop() failed to send POWER CTRL command to firmware, do not poll for ready bit dis-assertion - * 2. shorten polling count for shorter response time - * 3. if bad I/O operation is detected during TX resource polling, then further operation is aborted as well - * - * 10 18 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android - * complete implementation of Android NVRAM access - * - * 10 14 2010 wh.su - * [WCXRP00000102] [MT6620 Wi-Fi] [FW] Add a compiling flag and code for support Direct GO at Android - * Add a define CFG_TEST_ANDROID_DIRECT_GO compiling flag - * - * 10 08 2010 cm.chang - * NULL - * Remove unused compiling flags (TX_RDG and TX_SGI) - * - * 10 07 2010 cp.wu - * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection - * add firmware download for MT5931. - * - * 10 05 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * load manufacture data when CFG_SUPPORT_NVRAM is set to 1 - * - * 10 05 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * 1) add NVRAM access API - * 2) fake scanning result when NVRAM doesn't exist and/or version mismatch. (off by compiler option) - * 3) add OID implementation for NVRAM read/write service - * - * 10 05 2010 yarco.yang - * [WCXRP00000082] [MT6620 Wi-Fi][Driver]High throughput performance tuning - * Change CFG_IST_LOOP_COUNT from 2 to 1 to reduce unnecessary SDIO bus access - * - * 09 24 2010 cp.wu - * [WCXRP00000057] [MT6620 Wi-Fi][Driver] Modify online scan to a run-time switchable feature - * Modify online scan as a run-time adjustable option (for Windows, in registry) - * - * 09 23 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * eliminate reference of CFG_RESPONSE_MAX_PKT_SIZE - * - * 09 20 2010 cm.chang - * NULL - * Disable RX STBC by BB HEC based on MT6620E1_PHY_BUG v05.docx - * - * 09 17 2010 chinglan.wang - * NULL - * Add performance test option - * - * 09 10 2010 chinglan.wang - * NULL - * Modify for Software Migration Phase 2.10 for E2 FPGA - * - * 09 07 2010 yuche.tsai - * NULL - * Add a CFG for max common IE buffer size. - * - * 09 01 2010 cp.wu - * NULL - * restore configuration as before. - * - * 09 01 2010 cp.wu - * NULL - * HIFSYS Clock Source Workaround - * - * 08 31 2010 kevin.huang - * NULL - * Use LINK LIST operation to process SCAN result - * - * 08 30 2010 chinglan.wang - * NULL - * Enable the MT6620_FPGA_BWCS value. - * - * 08 30 2010 chinglan.wang - * NULL - * Disable the FW encryption. - * - * 08 27 2010 chinglan.wang - * NULL - * Update configuration for MT6620_E1_PRE_ALPHA_1832_0827_2010 - * - * 08 26 2010 yuche.tsai - * NULL - * Add AT GO test configure mode under WinXP. - * Please enable 1. CFG_ENABLE_WIFI_DIRECT, 2. CFG_TEST_WIFI_DIRECT_GO, 3. CFG_SUPPORT_AAA - * - * 08 25 2010 cp.wu - * NULL - * add option for enabling AIS 5GHz scan - * - * 08 25 2010 george.huang - * NULL - * update OID/ registry control path for PM related settings - * - * 08 24 2010 cp.wu - * NULL - * 1) initialize variable for enabling short premable/short time slot. - * 2) add compile option for disabling online scan - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 08 23 2010 cp.wu - * NULL - * revise constant definitions to be matched with implementation (original cmd-event definition is deprecated) - * - * 08 23 2010 chinghwa.yu - * NULL - * Disable BOW Test. - * - * 08 23 2010 jeffrey.chang - * NULL - * fix config.h typo - * - * 08 23 2010 chinghwa.yu - * NULL - * Update for BOW. - * - * 08 21 2010 jeffrey.chang - * NULL - * 1) add sdio two setting - * 2) bug fix of sdio glue - * - * 08 09 2010 wh.su - * NULL - * let the firmware download default enabled. - * - * 08 07 2010 wh.su - * NULL - * adding the privacy related code for P2P network - * - * 08 05 2010 yuche.tsai - * NULL - * Add a configure flag for P2P unitest. - * - * 07 23 2010 cp.wu - * - * 1) re-enable AIS-FSM beacon timeout handling. - * 2) scan done API revised - * - * 07 23 2010 cp.wu - * - * 1) enable Ad-Hoc - * 2) disable beacon timeout handling temporally due to unexpected beacon timeout event. - * - * 07 19 2010 wh.su - * - * update for security supporting. - * - * 07 19 2010 yuche.tsai - * - * Add for SLT support. - * - * 07 16 2010 cp.wu - * - * remove work-around in case SCN is not available. - * - * 07 14 2010 yarco.yang - * - * 1. Remove CFG_MQM_MIGRATION - * 2. Add CMD_UPDATE_WMM_PARMS command - * - * 07 13 2010 cp.wu - * - * 1) MMPDUs are now sent to MT6620 by CMD queue for keeping strict order of 1X/MMPDU/CMD packets - * 2) integrate with qmGetFrameAction() for deciding which MMPDU/1X could pass checking for sending - * 2) enhance CMD_INFO_T descriptor number from 10 to 32 to avoid descriptor underflow under concurrent network operation - * - * 07 09 2010 yarco.yang - * - * [MT6620 and MT5931] SW Migration: Add ADDBA support - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * take use of RLM module for parsing/generating HT IEs for 11n capability - * - * 07 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * for first connection, if connecting failed do not enter into scan state. - * - * 06 25 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * modify Beacon/ProbeResp to complete parsing, - * because host software has looser memory usage restriction - * - * 06 23 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) add SCN compilation option. - * 2) when SCN is not turned on, BSSID_SCAN will generate a fake entry for 1st connection - * - * 06 22 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) add command warpper for STA-REC/BSS-INFO sync. - * 2) enhance command packet sending procedure for non-oid part - * 3) add command packet definitions for STA-REC/BSS-INFO sync. - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * set default compiling flag for security disable. - * - * 06 21 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Support CFG_MQM_MIGRATION flag - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * enable RX management frame handling. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add scan_fsm into building. - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add scan.c. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add management dispatching function table. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * auth.c is migrated. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add bss.c. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) eliminate CFG_CMD_EVENT_VERSION_0_9 - * 2) when disconnected, indicate nic directly (no event is needed) - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add aa_fsm.h, ais_fsm.h, bss.h, mib.h and scan.h. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge wlan_def.h. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 31 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add config option for cfg80211. - * - * 05 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * set ATIMwindow default value to zero. - * - * 05 21 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add option for FPGA_BWCS & FPGA_V5 - * - * 05 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS - * 2) buffer statistics data for 2 seconds - * 3) use default value for adhoc parameters instead of 0 - * - * 05 17 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) enable CMD/EVENT ver 0.9 definition. - * 2) abandon use of ENUM_MEDIA_STATE - * - * 05 17 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add CFG_STARTUP_DEBUG for debugging starting up issue. - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add basic handling framework for wireless extension ioctls. - * - * 05 11 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * change firmware name to WIFI_RAM_CODE. - * - * 05 07 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * disable bt-over-wifi configuration, turn it on after firmware finished implementation - * - * 04 27 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add multiple physical link support - * - * 04 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * surpress compiler warning - * - * 04 22 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * re-enable power management - * - * 04 22 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * - * 1) modify rx path code for supporting Wi-Fi direct - * 2) modify config.h since Linux dont need to consider retaining packet - * - * 04 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * enable TCP/IP checksum offloading by default. - * - * 04 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * set CFG_ENABLE_FULL_PM to 1 as default to - * 1) acquire own before hardware access - * 2) set own back after hardware access - * - * 04 15 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * change firmware name - * - * 04 07 2010 cp.wu - * [WPD00003827][MT6620 Wi-Fi] Chariot fail and following ping fail, no pkt send from driver - * disable RX-enhanced response temporally, it seems the CQ is not resolved yet. - * - * 04 06 2010 cp.wu - * [WPD00003827][MT6620 Wi-Fi] Chariot fail and following ping fail, no pkt send from driver - * re-enable RX enhanced mode as WPD00003827 is resolved. - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * turn off RX_ENHANCE mode by default. - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) eliminate unused definitions - * * 2) ready bit will be polled for limited iteration - * - * 04 02 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * firmware download: Linux uses different firmware path - * - * 04 01 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * change to use WIFI_TCM_ALWAYS_ON as firmware image - * - * 03 31 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * modify the wapi related code for new driver's design. - * - * 03 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add a temporary flag for integration with CMD/EVENT v0.9. - * - * 03 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * firmware download load adress & start address are now configured from config.h - * * due to the different configurations on FPGA and ASIC - * - * 03 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add options for full PM support. - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * [WPD00003826] Initial import for Linux port - * initial import for Linux port - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * [WPD00003826] Initial import for Linux port - * initial import for Linux port - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port - * - * 03 16 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * turn on FW-DOWNLOAD as default for release. - * - * 03 16 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * build up basic data structure and definitions to support BT-over-WiFi - * - * 03 12 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add two option for ACK and ENCRYPTION for firmware download - * - * 03 11 2010 cp.wu - * [WPD00003821][BUG] Host driver stops processing RX packets from HIF RX0 - * add RX starvation warning debug message controlled by CFG_HIF_RX_STARVATION_WARNING - * - * 03 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * code clean: removing unused variables and structure definitions - * - * 03 05 2010 cp.wu - * [WPD00003821][BUG] Host driver stops processing RX packets from HIF RX0 - * change CFG_NUM_OF_QM_RX_PKT_NUM to 120 - * - * 03 04 2010 cp.wu - * [WPD00003821][BUG] Host driver stops processing RX packets from HIF RX0 - * . - * - * 03 04 2010 cp.wu - * [WPD00003821][BUG] Host driver stops processing RX packets from HIF RX0 - * increase RX buffer number to avoid RX buffer starvation. - * - * 02 24 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Changed the number of STA_RECs to 20 - * - * 02 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add checksum offloading support. - * - * 02 11 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. add logic for firmware download - * * 2. firmware image filename and start/load address are now retrieved from registry - * - * 02 08 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * prepare for implementing fw download logic - * - * 12 30 2009 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) According to CMD/EVENT documentation v0.8, - * * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used, - * * and result is retrieved by get ATInfo instead - * * 2) add 4 counter for recording aggregation statistics -** \main\maintrunk.MT6620WiFiDriver_Prj\25 2009-12-16 22:12:28 GMT mtk02752 -** enable interrupt enhanced response, TX/RX Aggregation as default -** \main\maintrunk.MT6620WiFiDriver_Prj\24 2009-12-10 16:38:43 GMT mtk02752 -** eliminate compile options which are obsolete or for emulation purpose -** \main\maintrunk.MT6620WiFiDriver_Prj\23 2009-12-09 13:56:26 GMT MTK02468 -** Added RX buffer reordering configurations -** \main\maintrunk.MT6620WiFiDriver_Prj\22 2009-12-04 12:09:09 GMT mtk02752 -** once enhanced intr/rx reponse is taken, RX must be access in aggregated basis -** \main\maintrunk.MT6620WiFiDriver_Prj\21 2009-11-23 17:54:50 GMT mtk02752 -** correct a typo -** \main\maintrunk.MT6620WiFiDriver_Prj\20 2009-11-17 22:40:47 GMT mtk01084 -** add defines -** \main\maintrunk.MT6620WiFiDriver_Prj\19 2009-11-17 17:33:37 GMT mtk02752 -** add coalescing buffer definition for SD1_SD3_DATAPATH_INTEGRATION -** \main\maintrunk.MT6620WiFiDriver_Prj\18 2009-11-16 20:32:40 GMT mtk02752 -** add CFG_TX_MAX_PKT_NUM for limiting queued TX packet -** \main\maintrunk.MT6620WiFiDriver_Prj\17 2009-11-16 13:34:44 GMT mtk02752 -** add SD1_SD3_DATAPATH_INTEGRATION define for source control -** \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-11-13 13:54:11 GMT mtk01084 -** enable INT enhance mode by default -** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-10-30 18:17:14 GMT mtk01084 -** add new define -** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-10-29 19:47:36 GMT mtk01084 -** not use HIF loopback mode -** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-10-13 21:58:33 GMT mtk01084 -** update for new macro define -** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-09-09 17:26:08 GMT mtk01084 -** add CFG_TEST_WITH_MT5921 -** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-05-18 21:02:30 GMT mtk01426 -** Update CFG_RX_COALESCING_BUFFER_SIZE -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-04-21 09:35:51 GMT mtk01461 -** Add CFG_TX_DBG_MGT_BUF to debug MGMT Buffer depth -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-04-14 15:52:21 GMT mtk01426 -** Add OOB_DATA_PRE_FIXED_LEN define -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-04-08 16:51:08 GMT mtk01084 -** update for FW download part -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-04-01 10:33:37 GMT mtk01461 -** Add SW pre test flag CFG_HIF_LOOPBACK_PRETEST -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-03-23 00:29:18 GMT mtk01461 -** Fix CFG_COALESCING_BUFFER_SIZE if enable the CFG_TX_FRAGMENT -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-03-18 20:58:34 GMT mtk01426 -** Add CFG_HIF_LOOPBACK and CFG_SDIO_RX_ENHANCE -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-17 20:17:36 GMT mtk01426 -** Add CMD/Response related configure -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-16 09:08:21 GMT mtk01461 -** Update TX PATH API -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:11:21 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _CONFIG_H -#define _CONFIG_H -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -/** -#ifndef MT6620 -#define MT6620 -#endif - -#ifdef MT5931 -#undef MT5931 -#endif - -#ifdef MT6628 -#undef MT6628 -#endif -***/ //mark skynine comment - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -//2 Flags for OS capability - -#ifdef LINUX - #ifdef CONFIG_X86 - #define MTK_WCN_HIF_SDIO 0 - #else - #define MTK_WCN_HIF_SDIO 0 - #endif -#else - #define MTK_WCN_HIF_SDIO 0 -#endif - -#if (CFG_SUPPORT_AEE == 1) - #define CFG_ENABLE_AEE_MSG 1 -#else - #define CFG_ENABLE_AEE_MSG 0 -#endif - -//2 Flags for Driver Features -#define CFG_TX_FRAGMENT 1 /*!< 1: Enable TX fragmentation - 0: Disable */ -#define CFG_SUPPORT_PERFORMANCE_TEST 0 /*Only for performance Test*/ - -#define CFG_COUNTRY_CODE NULL //"US" - -#ifndef LINUX - #define CFG_FW_FILENAME L"WIFI_RAM_CODE" - #define CFG_FW_FILENAME_E6 L"WIFI_RAM_CODE_E6" -#else - #define CFG_FW_FILENAME "WIFI_RAM_CODE" -#endif - -#define CFG_SUPPORT_802_11D 1 /*!< 1(default): Enable 802.11d - 0: Disable */ - -#define CFG_SUPPORT_SPEC_MGMT 0 /* Spectrum Management (802.11h): TPC and DFS */ -#define CFG_SUPPORT_RRM 0 /* Radio Reasource Measurement (802.11k) */ -#define CFG_SUPPORT_QUIET 0 /* Quiet (802.11h) */ - - -#define CFG_SUPPORT_RX_RDG 0 /* 11n feature. RX RDG capability */ -#define CFG_SUPPORT_MFB 0 /* 802.11n MCS Feedback responder */ -#define CFG_SUPPORT_RX_STBC 1 /* 802.11n RX STBC (1SS) */ -#define CFG_SUPPORT_RX_SGI 1 /* 802.11n RX short GI for both 20M and 40M BW */ -#define CFG_SUPPORT_RX_HT_GF 1 /* 802.11n RX HT green-field capability */ - -/*------------------------------------------------------------------------------ - * SLT Option - *------------------------------------------------------------------------------ - */ -#define CFG_SLT_SUPPORT 0 - - -#ifdef NDIS60_MINIPORT - #define CFG_NATIVE_802_11 1 - - #define CFG_TX_MAX_PKT_SIZE 2304 - #define CFG_TCP_IP_CHKSUM_OFFLOAD_NDIS_60 0 /* !< 1: Enable TCP/IP header checksum offload - 0: Disable */ - #define CFG_TCP_IP_CHKSUM_OFFLOAD 0 - #define CFG_WHQL_DOT11_STATISTICS 1 - #define CFG_WHQL_ADD_REMOVE_KEY 1 - #define CFG_WHQL_CUSTOM_IE 1 - #define CFG_WHQL_SAFE_MODE_ENABLED 1 - -#else - #define CFG_TCP_IP_CHKSUM_OFFLOAD 1 /* !< 1: Enable TCP/IP header checksum offload - 0: Disable */ - #define CFG_TCP_IP_CHKSUM_OFFLOAD_NDIS_60 0 - #define CFG_TX_MAX_PKT_SIZE 1600 - #define CFG_NATIVE_802_11 0 -#endif - - -//2 Flags for Driver Parameters -/*------------------------------------------------------------------------------ - * Flags for EHPI Interface in Colibri Platform - *------------------------------------------------------------------------------ - */ -#define CFG_EHPI_FASTER_BUS_TIMING 0 /*!< 1: Do workaround for faster bus timing - 0(default): Disable */ - -/*------------------------------------------------------------------------------ - * Flags for HIFSYS Interface - *------------------------------------------------------------------------------ - */ -#ifdef _lint - #define _HIF_SDIO 1 -#endif - -#define CFG_SDIO_INTR_ENHANCE 1 /*!< 1(default): Enable SDIO ISR & TX/RX status enhance mode - 0: Disable */ -#define CFG_SDIO_RX_ENHANCE 0 /*!< 1(default): Enable SDIO ISR & TX/RX status enhance mode - 0: Disable */ -#define CFG_SDIO_TX_AGG 1 /*!< 1: Enable SDIO TX enhance mode(Multiple frames in single BLOCK CMD) - 0(default): Disable */ - -#define CFG_SDIO_RX_AGG 1 /*!< 1: Enable SDIO RX enhance mode(Multiple frames in single BLOCK CMD) - 0(default): Disable */ - -#if (CFG_SDIO_RX_AGG == 1) && (CFG_SDIO_INTR_ENHANCE == 0) - #error "CFG_SDIO_INTR_ENHANCE should be 1 once CFG_SDIO_RX_AGG equals to 1" -#elif (CFG_SDIO_INTR_ENHANCE == 1 || CFG_SDIO_RX_ENHANCE == 1) && (CFG_SDIO_RX_AGG == 0) - #error "CFG_SDIO_RX_AGG should be 1 once CFG_SDIO_INTR_ENHANCE and/or CFG_SDIO_RX_ENHANCE equals to 1" -#endif - -#define CFG_SDIO_MAX_RX_AGG_NUM 0 /*!< 1: Setting the maximum RX aggregation number - 0(default): no limited */ - -#ifdef WINDOWS_CE - #define CFG_SDIO_PATHRU_MODE 1 /*!< 1: Suport pass through (PATHRU) mode - 0: Disable */ -#else - #define CFG_SDIO_PATHRU_MODE 0 /*!< 0: Always disable if WINDOWS_CE is not defined */ -#endif - -#define CFG_MAX_RX_ENHANCE_LOOP_COUNT 3 - - -/*------------------------------------------------------------------------------ - * Flags and Parameters for Integration - *------------------------------------------------------------------------------ - */ -#if defined(MT6620) - #define MT6620_FPGA_BWCS 0 - #define MT6620_FPGA_V5 0 - - #if (MT6620_FPGA_BWCS == 1) && (MT6620_FPGA_V5 == 1) - #error - #endif - - #if (MTK_WCN_HIF_SDIO == 1) - #define CFG_MULTI_ECOVER_SUPPORT 1 - #elif !defined(LINUX) - #define CFG_MULTI_ECOVER_SUPPORT 1 - #else - #define CFG_MULTI_ECOVER_SUPPORT 0 - #endif - - #define CFG_ENABLE_CAL_LOG 0 - #define CFG_REPORT_RFBB_VERSION 0 -#elif defined(MT5931) - -#define CFG_MULTI_ECOVER_SUPPORT 0 -#define CFG_ENABLE_CAL_LOG 0 -#define CFG_REPORT_RFBB_VERSION 0 - -#elif defined(MT6628) - -#define CFG_MULTI_ECOVER_SUPPORT 0 - -#define CFG_ENABLE_CAL_LOG 1 -#define CFG_REPORT_RFBB_VERSION 1 - -#endif - -#if (MTK_WCN_HIF_SDIO == 1) -#define CFG_CHIP_RESET_SUPPORT 1 -#else -#define CFG_CHIP_RESET_SUPPORT 0 -#endif - - -/*------------------------------------------------------------------------------ - * Flags for workaround - *------------------------------------------------------------------------------ - */ -#if defined(MT6620) && (MT6620_FPGA_BWCS == 0) && (MT6620_FPGA_V5 == 0) - #define MT6620_E1_ASIC_HIFSYS_WORKAROUND 0 -#else - #define MT6620_E1_ASIC_HIFSYS_WORKAROUND 0 -#endif - -/*------------------------------------------------------------------------------ - * Flags for driver version - *------------------------------------------------------------------------------ - */ -#define CFG_DRV_OWN_VERSION ((UINT_16)((NIC_DRIVER_MAJOR_VERSION << 8) | (NIC_DRIVER_MINOR_VERSION))) -#define CFG_DRV_PEER_VERSION ((UINT_16)0x0000) - - -/*------------------------------------------------------------------------------ - * Flags for TX path which are OS dependent - *------------------------------------------------------------------------------ - */ -/*! NOTE(Kevin): If the Network buffer is non-scatter-gather like structure(without - * NETIF_F_FRAGLIST in LINUX), then we can set CFG_TX_BUFFER_IS_SCATTER_LIST to "0" - * for zero copy TX packets. - * For scatter-gather like structure, we set "1", driver will do copy frame to - * internal coalescing buffer before write it to FIFO. - */ -#if defined(LINUX) - #define CFG_TX_BUFFER_IS_SCATTER_LIST 1 /*!< 1: Do frame copy before write to TX FIFO. - Used when Network buffer is scatter-gather. - 0(default): Do not copy frame */ -#else /* WINDOWS/WINCE */ - #define CFG_TX_BUFFER_IS_SCATTER_LIST 1 -#endif /* LINUX */ - - -#if CFG_SDIO_TX_AGG || CFG_TX_BUFFER_IS_SCATTER_LIST - #define CFG_COALESCING_BUFFER_SIZE (CFG_TX_MAX_PKT_SIZE * NIC_TX_BUFF_SUM) -#else - #define CFG_COALESCING_BUFFER_SIZE (CFG_TX_MAX_PKT_SIZE) -#endif /* CFG_SDIO_TX_AGG || CFG_TX_BUFFER_IS_SCATTER_LIST */ - -/*------------------------------------------------------------------------------ - * Flags and Parameters for TX path - *------------------------------------------------------------------------------ - */ - -/*! Maximum number of SW TX packet queue */ -#define CFG_TX_MAX_PKT_NUM 256 - -/*! Maximum number of SW TX CMD packet buffer */ -#define CFG_TX_MAX_CMD_PKT_NUM 32 - -/*! Maximum number of associated STAs */ -#define CFG_NUM_OF_STA_RECORD 20 - -/*------------------------------------------------------------------------------ - * Flags and Parameters for RX path - *------------------------------------------------------------------------------ - */ - -/*! Max. descriptor number - sync. with firmware */ -#if CFG_SLT_SUPPORT -#define CFG_NUM_OF_RX0_HIF_DESC 42 -#else -#define CFG_NUM_OF_RX0_HIF_DESC 16 -#endif -#define CFG_NUM_OF_RX1_HIF_DESC 2 - -/*! Max. buffer hold by QM */ -#define CFG_NUM_OF_QM_RX_PKT_NUM 120 - -/*! Maximum number of SW RX packet buffer */ -#define CFG_RX_MAX_PKT_NUM ((CFG_NUM_OF_RX0_HIF_DESC + CFG_NUM_OF_RX1_HIF_DESC) * 3 \ - + CFG_NUM_OF_QM_RX_PKT_NUM) - -#define CFG_RX_REORDER_Q_THRESHOLD 8 - -#ifndef LINUX -#define CFG_RX_RETAINED_PKT_THRESHOLD (CFG_NUM_OF_RX0_HIF_DESC + CFG_NUM_OF_RX1_HIF_DESC + CFG_NUM_OF_QM_RX_PKT_NUM) -#else -#define CFG_RX_RETAINED_PKT_THRESHOLD 0 -#endif - -/*! Maximum RX packet size, if exceed this value, drop incoming packet */ -/* 7.2.3 Maganement frames */ -#define CFG_RX_MAX_PKT_SIZE ( 28 + 2312 + 12 /*HIF_RX_HEADER_T*/ ) //TODO: it should be 4096 under emulation mode - -/*! Minimum RX packet size, if lower than this value, drop incoming packet */ -#define CFG_RX_MIN_PKT_SIZE 10 /*!< 802.11 Control Frame is 10 bytes */ - -#if CFG_SDIO_RX_AGG - /* extra size for CS_STATUS and enhanced response */ - #define CFG_RX_COALESCING_BUFFER_SIZE ((CFG_NUM_OF_RX0_HIF_DESC + 1) \ - * CFG_RX_MAX_PKT_SIZE) -#else - #define CFG_RX_COALESCING_BUFFER_SIZE (CFG_RX_MAX_PKT_SIZE) -#endif - -/*! RX BA capability */ -#define CFG_NUM_OF_RX_BA_AGREEMENTS 8 -#define CFG_RX_BA_MAX_WINSIZE 16 -#define CFG_RX_BA_INC_SIZE 4 -#define CFG_RX_MAX_BA_TID_NUM 8 -#define CFG_RX_REORDERING_ENABLED 1 - -/*------------------------------------------------------------------------------ - * Flags and Parameters for CMD/RESPONSE - *------------------------------------------------------------------------------ - */ -#define CFG_RESPONSE_POLLING_TIMEOUT 512 - - -/*------------------------------------------------------------------------------ - * Flags and Parameters for Protocol Stack - *------------------------------------------------------------------------------ - */ -/*! Maximum number of BSS in the SCAN list */ -#define CFG_MAX_NUM_BSS_LIST 64 - -#define CFG_MAX_COMMON_IE_BUF_LEN (1500 * CFG_MAX_NUM_BSS_LIST) / 3 - -/*! Maximum size of IE buffer of each SCAN record */ -#define CFG_IE_BUFFER_SIZE 512 - -/*! Maximum number of STA records */ -#define CFG_MAX_NUM_STA_RECORD 32 - - - -/*------------------------------------------------------------------------------ - * Flags and Parameters for Power management - *------------------------------------------------------------------------------ - */ -#define CFG_ENABLE_FULL_PM 1 -#define CFG_ENABLE_WAKEUP_ON_LAN 0 - -#define CFG_INIT_POWER_SAVE_PROF ENUM_PSP_FAST_SWITCH - -#define CFG_INIT_ENABLE_PATTERN_FILTER_ARP 0 - -#define CFG_INIT_UAPSD_AC_BMP 0//(BIT(3) | BIT(2) | BIT(1) | BIT(0)) - -//#define CFG_SUPPORT_WAPI 0 -#define CFG_SUPPORT_WPS 1 -#define CFG_SUPPORT_WPS2 1 - -/*------------------------------------------------------------------------------ - * 802.11i RSN Pre-authentication PMKID cahce maximun number - *------------------------------------------------------------------------------ - */ -#define CFG_MAX_PMKID_CACHE 16 /*!< max number of PMKID cache - 16(default) : The Max PMKID cache */ - -/*------------------------------------------------------------------------------ - * Flags and Parameters for Ad-Hoc - *------------------------------------------------------------------------------ - */ -#define CFG_INIT_ADHOC_FREQ (2462000) -#define CFG_INIT_ADHOC_MODE AD_HOC_MODE_MIXED_11BG -#define CFG_INIT_ADHOC_BEACON_INTERVAL (100) -#define CFG_INIT_ADHOC_ATIM_WINDOW (0) - - -/*------------------------------------------------------------------------------ - * Flags and Parameters for Load Setup Default - *------------------------------------------------------------------------------ - */ - -/*------------------------------------------------------------------------------ - * Flags for enable 802.11A Band setting - *------------------------------------------------------------------------------ - */ - -/*------------------------------------------------------------------------------ - * Flags and Parameters for Interrupt Process - *------------------------------------------------------------------------------ - */ -#if defined(_HIF_SDIO) && defined(WINDOWS_CE) - #define CFG_IST_LOOP_COUNT 1 -#else - #define CFG_IST_LOOP_COUNT 1 -#endif /* _HIF_SDIO */ - -#define CFG_INT_WRITE_CLEAR 0 - -#if defined(LINUX) -#define CFG_DBG_GPIO_PINS 0 /* if 1, use MT6516 GPIO pin to log TX behavior */ -#endif - -//2 Flags for Driver Debug Options -/*------------------------------------------------------------------------------ - * Flags of TX Debug Option. NOTE(Kevin): Confirm with SA before modifying following flags. - *------------------------------------------------------------------------------ - */ -#define CFG_DBG_MGT_BUF 1 /*!< 1: Debug statistics usage of MGMT Buffer - 0: Disable */ - -#define CFG_HIF_STATISTICS 0 - -#define CFG_HIF_RX_STARVATION_WARNING 0 - -#define CFG_STARTUP_DEBUG 0 - -#define CFG_RX_PKTS_DUMP 1 - -/*------------------------------------------------------------------------------ - * Flags of Firmware Download Option. - *------------------------------------------------------------------------------ - */ -#define CFG_ENABLE_FW_DOWNLOAD 1 - -#define CFG_ENABLE_FW_DOWNLOAD_ACK 1 -#define CFG_ENABLE_FW_ENCRYPTION 1 - -#if defined(MT6620) || defined(MT6628) - #define CFG_ENABLE_FW_DOWNLOAD_AGGREGATION 0 - #define CFG_ENABLE_FW_DIVIDED_DOWNLOAD 1 -#else - #define CFG_ENABLE_FW_DOWNLOAD_AGGREGATION 0 - #define CFG_ENABLE_FW_DIVIDED_DOWNLOAD 0 -#endif - - - -#if defined(MT6620) - #if MT6620_FPGA_BWCS - #define CFG_FW_LOAD_ADDRESS 0x10014000 - #define CFG_OVERRIDE_FW_START_ADDRESS 0 - #define CFG_FW_START_ADDRESS 0x10014001 - #elif MT6620_FPGA_V5 - #define CFG_FW_LOAD_ADDRESS 0x10008000 - #define CFG_OVERRIDE_FW_START_ADDRESS 0 - #define CFG_FW_START_ADDRESS 0x10008001 - #else - #define CFG_FW_LOAD_ADDRESS 0x10008000 - #define CFG_OVERRIDE_FW_START_ADDRESS 0 - #define CFG_FW_START_ADDRESS 0x10008001 - #endif -#elif defined(MT5931) - #define CFG_FW_LOAD_ADDRESS 0xFF900000 - #define CFG_FW_START_ADDRESS 0x00000000 -#elif defined(MT6628) - #define CFG_FW_LOAD_ADDRESS 0x00060000 - #define CFG_OVERRIDE_FW_START_ADDRESS 0 - #define CFG_FW_START_ADDRESS 0x00060000 -#endif - - -/*------------------------------------------------------------------------------ - * Flags of Bluetooth-over-WiFi (BT 3.0 + HS) support - *------------------------------------------------------------------------------ - */ - -#ifdef LINUX - #ifdef CONFIG_X86 - #define CFG_ENABLE_BT_OVER_WIFI 0 - #else - #define CFG_ENABLE_BT_OVER_WIFI 1 - #endif -#else - #define CFG_ENABLE_BT_OVER_WIFI 0 -#endif - -#define CFG_BOW_SEPARATE_DATA_PATH 1 - -#define CFG_BOW_PHYSICAL_LINK_NUM 4 - -#define CFG_BOW_TEST 0 - -#define CFG_BOW_LIMIT_AIS_CHNL 1 - -#define CFG_BOW_SUPPORT_11N 0 - -#define CFG_BOW_RATE_LIMITATION 1 - -/*------------------------------------------------------------------------------ - * Flags of Wi-Fi Direct support - *------------------------------------------------------------------------------ - */ -#ifdef LINUX - #ifdef CONFIG_X86 - #define CFG_ENABLE_WIFI_DIRECT 0 - #define CFG_SUPPORT_802_11W 0 - #else - #define CFG_ENABLE_WIFI_DIRECT 1 - #define CFG_SUPPORT_802_11W 0 /*!< 0(default): Disable 802.11W */ - #endif -#else - #define CFG_ENABLE_WIFI_DIRECT 0 - #define CFG_SUPPORT_802_11W 0 /* Not support at WinXP */ -#endif - -#define CFG_SUPPORT_PERSISTENT_GROUP 0 - -#define CFG_TEST_WIFI_DIRECT_GO 0 - -#define CFG_TEST_ANDROID_DIRECT_GO 0 - -#define CFG_UNITEST_P2P 0 - -/* - * Enable cfg80211 option after Android 2.2(Froyo) is suggested, - * cfg80211 on linux 2.6.29 is not mature yet - */ -#define CFG_ENABLE_WIFI_DIRECT_CFG_80211 1 - -/*------------------------------------------------------------------------------ - * Configuration Flags (Linux Only) - *------------------------------------------------------------------------------ - */ -#define CFG_SUPPORT_EXT_CONFIG 0 - -/*------------------------------------------------------------------------------ - * Statistics Buffering Mechanism - *------------------------------------------------------------------------------ - */ -#if CFG_SUPPORT_PERFORMANCE_TEST -#define CFG_ENABLE_STATISTICS_BUFFERING 1 -#else -#define CFG_ENABLE_STATISTICS_BUFFERING 0 -#endif -#define CFG_STATISTICS_VALID_CYCLE 2000 -#define CFG_LINK_QUALITY_VALID_PERIOD 5000 - -/*------------------------------------------------------------------------------ - * Migration Option - *------------------------------------------------------------------------------ - */ -#define CFG_SUPPORT_ADHOC 1 -#define CFG_SUPPORT_AAA 1 - - -#if (defined(MT5931) && defined(LINUX)) -#define CFG_SUPPORT_BCM 1 -#define CFG_SUPPORT_BCM_BWCS 1 -#define CFG_SUPPORT_BCM_BWCS_DEBUG 1 -#else -#define CFG_SUPPORT_BCM 0 -#define CFG_SUPPORT_BCM_BWCS 0 -#define CFG_SUPPORT_BCM_BWCS_DEBUG 0 -#endif - -#define CFG_SUPPORT_RDD_TEST_MODE 0 - -#define CFG_SUPPORT_PWR_MGT 1 - -#define CFG_RSN_MIGRATION 1 - -#define CFG_PRIVACY_MIGRATION 1 - -#define CFG_ENABLE_HOTSPOT_PRIVACY_CHECK 1 - -#define CFG_MGMT_FRAME_HANDLING 1 - -#define CFG_MGMT_HW_ACCESS_REPLACEMENT 0 - -#if CFG_SUPPORT_PERFORMANCE_TEST - -#else - -#endif - -#define CFG_SUPPORT_AIS_5GHZ 1 -#define CFG_SUPPORT_BEACON_CHANGE_DETECTION 0 - -/*------------------------------------------------------------------------------ - * Option for NVRAM and Version Checking - *------------------------------------------------------------------------------ - */ -#define CFG_SUPPORT_NVRAM 0 -#define CFG_NVRAM_EXISTENCE_CHECK 1 -#define CFG_SW_NVRAM_VERSION_CHECK 0 -#define CFG_SUPPORT_NIC_CAPABILITY 1 - - -/*------------------------------------------------------------------------------ - * CONFIG_TITLE : Stress Test Option - * OWNER : Puff Wen - * Description : For stress test only. DO NOT enable it while normal operation - *------------------------------------------------------------------------------ - */ -#define CFG_STRESS_TEST_SUPPORT 0 - -/*------------------------------------------------------------------------------ - * Flags for LINT - *------------------------------------------------------------------------------ - */ -#define LINT_SAVE_AND_DISABLE /*lint -save -e* */ - -#define LINT_RESTORE /*lint -restore */ - -#define LINT_EXT_HEADER_BEGIN LINT_SAVE_AND_DISABLE - -#define LINT_EXT_HEADER_END LINT_RESTORE - -/*------------------------------------------------------------------------------ - * Flags of Features - *------------------------------------------------------------------------------ - */ - -#define CFG_SUPPORT_QOS 1 /* Enable/disable QoS TX, AMPDU */ -#define CFG_SUPPORT_AMPDU_TX 1 -#define CFG_SUPPORT_AMPDU_RX 1 -#define CFG_SUPPORT_TSPEC 0 /* Enable/disable TS-related Action frames handling */ -#define CFG_SUPPORT_UAPSD 1 -#define CFG_SUPPORT_UL_PSMP 0 - -#define CFG_SUPPORT_ROAMING 0 /* Roaming System */ -#define CFG_SUPPORT_SWCR 1 - -#define CFG_SUPPORT_ANTI_PIRACY 1 - -#define CFG_SUPPORT_OSC_SETTING 1 - -#if defined(MT5931) -#define CFG_SUPPORT_WHOLE_CHIP_RESET 1 /* for e3 chip only */ -#endif - -#define CFG_SUPPORT_P2P_RSSI_QUERY 0 - -#define CFG_SHOW_MACADDR_SOURCE 1 - -#define CFG_SUPPORT_802_11V 0 /* Support 802.11v Wireless Network Management */ -#define CFG_SUPPORT_802_11V_TIMING_MEASUREMENT 0 -#if (CFG_SUPPORT_802_11V_TIMING_MEASUREMENT == 1) && (CFG_SUPPORT_802_11V == 0) - #error "CFG_SUPPORT_802_11V should be 1 once CFG_SUPPORT_802_11V_TIMING_MEASUREMENT equals to 1" -#endif -#if (CFG_SUPPORT_802_11V == 0) -#define WNM_UNIT_TEST 0 -#endif - -#define CFG_DRIVER_COMPOSE_ASSOC_REQ 1 - -#define CFG_STRICT_CHECK_CAPINFO_PRIVACY 0 - -/*------------------------------------------------------------------------------ - * Flags of bus error tolerance - *------------------------------------------------------------------------------ - */ -#define CFG_FORCE_RESET_UNDER_BUS_ERROR 0 - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#endif /* _CONFIG_H */ - - diff --git a/drivers/net/wireless/mt5931/include/debug.h b/drivers/net/wireless/mt5931/include/debug.h deleted file mode 100755 index 3d5f03e16d0d..000000000000 --- a/drivers/net/wireless/mt5931/include/debug.h +++ /dev/null @@ -1,517 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/debug.h#1 $ -*/ - -/*! \file debug.h - \brief Definition of SW debugging level. - - In this file, it describes the definition of various SW debugging levels and - assert functions. -*/ - - - -/* -** $Log: debug.h $ - * - * 12 16 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * fixed the Windows DDK free build compiling error. - * - * 11 24 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * Adjust code for DBG and CONFIG_XLOG. - * - * 11 11 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * modify the xlog related code. - * - * 11 10 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * Using the new XLOG define for dum Memory. - * - * 11 03 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * Add dumpMemory8 at XLOG support. - * - * 11 02 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * adding the code for XLOG. - * - * 08 31 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * . - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * - * 01 07 2011 wh.su - * [WCXRP00000326] [MT6620][Wi-Fi][Driver] check in the binary format gl_sec.o.new instead of use change type!!! - * . - * - * 09 23 2010 cp.wu - * NULL - * add BOW index for debugging message and passing compilation - * - * 07 20 2010 wh.su - * - * adding the wapi code. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 21 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Support CFG_MQM_MIGRATION flag - * - * 06 17 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Add one more debug moduel for P2P. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add management dispatching function table. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add bss.c. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add debug module index for cnm and ais. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 17 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add CFG_STARTUP_DEBUG for debugging starting up issue. - * - * 04 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) surpress compiler warning - * 2) when acqruing LP-own, keep writing WHLPCR whenever OWN is not acquired yet -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-10-29 19:47:50 GMT mtk01084 -** add emu catagory -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-04-17 18:12:04 GMT mtk01426 -** Don't use dynamic memory allocate for debug message -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:11:29 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _DEBUG_H -#define _DEBUG_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ -#ifndef BUILD_QA_DBG -#define BUILD_QA_DBG 0 -#endif - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_typedef.h" -#if CFG_SUPPORT_XLOG -#include "linux/xlog.h" -#endif - -extern UINT_8 aucDebugModule[]; -extern UINT_32 u4DebugModule; - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -/* Define debug category (class): - * (1) ERROR (2) WARN (3) STATE (4) EVENT (5) TRACE (6) INFO (7) LOUD (8) TEMP - */ -#define DBG_CLASS_ERROR BIT(0) -#define DBG_CLASS_WARN BIT(1) -#define DBG_CLASS_STATE BIT(2) -#define DBG_CLASS_EVENT BIT(3) -#define DBG_CLASS_TRACE BIT(4) -#define DBG_CLASS_INFO BIT(5) -#define DBG_CLASS_LOUD BIT(6) -#define DBG_CLASS_TEMP BIT(7) -#define DBG_CLASS_MASK BITS(0,7) - - -#if defined(LINUX) -#define DBG_PRINTF_64BIT_DEC "lld" - -#else //Windows -#define DBG_PRINTF_64BIT_DEC "I64d" - -#endif -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/* Define debug module index */ -typedef enum _ENUM_DBG_MODULE_T { - DBG_INIT_IDX = 0, /* For driver initial */ - DBG_HAL_IDX, /* For HAL(HW) Layer */ - DBG_INTR_IDX, /* For Interrupt */ - DBG_REQ_IDX, - DBG_TX_IDX, - DBG_RX_IDX, - DBG_RFTEST_IDX, /* For RF test mode*/ - DBG_EMU_IDX, /* Developer specific */ - - DBG_SW1_IDX, /* Developer specific */ - DBG_SW2_IDX, /* Developer specific */ - DBG_SW3_IDX, /* Developer specific */ - DBG_SW4_IDX, /* Developer specific */ - - DBG_HEM_IDX, /* HEM */ - DBG_AIS_IDX, /* AIS */ - DBG_RLM_IDX, /* RLM */ - DBG_MEM_IDX, /* RLM */ - DBG_CNM_IDX, /* CNM */ - DBG_RSN_IDX, /* RSN */ - DBG_BSS_IDX, /* BSS */ - DBG_SCN_IDX, /* SCN */ - DBG_SAA_IDX, /* SAA */ - DBG_AAA_IDX, /* AAA */ - DBG_P2P_IDX, /* P2P */ - DBG_QM_IDX, /* QUE_MGT */ - DBG_SEC_IDX, /* SEC */ - DBG_BOW_IDX, /* BOW */ - DBG_WAPI_IDX, /* WAPI */ - DBG_ROAMING_IDX, /* ROAMING */ - - DBG_MODULE_NUM /* Notice the XLOG check */ -} ENUM_DBG_MODULE_T; - -//XLOG -//#define XLOG_DBG_MODULE_IDX 28 /* DBG_MODULE_NUM */ -//#if (XLOG_DBG_MODULE_IDX != XLOG_DBG_MODULE_IDX) -//#error "Please modify the DBG_MODULE_NUM and make sure this include at XLOG" -//#endif - -/* Define who owns developer specific index */ -#define DBG_YARCO_IDX DBG_SW1_IDX -#define DBG_KEVIN_IDX DBG_SW2_IDX -#define DBG_CMC_IDX DBG_SW3_IDX -#define DBG_GEORGE_IDX DBG_SW4_IDX - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -/* Debug print format string for the OS system time */ -#define OS_SYSTIME_DBG_FORMAT "0x%08x" - -/* Debug print argument for the OS system time */ -#define OS_SYSTIME_DBG_ARGUMENT(systime) (systime) - -/* Debug print format string for the MAC Address */ -#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" - -/* Debug print argument for the MAC Address */ -#define MAC2STR(a) ((PUINT_8)a)[0], ((PUINT_8)a)[1], ((PUINT_8)a)[2], \ - ((PUINT_8)a)[3], ((PUINT_8)a)[4], ((PUINT_8)a)[5] - -/* The pre-defined format to dump the value of a varaible with its name shown. */ -#define DUMPVAR(variable, format) (#variable " = " format "\n", variable) - -/* The pre-defined format to dump the MAC type value with its name shown. */ -#define DUMPMACADDR(addr) (#addr " = " MACSTR "\n", MAC2STR(addr)) - - -/* Basiclly, we just do renaming of KAL functions although they should - * be defined as "Nothing to do" if DBG=0. But in some compiler, the macro - * syntax does not support #define LOG_FUNC(x,...) - * - * A caller shall not invoke these three macros when DBG=0. - */ -#define LOG_FUNC_TIME kalPrint -#define LOG_FUNC kalPrint - -#if DBG - - #define TMP_BUF_LEN 256 - #define TMP_WBUF_LEN (TMP_BUF_LEN * 2) - - extern PINT_16 g_wbuf_p; - extern PINT_8 g_buf_p; - - /* If __FUNCTION__ is already defined by compiler, we just use it. */ - #if defined(__FUNCTION__) - #define DEBUGFUNC(_Func) - #else - #define DEBUGFUNC(_Func) static const char __FUNCTION__[] = _Func; - #endif - - /* The following macros are used for future debug message. */ - /* TODO(Kevin): We should remove INITLOG/ERRORLOG/WARNLOG macro sooner or later */ - #define INITLOG(_Fmt) \ - { \ - if (aucDebugModule[DBG_INIT_IDX] & DBG_CLASS_TRACE) { \ - LOG_FUNC("%s: ", __FUNCTION__); \ - LOG_FUNC _Fmt; \ - } \ - } - - #define ERRORLOG(_Fmt) \ - { \ - if (aucDebugModule[DBG_INIT_IDX] & DBG_CLASS_ERROR) { \ - LOG_FUNC("**Error[%s:%d]-", __FILE__, __LINE__); \ - LOG_FUNC _Fmt; \ - } \ - } - - #define WARNLOG(_Fmt) \ - { \ - if (aucDebugModule[DBG_INIT_IDX] & DBG_CLASS_WARN) { \ - LOG_FUNC("**Warning[%s:%d]-", __FILE__, __LINE__); \ - LOG_FUNC _Fmt; \ - } \ - } - - /*lint -save -e960 Multiple use of '#/##' */ - #define DBGLOG(_Module, _Class, _Fmt) \ - { \ - if (aucDebugModule[DBG_##_Module##_IDX] & DBG_CLASS_##_Class) { \ - if (DBG_CLASS_##_Class == DBG_CLASS_ERROR) { \ - LOG_FUNC_TIME("**Error[%s:%d]-", __FILE__, __LINE__); \ - LOG_FUNC("%s: (" #_Module " " #_Class ") ", __FUNCTION__); \ - } \ - else if (DBG_CLASS_##_Class == DBG_CLASS_WARN) { \ - LOG_FUNC_TIME("**Warning[%s:%d]-", __FILE__, __LINE__); \ - LOG_FUNC("%s: (" #_Module " " #_Class ") ", __FUNCTION__); \ - } \ - else if (DBG_CLASS_##_Class == DBG_CLASS_EVENT) { \ - } \ - else { \ - LOG_FUNC_TIME("%s: (" #_Module " " #_Class ") ", __FUNCTION__); \ - } \ - LOG_FUNC _Fmt; \ - } \ - } - - #define DBGLOG_MEM8(_Module, _Class, _StartAddr, _Length) \ - { \ - if (aucDebugModule[DBG_##_Module##_IDX] & DBG_CLASS_##_Class) { \ - LOG_FUNC("%s: (" #_Module " " #_Class ")\n", __FUNCTION__); \ - dumpMemory8((PUINT_8) (_StartAddr), (UINT_32) (_Length)); \ - } \ - } - - #define DBGLOG_MEM32(_Module, _Class, _StartAddr, _Length) \ - { \ - if (aucDebugModule[DBG_##_Module##_IDX] & DBG_CLASS_##_Class) { \ - LOG_FUNC("%s: (" #_Module " " #_Class ")\n", __FUNCTION__); \ - dumpMemory32((PUINT_32) (_StartAddr), (UINT_32) (_Length)); \ - } \ - } - /*lint -restore */ - - /*lint -save -e961 use of '#undef' is discouraged */ - #undef ASSERT - /*lint -restore */ - - #ifdef _lint - #define ASSERT(_exp) \ - { \ - if (!(_exp)) {do {} while (1);} \ - } - #else - #define ASSERT(_exp) \ - { \ - if (!(_exp) && !fgIsBusAccessFailed) { \ - LOG_FUNC("Assertion failed: %s:%d %s\n", __FILE__, __LINE__, #_exp); \ - kalBreakPoint(); \ - } \ - } - #endif /* _lint */ - - #define ASSERT_REPORT(_exp, _fmt) \ - { \ - if (!(_exp) && !fgIsBusAccessFailed) { \ - LOG_FUNC("Assertion failed: %s:%d %s\n", __FILE__, __LINE__, #_exp); \ - LOG_FUNC _fmt; \ - kalBreakPoint(); \ - } \ - } - - #define DISP_STRING(_str) _str - -#else /* !DBG */ - - #define DEBUGFUNC(_Func) - #define INITLOG(_Fmt) - #define ERRORLOG(_Fmt) - #define WARNLOG(_Fmt) - -#if defined(LINUX) - #define DBGLOG(_Module, _Class, _Fmt) \ - { \ - _Module##_##_Class##_LOGFUNC _Fmt; \ - } -#else - #define DBGLOG(_Module, _Class, _Fmt) -#endif - -#if CFG_SUPPORT_XLOG - #define DBGLOG_MEM8(_Module, _Class, _StartAddr, _Length) \ - { \ - _Module##_##_Class##_LOGFUNC (__FUNCTION__);\ - _Module##_##_Class##_LOGDUMP8(_StartAddr, _Length); \ - } -#else - #define DBGLOG_MEM8(_Module, _Class, _StartAddr, _Length) -#endif - #define DBGLOG_MEM32(_Module, _Class, _StartAddr, _Length) - - #undef ASSERT - -#if BUILD_QA_DBG - #if defined(LINUX) /* For debugging in Linux w/o GDB */ - #define ASSERT(_exp) \ - { \ - if (!(_exp) && !fgIsBusAccessFailed) { \ - LOG_FUNC("Assertion failed: %s:%d (%s)\n", __FILE__, __LINE__, #_exp); \ - kalBreakPoint(); \ - } \ - } - - #define ASSERT_REPORT(_exp, _fmt) \ - { \ - if (!(_exp) && !fgIsBusAccessFailed) { \ - LOG_FUNC("Assertion failed: %s:%d (%s)\n", __FILE__, __LINE__, #_exp); \ - LOG_FUNC _fmt; \ - kalBreakPoint(); \ - } \ - } - #else - #ifdef WINDOWS_CE - #define UNICODE_TEXT(_msg) TEXT(_msg) - #define ASSERT(_exp) \ - { \ - if (!(_exp) && !fgIsBusAccessFailed) { \ - TCHAR rUbuf[256]; \ - kalBreakPoint(); \ - _stprintf(rUbuf, TEXT("Assertion failed: %s:%d %s\n"), \ - UNICODE_TEXT(__FILE__), \ - __LINE__, \ - UNICODE_TEXT(#_exp)); \ - MessageBox(NULL, rUbuf, TEXT("ASSERT!"), MB_OK); \ - } \ - } - - #define ASSERT_REPORT(_exp, _fmt) \ - { \ - if (!(_exp) && !fgIsBusAccessFailed) { \ - TCHAR rUbuf[256]; \ - kalBreakPoint(); \ - _stprintf(rUbuf, TEXT("Assertion failed: %s:%d %s\n"), \ - UNICODE_TEXT(__FILE__), \ - __LINE__, \ - UNICODE_TEXT(#_exp)); \ - MessageBox(NULL, rUbuf, TEXT("ASSERT!"), MB_OK); \ - } \ - } - #else - #define ASSERT(_exp) \ - { \ - if (!(_exp) && !fgIsBusAccessFailed) { \ - kalBreakPoint(); \ - } \ - } - - #define ASSERT_REPORT(_exp, _fmt) \ - { \ - if (!(_exp) && !fgIsBusAccessFailed) { \ - kalBreakPoint(); \ - } \ - } - #endif /* WINDOWS_CE */ - #endif /* LINUX */ -#else - #define ASSERT(_exp) - #define ASSERT_REPORT(_exp, _fmt) -#endif /* BUILD_QA_DBG */ - - #define DISP_STRING(_str) "" - -#endif /* DBG */ - -#if CFG_STARTUP_DEBUG - #if defined(LINUX) -#define DBGPRINTF kalPrint - #else -#define DBGPRINTF DbgPrint - #endif -#else -#define DBGPRINTF(...) -#endif - - -/* The following macro is used for debugging packed structures. */ -#ifndef DATA_STRUC_INSPECTING_ASSERT -#define DATA_STRUC_INSPECTING_ASSERT(expr) \ - switch (0) {case 0: case (expr): default:;} -#endif - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -#if DBG -VOID -dumpMemory8 ( - IN PUINT_8 pucStartAddr, - IN UINT_32 u4Length - ); - -VOID -dumpMemory32 ( - IN PUINT_32 pu4StartAddr, - IN UINT_32 u4Length - ); -#elif CFG_SUPPORT_XLOG -VOID -dumpMemory8 ( - IN UINT_32 log_level, - IN PUINT_8 pucStartAddr, - IN UINT_32 u4Length - ); -#endif /* DBG */ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#endif /* _DEBUG_H */ - diff --git a/drivers/net/wireless/mt5931/include/link.h b/drivers/net/wireless/mt5931/include/link.h deleted file mode 100755 index deefb031a2e5..000000000000 --- a/drivers/net/wireless/mt5931/include/link.h +++ /dev/null @@ -1,414 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/link.h#1 $ -*/ - -/*! \file link.h - \brief Definition for simple doubly linked list operations. - - In this file we define the simple doubly linked list data structure and its - operation MACROs and INLINE functions. -*/ - - - -/* -** $Log: link.h $ - * - * 08 05 2010 yuche.tsai - * NULL - * Modify a MACRO of LINK_FOR_EACH_SAFE for compile error. - * - * 07 19 2010 cm.chang - * - * Set RLM parameters and enable CNM channel manager - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * [WPD00003833] [MT6620 and MT5931] Driver migration - * . - * - * - * - * - * May 4 2009 mtk01084 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * add WIFI to BORA source control -** \main\maintrunk.MT5921\8 2008-10-16 15:57:11 GMT mtk01461 -** Update driver to fix lint warning -** \main\maintrunk.MT5921\7 2008-08-10 18:47:53 GMT mtk01461 -** Update for Driver Review -** \main\maintrunk.MT5921\6 2007-12-11 00:09:00 GMT mtk01461 -** Add macro for checking valid list -** \main\maintrunk.MT5921\5 2007-11-13 14:27:01 GMT mtk01461 -** Add LINK_IS_INVALID macro -** Revision 1.1.1.1 2007/06/22 08:09:05 MTK01461 -** no message -** -*/ - -#ifndef _LINK_H -#define _LINK_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_typedef.h" - - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define INVALID_LINK_POISON1 ((VOID *) 0x00100101) // May cause page fault & unalignment issue (data abort) -#define INVALID_LINK_POISON2 ((VOID *) 0x00100201) // Used to verify that nonbody uses non-initialized link entries. - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/* Simple Doubly Linked List Structures - Entry Part */ -typedef struct _LINK_ENTRY_T { - struct _LINK_ENTRY_T *prNext, *prPrev; -} LINK_ENTRY_T, *P_LINK_ENTRY_T; - -/* Simple Doubly Linked List Structures - List Part */ -typedef struct _LINK_T { - P_LINK_ENTRY_T prNext; - P_LINK_ENTRY_T prPrev; - UINT_32 u4NumElem; -} LINK_T, *P_LINK_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#if 0 // No one use it, temporarily mark it for [Lint - Info 773] -#define LINK_ADDR(rLink) { (P_LINK_ENTRY_T)(&(rLink)), (P_LINK_ENTRY_T)(&(rLink)), 0 } - -#define LINK_DECLARATION(rLink) \ - struct _LINK_T rLink = LINK_ADDR(rLink) -#endif - -#define LINK_INITIALIZE(prLink) \ - do { \ - ((P_LINK_T)(prLink))->prNext = (P_LINK_ENTRY_T)(prLink); \ - ((P_LINK_T)(prLink))->prPrev = (P_LINK_ENTRY_T)(prLink); \ - ((P_LINK_T)(prLink))->u4NumElem = 0; \ - } while (0) - -#define LINK_ENTRY_INITIALIZE(prEntry) \ - do { \ - ((P_LINK_ENTRY_T)(prEntry))->prNext = (P_LINK_ENTRY_T)NULL; \ - ((P_LINK_ENTRY_T)(prEntry))->prPrev = (P_LINK_ENTRY_T)NULL; \ - } while (0) - -#define LINK_ENTRY_INVALID(prEntry) \ - do { \ - ((P_LINK_ENTRY_T)(prEntry))->prNext = (P_LINK_ENTRY_T)INVALID_LINK_POISON1; \ - ((P_LINK_ENTRY_T)(prEntry))->prPrev = (P_LINK_ENTRY_T)INVALID_LINK_POISON2; \ - } while (0) - -#define LINK_IS_EMPTY(prLink) (((P_LINK_T)(prLink))->prNext == (P_LINK_ENTRY_T)(prLink)) - -/* NOTE: We should do memory zero before any LINK been initiated, so we can check - * if it is valid before parsing the LINK. - */ -#define LINK_IS_INVALID(prLink) (((P_LINK_T)(prLink))->prNext == (P_LINK_ENTRY_T)NULL) - -#define LINK_IS_VALID(prLink) (((P_LINK_T)(prLink))->prNext != (P_LINK_ENTRY_T)NULL) - - -#define LINK_ENTRY(ptr, type, member) ENTRY_OF(ptr, type, member) - -/* Insert an entry into a link list's head */ -#define LINK_INSERT_HEAD(prLink, prEntry) \ - { \ - linkAdd(prEntry, prLink); \ - ((prLink)->u4NumElem)++; \ - } - - -/* Append an entry into a link list's tail */ -#define LINK_INSERT_TAIL(prLink, prEntry) \ - { \ - linkAddTail(prEntry, prLink); \ - ((prLink)->u4NumElem)++; \ - } - -/* Peek head entry, but keep still in link list */ -#define LINK_PEEK_HEAD(prLink, _type, _member) \ - ( \ - LINK_IS_EMPTY(prLink) ? \ - NULL : LINK_ENTRY((prLink)->prNext, _type, _member) \ - ) - -/* Peek tail entry, but keep still in link list */ -#define LINK_PEEK_TAIL(prLink, _type, _member) \ - ( \ - LINK_IS_EMPTY(prLink) ? \ - NULL : LINK_ENTRY((prLink)->prPrev, _type, _member) \ - ) - -/* Get first entry from a link list */ -/* NOTE: We assume the link entry located at the beginning of "prEntry Type", - * so that we can cast the link entry to other data type without doubts. - * And this macro also decrease the total entry count at the same time. - */ -#define LINK_REMOVE_HEAD(prLink, prEntry, _P_TYPE) \ - { \ - ASSERT(prLink); \ - if (LINK_IS_EMPTY(prLink)) { \ - prEntry = (_P_TYPE)NULL; \ - } \ - else { \ - prEntry = (_P_TYPE)(((P_LINK_T)(prLink))->prNext); \ - linkDel((P_LINK_ENTRY_T)prEntry); \ - ((prLink)->u4NumElem)--; \ - } \ - } - -/* Assume the link entry located at the beginning of prEntry Type. - * And also decrease the total entry count. - */ -#define LINK_REMOVE_KNOWN_ENTRY(prLink, prEntry) \ - { \ - ASSERT(prLink); \ - ASSERT(prEntry); \ - linkDel((P_LINK_ENTRY_T)prEntry); \ - ((prLink)->u4NumElem)--; \ - } - -/* Iterate over a link list */ -#define LINK_FOR_EACH(prEntry, prLink) \ - for (prEntry = (prLink)->prNext; \ - prEntry != (P_LINK_ENTRY_T)(prLink); \ - prEntry = (P_LINK_ENTRY_T)prEntry->prNext) - -/* Iterate over a link list backwards */ -#define LINK_FOR_EACH_PREV(prEntry, prLink) \ - for (prEntry = (prLink)->prPrev; \ - prEntry != (P_LINK_ENTRY_T)(prLink); \ - prEntry = (P_LINK_ENTRY_T)prEntry->prPrev) - -/* Iterate over a link list safe against removal of link entry */ -#define LINK_FOR_EACH_SAFE(prEntry, prNextEntry, prLink) \ - for (prEntry = (prLink)->prNext, prNextEntry = prEntry->prNext; \ - prEntry != (P_LINK_ENTRY_T)(prLink); \ - prEntry = prNextEntry, prNextEntry = prEntry->prNext) - -/* Iterate over a link list of given type */ -#define LINK_FOR_EACH_ENTRY(prObj, prLink, rMember, _TYPE) \ - for (prObj = LINK_ENTRY((prLink)->prNext, _TYPE, rMember); \ - &prObj->rMember != (P_LINK_ENTRY_T)(prLink); \ - prObj = LINK_ENTRY(prObj->rMember.prNext, _TYPE, rMember)) - -/* Iterate backwards over a link list of given type */ -#define LINK_FOR_EACH_ENTRY_PREV(prObj, prLink, rMember, _TYPE) \ - for (prObj = LINK_ENTRY((prLink)->prPrev, _TYPE, rMember); \ - &prObj->rMember != (P_LINK_ENTRY_T)(prLink); \ - prObj = LINK_ENTRY(prObj->rMember.prPrev, _TYPE, rMember)) - -/* Iterate over a link list of given type safe against removal of link entry */ -#define LINK_FOR_EACH_ENTRY_SAFE(prObj, prNextObj, prLink, rMember, _TYPE) \ - for (prObj = LINK_ENTRY((prLink)->prNext, _TYPE, rMember), \ - prNextObj = LINK_ENTRY(prObj->rMember.prNext, _TYPE, rMember); \ - &prObj->rMember != (P_LINK_ENTRY_T)(prLink); \ - prObj = prNextObj, \ - prNextObj = LINK_ENTRY(prNextObj->rMember.prNext, _TYPE, rMember)) - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is only for internal link list manipulation. -* -* \param[in] prNew Pointer of new link head -* \param[in] prPrev Pointer of previous link head -* \param[in] prNext Pointer of next link head -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -__linkAdd ( - IN P_LINK_ENTRY_T prNew, - IN P_LINK_ENTRY_T prPrev, - IN P_LINK_ENTRY_T prNext - ) -{ - prNext->prPrev = prNew; - prNew->prNext = prNext; - prNew->prPrev = prPrev; - prPrev->prNext = prNew; - - return; -} /* end of __linkAdd() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will add a new entry after the specified link head. -* -* \param[in] prNew New entry to be added -* \param[in] prHead Specified link head to add it after -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -linkAdd ( - IN P_LINK_ENTRY_T prNew, - IN P_LINK_T prLink - ) -{ - __linkAdd(prNew, (P_LINK_ENTRY_T)prLink, prLink->prNext); - - return; -} /* end of linkAdd() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will add a new entry before the specified link head. -* -* \param[in] prNew New entry to be added -* \param[in] prHead Specified link head to add it before -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -linkAddTail ( - IN P_LINK_ENTRY_T prNew, - IN P_LINK_T prLink - ) -{ - __linkAdd(prNew, prLink->prPrev, (P_LINK_ENTRY_T)prLink); - - return; -} /* end of linkAddTail() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is only for internal link list manipulation. -* -* \param[in] prPrev Pointer of previous link head -* \param[in] prNext Pointer of next link head -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -__linkDel ( - IN P_LINK_ENTRY_T prPrev, - IN P_LINK_ENTRY_T prNext - ) -{ - prNext->prPrev = prPrev; - prPrev->prNext = prNext; - - return; -} /* end of __linkDel() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will delete a specified entry from link list. -* NOTE: the entry is in an initial state. -* -* \param prEntry Specified link head(entry) -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -linkDel ( - IN P_LINK_ENTRY_T prEntry - ) -{ - __linkDel(prEntry->prPrev, prEntry->prNext); - - LINK_ENTRY_INITIALIZE(prEntry); - - return; -} /* end of linkDel() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will delete a specified entry from link list and then add it -* after the specified link head. -* -* \param[in] prEntry Specified link head(entry) -* \param[in] prOtherHead Another link head to add it after -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -linkMove ( - IN P_LINK_ENTRY_T prEntry, - IN P_LINK_T prLink - ) -{ - __linkDel(prEntry->prPrev, prEntry->prNext); - linkAdd(prEntry, prLink); - - return; -} /* end of linkMove() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will delete a specified entry from link list and then add it -* before the specified link head. -* -* \param[in] prEntry Specified link head(entry) -* \param[in] prOtherHead Another link head to add it before -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -linkMoveTail ( - IN P_LINK_ENTRY_T prEntry, - IN P_LINK_T prLink - ) -{ - __linkDel(prEntry->prPrev, prEntry->prNext); - linkAddTail(prEntry, prLink); - - return; -} /* end of linkMoveTail() */ - -#endif /* _LINK_H */ - diff --git a/drivers/net/wireless/mt5931/include/mgmt/aa_fsm.h b/drivers/net/wireless/mt5931/include/mgmt/aa_fsm.h deleted file mode 100755 index 1e7630c7c7ee..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/aa_fsm.h +++ /dev/null @@ -1,251 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/aa_fsm.h#1 $ -*/ - -/*! \file aa_fsm.h - \brief Declaration of functions and finite state machine for SAA/AAA Module. - - Declaration of functions and finite state machine for SAA/AAA Module. -*/ - - - -/* -** $Log: aa_fsm.h $ - * - * 10 13 2011 cp.wu - * [MT6620 Wi-Fi][Driver] Reduce join failure count limit to 2 for faster re-join for other BSS - * 1. short join failure count limit to 2 - * 2. treat join timeout as kind of join failure as well - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * refine TX-DONE callback. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add buildable & linkable ais_fsm.c - * - * related reference are still waiting to be resolved - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add aa_fsm.h, ais_fsm.h, bss.h, mib.h and scan.h. - * - * 03 10 2010 kevin.huang - * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support - * - * Add Channel Manager for arbitration of JOIN and SCAN Req - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * 01 11 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add Deauth and Disassoc Handler - * - * Nov 24 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Revise MGMT Handler with Retain Status - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -*/ - - -#ifndef _AA_FSM_H -#define _AA_FSM_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -/* Retry interval for retransmiting authentication-request MMPDU. */ -#define TX_AUTHENTICATION_RETRY_TIMEOUT_TU 100 // TU. - -/* Retry interval for retransmiting association-request MMPDU. */ -#define TX_ASSOCIATION_RETRY_TIMEOUT_TU 100 // TU. - -/* Wait for a response to a transmitted authentication-request MMPDU. */ -#define DOT11_AUTHENTICATION_RESPONSE_TIMEOUT_TU 512 // TU. - -/* Wait for a response to a transmitted association-request MMPDU. */ -#define DOT11_ASSOCIATION_RESPONSE_TIMEOUT_TU 512 // TU. - -/* The maximum time to wait for JOIN process complete. */ -#define JOIN_FAILURE_TIMEOUT_BEACON_INTERVAL 20 // Beacon Interval, 20 * 100TU = 2 sec. - -/* Retry interval for next JOIN request. */ -#define JOIN_RETRY_INTERVAL_SEC 10 // Seconds - -/* Maximum Retry Count for accept a JOIN request. */ -#define JOIN_MAX_RETRY_FAILURE_COUNT 2 // Times - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef enum _ENUM_AA_STATE_T { - AA_STATE_IDLE = 0, - SAA_STATE_SEND_AUTH1, - SAA_STATE_WAIT_AUTH2, - SAA_STATE_SEND_AUTH3, - SAA_STATE_WAIT_AUTH4, - SAA_STATE_SEND_ASSOC1, - SAA_STATE_WAIT_ASSOC2, - AAA_STATE_SEND_AUTH2, - AAA_STATE_SEND_AUTH4, // We may not use, because P2P GO didn't support WEP and 11r - AAA_STATE_SEND_ASSOC2, - AA_STATE_RESOURCE, // A state for debugging the case of out of msg buffer. - AA_STATE_NUM -} ENUM_AA_STATE_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Routines in saa_fsm.c */ -/*----------------------------------------------------------------------------*/ -VOID -saaFsmSteps ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN ENUM_AA_STATE_T eNextState, - IN P_SW_RFB_T prRetainedSwRfb - ); - -WLAN_STATUS -saaFsmSendEventJoinComplete ( - IN P_ADAPTER_T prAdapter, - WLAN_STATUS rJoinStatus, - P_STA_RECORD_T prStaRec, - P_SW_RFB_T prSwRfb - ); - -VOID -saaFsmRunEventStart ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -WLAN_STATUS -saaFsmRunEventTxDone ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - -VOID -saaFsmRunEventTxReqTimeOut ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -VOID -saaFsmRunEventRxRespTimeOut ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -VOID -saaFsmRunEventRxAuth ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -WLAN_STATUS -saaFsmRunEventRxAssoc ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -WLAN_STATUS -saaFsmRunEventRxDeauth ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -WLAN_STATUS -saaFsmRunEventRxDisassoc ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -VOID -saaFsmRunEventAbort ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -/*----------------------------------------------------------------------------*/ -/* Routines in aaa_fsm.c */ -/*----------------------------------------------------------------------------*/ -VOID -aaaFsmRunEventRxAuth ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -WLAN_STATUS -aaaFsmRunEventRxAssoc ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -WLAN_STATUS -aaaFsmRunEventTxDone ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _AA_FSM_H */ - - - - diff --git a/drivers/net/wireless/mt5931/include/mgmt/ais_fsm.h b/drivers/net/wireless/mt5931/include/mgmt/ais_fsm.h deleted file mode 100755 index b153256ed6f3..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/ais_fsm.h +++ /dev/null @@ -1,680 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/ais_fsm.h#1 $ -*/ - -/*! \file ais_fsm.h - \brief Declaration of functions and finite state machine for AIS Module. - - Declaration of functions and finite state machine for AIS Module. -*/ - - - -/* -** $Log: ais_fsm.h $ - * - * 11 22 2011 cp.wu - * [WCXRP00001120] [MT6620 Wi-Fi][Driver] Modify roaming to AIS state transition from synchronous to asynchronous approach to avoid incomplete state termination - * 1. change RDD related compile option brace position. - * 2. when roaming is triggered, ask AIS to transit immediately only when AIS is in Normal TR state without join timeout timer ticking - * 3. otherwise, insert AIS_REQUEST into pending request queue - * - * 04 25 2011 cp.wu - * [WCXRP00000676] [MT6620 Wi-Fi][Driver] AIS to reduce request channel period from 5 seconds to 2 seconds - * channel interval for joining is shortened to 2 seconds to avoid interruption of concurrent operating network. - * - * 02 26 2011 tsaiyuan.hsu - * [WCXRP00000391] [MT6620 Wi-Fi][FW] Add Roaming Support - * not send disassoc or deauth to leaving AP so as to improve performace of roaming. - * - * 02 22 2011 cp.wu - * [WCXRP00000487] [MT6620 Wi-Fi][Driver][AIS] Serve scan and connect request with a queue-based approach to improve response time for scanning request - * handle SCAN and RECONNECT with a FIFO approach. - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * - * 01 14 2011 cp.wu - * [WCXRP00000359] [MT6620 Wi-Fi][Driver] add an extra state to ensure DEAUTH frame is always sent - * Add an extra state to guarantee DEAUTH frame is sent then connect to new BSS. - * This change is due to WAPI AP needs DEAUTH frame as a necessary step in handshaking protocol. - * - * 11 25 2010 cp.wu - * [WCXRP00000208] [MT6620 Wi-Fi][Driver] Add scanning with specified SSID to AIS FSM - * add scanning with specified SSID facility to AIS-FSM - * - * 11 01 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module - * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead - * 2) Remove CNM CH-RECOVER event handling - * 3) cfg read/write API renamed with kal prefix for unified naming rules. - * - * 09 06 2010 cp.wu - * NULL - * 1) initialize for correct parameter even for disassociation. - * 2) AIS-FSM should have a limit on trials to build connection - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 25 2010 cp.wu - * NULL - * [AIS-FSM] IBSS no longer needs to acquire channel for beaconing, RLM/CNM will handle the channel switching when BSS information is updated - * - * 08 12 2010 kevin.huang - * NULL - * Refine bssProcessProbeRequest() and bssSendBeaconProbeResponse() - * - * 08 12 2010 cp.wu - * NULL - * [AIS-FSM] honor registry setting for adhoc running mode. (A/B/G) - * - * 08 03 2010 cp.wu - * NULL - * surpress compilation warning. - * - * 07 30 2010 cp.wu - * NULL - * 1) BoW wrapper: use definitions instead of hard-coded constant for error code - * 2) AIS-FSM: eliminate use of desired RF parameters, use prTargetBssDesc instead - * 3) add handling for RX_PKT_DESTINATION_HOST_WITH_FORWARD for GO-broadcast frames - * - * 07 26 2010 cp.wu - * - * AIS-FSM: when scan request is coming in the 1st 5 seconds of channel privilege period, just pend it til 5-sec. period finishes - * - * 07 26 2010 cp.wu - * - * AIS-FSM FIX: return channel privilege even when the privilege is not granted yet - * QM: qmGetFrameAction() won't assert when corresponding STA-REC index is not found - * - * 07 23 2010 cp.wu - * - * add AIS-FSM handling for beacon timeout event. - * - * 07 21 2010 cp.wu - * - * separate AIS-FSM states into different cases of channel request. - * - * 07 21 2010 cp.wu - * - * 1) change BG_SCAN to ONLINE_SCAN for consistent term - * 2) only clear scanning result when scan is permitted to do - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * Add Ad-Hoc support to AIS-FSM - * - * 07 14 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * Refine AIS-FSM by divided into more states - * - * 07 09 2010 cp.wu - * - * 1) separate AIS_FSM state for two kinds of scanning. (OID triggered scan, and scan-for-connection) - * 2) eliminate PRE_BSS_DESC_T, Beacon/PrebResp is now parsed in single pass - * 3) implment DRV-SCN module, currently only accepts single scan request, other request will be directly dropped by returning BUSY - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * AIS-FSM integration with CNM channel request messages - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * implementation of DRV-SCN and related mailbox message handling. - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add buildable & linkable ais_fsm.c - * - * related reference are still waiting to be resolved - * - * 06 09 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add definitions for module migration. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add aa_fsm.h, ais_fsm.h, bss.h, mib.h and scan.h. - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 04 23 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * reduce the backgroud ssid idle time min and max value - * - * 04 19 2010 kevin.huang - * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support - * Add Beacon Timeout Support - * * and will send Null frame to diagnose connection - * - * 03 16 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add AdHoc Mode - * - * 03 10 2010 kevin.huang - * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support - * - * * Add Channel Manager for arbitration of JOIN and SCAN Req - * - * 02 26 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Remove CFG_TEST_VIRTUAL_CMD and add support of Driver STA_RECORD_T activation - * - * 02 23 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Support dynamic channel selection - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * 01 11 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add Deauth and Disassoc Handler - * - * 01 07 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add Media disconnect indication and related postpone functions - * - * Dec 3 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add aisFsmRunEventJoinComplete() - * - * Nov 25 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add Virtual CMD & RESP for testing CMD PATH - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * add aisFsmInitializeConnectionSettings() - * - * Nov 20 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add CFG_TEST_MGMT_FSM for aisFsmTest() - * - * Nov 18 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add function prototype of aisFsmInit() - * - * Nov 16 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -*/ - -#ifndef _AIS_FSM_H -#define _AIS_FSM_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define AIS_BG_SCAN_INTERVAL_MIN_SEC 2 //30 // exponential to 960 -#define AIS_BG_SCAN_INTERVAL_MAX_SEC 2 //960 // 16min - -#define AIS_DELAY_TIME_OF_DISCONNECT_SEC 10 - -#define AIS_IBSS_ALONE_TIMEOUT_SEC 20 // seconds - -#define AIS_BEACON_TIMEOUT_COUNT_ADHOC 30 -#define AIS_BEACON_TIMEOUT_COUNT_INFRA 10 -#define AIS_BEACON_TIMEOUT_GUARD_TIME_SEC 1 /* Second */ - -#define AIS_BEACON_MAX_TIMEOUT_TU 100 -#define AIS_BEACON_MIN_TIMEOUT_TU 5 -#define AIS_BEACON_MAX_TIMEOUT_VALID TRUE -#define AIS_BEACON_MIN_TIMEOUT_VALID TRUE - -#define AIS_BMC_MAX_TIMEOUT_TU 100 -#define AIS_BMC_MIN_TIMEOUT_TU 5 -#define AIS_BMC_MAX_TIMEOUT_VALID TRUE -#define AIS_BMC_MIN_TIMEOUT_VALID TRUE - -#define AIS_JOIN_CH_GRANT_THRESHOLD 10 -#define AIS_JOIN_CH_REQUEST_INTERVAL 2000 - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef enum _ENUM_AIS_STATE_T { - AIS_STATE_IDLE = 0, - AIS_STATE_SEARCH, - AIS_STATE_SCAN, - AIS_STATE_ONLINE_SCAN, - AIS_STATE_LOOKING_FOR, - AIS_STATE_WAIT_FOR_NEXT_SCAN, - AIS_STATE_REQ_CHANNEL_JOIN, - AIS_STATE_JOIN, - AIS_STATE_IBSS_ALONE, - AIS_STATE_IBSS_MERGE, - AIS_STATE_NORMAL_TR, - AIS_STATE_DISCONNECTING, - AIS_STATE_NUM -} ENUM_AIS_STATE_T; - - -typedef struct _MSG_AIS_ABORT_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 ucReasonOfDisconnect; - BOOLEAN fgDelayIndication; -} MSG_AIS_ABORT_T, *P_MSG_AIS_ABORT_T; - - -typedef struct _MSG_AIS_IBSS_PEER_FOUND_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 ucNetTypeIndex; - BOOLEAN fgIsMergeIn; /* TRUE: Merge In, FALSE: Merge Out */ - P_STA_RECORD_T prStaRec; -} MSG_AIS_IBSS_PEER_FOUND_T, *P_MSG_AIS_IBSS_PEER_FOUND_T; - -typedef enum _ENUM_AIS_REQUEST_TYPE_T { - AIS_REQUEST_SCAN, - AIS_REQUEST_RECONNECT, - AIS_REQUEST_ROAMING_SEARCH, - AIS_REQUEST_ROAMING_CONNECT, - AIS_REQUEST_NUM -} ENUM_AIS_REQUEST_TYPE_T; - -typedef struct _AIS_REQ_HDR_T { - LINK_ENTRY_T rLinkEntry; - ENUM_AIS_REQUEST_TYPE_T eReqType; -} AIS_REQ_HDR_T, *P_AIS_REQ_HDR_T; - - -typedef struct _AIS_FSM_INFO_T { - ENUM_AIS_STATE_T ePreviousState; - ENUM_AIS_STATE_T eCurrentState; - - BOOLEAN fgTryScan; - - BOOLEAN fgIsInfraChannelFinished; - BOOLEAN fgIsChannelRequested; - BOOLEAN fgIsChannelGranted; - -#if CFG_SUPPORT_ROAMING - BOOLEAN fgIsRoamingScanPending; -#endif /* CFG_SUPPORT_ROAMING */ - - UINT_8 ucAvailableAuthTypes; /* Used for AUTH_MODE_AUTO_SWITCH */ - - P_BSS_DESC_T prTargetBssDesc; /* For destination */ - - P_STA_RECORD_T prTargetStaRec; /* For JOIN Abort */ - - UINT_32 u4SleepInterval; - - TIMER_T rBGScanTimer; - - TIMER_T rIbssAloneTimer; - - TIMER_T rIndicationOfDisconnectTimer; - - TIMER_T rJoinTimeoutTimer; - - UINT_8 ucSeqNumOfReqMsg; - UINT_8 ucSeqNumOfChReq; - UINT_8 ucSeqNumOfScanReq; - - UINT_32 u4ChGrantedInterval; - - UINT_8 ucConnTrialCount; - - UINT_8 ucScanSSIDLen; - UINT_8 aucScanSSID[ELEM_MAX_LEN_SSID]; - - UINT_32 u4ScanIELength; - UINT_8 aucScanIEBuf[MAX_IE_LENGTH]; - - /* Pending Request List */ - LINK_T rPendingReqList; - -} AIS_FSM_INFO_T, *P_AIS_FSM_INFO_T; - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#define aisChangeMediaState(_prAdapter, _eNewMediaState) \ - (_prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX].eConnectionState = (_eNewMediaState)); - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -VOID -aisInitializeConnectionSettings ( - IN P_ADAPTER_T prAdapter, - IN P_REG_INFO_T prRegInfo - ); - -VOID -aisFsmInit ( - IN P_ADAPTER_T prAdapter - ); - -VOID -aisFsmUninit ( - IN P_ADAPTER_T prAdapter - ); - -VOID -aisFsmStateInit_JOIN ( - IN P_ADAPTER_T prAdapter, - P_BSS_DESC_T prBssDesc - ); - -BOOLEAN -aisFsmStateInit_RetryJOIN ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -VOID -aisFsmStateInit_IBSS_ALONE ( - IN P_ADAPTER_T prAdapter - ); - -VOID -aisFsmStateInit_IBSS_MERGE ( - IN P_ADAPTER_T prAdapter, - P_BSS_DESC_T prBssDesc - ); - -VOID -aisFsmStateAbort ( - IN P_ADAPTER_T prAdapter, - UINT_8 ucReasonOfDisconnect, - BOOLEAN fgDelayIndication - ); - -VOID -aisFsmStateAbort_JOIN ( - IN P_ADAPTER_T prAdapter - ); - -VOID -aisFsmStateAbort_SCAN ( - IN P_ADAPTER_T prAdapter - ); - -VOID -aisFsmStateAbort_NORMAL_TR ( - IN P_ADAPTER_T prAdapter - ); - -VOID -aisFsmStateAbort_IBSS ( - IN P_ADAPTER_T prAdapter - ); - -VOID -aisFsmSteps ( - IN P_ADAPTER_T prAdapter, - ENUM_AIS_STATE_T eNextState - ); - -/*----------------------------------------------------------------------------*/ -/* Mailbox Message Handling */ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmRunEventScanDone ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -aisFsmRunEventAbort ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -aisFsmRunEventJoinComplete ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -aisFsmRunEventFoundIBSSPeer ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -/*----------------------------------------------------------------------------*/ -/* Handling for Ad-Hoc Network */ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmCreateIBSS ( - IN P_ADAPTER_T prAdapter - ); - -VOID -aisFsmMergeIBSS ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -/*----------------------------------------------------------------------------*/ -/* Handling of Incoming Mailbox Message from CNM */ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmRunEventChGrant ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - - -/*----------------------------------------------------------------------------*/ -/* Generating Outgoing Mailbox Message to CNM */ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmReleaseCh ( - IN P_ADAPTER_T prAdapter - ); - - -/*----------------------------------------------------------------------------*/ -/* Event Indication */ -/*----------------------------------------------------------------------------*/ -VOID -aisIndicationOfMediaStateToHost ( - IN P_ADAPTER_T prAdapter, - ENUM_PARAM_MEDIA_STATE_T eConnectionState, - BOOLEAN fgDelayIndication - ); - -VOID -aisPostponedEventOfDisconnTimeout ( - IN P_ADAPTER_T prAdapter, - UINT_32 u4Param - ); - -VOID -aisUpdateBssInfoForJOIN ( - IN P_ADAPTER_T prAdapter, - P_STA_RECORD_T prStaRec, - P_SW_RFB_T prAssocRspSwRfb - ); - -VOID -aisUpdateBssInfoForCreateIBSS ( - IN P_ADAPTER_T prAdapter - ); - -VOID -aisUpdateBssInfoForMergeIBSS ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -BOOLEAN -aisValidateProbeReq ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_32 pu4ControlFlags - ); - -/*----------------------------------------------------------------------------*/ -/* Disconnection Handling */ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmDisconnect ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgDelayIndication - ); - - -/*----------------------------------------------------------------------------*/ -/* Event Handling */ -/*----------------------------------------------------------------------------*/ -VOID -aisBssBeaconTimeout ( - IN P_ADAPTER_T prAdapter - ); - -WLAN_STATUS -aisDeauthXmitComplete ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - -#if CFG_SUPPORT_ROAMING -VOID -aisFsmRunEventRoamingDiscovery ( - IN P_ADAPTER_T prAdapter, - UINT_32 u4ReqScan - ); - -ENUM_AIS_STATE_T -aisFsmRoamingScanResultsUpdate ( - IN P_ADAPTER_T prAdapter - ); - -VOID -aisFsmRoamingDisconnectPrevAP ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prTargetStaRec - ); - -VOID -aisUpdateBssInfoForRoamingAP ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prAssocRspSwRfb - ); -#endif /*CFG_SUPPORT_ROAMING */ - -/*----------------------------------------------------------------------------*/ -/* Timeout Handling */ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmRunEventBGSleepTimeOut ( - IN P_ADAPTER_T prAdapter, - UINT_32 u4Param - ); - -VOID -aisFsmRunEventIbssAloneTimeOut ( - IN P_ADAPTER_T prAdapter, - UINT_32 u4Param - ); - -VOID -aisFsmRunEventJoinTimeout ( - IN P_ADAPTER_T prAdapter, - UINT_32 u4Param - ); - -/*----------------------------------------------------------------------------*/ -/* OID/IOCTL Handling */ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmScanRequest ( - IN P_ADAPTER_T prAdapter, - IN P_PARAM_SSID_T prSsid, - IN PUINT_8 pucIe, - IN UINT_32 u4IeLength - ); - -/*----------------------------------------------------------------------------*/ -/* Internal State Checking */ -/*----------------------------------------------------------------------------*/ -BOOLEAN -aisFsmIsRequestPending ( - IN P_ADAPTER_T prAdapter, - IN ENUM_AIS_REQUEST_TYPE_T eReqType, - IN BOOLEAN bRemove - ); - -P_AIS_REQ_HDR_T -aisFsmGetNextRequest ( - IN P_ADAPTER_T prAdapter - ); - -BOOLEAN -aisFsmInsertRequest ( - IN P_ADAPTER_T prAdapter, - IN ENUM_AIS_REQUEST_TYPE_T eReqType - ); - -VOID -aisFsmFlushRequest ( - IN P_ADAPTER_T prAdapter - ); - - -#if defined(CFG_TEST_MGMT_FSM) && (CFG_TEST_MGMT_FSM != 0) -VOID -aisTest ( - VOID - ); -#endif /* CFG_TEST_MGMT_FSM */ -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _AIS_FSM_H */ - - - - diff --git a/drivers/net/wireless/mt5931/include/mgmt/assoc.h b/drivers/net/wireless/mt5931/include/mgmt/assoc.h deleted file mode 100755 index 1dbb06e73f1c..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/assoc.h +++ /dev/null @@ -1,147 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/assoc.h#1 $ -*/ - -/*! \file assoc.h - \brief This file contains the ASSOC REQ/RESP of - IEEE 802.11 family for MediaTek 802.11 Wireless LAN Adapters. -*/ - - - -/* -** $Log: assoc.h $ - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 17 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Add assocCheckTxReAssocRespFrame() proto type for P2P usage. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add buildable & linkable ais_fsm.c - * - * related reference are still waiting to be resolved - * -*/ - -#ifndef _ASSOC_H -#define _ASSOC_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Routines in assoc.c */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -assocSendReAssocReqFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -WLAN_STATUS -assocCheckTxReAssocReqFrame ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -WLAN_STATUS -assocCheckTxReAssocRespFrame( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -WLAN_STATUS -assocCheckRxReAssocRspFrameStatus ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_16 pu2StatusCode - ); - -WLAN_STATUS -assocSendDisAssocFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN UINT_16 u2ReasonCode - ); - -WLAN_STATUS -assocProcessRxDisassocFrame ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN UINT_8 aucBSSID[], - OUT PUINT_16 pu2ReasonCode - ); - -WLAN_STATUS -assocProcessRxAssocReqFrame ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_16 pu2StatusCode - ); - -WLAN_STATUS -assocSendReAssocRespFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _ASSOC_H */ - diff --git a/drivers/net/wireless/mt5931/include/mgmt/auth.h b/drivers/net/wireless/mt5931/include/mgmt/auth.h deleted file mode 100755 index 6a8bf18b063b..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/auth.h +++ /dev/null @@ -1,175 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/auth.h#1 $ -*/ - -/*! \file auth.h - \brief This file contains the authentication REQ/RESP of - IEEE 802.11 family for MediaTek 802.11 Wireless LAN Adapters. -*/ - - - -/* -** $Log: auth.h $ - * - * 04 21 2011 terry.wu - * [WCXRP00000674] [MT6620 Wi-Fi][Driver] Refine AAA authSendAuthFrame - * Add network type parameter to authSendAuthFrame. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add management dispatching function table. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * auth.c is migrated. - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add buildable & linkable ais_fsm.c - * - * related reference are still waiting to be resolved - * -*/ - -#ifndef _AUTH_H -#define _AUTH_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Routines in auth.c */ -/*----------------------------------------------------------------------------*/ -VOID -authAddIEChallengeText ( - IN P_ADAPTER_T prAdapter, - IN OUT P_MSDU_INFO_T prMsduInfo - ); - -#if !CFG_SUPPORT_AAA -WLAN_STATUS -authSendAuthFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN UINT_16 u2TransactionSeqNum - ); -#else -WLAN_STATUS -authSendAuthFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_SW_RFB_T prFalseAuthSwRfb, - IN UINT_16 u2TransactionSeqNum, - IN UINT_16 u2StatusCode - ); -#endif /* CFG_SUPPORT_AAA */ - -WLAN_STATUS -authCheckTxAuthFrame ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN UINT_16 u2TransactionSeqNum - ); - -WLAN_STATUS -authCheckRxAuthFrameTransSeq ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -WLAN_STATUS -authCheckRxAuthFrameStatus ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN UINT_16 u2TransactionSeqNum, - OUT PUINT_16 pu2StatusCode - ); - -VOID -authHandleIEChallengeText ( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb, - P_IE_HDR_T prIEHdr - ); - -WLAN_STATUS -authProcessRxAuth2_Auth4Frame ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -WLAN_STATUS -authSendDeauthFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prClassErrSwRfb, - IN UINT_16 u2ReasonCode, - IN PFN_TX_DONE_HANDLER pfTxDoneHandler - ); - -WLAN_STATUS -authProcessRxDeauthFrame ( - IN P_SW_RFB_T prSwRfb, - IN UINT_8 aucBSSID[], - OUT PUINT_16 pu2ReasonCode - ); - -WLAN_STATUS -authProcessRxAuth1Frame ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN UINT_8 aucExpectedBSSID[], - IN UINT_16 u2ExpectedAuthAlgNum, - IN UINT_16 u2ExpectedTransSeqNum, - OUT PUINT_16 pu2ReturnStatusCode - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _AUTH_H */ - diff --git a/drivers/net/wireless/mt5931/include/mgmt/bow_fsm.h b/drivers/net/wireless/mt5931/include/mgmt/bow_fsm.h deleted file mode 100755 index 2e63f9131163..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/bow_fsm.h +++ /dev/null @@ -1,190 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/bow_fsm.h#1 $ -*/ - -/*! \file bow_fsm.h - \brief Declaration of functions and finite state machine for BOW Module. - - Declaration of functions and finite state machine for BOW Module. -*/ - - - -/* -** $Log: bow_fsm.h $ - * - * 05 22 2011 terry.wu - * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment - * Submit missing BoW header files. - * - * 03 27 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Support multiple physical link. - * - * 02 16 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add bowNotifyAllLinkDisconnected interface and change channel grant procedure for bow starting.. - * - * 02 15 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add channel previledge into _BOW_FSM_INFO_T. - * - * 09 16 2010 chinghwa.yu - * NULL - * update bowChangeMediaState. - * - * 08 24 2010 chinghwa.yu - * NULL - * Update BOW for the 1st time. - */ - -#ifndef _BOW_FSM_H -#define _BOW_FSM_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -#define BOW_BG_SCAN_INTERVAL_MIN_SEC 2 //30 // exponential to 960 -#define BOW_BG_SCAN_INTERVAL_MAX_SEC 2 //960 // 16min - -#define BOW_DELAY_TIME_OF_DISCONNECT_SEC 10 - -#define BOW_BEACON_TIMEOUT_COUNT_STARTING 10 -#define BOW_BEACON_TIMEOUT_GUARD_TIME_SEC 1 /* Second */ - -#define BOW_BEACON_MAX_TIMEOUT_TU 100 -#define BOW_BEACON_MIN_TIMEOUT_TU 5 -#define BOW_BEACON_MAX_TIMEOUT_VALID TRUE -#define BOW_BEACON_MIN_TIMEOUT_VALID TRUE - -#define BOW_BMC_MAX_TIMEOUT_TU 100 -#define BOW_BMC_MIN_TIMEOUT_TU 5 -#define BOW_BMC_MAX_TIMEOUT_VALID TRUE -#define BOW_BMC_MIN_TIMEOUT_VALID TRUE - -#define BOW_JOIN_CH_GRANT_THRESHOLD 10 -#define BOW_JOIN_CH_REQUEST_INTERVAL 2000 - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -typedef enum _ENUM_BOW_STATE_T { - BOW_STATE_IDLE = 0, - BOW_STATE_SEARCH, - BOW_STATE_SCAN, - BOW_STATE_ONLINE_SCAN, - BOW_STATE_LOOKING_FOR, - BOW_STATE_WAIT_FOR_NEXT_SCAN, - BOW_STATE_REQ_CHANNEL_JOIN, - BOW_STATE_REQ_CHANNEL_ALONE, - BOW_STATE_REQ_CHANNEL_MERGE, - BOW_STATE_JOIN, - BOW_STATE_IBSS_ALONE, - BOW_STATE_IBSS_MERGE, - BOW_STATE_NORMAL_TR, - BOW_STATE_NUM -} ENUM_BOW_STATE_T; - -typedef struct _BOW_FSM_INFO_T { - ENUM_BOW_STATE_T ePreviousState; - ENUM_BOW_STATE_T eCurrentState; - - BOOLEAN fgTryScan; - - /* Channel Privilege */ - - BOOLEAN fgIsInfraChannelFinished; - BOOLEAN fgIsChannelRequested; - BOOLEAN fgIsChannelGranted; - BOOLEAN fgIsScanPending; - UINT_32 u4ChGrantedInterval; - - - UINT_8 ucPrimaryChannel; - ENUM_BAND_T eBand; - UINT_16 u2BeaconInterval; - - ENUM_BOW_STATE_T eReturnState; /* Return state after current activity finished or abort. */ - ENUM_BOW_STATE_T eForwardState; /* Step to next state if ACTION frame is TX successfully. */ - - P_BSS_DESC_T prTargetBss; /* BSS of target P2P Device. For Connection/Service Discovery */ - - P_STA_RECORD_T prTargetStaRec; - P_BSS_DESC_T prTargetBssDesc; /* For destination */ - - UINT_8 aucPeerAddress[6]; - - UINT_8 ucRole; - - BOOLEAN fgSupportQoS; - - BOOLEAN fgIsRsponseProbe; /* Indicate if BOW can response probe request frame. */ - - /* Sequence number of requested message. */ - UINT_8 ucSeqNumOfChReq; - UINT_8 ucSeqNumOfReqMsg; - UINT_8 ucSeqNumOfScnMsg; - UINT_8 ucSeqNumOfScanReq; - - UINT_8 ucSeqNumOfCancelMsg; - - UINT_8 ucDialogToken; - - /* Timer */ - TIMER_T rStartingBeaconTimer; /* For device discovery time of each discovery request from user.*/ - TIMER_T rStartingDiscoveryTimer; - TIMER_T rOperationListenTimer; /* For Find phase under operational state. */ - TIMER_T rFSMTimer; /* A timer used for Action frame timeout usage. */ - TIMER_T rIndicationOfDisconnectTimer; - TIMER_T rChGrantedTimer; - - UINT_8 ucAvailableAuthTypes; /* Used for AUTH_MODE_AUTO_SWITCH */ - -} BOW_FSM_INFO_T, *P_BOW_FSM_INFO_T; - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -#define bowChangeMediaState(_prAdapter, _eNewMediaState) \ - (_prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX].eConnectionState = (_eNewMediaState)); - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - - - -#endif diff --git a/drivers/net/wireless/mt5931/include/mgmt/bss.h b/drivers/net/wireless/mt5931/include/mgmt/bss.h deleted file mode 100755 index b7ff943c2763..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/bss.h +++ /dev/null @@ -1,353 +0,0 @@ -/* -** $Id: @(#) bss.h -*/ - -/*! \file "bss.h" - \brief In this file we define the function prototype used in BSS/IBSS. - - The file contains the function declarations and defines for used in BSS/IBSS. -*/ - - - -/* -** $Log: bss.h $ - * - * 07 17 2012 yuche.tsai - * NULL - * Let netdev bring up. - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 09 14 2011 yuche.tsai - * NULL - * Add P2P IE in assoc response. - * - * 03 19 2011 yuche.tsai - * [WCXRP00000581] [Volunteer Patch][MT6620][Driver] P2P IE in Assoc Req Issue - * Make assoc req to append P2P IE if wifi direct is enabled. - * - * 03 02 2011 wh.su - * [WCXRP00000448] [MT6620 Wi-Fi][Driver] Fixed WSC IE not send out at probe request - * Add code to send beacon and probe response WSC IE at Auto GO. - * - * 02 23 2011 eddie.chen - * [WCXRP00000463] [MT6620 Wi-Fi][FW/Driver][Hotspot] Cannot update WMM PS STA's partital bitmap - * Fix parsing WMM INFO and bmp delivery bitmap definition. - * - * 01 31 2011 george.huang - * [WCXRP00000333] [MT5931][FW] support SRAM power control drivers - * Extend TIM PVB, from 2 to 3 octets. - * - * 11 29 2010 cp.wu - * [WCXRP00000210] [MT6620 Wi-Fi][Driver][FW] Set RCPI value in STA_REC for initial TX rate selection of auto-rate algorithm - * update ucRcpi of STA_RECORD_T for AIS when - * 1) Beacons for IBSS merge is received - * 2) Associate Response for a connecting peer is received - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 12 2010 kevin.huang - * NULL - * Update bssProcessProbeRequest() and bssSendBeaconProbeResponse() declarations - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * when IBSS is being merged-in, send command packet to PM for connected indication - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 25 2010 george.huang - * [WPD00001556]Basic power managemenet function - * Create beacon update path, with expose bssUpdateBeaconContent() - * - * 06 17 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Add CTRL FLAGS for Probe Response. - * - * 06 09 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add necessary changes to driver data paths. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add aa_fsm.h, ais_fsm.h, bss.h, mib.h and scan.h. - * - * 06 04 2010 george.huang - * [BORA00000678][MT6620]WiFi LP integration - * [PM] Support U-APSD for STA mode - * - * 05 28 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add ClientList handling API - bssClearClientList, bssAddStaRecToClientList - * - * 05 14 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Remove unused typedef. - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Fix file merge error - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 04 19 2010 kevin.huang - * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support - * Add Beacon Timeout Support - * * * and will send Null frame to diagnose connection - * - * 03 16 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add AdHoc Mode - * - * 02 23 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add DTIM count update while TX Beacon - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup -*/ - -#ifndef _BSS_H -#define _BSS_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -//NOTE(Kevin): change define for george -//#define MAX_LEN_TIM_PARTIAL_BMP (((MAX_ASSOC_ID + 1) + 7) / 8) /* Required bits = (MAX_ASSOC_ID + 1) */ -#define MAX_LEN_TIM_PARTIAL_BMP ((CFG_STA_REC_NUM + 7) / 8) /* reserve length greater than maximum size of STA_REC */ //obsoleted: Assume we only use AID:1~15 - -/* CTRL FLAGS for Probe Response */ -#define BSS_PROBE_RESP_USE_P2P_DEV_ADDR BIT(0) -#define BSS_PROBE_RESP_INCLUDE_P2P_IE BIT(1) - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#define bssAssignAssocID(_prStaRec) ((_prStaRec)->ucIndex + 1) - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Routines for all Operation Modes */ -/*----------------------------------------------------------------------------*/ -P_STA_RECORD_T -bssCreateStaRecFromBssDesc ( - IN P_ADAPTER_T prAdapter, - IN ENUM_STA_TYPE_T eStaType, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_BSS_DESC_T prBssDesc - ); - -VOID -bssComposeNullFrame ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBuffer, - IN P_STA_RECORD_T prStaRec - ); - -VOID -bssComposeQoSNullFrame ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBuffer, - IN P_STA_RECORD_T prStaRec, - IN UINT_8 ucUP, - IN BOOLEAN fgSetEOSP - ); - -WLAN_STATUS -bssSendNullFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN PFN_TX_DONE_HANDLER pfTxDoneHandler - ); - -WLAN_STATUS -bssSendQoSNullFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN UINT_8 ucUP, - IN PFN_TX_DONE_HANDLER pfTxDoneHandler - ); - - -/*----------------------------------------------------------------------------*/ -/* Routines for both IBSS(AdHoc) and BSS(AP) */ -/*----------------------------------------------------------------------------*/ -VOID -bssGenerateExtSuppRate_IE ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -VOID -bssBuildBeaconProbeRespFrameCommonIEs ( - IN P_MSDU_INFO_T prMsduInfo, - IN P_BSS_INFO_T prBssInfo, - IN PUINT_8 pucDestAddr - ); - -VOID -bssComposeBeaconProbeRespFrameHeaderAndFF ( - IN PUINT_8 pucBuffer, - IN PUINT_8 pucDestAddr, - IN PUINT_8 pucOwnMACAddress, - IN PUINT_8 pucBSSID, - IN UINT_16 u2BeaconInterval, - IN UINT_16 u2CapInfo - ); - -WLAN_STATUS -bssSendBeaconProbeResponse ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN PUINT_8 pucDestAddr, - IN UINT_32 u4ControlFlags - ); - -WLAN_STATUS -bssProcessProbeRequest ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -VOID -bssClearClientList ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo - ); - -VOID -bssAddStaRecToClientList ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo, - IN P_STA_RECORD_T prStaRec - ); - -VOID -bssRemoveStaRecFromClientList ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo, - IN P_STA_RECORD_T prStaRec - ); - - -/*----------------------------------------------------------------------------*/ -/* Routines for IBSS(AdHoc) only */ -/*----------------------------------------------------------------------------*/ -VOID -ibssProcessMatchedBeacon ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo, - IN P_BSS_DESC_T prBssDesc, - IN UINT_8 ucRCPI - ); - -WLAN_STATUS -ibssCheckCapabilityForAdHocMode ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ); - -VOID -ibssInitForAdHoc ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo - ); - -WLAN_STATUS -bssUpdateBeaconContent ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ); - - -/*----------------------------------------------------------------------------*/ -/* Routines for BSS(AP) only */ -/*----------------------------------------------------------------------------*/ -VOID -bssInitForAP ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo, - IN BOOLEAN fgIsRateUpdate - ); - -VOID -bssUpdateDTIMCount ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ); - -VOID -bssSetTIMBitmap ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo, - IN UINT_16 u2AssocId - ); - - -/*link function to p2p module for txBcnIETable*/ - -/* WMM-2.2.2 WMM ACI to AC coding */ -typedef enum _ENUM_ACI_T { - ACI_BE = 0, - ACI_BK = 1, - ACI_VI = 2, - ACI_VO = 3, - ACI_NUM -} ENUM_ACI_T, *P_ENUM_ACI_T; - -typedef enum _ENUM_AC_PRIORITY_T { - AC_BK_PRIORITY = 0, - AC_BE_PRIORITY, - AC_VI_PRIORITY, - AC_VO_PRIORITY -} ENUM_AC_PRIORITY_T, *P_ENUM_AC_PRIORITY_T; - - -#endif /* _BSS_H */ - diff --git a/drivers/net/wireless/mt5931/include/mgmt/cnm.h b/drivers/net/wireless/mt5931/include/mgmt/cnm.h deleted file mode 100755 index ec41a1155427..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/cnm.h +++ /dev/null @@ -1,323 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/cnm.h#1 $ -*/ - -/*! \file "cnm.h" - \brief -*/ - - - -/* -** $Log: cnm.h $ - * - * 06 23 2011 cp.wu - * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module - * change parameter name from PeerAddr to BSSID - * - * 06 20 2011 cp.wu - * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module - * 1. specify target's BSSID when requesting channel privilege. - * 2. pass BSSID information to firmware domain - * - * 04 12 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * . - * - * 03 10 2011 cm.chang - * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module - * Add some functions to let AIS/Tethering or AIS/BOW be the same channel - * - * 01 12 2011 cm.chang - * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module - * Provide function to decide if BSS can be activated or not - * - * 12 07 2010 cm.chang - * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk - * 1. BSSINFO include RLM parameter - * 2. free all sta records when network is disconnected - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 07 19 2010 cm.chang - * - * Set RLM parameters and enable CNM channel manager - * - * 07 13 2010 cm.chang - * - * Rename MSG_CH_RELEASE_T to MSG_CH_ABORT_T - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Rename MID_MNY_CNM_CH_RELEASE to MID_MNY_CNM_CH_ABORT - * - * 07 01 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Need bandwidth info when requesting channel privilege - * - * 07 01 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Modify CNM message handler for new flow - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 05 05 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add a new function to send abort message - * - * 03 16 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add AdHoc Mode - * - * 03 10 2010 kevin.huang - * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support - * Add Channel Manager for arbitration of JOIN and SCAN Req - * - * 02 08 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support partial part about cmd basic configuration - * - * Nov 18 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add prototype of cnmFsmEventInit() - * - * Nov 2 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -** -*/ - -#ifndef _CNM_H -#define _CNM_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -typedef enum _ENUM_CH_REQ_TYPE_T { - CH_REQ_TYPE_JOIN, - CH_REQ_TYPE_P2P_LISTEN, - - CH_REQ_TYPE_NUM -} ENUM_CH_REQ_TYPE_T, *P_ENUM_CH_REQ_TYPE_T; - -typedef struct _MSG_CH_REQ_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 ucNetTypeIndex; - UINT_8 ucTokenID; - UINT_8 ucPrimaryChannel; - ENUM_CHNL_EXT_T eRfSco; - ENUM_BAND_T eRfBand; - ENUM_CH_REQ_TYPE_T eReqType; - UINT_32 u4MaxInterval; /* In unit of ms */ - UINT_8 aucBSSID[6]; - UINT_8 aucReserved[2]; -} MSG_CH_REQ_T, *P_MSG_CH_REQ_T; - -typedef struct _MSG_CH_ABORT_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 ucNetTypeIndex; - UINT_8 ucTokenID; -} MSG_CH_ABORT_T, *P_MSG_CH_ABORT_T; - -typedef struct _MSG_CH_GRANT_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 ucNetTypeIndex; - UINT_8 ucTokenID; - UINT_8 ucPrimaryChannel; - ENUM_CHNL_EXT_T eRfSco; - ENUM_BAND_T eRfBand; - ENUM_CH_REQ_TYPE_T eReqType; - UINT_32 u4GrantInterval; /* In unit of ms */ -} MSG_CH_GRANT_T, *P_MSG_CH_GRANT_T; - -typedef struct _MSG_CH_REOCVER_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 ucNetTypeIndex; - UINT_8 ucTokenID; - UINT_8 ucPrimaryChannel; - ENUM_CHNL_EXT_T eRfSco; - ENUM_BAND_T eRfBand; - ENUM_CH_REQ_TYPE_T eReqType; -} MSG_CH_RECOVER_T, *P_MSG_CH_RECOVER_T; - - -typedef struct _CNM_INFO_T { - UINT_32 u4Reserved; -} CNM_INFO_T, *P_CNM_INFO_T; - -#if CFG_ENABLE_WIFI_DIRECT -/* Moved from p2p_fsm.h */ -typedef struct _DEVICE_TYPE_T { - UINT_16 u2CategoryId; /* Category ID */ - UINT_8 aucOui[4]; /* OUI */ - UINT_16 u2SubCategoryId; /* Sub Category ID */ -} __KAL_ATTRIB_PACKED__ DEVICE_TYPE_T, *P_DEVICE_TYPE_T; -#endif - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -VOID -cnmInit ( - P_ADAPTER_T prAdapter - ); - -VOID -cnmUninit ( - P_ADAPTER_T prAdapter - ); - -VOID -cnmChMngrRequestPrivilege ( - P_ADAPTER_T prAdapter, - P_MSG_HDR_T prMsgHdr - ); - -VOID -cnmChMngrAbortPrivilege ( - P_ADAPTER_T prAdapter, - P_MSG_HDR_T prMsgHdr - ); - -VOID -cnmChMngrHandleChEvent ( - P_ADAPTER_T prAdapter, - P_WIFI_EVENT_T prEvent - ); - -BOOLEAN -cnmPreferredChannel ( - P_ADAPTER_T prAdapter, - P_ENUM_BAND_T prBand, - PUINT_8 pucPrimaryChannel, - P_ENUM_CHNL_EXT_T prBssSCO - ); - -BOOLEAN -cnmAisInfraChannelFixed ( - P_ADAPTER_T prAdapter, - P_ENUM_BAND_T prBand, - PUINT_8 pucPrimaryChannel - ); - -VOID -cnmAisInfraConnectNotify ( - P_ADAPTER_T prAdapter - ); - -BOOLEAN -cnmAisIbssIsPermitted ( - P_ADAPTER_T prAdapter - ); - -BOOLEAN -cnmP2PIsPermitted ( - P_ADAPTER_T prAdapter - ); - -BOOLEAN -cnmBowIsPermitted ( - P_ADAPTER_T prAdapter - ); - -BOOLEAN -cnmBss40mBwPermitted ( - P_ADAPTER_T prAdapter, - ENUM_NETWORK_TYPE_INDEX_T eNetTypeIdx - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#ifndef _lint -/* We don't have to call following function to inspect the data structure. - * It will check automatically while at compile time. - * We'll need this to guarantee the same member order in different structures - * to simply handling effort in some functions. - */ -__KAL_INLINE__ VOID -cnmMsgDataTypeCheck ( - VOID - ) -{ - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSG_CH_GRANT_T,rMsgHdr) == 0); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSG_CH_GRANT_T,rMsgHdr) == - OFFSET_OF(MSG_CH_RECOVER_T,rMsgHdr)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSG_CH_GRANT_T,ucNetTypeIndex) == - OFFSET_OF(MSG_CH_RECOVER_T,ucNetTypeIndex)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSG_CH_GRANT_T,ucTokenID) == - OFFSET_OF(MSG_CH_RECOVER_T,ucTokenID)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSG_CH_GRANT_T,ucPrimaryChannel) == - OFFSET_OF(MSG_CH_RECOVER_T,ucPrimaryChannel)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSG_CH_GRANT_T,eRfSco) == - OFFSET_OF(MSG_CH_RECOVER_T,eRfSco)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSG_CH_GRANT_T,eRfBand) == - OFFSET_OF(MSG_CH_RECOVER_T,eRfBand)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSG_CH_GRANT_T,eReqType) == - OFFSET_OF(MSG_CH_RECOVER_T,eReqType)); - - return; -} -#endif /* _lint */ - -#endif /* _CNM_H */ - - diff --git a/drivers/net/wireless/mt5931/include/mgmt/cnm_mem.h b/drivers/net/wireless/mt5931/include/mgmt/cnm_mem.h deleted file mode 100755 index ae08428153e1..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/cnm_mem.h +++ /dev/null @@ -1,1159 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/cnm_mem.h#1 $ -*/ - -/*! \file "cnm_mem.h" - \brief In this file we define the structure of the control unit of - packet buffer and MGT/MSG Memory Buffer. -*/ - - - -/* -** $Log: cnm_mem.h $ - * - * 03 02 2012 terry.wu - * NULL - * Snc CFG80211 modification for ICS migration from branch 2.2. - * - * 01 05 2012 tsaiyuan.hsu - * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v - * add timing measurement support for 802.11v. - * - * 03 17 2011 yuche.tsai - * NULL - * Resize the Secondary Device Type array when WiFi Direct is enabled. - * - * 03 16 2011 wh.su - * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done - * enable the protected while at P2P start GO, and skip some security check . - * - * 01 26 2011 cm.chang - * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument - * . - * - * 01 11 2011 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, - -Add per station flow control when STA is in PS - - - * Add per STA flow control when STA is in PS mode - * - * 12 29 2010 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, -Add per station flow control when STA is in PS - - * 1) PS flow control event - * - * 2) WMM IE in beacon, assoc resp, probe resp - * - * 12 23 2010 george.huang - * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function - * 1. update WMM IE parsing, with ASSOC REQ handling - * 2. extend U-APSD parameter passing from driver to FW - * - * 12 07 2010 cm.chang - * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk - * 1. BSSINFO include RLM parameter - * 2. free all sta records when network is disconnected - * - * 11 29 2010 cm.chang - * [WCXRP00000210] [MT6620 Wi-Fi][Driver][FW] Set RCPI value in STA_REC for initial TX rate selection of auto-rate algorithm - * Sync RCPI of STA_REC to FW as reference of initial TX rate - * - * 10 18 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * 1. remove redundant variables in STA_REC structure - * 2. add STA-REC uninitialization routine for clearing pending events - * - * 09 21 2010 kevin.huang - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * Eliminate Linux Compile Warning - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 07 12 2010 cp.wu - * - * SAA will take a record for tracking request sequence number. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 07 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Support state of STA record change from 1 to 1 - * - * 07 01 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Support sync command of STA_REC - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * modify some code for concurrent network. - * - * 06 21 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Fix compile error for P2P related defination. - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 17 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Add P2P related fields. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * saa_fsm.c is migrated. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * restore utility function invoking via hem_mbox to direct calls - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add buildable & linkable ais_fsm.c - * - * related reference are still waiting to be resolved - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * hem_mbox is migrated. - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add hem_mbox.c and cnm_mem.h (but disabled some feature) for further migration - * - * 06 04 2010 george.huang - * [BORA00000678][MT6620]WiFi LP integration - * [BORA00000678] [MT6620]WiFi LP integration - * 1. add u8TimeStamp in MSDU_INFO - * 2. move fgIsRxTSFUpdated/fgIsTxTSFUpdated from static to BSS_INFO - * 3. add new member for supporting PM in STA_RECORD, which is for AP PS mode - * - * 05 31 2010 yarco.yang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add RX TSF Log Feature and ADDBA Rsp with DECLINE handling - * - * 05 28 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support checking of duplicated buffer free - * - * 05 28 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Move define of STA_REC_NUM to config.h and rename to CFG_STA_REC_NUM - * - * 05 21 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Refine txmInitWtblTxRateTable() - set TX initial rate according to AP's operation rate set - * - * 05 19 2010 yarco.yang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Fixed MAC RX Desc be overwritten issue - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 05 10 2010 yarco.yang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support Rx header translation for A-MSDU subframe - * - * 05 07 2010 george.huang - * [BORA00000678][MT6620]WiFi LP integration - * add more sanity check about setting timer - * - * 04 29 2010 george.huang - * [BORA00000678][MT6620]WiFi LP integration - * modify the compiling flag for RAM usage - * - * 04 28 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * Modified some MQM-related data structures (SN counter, TX/RX BA table) - * - * 04 27 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * Added new TX/RX BA tables in STA_REC - * - * 04 19 2010 kevin.huang - * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support - * Add Beacon Timeout Support and will send Null frame to diagnose connection - * - * 04 09 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * [BORA00000644] WiFi phase 4 integration - * Added per-TID SN cache in STA_REC - * - * 03 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support power control - * - * 03 16 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add AdHoc Mode - * - * 03 11 2010 yuche.tsai - * [BORA00000343][MT6620] Emulation For TX - * . - * - * 03 05 2010 yarco.yang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Remove Emulation definition - * - * 03 04 2010 cp.wu - * [BORA00000368]Integrate HIF part into BORA - * eliminate HIF_EMULATION in cnm_mem.h - * - * 03 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add cnmStaRecChangeState() declaration. - * - * 03 03 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Remove compiling warning for some emulation flags - * - * 03 03 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * move the AIS specific variable for security to AIS specific structure. - * - * 03 03 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * Fixed the pre-authentication timer not correctly init issue, and modify the security related callback function prototype. - * - * 03 01 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * To store field AMPDU Parameters in STA_REC - * - * 02 26 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Added fgIsWmmSupported in STA_RECORD_T. - * - * 02 26 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Added fgIsUapsdSupported in STA_RECORD_T - * - * 02 13 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Added arTspecTable in STA_REC for TSPEC management - * - * 02 12 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Enable mgmt buffer debug by default - * - * 02 12 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Added BUFFER_SOURCE_BCN - * - * 02 10 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Renamed MSDU_INFO.ucFixedRateIndex as MSDU_INFO.ucFixedRateCode - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * 02 02 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Added SN info in MSDU_INFO_T - * - * 01 27 2010 wh.su - * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code - * add and fixed some security function. - * - * 01 11 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add Deauth and Disassoc Handler - * - * 01 08 2010 cp.wu - * [BORA00000368]Integrate HIF part into BORA - * 1) separate wifi_var_emu.c/.h from wifi_var.c/.h - * 2) eliminate HIF_EMULATION code sections appeared in wifi_var/cnm_mem - * 3) use cnmMemAlloc() instead to allocate SRAM buffer - * - * 12 31 2009 cp.wu - * [BORA00000368]Integrate HIF part into BORA - * 1) surpress debug message emitted from hal_hif.c - * 2) add two set of field for recording buffer process time - * - * 12 31 2009 cp.wu - * [BORA00000368]Integrate HIF part into BORA - * 1. move wifi task initialization from wifi_task.c(rom) to wifi_init.c (TCM) for integrating F/W download later - * * * * * 2. WIFI_Event_Dispatcher() prototype changed to return to suspend mode from normal operation mode - * * * * * 2. HIF emulation logic revised - * - * 12 29 2009 yuche.tsai - * [BORA00000343][MT6620] Emulation For TX - * .Using global buffer declaring by SD1 instead of using another one. - * - * 12 25 2009 tehuang.liu - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Integrated modifications for 1st connection (mainly on FW modules MQM, TXM, and RXM) - * * MQM: BA handling - * * TXM: Macros updates - * * RXM: Macros/Duplicate Removal updates - * - * 12 24 2009 yarco.yang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * 12 23 2009 cp.wu - * [BORA00000368]Integrate HIF part into BORA - * allocating SRAM for emulation purpose by ruducing MEM_BANK3_BUF_SZ - * - * 12 21 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Remove individual DATA_BUF_BLOCK_NUM definition for emulation compiling flagsu1rwduu`wvpghlqg|fh+fmdkb - * - * 12 21 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support several data buffer banks. - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * .For new FPGA memory size - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * 12 17 2009 george.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * Dec 17 2009 MTK02468 - * [BORA00000337] To check in codes for FPGA emulation - * Modified the DATA_BLOCK_SIZE from 1620 to 2048 - * - * Dec 16 2009 mtk01426 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add CFG_TEST_SEC_EMULATION flag - * - * Dec 9 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add HT cap to sta record - * - * Dec 9 2009 mtk02752 - * [BORA00000368] Integrate HIF part into BORA - * add cnmDataPktFree() for emulation loopback purpose - * - * Dec 8 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * add the buffer for key handshake 1x and cmd key order issue - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * move the tx call back function proto type to typedef.h - * - * Dec 3 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add cnmGetStaRecByAddress() and modify variable in STA_RECORD_T - * - * Dec 1 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * rename the port block flag - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add variables to STA_RECORD_T for assoc/auth - * - * Nov 23 2009 mtk02468 - * [BORA00000337] To check in codes for FPGA emulation - * Fixed the value of STA_WAIT_QUEUE_NUM (from 7 to 5) - * - * Nov 20 2009 mtk02468 - * [BORA00000337] To check in codes for FPGA emulation - * Removed u2FrameLength from SW_RFB - * - * Nov 20 2009 mtk02468 - * [BORA00000337] To check in codes for FPGA emulation - * Fixed indenting - * - * Nov 20 2009 mtk02468 - * [BORA00000337] To check in codes for FPGA emulation - * Updated MSDU_INFO and SW_RFB - * - * Nov 19 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * update the variable for security - * - * Nov 18 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * remove the variable to make the compiler ok - * - * Nov 18 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * add the variable for security module - * - * Nov 16 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix typo in define of MSG_BUF_BLOCK_SIZE - * - * Nov 13 2009 mtk02468 - * [BORA00000337] To check in codes for FPGA emulation - * Let typedef STA_REC_T precede typedef MSDU_INFO_T and SW_RFB_T - * - * Nov 13 2009 mtk02468 - * [BORA00000337] To check in codes for FPGA emulation - * Modified MSDU_INFO and STA_REC for TXM and MQM - * - * Nov 12 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Rename STA_REC_T to STA_RECORD_T and add ucIndex member - * - * Nov 9 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Make sure ucBufferSource the same offset in MSDU_INFO and SW_RFB - * - * Nov 6 2009 mtk01426 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * - * - * Nov 5 2009 mtk01426 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * - * - * Nov 5 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Update comment - * - * Oct 30 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add draft content of MSDU_INFO_T and SW_RFB_T - * - * Oct 30 2009 mtk01084 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * - * - * Oct 28 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * - * - * Oct 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix lint warning - * - * Oct 21 2009 mtk01426 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add CFG_TEST_RX_EMULATION flag - * - * Oct 20 2009 mtk01426 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * - * - * Oct 9 2009 mtk02468 - * [BORA00000337] To check in codes for FPGA emulation - * Added field ucTC to MSDU_INFO_T and field pucHifRxPacket to SW_RFB_T - * - * Oct 8 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -** -*/ - -#ifndef _CNM_MEM_H -#define _CNM_MEM_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -#ifndef POWER_OF_2 -#define POWER_OF_2(n) BIT(n) -#endif - -/* Size of a basic management buffer block in power of 2 */ -#define MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2 7 /* 7 to the power of 2 = 128 */ -#define MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2 5 /* 5 to the power of 2 = 32 */ - -/* Size of a basic management buffer block */ -#define MGT_BUF_BLOCK_SIZE POWER_OF_2(MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2) -#define MSG_BUF_BLOCK_SIZE POWER_OF_2(MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2) - -/* Total size of (n) basic management buffer blocks */ -#define MGT_BUF_BLOCKS_SIZE(n) ((UINT_32)(n) << MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2) -#define MSG_BUF_BLOCKS_SIZE(n) ((UINT_32)(n) << MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2) - -/* Number of management buffer block */ -#define MAX_NUM_OF_BUF_BLOCKS 32 /* Range: 1~32 */ - -/* Size of overall management frame buffer */ -#define MGT_BUFFER_SIZE (MAX_NUM_OF_BUF_BLOCKS * MGT_BUF_BLOCK_SIZE) -#define MSG_BUFFER_SIZE (MAX_NUM_OF_BUF_BLOCKS * MSG_BUF_BLOCK_SIZE) - - -/* STA_REC related definitions */ -#define STA_REC_INDEX_BMCAST 0xFF -#define STA_REC_INDEX_NOT_FOUND 0xFE -#define STA_WAIT_QUEUE_NUM 5 /* Number of SW queues in each STA_REC: AC0~AC4 */ -#define SC_CACHE_INDEX_NUM 5 /* Number of SC caches in each STA_REC: AC0~AC4 */ - - -/* P2P related definitions */ -#ifdef CFG_ENABLE_WIFI_DIRECT -/* Moved from p2p_fsm.h */ -#define WPS_ATTRI_MAX_LEN_DEVICE_NAME 32 /* 0x1011 */ -#define P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT 8 /* NOTE(Kevin): Shall <= 16 */ -#endif - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -#if ((MAX_NUM_OF_BUF_BLOCKS > 32) || (MAX_NUM_OF_BUF_BLOCKS <= 0)) - #error > #define MAX_NUM_OF_MGT_BUF_BLOCKS : Out of boundary ! -#elif MAX_NUM_OF_BUF_BLOCKS > 16 - typedef UINT_32 BUF_BITMAP; -#elif MAX_NUM_OF_BUF_BLOCKS > 8 - typedef UINT_16 BUF_BITMAP; -#else - typedef UINT_8 BUF_BITMAP; -#endif /* MAX_NUM_OF_MGT_BUF_BLOCKS */ - - -/* Control variable of TX management memory pool */ -typedef struct _BUF_INFO_T { - PUINT_8 pucBuf; - -#if CFG_DBG_MGT_BUF - UINT_32 u4AllocCount; - UINT_32 u4FreeCount; - UINT_32 u4AllocNullCount; -#endif /* CFG_DBG_MGT_BUF */ - - BUF_BITMAP rFreeBlocksBitmap; - UINT_8 aucAllocatedBlockNum[MAX_NUM_OF_BUF_BLOCKS]; -} BUF_INFO_T, *P_BUF_INFO_T; - - -/* Wi-Fi divides RAM into three types - * MSG: Mailbox message (Small size) - * BUF: HW DMA buffers (HIF/MAC) - */ -typedef enum _ENUM_RAM_TYPE_T { - RAM_TYPE_MSG = 0, - RAM_TYPE_BUF -} ENUM_RAM_TYPE_T, P_ENUM_RAM_TYPE_T; - -typedef enum _ENUM_BUFFER_SOURCE_T { - BUFFER_SOURCE_HIF_TX0 =0, - BUFFER_SOURCE_HIF_TX1, - BUFFER_SOURCE_MAC_RX, - BUFFER_SOURCE_MNG, - BUFFER_SOURCE_BCN, - BUFFER_SOURCE_NUM -} ENUM_BUFFER_SOURCE_T, *P_ENUM_BUFFER_SOURCE_T; - - -typedef enum _ENUM_SEC_STATE_T { - SEC_STATE_INIT, - SEC_STATE_INITIATOR_PORT_BLOCKED, - SEC_STATE_RESPONDER_PORT_BLOCKED, - SEC_STATE_CHECK_OK, - SEC_STATE_SEND_EAPOL, - SEC_STATE_SEND_DEAUTH, - SEC_STATE_COUNTERMEASURE, - SEC_STATE_NUM -} ENUM_SEC_STATE_T; - -typedef struct _TSPEC_ENTRY_T { - UINT_8 ucStatus; - UINT_8 ucToken; /* Dialog Token in ADDTS_REQ or ADDTS_RSP */ - UINT_16 u2MediumTime; - UINT_32 u4TsInfo; - //PARAM_QOS_TS_INFO rParamTsInfo; - /* Add other retained QoS parameters below */ -} TSPEC_ENTRY_T, *P_TSPEC_ENTRY_T, TSPEC_TABLE_ENTRY_T, *P_TSPEC_TABLE_ENTRY_T; - -typedef struct _SEC_INFO_T { - - ENUM_SEC_STATE_T ePreviousState; - ENUM_SEC_STATE_T eCurrentState; - - BOOL fg2nd1xSend; - BOOL fgKeyStored; - - UINT_8 aucStoredKey[64]; - - BOOL fgAllowOnly1x; -} SEC_INFO_T, *P_SEC_INFO_T; - -#define MAX_NUM_CONCURRENT_FRAGMENTED_MSDUS 3 - -#define UPDATE_BSS_RSSI_INTERVAL_SEC 3 // Seconds - -/* Fragment information structure */ -typedef struct _FRAG_INFO_T { - UINT_16 u2NextFragSeqCtrl; - PUINT_8 pucNextFragStart; - P_SW_RFB_T pr1stFrag; - OS_SYSTIME rReceiveLifetimeLimit; /* The receive time of 1st fragment */ -} FRAG_INFO_T, *P_FRAG_INFO_T; - - -/* Define STA record structure */ -struct _STA_RECORD_T { - LINK_ENTRY_T rLinkEntry; - UINT_8 ucIndex; /* Not modify it except initializing */ - - BOOLEAN fgIsInUse; /* Indicate if this entry is in use or not */ - UINT_8 aucMacAddr[MAC_ADDR_LEN]; /* MAC address */ - - /* SAA/AAA */ - ENUM_AA_STATE_T eAuthAssocState; /* Store STATE Value used in SAA/AAA */ - UINT_8 ucAuthAssocReqSeqNum; - - ENUM_STA_TYPE_T eStaType; /* Indicate the role of this STA in - * the network (for example, P2P GO) - */ - - UINT_8 ucNetTypeIndex; /* ENUM_NETWORK_TYPE_INDEX_T */ - - UINT_8 ucStaState; /* STATE_1,2,3 */ - - UINT_8 ucPhyTypeSet; /* Available PHY Type Set of this peer - * (may deduced from received BSS_DESC_T) - */ - UINT_8 ucDesiredPhyTypeSet; /* The match result by AND operation of peer's - * PhyTypeSet and ours. - */ - BOOLEAN fgHasBasicPhyType; /* A flag to indicate a Basic Phy Type which - * is used to generate some Phy Attribute IE - * (e.g. capability, MIB) during association. - */ - UINT_8 ucNonHTBasicPhyType; /* The Basic Phy Type choosen among the - * ucDesiredPhyTypeSet. - */ - - UINT_16 u2CapInfo; /* For Infra Mode, to store Capability Info. from Association Resp(SAA). - * For AP Mode, to store Capability Info. from Association Req(AAA). - */ - UINT_16 u2AssocId; /* For Infra Mode, to store AID from Association Resp(SAA). - * For AP Mode, to store the Assigned AID(AAA). - */ - - UINT_16 u2ListenInterval; /* Listen Interval from STA(AAA) */ - - UINT_16 u2DesiredNonHTRateSet; /* Our Current Desired Rate Set after - * match with STA's Operational Rate Set - */ - - UINT_16 u2OperationalRateSet; /* Operational Rate Set of peer BSS */ - UINT_16 u2BSSBasicRateSet; /* Basic Rate Set of peer BSS */ - - BOOLEAN fgIsMerging; /* For IBSS Mode, to indicate that Merge is ongoing */ - - BOOLEAN fgDiagnoseConnection; /* For Infra/AP Mode, to diagnose the Connection with - * this peer by sending ProbeReq/Null frame */ - - /*------------------------------------------------------------------------------------------*/ - /* 802.11n HT capabilities when (prStaRec->ucPhyTypeSet & PHY_TYPE_BIT_HT) is true */ - /* They have the same definition with fields of information element */ - /*------------------------------------------------------------------------------------------*/ - UINT_8 ucMcsSet; /* MCS0~7 rate set of peer BSS */ - BOOLEAN fgSupMcs32; /* MCS32 is supported by peer BSS */ - UINT_16 u2HtCapInfo; /* HT cap info field by HT cap IE */ - UINT_8 ucAmpduParam; /* Field A-MPDU Parameters in HT cap IE */ - UINT_16 u2HtExtendedCap; /* HT extended cap field by HT cap IE */ - UINT_32 u4TxBeamformingCap; /* TX beamforming cap field by HT cap IE */ - UINT_8 ucAselCap; /* ASEL cap field by HT cap IE */ - - UINT_8 ucRCPI; /* RCPI of peer */ - - UINT_8 ucDTIMPeriod; /* Target BSS's DTIM Period, we use this - * value for setup Listen Interval - * TODO(Kevin): TBD - */ - UINT_8 ucAuthAlgNum; /* For Infra/AP Mode, the Auth Alogrithm Num used in Authentication(SAA/AAA) */ - BOOLEAN fgIsReAssoc; /* For Infra/AP Mode, to indicate ReAssoc Frame was in used(SAA/AAA) */ - - UINT_8 ucTxAuthAssocRetryCount;/* For Infra Mode, the Retry Count of TX Auth/Assod Frame(SAA) */ - UINT_8 ucTxAuthAssocRetryLimit;/* For Infra Mode, the Retry Limit of TX Auth/Assod Frame(SAA) */ - - UINT_16 u2StatusCode; /* Status of Auth/Assoc Req */ - UINT_16 u2ReasonCode; /* Reason that been Deauth/Disassoc */ - - - P_IE_CHALLENGE_TEXT_T prChallengeText; /* Point to an allocated buffer for storing Challenge Text for Shared Key Authentication */ - - TIMER_T rTxReqDoneOrRxRespTimer;/* For Infra Mode, a timer used to send a timeout event - * while waiting for TX request done or RX response. - */ - - /*------------------------------------------------------------------------------------------*/ - /* Power Management related fields (for STA/ AP/ P2P/ BOW power saving mode) */ - /*------------------------------------------------------------------------------------------*/ - BOOLEAN fgSetPwrMgtBit; /* For Infra Mode, to indicate that outgoing frame need toggle - * the Pwr Mgt Bit in its Frame Control Field. - */ - - BOOLEAN fgIsInPS; /* For AP Mode, to indicate the client PS state(PM). - * TRUE: In PS Mode; FALSE: In Active Mode. */ - - BOOLEAN fgIsInPsPollSP; /* For Infra Mode, to indicate we've sent a PS POLL to AP and start - * the PS_POLL Service Period(LP) - */ - - BOOLEAN fgIsInTriggerSP; /* For Infra Mode, to indicate we've sent a Trigger Frame to AP and start - * the Delivery Service Period(LP) - */ - - UINT_8 ucBmpDeliveryAC; /* 0: AC0, 1: AC1, 2: AC2, 3: AC3 */ - - UINT_8 ucBmpTriggerAC; /* 0: AC0, 1: AC1, 2: AC2, 3: AC3 */ - - UINT_8 ucUapsdSp; /* Max SP length */ - - /*------------------------------------------------------------------------------------------*/ - - BOOLEAN fgIsRtsEnabled; - - OS_SYSTIME rUpdateTime; /* (4) System Timestamp of Successful TX and RX */ - - OS_SYSTIME rLastJoinTime; /* (4) System Timestamp of latest JOIN process */ - - UINT_8 ucJoinFailureCount; /* Retry Count of JOIN process */ - - LINK_T arStaWaitQueue[STA_WAIT_QUEUE_NUM]; /* For TXM to defer pkt forwarding to MAC TX DMA */ - - UINT_16 au2CachedSeqCtrl[TID_NUM + 1]; /* Duplicate removal for HT STA on a per-TID basis ("+1" is for MMPDU and non-QoS) */ - -#if 0 - /* RXM */ - P_RX_BA_ENTRY_T aprRxBaTable[TID_NUM]; - - /* TXM */ - P_TX_BA_ENTRY_T aprTxBaTable[TID_NUM]; -#endif - - FRAG_INFO_T rFragInfo[MAX_NUM_CONCURRENT_FRAGMENTED_MSDUS]; - - SEC_INFO_T rSecInfo; /* The security state machine */ - - BOOLEAN fgPortBlock; /* The 802.1x Port Control flag */ - - BOOLEAN fgTransmitKeyExist; /* Unicast key exist for this STA */ - - UINT_8 ucWTEntry; - - BOOLEAN fgTxAmpduEn; /* Enable TX AMPDU for this Peer */ - BOOLEAN fgRxAmpduEn; /* Enable RX AMPDU for this Peer */ - - PUINT_8 pucAssocReqIe; - UINT_16 u2AssocReqIeLen; - /*------------------------------------------------------------------------------------------*/ - /* WMM/QoS related fields */ - /*------------------------------------------------------------------------------------------*/ - BOOLEAN fgIsQoS; /* If the STA is associated as a QSTA or QAP (for TX/RX) */ - BOOLEAN fgIsWmmSupported; /* If the peer supports WMM, set to TRUE (for association)*/ - BOOLEAN fgIsUapsdSupported; /* Set according to the scan result (for association) */ - - /*------------------------------------------------------------------------------------------*/ - /* P2P related fields */ - /*------------------------------------------------------------------------------------------*/ -#if CFG_ENABLE_WIFI_DIRECT - UINT_8 u2DevNameLen; - UINT_8 aucDevName[WPS_ATTRI_MAX_LEN_DEVICE_NAME]; - - UINT_8 aucDevAddr[MAC_ADDR_LEN]; /* P2P Device Address */ - - UINT_16 u2ConfigMethods; - - UINT_8 ucDeviceCap; - - UINT_8 ucSecondaryDevTypeCount; - - DEVICE_TYPE_T rPrimaryDevTypeBE; - - DEVICE_TYPE_T arSecondaryDevTypeBE[P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT]; -#endif /* CFG_SUPPORT_P2P */ - - - /*------------------------------------------------------------------------------------------*/ - /* QM related fields */ - /*------------------------------------------------------------------------------------------*/ - - UINT_8 ucFreeQuota; /* Per Sta flow controal. Valid when fgIsInPS is TRUE. Chnage it for per Queue flow control */ - //UINT_8 aucFreeQuotaPerQueue[NUM_OF_PER_STA_TX_QUEUES]; /* used in future */ - UINT_8 ucFreeQuotaForDelivery; - UINT_8 ucFreeQuotaForNonDelivery; - -#if 1 - /*------------------------------------------------------------------------------------------*/ - /* To be removed, this is to make que_mgt compilation success only */ - /*------------------------------------------------------------------------------------------*/ - /* When this STA_REC is in use, set to TRUE. */ - BOOLEAN fgIsValid; - - /* Per-STA Queues: [0] AC0, [1] AC1, [2] AC2, [3] AC3, [4] 802.1x */ - QUE_T arTxQueue[NUM_OF_PER_STA_TX_QUEUES]; - - /* When this STA is in PS Mode, set to TRUE. */ - //BOOLEAN fgIsPS; - - /* When this STA enters Power-Saving, FW will notify the driver with a Session ID */ - UINT_8 ucPsSessionID; - - BOOLEAN fgIsAp; - - /* Reorder Parameter reference table */ - P_RX_BA_ENTRY_T aprRxReorderParamRefTbl[CFG_RX_MAX_BA_TID_NUM]; -#endif - -#if CFG_SUPPORT_802_11V_TIMING_MEASUREMENT - TIMINGMSMT_PARAM_T rWNMTimingMsmt; -#endif -}; - -#if 0 -/* use nic_tx.h instead */ -/* MSDU_INFO and SW_RFB structure */ -typedef struct _MSDU_INFO_T { - - //4 /* ----------------MSDU_INFO and SW_RFB Common Fields------------------ */ - - LINK_ENTRY_T rLinkEntry; - PUINT_8 pucBuffer; /* Pointer to the associated buffer */ - - UINT_8 ucBufferSource; /* HIF TX0, HIF TX1, MAC RX, or MNG Pool */ - UINT_8 ucNetworkTypeIndex; /* Network type index that this TX packet is assocaited with */ - UINT_8 ucTC; /* 0 to 5 (used by HIF TX to increment the corresponding TC counter) */ - UINT_8 ucTID; /* Traffic Identification */ - - BOOLEAN fgIs802_11Frame; /* Set to TRUE for 802.11 frame */ - UINT_8 ucMacHeaderLength; - UINT_16 u2PayloadLength; - PUINT_8 pucMacHeader; /* 802.11 header */ - PUINT_8 pucPayload; /* 802.11 payload */ - - OS_SYSTIME rArrivalTime; /* System Timestamp (4) */ - P_STA_RECORD_T prStaRec; - -#if CFG_PROFILE_BUFFER_TRACING - ENUM_BUFFER_ACTIVITY_TYPE_T eActivity[2]; - UINT_32 rActivityTime[2]; -#endif -#if DBG && CFG_BUFFER_FREE_CHK - BOOLEAN fgBufferInSource; -#endif - - UINT_8 ucControlFlag; /* For specify some Control Flags, e.g. Basic Rate */ - - //4 /* -----------------------Non-Common ------------------------- */ - /* TODO: move flags to ucControlFlag */ - - BOOLEAN fgIs1xFrame; /* Set to TRUE for 802.1x frame */ - - /* TXM: For TX Done handling, callback function & parameter (5) */ - BOOLEAN fgIsTxFailed; /* Set to TRUE if transmission failure */ - - PFN_TX_DONE_HANDLER pfTxDoneHandler; - - UINT_64 u8TimeStamp; /* record the TX timestamp */ - - /* TXM: For PS forwarding control (per-STA flow control) */ - UINT_8 ucPsForwardingType; /* Delivery-enabled, non-delivery-enabled, non-PS */ - UINT_8 ucPsSessionID; /* The Power Save session id for PS forwarding control*/ - - /* TXM: For MAC TX DMA operations */ - UINT_8 ucMacTxQueIdx; /* MAC TX queue: AC0-AC6, BCM, or BCN */ - BOOLEAN fgNoAck; /* Set to true if Ack is not requred for this packet */ - BOOLEAN fgBIP; /* Set to true if BIP is used for this packet */ - UINT_8 ucFragTotalCount; - UINT_8 ucFragFinishedCount; - UINT_16 u2FragThreshold; /* Fragmentation threshold without WLAN Header & FCS */ - BOOLEAN fgFixedRate; /* If a fixed rate is used, set to TRUE. */ - UINT_8 ucFixedRateCode; /* The rate code copied to MAC TX Desc */ - UINT_8 ucFixedRateRetryLimit; /* The retry limit when a fixed rate is used */ - BOOLEAN fgIsBmcQueueEnd; /* Set to true if this packet is the end of BMC */ - - /* TXM: For flushing ACL frames */ - UINT_16 u2PalLLH; /* 802.11 PAL LLH */ - //UINT_16 u2LLH; - UINT_16 u2ACLSeq; /* u2LLH+u2ACLSeq for AM HCI flush ACL frame */ - - /* TXM for retransmitting a flushed packet */ - BOOLEAN fgIsSnAssigned; - UINT_16 u2SequenceNumber; /* To remember the Sequence Control field of this MPDU */ - -} MSDU_INFO_T, *P_MSDU_INFO_T; -#endif - -#if 0 -/* nic_rx.h */ -typedef struct _SW_RFB_T { - - //4 /* ----------------MSDU_INFO and SW_RFB Common Fields------------------ */ - - LINK_ENTRY_T rLinkEntry; - PUINT_8 pucBuffer; /* Pointer to the associated buffer */ - - UINT_8 ucBufferSource; /* HIF TX0, HIF TX1, MAC RX, or MNG Pool */ - UINT_8 ucNetworkTypeIndex; /* Network type index that this TX packet is assocaited with */ - UINT_8 ucTC; /* 0 to 5 (used by HIF TX to increment the corresponding TC counter) */ - UINT_8 ucTID; /* Traffic Identification */ - - BOOLEAN fgIs802_11Frame; /* Set to TRUE for 802.11 frame */ - UINT_8 ucMacHeaderLength; - UINT_16 u2PayloadLength; - PUINT_8 pucMacHeader; /* 802.11 header */ - PUINT_8 pucPayload; /* 802.11 payload */ - - OS_SYSTIME rArrivalTime; /* System Timestamp (4) */ - P_STA_RECORD_T prStaRec; - -#if CFG_PROFILE_BUFFER_TRACING - ENUM_BUFFER_ACTIVITY_TYPE_T eActivity[2]; - UINT_32 rActivityTime[2]; -#endif -#if DBG && CFG_BUFFER_FREE_CHK - BOOLEAN fgBufferInSource; -#endif - - UINT_8 ucControlFlag; /* For specify some Control Flags, e.g. Basic Rate */ - - //4 /* -----------------------Non-Common ------------------------- */ - - /* For composing the HIF RX Header (TODO: move flags to ucControlFlag) */ - PUINT_8 pucHifRxPacket; /* Pointer to the Response packet to HIF RX0 or RX1 */ - UINT_16 u2HifRxPacketLength; - UINT_8 ucHeaderOffset; - UINT_8 ucHifRxPortIndex; - - UINT_16 u2SequenceControl; - BOOLEAN fgIsA4Frame; /* (For MAC RX packet parsing) set to TRUE if 4 addresses are present */ - BOOLEAN fgIsBAR; - BOOLEAN fgIsQoSData; - BOOLEAN fgIsAmsduSubframe; /* Set to TRUE for A-MSDU Subframe */ - - /* For HIF RX DMA Desc */ - BOOLEAN fgTUChecksumCheckRequired; - BOOLEAN fgIPChecksumCheckRequired; - UINT_8 ucEtherTypeOffset; - -} SW_RFB_T, *P_SW_RFB_T; -#endif - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -P_MSDU_INFO_T -cnmMgtPktAlloc ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Length - ); - -VOID -cnmMgtPktFree ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -VOID -cnmMemInit ( - IN P_ADAPTER_T prAdapter - ); - -PVOID -cnmMemAlloc ( - IN P_ADAPTER_T prAdapter, - IN ENUM_RAM_TYPE_T eRamType, - IN UINT_32 u4Length - ); - -VOID -cnmMemFree ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvMemory - ); - -VOID -cnmStaRecInit ( - IN P_ADAPTER_T prAdapter - ); - -VOID -cnmStaRecUninit ( - IN P_ADAPTER_T prAdapter - ); - -P_STA_RECORD_T -cnmStaRecAlloc ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucNetTypeIndex - ); - -VOID -cnmStaRecFree ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN BOOLEAN fgSyncToChip - ); - -VOID -cnmStaFreeAllStaByNetType ( - P_ADAPTER_T prAdapter, - ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - BOOLEAN fgSyncToChip - ); - -P_STA_RECORD_T -cnmGetStaRecByIndex ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucIndex - ); - -P_STA_RECORD_T -cnmGetStaRecByAddress ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucNetTypeIndex, - IN UINT_8 aucPeerMACAddress[] - ); - -VOID -cnmStaRecResetStatus ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ); - -VOID -cnmStaRecChangeState ( - IN P_ADAPTER_T prAdapter, - IN OUT P_STA_RECORD_T prStaRec, - IN UINT_8 ucNewState - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#ifndef _lint -/* Kevin: we don't have to call following function to inspect the data structure. - * It will check automatically while at compile time. - * We'll need this for porting driver to different RTOS. - */ -__KAL_INLINE__ VOID -cnmMemDataTypeCheck ( - VOID - ) -{ -#if 0 - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,rLinkEntry) == 0); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,rLinkEntry) == OFFSET_OF(SW_RFB_T,rLinkEntry)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,pucBuffer) == OFFSET_OF(SW_RFB_T,pucBuffer)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,ucBufferSource) == - OFFSET_OF(SW_RFB_T,ucBufferSource)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,pucMacHeader) == - OFFSET_OF(SW_RFB_T,pucMacHeader)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,ucMacHeaderLength) == - OFFSET_OF(SW_RFB_T,ucMacHeaderLength)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,pucPayload) == - OFFSET_OF(SW_RFB_T,pucPayload)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,u2PayloadLength) == - OFFSET_OF(SW_RFB_T,u2PayloadLength)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,prStaRec) == - OFFSET_OF(SW_RFB_T,prStaRec)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,ucNetworkTypeIndex) == - OFFSET_OF(SW_RFB_T,ucNetworkTypeIndex)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,ucTID) == - OFFSET_OF(SW_RFB_T,ucTID)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,fgIs802_11Frame) == - OFFSET_OF(SW_RFB_T,fgIs802_11Frame)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,ucControlFlag) == - OFFSET_OF(SW_RFB_T,ucControlFlag)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,rArrivalTime) == - OFFSET_OF(SW_RFB_T,rArrivalTime)); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,ucTC) == - OFFSET_OF(SW_RFB_T,ucTC)); - -#if CFG_PROFILE_BUFFER_TRACING - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,eActivity[0]) == - OFFSET_OF(SW_RFB_T,eActivity[0])); - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,rActivityTime[0]) == - OFFSET_OF(SW_RFB_T,rActivityTime[0])); -#endif - -#if DBG && CFG_BUFFER_FREE_CHK - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(MSDU_INFO_T,fgBufferInSource) == - OFFSET_OF(SW_RFB_T,fgBufferInSource)); -#endif - - - DATA_STRUC_INSPECTING_ASSERT( - OFFSET_OF(STA_RECORD_T,rLinkEntry) == 0); - - return; -#endif -} -#endif /* _lint */ - -#endif /* _CNM_MEM_H */ - - diff --git a/drivers/net/wireless/mt5931/include/mgmt/cnm_scan.h b/drivers/net/wireless/mt5931/include/mgmt/cnm_scan.h deleted file mode 100755 index b3d2993f801a..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/cnm_scan.h +++ /dev/null @@ -1,206 +0,0 @@ -/* -** $Id: @(#) -*/ - -/*! \file "cnm_scan.h" - \brief - -*/ - - - -/* -** $Log: cnm_scan.h $ - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 05 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * remove unused definitions. - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * implementation of DRV-SCN and related mailbox message handling. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge cnm_scan.h and hem_mbox.h - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 03 30 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support 2.4G OBSS scan - * - * 03 16 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add AdHoc Mode - * - * 03 10 2010 kevin.huang - * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support - * - * * * * Add Channel Manager for arbitration of JOIN and SCAN Req - * - * 02 23 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add support scan channel 1~14 and update scan result's frequency infou1rwduu`wvpghlqg|n`slk+mpdkb - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * Nov 18 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add function prototype of cnmScanInit() - * - * Nov 5 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -** -*/ - -#ifndef _CNM_SCAN_H -#define _CNM_SCAN_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define SCN_CHANNEL_DWELL_TIME_MIN_MSEC 12 -#define SCN_CHANNEL_DWELL_TIME_EXT_MSEC 98 - -#define SCN_TOTAL_PROBEREQ_NUM_FOR_FULL 3 -#define SCN_SPECIFIC_PROBEREQ_NUM_FOR_FULL 1 - -#define SCN_TOTAL_PROBEREQ_NUM_FOR_PARTIAL 2 -#define SCN_SPECIFIC_PROBEREQ_NUM_FOR_PARTIAL 1 - - -#define SCN_INTERLACED_CHANNEL_GROUPS_NUM 3 /* Used by partial scan */ - -#define SCN_PARTIAL_SCAN_NUM 3 - -#define SCN_PARTIAL_SCAN_IDLE_MSEC 100 - -#define MAXIMUM_OPERATION_CHANNEL_LIST 32 - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/* The type of Scan Source */ -typedef enum _ENUM_SCN_REQ_SOURCE_T { - SCN_REQ_SOURCE_HEM = 0, - SCN_REQ_SOURCE_NET_FSM, - SCN_REQ_SOURCE_ROAMING, /* ROAMING Module is independent of AIS FSM */ - SCN_REQ_SOURCE_OBSS, /* 2.4G OBSS scan */ - SCN_REQ_SOURCE_NUM -} ENUM_SCN_REQ_SOURCE_T, *P_ENUM_SCN_REQ_SOURCE_T; - -typedef enum _ENUM_SCAN_PROFILE_T { - SCAN_PROFILE_FULL = 0, - SCAN_PROFILE_PARTIAL, - SCAN_PROFILE_VOIP, - SCAN_PROFILE_FULL_2G4, - SCAN_PROFILE_NUM -} ENUM_SCAN_PROFILE_T, *P_ENUM_SCAN_PROFILE_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#if 0 -VOID -cnmScanInit ( - VOID - ); - -VOID -cnmScanRunEventScanRequest ( - IN P_MSG_HDR_T prMsgHdr - ); - -BOOLEAN -cnmScanRunEventScanAbort ( - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -cnmScanProfileSelection ( - VOID - ); - -VOID -cnmScanProcessStart ( - VOID - ); - -VOID -cnmScanProcessStop ( - VOID - ); - -VOID -cnmScanRunEventReqAISAbsDone ( - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -cnmScanRunEventCancelAISAbsDone ( - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -cnmScanPartialScanTimeout ( - UINT_32 u4Param - ); - -VOID -cnmScanRunEventScnFsmComplete ( - IN P_MSG_HDR_T prMsgHdr - ); -#endif - - - -#endif /* _CNM_SCAN_H */ - - diff --git a/drivers/net/wireless/mt5931/include/mgmt/cnm_timer.h b/drivers/net/wireless/mt5931/include/mgmt/cnm_timer.h deleted file mode 100755 index b1ed2c6456ad..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/cnm_timer.h +++ /dev/null @@ -1,274 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/cnm_timer.h#1 $ -*/ - -/*! \file cnm_timer.h - \brief Declaration of timer obj and related timer macro for setup time out - event. - - In this file we declare the timer object and provide several macro for - Protocol functional blocks to setup their own time out event. -*/ - - - -/* -** $Log: cnm_timer.h $ - * - * 12 13 2011 cm.chang - * [WCXRP00001136] [All Wi-Fi][Driver] Add wake lock for pending timer - * Add wake lock if timer timeout value is smaller than 5 seconds - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * cnm_timer has been migrated. - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add hem_mbox.c and cnm_mem.h (but disabled some feature) for further migration - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge cnm_scan.h and hem_mbox.h - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge wifi_var.h, precomp.h, cnm_timer.h (data type only) - * - * 06 04 2010 george.huang - * [BORA00000678][MT6620]WiFi LP integration - * [PM] Support U-APSD for STA mode - * - * 04 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Return timer token back to COS when entering wait off state - * - * 01 08 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support longer timeout interval to 45 days from 65secu1rwduu`wvpghlqg|fh+fmdkb - * - * 01 06 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Fix system time is 32KHz instead of 1ms - * - * Nov 23 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * add the copy time function - * - * Nov 5 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix LINT warnning - * - * Oct 28 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -** -*/ - -#ifndef _CNM_TIMER_H -#define _CNM_TIMER_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#undef MSEC_PER_SEC -#define MSEC_PER_SEC 1000 -#undef USEC_PER_MSEC -#define USEC_PER_MSEC 1000 -#define USEC_PER_TU 1024 /* microsecond */ - -#define MSEC_PER_MIN (60 * MSEC_PER_SEC) - - -#define MGMT_MAX_TIMEOUT_INTERVAL ((UINT_32)0x7fffffff) - -#define WAKE_LOCK_MAX_TIME 5 /* Unit: sec */ - -/* If WAKE_LOCK_MAX_TIME is too large, the whole system may always keep awake - * because of periodic timer of OBSS scanning - */ -#if (WAKE_LOCK_MAX_TIME >= OBSS_SCAN_MIN_INTERVAL) - #error WAKE_LOCK_MAX_TIME is too large -#endif - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef VOID (*PFN_MGMT_TIMEOUT_FUNC)(P_ADAPTER_T, UINT_32); - -typedef struct _TIMER_T { - LINK_ENTRY_T rLinkEntry; - OS_SYSTIME rExpiredSysTime; - UINT_16 u2Minutes; - UINT_16 u2Reserved; - UINT_32 u4Data; - PFN_MGMT_TIMEOUT_FUNC pfMgmtTimeOutFunc; -} TIMER_T, *P_TIMER_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -/* Check if time "a" is before time "b" */ -/* In 32-bit variable, 0x00000001~0x7fffffff -> positive number, - * 0x80000000~0xffffffff -> negative number - */ -#define TIME_BEFORE_64bit(a,b) (a < b) - -#define TIME_BEFORE(a,b) ((UINT_32)((UINT_32)(a) - (UINT_32)(b)) > 0x7fffffff) - -/* #define TIME_BEFORE(a,b) ((INT_32)((INT_32)(b) - (INT_32)(a)) > 0) - * may cause UNexpect result between Free build and Check build for WinCE - */ - -#define TIME_AFTER(a,b) TIME_BEFORE(b,a) - -#define SYSTIME_TO_SEC(_systime) ((_systime) / KAL_HZ) -#define SEC_TO_SYSTIME(_sec) ((_sec) * KAL_HZ) - - -/* The macros to convert second & millisecond */ -#define MSEC_TO_SEC(_msec) ((_msec) / MSEC_PER_SEC) -#define SEC_TO_MSEC(_sec) ((UINT_32)(_sec) * MSEC_PER_SEC) - - -/* The macros to convert millisecond & microsecond */ -#define USEC_TO_MSEC(_usec) ((_usec) / USEC_PER_MSEC) -#define MSEC_TO_USEC(_msec) ((UINT_32)(_msec) * USEC_PER_MSEC) - - -/* The macros to convert TU & microsecond, TU & millisecond */ -#define TU_TO_USEC(_tu) ((_tu) * USEC_PER_TU) -#define TU_TO_MSEC(_tu) USEC_TO_MSEC( TU_TO_USEC(_tu) ) - - -/* The macros to convert TU & & OS system time, round up by 0.5 */ -#define TU_TO_SYSTIME(_tu) MSEC_TO_SYSTIME( TU_TO_MSEC(_tu) ) -#define SYSTIME_TO_TU(_systime) \ - ((SYSTIME_TO_USEC(_systime) + ((USEC_PER_TU / 2) - 1)) / USEC_PER_TU) - - -/* The macros to convert OS system time & microsecond */ -#define SYSTIME_TO_USEC(_systime) (SYSTIME_TO_MSEC(_systime) * USEC_PER_MSEC) - - -/* The macro to get the current OS system time */ -#define GET_CURRENT_SYSTIME(_systime_p) {*(_systime_p) = kalGetTimeTick();} - -/* The macro to copy the system time */ -#define COPY_SYSTIME(_destTime, _srcTime) (_destTime) = (_srcTime) - -/* The macro to get the system time difference between t1 and t2 (t1 - t2) */ -/* #define GET_SYSTIME_DIFFERENCE(_time1, _time2, _diffTime) \ - (_diffTime) = (_time1) - (_time2) */ - -/* The macro to check for the expiration, if TRUE means _currentTime >= _expirationTime */ -#define CHECK_FOR_EXPIRATION(_currentTime, _expirationTime) \ - ( ((UINT_32)(_currentTime) - (UINT_32)(_expirationTime)) <= 0x7fffffffUL) - -/* The macro to check for the timeout */ -#define CHECK_FOR_TIMEOUT(_currentTime, _timeoutStartingTime, _timeout) \ - CHECK_FOR_EXPIRATION((_currentTime), ((_timeoutStartingTime) + (_timeout))) - -/* The macro to set the expiration time with a specified timeout *//* Watch out for round up.*/ -#define SET_EXPIRATION_TIME(_expirationTime, _timeout) \ - { \ - GET_CURRENT_SYSTIME(&(_expirationTime)); \ - (_expirationTime) += (OS_SYSTIME)(_timeout); \ - } - -#define timerRenewTimer(adapter,tmr,interval) \ - timerStartTimer(adapter,tmr,interval,(tmr)->function,(tmr)->data) - -#define MGMT_INIT_TIMER(_adapter_p, _timer, _callbackFunc) \ - timerInitTimer(_adapter_p, &(_timer), (UINT_32)(_callbackFunc)) - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -VOID -cnmTimerInitialize ( - IN P_ADAPTER_T prAdapter - ); - -VOID -cnmTimerDestroy ( - IN P_ADAPTER_T prAdapter - ); - -VOID -cnmTimerInitTimer ( - IN P_ADAPTER_T prAdapter, - IN P_TIMER_T prTimer, - IN PFN_MGMT_TIMEOUT_FUNC pfFunc, - IN UINT_32 u4Data - ); - -VOID -cnmTimerStopTimer ( - IN P_ADAPTER_T prAdapter, - IN P_TIMER_T prTimer - ); - -VOID -cnmTimerStartTimer ( - IN P_ADAPTER_T prAdapter, - IN P_TIMER_T prTimer, - IN UINT_32 u4TimeoutMs - ); - -VOID -cnmTimerDoTimeOutCheck ( - IN P_ADAPTER_T prAdapter - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -__KAL_INLINE__ -INT_32 -timerPendingTimer ( - IN P_TIMER_T prTimer - ) -{ - ASSERT(prTimer); - - return prTimer->rLinkEntry.prNext != NULL; -} - -#endif /* _CNM_TIMER_H */ - - diff --git a/drivers/net/wireless/mt5931/include/mgmt/hem_mbox.h b/drivers/net/wireless/mt5931/include/mgmt/hem_mbox.h deleted file mode 100755 index d01c9c211f87..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/hem_mbox.h +++ /dev/null @@ -1,441 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/hem_mbox.h#2 $ -*/ - -/*! \file hem_mbox.h - \brief - -*/ - - - -/* -** $Log: hem_mbox.h $ -** -** 07 26 2012 yuche.tsai -** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot -** Update driver code of ALPS.JB for hot-spot. -** -** 07 19 2012 yuche.tsai -** NULL -** Code update for JB. - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 07 18 2011 cp.wu - * [WCXRP00000858] [MT5931][Driver][Firmware] Add support for scan to search for more than one SSID in a single scanning request - * add framework in driver domain for supporting new SCAN_REQ_V2 for more than 1 SSID support as well as uProbeDelay in NDIS 6.x driver model - * - * 06 07 2011 yuche.tsai - * [WCXRP00000696] [Volunteer Patch][MT6620][Driver] Infinite loop issue when RX invitation response.[WCXRP00000763] [Volunteer Patch][MT6620][Driver] RX Service Discovery Frame under AP mode Issue - * Add invitation support. - * - * 06 02 2011 cp.wu - * [WCXRP00000681] [MT5931][Firmware] HIF code size reduction - * eliminate unused parameters for SAA-FSM - * - * 01 26 2011 cm.chang - * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument - * Allocate system RAM if fixed message or mgmt buffer is not available - * - * 11 08 2010 cm.chang - * [WCXRP00000169] [MT6620 Wi-Fi][Driver][FW] Remove unused CNM recover message ID - * Remove CNM channel reover message ID - * - * 09 16 2010 cm.chang - * NULL - * Remove unused message ID - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 30 2010 cp.wu - * NULL - * eliminate klockwork errors - * - * 08 25 2010 george.huang - * NULL - * update OID/ registry control path for PM related settings - * - * 08 23 2010 chinghwa.yu - * NULL - * Update for BOW. - * - * 08 16 2010 cp.wu - * NULL - * add interface for RLM to trigger OBSS-SCAN. - * - * 08 11 2010 yuche.tsai - * NULL - * Add some message ID for P2P FSM under provisioning phase. - * - * 08 11 2010 yuche.tsai - * NULL - * Add Message Event ID for P2P Module. - * - * 08 05 2010 yuche.tsai - * NULL - * Check-in P2P Device Discovery Feature. - * - * 08 04 2010 cp.wu - * NULL - * remove unused mailbox message definitions. - * - * 08 02 2010 yuche.tsai - * NULL - * P2P Group Negotiation Code Check in. - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * message table should not be commented out by compilation option without modifying header file - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Rename MID_MNY_CNM_CH_RELEASE to MID_MNY_CNM_CH_ABORT - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * AIS-FSM integration with CNM channel request messages - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * implementation of DRV-SCN and related mailbox message handling. - * - * 07 01 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Modify CNM message handler for new flow - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * restore utility function invoking via hem_mbox to direct calls - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * auth.c is migrated. - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add buildable & linkable ais_fsm.c - * - * related reference are still waiting to be resolved - * - * 06 09 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add definitions for module migration. - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * hem_mbox is migrated. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge cnm_scan.h and hem_mbox.h - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 04 29 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * Removed MID_RXM_MQM_QOS_ACTION_FRAME - * - * 04 29 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * Removed MID_RXM_MQM_BA_ACTION_FRAME - * - * 03 30 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support 2.4G OBSS scan - * - * 03 16 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add AdHoc Mode - * - * 03 10 2010 kevin.huang - * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support - * - * * * * * Add Channel Manager for arbitration of JOIN and SCAN Req - * - * 03 05 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Develop partial DPD code - * - * 02 11 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Added MID_RXM_MQM_QOS_ACTION_FRAME for RXM to indicate QoS Action frames to MQM - * - * 01 11 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add Deauth and Disassoc Handler - * - * Dec 7 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Rename the parameter of mboxDummy() - * - * Dec 2 2009 MTK02468 - * [BORA00000337] To check in codes for FPGA emulation - * Added MID_RXM_MQM_BA_ACTION_FRAME - * - * Nov 24 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Remove Dummy MSG ID - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add JOIN REQ related MSG ID - * - * Nov 16 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add AIS ABORT MSG ID - * - * Nov 5 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add SCN MSG IDs - * - * Oct 28 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -*/ - -#ifndef _HEM_MBOX_H -#define _HEM_MBOX_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/* Message IDs */ -typedef enum _ENUM_MSG_ID_T { - MID_MNY_CNM_CH_REQ, /* MANY notify CNM to obtain channel privilege */ - MID_MNY_CNM_CH_ABORT, /* MANY notify CNM to abort/release channel privilege */ - - MID_CNM_AIS_CH_GRANT, /* CNM notify AIS for indicating channel granted */ - MID_CNM_P2P_CH_GRANT, /* CNM notify P2P for indicating channel granted */ - MID_CNM_BOW_CH_GRANT, /* CNM notify BOW for indicating channel granted */ - - /*--------------------------------------------------*/ - /* SCN Module Mailbox Messages */ - /*--------------------------------------------------*/ - MID_AIS_SCN_SCAN_REQ, /* AIS notify SCN for starting scan */ - MID_AIS_SCN_SCAN_REQ_V2, /* AIS notify SCN for starting scan with multiple SSID support */ - MID_AIS_SCN_SCAN_CANCEL, /* AIS notify SCN for cancelling scan */ - MID_P2P_SCN_SCAN_REQ, /* P2P notify SCN for starting scan */ - MID_P2P_SCN_SCAN_REQ_V2, /* P2P notify SCN for starting scan with multiple SSID support */ - MID_P2P_SCN_SCAN_CANCEL, /* P2P notify SCN for cancelling scan */ - MID_BOW_SCN_SCAN_REQ, /* BOW notify SCN for starting scan */ - MID_BOW_SCN_SCAN_REQ_V2, /* BOW notify SCN for starting scan with multiple SSID support */ - MID_BOW_SCN_SCAN_CANCEL, /* BOW notify SCN for cancelling scan */ - MID_RLM_SCN_SCAN_REQ, /* RLM notify SCN for starting scan (OBSS-SCAN) */ - MID_RLM_SCN_SCAN_REQ_V2, /* RLM notify SCN for starting scan (OBSS-SCAN) with multiple SSID support */ - MID_RLM_SCN_SCAN_CANCEL, /* RLM notify SCN for cancelling scan (OBSS-SCAN)*/ - MID_SCN_AIS_SCAN_DONE, /* SCN notify AIS for scan completion */ - MID_SCN_P2P_SCAN_DONE, /* SCN notify P2P for scan completion */ - MID_SCN_BOW_SCAN_DONE, /* SCN notify BOW for scan completion */ - MID_SCN_RLM_SCAN_DONE, /* SCN notify RLM for scan completion (OBSS-SCAN) */ - - /*--------------------------------------------------*/ - /* AIS Module Mailbox Messages */ - /*--------------------------------------------------*/ - MID_OID_AIS_FSM_JOIN_REQ, /* OID/IOCTL notify AIS for join */ - MID_OID_AIS_FSM_ABORT, /* OID/IOCTL notify AIS for abort */ - MID_AIS_SAA_FSM_START, /* AIS notify SAA for Starting authentication/association fsm */ - MID_AIS_SAA_FSM_ABORT, /* AIS notify SAA for Aborting authentication/association fsm */ - MID_SAA_AIS_JOIN_COMPLETE, /* SAA notify AIS for indicating join complete */ - -#if CFG_ENABLE_BT_OVER_WIFI - /*--------------------------------------------------*/ - /* BOW Module Mailbox Messages */ - /*--------------------------------------------------*/ - MID_BOW_SAA_FSM_START, /* BOW notify SAA for Starting authentication/association fsm */ - MID_BOW_SAA_FSM_ABORT, /* BOW notify SAA for Aborting authentication/association fsm */ - MID_SAA_BOW_JOIN_COMPLETE, /* SAA notify BOW for indicating join complete */ -#endif - -#if CFG_ENABLE_WIFI_DIRECT - /*--------------------------------------------------*/ - /* P2P Module Mailbox Messages */ - /*--------------------------------------------------*/ - MID_P2P_SAA_FSM_START, /* P2P notify SAA for Starting authentication/association fsm */ - MID_P2P_SAA_FSM_ABORT, /* P2P notify SAA for Aborting authentication/association fsm */ - MID_SAA_P2P_JOIN_COMPLETE, /* SAA notify P2P for indicating join complete */ - - MID_MNY_P2P_FUN_SWITCH, /* Enable P2P FSM. */ - MID_MNY_P2P_DEVICE_DISCOVERY, /* Start device discovery. */ - MID_MNY_P2P_CONNECTION_REQ, /* Connection request. */ - MID_MNY_P2P_CONNECTION_ABORT, /* Abort connection request, P2P FSM return to IDLE. */ - MID_MNY_P2P_BEACON_UPDATE, - MID_MNY_P2P_STOP_AP, - MID_MNY_P2P_CHNL_REQ, - MID_MNY_P2P_CHNL_ABORT, - MID_MNY_P2P_MGMT_TX, - MID_MNY_P2P_GROUP_DISSOLVE, - MID_MNY_P2P_MGMT_FRAME_REGISTER, - MID_MNY_P2P_NET_DEV_REGISTER, - MID_MNY_P2P_START_AP, - MID_MNY_P2P_MGMT_FRAME_UPDATE, -#endif - -#if CFG_SUPPORT_ADHOC - MID_SCN_AIS_FOUND_IBSS, /* SCN notify AIS that an IBSS Peer has been found and can merge into */ -#endif /* CFG_SUPPORT_ADHOC */ - - MID_SAA_AIS_FSM_ABORT, /* SAA notify AIS for indicating deauthentication/disassociation */ - - MID_TOTAL_NUM -} ENUM_MSG_ID_T, *P_ENUM_MSG_ID_T; - -/* Message header of inter-components */ -struct _MSG_HDR_T { - LINK_ENTRY_T rLinkEntry; - ENUM_MSG_ID_T eMsgId; -}; - -typedef VOID (*PFN_MSG_HNDL_FUNC)(P_ADAPTER_T, P_MSG_HDR_T); - -typedef struct _MSG_HNDL_ENTRY { - ENUM_MSG_ID_T eMsgId; - PFN_MSG_HNDL_FUNC pfMsgHndl; -} MSG_HNDL_ENTRY_T, *P_MSG_HNDL_ENTRY_T; - -typedef enum _EUNM_MSG_SEND_METHOD_T { - MSG_SEND_METHOD_BUF = 0, /* Message is put in the queue and will be - executed when mailbox is checked. */ - MSG_SEND_METHOD_UNBUF /* The handler function is called immediately - in the same context of the sender */ -} EUNM_MSG_SEND_METHOD_T, *P_EUNM_MSG_SEND_METHOD_T; - - -typedef enum _ENUM_MBOX_ID_T { - MBOX_ID_0 = 0, - MBOX_ID_TOTAL_NUM -} ENUM_MBOX_ID_T, *P_ENUM_MBOX_ID_T; - -/* Define Mailbox structure */ -typedef struct _MBOX_T { - LINK_T rLinkHead; -} MBOX_T, *P_MBOX_T; - -typedef struct _MSG_SAA_FSM_START_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 ucSeqNum; - P_STA_RECORD_T prStaRec; -} MSG_SAA_FSM_START_T, *P_MSG_SAA_FSM_START_T; - -typedef struct _MSG_SAA_FSM_COMP_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 ucSeqNum; - WLAN_STATUS rJoinStatus; - P_STA_RECORD_T prStaRec; - P_SW_RFB_T prSwRfb; -} MSG_SAA_FSM_COMP_T, *P_MSG_SAA_FSM_COMP_T; - -typedef struct _MSG_SAA_FSM_ABORT_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 ucSeqNum; - P_STA_RECORD_T prStaRec; -} MSG_SAA_FSM_ABORT_T, *P_MSG_SAA_FSM_ABORT_T; - -typedef struct _MSG_CONNECTION_ABORT_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 ucNetTypeIndex; -} MSG_CONNECTION_ABORT_T, *P_MSG_CONNECTION_ABORT_T; - - - -/* specific message data types */ -typedef MSG_SAA_FSM_START_T MSG_JOIN_REQ_T, *P_MSG_JOIN_REQ_T; -typedef MSG_SAA_FSM_COMP_T MSG_JOIN_COMP_T, *P_MSG_JOIN_COMP_T; -typedef MSG_SAA_FSM_ABORT_T MSG_JOIN_ABORT_T, *P_MSG_JOIN_ABORT_T; - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -VOID -mboxSetup ( - IN P_ADAPTER_T prAdapter, - IN ENUM_MBOX_ID_T eMboxId - ); - - -VOID -mboxSendMsg ( - IN P_ADAPTER_T prAdapter, - IN ENUM_MBOX_ID_T eMboxId, - IN P_MSG_HDR_T prMsg, - IN EUNM_MSG_SEND_METHOD_T eMethod - ); - -VOID -mboxRcvAllMsg ( - IN P_ADAPTER_T prAdapter, - IN ENUM_MBOX_ID_T eMboxId - ); - -VOID -mboxInitialize ( - IN P_ADAPTER_T prAdapter - ); - -VOID -mboxDestroy ( - IN P_ADAPTER_T prAdapter - ); - -VOID -mboxDummy ( - IN P_ADAPTER_T prAdapter, - P_MSG_HDR_T prMsgHdr - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _HEM_MBOX_H */ - - diff --git a/drivers/net/wireless/mt5931/include/mgmt/mib.h b/drivers/net/wireless/mt5931/include/mgmt/mib.h deleted file mode 100755 index febcfb5fc40c..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/mib.h +++ /dev/null @@ -1,157 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/mib.h#1 $ -*/ - -/*! \file mib.h - \brief This file contains the IEEE 802.11 family related MIB definition - for MediaTek 802.11 Wireless LAN Adapters. -*/ - - - -/* -** $Log: mib.h $ - * - * 11 08 2010 wh.su - * [WCXRP00000171] [MT6620 Wi-Fi][Driver] Add message check code same behavior as mt5921 - * add the message check code from mt5921. - * - * 07 24 2010 wh.su - * - * .support the Wi-Fi RSN - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add aa_fsm.h, ais_fsm.h, bss.h, mib.h and scan.h. - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -*/ - -#ifndef _MIB_H -#define _MIB_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/* Entry in SMT AuthenticationAlgorithms Table: dot11AuthenticationAlgorithmsEntry */ -typedef struct _DOT11_AUTHENTICATION_ALGORITHMS_ENTRY { - BOOLEAN dot11AuthenticationAlgorithmsEnable; /* dot11AuthenticationAlgorithmsEntry 3 */ -} DOT11_AUTHENTICATION_ALGORITHMS_ENTRY, *P_DOT11_AUTHENTICATION_ALGORITHMS_ENTRY; - -/* Entry in SMT dot11RSNAConfigPairwiseCiphersTalbe Table: dot11RSNAConfigPairwiseCiphersEntry */ -typedef struct _DOT11_RSNA_CONFIG_PAIRWISE_CIPHERS_ENTRY -{ - UINT_32 dot11RSNAConfigPairwiseCipher; /* dot11RSNAConfigPairwiseCiphersEntry 2 */ - BOOLEAN dot11RSNAConfigPairwiseCipherEnabled; /* dot11RSNAConfigPairwiseCiphersEntry 3 */ -} DOT11_RSNA_CONFIG_PAIRWISE_CIPHERS_ENTRY, *P_DOT11_RSNA_CONFIG_PAIRWISE_CIPHERS_ENTRY; - -/* Entry in SMT dot11RSNAConfigAuthenticationSuitesTalbe Table: dot11RSNAConfigAuthenticationSuitesEntry */ -typedef struct _DOT11_RSNA_CONFIG_AUTHENTICATION_SUITES_ENTRY -{ - UINT_32 dot11RSNAConfigAuthenticationSuite; /* dot11RSNAConfigAuthenticationSuitesEntry 2 */ - BOOLEAN dot11RSNAConfigAuthenticationSuiteEnabled; /* dot11RSNAConfigAuthenticationSuitesEntry 3 */ -} DOT11_RSNA_CONFIG_AUTHENTICATION_SUITES_ENTRY, *P_DOT11_RSNA_CONFIG_AUTHENTICATION_SUITES_ENTRY; - -/* ----- IEEE 802.11 MIB Major sections ----- */ -typedef struct _IEEE_802_11_MIB_T { - /* dot11PrivacyTable (dot11smt 5) */ - UINT_8 dot11WEPDefaultKeyID; /* dot11PrivacyEntry 2 */ - BOOLEAN dot11TranmitKeyAvailable; - UINT_32 dot11WEPICVErrorCount; /* dot11PrivacyEntry 5 */ - UINT_32 dot11WEPExcludedCount; /* dot11PrivacyEntry 6 */ - - /* dot11RSNAConfigTable (dot11smt 8) */ - UINT_32 dot11RSNAConfigGroupCipher; /* dot11RSNAConfigEntry 4 */ - - /* dot11RSNAConfigPairwiseCiphersTable (dot11smt 9) */ - DOT11_RSNA_CONFIG_PAIRWISE_CIPHERS_ENTRY dot11RSNAConfigPairwiseCiphersTable[MAX_NUM_SUPPORTED_CIPHER_SUITES]; - - /* dot11RSNAConfigAuthenticationSuitesTable (dot11smt 10) */ - DOT11_RSNA_CONFIG_AUTHENTICATION_SUITES_ENTRY dot11RSNAConfigAuthenticationSuitesTable[MAX_NUM_SUPPORTED_AKM_SUITES]; - -#if 0 //SUPPORT_WAPI - BOOLEAN fgWapiKeyInstalled; - PARAM_WPI_KEY_T rWapiPairwiseKey[2]; - BOOLEAN fgPairwiseKeyUsed[2]; - UINT_8 ucWpiActivedPWKey; /* Must be 0 or 1, by wapi spec */ - PARAM_WPI_KEY_T rWapiGroupKey[2]; - BOOLEAN fgGroupKeyUsed[2]; -#endif -} IEEE_802_11_MIB_T, *P_IEEE_802_11_MIB_T; - -/* ------------------ IEEE 802.11 non HT PHY characteristics ---------------- */ -typedef const struct _NON_HT_PHY_ATTRIBUTE_T { - UINT_16 u2SupportedRateSet; - - BOOLEAN fgIsShortPreambleOptionImplemented; - - BOOLEAN fgIsShortSlotTimeOptionImplemented; - -} NON_HT_PHY_ATTRIBUTE_T, *P_NON_HT_PHY_ATTRIBUTE_T; - -typedef const struct _NON_HT_ADHOC_MODE_ATTRIBUTE_T { - - ENUM_PHY_TYPE_INDEX_T ePhyTypeIndex; - - UINT_16 u2BSSBasicRateSet; - -} NON_HT_ADHOC_MODE_ATTRIBUTE_T, *P_NON_HT_ADHOC_MODE_ATTRIBUTE_T; - -typedef NON_HT_ADHOC_MODE_ATTRIBUTE_T NON_HT_AP_MODE_ATTRIBUTE_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ -extern NON_HT_PHY_ATTRIBUTE_T rNonHTPhyAttributes[]; -extern NON_HT_ADHOC_MODE_ATTRIBUTE_T rNonHTAdHocModeAttributes[]; -extern NON_HT_AP_MODE_ATTRIBUTE_T rNonHTApModeAttributes[]; - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _MIB_H */ - diff --git a/drivers/net/wireless/mt5931/include/mgmt/p2p_assoc.h b/drivers/net/wireless/mt5931/include/mgmt/p2p_assoc.h deleted file mode 100755 index 270d1d63c7fb..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/p2p_assoc.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/include/mgmt/p2p_assoc.h#1 $ -*/ - -/*! \file p2p_assoc.h - \brief This file contains the Wi-Fi Direct ASSOC REQ/RESP of - IEEE 802.11 family for MediaTek 802.11 Wireless LAN Adapters. -*/ - - - - -#ifndef _P2P_ASSOC_H -#define _P2P_ASSOC_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -PUINT_8 -p2pBuildReAssocReqFrameCommonIEs ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN PUINT_8 pucBuffer - ); - - -#endif diff --git a/drivers/net/wireless/mt5931/include/mgmt/p2p_bss.h b/drivers/net/wireless/mt5931/include/mgmt/p2p_bss.h deleted file mode 100755 index a609476fff7d..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/p2p_bss.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/include/mgmt/p2p_bss.h#2 $ -*/ - -/*! \file "p2p_bss.h" - \brief In this file we define the function prototype used in p2p BSS/IBSS. - - The file contains the function declarations and defines for used in BSS/IBSS. -*/ - - - - - -#ifndef _P2P_BSS_H -#define _P2P_BSS_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - - -UINT_32 -p2pGetTxProbRspIeTableSize( - VOID - ); - -#endif - diff --git a/drivers/net/wireless/mt5931/include/mgmt/p2p_fsm.h b/drivers/net/wireless/mt5931/include/mgmt/p2p_fsm.h deleted file mode 100755 index 01d2c9c9b94f..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/p2p_fsm.h +++ /dev/null @@ -1,2740 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/include/mgmt/p2p_fsm.h#23 $ -*/ - -/*! \file p2p_fsm.h - \brief Declaration of functions and finite state machine for P2P Module. - - Declaration of functions and finite state machine for P2P Module. -*/ - -/******************************************************************************* -* Copyright (c) 2010 MediaTek Inc. -* -* All rights reserved. Copying, compilation, modification, distribution -* or any other use whatsoever of this material is strictly prohibited -* except in accordance with a Software License Agreement with -* MediaTek Inc. -******************************************************************************** -*/ - -/******************************************************************************* -* LEGAL DISCLAIMER -* -* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND -* AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK -* SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE -* PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY -* DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT -* LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -* PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE -* ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY -* WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK -* SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY -* WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE -* FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO -* CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. -* -* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE -* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL -* BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT -* ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY -* BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. -* -* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE -* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT -* OF LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING -* THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN -* FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE -* (ICC). -******************************************************************************** -*/ - -/* -** $Log: p2p_fsm.h $ -** -** 08 14 2012 yuche.tsai -** NULL -** Fix compile error. -** -** 07 26 2012 yuche.tsai -** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot -** Update driver code of ALPS.JB for hot-spot. -** -** 07 19 2012 yuche.tsai -** NULL -** Code update for JB. - * - * 07 18 2012 yuche.tsai - * NULL - * add one file. - * - * 12 02 2011 yuche.tsai - * NULL - * Resolve class 3 error issue under AP mode. - * - * data frame may TX before Assoc Response TX. - * - * 11 11 2011 yuche.tsai - * NULL - * Fix work thread cancel issue. - * - * 11 11 2011 yuche.tsai - * NULL - * Fix default device name issue. - * - * 11 09 2011 yuche.tsai - * [WCXRP00001093] [Need Patch][Volunteer Patch] Service Discovery 2.0 state transition issue. - * Fix SD2.0 issue which may cause KE. (Monkey test) - * - * 11 08 2011 yuche.tsai - * [WCXRP00001094] [Volunteer Patch][Driver] Driver version & supplicant version query & set support for service discovery version check. - * Add support for driver version query & p2p supplicant verseion set. - * For new service discovery mechanism sync. - * - * 10 18 2011 yuche.tsai - * [WCXRP00001045] [WiFi Direct][Driver] Check 2.1 branch. - * Support Channle Query. - * - * 10 18 2011 yuche.tsai - * [WCXRP00001045] [WiFi Direct][Driver] Check 2.1 branch. - * New 2.1 branch - - * - * 09 01 2011 yuche.tsai - * NULL - * Fix channel stay interval. - * Sync channel stay interval & channel request interval under AP mode.. - * - * 08 30 2011 yuche.tsai - * [WCXRP00000953] [Volunteer Patch][Driver] Hot Spot Channel ASSERT issue. - * Fix hot spot FW assert issue when under concurrent case. (DBG enable only) - * - * 08 16 2011 cp.wu - * [WCXRP00000934] [MT6620 Wi-Fi][Driver][P2P] Wi-Fi hot spot with auto sparse channel residence - * auto channel decision for 2.4GHz hot spot mode - * - * 08 16 2011 yuche.tsai - * NULL - * Fix scan policy for Active LISTEN scan. - * - * 08 09 2011 yuche.tsai - * [WCXRP00000919] [Volunteer Patch][WiFi Direct][Driver] Invitation New Feature. - * Invitation Feature add on. - * - * 08 02 2011 yuche.tsai - * [WCXRP00000896] [Volunteer Patch][WiFi Direct][Driver] GO with multiple client, TX deauth to a disconnecting device issue. - * Support TX Deauth Issue. - * - * 07 26 2011 yuche.tsai - * [WCXRP00000875] [Volunteer Patch][WiFi Direct][Driver] MT6620 IOT issue with realtek test bed solution. - * Turn off persistent group support for V2.0 release. - * - * 07 18 2011 yuche.tsai - * [WCXRP00000856] [Volunteer Patch][WiFi Direct][Driver] MT6620 WiFi Direct IOT Issue with BCM solution. - * Fix compile error. - * - * 07 18 2011 yuche.tsai - * [WCXRP00000856] [Volunteer Patch][WiFi Direct][Driver] MT6620 WiFi Direct IOT Issue with BCM solution. - * Fix MT6620 WiFi Direct IOT Issue with BCM solution. - * - * 07 11 2011 yuche.tsai - * [WCXRP00000845] [Volunteer Patch][WiFi Direct] WiFi Direct Device Connection Robustness - * Enhance Connection Robustness. - * - * 07 08 2011 yuche.tsai - * [WCXRP00000841] [Volunteer Patch][WiFi Direct] Group Owner Setting. - * Update GO configure parameter. - * - * 07 05 2011 yuche.tsai - * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue - * Disable enhancement II for debugging. - * - * 07 05 2011 yuche.tsai - * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue - * Refine compile flag. - * - * 07 05 2011 yuche.tsai - * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue - * Add wifi direct connection enhancement method I, II & VI. - * - * 06 20 2011 yuche.tsai - * [WCXRP00000799] [Volunteer Patch][MT6620][Driver] Connection Indication Twice Issue. - * Fix connection indication twice issue. - * - * 06 07 2011 yuche.tsai - * [WCXRP00000763] [Volunteer Patch][MT6620][Driver] RX Service Discovery Frame under AP mode Issue - * Fix RX SD request under AP mode issue. - * - * 05 04 2011 yuche.tsai - * NULL - * Support partial persistent group function. - * - * 04 20 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove CFG_WIFI_DIRECT_MOVED. - * - * 04 08 2011 yuche.tsai - * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO. - * Add device discoverability support. - * - * 03 25 2011 yuche.tsai - * NULL - * Improve some error handleing. - * - * 03 22 2011 george.huang - * [WCXRP00000504] [MT6620 Wi-Fi][FW] Support Sigma CAPI for power saving related command - * link with supplicant commands - * - * 03 22 2011 yuche.tsai - * NULL - * 1.Shorten the LISTEN interval. - * 2. Fix IF address issue when we are GO - * 3. Fix LISTEN channel issue. - * - * 03 21 2011 yuche.tsai - * NULL - * Change P2P Connection Request Flow. - * - * 03 19 2011 yuche.tsai - * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct. - * Add beacon timeout support. - * - * 03 19 2011 yuche.tsai - * [WCXRP00000581] [Volunteer Patch][MT6620][Driver] P2P IE in Assoc Req Issue - * Append P2P IE in Assoc Req, so that GC can be discovered in probe response of GO. - * - * 03 18 2011 yuche.tsai - * [WCXRP00000574] [Volunteer Patch][MT6620][Driver] Modify P2P FSM Connection Flow - * Modify connection flow after Group Formation Complete, or device connect to a GO. - * Instead of request channel & connect directly, we use scan to allocate channel bandwidth & connect after RX BCN. - * - * 03 15 2011 yuche.tsai - * [WCXRP00000560] [Volunteer Patch][MT6620][Driver] P2P Connection from UI using KEY/DISPLAY issue - * Fix some configure method issue. - * - * 03 10 2011 yuche.tsai - * NULL - * Add P2P API. - * - * 03 07 2011 yuche.tsai - * [WCXRP00000502] [Volunteer Patch][MT6620][Driver] Fix group ID issue when doing Group Formation. - * . - * - * 03 07 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * rename the define to anti_pviracy. - * - * 03 05 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * add the code to get the check rsponse and indicate to app. - * - * 03 01 2011 yuche.tsai - * [WCXRP00000501] [Volunteer Patch][MT6620][Driver] No common channel issue when doing GO formation - * Update channel issue when doing GO formation.. - * - * 03 01 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Update Service Discovery Related wlanoid function. - * - * 02 18 2011 wh.su - * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE - * fixed the ioctl setting that index not map to spec defined config method. - * - * 02 18 2011 yuche.tsai - * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue - * Fix WSC IE BE format issue. - * - * 02 17 2011 wh.su - * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE - * append the WSC IE config method attribute at provision discovery request. - * - * 02 11 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * Add two function prototype. - * - * 02 10 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * Support Disassoc & Deauthentication for Hot-Spot. - * - * 02 09 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. - -2. Provision Discovery Request/Response - - * Add Service Discovery Indication Related code. - * - * 02 09 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * Add Support for MLME deauthentication for Hot-Spot. - * - * 02 09 2011 yuche.tsai - * [WCXRP00000429] [Volunteer Patch][MT6620][Driver] Hot Spot Client Limit Issue - * Fix Client Limit Issue. - * - * 01 26 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. - -2. Provision Discovery Request/Response - - * Add Service Discovery Function. - * - * 01 25 2011 terry.wu - * [WCXRP00000393] [MT6620 Wi-Fi][Driver] Add new module insert parameter - * Add a new module parameter to indicate current runnig mode, P2P or AP. - * - * 01 19 2011 george.huang - * [WCXRP00000355] [MT6620 Wi-Fi] Set WMM-PS related setting with qualifying AP capability - * Null NOA attribute setting when no related parameters. - * - * 01 12 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * Modify some behavior of AP mode. - * - * 12 22 2010 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Fix Compile Error. - * - * 12 15 2010 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Refine Connection Flow. - * - * 12 08 2010 yuche.tsai - * [WCXRP00000244] [MT6620][Driver] Add station record type for each client when in AP mode. - * Change STA Type under AP mode. We would tell if client is a P2P device or a legacy client by checking the P2P IE in assoc req frame. - * - * 12 02 2010 yuche.tsai - * NULL - * Update P2P Connection Policy for Invitation. - * - * 12 02 2010 yuche.tsai - * NULL - * Update P2P Connection Policy for Invitation & Provision Discovery. - * - * 11 30 2010 yuche.tsai - * NULL - * Invitation & Provision Discovery Indication. - * - * 11 30 2010 yuche.tsai - * NULL - * Update Configure Method indication & selection for Provision Discovery & GO_NEGO_REQ - * - * 11 29 2010 yuche.tsai - * NULL - * Update P2P related function for INVITATION & PROVISION DISCOVERY. - * - * 11 26 2010 george.huang - * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function - * Update P2P PS for NOA function. - * - * 11 25 2010 yuche.tsai - * NULL - * Update Code for Invitation Related Function. - * - * 11 17 2010 wh.su - * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID[WCXRP00000179] [MT6620 Wi-Fi][FW] Set the Tx lowest rate at wlan table for normal operation - * fixed some ASSERT check. - * - * 11 04 2010 wh.su - * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID - * adding the p2p random ssid support. - * - * 10 20 2010 wh.su - * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group - * Add the code to support disconnect p2p group - * - * 10 08 2010 wh.su - * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine - * update the frog's new p2p state machine. - * - * 10 04 2010 wh.su - * [WCXRP00000081] [MT6620][Driver] Fix the compiling error at WinXP while enable P2P - * fixed compiling error while enable p2p. - * - * 09 21 2010 kevin.huang - * [WCXRP00000054] [MT6620 Wi-Fi][Driver] Restructure driver for second Interface - * Isolate P2P related function for Hardware Software Bundle - * - * 09 10 2010 wh.su - * NULL - * fixed the compiling error at WinXP. - * - * 09 07 2010 wh.su - * NULL - * adding the code for beacon/probe req/ probe rsp wsc ie at p2p. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 26 2010 yuche.tsai - * NULL - * Add connection abort message event prototype. - * - * 08 20 2010 kevin.huang - * NULL - * Modify AAA Module for changing STA STATE 3 at p2p/bowRunEventAAAComplete() - * - * 08 16 2010 yuche.tsai - * NULL - * Fix P2P Intended Interface Address Bug. - * Extend GO Nego Timeout Time. - * - * 08 16 2010 yuche.tsai - * NULL - * Extend Listen Interval default value & remove deprecated variable. - * - * 08 16 2010 kevin.huang - * NULL - * Refine AAA functions - * - * 08 12 2010 kevin.huang - * NULL - * Refine bssProcessProbeRequest() and bssSendBeaconProbeResponse() - * - * 08 12 2010 yuche.tsai - * NULL - * Add function prototype for join complete. - * - * 08 11 2010 yuche.tsai - * NULL - * Add some function proto type for P2P FSM under provisioning phase.. - * - * 08 11 2010 yuche.tsai - * NULL - * Change P2P data structure for supporting - * 1. P2P Device discovery. - * 2. P2P Group Negotiation. - * 3. P2P JOIN - * - * 08 05 2010 yuche.tsai - * NULL - * Check-in P2P Device Discovery Feature. - * - * 08 03 2010 george.huang - * NULL - * handle event for updating NOA parameters indicated from FW - * - * 08 02 2010 yuche.tsai - * NULL - * P2P Group Negotiation Code Check in. - * - * 07 26 2010 yuche.tsai - * - * Update P2P FSM header file. - * - * 07 23 2010 cp.wu - * - * P2P/RSN/WAPI IEs need to be declared with compact structure. - * - * 07 21 2010 yuche.tsai - * - * Add for P2P Scan Result Parsing & Saving. - * - * 07 19 2010 yuche.tsai - * - * Update P2P FSM header file. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 21 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Fix some P2P function prototype. - * - * 06 17 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * First draft for migration P2P FSM from FW to Driver. - * - * 03 18 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Rename CFG flag for P2P - * - * 02 26 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Modify parameter of p2pStartGO - * - * 02 23 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add Wi-Fi Direct SSID and P2P GO Test Mode - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup -*/ - -#ifndef _P2P_FSM_H -#define _P2P_FSM_H - - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ -#define CID52_53_54 0 - - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - - - - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef enum _ENUM_P2P_STATE_T { - P2P_STATE_IDLE = 0, - P2P_STATE_SCAN, - P2P_STATE_AP_CHANNEL_DETECT, - P2P_STATE_REQING_CHANNEL, - P2P_STATE_CHNL_ON_HAND, /* Requesting Channel to Send Specific Frame. */ - P2P_STATE_GC_JOIN, /* Sending Specific Frame. May extending channel by other event. */ - P2P_STATE_NUM -} ENUM_P2P_STATE_T, *P_ENUM_P2P_STATE_T; - - -typedef enum _ENUM_CHANNEL_REQ_TYPE_T { - CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL, - CHANNEL_REQ_TYPE_GC_JOIN_REQ, - CHANNEL_REQ_TYPE_GO_START_BSS -} -ENUM_CHANNEL_REQ_TYPE_T, *P_ENUM_CHANNEL_REQ_TYPE_T; - - -typedef enum _ENUM_BUFFER_TYPE_T { - ENUM_FRAME_TYPE_EXTRA_IE_BEACON, - ENUM_FRAME_TYPE_EXTRA_IE_ASSOC_RSP, - ENUM_FRAME_TYPE_EXTRA_IE_PROBE_RSP, - ENUM_FRAME_TYPE_PROBE_RSP_TEMPLATE, - ENUM_FRAME_TYPE_BEACON_TEMPLATE, - ENUM_FRAME_IE_NUM -} ENUM_BUFFER_TYPE_T, *P_ENUM_BUFFER_TYPE_T; - -typedef enum _ENUM_HIDDEN_SSID_TYPE_T { - ENUM_HIDDEN_SSID_NONE, - ENUM_HIDDEN_SSID_LEN, - ENUM_HIDDEN_SSID_ZERO_CONTENT, - ENUM_HIDDEN_SSID_NUM -} -ENUM_HIDDEN_SSID_TYPE_T, *P_ENUM_HIDDEN_SSID_TYPE_T; - -typedef struct _P2P_SSID_STRUCT_T { - UINT_8 aucSsid[32]; - UINT_8 ucSsidLen; -} P2P_SSID_STRUCT_T, *P_P2P_SSID_STRUCT_T; - -typedef struct _P2P_STATION_INFO_T { - UINT_32 u4InactiveTime; - UINT_32 u4RxBytes; // TODO: - UINT_32 u4TxBytes; // TODO: - UINT_32 u4RxPackets; // TODO: - UINT_32 u4TxPackets; // TODO: - // TODO: Add more for requirement. -} -P2P_STATION_INFO_T, *P_P2P_STATION_INFO_T; - - -typedef struct _AP_CRYPTO_SETTINGS_T { - UINT_32 u4WpaVersion; - UINT_32 u4CipherGroup; - INT_32 i4NumOfCiphers; - UINT_32 aucCiphersPairwise[5]; - INT_32 i4NumOfAkmSuites; - UINT_32 aucAkmSuites[2]; - BOOLEAN fgIsControlPort; - UINT_16 u2ControlPortBE; - BOOLEAN fgIsControlPortEncrypt; -} AP_CRYPTO_SETTINGS_T, *P_AP_CRYPTO_SETTINGS_T; - -/*-------------------- P2P FSM ACTION STRUCT ---------------------*/ -typedef struct _P2P_CHNL_REQ_INFO_T { - BOOLEAN fgIsChannelRequested; - UINT_8 ucSeqNumOfChReq; - UINT_64 u8Cookie; - UINT_8 ucReqChnlNum; - ENUM_BAND_T eBand; - ENUM_CHNL_EXT_T eChnlSco; - UINT_32 u4MaxInterval; - ENUM_CHANNEL_REQ_TYPE_T eChannelReqType; - - UINT_8 ucOriChnlNum; - ENUM_BAND_T eOriBand; - ENUM_CHNL_EXT_T eOriChnlSco; -} P2P_CHNL_REQ_INFO_T, *P_P2P_CHNL_REQ_INFO_T; - -typedef struct _P2P_SCAN_REQ_INFO_T { - ENUM_SCAN_TYPE_T eScanType; - ENUM_SCAN_CHANNEL eChannelSet; - UINT_16 u2PassiveDewellTime; - UINT_8 ucSeqNumOfScnMsg; - BOOLEAN fgIsAbort; - BOOLEAN fgIsScanRequest; - UINT_8 ucNumChannelList; - RF_CHANNEL_INFO_T arScanChannelList[MAXIMUM_OPERATION_CHANNEL_LIST]; - UINT_32 u4BufLength; - UINT_8 aucIEBuf[MAX_IE_LENGTH]; - P2P_SSID_STRUCT_T rSsidStruct; // Currently we can only take one SSID scan request -} -P2P_SCAN_REQ_INFO_T, *P_P2P_SCAN_REQ_INFO_T; - -typedef struct _P2P_CONNECTION_REQ_INFO_T { - - BOOLEAN fgIsConnRequest; - P2P_SSID_STRUCT_T rSsidStruct; - UINT_8 aucBssid[MAC_ADDR_LEN]; - /* For ASSOC Req. */ - UINT_32 u4BufLength; - UINT_8 aucIEBuf[MAX_IE_LENGTH]; -} P2P_CONNECTION_REQ_INFO_T, *P_P2P_CONNECTION_REQ_INFO_T; - -typedef struct _P2P_MGMT_TX_REQ_INFO_T { - BOOLEAN fgIsMgmtTxRequested; - P_MSDU_INFO_T prMgmtTxMsdu; - UINT_64 u8Cookie; -} P2P_MGMT_TX_REQ_INFO_T, *P_P2P_MGMT_TX_REQ_INFO_T; - -typedef struct _P2P_BEACON_UPDATE_INFO_T { - PUINT_8 pucBcnHdr; - UINT_32 u4BcnHdrLen; - PUINT_8 pucBcnBody; - UINT_32 u4BcnBodyLen; -} -P2P_BEACON_UPDATE_INFO_T, *P_P2P_BEACON_UPDATE_INFO_T; - -typedef struct _P2P_PROBE_RSP_UPDATE_INFO_T { - P_MSDU_INFO_T prProbeRspMsduTemplate; -} P2P_PROBE_RSP_UPDATE_INFO_T, *P_P2P_PROBE_RSP_UPDATE_INFO_T; - -typedef struct _P2P_ASSOC_RSP_UPDATE_INFO_T { - PUINT_8 pucAssocRspExtIE; - UINT_16 u2AssocIELen; -} P2P_ASSOC_RSP_UPDATE_INFO_T, *P_P2P_ASSOC_RSP_UPDATE_INFO_T; - -typedef struct _P2P_JOIN_INFO_T { - UINT_32 ucSeqNumOfReqMsg; - UINT_8 ucAvailableAuthTypes; - P_STA_RECORD_T prTargetStaRec; - P2P_SSID_STRUCT_T rSsidStruct; - BOOLEAN fgIsJoinComplete; - /* For ASSOC Rsp. */ - UINT_32 u4BufLength; - UINT_8 aucIEBuf[MAX_IE_LENGTH]; -} -P2P_JOIN_INFO_T, *P_P2P_JOIN_INFO_T; - -struct _P2P_FSM_INFO_T { - /* State related. */ - ENUM_P2P_STATE_T ePreviousState; - ENUM_P2P_STATE_T eCurrentState; - - /* Channel related. */ - P2P_CHNL_REQ_INFO_T rChnlReqInfo; - - /* Scan related. */ - P2P_SCAN_REQ_INFO_T rScanReqInfo; - - /* Connection related. */ - P2P_CONNECTION_REQ_INFO_T rConnReqInfo; - - /* Mgmt tx related. */ - P2P_MGMT_TX_REQ_INFO_T rMgmtTxInfo; - - /* Beacon related. */ - P2P_BEACON_UPDATE_INFO_T rBcnContentInfo; - - /* Probe Response related. */ - P2P_PROBE_RSP_UPDATE_INFO_T rProbeRspContentInfo; - - /* Assoc Rsp related. */ - P2P_ASSOC_RSP_UPDATE_INFO_T rAssocRspContentInfo; - - /* GC Join related. */ - P2P_JOIN_INFO_T rJoinInfo; - - /* FSM Timer */ - TIMER_T rP2pFsmTimeoutTimer; - - - /* GC Target BSS. */ - P_BSS_DESC_T prTargetBss; - - /* GC Connection Request. */ - BOOLEAN fgIsConnectionRequested; - - BOOLEAN fgIsApMode; - - /* Channel grant interval. */ - UINT_32 u4GrantInterval; - - /* Packet filter for P2P module. */ - UINT_32 u4P2pPacketFilter; - - //vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv Prepare for use vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv - /* Msg event queue. */ - LINK_T rMsgEventQueue; - -}; - - -/*---------------- Messages -------------------*/ -typedef struct _MSG_P2P_SCAN_REQUEST_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - P_P2P_SSID_STRUCT_T prSSID; - INT_32 i4SsidNum; - UINT_32 u4NumChannel; - PUINT_8 pucIEBuf; - UINT_32 u4IELen; - BOOLEAN fgIsAbort; - RF_CHANNEL_INFO_T arChannelListInfo[1]; -} MSG_P2P_SCAN_REQUEST_T, *P_MSG_P2P_SCAN_REQUEST_T; - -typedef struct _MSG_P2P_CHNL_REQUEST_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_64 u8Cookie; - UINT_32 u4Duration; - ENUM_CHNL_EXT_T eChnlSco; - RF_CHANNEL_INFO_T rChannelInfo; -} MSG_P2P_CHNL_REQUEST_T, *P_MSG_P2P_CHNL_REQUEST_T; - -typedef struct _MSG_P2P_CHNL_ABORT_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_64 u8Cookie; -} MSG_P2P_CHNL_ABORT_T, *P_MSG_P2P_CHNL_ABORT_T; - - -typedef struct _MSG_P2P_CONNECTION_REQUEST_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - P2P_SSID_STRUCT_T rSsid; - UINT_8 aucBssid[MAC_ADDR_LEN]; - ENUM_CHNL_EXT_T eChnlSco; - RF_CHANNEL_INFO_T rChannelInfo; - UINT_32 u4IELen; - UINT_8 aucIEBuf[1]; - // TODO: Auth Type, OPEN, SHARED, FT, EAP... -} MSG_P2P_CONNECTION_REQUEST_T, *P_MSG_P2P_CONNECTION_REQUEST_T; - - -typedef struct _MSG_P2P_CONNECTION_ABORT_T { - MSG_HDR_T rMsgHdr; /* Must be the first member. */ - UINT_8 aucTargetID[MAC_ADDR_LEN]; - UINT_16 u2ReasonCode; - BOOLEAN fgSendDeauth; -} MSG_P2P_CONNECTION_ABORT_T, *P_MSG_P2P_CONNECTION_ABORT_T; - -typedef struct _MSG_P2P_MGMT_TX_REQUEST_T { - MSG_HDR_T rMsgHdr; - P_MSDU_INFO_T prMgmtMsduInfo; - UINT_64 u8Cookie; /* For indication. */ - BOOLEAN fgNoneCckRate; - BOOLEAN fgIsWaitRsp; -} MSG_P2P_MGMT_TX_REQUEST_T, *P_MSG_P2P_MGMT_TX_REQUEST_T; - -typedef struct _MSG_P2P_START_AP_T { - MSG_HDR_T rMsgHdr; - UINT_32 u4DtimPeriod; - UINT_32 u4BcnInterval; - UINT_8 aucSsid[32]; - UINT_16 u2SsidLen; - UINT_8 ucHiddenSsidType; - BOOLEAN fgIsPrivacy; - AP_CRYPTO_SETTINGS_T rEncryptionSettings; - INT_32 i4InactiveTimeout; -} -MSG_P2P_START_AP_T, *P_MSG_P2P_START_AP_T; - - -typedef struct _MSG_P2P_BEACON_UPDATE_T { - MSG_HDR_T rMsgHdr; - UINT_32 u4BcnHdrLen; - UINT_32 u4BcnBodyLen; - PUINT_8 pucBcnHdr; - PUINT_8 pucBcnBody; - UINT_8 aucBuffer[1]; /* Header & Body are put here. */ -} -MSG_P2P_BEACON_UPDATE_T, *P_MSG_P2P_BEACON_UPDATE_T; - -typedef struct _MSG_P2P_MGMT_FRAME_UPDATE_T { - MSG_HDR_T rMsgHdr; - ENUM_BUFFER_TYPE_T eBufferType; - UINT_32 u4BufferLen; - UINT_8 aucBuffer[1]; -} MSG_P2P_MGMT_FRAME_UPDATE_T, *P_MSG_P2P_MGMT_FRAME_UPDATE_T; - - -typedef struct _MSG_P2P_SWITCH_OP_MODE_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - ENUM_OP_MODE_T eOpMode; -} MSG_P2P_SWITCH_OP_MODE_T, *P_MSG_P2P_SWITCH_OP_MODE_T; - -typedef struct _MSG_P2P_MGMT_FRAME_REGISTER_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_16 u2FrameType; - BOOLEAN fgIsRegister; -} -MSG_P2P_MGMT_FRAME_REGISTER_T, *P_MSG_P2P_MGMT_FRAME_REGISTER_T; - -typedef struct _MSG_P2P_NETDEV_REGISTER_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - BOOLEAN fgIsEnable; - UINT_8 ucMode; -} MSG_P2P_NETDEV_REGISTER_T, *P_MSG_P2P_NETDEV_REGISTER_T; - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -VOID -p2pFsmStateTransition( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN ENUM_P2P_STATE_T eNextState - ); - - - -VOID -p2pFsmRunEventAbort( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo - ); - - -VOID -p2pFsmRunEventScanRequest( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventMgmtFrameTx( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventStartAP( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventNetDeviceRegister( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventUpdateMgmtFrame( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventBeaconUpdate( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventStopAP( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventChannelRequest( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - - -VOID -p2pFsmRunEventChannelAbort( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - - -VOID -p2pFsmRunEventDissolve( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - - -VOID -p2pFsmRunEventSwitchOPMode( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - - -WLAN_STATUS -p2pFsmRunEventMgmtFrameTxDone( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - - -VOID -p2pFsmRunEventMgmtFrameRegister( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - - -#if 0 -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#endif - -//3 /* --------------- WFA P2P DEFAULT PARAMETERS --------------- */ -#define P2P_WILDCARD_SSID "DIRECT-" -#define P2P_WILDCARD_SSID_LEN 7 -#define P2P_GROUP_ID_LEN 9 - -#define P2P_DRIVER_VERSION 2 /* Update when needed. */ - -#define P2P_DEFAULT_DEV_NAME "Wireless Client" -#define P2P_DEFAULT_DEV_NAME_LEN 15 -#define P2P_DEFAULT_PRIMARY_CATEGORY_ID 10 -#define P2P_DEFAULT_PRIMARY_SUB_CATEGORY_ID 5 -#define P2P_DEFAULT_CONFIG_METHOD (WPS_ATTRI_CFG_METHOD_PUSH_BUTTON | WPS_ATTRI_CFG_METHOD_KEYPAD | WPS_ATTRI_CFG_METHOD_DISPLAY) -#define P2P_DEFAULT_LISTEN_CHANNEL 1 - -#define P2P_MAX_SUPPORTED_SEC_DEV_TYPE_COUNT 0 /* NOTE(Kevin): Shall <= 16 */ -#define P2P_MAX_SUPPORTED_CHANNEL_LIST_COUNT 13 - -#define P2P_MAX_SUPPORTED_CHANNEL_LIST_SIZE 51 /* Contains 6 sub-band. */ - -#define P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT 8 /* NOTE(Kevin): Shall <= 16 */ - -#define P2P_MAXIMUM_CLIENT_COUNT 8 -#define P2P_MAXIMUM_NOA_COUNT 8 - - -#define P2P_MAXIMUM_ATTRIBUTE_LEN 251 - -#define P2P_CTWINDOW_DEFAULT 25 /* in TU=(1024usec) */ - -#define P2P_MAXIMUM_ATTRIBUTES_CACHE_SIZE 768 - -/* P2P 3.1.2.1.3 - Find Phase */ -#define P2P_MAX_DISCOVERABLE_INTERVAL 8 //3//3 -#define P2P_MIN_DISCOVERABLE_INTERVAL 5 // 1 - -#define P2P_LISTEN_SCAN_UNIT 100 // MS - -/* FSM Time Related constrain. */ -#define P2P_SERACH_STATE_PERIOD_MS 1000 // Deprecated. - -#define P2P_GO_CHANNEL_STAY_INTERVAL 1000 - -#define P2P_GO_NEGO_TIMEOUT_MS 500 -#define P2P_CONNECTION_TIMEOUT_SEC 120 - -#define P2P_INVITAION_TIMEOUT_MS 500 /* Timeout Wait Invitation Resonse. */ -#define P2P_PROVISION_DISCOVERY_TIMEOUT_MS 500 /* Timeout Wait Provision Discovery Resonse. */ - -//3 /* --------------- WFA P2P IE --------------- */ -/* P2P 4.1.1 - P2P IE format */ -#define P2P_OUI_TYPE_LEN 4 -#define P2P_IE_OUI_HDR (ELEM_HDR_LEN + P2P_OUI_TYPE_LEN) /* == OFFSET_OF(IE_P2P_T, aucP2PAttributes[0]) */ - -/* P2P 4.1.1 - General P2P Attribute */ -#define P2P_ATTRI_HDR_LEN 3 /* ID(1 octet) + Length(2 octets) */ - -/* P2P 4.1.1 - P2P Attribute ID definitions */ -#define P2P_ATTRI_ID_STATUS 0 -#define P2P_ATTRI_ID_REASON_CODE 1 -#define P2P_ATTRI_ID_P2P_CAPABILITY 2 -#define P2P_ATTRI_ID_P2P_DEV_ID 3 -#define P2P_ATTRI_ID_GO_INTENT 4 -#define P2P_ATTRI_ID_CFG_TIMEOUT 5 -#define P2P_ATTRI_ID_LISTEN_CHANNEL 6 -#define P2P_ATTRI_ID_P2P_GROUP_BSSID 7 -#define P2P_ATTRI_ID_EXT_LISTEN_TIMING 8 -#define P2P_ATTRI_ID_INTENDED_P2P_IF_ADDR 9 -#define P2P_ATTRI_ID_P2P_MANAGEABILITY 10 -#define P2P_ATTRI_ID_CHANNEL_LIST 11 -#define P2P_ATTRI_ID_NOTICE_OF_ABSENCE 12 -#define P2P_ATTRI_ID_P2P_DEV_INFO 13 -#define P2P_ATTRI_ID_P2P_GROUP_INFO 14 -#define P2P_ATTRI_ID_P2P_GROUP_ID 15 -#define P2P_ATTRI_ID_P2P_INTERFACE 16 -#define P2P_ATTRI_ID_OPERATING_CHANNEL 17 -#define P2P_ATTRI_ID_INVITATION_FLAG 18 -#define P2P_ATTRI_ID_VENDOR_SPECIFIC 221 - -/* Maximum Length of P2P Attributes */ -#define P2P_ATTRI_MAX_LEN_STATUS 1 /* 0 */ -#define P2P_ATTRI_MAX_LEN_REASON_CODE 1 /* 1 */ -#define P2P_ATTRI_MAX_LEN_P2P_CAPABILITY 2 /* 2 */ -#define P2P_ATTRI_MAX_LEN_P2P_DEV_ID 6 /* 3 */ -#define P2P_ATTRI_MAX_LEN_GO_INTENT 1 /* 4 */ -#define P2P_ATTRI_MAX_LEN_CFG_TIMEOUT 2 /* 5 */ -#if CID52_53_54 - #define P2P_ATTRI_MAX_LEN_LISTEN_CHANNEL 5 /* 6 */ -#else - #define P2P_ATTRI_MAX_LEN_LISTEN_CHANNEL 5 /* 6 */ -#endif -#define P2P_ATTRI_MAX_LEN_P2P_GROUP_BSSID 6 /* 7 */ -#define P2P_ATTRI_MAX_LEN_EXT_LISTEN_TIMING 4 /* 8 */ -#define P2P_ATTRI_MAX_LEN_INTENDED_P2P_IF_ADDR 6 /* 9 */ -#define P2P_ATTRI_MAX_LEN_P2P_MANAGEABILITY 1 /* 10 */ -//#define P2P_ATTRI_MAX_LEN_CHANNEL_LIST 3 + (n* (2 + num_of_ch)) /* 11 */ -#define P2P_ATTRI_LEN_CHANNEL_LIST 3 /* 11 */ -#define P2P_ATTRI_LEN_CHANNEL_ENTRY 2 /* 11 */ - - -//#define P2P_ATTRI_MAX_LEN_NOTICE_OF_ABSENCE 2 + (n* (13)) /* 12 */ -#define P2P_ATTRI_MAX_LEN_NOTICE_OF_ABSENCE (2 + (P2P_MAXIMUM_NOA_COUNT*(13))) /* 12 */ - -#define P2P_ATTRI_MAX_LEN_P2P_DEV_INFO 17 + (8 * (8)) + 36 /* 13 */ -//#define P2P_ATTRI_MAX_LEN_P2P_GROUP_INFO n* (25 + (m* (8)) + 32) /* 14 */ -#define P2P_ATTRI_MAX_LEN_P2P_GROUP_ID 38 /* 15 */ -#define P2P_ATTRI_MAX_LEN_P2P_INTERFACE 253 // 7 + 6* [0~41] /* 16 */ -#if CID52_53_54 - #define P2P_ATTRI_MAX_LEN_OPERATING_CHANNEL 5 /* 17 */ -#else - #define P2P_ATTRI_MAX_LEN_OPERATING_CHANNEL 5 /* 17 */ -#endif -#define P2P_ATTRI_MAX_LEN_INVITATION_FLAGS 1 /* 18 */ - -/* P2P 4.1.2 - P2P Status definitions */ -#define P2P_STATUS_SUCCESS 0 -#define P2P_STATUS_FAIL_INFO_IS_CURRENTLY_UNAVAILABLE 1 -#define P2P_STATUS_FAIL_INCOMPATIBLE_PARAM 2 -#define P2P_STATUS_FAIL_LIMIT_REACHED 3 -#define P2P_STATUS_FAIL_INVALID_PARAM 4 -#define P2P_STATUS_FAIL_UNABLE_ACCOMMODATE_REQ 5 -#define P2P_STATUS_FAIL_PREVIOUS_PROTOCOL_ERR 6 -#define P2P_STATUS_FAIL_NO_COMMON_CHANNELS 7 -#define P2P_STATUS_FAIL_UNKNOWN_P2P_GROUP 8 -#define P2P_STATUS_FAIL_SAME_INTENT_VALUE_15 9 -#define P2P_STATUS_FAIL_INCOMPATIBLE_PROVISION_METHOD 10 -#define P2P_STATUS_FAIL_REJECTED_BY_USER 11 - - -/* P2P 4.1.3 - P2P Minor Reason Code definitions */ -#define P2P_REASON_SUCCESS 0 -#define P2P_REASON_DISASSOCIATED_DUE_CROSS_CONNECTION 1 -#define P2P_REASON_DISASSOCIATED_DUE_UNMANAGEABLE 2 -#define P2P_REASON_DISASSOCIATED_DUE_NO_P2P_COEXIST_PARAM 3 -#define P2P_REASON_DISASSOCIATED_DUE_MANAGEABLE 4 - - -/* P2P 4.1.4 - Device Capability Bitmap definitions */ -#define P2P_DEV_CAPABILITY_SERVICE_DISCOVERY BIT(0) -#define P2P_DEV_CAPABILITY_CLIENT_DISCOVERABILITY BIT(1) -#define P2P_DEV_CAPABILITY_CONCURRENT_OPERATION BIT(2) -#define P2P_DEV_CAPABILITY_P2P_INFRA_MANAGED BIT(3) -#define P2P_DEV_CAPABILITY_P2P_DEVICE_LIMIT BIT(4) -#define P2P_DEV_CAPABILITY_P2P_INVITATION_PROCEDURE BIT(5) - - -/* P2P 4.1.4 - Group Capability Bitmap definitions */ -#define P2P_GROUP_CAPABILITY_P2P_GROUP_OWNER BIT(0) -#define P2P_GROUP_CAPABILITY_PERSISTENT_P2P_GROUP BIT(1) -#define P2P_GROUP_CAPABILITY_P2P_GROUP_LIMIT BIT(2) -#define P2P_GROUP_CAPABILITY_INTRA_BSS_DISTRIBUTION BIT(3) -#define P2P_GROUP_CAPABILITY_CROSS_CONNECTION BIT(4) -#define P2P_GROUP_CAPABILITY_PERSISTENT_RECONNECT BIT(5) -#define P2P_GROUP_CAPABILITY_GROUP_FORMATION BIT(6) - -/* P2P 4.1.6 - GO Intent field definitions */ -#define P2P_GO_INTENT_TIE_BREAKER_FIELD BIT(0) -#define P2P_GO_INTENT_VALUE_MASK BITS(1,7) -#define P2P_GO_INTENT_VALUE_OFFSET 1 - -/* P2P 4.1.12 - Manageability Bitmap definitions */ -#define P2P_DEVICE_MANAGEMENT BIT(0) - -/* P2P 4.1.14 - CTWindow and OppPS Parameters definitions */ -#define P2P_CTW_OPPPS_PARAM_OPPPS_FIELD BIT(7) -#define P2P_CTW_OPPPS_PARAM_CTWINDOW_MASK BITS(0,6) - - -#define ELEM_MAX_LEN_P2P_FOR_PROBE_REQ \ - (P2P_OUI_TYPE_LEN + \ - (P2P_ATTRI_HDR_LEN + P2P_ATTRI_MAX_LEN_P2P_CAPABILITY) + \ - (P2P_ATTRI_HDR_LEN + P2P_ATTRI_MAX_LEN_P2P_DEV_ID) + \ - (P2P_ATTRI_HDR_LEN + P2P_ATTRI_MAX_LEN_LISTEN_CHANNEL) + \ - (P2P_ATTRI_HDR_LEN + P2P_ATTRI_MAX_LEN_OPERATING_CHANNEL)) - -#define ELEM_MAX_LEN_P2P_FOR_ASSOC_REQ \ - (P2P_OUI_TYPE_LEN + \ - (P2P_ATTRI_HDR_LEN + P2P_ATTRI_MAX_LEN_P2P_CAPABILITY) + \ - (P2P_ATTRI_HDR_LEN + P2P_ATTRI_MAX_LEN_EXT_LISTEN_TIMING) + \ - (P2P_ATTRI_HDR_LEN + P2P_ATTRI_MAX_LEN_P2P_DEV_INFO)) - - -/* P2P 4.1.16 - P2P Client Infor Descriptor */ -#define P2P_CLIENT_INFO_DESC_HDR_LEN 1 /* Length(1 octets) */ - -/* P2P 4.1.20 - P2P Invitation Flags Attribute*/ -#define P2P_INVITATION_FLAGS_INVITATION_TYPE BIT(0) -#define P2P_INVITATION_TYPE_INVITATION 0 -#define P2P_INVITATION_TYPE_REINVOKE 1 -//3 /* --------------- WPS Data Element Definitions --------------- */ -/* P2P 4.2.2 - General WSC Attribute */ -#define WSC_ATTRI_HDR_LEN 4 /* ID(2 octet) + Length(2 octets) */ -#define WSC_ATTRI_MAX_LEN_VERSION 1 -#define WSC_ATTRI_MAX_LEN_DEVICE_PASSWORD_ID 2 -#define WSC_ATTRI_LEN_CONFIG_METHOD 2 - -/* WPS 11 - Data Element Definitions */ -#define WPS_ATTRI_ID_VERSION 0x104A -#define WPS_ATTRI_ID_CONFIGURATION_METHODS 0x1008 -#define WPS_ATTRI_ID_DEVICE_PASSWORD 0x1012 -#define WPS_ATTRI_ID_DEVICE_NAME 0x1011 -#define WPS_ATTRI_ID_PRI_DEVICE_TYPE 0x1054 -#define WPS_ATTRI_ID_SEC_DEVICE_TYPE 0x1055 - -#define WPS_MAXIMUM_ATTRIBUTES_CACHE_SIZE 300 - -#define WPS_ATTRI_MAX_LEN_DEVICE_NAME 32 /* 0x1011 */ - -#define WPS_ATTRI_CFG_METHOD_USBA BIT(0) -#define WPS_ATTRI_CFG_METHOD_ETHERNET BIT(1) -#define WPS_ATTRI_CFG_METHOD_LABEL BIT(2) -#define WPS_ATTRI_CFG_METHOD_DISPLAY BIT(3) -#define WPS_ATTRI_CFG_METHOD_EXT_NFC BIT(4) -#define WPS_ATTRI_CFG_METHOD_INT_NFC BIT(5) -#define WPS_ATTRI_CFG_METHOD_NFC_IF BIT(6) -#define WPS_ATTRI_CFG_METHOD_PUSH_BUTTON BIT(7) -#define WPS_ATTRI_CFG_METHOD_KEYPAD BIT(8) - - -#define P2P_FLAGS_PROVISION_COMPLETE 0x00000001 -#define P2P_FLAGS_PROVISION_DISCOVERY_COMPLETE 0x00000002 -#define P2P_FLAGS_PROVISION_DISCOVERY_WAIT_RESPONSE 0x00000004 -#define P2P_FLAGS_PROVISION_DISCOVERY_RESPONSE_WAIT 0x00000008 -#define P2P_FLAGS_MASK_PROVISION 0x00000017 -#define P2P_FLAGS_MASK_PROVISION_COMPLETE 0x00000015 -#define P2P_FLAGS_PROVISION_DISCOVERY_INDICATED 0x00000010 -#define P2P_FLAGS_INVITATION_TOBE_GO 0x00000100 -#define P2P_FLAGS_INVITATION_TOBE_GC 0x00000200 -#define P2P_FLAGS_INVITATION_SUCCESS 0x00000400 -#define P2P_FLAGS_INVITATION_WAITING_TARGET 0x00000800 -#define P2P_FLAGS_MASK_INVITATION 0x00000F00 -#define P2P_FLAGS_FORMATION_ON_GOING 0x00010000 -#define P2P_FLAGS_FORMATION_LOCAL_PWID_RDY 0x00020000 -#define P2P_FLAGS_FORMATION_TARGET_PWID_RDY 0x00040000 -#define P2P_FLAGS_FORMATION_COMPLETE 0x00080000 -#define P2P_FLAGS_MASK_FORMATION 0x000F0000 -#define P2P_FLAGS_DEVICE_DISCOVER_REQ 0x00100000 -#define P2P_FLAGS_DEVICE_DISCOVER_DONE 0x00200000 -#define P2P_FLAGS_DEVICE_INVITATION_WAIT 0x00400000 -#define P2P_FLAGS_DEVICE_SERVICE_DISCOVER_WAIT 0x00800000 -#define P2P_FLAGS_MASK_DEVICE_DISCOVER 0x00F00000 - -#define P2P_FLAGS_DEVICE_FORMATION_REQUEST 0x01000000 - - -/* MACRO for flag operation */ -#define SET_FLAGS(_FlagsVar, _BitsToSet) \ - (_FlagsVar) = ((_FlagsVar) | (_BitsToSet)) - -#define TEST_FLAGS(_FlagsVar, _BitsToCheck) \ - (((_FlagsVar) & (_BitsToCheck)) == (_BitsToCheck)) - -#define CLEAR_FLAGS(_FlagsVar, _BitsToClear) \ - (_FlagsVar) &= ~(_BitsToClear) - - - -#define CFG_DISABLE_WIFI_DIRECT_ENHANCEMENT_I 0 - -#define CFG_DISABLE_WIFI_DIRECT_ENHANCEMENT_II 0 - -#define CFG_DISABLE_WIFI_DIRECT_ENHANCEMENT_III 0 - -#define CFG_DISABLE_WIFI_DIRECT_ENHANCEMENT_IV 0 - -#define CFG_DISABLE_DELAY_PROVISION_DISCOVERY 0 - -#define CFG_CONNECTION_POLICY_2_0 0 - -/* Device Password ID */ -enum wps_dev_password_id { - DEV_PW_DEFAULT = 0x0000, - DEV_PW_USER_SPECIFIED = 0x0001, - DEV_PW_MACHINE_SPECIFIED = 0x0002, - DEV_PW_REKEY = 0x0003, - DEV_PW_PUSHBUTTON = 0x0004, - DEV_PW_REGISTRAR_SPECIFIED = 0x0005 -}; - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -#if defined(WINDOWS_DDK) || defined(WINDOWS_CE) -#pragma pack(1) -#endif - -//3 /* --------------- WFA P2P IE and Attributes --------------- */ - -/* P2P 4.1.1 - P2P Information Element */ -typedef struct _IE_P2P_T { - UINT_8 ucId; /* Element ID */ - UINT_8 ucLength; /* Length */ - UINT_8 aucOui[3]; /* OUI */ - UINT_8 ucOuiType; /* OUI Type */ - UINT_8 aucP2PAttributes[1]; /* P2P Attributes */ -} __KAL_ATTRIB_PACKED__ IE_P2P_T, *P_IE_P2P_T; - -/* P2P 4.1.1 - General P2P Attribute */ -typedef struct _P2P_ATTRIBUTE_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 aucBody[1]; /* Body field */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRIBUTE_T, ATTRIBUTE_HDR_T, *P_P2P_ATTRIBUTE_T, *P_ATTRIBUTE_HDR_T; - - -/* P2P 4.1.2 - P2P Status Attribute */ -typedef struct _P2P_ATTRI_STATUS_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 ucStatusCode; /* Status Code */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_STATUS_T, *P_P2P_ATTRI_STATUS_T; - - -/* P2P 4.1.3 - P2P Minor Reason Code Attribute */ -typedef struct _P2P_ATTRI_REASON_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 ucMinorReasonCode; /* Minor Reason Code */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_REASON_T, *P_P2P_ATTRI_REASON_T; - - -/* P2P 4.1.4 - P2P Capability Attribute */ -typedef struct _P2P_ATTRI_CAPABILITY_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 ucDeviceCap; /* Device Capability Bitmap */ - UINT_8 ucGroupCap; /* Group Capability Bitmap */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_CAPABILITY_T, *P_P2P_ATTRI_CAPABILITY_T; - - -/* P2P 4.1.5 - P2P Device ID Attribute */ -typedef struct _P2P_ATTRI_DEV_ID_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 aucDevAddr[MAC_ADDR_LEN]; /* P2P Device Address */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_DEV_ID_T, *P_P2P_ATTRI_DEV_ID_T; - - -/* P2P 4.1.6 - Group Owner Intent Attribute */ -typedef struct _P2P_ATTRI_GO_INTENT_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 ucGOIntent; /* Group Owner Intent */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_GO_INTENT_T, *P_P2P_ATTRI_GO_INTENT_T; - - -/* P2P 4.1.7 - Configuration Timeout Attribute */ -typedef struct _P2P_ATTRI_CFG_TIMEOUT_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 ucGOCfgTimeout; /* GO Configuration Timeout */ - UINT_8 ucClientCfgTimeout; /* Client Configuration Timeout */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_CFG_TIMEOUT_T, *P_P2P_ATTRI_CFG_TIMEOUT_T; - - -/* P2P 4.1.8 - Listen Channel Attribute */ -typedef struct _P2P_ATTRI_LISTEN_CHANNEL_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 aucCountryString[3]; /* Country String */ - UINT_8 ucOperatingClass; /* Operating Class from 802.11 Annex J/P802.11 REVmb 3.0 */ - UINT_8 ucChannelNumber; /* Channel Number */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_LISTEN_CHANNEL_T, *P_P2P_ATTRI_LISTEN_CHANNEL_T; - - -/* P2P 4.1.9 - P2P Group BSSID Attribute */ -typedef struct _P2P_ATTRI_GROUP_BSSID_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 aucBssid[MAC_ADDR_LEN]; /* P2P Group BSSID */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_GROUP_BSSID_T, *P_P2P_ATTRI_GROUP_BSSID_T; - - -/* P2P 4.1.10 - Extended Listen Timing Attribute */ -typedef struct _P2P_ATTRI_EXT_LISTEN_TIMING_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_16 u2AvailPeriod; /* Availability Period */ - UINT_16 u2AvailInterval; /* Availability Interval */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_EXT_LISTEN_TIMING_T, *P_P2P_ATTRI_EXT_LISTEN_TIMING_T; - - -/* P2P 4.1.11 - Intended P2P Interface Address Attribute */ -typedef struct _P2P_ATTRI_INTENDED_IF_ADDR_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 aucIfAddr[MAC_ADDR_LEN];/* P2P Interface Address */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_INTENDED_IF_ADDR_T, *P_P2P_ATTRI_INTENDED_IF_ADDR_T; - - -/* P2P 4.1.12 - P2P Manageability Attribute */ -typedef struct _P2P_ATTRI_MANAGEABILITY_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 ucManageability; /* P2P Manageability Bitmap */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_MANAGEABILITY_T, *P_P2P_ATTRI_MANAGEABILITY_T; - - -/* P2P 4.1.13 - Channel List Attribute */ -typedef struct _P2P_ATTRI_CHANNEL_LIST_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 aucCountryString[3]; /* Country String */ - UINT_8 aucChannelEntry[1]; /* Channel Entry List */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_CHANNEL_T, *P_P2P_ATTRI_CHANNEL_T; - -typedef struct _CHANNEL_ENTRY_FIELD_T { - UINT_8 ucRegulatoryClass; /* Regulatory Class */ - UINT_8 ucNumberOfChannels; /* Number Of Channels */ - UINT_8 aucChannelList[1]; /* Channel List */ -} __KAL_ATTRIB_PACKED__ CHANNEL_ENTRY_FIELD_T, *P_CHANNEL_ENTRY_FIELD_T; - - -/* P2P 4.1.14 - Notice of Absence Attribute */ -typedef struct _P2P_ATTRI_NOA_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 ucIndex; /* Index */ - UINT_8 ucCTWOppPSParam; /* CTWindow and OppPS Parameters */ - UINT_8 aucNoADesc[1]; /* NoA Descriptor */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_NOA_T, *P_P2P_ATTRI_NOA_T; - -typedef struct _NOA_DESCRIPTOR_T { - UINT_8 ucCountType; /* Count/Type */ - UINT_32 u4Duration; /* Duration */ - UINT_32 u4Interval; /* Interval */ - UINT_32 u4StartTime; /* Start Time */ -} __KAL_ATTRIB_PACKED__ NOA_DESCRIPTOR_T, *P_NOA_DESCRIPTOR_T; - -typedef struct _P2P_ATTRI_DEV_INFO_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 aucDevAddr[MAC_ADDR_LEN]; /* P2P Device Address */ - UINT_16 u2ConfigMethodsBE; /* Config Method */ - DEVICE_TYPE_T rPrimaryDevTypeBE; /* Primary Device Type */ - UINT_8 ucNumOfSecondaryDevType; /* Number of Secondary Device Types */ - DEVICE_TYPE_T arSecondaryDevTypeListBE[1]; /* Secondary Device Type List */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_DEV_INFO_T, *P_P2P_ATTRI_DEV_INFO_T; - -/* WPS 7.1 & 11 WPS TLV Data Format - Device Name */ -typedef struct _DEVICE_NAME_TLV_T { - UINT_16 u2Id; /* WPS Attribute Type */ - UINT_16 u2Length; /* Data Length */ - UINT_8 aucName[32]; /* Device Name */ // TODO: Fixme -} __KAL_ATTRIB_PACKED__ DEVICE_NAME_TLV_T, *P_DEVICE_NAME_TLV_T; - - -/* P2P 4.1.16 - P2P Group Info Attribute */ -typedef struct _P2P_CLIENT_INFO_DESC_T { - UINT_8 ucLength; /* Length */ - UINT_8 aucDevAddr[MAC_ADDR_LEN]; /* P2P Device Address */ - UINT_8 aucIfAddr[MAC_ADDR_LEN]; /* P2P Interface Address */ - UINT_8 ucDeviceCap; /* Device Capability Bitmap */ - UINT_16 u2ConfigMethodsBE; /* Config Method */ - DEVICE_TYPE_T rPrimaryDevTypeBE; /* Primary Device Type */ - UINT_8 ucNumOfSecondaryDevType; /* Number of Secondary Device Types */ - DEVICE_TYPE_T arSecondaryDevTypeListBE[1]; /* Secondary Device Type List */ -} __KAL_ATTRIB_PACKED__ P2P_CLIENT_INFO_DESC_T, *P_P2P_CLIENT_INFO_DESC_T; - -typedef struct _P2P_ATTRI_GROUP_INFO_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - P2P_CLIENT_INFO_DESC_T arClientDesc[1]; /* P2P Client Info Descriptors */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_GROUP_INFO_T, *P_P2P_ATTRI_GROUP_INFO_T; - - -/* P2P 4.1.17 - P2P Group ID Attribute */ -typedef struct _P2P_ATTRI_GROUP_ID_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 aucDevAddr[MAC_ADDR_LEN]; /* P2P Device Address */ - UINT_8 aucSSID[ELEM_MAX_LEN_SSID]; /* SSID */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_GROUP_ID_T, *P_P2P_ATTRI_GROUP_ID_T; - - -/* P2P 4.1.18 - P2P Interface Attribute */ -typedef struct _P2P_ATTRI_INTERFACE_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 aucDevAddr[MAC_ADDR_LEN]; /* P2P Device Address */ - UINT_8 ucIfAddrCount; /* P2P Interface Address Count */ - UINT_8 aucIfAddrList[MAC_ADDR_LEN];/* P2P Interface Address List */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_INTERFACE_T, *P_P2P_ATTRI_INTERFACE_T; - - -/* P2P 4.1.19 - Operating Channel Attribute */ -typedef struct _P2P_ATTRI_OPERATING_CHANNEL_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 aucCountryString[3]; /* Country String */ - UINT_8 ucOperatingClass; /* Operating Class from 802.11 Annex J/P802.11 REVmb 3.0 */ - UINT_8 ucChannelNumber; /* Channel Number */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_OPERATING_CHANNEL_T, *P_P2P_ATTRI_OPERATING_CHANNEL_T; - -/* P2P 4.1.20 - Invitation Flags Attribute */ -typedef struct _P2P_ATTRI_INVITATION_FLAG_T { - UINT_8 ucId; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 ucInviteFlagsBitmap; /* Invitation Flags Bitmap */ -} __KAL_ATTRIB_PACKED__ P2P_ATTRI_INVITATION_FLAG_T, *P_P2P_ATTRI_INVITATION_FLAG_T; - - - -/* P2P 4.1.1 - General WSC Attribute */ -typedef struct _WSC_ATTRIBUTE_T { - UINT_16 u2Id; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 aucBody[1]; /* Body field */ -} __KAL_ATTRIB_PACKED__ WSC_ATTRIBUTE_T, *P_WSC_ATTRIBUTE_T; - -/* WSC 1.0 Table 28 */ -typedef struct _WSC_ATTRI_VERSION_T { - UINT_16 u2Id; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_8 ucVersion; /* Version 1.0 or 1.1 */ -} __KAL_ATTRIB_PACKED__ WSC_ATTRI_VERSION_T, *P_WSC_ATTRI_VERSION_T; - -typedef struct _WSC_ATTRI_DEVICE_PASSWORD_ID_T { - UINT_16 u2Id; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_16 u2DevPasswordId; /* Device Password ID */ -} __KAL_ATTRIB_PACKED__ WSC_ATTRI_DEVICE_PASSWORD_ID_T, *P_WSC_ATTRI_DEVICE_PASSWORD_ID_T; - - -typedef struct _WSC_ATTRI_CONFIGURATION_METHOD_T { - UINT_16 u2Id; /* Attribute ID */ - UINT_16 u2Length; /* Length */ - UINT_16 u2ConfigMethods; /* Configure Methods */ -} __KAL_ATTRIB_PACKED__ WSC_ATTRI_CONFIGURATION_METHOD_T, *P_WSC_ATTRI_CONFIGURATION_METHOD_T; - - - -#if defined(WINDOWS_DDK) || defined(WINDOWS_CE) -#pragma pack() -#endif - - -//3 /* --------------- WFA P2P Attributes Handler prototype --------------- */ -typedef UINT_32 (*PFN_APPEND_ATTRI_FUNC)(P_ADAPTER_T, BOOLEAN, PUINT_16, PUINT_8, UINT_16); - -typedef VOID (*PFN_HANDLE_ATTRI_FUNC)(P_SW_RFB_T, P_P2P_ATTRIBUTE_T); - -typedef VOID (*PFN_VERIFY_ATTRI_FUNC)(P_SW_RFB_T, P_P2P_ATTRIBUTE_T, PUINT_16); - -typedef UINT_32 (*PFN_CALCULATE_VAR_ATTRI_LEN_FUNC)(P_ADAPTER_T, P_STA_RECORD_T); - - -typedef struct _APPEND_VAR_ATTRI_ENTRY_T { - UINT_16 u2EstimatedFixedAttriLen; /* For fixed length */ - PFN_CALCULATE_VAR_ATTRI_LEN_FUNC pfnCalculateVariableAttriLen; - PFN_APPEND_ATTRI_FUNC pfnAppendAttri; -} APPEND_VAR_ATTRI_ENTRY_T, *P_APPEND_VAR_ATTRI_ENTRY_T; - -typedef enum _ENUM_CONFIG_METHOD_SEL { - ENUM_CONFIG_METHOD_SEL_AUTO, - ENUM_CONFIG_METHOD_SEL_USER, - ENUM_CONFIG_METHOD_SEL_NUM -} ENUM_CONFIG_METHOD_SEL, *P_ENUM_CONFIG_METHOD_SEL; - -typedef enum _ENUM_P2P_FORMATION_POLICY { - ENUM_P2P_FORMATION_POLICY_AUTO = 0, - ENUM_P2P_FORMATION_POLICY_PASSIVE, /* Device would wait GO NEGO REQ instead of sending it actively. */ - ENUM_P2P_FORMATION_POLICY_NUM -} ENUM_P2P_FORMATION_POLICY, P_ENUM_P2P_FORMATION_POLICY; - -typedef enum _ENUM_P2P_INVITATION_POLICY { - ENUM_P2P_INVITATION_POLICY_USER = 0, - ENUM_P2P_INVITATION_POLICY_ACCEPT_FIRST, - ENUM_P2P_INVITATION_POLICY_DENY_ALL, - ENUM_P2P_INVITATION_POLICY_NUM -} ENUM_P2P_INVITATION_POLICY, P_ENUM_P2P_INVITATION_POLICY; - -//3 /* --------------- Data Structure for P2P Operation --------------- */ -//3 /* Session for CONNECTION SETTINGS of P2P */ -struct _P2P_CONNECTION_SETTINGS_T { - UINT_8 ucDevNameLen; - UINT_8 aucDevName[WPS_ATTRI_MAX_LEN_DEVICE_NAME]; - - DEVICE_TYPE_T rPrimaryDevTypeBE; - - ENUM_P2P_FORMATION_POLICY eFormationPolicy; /* Formation Policy. */ - - /*------------WSC Related Param---------------*/ - UINT_16 u2ConfigMethodsSupport; /* Prefered configure method. - * Some device may not have keypad. - */ - ENUM_CONFIG_METHOD_SEL eConfigMethodSelType; - UINT_16 u2TargetConfigMethod; /* Configure method selected by user or auto. */ - UINT_16 u2LocalConfigMethod; /* Configure method of target. */ - BOOLEAN fgIsPasswordIDRdy; - /*------------WSC Related Param---------------*/ - - UINT_8 ucClientConfigTimeout; - UINT_8 ucGoConfigTimeout; - - UINT_8 ucSecondaryDevTypeCount; -#if P2P_MAX_SUPPORTED_SEC_DEV_TYPE_COUNT - DEVICE_TYPE_T arSecondaryDevTypeBE[P2P_MAX_SUPPORTED_SEC_DEV_TYPE_COUNT]; -#endif - - -#if 0 - UINT_8 ucRfChannelListCount; -#if P2P_MAX_SUPPORTED_CHANNEL_LIST_COUNT - UINT_8 aucChannelList[P2P_MAX_SUPPORTED_CHANNEL_LIST_COUNT]; /* Channel Numbering depends on 802.11mb Annex J. */ - -#endif -#else - UINT_8 ucRfChannelListSize; -#if P2P_MAX_SUPPORTED_CHANNEL_LIST_SIZE - UINT_8 aucChannelEntriesField[P2P_MAX_SUPPORTED_CHANNEL_LIST_SIZE]; -#endif -#endif - - /* Go Intent */ - UINT_8 ucTieBreaker; - UINT_8 ucGoIntent; - - /* For Device Capability */ - BOOLEAN fgSupportServiceDiscovery; - BOOLEAN fgSupportClientDiscoverability; - BOOLEAN fgSupportConcurrentOperation; - BOOLEAN fgSupportInfraManaged; - BOOLEAN fgSupportInvitationProcedure; - - /* For Group Capability */ - BOOLEAN fgSupportPersistentP2PGroup; - BOOLEAN fgSupportIntraBSSDistribution; - BOOLEAN fgSupportCrossConnection; - BOOLEAN fgSupportPersistentReconnect; - - BOOLEAN fgP2pGroupLimit; - - BOOLEAN fgSupportOppPS; - UINT_16 u2CTWindow; - - BOOLEAN fgIsScanReqIssued; - BOOLEAN fgIsServiceDiscoverIssued; - - - /*============ Target Device Connection Settings ============*/ - - /* Discover Target Device Info. */ - BOOLEAN fgIsDevId; - BOOLEAN fgIsDevType; - - /* Encryption mode of Target Device */ - ENUM_PARAM_AUTH_MODE_T eAuthMode; - - /* SSID - * 1. AP Mode, this is the desired SSID user specified. - * 2. Client Mode, this is the target SSID to be connected to. - */ - UINT_8 aucSSID[ELEM_MAX_LEN_SSID]; - UINT_8 ucSSIDLen; - - /* Operating channel requested. */ - UINT_8 ucOperatingChnl; - ENUM_BAND_T eBand; - - /* Linten channel requested. */ - UINT_8 ucListenChnl; - - /* For device discover address/type. */ - UINT_8 aucTargetDevAddr[MAC_ADDR_LEN]; /* P2P Device Address, for P2P Device Discovery & P2P Connection. */ - -#if CFG_ENABLE_WIFI_DIRECT - P_P2P_DEVICE_DESC_T prTargetP2pDesc; -#endif - - UINT_8 ucLastStatus; /* P2P FSM would append status attribute according to this field. */ - - -#if !CFG_DISABLE_DELAY_PROVISION_DISCOVERY - UINT_8 ucLastDialogToken; - UINT_8 aucIndicateDevAddr[MAC_ADDR_LEN]; -#endif - -#if 0 - UINT_8 ucTargetRfChannelListCount; -#if P2P_MAX_SUPPORTED_CHANNEL_LIST_COUNT - UINT_8 aucTargetChannelList[P2P_MAX_SUPPORTED_CHANNEL_LIST_COUNT]; /* Channel Numbering depends on 802.11mb Annex J. */ -#endif -#endif - -}; - - -typedef struct _NOA_TIMING_T { - BOOLEAN fgIsInUse; /* Indicate if this entry is in use or not */ - UINT_8 ucCount; /* Count */ - - UINT_8 aucReserved[2]; - - UINT_32 u4Duration; /* Duration */ - UINT_32 u4Interval; /* Interval */ - UINT_32 u4StartTime; /* Start Time */ -} NOA_TIMING_T, *P_NOA_TIMING_T; - -typedef enum _ENUM_P2P_IOCTL_T { - P2P_IOCTL_IDLE = 0, - P2P_IOCTL_DEV_DISCOVER, - P2P_IOCTL_INVITATION_REQ, - P2P_IOCTL_SERV_DISCOVER, - P2P_IOCTL_WAITING, - P2P_IOCTL_NUM -} ENUM_P2P_IOCTL_T; - - - -/*---------------- Service Discovery Related -------------------*/ -typedef enum _ENUM_SERVICE_TX_TYPE_T { - ENUM_SERVICE_TX_TYPE_BY_DA, - ENUM_SERVICE_TX_TYPE_BY_CHNL, - ENUM_SERVICE_TX_TYPE_NUM -} ENUM_SERVICE_TX_TYPE_T; - - -typedef struct _SERVICE_DISCOVERY_FRAME_DATA_T { - QUE_ENTRY_T rQueueEntry; - P_MSDU_INFO_T prSDFrame; - ENUM_SERVICE_TX_TYPE_T eServiceType; - UINT_8 ucSeqNum; - union { - - UINT_8 ucChannelNum; - UINT_8 aucPeerAddr[MAC_ADDR_LEN]; - } uTypeData; - BOOLEAN fgIsTxDoneIndicate; -} SERVICE_DISCOVERY_FRAME_DATA_T, *P_SERVICE_DISCOVERY_FRAME_DATA_T; - - - - -struct _P2P_FSM_INFO_T_DEPRECATED { - /* P2P FSM State */ - ENUM_P2P_STATE_T eCurrentState; - - /* Channel */ - BOOLEAN fgIsChannelRequested; - - - - - - - - - - - ENUM_P2P_STATE_T ePreviousState; - - ENUM_P2P_STATE_T eReturnState; /* Return state after current activity finished or abort. */ - - UINT_8 aucTargetIfAddr[PARAM_MAC_ADDR_LEN]; - P_BSS_DESC_T prTargetBss; /* BSS of target P2P Device. For Connection/Service Discovery */ - - P_STA_RECORD_T prTargetStaRec; - - BOOLEAN fgIsRsponseProbe; /* Indicate if P2P FSM can response probe request frame. */ - - /* Sequence number of requested message. */ - UINT_8 ucSeqNumOfReqMsg; /* Used for SAA FSM request message. */ - - /* Channel Privilege */ - UINT_8 ucSeqNumOfChReq; /* Used for Channel Request message. */ - - - UINT_8 ucSeqNumOfScnMsg; /* Used for SCAN FSM request message. */ - UINT_8 ucSeqNumOfCancelMsg; - - UINT_8 ucDialogToken; - UINT_8 ucRxDialogToken; - - /* Timer */ - TIMER_T rDeviceDiscoverTimer; /* For device discovery time of each discovery request from user.*/ - TIMER_T rOperationListenTimer; /* For Find phase under operational state. */ - TIMER_T rFSMTimer; /* A timer used for Action frame timeout usage. */ - - TIMER_T rRejoinTimer; /* A timer used for Action frame timeout usage. */ - - - /* Flag to indicate Provisioning */ - BOOLEAN fgIsConnectionRequested; - - /* Current IOCTL. */ - ENUM_P2P_IOCTL_T eP2pIOCTL; - - UINT_8 ucAvailableAuthTypes; /* Used for AUTH_MODE_AUTO_SWITCH */ - - /*--------SERVICE DISCOVERY--------*/ - QUE_T rQueueGASRx; /* Input Request/Response. */ - QUE_T rQueueGASTx; /* Output Response. */ - P_SERVICE_DISCOVERY_FRAME_DATA_T prSDRequest; - UINT_8 ucVersionNum; /* GAS packet sequence number for...Action Frame? */ - UINT_8 ucGlobalSeqNum; /* Sequence Number of RX SD packet. */ - /*--------Service DISCOVERY--------*/ - - /*--------DEVICE DISCOVERY---------*/ - UINT_8 aucTargetGroupID[PARAM_MAC_ADDR_LEN]; - UINT_16 u2TargetGroupSsidLen; - UINT_8 aucTargetSsid[32]; - UINT_8 aucSearchingP2pDevice[PARAM_MAC_ADDR_LEN]; - UINT_8 ucDLToken; - /*----------------------------------*/ - - /* Indicating Peer Status. */ - UINT_32 u4Flags; - - /*Indicating current running mode.*/ - BOOLEAN fgIsApMode; - - - /*------------INVITATION------------*/ - ENUM_P2P_INVITATION_POLICY eInvitationRspPolicy; - /*----------------------------------*/ - -}; - - - -struct _P2P_SPECIFIC_BSS_INFO_T { - /* For GO(AP) Mode - Compose TIM IE */ - UINT_16 u2SmallestAID; - UINT_16 u2LargestAID; - UINT_8 ucBitmapCtrl; - //UINT_8 aucPartialVirtualBitmap[MAX_LEN_TIM_PARTIAL_BMP]; - - /* For GC/GO OppPS */ - BOOLEAN fgEnableOppPS; - UINT_16 u2CTWindow; - - /* For GC/GO NOA */ - UINT_8 ucNoAIndex; - UINT_8 ucNoATimingCount; /* Number of NoA Timing */ - NOA_TIMING_T arNoATiming[P2P_MAXIMUM_NOA_COUNT]; - - BOOLEAN fgIsNoaAttrExisted; - - /* For P2P Device */ - UINT_8 ucRegClass; /* Regulatory Class for channel. */ - UINT_8 ucListenChannel; /* Linten Channel only on channels 1, 6 and 11 in the 2.4 GHz. */ - - UINT_8 ucPreferredChannel; /* Operating Channel, should be one of channel list in p2p connection settings. */ - ENUM_CHNL_EXT_T eRfSco; - ENUM_BAND_T eRfBand; - - /* Extened Listen Timing. */ - UINT_16 u2AvailabilityPeriod; - UINT_16 u2AvailabilityInterval; - - -#if 0 //LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - UINT_16 u2IELenForBCN; - UINT_8 aucBeaconIECache[P2P_MAXIMUM_ATTRIBUTES_CACHE_SIZE + WPS_MAXIMUM_ATTRIBUTES_CACHE_SIZE]; - -// UINT_16 u2IELenForProbeRsp; -// UINT_8 aucProbeRspIECache[P2P_MAXIMUM_ATTRIBUTES_CACHE_SIZE + WPS_MAXIMUM_ATTRIBUTES_CACHE_SIZE]; - - UINT_16 u2IELenForAssocRsp; - UINT_8 aucAssocRspIECache[P2P_MAXIMUM_ATTRIBUTES_CACHE_SIZE + WPS_MAXIMUM_ATTRIBUTES_CACHE_SIZE]; - -#else - UINT_16 u2AttributeLen; - UINT_8 aucAttributesCache[P2P_MAXIMUM_ATTRIBUTES_CACHE_SIZE]; - - UINT_16 u2WscAttributeLen; - UINT_8 aucWscAttributesCache[WPS_MAXIMUM_ATTRIBUTES_CACHE_SIZE]; -#endif - UINT_8 aucGroupID[MAC_ADDR_LEN]; - UINT_16 u2GroupSsidLen; - UINT_8 aucGroupSsid[ELEM_MAX_LEN_SSID]; - - PARAM_CUSTOM_NOA_PARAM_STRUC_T rNoaParam; - PARAM_CUSTOM_OPPPS_PARAM_STRUC_T rOppPsParam; - -}; - - - - - - - -typedef struct _MSG_P2P_DEVICE_DISCOVER_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_32 u4DevDiscoverTime; /* 0: Infinite, 1~X: in unit of MS. */ - BOOLEAN fgIsSpecificType; -#if CFG_ENABLE_WIFI_DIRECT - P2P_DEVICE_TYPE_T rTargetDeviceType; -#endif - UINT_8 aucTargetDeviceID[MAC_ADDR_LEN]; -} MSG_P2P_DEVICE_DISCOVER_T, *P_MSG_P2P_DEVICE_DISCOVER_T; - - - -typedef struct _MSG_P2P_INVITATION_REQUEST_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 aucDeviceID[MAC_ADDR_LEN]; /* Target Device ID to be invited. */ -} MSG_P2P_INVITATION_REQUEST_T, *P_MSG_P2P_INVITATION_REQUEST_T; - -typedef struct _MSG_P2P_FUNCTION_SWITCH_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - BOOLEAN fgIsFuncOn; -} MSG_P2P_FUNCTION_SWITCH_T, *P_MSG_P2P_FUNCTION_SWITCH_T; - -typedef struct _MSG_P2P_SERVICE_DISCOVERY_REQUEST_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 aucDeviceID[MAC_ADDR_LEN]; - BOOLEAN fgNeedTxDoneIndicate; - UINT_8 ucSeqNum; -} MSG_P2P_SERVICE_DISCOVERY_REQUEST_T, *P_MSG_P2P_SERVICE_DISCOVERY_REQUEST_T; - - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#define p2pChangeMediaState(_prAdapter, _eNewMediaState) \ - (_prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX].eConnectionState = (_eNewMediaState)); - -#define ATTRI_ID(_fp) (((P_P2P_ATTRIBUTE_T) _fp)->ucId) -#define ATTRI_LEN(_fp) \ - (((UINT_16) ((PUINT_8)&((P_P2P_ATTRIBUTE_T) _fp)->u2Length)[0]) | \ - ((UINT_16) ((PUINT_8)&((P_P2P_ATTRIBUTE_T) _fp)->u2Length)[1] << 8)) - - -#define ATTRI_SIZE(_fp) (P2P_ATTRI_HDR_LEN + ATTRI_LEN(_fp)) - -#define P2P_ATTRI_FOR_EACH(_pucAttriBuf, _u2AttriBufLen, _u2Offset) \ - for ((_u2Offset) = 0; ((_u2Offset) < (_u2AttriBufLen)); \ - (_u2Offset) += ATTRI_SIZE(_pucAttriBuf), ((_pucAttriBuf) += ATTRI_SIZE(_pucAttriBuf)) ) - - -#define P2P_IE(_fp) ((P_IE_P2P_T) _fp) - - -#define WSC_ATTRI_ID(_fp) \ - (((UINT_16) ((PUINT_8)&((P_WSC_ATTRIBUTE_T) _fp)->u2Id)[0] << 8) | \ - ((UINT_16) ((PUINT_8)&((P_WSC_ATTRIBUTE_T) _fp)->u2Id)[1])) - -#define WSC_ATTRI_LEN(_fp) \ - (((UINT_16) ((PUINT_8)&((P_WSC_ATTRIBUTE_T) _fp)->u2Length)[0] << 8) | \ - ((UINT_16) ((PUINT_8)&((P_WSC_ATTRIBUTE_T) _fp)->u2Length)[1])) - - -#define WSC_ATTRI_SIZE(_fp) (WSC_ATTRI_HDR_LEN + WSC_ATTRI_LEN(_fp)) - -#define WSC_ATTRI_FOR_EACH(_pucAttriBuf, _u2AttriBufLen, _u2Offset) \ - for ((_u2Offset) = 0; ((_u2Offset) < (_u2AttriBufLen)); \ - (_u2Offset) += WSC_ATTRI_SIZE(_pucAttriBuf), ((_pucAttriBuf) += WSC_ATTRI_SIZE(_pucAttriBuf)) ) - -#define WSC_IE(_fp) ((P_IE_P2P_T) _fp) - - -#define WFD_ATTRI_SIZE(_fp) (P2P_ATTRI_HDR_LEN + WSC_ATTRI_LEN(_fp)) - -#define WFD_ATTRI_FOR_EACH(_pucAttriBuf, _u2AttriBufLen, _u2Offset) \ - for ((_u2Offset) = 0; ((_u2Offset) < (_u2AttriBufLen)); \ - (_u2Offset) += WFD_ATTRI_SIZE(_pucAttriBuf), ((_pucAttriBuf) += WFD_ATTRI_SIZE(_pucAttriBuf)) ) - - - - -#if DBG - #define ASSERT_BREAK(_exp) \ - { \ - if (!(_exp)) { \ - ASSERT(FALSE); \ - break; \ - } \ - } - -#else - #define ASSERT_BREAK(_exp) -#endif - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/*======P2P State======*/ -VOID -p2pStateInit_LISTEN( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN P_P2P_SPECIFIC_BSS_INFO_T prSP2pBssInfo, - IN UINT_8 ucListenChannel - ); - -VOID -p2pStateAbort_LISTEN( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsChannelExtenstion - ); - -VOID -p2pStateAbort_SEARCH_SCAN( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsChannelExtenstion - ); - -VOID -p2pStateAbort_GO_OPERATION( - IN P_ADAPTER_T prAdapter - ); - -VOID -p2pStateAbort_GC_OPERATION( - IN P_ADAPTER_T prAdapter - ); - -VOID -p2pStateInit_CONFIGURATION( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN P_BSS_INFO_T prP2pBssInfo, - IN P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecBssInfo - ); - -VOID -p2pStateAbort_CONFIGURATION( - IN P_ADAPTER_T prAdapter - ); - -VOID -p2pStateInit_JOIN( - IN P_ADAPTER_T prAdapter - ); - -VOID -p2pStateAbort_JOIN( - IN P_ADAPTER_T prAdapter - ); - -/*====== P2P Functions ======*/ - - -VOID -p2pFuncInitGO( - IN P_ADAPTER_T prAdapter - ); - - - - - -VOID -p2pFuncDisconnect( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN BOOLEAN fgSendDeauth, - IN UINT_16 u2ReasonCode - ); - -VOID -p2pFuncSwitchOPMode( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prP2pBssInfo, - IN ENUM_OP_MODE_T eOpMode, - IN BOOLEAN fgSyncToFW - ); - -VOID -p2pFuncRunEventProvisioningComplete( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -WLAN_STATUS -p2pFuncSetGroupID( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucGroupID, - IN PUINT_8 pucSsid, - IN UINT_8 ucSsidLen - ); - - -WLAN_STATUS -p2pFuncSendDeviceDiscoverabilityReqFrame( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucDestAddr[], - IN UINT_8 ucDialogToken - ); - -WLAN_STATUS -p2pFuncSendDeviceDiscoverabilityRspFrame( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucDestAddr[], - IN UINT_8 ucDialogToken - ); - - -UINT_8 -p2pFuncGetVersionNumOfSD( - IN P_ADAPTER_T prAdapter - ); - -/*====== P2P FSM ======*/ -VOID -p2pFsmRunEventConnectionRequest( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventDeviceDiscoveryRequest( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventDeviceDiscoveryAbort( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventRxGroupNegotiationReqFrame( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -WLAN_STATUS -p2pFsmRunEventGroupNegotiationRequestTxDone( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - -WLAN_STATUS -p2pFsmRunEventGroupNegotiationResponseTxDone( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - -WLAN_STATUS -p2pFsmRunEventGroupNegotiationConfirmTxDone( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - -WLAN_STATUS -p2pFsmRunEventProvisionDiscoveryRequestTxDone( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - -WLAN_STATUS -p2pFsmRunEventProvisionDiscoveryResponseTxDone( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - - -WLAN_STATUS -p2pFsmRunEventInvitationRequestTxDone ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - - - -VOID -p2pFsmRunEventRxDeauthentication( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prSwRfb - ); - -VOID -p2pFsmRunEventRxDisassociation( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prSwRfb - ); - -VOID -p2pFsmRunEventBeaconTimeout( - IN P_ADAPTER_T prAdapter - ); - - - -WLAN_STATUS -p2pFsmRunEventDeauthTxDone( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - - -#if 1 -#endif - - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -/*======Mail Box Event Message=====*/ - - -VOID -p2pFsmRunEventConnectionAbort( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventConnectionTrigger( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - - -VOID -p2pFsmRunEventP2PFunctionSwitch( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventChGrant( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventJoinComplete( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventConnectionPause( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pIndicationOfMediaStateToHost( - IN P_ADAPTER_T prAdapter, - IN ENUM_PARAM_MEDIA_STATE_T eConnectionState, - IN UINT_8 aucTargetAddr[] - ); - -VOID -p2pUpdateBssInfoForJOIN( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prAssocRspSwRfb - ); - -/*======Mail Box Event Message=====*/ - - -VOID -p2pFsmInit( - IN P_ADAPTER_T prAdapter - ); - -VOID -p2pFsmUninit( - IN P_ADAPTER_T prAdapter - ); - -VOID -p2pFsmSteps( - IN P_ADAPTER_T prAdapter, - IN ENUM_P2P_STATE_T eNextState - ); - -VOID -p2pStartGO( - IN P_ADAPTER_T prAdapter - ); - -VOID -p2pAssignSsid( - IN PUINT_8 pucSsid, - IN PUINT_8 pucSsidLen - ); - -VOID -p2pFsmRunEventScanDone( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -p2pFsmRunEventIOReqTimeout( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Param - ); - -VOID -p2pFsmRunEventSearchPeriodTimeout( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Param - ); - -VOID -p2pFsmRunEventFsmTimeout( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Param - ); - -VOID -p2pFsmRunEventRejoinTimeout( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Parm - ); - - - - -/*=============== P2P Function Related ================*/ - -/*=============== P2P Function Related ================*/ - - -#if CFG_TEST_WIFI_DIRECT_GO -VOID -p2pTest( - IN P_ADAPTER_T prAdapter - ); -#endif /* CFG_TEST_WIFI_DIRECT_GO */ - - - - -VOID -p2pGenerateP2P_IEForBeacon( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -VOID -p2pGenerateP2P_IEForAssocReq( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -VOID -p2pGenerateP2P_IEForAssocRsp( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - - -VOID -p2pGenerateP2P_IEForProbeReq( - IN P_ADAPTER_T prAdapter, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - - - - -UINT_32 -p2pCalculateP2P_IELenForBeacon( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ); - -UINT_32 -p2pCalculateP2P_IELenForAssocRsp( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ); - - -UINT_32 -p2pCalculateP2P_IELenForProbeReq( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ); - - - -VOID -p2pGenerateWSC_IEForProbeResp( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -VOID -p2pGenerateWSC_IEForProbeReq( - IN P_ADAPTER_T prAdapter, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - - - -UINT_16 -p2pCalculateWSC_IELenForProbeReq( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ); - -UINT_32 -p2pCalculateWSC_IELenForProbeResp( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ); - -UINT_32 -p2pAppendAttriStatus( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - - - -UINT_32 -p2pAppendAttriCapability( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pAppendAttriGoIntent( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pAppendAttriCfgTimeout( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pAppendAttriGroupBssid( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - - -UINT_32 -p2pAppendAttriDeviceIDForBeacon( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pAppendAttriDeviceIDForProbeReq( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pAppendAttriDeviceIDForDeviceDiscoveryReq( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pAppendAttriListenChannel( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pAppendAttriIntendP2pIfAddr( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - - -UINT_32 -p2pAppendAttriChannelList( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pCalculateAttriLenChannelList( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -UINT_32 -p2pAppendAttriNoA( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pAppendAttriDeviceInfo( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pCalculateAttriLenDeviceInfo( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -UINT_32 -p2pAppendAttriGroupInfo( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pCalculateAttriLenGroupInfo( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - - -UINT_32 -p2pAppendAttriP2pGroupID( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pAppendAttriOperatingChannel( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pAppendAttriInvitationFlag( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - - -VOID -p2pGenerateWscIE ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucOuiType, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize, - IN APPEND_VAR_ATTRI_ENTRY_T arAppendAttriTable[], - IN UINT_32 u4AttriTableSize - ); - -UINT_32 -p2pAppendAttriWSCConfigMethod ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pAppendAttriWSCVersion ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pAppendAttriWSCGONegReqDevPasswordId ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -UINT_32 -p2pAppendAttriWSCGONegRspDevPasswordId ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -WLAN_STATUS -p2pGetWscAttriList( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucOuiType, - IN PUINT_8 pucIE, - IN UINT_16 u2IELength, - OUT PPUINT_8 ppucAttriList, - OUT PUINT_16 pu2AttriListLen - ); - -WLAN_STATUS -p2pGetAttriList ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucOuiType, - IN PUINT_8 pucIE, - IN UINT_16 u2IELength, - OUT PPUINT_8 ppucAttriList, - OUT PUINT_16 pu2AttriListLen - ); - -VOID -p2pRunEventAAATxFail ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -WLAN_STATUS -p2pRunEventAAASuccess ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - - -WLAN_STATUS -p2pRunEventAAAComplete ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -WLAN_STATUS -p2pSendProbeResponseFrame( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -BOOLEAN -p2pFsmRunEventRxProbeRequestFrame( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -VOID -p2pFsmRunEventRxProbeResponseFrame( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN P_BSS_DESC_T prBssDesc - ); - -WLAN_STATUS -p2pRxPublicActionFrame( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -WLAN_STATUS -p2pRxActionFrame( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -VOID -p2pFsmRunEventRxGroupNegotiationRspFrame( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -VOID -p2pFsmRunEventRxGroupNegotiationCfmFrame( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - - -#if 0 // frog -BOOLEAN -scanMatchFilterOfP2P ( - IN P_SW_RFB_T prSWRfb, - IN PP_BSS_DESC_T pprBssDesc - ); -#endif // frog - -VOID -p2pProcessEvent_UpdateNOAParam ( - IN P_ADAPTER_T prAdapter, - UINT_8 ucNetTypeIndex, - P_EVENT_UPDATE_NOA_PARAMS_T prEventUpdateNoaParam - ); - -VOID -p2pFuncCompleteIOCTL( - IN P_ADAPTER_T prAdapter, - IN WLAN_STATUS rWlanStatus - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#ifndef _lint -/* Kevin: we don't have to call following function to inspect the data structure. - * It will check automatically while at compile time. - * We'll need this for porting driver to different RTOS. - */ -__KAL_INLINE__ VOID -p2pDataTypeCheck ( - VOID - ) -{ - DATA_STRUC_INSPECTING_ASSERT(sizeof(IE_P2P_T) == (2+4+1)); // all UINT_8 - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRIBUTE_T) == (3+1)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_STATUS_T) == (3+1)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_REASON_T) == (3+1)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_CAPABILITY_T) == (3+2)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_DEV_ID_T) == (3+6)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_GO_INTENT_T) == (3+1)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_CFG_TIMEOUT_T) == (3+2)); -#if CID52_53_54 - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_LISTEN_CHANNEL_T) == (3+5)); -#else - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_LISTEN_CHANNEL_T) == (3+5)); -#endif - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_GROUP_BSSID_T) == (3+6)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_EXT_LISTEN_TIMING_T) == (3+4)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_INTENDED_IF_ADDR_T) == (3+6)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_MANAGEABILITY_T) == (3+1)); - - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_CHANNEL_T) == (3+4)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(CHANNEL_ENTRY_FIELD_T) == 3); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_NOA_T) == (3+3)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(NOA_DESCRIPTOR_T) == 13); - DATA_STRUC_INSPECTING_ASSERT(sizeof(DEVICE_TYPE_T) == 8); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_DEV_INFO_T) == (3+6+2+8+1+8)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(DEVICE_NAME_TLV_T) == (4+32)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_CLIENT_INFO_DESC_T) == (1+6+6+1+2+8+1+8)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_GROUP_INFO_T) == (3+(1+6+6+1+2+8+1+8))); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_GROUP_ID_T) == (3+38)); - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_INTERFACE_T) == (3+13)); -#if CID52_53_54 - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_OPERATING_CHANNEL_T) == (3+5)); -#else - DATA_STRUC_INSPECTING_ASSERT(sizeof(P2P_ATTRI_OPERATING_CHANNEL_T) == (3+5)); -#endif - - - return; -} -#endif /* _lint */ - -#endif /* _P2P_FSM_H */ - - - - diff --git a/drivers/net/wireless/mt5931/include/mgmt/p2p_func.h b/drivers/net/wireless/mt5931/include/mgmt/p2p_func.h deleted file mode 100755 index 6d9db0274603..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/p2p_func.h +++ /dev/null @@ -1,324 +0,0 @@ -#ifndef _P2P_FUNC_H -#define _P2P_FUNC_H - - -VOID -p2pFuncRequestScan( - IN P_ADAPTER_T prAdapter, - IN P_P2P_SCAN_REQ_INFO_T prScanReqInfo - ); - -VOID -p2pFuncCancelScan( - IN P_ADAPTER_T prAdapter, - IN P_P2P_SCAN_REQ_INFO_T prScanReqInfo - ); - - - -VOID -p2pFuncStartGO( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo, - IN PUINT_8 pucSsidBuf, - IN UINT_8 ucSsidLen, - IN UINT_8 ucChannelNum, - IN ENUM_BAND_T eBand, - IN ENUM_CHNL_EXT_T eSco, - IN BOOLEAN fgIsPureAP - ); - - - -VOID -p2pFuncAcquireCh( - IN P_ADAPTER_T prAdapter, - IN P_P2P_CHNL_REQ_INFO_T prChnlReqInfo - ); - - -VOID -p2pFuncReleaseCh( - IN P_ADAPTER_T prAdapter, - IN P_P2P_CHNL_REQ_INFO_T prChnlReqInfo - ); - -VOID -p2pFuncSetChannel( - IN P_ADAPTER_T prAdapter, - IN P_RF_CHANNEL_INFO_T prRfChannelInfo - ); - - -BOOLEAN -p2pFuncRetryJOIN( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_P2P_JOIN_INFO_T prJoinInfo - ); - -VOID -p2pFuncUpdateBssInfoForJOIN ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prAssocRspSwRfb - ); - - -WLAN_STATUS -p2pFuncTxMgmtFrame( - IN P_ADAPTER_T prAdapter, - IN P_P2P_MGMT_TX_REQ_INFO_T prMgmtTxReqInfo, - IN P_MSDU_INFO_T prMgmtTxMsdu, - IN UINT_64 u8Cookie - ); - -WLAN_STATUS -p2pFuncBeaconUpdate( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prP2pBssInfo, - IN P_P2P_BEACON_UPDATE_INFO_T prBcnUpdateInfo, - IN PUINT_8 pucNewBcnHdr, - IN UINT_32 u4NewHdrLen, - IN PUINT_8 pucNewBcnBody, - IN UINT_32 u4NewBodyLen - ); - - -BOOLEAN -p2pFuncValidateAuth( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN PP_STA_RECORD_T pprStaRec, - OUT PUINT_16 pu2StatusCode - ); - -BOOLEAN -p2pFuncValidateAssocReq( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_16 pu2StatusCode - ); - - -VOID -p2pFuncResetStaRecStatus( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -VOID -p2pFuncInitConnectionSettings( - IN P_ADAPTER_T prAdapter, - IN P_P2P_CONNECTION_SETTINGS_T prP2PConnSettings - ); - - -BOOLEAN -p2pFuncParseCheckForP2PInfoElem( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBuf, - OUT PUINT_8 pucOuiType - ); - - -BOOLEAN -p2pFuncValidateProbeReq( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_32 pu4ControlFlags - ); - -VOID -p2pFuncValidateRxActionFrame( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -BOOLEAN -p2pFuncIsAPMode( - IN P_P2P_FSM_INFO_T prP2pFsmInfo - ); - - -VOID -p2pFuncParseBeaconContent( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prP2pBssInfo, - IN PUINT_8 pucIEInfo, - IN UINT_32 u4IELen - ); - - -P_BSS_DESC_T -p2pFuncKeepOnConnection( - - IN P_ADAPTER_T prAdapter, - IN P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo, - IN P_P2P_CHNL_REQ_INFO_T prChnlReqInfo, - IN P_P2P_SCAN_REQ_INFO_T prScanReqInfo - ); - - -VOID -p2pFuncStoreAssocRspIEBuffer( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - - -VOID -p2pFuncMgmtFrameRegister( - IN P_ADAPTER_T prAdapter, - IN UINT_16 u2FrameType, - IN BOOLEAN fgIsRegistered, - OUT PUINT_32 pu4P2pPacketFilter - ); - -VOID -p2pFuncUpdateMgmtFrameRegister( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4OsFilter - ); - - -VOID -p2pFuncGetStationInfo( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucMacAddr, - OUT P_P2P_STATION_INFO_T prStaInfo - ); - -P_MSDU_INFO_T -p2pFuncProcessP2pProbeRsp( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMgmtTxMsdu - ); - -#if 0 //LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) -UINT_32 -p2pFuncCalculateExtra_IELenForBeacon( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ); - -VOID -p2pFuncGenerateExtra_IEForBeacon( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - - -#else -UINT_32 -p2pFuncCalculateP2p_IELenForBeacon( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ); - - -VOID -p2pFuncGenerateP2p_IEForBeacon( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - - -UINT_32 -p2pFuncCalculateWSC_IELenForBeacon( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ); - -VOID -p2pFuncGenerateWSC_IEForBeacon( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); -#endif -UINT_32 -p2pFuncCalculateP2p_IELenForAssocRsp( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ); - -VOID -p2pFuncGenerateP2p_IEForAssocRsp( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - - -UINT_32 -p2pFuncCalculateP2P_IELen( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec, - IN APPEND_VAR_ATTRI_ENTRY_T arAppendAttriTable[], - IN UINT_32 u4AttriTableSize - ); - -VOID -p2pFuncGenerateP2P_IE( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize, - IN APPEND_VAR_ATTRI_ENTRY_T arAppendAttriTable[], - IN UINT_32 u4AttriTableSize - ); - - -UINT_32 -p2pFuncAppendAttriStatusForAssocRsp( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - - -UINT_32 -p2pFuncAppendAttriExtListenTiming( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ); - -VOID -p2pFuncDissolve( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prP2pBssInfo, - IN BOOLEAN fgSendDeauth, - IN UINT_16 u2ReasonCode - ); - - -P_IE_HDR_T -p2pFuncGetSpecIE( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucIEBuf, - IN UINT_16 u2BufferLen, - IN UINT_8 ucElemID, - IN PBOOLEAN pfgIsMore - ); - -P_ATTRIBUTE_HDR_T -p2pFuncGetSpecAttri( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucOuiType, - IN PUINT_8 pucIEBuf, - IN UINT_16 u2BufferLen, - IN UINT_8 ucAttriID - ); - -#endif diff --git a/drivers/net/wireless/mt5931/include/mgmt/p2p_ie.h b/drivers/net/wireless/mt5931/include/mgmt/p2p_ie.h deleted file mode 100755 index fa5b651e3ee3..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/p2p_ie.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _P2P_IE_H -#define _P2P_IE_H - - -UINT_32 -p2pCalculate_IEForAssocReq( - - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ); - - -VOID -p2pGenerate_IEForAssocReq( - - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - - - -#endif diff --git a/drivers/net/wireless/mt5931/include/mgmt/p2p_rlm.h b/drivers/net/wireless/mt5931/include/mgmt/p2p_rlm.h deleted file mode 100755 index fe20ac38048f..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/p2p_rlm.h +++ /dev/null @@ -1,109 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/include/mgmt/p2p_rlm.h#1 $ -*/ - -/*! \file "rlm.h" - \brief -*/ - - - - -#ifndef _P2P_RLM_H -#define _P2P_RLM_H - - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - - -VOID -rlmBssInitForAP( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ); - -BOOLEAN -rlmUpdateBwByChListForAP ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ); - -VOID -rlmUpdateParamsForAP ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - BOOLEAN fgUpdateBeacon - ); - -VOID -rlmFuncInitialChannelList( - IN P_ADAPTER_T prAdapter - ); - -VOID -rlmFuncCommonChannelList( - IN P_ADAPTER_T prAdapter, - IN P_CHANNEL_ENTRY_FIELD_T prChannelEntryII, - IN UINT_8 ucChannelListSize - ); - -UINT_8 -rlmFuncFindOperatingClass( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucChannelNum - ); - -BOOLEAN -rlmFuncFindAvailableChannel( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucCheckChnl, - IN PUINT_8 pucSuggestChannel, - IN BOOLEAN fgIsSocialChannel, - IN BOOLEAN fgIsDefaultChannel - ); - -ENUM_CHNL_EXT_T -rlmDecideScoForAP ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ); - -#endif diff --git a/drivers/net/wireless/mt5931/include/mgmt/p2p_rlm_obss.h b/drivers/net/wireless/mt5931/include/mgmt/p2p_rlm_obss.h deleted file mode 100755 index fa93d94decde..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/p2p_rlm_obss.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/include/mgmt/p2p_rlm_obss.h#1 $ -*/ - -/*! \file "rlm_obss.h" - \brief -*/ - - - -#ifndef _P2P_RLM_OBSS_H -#define _P2P_RLM_OBSS_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -VOID -rlmRspGenerateObssScanIE ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ); - -VOID -rlmProcessPublicAction ( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb - ); - -VOID -rlmProcessHtAction ( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb - ); - -VOID -rlmHandleObssStatusEventPkt ( - P_ADAPTER_T prAdapter, - P_EVENT_AP_OBSS_STATUS_T prObssStatus - ); - -UINT_8 -rlmObssChnlLevel ( - P_BSS_INFO_T prBssInfo, - ENUM_BAND_T eBand, - UINT_8 ucPriChannel, - ENUM_CHNL_EXT_T eExtend - ); - -VOID -rlmObssScanExemptionRsp ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - P_SW_RFB_T prSwRfb - ); - -#endif diff --git a/drivers/net/wireless/mt5931/include/mgmt/p2p_scan.h b/drivers/net/wireless/mt5931/include/mgmt/p2p_scan.h deleted file mode 100755 index 8ba3199f4b02..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/p2p_scan.h +++ /dev/null @@ -1,127 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/include/mgmt/p2p_scan.h#1 $ -*/ - -/*! \file "scan.h" - \brief - -*/ - - - - -#ifndef _P2P_SCAN_H -#define _P2P_SCAN_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - - -WLAN_STATUS -scanSendDeviceDiscoverEvent ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc, - IN P_SW_RFB_T prSwRfb - ); - -P_P2P_DEVICE_DESC_T -scanSearchTargetP2pDesc( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucDeviceID[], - IN PP_BSS_DESC_T pprBssDesc - ); - -P_P2P_DEVICE_DESC_T -scanFindP2pDeviceDesc( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc, - IN UINT_8 aucMacAddr[], - IN BOOLEAN fgIsDeviceAddr, - IN BOOLEAN fgAddIfNoFound - ); - -P_P2P_DEVICE_DESC_T -scanGetP2pDeviceDesc( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ); - -VOID -scnEventReturnChannel( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucScnSeqNum - ); - -BOOLEAN -scanUpdateP2pDeviceDesc ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ); - -VOID -scanP2pProcessBeaconAndProbeResp( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN P_WLAN_STATUS prStatus, - IN P_BSS_DESC_T prBssDesc, - IN P_WLAN_BEACON_FRAME_T prWlanBeaconFrame - ); - -VOID -scanRemoveAllP2pBssDesc( - P_ADAPTER_T prAdapter - ); - -VOID -scanRemoveP2pBssDesc( - P_ADAPTER_T prAdapter, - P_BSS_DESC_T prBssDesc - ); - - -P_BSS_DESC_T -scanP2pSearchDesc( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prP2pBssInfo, - IN P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo - ); - - - -#endif diff --git a/drivers/net/wireless/mt5931/include/mgmt/p2p_state.h b/drivers/net/wireless/mt5931/include/mgmt/p2p_state.h deleted file mode 100755 index 22bcf1798ce3..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/p2p_state.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _P2P_STATE_H -#define _P2P_STATE_H - -BOOLEAN -p2pStateInit_IDLE( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN P_BSS_INFO_T prP2pBssInfo, - OUT P_ENUM_P2P_STATE_T peNextState - ); - - -VOID -p2pStateAbort_IDLE( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN ENUM_P2P_STATE_T eNextState - ); - -VOID -p2pStateInit_SCAN( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo - ); - -VOID -p2pStateAbort_SCAN( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN ENUM_P2P_STATE_T eNextState - ); - -VOID -p2pStateInit_AP_CHANNEL_DETECT( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo - ); - -VOID -p2pStateAbort_AP_CHANNEL_DETECT( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo, - IN ENUM_P2P_STATE_T eNextState - ); - -VOID -p2pStateInit_CHNL_ON_HAND( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prP2pBssInfo, - IN P_P2P_FSM_INFO_T prP2pFsmInfo - ); - -VOID -p2pStateAbort_CHNL_ON_HAND( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN P_BSS_INFO_T prP2pBssInfo, - IN ENUM_P2P_STATE_T eNextState - ); - - -VOID -p2pStateAbort_REQING_CHANNEL( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN ENUM_P2P_STATE_T eNextState - ); - - -VOID -p2pStateInit_GC_JOIN( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN P_BSS_INFO_T prP2pBssInfo, - IN P_P2P_JOIN_INFO_T prJoinInfo, - IN P_BSS_DESC_T prBssDesc - ); - -VOID -p2pStateAbort_GC_JOIN( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN P_P2P_JOIN_INFO_T prJoinInfo, - IN ENUM_P2P_STATE_T eNextState - ); - -#endif - diff --git a/drivers/net/wireless/mt5931/include/mgmt/privacy.h b/drivers/net/wireless/mt5931/include/mgmt/privacy.h deleted file mode 100755 index 8f6ffd131803..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/privacy.h +++ /dev/null @@ -1,288 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/privacy.h#1 $ -*/ - -/*! \file privacy.h - \brief This file contains the function declaration for privacy.c. -*/ - - - -/* -** $Log: privacy.h $ - * - * 07 24 2010 wh.su - * - * .support the Wi-Fi RSN - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * modify some code for concurrent network. - * - * 06 19 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * consdier the concurrent network setting. - * - * 06 18 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * migration the security related function from firmware. - * - * 03 01 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * Refine the variable and parameter for security. - * - * 02 25 2010 wh.su - * [BORA00000626][MT6620] Refine the remove key flow for WHQL testing - * For support the WHQL test, do the remove key code refine. - * - * Dec 10 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * change the cmd return type - * - * Dec 8 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the function declaration for auth mode and encryption status setting from build connection command - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the function declaration for wapi - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the tx done callback handle function - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the function declaration for mac header privacy bit setting - * - * Dec 4 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the structure for parsing the EAPoL frame - * - * Dec 3 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adjust the class error function parameter - * - * Dec 1 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding some security function declaration - * - * Nov 19 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the ap selection structure - * - * Nov 18 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * -** -*/ - -#ifndef _PRIVACY_H -#define _PRIVACY_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define MAX_KEY_NUM 4 -#define WEP_40_LEN 5 -#define WEP_104_LEN 13 -#define LEGACY_KEY_MAX_LEN 16 -#define CCMP_KEY_LEN 16 -#define TKIP_KEY_LEN 32 -#define MAX_KEY_LEN 32 -#define MIC_RX_KEY_OFFSET 16 -#define MIC_TX_KEY_OFFSET 24 -#define MIC_KEY_LEN 8 - -#define WEP_KEY_ID_FIELD BITS(0,29) -#define KEY_ID_FIELD BITS(0,7) - -#define IS_TRANSMIT_KEY BIT(31) -#define IS_UNICAST_KEY BIT(30) -#define IS_AUTHENTICATOR BIT(28) - -#define CIPHER_SUITE_NONE 0 -#define CIPHER_SUITE_WEP40 1 -#define CIPHER_SUITE_TKIP 2 -#define CIPHER_SUITE_TKIP_WO_MIC 3 -#define CIPHER_SUITE_CCMP 4 -#define CIPHER_SUITE_WEP104 5 -#define CIPHER_SUITE_BIP 6 -#define CIPHER_SUITE_WEP128 7 -#define CIPHER_SUITE_WPI 8 - -#define WPA_KEY_INFO_KEY_TYPE BIT(3) /* 1 = Pairwise, 0 = Group key */ -#define WPA_KEY_INFO_MIC BIT(8) -#define WPA_KEY_INFO_SECURE BIT(9) - -#define MASK_2ND_EAPOL (WPA_KEY_INFO_KEY_TYPE | WPA_KEY_INFO_MIC) - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -typedef struct _IEEE_802_1X_HDR { - UINT_8 ucVersion; - UINT_8 ucType; - UINT_16 u2Length; - /* followed by length octets of data */ -} IEEE_802_1X_HDR, *P_IEEE_802_1X_HDR; - -typedef struct _EAPOL_KEY { - UINT_8 ucType; - /* Note: key_info, key_length, and key_data_length are unaligned */ - UINT_8 aucKeyInfo[2]; /* big endian */ - UINT_8 aucKeyLength[2]; /* big endian */ - UINT_8 aucReplayCounter[8]; - UINT_8 aucKeyNonce[16]; - UINT_8 aucKeyIv[16]; - UINT_8 aucKeyRsc[8]; - UINT_8 aucKeyId[8]; /* Reserved in IEEE 802.11i/RSN */ - UINT_8 aucKeyMic[16]; - UINT_8 aucKeyDataLength[2]; /* big endian */ - /* followed by key_data_length bytes of key_data */ -} EAPOL_KEY, *P_EAPOL_KEY; - -/* WPA2 PMKID candicate structure */ -typedef struct _PMKID_CANDICATE_T { - UINT_8 aucBssid[MAC_ADDR_LEN]; - UINT_32 u4PreAuthFlags; -} PMKID_CANDICATE_T, *P_PMKID_CANDICATE_T; - -#if 0 -/* WPA2 PMKID cache structure */ -typedef struct _PMKID_ENTRY_T { - PARAM_BSSID_INFO_T rBssidInfo; - BOOLEAN fgPmkidExist; -} PMKID_ENTRY_T, *P_PMKID_ENTRY_T; -#endif - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -VOID -secInit( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucNetTypeIdx - ); - -VOID -secSetPortBlocked( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta, - IN BOOLEAN fgPort - ); - -BOOL -secCheckClassError( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN P_STA_RECORD_T prStaRec - ); - -BOOL -secTxPortControlCheck( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN P_STA_RECORD_T prStaRec - ); - -BOOLEAN -secRxPortControlCheck( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSWRfb - ); - -VOID -secSetCipherSuite( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4CipherSuitesFlags - ); - -BOOL -secProcessEAPOL( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN P_STA_RECORD_T prStaRec, - IN PUINT_8 pucPayload, - IN UINT_16 u2PayloadLen - ); - -VOID -secHandleTxDoneCallback( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T pMsduInfo, - IN P_STA_RECORD_T prStaRec, - IN WLAN_STATUS rStatus - ); - -BOOLEAN -secIsProtectedFrame ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsdu, - IN P_STA_RECORD_T prStaRec - ); - -VOID -secClearPmkid( - IN P_ADAPTER_T prAdapter - ); - -BOOLEAN -secRsnKeyHandshakeEnabled( - IN P_ADAPTER_T prAdapter - ); - -BOOLEAN -secTransmitKeyExist( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ); - -BOOLEAN -secEnabledInAis( - IN P_ADAPTER_T prAdapter - ); - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _PRIVACY_H */ - diff --git a/drivers/net/wireless/mt5931/include/mgmt/rate.h b/drivers/net/wireless/mt5931/include/mgmt/rate.h deleted file mode 100755 index 74c4bb0fc440..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/rate.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/rate.h#1 $ -*/ - -/*! \file rate.h - \brief This file contains the rate utility function of - IEEE 802.11 family for MediaTek 802.11 Wireless LAN Adapters. -*/ - - - -/* -** $Log: rate.h $ - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add buildable & linkable ais_fsm.c - * - * related reference are still waiting to be resolved - * -*/ - -#ifndef _RATE_H -#define _RATE_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Routines in rate.c */ -/*----------------------------------------------------------------------------*/ -VOID -rateGetRateSetFromIEs ( - IN P_IE_SUPPORTED_RATE_T prIeSupportedRate, - IN P_IE_EXT_SUPPORTED_RATE_T prIeExtSupportedRate, - OUT PUINT_16 pu2OperationalRateSet, - OUT PUINT_16 pu2BSSBasicRateSet, - OUT PBOOLEAN pfgIsUnknownBSSBasicRate - ); - -VOID -rateGetDataRatesFromRateSet ( - IN UINT_16 u2OperationalRateSet, - IN UINT_16 u2BSSBasicRateSet, - OUT PUINT_8 pucDataRates, - OUT PUINT_8 pucDataRatesLen - ); - -BOOLEAN -rateGetHighestRateIndexFromRateSet ( - IN UINT_16 u2RateSet, - OUT PUINT_8 pucHighestRateIndex - ); - -BOOLEAN -rateGetLowestRateIndexFromRateSet ( - IN UINT_16 u2RateSet, - OUT PUINT_8 pucLowestRateIndex - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _RATE_H */ - diff --git a/drivers/net/wireless/mt5931/include/mgmt/rlm.h b/drivers/net/wireless/mt5931/include/mgmt/rlm.h deleted file mode 100755 index 197202f73e76..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/rlm.h +++ /dev/null @@ -1,451 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/rlm.h#2 $ -*/ - -/*! \file "rlm.h" - \brief -*/ - - - -/* -** $Log: rlm.h $ - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 09 30 2011 cm.chang - * [WCXRP00001020] [MT6620 Wi-Fi][Driver] Handle secondary channel offset of AP in 5GHz band - * . - * - * 04 12 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * . - * - * 01 13 2011 cm.chang - * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module - * Refine function when rcv a 20/40M public action frame - * - * 01 13 2011 cm.chang - * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting - * Use SCO of BSS_INFO to replace user-defined setting variables - * - * 01 12 2011 cm.chang - * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting - * User-defined bandwidth is for 2.4G and 5G individually - * - * 12 07 2010 cm.chang - * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk - * 1. BSSINFO include RLM parameter - * 2. free all sta records when network is disconnected - * - * 12 07 2010 cm.chang - * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant - * 1. Country code is from NVRAM or supplicant - * 2. Change band definition in CMD/EVENT. - * - * 10 18 2010 cm.chang - * [WCXRP00000114] [MT6620 Wi-Fi] [Driver] Fix compiling warning in Linux about RLM network index checking - * Enum member cannot be used as compiling option decision in Linux - * - * 09 10 2010 cm.chang - * NULL - * Always update Beacon content if FW sync OBSS info - * - * 08 31 2010 kevin.huang - * NULL - * Use LINK LIST operation to process SCAN result - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 08 23 2010 chinghwa.yu - * NULL - * Update for BOW. - * - * 08 20 2010 cm.chang - * NULL - * Migrate RLM code to host from FW - * - * 08 16 2010 cp.wu - * NULL - * Replace CFG_SUPPORT_BOW by CFG_ENABLE_BT_OVER_WIFI. - * There is no CFG_SUPPORT_BOW in driver domain source. - * - * 08 02 2010 yuche.tsai - * NULL - * P2P Group Negotiation Code Check in. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Check draft RLM code for HT cap - * - * 06 28 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * 1st draft code for RLM module - * - * 06 02 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add RX HT GF compiling option - * - * 06 02 2010 chinghwa.yu - * [BORA00000563]Add WiFi CoEx BCM module - * Roll back to remove CFG_SUPPORT_BCM_TEST. - * - * 06 01 2010 chinghwa.yu - * [BORA00000563]Add WiFi CoEx BCM module - * Update BCM Test and RW configuration. - * - * 05 31 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add some compiling options to control 11n functions - * - * 05 18 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Ad-hoc Beacon should not carry HT OP and OBSS IEs - * - * 05 17 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * MT6620 does not support L-SIG TXOP - * - * 05 05 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * First draft support for 20/40M bandwidth for AP mode - * - * 04 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW - * - * 04 22 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * First draft code to support protection in AP mode - * - * 04 07 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Different invoking order for WTBL entry of associated AP - * - * 03 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Not carry HT cap when being associated with b/g only AP - * - * 03 03 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Move default value of HT capability to rlm.h - * - * 02 12 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Use bss info array for concurrent handle - * - * 01 22 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support protection and bandwidth switch - * - * 01 08 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * - * Modify the prototype of rlmRecAssocRspHtInfo() - * - * Dec 9 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add several function prototypes for HT operation - * - * Nov 18 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * - * -** -*/ - -#ifndef _RLM_H -#define _RLM_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define ELEM_EXT_CAP_DEFAULT_VAL \ - (ELEM_EXT_CAP_20_40_COEXIST_SUPPORT /*| ELEM_EXT_CAP_PSMP_CAP*/) - - -#if CFG_SUPPORT_RX_STBC - #define FIELD_HT_CAP_INFO_RX_STBC HT_CAP_INFO_RX_STBC_1_SS -#else - #define FIELD_HT_CAP_INFO_RX_STBC HT_CAP_INFO_RX_STBC_NO_SUPPORTED -#endif - -#if CFG_SUPPORT_RX_SGI - #define FIELD_HT_CAP_INFO_SGI_20M HT_CAP_INFO_SHORT_GI_20M - #define FIELD_HT_CAP_INFO_SGI_40M HT_CAP_INFO_SHORT_GI_40M -#else - #define FIELD_HT_CAP_INFO_SGI_20M 0 - #define FIELD_HT_CAP_INFO_SGI_40M 0 -#endif - -#if CFG_SUPPORT_RX_HT_GF - #define FIELD_HT_CAP_INFO_HT_GF HT_CAP_INFO_HT_GF -#else - #define FIELD_HT_CAP_INFO_HT_GF 0 -#endif - -#define HT_CAP_INFO_DEFAULT_VAL \ - (HT_CAP_INFO_SUP_CHNL_WIDTH | FIELD_HT_CAP_INFO_HT_GF | \ - FIELD_HT_CAP_INFO_SGI_20M | FIELD_HT_CAP_INFO_SGI_40M | \ - FIELD_HT_CAP_INFO_RX_STBC | HT_CAP_INFO_DSSS_CCK_IN_40M) - - - -#define AMPDU_PARAM_DEFAULT_VAL \ - (AMPDU_PARAM_MAX_AMPDU_LEN_64K | AMPDU_PARAM_MSS_NO_RESTRICIT) - - -#define SUP_MCS_TX_DEFAULT_VAL \ - SUP_MCS_TX_SET_DEFINED /* TX defined and TX/RX equal (TBD) */ - -#if CFG_SUPPORT_MFB - #define FIELD_HT_EXT_CAP_MFB HT_EXT_CAP_MCS_FEEDBACK_BOTH -#else - #define FIELD_HT_EXT_CAP_MFB HT_EXT_CAP_MCS_FEEDBACK_NO_FB -#endif - -#if CFG_SUPPORT_RX_RDG - #define FIELD_HT_EXT_CAP_RDR HT_EXT_CAP_RD_RESPONDER -#else - #define FIELD_HT_EXT_CAP_RDR 0 -#endif - -#if CFG_SUPPORT_MFB || CFG_SUPPORT_RX_RDG - #define FIELD_HT_EXT_CAP_HTC HT_EXT_CAP_HTC_SUPPORT -#else - #define FIELD_HT_EXT_CAP_HTC 0 -#endif - -#define HT_EXT_CAP_DEFAULT_VAL \ - (HT_EXT_CAP_PCO | HT_EXT_CAP_PCO_TRANS_TIME_NONE | \ - FIELD_HT_EXT_CAP_MFB | FIELD_HT_EXT_CAP_HTC | \ - FIELD_HT_EXT_CAP_RDR) - -#define TX_BEAMFORMING_CAP_DEFAULT_VAL 0 -#define ASEL_CAP_DEFAULT_VAL 0 - - -/* Define bandwidth from user setting */ -#define CONFIG_BW_20_40M 0 -#define CONFIG_BW_20M 1 /* 20MHz only */ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/* It is used for RLM module to judge if specific network is valid - * Note: Ad-hoc mode of AIS is not included now. (TBD) - */ -#define RLM_NET_PARAM_VALID(_prBssInfo) \ - (IS_BSS_ACTIVE(_prBssInfo) && \ - ((_prBssInfo)->eConnectionState == PARAM_MEDIA_STATE_CONNECTED || \ - (_prBssInfo)->eCurrentOPMode == OP_MODE_ACCESS_POINT || \ - (_prBssInfo)->eCurrentOPMode == OP_MODE_IBSS || \ - RLM_NET_IS_BOW(_prBssInfo)) \ - ) - -#define RLM_NET_IS_11N(_prBssInfo) \ - ((_prBssInfo)->ucPhyTypeSet & PHY_TYPE_SET_802_11N) -#define RLM_NET_IS_11GN(_prBssInfo) \ - ((_prBssInfo)->ucPhyTypeSet & PHY_TYPE_SET_802_11GN) - - -/* This macro is used to sweep all 3 networks */ -#define RLM_NET_FOR_EACH(_ucNetIdx) \ - for ((_ucNetIdx) = 0; \ - (_ucNetIdx) < NETWORK_TYPE_INDEX_NUM; \ - (_ucNetIdx)++) - -/* This macro is used to sweep all networks excluding BOW */ -#if CFG_ENABLE_BT_OVER_WIFI - /* Note: value of enum NETWORK_TYPE_BOW_INDEX is validated in - * rlmStuctureCheck(). - */ - #define RLM_NET_FOR_EACH_NO_BOW(_ucNetIdx) \ - for ((_ucNetIdx) = 0; \ - (_ucNetIdx) < NETWORK_TYPE_BOW_INDEX; \ - (_ucNetIdx)++) - - #define RLM_NET_IS_BOW(_prBssInfo) \ - ((_prBssInfo)->ucNetTypeIndex == NETWORK_TYPE_BOW_INDEX) - -#else - #define RLM_NET_FOR_EACH_NO_BOW(_ucNetIdx) RLM_NET_FOR_EACH(_ucNetIdx) - #define RLM_NET_IS_BOW(_prBssInfo) (FALSE) - -#endif /* end of CFG_ENABLE_BT_OVER_WIFI */ - - -/* The bandwidth modes are not used anymore. They represent if AP - * can use 20/40 bandwidth, not all modes. (20110411) - */ -#define RLM_AP_IS_BW_40_ALLOWED(_prAdapter, _prBssInfo) \ - (((_prBssInfo)->eBand == BAND_2G4 && \ - (_prAdapter)->rWifiVar.rConnSettings.uc2G4BandwidthMode \ - == CONFIG_BW_20_40M) || \ - ((_prBssInfo)->eBand == BAND_5G && \ - (_prAdapter)->rWifiVar.rConnSettings.uc5GBandwidthMode \ - == CONFIG_BW_20_40M)) - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -VOID -rlmFsmEventInit ( - P_ADAPTER_T prAdapter - ); - -VOID -rlmFsmEventUninit ( - P_ADAPTER_T prAdapter - ); - -VOID -rlmReqGenerateHtCapIE ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ); - -VOID -rlmReqGenerateExtCapIE ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ); - -VOID -rlmRspGenerateHtCapIE ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ); - -VOID -rlmRspGenerateExtCapIE ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ); - -VOID -rlmRspGenerateHtOpIE ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ); - -VOID -rlmRspGenerateErpIE ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ); - -VOID -rlmProcessBcn ( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb, - PUINT_8 pucIE, - UINT_16 u2IELength - ); - -VOID -rlmProcessAssocRsp ( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb, - PUINT_8 pucIE, - UINT_16 u2IELength - ); - -VOID -rlmFillSyncCmdParam ( - P_CMD_SET_BSS_RLM_PARAM_T prCmdBody, - P_BSS_INFO_T prBssInfo - ); - -VOID -rlmSyncOperationParams ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ); - -VOID -rlmBssInitForAPandIbss ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ); - -VOID -rlmProcessAssocReq ( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb, - PUINT_8 pucIE, - UINT_16 u2IELength - ); - -VOID -rlmBssAborted ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ); - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#ifndef _lint -__KAL_INLINE__ VOID -rlmDataTypeCheck ( - VOID - ) -{ -#if CFG_ENABLE_BT_OVER_WIFI - DATA_STRUC_INSPECTING_ASSERT( - NETWORK_TYPE_AIS_INDEX < NETWORK_TYPE_BOW_INDEX); - - #if CFG_ENABLE_WIFI_DIRECT - DATA_STRUC_INSPECTING_ASSERT( - NETWORK_TYPE_P2P_INDEX < NETWORK_TYPE_BOW_INDEX); - #endif -#endif - - return; -} -#endif /* _lint */ - -#endif /* _RLM_H */ - - diff --git a/drivers/net/wireless/mt5931/include/mgmt/rlm_domain.h b/drivers/net/wireless/mt5931/include/mgmt/rlm_domain.h deleted file mode 100755 index fda01372bf37..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/rlm_domain.h +++ /dev/null @@ -1,358 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/rlm_domain.h#1 $ -*/ - -/*! \file "rlm_domain.h" - \brief -*/ - - - -/* -** $Log: rlm_domain.h $ - * - * 09 29 2011 cm.chang - * NULL - * Change the function prototype of rlmDomainGetChnlList() - * - * 09 08 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * Use new fields ucChannelListMap and ucChannelListIndex in NVRAM - * - * 08 31 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * . - * - * 06 01 2011 cm.chang - * [WCXRP00000756] [MT6620 Wi-Fi][Driver] 1. AIS follow channel of BOW 2. Provide legal channel function - * Provide legal channel function based on domain - * - * 12 07 2010 cm.chang - * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant - * 1. Country code is from NVRAM or supplicant - * 2. Change band definition in CMD/EVENT. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 28 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * 1st draft code for RLM module - * - * 02 23 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add support scan channel 1~14 and update scan result's frequency infou1rwduu`wvpghlqg|n`slk+mpdkb - * - * 01 13 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Provide query function about full channle list. - * - * Dec 1 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Declare public rDomainInfo - * -** -*/ - -#ifndef _RLM_DOMAIN_H -#define _RLM_DOMAIN_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define MAX_SUBBAND_NUM 6 - - -#define COUNTRY_CODE_NULL ((UINT_16)0x0) - -/* ISO/IEC 3166-1 two-character country codes */ -#define COUNTRY_CODE_AG (((UINT_16) 'A' << 8) | (UINT_16) 'G') /* Antigua/Barbuda */ -#define COUNTRY_CODE_AI (((UINT_16) 'A' << 8) | (UINT_16) 'I') /* Anguilla */ -#define COUNTRY_CODE_AR (((UINT_16) 'A' << 8) | (UINT_16) 'T') /* Argentina */ -#define COUNTRY_CODE_AT (((UINT_16) 'A' << 8) | (UINT_16) 'T') /* Austria */ -#define COUNTRY_CODE_AU (((UINT_16) 'A' << 8) | (UINT_16) 'U') /* Australia */ -#define COUNTRY_CODE_AW (((UINT_16) 'A' << 8) | (UINT_16) 'W') /* Aruba */ -#define COUNTRY_CODE_BB (((UINT_16) 'B' << 8) | (UINT_16) 'B') /* Barbados */ -#define COUNTRY_CODE_BE (((UINT_16) 'B' << 8) | (UINT_16) 'E') /* Belgium */ -#define COUNTRY_CODE_BM (((UINT_16) 'B' << 8) | (UINT_16) 'M') /* Bermuda */ -#define COUNTRY_CODE_BO (((UINT_16) 'B' << 8) | (UINT_16) 'O') /* Bolivia */ -#define COUNTRY_CODE_BR (((UINT_16) 'B' << 8) | (UINT_16) 'R') /* Brazil */ -#define COUNTRY_CODE_BS (((UINT_16) 'B' << 8) | (UINT_16) 'S') /* Bahamas */ -#define COUNTRY_CODE_BY (((UINT_16) 'B' << 8) | (UINT_16) 'Y') /* Belarus */ -#define COUNTRY_CODE_CA (((UINT_16) 'C' << 8) | (UINT_16) 'A') /* Canada */ -#define COUNTRY_CODE_CH (((UINT_16) 'C' << 8) | (UINT_16) 'H') /* Switzerland */ -#define COUNTRY_CODE_CL (((UINT_16) 'C' << 8) | (UINT_16) 'L') /* Chile */ -#define COUNTRY_CODE_CN (((UINT_16) 'C' << 8) | (UINT_16) 'N') /* China */ -#define COUNTRY_CODE_CO (((UINT_16) 'C' << 8) | (UINT_16) 'O') /* Colombia */ -#define COUNTRY_CODE_CR (((UINT_16) 'C' << 8) | (UINT_16) 'R') /* Costa Rica */ -#define COUNTRY_CODE_CU (((UINT_16) 'C' << 8) | (UINT_16) 'U') /* Cuba */ -#define COUNTRY_CODE_DE (((UINT_16) 'D' << 8) | (UINT_16) 'E') /* Germany */ -#define COUNTRY_CODE_DK (((UINT_16) 'D' << 8) | (UINT_16) 'K') /* Denmark */ -#define COUNTRY_CODE_DM (((UINT_16) 'D' << 8) | (UINT_16) 'M') /* Dominica */ -#define COUNTRY_CODE_DO (((UINT_16) 'D' << 8) | (UINT_16) 'O') /* Dominican Republic */ -#define COUNTRY_CODE_EC (((UINT_16) 'E' << 8) | (UINT_16) 'C') /* Ecuador */ -#define COUNTRY_CODE_EG (((UINT_16) 'E' << 8) | (UINT_16) 'G') /* Egypt */ -#define COUNTRY_CODE_ES (((UINT_16) 'E' << 8) | (UINT_16) 'S') /* Spain */ -#define COUNTRY_CODE_EU (((UINT_16) 'E' << 8) | (UINT_16) 'U') /* ETSI (Europe) */ -#define COUNTRY_CODE_FI (((UINT_16) 'F' << 8) | (UINT_16) 'I') /* Finland */ -#define COUNTRY_CODE_FR (((UINT_16) 'F' << 8) | (UINT_16) 'R') /* France */ -#define COUNTRY_CODE_GB (((UINT_16) 'G' << 8) | (UINT_16) 'B') /* United Kingdom */ -#define COUNTRY_CODE_GD (((UINT_16) 'G' << 8) | (UINT_16) 'D') /* Grenada */ -#define COUNTRY_CODE_GR (((UINT_16) 'G' << 8) | (UINT_16) 'R') /* Greece */ -#define COUNTRY_CODE_GY (((UINT_16) 'G' << 8) | (UINT_16) 'Y') /* Guyana */ -#define COUNTRY_CODE_HK (((UINT_16) 'H' << 8) | (UINT_16) 'K') /* Hong Kong */ -#define COUNTRY_CODE_HT (((UINT_16) 'H' << 8) | (UINT_16) 'T') /* Haiti */ -#define COUNTRY_CODE_HN (((UINT_16) 'H' << 8) | (UINT_16) 'N') /* Honduras */ -#define COUNTRY_CODE_ID (((UINT_16) 'I' << 8) | (UINT_16) 'D') /* Indonesia */ -#define COUNTRY_CODE_IE (((UINT_16) 'I' << 8) | (UINT_16) 'E') /* Ireland */ -#define COUNTRY_CODE_IL (((UINT_16) 'I' << 8) | (UINT_16) 'L') /* Israel */ -#define COUNTRY_CODE_IN (((UINT_16) 'I' << 8) | (UINT_16) 'N') /* India */ -#define COUNTRY_CODE_IR (((UINT_16) 'I' << 8) | (UINT_16) 'R') /* Iran */ -#define COUNTRY_CODE_IS (((UINT_16) 'I' << 8) | (UINT_16) 'S') /* Iceland */ -#define COUNTRY_CODE_IT (((UINT_16) 'I' << 8) | (UINT_16) 'T') /* Italy */ -#define COUNTRY_CODE_JM (((UINT_16) 'J' << 8) | (UINT_16) 'M') /* Jamaica */ -#define COUNTRY_CODE_JO (((UINT_16) 'J' << 8) | (UINT_16) 'O') /* Jordan */ -#define COUNTRY_CODE_JP (((UINT_16) 'J' << 8) | (UINT_16) 'P') /* Japan */ -#define COUNTRY_CODE_KN (((UINT_16) 'K' << 8) | (UINT_16) 'N') /* Saint Kitts and Nevis */ -#define COUNTRY_CODE_KR (((UINT_16) 'K' << 8) | (UINT_16) 'R') /* South Korea */ -#define COUNTRY_CODE_KW (((UINT_16) 'K' << 8) | (UINT_16) 'W') /* Kuwait */ -#define COUNTRY_CODE_LC (((UINT_16) 'L' << 8) | (UINT_16) 'C') /* Saint Lucia */ -#define COUNTRY_CODE_LI (((UINT_16) 'L' << 8) | (UINT_16) 'I') /* Liechtenstein */ -#define COUNTRY_CODE_LK (((UINT_16) 'L' << 8) | (UINT_16) 'K') /* Sri Lanka */ -#define COUNTRY_CODE_LU (((UINT_16) 'L' << 8) | (UINT_16) 'U') /* Luxembourg */ -#define COUNTRY_CODE_MA (((UINT_16) 'M' << 8) | (UINT_16) 'A') /* Morocco */ -#define COUNTRY_CODE_MD (((UINT_16) 'M' << 8) | (UINT_16) 'D') /* Moldova */ -#define COUNTRY_CODE_MX (((UINT_16) 'M' << 8) | (UINT_16) 'X') /* Mexico */ -#define COUNTRY_CODE_MY (((UINT_16) 'M' << 8) | (UINT_16) 'Y') /* Malaysia */ -#define COUNTRY_CODE_NI (((UINT_16) 'N' << 8) | (UINT_16) 'I') /* Nicaragua */ -#define COUNTRY_CODE_NL (((UINT_16) 'N' << 8) | (UINT_16) 'L') /* Netherlands */ -#define COUNTRY_CODE_NO (((UINT_16) 'N' << 8) | (UINT_16) 'O') /* Norway */ -#define COUNTRY_CODE_NZ (((UINT_16) 'N' << 8) | (UINT_16) 'Z') /* New Zealand */ -#define COUNTRY_CODE_OM (((UINT_16) 'O' << 8) | (UINT_16) 'M') /* Oman */ -#define COUNTRY_CODE_PE (((UINT_16) 'P' << 8) | (UINT_16) 'E') /* Peru */ -#define COUNTRY_CODE_PG (((UINT_16) 'P' << 8) | (UINT_16) 'G') /* Papua New Guinea */ -#define COUNTRY_CODE_PH (((UINT_16) 'P' << 8) | (UINT_16) 'H') /* Philippines */ -#define COUNTRY_CODE_PK (((UINT_16) 'P' << 8) | (UINT_16) 'K') /* Pakistan */ -#define COUNTRY_CODE_PR (((UINT_16) 'P' << 8) | (UINT_16) 'R') /* Puerto Rico */ -#define COUNTRY_CODE_PT (((UINT_16) 'P' << 8) | (UINT_16) 'T') /* Portugal */ -#define COUNTRY_CODE_PY (((UINT_16) 'P' << 8) | (UINT_16) 'Y') /* Paraguay */ -#define COUNTRY_CODE_PZ (((UINT_16) 'P' << 8) | (UINT_16) 'Z') /* Panama */ -#define COUNTRY_CODE_RU (((UINT_16) 'R' << 8) | (UINT_16) 'U') /* Russian */ -#define COUNTRY_CODE_SA (((UINT_16) 'S' << 8) | (UINT_16) 'A') /* Saudi Arabia */ -#define COUNTRY_CODE_SE (((UINT_16) 'S' << 8) | (UINT_16) 'E') /* Sweden */ -#define COUNTRY_CODE_SG (((UINT_16) 'S' << 8) | (UINT_16) 'G') /* Singapore */ -#define COUNTRY_CODE_SR (((UINT_16) 'S' << 8) | (UINT_16) 'R') /* Suriname */ -#define COUNTRY_CODE_TW (((UINT_16) 'T' << 8) | (UINT_16) 'W') /* Taiwan */ -#define COUNTRY_CODE_TH (((UINT_16) 'T' << 8) | (UINT_16) 'H') /* Thailand */ -#define COUNTRY_CODE_TR (((UINT_16) 'T' << 8) | (UINT_16) 'R') /* Turkey */ -#define COUNTRY_CODE_TT (((UINT_16) 'T' << 8) | (UINT_16) 'T') /* Trinidad */ -#define COUNTRY_CODE_UA (((UINT_16) 'U' << 8) | (UINT_16) 'A') /* Ukraine */ -#define COUNTRY_CODE_US (((UINT_16) 'U' << 8) | (UINT_16) 'S') /* United States */ -#define COUNTRY_CODE_UY (((UINT_16) 'U' << 8) | (UINT_16) 'Y') /* Uruguay */ -#define COUNTRY_CODE_VC (((UINT_16) 'V' << 8) | (UINT_16) 'C') /* Saint Vincent */ -#define COUNTRY_CODE_VE (((UINT_16) 'V' << 8) | (UINT_16) 'E') /* Venezuela */ -#define COUNTRY_CODE_VN (((UINT_16) 'V' << 8) | (UINT_16) 'N') /* Vietnam */ - -/* dot11RegDomainsSupportValue */ -#define MIB_REG_DOMAIN_FCC 0x10 /* FCC (US) */ -#define MIB_REG_DOMAIN_IC 0x20 /* IC or DOC (Canada) */ -#define MIB_REG_DOMAIN_ETSI 0x30 /* ETSI (Europe) */ -#define MIB_REG_DOMAIN_SPAIN 0x31 /* Spain */ -#define MIB_REG_DOMAIN_FRANCE 0x32 /* France */ -#define MIB_REG_DOMAIN_JAPAN 0x40 /* MPHPT (Japan) */ -#define MIB_REG_DOMAIN_OTHER 0x00 /* other */ - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/* Define channel offset in unit of 5MHz bandwidth */ -typedef enum _ENUM_CHNL_SPAN_T { - CHNL_SPAN_5 = 1, - CHNL_SPAN_10 = 2, - CHNL_SPAN_20 = 4, - CHNL_SPAN_40 = 8 -} ENUM_CHNL_SPAN_T, *P_ENUM_CHNL_SPAN_T; - -/* Define BSS operating bandwidth */ -typedef enum _ENUM_CHNL_BW_T { - CHNL_BW_20, - CHNL_BW_20_40, - CHNL_BW_10, - CHNL_BW_5 -} ENUM_CHNL_BW_T, *P_ENUM_CHNL_BW_T; - -#if 0 -/* If channel width is CHNL_BW_20_40, the first channel will be SCA and - * the second channel is SCB, then iteratively. - * Note the final channel will not be SCA. - */ -typedef struct _DOMAIN_SUBBAND_INFO { - UINT_8 ucRegClass; - ENUM_BAND_T eBand; - ENUM_CHNL_SPAN_T eChannelSpan; - UINT_8 ucFirstChannelNum; - UINT_8 ucNumChannels; - ENUM_CHNL_BW_T eChannelBw; - BOOLEAN fgDfsNeeded; - BOOLEAN fgIbssProhibited; -} DOMAIN_SUBBAND_INFO, *P_DOMAIN_SUBBAND_INFO; - -/* Use it as all available channel list for STA */ -typedef struct _DOMAIN_INFO_ENTRY { - UINT_16 u2CountryCode; - UINT_16 u2MibRegDomainValue; - - /* If different attributes, put them into different rSubBands. - * For example, DFS shall be used or not. - */ - DOMAIN_SUBBAND_INFO rSubBand[MAX_SUBBAND_NUM]; -} DOMAIN_INFO_ENTRY, *P_DOMAIN_INFO_ENTRY; - -#else /* New definition 20110830 */ - -/* In all bands, the first channel will be SCA and the second channel is SCB, - * then iteratively. - * Note the final channel will not be SCA. - */ -typedef struct _DOMAIN_SUBBAND_INFO { - /* Note1: regulation class depends on operation bandwidth and RF band. - * For example: 2.4GHz, 1~13, 20MHz ==> regulation class = 81 - * 2.4GHz, 1~13, SCA ==> regulation class = 83 - * 2.4GHz, 1~13, SCB ==> regulation class = 84 - * Note2: TX power limit is not specified here because path loss is unknown - */ - UINT_8 ucRegClass; /* Regulation class for 20MHz */ - UINT_8 ucBand; /* Type: ENUM_BAND_T */ - UINT_8 ucChannelSpan; /* Type: ENUM_CHNL_SPAN_T */ - UINT_8 ucFirstChannelNum; - UINT_8 ucNumChannels; - UINT_8 ucReserved; /* Type: BOOLEAN (fgDfsNeeded) */ -} DOMAIN_SUBBAND_INFO, *P_DOMAIN_SUBBAND_INFO; - -/* Use it as all available channel list for STA */ -typedef struct _DOMAIN_INFO_ENTRY { - PUINT_16 pu2CountryGroup; - UINT_32 u4CountryNum; - - /* If different attributes, put them into different rSubBands. - * For example, DFS shall be used or not. - */ - DOMAIN_SUBBAND_INFO rSubBand[MAX_SUBBAND_NUM]; -} DOMAIN_INFO_ENTRY, *P_DOMAIN_INFO_ENTRY; -#endif - -/* The following definitions are not used yet */ -typedef enum _ENUM_CH_SET_2G4_T { - CH_SET_2G4_NA, - CH_SET_2G4_1_11, - CH_SET_2G4_1_13, - CH_SET_2G4_1_14, - CH_SET_2G4_NUM -} ENUM_CH_SET_2G4_T, *P_ENUM_CH_SET_2G4_T; - -typedef enum _ENUM_CH_SET_UNII_LOW_T { - CH_SET_UNII_LOW_NA, - CH_SET_UNII_LOW_36_48, - CH_SET_UNII_LOW_NUM -} ENUM_CH_SET_UNII_LOW_T, *P_ENUM_CH_SET_UNII_LOW_T; - -typedef enum _ENUM_CH_SET_UNII_MID_T { - CH_SET_UNII_MID_NA, - CH_SET_UNII_MID_52_64, - CH_SET_UNII_MID_NUM -} ENUM_CH_SET_UNII_MID_T, *P_ENUM_CH_SET_UNII_MID_T; - -typedef enum _ENUM_CH_SET_UNII_WW_T { - CH_SET_UNII_WW_NA, - CH_SET_UNII_WW_100_128, - CH_SET_UNII_WW_100_140, - CH_SET_UNII_WW_100_116_132_140, - CH_SET_UNII_WW_NUM -} ENUM_CH_SET_UNII_WW_T, *P_ENUM_CH_SET_UNII_WW_T; - -typedef enum _ENUM_CH_SET_UNII_UPPER_T { - CH_SET_UNII_UPPER_NA, - CH_SET_UNII_UPPER_149_161, - CH_SET_UNII_UPPER_149_165, - CH_SET_UNII_UPPER_149_173, - CH_SET_UNII_UPPER_NUM -} ENUM_CH_SET_UNII_UPPER_T, *P_ENUM_CH_SET_UNII_UPPER_T; - -typedef struct _COUNTRY_CH_SET_T { - ENUM_CH_SET_2G4_T e2G4; - ENUM_CH_SET_UNII_LOW_T eUniiLow; - ENUM_CH_SET_UNII_MID_T eUniiMid; - ENUM_CH_SET_UNII_WW_T eUniiWw; - ENUM_CH_SET_UNII_UPPER_T eUniiUpper; -} COUNTRY_CH_SET_T, *P_COUNTRY_CH_SET_T; - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -P_DOMAIN_INFO_ENTRY -rlmDomainGetDomainInfo ( - P_ADAPTER_T prAdapter - ); - -VOID -rlmDomainGetChnlList ( - P_ADAPTER_T prAdapter, - ENUM_BAND_T eSpecificBand, - UINT_8 ucMaxChannelNum, - PUINT_8 pucNumOfChannel, - P_RF_CHANNEL_INFO_T paucChannelList - ); - -VOID -rlmDomainSendCmd ( - P_ADAPTER_T prAdapter, - BOOLEAN fgIsOid - ); - -BOOLEAN -rlmDomainIsLegalChannel ( - P_ADAPTER_T prAdapter, - ENUM_BAND_T eBand, - UINT_8 ucChannel - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _RLM_DOMAIN_H */ - - diff --git a/drivers/net/wireless/mt5931/include/mgmt/rlm_obss.h b/drivers/net/wireless/mt5931/include/mgmt/rlm_obss.h deleted file mode 100755 index 20533c95762f..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/rlm_obss.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/rlm_obss.h#1 $ -*/ - -/*! \file "rlm_obss.h" - \brief -*/ - - - -/* -** $Log: rlm_obss.h $ - * - * 01 24 2011 cm.chang - * [WCXRP00000384] [MT6620 Wi-Fi][Driver][FW] Handle 20/40 action frame in AP mode and stop ampdu timer when sta_rec is freed - * Process received 20/40 coexistence action frame for AP mode - * - * 01 13 2011 cm.chang - * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module - * Refine function when rcv a 20/40M public action frame - * - * 01 12 2011 cm.chang - * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting - * User-defined bandwidth is for 2.4G and 5G individually - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 28 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * 1st draft code for RLM module - * - * 05 07 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Process 20/40 coexistence public action frame in AP mode - * - * 05 05 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * First draft support for 20/40M bandwidth for AP mode - * - * 04 07 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add virtual test for OBSS scan - * - * 03 30 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support 2.4G OBSS scan - * - * 02 13 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support PCO in STA mode - * - * 02 12 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Use bss info array for concurrent handle - * - * 01 25 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support protection and bandwidth switch -*/ - -#ifndef _RLM_OBSS_H -#define _RLM_OBSS_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define CHNL_LIST_SZ_2G 14 -#define CHNL_LIST_SZ_5G 14 - - -#define CHNL_LEVEL0 0 -#define CHNL_LEVEL1 1 -#define CHNL_LEVEL2 2 - -#define AFFECTED_CHNL_OFFSET 5 - -#define OBSS_SCAN_MIN_INTERVAL 10 /* In unit of sec */ - -#define PUBLIC_ACTION_MAX_LEN 200 /* In unit of byte */ - -/* P2P GO only */ -/* Define default OBSS Scan parameters (from MIB in spec.) */ -#define dot11OBSSScanPassiveDwell 20 -#define dot11OBSSScanActiveDwell 10 -#define dot11OBSSScanPassiveTotalPerChannel 200 -#define dot11OBSSScanActiveTotalPerChannel 20 -#define dot11BSSWidthTriggerScanInterval 300 /* Unit: sec */ -#define dot11BSSWidthChannelTransitionDelayFactor 5 -#define dot11OBSSScanActivityThreshold 25 - -#define OBSS_20_40M_TIMEOUT (dot11BSSWidthTriggerScanInterval + 10) - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/* Control MAC PCO function */ -typedef enum _ENUM_SYS_PCO_PHASE_T { - SYS_PCO_PHASE_DISABLED = 0, - SYS_PCO_PHASE_20M, - SYS_PCO_PHASE_40M -} ENUM_SYS_PCO_PHASE_T, *P_ENUM_SYS_PCO_PHASE_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -VOID -rlmObssInit ( - P_ADAPTER_T prAdapter - ); - -VOID -rlmObssScanDone ( - P_ADAPTER_T prAdapter, - P_MSG_HDR_T prMsgHdr - ); - -VOID -rlmObssTriggerScan ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _RLM_OBSS_H */ - diff --git a/drivers/net/wireless/mt5931/include/mgmt/rlm_protection.h b/drivers/net/wireless/mt5931/include/mgmt/rlm_protection.h deleted file mode 100755 index 6025b9044740..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/rlm_protection.h +++ /dev/null @@ -1,126 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/rlm_protection.h#1 $ -*/ - -/*! \file "rlm_protection.h" - \brief -*/ - - - -/* -** $Log: rlm_protection.h $ - * - * 08 20 2010 cm.chang - * NULL - * Migrate RLM code to host from FW - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 28 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * 1st draft code for RLM module - * - * 04 22 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * First draft code to support protection in AP mode - * - * 02 13 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support PCO in STA mode - * - * 02 12 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Use bss info array for concurrent handle - * - * 01 25 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support protection and bandwidth switch -*/ - -#ifndef _RLM_PROTECTION_H -#define _RLM_PROTECTION_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef enum _ENUM_SYS_PROTECT_MODE_T { - SYS_PROTECT_MODE_NONE = 0, /* Mode 0 */ - SYS_PROTECT_MODE_ERP, /* Mode 1 */ - SYS_PROTECT_MODE_NON_HT, /* Mode 2 */ - SYS_PROTECT_MODE_20M, /* Mode 3 */ - - SYS_PROTECT_MODE_NUM -} ENUM_SYS_PROTECT_MODE_T, *P_ENUM_SYS_PROTECT_MODE_T; - -/* This definition follows HT Protection field of HT Operation IE */ -typedef enum _ENUM_HT_PROTECT_MODE_T { - HT_PROTECT_MODE_NONE = 0, - HT_PROTECT_MODE_NON_MEMBER, - HT_PROTECT_MODE_20M, - HT_PROTECT_MODE_NON_HT, - - HT_PROTECT_MODE_NUM -} ENUM_HT_PROTECT_MODE_T, *P_ENUM_HT_PROTECT_MODE_T; - - -typedef enum _ENUM_GF_MODE_T { - GF_MODE_NORMAL = 0, - GF_MODE_PROTECT, - GF_MODE_DISALLOWED, - - GF_MODE_NUM -} ENUM_GF_MODE_T, *P_ENUM_GF_MODE_T; - -typedef enum _ENUM_RIFS_MODE_T { - RIFS_MODE_NORMAL = 0, - RIFS_MODE_DISALLOWED, - - RIFS_MODE_NUM -} ENUM_RIFS_MODE_T, *P_ENUM_RIFS_MODE_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _RLM_PROTECTION_H */ - diff --git a/drivers/net/wireless/mt5931/include/mgmt/roaming_fsm.h b/drivers/net/wireless/mt5931/include/mgmt/roaming_fsm.h deleted file mode 100755 index 2a744f7e3c68..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/roaming_fsm.h +++ /dev/null @@ -1,209 +0,0 @@ -/* -** $Id: -*/ - -/*! \file "roaming_fsm.h" - \brief This file defines the FSM for Roaming MODULE. - - This file defines the FSM for Roaming MODULE. -*/ - - - -/* -** $Log: roaming_fsm.h $ - * - * 08 31 2011 tsaiyuan.hsu - * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver - * remove obsolete code. - * - * 08 15 2011 tsaiyuan.hsu - * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver - * add swcr in driver reg, 0x9fxx0000, to disable roaming . - * - * 03 16 2011 tsaiyuan.hsu - * [WCXRP00000517] [MT6620 Wi-Fi][Driver][FW] Fine Tune Performance of Roaming - * remove obsolete definition and unused variables. - * - * 02 26 2011 tsaiyuan.hsu - * [WCXRP00000391] [MT6620 Wi-Fi][FW] Add Roaming Support - * not send disassoc or deauth to leaving AP so as to improve performace of roaming. - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * -*/ - -#ifndef _ROAMING_FSM_H -#define _ROAMING_FSM_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -/* Roaming Discovery interval, SCAN result need to be updated */ -#define ROAMING_DISCOVERY_TIMEOUT_SEC 5 // Seconds. - -//#define ROAMING_NO_SWING_RCPI_STEP 5 //rcpi -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef enum _ENUM_ROAMING_FAIL_REASON_T { - ROAMING_FAIL_REASON_CONNLIMIT = 0, - ROAMING_FAIL_REASON_NOCANDIDATE, - ROAMING_FAIL_REASON_NUM -} ENUM_ROAMING_FAIL_REASON_T; - -/* events of roaming between driver and firmware */ -typedef enum _ENUM_ROAMING_EVENT_T { - ROAMING_EVENT_START = 0, - ROAMING_EVENT_DISCOVERY, - ROAMING_EVENT_ROAM, - ROAMING_EVENT_FAIL, - ROAMING_EVENT_ABORT, - ROAMING_EVENT_NUM -} ENUM_ROAMING_EVENT_T; - -typedef struct _ROAMING_PARAM_T { - UINT_16 u2Event; - UINT_16 u2Data; -} ROAMING_PARAM_T, *P_ROAMING_PARAM_T; - -/**/ -typedef enum _ENUM_ROAMING_STATE_T { - ROAMING_STATE_IDLE = 0, - ROAMING_STATE_DECISION, - ROAMING_STATE_DISCOVERY, - ROAMING_STATE_ROAM, - ROAMING_STATE_NUM -} ENUM_ROAMING_STATE_T; - -typedef struct _ROAMING_INFO_T { - BOOLEAN fgIsEnableRoaming; - - ENUM_ROAMING_STATE_T eCurrentState; - - OS_SYSTIME rRoamingDiscoveryUpdateTime; - -} ROAMING_INFO_T, *P_ROAMING_INFO_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -#if CFG_SUPPORT_ROAMING -#define IS_ROAMING_ACTIVE(prAdapter) \ - (prAdapter->rWifiVar.rRoamingInfo.eCurrentState == ROAMING_STATE_ROAM) -#else -#define IS_ROAMING_ACTIVE(prAdapter) FALSE -#endif /* CFG_SUPPORT_ROAMING */ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -VOID -roamingFsmInit ( - IN P_ADAPTER_T prAdapter - ); - -VOID -roamingFsmUninit ( - IN P_ADAPTER_T prAdapter - ); - -VOID -roamingFsmSendCmd ( - IN P_ADAPTER_T prAdapter, - IN P_ROAMING_PARAM_T prParam - ); - -VOID -roamingFsmScanResultsUpdate ( - IN P_ADAPTER_T prAdapter - ); - -VOID -roamingFsmSteps ( - IN P_ADAPTER_T prAdapter, - IN ENUM_ROAMING_STATE_T eNextState - ); - -VOID -roamingFsmRunEventStart ( - IN P_ADAPTER_T prAdapter - ); - -VOID -roamingFsmRunEventDiscovery ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Param - ); - -VOID -roamingFsmRunEventRoam ( - IN P_ADAPTER_T prAdapter - ); - -VOID -roamingFsmRunEventFail ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Reason - ); - -VOID -roamingFsmRunEventAbort ( - IN P_ADAPTER_T prAdapter - ); - -WLAN_STATUS -roamingFsmProcessEvent ( - IN P_ADAPTER_T prAdapter, - IN P_ROAMING_PARAM_T prParam - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _ROAMING_FSM_H */ - - - - diff --git a/drivers/net/wireless/mt5931/include/mgmt/rsn.h b/drivers/net/wireless/mt5931/include/mgmt/rsn.h deleted file mode 100755 index dcb05b1fbbfb..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/rsn.h +++ /dev/null @@ -1,380 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/rsn.h#1 $ -*/ - -/*! \file rsn.h - \brief The wpa/rsn related define, macro and structure are described here. -*/ - - - -/* -** $Log: rsn.h $ - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 06 22 2011 wh.su - * [WCXRP00000806] [MT6620 Wi-Fi][Driver] Move the WPA/RSN IE and WAPI IE structure to mac.h and let the sw structure not align at byte - * Move the WAPI/RSN IE to mac.h and SW structure not align to byte, - * Notice needed update P2P.ko. - * - * 03 17 2011 chinglan.wang - * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature - * . - * - * 02 09 2011 wh.su - * [WCXRP00000432] [MT6620 Wi-Fi][Driver] Add STA privacy check at hotspot mode - * adding the code for check STA privacy bit at AP mode, . - * - * 11 05 2010 wh.su - * [WCXRP00000165] [MT6620 Wi-Fi] [Pre-authentication] Assoc req rsn ie use wrong pmkid value - * fixed the.pmkid value mismatch issue - * - * 10 04 2010 wh.su - * [WCXRP00000081] [MT6620][Driver] Fix the compiling error at WinXP while enable P2P - * add a kal function for set cipher. - * - * 09 01 2010 wh.su - * NULL - * adding the wapi support for integration test. - * - * 08 30 2010 wh.su - * NULL - * remove non-used code. - * - * 08 19 2010 wh.su - * NULL - * adding the tx pkt call back handle for countermeasure. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 18 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * migration from MT6620 firmware. - * - * 03 03 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * Fixed the pre-authentication timer not correctly init issue, and modify the security related callback function prototype. - * - * 01 27 2010 wh.su - * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code - * add and fixed some security function. - * - * Dec 4 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adjust the function prototype for generate wap/rsn ie - * - * Dec 3 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adjust the function input parameter - * - * Dec 1 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding some event function declaration - * - * Nov 26 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * move the internal data structure for pmkid to rsn.h - * - * Nov 23 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the port control and class error function - * - * Nov 19 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the pmkid candidate - * - * Nov 18 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * -** -*/ - -#ifndef _RSN_H -#define _RSN_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -/* ----- Definitions for Cipher Suite Selectors ----- */ -#define RSN_CIPHER_SUITE_USE_GROUP_KEY 0x00AC0F00 -#define RSN_CIPHER_SUITE_WEP40 0x01AC0F00 -#define RSN_CIPHER_SUITE_TKIP 0x02AC0F00 -#define RSN_CIPHER_SUITE_CCMP 0x04AC0F00 -#define RSN_CIPHER_SUITE_WEP104 0x05AC0F00 -#if CFG_SUPPORT_802_11W -#define RSN_CIPHER_SUITE_AES_128_CMAC 0x06AC0F00 -#endif - -#define WPA_CIPHER_SUITE_NONE 0x00F25000 -#define WPA_CIPHER_SUITE_WEP40 0x01F25000 -#define WPA_CIPHER_SUITE_TKIP 0x02F25000 -#define WPA_CIPHER_SUITE_CCMP 0x04F25000 -#define WPA_CIPHER_SUITE_WEP104 0x05F25000 - -/* ----- Definitions for Authentication and Key Management Suite Selectors ----- */ -#define RSN_AKM_SUITE_NONE 0x00AC0F00 -#define RSN_AKM_SUITE_802_1X 0x01AC0F00 -#define RSN_AKM_SUITE_PSK 0x02AC0F00 -#if CFG_SUPPORT_802_11W -#define RSN_AKM_SUITE_802_1X_SHA256 0x05AC0F00 -#define RSN_AKM_SUITE_PSK_SHA256 0x06AC0F00 -#endif - -#define WPA_AKM_SUITE_NONE 0x00F25000 -#define WPA_AKM_SUITE_802_1X 0x01F25000 -#define WPA_AKM_SUITE_PSK 0x02F25000 - -#define ELEM_ID_RSN_LEN_FIXED 20 /* The RSN IE len for associate request */ - -#define ELEM_ID_WPA_LEN_FIXED 22 /* The RSN IE len for associate request */ - -#define MASK_RSNIE_CAP_PREAUTH BIT(0) - -#define GET_SELECTOR_TYPE(x) ((UINT_8)(((x) >> 24) & 0x000000FF)) -#define SET_SELECTOR_TYPE(x, y) x = (((x) & 0x00FFFFFF) | (((UINT_32)(y) << 24) & 0xFF000000)) - -#define AUTH_CIPHER_CCMP 0x00000008 - -/* Cihpher suite flags */ -#define CIPHER_FLAG_NONE 0x00000000 -#define CIPHER_FLAG_WEP40 0x00000001 /* BIT 1 */ -#define CIPHER_FLAG_TKIP 0x00000002 /* BIT 2 */ -#define CIPHER_FLAG_CCMP 0x00000008 /* BIT 4 */ -#define CIPHER_FLAG_WEP104 0x00000010 /* BIT 5 */ -#define CIPHER_FLAG_WEP128 0x00000020 /* BIT 6 */ - -#define WAIT_TIME_IND_PMKID_CANDICATE_SEC 6 /* seconds */ -#define TKIP_COUNTERMEASURE_SEC 60 /* seconds */ - -#if CFG_SUPPORT_802_11W -#define RSN_AUTH_MFP_DISABLED 0 /* MFP disabled */ -#define RSN_AUTH_MFP_OPTIONAL 1 /* MFP optional */ -#define RSN_AUTH_MFP_REQUIRED 2 /* MFP required */ -#endif - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/* Flags for PMKID Candidate list structure */ -#define EVENT_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01 - - -#define CONTROL_FLAG_UC_MGMT_NO_ENC BIT(5) - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#define RSN_IE(fp) ((P_RSN_INFO_ELEM_T) fp) -#define WPA_IE(fp) ((P_WPA_INFO_ELEM_T) fp) - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -BOOLEAN -rsnParseRsnIE( - IN P_ADAPTER_T prAdapter, - IN P_RSN_INFO_ELEM_T prInfoElem, - OUT P_RSN_INFO_T prRsnInfo - ); - -BOOLEAN -rsnParseWpaIE( - IN P_ADAPTER_T prAdapter, - IN P_WPA_INFO_ELEM_T prInfoElem, - OUT P_RSN_INFO_T prWpaInfo - ); - -BOOLEAN -rsnSearchSupportedCipher( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Cipher, - OUT PUINT_32 pu4Index - ); - -BOOLEAN -rsnSearchAKMSuite( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4AkmSuite, - OUT PUINT_32 pu4Index - ); - -BOOLEAN -rsnPerformPolicySelection( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBss - ); - -VOID -rsnGenerateWpaNoneIE( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -VOID -rsnGenerateWPAIE( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -VOID -rsnGenerateRSNIE( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -BOOLEAN -rsnParseCheckForWFAInfoElem( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBuf, - OUT PUINT_8 pucOuiType, - OUT PUINT_16 pu2SubTypeVersion - ); - -#if CFG_SUPPORT_AAA -void -rsnParserCheckForRSNCCMPPSK ( - P_ADAPTER_T prAdapter, - P_RSN_INFO_ELEM_T prIe, - PUINT_16 pu2StatusCode - ); -#endif - -VOID -rsnTkipHandleMICFailure( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta, - IN BOOLEAN fgErrorKeyType - ); - -VOID -rsnSelectPmkidCandidateList( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ); - -VOID -rsnUpdatePmkidCandidateList( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ); - -BOOLEAN -rsnSearchPmkidEntry( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBssid, - OUT PUINT_32 pu4EntryIndex - ); - -BOOLEAN -rsnCheckPmkidCandicate( - IN P_ADAPTER_T prAdapter - ); - -VOID -rsnCheckPmkidCache( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBss - ); - -VOID -rsnGeneratePmkidIndication( - IN P_ADAPTER_T prAdapter - ); - -VOID -rsnIndicatePmkidCand( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Parm - ); -#if CFG_SUPPORT_WPS2 -VOID -rsnGenerateWSCIE( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); -#endif - -#if CFG_SUPPORT_802_11W -UINT_32 -rsnCheckBipKeyInstalled( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -UINT_8 -rsnCheckSaQueryTimeout( - IN P_ADAPTER_T prAdapter - ); - -void -rsnStartSaQueryTimer( - IN P_ADAPTER_T prAdapter - ); - -void -rsnStartSaQuery( - IN P_ADAPTER_T prAdapter - ); - -void -rsnStopSaQuery( - IN P_ADAPTER_T prAdapter - ); - -void -rsnSaQueryRequest( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -void -rsnSaQueryAction( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -BOOLEAN -rsnCheckRxMgmt( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN UINT_8 ucSubtype - ); -#endif -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _RSN_H */ - diff --git a/drivers/net/wireless/mt5931/include/mgmt/scan.h b/drivers/net/wireless/mt5931/include/mgmt/scan.h deleted file mode 100755 index 85ab71281b58..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/scan.h +++ /dev/null @@ -1,847 +0,0 @@ -/* -** $Id: @(#) -*/ - -/*! \file "scan.h" - \brief - -*/ - - - -/* -** $Log: scan.h $ - * - * 01 16 2012 cp.wu - * [MT6620 Wi-Fi][Driver] API and behavior modification for preferred band configuration with corresponding network configuration - * add wlanSetPreferBandByNetwork() for glue layer to invoke for setting preferred band configuration corresponding to network type. - * - * 08 11 2011 cp.wu - * [WCXRP00000830] [MT6620 Wi-Fi][Firmware] Use MDRDY counter to detect empty channel for shortening scan time - * sparse channel detection: - * driver: collect sparse channel information with scan-done event - - * - * 07 18 2011 cp.wu - * [WCXRP00000858] [MT5931][Driver][Firmware] Add support for scan to search for more than one SSID in a single scanning request - * add framework in driver domain for supporting new SCAN_REQ_V2 for more than 1 SSID support as well as uProbeDelay in NDIS 6.x driver model - * - * 06 27 2011 cp.wu - * [WCXRP00000815] [MT6620 Wi-Fi][Driver] allow single BSSID with multiple SSID settings to work around some tricky AP which use space character as hidden SSID - * allow to have a single BSSID with multiple SSID to be presented in scanning result - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 02 09 2011 wh.su - * [WCXRP00000433] [MT6620 Wi-Fi][Driver] Remove WAPI structure define for avoid P2P module with structure miss-align pointer issue - * always pre-allio WAPI related structure for align p2p module. - * - * 01 14 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * Fix compile error. - * - * 09 08 2010 cp.wu - * NULL - * use static memory pool for storing IEs of scanning result. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 31 2010 kevin.huang - * NULL - * Use LINK LIST operation to process SCAN result - * - * 08 30 2010 cp.wu - * NULL - * eliminate klockwork errors - * - * 08 16 2010 cp.wu - * NULL - * add interface for RLM to trigger OBSS-SCAN. - * - * 08 12 2010 yuche.tsai - * NULL - * Add a functio prototype to find p2p descriptor of a bss descriptor directly. - * - * 08 11 2010 yuche.tsai - * NULL - * Add function prototype for return channel. - * modify data structure for scan specific device ID or TYPE. (Move from P2P Connection Settings to Scan Param) - * - * 08 05 2010 yuche.tsai - * NULL - * Check-in P2P Device Discovery Feature. - * - * 08 02 2010 yuche.tsai - * NULL - * P2P Group Negotiation Code Check in. - * - * 07 26 2010 yuche.tsai - * - * Add a option for channel time extention in scan abort command. - * - * 07 21 2010 yuche.tsai - * - * Add for P2P Scan Result Parsing & Saving. - * - * 07 19 2010 yuche.tsai - * - * Scan status "FIND" is used for P2P FSM find state. - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * SCN module is now able to handle multiple concurrent scanning requests - * - * 07 14 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * pass band with channel number information as scan parameter - * - * 07 14 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * remove timer in DRV-SCN. - * - * 07 09 2010 cp.wu - * - * 1) separate AIS_FSM state for two kinds of scanning. (OID triggered scan, and scan-for-connection) - * 2) eliminate PRE_BSS_DESC_T, Beacon/PrebResp is now parsed in single pass - * 3) implment DRV-SCN module, currently only accepts single scan request, other request will be directly dropped by returning BUSY - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add scan uninitialization procedure - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * implementation of DRV-SCN and related mailbox message handling. - * - * 06 25 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * modify Beacon/ProbeResp to complete parsing, - * because host software has looser memory usage restriction - * - * 06 17 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Add P2P related field in SCAN_PARAM_T. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * saa_fsm.c is migrated. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add management dispatching function table. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * restore utility function invoking via hem_mbox to direct calls - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * auth.c is migrated. - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add buildable & linkable ais_fsm.c - * - * related reference are still waiting to be resolved - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add aa_fsm.h, ais_fsm.h, bss.h, mib.h and scan.h. - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 04 13 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * - * Add new HW CH macro support - * - * 03 16 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add AdHoc Mode - * - * 03 10 2010 kevin.huang - * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support - * - * * * * * * Add Channel Manager for arbitration of JOIN and SCAN Req - * - * 02 26 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Modify scanBuildProbeReqFrameCommonIEs() to support P2P SCAN - * - * 02 23 2010 wh.su - * [BORA00000592][MT6620 Wi-Fi] Adding the security related code for driver - * refine the scan procedure, reduce the WPA and WAPI IE parsing, and move the parsing to the time for join. - * - * 02 23 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add support scan channel 1~14 and update scan result's frequency infou1rwduu`wvpghlqg|n`slk+mpdkb - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * 01 27 2010 wh.su - * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code - * add and fixed some security function. - * - * 01 07 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * - * Simplify the process of Beacon during SCAN and remove redundant variable in PRE_BSS_DESC_T - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding variable for wapi ap - * - * Dec 4 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * remove non-used secuirty variavle - * - * Dec 3 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Refine data structure of BSS_DESC_T and PRE_BSS_DESC_T - * - * Nov 24 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add eNetType to rScanParam and revise MGMT Handler with Retain Status - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add ucAvailablePhyTypeSet to BSS_DESC_T - * - * Nov 20 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add aucSrcAddress to SCAN_PARAM_T for P2P's Device Address - * - * Nov 19 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the security related variable - * - * Nov 18 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the security ie filed for scan parsing - * - * Nov 16 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add scanSearchBssDescByPolicy() - * - * Nov 5 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add function declarations of scan_fsm.c - * - * Oct 30 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add scan.h to source control -** -*/ - -#ifndef _SCAN_H -#define _SCAN_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -/*! Maximum buffer size of SCAN list */ -#define SCN_MAX_BUFFER_SIZE (CFG_MAX_NUM_BSS_LIST * ALIGN_4(sizeof(BSS_DESC_T))) - -#define SCN_RM_POLICY_EXCLUDE_CONNECTED BIT(0) // Remove SCAN result except the connected one. -#define SCN_RM_POLICY_TIMEOUT BIT(1) // Remove the timeout one -#define SCN_RM_POLICY_OLDEST_HIDDEN BIT(2) // Remove the oldest one with hidden ssid -#define SCN_RM_POLICY_SMART_WEAKEST BIT(3) /* If there are more than half BSS which has the - * same ssid as connection setting, remove the weakest one from them - * Else remove the weakest one. - */ -#define SCN_RM_POLICY_ENTIRE BIT(4) // Remove entire SCAN result - -#define SCN_BSS_DESC_SAME_SSID_THRESHOLD 3 /* This is used by POLICY SMART WEAKEST, - * If exceed this value, remove weakest BSS_DESC_T - * with same SSID first in large network. - */ - -#define SCN_BSS_DESC_REMOVE_TIMEOUT_SEC 5 // Second. - /* This is used by POLICY TIMEOUT, - * If exceed this value, remove timeout BSS_DESC_T. - */ - - - - -#define SCN_PROBE_DELAY_MSEC 0 - -#define SCN_ADHOC_BSS_DESC_TIMEOUT_SEC 5 // Second. - -/*----------------------------------------------------------------------------*/ -/* MSG_SCN_SCAN_REQ */ -/*----------------------------------------------------------------------------*/ -#define SCAN_REQ_SSID_WILDCARD BIT(0) -#define SCAN_REQ_SSID_P2P_WILDCARD BIT(1) -#define SCAN_REQ_SSID_SPECIFIED BIT(2) - - -/*----------------------------------------------------------------------------*/ -/* Support Multiple SSID SCAN */ -/*----------------------------------------------------------------------------*/ -#define SCN_SSID_MAX_NUM 4 - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef enum _ENUM_SCAN_TYPE_T { - SCAN_TYPE_PASSIVE_SCAN = 0, - SCAN_TYPE_ACTIVE_SCAN, - SCAN_TYPE_NUM -} ENUM_SCAN_TYPE_T, *P_ENUM_SCAN_TYPE_T; - -typedef enum _ENUM_SCAN_STATE_T { - SCAN_STATE_IDLE = 0, - SCAN_STATE_SCANNING, - SCAN_STATE_NUM -} ENUM_SCAN_STATE_T; - -typedef enum _ENUM_SCAN_CHANNEL_T { - SCAN_CHANNEL_FULL = 0, - SCAN_CHANNEL_2G4, - SCAN_CHANNEL_5G, - SCAN_CHANNEL_P2P_SOCIAL, - SCAN_CHANNEL_SPECIFIED, - SCAN_CHANNEL_NUM -} ENUM_SCAN_CHANNEL, *P_ENUM_SCAN_CHANNEL; - -typedef struct _MSG_SCN_FSM_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_32 u4Dummy; -} MSG_SCN_FSM_T, *P_MSG_SCN_FSM_T; - - - -/*----------------------------------------------------------------------------*/ -/* BSS Descriptors */ -/*----------------------------------------------------------------------------*/ -struct _BSS_DESC_T { - LINK_ENTRY_T rLinkEntry; - - UINT_8 aucBSSID[MAC_ADDR_LEN]; - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* For IBSS, the SrcAddr is different from BSSID */ - - BOOLEAN fgIsConnecting; /* If we are going to connect to this BSS - * (JOIN or ROAMING to another BSS), don't - * remove this record from BSS List. - */ - BOOLEAN fgIsConnected; /* If we have connected to this BSS (NORMAL_TR), - * don't removed this record from BSS list. - */ - - BOOLEAN fgIsHiddenSSID; /* When this flag is TRUE, means the SSID - * of this BSS is not known yet. - */ - UINT_8 ucSSIDLen; - UINT_8 aucSSID[ELEM_MAX_LEN_SSID]; - - OS_SYSTIME rUpdateTime; - - ENUM_BSS_TYPE_T eBSSType; - - UINT_16 u2CapInfo; - - UINT_16 u2BeaconInterval; - UINT_16 u2ATIMWindow; - - UINT_16 u2OperationalRateSet; - UINT_16 u2BSSBasicRateSet; - BOOLEAN fgIsUnknownBssBasicRate; - - BOOLEAN fgIsERPPresent; - BOOLEAN fgIsHTPresent; - - UINT_8 ucPhyTypeSet; /* Available PHY Type Set of this BSS */ - - UINT_8 ucChannelNum; - - ENUM_CHNL_EXT_T eSco; /* Record bandwidth for association process - Some AP will send association resp by 40MHz BW */ - ENUM_BAND_T eBand; - - UINT_8 ucDTIMPeriod; - - BOOLEAN fgIsLargerTSF; /* This BSS's TimeStamp is larger than us(TCL == 1 in RX_STATUS_T) */ - - UINT_8 ucRCPI; - - UINT_8 ucWmmFlag; /* A flag to indicate this BSS's WMM capability */ - - /*! \brief The srbiter Search State will matched the scan result, - and saved the selected cipher and akm, and report the score, - for arbiter join state, join module will carry this target BSS - to rsn generate ie function, for gen wpa/rsn ie */ - UINT_32 u4RsnSelectedGroupCipher; - UINT_32 u4RsnSelectedPairwiseCipher; - UINT_32 u4RsnSelectedAKMSuite; - - UINT_16 u2RsnCap; - - RSN_INFO_T rRSNInfo; - RSN_INFO_T rWPAInfo; -#if 1//CFG_SUPPORT_WAPI - WAPI_INFO_T rIEWAPI; - BOOL fgIEWAPI; -#endif - BOOL fgIERSN; - BOOL fgIEWPA; - - /*! \brief RSN parameters selected for connection */ - /*! \brief The Select score for final AP selection, - 0, no sec, 1,2,3 group cipher is WEP, TKIP, CCMP */ - UINT_8 ucEncLevel; - -#if CFG_ENABLE_WIFI_DIRECT - BOOLEAN fgIsP2PPresent; - P_P2P_DEVICE_DESC_T prP2pDesc; - - UINT_8 aucIntendIfAddr[MAC_ADDR_LEN]; /* For IBSS, the SrcAddr is different from BSSID */ -// UINT_8 ucDevCapabilityBitmap; /* Device Capability Attribute. (P2P_DEV_CAPABILITY_XXXX) */ -// UINT_8 ucGroupCapabilityBitmap; /* Group Capability Attribute. (P2P_GROUP_CAPABILITY_XXXX) */ - - LINK_T rP2pDeviceList; - -// P_LINK_T prP2pDeviceList; - - /* For - * 1. P2P Capability. - * 2. P2P Device ID. ( in aucSrcAddr[] ) - * 3. NOA (TODO:) - * 4. Extend Listen Timing. (Probe Rsp) (TODO:) - * 5. P2P Device Info. (Probe Rsp) - * 6. P2P Group Info. (Probe Rsp) - */ -#endif - - BOOLEAN fgIsIEOverflow; /* The received IE length exceed the maximum IE buffer size */ - UINT_16 u2IELength; /* The byte count of aucIEBuf[] */ - - ULARGE_INTEGER u8TimeStamp; /* Place u8TimeStamp before aucIEBuf[1] to force DW align */ - - UINT_8 aucIEBuf[CFG_IE_BUFFER_SIZE]; -}; - - -typedef struct _SCAN_PARAM_T { /* Used by SCAN FSM */ - /* Active or Passive */ - ENUM_SCAN_TYPE_T eScanType; - - /* Network Type */ - ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex; - - /* Specified SSID Type */ - UINT_8 ucSSIDType; - UINT_8 ucSSIDNum; - - /* Length of Specified SSID */ - UINT_8 ucSpecifiedSSIDLen[SCN_SSID_MAX_NUM]; - - /* Specified SSID */ - UINT_8 aucSpecifiedSSID[SCN_SSID_MAX_NUM][ELEM_MAX_LEN_SSID]; - -#if CFG_ENABLE_WIFI_DIRECT - BOOLEAN fgFindSpecificDev; /* P2P: Discovery Protocol */ - UINT_8 aucDiscoverDevAddr[MAC_ADDR_LEN]; - BOOLEAN fgIsDevType; - P2P_DEVICE_TYPE_T rDiscoverDevType; - - UINT_16 u2PassiveListenInterval; - // TODO: Find Specific Device Type. -#endif /* CFG_SUPPORT_P2P */ - - BOOLEAN fgIsObssScan; - BOOLEAN fgIsScanV2; - - /* Run time flags */ - UINT_16 u2ProbeDelayTime; - - /* channel information */ - ENUM_SCAN_CHANNEL eScanChannel; - UINT_8 ucChannelListNum; - RF_CHANNEL_INFO_T arChnlInfoList[MAXIMUM_OPERATION_CHANNEL_LIST]; - - /* Feedback information */ - UINT_8 ucSeqNum; - - /* Information Element */ - UINT_16 u2IELen; - UINT_8 aucIE[MAX_IE_LENGTH]; - -} SCAN_PARAM_T, *P_SCAN_PARAM_T; - -typedef struct _SCAN_INFO_T { - ENUM_SCAN_STATE_T eCurrentState; /* Store the STATE variable of SCAN FSM */ - - OS_SYSTIME rLastScanCompletedTime; - - SCAN_PARAM_T rScanParam; - - UINT_32 u4NumOfBssDesc; - - UINT_8 aucScanBuffer[SCN_MAX_BUFFER_SIZE]; - - LINK_T rBSSDescList; - - LINK_T rFreeBSSDescList; - - LINK_T rPendingMsgList; - - /* Sparse Channel Detection */ - BOOLEAN fgIsSparseChannelValid; - RF_CHANNEL_INFO_T rSparseChannel; - -} SCAN_INFO_T, *P_SCAN_INFO_T; - - -/* Incoming Mailbox Messages */ -typedef struct _MSG_SCN_SCAN_REQ_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 ucSeqNum; - UINT_8 ucNetTypeIndex; - ENUM_SCAN_TYPE_T eScanType; - UINT_8 ucSSIDType; /* BIT(0) wildcard / BIT(1) P2P-wildcard / BIT(2) specific */ - UINT_8 ucSSIDLength; - UINT_8 aucSSID[PARAM_MAX_LEN_SSID]; -#if CFG_ENABLE_WIFI_DIRECT - UINT_16 u2ChannelDwellTime; /* In TU. 1024us. */ -#endif - ENUM_SCAN_CHANNEL eScanChannel; - UINT_8 ucChannelListNum; - RF_CHANNEL_INFO_T arChnlInfoList[MAXIMUM_OPERATION_CHANNEL_LIST]; - UINT_16 u2IELen; - UINT_8 aucIE[MAX_IE_LENGTH]; -} MSG_SCN_SCAN_REQ, *P_MSG_SCN_SCAN_REQ; - -typedef struct _MSG_SCN_SCAN_REQ_V2_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 ucSeqNum; - UINT_8 ucNetTypeIndex; - ENUM_SCAN_TYPE_T eScanType; - UINT_8 ucSSIDType; /* BIT(0) wildcard / BIT(1) P2P-wildcard / BIT(2) specific */ - UINT_8 ucSSIDNum; - P_PARAM_SSID_T prSsid; - UINT_16 u2ProbeDelay; - UINT_16 u2ChannelDwellTime; /* In TU. 1024us. */ - ENUM_SCAN_CHANNEL eScanChannel; - UINT_8 ucChannelListNum; - RF_CHANNEL_INFO_T arChnlInfoList[MAXIMUM_OPERATION_CHANNEL_LIST]; - UINT_16 u2IELen; - UINT_8 aucIE[MAX_IE_LENGTH]; -} MSG_SCN_SCAN_REQ_V2, *P_MSG_SCN_SCAN_REQ_V2; - - -typedef struct _MSG_SCN_SCAN_CANCEL_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 ucSeqNum; - UINT_8 ucNetTypeIndex; -#if CFG_ENABLE_WIFI_DIRECT - BOOLEAN fgIsChannelExt; -#endif -} MSG_SCN_SCAN_CANCEL, *P_MSG_SCN_SCAN_CANCEL; - -/* Outgoing Mailbox Messages */ -typedef enum _ENUM_SCAN_STATUS_T { - SCAN_STATUS_DONE = 0, - SCAN_STATUS_CANCELLED, - SCAN_STATUS_FAIL, - SCAN_STATUS_BUSY, - SCAN_STATUS_NUM -} ENUM_SCAN_STATUS, *P_ENUM_SCAN_STATUS; - -typedef struct _MSG_SCN_SCAN_DONE_T { - MSG_HDR_T rMsgHdr; /* Must be the first member */ - UINT_8 ucSeqNum; - UINT_8 ucNetTypeIndex; - ENUM_SCAN_STATUS eScanStatus; -} MSG_SCN_SCAN_DONE, *P_MSG_SCN_SCAN_DONE; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Routines in scan.c */ -/*----------------------------------------------------------------------------*/ -VOID -scnInit ( - IN P_ADAPTER_T prAdapter - ); - -VOID -scnUninit ( - IN P_ADAPTER_T prAdapter - ); - -/* BSS-DESC Search */ -P_BSS_DESC_T -scanSearchBssDescByBssid ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucBSSID[] - ); - -P_BSS_DESC_T -scanSearchBssDescByBssidAndSsid ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucBSSID[], - IN BOOLEAN fgCheckSsid, - IN P_PARAM_SSID_T prSsid - ); - -P_BSS_DESC_T -scanSearchBssDescByTA ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucSrcAddr[] - ); - -P_BSS_DESC_T -scanSearchBssDescByTAAndSsid ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucSrcAddr[], - IN BOOLEAN fgCheckSsid, - IN P_PARAM_SSID_T prSsid - ); - - -/* BSS-DESC Search - Alternative */ -P_BSS_DESC_T -scanSearchExistingBssDesc ( - IN P_ADAPTER_T prAdapter, - IN ENUM_BSS_TYPE_T eBSSType, - IN UINT_8 aucBSSID[], - IN UINT_8 aucSrcAddr[] - ); - -P_BSS_DESC_T -scanSearchExistingBssDescWithSsid ( - IN P_ADAPTER_T prAdapter, - IN ENUM_BSS_TYPE_T eBSSType, - IN UINT_8 aucBSSID[], - IN UINT_8 aucSrcAddr[], - IN BOOLEAN fgCheckSsid, - IN P_PARAM_SSID_T prSsid - ); - - -/* BSS-DESC Allocation */ -P_BSS_DESC_T -scanAllocateBssDesc ( - IN P_ADAPTER_T prAdapter - ); - -/* BSS-DESC Removal */ -VOID -scanRemoveBssDescsByPolicy ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4RemovePolicy - ); - -VOID -scanRemoveBssDescByBssid ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucBSSID[] - ); - -VOID -scanRemoveBssDescByBandAndNetwork ( - IN P_ADAPTER_T prAdapter, - IN ENUM_BAND_T eBand, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ); - -/* BSS-DESC State Change */ -VOID -scanRemoveConnFlagOfBssDescByBssid ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucBSSID[] - ); - -#if 0 -/* BSS-DESC Insertion */ -P_BSS_DESC_T -scanAddToInternalScanResult ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSWRfb, - IN P_BSS_DESC_T prBssDesc - ); -#endif - -/* BSS-DESC Insertion - ALTERNATIVE */ -P_BSS_DESC_T -scanAddToBssDesc ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -WLAN_STATUS -scanProcessBeaconAndProbeResp ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSWRfb - ); - -VOID -scanBuildProbeReqFrameCommonIEs ( - IN P_MSDU_INFO_T prMsduInfo, - IN PUINT_8 pucDesiredSsid, - IN UINT_32 u4DesiredSsidLen, - IN UINT_16 u2SupportedRateSet - ); - -WLAN_STATUS -scanSendProbeReqFrames ( - IN P_ADAPTER_T prAdapter, - IN P_SCAN_PARAM_T prScanParam - ); - -VOID -scanUpdateBssDescForSearch ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ); - -P_BSS_DESC_T -scanSearchBssDescByPolicy ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ); - -WLAN_STATUS -scanAddScanResult ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc, - IN P_SW_RFB_T prSwRfb - ); - -/*----------------------------------------------------------------------------*/ -/* Routines in scan_fsm.c */ -/*----------------------------------------------------------------------------*/ -VOID -scnFsmSteps ( - IN P_ADAPTER_T prAdapter, - IN ENUM_SCAN_STATE_T eNextState - ); - -/*----------------------------------------------------------------------------*/ -/* Command Routines */ -/*----------------------------------------------------------------------------*/ -VOID -scnSendScanReq ( - IN P_ADAPTER_T prAdapter - ); - -VOID -scnSendScanReqV2 ( - IN P_ADAPTER_T prAdapter - ); - -/*----------------------------------------------------------------------------*/ -/* RX Event Handling */ -/*----------------------------------------------------------------------------*/ -VOID -scnEventScanDone( - IN P_ADAPTER_T prAdapter, - IN P_EVENT_SCAN_DONE prScanDone - ); - -/*----------------------------------------------------------------------------*/ -/* Mailbox Message Handling */ -/*----------------------------------------------------------------------------*/ -VOID -scnFsmMsgStart ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -scnFsmMsgAbort ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -scnFsmHandleScanMsg ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_SCN_SCAN_REQ prScanReqMsg - ); - -VOID -scnFsmHandleScanMsgV2 ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_SCN_SCAN_REQ_V2 prScanReqMsg - ); - -VOID -scnFsmRemovePendingMsg ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucSeqNum, - IN UINT_8 ucNetTypeIndex - ); - -/*----------------------------------------------------------------------------*/ -/* Mailbox Message Generation */ -/*----------------------------------------------------------------------------*/ -VOID -scnFsmGenerateScanDoneMsg ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucSeqNum, - IN UINT_8 ucNetTypeIndex, - IN ENUM_SCAN_STATUS eScanStatus - ); - -/*----------------------------------------------------------------------------*/ -/* Query for sparse channel */ -/*----------------------------------------------------------------------------*/ -BOOLEAN -scnQuerySparseChannel ( - IN P_ADAPTER_T prAdapter, - P_ENUM_BAND_T prSparseBand, - PUINT_8 pucSparseChannel - ); - - -#endif /* _SCAN_H */ - - diff --git a/drivers/net/wireless/mt5931/include/mgmt/sec_fsm.h b/drivers/net/wireless/mt5931/include/mgmt/sec_fsm.h deleted file mode 100755 index 17c651937abc..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/sec_fsm.h +++ /dev/null @@ -1,284 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/sec_fsm.h#1 $ -*/ - -/*! \file sec_fsm.h - \brief Declaration of functions and finite state machine for SECURITY Module. - - Function declaration for privacy.c and SEC_STATE for SECURITY FSM. -*/ - - - -/* -** $Log: sec_fsm.h $ - * - * 09 29 2010 wh.su - * [WCXRP00000072] [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue - * [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue. - * - * 09 21 2010 kevin.huang - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * Eliminate Linux Compile Warning - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 20 2010 wh.su - * NULL - * adding the eapol callback setting. - * - * 08 19 2010 wh.su - * NULL - * adding the tx pkt call back handle for countermeasure. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * modify some code for concurrent network. - * - * 06 19 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * consdier the concurrent network setting. - * - * 03 04 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * Code refine, and remove non-used code. - * - * 03 03 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * Fixed the pre-authentication timer not correctly init issue, and modify the security related callback function prototype. - * - * 03 01 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * Refine the variable and parameter for security. - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * fixed the deauth Tx done callback parameter - * - * Dec 4 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the reference function declaration - * - * Dec 3 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * delete non-used code - * - * Dec 1 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adjust the function prototype - * - * Nov 23 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adjust the function declaration - * - * Nov 19 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the security variable - * - * Nov 18 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * -** \main\maintrunk.MT5921\14 2009-04-06 15:35:47 GMT mtk01088 -** add the variable to set the disable AP selection for privacy check, for wps open networking. -** \main\maintrunk.MT5921\13 2008-11-19 11:46:01 GMT mtk01088 -** rename some variable with pre-fix to avoid the misunderstanding -** \main\maintrunk.MT5921\12 2008-08-28 20:37:11 GMT mtk01088 -** remove non-used code -** -** \main\maintrunk.MT5921\11 2008-03-18 09:51:52 GMT mtk01088 -** Add function declaration for timer to indicate pmkid candidate -** \main\maintrunk.MT5921\10 2008-02-29 15:12:08 GMT mtk01088 -** add variable for sw port control -** \main\maintrunk.MT5921\9 2008-02-29 12:37:30 GMT mtk01088 -** rename the security related function declaration -** \main\maintrunk.MT5921\8 2007-12-27 13:59:08 GMT mtk01088 -** adjust the wlan table and sec fsm init timing -** \main\maintrunk.MT5921\7 2007-11-20 10:39:49 GMT mtk01088 -** add function timer for wait EAPoL Error timeout -** \main\maintrunk.MT5921\6 2007-11-06 20:39:08 GMT mtk01088 -** rename the counter measure timer -** \main\maintrunk.MT5921\5 2007-11-06 20:14:31 GMT mtk01088 -** add a abort function -** Revision 1.5 2007/07/16 02:33:42 MTK01088 -** change the ENUM declaration structure prefix from r to e -** -** Revision 1.4 2007/07/09 06:23:10 MTK01088 -** update -** -** Revision 1.3 2007/07/04 10:09:04 MTK01088 -** adjust the state for security fsm -** change function name -** -** Revision 1.2 2007/07/03 08:13:22 MTK01088 -** change the sec fsm state -** add the event for sec fsm -** -** Revision 1.1 2007/06/27 06:20:35 MTK01088 -** add the sec fsm header file -** -** -*/ -#ifndef _SEC_FSM_H -#define _SEC_FSM_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/* TKIP CounterMeasure interval for Rejoin to Network. */ -#define COUNTER_MEASURE_TIMEOUT_INTERVAL_SEC 60 - -/* Timeout to wait the EAPoL Error Report frame Send out. */ -#define EAPOL_REPORT_SEND_TIMEOUT_INTERVAL_SEC 1 - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -typedef UINT_32 SEC_STATUS, *P_SEC_STATUS; - -#if 0 -/* WPA2 PMKID candicate structure */ -typedef struct _PMKID_CANDICATE_T { - UINT_8 aucBssid[MAC_ADDR_LEN]; /* MAC address */ - UINT_32 u4PreAuthFlags; -} PMKID_CANDICATE_T, *P_PMKID_CANDICATE_T; -#endif - -typedef SEC_STATUS (*PFN_SEC_FSM_STATE_HANDLER)(VOID); - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#define SEC_STATE_TRANSITION_FLAG fgIsTransition -#define SEC_NEXT_STATE_VAR eNextState - -#define SEC_STATE_TRANSITION(prAdapter, prSta, eFromState, eToState) \ - { secFsmTrans_ ## eFromState ## _to_ ## eToState(prAdapter, prSta); \ - SEC_NEXT_STATE_VAR = SEC_STATE_ ## eToState; \ - SEC_STATE_TRANSITION_FLAG = (BOOLEAN)TRUE; \ - } - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/*--------------------------------------------------------------*/ -/* Routines to handle the sec check */ -/*--------------------------------------------------------------*/ -/***** Routines in sec_fsm.c *****/ -VOID -secFsmInit( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ); - -VOID -secFsmEventInit( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ); - -VOID -secFsmEventStart( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ); - -VOID -secFsmEventAbort( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ); - -BOOLEAN -secFsmEventPTKInstalled( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ); - -VOID -secFsmEvent2ndEapolTx( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ); - -VOID -secFsmEvent4ndEapolTxDone( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ); - -VOID -secFsmEventEapolTxDone ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - -VOID -secFsmEventEapolTxTimeout ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Parm - ); - -VOID -secFsmEventDeauthTxDone( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - -VOID -secFsmEventStartCounterMeasure( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ); - -VOID -secFsmEventEndOfCounterMeasure( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Parm - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#endif /* _SEC_FSM_H */ - - diff --git a/drivers/net/wireless/mt5931/include/mgmt/swcr.h b/drivers/net/wireless/mt5931/include/mgmt/swcr.h deleted file mode 100755 index 4ea322d9763d..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/swcr.h +++ /dev/null @@ -1,180 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/swcr.h#1 $ -*/ - -/*! \file "swcr.h" - \brief -*/ - - - -/* - * - */ - -#ifndef _SWCR_H -#define _SWCR_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -#define SWCR_VAR(x) ((VOID *)&x) -#define SWCR_FUNC(x) ((VOID *)x) - -#define SWCR_T_FUNC BIT(7) - -#define SWCR_L_32 3 -#define SWCR_L_16 2 -#define SWCR_L_8 1 - -#define SWCR_READ 0 -#define SWCR_WRITE 1 - -#define SWCR_MAP_NUM(x) (sizeof(x)/sizeof(x[0])) - -#define SWCR_CR_NUM 7 - -#define SWCR_GET_RW_INDEX(action,rw,index) \ - index = action & 0x7F; \ - rw = action >> 7; - - -extern UINT_32 g_au4SwCr[]; /*: 0: command other: data */ - -typedef VOID (*PFN_SWCR_RW_T)(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data); -typedef VOID (*PFN_CMD_RW_T)(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1); - -typedef struct _SWCR_MAP_ENTRY_T { - UINT_16 u2Type; - PVOID u4Addr; -} SWCR_MAP_ENTRY_T, *P_SWCR_MAP_ENTRY_T; - - -typedef struct _SWCR_MOD_MAP_ENTRY_T { - UINT_8 ucMapNum; - P_SWCR_MAP_ENTRY_T prSwCrMap; -} SWCR_MOD_MAP_ENTRY_T, *P_SWCR_MOD_MAP_ENTRY_T; - -typedef enum _ENUM_SWCR_DBG_TYPE_T { - SWCR_DBG_TYPE_ALL = 0, - SWCR_DBG_TYPE_TXRX, - SWCR_DBG_TYPE_RX_RATES, - SWCR_DBG_TYPE_PS, - SWCR_DBG_TYPE_NUM -} ENUM_SWCR_DBG_TYPE_T; - -typedef enum _ENUM_SWCR_DBG_ALL_T { - SWCR_DBG_ALL_TX_CNT = 0, - SWCR_DBG_ALL_TX_BCN_CNT, - SWCR_DBG_ALL_TX_FAILED_CNT, - SWCR_DBG_ALL_TX_RETRY_CNT, - SWCR_DBG_ALL_TX_AGING_TIMEOUT_CNT, - SWCR_DBG_ALL_TX_PS_OVERFLOW_CNT, - SWCR_DBG_ALL_TX_MGNT_DROP_CNT, - SWCR_DBG_ALL_TX_ERROR_CNT, - - SWCR_DBG_ALL_RX_CNT, - SWCR_DBG_ALL_RX_DROP_CNT, - SWCR_DBG_ALL_RX_DUP_DROP_CNT, - SWCR_DBG_ALL_RX_TYPE_ERROR_DROP_CNT, - SWCR_DBG_ALL_RX_CLASS_ERROR_DROP_CNT, - SWCR_DBG_ALL_RX_AMPDU_ERROR_DROP_CNT, - - SWCR_DBG_ALL_RX_STATUS_ERROR_DROP_CNT, - SWCR_DBG_ALL_RX_FORMAT_ERROR_DROP_CNT, - SWCR_DBG_ALL_RX_ICV_ERROR_DROP_CNT, - SWCR_DBG_ALL_RX_KEY_ERROR_DROP_CNT, - SWCR_DBG_ALL_RX_TKIP_ERROR_DROP_CNT, - SWCR_DBG_ALL_RX_MIC_ERROR_DROP_CNT, - SWCR_DBG_ALL_RX_BIP_ERROR_DROP_CNT, - - SWCR_DBG_ALL_RX_FCSERR_CNT, - SWCR_DBG_ALL_RX_FIFOFULL_CNT, - SWCR_DBG_ALL_RX_PFDROP_CNT, - - SWCR_DBG_ALL_PWR_PS_POLL_CNT, - SWCR_DBG_ALL_PWR_TRIGGER_NULL_CNT, - SWCR_DBG_ALL_PWR_BCN_IND_CNT, - SWCR_DBG_ALL_PWR_BCN_TIMEOUT_CNT, - SWCR_DBG_ALL_PWR_PM_STATE0, - SWCR_DBG_ALL_PWR_PM_STATE1, - SWCR_DBG_ALL_PWR_CUR_PS_PROF0, - SWCR_DBG_ALL_PWR_CUR_PS_PROF1, - - SWCR_DBG_ALL_AR_STA0_RATE, - SWCR_DBG_ALL_AR_STA0_BWGI, - SWCR_DBG_ALL_AR_STA0_RX_RATE_RCPI, - - SWCR_DBG_ALL_ROAMING_ENABLE, - SWCR_DBG_ALL_ROAMING_ROAM_CNT, - SWCR_DBG_ALL_ROAMING_INT_CNT, - - SWCR_DBG_ALL_BB_RX_MDRDY_CNT, - SWCR_DBG_ALL_BB_RX_FCSERR_CNT, - SWCR_DBG_ALL_BB_CCK_PD_CNT, - SWCR_DBG_ALL_BB_OFDM_PD_CNT, - SWCR_DBG_ALL_BB_CCK_SFDERR_CNT, - SWCR_DBG_ALL_BB_CCK_SIGERR_CNT, - SWCR_DBG_ALL_BB_OFDM_TAGERR_CNT, - SWCR_DBG_ALL_BB_OFDM_SIGERR_CNT, - - SWCR_DBG_ALL_NUM -} ENUM_SWCR_DBG_ALL_T; - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -VOID swCrReadWriteCmd( - P_ADAPTER_T prAdapter, - UINT_8 ucRead, - UINT_16 u2Addr, - UINT_32 *pu4Data - ); - -/* Debug Support */ -VOID swCrFrameCheckEnable(P_ADAPTER_T prAdapter, UINT_32 u4DumpType); -VOID swCrDebugInit(P_ADAPTER_T prAdapter); -VOID swCrDebugCheckEnable(P_ADAPTER_T prAdapter, BOOLEAN fgIsEnable, UINT_8 ucType, UINT_32 u4Timeout); -VOID swCrDebugUninit(P_ADAPTER_T prAdapter); - -#endif diff --git a/drivers/net/wireless/mt5931/include/mgmt/wapi.h b/drivers/net/wireless/mt5931/include/mgmt/wapi.h deleted file mode 100755 index a47acae67778..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/wapi.h +++ /dev/null @@ -1,120 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/wapi.h#1 $ -*/ - -/*! \file wapi.h - \brief The wapi related define, macro and structure are described here. -*/ - - - -/* -** $Log: wapi.h $ - * - * 07 20 2010 wh.su - * - * . - * - * 01 27 2010 wh.su - * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code - * add and fixed some security function. - * - * Dec 8 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * change the wapi function name and adding the generate wapi ie function - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding some wapi structure define - * - * Nov 23 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * -** \main\maintrunk.MT5921\1 2009-10-09 17:06:29 GMT mtk01088 -** -*/ - -#ifndef _WAPI_H -#define _WAPI_H - -#if CFG_SUPPORT_WAPI - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#define WAPI_CIPHER_SUITE_WPI 0x01721400 /* WPI_SMS4 */ -#define WAPI_AKM_SUITE_802_1X 0x01721400 /* WAI */ -#define WAPI_AKM_SUITE_PSK 0x02721400 /* WAI_PSK */ - -#define ELEM_ID_WAPI 68 /* WAPI IE */ - -#define WAPI_IE(fp) ((P_WAPI_INFO_ELEM_T) fp) - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -VOID -wapiGenerateWAPIIE( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -BOOLEAN -wapiParseWapiIE ( - IN P_WAPI_INFO_ELEM_T prInfoElem, - OUT P_WAPI_INFO_T prWapiInfo - ); - -BOOLEAN -wapiPerformPolicySelection( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBss - ); - -//BOOLEAN -//wapiUpdateTxKeyIdx ( -// IN P_STA_RECORD_T prStaRec, -// IN UINT_8 ucWlanIdx -// ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#endif -#endif /* _WAPI_H */ - diff --git a/drivers/net/wireless/mt5931/include/mgmt/wlan_typedef.h b/drivers/net/wireless/mt5931/include/mgmt/wlan_typedef.h deleted file mode 100755 index bbf653aeb6df..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/wlan_typedef.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/mgmt/wlan_typedef.h#1 $ -*/ - -/*! \file wlan_typedef.h - \brief Declaration of data type and return values of internal protocol stack. - - In this file we declare the data type and return values which will be exported - to all MGMT Protocol Stack. -*/ - - - -/* -** $Log: wlan_typedef.h $ -*/ - -#ifndef _WLAN_TYPEDEF_H -#define _WLAN_TYPEDEF_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/* Type definition for BSS_INFO_T structure, to describe the attributes used in a - * common BSS. - */ -typedef struct _BSS_INFO_T BSS_INFO_T, *P_BSS_INFO_T; - -typedef BSS_INFO_T AIS_BSS_INFO_T, *P_AIS_BSS_INFO_T; -typedef BSS_INFO_T P2P_BSS_INFO_T, *P_P2P_BSS_INFO_T; -typedef BSS_INFO_T BOW_BSS_INFO_T, *P_BOW_BSS_INFO_T; - -typedef struct _AIS_SPECIFIC_BSS_INFO_T AIS_SPECIFIC_BSS_INFO_T, *P_AIS_SPECIFIC_BSS_INFO_T; -typedef struct _P2P_SPECIFIC_BSS_INFO_T P2P_SPECIFIC_BSS_INFO_T, *P_P2P_SPECIFIC_BSS_INFO_T; -typedef struct _BOW_SPECIFIC_BSS_INFO_T BOW_SPECIFIC_BSS_INFO_T, *P_BOW_SPECIFIC_BSS_INFO_T; - - -/* BSS related structures */ -/* Type definition for BSS_DESC_T structure, to describe parameter sets of a particular BSS */ -typedef struct _BSS_DESC_T BSS_DESC_T, *P_BSS_DESC_T, **PP_BSS_DESC_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#endif /* _WLAN_TYPEDEF_H */ - - diff --git a/drivers/net/wireless/mt5931/include/mgmt/wnm.h b/drivers/net/wireless/mt5931/include/mgmt/wnm.h deleted file mode 100755 index ac54cbc86dfa..000000000000 --- a/drivers/net/wireless/mt5931/include/mgmt/wnm.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/MT6620_5931_WiFi_Driver/include/mgmt/wnm.h#1 $ -*/ - -/*! \file wnm.h - \brief This file contains the IEEE 802.11 family related 802.11v network management - for MediaTek 802.11 Wireless LAN Adapters. -*/ - - - -/* -** $Log: wnm.h $ - * - * 01 05 2012 tsaiyuan.hsu - * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v - * add timing measurement support for 802.11v. - * - * -*/ - -#ifndef _WNM_H -#define _WNM_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -typedef struct _TIMINGMSMT_PARAM_T { - BOOLEAN fgInitiator; - UINT_8 ucTrigger; - UINT_8 ucDialogToken; /* Dialog Token */ - UINT_8 ucFollowUpDialogToken; /* Follow Up Dialog Token */ - UINT_32 u4ToD; /* Timestamp of Departure [10ns] */ - UINT_32 u4ToA; /* Timestamp of Arrival [10ns] */ -} TIMINGMSMT_PARAM_T, *P_TIMINGMSMT_PARAM_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -VOID -wnmWNMAction ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -VOID -wnmReportTimingMeas ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucStaRecIndex, - IN UINT_32 u4ToD, - IN UINT_32 u4ToA - ); - -#define WNM_UNIT_TEST 1 - -#if WNM_UNIT_TEST -VOID wnmTimingMeasUnitTest1(P_ADAPTER_T prAdapter, UINT_8 ucStaRecIndex); -#endif - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _WNM_H */ - diff --git a/drivers/net/wireless/mt5931/include/nic/adapter.h b/drivers/net/wireless/mt5931/include/nic/adapter.h deleted file mode 100755 index c2413fa4a012..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/adapter.h +++ /dev/null @@ -1,1404 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/adapter.h#3 $ -*/ - -/*! \file adapter.h - \brief Definition of internal data structure for driver manipulation. - - In this file we define the internal data structure - ADAPTER_T which stands - for MiniPort ADAPTER(From Windows point of view) or stands for Network ADAPTER. -*/ - - - -/* -** $Log: adapter.h $ -** -** 08 31 2012 yuche.tsai -** [ALPS00349585] [6577JB][WiFi direct][KE]Establish p2p connection while both device have connected to AP previously,one device reboots automatically with KE -** Fix possible KE when concurrent & disconnect. -** -** 07 26 2012 yuche.tsai -** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot -** Update driver code of ALPS.JB for hot-spot. - * - * 07 17 2012 yuche.tsai - * NULL - * Let netdev bring up. - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 06 13 2012 yuche.tsai - * NULL - * Update maintrunk driver. - * Add support for driver compose assoc request frame. - * - * 03 02 2012 terry.wu - * NULL - * Snc CFG80211 modification for ICS migration from branch 2.2. - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 01 16 2012 cp.wu - * [MT6620 Wi-Fi][Driver] API and behavior modification for preferred band configuration with corresponding network configuration - * add wlanSetPreferBandByNetwork() for glue layer to invoke for setting preferred band configuration corresponding to network type. - * - * 12 13 2011 cm.chang - * [WCXRP00001136] [All Wi-Fi][Driver] Add wake lock for pending timer - * Add wake lock if timer timeout value is smaller than 5 seconds - * - * 12 02 2011 yuche.tsai - * NULL - * Resolve inorder issue under AP mode. - * - * data frame may TX before assoc response frame. - * - * 11 19 2011 yuche.tsai - * NULL - * Update RSSI for P2P. - * - * 11 18 2011 yuche.tsai - * NULL - * CONFIG P2P support RSSI query, default turned off. - * - * 11 11 2011 yuche.tsai - * NULL - * Fix work thread cancel issue. - * - * 10 21 2011 eddie.chen - * [WCXRP00001051] [MT6620 Wi-Fi][Driver/Fw] Adjust the STA aging timeout - * Add switch to ignore the STA aging timeout. - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 09 20 2011 cm.chang - * [WCXRP00000997] [MT6620 Wi-Fi][Driver][FW] Handle change of BSS preamble type and slot time - * Remove ERP member in adapter structure - * - * 09 14 2011 yuche.tsai - * NULL - * Add P2P IE in assoc response. - * - * 08 31 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * . - * - * 07 18 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add CMD/Event for RDD and BWCS. - * - * 06 23 2011 cp.wu - * [WCXRP00000812] [MT6620 Wi-Fi][Driver] not show NVRAM when there is no valid MAC address in NVRAM content - * check with firmware for valid MAC address. - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 04 12 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * . - * - * 04 08 2011 yuche.tsai - * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO. - * Add device discoverability support. - * Action frame callback for GO Device Discoverability Req. - * - * 04 08 2011 george.huang - * [WCXRP00000621] [MT6620 Wi-Fi][Driver] Support P2P supplicant to set power mode - * separate settings of P2P and AIS - * - * 04 08 2011 eddie.chen - * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma - * Fix for sigma - * - * 03 19 2011 yuche.tsai - * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct. - * Add beacon timeout support for WiFi Direct Network. - * - * 03 19 2011 yuche.tsai - * [WCXRP00000581] [Volunteer Patch][MT6620][Driver] P2P IE in Assoc Req Issue - * Make assoc req to append P2P IE if wifi direct is enabled. - * - * 03 17 2011 cp.wu - * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period - * use pre-allocated buffer for storing enhanced interrupt response as well - * - * 03 15 2011 cp.wu - * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous memory consumption - * 1. deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK - * 2. Use common coalescing buffer for both TX/RX directions - * - * - * 03 10 2011 yuche.tsai - * [WCXRP00000533] [Volunteer Patch][MT6620][Driver] Provide a P2P function API for Legacy WiFi to query AP mode. - * Provide an API for Legacy WiFi to query the operation mode.. - * - * 03 05 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * add the code to get the check rsponse and indicate to app. - * - * 03 02 2011 wh.su - * [WCXRP00000448] [MT6620 Wi-Fi][Driver] Fixed WSC IE not send out at probe request - * Add code to send beacon and probe response WSC IE at Auto GO. - * - * 03 02 2011 cp.wu - * [WCXRP00000503] [MT6620 Wi-Fi][Driver] Take RCPI brought by association response as initial RSSI right after connection is built. - * use RCPI brought by ASSOC-RESP after connection is built as initial RCPI to avoid using a uninitialized MAC-RX RCPI. - * - * 02 21 2011 terry.wu - * [WCXRP00000476] [MT6620 Wi-Fi][Driver] Clean P2P scan list while removing P2P - * Clean P2P scan list while removing P2P. - * - * 02 17 2011 eddie.chen - * [WCXRP00000458] [MT6620 Wi-Fi][Driver] BOW Concurrent - ProbeResp was exist in other channel - * 1) Chnage GetFrameAction decision when BSS is absent. - * 2) Check channel and resource in processing ProbeRequest - * - * 02 16 2011 cm.chang - * [WCXRP00000447] [MT6620 Wi-Fi][FW] Support new NVRAM update mechanism - * . - * - * 02 10 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * Add RX deauthentication & disassociation process under Hot-Spot mode. - * - * 02 09 2011 wh.su - * [WCXRP00000433] [MT6620 Wi-Fi][Driver] Remove WAPI structure define for avoid P2P module with structure miss-align pointer issue - * always pre-allio WAPI related structure for align p2p module. - * - * 02 08 2011 yuche.tsai - * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module. - * Provide disconnect function for AAA module. - * - * 02 01 2011 cm.chang - * [WCXRP00000415] [MT6620 Wi-Fi][Driver] Check if any memory leakage happens when uninitializing in DGB mode - * . - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * - * 01 27 2011 george.huang - * [WCXRP00000400] [MT6620 Wi-Fi] support CTIA power mode setting - * Support CTIA power mode setting. - * - * 01 27 2011 george.huang - * [WCXRP00000355] [MT6620 Wi-Fi] Set WMM-PS related setting with qualifying AP capability - * Support current measure mode, assigned by registry (XP only). - * - * 01 24 2011 cp.wu - * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving - * 1. add an extra counter for tracking pending forward frames. - * 2. notify TX service thread as well when there is pending forward frame - * 3. correct build errors leaded by introduction of Wi-Fi direct separation module - * - * 01 12 2011 cm.chang - * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting - * User-defined bandwidth is for 2.4G and 5G individually - * - * 12 29 2010 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, - -Add per station flow control when STA is in PS - - - * Add WMM parameter for broadcast. - * - * 12 29 2010 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, - -Add per station flow control when STA is in PS - - - * Add CWMin CWMax for AP to generate IE. - * - * 12 29 2010 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, -Add per station flow control when STA is in PS - - * 1) PS flow control event - * - * 2) WMM IE in beacon, assoc resp, probe resp - * - * 12 28 2010 cp.wu - * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release - * report EEPROM used flag via NIC_CAPABILITY - * - * 12 28 2010 cp.wu - * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release - * integrate with 'EEPROM used' flag for reporting correct capability to Engineer Mode/META and other tools - * - * 12 07 2010 cm.chang - * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant - * 1. Country code is from NVRAM or supplicant - * 2. Change band definition in CMD/EVENT. - * - * 11 01 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module - * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead - * 2) Remove CNM CH-RECOVER event handling - * 3) cfg read/write API renamed with kal prefix for unified naming rules. - * - * 10 27 2010 george.huang - * [WCXRP00000127] [MT6620 Wi-Fi][Driver] Add a registry to disable Beacon Timeout function for SQA test by using E1 EVB - * Support registry option for disable beacon lost detection. - * - * 10 26 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW] Support NIC capability query command - * 1) update NVRAM content template to ver 1.02 - * 2) add compile option for querying NIC capability (default: off) - * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting - * 4) correct auto-rate compiler error under linux (treat warning as error) - * 5) simplify usage of NVRAM and REG_INFO_T - * 6) add version checking between driver and firmware - * - * 10 08 2010 cp.wu - * [WCXRP00000084] [MT6620 Wi-Fi][Driver][FW] Add fixed rate support for distance test - * adding fixed rate support for distance test. (from registry setting) - * - * 10 06 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * code reorganization to improve isolation between GLUE and CORE layers. - * - * 10 05 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * 1) add NVRAM access API - * 2) fake scanning result when NVRAM doesn't exist and/or version mismatch. (off by compiler option) - * 3) add OID implementation for NVRAM read/write service - * - * 09 27 2010 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000065] Update BoW design and settings - * Update BCM/BoW design and settings. - * - * 09 24 2010 cp.wu - * [WCXRP00000057] [MT6620 Wi-Fi][Driver] Modify online scan to a run-time switchable feature - * Modify online scan as a run-time adjustable option (for Windows, in registry) - * - * 09 23 2010 cp.wu - * [WCXRP00000051] [MT6620 Wi-Fi][Driver] WHQL test fail in MAC address changed item - * use firmware reported mac address right after wlanAdapterStart() as permanent address - * - * 09 08 2010 cp.wu - * NULL - * use static memory pool for storing IEs of scanning result. - * - * 09 07 2010 yuche.tsai - * NULL - * Add a common IE buffer in P2P INFO structure. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 09 01 2010 cp.wu - * NULL - * restore configuration as before. - * - * 09 01 2010 wh.su - * NULL - * adding the wapi support for integration test. - * - * 08 31 2010 kevin.huang - * NULL - * Use LINK LIST operation to process SCAN result - * - * 08 29 2010 yuche.tsai - * NULL - * Finish SLT TX/RX & Rate Changing Support. - * - * 08 25 2010 george.huang - * NULL - * update OID/ registry control path for PM related settings - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 08 23 2010 chinghwa.yu - * NULL - * Update for BOW. - * - * 08 20 2010 cm.chang - * NULL - * Migrate RLM code to host from FW - * - * 08 16 2010 yuche.tsai - * NULL - * Add an intend mode for BSS info. - * It is used to let P2P BSS Info to know which OP Mode it is going to become. - * - * 08 04 2010 george.huang - * NULL - * handle change PS mode OID/ CMD - * - * 08 02 2010 cp.wu - * NULL - * comment out deprecated members in BSS_INFO, which are only used by firmware rather than driver. - * - * 07 29 2010 cp.wu - * NULL - * eliminate u4FreqInKHz usage, combined into rConnections.ucAdHoc* - * - * 07 28 2010 cp.wu - * NULL - * 1) eliminate redundant variable eOPMode in prAdapter->rWlanInfo - * 2) change nicMediaStateChange() API prototype - * - * 07 24 2010 wh.su - * - * .support the Wi-Fi RSN - * - * 07 21 2010 yuche.tsai - * - * Add for P2P Scan Result Parsing & Saving. - * - * 07 19 2010 wh.su - * - * update for security supporting. - * - * 07 19 2010 cm.chang - * - * Set RLM parameters and enable CNM channel manager - * - * 07 19 2010 yuche.tsai - * - * Remove BSS info which is redonedent in Wifi Var.. - * - * 07 16 2010 yarco.yang - * - * 1. Support BSS Absence/Presence Event - * 2. Support STA change PS mode Event - * 3. Support BMC forwarding for AP mode. - * - * 07 14 2010 yarco.yang - * - * 1. Remove CFG_MQM_MIGRATION - * 2. Add CMD_UPDATE_WMM_PARMS command - * - * 07 09 2010 george.huang - * - * [WPD00001556] Migrate PM variables from FW to driver: for composing QoS Info - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Check draft RLM code for HT cap - * - * 06 29 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * replace g_rQM with Adpater->rQM - * - * 06 28 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * 1st draft code for RLM module - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * remove duplicate variable for migration. - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * modify some code for concurrent network. - * - * 06 21 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Add P2P FSM Info in adapter. - * - * 06 21 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Support CFG_MQM_MIGRATION flag - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 18 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * migration the security related function from firmware. - * - * 06 17 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Add P2P related field, additional include p2p_fsm.h if p2p is enabled. - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add scan.c. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add management dispatching function table. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * auth.c is migrated. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add buildable & linkable ais_fsm.c - * - * related reference are still waiting to be resolved - * - * 06 09 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add definitions for module migration. - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * cnm_timer has been migrated. - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * hem_mbox is migrated. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge wifi_var.h, precomp.h, cnm_timer.h (data type only) - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * change OID behavior to meet WHQL requirement. - * - * 05 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS - * 2) buffer statistics data for 2 seconds - * 3) use default value for adhoc parameters instead of 0 - * - * 05 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) do not take timeout mechanism for power mode oids - * 2) retrieve network type from connection status - * 3) after disassciation, set radio state to off - * 4) TCP option over IPv6 is supported - * - * 05 18 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement Wakeup-on-LAN except firmware integration part - * - * 04 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * reserve field of privacy filter and RTS threshold setting. - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * * * 2) command sequence number is now increased atomically - * * * * * * 3) private data could be hold and taken use for other purpose - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * rWlanInfo should be placed at adapter rather than glue due to most operations - * * * are done in adapter layer. - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * code refine: fgTestMode should be at adapter rather than glue due to the device/fw is also involved - * - * 03 31 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * modify the wapi related code for new driver's design. - * - * 03 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) add ACPI D0/D3 state switching support - * * * 2) use more formal way to handle interrupt when the status is retrieved from enhanced RX response - * - * 03 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement OID_802_3_MULTICAST_LIST oid handling - * - * 03 02 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) the use of prPendingOid revised, all accessing are now protected by spin lock - * * * 2) ensure wlanReleasePendingOid will clear all command queues - * - * 02 09 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * move ucCmdSeqNum as instance variable - * - * 01 27 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * . - * - * 01 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. eliminate improper variable in rHifInfo - * * * 2. block TX/ordinary OID when RF test mode is engaged - * * * 3. wait until firmware finish operation when entering into and leaving from RF test mode - * * * 4. correct some HAL implementation - * - * 12 30 2009 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) According to CMD/EVENT documentation v0.8, - * * * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used, - * * * and result is retrieved by get ATInfo instead - * * * 2) add 4 counter for recording aggregation statistics - * - * 12 28 2009 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate redundant variables for connection_state -** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-12-16 18:02:03 GMT mtk02752 -** add external reference to avoid compilation error -** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-12-10 16:40:26 GMT mtk02752 -** eliminate unused member -** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-12-08 17:36:08 GMT mtk02752 -** add RF test data members into P_ADAPTER_T -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-10-13 21:58:45 GMT mtk01084 -** update for new HW architecture design -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-04-28 10:29:57 GMT mtk01461 -** Add read WTSR for SDIO_STATUS_ENHANCE mode -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-04-21 09:37:35 GMT mtk01461 -** Add prPendingCmdInfoOfOID for temporarily saving the CMD_INFO_T before en-queue to rCmdQueue -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-04-17 19:57:51 GMT mtk01461 -** Add MGMT Buffer Info -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-01 10:34:12 GMT mtk01461 -** Add SW pre test CFG_HIF_LOOPBACK_PRETEST -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-03-23 21:41:48 GMT mtk01461 -** Add fgIsWmmAssoc flag for TC assignment -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-19 18:32:51 GMT mtk01084 -** update for basic power management functions -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-18 20:51:52 GMT mtk01426 -** Add #if CFG_SDIO_RX_ENHANCE related data structure -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:16:17 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _ADAPTER_H -#define _ADAPTER_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef struct _ENHANCE_MODE_DATA_STRUCT_T SDIO_CTRL_T, *P_SDIO_CTRL_T; - -typedef struct _WLAN_INFO_T { - PARAM_BSSID_EX_T rCurrBssId; - - // Scan Result - PARAM_BSSID_EX_T arScanResult[CFG_MAX_NUM_BSS_LIST]; - PUINT_8 apucScanResultIEs[CFG_MAX_NUM_BSS_LIST]; - UINT_32 u4ScanResultNum; - - // IE pool for Scanning Result - UINT_8 aucScanIEBuf[CFG_MAX_COMMON_IE_BUF_LEN]; - UINT_32 u4ScanIEBufferUsage; - - OS_SYSTIME u4SysTime; - - // connection parameter (for Ad-Hoc) - UINT_16 u2BeaconPeriod; - UINT_16 u2AtimWindow; - - PARAM_RATES eDesiredRates; - CMD_LINK_ATTRIB eLinkAttr; -// CMD_PS_PROFILE_T ePowerSaveMode; - CMD_PS_PROFILE_T arPowerSaveMode[NETWORK_TYPE_INDEX_NUM]; - - // trigger parameter - ENUM_RSSI_TRIGGER_TYPE eRssiTriggerType; - PARAM_RSSI rRssiTriggerValue; - - // Privacy Filter - ENUM_PARAM_PRIVACY_FILTER_T ePrivacyFilter; - - // RTS Threshold - PARAM_RTS_THRESHOLD eRtsThreshold; - - // Network Type - UINT_8 ucNetworkType; - - // Network Type In Use - UINT_8 ucNetworkTypeInUse; - -} WLAN_INFO_T, *P_WLAN_INFO_T; - -/* Session for CONNECTION SETTINGS */ -typedef struct _CONNECTION_SETTINGS_T { - - UINT_8 aucMacAddress[MAC_ADDR_LEN]; - - UINT_8 ucDelayTimeOfDisconnectEvent; - - BOOLEAN fgIsConnByBssidIssued; - UINT_8 aucBSSID[MAC_ADDR_LEN]; - - BOOLEAN fgIsConnReqIssued; - UINT_8 ucSSIDLen; - UINT_8 aucSSID[ELEM_MAX_LEN_SSID]; - - ENUM_PARAM_OP_MODE_T eOPMode; - - ENUM_PARAM_CONNECTION_POLICY_T eConnectionPolicy; - - ENUM_PARAM_AD_HOC_MODE_T eAdHocMode; - - ENUM_PARAM_AUTH_MODE_T eAuthMode; - - ENUM_PARAM_ENCRYPTION_STATUS_T eEncStatus; - - BOOLEAN fgIsScanReqIssued; - - - /* MIB attributes */ - UINT_16 u2BeaconPeriod; - - UINT_16 u2RTSThreshold; /* User desired setting */ - - UINT_16 u2DesiredNonHTRateSet; /* User desired setting */ - - UINT_8 ucAdHocChannelNum; /* For AdHoc */ - - ENUM_BAND_T eAdHocBand; /* For AdHoc */ - - UINT_32 u4FreqInKHz; /* Center frequency */ - - /* ATIM windows using for IBSS power saving function */ - UINT_16 u2AtimWindow; - - /* Features */ - BOOLEAN fgIsEnableRoaming; - - BOOLEAN fgIsAdHocQoSEnable; - - ENUM_PARAM_PHY_CONFIG_T eDesiredPhyConfig; - - /* Used for AP mode for desired channel and bandwidth */ - UINT_16 u2CountryCode; - UINT_8 uc2G4BandwidthMode; /* 20/40M or 20M only */ - UINT_8 uc5GBandwidthMode; /* 20/40M or 20M only */ - - BOOLEAN fgTxShortGIDisabled; - BOOLEAN fgRxShortGIDisabled; - -#if CFG_SUPPORT_802_11D - BOOLEAN fgMultiDomainCapabilityEnabled; -#endif /* CFG_SUPPORT_802_11D*/ - - -#if 1 //CFG_SUPPORT_WAPI - BOOL fgWapiMode; - UINT_32 u4WapiSelectedGroupCipher; - UINT_32 u4WapiSelectedPairwiseCipher; - UINT_32 u4WapiSelectedAKMSuite; -#endif - - /* CR1486, CR1640 */ - /* for WPS, disable the privacy check for AP selection policy */ - BOOLEAN fgPrivacyCheckDisable; - - /* b0~3: trigger-en AC0~3. b4~7: delivery-en AC0~3 */ - UINT_8 bmfgApsdEnAc; - -} CONNECTION_SETTINGS_T, *P_CONNECTION_SETTINGS_T; - -struct _BSS_INFO_T { - - ENUM_PARAM_MEDIA_STATE_T eConnectionState; /* Connected Flag used in AIS_NORMAL_TR */ - ENUM_PARAM_MEDIA_STATE_T eConnectionStateIndicated; /* The Media State that report to HOST */ - - ENUM_OP_MODE_T eCurrentOPMode; /* Current Operation Mode - Infra/IBSS */ -#if CFG_ENABLE_WIFI_DIRECT - ENUM_OP_MODE_T eIntendOPMode; -#endif - - BOOLEAN fgIsNetActive; /* TRUE if this network has been activated */ - - UINT_8 ucNetTypeIndex; /* ENUM_NETWORK_TYPE_INDEX_T */ - - UINT_8 ucReasonOfDisconnect; /* Used by media state indication */ - - UINT_8 ucSSIDLen; /* Length of SSID */ - -#if CFG_ENABLE_WIFI_DIRECT - ENUM_HIDDEN_SSID_TYPE_T eHiddenSsidType; /* For Hidden SSID usage. */ -#endif - - UINT_8 aucSSID[ELEM_MAX_LEN_SSID]; /* SSID used in this BSS */ - - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* The BSSID of the associated BSS */ - - UINT_8 aucOwnMacAddr[MAC_ADDR_LEN];/* Owned MAC Address used in this BSS */ - - P_STA_RECORD_T prStaRecOfAP; /* For Infra Mode, and valid only if - * eConnectionState == MEDIA_STATE_CONNECTED - */ - LINK_T rStaRecOfClientList; /* For IBSS/AP Mode, all known STAs in current BSS */ - - UINT_16 u2CapInfo; /* Change Detection */ - - UINT_16 u2BeaconInterval; /* The Beacon Interval of this BSS */ - - - UINT_16 u2ATIMWindow; /* For IBSS Mode */ - - UINT_16 u2AssocId; /* For Infra Mode, it is the Assoc ID assigned by AP. - */ - - - UINT_8 ucDTIMPeriod; /* For Infra/AP Mode */ - - UINT_8 ucDTIMCount; /* For AP Mode, it is the DTIM value we should carried in - * the Beacon of next TBTT. - */ - - UINT_8 ucPhyTypeSet; /* Available PHY Type Set of this peer - * (This is deduced from received BSS_DESC_T) - */ - - UINT_8 ucNonHTBasicPhyType; /* The Basic PHY Type Index, used to setup Phy Capability */ - - UINT_8 ucConfigAdHocAPMode; /* The configuration of AdHoc/AP Mode. e.g. 11g or 11b */ - - UINT_8 ucBeaconTimeoutCount; /* For Infra/AP Mode, it is a threshold of Beacon Lost Count to - confirm connection was lost */ - - BOOLEAN fgHoldSameBssidForIBSS; /* For IBSS Mode, to keep use same BSSID to extend the life cycle of an IBSS */ - - BOOLEAN fgIsBeaconActivated; /* For AP/IBSS Mode, it is used to indicate that Beacon is sending */ - - P_MSDU_INFO_T prBeacon; /* For AP/IBSS Mode - Beacon Frame */ - - BOOLEAN fgIsIBSSMaster; /* For IBSS Mode - To indicate that we can reply ProbeResp Frame. - In current TBTT interval */ - - BOOLEAN fgIsShortPreambleAllowed; /* From Capability Info. of AssocResp Frame AND of Beacon/ProbeResp Frame */ - BOOLEAN fgUseShortPreamble; /* Short Preamble is enabled in current BSS. */ - BOOLEAN fgUseShortSlotTime; /* Short Slot Time is enabled in current BSS. */ - - UINT_16 u2OperationalRateSet; /* Operational Rate Set of current BSS */ - UINT_16 u2BSSBasicRateSet; /* Basic Rate Set of current BSS */ - - - UINT_8 ucAllSupportedRatesLen; /* Used for composing Beacon Frame in AdHoc or AP Mode */ - UINT_8 aucAllSupportedRates[RATE_NUM]; - - UINT_8 ucAssocClientCnt; /* TODO(Kevin): Number of associated clients */ - - BOOLEAN fgIsProtection; - BOOLEAN fgIsQBSS; /* fgIsWmmBSS; */ /* For Infra/AP/IBSS Mode, it is used to indicate if we support WMM in - * current BSS. */ - BOOLEAN fgIsNetAbsent; /* TRUE: BSS is absent, FALSE: BSS is present */ - - UINT_32 u4RsnSelectedGroupCipher; - UINT_32 u4RsnSelectedPairwiseCipher; - UINT_32 u4RsnSelectedAKMSuite; - UINT_16 u2RsnSelectedCapInfo; - - /*------------------------------------------------------------------------*/ - /* Power Management related information */ - /*------------------------------------------------------------------------*/ - PM_PROFILE_SETUP_INFO_T rPmProfSetupInfo; - - - /*------------------------------------------------------------------------*/ - /* WMM/QoS related information */ - /*------------------------------------------------------------------------*/ - UINT_8 ucWmmParamSetCount; /* Used to detect the change of EDCA parameters. For AP mode, the value is used in WMM IE */ - - AC_QUE_PARMS_T arACQueParms[WMM_AC_INDEX_NUM]; - - UINT_8 aucCWminLog2ForBcast[WMM_AC_INDEX_NUM]; /* For AP mode, broadcast the CWminLog2 */ - UINT_8 aucCWmaxLog2ForBcast[WMM_AC_INDEX_NUM]; /* For AP mode, broadcast the CWmaxLog2 */ - AC_QUE_PARMS_T arACQueParmsForBcast[WMM_AC_INDEX_NUM]; /* For AP mode, broadcast the value */ - - /*------------------------------------------------------------------------*/ - /* 802.11n HT operation IE when (prStaRec->ucPhyTypeSet & PHY_TYPE_BIT_HT)*/ - /* is true. They have the same definition with fields of */ - /* information element (CM) */ - /*------------------------------------------------------------------------*/ - ENUM_BAND_T eBand; - UINT_8 ucPrimaryChannel; - UINT_8 ucHtOpInfo1; - UINT_16 u2HtOpInfo2; - UINT_16 u2HtOpInfo3; - - /*------------------------------------------------------------------------*/ - /* Required protection modes (CM) */ - /*------------------------------------------------------------------------*/ - BOOLEAN fgErpProtectMode; - ENUM_HT_PROTECT_MODE_T eHtProtectMode; - ENUM_GF_MODE_T eGfOperationMode; - ENUM_RIFS_MODE_T eRifsOperationMode; - - BOOLEAN fgObssErpProtectMode; /* GO only */ - ENUM_HT_PROTECT_MODE_T eObssHtProtectMode; /* GO only */ - ENUM_GF_MODE_T eObssGfOperationMode; /* GO only */ - BOOLEAN fgObssRifsOperationMode; /* GO only */ - - /*------------------------------------------------------------------------*/ - /* OBSS to decide if 20/40M bandwidth is permitted. */ - /* The first member indicates the following channel list length. */ - /*------------------------------------------------------------------------*/ - BOOLEAN fgAssoc40mBwAllowed; - BOOLEAN fg40mBwAllowed; - ENUM_CHNL_EXT_T eBssSCO; /* Real setting for HW - * 20/40M AP mode will always set 40M, - * but its OP IE can be changed. - */ - UINT_8 auc2G_20mReqChnlList[CHNL_LIST_SZ_2G + 1]; - UINT_8 auc2G_NonHtChnlList[CHNL_LIST_SZ_2G + 1]; - UINT_8 auc2G_PriChnlList[CHNL_LIST_SZ_2G + 1]; - UINT_8 auc2G_SecChnlList[CHNL_LIST_SZ_2G + 1]; - - UINT_8 auc5G_20mReqChnlList[CHNL_LIST_SZ_5G + 1]; - UINT_8 auc5G_NonHtChnlList[CHNL_LIST_SZ_5G + 1]; - UINT_8 auc5G_PriChnlList[CHNL_LIST_SZ_5G + 1]; - UINT_8 auc5G_SecChnlList[CHNL_LIST_SZ_5G + 1]; - - TIMER_T rObssScanTimer; - UINT_16 u2ObssScanInterval; /* in unit of sec */ - - BOOLEAN fgObssActionForcedTo20M; /* GO only */ - BOOLEAN fgObssBeaconForcedTo20M; /* GO only */ - - /*------------------------------------------------------------------------*/ - /* HW Related Fields (Kevin) */ - /*------------------------------------------------------------------------*/ - UINT_8 ucHwDefaultFixedRateCode; /* The default rate code copied to MAC TX Desc */ - UINT_16 u2HwLPWakeupGuardTimeUsec; - - - UINT_8 ucBssFreeQuota; /* The value is updated from FW */ -}; - - -struct _AIS_SPECIFIC_BSS_INFO_T { - UINT_8 ucRoamingAuthTypes; /* This value indicate the roaming type used in AIS_JOIN */ - - BOOLEAN fgIsIBSSActive; - - /*! \brief Global flag to let arbiter stay at standby and not connect to any network */ - BOOLEAN fgCounterMeasure; - UINT_8 ucWEPDefaultKeyID; - BOOLEAN fgTransmitKeyExist; /* Legacy wep Transmit key exist or not */ - - /* While Do CounterMeasure procedure, check the EAPoL Error report have send out */ - BOOLEAN fgCheckEAPoLTxDone; - - UINT_32 u4RsnaLastMICFailTime; - - /* Stored the current bss wpa rsn cap filed, used for roaming policy */ - //UINT_16 u2RsnCap; - TIMER_T rPreauthenticationTimer; - - /* By the flow chart of 802.11i, - wait 60 sec before associating to same AP - or roaming to a new AP - or sending data in IBSS, - keep a timer for handle the 60 sec counterMeasure */ - TIMER_T rRsnaBlockTrafficTimer; - TIMER_T rRsnaEAPoLReportTimeoutTimer; - - /* For Keep the Tx/Rx Mic key for TKIP SW Calculate Mic */ - /* This is only one for AIS/AP */ - UINT_8 aucTxMicKey[8]; - UINT_8 aucRxMicKey[8]; - - /* Buffer for WPA2 PMKID */ - /* The PMKID cache lifetime is expire by media_disconnect_indication */ - UINT_32 u4PmkidCandicateCount; - PMKID_CANDICATE_T arPmkidCandicate[CFG_MAX_PMKID_CACHE]; - UINT_32 u4PmkidCacheCount; - PMKID_ENTRY_T arPmkidCache[CFG_MAX_PMKID_CACHE]; - BOOLEAN fgIndicatePMKID; -#if CFG_SUPPORT_802_11W - BOOLEAN fgMgmtProtection; - UINT_32 u4SaQueryStart; - UINT_32 u4SaQueryCount; - UINT_8 ucSaQueryTimedOut; - PUINT_8 pucSaQueryTransId; - TIMER_T rSaQueryTimer; - BOOLEAN fgBipKeyInstalled; -#endif -}; - -struct _BOW_SPECIFIC_BSS_INFO_T { - UINT_16 u2Reserved; /* Reserved for Data Type Check */ -}; - -#if CFG_SLT_SUPPORT -typedef struct _SLT_INFO_T { - - P_BSS_DESC_T prPseudoBssDesc; - UINT_16 u2SiteID; - UINT_8 ucChannel2G4; - UINT_8 ucChannel5G; - BOOLEAN fgIsDUT; - UINT_32 u4BeaconReceiveCnt; - /////////Deprecated///////// - P_STA_RECORD_T prPseudoStaRec; -} SLT_INFO_T, *P_SLT_INFO_T; -#endif - - -/* Major member variables for WiFi FW operation. - Variables within this region will be ready for access after WIFI function is enabled. -*/ -typedef struct _WIFI_VAR_T { - BOOLEAN fgIsRadioOff; - - BOOLEAN fgIsEnterD3ReqIssued; - - BOOLEAN fgDebugCmdResp; - - CONNECTION_SETTINGS_T rConnSettings; - - SCAN_INFO_T rScanInfo; - -#if CFG_SUPPORT_ROAMING - ROAMING_INFO_T rRoamingInfo; -#endif /* CFG_SUPPORT_ROAMING */ - - AIS_FSM_INFO_T rAisFsmInfo; - - ENUM_PWR_STATE_T aePwrState[NETWORK_TYPE_INDEX_NUM]; - - BSS_INFO_T arBssInfo[NETWORK_TYPE_INDEX_NUM]; - - AIS_SPECIFIC_BSS_INFO_T rAisSpecificBssInfo; - -#if CFG_ENABLE_WIFI_DIRECT - P_P2P_CONNECTION_SETTINGS_T prP2PConnSettings; - - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo; - - P_P2P_FSM_INFO_T prP2pFsmInfo; -#endif /* CFG_ENABLE_WIFI_DIRECT */ - -#if CFG_ENABLE_BT_OVER_WIFI - BOW_SPECIFIC_BSS_INFO_T rBowSpecificBssInfo; - BOW_FSM_INFO_T rBowFsmInfo; -#endif /* CFG_ENABLE_BT_OVER_WIFI */ - - DEAUTH_INFO_T arDeauthInfo[MAX_DEAUTH_INFO_COUNT]; - - /* Current Wi-Fi Settings and Flags */ - UINT_8 aucPermanentAddress[MAC_ADDR_LEN]; - UINT_8 aucMacAddress[MAC_ADDR_LEN]; - UINT_8 aucDeviceAddress[MAC_ADDR_LEN]; - UINT_8 aucInterfaceAddress[MAC_ADDR_LEN]; - - UINT_8 ucAvailablePhyTypeSet; - - ENUM_PHY_TYPE_INDEX_T eNonHTBasicPhyType2G4; /* Basic Phy Type used by SCN according - * to the set of Available PHY Types - */ - - ENUM_PARAM_PREAMBLE_TYPE_T ePreambleType; - ENUM_REGISTRY_FIXED_RATE_T eRateSetting; - - BOOLEAN fgIsShortSlotTimeOptionEnable; - /* User desired setting, but will honor the capability of AP */ - - BOOLEAN fgEnableJoinToHiddenSSID; - BOOLEAN fgSupportWZCDisassociation; - - BOOLEAN fgSupportQoS; - BOOLEAN fgSupportAmpduTx; - BOOLEAN fgSupportAmpduRx; - BOOLEAN fgSupportTspec; - BOOLEAN fgSupportUAPSD; - BOOLEAN fgSupportULPSMP; - -#if CFG_SLT_SUPPORT - SLT_INFO_T rSltInfo; -#endif - -} WIFI_VAR_T, *P_WIFI_VAR_T;/* end of _WIFI_VAR_T */ - -/* cnm_timer module */ -typedef struct { - LINK_T rLinkHead; - OS_SYSTIME rNextExpiredSysTime; - KAL_WAKE_LOCK_T rWakeLock; - BOOLEAN fgWakeLocked; -} ROOT_TIMER, *P_ROOT_TIMER; - - -/* FW/DRV/NVRAM version information */ -typedef struct { - - /* NVRAM or Registry */ - UINT_16 u2Part1CfgOwnVersion; - UINT_16 u2Part1CfgPeerVersion; - UINT_16 u2Part2CfgOwnVersion; - UINT_16 u2Part2CfgPeerVersion; - - /* Firmware */ - UINT_16 u2FwProductID; - UINT_16 u2FwOwnVersion; - UINT_16 u2FwPeerVersion; - -} WIFI_VER_INFO_T, *P_WIFI_VER_INFO_T; - - -#if CFG_ENABLE_WIFI_DIRECT -/* -* p2p function pointer structure -*/ - -typedef struct _P2P_FUNCTION_LINKER { - P2P_REMOVE prP2pRemove; -// NIC_P2P_MEDIA_STATE_CHANGE prNicP2pMediaStateChange; -// SCAN_UPDATE_P2P_DEVICE_DESC prScanUpdateP2pDeviceDesc; -// P2P_FSM_RUN_EVENT_RX_PROBE_RESPONSE_FRAME prP2pFsmRunEventRxProbeResponseFrame; - P2P_GENERATE_P2P_IE prP2pGenerateWSC_IEForBeacon; -// P2P_CALCULATE_WSC_IE_LEN_FOR_PROBE_RSP prP2pCalculateWSC_IELenForProbeRsp; -// P2P_GENERATE_WSC_IE_FOR_PROBE_RSP prP2pGenerateWSC_IEForProbeRsp; -// SCAN_REMOVE_P2P_BSS_DESC prScanRemoveP2pBssDesc; -// P2P_HANDLE_SEC_CHECK_RSP prP2pHandleSecCheckRsp; - P2P_NET_REGISTER prP2pNetRegister; - P2P_NET_UNREGISTER prP2pNetUnregister; - P2P_CALCULATE_P2P_IE_LEN prP2pCalculateP2p_IELenForAssocReq; /* All IEs generated from supplicant. */ - P2P_GENERATE_P2P_IE prP2pGenerateP2p_IEForAssocReq; /* All IEs generated from supplicant. */ -} P2P_FUNCTION_LINKER, *P_P2P_FUNCTION_LINKER; - - -#endif - -/* - * Major ADAPTER structure - * Major data structure for driver operation - */ -struct _ADAPTER_T { - UINT_8 ucRevID; - - UINT_16 u2NicOpChnlNum; - - BOOLEAN fgIsEnableWMM; - BOOLEAN fgIsWmmAssoc; /* This flag is used to indicate that WMM is enable in current BSS */ - - UINT_32 u4OsPacketFilter; // packet filter used by OS - - -#if CFG_TCP_IP_CHKSUM_OFFLOAD - UINT_32 u4CSUMFlags; -#endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */ - - - ENUM_BAND_T aePreferBand[NETWORK_TYPE_INDEX_NUM]; - - /* ADAPTER flags */ - UINT_32 u4Flags; - UINT_32 u4HwFlags; - - BOOLEAN fgIsRadioOff; - - BOOLEAN fgIsEnterD3ReqIssued; - - UINT_8 aucMacAddress[MAC_ADDR_LEN]; - - ENUM_PHY_TYPE_INDEX_T eCurrentPhyType; /* Current selection basing on the set of Available PHY Types */ - -#if CFG_COALESCING_BUFFER_SIZE || CFG_SDIO_RX_AGG - UINT_32 u4CoalescingBufCachedSize; - PUINT_8 pucCoalescingBufCached; -#endif /* CFG_COALESCING_BUFFER_SIZE */ - - /* Buffer for CMD_INFO_T, Mgt packet and mailbox message */ - BUF_INFO_T rMgtBufInfo; - BUF_INFO_T rMsgBufInfo; - PUINT_8 pucMgtBufCached; - UINT_32 u4MgtBufCachedSize; - UINT_8 aucMsgBuf[MSG_BUFFER_SIZE]; -#if CFG_DBG_MGT_BUF - UINT_32 u4MemAllocDynamicCount; /* Debug only */ - UINT_32 u4MemFreeDynamicCount; /* Debug only */ -#endif - - STA_RECORD_T arStaRec[CFG_STA_REC_NUM]; - - /* Element for TX PATH */ - TX_CTRL_T rTxCtrl; - QUE_T rFreeCmdList; - CMD_INFO_T arHifCmdDesc[CFG_TX_MAX_CMD_PKT_NUM]; - - /* Element for RX PATH */ - RX_CTRL_T rRxCtrl; - - P_SDIO_CTRL_T prSDIOCtrl; - -#if (MT6620_E1_ASIC_HIFSYS_WORKAROUND == 1) - /* Element for MT6620 E1 HIFSYS workaround */ - BOOLEAN fgIsClockGatingEnabled; -#endif - - /* Buffer for Authentication Event */ - /* Move to glue layer and refine the kal function */ - /* Reference to rsnGeneratePmkidIndication function at rsn.c */ - UINT_8 aucIndicationEventBuffer[(CFG_MAX_PMKID_CACHE * 20) + 8 ]; - - UINT_32 u4IntStatus; - - ENUM_ACPI_STATE_T rAcpiState; - - BOOLEAN fgIsIntEnable; - BOOLEAN fgIsIntEnableWithLPOwnSet; - - BOOLEAN fgIsFwOwn; - BOOLEAN fgWiFiInSleepyState; - - UINT_32 u4PwrCtrlBlockCnt; - - QUE_T rPendingCmdQueue; - - P_GLUE_INFO_T prGlueInfo; - - UINT_8 ucCmdSeqNum; - UINT_8 ucTxSeqNum; - -#if 1//CFG_SUPPORT_WAPI - BOOLEAN fgUseWapi; -#endif - - /* RF Test flags */ - BOOLEAN fgTestMode; - - /* WLAN Info for DRIVER_CORE OID query */ - WLAN_INFO_T rWlanInfo; - -#if CFG_ENABLE_WIFI_DIRECT - BOOLEAN fgIsP2PRegistered; - ENUM_NET_REG_STATE_T rP2PNetRegState; - BOOLEAN fgIsWlanLaunched; - P_P2P_INFO_T prP2pInfo; -#if CFG_SUPPORT_P2P_RSSI_QUERY - OS_SYSTIME rP2pLinkQualityUpdateTime; - BOOLEAN fgIsP2pLinkQualityValid; - EVENT_LINK_QUALITY rP2pLinkQuality; -#endif -#endif - - /* Online Scan Option */ - BOOLEAN fgEnOnlineScan; - - /* Online Scan Option */ - BOOLEAN fgDisBcnLostDetection; - - /* MAC address */ - PARAM_MAC_ADDRESS rMyMacAddr; - - /* Wake-up Event for WOL */ - UINT_32 u4WakeupEventEnable; - - /* Event Buffering */ - EVENT_STATISTICS rStatStruct; - OS_SYSTIME rStatUpdateTime; - BOOLEAN fgIsStatValid; - - EVENT_LINK_QUALITY rLinkQuality; - OS_SYSTIME rLinkQualityUpdateTime; - BOOLEAN fgIsLinkQualityValid; - OS_SYSTIME rLinkRateUpdateTime; - BOOLEAN fgIsLinkRateValid; - - /* WIFI_VAR_T */ - WIFI_VAR_T rWifiVar; - - /* MTK WLAN NIC driver IEEE 802.11 MIB */ - IEEE_802_11_MIB_T rMib; - - /* Mailboxs for inter-module communication */ - MBOX_T arMbox[MBOX_ID_TOTAL_NUM]; - - /* Timers for OID Pending Handling */ - TIMER_T rOidTimeoutTimer; - - /* Root Timer for cnm_timer module */ - ROOT_TIMER rRootTimer; - - /* RLM maintenance */ - ENUM_CHNL_EXT_T eRfSco; - ENUM_SYS_PROTECT_MODE_T eSysProtectMode; - ENUM_GF_MODE_T eSysHtGfMode; - ENUM_RIFS_MODE_T eSysTxRifsMode; - ENUM_SYS_PCO_PHASE_T eSysPcoPhase; - - P_DOMAIN_INFO_ENTRY prDomainInfo; - - /* QM */ - QUE_MGT_T rQM; - - CNM_INFO_T rCnmInfo; - - UINT_32 u4PowerMode; - - UINT_32 u4CtiaPowerMode; - BOOLEAN fgEnCtiaPowerMode; - - UINT_32 fgEnArpFilter; - - UINT_32 u4UapsdAcBmp; - - UINT_32 u4MaxSpLen; - - UINT_32 u4PsCurrentMeasureEn; - - /* Version Information */ - WIFI_VER_INFO_T rVerInfo; - - /* 5GHz support (from F/W) */ - BOOLEAN fgIsHw5GBandDisabled; - BOOLEAN fgEnable5GBand; - BOOLEAN fgIsEepromUsed; - BOOLEAN fgIsEfuseValid; - BOOLEAN fgIsEmbbededMacAddrValid; - - /* Packet Forwarding Tracking */ - INT_32 i4PendingFwdFrameCount; - -#if CFG_SUPPORT_RDD_TEST_MODE - UINT_8 ucRddStatus; -#endif - - BOOL fgDisStaAgingTimeoutDetection; - -};/* end of _ADAPTER_T */ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Macros for BSS_INFO_T - Flag of Net Active */ -/*----------------------------------------------------------------------------*/ -#define IS_NET_ACTIVE(_prAdapter, _NetTypeIndex) \ - (_prAdapter->rWifiVar.arBssInfo[(_NetTypeIndex)].fgIsNetActive) -#define IS_BSS_ACTIVE(_prBssInfo) ((_prBssInfo)->fgIsNetActive) - -#define IS_AIS_ACTIVE(_prAdapter) IS_NET_ACTIVE(_prAdapter, NETWORK_TYPE_AIS_INDEX) -#define IS_P2P_ACTIVE(_prAdapter) IS_NET_ACTIVE(_prAdapter, NETWORK_TYPE_P2P_INDEX) -#define IS_BOW_ACTIVE(_prAdapter) IS_NET_ACTIVE(_prAdapter, NETWORK_TYPE_BOW_INDEX) - -#define SET_NET_ACTIVE(_prAdapter, _NetTypeIndex) \ - {_prAdapter->rWifiVar.arBssInfo[(_NetTypeIndex)].fgIsNetActive = TRUE;} - -#define UNSET_NET_ACTIVE(_prAdapter, _NetTypeIndex) \ - {_prAdapter->rWifiVar.arBssInfo[(_NetTypeIndex)].fgIsNetActive = FALSE;} - -#define BSS_INFO_INIT(_prAdapter, _NetTypeIndex) \ - { UINT_8 _aucZeroMacAddr[] = NULL_MAC_ADDR; \ - P_BSS_INFO_T _prBssInfo = &(_prAdapter->rWifiVar.arBssInfo[(_NetTypeIndex)]); \ - \ - _prBssInfo->eConnectionState = PARAM_MEDIA_STATE_DISCONNECTED; \ - _prBssInfo->eConnectionStateIndicated = PARAM_MEDIA_STATE_DISCONNECTED; \ - _prBssInfo->eCurrentOPMode = OP_MODE_INFRASTRUCTURE; \ - _prBssInfo->fgIsNetActive = FALSE; \ - _prBssInfo->ucNetTypeIndex = (_NetTypeIndex); \ - _prBssInfo->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_RESERVED; \ - COPY_MAC_ADDR(_prBssInfo->aucBSSID, _aucZeroMacAddr); \ - LINK_INITIALIZE(&_prBssInfo->rStaRecOfClientList); \ - _prBssInfo->fgIsBeaconActivated = FALSE; \ - _prBssInfo->ucHwDefaultFixedRateCode = RATE_CCK_1M_LONG; \ - _prBssInfo->fgIsNetAbsent = FALSE; \ - } - -#if CFG_ENABLE_BT_OVER_WIFI -#define BOW_BSS_INFO_INIT(_prAdapter, _NetTypeIndex) \ - { \ - P_BSS_INFO_T _prBssInfo = &(_prAdapter->rWifiVar.arBssInfo[(_NetTypeIndex)]); \ - \ - _prBssInfo->eConnectionState = PARAM_MEDIA_STATE_DISCONNECTED; \ - _prBssInfo->eConnectionStateIndicated = PARAM_MEDIA_STATE_DISCONNECTED; \ - _prBssInfo->eCurrentOPMode = OP_MODE_BOW; \ - _prBssInfo->ucNetTypeIndex = (_NetTypeIndex); \ - _prBssInfo->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_RESERVED; \ - LINK_INITIALIZE(&_prBssInfo->rStaRecOfClientList); \ - _prBssInfo->fgIsBeaconActivated = TRUE; \ - _prBssInfo->ucHwDefaultFixedRateCode = RATE_CCK_1M_LONG; \ - _prBssInfo->fgIsNetAbsent = FALSE; \ - } -#endif - -/*----------------------------------------------------------------------------*/ -/* Macros for Power State */ -/*----------------------------------------------------------------------------*/ -#define SET_NET_PWR_STATE_IDLE(_prAdapter, _NetTypeIndex) \ - {_prAdapter->rWifiVar.aePwrState[(_NetTypeIndex)] = PWR_STATE_IDLE;} - -#define SET_NET_PWR_STATE_ACTIVE(_prAdapter, _NetTypeIndex) \ - {_prAdapter->rWifiVar.aePwrState[(_NetTypeIndex)] = PWR_STATE_ACTIVE;} - -#define SET_NET_PWR_STATE_PS(_prAdapter, _NetTypeIndex) \ - {_prAdapter->rWifiVar.aePwrState[(_NetTypeIndex)] = PWR_STATE_PS;} - -#define IS_NET_PWR_STATE_ACTIVE(_prAdapter, _NetTypeIndex) \ - (_prAdapter->rWifiVar.aePwrState[(_NetTypeIndex)] == PWR_STATE_ACTIVE) - -#define IS_NET_PWR_STATE_IDLE(_prAdapter, _NetTypeIndex) \ - (_prAdapter->rWifiVar.aePwrState[(_NetTypeIndex)] == PWR_STATE_IDLE) - -#define IS_SCN_PWR_STATE_ACTIVE(_prAdapter) \ - (_prAdapter->rWifiVar.rScanInfo.eScanPwrState == SCAN_PWR_STATE_ACTIVE) - -#define IS_SCN_PWR_STATE_IDLE(_prAdapter) \ - (_prAdapter->rWifiVar.rScanInfo.eScanPwrState == SCAN_PWR_STATE_IDLE) - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _ADAPTER_H */ - - diff --git a/drivers/net/wireless/mt5931/include/nic/bow.h b/drivers/net/wireless/mt5931/include/nic/bow.h deleted file mode 100755 index d0be930e2a61..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/bow.h +++ /dev/null @@ -1,323 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/bow.h#1 $ -*/ - - - -/* -** $Log: bow.h $ - * - * 01 16 2012 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Support BOW for 5GHz band. - * - * 05 25 2011 terry.wu - * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment - * Add BoW Cancel Scan Request and Turn On deactive network function. - * - * 05 22 2011 terry.wu - * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment - * Submit missing BoW header files. - * - * 03 27 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Support multiple physical link. - * - * 03 06 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Sync BOW Driver to latest person development branch version.. - * - * 02 10 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Fix kernel API change issue. - * Before ALPS 2.2 (2.2 included), kfifo_alloc() is - * struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, spinlock_t *lock); - * After ALPS 2.3, kfifo_alloc() is changed to - * int kfifo_alloc(struct kfifo *fifo, unsigned int size, gfp_t gfp_mask); - * - * 02 10 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Update BOW structure. - * - * 02 09 2011 cp.wu - * [WCXRP00000430] [MT6620 Wi-Fi][Firmware][Driver] Create V1.2 branch for MT6620E1 and MT6620E3 - * create V1.2 driver branch based on label MT6620_WIFI_DRIVER_V1_2_110209_1031 - * with BOW and P2P enabled as default - * - * 02 08 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Replace kfifo_get and kfifo_put with kfifo_out and kfifo_in. - * Update BOW get MAC status, remove returning event for AIS network type. - * - * 01 11 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add Activity Report definition. - * - * 10 18 2010 chinghwa.yu - * [WCXRP00000110] [MT6620 Wi-Fi] [Driver] Fix BoW Connected event size - * Fix wrong BoW event size. - * - * 07 15 2010 cp.wu - * - * sync. bluetooth-over-Wi-Fi interface to driver interface document v0.2.6. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * 1) all BT physical handles shares the same RSSI/Link Quality. - * 2) simplify BT command composing - * - * 04 28 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * change prefix for data structure used to communicate with 802.11 PAL - * to avoid ambiguous naming with firmware interface - * - * 04 27 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * basic implementation for EVENT_BT_OVER_WIFI - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * * * * 2) command sequence number is now increased atomically - * * * * * * * 3) private data could be hold and taken use for other purpose - * - * 04 09 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * sync. with design document for interface change. - * - * 04 02 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * Wi-Fi driver no longer needs to implement 802.11 PAL, thus replaced by wrapping command/event definitions - * - * 03 16 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * correct typo. - * - * 03 16 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * update for all command/event needed to be supported by 802.11 PAL. - * - * 03 16 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * build up basic data structure and definitions to support BT-over-WiFi - * -*/ - -#ifndef _BOW_H_ -#define _BOW_H_ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -#define BOWDEVNAME "bow0" - -#define MAX_BOW_NUMBER_OF_CHANNEL_2G4 14 -#define MAX_BOW_NUMBER_OF_CHANNEL_5G 4 -#define MAX_BOW_NUMBER_OF_CHANNEL 18 //(MAX_BOW_NUMBER_OF_CHANNEL_2G4 + MAX_BOW_NUMBER_OF_CHANNEL_5G) - -#define MAX_ACTIVITY_REPORT 2 -#define MAX_ACTIVITY_REPROT_TIME 660 - -#define ACTIVITY_REPORT_STATUS_SUCCESS 0 -#define ACTIVITY_REPORT_STATUS_FAILURE 1 -#define ACTIVITY_REPORT_STATUS_TIME_INVALID 2 -#define ACTIVITY_REPORT_STATUS_OTHERS 3 - -#define ACTIVITY_REPORT_SCHEDULE_UNKNOWN 0 //Does not know the schedule of the interference -#define ACTIVITY_REPORT_SCHEDULE_KNOWN 1 - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef struct _BT_OVER_WIFI_COMMAND_HEADER_T { - UINT_8 ucCommandId; - UINT_8 ucSeqNumber; - UINT_16 u2PayloadLength; -} AMPC_COMMAND_HEADER_T, *P_AMPC_COMMAND_HEADER_T; - -typedef struct _BT_OVER_WIFI_COMMAND { - AMPC_COMMAND_HEADER_T rHeader; - UINT_8 aucPayload[0]; -} AMPC_COMMAND, *P_AMPC_COMMAND; - -typedef struct _BT_OVER_WIFI_EVENT_HEADER_T { - UINT_8 ucEventId; - UINT_8 ucSeqNumber; - UINT_16 u2PayloadLength; -} AMPC_EVENT_HEADER_T, *P_AMPC_EVENT_HEADER_T; - -typedef struct _BT_OVER_WIFI_EVENT { - AMPC_EVENT_HEADER_T rHeader; - UINT_8 aucPayload[0]; -} AMPC_EVENT, *P_AMPC_EVENT; - -typedef struct _CHANNEL_DESC_T { - UINT_8 ucChannelBand; - UINT_8 ucChannelNum; -} CHANNEL_DESC, P_CHANNEL_DESC; - -// Command Structures -typedef struct _BOW_SETUP_CONNECTION { -//Fixed to 2.4G - UINT_8 ucChannelNum; - UINT_8 ucReserved1; - UINT_8 aucPeerAddress[6]; - UINT_16 u2BeaconInterval; - UINT_8 ucTimeoutDiscovery; - UINT_8 ucTimeoutInactivity; - UINT_8 ucRole; - UINT_8 ucPAL_Capabilities; - INT_8 cMaxTxPower; - UINT_8 ucReserved2; - -//Pending, for future BOW 5G supporting. -/* UINT_8 aucPeerAddress[6]; - UINT_16 u2BeaconInterval; - UINT_8 ucTimeoutDiscovery; - UINT_8 ucTimeoutInactivity; - UINT_8 ucRole; - UINT_8 ucPAL_Capabilities; - INT_8 cMaxTxPower; - UINT_8 ucChannelListNum; - CHANNEL_DESC arChannelList[1]; -*/ -} BOW_SETUP_CONNECTION, *P_BOW_SETUP_CONNECTION; - -typedef struct _BOW_DESTROY_CONNECTION { - UINT_8 aucPeerAddress[6]; - UINT_8 aucReserved[2]; -} BOW_DESTROY_CONNECTION, *P_BOW_DESTROY_CONNECTION; - -typedef struct _BOW_SET_PTK { - UINT_8 aucPeerAddress[6]; - UINT_8 aucReserved[2]; - UINT_8 aucTemporalKey[16]; -} BOW_SET_PTK, *P_BOW_SET_PTK; - -typedef struct _BOW_READ_RSSI { - UINT_8 aucPeerAddress[6]; - UINT_8 aucReserved[2]; -} BOW_READ_RSSI, *P_BOW_READ_RSSI; - -typedef struct _BOW_READ_LINK_QUALITY { - UINT_8 aucPeerAddress[6]; - UINT_8 aucReserved[2]; -} BOW_READ_LINK_QUALITY, *P_BOW_READ_LINK_QUALITY; - -typedef struct _BOW_SHORT_RANGE_MODE { - UINT_8 aucPeerAddress[6]; - INT_8 cTxPower; - UINT_8 ucReserved; -} BOW_SHORT_RANGE_MODE, *P_BOW_SHORT_RANGE_MODE; - -// Event Structures -typedef struct _BOW_COMMAND_STATUS { - UINT_8 ucStatus; - UINT_8 ucReserved[3]; -} BOW_COMMAND_STATUS, *P_BOW_COMMAND_STATUS; - -typedef struct _BOW_MAC_STATUS { - UINT_8 aucMacAddr[6]; - UINT_8 ucAvailability; - UINT_8 ucNumOfChannel; - CHANNEL_DESC arChannelList[MAX_BOW_NUMBER_OF_CHANNEL]; -} BOW_MAC_STATUS, *P_BOW_MAC_STATUS; - -typedef struct _BOW_LINK_CONNECTED { - CHANNEL_DESC rChannel; - UINT_8 aucReserved; - UINT_8 aucPeerAddress[6]; -} BOW_LINK_CONNECTED, *P_BOW_LINK_CONNECTED; - -typedef struct _BOW_LINK_DISCONNECTED { - UINT_8 ucReason; - UINT_8 aucReserved; - UINT_8 aucPeerAddress[6]; -} BOW_LINK_DISCONNECTED, *P_BOW_LINK_DISCONNECTED; - -typedef struct _BOW_RSSI { - INT_8 cRssi; - UINT_8 aucReserved[3]; -} BOW_RSSI, *P_BOW_RSSI; - -typedef struct _BOW_LINK_QUALITY { - UINT_8 ucLinkQuality; - UINT_8 aucReserved[3]; -} BOW_LINK_QUALITY, *P_BOW_LINK_QUALITY; - -typedef enum _ENUM_BOW_CMD_ID_T { - BOW_CMD_ID_GET_MAC_STATUS = 1, - BOW_CMD_ID_SETUP_CONNECTION, - BOW_CMD_ID_DESTROY_CONNECTION, - BOW_CMD_ID_SET_PTK, - BOW_CMD_ID_READ_RSSI, - BOW_CMD_ID_READ_LINK_QUALITY, - BOW_CMD_ID_SHORT_RANGE_MODE, - BOW_CMD_ID_GET_CHANNEL_LIST, -} ENUM_BOW_CMD_ID_T, *P_ENUM_BOW_CMD_ID_T; - -typedef enum _ENUM_BOW_EVENT_ID_T { - BOW_EVENT_ID_COMMAND_STATUS = 1, - BOW_EVENT_ID_MAC_STATUS, - BOW_EVENT_ID_LINK_CONNECTED, - BOW_EVENT_ID_LINK_DISCONNECTED, - BOW_EVENT_ID_RSSI, - BOW_EVENT_ID_LINK_QUALITY, - BOW_EVENT_ID_CHANNEL_LIST, - BOW_EVENT_ID_CHANNEL_SELECTED, -} ENUM_BOW_EVENT_ID_T, *P_ENUM_BOW_EVENT_ID_T; - -typedef enum _ENUM_BOW_DEVICE_STATE { - BOW_DEVICE_STATE_DISCONNECTED = 0, - BOW_DEVICE_STATE_DISCONNECTING, - BOW_DEVICE_STATE_ACQUIRING_CHANNEL, - BOW_DEVICE_STATE_STARTING, - BOW_DEVICE_STATE_SCANNING, - BOW_DEVICE_STATE_CONNECTING, - BOW_DEVICE_STATE_CONNECTED, - BOW_DEVICE_STATE_NUM -} ENUM_BOW_DEVICE_STATE, *P_ENUM_BOW_DEVICE_STATE; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -#endif /*_BOW_H */ diff --git a/drivers/net/wireless/mt5931/include/nic/cmd_buf.h b/drivers/net/wireless/mt5931/include/nic/cmd_buf.h deleted file mode 100755 index 2bb10b9b1390..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/cmd_buf.h +++ /dev/null @@ -1,176 +0,0 @@ -/* -** $Id: -*/ - -/*! \file "cmd_buf.h" - \brief In this file we define the structure for Command Packet. - - In this file we define the structure for Command Packet and the control unit - of MGMT Memory Pool. -*/ - - - -/* -** $Log: cmd_buf.h $ - * - * 10 04 2010 cp.wu - * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by ENUM_NETWORK_TYPE_INDEX_T only - * remove ENUM_NETWORK_TYPE_T definitions - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 07 13 2010 cp.wu - * - * 1) MMPDUs are now sent to MT6620 by CMD queue for keeping strict order of 1X/MMPDU/CMD packets - * 2) integrate with qmGetFrameAction() for deciding which MMPDU/1X could pass checking for sending - * 2) enhance CMD_INFO_T descriptor number from 10 to 32 to avoid descriptor underflow under concurrent network operation - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 01 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Enable change log -*/ - -#ifndef _CMD_BUF_H -#define _CMD_BUF_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -typedef enum _COMMAND_TYPE { - COMMAND_TYPE_GENERAL_IOCTL, - COMMAND_TYPE_NETWORK_IOCTL, - COMMAND_TYPE_SECURITY_FRAME, - COMMAND_TYPE_MANAGEMENT_FRAME, - COMMAND_TYPE_NUM -} COMMAND_TYPE, *P_COMMAND_TYPE; - -typedef VOID (*PFN_CMD_DONE_HANDLER) ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -typedef VOID (*PFN_CMD_TIMEOUT_HANDLER) ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ); - -struct _CMD_INFO_T { - QUE_ENTRY_T rQueEntry; - - COMMAND_TYPE eCmdType; - - UINT_16 u2InfoBufLen; /* This is actual CMD buffer length */ - PUINT_8 pucInfoBuffer; /* May pointer to structure in prAdapter */ - P_NATIVE_PACKET prPacket; /* only valid when it's a security frame */ - - ENUM_NETWORK_TYPE_INDEX_T eNetworkType; - UINT_8 ucStaRecIndex; /* only valid when it's a security frame */ - - PFN_CMD_DONE_HANDLER pfCmdDoneHandler; - PFN_CMD_TIMEOUT_HANDLER pfCmdTimeoutHandler; - - BOOLEAN fgIsOid; /* Used to check if we need indicate */ - - UINT_8 ucCID; - BOOLEAN fgSetQuery; - BOOLEAN fgNeedResp; - BOOLEAN fgDriverDomainMCR; /* Access Driver Domain MCR, for CMD_ID_ACCESS_REG only */ - UINT_8 ucCmdSeqNum; - UINT_32 u4SetInfoLen; /* Indicate how many byte we read for Set OID */ - - /* information indicating by OID/ioctl */ - PVOID pvInformationBuffer; - UINT_32 u4InformationBufferLength; - - /* private data */ - UINT_32 u4PrivateData; -}; - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -VOID -cmdBufInitialize ( - IN P_ADAPTER_T prAdapter - ); - -P_CMD_INFO_T -cmdBufAllocateCmdInfo ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Length - ); - -VOID -cmdBufFreeCmdInfo ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ); - -/*----------------------------------------------------------------------------*/ -/* Routines for CMDs */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanSendSetQueryCmd ( - IN P_ADAPTER_T prAdapter, - UINT_8 ucCID, - BOOLEAN fgSetQuery, - BOOLEAN fgNeedResp, - BOOLEAN fgIsOid, - PFN_CMD_DONE_HANDLER pfCmdDoneHandler, - PFN_CMD_TIMEOUT_HANDLER pfCmdTimeoutHandler, - UINT_32 u4SetQueryInfoLen, - PUINT_8 pucInfoBuffer, - OUT PVOID pvSetQueryBuffer, - IN UINT_32 u4SetQueryBufferLen - ); - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#endif /* _CMD_BUF_H */ - - diff --git a/drivers/net/wireless/mt5931/include/nic/hal.h b/drivers/net/wireless/mt5931/include/nic/hal.h deleted file mode 100755 index e67727d7653d..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/hal.h +++ /dev/null @@ -1,609 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/hal.h#1 $ -*/ - -/*! \file "hal.h" - \brief The declaration of hal functions - - N/A -*/ - - - -/* -** $Log: hal.h $ - * - * 04 01 2011 tsaiyuan.hsu - * [WCXRP00000615] [MT 6620 Wi-Fi][Driver] Fix klocwork issues - * fix the klocwork issues, 57500, 57501, 57502 and 57503. - * - * 03 21 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * portability improvement - * - * 03 07 2011 terry.wu - * [WCXRP00000521] [MT6620 Wi-Fi][Driver] Remove non-standard debug message - * Toggle non-standard debug messages to comments. - * - * 11 08 2010 cp.wu - * [WCXRP00000166] [MT6620 Wi-Fi][Driver] use SDIO CMD52 for enabling/disabling interrupt to reduce transaction period - * change to use CMD52 for enabling/disabling interrupt to reduce SDIO transaction time - * - * 09 01 2010 cp.wu - * NULL - * move HIF CR initialization from where after sdioSetupCardFeature() to wlanAdapterStart() - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * change zero-padding for TX port access to HAL. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer - * - * 01 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. eliminate improper variable in rHifInfo - * * * * 2. block TX/ordinary OID when RF test mode is engaged - * * * * 3. wait until firmware finish operation when entering into and leaving from RF test mode - * * * * 4. correct some HAL implementation -** \main\maintrunk.MT6620WiFiDriver_Prj\17 2009-12-16 18:02:26 GMT mtk02752 -** include precomp.h -** \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-12-10 16:43:16 GMT mtk02752 -** code clean -** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-11-13 13:54:15 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-11-11 10:36:01 GMT mtk01084 -** modify HAL functions -** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-11-09 22:56:28 GMT mtk01084 -** modify HW access routines -** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-10-29 19:50:09 GMT mtk01084 -** add new macro HAL_TX_PORT_WR -** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-10-23 16:08:10 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-10-13 21:58:50 GMT mtk01084 -** update for new HW architecture design -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-05-18 14:28:10 GMT mtk01084 -** fix issue in HAL_DRIVER_OWN_BY_SDIO_CMD52() -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-05-11 17:26:33 GMT mtk01084 -** modify the bit definition to check driver own status -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-04-28 10:30:22 GMT mtk01461 -** Fix typo -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-01 10:50:34 GMT mtk01461 -** Redefine HAL_PORT_RD/WR macro for SW pre test -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-03-24 09:46:49 GMT mtk01084 -** fix LINT error -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-23 16:53:38 GMT mtk01084 -** add HAL_DRIVER_OWN_BY_SDIO_CMD52() -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-18 20:53:13 GMT mtk01426 -** Fixed lint warn -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:16:20 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _HAL_H -#define _HAL_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/* Macros for flag operations for the Adapter structure */ -#define HAL_SET_FLAG(_M, _F) ((_M)->u4HwFlags |= (_F)) -#define HAL_CLEAR_FLAG(_M, _F) ((_M)->u4HwFlags &= ~(_F)) -#define HAL_TEST_FLAG(_M, _F) ((_M)->u4HwFlags & (_F)) -#define HAL_TEST_FLAGS(_M, _F) (((_M)->u4HwFlags & (_F)) == (_F)) - -#if defined(_HIF_SDIO) -#define HAL_MCR_RD(_prAdapter, _u4Offset, _pu4Value) \ - { \ - if (HAL_TEST_FLAG(_prAdapter, ADAPTER_FLAG_HW_ERR) == FALSE) { \ - if (_prAdapter->rAcpiState == ACPI_STATE_D3) { \ - ASSERT(0); \ - } \ - if (kalDevRegRead(_prAdapter->prGlueInfo, _u4Offset, _pu4Value) == FALSE) {\ - HAL_SET_FLAG(_prAdapter, ADAPTER_FLAG_HW_ERR); \ - fgIsBusAccessFailed = TRUE; \ - DBGLOG(HAL, ERROR, ("HAL_MCR_RD access fail! 0x%x: 0x%x \n", _u4Offset, *_pu4Value)); \ - } \ - } else { \ - DBGLOG(HAL, WARN, ("ignore HAL_MCR_RD access! 0x%x\n", _u4Offset)); \ - } \ - } - -#define HAL_MCR_WR(_prAdapter, _u4Offset, _u4Value) \ - { \ - if (HAL_TEST_FLAG(_prAdapter, ADAPTER_FLAG_HW_ERR) == FALSE) { \ - if (_prAdapter->rAcpiState == ACPI_STATE_D3) { \ - ASSERT(0); \ - } \ - if (kalDevRegWrite(_prAdapter->prGlueInfo, _u4Offset, _u4Value) == FALSE) {\ - HAL_SET_FLAG(_prAdapter, ADAPTER_FLAG_HW_ERR); \ - fgIsBusAccessFailed = TRUE; \ - DBGLOG(HAL, ERROR, ("HAL_MCR_WR access fail! 0x%x: 0x%x \n", _u4Offset, _u4Value)); \ - } \ - } else { \ - DBGLOG(HAL, WARN, ("ignore HAL_MCR_WR access! 0x%x: 0x%x \n", _u4Offset, _u4Value)); \ - } \ - } - -#define HAL_PORT_RD(_prAdapter, _u4Port, _u4Len, _pucBuf, _u4ValidBufSize) \ - { \ - /*fgResult = FALSE; */\ - if (_prAdapter->rAcpiState == ACPI_STATE_D3) { \ - ASSERT(0); \ - } \ - if (HAL_TEST_FLAG(_prAdapter, ADAPTER_FLAG_HW_ERR) == FALSE) { \ - if (kalDevPortRead(_prAdapter->prGlueInfo, _u4Port, _u4Len, _pucBuf, _u4ValidBufSize) == FALSE) {\ - HAL_SET_FLAG(_prAdapter, ADAPTER_FLAG_HW_ERR); \ - fgIsBusAccessFailed = TRUE; \ - DBGLOG(HAL, ERROR, ("HAL_PORT_RD access fail! 0x%x\n", _u4Port)); \ - } \ - else { \ - /*fgResult = TRUE;*/ } \ - } else { \ - DBGLOG(HAL, WARN, ("ignore HAL_PORT_RD access! 0x%x\n", _u4Port)); \ - } \ - } - -#define HAL_PORT_WR(_prAdapter, _u4Port, _u4Len, _pucBuf, _u4ValidBufSize) \ - { \ - /*fgResult = FALSE; */\ - if (_prAdapter->rAcpiState == ACPI_STATE_D3) { \ - ASSERT(0); \ - } \ - if (HAL_TEST_FLAG(_prAdapter, ADAPTER_FLAG_HW_ERR) == FALSE) { \ - if (kalDevPortWrite(_prAdapter->prGlueInfo, _u4Port, _u4Len, _pucBuf, _u4ValidBufSize) == FALSE) {\ - HAL_SET_FLAG(_prAdapter, ADAPTER_FLAG_HW_ERR); \ - fgIsBusAccessFailed = TRUE; \ - DBGLOG(HAL, ERROR, ("HAL_PORT_WR access fail! 0x%x\n", _u4Port)); \ - } \ - else { \ - /*fgResult = TRUE;*/ } \ - } else { \ - DBGLOG(HAL, WARN, ("ignore HAL_PORT_WR access! 0x%x\n", _u4Port)); \ - } \ - } - -#define HAL_BYTE_WR(_prAdapter, _u4Port, _ucBuf) \ - { \ - if (_prAdapter->rAcpiState == ACPI_STATE_D3) { \ - ASSERT(0); \ - } \ - if (HAL_TEST_FLAG(_prAdapter, ADAPTER_FLAG_HW_ERR) == FALSE) { \ - if (kalDevWriteWithSdioCmd52(_prAdapter->prGlueInfo, _u4Port, _ucBuf) == FALSE) {\ - HAL_SET_FLAG(_prAdapter, ADAPTER_FLAG_HW_ERR); \ - fgIsBusAccessFailed = TRUE; \ - DBGLOG(HAL, ERROR, ("HAL_BYTE_WR access fail! 0x%x\n", _u4Port)); \ - } \ - else { \ - } \ - } \ - else { \ - DBGLOG(HAL, WARN, ("ignore HAL_BYTE_WR access! 0x%x\n", _u4Port)); \ - } \ - } - - -#define HAL_DRIVER_OWN_BY_SDIO_CMD52(_prAdapter, _pfgDriverIsOwnReady) \ - { \ - UINT_8 ucBuf = BIT(1); \ - if (_prAdapter->rAcpiState == ACPI_STATE_D3) { \ - ASSERT(0); \ - } \ - if (HAL_TEST_FLAG(_prAdapter, ADAPTER_FLAG_HW_ERR) == FALSE) { \ - if (kalDevReadAfterWriteWithSdioCmd52(_prAdapter->prGlueInfo, MCR_WHLPCR_BYTE1, &ucBuf, 1) == FALSE) {\ - HAL_SET_FLAG(_prAdapter, ADAPTER_FLAG_HW_ERR); \ - fgIsBusAccessFailed = TRUE; \ - DBGLOG(HAL, ERROR, ("kalDevReadAfterWriteWithSdioCmd52 access fail!\n")); \ - } \ - else { \ - *_pfgDriverIsOwnReady = (ucBuf & BIT(0)) ? TRUE : FALSE; \ - } \ - } else { \ - DBGLOG(HAL, WARN, ("ignore HAL_DRIVER_OWN_BY_SDIO_CMD52 access!\n")); \ - } \ - } - -#else /* #if defined(_HIF_SDIO) */ -#define HAL_MCR_RD(_prAdapter, _u4Offset, _pu4Value) \ - { \ - if (_prAdapter->rAcpiState == ACPI_STATE_D3) { \ - ASSERT(0); \ - } \ - kalDevRegRead(_prAdapter->prGlueInfo, _u4Offset, _pu4Value); \ - } - -#define HAL_MCR_WR(_prAdapter, _u4Offset, _u4Value) \ - { \ - if (_prAdapter->rAcpiState == ACPI_STATE_D3) { \ - ASSERT(0); \ - } \ - kalDevRegWrite(_prAdapter->prGlueInfo, _u4Offset, _u4Value); \ - } - -#define HAL_PORT_RD(_prAdapter, _u4Port, _u4Len, _pucBuf, _u4ValidBufSize) \ - { \ - if (_prAdapter->rAcpiState == ACPI_STATE_D3) { \ - ASSERT(0); \ - } \ - kalDevPortRead(_prAdapter->prGlueInfo, _u4Port, _u4Len, _pucBuf, _u4ValidBufSize); \ - } - -#define HAL_PORT_WR(_prAdapter, _u4Port, _u4Len, _pucBuf, _u4ValidBufSize) \ - { \ - if (_prAdapter->rAcpiState == ACPI_STATE_D3) { \ - ASSERT(0); \ - } \ - kalDevPortWrite(_prAdapter->prGlueInfo, _u4Port, _u4Len, _pucBuf, _u4ValidBufSize); \ - } - -#define HAL_BYTE_WR(_prAdapter, _u4Port, _ucBuf) \ - { \ - if (_prAdapter->rAcpiState == ACPI_STATE_D3) { \ - ASSERT(0); \ - } \ - kalDevWriteWithSdioCmd52(_prAdapter->prGlueInfo, _u4Port, _ucBuf); \ - } - -#endif /* #if defined(_HIF_SDIO) */ - - -#define HAL_READ_RX_PORT(prAdapter, u4PortId, u4Len, pvBuf, _u4ValidBufSize) \ - { \ - ASSERT(u4PortId < 2); \ - HAL_PORT_RD(prAdapter, \ - ((u4PortId == 0) ? MCR_WRDR0 : MCR_WRDR1), \ - u4Len, \ - pvBuf, \ - _u4ValidBufSize/*temp!!*//*4Kbyte*/) \ - } - -#define HAL_WRITE_TX_PORT(_prAdapter, _ucTxPortIdx, _u4Len, _pucBuf, _u4ValidBufSize) \ - { \ - ASSERT(_ucTxPortIdx < 2); \ - if((_u4ValidBufSize - _u4Len) >= sizeof(UINT_32)) { \ - /* fill with single dword of zero as TX-aggregation termination */ \ - *(PUINT_32) (&((_pucBuf)[ALIGN_4(_u4Len)])) = 0; \ - } \ - HAL_PORT_WR(_prAdapter, \ - (_ucTxPortIdx == 0) ? MCR_WTDR0 : MCR_WTDR1, \ - _u4Len, \ - _pucBuf, \ - _u4ValidBufSize/*temp!!*//*4KByte*/) \ - } - -/* The macro to read the given MCR several times to check if the wait - condition come true. */ -#define HAL_MCR_RD_AND_WAIT(_pAdapter, _offset, _pReadValue, _waitCondition, _waitDelay, _waitCount, _status) \ - { \ - UINT_32 count; \ - (_status) = FALSE; \ - for (count = 0; count < (_waitCount); count++) { \ - HAL_MCR_RD((_pAdapter), (_offset), (_pReadValue)); \ - if ((_waitCondition)) { \ - (_status) = TRUE; \ - break; \ - } \ - kalUdelay((_waitDelay)); \ - } \ - } - - -/* The macro to write 1 to a R/S bit and read it several times to check if the - command is done */ -#define HAL_MCR_WR_AND_WAIT(_pAdapter, _offset, _writeValue, _busyMask, _waitDelay, _waitCount, _status) \ - { \ - UINT_32 u4Temp; \ - UINT_32 u4Count = _waitCount; \ - (_status) = FALSE; \ - HAL_MCR_WR((_pAdapter), (_offset), (_writeValue)); \ - do { \ - kalUdelay((_waitDelay)); \ - HAL_MCR_RD((_pAdapter), (_offset), &u4Temp); \ - if (!(u4Temp & (_busyMask))) { \ - (_status) = TRUE; \ - break; \ - } \ - u4Count--; \ - } while (u4Count); \ - } - -#define HAL_GET_CHIP_ID_VER(_prAdapter, pu2ChipId, pu2Version) \ - { \ - UINT_32 u4Value; \ - HAL_MCR_RD(_prAdapter, \ - MCR_WCIR, \ - &u4Value); \ - *pu2ChipId = (UINT_16)(u4Value & WCIR_CHIP_ID); \ - *pu2Version = (UINT_16)(u4Value & WCIR_REVISION_ID) >> 16; \ - } - -#define HAL_WAIT_WIFI_FUNC_READY(_prAdapter) \ - { \ - UINT_32 u4Value; \ - UINT_32 i; \ - for (i = 0; i < 100; i++) { \ - HAL_MCR_RD(_prAdapter, \ - MCR_WCIR, \ - &u4Value); \ - if (u4Value & WCIR_WLAN_READY) { \ - break; \ - } \ - NdisMSleep(10); \ - } \ - } - -#define HAL_INTR_DISABLE(_prAdapter) \ - HAL_MCR_WR(_prAdapter, \ - MCR_WHLPCR, \ - WHLPCR_INT_EN_CLR) - -#define HAL_INTR_ENABLE(_prAdapter) \ - HAL_MCR_WR(_prAdapter, \ - MCR_WHLPCR, \ - WHLPCR_INT_EN_SET) - -#define HAL_INTR_ENABLE_AND_LP_OWN_SET(_prAdapter) \ - HAL_MCR_WR(_prAdapter, \ - MCR_WHLPCR, \ - (WHLPCR_INT_EN_SET | WHLPCR_FW_OWN_REQ_SET)) - -#define HAL_LP_OWN_SET(_prAdapter) \ - HAL_MCR_WR(_prAdapter, \ - MCR_WHLPCR, \ - WHLPCR_FW_OWN_REQ_SET) - -#define HAL_LP_OWN_CLR_OK(_prAdapter, _pfgResult) \ - { \ - UINT_32 i; \ - UINT_32 u4RegValue; \ - UINT_32 u4LoopCnt = 2048 / 8; \ - *_pfgResult = TRUE; \ - /* Software get LP ownership */ \ - HAL_MCR_WR(_prAdapter, \ - MCR_WHLPCR, \ - WHLPCR_FW_OWN_REQ_CLR) \ - for (i = 0; i < u4LoopCnt; i++) { \ - HAL_MCR_RD(_prAdapter, MCR_WHLPCR, &u4RegValue); \ - if (u4RegValue & WHLPCR_IS_DRIVER_OWN) { \ - break; \ - } \ - else { \ - kalUdelay(8); \ - } \ - } \ - if (i == u4LoopCnt) { \ - *_pfgResult = FALSE; \ - /*ERRORLOG(("LP cannot be own back (%ld)", u4LoopCnt));*/ \ - /* check the time of LP instructions need to perform from Sleep to On */ \ - /*ASSERT(0); */ \ - } \ - } - -#define HAL_GET_ABNORMAL_INTERRUPT_REASON_CODE(_prAdapter, pu4AbnormalReason) \ - { \ - HAL_MCR_RD(_prAdapter, \ - MCR_WASR, \ - pu4AbnormalReason); \ - } - - -#define HAL_DISABLE_RX_ENHANCE_MODE(_prAdapter) \ - { \ - UINT_32 u4Value; \ - HAL_MCR_RD(_prAdapter, \ - MCR_WHCR, \ - &u4Value); \ - HAL_MCR_WR(_prAdapter, \ - MCR_WHCR, \ - u4Value & ~WHCR_RX_ENHANCE_MODE_EN); \ - } - -#define HAL_ENABLE_RX_ENHANCE_MODE(_prAdapter) \ - { \ - UINT_32 u4Value; \ - HAL_MCR_RD(_prAdapter, \ - MCR_WHCR, \ - &u4Value); \ - HAL_MCR_WR(_prAdapter, \ - MCR_WHCR, \ - u4Value | WHCR_RX_ENHANCE_MODE_EN); \ - } - -#define HAL_CFG_MAX_HIF_RX_LEN_NUM(_prAdapter, _ucNumOfRxLen) \ - { \ - UINT_32 u4Value, ucNum; \ - ucNum = ((_ucNumOfRxLen >= 16) ? 0 : _ucNumOfRxLen); \ - u4Value = 0; \ - HAL_MCR_RD(_prAdapter, \ - MCR_WHCR, \ - &u4Value); \ - u4Value &= ~WHCR_MAX_HIF_RX_LEN_NUM; \ - u4Value |= ((((UINT_32)ucNum) << 4) & WHCR_MAX_HIF_RX_LEN_NUM); \ - HAL_MCR_WR(_prAdapter, \ - MCR_WHCR, \ - u4Value); \ - } - -#define HAL_SET_INTR_STATUS_READ_CLEAR(prAdapter) \ - { \ - UINT_32 u4Value; \ - HAL_MCR_RD(prAdapter, \ - MCR_WHCR, \ - &u4Value); \ - HAL_MCR_WR(prAdapter, \ - MCR_WHCR, \ - u4Value & ~WHCR_W_INT_CLR_CTRL); \ - prAdapter->prGlueInfo->rHifInfo.fgIntReadClear = TRUE;\ - } - -#define HAL_SET_INTR_STATUS_WRITE_1_CLEAR(prAdapter) \ - { \ - UINT_32 u4Value; \ - HAL_MCR_RD(prAdapter, \ - MCR_WHCR, \ - &u4Value); \ - HAL_MCR_WR(prAdapter, \ - MCR_WHCR, \ - u4Value | WHCR_W_INT_CLR_CTRL); \ - prAdapter->prGlueInfo->rHifInfo.fgIntReadClear = FALSE;\ - } - -/* Note: enhance mode structure may also carried inside the buffer, - if the length of the buffer is long enough */ -#define HAL_READ_INTR_STATUS(prAdapter, length, pvBuf) \ - HAL_PORT_RD(prAdapter, \ - MCR_WHISR, \ - length, \ - pvBuf, \ - length) - -#define HAL_READ_TX_RELEASED_COUNT(_prAdapter, aucTxReleaseCount) \ - { \ - PUINT_32 pu4Value = (PUINT_32)aucTxReleaseCount; \ - HAL_MCR_RD(_prAdapter, \ - MCR_WTSR0, \ - &pu4Value[0]); \ - HAL_MCR_RD(_prAdapter, \ - MCR_WTSR1, \ - &pu4Value[1]); \ - } - -#define HAL_READ_RX_LENGTH(prAdapter, pu2Rx0Len, pu2Rx1Len) \ - { \ - UINT_32 u4Value; \ - u4Value = 0; \ - HAL_MCR_RD(prAdapter, \ - MCR_WRPLR, \ - &u4Value); \ - *pu2Rx0Len = (UINT_16)u4Value; \ - *pu2Rx1Len = (UINT_16)(u4Value >> 16); \ - } - -#define HAL_GET_INTR_STATUS_FROM_ENHANCE_MODE_STRUCT(pvBuf, u2Len, pu4Status) \ - { \ - PUINT_32 pu4Buf = (PUINT_32)pvBuf; \ - *pu4Status = pu4Buf[0]; \ - } - -#define HAL_GET_TX_STATUS_FROM_ENHANCE_MODE_STRUCT(pvInBuf, pu4BufOut, u4LenBufOut) \ - { \ - PUINT_32 pu4Buf = (PUINT_32)pvInBuf; \ - ASSERT(u4LenBufOut >= 8); \ - pu4BufOut[0] = pu4Buf[1]; \ - pu4BufOut[1] = pu4Buf[2]; \ - } - -#define HAL_GET_RX_LENGTH_FROM_ENHANCE_MODE_STRUCT(pvInBuf, pu2Rx0Num, au2Rx0Len, pu2Rx1Num, au2Rx1Len) \ - { \ - PUINT_32 pu4Buf = (PUINT_32)pvInBuf; \ - ASSERT((sizeof(au2Rx0Len) / sizeof(UINT_16)) >= 16); \ - ASSERT((sizeof(au2Rx1Len) / sizeof(UINT_16)) >= 16); \ - *pu2Rx0Num = (UINT_16)pu4Buf[3]; \ - *pu2Rx1Num = (UINT_16)(pu4Buf[3] >> 16); \ - kalMemCopy(au2Rx0Len, &pu4Buf[4], 8); \ - kalMemCopy(au2Rx1Len, &pu4Buf[12], 8); \ - } - -#define HAL_GET_MAILBOX_FROM_ENHANCE_MODE_STRUCT(pvInBuf, pu4Mailbox0, pu4Mailbox1) \ - { \ - PUINT_32 pu4Buf = (PUINT_32)pvInBuf; \ - *pu4Mailbox0 = (UINT_16)pu4Buf[21]; \ - *pu4Mailbox1 = (UINT_16)pu4Buf[22]; \ - } - -#define HAL_IS_TX_DONE_INTR(u4IntrStatus) \ - ((u4IntrStatus & WHISR_TX_DONE_INT) ? TRUE : FALSE) - -#define HAL_IS_RX_DONE_INTR(u4IntrStatus) \ - ((u4IntrStatus & (WHISR_RX0_DONE_INT | WHISR_RX1_DONE_INT)) ? TRUE : FALSE) - -#define HAL_IS_ABNORMAL_INTR(u4IntrStatus) \ - ((u4IntrStatus & WHISR_ABNORMAL_INT) ? TRUE : FALSE) - -#define HAL_IS_FW_OWNBACK_INTR(u4IntrStatus) \ - ((u4IntrStatus & WHISR_FW_OWN_BACK_INT) ? TRUE : FALSE) - -#define HAL_PUT_MAILBOX(prAdapter, u4MboxId, u4Data) \ - { \ - ASSERT(u4MboxId < 2); \ - HAL_MCR_WR(prAdapter, \ - ((u4MboxId == 0) ? MCR_H2DSM0R : MCR_H2DSM1R), \ - u4Data); \ - } - -#define HAL_GET_MAILBOX(prAdapter, u4MboxId, pu4Data) \ - { \ - ASSERT(u4MboxId < 2); \ - HAL_MCR_RD(prAdapter, \ - ((u4MboxId == 0) ? MCR_D2HRM0R : MCR_D2HRM1R), \ - pu4Data); \ - } - -#define HAL_SET_MAILBOX_READ_CLEAR(prAdapter, fgEnableReadClear) \ - { \ - UINT_32 u4Value; \ - HAL_MCR_RD(prAdapter, MCR_WHCR, &u4Value);\ - HAL_MCR_WR(prAdapter, MCR_WHCR, \ - (fgEnableReadClear) ? \ - (u4Value | WHCR_W_MAILBOX_RD_CLR_EN) : \ - (u4Value & ~WHCR_W_MAILBOX_RD_CLR_EN)); \ - prAdapter->prGlueInfo->rHifInfo.fgMbxReadClear = fgEnableReadClear;\ - } - -#define HAL_GET_MAILBOX_READ_CLEAR(prAdapter) (prAdapter->prGlueInfo->rHifInfo.fgMbxReadClear) - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _HAL_H */ - diff --git a/drivers/net/wireless/mt5931/include/nic/hif_rx.h b/drivers/net/wireless/mt5931/include/nic/hif_rx.h deleted file mode 100755 index 3895a7c3fc01..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/hif_rx.h +++ /dev/null @@ -1,227 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/hif_rx.h#1 $ -*/ - -/*! \file "hif_rx.h" - \brief Provide HIF RX Header Information between F/W and Driver - - N/A -*/ - - -/* -** $Log: hif_rx.h $ - * - * 09 01 2010 kevin.huang - * NULL - * Use LINK LIST operation to process SCAN result - * - * 07 16 2010 yarco.yang - * - * 1. Support BSS Absence/Presence Event - * 2. Support STA change PS mode Event - * 3. Support BMC forwarding for AP mode. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * follow-ups for HIF_RX_HEADER_T update: - * 1) add TCL - * 2) add RCPI - * 3) add ChannelNumber - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 09 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add necessary changes to driver data paths. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-12-10 16:44:00 GMT mtk02752 -** code clean -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-12-09 13:59:20 GMT MTK02468 -** Added HIF_RX_HDR parsing macros -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-11-24 19:54:54 GMT mtk02752 -** adopt HIF_RX_HEADER_T in new data path -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-10-29 19:51:19 GMT mtk01084 -** modify FW/ driver interface -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-28 10:33:58 GMT mtk01461 -** Add define of HW_APPENED_LEN -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-04-01 10:51:02 GMT mtk01461 -** Rename ENUM_HIF_RX_PKT_TYPE_T -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-19 12:05:03 GMT mtk01426 -** Remove __KAL_ATTRIB_PACKED__ and add hifDataTypeCheck() -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-17 20:18:52 GMT mtk01426 -** Add comment to HIF_RX_HEADER_T -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:16:23 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _HIF_RX_H -#define _HIF_RX_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -/*! HIF_RX_HEADER_T */ -// DW 0, Byte 1 -#define HIF_RX_HDR_PACKET_TYPE_MASK BITS(0,1) - -// DW 1, Byte 0 -#define HIF_RX_HDR_HEADER_LEN BITS(2,7) -#define HIF_RX_HDR_HEADER_LEN_OFFSET 2 -#define HIF_RX_HDR_HEADER_OFFSET_MASK BITS(0,1) - -// DW 1, Byte 1 -#define HIF_RX_HDR_80211_HEADER_FORMAT BIT(0) -#define HIF_RX_HDR_DO_REORDER BIT(1) -#define HIF_RX_HDR_PAL BIT(2) -#define HIF_RX_HDR_TCL BIT(3) -#define HIF_RX_HDR_NETWORK_IDX_MASK BITS(4,7) -#define HIF_RX_HDR_NETWORK_IDX_OFFSET 4 - -// DW 1, Byte 2, 3 -#define HIF_RX_HDR_SEQ_NO_MASK BITS(0,11) -#define HIF_RX_HDR_TID_MASK BITS(12,14) -#define HIF_RX_HDR_TID_OFFSET 12 -#define HIF_RX_HDR_BAR_FRAME BIT(15) - - - -#define HIF_RX_HDR_FLAG_AMP_WDS BIT(0) -#define HIF_RX_HDR_FLAG_802_11_FORMAT BIT(1) -#define HIF_RX_HDR_FLAG_BAR_FRAME BIT(2) -#define HIF_RX_HDR_FLAG_DO_REORDERING BIT(3) -#define HIF_RX_HDR_FLAG_CTRL_WARPPER_FRAME BIT(4) - -#define HIF_RX_HW_APPENDED_LEN 4 - -// For DW 2, Byte 3 - ucHwChannelNum -#define HW_CHNL_NUM_MAX_2G4 14 -#define HW_CHNL_NUM_MAX_4G_5G (255 - HW_CHNL_NUM_MAX_2G4) - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -typedef struct _HIF_RX_HEADER_T { - UINT_16 u2PacketLen; - UINT_16 u2PacketType; - UINT_8 ucHerderLenOffset; - UINT_8 uc80211_Reorder_PAL_TCL; - UINT_16 u2SeqNoTid; - UINT_8 ucStaRecIdx; - UINT_8 ucRcpi; - UINT_8 ucHwChannelNum; - UINT_8 ucReserved; -} HIF_RX_HEADER_T, *P_HIF_RX_HEADER_T; - -typedef enum _ENUM_HIF_RX_PKT_TYPE_T { - HIF_RX_PKT_TYPE_DATA = 0, - HIF_RX_PKT_TYPE_EVENT, - HIF_RX_PKT_TYPE_TX_LOOPBACK, - HIF_RX_PKT_TYPE_MANAGEMENT, - HIF_RX_PKT_TYPE_NUM -} ENUM_HIF_RX_PKT_TYPE_T, *P_ENUM_HIF_RX_PKT_TYPE_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#define HIF_RX_HDR_SIZE sizeof(HIF_RX_HEADER_T) - -#define HIF_RX_HDR_GET_80211_FLAG(_prHifRxHdr) \ - (((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_80211_HEADER_FORMAT) ? TRUE : FALSE)) -#define HIF_RX_HDR_GET_REORDER_FLAG(_prHifRxHdr) \ - (((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_DO_REORDER) ? TRUE : FALSE)) -#define HIF_RX_HDR_GET_PAL_FLAG(_prHifRxHdr) \ - (((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_PAL) ? TRUE : FALSE)) -#define HIF_RX_HDR_GET_TCL_FLAG(_prHifRxHdr) \ - (((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_TCL) ? TRUE : FALSE)) -#define HIF_RX_HDR_GET_NETWORK_IDX(_prHifRxHdr) \ - ((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_NETWORK_IDX_MASK)\ - >> HIF_RX_HDR_NETWORK_IDX_OFFSET) - - -#define HIF_RX_HDR_GET_TID(_prHifRxHdr) \ - ((((_prHifRxHdr)->u2SeqNoTid) & HIF_RX_HDR_TID_MASK)\ - >> HIF_RX_HDR_TID_OFFSET) -#define HIF_RX_HDR_GET_SN(_prHifRxHdr) \ - (((_prHifRxHdr)->u2SeqNoTid) & HIF_RX_HDR_SEQ_NO_MASK) -#define HIF_RX_HDR_GET_BAR_FLAG(_prHifRxHdr) \ - (((((_prHifRxHdr)->u2SeqNoTid) & HIF_RX_HDR_BAR_FRAME)? TRUE: FALSE)) - - -#define HIF_RX_HDR_GET_CHNL_NUM(_prHifRxHdr) \ - ( ( ((_prHifRxHdr)->ucHwChannelNum) > HW_CHNL_NUM_MAX_4G_5G ) ? \ - ( ((_prHifRxHdr)->ucHwChannelNum) - HW_CHNL_NUM_MAX_4G_5G ) : \ - ((_prHifRxHdr)->ucHwChannelNum) ) - -/* To do: support more bands other than 2.4G and 5G */ -#define HIF_RX_HDR_GET_RF_BAND(_prHifRxHdr) \ - ( ( ((_prHifRxHdr)->ucHwChannelNum) <= HW_CHNL_NUM_MAX_2G4 ) ? \ - BAND_2G4 : BAND_5G) - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -__KAL_INLINE__ VOID -hifDataTypeCheck ( - VOID - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/* Kevin: we don't have to call following function to inspect the data structure. - * It will check automatically while at compile time. - * We'll need this for porting driver to different RTOS. - */ -__KAL_INLINE__ VOID -hifDataTypeCheck ( - VOID - ) -{ - DATA_STRUC_INSPECTING_ASSERT(sizeof(HIF_RX_HEADER_T) == 12); - - return; -} - -#endif diff --git a/drivers/net/wireless/mt5931/include/nic/hif_tx.h b/drivers/net/wireless/mt5931/include/nic/hif_tx.h deleted file mode 100755 index 3a04ce55d9be..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/hif_tx.h +++ /dev/null @@ -1,225 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/hif_tx.h#1 $ -*/ - - - -/* -** $Log: hif_tx.h $ - * - * 10 07 2010 cp.wu - * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection - * add firmware download for MT5931. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * fill extra information for revised HIF_TX_HEADER. - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) add flag on MSDU_INFO_T for indicating BIP frame and forceBasicRate - * 2) add packet type for indicating management frames - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 03 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * code clean: removing unused variables and structure definitions - * - * 02 09 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address - * * * 2. follow MSDN defined behavior when associates to another AP - * * * 3. for firmware download, packet size could be up to 2048 bytes - * - * 01 13 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Enabled the Burst_End Indication mechanism - * - * 01 13 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * TX: fill ucWlanHeaderLength/ucPktFormtId_Flags according to info provided by prMsduInfo -** \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-12-10 16:43:40 GMT mtk02752 -** code clean -** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-11-24 19:55:11 GMT mtk02752 -** adopt HIF_TX_HEADER_T in new data path -** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-11-23 17:54:13 GMT mtk02752 -** CMD_HDR_SIZE = (sizeof(WIFI_CMD_T)) to follow up CM's CMD/EVENT documentation -** -** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-11-17 22:41:10 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-11-17 17:34:07 GMT mtk02752 -** remove HIF_TX_BUFF_COUNT_TC0 (move to nic_tx.h) -** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-11-17 12:14:12 GMT mtk02752 -** add initial value for HIF_TX_BUFF_COUNT_TC5 -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-11-13 13:54:18 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-11-04 14:11:14 GMT mtk01084 -** modify SW TX data format -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-10-29 19:51:53 GMT mtk01084 -** modify FW/ driver interface -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-05-20 12:22:46 GMT mtk01461 -** Add SeqNum field to CMD Header -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-17 19:40:52 GMT mtk01461 -** Update the Log Sign -*/ - -#ifndef _HIF_TX_H -#define _HIF_TX_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -/* Maximum buffer size for individual HIF TCQ Buffer */ -#define HIF_TX_BUFF_MAX_SIZE 1552 /* Reserved field was not included */ - -/* Maximum buffer count for individual HIF TCQ */ -#define HIF_TX_BUFF_COUNT_TC0 3 -#define HIF_TX_BUFF_COUNT_TC1 3 -#define HIF_TX_BUFF_COUNT_TC2 3 -#define HIF_TX_BUFF_COUNT_TC3 3 -#define HIF_TX_BUFF_COUNT_TC4 2 - -#define TX_HDR_SIZE sizeof(HIF_TX_HEADER_T) - -#define CMD_HDR_SIZE sizeof(WIFI_CMD_T) - -#define CMD_PKT_SIZE_FOR_IMAGE 2048 /* !< 2048 Bytes CMD payload buffer */ - - -/*! NIC_HIF_TX_HEADER_T */ -// DW 0, Byte 0,1 -#define HIF_TX_HDR_TX_BYTE_COUNT_MASK BITS(0,11) -#define HIF_TX_HDR_USER_PRIORITY_OFFSET 12 - -// DW 0, Byte 2 -#define HIF_TX_HDR_ETHER_TYPE_OFFSET_MASK BITS(0,7) - -// DW 0, Byte 3 -#define HIF_TX_HDR_IP_CSUM BIT(0) -#define HIF_TX_HDR_TCP_CSUM BIT(1) -#define HIF_TX_HDR_RESOURCE_MASK BITS(2,5) -#define HIF_TX_HDR_RESOURCE_OFFSET 2 -#define HIF_TX_HDR_PACKET_TYPE_MASK BITS(6,7) -#define HIF_TX_HDR_PACKET_TYPE_OFFSET 6 - -// DW 1, Byte 0 -#define HIF_TX_HDR_WLAN_HEADER_LEN_MASK BITS(0,5) - -// DW 1, Byte 1 -#define HIF_TX_HDR_FORMAT_ID_MASK BITS(0,2) -#define HIF_TX_HDR_NETWORK_TYPE_MASK BITS(4,5) -#define HIF_TX_HDR_NETWORK_TYPE_OFFSET 4 -#define HIF_TX_HDR_FLAG_1X_FRAME_MASK BIT(6) -#define HIF_TX_HDR_FLAG_1X_FRAME_OFFSET 6 -#define HIF_TX_HDR_FLAG_802_11_FORMAT_MASK BIT(7) -#define HIF_TX_HDR_FLAG_802_11_FORMAT_OFFSET 7 - - -// DW2, Byte 3 -#define HIF_TX_HDR_PS_FORWARDING_TYPE_MASK BITS(0,1) -#define HIF_TX_HDR_PS_SESSION_ID_MASK BITS(2,4) -#define HIF_TX_HDR_PS_SESSION_ID_OFFSET 2 -#define HIF_TX_HDR_BURST_END_MASK BIT(5) -#define HIF_TX_HDR_BURST_END_OFFSET 5 - -// DW3, Byte 1 -#define HIF_TX_HDR_NEED_ACK BIT(0) -#define HIF_TX_HDR_BIP BIT(1) -#define HIF_TX_HDR_BASIC_RATE BIT(2) - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef struct _HIF_HW_TX_HEADER_T { - UINT_16 u2TxByteCount; - UINT_8 ucEtherTypeOffset; - UINT_8 ucCSflags; - UINT_8 aucBuffer[0]; -} HIF_HW_TX_HEADER_T, *P_HIF_HW_TX_HEADER_T; - -typedef struct _HIF_TX_HEADER_T { - UINT_16 u2TxByteCount_UserPriority; - UINT_8 ucEtherTypeOffset; - UINT_8 ucResource_PktType_CSflags; - UINT_8 ucWlanHeaderLength; - UINT_8 ucPktFormtId_Flags; - UINT_16 u2LLH; /* for BOW */ - UINT_16 u2SeqNo; /* for BOW */ - UINT_8 ucStaRecIdx; - UINT_8 ucForwardingType_SessionID_Reserved; - UINT_8 ucPacketSeqNo; - UINT_8 ucAck_BIP_BasicRate; - UINT_8 aucReserved[2]; -} HIF_TX_HEADER_T, *P_HIF_TX_HEADER_T; - -typedef enum _ENUM_HIF_TX_PKT_TYPE_T { - HIF_TX_PKT_TYPE_DATA = 0, - HIF_TX_PKT_TYPE_CMD, - HIF_TX_PKT_TYPE_HIF_LOOPBACK, - HIF_TX_PKT_TYPE_MANAGEMENT, - HIF_TX_PKT_TYPE_NUM -} ENUM_HIF_TX_PKT_TYPE_T, *P_ENUM_HIF_TX_PKT_TYPE_T; - -typedef enum _ENUM_HIF_OOB_CTRL_PKT_TYPE_T { - HIF_OOB_CTRL_PKT_TYPE_LOOPBACK = 1, - HIF_OOB_CTRL_PKT_TYP_NUM -} ENUM_HIF_OOB_CTRL_PKT_TYPE_T, *P_ENUM_HIF_OOB_CTRL_PKT_TYPE_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#define TFCB_FRAME_PAD_TO_DW(u2Length) ALIGN_4(u2Length) - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/* Kevin: we don't have to call following function to inspect the data structure. - * It will check automatically while at compile time. - */ -__KAL_INLINE__ VOID -hif_txDataTypeCheck ( - VOID - ); - -__KAL_INLINE__ VOID -hif_txDataTypeCheck ( - VOID - ) -{ - DATA_STRUC_INSPECTING_ASSERT(sizeof(HIF_TX_HEADER_T) == 16); - - return; -} - -#endif /*_HIF_TX_H */ - diff --git a/drivers/net/wireless/mt5931/include/nic/mac.h b/drivers/net/wireless/mt5931/include/nic/mac.h deleted file mode 100755 index d67780a668bc..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/mac.h +++ /dev/null @@ -1,2183 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/mac.h#1 $ -*/ - -/*! \file "mac.h" - \brief Brief description. - - Detail description. -*/ - - - -/* -** $Log: mac.h $ - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 01 05 2012 tsaiyuan.hsu - * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v - * add timing measurement support for 802.11v. - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 06 22 2011 wh.su - * [WCXRP00000806] [MT6620 Wi-Fi][Driver] Move the WPA/RSN IE and WAPI IE structure to mac.h and let the sw structure not align at byte - * Move the WAPI/RSN IE to mac.h and SW structure not align to byte, - * Notice needed update P2P.ko. - * - * 05 06 2011 wh.su - * [WCXRP00000699] [MT6620 Wi-Fi][Driver] Add the ie pointer check for avoid TP-LINK AP send the wrong beacon make driver got incorrect support rate set - * Add the length check before access the ie length filed. - * - * 05 06 2011 wh.su - * [WCXRP00000699] [MT6620 Wi-Fi][Driver] Add the ie pointer check for avoid TP-LINK AP send the wrong beacon make driver got incorrect support rate set - * adding the length check before processing next ie.. - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 04 12 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * . - * - * 04 08 2011 yuche.tsai - * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO. - * Add device discover ability support. - * - * 03 17 2011 chinglan.wang - * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature - * . - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Some action frame define is not belong to P2P. - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Add some service discovery MAC define, phase I. - * - * 12 13 2010 cp.wu - * [WCXRP00000260] [MT6620 Wi-Fi][Driver][Firmware] Create V1.1 branch for both firmware and driver - * create branch for Wi-Fi driver v1.1 - * - * 12 13 2010 cp.wu - * [WCXRP00000256] [MT6620 Wi-Fi][Driver] Eliminate potential issues which is identified by Klockwork - * suppress warning reported by Klockwork. - * - * 11 01 2010 cp.wu - * [WCXRP00000122] [MT6620 Wi-Fi][Driver] Preparation for YuSu source tree integration - * revert to previous revision. (this file is not necessary to be changed) - * - * 08 20 2010 cm.chang - * NULL - * Migrate RLM code to host from FW - * - * 08 02 2010 yuche.tsai - * NULL - * 1. Add P2P MAC define. - * 2. Add scan device found event - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 21 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Add WFA specific OUI. - * - * 06 17 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Add P2P IE ID & Vendor OUI TYPE for P2P. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge MAC.h. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 01 13 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Added OFFSET_BAR_SSC_SN -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-12-09 14:00:24 GMT MTK02468 -** Added offsets and masks for the BA Parameter Set filed -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:16:26 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _MAC_H -#define _MAC_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -//3 /* --------------- Constants for Ethernet/802.11 MAC --------------- */ -/* MAC Address */ -#define MAC_ADDR_LEN 6 - -#define MAC_ADDR_LOCAL_ADMIN BIT(1) - -#define ETH_P_IPV4 0x0800 -#define ETH_P_IPX 0x8137 // Novell IPX -#define ETH_P_AARP 0x80F3 // AppleTalk Address Resolution Protocol (AARP) -#define ETH_P_IPV6 0x86DD - -#define IP_VERSION_4 4 -#define IP_VERSION_6 6 - -#define IP_PROTOCOL_TCP 6 -#define IP_PROTOCOL_UDP 17 - -#define IPV4_HDR_IP_PROTOCOL_OFFSET 9 -#define IPV4_HDR_IP_CSUM_OFFSET 10 - -#define IPV6_HDR_IP_PROTOCOL_OFFSET 6 - -#define TCP_HDR_TCP_CSUM_OFFSET 16 -#define UDP_HDR_UDP_CSUM_OFFSET 6 - -#define LLC_LEN 8 // LLC(3) + SNAP(3) + EtherType(2) - -#define NULL_MAC_ADDR {0x00, 0x00, 0x00, 0x00, 0x00, 0x00} -#define BC_MAC_ADDR {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} - -/* Ethernet Frame Field Size, in byte */ -#define ETHER_HEADER_LEN 14 -#define ETHER_TYPE_LEN 2 -#define ETHER_MIN_PKT_SZ 60 -#define ETHER_MAX_PKT_SZ 1514 - -/* IEEE 802.11 WLAN Frame Field Size, in byte */ -#define WLAN_MAC_HEADER_LEN 24 /* Address 4 excluded */ -#define WLAN_MAC_HEADER_A4_LEN 30 /* Address 4 included */ -#define WLAN_MAC_HEADER_QOS_LEN 26 /* QoS Control included */ -#define WLAN_MAC_HEADER_QOS_HTC_LEN 30 /* QoS Control and HTC included */ -#define WLAN_MAC_HEADER_A4_QOS_LEN 32 /* Address 4 and QoS Control included */ -#define WLAN_MAC_HEADER_A4_QOS_HTC_LEN 36 /* Address 4, QoS Control and HTC included */ -#define WLAN_MAC_MGMT_HEADER_LEN 24 /* Address 4 excluded */ -#define WLAN_MAC_MGMT_HEADER_HTC_LEN 28 /* HTC included */ - -#define QOS_CTRL_LEN 2 -#define HT_CTRL_LEN 4 - -#define WLAN_MAC_CTS_ACK_LEN WLAN_MAC_CTS_ACK_FRAME_HEADER_LEN + FCS_LEN - -/* 6.2.1.1.2 Semantics of the service primitive */ -#define MSDU_MAX_LENGTH 2304 - -/* 7.1.3.3.3 Broadcast BSSID */ -#define BC_BSSID BC_MAC_ADDR - -/* 7.1.3.7 FCS field */ -#define FCS_LEN 4 - -/* 7.3.1.6 Listen Interval field */ -#define DEFAULT_LISTEN_INTERVAL_BY_DTIM_PERIOD 2 // In unit of AP's DTIM interval, -#define DEFAULT_LISTEN_INTERVAL 10 - -/* 7.3.2.1 Broadcast(Wildcard) SSID */ -#define BC_SSID "" -#define BC_SSID_LEN 0 - -/* 7.3.2.2 Data Rate Value */ -#define RATE_1M 2 /* 1M in unit of 500kb/s */ -#define RATE_2M 4 /* 2M */ -#define RATE_5_5M 11 /* 5.5M */ -#define RATE_11M 22 /* 11M */ -#define RATE_22M 44 /* 22M */ -#define RATE_33M 66 /* 33M */ -#define RATE_6M 12 /* 6M */ -#define RATE_9M 18 /* 9M */ -#define RATE_12M 24 /* 12M */ -#define RATE_18M 36 /* 18M */ -#define RATE_24M 48 /* 24M */ -#define RATE_36M 72 /* 36M */ -#define RATE_48M 96 /* 48M */ -#define RATE_54M 108 /* 54M */ -/* 7.3.2.14 BSS membership selector */ -#define RATE_HT_PHY 127 /* BSS Selector - Clause 20. HT PHY */ -#define RATE_MASK BITS(0,6) /* mask bits for the rate */ -#define RATE_BASIC_BIT BIT(7) /* mask bit for the rate belonging to the BSSBasicRateSet */ - -/* 8.3.2.2 TKIP MPDU formats */ -#define TKIP_MIC_LEN 8 - -/* 9.2.10 DIFS */ -#define DIFS 2 /* 2 x aSlotTime */ - -/* 11.3 STA Authentication and Association */ -#define STA_STATE_1 0 /* Accept Class 1 frames */ -#define STA_STATE_2 1 /* Accept Class 1 & 2 frames */ -#define STA_STATE_3 2 /* Accept Class 1,2 & 3 frames */ - -/* 15.4.8.5 802.11k RCPI-dBm mapping*/ -#define NDBM_LOW_BOUND_FOR_RCPI 110 -#define RCPI_LOW_BOUND 0 -#define RCPI_HIGH_BOUND 220 -#define RCPI_MEASUREMENT_NOT_AVAILABLE 255 - - -/* PHY characteristics */ -/* 17.4.4/18.3.3/19.8.4 Slot Time (aSlotTime) */ -#define SLOT_TIME_LONG 20 /* Long Slot Time */ -#define SLOT_TIME_SHORT 9 /* Short Slot Time */ - -#define SLOT_TIME_HR_DSSS SLOT_TIME_LONG /* 802.11b aSlotTime */ -#define SLOT_TIME_OFDM SLOT_TIME_SHORT /* 802.11a aSlotTime(20M Spacing) */ -#define SLOT_TIME_OFDM_10M_SPACING 13 /* 802.11a aSlotTime(10M Spacing) */ -#define SLOT_TIME_ERP_LONG SLOT_TIME_LONG /* 802.11g aSlotTime(Long) */ -#define SLOT_TIME_ERP_SHORT SLOT_TIME_SHORT /* 802.11g aSlotTime(Short) */ - -/* 17.4.4/18.3.3/19.8.4 Contention Window (aCWmin & aCWmax) */ -#define CWMIN_OFDM 15 /* 802.11a aCWmin */ -#define CWMAX_OFDM 1023 /* 802.11a aCWmax */ - -#define CWMIN_HR_DSSS 31 /* 802.11b aCWmin */ -#define CWMAX_HR_DSSS 1023 /* 802.11b aCWmax */ - -#define CWMIN_ERP_0 31 /* 802.11g aCWmin(0) - for only have 1/2/5/11Mbps Rates */ -#define CWMIN_ERP_1 15 /* 802.11g aCWmin(1) */ -#define CWMAX_ERP 1023 /* 802.11g aCWmax */ - -/* Short Inter-Frame Space (aSIFSTime) */ -/* 15.3.3 802.11b aSIFSTime */ -#define SIFS_TIME_HR_DSSS 10 -/* 17.4.4 802.11a aSIFSTime */ -#define SIFS_TIME_OFDM 16 -/* 19.8.4 802.11g aSIFSTime */ -#define SIFS_TIME_ERP 10 - -/* 15.4.6.2 Number of operating channels */ -#define CH_1 0x1 -#define CH_2 0x2 -#define CH_3 0x3 -#define CH_4 0x4 -#define CH_5 0x5 -#define CH_6 0x6 -#define CH_7 0x7 -#define CH_8 0x8 -#define CH_9 0x9 -#define CH_10 0xa -#define CH_11 0xb -#define CH_12 0xc -#define CH_13 0xd -#define CH_14 0xe - -#define MAXIMUM_OPERATION_CHANNEL_LIST 32 - - -//3 /* --------------- IEEE 802.11 PICS --------------- */ -/* Annex D - dot11OperationEntry 2 */ -#define DOT11_RTS_THRESHOLD_MIN 0 -#define DOT11_RTS_THRESHOLD_MAX 2347 // from Windows DDK -//#define DOT11_RTS_THRESHOLD_MAX 3000 // from Annex D - -#define DOT11_RTS_THRESHOLD_DEFAULT \ - DOT11_RTS_THRESHOLD_MAX - -/* Annex D - dot11OperationEntry 5 */ -#define DOT11_FRAGMENTATION_THRESHOLD_MIN 256 -#define DOT11_FRAGMENTATION_THRESHOLD_MAX 2346 // from Windows DDK -//#define DOT11_FRAGMENTATION_THRESHOLD_MAX 3000 // from Annex D - -#define DOT11_FRAGMENTATION_THRESHOLD_DEFAULT \ - DOT11_FRAGMENTATION_THRESHOLD_MAX - -/* Annex D - dot11OperationEntry 6 */ -#define DOT11_TRANSMIT_MSDU_LIFETIME_TU_MIN 1 -#define DOT11_TRANSMIT_MSDU_LIFETIME_TU_MAX 0xFFFFffff -#define DOT11_TRANSMIT_MSDU_LIFETIME_TU_DEFAULT 4095 // 802.11 define 512 - // MT5921 only aceept N <= 4095 - -/* Annex D - dot11OperationEntry 7 */ -#define DOT11_RECEIVE_LIFETIME_TU_MIN 1 -#define DOT11_RECEIVE_LIFETIME_TU_MAX 0xFFFFffff -#define DOT11_RECEIVE_LIFETIME_TU_DEFAULT 4096 // 802.11 define 512 - -/* Annex D - dot11StationConfigEntry 12 */ -#define DOT11_BEACON_PERIOD_MIN 1 // TU. -#define DOT11_BEACON_PERIOD_MAX 0xffff // TU. -#define DOT11_BEACON_PERIOD_DEFAULT 100 // TU. - -/* Annex D - dot11StationConfigEntry 13 */ -#define DOT11_DTIM_PERIOD_MIN 1 // TU. -#define DOT11_DTIM_PERIOD_MAX 255 // TU. -#define DOT11_DTIM_PERIOD_DEFAULT 1 // TU. - -/* Annex D - dot11RegDomainsSupportValue */ -#define REGULATION_DOMAIN_FCC 0x10 /* FCC (US) */ -#define REGULATION_DOMAIN_IC 0x20 /* IC or DOC (Canada) */ -#define REGULATION_DOMAIN_ETSI 0x30 /* ETSI (Europe) */ -#define REGULATION_DOMAIN_SPAIN 0x31 /* Spain */ -#define REGULATION_DOMAIN_FRANCE 0x32 /* France */ -#define REGULATION_DOMAIN_JAPAN 0x40 /* MKK (Japan) */ -#define REGULATION_DOMAIN_CHINA 0x50 /* China */ -#define REGULATION_DOMAIN_OTHER 0x00 /* Other */ - - - -//3 /* --------------- IEEE 802.11 MAC header fields --------------- */ -/* 7.1.3.1 Masks for the subfields in the Frame Control field */ -#define MASK_FC_PROTOCOL_VER BITS(0,1) -#define MASK_FC_TYPE BITS(2,3) -#define MASK_FC_SUBTYPE BITS(4,7) -#define MASK_FC_SUBTYPE_QOS_DATA BIT(7) -#define MASK_FC_TO_DS BIT(8) -#define MASK_FC_FROM_DS BIT(9) -#define MASK_FC_MORE_FRAG BIT(10) -#define MASK_FC_RETRY BIT(11) -#define MASK_FC_PWR_MGT BIT(12) -#define MASK_FC_MORE_DATA BIT(13) -#define MASK_FC_PROTECTED_FRAME BIT(14) -#define MASK_FC_ORDER BIT(15) - -#define MASK_FRAME_TYPE (MASK_FC_TYPE | MASK_FC_SUBTYPE) -#define MASK_TO_DS_FROM_DS (MASK_FC_TO_DS | MASK_FC_FROM_DS) - -#define MAX_NUM_OF_FC_SUBTYPES 16 -#define OFFSET_OF_FC_SUBTYPE 4 - - -/* 7.1.3.1.2 MAC frame types and subtypes */ -#define MAC_FRAME_TYPE_MGT 0 -#define MAC_FRAME_TYPE_CTRL BIT(2) -#define MAC_FRAME_TYPE_DATA BIT(3) -#define MAC_FRAME_TYPE_QOS_DATA (MAC_FRAME_TYPE_DATA | MASK_FC_SUBTYPE_QOS_DATA) - -#define MAC_FRAME_ASSOC_REQ (MAC_FRAME_TYPE_MGT | 0x0000) -#define MAC_FRAME_ASSOC_RSP (MAC_FRAME_TYPE_MGT | 0x0010) -#define MAC_FRAME_REASSOC_REQ (MAC_FRAME_TYPE_MGT | 0x0020) -#define MAC_FRAME_REASSOC_RSP (MAC_FRAME_TYPE_MGT | 0x0030) -#define MAC_FRAME_PROBE_REQ (MAC_FRAME_TYPE_MGT | 0x0040) -#define MAC_FRAME_PROBE_RSP (MAC_FRAME_TYPE_MGT | 0x0050) -#define MAC_FRAME_BEACON (MAC_FRAME_TYPE_MGT | 0x0080) -#define MAC_FRAME_ATIM (MAC_FRAME_TYPE_MGT | 0x0090) -#define MAC_FRAME_DISASSOC (MAC_FRAME_TYPE_MGT | 0x00A0) -#define MAC_FRAME_AUTH (MAC_FRAME_TYPE_MGT | 0x00B0) -#define MAC_FRAME_DEAUTH (MAC_FRAME_TYPE_MGT | 0x00C0) -#define MAC_FRAME_ACTION (MAC_FRAME_TYPE_MGT | 0x00D0) -#define MAC_FRAME_ACTION_NO_ACK (MAC_FRAME_TYPE_MGT | 0x00E0) - - -#define MAC_FRAME_CONTRL_WRAPPER (MAC_FRAME_TYPE_CTRL | 0x0070) -#define MAC_FRAME_BLOCK_ACK_REQ (MAC_FRAME_TYPE_CTRL | 0x0080) -#define MAC_FRAME_BLOCK_ACK (MAC_FRAME_TYPE_CTRL | 0x0090) -#define MAC_FRAME_PS_POLL (MAC_FRAME_TYPE_CTRL | 0x00A0) -#define MAC_FRAME_RTS (MAC_FRAME_TYPE_CTRL | 0x00B0) -#define MAC_FRAME_CTS (MAC_FRAME_TYPE_CTRL | 0x00C0) -#define MAC_FRAME_ACK (MAC_FRAME_TYPE_CTRL | 0x00D0) -#define MAC_FRAME_CF_END (MAC_FRAME_TYPE_CTRL | 0x00E0) -#define MAC_FRAME_CF_END_CF_ACK (MAC_FRAME_TYPE_CTRL | 0x00F0) - -#define MAC_FRAME_DATA (MAC_FRAME_TYPE_DATA | 0x0000) -#define MAC_FRAME_DATA_CF_ACK (MAC_FRAME_TYPE_DATA | 0x0010) -#define MAC_FRAME_DATA_CF_POLL (MAC_FRAME_TYPE_DATA | 0x0020) -#define MAC_FRAME_DATA_CF_ACK_CF_POLL (MAC_FRAME_TYPE_DATA | 0x0030) -#define MAC_FRAME_NULL (MAC_FRAME_TYPE_DATA | 0x0040) -#define MAC_FRAME_CF_ACK (MAC_FRAME_TYPE_DATA | 0x0050) -#define MAC_FRAME_CF_POLL (MAC_FRAME_TYPE_DATA | 0x0060) -#define MAC_FRAME_CF_ACK_CF_POLL (MAC_FRAME_TYPE_DATA | 0x0070) -#define MAC_FRAME_QOS_DATA (MAC_FRAME_TYPE_DATA | 0x0080) -#define MAC_FRAME_QOS_DATA_CF_ACK (MAC_FRAME_TYPE_DATA | 0x0090) -#define MAC_FRAME_QOS_DATA_CF_POLL (MAC_FRAME_TYPE_DATA | 0x00A0) -#define MAC_FRAME_QOS_DATA_CF_ACK_CF_POLL (MAC_FRAME_TYPE_DATA | 0x00B0) -#define MAC_FRAME_QOS_NULL (MAC_FRAME_TYPE_DATA | 0x00C0) -#define MAC_FRAME_QOS_CF_POLL (MAC_FRAME_TYPE_DATA | 0x00E0) -#define MAC_FRAME_QOS_CF_ACK_CF_POLL (MAC_FRAME_TYPE_DATA | 0x00F0) - -/* 7.1.3.2 Mask for the AID value in the Duration/ID field */ -#define MASK_DI_DURATION BITS(0,14) -#define MASK_DI_AID BITS(0,13) -#define MASK_DI_AID_MSB BITS(14,15) -#define MASK_DI_CFP_FIXED_VALUE BIT(15) - -/* 7.1.3.4 Masks for the subfields in the Sequence Control field */ -#define MASK_SC_SEQ_NUM BITS(4,15) -#define MASK_SC_SEQ_NUM_OFFSET 4 -#define MASK_SC_FRAG_NUM BITS(0,3) -#define INVALID_SEQ_CTRL_NUM 0x000F /* According to 6.2.1.1.2 - * FRAG_NUM won't equal to 15 - */ - -/* 7.1.3.5 QoS Control field */ -#define TID_NUM 16 -#define TID_MASK BITS(0,3) -#define EOSP BIT(4) -#define ACK_POLICY BITS(5,6) -#define A_MSDU_PRESENT BIT(7) - -#define MASK_QC_TID BITS(0,3) -#define MASK_QC_EOSP BIT(4) -#define MASK_QC_EOSP_OFFSET 4 -#define MASK_QC_ACK_POLICY BITS(5, 6) -#define MASK_QC_ACK_POLICY_OFFSET 5 -#define MASK_QC_A_MSDU_PRESENT BIT(7) - -/* 7.1.3.5a HT Control field */ -#define HT_CTRL_LINK_ADAPTATION_CTRL BITS(0,15) -#define HT_CTRL_CALIBRATION_POSITION BITS(16,17) -#define HT_CTRL_CALIBRATION_SEQUENCE BITS(18,19) -#define HT_CTRL_CSI_STEERING BITS(22,23) -#define HT_CTRL_NDP_ANNOUNCEMENT BIT(24) -#define HT_CTRL_AC_CONSTRAINT BIT(30) -#define HT_CTRL_RDG_MORE_PPDU BIT(31) - -#define LINK_ADAPTATION_CTRL_TRQ BIT(1) -#define LINK_ADAPTATION_CTRL_MAI_MRQ BIT(2) -#define LINK_ADAPTATION_CTRL_MAI_MSI BITS(3,5) -#define LINK_ADAPTATION_CTRL_MFSI BITS(6,8) -#define LINK_ADAPTATION_CTRL_MFB_ASELC_CMD BITS(9,11) -#define LINK_ADAPTATION_CTRL_MFB_ASELC_DATA BITS(12,15) - -/* 7.1.3.5.3 Ack Policy subfield*/ -#define ACK_POLICY_NORMAL_ACK_IMPLICIT_BA_REQ 0 -#define ACK_POLICY_NO_ACK 1 -#define ACK_POLICY_NO_EXPLICIT_ACK_PSMP_ACK 2 -#define ACK_POLICY_BA 3 - -/* 7.1.3.7 FCS field */ -#define FCS_LEN 4 - -/* 7.2.1.4 WLAN Control Frame - PS-POLL Frame */ -#define PSPOLL_FRAME_LEN 16 /* w/o FCS */ - -/* 7.2.7.1 BAR */ -#define OFFSET_BAR_SSC_SN 4 - -/* 8.3.2.2 TKIP MPDU formats */ -#define TKIP_MIC_LEN 8 - -/* 2009.11.30 mtk02468: Moved these definitions to the right place */ -#if 0 -/* Block Ack Parameter Set field */ -#define BA_PARM_BA_POLICY BIT(1) -#define BA_PARM_TID BITS(2,5) -#define BA_PARM_BUFFER_SIZE BITS(6,15) -#endif - -#define BA_POLICY_IMMEDIATE BIT(1) - -/* Block Ack Starting Sequence Control field */ -#define BA_START_SEQ_CTL_FRAG_NUM BITS(0,3) -#define BA_START_SEQ_CTL_SSN BITS(4,15) - -/* BAR Control field */ -#define BAR_CONTROL_NO_ACK_POLICY BIT(0) -#define BAR_CONTROL_MULTI_TID BIT(1) -#define BAR_CONTROL_COMPRESSED_BA BIT(2) -#define BAR_CONTROL_TID_INFO BITS(12,15) -#define BAR_CONTROL_TID_INFO_OFFSET 12 - -/* TID Value */ -#define BAR_INFO_TID_VALUE BITS(12,15) - -#define BAR_COMPRESSED_VARIANT_FRAME_LEN (16 + 4) - -//3 /* --------------- IEEE 802.11 frame body fields --------------- */ -//3 Management frame body components (I): Fixed Fields. -/* 7.3.1.1 Authentication Algorithm Number field */ -#define AUTH_ALGORITHM_NUM_FIELD_LEN 2 - -#define AUTH_ALGORITHM_NUM_OPEN_SYSTEM 0 /* Open System */ -#define AUTH_ALGORITHM_NUM_SHARED_KEY 1 /* Shared Key */ -#define AUTH_ALGORITHM_NUM_FAST_BSS_TRANSITION 2 /* Fast BSS Transition */ - -/* 7.3.1.2 Authentication Transaction Sequence Number field */ -#define AUTH_TRANSACTION_SEQENCE_NUM_FIELD_LEN 2 -#define AUTH_TRANSACTION_SEQ_1 1 -#define AUTH_TRANSACTION_SEQ_2 2 -#define AUTH_TRANSACTION_SEQ_3 3 -#define AUTH_TRANSACTION_SEQ_4 4 - -/* 7.3.1.3 Beacon Interval field */ -#define BEACON_INTERVAL_FIELD_LEN 2 - -/* 7.3.1.4 Capability Information field */ -#define CAP_INFO_FIELD_LEN 2 -#define CAP_INFO_ESS BIT(0) -#define CAP_INFO_IBSS BIT(1) -#define CAP_INFO_BSS_TYPE (CAP_INFO_ESS | CAP_INFO_IBSS) -#define CAP_INFO_CF_POLLABLE BIT(2) -#define CAP_INFO_CF_POLL_REQ BIT(3) -#define CAP_INFO_CF (CAP_INFO_CF_POLLABLE | CAP_INFO_CF_POLL_REQ) -#define CAP_INFO_PRIVACY BIT(4) -#define CAP_INFO_SHORT_PREAMBLE BIT(5) -#define CAP_INFO_PBCC BIT(6) -#define CAP_INFO_CH_AGILITY BIT(7) -#define CAP_INFO_SPEC_MGT BIT(8) -#define CAP_INFO_QOS BIT(9) -#define CAP_INFO_SHORT_SLOT_TIME BIT(10) -#define CAP_INFO_APSD BIT(11) -#define CAP_INFO_RESERVED BIT(12) -#define CAP_INFO_DSSS_OFDM BIT(13) -#define CAP_INFO_DELAYED_BLOCK_ACK BIT(14) -#define CAP_INFO_IMM_BLOCK_ACK BIT(15) -/* STA usage of CF-Pollable and CF-Poll Request subfields */ -/* STA: not CF-Pollable */ -#define CAP_CF_STA_NOT_POLLABLE 0x0000 -/* STA: CF-Pollable, not requesting on the CF-Polling list */ -#define CAP_CF_STA_NOT_ON_LIST CAP_INFO_CF_POLL_REQ -/* STA: CF-Pollable, requesting on the CF-Polling list */ -#define CAP_CF_STA_ON_LIST CAP_INFO_CF_POLLABLE -/* STA: CF-Pollable, requesting never to be polled */ -#define CAP_CF_STA_NEVER_POLLED (CAP_INFO_CF_POLLABLE | CAP_INFO_CF_POLL_REQ) - -/* AP usage of CF-Pollable and CF-Poll Request subfields */ -/* AP: No point coordinator (PC) */ -#define CAP_CF_AP_NO_PC 0x0000 -/* AP: PC at AP for delivery only (no polling) */ -#define CAP_CF_AP_DELIVERY_ONLY CAP_INFO_CF_POLL_REQ -/* AP: PC at AP for delivery and polling */ -#define CAP_CF_AP_DELIVERY_POLLING CAP_INFO_CF_POLLABLE - -/* 7.3.1.5 Current AP Address field */ -#define CURR_AP_ADDR_FIELD_LEN MAC_ADDR_LEN - -/* 7.3.1.6 Listen Interval field */ -#define LISTEN_INTERVAL_FIELD_LEN 2 - -/* 7.3.1.7 Reason Code field */ -#define REASON_CODE_FIELD_LEN 2 - -#define REASON_CODE_RESERVED 0 /* Reseved */ -#define REASON_CODE_UNSPECIFIED 1 /* Unspecified reason */ -#define REASON_CODE_PREV_AUTH_INVALID 2 /* Previous auth no longer valid */ -#define REASON_CODE_DEAUTH_LEAVING_BSS 3 /* Deauth because sending STA is leaving BSS */ -#define REASON_CODE_DISASSOC_INACTIVITY 4 /* Disassoc due to inactivity */ -#define REASON_CODE_DISASSOC_AP_OVERLOAD 5 /* Disassoc because AP is unable to handle all assoc STAs */ -#define REASON_CODE_CLASS_2_ERR 6 /* Class 2 frame rx from nonauth STA */ -#define REASON_CODE_CLASS_3_ERR 7 /* Class 3 frame rx from nonassoc STA */ -#define REASON_CODE_DISASSOC_LEAVING_BSS 8 /* Disassoc because sending STA is leaving BSS */ -#define REASON_CODE_ASSOC_BEFORE_AUTH 9 /* STA requesting (re)assoc is not auth with responding STA */ -#define REASON_CODE_DISASSOC_PWR_CAP_UNACCEPTABLE 10 /* Disassoc because the info in Power Capability is unacceptable */ -#define REASON_CODE_DISASSOC_SUP_CHS_UNACCEPTABLE 11 /* Disassoc because the info in Supported Channels is unacceptable */ -#define REASON_CODE_INVALID_INFO_ELEM 13 /* Invalid information element */ -#define REASON_CODE_MIC_FAILURE 14 /* MIC failure */ -#define REASON_CODE_4_WAY_HANDSHAKE_TIMEOUT 15 /* 4-way handshake timeout */ -#define REASON_CODE_GROUP_KEY_UPDATE_TIMEOUT 16 /* Group key update timeout */ -#define REASON_CODE_DIFFERENT_INFO_ELEM 17 /* Info element in 4-way handshake different from (Re-)associate request/Probe response/Beacon */ -#define REASON_CODE_MULTICAST_CIPHER_NOT_VALID 18 /* Multicast Cipher is not valid */ -#define REASON_CODE_UNICAST_CIPHER_NOT_VALID 19 /* Unicast Cipher is not valid */ -#define REASON_CODE_AKMP_NOT_VALID 20 /* AKMP is not valid */ -#define REASON_CODE_UNSUPPORTED_RSNE_VERSION 21 /* Unsupported RSNE version */ -#define REASON_CODE_INVALID_RSNE_CAPABILITIES 22 /* Invalid RSNE Capabilities */ -#define REASON_CODE_IEEE_802_1X_AUTH_FAILED 23 /* IEEE 802.1X Authentication failed */ -#define REASON_CODE_CIPHER_REJECT_SEC_POLICY 24 /* Cipher suite rejected because of the security policy */ -#define REASON_CODE_DISASSOC_UNSPECIFIED_QOS 32 /* Disassoc for unspecified, QoS-related reason */ -#define REASON_CODE_DISASSOC_LACK_OF_BANDWIDTH 33 /* Disassoc because QAP lacks sufficient bandwidth for this QSTA */ -#define REASON_CODE_DISASSOC_ACK_LOST_POOR_CHANNEL 34 /* Disassoc because of too many ACKs lost for AP transmissions and/or poor channel conditions */ -#define REASON_CODE_DISASSOC_TX_OUTSIDE_TXOP_LIMIT 35 /* Disassoc because QSTA is transmitting outside the limits of its TXOPs */ -#define REASON_CODE_PEER_WHILE_LEAVING 36 /* QSTA is leaving the QBSS or resetting */ -#define REASON_CODE_PEER_REFUSE_DLP 37 /* Peer does not want to use this mechanism */ -#define REASON_CODE_PEER_SETUP_REQUIRED 38 /* Frames received but a setup is reqired */ -#define REASON_CODE_PEER_TIME_OUT 39 /* Time out */ -#define REASON_CODE_PEER_CIPHER_UNSUPPORTED 45 /* Peer does not support the requested cipher suite */ - -/* 7.3.1.8 AID field */ -#define AID_FIELD_LEN 2 -#define AID_MASK BITS(0,13) -#define AID_MSB BITS(14,15) -#define AID_MIN_VALUE 1 -#define AID_MAX_VALUE 2007 - -/* 7.3.1.9 Status Code field */ -#define STATUS_CODE_FIELD_LEN 2 - -#define STATUS_CODE_RESERVED 0 /* Reserved - Used by TX Auth */ -#define STATUS_CODE_SUCCESSFUL 0 /* Successful */ -#define STATUS_CODE_UNSPECIFIED_FAILURE 1 /* Unspecified failure */ -#define STATUS_CODE_CAP_NOT_SUPPORTED 10 /* Cannot support all requested cap in the Cap Info field */ -#define STATUS_CODE_REASSOC_DENIED_WITHOUT_ASSOC 11 /* Reassoc denied due to inability to confirm that assoc exists */ -#define STATUS_CODE_ASSOC_DENIED_OUTSIDE_STANDARD 12 /* Assoc denied due to reason outside the scope of this std. */ -#define STATUS_CODE_AUTH_ALGORITHM_NOT_SUPPORTED 13 /* Responding STA does not support the specified auth algorithm */ -#define STATUS_CODE_AUTH_OUT_OF_SEQ 14 /* Rx an auth frame with auth transaction seq num out of expected seq */ -#define STATUS_CODE_AUTH_REJECTED_CHAL_FAIL 15 /* Auth rejected because of challenge failure */ -#define STATUS_CODE_AUTH_REJECTED_TIMEOUT 16 /* Auth rejected due to timeout waiting for next frame in sequence */ -#define STATUS_CODE_ASSOC_DENIED_AP_OVERLOAD 17 /* Assoc denied because AP is unable to handle additional assoc STAs */ -#define STATUS_CODE_ASSOC_DENIED_RATE_NOT_SUPPORTED 18 /* Assoc denied due to requesting STA not supporting all of basic rates */ -#define STATUS_CODE_ASSOC_DENIED_NO_SHORT_PREAMBLE 19 /* Assoc denied due to requesting STA not supporting short preamble */ -#define STATUS_CODE_ASSOC_DENIED_NO_PBCC 20 /* Assoc denied due to requesting STA not supporting PBCC */ -#define STATUS_CODE_ASSOC_DENIED_NO_CH_AGILITY 21 /* Assoc denied due to requesting STA not supporting channel agility */ -#define STATUS_CODE_ASSOC_REJECTED_NO_SPEC_MGT 22 /* Assoc rejected because Spectrum Mgt capability is required */ -#define STATUS_CODE_ASSOC_REJECTED_PWR_CAP 23 /* Assoc rejected because the info in Power Capability is unacceptable */ -#define STATUS_CODE_ASSOC_REJECTED_SUP_CHS 24 /* Assoc rejected because the info in Supported Channels is unacceptable */ -#define STATUS_CODE_ASSOC_DENIED_NO_SHORT_SLOT_TIME 25 /* Assoc denied due to requesting STA not supporting short slot time */ -#define STATUS_CODE_ASSOC_DENIED_NO_DSSS_OFDM 26 /* Assoc denied due to requesting STA not supporting DSSS-OFDM */ -#if CFG_SUPPORT_802_11W -#define STATUS_CODE_ASSOC_REJECTED_TEMPORARILY 30 /* IEEE 802.11w, Assoc denied due to the SA query */ -#define STATUS_CODE_ROBUST_MGMT_FRAME_POLICY_VIOLATION 31 /* IEEE 802.11w, Assoc denied due to the MFP select policy */ -#endif -#define STATUS_CODE_UNSPECIFIED_QOS_FAILURE 32 /* Unspecified, QoS-related failure */ -#define STATUS_CODE_ASSOC_DENIED_BANDWIDTH 33 /* Assoc denied due to insufficient bandwidth to handle another QSTA */ -#define STATUS_CODE_ASSOC_DENIED_POOR_CHANNEL 34 /* Assoc denied due to excessive frame loss rates and/or poor channel conditions */ -#define STATUS_CODE_ASSOC_DENIED_NO_QOS_FACILITY 35 /* Assoc denied due to requesting STA not supporting QoS facility */ -#define STATUS_CODE_REQ_DECLINED 37 /* Request has been declined */ -#define STATUS_CODE_REQ_INVALID_PARAMETER_VALUE 38 /* Request has not been successful as one or more parameters have invalid values */ -#define STATUS_CODE_REQ_NOT_HONORED_TSPEC 39 /* TS not created because request cannot be honored. Suggested TSPEC provided. */ -#define STATUS_CODE_INVALID_INFO_ELEMENT 40 /* Invalid information element */ -#define STATUS_CODE_INVALID_GROUP_CIPHER 41 /* Invalid group cipher */ -#define STATUS_CODE_INVALID_PAIRWISE_CIPHER 42 /* Invalid pairwise cipher */ -#define STATUS_CODE_INVALID_AKMP 43 /* Invalid AKMP */ -#define STATUS_CODE_UNSUPPORTED_RSN_IE_VERSION 44 /* Unsupported RSN information element version */ -#define STATUS_CODE_INVALID_RSN_IE_CAP 45 /* Invalid RSN information element capabilities */ -#define STATUS_CODE_CIPHER_SUITE_REJECTED 46 /* Cipher suite rejected because of security policy */ -#define STATUS_CODE_REQ_NOT_HONORED_TS_DELAY 47 /* TS not created becasue request cannot be honored. Attempt to create a TS later. */ -#define STATUS_CODE_DIRECT_LINK_NOT_ALLOWED 48 /* Direct Link is not allowed in the BSS by policy */ -#define STATUS_CODE_DESTINATION_STA_NOT_PRESENT 49 /* Destination STA is not present within this QBSS */ -#define STATUS_CODE_DESTINATION_STA_NOT_QSTA 50 /* Destination STA is not a QSTA */ -#define STATUS_CODE_ASSOC_DENIED_LARGE_LIS_INTERVAL 51 /* Association denied because the ListenInterval is too large */ - -/* proprietary definition of reserved field of Status Code */ -#define STATUS_CODE_JOIN_FAILURE 0xFFF0 /* Join failure */ -#define STATUS_CODE_JOIN_TIMEOUT 0xFFF1 /* Join timeout */ -#define STATUS_CODE_AUTH_TIMEOUT 0xFFF2 /* Authentication timeout */ -#define STATUS_CODE_ASSOC_TIMEOUT 0xFFF3 /* (Re)Association timeout */ -#define STATUS_CODE_CCX_CCKM_REASSOC_FAILURE 0xFFF4 /* CCX CCKM reassociation failure */ - - -/* 7.3.1.10 Timestamp field */ -#define TIMESTAMP_FIELD_LEN 8 - -/* 7.3.1.11 Category of Action field */ -#define CATEGORY_SPEC_MGT 0 -#define CATEGORY_QOS_ACTION 1 /* QoS action */ -#define CATEGORY_DLS_ACTION 2 /* Direct Link Protocol (DLP) action */ -#define CATEGORY_BLOCK_ACK_ACTION 3 /* Block ack action */ -#define CATEGORY_PUBLIC_ACTION 4 /* Public action */ -#define CATEGORY_RM_ACTION 5 /* Radio measurement action */ -#define CATEGORY_HT_ACTION 7 -#if CFG_SUPPORT_802_11W -#define CATEGORY_SA_QUERT_ACTION 8 -#endif -#define CATEGORY_WNM_ACTION 10 /* 802.11v Wireless Network Management */ -#define CATEGORY_UNPROTECTED_WNM_ACTION 11 /* 802.11v Wireless Network Management */ -#define CATEGORY_WME_MGT_NOTIFICATION 17 /* WME management notification */ -#define CATEGORY_VENDOR_SPECIFIC_ACTION 127 - - -/* 7.3.1.14 Block Ack Parameter Set field */ -#define BA_PARAM_SET_ACK_POLICY_MASK BIT(1) -#define BA_PARAM_SET_ACK_POLICY_MASK_OFFSET 1 -#define BA_PARAM_SET_TID_MASK BITS(2,5) -#define BA_PARAM_SET_TID_MASK_OFFSET 2 -#define BA_PARAM_SET_BUFFER_SIZE_MASK BITS(6,15) -#define BA_PARAM_SET_BUFFER_SIZE_MASK_OFFSET 6 - -#define BA_PARAM_SET_ACK_POLICY_IMMEDIATE_BA 1 -#define BA_PARAM_SET_ACK_POLICY_DELAYED_BA 0 - - -//3 Management frame body components (II): Information Elements. -/* 7.3.2 Element IDs of information elements */ -#define ELEM_HDR_LEN 2 - -#define ELEM_ID_SSID 0 /* SSID */ -#define ELEM_ID_SUP_RATES 1 /* Supported rates */ -#define ELEM_ID_FH_PARAM_SET 2 /* FH parameter set */ -#define ELEM_ID_DS_PARAM_SET 3 /* DS parameter set */ -#define ELEM_ID_CF_PARAM_SET 4 /* CF parameter set */ -#define ELEM_ID_TIM 5 /* TIM */ -#define ELEM_ID_IBSS_PARAM_SET 6 /* IBSS parameter set */ -#define ELEM_ID_COUNTRY_INFO 7 /* Country information */ -#define ELEM_ID_HOPPING_PATTERN_PARAM 8 /* Hopping pattern parameters */ -#define ELEM_ID_HOPPING_PATTERN_TABLE 9 /* Hopping pattern table */ -#define ELEM_ID_REQUEST 10 /* Request */ -#define ELEM_ID_BSS_LOAD 11 /* BSS load */ -#define ELEM_ID_EDCA_PARAM_SET 12 /* EDCA parameter set */ -#define ELEM_ID_TSPEC 13 /* Traffic specification (TSPEC) */ -#define ELEM_ID_TCLAS 14 /* Traffic classification (TCLAS) */ -#define ELEM_ID_SCHEDULE 15 /* Schedule */ -#define ELEM_ID_CHALLENGE_TEXT 16 /* Challenge text */ - -#define ELEM_ID_PWR_CONSTRAINT 32 /* Power constraint */ -#define ELEM_ID_PWR_CAP 33 /* Power capability */ -#define ELEM_ID_TPC_REQ 34 /* TPC request */ -#define ELEM_ID_TPC_REPORT 35 /* TPC report */ -#define ELEM_ID_SUP_CHS 36 /* Supported channels */ -#define ELEM_ID_CH_SW_ANNOUNCEMENT 37 /* Channel switch announcement */ -#define ELEM_ID_MEASUREMENT_REQ 38 /* Measurement request */ -#define ELEM_ID_MEASUREMENT_REPORT 39 /* Measurement report */ -#define ELEM_ID_QUIET 40 /* Quiet */ -#define ELEM_ID_IBSS_DFS 41 /* IBSS DFS */ -#define ELEM_ID_ERP_INFO 42 /* ERP information */ -#define ELEM_ID_TS_DELAY 43 /* TS delay */ -#define ELEM_ID_TCLAS_PROCESSING 44 /* TCLAS processing */ -#define ELEM_ID_HT_CAP 45 /* HT Capabilities subelement */ -#define ELEM_ID_QOS_CAP 46 /* QoS capability */ -#define ELEM_ID_RSN 48 /* RSN IE */ -#define ELEM_ID_EXTENDED_SUP_RATES 50 /* Extended supported rates */ -#if CFG_SUPPORT_802_11W -#define ELEM_ID_TIMEOUT_INTERVAL 56 /* 802.11w SA Timeout interval */ -#endif -#define ELEM_ID_HT_OP 61 /* HT Operation */ -#define ELEM_ID_SCO 62 /* Secondary Channel Offset */ -#define ELEM_ID_RRM_ENABLED_CAP 70 /* Radio Resource Management Enabled Capabilities */ -#define ELEM_ID_20_40_BSS_COEXISTENCE 72 /* 20/40 BSS Coexistence */ -#define ELEM_ID_20_40_INTOLERANT_CHNL_REPORT 73 /* 20/40 BSS Intolerant Channel Report */ -#define ELEM_ID_OBSS_SCAN_PARAMS 74 /* Overlapping BSS Scan Parameters */ -#define ELEM_ID_EXTENDED_CAP 127 /* Extended capabilities */ - -#define ELEM_ID_VENDOR 221 /* Vendor specific IE */ -#define ELEM_ID_WPA ELEM_ID_VENDOR /* WPA IE */ -#define ELEM_ID_WMM ELEM_ID_VENDOR /* WMM IE */ -#define ELEM_ID_P2P ELEM_ID_VENDOR /* WiFi Direct */ -#define ELEM_ID_WSC ELEM_ID_VENDOR /* WSC IE */ - -#define ELEM_ID_RESERVED 255 /* Reserved */ - - -/* 7.3.2.1 SSID element */ -#define ELEM_MAX_LEN_SSID 32 - -/* 7.3.2.2 Supported Rates */ -#define ELEM_MAX_LEN_SUP_RATES 8 - -/* 7.3.2.4 DS Parameter Set */ -#define ELEM_MAX_LEN_DS_PARAMETER_SET 1 - -/* 7.3.2.5 CF Parameter Set */ -#define ELEM_CF_PARM_LEN 8 - -/* 7.3.2.6 TIM */ -#define ELEM_MIX_LEN_TIM 4 -#define ELEM_MAX_LEN_TIM 254 - -/* 7.3.2.7 IBSS Parameter Set element */ -#define ELEM_MAX_LEN_IBSS_PARAMETER_SET 2 - -/* 7.3.2.8 Challenge Text element */ -#define ELEM_MIN_LEN_CHALLENGE_TEXT 1 -#define ELEM_MAX_LEN_CHALLENGE_TEXT 253 - -/* 7.3.2.9 Country Information element */ -/* Country IE should contain at least 3-bytes country code string and one subband triplet. */ -#define ELEM_MIN_LEN_COUNTRY_INFO 6 - -#define ELEM_ID_COUNTRY_INFO_TRIPLET_LEN_FIXED 3 -#define ELEM_ID_COUNTRY_INFO_SUBBAND_TRIPLET_LEN_FIXED 3 -#define ELEM_ID_COUNTRY_INFO_REGULATORY_TRIPLET_LEN_FIXED 3 - - -/* 7.3.2.13 ERP Information element */ -#define ELEM_MAX_LEN_ERP 1 -/* -- bits in the ERP Information element */ -#define ERP_INFO_NON_ERP_PRESENT BIT(0) /* NonERP_Present bit */ -#define ERP_INFO_USE_PROTECTION BIT(1) /* Use_Protection bit */ -#define ERP_INFO_BARKER_PREAMBLE_MODE BIT(2) /* Barker_Preamble_Mode bit */ - - -/* 7.3.2.14 Extended Supported Rates */ -#define ELEM_MAX_LEN_EXTENDED_SUP_RATES 255 - -/* 7.3.2.21 Measurement Request element */ -#define ELEM_RM_TYPE_BASIC_REQ 0 -#define ELEM_RM_TYPE_CCA_REQ 1 -#define ELEM_RM_TYPE_RPI_HISTOGRAM_REQ 2 -#define ELEM_RM_TYPE_CHNL_LOAD_REQ 3 -#define ELEM_RM_TYPE_NOISE_HISTOGRAM_REQ 4 -#define ELEM_RM_TYPE_BEACON_REQ 5 -#define ELEM_RM_TYPE_FRAME_REQ 6 -#define ELEM_RM_TYPE_STA_STATISTICS_REQ 7 -#define ELEM_RM_TYPE_LCI_REQ 8 -#define ELEM_RM_TYPE_TS_REQ 9 -#define ELEM_RM_TYPE_MEASURE_PAUSE_REQ 255 - -/* 7.3.2.22 Measurement Report element */ -#define ELEM_RM_TYPE_BASIC_REPORT 0 -#define ELEM_RM_TYPE_CCA_REPORT 1 -#define ELEM_RM_TYPE_RPI_HISTOGRAM_REPORT 2 -#define ELEM_RM_TYPE_CHNL_LOAD_REPORT 3 -#define ELEM_RM_TYPE_NOISE_HISTOGRAM_REPORT 4 -#define ELEM_RM_TYPE_BEACON_REPORT 5 -#define ELEM_RM_TYPE_FRAME_REPORT 6 -#define ELEM_RM_TYPE_STA_STATISTICS_REPORT 7 -#define ELEM_RM_TYPE_LCI_REPORT 8 -#define ELEM_RM_TYPE_TS_REPORT 9 - - -/* 7.3.2.25 RSN information element */ -#define ELEM_MAX_LEN_WPA 24 /* one pairwise, one AKM suite, one PMKID */ -#define ELEM_MAX_LEN_RSN 38 /* one pairwise, one AKM suite, one PMKID */ -#define ELEM_MAX_LEN_WAPI 38 /* one pairwise, one AKM suite, one BKID */ -#define ELEM_MAX_LEN_WSC 200/* one pairwise, one AKM suite, one BKID */ - -#if CFG_SUPPORT_802_11W -#define ELEM_WPA_CAP_MFPR BIT(6) -#define ELEM_WPA_CAP_MFPC BIT(7) -#endif - -/* 7.3.2.27 Extended Capabilities information element */ -#define ELEM_EXT_CAP_20_40_COEXIST_SUPPORT BIT(0) -#define ELEM_EXT_CAP_PSMP_CAP BIT(4) -#define ELEM_EXT_CAP_SERVICE_INTERVAL_GRANULARITY BIT(5) -#define ELEM_EXT_CAP_SCHEDULE_PSMP BIT(6) - -#define ELEM_MAX_LEN_EXT_CAP (3 - ELEM_HDR_LEN) - -/* 7.3.2.30 TSPEC element */ -#define TS_INFO_TRAFFIC_TYPE_MASK BIT(0) //WMM: 0 (Asynchronous TS of low-duty cycles) -#define TS_INFO_TID_OFFSET 1 -#define TS_INFO_TID_MASK BITS(1,4) -#define TS_INFO_DIRECTION_OFFSET 5 -#define TS_INFO_DIRECTION_MASK BITS(5,6) -#define TS_INFO_ACCESS_POLICY_OFFSET 7 -#define TS_INFO_ACCESS_POLICY_MASK BITS(7,8) //WMM: Bit(7,8) = (1,0) = EDCA -#define TS_INFO_AGGREGATION_MASK BIT(9) //WMM: 0 -#define TS_INFO_APSD_MASK BIT(10) -#define TS_INFO_UP_OFFSET 11 -#define TS_INFO_UP_MASK BITS(11,13) -#define TS_INFO_ACK_POLICY_OFFSET 14 -#define TS_INFO_ACK_POLICY_MASK BITS(14,15) -#define TS_INFO_SCHEDULE_MASK 16 - -/* 7.3.2.56 HT capabilities element */ -#define ELEM_MAX_LEN_HT_CAP (28 - ELEM_HDR_LEN) /* sizeof(IE_HT_CAP_T)-2 */ - -/* 7.3.2.56.2 HT capabilities Info field */ -#define HT_CAP_INFO_LDPC_CAP BIT(0) -#define HT_CAP_INFO_SUP_CHNL_WIDTH BIT(1) -#define HT_CAP_INFO_SM_POWER_SAVE BITS(2,3) -#define HT_CAP_INFO_HT_GF BIT(4) -#define HT_CAP_INFO_SHORT_GI_20M BIT(5) -#define HT_CAP_INFO_SHORT_GI_40M BIT(6) -#define HT_CAP_INFO_TX_STBC BIT(7) -#define HT_CAP_INFO_RX_STBC BITS(8,9) -#define HT_CAP_INFO_HT_DELAYED_BA BIT(10) -#define HT_CAP_INFO_MAX_AMSDU_LEN BIT(11) -#define HT_CAP_INFO_DSSS_CCK_IN_40M BIT(12) -#define HT_CAP_INFO_40M_INTOLERANT BIT(14) -#define HT_CAP_INFO_LSIG_TXOP_SUPPORT BIT(15) - -#define HT_CAP_INFO_RX_STBC_NO_SUPPORTED 0 -#define HT_CAP_INFO_RX_STBC_1_SS BIT(8) -#define HT_CAP_INFO_RX_STBC_2_SS BIT(9) -#define HT_CAP_INFO_RX_STBC_3_SS HT_CAP_INFO_RX_STBC - -/* 7.3.2.56.3 A-MPDU Parameters field */ -#define AMPDU_PARAM_MAX_AMPDU_LEN_EXP BITS(0,1) -#define AMPDU_PARAM_MIN_START_SPACING BITS(2,4) - -#define AMPDU_PARAM_MAX_AMPDU_LEN_8K 0 -#define AMPDU_PARAM_MAX_AMPDU_LEN_16K BIT(0) -#define AMPDU_PARAM_MAX_AMPDU_LEN_32K BIT(1) -#define AMPDU_PARAM_MAX_AMPDU_LEN_64K BITS(0,1) - -#define AMPDU_PARAM_MSS_NO_RESTRICIT 0 -#define AMPDU_PARAM_MSS_1_4_US BIT(2) -#define AMPDU_PARAM_MSS_1_2_US BIT(3) -#define AMPDU_PARAM_MSS_1_US BITS(2,3) -#define AMPDU_PARAM_MSS_2_US BIT(4) -#define AMPDU_PARAM_MSS_4_US (BIT(4) | BIT(2)) -#define AMPDU_PARAM_MSS_8_US (BIT(4) | BIT(3)) -#define AMPDU_PARAM_MSS_16_US BITS(2,4) - -/* 7.3.2.56.4 Supported MCS Set field (TX rate: octects 12~15) */ -#define SUP_MCS_TX_SET_DEFINED BIT(0) -#define SUP_MCS_TX_RX_SET_NOT_EQUAL BIT(1) -#define SUP_MCS_TX_MAX_NUM_SS BITS(2,3) -#define SUP_MCS_TX_UNEQUAL_MODULATION BIT(4) - -#define SUP_MCS_TX_MAX_NUM_1_SS 0 -#define SUP_MCS_TX_MAX_NUM_2_SS BIT(2) -#define SUP_MCS_TX_MAX_NUM_3_SS BIT(3) -#define SUP_MCS_TX_MAX_NUM_4_SS BITS(2,3) - -#define SUP_MCS_RX_BITMASK_OCTET_NUM 10 -#define SUP_MCS_RX_DEFAULT_HIGHEST_RATE 0 /* Not specify */ - -/* 7.3.2.56.5 HT Extended Capabilities field */ -#define HT_EXT_CAP_PCO BIT(0) -#define HT_EXT_CAP_PCO_TRANSITION_TIME BITS(1,2) -#define HT_EXT_CAP_MCS_FEEDBACK BITS(8,9) -#define HT_EXT_CAP_HTC_SUPPORT BIT(10) -#define HT_EXT_CAP_RD_RESPONDER BIT(11) - -#define HT_EXT_CAP_PCO_TRANS_TIME_NONE 0 -#define HT_EXT_CAP_PCO_TRANS_TIME_400US BIT(1) -#define HT_EXT_CAP_PCO_TRANS_TIME_1_5MS BIT(2) -#define HT_EXT_CAP_PCO_TRANS_TIME_5MS BITS(1,2) - -#define HT_EXT_CAP_MCS_FEEDBACK_NO_FB 0 -#define HT_EXT_CAP_MCS_FEEDBACK_UNSOLICITED BIT(9) -#define HT_EXT_CAP_MCS_FEEDBACK_BOTH BITS(8,9) - -/* 7.3.2.56.6 Transmit Beamforming Capabilities field */ - -/* 7.3.2.56.7 Antenna Selection Capability field */ -#define ASEL_CAP_CAPABLE BIT(0) -#define ASEL_CAP_CSI_FB_BY_TX_ASEL_CAPABLE BIT(1) -#define ASEL_CAP_ANT_INDICES_FB_BY_TX_ASEL_CAPABLE BIT(2) -#define ASEL_CAP_EXPLICIT_CSI_FB_CAPABLE BIT(3) -#define ASEL_CAP_ANT_INDICES_CAPABLE BIT(4) -#define ASEL_CAP_RX_ASEL_CAPABLE BIT(5) -#define ASEL_CAP_TX_SOUNDING_CAPABLE BIT(6) - -/* 7.3.2.57 HT Operation element */ -#define ELEM_MAX_LEN_HT_OP (24 - ELEM_HDR_LEN) /* sizeof(IE_HT_OP_T)-2 */ - -#define HT_OP_INFO1_SCO BITS(0,1) -#define HT_OP_INFO1_STA_CHNL_WIDTH BIT(2) -#define HT_OP_INFO1_RIFS_MODE BIT(3) - -#define HT_OP_INFO2_HT_PROTECTION BITS(0,1) -#define HT_OP_INFO2_NON_GF_HT_STA_PRESENT BIT(2) -#define HT_OP_INFO2_OBSS_NON_HT_STA_PRESENT BIT(4) - -#define HT_OP_INFO3_DUAL_BEACON BIT(6) -#define HT_OP_INFO3_DUAL_CTS_PROTECTION BIT(7) -#define HT_OP_INFO3_STBC_BEACON BIT(8) -#define HT_OP_INFO3_LSIG_TXOP_FULL_SUPPORT BIT(9) -#define HT_OP_INFO3_PCO_ACTIVE BIT(10) -#define HT_OP_INFO3_PCO_PHASE BIT(11) - -/* 7.3.2.59 OBSS Scan Parameter element */ -#define ELEM_MAX_LEN_OBSS_SCAN (16 - ELEM_HDR_LEN) - -/* 7.3.2.60 20/40 BSS Coexistence element */ -#define ELEM_MAX_LEN_20_40_BSS_COEXIST (3 - ELEM_HDR_LEN) - -#define BSS_COEXIST_INFO_REQ BIT(0) -#define BSS_COEXIST_40M_INTOLERANT BIT(1) -#define BSS_COEXIST_20M_REQ BIT(2) -#define BSS_COEXIST_OBSS_SCAN_EXEMPTION_REQ BIT(3) -#define BSS_COEXIST_OBSS_SCAN_EXEMPTION_GRANT BIT(4) - - -//3 Management frame body components (III): 7.4 Action frame format details. -/* 7.4.1 Spectrum Measurement Action frame details */ -#define ACTION_MEASUREMENT_REQ 0 /* Spectrum measurement request */ -#define ACTION_MEASUREMENT_REPORT 1 /* Spectrum measurement report */ -#define ACTION_TPC_REQ 2 /* TPC request */ -#define ACTION_TPC_REPORT 3 /* TPC report */ -#define ACTION_CHNL_SWITCH 4 /* Channel Switch Announcement */ - -/* 7.4.2 QoS Action frame details */ -#define ACTION_ADDTS_REQ 0 /* ADDTS request */ -#define ACTION_ADDTS_RSP 1 /* ADDTS response */ -#define ACTION_DELTS 2 /* DELTS */ -#define ACTION_SCHEDULE 3 /* Schedule */ - -#define ACTION_ADDTS_REQ_FRAME_LEN (24+3+63) /* WMM TSPEC IE: 63 */ -#define ACTION_ADDTS_RSP_FRAME_LEN (24+4+63) /* WMM Status Code: 1; WMM TSPEC IE: 63*/ - -/* 7.4.3 DLS Action frame details */ -#define ACTION_DLS_REQ 0 /* DLS request */ -#define ACTION_DLS_RSP 1 /* DLS response */ -#define ACTION_DLS_TEARDOWN 2 /* DLS teardown */ - -/* 7.4.4 Block ack Action frame details */ -#define ACTION_ADDBA_REQ 0 /* ADDBA request */ -#define ACTION_ADDBA_RSP 1 /* ADDBA response */ -#define ACTION_DELBA 2 /* DELBA */ - -#define ACTION_ADDBA_REQ_FRAME_LEN (24+9) -#define ACTION_ADDBA_RSP_FRAME_LEN (24+9) - -#define ACTION_DELBA_INITIATOR_MASK BIT(11) -#define ACTION_DELBA_TID_MASK BITS(12,15) -#define ACTION_DELBA_TID_OFFSET 12 -#define ACTION_DELBA_FRAME_LEN (24+6) - -/* 7.4.6 Radio Measurement Action frame details */ -#define ACTION_RM_REQ 0 /* Radio measurement request */ -#define ACTION_RM_REPORT 1 /* Radio measurement report */ -#define ACTION_LM_REQ 2 /* Link measurement request */ -#define ACTION_LM_REPORT 3 /* Link measurement report */ -#define ACTION_NEIGHBOR_REPORT_REQ 4 /* Neighbor report request */ -#define ACTION_NEIGHBOR_REPORT_RSP 5 /* Neighbor report response */ - -/* 7.4.7 Public Action frame details */ -#define ACTION_PUBLIC_20_40_COEXIST 0 /* 20/40 BSS coexistence */ - -#if CFG_SUPPORT_802_11W -/* SA Query Action frame (IEEE 802.11w/D8.0, 7.4.9) */ -#define ACTION_SA_QUERY_REQUEST 0 -#define ACTION_SA_QUERY_RESPONSE 1 - -#define ACTION_SA_QUERY_TR_ID_LEN 2 - -/* Timeout Interval Type */ -#define ACTION_SA_TIMEOUT_REASSOC_DEADLINE 1 -#define ACTION_SA_TIMEOUT_KEY_LIFETIME 2 -#define ACTION_SA_TIMEOUT_ASSOC_COMEBACK 3 -#endif - -/* 7.4.10.1 HT action frame details */ -#define ACTION_HT_NOTIFY_CHANNEL_WIDTH 0 /* Notify Channel Width */ -#define ACTION_HT_SM_POWER_SAVE 1 /* SM Power Save */ -#define ACTION_HT_PSMP 2 /* PSMP */ -#define ACTION_HT_SET_PCO_PHASE 3 /* Set PCO Phase */ -#define ACTION_HT_CSI 4 /* CSI */ -#define ACTION_HT_NON_COMPRESSED_BEAMFORM 5 /* Non-compressed Beamforming */ -#define ACTION_HT_COMPRESSED_BEAMFORM 6 /* Compressed Beamforming */ -#define ACTION_HT_ANT_SEL_INDICES_FB 7 /* Antenna Selection Indices Feedback */ - -/* 802.11v Wireless Network Management */ -#define ACTION_WNM_TIMING_MEASUREMENT_REQUEST 27 - -#define ACTION_UNPROTECTED_WNM_TIM 0 -#define ACTION_UNPROTECTED_WNM_TIMING_MEASUREMENT 1 - -#define ACTION_UNPROTECTED_WNM_TIMING_MEAS_LEN 12 - -//3 /* --------------- WFA frame body fields --------------- */ -#define VENDOR_OUI_WFA { 0x00, 0x50, 0xF2 } -#define VENDOR_OUI_WFA_SPECIFIC { 0x50, 0x6F, 0x9A } -#define VENDOR_OUI_TYPE_WPA 1 -#define VENDOR_OUI_TYPE_WMM 2 -#define VENDOR_OUI_TYPE_WPS 4 -#define VENDOR_OUI_TYPE_P2P 9 - -#define VENDOR_OUI_TYPE_LEN 4 /* Length of OUI and Type */ - -/* VERSION(2 octets for WPA) / SUBTYPE(1 octet)-VERSION(1 octet) fields for WMM in WFA IE */ -#define VERSION_WPA 0x0001 /* Little Endian Format */ -#define VENDOR_OUI_SUBTYPE_VERSION_WMM_INFO 0x0100 -#define VENDOR_OUI_SUBTYPE_VERSION_WMM_PARAM 0x0101 - -/* SUBTYPE(1 octet) for WMM */ -#define VENDOR_OUI_SUBTYPE_WMM_INFO 0x00 /* WMM Spec version 1.1 */ -#define VENDOR_OUI_SUBTYPE_WMM_PARAM 0x01 -#define VENDOR_OUI_SUBTYPE_WMM_TSPEC 0x02 - -/* VERSION(1 octet) for WMM */ -#define VERSION_WMM 0x01 /* WMM Spec version 1.1 */ - -/* WMM-2.1.6 QoS Control Field */ -#define WMM_QC_UP_MASK BITS(0,2) -#define WMM_QC_EOSP BIT(4) -#define WMM_QC_ACK_POLICY_MASK BITS(5, 6) -#define WMM_QC_ACK_POLICY_OFFSET 5 -#define WMM_QC_ACK_POLICY_ACKNOWLEDGE 0 -#define WMM_QC_ACK_POLICY_NOT_ACKNOWLEDGE (1 << WMM_QC_ACK_POLICY_OFFSET) - - -/* WMM-2.2.1 WMM Information Element */ -#define ELEM_MIN_LEN_WFA_OUI_TYPE_SUBTYPE 6 - - -//3 Control frame body -/* 7.2.1.7 BlockAckReq */ -#define CTRL_BAR_BAR_CONTROL_OFFSET 16 -#define CTRL_BAR_BAR_INFORMATION_OFFSET 18 - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -#if defined(WINDOWS_DDK) || defined(WINDOWS_CE) -#pragma pack(1) -#endif - -typedef struct _LLC_SNAP_HEADER_T { - UINT_8 ucDSAP; - UINT_8 ucSSAP; - UINT_8 ucControl; - UINT_8 aucCode[3]; - UINT_16 u2Type; -} __KAL_ATTRIB_PACKED__ LLC_SNAP_HEADER_T, *P_LLC_SNAP_HEADER_T; - -//3 MAC Header. -/* Ethernet Frame Header */ -typedef struct _ETH_FRAME_HEADER_T { - UINT_8 aucDestAddr[MAC_ADDR_LEN]; - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; - UINT_16 u2TypeLen; -} __KAL_ATTRIB_PACKED__ ETH_FRAME_HEADER_T, *P_ETH_FRAME_HEADER_T; - -/* Ethernet Frame Structure */ -typedef struct _ETH_FRAME_T { - UINT_8 aucDestAddr[MAC_ADDR_LEN]; - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; - UINT_16 u2TypeLen; - UINT_8 aucData[1]; -} __KAL_ATTRIB_PACKED__ ETH_FRAME_T, *P_ETH_FRAME_T; - - -/* IEEE 802.11 WLAN Frame Structure */ -/* WLAN MAC Header (without Address 4 and QoS Control fields) */ -typedef struct _WLAN_MAC_HEADER_T { - UINT_16 u2FrameCtrl; - UINT_16 u2DurationID; - UINT_8 aucAddr1[MAC_ADDR_LEN]; - UINT_8 aucAddr2[MAC_ADDR_LEN]; - UINT_8 aucAddr3[MAC_ADDR_LEN]; - UINT_16 u2SeqCtrl; -} __KAL_ATTRIB_PACKED__ WLAN_MAC_HEADER_T, *P_WLAN_MAC_HEADER_T; - - -/* WLAN MAC Header (QoS Control fields included) */ -typedef struct _WLAN_MAC_HEADER_QOS_T { - UINT_16 u2FrameCtrl; - UINT_16 u2DurationID; - UINT_8 aucAddr1[MAC_ADDR_LEN]; - UINT_8 aucAddr2[MAC_ADDR_LEN]; - UINT_8 aucAddr3[MAC_ADDR_LEN]; - UINT_16 u2SeqCtrl; - UINT_16 u2QosCtrl; -} __KAL_ATTRIB_PACKED__ WLAN_MAC_HEADER_QOS_T, *P_WLAN_MAC_HEADER_QOS_T; - - -/* WLAN MAC Header (HT Control fields included) */ -typedef struct _WLAN_MAC_HEADER_HT_T { - UINT_16 u2FrameCtrl; - UINT_16 u2DurationID; - UINT_8 aucAddr1[MAC_ADDR_LEN]; - UINT_8 aucAddr2[MAC_ADDR_LEN]; - UINT_8 aucAddr3[MAC_ADDR_LEN]; - UINT_16 u2SeqCtrl; - UINT_16 u2QosCtrl; - UINT_32 u4HtCtrl; -} __KAL_ATTRIB_PACKED__ WLAN_MAC_HEADER_HT_T, *P_WLAN_MAC_HEADER_HT_T; - - -/* WLAN MAC Header (Address 4 included) */ -typedef struct _WLAN_MAC_HEADER_A4_T { - UINT_16 u2FrameCtrl; - UINT_16 u2DurationID; - UINT_8 aucAddr1[MAC_ADDR_LEN]; - UINT_8 aucAddr2[MAC_ADDR_LEN]; - UINT_8 aucAddr3[MAC_ADDR_LEN]; - UINT_16 u2SeqCtrl; - UINT_8 aucAddr4[MAC_ADDR_LEN]; -} __KAL_ATTRIB_PACKED__ WLAN_MAC_HEADER_A4_T, *P_WLAN_MAC_HEADER_A4_T; - - -/* WLAN MAC Header (Address 4 and QoS Control fields included) */ -typedef struct _WLAN_MAC_HEADER_A4_QOS_T { - UINT_16 u2FrameCtrl; - UINT_16 u2DurationID; - UINT_8 aucAddr1[MAC_ADDR_LEN]; - UINT_8 aucAddr2[MAC_ADDR_LEN]; - UINT_8 aucAddr3[MAC_ADDR_LEN]; - UINT_16 u2SeqCtrl; - UINT_8 aucAddr4[MAC_ADDR_LEN]; - UINT_16 u2QosCtrl; -} __KAL_ATTRIB_PACKED__ WLAN_MAC_HEADER_A4_QOS_T, *P_WLAN_MAC_HEADER_A4_QOS_T; - - -typedef struct _WLAN_MAC_HEADER_A4_HT_T { - UINT_16 u2FrameCtrl; - UINT_16 u2DurationID; - UINT_8 aucAddr1[MAC_ADDR_LEN]; - UINT_8 aucAddr2[MAC_ADDR_LEN]; - UINT_8 aucAddr3[MAC_ADDR_LEN]; - UINT_16 u2SeqCtrl; - UINT_8 aucAddr4[MAC_ADDR_LEN]; - UINT_16 u2QosCtrl; - UINT_32 u4HtCtrl; -} __KAL_ATTRIB_PACKED__ WLAN_MAC_HEADER_A4_HT_T, *P_WLAN_MAC_HEADER_A4_HT_T; - - -/* 7.2.3 WLAN MAC Header for Management Frame - MMPDU */ -typedef struct _WLAN_MAC_MGMT_HEADER_T { - UINT_16 u2FrameCtrl; - UINT_16 u2Duration; - UINT_8 aucDestAddr[MAC_ADDR_LEN]; - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; - UINT_8 aucBSSID[MAC_ADDR_LEN]; - UINT_16 u2SeqCtrl; -} __KAL_ATTRIB_PACKED__ WLAN_MAC_MGMT_HEADER_T, *P_WLAN_MAC_MGMT_HEADER_T; - - -/* WLAN MAC Header for Management Frame (HT Control fields included) */ -typedef struct _WLAN_MAC_MGMT_HEADER_HT_T { - UINT_16 u2FrameCtrl; - UINT_16 u2DurationID; - UINT_8 aucAddr1[MAC_ADDR_LEN]; - UINT_8 aucAddr2[MAC_ADDR_LEN]; - UINT_8 aucAddr3[MAC_ADDR_LEN]; - UINT_16 u2SeqCtrl; - UINT_32 u4HtCtrl; -} __KAL_ATTRIB_PACKED__ WLAN_MAC_MGMT_HEADER_HT_T, *P_WLAN_MAC_MGMT_HEADER_HT_T; - -//3 WLAN CONTROL Frame -/* 7.2.1.4 WLAN Control Frame - PS-POLL Frame */ -typedef struct _CTRL_PSPOLL_FRAME_T { - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2AID; /* AID */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_8 aucTA[MAC_ADDR_LEN]; /* TA */ -} __KAL_ATTRIB_PACKED__ CTRL_PSPOLL_FRAME_T, *P_CTRL_PSPOLL_FRAME_T; - - -/* BAR */ -typedef struct _CTRL_BAR_FRAME_T { - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2DurationID; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* RA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* TA */ - UINT_16 u2BarControl; - UINT_8 aucBarInfo[2]; /* Variable size */ -} __KAL_ATTRIB_PACKED__ CTRL_BAR_FRAME_T, *P_CTRL_BAR_FRAME_T; - -//3 WLAN Management Frame. -/* 7.2.3.1 WLAN Management Frame - Beacon Frame */ -typedef struct _WLAN_BEACON_FRAME_T { - /* Beacon header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2DurationID; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Beacon frame body */ - UINT_32 au4Timestamp[2]; /* Timestamp */ - UINT_16 u2BeaconInterval; /* Beacon Interval */ - UINT_16 u2CapInfo; /* Capability */ - UINT_8 aucInfoElem[1]; /* Various IEs, start from SSID */ -} __KAL_ATTRIB_PACKED__ WLAN_BEACON_FRAME_T, *P_WLAN_BEACON_FRAME_T; - -typedef struct _WLAN_BEACON_FRAME_BODY_T { - /* Beacon frame body */ - UINT_32 au4Timestamp[2]; /* Timestamp */ - UINT_16 u2BeaconInterval; /* Beacon Interval */ - UINT_16 u2CapInfo; /* Capability */ - UINT_8 aucInfoElem[1]; /* Various IEs, start from SSID */ -} __KAL_ATTRIB_PACKED__ WLAN_BEACON_FRAME_BODY_T, *P_WLAN_BEACON_FRAME_BODY_T; - - -/* 7.2.3.3 WLAN Management Frame - Disassociation Frame */ -typedef struct _WLAN_DISASSOC_FRAME_T { - /* Authentication MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2DurationID; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Disassociation frame body */ - UINT_16 u2ReasonCode; /* Reason code */ - UINT_8 aucInfoElem[1]; /* Various IEs, possible no. */ -} __KAL_ATTRIB_PACKED__ WLAN_DISASSOC_FRAME_T, *P_WLAN_DISASSOC_FRAME_T; - - -/* 7.2.3.4 WLAN Management Frame - Association Request frame */ -typedef struct _WLAN_ASSOC_REQ_FRAME_T { - /* Association Request MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2DurationID; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Association Request frame body */ - UINT_16 u2CapInfo; /* Capability information */ - UINT_16 u2ListenInterval; /* Listen interval */ - UINT_8 aucInfoElem[1]; /* Information elements, include WPA IE */ -} __KAL_ATTRIB_PACKED__ WLAN_ASSOC_REQ_FRAME_T, *P_WLAN_ASSOC_REQ_FRAME_T; - - -/* 7.2.3.5 WLAN Management Frame - Association Response frame */ -typedef struct _WLAN_ASSOC_RSP_FRAME_T { - /* Association Response MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2DurationID; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Association Response frame body */ - UINT_16 u2CapInfo; /* Capability information */ - UINT_16 u2StatusCode; /* Status code */ - UINT_16 u2AssocId; /* Association ID */ - UINT_8 aucInfoElem[1]; /* Information elements, such as - supported rates, and etc. */ -} __KAL_ATTRIB_PACKED__ WLAN_ASSOC_RSP_FRAME_T, *P_WLAN_ASSOC_RSP_FRAME_T; - - -/* 7.2.3.6 WLAN Management Frame - Reassociation Request frame */ -typedef struct _WLAN_REASSOC_REQ_FRAME_T { - /* Reassociation Request MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2DurationID; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Reassociation Request frame body */ - UINT_16 u2CapInfo; /* Capability information */ - UINT_16 u2ListenInterval; /* Listen interval */ - UINT_8 aucCurrentAPAddr[MAC_ADDR_LEN]; /* Current AP address */ - UINT_8 aucInfoElem[1]; /* Information elements, include WPA IE */ -} __KAL_ATTRIB_PACKED__ WLAN_REASSOC_REQ_FRAME_T, *P_WLAN_REASSOC_REQ_FRAME_T; - - -/* 7.2.3.7 WLAN Management Frame - Reassociation Response frame - (the same as Association Response frame) */ -typedef WLAN_ASSOC_RSP_FRAME_T WLAN_REASSOC_RSP_FRAME_T, *P_WLAN_REASSOC_RSP_FRAME_T; - -/* 7.2.3.9 WLAN Management Frame - Probe Response Frame */ -typedef WLAN_BEACON_FRAME_T WLAN_PROBE_RSP_FRAME_T, *P_WLAN_PROBE_RSP_FRAME_T; - -/* 7.2.3.10 WLAN Management Frame - Authentication Frame */ -typedef struct _WLAN_AUTH_FRAME_T { - /* Authentication MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2DurationID; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Authentication frame body */ - UINT_16 u2AuthAlgNum; /* Authentication algorithm number */ - UINT_16 u2AuthTransSeqNo; /* Authentication transaction sequence number */ - UINT_16 u2StatusCode; /* Status code */ - UINT_8 aucInfoElem[1]; /* Various IEs for Fast BSS Transition */ -} __KAL_ATTRIB_PACKED__ WLAN_AUTH_FRAME_T, *P_WLAN_AUTH_FRAME_T; - - -/* 7.2.3.11 WLAN Management Frame - Deauthentication Frame */ -typedef struct _WLAN_DEAUTH_FRAME_T { - /* Authentication MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2DurationID; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Deauthentication frame body */ - UINT_16 u2ReasonCode; /* Reason code */ - UINT_8 aucInfoElem[1]; /* Various IEs, possible no. */ -} __KAL_ATTRIB_PACKED__ WLAN_DEAUTH_FRAME_T, *P_WLAN_DEAUTH_FRAME_T; - - - -//3 Information Elements. -/* 7.3.2 Generic element format */ -typedef struct _IE_HDR_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 aucInfo[1]; -} __KAL_ATTRIB_PACKED__ IE_HDR_T, *P_IE_HDR_T; - -/* 7.3.2.1 SSID element */ -typedef struct _IE_SSID_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 aucSSID[ELEM_MAX_LEN_SSID]; -} __KAL_ATTRIB_PACKED__ IE_SSID_T, *P_IE_SSID_T; - -/* 7.3.2.2 Supported Rates element */ -typedef struct _IE_SUPPORTED_RATE_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 aucSupportedRates[ELEM_MAX_LEN_SUP_RATES]; -} __KAL_ATTRIB_PACKED__ IE_SUPPORTED_RATE_T, *P_IE_SUPPORTED_RATE_T; - -/* 7.3.2.4 DS Parameter Set element */ -typedef struct _IE_DS_PARAM_SET_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 ucCurrChnl; -} __KAL_ATTRIB_PACKED__ IE_DS_PARAM_SET_T, *P_IE_DS_PARAM_SET_T; - - -/* 7.3.2.5 CF Parameter Set element */ -typedef struct _IE_CF_PARAM_SET_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 ucCFPCount; - UINT_8 ucCFPPeriod; - UINT_16 u2CFPMaxDur; - UINT_16 u2DurRemaining; -} __KAL_ATTRIB_PACKED__ IE_CF_PARAM_SET_T, *P_IE_CF_PARAM_SET_T; - - -/* 7.3.2.6 TIM */ -typedef struct _IE_TIM_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 ucDTIMCount; - UINT_8 ucDTIMPeriod; - UINT_8 ucBitmapControl; - UINT_8 aucPartialVirtualMap[1]; -} __KAL_ATTRIB_PACKED__ IE_TIM_T, *P_IE_TIM_T; - -/* 7.3.2.7 IBSS Parameter Set element */ -typedef struct _IE_IBSS_PARAM_SET_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_16 u2ATIMWindow; -} __KAL_ATTRIB_PACKED__ IE_IBSS_PARAM_SET_T, *P_IE_IBSS_PARAM_SET_T; - -/* 7.3.2.8 Challenge Text element */ -typedef struct _IE_CHALLENGE_TEXT_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 aucChallengeText[ELEM_MAX_LEN_CHALLENGE_TEXT]; -} __KAL_ATTRIB_PACKED__ IE_CHALLENGE_TEXT_T, *P_IE_CHALLENGE_TEXT_T; - -/* 7.3.2.9 Country information element */ -#if CFG_SUPPORT_802_11D -/*! \brief COUNTRY_INFO_TRIPLET is defined for the COUNTRY_INFO_ELEM structure. */ -typedef struct _COUNTRY_INFO_TRIPLET_T { - UINT_8 ucParam1; /*!< If param1 >= 201, this triplet is referred to as - Regulatory Triplet in 802_11J. */ - UINT_8 ucParam2; - UINT_8 ucParam3; -} __KAL_ATTRIB_PACKED__ COUNTRY_INFO_TRIPLET_T, *P_COUNTRY_INFO_TRIPLET_T; - -typedef struct _COUNTRY_INFO_SUBBAND_TRIPLET_T { - UINT_8 ucFirstChnlNum; /*!< First Channel Number */ - UINT_8 ucNumOfChnl; /*!< Number of Channels */ - INT_8 cMaxTxPwrLv; /*!< Maximum Transmit Power Level */ -} __KAL_ATTRIB_PACKED__ COUNTRY_INFO_SUBBAND_TRIPLET_T, *P_COUNTRY_INFO_SUBBAND_TRIPLET_T; - -typedef struct _COUNTRY_INFO_REGULATORY_TRIPLET_T { - UINT_8 ucRegExtId; /*!< Regulatory Extension Identifier, should - be greater than or equal to 201 */ - UINT_8 ucRegClass; /*!< Regulatory Class */ - UINT_8 ucCoverageClass; /*!< Coverage Class, unsigned 1-octet value 0~31 - , 32~255 reserved */ -} __KAL_ATTRIB_PACKED__ COUNTRY_INFO_REGULATORY_TRIPLET_T, *P_COUNTRY_INFO_REGULATORY_TRIPLET_T; - -typedef struct _IE_COUNTRY_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 aucCountryStr[3]; - COUNTRY_INFO_SUBBAND_TRIPLET_T arCountryStr[1]; -} __KAL_ATTRIB_PACKED__ IE_COUNTRY_T, *P_IE_COUNTRY_T; -#endif /* CFG_SUPPORT_802_11D */ - -/* 7.3.2.13 ERP element */ -typedef struct _IE_ERP_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 ucERP; -} __KAL_ATTRIB_PACKED__ IE_ERP_T, *P_IE_ERP_T; - -/* 7.3.2.14 Extended Supported Rates element */ -typedef struct _IE_EXT_SUPPORTED_RATE_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 aucExtSupportedRates[ELEM_MAX_LEN_EXTENDED_SUP_RATES]; -} __KAL_ATTRIB_PACKED__ IE_EXT_SUPPORTED_RATE_T, *P_IE_EXT_SUPPORTED_RATE_T; - -/* 7.3.2.15 Power Constraint element */ -typedef struct _IE_POWER_CONSTRAINT_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 ucLocalPowerConstraint; /* Unit: dBm */ -} __KAL_ATTRIB_PACKED__ IE_POWER_CONSTRAINT_T, *P_IE_POWER_CONSTRAINT_T; - -/* 7.3.2.16 Power Capability element */ -typedef struct _IE_POWER_CAP_T { - UINT_8 ucId; - UINT_8 ucLength; - INT_8 cMinTxPowerCap; /* Unit: dBm */ - INT_8 cMaxTxPowerCap; /* Unit: dBm */ -} __KAL_ATTRIB_PACKED__ IE_POWER_CAP_T, *P_IE_POWER_CAP_T; - -/* 7.3.2.17 TPC request element */ -typedef struct _IE_TPC_REQ_T { - UINT_8 ucId; - UINT_8 ucLength; -} __KAL_ATTRIB_PACKED__ IE_TPC_REQ_T, *P_IE_TPC_REQ_T; - -/* 7.3.2.18 TPC report element */ -typedef struct _IE_TPC_REPORT_T { - UINT_8 ucId; - UINT_8 ucLength; - INT_8 cTxPower; /* Unit: dBm */ - INT_8 cLinkMargin; /* Unit: dB */ -} __KAL_ATTRIB_PACKED__ IE_TPC_REPORT_T, *P_IE_TPC_REPORT_T; - -/* 7.3.2.20 Channel Switch Announcement element */ -typedef struct _IE_CHNL_SWITCH_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 ucSwitchMode; - UINT_8 ucNewChannel; - UINT_8 ucSwitchCount; -} __KAL_ATTRIB_PACKED__ IE_CHNL_SWITCH_T, *P_IE_CHNL_SWITCH_T; - -/* 7.3.2.21 Measurement Request element */ -typedef struct _IE_MEASUREMENT_REQ_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 ucToken; - UINT_8 ucRequestMode; - UINT_8 ucMeasurementType; - UINT_8 aucRequestFields[1]; -} __KAL_ATTRIB_PACKED__ IE_MEASUREMENT_REQ_T, *P_IE_MEASUREMENT_REQ_T; - -typedef struct _SM_BASIC_REQ_T { - UINT_8 ucChannel; - UINT_32 au4StartTime[2]; - UINT_16 u2Duration; -} __KAL_ATTRIB_PACKED__ SM_BASIC_REQ_T, *P_SM_BASIC_REQ_T; - -/* SM_COMMON_REQ_T is not specified in Spec. Use it as common structure of SM */ -typedef SM_BASIC_REQ_T SM_REQ_COMMON_T, *P_SM_REQ_COMMON_T; -typedef SM_BASIC_REQ_T SM_CCA_REQ_T, *P_SM_CCA_REQ_T; -typedef SM_BASIC_REQ_T SM_RPI_HISTOGRAM_REQ_T, *P_SM_RPI_HISTOGRAM_REQ_T; - -typedef struct _RM_CHNL_LOAD_REQ_T { - UINT_8 ucRegulatoryClass; - UINT_8 ucChannel; - UINT_16 u2RandomInterval; - UINT_16 u2Duration; - UINT_8 aucSubElements[1]; -} __KAL_ATTRIB_PACKED__ RM_CHNL_LOAD_REQ_T, *P_RM_CHNL_LOAD_REQ_T; - -typedef RM_CHNL_LOAD_REQ_T \ - RM_NOISE_HISTOGRAM_REQ_T, *P_RM_NOISE_HISTOGRAM_REQ_T; - -typedef struct _RM_BCN_REQ_T { - UINT_8 ucRegulatoryClass; - UINT_8 ucChannel; - UINT_16 u2RandomInterval; - UINT_16 u2Duration; - UINT_8 ucMeasurementMode; - UINT_8 aucBssid[6]; - UINT_8 aucSubElements[1]; -} __KAL_ATTRIB_PACKED__ RM_BCN_REQ_T, *P_RM_BCN_REQ_T; - -typedef struct _RM_FRAME_REQ_T { - UINT_8 ucRegulatoryClass; - UINT_8 ucChannel; - UINT_16 u2RandomInterval; - UINT_16 u2Duration; - UINT_8 ucFrameReqType; - UINT_8 aucMacAddr[6]; - UINT_8 aucSubElements[1]; -} __KAL_ATTRIB_PACKED__ RM_FRAME_REQ_T, *P_RM_FRAME_REQ_T; - -typedef struct _RM_STA_STATS_REQ_T { - UINT_8 aucPeerMacAddr[6]; - UINT_16 u2RandomInterval; - UINT_16 u2Duration; - UINT_8 ucGroupID; - UINT_8 aucSubElements[1]; -} __KAL_ATTRIB_PACKED__ RM_STA_STATS_REQ_T, *P_RM_STA_STATS_REQ_T; - -typedef struct _RM_LCI_REQ_T { - UINT_8 ucLocationSubject; - UINT_8 ucLatitudeResolution; - UINT_8 ucLongitudeResolution; - UINT_8 ucAltitudeResolution; - UINT_8 aucSubElements[1]; -} __KAL_ATTRIB_PACKED__ RM_LCI_REQ_T, *P_RM_LCI_REQ_T; - -typedef struct _RM_TS_MEASURE_REQ_T { - UINT_16 u2RandomInterval; - UINT_16 u2Duration; - UINT_8 aucPeerStaAddr[6]; - UINT_8 ucTrafficID; - UINT_8 ucBin0Range; - UINT_8 aucSubElements[1]; -} __KAL_ATTRIB_PACKED__ RM_TS_MEASURE_REQ_T, *P_RM_TS_MEASURE_REQ_T; - -typedef struct _RM_MEASURE_PAUSE_REQ_T { - UINT_16 u2PauseTime; - UINT_8 aucSubElements[1]; -} __KAL_ATTRIB_PACKED__ RM_MEASURE_PAUSE_REQ_T, *P_RM_MEASURE_PAUSE_REQ_T; - -/* 7.3.2.22 Measurement Report element */ -typedef struct _IE_MEASUREMENT_REPORT_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 ucToken; - UINT_8 ucReportMode; - UINT_8 ucMeasurementType; - UINT_8 aucReportFields[1]; -} __KAL_ATTRIB_PACKED__ IE_MEASUREMENT_REPORT_T, *P_IE_MEASUREMENT_REPORT_T; - -typedef struct _SM_BASIC_REPORT_T { - UINT_8 ucChannel; - UINT_32 u4StartTime[2]; - UINT_16 u2Duration; - UINT_8 ucMap; -} __KAL_ATTRIB_PACKED__ SM_BASIC_REPORT_T, *P_SM_BASIC_REPORT_T; - -typedef struct _SM_CCA_REPORT_T { - UINT_8 ucChannel; - UINT_32 u4StartTime[2]; - UINT_16 u2Duration; - UINT_8 ucCcaBusyFraction; -} __KAL_ATTRIB_PACKED__ SM_CCA_REPORT_T, *P_SM_CCA_REPORT_T; - -typedef struct _SM_RPI_REPORT_T { - UINT_8 ucChannel; - UINT_32 u4StartTime[2]; - UINT_16 u2Duration; - UINT_8 aucRPI[8]; -} __KAL_ATTRIB_PACKED__ SM_RPI_REPORT_T, *P_SM_RPI_REPORT_T; - -typedef struct _RM_CHNL_LOAD_REPORT_T { - UINT_8 ucRegulatoryClass; - UINT_8 ucChannel; - UINT_32 u4StartTime[2]; - UINT_16 u2Duration; - UINT_8 ucChnlLoad; -} __KAL_ATTRIB_PACKED__ RM_CHNL_LOAD_REPORT_T, *P_RM_CHNL_LOAD_REPORT_T; - -typedef struct _RM_IPI_REPORT_T { - UINT_8 ucRegulatoryClass; - UINT_8 ucChannel; - UINT_32 u4StartTime[2]; - UINT_16 u2Duration; - UINT_8 ucAntennaId; - INT_8 cANPI; - UINT_8 aucIPI[11]; -} __KAL_ATTRIB_PACKED__ RM_IPI_REPORT_T, *P_RM_IPI_REPORT_T; - -/* 7.3.2.23 Quiet element */ -typedef struct _IE_QUIET_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 ucCount; - UINT_8 ucPeriod; - UINT_16 u2Duration; - UINT_16 u2Offset; -} __KAL_ATTRIB_PACKED__ IE_QUIET_T, *P_IE_QUIET_T; - -/* 7.3.2.27 Extended Capabilities element */ -typedef struct _IE_EXT_CAP_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 aucCapabilities[1]; -} __KAL_ATTRIB_PACKED__ IE_EXT_CAP_T, *P_EXT_CAP_T; - -/* 7.3.2.27 Extended Capabilities element */ -typedef struct _IE_RRM_ENABLED_CAP_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 aucCap[5]; -} __KAL_ATTRIB_PACKED__ IE_RRM_ENABLED_CAP_T, *P_IE_RRM_ENABLED_CAP_T; - -/* 7.3.2.56 HT Capabilities element */ -typedef struct _SUP_MCS_SET_FIELD { - UINT_8 aucRxMcsBitmask[SUP_MCS_RX_BITMASK_OCTET_NUM]; - UINT_16 u2RxHighestSupportedRate; - UINT_32 u4TxRateInfo; -} __KAL_ATTRIB_PACKED__ SUP_MCS_SET_FIELD, *P_SUP_MCS_SET_FIELD; - -typedef struct _IE_HT_CAP_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_16 u2HtCapInfo; - UINT_8 ucAmpduParam; - SUP_MCS_SET_FIELD rSupMcsSet; - UINT_16 u2HtExtendedCap; - UINT_32 u4TxBeamformingCap; - UINT_8 ucAselCap; -} __KAL_ATTRIB_PACKED__ IE_HT_CAP_T, *P_IE_HT_CAP_T; - -/* 7.3.2.57 HT Operation element */ -typedef struct _IE_HT_OP_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 ucPrimaryChannel; - UINT_8 ucInfo1; - UINT_16 u2Info2; - UINT_16 u2Info3; - UINT_8 aucBasicMcsSet[16]; -} __KAL_ATTRIB_PACKED__ IE_HT_OP_T, *P_IE_HT_OP_T; - -/* 7.3.2.25 RSN Information element format */ -typedef struct _RSN_INFO_ELEM_T { - UCHAR ucElemId; - UCHAR ucLength; - UINT_16 u2Version; - UINT_32 u4GroupKeyCipherSuite; - UINT_16 u2PairwiseKeyCipherSuiteCount; - UCHAR aucPairwiseKeyCipherSuite1[4]; -} __KAL_ATTRIB_PACKED__ RSN_INFO_ELEM_T, *P_RSN_INFO_ELEM_T; - -/* 7.3.2.26 WPA Information element format */ -typedef struct _WPA_INFO_ELEM_T { - UCHAR ucElemId; - UCHAR ucLength; - UCHAR aucOui[3]; - UCHAR ucOuiType; - UINT_16 u2Version; - UINT_32 u4GroupKeyCipherSuite; - UINT_16 u2PairwiseKeyCipherSuiteCount; - UCHAR aucPairwiseKeyCipherSuite1[4]; -} __KAL_ATTRIB_PACKED__ WPA_INFO_ELEM_T, *P_WPA_INFO_ELEM_T; - -/* 7.3.2.58 20/40 BSS Intolerant Channel Report element */ -typedef struct _IE_INTOLERANT_CHNL_REPORT_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 ucRegulatoryClass; - UINT_8 aucChannelList[1]; -} __KAL_ATTRIB_PACKED__ IE_INTOLERANT_CHNL_REPORT_T, *P_IE_INTOLERANT_CHNL_REPORT_T; - -/* 7.3.2.59 OBSS Scan Parameters element */ -typedef struct _IE_OBSS_SCAN_PARAM_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_16 u2ScanPassiveDwell; - UINT_16 u2ScanActiveDwell; - UINT_16 u2TriggerScanInterval; - UINT_16 u2ScanPassiveTotalPerChnl; - UINT_16 u2ScanActiveTotalPerChnl; - UINT_16 u2WidthTransDelayFactor; - UINT_16 u2ScanActivityThres; -} __KAL_ATTRIB_PACKED__ IE_OBSS_SCAN_PARAM_T, *P_IE_OBSS_SCAN_PARAM_T; - -/* 7.3.2.60 20/40 BSS Coexistence element */ -typedef struct _IE_20_40_COEXIST_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 ucData; -} __KAL_ATTRIB_PACKED__ IE_20_40_COEXIST_T, *P_IE_20_40_COEXIST_T; - - -//3 7.4 Action Frame. -/* 7.4 Action frame format */ -typedef struct _WLAN_ACTION_FRAME { - /* Action MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2DurationID; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Action frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - UINT_8 ucActionDetails[1]; /* Action details */ -} __KAL_ATTRIB_PACKED__ WLAN_ACTION_FRAME, *P_WLAN_ACTION_FRAME; - -/* 7.4.1.1 Spectrum Measurement Request frame format */ -typedef struct _ACTION_SM_REQ_FRAME { - /* ADDTS Request MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* ADDTS Request frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - UINT_8 ucDialogToken; /* Dialog Token */ - UINT_8 aucInfoElem[1]; /* Information elements */ -} __KAL_ATTRIB_PACKED__ ACTION_SM_REQ_FRAME, *P_ACTION_SM_REQ_FRAME; - -/* 7.4.1.2 Spectrum Measurement Report frame format */ -typedef ACTION_SM_REQ_FRAME ACTION_SM_REPORT_FRAME, *P_ACTION_SM_REPORT_FRAME; - -/* 7.4.2.1 ADDTS Request frame format */ -typedef struct _ACTION_ADDTS_REQ_FRAME { - /* ADDTS Request MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* ADDTS Request frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - UINT_8 ucDialogToken; /* Dialog Token */ - UINT_8 aucInfoElem[1]; /* Information elements, such as - TS Delay, and etc. */ -} __KAL_ATTRIB_PACKED__ ACTION_ADDTS_REQ_FRAME, *P_ACTION_ADDTS_REQ_FRAME; - - -/* 7.4.2.2 ADDTS Response frame format */ -typedef struct _ACTION_ADDTS_RSP_FRAME { - /* ADDTS Response MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* ADDTS Response frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - UINT_8 ucDialogToken; /* Dialog Token */ - UINT_8 ucStatusCode; /* WMM Status Code is of one byte */ - UINT_8 aucInfoElem[1]; /* Information elements, such as - TS Delay, and etc. */ -} __KAL_ATTRIB_PACKED__ ACTION_ADDTS_RSP_FRAME, *P_ACTION_ADDTS_RSP_FRAME; - - -/* 7.4.2.3 DELTS frame format */ -typedef struct _ACTION_DELTS_FRAME { - /* DELTS MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2DurationID; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* DELTS frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - UINT_8 aucTsInfo[3]; /* TS Info */ -} __KAL_ATTRIB_PACKED__ ACTION_DELTS_FRAME, *P_ACTION_DELTS_FRAME; - - -/* 7.4.4.1 ADDBA Request frame format */ -typedef struct _ACTION_ADDBA_REQ_FRAME_T { - /* Action MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2DurationID; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Action frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - UINT_8 ucDialogToken; /* Dialog Token chosen by the sender */ - UINT_8 aucBAParameterSet[2]; /* BA policy, TID, buffer size */ - UINT_8 aucBATimeoutValue[2]; - UINT_8 aucBAStartSeqCtrl[2]; /* SSN */ -} __KAL_ATTRIB_PACKED__ ACTION_ADDBA_REQ_FRAME_T, *P_ACTION_ADDBA_REQ_FRAME_T; - -typedef struct _ACTION_ADDBA_REQ_BODY_T{ - UINT_16 u2BAParameterSet; /* BA policy, TID, buffer size */ - UINT_16 u2BATimeoutValue; - UINT_16 u2BAStartSeqCtrl; /* SSN */ -} __KAL_ATTRIB_PACKED__ ACTION_ADDBA_REQ_BODY_T, *P_ACTION_ADDBA_REQ_BODY_T; - -/* 7.4.4.2 ADDBA Response frame format */ -typedef struct _ACTION_ADDBA_RSP_FRAME_T { - /* Action MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2DurationID; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Action frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - UINT_8 ucDialogToken; /* Dialog Token chosen by the sender */ - UINT_8 aucStatusCode[2]; - UINT_8 aucBAParameterSet[2]; /* BA policy, TID, buffer size */ - UINT_8 aucBATimeoutValue[2]; -} __KAL_ATTRIB_PACKED__ ACTION_ADDBA_RSP_FRAME_T, *P_ACTION_ADDBA_RSP_FRAME_T; - -typedef struct _ACTION_ADDBA_RSP_BODY_T { - UINT_16 u2StatusCode; - UINT_16 u2BAParameterSet; /* BA policy, TID, buffer size */ - UINT_16 u2BATimeoutValue; -} __KAL_ATTRIB_PACKED__ ACTION_ADDBA_RSP_BODY_T, *P_ACTION_ADDBA_RSP_BODY_T; - -/* 7.4.4.3 DELBA frame format */ -typedef struct _ACTION_DELBA_FRAME_T { - /* Action MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2DurationID; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Action frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - UINT_16 u2DelBaParameterSet; /* Bit 11 Initiator, Bits 12-15 TID */ - UINT_16 u2ReasonCode; /* 7.3.1.7 */ -} __KAL_ATTRIB_PACKED__ ACTION_DELBA_FRAME_T, *P_ACTION_DELBA_FRAME_T; - -/* 7.4.6.1 Radio Measurement Request frame format */ -typedef struct _ACTION_RM_REQ_FRAME { - /* MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Radio Measurement Request frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - UINT_8 ucDialogToken; /* Dialog Token */ - UINT_16 u2Repetitions; /* Number of repetitions */ - UINT_8 aucInfoElem[1]; /* Measurement Request elements, such as - channel load request, and etc. */ -} __KAL_ATTRIB_PACKED__ ACTION_RM_REQ_FRAME, *P_ACTION_RM_REQ_FRAME; - -/* 7.4.6.2 Radio Measurement Report frame format */ -typedef struct _ACTION_RM_REPORT_FRAME { - /* MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Radio Measurement Report frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - UINT_8 ucDialogToken; /* Dialog Token */ - UINT_8 aucInfoElem[1]; /* Measurement Report elements, such as - channel load report, and etc. */ -} __KAL_ATTRIB_PACKED__ ACTION_RM_REPORT_FRAME, *P_ACTION_RM_REPORT_FRAME; - -/* 7.4.7.1a 20/40 BSS Coexistence Management frame format */ -typedef struct _ACTION_20_40_COEXIST_FRAME { - /* MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* BSS Coexistence Management frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - - IE_20_40_COEXIST_T rBssCoexist;/* 20/40 BSS coexistence element */ - IE_INTOLERANT_CHNL_REPORT_T rChnlReport;/* Intolerant channel report */ - -} __KAL_ATTRIB_PACKED__ ACTION_20_40_COEXIST_FRAME, *P_ACTION_20_40_COEXIST_FRAME; - - -#if CFG_SUPPORT_802_11W -/* 7.4.9 SA Query Management frame format */ -typedef struct _ACTION_SA_QUERY_FRAME { - /* MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* BSS Coexistence Management frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - - UINT_8 ucTransId[ACTION_SA_QUERY_TR_ID_LEN]; /* Transaction id */ - -} __KAL_ATTRIB_PACKED__ ACTION_SA_QUERY_FRAME, *P_ACTION_SA_QUERY_FRAME; -#endif - -/* 7.4.10 Notify Channel Width Management frame format */ -typedef struct _ACTION_NOTIFY_CHNL_WIDTH_FRAME { - /* MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* BSS Coexistence Management frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - UINT_8 ucChannelWidth; /* Channel Width */ -} __KAL_ATTRIB_PACKED__ ACTION_NOTIFY_CHNL_WIDTH_FRAME, *P_ACTION_NOTIFY_CHNL_WIDTH_FRAME; - -/* 802.11v Wireless Network Management: Timing Measurement Request */ -typedef struct _ACTION_WNM_TIMING_MEAS_REQ_FRAME { - /* MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Timing Measurement Request Management frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - UINT_8 ucTrigger; /* Trigger */ -} __KAL_ATTRIB_PACKED__ ACTION_WNM_TIMING_MEAS_REQ_FRAME, *P_ACTION_WNM_TIMING_MEAS_REQ_FRAME; - -/* 802.11v Wireless Network Management: Timing Measurement */ -typedef struct _ACTION_UNPROTECTED_WNM_TIMING_MEAS_FRAME { - /* MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* Timing Measurement Management frame body */ - UINT_8 ucCategory; /* Category */ - UINT_8 ucAction; /* Action Value */ - UINT_8 ucDialogToken; /* Dialog Token */ - UINT_8 ucFollowUpDialogToken; /* Follow Up Dialog Token */ - UINT_32 u4ToD; /* Timestamp of Departure [10ns] */ - UINT_32 u4ToA; /* Timestamp of Arrival [10ns] */ - UINT_8 ucMaxToDErr; /* Maximum of ToD Error [10ns] */ - UINT_8 ucMaxToAErr; /* Maximum of ToA Error [10ns] */ -} __KAL_ATTRIB_PACKED__ ACTION_UNPROTECTED_WNM_TIMING_MEAS_FRAME, *P_ACTION_UNPROTECTED_WNM_TIMING_MEAS_FRAME; - -//3 Information Elements from WFA. -typedef struct _IE_WFA_T { - UINT_8 ucId; - UINT_8 ucLength; - UINT_8 aucOui[3]; - UINT_8 ucOuiType; - UINT_8 aucOuiSubTypeVersion[2]; - /*!< Please be noted. WPA defines a 16 bit field version - instead of one subtype field and one version field*/ -} __KAL_ATTRIB_PACKED__ IE_WFA_T, *P_IE_WFA_T; - -/* WAPI Information element format */ -typedef struct _WAPI_INFO_ELEM_T { - UCHAR ucElemId; - UCHAR ucLength; - UINT_16 u2Version; - UINT_16 u2AuthKeyMgtSuiteCount; - UCHAR aucAuthKeyMgtSuite1[4]; -} __KAL_ATTRIB_PACKED__ WAPI_INFO_ELEM_T, *P_WAPI_INFO_ELEM_T; - -#if defined(WINDOWS_DDK) || defined(WINDOWS_CE) -#pragma pack() -#endif - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -/* Convert the ECWmin(max) to CWmin(max) */ -#define ECW_TO_CW(_ECW) ((1 << (_ECW)) - 1) - -/* Convert the RCPI to dBm */ -#define RCPI_TO_dBm(_rcpi) \ - ((PARAM_RSSI)(((_rcpi) > RCPI_HIGH_BOUND ? RCPI_HIGH_BOUND : (_rcpi)) >> 1) - NDBM_LOW_BOUND_FOR_RCPI) - -/* Convert the dBm to RCPI */ -#define dBm_TO_RCPI(_dbm) \ - (RCPI)( ( (((PARAM_RSSI)(_dbm) + NDBM_LOW_BOUND_FOR_RCPI) << 1) > RCPI_HIGH_BOUND) ? RCPI_HIGH_BOUND : \ - ( (((PARAM_RSSI)(_dbm) + NDBM_LOW_BOUND_FOR_RCPI) << 1) < RCPI_LOW_BOUND ? RCPI_LOW_BOUND : \ - (((PARAM_RSSI)(_dbm) + NDBM_LOW_BOUND_FOR_RCPI) << 1) ) ) - -/* Convert an unsigned char pointer to an information element pointer */ -#define IE_ID(fp) (((P_IE_HDR_T) fp)->ucId) -#define IE_LEN(fp) (((P_IE_HDR_T) fp)->ucLength) -#define IE_SIZE(fp) (ELEM_HDR_LEN + IE_LEN(fp)) - -#define SSID_IE(fp) ((P_IE_SSID_T) fp) - -#define SUP_RATES_IE(fp) ((P_IE_SUPPORTED_RATE_T) fp) - -#define DS_PARAM_IE(fp) ((P_IE_DS_PARAM_SET_T) fp) - -#define TIM_IE(fp) ((P_IE_TIM_T) fp) - -#define IBSS_PARAM_IE(fp) ((P_IE_IBSS_PARAM_SET_T) fp) - -#define ERP_INFO_IE(fp) ((P_IE_ERP_T) fp) - -#define EXT_SUP_RATES_IE(fp) ((P_IE_EXT_SUPPORTED_RATE_T) fp) - -#define WFA_IE(fp) ((P_IE_WFA_T) fp) - -#if CFG_SUPPORT_802_11D -#define COUNTRY_IE(fp) ((P_IE_COUNTRY_T) fp) -#endif - -#define EXT_CAP_IE(fp) ((P_EXT_CAP_T) fp) - -#define HT_CAP_IE(fp) ((P_IE_HT_CAP_T) fp) - -#define HT_OP_IE(fp) ((P_IE_HT_OP_T) fp) - -#define OBSS_SCAN_PARAM_IE(fp) ((P_IE_OBSS_SCAN_PARAM_T) fp) - -#define BSS_20_40_COEXIST_IE(fp) ((P_IE_20_40_COEXIST_T) fp) - -#define QUIET_IE(fp) ((P_IE_QUIET_T) fp) - - - -/* The macro to check if the MAC address is B/MCAST Address */ -#define IS_BMCAST_MAC_ADDR(_pucDestAddr) \ - ((BOOLEAN) ( ((PUINT_8)(_pucDestAddr))[0] & BIT(0) )) - -/* The macro to check if the MAC address is UCAST Address */ -#define IS_UCAST_MAC_ADDR(_pucDestAddr) \ - ((BOOLEAN) !( ((PUINT_8)(_pucDestAddr))[0] & BIT(0) )) - -/* The macro to copy the MAC address */ -#define COPY_MAC_ADDR(_pucDestAddr, _pucSrcAddr) \ - kalMemCopy(_pucDestAddr, _pucSrcAddr, MAC_ADDR_LEN) - -/* The macro to check if two MAC addresses are equal */ -#define EQUAL_MAC_ADDR(_pucDestAddr, _pucSrcAddr) \ - (!kalMemCmp(_pucDestAddr, _pucSrcAddr, MAC_ADDR_LEN)) - -/* The macro to check if two MAC addresses are not equal */ -#define UNEQUAL_MAC_ADDR(_pucDestAddr, _pucSrcAddr) \ - (kalMemCmp(_pucDestAddr, _pucSrcAddr, MAC_ADDR_LEN)) - - -/* The macro to check whether two SSIDs are equal */ -#define EQUAL_SSID(pucSsid1, ucSsidLen1, pucSsid2, ucSsidLen2) \ - ((ucSsidLen1 <= ELEM_MAX_LEN_SSID) && \ - (ucSsidLen2 <= ELEM_MAX_LEN_SSID) && \ - ((ucSsidLen1) == (ucSsidLen2)) && \ - !kalMemCmp(pucSsid1, pucSsid2, ucSsidLen1)) - -/* The macro to check whether two SSIDs are equal */ -#define UNEQUAL_SSID(pucSsid1, ucSsidLen1, pucSsid2, ucSsidLen2) \ - ((ucSsidLen1 > ELEM_MAX_LEN_SSID) || \ - (ucSsidLen2 > ELEM_MAX_LEN_SSID) || \ - ((ucSsidLen1) != (ucSsidLen2)) || \ - kalMemCmp(pucSsid1, pucSsid2, ucSsidLen1)) - -/* The macro to copy the SSID, the length of pucDestSsid should have at least 32 bytes */ -#define COPY_SSID(pucDestSsid, ucDestSsidLen, pucSrcSsid, ucSrcSsidLen) \ - do { \ - ucDestSsidLen = ucSrcSsidLen; \ - if (ucSrcSsidLen) { \ - ASSERT(ucSrcSsidLen <= ELEM_MAX_LEN_SSID); \ - kalMemCopy(pucDestSsid, pucSrcSsid, ((ucSrcSsidLen > ELEM_MAX_LEN_SSID) ? ELEM_MAX_LEN_SSID : ucSrcSsidLen)); \ - } \ - } while (FALSE) - -/* The macro to copy the IE */ -#define COPY_IE(pucDestIE, pucSrcIE) \ - do { \ - kalMemCopy((PUINT_8)pucDestIE, \ - (PUINT_8)pucSrcIE,\ - IE_SIZE(pucSrcIE)); \ - } while (FALSE) - -#define IE_FOR_EACH(_pucIEsBuf, _u2IEsBufLen, _u2Offset) \ - for ((_u2Offset) = 0; ((((_u2Offset) + 2) <= (_u2IEsBufLen)) && (((_u2Offset) + IE_SIZE(_pucIEsBuf)) <= (_u2IEsBufLen))) ; \ - (_u2Offset) += IE_SIZE(_pucIEsBuf), (_pucIEsBuf) += IE_SIZE(_pucIEsBuf)) - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _MAC_H */ - diff --git a/drivers/net/wireless/mt5931/include/nic/mt5931_reg.h b/drivers/net/wireless/mt5931/include/nic/mt5931_reg.h deleted file mode 100755 index 6cec38d71542..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/mt5931_reg.h +++ /dev/null @@ -1,336 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/MT6620_5931_WiFi_Driver/include/nic/mt5931_reg.h#3 $ -*/ - -/*! \file "mt5931_reg.h" - \brief The common register definition of mt5931 - - N/A -*/ - -/******************************************************************************* -* Copyright (c) 2010 MediaTek Inc. -* -* All rights reserved. Copying, compilation, modification, distribution -* or any other use whatsoever of this material is strictly prohibited -* except in accordance with a Software License Agreement with -* MediaTek Inc. -******************************************************************************** -*/ - -/******************************************************************************* -* LEGAL DISCLAIMER -* -* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND -* AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK -* SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE -* PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY -* DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT -* LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -* PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE -* ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY -* WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK -* SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY -* WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE -* FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO -* CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. -* -* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE -* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL -* BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT -* ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY -* BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. -* -* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE -* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT -* OF LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING -* THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN -* FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE -* (ICC). -******************************************************************************** -*/ - -/* -** $Log: mt5931_reg.h $ - * - * 02 25 2011 cp.wu - * [WCXRP00000496] [MT5931][Driver] Apply host-triggered chip reset before initializing firmware download procedures - * apply host-triggered chip reset mechanism before initializing firmware download procedures. - * - * 02 18 2011 terry.wu - * [WCXRP00000412] [MT6620 Wi-Fi][FW/Driver] Dump firmware assert info at android kernel log - * Add WHISR_D2H_SW_ASSERT_INFO_INT to MT5931_reg. - * - * 10 07 2010 cp.wu - * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection - * add firmware download for MT5931. - * -*/ - -#ifndef _MT5931_REG_H -#define _MT5931_REG_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -//1 MT5931 MCR Definition - -//2 Host Interface - -//4 CHIP ID Register -#define MCR_WCIR 0x0000 - -//4 HIF Low Power Control Register -#define MCR_WHLPCR 0x0004 - -//4 Control Status Register -#define MCR_WSDIOCSR 0x0008 -#define MCR_WSPICSR 0x0008 - -//4 HIF Control Register -#define MCR_WHCR 0x000C - -//4 HIF Interrupt Status Register -#define MCR_WHISR 0x0010 - -//4 HIF Interrupt Enable Register -#define MCR_WHIER 0x0014 - -//4 Abnormal Status Register -#define MCR_WASR 0x0018 - -//4 WLAN Software Interrupt Control Register -#define MCR_WSICR 0x001C - -//4 WLAN TX Status Register -#define MCR_WTSR0 0x0020 - -//4 WLAN TX Status Register -#define MCR_WTSR1 0x0024 - -//4 WLAN TX Data Register 0 -#define MCR_WTDR0 0x0028 - -//4 WLAN TX Data Register 1 -#define MCR_WTDR1 0x002C - -//4 WLAN RX Data Register 0 -#define MCR_WRDR0 0x0030 - -//4 WLAN RX Data Register 1 -#define MCR_WRDR1 0x0034 - -//4 Host to Device Send Mailbox 0 Register -#define MCR_H2DSM0R 0x0038 - -//4 Host to Device Send Mailbox 1 Register -#define MCR_H2DSM1R 0x003c - -//4 Device to Host Receive Mailbox 0 Register -#define MCR_D2HRM0R 0x0040 - -//4 Device to Host Receive Mailbox 1 Register -#define MCR_D2HRM1R 0x0044 - -//4 Device to Host Receive Mailbox 2 Register -#define MCR_D2HRM2R 0x0048 - -//4 WLAN RX Packet Length Register -#define MCR_WRPLR 0x0050 - -//4 EHPI Transaction Count Register -#define MCR_EHTCR 0x0054 - -//4 Firmware Download Data Register -#define MCR_FWDLDR 0x0080 - -//4 Firmware Download Destination Starting Address Register -#define MCR_FWDLDSAR 0x0084 - -//4 Firmware Download Status Register -#define MCR_FWDLSR 0x0088 - -//4 WLAN MCU Control & Status Register -#define MCR_WMCSR 0x008c - -//4 WLAN Firmware Download Configuration -#define MCR_FWCFG 0x0090 - - -//#if CFG_SDIO_INTR_ENHANCE -typedef struct _ENHANCE_MODE_DATA_STRUCT_T { - UINT_32 u4WHISR; - union { - struct { - UINT_8 ucTQ0Cnt; - UINT_8 ucTQ1Cnt; - UINT_8 ucTQ2Cnt; - UINT_8 ucTQ3Cnt; - UINT_8 ucTQ4Cnt; - UINT_8 ucTQ5Cnt; - UINT_16 u2Rsrv; - } u; - UINT_32 au4WTSR[2]; - } rTxInfo; - union { - struct { - UINT_16 u2NumValidRx0Len; - UINT_16 u2NumValidRx1Len; - UINT_16 au2Rx0Len[16]; - UINT_16 au2Rx1Len[16]; - } u; - UINT_32 au4RxStatusRaw[17]; - } rRxInfo; - UINT_32 u4RcvMailbox0; - UINT_32 u4RcvMailbox1; -} ENHANCE_MODE_DATA_STRUCT_T, *P_ENHANCE_MODE_DATA_STRUCT_T; -// #endif /* ENHANCE_MODE_DATA_STRUCT_T */ - - -//2 Definition in each register -//3 WCIR 0x0000 -#define WCIR_WLAN_READY BIT(21) -#define WCIR_POR_INDICATOR BIT(20) -#define WCIR_REVISION_ID BITS(16,19) -#define WCIR_CHIP_ID BITS(0,15) - -#define MTK_CHIP_REV 0x00005931 -#define MTK_CHIP_MP_REVERSION_ID 0x0 - -//3 WHLPCR 0x0004 -#define WHLPCR_FW_OWN_REQ_CLR BIT(9) -#define WHLPCR_FW_OWN_REQ_SET BIT(8) -#define WHLPCR_IS_DRIVER_OWN BIT(8) -#define WHLPCR_INT_EN_CLR BIT(1) -#define WHLPCR_INT_EN_SET BIT(0) - -//3 WSDIOCSR 0x0008 -#define WSDIOCSR_SDIO_RE_INIT_EN BIT(0) - -//3 WSPICSR 0x0008 -#define WCSR_SPI_MODE_SEL BITS(3,4) -#define WCSR_SPI_ENDIAN_BIG BIT(2) -#define WCSR_SPI_INT_OUT_MODE BIT(1) -#define WCSR_SPI_DATA_OUT_MODE BIT(0) - -//3 WHCR 0x000C -#define WHCR_RX_ENHANCE_MODE_EN BIT(16) -#define WHCR_MAX_HIF_RX_LEN_NUM BITS(4,7) -#define WHCR_W_MAILBOX_RD_CLR_EN BIT(2) -#define WHCR_W_INT_CLR_CTRL BIT(1) -#define WHCR_MCU_DBG_EN BIT(0) -#define WHCR_OFFSET_MAX_HIF_RX_LEN_NUM 4 - -//3 WHISR 0x0010 -#define WHISR_D2H_SW_INT BITS(8,31) -#define WHISR_D2H_SW_ASSERT_INFO_INT BIT(31) -#define WHISR_FW_OWN_BACK_INT BIT(4) -#define WHISR_ABNORMAL_INT BIT(3) -#define WHISR_RX1_DONE_INT BIT(2) -#define WHISR_RX0_DONE_INT BIT(1) -#define WHISR_TX_DONE_INT BIT(0) - - -//3 WHIER 0x0014 -#define WHIER_D2H_SW_INT BITS(8,31) -#define WHIER_FW_OWN_BACK_INT_EN BIT(4) -#define WHIER_ABNORMAL_INT_EN BIT(3) -#define WHIER_RX1_DONE_INT_EN BIT(2) -#define WHIER_RX0_DONE_INT_EN BIT(1) -#define WHIER_TX_DONE_INT_EN BIT(0) -#define WHIER_DEFAULT (WHIER_RX0_DONE_INT_EN | \ - WHIER_RX1_DONE_INT_EN | \ - WHIER_TX_DONE_INT_EN | \ - WHIER_ABNORMAL_INT_EN | \ - WHIER_D2H_SW_INT \ - ) - - -//3 WASR 0x0018 -#define WASR_FW_OWN_INVALID_ACCESS BIT(4) -#define WASR_RX1_UNDER_FLOW BIT(3) -#define WASR_RX0_UNDER_FLOW BIT(2) -#define WASR_TX1_OVER_FLOW BIT(1) -#define WASR_TX0_OVER_FLOW BIT(0) - - -//3 WSICR 0x001C -#define WSICR_H2D_SW_INT_SET BITS(16,31) - - -//3 WRPLR 0x0050 -#define WRPLR_RX1_PACKET_LENGTH BITS(16,31) -#define WRPLR_RX0_PACKET_LENGTH BITS(0,15) - - -//3 FWDLSR 0x0088 -#define FWDLSR_FWDL_RDY BIT(8) -#define FWDLSR_FWDL_MODE BIT(0) - - -//3 WMCSR 0x008c -#define WMCSR_CHIP_RST BIT(15) /* write */ -#define WMCSR_DL_OK BIT(15) /* read */ -#define WMCSR_DL_FAIL BIT(14) -#define WMCSR_PLLRDY BIT(13) -#define WMCSR_WF_ON BIT(12) -#define WMCSR_INI_RDY BIT(11) -#define WMCSR_WF_EN BIT(6) -#define WMCSR_SW_EN BIT(5) -#define WMCSR_SPLLEN BIT(4) -#define WMCSR_SPWREN BIT(3) -#define WMCSR_HSTOPIL BIT(2) -#define WMCSR_FWDLRST BIT(1) -#define WMCSR_FWDLEN BIT(0) - - -//3 FWCFG 0x0090 -#define FWCFG_KSEL BITS(14,15) -#define FWCFG_FLEN BITS(0,13) - - -#endif /* _MT5931_REG_H */ - diff --git a/drivers/net/wireless/mt5931/include/nic/mt6620_reg.h b/drivers/net/wireless/mt5931/include/nic/mt6620_reg.h deleted file mode 100755 index 3f2eacd3a1a2..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/mt6620_reg.h +++ /dev/null @@ -1,286 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/mt6620_reg.h#1 $ -*/ - -/*! \file "mt6620_reg.h" - \brief The common register definition of mt6620 - - N/A -*/ - - - -/* -** $Log: mt6620_reg.h $ - * - * 01 31 2011 terry.wu - * [WCXRP00000412] [MT6620 Wi-Fi][FW/Driver] Dump firmware assert info at android kernel log - * Print firmware ASSERT info at Android kernel log, driver side - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 03 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) add ACPI D0/D3 state switching support - * * * * 2) use more formal way to handle interrupt when the status is retrieved from enhanced RX response -** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-12-10 16:44:18 GMT mtk02752 -** remove 5921 definitions -** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-11-09 22:56:32 GMT mtk01084 -** modify HW register definitions -** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-11-04 14:11:04 GMT mtk01084 -** modify default IER bits -** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-10-29 19:52:32 GMT mtk01084 -** modify data struture -** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-10-23 16:08:20 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-10-13 21:58:53 GMT mtk01084 -** update for new HW architecture design -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-09-09 17:26:11 GMT mtk01084 -** add CFG_TEST_WITH_MT5921 -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-05-18 20:59:57 GMT mtk01426 -** Update WHIER_DEFAULT value -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-05-07 16:57:36 GMT mtk01426 -** Update CHIP ID to 0x6620, and WHLPCR bit definition -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-28 10:34:57 GMT mtk01461 -** Add read WTSR and fix RX STATUS is DW align for SDIO_STATUS_ENHANCE mode -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-03-24 09:46:52 GMT mtk01084 -** fix LINT error -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-23 00:32:24 GMT mtk01461 -** Define constants for TX PATH -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-18 20:54:10 GMT mtk01426 -** Add WHCR_MAX_HIF_RX_AGG_LEN_OFFSET definition -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:16:29 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _MT6620_REG_H -#define _MT6620_REG_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -//1 MT6620 MCR Definition - -//2 Host Interface - -//4 CHIP ID Register -#define MCR_WCIR 0x0000 - -//4 HIF Low Power Control Register -#define MCR_WHLPCR 0x0004 -//#define MCR_WHLPCR_BYTE1 0x0005 - - -//4 Control Status Register -#define MCR_WSDIOCSR 0x0008 -#define MCR_WSPICSR 0x0008 - -//4 HIF Control Register -#define MCR_WHCR 0x000C - -//4 HIF Interrupt Status Register -#define MCR_WHISR 0x0010 - -//4 HIF Interrupt Enable Register -#define MCR_WHIER 0x0014 - -//4 Abnormal Status Register -#define MCR_WASR 0x0018 - -//4 WLAN Software Interrupt Control Register -#define MCR_WSICR 0x001C - -//4 WLAN TX Status Register -#define MCR_WTSR0 0x0020 - -//4 WLAN TX Status Register -#define MCR_WTSR1 0x0024 - -//4 WLAN TX Data Register 0 -#define MCR_WTDR0 0x0028 - -//4 WLAN TX Data Register 1 -#define MCR_WTDR1 0x002C - -//4 WLAN RX Data Register 0 -#define MCR_WRDR0 0x0030 - -//4 WLAN RX Data Register 1 -#define MCR_WRDR1 0x0034 - -//4 Host to Device Send Mailbox 0 Register -#define MCR_H2DSM0R 0x0038 - -//4 Host to Device Send Mailbox 1 Register -#define MCR_H2DSM1R 0x003c - -//4 Device to Host Receive Mailbox 0 Register -#define MCR_D2HRM0R 0x0040 - -//4 Device to Host Receive Mailbox 1 Register -#define MCR_D2HRM1R 0x0044 - -//4 WLAN RX Packet Length Register -#define MCR_WRPLR 0x0048 - - - - -//temp //#if CFG_SDIO_INTR_ENHANCE -typedef struct _ENHANCE_MODE_DATA_STRUCT_T { - UINT_32 u4WHISR; - union { - struct { - UINT_8 ucTQ0Cnt; - UINT_8 ucTQ1Cnt; - UINT_8 ucTQ2Cnt; - UINT_8 ucTQ3Cnt; - UINT_8 ucTQ4Cnt; - UINT_8 ucTQ5Cnt; - UINT_16 u2Rsrv; - } u; - UINT_32 au4WTSR[2]; - } rTxInfo; - union { - struct { - UINT_16 u2NumValidRx0Len; - UINT_16 u2NumValidRx1Len; - UINT_16 au2Rx0Len[16]; - UINT_16 au2Rx1Len[16]; - } u; - UINT_32 au4RxStatusRaw[17]; - } rRxInfo; - UINT_32 u4RcvMailbox0; - UINT_32 u4RcvMailbox1; -} ENHANCE_MODE_DATA_STRUCT_T, *P_ENHANCE_MODE_DATA_STRUCT_T; -// #endif /* ENHANCE_MODE_DATA_STRUCT_T */ - - -//2 Definition in each register -//3 WCIR 0x0000 -#define WCIR_WLAN_READY BIT(21) -#define WCIR_POR_INDICATOR BIT(20) -#define WCIR_REVISION_ID BITS(16,19) -#define WCIR_CHIP_ID BITS(0,15) - -#define MTK_CHIP_REV 0x00006620 -#define MTK_CHIP_MP_REVERSION_ID 0x0 - -//3 WHLPCR 0x0004 -#define WHLPCR_FW_OWN_REQ_CLR BIT(9) -#define WHLPCR_FW_OWN_REQ_SET BIT(8) -#define WHLPCR_IS_DRIVER_OWN BIT(8) -#define WHLPCR_INT_EN_CLR BIT(1) -#define WHLPCR_INT_EN_SET BIT(0) - -//3 WSDIOCSR 0x0008 -#define WSDIOCSR_SDIO_RE_INIT_EN BIT(0) - -//3 WSPICSR 0x0008 -#define WCSR_SPI_MODE_SEL BITS(3,4) -#define WCSR_SPI_ENDIAN_BIG BIT(2) -#define WCSR_SPI_INT_OUT_MODE BIT(1) -#define WCSR_SPI_DATA_OUT_MODE BIT(0) - -//3 WHCR 0x000C -#define WHCR_RX_ENHANCE_MODE_EN BIT(16) -#define WHCR_MAX_HIF_RX_LEN_NUM BITS(4,7) -#define WHCR_W_MAILBOX_RD_CLR_EN BIT(2) -#define WHCR_W_INT_CLR_CTRL BIT(1) -#define WHCR_MCU_DBG_EN BIT(0) -#define WHCR_OFFSET_MAX_HIF_RX_LEN_NUM 4 - -//3 WHISR 0x0010 -#define WHISR_D2H_SW_INT BITS(8,31) -#define WHISR_D2H_SW_ASSERT_INFO_INT BIT(31) -#define WHISR_FW_INT_INDICATOR BIT(7) -#define WHISR_FW_OWN_BACK_INT BIT(4) -#define WHISR_ABNORMAL_INT BIT(3) -#define WHISR_RX1_DONE_INT BIT(2) -#define WHISR_RX0_DONE_INT BIT(1) -#define WHISR_TX_DONE_INT BIT(0) - - -//3 WHIER 0x0014 -#define WHIER_D2H_SW_INT BITS(8,31) -#define WHIER_FW_INT_INDICATOR_EN BIT(7) -#define WHIER_FW_OWN_BACK_INT_EN BIT(4) -#define WHIER_ABNORMAL_INT_EN BIT(3) -#define WHIER_RX1_DONE_INT_EN BIT(2) -#define WHIER_RX0_DONE_INT_EN BIT(1) -#define WHIER_TX_DONE_INT_EN BIT(0) -#define WHIER_DEFAULT (WHIER_RX0_DONE_INT_EN | \ - WHIER_RX1_DONE_INT_EN | \ - WHIER_TX_DONE_INT_EN | \ - WHIER_ABNORMAL_INT_EN | \ - WHIER_D2H_SW_INT \ - ) - - -//3 WASR 0x0018 -#define WASR_FW_OWN_INVALID_ACCESS BIT(4) -#define WASR_RX1_UNDER_FLOW BIT(3) -#define WASR_RX0_UNDER_FLOW BIT(2) -#define WASR_TX1_OVER_FLOW BIT(1) -#define WASR_TX0_OVER_FLOW BIT(0) - - -//3 WSICR 0x001C -#define WSICR_H2D_SW_INT_SET BITS(16,31) - - -//3 WTSR0 0x0044 -#define WRPLR_RX1_PACKET_LENGTH BITS(16,31) -#define WRPLR_RX0_PACKET_LENGTH BITS(0,15) - -#endif /* _MT6620_REG_H */ - diff --git a/drivers/net/wireless/mt5931/include/nic/nic.h b/drivers/net/wireless/mt5931/include/nic/nic.h deleted file mode 100755 index 64631384d9dc..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/nic.h +++ /dev/null @@ -1,724 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/nic.h#1 $ -*/ - -/*! \file "nic.h" - \brief The declaration of nic functions - - Detail description. -*/ - - - -/* -** $Log: nic.h $ - * - * 11 01 2011 chinglan.wang - * NULL - * Modify the Wi-Fi method of the flush TX queue when disconnect the AP. - * If disconnect the AP and flush all the data frame in the TX queue, WPS cannot do the 4-way handshake to connect to the AP.. - * - * 07 18 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add CMD/Event for RDD and BWCS. - * - * 05 11 2011 cp.wu - * [WCXRP00000718] [MT6620 Wi-Fi] modify the behavior of setting tx power - * ACPI APIs migrate to wlan_lib.c for glue layer to invoke. - * - * 04 11 2011 yuche.tsai - * [WCXRP00000627] [Volunteer Patch][MT6620][Driver] Pending MMPUD of P2P Network may crash system issue. - * Fix kernel panic issue when MMPDU of P2P is pending in driver. - * - * 03 02 2011 cp.wu - * [WCXRP00000503] [MT6620 Wi-Fi][Driver] Take RCPI brought by association response as initial RSSI right after connection is built. - * use RCPI brought by ASSOC-RESP after connection is built as initial RCPI to avoid using a uninitialized MAC-RX RCPI. - * - * 02 01 2011 cm.chang - * [WCXRP00000415] [MT6620 Wi-Fi][Driver] Check if any memory leakage happens when uninitializing in DGB mode - * . - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * - * 10 26 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW] Support NIC capability query command - * 1) update NVRAM content template to ver 1.02 - * 2) add compile option for querying NIC capability (default: off) - * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting - * 4) correct auto-rate compiler error under linux (treat warning as error) - * 5) simplify usage of NVRAM and REG_INFO_T - * 6) add version checking between driver and firmware - * - * 10 26 2010 eddie.chen - * [WCXRP00000134] [MT6620 Wi-Fi][Driver] Add a registry to enable auto rate for SQA test by using E1 EVB - * Add auto rate parameter in registry. - * - * 10 12 2010 cp.wu - * [WCXRP00000084] [MT6620 Wi-Fi][Driver][FW] Add fixed rate support for distance test - * add HT (802.11n) fixed rate support. - * - * 10 08 2010 cp.wu - * [WCXRP00000084] [MT6620 Wi-Fi][Driver][FW] Add fixed rate support for distance test - * adding fixed rate support for distance test. (from registry setting) - * - * 10 05 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * 1) add NVRAM access API - * 2) fake scanning result when NVRAM doesn't exist and/or version mismatch. (off by compiler option) - * 3) add OID implementation for NVRAM read/write service - * - * 10 04 2010 cp.wu - * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by ENUM_NETWORK_TYPE_INDEX_T only - * remove ENUM_NETWORK_TYPE_T definitions - * - * 09 21 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * Do a complete reset with STA-REC null checking for RF test re-entry - * - * 09 08 2010 cp.wu - * NULL - * use static memory pool for storing IEs of scanning result. - * - * 09 01 2010 cp.wu - * NULL - * HIFSYS Clock Source Workaround - * - * 08 25 2010 george.huang - * NULL - * update OID/ registry control path for PM related settings - * - * 08 12 2010 cp.wu - * NULL - * [AIS-FSM] honor registry setting for adhoc running mode. (A/B/G) - * - * 08 03 2010 cp.wu - * NULL - * Centralize mgmt/system service procedures into independent calls. - * - * 07 28 2010 cp.wu - * NULL - * 1) eliminate redundant variable eOPMode in prAdapter->rWlanInfo - * 2) change nicMediaStateChange() API prototype - * - * 07 14 2010 yarco.yang - * - * 1. Remove CFG_MQM_MIGRATION - * 2. Add CMD_UPDATE_WMM_PARMS command - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 06 2010 george.huang - * [WPD00001556]Basic power managemenet function - * Update arguments for nicUpdateBeaconIETemplate() - * - * 07 06 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * STA-REC is maintained by CNM only. - * - * 07 05 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) ignore RSN checking when RSN is not turned on. - * 2) set STA-REC deactivation callback as NULL - * 3) add variable initialization API based on PHY configuration - * - * 06 30 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * sync. with CMD/EVENT document ver0.07. - * - * 06 29 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) sync to. CMD/EVENT document v0.03 - * 2) simplify DTIM period parsing in scan.c only, bss.c no longer parses it again. - * 3) send command packet to indicate FW-PM after - * a) 1st beacon is received after AIS has connected to an AP - * b) IBSS-ALONE has been created - * c) IBSS-MERGE has occured - * - * 06 25 2010 george.huang - * [WPD00001556]Basic power managemenet function - * Create beacon update path, with expose bssUpdateBeaconContent() - * - * 06 22 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) add command warpper for STA-REC/BSS-INFO sync. - * 2) enhance command packet sending procedure for non-oid part - * 3) add command packet definitions for STA-REC/BSS-INFO sync. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * implement TX_DONE callback path. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) eliminate CFG_CMD_EVENT_VERSION_0_9 - * 2) when disconnected, indicate nic directly (no event is needed) - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 04 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) surpress compiler warning - * 2) when acqruing LP-own, keep writing WHLPCR whenever OWN is not acquired yet - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * * * * * * 2) command sequence number is now increased atomically - * * * * * * * * * 3) private data could be hold and taken use for other purpose - * - * 04 12 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add channel frequency <-> number conversion - * - * 03 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) add ACPI D0/D3 state switching support - * * * * * 2) use more formal way to handle interrupt when the status is retrieved from enhanced RX response - * - * 03 17 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * always process TX interrupt first then RX interrupt. - * - * 02 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct behavior to prevent duplicated RX handling for RX0_DONE and RX1_DONE - * - * 02 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add checksum offloading support. -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-10-13 21:58:58 GMT mtk01084 -** update for new HW architecture design -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-04-24 21:12:55 GMT mtk01104 -** Add function prototype nicRestoreSpiDefMode() -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-19 18:32:54 GMT mtk01084 -** update for basic power management functions -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:16:32 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _NIC_H -#define _NIC_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - - -struct _REG_ENTRY_T { - UINT_32 u4Offset; - UINT_32 u4Value; -}; - -struct _TABLE_ENTRY_T { - P_REG_ENTRY_T pu4TablePtr; - UINT_16 u2Size; -}; - -/*! INT status to event map */ -typedef struct _INT_EVENT_MAP_T { - UINT_32 u4Int; - UINT_32 u4Event; -} INT_EVENT_MAP_T, *P_INT_EVENT_MAP_T; - - -enum ENUM_INT_EVENT_T { - INT_EVENT_ABNORMAL, - INT_EVENT_SW_INT, - INT_EVENT_TX, - INT_EVENT_RX, - INT_EVENT_NUM -}; - -typedef enum _ENUM_IE_UPD_METHOD_T { - IE_UPD_METHOD_UPDATE_RANDOM, - IE_UPD_METHOD_UPDATE_ALL, - IE_UPD_METHOD_DELETE_ALL, -} ENUM_IE_UPD_METHOD_T, *P_ENUM_IE_UPD_METHOD_T; - - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Routines in nic.c */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicAllocateAdapterMemory ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicReleaseAdapterMemory ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicDisableInterrupt ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicEnableInterrupt ( - IN P_ADAPTER_T prAdapter - ); - -WLAN_STATUS -nicProcessIST ( - IN P_ADAPTER_T prAdapter - ); - -WLAN_STATUS -nicProcessIST_impl ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4IntStatus - ); - -WLAN_STATUS -nicInitializeAdapter ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicMCRInit ( - IN P_ADAPTER_T prAdapter - ); - -BOOL -nicVerifyChipID ( - IN P_ADAPTER_T prAdapter - ); - - -#if CFG_SDIO_INTR_ENHANCE -VOID -nicSDIOInit ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicSDIOReadIntStatus ( - IN P_ADAPTER_T prAdapter, - OUT PUINT_32 pu4IntStatus - ); -#endif - -BOOLEAN -nicpmSetDriverOwn ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicpmSetFWOwn ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgEnableGlobalInt - ); - -BOOLEAN -nicpmSetAcpiPowerD0 ( - IN P_ADAPTER_T prAdapter - ); - -BOOLEAN -nicpmSetAcpiPowerD3 ( - IN P_ADAPTER_T prAdapter - ); - -#if defined(_HIF_SPI) -void -nicRestoreSpiDefMode( - IN P_ADAPTER_T prAdapter - ); -#endif - -VOID -nicProcessSoftwareInterrupt( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicProcessAbnormalInterrupt ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicPutMailbox ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4MailboxNum, - IN UINT_32 u4Data); - -VOID -nicGetMailbox ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4MailboxNum, - OUT PUINT_32 pu4Data); - -VOID -nicSetSwIntr ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4SwIntrBitmap - ); - -P_CMD_INFO_T -nicGetPendingCmdInfo ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucSeqNum - ); - -P_MSDU_INFO_T -nicGetPendingTxMsduInfo ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucSeqNum - ); - -P_MSDU_INFO_T -nicGetPendingStaMMPDU( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucStaRecIdx - ); - -VOID -nicFreePendingTxMsduInfoByNetwork ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkType - ); - -UINT_8 -nicIncreaseCmdSeqNum ( - IN P_ADAPTER_T prAdapter - ); - -UINT_8 -nicIncreaseTxSeqNum ( - IN P_ADAPTER_T prAdapter - ); - -/* Media State Change */ -WLAN_STATUS -nicMediaStateChange ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkType, - IN P_EVENT_CONNECTION_STATUS prConnectionStatus - ); - -/* Utility function for channel number conversion */ -UINT_32 -nicChannelNum2Freq ( - IN UINT_32 u4ChannelNum - ); - -UINT_32 -nicFreq2ChannelNum ( - IN UINT_32 u4FreqInKHz - ); - -/* firmware command wrapper */ - /* NETWORK (WIFISYS) */ -WLAN_STATUS -nicActivateNetwork( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ); - -WLAN_STATUS -nicDeactivateNetwork( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ); - - - /* BSS-INFO */ -WLAN_STATUS -nicUpdateBss( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ); - - /* BSS-INFO Indication (PM) */ -WLAN_STATUS -nicPmIndicateBssCreated( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ); - -WLAN_STATUS -nicPmIndicateBssConnected( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ); - -WLAN_STATUS -nicPmIndicateBssAbort( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ); - - /* Beacon Template Update */ -WLAN_STATUS -nicUpdateBeaconIETemplate ( - IN P_ADAPTER_T prAdapter, - IN ENUM_IE_UPD_METHOD_T eIeUpdMethod, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN UINT_16 u2Capability, - IN PUINT_8 aucIe, - IN UINT_16 u2IELen - ); - -WLAN_STATUS -nicQmUpdateWmmParms( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ); - -WLAN_STATUS -nicSetAutoTxPower( - IN P_ADAPTER_T prAdapter, - IN P_CMD_AUTO_POWER_PARAM_T prAutoPwrParam - ); - -/*----------------------------------------------------------------------------*/ -/* Calibration Control */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicUpdateTxPower( - IN P_ADAPTER_T prAdapter, - IN P_CMD_TX_PWR_T prTxPwrParam - ); - -WLAN_STATUS -nicUpdate5GOffset( - IN P_ADAPTER_T prAdapter, - IN P_CMD_5G_PWR_OFFSET_T pr5GPwrOffset - ); - -WLAN_STATUS -nicUpdateDPD( - IN P_ADAPTER_T prAdapter, - IN P_CMD_PWR_PARAM_T prDpdCalResult - ); - - -/*----------------------------------------------------------------------------*/ -/* PHY configuration */ -/*----------------------------------------------------------------------------*/ -VOID -nicSetAvailablePhyTypeSet ( - IN P_ADAPTER_T prAdapter - ); - -/*----------------------------------------------------------------------------*/ -/* MGMT and System Service Control */ -/*----------------------------------------------------------------------------*/ -VOID -nicInitSystemService ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicResetSystemService ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicUninitSystemService ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicInitMGMT ( - IN P_ADAPTER_T prAdapter, - IN P_REG_INFO_T prRegInfo - ); - -VOID -nicUninitMGMT ( - IN P_ADAPTER_T prAdapter - ); - -WLAN_STATUS -nicConfigPowerSaveProfile ( - IN P_ADAPTER_T prAdapter, - ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - PARAM_POWER_MODE ePwrMode, - BOOLEAN fgEnCmdEvent - ); - -/*----------------------------------------------------------------------------*/ -/* Scan Result Processing */ -/*----------------------------------------------------------------------------*/ -VOID -nicAddScanResult ( - IN P_ADAPTER_T prAdapter, - IN PARAM_MAC_ADDRESS rMacAddr, - IN P_PARAM_SSID_T prSsid, - IN UINT_32 u4Privacy, - IN PARAM_RSSI rRssi, - IN ENUM_PARAM_NETWORK_TYPE_T eNetworkType, - IN P_PARAM_802_11_CONFIG_T prConfiguration, - IN ENUM_PARAM_OP_MODE_T eOpMode, - IN PARAM_RATES_EX rSupportedRates, - IN UINT_16 u2IELength, - IN PUINT_8 pucIEBuf - ); - -VOID -nicFreeScanResultIE ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Idx - ); - -#if (MT6620_E1_ASIC_HIFSYS_WORKAROUND == 1) -/*----------------------------------------------------------------------------*/ -/* Workaround Control */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicEnableClockGating ( - IN P_ADAPTER_T prAdapter - ); - -WLAN_STATUS -nicDisableClockGating ( - IN P_ADAPTER_T prAdapter - ); -#endif - - -/*----------------------------------------------------------------------------*/ -/* Fixed Rate Hacking */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicUpdateRateParams ( - IN P_ADAPTER_T prAdapter, - IN ENUM_REGISTRY_FIXED_RATE_T eRateSetting, - IN PUINT_8 pucDesiredPhyTypeSet, - IN PUINT_16 pu2DesiredNonHTRateSet, - IN PUINT_16 pu2BSSBasicRateSet, - IN PUINT_8 pucMcsSet, - IN PUINT_8 pucSupMcs32, - IN PUINT_16 u2HtCapInfo - ); - -/*----------------------------------------------------------------------------*/ -/* Write registers */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicWriteMcr ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Address, - IN UINT_32 u4Value - ); - -/*----------------------------------------------------------------------------*/ -/* Update auto rate */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicRlmArUpdateParms( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4ArSysParam0, - IN UINT_32 u4ArSysParam1, - IN UINT_32 u4ArSysParam2, - IN UINT_32 u4ArSysParam3 - ); - -/*----------------------------------------------------------------------------*/ -/* Enable/Disable Roaming */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicRoamingUpdateParams( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4EnableRoaming - ); - - -VOID -nicPrintFirmwareAssertInfo( - IN P_ADAPTER_T prAdapter - ); - -/*----------------------------------------------------------------------------*/ -/* Link Quality Updating */ -/*----------------------------------------------------------------------------*/ -VOID -nicUpdateLinkQuality( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIdx, - IN P_EVENT_LINK_QUALITY prEventLinkQuality - ); - -VOID -nicUpdateRSSI( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIdx, - IN INT_8 cRssi, - IN INT_8 cLinkQuality - ); - -VOID -nicUpdateLinkSpeed( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIdx, - IN UINT_16 u2LinkSpeed - ); - -#if CFG_SUPPORT_RDD_TEST_MODE -WLAN_STATUS -nicUpdateRddTestMode( - IN P_ADAPTER_T prAdapter, - IN P_CMD_RDD_CH_T prRddChParam - ); -#endif - -#endif /* _NIC_H */ - diff --git a/drivers/net/wireless/mt5931/include/nic/nic_rx.h b/drivers/net/wireless/mt5931/include/nic/nic_rx.h deleted file mode 100755 index 49ca2991abab..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/nic_rx.h +++ /dev/null @@ -1,529 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/nic_rx.h#1 $ -*/ - -/*! \file "nic_rx.h" - \brief The declaration of the nic rx functions - -*/ - - - -/* -** $Log: nic_rx.h $ - * - * 11 07 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * add debug counters and periodically dump counters for debugging. - * - * 05 05 2011 cp.wu - * [WCXRP00000702] [MT5931][Driver] Modify initialization sequence for E1 ASIC - * add delay after whole-chip resetting for MT5931 E1 ASIC. - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 01 24 2011 cm.chang - * [WCXRP00000384] [MT6620 Wi-Fi][Driver][FW] Handle 20/40 action frame in AP mode and stop ampdu timer when sta_rec is freed - * Process received 20/40 coexistence action frame for AP mode - * - * 09 08 2010 cp.wu - * NULL - * use static memory pool for storing IEs of scanning result. - * - * 09 07 2010 yuche.tsai - * NULL - * Change prototype of API of adding P2P device to scan result. - * Additional IE buffer is saved. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 05 2010 yuche.tsai - * NULL - * Modify data structure for P2P Scan result. - * - * 08 03 2010 cp.wu - * NULL - * newly added P2P API should be declared in header file. - * - * 07 30 2010 cp.wu - * NULL - * 1) BoW wrapper: use definitions instead of hard-coded constant for error code - * 2) AIS-FSM: eliminate use of desired RF parameters, use prTargetBssDesc instead - * 3) add handling for RX_PKT_DESTINATION_HOST_WITH_FORWARD for GO-broadcast frames - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * saa_fsm.c is migrated. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add management dispatching function table. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 03 30 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * remove driver-land statistics. - * - * 03 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * generate information for OID_GEN_RCV_OK & OID_GEN_XMIT_OK - * * - * - * 03 11 2010 cp.wu - * [WPD00003821][BUG] Host driver stops processing RX packets from HIF RX0 - * add RX starvation warning debug message controlled by CFG_HIF_RX_STARVATION_WARNING - * - * 03 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * code clean: removing unused variables and structure definitions - * - * 02 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct behavior to prevent duplicated RX handling for RX0_DONE and RX1_DONE - * - * 02 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement host-side firmware download logic - * - * 02 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) remove unused function in nic_rx.c [which has been handled in que_mgt.c] - * * 2) firmware image length is now retrieved via NdisFileOpen - * * 3) firmware image is not structured by (P_IMG_SEC_HDR_T) anymore - * * 4) nicRxWaitResponse() revised - * * 5) another set of TQ counter default value is added for fw-download state - * * 6) Wi-Fi load address is now retrieved from registry too - * - * 12 30 2009 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) According to CMD/EVENT documentation v0.8, - * * * * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used, - * * * * and result is retrieved by get ATInfo instead - * * * * 2) add 4 counter for recording aggregation statistics -** \main\maintrunk.MT6620WiFiDriver_Prj\24 2009-12-10 16:49:09 GMT mtk02752 -** code clean -** \main\maintrunk.MT6620WiFiDriver_Prj\23 2009-12-09 14:02:37 GMT MTK02468 -** Added ucStaRecIdx in SW_RFB_T and HALF_SEQ_NO_COUNT definition (to replace HALF_SEQ_NO_CNOUT) -** \main\maintrunk.MT6620WiFiDriver_Prj\22 2009-11-27 11:07:54 GMT mtk02752 -** add flush for reset -** \main\maintrunk.MT6620WiFiDriver_Prj\21 2009-11-25 18:18:09 GMT mtk02752 -** modify nicRxAddScanResult() -** \main\maintrunk.MT6620WiFiDriver_Prj\20 2009-11-24 22:42:22 GMT mtk02752 -** add nicRxAddScanResult() to prepare to handle SCAN_RESULT event -** \main\maintrunk.MT6620WiFiDriver_Prj\19 2009-11-24 19:57:06 GMT mtk02752 -** adopt P_HIF_RX_HEADER_T -** \main\maintrunk.MT6620WiFiDriver_Prj\18 2009-11-16 21:43:04 GMT mtk02752 -** correct ENUM_RX_PKT_DESTINATION_T definitions -** \main\maintrunk.MT6620WiFiDriver_Prj\17 2009-11-16 15:28:25 GMT mtk02752 -** add ucQueuedPacketNum for indicating how many packet are queued by RX reordering buffer/forwarding path -** \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-11-16 15:05:01 GMT mtk02752 -** add eTC for SW_RFB_T and structure RX_MAILBOX -** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-11-13 21:16:57 GMT mtk02752 -** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-11-13 16:59:30 GMT mtk02752 -** add handler for event packet -** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-11-13 13:45:50 GMT mtk02752 -** add port param for nicRxEnhanceReadBuffer() -** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-11-11 10:12:31 GMT mtk02752 -** nicSDIOReadIntStatus() always read sizeof(ENHANCE_MODE_DATA_STRUCT_T) for int response, thus the number should be set to 0(:=16) instead of 10 -** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-10-29 19:53:32 GMT mtk01084 -** modify structure naming -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-10-23 16:08:23 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-10-13 21:59:01 GMT mtk01084 -** update for new HW architecture design -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-05-20 12:23:33 GMT mtk01461 -** Add u4MaxEventBufferLen parameter to nicRxWaitResponse() -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-05-18 21:00:48 GMT mtk01426 -** Update SDIO_MAXIMUM_RX_STATUS value -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-28 10:36:15 GMT mtk01461 -** Remove unused define - SDIO_MAXIMUM_TX_STATUS -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-04-01 10:53:17 GMT mtk01461 -** Add function for HIF_LOOPBACK_PRE_TEST -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-18 20:56:19 GMT mtk01426 -** Add to support CFG_HIF_LOOPBACK and CFG_SDIO_RX_ENHANCE -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-17 20:19:56 GMT mtk01426 -** Add nicRxWaitResponse function proto type -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:16:35 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _NIC_RX_H -#define _NIC_RX_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define MAX_SEQ_NO 4095 -#define MAX_SEQ_NO_COUNT 4096 -#define HALF_SEQ_NO_CNOUT 2048 - -#define HALF_SEQ_NO_COUNT 2048 - -#define MT6620_FIXED_WIN_SIZE 64 -#define CFG_RX_MAX_BA_ENTRY 4 -#define CFG_RX_MAX_BA_TID_NUM 8 - -#define RX_STATUS_FLAG_MORE_PACKET BIT(30) -#define RX_STATUS_CHKSUM_MASK BITS(0,10) - -#define RX_RFB_LEN_FIELD_LEN 4 -#define RX_HEADER_OFFSET 2 - - -#if defined(_HIF_SDIO) && defined (WINDOWS_DDK) -/*! On XP, maximum Tx+Rx Statue <= 64-4(HISR)*/ - #define SDIO_MAXIMUM_RX_LEN_NUM 0 /*!< 0~15 (0: un-limited) */ -#else - #define SDIO_MAXIMUM_RX_LEN_NUM 0 /*!< 0~15 (0: un-limited) */ -#endif - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef enum _ENUM_RX_STATISTIC_COUNTER_T { - RX_MPDU_TOTAL_COUNT = 0, - RX_SIZE_ERR_DROP_COUNT, - - RX_DATA_INDICATION_COUNT, - RX_DATA_RETURNED_COUNT, - RX_DATA_RETAINED_COUNT, - - RX_DROP_TOTAL_COUNT, - RX_TYPE_ERR_DROP_COUNT, - RX_CLASS_ERR_DROP_COUNT, - RX_DST_NULL_DROP_COUNT, - -#if CFG_TCP_IP_CHKSUM_OFFLOAD || CFG_TCP_IP_CHKSUM_OFFLOAD_NDIS_60 - RX_CSUM_TCP_FAILED_COUNT, - RX_CSUM_UDP_FAILED_COUNT, - RX_CSUM_IP_FAILED_COUNT, - RX_CSUM_TCP_SUCCESS_COUNT, - RX_CSUM_UDP_SUCCESS_COUNT, - RX_CSUM_IP_SUCCESS_COUNT, - RX_CSUM_UNKNOWN_L4_PKT_COUNT, - RX_CSUM_UNKNOWN_L3_PKT_COUNT, - RX_IP_V6_PKT_CCOUNT, -#endif - RX_STATISTIC_COUNTER_NUM -} ENUM_RX_STATISTIC_COUNTER_T; - -typedef enum _ENUM_RX_PKT_DESTINATION_T { - RX_PKT_DESTINATION_HOST, /* to OS */ - RX_PKT_DESTINATION_FORWARD, /* to TX queue for forward, AP mode */ - RX_PKT_DESTINATION_HOST_WITH_FORWARD, /* to both TX and OS, AP mode broadcast packet */ - RX_PKT_DESTINATION_NULL, /* packet to be freed */ - RX_PKT_DESTINATION_NUM -} ENUM_RX_PKT_DESTINATION_T; - -struct _SW_RFB_T { - QUE_ENTRY_T rQueEntry; - PVOID pvPacket; /*!< ptr to rx Packet Descriptor */ - PUINT_8 pucRecvBuff; /*!< ptr to receive data buffer */ - P_HIF_RX_HEADER_T prHifRxHdr; - UINT_32 u4HifRxHdrFlag; - PVOID pvHeader; - UINT_16 u2PacketLen; - UINT_16 u2HeaderLen; - UINT_16 u2SSN; - UINT_8 ucTid; - UINT_8 ucWlanIdx; - UINT_8 ucPacketType; - UINT_8 ucStaRecIdx; - - ENUM_CSUM_RESULT_T aeCSUM[CSUM_TYPE_NUM]; - ENUM_RX_PKT_DESTINATION_T eDst; - ENUM_TRAFFIC_CLASS_INDEX_T eTC; /* only valid when eDst == FORWARD */ -}; - -/*! RX configuration type structure */ -typedef struct _RX_CTRL_T { - UINT_32 u4RxCachedSize; - PUINT_8 pucRxCached; - QUE_T rFreeSwRfbList; - QUE_T rReceivedRfbList; - QUE_T rIndicatedRfbList; - -#if CFG_SDIO_RX_AGG - PUINT_8 pucRxCoalescingBufPtr; -#endif - - PVOID apvIndPacket[CFG_RX_MAX_PKT_NUM]; - PVOID apvRetainedPacket[CFG_RX_MAX_PKT_NUM]; - - UINT_8 ucNumIndPacket; - UINT_8 ucNumRetainedPacket; - UINT_64 au8Statistics[RX_STATISTIC_COUNTER_NUM]; /*!< RX Counters */ - -#if CFG_HIF_STATISTICS - UINT_32 u4TotalRxAccessNum; - UINT_32 u4TotalRxPacketNum; -#endif - -#if CFG_HIF_RX_STARVATION_WARNING - UINT_32 u4QueuedCnt; - UINT_32 u4DequeuedCnt; -#endif - -#if CFG_RX_PKTS_DUMP - UINT_32 u4RxPktsDumpTypeMask; -#endif - -} RX_CTRL_T, *P_RX_CTRL_T; - -typedef struct _RX_MAILBOX_T { - UINT_32 u4RxMailbox[2]; /* for Device-to-Host Mailbox */ -} RX_MAILBOX_T, *P_RX_MAILBOX_T; - -typedef WLAN_STATUS (*PROCESS_RX_MGT_FUNCTION)(P_ADAPTER_T, P_SW_RFB_T); - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#define RX_INC_CNT(prRxCtrl, eCounter) \ - {((P_RX_CTRL_T)prRxCtrl)->au8Statistics[eCounter]++;} - -#define RX_ADD_CNT(prRxCtrl, eCounter, u8Amount) \ - {((P_RX_CTRL_T)prRxCtrl)->au8Statistics[eCounter] += (UINT_64)u8Amount;} - -#define RX_GET_CNT(prRxCtrl, eCounter) \ - (((P_RX_CTRL_T)prRxCtrl)->au8Statistics[eCounter]) - -#define RX_RESET_ALL_CNTS(prRxCtrl) \ - {kalMemZero(&prRxCtrl->au8Statistics[0], sizeof(prRxCtrl->au8Statistics));} - -#define RX_STATUS_TEST_MORE_FLAG(flag) \ - ((BOOL)((flag & RX_STATUS_FLAG_MORE_PACKET) ? TRUE : FALSE)) - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -VOID -nicRxInitialize ( - IN P_ADAPTER_T prAdapter - ); - -#if defined(MT5931) -VOID -nicRxPostInitialize ( - IN P_ADAPTER_T prAdapter - ); -#endif - -VOID -nicRxUninitialize ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicRxProcessRFBs ( - IN P_ADAPTER_T prAdapter - ); - -#if !CFG_SDIO_INTR_ENHANCE -VOID -nicRxReceiveRFBs ( - IN P_ADAPTER_T prAdapter - ); - -WLAN_STATUS -nicRxReadBuffer ( - IN P_ADAPTER_T prAdapter, - IN OUT P_SW_RFB_T prSwRfb - ); - -#else -VOID -nicRxSDIOReceiveRFBs ( - IN P_ADAPTER_T prAdapter - ); - -WLAN_STATUS -nicRxEnhanceReadBuffer ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4DataPort, - IN UINT_16 u2RxLength, - IN OUT P_SW_RFB_T prSwRfb - ); -#endif /* CFG_SDIO_INTR_ENHANCE */ - - -#if CFG_SDIO_RX_AGG -VOID -nicRxSDIOAggReceiveRFBs ( - IN P_ADAPTER_T prAdapter - ); -#endif - -WLAN_STATUS -nicRxSetupRFB ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prRfb - ); - -VOID -nicRxReturnRFB ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prRfb - ); - -VOID -nicProcessRxInterrupt ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicRxProcessPktWithoutReorder ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -VOID -nicRxProcessForwardPkt ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -VOID -nicRxProcessGOBroadcastPkt ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - - -VOID -nicRxFillRFB ( - IN P_ADAPTER_T prAdapter, - IN OUT P_SW_RFB_T prSwRfb - ); - -VOID -nicRxProcessDataPacket ( - IN P_ADAPTER_T prAdapter, - IN OUT P_SW_RFB_T prSwRfb - ); - -VOID -nicRxProcessEventPacket ( - IN P_ADAPTER_T prAdapter, - IN OUT P_SW_RFB_T prSwRfb - ); - -VOID -nicRxProcessMgmtPacket ( - IN P_ADAPTER_T prAdapter, - IN OUT P_SW_RFB_T prSwRfb - ); - -#if CFG_TCP_IP_CHKSUM_OFFLOAD -VOID -nicRxFillChksumStatus( - IN P_ADAPTER_T prAdapter, - IN OUT P_SW_RFB_T prSwRfb, - IN UINT_32 u4TcpUdpIpCksStatus - ); - -VOID -nicRxUpdateCSUMStatistics ( - IN P_ADAPTER_T prAdapter, - IN const ENUM_CSUM_RESULT_T aeCSUM[] - ); -#endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */ - - -VOID -nicRxQueryStatus ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBuffer, - OUT PUINT_32 pu4Count - ); - -VOID -nicRxClearStatistics ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicRxQueryStatistics ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBuffer, - OUT PUINT_32 pu4Count - ); - -WLAN_STATUS -nicRxWaitResponse ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucPortIdx, - OUT PUINT_8 pucRspBuffer, - IN UINT_32 u4MaxRespBufferLen, - OUT PUINT_32 pu4Length - ); - -VOID -nicRxEnablePromiscuousMode ( - IN P_ADAPTER_T prAdapter - ); - - -VOID -nicRxDisablePromiscuousMode ( - IN P_ADAPTER_T prAdapter - ); - - -WLAN_STATUS -nicRxFlush ( - IN P_ADAPTER_T prAdapter - ); - -WLAN_STATUS -nicRxProcessActionFrame ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -#endif /* _NIC_RX_H */ - diff --git a/drivers/net/wireless/mt5931/include/nic/nic_tx.h b/drivers/net/wireless/mt5931/include/nic/nic_tx.h deleted file mode 100755 index 4837da4877ca..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/nic_tx.h +++ /dev/null @@ -1,646 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/nic_tx.h#1 $ -*/ - -/*! \file nic_tx.h - \brief Functions that provide TX operation in NIC's point of view. - - This file provides TX functions which are responsible for both Hardware and - Software Resource Management and keep their Synchronization. - -*/ - - - -/* -** $Log: nic_tx.h $ - * - * 11 18 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Add log counter for tx - * - * 11 10 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Add TX_DONE status detail information. - * - * 08 15 2011 cp.wu - * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree - * add MT6628-specific definitions. - * - * 04 12 2011 cp.wu - * [WCXRP00000631] [MT6620 Wi-Fi][Driver] Add an API for QM to retrieve current TC counter value and processing frame dropping cases for TC4 path - * 1. add nicTxGetResource() API for QM to make decisions. - * 2. if management frames is decided by QM for dropping, the call back is invoked to indicate such a case. - * - * 03 21 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * portability improvement - * - * 02 16 2011 cp.wu - * [WCXRP00000449] [MT6620 Wi-Fi][Driver] Refine CMD queue handling by adding an extra API for checking availble count and modify behavior - * 1. add new API: nicTxGetFreeCmdCount() - * 2. when there is insufficient command descriptor, nicTxEnqueueMsdu() will drop command packets directly - * - * 01 24 2011 cp.wu - * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving - * 1. add an extra counter for tracking pending forward frames. - * 2. notify TX service thread as well when there is pending forward frame - * 3. correct build errors leaded by introduction of Wi-Fi direct separation module - * - * 12 15 2010 yuche.tsai - * NULL - * Update SLT Descriptor number configure in driver. - * - * 11 16 2010 yarco.yang - * [WCXRP00000177] [MT5931 F/W] Performance tuning for 1st connection - * Update TX buffer count - * - * 11 03 2010 cp.wu - * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection - * 1) use 8 buffers for MT5931 which is equipped with less memory - * 2) modify MT5931 debug level to TRACE when download is successful - * - * 10 18 2010 cp.wu - * [WCXRP00000117] [MT6620 Wi-Fi][Driver] Add logic for suspending driver when MT6620 is not responding anymore - * 1. when wlanAdapterStop() failed to send POWER CTRL command to firmware, do not poll for ready bit dis-assertion - * 2. shorten polling count for shorter response time - * 3. if bad I/O operation is detected during TX resource polling, then further operation is aborted as well - * - * 10 06 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * code reorganization to improve isolation between GLUE and CORE layers. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 30 2010 cp.wu - * NULL - * API added: nicTxPendingPackets(), for simplifying porting layer - * - * 07 26 2010 cp.wu - * - * change TC4 initial value from 2 to 4. - * - * 07 13 2010 cp.wu - * - * 1) MMPDUs are now sent to MT6620 by CMD queue for keeping strict order of 1X/MMPDU/CMD packets - * 2) integrate with qmGetFrameAction() for deciding which MMPDU/1X could pass checking for sending - * 2) enhance CMD_INFO_T descriptor number from 10 to 32 to avoid descriptor underflow under concurrent network operation - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 06 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Add MGMT Packet type for HIF_TX_HEADER - * - * 06 23 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * integrate . - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * refine TX-DONE callback. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * TX descriptors are now allocated once for reducing allocation overhead - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * specify correct value for management frames. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) add flag on MSDU_INFO_T for indicating BIP frame and forceBasicRate - * 2) add packet type for indicating management frames - * - * 06 09 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add necessary changes to driver data paths. - * - * 06 09 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add TX_PACKET_MGMT to indicate the frame is coming from management modules - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge wlan_def.h. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 03 30 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * remove driver-land statistics. - * - * 03 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * generate information for OID_GEN_RCV_OK & OID_GEN_XMIT_OK - * * * - * - * 03 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * code clean: removing unused variables and structure definitions - * - * 03 02 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Redistributed the initial TC resources for normal operation - * - * 03 02 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add mutex to avoid multiple access to qmTxQueue simultaneously. - * - * 02 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add new API: wlanProcessQueuedPackets() - * - * 02 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) remove unused function in nic_rx.c [which has been handled in que_mgt.c] - * * * 2) firmware image length is now retrieved via NdisFileOpen - * * * 3) firmware image is not structured by (P_IMG_SEC_HDR_T) anymore - * * * 4) nicRxWaitResponse() revised - * * * 5) another set of TQ counter default value is added for fw-download state - * * * 6) Wi-Fi load address is now retrieved from registry too - * - * 02 09 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address - * * * * 2. follow MSDN defined behavior when associates to another AP - * * * * 3. for firmware download, packet size could be up to 2048 bytes - * - * 01 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. eliminate improper variable in rHifInfo - * * * * * 2. block TX/ordinary OID when RF test mode is engaged - * * * * * 3. wait until firmware finish operation when entering into and leaving from RF test mode - * * * * * 4. correct some HAL implementation - * - * 01 13 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Enabled the Burst_End Indication mechanism - * - * 12 30 2009 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) According to CMD/EVENT documentation v0.8, - * * * * * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used, - * * * * * and result is retrieved by get ATInfo instead - * * * * * 2) add 4 counter for recording aggregation statistics -** \main\maintrunk.MT6620WiFiDriver_Prj\24 2009-12-10 16:53:28 GMT mtk02752 -** remove unused API -** \main\maintrunk.MT6620WiFiDriver_Prj\23 2009-11-27 11:08:00 GMT mtk02752 -** add flush for reset -** \main\maintrunk.MT6620WiFiDriver_Prj\22 2009-11-24 19:56:49 GMT mtk02752 -** remove redundant eTC -** \main\maintrunk.MT6620WiFiDriver_Prj\21 2009-11-23 22:01:08 GMT mtk02468 -** Added MSDU_INFO fields for composing HIF TX header -** \main\maintrunk.MT6620WiFiDriver_Prj\20 2009-11-17 22:40:51 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\19 2009-11-17 17:35:05 GMT mtk02752 -** + nicTxMsduInfoList() for sending MsduInfoList -** + NIC_TX_BUFF_COUNT_TC[0~5] -** \main\maintrunk.MT6620WiFiDriver_Prj\18 2009-11-17 11:07:00 GMT mtk02752 -** add nicTxAdjustTcq() API -** \main\maintrunk.MT6620WiFiDriver_Prj\17 2009-11-16 22:28:30 GMT mtk02752 -** move aucFreeBufferCount/aucMaxNumOfBuffer into another structure -** \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-11-16 21:44:50 GMT mtk02752 -** + nicTxReturnMsduInfo() -** + nicTxFillMsduInfo() -** + rFreeMsduInfoList field in TX_CTRL -** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-11-16 18:00:43 GMT mtk02752 -** use P_PACKET_INFO_T for prPacket to avoid inventing another new structure for packet -** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-11-16 15:28:49 GMT mtk02752 -** add ucQueuedPacketNum for indicating how many packets are queued by per STA/AC queue -** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-11-16 10:52:01 GMT mtk02752 -** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-11-14 23:39:24 GMT mtk02752 -** interface structure redefine -** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-11-13 21:17:03 GMT mtk02752 -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-10-29 19:53:10 GMT mtk01084 -** remove strange code by Frog -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-10-13 21:59:04 GMT mtk01084 -** update for new HW architecture design -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-10-02 13:53:03 GMT mtk01725 -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-04-28 10:36:50 GMT mtk01461 -** Add declaration of nicTxReleaseResource() -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-17 19:58:39 GMT mtk01461 -** Move CMD_INFO_T related define and function to cmd_buf.h -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-04-01 10:53:53 GMT mtk01461 -** Add function for SDIO_TX_ENHANCE -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-23 00:33:27 GMT mtk01461 -** Define constants for TX PATH and add nicTxPollingResource -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-16 09:09:32 GMT mtk01461 -** Update TX PATH API -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:16:38 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _NIC_TX_H -#define _NIC_TX_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define NIC_TX_RESOURCE_POLLING_TIMEOUT 256 -#define NIC_TX_RESOURCE_POLLING_DELAY_MSEC 50 - -/* Maximum buffer count for individual HIF TCQ */ - -#if defined(MT6620) -#if CFG_SLT_SUPPORT - /* 20101215 mtk01725 Redistributed the initial TC resources for SLT operation */ - #define NIC_TX_BUFF_COUNT_TC0 0 // First connection: 0 - #define NIC_TX_BUFF_COUNT_TC1 16 // First connection: 32 - #define NIC_TX_BUFF_COUNT_TC2 0 // First connection: 0 - #define NIC_TX_BUFF_COUNT_TC3 0 // First connection: 0 - #define NIC_TX_BUFF_COUNT_TC4 4 // First connection: 2 - #define NIC_TX_BUFF_COUNT_TC5 0 // First connection: 0 -#else - /* 20100302 mtk02468 Redistributed the initial TC resources for normal operation */ - #define NIC_TX_BUFF_COUNT_TC0 6 // First connection: 0 - #define NIC_TX_BUFF_COUNT_TC1 8 // First connection: 32 - #define NIC_TX_BUFF_COUNT_TC2 8 // First connection: 0 - #define NIC_TX_BUFF_COUNT_TC3 8 // First connection: 0 - #define NIC_TX_BUFF_COUNT_TC4 4 // First connection: 2 - #define NIC_TX_BUFF_COUNT_TC5 2 // First connection: 0 -#endif -#elif defined(MT5931) - #define NIC_TX_BUFF_COUNT_TC0 1 // First connection: 0 - #define NIC_TX_BUFF_COUNT_TC1 14 // First connection: 32 - #define NIC_TX_BUFF_COUNT_TC2 1 // First connection: 0 - #define NIC_TX_BUFF_COUNT_TC3 1 // First connection: 0 - #define NIC_TX_BUFF_COUNT_TC4 4 // First connection: 2 - #define NIC_TX_BUFF_COUNT_TC5 1 // First connection: 0 -#elif defined(MT6628) - #define NIC_TX_BUFF_COUNT_TC0 1 // First connection: 0 - #define NIC_TX_BUFF_COUNT_TC1 20 // First connection: 32 - #define NIC_TX_BUFF_COUNT_TC2 1 // First connection: 0 - #define NIC_TX_BUFF_COUNT_TC3 1 // First connection: 0 - #define NIC_TX_BUFF_COUNT_TC4 4 // First connection: 2 - #define NIC_TX_BUFF_COUNT_TC5 1 // First connection: 0 - -#endif - -#define NIC_TX_BUFF_SUM (NIC_TX_BUFF_COUNT_TC0 + \ - NIC_TX_BUFF_COUNT_TC1 + \ - NIC_TX_BUFF_COUNT_TC2 + \ - NIC_TX_BUFF_COUNT_TC3 + \ - NIC_TX_BUFF_COUNT_TC4 + \ - NIC_TX_BUFF_COUNT_TC5) -#if CFG_ENABLE_FW_DOWNLOAD - - #define NIC_TX_INIT_BUFF_COUNT_TC0 8 - #define NIC_TX_INIT_BUFF_COUNT_TC1 0 - #define NIC_TX_INIT_BUFF_COUNT_TC2 0 - #define NIC_TX_INIT_BUFF_COUNT_TC3 0 - #define NIC_TX_INIT_BUFF_COUNT_TC4 0 - #define NIC_TX_INIT_BUFF_COUNT_TC5 0 - - #define NIC_TX_INIT_BUFF_SUM (NIC_TX_INIT_BUFF_COUNT_TC0 + \ - NIC_TX_INIT_BUFF_COUNT_TC1 + \ - NIC_TX_INIT_BUFF_COUNT_TC2 + \ - NIC_TX_INIT_BUFF_COUNT_TC3 + \ - NIC_TX_INIT_BUFF_COUNT_TC4 + \ - NIC_TX_INIT_BUFF_COUNT_TC5) - -#endif - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -//3 /* Session for TX QUEUES */ -/* The definition in this ENUM is used to categorize packet's Traffic Class according - * to the their TID(User Priority). - * In order to achieve QoS goal, a particular TC should not block the process of - * another packet with different TC. - * In current design we will have 5 categories(TCs) of SW resource. - */ -typedef enum _ENUM_TRAFFIC_CLASS_INDEX_T { - TC0_INDEX = 0, /* HIF TX0: AC0 packets */ - TC1_INDEX, /* HIF TX0: AC1 packets & non-QoS packets */ - TC2_INDEX, /* HIF TX0: AC2 packets */ - TC3_INDEX, /* HIF TX0: AC3 packets */ - TC4_INDEX, /* HIF TX1: Command packets or 802.1x packets */ - TC5_INDEX, /* HIF TX0: BMCAST packets */ - TC_NUM /* Maximum number of Traffic Classes. */ -} ENUM_TRAFFIC_CLASS_INDEX_T; - -typedef enum _ENUM_TX_STATISTIC_COUNTER_T { - TX_MPDU_TOTAL_COUNT = 0, - TX_INACTIVE_BSS_DROP, - TX_INACTIVE_STA_DROP, - TX_FORWARD_OVERFLOW_DROP, - TX_AP_BORADCAST_DROP, - TX_STATISTIC_COUNTER_NUM -} ENUM_TX_STATISTIC_COUNTER_T; - - -typedef struct _TX_TCQ_STATUS_T { - UINT_8 aucFreeBufferCount[TC_NUM]; - UINT_8 aucMaxNumOfBuffer[TC_NUM]; -} TX_TCQ_STATUS_T, *P_TX_TCQ_STATUS_T; - -typedef struct _TX_TCQ_ADJUST_T { - INT_8 acVariation[TC_NUM]; -} TX_TCQ_ADJUST_T, *P_TX_TCQ_ADJUST_T; - -typedef struct _TX_CTRL_T { - UINT_32 u4TxCachedSize; - PUINT_8 pucTxCached; - -/* Elements below is classified according to TC (Traffic Class) value. */ - - TX_TCQ_STATUS_T rTc; - - PUINT_8 pucTxCoalescingBufPtr; - - QUE_T rFreeMsduInfoList; - - /* Management Frame Tracking */ - /* number of management frames to be sent */ - INT_32 i4TxMgmtPendingNum; - - /* to tracking management frames need TX done callback */ - QUE_T rTxMgmtTxingQueue; - -#if CFG_HIF_STATISTICS - UINT_32 u4TotalTxAccessNum; - UINT_32 u4TotalTxPacketNum; -#endif - UINT_32 au4Statistics[TX_STATISTIC_COUNTER_NUM]; - - /* Number to track forwarding frames */ - INT_32 i4PendingFwdFrameCount; - -} TX_CTRL_T, *P_TX_CTRL_T; - -typedef enum _ENUM_TX_PACKET_SRC_T { - TX_PACKET_OS, - TX_PACKET_OS_OID, - TX_PACKET_FORWARDING, - TX_PACKET_MGMT, - TX_PACKET_NUM -} ENUM_TX_PACKET_SRC_T; - -typedef enum _ENUM_HIF_TX_PACKET_TYPE_T { - HIF_TX_PACKET_TYPE_DATA = 0, - HIF_TX_PACKET_TYPE_COMMAND, - HIF_TX_PACKET_TYPE_HIF_LB, - HIF_TX_PACKET_TYPE_MGMT -} ENUM_HIF_TX_PACKET_TYPE_T, *P_ENUM_HIF_TX_PACKET_TYPE_T; - -typedef enum _ENUM_TX_RESULT_CODE_T { - TX_RESULT_SUCCESS = 0, - TX_RESULT_LIFE_TIMEOUT, - TX_RESULT_RTS_ERROR, - TX_RESULT_MPDU_ERROR, - TX_RESULT_AGING_TIMEOUT, - TX_RESULT_FLUSHED, - TX_RESULT_DROPPED_IN_DRIVER = 32, - TX_RESULT_NUM -} ENUM_TX_RESULT_CODE_T, *P_ENUM_TX_RESULT_CODE_T; - -/* TX Call Back Function */ -typedef WLAN_STATUS (*PFN_TX_DONE_HANDLER) ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - -/* TX transactions could be divided into 4 kinds: - * - * 1) 802.1X / Bluetooth-over-Wi-Fi Security Frames - * [CMD_INFO_T] - [prPacket] - in skb or NDIS_PACKET form - * - * 2) MMPDU - * [CMD_INFO_T] - [prPacket] - [MSDU_INFO_T] - [prPacket] - direct buffer for frame body - * - * 3) Command Packets - * [CMD_INFO_T] - [pucInfoBuffer] - direct buffer for content of command packet - * - * 4) Normal data frame - * [MSDU_INFO_T] - [prPacket] - in skb or NDIS_PACKET form - */ - - -/* PS_FORWARDING_TYPE_NON_PS means that the receiving STA is in Active Mode -* from the perspective of host driver (maybe not synchronized with FW --> SN is needed) -*/ - -struct _MSDU_INFO_T { - QUE_ENTRY_T rQueEntry; - P_NATIVE_PACKET prPacket; - - ENUM_TX_PACKET_SRC_T eSrc; /* specify OS/FORWARD packet */ - UINT_8 ucUserPriority; - - /* For composing HIF TX header */ - UINT_8 ucTC; /* Traffic Class: 0~4 (HIF TX0), 5 (HIF TX1) */ - UINT_8 ucPacketType; /* 0: Data, 1: Command, 2: HIF Loopback 3: Management Frame */ - UINT_8 ucStaRecIndex; - UINT_8 ucNetworkType; /* See ENUM_NETWORK_TYPE_T */ - UINT_8 ucFormatID; /* 0: MAUI, Linux, Windows NDIS 5.1 */ - BOOLEAN fgIs802_1x; /* TRUE: 802.1x frame */ - BOOLEAN fgIs802_11; /* TRUE: 802.11 header is present */ - UINT_16 u2PalLLH; /* PAL Logical Link Header (for BOW network) */ - UINT_16 u2AclSN; /* ACL Sequence Number (for BOW network) */ - UINT_8 ucPsForwardingType; /* See ENUM_PS_FORWARDING_TYPE_T */ - UINT_8 ucPsSessionID; /* PS Session ID specified by the FW for the STA */ - BOOLEAN fgIsBurstEnd; /* TRUE means this is the last packet of the burst for (STA, TID) */ - BOOLEAN fgIsBIP; /* Management Frame Protection */ - BOOLEAN fgIsBasicRate; /* Force Basic Rate Transmission */ - - /* flattened from PACKET_INFO_T */ - UINT_8 ucMacHeaderLength; - UINT_8 ucLlcLength; /* w/o EtherType */ - UINT_16 u2FrameLength; - UINT_8 aucEthDestAddr[MAC_ADDR_LEN]; /* Ethernet Destination Address */ - - /* for TX done tracking */ - UINT_8 ucTxSeqNum; - PFN_TX_DONE_HANDLER pfTxDoneHandler; -}; - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -#define TX_INC_CNT(prTxCtrl, eCounter) \ - {((P_TX_CTRL_T)prTxCtrl)->au4Statistics[eCounter]++;} - -#define TX_ADD_CNT(prTxCtrl, eCounter, u8Amount) \ - {((P_TX_CTRL_T)prTxCtrl)->au4Statistics[eCounter] += (UINT_32)u8Amount;} - -#define TX_GET_CNT(prTxCtrl, eCounter) \ - (((P_TX_CTRL_T)prTxCtrl)->au4Statistics[eCounter]) - -#define TX_RESET_ALL_CNTS(prTxCtrl) \ - {kalMemZero(&prTxCtrl->au4Statistics[0], sizeof(prTxCtrl->au4Statistics));} - - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -VOID -nicTxInitialize ( - IN P_ADAPTER_T prAdapter - ); - -WLAN_STATUS -nicTxAcquireResource ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucTC - ); - -WLAN_STATUS -nicTxPollingResource ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucTC - ); - -BOOLEAN -nicTxReleaseResource ( - IN P_ADAPTER_T prAdapter, - IN UINT_8* aucTxRlsCnt - ); - -WLAN_STATUS -nicTxResetResource ( - IN P_ADAPTER_T prAdapter - ); - -UINT_8 -nicTxGetResource ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucTC - ); - -WLAN_STATUS -nicTxMsduInfoList ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfoListHead - ); - -WLAN_STATUS -nicTxMsduQueue ( - IN P_ADAPTER_T prAdapter, - UINT_8 ucPortIdx, - P_QUE_T prQue - ); - -WLAN_STATUS -nicTxCmd ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN UINT_8 ucTC - ); - -VOID -nicTxRelease ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicProcessTxInterrupt ( - IN P_ADAPTER_T prAdapter - ); - -VOID -nicTxFreeMsduInfoPacket ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfoListHead - ); - -VOID -nicTxReturnMsduInfo ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfoListHead - ); - -BOOLEAN -nicTxFillMsduInfo ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN P_NATIVE_PACKET prNdisPacket - ); - -WLAN_STATUS -nicTxAdjustTcq ( - IN P_ADAPTER_T prAdapter - ); - -WLAN_STATUS -nicTxFlush ( - IN P_ADAPTER_T prAdapter - ); - -#if CFG_ENABLE_FW_DOWNLOAD -WLAN_STATUS -nicTxInitCmd ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN UINT_8 ucTC - ); - -WLAN_STATUS -nicTxInitResetResource ( - IN P_ADAPTER_T prAdapter - ); -#endif - -WLAN_STATUS -nicTxEnqueueMsdu ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -UINT_32 -nicTxGetFreeCmdCount ( - IN P_ADAPTER_T prAdapter - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _NIC_TX_H */ - - diff --git a/drivers/net/wireless/mt5931/include/nic/p2p.h b/drivers/net/wireless/mt5931/include/nic/p2p.h deleted file mode 100755 index 30bae79019e1..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/p2p.h +++ /dev/null @@ -1,195 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/include/nic/p2p.h#3 $ -*/ - - - -/* -** $Log: p2p.h $ - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 10 20 2010 wh.su - * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group - * Add the code to support disconnect p2p group - * - * 09 21 2010 kevin.huang - * [WCXRP00000054] [MT6620 Wi-Fi][Driver] Restructure driver for second Interface - * Isolate P2P related function for Hardware Software Bundle - * - * 08 03 2010 cp.wu - * NULL - * [Wi-Fi Direct] add framework for driver hooks - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 23 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * p2p interface revised to be sync. with HAL - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 18 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add parameter to control: - * 1) auto group owner - * 2) P2P-PS parameter (CTWindow, NoA descriptors) - * - * 05 18 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * correct WPS Device Password ID definition. - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * implement get scan result. - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add basic handling framework for wireless extension ioctls. - * - * 05 14 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add ioctl framework for Wi-Fi Direct by reusing wireless extension ioctls as well - * - * 05 11 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * p2p ioctls revised. - * - * 05 10 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * implement basic wi-fi direct framework - * - * 05 07 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add basic framework for implementating P2P driver hook. - * - * -*/ - -#ifndef _P2P_H -#define _P2P_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -// refer to 'Config Methods' in WPS -#define WPS_CONFIG_USBA 0x0001 -#define WPS_CONFIG_ETHERNET 0x0002 -#define WPS_CONFIG_LABEL 0x0004 -#define WPS_CONFIG_DISPLAY 0x0008 -#define WPS_CONFIG_EXT_NFC 0x0010 -#define WPS_CONFIG_INT_NFC 0x0020 -#define WPS_CONFIG_NFC 0x0040 -#define WPS_CONFIG_PBC 0x0080 -#define WPS_CONFIG_KEYPAD 0x0100 - -// refer to 'Device Password ID' in WPS -#define WPS_DEV_PASSWORD_ID_PIN 0x0000 -#define WPS_DEV_PASSWORD_ID_USER 0x0001 -#define WPS_DEV_PASSWORD_ID_MACHINE 0x0002 -#define WPS_DEV_PASSWORD_ID_REKEY 0x0003 -#define WPS_DEV_PASSWORD_ID_PUSHBUTTON 0x0004 -#define WPS_DEV_PASSWORD_ID_REGISTRAR 0x0005 - - -#define P2P_DEVICE_TYPE_NUM 2 -#define P2P_DEVICE_NAME_LENGTH 32 -#define P2P_NETWORK_NUM 8 -#define P2P_MEMBER_NUM 8 - -#define P2P_WILDCARD_SSID "DIRECT-" - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -struct _P2P_INFO_T { - UINT_32 u4DeviceNum; - EVENT_P2P_DEV_DISCOVER_RESULT_T arP2pDiscoverResult[CFG_MAX_NUM_BSS_LIST]; - PUINT_8 pucCurrIePtr; - UINT_8 aucCommIePool[CFG_MAX_COMMON_IE_BUF_LEN]; /* A common pool for IE of all scan results. */ -}; - -typedef enum { - ENUM_P2P_PEER_GROUP, - ENUM_P2P_PEER_DEVICE, - ENUM_P2P_PEER_NUM -} ENUM_P2P_PEER_TYPE, *P_ENUM_P2P_PEER_TYPE; - -typedef struct _P2P_DEVICE_INFO { - UINT_8 aucDevAddr[PARAM_MAC_ADDR_LEN]; - UINT_8 aucIfAddr[PARAM_MAC_ADDR_LEN]; - UINT_8 ucDevCapabilityBitmap; - INT_32 i4ConfigMethod; - UINT_8 aucPrimaryDeviceType[8]; - UINT_8 aucSecondaryDeviceType[8]; - UINT_8 aucDeviceName[P2P_DEVICE_NAME_LENGTH]; -} P2P_DEVICE_INFO, *P_P2P_DEVICE_INFO; - -typedef struct _P2P_GROUP_INFO { - PARAM_SSID_T rGroupID; - P2P_DEVICE_INFO rGroupOwnerInfo; - UINT_8 ucMemberNum; - P2P_DEVICE_INFO arMemberInfo[P2P_MEMBER_NUM]; -} P2P_GROUP_INFO, *P_P2P_GROUP_INFO; - -typedef struct _P2P_NETWORK_INFO { - ENUM_P2P_PEER_TYPE eNodeType; - - union { - P2P_GROUP_INFO rGroupInfo; - P2P_DEVICE_INFO rDeviceInfo; - } node; - -} P2P_NETWORK_INFO, *P_P2P_NETWORK_INFO; - -typedef struct _P2P_NETWORK_LIST { - UINT_8 ucNetworkNum; - P2P_NETWORK_INFO rP2PNetworkInfo[P2P_NETWORK_NUM]; -} P2P_NETWORK_LIST, *P_P2P_NETWORK_LIST; - -typedef struct _P2P_DISCONNECT_INFO { - UINT_8 ucRole; - UINT_8 ucRsv[3]; -} P2P_DISCONNECT_INFO, *P_P2P_DISCONNECT_INFO; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -#endif /*_P2P_H */ diff --git a/drivers/net/wireless/mt5931/include/nic/p2p_cmd_buf.h b/drivers/net/wireless/mt5931/include/nic/p2p_cmd_buf.h deleted file mode 100755 index c59c60678d44..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/p2p_cmd_buf.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -** $Id: -*/ - -/*! \file "p2p_cmd_buf.h" - \brief In this file we define the structure for Command Packet. - - In this file we define the structure for Command Packet and the control unit - of MGMT Memory Pool. -*/ - - - -/* -** $Log: p2p_cmd_buf.h $ - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 12 22 2010 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * 1. header file restructure for more clear module isolation - * 2. add function interface definition for implementing Service Discovery callbacks -*/ - -#ifndef _P2P_CMD_BUF_H -#define _P2P_CMD_BUF_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/*--------------------------------------------------------------*/ -/* Firmware Command Packer */ -/*--------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSendSetQueryP2PCmd ( - IN P_ADAPTER_T prAdapter, - UINT_8 ucCID, - BOOLEAN fgSetQuery, - BOOLEAN fgNeedResp, - BOOLEAN fgIsOid, - PFN_CMD_DONE_HANDLER pfCmdDoneHandler, - PFN_CMD_TIMEOUT_HANDLER pfCmdTimeoutHandler, - UINT_32 u4SetQueryInfoLen, - PUINT_8 pucInfoBuffer, - OUT PVOID pvSetQueryBuffer, - IN UINT_32 u4SetQueryBufferLen - ); - - - - -#endif /* _P2P_CMD_BUF_H */ - - diff --git a/drivers/net/wireless/mt5931/include/nic/p2p_mac.h b/drivers/net/wireless/mt5931/include/nic/p2p_mac.h deleted file mode 100755 index 9c022b0193b8..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/p2p_mac.h +++ /dev/null @@ -1,223 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/include/nic/p2p_mac.h#2 $ -*/ - -/*! \file "p2p_mac.h" - \brief Brief description. - - Detail description. -*/ - - - - - -#ifndef _P2P_MAC_H -#define _P2P_MAC_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -#define ACTION_PUBLIC_WIFI_DIRECT 9 -#define ACTION_GAS_INITIAL_REQUEST 10 -#define ACTION_GAS_INITIAL_RESPONSE 11 -#define ACTION_GAS_COMEBACK_REQUEST 12 -#define ACTION_GAS_COMEBACK_RESPONSE 13 - - -/* P2P 4.2.8.1 - P2P Public Action Frame Type. */ -#define P2P_PUBLIC_ACTION_GO_NEGO_REQ 0 -#define P2P_PUBLIC_ACTION_GO_NEGO_RSP 1 -#define P2P_PUBLIC_ACTION_GO_NEGO_CFM 2 -#define P2P_PUBLIC_ACTION_INVITATION_REQ 3 -#define P2P_PUBLIC_ACTION_INVITATION_RSP 4 -#define P2P_PUBLIC_ACTION_DEV_DISCOVER_REQ 5 -#define P2P_PUBLIC_ACTION_DEV_DISCOVER_RSP 6 -#define P2P_PUBLIC_ACTION_PROV_DISCOVERY_REQ 7 -#define P2P_PUBLIC_ACTION_PROV_DISCOVERY_RSP 8 - -/* P2P 4.2.9.1 - P2P Action Frame Type */ -#define P2P_ACTION_NOTICE_OF_ABSENCE 0 -#define P2P_ACTION_P2P_PRESENCE_REQ 1 -#define P2P_ACTION_P2P_PRESENCE_RSP 2 -#define P2P_ACTION_GO_DISCOVER_REQ 3 - -#define P2P_PUBLIC_ACTION_FRAME_LEN (WLAN_MAC_MGMT_HEADER_LEN+8) -#define P2P_ACTION_FRAME_LEN (WLAN_MAC_MGMT_HEADER_LEN+7) - - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - - -/* P2P 4.2.8.2 P2P Public Action Frame Format */ -typedef struct _P2P_PUBLIC_ACTION_FRAME_T { - /* MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* P2P Public Action Frame Body */ - UINT_8 ucCategory; /* Category, 0x04 */ - UINT_8 ucAction; /* Action Value, 0x09 */ - UINT_8 aucOui[3]; /* 0x50, 0x6F, 0x9A */ - UINT_8 ucOuiType; /* 0x09 */ - UINT_8 ucOuiSubtype; /* GO Nego Req/Rsp/Cfm, P2P Invittion Req/Rsp, Device Discoverability Req/Rsp */ - UINT_8 ucDialogToken; /* Dialog Token. */ - UINT_8 aucInfoElem[1]; /* P2P IE, WSC IE. */ -} __KAL_ATTRIB_PACKED__ P2P_PUBLIC_ACTION_FRAME_T, *P_P2P_PUBLIC_ACTION_FRAME_T; - - -/* P2P 4.2.9.1 - General Action Frame Format. */ -typedef struct _P2P_ACTION_FRAME_T { - /* MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* P2P Action Frame Body */ - UINT_8 ucCategory; // 0x7F - UINT_8 aucOui[3]; // 0x50, 0x6F, 0x9A - UINT_8 ucOuiType; // 0x09 - UINT_8 ucOuiSubtype; // - UINT_8 ucDialogToken; - UINT_8 aucInfoElem[1]; -} __KAL_ATTRIB_PACKED__ P2P_ACTION_FRAME_T, *P_P2P_ACTION_FRAME_T; - -/* P2P C.1 GAS Public Action Initial Request Frame Format */ -typedef struct _GAS_PUBLIC_ACTION_INITIAL_REQUEST_FRAME_T { - /* MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* P2P Public Action Frame Body */ - UINT_8 ucCategory; /* Category, 0x04 */ - UINT_8 ucAction; /* Action Value, 0x09 */ - UINT_8 ucDialogToken; /* Dialog Token. */ - UINT_8 aucInfoElem[1]; /* Advertisement IE. */ -} __KAL_ATTRIB_PACKED__ GAS_PUBLIC_ACTION_INITIAL_REQUEST_FRAME_T, *P_GAS_PUBLIC_ACTION_INITIAL_REQUEST_FRAME_T; - -/* P2P C.2 GAS Public Action Initial Response Frame Format */ -typedef struct _GAS_PUBLIC_ACTION_INITIAL_RESPONSE_FRAME_T { - /* MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* P2P Public Action Frame Body */ - UINT_8 ucCategory; /* Category, 0x04 */ - UINT_8 ucAction; /* Action Value, 0x09 */ - UINT_8 ucDialogToken; /* Dialog Token. */ - UINT_16 u2StatusCode; /* Initial Response. */ - UINT_16 u2ComebackDelay; /* Initial Response. */ /* In unit of TU. */ - UINT_8 aucInfoElem[1]; /* Advertisement IE. */ -} __KAL_ATTRIB_PACKED__ GAS_PUBLIC_ACTION_INITIAL_RESPONSE_FRAME_T, *P_GAS_PUBLIC_ACTION_INITIAL_RESPONSE_FRAME_T; - - -/* P2P C.3-1 GAS Public Action Comeback Request Frame Format */ -typedef struct _GAS_PUBLIC_ACTION_COMEBACK_REQUEST_FRAME_T { - /* MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* P2P Public Action Frame Body */ - UINT_8 ucCategory; /* Category, 0x04 */ - UINT_8 ucAction; /* Action Value, 0x09 */ - UINT_8 ucDialogToken; /* Dialog Token. */ -} __KAL_ATTRIB_PACKED__ GAS_PUBLIC_ACTION_COMEBACK_REQUEST_FRAME_T, *P_GAS_PUBLIC_ACTION_COMEBACK_REQUEST_FRAME_T; - -/* P2P C.3-2 GAS Public Action Comeback Response Frame Format */ -typedef struct _GAS_PUBLIC_ACTION_COMEBACK_RESPONSE_FRAME_T { - /* MAC header */ - UINT_16 u2FrameCtrl; /* Frame Control */ - UINT_16 u2Duration; /* Duration */ - UINT_8 aucDestAddr[MAC_ADDR_LEN]; /* DA */ - UINT_8 aucSrcAddr[MAC_ADDR_LEN]; /* SA */ - UINT_8 aucBSSID[MAC_ADDR_LEN]; /* BSSID */ - UINT_16 u2SeqCtrl; /* Sequence Control */ - /* P2P Public Action Frame Body */ - UINT_8 ucCategory; /* Category, 0x04 */ - UINT_8 ucAction; /* Action Value, 0x09 */ - UINT_8 ucDialogToken; /* Dialog Token. */ - UINT_16 u2StatusCode; /* Comeback Response. */ - UINT_8 ucFragmentID; /*Comeback Response. */ - UINT_16 u2ComebackDelay; /* Comeback Response. */ - UINT_8 aucInfoElem[1]; /* Advertisement IE. */ -} __KAL_ATTRIB_PACKED__ GAS_PUBLIC_ACTION_COMEBACK_RESPONSE_FRAME_T, *P_GAS_PUBLIC_ACTION_COMEBACK_RESPONSE_FRAME_T; - - - - -typedef struct _P2P_SD_VENDER_SPECIFIC_CONTENT_T { - /* Service Discovery Vendor-specific Content. */ - UINT_8 ucOuiSubtype; // 0x09 - UINT_16 u2ServiceUpdateIndicator; - UINT_8 aucServiceTLV[1]; -} __KAL_ATTRIB_PACKED__ P2P_SD_VENDER_SPECIFIC_CONTENT_T, *P_P2P_SD_VENDER_SPECIFIC_CONTENT_T; - - -typedef struct _P2P_SERVICE_REQUEST_TLV_T { - UINT_16 u2Length; - UINT_8 ucServiceProtocolType; - UINT_8 ucServiceTransID; - UINT_8 aucQueryData[1]; -} __KAL_ATTRIB_PACKED__ P2P_SERVICE_REQUEST_TLV_T, *P_P2P_SERVICE_REQUEST_TLV_T; - - - -typedef struct _P2P_SERVICE_RESPONSE_TLV_T { - UINT_16 u2Length; - UINT_8 ucServiceProtocolType; - UINT_8 ucServiceTransID; - UINT_8 ucStatusCode; - UINT_8 aucResponseData[1]; -} __KAL_ATTRIB_PACKED__ P2P_SERVICE_RESPONSE_TLV_T, *P_P2P_SERVICE_RESPONSE_TLV_T; - - -#endif diff --git a/drivers/net/wireless/mt5931/include/nic/p2p_nic.h b/drivers/net/wireless/mt5931/include/nic/p2p_nic.h deleted file mode 100755 index 3f1363f77d1a..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/p2p_nic.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/include/nic/p2p_nic.h#1 $ -*/ - -/*! \file "p2p_nic.h" - \brief The declaration of nic functions - - Detail description. -*/ - - - - - -#ifndef _P2P_NIC_H -#define _P2P_NIC_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - - -VOID -nicP2pMediaStateChange( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkType, - IN P_EVENT_CONNECTION_STATUS prConnectionStatus - ); - -VOID -nicRxAddP2pDevice( - IN P_ADAPTER_T prAdapter, - IN P_EVENT_P2P_DEV_DISCOVER_RESULT_T prP2pResult, - IN PUINT_8 pucRxIEBuf, - IN UINT_16 u2RxIELength - ); - -#endif diff --git a/drivers/net/wireless/mt5931/include/nic/p2p_nic_cmd_event.h b/drivers/net/wireless/mt5931/include/nic/p2p_nic_cmd_event.h deleted file mode 100755 index fb056fff3598..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/p2p_nic_cmd_event.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/include/nic/p2p_nic_cmd_event.h#1 $ -*/ - -/*! \file p2p_nic_cmd_event.h - \brief -*/ - - - -#ifndef _P2P_NIC_CMD_EVENT_H -#define _P2P_NIC_CMD_EVENT_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - - -typedef struct _EVENT_P2P_DEV_DISCOVER_RESULT_T { -// UINT_8 aucCommunicateAddr[MAC_ADDR_LEN]; // Deprecated. - UINT_8 aucDeviceAddr[MAC_ADDR_LEN]; /* Device Address. */ - UINT_8 aucInterfaceAddr[MAC_ADDR_LEN]; /* Device Address. */ - UINT_8 ucDeviceCapabilityBitmap; - UINT_8 ucGroupCapabilityBitmap; - UINT_16 u2ConfigMethod; /* Configure Method. */ - P2P_DEVICE_TYPE_T rPriDevType; - UINT_8 ucSecDevTypeNum; - P2P_DEVICE_TYPE_T arSecDevType[2]; - UINT_16 u2NameLength; - UINT_8 aucName[32]; - PUINT_8 pucIeBuf; - UINT_16 u2IELength; - UINT_8 aucBSSID[MAC_ADDR_LEN]; - // TODO: Service Information or PasswordID valid? -} EVENT_P2P_DEV_DISCOVER_RESULT_T, *P_EVENT_P2P_DEV_DISCOVER_RESULT_T; - -#endif \ No newline at end of file diff --git a/drivers/net/wireless/mt5931/include/nic/que_mgt.h b/drivers/net/wireless/mt5931/include/nic/que_mgt.h deleted file mode 100755 index 65004743db8e..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/que_mgt.h +++ /dev/null @@ -1,1150 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/que_mgt.h#1 $ -*/ - -/*! \file "que_mgt.h" - \brief TX/RX queues management header file - - The main tasks of queue management include TC-based HIF TX flow control, - adaptive TC quota adjustment, HIF TX grant scheduling, Power-Save - forwarding control, RX packet reordering, and RX BA agreement management. -*/ - - - -/* -** $Log: que_mgt.h $ - * - * 08 15 2011 cp.wu - * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree - * add MT6628-specific definitions. - * - * 07 26 2011 eddie.chen - * [WCXRP00000874] [MT5931][DRV] API for query the RX reorder queued packets counter - * API for query the RX reorder queued packets counter. - * - * 06 14 2011 eddie.chen - * [WCXRP00000753] [MT5931 Wi-Fi][DRV] Adjust QM for MT5931 - * Change the parameter for WMM pass. - * - * 05 31 2011 eddie.chen - * [WCXRP00000753] [MT5931 Wi-Fi][DRV] Adjust QM for MT5931 - * Fix the QM quota in MT5931. - * - * 05 09 2011 eddie.chen - * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet - * Check free number before copying broadcast packet. - * - * 04 14 2011 eddie.chen - * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning - * Check the SW RFB free. Fix the compile warning.. - * - * 04 08 2011 eddie.chen - * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma - * Fix for sigma - * - * 03 28 2011 eddie.chen - * [WCXRP00000602] [MT6620 Wi-Fi][DRV] Fix wmm parameters in beacon for BOW - * Fix wmm parameters in beacon for BOW. - * - * 03 15 2011 eddie.chen - * [WCXRP00000554] [MT6620 Wi-Fi][DRV] Add sw control debug counter - * Add sw debug counter for QM. - * - * 02 17 2011 eddie.chen - * [WCXRP00000458] [MT6620 Wi-Fi][Driver] BOW Concurrent - ProbeResp was exist in other channel - * 1) Chnage GetFrameAction decision when BSS is absent. - * 2) Check channel and resource in processing ProbeRequest - * - * 01 12 2011 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, - -Add per station flow control when STA is in PS - - - * 1) Check Bss if support QoS before adding WMMIE - * 2) Check if support prAdapter->rWifiVar QoS and uapsd in flow control - * - * 12 29 2010 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, - -Add per station flow control when STA is in PS - - - * 1) PS flow control event - * - * 2) WMM IE in beacon, assoc resp, probe resp - * - * 12 23 2010 george.huang - * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function - * 1. update WMM IE parsing, with ASSOC REQ handling - * 2. extend U-APSD parameter passing from driver to FW - * - * 10 04 2010 cp.wu - * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by ENUM_NETWORK_TYPE_INDEX_T only - * remove ENUM_NETWORK_TYPE_T definitions - * - * 09 21 2010 kevin.huang - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * Eliminate Linux Compile Warning - * - * 08 04 2010 yarco.yang - * NULL - * Add TX_AMPDU and ADDBA_REJECT command - * - * 07 22 2010 george.huang - * - * Update fgIsQoS information in BSS INFO by CMD - * - * 07 16 2010 yarco.yang - * - * 1. Support BSS Absence/Presence Event - * 2. Support STA change PS mode Event - * 3. Support BMC forwarding for AP mode. - * - * 07 14 2010 yarco.yang - * - * 1. Remove CFG_MQM_MIGRATION - * 2. Add CMD_UPDATE_WMM_PARMS command - * - * 07 13 2010 yarco.yang - * - * [WPD00003849] - * [MT6620 and MT5931] SW Migration, add qmGetFrameAction() API for CMD Queue Processing - * - * 07 09 2010 yarco.yang - * - * [MT6620 and MT5931] SW Migration: Add ADDBA support - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 29 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * replace g_rQM with Adpater->rQM - * - * 06 25 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add API in que_mgt to retrieve sta-rec index for security frames. - * - * 06 23 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Merge g_arStaRec[] into adapter->arStaRec[] - * - * 06 21 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Support CFG_MQM_MIGRATION flag - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add hem_mbox.c and cnm_mem.h (but disabled some feature) for further migration - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 03 30 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Enabled adaptive TC resource control - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port - * - * 03 19 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * By default enabling dynamic STA_REC activation and decactivation - * - * 03 17 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Changed STA_REC index determination rules (DA=BMCAST always --> STA_REC_INDEX_BMCAST) - * - * 03 11 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Fixed buffer leak when processing BAR frames - * - * 02 25 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Enabled multi-STA TX path with fairness - * - * 02 24 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Enabled dynamically activating and deactivating STA_RECs - * - * 02 24 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Added code for dynamic activating and deactivating STA_RECs. - * - * 01 13 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Enabled the Burst_End Indication mechanism -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-12-09 14:04:53 GMT MTK02468 -** Added RX buffer reordering function prototypes -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-12-02 22:08:44 GMT MTK02468 -** Added macro QM_INIT_STA_REC for initialize a STA_REC -** \main\maintrunk.MT6620WiFiDriver_Prj\1 2009-11-23 21:58:43 GMT mtk02468 -** Initial version -** -*/ - -#ifndef _QUE_MGT_H -#define _QUE_MGT_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/* Queue Manager Features */ -#define QM_BURST_END_INFO_ENABLED 1 /* 1: Indicate the last TX packet to the FW for each burst */ -#define QM_FORWARDING_FAIRNESS 1 /* 1: To fairly share TX resource among active STAs */ -#define QM_ADAPTIVE_TC_RESOURCE_CTRL 1 /* 1: To adaptively adjust resource for each TC */ -#define QM_PRINT_TC_RESOURCE_CTRL 0 /* 1: To print TC resource adjustment results */ -#define QM_RX_WIN_SSN_AUTO_ADVANCING 1 /* 1: If pkt with SSN is missing, auto advance the RX reordering window */ -#define QM_RX_INIT_FALL_BEHIND_PASS 1 /* 1: Indicate the packets falling behind to OS before the frame with SSN is received */ -/* Parameters */ -#define QM_INIT_TIME_TO_UPDATE_QUE_LEN 60 /* p: Update queue lengths when p TX packets are enqueued */ -#define QM_INIT_TIME_TO_ADJUST_TC_RSC 3 /* s: Adjust the TC resource every s updates of queue lengths */ -#define QM_QUE_LEN_MOVING_AVE_FACTOR 3 /* Factor for Que Len averaging */ - -#define QM_MIN_RESERVED_TC0_RESOURCE 1 -#define QM_MIN_RESERVED_TC1_RESOURCE 1 -#define QM_MIN_RESERVED_TC2_RESOURCE 1 -#define QM_MIN_RESERVED_TC3_RESOURCE 1 -#define QM_MIN_RESERVED_TC4_RESOURCE 2 /* Resource for TC4 is not adjustable */ -#define QM_MIN_RESERVED_TC5_RESOURCE 1 - -#if defined(MT6620) - -#define QM_GUARANTEED_TC0_RESOURCE 4 -#define QM_GUARANTEED_TC1_RESOURCE 4 -#define QM_GUARANTEED_TC2_RESOURCE 9 -#define QM_GUARANTEED_TC3_RESOURCE 11 -#define QM_GUARANTEED_TC4_RESOURCE 2 /* Resource for TC4 is not adjustable */ -#define QM_GUARANTEED_TC5_RESOURCE 4 - -#elif defined(MT5931) - -#define QM_GUARANTEED_TC0_RESOURCE 4 -#define QM_GUARANTEED_TC1_RESOURCE 4 -#define QM_GUARANTEED_TC2_RESOURCE 4 -#define QM_GUARANTEED_TC3_RESOURCE 4 -#define QM_GUARANTEED_TC4_RESOURCE 2 /* Resource for TC4 is not adjustable */ -#define QM_GUARANTEED_TC5_RESOURCE 2 - -#elif defined(MT6628) - -#define QM_GUARANTEED_TC0_RESOURCE 4 -#define QM_GUARANTEED_TC1_RESOURCE 4 -#define QM_GUARANTEED_TC2_RESOURCE 6 -#define QM_GUARANTEED_TC3_RESOURCE 6 -#define QM_GUARANTEED_TC4_RESOURCE 2 /* Resource for TC4 is not adjustable */ -#define QM_GUARANTEED_TC5_RESOURCE 4 - - -#else -#error -#endif - - - -#define QM_EXTRA_RESERVED_RESOURCE_WHEN_BUSY 0 - -#define QM_TOTAL_TC_RESOURCE (\ - NIC_TX_BUFF_COUNT_TC0 + NIC_TX_BUFF_COUNT_TC1 +\ - NIC_TX_BUFF_COUNT_TC2 + NIC_TX_BUFF_COUNT_TC3 +\ - NIC_TX_BUFF_COUNT_TC5) -#define QM_AVERAGE_TC_RESOURCE 6 - -/* Note: QM_INITIAL_RESIDUAL_TC_RESOURCE shall not be less than 0 */ -#define QM_INITIAL_RESIDUAL_TC_RESOURCE (QM_TOTAL_TC_RESOURCE - \ - (QM_GUARANTEED_TC0_RESOURCE +\ - QM_GUARANTEED_TC1_RESOURCE +\ - QM_GUARANTEED_TC2_RESOURCE +\ - QM_GUARANTEED_TC3_RESOURCE +\ - QM_GUARANTEED_TC5_RESOURCE \ - )) - -/* Hard-coded network type for Phase 3: NETWORK_TYPE_AIS/P2P/BOW */ -#define QM_OPERATING_NETWORK_TYPE NETWORK_TYPE_AIS - -#define QM_TEST_MODE 0 -#define QM_TEST_TRIGGER_TX_COUNT 50 -#define QM_TEST_STA_REC_DETERMINATION 0 -#define QM_TEST_STA_REC_DEACTIVATION 0 -#define QM_TEST_FAIR_FORWARDING 0 - -#define QM_DEBUG_COUNTER 0 - -/* Per-STA Queues: [0] AC0, [1] AC1, [2] AC2, [3] AC3, [4] 802.1x */ -/* Per-Type Queues: [0] BMCAST */ -#define NUM_OF_PER_STA_TX_QUEUES 5 -#define NUM_OF_PER_TYPE_TX_QUEUES 1 - -/* These two constants are also used for FW to verify the STA_REC index */ -#define STA_REC_INDEX_BMCAST 0xFF -#define STA_REC_INDEX_NOT_FOUND 0xFE - -/* TX Queue Index */ -#define TX_QUEUE_INDEX_BMCAST 0 -#define TX_QUEUE_INDEX_NO_STA_REC 0 -#define TX_QUEUE_INDEX_AC0 0 -#define TX_QUEUE_INDEX_AC1 1 -#define TX_QUEUE_INDEX_AC2 2 -#define TX_QUEUE_INDEX_AC3 3 -#define TX_QUEUE_INDEX_802_1X 4 -#define TX_QUEUE_INDEX_NON_QOS 1 - - -//1 WMM-related -/* WMM FLAGS */ -#define WMM_FLAG_SUPPORT_WMM BIT(0) -#define WMM_FLAG_SUPPORT_WMMSA BIT(1) -#define WMM_FLAG_AC_PARAM_PRESENT BIT(2) -#define WMM_FLAG_SUPPORT_UAPSD BIT(3) - -/* WMM Admission Control Mandatory FLAGS */ -#define ACM_FLAG_ADM_NOT_REQUIRED 0 -#define ACM_FLAG_ADM_GRANTED BIT(0) -#define ACM_FLAG_ADM_REQUIRED BIT(1) - -/* WMM Power Saving FLAGS */ -#define AC_FLAG_TRIGGER_ENABLED BIT(1) -#define AC_FLAG_DELIVERY_ENABLED BIT(2) - -/* WMM-2.2.1 WMM Information Element */ -#define ELEM_MAX_LEN_WMM_INFO 7 - -/* WMM-2.2.2 WMM Parameter Element */ -#define ELEM_MAX_LEN_WMM_PARAM 24 - -/* WMM-2.2.1 WMM QoS Info field */ -#define WMM_QOS_INFO_PARAM_SET_CNT BITS(0,3) /* Sent by AP */ -#define WMM_QOS_INFO_UAPSD BIT(7) - -#define WMM_QOS_INFO_VO_UAPSD BIT(0) /* Sent by non-AP STA */ -#define WMM_QOS_INFO_VI_UAPSD BIT(1) -#define WMM_QOS_INFO_BK_UAPSD BIT(2) -#define WMM_QOS_INFO_BE_UAPSD BIT(3) -#define WMM_QOS_INFO_MAX_SP_LEN_MASK BITS(5,6) -#define WMM_QOS_INFO_MAX_SP_ALL 0 -#define WMM_QOS_INFO_MAX_SP_2 BIT(5) -#define WMM_QOS_INFO_MAX_SP_4 BIT(6) -#define WMM_QOS_INFO_MAX_SP_6 BITS(5,6) - -/* -- definitions for Max SP length field */ -#define WMM_MAX_SP_LENGTH_ALL 0 -#define WMM_MAX_SP_LENGTH_2 2 -#define WMM_MAX_SP_LENGTH_4 4 -#define WMM_MAX_SP_LENGTH_6 6 - - -/* WMM-2.2.2 WMM ACI/AIFSN field */ -/* -- subfields in the ACI/AIFSN field */ -#define WMM_ACIAIFSN_AIFSN BITS(0,3) -#define WMM_ACIAIFSN_ACM BIT(4) -#define WMM_ACIAIFSN_ACI BITS(5,6) -#define WMM_ACIAIFSN_ACI_OFFSET 5 - -/* -- definitions for ACI field */ -#define WMM_ACI_AC_BE 0 -#define WMM_ACI_AC_BK BIT(5) -#define WMM_ACI_AC_VI BIT(6) -#define WMM_ACI_AC_VO BITS(5,6) - -#define WMM_ACI(_AC) (_AC << WMM_ACIAIFSN_ACI_OFFSET) - -/* -- definitions for ECWmin/ECWmax field */ -#define WMM_ECW_WMIN_MASK BITS(0,3) -#define WMM_ECW_WMAX_MASK BITS(4,7) -#define WMM_ECW_WMAX_OFFSET 4 - -#define TXM_DEFAULT_FLUSH_QUEUE_GUARD_TIME 0 /* Unit: 64 us */ - -#define QM_RX_BA_ENTRY_MISS_TIMEOUT_MS (1000) - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -enum { - QM_DBG_CNT_00=0, - QM_DBG_CNT_01, - QM_DBG_CNT_02, - QM_DBG_CNT_03, - QM_DBG_CNT_04, - QM_DBG_CNT_05, - QM_DBG_CNT_06, - QM_DBG_CNT_07, - QM_DBG_CNT_08, - QM_DBG_CNT_09, - QM_DBG_CNT_10, - QM_DBG_CNT_11, - QM_DBG_CNT_12, - QM_DBG_CNT_13, - QM_DBG_CNT_14, - QM_DBG_CNT_15, - QM_DBG_CNT_16, - QM_DBG_CNT_17, - QM_DBG_CNT_18, - QM_DBG_CNT_19, - QM_DBG_CNT_20, - QM_DBG_CNT_21, - QM_DBG_CNT_22, - QM_DBG_CNT_23, - QM_DBG_CNT_24, - QM_DBG_CNT_25, - QM_DBG_CNT_26, - QM_DBG_CNT_27, - QM_DBG_CNT_28, - QM_DBG_CNT_29, - QM_DBG_CNT_30, - QM_DBG_CNT_31, - QM_DBG_CNT_NUM -}; - - - - -/* Used for MAC TX */ -typedef enum _ENUM_MAC_TX_QUEUE_INDEX_T { - MAC_TX_QUEUE_AC0_INDEX = 0, - MAC_TX_QUEUE_AC1_INDEX, - MAC_TX_QUEUE_AC2_INDEX, - MAC_TX_QUEUE_AC3_INDEX, - MAC_TX_QUEUE_AC4_INDEX, - MAC_TX_QUEUE_AC5_INDEX, - MAC_TX_QUEUE_AC6_INDEX, - MAC_TX_QUEUE_BCN_INDEX, - MAC_TX_QUEUE_BMC_INDEX, - MAC_TX_QUEUE_NUM -} ENUM_MAC_TX_QUEUE_INDEX_T; - -typedef struct _RX_BA_ENTRY_T { - BOOLEAN fgIsValid; - QUE_T rReOrderQue; - UINT_16 u2WinStart; - UINT_16 u2WinEnd; - UINT_16 u2WinSize; - - /* For identifying the RX BA agreement */ - UINT_8 ucStaRecIdx; - UINT_8 ucTid; - - BOOLEAN fgIsWaitingForPktWithSsn; - - //UINT_8 ucTxBufferSize; - //BOOL fgIsAcConstrain; - //BOOL fgIsBaEnabled; -} RX_BA_ENTRY_T, *P_RX_BA_ENTRY_T; - -/* The mailbox message (could be used for Host-To-Device or Device-To-Host Mailbox) */ -typedef struct _MAILBOX_MSG_T{ - UINT_32 u4Msg[2]; /* [0]: D2HRM0R or H2DRM0R, [1]: D2HRM1R or H2DRM1R */ -} MAILBOX_MSG_T, *P_MAILBOX_MSG_T; - - -/* Used for adaptively adjusting TC resources */ -typedef struct _TC_RESOURCE_CTRL_T { - /* TC0, TC1, TC2, TC3, TC5 */ - UINT_32 au4AverageQueLen[TC_NUM - 1]; -} TC_RESOURCE_CTRL_T, *P_TC_RESOURCE_CTRL_T; - -typedef struct _QUE_MGT_T{ /* Queue Management Control Info */ - - /* Per-Type Queues: [0] BMCAST or UNKNOWN-STA packets */ - QUE_T arTxQueue[NUM_OF_PER_TYPE_TX_QUEUES]; - -#if 0 - /* For TX Scheduling */ - UINT_8 arRemainingTxOppt[NUM_OF_PER_STA_TX_QUEUES]; - UINT_8 arCurrentTxStaIndex[NUM_OF_PER_STA_TX_QUEUES]; - -#endif - - /* Reordering Queue Parameters */ - RX_BA_ENTRY_T arRxBaTable[CFG_NUM_OF_RX_BA_AGREEMENTS]; - - /* Current number of activated RX BA agreements <= CFG_NUM_OF_RX_BA_AGREEMENTS */ - UINT_8 ucRxBaCount; - -#if QM_TEST_MODE - UINT_32 u4PktCount; - P_ADAPTER_T prAdapter; - -#if QM_TEST_FAIR_FORWARDING - UINT_32 u4CurrentStaRecIndexToEnqueue; -#endif - -#endif - - -#if QM_FORWARDING_FAIRNESS - /* The current TX count for a STA with respect to a TC index */ - UINT_32 au4ForwardCount[NUM_OF_PER_STA_TX_QUEUES]; - - /* The current serving STA with respect to a TC index */ - UINT_32 au4HeadStaRecIndex [NUM_OF_PER_STA_TX_QUEUES]; -#endif - -#if QM_ADAPTIVE_TC_RESOURCE_CTRL - UINT_32 au4AverageQueLen[TC_NUM]; - UINT_32 au4CurrentTcResource[TC_NUM]; - UINT_32 au4MinReservedTcResource[TC_NUM]; /* The minimum amount of resource no matter busy or idle */ - UINT_32 au4GuaranteedTcResource[TC_NUM]; /* The minimum amount of resource when extremely busy */ - - UINT_32 u4TimeToAdjustTcResource; - UINT_32 u4TimeToUpdateQueLen; - - /* Set to TRUE if the last TC adjustment has not been completely applied (i.e., waiting more TX-Done events - to align the TC quotas to the TC resource assignment) */ - BOOLEAN fgTcResourcePostAnnealing; - -#endif - -#if QM_DEBUG_COUNTER - UINT_32 au4QmDebugCounters[QM_DBG_CNT_NUM]; -#endif - - - - -} QUE_MGT_T, *P_QUE_MGT_T; - - - -typedef struct _EVENT_RX_ADDBA_T { - /* Event header */ - UINT_16 u2Length; - UINT_16 u2Reserved1; /* Must be filled with 0x0001 (EVENT Packet) */ - UINT_8 ucEID; - UINT_8 ucSeqNum; - UINT_8 aucReserved2[2]; - - /* Fields not present in the received ADDBA_REQ */ - UINT_8 ucStaRecIdx; - - /* Fields that are present in the received ADDBA_REQ */ - UINT_8 ucDialogToken; /* Dialog Token chosen by the sender */ - UINT_16 u2BAParameterSet; /* BA policy, TID, buffer size */ - UINT_16 u2BATimeoutValue; - UINT_16 u2BAStartSeqCtrl; /* SSN */ - -} EVENT_RX_ADDBA_T, *P_EVENT_RX_ADDBA_T; - -typedef struct _EVENT_RX_DELBA_T { - /* Event header */ - UINT_16 u2Length; - UINT_16 u2Reserved1; /* Must be filled with 0x0001 (EVENT Packet) */ - UINT_8 ucEID; - UINT_8 ucSeqNum; - UINT_8 aucReserved2[2]; - - /* Fields not present in the received ADDBA_REQ */ - UINT_8 ucStaRecIdx; - UINT_8 ucTid; -} EVENT_RX_DELBA_T, *P_EVENT_RX_DELBA_T; - - -typedef struct _EVENT_BSS_ABSENCE_PRESENCE_T { - /* Event header */ - UINT_16 u2Length; - UINT_16 u2Reserved1; /* Must be filled with 0x0001 (EVENT Packet) */ - UINT_8 ucEID; - UINT_8 ucSeqNum; - UINT_8 aucReserved2[2]; - - /* Event Body */ - UINT_8 ucNetTypeIdx; - BOOLEAN fgIsAbsent; - UINT_8 ucBssFreeQuota; - UINT_8 aucReserved[1]; -} EVENT_BSS_ABSENCE_PRESENCE_T, *P_EVENT_BSS_ABSENCE_PRESENCE_T; - - -typedef struct _EVENT_STA_CHANGE_PS_MODE_T { - /* Event header */ - UINT_16 u2Length; - UINT_16 u2Reserved1; /* Must be filled with 0x0001 (EVENT Packet) */ - UINT_8 ucEID; - UINT_8 ucSeqNum; - UINT_8 aucReserved2[2]; - - /* Event Body */ - UINT_8 ucStaRecIdx; - BOOLEAN fgIsInPs; - UINT_8 ucUpdateMode; - UINT_8 ucFreeQuota; -} EVENT_STA_CHANGE_PS_MODE_T, *P_EVENT_STA_CHANGE_PS_MODE_T; - -/* The free quota is used by PS only now */ -/* The event may be used by per STA flow conttrol in general */ -typedef struct _EVENT_STA_UPDATE_FREE_QUOTA_T { - /* Event header */ - UINT_16 u2Length; - UINT_16 u2Reserved1; /* Must be filled with 0x0001 (EVENT Packet) */ - UINT_8 ucEID; - UINT_8 ucSeqNum; - UINT_8 aucReserved2[2]; - - /* Event Body */ - UINT_8 ucStaRecIdx; - UINT_8 ucUpdateMode; - UINT_8 ucFreeQuota; - UINT_8 aucReserved[1]; -} EVENT_STA_UPDATE_FREE_QUOTA_T, *P_EVENT_STA_UPDATE_FREE_QUOTA_T; - - - - -/* WMM-2.2.1 WMM Information Element */ -typedef struct _IE_WMM_INFO_T { - UINT_8 ucId; /* Element ID */ - UINT_8 ucLength; /* Length */ - UINT_8 aucOui[3]; /* OUI */ - UINT_8 ucOuiType; /* OUI Type */ - UINT_8 ucOuiSubtype; /* OUI Subtype */ - UINT_8 ucVersion; /* Version */ - UINT_8 ucQosInfo; /* QoS Info field */ - UINT_8 ucDummy[3]; /* Dummy for pack */ -} IE_WMM_INFO_T, *P_IE_WMM_INFO_T; - -/* WMM-2.2.2 WMM Parameter Element */ -typedef struct _IE_WMM_PARAM_T { - UINT_8 ucId; /* Element ID */ - UINT_8 ucLength; /* Length */ - - /* IE Body */ - UINT_8 aucOui[3]; /* OUI */ - UINT_8 ucOuiType; /* OUI Type */ - UINT_8 ucOuiSubtype; /* OUI Subtype */ - UINT_8 ucVersion; /* Version */ - - /* WMM IE Body */ - UINT_8 ucQosInfo; /* QoS Info field */ - UINT_8 ucReserved; - - /* AC Parameters */ - UINT_8 ucAciAifsn_BE; - UINT_8 ucEcw_BE; - UINT_8 aucTxopLimit_BE[2]; - - UINT_8 ucAciAifsn_BG; - UINT_8 ucEcw_BG; - UINT_8 aucTxopLimit_BG[2]; - - UINT_8 ucAciAifsn_VI; - UINT_8 ucEcw_VI; - UINT_8 aucTxopLimit_VI[2]; - - UINT_8 ucAciAifsn_VO; - UINT_8 ucEcw_VO; - UINT_8 aucTxopLimit_VO[2]; - -} IE_WMM_PARAM_T, *P_IE_WMM_PARAM_T; - -typedef struct _IE_WMM_TSPEC_T { - UINT_8 ucId; /* Element ID */ - UINT_8 ucLength; /* Length */ - UINT_8 aucOui[3]; /* OUI */ - UINT_8 ucOuiType; /* OUI Type */ - UINT_8 ucOuiSubtype; /* OUI Subtype */ - UINT_8 ucVersion; /* Version */ - /* WMM TSPEC body */ - UINT_8 aucTsInfo[3]; /* TS Info */ - UINT_8 aucTspecBodyPart[1]; /* Note: Utilize PARAM_QOS_TSPEC to fill (memory copy) */ -} IE_WMM_TSPEC_T, *P_IE_WMM_TSPEC_T; - -typedef struct _IE_WMM_HDR_T { - UINT_8 ucId; /* Element ID */ - UINT_8 ucLength; /* Length */ - UINT_8 aucOui[3]; /* OUI */ - UINT_8 ucOuiType; /* OUI Type */ - UINT_8 ucOuiSubtype; /* OUI Subtype */ - UINT_8 ucVersion; /* Version */ - UINT_8 aucBody[1]; /* IE body */ -} IE_WMM_HDR_T, *P_IE_WMM_HDR_T; - - -typedef struct _AC_QUE_PARMS_T{ - UINT_16 u2CWmin; /*!< CWmin */ - UINT_16 u2CWmax; /*!< CWmax */ - UINT_16 u2TxopLimit; /*!< TXOP limit */ - UINT_16 u2Aifsn; /*!< AIFSN */ - UINT_8 ucGuradTime; /*!< GuardTime for STOP/FLUSH. */ - BOOLEAN fgIsACMSet; -} AC_QUE_PARMS_T, *P_AC_QUE_PARMS_T; - -/* WMM ACI (AC index) */ -typedef enum _ENUM_WMM_ACI_T { - WMM_AC_BE_INDEX = 0, - WMM_AC_BK_INDEX, - WMM_AC_VI_INDEX, - WMM_AC_VO_INDEX, - WMM_AC_INDEX_NUM -} ENUM_WMM_ACI_T, *P_ENUM_WMM_ACI_T; - - -/* Used for CMD Queue Operation */ -typedef enum _ENUM_FRAME_ACTION_T { - FRAME_ACTION_DROP_PKT = 0, - FRAME_ACTION_QUEUE_PKT, - FRAME_ACTION_TX_PKT, - FRAME_ACTION_NUM -} ENUM_FRAME_ACTION_T; - - -typedef enum _ENUM_FRAME_TYPE_IN_CMD_Q_T { - FRAME_TYPE_802_1X = 0, - FRAME_TYPE_MMPDU, - FRAME_TYEP_NUM -} ENUM_FRAME_TYPE_IN_CMD_Q_T; - -typedef enum _ENUM_FREE_QUOTA_MODET_T { - FREE_QUOTA_UPDATE_MODE_INIT = 0, - FREE_QUOTA_UPDATE_MODE_OVERWRITE, - FREE_QUOTA_UPDATE_MODE_INCREASE, - FREE_QUOTA_UPDATE_MODE_DECREASE -} ENUM_FREE_QUOTA_MODET_T, *P_ENUM_FREE_QUOTA_MODET_T; - - - -typedef struct _CMD_UPDATE_WMM_PARMS_T { - AC_QUE_PARMS_T arACQueParms[AC_NUM]; - UINT_8 ucNetTypeIndex; - UINT_8 fgIsQBSS; - UINT_8 aucReserved[2]; -} CMD_UPDATE_WMM_PARMS_T, *P_CMD_UPDATE_WMM_PARMS_T; - - -typedef struct _CMD_TX_AMPDU_T { - BOOLEAN fgEnable; - UINT_8 aucReserved[3]; -} CMD_TX_AMPDU_T, *P_CMD_TX_AMPDU_T; - - -typedef struct _CMD_ADDBA_REJECT { - BOOLEAN fgEnable; - UINT_8 aucReserved[3]; -} CMD_ADDBA_REJECT_T, *P_CMD_ADDBA_REJECT_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -#define QM_TX_SET_NEXT_MSDU_INFO(_prMsduInfoPreceding, _prMsduInfoNext) \ - ((((_prMsduInfoPreceding)->rQueEntry).prNext) = (P_QUE_ENTRY_T)(_prMsduInfoNext)) - -#define QM_TX_SET_NEXT_SW_RFB(_prSwRfbPreceding, _prSwRfbNext) \ - ((((_prSwRfbPreceding)->rQueEntry).prNext) = (P_QUE_ENTRY_T)(_prSwRfbNext)) - - -#define QM_TX_GET_NEXT_MSDU_INFO(_prMsduInfo) \ - ((P_MSDU_INFO_T)(((_prMsduInfo)->rQueEntry).prNext)) - -#define QM_RX_SET_NEXT_SW_RFB(_prSwRfbPreceding, _prSwRfbNext) \ - ((((_prSwRfbPreceding)->rQueEntry).prNext) = (P_QUE_ENTRY_T)(_prSwRfbNext)) - -#define QM_RX_GET_NEXT_SW_RFB(_prSwRfb) \ - ((P_SW_RFB_T)(((_prSwRfb)->rQueEntry).prNext)) - -#if 0 -#define QM_GET_STA_REC_PTR_FROM_INDEX(_prAdapter, _ucIndex) \ - ((((_ucIndex) != STA_REC_INDEX_BMCAST) && ((_ucIndex)!= STA_REC_INDEX_NOT_FOUND)) ?\ - &(_prAdapter->arStaRec[_ucIndex]): NULL) -#endif - -#define QM_GET_STA_REC_PTR_FROM_INDEX(_prAdapter, _ucIndex) \ - cnmGetStaRecByIndex(_prAdapter,_ucIndex) - - -#define QM_TX_SET_MSDU_INFO_FOR_DATA_PACKET(\ - _prMsduInfo,\ - _ucTC,\ - _ucPacketType,\ - _ucFormatID,\ - _fgIs802_1x,\ - _fgIs802_11,\ - _u2PalLLH,\ - _u2AclSN,\ - _ucPsForwardingType,\ - _ucPsSessionID\ - ) \ -{\ - ASSERT(_prMsduInfo);\ - (_prMsduInfo)->ucTC = (_ucTC);\ - (_prMsduInfo)->ucPacketType = (_ucPacketType);\ - (_prMsduInfo)->ucFormatID = (_ucFormatID);\ - (_prMsduInfo)->fgIs802_1x = (_fgIs802_1x);\ - (_prMsduInfo)->fgIs802_11 = (_fgIs802_11);\ - (_prMsduInfo)->u2PalLLH = (_u2PalLLH);\ - (_prMsduInfo)->u2AclSN = (_u2AclSN);\ - (_prMsduInfo)->ucPsForwardingType = (_ucPsForwardingType);\ - (_prMsduInfo)->ucPsSessionID = (_ucPsSessionID);\ - (_prMsduInfo)->fgIsBurstEnd = (FALSE);\ -} - -#define QM_INIT_STA_REC(\ - _prStaRec,\ - _fgIsValid,\ - _fgIsQoS,\ - _pucMacAddr\ - )\ -{\ - ASSERT(_prStaRec);\ - (_prStaRec)->fgIsValid = (_fgIsValid);\ - (_prStaRec)->fgIsQoS = (_fgIsQoS);\ - (_prStaRec)->fgIsInPS = FALSE; \ - (_prStaRec)->ucPsSessionID = 0xFF;\ - COPY_MAC_ADDR((_prStaRec)->aucMacAddr,(_pucMacAddr));\ -} - -#if QM_ADAPTIVE_TC_RESOURCE_CTRL -#define QM_GET_TX_QUEUE_LEN(_prAdapter, _u4QueIdx) ((_prAdapter->rQM.au4AverageQueLen[(_u4QueIdx)] >> QM_QUE_LEN_MOVING_AVE_FACTOR)) -#endif - - -#define WMM_IE_OUI_TYPE(fp) (((P_IE_WMM_HDR_T)(fp))->ucOuiType) -#define WMM_IE_OUI_SUBTYPE(fp) (((P_IE_WMM_HDR_T)(fp))->ucOuiSubtype) -#define WMM_IE_OUI(fp) (((P_IE_WMM_HDR_T)(fp))->aucOui) - -#if QM_DEBUG_COUNTER -#define QM_DBG_CNT_INC(_prQM, _index) { (_prQM)->au4QmDebugCounters[(_index)]++; } -#else -#define QM_DBG_CNT_INC(_prQM, _index) {} -#endif - - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Queue Management and STA_REC Initialization */ -/*----------------------------------------------------------------------------*/ - -VOID -qmInit( - IN P_ADAPTER_T prAdapter - ); - -#if QM_TEST_MODE -VOID -qmTestCases( - IN P_ADAPTER_T prAdapter - ); -#endif - -VOID -qmActivateStaRec( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -VOID -qmDeactivateStaRec( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4StaRecIdx - ); - - -/*----------------------------------------------------------------------------*/ -/* TX-Related Queue Management */ -/*----------------------------------------------------------------------------*/ - -P_MSDU_INFO_T -qmFlushTxQueues( - IN P_ADAPTER_T prAdapter - ); - -P_MSDU_INFO_T -qmFlushStaTxQueues( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4StaRecIdx - ); - -P_MSDU_INFO_T -qmEnqueueTxPackets( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfoListHead - ); - -P_MSDU_INFO_T -qmDequeueTxPackets( - IN P_ADAPTER_T prAdapter, - IN P_TX_TCQ_STATUS_T prTcqStatus - ); - -VOID -qmAdjustTcQuotas ( - IN P_ADAPTER_T prAdapter, - OUT P_TX_TCQ_ADJUST_T prTcqAdjust, - IN P_TX_TCQ_STATUS_T prTcqStatus - ); - - -#if QM_ADAPTIVE_TC_RESOURCE_CTRL -VOID -qmReassignTcResource( - IN P_ADAPTER_T prAdapter - ); - -VOID -qmUpdateAverageTxQueLen( - IN P_ADAPTER_T prAdapter - ); -#endif - - -/*----------------------------------------------------------------------------*/ -/* RX-Related Queue Management */ -/*----------------------------------------------------------------------------*/ - -VOID -qmInitRxQueues( - IN P_ADAPTER_T prAdapter - ); - -P_SW_RFB_T -qmFlushRxQueues( - IN P_ADAPTER_T prAdapter - ); - -P_SW_RFB_T -qmHandleRxPackets( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfbListHead - ); - -VOID -qmProcessPktWithReordering( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT P_QUE_T prReturnedQue - ); - -VOID -qmProcessBarFrame( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT P_QUE_T prReturnedQue - ); - -VOID -qmInsertFallWithinReorderPkt( - IN P_SW_RFB_T prSwRfb, - IN P_RX_BA_ENTRY_T prReorderQueParm, - OUT P_QUE_T prReturnedQue - ); - -VOID -qmInsertFallAheadReorderPkt( - IN P_SW_RFB_T prSwRfb, - IN P_RX_BA_ENTRY_T prReorderQueParm, - OUT P_QUE_T prReturnedQue - ); - -VOID -qmPopOutDueToFallWithin( - IN P_RX_BA_ENTRY_T prReorderQueParm, - OUT P_QUE_T prReturnedQue - ); - -VOID -qmPopOutDueToFallAhead( - IN P_RX_BA_ENTRY_T prReorderQueParm, - OUT P_QUE_T prReturnedQue - ); - - -VOID -qmHandleMailboxRxMessage( - IN MAILBOX_MSG_T prMailboxRxMsg - ); - -BOOLEAN -qmCompareSnIsLessThan( - IN UINT_32 u4SnLess, - IN UINT_32 u4SnGreater - ); - -VOID -qmHandleEventRxAddBa( - IN P_ADAPTER_T prAdapter, - IN P_WIFI_EVENT_T prEvent - ); - -VOID -qmHandleEventRxDelBa( - IN P_ADAPTER_T prAdapter, - IN P_WIFI_EVENT_T prEvent - ); - -P_RX_BA_ENTRY_T -qmLookupRxBaEntry( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucStaRecIdx, - IN UINT_8 ucTid - ); - -BOOL -qmAddRxBaEntry( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucStaRecIdx, - IN UINT_8 ucTid, - IN UINT_16 u2WinStart, - IN UINT_16 u2WinSize - ); - - -VOID -qmDelRxBaEntry( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucStaRecIdx, - IN UINT_8 ucTid, - IN BOOLEAN fgFlushToHost - ); - - -VOID -mqmProcessAssocRsp ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN PUINT_8 pucIE, - IN UINT_16 u2IELength - ); - -VOID -mqmParseEdcaParameters ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN PUINT_8 pucIE, - IN UINT_16 u2IELength, - IN BOOLEAN fgForceOverride - ); - -VOID -mqmFillAcQueParam( - IN P_IE_WMM_PARAM_T prIeWmmParam, - IN UINT_32 u4AcOffset, - OUT P_AC_QUE_PARMS_T prAcQueParams - ); - -VOID -mqmProcessScanResult( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prScanResult, - OUT P_STA_RECORD_T prStaRec - ); - - -/* Utility function: for deciding STA-REC index */ -UINT_8 -qmGetStaRecIdx( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucEthDestAddr, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkType - ); - -VOID -mqmGenerateWmmInfoIE ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -VOID -mqmGenerateWmmParamIE ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - - -ENUM_FRAME_ACTION_T -qmGetFrameAction( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkType, - IN UINT_8 ucStaRecIdx, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_FRAME_TYPE_IN_CMD_Q_T eFrameType -); - -VOID -qmHandleEventBssAbsencePresence( - IN P_ADAPTER_T prAdapter, - IN P_WIFI_EVENT_T prEvent - ); - -VOID -qmHandleEventStaChangePsMode( - IN P_ADAPTER_T prAdapter, - IN P_WIFI_EVENT_T prEvent - ); - -VOID -mqmProcessAssocReq ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN PUINT_8 pucIE, - IN UINT_16 u2IELength - ); - -VOID -qmHandleEventStaUpdateFreeQuota( - IN P_ADAPTER_T prAdapter, - IN P_WIFI_EVENT_T prEvent - ); - - -VOID -qmUpdateFreeQuota( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN UINT_8 ucUpdateMode, - IN UINT_8 ucFreeQuota - ); - -VOID -qmFreeAllByNetType( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ); - -UINT_32 -qmGetRxReorderQueuedBufferCount( - IN P_ADAPTER_T prAdapter - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _QUE_MGT_H */ diff --git a/drivers/net/wireless/mt5931/include/nic/wlan_def.h b/drivers/net/wireless/mt5931/include/nic/wlan_def.h deleted file mode 100755 index 6a000d8c3532..000000000000 --- a/drivers/net/wireless/mt5931/include/nic/wlan_def.h +++ /dev/null @@ -1,1012 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/wlan_def.h#1 $ -*/ - -/*! \file "wlan_def.h" - \brief This file includes the basic definition of WLAN - -*/ - - - -/* -** $Log: wlan_def.h $ - * - * 12 05 2011 cp.wu - * [WCXRP00001131] [MT6620 Wi-Fi][Driver][AIS] Implement connect-by-BSSID path - * add CONNECT_BY_BSSID policy - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 06 22 2011 wh.su - * [WCXRP00000806] [MT6620 Wi-Fi][Driver] Move the WPA/RSN IE and WAPI IE structure to mac.h and let the sw structure not align at byte - * Move the WAPI/RSN IE to mac.h and SW structure not align to byte, - * Notice needed update P2P.ko. - * - * 04 08 2011 eddie.chen - * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma - * Fix for sigma - * - * 03 17 2011 yuche.tsai - * NULL - * Resize the Secondary Device Type array when WiFi Direct is enabled. - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Change Station Type in Station Record, Modify MACRO definition for getting station type & network type index & Role. - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Add new station type MACRO. - * - * 12 07 2010 cm.chang - * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant - * 1. Country code is from NVRAM or supplicant - * 2. Change band definition in CMD/EVENT. - * - * 10 11 2010 kevin.huang - * [WCXRP00000068] [MT6620 Wi-Fi][Driver][FW] Fix STA RECORD sync issue and remove unused code - * Update ENUM_STA_ROLE_INDEX_T by using a fixed base value - * - * 10 04 2010 cp.wu - * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by ENUM_NETWORK_TYPE_INDEX_T only - * remove ENUM_NETWORK_TYPE_T definitions - * - * 09 14 2010 chinghwa.yu - * NULL - * Update OP_MODE_BOW and include bow_fsm.h. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 31 2010 kevin.huang - * NULL - * Use LINK LIST operation to process SCAN result - * - * 08 29 2010 yuche.tsai - * NULL - * Change P2P Descriptor List to a pointer and allocate it dynamically to avoid structure corrupt by BssDescriptor free. - * - * 08 16 2010 kevin.huang - * NULL - * Refine AAA functions - * - * 08 12 2010 kevin.huang - * NULL - * Refine bssProcessProbeRequest() and bssSendBeaconProbeResponse() - * - * 08 12 2010 yuche.tsai - * NULL - * Add a pointer in BSS Descriptor for P2P Descriptor. - * - * 08 11 2010 yuche.tsai - * NULL - * Add an Interface in BSS Descriptor. - * - * 08 05 2010 yuche.tsai - * NULL - * Modify data structure for P2P Scan result. - * - * 07 26 2010 yuche.tsai - * - * Add an operation mode for P2P device. - * - * 07 23 2010 cp.wu - * - * P2P/RSN/WAPI IEs need to be declared with compact structure. - * - * 07 21 2010 yuche.tsai - * - * Add for P2P Scan Result Parsing & Saving. - * - * 07 20 2010 wh.su - * - * adding the wapi code. - * - * 07 09 2010 cp.wu - * - * 1) separate AIS_FSM state for two kinds of scanning. (OID triggered scan, and scan-for-connection) - * 2) eliminate PRE_BSS_DESC_T, Beacon/PrebResp is now parsed in single pass - * 3) implment DRV-SCN module, currently only accepts single scan request, other request will be directly dropped by returning BUSY - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 28 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * 1st draft code for RLM module - * - * 06 25 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * modify Beacon/ProbeResp to complete parsing, - * because host software has looser memory usage restriction - * - * 06 21 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Add P2P present boolean flag in BSS & Pre-BSS descriptor. - * - * 06 18 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * migration the security related function from firmware. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * auth.c is migrated. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add buildable & linkable ais_fsm.c - * - * related reference are still waiting to be resolved - * - * 06 09 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add definitions for module migration. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * move bss related data types to wlan_def.h to avoid recursive dependency. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge wlan_def.h. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge cnm_scan.h and hem_mbox.h - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge wifi_var.h, precomp.h, cnm_timer.h (data type only) - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:16:40 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _WLAN_DEF_H -#define _WLAN_DEF_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -/* disconnect reason */ -#define DISCONNECT_REASON_CODE_RESERVED 0 -#define DISCONNECT_REASON_CODE_RADIO_LOST 1 -#define DISCONNECT_REASON_CODE_DEAUTHENTICATED 2 -#define DISCONNECT_REASON_CODE_DISASSOCIATED 3 -#define DISCONNECT_REASON_CODE_NEW_CONNECTION 4 - -/* The rate definitions */ -#define TX_MODE_CCK 0x00 -#define TX_MODE_OFDM 0x40 -#define TX_MODE_HT_MM 0x80 -#define TX_MODE_HT_GF 0xC0 - -#define RATE_CCK_SHORT_PREAMBLE 0x10 -#define RATE_OFDM 0x20 - -#define PHY_RATE_1M 0x0 -#define PHY_RATE_2M 0x1 -#define PHY_RATE_5_5M 0x2 -#define PHY_RATE_11M 0x3 -#define PHY_RATE_6M 0xB -#define PHY_RATE_9M 0xF -#define PHY_RATE_12M 0xA -#define PHY_RATE_18M 0xE -#define PHY_RATE_24M 0x9 -#define PHY_RATE_36M 0xD -#define PHY_RATE_48M 0x8 -#define PHY_RATE_54M 0xC -#define PHY_RATE_MCS0 0x0 -#define PHY_RATE_MCS1 0x1 -#define PHY_RATE_MCS2 0x2 -#define PHY_RATE_MCS3 0x3 -#define PHY_RATE_MCS4 0x4 -#define PHY_RATE_MCS5 0x5 -#define PHY_RATE_MCS6 0x6 -#define PHY_RATE_MCS7 0x7 -#define PHY_RATE_MCS32 0x20 - -#define RATE_CCK_1M_LONG (TX_MODE_CCK | PHY_RATE_1M) -#define RATE_CCK_2M_LONG (TX_MODE_CCK | PHY_RATE_2M) -#define RATE_CCK_5_5M_LONG (TX_MODE_CCK | PHY_RATE_5_5M) -#define RATE_CCK_11M_LONG (TX_MODE_CCK | PHY_RATE_11M) -#define RATE_CCK_2M_SHORT (TX_MODE_CCK | PHY_RATE_2M | RATE_CCK_SHORT_PREAMBLE) -#define RATE_CCK_5_5M_SHORT (TX_MODE_CCK | PHY_RATE_5_5M | RATE_CCK_SHORT_PREAMBLE) -#define RATE_CCK_11M_SHORT (TX_MODE_CCK | PHY_RATE_11M | RATE_CCK_SHORT_PREAMBLE) -#define RATE_OFDM_6M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_6M) -#define RATE_OFDM_9M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_9M) -#define RATE_OFDM_12M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_12M) -#define RATE_OFDM_18M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_18M) -#define RATE_OFDM_24M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_24M) -#define RATE_OFDM_36M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_36M) -#define RATE_OFDM_48M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_48M) -#define RATE_OFDM_54M (TX_MODE_OFDM | RATE_OFDM | PHY_RATE_54M) - -#define RATE_MM_MCS_0 (TX_MODE_HT_MM | PHY_RATE_MCS0) -#define RATE_MM_MCS_1 (TX_MODE_HT_MM | PHY_RATE_MCS1) -#define RATE_MM_MCS_2 (TX_MODE_HT_MM | PHY_RATE_MCS2) -#define RATE_MM_MCS_3 (TX_MODE_HT_MM | PHY_RATE_MCS3) -#define RATE_MM_MCS_4 (TX_MODE_HT_MM | PHY_RATE_MCS4) -#define RATE_MM_MCS_5 (TX_MODE_HT_MM | PHY_RATE_MCS5) -#define RATE_MM_MCS_6 (TX_MODE_HT_MM | PHY_RATE_MCS6) -#define RATE_MM_MCS_7 (TX_MODE_HT_MM | PHY_RATE_MCS7) -#define RATE_MM_MCS_32 (TX_MODE_HT_MM | PHY_RATE_MCS32) - -#define RATE_GF_MCS_0 (TX_MODE_HT_GF | PHY_RATE_MCS0) -#define RATE_GF_MCS_1 (TX_MODE_HT_GF | PHY_RATE_MCS1) -#define RATE_GF_MCS_2 (TX_MODE_HT_GF | PHY_RATE_MCS2) -#define RATE_GF_MCS_3 (TX_MODE_HT_GF | PHY_RATE_MCS3) -#define RATE_GF_MCS_4 (TX_MODE_HT_GF | PHY_RATE_MCS4) -#define RATE_GF_MCS_5 (TX_MODE_HT_GF | PHY_RATE_MCS5) -#define RATE_GF_MCS_6 (TX_MODE_HT_GF | PHY_RATE_MCS6) -#define RATE_GF_MCS_7 (TX_MODE_HT_GF | PHY_RATE_MCS7) -#define RATE_GF_MCS_32 (TX_MODE_HT_GF | PHY_RATE_MCS32) - -#define RATE_TX_MODE_MASK BITS(6,7) -#define RATE_TX_MODE_OFFSET 6 -#define RATE_CODE_GET_TX_MODE(_ucRateCode) ((_ucRateCode & RATE_TX_MODE_MASK) >> RATE_TX_MODE_OFFSET) -#define RATE_PHY_RATE_MASK BITS(0,5) -#define RATE_PHY_RATE_OFFSET 0 -#define RATE_CODE_GET_PHY_RATE(_ucRateCode) ((_ucRateCode & RATE_PHY_RATE_MASK) >> RATE_PHY_RATE_OFFSET) -#define RATE_PHY_RATE_SHORT_PREAMBLE BIT(4) -#define RATE_CODE_IS_SHORT_PREAMBLE(_ucRateCode) ((_ucRateCode & RATE_PHY_RATE_SHORT_PREAMBLE)?TRUE:FALSE) - - -#define CHNL_LIST_SZ_2G 14 -#define CHNL_LIST_SZ_5G 14 - -/*! CNM(STA_RECORD_T) related definition */ -#define CFG_STA_REC_NUM 20 - -/* PHY TYPE bit definitions */ -#define PHY_TYPE_BIT_HR_DSSS BIT(PHY_TYPE_HR_DSSS_INDEX) /* HR/DSSS PHY (clause 18) */ -#define PHY_TYPE_BIT_ERP BIT(PHY_TYPE_ERP_INDEX) /* ERP PHY (clause 19) */ -#define PHY_TYPE_BIT_OFDM BIT(PHY_TYPE_OFDM_INDEX) /* OFDM 5 GHz PHY (clause 17) */ -#define PHY_TYPE_BIT_HT BIT(PHY_TYPE_HT_INDEX) /* HT PHY (clause 20) */ - - -/* PHY TYPE set definitions */ -#define PHY_TYPE_SET_802_11ABGN (PHY_TYPE_BIT_OFDM | \ - PHY_TYPE_BIT_HR_DSSS | \ - PHY_TYPE_BIT_ERP | \ - PHY_TYPE_BIT_HT) - -#define PHY_TYPE_SET_802_11BGN (PHY_TYPE_BIT_HR_DSSS | \ - PHY_TYPE_BIT_ERP | \ - PHY_TYPE_BIT_HT) - -#define PHY_TYPE_SET_802_11GN (PHY_TYPE_BIT_ERP | \ - PHY_TYPE_BIT_HT) - -#define PHY_TYPE_SET_802_11AN (PHY_TYPE_BIT_OFDM | \ - PHY_TYPE_BIT_HT) - -#define PHY_TYPE_SET_802_11ABG (PHY_TYPE_BIT_OFDM | \ - PHY_TYPE_BIT_HR_DSSS | \ - PHY_TYPE_BIT_ERP) - -#define PHY_TYPE_SET_802_11BG (PHY_TYPE_BIT_HR_DSSS | \ - PHY_TYPE_BIT_ERP) - -#define PHY_TYPE_SET_802_11A (PHY_TYPE_BIT_OFDM) - -#define PHY_TYPE_SET_802_11G (PHY_TYPE_BIT_ERP) - -#define PHY_TYPE_SET_802_11B (PHY_TYPE_BIT_HR_DSSS) - -#define PHY_TYPE_SET_802_11N (PHY_TYPE_BIT_HT) - - -/* Rate set bit definitions */ -#define RATE_SET_BIT_1M BIT(RATE_1M_INDEX) /* Bit 0: 1M */ -#define RATE_SET_BIT_2M BIT(RATE_2M_INDEX) /* Bit 1: 2M */ -#define RATE_SET_BIT_5_5M BIT(RATE_5_5M_INDEX) /* Bit 2: 5.5M */ -#define RATE_SET_BIT_11M BIT(RATE_11M_INDEX) /* Bit 3: 11M */ -#define RATE_SET_BIT_22M BIT(RATE_22M_INDEX) /* Bit 4: 22M */ -#define RATE_SET_BIT_33M BIT(RATE_33M_INDEX) /* Bit 5: 33M */ -#define RATE_SET_BIT_6M BIT(RATE_6M_INDEX) /* Bit 6: 6M */ -#define RATE_SET_BIT_9M BIT(RATE_9M_INDEX) /* Bit 7: 9M */ -#define RATE_SET_BIT_12M BIT(RATE_12M_INDEX) /* Bit 8: 12M */ -#define RATE_SET_BIT_18M BIT(RATE_18M_INDEX) /* Bit 9: 18M */ -#define RATE_SET_BIT_24M BIT(RATE_24M_INDEX) /* Bit 10: 24M */ -#define RATE_SET_BIT_36M BIT(RATE_36M_INDEX) /* Bit 11: 36M */ -#define RATE_SET_BIT_48M BIT(RATE_48M_INDEX) /* Bit 12: 48M */ -#define RATE_SET_BIT_54M BIT(RATE_54M_INDEX) /* Bit 13: 54M */ -#define RATE_SET_BIT_HT_PHY BIT(RATE_HT_PHY_INDEX) /* Bit 14: BSS Selector */ - - -/* Rate set definitions */ -#define RATE_SET_HR_DSSS (RATE_SET_BIT_1M | \ - RATE_SET_BIT_2M | \ - RATE_SET_BIT_5_5M | \ - RATE_SET_BIT_11M) - -#define RATE_SET_ERP (RATE_SET_BIT_1M | \ - RATE_SET_BIT_2M | \ - RATE_SET_BIT_5_5M | \ - RATE_SET_BIT_11M | \ - RATE_SET_BIT_6M | \ - RATE_SET_BIT_9M | \ - RATE_SET_BIT_12M | \ - RATE_SET_BIT_18M | \ - RATE_SET_BIT_24M | \ - RATE_SET_BIT_36M | \ - RATE_SET_BIT_48M | \ - RATE_SET_BIT_54M) - -#define RATE_SET_ERP_P2P (RATE_SET_BIT_6M | \ - RATE_SET_BIT_9M | \ - RATE_SET_BIT_12M | \ - RATE_SET_BIT_18M | \ - RATE_SET_BIT_24M | \ - RATE_SET_BIT_36M | \ - RATE_SET_BIT_48M | \ - RATE_SET_BIT_54M) - -#define RATE_SET_OFDM (RATE_SET_BIT_6M | \ - RATE_SET_BIT_9M | \ - RATE_SET_BIT_12M | \ - RATE_SET_BIT_18M | \ - RATE_SET_BIT_24M | \ - RATE_SET_BIT_36M | \ - RATE_SET_BIT_48M | \ - RATE_SET_BIT_54M) - -#define RATE_SET_HT (RATE_SET_ERP) -//#define RATE_SET_HT (RATE_SET_ERP | RATE_SET_BIT_HT_PHY) /* NOTE(Kevin): TBD */ - - -#define RATE_SET_ALL_ABG RATE_SET_ERP - -#define BASIC_RATE_SET_HR_DSSS (RATE_SET_BIT_1M | \ - RATE_SET_BIT_2M) - -#define BASIC_RATE_SET_HR_DSSS_ERP (RATE_SET_BIT_1M | \ - RATE_SET_BIT_2M | \ - RATE_SET_BIT_5_5M | \ - RATE_SET_BIT_11M) - -#define BASIC_RATE_SET_ERP (RATE_SET_BIT_1M | \ - RATE_SET_BIT_2M | \ - RATE_SET_BIT_5_5M | \ - RATE_SET_BIT_11M | \ - RATE_SET_BIT_6M | \ - RATE_SET_BIT_12M | \ - RATE_SET_BIT_24M) - -#define BASIC_RATE_SET_OFDM (RATE_SET_BIT_6M | \ - RATE_SET_BIT_12M | \ - RATE_SET_BIT_24M) - -#define BASIC_RATE_SET_ERP_P2P (RATE_SET_BIT_6M | \ - RATE_SET_BIT_12M | \ - RATE_SET_BIT_24M) - -#define INITIAL_RATE_SET_RCPI_100 RATE_SET_ALL_ABG - -#define INITIAL_RATE_SET_RCPI_80 (RATE_SET_BIT_1M | \ - RATE_SET_BIT_2M | \ - RATE_SET_BIT_5_5M | \ - RATE_SET_BIT_11M | \ - RATE_SET_BIT_6M | \ - RATE_SET_BIT_9M | \ - RATE_SET_BIT_12M | \ - RATE_SET_BIT_24M) - -#define INITIAL_RATE_SET_RCPI_60 (RATE_SET_BIT_1M | \ - RATE_SET_BIT_2M | \ - RATE_SET_BIT_5_5M | \ - RATE_SET_BIT_11M | \ - RATE_SET_BIT_6M) - -#define INITIAL_RATE_SET(_rcpi) (INITIAL_RATE_SET_ ## _rcpi) - -#define RCPI_100 100 /* -60 dBm */ -#define RCPI_80 80 /* -70 dBm */ -#define RCPI_60 60 /* -80 dBm */ - - -/* The number of RCPI records used to calculate their average value */ -#define MAX_NUM_RCPI_RECORDS 10 - -/* The number of RCPI records used to calculate their average value */ -#define NO_RCPI_RECORDS -128 -#define MAX_RCPI_DBM 0 -#define MIN_RCPI_DBM -100 - - -#define MAC_TX_RESERVED_FIELD 0 /* NOTE(Kevin): Should defined in tx.h */ - -#define MAX_ASSOC_ID (CFG_STA_REC_NUM) /* Available AID: 1 ~ 20(STA_REC_NUM) */ - - -#define MAX_DEAUTH_INFO_COUNT 4 /* NOTE(Kevin): Used in auth.c */ -#define MIN_DEAUTH_INTERVAL_MSEC 500 /* The minimum interval if continuously send Deauth Frame */ - -/* Authentication Type */ -#define AUTH_TYPE_OPEN_SYSTEM BIT(AUTH_ALGORITHM_NUM_OPEN_SYSTEM) -#define AUTH_TYPE_SHARED_KEY BIT(AUTH_ALGORITHM_NUM_SHARED_KEY) -#define AUTH_TYPE_FAST_BSS_TRANSITION BIT(AUTH_ALGORITHM_NUM_FAST_BSS_TRANSITION) - -/* Authentication Retry Limit */ -#define TX_AUTH_ASSOCI_RETRY_LIMIT 2 -#define TX_AUTH_ASSOCI_RETRY_LIMIT_FOR_ROAMING 1 - -/* WMM-2.2.1 WMM Information Element */ -#define ELEM_MAX_LEN_WMM_INFO 7 - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef UINT_16 PHY_TYPE, *P_PHY_TYPE; -typedef UINT_8 RCPI, *P_RCPI; -typedef UINT_8 ALC_VAL, *P_ALC_VAL; - -typedef enum _ENUM_HW_BSSID_T { - BSSID_0 = 0, - BSSID_1, - BSSID_NUM -} ENUM_HW_BSSID_T; - -typedef enum _ENUM_HW_MAC_ADDR_T { - MAC_ADDR_0 = 0, - MAC_ADDR_1, - MAC_ADDR_NUM -} ENUM_HW_MAC_ADDR_T; - -typedef enum _ENUM_HW_OP_MODE_T { - HW_OP_MODE_STA = 0, - HW_OP_MODE_AP, - HW_OP_MODE_ADHOC, - HW_OP_MODE_NUM -} ENUM_HW_OP_MODE_T; - -typedef enum _ENUM_TSF_T { - ENUM_LOCAL_TSF_0, - ENUM_LOCAL_TSF_1, - ENUM_LOCAL_TSF_NUM -} ENUM_LOCAL_TSF_T, *P_ENUM_LOCAL_TSF_T; - -typedef enum _HAL_TS_HW_UPDATE_MODE { - HAL_TSF_HW_UPDATE_BY_TICK_AND_RECEIVED_FRAME, - HAL_TSF_HW_UPDATE_BY_TICK_ONLY, - HAL_TSF_HW_UPDATE_BY_RECEIVED_FRAME_ONLY, - HAL_TSF_HW_UPDATE_BY_TICK_AND_RECEIVED_FRAME_AD_HOC -} HAL_TSF_HW_UPDATE_MODE; - - -typedef enum _ENUM_AC_T { - AC0 = 0, - AC1, - AC2, - AC3, - AC_NUM -} ENUM_AC_T, *P_ENUM_AC_T; - - -/* The Type of Network been activated */ -typedef enum _ENUM_NETWORK_TYPE_INDEX_T { - NETWORK_TYPE_AIS_INDEX = 0, - NETWORK_TYPE_P2P_INDEX, - NETWORK_TYPE_BOW_INDEX, - NETWORK_TYPE_INDEX_NUM -} ENUM_NETWORK_TYPE_INDEX_T; - - -/* The Type of STA Type. */ -typedef enum _ENUM_STA_TYPE_INDEX_T { - STA_TYPE_LEGACY_INDEX = 0, - STA_TYPE_P2P_INDEX, - STA_TYPE_BOW_INDEX, - STA_TYPE_INDEX_NUM -} -ENUM_STA_TYPE_INDEX_T; - -#define STA_ROLE_BASE_INDEX 4 - -typedef enum _ENUM_STA_ROLE_INDEX_T { - STA_ROLE_ADHOC_INDEX = STA_ROLE_BASE_INDEX, //4 - STA_ROLE_CLIENT_INDEX, - STA_ROLE_AP_INDEX, - STA_ROLE_DLS_INDEX -} ENUM_STA_ROLE_INDEX_T; - -/* The Power State of a specific Network */ -typedef enum _ENUM_PWR_STATE_T { - PWR_STATE_IDLE = 0, - PWR_STATE_ACTIVE, - PWR_STATE_PS, - PWR_STATE_NUM -} ENUM_PWR_STATE_T; - -typedef enum _ENUM_PHY_TYPE_INDEX_T { - //PHY_TYPE_DSSS_INDEX, /* DSSS PHY (clause 15) -- Not used anymore */ - PHY_TYPE_HR_DSSS_INDEX = 0, /* HR/DSSS PHY (clause 18) */ - PHY_TYPE_ERP_INDEX, /* ERP PHY (clause 19) */ - PHY_TYPE_ERP_P2P_INDEX, /* ERP PHY (clause 19) w/o HR/DSSS */ - PHY_TYPE_OFDM_INDEX, /* OFDM 5 GHz PHY (clause 17) */ - PHY_TYPE_HT_INDEX, /* HT PHY (clause 20) */ - PHY_TYPE_INDEX_NUM // 5 -} ENUM_PHY_TYPE_INDEX_T, *P_ENUM_PHY_TYPE_INDEX_T; - -typedef enum _ENUM_ACPI_STATE_T { - ACPI_STATE_D0 = 0, - ACPI_STATE_D1, - ACPI_STATE_D2, - ACPI_STATE_D3 -} ENUM_ACPI_STATE_T; - -/* The operation mode of a specific Network */ -typedef enum _ENUM_OP_MODE_T { - OP_MODE_INFRASTRUCTURE = 0, /* Infrastructure/GC */ - OP_MODE_IBSS, /* AdHoc */ - OP_MODE_ACCESS_POINT, /* For GO */ - OP_MODE_P2P_DEVICE, /* P2P Device */ - OP_MODE_BOW, - OP_MODE_NUM -} ENUM_OP_MODE_T, *P_ENUM_OP_MODE_T; - -typedef enum _ENUM_CHNL_EXT_T { - CHNL_EXT_SCN = 0, - CHNL_EXT_SCA = 1, - CHNL_EXT_RES = 2, - CHNL_EXT_SCB = 3 -} ENUM_CHNL_EXT_T, *P_ENUM_CHNL_EXT_T; - -/* This starting freq of the band is unit of kHz */ -typedef enum _ENUM_BAND_T { - BAND_NULL, - BAND_2G4, - BAND_5G, - BAND_NUM -} ENUM_BAND_T, *P_ENUM_BAND_T; - -/* Provide supported channel list to other components in array format */ -typedef struct _RF_CHANNEL_INFO_T { - ENUM_BAND_T eBand; - UINT_8 ucChannelNum; -} RF_CHANNEL_INFO_T, *P_RF_CHANNEL_INFO_T; - -typedef enum _ENUM_RATE_INDEX_T { - RATE_1M_INDEX = 0, /* 1M */ - RATE_2M_INDEX, /* 2M */ - RATE_5_5M_INDEX, /* 5.5M */ - RATE_11M_INDEX, /* 11M */ - RATE_22M_INDEX, /* 22M */ - RATE_33M_INDEX, /* 33M */ - RATE_6M_INDEX, /* 6M */ - RATE_9M_INDEX, /* 9M */ - RATE_12M_INDEX, /* 12M */ - RATE_18M_INDEX, /* 18M */ - RATE_24M_INDEX, /* 24M */ - RATE_36M_INDEX, /* 36M */ - RATE_48M_INDEX, /* 48M */ - RATE_54M_INDEX, /* 54M */ - RATE_HT_PHY_INDEX, /* BSS Selector - HT PHY */ - RATE_NUM // 15 -} ENUM_RATE_INDEX_T, *P_ENUM_RATE_INDEX_T; - -typedef enum _ENUM_HT_RATE_INDEX_T { - HT_RATE_MCS0_INDEX = 0, - HT_RATE_MCS1_INDEX, - HT_RATE_MCS2_INDEX, - HT_RATE_MCS3_INDEX, - HT_RATE_MCS4_INDEX, - HT_RATE_MCS5_INDEX, - HT_RATE_MCS6_INDEX, - HT_RATE_MCS7_INDEX, - HT_RATE_MCS32_INDEX, - HT_RATE_NUM // 9 -} ENUM_HT_RATE_INDEX_T, *P_ENUM_HT_RATE_INDEX_T; - -typedef enum _ENUM_PREMABLE_OPTION_T { - PREAMBLE_DEFAULT_LONG_NONE = 0, /* LONG for PHY_TYPE_HR_DSSS, NONE for PHY_TYPE_OFDM */ - PREAMBLE_OPTION_SHORT, /* SHORT mandatory for PHY_TYPE_ERP, SHORT option for PHY_TYPE_HR_DSSS */ - PREAMBLE_HT_MIXED_MODE, - PREAMBLE_HT_GREEN_FIELD, - PREAMBLE_OPTION_NUM -} ENUM_PREMABLE_OPTION_T, *P_ENUM_PREMABLE_OPTION_T; - -typedef enum _ENUM_MODULATION_SYSTEM_T { - MODULATION_SYSTEM_CCK = 0, - MODULATION_SYSTEM_OFDM, - MODULATION_SYSTEM_HT20, - MODULATION_SYSTEM_HT40, - MODULATION_SYSTEM_NUM -} ENUM_MODULATION_SYSTEM_T, *P_ENUM_MODULATION_SYSTEM_T; - -typedef enum _ENUM_MODULATION_TYPE_T { - MODULATION_TYPE_CCK_BPSK = 0, - MODULATION_TYPE_QPSK, - MODULATION_TYPE_16QAM, - MODULATION_TYPE_64QAM, - MODULATION_TYPE_NUM -} ENUM_MODULATION_TYPE_T, *P_ENUM_MODULATION_TYPE_T; - -typedef enum _ENUM_PS_FORWARDING_TYPE_T { - PS_FORWARDING_TYPE_NON_PS = 0, - PS_FORWARDING_TYPE_DELIVERY_ENABLED, - PS_FORWARDING_TYPE_NON_DELIVERY_ENABLED, - PS_FORWARDING_MORE_DATA_ENABLED, - PS_FORWARDING_TYPE_NUM -} ENUM_PS_FORWARDING_TYPE_T, *P_ENUM_PS_FORWARDING_TYPE_T; - -typedef struct _DEAUTH_INFO_T { - UINT_8 aucRxAddr[MAC_ADDR_LEN]; - OS_SYSTIME rLastSendTime; -} DEAUTH_INFO_T, *P_DEAUTH_INFO_T; - -/*----------------------------------------------------------------------------*/ -/* Information Element (IE) handlers */ -/*----------------------------------------------------------------------------*/ -typedef VOID (*PFN_APPEND_IE_FUNC)(P_ADAPTER_T, P_MSDU_INFO_T); -typedef VOID (*PFN_HANDLE_IE_FUNC)(P_ADAPTER_T, P_SW_RFB_T, P_IE_HDR_T); -typedef VOID (*PFN_VERIFY_IE_FUNC)(P_ADAPTER_T, P_SW_RFB_T, P_IE_HDR_T, PUINT_16); -typedef UINT_32 (*PFN_CALCULATE_VAR_IE_LEN_FUNC)(P_ADAPTER_T, ENUM_NETWORK_TYPE_INDEX_T, P_STA_RECORD_T); - -typedef struct _APPEND_IE_ENTRY_T { - UINT_16 u2EstimatedIELen; - PFN_APPEND_IE_FUNC pfnAppendIE; -} APPEND_IE_ENTRY_T, *P_APPEND_IE_ENTRY_T; - -typedef struct _APPEND_VAR_IE_ENTRY_T { - UINT_16 u2EstimatedFixedIELen; /* For Fixed Length */ - PFN_CALCULATE_VAR_IE_LEN_FUNC pfnCalculateVariableIELen; - PFN_APPEND_IE_FUNC pfnAppendIE; -} APPEND_VAR_IE_ENTRY_T, *P_APPEND_VAR_IE_ENTRY_T; - -typedef struct _HANDLE_IE_ENTRY_T { - UINT_8 ucElemID; - PFN_HANDLE_IE_FUNC pfnHandleIE; -} HANDLE_IE_ENTRY_T, *P_HANDLE_IE_ENTRY_T; - -typedef struct _VERIFY_IE_ENTRY_T { - UINT_8 ucElemID; - PFN_VERIFY_IE_FUNC pfnVarifyIE; -} VERIFY_IE_ENTRY_T, *P_VERIFY_IE_ENTRY_T; - -/*----------------------------------------------------------------------------*/ -/* Parameters of User Configuration */ -/*----------------------------------------------------------------------------*/ -typedef enum _ENUM_PARAM_CONNECTION_POLICY_T { - CONNECT_BY_SSID_BEST_RSSI = 0, - CONNECT_BY_SSID_GOOD_RSSI_MIN_CH_LOAD, - CONNECT_BY_SSID_ANY, /* NOTE(Kevin): Needed by WHQL */ - CONNECT_BY_BSSID, - CONNECT_BY_CUSTOMIZED_RULE /* NOTE(Kevin): TBD */ -} ENUM_PARAM_CONNECTION_POLICY_T, *P_ENUM_PARAM_CONNECTION_POLICY_T; - -typedef enum _ENUM_PARAM_PREAMBLE_TYPE_T { - PREAMBLE_TYPE_LONG = 0, - PREAMBLE_TYPE_SHORT, - PREAMBLE_TYPE_AUTO /*!< Try preamble short first, if fail tray preamble long. */ -} ENUM_PARAM_PREAMBLE_TYPE_T, *P_ENUM_PARAM_PREAMBLE_TYPE_T; - -/* This is enum defined for user to select a phy config listed in combo box */ -typedef enum _ENUM_PARAM_PHY_CONFIG_T { - PHY_CONFIG_802_11ABG = 0, /*!< Can associated with 802.11abg AP but without n capability, Scan dual band. */ - PHY_CONFIG_802_11BG, /*!< Can associated with 802_11bg AP, Scan single band and not report 5G BSSs. */ - PHY_CONFIG_802_11G, /*!< Can associated with 802_11g only AP, Scan single band and not report 5G BSSs. */ - PHY_CONFIG_802_11A, /*!< Can associated with 802_11a only AP, Scan single band and not report 2.4G BSSs. */ - PHY_CONFIG_802_11B, /*!< Can associated with 802_11b only AP, Scan single band and not report 5G BSSs. */ - PHY_CONFIG_802_11ABGN, /*!< Can associated with 802.11abgn AP, Scan dual band. */ - PHY_CONFIG_802_11BGN, /*!< Can associated with 802_11bgn AP, Scan single band and not report 5G BSSs. */ - PHY_CONFIG_802_11AN, /*!< Can associated with 802_11an AP, Scan single band and not report 2.4G BSSs. */ - PHY_CONFIG_802_11GN, /*!< Can associated with 802_11gn AP, Scan single band and not report 5G BSSs. */ - PHY_CONFIG_NUM // 9 -} ENUM_PARAM_PHY_CONFIG_T, *P_ENUM_PARAM_PHY_CONFIG_T; - -/* This is enum defined for user to select an AP Mode */ -typedef enum _ENUM_PARAM_AP_MODE_T { - AP_MODE_11B = 0, /*!< Create 11b BSS if we support 802.11abg/802.11bg. */ - AP_MODE_MIXED_11BG, /*!< Create 11bg mixed BSS if we support 802.11abg/802.11bg/802.11g. */ - AP_MODE_11G, /*!< Create 11g only BSS if we support 802.11abg/802.11bg/802.11g. */ - AP_MODE_11G_P2P, /*!< Create 11g only BSS for P2P if we support 802.11abg/802.11bg/802.11g. */ - AP_MODE_11A, /*!< Create 11a only BSS if we support 802.11abg. */ - AP_MODE_NUM // 4 -} ENUM_PARAM_AP_MODE_T, *P_ENUM_PARAM_AP_MODE_T; - - -/* Masks for determining the Network Type or the Station Role, given the ENUM_STA_TYPE_T */ -#define NETWORK_TYPE_AIS_MASK BIT(NETWORK_TYPE_AIS_INDEX) -#define NETWORK_TYPE_P2P_MASK BIT(NETWORK_TYPE_P2P_INDEX) -#define NETWORK_TYPE_BOW_MASK BIT(NETWORK_TYPE_BOW_INDEX) -#define STA_TYPE_LEGACY_MASK BIT(STA_TYPE_LEGACY_INDEX) -#define STA_TYPE_P2P_MASK BIT(STA_TYPE_P2P_INDEX) -#define STA_TYPE_BOW_MASK BIT(STA_TYPE_BOW_INDEX) -#define STA_TYPE_ADHOC_MASK BIT(STA_ROLE_ADHOC_INDEX) -#define STA_TYPE_CLIENT_MASK BIT(STA_ROLE_CLIENT_INDEX) -#define STA_TYPE_AP_MASK BIT(STA_ROLE_AP_INDEX) -#define STA_TYPE_DLS_MASK BIT(STA_ROLE_DLS_INDEX) - -/* Macros for obtaining the Network Type or the Station Role, given the ENUM_STA_TYPE_T */ -#define IS_STA_IN_AIS(_prStaRec) ((_prStaRec)->ucNetTypeIndex == NETWORK_TYPE_AIS_INDEX) -#define IS_STA_IN_P2P(_prStaRec) ((_prStaRec)->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX) -#define IS_STA_IN_BOW(_prStaRec) ((_prStaRec)->ucNetTypeIndex == NETWORK_TYPE_BOW_INDEX) -#define IS_STA_LEGACY_TYPE(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_LEGACY_MASK) -#define IS_STA_P2P_TYPE(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_P2P_MASK) -#define IS_STA_BOW_TYPE(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_BOW_MASK) -#define IS_ADHOC_STA(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_ADHOC_MASK) -#define IS_CLIENT_STA(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_CLIENT_MASK) -#define IS_AP_STA(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_AP_MASK) -#define IS_DLS_STA(_prStaRec) ((_prStaRec->eStaType) & STA_TYPE_DLS_MASK) - -/* The ENUM_STA_TYPE_T accounts for ENUM_NETWORK_TYPE_T and ENUM_STA_ROLE_INDEX_T. - * * It is a merged version of Network Type and STA Role. - * */ -typedef enum _ENUM_STA_TYPE_T { - STA_TYPE_LEGACY_AP = (STA_TYPE_LEGACY_MASK | STA_TYPE_AP_MASK), - STA_TYPE_LEGACY_CLIENT = (STA_TYPE_LEGACY_MASK | STA_TYPE_CLIENT_MASK), - STA_TYPE_ADHOC_PEER = (STA_TYPE_LEGACY_MASK | STA_TYPE_ADHOC_MASK), -#if CFG_ENABLE_WIFI_DIRECT - STA_TYPE_P2P_GO = (STA_TYPE_P2P_MASK | STA_TYPE_AP_MASK), - STA_TYPE_P2P_GC = (STA_TYPE_P2P_MASK | STA_TYPE_CLIENT_MASK), -#endif -#if CFG_ENABLE_BT_OVER_WIFI - STA_TYPE_BOW_AP = (STA_TYPE_BOW_MASK | STA_TYPE_AP_MASK), - STA_TYPE_BOW_CLIENT = (STA_TYPE_BOW_MASK | STA_TYPE_CLIENT_MASK), -#endif - STA_TYPE_DLS_PEER = (STA_TYPE_LEGACY_MASK | STA_TYPE_DLS_MASK) -} ENUM_STA_TYPE_T, *P_ENUM_STA_TYPE_T; - -/* The type of BSS we discovered */ -typedef enum _ENUM_BSS_TYPE_T { - BSS_TYPE_INFRASTRUCTURE = 1, - BSS_TYPE_IBSS, - BSS_TYPE_P2P_DEVICE, - BSS_TYPE_BOW_DEVICE, - BSS_TYPE_NUM -} ENUM_BSS_TYPE_T, *P_ENUM_BSS_TYPE_T; - -/*----------------------------------------------------------------------------*/ -/* RSN structures */ -/*----------------------------------------------------------------------------*/ -//#if defined(WINDOWS_DDK) || defined(WINDOWS_CE) -//#pragma pack(1) -//#endif - -#define MAX_NUM_SUPPORTED_CIPHER_SUITES 8 /* max number of supported cipher suites */ -#if CFG_SUPPORT_802_11W -#define MAX_NUM_SUPPORTED_AKM_SUITES 8 /* max number of supported AKM suites */ -#else -#define MAX_NUM_SUPPORTED_AKM_SUITES 6 /* max number of supported AKM suites */ -#endif - -/* Structure of RSN Information */ -typedef struct _RSN_INFO_T { - UINT_8 ucElemId; - UINT_16 u2Version; - UINT_32 u4GroupKeyCipherSuite; - UINT_32 u4PairwiseKeyCipherSuiteCount; - UINT_32 au4PairwiseKeyCipherSuite[MAX_NUM_SUPPORTED_CIPHER_SUITES]; - UINT_32 u4AuthKeyMgtSuiteCount; - UINT_32 au4AuthKeyMgtSuite[MAX_NUM_SUPPORTED_AKM_SUITES]; - UINT_16 u2RsnCap; - BOOLEAN fgRsnCapPresent; -} /*__KAL_ATTRIB_PACKED__*/ RSN_INFO_T, *P_RSN_INFO_T; - -#define MAX_NUM_SUPPORTED_WAPI_AKM_SUITES 1 /* max number of supported AKM suites */ -#define MAX_NUM_SUPPORTED_WAPI_CIPHER_SUITES 1 /* max number of supported cipher suites */ - -/* Structure of WAPI Information */ -typedef struct _WAPI_INFO_T { - UINT_8 ucElemId; - UCHAR ucLength; - UINT_16 u2Version; - UINT_32 u4AuthKeyMgtSuiteCount; - UINT_32 au4AuthKeyMgtSuite[MAX_NUM_SUPPORTED_WAPI_AKM_SUITES]; - UINT_32 u4PairwiseKeyCipherSuiteCount; - UINT_32 au4PairwiseKeyCipherSuite[MAX_NUM_SUPPORTED_WAPI_CIPHER_SUITES]; - UINT_32 u4GroupKeyCipherSuite; - UINT_16 u2WapiCap; - UINT_16 u2Bkid; - UINT_8 aucBkid[1][16]; -} /* __KAL_ATTRIB_PACKED__*/ WAPI_INFO_T, *P_WAPI_INFO_T; - -//#if defined(WINDOWS_DDK) || defined(WINDOWS_CE) -//#pragma pack() -//#endif - - -#if CFG_ENABLE_WIFI_DIRECT - -typedef struct _P2P_DEVICE_TYPE_T { - UINT_16 u2CategoryID; - UINT_16 u2SubCategoryID; -} P2P_DEVICE_TYPE_T, *P_P2P_DEVICE_TYPE_T; - -typedef struct _P2P_DEVICE_DESC_T { - LINK_ENTRY_T rLinkEntry; - BOOLEAN fgDevInfoValid; - UINT_8 aucDeviceAddr[MAC_ADDR_LEN]; /* Device Address. */ - UINT_8 aucInterfaceAddr[MAC_ADDR_LEN]; /* Interface Address. */ - UINT_8 ucDeviceCapabilityBitmap; - UINT_8 ucGroupCapabilityBitmap; - UINT_16 u2ConfigMethod; /* Configure Method support. */ - P2P_DEVICE_TYPE_T rPriDevType; - UINT_8 ucSecDevTypeNum; - P2P_DEVICE_TYPE_T arSecDevType[8]; // Reference to P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT - UINT_16 u2NameLength; - UINT_8 aucName[32]; // Reference to WPS_ATTRI_MAX_LEN_DEVICE_NAME - // TODO: Service Information or PasswordID valid? -} P2P_DEVICE_DESC_T, *P_P2P_DEVICE_DESC_T; - -#endif - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ -static const UINT_8 aucRateIndex2RateCode[PREAMBLE_OPTION_NUM][RATE_NUM] = { - { /* Long Preamble */ - RATE_CCK_1M_LONG, /* RATE_1M_INDEX = 0 */ - RATE_CCK_2M_LONG, /* RATE_2M_INDEX */ - RATE_CCK_5_5M_LONG, /* RATE_5_5M_INDEX */ - RATE_CCK_11M_LONG, /* RATE_11M_INDEX */ - RATE_CCK_1M_LONG, /* RATE_22M_INDEX - Not supported */ - RATE_CCK_1M_LONG, /* RATE_33M_INDEX - Not supported */ - RATE_OFDM_6M, /* RATE_6M_INDEX */ - RATE_OFDM_9M, /* RATE_9M_INDEX */ - RATE_OFDM_12M, /* RATE_12M_INDEX */ - RATE_OFDM_18M, /* RATE_18M_INDEX */ - RATE_OFDM_24M, /* RATE_24M_INDEX */ - RATE_OFDM_36M, /* RATE_36M_INDEX */ - RATE_OFDM_48M, /* RATE_48M_INDEX */ - RATE_OFDM_54M, /* RATE_54M_INDEX */ - }, - { /* Short Preamble */ - RATE_CCK_1M_LONG, /* RATE_1M_INDEX = 0 */ - RATE_CCK_2M_SHORT, /* RATE_2M_INDEX */ - RATE_CCK_5_5M_SHORT, /* RATE_5_5M_INDEX */ - RATE_CCK_11M_SHORT, /* RATE_11M_INDEX */ - RATE_CCK_1M_LONG, /* RATE_22M_INDEX - Not supported */ - RATE_CCK_1M_LONG, /* RATE_33M_INDEX - Not supported */ - RATE_OFDM_6M, /* RATE_6M_INDEX */ - RATE_OFDM_9M, /* RATE_9M_INDEX */ - RATE_OFDM_12M, /* RATE_12M_INDEX */ - RATE_OFDM_18M, /* RATE_18M_INDEX */ - RATE_OFDM_24M, /* RATE_24M_INDEX */ - RATE_OFDM_36M, /* RATE_36M_INDEX */ - RATE_OFDM_48M, /* RATE_48M_INDEX */ - RATE_OFDM_54M, /* RATE_54M_INDEX */ - }, - { /* Mixed Mode(Option) */ - RATE_MM_MCS_0, /* RATE_MCS0_INDEX, */ - RATE_MM_MCS_1, /* RATE_MCS1_INDEX, */ - RATE_MM_MCS_2, /* RATE_MCS2_INDEX, */ - RATE_MM_MCS_3, /* RATE_MCS3_INDEX, */ - RATE_MM_MCS_4, /* RATE_MCS4_INDEX, */ - RATE_MM_MCS_5, /* RATE_MCS5_INDEX, */ - RATE_MM_MCS_6, /* RATE_MCS6_INDEX, */ - RATE_MM_MCS_7, /* RATE_MCS7_INDEX, */ - RATE_MM_MCS_32 /* RATE_MCS32_INDEX, */ - }, - { /* Green Field(Option) */ - RATE_GF_MCS_0, /* RATE_MCS0_INDEX, */ - RATE_GF_MCS_1, /* RATE_MCS1_INDEX, */ - RATE_GF_MCS_2, /* RATE_MCS2_INDEX, */ - RATE_GF_MCS_3, /* RATE_MCS3_INDEX, */ - RATE_GF_MCS_4, /* RATE_MCS4_INDEX, */ - RATE_GF_MCS_5, /* RATE_MCS5_INDEX, */ - RATE_GF_MCS_6, /* RATE_MCS6_INDEX, */ - RATE_GF_MCS_7, /* RATE_MCS7_INDEX, */ - RATE_GF_MCS_32 /* RATE_MCS32_INDEX, */ - } -}; - -static const UINT_8 aucRateTableSize[PREAMBLE_OPTION_NUM] = { - RATE_HT_PHY_INDEX, - RATE_HT_PHY_INDEX, - HT_RATE_NUM, - HT_RATE_NUM -}; - - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -/* Macros to get and set the wireless LAN frame fields those are 16/32 bits in - length. */ -#define WLAN_GET_FIELD_16(_memAddr_p, _value_p) \ - { \ - PUINT_8 __cp = (PUINT_8) (_memAddr_p); \ - *(PUINT_16)(_value_p) = ((UINT_16) __cp[0]) | ((UINT_16) __cp[1] << 8); \ - } - -#define WLAN_GET_FIELD_BE16(_memAddr_p, _value_p) \ - { \ - PUINT_8 __cp = (PUINT_8) (_memAddr_p); \ - *(PUINT_16)(_value_p) = ((UINT_16) __cp[0] << 8) | ((UINT_16) __cp[1]); \ - } - -#define WLAN_GET_FIELD_32(_memAddr_p, _value_p) \ - { \ - PUINT_8 __cp = (PUINT_8) (_memAddr_p); \ - *(PUINT_32)(_value_p) = ((UINT_32) __cp[0]) | ((UINT_32) __cp[1] << 8) | \ - ((UINT_32) __cp[2] << 16) | ((UINT_32) __cp[3] << 24); \ - } - -#define WLAN_GET_FIELD_64(_memAddr_p, _value_p) \ - { \ - PUINT_8 __cp = (PUINT_8) (_memAddr_p); \ - *(PUINT_64)(_value_p) = \ - ((UINT_64) __cp[0]) | ((UINT_64) __cp[1] << 8) | \ - ((UINT_64) __cp[2] << 16) | ((UINT_64) __cp[3] << 24) | \ - ((UINT_64) __cp[4] << 32) | ((UINT_64) __cp[5] << 40) | \ - ((UINT_64) __cp[6] << 48) | ((UINT_64) __cp[7] << 56); \ - } - -#define WLAN_SET_FIELD_16(_memAddr_p, _value) \ - { \ - PUINT_8 __cp = (PUINT_8) (_memAddr_p); \ - __cp[0] = (UINT_8) (_value); \ - __cp[1] = (UINT_8) ((_value) >> 8); \ - } - -#define WLAN_SET_FIELD_BE16(_memAddr_p, _value) \ - { \ - PUINT_8 __cp = (PUINT_8) (_memAddr_p); \ - __cp[0] = (UINT_8) ((_value) >> 8); \ - __cp[1] = (UINT_8) (_value); \ - } - -#define WLAN_SET_FIELD_32(_memAddr_p, _value) \ - { \ - PUINT_8 __cp = (PUINT_8) (_memAddr_p); \ - __cp[0] = (UINT_8) (_value); \ - __cp[1] = (UINT_8) ((_value) >> 8); \ - __cp[2] = (UINT_8) ((_value) >> 16); \ - __cp[3] = (UINT_8) ((_value) >> 24); \ - } - - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _WLAN_DEF_H */ - diff --git a/drivers/net/wireless/mt5931/include/nic_cmd_event.h b/drivers/net/wireless/mt5931/include/nic_cmd_event.h deleted file mode 100755 index 3c482911d4b4..000000000000 --- a/drivers/net/wireless/mt5931/include/nic_cmd_event.h +++ /dev/null @@ -1,1888 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic_cmd_event.h#1 $ -*/ - -/*! \file "nic_cmd_event.h" - \brief This file contains the declairation file of the WLAN OID processing routines - of Windows driver for MediaTek Inc. 802.11 Wireless LAN Adapters. -*/ - - - -/* -** $Log: nic_cmd_event.h $ - * - * 03 29 2012 eason.tsai - * [WCXRP00001216] [MT6628 Wi-Fi][Driver]add conditional define - * add conditional define. - * - * 03 04 2012 eason.tsai - * NULL - * modify the cal fail report code. - * - * 01 06 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * redefine the CMD_ID_SET_TXPWR_CTRL value. - * - * 01 05 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the related ioctl / wlan oid function to set the Tx power cfg. - * - * 11 30 2011 cm.chang - * [WCXRP00001128] [MT5931 Wi-Fi][FW] Update BB/RF setting based on RF doc v0.7 for LGE spec - * 1. Add a new CMD for driver to set device mode - * 2. Update calibration parameters - * - * 11 19 2011 yuche.tsai - * NULL - * Update RSSI for P2P. - * - * 11 18 2011 yuche.tsai - * NULL - * CONFIG P2P support RSSI query, default turned off. - * - * 11 10 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Add TX_DONE status detail information. - * - * 11 08 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * check if CFG_SUPPORT_SWCR is defined to aoid compiler error. - * - * 11 07 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * add debug counters and periodically dump counters for debugging. - * - * 10 26 2011 cp.wu - * [WCXRP00001065] [MT6620 Wi-Fi][MT5931][FW][DRV] Adding parameter for controlling minimum channel dwell time for scanning - * add interface for control minimum channel dwell time for scanning. - * - * 09 20 2011 cm.chang - * [WCXRP00000997] [MT6620 Wi-Fi][Driver][FW] Handle change of BSS preamble type and slot time - * New CMD definition about RLM parameters - * - * 08 31 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * . - * - * 08 25 2011 chinghwa.yu - * [WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add DFS switch. - * - * 08 24 2011 chinghwa.yu - * [WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Update RDD test mode cases. - * - * 08 15 2011 cp.wu - * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree - * add MT6628-specific definitions. - * - * 08 11 2011 cp.wu - * [WCXRP00000830] [MT6620 Wi-Fi][Firmware] Use MDRDY counter to detect empty channel for shortening scan time - * sparse channel detection: - * driver: collect sparse channel information with scan-done event - * - * 08 09 2011 cp.wu - * [WCXRP00000702] [MT5931][Driver] Modify initialization sequence for E1 ASIC[WCXRP00000913] [MT6620 Wi-Fi] create repository of source code dedicated for MT6620 E6 ASIC - * add CCK-DSSS TX-PWR control field in NVRAM and CMD definition for MT5931-MP - * - * 08 03 2011 terry.wu - * [WCXRP00000899] [MT6620] [FW] Reply probe rsp in FW for hotspot mode - * Reply Probe Rsp in FW for Hotspot Mode. - * - * - * - * 08 03 2011 terry.wu - * [WCXRP00000899] [MT6620] [FW] Reply probe rsp in FW for hotspot mode - * Reply Probe Rsp in FW for Hotspot Mode. - * - * - * 08 03 2011 terry.wu - * [WCXRP00000899] [MT6620] [FW] Reply probe rsp in FW for hotspot mode - * Reply Probe Rsp in FW for Hotspot Mode. - * - * 08 03 2011 terry.wu - * [WCXRP00000899] [MT6620] [FW] Reply probe rsp in FW for hotspot mode - * Reply Probe Rsp in FW for Hotspot Mode. - * - * 07 28 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings - * Add BWCS cmd and event. - * - * 07 22 2011 jeffrey.chang - * [WCXRP00000864] [MT5931] Add command to adjust OSC stable time - * add osc stable time command structure - * - * 07 22 2011 jeffrey.chang - * [WCXRP00000864] [MT5931] Add command to adjust OSC stable time - * modify driver to set OSC stable time after f/w download - * - * 07 18 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add CMD/Event for RDD and BWCS. - * - * 07 18 2011 cp.wu - * [WCXRP00000858] [MT5931][Driver][Firmware] Add support for scan to search for more than one SSID in a single scanning request - * add framework in driver domain for supporting new SCAN_REQ_V2 for more than 1 SSID support as well as uProbeDelay in NDIS 6.x driver model - * - * 06 23 2011 cp.wu - * [WCXRP00000812] [MT6620 Wi-Fi][Driver] not show NVRAM when there is no valid MAC address in NVRAM content - * check with firmware for valid MAC address. - * - * 06 23 2011 cp.wu - * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module - * change parameter name from PeerAddr to BSSID - * - * 06 20 2011 cp.wu - * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module - * 1. specify target's BSSID when requesting channel privilege. - * 2. pass BSSID information to firmware domain - * - * 06 09 2011 tsaiyuan.hsu - * [WCXRP00000760] [MT5931 Wi-Fi][FW] Refine rxmHandleMacRxDone to reduce code size - * move send_auth at rxmHandleMacRxDone in firmware to driver to reduce code size. - * - * 05 27 2011 cp.wu - * [WCXRP00000749] [MT6620 Wi-Fi][Driver] Add band edge tx power control to Wi-Fi NVRAM - * invoke CMD_ID_SET_EDGE_TXPWR_LIMIT when there is valid data exist in NVRAM content. - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 03 31 2011 chinglan.wang - * [WCXRP00000613] [MT6620 Wi-Fi] [FW] [Driver] BssInfo can get the security mode which is WPA/WPA2/WAPI or not. - * . - * - * 03 18 2011 cm.chang - * [WCXRP00000576] [MT6620 Wi-Fi][Driver][FW] Remove P2P compile option in scan req/cancel command - * As CR title - * - * 03 17 2011 yarco.yang - * [WCXRP00000569] [MT6620 Wi-Fi][F/W][Driver] Set multicast address support current network usage - * . - * - * 03 07 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * rename the define to anti_pviracy. - * - * 03 05 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * add the code to get the check rsponse and indicate to app. - * - * 03 02 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * Add Security check related code. - * - * 03 02 2011 george.huang - * [WCXRP00000504] [MT6620 Wi-Fi][FW] Support Sigma CAPI for power saving related command - * Support UAPSD/OppPS/NoA parameter setting - * - * 02 16 2011 cm.chang - * [WCXRP00000447] [MT6620 Wi-Fi][FW] Support new NVRAM update mechanism - * . - * - * 02 10 2011 cp.wu - * [WCXRP00000434] [MT6620 Wi-Fi][Driver] Obsolete unused event packet handlers - * EVENT_ID_CONNECTION_STATUS has been obsoleted and no need to handle. - * - * 02 08 2011 eddie.chen - * [WCXRP00000426] [MT6620 Wi-Fi][FW/Driver] Add STA aging timeout and defualtHwRatein AP mode - * Add event STA agint timeout - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * - * 01 25 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * Update cmd format of BSS INFO, always sync OwnMac to FW no matter P2P is enabled or not.. - * - * 01 20 2011 eddie.chen - * [WCXRP00000374] [MT6620 Wi-Fi][DRV] SW debug control - * Add Oid for sw control debug command - * - * 01 15 2011 puff.wen - * NULL - * Add Stress test - * - * 01 12 2011 cm.chang - * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting - * Sync HT operation element information from host to FW - * - * 01 12 2011 cm.chang - * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting - * User-defined bandwidth is for 2.4G and 5G individually - * - * 12 29 2010 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, - -Add per station flow control when STA is in PS - - - * 1) PS flow control event - * - * 2) WMM IE in beacon, assoc resp, probe resp - * - * 12 28 2010 cp.wu - * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release - * report EEPROM used flag via NIC_CAPABILITY - * - * 12 28 2010 cp.wu - * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release - * integrate with 'EEPROM used' flag for reporting correct capability to Engineer Mode/META and other tools - * - * 12 23 2010 george.huang - * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function - * 1. update WMM IE parsing, with ASSOC REQ handling - * 2. extend U-APSD parameter passing from driver to FW - * - * 12 07 2010 cm.chang - * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk - * 1. BSSINFO include RLM parameter - * 2. free all sta records when network is disconnected - * - * 12 07 2010 cm.chang - * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant - * 1. Country code is from NVRAM or supplicant - * 2. Change band definition in CMD/EVENT. - * - * 11 29 2010 cm.chang - * [WCXRP00000210] [MT6620 Wi-Fi][Driver][FW] Set RCPI value in STA_REC for initial TX rate selection of auto-rate algorithm - * Sync RCPI of STA_REC to FW as reference of initial TX rate - * - * 11 08 2010 cm.chang - * [WCXRP00000169] [MT6620 Wi-Fi][Driver][FW] Remove unused CNM recover message ID - * Remove CNM channel reover message ID - * - * 11 01 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module - * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead - * 2) Remove CNM CH-RECOVER event handling - * 3) cfg read/write API renamed with kal prefix for unified naming rules. - * - * 10 26 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW] Support NIC capability query command - * 1) update NVRAM content template to ver 1.02 - * 2) add compile option for querying NIC capability (default: off) - * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting - * 4) correct auto-rate compiler error under linux (treat warning as error) - * 5) simplify usage of NVRAM and REG_INFO_T - * 6) add version checking between driver and firmware - * - * 10 25 2010 cp.wu - * [WCXRP00000133] [MT6620 Wi-Fi] [FW][Driver] Change TX power offset band definition - * follow-up for CMD_5G_PWR_OFFSET_T definition change - * - * 10 20 2010 cp.wu - * [WCXRP00000117] [MT6620 Wi-Fi][Driver] Add logic for suspending driver when MT6620 is not responding anymore - * use OID_CUSTOM_TEST_MODE as indication for driver reset - * by dropping pending TX packets - * - * 10 20 2010 wh.su - * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group - * Add the code to support disconnect p2p group - * - * 09 15 2010 cm.chang - * NULL - * Add new CMD for TX power, 5G power offset and power parameters - * - * 09 07 2010 yuche.tsai - * NULL - * Add a pointer in P2P SCAN RESULT structure. This pointer - * is pointed to a IE buffer for this P2p device. - * - * 09 07 2010 wh.su - * NULL - * adding the code for beacon/probe req/ probe rsp wsc ie at p2p. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 23 2010 chinghwa.yu - * NULL - * Update for BOW. - * - * 08 20 2010 cm.chang - * NULL - * Migrate RLM code to host from FW - * - * 08 16 2010 george.huang - * NULL - * add new CMD ID definition - * - * 08 16 2010 yuche.tsai - * NULL - * Add a field in BSS INFO cmd to change interface address for P2P. (switching between Device Addr & Interface Addr) - * - * 08 12 2010 yuche.tsai - * NULL - * Add interface address indication when indicate connection status. - * It is requested by supplicant to do 4 way handshake. - * - * 08 07 2010 wh.su - * NULL - * adding the privacy related code for P2P network - * - * 08 05 2010 yuche.tsai - * NULL - * Change data structure for P2P Device scan result, all channel time for scan command. - * - * 08 04 2010 george.huang - * NULL - * handle change PS mode OID/ CMD - * - * 08 04 2010 yarco.yang - * NULL - * Add TX_AMPDU and ADDBA_REJECT command - * - * 08 03 2010 george.huang - * NULL - * handle event for updating NOA parameters indicated from FW - * - * 08 02 2010 george.huang - * NULL - * add WMM-PS test related OID/ CMD handlers - * - * 07 28 2010 cp.wu - * NULL - * sync. CMD_BSS_INFO structure change to CMD-EVENT v0.15. - * - * 07 26 2010 yuche.tsai - * - * Add P2P Device Found Event. - * Channel extention option in scan abort command. - * - * 07 23 2010 cp.wu - * - * add AIS-FSM handling for beacon timeout event. - * - * 07 21 2010 yuche.tsai - * - * Add for P2P Scan Result Parsing & Saving. - * - * 07 20 2010 george.huang - * - * DWORD align for the CMD data structure - * - * 07 20 2010 cp.wu - * - * pass band information for scan in an efficient way by mapping ENUM_BAND_T into UINT_8.. - * - * 07 19 2010 wh.su - * - * update for security supporting. - * - * 07 19 2010 cm.chang - * - * Set RLM parameters and enable CNM channel manager - * - * 07 16 2010 yarco.yang - * - * 1. Support BSS Absence/Presence Event - * 2. Support STA change PS mode Event - * 3. Support BMC forwarding for AP mode. - * - * 07 14 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * pass band with channel number information as scan parameter - * - * 07 14 2010 yarco.yang - * - * 1. Remove CFG_MQM_MIGRATION - * 2. Add CMD_UPDATE_WMM_PARMS command - * - * 07 09 2010 cp.wu - * - * reorder members of CMD_SET_BSS_INFO. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * update prStaRecOfAP with BSS-INFO. - * - * 07 07 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Support state of STA record change from 1 to 1 - * - * 07 01 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Support sync command of STA_REC - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * implementation of DRV-SCN and related mailbox message handling. - * - * 06 30 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * sync. with CMD/EVENT document ver0.07. - * - * 06 29 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * correct variable naming for 8-bit variable used in CMD_BEACON_TEMPLATE_UPDATE. - * - * 06 29 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) sync to. CMD/EVENT document v0.03 - * 2) simplify DTIM period parsing in scan.c only, bss.c no longer parses it again. - * 3) send command packet to indicate FW-PM after - * a) 1st beacon is received after AIS has connected to an AP - * b) IBSS-ALONE has been created - * c) IBSS-MERGE has occured - * - * 06 28 2010 george.huang - * [WPD00001556]Basic power managemenet function - * Create beacon update path, with expose bssUpdateBeaconContent() - * - * 06 22 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) add command warpper for STA-REC/BSS-INFO sync. - * 2) enhance command packet sending procedure for non-oid part - * 3) add command packet definitions for STA-REC/BSS-INFO sync. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add BSS/STA_REC commands for integration. - * - * 06 21 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Add TX Done Event handle entry - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) eliminate CFG_CMD_EVENT_VERSION_0_9 - * 2) when disconnected, indicate nic directly (no event is needed) - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS - * 2) buffer statistics data for 2 seconds - * 3) use default value for adhoc parameters instead of 0 - * - * 05 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) do not take timeout mechanism for power mode oids - * 2) retrieve network type from connection status - * 3) after disassciation, set radio state to off - * 4) TCP option over IPv6 is supported - * - * 05 17 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct OID_802_11_DISASSOCIATE handling. - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * 1) add timeout handler mechanism for pending command packets - * 2) add p2p add/removal key - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * * * * * * * 2) command sequence number is now increased atomically - * * * * * * * * * * 3) private data could be hold and taken use for other purpose - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * sync statistics data structure definition with firmware implementation - * - * 03 30 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * statistics information OIDs are now handled by querying from firmware domain - * - * 03 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * indicate media stream mode after set is done - * - * 03 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add a temporary flag for integration with CMD/EVENT v0.9. - * - * 03 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) correct OID_802_11_CONFIGURATION with frequency setting behavior. - * * the frequency is used for adhoc connection only - * * 2) update with SD1 v0.9 CMD/EVENT documentation - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port - * - * 03 22 2010 cp.wu - * [WPD00003824][MT6620 Wi-Fi][New Feature] Add support of large scan list - * Implement feature needed by CR: WPD00003824: refining association command by pasting scanning result - * - * 03 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) add ACPI D0/D3 state switching support - * * * * * * 2) use more formal way to handle interrupt when the status is retrieved from enhanced RX response - * - * 03 15 2010 kevin.huang - * [WPD00003820][MT6620 Wi-Fi] Modify the code for meet the WHQL test - * Add event for activate STA_RECORD_T - * - * 03 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement custom OID: EEPROM read/write access - * - * 03 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement OID_802_3_MULTICAST_LIST oid handling - * - * 02 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * move EVENT_ID_ASSOC_INFO from nic_rx.c to gl_kal_ndis_51.c - * 'cause it involves OS dependent data structure handling - * - * 02 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * send CMD_ID_INFRASTRUCTURE when handling OID_802_11_INFRASTRUCTURE_MODE set. - * - * 02 09 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address - * * * * * 2. follow MSDN defined behavior when associates to another AP - * * * * * 3. for firmware download, packet size could be up to 2048 bytes - * - * 01 27 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * . - * - * 01 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. eliminate improper variable in rHifInfo - * * * * * * 2. block TX/ordinary OID when RF test mode is engaged - * * * * * * 3. wait until firmware finish operation when entering into and leaving from RF test mode - * * * * * * 4. correct some HAL implementation - * - * 01 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement following 802.11 OIDs: - * * * OID_802_11_RSSI, - * * * OID_802_11_RSSI_TRIGGER, - * * * OID_802_11_STATISTICS, - * * * OID_802_11_DISASSOCIATE, - * * * OID_802_11_POWER_MODE - * - * 01 21 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement OID_802_11_MEDIA_STREAM_MODE - * - * 01 21 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement OID_802_11_SUPPORTED_RATES / OID_802_11_DESIRED_RATES - * - * 12 30 2009 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) According to CMD/EVENT documentation v0.8, - * * * * * * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used, - * * * * * * and result is retrieved by get ATInfo instead - * * * * * * 2) add 4 counter for recording aggregation statistics -** \main\maintrunk.MT6620WiFiDriver_Prj\20 2009-12-11 18:35:07 GMT mtk02752 -** add CMD added in CMD/EVEN document v0.8 -** \main\maintrunk.MT6620WiFiDriver_Prj\19 2009-12-10 16:39:37 GMT mtk02752 -** eliminate unused definitions -** \main\maintrunk.MT6620WiFiDriver_Prj\18 2009-12-10 09:55:11 GMT mtk02752 -** command ID/event ID revised -** \main\maintrunk.MT6620WiFiDriver_Prj\17 2009-12-09 13:57:37 GMT MTK02468 -** Added event ids (EVENT_ID_RX_ADDBA and EVENT_ID_RX_DELBA) -** \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-12-08 17:35:39 GMT mtk02752 -** + add event ID for EVENT_ID_TEST_STATUS (rf test) -** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-12-07 23:01:09 GMT mtk02752 -** add data structure for RF_TEST -** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-12-03 16:22:56 GMT mtk01461 -** Modify the element - i4RSSI in EVENT of SCAN RESULT -** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-11-30 10:54:44 GMT mtk02752 -** 1st DW of WIFI_CMD_T is shared with HIF_TX_HEADER_T, while 1st DW of WIFI_EVENT_T is shared with HIF_RX_HEADER_T -** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-11-26 10:16:58 GMT mtk02752 -** resync EVENT_CONNECTION_STATUS -** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-11-25 21:34:01 GMT mtk02752 -** sync. EVENT_SCAN_RESULT_T with firmware -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-11-25 21:03:48 GMT mtk02752 -** refine MGMT_FRAME -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-11-25 18:17:47 GMT mtk02752 -** refine GL_WLAN_INFO_T for buffering scan result and presume max. ie length = 600 bytes -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-11-24 22:41:20 GMT mtk02752 -** add EVENT_SCAN_RESULT_T definition -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-11-23 20:29:16 GMT mtk02752 -** fix typo -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-11-23 14:46:01 GMT mtk02752 -** add new command/event structure upon CM@SD1's documentation -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-11-13 15:13:40 GMT mtk02752 -** add command definition for CMD_BUILD_CONNECTION and EVENT_CONNECTION_STATUS -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-05-20 12:22:22 GMT mtk01461 -** Add SeqNum field to Event Header -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-04-29 15:42:11 GMT mtk01461 -** Update structure of HIF_EVENT_HEADER_T and EVENT_HDR_SIZE -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-04-21 12:10:36 GMT mtk01461 -** Add Common Set CMD Callback for MCR Write and other Set OID -** \main\maintrunk.MT6620WiFiDriver_Prj\1 2009-04-21 01:40:17 GMT mtk01461 -** Command Done Handler -*/ -#ifndef _NIC_CMD_EVENT_H -#define _NIC_CMD_EVENT_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define CMD_STATUS_SUCCESS 0 -#define CMD_STATUS_REJECTED 1 -#define CMD_STATUS_UNKNOWN 2 - -#define EVENT_HDR_SIZE OFFSET_OF(WIFI_EVENT_T, aucBuffer[0]) - -#define MAX_IE_LENGTH (600) -#define MAX_WSC_IE_LENGTH (400) - -/* Action field in structure CMD_CH_PRIVILEGE_T */ -#define CMD_CH_ACTION_REQ 0 -#define CMD_CH_ACTION_ABORT 1 - -/* Status field in structure EVENT_CH_PRIVILEGE_T */ -#define EVENT_CH_STATUS_GRANT 0 - - -typedef enum _ENUM_CMD_ID_T { - CMD_ID_TEST_MODE = 1, /* 0x01 (Set) */ - CMD_ID_RESET_REQUEST, /* 0x02 (Set) */ - CMD_ID_BUILD_CONNECTION, /* 0x03 (Set) */ - CMD_ID_SCAN_REQ_V2, /* 0x04 (Set) */ - CMD_ID_NIC_POWER_CTRL, /* 0x05 (Set) */ - CMD_ID_POWER_SAVE_MODE, /* 0x06 (Set) */ - CMD_ID_LINK_ATTRIB, /* 0x07 (Set) */ - CMD_ID_ADD_REMOVE_KEY, /* 0x08 (Set) */ - CMD_ID_DEFAULT_KEY_ID, /* 0x09 (Set) */ - CMD_ID_INFRASTRUCTURE, /* 0x0a (Set) */ - CMD_ID_SET_RX_FILTER, /* 0x0b (Set) */ - CMD_ID_DOWNLOAD_BUF, /* 0x0c (Set) */ - CMD_ID_WIFI_START, /* 0x0d (Set) */ - CMD_ID_CMD_BT_OVER_WIFI, /* 0x0e (Set) */ - CMD_ID_SET_MEDIA_CHANGE_DELAY_TIME, /* 0x0f (Set) */ - CMD_ID_SEND_ADDBA_RSP, /* 0x10 (Set) */ - CMD_ID_WAPI_MODE, /* 0x11 (Set) (obsolete) */ - CMD_ID_WAPI_ASSOC_INFO, /* 0x12 (Set) (obsolete) */ - CMD_ID_SET_DOMAIN_INFO, /* 0x13 (Set) */ - CMD_ID_SET_IP_ADDRESS, /* 0x14 (Set) */ - CMD_ID_BSS_ACTIVATE_CTRL, /* 0x15 (Set) */ - CMD_ID_SET_BSS_INFO, /* 0x16 (Set) */ - CMD_ID_UPDATE_STA_RECORD, /* 0x17 (Set) */ - CMD_ID_REMOVE_STA_RECORD, /* 0x18 (Set) */ - CMD_ID_INDICATE_PM_BSS_CREATED, /* 0x19 (Set) */ - CMD_ID_INDICATE_PM_BSS_CONNECTED, /* 0x1a (Set) */ - CMD_ID_INDICATE_PM_BSS_ABORT, /* 0x1b (Set) */ - CMD_ID_UPDATE_BEACON_CONTENT, /* 0x1c (Set) */ - CMD_ID_SET_BSS_RLM_PARAM, /* 0x1d (Set) */ - CMD_ID_SCAN_REQ, /* 0x1e (Set) */ - CMD_ID_SCAN_CANCEL, /* 0x1f (Set) */ - CMD_ID_CH_PRIVILEGE, /* 0x20 (Set) */ - CMD_ID_UPDATE_WMM_PARMS, /* 0x21 (Set) */ - CMD_ID_SET_WMM_PS_TEST_PARMS, /* 0x22 (Set) */ - CMD_ID_TX_AMPDU, /* 0x23 (Set) */ - CMD_ID_ADDBA_REJECT, /* 0x24 (Set) */ - CMD_ID_SET_PS_PROFILE_ADV, /* 0x25 (Set) */ - CMD_ID_SET_RAW_PATTERN, /* 0x26 (Set) */ - CMD_ID_CONFIG_PATTERN_FUNC, /* 0x27 (Set) */ - CMD_ID_SET_TX_PWR, /* 0x28 (Set) */ - CMD_ID_SET_5G_PWR_OFFSET, /* 0x29 (Set) */ - CMD_ID_SET_PWR_PARAM, /* 0x2A (Set) */ - CMD_ID_P2P_ABORT, /* 0x2B (Set) */ -#if CFG_STRESS_TEST_SUPPORT - CMD_ID_RANDOM_RX_RESET_EN = 0x2C, /* 0x2C (Set ) */ - CMD_ID_RANDOM_RX_RESET_DE = 0x2D, /* 0x2D (Set ) */ - CMD_ID_SAPP_EN = 0x2E, /* 0x2E (Set ) */ - CMD_ID_SAPP_DE = 0x2F, /* 0x2F (Set ) */ -#endif - CMD_ID_ROAMING_TRANSIT = 0x30, /* 0x30 (Set) */ - CMD_ID_SET_PHY_PARAM, /* 0x31 (Set) */ - CMD_ID_SET_NOA_PARAM, /* 0x32 (Set) */ - CMD_ID_SET_OPPPS_PARAM, /* 0x33 (Set) */ - CMD_ID_SET_UAPSD_PARAM, /* 0x34 (Set) */ - CMD_ID_SET_SIGMA_STA_SLEEP, /* 0x35 (Set) */ - CMD_ID_SET_EDGE_TXPWR_LIMIT, /* 0x36 (Set) */ - CMD_ID_SET_DEVICE_MODE, /* 0x37 (Set) */ - CMD_ID_SET_TXPWR_CTRL, /* 0x38 (Set) */ - CMD_ID_SET_AUTOPWR_CTRL, /* 0x39 (Set) */ - - CMD_ID_GET_NIC_CAPABILITY = 0x80, /* 0x80 (Query) */ - CMD_ID_GET_LINK_QUALITY, /* 0x81 (Query) */ - CMD_ID_GET_STATISTICS, /* 0x82 (Query) */ - CMD_ID_GET_CONNECTION_STATUS, /* 0x83 (Query) */ - CMD_ID_GET_ASSOC_INFO, /* 0x84 (Query) (obsolete) */ - - CMD_ID_BASIC_CONFIG = 0xc1, /* 0xc1 (Set / Query) */ - CMD_ID_ACCESS_REG, /* 0xc2 (Set / Query) */ - CMD_ID_MAC_MCAST_ADDR, /* 0xc3 (Set / Query) */ - CMD_ID_802_11_PMKID, /* 0xc4 (Set / Query) */ - CMD_ID_ACCESS_EEPROM, /* 0xc5 (Set / Query) */ - CMD_ID_SW_DBG_CTRL, /* 0xc6 (Set / Query) */ -#if 1/* CFG_SUPPORT_ANTI_PIRACY */ - CMD_ID_SEC_CHECK, /* 0xc7 (Set / Query) */ -#endif - CMD_ID_DUMP_MEM, /* 0xc8 (Query) */ - -#if CFG_SUPPORT_RDD_TEST_MODE - CMD_ID_SET_RDD_CH = 0xE1, -#endif - - CMD_ID_SET_BWCS = 0xF1, -#if CFG_SUPPORT_OSC_SETTING && defined(MT5931) - CMD_ID_SET_OSC = 0xf2, -#endif - -} ENUM_CMD_ID_T, *P_ENUM_CMD_ID_T; - -typedef enum _ENUM_EVENT_ID_T { - EVENT_ID_CMD_RESULT = 1, /* 0x01 (Query) */ - EVENT_ID_NIC_CAPABILITY, /* 0x02 (Query) */ - EVENT_ID_CONNECTION_STATUS, /* 0x03 (Query / Unsolicited) (obsolete) */ - EVENT_ID_SCAN_RESULT, /* 0x04 (Query / Unsolicited) (obselete) */ - EVENT_ID_LINK_QUALITY, /* 0x05 (Query / Unsolicited) */ - EVENT_ID_STATISTICS, /* 0x06 (Query) */ - EVENT_ID_MIC_ERR_INFO, /* 0x07 (Unsolicited) */ - EVENT_ID_ASSOC_INFO, /* 0x08 (Query - CMD_ID_GET_ASSOC_INFO) */ - EVENT_ID_BASIC_CONFIG, /* 0x09 (Query - CMD_ID_BASIC_CONFIG) */ - EVENT_ID_ACCESS_REG, /* 0x0a (Query - CMD_ID_ACCESS_REG) */ - EVENT_ID_MAC_MCAST_ADDR, /* 0x0b (Query - CMD_ID_MAC_MCAST_ADDR) */ - EVENT_ID_802_11_PMKID, /* 0x0c (Query - CMD_ID_802_11_PMKID) */ - EVENT_ID_ACCESS_EEPROM, /* 0x0d (Query - CMD_ID_ACCESS_EEPROM) */ - EVENT_ID_SLEEPY_NOTIFY, /* 0x0e (Query) */ - EVENT_ID_BT_OVER_WIFI, /* 0x0f (Unsolicited) */ - EVENT_ID_TEST_STATUS, /* 0x10 (Query - CMD_ID_TEST_MODE) */ - EVENT_ID_RX_ADDBA, /* 0x11 (Unsolicited) (obsolete) */ - EVENT_ID_RX_DELBA, /* 0x12 (Unsolicited) (obsolete) */ - EVENT_ID_ACTIVATE_STA_REC_T, /* 0x13 (Unsolicited) */ - EVENT_ID_DEACTIVATE_STA_REC_T, /* 0x14 (Unsolicited) */ - EVENT_ID_SCAN_DONE, /* 0x15 (Unsoiicited) */ - EVENT_ID_RX_FLUSH, /* 0x16 (Unsolicited) */ - EVENT_ID_TX_DONE, /* 0x17 (Unsolicited) */ - EVENT_ID_CH_PRIVILEGE, /* 0x18 (Unsolicited) */ - EVENT_ID_BSS_ABSENCE_PRESENCE = 0x19, /* 0x19 (Unsolicited) */ - EVENT_ID_STA_CHANGE_PS_MODE, /* 0x1A (Unsolicited) */ - EVENT_ID_BSS_BEACON_TIMEOUT, /* 0x1B (Unsolicited) */ - EVENT_ID_UPDATE_NOA_PARAMS, /* 0x1C (Unsolicited) */ - EVENT_ID_AP_OBSS_STATUS, /* 0x1D (Unsolicited) */ - EVENT_ID_STA_UPDATE_FREE_QUOTA, /* 0x1E (Unsolicited) */ - EVENT_ID_SW_DBG_CTRL, /* 0x1F (Query - CMD_ID_SW_DBG_CTRL) */ - EVENT_ID_ROAMING_STATUS, /* 0x20 (Unsolicited) */ - EVENT_ID_STA_AGING_TIMEOUT, /* 0x21 (Unsolicited) */ -#if 1 /* CFG_SUPPORT_ANTI_PIRACY */ - EVENT_ID_SEC_CHECK_RSP, /* 0x22 (Unsolicited) */ -#endif - EVENT_ID_SEND_DEAUTH, /* 0x23 (Unsolicited) */ - -#if CFG_SUPPORT_RDD_TEST_MODE - EVENT_ID_UPDATE_RDD_STATUS, /* 0x24 (Unsolicited) */ -#endif - -#if CFG_SUPPORT_BCM && CFG_SUPPORT_BCM_BWCS - EVENT_ID_UPDATE_BWCS_STATUS = 0x25, /* 0x25 (Unsolicited) */ - EVENT_ID_UPDATE_BCM_DEBUG, /* 0x26 (Unsolicited) */ -#endif - EVENT_ID_RX_ERR, - EVENT_ID_DUMP_MEM -} ENUM_EVENT_ID_T, *P_ENUM_EVENT_ID_T; - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -#ifndef LINUX -typedef UINT_8 CMD_STATUS; -#endif -/* for Event Packet (via HIF-RX) */ - /* following CM's documentation v0.7 */ -typedef struct _WIFI_CMD_T { - UINT_16 u2TxByteCount_UserPriority; - UINT_8 ucEtherTypeOffset; - UINT_8 ucResource_PktType_CSflags; - UINT_8 ucCID; - UINT_8 ucSetQuery; - UINT_8 ucSeqNum; - UINT_8 aucReserved2; - - UINT_8 aucBuffer[0]; -} WIFI_CMD_T, *P_WIFI_CMD_T; - -/* for Command Packet (via HIF-TX) */ - /* following CM's documentation v0.7 */ -typedef struct _WIFI_EVENT_T { - UINT_16 u2PacketLen; - UINT_16 u2PacketType; - UINT_8 ucEID; - UINT_8 ucSeqNum; - UINT_8 aucReserved2[2]; - - UINT_8 aucBuffer[0]; -} WIFI_EVENT_T, *P_WIFI_EVENT_T; - -// CMD_ID_TEST_MODE -typedef struct _CMD_TEST_CTRL_T { - UINT_8 ucAction; - UINT_8 aucReserved[3]; - union { - UINT_32 u4OpMode; - UINT_32 u4ChannelFreq; - PARAM_MTK_WIFI_TEST_STRUC_T rRfATInfo; - } u; -} CMD_TEST_CTRL_T, *P_CMD_TEST_CTRL_T; - -// EVENT_TEST_STATUS -typedef struct _PARAM_CUSTOM_RFTEST_TX_STATUS_STRUC_T { - UINT_32 u4PktSentStatus; - UINT_32 u4PktSentCount; - UINT_16 u2AvgAlc; - UINT_8 ucCckGainControl; - UINT_8 ucOfdmGainControl; -} PARAM_CUSTOM_RFTEST_TX_STATUS_STRUC_T, *P_PARAM_CUSTOM_RFTEST_TX_STATUS_STRUC_T; - -typedef struct _PARAM_CUSTOM_RFTEST_RX_STATUS_STRUC_T { - UINT_32 u4IntRxOk; /*!< number of packets that Rx ok from interrupt */ - UINT_32 u4IntCrcErr; /*!< number of packets that CRC error from interrupt */ - UINT_32 u4IntShort; /*!< number of packets that is short preamble from interrupt */ - UINT_32 u4IntLong; /*!< number of packets that is long preamble from interrupt */ - UINT_32 u4PauRxPktCount; /*!< number of packets that Rx ok from PAU */ - UINT_32 u4PauCrcErrCount; /*!< number of packets that CRC error from PAU */ - UINT_32 u4PauRxFifoFullCount; /*!< number of packets that is short preamble from PAU */ - UINT_32 u4PauCCACount; /*!< CCA rising edge count */ -} PARAM_CUSTOM_RFTEST_RX_STATUS_STRUC_T, *P_PARAM_CUSTOM_RFTEST_RX_STATUS_STRUC_T; - -typedef union _EVENT_TEST_STATUS { - PARAM_MTK_WIFI_TEST_STRUC_T rATInfo; -// PARAM_CUSTOM_RFTEST_TX_STATUS_STRUC_T rTxStatus; -// PARAM_CUSTOM_RFTEST_RX_STATUS_STRUC_T rRxStatus; -} EVENT_TEST_STATUS, *P_EVENT_TEST_STATUS; - -// CMD_BUILD_CONNECTION -typedef struct _CMD_BUILD_CONNECTION { - UINT_8 ucInfraMode; - UINT_8 ucAuthMode; - UINT_8 ucEncryptStatus; - UINT_8 ucSsidLen; - UINT_8 aucSsid[PARAM_MAX_LEN_SSID]; - UINT_8 aucBssid[PARAM_MAC_ADDR_LEN]; - - /* Ad-hoc mode */ - UINT_16 u2BeaconPeriod; - UINT_16 u2ATIMWindow; - UINT_8 ucJoinOnly; - UINT_8 ucReserved; - UINT_32 u4FreqInKHz; - - /* for faster connection */ - UINT_8 aucScanResult[0]; -} CMD_BUILD_CONNECTION, *P_CMD_BUILD_CONNECTION; - -//CMD_ADD_REMOVE_KEY -typedef struct _CMD_802_11_KEY { - UINT_8 ucAddRemove; - UINT_8 ucTxKey; - UINT_8 ucKeyType; - UINT_8 ucIsAuthenticator; - UINT_8 aucPeerAddr[6]; - UINT_8 ucNetType; - UINT_8 ucAlgorithmId; - UINT_8 ucKeyId; - UINT_8 ucKeyLen; - UINT_8 aucReverved[2]; - UINT_8 aucKeyMaterial[32]; - UINT_8 aucKeyRsc[16]; -} CMD_802_11_KEY, *P_CMD_802_11_KEY; - -/* WPA2 PMKID cache structure */ -typedef struct _PMKID_ENTRY_T { - PARAM_BSSID_INFO_T rBssidInfo; - BOOLEAN fgPmkidExist; -} PMKID_ENTRY_T, *P_PMKID_ENTRY_T; - -typedef struct _CMD_802_11_PMKID -{ - ULONG u4BSSIDInfoCount; - P_PMKID_ENTRY_T arPMKIDInfo[1]; -} CMD_802_11_PMKID, *P_CMD_802_11_PMKID; - -// CMD_BASIC_CONFIG -typedef struct _CMD_CSUM_OFFLOAD { - UINT_16 u2RxChecksum; // bit0: IP, bit1: UDP, bit2: TCP - UINT_16 u2TxChecksum; // bit0: IP, bit1: UDP, bit2: TCP -} CMD_CSUM_OFFLOAD, *P_CMD_CSUM_OFFLOAD; - -typedef struct _CMD_BASIC_CONFIG { - PARAM_MAC_ADDRESS rMyMacAddr; - UINT_8 ucNative80211; - UINT_8 aucReserved[1]; - - CMD_CSUM_OFFLOAD rCsumOffload; -} CMD_BASIC_CONFIG, *P_CMD_BASIC_CONFIG, EVENT_BASIC_CONFIG, *P_EVENT_BASIC_CONFIG; - -// CMD_MAC_MCAST_ADDR -typedef struct _CMD_MAC_MCAST_ADDR { - UINT_32 u4NumOfGroupAddr; - UINT_8 ucNetTypeIndex; - UINT_8 aucReserved[3]; - PARAM_MAC_ADDRESS arAddress[MAX_NUM_GROUP_ADDR]; -} CMD_MAC_MCAST_ADDR, *P_CMD_MAC_MCAST_ADDR, EVENT_MAC_MCAST_ADDR, *P_EVENT_MAC_MCAST_ADDR; - -// CMD_ACCESS_EEPROM -typedef struct _CMD_ACCESS_EEPROM { - UINT_16 u2Offset; - UINT_16 u2Data; -} CMD_ACCESS_EEPROM, *P_CMD_ACCESS_EEPROM, EVENT_ACCESS_EEPROM, *P_EVENT_ACCESS_EEPROM; - -typedef struct _CMD_CUSTOM_NOA_PARAM_STRUC_T { - UINT_32 u4NoaDurationMs; - UINT_32 u4NoaIntervalMs; - UINT_32 u4NoaCount; -} CMD_CUSTOM_NOA_PARAM_STRUC_T, *P_CMD_CUSTOM_NOA_PARAM_STRUC_T; - -typedef struct _CMD_CUSTOM_OPPPS_PARAM_STRUC_T { - UINT_32 u4CTwindowMs; -} CMD_CUSTOM_OPPPS_PARAM_STRUC_T, *P_CMD_CUSTOM_OPPPS_PARAM_STRUC_T; - -typedef struct _CMD_CUSTOM_UAPSD_PARAM_STRUC_T { - UINT_8 fgEnAPSD; - UINT_8 fgEnAPSD_AcBe; - UINT_8 fgEnAPSD_AcBk; - UINT_8 fgEnAPSD_AcVo; - UINT_8 fgEnAPSD_AcVi; - UINT_8 ucMaxSpLen; - UINT_8 aucResv[2]; -} CMD_CUSTOM_UAPSD_PARAM_STRUC_T, *P_CMD_CUSTOM_UAPSD_PARAM_STRUC_T; - -// EVENT_CONNECTION_STATUS -typedef struct _EVENT_CONNECTION_STATUS { - UINT_8 ucMediaStatus; - UINT_8 ucReasonOfDisconnect; - - UINT_8 ucInfraMode; - UINT_8 ucSsidLen; - UINT_8 aucSsid[PARAM_MAX_LEN_SSID]; - UINT_8 aucBssid[PARAM_MAC_ADDR_LEN]; - UINT_8 ucAuthenMode; - UINT_8 ucEncryptStatus; - UINT_16 u2BeaconPeriod; - UINT_16 u2AID; - UINT_16 u2ATIMWindow; - UINT_8 ucNetworkType; - UINT_8 aucReserved[1]; - UINT_32 u4FreqInKHz; - -#if CFG_ENABLE_WIFI_DIRECT - UINT_8 aucInterfaceAddr[PARAM_MAC_ADDR_LEN]; -#endif - -} EVENT_CONNECTION_STATUS, *P_EVENT_CONNECTION_STATUS; - -// EVENT_NIC_CAPABILITY -typedef struct _EVENT_NIC_CAPABILITY { - UINT_16 u2ProductID; - UINT_16 u2FwVersion; - UINT_16 u2DriverVersion; - UINT_8 ucHw5GBandDisabled; - UINT_8 ucEepromUsed; - UINT_8 ucEfuseValid; - UINT_8 ucMacAddrValid; -#if CFG_REPORT_RFBB_VERSION - UINT_8 ucRfVersion; - UINT_8 ucPhyVersion; -#endif -#if CFG_ENABLE_CAL_LOG - UINT_8 ucRfCalFail; - UINT_8 ucBbCalFail; -#endif - UINT_8 aucReserved[2]; -} EVENT_NIC_CAPABILITY, *P_EVENT_NIC_CAPABILITY; - -// modified version of WLAN_BEACON_FRAME_BODY_T for simplier buffering -typedef struct _WLAN_BEACON_FRAME_BODY_T_LOCAL { - /* Beacon frame body */ - UINT_32 au4Timestamp[2]; /* Timestamp */ - UINT_16 u2BeaconInterval; /* Beacon Interval */ - UINT_16 u2CapInfo; /* Capability */ - UINT_8 aucInfoElem[MAX_IE_LENGTH]; /* Various IEs, start from SSID */ - UINT_16 u2IELength; /* This field is *NOT* carried by F/W but caculated by nic_rx */ -} WLAN_BEACON_FRAME_BODY_T_LOCAL, *P_WLAN_BEACON_FRAME_BODY_T_LOCAL; - -// EVENT_SCAN_RESULT -typedef struct _EVENT_SCAN_RESULT_T { - INT_32 i4RSSI; - UINT_32 u4LinkQuality; - UINT_32 u4DSConfig; /* Center frequency */ - UINT_32 u4DomainInfo; /* Require CM opinion */ - UINT_32 u4Reserved; - UINT_8 ucNetworkType; - UINT_8 ucOpMode; - UINT_8 aucBssid[MAC_ADDR_LEN]; - UINT_8 aucRatesEx[PARAM_MAX_LEN_RATES_EX]; - WLAN_BEACON_FRAME_BODY_T_LOCAL rBeaconFrameBody; -} EVENT_SCAN_RESULT_T, *P_EVENT_SCAN_RESULT_T; - -/* event of tkip mic error */ -typedef struct _EVENT_MIC_ERR_INFO -{ - UINT_32 u4Flags; -} EVENT_MIC_ERR_INFO, *P_EVENT_MIC_ERR_INFO; - -typedef struct _EVENT_PMKID_CANDIDATE_LIST_T -{ - UINT_32 u4Version; /*!< Version */ - UINT_32 u4NumCandidates; /*!< How many candidates follow */ - PARAM_PMKID_CANDIDATE_T arCandidateList[1]; -} EVENT_PMKID_CANDIDATE_LIST_T, *P_EVENT_PMKID_CANDIDATE_LIST_T; - - -typedef struct _EVENT_CMD_RESULT { - UINT_8 ucCmdID; - UINT_8 ucStatus; - UINT_8 aucReserved[2]; -} EVENT_CMD_RESULT, *P_EVENT_CMD_RESULT; - -#if CFG_SUPPORT_OSC_SETTING && defined(MT5931) -typedef struct _CMD_MCU_LP_PARAM_T { - UINT_16 u2OscStableTime; - UINT_8 ucReserved[6]; -} CMD_MCU_LP_PARAM_T, *P_CMD_MCU_LP_PARAM_T; -#endif - - -// CMD_ID_ACCESS_REG & EVENT_ID_ACCESS_REG -typedef struct _CMD_ACCESS_REG { - UINT_32 u4Address; - UINT_32 u4Data; -} CMD_ACCESS_REG, *P_CMD_ACCESS_REG; - -// CMD_DUMP_MEMORY -typedef struct _CMD_DUMP_MEM { - UINT_32 u4Address; - UINT_32 u4Length; - UINT_32 u4RemainLength; - UINT_8 ucFragNum; -} CMD_DUMP_MEM, *P_CMD_DUMP_MEM; - -typedef struct _EVENT_DUMP_MEM_T { - UINT_32 u4Address; - UINT_32 u4Length; - UINT_32 u4RemainLength; - UINT_8 ucFragNum; - UINT_8 aucBuffer[1]; -} EVENT_DUMP_MEM_T, *P_EVENT_DUMP_MEM_T; - -typedef struct _CMD_SW_DBG_CTRL_T { - UINT_32 u4Id; - UINT_32 u4Data; - /* Debug Support */ - UINT_32 u4DebugCnt[64]; -} CMD_SW_DBG_CTRL_T, *P_CMD_SW_DBG_CTRL_T; - - -// CMD_ID_LINK_ATTRIB -typedef struct _CMD_LINK_ATTRIB { - INT_8 cRssiTrigger; - UINT_8 ucDesiredRateLen; - UINT_16 u2DesiredRate[32]; - UINT_8 ucMediaStreamMode; - UINT_8 aucReserved[1]; -} CMD_LINK_ATTRIB, *P_CMD_LINK_ATTRIB; - -// CMD_ID_NIC_POWER_CTRL -typedef struct _CMD_NIC_POWER_CTRL { - UINT_8 ucPowerMode; - UINT_8 aucReserved[3]; -} CMD_NIC_POWER_CTRL, *P_CMD_NIC_POWER_CTRL; - -// CMD_ID_POWER_SAVE_MODE -typedef struct _CMD_PS_PROFILE_T { - UINT_8 ucNetTypeIndex; - UINT_8 ucPsProfile; - UINT_8 aucReserved[2]; -} CMD_PS_PROFILE_T, *P_CMD_PS_PROFILE_T; - - -// EVENT_LINK_QUALITY -typedef struct _EVENT_LINK_QUALITY { - INT_8 cRssi; - INT_8 cLinkQuality; - UINT_16 u2LinkSpeed; - UINT_8 ucMediumBusyPercentage; -} EVENT_LINK_QUALITY, *P_EVENT_LINK_QUALITY; - -#if CFG_SUPPORT_P2P_RSSI_QUERY -// EVENT_LINK_QUALITY -typedef struct _EVENT_LINK_QUALITY_EX { - INT_8 cRssi; - INT_8 cLinkQuality; - UINT_16 u2LinkSpeed; - UINT_8 ucMediumBusyPercentage; - UINT_8 ucIsLQ0Rdy; - INT_8 cRssiP2P; /* For P2P Network. */ - INT_8 cLinkQualityP2P; - UINT_16 u2LinkSpeedP2P; - UINT_8 ucMediumBusyPercentageP2P; - UINT_8 ucIsLQ1Rdy; -} EVENT_LINK_QUALITY_EX, *P_EVENT_LINK_QUALITY_EX; -#endif - -// EVENT_ID_STATISTICS -typedef struct _EVENT_STATISTICS { - LARGE_INTEGER rTransmittedFragmentCount; - LARGE_INTEGER rMulticastTransmittedFrameCount; - LARGE_INTEGER rFailedCount; - LARGE_INTEGER rRetryCount; - LARGE_INTEGER rMultipleRetryCount; - LARGE_INTEGER rRTSSuccessCount; - LARGE_INTEGER rRTSFailureCount; - LARGE_INTEGER rACKFailureCount; - LARGE_INTEGER rFrameDuplicateCount; - LARGE_INTEGER rReceivedFragmentCount; - LARGE_INTEGER rMulticastReceivedFrameCount; - LARGE_INTEGER rFCSErrorCount; -} EVENT_STATISTICS, *P_EVENT_STATISTICS; - -// EVENT_ID_FW_SLEEPY_NOTIFY -typedef struct _EVENT_SLEEPY_NOTIFY { - UINT_8 ucSleepyState; - UINT_8 aucReserved[3]; -} EVENT_SLEEPY_NOTIFY, *P_EVENT_SLEEPY_NOTIFY; - -typedef struct _EVENT_ACTIVATE_STA_REC_T { - UINT_8 aucMacAddr[6]; - UINT_8 ucStaRecIdx; - UINT_8 ucNetworkTypeIndex; - BOOLEAN fgIsQoS; - BOOLEAN fgIsAP; - UINT_8 aucReserved[2]; -} EVENT_ACTIVATE_STA_REC_T, *P_EVENT_ACTIVATE_STA_REC_T; - -typedef struct _EVENT_DEACTIVATE_STA_REC_T { - UINT_8 ucStaRecIdx; - UINT_8 aucReserved[3]; -} EVENT_DEACTIVATE_STA_REC_T, *P_EVENT_DEACTIVATE_STA_REC_T; - -// CMD_BT_OVER_WIFI -typedef struct _CMD_BT_OVER_WIFI { - UINT_8 ucAction; /* 0: query, 1: setup, 2: destroy */ - UINT_8 ucChannelNum; - PARAM_MAC_ADDRESS rPeerAddr; - UINT_16 u2BeaconInterval; - UINT_8 ucTimeoutDiscovery; - UINT_8 ucTimeoutInactivity; - UINT_8 ucRole; - UINT_8 PAL_Capabilities; - UINT_8 cMaxTxPower; - UINT_8 ucChannelBand; - UINT_8 ucReserved[1]; -} CMD_BT_OVER_WIFI, *P_CMD_BT_OVER_WIFI; - -// EVENT_BT_OVER_WIFI -typedef struct _EVENT_BT_OVER_WIFI { - UINT_8 ucLinkStatus; - UINT_8 ucSelectedChannel; - INT_8 cRSSI; - UINT_8 ucReserved[1]; -} EVENT_BT_OVER_WIFI, *P_EVENT_BT_OVER_WIFI; - -// Same with DOMAIN_SUBBAND_INFO -typedef struct _CMD_SUBBAND_INFO { - UINT_8 ucRegClass; - UINT_8 ucBand; - UINT_8 ucChannelSpan; - UINT_8 ucFirstChannelNum; - UINT_8 ucNumChannels; - UINT_8 aucReserved[3]; -} CMD_SUBBAND_INFO, *P_CMD_SUBBAND_INFO; - -// CMD_SET_DOMAIN_INFO -typedef struct _CMD_SET_DOMAIN_INFO_T { - UINT_16 u2CountryCode; - UINT_16 u2Reserved; - CMD_SUBBAND_INFO rSubBand[6]; - - UINT_8 uc2G4Bandwidth; /* CONFIG_BW_20_40M or CONFIG_BW_20M */ - UINT_8 uc5GBandwidth; /* CONFIG_BW_20_40M or CONFIG_BW_20M */ - UINT_8 aucReserved[2]; -} CMD_SET_DOMAIN_INFO_T, *P_CMD_SET_DOMAIN_INFO_T; - -// CMD_SET_IP_ADDRESS -typedef struct _IPV4_NETWORK_ADDRESS { - UINT_8 aucIpAddr[4]; -} IPV4_NETWORK_ADDRESS, *P_IPV4_NETWORK_ADDRESS; - -typedef struct _CMD_SET_NETWORK_ADDRESS_LIST { - UINT_8 ucNetTypeIndex; - UINT_8 ucAddressCount; - UINT_8 ucReserved[2]; - IPV4_NETWORK_ADDRESS arNetAddress[1]; -} CMD_SET_NETWORK_ADDRESS_LIST, *P_CMD_SET_NETWORK_ADDRESS_LIST; - -typedef struct _PATTERN_DESCRIPTION { - UINT_8 fgCheckBcA1; - UINT_8 fgCheckMcA1; - UINT_8 ePatternHeader; - UINT_8 fgAndOp; - UINT_8 fgNotOp; - UINT_8 ucPatternMask; - UINT_16 ucPatternOffset; - UINT_8 aucPattern[8]; -} PATTERN_DESCRIPTION, *P_PATTERN_DESCRIPTION; - -typedef struct _CMD_RAW_PATTERN_CONFIGURATION_T { - PATTERN_DESCRIPTION arPatternDesc[4]; -} CMD_RAW_PATTERN_CONFIGURATION_T, *P_CMD_RAW_PATTERN_CONFIGURATION_T; - -typedef struct _CMD_PATTERN_FUNC_CONFIG { - BOOLEAN fgBcA1En; - BOOLEAN fgMcA1En; - BOOLEAN fgBcA1MatchDrop; - BOOLEAN fgMcA1MatchDrop; -} CMD_PATTERN_FUNC_CONFIG, *P_CMD_PATTERN_FUNC_CONFIG; - - -typedef struct _EVENT_TX_DONE_T { - UINT_8 ucPacketSeq; - UINT_8 ucStatus; - UINT_16 u2SequenceNumber; - UINT_32 au4Reserved1; - UINT_32 au4Reserved2; - UINT_32 au4Reserved3; -} EVENT_TX_DONE_T, *P_EVENT_TX_DONE_T; - -typedef struct _CMD_BSS_ACTIVATE_CTRL { - UINT_8 ucNetTypeIndex; - UINT_8 ucActive; - UINT_8 aucReserved[2]; -} CMD_BSS_ACTIVATE_CTRL, *P_CMD_BSS_ACTIVATE_CTRL; - -typedef struct _CMD_SET_BSS_RLM_PARAM_T { - UINT_8 ucNetTypeIndex; - UINT_8 ucRfBand; - UINT_8 ucPrimaryChannel; - UINT_8 ucRfSco; - UINT_8 ucErpProtectMode; - UINT_8 ucHtProtectMode; - UINT_8 ucGfOperationMode; - UINT_8 ucTxRifsMode; - UINT_16 u2HtOpInfo3; - UINT_16 u2HtOpInfo2; - UINT_8 ucHtOpInfo1; - UINT_8 ucUseShortPreamble; - UINT_8 ucUseShortSlotTime; - UINT_8 ucCheckId; /* Fixed value: 0x72 */ -} CMD_SET_BSS_RLM_PARAM_T, *P_CMD_SET_BSS_RLM_PARAM_T; - -typedef struct _CMD_SET_BSS_INFO { - UINT_8 ucNetTypeIndex; - UINT_8 ucConnectionState; - UINT_8 ucCurrentOPMode; - UINT_8 ucSSIDLen; - UINT_8 aucSSID[32]; - UINT_8 aucBSSID[6]; - UINT_8 ucIsQBSS; - UINT_8 ucReserved1; - UINT_16 u2OperationalRateSet; - UINT_16 u2BSSBasicRateSet; - UINT_8 ucStaRecIdxOfAP; - UINT_8 ucReserved2; - UINT_8 ucReserved3; - UINT_8 ucNonHTBasicPhyType; /* For Slot Time and CWmin */ - UINT_8 ucAuthMode; - UINT_8 ucEncStatus; - UINT_8 ucPhyTypeSet; - UINT_8 aucOwnMac[6]; - UINT_8 fgWapiMode; - UINT_8 fgIsApMode; - UINT_8 aucRsv[1]; - CMD_SET_BSS_RLM_PARAM_T rBssRlmParam; -} CMD_SET_BSS_INFO, *P_CMD_SET_BSS_INFO; - -typedef struct _CMD_UPDATE_STA_RECORD_T { - UINT_8 ucIndex; - UINT_8 ucStaType; - UINT_8 aucMacAddr[MAC_ADDR_LEN]; - UINT_16 u2AssocId; - UINT_16 u2ListenInterval; - UINT_8 ucNetTypeIndex; - UINT_8 ucDesiredPhyTypeSet; - UINT_16 u2DesiredNonHTRateSet; - UINT_16 u2BSSBasicRateSet; - UINT_8 ucIsQoS; - UINT_8 ucIsUapsdSupported; - UINT_8 ucStaState; - UINT_8 ucMcsSet; - UINT_8 ucSupMcs32; - UINT_8 ucAmpduParam; - UINT_16 u2HtCapInfo; - UINT_16 u2HtExtendedCap; - UINT_32 u4TxBeamformingCap; - UINT_8 ucAselCap; - UINT_8 ucRCPI; - UINT_8 ucNeedResp; - UINT_8 ucUapsdAc; /* b0~3: Trigger enabled, b4~7: Delivery enabled */ - UINT_8 ucUapsdSp; /* 0: all, 1: max 2, 2: max 4, 3: max 6 */ - UINT_8 aucReserved[3]; - /* TBD */ -} CMD_UPDATE_STA_RECORD_T, *P_CMD_UPDATE_STA_RECORD_T; - -typedef struct _CMD_REMOVE_STA_RECORD_T { - UINT_8 ucIndex; - UINT_8 ucReserved; - UINT_8 aucMacAddr[MAC_ADDR_LEN]; -} CMD_REMOVE_STA_RECORD_T, *P_CMD_REMOVE_STA_RECORD_T; - -typedef struct _CMD_INDICATE_PM_BSS_CREATED_T { - UINT_8 ucNetTypeIndex; - UINT_8 ucDtimPeriod; - UINT_16 u2BeaconInterval; - UINT_16 u2AtimWindow; - UINT_8 aucReserved[2]; -} CMD_INDICATE_PM_BSS_CREATED, *P_CMD_INDICATE_PM_BSS_CREATED; - -typedef struct _CMD_INDICATE_PM_BSS_CONNECTED_T { - UINT_8 ucNetTypeIndex; - UINT_8 ucDtimPeriod; - UINT_16 u2AssocId; - UINT_16 u2BeaconInterval; - UINT_16 u2AtimWindow; - UINT_8 fgIsUapsdConnection; - UINT_8 ucBmpDeliveryAC; - UINT_8 ucBmpTriggerAC; - UINT_8 aucReserved[1]; -} CMD_INDICATE_PM_BSS_CONNECTED, *P_CMD_INDICATE_PM_BSS_CONNECTED; - -typedef struct _CMD_INDICATE_PM_BSS_ABORT { - UINT_8 ucNetTypeIndex; - UINT_8 aucReserved[3]; -} CMD_INDICATE_PM_BSS_ABORT, *P_CMD_INDICATE_PM_BSS_ABORT; - -typedef struct _CMD_BEACON_TEMPLATE_UPDATE { - UINT_8 ucUpdateMethod; // 0: update randomly, 1: update all, 2: delete all (1 and 2 will update directly without search) - UINT_8 ucNetTypeIndex; - UINT_8 aucReserved[2]; - UINT_16 u2Capability; - UINT_16 u2IELen; - UINT_8 aucIE[MAX_IE_LENGTH]; -} CMD_BEACON_TEMPLATE_UPDATE, *P_CMD_BEACON_TEMPLATE_UPDATE; - -typedef struct _CMD_SET_WMM_PS_TEST_STRUC_T { - UINT_8 ucNetTypeIndex; - UINT_8 bmfgApsdEnAc; /* b0~3: trigger-en AC0~3. b4~7: delivery-en AC0~3 */ - UINT_8 ucIsEnterPsAtOnce; /* enter PS immediately without 5 second guard after connected */ - UINT_8 ucIsDisableUcTrigger; /* not to trigger UC on beacon TIM is matched (under U-APSD) */ -} CMD_SET_WMM_PS_TEST_STRUC_T, *P_CMD_SET_WMM_PS_TEST_STRUC_T; - - -/* Definition for CHANNEL_INFO.ucBand: - * 0: Reserved - * 1: BAND_2G4 - * 2: BAND_5G - * Others: Reserved - */ -typedef struct _CHANNEL_INFO_T { - UINT_8 ucBand; - UINT_8 ucChannelNum; -} CHANNEL_INFO_T, *P_CHANNEL_INFO_T; - -typedef struct _CMD_SCAN_REQ_T { - UINT_8 ucSeqNum; - UINT_8 ucNetworkType; - UINT_8 ucScanType; - UINT_8 ucSSIDType; /* BIT(0) wildcard / BIT(1) P2P-wildcard / BIT(2) specific */ - UINT_8 ucSSIDLength; - UINT_8 aucReserved[1]; - UINT_16 u2ChannelMinDwellTime; - UINT_8 aucSSID[32]; - UINT_16 u2ChannelDwellTime; /* For P2P */ - UINT_8 ucChannelType; - UINT_8 ucChannelListNum; - CHANNEL_INFO_T arChannelList[32]; - UINT_16 u2IELen; - UINT_8 aucIE[MAX_IE_LENGTH]; -} CMD_SCAN_REQ, *P_CMD_SCAN_REQ; - -typedef struct _CMD_SCAN_REQ_V2_T { - UINT_8 ucSeqNum; - UINT_8 ucNetworkType; - UINT_8 ucScanType; - UINT_8 ucSSIDType; - PARAM_SSID_T arSSID[4]; - UINT_16 u2ProbeDelayTime; - UINT_16 u2ChannelDwellTime; /* For P2P */ - UINT_8 ucChannelType; - UINT_8 ucChannelListNum; - CHANNEL_INFO_T arChannelList[32]; - UINT_16 u2IELen; - UINT_8 aucIE[MAX_IE_LENGTH]; -} CMD_SCAN_REQ_V2, *P_CMD_SCAN_REQ_V2; - -typedef struct _CMD_SCAN_CANCEL_T { - UINT_8 ucSeqNum; - UINT_8 ucIsExtChannel; /* For P2P channel extention. */ - UINT_8 aucReserved[2]; -} CMD_SCAN_CANCEL, *P_CMD_SCAN_CANCEL; - -typedef struct _EVENT_SCAN_DONE_T { - UINT_8 ucSeqNum; - UINT_8 ucSparseChannelValid; - CHANNEL_INFO_T rSparseChannel; -} EVENT_SCAN_DONE, *P_EVENT_SCAN_DONE; - -typedef struct _CMD_CH_PRIVILEGE_T { - UINT_8 ucNetTypeIndex; - UINT_8 ucTokenID; - UINT_8 ucAction; - UINT_8 ucPrimaryChannel; - UINT_8 ucRfSco; - UINT_8 ucRfBand; - UINT_8 ucReqType; - UINT_8 ucReserved; - UINT_32 u4MaxInterval; /* In unit of ms */ - UINT_8 aucBSSID[6]; - UINT_8 aucReserved[2]; -} CMD_CH_PRIVILEGE_T, *P_CMD_CH_PRIVILEGE_T; - -typedef struct _CMD_TX_PWR_T { - INT_8 cTxPwr2G4Cck; /* signed, in unit of 0.5dBm */ -#if defined(MT6620) - INT_8 acReserved[3]; -#elif defined(MT5931) || defined(MT6628) - INT_8 cTxPwr2G4Dsss; /* signed, in unit of 0.5dBm */ - INT_8 acReserved[2]; -#else - #error "No valid definition!" -#endif - - INT_8 cTxPwr2G4OFDM_BPSK; - INT_8 cTxPwr2G4OFDM_QPSK; - INT_8 cTxPwr2G4OFDM_16QAM; - INT_8 cTxPwr2G4OFDM_Reserved; - INT_8 cTxPwr2G4OFDM_48Mbps; - INT_8 cTxPwr2G4OFDM_54Mbps; - - INT_8 cTxPwr2G4HT20_BPSK; - INT_8 cTxPwr2G4HT20_QPSK; - INT_8 cTxPwr2G4HT20_16QAM; - INT_8 cTxPwr2G4HT20_MCS5; - INT_8 cTxPwr2G4HT20_MCS6; - INT_8 cTxPwr2G4HT20_MCS7; - - INT_8 cTxPwr2G4HT40_BPSK; - INT_8 cTxPwr2G4HT40_QPSK; - INT_8 cTxPwr2G4HT40_16QAM; - INT_8 cTxPwr2G4HT40_MCS5; - INT_8 cTxPwr2G4HT40_MCS6; - INT_8 cTxPwr2G4HT40_MCS7; - - INT_8 cTxPwr5GOFDM_BPSK; - INT_8 cTxPwr5GOFDM_QPSK; - INT_8 cTxPwr5GOFDM_16QAM; - INT_8 cTxPwr5GOFDM_Reserved; - INT_8 cTxPwr5GOFDM_48Mbps; - INT_8 cTxPwr5GOFDM_54Mbps; - - INT_8 cTxPwr5GHT20_BPSK; - INT_8 cTxPwr5GHT20_QPSK; - INT_8 cTxPwr5GHT20_16QAM; - INT_8 cTxPwr5GHT20_MCS5; - INT_8 cTxPwr5GHT20_MCS6; - INT_8 cTxPwr5GHT20_MCS7; - - INT_8 cTxPwr5GHT40_BPSK; - INT_8 cTxPwr5GHT40_QPSK; - INT_8 cTxPwr5GHT40_16QAM; - INT_8 cTxPwr5GHT40_MCS5; - INT_8 cTxPwr5GHT40_MCS6; - INT_8 cTxPwr5GHT40_MCS7; -} CMD_TX_PWR_T, *P_CMD_TX_PWR_T; - -typedef struct _CMD_5G_PWR_OFFSET_T { - INT_8 cOffsetBand0; /* 4.915-4.980G */ - INT_8 cOffsetBand1; /* 5.000-5.080G */ - INT_8 cOffsetBand2; /* 5.160-5.180G */ - INT_8 cOffsetBand3; /* 5.200-5.280G */ - INT_8 cOffsetBand4; /* 5.300-5.340G */ - INT_8 cOffsetBand5; /* 5.500-5.580G */ - INT_8 cOffsetBand6; /* 5.600-5.680G */ - INT_8 cOffsetBand7; /* 5.700-5.825G */ -} CMD_5G_PWR_OFFSET_T, *P_CMD_5G_PWR_OFFSET_T; - -typedef struct _CMD_PWR_PARAM_T { - UINT_32 au4Data[28]; - UINT_32 u4RefValue1; - UINT_32 u4RefValue2; -} CMD_PWR_PARAM_T, *P_CMD_PWR_PARAM_T; - - -typedef struct _CMD_PHY_PARAM_T { - UINT_8 aucData[144]; /* eFuse content */ -} CMD_PHY_PARAM_T, *P_CMD_PHY_PARAM_T; - -typedef struct _CMD_AUTO_POWER_PARAM_T { - UINT_8 ucType; /* 0: Disable 1: Enalbe 0x10: Change paramters */ - UINT_8 ucNetTypeIndex; - UINT_8 aucReserved[2]; - UINT_8 aucLevelRcpiTh[3]; - UINT_8 aucReserved2[1]; - INT_8 aicLevelPowerOffset[3]; /* signed, in unit of 0.5dBm */ - UINT_8 aucReserved3[1]; - UINT_8 aucReserved4[8]; -} CMD_AUTO_POWER_PARAM_T, *P_CMD_AUTO_POWER_PARAM_T; - - -typedef struct _EVENT_CH_PRIVILEGE_T { - UINT_8 ucNetTypeIndex; - UINT_8 ucTokenID; - UINT_8 ucStatus; - UINT_8 ucPrimaryChannel; - UINT_8 ucRfSco; - UINT_8 ucRfBand; - UINT_8 ucReqType; - UINT_8 ucReserved; - UINT_32 u4GrantInterval; /* In unit of ms */ -} EVENT_CH_PRIVILEGE_T, *P_EVENT_CH_PRIVILEGE_T; - -typedef struct _EVENT_BSS_BEACON_TIMEOUT_T { - UINT_8 ucNetTypeIndex; - UINT_8 aucReserved[3]; -} EVENT_BSS_BEACON_TIMEOUT_T, *P_EVENT_BSS_BEACON_TIMEOUT_T; - -typedef struct _EVENT_STA_AGING_TIMEOUT_T { - UINT_8 ucStaRecIdx; - UINT_8 aucReserved[3]; -} EVENT_STA_AGING_TIMEOUT_T, *P_EVENT_STA_AGING_TIMEOUT_T; - -typedef struct _EVENT_NOA_TIMING_T { - UINT_8 fgIsInUse; /* Indicate if this entry is in use or not */ - UINT_8 ucCount; /* Count */ - UINT_8 aucReserved[2]; - - UINT_32 u4Duration; /* Duration */ - UINT_32 u4Interval; /* Interval */ - UINT_32 u4StartTime; /* Start Time */ -} EVENT_NOA_TIMING_T, *P_EVENT_NOA_TIMING_T; - -typedef struct _EVENT_UPDATE_NOA_PARAMS_T { - UINT_8 ucNetTypeIndex; - UINT_8 aucReserved[2]; - UINT_8 fgEnableOppPS; - UINT_16 u2CTWindow; - - UINT_8 ucNoAIndex; - UINT_8 ucNoATimingCount; /* Number of NoA Timing */ - EVENT_NOA_TIMING_T arEventNoaTiming[8/*P2P_MAXIMUM_NOA_COUNT*/]; -} EVENT_UPDATE_NOA_PARAMS_T, *P_EVENT_UPDATE_NOA_PARAMS_T; - -typedef struct _EVENT_AP_OBSS_STATUS_T { - UINT_8 ucNetTypeIndex; - UINT_8 ucObssErpProtectMode; - UINT_8 ucObssHtProtectMode; - UINT_8 ucObssGfOperationMode; - UINT_8 ucObssRifsOperationMode; - UINT_8 ucObssBeaconForcedTo20M; - UINT_8 aucReserved[2]; -} EVENT_AP_OBSS_STATUS_T, *P_EVENT_AP_OBSS_STATUS_T; - -typedef struct _CMD_EDGE_TXPWR_LIMIT_T { - INT_8 cBandEdgeMaxPwrCCK; - INT_8 cBandEdgeMaxPwrOFDM20; - INT_8 cBandEdgeMaxPwrOFDM40; - INT_8 cReserved; -} CMD_EDGE_TXPWR_LIMIT_T, *P_CMD_EDGE_TXPWR_LIMIT_T; - -typedef struct _CMD_SET_DEVICE_MODE_T { - UINT_16 u2ChipID; - UINT_16 u2Mode; -} CMD_SET_DEVICE_MODE_T, *P_CMD_SET_DEVICE_MODE_T; - - -#if CFG_SUPPORT_RDD_TEST_MODE -typedef struct _CMD_RDD_CH_T { - UINT_8 ucRddTestMode; - UINT_8 ucRddShutCh; - UINT_8 ucRddStartCh; - UINT_8 ucRddStopCh; - UINT_8 ucRddDfs; - UINT_8 ucReserved; - UINT_8 ucReserved1; - UINT_8 ucReserved2; -} CMD_RDD_CH_T, *P_CMD_RDD_CH_T; - -typedef struct _EVENT_RDD_STATUS_T { - UINT_8 ucRddStatus; - UINT_8 aucReserved[3]; -} EVENT_RDD_STATUS_T, *P_EVENT_RDD_STATUS_T; -#endif - -typedef struct _CMD_SET_TXPWR_CTRL_T{ - INT_8 c2GLegacyStaPwrOffset; /* Unit: 0.5dBm, default: 0*/ - INT_8 c2GHotspotPwrOffset; - INT_8 c2GP2pPwrOffset; - INT_8 c2GBowPwrOffset; - INT_8 c5GLegacyStaPwrOffset; /* Unit: 0.5dBm, default: 0*/ - INT_8 c5GHotspotPwrOffset; - INT_8 c5GP2pPwrOffset; - INT_8 c5GBowPwrOffset; - UINT_8 ucConcurrencePolicy; /* TX power policy when concurrence - in the same channel - 0: Highest power has priority - 1: Lowest power has priority */ - INT_8 acReserved1[3]; /* Must be zero */ - - /* Power limit by channel for all data rates */ - INT_8 acTxPwrLimit2G[14]; /* Channel 1~14, Unit: 0.5dBm*/ - INT_8 acTxPwrLimit5G[4]; /* UNII 1~4 */ - INT_8 acReserved2[2]; /* Must be zero */ -} CMD_SET_TXPWR_CTRL_T, *P_CMD_SET_TXPWR_CTRL_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -VOID -nicCmdEventQueryMcrRead ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryMemDump ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQuerySwCtrlRead ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - - - -VOID -nicCmdEventQueryRfTestATInfo( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventSetCommon ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventSetDisassociate ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventSetIpAddress ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryLinkQuality( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryLinkSpeed( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryStatistics( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventEnterRfTest( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventLeaveRfTest( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryAddress( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryMcastAddr( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryEepromRead( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventSetMediaStreamMode( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -/* Statistics responder */ -VOID -nicCmdEventQueryXmitOk( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryRecvOk( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryXmitError( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryRecvError( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryRecvNoBuffer( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryRecvCrcError( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryRecvErrorAlignment( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryXmitOneCollision( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryXmitMoreCollisions( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -nicCmdEventQueryXmitMaxCollisions( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -/* for timeout check */ -VOID -nicOidCmdTimeoutCommon ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ); - -VOID -nicCmdTimeoutCommon ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ); - -VOID -nicOidCmdEnterRFTestTimeout ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _NIC_CMD_EVENT_H */ - diff --git a/drivers/net/wireless/mt5931/include/nic_init_cmd_event.h b/drivers/net/wireless/mt5931/include/nic_init_cmd_event.h deleted file mode 100755 index 33886c98045a..000000000000 --- a/drivers/net/wireless/mt5931/include/nic_init_cmd_event.h +++ /dev/null @@ -1,180 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic_init_cmd_event.h#1 $ -*/ - -/*! \file "nic_init_cmd_event.h" - \brief This file contains the declairation file of the WLAN initialization routines - for MediaTek Inc. 802.11 Wireless LAN Adapters. -*/ - - - -/* -** $Log: nic_init_cmd_event.h $ - * - * 09 26 2011 cp.wu - * [WCXRP00001011] [MT6628 Wi-Fi] Firmware Download Agent: make CRC validation as an optional feature - * add definition for disabling CRC32 validation (for MT6628 only) - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 03 12 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add two option for ACK and ENCRYPTION for firmware download - * - * 03 01 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add command/event definitions for initial states - * - * 02 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement host-side firmware download logic - * - * 02 08 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * prepare for implementing fw download logic - * -*/ -#ifndef _NIC_INIT_CMD_EVENT_H -#define _NIC_INIT_CMD_EVENT_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -#include "gl_typedef.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define INIT_CMD_STATUS_SUCCESS 0 -#define INIT_CMD_STATUS_REJECTED_INVALID_PARAMS 1 -#define INIT_CMD_STATUS_REJECTED_CRC_ERROR 2 -#define INIT_CMD_STATUS_REJECTED_DECRYPT_FAIL 3 -#define INIT_CMD_STATUS_UNKNOWN 4 - -#define EVENT_HDR_SIZE OFFSET_OF(WIFI_EVENT_T, aucBuffer[0]) - -typedef enum _ENUM_INIT_CMD_ID { - INIT_CMD_ID_DOWNLOAD_BUF = 1, - INIT_CMD_ID_WIFI_START, - INIT_CMD_ID_ACCESS_REG, - INIT_CMD_ID_QUERY_PENDING_ERROR -} ENUM_INIT_CMD_ID, *P_ENUM_INIT_CMD_ID; - -typedef enum _ENUM_INIT_EVENT_ID { - INIT_EVENT_ID_CMD_RESULT = 1, - INIT_EVENT_ID_ACCESS_REG, - INIT_EVENT_ID_PENDING_ERROR -} ENUM_INIT_EVENT_ID, *P_ENUM_INIT_EVENT_ID; - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef UINT_8 CMD_STATUS; - -// commands -typedef struct _INIT_WIFI_CMD_T { - UINT_8 ucCID; - UINT_8 ucSeqNum; - UINT_16 u2Reserved; - UINT_8 aucBuffer[0]; -} INIT_WIFI_CMD_T, *P_INIT_WIFI_CMD_T; - -typedef struct _INIT_HIF_TX_HEADER_T { - UINT_16 u2TxByteCount; - UINT_8 ucEtherTypeOffset; - UINT_8 ucCSflags; - INIT_WIFI_CMD_T rInitWifiCmd; -} INIT_HIF_TX_HEADER_T, *P_INIT_HIF_TX_HEADER_T; - -#define DOWNLOAD_BUF_ENCRYPTION_MODE BIT(0) -#define DOWNLOAD_BUF_NO_CRC_CHECKING BIT(30) -#define DOWNLOAD_BUF_ACK_OPTION BIT(31) -typedef struct _INIT_CMD_DOWNLOAD_BUF { - UINT_32 u4Address; - UINT_32 u4Length; - UINT_32 u4CRC32; - UINT_32 u4DataMode; - UINT_8 aucBuffer[0]; -} INIT_CMD_DOWNLOAD_BUF, *P_INIT_CMD_DOWNLOAD_BUF; - -typedef struct _INIT_CMD_WIFI_START { - UINT_32 u4Override; - UINT_32 u4Address; -} INIT_CMD_WIFI_START, *P_INIT_CMD_WIFI_START; - -typedef struct _INIT_CMD_ACCESS_REG { - UINT_8 ucSetQuery; - UINT_8 aucReserved[3]; - UINT_32 u4Address; - UINT_32 u4Data; -} INIT_CMD_ACCESS_REG, *P_INIT_CMD_ACCESS_REG; - -// Events -typedef struct _INIT_WIFI_EVENT_T { - UINT_16 u2RxByteCount; - UINT_8 ucEID; - UINT_8 ucSeqNum; - UINT_8 aucBuffer[0]; -} INIT_WIFI_EVENT_T, *P_INIT_WIFI_EVENT_T; - -typedef struct _INIT_HIF_RX_HEADER_T { - INIT_WIFI_EVENT_T rInitWifiEvent; -} INIT_HIF_RX_HEADER_T, *P_INIT_HIF_RX_HEADER_T; - -typedef struct _INIT_EVENT_CMD_RESULT { - UINT_8 ucStatus; // 0: success - // 1: rejected by invalid param - // 2: rejected by incorrect CRC - // 3: rejected by decryption failure - // 4: unknown CMD - UINT_8 aucReserved[3]; -} INIT_EVENT_CMD_RESULT, *P_INIT_EVENT_CMD_RESULT, INIT_EVENT_PENDING_ERROR, *P_INIT_EVENT_PENDING_ERROR; - -typedef struct _INIT_EVENT_ACCESS_REG { - UINT_32 u4Address; - UINT_32 u4Data; -} INIT_EVENT_ACCESS_REG, *P_INIT_EVENT_ACCESS_REG; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _NIC_INIT_CMD_EVENT_H */ - diff --git a/drivers/net/wireless/mt5931/include/p2p_precomp.h b/drivers/net/wireless/mt5931/include/p2p_precomp.h deleted file mode 100755 index 892b5b714baf..000000000000 --- a/drivers/net/wireless/mt5931/include/p2p_precomp.h +++ /dev/null @@ -1,225 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/include/p2p_precomp.h#1 $ -*/ - -/*! \file p2p_precomp.h - \brief Collection of most compiler flags for p2p driver are described here. - - In this file we collect all compiler flags and detail the p2p driver behavior if - enable/disable such switch or adjust numeric parameters. -*/ - - - -#ifndef _P2P_PRECOMP_H -#define _P2P_PRECOMP_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_os.h" // Include "config.h" - -#include "gl_p2p_os.h" - -#include "debug.h" - -#include "link.h" -#include "queue.h" - - -/*------------------------------------------------------------------------------ - * .\include\mgmt - *------------------------------------------------------------------------------ - */ -#include "wlan_typedef.h" - - -#include "mac.h" - -/* Dependency: mac.h (MAC_ADDR_LEN) */ -#include "wlan_def.h" - -#include "roaming_fsm.h" - - -/*------------------------------------------------------------------------------ - * .\include\nic - *------------------------------------------------------------------------------ - */ -/* Dependency: wlan_def.h (ENUM_NETWORK_TYPE_T) */ -#include "cmd_buf.h" - - -/* Dependency: mac.h (MAC_ADDR_LEN) */ -#include "nic_cmd_event.h" - - -/* Dependency: nic_cmd_event.h (P_EVENT_CONNECTION_STATUS) */ -#include "nic.h" - -#include "nic_init_cmd_event.h" - -#include "hif_rx.h" -#include "hif_tx.h" - -#include "nic_tx.h" - -/* Dependency: hif_rx.h (P_HIF_RX_HEADER_T) */ -#include "nic_rx.h" - -#include "que_mgt.h" - -#if CFG_ENABLE_WIFI_DIRECT -#include "p2p_typedef.h" -#include "p2p_cmd_buf.h" -#include "p2p_nic_cmd_event.h" -#include "p2p_mac.h" -#include "p2p_nic.h" -#endif - - -/*------------------------------------------------------------------------------ - * .\include\mgmt - *------------------------------------------------------------------------------ - */ - -#include "hem_mbox.h" - -#include "scan.h" -#include "bss.h" - -#include "wlan_lib.h" -#include "wlan_oid.h" -#include "wlan_bow.h" - -#include "wlan_p2p.h" - - - - -#include "hal.h" - -#if defined(MT6620) - #include "mt6620_reg.h" -#elif defined(MT5931) - #include "mt5931_reg.h" -#endif - -#include "rlm.h" -#include "rlm_domain.h" -#include "rlm_protection.h" -#include "rlm_obss.h" -#include "rate.h" - - -#include "aa_fsm.h" - -#include "cnm_timer.h" - -#if CFG_ENABLE_BT_OVER_WIFI -#include "bow.h" -#include "bow_fsm.h" -#endif - -#include "pwr_mgt.h" - - -#include "cnm.h" -/* Dependency: aa_fsm.h (ENUM_AA_STATE_T), p2p_fsm.h (WPS_ATTRI_MAX_LEN_DEVICE_NAME) */ -#include "cnm_mem.h" -#include "cnm_scan.h" - -#include "p2p_rlm_obss.h" -#include "p2p_bss.h" -#include "p2p.h" -/* Dependency: cnm_timer.h (TIMER_T) */ -#include "p2p_fsm.h" -#include "p2p_scan.h" -#include "p2p_state.h" -#include "p2p_func.h" -#include "p2p_rlm.h" -#include "p2p_assoc.h" -#include "p2p_ie.h" - - -#include "privacy.h" - -#include "mib.h" - -#include "auth.h" -#include "assoc.h" - - -#include "ais_fsm.h" - - -#include "adapter.h" - - -#include "que_mgt.h" -#include "rftest.h" - - -#if CFG_RSN_MIGRATION -#include "rsn.h" -#include "sec_fsm.h" -#endif - -#if CFG_SUPPORT_WAPI -#include "wapi.h" -#endif - -/*------------------------------------------------------------------------------ - * NVRAM structure - *------------------------------------------------------------------------------ - */ -#include "CFG_Wifi_File.h" - -#include "gl_p2p_kal.h" - - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /*_P2P_PRECOMP_H */ - - - diff --git a/drivers/net/wireless/mt5931/include/p2p_typedef.h b/drivers/net/wireless/mt5931/include/p2p_typedef.h deleted file mode 100755 index c8aa47fb6297..000000000000 --- a/drivers/net/wireless/mt5931/include/p2p_typedef.h +++ /dev/null @@ -1,278 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/p2p_typedef.h#1 $ -*/ - -/*! \file p2p_typedef.h - \brief Declaration of data type and return values of internal protocol stack. - - In this file we declare the data type and return values which will be exported - to all MGMT Protocol Stack. -*/ - - - - -#ifndef _P2P_TYPEDEF_H -#define _P2P_TYPEDEF_H - -#if CFG_ENABLE_WIFI_DIRECT - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/* -* type definition of pointer to p2p structure -*/ -//typedef struct _GL_P2P_INFO_T GL_P2P_INFO_T, *P_GL_P2P_INFO_T; -typedef struct _P2P_INFO_T P2P_INFO_T, *P_P2P_INFO_T; - -typedef struct _P2P_FSM_INFO_T P2P_FSM_INFO_T, *P_P2P_FSM_INFO_T; - -typedef struct _P2P_CONNECTION_SETTINGS_T P2P_CONNECTION_SETTINGS_T, *P_P2P_CONNECTION_SETTINGS_T; - - -/* Type definition for function pointer to p2p function*/ -typedef BOOLEAN (*P2P_LAUNCH)( - P_GLUE_INFO_T prGlueInfo - ); - -typedef BOOLEAN (*P2P_REMOVE)( - P_GLUE_INFO_T prGlueInfo, - BOOLEAN fgIsWlanLaunched - ); - -typedef BOOLEAN (*KAL_P2P_GET_CIPHER)( - IN P_GLUE_INFO_T prGlueInfo - ); - -typedef BOOLEAN (*KAL_P2P_GET_TKIP_CIPHER)( - IN P_GLUE_INFO_T prGlueInfo - ); - -typedef BOOLEAN (*KAL_P2P_GET_CCMP_CIPHER)( - IN P_GLUE_INFO_T prGlueInfo - ); - -typedef BOOLEAN (*KAL_P2P_GET_WSC_MODE)( - IN P_GLUE_INFO_T prGlueInfo - ); - -typedef struct net_device* (*KAL_P2P_GET_DEV_HDLR)( - P_GLUE_INFO_T prGlueInfo - ); - -typedef VOID (*KAL_P2P_SET_MULTICAST_WORK_ITEM) ( - P_GLUE_INFO_T prGlueInfo - ); - -typedef VOID (*P2P_NET_REGISTER) ( - P_GLUE_INFO_T prGlueInfo - ); - -typedef VOID (*P2P_NET_UNREGISTER) ( - P_GLUE_INFO_T prGlueInfo - ); - -typedef VOID (*KAL_P2P_UPDATE_ASSOC_INFO)( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucFrameBody, - IN UINT_32 u4FrameBodyLen, - IN BOOLEAN fgReassocRequest - ); - -typedef BOOLEAN (*P2P_VALIDATE_AUTH) ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN PP_STA_RECORD_T pprStaRec, - OUT PUINT_16 pu2StatusCode - ); - -typedef BOOLEAN (*P2P_VALIDATE_ASSOC_REQ) ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_16 pu4ControlFlags - ); - -typedef VOID (*P2P_RUN_EVENT_AAA_TX_FAIL) ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -typedef BOOLEAN (*P2P_PARSE_CHECK_FOR_P2P_INFO_ELEM)( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBuf, - OUT PUINT_8 pucOuiType - ); - - -typedef WLAN_STATUS (*P2P_RUN_EVENT_AAA_COMPLETE) ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -typedef VOID (*P2P_PROCESS_EVENT_UPDATE_NOA_PARAM) ( - IN P_ADAPTER_T prAdapter, - UINT_8 ucNetTypeIndex, - P_EVENT_UPDATE_NOA_PARAMS_T prEventUpdateNoaParam - ); - -typedef VOID (*SCAN_P2P_PROCESS_BEACON_AND_PROBE_RESP) ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN P_WLAN_STATUS prStatus, - IN P_BSS_DESC_T prBssDesc, - IN P_WLAN_BEACON_FRAME_T prWlanBeaconFrame - ); - -typedef VOID (*P2P_RX_PUBLIC_ACTION_FRAME) ( - P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - -typedef VOID (*RLM_RSP_GENERATE_OBSS_SCAN_IE) ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ); - -typedef VOID (*RLM_UPDATE_BW_BY_CH_LIST_FOR_AP)( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ); - -typedef VOID (*RLM_PROCESS_PUBLIC_ACTION)( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb - ); - -typedef VOID (*RLM_PROCESS_HT_ACTION)( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb - ); - -typedef VOID (*RLM_UPDATE_PARAMS_FOR_AP)( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - BOOLEAN fgUpdateBeacon - ); - -typedef VOID (*RLM_HANDLE_OBSS_STATUS_EVENT_PKT) ( - P_ADAPTER_T prAdapter, - P_EVENT_AP_OBSS_STATUS_T prObssStatus - ); - - -typedef BOOLEAN (*P2P_FUNC_VALIDATE_PROBE_REQ) ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_32 pu4ControlFlags - ); - -typedef VOID (*RLM_BSS_INIT_FOR_AP)( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ); - -typedef UINT_32 (*P2P_GET_PROB_RSP_IE_TABLE_SIZE)( - VOID - ); - -typedef PUINT_8 (*P2P_BUILD_REASSOC_REQ_FRAME_COMMON_IES) ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN PUINT_8 pucBuffer - ); - - -typedef VOID (*P2P_FUNC_DISCONNECT) ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN BOOLEAN fgSendDeauth, - IN UINT_16 u2ReasonCode - ); - -typedef VOID (*P2P_FSM_RUN_EVENT_RX_DEAUTH) ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prSwRfb - ); - -typedef VOID (*P2P_FSM_RUN_EVENT_RX_DISASSOC) ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prSwRfb - ); - -typedef BOOLEAN (*P2P_FUN_IS_AP_MODE) ( - IN P_P2P_FSM_INFO_T prP2pFsmInfo - ); - -typedef VOID (*P2P_FSM_RUN_EVENT_BEACON_TIMEOUT) ( - IN P_ADAPTER_T prAdapter - ); - - -typedef VOID (*P2P_FUNC_STORE_ASSOC_RSP_IE_BUFFER) ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); - - -typedef VOID (*P2P_GENERATE_P2P_IE) ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -typedef UINT_32 (*P2P_CALCULATE_P2P_IE_LEN) ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ); - - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#endif /*CFG_ENABLE_WIFI_DIRECT*/ - -#endif /* _P2P_TYPEDEF_H */ - - diff --git a/drivers/net/wireless/mt5931/include/precomp.h b/drivers/net/wireless/mt5931/include/precomp.h deleted file mode 100755 index 0e5a8e372076..000000000000 --- a/drivers/net/wireless/mt5931/include/precomp.h +++ /dev/null @@ -1,380 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/precomp.h#2 $ -*/ - -/*! \file precomp.h - \brief Collection of most compiler flags are described here. - - In this file we collect all compiler flags and detail the driver behavior if - enable/disable such switch or adjust numeric parameters. -*/ - - - -/* -** $Log: precomp.h $ - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 01 05 2012 tsaiyuan.hsu - * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v - * add timing measurement support for 802.11v. - * - * 08 15 2011 cp.wu - * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree - * add MT6628-specific definitions. - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 03 15 2011 eddie.chen - * [WCXRP00000554] [MT6620 Wi-Fi][DRV] Add sw control debug counter - * Add sw debug counter for QM. - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * - * 12 13 2010 cp.wu - * [WCXRP00000260] [MT6620 Wi-Fi][Driver][Firmware] Create V1.1 branch for both firmware and driver - * create branch for Wi-Fi driver v1.1 - * - * 10 07 2010 cp.wu - * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection - * add firmware download for MT5931. - * - * 10 05 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * 1) add NVRAM access API - * 2) fake scanning result when NVRAM doesn't exist and/or version mismatch. (off by compiler option) - * 3) add OID implementation for NVRAM read/write service - * - * 09 21 2010 kevin.huang - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * Isolate P2P related function for Hardware Software Bundle - * - * 09 14 2010 chinghwa.yu - * NULL - * Fix BOW_FSM_INFO_T dependence. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 07 20 2010 wh.su - * - * adding the wapi code. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Check draft RLM code for HT cap - * - * 07 01 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Modify CNM message handler for new flow - * - * 06 28 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * 1st draft code for RLM module - * - * 06 19 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * consdier the concurrent network setting. - * - * 06 18 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * migration the security related function from firmware. - * - * 06 18 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * migration from MT6620 firmware. - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add hem_mbox.c and cnm_mem.h (but disabled some feature) for further migration - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge cnm_scan.h and hem_mbox.h - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge wifi_var.h, precomp.h, cnm_timer.h (data type only) - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * 1) add timeout handler mechanism for pending command packets - * 2) add p2p add/removal key - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * * * * * * * * 2) command sequence number is now increased atomically - * * * * * * * * * * * 3) private data could be hold and taken use for other purpose - * - * 03 16 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * build up basic data structure and definitions to support BT-over-WiFi - * - * 02 08 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * prepare for implementing fw download logic - * - * 01 27 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * . -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-12-08 11:30:58 GMT mtk02752 -** add rftest.h for implementing RF test mode in driver land -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-11-23 22:02:00 GMT mtk02468 -** Added que_mgt.h -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-10-13 21:58:36 GMT mtk01084 -** update for new macro define -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-21 09:40:11 GMT mtk01461 -** Add nic_cmd_event.h -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-04-17 20:00:26 GMT mtk01461 -** Add cmd_buf.h -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-19 18:32:44 GMT mtk01084 -** update for basic power management functions -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-16 09:08:25 GMT mtk01461 -** Update TX PATH API -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:11:38 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _PRECOMP_H -#define _PRECOMP_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_os.h" // Include "config.h" - -#if CFG_ENABLE_WIFI_DIRECT -#include "gl_p2p_os.h" -#endif - -#include "debug.h" - -#include "link.h" -#include "queue.h" - - -/*------------------------------------------------------------------------------ - * .\include\mgmt - *------------------------------------------------------------------------------ - */ -#include "wlan_typedef.h" - -#include "mac.h" - -/* Dependency: mac.h (MAC_ADDR_LEN) */ -#include "wlan_def.h" - -#if CFG_SUPPORT_SWCR -#include "swcr.h" -#endif - -/*------------------------------------------------------------------------------ - * .\include\nic - *------------------------------------------------------------------------------ - */ -/* Dependency: wlan_def.h (ENUM_NETWORK_TYPE_T) */ -#include "cmd_buf.h" - -/* Dependency: mac.h (MAC_ADDR_LEN) */ -#include "nic_cmd_event.h" - -/* Dependency: nic_cmd_event.h (P_EVENT_CONNECTION_STATUS) */ -#include "nic.h" - -#include "nic_init_cmd_event.h" - -#include "hif_rx.h" -#include "hif_tx.h" - -#include "nic_tx.h" - -/* Dependency: hif_rx.h (P_HIF_RX_HEADER_T) */ -#include "nic_rx.h" - -#include "que_mgt.h" - -#if CFG_ENABLE_WIFI_DIRECT -#include "p2p_typedef.h" -#include "p2p_cmd_buf.h" -#include "p2p_nic_cmd_event.h" -#include "p2p_mac.h" -#include "p2p_nic.h" -#endif - - -/*------------------------------------------------------------------------------ - * .\include\mgmt - *------------------------------------------------------------------------------ - */ - -#include "hem_mbox.h" - -#include "scan.h" -#include "bss.h" - -#include "wlan_lib.h" -#include "wlan_oid.h" -#include "wlan_bow.h" - -#if CFG_ENABLE_WIFI_DIRECT -#include "wlan_p2p.h" -#endif - -#include "hal.h" - -#if defined(MT6620) - #include "mt6620_reg.h" -#elif defined(MT5931) - #include "mt5931_reg.h" -#elif defined(MT6628) - #include "mt6628_reg.h" -#endif - -#include "rlm.h" -#include "rlm_domain.h" -#include "rlm_protection.h" -#include "rlm_obss.h" -#include "rate.h" -#if CFG_SUPPORT_802_11V -#include "wnm.h" -#endif - -#include "aa_fsm.h" - -#include "cnm_timer.h" - - -#if CFG_ENABLE_BT_OVER_WIFI -#include "bow.h" -#include "bow_fsm.h" -#endif - -#include "pwr_mgt.h" - - -#include "cnm.h" -/* Dependency: aa_fsm.h (ENUM_AA_STATE_T), p2p_fsm.h (WPS_ATTRI_MAX_LEN_DEVICE_NAME) */ -#include "cnm_mem.h" -#include "cnm_scan.h" - - -#if CFG_ENABLE_WIFI_DIRECT -#include "p2p_rlm_obss.h" -#include "p2p_bss.h" -#include "p2p.h" -#include "p2p_fsm.h" -#include "p2p_scan.h" -#include "p2p_state.h" -#include "p2p_func.h" -#include "p2p_rlm.h" -#include "p2p_assoc.h" -#include "p2p_ie.h" -#endif - -#include "privacy.h" - -#include "mib.h" - -#include "auth.h" -#include "assoc.h" - -#if CFG_SUPPORT_ROAMING -#include "roaming_fsm.h" -#endif /* CFG_SUPPORT_ROAMING */ - -#include "ais_fsm.h" - - -#include "adapter.h" - - -#include "que_mgt.h" -#include "rftest.h" - - -#if CFG_RSN_MIGRATION -#include "rsn.h" -#include "sec_fsm.h" -#endif - -#if CFG_SUPPORT_WAPI -#include "wapi.h" -#endif - -/*------------------------------------------------------------------------------ - * NVRAM structure - *------------------------------------------------------------------------------ - */ -#include "CFG_Wifi_File.h" - -#if CFG_ENABLE_WIFI_DIRECT -#include "gl_p2p_kal.h" -#endif - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _PRECOMP_H */ - - diff --git a/drivers/net/wireless/mt5931/include/pwr_mgt.h b/drivers/net/wireless/mt5931/include/pwr_mgt.h deleted file mode 100755 index 4819de0fd9bb..000000000000 --- a/drivers/net/wireless/mt5931/include/pwr_mgt.h +++ /dev/null @@ -1,147 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/pwr_mgt.h#1 $ -*/ - -/*! \file "pwr_mgt.h" - \brief In this file we define the STATE and EVENT for Power Management FSM. - - The SCAN FSM is responsible for performing SCAN behavior when the Arbiter enter - ARB_STATE_SCAN. The STATE and EVENT for SCAN FSM are defined here with detail - description. -*/ - - - -/* -** $Log: pwr_mgt.h $ - * - * 07 09 2010 george.huang - * - * [WPD00001556] Migrate PM variables from FW to driver: for composing QoS Info - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 04 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * don't need SPIN_LOCK_PWR_CTRL anymore, it will raise IRQL - * and cause SdBusSubmitRequest running at DISPATCH_LEVEL as well. - - * - * 03 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * firmware download load adress & start address are now configured from config.h - * * * due to the different configurations on FPGA and ASIC -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-12-10 16:39:10 GMT mtk02752 -** disable PM macros temporally -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-10-29 19:48:37 GMT mtk01084 -** temp remove power management macro -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-04-08 16:51:11 GMT mtk01084 -** update for power management control macro -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-04-03 14:59:58 GMT mtk01426 -** Add #if CFG_HIF_LOOPBACK_PRETEST -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-23 16:53:10 GMT mtk01084 -** modify ACQUIRE_POWER_CONTROL_FROM_PM() and RECLAIM_POWER_CONTROL_TO_PM() macro -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-19 18:32:47 GMT mtk01084 -** update for basic power management functions -** \main\maintrunk.MT6620WiFiDriver_Prj\1 2009-03-19 15:05:20 GMT mtk01084 -** Initial version -** -*/ - -#ifndef _PWR_MGT_H -#define _PWR_MGT_H -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define PM_UAPSD_AC0 (BIT(0)) -#define PM_UAPSD_AC1 (BIT(1)) -#define PM_UAPSD_AC2 (BIT(2)) -#define PM_UAPSD_AC3 (BIT(3)) - -#define PM_UAPSD_ALL (PM_UAPSD_AC0 | PM_UAPSD_AC1 | PM_UAPSD_AC2 | PM_UAPSD_AC3) -#define PM_UAPSD_NONE 0 - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef struct _PM_PROFILE_SETUP_INFO_T { - /* Profile setup */ - UINT_8 ucBmpDeliveryAC; /* 0: AC_BE, 1: AC_BK, 2: AC_VI, 3: AC_VO */ - UINT_8 ucBmpTriggerAC; /* 0: AC_BE, 1: AC_BK, 2: AC_VI, 3: AC_VO */ - - UINT_8 ucUapsdSp; /* Number of triggered packets in UAPSD */ - -} PM_PROFILE_SETUP_INFO_T, *P_PM_PROFILE_SETUP_INFO_T; - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -#if !CFG_ENABLE_FULL_PM - #define ACQUIRE_POWER_CONTROL_FROM_PM(_prAdapter) - #define RECLAIM_POWER_CONTROL_TO_PM(_prAdapter, _fgEnableGINT_in_IST) -#else - #define ACQUIRE_POWER_CONTROL_FROM_PM(_prAdapter) \ - { \ - if (_prAdapter->fgIsFwOwn) { \ - nicpmSetDriverOwn(_prAdapter); \ - } \ - /* Increase Block to Enter Low Power Semaphore count */ \ - GLUE_INC_REF_CNT(_prAdapter->u4PwrCtrlBlockCnt); \ - } - - #define RECLAIM_POWER_CONTROL_TO_PM(_prAdapter, _fgEnableGINT_in_IST) \ - { \ - ASSERT(_prAdapter->u4PwrCtrlBlockCnt != 0); \ - /* Decrease Block to Enter Low Power Semaphore count */ \ - GLUE_DEC_REF_CNT(_prAdapter->u4PwrCtrlBlockCnt); \ - if (_prAdapter->fgWiFiInSleepyState && (_prAdapter->u4PwrCtrlBlockCnt == 0)) { \ - nicpmSetFWOwn(_prAdapter, _fgEnableGINT_in_IST); \ - } \ - } -#endif - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _PWR_MGT_H */ - diff --git a/drivers/net/wireless/mt5931/include/queue.h b/drivers/net/wireless/mt5931/include/queue.h deleted file mode 100755 index a7773e9d592d..000000000000 --- a/drivers/net/wireless/mt5931/include/queue.h +++ /dev/null @@ -1,189 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/queue.h#1 $ -*/ - -/*! \file queue.h - \brief Definition for singly queue operations. - - In this file we define the singly queue data structure and its - queue operation MACROs. -*/ - - - -/* -** $Log: queue.h $ - * - * 07 16 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * bugfix for SCN migration - * 1) modify QUEUE_CONCATENATE_QUEUES() so it could be used to concatence with an empty queue - * 2) before AIS issues scan request, network(BSS) needs to be activated first - * 3) only invoke COPY_SSID when using specified SSID for scan - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 04 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * . -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:11:46 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _QUEUE_H -#define _QUEUE_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_typedef.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/* Singly Queue Structures - Entry Part */ -typedef struct _QUE_ENTRY_T { - struct _QUE_ENTRY_T *prNext; - struct _QUE_ENTRY_T *prPrev; /* For Rx buffer reordering used only */ -} QUE_ENTRY_T, *P_QUE_ENTRY_T; - -/* Singly Queue Structures - Queue Part */ -typedef struct _QUE_T { - P_QUE_ENTRY_T prHead; - P_QUE_ENTRY_T prTail; - UINT_32 u4NumElem; -} QUE_T, *P_QUE_T; - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#define QUEUE_INITIALIZE(prQueue) \ - { \ - (prQueue)->prHead = (P_QUE_ENTRY_T)NULL; \ - (prQueue)->prTail = (P_QUE_ENTRY_T)NULL; \ - (prQueue)->u4NumElem = 0; \ - } - -#define QUEUE_IS_EMPTY(prQueue) (((P_QUE_T)(prQueue))->prHead == (P_QUE_ENTRY_T)NULL) - -#define QUEUE_IS_NOT_EMPTY(prQueue) ((prQueue)->u4NumElem > 0) - -#define QUEUE_GET_HEAD(prQueue) ((prQueue)->prHead) - -#define QUEUE_GET_TAIL(prQueue) ((prQueue)->prTail) - -#define QUEUE_GET_NEXT_ENTRY(prQueueEntry) ((prQueueEntry)->prNext) - -#define QUEUE_INSERT_HEAD(prQueue, prQueueEntry) \ - { \ - ASSERT(prQueue); \ - ASSERT(prQueueEntry); \ - (prQueueEntry)->prNext = (prQueue)->prHead; \ - (prQueue)->prHead = (prQueueEntry); \ - if ((prQueue)->prTail == (P_QUE_ENTRY_T)NULL) { \ - (prQueue)->prTail = (prQueueEntry); \ - } \ - ((prQueue)->u4NumElem)++; \ - } - -#define QUEUE_INSERT_TAIL(prQueue, prQueueEntry) \ - { \ - ASSERT(prQueue); \ - ASSERT(prQueueEntry); \ - (prQueueEntry)->prNext = (P_QUE_ENTRY_T)NULL; \ - if ((prQueue)->prTail) { \ - ((prQueue)->prTail)->prNext = (prQueueEntry); \ - } else { \ - (prQueue)->prHead = (prQueueEntry); \ - } \ - (prQueue)->prTail = (prQueueEntry); \ - ((prQueue)->u4NumElem)++; \ - } - -/* NOTE: We assume the queue entry located at the beginning of "prQueueEntry Type", - * so that we can cast the queue entry to other data type without doubts. - * And this macro also decrease the total entry count at the same time. - */ -#define QUEUE_REMOVE_HEAD(prQueue, prQueueEntry, _P_TYPE) \ - { \ - ASSERT(prQueue); \ - prQueueEntry = (_P_TYPE)((prQueue)->prHead); \ - if (prQueueEntry) { \ - (prQueue)->prHead = ((P_QUE_ENTRY_T)(prQueueEntry))->prNext; \ - if ((prQueue)->prHead == (P_QUE_ENTRY_T)NULL){ \ - (prQueue)->prTail = (P_QUE_ENTRY_T)NULL; \ - } \ - ((P_QUE_ENTRY_T)(prQueueEntry))->prNext = (P_QUE_ENTRY_T)NULL; \ - ((prQueue)->u4NumElem)--; \ - } \ - } - -#define QUEUE_MOVE_ALL(prDestQueue, prSrcQueue) \ - { \ - ASSERT(prDestQueue); \ - ASSERT(prSrcQueue); \ - *(P_QUE_T)prDestQueue = *(P_QUE_T)prSrcQueue; \ - QUEUE_INITIALIZE(prSrcQueue); \ - } - -#define QUEUE_CONCATENATE_QUEUES(prDestQueue, prSrcQueue) \ - { \ - ASSERT(prDestQueue); \ - ASSERT(prSrcQueue); \ - if (prSrcQueue->u4NumElem > 0) { \ - if ((prDestQueue)->prTail) { \ - ((prDestQueue)->prTail)->prNext = (prSrcQueue)->prHead; \ - } else { \ - (prDestQueue)->prHead = (prSrcQueue)->prHead; \ - } \ - (prDestQueue)->prTail = (prSrcQueue)->prTail; \ - ((prDestQueue)->u4NumElem) += ((prSrcQueue)->u4NumElem); \ - QUEUE_INITIALIZE(prSrcQueue); \ - } \ - } - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _QUEUE_H */ - diff --git a/drivers/net/wireless/mt5931/include/rftest.h b/drivers/net/wireless/mt5931/include/rftest.h deleted file mode 100755 index ae6541dc2e92..000000000000 --- a/drivers/net/wireless/mt5931/include/rftest.h +++ /dev/null @@ -1,317 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/rftest.h#1 $ -*/ - -/*! \file "rftest.h" - \brief definitions for RF Productino test - -*/ - - - -/* -** $Log: rftest.h $ - * - * 12 20 2011 cp.wu - * [WCXRP00001144] [MT6620 Wi-Fi][Driver][Firmware] Add RF_FUNC_ID for exposing device and related version information - * add driver implementations for RF_AT_FUNCID_FW_INFO & RF_AT_FUNCID_DRV_INFO - * to expose version information - * - * 08 04 2010 cp.wu - * NULL - * add an extra parameter to rftestQueryATInfo 'cause it's necessary to pass u4FuncData for query request. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 04 14 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * information buffer for query oid/ioctl is now buffered in prCmdInfo - * * * * instead of glue-layer variable to improve multiple oid/ioctl capability - * - * 12 30 2009 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) According to CMD/EVENT documentation v0.8, - * * * * * * * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used, - * * * * * * * and result is retrieved by get ATInfo instead - * * * * * * * 2) add 4 counter for recording aggregation statistics -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-12-08 17:35:11 GMT mtk02752 -** * comment out RF test which is not supported on MT6620 -** + API decalre for rftest -** \main\maintrunk.MT6620WiFiDriver_Prj\1 2009-12-08 11:29:07 GMT mtk02752 -** definitions for RF test mode -** -*/ -#ifndef _RFTEST_H -#define _RFTEST_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -// Table Version -#define RF_AUTO_TEST_FUNCTION_TABLE_VERSION 0x01000001 - -// Power -#define RF_AT_PARAM_POWER_MASK BITS(0,7) -#define RF_AT_PARAM_POWER_MAX RF_AT_PARAM_POWER_MASK - -// Rate -#define RF_AT_PARAM_RATE_MCS_MASK BIT(31) -#define RF_AT_PARAM_RATE_MASK BITS(0,7) -#define RF_AT_PARAM_RATE_CCK_MAX 3 -#define RF_AT_PARAM_RATE_1M 0 -#define RF_AT_PARAM_RATE_2M 1 -#define RF_AT_PARAM_RATE_5_5M 2 -#define RF_AT_PARAM_RATE_11M 3 -#define RF_AT_PARAM_RATE_6M 4 -#define RF_AT_PARAM_RATE_9M 5 -#define RF_AT_PARAM_RATE_12M 6 -#define RF_AT_PARAM_RATE_18M 7 -#define RF_AT_PARAM_RATE_24M 8 -#define RF_AT_PARAM_RATE_36M 9 -#define RF_AT_PARAM_RATE_48M 10 -#define RF_AT_PARAM_RATE_54M 11 - -// Antenna -#define RF_AT_PARAM_ANTENNA_ID_MASK BITS(0,7) -#define RF_AT_PARAM_ANTENNA_ID_MAX 1 - -// Packet Length -#define RF_AT_PARAM_TX_80211HDR_BYTE_MAX (32) -#define RF_AT_PARAM_TX_80211PAYLOAD_BYTE_MAX (2048) - -#define RF_AT_PARAM_TX_PKTLEN_BYTE_DEFAULT 1024 -#define RF_AT_PARAM_TX_PKTLEN_BYTE_MAX \ - ((UINT_16)(RF_AT_PARAM_TX_80211HDR_BYTE_MAX + RF_AT_PARAM_TX_80211PAYLOAD_BYTE_MAX )) - -// Packet Count -#define RF_AT_PARAM_TX_PKTCNT_DEFAULT 1000 -#define RF_AT_PARAM_TX_PKTCNT_UNLIMITED 0 - -// Packet Interval -#define RF_AT_PARAM_TX_PKT_INTERVAL_US_DEFAULT 50 - -// ALC -#define RF_AT_PARAM_ALC_DISABLE 0 -#define RF_AT_PARAM_ALC_ENABLE 1 - -// TXOP -#define RF_AT_PARAM_TXOP_DEFAULT 0 -#define RF_AT_PARAM_TXOPQUE_QMASK BITS(16,31) -#define RF_AT_PARAM_TXOPQUE_TMASK BITS(0,15) -#define RF_AT_PARAM_TXOPQUE_AC0 (0<<16) -#define RF_AT_PARAM_TXOPQUE_AC1 (1<<16) -#define RF_AT_PARAM_TXOPQUE_AC2 (2<<16) -#define RF_AT_PARAM_TXOPQUE_AC3 (3<<16) -#define RF_AT_PARAM_TXOPQUE_AC4 (4<<16) -#define RF_AT_PARAM_TXOPQUE_QOFFSET 16 - -// Retry Limit -#define RF_AT_PARAM_TX_RETRY_DEFAULT 0 -#define RF_AT_PARAM_TX_RETRY_MAX 6 - -// QoS Queue -#define RF_AT_PARAM_QOSQUE_AC0 0 -#define RF_AT_PARAM_QOSQUE_AC1 1 -#define RF_AT_PARAM_QOSQUE_AC2 2 -#define RF_AT_PARAM_QOSQUE_AC3 3 -#define RF_AT_PARAM_QOSQUE_AC4 4 -#define RF_AT_PARAM_QOSQUE_DEFAULT RF_AT_PARAM_QOSQUE_AC0 - -// Bandwidth -#define RF_AT_PARAM_BANDWIDTH_20MHZ 0 -#define RF_AT_PARAM_BANDWIDTH_40MHZ 1 -#define RF_AT_PARAM_BANDWIDTH_U20_IN_40MHZ 2 -#define RF_AT_PARAM_BANDWIDTH_D20_IN_40MHZ 3 -#define RF_AT_PARAM_BANDWIDTH_DEFAULT RF_AT_PARAM_BANDWIDTH_20MHZ - -// GI (Guard Interval) -#define RF_AT_PARAM_GI_800NS 0 -#define RF_AT_PARAM_GI_400NS 1 -#define RF_AT_PARAM_GI_DEFAULT RF_AT_PARAM_GI_800NS - -// STBC -#define RF_AT_PARAM_STBC_DISABLE 0 -#define RF_AT_PARAM_STBC_ENABLE 1 - -// RIFS -#define RF_AT_PARAM_RIFS_DISABLE 0 -#define RF_AT_PARAM_RIFS_ENABLE 1 - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -// Function ID List -typedef enum _ENUM_RF_AT_FUNCID_T { - RF_AT_FUNCID_VERSION = 0, - RF_AT_FUNCID_COMMAND, - RF_AT_FUNCID_POWER, - RF_AT_FUNCID_RATE, - RF_AT_FUNCID_PREAMBLE, - RF_AT_FUNCID_ANTENNA, - RF_AT_FUNCID_PKTLEN, - RF_AT_FUNCID_PKTCNT, - RF_AT_FUNCID_PKTINTERVAL, - RF_AT_FUNCID_TEMP_COMPEN, - RF_AT_FUNCID_TXOPLIMIT, - RF_AT_FUNCID_ACKPOLICY, - RF_AT_FUNCID_PKTCONTENT, - RF_AT_FUNCID_RETRYLIMIT, - RF_AT_FUNCID_QUEUE, - RF_AT_FUNCID_BANDWIDTH, - RF_AT_FUNCID_GI, - RF_AT_FUNCID_STBC, - RF_AT_FUNCID_CHNL_FREQ, - RF_AT_FUNCID_RIFS, - RF_AT_FUNCID_TRSW_TYPE, - RF_AT_FUNCID_RF_SX_SHUTDOWN, - RF_AT_FUNCID_PLL_SHUTDOWN, - RF_AT_FUNCID_SLOW_CLK_MODE, - RF_AT_FUNCID_ADC_CLK_MODE, - RF_AT_FUNCID_MEASURE_MODE, - RF_AT_FUNCID_VOLT_COMPEN, - RF_AT_FUNCID_DPD_TX_GAIN, - RF_AT_FUNCID_DPD_MODE, - RF_AT_FUNCID_TSSI_MODE, - RF_AT_FUNCID_TX_GAIN_CODE, - RF_AT_FUNCID_TX_PWR_MODE, - - /* Query command */ - RF_AT_FUNCID_TXED_COUNT = 32, - RF_AT_FUNCID_TXOK_COUNT, - RF_AT_FUNCID_RXOK_COUNT, - RF_AT_FUNCID_RXERROR_COUNT, - RF_AT_FUNCID_RESULT_INFO, - RF_AT_FUNCID_TRX_IQ_RESULT, - RF_AT_FUNCID_TSSI_RESULT, - RF_AT_FUNCID_DPD_RESULT, - RF_AT_FUNCID_RXV_DUMP, - RF_AT_FUNCID_RX_PHY_STATIS, - RF_AT_FUNCID_MEASURE_RESULT, - RF_AT_FUNCID_TEMP_SENSOR, - RF_AT_FUNCID_VOLT_SENSOR, - RF_AT_FUNCID_READ_EFUSE, - RF_AT_FUNCID_RX_RSSI, - RF_AT_FUNCID_FW_INFO, - RF_AT_FUNCID_DRV_INFO, - - /* Set command */ - RF_AT_FUNCID_SET_DPD_RESULT = 64, - RF_AT_FUNCID_SET_CW_MODE, - RF_AT_FUNCID_SET_JAPAN_CH14_FILTER, - RF_AT_FUNCID_WRITE_EFUSE, - RF_AT_FUNCID_SET_MAC_ADDRESS - -} ENUM_RF_AT_FUNCID_T; - -// Command -typedef enum _ENUM_RF_AT_COMMAND_T { - RF_AT_COMMAND_STOPTEST = 0, - RF_AT_COMMAND_STARTTX, - RF_AT_COMMAND_STARTRX, - RF_AT_COMMAND_RESET, - RF_AT_COMMAND_OUTPUT_POWER, /* Payload */ - RF_AT_COMMAND_LO_LEAKAGE, /* Local freq is renamed to Local leakage */ - RF_AT_COMMAND_CARRIER_SUPPR, /* OFDM (LTF/STF), CCK (PI,PI/2) */ - RF_AT_COMMAND_TRX_IQ_CAL, - RF_AT_COMMAND_TSSI_CAL, - RF_AT_COMMAND_DPD_CAL, - RF_AT_COMMAND_CW, - RF_AT_COMMAND_NUM -} ENUM_RF_AT_COMMAND_T; - -// Preamble -typedef enum _ENUM_RF_AT_PREAMBLE_T { - RF_AT_PREAMBLE_NORMAL = 0, - RF_AT_PREAMBLE_CCK_SHORT, - RF_AT_PREAMBLE_11N_MM, - RF_AT_PREAMBLE_11N_GF, - RF_AT_PREAMBLE_NUM -} ENUM_RF_AT_PREAMBLE_T; - -// Ack Policy -typedef enum _ENUM_RF_AT_ACK_POLICY_T { - RF_AT_ACK_POLICY_NORMAL = 0, - RF_AT_ACK_POLICY_NOACK, - RF_AT_ACK_POLICY_NOEXPLICTACK, - RF_AT_ACK_POLICY_BLOCKACK, - RF_AT_ACK_POLICY_NUM -} ENUM_RF_AT_ACK_POLICY_T; - -typedef enum _ENUM_RF_AUTOTEST_STATE_T { - RF_AUTOTEST_STATE_STANDBY = 0, - RF_AUTOTEST_STATE_TX, - RF_AUTOTEST_STATE_RX, - RF_AUTOTEST_STATE_RESET, - RF_AUTOTEST_STATE_OUTPUT_POWER, - RF_AUTOTEST_STATE_LOCA_FREQUENCY, - RF_AUTOTEST_STATE_CARRIER_SUPRRESION, - RF_AUTOTEST_STATE_NUM -} ENUM_RF_AUTOTEST_STATE_T; - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -WLAN_STATUS -rftestSetATInfo( - IN P_ADAPTER_T prAdapter, - UINT_32 u4FuncIndex, - UINT_32 u4FuncData - ); - -WLAN_STATUS -rftestQueryATInfo( - IN P_ADAPTER_T prAdapter, - UINT_32 u4FuncIndex, - UINT_32 u4FuncData, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen - ); - -WLAN_STATUS -rftestSetFrequency( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4FreqInKHz, - IN PUINT_32 pu4SetInfoLen - ); - -#endif /* _RFTEST_H */ - - - diff --git a/drivers/net/wireless/mt5931/include/typedef.h b/drivers/net/wireless/mt5931/include/typedef.h deleted file mode 100755 index 2fba6fe88ec0..000000000000 --- a/drivers/net/wireless/mt5931/include/typedef.h +++ /dev/null @@ -1,236 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/typedef.h#1 $ -*/ - -/*! \file typedef.h - \brief Declaration of data type and return values of internal protocol stack. - - In this file we declare the data type and return values which will be exported - to the GLUE Layer. -*/ - - - -/* -** $Log: typedef.h $ - * - * 07 18 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add CMD/Event for RDD and BWCS. - * - * 12 30 2010 cp.wu - * [WCXRP00000327] [MT6620 Wi-Fi][Driver] Improve HEC WHQA 6972 workaround coverage in driver side - * host driver not to set FW-own when there is still pending interrupts - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 16 2010 kevin.huang - * NULL - * Refine AAA functions - * - * 07 19 2010 jeffrey.chang - * - * Linux port modification - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 23 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * integrate . - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 09 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add necessary changes to driver data paths. - * - * 06 09 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add definitions for module migration. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add aa_fsm.h, ais_fsm.h, bss.h, mib.h and scan.h. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 06 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * move timer callback to glue layer. - * - * 05 31 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add cfg80211 interface, which is to replace WE, for further extension - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port - * - * 02 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add Ethernet destination address information in packet info for TX - * - * 02 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add new API: wlanProcessQueuedPackets() -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-03-23 21:41:37 GMT mtk01461 -** Update PACKET_INFO_INIT for TX Path -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-03-23 00:30:17 GMT mtk01461 -** Add parameter in PACKET_INFO_T for HIF Loopback -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-18 20:25:22 GMT mtk01461 -** Fix LINT warning -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-16 09:08:28 GMT mtk01461 -** Update TX PATH API -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:11:54 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _TYPEDEF_H -#define _TYPEDEF_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/* ieee80211.h of linux has duplicated definitions */ -#if defined(WLAN_STATUS_SUCCESS) -#undef WLAN_STATUS_SUCCESS -#endif - -#define WLAN_STATUS_SUCCESS ((WLAN_STATUS) 0x00000000L) -#define WLAN_STATUS_PENDING ((WLAN_STATUS) 0x00000103L) -#define WLAN_STATUS_NOT_ACCEPTED ((WLAN_STATUS) 0x00010003L) - -#define WLAN_STATUS_MEDIA_CONNECT ((WLAN_STATUS) 0x4001000BL) -#define WLAN_STATUS_MEDIA_DISCONNECT ((WLAN_STATUS) 0x4001000CL) -#define WLAN_STATUS_MEDIA_SPECIFIC_INDICATION ((WLAN_STATUS) 0x40010012L) - -#define WLAN_STATUS_SCAN_COMPLETE ((WLAN_STATUS) 0x60010001L) -#define WLAN_STATUS_MSDU_OK ((WLAN_STATUS) 0x60010002L) - -/* TODO(Kevin): double check if 0x60010001 & 0x60010002 is proprietary */ -#define WLAN_STATUS_ROAM_OUT_FIND_BEST ((WLAN_STATUS) 0x60010101L) -#define WLAN_STATUS_ROAM_DISCOVERY ((WLAN_STATUS) 0x60010102L) - -#define WLAN_STATUS_FAILURE ((WLAN_STATUS) 0xC0000001L) -#define WLAN_STATUS_RESOURCES ((WLAN_STATUS) 0xC000009AL) -#define WLAN_STATUS_NOT_SUPPORTED ((WLAN_STATUS) 0xC00000BBL) - -#define WLAN_STATUS_MULTICAST_FULL ((WLAN_STATUS) 0xC0010009L) -#define WLAN_STATUS_INVALID_PACKET ((WLAN_STATUS) 0xC001000FL) -#define WLAN_STATUS_ADAPTER_NOT_READY ((WLAN_STATUS) 0xC0010011L) -#define WLAN_STATUS_NOT_INDICATING ((WLAN_STATUS) 0xC0010013L) -#define WLAN_STATUS_INVALID_LENGTH ((WLAN_STATUS) 0xC0010014L) -#define WLAN_STATUS_INVALID_DATA ((WLAN_STATUS) 0xC0010015L) -#define WLAN_STATUS_BUFFER_TOO_SHORT ((WLAN_STATUS) 0xC0010016L) - -#define WLAN_STATUS_BWCS_UPDATE ((WLAN_STATUS) 0xC0010017L) - -/* NIC status flags */ -#define ADAPTER_FLAG_HW_ERR 0x00400000 - -/* Type Length */ -#define TL_IPV4 0x0008 -#define TL_IPV6 0xDD86 - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/* Type definition for GLUE_INFO structure */ -typedef struct _GLUE_INFO_T GLUE_INFO_T, *P_GLUE_INFO_T; - -/* Type definition for WLAN STATUS */ -typedef UINT_32 WLAN_STATUS, *P_WLAN_STATUS; - -/* Type definition for ADAPTER structure */ -typedef struct _ADAPTER_T ADAPTER_T, *P_ADAPTER_T; - -/* Type definition for MESSAGE HEADER structure */ -typedef struct _MSG_HDR_T MSG_HDR_T, *P_MSG_HDR_T; - -/* Type definition for Pointer to OS Native Packet */ -typedef void *P_NATIVE_PACKET; - -/* Type definition for STA_RECORD_T structure to handle the connectivity and packet reception - * for a particular STA. - */ -typedef struct _STA_RECORD_T STA_RECORD_T, *P_STA_RECORD_T, **PP_STA_RECORD_T; - -/* CMD_INFO_T is used by Glue Layer to send a cluster of Command(OID) information to - * the TX Path to reduce the parameters of a function call. - */ -typedef struct _CMD_INFO_T CMD_INFO_T, *P_CMD_INFO_T; - -/* Following typedef should be removed later, because Glue Layer should not - * be aware of following data type. - */ -typedef struct _SW_RFB_T SW_RFB_T, *P_SW_RFB_T, **PP_SW_RFB_T; - -typedef struct _MSDU_INFO_T MSDU_INFO_T, *P_MSDU_INFO_T; - -typedef struct _REG_ENTRY_T REG_ENTRY_T, *P_REG_ENTRY_T; - -/* IST handler definition */ -typedef VOID (*IST_EVENT_FUNCTION)(P_ADAPTER_T); - -/* Type definition for function pointer of timer handler */ -typedef VOID (*PFN_TIMER_CALLBACK)(IN P_GLUE_INFO_T); - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#endif /* _TYPEDEF_H */ - - diff --git a/drivers/net/wireless/mt5931/include/wlan_bow.h b/drivers/net/wireless/mt5931/include/wlan_bow.h deleted file mode 100755 index a3c4d3849a05..000000000000 --- a/drivers/net/wireless/mt5931/include/wlan_bow.h +++ /dev/null @@ -1,547 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/wlan_bow.h#1 $ -*/ - -/*! \file "wlan_bow.h" - \brief This file contains the declairations of 802.11 PAL - command processing routines for - MediaTek Inc. 802.11 Wireless LAN Adapters. -*/ - - - -/* -** $Log: wlan_bow.h $ - * - * 05 25 2011 terry.wu - * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment - * Add BoW Cancel Scan Request and Turn On deactive network function. - * - * 05 23 2011 terry.wu - * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment - * Add some BoW error handling. - * - * 05 21 2011 terry.wu - * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment - * Protect BoW connection establishment. - * - * 05 17 2011 terry.wu - * [WCXRP00000730] [MT6620 Wi-Fi][BoW] Send deauth while disconnecting - * Send deauth while disconnecting BoW link. - * - * 05 06 2011 terry.wu - * [WCXRP00000707] [MT6620 Wi-Fi][Driver] Fix BoW Multiple Physical Link connect/disconnect issue - * Fix BoW Multiple Physical Link connect/disconnect issue. - * - * 04 15 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add BOW short range mode. - * - * 03 27 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Support multiple physical link. - * - * 03 10 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add BOW table. - * - * 02 16 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add bowNotifyAllLinkDisconnected interface and change channel grant procedure for bow starting.. - * - * 02 15 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Update bowString and channel grant. - * - * 01 11 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Update BOW Activity Report structure and bug fix. - * - * 09 27 2010 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000065] Update BoW design and settings - * Update BCM/BoW design and settings. - * - * 09 14 2010 chinghwa.yu - * NULL - * Add bowRunEventAAAComplete. - * - * 08 24 2010 chinghwa.yu - * NULL - * Update BOW for the 1st time. - * - * 07 30 2010 cp.wu - * NULL - * 1) BoW wrapper: use definitions instead of hard-coded constant for error code - * 2) AIS-FSM: eliminate use of desired RF parameters, use prTargetBssDesc instead - * 3) add handling for RX_PKT_DESTINATION_HOST_WITH_FORWARD for GO-broadcast frames - * - * 07 15 2010 cp.wu - * - * sync. bluetooth-over-Wi-Fi interface to driver interface document v0.2.6. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * 1) add timeout handler mechanism for pending command packets - * 2) add p2p add/removal key - * - * 05 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * 1) all BT physical handles shares the same RSSI/Link Quality. - * 2) simplify BT command composing - * - * 04 28 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * change prefix for data structure used to communicate with 802.11 PAL - * to avoid ambiguous naming with firmware interface - * - * 04 27 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add multiple physical link support - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * * * * * * * * * 2) command sequence number is now increased atomically - * * * * * * * * * * * * 3) private data could be hold and taken use for other purpose -** -*/ - -#ifndef _WLAN_BOW_H -#define _WLAN_BOW_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "nic/bow.h" -#include "nic/cmd_buf.h" - -#if CFG_ENABLE_BT_OVER_WIFI -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define BOWCMD_STATUS_SUCCESS 0 -#define BOWCMD_STATUS_FAILURE 1 -#define BOWCMD_STATUS_UNACCEPTED 2 -#define BOWCMD_STATUS_INVALID 3 -#define BOWCMD_STATUS_TIMEOUT 4 - -#define BOW_WILDCARD_SSID "AMP" -#define BOW_WILDCARD_SSID_LEN 3 -#define BOW_SSID_LEN 21 - - /* 0: query, 1: setup, 2: destroy */ -#define BOW_QUERY_CMD 0 -#define BOW_SETUP_CMD 1 -#define BOW_DESTROY_CMD 2 - -#define BOW_INITIATOR 0 -#define BOW_RESPONDER 1 - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -typedef struct _BOW_TABLE_T { - UINT_8 ucAcquireID; - BOOLEAN fgIsValid; - ENUM_BOW_DEVICE_STATE eState; - UINT_8 aucPeerAddress[6]; - //UINT_8 ucRole; - //UINT_8 ucChannelNum; - UINT_16 u2Reserved; -} BOW_TABLE_T, *P_BOW_TABLE_T; - -typedef WLAN_STATUS (*PFN_BOW_CMD_HANDLE)(P_ADAPTER_T, P_AMPC_COMMAND); - -typedef struct _BOW_CMD_T { - UINT_8 uCmdID; - PFN_BOW_CMD_HANDLE pfCmdHandle; -} BOW_CMD_T, *P_BOW_CMD_T; - -typedef struct _BOW_EVENT_ACTIVITY_REPORT_T { - UINT_8 ucReason; - UINT_8 aucReserved; - UINT_8 aucPeerAddress[6]; -} BOW_EVENT_ACTIVITY_REPORT_T, *P_BOW_EVENT_ACTIVITY_REPORT_T; - -/* -ucReason: 0: success - 1: general failure - 2: too much time (> 2/3 second totally) requested for scheduling. - Others: reserved. -*/ - -typedef struct _BOW_EVENT_SYNC_TSF_T { - UINT_64 u4TsfTime; - UINT_32 u4TsfSysTime; - UINT_32 u4ScoTime; - UINT_32 u4ScoSysTime; - } BOW_EVENT_SYNC_TSF_T, *P_BOW_EVENT_SYNC_TSF_T; - -typedef struct _BOW_ACTIVITY_REPORT_BODY_T { - UINT_32 u4StartTime; - UINT_32 u4Duration; - UINT_32 u4Periodicity; - } BOW_ACTIVITY_REPORT_BODY_T, *P_BOW_ACTIVITY_REPORT_BODY_T; - -typedef struct _BOW_ACTIVITY_REPORT_T { - UINT_8 aucPeerAddress[6]; - UINT_8 ucScheduleKnown; - UINT_8 ucNumReports; - BOW_ACTIVITY_REPORT_BODY_T arBowActivityReportBody[MAX_ACTIVITY_REPORT]; - } BOW_ACTIVITY_REPORT_T, *P_BOW_ACTIVITY_REPORT_T; - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/*--------------------------------------------------------------*/ -/* Firmware Command Packer */ -/*--------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSendSetQueryBowCmd ( - IN P_ADAPTER_T prAdapter, - UINT_8 ucCID, - BOOLEAN fgSetQuery, - BOOLEAN fgNeedResp, - PFN_CMD_DONE_HANDLER pfCmdDoneHandler, - PFN_CMD_TIMEOUT_HANDLER pfCmdTimeoutHandler, - UINT_32 u4SetQueryInfoLen, - PUINT_8 pucInfoBuffer, - IN UINT_8 ucSeqNumber - ); - - -/*--------------------------------------------------------------*/ -/* Command Dispatcher */ -/*--------------------------------------------------------------*/ -WLAN_STATUS -wlanbowHandleCommand( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ); - - -/*--------------------------------------------------------------*/ -/* Routines to handle command */ -/*--------------------------------------------------------------*/ -WLAN_STATUS -bowCmdGetMacStatus( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ); - -WLAN_STATUS -bowCmdSetupConnection( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ); - -WLAN_STATUS -bowCmdDestroyConnection( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ); - -WLAN_STATUS -bowCmdSetPTK( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ); - -WLAN_STATUS -bowCmdReadRSSI( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ); - -WLAN_STATUS -bowCmdReadLinkQuality( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ); - -WLAN_STATUS -bowCmdShortRangeMode( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ); - -WLAN_STATUS -bowCmdGetChannelList( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd - ); - -VOID -wlanbowCmdEventSetStatus( - IN P_ADAPTER_T prAdapter, - IN P_AMPC_COMMAND prCmd, - IN UINT_8 ucEventBuf - ); - -/*--------------------------------------------------------------*/ -/* Callbacks for event indication */ -/*--------------------------------------------------------------*/ -VOID -wlanbowCmdEventSetCommon ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -wlanbowCmdEventLinkConnected ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -wlanbowCmdEventLinkDisconnected ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -wlanbowCmdEventSetSetupConnection ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -wlanbowCmdEventReadLinkQuality ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -wlanbowCmdEventReadRssi ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -wlanbowCmdTimeoutHandler ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ); - -VOID -bowStopping( - IN P_ADAPTER_T prAdapter); - -VOID -bowStarting ( - IN P_ADAPTER_T prAdapter - ); - -VOID -bowAssignSsid ( - IN PUINT_8 pucSsid, - IN PUINT_8 pucSsidLen - ); - -BOOLEAN -bowValidateProbeReq ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_32 pu4ControlFlags - ); - -VOID -bowSendBeacon( - IN P_ADAPTER_T prAdapter, - UINT_32 u4Param - ); - -VOID -bowResponderScan( - IN P_ADAPTER_T prAdapter - ); - -VOID -bowResponderScanDone( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -bowResponderCancelScan ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsChannelExtention - ); - -VOID -bowResponderJoin( - IN P_ADAPTER_T prAdapter, - P_BSS_DESC_T prBssDesc - ); - -VOID -bowFsmRunEventJoinComplete( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -bowIndicationOfMediaStateToHost( - IN P_ADAPTER_T prAdapter, - ENUM_PARAM_MEDIA_STATE_T eConnectionState, - BOOLEAN fgDelayIndication - ); - -VOID -bowRunEventAAATxFail( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -WLAN_STATUS -bowRunEventAAAComplete( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ); - -WLAN_STATUS -bowRunEventRxDeAuth ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prSwRfb - ); - -VOID -bowDisconnectLink ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - -BOOLEAN -bowValidateAssocReq( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_16 pu2StatusCode - ); - -BOOLEAN -bowValidateAuth( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN PP_STA_RECORD_T pprStaRec, - OUT PUINT_16 pu2StatusCode - ); - -VOID -bowRunEventChGrant ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ); - -VOID -bowRequestCh ( - IN P_ADAPTER_T prAdapter - ); - -VOID -bowReleaseCh ( - IN P_ADAPTER_T prAdapter - ); - -VOID -bowChGrantedTimeout( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Param - ); - -BOOLEAN -bowNotifyAllLinkDisconnected ( - IN P_ADAPTER_T prAdapter - ); - -BOOLEAN -bowCheckBowTableIfVaild( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucPeerAddress[6] - ); - -BOOLEAN -bowGetBowTableContent( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucBowTableIdx, - OUT P_BOW_TABLE_T prBowTable - ); - -BOOLEAN -bowGetBowTableEntryByPeerAddress( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucPeerAddress[6], - OUT PUINT_8 pucBowTableIdx - ); - -BOOLEAN -bowGetBowTableFreeEntry( - IN P_ADAPTER_T prAdapter, - OUT PUINT_8 pucBowTableIdx - ); - -ENUM_BOW_DEVICE_STATE -bowGetBowTableState( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucPeerAddress[6] - ); - -BOOLEAN -bowSetBowTableState( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucPeerAddress[6], - IN ENUM_BOW_DEVICE_STATE eState - ); - - -BOOLEAN -bowSetBowTableContent( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucBowTableIdx, - IN P_BOW_TABLE_T prBowTable - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif -#endif /* _WLAN_BOW_H */ - diff --git a/drivers/net/wireless/mt5931/include/wlan_lib.h b/drivers/net/wireless/mt5931/include/wlan_lib.h deleted file mode 100755 index 5141726b1fec..000000000000 --- a/drivers/net/wireless/mt5931/include/wlan_lib.h +++ /dev/null @@ -1,1042 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/wlan_lib.h#1 $ -*/ - -/*! \file "wlan_lib.h" - \brief The declaration of the functions of the wlanAdpater objects - - Detail description. -*/ - - - -/* -** $Log: wlan_lib.h $ - * - * 06 08 2012 eason.tsai - * NULL - * Nvram context covert from 6620 to 6628 for old 6620 meta tool - * - * 01 16 2012 cp.wu - * [MT6620 Wi-Fi][Driver] API and behavior modification for preferred band configuration with corresponding network configuration - * add wlanSetPreferBandByNetwork() for glue layer to invoke for setting preferred band configuration corresponding to network type. - * - * 01 05 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the related ioctl / wlan oid function to set the Tx power cfg. - * - * 10 03 2011 cp.wu - * [WCXRP00001022] [MT6628 Driver][Firmware Download] Add multi section independent download functionality - * eliminate win32 native data types. - * - * 10 03 2011 cp.wu - * [WCXRP00001022] [MT6628 Driver][Firmware Download] Add multi section independent download functionality - * add firmware download path in divided scatters. - * - * 10 03 2011 cp.wu - * [MT6628 Driver][Firmware Download] Add multi section independent download functionality - * add firmware downloading aggregated path. - * - * 09 20 2011 tsaiyuan.hsu - * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver - * change window registry of driver for roaming. - * - * 09 08 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * Use new fields ucChannelListMap and ucChannelListIndex in NVRAM - * - * 08 31 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * . - * - * 08 25 2011 chinghwa.yu - * [WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add DFS switch. - * - * 08 24 2011 chinghwa.yu - * [WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Update RDD test mode cases. - * - * 08 15 2011 cp.wu - * [WCXRP00000913] [MT6620 Wi-Fi] create repository of source code dedicated for MT6620 E6 ASIC - * support to load different firmware image for E3/E4/E5 and E6 ASIC on win32 platforms. - * - * 08 02 2011 yuche.tsai - * [WCXRP00000896] [Volunteer Patch][WiFi Direct][Driver] GO with multiple client, TX deauth to a disconnecting device issue. - * Fix GO send deauth frame issue. - * - * 07 22 2011 jeffrey.chang - * [WCXRP00000864] [MT5931] Add command to adjust OSC stable time - * modify driver to set OSC stable time after f/w download - * - * 07 18 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add CMD/Event for RDD and BWCS. - * - * 05 27 2011 cp.wu - * [WCXRP00000749] [MT6620 Wi-Fi][Driver] Add band edge tx power control to Wi-Fi NVRAM - * invoke CMD_ID_SET_EDGE_TXPWR_LIMIT when there is valid data exist in NVRAM content. - * - * 05 11 2011 cp.wu - * [WCXRP00000718] [MT6620 Wi-Fi] modify the behavior of setting tx power - * ACPI APIs migrate to wlan_lib.c for glue layer to invoke. - * - * 04 18 2011 cp.wu - * [WCXRP00000636] [WHQL][MT5931 Driver] 2c_PMHibernate (hang on 2h) - * 1) add API for glue layer to query ACPI state - * 2) Windows glue should not access to hardware after switched into D3 state - * - * 03 10 2011 cp.wu - * [WCXRP00000532] [MT6620 Wi-Fi][Driver] Migrate NVRAM configuration procedures from MT6620 E2 to MT6620 E3 - * deprecate configuration used by MT6620 E2 - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * - * 01 27 2011 george.huang - * [WCXRP00000355] [MT6620 Wi-Fi] Set WMM-PS related setting with qualifying AP capability - * Support current measure mode, assigned by registry (XP only). - * - * 01 24 2011 cp.wu - * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving - * 1. add an extra counter for tracking pending forward frames. - * 2. notify TX service thread as well when there is pending forward frame - * 3. correct build errors leaded by introduction of Wi-Fi direct separation module - * - * 01 10 2011 cp.wu - * [WCXRP00000351] [MT6620 Wi-Fi][Driver] remove from scanning result in OID handling layer when the corresponding BSS is disconnected due to beacon timeout - * remove from scanning result when the BSS is disconnected due to beacon timeout. - * - * 10 27 2010 george.huang - * [WCXRP00000127] [MT6620 Wi-Fi][Driver] Add a registry to disable Beacon Timeout function for SQA test by using E1 EVB - * Support registry option for disable beacon lost detection. - * - * 10 26 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW] Support NIC capability query command - * 1) update NVRAM content template to ver 1.02 - * 2) add compile option for querying NIC capability (default: off) - * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting - * 4) correct auto-rate compiler error under linux (treat warning as error) - * 5) simplify usage of NVRAM and REG_INFO_T - * 6) add version checking between driver and firmware - * - * 10 26 2010 eddie.chen - * [WCXRP00000134] [MT6620 Wi-Fi][Driver] Add a registry to enable auto rate for SQA test by using E1 EVB - * Add auto rate parameter in registry. - * - * 10 18 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android - * complete implementation of Android NVRAM access - * - * 10 08 2010 cp.wu - * [WCXRP00000084] [MT6620 Wi-Fi][Driver][FW] Add fixed rate support for distance test - * adding fixed rate support for distance test. (from registry setting) - * - * 10 06 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * divide a single function into 2 part to surpress a weird compiler warning from gcc-4.4.0 - * - * 10 06 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * code reorganization to improve isolation between GLUE and CORE layers. - * - * 10 05 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * load manufacture data when CFG_SUPPORT_NVRAM is set to 1 - * - * 09 24 2010 cp.wu - * [WCXRP00000057] [MT6620 Wi-Fi][Driver] Modify online scan to a run-time switchable feature - * Modify online scan as a run-time adjustable option (for Windows, in registry) - * - * 09 23 2010 cp.wu - * [WCXRP00000051] [MT6620 Wi-Fi][Driver] WHQL test fail in MAC address changed item - * use firmware reported mac address right after wlanAdapterStart() as permanent address - * - * 09 23 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * add skeleton for NVRAM integration - * - * 08 26 2010 yuche.tsai - * NULL - * Add AT GO test configure mode under WinXP. - * Please enable 1. CFG_ENABLE_WIFI_DIRECT, 2. CFG_TEST_WIFI_DIRECT_GO, 3. CFG_SUPPORT_AAA - * - * 08 25 2010 george.huang - * NULL - * . - * - * 07 21 2010 cp.wu - * - * 1) change BG_SCAN to ONLINE_SCAN for consistent term - * 2) only clear scanning result when scan is permitted to do - * - * 07 13 2010 cp.wu - * - * 1) MMPDUs are now sent to MT6620 by CMD queue for keeping strict order of 1X/MMPDU/CMD packets - * 2) integrate with qmGetFrameAction() for deciding which MMPDU/1X could pass checking for sending - * 2) enhance CMD_INFO_T descriptor number from 10 to 32 to avoid descriptor underflow under concurrent network operation - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 24 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 802.1x and bluetooth-over-Wi-Fi security frames are now delievered to firmware via command path instead of data path. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * change MAC address updating logic. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * simplify timer usage. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * cnm_timer has been migrated. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS - * 2) buffer statistics data for 2 seconds - * 3) use default value for adhoc parameters instead of 0 - * - * 05 12 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add extra 64 adjustable parameters for CoEX scenario. - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * code refine: fgTestMode should be at adapter rather than glue due to the device/fw is also involved - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) for some OID, never do timeout expiration - * * 2) add 2 kal API for later integration - * - * 04 01 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * change to use WIFI_TCM_ALWAYS_ON as firmware image - * - * 03 31 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * modify the wapi related code for new driver's design. - * - * 03 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * always send CMD_NIC_POWER_CTRL packet when nic is being halted - * - * 03 12 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add two option for ACK and ENCRYPTION for firmware download - * - * 02 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * separate wlanProcesQueuePacket() into 2 APIs upon request - * - * 02 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add new API: wlanProcessQueuedPackets() - * - * 02 11 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. add logic for firmware download - * * * 2. firmware image filename and start/load address are now retrieved from registry - * - * 02 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) remove unused function in nic_rx.c [which has been handled in que_mgt.c] - * * * * 2) firmware image length is now retrieved via NdisFileOpen - * * * * 3) firmware image is not structured by (P_IMG_SEC_HDR_T) anymore - * * * * 4) nicRxWaitResponse() revised - * * * * 5) another set of TQ counter default value is added for fw-download state - * * * * 6) Wi-Fi load address is now retrieved from registry too - * - * 02 08 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * prepare for implementing fw download logic - * - * 01 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. eliminate improper variable in rHifInfo - * * * * * * * 2. block TX/ordinary OID when RF test mode is engaged - * * * * * * * 3. wait until firmware finish operation when entering into and leaving from RF test mode - * * * * * * * 4. correct some HAL implementation -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-12-10 16:39:55 GMT mtk02752 -** eliminate unused API -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-10-13 21:58:41 GMT mtk01084 -** update for new macro define -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-05-19 10:43:06 GMT mtk01461 -** Add wlanReleasePendingOid() -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-04-13 16:38:44 GMT mtk01084 -** add WIFI start function -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-08 16:51:14 GMT mtk01084 -** Update for the image download part -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-04-01 10:57:38 GMT mtk01461 -** Add wlanSendLeftClusteredFrames() for SDIO_TX_ENHANCE -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-23 00:31:02 GMT mtk01461 -** Add declaration of FW Image download reference code -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-16 09:08:31 GMT mtk01461 -** Update TX PATH API -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:12:04 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _WLAN_LIB_H -#define _WLAN_LIB_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "CFG_Wifi_File.h" -#include "rlm_domain.h" -#include "wlan_typedef.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -#define MAX_NUM_GROUP_ADDR 32 /* max number of group addresses */ - - - -#define TX_CS_TCP_UDP_GEN BIT(1) -#define TX_CS_IP_GEN BIT(0) - - -#define CSUM_OFFLOAD_EN_TX_TCP BIT(0) -#define CSUM_OFFLOAD_EN_TX_UDP BIT(1) -#define CSUM_OFFLOAD_EN_TX_IP BIT(2) -#define CSUM_OFFLOAD_EN_RX_TCP BIT(3) -#define CSUM_OFFLOAD_EN_RX_UDP BIT(4) -#define CSUM_OFFLOAD_EN_RX_IPv4 BIT(5) -#define CSUM_OFFLOAD_EN_RX_IPv6 BIT(6) -#define CSUM_OFFLOAD_EN_TX_MASK BITS(0,2) -#define CSUM_OFFLOAD_EN_ALL BITS(0,6) - -/* TCP, UDP, IP Checksum */ -#define RX_CS_TYPE_UDP BIT(7) -#define RX_CS_TYPE_TCP BIT(6) -#define RX_CS_TYPE_IPv6 BIT(5) -#define RX_CS_TYPE_IPv4 BIT(4) - -#define RX_CS_STATUS_UDP BIT(3) -#define RX_CS_STATUS_TCP BIT(2) -#define RX_CS_STATUS_IP BIT(0) - -#define CSUM_NOT_SUPPORTED 0x0 - -#define TXPWR_USE_PDSLOPE 0 - -/* NVRAM error code definitions */ -#define NVRAM_ERROR_VERSION_MISMATCH BIT(1) -#define NVRAM_ERROR_INVALID_TXPWR BIT(2) -#define NVRAM_ERROR_INVALID_DPD BIT(3) -#define NVRAM_ERROR_INVALID_MAC_ADDR BIT(4) - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef WLAN_STATUS (*PFN_OID_HANDLER_FUNC) ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvBuf, - IN UINT_32 u4BufLen, - OUT PUINT_32 pu4OutInfoLen - ); - -typedef enum _ENUM_CSUM_TYPE_T { - CSUM_TYPE_IPV4, - CSUM_TYPE_IPV6, - CSUM_TYPE_TCP, - CSUM_TYPE_UDP, - CSUM_TYPE_NUM -} ENUM_CSUM_TYPE_T, *P_ENUM_CSUM_TYPE_T; - -typedef enum _ENUM_CSUM_RESULT_T { - CSUM_RES_NONE, - CSUM_RES_SUCCESS, - CSUM_RES_FAILED, - CSUM_RES_NUM -} ENUM_CSUM_RESULT_T, *P_ENUM_CSUM_RESULT_T; - -typedef enum _ENUM_PHY_MODE_T { - ENUM_PHY_2G4_CCK, - ENUM_PHY_2G4_OFDM_BPSK, - ENUM_PHY_2G4_OFDM_QPSK, - ENUM_PHY_2G4_OFDM_16QAM, - ENUM_PHY_2G4_OFDM_48M, - ENUM_PHY_2G4_OFDM_54M, - ENUM_PHY_2G4_HT20_BPSK, - ENUM_PHY_2G4_HT20_QPSK, - ENUM_PHY_2G4_HT20_16QAM, - ENUM_PHY_2G4_HT20_MCS5, - ENUM_PHY_2G4_HT20_MCS6, - ENUM_PHY_2G4_HT20_MCS7, - ENUM_PHY_2G4_HT40_BPSK, - ENUM_PHY_2G4_HT40_QPSK, - ENUM_PHY_2G4_HT40_16QAM, - ENUM_PHY_2G4_HT40_MCS5, - ENUM_PHY_2G4_HT40_MCS6, - ENUM_PHY_2G4_HT40_MCS7, - ENUM_PHY_5G_OFDM_BPSK, - ENUM_PHY_5G_OFDM_QPSK, - ENUM_PHY_5G_OFDM_16QAM, - ENUM_PHY_5G_OFDM_48M, - ENUM_PHY_5G_OFDM_54M, - ENUM_PHY_5G_HT20_BPSK, - ENUM_PHY_5G_HT20_QPSK, - ENUM_PHY_5G_HT20_16QAM, - ENUM_PHY_5G_HT20_MCS5, - ENUM_PHY_5G_HT20_MCS6, - ENUM_PHY_5G_HT20_MCS7, - ENUM_PHY_5G_HT40_BPSK, - ENUM_PHY_5G_HT40_QPSK, - ENUM_PHY_5G_HT40_16QAM, - ENUM_PHY_5G_HT40_MCS5, - ENUM_PHY_5G_HT40_MCS6, - ENUM_PHY_5G_HT40_MCS7, - ENUM_PHY_MODE_NUM -} ENUM_PHY_MODE_T, *P_ENUM_PHY_MODE_T; - -typedef enum _ENUM_POWER_SAVE_POLL_MODE_T { - ENUM_POWER_SAVE_POLL_DISABLE, - ENUM_POWER_SAVE_POLL_LEGACY_NULL, - ENUM_POWER_SAVE_POLL_QOS_NULL, - ENUM_POWER_SAVE_POLL_NUM -} ENUM_POWER_SAVE_POLL_MODE_T, *P_ENUM_POWER_SAVE_POLL_MODE_T; - -typedef enum _ENUM_AC_TYPE_T { - ENUM_AC_TYPE_AC0, - ENUM_AC_TYPE_AC1, - ENUM_AC_TYPE_AC2, - ENUM_AC_TYPE_AC3, - ENUM_AC_TYPE_AC4, - ENUM_AC_TYPE_AC5, - ENUM_AC_TYPE_AC6, - ENUM_AC_TYPE_BMC, - ENUM_AC_TYPE_NUM -} ENUM_AC_TYPE_T, *P_ENUM_AC_TYPE_T; - -typedef enum _ENUM_ADV_AC_TYPE_T { - ENUM_ADV_AC_TYPE_RX_NSW, - ENUM_ADV_AC_TYPE_RX_PTA, - ENUM_ADV_AC_TYPE_RX_SP, - ENUM_ADV_AC_TYPE_TX_PTA, - ENUM_ADV_AC_TYPE_TX_RSP, - ENUM_ADV_AC_TYPE_NUM -} ENUM_ADV_AC_TYPE_T, *P_ENUM_ADV_AC_TYPE_T; - -typedef enum _ENUM_REG_CH_MAP_T { - REG_CH_MAP_COUNTRY_CODE, - REG_CH_MAP_TBL_IDX, - REG_CH_MAP_CUSTOMIZED, - REG_CH_MAP_NUM -} ENUM_REG_CH_MAP_T, *P_ENUM_REG_CH_MAP_T; - -typedef struct _SET_TXPWR_CTRL_T{ - INT_8 c2GLegacyStaPwrOffset; /* Unit: 0.5dBm, default: 0*/ - INT_8 c2GHotspotPwrOffset; - INT_8 c2GP2pPwrOffset; - INT_8 c2GBowPwrOffset; - INT_8 c5GLegacyStaPwrOffset; /* Unit: 0.5dBm, default: 0*/ - INT_8 c5GHotspotPwrOffset; - INT_8 c5GP2pPwrOffset; - INT_8 c5GBowPwrOffset; - UINT_8 ucConcurrencePolicy; /* TX power policy when concurrence - in the same channel - 0: Highest power has priority - 1: Lowest power has priority */ - INT_8 acReserved1[3]; /* Must be zero */ - - /* Power limit by channel for all data rates */ - INT_8 acTxPwrLimit2G[14]; /* Channel 1~14, Unit: 0.5dBm*/ - INT_8 acTxPwrLimit5G[4]; /* UNII 1~4 */ - INT_8 acReserved2[2]; /* Must be zero */ -} SET_TXPWR_CTRL_T, *P_SET_TXPWR_CTRL_T; - -/* For storing driver initialization value from glue layer */ -typedef struct _REG_INFO_T { - UINT_32 u4SdBlockSize; /* SDIO block size */ - UINT_32 u4SdBusWidth; /* SDIO bus width. 1 or 4 */ - UINT_32 u4SdClockRate; /* SDIO clock rate. (in unit of HZ) */ - UINT_32 u4StartAddress; /* Starting address of Wi-Fi Firmware */ - UINT_32 u4LoadAddress; /* Load address of Wi-Fi Firmware */ - UINT_16 aucFwImgFilename[65]; /* Firmware filename */ - UINT_16 aucFwImgFilenameE6[65]; /* Firmware filename for E6 */ - UINT_32 u4StartFreq; /* Start Frequency for Ad-Hoc network : in unit of KHz */ - UINT_32 u4AdhocMode; /* Default mode for Ad-Hoc network : ENUM_PARAM_AD_HOC_MODE_T */ - UINT_32 u4RddStartFreq; - UINT_32 u4RddStopFreq; - UINT_32 u4RddTestMode; - UINT_32 u4RddShutFreq; - UINT_32 u4RddDfs; - INT_32 i4HighRssiThreshold; - INT_32 i4MediumRssiThreshold; - INT_32 i4LowRssiThreshold; - INT_32 au4TxPriorityTag[ENUM_AC_TYPE_NUM]; - INT_32 au4RxPriorityTag[ENUM_AC_TYPE_NUM]; - INT_32 au4AdvPriorityTag[ENUM_ADV_AC_TYPE_NUM]; - UINT_32 u4FastPSPoll; - UINT_32 u4PTA; /* 0: disable, 1: enable */ - UINT_32 u4TXLimit; /* 0: disable, 1: enable */ - UINT_32 u4SilenceWindow; /* range: 100 - 625, unit: us */ - UINT_32 u4TXLimitThreshold; /* range: 250 - 1250, unit: us */ - UINT_32 u4PowerMode; - UINT_32 fgEnArpFilter; - UINT_32 u4PsCurrentMeasureEn; - UINT_32 u4UapsdAcBmp; - UINT_32 u4MaxSpLen; - UINT_32 fgDisOnlineScan; /* 0: enable online scan, non-zero: disable online scan*/ - UINT_32 fgDisBcnLostDetection; /* 0: enable online scan, non-zero: disable online scan*/ - UINT_32 u4FixedRate; /* 0: automatic, non-zero: fixed rate */ - UINT_32 u4ArSysParam0; - UINT_32 u4ArSysParam1; - UINT_32 u4ArSysParam2; - UINT_32 u4ArSysParam3; - UINT_32 fgDisRoaming; /* 0:enable roaming 1:disable */ - - // NVRAM - MP Data -START- - UINT_8 aucMacAddr[6]; - UINT_16 au2CountryCode[4]; /* Country code (in ISO 3166-1 expression, ex: "US", "TW") */ - TX_PWR_PARAM_T rTxPwr; - UINT_8 aucEFUSE[144]; - UINT_8 ucTxPwrValid; - UINT_8 ucSupport5GBand; - UINT_8 fg2G4BandEdgePwrUsed; - INT_8 cBandEdgeMaxPwrCCK; - INT_8 cBandEdgeMaxPwrOFDM20; - INT_8 cBandEdgeMaxPwrOFDM40; - ENUM_REG_CH_MAP_T eRegChannelListMap; - UINT_8 ucRegChannelListIndex; - DOMAIN_INFO_ENTRY rDomainInfo; - // NVRAM - MP Data -END- - - // NVRAM - Functional Data -START- - UINT_8 uc2G4BwFixed20M; - UINT_8 uc5GBwFixed20M; - UINT_8 ucEnable5GBand; - // NVRAM - Functional Data -END- - -} REG_INFO_T, *P_REG_INFO_T; - -/* for divided firmware loading */ -typedef struct _FWDL_SECTION_INFO_T -{ - UINT_32 u4Offset; - UINT_32 u4Reserved; - UINT_32 u4Length; - UINT_32 u4DestAddr; -} FWDL_SECTION_INFO_T, *P_FWDL_SECTION_INFO_T; - -typedef struct _FIRMWARE_DIVIDED_DOWNLOAD_T -{ - UINT_32 u4Signature; - UINT_32 u4CRC; /* CRC calculated without first 8 bytes included */ - UINT_32 u4NumOfEntries; - UINT_32 u4Reserved; - FWDL_SECTION_INFO_T arSection[]; -} FIRMWARE_DIVIDED_DOWNLOAD_T, *P_FIRMWARE_DIVIDED_DOWNLOAD_T; - -typedef struct _PARAM_MCR_RW_STRUC_T { - UINT_32 u4McrOffset; - UINT_32 u4McrData; -} PARAM_MCR_RW_STRUC_T, *P_PARAM_MCR_RW_STRUC_T; - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#define BUILD_SIGN(ch0, ch1, ch2, ch3) \ - ((UINT_32)(UINT_8)(ch0) | ((UINT_32)(UINT_8)(ch1) << 8) | \ - ((UINT_32)(UINT_8)(ch2) << 16) | ((UINT_32)(UINT_8)(ch3) << 24 )) - -#define MTK_WIFI_SIGNATURE BUILD_SIGN('M', 'T', 'K', 'W') - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -P_ADAPTER_T -wlanAdapterCreate ( - IN P_GLUE_INFO_T prGlueInfo - ); - -VOID -wlanAdapterDestroy ( - IN P_ADAPTER_T prAdapter - ); - -VOID -wlanCardEjected( - IN P_ADAPTER_T prAdapter - ); - -VOID -wlanIST ( - IN P_ADAPTER_T prAdapter - ); - -BOOL -wlanISR ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgGlobalIntrCtrl - ); - -WLAN_STATUS -wlanProcessCommandQueue ( - IN P_ADAPTER_T prAdapter, - IN P_QUE_T prCmdQue - ); - -WLAN_STATUS -wlanSendCommand ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ); - -VOID -wlanReleaseCommand ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ); - -VOID -wlanReleasePendingOid ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Data - ); - -VOID -wlanReleasePendingCMDbyNetwork( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkType - ); - -VOID -wlanReturnPacket ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvPacket - ); - -WLAN_STATUS -wlanQueryInformation ( - IN P_ADAPTER_T prAdapter, - IN PFN_OID_HANDLER_FUNC pfOidQryHandler, - IN PVOID pvInfoBuf, - IN UINT_32 u4InfoBufLen, - OUT PUINT_32 pu4QryInfoLen - ); - -WLAN_STATUS -wlanSetInformation ( - IN P_ADAPTER_T prAdapter, - IN PFN_OID_HANDLER_FUNC pfOidSetHandler, - IN PVOID pvInfoBuf, - IN UINT_32 u4InfoBufLen, - OUT PUINT_32 pu4SetInfoLen - ); - - -WLAN_STATUS -wlanAdapterStart ( - IN P_ADAPTER_T prAdapter, - IN P_REG_INFO_T prRegInfo, - IN PVOID pvFwImageMapFile, - IN UINT_32 u4FwImageFileLength - ); - -WLAN_STATUS -wlanAdapterStop ( - IN P_ADAPTER_T prAdapter - ); - -#if CFG_SUPPORT_WAPI -BOOLEAN -wlanQueryWapiMode( - IN P_ADAPTER_T prAdapter - ); -#endif - -VOID -wlanReturnRxPacket ( - IN PVOID pvAdapter, - IN PVOID pvPacket - ); - -VOID -wlanRxSetBroadcast ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgEnableBroadcast - ); - -BOOLEAN -wlanIsHandlerNeedHwAccess ( - IN PFN_OID_HANDLER_FUNC pfnOidHandler, - IN BOOLEAN fgSetInfo - ); - -VOID -wlanSetPromiscuousMode ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgEnablePromiscuousMode - ); - -#if CFG_ENABLE_FW_DOWNLOAD - #if CFG_ENABLE_FW_DOWNLOAD_AGGREGATION -WLAN_STATUS -wlanImageSectionDownloadAggregated ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4DestAddr, - IN UINT_32 u4ImgSecSize, - IN PUINT_8 pucImgSecBuf - ); - #endif - -WLAN_STATUS -wlanImageSectionDownload ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4DestAddr, - IN UINT_32 u4ImgSecSize, - IN PUINT_8 pucImgSecBuf - ); - -#if !CFG_ENABLE_FW_DOWNLOAD_ACK -WLAN_STATUS -wlanImageQueryStatus( - IN P_ADAPTER_T prAdapter - ); -#else -WLAN_STATUS -wlanImageSectionDownloadStatus ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucCmdSeqNum - ); -#endif - -WLAN_STATUS -wlanConfigWifiFunc ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgEnable, - IN UINT_32 u4StartAddress - ); - -UINT_32 wlanCRC32( - PUINT_8 buf, - UINT_32 len - ); - -#endif - -WLAN_STATUS -wlanSendNicPowerCtrlCmd ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucPowerMode - ); - -BOOLEAN -wlanIsHandlerAllowedInRFTest ( - IN PFN_OID_HANDLER_FUNC pfnOidHandler, - IN BOOLEAN fgSetInfo - ); - -WLAN_STATUS -wlanProcessQueuedSwRfb ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfbListHead - ); - -WLAN_STATUS -wlanProcessQueuedMsduInfo ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfoListHead - ); - -BOOLEAN -wlanoidTimeoutCheck ( - IN P_ADAPTER_T prAdapter, - IN PFN_OID_HANDLER_FUNC pfnOidHandler - ); - -VOID -wlanoidClearTimeoutCheck ( - IN P_ADAPTER_T prAdapter - ); - -WLAN_STATUS -wlanUpdateNetworkAddress ( - IN P_ADAPTER_T prAdapter - ); - -BOOLEAN -wlanQueryTestMode( - IN P_ADAPTER_T prAdapter - ); - -/* Security Frame Handling */ -BOOLEAN -wlanProcessSecurityFrame( - IN P_ADAPTER_T prAdapter, - IN P_NATIVE_PACKET prPacket - ); - -VOID -wlanSecurityFrameTxDone( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); - -VOID -wlanSecurityFrameTxTimeout( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ); - -/*----------------------------------------------------------------------------*/ -/* OID/IOCTL Handling */ -/*----------------------------------------------------------------------------*/ -VOID -wlanClearScanningResult( - IN P_ADAPTER_T prAdapter - ); - -VOID -wlanClearBssInScanningResult( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 arBSSID - ); - -#if CFG_TEST_WIFI_DIRECT_GO -VOID -wlanEnableP2pFunction( - IN P_ADAPTER_T prAdapter - ); - -VOID -wlanEnableATGO( - IN P_ADAPTER_T prAdapter - ); -#endif - - -/*----------------------------------------------------------------------------*/ -/* Address Retreive by Polling */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanQueryPermanentAddress( - IN P_ADAPTER_T prAdapter - ); - - -/*----------------------------------------------------------------------------*/ -/* NIC Capability Retrieve by Polling */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanQueryNicCapability( - IN P_ADAPTER_T prAdapter - ); - - -/*----------------------------------------------------------------------------*/ -/* PD MCR Retrieve by Polling */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanQueryPdMcr( - IN P_ADAPTER_T prAdapter, - IN P_PARAM_MCR_RW_STRUC_T prMcrRdInfo - ); -/*----------------------------------------------------------------------------*/ -/* Loading Manufacture Data */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanLoadManufactureData ( - IN P_ADAPTER_T prAdapter, - IN P_REG_INFO_T prRegInfo - ); - - -/*----------------------------------------------------------------------------*/ -/* Media Stream Mode */ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wlanResetMediaStreamMode( - IN P_ADAPTER_T prAdapter - ); - - -/*----------------------------------------------------------------------------*/ -/* Timer Timeout Check (for Glue Layer) */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanTimerTimeoutCheck( - IN P_ADAPTER_T prAdapter - ); - - -/*----------------------------------------------------------------------------*/ -/* Mailbox Message Check (for Glue Layer) */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanProcessMboxMessage( - IN P_ADAPTER_T prAdapter - ); - - -/*----------------------------------------------------------------------------*/ -/* TX Pending Packets Handling (for Glue Layer) */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanEnqueueTxPacket ( - IN P_ADAPTER_T prAdapter, - IN P_NATIVE_PACKET prNativePacket - ); - -WLAN_STATUS -wlanFlushTxPendingPackets( - IN P_ADAPTER_T prAdapter - ); - -WLAN_STATUS -wlanTxPendingPackets ( - IN P_ADAPTER_T prAdapter, - IN OUT PBOOLEAN pfgHwAccess - ); - - -/*----------------------------------------------------------------------------*/ -/* Low Power Acquire/Release (for Glue Layer) */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanAcquirePowerControl( - IN P_ADAPTER_T prAdapter - ); - -WLAN_STATUS -wlanReleasePowerControl( - IN P_ADAPTER_T prAdapter - ); - - -/*----------------------------------------------------------------------------*/ -/* Pending Packets Number Reporting (for Glue Layer) */ -/*----------------------------------------------------------------------------*/ -UINT_32 -wlanGetTxPendingFrameCount ( - IN P_ADAPTER_T prAdapter - ); - - -/*----------------------------------------------------------------------------*/ -/* ACPI state inquiry (for Glue Layer) */ -/*----------------------------------------------------------------------------*/ -ENUM_ACPI_STATE_T -wlanGetAcpiState ( - IN P_ADAPTER_T prAdapter - ); - -VOID -wlanSetAcpiState ( - IN P_ADAPTER_T prAdapter, - IN ENUM_ACPI_STATE_T ePowerState - ); - -#if CFG_SUPPORT_OSC_SETTING && defined(MT5931) -WLAN_STATUS -wlanSetMcuOscStableTime ( - IN P_ADAPTER_T prAdapter, - IN UINT_16 u2OscStableTime - ); -#endif - -VOID -wlanDefTxPowerCfg ( - IN P_ADAPTER_T prAdapter - ); - -/*----------------------------------------------------------------------------*/ -/* get ECO version from Revision ID register (for Win32) */ -/*----------------------------------------------------------------------------*/ -UINT_8 -wlanGetEcoVersion( - IN P_ADAPTER_T prAdapter - ); - -/*----------------------------------------------------------------------------*/ -/* set preferred band configuration corresponding to network type */ -/*----------------------------------------------------------------------------*/ -VOID -wlanSetPreferBandByNetwork ( - IN P_ADAPTER_T prAdapter, - IN ENUM_BAND_T eBand, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ); - -/*----------------------------------------------------------------------------*/ -/* get currently operating channel information */ -/*----------------------------------------------------------------------------*/ -UINT_8 -wlanGetChannelNumberByNetwork ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ); - -/*----------------------------------------------------------------------------*/ -/* get BSS Descriptor information */ -/*----------------------------------------------------------------------------*/ -P_BSS_DESC_T -wlanGetTargetBssDescByNetwork ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ); - -/*----------------------------------------------------------------------------*/ -/* check for system configuration to generate message on scan list */ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanCheckSystemConfiguration ( - IN P_ADAPTER_T prAdapter - ); - - -#endif /* _WLAN_LIB_H */ - diff --git a/drivers/net/wireless/mt5931/include/wlan_oid.h b/drivers/net/wireless/mt5931/include/wlan_oid.h deleted file mode 100755 index 0f5a6b6e3f25..000000000000 --- a/drivers/net/wireless/mt5931/include/wlan_oid.h +++ /dev/null @@ -1,2073 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/wlan_oid.h#2 $ -*/ - -/*! \file "wlan_oid.h" - \brief This file contains the declairation file of the WLAN OID processing routines - of Windows driver for MediaTek Inc. 802.11 Wireless LAN Adapters. -*/ - - - -/* -** $Log: wlan_oid.h $ - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 01 05 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the related ioctl / wlan oid function to set the Tx power cfg. - * - * 07 18 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add CMD/Event for RDD and BWCS. - * - * 03 22 2011 george.huang - * [WCXRP00000504] [MT6620 Wi-Fi][FW] Support Sigma CAPI for power saving related command - * link with supplicant commands - * - * 03 17 2011 chinglan.wang - * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature - * . - * - * 03 02 2011 george.huang - * [WCXRP00000504] [MT6620 Wi-Fi][FW] Support Sigma CAPI for power saving related command - * Support UAPSD/OppPS/NoA parameter setting - * - * 01 20 2011 eddie.chen - * [WCXRP00000374] [MT6620 Wi-Fi][DRV] SW debug control - * Add Oid for sw control debug command - * - * 12 07 2010 cm.chang - * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant - * 1. Country code is from NVRAM or supplicant - * 2. Change band definition in CMD/EVENT. - * - * 10 18 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android - * complete implementation of Android NVRAM access - * - * 10 08 2010 cp.wu - * [WCXRP00000084] [MT6620 Wi-Fi][Driver][FW] Add fixed rate support for distance test - * adding fixed rate support for distance test. (from registry setting) - * - * 09 23 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * add skeleton for NVRAM integration - * - * 09 08 2010 cp.wu - * NULL - * use static memory pool for storing IEs of scanning result. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 29 2010 yuche.tsai - * NULL - * Finish SLT TX/RX & Rate Changing Support. - * - * 08 04 2010 cp.wu - * NULL - * revert changelist #15371, efuse read/write access will be done by RF test approach - * - * 08 04 2010 cp.wu - * NULL - * add OID definitions for EFUSE read/write access. - * - * 08 04 2010 yarco.yang - * NULL - * Add TX_AMPDU and ADDBA_REJECT command - * - * 08 02 2010 george.huang - * NULL - * add WMM-PS test related OID/ CMD handlers - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 22 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) add command warpper for STA-REC/BSS-INFO sync. - * 2) enhance command packet sending procedure for non-oid part - * 3) add command packet definitions for STA-REC/BSS-INFO sync. - * - * 06 18 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * migration from MT6620 firmware. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge wlan_def.h. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge wifi_var.h, precomp.h, cnm_timer.h (data type only) - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 06 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * move timer callback to glue layer. - * - * 05 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS - * 2) buffer statistics data for 2 seconds - * 3) use default value for adhoc parameters instead of 0 - * - * 05 18 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement Wakeup-on-LAN except firmware integration part - * - * 05 17 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * MT6620 is not supporting NDIS_PACKET_TYPE_PROMISCUOUS. - * - - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * 1) add timeout handler mechanism for pending command packets - * 2) add p2p add/removal key - * - * 05 13 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add NULL OID implementation for WOL-related OIDs. - * - * 04 22 2010 cp.wu - * [WPD00003830]add OID_802_11_PRIVACY_FILTER support - * enable RX filter OID - * - * 04 14 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * information buffer for query oid/ioctl is now buffered in prCmdInfo - * * * * * instead of glue-layer variable to improve multiple oid/ioctl capability - * - * 03 31 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * modify the wapi related code for new driver's design. - * - * 03 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * indicate media stream mode after set is done - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port - * - * 03 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement custom OID: EEPROM read/write access - * - * 02 09 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address - * * * * * * 2. follow MSDN defined behavior when associates to another AP - * * * * * * 3. for firmware download, packet size could be up to 2048 bytes - * - * 01 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) implement timeout mechanism when OID is pending for longer than 1 second - * * * 2) allow OID_802_11_CONFIGURATION to be executed when RF test mode is turned on - * - * 01 27 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * . - * - * 01 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement following 802.11 OIDs: - * * * * OID_802_11_RSSI, - * * * * OID_802_11_RSSI_TRIGGER, - * * * * OID_802_11_STATISTICS, - * * * * OID_802_11_DISASSOCIATE, - * * * * OID_802_11_POWER_MODE - * - * 01 21 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement OID_802_11_MEDIA_STREAM_MODE - * - * 01 21 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement OID_802_11_SUPPORTED_RATES / OID_802_11_DESIRED_RATES -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-12-08 11:38:11 GMT mtk02752 -** add declares for RF test related APIs -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-11-24 22:41:53 GMT mtk02752 -** remove u4SysTime, MSDN 10-second will be implemented in FW side -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-11-23 20:30:13 GMT mtk02752 -** add u4SysTime field in PARAM_BSSID_EX_T -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-11-12 19:48:35 GMT mtk02752 -** allow upper layer to set a packet filter with PROMISCUOUS mode -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:12:12 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _WLAN_OID_H -#define _WLAN_OID_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -#define PARAM_MAX_LEN_SSID 32 - -#define PARAM_MAC_ADDR_LEN 6 - -#define ETHERNET_HEADER_SZ 14 -#define ETHERNET_MIN_PKT_SZ 60 -#define ETHERNET_MAX_PKT_SZ 1514 - -#define PARAM_MAX_LEN_RATES 8 -#define PARAM_MAX_LEN_RATES_EX 16 - -#define PARAM_AUTH_REQUEST_REAUTH 0x01 -#define PARAM_AUTH_REQUEST_KEYUPDATE 0x02 -#define PARAM_AUTH_REQUEST_PAIRWISE_ERROR 0x06 -#define PARAM_AUTH_REQUEST_GROUP_ERROR 0x0E - -#define PARAM_EEPROM_READ_METHOD_READ 1 -#define PARAM_EEPROM_READ_METHOD_GETSIZE 0 - -#define PARAM_WHQL_RSSI_MAX_DBM (-10) -#define PARAM_WHQL_RSSI_MIN_DBM (-200) - -#define PARAM_DEVICE_WAKE_UP_ENABLE 0x00000001 -#define PARAM_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE 0x00000002 -#define PARAM_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE 0x00000004 - -#define PARAM_WAKE_UP_MAGIC_PACKET 0x00000001 -#define PARAM_WAKE_UP_PATTERN_MATCH 0x00000002 -#define PARAM_WAKE_UP_LINK_CHANGE 0x00000004 - - -/* Packet filter bit definitioin (UINT_32 bit-wise definition) */ -#define PARAM_PACKET_FILTER_DIRECTED 0x00000001 -#define PARAM_PACKET_FILTER_MULTICAST 0x00000002 -#define PARAM_PACKET_FILTER_ALL_MULTICAST 0x00000004 -#define PARAM_PACKET_FILTER_BROADCAST 0x00000008 -#define PARAM_PACKET_FILTER_PROMISCUOUS 0x00000020 -#define PARAM_PACKET_FILTER_ALL_LOCAL 0x00000080 -#if CFG_ENABLE_WIFI_DIRECT_CFG_80211 -#define PARAM_PACKET_FILTER_P2P_MASK 0xC0000000 -#define PARAM_PACKET_FILTER_PROBE_REQ 0x80000000 -#define PARAM_PACKET_FILTER_ACTION_FRAME 0x40000000 -#endif - -#if CFG_SLT_SUPPORT -#define PARAM_PACKET_FILTER_SUPPORTED (PARAM_PACKET_FILTER_DIRECTED | \ - PARAM_PACKET_FILTER_MULTICAST | \ - PARAM_PACKET_FILTER_BROADCAST | \ - PARAM_PACKET_FILTER_ALL_MULTICAST) -#else -#define PARAM_PACKET_FILTER_SUPPORTED (PARAM_PACKET_FILTER_DIRECTED | \ - PARAM_PACKET_FILTER_MULTICAST | \ - PARAM_PACKET_FILTER_BROADCAST) -#endif - -#define PARAM_MEM_DUMP_MAX_SIZE 2048 - -#define BT_PROFILE_PARAM_LEN 8 -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Parameters of User Configuration which match to NDIS5.1 */ -/*----------------------------------------------------------------------------*/ -/* NDIS_802_11_AUTHENTICATION_MODE */ -typedef enum _ENUM_PARAM_AUTH_MODE_T -{ - AUTH_MODE_OPEN, /*!< Open system */ - AUTH_MODE_SHARED, /*!< Shared key */ - AUTH_MODE_AUTO_SWITCH, /*!< Either open system or shared key */ - AUTH_MODE_WPA, - AUTH_MODE_WPA_PSK, - AUTH_MODE_WPA_NONE, /*!< For Ad hoc */ - AUTH_MODE_WPA2, - AUTH_MODE_WPA2_PSK, - AUTH_MODE_NUM /*!< Upper bound, not real case */ -} ENUM_PARAM_AUTH_MODE_T, *P_ENUM_PARAM_AUTH_MODE_T; - -/* NDIS_802_11_ENCRYPTION_STATUS *//* Encryption types */ -typedef enum _ENUM_WEP_STATUS_T -{ - ENUM_WEP_ENABLED, - ENUM_ENCRYPTION1_ENABLED = ENUM_WEP_ENABLED, - ENUM_WEP_DISABLED, - ENUM_ENCRYPTION_DISABLED = ENUM_WEP_DISABLED, - ENUM_WEP_KEY_ABSENT, - ENUM_ENCRYPTION1_KEY_ABSENT = ENUM_WEP_KEY_ABSENT, - ENUM_WEP_NOT_SUPPORTED, - ENUM_ENCRYPTION_NOT_SUPPORTED = ENUM_WEP_NOT_SUPPORTED, - ENUM_ENCRYPTION2_ENABLED, - ENUM_ENCRYPTION2_KEY_ABSENT, - ENUM_ENCRYPTION3_ENABLED, - ENUM_ENCRYPTION3_KEY_ABSENT -} ENUM_PARAM_ENCRYPTION_STATUS_T, *P_ENUM_PARAM_ENCRYPTION_STATUS_T; - - - -typedef UINT_8 PARAM_MAC_ADDRESS[PARAM_MAC_ADDR_LEN]; - -typedef UINT_32 PARAM_KEY_INDEX; -typedef UINT_64 PARAM_KEY_RSC; -typedef INT_32 PARAM_RSSI; - -typedef UINT_32 PARAM_FRAGMENTATION_THRESHOLD; -typedef UINT_32 PARAM_RTS_THRESHOLD; - -typedef UINT_8 PARAM_RATES[PARAM_MAX_LEN_RATES]; -typedef UINT_8 PARAM_RATES_EX[PARAM_MAX_LEN_RATES_EX]; - -typedef enum _ENUM_PARAM_PHY_TYPE_T { - PHY_TYPE_802_11ABG = 0, /*!< Can associated with 802.11abg AP, Scan dual band. */ - PHY_TYPE_802_11BG, /*!< Can associated with 802_11bg AP, Scan single band and not report 802_11a BSSs. */ - PHY_TYPE_802_11G, /*!< Can associated with 802_11g only AP, Scan single band and not report 802_11ab BSSs. */ - PHY_TYPE_802_11A, /*!< Can associated with 802_11a only AP, Scan single band and not report 802_11bg BSSs. */ - PHY_TYPE_802_11B, /*!< Can associated with 802_11b only AP, Scan single band and not report 802_11ag BSSs. */ - PHY_TYPE_NUM // 5 -} ENUM_PARAM_PHY_TYPE_T, *P_ENUM_PARAM_PHY_TYPE_T; - -typedef enum _ENUM_PARAM_OP_MODE_T { - NET_TYPE_IBSS = 0, /*!< Try to merge/establish an AdHoc, do periodic SCAN for merging. */ - NET_TYPE_INFRA, /*!< Try to join an Infrastructure, do periodic SCAN for joining. */ - NET_TYPE_AUTO_SWITCH, /*!< Try to join an Infrastructure, if fail then try to merge or - establish an AdHoc, do periodic SCAN for joining or merging. */ - NET_TYPE_DEDICATED_IBSS, /*!< Try to merge an AdHoc first, if fail then establish AdHoc permanently, no more SCAN. */ - NET_TYPE_NUM // 4 -} ENUM_PARAM_OP_MODE_T, *P_ENUM_PARAM_OP_MODE_T; - -typedef struct _PARAM_SSID_T { - UINT_32 u4SsidLen; /*!< SSID length in bytes. Zero length is broadcast(any) SSID */ - UINT_8 aucSsid[PARAM_MAX_LEN_SSID]; -} PARAM_SSID_T, *P_PARAM_SSID_T; - -/* This is enum defined for user to select an AdHoc Mode */ -typedef enum _ENUM_PARAM_AD_HOC_MODE_T { - AD_HOC_MODE_11B = 0, /*!< Create 11b IBSS if we support 802.11abg/802.11bg. */ - AD_HOC_MODE_MIXED_11BG, /*!< Create 11bg mixed IBSS if we support 802.11abg/802.11bg/802.11g. */ - AD_HOC_MODE_11G, /*!< Create 11g only IBSS if we support 802.11abg/802.11bg/802.11g. */ - AD_HOC_MODE_11A, /*!< Create 11a only IBSS if we support 802.11abg. */ - AD_HOC_MODE_NUM // 4 -} ENUM_PARAM_AD_HOC_MODE_T, *P_ENUM_PARAM_AD_HOC_MODE_T; - - -typedef enum _ENUM_PARAM_MEDIA_STATE_T { - PARAM_MEDIA_STATE_CONNECTED, - PARAM_MEDIA_STATE_DISCONNECTED, - PARAM_MEDIA_STATE_TO_BE_INDICATED // for following MSDN re-association behavior -} ENUM_PARAM_MEDIA_STATE_T, *P_ENUM_PARAM_MEDIA_STATE_T; - - -typedef enum _ENUM_PARAM_NETWORK_TYPE_T { - PARAM_NETWORK_TYPE_FH, - PARAM_NETWORK_TYPE_DS, - PARAM_NETWORK_TYPE_OFDM5, - PARAM_NETWORK_TYPE_OFDM24, - PARAM_NETWORK_TYPE_AUTOMODE, - PARAM_NETWORK_TYPE_NUM /*!< Upper bound, not real case */ -} ENUM_PARAM_NETWORK_TYPE_T, *P_ENUM_PARAM_NETWORK_TYPE_T; - - -typedef struct _PARAM_NETWORK_TYPE_LIST { - UINT_32 NumberOfItems; /*!< At least 1 */ - ENUM_PARAM_NETWORK_TYPE_T eNetworkType [1]; -} PARAM_NETWORK_TYPE_LIST, *PPARAM_NETWORK_TYPE_LIST; - -typedef enum _ENUM_PARAM_PRIVACY_FILTER_T -{ - PRIVACY_FILTER_ACCEPT_ALL, - PRIVACY_FILTER_8021xWEP, - PRIVACY_FILTER_NUM -} ENUM_PARAM_PRIVACY_FILTER_T, *P_ENUM_PARAM_PRIVACY_FILTER_T; - -typedef enum _ENUM_RELOAD_DEFAULTS -{ - ENUM_RELOAD_WEP_KEYS -} PARAM_RELOAD_DEFAULTS, *P_PARAM_RELOAD_DEFAULTS; - -typedef struct _PARAM_PM_PACKET_PATTERN -{ - UINT_32 Priority; // Importance of the given pattern. - UINT_32 Reserved; // Context information for transports. - UINT_32 MaskSize; // Size in bytes of the pattern mask. - UINT_32 PatternOffset; // Offset from beginning of this - // structure to the pattern bytes. - UINT_32 PatternSize; // Size in bytes of the pattern. - UINT_32 PatternFlags; // Flags (TBD). -} PARAM_PM_PACKET_PATTERN, *P_PARAM_PM_PACKET_PATTERN; - -/*--------------------------------------------------------------*/ -/*! \brief Struct definition to indicate specific event. */ -/*--------------------------------------------------------------*/ -typedef enum _ENUM_STATUS_TYPE_T -{ - ENUM_STATUS_TYPE_AUTHENTICATION, - ENUM_STATUS_TYPE_MEDIA_STREAM_MODE, - ENUM_STATUS_TYPE_CANDIDATE_LIST, - ENUM_STATUS_TYPE_NUM /*!< Upper bound, not real case */ -} ENUM_STATUS_TYPE_T, *P_ENUM_STATUS_TYPE_T; - - -typedef struct _PARAM_802_11_CONFIG_FH_T { - UINT_32 u4Length; /*!< Length of structure */ - UINT_32 u4HopPattern; /*!< Defined as 802.11 */ - UINT_32 u4HopSet; /*!< to one if non-802.11 */ - UINT_32 u4DwellTime; /*!< In unit of Kusec */ -} PARAM_802_11_CONFIG_FH_T, *P_PARAM_802_11_CONFIG_FH_T; - -typedef struct _PARAM_802_11_CONFIG_T { - UINT_32 u4Length; /*!< Length of structure */ - UINT_32 u4BeaconPeriod; /*!< In unit of Kusec */ - UINT_32 u4ATIMWindow; /*!< In unit of Kusec */ - UINT_32 u4DSConfig; /*!< Channel frequency in unit of kHz */ - PARAM_802_11_CONFIG_FH_T rFHConfig; -} PARAM_802_11_CONFIG_T, *P_PARAM_802_11_CONFIG_T; - -typedef struct _PARAM_STATUS_INDICATION_T -{ - ENUM_STATUS_TYPE_T eStatusType; -} PARAM_STATUS_INDICATION_T, *P_PARAM_STATUS_INDICATION_T; - -typedef struct _PARAM_AUTH_REQUEST_T -{ - UINT_32 u4Length; /*!< Length of this struct */ - PARAM_MAC_ADDRESS arBssid; - UINT_32 u4Flags; /*!< Definitions are as follows */ -} PARAM_AUTH_REQUEST_T, *P_PARAM_AUTH_REQUEST_T; - -typedef struct _PARAM_AUTH_EVENT_T -{ - PARAM_STATUS_INDICATION_T rStatus; - PARAM_AUTH_REQUEST_T arRequest[1]; -} PARAM_AUTH_EVENT_T, *P_PARAM_AUTH_EVENT_T; - -/*! \brief Capabilities, privacy, rssi and IEs of each BSSID */ -typedef struct _PARAM_BSSID_EX_T { - UINT_32 u4Length; /*!< Length of structure */ - PARAM_MAC_ADDRESS arMacAddress; /*!< BSSID */ - UINT_8 Reserved[2]; - PARAM_SSID_T rSsid; /*!< SSID */ - UINT_32 u4Privacy; /*!< Need WEP encryption */ - PARAM_RSSI rRssi; /*!< in dBm */ - PARAM_RSSI AvgRssiX8; - PARAM_RSSI AvgRssi; - ENUM_PARAM_NETWORK_TYPE_T eNetworkTypeInUse; - PARAM_802_11_CONFIG_T rConfiguration; - ENUM_PARAM_OP_MODE_T eOpMode; - PARAM_RATES_EX rSupportedRates; - UINT_32 u4IELength; - UINT_8 aucIEs[1]; -} PARAM_BSSID_EX_T, *P_PARAM_BSSID_EX_T; - -/*! hold a table of mac and AvgRssiX8*/ -typedef struct _TABLE_RSSI_ { - PARAM_MAC_ADDRESS arMacAddress; /*!< BSSID */ - PARAM_RSSI AvgRssiX8; - PARAM_RSSI AvgRssi; -} TABLE_RSSI; - -#define MAX_SCAN_RSSI_NUM 128 -extern TABLE_RSSI mTABLE_RSSI[MAX_SCAN_RSSI_NUM]; - -typedef struct _PARAM_BSSID_LIST_EX { - UINT_32 u4NumberOfItems; /*!< at least 1 */ - PARAM_BSSID_EX_T arBssid[1]; -} PARAM_BSSID_LIST_EX_T, *P_PARAM_BSSID_LIST_EX_T; - - -typedef struct _PARAM_WEP_T -{ - UINT_32 u4Length; /*!< Length of structure */ - UINT_32 u4KeyIndex; /*!< 0: pairwise key, others group keys */ - UINT_32 u4KeyLength; /*!< Key length in bytes */ - UINT_8 aucKeyMaterial[32]; /*!< Key content by above setting */ -} PARAM_WEP_T, *P_PARAM_WEP_T; - -/*! \brief Key mapping of BSSID */ -typedef struct _PARAM_KEY_T -{ - UINT_32 u4Length; /*!< Length of structure */ - UINT_32 u4KeyIndex; /*!< KeyID */ - UINT_32 u4KeyLength; /*!< Key length in bytes */ - PARAM_MAC_ADDRESS arBSSID; /*!< MAC address */ - PARAM_KEY_RSC rKeyRSC; - UINT_8 aucKeyMaterial[32]; /*!< Key content by above setting */ -} PARAM_KEY_T, *P_PARAM_KEY_T; - -typedef struct _PARAM_REMOVE_KEY_T -{ - UINT_32 u4Length; /*!< Length of structure */ - UINT_32 u4KeyIndex; /*!< KeyID */ - PARAM_MAC_ADDRESS arBSSID; /*!< MAC address */ -} PARAM_REMOVE_KEY_T, *P_PARAM_REMOVE_KEY_T; - -#if CFG_SUPPORT_WAPI -typedef enum _ENUM_KEY_TYPE { - ENUM_WPI_PAIRWISE_KEY = 0, - ENUM_WPI_GROUP_KEY -} ENUM_KEY_TYPE; - -typedef enum _ENUM_WPI_PROTECT_TYPE -{ - ENUM_WPI_NONE, - ENUM_WPI_RX, - ENUM_WPI_TX, - ENUM_WPI_RX_TX -} ENUM_WPI_PROTECT_TYPE; - -typedef struct _PARAM_WPI_KEY_T { - ENUM_KEY_TYPE eKeyType; - ENUM_WPI_PROTECT_TYPE eDirection; - UINT_8 ucKeyID; - UINT_8 aucRsv[3]; - UINT_8 aucAddrIndex[12]; - UINT_32 u4LenWPIEK; - UINT_8 aucWPIEK[256]; - UINT_32 u4LenWPICK; - UINT_8 aucWPICK[256]; - UINT_8 aucPN[16]; -} PARAM_WPI_KEY_T, *P_PARAM_WPI_KEY_T; -#endif - - -typedef enum _PARAM_POWER_MODE -{ - Param_PowerModeCAM, - Param_PowerModeMAX_PSP, - Param_PowerModeFast_PSP, - Param_PowerModeMax /* Upper bound, not real case */ -} PARAM_POWER_MODE, *PPARAM_POWER_MODE; - -typedef enum _PARAM_DEVICE_POWER_STATE -{ - ParamDeviceStateUnspecified = 0, - ParamDeviceStateD0, - ParamDeviceStateD1, - ParamDeviceStateD2, - ParamDeviceStateD3, - ParamDeviceStateMaximum -} PARAM_DEVICE_POWER_STATE, *PPARAM_DEVICE_POWER_STATE; - -#if CFG_SUPPORT_802_11D - -/*! \brief The enumeration definitions for OID_IPN_MULTI_DOMAIN_CAPABILITY */ -typedef enum _PARAM_MULTI_DOMAIN_CAPABILITY { - ParamMultiDomainCapDisabled, - ParamMultiDomainCapEnabled -} PARAM_MULTI_DOMAIN_CAPABILITY, *P_PARAM_MULTI_DOMAIN_CAPABILITY; -#endif - -typedef struct _COUNTRY_STRING_ENTRY { - UINT_8 aucCountryCode[2]; - UINT_8 aucEnvironmentCode[2]; -} COUNTRY_STRING_ENTRY, *P_COUNTRY_STRING_ENTRY; - -/* Power management related definition and enumerations */ -#define UAPSD_NONE 0 -#define UAPSD_AC0 (BIT(0) | BIT(4)) -#define UAPSD_AC1 (BIT(1) | BIT(5)) -#define UAPSD_AC2 (BIT(2) | BIT(6)) -#define UAPSD_AC3 (BIT(3) | BIT(7)) -#define UAPSD_ALL (UAPSD_AC0 | UAPSD_AC1 | UAPSD_AC2 | UAPSD_AC3) - -typedef enum _ENUM_POWER_SAVE_PROFILE_T -{ - ENUM_PSP_CONTINUOUS_ACTIVE = 0, - ENUM_PSP_CONTINUOUS_POWER_SAVE, - ENUM_PSP_FAST_SWITCH, - ENUM_PSP_NUM -} ENUM_POWER_SAVE_PROFILE_T, *PENUM_POWER_SAVE_PROFILE_T; - - -/*--------------------------------------------------------------*/ -/*! \brief Set/Query testing type. */ -/*--------------------------------------------------------------*/ -typedef struct _PARAM_802_11_TEST_T -{ - UINT_32 u4Length; - UINT_32 u4Type; - union - { - PARAM_AUTH_EVENT_T AuthenticationEvent; - PARAM_RSSI RssiTrigger; - } u; -} PARAM_802_11_TEST_T, *P_PARAM_802_11_TEST_T; - - - -/*--------------------------------------------------------------*/ -/*! \brief Set/Query authentication and encryption capability. */ -/*--------------------------------------------------------------*/ -typedef struct _PARAM_AUTH_ENCRYPTION_T -{ - ENUM_PARAM_AUTH_MODE_T eAuthModeSupported; - ENUM_PARAM_ENCRYPTION_STATUS_T eEncryptStatusSupported; -} PARAM_AUTH_ENCRYPTION_T, *P_PARAM_AUTH_ENCRYPTION_T; - -typedef struct _PARAM_CAPABILITY_T -{ - UINT_32 u4Length; - UINT_32 u4Version; - UINT_32 u4NoOfPMKIDs; - UINT_32 u4NoOfAuthEncryptPairsSupported; - PARAM_AUTH_ENCRYPTION_T arAuthenticationEncryptionSupported[1]; -} PARAM_CAPABILITY_T, *P_PARAM_CAPABILITY_T; - -typedef UINT_8 PARAM_PMKID_VALUE[16]; - -typedef struct _PARAM_BSSID_INFO_T -{ - PARAM_MAC_ADDRESS arBSSID; - PARAM_PMKID_VALUE arPMKID; -} PARAM_BSSID_INFO_T, *P_PARAM_BSSID_INFO_T; - -typedef struct _PARAM_PMKID_T -{ - UINT_32 u4Length; - UINT_32 u4BSSIDInfoCount; - PARAM_BSSID_INFO_T arBSSIDInfo[1]; -} PARAM_PMKID_T, *P_PARAM_PMKID_T; - -/*! \brief PMKID candidate lists. */ -typedef struct _PARAM_PMKID_CANDIDATE_T { - PARAM_MAC_ADDRESS arBSSID; - UINT_32 u4Flags; -} PARAM_PMKID_CANDIDATE_T, *P_PARAM_PMKID_CANDIDATE_T; - -//#ifdef LINUX -typedef struct _PARAM_PMKID_CANDIDATE_LIST_T -{ - UINT_32 u4Version; /*!< Version */ - UINT_32 u4NumCandidates; /*!< How many candidates follow */ - PARAM_PMKID_CANDIDATE_T arCandidateList[1]; -} PARAM_PMKID_CANDIDATE_LIST_T, *P_PARAM_PMKID_CANDIDATE_LIST_T; -//#endif - -typedef struct _PARAM_CUSTOM_MCR_RW_STRUC_T { - UINT_32 u4McrOffset; - UINT_32 u4McrData; -} PARAM_CUSTOM_MCR_RW_STRUC_T, *P_PARAM_CUSTOM_MCR_RW_STRUC_T; - -typedef struct _PARAM_CUSTOM_MEM_DUMP_STRUC_T { - UINT_32 u4Address; - UINT_32 u4Length; - UINT_32 u4RemainLength; - UINT_8 ucFragNum; -} PARAM_CUSTOM_MEM_DUMP_STRUC_T, *P_PARAM_CUSTOM_MEM_DUMP_STRUC_T; - - -typedef struct _PARAM_CUSTOM_SW_CTRL_STRUC_T { - UINT_32 u4Id; - UINT_32 u4Data; -} PARAM_CUSTOM_SW_CTRL_STRUC_T, *P_PARAM_CUSTOM_SW_CTRL_STRUC_T; - - -typedef struct _PARAM_CUSTOM_EEPROM_RW_STRUC_T { - UINT_8 ucEepromMethod; /* For read only read: 1, query size: 0*/ - UINT_8 ucEepromIndex; - UINT_8 reserved; - UINT_16 u2EepromData; -} PARAM_CUSTOM_EEPROM_RW_STRUC_T, *P_PARAM_CUSTOM_EEPROM_RW_STRUC_T, - PARAM_CUSTOM_NVRAM_RW_STRUCT_T, *P_PARAM_CUSTOM_NVRAM_RW_STRUCT_T; - -typedef struct _PARAM_CUSTOM_WMM_PS_TEST_STRUC_T { - UINT_8 bmfgApsdEnAc; /* b0~3: trigger-en AC0~3. b4~7: delivery-en AC0~3 */ - UINT_8 ucIsEnterPsAtOnce; /* enter PS immediately without 5 second guard after connected */ - UINT_8 ucIsDisableUcTrigger; /* not to trigger UC on beacon TIM is matched (under U-APSD) */ - UINT_8 reserved; -} PARAM_CUSTOM_WMM_PS_TEST_STRUC_T, *P_PARAM_CUSTOM_WMM_PS_TEST_STRUC_T; - -typedef struct _PARAM_CUSTOM_NOA_PARAM_STRUC_T { - UINT_32 u4NoaDurationMs; - UINT_32 u4NoaIntervalMs; - UINT_32 u4NoaCount; -} PARAM_CUSTOM_NOA_PARAM_STRUC_T, *P_PARAM_CUSTOM_NOA_PARAM_STRUC_T; - -typedef struct _PARAM_CUSTOM_OPPPS_PARAM_STRUC_T { - UINT_32 u4CTwindowMs; -} PARAM_CUSTOM_OPPPS_PARAM_STRUC_T, *P_PARAM_CUSTOM_OPPPS_PARAM_STRUC_T; - -typedef struct _PARAM_CUSTOM_UAPSD_PARAM_STRUC_T { - UINT_8 fgEnAPSD; - UINT_8 fgEnAPSD_AcBe; - UINT_8 fgEnAPSD_AcBk; - UINT_8 fgEnAPSD_AcVo; - UINT_8 fgEnAPSD_AcVi; - UINT_8 ucMaxSpLen; - UINT_8 aucResv[2]; -} PARAM_CUSTOM_UAPSD_PARAM_STRUC_T, *P_PARAM_CUSTOM_UAPSD_PARAM_STRUC_T; - -typedef struct _PARAM_CUSTOM_P2P_SET_STRUC_T { - UINT_32 u4Enable; - UINT_32 u4Mode; -} PARAM_CUSTOM_P2P_SET_STRUC_T, *P_PARAM_CUSTOM_P2P_SET_STRUC_T; - -typedef enum _ENUM_CFG_SRC_TYPE_T { - CFG_SRC_TYPE_EEPROM, - CFG_SRC_TYPE_NVRAM, - CFG_SRC_TYPE_UNKNOWN, - CFG_SRC_TYPE_NUM -} ENUM_CFG_SRC_TYPE_T, *P_ENUM_CFG_SRC_TYPE_T; - -typedef enum _ENUM_EEPROM_TYPE_T { - EEPROM_TYPE_NO, - EEPROM_TYPE_PRESENT, - EEPROM_TYPE_NUM -} ENUM_EEPROM_TYPE_T, *P_ENUM_EEPROM_TYPE_T; - -typedef struct _PARAM_QOS_TSINFO { - UINT_8 ucTrafficType; /* Traffic Type: 1 for isochronous 0 for asynchronous */ - UINT_8 ucTid; /* TSID: must be between 8 ~ 15 */ - UINT_8 ucDirection; /* direction */ - UINT_8 ucAccessPolicy; /* access policy */ - UINT_8 ucAggregation; /* aggregation */ - UINT_8 ucApsd; /* APSD */ - UINT_8 ucuserPriority; /* user priority */ - UINT_8 ucTsInfoAckPolicy; /* TSINFO ACK policy */ - UINT_8 ucSchedule; /* Schedule */ -} PARAM_QOS_TSINFO, *P_PARAM_QOS_TSINFO; - -typedef struct _PARAM_QOS_TSPEC { - PARAM_QOS_TSINFO rTsInfo; /* TS info field */ - UINT_16 u2NominalMSDUSize; /* nominal MSDU size */ - UINT_16 u2MaxMSDUsize; /* maximum MSDU size */ - UINT_32 u4MinSvcIntv; /* minimum service interval */ - UINT_32 u4MaxSvcIntv; /* maximum service interval */ - UINT_32 u4InactIntv; /* inactivity interval */ - UINT_32 u4SpsIntv; /* suspension interval */ - UINT_32 u4SvcStartTime; /* service start time */ - UINT_32 u4MinDataRate; /* minimum Data rate */ - UINT_32 u4MeanDataRate; /* mean data rate */ - UINT_32 u4PeakDataRate; /* peak data rate */ - UINT_32 u4MaxBurstSize; /* maximum burst size */ - UINT_32 u4DelayBound; /* delay bound */ - UINT_32 u4MinPHYRate; /* minimum PHY rate */ - UINT_16 u2Sba; /* surplus bandwidth allowance */ - UINT_16 u2MediumTime; /* medium time */ -} PARAM_QOS_TSPEC, *P_PARAM_QOS_TSPEC; - -typedef struct _PARAM_QOS_ADDTS_REQ_INFO { - PARAM_QOS_TSPEC rTspec; -} PARAM_QOS_ADDTS_REQ_INFO, *P_PARAM_QOS_ADDTS_REQ_INFO; - -typedef struct _PARAM_VOIP_CONFIG { - UINT_32 u4VoipTrafficInterval; /* 0: disable VOIP configuration */ -} PARAM_VOIP_CONFIG, *P_PARAM_VOIP_CONFIG; - -/*802.11 Statistics Struct*/ -typedef struct _PARAM_802_11_STATISTICS_STRUCT_T { - UINT_32 u4Length; // Length of structure - LARGE_INTEGER rTransmittedFragmentCount; - LARGE_INTEGER rMulticastTransmittedFrameCount; - LARGE_INTEGER rFailedCount; - LARGE_INTEGER rRetryCount; - LARGE_INTEGER rMultipleRetryCount; - LARGE_INTEGER rRTSSuccessCount; - LARGE_INTEGER rRTSFailureCount; - LARGE_INTEGER rACKFailureCount; - LARGE_INTEGER rFrameDuplicateCount; - LARGE_INTEGER rReceivedFragmentCount; - LARGE_INTEGER rMulticastReceivedFrameCount; - LARGE_INTEGER rFCSErrorCount; - LARGE_INTEGER rTKIPLocalMICFailures; - LARGE_INTEGER rTKIPICVErrors; - LARGE_INTEGER rTKIPCounterMeasuresInvoked; - LARGE_INTEGER rTKIPReplays; - LARGE_INTEGER rCCMPFormatErrors; - LARGE_INTEGER rCCMPReplays; - LARGE_INTEGER rCCMPDecryptErrors; - LARGE_INTEGER rFourWayHandshakeFailures; - LARGE_INTEGER rWEPUndecryptableCount; - LARGE_INTEGER rWEPICVErrorCount; - LARGE_INTEGER rDecryptSuccessCount; - LARGE_INTEGER rDecryptFailureCount; -} PARAM_802_11_STATISTICS_STRUCT_T, *P_PARAM_802_11_STATISTICS_STRUCT_T; - -/* Linux Network Device Statistics Struct */ -typedef struct _PARAM_LINUX_NETDEV_STATISTICS_T { - UINT_32 u4RxPackets; - UINT_32 u4TxPackets; - UINT_32 u4RxBytes; - UINT_32 u4TxBytes; - UINT_32 u4RxErrors; - UINT_32 u4TxErrors; - UINT_32 u4Multicast; -} PARAM_LINUX_NETDEV_STATISTICS_T, *P_PARAM_LINUX_NETDEV_STATISTICS_T; - - -typedef struct _PARAM_MTK_WIFI_TEST_STRUC_T { - UINT_32 u4FuncIndex; - UINT_32 u4FuncData; -} PARAM_MTK_WIFI_TEST_STRUC_T, *P_PARAM_MTK_WIFI_TEST_STRUC_T; - - -/* 802.11 Media stream constraints */ -typedef enum _ENUM_MEDIA_STREAM_MODE { - ENUM_MEDIA_STREAM_OFF, - ENUM_MEDIA_STREAM_ON -} ENUM_MEDIA_STREAM_MODE, *P_ENUM_MEDIA_STREAM_MODE; - -/* for NDIS 5.1 Media Streaming Change */ -typedef struct _PARAM_MEDIA_STREAMING_INDICATION { - PARAM_STATUS_INDICATION_T rStatus; - ENUM_MEDIA_STREAM_MODE eMediaStreamMode; -} PARAM_MEDIA_STREAMING_INDICATION, *P_PARAM_MEDIA_STREAMING_INDICATION; - - -#define PARAM_PROTOCOL_ID_DEFAULT 0x00 -#define PARAM_PROTOCOL_ID_TCP_IP 0x02 -#define PARAM_PROTOCOL_ID_IPX 0x06 -#define PARAM_PROTOCOL_ID_NBF 0x07 -#define PARAM_PROTOCOL_ID_MAX 0x0F -#define PARAM_PROTOCOL_ID_MASK 0x0F - -/* for NDIS OID_GEN_NETWORK_LAYER_ADDRESSES */ -typedef struct _PARAM_NETWORK_ADDRESS_IP -{ - UINT_16 sin_port; - UINT_32 in_addr; - UINT_8 sin_zero[8]; -} PARAM_NETWORK_ADDRESS_IP, *P_PARAM_NETWORK_ADDRESS_IP; - -typedef struct _PARAM_NETWORK_ADDRESS { - UINT_16 u2AddressLength; // length in bytes of Address[] in this - UINT_16 u2AddressType; // type of this address (PARAM_PROTOCOL_ID_XXX above) - UINT_8 aucAddress[1]; // actually AddressLength bytes long -} PARAM_NETWORK_ADDRESS, *P_PARAM_NETWORK_ADDRESS; - -// The following is used with OID_GEN_NETWORK_LAYER_ADDRESSES to set network layer addresses on an interface - -typedef struct _PARAM_NETWORK_ADDRESS_LIST -{ - UINT_32 u4AddressCount; // number of addresses following - UINT_16 u2AddressType; // type of this address (NDIS_PROTOCOL_ID_XXX above) - PARAM_NETWORK_ADDRESS arAddress[1]; // actually AddressCount elements long -} PARAM_NETWORK_ADDRESS_LIST, *P_PARAM_NETWORK_ADDRESS_LIST; - -#if CFG_SLT_SUPPORT - -#define FIXED_BW_LG20 0x0000 -#define FIXED_BW_UL20 0x2000 -#define FIXED_BW_DL40 0x3000 - -#define FIXED_EXT_CHNL_U20 0x4000 // For AGG register. -#define FIXED_EXT_CHNL_L20 0xC000 // For AGG regsiter. - -typedef enum _ENUM_MTK_LP_TEST_MODE_T { - ENUM_MTK_LP_TEST_NORMAL, - ENUM_MTK_LP_TEST_GOLDEN_SAMPLE, - ENUM_MTK_LP_TEST_DUT, - ENUM_MTK_LP_TEST_MODE_NUM -} ENUM_MTK_LP_TEST_MODE_T, *P_ENUM_MTK_LP_TEST_MODE_T; - -typedef enum _ENUM_MTK_SLT_FUNC_IDX_T { - ENUM_MTK_SLT_FUNC_DO_NOTHING, - ENUM_MTK_SLT_FUNC_INITIAL, - ENUM_MTK_SLT_FUNC_RATE_SET, - ENUM_MTK_SLT_FUNC_LP_SET, - ENUM_MTK_SLT_FUNC_NUM -} ENUM_MTK_SLT_FUNC_IDX_T, *P_ENUM_MTK_SLT_FUNC_IDX_T; - -typedef struct _PARAM_MTK_SLT_LP_TEST_STRUC_T { - ENUM_MTK_LP_TEST_MODE_T rLpTestMode; - UINT_32 u4BcnRcvNum; -} PARAM_MTK_SLT_LP_TEST_STRUC_T, *P_PARAM_MTK_SLT_LP_TEST_STRUC_T; - -typedef struct _PARAM_MTK_SLT_TR_TEST_STRUC_T { - ENUM_PARAM_NETWORK_TYPE_T rNetworkType; // Network Type OFDM5G or OFDM2.4G - UINT_32 u4FixedRate; // Fixed Rate including BW -} PARAM_MTK_SLT_TR_TEST_STRUC_T, *P_PARAM_MTK_SLT_TR_TEST_STRUC_T; - -typedef struct _PARAM_MTK_SLT_INITIAL_STRUC_T { - UINT_8 aucTargetMacAddr[PARAM_MAC_ADDR_LEN]; - UINT_16 u2SiteID; -} PARAM_MTK_SLT_INITIAL_STRUC_T, *P_PARAM_MTK_SLT_INITIAL_STRUC_T; - -typedef struct _PARAM_MTK_SLT_TEST_STRUC_T { - ENUM_MTK_SLT_FUNC_IDX_T rSltFuncIdx; - UINT_32 u4Length; /* Length of structure, - including myself */ - UINT_32 u4FuncInfoLen; /* Include following content - field and myself */ - union { - PARAM_MTK_SLT_INITIAL_STRUC_T rMtkInitTest; - PARAM_MTK_SLT_LP_TEST_STRUC_T rMtkLpTest; - PARAM_MTK_SLT_TR_TEST_STRUC_T rMtkTRTest; - } unFuncInfoContent; - -} PARAM_MTK_SLT_TEST_STRUC_T, *P_PARAM_MTK_SLT_TEST_STRUC_T; - -#endif - -/*--------------------------------------------------------------*/ -/*! \brief For Fixed Rate Configuration (Registry) */ -/*--------------------------------------------------------------*/ -typedef enum _ENUM_REGISTRY_FIXED_RATE_T { - FIXED_RATE_NONE, - FIXED_RATE_1M, - FIXED_RATE_2M, - FIXED_RATE_5_5M, - FIXED_RATE_11M, - FIXED_RATE_6M, - FIXED_RATE_9M, - FIXED_RATE_12M, - FIXED_RATE_18M, - FIXED_RATE_24M, - FIXED_RATE_36M, - FIXED_RATE_48M, - FIXED_RATE_54M, - FIXED_RATE_MCS0_20M_800NS, - FIXED_RATE_MCS1_20M_800NS, - FIXED_RATE_MCS2_20M_800NS, - FIXED_RATE_MCS3_20M_800NS, - FIXED_RATE_MCS4_20M_800NS, - FIXED_RATE_MCS5_20M_800NS, - FIXED_RATE_MCS6_20M_800NS, - FIXED_RATE_MCS7_20M_800NS, - FIXED_RATE_MCS0_20M_400NS, - FIXED_RATE_MCS1_20M_400NS, - FIXED_RATE_MCS2_20M_400NS, - FIXED_RATE_MCS3_20M_400NS, - FIXED_RATE_MCS4_20M_400NS, - FIXED_RATE_MCS5_20M_400NS, - FIXED_RATE_MCS6_20M_400NS, - FIXED_RATE_MCS7_20M_400NS, - FIXED_RATE_MCS0_40M_800NS, - FIXED_RATE_MCS1_40M_800NS, - FIXED_RATE_MCS2_40M_800NS, - FIXED_RATE_MCS3_40M_800NS, - FIXED_RATE_MCS4_40M_800NS, - FIXED_RATE_MCS5_40M_800NS, - FIXED_RATE_MCS6_40M_800NS, - FIXED_RATE_MCS7_40M_800NS, - FIXED_RATE_MCS32_800NS, - FIXED_RATE_MCS0_40M_400NS, - FIXED_RATE_MCS1_40M_400NS, - FIXED_RATE_MCS2_40M_400NS, - FIXED_RATE_MCS3_40M_400NS, - FIXED_RATE_MCS4_40M_400NS, - FIXED_RATE_MCS5_40M_400NS, - FIXED_RATE_MCS6_40M_400NS, - FIXED_RATE_MCS7_40M_400NS, - FIXED_RATE_MCS32_400NS, - FIXED_RATE_NUM -} ENUM_REGISTRY_FIXED_RATE_T, *P_ENUM_REGISTRY_FIXED_RATE_T; - -typedef enum _ENUM_BT_CMD_T { - BT_CMD_PROFILE = 0, - BT_CMD_UPDATE, - BT_CMD_NUM -} ENUM_BT_CMD_T; - -typedef enum _ENUM_BT_PROFILE_T { - BT_PROFILE_CUSTOM = 0, - BT_PROFILE_SCO, - BT_PROFILE_ACL, - BT_PROFILE_MIXED, - BT_PROFILE_NO_CONNECTION, - BT_PROFILE_NUM -} ENUM_BT_PROFILE_T; - -typedef struct _PTA_PROFILE_T { - ENUM_BT_PROFILE_T eBtProfile; - union { - UINT_8 aucBTPParams[BT_PROFILE_PARAM_LEN]; - /* 0: sco reserved slot time, - 1: sco idle slot time, - 2: acl throughput, - 3: bt tx power, - 4: bt rssi - 5: VoIP interval - 6: BIT(0) Use this field, BIT(1) 0 apply single/ 1 dual PTA setting. - */ - UINT_32 au4Btcr[4]; - } u; -} PTA_PROFILE_T, *P_PTA_PROFILE_T; - -typedef struct _PTA_IPC_T { - UINT_8 ucCmd; - UINT_8 ucLen; - union { - PTA_PROFILE_T rProfile; - UINT_8 aucBTPParams[BT_PROFILE_PARAM_LEN]; - } u; -} PARAM_PTA_IPC_T, *P_PARAM_PTA_IPC_T, PTA_IPC_T, *P_PTA_IPC_T; - -/*--------------------------------------------------------------*/ -/*! \brief CFG80211 Scan Request Container */ -/*--------------------------------------------------------------*/ - -typedef struct _PARAM_SCAN_REQUEST_EXT_T { - PARAM_SSID_T rSsid; - UINT_32 u4IELength; - PUINT_8 pucIE; -} PARAM_SCAN_REQUEST_EXT_T, *P_PARAM_SCAN_REQUEST_EXT_T; - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/*--------------------------------------------------------------*/ -/* Routines to set parameters or query information. */ -/*--------------------------------------------------------------*/ -/***** Routines in wlan_oid.c *****/ -WLAN_STATUS -wlanoidQueryNetworkTypesSupported( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryNetworkTypeInUse( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetNetworkTypeInUse ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryBssid( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetBssidListScan( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetBssidListScanExt ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryBssidList( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetBssid( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetSsid( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQuerySsid( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryInfrastructureMode( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetInfrastructureMode( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryAuthMode( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetAuthMode( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -#if 0 -WLAN_STATUS -wlanoidQueryPrivacyFilter ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - - -WLAN_STATUS -wlanoidSetPrivacyFilter ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); -#endif - -WLAN_STATUS -wlanoidSetEncryptionStatus( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryEncryptionStatus( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetAddWep( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetRemoveWep( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetAddKey( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetRemoveKey( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetReloadDefaults( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetTest( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryCapability( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryFrequency ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetFrequency ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - - -WLAN_STATUS -wlanoidQueryAtimWindow ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetAtimWindow ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - - -WLAN_STATUS -wlanoidSetChannel ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryRssi( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryRssiTrigger( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetRssiTrigger( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryRtsThreshold ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetRtsThreshold ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQuery802dot11PowerSaveProfile ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSet802dot11PowerSaveProfile ( - IN P_ADAPTER_T prAdapter, - IN PVOID prSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryPmkid( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetPmkid( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQuerySupportedRates( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryDesiredRates ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetDesiredRates ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryPermanentAddr ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuf, - IN UINT_32 u4QueryBufLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryCurrentAddr ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuf, - IN UINT_32 u4QueryBufLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryPermanentAddr ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuf, - IN UINT_32 u4QueryBufLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryLinkSpeed( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryMcrRead ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryMemDump ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetMcrWrite ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - - -WLAN_STATUS -wlanoidQuerySwCtrlRead ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetSwCtrlWrite ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - - -WLAN_STATUS -wlanoidQueryEepromRead ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetEepromWrite ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryRfTestRxStatus ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryRfTestTxStatus ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryOidInterfaceVersion ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryVendorId( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryMulticastList( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetMulticastList( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryRcvError ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryRcvNoBuffer ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryRcvCrcError ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryStatistics ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -#ifdef LINUX - -WLAN_STATUS -wlanoidQueryStatisticsForLinux ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -#endif - -WLAN_STATUS -wlanoidQueryMediaStreamMode( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetMediaStreamMode( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryRcvOk( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryXmitOk( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryXmitError ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryXmitOneCollision ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryXmitMoreCollisions ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryXmitMaxCollisions ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - - -WLAN_STATUS -wlanoidSetCurrentPacketFilter( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryCurrentPacketFilter ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - - -WLAN_STATUS -wlanoidSetAcpiDevicePowerState ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryAcpiDevicePowerState ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - - -WLAN_STATUS -wlanoidSetDisassociate ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryFragThreshold ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetFragThreshold ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - - -WLAN_STATUS -wlanoidQueryAdHocMode ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetAdHocMode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryBeaconInterval ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetBeaconInterval ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetCurrentAddr ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -#if CFG_TCP_IP_CHKSUM_OFFLOAD -WLAN_STATUS -wlanoidSetCSUMOffload ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen -); -#endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */ - -WLAN_STATUS -wlanoidSetNetworkAddress ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryMaxFrameSize ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryMaxTotalSize ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetCurrentLookahead ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -/* RF Test related APIs */ -WLAN_STATUS -wlanoidRftestSetTestMode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidRftestSetAbortTestMode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidRftestQueryAutoTest ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidRftestSetAutoTest ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -#if CFG_SUPPORT_WAPI -WLAN_STATUS -wlanoidSetWapiMode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetWapiAssocInfo ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetWapiKey( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); -#endif - -#if CFG_SUPPORT_WPS2 -WLAN_STATUS -wlanoidSetWSCAssocInfo ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); -#endif - -#if CFG_ENABLE_WAKEUP_ON_LAN -WLAN_STATUS -wlanoidSetAddWakeupPattern ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetRemoveWakeupPattern ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryEnableWakeup ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 u4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetEnableWakeup ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); -#endif - -WLAN_STATUS -wlanoidSetWiFiWmmPsTest ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetTxAmpdu ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetAddbaReject( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryNvramRead ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetNvramWrite ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryCfgSrcType( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryEepromType( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetCountryCode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanSendMemDumpCmd ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen - ); - -#if CFG_SLT_SUPPORT - -WLAN_STATUS -wlanoidQuerySLTStatus( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidUpdateSLTMode( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -#endif - -#if 0 -WLAN_STATUS -wlanoidSetNoaParam ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetOppPsParam ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetUApsdParam ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); -#endif - -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetBT ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryBT ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetTxPower ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -/* -WLAN_STATUS -wlanoidQueryBtSingleAntenna ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetBtSingleAntenna ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetPta ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryPta ( - IN P_ADAPTER_T prAdapter, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); -*/ - -#if CFG_ENABLE_WIFI_DIRECT -WLAN_STATUS -wlanoidSetP2pMode ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); -#endif - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _WLAN_OID_H */ - diff --git a/drivers/net/wireless/mt5931/include/wlan_p2p.h b/drivers/net/wireless/mt5931/include/wlan_p2p.h deleted file mode 100755 index 4dc0a46a81a3..000000000000 --- a/drivers/net/wireless/mt5931/include/wlan_p2p.h +++ /dev/null @@ -1,424 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/include/wlan_p2p.h#3 $ -*/ - -/*! \file "wlan_p2p.h" - \brief This file contains the declairations of Wi-Fi Direct command - processing routines for MediaTek Inc. 802.11 Wireless LAN Adapters. -*/ - - - -/* -** $Log: wlan_p2p.h $ - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 11 19 2011 yuche.tsai - * NULL - * Add RSSI support for P2P network. - * - * 11 08 2011 yuche.tsai - * [WCXRP00001094] [Volunteer Patch][Driver] Driver version & supplicant version query & set support for service discovery version check. - * Add support for driver version query & p2p supplicant verseion set. - * For new service discovery mechanism sync. - * - * 10 18 2011 yuche.tsai - * [WCXRP00001045] [WiFi Direct][Driver] Check 2.1 branch. - * Support Channle Query. - * - * 10 18 2011 yuche.tsai - * [WCXRP00001045] [WiFi Direct][Driver] Check 2.1 branch. - * New 2.1 branch - - * - * 04 27 2011 george.huang - * [WCXRP00000684] [MT6620 Wi-Fi][Driver] Support P2P setting ARP filter - * Support P2P ARP filter setting on early suspend/ late resume - * - * 04 08 2011 george.huang - * [WCXRP00000621] [MT6620 Wi-Fi][Driver] Support P2P supplicant to set power mode - * separate settings of P2P and AIS - * - * 03 22 2011 george.huang - * [WCXRP00000504] [MT6620 Wi-Fi][FW] Support Sigma CAPI for power saving related command - * link with supplicant commands - * - * 03 07 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * rename the define to anti_pviracy. - * - * 03 02 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * Add Security check related code. - * - * 01 05 2011 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * ioctl implementations for P2P Service Discovery - * - * 12 22 2010 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * 1. header file restructure for more clear module isolation - * 2. add function interface definition for implementing Service Discovery callbacks - * - * 09 21 2010 kevin.huang - * [WCXRP00000054] [MT6620 Wi-Fi][Driver] Restructure driver for second Interface - * Isolate P2P related function for Hardware Software Bundle - * - * 08 16 2010 cp.wu - * NULL - * add subroutines for P2P to set multicast list. - * - * 08 16 2010 george.huang - * NULL - * support wlanoidSetP2pPowerSaveProfile() in P2P - * - * 08 16 2010 george.huang - * NULL - * Support wlanoidSetNetworkAddress() for P2P - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 17 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * MT6620 is not supporting NDIS_PACKET_TYPE_PROMISCUOUS. - * - - * -** -*/ - -#ifndef _WLAN_P2P_H -#define _WLAN_P2P_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -#if CFG_ENABLE_WIFI_DIRECT -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/* Service Discovery */ -typedef struct _PARAM_P2P_SEND_SD_RESPONSE { - PARAM_MAC_ADDRESS rReceiverAddr; - UINT_8 fgNeedTxDoneIndication; - UINT_8 ucChannelNum; - UINT_16 u2PacketLength; - UINT_8 aucPacketContent[0]; /*native 802.11*/ -} PARAM_P2P_SEND_SD_RESPONSE, *P_PARAM_P2P_SEND_SD_RESPONSE; - -typedef struct _PARAM_P2P_GET_SD_REQUEST { - PARAM_MAC_ADDRESS rTransmitterAddr; - UINT_16 u2PacketLength; - UINT_8 aucPacketContent[0]; /*native 802.11*/ -} PARAM_P2P_GET_SD_REQUEST, *P_PARAM_P2P_GET_SD_REQUEST; - -typedef struct _PARAM_P2P_GET_SD_REQUEST_EX { - PARAM_MAC_ADDRESS rTransmitterAddr; - UINT_16 u2PacketLength; - UINT_8 ucChannelNum; /* Channel Number Where SD Request is received. */ - UINT_8 ucSeqNum; /* Get SD Request by sequence number. */ - UINT_8 aucPacketContent[0]; /*native 802.11*/ -} PARAM_P2P_GET_SD_REQUEST_EX, *P_PARAM_P2P_GET_SD_REQUEST_EX; - -typedef struct _PARAM_P2P_SEND_SD_REQUEST { - PARAM_MAC_ADDRESS rReceiverAddr; - UINT_8 fgNeedTxDoneIndication; - UINT_8 ucVersionNum; /* Indicate the Service Discovery Supplicant Version. */ - UINT_16 u2PacketLength; - UINT_8 aucPacketContent[0]; /*native 802.11*/ -} PARAM_P2P_SEND_SD_REQUEST, *P_PARAM_P2P_SEND_SD_REQUEST; - -/* Service Discovery 1.0. */ -typedef struct _PARAM_P2P_GET_SD_RESPONSE { - PARAM_MAC_ADDRESS rTransmitterAddr; - UINT_16 u2PacketLength; - UINT_8 aucPacketContent[0]; /*native 802.11*/ -} PARAM_P2P_GET_SD_RESPONSE, *P_PARAM_P2P_GET_SD_RESPONSE; - -/* Service Discovery 2.0. */ -typedef struct _PARAM_P2P_GET_SD_RESPONSE_EX { - PARAM_MAC_ADDRESS rTransmitterAddr; - UINT_16 u2PacketLength; - UINT_8 ucSeqNum; /* Get SD Response by sequence number. */ - UINT_8 aucPacketContent[0]; /*native 802.11*/ -} PARAM_P2P_GET_SD_RESPONSE_EX, *P_PARAM_P2P_GET_SD_RESPONSE_EX; - - -typedef struct _PARAM_P2P_TERMINATE_SD_PHASE { - PARAM_MAC_ADDRESS rPeerAddr; -} PARAM_P2P_TERMINATE_SD_PHASE, *P_PARAM_P2P_TERMINATE_SD_PHASE; - - -/*! \brief Key mapping of BSSID */ -typedef struct _P2P_PARAM_KEY_T -{ - UINT_32 u4Length; /*!< Length of structure */ - UINT_32 u4KeyIndex; /*!< KeyID */ - UINT_32 u4KeyLength; /*!< Key length in bytes */ - PARAM_MAC_ADDRESS arBSSID; /*!< MAC address */ - PARAM_KEY_RSC rKeyRSC; - UINT_8 aucKeyMaterial[32]; /*!< Key content by above setting */ -} P2P_PARAM_KEY_T, *P_P2P_PARAM_KEY_T; - -#if CONFIG_NL80211_TESTMODE - -typedef struct _NL80211_DRIVER_TEST_PRE_PARAMS { - UINT_16 idx_mode; - UINT_16 idx; - UINT_32 value; -} NL80211_DRIVER_TEST_PRE_PARAMS, *P_NL80211_DRIVER_TEST_PRE_PARAMS; - - -typedef struct _NL80211_DRIVER_TEST_PARAMS { - UINT_32 index; - UINT_32 buflen; -} NL80211_DRIVER_TEST_PARAMS, *P_NL80211_DRIVER_TEST_PARAMS; - - -/* P2P Sigma*/ -typedef struct _NL80211_DRIVER_P2P_SIGMA_PARAMS { - NL80211_DRIVER_TEST_PARAMS hdr; - UINT_32 idx; - UINT_32 value; -}NL80211_DRIVER_P2P_SIGMA_PARAMS, *P_NL80211_DRIVER_P2P_SIGMA_PARAMS; - - -/* Hotspot Client Management */ -typedef struct _NL80211_DRIVER_hotspot_block_PARAMS { - NL80211_DRIVER_TEST_PARAMS hdr; - UINT_8 ucblocked; - UINT_8 aucBssid[MAC_ADDR_LEN]; -}NL80211_DRIVER_hotspot_block_PARAMS, *P_NL80211_DRIVER_hotspot_block_PARAMS; - -#endif - - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/*--------------------------------------------------------------*/ -/* Routines to handle command */ -/*--------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSetAddP2PKey( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetRemoveP2PKey( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetNetworkAddress( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetP2PMulticastList( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -/*--------------------------------------------------------------*/ -/* Service Discovery Subroutines */ -/*--------------------------------------------------------------*/ -WLAN_STATUS -wlanoidSendP2PSDRequest( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSendP2PSDResponse( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidGetP2PSDRequest( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidGetP2PSDResponse( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 puQueryInfoLen - ); - -WLAN_STATUS -wlanoidSetP2PTerminateSDPhase( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -#if CFG_SUPPORT_ANTI_PIRACY -WLAN_STATUS -wlanoidSetSecCheckRequest( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidGetSecCheckResponse( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); -#endif - -WLAN_STATUS -wlanoidSetNoaParam ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetOppPsParam ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetUApsdParam ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryP2pPowerSaveProfile ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetP2pPowerSaveProfile ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidSetP2pSetNetworkAddress ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -WLAN_STATUS -wlanoidQueryP2pOpChannel( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidQueryP2pVersion( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -WLAN_STATUS -wlanoidSetP2pSupplicantVersion( - IN P_ADAPTER_T prAdapter, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -#if CFG_SUPPORT_P2P_RSSI_QUERY -WLAN_STATUS -wlanoidQueryP2pRssi( - IN P_ADAPTER_T prAdapter, - IN PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); -#endif - - -/*--------------------------------------------------------------*/ -/* Callbacks for event indication */ -/*--------------------------------------------------------------*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif -#endif /* _WLAN_P2P_H */ - diff --git a/drivers/net/wireless/mt5931/mgmt/aaa_fsm.c b/drivers/net/wireless/mt5931/mgmt/aaa_fsm.c deleted file mode 100755 index 1d1479378e3a..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/aaa_fsm.c +++ /dev/null @@ -1,1490 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/aaa_fsm.c#2 $ -*/ - -/*! \file "aaa_fsm.c" - \brief This file defines the FSM for AAA MODULE. - - This file defines the FSM for AAA MODULE. -*/ - - - -/* -** $Log: aaa_fsm.c $ - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 06 13 2012 yuche.tsai - * NULL - * Update maintrunk driver. - * Add support for driver compose assoc request frame. - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 02 22 2012 yuche.tsai - * NULL - * Solve sigma test 5.1.3 issue, assoc response should have P2P IE. - * - * 12 02 2011 yuche.tsai - * NULL - * Resolve inorder issue under AP mode. - * - * data frame may TX before assoc response frame. - * - * 11 18 2011 yuche.tsai - * NULL - * CONFIG P2P support RSSI query, default turned off. - * - * 06 17 2011 terry.wu - * NULL - * Add BoW 11N support. - * - * 06 02 2011 eddie.chen - * [WCXRP00000759] [MT6620 Wi-Fi][DRV] Update RCPI in AAA - * Update RCPI when receiving Assoc request. - * - * 04 21 2011 terry.wu - * [WCXRP00000674] [MT6620 Wi-Fi][Driver] Refine AAA authSendAuthFrame - * Add network type parameter to authSendAuthFrame. - * - * 04 15 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add BOW short range mode. - * - * 04 09 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Change Link connection event procedure and change skb length check to 1512 bytes. - * - * 03 09 2011 wh.su - * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done - * Skip to call p2pRunEventAAAComplete to avoid indicate STA connect twice. - * - * 03 04 2011 terry.wu - * [WCXRP00000515] [MT6620 Wi-Fi][Driver] Surpress compiler warning which is identified by GNU compiler collection - * Remove unused variable. - * - * 02 16 2011 yuche.tsai - * [WCXRP00000429] [Volunteer Patch][MT6620][Driver] Hot Spot Client Limit Issue - * Add more check after RX assoc frame under Hot-Spot mode. - * - * 02 09 2011 yuche.tsai - * [WCXRP00000429] [Volunteer Patch][MT6620][Driver] Hot Spot Client Limit Issue - * Fix Client Limit Issue. - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Change Station Type in Station Record, Modify MACRO definition for getting station type & network type index & Role. - * - * 01 15 2011 puff.wen - * NULL - * [On behalf of Frog] Add CFG_ENABLE_WIFI_DIRECT to p2pRunEventAAAComplete - * - * 01 14 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * Modify AAA flow according to CM's comment. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 29 2010 yuche.tsai - * NULL - * Fix Compile warning, type cast from UINT_32 to UINT_16. - * - * 08 26 2010 yuche.tsai - * NULL - * In P2P AT GO test mode under WinXP, we would not indicate connected event to host. - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 08 23 2010 chinghwa.yu - * NULL - * Update for BOW. - * - * 08 20 2010 kevin.huang - * NULL - * Modify AAA Module for changing STA STATE 3 at p2p/bowRunEventAAAComplete() - * - * 08 17 2010 yuche.tsai - * NULL - * Fix bug while enabling P2P GO. - * - * 08 16 2010 kevin.huang - * NULL - * Refine AAA functions - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * refine TX-DONE callback. - * - * 06 21 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * modify due to P2P functino call prototype change. - * - * 06 17 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * First draft for migration P2P FSM from FW to Driver. - * - * 04 02 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Modify CFG flags - * - * 02 26 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * add support of Driver STA_RECORD_T activation - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#if 0 -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will send Event to AIS/BOW/P2P -* -* @param[in] rJoinStatus To indicate JOIN success or failure. -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] prSwRfb Pointer to the SW_RFB_T - -* @return none -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -aaaFsmSendEventJoinComplete ( - WLAN_STATUS rJoinStatus, - P_STA_RECORD_T prStaRec, - P_SW_RFB_T prSwRfb - ) -{ - P_MSG_SAA_JOIN_COMP_T prJoinCompMsg; - - - ASSERT(prStaRec); - - prJoinCompMsg = cnmMemAlloc(RAM_TYPE_TCM, sizeof(MSG_SAA_JOIN_COMP_T)); - if (!prJoinCompMsg) { - return WLAN_STATUS_RESOURCES; - } - - if (IS_STA_IN_AIS(prStaRec)) { - prJoinCompMsg->rMsgHdr.eMsgId = MID_SAA_AIS_JOIN_COMPLETE; - } - else if (IS_STA_IN_P2P(prStaRec)) { - prJoinCompMsg->rMsgHdr.eMsgId = MID_SAA_P2P_JOIN_COMPLETE; - } - else if (IS_STA_IN_BOW(prStaRec)) { - prJoinCompMsg->rMsgHdr.eMsgId = MID_SAA_BOW_JOIN_COMPLETE; - } - else { - ASSERT(0); - } - - prJoinCompMsg->rJoinStatus = rJoinStatus; - prJoinCompMsg->prStaRec = prStaRec; - prJoinCompMsg->prSwRfb = prSwRfb; - - mboxSendMsg(MBOX_ID_0, - (P_MSG_HDR_T)prJoinCompMsg, - MSG_SEND_METHOD_BUF); - - return WLAN_STATUS_SUCCESS; - -} /* end of saaFsmSendEventJoinComplete() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will handle the Start Event to AAA FSM. -* -* @param[in] prMsgHdr Message of Join Request for a particular STA. -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -aaaFsmRunEventStart ( - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_SAA_JOIN_REQ_T prJoinReqMsg; - P_STA_RECORD_T prStaRec; - P_AIS_BSS_INFO_T prAisBssInfo; - - - ASSERT(prMsgHdr); - - prJoinReqMsg = (P_MSG_SAA_JOIN_REQ_T)prMsgHdr; - prStaRec = prJoinReqMsg->prStaRec; - - ASSERT(prStaRec); - - DBGLOG(SAA, LOUD, ("EVENT-START: Trigger SAA FSM\n")); - - cnmMemFree(prMsgHdr); - - //4 <1> Validation of SAA Start Event - if (!IS_AP_STA(prStaRec->eStaType)) { - - DBGLOG(SAA, ERROR, ("EVENT-START: STA Type - %d was not supported.\n", prStaRec->eStaType)); - - /* Ignore the return value because don't care the prSwRfb */ - saaFsmSendEventJoinComplete(WLAN_STATUS_FAILURE, prStaRec, NULL); - - return; - } - - //4 <2> The previous JOIN process is not completed ? - if (prStaRec->eAuthAssocState != AA_STATE_IDLE) { - DBGLOG(SAA, ERROR, ("EVENT-START: Reentry of SAA Module.\n")); - prStaRec->eAuthAssocState = AA_STATE_IDLE; - } - - //4 <3> Reset Status Code and Time - /* Update Station Record - Status/Reason Code */ - prStaRec->u2StatusCode = STATUS_CODE_SUCCESSFUL; - - /* Update the record join time. */ - GET_CURRENT_SYSTIME(&prStaRec->rLastJoinTime); - - prStaRec->ucTxAuthAssocRetryCount = 0; - - if (prStaRec->prChallengeText) { - cnmMemFree(prStaRec->prChallengeText); - prStaRec->prChallengeText = (P_IE_CHALLENGE_TEXT_T)NULL; - } - - cnmTimerStopTimer(&prStaRec->rTxReqDoneOrRxRespTimer); - - prStaRec->ucStaState = STA_STATE_1; - - /* Trigger SAA MODULE */ - saaFsmSteps(prStaRec, SAA_STATE_SEND_AUTH1, (P_SW_RFB_T)NULL); - - return; -} /* end of saaFsmRunEventStart() */ -#endif - - -#if CFG_SUPPORT_AAA -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will process the Rx Auth Request Frame and then -* trigger AAA FSM. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prSwRfb Pointer to the SW_RFB_T structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aaaFsmRunEventRxAuth ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_BSS_INFO_T prBssInfo; - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - UINT_16 u2StatusCode; - BOOLEAN fgReplyAuth = FALSE; - ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex; - - - ASSERT(prAdapter); - - do { - - - //4 <1> Check P2P network conditions -#if CFG_ENABLE_WIFI_DIRECT - if(prAdapter->fgIsP2PRegistered){ - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - if (prBssInfo->fgIsNetActive) { - - //4 <1.1> Validate Auth Frame by Auth Algorithm/Transation Seq - if (WLAN_STATUS_SUCCESS == - authProcessRxAuth1Frame(prAdapter, - prSwRfb, - prBssInfo->aucBSSID, - AUTH_ALGORITHM_NUM_OPEN_SYSTEM, - AUTH_TRANSACTION_SEQ_1, - &u2StatusCode)) { - - if (STATUS_CODE_SUCCESSFUL == u2StatusCode) { - //4 <1.2> Validate Auth Frame for Network Specific Conditions - fgReplyAuth = p2pFuncValidateAuth( - prAdapter, - prSwRfb, - &prStaRec, - &u2StatusCode); - } - else { - fgReplyAuth = TRUE; - } - eNetTypeIndex = NETWORK_TYPE_P2P_INDEX; - break; - } - } - } -#endif /* CFG_ENABLE_WIFI_DIRECT */ - - //4 <2> Check BOW network conditions -#if CFG_ENABLE_BT_OVER_WIFI - { - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - - if ((prBssInfo->fgIsNetActive) && - (OP_MODE_BOW == prBssInfo->eCurrentOPMode)) { - - //4 <2.1> Validate Auth Frame by Auth Algorithm/Transation Seq - /* Check if for this BSSID */ - if (WLAN_STATUS_SUCCESS == - authProcessRxAuth1Frame(prAdapter, - prSwRfb, - prBssInfo->aucBSSID, - AUTH_ALGORITHM_NUM_OPEN_SYSTEM, - AUTH_TRANSACTION_SEQ_1, - &u2StatusCode)) { - - if (STATUS_CODE_SUCCESSFUL == u2StatusCode) { - - //4 <2.2> Validate Auth Frame for Network Specific Conditions - fgReplyAuth = bowValidateAuth(prAdapter, prSwRfb, &prStaRec, &u2StatusCode); - - } - else { - - fgReplyAuth = TRUE; - } - eNetTypeIndex = NETWORK_TYPE_BOW_INDEX; - /* TODO(Kevin): Allocate a STA_RECORD_T for new client */ - break; - } - } - } -#endif /* CFG_ENABLE_BT_OVER_WIFI */ - - return; - } while (FALSE); - - if(prStaRec) { - /* update RCPI */ - prStaRec->ucRCPI = prSwRfb->prHifRxHdr->ucRcpi; - } - - //4 <3> Update STA_RECORD_T and reply Auth_2(Response to Auth_1) Frame - if (fgReplyAuth) { - - if (prStaRec) { - - if (u2StatusCode == STATUS_CODE_SUCCESSFUL) { - if (prStaRec->eAuthAssocState != AA_STATE_IDLE) { - DBGLOG(AAA, WARN, ("Previous AuthAssocState (%d) != IDLE.\n", - prStaRec->eAuthAssocState)); - } - - prStaRec->eAuthAssocState = AAA_STATE_SEND_AUTH2; - } - else { - prStaRec->eAuthAssocState = AA_STATE_IDLE; - - /* NOTE(Kevin): Change to STATE_1 */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - } - - /* Update the record join time. */ - GET_CURRENT_SYSTIME(&prStaRec->rUpdateTime); - - /* Update Station Record - Status/Reason Code */ - prStaRec->u2StatusCode = u2StatusCode; - - prStaRec->ucAuthAlgNum = AUTH_ALGORITHM_NUM_OPEN_SYSTEM; - } - else { - /* NOTE(Kevin): We should have STA_RECORD_T if the status code was successful */ - ASSERT(!(u2StatusCode == STATUS_CODE_SUCCESSFUL)); - } - - /* NOTE: Ignore the return status for AAA */ - //4 <4> Reply Auth - authSendAuthFrame(prAdapter, - prStaRec, - eNetTypeIndex, - prSwRfb, - AUTH_TRANSACTION_SEQ_2, - u2StatusCode); - - } - - return; -} /* end of aaaFsmRunEventRxAuth() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will process the Rx (Re)Association Request Frame and then -* trigger AAA FSM. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prSwRfb Pointer to the SW_RFB_T structure. -* -* @retval WLAN_STATUS_SUCCESS Always return success -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -aaaFsmRunEventRxAssoc ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_BSS_INFO_T prBssInfo; - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - UINT_16 u2StatusCode = STATUS_CODE_RESERVED; - BOOLEAN fgReplyAssocResp = FALSE; - - - ASSERT(prAdapter); - - do { - - //4 <1> Check if we have the STA_RECORD_T for incoming Assoc Req - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - - /* We should have the corresponding Sta Record. */ - if ((!prStaRec) || (!prStaRec->fgIsInUse)) { - ASSERT(0); // Only for debug phase - break; - } - - if (!IS_CLIENT_STA(prStaRec)) { - break; - } - - if (prStaRec->ucStaState == STA_STATE_3) { - /* Do Reassocation */ - } - else if ((prStaRec->ucStaState == STA_STATE_2) && - (prStaRec->eAuthAssocState == AAA_STATE_SEND_AUTH2)) { - /* Normal case */ - } - else { - DBGLOG(AAA, WARN, ("Previous AuthAssocState (%d) != SEND_AUTH2.\n", - prStaRec->eAuthAssocState)); - break; - } - - /* update RCPI */ - prStaRec->ucRCPI = prSwRfb->prHifRxHdr->ucRcpi; - - //4 <2> Check P2P network conditions -#if CFG_ENABLE_WIFI_DIRECT - if ((prAdapter->fgIsP2PRegistered) && (IS_STA_IN_P2P(prStaRec))) { - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - if (prBssInfo->fgIsNetActive) { - - //4 <2.1> Validate Assoc Req Frame and get Status Code - /* Check if for this BSSID */ - if (WLAN_STATUS_SUCCESS == - assocProcessRxAssocReqFrame(prAdapter, - prSwRfb, - &u2StatusCode)) { - - if (STATUS_CODE_SUCCESSFUL == u2StatusCode) { - //4 <2.2> Validate Assoc Req Frame for Network Specific Conditions - fgReplyAssocResp = p2pFuncValidateAssocReq( - prAdapter, - prSwRfb, - (PUINT_16)&u2StatusCode); - } - else { - fgReplyAssocResp = TRUE; - } - - break; - } - } - } -#endif /* CFG_ENABLE_WIFI_DIRECT */ - - //4 <3> Check BOW network conditions -#if CFG_ENABLE_BT_OVER_WIFI - if (IS_STA_IN_BOW(prStaRec)) { - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]); - - if ((prBssInfo->fgIsNetActive) && - (OP_MODE_BOW == prBssInfo->eCurrentOPMode)){ - - //4 <3.1> Validate Auth Frame by Auth Algorithm/Transation Seq - /* Check if for this BSSID */ - if (WLAN_STATUS_SUCCESS == - assocProcessRxAssocReqFrame(prAdapter, - prSwRfb, - &u2StatusCode)) { - - if (STATUS_CODE_SUCCESSFUL == u2StatusCode) { - - //4 <3.2> Validate Auth Frame for Network Specific Conditions - fgReplyAssocResp = bowValidateAssocReq(prAdapter, prSwRfb, &u2StatusCode); - - } - else { - - fgReplyAssocResp = TRUE; - } - - /* TODO(Kevin): Allocate a STA_RECORD_T for new client */ - break; - } - } - } -#endif /* CFG_ENABLE_BT_OVER_WIFI */ - - return WLAN_STATUS_SUCCESS; // To release the SW_RFB_T - } while (FALSE); - - - //4 <4> Update STA_RECORD_T and reply Assoc Resp Frame - if (fgReplyAssocResp) { - UINT_16 u2IELength; - PUINT_8 pucIE; - - if ((((P_WLAN_ASSOC_REQ_FRAME_T)(prSwRfb->pvHeader))->u2FrameCtrl & MASK_FRAME_TYPE) == - MAC_FRAME_REASSOC_REQ) { - - u2IELength = prSwRfb->u2PacketLen - - (UINT_16)OFFSET_OF(WLAN_REASSOC_REQ_FRAME_T, aucInfoElem[0]); - - pucIE = ((P_WLAN_REASSOC_REQ_FRAME_T)(prSwRfb->pvHeader))->aucInfoElem; - } - else { - u2IELength = prSwRfb->u2PacketLen - - (UINT_16)OFFSET_OF(WLAN_ASSOC_REQ_FRAME_T, aucInfoElem[0]); - - pucIE = ((P_WLAN_ASSOC_REQ_FRAME_T)(prSwRfb->pvHeader))->aucInfoElem; - } - - rlmProcessAssocReq(prAdapter, prSwRfb, pucIE, u2IELength); - - //4 <4.1> Assign Association ID - if (u2StatusCode == STATUS_CODE_SUCCESSFUL) { - -#if CFG_ENABLE_WIFI_DIRECT - if ((prAdapter->fgIsP2PRegistered) && (IS_STA_IN_P2P(prStaRec))) { - if (p2pRunEventAAAComplete(prAdapter, prStaRec) == WLAN_STATUS_SUCCESS) { - prStaRec->u2AssocId = bssAssignAssocID(prStaRec); - //prStaRec->eAuthAssocState = AA_STATE_IDLE; - prStaRec->eAuthAssocState = AAA_STATE_SEND_ASSOC2; // NOTE(Kevin): for TX done - - /* NOTE(Kevin): Method A: Change to STATE_3 before handle TX Done */ - //cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); - } - else { - /* Client List FULL. */ - u2StatusCode = STATUS_CODE_REQ_DECLINED; - - prStaRec->u2AssocId = 0; /* Invalid Assocation ID */ - - /* If (Re)association fail, the peer can try Assocation w/o Auth immediately */ - prStaRec->eAuthAssocState = AAA_STATE_SEND_AUTH2; - - /* NOTE(Kevin): Better to change state here, not at TX Done */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_2); - } - } -#endif - -#if CFG_ENABLE_BT_OVER_WIFI - if ((IS_STA_IN_BOW(prStaRec))) { - -// if (bowRunEventAAAComplete(prAdapter, prStaRec) == WLAN_STATUS_SUCCESS) { - prStaRec->u2AssocId = bssAssignAssocID(prStaRec); - prStaRec->eAuthAssocState = AAA_STATE_SEND_ASSOC2; // NOTE(Kevin): for TX done - - /* NOTE(Kevin): Method A: Change to STATE_3 before handle TX Done */ - //cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); - } -#if 0 - else { - /* Client List FULL. */ - u2StatusCode = STATUS_CODE_REQ_DECLINED; - - prStaRec->u2AssocId = 0; /* Invalid Assocation ID */ - - /* If (Re)association fail, the peer can try Assocation w/o Auth immediately */ - prStaRec->eAuthAssocState = AAA_STATE_SEND_AUTH2; - - /* NOTE(Kevin): Better to change state here, not at TX Done */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_2); - } - } -#endif -#endif - } - else { - prStaRec->u2AssocId = 0; /* Invalid Assocation ID */ - - /* If (Re)association fail, the peer can try Assocation w/o Auth immediately */ - prStaRec->eAuthAssocState = AAA_STATE_SEND_AUTH2; - - /* NOTE(Kevin): Better to change state here, not at TX Done */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_2); - } - - /* Update the record join time. */ - GET_CURRENT_SYSTIME(&prStaRec->rUpdateTime); - - /* Update Station Record - Status/Reason Code */ - prStaRec->u2StatusCode = u2StatusCode; - - /* NOTE: Ignore the return status for AAA */ - //4 <4.2> Reply Assoc Resp - assocSendReAssocRespFrame(prAdapter, prStaRec); - - } - - return WLAN_STATUS_SUCCESS; - -} /* end of aaaFsmRunEventRxAssoc() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will handle TxDone(Auth2/AssocReq) Event of AAA FSM. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prMsduInfo Pointer to the MSDU_INFO_T. -* @param[in] rTxDoneStatus Return TX status of the Auth1/Auth3/AssocReq frame. -* -* @retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -aaaFsmRunEventTxDone ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ) -{ - P_STA_RECORD_T prStaRec; - P_BSS_INFO_T prBssInfo; - - - ASSERT(prAdapter); - ASSERT(prMsduInfo); - - DBGLOG(AAA, LOUD, ("EVENT-TX DONE: Current Time = %ld\n", kalGetTimeTick())); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - if ((!prStaRec) || (!prStaRec->fgIsInUse)) { - return WLAN_STATUS_SUCCESS; /* For the case of replying ERROR STATUS CODE */ - } - - ASSERT(prStaRec->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - - switch (prStaRec->eAuthAssocState) { - case AAA_STATE_SEND_AUTH2: - { - /* Strictly check the outgoing frame is matched with current AA STATE */ - if (authCheckTxAuthFrame(prAdapter, - prMsduInfo, - AUTH_TRANSACTION_SEQ_2) != WLAN_STATUS_SUCCESS) { - break; - } - - if (STATUS_CODE_SUCCESSFUL == prStaRec->u2StatusCode) { - if (TX_RESULT_SUCCESS == rTxDoneStatus) { - - /* NOTE(Kevin): Change to STATE_2 at TX Done */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_2); - } - else { - - prStaRec->eAuthAssocState = AA_STATE_IDLE; - - /* NOTE(Kevin): Change to STATE_1 */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - -#if CFG_ENABLE_WIFI_DIRECT - if ((prAdapter->fgIsP2PRegistered) && - (IS_STA_IN_P2P(prStaRec))) { - p2pRunEventAAATxFail(prAdapter, prStaRec); - } -#endif /* CFG_ENABLE_WIFI_DIRECT */ - -#if CFG_ENABLE_BT_OVER_WIFI - if (IS_STA_IN_BOW(prStaRec)) { - bowRunEventAAATxFail(prAdapter, prStaRec); - } -#endif /* CFG_ENABLE_BT_OVER_WIFI */ - } - - } - /* NOTE(Kevin): Ignore the TX Done Event of Auth Frame with Error Status Code */ - - } - break; - - case AAA_STATE_SEND_ASSOC2: - { - /* Strictly check the outgoing frame is matched with current SAA STATE */ - if (assocCheckTxReAssocRespFrame(prAdapter, prMsduInfo) != WLAN_STATUS_SUCCESS) { - break; - } - - if (STATUS_CODE_SUCCESSFUL == prStaRec->u2StatusCode) { - if (TX_RESULT_SUCCESS == rTxDoneStatus) { - - prStaRec->eAuthAssocState = AA_STATE_IDLE; - - /* NOTE(Kevin): Change to STATE_3 at TX Done */ -#if CFG_ENABLE_WIFI_DIRECT - if ((prAdapter->fgIsP2PRegistered) && - (IS_STA_IN_P2P(prStaRec))) { - p2pRunEventAAASuccess(prAdapter, prStaRec); - } -#endif /* CFG_ENABLE_WIFI_DIRECT */ - -#if CFG_ENABLE_BT_OVER_WIFI - - if (IS_STA_IN_BOW(prStaRec)) - { - bowRunEventAAAComplete(prAdapter, prStaRec); - } -#endif /* CFG_ENABLE_BT_OVER_WIFI */ - - } - else { - - prStaRec->eAuthAssocState = AAA_STATE_SEND_AUTH2; - - /* NOTE(Kevin): Change to STATE_2 */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_2); - -#if CFG_ENABLE_WIFI_DIRECT - if ((prAdapter->fgIsP2PRegistered) && - (IS_STA_IN_P2P(prStaRec))) { - p2pRunEventAAATxFail(prAdapter, prStaRec); - } -#endif /* CFG_ENABLE_WIFI_DIRECT */ - -#if CFG_ENABLE_BT_OVER_WIFI - if (IS_STA_IN_BOW(prStaRec)) { - bowRunEventAAATxFail(prAdapter, prStaRec); - } -#endif /* CFG_ENABLE_BT_OVER_WIFI */ - - } - } - /* NOTE(Kevin): Ignore the TX Done Event of Auth Frame with Error Status Code */ - } - break; - - default: - break; /* Ignore other cases */ - } - - - return WLAN_STATUS_SUCCESS; - -} /* end of aaaFsmRunEventTxDone() */ -#endif /* CFG_SUPPORT_AAA */ - - -#if 0 /* TODO(Kevin): for abort event, just reset the STA_RECORD_T. */ -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will send ABORT Event to JOIN FSM. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -saaFsmRunEventAbort ( - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_JOIN_INFO_T prJoinInfo; - P_STA_RECORD_T prStaRec; - - DEBUGFUNC("joinFsmRunEventAbort"); - - - ASSERT(prAdapter); - prJoinInfo = &prAdapter->rJoinInfo; - - DBGLOG(JOIN, EVENT, ("JOIN EVENT: ABORT\n")); - - - /* NOTE(Kevin): when reach here, the ARB_STATE should be in ARB_STATE_JOIN. */ - ASSERT(prJoinInfo->prBssDesc); - - //4 <1> Update Flags and Elements of JOIN Module. - /* Reset Send Auth/(Re)Assoc Frame Count */ - prJoinInfo->ucTxAuthAssocRetryCount = 0; - - /* Cancel all JOIN relative Timer */ - ARB_CANCEL_TIMER(prAdapter, - prJoinInfo->rTxRequestTimer); - - ARB_CANCEL_TIMER(prAdapter, - prJoinInfo->rRxResponseTimer); - - ARB_CANCEL_TIMER(prAdapter, - prJoinInfo->rJoinTimer); - - //4 <2> Update the associated STA_RECORD_T during JOIN. - /* Get a Station Record if possible, TA == BSSID for AP */ - prStaRec = staRecGetStaRecordByAddr(prAdapter, - prJoinInfo->prBssDesc->aucBSSID); - if (prStaRec) { - - /* Update Station Record - Class 1 Flag */ - prStaRec->ucStaState = STA_STATE_1; - } -#if DBG - else { - ASSERT(0); /* Shouldn't happened, because we already add this STA_RECORD_T at JOIN_STATE_INIT */ - } -#endif /* DBG */ - - //4 <3> Pull back to IDLE. - joinFsmSteps(prAdapter, JOIN_STATE_IDLE); - - //4 <4> If we are in Roaming, recover the settings of previous BSS. - /* NOTE: JOIN FAIL - - * Restore original setting from current BSS_INFO_T. - */ - if (prAdapter->eConnectionState == MEDIA_STATE_CONNECTED) { - joinAdoptParametersFromCurrentBss(prAdapter); - } - - return; -} /* end of joinFsmRunEventAbort() */ -#endif - - -/* TODO(Kevin): following code will be modified and move to AIS FSM */ -#if 0 -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will send Join Timeout Event to JOIN FSM. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* -* \retval WLAN_STATUS_FAILURE Fail because of Join Timeout -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -joinFsmRunEventJoinTimeOut ( - IN P_ADAPTER_T prAdapter - ) -{ - P_JOIN_INFO_T prJoinInfo; - P_STA_RECORD_T prStaRec; - - DEBUGFUNC("joinFsmRunEventJoinTimeOut"); - - - ASSERT(prAdapter); - prJoinInfo = &prAdapter->rJoinInfo; - - DBGLOG(JOIN, EVENT, ("JOIN EVENT: JOIN TIMEOUT\n")); - - /* Get a Station Record if possible, TA == BSSID for AP */ - prStaRec = staRecGetStaRecordByAddr(prAdapter, - prJoinInfo->prBssDesc->aucBSSID); - - /* We have renew this Sta Record when in JOIN_STATE_INIT */ - ASSERT(prStaRec); - - /* Record the Status Code of Authentication Request */ - prStaRec->u2StatusCode = STATUS_CODE_JOIN_TIMEOUT; - - /* Increase Failure Count */ - prStaRec->ucJoinFailureCount++; - - /* Reset Send Auth/(Re)Assoc Frame Count */ - prJoinInfo->ucTxAuthAssocRetryCount = 0; - - /* Cancel other JOIN relative Timer */ - ARB_CANCEL_TIMER(prAdapter, - prJoinInfo->rTxRequestTimer); - - ARB_CANCEL_TIMER(prAdapter, - prJoinInfo->rRxResponseTimer); - - /* Restore original setting from current BSS_INFO_T */ - if (prAdapter->eConnectionState == MEDIA_STATE_CONNECTED) { - joinAdoptParametersFromCurrentBss(prAdapter); - } - - /* Pull back to IDLE */ - joinFsmSteps(prAdapter, JOIN_STATE_IDLE); - - return WLAN_STATUS_FAILURE; - -} /* end of joinFsmRunEventJoinTimeOut() */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will adopt the parameters from Peer BSS. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -joinAdoptParametersFromPeerBss ( - IN P_ADAPTER_T prAdapter - ) -{ - P_JOIN_INFO_T prJoinInfo; - P_BSS_DESC_T prBssDesc; - - DEBUGFUNC("joinAdoptParametersFromPeerBss"); - - - ASSERT(prAdapter); - prJoinInfo = &prAdapter->rJoinInfo; - prBssDesc = prJoinInfo->prBssDesc; - - //4 <1> Adopt Peer BSS' PHY TYPE - prAdapter->eCurrentPhyType = prBssDesc->ePhyType; - - DBGLOG(JOIN, INFO, ("Target BSS[%s]'s PhyType = %s\n", - prBssDesc->aucSSID, (prBssDesc->ePhyType == PHY_TYPE_ERP_INDEX) ? "ERP" : "HR_DSSS")); - - - //4 <2> Adopt Peer BSS' Frequency(Band/Channel) - DBGLOG(JOIN, INFO, ("Target BSS's Channel = %d, Band = %d\n", - prBssDesc->ucChannelNum, prBssDesc->eBand)); - - nicSwitchChannel(prAdapter, - prBssDesc->eBand, - prBssDesc->ucChannelNum, - 10); - - prJoinInfo->fgIsParameterAdopted = TRUE; - - return; -} /* end of joinAdoptParametersFromPeerBss() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will adopt the parameters from current associated BSS. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -joinAdoptParametersFromCurrentBss ( - IN P_ADAPTER_T prAdapter - ) -{ - //P_JOIN_INFO_T prJoinInfo = &prAdapter->rJoinInfo; - P_BSS_INFO_T prBssInfo; - - - ASSERT(prAdapter); - prBssInfo = &prAdapter->rBssInfo; - - //4 <1> Adopt current BSS' PHY TYPE - prAdapter->eCurrentPhyType = prBssInfo->ePhyType; - - //4 <2> Adopt current BSS' Frequency(Band/Channel) - DBGLOG(JOIN, INFO, ("Current BSS's Channel = %d, Band = %d\n", - prBssInfo->ucChnl, prBssInfo->eBand)); - - nicSwitchChannel(prAdapter, - prBssInfo->eBand, - prBssInfo->ucChnl, - 10); - return; -} /* end of joinAdoptParametersFromCurrentBss() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will update all the SW variables and HW MCR registers after -* the association with target BSS. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -joinComplete ( - IN P_ADAPTER_T prAdapter - ) -{ - P_JOIN_INFO_T prJoinInfo; - P_BSS_DESC_T prBssDesc; - P_PEER_BSS_INFO_T prPeerBssInfo; - P_BSS_INFO_T prBssInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - P_STA_RECORD_T prStaRec; - P_TX_CTRL_T prTxCtrl; -#if CFG_SUPPORT_802_11D - P_IE_COUNTRY_T prIECountry; -#endif - - DEBUGFUNC("joinComplete"); - - - ASSERT(prAdapter); - prJoinInfo = &prAdapter->rJoinInfo; - prBssDesc = prJoinInfo->prBssDesc; - prPeerBssInfo = &prAdapter->rPeerBssInfo; - prBssInfo = &prAdapter->rBssInfo; - prConnSettings = &prAdapter->rConnSettings; - prTxCtrl = &prAdapter->rTxCtrl; - -//4 <1> Update Connecting & Connected Flag of BSS_DESC_T. - /* Remove previous AP's Connection Flags if have */ - scanRemoveConnectionFlagOfBssDescByBssid(prAdapter, prBssInfo->aucBSSID); - - prBssDesc->fgIsConnected = TRUE; /* Mask as Connected */ - - if (prBssDesc->fgIsHiddenSSID) { - /* NOTE(Kevin): This is for the case of Passive Scan and the target BSS didn't - * broadcast SSID on its Beacon Frame. - */ - COPY_SSID(prBssDesc->aucSSID, - prBssDesc->ucSSIDLen, - prAdapter->rConnSettings.aucSSID, - prAdapter->rConnSettings.ucSSIDLen); - - if (prBssDesc->ucSSIDLen) { - prBssDesc->fgIsHiddenSSID = FALSE; - } -#if DBG - else { - ASSERT(0); - } -#endif /* DBG */ - - DBGLOG(JOIN, INFO, ("Hidden SSID! - Update SSID : %s\n", prBssDesc->aucSSID)); - } - - -//4 <2> Update BSS_INFO_T from BSS_DESC_T - //4 <2.A> PHY Type - prBssInfo->ePhyType = prBssDesc->ePhyType; - - //4 <2.B> BSS Type - prBssInfo->eBSSType = BSS_TYPE_INFRASTRUCTURE; - - //4 <2.C> BSSID - COPY_MAC_ADDR(prBssInfo->aucBSSID, prBssDesc->aucBSSID); - - DBGLOG(JOIN, INFO, ("JOIN to BSSID: ["MACSTR"]\n", MAC2STR(prBssDesc->aucBSSID))); - - - //4 <2.D> SSID - COPY_SSID(prBssInfo->aucSSID, - prBssInfo->ucSSIDLen, - prBssDesc->aucSSID, - prBssDesc->ucSSIDLen); - - //4 <2.E> Channel / Band information. - prBssInfo->eBand = prBssDesc->eBand; - prBssInfo->ucChnl = prBssDesc->ucChannelNum; - - //4 <2.F> RSN/WPA information. - secFsmRunEventStart(prAdapter); - prBssInfo->u4RsnSelectedPairwiseCipher = prBssDesc->u4RsnSelectedPairwiseCipher; - prBssInfo->u4RsnSelectedGroupCipher = prBssDesc->u4RsnSelectedGroupCipher; - prBssInfo->u4RsnSelectedAKMSuite = prBssDesc->u4RsnSelectedAKMSuite; - - if (secRsnKeyHandshakeEnabled()) { - prBssInfo->fgIsWPAorWPA2Enabled = TRUE; - } - else { - prBssInfo->fgIsWPAorWPA2Enabled = FALSE; - } - - //4 <2.G> Beacon interval. - prBssInfo->u2BeaconInterval = prBssDesc->u2BeaconInterval; - - //4 <2.H> DTIM period. - prBssInfo->ucDtimPeriod = prBssDesc->ucDTIMPeriod; - - //4 <2.I> ERP Information - if ((prBssInfo->ePhyType == PHY_TYPE_ERP_INDEX) && // Our BSS's PHY_TYPE is ERP now. - (prBssDesc->fgIsERPPresent)) { - - prBssInfo->fgIsERPPresent = TRUE; - prBssInfo->ucERP = prBssDesc->ucERP; /* Save the ERP for later check */ - } - else { /* Some AP, may send ProbeResp without ERP IE. Thus prBssDesc->fgIsERPPresent is FALSE. */ - prBssInfo->fgIsERPPresent = FALSE; - prBssInfo->ucERP = 0; - } - -#if CFG_SUPPORT_802_11D - //4 <2.J> Country inforamtion of the associated AP - if (prConnSettings->fgMultiDomainCapabilityEnabled) { - DOMAIN_INFO_ENTRY rDomainInfo; - if (domainGetDomainInfoByScanResult(prAdapter, &rDomainInfo)) { - if (prBssDesc->prIECountry) { - prIECountry = prBssDesc->prIECountry; - - domainParseCountryInfoElem(prIECountry, &prBssInfo->rDomainInfo); - - /* use the domain get from the BSS info */ - prBssInfo->fgIsCountryInfoPresent = TRUE; - nicSetupOpChnlList(prAdapter, prBssInfo->rDomainInfo.u2CountryCode, FALSE); - } else { - /* use the domain get from the scan result */ - prBssInfo->fgIsCountryInfoPresent = TRUE; - nicSetupOpChnlList(prAdapter, rDomainInfo.u2CountryCode, FALSE); - } - } - } -#endif - - //4 <2.K> Signal Power of the associated AP - prBssInfo->rRcpi = prBssDesc->rRcpi; - prBssInfo->rRssi = RCPI_TO_dBm(prBssInfo->rRcpi); - GET_CURRENT_SYSTIME(&prBssInfo->rRssiLastUpdateTime); - - //4 <2.L> Capability Field of the associated AP - prBssInfo->u2CapInfo = prBssDesc->u2CapInfo; - - DBGLOG(JOIN, INFO, ("prBssInfo-> fgIsERPPresent = %d, ucERP = %02x, rRcpi = %d, rRssi = %ld\n", - prBssInfo->fgIsERPPresent, prBssInfo->ucERP, prBssInfo->rRcpi, prBssInfo->rRssi)); - - -//4 <3> Update BSS_INFO_T from PEER_BSS_INFO_T & NIC RATE FUNC - //4 <3.A> Association ID - prBssInfo->u2AssocId = prPeerBssInfo->u2AssocId; - - //4 <3.B> WMM Infomation - if (prAdapter->fgIsEnableWMM && - (prPeerBssInfo->rWmmInfo.ucWmmFlag & WMM_FLAG_SUPPORT_WMM)) { - - prBssInfo->fgIsWmmAssoc = TRUE; - prTxCtrl->rTxQForVoipAccess = TXQ_AC3; - - qosWmmInfoInit(&prBssInfo->rWmmInfo, (prBssInfo->ePhyType == PHY_TYPE_HR_DSSS_INDEX) ? TRUE : FALSE); - - if (prPeerBssInfo->rWmmInfo.ucWmmFlag & WMM_FLAG_AC_PARAM_PRESENT) { - kalMemCopy(&prBssInfo->rWmmInfo, - &prPeerBssInfo->rWmmInfo, - sizeof(WMM_INFO_T)); - } - else { - kalMemCopy(&prBssInfo->rWmmInfo, - &prPeerBssInfo->rWmmInfo, - sizeof(WMM_INFO_T) - sizeof(prPeerBssInfo->rWmmInfo.arWmmAcParams)); - } - } - else { - prBssInfo->fgIsWmmAssoc = FALSE; - prTxCtrl->rTxQForVoipAccess = TXQ_AC1; - - kalMemZero(&prBssInfo->rWmmInfo, sizeof(WMM_INFO_T)); - } - - - //4 <3.C> Operational Rate Set & BSS Basic Rate Set - prBssInfo->u2OperationalRateSet = prPeerBssInfo->u2OperationalRateSet; - prBssInfo->u2BSSBasicRateSet = prPeerBssInfo->u2BSSBasicRateSet; - - - //4 <3.D> Short Preamble - if (prBssInfo->fgIsERPPresent) { - - /* NOTE(Kevin 2007/12/24): Truth Table. - * Short Preamble Bit in - * Final Driver Setting(Short) - * TRUE FALSE FALSE FALSE(shouldn't have such case, use the AssocResp) - * TRUE FALSE TRUE FALSE - * FALSE FALSE FALSE FALSE(shouldn't have such case, use the AssocResp) - * FALSE FALSE TRUE FALSE - * TRUE TRUE FALSE TRUE(follow ERP) - * TRUE TRUE TRUE FALSE(follow ERP) - * FALSE TRUE FALSE FALSE(shouldn't have such case, and we should set to FALSE) - * FALSE TRUE TRUE FALSE(we should set to FALSE) - */ - if ((prPeerBssInfo->fgIsShortPreambleAllowed) && - ((prConnSettings->ePreambleType == PREAMBLE_TYPE_SHORT) || /* Short Preamble Option Enable is TRUE */ - ((prConnSettings->ePreambleType == PREAMBLE_TYPE_AUTO) && - (prBssDesc->u2CapInfo & CAP_INFO_SHORT_PREAMBLE)))) { - - prBssInfo->fgIsShortPreambleAllowed = TRUE; - - if (prBssInfo->ucERP & ERP_INFO_BARKER_PREAMBLE_MODE) { - prBssInfo->fgUseShortPreamble = FALSE; - } - else { - prBssInfo->fgUseShortPreamble = TRUE; - } - } - else { - prBssInfo->fgIsShortPreambleAllowed = FALSE; - prBssInfo->fgUseShortPreamble = FALSE; - } - } - else { - /* NOTE(Kevin 2007/12/24): Truth Table. - * Short Preamble Bit in - * Final Driver Setting(Short) - * TRUE FALSE FALSE - * FALSE FALSE FALSE - * TRUE TRUE TRUE - * FALSE TRUE(status success) TRUE - * --> Honor the result of prPeerBssInfo. - */ - - prBssInfo->fgIsShortPreambleAllowed = prBssInfo->fgUseShortPreamble = - prPeerBssInfo->fgIsShortPreambleAllowed; - } - - DBGLOG(JOIN, INFO, ("prBssInfo->fgIsShortPreambleAllowed = %d, prBssInfo->fgUseShortPreamble = %d\n", - prBssInfo->fgIsShortPreambleAllowed, prBssInfo->fgUseShortPreamble)); - - - //4 <3.E> Short Slot Time - prBssInfo->fgUseShortSlotTime = - prPeerBssInfo->fgUseShortSlotTime; /* AP support Short Slot Time */ - - DBGLOG(JOIN, INFO, ("prBssInfo->fgUseShortSlotTime = %d\n", - prBssInfo->fgUseShortSlotTime)); - - nicSetSlotTime(prAdapter, - prBssInfo->ePhyType, - ((prConnSettings->fgIsShortSlotTimeOptionEnable && - prBssInfo->fgUseShortSlotTime) ? TRUE : FALSE)); - - - //4 <3.F> Update Tx Rate for Control Frame - bssUpdateTxRateForControlFrame(prAdapter); - - - //4 <3.G> Save the available Auth Types during Roaming (Design for Fast BSS Transition). - //if (prAdapter->fgIsEnableRoaming) /* NOTE(Kevin): Always prepare info for roaming */ - { - - if (prJoinInfo->ucCurrAuthAlgNum == AUTH_ALGORITHM_NUM_OPEN_SYSTEM) { - prJoinInfo->ucRoamingAuthTypes |= AUTH_TYPE_OPEN_SYSTEM; - } - else if (prJoinInfo->ucCurrAuthAlgNum == AUTH_ALGORITHM_NUM_SHARED_KEY) { - prJoinInfo->ucRoamingAuthTypes |= AUTH_TYPE_SHARED_KEY; - } - - prBssInfo->ucRoamingAuthTypes = prJoinInfo->ucRoamingAuthTypes; - - - /* Set the stable time of the associated BSS. We won't do roaming decision - * during the stable time. - */ - SET_EXPIRATION_TIME(prBssInfo->rRoamingStableExpirationTime, - SEC_TO_SYSTIME(ROAMING_STABLE_TIMEOUT_SEC)); - } - - - //4 <3.H> Update Parameter for TX Fragmentation Threshold -#if CFG_TX_FRAGMENT - txFragInfoUpdate(prAdapter); -#endif /* CFG_TX_FRAGMENT */ - - -//4 <4> Update STA_RECORD_T - /* Get a Station Record if possible */ - prStaRec = staRecGetStaRecordByAddr(prAdapter, - prBssDesc->aucBSSID); - - if (prStaRec) { - UINT_16 u2OperationalRateSet, u2DesiredRateSet; - - //4 <4.A> Desired Rate Set - u2OperationalRateSet = (rPhyAttributes[prBssInfo->ePhyType].u2SupportedRateSet & - prBssInfo->u2OperationalRateSet); - - u2DesiredRateSet = (u2OperationalRateSet & prConnSettings->u2DesiredRateSet); - if (u2DesiredRateSet) { - prStaRec->u2DesiredRateSet = u2DesiredRateSet; - } - else { - /* For Error Handling - The Desired Rate Set is not covered in Operational Rate Set. */ - prStaRec->u2DesiredRateSet = u2OperationalRateSet; - } - - /* Try to set the best initial rate for this entry */ - if (!rateGetBestInitialRateIndex(prStaRec->u2DesiredRateSet, - prStaRec->rRcpi, - &prStaRec->ucCurrRate1Index)) { - - if (!rateGetLowestRateIndexFromRateSet(prStaRec->u2DesiredRateSet, - &prStaRec->ucCurrRate1Index)) { - ASSERT(0); - } - } - - DBGLOG(JOIN, INFO, ("prStaRec->ucCurrRate1Index = %d\n", - prStaRec->ucCurrRate1Index)); - - //4 <4.B> Preamble Mode - prStaRec->fgIsShortPreambleOptionEnable = - prBssInfo->fgUseShortPreamble; - - //4 <4.C> QoS Flag - prStaRec->fgIsQoS = prBssInfo->fgIsWmmAssoc; - } -#if DBG - else { - ASSERT(0); - } -#endif /* DBG */ - - -//4 <5> Update NIC - //4 <5.A> Update BSSID & Operation Mode - nicSetupBSS(prAdapter, prBssInfo); - - //4 <5.B> Update WLAN Table. - if (nicSetHwBySta(prAdapter, prStaRec) == FALSE) { - ASSERT(FALSE); - } - - //4 <5.C> Update Desired Rate Set for BT. -#if CFG_TX_FRAGMENT - if (prConnSettings->fgIsEnableTxAutoFragmentForBT) { - txRateSetInitForBT(prAdapter, prStaRec); - } -#endif /* CFG_TX_FRAGMENT */ - - //4 <5.D> TX AC Parameter and TX/RX Queue Control - if (prBssInfo->fgIsWmmAssoc) { - -#if CFG_TX_AGGREGATE_HW_FIFO - nicTxAggregateTXQ(prAdapter, FALSE); -#endif /* CFG_TX_AGGREGATE_HW_FIFO */ - - qosUpdateWMMParametersAndAssignAllowedACI(prAdapter, &prBssInfo->rWmmInfo); - } - else { - -#if CFG_TX_AGGREGATE_HW_FIFO - nicTxAggregateTXQ(prAdapter, TRUE); -#endif /* CFG_TX_AGGREGATE_HW_FIFO */ - - nicTxNonQoSAssignDefaultAdmittedTXQ(prAdapter); - - nicTxNonQoSUpdateTXQParameters(prAdapter, - prBssInfo->ePhyType); - } - -#if CFG_TX_STOP_WRITE_TX_FIFO_UNTIL_JOIN - { - prTxCtrl->fgBlockTxDuringJoin = FALSE; - - #if !CFG_TX_AGGREGATE_HW_FIFO /* TX FIFO AGGREGATE already do flush once */ - nicTxFlushStopQueues(prAdapter, (UINT_8)TXQ_DATA_MASK, (UINT_8)NULL); - #endif /* CFG_TX_AGGREGATE_HW_FIFO */ - - nicTxRetransmitOfSendWaitQue(prAdapter); - - if (prTxCtrl->fgIsPacketInOsSendQueue) { - nicTxRetransmitOfOsSendQue(prAdapter); - } - - #if CFG_SDIO_TX_ENHANCE - halTxLeftClusteredMpdu(prAdapter); - #endif /* CFG_SDIO_TX_ENHANCE */ - - } -#endif /* CFG_TX_STOP_WRITE_TX_FIFO_UNTIL_JOIN */ - - -//4 <6> Setup CONNECTION flag. - prAdapter->eConnectionState = MEDIA_STATE_CONNECTED; - prAdapter->eConnectionStateIndicated = MEDIA_STATE_CONNECTED; - - if (prJoinInfo->fgIsReAssoc) { - prAdapter->fgBypassPortCtrlForRoaming = TRUE; - } - else { - prAdapter->fgBypassPortCtrlForRoaming = FALSE; - } - - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_CONNECT, - (PVOID)NULL, - 0); - - return; -} /* end of joinComplete() */ -#endif - diff --git a/drivers/net/wireless/mt5931/mgmt/ais_fsm.c b/drivers/net/wireless/mt5931/mgmt/ais_fsm.c deleted file mode 100755 index f903fbd65bd3..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/ais_fsm.c +++ /dev/null @@ -1,4599 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/ais_fsm.c#1 $ -*/ - -/*! \file "aa_fsm.c" - \brief This file defines the FSM for SAA and AAA MODULE. - - This file defines the FSM for SAA and AAA MODULE. -*/ - - - -/* -** $Log: ais_fsm.c $ - * - * 04 20 2012 cp.wu - * [WCXRP00000913] [MT6620 Wi-Fi] create repository of source code dedicated for MT6620 E6 ASIC - * correct macro - * - * 01 16 2012 cp.wu - * [MT6620 Wi-Fi][Driver] API and behavior modification for preferred band configuration with corresponding network configuration - * add wlanSetPreferBandByNetwork() for glue layer to invoke for setting preferred band configuration corresponding to network type. - * - * 11 24 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * Adjust code for DBG and CONFIG_XLOG. - * - * 11 22 2011 cp.wu - * [WCXRP00001120] [MT6620 Wi-Fi][Driver] Modify roaming to AIS state transition from synchronous to asynchronous approach to avoid incomplete state termination - * 1. change RDD related compile option brace position. - * 2. when roaming is triggered, ask AIS to transit immediately only when AIS is in Normal TR state without join timeout timer ticking - * 3. otherwise, insert AIS_REQUEST into pending request queue - * - * 11 11 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * modify the xlog related code. - * - * 11 04 2011 cp.wu - * [WCXRP00001086] [MT6620 Wi-Fi][Driver] On Android, indicate an extra DISCONNECT for REASSOCIATED cases as an explicit trigger for Android framework - * correct reference to BSSID field in Association-Response frame. - * - * 11 04 2011 cp.wu - * [WCXRP00001086] [MT6620 Wi-Fi][Driver] On Android, indicate an extra DISCONNECT for REASSOCIATED cases as an explicit trigger for Android framework - * 1. for DEAUTH/DISASSOC cases, indicate for DISCONNECTION immediately. - * 2. (Android only) when reassociation-and-non-roaming cases happened, indicate an extra DISCONNECT indication to Android Wi-Fi framework - * - * 11 02 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * adding the code for XLOG. - * - * 10 26 2011 tsaiyuan.hsu - * [WCXRP00001064] [MT6620 Wi-Fi][DRV]] add code with roaming awareness when disconnecting AIS network - * be aware roaming when disconnecting AIS network. - * - * 10 25 2011 cm.chang - * [WCXRP00001058] [All Wi-Fi][Driver] Fix sta_rec's phyTypeSet and OBSS scan in AP mode - * STA_REC shall be NULL for Beacon's MSDU - * - * 10 13 2011 cp.wu - * [MT6620 Wi-Fi][Driver] Reduce join failure count limit to 2 for faster re-join for other BSS - * 1. short join failure count limit to 2 - * 2. treat join timeout as kind of join failure as well - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 09 30 2011 cm.chang - * [WCXRP00001020] [MT6620 Wi-Fi][Driver] Handle secondary channel offset of AP in 5GHz band - * . - * - * 09 20 2011 tsaiyuan.hsu - * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver - * change window registry of driver for roaming. - * - * 09 20 2011 cm.chang - * [WCXRP00000997] [MT6620 Wi-Fi][Driver][FW] Handle change of BSS preamble type and slot time - * Handle client mode about preamble type and slot time - * - * 09 08 2011 tsaiyuan.hsu - * [WCXRP00000972] [MT6620 Wi-Fi][DRV]] check if roaming occurs after join failure to avoid state incosistence. - * check if roaming occurs after join failure to avoid deactivation of network. - * - * 08 24 2011 chinghwa.yu - * [WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Update RDD test mode cases. - * - * 08 16 2011 tsaiyuan.hsu - * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver - * EnableRoaming in registry is deprecated. - * - * 08 16 2011 tsaiyuan.hsu - * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver - * use registry to enable or disable roaming. - * - * 07 07 2011 cp.wu - * [WCXRP00000840] [MT6620 Wi-Fi][Driver][AIS] Stop timer for joining when channel is released due to join failure count exceeding limit - * stop timer when joining operation is failed due to try count exceeds limitation - * - * 06 28 2011 cp.wu - * [WCXRP00000815] [MT6620 Wi-Fi][Driver] allow single BSSID with multiple SSID settings to work around some tricky AP which use space character as hidden SSID - * do not handle SCAN request immediately after connected to increase the probability of receiving 1st beacon frame. - * - * 06 23 2011 cp.wu - * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module - * change parameter name from PeerAddr to BSSID - * - * 06 20 2011 cp.wu - * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module - * 1. specify target's BSSID when requesting channel privilege. - * 2. pass BSSID information to firmware domain - * - * 06 16 2011 cp.wu - * [WCXRP00000782] [MT6620 Wi-Fi][AIS] Treat connection at higher priority over scanning to avoid WZC connection timeout - * ensure DEAUTH is always sent before establish a new connection - * - * 06 16 2011 cp.wu - * [WCXRP00000782] [MT6620 Wi-Fi][AIS] Treat connection at higher priority over scanning to avoid WZC connection timeout - * typo fix: a right brace is missed. - * - * 06 16 2011 cp.wu - * [WCXRP00000782] [MT6620 Wi-Fi][AIS] Treat connection at higher priority over scanning to avoid WZC connection timeout - * When RECONNECT request is identified as disconnected, it is necessary to check for pending scan request. - * - * 06 16 2011 cp.wu - * [WCXRP00000757] [MT6620 Wi-Fi][Driver][SCN] take use of RLM API to filter out BSS in disallowed channels - * mark fgIsTransition as TRUE for state rolling. - * - * 06 16 2011 cp.wu - * [WCXRP00000782] [MT6620 Wi-Fi][AIS] Treat connection at higher priority over scanning to avoid WZC connection timeout - * always check for pending scan after switched into NORMAL_TR state. - * - * 06 14 2011 cp.wu - * [WCXRP00000782] [MT6620 Wi-Fi][AIS] Treat connection at higher priority over scanning to avoid WZC connection timeout - * always treat connection request at higher priority over scanning request - * - * 06 09 2011 tsaiyuan.hsu - * [WCXRP00000760] [MT5931 Wi-Fi][FW] Refine rxmHandleMacRxDone to reduce code size - * move send_auth at rxmHandleMacRxDone in firmware to driver to reduce code size. - * - * 06 02 2011 cp.wu - * [WCXRP00000681] [MT5931][Firmware] HIF code size reduction - * eliminate unused parameters for SAA-FSM - * - * 05 18 2011 cp.wu - * [WCXRP00000732] [MT6620 Wi-Fi][AIS] No need to switch back to IDLE state when DEAUTH frame is dropped due to bss disconnection - * change SCAN handling behavior when followed by a CONNECT/DISCONNECT requests by pending instead of dropping. - * - * 05 17 2011 cp.wu - * [WCXRP00000732] [MT6620 Wi-Fi][AIS] No need to switch back to IDLE state when DEAUTH frame is dropped due to bss disconnection - * when TX DONE status is TX_RESULT_DROPPED_IN_DRIVER, no need to switch back to IDLE state. - * - * 04 14 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * . - * - * 04 13 2011 george.huang - * [WCXRP00000628] [MT6620 Wi-Fi][FW][Driver] Modify U-APSD setting to default OFF - * remove assert - * - * 03 18 2011 cp.wu - * [WCXRP00000575] [MT6620 Wi-Fi][Driver][AIS] reduce memory usage when generating mailbox message for scan request - * when there is no IE needed for probe request, then request a smaller memory for mailbox message - * - * 03 17 2011 chinglan.wang - * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature - * . - * - * 03 17 2011 chinglan.wang - * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature - * . - * - * 03 16 2011 tsaiyuan.hsu - * [WCXRP00000517] [MT6620 Wi-Fi][Driver][FW] Fine Tune Performance of Roaming - * remove obsolete definition and unused variables. - * - * 03 11 2011 cp.wu - * [WCXRP00000535] [MT6620 Wi-Fi][Driver] Fixed channel operation when AIS and Tethering are operating concurrently - * When fixed channel operation is necessary, AIS-FSM would scan and only connect for BSS on the specific channel - * - * 03 09 2011 tsaiyuan.hsu - * [WCXRP00000517] [MT6620 Wi-Fi][Driver][FW] Fine Tune Performance of Roaming - * avoid clearing fgIsScanReqIssued so as to add scan results. - * - * 03 07 2011 terry.wu - * [WCXRP00000521] [MT6620 Wi-Fi][Driver] Remove non-standard debug message - * Toggle non-standard debug messages to comments. - * - * 03 04 2011 tsaiyuan.hsu - * [WCXRP00000517] [MT6620 Wi-Fi][Driver][FW] Fine Tune Performance of Roaming - * reset retry conter of attemp to connect to ap after completion of join. - * - * 03 04 2011 cp.wu - * [WCXRP00000515] [MT6620 Wi-Fi][Driver] Surpress compiler warning which is identified by GNU compiler collection - * surpress compile warning occured when compiled by GNU compiler collection. - * - * 03 02 2011 cp.wu - * [WCXRP00000503] [MT6620 Wi-Fi][Driver] Take RCPI brought by association response as initial RSSI right after connection is built. - * use RCPI brought by ASSOC-RESP after connection is built as initial RCPI to avoid using a uninitialized MAC-RX RCPI. - * - * 02 26 2011 tsaiyuan.hsu - * [WCXRP00000391] [MT6620 Wi-Fi][FW] Add Roaming Support - * not send disassoc or deauth to leaving AP so as to improve performace of roaming. - * - * 02 23 2011 cp.wu - * [WCXRP00000487] [MT6620 Wi-Fi][Driver][AIS] Serve scan and connect request with a queue-based approach to improve response time for scanning request - * when handling reconnect request, set fgTryScan as TRUE - * - * 02 22 2011 cp.wu - * [WCXRP00000487] [MT6620 Wi-Fi][Driver][AIS] Serve scan and connect request with a queue-based approach to improve response time for scanning request - * handle SCAN and RECONNECT with a FIFO approach. - * - * 02 09 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * Check if prRegInfo is null or not before initializing roaming parameters. - * - * 02 01 2011 cp.wu - * [WCXRP00000416] [MT6620 Wi-Fi][Driver] treat "unable to find BSS" as connection trial to prevent infinite reconnection trials - * treat "unable to find BSS" as connection trial to prevent infinite reconnection trials. - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * - * 01 26 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * . - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Fix Compile Error when DBG is disabled. - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Change Station Type in Station Record, Modify MACRO definition for getting station type & network type index & Role. - * - * 01 14 2011 cp.wu - * [WCXRP00000359] [MT6620 Wi-Fi][Driver] add an extra state to ensure DEAUTH frame is always sent - * Add an extra state to guarantee DEAUTH frame is sent then connect to new BSS. - * This change is due to WAPI AP needs DEAUTH frame as a necessary step in handshaking protocol. - * - * 01 11 2011 cp.wu - * [WCXRP00000307] [MT6620 Wi-Fi][SQA]WHQL test .2c_wlan_adhoc case fail. - * [IBSS] when merged in, the bss state should be updated to firmware to pass WHQL adhoc failed item - * - * 01 10 2011 cp.wu - * [WCXRP00000351] [MT6620 Wi-Fi][Driver] remove from scanning result in OID handling layer when the corresponding BSS is disconnected due to beacon timeout - * remove from scanning result when the BSS is disconnected due to beacon timeout. - * - * 01 03 2011 cp.wu - * [WCXRP00000337] [MT6620 Wi-FI][Driver] AIS-FSM not to invoke cnmStaRecResetStatus directly 'cause it frees all belonging STA-RECs - * do not invoke cnmStaRecResetStatus() directly, nicUpdateBss will do the things after bss is disconnected - * - * 12 30 2010 cp.wu - * [WCXRP00000270] [MT6620 Wi-Fi][Driver] Clear issues after concurrent networking support has been merged - * do not need to manipulate prStaRec after indicating BSS disconnection to firmware, 'cause all STA-RECs belongs to BSS has been freed already - * - * 12 27 2010 cp.wu - * [WCXRP00000269] [MT6620 Wi-Fi][Driver][Firmware] Prepare for v1.1 branch release - * add DEBUGFUNC() macro invoking for more detailed debugging information - * - * 12 23 2010 george.huang - * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function - * 1. update WMM IE parsing, with ASSOC REQ handling - * 2. extend U-APSD parameter passing from driver to FW - * - * 12 17 2010 cp.wu - * [WCXRP00000270] [MT6620 Wi-Fi][Driver] Clear issues after concurrent networking support has been merged - * before BSS disconnection is indicated to firmware, all correlated peer should be cleared and freed - * - * 12 07 2010 cm.chang - * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk - * 1. BSSINFO include RLM parameter - * 2. free all sta records when network is disconnected - * - * 11 25 2010 yuche.tsai - * NULL - * Update SLT Function for QoS Support and not be affected by fixed rate function. - * - * 11 25 2010 cp.wu - * [WCXRP00000208] [MT6620 Wi-Fi][Driver] Add scanning with specified SSID to AIS FSM - * add scanning with specified SSID facility to AIS-FSM - * - * 11 01 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module - * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead - * 2) Remove CNM CH-RECOVER event handling - * 3) cfg read/write API renamed with kal prefix for unified naming rules. - * - * 10 26 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW] Support NIC capability query command - * 1) update NVRAM content template to ver 1.02 - * 2) add compile option for querying NIC capability (default: off) - * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting - * 4) correct auto-rate compiler error under linux (treat warning as error) - * 5) simplify usage of NVRAM and REG_INFO_T - * 6) add version checking between driver and firmware - * - * 10 14 2010 wh.su - * [WCXRP00000097] [MT6620 Wi-Fi] [Driver] Fixed the P2P not setting the fgIsChannelExt value make scan not abort - * initial the fgIsChannelExt value. - * - * 10 08 2010 cp.wu - * [WCXRP00000087] [MT6620 Wi-Fi][Driver] Cannot connect to 5GHz AP, driver will cause FW assert. - * correct erroneous logic: specifying eBand with incompatible eSco - * - * 10 04 2010 cp.wu - * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by ENUM_NETWORK_TYPE_INDEX_T only - * remove ENUM_NETWORK_TYPE_T definitions - * - * 09 27 2010 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000065] Update BoW design and settings - * Update BCM/BoW design and settings. - * - * 09 23 2010 cp.wu - * [WCXRP00000049] [MT6620 Wi-Fi][Driver] Adhoc cannot be created successfully. - * keep IBSS-ALONE state retrying until further instruction is received - * - * 09 21 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * Do a complete reset with STA-REC null checking for RF test re-entry - * - * 09 09 2010 yuche.tsai - * NULL - * Fix NULL IE Beacon issue. Sync Beacon Content to FW before enable beacon. - * Both in IBSS Create & IBSS Merge - * - * 09 09 2010 cp.wu - * NULL - * frequency is in unit of KHz thus no need to divide 1000 once more. - * - * 09 06 2010 cp.wu - * NULL - * 1) initialize for correct parameter even for disassociation. - * 2) AIS-FSM should have a limit on trials to build connection - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 30 2010 cp.wu - * NULL - * eliminate klockwork errors - * - * 08 29 2010 yuche.tsai - * NULL - * Finish SLT TX/RX & Rate Changing Support. - * - * 08 25 2010 cp.wu - * NULL - * add option for enabling AIS 5GHz scan - * - * 08 25 2010 cp.wu - * NULL - * [AIS-FSM] IBSS no longer needs to acquire channel for beaconing, RLM/CNM will handle the channel switching when BSS information is updated - * - * 08 25 2010 george.huang - * NULL - * update OID/ registry control path for PM related settings - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 08 20 2010 cm.chang - * NULL - * Migrate RLM code to host from FW - * - * 08 12 2010 cp.wu - * NULL - * check-in missed files. - * - * 08 12 2010 kevin.huang - * NULL - * Refine bssProcessProbeRequest() and bssSendBeaconProbeResponse() - * - * 08 09 2010 cp.wu - * NULL - * reset fgIsScanReqIssued when abort request is received right after join completion. - * - * 08 03 2010 cp.wu - * NULL - * surpress compilation warning. - * - * 08 02 2010 cp.wu - * NULL - * comment out deprecated members in BSS_INFO, which are only used by firmware rather than driver. - * - * 07 30 2010 cp.wu - * NULL - * 1) BoW wrapper: use definitions instead of hard-coded constant for error code - * 2) AIS-FSM: eliminate use of desired RF parameters, use prTargetBssDesc instead - * 3) add handling for RX_PKT_DESTINATION_HOST_WITH_FORWARD for GO-broadcast frames - * - * 07 29 2010 cp.wu - * NULL - * eliminate u4FreqInKHz usage, combined into rConnections.ucAdHoc* - * - * 07 29 2010 cp.wu - * NULL - * allocate on MGMT packet for IBSS beaconing. - * - * 07 29 2010 cp.wu - * NULL - * [AIS-FSM] fix: when join failed, release channel privilege as well - * - * 07 28 2010 cp.wu - * NULL - * reuse join-abort sub-procedure to reduce code size. - * - * 07 28 2010 cp.wu - * NULL - * 1) eliminate redundant variable eOPMode in prAdapter->rWlanInfo - * 2) change nicMediaStateChange() API prototype - * - * 07 26 2010 cp.wu - * - * AIS-FSM: when scan request is coming in the 1st 5 seconds of channel privilege period, just pend it til 5-sec. period finishes - * - * 07 26 2010 cp.wu - * - * AIS-FSM FIX: return channel privilege even when the privilege is not granted yet - * QM: qmGetFrameAction() won't assert when corresponding STA-REC index is not found - * - * 07 26 2010 cp.wu - * - * re-commit code logic being overwriten. - * - * 07 24 2010 wh.su - * - * .support the Wi-Fi RSN - * - * 07 23 2010 cp.wu - * - * 1) re-enable AIS-FSM beacon timeout handling. - * 2) scan done API revised - * - * 07 23 2010 cp.wu - * - * 1) enable Ad-Hoc - * 2) disable beacon timeout handling temporally due to unexpected beacon timeout event. - * - * 07 23 2010 cp.wu - * - * indicate scan done for linux wireless extension - * - * 07 23 2010 cp.wu - * - * add AIS-FSM handling for beacon timeout event. - * - * 07 22 2010 cp.wu - * - * 1) refine AIS-FSM indent. - * 2) when entering RF Test mode, flush 802.1X frames as well - * 3) when entering D3 state, flush 802.1X frames as well - * - * 07 21 2010 cp.wu - * - * separate AIS-FSM states into different cases of channel request. - * - * 07 21 2010 cp.wu - * - * 1) change BG_SCAN to ONLINE_SCAN for consistent term - * 2) only clear scanning result when scan is permitted to do - * - * 07 20 2010 cp.wu - * - * 1) [AIS] when new scan is issued, clear currently available scanning result except the connected one - * 2) refine disconnection behaviour when issued during BG-SCAN process - * - * 07 20 2010 cp.wu - * - * 1) bugfix: do not stop timer for join after switched into normal_tr state, for providing chance for DHCP handshasking - * 2) modify rsnPerformPolicySelection() invoking - * - * 07 19 2010 cp.wu - * - * 1) init AIS_BSS_INFO as channel number = 1 with band = 2.4GHz - * 2) correct typo - * - * 07 19 2010 wh.su - * - * update for security supporting. - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * when IBSS is being merged-in, send command packet to PM for connected indication - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * Add Ad-Hoc support to AIS-FSM - * - * 07 19 2010 jeffrey.chang - * - * Linux port modification - * - * 07 16 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * bugfix for SCN migration - * 1) modify QUEUE_CONCATENATE_QUEUES() so it could be used to concatence with an empty queue - * 2) before AIS issues scan request, network(BSS) needs to be activated first - * 3) only invoke COPY_SSID when using specified SSID for scan - * - * 07 15 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * for AIS scanning, driver specifies no extra IE for probe request - * - * 07 15 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * driver no longer generates probe request frames - * - * 07 14 2010 yarco.yang - * - * Remove CFG_MQM_MIGRATION - * - * 07 14 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * Refine AIS-FSM by divided into more states - * - * 07 13 2010 cm.chang - * - * Rename MSG_CH_RELEASE_T to MSG_CH_ABORT_T - * - * 07 09 2010 cp.wu - * - * 1) separate AIS_FSM state for two kinds of scanning. (OID triggered scan, and scan-for-connection) - * 2) eliminate PRE_BSS_DESC_T, Beacon/PrebResp is now parsed in single pass - * 3) implment DRV-SCN module, currently only accepts single scan request, other request will be directly dropped by returning BUSY - * - * 07 09 2010 george.huang - * - * [WPD00001556] Migrate PM variables from FW to driver: for composing QoS Info - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * take use of RLM module for parsing/generating HT IEs for 11n capability - * - * 07 08 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Rename MID_MNY_CNM_CH_RELEASE to MID_MNY_CNM_CH_ABORT - * - * 07 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * for first connection, if connecting failed do not enter into scan state. - * - * 07 06 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * once STA-REC is allocated and updated, invoke cnmStaRecChangeState() to sync. with firmware. - * - * 07 06 2010 george.huang - * [WPD00001556]Basic power managemenet function - * Update arguments for nicUpdateBeaconIETemplate() - * - * 07 06 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * STA-REC is maintained by CNM only. - * - * 07 05 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * remove unused definitions. - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * AIS-FSM integration with CNM channel request messages - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * implementation of DRV-SCN and related mailbox message handling. - * - * 06 30 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * sync. with CMD/EVENT document ver0.07. - * - * 06 29 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) sync to. CMD/EVENT document v0.03 - * 2) simplify DTIM period parsing in scan.c only, bss.c no longer parses it again. - * 3) send command packet to indicate FW-PM after - * a) 1st beacon is received after AIS has connected to an AP - * b) IBSS-ALONE has been created - * c) IBSS-MERGE has occured - * - * 06 25 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * modify Beacon/ProbeResp to complete parsing, - * because host software has looser memory usage restriction - * - * 06 23 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * integrate . - * - * 06 22 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * comment out RLM APIs by CFG_RLM_MIGRATION. - * - * 06 22 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) add command warpper for STA-REC/BSS-INFO sync. - * 2) enhance command packet sending procedure for non-oid part - * 3) add command packet definitions for STA-REC/BSS-INFO sync. - * - * 06 21 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Support CFG_MQM_MIGRATION flag - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add scan_fsm into building. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * RSN/PRIVACY compilation flag awareness correction - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 18 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * migration from MT6620 firmware. - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add scan.c. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * restore utility function invoking via hem_mbox to direct calls - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * auth.c is migrated. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add bss.c. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * change to enqueue TX frame infinitely. - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) eliminate CFG_CMD_EVENT_VERSION_0_9 - * 2) when disconnected, indicate nic directly (no event is needed) - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add buildable & linkable ais_fsm.c - * - * related reference are still waiting to be resolved - * - * 06 01 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add conditionial compiling flag to choose default available bandwidth - * - * 05 28 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add ClientList handling API - bssClearClientList, bssAddStaRecToClientList - * - * 05 24 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Refine authSendAuthFrame() for NULL STA_RECORD_T case and minimum deauth interval. - * - * 05 21 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Fix compile error if CFG_CMD_EVENT_VER_009 == 0 for prEventConnStatus->ucNetworkType. - * - * 05 21 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Refine txmInitWtblTxRateTable() - set TX initial rate according to AP's operation rate set - * - * 05 17 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Call pmAbort() and add ucNetworkType field in EVENT_CONNECTION_STATUS - * - * 05 14 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Fix compile warning - define of MQM_WMM_PARSING was removed - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 04 28 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * Removed the use of compiling flag MQM_WMM_PARSING - * - * 04 27 2010 kevin.huang - * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support - * - * Fix typo - * - * 04 27 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add Set Slot Time and Beacon Timeout Support for AdHoc Mode - * - * 04 19 2010 kevin.huang - * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support - * Add Send Deauth for Class 3 Error and Leave Network Support - * - * 04 15 2010 wh.su - * [BORA00000680][MT6620] Support the statistic for Microsoft os query - * fixed the protected bit at cap info for ad-hoc. - * - * 04 13 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add new HW CH macro support - * - * 04 07 2010 chinghwa.yu - * [BORA00000563]Add WiFi CoEx BCM module - * Add TX Power Control RCPI function. - * - * 03 29 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * move the wlan table alloc / free to change state function. - * - * 03 25 2010 wh.su - * [BORA00000676][MT6620] Support the frequency setting and query at build connection / connection event - * modify the build connection and status event structure bu CMD_EVENT doc 0.09 draft, default is disable. - * - * 03 24 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * fixed some WHQL testing error. - * - * 03 24 2010 kevin.huang - * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support - * Add Set / Unset POWER STATE in AIS Network - * - * 03 16 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add AdHoc Mode - * - * 03 10 2010 kevin.huang - * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support - * Add Channel Manager for arbitration of JOIN and SCAN Req - * - * 03 03 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add PHY_CONFIG to change Phy Type - * - * 03 03 2010 chinghwa.yu - * [BORA00000563]Add WiFi CoEx BCM module - * Use bcmWiFiNotify to replace wifi_send_msg to pass infomation to BCM module. - * - * 03 03 2010 chinghwa.yu - * [BORA00000563]Add WiFi CoEx BCM module - * Remove wmt_task definition and add PTA function. - * - * 03 02 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Init TXM and MQM testing procedures in aisFsmRunEventJoinComplete() - * - * 03 01 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Modified aisUpdateBssInfo() to call TXM's functions for setting WTBL TX parameters - * - * 03 01 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * clear the pmkid cache while indicate media disconnect. - * - * 02 26 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * . - * - * 02 26 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Enabled MQM parsing WMM IEs for non-AP mode - * - * 02 26 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Remove CFG_TEST_VIRTUAL_CMD and add support of Driver STA_RECORD_T activation - * - * 02 25 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * use the Rx0 dor event indicate. - * - * 02 23 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Support dynamic channel selection - * - * 02 23 2010 wh.su - * [BORA00000621][MT6620 Wi-Fi] Add the RSSI indicate to avoid XP stalled for query rssi value - * Adding the RSSI event support, using the HAL function to get the rcpi value and tranlsate to RSSI and indicate to driver - * - * 02 12 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Use bss info array for concurrent handle - * - * 02 05 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Revise data structure to share the same BSS_INFO_T for avoiding coding error - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * 01 27 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Set max AMDPU size supported by the peer to 64 KB, removed mqmInit() and mqmTxSendAddBaReq() function calls in aisUpdateBssInfo() - * - * 01 27 2010 wh.su - * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code - * add and fixed some security function. - * - * 01 22 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support protection and bandwidth switch - * - * 01 20 2010 kevin.huang - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Add PHASE_2_INTEGRATION_WORK_AROUND and CFG_SUPPORT_BCM flags - * - * 01 15 2010 tehuang.liu - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Configured the AMPDU factor to 3 for the APu1rwduu`wvpghlqg|q`mpdkb+ilp - * - * 01 14 2010 chinghwa.yu - * [BORA00000563]Add WiFi CoEx BCM module - * Add WiFi BCM module for the 1st time. - * - * 01 11 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add Deauth and Disassoc Handler - * - * 01 07 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * - * Refine JOIN Complete and seperate the function of Media State indication - * - * 01 04 2010 tehuang.liu - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * For working out the first connection Chariot-verified version - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * Dec 10 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the sample code to update the wlan table rate, - * - * Dec 10 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Different function prototype of wifi_send_msg() - * - * Dec 9 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Call rlm related function to process HT info when join complete - * - * Dec 9 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * default the acquired wlan table entry code off - * - * Dec 9 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the code to acquired the wlan table entry, and a sample code to update the BA bit at table - * - * Dec 7 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix the problem of prSwRfb overwrited by event packet in aisFsmRunEventJoinComplete() - * - * Dec 4 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the code to integrate the security related code - * - * Dec 3 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Remove redundant declaration - * - * Dec 3 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add code for JOIN init and JOIN complete - * - * Nov 30 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Rename u4RSSI to i4RSSI - * - * Nov 30 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Revise ENUM_MEDIA_STATE to ENUM_PARAM_MEDIA_STATE - * - * Nov 30 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add fgIsScanReqIssued to CONNECTION_SETTINGS_T - * - * Nov 26 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Revise Virtual CMD handler due to structure changed - * - * Nov 25 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add Virtual CMD & RESP for testing CMD PATH - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add aisFsmInitializeConnectionSettings() - * - * Nov 20 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add CFG_TEST_MGMT_FSM flag for aisFsmTest() - * - * Nov 16 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define AIS_ROAMING_CONNECTION_TRIAL_LIMIT 2 - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ -#if DBG -/*lint -save -e64 Type mismatch */ -static PUINT_8 apucDebugAisState[AIS_STATE_NUM] = { - (PUINT_8)DISP_STRING("AIS_STATE_IDLE"), - (PUINT_8)DISP_STRING("AIS_STATE_SEARCH"), - (PUINT_8)DISP_STRING("AIS_STATE_SCAN"), - (PUINT_8)DISP_STRING("AIS_STATE_ONLINE_SCAN"), - (PUINT_8)DISP_STRING("AIS_STATE_LOOKING_FOR"), - (PUINT_8)DISP_STRING("AIS_STATE_WAIT_FOR_NEXT_SCAN"), - (PUINT_8)DISP_STRING("AIS_STATE_REQ_CHANNEL_JOIN"), - (PUINT_8)DISP_STRING("AIS_STATE_JOIN"), - (PUINT_8)DISP_STRING("AIS_STATE_IBSS_ALONE"), - (PUINT_8)DISP_STRING("AIS_STATE_IBSS_MERGE"), - (PUINT_8)DISP_STRING("AIS_STATE_NORMAL_TR"), - (PUINT_8)DISP_STRING("AIS_STATE_DISCONNECTING") -}; -/*lint -restore */ -#endif /* DBG */ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/*! -* @brief the function is used to initialize the value of the connection settings for -* AIS network -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisInitializeConnectionSettings ( - IN P_ADAPTER_T prAdapter, - IN P_REG_INFO_T prRegInfo - ) -{ - P_CONNECTION_SETTINGS_T prConnSettings; - UINT_8 aucAnyBSSID[] = BC_BSSID; - UINT_8 aucZeroMacAddr[] = NULL_MAC_ADDR; - - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - /* Setup default values for operation */ - COPY_MAC_ADDR(prConnSettings->aucMacAddress, aucZeroMacAddr); - - prConnSettings->ucDelayTimeOfDisconnectEvent = AIS_DELAY_TIME_OF_DISCONNECT_SEC; - - COPY_MAC_ADDR(prConnSettings->aucBSSID, aucAnyBSSID); - prConnSettings->fgIsConnByBssidIssued = FALSE; - - prConnSettings->fgIsConnReqIssued = FALSE; - - prConnSettings->ucSSIDLen = 0; - - prConnSettings->eOPMode = NET_TYPE_INFRA; - - prConnSettings->eConnectionPolicy = CONNECT_BY_SSID_BEST_RSSI; - - if(prRegInfo) { - prConnSettings->ucAdHocChannelNum = (UINT_8) nicFreq2ChannelNum(prRegInfo->u4StartFreq); - prConnSettings->eAdHocBand = prRegInfo->u4StartFreq < 5000000 ? BAND_2G4 : BAND_5G; - prConnSettings->eAdHocMode = (ENUM_PARAM_AD_HOC_MODE_T) (prRegInfo->u4AdhocMode); - } - - prConnSettings->eAuthMode = AUTH_MODE_OPEN; - - prConnSettings->eEncStatus = ENUM_ENCRYPTION_DISABLED; - - prConnSettings->fgIsScanReqIssued = FALSE; - - /* MIB attributes */ - prConnSettings->u2BeaconPeriod = DOT11_BEACON_PERIOD_DEFAULT; - - prConnSettings->u2RTSThreshold = DOT11_RTS_THRESHOLD_DEFAULT; - - prConnSettings->u2DesiredNonHTRateSet = RATE_SET_ALL_ABG; - - //prConnSettings->u4FreqInKHz; /* Center frequency */ - - - /* Set U-APSD AC */ - prConnSettings->bmfgApsdEnAc = PM_UAPSD_NONE; - - secInit(prAdapter, NETWORK_TYPE_AIS_INDEX); - - /* Features */ - prConnSettings->fgIsEnableRoaming = FALSE; -#if CFG_SUPPORT_ROAMING - if(prRegInfo) { - prConnSettings->fgIsEnableRoaming = ((prRegInfo->fgDisRoaming > 0)?(FALSE):(TRUE)); - } -#endif /* CFG_SUPPORT_ROAMING */ - - prConnSettings->fgIsAdHocQoSEnable = FALSE; - - prConnSettings->eDesiredPhyConfig = PHY_CONFIG_802_11ABGN; - - /* Set default bandwidth modes */ - prConnSettings->uc2G4BandwidthMode = CONFIG_BW_20M; - prConnSettings->uc5GBandwidthMode = CONFIG_BW_20_40M; - - return; -} /* end of aisFsmInitializeConnectionSettings() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief the function is used to initialize the value in AIS_FSM_INFO_T for -* AIS FSM operation -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmInit ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_BSS_INFO_T prAisBssInfo; - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecificBssInfo; - - DEBUGFUNC("aisFsmInit()"); - DBGLOG(SW1, INFO, ("->aisFsmInit()\n")); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - prAisSpecificBssInfo = &(prAdapter->rWifiVar.rAisSpecificBssInfo); - - //4 <1> Initiate FSM - prAisFsmInfo->ePreviousState = AIS_STATE_IDLE; - prAisFsmInfo->eCurrentState = AIS_STATE_IDLE; - - prAisFsmInfo->ucAvailableAuthTypes = 0; - - prAisFsmInfo->prTargetBssDesc = (P_BSS_DESC_T)NULL; - - prAisFsmInfo->ucSeqNumOfReqMsg = 0; - prAisFsmInfo->ucSeqNumOfChReq = 0; - prAisFsmInfo->ucSeqNumOfScanReq = 0; - - prAisFsmInfo->fgIsInfraChannelFinished = TRUE; -#if CFG_SUPPORT_ROAMING - prAisFsmInfo->fgIsRoamingScanPending = FALSE; -#endif /* CFG_SUPPORT_ROAMING */ - prAisFsmInfo->fgIsChannelRequested = FALSE; - prAisFsmInfo->fgIsChannelGranted = FALSE; - - //4 <1.1> Initiate FSM - Timer INIT - cnmTimerInitTimer(prAdapter, - &prAisFsmInfo->rBGScanTimer, - (PFN_MGMT_TIMEOUT_FUNC)aisFsmRunEventBGSleepTimeOut, - (UINT_32)NULL); - - cnmTimerInitTimer(prAdapter, - &prAisFsmInfo->rIbssAloneTimer, - (PFN_MGMT_TIMEOUT_FUNC)aisFsmRunEventIbssAloneTimeOut, - (UINT_32)NULL); - - cnmTimerInitTimer(prAdapter, - &prAisFsmInfo->rIndicationOfDisconnectTimer, - (PFN_MGMT_TIMEOUT_FUNC)aisPostponedEventOfDisconnTimeout, - (UINT_32)NULL); - - cnmTimerInitTimer(prAdapter, - &prAisFsmInfo->rJoinTimeoutTimer, - (PFN_MGMT_TIMEOUT_FUNC)aisFsmRunEventJoinTimeout, - (UINT_32)NULL); - - //4 <1.2> Initiate PWR STATE - SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_AIS_INDEX); - - - //4 <2> Initiate BSS_INFO_T - common part - BSS_INFO_INIT(prAdapter, NETWORK_TYPE_AIS_INDEX); - COPY_MAC_ADDR(prAisBssInfo->aucOwnMacAddr, prAdapter->rWifiVar.aucMacAddress); - - //4 <3> Initiate BSS_INFO_T - private part - /* TODO */ - prAisBssInfo->eBand = BAND_2G4; - prAisBssInfo->ucPrimaryChannel = 1; - prAisBssInfo->prStaRecOfAP = (P_STA_RECORD_T)NULL; - - //4 <4> Allocate MSDU_INFO_T for Beacon - prAisBssInfo->prBeacon = cnmMgtPktAlloc(prAdapter, - OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH); - - if (prAisBssInfo->prBeacon) { - prAisBssInfo->prBeacon->eSrc = TX_PACKET_MGMT; - prAisBssInfo->prBeacon->ucStaRecIndex = 0xFF; /* NULL STA_REC */ - } - else { - ASSERT(0); - } - -#if 0 - prAisBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = PM_UAPSD_ALL; - prAisBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = PM_UAPSD_ALL; - prAisBssInfo->rPmProfSetupInfo.ucUapsdSp = WMM_MAX_SP_LENGTH_2; -#else - if (prAdapter->u4UapsdAcBmp == 0) { - prAdapter->u4UapsdAcBmp = CFG_INIT_UAPSD_AC_BMP; - //ASSERT(prAdapter->u4UapsdAcBmp); - } - prAisBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = (UINT_8)prAdapter->u4UapsdAcBmp; - prAisBssInfo->rPmProfSetupInfo.ucBmpTriggerAC =(UINT_8) prAdapter->u4UapsdAcBmp; - prAisBssInfo->rPmProfSetupInfo.ucUapsdSp = (UINT_8)prAdapter->u4MaxSpLen; -#endif - - /* request list initialization */ - LINK_INITIALIZE(&prAisFsmInfo->rPendingReqList); - - //DBGPRINTF("[2] ucBmpDeliveryAC:0x%x, ucBmpTriggerAC:0x%x, ucUapsdSp:0x%x", - //prAisBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC, - //prAisBssInfo->rPmProfSetupInfo.ucBmpTriggerAC, - //prAisBssInfo->rPmProfSetupInfo.ucUapsdSp); - - return; -} /* end of aisFsmInit() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief the function is used to uninitialize the value in AIS_FSM_INFO_T for -* AIS FSM operation -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmUninit ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_BSS_INFO_T prAisBssInfo; - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecificBssInfo; - - DEBUGFUNC("aisFsmUninit()"); - DBGLOG(SW1, INFO, ("->aisFsmUninit()\n")); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - prAisSpecificBssInfo = &(prAdapter->rWifiVar.rAisSpecificBssInfo); - - //4 <1> Stop all timers - cnmTimerStopTimer(prAdapter, &prAisFsmInfo->rBGScanTimer); - cnmTimerStopTimer(prAdapter, &prAisFsmInfo->rIbssAloneTimer); - cnmTimerStopTimer(prAdapter, &prAisFsmInfo->rIndicationOfDisconnectTimer); - cnmTimerStopTimer(prAdapter, &prAisFsmInfo->rJoinTimeoutTimer); - - //4 <2> flush pending request - aisFsmFlushRequest(prAdapter); - - //4 <3> Reset driver-domain BSS-INFO - if(prAisBssInfo->prBeacon) { - cnmMgtPktFree(prAdapter, prAisBssInfo->prBeacon); - prAisBssInfo->prBeacon = NULL; - } - -#if CFG_SUPPORT_802_11W - rsnStopSaQuery(prAdapter); -#endif - - return; -} /* end of aisFsmUninit() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Initialization of JOIN STATE -* -* @param[in] prBssDesc The pointer of BSS_DESC_T which is the BSS we will try to join with. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmStateInit_JOIN ( - IN P_ADAPTER_T prAdapter, - P_BSS_DESC_T prBssDesc - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_BSS_INFO_T prAisBssInfo; - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecificBssInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - P_STA_RECORD_T prStaRec; - P_MSG_JOIN_REQ_T prJoinReqMsg; - - DEBUGFUNC("aisFsmStateInit_JOIN()"); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - prAisSpecificBssInfo = &(prAdapter->rWifiVar.rAisSpecificBssInfo); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - ASSERT(prBssDesc); - - //4 <1> We are going to connect to this BSS. - prBssDesc->fgIsConnecting = TRUE; - - - //4 <2> Setup corresponding STA_RECORD_T - prStaRec = bssCreateStaRecFromBssDesc(prAdapter, - STA_TYPE_LEGACY_AP, - NETWORK_TYPE_AIS_INDEX, - prBssDesc); - - prAisFsmInfo->prTargetStaRec = prStaRec; - - //4 <2.1> sync. to firmware domain - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - - //4 <3> Update ucAvailableAuthTypes which we can choice during SAA - if (prAisBssInfo->eConnectionState == PARAM_MEDIA_STATE_DISCONNECTED) { - - prStaRec->fgIsReAssoc = FALSE; - - switch (prConnSettings->eAuthMode) { - case AUTH_MODE_OPEN: /* Note: Omit break here. */ - case AUTH_MODE_WPA: - case AUTH_MODE_WPA_PSK: - case AUTH_MODE_WPA2: - case AUTH_MODE_WPA2_PSK: - prAisFsmInfo->ucAvailableAuthTypes = (UINT_8)AUTH_TYPE_OPEN_SYSTEM; - break; - - - case AUTH_MODE_SHARED: - prAisFsmInfo->ucAvailableAuthTypes = (UINT_8)AUTH_TYPE_SHARED_KEY; - break; - - - case AUTH_MODE_AUTO_SWITCH: - DBGLOG(AIS, LOUD, ("JOIN INIT: eAuthMode == AUTH_MODE_AUTO_SWITCH\n")); - prAisFsmInfo->ucAvailableAuthTypes = (UINT_8)(AUTH_TYPE_OPEN_SYSTEM | - AUTH_TYPE_SHARED_KEY); - break; - - default: - ASSERT(!(prConnSettings->eAuthMode == AUTH_MODE_WPA_NONE)); - DBGLOG(AIS, ERROR, ("JOIN INIT: Auth Algorithm : %d was not supported by JOIN\n", - prConnSettings->eAuthMode)); - /* TODO(Kevin): error handling ? */ - return; - } - - /* TODO(tyhsu): Assume that Roaming Auth Type is equal to ConnSettings eAuthMode */ - prAisSpecificBssInfo->ucRoamingAuthTypes = prAisFsmInfo->ucAvailableAuthTypes; - - prStaRec->ucTxAuthAssocRetryLimit = TX_AUTH_ASSOCI_RETRY_LIMIT; - - } - else { - ASSERT(prBssDesc->eBSSType == BSS_TYPE_INFRASTRUCTURE); - ASSERT(!prBssDesc->fgIsConnected); - - DBGLOG(AIS, LOUD, ("JOIN INIT: AUTH TYPE = %d for Roaming\n", - prAisSpecificBssInfo->ucRoamingAuthTypes)); - - - prStaRec->fgIsReAssoc = TRUE; /* We do roaming while the medium is connected */ - - /* TODO(Kevin): We may call a sub function to acquire the Roaming Auth Type */ - prAisFsmInfo->ucAvailableAuthTypes = prAisSpecificBssInfo->ucRoamingAuthTypes; - - prStaRec->ucTxAuthAssocRetryLimit = TX_AUTH_ASSOCI_RETRY_LIMIT_FOR_ROAMING; - } - - - //4 <4> Use an appropriate Authentication Algorithm Number among the ucAvailableAuthTypes - if (prAisFsmInfo->ucAvailableAuthTypes & - (UINT_8)AUTH_TYPE_OPEN_SYSTEM) { - - DBGLOG(AIS, LOUD, ("JOIN INIT: Try to do Authentication with AuthType == OPEN_SYSTEM.\n")); - prAisFsmInfo->ucAvailableAuthTypes &= - ~(UINT_8)AUTH_TYPE_OPEN_SYSTEM; - - prStaRec->ucAuthAlgNum = (UINT_8)AUTH_ALGORITHM_NUM_OPEN_SYSTEM; - } - else if (prAisFsmInfo->ucAvailableAuthTypes & - (UINT_8)AUTH_TYPE_SHARED_KEY) { - - DBGLOG(AIS, LOUD, ("JOIN INIT: Try to do Authentication with AuthType == SHARED_KEY.\n")); - - prAisFsmInfo->ucAvailableAuthTypes &= - ~(UINT_8)AUTH_TYPE_SHARED_KEY; - - prStaRec->ucAuthAlgNum = (UINT_8)AUTH_ALGORITHM_NUM_SHARED_KEY; - } - else if (prAisFsmInfo->ucAvailableAuthTypes & - (UINT_8)AUTH_TYPE_FAST_BSS_TRANSITION) { - - DBGLOG(AIS, LOUD, ("JOIN INIT: Try to do Authentication with AuthType == FAST_BSS_TRANSITION.\n")); - - prAisFsmInfo->ucAvailableAuthTypes &= - ~(UINT_8)AUTH_TYPE_FAST_BSS_TRANSITION; - - prStaRec->ucAuthAlgNum = (UINT_8)AUTH_ALGORITHM_NUM_FAST_BSS_TRANSITION; - } - else { - ASSERT(0); - } - - //4 <5> Overwrite Connection Setting for eConnectionPolicy == ANY (Used by Assoc Req) - if (prConnSettings->eConnectionPolicy == CONNECT_BY_SSID_ANY) { - - if (prBssDesc->ucSSIDLen) { - COPY_SSID(prConnSettings->aucSSID, - prConnSettings->ucSSIDLen, - prBssDesc->aucSSID, - prBssDesc->ucSSIDLen); - } - } - - //4 <6> Send a Msg to trigger SAA to start JOIN process. - prJoinReqMsg = (P_MSG_JOIN_REQ_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_JOIN_REQ_T)); - if (!prJoinReqMsg) { - - ASSERT(0); // Can't trigger SAA FSM - return; - } - - prJoinReqMsg->rMsgHdr.eMsgId = MID_AIS_SAA_FSM_START; - prJoinReqMsg->ucSeqNum = ++prAisFsmInfo->ucSeqNumOfReqMsg; - prJoinReqMsg->prStaRec = prStaRec; - - if (1) { - int j; - P_FRAG_INFO_T prFragInfo; - for (j = 0; j < MAX_NUM_CONCURRENT_FRAGMENTED_MSDUS; j++) { - prFragInfo = &prStaRec->rFragInfo[j]; - - if (prFragInfo->pr1stFrag) { - //nicRxReturnRFB(prAdapter, prFragInfo->pr1stFrag); - prFragInfo->pr1stFrag = (P_SW_RFB_T)NULL; - } - } - } - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prJoinReqMsg, - MSG_SEND_METHOD_BUF); - - return; -} /* end of aisFsmInit_JOIN() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Retry JOIN for AUTH_MODE_AUTO_SWITCH -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @retval TRUE We will retry JOIN -* @retval FALSE We will not retry JOIN -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -aisFsmStateInit_RetryJOIN ( - IN P_ADAPTER_T prAdapter, - P_STA_RECORD_T prStaRec - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_MSG_JOIN_REQ_T prJoinReqMsg; - - DEBUGFUNC("aisFsmStateInit_RetryJOIN()"); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - - /* Retry other AuthType if possible */ - if (!prAisFsmInfo->ucAvailableAuthTypes) { - return FALSE; - } - - if (prAisFsmInfo->ucAvailableAuthTypes & - (UINT_8)AUTH_TYPE_SHARED_KEY) { - - DBGLOG(AIS, INFO, ("RETRY JOIN INIT: Retry Authentication with AuthType == SHARED_KEY.\n")); - - prAisFsmInfo->ucAvailableAuthTypes &= - ~(UINT_8)AUTH_TYPE_SHARED_KEY; - - prStaRec->ucAuthAlgNum = (UINT_8)AUTH_ALGORITHM_NUM_SHARED_KEY; - } - else { - DBGLOG(AIS, ERROR, ("RETRY JOIN INIT: Retry Authentication with Unexpected AuthType.\n")); - ASSERT(0); - } - - prAisFsmInfo->ucAvailableAuthTypes = 0; /* No more available Auth Types */ - - /* Trigger SAA to start JOIN process. */ - prJoinReqMsg = (P_MSG_JOIN_REQ_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_JOIN_REQ_T)); - if (!prJoinReqMsg) { - - ASSERT(0); // Can't trigger SAA FSM - return FALSE; - } - - prJoinReqMsg->rMsgHdr.eMsgId = MID_AIS_SAA_FSM_START; - prJoinReqMsg->ucSeqNum = ++prAisFsmInfo->ucSeqNumOfReqMsg; - prJoinReqMsg->prStaRec = prStaRec; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prJoinReqMsg, - MSG_SEND_METHOD_BUF); - - return TRUE; - -}/* end of aisFsmRetryJOIN() */ - - -#if CFG_SUPPORT_ADHOC -/*----------------------------------------------------------------------------*/ -/*! -* @brief State Initialization of AIS_STATE_IBSS_ALONE -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmStateInit_IBSS_ALONE ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - P_BSS_INFO_T prAisBssInfo; - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - - //4 <1> Check if IBSS was created before ? - if (prAisBssInfo->fgIsBeaconActivated) { - - //4 <2> Start IBSS Alone Timer for periodic SCAN and then SEARCH -#if !CFG_SLT_SUPPORT - cnmTimerStartTimer(prAdapter, - &prAisFsmInfo->rIbssAloneTimer, - SEC_TO_MSEC(AIS_IBSS_ALONE_TIMEOUT_SEC)); -#endif - } - - aisFsmCreateIBSS(prAdapter); - - return; -} /* end of aisFsmStateInit_IBSS_ALONE() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief State Initialization of AIS_STATE_IBSS_MERGE -* -* @param[in] prBssDesc The pointer of BSS_DESC_T which is the IBSS we will try to merge with. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmStateInit_IBSS_MERGE ( - IN P_ADAPTER_T prAdapter, - P_BSS_DESC_T prBssDesc - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - P_BSS_INFO_T prAisBssInfo; - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - - - ASSERT(prBssDesc); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - - //4 <1> We will merge with to this BSS immediately. - prBssDesc->fgIsConnecting = FALSE; - prBssDesc->fgIsConnected = TRUE; - - //4 <2> Setup corresponding STA_RECORD_T - prStaRec = bssCreateStaRecFromBssDesc(prAdapter, - STA_TYPE_ADHOC_PEER, - NETWORK_TYPE_AIS_INDEX, - prBssDesc); - - prStaRec->fgIsMerging = TRUE; - - prAisFsmInfo->prTargetStaRec = prStaRec; - - //4 <2.1> sync. to firmware domain - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - - //4 <3> IBSS-Merge - aisFsmMergeIBSS(prAdapter, prStaRec); - - return; -} /* end of aisFsmStateInit_IBSS_MERGE() */ - -#endif /* CFG_SUPPORT_ADHOC */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process of JOIN Abort -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmStateAbort_JOIN ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_MSG_JOIN_ABORT_T prJoinAbortMsg; - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - - /* 1. Abort JOIN process */ - prJoinAbortMsg = (P_MSG_JOIN_ABORT_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_JOIN_ABORT_T)); - if (!prJoinAbortMsg) { - - ASSERT(0); // Can't abort SAA FSM - return; - } - - prJoinAbortMsg->rMsgHdr.eMsgId = MID_AIS_SAA_FSM_ABORT; - prJoinAbortMsg->ucSeqNum = prAisFsmInfo->ucSeqNumOfReqMsg; - prJoinAbortMsg->prStaRec = prAisFsmInfo->prTargetStaRec; - - scanRemoveConnFlagOfBssDescByBssid(prAdapter, prAisFsmInfo->prTargetStaRec->aucMacAddr); - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prJoinAbortMsg, - MSG_SEND_METHOD_BUF); - - /* 2. Return channel privilege */ - aisFsmReleaseCh(prAdapter); - - /* 3.1 stop join timeout timer */ - cnmTimerStopTimer(prAdapter, &prAisFsmInfo->rJoinTimeoutTimer); - - /* 3.2 reset local variable */ - prAisFsmInfo->fgIsInfraChannelFinished = TRUE; - - return; -} /* end of aisFsmAbortJOIN() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process of SCAN Abort -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmStateAbort_SCAN ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_MSG_SCN_SCAN_CANCEL prScanCancelMsg; - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - - /* Abort JOIN process. */ - prScanCancelMsg = (P_MSG_SCN_SCAN_CANCEL)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_SCN_SCAN_CANCEL)); - if (!prScanCancelMsg) { - - ASSERT(0); // Can't abort SCN FSM - return; - } - - prScanCancelMsg->rMsgHdr.eMsgId = MID_AIS_SCN_SCAN_CANCEL; - prScanCancelMsg->ucSeqNum = prAisFsmInfo->ucSeqNumOfScanReq; - prScanCancelMsg->ucNetTypeIndex = (UINT_8)NETWORK_TYPE_AIS_INDEX; -#if CFG_ENABLE_WIFI_DIRECT - if(prAdapter->fgIsP2PRegistered) { - prScanCancelMsg->fgIsChannelExt = FALSE; - } -#endif - - /* unbuffered message to guarantee scan is cancelled in sequence */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prScanCancelMsg, - MSG_SEND_METHOD_UNBUF); - - return; -} /* end of aisFsmAbortSCAN() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process of NORMAL_TR Abort -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmStateAbort_NORMAL_TR ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - - ASSERT(prAdapter); - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - - /* TODO(Kevin): Do abort other MGMT func */ - - /* 1. Release channel to CNM */ - aisFsmReleaseCh(prAdapter); - - /* 2.1 stop join timeout timer */ - cnmTimerStopTimer(prAdapter, &prAisFsmInfo->rJoinTimeoutTimer); - - /* 2.2 reset local variable */ - prAisFsmInfo->fgIsInfraChannelFinished = TRUE; - - return; -} /* end of aisFsmAbortNORMAL_TR() */ - - -#if CFG_SUPPORT_ADHOC -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process of NORMAL_TR Abort -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmStateAbort_IBSS ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_BSS_DESC_T prBssDesc; - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - - // reset BSS-DESC - if (prAisFsmInfo->prTargetStaRec) { - prBssDesc = scanSearchBssDescByTA(prAdapter, - prAisFsmInfo->prTargetStaRec->aucMacAddr); - - if (prBssDesc) { - prBssDesc->fgIsConnected = FALSE; - prBssDesc->fgIsConnecting = FALSE; - } - } - - // release channel privilege - aisFsmReleaseCh(prAdapter); - - return; -} -#endif /* CFG_SUPPORT_ADHOC */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief The Core FSM engine of AIS(Ad-hoc, Infra STA) -* -* @param[in] eNextState Enum value of next AIS STATE -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmSteps ( - IN P_ADAPTER_T prAdapter, - ENUM_AIS_STATE_T eNextState - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_BSS_INFO_T prAisBssInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - P_BSS_DESC_T prBssDesc; - P_MSG_CH_REQ_T prMsgChReq; - P_MSG_SCN_SCAN_REQ prScanReqMsg; - P_AIS_REQ_HDR_T prAisReq; - ENUM_BAND_T eBand; - UINT_8 ucChannel; - UINT_16 u2ScanIELen; - - BOOLEAN fgIsTransition = (BOOLEAN)FALSE; - - DEBUGFUNC("aisFsmSteps()"); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - do { - - /* Do entering Next State */ - prAisFsmInfo->ePreviousState = prAisFsmInfo->eCurrentState; - -#if DBG - DBGLOG(AIS, STATE, ("TRANSITION: [%s] -> [%s]\n", - apucDebugAisState[prAisFsmInfo->eCurrentState], - apucDebugAisState[eNextState])); -#else - DBGLOG(AIS, STATE, ("[%d] TRANSITION: [%d] -> [%d]\n", - DBG_AIS_IDX, - prAisFsmInfo->eCurrentState, - eNextState)); -#endif - /* NOTE(Kevin): This is the only place to change the eCurrentState(except initial) */ - prAisFsmInfo->eCurrentState = eNextState; - - fgIsTransition = (BOOLEAN)FALSE; - - /* Do tasks of the State that we just entered */ - switch (prAisFsmInfo->eCurrentState) { - /* NOTE(Kevin): we don't have to rearrange the sequence of following - * switch case. Instead I would like to use a common lookup table of array - * of function pointer to speed up state search. - */ - case AIS_STATE_IDLE: - - prAisReq = aisFsmGetNextRequest(prAdapter); - - if(prAisReq == NULL || prAisReq->eReqType == AIS_REQUEST_RECONNECT) { - if (prConnSettings->fgIsConnReqIssued) { - - prAisFsmInfo->fgTryScan = TRUE; - - SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_AIS_INDEX); - SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_AIS_INDEX); - - // sync with firmware - nicActivateNetwork(prAdapter, NETWORK_TYPE_AIS_INDEX); - - // reset trial count - prAisFsmInfo->ucConnTrialCount = 0; - - eNextState = AIS_STATE_SEARCH; - fgIsTransition = TRUE; - } - else { - UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_AIS_INDEX); - SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_AIS_INDEX); - - // sync with firmware - nicDeactivateNetwork(prAdapter, NETWORK_TYPE_AIS_INDEX); - - // check for other pending request - if(prAisReq) { - if(aisFsmIsRequestPending(prAdapter, AIS_REQUEST_SCAN, TRUE) == TRUE) { - wlanClearScanningResult(prAdapter); - eNextState = AIS_STATE_SCAN; - - fgIsTransition = TRUE; - } - } - } - - if(prAisReq) { - /* free the message */ - cnmMemFree(prAdapter, prAisReq); - } - } - else if(prAisReq->eReqType == AIS_REQUEST_SCAN) { -#if CFG_SUPPORT_ROAMING - prAisFsmInfo->fgIsRoamingScanPending = FALSE; -#endif /* CFG_SUPPORT_ROAMING */ - wlanClearScanningResult(prAdapter); - - eNextState = AIS_STATE_SCAN; - fgIsTransition = TRUE; - - /* free the message */ - cnmMemFree(prAdapter, prAisReq); - } - else if(prAisReq->eReqType == AIS_REQUEST_ROAMING_CONNECT || prAisReq->eReqType == AIS_REQUEST_ROAMING_SEARCH) { - /* ignore */ - /* free the message */ - cnmMemFree(prAdapter, prAisReq); - } - - prAisFsmInfo->u4SleepInterval = AIS_BG_SCAN_INTERVAL_MIN_SEC; - - break; - - case AIS_STATE_SEARCH: - //4 <1> Search for a matched candidate and save it to prTargetBssDesc. -#if CFG_SLT_SUPPORT - prBssDesc = prAdapter->rWifiVar.rSltInfo.prPseudoBssDesc; -#else - prBssDesc = scanSearchBssDescByPolicy(prAdapter, NETWORK_TYPE_AIS_INDEX); -#endif - - // we are under Roaming Condition. - if (prAisBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED) { - if(prAisFsmInfo->ucConnTrialCount > AIS_ROAMING_CONNECTION_TRIAL_LIMIT) { -#if CFG_SUPPORT_ROAMING - roamingFsmRunEventFail(prAdapter, ROAMING_FAIL_REASON_CONNLIMIT); -#endif /* CFG_SUPPORT_ROAMING */ - // reset retry count - prAisFsmInfo->ucConnTrialCount = 0; - - // abort connection trial - prConnSettings->fgIsConnReqIssued = FALSE; - - eNextState = AIS_STATE_NORMAL_TR; - fgIsTransition = TRUE; - - break; - } - } - - //4 <2> We are not under Roaming Condition. - if (prAisBssInfo->eConnectionState == PARAM_MEDIA_STATE_DISCONNECTED) { - - //4 <2.a> If we have the matched one - if (prBssDesc) { - - //4 Stored the Selected BSS security cipher. For later asoc req compose IE - prAisBssInfo->u4RsnSelectedGroupCipher = - prBssDesc->u4RsnSelectedGroupCipher; - prAisBssInfo->u4RsnSelectedPairwiseCipher = - prBssDesc->u4RsnSelectedPairwiseCipher; - prAisBssInfo->u4RsnSelectedAKMSuite = - prBssDesc->u4RsnSelectedAKMSuite; - - //4 Do STATE transition and update current Operation Mode. - if (prBssDesc->eBSSType == BSS_TYPE_INFRASTRUCTURE) { - - prAisBssInfo->eCurrentOPMode = OP_MODE_INFRASTRUCTURE; - - /* Record the target BSS_DESC_T for next STATE. */ - prAisFsmInfo->prTargetBssDesc = prBssDesc; - - /* Transit to channel acquire */ - eNextState = AIS_STATE_REQ_CHANNEL_JOIN; - fgIsTransition = TRUE; - - // increase connection trial count - prAisFsmInfo->ucConnTrialCount++; - } -#if CFG_SUPPORT_ADHOC - else if (prBssDesc->eBSSType == BSS_TYPE_IBSS) { - - prAisBssInfo->eCurrentOPMode = OP_MODE_IBSS; - - /* Record the target BSS_DESC_T for next STATE. */ - prAisFsmInfo->prTargetBssDesc = prBssDesc; - - eNextState = AIS_STATE_IBSS_MERGE; - fgIsTransition = TRUE; - } -#endif /* CFG_SUPPORT_ADHOC */ - else { - ASSERT(0); - eNextState = AIS_STATE_WAIT_FOR_NEXT_SCAN; - fgIsTransition = TRUE; - } - } - //4 <2.b> If we don't have the matched one - else { - - // increase connection trial count for infrastructure connection - if (prConnSettings->eOPMode == NET_TYPE_INFRA) { - prAisFsmInfo->ucConnTrialCount++; - } - - //4 Try to SCAN - if (prAisFsmInfo->fgTryScan) { - eNextState = AIS_STATE_LOOKING_FOR; - - fgIsTransition = TRUE; - } - //4 We've do SCAN already, now wait in some STATE. - else { - if (prConnSettings->eOPMode == NET_TYPE_INFRA) { - - /* issue reconnect request, and retreat to idle state for scheduling */ - aisFsmInsertRequest(prAdapter, AIS_REQUEST_RECONNECT); - - eNextState = AIS_STATE_IDLE; - fgIsTransition = TRUE; - } -#if CFG_SUPPORT_ADHOC - else if ((prConnSettings->eOPMode == NET_TYPE_IBSS) - || (prConnSettings->eOPMode == NET_TYPE_AUTO_SWITCH) - || (prConnSettings->eOPMode == NET_TYPE_DEDICATED_IBSS)) { - - prAisBssInfo->eCurrentOPMode = OP_MODE_IBSS; - prAisFsmInfo->prTargetBssDesc = NULL; - - eNextState = AIS_STATE_IBSS_ALONE; - fgIsTransition = TRUE; - } -#endif /* CFG_SUPPORT_ADHOC */ - else { - ASSERT(0); - eNextState = AIS_STATE_WAIT_FOR_NEXT_SCAN; - fgIsTransition = TRUE; - } - } - } - } - //4 <3> We are under Roaming Condition. - else { // prAdapter->eConnectionState == MEDIA_STATE_CONNECTED. - - //4 <3.a> This BSS_DESC_T is our AP. - /* NOTE(Kevin 2008/05/16): Following cases will go back to NORMAL_TR. - * CASE I: During Roaming, APP(WZC/NDISTEST) change the connection - * settings. That make we can NOT match the original AP, so the - * prBssDesc is NULL. - * CASE II: The same reason as CASE I. Because APP change the - * eOPMode to other network type in connection setting - * (e.g. NET_TYPE_IBSS), so the BssDesc become the IBSS node. - * (For CASE I/II, before WZC/NDISTEST set the OID_SSID, it will change - * other parameters in connection setting first. So if we do roaming - * at the same time, it will hit these cases.) - * - * CASE III: Normal case, we can't find other candidate to roam - * out, so only the current AP will be matched. - */ - if ((!prBssDesc) || /* CASE I */ - (prBssDesc->eBSSType != BSS_TYPE_INFRASTRUCTURE) || /* CASE II */ - (prBssDesc->fgIsConnected) /* CASE III */) { -#if DBG - if ((prBssDesc) && - (prBssDesc->fgIsConnected)) { - ASSERT(EQUAL_MAC_ADDR(prBssDesc->aucBSSID, prAisBssInfo->aucBSSID)); - } -#endif /* DBG */ - /* We already associated with it, go back to NORMAL_TR */ - /* TODO(Kevin): Roaming Fail */ -#if CFG_SUPPORT_ROAMING - roamingFsmRunEventFail(prAdapter, ROAMING_FAIL_REASON_NOCANDIDATE); -#endif /* CFG_SUPPORT_ROAMING */ - - /* Retreat to NORMAL_TR state */ - eNextState = AIS_STATE_NORMAL_TR; - fgIsTransition = TRUE; - } - //4 <3.b> Try to roam out for JOIN this BSS_DESC_T. - else { -#if DBG - ASSERT(UNEQUAL_MAC_ADDR(prBssDesc->aucBSSID, prAisBssInfo->aucBSSID)); -#endif /* DBG */ - - //4 Record the target BSS_DESC_T for next STATE. - prAisFsmInfo->prTargetBssDesc = prBssDesc; - - // tyhsu: increase connection trial count - prAisFsmInfo->ucConnTrialCount++; - - /* Transit to channel acquire */ - eNextState = AIS_STATE_REQ_CHANNEL_JOIN; - fgIsTransition = TRUE; - } - } - - break; - - case AIS_STATE_WAIT_FOR_NEXT_SCAN: - - DBGLOG(AIS, LOUD, ("SCAN: Idle Begin - Current Time = %ld\n", kalGetTimeTick())); - - cnmTimerStartTimer(prAdapter, - &prAisFsmInfo->rBGScanTimer, - SEC_TO_MSEC(prAisFsmInfo->u4SleepInterval)); - - SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_AIS_INDEX); - - if (prAisFsmInfo->u4SleepInterval < AIS_BG_SCAN_INTERVAL_MAX_SEC) { - prAisFsmInfo->u4SleepInterval <<= 1; - } - break; - - case AIS_STATE_SCAN: - case AIS_STATE_ONLINE_SCAN: - case AIS_STATE_LOOKING_FOR: - - if(!IS_NET_ACTIVE(prAdapter, NETWORK_TYPE_AIS_INDEX)) { - SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_AIS_INDEX); - - // sync with firmware - nicActivateNetwork(prAdapter, NETWORK_TYPE_AIS_INDEX); - } - - /* IE length decision */ - if(prAisFsmInfo->u4ScanIELength > 0) { - u2ScanIELen = (UINT_16)prAisFsmInfo->u4ScanIELength; - } - else { -#if CFG_SUPPORT_WPS2 - u2ScanIELen = prAdapter->prGlueInfo->u2WSCIELen; -#else - u2ScanIELen = 0; -#endif - } - - prScanReqMsg = (P_MSG_SCN_SCAN_REQ)cnmMemAlloc(prAdapter, - RAM_TYPE_MSG, - OFFSET_OF(MSG_SCN_SCAN_REQ, aucIE) + u2ScanIELen); - if (!prScanReqMsg) { - ASSERT(0); // Can't trigger SCAN FSM - return; - } - - prScanReqMsg->rMsgHdr.eMsgId = MID_AIS_SCN_SCAN_REQ; - prScanReqMsg->ucSeqNum = ++prAisFsmInfo->ucSeqNumOfScanReq; - prScanReqMsg->ucNetTypeIndex = (UINT_8)NETWORK_TYPE_AIS_INDEX; - -#if CFG_SUPPORT_RDD_TEST_MODE - prScanReqMsg->eScanType = SCAN_TYPE_PASSIVE_SCAN; -#else - prScanReqMsg->eScanType = SCAN_TYPE_ACTIVE_SCAN; -#endif - - if(prAisFsmInfo->eCurrentState == AIS_STATE_SCAN - || prAisFsmInfo->eCurrentState == AIS_STATE_ONLINE_SCAN) { - if(prAisFsmInfo->ucScanSSIDLen == 0) { - /* Scan for all available SSID */ - prScanReqMsg->ucSSIDType = SCAN_REQ_SSID_WILDCARD; - } - else { - prScanReqMsg->ucSSIDType = SCAN_REQ_SSID_SPECIFIED; - COPY_SSID(prScanReqMsg->aucSSID, - prScanReqMsg->ucSSIDLength, - prAisFsmInfo->aucScanSSID, - prAisFsmInfo->ucScanSSIDLen); - } - } - else { - /* Scan for determined SSID */ - prScanReqMsg->ucSSIDType = SCAN_REQ_SSID_SPECIFIED; - COPY_SSID(prScanReqMsg->aucSSID, - prScanReqMsg->ucSSIDLength, - prConnSettings->aucSSID, - prConnSettings->ucSSIDLen); - } - - /* check if tethering is running and need to fix on specific channel */ - if(cnmAisInfraChannelFixed(prAdapter, &eBand, &ucChannel) == TRUE) { - prScanReqMsg->eScanChannel = SCAN_CHANNEL_SPECIFIED; - prScanReqMsg->ucChannelListNum = 1; - prScanReqMsg->arChnlInfoList[0].eBand - = eBand;; - prScanReqMsg->arChnlInfoList[0].ucChannelNum - = ucChannel; - } - else if(prAdapter->aePreferBand[NETWORK_TYPE_AIS_INDEX] == BAND_NULL) { - if(prAdapter->fgEnable5GBand == TRUE) { - prScanReqMsg->eScanChannel = SCAN_CHANNEL_FULL; - } - else { - prScanReqMsg->eScanChannel = SCAN_CHANNEL_2G4; - } - } - else if(prAdapter->aePreferBand[NETWORK_TYPE_AIS_INDEX] == BAND_2G4) { - prScanReqMsg->eScanChannel = SCAN_CHANNEL_2G4; - } - else if(prAdapter->aePreferBand[NETWORK_TYPE_AIS_INDEX] == BAND_5G) { - prScanReqMsg->eScanChannel = SCAN_CHANNEL_5G; - } - else { - prScanReqMsg->eScanChannel = SCAN_CHANNEL_FULL; - ASSERT(0); - } - - if(prAisFsmInfo->u4ScanIELength > 0) { - kalMemCopy(prScanReqMsg->aucIE, prAisFsmInfo->aucScanIEBuf, prAisFsmInfo->u4ScanIELength); - } - else { -#if CFG_SUPPORT_WPS2 - if(prAdapter->prGlueInfo->u2WSCIELen > 0) { - kalMemCopy(prScanReqMsg->aucIE, &prAdapter->prGlueInfo->aucWSCIE, prAdapter->prGlueInfo->u2WSCIELen); - } - } -#endif - - prScanReqMsg->u2IELen = u2ScanIELen; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prScanReqMsg, - MSG_SEND_METHOD_BUF); - - prAisFsmInfo->fgTryScan = FALSE; /* Will enable background sleep for infrastructure */ - - break; - - case AIS_STATE_REQ_CHANNEL_JOIN: - /* send message to CNM for acquiring channel */ - prMsgChReq = (P_MSG_CH_REQ_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_CH_REQ_T)); - if (!prMsgChReq) { - ASSERT(0); // Can't indicate CNM for channel acquiring - return; - } - - prMsgChReq->rMsgHdr.eMsgId = MID_MNY_CNM_CH_REQ; - prMsgChReq->ucNetTypeIndex = NETWORK_TYPE_AIS_INDEX; - prMsgChReq->ucTokenID = ++prAisFsmInfo->ucSeqNumOfChReq; - prMsgChReq->eReqType = CH_REQ_TYPE_JOIN; - prMsgChReq->u4MaxInterval = AIS_JOIN_CH_REQUEST_INTERVAL; - prMsgChReq->ucPrimaryChannel = prAisFsmInfo->prTargetBssDesc->ucChannelNum; - prMsgChReq->eRfSco = prAisFsmInfo->prTargetBssDesc->eSco; - prMsgChReq->eRfBand = prAisFsmInfo->prTargetBssDesc->eBand; - COPY_MAC_ADDR(prMsgChReq->aucBSSID, prAisFsmInfo->prTargetBssDesc->aucBSSID); - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prMsgChReq, - MSG_SEND_METHOD_BUF); - - prAisFsmInfo->fgIsChannelRequested = TRUE; - break; - - case AIS_STATE_JOIN: - aisFsmStateInit_JOIN(prAdapter, prAisFsmInfo->prTargetBssDesc); - break; - -#if CFG_SUPPORT_ADHOC - case AIS_STATE_IBSS_ALONE: - aisFsmStateInit_IBSS_ALONE(prAdapter); - break; - - case AIS_STATE_IBSS_MERGE: - aisFsmStateInit_IBSS_MERGE(prAdapter, prAisFsmInfo->prTargetBssDesc); - break; -#endif /* CFG_SUPPORT_ADHOC */ - - case AIS_STATE_NORMAL_TR: - if(prAisFsmInfo->fgIsInfraChannelFinished == FALSE) { - /* Don't do anything when rJoinTimeoutTimer is still ticking */ - } - else { - /* 1. Process for pending scan */ - if(aisFsmIsRequestPending(prAdapter, AIS_REQUEST_SCAN, TRUE) == TRUE) { - wlanClearScanningResult(prAdapter); - eNextState = AIS_STATE_ONLINE_SCAN; - fgIsTransition = TRUE; - } - /* 2. Process for pending roaming scan */ - else if(aisFsmIsRequestPending(prAdapter, AIS_REQUEST_ROAMING_SEARCH, TRUE) == TRUE) { - eNextState = AIS_STATE_LOOKING_FOR; - fgIsTransition = TRUE; - } - /* 3. Process for pending roaming scan */ - else if(aisFsmIsRequestPending(prAdapter, AIS_REQUEST_ROAMING_CONNECT, TRUE) == TRUE) { - eNextState = AIS_STATE_SEARCH; - fgIsTransition = TRUE; - } - } - - break; - - case AIS_STATE_DISCONNECTING: - /* send for deauth frame for disconnection */ - authSendDeauthFrame(prAdapter, - prAisBssInfo->prStaRecOfAP, - (P_SW_RFB_T)NULL, - REASON_CODE_DEAUTH_LEAVING_BSS, - aisDeauthXmitComplete); - break; - - default: - ASSERT(0); /* Make sure we have handle all STATEs */ - break; - - } - } - while (fgIsTransition); - - return; - -} /* end of aisFsmSteps() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmRunEventScanDone ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_SCN_SCAN_DONE prScanDoneMsg; - P_AIS_FSM_INFO_T prAisFsmInfo; - ENUM_AIS_STATE_T eNextState; - UINT_8 ucSeqNumOfCompMsg; - P_CONNECTION_SETTINGS_T prConnSettings; - - DEBUGFUNC("aisFsmRunEventScanDone()"); - - ASSERT(prAdapter); - ASSERT(prMsgHdr); - - DBGLOG(AIS, LOUD, ("EVENT-SCAN DONE: Current Time = %ld\n", kalGetTimeTick())); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)prMsgHdr; - ASSERT(prScanDoneMsg->ucNetTypeIndex == (UINT_8)NETWORK_TYPE_AIS_INDEX); - - ucSeqNumOfCompMsg = prScanDoneMsg->ucSeqNum; - cnmMemFree(prAdapter, prMsgHdr); - - eNextState = prAisFsmInfo->eCurrentState; - - if (ucSeqNumOfCompMsg != prAisFsmInfo->ucSeqNumOfScanReq) { - DBGLOG(AIS, WARN, ("SEQ NO of AIS SCN DONE MSG is not matched.\n")); - } - else { - switch (prAisFsmInfo->eCurrentState) { - case AIS_STATE_SCAN: - prConnSettings->fgIsScanReqIssued = FALSE; - - /* reset scan IE buffer */ - prAisFsmInfo->u4ScanIELength = 0; - - kalScanDone(prAdapter->prGlueInfo, KAL_NETWORK_TYPE_AIS_INDEX, WLAN_STATUS_SUCCESS); - eNextState = AIS_STATE_IDLE; - - break; - - case AIS_STATE_ONLINE_SCAN: - prConnSettings->fgIsScanReqIssued = FALSE; - - /* reset scan IE buffer */ - prAisFsmInfo->u4ScanIELength = 0; - - kalScanDone(prAdapter->prGlueInfo, KAL_NETWORK_TYPE_AIS_INDEX, WLAN_STATUS_SUCCESS); -#if CFG_SUPPORT_ROAMING - eNextState = aisFsmRoamingScanResultsUpdate(prAdapter); -#else - eNextState = AIS_STATE_NORMAL_TR; -#endif /* CFG_SUPPORT_ROAMING */ - - break; - - case AIS_STATE_LOOKING_FOR: -#if CFG_SUPPORT_ROAMING - eNextState = aisFsmRoamingScanResultsUpdate(prAdapter); -#else - eNextState = AIS_STATE_SEARCH; -#endif /* CFG_SUPPORT_ROAMING */ - break; - - default: - break; - - } - } - - if (eNextState != prAisFsmInfo->eCurrentState) { - aisFsmSteps(prAdapter, eNextState); - } - - return; -} /* end of aisFsmRunEventScanDone() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmRunEventAbort ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_AIS_ABORT_T prAisAbortMsg; - P_AIS_FSM_INFO_T prAisFsmInfo; - UINT_8 ucReasonOfDisconnect; - BOOLEAN fgDelayIndication; - - DEBUGFUNC("aisFsmRunEventAbort()"); - - ASSERT(prAdapter); - ASSERT(prMsgHdr); - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - - //4 <1> Extract information of Abort Message and then free memory. - prAisAbortMsg = (P_MSG_AIS_ABORT_T)prMsgHdr; - ucReasonOfDisconnect = prAisAbortMsg->ucReasonOfDisconnect; - fgDelayIndication = prAisAbortMsg->fgDelayIndication; - - cnmMemFree(prAdapter, prMsgHdr); - -#if DBG - DBGLOG(AIS, LOUD, ("EVENT-ABORT: Current State %s\n", - apucDebugAisState[prAisFsmInfo->eCurrentState])); -#else - DBGLOG(AIS, LOUD, ("[%d] EVENT-ABORT: Current State [%d]\n", - DBG_AIS_IDX, - prAisFsmInfo->eCurrentState)); -#endif - - //4 <2> clear previous pending connection request and insert new one - aisFsmIsRequestPending(prAdapter, AIS_REQUEST_RECONNECT, TRUE); - aisFsmInsertRequest(prAdapter, AIS_REQUEST_RECONNECT); - - if(prAisFsmInfo->eCurrentState != AIS_STATE_DISCONNECTING) { - //4 <3> invoke abort handler - aisFsmStateAbort(prAdapter, ucReasonOfDisconnect, fgDelayIndication); - } - - return; -} /* end of aisFsmRunEventAbort() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function handles AIS-FSM abort event/command -* -* \param[in] prAdapter Pointer of ADAPTER_T -* ucReasonOfDisconnect Reason for disonnection -* fgDelayIndication Option to delay disconnection indication -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmStateAbort ( - IN P_ADAPTER_T prAdapter, - UINT_8 ucReasonOfDisconnect, - BOOLEAN fgDelayIndication - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_BSS_INFO_T prAisBssInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - BOOLEAN fgIsCheckConnected; - - ASSERT(prAdapter); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - fgIsCheckConnected = FALSE; - - //4 <1> Save information of Abort Message and then free memory. - prAisBssInfo->ucReasonOfDisconnect = ucReasonOfDisconnect; - - //4 <2> Abort current job. - switch (prAisFsmInfo->eCurrentState) { - case AIS_STATE_IDLE: - case AIS_STATE_SEARCH: - break; - - case AIS_STATE_WAIT_FOR_NEXT_SCAN: - /* Do cancel timer */ - cnmTimerStopTimer(prAdapter, &prAisFsmInfo->rBGScanTimer); - - /* in case roaming is triggered */ - fgIsCheckConnected = TRUE; - break; - - case AIS_STATE_SCAN: - /* Do abort SCAN */ - aisFsmStateAbort_SCAN(prAdapter); - - /* queue for later handling */ - if(aisFsmIsRequestPending(prAdapter, AIS_REQUEST_SCAN, FALSE) == FALSE) { - aisFsmInsertRequest(prAdapter, AIS_REQUEST_SCAN); - } - - break; - - case AIS_STATE_LOOKING_FOR: - /* Do abort SCAN */ - aisFsmStateAbort_SCAN(prAdapter); - - /* in case roaming is triggered */ - fgIsCheckConnected = TRUE; - break; - - case AIS_STATE_REQ_CHANNEL_JOIN: - /* Release channel to CNM */ - aisFsmReleaseCh(prAdapter); - - /* in case roaming is triggered */ - fgIsCheckConnected = TRUE; - break; - - case AIS_STATE_JOIN: - /* Do abort JOIN */ - aisFsmStateAbort_JOIN(prAdapter); - - /* in case roaming is triggered */ - fgIsCheckConnected = TRUE; - break; - -#if CFG_SUPPORT_ADHOC - case AIS_STATE_IBSS_ALONE: - case AIS_STATE_IBSS_MERGE: - aisFsmStateAbort_IBSS(prAdapter); - break; -#endif /* CFG_SUPPORT_ADHOC */ - - case AIS_STATE_ONLINE_SCAN: - /* Do abort SCAN */ - aisFsmStateAbort_SCAN(prAdapter); - - /* queue for later handling */ - if(aisFsmIsRequestPending(prAdapter, AIS_REQUEST_SCAN, FALSE) == FALSE) { - aisFsmInsertRequest(prAdapter, AIS_REQUEST_SCAN); - } - - fgIsCheckConnected = TRUE; - break; - - case AIS_STATE_NORMAL_TR: - fgIsCheckConnected = TRUE; - break; - - case AIS_STATE_DISCONNECTING: - /* Do abort NORMAL_TR */ - aisFsmStateAbort_NORMAL_TR(prAdapter); - - break; - - default: - break; - } - - if (fgIsCheckConnected && - (PARAM_MEDIA_STATE_CONNECTED == prAisBssInfo->eConnectionState)) { - - /* switch into DISCONNECTING state for sending DEAUTH if necessary */ - if (prAisBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE && - prAisBssInfo->ucReasonOfDisconnect == DISCONNECT_REASON_CODE_NEW_CONNECTION && - prAisBssInfo->prStaRecOfAP && - prAisBssInfo->prStaRecOfAP->fgIsInUse) { - aisFsmSteps(prAdapter, AIS_STATE_DISCONNECTING); - - return; - } - else { - /* Do abort NORMAL_TR */ - aisFsmStateAbort_NORMAL_TR(prAdapter); - } - } - - aisFsmDisconnect(prAdapter, fgDelayIndication); - - return; - -} /* end of aisFsmStateAbort() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will handle the Join Complete Event from SAA FSM for AIS FSM -* -* @param[in] prMsgHdr Message of Join Complete of SAA FSM. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmRunEventJoinComplete ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_JOIN_COMP_T prJoinCompMsg; - P_AIS_FSM_INFO_T prAisFsmInfo; - ENUM_AIS_STATE_T eNextState; - P_STA_RECORD_T prStaRec; - P_SW_RFB_T prAssocRspSwRfb; - - DEBUGFUNC("aisFsmRunEventJoinComplete()"); - - ASSERT(prMsgHdr); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prJoinCompMsg = (P_MSG_JOIN_COMP_T)prMsgHdr; - prStaRec = prJoinCompMsg->prStaRec; - prAssocRspSwRfb = prJoinCompMsg->prSwRfb; - - eNextState = prAisFsmInfo->eCurrentState; - - // Check State and SEQ NUM - if (prAisFsmInfo->eCurrentState == AIS_STATE_JOIN) { - P_BSS_INFO_T prAisBssInfo; - - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - - // Check SEQ NUM - if (prJoinCompMsg->ucSeqNum == prAisFsmInfo->ucSeqNumOfReqMsg) { - - - //4 <1> JOIN was successful - if (prJoinCompMsg->rJoinStatus == WLAN_STATUS_SUCCESS) { - - //1. Reset retry count - prAisFsmInfo->ucConnTrialCount = 0; - - // Completion of roaming - if (prAisBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED) { - -#if CFG_SUPPORT_ROAMING - //2. Deactivate previous BSS - aisFsmRoamingDisconnectPrevAP(prAdapter, prStaRec); - - //3. Update bss based on roaming staRec - aisUpdateBssInfoForRoamingAP(prAdapter, prStaRec, prAssocRspSwRfb); -#endif /* CFG_SUPPORT_ROAMING */ - } - else { - //4 <1.1> Change FW's Media State immediately. - aisChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED); - - //4 <1.2> Deactivate previous AP's STA_RECORD_T in Driver if have. - if ((prAisBssInfo->prStaRecOfAP) && - (prAisBssInfo->prStaRecOfAP != prStaRec) && - (prAisBssInfo->prStaRecOfAP->fgIsInUse)) { - - cnmStaRecChangeState(prAdapter, prAisBssInfo->prStaRecOfAP, STA_STATE_1); - } - - //4 <1.3> Update BSS_INFO_T - aisUpdateBssInfoForJOIN(prAdapter, prStaRec, prAssocRspSwRfb); - - //4 <1.4> Activate current AP's STA_RECORD_T in Driver. - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); - - //4 <1.5> Update RSSI if necessary - nicUpdateRSSI(prAdapter, NETWORK_TYPE_AIS_INDEX, (INT_8)(RCPI_TO_dBm(prStaRec->ucRCPI)), 0); - - //4 <1.6> Indicate Connected Event to Host immediately. - /* Require BSSID, Association ID, Beacon Interval.. from AIS_BSS_INFO_T */ - aisIndicationOfMediaStateToHost(prAdapter, PARAM_MEDIA_STATE_CONNECTED, FALSE); - } - -#if CFG_SUPPORT_ROAMING - roamingFsmRunEventStart(prAdapter); -#endif /* CFG_SUPPORT_ROAMING */ - - //4 <1.7> Set the Next State of AIS FSM - eNextState = AIS_STATE_NORMAL_TR; - } - //4 <2> JOIN was not successful - else { - //4 <2.1> Redo JOIN process with other Auth Type if possible - if (aisFsmStateInit_RetryJOIN(prAdapter, prStaRec) == FALSE) { - P_BSS_DESC_T prBssDesc; - - /* 1. Increase Failure Count */ - prStaRec->ucJoinFailureCount++; - - /* 2. release channel */ - aisFsmReleaseCh(prAdapter); - - /* 3.1 stop join timeout timer */ - cnmTimerStopTimer(prAdapter, &prAisFsmInfo->rJoinTimeoutTimer); - - /* 3.2 reset local variable */ - prAisFsmInfo->fgIsInfraChannelFinished = TRUE; - - prBssDesc = scanSearchBssDescByBssid(prAdapter, prStaRec->aucMacAddr); - - ASSERT(prBssDesc); - ASSERT(prBssDesc->fgIsConnecting); - - if(prBssDesc) { - prBssDesc->fgIsConnecting = FALSE; - } - - /* 3.3 Free STA-REC */ - if(prStaRec != prAisBssInfo->prStaRecOfAP) { - cnmStaRecFree(prAdapter, prStaRec, FALSE); - } - - if (prAisBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED) { -#if CFG_SUPPORT_ROAMING - eNextState = AIS_STATE_WAIT_FOR_NEXT_SCAN; -#endif /* CFG_SUPPORT_ROAMING */ - } - else { - /* 4. send reconnect request */ - aisFsmInsertRequest(prAdapter, AIS_REQUEST_RECONNECT); - - eNextState = AIS_STATE_IDLE; - } - } - } - } -#if DBG - else { - DBGLOG(AIS, WARN, ("SEQ NO of AIS JOIN COMP MSG is not matched.\n")); - } -#endif /* DBG */ - - } - - if (eNextState != prAisFsmInfo->eCurrentState) { - aisFsmSteps(prAdapter, eNextState); - } - - if (prAssocRspSwRfb) { - nicRxReturnRFB(prAdapter, prAssocRspSwRfb); - } - - cnmMemFree(prAdapter, prMsgHdr); - - return; -} /* end of aisFsmRunEventJoinComplete() */ - - -#if CFG_SUPPORT_ADHOC -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will handle the Grant Msg of IBSS Create which was sent by -* CNM to indicate that channel was changed for creating IBSS. -* -* @param[in] prAdapter Pointer of ADAPTER_T -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmCreateIBSS ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - - ASSERT(prAdapter); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - - do { - // Check State - if (prAisFsmInfo->eCurrentState == AIS_STATE_IBSS_ALONE) { - aisUpdateBssInfoForCreateIBSS(prAdapter); - } - } - while (FALSE); - - return; -} /* end of aisFsmCreateIBSS() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will handle the Grant Msg of IBSS Merge which was sent by -* CNM to indicate that channel was changed for merging IBSS. -* -* @param[in] prAdapter Pointer of ADAPTER_T -* @param[in] prStaRec Pointer of STA_RECORD_T for merge -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmMergeIBSS ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - ENUM_AIS_STATE_T eNextState; - P_BSS_INFO_T prAisBssInfo; - - ASSERT(prAdapter); - ASSERT(prStaRec); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - - do { - - eNextState = prAisFsmInfo->eCurrentState; - - switch (prAisFsmInfo->eCurrentState) { - case AIS_STATE_IBSS_MERGE: - { - P_BSS_DESC_T prBssDesc; - - //4 <1.1> Change FW's Media State immediately. - aisChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED); - - //4 <1.2> Deactivate previous Peers' STA_RECORD_T in Driver if have. - bssClearClientList(prAdapter, prAisBssInfo); - - //4 <1.3> Unmark connection flag of previous BSS_DESC_T. - if ((prBssDesc = scanSearchBssDescByBssid(prAdapter, prAisBssInfo->aucBSSID)) != NULL) { - prBssDesc->fgIsConnecting = FALSE; - prBssDesc->fgIsConnected = FALSE; - } - - //4 <1.4> Update BSS_INFO_T - aisUpdateBssInfoForMergeIBSS(prAdapter, prStaRec); - - //4 <1.5> Add Peers' STA_RECORD_T to Client List - bssAddStaRecToClientList(prAdapter, prAisBssInfo, prStaRec); - - //4 <1.6> Activate current Peer's STA_RECORD_T in Driver. - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); - prStaRec->fgIsMerging = FALSE; - - //4 <1.7> Enable other features - - //4 <1.8> Indicate Connected Event to Host immediately. - aisIndicationOfMediaStateToHost(prAdapter, PARAM_MEDIA_STATE_CONNECTED, FALSE); - - //4 <1.9> Set the Next State of AIS FSM - eNextState = AIS_STATE_NORMAL_TR; - - //4 <1.10> Release channel privilege - aisFsmReleaseCh(prAdapter); - -#if CFG_SLT_SUPPORT - prAdapter->rWifiVar.rSltInfo.prPseudoStaRec = prStaRec; -#endif - } - break; - - default: - break; - } - - if (eNextState != prAisFsmInfo->eCurrentState) { - aisFsmSteps(prAdapter, eNextState); - } - - } - while (FALSE); - - return; -} /* end of aisFsmMergeIBSS() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will handle the Notification of existing IBSS was found -* from SCN. -* -* @param[in] prMsgHdr Message of Notification of an IBSS was present. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmRunEventFoundIBSSPeer ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_AIS_IBSS_PEER_FOUND_T prAisIbssPeerFoundMsg; - P_AIS_FSM_INFO_T prAisFsmInfo; - ENUM_AIS_STATE_T eNextState; - P_STA_RECORD_T prStaRec; - P_BSS_INFO_T prAisBssInfo; - P_BSS_DESC_T prBssDesc; - BOOLEAN fgIsMergeIn; - - - ASSERT(prMsgHdr); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - - prAisIbssPeerFoundMsg = (P_MSG_AIS_IBSS_PEER_FOUND_T)prMsgHdr; - - ASSERT(prAisIbssPeerFoundMsg->ucNetTypeIndex == NETWORK_TYPE_AIS_INDEX); - - prStaRec = prAisIbssPeerFoundMsg->prStaRec; - ASSERT(prStaRec); - - fgIsMergeIn = prAisIbssPeerFoundMsg->fgIsMergeIn; - - cnmMemFree(prAdapter, prMsgHdr); - - - eNextState = prAisFsmInfo->eCurrentState; - switch (prAisFsmInfo->eCurrentState) { - case AIS_STATE_IBSS_ALONE: - { - //4 <1> An IBSS Peer 'merged in'. - if (fgIsMergeIn) { - - //4 <1.1> Change FW's Media State immediately. - aisChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED); - - //4 <1.2> Add Peers' STA_RECORD_T to Client List - bssAddStaRecToClientList(prAdapter, prAisBssInfo, prStaRec); - -#if CFG_SLT_SUPPORT - //4 <1.3> Mark connection flag of BSS_DESC_T. - if ((prBssDesc = scanSearchBssDescByTA(prAdapter, prStaRec->aucMacAddr)) != NULL) { - prBssDesc->fgIsConnecting = FALSE; - prBssDesc->fgIsConnected = TRUE; - } - else { - ASSERT(0); // Should be able to find a BSS_DESC_T here. - } - - //4 <1.4> Activate current Peer's STA_RECORD_T in Driver. - prStaRec->fgIsQoS = TRUE; /* TODO(Kevin): TBD */ -#else - //4 <1.3> Mark connection flag of BSS_DESC_T. - if ((prBssDesc = scanSearchBssDescByBssid(prAdapter, prAisBssInfo->aucBSSID)) != NULL) { - prBssDesc->fgIsConnecting = FALSE; - prBssDesc->fgIsConnected = TRUE; - } - else { - ASSERT(0); // Should be able to find a BSS_DESC_T here. - } - - - //4 <1.4> Activate current Peer's STA_RECORD_T in Driver. - prStaRec->fgIsQoS = FALSE; /* TODO(Kevin): TBD */ - -#endif - - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); - prStaRec->fgIsMerging = FALSE; - - //4 <1.6> sync. to firmware - nicUpdateBss(prAdapter, NETWORK_TYPE_AIS_INDEX); - - //4 <1.7> Indicate Connected Event to Host immediately. - aisIndicationOfMediaStateToHost(prAdapter, PARAM_MEDIA_STATE_CONNECTED, FALSE); - - //4 <1.8> indicate PM for connected - nicPmIndicateBssConnected(prAdapter, NETWORK_TYPE_AIS_INDEX); - - //4 <1.9> Set the Next State of AIS FSM - eNextState = AIS_STATE_NORMAL_TR; - - //4 <1.10> Release channel privilege - aisFsmReleaseCh(prAdapter); - } - //4 <2> We need 'merge out' to this IBSS - else { - - //4 <2.1> Get corresponding BSS_DESC_T - prBssDesc = scanSearchBssDescByTA(prAdapter, prStaRec->aucMacAddr); - - prAisFsmInfo->prTargetBssDesc = prBssDesc; - - //4 <2.2> Set the Next State of AIS FSM - eNextState = AIS_STATE_IBSS_MERGE; - } - } - break; - - case AIS_STATE_NORMAL_TR: - { - - //4 <3> An IBSS Peer 'merged in'. - if (fgIsMergeIn) { - - //4 <3.1> Add Peers' STA_RECORD_T to Client List - bssAddStaRecToClientList(prAdapter, prAisBssInfo, prStaRec); - -#if CFG_SLT_SUPPORT - //4 <3.2> Activate current Peer's STA_RECORD_T in Driver. - prStaRec->fgIsQoS = TRUE; /* TODO(Kevin): TBD */ -#else - //4 <3.2> Activate current Peer's STA_RECORD_T in Driver. - prStaRec->fgIsQoS = FALSE; /* TODO(Kevin): TBD */ -#endif - - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); - prStaRec->fgIsMerging = FALSE; - - } - //4 <4> We need 'merge out' to this IBSS - else { - - //4 <4.1> Get corresponding BSS_DESC_T - prBssDesc = scanSearchBssDescByTA(prAdapter, prStaRec->aucMacAddr); - - prAisFsmInfo->prTargetBssDesc = prBssDesc; - - //4 <4.2> Set the Next State of AIS FSM - eNextState = AIS_STATE_IBSS_MERGE; - - } - } - break; - - default: - break; - } - - if (eNextState != prAisFsmInfo->eCurrentState) { - aisFsmSteps(prAdapter, eNextState); - } - - return; -} /* end of aisFsmRunEventFoundIBSSPeer() */ -#endif /* CFG_SUPPORT_ADHOC */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indicate the Media State to HOST -* -* @param[in] eConnectionState Current Media State -* @param[in] fgDelayIndication Set TRUE for postponing the Disconnect Indication. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisIndicationOfMediaStateToHost ( - IN P_ADAPTER_T prAdapter, - ENUM_PARAM_MEDIA_STATE_T eConnectionState, - BOOLEAN fgDelayIndication - ) -{ - EVENT_CONNECTION_STATUS rEventConnStatus; - P_CONNECTION_SETTINGS_T prConnSettings; - P_BSS_INFO_T prAisBssInfo; - P_AIS_FSM_INFO_T prAisFsmInfo; - - DEBUGFUNC("aisIndicationOfMediaStateToHost()"); - - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - - // NOTE(Kevin): Move following line to aisChangeMediaState() macro per CM's request. - //prAisBssInfo->eConnectionState = eConnectionState; - - /* For indicating the Disconnect Event only if current media state is - * disconnected and we didn't do indication yet. - */ - if (prAisBssInfo->eConnectionState == PARAM_MEDIA_STATE_DISCONNECTED) { - if (prAisBssInfo->eConnectionStateIndicated == eConnectionState) { - return; - } - } - - if (!fgDelayIndication) { - //4 <0> Cancel Delay Timer - cnmTimerStopTimer(prAdapter, &prAisFsmInfo->rIndicationOfDisconnectTimer); - - //4 <1> Fill EVENT_CONNECTION_STATUS - rEventConnStatus.ucMediaStatus = (UINT_8)eConnectionState; - - if (eConnectionState == PARAM_MEDIA_STATE_CONNECTED) { - rEventConnStatus.ucReasonOfDisconnect = DISCONNECT_REASON_CODE_RESERVED; - - if (prAisBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE) { - rEventConnStatus.ucInfraMode = (UINT_8)NET_TYPE_INFRA; - rEventConnStatus.u2AID = prAisBssInfo->u2AssocId; - rEventConnStatus.u2ATIMWindow = 0; - } - else if (prAisBssInfo->eCurrentOPMode == OP_MODE_IBSS) { - rEventConnStatus.ucInfraMode = (UINT_8)NET_TYPE_IBSS; - rEventConnStatus.u2AID = 0; - rEventConnStatus.u2ATIMWindow = prAisBssInfo->u2ATIMWindow; - } - else { - ASSERT(0); - } - - COPY_SSID(rEventConnStatus.aucSsid, - rEventConnStatus.ucSsidLen, - prConnSettings->aucSSID, - prConnSettings->ucSSIDLen); - - COPY_MAC_ADDR(rEventConnStatus.aucBssid, prAisBssInfo->aucBSSID); - - rEventConnStatus.u2BeaconPeriod = prAisBssInfo->u2BeaconInterval; - rEventConnStatus.u4FreqInKHz = nicChannelNum2Freq(prAisBssInfo->ucPrimaryChannel); - - switch (prAisBssInfo->ucNonHTBasicPhyType) { - case PHY_TYPE_HR_DSSS_INDEX: - rEventConnStatus.ucNetworkType = (UINT_8)PARAM_NETWORK_TYPE_DS; - break; - - case PHY_TYPE_ERP_INDEX: - rEventConnStatus.ucNetworkType = (UINT_8)PARAM_NETWORK_TYPE_OFDM24; - break; - - case PHY_TYPE_OFDM_INDEX: - rEventConnStatus.ucNetworkType = (UINT_8)PARAM_NETWORK_TYPE_OFDM5; - break; - - default: - ASSERT(0); - rEventConnStatus.ucNetworkType = (UINT_8)PARAM_NETWORK_TYPE_DS; - break; - } - } - else { - /* Deactivate previous Peers' STA_RECORD_T in Driver if have. */ - bssClearClientList(prAdapter, prAisBssInfo); - - #if CFG_PRIVACY_MIGRATION - /* Clear the pmkid cache while media disconnect */ - secClearPmkid(prAdapter); - #endif - - rEventConnStatus.ucReasonOfDisconnect = prAisBssInfo->ucReasonOfDisconnect; - } - - //4 <2> Indication - nicMediaStateChange(prAdapter, NETWORK_TYPE_AIS_INDEX, &rEventConnStatus); - prAisBssInfo->eConnectionStateIndicated = eConnectionState; - } - else { - /* NOTE: Only delay the Indication of Disconnect Event */ - ASSERT(eConnectionState == PARAM_MEDIA_STATE_DISCONNECTED); - - DBGLOG(AIS, INFO, ("Postpone the indication of Disconnect for %d seconds\n", - prConnSettings->ucDelayTimeOfDisconnectEvent)); - - cnmTimerStartTimer(prAdapter, - &prAisFsmInfo->rIndicationOfDisconnectTimer, - SEC_TO_MSEC(prConnSettings->ucDelayTimeOfDisconnectEvent)); - } - - return; -} /* end of aisIndicationOfMediaStateToHost() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indicate an Event of "Media Disconnect" to HOST -* -* @param[in] u4Param Unused timer parameter -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisPostponedEventOfDisconnTimeout ( - IN P_ADAPTER_T prAdapter, - UINT_32 u4Param - ) -{ - P_BSS_INFO_T prAisBssInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - - - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - - //4 <1> Deactivate previous AP's STA_RECORD_T in Driver if have. - if (prAisBssInfo->prStaRecOfAP) { - //cnmStaRecChangeState(prAdapter, prAisBssInfo->prStaRecOfAP, STA_STATE_1); - - prAisBssInfo->prStaRecOfAP = (P_STA_RECORD_T)NULL; - } - - //4 <2> Remove pending connection request - aisFsmIsRequestPending(prAdapter, AIS_REQUEST_RECONNECT, TRUE); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - /* Set Connection Request Issued Flag */ - prConnSettings->fgIsConnReqIssued = FALSE; - - //4 <3> Indicate Disconnected Event to Host immediately. - aisIndicationOfMediaStateToHost(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED, FALSE); - - return; -} /* end of aisPostponedEventOfDisconnTimeout() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will update the contain of BSS_INFO_T for AIS network once -* the association was completed. -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] prAssocRspSwRfb Pointer to SW RFB of ASSOC RESP FRAME. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisUpdateBssInfoForJOIN ( - IN P_ADAPTER_T prAdapter, - P_STA_RECORD_T prStaRec, - P_SW_RFB_T prAssocRspSwRfb - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_BSS_INFO_T prAisBssInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - P_WLAN_ASSOC_RSP_FRAME_T prAssocRspFrame; - P_BSS_DESC_T prBssDesc; - UINT_16 u2IELength; - PUINT_8 pucIE; - - DEBUGFUNC("aisUpdateBssInfoForJOIN()"); - - ASSERT(prStaRec); - ASSERT(prAssocRspSwRfb); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - prAssocRspFrame = (P_WLAN_ASSOC_RSP_FRAME_T) prAssocRspSwRfb->pvHeader; - - - DBGLOG(AIS, INFO, ("Update AIS_BSS_INFO_T and apply settings to MAC\n")); - - - //3 <1> Update BSS_INFO_T from AIS_FSM_INFO_T or User Settings - //4 <1.1> Setup Operation Mode - prAisBssInfo->eCurrentOPMode = OP_MODE_INFRASTRUCTURE; - - //4 <1.2> Setup SSID - COPY_SSID(prAisBssInfo->aucSSID, - prAisBssInfo->ucSSIDLen, - prConnSettings->aucSSID, - prConnSettings->ucSSIDLen); - - //4 <1.3> Setup Channel, Band - prAisBssInfo->ucPrimaryChannel = prAisFsmInfo->prTargetBssDesc->ucChannelNum; - prAisBssInfo->eBand = prAisFsmInfo->prTargetBssDesc->eBand; - - - //3 <2> Update BSS_INFO_T from STA_RECORD_T - //4 <2.1> Save current AP's STA_RECORD_T and current AID - prAisBssInfo->prStaRecOfAP = prStaRec; - prAisBssInfo->u2AssocId = prStaRec->u2AssocId; - - //4 <2.2> Setup Capability - prAisBssInfo->u2CapInfo = prStaRec->u2CapInfo; /* Use AP's Cap Info as BSS Cap Info */ - - if (prAisBssInfo->u2CapInfo & CAP_INFO_SHORT_PREAMBLE) { - prAisBssInfo->fgIsShortPreambleAllowed = TRUE; - } - else { - prAisBssInfo->fgIsShortPreambleAllowed = FALSE; - } - - //4 <2.3> Setup PHY Attributes and Basic Rate Set/Operational Rate Set - prAisBssInfo->ucPhyTypeSet = prStaRec->ucDesiredPhyTypeSet; - - prAisBssInfo->ucNonHTBasicPhyType = prStaRec->ucNonHTBasicPhyType; - - prAisBssInfo->u2OperationalRateSet = prStaRec->u2OperationalRateSet; - prAisBssInfo->u2BSSBasicRateSet = prStaRec->u2BSSBasicRateSet; - - - //3 <3> Update BSS_INFO_T from SW_RFB_T (Association Resp Frame) - //4 <3.1> Setup BSSID - COPY_MAC_ADDR(prAisBssInfo->aucBSSID, prAssocRspFrame->aucBSSID); - - - u2IELength = (UINT_16) ((prAssocRspSwRfb->u2PacketLen - prAssocRspSwRfb->u2HeaderLen) - - (OFFSET_OF(WLAN_ASSOC_RSP_FRAME_T, aucInfoElem[0]) - WLAN_MAC_MGMT_HEADER_LEN)); - pucIE = prAssocRspFrame->aucInfoElem; - - - //4 <3.2> Parse WMM and setup QBSS flag - /* Parse WMM related IEs and configure HW CRs accordingly */ - mqmProcessAssocRsp(prAdapter, prAssocRspSwRfb, pucIE, u2IELength); - - prAisBssInfo->fgIsQBSS = prStaRec->fgIsQoS; - - //3 <4> Update BSS_INFO_T from BSS_DESC_T - prBssDesc = scanSearchBssDescByBssid(prAdapter, prAssocRspFrame->aucBSSID); - if(prBssDesc) { - prBssDesc->fgIsConnecting = FALSE; - prBssDesc->fgIsConnected = TRUE; - - //4 <4.1> Setup MIB for current BSS - prAisBssInfo->u2BeaconInterval = prBssDesc->u2BeaconInterval; - } - else { - // should never happen - ASSERT(0); - } - - /* NOTE: Defer ucDTIMPeriod updating to when beacon is received after connection */ - prAisBssInfo->ucDTIMPeriod = 0; - prAisBssInfo->u2ATIMWindow = 0; - - prAisBssInfo->ucBeaconTimeoutCount = AIS_BEACON_TIMEOUT_COUNT_INFRA; - - //4 <4.2> Update HT information and set channel - /* Record HT related parameters in rStaRec and rBssInfo - * Note: it shall be called before nicUpdateBss() - */ - rlmProcessAssocRsp(prAdapter, prAssocRspSwRfb, pucIE, u2IELength); - - //4 <4.3> Sync with firmware for BSS-INFO - nicUpdateBss(prAdapter, NETWORK_TYPE_AIS_INDEX); - - //4 <4.4> *DEFER OPERATION* nicPmIndicateBssConnected() will be invoked - //inside scanProcessBeaconAndProbeResp() after 1st beacon is received - - return; -} /* end of aisUpdateBssInfoForJOIN() */ - - -#if CFG_SUPPORT_ADHOC -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will create an Ad-Hoc network and start sending Beacon Frames. -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisUpdateBssInfoForCreateIBSS ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_BSS_INFO_T prAisBssInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - if (prAisBssInfo->fgIsBeaconActivated) { - return; - } - - //3 <1> Update BSS_INFO_T per Network Basis - //4 <1.1> Setup Operation Mode - prAisBssInfo->eCurrentOPMode = OP_MODE_IBSS; - - //4 <1.2> Setup SSID - COPY_SSID(prAisBssInfo->aucSSID, - prAisBssInfo->ucSSIDLen, - prConnSettings->aucSSID, - prConnSettings->ucSSIDLen); - - //4 <1.3> Clear current AP's STA_RECORD_T and current AID - prAisBssInfo->prStaRecOfAP = (P_STA_RECORD_T)NULL; - prAisBssInfo->u2AssocId = 0; - - //4 <1.4> Setup Channel, Band and Phy Attributes - prAisBssInfo->ucPrimaryChannel = prConnSettings->ucAdHocChannelNum; - prAisBssInfo->eBand = prConnSettings->eAdHocBand; - - if (prAisBssInfo->eBand == BAND_2G4) { - - prAisBssInfo->ucPhyTypeSet = - prAdapter->rWifiVar.ucAvailablePhyTypeSet & PHY_TYPE_SET_802_11BGN; /* Depend on eBand */ - - prAisBssInfo->ucConfigAdHocAPMode = AD_HOC_MODE_MIXED_11BG; /* Depend on eCurrentOPMode and ucPhyTypeSet */ - } - else { - - prAisBssInfo->ucPhyTypeSet = - prAdapter->rWifiVar.ucAvailablePhyTypeSet & PHY_TYPE_SET_802_11AN; /* Depend on eBand */ - - prAisBssInfo->ucConfigAdHocAPMode = AD_HOC_MODE_11A; /* Depend on eCurrentOPMode and ucPhyTypeSet */ - } - - //4 <1.5> Setup MIB for current BSS - prAisBssInfo->u2BeaconInterval = prConnSettings->u2BeaconPeriod; - prAisBssInfo->ucDTIMPeriod = 0; - prAisBssInfo->u2ATIMWindow = prConnSettings->u2AtimWindow; - - prAisBssInfo->ucBeaconTimeoutCount = AIS_BEACON_TIMEOUT_COUNT_ADHOC; - -#if CFG_PRIVACY_MIGRATION - if (prConnSettings->eEncStatus == ENUM_ENCRYPTION1_ENABLED || - prConnSettings->eEncStatus == ENUM_ENCRYPTION2_ENABLED || - prConnSettings->eEncStatus == ENUM_ENCRYPTION3_ENABLED) { - prAisBssInfo->fgIsProtection = TRUE; - } - else { - prAisBssInfo->fgIsProtection = FALSE; - } -#else - prAisBssInfo->fgIsProtection = FALSE; -#endif - - //3 <2> Update BSS_INFO_T common part - ibssInitForAdHoc(prAdapter, prAisBssInfo); - - - - //3 <3> Set MAC HW - //4 <3.1> Setup channel and bandwidth - rlmBssInitForAPandIbss(prAdapter, prAisBssInfo); - - //4 <3.2> use command packets to inform firmware - nicUpdateBss(prAdapter, NETWORK_TYPE_AIS_INDEX); - - //4 <3.3> enable beaconing - bssUpdateBeaconContent(prAdapter, NETWORK_TYPE_AIS_INDEX); - - //4 <3.4> Update AdHoc PM parameter - nicPmIndicateBssCreated(prAdapter, NETWORK_TYPE_AIS_INDEX); - - //3 <4> Set ACTIVE flag. - prAisBssInfo->fgIsBeaconActivated = TRUE; - prAisBssInfo->fgHoldSameBssidForIBSS = TRUE; - - //3 <5> Start IBSS Alone Timer - cnmTimerStartTimer(prAdapter, - &prAisFsmInfo->rIbssAloneTimer, - SEC_TO_MSEC(AIS_IBSS_ALONE_TIMEOUT_SEC)); - - return; - -} /* end of aisCreateIBSS() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will update the contain of BSS_INFO_T for AIS network once -* the existing IBSS was found. -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisUpdateBssInfoForMergeIBSS ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_BSS_INFO_T prAisBssInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - P_BSS_DESC_T prBssDesc; - //UINT_16 u2IELength; - //PUINT_8 pucIE; - - - ASSERT(prStaRec); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - cnmTimerStopTimer(prAdapter, &prAisFsmInfo->rIbssAloneTimer); - - if (!prAisBssInfo->fgIsBeaconActivated) { - - //3 <1> Update BSS_INFO_T per Network Basis - //4 <1.1> Setup Operation Mode - prAisBssInfo->eCurrentOPMode = OP_MODE_IBSS; - - //4 <1.2> Setup SSID - COPY_SSID(prAisBssInfo->aucSSID, - prAisBssInfo->ucSSIDLen, - prConnSettings->aucSSID, - prConnSettings->ucSSIDLen); - - //4 <1.3> Clear current AP's STA_RECORD_T and current AID - prAisBssInfo->prStaRecOfAP = (P_STA_RECORD_T)NULL; - prAisBssInfo->u2AssocId = 0; - } - - //3 <2> Update BSS_INFO_T from STA_RECORD_T - //4 <2.1> Setup Capability - prAisBssInfo->u2CapInfo = prStaRec->u2CapInfo; /* Use Peer's Cap Info as IBSS Cap Info */ - - if (prAisBssInfo->u2CapInfo & CAP_INFO_SHORT_PREAMBLE) { - prAisBssInfo->fgIsShortPreambleAllowed = TRUE; - prAisBssInfo->fgUseShortPreamble = TRUE; - } - else { - prAisBssInfo->fgIsShortPreambleAllowed = FALSE; - prAisBssInfo->fgUseShortPreamble = FALSE; - } - - // 7.3.1.4 For IBSS, the Short Slot Time subfield shall be set to 0. - prAisBssInfo->fgUseShortSlotTime = FALSE; /* Set to FALSE for AdHoc */ - prAisBssInfo->u2CapInfo &= ~CAP_INFO_SHORT_SLOT_TIME; - - if (prAisBssInfo->u2CapInfo & CAP_INFO_PRIVACY) { - prAisBssInfo->fgIsProtection= TRUE; - } - else { - prAisBssInfo->fgIsProtection = FALSE; - } - - //4 <2.2> Setup PHY Attributes and Basic Rate Set/Operational Rate Set - prAisBssInfo->ucPhyTypeSet = prStaRec->ucDesiredPhyTypeSet; - - prAisBssInfo->ucNonHTBasicPhyType = prStaRec->ucNonHTBasicPhyType; - - prAisBssInfo->u2OperationalRateSet = prStaRec->u2OperationalRateSet; - prAisBssInfo->u2BSSBasicRateSet = prStaRec->u2BSSBasicRateSet; - - rateGetDataRatesFromRateSet(prAisBssInfo->u2OperationalRateSet, - prAisBssInfo->u2BSSBasicRateSet, - prAisBssInfo->aucAllSupportedRates, - &prAisBssInfo->ucAllSupportedRatesLen); - - //3 <3> X Update BSS_INFO_T from SW_RFB_T (Association Resp Frame) - - - //3 <4> Update BSS_INFO_T from BSS_DESC_T - prBssDesc = scanSearchBssDescByTA(prAdapter, prStaRec->aucMacAddr); - if(prBssDesc) { - prBssDesc->fgIsConnecting = FALSE; - prBssDesc->fgIsConnected = TRUE; - - //4 <4.1> Setup BSSID - COPY_MAC_ADDR(prAisBssInfo->aucBSSID, prBssDesc->aucBSSID); - - //4 <4.2> Setup Channel, Band - prAisBssInfo->ucPrimaryChannel = prBssDesc->ucChannelNum; - prAisBssInfo->eBand = prBssDesc->eBand; - - //4 <4.3> Setup MIB for current BSS - prAisBssInfo->u2BeaconInterval = prBssDesc->u2BeaconInterval; - prAisBssInfo->ucDTIMPeriod = 0; - prAisBssInfo->u2ATIMWindow = 0; /* TBD(Kevin) */ - - prAisBssInfo->ucBeaconTimeoutCount = AIS_BEACON_TIMEOUT_COUNT_ADHOC; - } - else { - // should never happen - ASSERT(0); - } - - - //3 <5> Set MAC HW - //4 <5.1> Find Lowest Basic Rate Index for default TX Rate of MMPDU - { - UINT_8 ucLowestBasicRateIndex; - - if (!rateGetLowestRateIndexFromRateSet(prAisBssInfo->u2BSSBasicRateSet, - &ucLowestBasicRateIndex)) { - - if (prAisBssInfo->ucPhyTypeSet & PHY_TYPE_BIT_OFDM) { - ucLowestBasicRateIndex = RATE_6M_INDEX; - } - else { - ucLowestBasicRateIndex = RATE_1M_INDEX; - } - } - - prAisBssInfo->ucHwDefaultFixedRateCode = - aucRateIndex2RateCode[prAisBssInfo->fgUseShortPreamble][ucLowestBasicRateIndex]; - } - - //4 <5.2> Setup channel and bandwidth - rlmBssInitForAPandIbss(prAdapter, prAisBssInfo); - - //4 <5.3> use command packets to inform firmware - nicUpdateBss(prAdapter, NETWORK_TYPE_AIS_INDEX); - - //4 <5.4> enable beaconing - bssUpdateBeaconContent(prAdapter, NETWORK_TYPE_AIS_INDEX); - - //4 <5.5> Update AdHoc PM parameter - nicPmIndicateBssConnected(prAdapter, NETWORK_TYPE_AIS_INDEX); - - //3 <6> Set ACTIVE flag. - prAisBssInfo->fgIsBeaconActivated = TRUE; - prAisBssInfo->fgHoldSameBssidForIBSS = TRUE; - - return; -} /* end of aisUpdateBssInfoForMergeIBSS() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will validate the Rx Probe Request Frame and then return -* result to BSS to indicate if need to send the corresponding Probe Response -* Frame if the specified conditions were matched. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[out] pu4ControlFlags Control flags for replying the Probe Response -* -* @retval TRUE Reply the Probe Response -* @retval FALSE Don't reply the Probe Response -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -aisValidateProbeReq ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_32 pu4ControlFlags - ) -{ - P_WLAN_MAC_MGMT_HEADER_T prMgtHdr; - P_BSS_INFO_T prBssInfo; - P_IE_SSID_T prIeSsid = (P_IE_SSID_T)NULL; - PUINT_8 pucIE; - UINT_16 u2IELength; - UINT_16 u2Offset = 0; - BOOLEAN fgReplyProbeResp = FALSE; - - - ASSERT(prSwRfb); - ASSERT(pu4ControlFlags); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - - //4 <1> Parse Probe Req IE and Get IE ptr (SSID, Supported Rate IE, ...) - prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)prSwRfb->pvHeader; - - u2IELength = prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen; - pucIE = (PUINT_8)((UINT_32)prSwRfb->pvHeader + prSwRfb->u2HeaderLen); - - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - if (ELEM_ID_SSID == IE_ID(pucIE)) { - if ((!prIeSsid) && - (IE_LEN(pucIE) <= ELEM_MAX_LEN_SSID)) { - prIeSsid = (P_IE_SSID_T)pucIE; - } - break; - } - } /* end of IE_FOR_EACH */ - - //4 <2> Check network conditions - - if (prBssInfo->eCurrentOPMode == OP_MODE_IBSS) { - - if ((prIeSsid) && - ((prIeSsid->ucLength == BC_SSID_LEN) || /* WILDCARD SSID */ - EQUAL_SSID(prBssInfo->aucSSID, prBssInfo->ucSSIDLen, /* CURRENT SSID */ - prIeSsid->aucSSID, prIeSsid->ucLength)) ) { - fgReplyProbeResp = TRUE; - } - } - - return fgReplyProbeResp; - -} /* end of aisValidateProbeReq() */ - -#endif /* CFG_SUPPORT_ADHOC */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will modify and update necessary information to firmware -* for disconnection handling -* -* @param[in] prAdapter Pointer to the Adapter structure. -* -* @retval None -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmDisconnect ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgDelayIndication - ) -{ - P_BSS_INFO_T prAisBssInfo; - - ASSERT(prAdapter); - - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - - nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_AIS_INDEX); - -#if CFG_SUPPORT_ADHOC - if (prAisBssInfo->fgIsBeaconActivated) { - nicUpdateBeaconIETemplate(prAdapter, - IE_UPD_METHOD_DELETE_ALL, - NETWORK_TYPE_AIS_INDEX, - 0, - NULL, - 0); - - prAisBssInfo->fgIsBeaconActivated = FALSE; - } -#endif - - rlmBssAborted(prAdapter, prAisBssInfo); - - //4 <3> Unset the fgIsConnected flag of BSS_DESC_T and send Deauth if needed. - if (PARAM_MEDIA_STATE_CONNECTED == prAisBssInfo->eConnectionState) { - - if (prAisBssInfo->ucReasonOfDisconnect == DISCONNECT_REASON_CODE_RADIO_LOST) { - scanRemoveBssDescByBssid(prAdapter, prAisBssInfo->aucBSSID); - - /* remove from scanning results as well */ - wlanClearBssInScanningResult(prAdapter, prAisBssInfo->aucBSSID); - - /* trials for re-association */ - if (fgDelayIndication) { - aisFsmIsRequestPending(prAdapter, AIS_REQUEST_RECONNECT, TRUE); - aisFsmInsertRequest(prAdapter, AIS_REQUEST_RECONNECT); - } - } - else { - scanRemoveConnFlagOfBssDescByBssid(prAdapter, prAisBssInfo->aucBSSID); - } - - if (fgDelayIndication) { - if (OP_MODE_IBSS != prAisBssInfo->eCurrentOPMode) { - prAisBssInfo->fgHoldSameBssidForIBSS = FALSE; - } - } - else { - prAisBssInfo->fgHoldSameBssidForIBSS = FALSE; - } - } - else { - prAisBssInfo->fgHoldSameBssidForIBSS = FALSE; - } - - - //4 <4> Change Media State immediately. - aisChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED); - - //4 <4.1> sync. with firmware - nicUpdateBss(prAdapter, NETWORK_TYPE_AIS_INDEX); - - if (!fgDelayIndication) { - //4 <5> Deactivate previous AP's STA_RECORD_T or all Clients in Driver if have. - if (prAisBssInfo->prStaRecOfAP) { - //cnmStaRecChangeState(prAdapter, prAisBssInfo->prStaRecOfAP, STA_STATE_1); - - prAisBssInfo->prStaRecOfAP = (P_STA_RECORD_T)NULL; - } - } - -#if CFG_SUPPORT_ROAMING - roamingFsmRunEventAbort(prAdapter); - - /* clear pending roaming connection request */ - aisFsmIsRequestPending(prAdapter, AIS_REQUEST_ROAMING_SEARCH, TRUE); - aisFsmIsRequestPending(prAdapter, AIS_REQUEST_ROAMING_CONNECT, TRUE); -#endif /* CFG_SUPPORT_ROAMING */ - - //4 <6> Indicate Disconnected Event to Host - aisIndicationOfMediaStateToHost(prAdapter, - PARAM_MEDIA_STATE_DISCONNECTED, - fgDelayIndication); - - - //4 <7> Trigger AIS FSM - aisFsmSteps(prAdapter, AIS_STATE_IDLE); - - return; -} /* end of aisFsmDisconnect() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indicate an Event of "Background Scan Time-Out" to AIS FSM. -* -* @param[in] u4Param Unused timer parameter -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmRunEventBGSleepTimeOut ( - IN P_ADAPTER_T prAdapter, - UINT_32 u4Param - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - ENUM_AIS_STATE_T eNextState; - - DEBUGFUNC("aisFsmRunEventBGSleepTimeOut()"); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - - eNextState = prAisFsmInfo->eCurrentState; - - switch (prAisFsmInfo->eCurrentState) { - case AIS_STATE_WAIT_FOR_NEXT_SCAN: - DBGLOG(AIS, LOUD, ("EVENT - SCAN TIMER: Idle End - Current Time = %ld\n", kalGetTimeTick())); - - eNextState = AIS_STATE_LOOKING_FOR; - - SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_AIS_INDEX); - - break; - - default: - break; - } - - /* Call aisFsmSteps() when we are going to change AIS STATE */ - if (eNextState != prAisFsmInfo->eCurrentState) { - aisFsmSteps(prAdapter, eNextState); - } - - return; -} /* end of aisFsmBGSleepTimeout() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indicate an Event of "IBSS ALONE Time-Out" to AIS FSM. -* -* @param[in] u4Param Unused timer parameter -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmRunEventIbssAloneTimeOut ( - IN P_ADAPTER_T prAdapter, - UINT_32 u4Param - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - ENUM_AIS_STATE_T eNextState; - - DEBUGFUNC("aisFsmRunEventIbssAloneTimeOut()"); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - eNextState = prAisFsmInfo->eCurrentState; - - switch(prAisFsmInfo->eCurrentState) { - case AIS_STATE_IBSS_ALONE: - - /* There is no one participate in our AdHoc during this TIMEOUT Interval - * so go back to search for a valid IBSS again. - */ - - DBGLOG(AIS, LOUD, ("EVENT-IBSS ALONE TIMER: Start pairing\n")); - - prAisFsmInfo->fgTryScan = TRUE; - - /* abort timer */ - aisFsmReleaseCh(prAdapter); - - /* Pull back to SEARCH to find candidate again */ - eNextState = AIS_STATE_SEARCH; - - break; - - default: - break; - } - - - /* Call aisFsmSteps() when we are going to change AIS STATE */ - if (eNextState != prAisFsmInfo->eCurrentState) { - aisFsmSteps(prAdapter, eNextState); - } - - return; -} /* end of aisIbssAloneTimeOut() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indicate an Event of "Join Time-Out" to AIS FSM. -* -* @param[in] u4Param Unused timer parameter -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmRunEventJoinTimeout ( - IN P_ADAPTER_T prAdapter, - UINT_32 u4Param - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - ENUM_AIS_STATE_T eNextState; - - DEBUGFUNC("aisFsmRunEventJoinTimeout()"); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - eNextState = prAisFsmInfo->eCurrentState; - - switch(prAisFsmInfo->eCurrentState) { - case AIS_STATE_JOIN: - DBGLOG(AIS, LOUD, ("EVENT- JOIN TIMEOUT\n")); - - /* 1. Do abort JOIN */ - aisFsmStateAbort_JOIN(prAdapter); - - /* 2. Increase Join Failure Count */ - prAisFsmInfo->prTargetStaRec->ucJoinFailureCount++; - - if(prAisFsmInfo->prTargetStaRec->ucJoinFailureCount < JOIN_MAX_RETRY_FAILURE_COUNT) { - /* 3.1 Retreat to AIS_STATE_SEARCH state for next try */ - eNextState = AIS_STATE_SEARCH; - } - else { - /* 3.2 Retreat to AIS_STATE_WAIT_FOR_NEXT_SCAN state for next try */ - eNextState = AIS_STATE_WAIT_FOR_NEXT_SCAN; - } - break; - - case AIS_STATE_NORMAL_TR: - /* 1. release channel */ - aisFsmReleaseCh(prAdapter); - prAisFsmInfo->fgIsInfraChannelFinished = TRUE; - - /* 2. process if there is pending scan */ - if(aisFsmIsRequestPending(prAdapter, AIS_REQUEST_SCAN, TRUE) == TRUE) { - wlanClearScanningResult(prAdapter); - eNextState = AIS_STATE_ONLINE_SCAN; - } - - break; - - default: - /* release channel */ - aisFsmReleaseCh(prAdapter); - break; - - } - - - /* Call aisFsmSteps() when we are going to change AIS STATE */ - if (eNextState != prAisFsmInfo->eCurrentState) { - aisFsmSteps(prAdapter, eNextState); - } - - return; -} /* end of aisFsmRunEventJoinTimeout() */ - - -#if defined(CFG_TEST_MGMT_FSM) && (CFG_TEST_MGMT_FSM != 0) -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisTest ( - VOID - ) -{ - P_MSG_AIS_ABORT_T prAisAbortMsg; - P_CONNECTION_SETTINGS_T prConnSettings; - UINT_8 aucSSID[]="pci-11n"; - UINT_8 ucSSIDLen=7; - - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - /* Set Connection Request Issued Flag */ - prConnSettings->fgIsConnReqIssued = TRUE; - prConnSettings->ucSSIDLen = ucSSIDLen; - kalMemCopy(prConnSettings->aucSSID, aucSSID, ucSSIDLen); - - prAisAbortMsg = (P_MSG_AIS_ABORT_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_AIS_ABORT_T)); - if (!prAisAbortMsg) { - - ASSERT(0); // Can't trigger SCAN FSM - return; - } - - prAisAbortMsg->rMsgHdr.eMsgId = MID_HEM_AIS_FSM_ABORT; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prAisAbortMsg, - MSG_SEND_METHOD_BUF); - - wifi_send_msg(INDX_WIFI, MSG_ID_WIFI_IST, 0); - - return; -} -#endif /* CFG_TEST_MGMT_FSM */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is used to handle OID_802_11_BSSID_LIST_SCAN -* -* \param[in] prAdapter Pointer of ADAPTER_T -* \param[in] prSsid Pointer of SSID_T if specified -* \param[in] pucIe Pointer to buffer of extra information elements to be attached -* \param[in] u4IeLength Length of information elements -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmScanRequest ( - IN P_ADAPTER_T prAdapter, - IN P_PARAM_SSID_T prSsid, - IN PUINT_8 pucIe, - IN UINT_32 u4IeLength - ) -{ - P_CONNECTION_SETTINGS_T prConnSettings; - P_BSS_INFO_T prAisBssInfo; - P_AIS_FSM_INFO_T prAisFsmInfo; - - DEBUGFUNC("aisFsmScanRequest()"); - - ASSERT(prAdapter); - ASSERT(u4IeLength <= MAX_IE_LENGTH); - - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - if (!prConnSettings->fgIsScanReqIssued) { - prConnSettings->fgIsScanReqIssued = TRUE; - - if(prSsid == NULL) { - prAisFsmInfo->ucScanSSIDLen = 0; - } - else { - COPY_SSID(prAisFsmInfo->aucScanSSID, - prAisFsmInfo->ucScanSSIDLen, - prSsid->aucSsid, - (UINT_8)prSsid->u4SsidLen); - } - - if(u4IeLength > 0 && u4IeLength <= MAX_IE_LENGTH ) { - prAisFsmInfo->u4ScanIELength = u4IeLength; - if(NULL != pucIe) - kalMemCopy(prAisFsmInfo->aucScanIEBuf, pucIe, u4IeLength); - DBGLOG(AIS, WARN, ("u4IeLength in aisFsmScanRequest is: %d\n",u4IeLength)); - } - else { - prAisFsmInfo->u4ScanIELength = 0; - } - - if(prAisFsmInfo->eCurrentState == AIS_STATE_NORMAL_TR) { - if(prAisBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE - && prAisFsmInfo->fgIsInfraChannelFinished == FALSE) { - // 802.1x might not finished yet, pend it for later handling .. - aisFsmInsertRequest(prAdapter, AIS_REQUEST_SCAN); - } - else { - if(prAisFsmInfo->fgIsChannelGranted == TRUE) { - DBGLOG(AIS, WARN, ("Scan Request with channel granted for join operation: %d, %d", - prAisFsmInfo->fgIsChannelGranted, - prAisFsmInfo->fgIsChannelRequested)); - } - - /* start online scan */ - wlanClearScanningResult(prAdapter); - aisFsmSteps(prAdapter, AIS_STATE_ONLINE_SCAN); - } - } - else if(prAisFsmInfo->eCurrentState == AIS_STATE_IDLE) { - wlanClearScanningResult(prAdapter); - aisFsmSteps(prAdapter, AIS_STATE_SCAN); - } - else { - aisFsmInsertRequest(prAdapter, AIS_REQUEST_SCAN); - } - } - else { - DBGLOG(AIS, WARN, ("Scan Request dropped. (state: %d)\n", prAisFsmInfo->eCurrentState)); - } - - return; -} /* end of aisFsmScanRequest() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is invoked when CNM granted channel privilege -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmRunEventChGrant ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_BSS_INFO_T prAisBssInfo; - P_AIS_FSM_INFO_T prAisFsmInfo; - P_MSG_CH_GRANT_T prMsgChGrant; - UINT_8 ucTokenID; - UINT_32 u4GrantInterval; - - ASSERT(prAdapter); - ASSERT(prMsgHdr); - - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prMsgChGrant = (P_MSG_CH_GRANT_T)prMsgHdr; - - ucTokenID = prMsgChGrant->ucTokenID; - u4GrantInterval = prMsgChGrant->u4GrantInterval; - - /* 1. free message */ - cnmMemFree(prAdapter, prMsgHdr); - - if(prAisFsmInfo->eCurrentState == AIS_STATE_REQ_CHANNEL_JOIN && - prAisFsmInfo->ucSeqNumOfChReq == ucTokenID) { - /* 2. channel privilege has been approved */ - prAisFsmInfo->u4ChGrantedInterval = u4GrantInterval; - - /* 3. state transition to join/ibss-alone/ibss-merge */ - /* 3.1 set timeout timer in cases join could not be completed */ - cnmTimerStartTimer(prAdapter, - &prAisFsmInfo->rJoinTimeoutTimer, - prAisFsmInfo->u4ChGrantedInterval - AIS_JOIN_CH_GRANT_THRESHOLD); - /* 3.2 set local variable to indicate join timer is ticking */ - prAisFsmInfo->fgIsInfraChannelFinished = FALSE; - - /* 3.3 switch to join state */ - aisFsmSteps(prAdapter, AIS_STATE_JOIN); - - prAisFsmInfo->fgIsChannelGranted = TRUE; - } - else { /* mismatched grant */ - /* 2. return channel privilege to CNM immediately */ - aisFsmReleaseCh(prAdapter); - } - - return; -} /* end of aisFsmRunEventChGrant() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is to inform CNM that channel privilege -* has been released -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmReleaseCh ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_MSG_CH_ABORT_T prMsgChAbort; - - ASSERT(prAdapter); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - - if(prAisFsmInfo->fgIsChannelGranted == TRUE - || prAisFsmInfo->fgIsChannelRequested == TRUE) { - - prAisFsmInfo->fgIsChannelRequested = FALSE; - prAisFsmInfo->fgIsChannelGranted = FALSE; - - /* 1. return channel privilege to CNM immediately */ - prMsgChAbort = (P_MSG_CH_ABORT_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_CH_ABORT_T)); - if (!prMsgChAbort) { - ASSERT(0); // Can't release Channel to CNM - return; - } - - prMsgChAbort->rMsgHdr.eMsgId = MID_MNY_CNM_CH_ABORT; - prMsgChAbort->ucNetTypeIndex = NETWORK_TYPE_AIS_INDEX; - prMsgChAbort->ucTokenID = prAisFsmInfo->ucSeqNumOfChReq; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prMsgChAbort, - MSG_SEND_METHOD_BUF); - } - - return; -} /* end of aisFsmReleaseCh() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is to inform AIS that corresponding beacon has not -* been received for a while and probing is not successful -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisBssBeaconTimeout ( - IN P_ADAPTER_T prAdapter - ) -{ - P_BSS_INFO_T prAisBssInfo; - BOOLEAN fgDoAbortIndication = FALSE; - - ASSERT(prAdapter); - - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - - //4 <1> Diagnose Connection for Beacon Timeout Event - if (PARAM_MEDIA_STATE_CONNECTED == prAisBssInfo->eConnectionState) { - if (OP_MODE_INFRASTRUCTURE == prAisBssInfo->eCurrentOPMode) { - P_STA_RECORD_T prStaRec = prAisBssInfo->prStaRecOfAP; - - if (prStaRec) { - fgDoAbortIndication = TRUE; - } - } - else if (OP_MODE_IBSS == prAisBssInfo->eCurrentOPMode) { - fgDoAbortIndication = TRUE; - } - } - - //4 <2> invoke abort handler - if (fgDoAbortIndication) { - aisFsmStateAbort(prAdapter, DISCONNECT_REASON_CODE_RADIO_LOST, TRUE); - } - - return; -} /* end of aisBssBeaconTimeout() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is to inform AIS that DEAUTH frame has been -* sent and thus state machine could go ahead -* -* \param[in] prAdapter Pointer of ADAPTER_T -* \param[in] prMsduInfo Pointer of MSDU_INFO_T for DEAUTH frame -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -aisDeauthXmitComplete ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - - ASSERT(prAdapter); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - - if(prAisFsmInfo->eCurrentState == AIS_STATE_DISCONNECTING) { - if(rTxDoneStatus != TX_RESULT_DROPPED_IN_DRIVER) { - aisFsmStateAbort(prAdapter, DISCONNECT_REASON_CODE_NEW_CONNECTION, FALSE); - } - } - else { - DBGLOG(AIS, WARN, ("DEAUTH frame transmitted without further handling")); - } - - return WLAN_STATUS_SUCCESS; - -} /* end of aisDeauthXmitComplete() */ - -#if CFG_SUPPORT_ROAMING -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indicate an Event of "Looking for a candidate due to weak signal" to AIS FSM. -* -* @param[in] u4ReqScan Requesting Scan or not -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmRunEventRoamingDiscovery ( - IN P_ADAPTER_T prAdapter, - UINT_32 u4ReqScan - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - ENUM_AIS_REQUEST_TYPE_T eAisRequest; - - DBGLOG(AIS, LOUD, ("aisFsmRunEventRoamingDiscovery()\n")); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - /* search candidates by best rssi */ - prConnSettings->eConnectionPolicy = CONNECT_BY_SSID_BEST_RSSI; - - /* results are still new */ - if (!u4ReqScan) { - roamingFsmRunEventRoam(prAdapter); - eAisRequest = AIS_REQUEST_ROAMING_CONNECT; - } - else { - if(prAisFsmInfo->eCurrentState == AIS_STATE_ONLINE_SCAN - || prAisFsmInfo->eCurrentState == AIS_STATE_LOOKING_FOR) { - eAisRequest = AIS_REQUEST_ROAMING_CONNECT; - } - else { - eAisRequest = AIS_REQUEST_ROAMING_SEARCH; - } - } - - if(prAisFsmInfo->eCurrentState == AIS_STATE_NORMAL_TR && prAisFsmInfo->fgIsInfraChannelFinished == TRUE) { - if(eAisRequest == AIS_REQUEST_ROAMING_SEARCH) { - aisFsmSteps(prAdapter, AIS_STATE_LOOKING_FOR); - } - else { - aisFsmSteps(prAdapter, AIS_STATE_SEARCH); - } - } - else { - aisFsmIsRequestPending(prAdapter, AIS_REQUEST_ROAMING_SEARCH, TRUE); - aisFsmIsRequestPending(prAdapter, AIS_REQUEST_ROAMING_CONNECT, TRUE); - - aisFsmInsertRequest(prAdapter, eAisRequest); - } - - return; -} /* end of aisFsmRunEventRoamingDiscovery() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Update the time of ScanDone for roaming and transit to Roam state. -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -ENUM_AIS_STATE_T -aisFsmRoamingScanResultsUpdate ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_ROAMING_INFO_T prRoamingFsmInfo; - ENUM_AIS_STATE_T eNextState; - - DBGLOG(AIS, LOUD, ("->aisFsmRoamingScanResultsUpdate()\n")); - - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - prRoamingFsmInfo = (P_ROAMING_INFO_T)&(prAdapter->rWifiVar.rRoamingInfo); - - roamingFsmScanResultsUpdate(prAdapter); - - eNextState = prAisFsmInfo->eCurrentState; - if (prRoamingFsmInfo->eCurrentState == ROAMING_STATE_DISCOVERY) { - roamingFsmRunEventRoam(prAdapter); - eNextState = AIS_STATE_SEARCH; - } - else if (prAisFsmInfo->eCurrentState == AIS_STATE_LOOKING_FOR) { - eNextState = AIS_STATE_SEARCH; - } - else if (prAisFsmInfo->eCurrentState == AIS_STATE_ONLINE_SCAN) { - eNextState = AIS_STATE_NORMAL_TR; - } - - return eNextState; -} /* end of aisFsmRoamingScanResultsUpdate() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will modify and update necessary information to firmware -* for disconnection of last AP before switching to roaming bss. -* -* @param IN prAdapter Pointer to the Adapter structure. -* prTargetStaRec Target of StaRec of roaming -* -* @retval None -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmRoamingDisconnectPrevAP ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prTargetStaRec - ) -{ - P_BSS_INFO_T prAisBssInfo; - - DBGLOG(AIS, LOUD, ("aisFsmRoamingDisconnectPrevAP()")); - - ASSERT(prAdapter); - - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - - nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_AIS_INDEX); - - /* Not invoke rlmBssAborted() here to avoid prAisBssInfo->fg40mBwAllowed - * to be reset. RLM related parameters will be reset again when handling - * association response in rlmProcessAssocRsp(). 20110413 - */ - //rlmBssAborted(prAdapter, prAisBssInfo); - - //4 <3> Unset the fgIsConnected flag of BSS_DESC_T and send Deauth if needed. - if (PARAM_MEDIA_STATE_CONNECTED == prAisBssInfo->eConnectionState) { - scanRemoveConnFlagOfBssDescByBssid(prAdapter, prAisBssInfo->aucBSSID); - } - - //4 <4> Change Media State immediately. - aisChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED); - - //4 <4.1> sync. with firmware - prTargetStaRec->ucNetTypeIndex = 0xff; /* Virtial NetType */ - nicUpdateBss(prAdapter, NETWORK_TYPE_AIS_INDEX); - prTargetStaRec->ucNetTypeIndex = NETWORK_TYPE_AIS_INDEX; /* Virtial NetType */ - - return; -} /* end of aisFsmRoamingDisconnectPrevAP() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will update the contain of BSS_INFO_T for AIS network once -* the roaming was completed. -* -* @param IN prAdapter Pointer to the Adapter structure. -* prStaRec StaRec of roaming AP -* prAssocRspSwRfb -* -* @retval None -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisUpdateBssInfoForRoamingAP ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prAssocRspSwRfb - ) -{ - P_BSS_INFO_T prAisBssInfo; - - DBGLOG(AIS, LOUD, ("aisUpdateBssInfoForRoamingAP()")); - - ASSERT(prAdapter); - - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - - //4 <1.1> Change FW's Media State immediately. - aisChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED); - - //4 <1.2> Deactivate previous AP's STA_RECORD_T in Driver if have. - if ((prAisBssInfo->prStaRecOfAP) && - (prAisBssInfo->prStaRecOfAP != prStaRec) && - (prAisBssInfo->prStaRecOfAP->fgIsInUse)) { - cnmStaRecChangeState(prAdapter, prAisBssInfo->prStaRecOfAP, STA_STATE_1); - } - - //4 <1.3> Update BSS_INFO_T - aisUpdateBssInfoForJOIN(prAdapter, prStaRec, prAssocRspSwRfb); - - //4 <1.4> Activate current AP's STA_RECORD_T in Driver. - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); - - //4 <1.6> Indicate Connected Event to Host immediately. - /* Require BSSID, Association ID, Beacon Interval.. from AIS_BSS_INFO_T */ - aisIndicationOfMediaStateToHost(prAdapter, PARAM_MEDIA_STATE_CONNECTED, FALSE); - - return; -} /* end of aisFsmRoamingUpdateBss() */ - -#endif /* CFG_SUPPORT_ROAMING */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Check if there is any pending request and remove it (optional) -* -* @param prAdapter -* eReqType -* bRemove -* -* @return TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -aisFsmIsRequestPending ( - IN P_ADAPTER_T prAdapter, - IN ENUM_AIS_REQUEST_TYPE_T eReqType, - IN BOOLEAN bRemove - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_AIS_REQ_HDR_T prPendingReqHdr, prPendingReqHdrNext; - - ASSERT(prAdapter); - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - - /* traverse through pending request list */ - LINK_FOR_EACH_ENTRY_SAFE(prPendingReqHdr, - prPendingReqHdrNext, - &(prAisFsmInfo->rPendingReqList), - rLinkEntry, - AIS_REQ_HDR_T) { - /* check for specified type */ - if(prPendingReqHdr->eReqType == eReqType) { - /* check if need to remove */ - if(bRemove == TRUE) { - LINK_REMOVE_KNOWN_ENTRY(&(prAisFsmInfo->rPendingReqList), &(prPendingReqHdr->rLinkEntry)); - - cnmMemFree(prAdapter, prPendingReqHdr); - } - - return TRUE; - } - } - - return FALSE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Get next pending request -* -* @param prAdapter -* -* @return P_AIS_REQ_HDR_T -*/ -/*----------------------------------------------------------------------------*/ -P_AIS_REQ_HDR_T -aisFsmGetNextRequest ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_FSM_INFO_T prAisFsmInfo; - P_AIS_REQ_HDR_T prPendingReqHdr; - - ASSERT(prAdapter); - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - - LINK_REMOVE_HEAD(&(prAisFsmInfo->rPendingReqList), prPendingReqHdr, P_AIS_REQ_HDR_T); - - return prPendingReqHdr; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Insert a new request -* -* @param prAdapter -* eReqType -* -* @return TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -aisFsmInsertRequest ( - IN P_ADAPTER_T prAdapter, - IN ENUM_AIS_REQUEST_TYPE_T eReqType - ) -{ - P_AIS_REQ_HDR_T prAisReq; - P_AIS_FSM_INFO_T prAisFsmInfo; - - ASSERT(prAdapter); - prAisFsmInfo = &(prAdapter->rWifiVar.rAisFsmInfo); - - prAisReq = (P_AIS_REQ_HDR_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(AIS_REQ_HDR_T)); - - if(!prAisReq) { - ASSERT(0); // Can't generate new message - return FALSE; - } - - prAisReq->eReqType = eReqType; - - /* attach request into pending request list */ - LINK_INSERT_TAIL(&prAisFsmInfo->rPendingReqList, &prAisReq->rLinkEntry); - - return TRUE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Flush all pending requests -* -* @param prAdapter -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -aisFsmFlushRequest ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_REQ_HDR_T prAisReq; - - ASSERT(prAdapter); - - while((prAisReq = aisFsmGetNextRequest(prAdapter)) != NULL) { - cnmMemFree(prAdapter, prAisReq); - } - - return; -} - - diff --git a/drivers/net/wireless/mt5931/mgmt/assoc.c b/drivers/net/wireless/mt5931/mgmt/assoc.c deleted file mode 100755 index c4d26fb100c2..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/assoc.c +++ /dev/null @@ -1,2044 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/assoc.c#3 $ -*/ - -/*! \file "assoc.c" - \brief This file includes the association-related functions. - - This file includes the association-related functions. -*/ - - - -/*\ -** $Log: assoc.c $ -** -** 07 27 2012 yuche.tsai -** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot -** Fix wifi direct connection issue. - * - * 07 17 2012 yuche.tsai - * NULL - * Let netdev bring up. - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 06 13 2012 yuche.tsai - * NULL - * Update maintrunk driver. - * Add support for driver compose assoc request frame. - * - * 06 08 2012 cp.wu - * [WCXRP00001245] [MT6620 Wi-Fi][Driver][Firmware] NPS Software Development - * add a pair of brace for compilation success. - * - * 06 04 2012 cp.wu - * [WCXRP00001245] [MT6620 Wi-Fi][Driver][Firmware] NPS Software Development - * discussed with WH, privacy bit in associate response is not necessary to be checked, and identified as association failure when mismatching with beacon/probe response - * - * 03 14 2012 wh.su - * [WCXRP00001173] [MT6620 Wi-Fi][Driver] Adding the ICS Tethering WPA2-PSK supporting - * Add code from 2.2 - * - * 03 09 2012 terry.wu - * NULL - * Fix build error. - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 01 16 2012 yuche.tsai - * NULL - * Update Driver for wifi driect gc join IE update issue. - * - * 11 10 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * change the debug module level. - * - * 10 25 2011 cm.chang - * [WCXRP00001058] [All Wi-Fi][Driver] Fix sta_rec's phyTypeSet and OBSS scan in AP mode - * Fix PhyTypeSet in STA_REC in AP mode - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 09 19 2011 yuche.tsai - * NULL - * Fix KE when enable hot-spot & any one client connect to this hot-spot. - * - * 09 14 2011 yuche.tsai - * NULL - * Add P2P IE in assoc response. - * - * 07 15 2011 terry.wu - * [WCXRP00000855] [MT6620 Wi-Fi] [Driver] Workaround for Kingnet 710 AP wrong AID assignment - * Update workaround for Kingnet AP. - * - * 07 15 2011 terry.wu - * [WCXRP00000855] [MT6620 Wi-Fi] [Driver] Workaround for Kingnet 710 AP wrong AID assignment - * Workaround for Kingnet 710 AP wrong AID assignment. - * - * 05 02 2011 eddie.chen - * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning[WCXRP00000672] [MT6620 Wi-Fi][FW] Fix the PS event allocation - * Check STA when rx assoc. - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 03 19 2011 yuche.tsai - * [WCXRP00000581] [Volunteer Patch][MT6620][Driver] P2P IE in Assoc Req Issue - * Make assoc req to append P2P IE if wifi direct is enabled. - * - * 03 17 2011 chinglan.wang - * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature - * . - * - * 03 16 2011 wh.su - * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done - * enable the protected while at P2P start GO, and skip some security check . - * - * 03 14 2011 wh.su - * [WCXRP00000545] [MT6620 Wi-Fi] [Driver] Fixed the p2p not enable, received a assoc rsp cause the rx assoc execute a null function - * Modify file for avoid assert at BOW recieve a assoc response frame but no p2p fucntion. - * - * 03 08 2011 terry.wu - * [WCXRP00000524] [MT6620 Wi-Fi][Driver] Fix p2p assoc request containing wrong IE format - * Fix p2p assoc request containing wrong IE format. - * - * 03 02 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * add code to let the beacon and probe response for Auto GO WSC . - * - * 02 15 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * Fix RX disassoc issue under Hot-spot mode. - * - * 02 09 2011 wh.su - * [WCXRP00000432] [MT6620 Wi-Fi][Driver] Add STA privacy check at hotspot mode - * adding the code for check STA privacy bit at AP mode, . - * - * 02 08 2011 eddie.chen - * [WCXRP00000426] [MT6620 Wi-Fi][FW/Driver] Add STA aging timeout and defualtHwRatein AP mode - * Add event STA agint timeout - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Change Station Type in Station Record, Modify MACRO definition for getting station type & network type index & Role. - * - * 01 12 2011 yuche.tsai - * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode. - * Update Phy Type Set. When legacy client is connected, it can use 11b rate, - * but if the P2P device is connected, 11b rate is not allowed. - * - * 01 11 2011 yuche.tsai - * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode. - * Update Desired Non-HT Rate Set. - * - * 12 30 2010 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, - -Add per station flow control when STA is in PS - - - * Recover the code that was coverwritted.. - * - * 12 29 2010 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, -Add per station flow control when STA is in PS - - * 1) PS flow control event - * - * 2) WMM IE in beacon, assoc resp, probe resp - * - * 11 04 2010 wh.su - * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID - * adding the p2p random ssid support. - * - * 10 18 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * use definition macro to replace hard-coded constant - * - * 09 28 2010 wh.su - * NULL - * [WCXRP00000069][MT6620 Wi-Fi][Driver] Fix some code for phase 1 P2P Demo. - * - * 09 27 2010 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000065] Update BoW design and settings - * Update BCM/BoW design and settings. - * - * 09 16 2010 cm.chang - * NULL - * Change conditional compiling options for BOW - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 09 01 2010 wh.su - * NULL - * adding the wapi support for integration test. - * - * 08 30 2010 cp.wu - * NULL - * eliminate klockwork errors - * - * 08 16 2010 yuche.tsai - * NULL - * Add SSID IE in assoc req frame which is sent by P2P GC. - * - * 08 16 2010 kevin.huang - * NULL - * Refine AAA functions - * - * 08 03 2010 cp.wu - * NULL - * surpress compilation warning. - * - * 07 20 2010 wh.su - * - * adding the wapi code. - * - * 07 09 2010 yarco.yang - * - * [MT6620 and MT5931] SW Migration: Add ADDBA support - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * take use of RLM module for parsing/generating HT IEs for 11n capability - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * comment out RSN IE generation by CFG_RSN_MIGRATION compilation flag. - * - * 06 28 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * send MMPDU in basic rate. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add scan_fsm into building. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * specify correct value for management frames. - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 18 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * migration from MT6620 firmware. - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * revised. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add management dispatching function table. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * auth.c is migrated. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 05 24 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Update assocProcessRxAssocReqFrame() to avoid redundant SSID IE {0,0} for IOT. - * - * 05 14 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Fix compile warning - macro > 10 line, initial value of an array - * - * 04 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW - * - * 04 22 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * First draft code to support protection in AP mode - * - * 04 19 2010 kevin.huang - * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support - * Add Beacon Timeout Support - * * * * * * * * and will send Null frame to diagnose connection - * - * 04 16 2010 wh.su - * [BORA00000680][MT6620] Support the statistic for Microsoft os query - * adding the wpa-none for ibss beacon. - * - * 03 25 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Remove compiling warning - * - * 03 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Not carry HT cap when being associated with b/g only AP - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * 01 28 2010 wh.su - * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code - * fixed the compiling warning.u1rwduu`wvpghlqg|rm+vp - * - * 01 27 2010 wh.su - * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code - * add and fixed some security function. - * - * 01 11 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add Deauth and Disassoc Handler - * - * 01 07 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Update Assoc ID for PS - * - * 01 04 2010 tehuang.liu - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * For working out the first connection Chariot-verified version - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * Dec 12 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Use new constant definition ELEM_MAX_LEN_EXT_CAP - * - * Dec 9 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Modify assoc req IE talbe for HT cap IE - * - * Dec 7 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * update the assocComposeReAssocReqFrameHeader() and fix the u2EstimatedFrameLen in assocSendReAssocReqFrame() - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * remove some space line - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the sending disassoc frame function - * - * Dec 4 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the txassocReq IE table, adding for WPA/RSN - * - * Dec 3 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix eNetType not init in send AssocReq function - * - * Dec 3 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Integrate the send Assoc with TXM - * - * Dec 1 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the code to indicate the assoc request and assoc response (now disable) - * - * Nov 24 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Remove unused variables - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ -APPEND_VAR_IE_ENTRY_T txAssocReqIETable[] = { - { (ELEM_HDR_LEN + ELEM_MAX_LEN_HT_CAP), NULL, rlmReqGenerateHtCapIE },/* 45 */ -#if CFG_SUPPORT_WPS2 - { (ELEM_HDR_LEN + ELEM_MAX_LEN_WSC), NULL, rsnGenerateWSCIE }, /* 221 */ -#endif -#if CFG_SUPPORT_WAPI - { (ELEM_HDR_LEN + ELEM_MAX_LEN_WAPI), NULL, wapiGenerateWAPIIE }, /* 68 */ -#endif -#if CFG_RSN_MIGRATION - { (ELEM_HDR_LEN + ELEM_MAX_LEN_WPA), NULL, rsnGenerateWPAIE }, /* 221 */ -#endif - { (ELEM_HDR_LEN + ELEM_MAX_LEN_EXT_CAP), NULL, rlmReqGenerateExtCapIE }, /* 127 */ - { (ELEM_HDR_LEN + ELEM_MAX_LEN_WMM_INFO), NULL, mqmGenerateWmmInfoIE }, /* 221 */ -#if CFG_RSN_MIGRATION - { (ELEM_HDR_LEN + ELEM_MAX_LEN_RSN), NULL, rsnGenerateRSNIE }, /* 48 */ -#endif -}; - -#if CFG_SUPPORT_AAA -VERIFY_IE_ENTRY_T rxAssocReqIETable[] = { - { ELEM_ID_RESERVED, NULL } /* 255 */ -}; - - -APPEND_VAR_IE_ENTRY_T txAssocRespIETable[] = { - { (ELEM_HDR_LEN + ELEM_MAX_LEN_ERP), NULL, rlmRspGenerateErpIE }, /* 42 */ - { (ELEM_HDR_LEN + ELEM_MAX_LEN_HT_CAP), NULL, rlmRspGenerateHtCapIE }, /* 45 */ - { (ELEM_HDR_LEN + ELEM_MAX_LEN_HT_OP), NULL, rlmRspGenerateHtOpIE }, /* 61 */ -#if CFG_ENABLE_WIFI_DIRECT - { (ELEM_HDR_LEN + ELEM_MAX_LEN_OBSS_SCAN), NULL, rlmRspGenerateObssScanIE }, /* 74 */ - { (0), p2pFuncCalculateP2p_IELenForAssocRsp, p2pFuncGenerateP2p_IEForAssocRsp }, /* 221 */ -#endif - { (ELEM_HDR_LEN + ELEM_MAX_LEN_EXT_CAP), NULL, rlmRspGenerateExtCapIE }, /* 127 */ - { (ELEM_HDR_LEN + ELEM_MAX_LEN_WMM_PARAM), NULL, mqmGenerateWmmParamIE } /* 221 */ -}; -#endif - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to compose the Capability Info Field. -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @retval Capability Info Field -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ UINT_16 -assocBuildCapabilityInfo ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - UINT_32 u4NonHTPhyType; - UINT_16 u2CapInfo; - - - ASSERT(prStaRec); - - - /* Set up our requested capabilities. */ - u2CapInfo = CAP_INFO_ESS; - u2CapInfo |= CAP_CF_STA_NOT_POLLABLE; - - if (prStaRec->u2CapInfo & CAP_INFO_PRIVACY) { - u2CapInfo |= CAP_INFO_PRIVACY; - } - - - /* 7.3.1.4 */ - if (prStaRec->fgHasBasicPhyType) { - u4NonHTPhyType = prStaRec->ucNonHTBasicPhyType; - - if ( (rNonHTPhyAttributes[u4NonHTPhyType].fgIsShortPreambleOptionImplemented) && - ( (prAdapter->rWifiVar.ePreambleType == PREAMBLE_TYPE_SHORT) || /* Short Preamble Option Enable is TRUE */ - ((prAdapter->rWifiVar.ePreambleType == PREAMBLE_TYPE_AUTO) && - (prStaRec->u2CapInfo & CAP_INFO_SHORT_PREAMBLE)) ) ) { - - /* Case I: Implemented == TRUE and Short Preamble Option Enable == TRUE. - * Case II: Implemented == TRUE and Short Preamble == AUTO (depends on - * BSS_DESC_T's capability) - */ - u2CapInfo |= CAP_INFO_SHORT_PREAMBLE; - } - - if (rNonHTPhyAttributes[u4NonHTPhyType].fgIsShortSlotTimeOptionImplemented && - prAdapter->rWifiVar.fgIsShortSlotTimeOptionEnable) { - u2CapInfo |= CAP_INFO_SHORT_SLOT_TIME; - } - } - - DBGLOG(SAA, LOUD, ("ASSOC REQ: Compose Capability = 0x%04x for Target BSS ["MACSTR"].\n", - u2CapInfo, MAC2STR(prStaRec->aucMacAddr))); - - - return u2CapInfo; - -} /* end of assocBuildCapabilityInfo() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to compose Common Information Elements for Association -* Request Frame. -* -* @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -assocBuildReAssocReqFrameCommonIEs ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - P_CONNECTION_SETTINGS_T prConnSettings; - P_STA_RECORD_T prStaRec; - PUINT_8 pucBuffer; - UINT_16 u2SupportedRateSet; - UINT_8 aucAllSupportedRates[RATE_NUM] = {0}; - UINT_8 ucAllSupportedRatesLen; - UINT_8 ucSupRatesLen; - UINT_8 ucExtSupRatesLen; - - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - ASSERT(prMsduInfo); - ASSERT(prMsduInfo->eSrc == TX_PACKET_MGMT); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - ASSERT(prStaRec); - - if(!prStaRec) { - return; - } - - pucBuffer = (PUINT_8)((UINT_32)prMsduInfo->prPacket + - (UINT_32)prMsduInfo->u2FrameLength); - ASSERT(pucBuffer); - - if (IS_STA_IN_AIS(prStaRec)) { - - /* Fill the SSID element. */ - SSID_IE(pucBuffer)->ucId = ELEM_ID_SSID; - - /* NOTE(Kevin): We copy the SSID from CONNECTION_SETTINGS for the case of - * Passive Scan and the target BSS didn't broadcast SSID on its Beacon Frame. - */ - - COPY_SSID(SSID_IE(pucBuffer)->aucSSID, - SSID_IE(pucBuffer)->ucLength, - prConnSettings->aucSSID, - prConnSettings->ucSSIDLen); - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - pucBuffer += IE_SIZE(pucBuffer); - - } -#if CFG_ENABLE_WIFI_DIRECT - else if((prAdapter->fgIsP2PRegistered) && - (IS_STA_IN_P2P(prStaRec))) { - pucBuffer = p2pBuildReAssocReqFrameCommonIEs(prAdapter, prMsduInfo, pucBuffer); - } -#endif -#if CFG_ENABLE_BT_OVER_WIFI - else if (IS_STA_IN_BOW(prStaRec)) { - - SSID_IE(pucBuffer)->ucId = ELEM_ID_SSID; - - /* NOTE(Kevin): We copy the SSID from CONNECTION_SETTINGS for the case of - * Passive Scan and the target BSS didn't broadcast SSID on its Beacon Frame. - */ - - COPY_SSID(SSID_IE(pucBuffer)->aucSSID, - SSID_IE(pucBuffer)->ucLength, - prConnSettings->aucSSID, - prConnSettings->ucSSIDLen); - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - pucBuffer += IE_SIZE(pucBuffer); - } -#endif - - else { - /* TODO(Kevin): For other network */ - } - - /* NOTE(Kevin 2008/12/19): 16.3.6.3 MLME-ASSOCIATE.indication - - * SupportedRates - The set of data rates that are supported by the STA - * that is requesting association. - * Original(Portable Driver): Only send the Rates that we'll support. - * New: Send the Phy Rates if the result of following & operation == NULL. - */ - //rateGetDataRatesFromRateSet((prBssDesc->u2OperationalRateSet & - // rPhyAttributes[prBssDesc->ePhyType].u2SupportedRateSet), - - if (prStaRec->fgHasBasicPhyType) { - UINT_32 u4NonHTPhyType; - - - u4NonHTPhyType = prStaRec->ucNonHTBasicPhyType; - - u2SupportedRateSet = (prStaRec->u2OperationalRateSet & - rNonHTPhyAttributes[u4NonHTPhyType].u2SupportedRateSet); - - ASSERT(u2SupportedRateSet); - - if (!u2SupportedRateSet) { - u2SupportedRateSet = rNonHTPhyAttributes[u4NonHTPhyType].u2SupportedRateSet; - } - - /* TODO(Kevin): For P2P, we shouldn't send support rate set which contains 11b rate */ - - rateGetDataRatesFromRateSet(u2SupportedRateSet, - 0, - aucAllSupportedRates, - &ucAllSupportedRatesLen); - - ucSupRatesLen = ((ucAllSupportedRatesLen > ELEM_MAX_LEN_SUP_RATES) ? - ELEM_MAX_LEN_SUP_RATES : ucAllSupportedRatesLen); - - ucExtSupRatesLen = ucAllSupportedRatesLen - ucSupRatesLen; - - - /* Fill the Supported Rates element. */ - if (ucSupRatesLen) { - SUP_RATES_IE(pucBuffer)->ucId = ELEM_ID_SUP_RATES; - SUP_RATES_IE(pucBuffer)->ucLength = ucSupRatesLen; - kalMemCopy(SUP_RATES_IE(pucBuffer)->aucSupportedRates, - aucAllSupportedRates, - ucSupRatesLen); - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - pucBuffer += IE_SIZE(pucBuffer); - } - - - /* Fill the Extended Supported Rates element. */ - if (ucExtSupRatesLen) { - - EXT_SUP_RATES_IE(pucBuffer)->ucId = ELEM_ID_EXTENDED_SUP_RATES; - EXT_SUP_RATES_IE(pucBuffer)->ucLength = ucExtSupRatesLen; - - kalMemCopy(EXT_SUP_RATES_IE(pucBuffer)->aucExtSupportedRates, - &aucAllSupportedRates[ucSupRatesLen], - ucExtSupRatesLen); - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - pucBuffer += IE_SIZE(pucBuffer); - } - } - - return; -} /* end of assocBuildReAssocReqFrameCommonIEs() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will compose the (Re)Association Request frame header and -* its fixed fields -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] pucBuffer Pointer to the frame buffer. -* @param[in] aucMACAddress Given Our MAC Address. -* @param[in out] pu2PayloadLen Return the length of the composed fixed fields -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -assocComposeReAssocReqFrameHeaderAndFF ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN PUINT_8 pucBuffer, - IN UINT_8 aucMACAddress[], - IN OUT PUINT_16 pu2PayloadLen - ) -{ - P_WLAN_ASSOC_REQ_FRAME_T prAssocFrame; - BOOLEAN fgIsReAssoc; - - UINT_16 u2FrameCtrl; - UINT_16 u2CapInfo; - UINT_16 u2ListenInterval; - - - ASSERT(prStaRec); - ASSERT(pucBuffer); - ASSERT(aucMACAddress); - ASSERT(pu2PayloadLen); - - prAssocFrame = (P_WLAN_ASSOC_REQ_FRAME_T)pucBuffer; - fgIsReAssoc = prStaRec->fgIsReAssoc; - - //4 <1> Compose the frame header of the (Re)Association Request frame. - /* Fill the Frame Control field. */ - if (fgIsReAssoc) { - u2FrameCtrl = MAC_FRAME_REASSOC_REQ; - } - else { - u2FrameCtrl = MAC_FRAME_ASSOC_REQ; - } - WLAN_SET_FIELD_16(&prAssocFrame->u2FrameCtrl, u2FrameCtrl); - - /* Fill the DA field with Target BSSID. */ - COPY_MAC_ADDR(prAssocFrame->aucDestAddr, prStaRec->aucMacAddr); - - /* Fill the SA field with our MAC Address. */ - COPY_MAC_ADDR(prAssocFrame->aucSrcAddr, aucMACAddress); - - /* Fill the BSSID field with Target BSSID. */ - COPY_MAC_ADDR(prAssocFrame->aucBSSID, prStaRec->aucMacAddr); - - /* Clear the SEQ/FRAG_NO field(HW won't overide the FRAG_NO, so we need to clear it). */ - prAssocFrame->u2SeqCtrl = 0; - - - //4 <2> Compose the frame body's common fixed field part of the (Re)Association Request frame. - u2CapInfo = assocBuildCapabilityInfo(prAdapter, prStaRec); - - /* Fill the Capability Information field. */ - WLAN_SET_FIELD_16(&prAssocFrame->u2CapInfo, u2CapInfo); - - - /* Calculate the listen interval for the maximum power mode. Currently, we - set it to the value 2 times DTIM period. */ - if (prStaRec->ucDTIMPeriod) { - u2ListenInterval = prStaRec->ucDTIMPeriod * DEFAULT_LISTEN_INTERVAL_BY_DTIM_PERIOD; - } - else { - DBGLOG(SAA, TRACE, ("Use default listen interval\n")); - u2ListenInterval = DEFAULT_LISTEN_INTERVAL; - } - prStaRec->u2ListenInterval = u2ListenInterval; - - /* Fill the Listen Interval field. */ - WLAN_SET_FIELD_16(&prAssocFrame->u2ListenInterval, u2ListenInterval); - - - //4 <3> Compose the Current AP Address field for ReAssociation Request frame. - /* Fill the Current AP Address field. */ - if (prStaRec->fgIsReAssoc) { - if (IS_STA_IN_AIS(prStaRec)) { - - P_AIS_BSS_INFO_T prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - P_WLAN_REASSOC_REQ_FRAME_T prReAssocFrame = - (P_WLAN_REASSOC_REQ_FRAME_T)prAssocFrame; - - COPY_MAC_ADDR(prReAssocFrame->aucCurrentAPAddr, prAisBssInfo->aucBSSID); - } - else { - ASSERT(0); /* We don't support ReAssociation for other network */ - } - - *pu2PayloadLen = (CAP_INFO_FIELD_LEN + - LISTEN_INTERVAL_FIELD_LEN + - CURR_AP_ADDR_FIELD_LEN); - } - else { - *pu2PayloadLen = (CAP_INFO_FIELD_LEN + - LISTEN_INTERVAL_FIELD_LEN); - } - - return; -} /* end of assocComposeReAssocReqFrame() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will send the (Re)Association Request frame -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @retval WLAN_STATUS_RESOURCES No available resource for frame composing. -* @retval WLAN_STATUS_SUCCESS Successfully send frame to TX Module -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -assocSendReAssocReqFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - P_MSDU_INFO_T prMsduInfo; - P_BSS_INFO_T prBssInfo; - - UINT_16 u2PayloadLen; - UINT_16 u2EstimatedFrameLen; - UINT_16 u2EstimatedExtraIELen; - BOOLEAN fgIsReAssoc; - UINT_32 i; - - - ASSERT(prStaRec); - - //4 <1> Allocate a PKT_INFO_T for Authentication Frame - fgIsReAssoc = prStaRec->fgIsReAssoc; - - /* Init with MGMT Header Length + Length of Fixed Fields + Common IE Length */ - if (fgIsReAssoc) { - u2EstimatedFrameLen = MAC_TX_RESERVED_FIELD + \ - WLAN_MAC_MGMT_HEADER_LEN + \ - CAP_INFO_FIELD_LEN + \ - LISTEN_INTERVAL_FIELD_LEN + \ - CURR_AP_ADDR_FIELD_LEN + \ - (ELEM_HDR_LEN + ELEM_MAX_LEN_SSID) + \ - (ELEM_HDR_LEN + ELEM_MAX_LEN_SUP_RATES) + \ - (ELEM_HDR_LEN + (RATE_NUM - ELEM_MAX_LEN_SUP_RATES)); - } - else { - u2EstimatedFrameLen = MAC_TX_RESERVED_FIELD + \ - WLAN_MAC_MGMT_HEADER_LEN + \ - CAP_INFO_FIELD_LEN + \ - LISTEN_INTERVAL_FIELD_LEN + \ - (ELEM_HDR_LEN + ELEM_MAX_LEN_SSID) + \ - (ELEM_HDR_LEN + ELEM_MAX_LEN_SUP_RATES) + \ - (ELEM_HDR_LEN + (RATE_NUM - ELEM_MAX_LEN_SUP_RATES)); - } - - /* + Extra IE Length */ - u2EstimatedExtraIELen = 0; - -#if CFG_ENABLE_WIFI_DIRECT_CFG_80211 && CFG_ENABLE_WIFI_DIRECT - if (prStaRec->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX) { - if ((prAdapter->fgIsP2PRegistered)) { - u2EstimatedExtraIELen = p2pCalculate_IEForAssocReq(prAdapter, - prStaRec->ucNetTypeIndex, - prStaRec); - } - else { - DBGLOG(P2P, TRACE, ("Function Linker Lost.\n")); - ASSERT(FALSE); - } - } - else { - for (i = 0; i < sizeof(txAssocReqIETable)/sizeof(APPEND_VAR_IE_ENTRY_T); i++) { - if (txAssocReqIETable[i].u2EstimatedFixedIELen != 0) { - u2EstimatedExtraIELen += txAssocReqIETable[i].u2EstimatedFixedIELen; - } - else { - u2EstimatedExtraIELen += (UINT_16)txAssocReqIETable[i].pfnCalculateVariableIELen(prAdapter, - prStaRec->ucNetTypeIndex, - prStaRec); - } - } - } -#else - for (i = 0; i < sizeof(txAssocReqIETable)/sizeof(APPEND_VAR_IE_ENTRY_T); i++) { - if (txAssocReqIETable[i].u2EstimatedFixedIELen != 0) { - u2EstimatedExtraIELen += txAssocReqIETable[i].u2EstimatedFixedIELen; - } - else { - u2EstimatedExtraIELen += (UINT_16)txAssocReqIETable[i].pfnCalculateVariableIELen(prAdapter, - prStaRec->ucNetTypeIndex, - prStaRec); - } - } -#endif - - u2EstimatedFrameLen += u2EstimatedExtraIELen; - - /* Allocate a MSDU_INFO_T */ - if ( (prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen)) == NULL) { - DBGLOG(SAA, WARN, ("No PKT_INFO_T for sending (Re)Assoc Request.\n")); - return WLAN_STATUS_RESOURCES; - } - - //4 <2> Compose (Re)Association Request frame header and fixed fields in MSDU_INfO_T. - ASSERT(prStaRec->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - - - /* Compose Header and Fixed Field */ - assocComposeReAssocReqFrameHeaderAndFF(prAdapter, - prStaRec, - (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD), - prBssInfo->aucOwnMacAddr, - &u2PayloadLen); - - //4 <3> Update information of MSDU_INFO_T - prMsduInfo->eSrc = TX_PACKET_MGMT; - prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_MGMT; - prMsduInfo->ucStaRecIndex = prStaRec->ucIndex; - prMsduInfo->ucNetworkType = prStaRec->ucNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_MGMT_HEADER_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = WLAN_MAC_MGMT_HEADER_LEN + u2PayloadLen; - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = saaFsmRunEventTxDone; - prMsduInfo->fgIsBasicRate = TRUE; - - //4 <4> Compose the frame body's IEs of the (Re)Association Request frame. - assocBuildReAssocReqFrameCommonIEs(prAdapter, prMsduInfo); - - - //4 <5> Compose IEs in MSDU_INFO_T -#if CFG_ENABLE_WIFI_DIRECT_CFG_80211 && CFG_ENABLE_WIFI_DIRECT - if (prStaRec->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX) { - if ((prAdapter->fgIsP2PRegistered)) { - p2pGenerate_IEForAssocReq(prAdapter, prMsduInfo); - } - else { - DBGLOG(P2P, TRACE, ("Function Linker Lost.\n")); - ASSERT(FALSE); - } - } - else { - /* Append IE */ - for (i = 0; i < sizeof(txAssocReqIETable)/sizeof(APPEND_VAR_IE_ENTRY_T); i++) { - if (txAssocReqIETable[i].pfnAppendIE) { - txAssocReqIETable[i].pfnAppendIE(prAdapter, prMsduInfo); - } - } - } -#else - /* Append IE */ - for (i = 0; i < sizeof(txAssocReqIETable)/sizeof(APPEND_VAR_IE_ENTRY_T); i++) { - if (txAssocReqIETable[i].pfnAppendIE) { - txAssocReqIETable[i].pfnAppendIE(prAdapter, prMsduInfo); - } - } -#endif - - //4 <6> Update the (Re)association request information - if (IS_STA_IN_AIS(prStaRec)) { - P_WLAN_ASSOC_REQ_FRAME_T prAssocFrame; - - prAssocFrame = (P_WLAN_ASSOC_REQ_FRAME_T)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD); - -#if CFG_RSN_MIGRATION - kalUpdateReAssocReqInfo(prAdapter->prGlueInfo, - (PUINT_8)&prAssocFrame->u2CapInfo, - prMsduInfo->u2FrameLength - offsetof(WLAN_ASSOC_REQ_FRAME_T, u2CapInfo), - fgIsReAssoc); -#endif - } - -#if CFG_ENABLE_WIFI_DIRECT - if ((prAdapter->fgIsP2PRegistered) && (IS_STA_IN_P2P(prStaRec))) { - P_WLAN_ASSOC_REQ_FRAME_T prAssocFrame; - - prAssocFrame = (P_WLAN_ASSOC_REQ_FRAME_T)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD); - - - kalP2PUpdateAssocInfo( - prAdapter->prGlueInfo, - (PUINT_8)&prAssocFrame->u2CapInfo, - prMsduInfo->u2FrameLength - offsetof(WLAN_ASSOC_REQ_FRAME_T, u2CapInfo), - fgIsReAssoc); - } -#endif - - /* TODO(Kevin): Also release the unused tail room of the composed MMPDU */ - - //4 <6> Enqueue the frame to send this (Re)Association request frame. - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - - return WLAN_STATUS_SUCCESS; -} /* end of assocSendReAssocReqFrame() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will strictly check the TX (Re)Association Request frame for -* SAA event handling. -* -* @param[in] prMsduInfo Pointer of MSDU_INFO_T -* -* @retval WLAN_STATUS_FAILURE This is not the frame we should handle at current state. -* @retval WLAN_STATUS_SUCCESS This is the frame we should handle. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -assocCheckTxReAssocReqFrame ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - P_WLAN_ASSOC_REQ_FRAME_T prAssocReqFrame; - P_STA_RECORD_T prStaRec; - UINT_16 u2TxFrameCtrl; - - - ASSERT(prMsduInfo); - ASSERT(prMsduInfo->eSrc == TX_PACKET_MGMT); - - prAssocReqFrame = (P_WLAN_ASSOC_REQ_FRAME_T)(prMsduInfo->prPacket); - ASSERT(prAssocReqFrame); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - ASSERT(prStaRec); - - if(!prStaRec) { - return WLAN_STATUS_INVALID_PACKET; - } - - //WLAN_GET_FIELD_16(&prAssocReqFrame->u2FrameCtrl, &u2TxFrameCtrl) - u2TxFrameCtrl = prAssocReqFrame->u2FrameCtrl; // NOTE(Kevin): Optimized for ARM - u2TxFrameCtrl &= MASK_FRAME_TYPE; - if (prStaRec->fgIsReAssoc) { - if (u2TxFrameCtrl != MAC_FRAME_REASSOC_REQ) { - return WLAN_STATUS_FAILURE; - } - } - else { - if (u2TxFrameCtrl != MAC_FRAME_ASSOC_REQ) { - return WLAN_STATUS_FAILURE; - } - } - - return WLAN_STATUS_SUCCESS; - -} /* end of assocCheckTxReAssocReqFrame() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will strictly check the TX (Re)Association Response frame for -* AAA event handling. -* -* @param[in] prMsduInfo Pointer of MSDU_INFO_T -* -* @retval WLAN_STATUS_FAILURE This is not the frame we should handle at current state. -* @retval WLAN_STATUS_SUCCESS This is the frame we should handle. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -assocCheckTxReAssocRespFrame ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - P_WLAN_ASSOC_RSP_FRAME_T prAssocRspFrame; - P_STA_RECORD_T prStaRec; - UINT_16 u2TxFrameCtrl; - - - ASSERT(prMsduInfo); - ASSERT(prMsduInfo->eSrc == TX_PACKET_MGMT); - - prAssocRspFrame = (P_WLAN_ASSOC_RSP_FRAME_T)(prMsduInfo->prPacket); - ASSERT(prAssocRspFrame); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - ASSERT(prStaRec); - - if(!prStaRec) { - return WLAN_STATUS_INVALID_PACKET; - } - - //WLAN_GET_FIELD_16(&prAssocFrame->u2FrameCtrl, &u2TxFrameCtrl) - u2TxFrameCtrl = prAssocRspFrame->u2FrameCtrl; // NOTE(Kevin): Optimized for ARM - u2TxFrameCtrl &= MASK_FRAME_TYPE; - if (prStaRec->fgIsReAssoc) { - if (u2TxFrameCtrl != MAC_FRAME_REASSOC_RSP) { - return WLAN_STATUS_FAILURE; - } - } - else { - if (u2TxFrameCtrl != MAC_FRAME_ASSOC_RSP) { - return WLAN_STATUS_FAILURE; - } - } - - return WLAN_STATUS_SUCCESS; - -} /* end of assocCheckTxReAssocRespFrame() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will validate the incoming (Re)Association Frame and take out -* the status code. -* -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[out] pu2StatusCode Pointer to store the Status Code from Authentication. -* -* @retval WLAN_STATUS_FAILURE This is not the frame we should handle at current state. -* @retval WLAN_STATUS_SUCCESS This is the frame we should handle. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -assocCheckRxReAssocRspFrameStatus ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_16 pu2StatusCode - ) -{ - P_STA_RECORD_T prStaRec; - P_WLAN_ASSOC_RSP_FRAME_T prAssocRspFrame; - UINT_16 u2RxFrameCtrl; - UINT_16 u2RxCapInfo; - UINT_16 u2RxStatusCode; - UINT_16 u2RxAssocId; - - - ASSERT(prSwRfb); - ASSERT(pu2StatusCode); - - if ((prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen) < (CAP_INFO_FIELD_LEN + - STATUS_CODE_FIELD_LEN + - AID_FIELD_LEN)) { - ASSERT(0); - return WLAN_STATUS_FAILURE; - } - - DBGLOG(SAA, LOUD, ("prSwRfb->u2PayloadLength = %d\n", prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen)); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - ASSERT(prStaRec); - - if(!prStaRec) { - return WLAN_STATUS_INVALID_PACKET; - } - - //4 <1> locate the (Re)Assocation Resp Frame. - prAssocRspFrame = (P_WLAN_ASSOC_RSP_FRAME_T) prSwRfb->pvHeader; - - //4 <2> Parse the Header of (Re)Assocation Resp Frame. - //WLAN_GET_FIELD_16(&prAssocRspFrame->u2FrameCtrl, &u2RxFrameCtrl); - u2RxFrameCtrl = prAssocRspFrame->u2FrameCtrl; // NOTE(Kevin): Optimized for ARM - u2RxFrameCtrl &= MASK_FRAME_TYPE; - if (prStaRec->fgIsReAssoc) { - if (u2RxFrameCtrl != MAC_FRAME_REASSOC_RSP) { - return WLAN_STATUS_FAILURE; - } - } - else { - if (u2RxFrameCtrl != MAC_FRAME_ASSOC_RSP) { - return WLAN_STATUS_FAILURE; - } - } - - //4 <3> Parse the Fixed Fields of (Re)Assocation Resp Frame Body. - //WLAN_GET_FIELD_16(&prAssocRspFrame->u2CapInfo, &u2RxCapInfo); - u2RxCapInfo = prAssocRspFrame->u2CapInfo; // NOTE(Kevin): Optimized for ARM - - //WLAN_GET_FIELD_16(&prAssocRspFrame->u2StatusCode, &u2RxStatusCode); - u2RxStatusCode = prAssocRspFrame->u2StatusCode; // NOTE(Kevin): Optimized for ARM - - //4 <4> Check CAP_INFO - /* NOTE(Kevin): CM suggest to add MGMT workaround for those APs didn't check - * the CAP Privacy Bit to overcome a corner case that the Privacy Bit - * of our SCAN result didn't consist with AP's Association Resp. - */ - if (u2RxStatusCode == STATUS_CODE_SUCCESSFUL) { -#if CFG_SUPPORT_WAPI - if (prAdapter->rWifiVar.rConnSettings.fgWapiMode) { - /* WAPI AP allow the customer use WZC to join mode, the privacy bit is 0 */ - /* even at WAI & WAPI_PSK mode, but the assoc respose set the privacy bit set 1 */ - DBGLOG(SEC, TRACE, ("Workaround the WAPI AP allow the customer to use WZC to join\n")); - } - else -#endif -#if CFG_ENABLE_WIFI_DIRECT - if (prAdapter->fgIsP2PRegistered && 1) { - /* Todo:: Fixed this */ - } - else -#endif - { - } - -#if CFG_STRICT_CHECK_CAPINFO_PRIVACY - if ((prStaRec->u2CapInfo & CAP_INFO_PRIVACY) ^ (u2RxCapInfo & CAP_INFO_PRIVACY)) { - u2RxStatusCode = STATUS_CODE_CAP_NOT_SUPPORTED; - } -#endif - } - - if (u2RxStatusCode == STATUS_CODE_SUCCESSFUL) { -#if CFG_RSN_MIGRATION - /* Update the information in the structure used to query and set - OID_802_11_ASSOCIATION_INFORMATION. */ - kalUpdateReAssocRspInfo(prAdapter->prGlueInfo, - (PUINT_8)&prAssocRspFrame->u2CapInfo, - (UINT_32)(prSwRfb->u2PacketLen)); -#endif - } - - //4 <5> Update CAP_INFO and ASSOC_ID - if (u2RxStatusCode == STATUS_CODE_SUCCESSFUL) { - prStaRec->u2CapInfo = u2RxCapInfo; - - //WLAN_GET_FIELD_16(&prAssocRspFrame->u2AssocId, &u2RxAssocId); - u2RxAssocId = prAssocRspFrame->u2AssocId; // NOTE(Kevin): Optimized for ARM - - /* 20110715 Workaround for Kingnet 710 AP (Realtek 8186) - * This AP raises the bit 6&7 not bit 14&15 in AID field. - * It cause wrong AID assignment. - * For AID = 2 - * Normal case: 0xC002(1100 0000 0000 0010) => 2 - * Kingnet 710: 0x00C2(0000 0000 1100 0010) => 194 - * workaround: mask bit 6&7 for this AP - */ - if((u2RxAssocId & BIT(6)) && - (u2RxAssocId & BIT(7)) && - !(u2RxAssocId & BITS(8, 15))) { - prStaRec->u2AssocId = u2RxAssocId & ~BITS(6,7); - } else { - prStaRec->u2AssocId = u2RxAssocId & ~AID_MSB; -#if CFG_SUPPORT_802_11W - if (prStaRec->ucNetTypeIndex == NETWORK_TYPE_AIS_INDEX) { - P_AIS_SPECIFIC_BSS_INFO_T prBssSpecInfo; - - prBssSpecInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - ASSERT(prBssSpecInfo); - - prBssSpecInfo->ucSaQueryTimedOut = 0; - } -#endif - } - } - -#if CFG_SUPPORT_802_11W - if (u2RxStatusCode == STATUS_CODE_AUTH_ALGORITHM_NOT_SUPPORTED){ - DBGLOG(SAA, INFO, ("AP rejected due the authentication algorithm not support\n")); - } - else if (u2RxStatusCode == STATUS_CODE_ASSOC_REJECTED_TEMPORARILY) { - PUINT_8 pucIE, pucTime; - UINT_16 u2IELength; - UINT_16 u2Offset = 0; - - u2IELength = prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen; - pucIE = (PUINT_8)((UINT_32)prSwRfb->pvHeader + prSwRfb->u2HeaderLen); - - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - if (ELEM_ID_TIMEOUT_INTERVAL == IE_ID(pucIE) && IE_LEN(pucIE) == 5) { - pucTime = ((P_IE_HDR_T)pucIE)->aucInfo; - if (pucTime[0] == ACTION_SA_TIMEOUT_ASSOC_COMEBACK) { - UINT_32 tu; - WLAN_GET_FIELD_32(pucTime + 1, &tu); - DBGLOG(SAA, INFO, ("AP rejected association temporarily; comeback duration %u TU " - "(%u ms)\n", tu, TU_TO_MSEC(tu))); - if (tu > TX_ASSOCIATION_RETRY_TIMEOUT_TU) { - DBGLOG(SAA, INFO, ("Update timer based on comeback duration\n")); - //ieee80211_reschedule_timer(wpa_s, ms); - } - } - break; - } - } /* end of IE_FOR_EACH */ - } -#endif - *pu2StatusCode = u2RxStatusCode; - - return WLAN_STATUS_SUCCESS; - -} /* end of assocCheckRxReAssocRspFrameStatus() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will compose the Disassociation frame -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] pucBuffer Pointer to the frame buffer. -* @param[in] aucMACAddress Given Our MAC Address. -* @param[in] u2ReasonCode The reason code of disassociation -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -assocComposeDisassocFrame ( - IN P_STA_RECORD_T prStaRec, - IN PUINT_8 pucBuffer, - IN UINT_8 aucMACAddress[], - IN UINT_16 u2ReasonCode - ) -{ - P_WLAN_DISASSOC_FRAME_T prDisAssocFrame; - UINT_16 u2FrameCtrl; - - ASSERT(pucBuffer); - ASSERT(pucBuffer); - ASSERT(aucMACAddress); - - prDisAssocFrame = (P_WLAN_DISASSOC_FRAME_T)pucBuffer; - - //4 <1> Compose the frame header of the DisAssociation frame. - /* Fill the Frame Control field. */ - u2FrameCtrl = MAC_FRAME_DISASSOC; - - WLAN_SET_FIELD_16(&prDisAssocFrame->u2FrameCtrl, u2FrameCtrl); - - /* Fill the DA field with Target BSSID. */ - COPY_MAC_ADDR(prDisAssocFrame->aucDestAddr, prStaRec->aucMacAddr); - - /* Fill the SA field with our MAC Address. */ - COPY_MAC_ADDR(prDisAssocFrame->aucSrcAddr, aucMACAddress); - - /* Fill the BSSID field with Target BSSID. */ - COPY_MAC_ADDR(prDisAssocFrame->aucBSSID, prStaRec->aucMacAddr); - - /* Clear the SEQ/FRAG_NO field(HW won't overide the FRAG_NO, so we need to clear it). */ - prDisAssocFrame->u2SeqCtrl = 0; - - //4 <2> Compose the frame body's fixed field part of the Disassociation frame. - /* Fill the Reason Code field. */ - WLAN_SET_FIELD_16(&prDisAssocFrame->u2ReasonCode, u2ReasonCode); - - return; -} /* end of assocComposeDisassocFrame() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will send the Disassociation frame -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] u2ReasonCode The reason code of disassociation -* -* @retval WLAN_STATUS_RESOURCES No available resource for frame composing. -* @retval WLAN_STATUS_SUCCESS Successfully send frame to TX Module -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -assocSendDisAssocFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN UINT_16 u2ReasonCode - ) -{ - PUINT_8 pucMacAddress; - P_MSDU_INFO_T prMsduInfo; - UINT_16 u2PayloadLen; - UINT_16 u2EstimatedFrameLen; - //UINT_32 u4Status = WLAN_STATUS_SUCCESS; - - - ASSERT(prStaRec); - - //4 <1> Allocate a PKT_INFO_T for Disassociation Frame - /* Init with MGMT Header Length + Length of Fixed Fields + IE Length */ - u2EstimatedFrameLen = MAC_TX_RESERVED_FIELD + \ - WLAN_MAC_MGMT_HEADER_LEN + \ - REASON_CODE_FIELD_LEN; - - /* Allocate a MSDU_INFO_T */ - if ( (prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen)) == NULL) { - DBGLOG(SAA, WARN, ("No PKT_INFO_T for sending DisAssoc.\n")); - return WLAN_STATUS_RESOURCES; - } - - //4 <2> Compose Disassociation frame header and fixed fields in MSDU_INfO_T. - ASSERT(prStaRec->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - - pucMacAddress = prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex].aucOwnMacAddr; - - /* Compose Header and Fixed Field */ - assocComposeDisassocFrame(prStaRec, - (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD), - pucMacAddress, - u2ReasonCode); - -#if CFG_SUPPORT_802_11W - if (rsnCheckBipKeyInstalled(prAdapter, prStaRec)) { - P_WLAN_DISASSOC_FRAME_T prDisassocFrame; - - prDisassocFrame = (P_WLAN_DEAUTH_FRAME_T)(PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD); - - prDisassocFrame->u2FrameCtrl |= MASK_FC_PROTECTED_FRAME; - DBGLOG(TX, WARN, ("assocSendDisAssocFrame with protection\n")); - } -#endif - - u2PayloadLen = REASON_CODE_FIELD_LEN; - - //4 <3> Update information of MSDU_INFO_T - ASSERT(prStaRec->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - - prMsduInfo->eSrc = TX_PACKET_MGMT; - prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_MGMT; - prMsduInfo->ucStaRecIndex = prStaRec->ucIndex; - prMsduInfo->ucNetworkType = prStaRec->ucNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_MGMT_HEADER_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = WLAN_MAC_MGMT_HEADER_LEN + u2PayloadLen; - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = NULL; - prMsduInfo->fgIsBasicRate = TRUE; - - //4 <4> Enqueue the frame to send this (Re)Association request frame. - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - - return WLAN_STATUS_SUCCESS; -} /* end of assocSendDisAssocFrame() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will parse and process the incoming Disassociation frame -* if the given BSSID is matched. -* -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[in] aucBSSID Given BSSID -* @param[out] pu2ReasonCode Pointer to store the Reason Code from Deauthentication. -* -* @retval WLAN_STATUS_FAILURE This is not the frame we should handle at current state. -* @retval WLAN_STATUS_SUCCESS This is the frame we should handle. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -assocProcessRxDisassocFrame ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN UINT_8 aucBSSID[], - OUT PUINT_16 pu2ReasonCode - ) -{ - P_WLAN_DISASSOC_FRAME_T prDisassocFrame; - UINT_16 u2RxReasonCode; - - - ASSERT(prSwRfb); - ASSERT(aucBSSID); - ASSERT(pu2ReasonCode); - - //4 <1> locate the Disassociation Frame. - prDisassocFrame = (P_WLAN_DISASSOC_FRAME_T) prSwRfb->pvHeader; - - //4 <2> Parse the Header of Disassociation Frame. - if ((prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen) < REASON_CODE_FIELD_LEN) { - ASSERT(0); - return WLAN_STATUS_FAILURE; - } - - /* Check if this Disassoc Frame is coming from Target BSSID */ - if (UNEQUAL_MAC_ADDR(prDisassocFrame->aucBSSID, aucBSSID)) { - DBGLOG(SAA, LOUD, ("Ignore Disassoc Frame from other BSS ["MACSTR"]\n", - MAC2STR(prDisassocFrame->aucSrcAddr))); - return WLAN_STATUS_FAILURE; - } - - //4 <3> Parse the Fixed Fields of Deauthentication Frame Body. - WLAN_GET_FIELD_16(&prDisassocFrame->u2ReasonCode, &u2RxReasonCode); - *pu2ReasonCode = u2RxReasonCode; - - return WLAN_STATUS_SUCCESS; - -} /* end of assocProcessRxDisassocFrame() */ - - -#if CFG_SUPPORT_AAA -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will parse and process the incoming Association Req frame -* and return a Status Code. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[out] pu2StatusCode Pointer to store the Status Code for carried in Association Response. -* -* @retval WLAN_STATUS_FAILURE This is not the frame we should handle at current state. -* @retval WLAN_STATUS_SUCCESS This is the frame we should handle. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -assocProcessRxAssocReqFrame ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_16 pu2StatusCode - ) -{ - P_WLAN_ASSOC_REQ_FRAME_T prAssocReqFrame; - P_STA_RECORD_T prStaRec; - P_BSS_INFO_T prBssInfo; - P_IE_SSID_T prIeSsid = (P_IE_SSID_T)NULL; - P_RSN_INFO_ELEM_T prIeRsn = (P_RSN_INFO_ELEM_T)NULL; - P_IE_SUPPORTED_RATE_T prIeSupportedRate = (P_IE_SUPPORTED_RATE_T)NULL; - P_IE_EXT_SUPPORTED_RATE_T prIeExtSupportedRate = (P_IE_EXT_SUPPORTED_RATE_T)NULL; - PUINT_8 pucIE, pucIEStart; - UINT_16 u2IELength; - UINT_16 u2Offset = 0; - UINT_16 u2StatusCode = STATUS_CODE_SUCCESSFUL; - UINT_16 u2RxFrameCtrl; - UINT_16 u2BSSBasicRateSet; - BOOLEAN fgIsUnknownBssBasicRate; - UINT_32 i; - - - ASSERT(prAdapter); - ASSERT(prSwRfb); - ASSERT(pu2StatusCode); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - - if (prStaRec == NULL) { - return WLAN_STATUS_FAILURE; - } - - //4 <1> locate the Association Req Frame. - prAssocReqFrame = (P_WLAN_ASSOC_REQ_FRAME_T) prSwRfb->pvHeader; - - //4 <2> Parse the Header of Association Req Frame. - if ((prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen) < - (CAP_INFO_FIELD_LEN + LISTEN_INTERVAL_FIELD_LEN)) { - ASSERT(0); - return WLAN_STATUS_FAILURE; - } - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - - /* Check if this Disassoc Frame is coming from Target BSSID */ - if (UNEQUAL_MAC_ADDR(prAssocReqFrame->aucBSSID, prBssInfo->aucBSSID)) { - return WLAN_STATUS_FAILURE; /* Just Ignore this MMPDU */ - } - - //WLAN_GET_FIELD_16(&prAssocReqFrame->u2FrameCtrl, &u2RxFrameCtrl); - u2RxFrameCtrl = prAssocReqFrame->u2FrameCtrl; // NOTE(Kevin): Optimized for ARM - u2RxFrameCtrl &= MASK_FRAME_TYPE; - if (MAC_FRAME_REASSOC_REQ == u2RxFrameCtrl) { - prStaRec->fgIsReAssoc = TRUE; - - u2IELength = (prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen) - - (UINT_16)(OFFSET_OF(WLAN_REASSOC_REQ_FRAME_T, aucInfoElem[0]) - WLAN_MAC_MGMT_HEADER_LEN); - - pucIEStart = pucIE = ((P_WLAN_REASSOC_REQ_FRAME_T)(prSwRfb->pvHeader))->aucInfoElem; - } - else { - prStaRec->fgIsReAssoc = FALSE; - - u2IELength = (prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen) - - (UINT_16)(OFFSET_OF(WLAN_ASSOC_REQ_FRAME_T, aucInfoElem[0]) - WLAN_MAC_MGMT_HEADER_LEN); - - pucIEStart = pucIE = prAssocReqFrame->aucInfoElem; - } - - - //4 <3> Parse the Fixed Fields of Assoc Req Frame Body. - prStaRec->u2CapInfo = prAssocReqFrame->u2CapInfo; - -#if CFG_ENABLE_WIFI_DIRECT && CFG_ENABLE_HOTSPOT_PRIVACY_CHECK - if (prAdapter->fgIsP2PRegistered && IS_STA_IN_P2P(prStaRec)) { - if (((prStaRec->u2CapInfo & CAP_INFO_PRIVACY) && - !kalP2PGetCipher(prAdapter->prGlueInfo))) { - u2StatusCode = STATUS_CODE_CAP_NOT_SUPPORTED; - DBGLOG(RSN, TRACE, ("STA Assoc req privacy bit check fail\n")); - return WLAN_STATUS_SUCCESS; - } - } -#endif - - prStaRec->u2ListenInterval = prAssocReqFrame->u2ListenInterval; - prStaRec->ucPhyTypeSet = 0; - - /* Might be legacy client or p2p gc. */ - prStaRec->eStaType = STA_TYPE_LEGACY_CLIENT; - - //4 <4> Parse the IE of Assoc Req Frame Body. - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - switch (IE_ID(pucIE)) { - case ELEM_ID_SSID: - if ((!prIeSsid) && /* NOTE(Kevin): Get SSID once */ - (IE_LEN(pucIE) <= ELEM_MAX_LEN_SSID)) { - prIeSsid = (P_IE_SSID_T)pucIE; - } - break; - - case ELEM_ID_SUP_RATES: - if ((!prIeSupportedRate) && (IE_LEN(pucIE) <= RATE_NUM)) { - prIeSupportedRate = SUP_RATES_IE(pucIE); - } - break; - - case ELEM_ID_EXTENDED_SUP_RATES: - if (!prIeExtSupportedRate) - prIeExtSupportedRate = EXT_SUP_RATES_IE(pucIE); - break; - case ELEM_ID_HT_CAP: - prStaRec->ucPhyTypeSet |= PHY_TYPE_BIT_HT; - break; - case ELEM_ID_RSN: - #if CFG_ENABLE_WIFI_DIRECT && CFG_ENABLE_HOTSPOT_PRIVACY_CHECK - if (prAdapter->fgIsP2PRegistered && IS_STA_IN_P2P(prStaRec)) { - prIeRsn = RSN_IE(pucIE); - rsnParserCheckForRSNCCMPPSK(prAdapter, prIeRsn, &u2StatusCode); - if (u2StatusCode != STATUS_CODE_SUCCESSFUL) { - *pu2StatusCode = u2StatusCode; - return WLAN_STATUS_SUCCESS; - } - } - #endif - break; - case ELEM_ID_VENDOR: - #if CFG_ENABLE_WIFI_DIRECT - { - if ((prAdapter->fgIsP2PRegistered)) { - UINT_8 ucOuiType = 0; - - p2pFuncParseCheckForP2PInfoElem(prAdapter, pucIE, &ucOuiType); - - if (ucOuiType == VENDOR_OUI_TYPE_P2P) { - DBGLOG(P2P, TRACE, ("Target Client is a P2P group client\n")); - prStaRec->eStaType = STA_TYPE_P2P_GC; - } - } - } - #endif - break; - default: - for (i = 0; i < (sizeof(rxAssocReqIETable) / sizeof(VERIFY_IE_ENTRY_T)); i++) { - - if ((IE_ID(pucIE)) == rxAssocReqIETable[i].ucElemID) { - rxAssocReqIETable[i].pfnVarifyIE(prAdapter, prSwRfb, (P_IE_HDR_T)pucIE, &u2StatusCode); - - if (u2StatusCode != STATUS_CODE_SUCCESSFUL) { - *pu2StatusCode = u2StatusCode; - return WLAN_STATUS_SUCCESS; - } - } - } - - break; - } - } /* end of IE_FOR_EACH */ - - // parsing for WMM related information (2010/12/21) - mqmProcessAssocReq( - prAdapter, - prSwRfb, - pucIEStart, - u2IELength); - - do { - if (prIeSsid) { - if (UNEQUAL_SSID(prBssInfo->aucSSID, prBssInfo->ucSSIDLen, - prIeSsid->aucSSID, prIeSsid->ucLength)) { - - u2StatusCode = STATUS_CODE_UNSPECIFIED_FAILURE; - break; - } - } - else { - u2StatusCode = STATUS_CODE_UNSPECIFIED_FAILURE; - break; - } - - prStaRec->u2OperationalRateSet = 0; - prStaRec->u2BSSBasicRateSet = 0; - - if (prIeSupportedRate || prIeExtSupportedRate) { - rateGetRateSetFromIEs(prIeSupportedRate, - prIeExtSupportedRate, - &prStaRec->u2OperationalRateSet, - &u2BSSBasicRateSet, /* Ignore any Basic Bit */ - &fgIsUnknownBssBasicRate); - - if ((prBssInfo->u2BSSBasicRateSet & prStaRec->u2OperationalRateSet) != - prBssInfo->u2BSSBasicRateSet) { - - u2StatusCode = STATUS_CODE_ASSOC_DENIED_RATE_NOT_SUPPORTED; - break; - } - - /* Accpet the Sta, update BSSBasicRateSet from Bss */ - - prStaRec->u2BSSBasicRateSet = prBssInfo->u2BSSBasicRateSet; - - prStaRec->u2DesiredNonHTRateSet = (prStaRec->u2OperationalRateSet & RATE_SET_ALL_ABG); - - if (BAND_2G4 == HIF_RX_HDR_GET_RF_BAND(prSwRfb->prHifRxHdr)) { - #if 0 /* Marked by CMC 20111024 */ - /* check if support 11n */ - if (!(u2BSSBasicRateSet & RATE_SET_BIT_HT_PHY)) { - - if (prStaRec->u2OperationalRateSet & RATE_SET_OFDM) { - prStaRec->ucPhyTypeSet |= PHY_TYPE_BIT_ERP; - } - - - if (!(u2BSSBasicRateSet & RATE_SET_OFDM)) { - if (prStaRec->u2OperationalRateSet & RATE_SET_HR_DSSS) { - prStaRec->ucPhyTypeSet |= PHY_TYPE_BIT_HR_DSSS; - } - - } - - } - #else - if (prStaRec->u2OperationalRateSet & RATE_SET_OFDM) { - prStaRec->ucPhyTypeSet |= PHY_TYPE_BIT_ERP; - } - if (prStaRec->u2OperationalRateSet & RATE_SET_HR_DSSS) { - prStaRec->ucPhyTypeSet |= PHY_TYPE_BIT_HR_DSSS; - } - #endif - } - else { /* (BAND_5G == prBssDesc->eBande) */ - #if 0 /* Marked by CMC 20111024 */ - if (!(u2BSSBasicRateSet & RATE_SET_BIT_HT_PHY)) { - - prStaRec->ucPhyTypeSet |= PHY_TYPE_BIT_OFDM; - } - ASSERT((prStaRec->u2OperationalRateSet & RATE_SET_HR_DSSS) == 0); - #else - if (prStaRec->u2OperationalRateSet & RATE_SET_OFDM) { - prStaRec->ucPhyTypeSet |= PHY_TYPE_BIT_OFDM; - } - #endif - } - - } - else { - ASSERT(0); - u2StatusCode = STATUS_CODE_ASSOC_DENIED_RATE_NOT_SUPPORTED; - break; - } - -#if CFG_ENABLE_WIFI_DIRECT && CFG_ENABLE_HOTSPOT_PRIVACY_CHECK - if (prAdapter->fgIsP2PRegistered && IS_STA_IN_P2P(prStaRec)) { - if (prIeRsn) { - if (!kalP2PGetCipher(prAdapter->prGlueInfo)) { - u2StatusCode = STATUS_CODE_CIPHER_SUITE_REJECTED; - break; - } - } - else { - prStaRec->rSecInfo.fgAllowOnly1x = FALSE; - if (kalP2PGetCipher(prAdapter->prGlueInfo)) { - //Only Allow 1x - prStaRec->rSecInfo.fgAllowOnly1x = TRUE; - break; - } - } - } -#endif - - } while (FALSE); - -#if CFG_ENABLE_WIFI_DIRECT - if (prAdapter->fgIsP2PRegistered && IS_STA_IN_P2P(prStaRec)) { - #if 1 /* ICS */ - { - PUINT_8 cp = (PUINT_8)&prAssocReqFrame->u2CapInfo; - if (prStaRec->fgIsReAssoc) - cp += 10; - else - cp += 4; - if (prStaRec->pucAssocReqIe) { - kalMemFree(prStaRec->pucAssocReqIe, VIR_MEM_TYPE, prStaRec->u2AssocReqIeLen); - prStaRec->pucAssocReqIe = NULL; - } - prStaRec->u2AssocReqIeLen = u2IELength; - if (u2IELength) { - prStaRec->pucAssocReqIe = kalMemAlloc(u2IELength, VIR_MEM_TYPE); - kalMemCopy(prStaRec->pucAssocReqIe, cp, u2IELength); - } - } - #endif - kalP2PUpdateAssocInfo(prAdapter->prGlueInfo, (PUINT_8)&prAssocReqFrame->u2CapInfo, u2IELength + (prStaRec->fgIsReAssoc ? 10 : 4), prStaRec->fgIsReAssoc); - } -#endif - - *pu2StatusCode = u2StatusCode; - - return WLAN_STATUS_SUCCESS; - -} /* end of assocProcessRxAssocReqFrame() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to compose Common Information Elements for Association -* Response Frame. -* -* @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T. -* @param[in] prBssInfo Pointer to the BSS_INFO_T. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -assocBuildReAssocRespFrameCommonIEs ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN P_BSS_INFO_T prBssInfo - ) -{ - PUINT_8 pucBuffer; - P_STA_RECORD_T prStaRec; - UINT_8 ucSupRatesLen; - UINT_8 ucExtSupRatesLen; - - - ASSERT(prMsduInfo); - ASSERT(prMsduInfo->eSrc == TX_PACKET_MGMT); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - ASSERT(prStaRec); - - - pucBuffer = (PUINT_8)((UINT_32)prMsduInfo->prPacket + - (UINT_32)prMsduInfo->u2FrameLength); - ASSERT(pucBuffer); - - if (prBssInfo->ucAllSupportedRatesLen > ELEM_MAX_LEN_SUP_RATES) { - - ucSupRatesLen = ELEM_MAX_LEN_SUP_RATES; - ucExtSupRatesLen = prBssInfo->ucAllSupportedRatesLen - ELEM_MAX_LEN_SUP_RATES; - } - else { - ucSupRatesLen = prBssInfo->ucAllSupportedRatesLen; - ucExtSupRatesLen = 0; - } - - /* Fill the Supported Rates element. */ - if (ucSupRatesLen) { - SUP_RATES_IE(pucBuffer)->ucId = ELEM_ID_SUP_RATES; - SUP_RATES_IE(pucBuffer)->ucLength = ucSupRatesLen; - kalMemCopy(SUP_RATES_IE(pucBuffer)->aucSupportedRates, - prBssInfo->aucAllSupportedRates, - ucSupRatesLen); - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - pucBuffer += IE_SIZE(pucBuffer); - } - - - /* Fill the Extended Supported Rates element. */ - if (ucExtSupRatesLen) { - - EXT_SUP_RATES_IE(pucBuffer)->ucId = ELEM_ID_EXTENDED_SUP_RATES; - EXT_SUP_RATES_IE(pucBuffer)->ucLength = ucExtSupRatesLen; - - kalMemCopy(EXT_SUP_RATES_IE(pucBuffer)->aucExtSupportedRates, - &prBssInfo->aucAllSupportedRates[ucSupRatesLen], - ucExtSupRatesLen); - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - } - - return; -} /* end of assocBuildReAssocRespFrameCommonIEs() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will compose the (Re)Association Response frame -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] pucBuffer Pointer to the frame buffer. -* @param[in] aucBssid Given BSSID. -* @param[in] u2CapInfo Capability Field of current BSS. -* @param[in out] pu2PayloadLen Return the length of the composed fixed fields -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -assocComposeReAssocRespFrameHeaderAndFF ( - IN P_STA_RECORD_T prStaRec, - IN PUINT_8 pucBuffer, - IN UINT_8 aucBSSID[], - IN UINT_16 u2CapInfo, - IN OUT PUINT_16 pu2PayloadLen - ) -{ - P_WLAN_ASSOC_RSP_FRAME_T prAssocRspFrame; - BOOLEAN fgIsReAssoc; - - UINT_16 u2FrameCtrl; - - - ASSERT(prStaRec); - ASSERT(pucBuffer); - ASSERT(aucBSSID); - ASSERT(pu2PayloadLen); - - prAssocRspFrame = (P_WLAN_ASSOC_RSP_FRAME_T)pucBuffer; - fgIsReAssoc = prStaRec->fgIsReAssoc; - - //4 <1> Compose the frame header of the (Re)Association Request frame. - /* Fill the Frame Control field. */ - if (fgIsReAssoc) { - u2FrameCtrl = MAC_FRAME_REASSOC_RSP; - } - else { - u2FrameCtrl = MAC_FRAME_ASSOC_RSP; - } - //WLAN_SET_FIELD_16(&prAssocFrame->u2FrameCtrl, u2FrameCtrl); - prAssocRspFrame->u2FrameCtrl = u2FrameCtrl; // NOTE(Kevin): Optimized for ARM - - /* Fill the DA field with Target MAC Address. */ - COPY_MAC_ADDR(prAssocRspFrame->aucDestAddr, prStaRec->aucMacAddr); - - /* Fill the SA field with current BSSID. */ - COPY_MAC_ADDR(prAssocRspFrame->aucSrcAddr, aucBSSID); - - /* Fill the BSSID field with current BSSID. */ - COPY_MAC_ADDR(prAssocRspFrame->aucBSSID, aucBSSID); - - /* Clear the SEQ/FRAG_NO field(HW won't overide the FRAG_NO, so we need to clear it). */ - prAssocRspFrame->u2SeqCtrl = 0; - - - //4 <2> Compose the frame body's common fixed field part of the (Re)Association Request frame. - /* Fill the Capability Information field. */ - //WLAN_SET_FIELD_16(&prAssocFrame->u2CapInfo, u2CapInfo); - prAssocRspFrame->u2CapInfo = u2CapInfo; // NOTE(Kevin): Optimized for ARM - - //WLAN_SET_FIELD_16(&prAssocFrame->u2StatusCode, prStaRec->u2StatusCode); - prAssocRspFrame->u2StatusCode = prStaRec->u2StatusCode; // NOTE(Kevin): Optimized for ARM - - //WLAN_SET_FIELD_16(&prAssocFrame->u2AssocId, ((prStaRec->u2AssocId & AID_MASK) | AID_MSB)); - prAssocRspFrame->u2AssocId = - ((prStaRec->u2AssocId & AID_MASK) | AID_MSB); // NOTE(Kevin): Optimized for ARM - - *pu2PayloadLen = (CAP_INFO_FIELD_LEN + - STATUS_CODE_FIELD_LEN + - AID_FIELD_LEN); - - return; -} /* end of assocComposeReAssocRespFrameHeaderAndFF() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will send the (Re)Association Resp frame -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @retval WLAN_STATUS_RESOURCES No available resource for frame composing. -* @retval WLAN_STATUS_SUCCESS Successfully send frame to TX Module -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -assocSendReAssocRespFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - P_BSS_INFO_T prBssInfo; - P_MSDU_INFO_T prMsduInfo; - - UINT_16 u2PayloadLen; - UINT_16 u2EstimatedFrameLen; - UINT_16 u2EstimatedExtraIELen; - BOOLEAN fgIsReAssoc; - UINT_32 i; - - - ASSERT(prStaRec); - - - //4 <1> Allocate a PKT_INFO_T for Authentication Frame - fgIsReAssoc = prStaRec->fgIsReAssoc; - - /* Init with MGMT Header Length + Length of Fixed Fields + Common IE Length */ - u2EstimatedFrameLen = MAC_TX_RESERVED_FIELD + \ - WLAN_MAC_MGMT_HEADER_LEN + \ - CAP_INFO_FIELD_LEN + \ - STATUS_CODE_FIELD_LEN + \ - AID_FIELD_LEN + \ - (ELEM_HDR_LEN + ELEM_MAX_LEN_SUP_RATES) + \ - (ELEM_HDR_LEN + (RATE_NUM - ELEM_MAX_LEN_SUP_RATES)); - - /* + Extra IE Length */ - u2EstimatedExtraIELen = 0; - - for (i = 0; i < sizeof(txAssocRespIETable)/sizeof(APPEND_VAR_IE_ENTRY_T); i++) { - if (txAssocRespIETable[i].u2EstimatedFixedIELen != 0) { - u2EstimatedExtraIELen += txAssocRespIETable[i].u2EstimatedFixedIELen; - } - else if (txAssocRespIETable[i].pfnCalculateVariableIELen != NULL) { - u2EstimatedExtraIELen += (UINT_16)txAssocRespIETable[i].pfnCalculateVariableIELen(prAdapter, - prStaRec->ucNetTypeIndex, - prStaRec); - } - - } - - u2EstimatedFrameLen += u2EstimatedExtraIELen; - - /* Allocate a MSDU_INFO_T */ - if ( (prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen)) == NULL) { - DBGLOG(AAA, WARN, ("No PKT_INFO_T for sending (Re)Assoc Response.\n")); - return WLAN_STATUS_RESOURCES; - } - - //4 <2> Compose (Re)Association Request frame header and fixed fields in MSDU_INfO_T. - ASSERT(prStaRec->ucNetTypeIndex != NETWORK_TYPE_AIS_INDEX); - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - - /* Compose Header and Fixed Field */ - assocComposeReAssocRespFrameHeaderAndFF(prStaRec, - (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD), - prBssInfo->aucBSSID, - prBssInfo->u2CapInfo, - &u2PayloadLen); - - //4 <3> Update information of MSDU_INFO_T - ASSERT(prStaRec->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - - prMsduInfo->eSrc = TX_PACKET_MGMT; - prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_MGMT; - prMsduInfo->ucStaRecIndex = prStaRec->ucIndex; - prMsduInfo->ucNetworkType = prStaRec->ucNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_MGMT_HEADER_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = WLAN_MAC_MGMT_HEADER_LEN + u2PayloadLen; - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = aaaFsmRunEventTxDone; - prMsduInfo->fgIsBasicRate = TRUE; - - //4 <4> Compose the frame body's IEs of the (Re)Association Request frame. - assocBuildReAssocRespFrameCommonIEs(prAdapter, prMsduInfo, prBssInfo); - - - //4 <5> Compose IEs in MSDU_INFO_T - - /* Append IE */ - for (i = 0; i < sizeof(txAssocRespIETable)/sizeof(APPEND_VAR_IE_ENTRY_T); i++) { - if (txAssocRespIETable[i].pfnAppendIE) { - txAssocRespIETable[i].pfnAppendIE(prAdapter, prMsduInfo); - } - } - - /* TODO(Kevin): Also release the unused tail room of the composed MMPDU */ - - //4 <6> Enqueue the frame to send this (Re)Association request frame. - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - - return WLAN_STATUS_SUCCESS; - -} /* end of assocSendReAssocRespFrame() */ -#endif /* CFG_SUPPORT_AAA */ - - diff --git a/drivers/net/wireless/mt5931/mgmt/auth.c b/drivers/net/wireless/mt5931/mgmt/auth.c deleted file mode 100755 index 9938ebc09823..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/auth.c +++ /dev/null @@ -1,1350 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/auth.c#1 $ -*/ - -/*! \file "auth.c" - \brief This file includes the authentication-related functions. - - This file includes the authentication-related functions. -*/ - - - -/* -** $Log: auth.c $ - * - * 02 13 2012 cp.wu - * NULL - * show error message only instead of raise assertion when - * received authentication frame is carrying illegal parameters. - * - * 11 09 2011 yuche.tsai - * NULL - * Fix a network index & station record index issue when TX deauth frame. - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 06 22 2011 yuche.tsai - * NULL - * Fix coding error. - * - * 06 20 2011 yuche.tsai - * [WCXRP00000796] [Volunteer Patch][MT6620][Driver] Add BC deauth frame TX feature. - * BC deauth support. - * - * 04 21 2011 terry.wu - * [WCXRP00000674] [MT6620 Wi-Fi][Driver] Refine AAA authSendAuthFrame - * Add network type parameter to authSendAuthFrame. - * - * 04 15 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add BOW short range mode. - * - * 02 08 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * 1. Fix Service Disocvery Logical issue. - * 2. Fix a NULL pointer access violation issue when sending deauthentication packet to a class error station. - * - * 01 24 2011 cp.wu - * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving - * 1. add an extra counter for tracking pending forward frames. - * 2. notify TX service thread as well when there is pending forward frame - * 3. correct build errors leaded by introduction of Wi-Fi direct separation module - * - * 01 21 2011 terry.wu - * [WCXRP00000381] [MT6620 Wi-Fi][Driver] Kernel panic when replying unaccept Auth in AP mode - * In AP mode, use STA_REC_INDEX_NOT_FOUND(0xFE) instead of StaRec index when replying an unaccept Auth frame. - * - * 10 18 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * use definition macro to replace hard-coded constant - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 30 2010 cp.wu - * NULL - * eliminate klockwork errors - * - * 08 16 2010 cp.wu - * NULL - * Replace CFG_SUPPORT_BOW by CFG_ENABLE_BT_OVER_WIFI. - * There is no CFG_SUPPORT_BOW in driver domain source. - * - * 08 16 2010 kevin.huang - * NULL - * Refine AAA functions - * - * 08 03 2010 cp.wu - * NULL - * surpress compilation warning. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 28 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * send MMPDU in basic rate. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * specify correct value for management frames. - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add management dispatching function table. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * auth.c is migrated. - * - * 05 28 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Update authSendDeauthFrame() for correct the value of eNetTypeIndex in MSDU_INFO_T - * - * 05 24 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Check Net is active before sending Deauth frame. - * - * 05 24 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Refine authSendAuthFrame() for NULL STA_RECORD_T case and minimum deauth interval. - * - * 04 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW - * - * 04 19 2010 kevin.huang - * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support - * Add Send Deauth for Class 3 Error and Leave Network Support - * - * 02 23 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Fix compile warning - * - * 02 05 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add debug message for abnormal authentication frame from AP - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * 01 11 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add Deauth and Disassoc Handler - * - * 01 07 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * - * Fix the Debug Label - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * Dec 7 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Update the authComposeAuthFrameHeader() - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the send deauth frame function - * - * Dec 3 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Integrate send Auth with TXM - * - * Nov 24 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Revise MGMT Handler with Retain Status - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ -APPEND_IE_ENTRY_T txAuthIETable[] = { - { (ELEM_HDR_LEN + ELEM_MAX_LEN_CHALLENGE_TEXT), authAddIEChallengeText } -}; - -HANDLE_IE_ENTRY_T rxAuthIETable[] = { - { ELEM_ID_CHALLENGE_TEXT, authHandleIEChallengeText } -}; - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will compose the Authentication frame header and fixed fields. -* -* @param[in] pucBuffer Pointer to the frame buffer. -* @param[in] aucPeerMACAddress Given Peer MAC Address. -* @param[in] aucMACAddress Given Our MAC Address. -* @param[in] u2AuthAlgNum Authentication Algorithm Number -* @param[in] u2TransactionSeqNum Transaction Sequence Number -* @param[in] u2StatusCode Status Code -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -authComposeAuthFrameHeaderAndFF ( - IN PUINT_8 pucBuffer, - IN UINT_8 aucPeerMACAddress[], - IN UINT_8 aucMACAddress[], - IN UINT_16 u2AuthAlgNum, - IN UINT_16 u2TransactionSeqNum, - IN UINT_16 u2StatusCode - ) -{ - P_WLAN_AUTH_FRAME_T prAuthFrame; - UINT_16 u2FrameCtrl; - - - ASSERT(pucBuffer); - ASSERT(aucPeerMACAddress); - ASSERT(aucMACAddress); - - prAuthFrame = (P_WLAN_AUTH_FRAME_T)pucBuffer; - - //4 <1> Compose the frame header of the Authentication frame. - /* Fill the Frame Control field. */ - u2FrameCtrl = MAC_FRAME_AUTH; - - /* If this frame is the third frame in the shared key authentication - * sequence, it shall be encrypted. - */ - if ((u2AuthAlgNum == AUTH_ALGORITHM_NUM_SHARED_KEY) && - (u2TransactionSeqNum == AUTH_TRANSACTION_SEQ_3)) { - - u2FrameCtrl |= MASK_FC_PROTECTED_FRAME; /* HW will also detect this bit for applying encryption */ - } - - //WLAN_SET_FIELD_16(&prAuthFrame->u2FrameCtrl, u2FrameCtrl); - prAuthFrame->u2FrameCtrl = u2FrameCtrl; // NOTE(Kevin): Optimized for ARM - - /* Fill the DA field with Target BSSID. */ - COPY_MAC_ADDR(prAuthFrame->aucDestAddr, aucPeerMACAddress); - - /* Fill the SA field with our MAC Address. */ - COPY_MAC_ADDR(prAuthFrame->aucSrcAddr, aucMACAddress); - - switch (u2TransactionSeqNum) { - case AUTH_TRANSACTION_SEQ_1: - case AUTH_TRANSACTION_SEQ_3: - - /* Fill the BSSID field with Target BSSID. */ - COPY_MAC_ADDR(prAuthFrame->aucBSSID, aucPeerMACAddress); - break; - - case AUTH_TRANSACTION_SEQ_2: - case AUTH_TRANSACTION_SEQ_4: - - /* Fill the BSSID field with Current BSSID. */ - COPY_MAC_ADDR(prAuthFrame->aucBSSID, aucMACAddress); - break; - - default: - ASSERT(0); - } - - /* Clear the SEQ/FRAG_NO field. */ - prAuthFrame->u2SeqCtrl = 0; - - - //4 <2> Compose the frame body's fixed field part of the Authentication frame. - /* Fill the Authentication Algorithm Number field. */ - //WLAN_SET_FIELD_16(&prAuthFrame->u2AuthAlgNum, u2AuthAlgNum); - prAuthFrame->u2AuthAlgNum = u2AuthAlgNum; // NOTE(Kevin): Optimized for ARM - - /* Fill the Authentication Transaction Sequence Number field. */ - //WLAN_SET_FIELD_16(&prAuthFrame->u2AuthTransSeqNo, u2TransactionSeqNum); - prAuthFrame->u2AuthTransSeqNo = u2TransactionSeqNum; // NOTE(Kevin): Optimized for ARM - - /* Fill the Status Code field. */ - //WLAN_SET_FIELD_16(&prAuthFrame->u2StatusCode, u2StatusCode); - prAuthFrame->u2StatusCode = u2StatusCode; // NOTE(Kevin): Optimized for ARM - - return; -} /* end of authComposeAuthFrameHeaderAndFF() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will append Challenge Text IE to the Authentication frame -* -* @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -authAddIEChallengeText ( - IN P_ADAPTER_T prAdapter, - IN OUT P_MSDU_INFO_T prMsduInfo - ) -{ - P_WLAN_AUTH_FRAME_T prAuthFrame; - P_STA_RECORD_T prStaRec; - UINT_16 u2TransactionSeqNum; - - - ASSERT(prMsduInfo); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - if(!prStaRec) { - return; - } - - ASSERT(prStaRec); - - /* For Management, frame header and payload are in a continuous buffer */ - prAuthFrame = (P_WLAN_AUTH_FRAME_T)prMsduInfo->prPacket; - - WLAN_GET_FIELD_16(&prAuthFrame->u2AuthTransSeqNo, &u2TransactionSeqNum) - - /* Only consider SEQ_3 for Challenge Text */ - if ((u2TransactionSeqNum == AUTH_TRANSACTION_SEQ_3) && - (prStaRec->ucAuthAlgNum == AUTH_ALGORITHM_NUM_SHARED_KEY) && - (prStaRec->prChallengeText != NULL)) { - - COPY_IE(((UINT_32)(prMsduInfo->prPacket) + prMsduInfo->u2FrameLength), - (prStaRec->prChallengeText)); - - prMsduInfo->u2FrameLength += IE_SIZE(prStaRec->prChallengeText); - } - - return; - -} /* end of authAddIEChallengeText() */ - - -#if !CFG_SUPPORT_AAA -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will send the Authenticiation frame -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] u2TransactionSeqNum Transaction Sequence Number -* -* @retval WLAN_STATUS_RESOURCES No available resource for frame composing. -* @retval WLAN_STATUS_SUCCESS Successfully send frame to TX Module -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -authSendAuthFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN UINT_16 u2TransactionSeqNum - ) -{ - P_MSDU_INFO_T prMsduInfo; - P_BSS_INFO_T prBssInfo; - UINT_16 u2EstimatedFrameLen; - UINT_16 u2EstimatedExtraIELen; - UINT_16 u2PayloadLen; - UINT_32 i; - - - DBGLOG(SAA, LOUD, ("Send Auth Frame\n")); - - ASSERT(prStaRec); - - //4 <1> Allocate a PKT_INFO_T for Authentication Frame - /* Init with MGMT Header Length + Length of Fixed Fields */ - u2EstimatedFrameLen = (MAC_TX_RESERVED_FIELD + - WLAN_MAC_MGMT_HEADER_LEN + - AUTH_ALGORITHM_NUM_FIELD_LEN + - AUTH_TRANSACTION_SEQENCE_NUM_FIELD_LEN + - STATUS_CODE_FIELD_LEN); - - /* + Extra IE Length */ - u2EstimatedExtraIELen = 0; - - for (i = 0; i < sizeof(txAuthIETable)/sizeof(APPEND_IE_ENTRY_T); i++) { - u2EstimatedExtraIELen += txAuthIETable[i].u2EstimatedIELen; - } - - u2EstimatedFrameLen += u2EstimatedExtraIELen; - - /* Allocate a MSDU_INFO_T */ - if ( (prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen)) == NULL) { - DBGLOG(SAA, WARN, ("No PKT_INFO_T for sending Auth Frame.\n")); - return WLAN_STATUS_RESOURCES; - } - - //4 <2> Compose Authentication Request frame header and fixed fields in MSDU_INfO_T. - ASSERT(prStaRec->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - - /* Compose Header and some Fixed Fields */ - authComposeAuthFrameHeaderAndFF( - (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD), - prStaRec->aucMacAddr, - prBssInfo->aucOwnMacAddr, - prStaRec->ucAuthAlgNum, - u2TransactionSeqNum, - STATUS_CODE_RESERVED); - - u2PayloadLen = (AUTH_ALGORITHM_NUM_FIELD_LEN + - AUTH_TRANSACTION_SEQENCE_NUM_FIELD_LEN + - STATUS_CODE_FIELD_LEN); - - //4 <3> Update information of MSDU_INFO_T - prMsduInfo->eSrc = TX_PACKET_MGMT; - prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_MGMT; - prMsduInfo->ucStaRecIndex = prStaRec->ucIndex; - prMsduInfo->ucNetworkType = prStaRec->ucNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_MGMT_HEADER_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = WLAN_MAC_MGMT_HEADER_LEN + u2PayloadLen; - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = saaFsmRunEventTxDone; - prMsduInfo->fgIsBasicRate = TRUE; - - //4 <4> Compose IEs in MSDU_INFO_T - for (i = 0; i < sizeof(txAuthIETable)/sizeof(APPEND_IE_ENTRY_T); i++) { - if (txAuthIETable[i].pfnAppendIE) { - txAuthIETable[i].pfnAppendIE(prAdapter, prMsduInfo); - } - } - - /* TODO(Kevin): Also release the unused tail room of the composed MMPDU */ - - //4 <6> Inform TXM to send this Authentication frame. - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - - return WLAN_STATUS_SUCCESS; -} /* end of authSendAuthFrame() */ - -#else - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will send the Authenticiation frame -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] u2TransactionSeqNum Transaction Sequence Number -* -* @retval WLAN_STATUS_RESOURCES No available resource for frame composing. -* @retval WLAN_STATUS_SUCCESS Successfully send frame to TX Module -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -authSendAuthFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_SW_RFB_T prFalseAuthSwRfb, - IN UINT_16 u2TransactionSeqNum, - IN UINT_16 u2StatusCode - ) -{ - PUINT_8 pucReceiveAddr; - PUINT_8 pucTransmitAddr; - P_MSDU_INFO_T prMsduInfo; - P_BSS_INFO_T prBssInfo; - /*get from input parameter*/ - //ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex = NETWORK_TYPE_AIS_INDEX; - PFN_TX_DONE_HANDLER pfTxDoneHandler = (PFN_TX_DONE_HANDLER)NULL; - UINT_16 u2EstimatedFrameLen; - UINT_16 u2EstimatedExtraIELen; - UINT_16 u2PayloadLen; - UINT_16 ucAuthAlgNum; - UINT_32 i; - - - DBGLOG(SAA, LOUD, ("Send Auth Frame %d, Status Code = %d\n", - u2TransactionSeqNum, u2StatusCode)); - - //4 <1> Allocate a PKT_INFO_T for Authentication Frame - /* Init with MGMT Header Length + Length of Fixed Fields */ - u2EstimatedFrameLen = (MAC_TX_RESERVED_FIELD + - WLAN_MAC_MGMT_HEADER_LEN + - AUTH_ALGORITHM_NUM_FIELD_LEN + - AUTH_TRANSACTION_SEQENCE_NUM_FIELD_LEN + - STATUS_CODE_FIELD_LEN); - - /* + Extra IE Length */ - u2EstimatedExtraIELen = 0; - - for (i = 0; i < sizeof(txAuthIETable)/sizeof(APPEND_IE_ENTRY_T); i++) { - u2EstimatedExtraIELen += txAuthIETable[i].u2EstimatedIELen; - } - - u2EstimatedFrameLen += u2EstimatedExtraIELen; - - /* Allocate a MSDU_INFO_T */ - if ( (prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen)) == NULL) { - DBGLOG(SAA, WARN, ("No PKT_INFO_T for sending Auth Frame.\n")); - return WLAN_STATUS_RESOURCES; - } - - //4 <2> Compose Authentication Request frame header and fixed fields in MSDU_INfO_T. - if (prStaRec) { - ASSERT(prStaRec->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - - pucTransmitAddr = prBssInfo->aucOwnMacAddr; - - pucReceiveAddr = prStaRec->aucMacAddr; - - ucAuthAlgNum = prStaRec->ucAuthAlgNum; - - switch (u2TransactionSeqNum) { - case AUTH_TRANSACTION_SEQ_1: - case AUTH_TRANSACTION_SEQ_3: - pfTxDoneHandler = saaFsmRunEventTxDone; - break; - - case AUTH_TRANSACTION_SEQ_2: - case AUTH_TRANSACTION_SEQ_4: - pfTxDoneHandler = aaaFsmRunEventTxDone; - break; - } - - } - else { /* For Error Status Code */ - P_WLAN_AUTH_FRAME_T prFalseAuthFrame; - - - ASSERT(prFalseAuthSwRfb); - prFalseAuthFrame = (P_WLAN_AUTH_FRAME_T)prFalseAuthSwRfb->pvHeader; - - ASSERT(u2StatusCode != STATUS_CODE_SUCCESSFUL); - - pucTransmitAddr = prFalseAuthFrame->aucDestAddr; - - pucReceiveAddr = prFalseAuthFrame->aucSrcAddr; - - ucAuthAlgNum = prFalseAuthFrame->u2AuthAlgNum; - - u2TransactionSeqNum = (prFalseAuthFrame->u2AuthTransSeqNo + 1); - } - - /* Compose Header and some Fixed Fields */ - authComposeAuthFrameHeaderAndFF((PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD), - pucReceiveAddr, - pucTransmitAddr, - ucAuthAlgNum, - u2TransactionSeqNum, - u2StatusCode); - - u2PayloadLen = (AUTH_ALGORITHM_NUM_FIELD_LEN + - AUTH_TRANSACTION_SEQENCE_NUM_FIELD_LEN + - STATUS_CODE_FIELD_LEN); - - //4 <3> Update information of MSDU_INFO_T - prMsduInfo->eSrc = TX_PACKET_MGMT; - prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_MGMT; - if(prStaRec) { - prMsduInfo->ucStaRecIndex = prStaRec->ucIndex; - } - else { - prMsduInfo->ucStaRecIndex = STA_REC_INDEX_NOT_FOUND; //false Auth frame - } - prMsduInfo->ucNetworkType = (UINT_8)eNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_MGMT_HEADER_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = WLAN_MAC_MGMT_HEADER_LEN + u2PayloadLen; - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = pfTxDoneHandler; - prMsduInfo->fgIsBasicRate = TRUE; - - //4 <4> Compose IEs in MSDU_INFO_T - for (i = 0; i < sizeof(txAuthIETable)/sizeof(APPEND_IE_ENTRY_T); i++) { - if (txAuthIETable[i].pfnAppendIE) { - txAuthIETable[i].pfnAppendIE(prAdapter, prMsduInfo); - } - } - - /* TODO(Kevin): Also release the unused tail room of the composed MMPDU */ - - //4 <6> Inform TXM to send this Authentication frame. - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - - return WLAN_STATUS_SUCCESS; -} /* end of authSendAuthFrame() */ - -#endif /* CFG_SUPPORT_AAA */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will strictly check the TX Authentication frame for SAA/AAA event -* handling. -* -* @param[in] prMsduInfo Pointer of MSDU_INFO_T -* @param[in] u2TransactionSeqNum Transaction Sequence Number -* -* @retval WLAN_STATUS_FAILURE This is not the frame we should handle at current state. -* @retval WLAN_STATUS_SUCCESS This is the frame we should handle. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -authCheckTxAuthFrame ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN UINT_16 u2TransactionSeqNum - ) -{ - P_WLAN_AUTH_FRAME_T prAuthFrame; - P_STA_RECORD_T prStaRec; - UINT_16 u2TxFrameCtrl; - UINT_16 u2TxAuthAlgNum; - UINT_16 u2TxTransactionSeqNum; - - - ASSERT(prMsduInfo); - - prAuthFrame = (P_WLAN_AUTH_FRAME_T)(prMsduInfo->prPacket); - ASSERT(prAuthFrame); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - ASSERT(prStaRec); - - if(!prStaRec) { - return WLAN_STATUS_INVALID_PACKET; - } - - //WLAN_GET_FIELD_16(&prAuthFrame->u2FrameCtrl, &u2TxFrameCtrl) - u2TxFrameCtrl = prAuthFrame->u2FrameCtrl; // NOTE(Kevin): Optimized for ARM - u2TxFrameCtrl &= MASK_FRAME_TYPE; - if (u2TxFrameCtrl != MAC_FRAME_AUTH) { - return WLAN_STATUS_FAILURE; - } - - //WLAN_GET_FIELD_16(&prAuthFrame->u2AuthAlgNum, &u2TxAuthAlgNum) - u2TxAuthAlgNum = prAuthFrame->u2AuthAlgNum; // NOTE(Kevin): Optimized for ARM - if (u2TxAuthAlgNum != (UINT_16)(prStaRec->ucAuthAlgNum)) { - return WLAN_STATUS_FAILURE; - } - - //WLAN_GET_FIELD_16(&prAuthFrame->u2AuthTransSeqNo, &u2TxTransactionSeqNum) - u2TxTransactionSeqNum = prAuthFrame->u2AuthTransSeqNo; // NOTE(Kevin): Optimized for ARM - if (u2TxTransactionSeqNum != u2TransactionSeqNum) { - return WLAN_STATUS_FAILURE; - } - - return WLAN_STATUS_SUCCESS; - -} /* end of authCheckTxAuthFrame() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will check the incoming Auth Frame's Transaction Sequence -* Number before delivering it to the corresponding SAA or AAA Module. -* -* @param[in] prSwRfb Pointer to the SW_RFB_T structure. -* -* @retval WLAN_STATUS_SUCCESS Always not retain authentication frames -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -authCheckRxAuthFrameTransSeq ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_WLAN_AUTH_FRAME_T prAuthFrame; - UINT_16 u2RxTransactionSeqNum; - - - ASSERT(prSwRfb); - - //4 <1> locate the Authentication Frame. - prAuthFrame = (P_WLAN_AUTH_FRAME_T) prSwRfb->pvHeader; - - //4 <2> Parse the Header of Authentication Frame. - if ((prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen) < (AUTH_ALGORITHM_NUM_FIELD_LEN + - AUTH_TRANSACTION_SEQENCE_NUM_FIELD_LEN + - STATUS_CODE_FIELD_LEN)) { - ASSERT(0); - return WLAN_STATUS_SUCCESS; - } - - //4 <3> Parse the Fixed Fields of Authentication Frame Body. - //WLAN_GET_FIELD_16(&prAuthFrame->u2AuthTransSeqNo, &u2RxTransactionSeqNum); - u2RxTransactionSeqNum = prAuthFrame->u2AuthTransSeqNo; // NOTE(Kevin): Optimized for ARM - - switch (u2RxTransactionSeqNum) { - case AUTH_TRANSACTION_SEQ_2: - case AUTH_TRANSACTION_SEQ_4: - saaFsmRunEventRxAuth(prAdapter, prSwRfb); - break; - - case AUTH_TRANSACTION_SEQ_1: - case AUTH_TRANSACTION_SEQ_3: -#if CFG_SUPPORT_AAA - aaaFsmRunEventRxAuth(prAdapter, prSwRfb); -#endif /* CFG_SUPPORT_AAA */ - break; - - default: - DBGLOG(SAA, WARN, ("Strange Authentication Packet: Auth Trans Seq No = %d, Error Status Code = %d\n", - u2RxTransactionSeqNum, prAuthFrame->u2StatusCode)); - break; - } - - return WLAN_STATUS_SUCCESS; - -} /* end of authCheckRxAuthFrameTransSeq() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will validate the incoming Authentication Frame and take -* the status code out. -* -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[in] u2TransactionSeqNum Transaction Sequence Number -* @param[out] pu2StatusCode Pointer to store the Status Code from Authentication. -* -* @retval WLAN_STATUS_FAILURE This is not the frame we should handle at current state. -* @retval WLAN_STATUS_SUCCESS This is the frame we should handle. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -authCheckRxAuthFrameStatus ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN UINT_16 u2TransactionSeqNum, - OUT PUINT_16 pu2StatusCode - ) -{ - P_STA_RECORD_T prStaRec; - P_WLAN_AUTH_FRAME_T prAuthFrame; - UINT_16 u2RxAuthAlgNum; - UINT_16 u2RxTransactionSeqNum; - //UINT_16 u2RxStatusCode; // NOTE(Kevin): Optimized for ARM - - - ASSERT(prSwRfb); - ASSERT(pu2StatusCode); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - ASSERT(prStaRec); - - if(!prStaRec) { - return WLAN_STATUS_INVALID_PACKET; - } - - //4 <1> locate the Authentication Frame. - prAuthFrame = (P_WLAN_AUTH_FRAME_T) prSwRfb->pvHeader; - - //4 <2> Parse the Fixed Fields of Authentication Frame Body. - //WLAN_GET_FIELD_16(&prAuthFrame->u2AuthAlgNum, &u2RxAuthAlgNum); - u2RxAuthAlgNum = prAuthFrame->u2AuthAlgNum; // NOTE(Kevin): Optimized for ARM - if (u2RxAuthAlgNum != (UINT_16)prStaRec->ucAuthAlgNum) { - DBGLOG(SAA, LOUD, ("Discard Auth frame with auth type = %d, current = %d\n", - u2RxAuthAlgNum, prStaRec->ucAuthAlgNum)); - return WLAN_STATUS_FAILURE; - } - - //WLAN_GET_FIELD_16(&prAuthFrame->u2AuthTransSeqNo, &u2RxTransactionSeqNum); - u2RxTransactionSeqNum = prAuthFrame->u2AuthTransSeqNo; // NOTE(Kevin): Optimized for ARM - if (u2RxTransactionSeqNum != u2TransactionSeqNum) { - DBGLOG(SAA, LOUD, ("Discard Auth frame with Transaction Seq No = %d\n", - u2RxTransactionSeqNum)); - return WLAN_STATUS_FAILURE; - } - - //4 <3> Get the Status code - //WLAN_GET_FIELD_16(&prAuthFrame->u2StatusCode, &u2RxStatusCode); - //*pu2StatusCode = u2RxStatusCode; - *pu2StatusCode = prAuthFrame->u2StatusCode; // NOTE(Kevin): Optimized for ARM - - return WLAN_STATUS_SUCCESS; - -} /* end of authCheckRxAuthFrameStatus() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will handle the Challenge Text IE from the Authentication frame -* -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[in] prIEHdr Pointer to start address of IE -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -authHandleIEChallengeText ( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb, - P_IE_HDR_T prIEHdr - ) -{ - P_WLAN_AUTH_FRAME_T prAuthFrame; - P_STA_RECORD_T prStaRec; - UINT_16 u2TransactionSeqNum; - - - ASSERT(prSwRfb); - ASSERT(prIEHdr); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - ASSERT(prStaRec); - - if(!prStaRec) { - return; - } - - /* For Management, frame header and payload are in a continuous buffer */ - prAuthFrame = (P_WLAN_AUTH_FRAME_T)prSwRfb->pvHeader; - - //WLAN_GET_FIELD_16(&prAuthFrame->u2AuthTransSeqNo, &u2TransactionSeqNum) - u2TransactionSeqNum = prAuthFrame->u2AuthTransSeqNo; // NOTE(Kevin): Optimized for ARM - - /* Only consider SEQ_2 for Challenge Text */ - if ((u2TransactionSeqNum == AUTH_TRANSACTION_SEQ_2) && - (prStaRec->ucAuthAlgNum == AUTH_ALGORITHM_NUM_SHARED_KEY)) { - - /* Free previous allocated TCM memory */ - if (prStaRec->prChallengeText) { - ASSERT(0); - cnmMemFree(prAdapter, prStaRec->prChallengeText); - prStaRec->prChallengeText = (P_IE_CHALLENGE_TEXT_T)NULL; - } - - if ( ( prStaRec->prChallengeText = cnmMemAlloc(prAdapter, RAM_TYPE_MSG, IE_SIZE(prIEHdr)) ) == NULL) { - return; - } - - /* Save the Challenge Text from Auth Seq 2 Frame, before sending Auth Seq 3 Frame */ - COPY_IE(prStaRec->prChallengeText, prIEHdr); - } - - return; - -} /* end of authAddIEChallengeText() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will parse and process the incoming Authentication frame. -* -* @param[in] prSwRfb Pointer to SW RFB data structure. -* -* @retval WLAN_STATUS_SUCCESS This is the frame we should handle. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -authProcessRxAuth2_Auth4Frame ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_WLAN_AUTH_FRAME_T prAuthFrame; - PUINT_8 pucIEsBuffer; - UINT_16 u2IEsLen; - UINT_16 u2Offset; - UINT_8 ucIEID; - UINT_32 i; - - - ASSERT(prSwRfb); - - prAuthFrame = (P_WLAN_AUTH_FRAME_T) prSwRfb->pvHeader; - - pucIEsBuffer = &prAuthFrame->aucInfoElem[0]; - u2IEsLen = (prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen) - - (AUTH_ALGORITHM_NUM_FIELD_LEN + - AUTH_TRANSACTION_SEQENCE_NUM_FIELD_LEN + - STATUS_CODE_FIELD_LEN); - - IE_FOR_EACH(pucIEsBuffer, u2IEsLen, u2Offset) { - ucIEID = IE_ID(pucIEsBuffer); - - for (i = 0; i < (sizeof(rxAuthIETable) / sizeof(HANDLE_IE_ENTRY_T)); i++) { - - if (ucIEID == rxAuthIETable[i].ucElemID) { - rxAuthIETable[i].pfnHandleIE(prAdapter, prSwRfb, (P_IE_HDR_T)pucIEsBuffer); - } - } - } - - return WLAN_STATUS_SUCCESS; - -} /* end of authProcessRxAuth2_Auth4Frame() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will compose the Deauthentication frame -* -* @param[in] pucBuffer Pointer to the frame buffer. -* @param[in] aucPeerMACAddress Given Peer MAC Address. -* @param[in] aucMACAddress Given Our MAC Address. -* @param[in] u2StatusCode Status Code -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -authComposeDeauthFrameHeaderAndFF ( - IN PUINT_8 pucBuffer, - IN UINT_8 aucPeerMACAddress[], - IN UINT_8 aucMACAddress[], - IN UINT_8 aucBssid[], - IN UINT_16 u2ReasonCode - ) -{ - P_WLAN_DEAUTH_FRAME_T prDeauthFrame; - UINT_16 u2FrameCtrl; - - ASSERT(pucBuffer); - ASSERT(aucPeerMACAddress); - ASSERT(aucMACAddress); - ASSERT(aucBssid); - - prDeauthFrame = (P_WLAN_DEAUTH_FRAME_T)pucBuffer; - - //4 <1> Compose the frame header of the Deauthentication frame. - /* Fill the Frame Control field. */ - u2FrameCtrl = MAC_FRAME_DEAUTH; - - //WLAN_SET_FIELD_16(&prDeauthFrame->u2FrameCtrl, u2FrameCtrl); - prDeauthFrame->u2FrameCtrl = u2FrameCtrl; // NOTE(Kevin): Optimized for ARM - - /* Fill the DA field with Target BSSID. */ - COPY_MAC_ADDR(prDeauthFrame->aucDestAddr, aucPeerMACAddress); - - /* Fill the SA field with our MAC Address. */ - COPY_MAC_ADDR(prDeauthFrame->aucSrcAddr, aucMACAddress); - - /* Fill the BSSID field with Target BSSID. */ - COPY_MAC_ADDR(prDeauthFrame->aucBSSID, aucBssid); - - /* Clear the SEQ/FRAG_NO field(HW won't overide the FRAG_NO, so we need to clear it). */ - prDeauthFrame->u2SeqCtrl = 0; - - //4 <2> Compose the frame body's fixed field part of the Authentication frame. - /* Fill the Status Code field. */ - //WLAN_SET_FIELD_16(&prDeauthFrame->u2ReasonCode, u2ReasonCode); - prDeauthFrame->u2ReasonCode = u2ReasonCode; // NOTE(Kevin): Optimized for ARM - - return; -} /* end of authComposeDeauthFrameHeaderAndFF() */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will send the Deauthenticiation frame -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] prClassErrSwRfb Pointer to the SW_RFB_T which is Class Error. -* @param[in] u2ReasonCode A reason code to indicate why to leave BSS. -* @param[in] pfTxDoneHandler TX Done call back function -* -* @retval WLAN_STATUS_RESOURCES No available resource for frame composing. -* @retval WLAN_STATUS_SUCCESS Successfully send frame to TX Module -* @retval WLAN_STATUS_FAILURE Didn't send Deauth frame for various reasons. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -authSendDeauthFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prClassErrSwRfb, - IN UINT_16 u2ReasonCode, - IN PFN_TX_DONE_HANDLER pfTxDoneHandler - ) -{ - P_WLAN_MAC_HEADER_A4_T prWlanMacHeader = NULL; - PUINT_8 pucReceiveAddr; - PUINT_8 pucTransmitAddr; - PUINT_8 pucBssid = NULL; - - ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex = NETWORK_TYPE_AIS_INDEX; - P_MSDU_INFO_T prMsduInfo; - UINT_16 u2EstimatedFrameLen; - UINT_16 u2RxFrameCtrl; - P_BSS_INFO_T prBssInfo; - - P_DEAUTH_INFO_T prDeauthInfo; - OS_SYSTIME rCurrentTime; - INT_32 i4NewEntryIndex, i; - UINT_8 ucStaRecIdx = STA_REC_INDEX_NOT_FOUND; - -#if CFG_ENABLE_WIFI_DIRECT - UINT_8 aucBMC[] = BC_MAC_ADDR; -#endif - - /* NOTE(Kevin): The best way to reply the Deauth is according to the incoming data - * frame - */ - //4 <1> Find the Receiver Address first. - if (prClassErrSwRfb) { - BOOLEAN fgIsAbleToSendDeauth = FALSE; - - prWlanMacHeader = (P_WLAN_MAC_HEADER_A4_T) prClassErrSwRfb->pvHeader; - - //WLAN_GET_FIELD_16(&prWlanMacHeader->u2FrameCtrl, &u2RxFrameCtrl); - u2RxFrameCtrl = prWlanMacHeader->u2FrameCtrl; // NOTE(Kevin): Optimized for ARM - - /* TODO(Kevin): Currently we won't send Deauth for IBSS node. How about DLS ? */ - if ((prWlanMacHeader->u2FrameCtrl & MASK_TO_DS_FROM_DS) == 0) { - return WLAN_STATUS_FAILURE; - } - - /* Check if corresponding BSS is able to send Deauth */ - for (i = NETWORK_TYPE_AIS_INDEX; i < NETWORK_TYPE_INDEX_NUM; i++) { - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[i]); - - if (IS_NET_ACTIVE(prAdapter, i) && - (EQUAL_MAC_ADDR(prWlanMacHeader->aucAddr1, prBssInfo->aucOwnMacAddr))) { - { - fgIsAbleToSendDeauth = TRUE; - eNetTypeIndex = (ENUM_NETWORK_TYPE_INDEX_T)i; - break; - } - } - } - - if (!fgIsAbleToSendDeauth) { - return WLAN_STATUS_FAILURE; - } - - pucReceiveAddr = prWlanMacHeader->aucAddr2; - - } - else if (prStaRec) { - - pucReceiveAddr = prStaRec->aucMacAddr; - } - else { -#if CFG_ENABLE_WIFI_DIRECT - pucReceiveAddr = aucBMC; -#else - return WLAN_STATUS_FAILURE; -#endif - } - - //4 <2> Check if already send a Deauth frame in MIN_DEAUTH_INTERVAL_MSEC - GET_CURRENT_SYSTIME(&rCurrentTime); - - i4NewEntryIndex = -1; - for (i = 0; i < MAX_DEAUTH_INFO_COUNT; i++) { - prDeauthInfo = &(prAdapter->rWifiVar.arDeauthInfo[i]); - - - /* For continuously sending Deauth frame, the minimum interval is - * MIN_DEAUTH_INTERVAL_MSEC. - */ - if (CHECK_FOR_TIMEOUT(rCurrentTime, - prDeauthInfo->rLastSendTime, - MSEC_TO_SYSTIME(MIN_DEAUTH_INTERVAL_MSEC))) { - - i4NewEntryIndex = i; - } - else if (EQUAL_MAC_ADDR(pucReceiveAddr, prDeauthInfo->aucRxAddr) && - (!pfTxDoneHandler)) { - - return WLAN_STATUS_FAILURE; - } - } - - //4 <3> Update information. - if (i4NewEntryIndex > 0) { - - prDeauthInfo = &(prAdapter->rWifiVar.arDeauthInfo[i4NewEntryIndex]); - - COPY_MAC_ADDR(prDeauthInfo->aucRxAddr, pucReceiveAddr); - prDeauthInfo->rLastSendTime = rCurrentTime; - } - else { - /* NOTE(Kevin): for the case of AP mode, we may encounter this case - * if deauth all the associated clients. - */ - DBGLOG(SAA, WARN, ("No unused DEAUTH_INFO_T !\n")); - } - - //4 <4> Allocate a PKT_INFO_T for Deauthentication Frame - /* Init with MGMT Header Length + Length of Fixed Fields + IE Length */ - u2EstimatedFrameLen = (MAC_TX_RESERVED_FIELD + - WLAN_MAC_MGMT_HEADER_LEN + - REASON_CODE_FIELD_LEN); - - /* Allocate a MSDU_INFO_T */ - if ( (prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen)) == NULL) { - DBGLOG(SAA, WARN, ("No PKT_INFO_T for sending Deauth Request.\n")); - return WLAN_STATUS_RESOURCES; - } - - //4 <5> Find the Transmitter Address and BSSID. - if (prClassErrSwRfb) { - - /* The TA of Deauth is the A1 of RX frame */ - pucTransmitAddr = prWlanMacHeader->aucAddr1; - - switch (prWlanMacHeader->u2FrameCtrl & MASK_TO_DS_FROM_DS) { - - case MASK_FC_FROM_DS: - /* The BSSID of Deauth is the A2 of RX frame */ - pucBssid = prWlanMacHeader->aucAddr2; - break; - - case MASK_FC_TO_DS: - /* The BSSID of Deauth is the A1 of RX frame */ - pucBssid = prWlanMacHeader->aucAddr1; - break; - - case MASK_TO_DS_FROM_DS: - /* TODO(Kevin): Consider BOW, now we set the BSSID of Deauth - * to the A2 of RX frame for temporary solution. - */ - pucBssid = prWlanMacHeader->aucAddr2; - break; - - /* No Default */ - } - - } - else if (prStaRec) { - eNetTypeIndex = prStaRec->ucNetTypeIndex; - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[eNetTypeIndex]); - - pucTransmitAddr = prBssInfo->aucOwnMacAddr; - - pucBssid = prBssInfo->aucBSSID; - } -#if CFG_ENABLE_WIFI_DIRECT - else { - if (prAdapter->fgIsP2PRegistered) { - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - ucStaRecIdx = STA_REC_INDEX_BMCAST; - - pucTransmitAddr = prBssInfo->aucOwnMacAddr; - - pucBssid = prBssInfo->aucBSSID; - - eNetTypeIndex = NETWORK_TYPE_P2P_INDEX; - } - else { - return WLAN_STATUS_FAILURE; - } - } - -#endif - - //4 <6> compose Deauthentication frame header and some fixed fields */ - authComposeDeauthFrameHeaderAndFF( - (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD), - pucReceiveAddr, - pucTransmitAddr, - pucBssid, - u2ReasonCode); - -#if CFG_SUPPORT_802_11W - if (rsnCheckBipKeyInstalled(prAdapter, prStaRec)) { - P_WLAN_DEAUTH_FRAME_T prDeauthFrame; - - prDeauthFrame = (P_WLAN_DEAUTH_FRAME_T)(PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD); - - prDeauthFrame->u2FrameCtrl |= MASK_FC_PROTECTED_FRAME; - DBGLOG(TX, WARN, ("authSendDeauthFrame with protection\n")); - } -#endif - - //4 <7> Update information of MSDU_INFO_T - prMsduInfo->eSrc = TX_PACKET_MGMT; - prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_MGMT; - prMsduInfo->ucStaRecIndex = ((prStaRec == NULL)?ucStaRecIdx:prStaRec->ucIndex); - prMsduInfo->ucNetworkType = (UINT_8)eNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_MGMT_HEADER_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = WLAN_MAC_MGMT_HEADER_LEN + REASON_CODE_FIELD_LEN; - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = pfTxDoneHandler; - prMsduInfo->fgIsBasicRate = TRUE; - - //4 <8> Inform TXM to send this Deauthentication frame. - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - - return WLAN_STATUS_SUCCESS; -} /* end of authSendDeauthFrame() */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will parse and process the incoming Deauthentication frame -* if the given BSSID is matched. -* -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[in] aucBSSID Given BSSID -* @param[out] pu2ReasonCode Pointer to store the Reason Code from Deauthentication. -* -* @retval WLAN_STATUS_FAILURE This is not the frame we should handle at current state. -* @retval WLAN_STATUS_SUCCESS This is the frame we should handle. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -authProcessRxDeauthFrame ( - IN P_SW_RFB_T prSwRfb, - IN UINT_8 aucBSSID[], - OUT PUINT_16 pu2ReasonCode - ) -{ - P_WLAN_DEAUTH_FRAME_T prDeauthFrame; - UINT_16 u2RxReasonCode; - - - ASSERT(prSwRfb); - ASSERT(aucBSSID); - ASSERT(pu2ReasonCode); - - //4 <1> locate the Deauthentication Frame. - prDeauthFrame = (P_WLAN_DEAUTH_FRAME_T) prSwRfb->pvHeader; - - //4 <2> Parse the Header of Deauthentication Frame. -#if 0 // Kevin: Seems redundant - WLAN_GET_FIELD_16(&prDeauthFrame->u2FrameCtrl, &u2RxFrameCtrl) - u2RxFrameCtrl &= MASK_FRAME_TYPE; - if (u2RxFrameCtrl != MAC_FRAME_DEAUTH) { - return WLAN_STATUS_FAILURE; - } -#endif - - if ((prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen) < REASON_CODE_FIELD_LEN) { - ASSERT(0); - return WLAN_STATUS_FAILURE; - } - - /* Check if this Deauth Frame is coming from Target BSSID */ - if (UNEQUAL_MAC_ADDR(prDeauthFrame->aucBSSID, aucBSSID)) { - DBGLOG(SAA, LOUD, ("Ignore Deauth Frame from other BSS ["MACSTR"]\n", - MAC2STR(prDeauthFrame->aucSrcAddr))); - return WLAN_STATUS_FAILURE; - } - - //4 <3> Parse the Fixed Fields of Deauthentication Frame Body. - WLAN_GET_FIELD_16(&prDeauthFrame->u2ReasonCode, &u2RxReasonCode); - *pu2ReasonCode = u2RxReasonCode; - - return WLAN_STATUS_SUCCESS; - -} /* end of authProcessRxDeauthFrame() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will parse and process the incoming Authentication frame. -* -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[in] aucExpectedBSSID Given Expected BSSID. -* @param[in] u2ExpectedAuthAlgNum Given Expected Authentication Algorithm Number -* @param[in] u2ExpectedTransSeqNum Given Expected Transaction Sequence Number. -* @param[out] pu2ReturnStatusCode Return Status Code. -* -* @retval WLAN_STATUS_SUCCESS This is the frame we should handle. -* @retval WLAN_STATUS_FAILURE The frame we will ignore. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -authProcessRxAuth1Frame ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN UINT_8 aucExpectedBSSID[], - IN UINT_16 u2ExpectedAuthAlgNum, - IN UINT_16 u2ExpectedTransSeqNum, - OUT PUINT_16 pu2ReturnStatusCode - ) -{ - P_WLAN_AUTH_FRAME_T prAuthFrame; - UINT_16 u2ReturnStatusCode = STATUS_CODE_SUCCESSFUL; - - - ASSERT(prSwRfb); - ASSERT(aucExpectedBSSID); - ASSERT(pu2ReturnStatusCode); - - //4 <1> locate the Authentication Frame. - prAuthFrame = (P_WLAN_AUTH_FRAME_T) prSwRfb->pvHeader; - - //4 <2> Check the BSSID - if (UNEQUAL_MAC_ADDR(prAuthFrame->aucBSSID, aucExpectedBSSID)) { - return WLAN_STATUS_FAILURE; /* Just Ignore this MMPDU */ - } - - //4 <3> Parse the Fixed Fields of Authentication Frame Body. - if (prAuthFrame->u2AuthAlgNum != u2ExpectedAuthAlgNum) { - u2ReturnStatusCode = STATUS_CODE_AUTH_ALGORITHM_NOT_SUPPORTED; - } - - if (prAuthFrame->u2AuthTransSeqNo != u2ExpectedTransSeqNum) { - u2ReturnStatusCode = STATUS_CODE_AUTH_OUT_OF_SEQ; - } - - *pu2ReturnStatusCode = u2ReturnStatusCode; - - return WLAN_STATUS_SUCCESS; - -} /* end of authProcessRxAuth1Frame() */ - - diff --git a/drivers/net/wireless/mt5931/mgmt/bss.c b/drivers/net/wireless/mt5931/mgmt/bss.c deleted file mode 100755 index 263f18b88eb7..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/bss.c +++ /dev/null @@ -1,2776 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/bss.c#3 $ -*/ - -/*! \file "bss.c" - \brief This file contains the functions for creating BSS(AP)/IBSS(AdHoc). - - This file contains the functions for BSS(AP)/IBSS(AdHoc). We may create a BSS/IBSS - network, or merge with exist IBSS network and sending Beacon Frame or reply - the Probe Response Frame for received Probe Request Frame. -*/ - - - -/* -** $Log: bss.c $ -** -** 08 29 2012 chinglan.wang -** [ALPS00349664] [6577JB][WIFI] Phone can not connect to AP secured with AES via WPS in 802.11n Only -** . -** -** 07 26 2012 yuche.tsai -** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot -** Update driver code of ALPS.JB for hot-spot. - * - * 07 17 2012 yuche.tsai - * NULL - * Let netdev bring up. - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 06 14 2012 chinglan.wang - * NULL - * Fix the losing of the HT IE in assoc request.. - * - * 06 13 2012 yuche.tsai - * NULL - * Update maintrunk driver. - * Add support for driver compose assoc request frame. - * - * 03 08 2012 yuche.tsai - * NULL - * Fix FW assert when start Hot-Spot. - * - * 03 02 2012 terry.wu - * NULL - * Snc CFG80211 modification for ICS migration from branch 2.2. - * - * 01 20 2012 chinglan.wang - * 03 02 2012 terry.wu - * NULL - * Fix the WPA-PSK TKIP and WPA2-PSK AES security mode bug. - * - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 01 15 2012 yuche.tsai - * NULL - * Fix wrong basic rate issue. - * - * 01 13 2012 yuche.tsai - * NULL - * WiFi Hot Spot Tethering for ICS ALPHA testing version. - * - * 11 03 2011 cm.chang - * [WCXRP00000997] [MT6620 Wi-Fi][Driver][FW] Handle change of BSS preamble type and slot time - * Always set short slot time to TRUE initially in AP mode - * - * 11 03 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * change the DBGLOG for "\n" and "\r\n". LABEL to LOUD for XLOG - * - * 09 14 2011 yuche.tsai - * NULL - * Add P2P IE in assoc response. - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 04 12 2011 eddie.chen - * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma - * Fix the sta index in processing security frame - * Simple flow control for TC4 to avoid mgt frames for PS STA to occupy the TC4 - * Add debug message. - * - * 04 08 2011 eddie.chen - * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma - * Fix for sigma - * - * 03 29 2011 eddie.chen - * [WCXRP00000608] [MT6620 Wi-Fi][DRV] Change wmm parameters in beacon - * Change wmm parameters in beacon. - * - * 03 29 2011 yuche.tsai - * [WCXRP00000607] [Volunteer Patch][MT6620][Driver] Coding Style Fix for klocwork scan. - * Fix klocwork issue. - * - * 03 19 2011 yuche.tsai - * [WCXRP00000581] [Volunteer Patch][MT6620][Driver] P2P IE in Assoc Req Issue - * Make assoc req to append P2P IE if wifi direct is enabled. - * - * 03 11 2011 chinglan.wang - * [WCXRP00000537] [MT6620 Wi-Fi][Driver] Can not connect to 802.11b/g/n mixed AP with WEP security. - * . - * - * 03 03 2011 george.huang - * [WCXRP00000508] [MT6620 Wi-Fi][Driver] aware of beacon MSDU will be free, after BSS deactivated - * . - * - * 03 03 2011 george.huang - * [WCXRP00000508] [MT6620 Wi-Fi][Driver] aware of beacon MSDU will be free, after BSS deactivated - * modify to handle if beacon MSDU been released when BSS deactivated - * - * 03 02 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * add code to let the beacon and probe response for Auto GO WSC . - * - * 03 02 2011 wh.su - * [WCXRP00000448] [MT6620 Wi-Fi][Driver] Fixed WSC IE not send out at probe request - * Add code to send beacon and probe response WSC IE at Auto GO. - * - * 02 17 2011 eddie.chen - * [WCXRP00000458] [MT6620 Wi-Fi][Driver] BOW Concurrent - ProbeResp was exist in other channel - * 1) Chnage GetFrameAction decision when BSS is absent. - * 2) Check channel and resource in processing ProbeRequest - * - * 02 12 2011 yuche.tsai - * [WCXRP00000441] [Volunteer Patch][MT6620][Driver] BoW can not create desired station type when Hot Spot is enabled. - * bss should create station record type according to callers input. - * - * 02 11 2011 terry.wu - * [WCXRP00000383] [MT6620 Wi-Fi][Driver] Separate WiFi and P2P driver into two modules - * In p2p link function, check networktype before calling p2p function. - * - * 02 11 2011 terry.wu - * [WCXRP00000383] [MT6620 Wi-Fi][Driver] Separate WiFi and P2P driver into two modules - * Modify p2p link function to avoid assert. - * - * 01 26 2011 cm.chang - * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument - * . - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Change Station Type in Station Record, Modify MACRO definition for getting station type & network type index & Role. - * - * 01 25 2011 eddie.chen - * [WCXRP00000385] [MT6620 Wi-Fi][DRV] Add destination decision for forwarding packets - * Fix the compile error in windows. - * - * 01 24 2011 eddie.chen - * [WCXRP00000385] [MT6620 Wi-Fi][DRV] Add destination decision for forwarding packets - * Add destination decision in AP mode. - * - * 01 24 2011 terry.wu - * [WCXRP00000383] [MT6620 Wi-Fi][Driver] Separate WiFi and P2P driver into two modules - * .Fix typo and missing entry - * - * 12 30 2010 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, - -Add per station flow control when STA is in PS - - - * Fix prBssInfo->aucCWminLog to prBssInfo->aucCWminLogForBcast - * - * 12 29 2010 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, - -Add per station flow control when STA is in PS - - - * Add WMM parameter for broadcast. - * - * 12 29 2010 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, -Add per station flow control when STA is in PS - - * 1) PS flow control event - * - * 2) WMM IE in beacon, assoc resp, probe resp - * - * 11 29 2010 cp.wu - * [WCXRP00000210] [MT6620 Wi-Fi][Driver][FW] Set RCPI value in STA_REC for initial TX rate selection of auto-rate algorithm - * update ucRcpi of STA_RECORD_T for AIS when - * 1) Beacons for IBSS merge is received - * 2) Associate Response for a connecting peer is received - * - * 10 18 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * use definition macro to replace hard-coded constant - * - * 10 08 2010 wh.su - * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine - * update the frog's new p2p state machine. - * - * 09 28 2010 wh.su - * NULL - * [WCXRP00000069][MT6620 Wi-Fi][Driver] Fix some code for phase 1 P2P Demo. - * - * 09 27 2010 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000065] Update BoW design and settings - * Update BCM/BoW design and settings. - * - * 09 16 2010 cm.chang - * NULL - * Change conditional compiling options for BOW - * - * 09 10 2010 cm.chang - * NULL - * Always update Beacon content if FW sync OBSS info - * - * 09 07 2010 wh.su - * NULL - * adding the code for beacon/probe req/ probe rsp wsc ie at p2p. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 31 2010 kevin.huang - * NULL - * Use LINK LIST operation to process SCAN result - * - * 08 30 2010 cp.wu - * NULL - * eliminate klockwork errors - * - * 08 29 2010 yuche.tsai - * NULL - * Finish SLT TX/RX & Rate Changing Support. - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 08 16 2010 yuche.tsai - * NULL - * Before composing Beacon IE, assign network type index for msdu info, - * this information is needed by RLM module while composing some RLM related IE field. - * - * 08 16 2010 cp.wu - * NULL - * Replace CFG_SUPPORT_BOW by CFG_ENABLE_BT_OVER_WIFI. - * There is no CFG_SUPPORT_BOW in driver domain source. - * - * 08 16 2010 kevin.huang - * NULL - * Refine AAA functions - * - * 08 12 2010 kevin.huang - * NULL - * Fix undefined pucDestAddr in bssUpdateBeaconContent() - * - * 08 12 2010 kevin.huang - * NULL - * Refine bssProcessProbeRequest() and bssSendBeaconProbeResponse() - * - * 08 11 2010 cp.wu - * NULL - * 1) do not use in-stack variable for beacon updating. (for MAUI porting) - * 2) extending scanning result to 64 instead of 48 - * - * 08 02 2010 yuche.tsai - * NULL - * P2P Group Negotiation Code Check in. - * - * 08 02 2010 george.huang - * NULL - * add WMM-PS test related OID/ CMD handlers - * - * 07 26 2010 yuche.tsai - * - * Add support to RX probe response for P2P. - * - * 07 20 2010 cp.wu - * - * 1) bugfix: do not stop timer for join after switched into normal_tr state, for providing chance for DHCP handshasking - * 2) modify rsnPerformPolicySelection() invoking - * - * 07 19 2010 wh.su - * - * update for security supporting. - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * when IBSS is being merged-in, send command packet to PM for connected indication - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * Add Ad-Hoc support to AIS-FSM - * - * 07 14 2010 yarco.yang - * - * 1. Remove CFG_MQM_MIGRATION - * 2. Add CMD_UPDATE_WMM_PARMS command - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 06 2010 george.huang - * [WPD00001556]Basic power managemenet function - * Update arguments for nicUpdateBeaconIETemplate() - * - * 06 29 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) sync to. CMD/EVENT document v0.03 - * 2) simplify DTIM period parsing in scan.c only, bss.c no longer parses it again. - * 3) send command packet to indicate FW-PM after - * a) 1st beacon is received after AIS has connected to an AP - * b) IBSS-ALONE has been created - * c) IBSS-MERGE has occured - * - * 06 28 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * send MMPDU in basic rate. - * - * 06 25 2010 george.huang - * [WPD00001556]Basic power managemenet function - * Create beacon update path, with expose bssUpdateBeaconContent() - * - * 06 21 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Fix compile error while enable WIFI_DIRECT support. - * - * 06 21 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Support CFG_MQM_MIGRATION flag - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * enable RX management frame handling. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * specify correct value for management frames. - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * correct when ADHOC support is turned on. - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add scan.c. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add management dispatching function table. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * auth.c is migrated. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * fix compilation error when WIFI_DIRECT is turned on - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add bss.c. - * - * 06 04 2010 george.huang - * [BORA00000678][MT6620]WiFi LP integration - * [PM] Support U-APSD for STA mode - * - * 05 28 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add ClientList handling API - bssClearClientList, bssAddStaRecToClientList - * - * 05 24 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Update bssProcessProbeRequest() to avoid redundant SSID IE {0,0} for IOT. - * - * 05 21 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Refine txmInitWtblTxRateTable() - set TX initial rate according to AP's operation rate set - * - * 05 18 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Ad-hoc Beacon should not carry HT OP and OBSS IEs - * - * 05 14 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Use TX MGMT Frame API for sending PS NULL frame to avoid the TX Burst Mechanism in TX FW Frame API - * - * 05 14 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Seperate Beacon and ProbeResp IE array - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 04 28 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * Removed the use of compiling flag MQM_WMM_PARSING - * - * 04 27 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add Set Slot Time and Beacon Timeout Support for AdHoc Mode - * - * 04 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW - * - * 04 22 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * First draft code to support protection in AP mode - * - * 04 20 2010 kevin.huang - * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support - * Fix restart Beacon Timeout Func after connection diagnosis - * - * 04 19 2010 kevin.huang - * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support - * Add Beacon Timeout Support and will send Null frame to diagnose connection - * - * 04 16 2010 wh.su - * [BORA00000680][MT6620] Support the statistic for Microsoft os query - * adding the wpa-none for ibss beacon. - * - * 04 15 2010 wh.su - * [BORA00000680][MT6620] Support the statistic for Microsoft os query - * fixed the protected bit at cap info for ad-hoc. - * - * 03 18 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Rename the CFG flags - * - * 03 16 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add AdHoc Mode - * - * 02 26 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Update outgoing beacon's TX data rate - * - * 02 23 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add DTIM count update while TX Beacon - * - * 02 05 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Modify code due to define - BAND_24G and specific BSS_INFO_T was changed - * - * 02 05 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Revise data structure to share the same BSS_INFO_T for avoiding coding error - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ -#if (CFG_SUPPORT_ADHOC) || (CFG_SUPPORT_AAA) -APPEND_VAR_IE_ENTRY_T txBcnIETable[] = { - { (ELEM_HDR_LEN + (RATE_NUM - ELEM_MAX_LEN_SUP_RATES)), NULL, bssGenerateExtSuppRate_IE } /* 50 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_ERP), NULL, rlmRspGenerateErpIE } /* 42 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_HT_CAP), NULL, rlmRspGenerateHtCapIE } /* 45 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_HT_OP), NULL, rlmRspGenerateHtOpIE } /* 61 */ -#if CFG_ENABLE_WIFI_DIRECT - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_OBSS_SCAN), NULL, rlmRspGenerateObssScanIE } /* 74 */ -#endif - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_EXT_CAP), NULL, rlmRspGenerateExtCapIE } /* 127 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_WPA), NULL, rsnGenerateWpaNoneIE } /* 221 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_WMM_PARAM), NULL, mqmGenerateWmmParamIE } /* 221 */ -#if CFG_ENABLE_WIFI_DIRECT - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_WPA), NULL, rsnGenerateWPAIE } /* 221 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_RSN), NULL, rsnGenerateRSNIE } /* 48 */ -#if 0 //LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - ,{ 0, p2pFuncCalculateExtra_IELenForBeacon, p2pFuncGenerateExtra_IEForBeacon } /* 221 */ -#else - ,{ 0, p2pFuncCalculateP2p_IELenForBeacon, p2pFuncGenerateP2p_IEForBeacon } /* 221 */ - ,{ 0, p2pFuncCalculateWSC_IELenForBeacon, p2pFuncGenerateWSC_IEForBeacon } /* 221 */ -#endif -#endif /* CFG_ENABLE_WIFI_DIRECT */ -}; - - -APPEND_VAR_IE_ENTRY_T txProbRspIETable[] = { - { (ELEM_HDR_LEN + (RATE_NUM - ELEM_MAX_LEN_SUP_RATES)), NULL, bssGenerateExtSuppRate_IE } /* 50 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_ERP), NULL, rlmRspGenerateErpIE } /* 42 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_HT_CAP), NULL, rlmRspGenerateHtCapIE } /* 45 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_HT_OP), NULL, rlmRspGenerateHtOpIE } /* 61 */ -#if CFG_ENABLE_WIFI_DIRECT - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_RSN), NULL, rsnGenerateRSNIE } /* 48 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_OBSS_SCAN), NULL, rlmRspGenerateObssScanIE } /* 74 */ -#endif - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_EXT_CAP), NULL, rlmRspGenerateExtCapIE } /* 127 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_WPA), NULL, rsnGenerateWpaNoneIE } /* 221 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_WMM_PARAM), NULL, mqmGenerateWmmParamIE } /* 221 */ -}; - -#endif /* CFG_SUPPORT_ADHOC || CFG_SUPPORT_AAA */ - - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Routines for all Operation Modes */ -/*----------------------------------------------------------------------------*/ -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will create or reset a STA_RECORD_T by given BSS_DESC_T for -* Infrastructure or AdHoc Mode. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] eStaType Assign STA Type for this STA_RECORD_T -* @param[in] eNetTypeIndex Assign Net Type Index for this STA_RECORD_T -* @param[in] prBssDesc Received Beacon/ProbeResp from this STA -* -* @retval Pointer to STA_RECORD_T -*/ -/*----------------------------------------------------------------------------*/ -P_STA_RECORD_T -bssCreateStaRecFromBssDesc ( - IN P_ADAPTER_T prAdapter, - IN ENUM_STA_TYPE_T eStaType, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_BSS_DESC_T prBssDesc - ) -{ - P_STA_RECORD_T prStaRec; - UINT_8 ucNonHTPhyTypeSet; - - - ASSERT(prBssDesc); - - //4 <1> Get a valid STA_RECORD_T - prStaRec = cnmGetStaRecByAddress(prAdapter, (UINT_8) eNetTypeIndex, - prBssDesc->aucSrcAddr); - if (!prStaRec) { - - prStaRec = cnmStaRecAlloc(prAdapter, (UINT_8) eNetTypeIndex); - - /* TODO(Kevin): Error handling of allocation of STA_RECORD_T for - * exhausted case and do removal of unused STA_RECORD_T. - */ - - if(!prStaRec) { - ASSERT(FALSE); - return NULL; - } - - ASSERT(prStaRec); - - prStaRec->ucJoinFailureCount = 0; - /* TODO(Kevin): If this is an old entry, we may also reset the ucJoinFailureCount to 0. - */ - - COPY_MAC_ADDR(prStaRec->aucMacAddr, prBssDesc->aucSrcAddr); - } - - - //4 <2> Setup STA TYPE and NETWORK - prStaRec->eStaType = eStaType; - - prStaRec->ucNetTypeIndex = eNetTypeIndex; - - - //4 <3> Update information from BSS_DESC_T to current P_STA_RECORD_T - prStaRec->u2CapInfo = prBssDesc->u2CapInfo; - - prStaRec->u2OperationalRateSet = prBssDesc->u2OperationalRateSet; - prStaRec->u2BSSBasicRateSet = prBssDesc->u2BSSBasicRateSet; - - prStaRec->ucPhyTypeSet = prBssDesc->ucPhyTypeSet; - - if (!((prAdapter->rWifiVar.rConnSettings.eEncStatus == ENUM_ENCRYPTION3_ENABLED) || - (prAdapter->rWifiVar.rConnSettings.eEncStatus == ENUM_ENCRYPTION3_KEY_ABSENT) || - (prAdapter->rWifiVar.rConnSettings.eEncStatus == ENUM_ENCRYPTION_DISABLED) || - (prAdapter->prGlueInfo->u2WSCAssocInfoIELen) || - (prAdapter->prGlueInfo->u2WapiAssocInfoIESz))) { - DBGLOG(BSS, INFO, ("Ignore the HT Bit for TKIP as pairwise cipher configed!\n")); - prStaRec->ucPhyTypeSet &= ~PHY_TYPE_BIT_HT; - } - - prStaRec->ucDesiredPhyTypeSet = prStaRec->ucPhyTypeSet & prAdapter->rWifiVar.ucAvailablePhyTypeSet; - - ucNonHTPhyTypeSet = prStaRec->ucDesiredPhyTypeSet & PHY_TYPE_SET_802_11ABG; - - /* Check for Target BSS's non HT Phy Types */ - if (ucNonHTPhyTypeSet) { - - if (ucNonHTPhyTypeSet & PHY_TYPE_BIT_ERP) { - prStaRec->ucNonHTBasicPhyType = PHY_TYPE_ERP_INDEX; - } - else if (ucNonHTPhyTypeSet & PHY_TYPE_BIT_OFDM) { - prStaRec->ucNonHTBasicPhyType = PHY_TYPE_OFDM_INDEX; - } - else /* if (ucNonHTPhyTypeSet & PHY_TYPE_HR_DSSS_INDEX) */ { - prStaRec->ucNonHTBasicPhyType = PHY_TYPE_HR_DSSS_INDEX; - } - - prStaRec->fgHasBasicPhyType = TRUE; - } - else { - /* Use mandatory for 11N only BSS */ - ASSERT(prStaRec->ucPhyTypeSet & PHY_TYPE_SET_802_11N); - - { - /* TODO(Kevin): which value should we set for 11n ? ERP ? */ - prStaRec->ucNonHTBasicPhyType = PHY_TYPE_HR_DSSS_INDEX; - } - - prStaRec->fgHasBasicPhyType = FALSE; - } - - /* Update non HT Desired Rate Set */ - { - P_CONNECTION_SETTINGS_T prConnSettings; - - - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - prStaRec->u2DesiredNonHTRateSet = - (prStaRec->u2OperationalRateSet & prConnSettings->u2DesiredNonHTRateSet); - } - - //4 <4> Update information from BSS_DESC_T to current P_STA_RECORD_T - if (IS_AP_STA(prStaRec)) { - /* do not need to parse IE for DTIM, - * which have been parsed before inserting into BSS_DESC_T - */ - if (prBssDesc->ucDTIMPeriod) { - prStaRec->ucDTIMPeriod = prBssDesc->ucDTIMPeriod; - } - else { - prStaRec->ucDTIMPeriod = 0; // Means that TIM was not parsed. - } - } - - - //4 <5> Update default value - prStaRec->fgDiagnoseConnection = FALSE; - - - //4 <6> Update default value for other Modules - /* Determine fgIsWmmSupported and fgIsUapsdSupported in STA_REC */ - mqmProcessScanResult(prAdapter, prBssDesc, prStaRec); - - return prStaRec; - -} /* end of bssCreateStaRecFromBssDesc() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will compose the Null Data frame. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] pucBuffer Pointer to the frame buffer. -* @param[in] prStaRec Pointer to the STA_RECORD_T. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bssComposeNullFrame ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBuffer, - IN P_STA_RECORD_T prStaRec - ) -{ - P_WLAN_MAC_HEADER_T prNullFrame; - P_BSS_INFO_T prBssInfo; - UINT_16 u2FrameCtrl; - - - ASSERT(pucBuffer); - ASSERT(prStaRec); - ASSERT(prStaRec->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - - ASSERT(prBssInfo); - - prNullFrame = (P_WLAN_MAC_HEADER_T)pucBuffer; - - //4 <1> Decide the Frame Control Field - u2FrameCtrl = MAC_FRAME_NULL; - - if (IS_AP_STA(prStaRec)) { - u2FrameCtrl |= MASK_FC_TO_DS; - - if (prStaRec->fgSetPwrMgtBit) { - u2FrameCtrl |= MASK_FC_PWR_MGT; - } - } - else if (IS_CLIENT_STA(prStaRec)) { - u2FrameCtrl |= MASK_FC_FROM_DS; - } - else if (IS_DLS_STA(prStaRec)) { - /* TODO(Kevin) */ - } - else { - /* NOTE(Kevin): We won't send Null frame for IBSS */ - ASSERT(0); - return; - } - - //4 <2> Compose the Null frame - /* Fill the Frame Control field. */ - //WLAN_SET_FIELD_16(&prNullFrame->u2FrameCtrl, u2FrameCtrl); - prNullFrame->u2FrameCtrl = u2FrameCtrl; // NOTE(Kevin): Optimized for ARM - - /* Fill the Address 1 field with Target Peer Address. */ - COPY_MAC_ADDR(prNullFrame->aucAddr1, prStaRec->aucMacAddr); - - /* Fill the Address 2 field with our MAC Address. */ - COPY_MAC_ADDR(prNullFrame->aucAddr2, prBssInfo->aucOwnMacAddr); - - /* Fill the Address 3 field with Target BSSID. */ - COPY_MAC_ADDR(prNullFrame->aucAddr3, prBssInfo->aucBSSID); - - /* Clear the SEQ/FRAG_NO field(HW won't overide the FRAG_NO, so we need to clear it). */ - prNullFrame->u2SeqCtrl = 0; - - return; - -} /* end of bssComposeNullFrameHeader() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will compose the QoS Null Data frame. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] pucBuffer Pointer to the frame buffer. -* @param[in] prStaRec Pointer to the STA_RECORD_T. -* @param[in] ucUP User Priority. -* @param[in] fgSetEOSP Set the EOSP bit. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bssComposeQoSNullFrame ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBuffer, - IN P_STA_RECORD_T prStaRec, - IN UINT_8 ucUP, - IN BOOLEAN fgSetEOSP - ) -{ - P_WLAN_MAC_HEADER_QOS_T prQoSNullFrame; - P_BSS_INFO_T prBssInfo; - UINT_16 u2FrameCtrl; - UINT_16 u2QosControl; - - - ASSERT(pucBuffer); - ASSERT(prStaRec); - ASSERT(prStaRec->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - - ASSERT(prBssInfo); - - prQoSNullFrame = (P_WLAN_MAC_HEADER_QOS_T)pucBuffer; - - //4 <1> Decide the Frame Control Field - u2FrameCtrl = MAC_FRAME_QOS_NULL; - - if (IS_AP_STA(prStaRec)) { - u2FrameCtrl |= MASK_FC_TO_DS; - - if (prStaRec->fgSetPwrMgtBit) { - u2FrameCtrl |= MASK_FC_PWR_MGT; - } - } - else if (IS_CLIENT_STA(prStaRec)) { - u2FrameCtrl |= MASK_FC_FROM_DS; - } - else if (IS_DLS_STA(prStaRec)) { - /* TODO(Kevin) */ - } - else { - /* NOTE(Kevin): We won't send QoS Null frame for IBSS */ - ASSERT(0); - return; - } - - //4 <2> Compose the QoS Null frame - /* Fill the Frame Control field. */ - //WLAN_SET_FIELD_16(&prQoSNullFrame->u2FrameCtrl, u2FrameCtrl); - prQoSNullFrame->u2FrameCtrl = u2FrameCtrl; // NOTE(Kevin): Optimized for ARM - - /* Fill the Address 1 field with Target Peer Address. */ - COPY_MAC_ADDR(prQoSNullFrame->aucAddr1, prStaRec->aucMacAddr); - - /* Fill the Address 2 field with our MAC Address. */ - COPY_MAC_ADDR(prQoSNullFrame->aucAddr2, prBssInfo->aucOwnMacAddr); - - /* Fill the Address 3 field with Target BSSID. */ - COPY_MAC_ADDR(prQoSNullFrame->aucAddr3, prBssInfo->aucBSSID); - - /* Clear the SEQ/FRAG_NO field(HW won't overide the FRAG_NO, so we need to clear it). */ - prQoSNullFrame->u2SeqCtrl = 0; - - u2QosControl = (UINT_16)(ucUP & WMM_QC_UP_MASK); - - if (fgSetEOSP) { - u2QosControl |= WMM_QC_EOSP; - } - - //WLAN_SET_FIELD_16(&prQoSNullFrame->u2QosCtrl, u2QosControl); - prQoSNullFrame->u2QosCtrl = u2QosControl; // NOTE(Kevin): Optimized for ARM - - return; - -} /* end of bssComposeQoSNullFrameHeader() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Send the Null Frame -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] pfTxDoneHandler TX Done call back function -* -* @retval WLAN_STATUS_RESOURCE No available resources to send frame. -* @retval WLAN_STATUS_SUCCESS Succe]ss. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bssSendNullFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN PFN_TX_DONE_HANDLER pfTxDoneHandler - ) -{ - P_MSDU_INFO_T prMsduInfo; - UINT_16 u2EstimatedFrameLen; - - - //4 <1> Allocate a PKT_INFO_T for Null Frame - /* Init with MGMT Header Length */ - u2EstimatedFrameLen = MAC_TX_RESERVED_FIELD + \ - WLAN_MAC_HEADER_LEN; - - /* Allocate a MSDU_INFO_T */ - if ( (prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen)) == NULL) { - DBGLOG(BSS, WARN, ("No PKT_INFO_T for sending Null Frame.\n")); - return WLAN_STATUS_RESOURCES; - } - - //4 <2> Compose Null frame in MSDU_INfO_T. - bssComposeNullFrame(prAdapter, - (PUINT_8)((UINT_32)prMsduInfo->prPacket + MAC_TX_RESERVED_FIELD), - prStaRec); -#if 0 - //4 <3> Update information of MSDU_INFO_T - TXM_SET_DATA_PACKET( \ - /* STA_REC ptr */ prStaRec, \ - /* MSDU_INFO ptr */ prMsduInfo, \ - /* MAC HDR ptr */ (prMsduInfo->pucBuffer + MAC_TX_RESERVED_FIELD), \ - /* MAC HDR length */ WLAN_MAC_HEADER_LEN, \ - /* PAYLOAD ptr */ (prMsduInfo->pucBuffer + MAC_TX_RESERVED_FIELD + WLAN_MAC_HEADER_LEN), \ - /* PAYLOAD length */ 0, \ - /* Network Type Index */(UINT_8)prStaRec->ucNetTypeIndex, \ - /* TID */ 0 /* BE: AC1 */, \ - /* Flag 802.11 */ TRUE,\ - /* Pkt arrival time */ 0 /* TODO: Obtain the system time */, \ - /* Resource TC */ 0 /* Irrelevant */, \ - /* Flag 802.1x */ FALSE,\ - /* TX-done callback */ pfTxDoneHandler, \ - /* PS forwarding type*/ PS_FORWARDING_TYPE_NON_PS, \ - /* PS Session ID */ 0 /* Irrelevant */, \ - /* Flag fixed rate */ TRUE, \ - /* Fixed tx rate */ g_aprBssInfo[prStaRec->ucNetTypeIndex]->ucHwDefaultFixedRateCode, \ - /* Fixed-rate retry */ BSS_DEFAULT_CONN_TEST_NULL_FRAME_RETRY_LIMIT, \ - /* PAL LLH */ 0 /* Irrelevant */,\ - /* ACL SN */ 0 /* Irrelevant */,\ - /* Flag No Ack */ FALSE \ - ); - - /* Terminate with a NULL pointer */ - NIC_HIF_TX_SET_NEXT_MSDU_INFO(prMsduInfo,NULL); - - /* TODO(Kevin): Also release the unused tail room of the composed MMPDU */ - - /* Indicate the packet to TXM */ - //4 <4> Inform TXM to send this Null frame. - txmSendFwDataPackets(prMsduInfo); -#endif - - prMsduInfo->eSrc = TX_PACKET_MGMT; - prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_DATA; - prMsduInfo->ucStaRecIndex = prStaRec->ucIndex; - prMsduInfo->ucNetworkType = prStaRec->ucNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_HEADER_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = WLAN_MAC_HEADER_LEN; - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = pfTxDoneHandler; - prMsduInfo->fgIsBasicRate = FALSE; - - //4 <4> Inform TXM to send this Null frame. - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - - return WLAN_STATUS_SUCCESS; - -} /* end of bssSendNullFrame() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Send the QoS Null Frame -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] pfTxDoneHandler TX Done call back function -* -* @retval WLAN_STATUS_RESOURCE No available resources to send frame. -* @retval WLAN_STATUS_SUCCESS Success. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bssSendQoSNullFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN UINT_8 ucUP, - IN PFN_TX_DONE_HANDLER pfTxDoneHandler - ) -{ - P_MSDU_INFO_T prMsduInfo; - UINT_16 u2EstimatedFrameLen; - - - //4 <1> Allocate a PKT_INFO_T for Null Frame - /* Init with MGMT Header Length */ - u2EstimatedFrameLen = MAC_TX_RESERVED_FIELD + \ - WLAN_MAC_HEADER_QOS_LEN; - - /* Allocate a MSDU_INFO_T */ - if ( (prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen)) == NULL) { - DBGLOG(BSS, WARN, ("No PKT_INFO_T for sending Null Frame.\n")); - return WLAN_STATUS_RESOURCES; - } - - //4 <2> Compose Null frame in MSDU_INfO_T. - bssComposeQoSNullFrame(prAdapter, - (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD), - prStaRec, - ucUP, - FALSE); -#if 0 - //4 <3> Update information of MSDU_INFO_T - TXM_SET_DATA_PACKET( \ - /* STA_REC ptr */ prStaRec, \ - /* MSDU_INFO ptr */ prMsduInfo, \ - /* MAC HDR ptr */ (prMsduInfo->pucBuffer + MAC_TX_RESERVED_FIELD), \ - /* MAC HDR length */ WLAN_MAC_HEADER_QOS_LEN, \ - /* PAYLOAD ptr */ (prMsduInfo->pucBuffer + MAC_TX_RESERVED_FIELD + WLAN_MAC_HEADER_QOS_LEN), \ - /* PAYLOAD length */ 0, \ - /* Network Type Index */(UINT_8)prStaRec->ucNetTypeIndex, \ - /* TID */ 0 /* BE: AC1 */, \ - /* Flag 802.11 */ TRUE,\ - /* Pkt arrival time */ 0 /* TODO: Obtain the system time */, \ - /* Resource TC */ 0 /* Irrelevant */, \ - /* Flag 802.1x */ FALSE,\ - /* TX-done callback */ pfTxDoneHandler, \ - /* PS forwarding type*/ PS_FORWARDING_TYPE_NON_PS, \ - /* PS Session ID */ 0 /* Irrelevant */, \ - /* Flag fixed rate */ TRUE, \ - /* Fixed tx rate */ g_aprBssInfo[prStaRec->ucNetTypeIndex]->ucHwDefaultFixedRateCode, \ - /* Fixed-rate retry */ TXM_DEFAULT_DATA_FRAME_RETRY_LIMIT, \ - /* PAL LLH */ 0 /* Irrelevant */,\ - /* ACL SN */ 0 /* Irrelevant */,\ - /* Flag No Ack */ FALSE \ - ); - - /* Terminate with a NULL pointer */ - NIC_HIF_TX_SET_NEXT_MSDU_INFO(prMsduInfo,NULL); - - /* TODO(Kevin): Also release the unused tail room of the composed MMPDU */ - - /* Indicate the packet to TXM */ - //4 <4> Inform TXM to send this Null frame. - txmSendFwDataPackets(prMsduInfo); -#endif - - prMsduInfo->eSrc = TX_PACKET_MGMT; - prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_MGMT; - prMsduInfo->ucStaRecIndex = prStaRec->ucIndex; - prMsduInfo->ucNetworkType = prStaRec->ucNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_HEADER_QOS_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = WLAN_MAC_HEADER_QOS_LEN; - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = pfTxDoneHandler; - prMsduInfo->fgIsBasicRate = TRUE; - - //4 <4> Inform TXM to send this Null frame. - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - - return WLAN_STATUS_SUCCESS; - -} /* end of bssSendQoSNullFrame() */ - - -#if (CFG_SUPPORT_ADHOC) || (CFG_SUPPORT_AAA) -/*----------------------------------------------------------------------------*/ -/* Routines for both IBSS(AdHoc) and BSS(AP) */ -/*----------------------------------------------------------------------------*/ -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to generate Information Elements of Extended -* Support Rate -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bssGenerateExtSuppRate_IE ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - P_BSS_INFO_T prBssInfo; - PUINT_8 pucBuffer; - UINT_8 ucExtSupRatesLen; - - - ASSERT(prMsduInfo); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prMsduInfo->ucNetworkType]); - ASSERT(prBssInfo); - - pucBuffer = (PUINT_8)((UINT_32)prMsduInfo->prPacket + - (UINT_32)prMsduInfo->u2FrameLength); - ASSERT(pucBuffer); - - if (prBssInfo->ucAllSupportedRatesLen > ELEM_MAX_LEN_SUP_RATES) { - - ucExtSupRatesLen = prBssInfo->ucAllSupportedRatesLen - ELEM_MAX_LEN_SUP_RATES; - } - else { - ucExtSupRatesLen = 0; - } - - /* Fill the Extended Supported Rates element. */ - if (ucExtSupRatesLen) { - - EXT_SUP_RATES_IE(pucBuffer)->ucId = ELEM_ID_EXTENDED_SUP_RATES; - EXT_SUP_RATES_IE(pucBuffer)->ucLength = ucExtSupRatesLen; - - kalMemCopy(EXT_SUP_RATES_IE(pucBuffer)->aucExtSupportedRates, - &prBssInfo->aucAllSupportedRates[ELEM_MAX_LEN_SUP_RATES], - ucExtSupRatesLen); - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - } - - return; -} /* end of bssGenerateExtSuppRate_IE() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to compose Common Information Elements for Beacon -* or Probe Response Frame. -* -* @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T. -* @param[in] prBssInfo Pointer to the BSS_INFO_T. -* @param[in] pucDestAddr Pointer to the Destination Address, if NULL, means Beacon. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bssBuildBeaconProbeRespFrameCommonIEs ( - IN P_MSDU_INFO_T prMsduInfo, - IN P_BSS_INFO_T prBssInfo, - IN PUINT_8 pucDestAddr - ) -{ - PUINT_8 pucBuffer; - UINT_8 ucSupRatesLen; - - - ASSERT(prMsduInfo); - ASSERT(prBssInfo); - - pucBuffer = (PUINT_8)((UINT_32)prMsduInfo->prPacket + - (UINT_32)prMsduInfo->u2FrameLength); - ASSERT(pucBuffer); - - /* Compose the frame body of the Probe Response frame. */ - //4 <1> Fill the SSID element. - SSID_IE(pucBuffer)->ucId = ELEM_ID_SSID; - SSID_IE(pucBuffer)->ucLength = prBssInfo->ucSSIDLen; - if (prBssInfo->ucSSIDLen) { - kalMemCopy(SSID_IE(pucBuffer)->aucSSID, prBssInfo->aucSSID, prBssInfo->ucSSIDLen); - } - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - pucBuffer += IE_SIZE(pucBuffer); - - - //4 <2> Fill the Supported Rates element. - if (prBssInfo->ucAllSupportedRatesLen > ELEM_MAX_LEN_SUP_RATES) { - - ucSupRatesLen = ELEM_MAX_LEN_SUP_RATES; - } - else { - ucSupRatesLen = prBssInfo->ucAllSupportedRatesLen; - } - - if (ucSupRatesLen) { - SUP_RATES_IE(pucBuffer)->ucId = ELEM_ID_SUP_RATES; - SUP_RATES_IE(pucBuffer)->ucLength = ucSupRatesLen; - kalMemCopy(SUP_RATES_IE(pucBuffer)->aucSupportedRates, - prBssInfo->aucAllSupportedRates, - ucSupRatesLen); - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - pucBuffer += IE_SIZE(pucBuffer); - } - - - //4 <3> Fill the DS Parameter Set element. - if (prBssInfo->eBand == BAND_2G4) { - DS_PARAM_IE(pucBuffer)->ucId = ELEM_ID_DS_PARAM_SET; - DS_PARAM_IE(pucBuffer)->ucLength = ELEM_MAX_LEN_DS_PARAMETER_SET; - DS_PARAM_IE(pucBuffer)->ucCurrChnl = prBssInfo->ucPrimaryChannel; - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - pucBuffer += IE_SIZE(pucBuffer); - } - - - //4 <4> IBSS Parameter Set element, ID: 6 - if (prBssInfo->eCurrentOPMode == OP_MODE_IBSS) { - IBSS_PARAM_IE(pucBuffer)->ucId = ELEM_ID_IBSS_PARAM_SET; - IBSS_PARAM_IE(pucBuffer)->ucLength = ELEM_MAX_LEN_IBSS_PARAMETER_SET; - WLAN_SET_FIELD_16(&(IBSS_PARAM_IE(pucBuffer)->u2ATIMWindow), prBssInfo->u2ATIMWindow); - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - pucBuffer += IE_SIZE(pucBuffer); - } - - - //4 <5> TIM element, ID: 5 - if ((!pucDestAddr) && // For Beacon only. - (prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT)) { - -#if CFG_ENABLE_WIFI_DIRECT - /*no fgIsP2PRegistered protect*/ - if (prBssInfo->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX) { -#if 0 - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo; - UINT_8 ucBitmapControl = 0; - UINT_32 u4N1, u4N2; - - - prP2pSpecificBssInfo = &(prAdapter->rWifiVar.rP2pSpecificBssInfo); - - // Clear existing value. - prP2pSpecificBssInfo->ucBitmapCtrl = 0; - kalMemZero(prP2pSpecificBssInfo->aucPartialVirtualBitmap, - sizeof(prP2pSpecificBssInfo->aucPartialVirtualBitmap)); - - - // IEEE 802.11 2007 - 7.3.2.6 - TIM_IE(pucBuffer)->ucId = ELEM_ID_TIM; - TIM_IE(pucBuffer)->ucDTIMCount = prBssInfo->ucDTIMCount; - TIM_IE(pucBuffer)->ucDTIMPeriod = prBssInfo->ucDTIMPeriod; - - // Setup DTIM Count for next TBTT. - if (prBssInfo->ucDTIMCount == 0) { - //3 *** pmQueryBufferedBCAST(); - } - - //3 *** pmQueryBufferedPSNode(); - /* TODO(Kevin): Call PM Module here to loop all STA_RECORD_Ts and it - * will call bssSetTIMBitmap to toggle the Bitmap. - */ - - // Set Virtual Bitmap for UCAST - u4N1 = (prP2pSpecificBssInfo->u2SmallestAID >> 4) << 1; // Find the largest even number. - u4N2 = prP2pSpecificBssInfo->u2LargestAID >> 3; // Find the smallest number. - - ASSERT(u4N2 >= u4N1); - - kalMemCopy(TIM_IE(pucBuffer)->aucPartialVirtualMap, - &prP2pSpecificBssInfo->aucPartialVirtualBitmap[u4N1], - ((u4N2 - u4N1) + 1)); - - // Set Virtual Bitmap for BMCAST - // BMC bit only indicated when DTIM count == 0. - if (prBssInfo->ucDTIMCount == 0) { - ucBitmapControl = prP2pSpecificBssInfo->ucBitmapCtrl; - } - TIM_IE(pucBuffer)->ucBitmapControl = ucBitmapControl | (UINT_8)u4N1; - - TIM_IE(pucBuffer)->ucLength = ((u4N2 - u4N1) + 4); - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); -#else - - // IEEE 802.11 2007 - 7.3.2.6 - TIM_IE(pucBuffer)->ucId = ELEM_ID_TIM; - TIM_IE(pucBuffer)->ucLength = (3 + MAX_LEN_TIM_PARTIAL_BMP)/*((u4N2 - u4N1) + 4)*/; // NOTE: fixed PVB length (AID is allocated from 8 ~ 15 only) - TIM_IE(pucBuffer)->ucDTIMCount = 0/*prBssInfo->ucDTIMCount*/; // will be overwrite by FW - TIM_IE(pucBuffer)->ucDTIMPeriod = prBssInfo->ucDTIMPeriod; - TIM_IE(pucBuffer)->ucBitmapControl = 0/*ucBitmapControl | (UINT_8)u4N1*/; // will be overwrite by FW - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - -#endif - - } - else -#endif /* CFG_ENABLE_WIFI_DIRECT */ - { - /* NOTE(Kevin): 1. AIS - Didn't Support AP Mode. - * 2. BOW - Didn't Support BCAST and PS. - */ - } - - - - } - - return; -} /* end of bssBuildBeaconProbeRespFrameCommonIEs() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will compose the Beacon/Probe Response frame header and -* its fixed fields. -* -* @param[in] pucBuffer Pointer to the frame buffer. -* @param[in] pucDestAddr Pointer to the Destination Address, if NULL, means Beacon. -* @param[in] pucOwnMACAddress Given Our MAC Address. -* @param[in] pucBSSID Given BSSID of the BSS. -* @param[in] u2BeaconInterval Given Beacon Interval. -* @param[in] u2CapInfo Given Capability Info. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bssComposeBeaconProbeRespFrameHeaderAndFF ( - IN PUINT_8 pucBuffer, - IN PUINT_8 pucDestAddr, - IN PUINT_8 pucOwnMACAddress, - IN PUINT_8 pucBSSID, - IN UINT_16 u2BeaconInterval, - IN UINT_16 u2CapInfo - ) -{ - P_WLAN_BEACON_FRAME_T prBcnProbRspFrame; - UINT_8 aucBCAddr[] = BC_MAC_ADDR; - UINT_16 u2FrameCtrl; - - DEBUGFUNC("bssComposeBeaconProbeRespFrameHeaderAndFF"); - //DBGLOG(INIT, LOUD, ("\n")); - - - ASSERT(pucBuffer); - ASSERT(pucOwnMACAddress); - ASSERT(pucBSSID); - - prBcnProbRspFrame = (P_WLAN_BEACON_FRAME_T)pucBuffer; - - //4 <1> Compose the frame header of the Beacon /ProbeResp frame. - /* Fill the Frame Control field. */ - if (pucDestAddr) { - u2FrameCtrl = MAC_FRAME_PROBE_RSP; - } - else { - u2FrameCtrl = MAC_FRAME_BEACON; - pucDestAddr = aucBCAddr; - } - //WLAN_SET_FIELD_16(&prBcnProbRspFrame->u2FrameCtrl, u2FrameCtrl); - prBcnProbRspFrame->u2FrameCtrl = u2FrameCtrl; // NOTE(Kevin): Optimized for ARM - - /* Fill the DA field with BCAST MAC ADDR or TA of ProbeReq. */ - COPY_MAC_ADDR(prBcnProbRspFrame->aucDestAddr, pucDestAddr); - - /* Fill the SA field with our MAC Address. */ - COPY_MAC_ADDR(prBcnProbRspFrame->aucSrcAddr, pucOwnMACAddress); - - /* Fill the BSSID field with current BSSID. */ - COPY_MAC_ADDR(prBcnProbRspFrame->aucBSSID, pucBSSID); - - /* Clear the SEQ/FRAG_NO field(HW won't overide the FRAG_NO, so we need to clear it). */ - prBcnProbRspFrame->u2SeqCtrl = 0; - - - //4 <2> Compose the frame body's common fixed field part of the Beacon /ProbeResp frame. - /* MAC will update TimeStamp field */ - - /* Fill the Beacon Interval field. */ - //WLAN_SET_FIELD_16(&prBcnProbRspFrame->u2BeaconInterval, u2BeaconInterval); - prBcnProbRspFrame->u2BeaconInterval = u2BeaconInterval; // NOTE(Kevin): Optimized for ARM - - /* Fill the Capability Information field. */ - //WLAN_SET_FIELD_16(&prBcnProbRspFrame->u2CapInfo, u2CapInfo); - prBcnProbRspFrame->u2CapInfo = u2CapInfo; // NOTE(Kevin): Optimized for ARM - - return; -} /* end of bssComposeBeaconProbeRespFrameHeaderAndFF() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Update the Beacon Frame Template to FW for AIS AdHoc and P2P GO. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] eNetTypeIndex Specify which network reply the Probe Response. -* -* @retval WLAN_STATUS_SUCCESS Success. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bssUpdateBeaconContent ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ) -{ - P_BSS_INFO_T prBssInfo; - P_MSDU_INFO_T prMsduInfo; - P_WLAN_BEACON_FRAME_T prBcnFrame; - UINT_32 i; - - DEBUGFUNC("bssUpdateBeaconContent"); - DBGLOG(INIT, LOUD, ("\n")); - - ASSERT(eNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[eNetTypeIndex]); - - //4 <1> Allocate a PKT_INFO_T for Beacon Frame - /* Allocate a MSDU_INFO_T */ - // For Beacon - prMsduInfo = prBssInfo->prBeacon; - - // beacon prMsduInfo will be NULLify once BSS deactivated, so skip if it is - if (prMsduInfo == NULL) { - return WLAN_STATUS_SUCCESS; - } - - //4 <2> Compose header - bssComposeBeaconProbeRespFrameHeaderAndFF( - (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD), - NULL, - prBssInfo->aucOwnMacAddr, - prBssInfo->aucBSSID, - prBssInfo->u2BeaconInterval, - prBssInfo->u2CapInfo); - - - prMsduInfo->u2FrameLength = (WLAN_MAC_MGMT_HEADER_LEN + - (TIMESTAMP_FIELD_LEN + BEACON_INTERVAL_FIELD_LEN + CAP_INFO_FIELD_LEN)); - - prMsduInfo->ucNetworkType = eNetTypeIndex; - - //4 <3> Compose the frame body's Common IEs of the Beacon frame. - bssBuildBeaconProbeRespFrameCommonIEs(prMsduInfo, prBssInfo, NULL); - - - //4 <4> Compose IEs in MSDU_INFO_T - - /* Append IE for Beacon */ - for (i = 0; i < sizeof(txBcnIETable)/sizeof(APPEND_VAR_IE_ENTRY_T); i++) { - if (txBcnIETable[i].pfnAppendIE) { - txBcnIETable[i].pfnAppendIE(prAdapter, prMsduInfo); - } - } - - prBcnFrame = (P_WLAN_BEACON_FRAME_T)prMsduInfo->prPacket; - - return nicUpdateBeaconIETemplate(prAdapter, - IE_UPD_METHOD_UPDATE_ALL, - eNetTypeIndex, - prBssInfo->u2CapInfo, - (PUINT_8)prBcnFrame->aucInfoElem, - prMsduInfo->u2FrameLength - OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem)); - - -} /* end of bssUpdateBeaconContent() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Send the Beacon Frame(for BOW) or Probe Response Frame according to the given -* Destination Address. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] eNetTypeIndex Specify which network reply the Probe Response. -* @param[in] pucDestAddr Pointer to the Destination Address to reply -* @param[in] u4ControlFlags Control flags for information on Probe Response. -* -* @retval WLAN_STATUS_RESOURCE No available resources to send frame. -* @retval WLAN_STATUS_SUCCESS Success. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bssSendBeaconProbeResponse ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN PUINT_8 pucDestAddr, - IN UINT_32 u4ControlFlags - ) -{ - P_BSS_INFO_T prBssInfo; - P_MSDU_INFO_T prMsduInfo; - UINT_16 u2EstimatedFrameLen; - UINT_16 u2EstimatedFixedIELen; - UINT_16 u2EstimatedExtraIELen; - P_APPEND_VAR_IE_ENTRY_T prIeArray = NULL; - UINT_32 u4IeArraySize = 0; - UINT_32 i; - - - ASSERT(eNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[eNetTypeIndex]); - - - if (!pucDestAddr) { // For Beacon - prIeArray = &txBcnIETable[0]; - u4IeArraySize = sizeof(txBcnIETable)/sizeof(APPEND_VAR_IE_ENTRY_T); - } - else { - prIeArray = &txProbRspIETable[0]; - u4IeArraySize = sizeof(txProbRspIETable)/sizeof(APPEND_VAR_IE_ENTRY_T); - } - - - //4 <1> Allocate a PKT_INFO_T for Beacon /Probe Response Frame - /* Allocate a MSDU_INFO_T */ - - /* Init with MGMT Header Length + Length of Fixed Fields + Common IE Fields */ - u2EstimatedFrameLen = MAC_TX_RESERVED_FIELD + \ - WLAN_MAC_MGMT_HEADER_LEN + \ - TIMESTAMP_FIELD_LEN + \ - BEACON_INTERVAL_FIELD_LEN + \ - CAP_INFO_FIELD_LEN + \ - (ELEM_HDR_LEN + ELEM_MAX_LEN_SSID) + \ - (ELEM_HDR_LEN + ELEM_MAX_LEN_SUP_RATES) + \ - (ELEM_HDR_LEN + ELEM_MAX_LEN_DS_PARAMETER_SET) + \ - (ELEM_HDR_LEN + ELEM_MAX_LEN_IBSS_PARAMETER_SET) + \ - (ELEM_HDR_LEN + (3 + MAX_LEN_TIM_PARTIAL_BMP)); - - /* + Extra IE Length */ - u2EstimatedExtraIELen = 0; - - for (i = 0; i < u4IeArraySize; i++) { - u2EstimatedFixedIELen = prIeArray[i].u2EstimatedFixedIELen; - - if (u2EstimatedFixedIELen) { - u2EstimatedExtraIELen += u2EstimatedFixedIELen; - } - else { - ASSERT(prIeArray[i].pfnCalculateVariableIELen); - - u2EstimatedExtraIELen += (UINT_16) - prIeArray[i].pfnCalculateVariableIELen(prAdapter, eNetTypeIndex, NULL); - } - } - - u2EstimatedFrameLen += u2EstimatedExtraIELen; - - if ( (prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen)) == NULL) { - DBGLOG(BSS, WARN, ("No PKT_INFO_T for sending %s.\n", - ((!pucDestAddr)?"Beacon":"Probe Response"))); - return WLAN_STATUS_RESOURCES; - } - - - //4 <2> Compose Beacon/Probe Response frame header and fixed fields in MSDU_INfO_T. - /* Compose Header and Fixed Field */ -#if CFG_ENABLE_WIFI_DIRECT - if (u4ControlFlags & BSS_PROBE_RESP_USE_P2P_DEV_ADDR) { - if(prAdapter->fgIsP2PRegistered) { - bssComposeBeaconProbeRespFrameHeaderAndFF( - (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD), - pucDestAddr, - prAdapter->rWifiVar.aucDeviceAddress, - prAdapter->rWifiVar.aucDeviceAddress, - DOT11_BEACON_PERIOD_DEFAULT, - (prBssInfo->u2CapInfo & ~(CAP_INFO_ESS | CAP_INFO_IBSS))); - } - } - else -#endif /* CFG_ENABLE_WIFI_DIRECT */ - { - bssComposeBeaconProbeRespFrameHeaderAndFF( - (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD), - pucDestAddr, - prBssInfo->aucOwnMacAddr, - prBssInfo->aucBSSID, - prBssInfo->u2BeaconInterval, - prBssInfo->u2CapInfo); - } - - - //4 <3> Update information of MSDU_INFO_T - prMsduInfo->eSrc = TX_PACKET_MGMT; - prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_MGMT; - prMsduInfo->ucStaRecIndex = 0xFF; - prMsduInfo->ucNetworkType = (UINT_8)eNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_MGMT_HEADER_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = (WLAN_MAC_MGMT_HEADER_LEN + - TIMESTAMP_FIELD_LEN + BEACON_INTERVAL_FIELD_LEN + CAP_INFO_FIELD_LEN); - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = NULL; - prMsduInfo->fgIsBasicRate = TRUE; - - - //4 <4> Compose the frame body's Common IEs of the Beacon/ProbeResp frame. - bssBuildBeaconProbeRespFrameCommonIEs(prMsduInfo, prBssInfo, pucDestAddr); - - - //4 <5> Compose IEs in MSDU_INFO_T - - /* Append IE */ - for (i = 0; i < u4IeArraySize; i++) { - if (prIeArray[i].pfnAppendIE) { - prIeArray[i].pfnAppendIE(prAdapter, prMsduInfo); - } - } - - /* TODO(Kevin): Also release the unused tail room of the composed MMPDU */ - - //4 <6> Inform TXM to send this Beacon /Probe Response frame. - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - - return WLAN_STATUS_SUCCESS; - -} /* end of bssSendBeaconProbeResponse() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will process the Rx Probe Request Frame and then send -* back the corresponding Probe Response Frame if the specified conditions -* were matched. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prSwRfb Pointer to SW RFB data structure. -* -* @retval WLAN_STATUS_SUCCESS Always return success -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bssProcessProbeRequest ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_WLAN_MAC_MGMT_HEADER_T prMgtHdr; - P_BSS_INFO_T prBssInfo; - ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex; - UINT_8 aucBCBSSID[] = BC_BSSID; - BOOLEAN fgIsBcBssid; - BOOLEAN fgReplyProbeResp; - UINT_32 u4CtrlFlagsForProbeResp = 0; - ENUM_BAND_T eBand; - UINT_8 ucHwChannelNum; - - - ASSERT(prSwRfb); - - //4 <1> Parse Probe Req and Get BSSID - prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)prSwRfb->pvHeader; - - if (EQUAL_MAC_ADDR(aucBCBSSID, prMgtHdr->aucBSSID)) { - fgIsBcBssid = TRUE; - } - else { - fgIsBcBssid = FALSE; - } - - - //4 <2> Check network conditions before reply Probe Response Frame (Consider Concurrent) - for (eNetTypeIndex = NETWORK_TYPE_AIS_INDEX; eNetTypeIndex < NETWORK_TYPE_INDEX_NUM; eNetTypeIndex++) { - - if (!IS_NET_ACTIVE(prAdapter, eNetTypeIndex)) { - continue; - } - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[eNetTypeIndex]); - - if ((!fgIsBcBssid) && - UNEQUAL_MAC_ADDR(prBssInfo->aucBSSID, prMgtHdr->aucBSSID)) { - continue; - } - - eBand = HIF_RX_HDR_GET_RF_BAND(prSwRfb->prHifRxHdr); - ucHwChannelNum = HIF_RX_HDR_GET_CHNL_NUM(prSwRfb->prHifRxHdr); - - if(prBssInfo->eBand != eBand) { - continue; - } - - if(prBssInfo->ucPrimaryChannel != ucHwChannelNum) { - continue; - } - - fgReplyProbeResp = FALSE; - - if (NETWORK_TYPE_AIS_INDEX == eNetTypeIndex) { - -#if CFG_SUPPORT_ADHOC - fgReplyProbeResp = aisValidateProbeReq(prAdapter, prSwRfb, &u4CtrlFlagsForProbeResp); -#endif - } -#if CFG_ENABLE_WIFI_DIRECT - else if ((prAdapter->fgIsP2PRegistered) && - (NETWORK_TYPE_P2P_INDEX == eNetTypeIndex)) { - - fgReplyProbeResp = p2pFuncValidateProbeReq(prAdapter, prSwRfb, &u4CtrlFlagsForProbeResp); - } -#endif -#if CFG_ENABLE_BT_OVER_WIFI - else if (NETWORK_TYPE_BOW_INDEX == eNetTypeIndex) { - - fgReplyProbeResp = bowValidateProbeReq(prAdapter, prSwRfb, &u4CtrlFlagsForProbeResp); - } -#endif - - if (fgReplyProbeResp) { - if(nicTxGetFreeCmdCount(prAdapter) > (CFG_TX_MAX_CMD_PKT_NUM/2) ){ - /* Resource margin is enough */ - bssSendBeaconProbeResponse(prAdapter, eNetTypeIndex, prMgtHdr->aucSrcAddr, u4CtrlFlagsForProbeResp); - } - } - } - - return WLAN_STATUS_SUCCESS; - -} /* end of bssProcessProbeRequest() */ - - -#if 0 // NOTE(Kevin): condition check should move to P2P_FSM.c -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will process the Rx Probe Request Frame and then send -* back the corresponding Probe Response Frame if the specified conditions -* were matched. -* -* @param[in] prSwRfb Pointer to SW RFB data structure. -* -* @retval WLAN_STATUS_SUCCESS Always return success -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -bssProcessProbeRequest ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_WLAN_MAC_MGMT_HEADER_T prMgtHdr; - P_BSS_INFO_T prBssInfo; - P_IE_SSID_T prIeSsid = (P_IE_SSID_T)NULL; - P_IE_SUPPORTED_RATE_T prIeSupportedRate = (P_IE_SUPPORTED_RATE_T)NULL; - P_IE_EXT_SUPPORTED_RATE_T prIeExtSupportedRate = (P_IE_EXT_SUPPORTED_RATE_T)NULL; - PUINT_8 pucIE; - UINT_16 u2IELength; - UINT_16 u2Offset = 0; - UINT_8 aucBCBSSID[] = BC_BSSID; - ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex; - BOOLEAN fgReplyProbeResp; -#if CFG_ENABLE_WIFI_DIRECT - BOOLEAN fgP2PTargetDeviceFound; - UINT_8 aucP2PWildcardSSID[] = P2P_WILDCARD_SSID; -#endif - - ASSERT(prSwRfb); - - //4 <1> Parse Probe Req and Get SSID IE ptr - prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)prSwRfb->pvHeader; - - u2IELength = prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen; - pucIE = (PUINT_8)((UINT_32)prSwRfb->pvHeader + prSwRfb->u2HeaderLen); - - prIeSsid = (P_IE_SSID_T)NULL; - - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - switch (IE_ID(pucIE)) { - case ELEM_ID_SSID: - if ((!prIeSsid) && - (IE_LEN(pucIE) <= ELEM_MAX_LEN_SSID)) { - prIeSsid = (P_IE_SSID_T)pucIE; - } - break; - - case ELEM_ID_SUP_RATES: - /* NOTE(Kevin): Buffalo WHR-G54S's supported rate set IE exceed 8. - * IE_LEN(pucIE) == 12, "1(B), 2(B), 5.5(B), 6(B), 9(B), 11(B), - * 12(B), 18(B), 24(B), 36(B), 48(B), 54(B)" - */ - // if (IE_LEN(pucIE) <= ELEM_MAX_LEN_SUP_RATES) { - if (IE_LEN(pucIE) <= RATE_NUM) { - prIeSupportedRate = SUP_RATES_IE(pucIE); - } - break; - - case ELEM_ID_EXTENDED_SUP_RATES: - prIeExtSupportedRate = EXT_SUP_RATES_IE(pucIE); - break; - -#if CFG_ENABLE_WIFI_DIRECT - // TODO: P2P IE & WCS IE parsing for P2P. - case ELEM_ID_P2P: - - break; -#endif - - /* no default */ - } - } /* end of IE_FOR_EACH */ - - //4 <2> Check network conditions before reply Probe Response Frame (Consider Concurrent) - for (eNetTypeIndex = NETWORK_TYPE_AIS_INDEX; eNetTypeIndex < NETWORK_TYPE_INDEX_NUM; eNetTypeIndex++) { - - if (!IS_NET_ACTIVE(prAdapter, eNetTypeIndex)) { - continue; - } - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[eNetTypeIndex]); - - if (UNEQUAL_MAC_ADDR(aucBCBSSID, prMgtHdr->aucBSSID) && - UNEQUAL_MAC_ADDR(prBssInfo->aucBSSID, prMgtHdr->aucBSSID)) { - /* BSSID not Wildcard BSSID. */ - continue; - } - - fgReplyProbeResp = FALSE; - - if (NETWORK_TYPE_AIS_INDEX == eNetTypeIndex) { - - if (prBssInfo->eCurrentOPMode == OP_MODE_IBSS) { - - /* TODO(Kevin): Check if we are IBSS Master. */ - if (TRUE) { - - if (prIeSsid) { - if ((prIeSsid->ucLength == BC_SSID_LEN) || /* WILDCARD SSID */ - EQUAL_SSID(prBssInfo->aucSSID, prBssInfo->ucSSIDLen, - prIeSsid->aucSSID, prIeSsid->ucLength)) { - fgReplyProbeResp = TRUE; - } - } - } - } - } -#if CFG_ENABLE_WIFI_DIRECT - else if (NETWORK_TYPE_P2P_INDEX == eNetTypeIndex) { - - // TODO(Kevin): Move following lines to p2p_fsm.c - - if ((prIeSsid) && - ((prIeSsid->ucLength == BC_SSID_LEN) || - (EQUAL_SSID(aucP2PWildcardSSID, - P2P_WILDCARD_SSID_LEN, - prIeSsid->aucSSID, - prIeSsid->ucLength)))) { -// if (p2pFsmRunEventRxProbeRequestFrame(prAdapter, prMgtHdr->aucSrcAddr, pucIE, u2IELength)) { - if (p2pFsmRunEventRxProbeRequestFrame(prAdapter, prSwRfb)) { - /* Extand channel request time & cancel scan request. */ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - - // TODO: RX probe request may not caused by LISTEN state. - // TODO: It can be GO. - /* Generally speaking, cancel a non-exist scan request is fine. - * We can check P2P FSM here for only LISTEN state. - */ - - P_MSG_SCN_SCAN_CANCEL prScanCancelMsg; - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - /* Abort JOIN process. */ - prScanCancelMsg = (P_MSG_SCN_SCAN_CANCEL)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_SCN_SCAN_CANCEL)); - if (!prScanCancelMsg) { - ASSERT(0); // Can't abort SCN FSM - continue; - } - - prScanCancelMsg->rMsgHdr.eMsgId = MID_P2P_SCN_SCAN_CANCEL; - prScanCancelMsg->ucSeqNum = prP2pFsmInfo->ucSeqNumOfScnMsg; - prScanCancelMsg->ucNetTypeIndex = (UINT_8)NETWORK_TYPE_P2P_INDEX; - prScanCancelMsg->fgIsChannelExt = TRUE; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prScanCancelMsg, - MSG_SEND_METHOD_BUF); - } - } - else { - /* 1. Probe Request without SSID. - * 2. Probe Request with SSID not Wildcard SSID & not P2P Wildcard SSID. - */ - continue; - } - -#if 0 // Frog - if (prAdapter->rWifiVar.prP2pFsmInfo->eCurrentState == P2P_STATE_LISTEN) { - // P2P 2.4.1 - P2P Devices shall not respond to Probe Request frames which only contain 11b rates only. - if (prIeSupportedRate || prIeExtSupportedRate) { - UINT_16 u2OperationalRateSet, u2BSSBasicRateSet; - BOOLEAN fgIsUnknownBssBasicRate; - - rateGetRateSetFromIEs(prIeSupportedRate, - prIeExtSupportedRate, - &u2OperationalRateSet, - &u2BSSBasicRateSet, /* Ignore any Basic Bit */ - &fgIsUnknownBssBasicRate); - - if (u2OperationalRateSet & ~RATE_SET_HR_DSSS) { - continue; - } - } - } - - // TODO: Check channel time before first check point to: - /* If Target device is selected: - * 1. Send XXXX request frame. - * else - * 1. Send Probe Response frame. - */ - - if (prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) { - /* TODO(Kevin): During PROVISION state, can we reply Probe Response ? */ - - /* TODO(Kevin): - * If we are GO, accept legacy client --> accept Wildcard SSID - * If we are in Listen State, accept only P2P Device --> check P2P IE and WPS IE - */ - if (TRUE /* We are GO */) { - if (prIeSsid) { - UINT_8 aucSSID[]=P2P_WILDCARD_SSID; - - if ((prIeSsid->ucLength == BC_SSID_LEN) || /* WILDCARD SSID */ - EQUAL_SSID(prBssInfo->aucSSID, prBssInfo->ucSSIDLen, - prIeSsid->aucSSID, prIeSsid->ucLength) || - EQUAL_SSID(aucSSID, P2P_WILDCARD_SSID_LEN, - prIeSsid->aucSSID, prIeSsid->ucLength)) { - fgReplyProbeResp = TRUE; - } - } - } -// else if (FALSE /* We are in Listen State */) { -// } - - /* TODO(Kevin): Check P2P IE and WPS IE */ - } -#endif - } -#endif -#if CFG_ENABLE_BT_OVER_WIFI - else if (NETWORK_TYPE_BOW_INDEX == eNetTypeIndex) { - - if (prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) { - /* TODO(Kevin): TBD */ - } - } -#endif - else { - ASSERT(eNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - } - - if (fgReplyProbeResp) { - bssSendBeaconProbeResponse(prAdapter, eNetTypeIndex, prMgtHdr->aucSrcAddr); - } - - } - - return WLAN_STATUS_SUCCESS; - -} /* end of bssProcessProbeRequest() */ -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to clear the client list for AdHoc or AP Mode -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prBssInfo Given related BSS_INFO_T. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bssClearClientList ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo - ) -{ - P_LINK_T prStaRecOfClientList; - - - ASSERT(prBssInfo); - - prStaRecOfClientList = &prBssInfo->rStaRecOfClientList; - - if (!LINK_IS_EMPTY(prStaRecOfClientList)) { - P_STA_RECORD_T prPeerStaRec; - - LINK_FOR_EACH_ENTRY(prPeerStaRec, prStaRecOfClientList, rLinkEntry, STA_RECORD_T) { - cnmStaRecChangeState(prAdapter, prPeerStaRec, STA_STATE_1); - } - - LINK_INITIALIZE(prStaRecOfClientList); - } - - return; -} /* end of bssClearClientList() */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to Add a STA_RECORD_T to the client list for AdHoc or AP Mode -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prBssInfo Given related BSS_INFO_T. -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bssAddStaRecToClientList ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo, - IN P_STA_RECORD_T prStaRec - ) -{ - P_LINK_T prStaRecOfClientList; - - - ASSERT(prBssInfo); - - prStaRecOfClientList = &prBssInfo->rStaRecOfClientList; - - if (!LINK_IS_EMPTY(prStaRecOfClientList)) { - P_STA_RECORD_T prCurrStaRec; - - LINK_FOR_EACH_ENTRY(prCurrStaRec, prStaRecOfClientList, rLinkEntry, STA_RECORD_T) { - - if (prCurrStaRec == prStaRec) { - DBGLOG(BSS, WARN, ("Current Client List already contains that STA_RECORD_T["MACSTR"]\n", - MAC2STR(prStaRec->aucMacAddr))); - return; - } - } - } - - LINK_INSERT_TAIL(prStaRecOfClientList, &prStaRec->rLinkEntry); - - return; -} /* end of bssAddStaRecToClientList() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to Remove a STA_RECORD_T from the client list for AdHoc or AP Mode -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bssRemoveStaRecFromClientList ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo, - IN P_STA_RECORD_T prStaRec - ) -{ - P_LINK_T prStaRecOfClientList; - - - ASSERT(prBssInfo); - - prStaRecOfClientList = &prBssInfo->rStaRecOfClientList; - - if (!LINK_IS_EMPTY(prStaRecOfClientList)) { - P_STA_RECORD_T prCurrStaRec; - - LINK_FOR_EACH_ENTRY(prCurrStaRec, prStaRecOfClientList, rLinkEntry, STA_RECORD_T) { - - if (prCurrStaRec == prStaRec) { - - LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prStaRec->rLinkEntry); - - return; - } - } - } - - DBGLOG(BSS, INFO, ("Current Client List didn't contain that STA_RECORD_T["MACSTR"] before removing.\n", - MAC2STR(prStaRec->aucMacAddr))); - - return; -} /* end of bssRemoveStaRecFromClientList() */ -#endif /* CFG_SUPPORT_ADHOC || CFG_SUPPORT_AAA */ - - -#if CFG_SUPPORT_ADHOC -/*----------------------------------------------------------------------------*/ -/* Routines for IBSS(AdHoc) only */ -/*----------------------------------------------------------------------------*/ -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to process Beacons from current Ad-Hoc network peers. -* We also process Beacons from other Ad-Hoc network during SCAN. If it has -* the same SSID and we'll decide to merge into it if it has a larger TSF. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prBssInfo Pointer to the BSS_INFO_T. -* @param[in] prBSSDesc Pointer to the BSS Descriptor. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -ibssProcessMatchedBeacon ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo, - IN P_BSS_DESC_T prBssDesc, - IN UINT_8 ucRCPI - ) -{ - P_STA_RECORD_T prStaRec = NULL; - - BOOLEAN fgIsCheckCapability = FALSE; - BOOLEAN fgIsCheckTSF = FALSE; - BOOLEAN fgIsGoingMerging = FALSE; - BOOLEAN fgIsSameBSSID; - - - ASSERT(prBssInfo); - ASSERT(prBssDesc); - - //4 <1> Process IBSS Beacon only after we create or merge with other IBSS. - if (!prBssInfo->fgIsBeaconActivated) { - return; - } - - //4 <2> Get the STA_RECORD_T of TA. - prStaRec = cnmGetStaRecByAddress(prAdapter, - (UINT_8) NETWORK_TYPE_AIS_INDEX, - prBssDesc->aucSrcAddr); - - fgIsSameBSSID = UNEQUAL_MAC_ADDR(prBssInfo->aucBSSID, prBssDesc->aucBSSID) ? FALSE : TRUE; - - - //4 <3> IBSS Merge Decision Flow for Processing Beacon. - if (fgIsSameBSSID) { - - /* Same BSSID: - * Case I. This is a new TA and it has decide to merged with us. - * a) If fgIsMerging == FALSE - we will send msg to notify AIS. - * b) If fgIsMerging == TRUE - already notify AIS. - * Case II. This is an old TA and we've already merged together. - */ - if (!prStaRec) { - - /* For Case I - Check this IBSS's capability first before adding this Sta Record. */ - fgIsCheckCapability = TRUE; - - /* If check is passed, then we perform merging with this new IBSS */ - fgIsGoingMerging = TRUE; - - } - else { - - ASSERT((prStaRec->ucNetTypeIndex == NETWORK_TYPE_AIS_INDEX) && - IS_ADHOC_STA(prStaRec)); - - if (prStaRec->ucStaState != STA_STATE_3) { - - if (!prStaRec->fgIsMerging) { - - /* For Case I - Check this IBSS's capability first before adding this Sta Record. */ - fgIsCheckCapability = TRUE; - - /* If check is passed, then we perform merging with this new IBSS */ - fgIsGoingMerging = TRUE; - } - else { - /* For Case II - Update rExpirationTime of Sta Record */ - GET_CURRENT_SYSTIME(&prStaRec->rUpdateTime); - } - } - else { - /* For Case II - Update rExpirationTime of Sta Record */ - GET_CURRENT_SYSTIME(&prStaRec->rUpdateTime); - } - - } - } - else { - - /* Unequal BSSID: - * Case III. This is a new TA and we need to compare the TSF and get the winner. - * Case IV. This is an old TA and it merge into a new IBSS before we do the same thing. - * We need to compare the TSF to get the winner. - * Case V. This is an old TA and it restart a new IBSS. We also need to - * compare the TSF to get the winner. - */ - - /* For Case III, IV & V - We'll always check this new IBSS's capability first - * before merging into new IBSS. - */ - fgIsCheckCapability = TRUE; - - /* If check is passed, we need to perform TSF check to decide the major BSSID */ - fgIsCheckTSF = TRUE; - - /* For Case IV & V - We won't update rExpirationTime of Sta Record */ - } - - - //4 <7> Check this BSS_DESC_T's capability. - if (fgIsCheckCapability) { - BOOLEAN fgIsCapabilityMatched = FALSE; - - do { - if (!(prBssDesc->ucPhyTypeSet & (prAdapter->rWifiVar.ucAvailablePhyTypeSet))) { - DBGLOG(BSS, LOUD, - ("IBSS MERGE: Ignore Peer MAC: "MACSTR" - Unsupported Phy.\n", - MAC2STR(prBssDesc->aucSrcAddr))); - - break; - } - - if (prBssDesc->fgIsUnknownBssBasicRate) { - DBGLOG(BSS, LOUD, - ("IBSS MERGE: Ignore Peer MAC: "MACSTR" - Unknown Basic Rate.\n", - MAC2STR(prBssDesc->aucSrcAddr))); - - break; - } - - if (ibssCheckCapabilityForAdHocMode(prAdapter, prBssDesc) == WLAN_STATUS_FAILURE) { - DBGLOG(BSS, LOUD, - ("IBSS MERGE: Ignore Peer MAC: "MACSTR" - Capability is not matched.\n", - MAC2STR(prBssDesc->aucSrcAddr))); - - break; - } - - fgIsCapabilityMatched = TRUE; - } - while (FALSE); - - if (!fgIsCapabilityMatched) { - - if (prStaRec) { - /* For Case II - We merge this STA_RECORD in RX Path. - * Case IV & V - They change their BSSID after we merge with them. - */ - - DBGLOG(BSS, LOUD, - ("IBSS MERGE: Ignore Peer MAC: "MACSTR" - Capability is not matched.\n", - MAC2STR(prBssDesc->aucSrcAddr))); - } - - return; - } - - DBGLOG(BSS, LOUD, - ("IBSS MERGE: Peer MAC: "MACSTR" - Check capability was passed.\n", - MAC2STR(prBssDesc->aucSrcAddr))); - } - - - if (fgIsCheckTSF) { -#if CFG_SLT_SUPPORT - fgIsGoingMerging = TRUE; -#else - if (prBssDesc->fgIsLargerTSF) { - fgIsGoingMerging = TRUE; - } - else { - return; - } -#endif - } - - - if (fgIsGoingMerging) { - P_MSG_AIS_IBSS_PEER_FOUND_T prAisIbssPeerFoundMsg; - - - //4 <1> We will merge with to this BSS immediately. - prBssDesc->fgIsConnecting = TRUE; - prBssDesc->fgIsConnected = FALSE; - - //4 <2> Setup corresponding STA_RECORD_T - prStaRec = bssCreateStaRecFromBssDesc(prAdapter, - STA_TYPE_ADHOC_PEER, - NETWORK_TYPE_AIS_INDEX, - prBssDesc); - - if(!prStaRec) { - // no memory ? - return; - } - - prStaRec->fgIsMerging = TRUE; - - /* update RCPI */ - prStaRec->ucRCPI = ucRCPI; - - //4 <3> Send Merge Msg to CNM to obtain the channel privilege. - prAisIbssPeerFoundMsg = (P_MSG_AIS_IBSS_PEER_FOUND_T) - cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_AIS_IBSS_PEER_FOUND_T)); - - if (!prAisIbssPeerFoundMsg) { - - ASSERT(0); // Can't send Merge Msg - return; - } - - prAisIbssPeerFoundMsg->rMsgHdr.eMsgId = MID_SCN_AIS_FOUND_IBSS; - prAisIbssPeerFoundMsg->ucNetTypeIndex = (UINT_8)NETWORK_TYPE_AIS_INDEX; - prAisIbssPeerFoundMsg->prStaRec = prStaRec; - - /* Inform AIS to do STATE TRANSITION - * For Case I - If AIS in IBSS_ALONE, let it jump to NORMAL_TR after we know the new member. - * For Case III, IV - Now this new BSSID wins the TSF, follow it. - */ - if (fgIsSameBSSID) { - prAisIbssPeerFoundMsg->fgIsMergeIn = TRUE; - } - else { -#if CFG_SLT_SUPPORT - prAisIbssPeerFoundMsg->fgIsMergeIn = TRUE; -#else - prAisIbssPeerFoundMsg->fgIsMergeIn = (prBssDesc->fgIsLargerTSF) ? FALSE: TRUE; -#endif - } - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prAisIbssPeerFoundMsg, - MSG_SEND_METHOD_BUF); - - } - - return; -} /* end of ibssProcessMatchedBeacon() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will check the Capability for Ad-Hoc to decide if we are -* able to merge with(same capability). -* -* @param[in] prBSSDesc Pointer to the BSS Descriptor. -* -* @retval WLAN_STATUS_FAILURE Can't pass the check of Capability. -* @retval WLAN_STATUS_SUCCESS Pass the check of Capability. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -ibssCheckCapabilityForAdHocMode ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ) -{ - P_CONNECTION_SETTINGS_T prConnSettings; - WLAN_STATUS rStatus = WLAN_STATUS_FAILURE; - - - ASSERT(prBssDesc); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - do { - //4 <1> Check the BSS Basic Rate Set for current AdHoc Mode - if ((prConnSettings->eAdHocMode == AD_HOC_MODE_11B) && - (prBssDesc->u2BSSBasicRateSet & ~RATE_SET_HR_DSSS)) { - break; - } - else if ((prConnSettings->eAdHocMode == AD_HOC_MODE_11A) && - (prBssDesc->u2BSSBasicRateSet & ~RATE_SET_OFDM)) { - break; - } - - //4 <2> Check the Short Slot Time. -#if 0 // Do not check ShortSlotTime until Wi-Fi define such policy - if (prConnSettings->eAdHocMode == AD_HOC_MODE_11G) { - if (((prConnSettings->fgIsShortSlotTimeOptionEnable) && - !(prBssDesc->u2CapInfo & CAP_INFO_SHORT_SLOT_TIME)) || - (!(prConnSettings->fgIsShortSlotTimeOptionEnable) && - (prBssDesc->u2CapInfo & CAP_INFO_SHORT_SLOT_TIME))) { - break; - } - } -#endif - - //4 <3> Check the ATIM window setting. - if (prBssDesc->u2ATIMWindow) { - DBGLOG(BSS, INFO, ("AdHoc PS was not supported(ATIM Window: %d)\n", - prBssDesc->u2ATIMWindow)); - break; - } - -#if CFG_RSN_MIGRATION - //4 <4> Check the Security setting. - if (!rsnPerformPolicySelection(prAdapter, prBssDesc)) { - break; - } -#endif - - rStatus = WLAN_STATUS_SUCCESS; - } - while (FALSE); - - return rStatus; - -} /* end of ibssCheckCapabilityForAdHocMode() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will initial the BSS_INFO_T for IBSS Mode. -* -* @param[in] prBssInfo Pointer to the BSS_INFO_T. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -ibssInitForAdHoc ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo - ) -{ - UINT_8 ucLowestBasicRateIndex; - UINT_8 aucBSSID[MAC_ADDR_LEN]; - PUINT_16 pu2BSSID = (PUINT_16)&aucBSSID[0]; - UINT_32 i; - - - ASSERT(prBssInfo); - ASSERT(prBssInfo->eCurrentOPMode == OP_MODE_IBSS); - - - //4 <1> Setup PHY Attributes and Basic Rate Set/Operational Rate Set - prBssInfo->ucNonHTBasicPhyType = (UINT_8) - rNonHTAdHocModeAttributes[prBssInfo->ucConfigAdHocAPMode].ePhyTypeIndex; - prBssInfo->u2BSSBasicRateSet = - rNonHTAdHocModeAttributes[prBssInfo->ucConfigAdHocAPMode].u2BSSBasicRateSet; - - - prBssInfo->u2OperationalRateSet = - rNonHTPhyAttributes[prBssInfo->ucNonHTBasicPhyType].u2SupportedRateSet; - - rateGetDataRatesFromRateSet(prBssInfo->u2OperationalRateSet, - prBssInfo->u2BSSBasicRateSet, - prBssInfo->aucAllSupportedRates, - &prBssInfo->ucAllSupportedRatesLen); - - //4 <2> Setup BSSID - if (!prBssInfo->fgHoldSameBssidForIBSS) { - - for (i = 0; i < sizeof(aucBSSID)/sizeof(UINT_16); i++) { - pu2BSSID[i] = (UINT_16)(kalRandomNumber() & 0xFFFF); - } - - aucBSSID[0] &= ~0x01; // 7.1.3.3.3 - The individual/group bit of the address is set to 0. - aucBSSID[0] |= 0x02; // 7.1.3.3.3 - The universal/local bit of the address is set to 1. - - COPY_MAC_ADDR(prBssInfo->aucBSSID, aucBSSID); - } - - - //4 <3> Setup Capability - Short Preamble - if (rNonHTPhyAttributes[prBssInfo->ucNonHTBasicPhyType].fgIsShortPreambleOptionImplemented && - ((prAdapter->rWifiVar.ePreambleType == PREAMBLE_TYPE_SHORT) || /* Short Preamble Option Enable is TRUE */ - (prAdapter->rWifiVar.ePreambleType == PREAMBLE_TYPE_AUTO)) ) { - - prBssInfo->fgIsShortPreambleAllowed = TRUE; - prBssInfo->fgUseShortPreamble = TRUE; - } - else { - prBssInfo->fgIsShortPreambleAllowed = FALSE; - prBssInfo->fgUseShortPreamble = FALSE; - } - - - //4 <4> Setup Capability - Short Slot Time - // 7.3.1.4 For IBSS, the Short Slot Time subfield shall be set to 0. - prBssInfo->fgUseShortSlotTime = FALSE; /* Set to FALSE for AdHoc */ - - - //4 <5> Compoase Capability - prBssInfo->u2CapInfo = CAP_INFO_IBSS; - - if (prBssInfo->fgIsProtection) { - prBssInfo->u2CapInfo |= CAP_INFO_PRIVACY; - } - - if (prBssInfo->fgIsShortPreambleAllowed) { - prBssInfo->u2CapInfo |= CAP_INFO_SHORT_PREAMBLE; - } - - if (prBssInfo->fgUseShortSlotTime) { - prBssInfo->u2CapInfo |= CAP_INFO_SHORT_SLOT_TIME; - } - - - //4 <6> Find Lowest Basic Rate Index for default TX Rate of MMPDU - rateGetLowestRateIndexFromRateSet(prBssInfo->u2BSSBasicRateSet, &ucLowestBasicRateIndex); - - prBssInfo->ucHwDefaultFixedRateCode = - aucRateIndex2RateCode[PREAMBLE_DEFAULT_LONG_NONE][ucLowestBasicRateIndex]; - - return; -} /* end of ibssInitForAdHoc() */ - -#endif /* CFG_SUPPORT_ADHOC */ - - -#if CFG_SUPPORT_AAA - -/*----------------------------------------------------------------------------*/ -/* Routines for BSS(AP) only */ -/*----------------------------------------------------------------------------*/ -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will initial the BSS_INFO_T for AP Mode. -* -* @param[in] prBssInfo Given related BSS_INFO_T. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bssInitForAP ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo, - IN BOOLEAN fgIsRateUpdate - ) -{ - UINT_8 ucLowestBasicRateIndex; - - P_AC_QUE_PARMS_T prACQueParms; - - ENUM_WMM_ACI_T eAci; - - UINT_8 auCWminLog2ForBcast[WMM_AC_INDEX_NUM] = { 4/*BE*/, 4 /*BK*/, 3/*VO*/, 2/*VI*/}; - UINT_8 auCWmaxLog2ForBcast[WMM_AC_INDEX_NUM] = { 10, 10, 4, 3}; - UINT_8 auAifsForBcast[WMM_AC_INDEX_NUM] = { 3, 7, 2, 2 }; - UINT_8 auTxopForBcast[WMM_AC_INDEX_NUM] = { 0, 0, 94, 47 }; /* If the AP is OFDM */ - - UINT_8 auCWminLog2[WMM_AC_INDEX_NUM] = { 4 /*BE*/, 4 /*BK*/, 3 /*VO*/, 2 /*VI*/}; - UINT_8 auCWmaxLog2[WMM_AC_INDEX_NUM] = { 7, 10, 4, 3}; - UINT_8 auAifs[WMM_AC_INDEX_NUM] = { 3, 7, 1, 1 }; - UINT_8 auTxop[WMM_AC_INDEX_NUM] = { 0, 0, 94, 47 }; /* If the AP is OFDM */ - - DEBUGFUNC("bssInitForAP"); - DBGLOG(BSS, LOUD,("\n")); - - ASSERT(prBssInfo); - ASSERT((prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) || (prBssInfo->eCurrentOPMode == OP_MODE_BOW)); - -#if 0 - prAdapter->rWifiVar.rConnSettings.fgRxShortGIDisabled = TRUE; - prAdapter->rWifiVar.rConnSettings.uc2G4BandwidthMode = CONFIG_BW_20M; - prAdapter->rWifiVar.rConnSettings.uc5GBandwidthMode = CONFIG_BW_20M; -#endif - - - //4 <1> Setup PHY Attributes and Basic Rate Set/Operational Rate Set - prBssInfo->ucNonHTBasicPhyType = (UINT_8) - rNonHTApModeAttributes[prBssInfo->ucConfigAdHocAPMode].ePhyTypeIndex; - prBssInfo->u2BSSBasicRateSet = - rNonHTApModeAttributes[prBssInfo->ucConfigAdHocAPMode].u2BSSBasicRateSet; - - - prBssInfo->u2OperationalRateSet = - rNonHTPhyAttributes[prBssInfo->ucNonHTBasicPhyType].u2SupportedRateSet; - - if (fgIsRateUpdate) { - rateGetDataRatesFromRateSet(prBssInfo->u2OperationalRateSet, - prBssInfo->u2BSSBasicRateSet, - prBssInfo->aucAllSupportedRates, - &prBssInfo->ucAllSupportedRatesLen); - } - - //4 <2> Setup BSSID - COPY_MAC_ADDR(prBssInfo->aucBSSID, prBssInfo->aucOwnMacAddr); - - - //4 <3> Setup Capability - Short Preamble - if (rNonHTPhyAttributes[prBssInfo->ucNonHTBasicPhyType].fgIsShortPreambleOptionImplemented && - ((prAdapter->rWifiVar.ePreambleType == PREAMBLE_TYPE_SHORT) || /* Short Preamble Option Enable is TRUE */ - (prAdapter->rWifiVar.ePreambleType == PREAMBLE_TYPE_AUTO)) ) { - - prBssInfo->fgIsShortPreambleAllowed = TRUE; - prBssInfo->fgUseShortPreamble = TRUE; - } - else { - prBssInfo->fgIsShortPreambleAllowed = FALSE; - prBssInfo->fgUseShortPreamble = FALSE; - } - - - //4 <4> Setup Capability - Short Slot Time - prBssInfo->fgUseShortSlotTime = TRUE; - - //4 <5> Compoase Capability - prBssInfo->u2CapInfo = CAP_INFO_ESS; - - if (prBssInfo->fgIsProtection) { - prBssInfo->u2CapInfo |= CAP_INFO_PRIVACY; - } - - if (prBssInfo->fgIsShortPreambleAllowed) { - prBssInfo->u2CapInfo |= CAP_INFO_SHORT_PREAMBLE; - } - - if (prBssInfo->fgUseShortSlotTime) { - prBssInfo->u2CapInfo |= CAP_INFO_SHORT_SLOT_TIME; - } - - - //4 <6> Find Lowest Basic Rate Index for default TX Rate of MMPDU - rateGetLowestRateIndexFromRateSet(prBssInfo->u2BSSBasicRateSet, &ucLowestBasicRateIndex); - - prBssInfo->ucHwDefaultFixedRateCode = - aucRateIndex2RateCode[PREAMBLE_DEFAULT_LONG_NONE][ucLowestBasicRateIndex]; - - - //4 <7> Fill the EDCA - - prACQueParms = prBssInfo->arACQueParmsForBcast; - - for(eAci = 0; eAci < WMM_AC_INDEX_NUM; eAci++){ - - prACQueParms[eAci].fgIsACMSet = FALSE; - prACQueParms[eAci].u2Aifsn = auAifsForBcast[eAci]; - prACQueParms[eAci].u2CWmin = BIT(auCWminLog2ForBcast[eAci])-1; - prACQueParms[eAci].u2CWmax = BIT(auCWmaxLog2ForBcast[eAci])-1; - prACQueParms[eAci].u2TxopLimit = auTxopForBcast[eAci]; - - prBssInfo->aucCWminLog2ForBcast[eAci] = auCWminLog2ForBcast[eAci] ; /* used to send WMM IE */ - prBssInfo->aucCWmaxLog2ForBcast[eAci] = auCWmaxLog2ForBcast[eAci] ; - - DBGLOG(BSS, INFO, ("Bcast: eAci = %d, ACM = %d, Aifsn = %d, CWmin = %d, CWmax = %d, TxopLimit = %d\n", - eAci,prACQueParms[eAci].fgIsACMSet , - prACQueParms[eAci].u2Aifsn, - prACQueParms[eAci].u2CWmin, - prACQueParms[eAci].u2CWmax, - prACQueParms[eAci].u2TxopLimit)); - - } - - prACQueParms = prBssInfo->arACQueParms; - - for(eAci = 0; eAci < WMM_AC_INDEX_NUM; eAci++){ - - prACQueParms[eAci].fgIsACMSet = FALSE; - prACQueParms[eAci].u2Aifsn = auAifs[eAci]; - prACQueParms[eAci].u2CWmin = BIT(auCWminLog2[eAci])-1; - prACQueParms[eAci].u2CWmax = BIT(auCWmaxLog2[eAci])-1; - prACQueParms[eAci].u2TxopLimit = auTxop[eAci]; - - DBGLOG(BSS, INFO, ("eAci = %d, ACM = %d, Aifsn = %d, CWmin = %d, CWmax = %d, TxopLimit = %d\n", - eAci,prACQueParms[eAci].fgIsACMSet , - prACQueParms[eAci].u2Aifsn, - prACQueParms[eAci].u2CWmin, - prACQueParms[eAci].u2CWmax, - prACQueParms[eAci].u2TxopLimit)); - } - - /* Note: Caller should update the EDCA setting to HW by nicQmUpdateWmmParms() it there is no AIS network */ - /* Note: In E2, only 4 HW queues. The the Edca parameters should be folow by AIS network */ - /* Note: In E3, 8 HW queues. the Wmm parameters should be updated to right queues according to BSS */ - - - return; -} /* end of bssInitForAP() */ - -#if 0 -/*----------------------------------------------------------------------------*/ -/*! -* @brief Update DTIM Count -* -* @param[in] eNetTypeIndex Specify which network to update -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bssUpdateDTIMCount ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ) -{ - P_BSS_INFO_T prBssInfo; - - - ASSERT(eNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[eNetTypeIndex]); - - if (prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) { - - // Setup DTIM Count for next TBTT. - if (prBssInfo->ucDTIMCount > 0) { - prBssInfo->ucDTIMCount--; - } - else { - - ASSERT(prBssInfo->ucDTIMPeriod > 0); - - prBssInfo->ucDTIMCount = prBssInfo->ucDTIMPeriod - 1; - } - } - - return; -} /* end of bssUpdateDTIMIE() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to set the Virtual Bitmap in TIM Information Elements -* -* @param[in] prBssInfo Pointer to the BSS_INFO_T. -* @param[in] u2AssocId The association id to set in Virtual Bitmap. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -bssSetTIMBitmap ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo, - IN UINT_16 u2AssocId - ) -{ - - ASSERT(prBssInfo); - - if (prBssInfo->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX) { - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo; - - - prP2pSpecificBssInfo = &(prAdapter->rWifiVar.rP2pSpecificBssInfo); - - /* Use Association ID == 0 for BMCAST indication */ - if (u2AssocId == 0) { - - prP2pSpecificBssInfo->ucBitmapCtrl |= (UINT_8)BIT(0); - } - else { - PUINT_8 pucPartialVirtualBitmap; - UINT_8 ucBitmapToSet; - - - pucPartialVirtualBitmap = &prP2pSpecificBssInfo->aucPartialVirtualBitmap[(u2AssocId >> 3)]; // (u2AssocId / 8) - ucBitmapToSet = (UINT_8) BIT((u2AssocId % 8)); - - if (*pucPartialVirtualBitmap & ucBitmapToSet) { - /* The virtual bitmap has been set */ - return; - } - - *pucPartialVirtualBitmap |= ucBitmapToSet; - - // Update u2SmallestAID and u2LargestAID - if ((u2AssocId < prP2pSpecificBssInfo->u2SmallestAID) || - (prP2pSpecificBssInfo->u2SmallestAID == 0)) { - prP2pSpecificBssInfo->u2SmallestAID = u2AssocId; - } - - if ((u2AssocId > prP2pSpecificBssInfo->u2LargestAID) || - (prP2pSpecificBssInfo->u2LargestAID == 0)) { - prP2pSpecificBssInfo->u2LargestAID = u2AssocId; - } - } - } - - return; -} /* end of bssSetTIMBitmap() */ -#endif - -#endif /* CFG_SUPPORT_AAA */ - - -VOID -bssCreateStaRecFromAuth ( - IN P_ADAPTER_T prAdapter - ) -{ - -} - - -VOID -bssUpdateStaRecFromAssocReq ( - IN P_ADAPTER_T prAdapter - ) -{ - -} - - diff --git a/drivers/net/wireless/mt5931/mgmt/cnm.c b/drivers/net/wireless/mt5931/mgmt/cnm.c deleted file mode 100755 index 1af871d96310..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/cnm.c +++ /dev/null @@ -1,775 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/cnm.c#2 $ -*/ - -/*! \file "cnm.c" - \brief Module of Concurrent Network Management - - Module of Concurrent Network Management -*/ - - - -/* -** $Log: cnm.c $ - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 11 15 2011 cm.chang - * NULL - * Fix possible wrong message when P2P is unregistered - * - * 11 14 2011 yuche.tsai - * [WCXRP00001107] [Volunteer Patch][Driver] Large Network Type index assert in FW issue. - * Fix large network type index assert in FW issue. - * - * 11 10 2011 cm.chang - * NULL - * Modify debug message for XLOG - * - * 11 08 2011 cm.chang - * NULL - * Add RLM and CNM debug message for XLOG - * - * 11 01 2011 cm.chang - * [WCXRP00001077] [All Wi-Fi][Driver] Fix wrong preferred channel for AP and BOW - * Only check AIS channel for P2P and BOW - * - * 10 25 2011 cm.chang - * [WCXRP00001058] [All Wi-Fi][Driver] Fix sta_rec's phyTypeSet and OBSS scan in AP mode - * Extension channel of some 5G AP will not follow regulation requirement - * - * 09 30 2011 cm.chang - * [WCXRP00001020] [MT6620 Wi-Fi][Driver] Handle secondary channel offset of AP in 5GHz band - * . - * - * 09 01 2011 cm.chang - * [WCXRP00000937] [MT6620 Wi-Fi][Driver][FW] cnm.c line #848 assert when doing monkey test - * Print message only in Linux platform for monkey testing - * - * 06 23 2011 cp.wu - * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module - * change parameter name from PeerAddr to BSSID - * - * 06 20 2011 cp.wu - * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module - * 1. specify target's BSSID when requesting channel privilege. - * 2. pass BSSID information to firmware domain - * - * 06 01 2011 cm.chang - * [WCXRP00000756] [MT6620 Wi-Fi][Driver] 1. AIS follow channel of BOW 2. Provide legal channel function - * Limit AIS to fixed channel same with BOW - * - * 04 12 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * . - * - * 03 10 2011 cm.chang - * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module - * Check if P2P network index is Tethering AP - * - * 03 10 2011 cm.chang - * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module - * Add some functions to let AIS/Tethering or AIS/BOW be the same channel - * - * 02 17 2011 cm.chang - * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module - * When P2P registried, invoke BOW deactivate function - * - * 01 12 2011 cm.chang - * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module - * Provide function to decide if BSS can be activated or not - * - * 12 07 2010 cm.chang - * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk - * 1. BSSINFO include RLM parameter - * 2. free all sta records when network is disconnected - * - * 12 07 2010 cm.chang - * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant - * 1. Country code is from NVRAM or supplicant - * 2. Change band definition in CMD/EVENT. - * - * 11 08 2010 cm.chang - * [WCXRP00000169] [MT6620 Wi-Fi][Driver][FW] Remove unused CNM recover message ID - * Remove CNM channel reover message ID - * - * 10 13 2010 cm.chang - * [WCXRP00000094] [MT6620 Wi-Fi][Driver] Connect to 2.4GHz AP, Driver crash. - * Add exception handle when cmd buffer is not available - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 07 19 2010 wh.su - * - * update for security supporting. - * - * 07 19 2010 cm.chang - * - * Set RLM parameters and enable CNM channel manager - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Rename MID_MNY_CNM_CH_RELEASE to MID_MNY_CNM_CH_ABORT - * - * 07 01 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Fix wrong message ID for channel grant to requester - * - * 07 01 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Modify CNM message handler for new flow - * - * 06 07 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Set 20/40M bandwidth of AP HT OP before association process - * - * 05 31 2010 yarco.yang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add RX TSF Log Feature and ADDBA Rsp with DECLINE handling - * - * 05 21 2010 yarco.yang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support TCP/UDP/IP Checksum offload feature - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 05 05 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add a new function to send abort message - * - * 04 27 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * BMC mac address shall be ignored in basic config command - * - * 04 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW - * - * 04 22 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support change of MAC address by host command - * - * 04 16 2010 wh.su - * [BORA00000680][MT6620] Support the statistic for Microsoft os query - * adding the wpa-none for ibss beacon. - * - * 04 07 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Fix bug for OBSS scan - * - * 03 30 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support 2.4G OBSS scan - * - * 03 16 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add AdHoc Mode - * - * 03 10 2010 kevin.huang - * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support - * - * * * * * * * * * * Add Channel Manager for arbitration of JOIN and SCAN Req - * - * 02 25 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * use the Rx0 dor event indicate. - * - * 02 08 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support partial part about cmd basic configuration - * - * Dec 10 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Remove conditional compiling FPGA_V5 - * - * Nov 18 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add function cnmFsmEventInit() - * - * Nov 2 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to initialize variables in CNM_INFO_T. -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmInit ( - P_ADAPTER_T prAdapter - ) -{ - return; -} /* end of cnmInit() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to initialize variables in CNM_INFO_T. -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmUninit ( - P_ADAPTER_T prAdapter - ) -{ - return; -} /* end of cnmUninit() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Before handle the message from other module, it need to obtain -* the Channel privilege from Channel Manager -* -* @param[in] prMsgHdr The message need to be handled. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmChMngrRequestPrivilege ( - P_ADAPTER_T prAdapter, - P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_CH_REQ_T prMsgChReq; - P_CMD_CH_PRIVILEGE_T prCmdBody; - WLAN_STATUS rStatus; - - ASSERT(prAdapter); - ASSERT(prMsgHdr); - - prMsgChReq = (P_MSG_CH_REQ_T) prMsgHdr; - - prCmdBody = (P_CMD_CH_PRIVILEGE_T) - cnmMemAlloc(prAdapter, RAM_TYPE_BUF, sizeof(CMD_CH_PRIVILEGE_T)); - ASSERT(prCmdBody); - - /* To do: exception handle */ - if (!prCmdBody) { - DBGLOG(CNM, ERROR, ("ChReq: fail to get buf (net=%d, token=%d)\n", - prMsgChReq->ucNetTypeIndex, prMsgChReq->ucTokenID)); - - cnmMemFree(prAdapter, prMsgHdr); - return; - } - - DBGLOG(CNM, INFO, ("ChReq net=%d token=%d b=%d c=%d s=%d\n", - prMsgChReq->ucNetTypeIndex, prMsgChReq->ucTokenID, - prMsgChReq->eRfBand, prMsgChReq->ucPrimaryChannel, - prMsgChReq->eRfSco)); - - prCmdBody->ucNetTypeIndex = prMsgChReq->ucNetTypeIndex; - prCmdBody->ucTokenID = prMsgChReq->ucTokenID; - prCmdBody->ucAction = CMD_CH_ACTION_REQ; /* Request */ - prCmdBody->ucPrimaryChannel = prMsgChReq->ucPrimaryChannel; - prCmdBody->ucRfSco = (UINT_8) prMsgChReq->eRfSco; - prCmdBody->ucRfBand = (UINT_8) prMsgChReq->eRfBand; - prCmdBody->ucReqType = (UINT_8) prMsgChReq->eReqType; - prCmdBody->ucReserved = 0; - prCmdBody->u4MaxInterval= prMsgChReq->u4MaxInterval; - COPY_MAC_ADDR(prCmdBody->aucBSSID, prMsgChReq->aucBSSID); - - ASSERT(prCmdBody->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - - /* For monkey testing 20110901 */ - if (prCmdBody->ucNetTypeIndex >= NETWORK_TYPE_INDEX_NUM) { - DBGLOG(CNM, ERROR, ("CNM: ChReq with wrong netIdx=%d\n\n", - prCmdBody->ucNetTypeIndex)); - } - - rStatus = wlanSendSetQueryCmd ( - prAdapter, /* prAdapter */ - CMD_ID_CH_PRIVILEGE, /* ucCID */ - TRUE, /* fgSetQuery */ - FALSE, /* fgNeedResp */ - FALSE, /* fgIsOid */ - NULL, /* pfCmdDoneHandler */ - NULL, /* pfCmdTimeoutHandler */ - sizeof(CMD_CH_PRIVILEGE_T), /* u4SetQueryInfoLen */ - (PUINT_8) prCmdBody, /* pucInfoBuffer */ - NULL, /* pvSetQueryBuffer */ - 0 /* u4SetQueryBufferLen */ - ); - - ASSERT(rStatus == WLAN_STATUS_PENDING); - - cnmMemFree(prAdapter, prCmdBody); - cnmMemFree(prAdapter, prMsgHdr); - - return; -} /* end of cnmChMngrRequestPrivilege() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Before deliver the message to other module, it need to release -* the Channel privilege to Channel Manager. -* -* @param[in] prMsgHdr The message need to be delivered -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmChMngrAbortPrivilege ( - P_ADAPTER_T prAdapter, - P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_CH_ABORT_T prMsgChAbort; - P_CMD_CH_PRIVILEGE_T prCmdBody; - WLAN_STATUS rStatus; - - ASSERT(prAdapter); - ASSERT(prMsgHdr); - - prMsgChAbort = (P_MSG_CH_ABORT_T) prMsgHdr; - - prCmdBody = (P_CMD_CH_PRIVILEGE_T) - cnmMemAlloc(prAdapter, RAM_TYPE_BUF, sizeof(CMD_CH_PRIVILEGE_T)); - ASSERT(prCmdBody); - - /* To do: exception handle */ - if (!prCmdBody) { - DBGLOG(CNM, ERROR, ("ChAbort: fail to get buf (net=%d, token=%d)\n", - prMsgChAbort->ucNetTypeIndex, prMsgChAbort->ucTokenID)); - - cnmMemFree(prAdapter, prMsgHdr); - return; - } - - DBGLOG(CNM, INFO, ("ChAbort net=%d token=%d\n", - prMsgChAbort->ucNetTypeIndex, prMsgChAbort->ucTokenID)); - - prCmdBody->ucNetTypeIndex = prMsgChAbort->ucNetTypeIndex; - prCmdBody->ucTokenID = prMsgChAbort->ucTokenID; - prCmdBody->ucAction = CMD_CH_ACTION_ABORT; /* Abort */ - - ASSERT(prCmdBody->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - - /* For monkey testing 20110901 */ - if (prCmdBody->ucNetTypeIndex >= NETWORK_TYPE_INDEX_NUM) { - DBGLOG(CNM, ERROR, ("CNM: ChAbort with wrong netIdx=%d\n\n", - prCmdBody->ucNetTypeIndex)); - } - - rStatus = wlanSendSetQueryCmd ( - prAdapter, /* prAdapter */ - CMD_ID_CH_PRIVILEGE, /* ucCID */ - TRUE, /* fgSetQuery */ - FALSE, /* fgNeedResp */ - FALSE, /* fgIsOid */ - NULL, /* pfCmdDoneHandler */ - NULL, /* pfCmdTimeoutHandler */ - sizeof(CMD_CH_PRIVILEGE_T), /* u4SetQueryInfoLen */ - (PUINT_8) prCmdBody, /* pucInfoBuffer */ - NULL, /* pvSetQueryBuffer */ - 0 /* u4SetQueryBufferLen */ - ); - - ASSERT(rStatus == WLAN_STATUS_PENDING); - - cnmMemFree(prAdapter, prCmdBody); - cnmMemFree(prAdapter, prMsgHdr); - - return; -} /* end of cnmChMngrAbortPrivilege() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmChMngrHandleChEvent ( - P_ADAPTER_T prAdapter, - P_WIFI_EVENT_T prEvent - ) -{ - P_EVENT_CH_PRIVILEGE_T prEventBody; - P_MSG_CH_GRANT_T prChResp; - - ASSERT(prAdapter); - ASSERT(prEvent); - - prEventBody = (P_EVENT_CH_PRIVILEGE_T) (prEvent->aucBuffer); - prChResp = (P_MSG_CH_GRANT_T) - cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_CH_GRANT_T)); - ASSERT(prChResp); - - /* To do: exception handle */ - if (!prChResp) { - DBGLOG(CNM, ERROR, ("ChGrant: fail to get buf (net=%d, token=%d)\n", - prEventBody->ucNetTypeIndex, prEventBody->ucTokenID)); - - return; - } - - DBGLOG(CNM, INFO, ("ChGrant net=%d token=%d ch=%d sco=%d\n", - prEventBody->ucNetTypeIndex, prEventBody->ucTokenID, - prEventBody->ucPrimaryChannel, prEventBody->ucRfSco)); - - ASSERT(prEventBody->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - ASSERT(prEventBody->ucStatus == EVENT_CH_STATUS_GRANT); - - /* Decide message ID based on network and response status */ - if (prEventBody->ucNetTypeIndex == NETWORK_TYPE_AIS_INDEX) { - prChResp->rMsgHdr.eMsgId = MID_CNM_AIS_CH_GRANT; - } -#if CFG_ENABLE_WIFI_DIRECT - else if ((prAdapter->fgIsP2PRegistered) && - (prEventBody->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX)) { - prChResp->rMsgHdr.eMsgId = MID_CNM_P2P_CH_GRANT; - } -#endif -#if CFG_ENABLE_BT_OVER_WIFI - else if (prEventBody->ucNetTypeIndex == NETWORK_TYPE_BOW_INDEX) { - prChResp->rMsgHdr.eMsgId = MID_CNM_BOW_CH_GRANT; - } -#endif - else { - cnmMemFree(prAdapter, prChResp); - return; - } - - prChResp->ucNetTypeIndex = prEventBody->ucNetTypeIndex; - prChResp->ucTokenID = prEventBody->ucTokenID; - prChResp->ucPrimaryChannel = prEventBody->ucPrimaryChannel; - prChResp->eRfSco = (ENUM_CHNL_EXT_T) prEventBody->ucRfSco; - prChResp->eRfBand = (ENUM_BAND_T) prEventBody->ucRfBand; - prChResp->eReqType = (ENUM_CH_REQ_TYPE_T) prEventBody->ucReqType; - prChResp->u4GrantInterval = prEventBody->u4GrantInterval; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prChResp, - MSG_SEND_METHOD_BUF); -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is invoked for P2P or BOW networks -* -* @param (none) -* -* @return TRUE: suggest to adopt the returned preferred channel -* FALSE: No suggestion. Caller should adopt its preference -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -cnmPreferredChannel ( - P_ADAPTER_T prAdapter, - P_ENUM_BAND_T prBand, - PUINT_8 pucPrimaryChannel, - P_ENUM_CHNL_EXT_T prBssSCO - ) -{ - P_BSS_INFO_T prBssInfo; - - ASSERT(prAdapter); - ASSERT(prBand); - ASSERT(pucPrimaryChannel); - ASSERT(prBssSCO); - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]; - - if (RLM_NET_PARAM_VALID(prBssInfo)) { - *prBand = prBssInfo->eBand; - *pucPrimaryChannel = prBssInfo->ucPrimaryChannel; - *prBssSCO = prBssInfo->eBssSCO; - - return TRUE; - } - - return FALSE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief -* -* @param (none) -* -* @return TRUE: available channel is limited to return value -* FALSE: no limited -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -cnmAisInfraChannelFixed ( - P_ADAPTER_T prAdapter, - P_ENUM_BAND_T prBand, - PUINT_8 pucPrimaryChannel - ) -{ -#if CFG_ENABLE_WIFI_DIRECT ||(CFG_ENABLE_BT_OVER_WIFI && CFG_BOW_LIMIT_AIS_CHNL) - P_BSS_INFO_T prBssInfo; -#endif - -#if CFG_ENABLE_WIFI_DIRECT - if (IS_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX) && - p2pFuncIsAPMode(prAdapter->rWifiVar.prP2pFsmInfo)) { - - ASSERT(prAdapter->fgIsP2PRegistered); - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]; - - *prBand = prBssInfo->eBand; - *pucPrimaryChannel = prBssInfo->ucPrimaryChannel; - - return TRUE; - } -#endif - -#if CFG_ENABLE_BT_OVER_WIFI && CFG_BOW_LIMIT_AIS_CHNL - if (IS_NET_ACTIVE(prAdapter, NETWORK_TYPE_BOW_INDEX)) { - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]; - - *prBand = prBssInfo->eBand; - *pucPrimaryChannel = prBssInfo->ucPrimaryChannel; - - return TRUE; - } -#endif - - return FALSE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmAisInfraConnectNotify ( - P_ADAPTER_T prAdapter - ) -{ -#if CFG_ENABLE_BT_OVER_WIFI - P_BSS_INFO_T prAisBssInfo, prBowBssInfo; - - prAisBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]; - prBowBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]; - - if (RLM_NET_PARAM_VALID(prAisBssInfo) && RLM_NET_PARAM_VALID(prBowBssInfo)){ - if (prAisBssInfo->eBand != prBowBssInfo->eBand || - prAisBssInfo->ucPrimaryChannel != prBowBssInfo->ucPrimaryChannel) { - - /* Notify BOW to do deactivation */ - bowNotifyAllLinkDisconnected(prAdapter); - } - } -#endif -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief -* -* @param (none) -* -* @return TRUE: permitted -* FALSE: Not permitted -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -cnmAisIbssIsPermitted ( - P_ADAPTER_T prAdapter - ) -{ -#if CFG_ENABLE_WIFI_DIRECT - if (IS_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX)) { - return FALSE; - } -#endif - -#if CFG_ENABLE_BT_OVER_WIFI - if (IS_NET_ACTIVE(prAdapter, NETWORK_TYPE_BOW_INDEX)) { - return FALSE; - } -#endif - - return TRUE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief -* -* @param (none) -* -* @return TRUE: permitted -* FALSE: Not permitted -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -cnmP2PIsPermitted ( - P_ADAPTER_T prAdapter - ) -{ - P_BSS_INFO_T prBssInfo; - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]; - - if (IS_BSS_ACTIVE(prBssInfo) && - prBssInfo->eCurrentOPMode == OP_MODE_IBSS) { - return FALSE; - } - -#if CFG_ENABLE_BT_OVER_WIFI - if (IS_NET_ACTIVE(prAdapter, NETWORK_TYPE_BOW_INDEX)) { - /* Notify BOW to do deactivation */ - bowNotifyAllLinkDisconnected(prAdapter); - } -#endif - - return TRUE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief -* -* @param (none) -* -* @return TRUE: permitted -* FALSE: Not permitted -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -cnmBowIsPermitted ( - P_ADAPTER_T prAdapter - ) -{ - P_BSS_INFO_T prBssInfo; - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]; - - if (IS_BSS_ACTIVE(prBssInfo) && - prBssInfo->eCurrentOPMode == OP_MODE_IBSS) { - return FALSE; - } - -#if CFG_ENABLE_WIFI_DIRECT - if (IS_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX)) { - return FALSE; - } -#endif - - return TRUE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief -* -* @param (none) -* -* @return TRUE: permitted -* FALSE: Not permitted -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -cnmBss40mBwPermitted ( - P_ADAPTER_T prAdapter, - ENUM_NETWORK_TYPE_INDEX_T eNetTypeIdx - ) -{ - P_BSS_INFO_T prBssInfo; - UINT_8 i; - - /* Note: To support real-time decision instead of current activated-time, - * the STA roaming case shall be considered about synchronization - * problem. Another variable fgAssoc40mBwAllowed is added to - * represent HT capability when association - */ - for (i = 0; i < NETWORK_TYPE_INDEX_NUM; i++) { - if (i != (UINT_8) eNetTypeIdx) { - prBssInfo = &prAdapter->rWifiVar.arBssInfo[i]; - - if (IS_BSS_ACTIVE(prBssInfo) && (prBssInfo->fg40mBwAllowed || - prBssInfo->fgAssoc40mBwAllowed)) { - return FALSE; - } - } - } - - return TRUE; -} - - diff --git a/drivers/net/wireless/mt5931/mgmt/cnm_mem.c b/drivers/net/wireless/mt5931/mgmt/cnm_mem.c deleted file mode 100755 index a1a50baf5382..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/cnm_mem.c +++ /dev/null @@ -1,1292 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/cnm_mem.c#2 $ -*/ - -/*! \file "cnm_mem.c" - \brief This file contain the management function of packet buffers and - generic memory alloc/free functioin for mailbox message. - - A data packet has a fixed size of buffer, but a management - packet can be equipped with a variable size of buffer. -*/ - - - -/* -** $Log: cnm_mem.c $ - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 03 14 2012 wh.su - * [WCXRP00001173] [MT6620 Wi-Fi][Driver] Adding the ICS Tethering WPA2-PSK supporting - * Add code from 2.2 - * - * 11 17 2011 tsaiyuan.hsu - * [WCXRP00001115] [MT6620 Wi-Fi][DRV] avoid deactivating staRec when changing state 3 to 3. - * initialize fgNeedResp. - * - * 11 17 2011 tsaiyuan.hsu - * [WCXRP00001115] [MT6620 Wi-Fi][DRV] avoid deactivating staRec when changing state 3 to 3. - * avoid deactivating staRec when changing state from 3 to 3. - * - * 02 01 2011 cm.chang - * [WCXRP00000415] [MT6620 Wi-Fi][Driver] Check if any memory leakage happens when uninitializing in DGB mode - * . - * - * 01 26 2011 cm.chang - * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument - * Allocate system RAM if fixed message or mgmt buffer is not available - * - * 01 26 2011 cm.chang - * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument - * . - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Change Station Type in Station Record, Modify MACRO definition for getting station type & network type index & Role. - * - * 12 13 2010 cp.wu - * [WCXRP00000260] [MT6620 Wi-Fi][Driver][Firmware] Create V1.1 branch for both firmware and driver - * create branch for Wi-Fi driver v1.1 - * - * 12 07 2010 cm.chang - * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk - * 1. BSSINFO include RLM parameter - * 2. free all sta records when network is disconnected - * - * 11 29 2010 cm.chang - * [WCXRP00000210] [MT6620 Wi-Fi][Driver][FW] Set RCPI value in STA_REC for initial TX rate selection of auto-rate algorithm - * Sync RCPI of STA_REC to FW as reference of initial TX rate - * - * 11 25 2010 yuche.tsai - * NULL - * Update SLT Function for QoS Support and not be affected by fixed rate function. - * - * 10 18 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * 1. remove redundant variables in STA_REC structure - * 2. add STA-REC uninitialization routine for clearing pending events - * - * 10 13 2010 cm.chang - * [WCXRP00000094] [MT6620 Wi-Fi][Driver] Connect to 2.4GHz AP, Driver crash. - * Add exception handle when cmd buffer is not available - * - * 10 12 2010 cp.wu - * [WCXRP00000084] [MT6620 Wi-Fi][Driver][FW] Add fixed rate support for distance test - * add HT (802.11n) fixed rate support. - * - * 10 08 2010 cp.wu - * [WCXRP00000084] [MT6620 Wi-Fi][Driver][FW] Add fixed rate support for distance test - * adding fixed rate support for distance test. (from registry setting) - * - * 09 24 2010 wh.su - * NULL - * [WCXRP00005002][MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning. - * - * 09 21 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * Do a complete reset with STA-REC null checking for RF test re-entry - * - * 09 16 2010 cm.chang - * NULL - * Change conditional compiling options for BOW - * - * 09 10 2010 cm.chang - * NULL - * Always update Beacon content if FW sync OBSS info - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 08 23 2010 chinghwa.yu - * NULL - * Update for BOW. - * - * 08 20 2010 cm.chang - * NULL - * Migrate RLM code to host from FW - * - * 08 19 2010 wh.su - * NULL - * adding the tx pkt call back handle for countermeasure. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Check draft RLM code for HT cap - * - * 07 07 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Support state of STA record change from 1 to 1 - * - * 07 05 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Fix correct structure size in cnmStaSendDeactivateCmd() - * - * 07 05 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) ignore RSN checking when RSN is not turned on. - * 2) set STA-REC deactivation callback as NULL - * 3) add variable initialization API based on PHY configuration - * - * 07 02 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * spin lock target revised - * - * 07 02 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * change inner loop index from i to k. - * - * 07 01 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Support sync command of STA_REC - * - * 06 23 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Merge g_arStaRec[] into adapter->arStaRec[] - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 05 31 2010 yarco.yang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add RX TSF Log Feature and ADDBA Rsp with DECLINE handling - * - * 05 28 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support checking of duplicated buffer free - * - * 05 28 2010 wh.su - * [BORA00000626][MT6620] Refine the remove key flow for WHQL testing - * fixed the ad-hoc wpa-none send non-encrypted frame issue. - * - * 05 28 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Move define of STA_REC_NUM to config.h and rename to CFG_STA_REC_NUM - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 04 28 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * Modified some MQM-related data structures (SN counter, TX/RX BA table) - * - * 04 27 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * Added new TX/RX BA tables in STA_REC - * - * 04 27 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * Notify MQM, TXM, and RXM upon disconnection . - * - * 04 26 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * Call mqm, txm, rxm functions upon disconnection - * - * 04 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW - * - * 04 22 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * First draft code to support protection in AP mode - * - * 04 19 2010 kevin.huang - * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support - * Add Beacon Timeout Support - * * * * * * * * * * and will send Null frame to diagnose connection - * - * 04 09 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * [BORA00000644] WiFi phase 4 integration - * * Added per-TID SN cache in STA_REC - * - * 04 07 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Different invoking order for WTBL entry of associated AP - * - * 03 29 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * move the wlan table alloc / free to change state function. - * - * 03 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support power control - * - * 03 03 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Initialize StaRec->arStaWaitQueue - * - * 03 03 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add debug message when no available pkt buffer - * - * 03 01 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Fixed STA_REC initialization bug: prStaRec->au2CachedSeqCtrl[k] - * - * 02 26 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Added fgIsWmmSupported in STA_RECORD_T. - * - * 02 26 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Added fgIsUapsdSupported in STA_RECORD_T - * - * 02 26 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * add support of Driver STA_RECORD_T activation - * - * 02 13 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Added arTspecTable in STA_REC for TSPEC management - * - * 02 12 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Enable mgmt buffer debug by default - * - * 02 12 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Added BUFFER_SOURCE_BCN - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * 01 11 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add Deauth and Disassoc Handler - * - * 01 08 2010 cp.wu - * [BORA00000368]Integrate HIF part into BORA - * 1) separate wifi_var_emu.c/.h from wifi_var.c/.h - * * * * * * * * * 2) eliminate HIF_EMULATION code sections appeared in wifi_var/cnm_mem - * * * * * * * * * 3) use cnmMemAlloc() instead to allocate SRAM buffer - * - * 12 25 2009 tehuang.liu - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Integrated modifications for 1st connection (mainly on FW modules MQM, TXM, and RXM) - * * * * * * * MQM: BA handling - * * * * * * * TXM: Macros updates - * * * * * * * RXM: Macros/Duplicate Removal updates - * - * 12 24 2009 yarco.yang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * 12 21 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support several data buffer banks. - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * .For new FPGA memory size - * - * Dec 9 2009 MTK02468 - * [BORA00000337] To check in codes for FPGA emulation - * Removed DBGPRINT - * - * Dec 9 2009 mtk02752 - * [BORA00000368] Integrate HIF part into BORA - * add cnmDataPktFree() for emulation loopback purpose - * - * Dec 3 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix warning of null pointer - * - * Dec 3 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add cnmGetStaRecByAddress() and add fgIsInUse flag in STA_RECORD_T - * - * Nov 23 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Assign ucBufferSource in function cnmMgtPktAlloc() - * - * Nov 23 2009 mtk02468 - * [BORA00000337] To check in codes for FPGA emulation - * Added packet redispatch function calls - * - * Nov 13 2009 mtk01084 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * enable packet re-usable in current emulation driver - * - * Nov 12 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * 1. Add new function cnmGetStaRecByIndex() - * 2. Rename STA_REC_T to STA_RECORD_T - * - * Nov 9 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Call cnmDataPktDispatch() in cnmPktFree() - * - * Nov 2 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Remove definition of pragma section code - * - * Oct 28 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * - * - * Oct 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix lint warning - * - * Oct 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix typo - * - * Oct 12 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * - * - * Oct 8 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -static VOID -cnmStaRecHandleEventPkt ( - P_ADAPTER_T prAdapter, - P_CMD_INFO_T prCmdInfo, - PUINT_8 pucEventBuf - ); - -static VOID -cnmStaSendUpdateCmd ( - P_ADAPTER_T prAdapter, - P_STA_RECORD_T prStaRec, - BOOLEAN fgNeedResp - ); - -static VOID -cnmStaSendRemoveCmd ( - P_ADAPTER_T prAdapter, - P_STA_RECORD_T prStaRec - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -P_MSDU_INFO_T -cnmMgtPktAlloc ( - P_ADAPTER_T prAdapter, - UINT_32 u4Length - ) -{ - P_MSDU_INFO_T prMsduInfo; - P_QUE_T prQueList; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - prQueList = &prAdapter->rTxCtrl.rFreeMsduInfoList; - - /* Get a free MSDU_INFO_T */ - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST); - QUEUE_REMOVE_HEAD(prQueList, prMsduInfo, P_MSDU_INFO_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST); - - if (prMsduInfo) { - prMsduInfo->prPacket = cnmMemAlloc(prAdapter, RAM_TYPE_BUF, u4Length); - prMsduInfo->eSrc = TX_PACKET_MGMT; - - if (prMsduInfo->prPacket == NULL) { - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST); - QUEUE_INSERT_TAIL(prQueList, &prMsduInfo->rQueEntry); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST); - prMsduInfo = NULL; - } - } - -#if DBG - if (prMsduInfo == NULL) { - DBGLOG(MEM, WARN, ("\n")); - DBGLOG(MEM, WARN, ("MgtDesc#=%ld\n", prQueList->u4NumElem)); - -#if CFG_DBG_MGT_BUF - DBGLOG(MEM, WARN, ("rMgtBufInfo: alloc#=%ld, free#=%ld, null#=%ld\n", - prAdapter->rMgtBufInfo.u4AllocCount, - prAdapter->rMgtBufInfo.u4FreeCount, - prAdapter->rMgtBufInfo.u4AllocNullCount)); -#endif - - DBGLOG(MEM, WARN, ("\n")); - } -#endif - - return prMsduInfo; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmMgtPktFree ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ) -{ - P_QUE_T prQueList; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - ASSERT(prMsduInfo); - - prQueList = &prAdapter->rTxCtrl.rFreeMsduInfoList; - - ASSERT(prMsduInfo->prPacket); - if (prMsduInfo->prPacket) { - cnmMemFree(prAdapter, prMsduInfo->prPacket); - prMsduInfo->prPacket = NULL; - } - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST); - QUEUE_INSERT_TAIL(prQueList, &prMsduInfo->rQueEntry) - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is used to initial the MGMT/MSG memory pool. -* -* \param (none) -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmMemInit ( - P_ADAPTER_T prAdapter - ) -{ - P_BUF_INFO_T prBufInfo; - - /* Initialize Management buffer pool */ - prBufInfo = &prAdapter->rMgtBufInfo; - kalMemZero(prBufInfo, sizeof(prAdapter->rMgtBufInfo)); - prBufInfo->pucBuf = prAdapter->pucMgtBufCached; - - /* Setup available memory blocks. 1 indicates FREE */ - prBufInfo->rFreeBlocksBitmap = - (BUF_BITMAP) BITS(0, MAX_NUM_OF_BUF_BLOCKS - 1); - - - /* Initialize Message buffer pool */ - prBufInfo = &prAdapter->rMsgBufInfo; - kalMemZero(prBufInfo, sizeof(prAdapter->rMsgBufInfo)); - prBufInfo->pucBuf = &prAdapter->aucMsgBuf[0]; - - /* Setup available memory blocks. 1 indicates FREE */ - prBufInfo->rFreeBlocksBitmap = - (BUF_BITMAP) BITS(0, MAX_NUM_OF_BUF_BLOCKS - 1); - - return; - -} /* end of cnmMemInit() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Allocate MGMT/MSG memory pool. -* -* \param[in] eRamType Target RAM type. -* TCM blk_sz= 16bytes, BUF blk_sz= 256bytes -* \param[in] u4Length Length of the buffer to allocate. -* -* \retval !NULL Pointer to the start address of allocated memory. -* \retval NULL Fail to allocat memory -*/ -/*----------------------------------------------------------------------------*/ -PVOID -cnmMemAlloc ( - IN P_ADAPTER_T prAdapter, - IN ENUM_RAM_TYPE_T eRamType, - IN UINT_32 u4Length - ) -{ - P_BUF_INFO_T prBufInfo; - BUF_BITMAP rRequiredBitmap; - UINT_32 u4BlockNum; - UINT_32 i, u4BlkSzInPower; - PVOID pvMemory; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - ASSERT(u4Length); - - if (eRamType == RAM_TYPE_MSG && u4Length <= 256) { - prBufInfo = &prAdapter->rMsgBufInfo; - u4BlkSzInPower = MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2; - - u4Length += (MSG_BUF_BLOCK_SIZE - 1); - u4BlockNum = u4Length >> MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2; - - ASSERT(u4BlockNum <= MAX_NUM_OF_BUF_BLOCKS); - } - else { - eRamType = RAM_TYPE_BUF; - - prBufInfo = &prAdapter->rMgtBufInfo; - u4BlkSzInPower = MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2; - - u4Length += (MGT_BUF_BLOCK_SIZE - 1); - u4BlockNum = u4Length >> MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2; - - ASSERT(u4BlockNum <= MAX_NUM_OF_BUF_BLOCKS); - } - -#if CFG_DBG_MGT_BUF - prBufInfo->u4AllocCount++; -#endif - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, - eRamType == RAM_TYPE_MSG ? SPIN_LOCK_MSG_BUF : SPIN_LOCK_MGT_BUF); - - if ((u4BlockNum > 0) && (u4BlockNum <= MAX_NUM_OF_BUF_BLOCKS)) { - - /* Convert number of block into bit cluster */ - rRequiredBitmap = BITS(0, u4BlockNum-1); - - for (i = 0; i <= (MAX_NUM_OF_BUF_BLOCKS - u4BlockNum); i++) { - - /* Have available memory blocks */ - if ((prBufInfo->rFreeBlocksBitmap & rRequiredBitmap) - == rRequiredBitmap) { - - /* Clear corresponding bits of allocated memory blocks */ - prBufInfo->rFreeBlocksBitmap &= ~rRequiredBitmap; - - /* Store how many blocks be allocated */ - prBufInfo->aucAllocatedBlockNum[i] = (UINT_8) u4BlockNum; - - KAL_RELEASE_SPIN_LOCK(prAdapter, - eRamType == RAM_TYPE_MSG ? - SPIN_LOCK_MSG_BUF : SPIN_LOCK_MGT_BUF); - - /* Return the start address of allocated memory */ - return (PVOID)(prBufInfo->pucBuf + (i << u4BlkSzInPower)); - - } - - rRequiredBitmap <<= 1; - } - } - -#ifdef LINUX - pvMemory = (PVOID)kalMemAlloc(u4Length, VIR_MEM_TYPE); -#else - pvMemory = (PVOID)NULL; -#endif - -#if CFG_DBG_MGT_BUF - prBufInfo->u4AllocNullCount++; - - if (pvMemory) { - prAdapter->u4MemAllocDynamicCount++; - } -#endif - - KAL_RELEASE_SPIN_LOCK(prAdapter, - eRamType == RAM_TYPE_MSG ? SPIN_LOCK_MSG_BUF : SPIN_LOCK_MGT_BUF); - - return pvMemory; - -} /* end of cnmMemAlloc() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Release memory to MGT/MSG memory pool. -* -* \param pucMemory Start address of previous allocated memory -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmMemFree ( - IN P_ADAPTER_T prAdapter, - IN PVOID pvMemory - ) -{ - P_BUF_INFO_T prBufInfo; - UINT_32 u4BlockIndex; - BUF_BITMAP rAllocatedBlocksBitmap; - ENUM_RAM_TYPE_T eRamType; - KAL_SPIN_LOCK_DECLARATION(); - - - ASSERT(prAdapter); - ASSERT(pvMemory); - if (!pvMemory) { - return; - } - - /* Judge it belongs to which RAM type */ - if ( ((UINT_32)pvMemory >= (UINT_32)&prAdapter->aucMsgBuf[0]) && - ((UINT_32)pvMemory <= (UINT_32)&prAdapter->aucMsgBuf[MSG_BUFFER_SIZE-1])) { - - prBufInfo = &prAdapter->rMsgBufInfo; - u4BlockIndex = ((UINT_32)pvMemory - (UINT_32)prBufInfo->pucBuf) - >> MSG_BUF_BLOCK_SIZE_IN_POWER_OF_2; - ASSERT(u4BlockIndex < MAX_NUM_OF_BUF_BLOCKS); - eRamType = RAM_TYPE_MSG; - } - else if ( ((UINT_32)pvMemory >= (UINT_32)prAdapter->pucMgtBufCached) && - ((UINT_32)pvMemory <= ((UINT_32)prAdapter->pucMgtBufCached + MGT_BUFFER_SIZE -1))) { - prBufInfo = &prAdapter->rMgtBufInfo; - u4BlockIndex = ((UINT_32)pvMemory - (UINT_32)prBufInfo->pucBuf) - >> MGT_BUF_BLOCK_SIZE_IN_POWER_OF_2; - ASSERT(u4BlockIndex < MAX_NUM_OF_BUF_BLOCKS); - eRamType = RAM_TYPE_BUF; - } - else { - #ifdef LINUX - /* For Linux, it is supported because size is not needed */ - kalMemFree(pvMemory, VIR_MEM_TYPE, 0); - #else - /* For Windows, it is not supported because of no size argument */ - ASSERT(0); - #endif - - #if CFG_DBG_MGT_BUF - prAdapter->u4MemFreeDynamicCount++; - #endif - return; - } - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, - eRamType == RAM_TYPE_MSG ? SPIN_LOCK_MSG_BUF : SPIN_LOCK_MGT_BUF); - -#if CFG_DBG_MGT_BUF - prBufInfo->u4FreeCount++; -#endif - - /* Convert number of block into bit cluster */ - ASSERT(prBufInfo->aucAllocatedBlockNum[u4BlockIndex] > 0); - - rAllocatedBlocksBitmap = - BITS(0, prBufInfo->aucAllocatedBlockNum[u4BlockIndex] - 1); - rAllocatedBlocksBitmap <<= u4BlockIndex; - - /* Clear saved block count for this memory segment */ - prBufInfo->aucAllocatedBlockNum[u4BlockIndex] = 0; - - /* Set corresponding bit of released memory block */ - prBufInfo->rFreeBlocksBitmap |= rAllocatedBlocksBitmap; - - KAL_RELEASE_SPIN_LOCK(prAdapter, - eRamType == RAM_TYPE_MSG ? SPIN_LOCK_MSG_BUF : SPIN_LOCK_MGT_BUF); - - return; - -} /* end of cnmMemFree() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmStaRecInit ( - P_ADAPTER_T prAdapter - ) -{ - P_STA_RECORD_T prStaRec; - UINT_16 i; - - for (i = 0; i < CFG_STA_REC_NUM; i++) { - prStaRec = &prAdapter->arStaRec[i]; - - prStaRec->ucIndex = (UINT_8) i; - prStaRec->fgIsInUse = FALSE; - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmStaRecUninit ( - IN P_ADAPTER_T prAdapter - ) -{ - P_STA_RECORD_T prStaRec; - UINT_16 i; - - for (i = 0; i < CFG_STA_REC_NUM; i++) { - prStaRec = &prAdapter->arStaRec[i]; - - if (prStaRec->fgIsInUse) { - cnmStaRecFree(prAdapter, prStaRec, FALSE); - } - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -P_STA_RECORD_T -cnmStaRecAlloc ( - P_ADAPTER_T prAdapter, - UINT_8 ucNetTypeIndex - ) -{ - P_STA_RECORD_T prStaRec; - UINT_16 i, k; - - ASSERT(prAdapter); - - for (i = 0; i < CFG_STA_REC_NUM; i++) { - prStaRec = &prAdapter->arStaRec[i]; - - if (!prStaRec->fgIsInUse) { - /*---- Initialize STA_REC_T here ----*/ - kalMemZero(prStaRec, sizeof(STA_RECORD_T)); - prStaRec->ucIndex = (UINT_8) i; - prStaRec->ucNetTypeIndex = ucNetTypeIndex; - prStaRec->fgIsInUse = TRUE; - - if (prStaRec->pucAssocReqIe) { - kalMemFree(prStaRec->pucAssocReqIe, VIR_MEM_TYPE, prStaRec->u2AssocReqIeLen); - prStaRec->pucAssocReqIe = NULL; - prStaRec->u2AssocReqIeLen = 0; - } - - /* Initialize the SN caches for duplicate detection */ - for (k = 0; k < TID_NUM + 1; k++) { - prStaRec->au2CachedSeqCtrl[k] = 0xFFFF; - } - - /* Initialize SW TX queues in STA_REC */ - for (k = 0; k < STA_WAIT_QUEUE_NUM; k++) { - LINK_INITIALIZE(&prStaRec->arStaWaitQueue[k]); - } - - /* Default enable TX/RX AMPDU */ - prStaRec->fgTxAmpduEn = TRUE; - prStaRec->fgRxAmpduEn = TRUE; - - for (k = 0; k < NUM_OF_PER_STA_TX_QUEUES; k++) { - QUEUE_INITIALIZE(&prStaRec->arTxQueue[k]); - } - - break; - } - } - - return (i < CFG_STA_REC_NUM) ? prStaRec : NULL; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmStaRecFree ( - P_ADAPTER_T prAdapter, - P_STA_RECORD_T prStaRec, - BOOLEAN fgSyncToChip - ) -{ - ASSERT(prAdapter); - ASSERT(prStaRec); - - /* To do: free related resources, e.g. timers, buffers, etc */ - cnmTimerStopTimer(prAdapter, &prStaRec->rTxReqDoneOrRxRespTimer); - prStaRec->fgTransmitKeyExist = FALSE; - prStaRec->fgSetPwrMgtBit = FALSE; - - if (prStaRec->pucAssocReqIe) { - kalMemFree(prStaRec->pucAssocReqIe, VIR_MEM_TYPE, prStaRec->u2AssocReqIeLen); - prStaRec->pucAssocReqIe = NULL; - prStaRec->u2AssocReqIeLen = 0; - } - - qmDeactivateStaRec(prAdapter, prStaRec->ucIndex); - - if (fgSyncToChip) { - cnmStaSendRemoveCmd(prAdapter, prStaRec); - } - - prStaRec->fgIsInUse = FALSE; - - return; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmStaFreeAllStaByNetType ( - P_ADAPTER_T prAdapter, - ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - BOOLEAN fgSyncToChip - ) -{ - P_STA_RECORD_T prStaRec; - UINT_16 i; - - for (i = 0; i < CFG_STA_REC_NUM; i++) { - prStaRec = (P_STA_RECORD_T) &prAdapter->arStaRec[i]; - - if (prStaRec->fgIsInUse && - prStaRec->ucNetTypeIndex == (UINT_8) eNetTypeIndex) { - - cnmStaRecFree(prAdapter, prStaRec, fgSyncToChip); - } - } /* end of for loop */ -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -P_STA_RECORD_T -cnmGetStaRecByIndex ( - P_ADAPTER_T prAdapter, - UINT_8 ucIndex - ) -{ - P_STA_RECORD_T prStaRec; - - ASSERT(prAdapter); - - prStaRec = (ucIndex < CFG_STA_REC_NUM) ? - &prAdapter->arStaRec[ucIndex] : NULL; - - if (prStaRec && prStaRec->fgIsInUse == FALSE) { - prStaRec = NULL; - } - - return prStaRec; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Get STA_RECORD_T by Peer MAC Address(Usually TA). -* -* @param[in] pucPeerMacAddr Given Peer MAC Address. -* -* @retval Pointer to STA_RECORD_T, if found. NULL, if not found -*/ -/*----------------------------------------------------------------------------*/ -P_STA_RECORD_T -cnmGetStaRecByAddress ( - P_ADAPTER_T prAdapter, - UINT_8 ucNetTypeIndex, - PUINT_8 pucPeerMacAddr - ) -{ - P_STA_RECORD_T prStaRec; - UINT_16 i; - - ASSERT(prAdapter); - ASSERT(pucPeerMacAddr); - - for (i = 0; i < CFG_STA_REC_NUM; i++) { - prStaRec = &prAdapter->arStaRec[i]; - - if (prStaRec->fgIsInUse && - prStaRec->ucNetTypeIndex == ucNetTypeIndex && - EQUAL_MAC_ADDR(prStaRec->aucMacAddr, pucPeerMacAddr)) { - break; - } - } - - return (i < CFG_STA_REC_NUM) ? prStaRec : NULL; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Reset the Status and Reason Code Field to 0 of all Station Records for -* the specified Network Type -* -* @param[in] eNetType Specify Network Type -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmStaRecResetStatus ( - P_ADAPTER_T prAdapter, - ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ) -{ - cnmStaFreeAllStaByNetType(prAdapter, eNetTypeIndex, FALSE); - -#if 0 - P_STA_RECORD_T prStaRec; - UINT_16 i; - - ASSERT(prAdapter); - - for (i = 0; i < CFG_STA_REC_NUM; i++) { - prStaRec = &prAdapter->arStaRec[i]; - - if (prStaRec->fgIsInUse) { - if ((NETWORK_TYPE_AIS_INDEX == eNetTypeIndex) && - IS_STA_IN_AIS(prStaRec->eStaType)) { - - prStaRec->u2StatusCode = STATUS_CODE_SUCCESSFUL; - prStaRec->u2ReasonCode = REASON_CODE_RESERVED; - prStaRec->ucJoinFailureCount = 0; - prStaRec->fgTransmitKeyExist = FALSE; - - prStaRec->fgSetPwrMgtBit = FALSE; - } - - /* TODO(Kevin): For P2P and BOW */ - } - } - - return; -#endif -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will change the ucStaState of STA_RECORD_T and also do -* event indication to HOST to sync the STA_RECORD_T in driver. -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] u4NewState New STATE to change. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmStaRecChangeState ( - P_ADAPTER_T prAdapter, - P_STA_RECORD_T prStaRec, - UINT_8 ucNewState - ) -{ - BOOLEAN fgNeedResp; - - ASSERT(prAdapter); - ASSERT(prStaRec); - ASSERT(prStaRec->fgIsInUse); - - /* Do nothing when following state transitions happen, - * other 6 conditions should be sync to FW, including 1-->1, 3-->3 - */ - if ((ucNewState == STA_STATE_2 && prStaRec->ucStaState != STA_STATE_3) || - (ucNewState == STA_STATE_1 && prStaRec->ucStaState == STA_STATE_2)) { - prStaRec->ucStaState = ucNewState; - return; - } - - fgNeedResp = FALSE; - if (ucNewState == STA_STATE_3) { - secFsmEventStart(prAdapter, prStaRec); - if (ucNewState != prStaRec->ucStaState) { - fgNeedResp = TRUE; - } - } - else { - if (ucNewState != prStaRec->ucStaState && - prStaRec->ucStaState == STA_STATE_3) { - qmDeactivateStaRec(prAdapter, prStaRec->ucIndex); - } - fgNeedResp = FALSE; - } - prStaRec->ucStaState = ucNewState; - - cnmStaSendUpdateCmd(prAdapter, prStaRec, fgNeedResp); - -#if CFG_ENABLE_WIFI_DIRECT - /* To do: Confirm if it is invoked here or other location, but it should - * be invoked after state sync of STA_REC - * Update system operation parameters for AP mode - */ - if (prAdapter->fgIsP2PRegistered && (IS_STA_IN_P2P(prStaRec))) { - P_BSS_INFO_T prBssInfo; - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]; - - if (prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) { - rlmUpdateParamsForAP(prAdapter, prBssInfo, FALSE); - } - } -#endif - return; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief -* -* @param[in] -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -static VOID -cnmStaRecHandleEventPkt ( - P_ADAPTER_T prAdapter, - P_CMD_INFO_T prCmdInfo, - PUINT_8 pucEventBuf - ) -{ - P_EVENT_ACTIVATE_STA_REC_T prEventContent; - P_STA_RECORD_T prStaRec; - - prEventContent = (P_EVENT_ACTIVATE_STA_REC_T) pucEventBuf; - prStaRec = cnmGetStaRecByIndex(prAdapter, prEventContent->ucStaRecIdx); - - if (prStaRec && prStaRec->ucStaState == STA_STATE_3 && - !kalMemCmp(&prStaRec->aucMacAddr[0], &prEventContent->aucMacAddr[0], - MAC_ADDR_LEN)) { - - qmActivateStaRec(prAdapter, prStaRec); - } - -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief -* -* @param[in] -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -static VOID -cnmStaSendUpdateCmd ( - P_ADAPTER_T prAdapter, - P_STA_RECORD_T prStaRec, - BOOLEAN fgNeedResp - ) -{ - P_CMD_UPDATE_STA_RECORD_T prCmdContent; - WLAN_STATUS rStatus; - - ASSERT(prAdapter); - ASSERT(prStaRec); - ASSERT(prStaRec->fgIsInUse); - - /* To do: come out a mechanism to limit one STA_REC sync once for AP mode - * to avoid buffer empty case when many STAs are associated - * simultaneously. - */ - - /* To do: how to avoid 2 times of allocated memory. Use Stack? - * One is here, the other is in wlanSendQueryCmd() - */ - prCmdContent = cnmMemAlloc(prAdapter, - RAM_TYPE_BUF, sizeof(CMD_UPDATE_STA_RECORD_T)); - ASSERT(prCmdContent); - - /* To do: exception handle */ - if (!prCmdContent) { - return; - } - - prCmdContent->ucIndex = prStaRec->ucIndex; - prCmdContent->ucStaType = (UINT_8) prStaRec->eStaType; - kalMemCopy(&prCmdContent->aucMacAddr[0], &prStaRec->aucMacAddr[0], - MAC_ADDR_LEN); - prCmdContent->u2AssocId = prStaRec->u2AssocId; - prCmdContent->u2ListenInterval = prStaRec->u2ListenInterval; - prCmdContent->ucNetTypeIndex = prStaRec->ucNetTypeIndex; - - prCmdContent->ucDesiredPhyTypeSet = prStaRec->ucDesiredPhyTypeSet; - prCmdContent->u2DesiredNonHTRateSet = prStaRec->u2DesiredNonHTRateSet; - prCmdContent->u2BSSBasicRateSet = prStaRec->u2BSSBasicRateSet; - prCmdContent->ucMcsSet = prStaRec->ucMcsSet; - prCmdContent->ucSupMcs32 = (UINT_8) prStaRec->fgSupMcs32; - prCmdContent->u2HtCapInfo = prStaRec->u2HtCapInfo; - prCmdContent->ucNeedResp = (UINT_8) fgNeedResp; - -#if !CFG_SLT_SUPPORT - if(prAdapter->rWifiVar.eRateSetting != FIXED_RATE_NONE) { - /* override rate configuration */ - nicUpdateRateParams(prAdapter, - prAdapter->rWifiVar.eRateSetting, - &(prCmdContent->ucDesiredPhyTypeSet), - &(prCmdContent->u2DesiredNonHTRateSet), - &(prCmdContent->u2BSSBasicRateSet), - &(prCmdContent->ucMcsSet), - &(prCmdContent->ucSupMcs32), - &(prCmdContent->u2HtCapInfo)); - } -#endif - - prCmdContent->ucIsQoS = prStaRec->fgIsQoS; - prCmdContent->ucIsUapsdSupported = prStaRec->fgIsUapsdSupported; - prCmdContent->ucStaState = prStaRec->ucStaState; - - prCmdContent->ucAmpduParam = prStaRec->ucAmpduParam; - prCmdContent->u2HtExtendedCap = prStaRec->u2HtExtendedCap; - prCmdContent->u4TxBeamformingCap = prStaRec->u4TxBeamformingCap; - prCmdContent->ucAselCap = prStaRec->ucAselCap; - prCmdContent->ucRCPI = prStaRec->ucRCPI; - - prCmdContent->ucUapsdAc = prStaRec->ucBmpTriggerAC | (prStaRec->ucBmpDeliveryAC << 4); - prCmdContent->ucUapsdSp = prStaRec->ucUapsdSp; - - rStatus = wlanSendSetQueryCmd ( - prAdapter, /* prAdapter */ - CMD_ID_UPDATE_STA_RECORD, /* ucCID */ - TRUE, /* fgSetQuery */ - fgNeedResp, /* fgNeedResp */ - FALSE, /* fgIsOid */ - fgNeedResp? cnmStaRecHandleEventPkt : NULL, - NULL, /* pfCmdTimeoutHandler */ - sizeof(CMD_UPDATE_STA_RECORD_T), /* u4SetQueryInfoLen */ - (PUINT_8) prCmdContent, /* pucInfoBuffer */ - NULL, /* pvSetQueryBuffer */ - 0 /* u4SetQueryBufferLen */ - ); - - ASSERT(rStatus == WLAN_STATUS_PENDING); - - cnmMemFree(prAdapter, prCmdContent); -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief -* -* @param[in] -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -static VOID -cnmStaSendRemoveCmd ( - P_ADAPTER_T prAdapter, - P_STA_RECORD_T prStaRec - ) -{ - CMD_REMOVE_STA_RECORD_T rCmdContent; - WLAN_STATUS rStatus; - - ASSERT(prAdapter); - ASSERT(prStaRec); - - rCmdContent.ucIndex = prStaRec->ucIndex; - kalMemCopy(&rCmdContent.aucMacAddr[0], &prStaRec->aucMacAddr[0], - MAC_ADDR_LEN); - - rStatus = wlanSendSetQueryCmd ( - prAdapter, /* prAdapter */ - CMD_ID_REMOVE_STA_RECORD, /* ucCID */ - TRUE, /* fgSetQuery */ - FALSE, /* fgNeedResp */ - FALSE, /* fgIsOid */ - NULL, /* pfCmdDoneHandler */ - NULL, /* pfCmdTimeoutHandler */ - sizeof(CMD_REMOVE_STA_RECORD_T), /* u4SetQueryInfoLen */ - (PUINT_8) &rCmdContent, /* pucInfoBuffer */ - NULL, /* pvSetQueryBuffer */ - 0 /* u4SetQueryBufferLen */ - ); - - ASSERT(rStatus == WLAN_STATUS_PENDING); -} - - diff --git a/drivers/net/wireless/mt5931/mgmt/cnm_timer.c b/drivers/net/wireless/mt5931/mgmt/cnm_timer.c deleted file mode 100755 index 2e8a8d7fa1b8..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/cnm_timer.c +++ /dev/null @@ -1,531 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/cnm_timer.c#1 $ -*/ - -/*! \file "cnm_timer.c" - \brief - -*/ - - - -/* -** $Log: cnm_timer.c $ - * - * 12 13 2011 cm.chang - * [WCXRP00001136] [All Wi-Fi][Driver] Add wake lock for pending timer - * Add wake lock if timer timeout value is smaller than 5 seconds - * - * 02 24 2011 cp.wu - * [WCXRP00000490] [MT6620 Wi-Fi][Driver][Win32] modify kalMsleep() implementation because NdisMSleep() won't sleep long enough for specified interval such as 500ms - * modify cnm_timer and hem_mbox APIs to be thread safe to ease invoking restrictions - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * cnm_timer has been migrated. - * - * 05 28 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support sleep notification to host - * - * 05 19 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add some checking assertions - * - * 04 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Return timer token back to COS when entering wait off state - * - * 01 11 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Remove compiling warning - * - * 01 08 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support longer timeout interval to 45 days from 65secu1rwduu`wvpghlqg|fh+fmdkb - * - * 01 06 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Fix system time is 32KHz instead of 1ms - * - * 01 04 2010 tehuang.liu - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * For working out the first connection Chariot-verified version - * - * Dec 3 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Place rRootTimer.rNextExpiredSysTime = rExpiredSysTime; before set timer - * - * Oct 30 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * In cnmTimerInitialize(), just stop timer if it was already created. - * - * Oct 30 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Move the external reference for Lint to precomp.h - * - * Oct 30 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix lint warning - * - * Oct 28 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set the time to do the time out check. -* -* \param[in] rTimeout Time out interval from current time. -* -* \retval TRUE Success. -* -*/ -/*----------------------------------------------------------------------------*/ -static BOOLEAN -cnmTimerSetTimer ( - IN P_ADAPTER_T prAdapter, - IN OS_SYSTIME rTimeout - ) -{ - P_ROOT_TIMER prRootTimer; - BOOLEAN fgNeedWakeLock; - - ASSERT(prAdapter); - - prRootTimer = &prAdapter->rRootTimer; - - kalSetTimer(prAdapter->prGlueInfo, rTimeout); - - if (rTimeout <= SEC_TO_SYSTIME(WAKE_LOCK_MAX_TIME)) { - fgNeedWakeLock = TRUE; - - if (!prRootTimer->fgWakeLocked) { - KAL_WAKE_LOCK(prAdapter, &prRootTimer->rWakeLock); - prRootTimer->fgWakeLocked = TRUE; - } - } - else { - fgNeedWakeLock = FALSE; - } - - return fgNeedWakeLock; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routines is called to initialize a root timer. -* -* \param[in] prAdapter -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmTimerInitialize ( - IN P_ADAPTER_T prAdapter - ) -{ - P_ROOT_TIMER prRootTimer; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - prRootTimer = &prAdapter->rRootTimer; - - /* Note: glue layer have configured timer */ - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TIMER); - LINK_INITIALIZE(&prRootTimer->rLinkHead); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TIMER); - - KAL_WAKE_LOCK_INIT(prAdapter, &prRootTimer->rWakeLock, "WLAN Timer"); - prRootTimer->fgWakeLocked = FALSE; - return; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routines is called to destroy a root timer. -* When WIFI is off, the token shall be returned back to system. -* -* \param[in] -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmTimerDestroy ( - IN P_ADAPTER_T prAdapter - ) -{ - P_ROOT_TIMER prRootTimer; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - prRootTimer = &prAdapter->rRootTimer; - - if (prRootTimer->fgWakeLocked) { - KAL_WAKE_UNLOCK(prAdapter, &prRootTimer->rWakeLock); - prRootTimer->fgWakeLocked = FALSE; - } - KAL_WAKE_LOCK_DESTROY(prAdapter, &prRootTimer->rWakeLock); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TIMER); - LINK_INITIALIZE(&prRootTimer->rLinkHead); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TIMER); - - /* Note: glue layer will be responsible for timer destruction */ - - return; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routines is called to initialize a timer. -* -* \param[in] prTimer Pointer to a timer structure. -* \param[in] pfnFunc Pointer to the call back function. -* \param[in] u4Data Parameter for call back function. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmTimerInitTimer ( - IN P_ADAPTER_T prAdapter, - IN P_TIMER_T prTimer, - IN PFN_MGMT_TIMEOUT_FUNC pfFunc, - IN UINT_32 u4Data - ) -{ - ASSERT(prAdapter); - - ASSERT(prTimer); - -#if DBG - /* Note: NULL function pointer is permitted for HEM POWER */ - if (pfFunc == NULL) { - DBGLOG(CNM, WARN, ("Init timer with NULL callback function!\n")); - } -#endif - -#if DBG - ASSERT(prAdapter->rRootTimer.rLinkHead.prNext); - { - P_LINK_T prTimerList; - P_LINK_ENTRY_T prLinkEntry; - P_TIMER_T prPendingTimer; - - prTimerList = &(prAdapter->rRootTimer.rLinkHead); - - LINK_FOR_EACH(prLinkEntry, prTimerList) { - prPendingTimer = LINK_ENTRY(prLinkEntry, TIMER_T, rLinkEntry); - ASSERT(prPendingTimer); - ASSERT(prPendingTimer != prTimer); - } - } -#endif - - LINK_ENTRY_INITIALIZE(&prTimer->rLinkEntry); - - prTimer->pfMgmtTimeOutFunc = pfFunc; - prTimer->u4Data = u4Data; - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routines is called to stop a timer. -* -* \param[in] prTimer Pointer to a timer structure. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -static VOID -cnmTimerStopTimer_impl ( - IN P_ADAPTER_T prAdapter, - IN P_TIMER_T prTimer, - IN BOOLEAN fgAcquireSpinlock - ) -{ - P_ROOT_TIMER prRootTimer; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - ASSERT(prTimer); - - prRootTimer = &prAdapter->rRootTimer; - - if (fgAcquireSpinlock) { - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TIMER); - } - - if (timerPendingTimer(prTimer)) { - LINK_REMOVE_KNOWN_ENTRY(&prRootTimer->rLinkHead, - &prTimer->rLinkEntry); - - /* Reduce dummy timeout for power saving, especially HIF activity. - * If two or more timers exist and being removed timer is smallest, - * this dummy timeout will still happen, but it is OK. - */ - if (LINK_IS_EMPTY(&prRootTimer->rLinkHead)) { - kalCancelTimer(prAdapter->prGlueInfo); - - if (fgAcquireSpinlock && prRootTimer->fgWakeLocked) { - KAL_WAKE_UNLOCK(prAdapter, &prRootTimer->rWakeLock); - prRootTimer->fgWakeLocked = FALSE; - } - } - } - - if (fgAcquireSpinlock) { - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TIMER); - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routines is called to stop a timer. -* -* \param[in] prTimer Pointer to a timer structure. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmTimerStopTimer ( - IN P_ADAPTER_T prAdapter, - IN P_TIMER_T prTimer - ) -{ - ASSERT(prAdapter); - ASSERT(prTimer); - - cnmTimerStopTimer_impl(prAdapter, prTimer, TRUE); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routines is called to start a timer with wake_lock. -* -* \param[in] prTimer Pointer to a timer structure. -* \param[in] u4TimeoutMs Timeout to issue the timer and call back function -* (unit: ms). -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmTimerStartTimer ( - IN P_ADAPTER_T prAdapter, - IN P_TIMER_T prTimer, - IN UINT_32 u4TimeoutMs - ) -{ - P_ROOT_TIMER prRootTimer; - P_LINK_T prTimerList; - OS_SYSTIME rExpiredSysTime, rTimeoutSystime; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - ASSERT(prTimer); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TIMER); - - prRootTimer = &prAdapter->rRootTimer; - prTimerList= &prRootTimer->rLinkHead; - - /* If timeout interval is larger than 1 minute, the mod value is set - * to the timeout value first, then per minutue. - */ - if (u4TimeoutMs > MSEC_PER_MIN) { - ASSERT(u4TimeoutMs <= ((UINT_32)0xFFFF * MSEC_PER_MIN)); - - prTimer->u2Minutes = (UINT_16)(u4TimeoutMs / MSEC_PER_MIN); - u4TimeoutMs -= (prTimer->u2Minutes * MSEC_PER_MIN); - if (u4TimeoutMs == 0) { - u4TimeoutMs = MSEC_PER_MIN; - prTimer->u2Minutes--; - } - } - else { - prTimer->u2Minutes = 0; - } - - /* The assertion check if MSEC_TO_SYSTIME() may be overflow. */ - ASSERT(u4TimeoutMs < (((UINT_32)0x80000000 - MSEC_PER_SEC) / KAL_HZ)); - rTimeoutSystime = MSEC_TO_SYSTIME(u4TimeoutMs); - rExpiredSysTime = kalGetTimeTick() + rTimeoutSystime; - - /* If no timer pending or the fast time interval is used. */ - if (LINK_IS_EMPTY(prTimerList) || - TIME_BEFORE(rExpiredSysTime, prRootTimer->rNextExpiredSysTime)) { - - prRootTimer->rNextExpiredSysTime = rExpiredSysTime; - cnmTimerSetTimer(prAdapter, rTimeoutSystime); - } - - /* Add this timer to checking list */ - prTimer->rExpiredSysTime = rExpiredSysTime; - - if (!timerPendingTimer(prTimer)) { - LINK_INSERT_TAIL(prTimerList, &prTimer->rLinkEntry); - } - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TIMER); - - return; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routines is called to check the timer list. -* -* \param[in] -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cnmTimerDoTimeOutCheck ( - IN P_ADAPTER_T prAdapter - ) -{ - P_ROOT_TIMER prRootTimer; - P_LINK_T prTimerList; - P_LINK_ENTRY_T prLinkEntry; - P_TIMER_T prTimer; - OS_SYSTIME rCurSysTime; - PFN_MGMT_TIMEOUT_FUNC pfMgmtTimeOutFunc; - UINT_32 u4TimeoutData; - BOOLEAN fgNeedWakeLock; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - /* acquire spin lock */ - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TIMER); - - prRootTimer = &prAdapter->rRootTimer; - prTimerList= &prRootTimer->rLinkHead; - - rCurSysTime = kalGetTimeTick(); - - /* Set the permitted max timeout value for new one */ - prRootTimer->rNextExpiredSysTime = rCurSysTime + MGMT_MAX_TIMEOUT_INTERVAL; - - LINK_FOR_EACH(prLinkEntry, prTimerList) { - prTimer = LINK_ENTRY(prLinkEntry, TIMER_T, rLinkEntry); - ASSERT(prTimer); - - /* Check if this entry is timeout. */ - if (!TIME_BEFORE(rCurSysTime, prTimer->rExpiredSysTime)) { - cnmTimerStopTimer_impl(prAdapter, prTimer, FALSE); - - pfMgmtTimeOutFunc = prTimer->pfMgmtTimeOutFunc; - u4TimeoutData = prTimer->u4Data; - - if (prTimer->u2Minutes > 0) { - prTimer->u2Minutes--; - prTimer->rExpiredSysTime = - rCurSysTime + MSEC_TO_SYSTIME(MSEC_PER_MIN); - LINK_INSERT_TAIL(prTimerList, &prTimer->rLinkEntry); - } - else if (pfMgmtTimeOutFunc) { - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TIMER); - (pfMgmtTimeOutFunc)(prAdapter, u4TimeoutData); - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TIMER); - } - - /* Search entire list again because of nest del and add timers - * and current MGMT_TIMER could be volatile after stopped - */ - prLinkEntry = (P_LINK_ENTRY_T)prTimerList; - - prRootTimer->rNextExpiredSysTime = - rCurSysTime + MGMT_MAX_TIMEOUT_INTERVAL; - } - else if (TIME_BEFORE(prTimer->rExpiredSysTime, - prRootTimer->rNextExpiredSysTime)) { - prRootTimer->rNextExpiredSysTime = prTimer->rExpiredSysTime; - } - } /* end of for loop */ - - /* Setup the prNext timeout event. It is possible the timer was already - * set in the above timeout callback function. - */ - fgNeedWakeLock = FALSE; - if (!LINK_IS_EMPTY(prTimerList)) { - ASSERT(TIME_AFTER(prRootTimer->rNextExpiredSysTime, rCurSysTime)); - - fgNeedWakeLock = cnmTimerSetTimer(prAdapter, (OS_SYSTIME) - ((INT_32)prRootTimer->rNextExpiredSysTime - (INT_32)rCurSysTime)); - } - - if (prRootTimer->fgWakeLocked && !fgNeedWakeLock) { - KAL_WAKE_UNLOCK(prAdapter, &prRootTimer->rWakeLock); - prRootTimer->fgWakeLocked = FALSE; - } - - /* release spin lock */ - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TIMER); -} - - diff --git a/drivers/net/wireless/mt5931/mgmt/hem_mbox.c b/drivers/net/wireless/mt5931/mgmt/hem_mbox.c deleted file mode 100755 index b6c627f16215..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/hem_mbox.c +++ /dev/null @@ -1,827 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/hem_mbox.c#3 $ -*/ - -/*! \file "hem_mbox.c" - \brief - -*/ - - - -/* -** $Log: hem_mbox.c $ -** -** 08 31 2012 yuche.tsai -** [ALPS00349585] [6577JB][WiFi direct][KE]Establish p2p connection while both device have connected to AP previously,one device reboots automatically with KE -** Fix possible KE when concurrent & disconnect. -** -** 07 26 2012 yuche.tsai -** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot -** Update driver code of ALPS.JB for hot-spot. -** -** 07 19 2012 yuche.tsai -** NULL -** Code update for JB. - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 05 03 2012 cp.wu - * [WCXRP00001231] [MT6620 Wi-Fi][MT5931][Driver] Correct SCAN_V2 related debugging facilities within hem_mbox.c - * correct for debug message string table by adding missed scan_v2 related definitions. - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 01 17 2012 yuche.tsai - * NULL - * Update mgmt frame filter setting. - * Please also update FW 2.1 - * - * 01 13 2012 yuche.tsai - * NULL - * WiFi Hot Spot Tethering for ICS ALPHA testing version. - * - * 11 24 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * Adjust code for DBG and CONFIG_XLOG. - * - * 11 15 2011 cm.chang - * NULL - * Add exception handle for NULL function pointer of mailbox message - * - * 11 11 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * modify the xlog related code. - * - * 11 02 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * adding the code for XLOG. - * - * 07 18 2011 cp.wu - * [WCXRP00000858] [MT5931][Driver][Firmware] Add support for scan to search for more than one SSID in a single scanning request - * add framework in driver domain for supporting new SCAN_REQ_V2 for more than 1 SSID support as well as uProbeDelay in NDIS 6.x driver model - * - * 06 07 2011 yuche.tsai - * [WCXRP00000696] [Volunteer Patch][MT6620][Driver] Infinite loop issue when RX invitation response.[WCXRP00000763] [Volunteer Patch][MT6620][Driver] RX Service Discovery Frame under AP mode Issue - * Add invitation support. - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 03 29 2011 cm.chang - * [WCXRP00000606] [MT6620 Wi-Fi][Driver][FW] Fix klocwork warning - * As CR title - * - * 02 24 2011 cp.wu - * [WCXRP00000490] [MT6620 Wi-Fi][Driver][Win32] modify kalMsleep() implementation because NdisMSleep() won't sleep long enough for specified interval such as 500ms - * modify cnm_timer and hem_mbox APIs to be thread safe to ease invoking restrictions - * - * 02 15 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Update bowString and channel grant. - * - * 01 26 2011 cm.chang - * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument - * Allocate system RAM if fixed message or mgmt buffer is not available - * - * 01 26 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * . - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Fix Compile Error when DBG is disabled. - * - * 01 24 2011 cp.wu - * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving - * 1. add an extra counter for tracking pending forward frames. - * 2. notify TX service thread as well when there is pending forward frame - * 3. correct build errors leaded by introduction of Wi-Fi direct separation module - * - * 12 08 2010 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Support concurrent networks. - * - * 11 08 2010 cm.chang - * [WCXRP00000169] [MT6620 Wi-Fi][Driver][FW] Remove unused CNM recover message ID - * Remove CNM channel reover message ID - * - * 11 01 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module - * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead - * 2) Remove CNM CH-RECOVER event handling - * 3) cfg read/write API renamed with kal prefix for unified naming rules. - * - * 10 08 2010 wh.su - * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine - * update the frog's new p2p state machine. - * - * 09 28 2010 wh.su - * NULL - * [WCXRP00000069][MT6620 Wi-Fi][Driver] Fix some code for phase 1 P2P Demo. - * - * 09 16 2010 cm.chang - * NULL - * Remove unused message ID - * - * 08 30 2010 cp.wu - * NULL - * eliminate klockwork errors - * - * 08 26 2010 yuche.tsai - * NULL - * Add P2P Connection Abort Event Message handler. - * - * 08 25 2010 george.huang - * NULL - * update OID/ registry control path for PM related settings - * - * 08 24 2010 yarco.yang - * NULL - * Fixed Driver ASSERT at mboxInitMsgMap() - * - * 08 24 2010 chinghwa.yu - * NULL - * Update for MID_SCN_BOW_SCAN_DONE mboxDummy. - * Update saa_fsm for BOW. - * - * 08 23 2010 chinghwa.yu - * NULL - * Add CFG_ENABLE_BT_OVER_WIFI. - * - * 08 23 2010 chinghwa.yu - * NULL - * Update for BOW. - * - * 08 16 2010 cp.wu - * NULL - * add interface for RLM to trigger OBSS-SCAN. - * - * 08 16 2010 yuche.tsai - * NULL - * Add debug message for newly add P2P message. - * - * 08 11 2010 yuche.tsai - * NULL - * Add some function entry for P2P FSM under provisioning phase.. - * - * 08 11 2010 yuche.tsai - * NULL - * Add some events to P2P Module. - * - * 08 05 2010 yuche.tsai - * NULL - * Add message box event for P2P device switch on & device discovery. - * - * 08 04 2010 cp.wu - * NULL - * remove unused mailbox message definitions. - * - * 08 02 2010 yuche.tsai - * NULL - * P2P Group Negotiation Code Check in. - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * message table should not be commented out by compilation option without modifying header file - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * Add Ad-Hoc support to AIS-FSM - * - * 07 19 2010 yuche.tsai - * - * Add wifi direct scan done callback. - * - * 07 09 2010 cp.wu - * - * change handler of MID_MNY_CNM_CONNECTION_ABORT from NULL to mboxDummy. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Rename MID_MNY_CNM_CH_RELEASE to MID_MNY_CNM_CH_ABORT - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * AIS-FSM integration with CNM channel request messages - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * implementation of DRV-SCN and related mailbox message handling. - * - * 07 01 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Modify CNM message handler for new flow - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * enable currently migrated message call-backs. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * restore utility function invoking via hem_mbox to direct calls - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add buildable & linkable ais_fsm.c - * - * related reference are still waiting to be resolved - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * hem_mbox is migrated. - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add hem_mbox.c and cnm_mem.h (but disabled some feature) for further migration - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Fix file merge error - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 04 29 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * Removed MID_RXM_MQM_QOS_ACTION_FRAME - * - * 04 29 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * Removed MID_RXM_MQM_BA_ACTION_FRAME - * - * 04 27 2010 tehuang.liu - * [BORA00000605][WIFISYS] Phase3 Integration - * MID_RXM_MQM_BA_ACTION_FRAME - * - * 03 30 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support 2.4G OBSS scan - * - * 03 16 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add AdHoc Mode - * - * 03 10 2010 kevin.huang - * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support - * - * * * * * * * * * * * * * * Add Channel Manager for arbitration of JOIN and SCAN Req - * - * 03 05 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Develop partial DPD code - * - * 02 11 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Updated arMsgMapTable for MID_RXM_MQM_QOS_ACTION_FRAME - * - * 01 11 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add Deauth and Disassoc Handler - * - * Dec 9 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add hemRunEventScanDone() to arMsgMapTable[] - * - * Dec 4 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix mboxDummy() didn't free prMsgHdr - * - * Dec 3 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add saaAisJoinComplete event handler - * - * Dec 2 2009 MTK02468 - * [BORA00000337] To check in codes for FPGA emulation - * Fixed the handler function name in arMsgMapTable for MID_RXM_MQM_BA_ACTION_FRAME - * - * Dec 2 2009 MTK02468 - * [BORA00000337] To check in codes for FPGA emulation - * Added MID_RXM_MQM_BA_ACTION_FRAME to MsgMapTable - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Revise MSG Handler (remove dummy and add for SAA) - * - * Nov 16 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add aisFsmRunEventAbort() event handler - * - * Nov 11 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix typo - * - * Nov 10 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add more MSG_HNDL_ENTRY_T to avoid ASSERT() in mboxInitMsgMap() - * - * Nov 5 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add SCN message and function entry to arMsgMapTable[] - * - * Nov 2 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix sorting algorithm in mboxInitMsgMap() - * - * Oct 28 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ -#if DBG -/*lint -save -e64 Type mismatch */ -static PUINT_8 apucDebugMsg[] = { - (PUINT_8)DISP_STRING("MID_MNY_CNM_CH_REQ"), - (PUINT_8)DISP_STRING("MID_MNY_CNM_CH_ABORT"), - (PUINT_8)DISP_STRING("MID_CNM_AIS_CH_GRANT"), - (PUINT_8)DISP_STRING("MID_CNM_P2P_CH_GRANT"), - (PUINT_8)DISP_STRING("MID_CNM_BOW_CH_GRANT"), - - (PUINT_8)DISP_STRING("MID_AIS_SCN_SCAN_REQ"), - (PUINT_8)DISP_STRING("MID_AIS_SCN_SCAN_REQ_V2"), - (PUINT_8)DISP_STRING("MID_AIS_SCN_SCAN_CANCEL"), - (PUINT_8)DISP_STRING("MID_P2P_SCN_SCAN_REQ"), - (PUINT_8)DISP_STRING("MID_P2P_SCN_SCAN_REQ_V2"), - (PUINT_8)DISP_STRING("MID_P2P_SCN_SCAN_CANCEL"), - (PUINT_8)DISP_STRING("MID_BOW_SCN_SCAN_REQ"), - (PUINT_8)DISP_STRING("MID_BOW_SCN_SCAN_REQ_V2"), - (PUINT_8)DISP_STRING("MID_BOW_SCN_SCAN_CANCEL"), - (PUINT_8)DISP_STRING("MID_RLM_SCN_SCAN_REQ"), - (PUINT_8)DISP_STRING("MID_RLM_SCN_SCAN_REQ_V2"), - (PUINT_8)DISP_STRING("MID_RLM_SCN_SCAN_CANCEL"), - (PUINT_8)DISP_STRING("MID_SCN_AIS_SCAN_DONE"), - (PUINT_8)DISP_STRING("MID_SCN_P2P_SCAN_DONE"), - (PUINT_8)DISP_STRING("MID_SCN_BOW_SCAN_DONE"), - (PUINT_8)DISP_STRING("MID_SCN_RLM_SCAN_DONE"), - - (PUINT_8)DISP_STRING("MID_OID_AIS_FSM_JOIN_REQ"), - (PUINT_8)DISP_STRING("MID_OID_AIS_FSM_ABORT"), - (PUINT_8)DISP_STRING("MID_AIS_SAA_FSM_START"), - (PUINT_8)DISP_STRING("MID_AIS_SAA_FSM_ABORT"), - (PUINT_8)DISP_STRING("MID_SAA_AIS_JOIN_COMPLETE"), - -#if CFG_ENABLE_BT_OVER_WIFI - (PUINT_8)DISP_STRING("MID_BOW_SAA_FSM_START"), - (PUINT_8)DISP_STRING("MID_BOW_SAA_FSM_ABORT"), - (PUINT_8)DISP_STRING("MID_SAA_BOW_JOIN_COMPLETE"), -#endif - -#if CFG_ENABLE_WIFI_DIRECT - (PUINT_8)DISP_STRING("MID_P2P_SAA_FSM_START"), - (PUINT_8)DISP_STRING("MID_P2P_SAA_FSM_ABORT"), - (PUINT_8)DISP_STRING("MID_SAA_P2P_JOIN_COMPLETE"), - - (PUINT_8)DISP_STRING("MID_MNY_P2P_FUN_SWITCH"), - (PUINT_8)DISP_STRING("MID_MNY_P2P_DEVICE_DISCOVERY"), - (PUINT_8)DISP_STRING("MID_MNY_P2P_CONNECTION_REQ"), - (PUINT_8)DISP_STRING("MID_MNY_P2P_CONNECTION_ABORT"), - (PUINT_8)DISP_STRING("MID_MNY_P2P_BEACON_UPDATE"), - (PUINT_8)DISP_STRING("MID_MNY_P2P_STOP_AP"), - (PUINT_8)DISP_STRING("MID_MNY_P2P_CHNL_REQ"), - (PUINT_8)DISP_STRING("MID_MNY_P2P_CHNL_ABORT"), - (PUINT_8)DISP_STRING("MID_MNY_P2P_MGMT_TX"), - (PUINT_8)DISP_STRING("MID_MNY_P2P_GROUP_DISSOLVE"), - (PUINT_8)DISP_STRING("MID_MNY_P2P_MGMT_FRAME_REGISTER"), - (PUINT_8)DISP_STRING("MID_MNY_P2P_NET_DEV_REGISTER"), - (PUINT_8)DISP_STRING("MID_MNY_P2P_START_AP"), - (PUINT_8)DISP_STRING("MID_MNY_P2P_UPDATE_IE_BUF"), - #endif - -#if CFG_SUPPORT_ADHOC - //(PUINT_8)DISP_STRING("MID_AIS_CNM_CREATE_IBSS_REQ"), - //(PUINT_8)DISP_STRING("MID_CNM_AIS_CREATE_IBSS_GRANT"), - //(PUINT_8)DISP_STRING("MID_AIS_CNM_MERGE_IBSS_REQ"), - //(PUINT_8)DISP_STRING("MID_CNM_AIS_MERGE_IBSS_GRANT"), - (PUINT_8)DISP_STRING("MID_SCN_AIS_FOUND_IBSS"), -#endif /* CFG_SUPPORT_ADHOC */ - - (PUINT_8)DISP_STRING("MID_SAA_AIS_FSM_ABORT") -}; -/*lint -restore */ -#endif /* DBG */ - -/* This message entry will be re-ordered based on the message ID order - * by invoking mboxInitMsgMap() - */ -static MSG_HNDL_ENTRY_T arMsgMapTable[] = { - { MID_MNY_CNM_CH_REQ, cnmChMngrRequestPrivilege }, - { MID_MNY_CNM_CH_ABORT, cnmChMngrAbortPrivilege }, - { MID_CNM_AIS_CH_GRANT, aisFsmRunEventChGrant }, -#if CFG_ENABLE_WIFI_DIRECT - { MID_CNM_P2P_CH_GRANT, p2pFsmRunEventChGrant }, /*set in gl_p2p_init.c*/ -#else - { MID_CNM_P2P_CH_GRANT, mboxDummy }, -#endif - -#if CFG_ENABLE_BT_OVER_WIFI - { MID_CNM_BOW_CH_GRANT, bowRunEventChGrant }, -#else - { MID_CNM_BOW_CH_GRANT, mboxDummy }, -#endif - - /*--------------------------------------------------*/ - /* SCN Module Mailbox Messages */ - /*--------------------------------------------------*/ - { MID_AIS_SCN_SCAN_REQ, scnFsmMsgStart }, - { MID_AIS_SCN_SCAN_REQ_V2, scnFsmMsgStart }, - { MID_AIS_SCN_SCAN_CANCEL, scnFsmMsgAbort }, - { MID_P2P_SCN_SCAN_REQ, scnFsmMsgStart }, - { MID_P2P_SCN_SCAN_REQ_V2, scnFsmMsgStart }, - { MID_P2P_SCN_SCAN_CANCEL, scnFsmMsgAbort }, - { MID_BOW_SCN_SCAN_REQ, scnFsmMsgStart }, - { MID_BOW_SCN_SCAN_REQ_V2, scnFsmMsgStart }, - { MID_BOW_SCN_SCAN_CANCEL, scnFsmMsgAbort }, - { MID_RLM_SCN_SCAN_REQ, scnFsmMsgStart }, - { MID_RLM_SCN_SCAN_REQ_V2, scnFsmMsgStart }, - { MID_RLM_SCN_SCAN_CANCEL, scnFsmMsgAbort }, - { MID_SCN_AIS_SCAN_DONE, aisFsmRunEventScanDone }, -#if CFG_ENABLE_WIFI_DIRECT - { MID_SCN_P2P_SCAN_DONE, p2pFsmRunEventScanDone }, /*set in gl_p2p_init.c*/ -#else - { MID_SCN_P2P_SCAN_DONE, mboxDummy }, -#endif - -#if CFG_ENABLE_BT_OVER_WIFI - { MID_SCN_BOW_SCAN_DONE, bowResponderScanDone }, -#else - { MID_SCN_BOW_SCAN_DONE, mboxDummy }, -#endif - { MID_SCN_RLM_SCAN_DONE, rlmObssScanDone }, - - /*--------------------------------------------------*/ - /* AIS Module Mailbox Messages */ - /*--------------------------------------------------*/ - { MID_OID_AIS_FSM_JOIN_REQ, aisFsmRunEventAbort }, - { MID_OID_AIS_FSM_ABORT, aisFsmRunEventAbort }, - { MID_AIS_SAA_FSM_START, saaFsmRunEventStart }, - { MID_AIS_SAA_FSM_ABORT, saaFsmRunEventAbort }, - { MID_SAA_AIS_JOIN_COMPLETE, aisFsmRunEventJoinComplete }, - -#if CFG_ENABLE_BT_OVER_WIFI - /*--------------------------------------------------*/ - /* BOW Module Mailbox Messages */ - /*--------------------------------------------------*/ - { MID_BOW_SAA_FSM_START, saaFsmRunEventStart }, - { MID_BOW_SAA_FSM_ABORT, saaFsmRunEventAbort }, - { MID_SAA_BOW_JOIN_COMPLETE, bowFsmRunEventJoinComplete }, -#endif - -#if CFG_ENABLE_WIFI_DIRECT /*set in gl_p2p_init.c*/ - { MID_P2P_SAA_FSM_START, saaFsmRunEventStart }, - { MID_P2P_SAA_FSM_ABORT, saaFsmRunEventAbort }, - { MID_SAA_P2P_JOIN_COMPLETE, p2pFsmRunEventJoinComplete },// TODO: p2pFsmRunEventJoinComplete - - { MID_MNY_P2P_FUN_SWITCH, p2pFsmRunEventSwitchOPMode }, - { MID_MNY_P2P_DEVICE_DISCOVERY, p2pFsmRunEventScanRequest }, - { MID_MNY_P2P_CONNECTION_REQ, p2pFsmRunEventConnectionRequest }, - { MID_MNY_P2P_CONNECTION_ABORT, p2pFsmRunEventConnectionAbort }, - { MID_MNY_P2P_BEACON_UPDATE, p2pFsmRunEventBeaconUpdate }, - { MID_MNY_P2P_STOP_AP, p2pFsmRunEventStopAP }, - { MID_MNY_P2P_CHNL_REQ, p2pFsmRunEventChannelRequest }, - { MID_MNY_P2P_CHNL_ABORT, p2pFsmRunEventChannelAbort }, - { MID_MNY_P2P_MGMT_TX, p2pFsmRunEventMgmtFrameTx }, - { MID_MNY_P2P_GROUP_DISSOLVE, p2pFsmRunEventDissolve }, - { MID_MNY_P2P_MGMT_FRAME_REGISTER, p2pFsmRunEventMgmtFrameRegister }, - { MID_MNY_P2P_NET_DEV_REGISTER, p2pFsmRunEventNetDeviceRegister }, - { MID_MNY_P2P_START_AP, p2pFsmRunEventStartAP }, - { MID_MNY_P2P_MGMT_FRAME_UPDATE, p2pFsmRunEventUpdateMgmtFrame }, -#endif - -#if CFG_SUPPORT_ADHOC - { MID_SCN_AIS_FOUND_IBSS, aisFsmRunEventFoundIBSSPeer }, -#endif /* CFG_SUPPORT_ADHOC */ - - { MID_SAA_AIS_FSM_ABORT, aisFsmRunEventAbort } -}; - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -#if DBG -#define MBOX_HNDL_MSG(prAdapter, prMsg) do { \ - ASSERT(arMsgMapTable[prMsg->eMsgId].pfMsgHndl); \ - if (arMsgMapTable[prMsg->eMsgId].pfMsgHndl) { \ - DBGLOG(CNM, LOUD, ("DO MSG [%d: %s]\n", prMsg->eMsgId, apucDebugMsg[prMsg->eMsgId])); \ - arMsgMapTable[prMsg->eMsgId].pfMsgHndl(prAdapter, prMsg); \ - } \ - else { \ - DBGLOG(CNM, ERROR, ("NULL fptr for MSG [%d]\n", prMsg->eMsgId)); \ - cnmMemFree(prAdapter, prMsg); \ - } \ -} while (0) -#else -#define MBOX_HNDL_MSG(prAdapter, prMsg) do { \ - ASSERT(arMsgMapTable[prMsg->eMsgId].pfMsgHndl); \ - if (arMsgMapTable[prMsg->eMsgId].pfMsgHndl) { \ - DBGLOG(CNM, LOUD, ("DO MSG [%d]\n", prMsg->eMsgId)); \ - arMsgMapTable[prMsg->eMsgId].pfMsgHndl(prAdapter, prMsg); \ - } \ - else { \ - DBGLOG(CNM, ERROR, ("NULL fptr for MSG [%d]\n", prMsg->eMsgId)); \ - cnmMemFree(prAdapter, prMsg); \ - } \ -} while (0) -#endif -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -mboxInitMsgMap ( - VOID - ) -{ - UINT_32 i, idx; - MSG_HNDL_ENTRY_T rTempEntry; - - ASSERT((sizeof(arMsgMapTable) / sizeof(MSG_HNDL_ENTRY_T)) == MID_TOTAL_NUM); - - for (i = 0; i < MID_TOTAL_NUM; i++) { - if (arMsgMapTable[i].eMsgId == (ENUM_MSG_ID_T) i) { - continue; - } - for (idx = i + 1; idx < MID_TOTAL_NUM; idx++) { - if (arMsgMapTable[idx].eMsgId == (ENUM_MSG_ID_T) i) { - break; - } - } - ASSERT(idx < MID_TOTAL_NUM); - if (idx >= MID_TOTAL_NUM) { - continue; - } - - /* Swap target entry and current entry */ - rTempEntry.eMsgId = arMsgMapTable[idx].eMsgId; - rTempEntry.pfMsgHndl= arMsgMapTable[idx].pfMsgHndl; - - arMsgMapTable[idx].eMsgId = arMsgMapTable[i].eMsgId; - arMsgMapTable[idx].pfMsgHndl = arMsgMapTable[i].pfMsgHndl; - - arMsgMapTable[i].eMsgId = rTempEntry.eMsgId; - arMsgMapTable[i].pfMsgHndl = rTempEntry.pfMsgHndl; - } - - /* Verify the correctness of final message map */ - for (i = 0; i < MID_TOTAL_NUM; i++) { - ASSERT(arMsgMapTable[i].eMsgId == (ENUM_MSG_ID_T) i); - while (arMsgMapTable[i].eMsgId != (ENUM_MSG_ID_T) i); - } - -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -mboxSetup ( - IN P_ADAPTER_T prAdapter, - IN ENUM_MBOX_ID_T eMboxId - ) -{ - P_MBOX_T prMbox; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(eMboxId < MBOX_ID_TOTAL_NUM); - ASSERT(prAdapter); - - prMbox = &(prAdapter->arMbox[eMboxId]); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX); - LINK_INITIALIZE(&prMbox->rLinkHead); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -mboxSendMsg ( - IN P_ADAPTER_T prAdapter, - IN ENUM_MBOX_ID_T eMboxId, - IN P_MSG_HDR_T prMsg, - IN EUNM_MSG_SEND_METHOD_T eMethod - ) -{ - P_MBOX_T prMbox; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(eMboxId < MBOX_ID_TOTAL_NUM); - ASSERT(prMsg); - ASSERT(prAdapter); - - prMbox = &(prAdapter->arMbox[eMboxId]); - - switch (eMethod) { - case MSG_SEND_METHOD_BUF: - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX); - LINK_INSERT_TAIL(&prMbox->rLinkHead, &prMsg->rLinkEntry); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX); - - // to wake up main service thread - GLUE_SET_EVENT(prAdapter->prGlueInfo); - - break; - - case MSG_SEND_METHOD_UNBUF: - MBOX_HNDL_MSG(prAdapter, prMsg); - break; - - default: - ASSERT(0); - break; - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -mboxRcvAllMsg ( - IN P_ADAPTER_T prAdapter, - ENUM_MBOX_ID_T eMboxId - ) -{ - P_MBOX_T prMbox; - P_MSG_HDR_T prMsg; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(eMboxId < MBOX_ID_TOTAL_NUM); - ASSERT(prAdapter); - - prMbox = &(prAdapter->arMbox[eMboxId]); - - while (!LINK_IS_EMPTY(&prMbox->rLinkHead) ) { - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX); - LINK_REMOVE_HEAD(&prMbox->rLinkHead, prMsg, P_MSG_HDR_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX); - - ASSERT(prMsg); - MBOX_HNDL_MSG(prAdapter, prMsg); - } - -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -mboxInitialize ( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 i; - - ASSERT(prAdapter); - - /* Initialize Mailbox */ - mboxInitMsgMap(); - - /* Setup/initialize each mailbox */ - for (i = 0; i < MBOX_ID_TOTAL_NUM; i++) { - mboxSetup(prAdapter, i); - } - -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -mboxDestroy ( - IN P_ADAPTER_T prAdapter - ) -{ - P_MBOX_T prMbox; - P_MSG_HDR_T prMsg; - UINT_8 i; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - for (i = 0; i < MBOX_ID_TOTAL_NUM; i++) { - prMbox = &(prAdapter->arMbox[i]); - - while (!LINK_IS_EMPTY(&prMbox->rLinkHead) ) { - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX); - LINK_REMOVE_HEAD(&prMbox->rLinkHead, prMsg, P_MSG_HDR_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX); - - ASSERT(prMsg); - cnmMemFree(prAdapter, prMsg); - } - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This is dummy function to prevent empty arMsgMapTable[] for compiling. -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -mboxDummy ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - ASSERT(prAdapter); - - cnmMemFree(prAdapter, prMsgHdr); - - return; -} - diff --git a/drivers/net/wireless/mt5931/mgmt/mib.c b/drivers/net/wireless/mt5931/mgmt/mib.c deleted file mode 100755 index 270bdf97a71e..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/mib.c +++ /dev/null @@ -1,102 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/mib.c#1 $ -*/ - -/*! \file "mib.c" - \brief This file includes the mib default vale and functions. -*/ - - - -/* -** $Log: mib.c $ - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add mib.c. - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ -NON_HT_PHY_ATTRIBUTE_T rNonHTPhyAttributes[] = { - {RATE_SET_HR_DSSS, TRUE, FALSE }, /* For PHY_TYPE_HR_DSSS_INDEX(0) */ - {RATE_SET_ERP, TRUE, TRUE }, /* For PHY_TYPE_ERP_INDEX(1) */ - {RATE_SET_ERP_P2P, TRUE, TRUE }, /* For PHY_TYPE_ERP_P2P_INDEX(2) */ - {RATE_SET_OFDM, FALSE, FALSE }, /* For PHY_TYPE_OFDM_INDEX(3) */ -}; - -NON_HT_ADHOC_MODE_ATTRIBUTE_T rNonHTAdHocModeAttributes[AD_HOC_MODE_NUM] = { - {PHY_TYPE_HR_DSSS_INDEX, BASIC_RATE_SET_HR_DSSS}, /* For AD_HOC_MODE_11B(0) */ - {PHY_TYPE_ERP_INDEX, BASIC_RATE_SET_HR_DSSS_ERP}, /* For AD_HOC_MODE_MIXED_11BG(1) */ - {PHY_TYPE_ERP_INDEX, BASIC_RATE_SET_ERP}, /* For AD_HOC_MODE_11G(2) */ - {PHY_TYPE_OFDM_INDEX, BASIC_RATE_SET_OFDM}, /* For AD_HOC_MODE_11A(3) */ -}; - -NON_HT_AP_MODE_ATTRIBUTE_T rNonHTApModeAttributes[AP_MODE_NUM] = { - {PHY_TYPE_HR_DSSS_INDEX, BASIC_RATE_SET_HR_DSSS}, /* For AP_MODE_11B(0) */ - {PHY_TYPE_ERP_INDEX, BASIC_RATE_SET_HR_DSSS_ERP}, /* For AP_MODE_MIXED_11BG(1) */ - {PHY_TYPE_ERP_INDEX, BASIC_RATE_SET_ERP}, /* For AP_MODE_11G(2) */ - {PHY_TYPE_ERP_P2P_INDEX, BASIC_RATE_SET_ERP_P2P}, /* For AP_MODE_11G_P2P(3) */ - {PHY_TYPE_OFDM_INDEX, BASIC_RATE_SET_OFDM}, /* For AP_MODE_11A(4) */ -}; - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - - diff --git a/drivers/net/wireless/mt5931/mgmt/p2p_assoc.c b/drivers/net/wireless/mt5931/mgmt/p2p_assoc.c deleted file mode 100755 index d03d8338a261..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/p2p_assoc.c +++ /dev/null @@ -1,99 +0,0 @@ -/* -** $Id: @(#) p2p_assoc.c@@ -*/ - -/*! \file "p2p_assoc.c" - \brief This file includes the Wi-Fi Direct association-related functions. - - This file includes the association-related functions. -*/ - - - - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to compose Common Information Elements for P2P Association -* Request Frame. -* -* @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -PUINT_8 -p2pBuildReAssocReqFrameCommonIEs( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN PUINT_8 pucBuffer - ) -{ - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - - prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - - /* Fill the SSID element. */ - SSID_IE(pucBuffer)->ucId = ELEM_ID_SSID; - - /* NOTE(Kevin): We copy the SSID from CONNECTION_SETTINGS for the case of - * Passive Scan and the target BSS didn't broadcast SSID on its Beacon Frame. - */ - - COPY_SSID(SSID_IE(pucBuffer)->aucSSID, - SSID_IE(pucBuffer)->ucLength, - prP2pConnSettings->aucSSID, - prP2pConnSettings->ucSSIDLen); - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - pucBuffer += IE_SIZE(pucBuffer); - return pucBuffer; -} - - diff --git a/drivers/net/wireless/mt5931/mgmt/p2p_bss.c b/drivers/net/wireless/mt5931/mgmt/p2p_bss.c deleted file mode 100755 index d9aa1a130034..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/p2p_bss.c +++ /dev/null @@ -1,66 +0,0 @@ -/* -** $Id: @(#) p2p_bss.c@@ -*/ - -/*! \file "p2p_bss.c" - \brief This file contains the functions for creating p2p BSS(AP). - - This file contains the functions for BSS(AP). We may create a BSS - network, or merge with exist IBSS network and sending Beacon Frame or reply - the Probe Response Frame for received Probe Request Frame. -*/ - - - - - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - - - diff --git a/drivers/net/wireless/mt5931/mgmt/p2p_fsm.c b/drivers/net/wireless/mt5931/mgmt/p2p_fsm.c deleted file mode 100755 index 6a72f32a5c0f..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/p2p_fsm.c +++ /dev/null @@ -1,3379 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/mgmt/p2p_fsm.c#61 $ -*/ - -/*! \file "p2p_fsm.c" - \brief This file defines the FSM for P2P Module. - - This file defines the FSM for P2P Module. -*/ - -/******************************************************************************* -* Copyright (c) 2010 MediaTek Inc. -* -* All rights reserved. Copying, compilation, modification, distribution -* or any other use whatsoever of this material is strictly prohibited -* except in accordance with a Software License Agreement with -* MediaTek Inc. -******************************************************************************** -*/ - -/******************************************************************************* -* LEGAL DISCLAIMER -* -* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND -* AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK -* SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE -* PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY -* DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT -* LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -* PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE -* ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY -* WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK -* SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY -* WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE -* FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO -* CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. -* -* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE -* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL -* BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT -* ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY -* BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. -* -* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE -* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT -* OF LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING -* THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN -* FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE -* (ICC). -******************************************************************************** -*/ - -/* -** $Log: p2p_fsm.c $ -** -** 08 31 2012 yuche.tsai -** [ALPS00349585] [6577JB][WiFi direct][KE]Establish p2p connection while both device have connected to AP previously,one device reboots automatically with KE -** Fix possible KE when concurrent & disconnect. -** -** 08 21 2012 yuche.tsai -** NULL -** fix disconnect indication. -** -** 08 16 2012 yuche.tsai -** NULL -** Fix compile warning. -** -** 08 14 2012 yuche.tsai -** NULL -** Fix p2p bug find on ALPS.JB trunk. -** -** 07 27 2012 yuche.tsai -** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot -** Update for driver unload KE issue. -** -** 07 26 2012 yuche.tsai -** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot -** Update driver code of ALPS.JB for hot-spot. -** -** 07 19 2012 yuche.tsai -** NULL -** Code update for JB. - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 07 05 2011 yuche.tsai - * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue - * Fix the compile flag of enhancement. - * - * 07 05 2011 yuche.tsai - * [WCXRP00000808] [Volunteer Patch][MT6620][Driver/FW] Device discoverability issue fix - * Change device discoverability methodology. From driver SCAN to FW lock channel. - * - * 07 05 2011 yuche.tsai - * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue - * Add wifi direct connection enhancement method I, II & VI. - * - * 07 05 2011 yuche.tsai - * [WCXRP00000833] [Volunteer Patch][WiFi Direct][Driver] Service Discovery Frame RX Indicate Issue - * Fix Service Discovery Race Condition Issue. - * - * 06 23 2011 cp.wu - * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module - * change parameter name from PeerAddr to BSSID - * - * 06 21 2011 yuche.tsai - * [WCXRP00000799] [Volunteer Patch][MT6620][Driver] Connection Indication Twice Issue. - * Fix an issue of accepting connection of GO. - * - * 06 21 2011 yuche.tsai - * [WCXRP00000775] [Volunteer Patch][MT6620][Driver] Dynamic enable SD capability - * Drop GAS frame when SD is not enabled. - * - * 06 20 2011 yuche.tsai - * NULL - * Fix compile error. - * - * 06 20 2011 yuche.tsai - * [WCXRP00000799] [Volunteer Patch][MT6620][Driver] Connection Indication Twice Issue. - * Fix connection indication twice issue. - * - * 06 20 2011 cp.wu - * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module - * 1. specify target's BSSID when requesting channel privilege. - * 2. pass BSSID information to firmware domain - * - * 06 20 2011 yuche.tsai - * [WCXRP00000795] [Volunteer Patch][MT6620][Driver] GO can not connect second device issue - * Solve P2P GO can not formation with second device issue. - * - * 06 14 2011 yuche.tsai - * NULL - * Change disconnect feature. - * - * 06 10 2011 yuche.tsai - * [WCXRP00000775] [Volunteer Patch][MT6620][Driver] Dynamic enable SD capability[WCXRP00000776] [Need Patch][MT6620][Driver] MT6620 response probe request of P2P device with P2P IE under Hot Spot mode. - * 1. Dynamic enable SD capability after P2P supplicant ready. - * 2. Avoid response probe respone with p2p IE when under hot spot mode. - * - * 06 07 2011 yuche.tsai - * [WCXRP00000763] [Volunteer Patch][MT6620][Driver] RX Service Discovery Frame under AP mode Issue - * Fix RX SD request under AP mode issue. - * - * 06 02 2011 cp.wu - * [WCXRP00000681] [MT5931][Firmware] HIF code size reduction - * eliminate unused parameters for SAA-FSM - * - * 05 26 2011 yuche.tsai - * [WCXRP00000745] Support accepting connection after one Group Connection Lost. - -After Group Formation & lost connection, if MT6620 behave as: - -1. GO: It would keep under GO state until been dissolved by supplicant. - - At this time, other P2P device can use join method to join this group. - - -2. GC: It would keep on searching target GO or target device until been dissolved by supplicant. - -At this time, it would ignore other P2P device formation request. - - --- - -Modification: Make driver to accept GO NEGO REQ at this time, to let user decide to accept new connection or not. - - * [Volunteer Patch][MT6620][Driver] - * Driver would indicate connection request, if password ID is not ready but connection request is issued. - * - * 05 18 2011 yuche.tsai - * [WCXRP00000728] [Volunteer Patch][MT6620][Driver] Service Discovery Request TX issue. - * A solution for both connection request & IO control. - * - * 05 16 2011 yuche.tsai - * [WCXRP00000728] [Volunteer Patch][MT6620][Driver] Service Discovery Request TX issue. - * Fix SD request can not send out issue. - * - * 05 09 2011 terry.wu - * [WCXRP00000711] [MT6620 Wi-Fi][Driver] Set Initial value of StaType in StaRec for Hotspot Client - * Set initial value of StaType in StaRec for hotspot client. - * - * 05 04 2011 yuche.tsai - * [WCXRP00000697] [Volunteer Patch][MT6620][Driver] - * Bug fix for p2p descriptor is NULL if BSS descriptor is found first. - * - * 05 04 2011 yuche.tsai - * NULL - * Support partial persistent group function. - * - * 05 02 2011 yuche.tsai - * [WCXRP00000693] [Volunteer Patch][MT6620][Driver] Clear Formation Flag after TX lifetime timeout. - * Clear formation flag after formation timeout. - * - * 04 20 2011 yuche.tsai - * [WCXRP00000668] [Volunteer Patch][MT6620][Driver] Possible race condition when add scan & query scan result at the same time. - * Fix side effect while starting ATGO. - * - * 04 20 2011 yuche.tsai - * NULL - * Fix ASSERT issue in FW, side effect of last change. - * - * 04 19 2011 yuche.tsai - * [WCXRP00000668] [Volunteer Patch][MT6620][Driver] Possible race condition when add scan & query scan result at the same time. - * Workaround for multiple device connection, before invitation ready. - * - * 04 19 2011 yuche.tsai - * [WCXRP00000665] [Wifi Direct][MT6620 E4] When use Ralink's dongle to establish wifi direct connection with PBC. But 6573 always not pop accept option to establish connection. - * Support connection indication when GO NEGO REQ doesn't have configure method, instead it has PasswordID. - * - * 04 18 2011 yuche.tsai - * NULL - * Fix error. - * - * 04 14 2011 yuche.tsai - * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case. - * Fix a connection issue. - * - * 04 14 2011 yuche.tsai - * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case. - * Fix the channel issue of AP mode. - * - * 04 14 2011 yuche.tsai - * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case. - * Connection flow refine for Sigma test. - * - * 04 09 2011 yuche.tsai - * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO. - * Fix Device discoverability related issue. - * - * 04 09 2011 yuche.tsai - * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO. - * Fix bug for Device Discoverability. - * - * 04 08 2011 yuche.tsai - * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO. - * Fix compile error. - * - * 04 08 2011 yuche.tsai - * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO. - * Add device discoverability support. - * - * 03 28 2011 yuche.tsai - * NULL - * Fix a possible issue for retry join when media status connected. - * - * 03 25 2011 yuche.tsai - * NULL - * Improve some error handleing. - * - * 03 24 2011 yuche.tsai - * NULL - * Assign AID before change STA_REC state to state 3. - * - * 03 23 2011 yuche.tsai - * NULL - * Fix Response Rate Issue when TX Auth Rsp Frame under P2P Mode. - * - * 03 23 2011 yuche.tsai - * NULL - * Fix issue of connection to one GC. - * - * 03 23 2011 yuche.tsai - * NULL - * Fix ASSERT issue when starting Hot-spot. - * - * 03 22 2011 yuche.tsai - * NULL - * When Target Information is not available, change to passive mode. - * - * 03 22 2011 yuche.tsai - * NULL - * Fix one connection issue while using Keypad to connect a GO. - * - * 03 22 2011 yuche.tsai - * NULL - * 1. Fix two issues that may cause kernel panic. - * - * 03 22 2011 yuche.tsai - * NULL - * Fix GC connect to other device issue. - * - * 03 22 2011 yuche.tsai - * NULL - * 1.Shorten the LISTEN interval. - * 2. Fix IF address issue when we are GO - * 3. Fix LISTEN channel issue. - * - * 03 22 2011 yuche.tsai - * NULL - * Modify formation policy setting. - * - * 03 21 2011 yuche.tsai - * NULL - * Solve Listen State doesn't response probe response issue. - * - * 03 21 2011 yuche.tsai - * NULL - * Change P2P Connection Request Flow. - * - * 03 19 2011 yuche.tsai - * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct. - * Add beacon timeout support. - * - * 03 19 2011 yuche.tsai - * [WCXRP00000583] [Volunteer Patch][MT6620][Driver] P2P connection of the third peer issue - * Indicate the correct Group SSID when join on Group. - * - * 03 19 2011 yuche.tsai - * [WCXRP00000583] [Volunteer Patch][MT6620][Driver] P2P connection of the third peer issue - * Support the third P2P device to join GO/GC group. - * - * 03 19 2011 yuche.tsai - * [WCXRP00000581] [Volunteer Patch][MT6620][Driver] P2P IE in Assoc Req Issue - * Append P2P IE in Assoc Req, so that GC can be discovered in probe response of GO. - * - * 03 18 2011 yuche.tsai - * [WCXRP00000578] [Volunteer Patch][MT6620][Driver] Separate Connection Request from general IOCTL - * Separate connection request from general IOCTL. - * - * 03 18 2011 yuche.tsai - * [WCXRP00000574] [Volunteer Patch][MT6620][Driver] Modify P2P FSM Connection Flow - * Modify connection flow after Group Formation Complete, or device connect to a GO. - * Instead of request channel & connect directly, we use scan to allocate channel bandwidth & connect after RX BCN. - * - * 03 17 2011 yuche.tsai - * NULL - * When AIS is connect to an AP, Hot Spot would be enabled under fixed same channel. - * - * 03 17 2011 yuche.tsai - * NULL - * Solve the Group Info IE in Probe Response incorrect issue. - * - * 03 17 2011 yuche.tsai - * NULL - * Release Channel after Join Complete. - * - * 03 16 2011 wh.su - * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done - * enable the protected while at P2P start GO, and skip some security check . - * - * 03 15 2011 yuche.tsai - * [WCXRP00000560] [Volunteer Patch][MT6620][Driver] P2P Connection from UI using KEY/DISPLAY issue - * Fix local configure method issue. - * - * 03 15 2011 yuche.tsai - * [WCXRP00000560] [Volunteer Patch][MT6620][Driver] P2P Connection from UI using KEY/DISPLAY issue - * Fix some configure method issue. - * - * 03 14 2011 yuche.tsai - * NULL - * . - * - * 03 14 2011 yuche.tsai - * NULL - * Fix password ID issue. - * - * 03 10 2011 yuche.tsai - * NULL - * Add P2P API. - * - * 03 08 2011 yuche.tsai - * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue[WCXRP00000509] [Volunteer Patch][MT6620][Driver] Kernal panic when remove p2p module. - * . - * - * 03 07 2011 yuche.tsai - * [WCXRP00000502] [Volunteer Patch][MT6620][Driver] Fix group ID issue when doing Group Formation. - * . - * - * 03 07 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * rename the define to anti_pviracy. - * - * 03 05 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * add the code to get the check rsponse and indicate to app. - * - * 03 04 2011 wh.su - * [WCXRP00000510] [MT6620 Wi-Fi] [Driver] Fixed the CTIA enter test mode issue - * fixed the p2p action frame type check for device request indication. - * - * 03 02 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Fix Service Discovery RX packet buffer pointer. - * - * 03 01 2011 yuche.tsai - * [WCXRP00000501] [Volunteer Patch][MT6620][Driver] No common channel issue when doing GO formation - * Update channel issue when doing GO formation.. - * - * 03 01 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Update Service Discovery Related wlanoid function. - * - * 02 21 2011 yuche.tsai - * [WCXRP00000481] [Volunteer Patch][MT6620][FW] Scan hang under concurrent case. - * Fix all BE issue of WSC or P2P IE. - * - * 02 18 2011 wh.su - * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE - * fixed the wsc config method mapping to driver used config method issue. - * - * 02 18 2011 yuche.tsai - * [WCXRP00000479] [Volunteer Patch][MT6620][Driver] Probe Response of P2P using 11b rate. - * Update basic rate to FW, after P2P is initialed. - * - * 02 18 2011 yuche.tsai - * [WCXRP00000478] [Volunteer Patch][MT6620][Driver] Probe request frame during search phase do not contain P2P wildcard SSID. - * Use P2P Wildcard SSID when scan type of P2P_WILDCARD_SSID is set. - * - * 02 18 2011 yuche.tsai - * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue - * Fix WSC IE BE format issue. - * - * 02 17 2011 wh.su - * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE - * append the WSC IE config method attribute at provision discovery request. - * - * 02 16 2011 wh.su - * [WCXRP00000448] [MT6620 Wi-Fi][Driver] Fixed WSC IE not send out at probe request - * fixed the probe request send out without WSC IE issue (at P2P). - * - * 02 16 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * If two station connected to the Hot-Spot and one disconnect, FW would get into an infinite loop - * - * 02 15 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * Fix re-connection issue after RX deauthentication. - * - * 02 15 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * Fix conneciton issue after disconnect with AP. - * - * 02 12 2011 yuche.tsai - * [WCXRP00000441] [Volunteer Patch][MT6620][Driver] BoW can not create desired station type when Hot Spot is enabled. - * P2P Create Station Type according to Target BSS capability. - * - * 02 10 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * Support Disassoc & Deauthentication for Hot-Spot. - * - * 02 09 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Add Service Discovery Indication Related code. - * - * 02 09 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * Add Support for MLME deauthentication for Hot-Spot. - * - * 02 09 2011 yuche.tsai - * [WCXRP00000429] [Volunteer Patch][MT6620][Driver] Hot Spot Client Limit Issue - * Fix Client Limit Issue. - * - * 02 08 2011 yuche.tsai - * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module. - * Disconnect every station client when disolve on P2P group. - * - * 02 08 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * 1. Fix Service Disocvery Logical issue. - * 2. Fix a NULL pointer access violation issue when sending deauthentication packet to a class error station. - * - * 02 08 2011 yuche.tsai - * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module. - * Workaround of disable P2P network. - * - * 02 08 2011 yuche.tsai - * [WCXRP00000421] [Volunteer Patch][MT6620][Driver] Fix incorrect SSID length Issue - * 1. Fixed SSID wrong length issue. - * 2. Under Hot Spot configuration, there won't be any P2P IE. - * 3. Under Hot Spot configuration, P2P FSM won't get into LISTEN state first. - * - * 01 27 2011 yuche.tsai - * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate. - * Modify Start GO flow. - * - * 01 27 2011 yuche.tsai - * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate. - * Fix desire phy type set issue. - * - * 01 27 2011 yuche.tsai - * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate. - * Add desire phy type set phase I. - * - * 01 26 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Fix P2P Disconnect Issue. - * - * 01 26 2011 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Add Service Discovery Function. - * - * 01 26 2011 cm.chang - * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument - * . - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Fix compile error when DBG is disabled. - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Change Station Type Definition. - * - * 01 19 2011 yuche.tsai - * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode. - * Add P2P QoS Support. - * - * 01 19 2011 george.huang - * [WCXRP00000355] [MT6620 Wi-Fi] Set WMM-PS related setting with qualifying AP capability - * Null NOA attribute setting when no related parameters. - * - * 01 14 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * Modify AAA flow according to CM's comment. - * - * 01 13 2011 yuche.tsai - * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode. - * Resolve Channel ZERO issue. (Uninitialized default channel) - * - * 01 13 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * Update P2P State Debug Message. - * - * 01 12 2011 yuche.tsai - * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode. - * Fix bug when allocating message buffer. - * - * 01 12 2011 yuche.tsai - * [WCXRP00000353] [Volunteer Patch][MT6620][Driver] Desired Non-HT Rate Set update when STA record is created under AP Mode. - * Update Phy Type Set. When legacy client is connected, it can use 11b rate, - * but if the P2P device is connected, 11b rate is not allowed. - * - * 01 12 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * 1. Modify Channel Acquire Time of AP mode from 5s to 1s. - * 2. Call cnmP2pIsPermit() before active P2P network. - * 3. Add channel selection support for AP mode. - * - * 01 12 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * Fix Bug of reference to NULL pointer. - * - * 01 12 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * Modify some behavior of AP mode. - * - * 01 12 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * Fix bug of wrong pointer check. - * - * 01 12 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * Fix Compile Error. - * - * 01 11 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * Add station record into client list before change it state from STATE_2 to STATE_3. - * - * 01 05 2011 yuche.tsai - * [WCXRP00000345] [MT6620][Volunteer Patch] P2P may issue a SSID specified scan request, but the SSID length is still invalid. - * Specify SSID Type when issue a scan request. - * - * 01 05 2011 cp.wu - * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands - * correct typo - * - * 01 05 2011 george.huang - * [WCXRP00000343] [MT6620 Wi-Fi] Add TSF reset path for concurrent operation - * modify NOA update path for preventing assertion false alarm. - * - * 01 04 2011 cp.wu - * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands - * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure - * - * 01 03 2011 wh.su - * [WCXRP00000326] [MT6620][Wi-Fi][Driver] check in the binary format gl_sec.o.new instead of use change type!!! - * let the p2p ap mode acept a legacy device join. - * - * 12 22 2010 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Fix Compile Error. - * - * 12 15 2010 yuche.tsai - * [WCXRP00000245] 1. Invitation Request/Response. -2. Provision Discovery Request/Response - - * Refine Connection Flow. - * - * 12 08 2010 yuche.tsai - * [WCXRP00000245] [MT6620][Driver] Invitation & Provision Discovery Feature Check-in - * [WCXRP000000245][MT6620][Driver] Invitation Request Feature Add - * - * 12 08 2010 yuche.tsai - * [WCXRP00000244] [MT6620][Driver] Add station record type for each client when in AP mode. - * Change STA Type under AP mode. We would tell if client is a P2P device or a legacy client by checking the P2P IE in assoc req frame. - * - * 12 07 2010 cm.chang - * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk - * The order of invoking nicUpdateBss() and rlm functions - * - * 12 02 2010 yuche.tsai - * NULL - * Update P2P Connection Policy for Invitation. - * - * 12 02 2010 yuche.tsai - * NULL - * Update P2P Connection Policy for Invitation & Provision Discovery. - * - * 11 30 2010 yuche.tsai - * NULL - * Invitation & Provision Discovery Indication. - * - * 11 30 2010 yuche.tsai - * NULL - * Update Configure Method indication & selection for Provision Discovery & GO_NEGO_REQ - * - * 11 30 2010 yuche.tsai - * NULL - * Update RCIP value when RX assoc request frame. - * - * 11 29 2010 yuche.tsai - * NULL - * Update P2P related function for INVITATION & PROVISION DISCOVERY. - * - * 11 26 2010 george.huang - * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function - * Update P2P PS for NOA function. - * - * 11 25 2010 yuche.tsai - * NULL - * Update Code for Invitation Related Function. - * - * 11 17 2010 wh.su - * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID[WCXRP00000179] [MT6620 Wi-Fi][FW] Set the Tx lowest rate at wlan table for normal operation - * fixed some ASSERT check. - * - * 11 05 2010 wh.su - * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID - * fixed the p2p role code error. - * - * 11 04 2010 wh.su - * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID - * adding the p2p random ssid support. - * - * 10 20 2010 wh.su - * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group - * fixed the ASSERT check error - * - * 10 20 2010 wh.su - * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group - * Add the code to support disconnect p2p group - * - * 10 19 2010 wh.su - * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine[WCXRP00000102] [MT6620 Wi-Fi] [FW] Add a compiling flag and code for support Direct GO at Android - * fixed the compiling error. - * - * 10 14 2010 wh.su - * [WCXRP00000102] [MT6620 Wi-Fi] [FW] Add a compiling flag and code for support Direct GO at Android - * adding a code to support Direct GO with a compiling flag . - * - * 10 08 2010 cp.wu - * [WCXRP00000087] [MT6620 Wi-Fi][Driver] Cannot connect to 5GHz AP, driver will cause FW assert. - * correct erroneous logic: specifying eBand with incompatible eSco - * - * 10 08 2010 wh.su - * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine - * fixed the compiling error. - * - * 10 08 2010 wh.su - * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine - * update the frog's new p2p state machine. - * - * 09 10 2010 wh.su - * NULL - * fixed the compiling error at WinXP. - * - * 09 07 2010 yuche.tsai - * NULL - * Reset Common IE Buffer of P2P INFO when scan request is issued. - * If an action frame other than public action frame is received, return direcly. - * - * 09 07 2010 wh.su - * NULL - * adding the code for beacon/probe req/ probe rsp wsc ie at p2p. - * - * 09 06 2010 wh.su - * NULL - * let the p2p can set the privacy bit at beacon and rsn ie at assoc req at key handshake state. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 26 2010 yuche.tsai - * NULL - * Add P2P Connection Abort Event Message handler. - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 08 23 2010 yuche.tsai - * NULL - * 1. Fix Interface Address from GO Nego Req/Rsp is not correct. - * 2. Fix GO mode does not change media state after station connected. - * 3. Fix STA don't response probe request when there is a connection request. - * - * 08 20 2010 cm.chang - * NULL - * Migrate RLM code to host from FW - * - * 08 20 2010 kevin.huang - * NULL - * Modify AAA Module for changing STA STATE 3 at p2p/bowRunEventAAAComplete() - * - * 08 20 2010 yuche.tsai - * NULL - * Add Glue Layer indication. - * - * 08 17 2010 yuche.tsai - * NULL - * Fix compile warning under Linux. - * - * 08 17 2010 yuche.tsai - * NULL - * Fix some P2P FSM bug. - * - * 08 16 2010 yuche.tsai - * NULL - * Add random Interface Address Generation support. - * - * 08 16 2010 yuche.tsai - * NULL - * Fix some P2P FSM bug. - * - * 08 16 2010 yuche.tsai - * NULL - * Update P2P FSM code for GO Nego. - * - * 08 16 2010 kevin.huang - * NULL - * Refine AAA functions - * - * 08 12 2010 kevin.huang - * NULL - * Refine bssProcessProbeRequest() and bssSendBeaconProbeResponse() - * - * 08 12 2010 yuche.tsai - * NULL - * Join complete indication. - * - * 08 11 2010 yuche.tsai - * NULL - * Add two boolean in connection request. - * Based on these two boolean value, P2P FSM should - * decide to do invitation or group formation or start a GO directly. - * - * 08 11 2010 yuche.tsai - * NULL - * Update P2P FSM, currently P2P Device Discovery is verified. - * - * 08 05 2010 yuche.tsai - * NULL - * Update P2P FSM for group formation. - * - * 08 03 2010 george.huang - * NULL - * handle event for updating NOA parameters indicated from FW - * - * 08 03 2010 cp.wu - * NULL - * limit build always needs spin-lock declaration. - * - * 08 02 2010 yuche.tsai - * NULL - * P2P Group Negotiation Code Check in. - * - * 07 26 2010 yuche.tsai - * - * Add P2P FSM code check in. - * - * 07 21 2010 yuche.tsai - * - * Add P2P Scan & Scan Result Parsing & Saving. - * - * 07 19 2010 yuche.tsai - * - * Update P2P FSM. - * - * 07 09 2010 george.huang - * - * [WPD00001556] Migrate PM variables from FW to driver: for composing QoS Info - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 21 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Fix compile error while enable WIFI_DIRECT support. - * - * 06 21 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Update P2P Function call. - * - * 06 17 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * First draft for migration P2P FSM from FW to Driver. - * - * 04 19 2010 kevin.huang - * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support - * Add Beacon Timeout Support and will send Null frame to diagnose connection - * - * 03 18 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Rename CFG flag for P2P - * - * 02 26 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add code to test P2P GO - * - * 02 23 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add Wi-Fi Direct SSID and P2P GO Test Mode - * - * 02 05 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Modify code due to BAND_24G define was changed - * - * 02 05 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Revise data structure to share the same BSS_INFO_T for avoiding coding error - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -#if CFG_ENABLE_WIFI_DIRECT - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ -#if DBG -/*lint -save -e64 Type mismatch */ -static PUINT_8 apucDebugP2pState[P2P_STATE_NUM] = { - (PUINT_8)DISP_STRING("P2P_STATE_IDLE"), - (PUINT_8)DISP_STRING("P2P_STATE_SCAN"), - (PUINT_8)DISP_STRING("P2P_STATE_AP_CHANNEL_DETECT"), - (PUINT_8)DISP_STRING("P2P_STATE_REQING_CHANNEL"), - (PUINT_8)DISP_STRING("P2P_STATE_CHNL_ON_HAND"), - (PUINT_8)DISP_STRING("P2P_STATE_GC_JOIN") -}; -/*lint -restore */ -#endif /* DBG */ - - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/* p2pStateXXX : Processing P2P FSM related action. - * p2pFSMXXX : Control P2P FSM flow. - * p2pFuncXXX : Function for doing one thing. - */ -VOID -p2pFsmInit ( - IN P_ADAPTER_T prAdapter - ) -{ - - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - - do { - ASSERT_BREAK(prAdapter != NULL); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - ASSERT_BREAK(prP2pFsmInfo != NULL); - - LINK_INITIALIZE(&(prP2pFsmInfo->rMsgEventQueue)); - - prP2pFsmInfo->eCurrentState = prP2pFsmInfo->ePreviousState = P2P_STATE_IDLE; - prP2pFsmInfo->prTargetBss = NULL; - - cnmTimerInitTimer(prAdapter, - &(prP2pFsmInfo->rP2pFsmTimeoutTimer), - (PFN_MGMT_TIMEOUT_FUNC)p2pFsmRunEventFsmTimeout, - (UINT_32)prP2pFsmInfo); - - //4 <2> Initiate BSS_INFO_T - common part - BSS_INFO_INIT(prAdapter, NETWORK_TYPE_P2P_INDEX); - - - //4 <2.1> Initiate BSS_INFO_T - Setup HW ID - prP2pBssInfo->ucConfigAdHocAPMode = AP_MODE_11G_P2P; - prP2pBssInfo->ucHwDefaultFixedRateCode = RATE_OFDM_6M; - - - prP2pBssInfo->ucNonHTBasicPhyType = (UINT_8) - rNonHTApModeAttributes[prP2pBssInfo->ucConfigAdHocAPMode].ePhyTypeIndex; - prP2pBssInfo->u2BSSBasicRateSet = - rNonHTApModeAttributes[prP2pBssInfo->ucConfigAdHocAPMode].u2BSSBasicRateSet; - - prP2pBssInfo->u2OperationalRateSet = - rNonHTPhyAttributes[prP2pBssInfo->ucNonHTBasicPhyType].u2SupportedRateSet; - - rateGetDataRatesFromRateSet(prP2pBssInfo->u2OperationalRateSet, - prP2pBssInfo->u2BSSBasicRateSet, - prP2pBssInfo->aucAllSupportedRates, - &prP2pBssInfo->ucAllSupportedRatesLen); - - prP2pBssInfo->prBeacon = cnmMgtPktAlloc(prAdapter, - OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH); - - if (prP2pBssInfo->prBeacon) { - prP2pBssInfo->prBeacon->eSrc = TX_PACKET_MGMT; - prP2pBssInfo->prBeacon->ucStaRecIndex = 0xFF; /* NULL STA_REC */ - prP2pBssInfo->prBeacon->ucNetworkType = NETWORK_TYPE_P2P_INDEX; - } - else { - /* Out of memory. */ - ASSERT(FALSE); - } - - prP2pBssInfo->eCurrentOPMode = OP_MODE_NUM; - - prP2pBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = PM_UAPSD_ALL; - prP2pBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = PM_UAPSD_ALL; - prP2pBssInfo->rPmProfSetupInfo.ucUapsdSp = WMM_MAX_SP_LENGTH_2; - prP2pBssInfo->ucPrimaryChannel = P2P_DEFAULT_LISTEN_CHANNEL; - prP2pBssInfo->eBand = BAND_2G4; - prP2pBssInfo->eBssSCO = CHNL_EXT_SCN; - - if (prAdapter->rWifiVar.fgSupportQoS) { - prP2pBssInfo->fgIsQBSS = TRUE; - } - else { - prP2pBssInfo->fgIsQBSS = FALSE; - } - - SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX); - - p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); - - } while (FALSE); - - return; -} /* p2pFsmInit */ - - - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief The function is used to uninitialize the value in P2P_FSM_INFO_T for -* P2P FSM operation -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFsmUninit ( - IN P_ADAPTER_T prAdapter - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - - do { - ASSERT_BREAK(prAdapter != NULL); - - DEBUGFUNC("p2pFsmUninit()"); - DBGLOG(P2P, INFO, ("->p2pFsmUninit()\n")); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - p2pFuncSwitchOPMode(prAdapter, prP2pBssInfo, OP_MODE_P2P_DEVICE, TRUE); - - p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo); - - p2pStateAbort_IDLE(prAdapter, prP2pFsmInfo, P2P_STATE_NUM); - - UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); - - wlanAcquirePowerControl(prAdapter); - - /* Release all pending CMD queue. */ - DBGLOG(P2P, TRACE, ("p2pFsmUninit: wlanProcessCommandQueue, num of element:%d\n", prAdapter->prGlueInfo->rCmdQueue.u4NumElem)); - wlanProcessCommandQueue(prAdapter, &prAdapter->prGlueInfo->rCmdQueue); - - wlanReleasePowerControl(prAdapter); - - /* Release pending mgmt frame, - * mgmt frame may be pending by CMD without resource. - */ - kalClearMgmtFramesByNetType(prAdapter->prGlueInfo, NETWORK_TYPE_P2P_INDEX); - - /* Clear PendingCmdQue*/ - wlanReleasePendingCMDbyNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); - - if (prP2pBssInfo->prBeacon) { - cnmMgtPktFree(prAdapter, prP2pBssInfo->prBeacon); - prP2pBssInfo->prBeacon = NULL; - } - - } while (FALSE); - - return; - -} /* end of p2pFsmUninit() */ - -VOID -p2pFsmStateTransition ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN ENUM_P2P_STATE_T eNextState - ) -{ - BOOLEAN fgIsTransOut = (BOOLEAN)FALSE; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL)); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; - - if (!IS_BSS_ACTIVE(prP2pBssInfo)) { - if (!cnmP2PIsPermitted(prAdapter)) { - return; - } - - SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); - nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); - } - - fgIsTransOut = fgIsTransOut?FALSE:TRUE; - - if (!fgIsTransOut) { - DBGLOG(P2P, STATE, ("TRANSITION: [%s] -> [%s]\n", - apucDebugP2pState[prP2pFsmInfo->eCurrentState], - apucDebugP2pState[eNextState])); - - /* Transition into current state. */ - prP2pFsmInfo->ePreviousState = prP2pFsmInfo->eCurrentState; - prP2pFsmInfo->eCurrentState = eNextState; - } - - - switch (prP2pFsmInfo->eCurrentState) { - case P2P_STATE_IDLE: - if (fgIsTransOut) { - - p2pStateAbort_IDLE(prAdapter, - prP2pFsmInfo, - eNextState); - } - else { - fgIsTransOut = p2pStateInit_IDLE(prAdapter, - prP2pFsmInfo, - prP2pBssInfo, - &eNextState); - } - - break; - case P2P_STATE_SCAN: - if (fgIsTransOut) { - - // Scan done / scan canceled. - p2pStateAbort_SCAN(prAdapter, prP2pFsmInfo, eNextState); - } - else { - // Initial scan request. - p2pStateInit_SCAN(prAdapter, prP2pFsmInfo); - } - - break; - case P2P_STATE_AP_CHANNEL_DETECT: - if (fgIsTransOut) { - // Scan done - // Get sparse channel result. - p2pStateAbort_AP_CHANNEL_DETECT(prAdapter, - prP2pFsmInfo, - prP2pSpecificBssInfo, - eNextState); - } - - else { - // Initial passive scan request. - p2pStateInit_AP_CHANNEL_DETECT(prAdapter, prP2pFsmInfo); - } - - break; - case P2P_STATE_REQING_CHANNEL: - if (fgIsTransOut) { - - // Channel on hand / Channel canceled. - p2pStateAbort_REQING_CHANNEL(prAdapter, prP2pFsmInfo, eNextState); - } - else { - // Initial channel request. - p2pFuncAcquireCh(prAdapter, &(prP2pFsmInfo->rChnlReqInfo)); - } - - break; - case P2P_STATE_CHNL_ON_HAND: - if (fgIsTransOut) { - p2pStateAbort_CHNL_ON_HAND(prAdapter, prP2pFsmInfo, prP2pBssInfo, eNextState); - } - else { - // Initial channel ready. - // Send channel ready event. - // Start a FSM timer. - p2pStateInit_CHNL_ON_HAND(prAdapter, prP2pBssInfo, prP2pFsmInfo); - } - - break; - case P2P_STATE_GC_JOIN: - if (fgIsTransOut) { - - // Join complete / join canceled. - p2pStateAbort_GC_JOIN(prAdapter, - prP2pFsmInfo, - &(prP2pFsmInfo->rJoinInfo), - eNextState); - } - else { - ASSERT(prP2pFsmInfo->prTargetBss != NULL); - - // Send request to SAA module. - p2pStateInit_GC_JOIN(prAdapter, - prP2pFsmInfo, - prP2pBssInfo, - &(prP2pFsmInfo->rJoinInfo), - prP2pFsmInfo->prTargetBss); - } - - break; - default: - break; - } - - } while (fgIsTransOut); - -} /* p2pFsmStateTransition */ - - -VOID -p2pFsmRunEventSwitchOPMode ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - P_MSG_P2P_SWITCH_OP_MODE_T prSwitchOpMode = (P_MSG_P2P_SWITCH_OP_MODE_T)prMsgHdr; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prSwitchOpMode != NULL)); - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventSwitchOPMode\n")); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - - if (prSwitchOpMode->eOpMode >= OP_MODE_NUM) { - ASSERT(FALSE); - break; - } - - /* P2P Device / GC. */ - p2pFuncSwitchOPMode(prAdapter, - prP2pBssInfo, - prSwitchOpMode->eOpMode, - TRUE); - - } while (FALSE); - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - -} /* p2pFsmRunEventSwitchOPMode */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is used to handle scan done event during Device Discovery. -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFsmRunEventScanDone ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL; - P_MSG_SCN_SCAN_DONE prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)NULL; - ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); - - - /* This scan done event is either for "SCAN" phase or "SEARCH" state or "LISTEN" state. - * The scan done for SCAN phase & SEARCH state doesn't imply Device - * Discovery over. - */ - DBGLOG(P2P, TRACE, ("P2P Scan Done Event\n")); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo == NULL) { - break; - } - - - prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo); - prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)prMsgHdr; - - if (prScanDoneMsg->ucSeqNum != prScanReqInfo->ucSeqNumOfScnMsg) { - /* Scan Done message sequence number mismatch. - * Ignore this event. (P2P FSM issue two scan events.) - */ - /* The scan request has been cancelled. - * Ignore this message. It is possible. - */ - DBGLOG(P2P, TRACE, ("P2P Scan Don SeqNum:%d <-> P2P Fsm SCAN Msg:%d\n", - prScanDoneMsg->ucSeqNum, - prScanReqInfo->ucSeqNumOfScnMsg)); - - break; - } - - - switch (prP2pFsmInfo->eCurrentState) { - case P2P_STATE_SCAN: - { - P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo); - - prScanReqInfo->fgIsAbort = FALSE; - - if (prConnReqInfo->fgIsConnRequest) { - - if ((prP2pFsmInfo->prTargetBss = p2pFuncKeepOnConnection(prAdapter, - &prP2pFsmInfo->rConnReqInfo, - &prP2pFsmInfo->rChnlReqInfo, - &prP2pFsmInfo->rScanReqInfo)) == NULL) { - eNextState = P2P_STATE_SCAN; - } - else { - eNextState = P2P_STATE_REQING_CHANNEL; - } - - } - else { - eNextState = P2P_STATE_IDLE; - } - - } - break; - case P2P_STATE_AP_CHANNEL_DETECT: - eNextState = P2P_STATE_REQING_CHANNEL; - break; - default: - /* Unexpected channel scan done event without being chanceled. */ - ASSERT(FALSE); - break; - } - - prScanReqInfo->fgIsScanRequest = FALSE; - - p2pFsmStateTransition(prAdapter, - prP2pFsmInfo, - eNextState); - - } while (FALSE); - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - return; -} /* p2pFsmRunEventScanDone */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is call when channel is granted by CNM module from FW. -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFsmRunEventChGrant ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL; - P_MSG_CH_GRANT_T prMsgChGrant = (P_MSG_CH_GRANT_T)NULL; - UINT_8 ucTokenID = 0; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); - - DBGLOG(P2P, TRACE, ("P2P Run Event Channel Grant\n")); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo == NULL) { - break; - } - - prMsgChGrant = (P_MSG_CH_GRANT_T)prMsgHdr; - ucTokenID = prMsgChGrant->ucTokenID; - prP2pFsmInfo->u4GrantInterval = prMsgChGrant->u4GrantInterval; - - prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo); - - if (ucTokenID == prChnlReqInfo->ucSeqNumOfChReq) { - ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM; - - switch (prP2pFsmInfo->eCurrentState) { - case P2P_STATE_REQING_CHANNEL: - switch (prChnlReqInfo->eChannelReqType) { - case CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL: - eNextState = P2P_STATE_CHNL_ON_HAND; - break; - case CHANNEL_REQ_TYPE_GC_JOIN_REQ: - eNextState = P2P_STATE_GC_JOIN; - break; - case CHANNEL_REQ_TYPE_GO_START_BSS: - eNextState = P2P_STATE_IDLE; - break; - default: - break; - } - - p2pFsmStateTransition(prAdapter, - prP2pFsmInfo, - eNextState); - break; - default: - /* Channel is granted under unexpected state. - * Driver should cancel channel privileagea before leaving the states. - */ - ASSERT(FALSE); - break; - } - - } - else { - /* Channel requsted, but released. */ - ASSERT(!prChnlReqInfo->fgIsChannelRequested); - } - } while (FALSE); - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - return; - -} /* p2pFsmRunEventChGrant */ - - -VOID -p2pFsmRunEventChannelRequest ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL; - P_MSG_P2P_CHNL_REQUEST_T prP2pChnlReqMsg = (P_MSG_P2P_CHNL_REQUEST_T)NULL; - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - ENUM_P2P_STATE_T eNextState = P2P_STATE_NUM; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); - - prP2pChnlReqMsg = (P_MSG_P2P_CHNL_REQUEST_T)prMsgHdr; - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo == NULL) { - break; - } - - prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo); - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventChannelRequest\n")); - - /* Special case of time renewing for same frequency. */ - if ((prP2pFsmInfo->eCurrentState == P2P_STATE_CHNL_ON_HAND) && - (prChnlReqInfo->ucReqChnlNum == prP2pChnlReqMsg->rChannelInfo.ucChannelNum) && - (prChnlReqInfo->eBand == prP2pChnlReqMsg->rChannelInfo.eBand) && - (prChnlReqInfo->eChnlSco == prP2pChnlReqMsg->eChnlSco)) { - - ASSERT(prChnlReqInfo->fgIsChannelRequested == TRUE); - ASSERT(prChnlReqInfo->eChannelReqType == CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL); - - prChnlReqInfo->u8Cookie = prP2pChnlReqMsg->u8Cookie; - prChnlReqInfo->u4MaxInterval = prP2pChnlReqMsg->u4Duration; - - /* Re-enter the state. */ - eNextState = P2P_STATE_CHNL_ON_HAND; - } - else { - - // Make sure the state is in IDLE state. - p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo); - - prChnlReqInfo->u8Cookie = prP2pChnlReqMsg->u8Cookie; /* Cookie can only be assign after abort.(for indication) */ - prChnlReqInfo->ucReqChnlNum = prP2pChnlReqMsg->rChannelInfo.ucChannelNum; - prChnlReqInfo->eBand = prP2pChnlReqMsg->rChannelInfo.eBand; - prChnlReqInfo->eChnlSco = prP2pChnlReqMsg->eChnlSco; - prChnlReqInfo->u4MaxInterval = prP2pChnlReqMsg->u4Duration; - prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_REMAIN_ON_CHANNEL; - - eNextState = P2P_STATE_REQING_CHANNEL; - } - - p2pFsmStateTransition(prAdapter, prP2pFsmInfo, eNextState); - - } while (FALSE); - - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - return; -} /* p2pFsmRunEventChannelRequest */ - - -VOID -p2pFsmRunEventChannelAbort ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_MSG_P2P_CHNL_ABORT_T prChnlAbortMsg = (P_MSG_P2P_CHNL_ABORT_T)NULL; - P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); - - prChnlAbortMsg = (P_MSG_P2P_CHNL_ABORT_T)prMsgHdr; - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo == NULL) { - break; - } - - prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo; - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventChannelAbort\n")); - - if ((prChnlAbortMsg->u8Cookie == prChnlReqInfo->u8Cookie) && - (prChnlReqInfo->fgIsChannelRequested)) { - - ASSERT((prP2pFsmInfo->eCurrentState == P2P_STATE_REQING_CHANNEL || - (prP2pFsmInfo->eCurrentState == P2P_STATE_CHNL_ON_HAND))); - - p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); - } - - } while (FALSE); - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - return; -} /* p2pFsmRunEventChannelAbort */ - - - -VOID -p2pFsmRunEventScanRequest ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_MSG_P2P_SCAN_REQUEST_T prP2pScanReqMsg = (P_MSG_P2P_SCAN_REQUEST_T)NULL; - P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL; - UINT_32 u4ChnlListSize = 0; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo == NULL) { - break; - } - - prP2pScanReqMsg = (P_MSG_P2P_SCAN_REQUEST_T)prMsgHdr; - prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo); - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventScanRequest\n")); - - // Make sure the state is in IDLE state. - p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo); - - ASSERT(prScanReqInfo->fgIsScanRequest == FALSE); - - prScanReqInfo->fgIsAbort = TRUE; - prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN; - prScanReqInfo->eChannelSet = SCAN_CHANNEL_SPECIFIED; - - // Channel List - prScanReqInfo->ucNumChannelList = prP2pScanReqMsg->u4NumChannel; - DBGLOG(P2P, TRACE, ("Scan Request Channel List Number: %d\n", prScanReqInfo->ucNumChannelList)); - if (prScanReqInfo->ucNumChannelList > MAXIMUM_OPERATION_CHANNEL_LIST) { - DBGLOG(P2P, TRACE, ("Channel List Number Overloaded: %d, change to: %d\n", - prScanReqInfo->ucNumChannelList, - MAXIMUM_OPERATION_CHANNEL_LIST)); - prScanReqInfo->ucNumChannelList = MAXIMUM_OPERATION_CHANNEL_LIST; - } - - u4ChnlListSize = sizeof(RF_CHANNEL_INFO_T) * prScanReqInfo->ucNumChannelList; - kalMemCopy(prScanReqInfo->arScanChannelList, prP2pScanReqMsg->arChannelListInfo, u4ChnlListSize); - - // TODO: I only take the first SSID. Multiple SSID may be needed in the future. - // SSID - if (prP2pScanReqMsg->i4SsidNum >= 1) { - - kalMemCopy(&(prScanReqInfo->rSsidStruct), - prP2pScanReqMsg->prSSID, - sizeof(P2P_SSID_STRUCT_T)); - } - else { - prScanReqInfo->rSsidStruct.ucSsidLen = 0; - } - - // IE Buffer - kalMemCopy(prScanReqInfo->aucIEBuf, - prP2pScanReqMsg->pucIEBuf, - prP2pScanReqMsg->u4IELen); - - prScanReqInfo->u4BufLength = prP2pScanReqMsg->u4IELen; - - p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN); - - - - } while (FALSE); - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - -} /* p2pFsmRunEventScanRequest */ - - -VOID -p2pFsmRunEventScanAbort ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - - do { - ASSERT_BREAK(prAdapter != NULL); - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventScanAbort\n")); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo->eCurrentState == P2P_STATE_SCAN) { - P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo); - - prScanReqInfo->fgIsAbort = TRUE; - - p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); - } - - } while (FALSE); - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - return; -} /* p2pFsmRunEventScanAbort */ - - - - - -VOID -p2pFsmRunEventAbort ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo - ) -{ - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - do { - ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL)); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventAbort\n")); - - if (prP2pFsmInfo->eCurrentState != P2P_STATE_IDLE) { - - if (prP2pFsmInfo->eCurrentState == P2P_STATE_SCAN) { - - P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo); - - prScanReqInfo->fgIsAbort = TRUE; - } - else if (prP2pFsmInfo->eCurrentState == P2P_STATE_REQING_CHANNEL) { - /* 2012/08/06: frog - * Prevent Start GO. - */ - prP2pBssInfo->eIntendOPMode = OP_MODE_NUM; - } - - // For other state, is there any special action that should be take before leaving? - - p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); - } - else { - /* P2P State IDLE. */ - P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo); - - if (prChnlReqInfo->fgIsChannelRequested) { - p2pFuncReleaseCh(prAdapter, prChnlReqInfo); - } - - cnmTimerStopTimer(prAdapter, &(prP2pFsmInfo->rP2pFsmTimeoutTimer)); - } - - - } while (FALSE); - - return; -} /* p2pFsmRunEventAbort */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is used to handle FSM Timeout. -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFsmRunEventFsmTimeout ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Param - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)u4Param; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL)); - - DBGLOG(P2P, TRACE, ("P2P FSM Timeout Event\n")); - - switch (prP2pFsmInfo->eCurrentState) { - case P2P_STATE_IDLE: - { - P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo; - if (prChnlReqInfo->fgIsChannelRequested) { - p2pFuncReleaseCh(prAdapter, prChnlReqInfo); - } - else if (IS_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX)) { - UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); - nicDeactivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); - } - - } - break; - -// case P2P_STATE_SCAN: -// break; -// case P2P_STATE_AP_CHANNEL_DETECT: -// break; -// case P2P_STATE_REQING_CHANNEL: -// break; - case P2P_STATE_CHNL_ON_HAND: - { - p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); - } - break; -// case P2P_STATE_GC_JOIN: -// break; - default: - break; - } - - } while (FALSE); - - return; -} /* p2pFsmRunEventFsmTimeout */ - -VOID -p2pFsmRunEventMgmtFrameTx ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_MSG_P2P_MGMT_TX_REQUEST_T prMgmtTxMsg = (P_MSG_P2P_MGMT_TX_REQUEST_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventMgmtFrameTx\n")); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo == NULL) { - break; - } - - prMgmtTxMsg = (P_MSG_P2P_MGMT_TX_REQUEST_T)prMsgHdr; - - p2pFuncTxMgmtFrame(prAdapter, - &prP2pFsmInfo->rMgmtTxInfo, - prMgmtTxMsg->prMgmtMsduInfo, - prMgmtTxMsg->u8Cookie); - - - - } while (FALSE); - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - return; - -} /* p2pFsmRunEventMgmtTx */ - - -VOID -p2pFsmRunEventStartAP ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - P_MSG_P2P_START_AP_T prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)NULL; - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventStartAP\n")); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo == NULL) { - break; - } - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)prMsgHdr; - prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; - - - if (prP2pStartAPMsg->u4BcnInterval) { - DBGLOG(P2P, TRACE, ("Beacon interval updated to :%ld \n", prP2pStartAPMsg->u4BcnInterval)); - prP2pBssInfo->u2BeaconInterval = (UINT_16)prP2pStartAPMsg->u4BcnInterval; - } - else if (prP2pBssInfo->u2BeaconInterval == 0) { - prP2pBssInfo->u2BeaconInterval = DOT11_BEACON_PERIOD_DEFAULT; - } - - if (prP2pStartAPMsg->u4DtimPeriod) { - DBGLOG(P2P, TRACE, ("DTIM interval updated to :%ld \n", prP2pStartAPMsg->u4DtimPeriod)); - prP2pBssInfo->ucDTIMPeriod = (UINT_8)prP2pStartAPMsg->u4DtimPeriod; - } - else if (prP2pBssInfo->ucDTIMPeriod == 0) { - prP2pBssInfo->ucDTIMPeriod = DOT11_DTIM_PERIOD_DEFAULT; - } - - if (prP2pStartAPMsg->u2SsidLen != 0) { - kalMemCopy(prP2pBssInfo->aucSSID, prP2pStartAPMsg->aucSsid, prP2pStartAPMsg->u2SsidLen); - kalMemCopy(prP2pSpecificBssInfo->aucGroupSsid, prP2pStartAPMsg->aucSsid, prP2pStartAPMsg->u2SsidLen); - prP2pBssInfo->ucSSIDLen = prP2pSpecificBssInfo->u2GroupSsidLen = prP2pStartAPMsg->u2SsidLen; - } - - - prP2pBssInfo->eHiddenSsidType = prP2pStartAPMsg->ucHiddenSsidType; - - - // TODO: JB - /* Privacy & inactive timeout. */ - - if ((prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) || - (prP2pBssInfo->eIntendOPMode != OP_MODE_NUM)) { - UINT_8 ucPreferedChnl = 0; - ENUM_BAND_T eBand = BAND_NULL; - ENUM_CHNL_EXT_T eSco = CHNL_EXT_SCN; - ENUM_P2P_STATE_T eNextState = P2P_STATE_SCAN; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - - - if(prP2pFsmInfo->eCurrentState != P2P_STATE_SCAN && - prP2pFsmInfo->eCurrentState != P2P_STATE_IDLE) { - // Make sure the state is in IDLE state. - p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo); - } - - // 20120118: Moved to p2pFuncSwitchOPMode(). - //SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); - - /* Leave IDLE state. */ - SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); - - // sync with firmware - //DBGLOG(P2P, INFO, ("Activate P2P Network. \n")); - //nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); - - - /* Key to trigger P2P FSM to allocate channel for AP mode. */ - prP2pBssInfo->eIntendOPMode = OP_MODE_ACCESS_POINT; - - /* Sparse Channel to decide which channel to use. */ - if ((cnmPreferredChannel(prAdapter, - &eBand, - &ucPreferedChnl, - &eSco) == FALSE) && (prP2pConnSettings->ucOperatingChnl == 0)) { - // Sparse Channel Detection using passive mode. - eNextState = P2P_STATE_AP_CHANNEL_DETECT; - } - else { - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; - P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo; - - -#if 1 - /* 2012-01-27: frog - Channel set from upper layer is the first priority. */ - /* Becuase the channel & beacon is decided by p2p_supplicant. */ - if (prP2pConnSettings->ucOperatingChnl != 0) { - prP2pSpecificBssInfo->ucPreferredChannel = prP2pConnSettings->ucOperatingChnl; - prP2pSpecificBssInfo->eRfBand = prP2pConnSettings->eBand; - } - - else { - ASSERT(ucPreferedChnl != 0); - prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl; - prP2pSpecificBssInfo->eRfBand = eBand; - } -#else - if (ucPreferedChnl) { - prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl; - prP2pSpecificBssInfo->eRfBand = eBand; - } - else { - ASSERT(prP2pConnSettings->ucOperatingChnl != 0); - prP2pSpecificBssInfo->ucPreferredChannel = prP2pConnSettings->ucOperatingChnl; - prP2pSpecificBssInfo->eRfBand = prP2pConnSettings->eBand; - } - -#endif - prChnlReqInfo->ucReqChnlNum = prP2pSpecificBssInfo->ucPreferredChannel; - prChnlReqInfo->eBand = prP2pSpecificBssInfo->eRfBand; - prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GO_START_BSS; - } - - /* If channel is specified, use active scan to shorten the scan time. */ - p2pFsmStateTransition(prAdapter, - prAdapter->rWifiVar.prP2pFsmInfo, - eNextState); - } - - - - } while (FALSE); - - - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - return; -} /* p2pFsmRunEventStartAP */ - -VOID -p2pFsmRunEventNetDeviceRegister ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_P2P_NETDEV_REGISTER_T prNetDevRegisterMsg = (P_MSG_P2P_NETDEV_REGISTER_T)NULL; - - - do { - - ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventNetDeviceRegister\n")); - - prNetDevRegisterMsg = (P_MSG_P2P_NETDEV_REGISTER_T)prMsgHdr; - - if (prNetDevRegisterMsg->fgIsEnable) { - p2pSetMode((prNetDevRegisterMsg->ucMode == 1)?TRUE:FALSE); - - if (p2pLaunch(prAdapter->prGlueInfo)) { - ASSERT(prAdapter->fgIsP2PRegistered); - } - - } - else { - if (prAdapter->fgIsP2PRegistered) { - p2pRemove(prAdapter->prGlueInfo); - } - - } - } while (FALSE); - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - return; -} /* p2pFsmRunEventNetDeviceRegister */ - - -VOID -p2pFsmRunEventUpdateMgmtFrame ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_P2P_MGMT_FRAME_UPDATE_T prP2pMgmtFrameUpdateMsg = (P_MSG_P2P_MGMT_FRAME_UPDATE_T)NULL; - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventUpdateMgmtFrame\n")); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo == NULL) { - break; - } - - prP2pMgmtFrameUpdateMsg = (P_MSG_P2P_MGMT_FRAME_UPDATE_T)prMsgHdr; - - switch (prP2pMgmtFrameUpdateMsg->eBufferType) { - case ENUM_FRAME_TYPE_EXTRA_IE_BEACON: - break; - case ENUM_FRAME_TYPE_EXTRA_IE_ASSOC_RSP: - break; - case ENUM_FRAME_TYPE_EXTRA_IE_PROBE_RSP: - break; - case ENUM_FRAME_TYPE_PROBE_RSP_TEMPLATE: - break; - case ENUM_FRAME_TYPE_BEACON_TEMPLATE: - break; - default: - break; - } - - } while (FALSE); - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - return; -} /* p2pFsmRunEventUpdateMgmtFrame */ - - -VOID -p2pFsmRunEventBeaconUpdate ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - P_MSG_P2P_BEACON_UPDATE_T prBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconUpdate\n")); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo == NULL) { - break; - } - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - prBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)prMsgHdr; - - - p2pFuncBeaconUpdate(prAdapter, - prP2pBssInfo, - &prP2pFsmInfo->rBcnContentInfo, - prBcnUpdateMsg->pucBcnHdr, - prBcnUpdateMsg->u4BcnHdrLen, - prBcnUpdateMsg->pucBcnBody, - prBcnUpdateMsg->u4BcnBodyLen); - - if ((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) && - (prP2pBssInfo->eIntendOPMode == OP_MODE_NUM)) { - /* AP is created, Beacon Update. */ - //nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX); - - bssUpdateBeaconContent(prAdapter, NETWORK_TYPE_P2P_INDEX); - - //nicPmIndicateBssCreated(prAdapter, NETWORK_TYPE_P2P_INDEX); - } - - - - } while (FALSE); - - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - -} /* p2pFsmRunEventBeaconUpdate */ - - -VOID -p2pFsmRunEventStopAP ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL)); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventStopAP\n")); - - if ((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) - && (prP2pBssInfo->eIntendOPMode == OP_MODE_NUM)) { - /* AP is created, Beacon Update. */ - - p2pFuncDissolve(prAdapter, prP2pBssInfo, TRUE, REASON_CODE_DEAUTH_LEAVING_BSS); - - DBGLOG(P2P, TRACE, ("Stop Beaconing\n")); - nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX); - - /* Reset RLM related field of BSSINFO. */ - rlmBssAborted(prAdapter, prP2pBssInfo); - } - - - - // 20120118: Moved to p2pFuncSwitchOPMode(). - //UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); - - /* Enter IDLE state. */ - SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX); - - DBGLOG(P2P, INFO, ("Re activate P2P Network. \n")); - nicDeactivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); - - nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); - - p2pFsmRunEventAbort(prAdapter, prAdapter->rWifiVar.prP2pFsmInfo); -// p2pFsmStateTransition(prAdapter, prAdapter->rWifiVar.prP2pFsmInfo, P2P_STATE_IDLE); - - } while (FALSE); - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - -} /* p2pFsmRunEventStopAP */ - -VOID -p2pFsmRunEventConnectionRequest ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL; - P_MSG_P2P_CONNECTION_REQUEST_T prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)NULL; - P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = (P_P2P_CONNECTION_REQ_INFO_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo == NULL) { - break; - } - - prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)prMsgHdr; - - prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo); - prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo); - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventConnectionRequest\n")); - - if (prP2pBssInfo->eCurrentOPMode != OP_MODE_INFRASTRUCTURE) { - break; - } - - SET_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); - - - // Make sure the state is in IDLE state. - p2pFsmRunEventAbort(prAdapter, prP2pFsmInfo); - - // Update connection request information. - prConnReqInfo->fgIsConnRequest = TRUE; - COPY_MAC_ADDR(prConnReqInfo->aucBssid, prConnReqMsg->aucBssid); - kalMemCopy(&(prConnReqInfo->rSsidStruct), &(prConnReqMsg->rSsid), sizeof(P2P_SSID_STRUCT_T)); - kalMemCopy(prConnReqInfo->aucIEBuf, prConnReqMsg->aucIEBuf, prConnReqMsg->u4IELen); - prConnReqInfo->u4BufLength = prConnReqMsg->u4IELen; - - /* Find BSS Descriptor first. */ - prP2pFsmInfo->prTargetBss = scanP2pSearchDesc(prAdapter, - prP2pBssInfo, - prConnReqInfo); - - if (prP2pFsmInfo->prTargetBss == NULL) { - /* Update scan parameter... to scan target device. */ - P_P2P_SCAN_REQ_INFO_T prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo); - - prScanReqInfo->ucNumChannelList = 1; - prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN; - prScanReqInfo->eChannelSet = SCAN_CHANNEL_SPECIFIED; - prScanReqInfo->arScanChannelList[0].ucChannelNum = prConnReqMsg->rChannelInfo.ucChannelNum; - kalMemCopy(&(prScanReqInfo->rSsidStruct), &(prConnReqMsg->rSsid), sizeof(P2P_SSID_STRUCT_T)); - prScanReqInfo->u4BufLength = 0; /* Prevent other P2P ID in IE. */ - prScanReqInfo->fgIsAbort = TRUE; - - p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_SCAN); - } - else { - prChnlReqInfo->u8Cookie = 0; - prChnlReqInfo->ucReqChnlNum = prConnReqMsg->rChannelInfo.ucChannelNum; - prChnlReqInfo->eBand = prConnReqMsg->rChannelInfo.eBand; - prChnlReqInfo->eChnlSco = prConnReqMsg->eChnlSco; - prChnlReqInfo->u4MaxInterval = AIS_JOIN_CH_REQUEST_INTERVAL; - prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GC_JOIN_REQ; - - p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_REQING_CHANNEL); - } - - - } while (FALSE); - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - return; - -} /* p2pFsmRunEventConnectionRequest */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is used to handle Connection Request from Supplicant. -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFsmRunEventConnectionAbort ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - P_MSG_P2P_CONNECTION_ABORT_T prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)NULL; - //P_STA_RECORD_T prTargetStaRec = (P_STA_RECORD_T)NULL; - - do { - - ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventConnectionAbort: Connection Abort.\n")); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo == NULL) { - break; - } - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)prMsgHdr; - - switch (prP2pBssInfo->eCurrentOPMode) { - case OP_MODE_INFRASTRUCTURE: - { - UINT_8 aucBCBSSID[] = BC_BSSID; - - if (!prP2pBssInfo->prStaRecOfAP) { - DBGLOG(P2P, TRACE, ("GO's StaRec is NULL\n")); - break; - } - if (UNEQUAL_MAC_ADDR(prP2pBssInfo->prStaRecOfAP->aucMacAddr, prDisconnMsg->aucTargetID) && - UNEQUAL_MAC_ADDR(prDisconnMsg->aucTargetID, aucBCBSSID)) { - DBGLOG(P2P, TRACE, ("Unequal MAC ADDR ["MACSTR":"MACSTR"]\n", - MAC2STR(prP2pBssInfo->prStaRecOfAP->aucMacAddr), - MAC2STR(prDisconnMsg->aucTargetID))); - break; - } - - - kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, NULL, NULL, 0, 0); - - /* Stop rejoin timer if it is started. */ - // TODO: If it has. - - p2pFuncDisconnect(prAdapter, prP2pBssInfo->prStaRecOfAP, prDisconnMsg->fgSendDeauth, prDisconnMsg->u2ReasonCode); - - //prTargetStaRec = prP2pBssInfo->prStaRecOfAP; - - /* Fix possible KE when RX Beacon & call nicPmIndicateBssConnected(). hit prStaRecOfAP == NULL. */ - p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED); - - prP2pBssInfo->prStaRecOfAP = NULL; - - SET_NET_PWR_STATE_IDLE(prAdapter, NETWORK_TYPE_P2P_INDEX); - - p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); - - } - break; - case OP_MODE_ACCESS_POINT: - { - P_LINK_T prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList; - /* Search specific client device, and disconnect. */ - /* 1. Send deauthentication frame. */ - /* 2. Indication: Device disconnect. */ - P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL; - P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL; - - DBGLOG(P2P, TRACE, ("Disconnecting with Target ID: "MACSTR"\n", MAC2STR(prDisconnMsg->aucTargetID))); - - LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) { - prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry); - - ASSERT(prCurrStaRec); - - if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prDisconnMsg->aucTargetID)) { - - DBGLOG(P2P, TRACE, ("Disconnecting: "MACSTR"\n", MAC2STR(prCurrStaRec->aucMacAddr))); - - /* Remove STA from client list. */ - LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry); - - /* Glue layer indication. */ - //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prCurrStaRec, FALSE); - - /* Send deauth & do indication. */ - p2pFuncDisconnect(prAdapter, prCurrStaRec, prDisconnMsg->fgSendDeauth, prDisconnMsg->u2ReasonCode); - - //prTargetStaRec = prCurrStaRec; - - break; - } - } - - } - break; - case OP_MODE_P2P_DEVICE: - default: - ASSERT(FALSE); - break; - } - - } while (FALSE); - - //20120830 moved into p2pFuncDisconnect() - //if ((!prDisconnMsg->fgSendDeauth) && (prTargetStaRec)) { - // cnmStaRecFree(prAdapter, prTargetStaRec, TRUE); - //} - - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - return; -} /* p2pFsmRunEventConnectionAbort */ - - -VOID -p2pFsmRunEventDissolve ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - - // TODO: - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventDissolve\n")); - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - return; -} -WLAN_STATUS -p2pFsmRunEventDeauthTxDone ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ) -{ - - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - ENUM_PARAM_MEDIA_STATE_T eOriMediaStatus; - - do { - - ASSERT_BREAK((prAdapter != NULL) && - (prMsduInfo != NULL)); - - DBGLOG(P2P, TRACE, ("Deauth TX Done\n")); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - if (prStaRec == NULL) { - DBGLOG(P2P, TRACE, ("Station Record NULL, Index:%d\n", prMsduInfo->ucStaRecIndex)); - break; - } - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - eOriMediaStatus = prP2pBssInfo->eConnectionState; - - /* Change station state. */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - - /* Reset Station Record Status. */ - p2pFuncResetStaRecStatus(prAdapter, prStaRec); - - /**/ - cnmStaRecFree(prAdapter, prStaRec, TRUE); - - if ((prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) || - (prP2pBssInfo->rStaRecOfClientList.u4NumElem == 0)) { - DBGLOG(P2P, TRACE, ("No More Client, Media Status DISCONNECTED\n")); - p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED); - } - - if (eOriMediaStatus != prP2pBssInfo->eConnectionState) { - /* Update Disconnected state to FW. */ - nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX); - } - - - } while (FALSE); - - return WLAN_STATUS_SUCCESS; -} /* p2pFsmRunEventDeauthTxDone */ - - -WLAN_STATUS -p2pFsmRunEventMgmtFrameTxDone ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_P2P_MGMT_TX_REQ_INFO_T prMgmtTxReqInfo = (P_P2P_MGMT_TX_REQ_INFO_T)NULL; - BOOLEAN fgIsSuccess = FALSE; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL)); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - prMgmtTxReqInfo = &(prP2pFsmInfo->rMgmtTxInfo); - - if (rTxDoneStatus != TX_RESULT_SUCCESS) { - DBGLOG(P2P, TRACE, ("Mgmt Frame TX Fail, Status:%d.\n", rTxDoneStatus)); - } - else { - fgIsSuccess = TRUE; - DBGLOG(P2P, TRACE, ("Mgmt Frame TX Done.\n")); - } - - - if (prMgmtTxReqInfo->prMgmtTxMsdu == prMsduInfo) { - kalP2PIndicateMgmtTxStatus(prAdapter->prGlueInfo, - prMgmtTxReqInfo->u8Cookie, - fgIsSuccess, - prMsduInfo->prPacket, - (UINT_32)prMsduInfo->u2FrameLength); - - prMgmtTxReqInfo->prMgmtTxMsdu = NULL; - } - - } while (FALSE); - - return WLAN_STATUS_SUCCESS; - -} /* p2pFsmRunEventMgmtFrameTxDone */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is called when JOIN complete message event is received from SAA. -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFsmRunEventJoinComplete ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_P2P_JOIN_INFO_T prJoinInfo = (P_P2P_JOIN_INFO_T)NULL; - P_MSG_JOIN_COMP_T prJoinCompMsg = (P_MSG_JOIN_COMP_T)NULL; - P_SW_RFB_T prAssocRspSwRfb = (P_SW_RFB_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); - - DBGLOG(P2P, TRACE, ("P2P Join Complete\n")); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo == NULL) { - break; - } - - - prJoinInfo = &(prP2pFsmInfo->rJoinInfo); - prJoinCompMsg = (P_MSG_JOIN_COMP_T)prMsgHdr; - prAssocRspSwRfb = prJoinCompMsg->prSwRfb; - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - if (prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE) { - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - - prStaRec = prJoinCompMsg->prStaRec; - - /* Check SEQ NUM */ - if (prJoinCompMsg->ucSeqNum == prJoinInfo->ucSeqNumOfReqMsg) { - ASSERT(prStaRec == prJoinInfo->prTargetStaRec); - prJoinInfo->fgIsJoinComplete = TRUE; - - if (prJoinCompMsg->rJoinStatus == WLAN_STATUS_SUCCESS) { - - //4 <1.1> Change FW's Media State immediately. - p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED); - - //4 <1.2> Deactivate previous AP's STA_RECORD_T in Driver if have. - if ((prP2pBssInfo->prStaRecOfAP) && - (prP2pBssInfo->prStaRecOfAP != prStaRec)) { - cnmStaRecChangeState(prAdapter, prP2pBssInfo->prStaRecOfAP, STA_STATE_1); - - cnmStaRecFree(prAdapter, prP2pBssInfo->prStaRecOfAP, TRUE); - - prP2pBssInfo->prStaRecOfAP = NULL; - } - - //4 <1.3> Update BSS_INFO_T - p2pFuncUpdateBssInfoForJOIN(prAdapter, prP2pFsmInfo->prTargetBss, prStaRec, prAssocRspSwRfb); - - //4 <1.4> Activate current AP's STA_RECORD_T in Driver. - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); - -#if CFG_SUPPORT_P2P_RSSI_QUERY - //<1.5> Update RSSI if necessary - nicUpdateRSSI(prAdapter, NETWORK_TYPE_P2P_INDEX, (INT_8)(RCPI_TO_dBm(prStaRec->ucRCPI)), 0); -#endif - - //4 <1.6> Indicate Connected Event to Host immediately. - /* Require BSSID, Association ID, Beacon Interval.. from AIS_BSS_INFO_T */ - //p2pIndicationOfMediaStateToHost(prAdapter, PARAM_MEDIA_STATE_CONNECTED, prStaRec->aucMacAddr); - kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, - &prP2pFsmInfo->rConnReqInfo, - prJoinInfo->aucIEBuf, - prJoinInfo->u4BufLength, - prStaRec->u2StatusCode); - - } - else { - /* Join Fail*/ - //4 <2.1> Redo JOIN process with other Auth Type if possible - if (p2pFuncRetryJOIN(prAdapter, prStaRec, prJoinInfo) == FALSE) { - P_BSS_DESC_T prBssDesc; - - /* Increase Failure Count */ - prStaRec->ucJoinFailureCount++; - - prBssDesc = prP2pFsmInfo->prTargetBss; - - ASSERT(prBssDesc); - ASSERT(prBssDesc->fgIsConnecting); - - prBssDesc->fgIsConnecting = FALSE; - - kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, - &prP2pFsmInfo->rConnReqInfo, - prJoinInfo->aucIEBuf, - prJoinInfo->u4BufLength, - prStaRec->u2StatusCode); - - } - - } - } - } - - if (prAssocRspSwRfb) { - nicRxReturnRFB(prAdapter, prAssocRspSwRfb); - } - - if (prP2pFsmInfo->eCurrentState == P2P_STATE_GC_JOIN) { - /* Return to IDLE state. */ - p2pFsmStateTransition(prAdapter, prP2pFsmInfo, P2P_STATE_IDLE); - } - - } while (FALSE); - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - return; - -} /* p2pFsmRunEventJoinComplete */ - - - -VOID -p2pFsmRunEventMgmtFrameRegister ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_P2P_MGMT_FRAME_REGISTER_T prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)NULL; - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsgHdr != NULL)); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo == NULL) { - break; - } - - prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)prMsgHdr; - - p2pFuncMgmtFrameRegister(prAdapter, - prMgmtFrameRegister->u2FrameType, - prMgmtFrameRegister->fgIsRegister, - &prP2pFsmInfo->u4P2pPacketFilter); - - - } while (FALSE); - - if (prMsgHdr) { - cnmMemFree(prAdapter, prMsgHdr); - } - - return; - -} /* p2pFsmRunEventMgmtFrameRegister */ - - - - -#if 0 -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#endif - - - - - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is call when RX deauthentication frame from the AIR. -* If we are under STA mode, we would go back to P2P Device. -* If we are under AP mode, we would stay in AP mode until disconnect event from HOST. -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFsmRunEventRxDeauthentication ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prSwRfb - ) -{ - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - UINT_16 u2ReasonCode = 0; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL)); - - if (prStaRec == NULL) { - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - } - - if (!prStaRec) { - break; - } - - - prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]; - - if (prStaRec->ucStaState == STA_STATE_1) { - break; - } - - DBGLOG(P2P, TRACE, ("RX Deauth\n")); - - switch (prP2pBssInfo->eCurrentOPMode) { - case OP_MODE_INFRASTRUCTURE: - if (authProcessRxDeauthFrame(prSwRfb, - prStaRec->aucMacAddr, - &u2ReasonCode) == WLAN_STATUS_SUCCESS) { - P_WLAN_DEAUTH_FRAME_T prDeauthFrame = (P_WLAN_DEAUTH_FRAME_T)prSwRfb->pvHeader; - UINT_16 u2IELength = 0; - - if (prP2pBssInfo->prStaRecOfAP != prStaRec) { - break; - } - - - prStaRec->u2ReasonCode = u2ReasonCode; - u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + REASON_CODE_FIELD_LEN); - - ASSERT(prP2pBssInfo->prStaRecOfAP == prStaRec); - - /* Indicate disconnect to Host. */ - kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, - NULL, - prDeauthFrame->aucInfoElem, - u2IELength, - u2ReasonCode); - - prP2pBssInfo->prStaRecOfAP = NULL; - - p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode); - } - break; - case OP_MODE_ACCESS_POINT: - /* Delete client from client list. */ - if (authProcessRxDeauthFrame(prSwRfb, - prP2pBssInfo->aucBSSID, - &u2ReasonCode) == WLAN_STATUS_SUCCESS) { - P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL; - P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL; - P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL; - - prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList; - - LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) { - prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry); - - ASSERT(prCurrStaRec); - - if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prStaRec->aucMacAddr)) { - - /* Remove STA from client list. */ - LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry); - - /* Indicate to Host. */ - //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE); - - /* Indicate disconnect to Host. */ - p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode); - - break; - } - } - } - break; - case OP_MODE_P2P_DEVICE: - default: - /* Findout why someone sent deauthentication frame to us. */ - ASSERT(FALSE); - break; - } - - DBGLOG(P2P, TRACE, ("Deauth Reason:%d\n", u2ReasonCode)); - - } while (FALSE); - - return; -} /* p2pFsmRunEventRxDeauthentication */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is call when RX deauthentication frame from the AIR. -* If we are under STA mode, we would go back to P2P Device. -* If we are under AP mode, we would stay in AP mode until disconnect event from HOST. -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFsmRunEventRxDisassociation ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prSwRfb - ) -{ - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - UINT_16 u2ReasonCode = 0; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL)); - - if (prStaRec == NULL) { - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - } - - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - if (prStaRec->ucStaState == STA_STATE_1) { - - break; - } - - DBGLOG(P2P, TRACE, ("RX Disassoc\n")); - - switch (prP2pBssInfo->eCurrentOPMode) { - case OP_MODE_INFRASTRUCTURE: - if (assocProcessRxDisassocFrame(prAdapter, - prSwRfb, - prStaRec->aucMacAddr, - &prStaRec->u2ReasonCode) == WLAN_STATUS_SUCCESS) { - P_WLAN_DISASSOC_FRAME_T prDisassocFrame = (P_WLAN_DISASSOC_FRAME_T)prSwRfb->pvHeader; - UINT_16 u2IELength = 0; - - ASSERT(prP2pBssInfo->prStaRecOfAP == prStaRec); - - if (prP2pBssInfo->prStaRecOfAP != prStaRec) { - break; - } - - - u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + REASON_CODE_FIELD_LEN); - - /* Indicate disconnect to Host. */ - kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, - NULL, - prDisassocFrame->aucInfoElem, - u2IELength, - prStaRec->u2ReasonCode); - - prP2pBssInfo->prStaRecOfAP = NULL; - - p2pFuncDisconnect(prAdapter, prStaRec, FALSE, prStaRec->u2ReasonCode); - - } - break; - case OP_MODE_ACCESS_POINT: - /* Delete client from client list. */ - if (assocProcessRxDisassocFrame(prAdapter, - prSwRfb, - prP2pBssInfo->aucBSSID, - &u2ReasonCode) == WLAN_STATUS_SUCCESS) { - P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL; - P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL; - P_STA_RECORD_T prCurrStaRec = (P_STA_RECORD_T)NULL; - - prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList; - - LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) { - prCurrStaRec = LINK_ENTRY(prLinkEntry, STA_RECORD_T, rLinkEntry); - - ASSERT(prCurrStaRec); - - if (EQUAL_MAC_ADDR(prCurrStaRec->aucMacAddr, prStaRec->aucMacAddr)) { - - /* Remove STA from client list. */ - LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCurrStaRec->rLinkEntry); - - /* Indicate to Host. */ - //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE); - - /* Indicate disconnect to Host. */ - p2pFuncDisconnect(prAdapter, prStaRec, FALSE, u2ReasonCode); - - break; - } - } - } - break; - case OP_MODE_P2P_DEVICE: - default: - ASSERT(FALSE); - break; - } - - - } while (FALSE); - - return; -} /* p2pFsmRunEventRxDisassociation */ - - - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is called when a probe request frame is received. -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return boolean value if probe response frame is accepted & need cancel scan request. -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFsmRunEventRxProbeResponseFrame ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN P_BSS_DESC_T prBssDesc - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - P_WLAN_MAC_MGMT_HEADER_T prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL) && (prBssDesc != NULL)); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]; - - /* There is a connection request. */ - prMgtHdr = (P_WLAN_MAC_MGMT_HEADER_T)prSwRfb->pvHeader; - - } while (FALSE); - - return; -} /* p2pFsmRunEventRxProbeResponseFrame */ - - - - - - -VOID -p2pFsmRunEventBeaconTimeout ( - IN P_ADAPTER_T prAdapter - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - - do { - ASSERT_BREAK(prAdapter != NULL); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - DBGLOG(P2P, TRACE, ("p2pFsmRunEventBeaconTimeout: Beacon Timeout\n")); - - /* Only client mode would have beacon lost event. */ - ASSERT(prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE); - - if (prP2pBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED) { - /* Indicate disconnect to Host. */ - kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, - NULL, - NULL, - 0, - REASON_CODE_DISASSOC_INACTIVITY); - - if (prP2pBssInfo->prStaRecOfAP != NULL) { - P_STA_RECORD_T prStaRec = prP2pBssInfo->prStaRecOfAP; - - prP2pBssInfo->prStaRecOfAP = NULL; - - p2pFuncDisconnect(prAdapter, prStaRec, FALSE, REASON_CODE_DISASSOC_LEAVING_BSS); - - //20120830 moved into p2pFuncDisconnect() - //cnmStaRecFree(prAdapter, prP2pBssInfo->prStaRecOfAP, TRUE); - - - } - } - } while (FALSE); - - return; -} /* p2pFsmRunEventBeaconTimeout */ - - - - - - - - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to generate P2P IE for Beacon frame. -* -* @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T. -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pGenerateP2P_IEForAssocReq ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL)); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - if (IS_STA_P2P_TYPE(prStaRec)) { - // TODO: - } - - } while (FALSE); - - return; - -} /* end of p2pGenerateP2P_IEForAssocReq() */ - - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to generate P2P IE for Probe Request frame. -* -* @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T. -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pGenerateP2P_IEForProbeReq ( - IN P_ADAPTER_T prAdapter, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ) -{ - ASSERT(prAdapter); - ASSERT(pucBuf); - - // TODO: - - return; - -} /* end of p2pGenerateP2P_IEForProbReq() */ - - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to calculate P2P IE length for Beacon frame. -* -* @param[in] eNetTypeIndex Specify which network -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @return The length of P2P IE added -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -p2pCalculateP2P_IELenForProbeReq ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ) -{ - - if (eNetTypeIndex != NETWORK_TYPE_P2P_INDEX) { - return 0; - } - - // TODO: - - return 0; - -} /* end of p2pCalculateP2P_IELenForProbeReq() */ - - - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indiate the Event of Tx Fail of AAA Module. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pRunEventAAATxFail ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - P_BSS_INFO_T prBssInfo; - - - ASSERT(prAdapter); - ASSERT(prStaRec); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - - bssRemoveStaRecFromClientList(prAdapter, prBssInfo, prStaRec); - - p2pFuncDisconnect(prAdapter, prStaRec, FALSE, REASON_CODE_UNSPECIFIED); - - - //20120830 moved into p2puUncDisconnect. - //cnmStaRecFree(prAdapter, prStaRec, TRUE); - - return; -} /* p2pRunEventAAATxFail */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indiate the Event of Successful Completion of AAA Module. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -p2pRunEventAAAComplete ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - ENUM_PARAM_MEDIA_STATE_T eOriMediaState; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL)); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - eOriMediaState = prP2pBssInfo->eConnectionState; - - bssRemoveStaRecFromClientList(prAdapter, prP2pBssInfo, prStaRec); - - if (prP2pBssInfo->rStaRecOfClientList.u4NumElem >= P2P_MAXIMUM_CLIENT_COUNT || - kalP2PMaxClients(prAdapter->prGlueInfo, prP2pBssInfo->rStaRecOfClientList.u4NumElem)) { - rStatus = WLAN_STATUS_RESOURCES; - break; - } - - bssAddStaRecToClientList(prAdapter, prP2pBssInfo, prStaRec); - - prStaRec->u2AssocId = bssAssignAssocID(prStaRec); - - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); - - p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_CONNECTED); - - /* Update Connected state to FW. */ - if (eOriMediaState != prP2pBssInfo->eConnectionState) { - nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX); - } - - } while (FALSE); - - return rStatus; -} /* p2pRunEventAAAComplete */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will indiate the Event of Successful Completion of AAA Module. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -p2pRunEventAAASuccess ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL)); - - /* Glue layer indication. */ - kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, TRUE); - - } while (FALSE); - - return rStatus; -} /* p2pRunEventAAASuccess */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -p2pRxPublicActionFrame ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - P_P2P_PUBLIC_ACTION_FRAME_T prPublicActionFrame = (P_P2P_PUBLIC_ACTION_FRAME_T)NULL; - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - - ASSERT(prSwRfb); - ASSERT(prAdapter); - - - - prPublicActionFrame = (P_P2P_PUBLIC_ACTION_FRAME_T)prSwRfb->pvHeader; - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - DBGLOG(P2P, TRACE, ("RX Public Action Frame Token:%d.\n", prPublicActionFrame->ucDialogToken)); - - if (prPublicActionFrame->ucCategory != CATEGORY_PUBLIC_ACTION) { - return rWlanStatus; - } - - switch (prPublicActionFrame->ucAction) { - case ACTION_PUBLIC_WIFI_DIRECT: - break; - case ACTION_GAS_INITIAL_REQUEST: - case ACTION_GAS_INITIAL_RESPONSE: - case ACTION_GAS_COMEBACK_REQUEST: - case ACTION_GAS_COMEBACK_RESPONSE: - break; - default: - break; - } - - return rWlanStatus; -} /* p2pRxPublicActionFrame */ - - - -WLAN_STATUS -p2pRxActionFrame ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - P_P2P_ACTION_FRAME_T prP2pActionFrame = (P_P2P_ACTION_FRAME_T)NULL; - UINT_8 aucOui[3] = VENDOR_OUI_WFA_SPECIFIC; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL)); - - prP2pActionFrame = (P_P2P_ACTION_FRAME_T)prSwRfb->pvHeader; - - if (prP2pActionFrame->ucCategory != CATEGORY_VENDOR_SPECIFIC_ACTION) { - DBGLOG(P2P, TRACE, ("RX Action Frame but not vendor specific.\n")); - break; - } - - - if ((prP2pActionFrame->ucOuiType != VENDOR_OUI_TYPE_P2P) || - (prP2pActionFrame->aucOui[0] != aucOui[0]) || - (prP2pActionFrame->aucOui[1] != aucOui[1]) || - (prP2pActionFrame->aucOui[2] != aucOui[2])) { - DBGLOG(P2P, TRACE, ("RX Vendor Specific Action Frame but not P2P Type or not WFA OUI.\n")); - break; - } - - } while (FALSE); - - return rWlanStatus; -} /* p2pRxActionFrame */ - - -VOID -p2pProcessEvent_UpdateNOAParam ( - IN P_ADAPTER_T prAdapter, - UINT_8 ucNetTypeIndex, - P_EVENT_UPDATE_NOA_PARAMS_T prEventUpdateNoaParam - ) -{ - P_BSS_INFO_T prBssInfo = (P_BSS_INFO_T)NULL; - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo; - UINT_32 i; - BOOLEAN fgNoaAttrExisted = FALSE; - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[ucNetTypeIndex]); - prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; - - prP2pSpecificBssInfo->fgEnableOppPS = prEventUpdateNoaParam->fgEnableOppPS; - prP2pSpecificBssInfo->u2CTWindow = prEventUpdateNoaParam->u2CTWindow; - prP2pSpecificBssInfo->ucNoAIndex = prEventUpdateNoaParam->ucNoAIndex; - prP2pSpecificBssInfo->ucNoATimingCount = prEventUpdateNoaParam->ucNoATimingCount; - - fgNoaAttrExisted |= prP2pSpecificBssInfo->fgEnableOppPS; - - - ASSERT(prP2pSpecificBssInfo->ucNoATimingCount <= P2P_MAXIMUM_NOA_COUNT); - - for (i = 0; i < prP2pSpecificBssInfo->ucNoATimingCount; i++) { - // in used - prP2pSpecificBssInfo->arNoATiming[i].fgIsInUse = - prEventUpdateNoaParam->arEventNoaTiming[i].fgIsInUse; - // count - prP2pSpecificBssInfo->arNoATiming[i].ucCount = - prEventUpdateNoaParam->arEventNoaTiming[i].ucCount; - // duration - prP2pSpecificBssInfo->arNoATiming[i].u4Duration = - prEventUpdateNoaParam->arEventNoaTiming[i].u4Duration; - // interval - prP2pSpecificBssInfo->arNoATiming[i].u4Interval = - prEventUpdateNoaParam->arEventNoaTiming[i].u4Interval; - // start time - prP2pSpecificBssInfo->arNoATiming[i].u4StartTime = - prEventUpdateNoaParam->arEventNoaTiming[i].u4StartTime; - - fgNoaAttrExisted |= prP2pSpecificBssInfo->arNoATiming[i].fgIsInUse; - } - - prP2pSpecificBssInfo->fgIsNoaAttrExisted = fgNoaAttrExisted; - - // update beacon content by the change - bssUpdateBeaconContent(prAdapter, ucNetTypeIndex); -} - -#endif /* CFG_ENABLE_WIFI_DIRECT */ - diff --git a/drivers/net/wireless/mt5931/mgmt/p2p_func.c b/drivers/net/wireless/mt5931/mgmt/p2p_func.c deleted file mode 100755 index 0a61d7591c59..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/p2p_func.c +++ /dev/null @@ -1,3378 +0,0 @@ -#include "precomp.h" - -APPEND_VAR_ATTRI_ENTRY_T txAssocRspAttributesTable[] = { - { (P2P_ATTRI_HDR_LEN + P2P_ATTRI_MAX_LEN_STATUS) , NULL, p2pFuncAppendAttriStatusForAssocRsp } /* 0 */ // Status - ,{ (P2P_ATTRI_HDR_LEN + P2P_ATTRI_MAX_LEN_EXT_LISTEN_TIMING), NULL, p2pFuncAppendAttriExtListenTiming } /* 8 */ -}; - - -APPEND_VAR_IE_ENTRY_T txProbeRspIETable[] = { - { (ELEM_HDR_LEN + (RATE_NUM - ELEM_MAX_LEN_SUP_RATES)), NULL, bssGenerateExtSuppRate_IE } /* 50 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_ERP), NULL, rlmRspGenerateErpIE } /* 42 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_HT_CAP), NULL, rlmRspGenerateHtCapIE } /* 45 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_HT_OP), NULL, rlmRspGenerateHtOpIE } /* 61 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_RSN), NULL, rsnGenerateRSNIE } /* 48 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_OBSS_SCAN), NULL, rlmRspGenerateObssScanIE } /* 74 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_EXT_CAP), NULL, rlmRspGenerateExtCapIE } /* 127 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_WPA), NULL, rsnGenerateWpaNoneIE } /* 221 */ - ,{ (ELEM_HDR_LEN + ELEM_MAX_LEN_WMM_PARAM), NULL, mqmGenerateWmmParamIE } /* 221 */ -}; - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Function for requesting scan. There is an option to do ACTIVE or PASSIVE scan. -* -* @param eScanType - Specify the scan type of the scan request. It can be an ACTIVE/PASSIVE -* Scan. -* eChannelSet - Specify the prefered channel set. -* A FULL scan would request a legacy full channel normal scan.(usually ACTIVE). -* A P2P_SOCIAL scan would scan 1+6+11 channels.(usually ACTIVE) -* A SPECIFIC scan would only 1/6/11 channels scan. (Passive Listen/Specific Search) -* ucChannelNum - A specific channel number. (Only when channel is specified) -* eBand - A specific band. (Only when channel is specified) -* -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFuncRequestScan ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_SCAN_REQ_INFO_T prScanReqInfo - ) -{ - - P_MSG_SCN_SCAN_REQ prScanReq = (P_MSG_SCN_SCAN_REQ)NULL; - - DEBUGFUNC("p2pFuncRequestScan()"); - - do { - ASSERT_BREAK((prAdapter != NULL) && - (prScanReqInfo != NULL)); - - if (prScanReqInfo->eChannelSet == SCAN_CHANNEL_SPECIFIED) { - ASSERT_BREAK(prScanReqInfo->ucNumChannelList > 0); - DBGLOG(P2P, LOUD, ("P2P Scan Request Channel:%d\n", prScanReqInfo->arScanChannelList[0].ucChannelNum)); - } - - prScanReq = (P_MSG_SCN_SCAN_REQ)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_SCN_SCAN_REQ)); - if (!prScanReq) { - ASSERT(0); // Can't trigger SCAN FSM - break; - } - - prScanReq->rMsgHdr.eMsgId = MID_P2P_SCN_SCAN_REQ; - prScanReq->ucSeqNum = ++prScanReqInfo->ucSeqNumOfScnMsg; - prScanReq->ucNetTypeIndex = (UINT_8)NETWORK_TYPE_P2P_INDEX; - prScanReq->eScanType = prScanReqInfo->eScanType; - prScanReq->eScanChannel = prScanReqInfo->eChannelSet; - prScanReq->u2IELen = 0; - - /* Copy IE for Probe Request. */ - kalMemCopy(prScanReq->aucIE, prScanReqInfo->aucIEBuf, prScanReqInfo->u4BufLength); - prScanReq->u2IELen = (UINT_16)prScanReqInfo->u4BufLength; - - prScanReq->u2ChannelDwellTime = prScanReqInfo->u2PassiveDewellTime; - - switch (prScanReqInfo->eChannelSet) { - case SCAN_CHANNEL_SPECIFIED: - { - UINT_32 u4Idx = 0; - P_RF_CHANNEL_INFO_T prDomainInfo = (P_RF_CHANNEL_INFO_T)prScanReqInfo->arScanChannelList; - - if (prScanReqInfo->ucNumChannelList > MAXIMUM_OPERATION_CHANNEL_LIST) { - prScanReqInfo->ucNumChannelList = MAXIMUM_OPERATION_CHANNEL_LIST; - } - - - for (u4Idx = 0; u4Idx < prScanReqInfo->ucNumChannelList; u4Idx++) { - prScanReq->arChnlInfoList[u4Idx].ucChannelNum = prDomainInfo->ucChannelNum; - prScanReq->arChnlInfoList[u4Idx].eBand = prDomainInfo->eBand; - prDomainInfo++; - } - - prScanReq->ucChannelListNum = prScanReqInfo->ucNumChannelList; - } - case SCAN_CHANNEL_FULL: - case SCAN_CHANNEL_2G4: - case SCAN_CHANNEL_P2P_SOCIAL: - { - UINT_8 aucP2pSsid[] = P2P_WILDCARD_SSID; - - COPY_SSID(prScanReq->aucSSID, - prScanReq->ucSSIDLength, - prScanReqInfo->rSsidStruct.aucSsid, - prScanReqInfo->rSsidStruct.ucSsidLen); - - /* For compatible. */ - if (EQUAL_SSID(aucP2pSsid, P2P_WILDCARD_SSID_LEN, prScanReq->aucSSID, prScanReq->ucSSIDLength)) { - prScanReq->ucSSIDType = SCAN_REQ_SSID_P2P_WILDCARD; - } - else if (prScanReq->ucSSIDLength != 0) { - prScanReq->ucSSIDType = SCAN_REQ_SSID_SPECIFIED; - } - } - break; - default: - /* Currently there is no other scan channel set. */ - ASSERT(FALSE); - break; - } - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prScanReq, - MSG_SEND_METHOD_BUF); - - } while (FALSE); - - return; -} /* p2pFuncRequestScan */ - -VOID -p2pFuncCancelScan ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_SCAN_REQ_INFO_T prScanInfo - ) -{ - P_MSG_SCN_SCAN_CANCEL prScanCancelMsg = (P_MSG_SCN_SCAN_CANCEL)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prScanInfo != NULL)); - - if (!prScanInfo->fgIsScanRequest) { - break; - } - - - if (prScanInfo->ucSeqNumOfScnMsg) { - /* There is a channel privilege on hand. */ - DBGLOG(P2P, TRACE, ("P2P Cancel Scan\n")); - - prScanCancelMsg = (P_MSG_SCN_SCAN_CANCEL)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_SCN_SCAN_CANCEL)); - if (!prScanCancelMsg) { - /* Buffer not enough, can not cancel scan request. */ - DBGLOG(P2P, TRACE, ("Buffer not enough, can not cancel scan.\n")); - ASSERT(FALSE); - break; - } - - prScanCancelMsg->rMsgHdr.eMsgId = MID_P2P_SCN_SCAN_CANCEL; - prScanCancelMsg->ucNetTypeIndex = NETWORK_TYPE_P2P_INDEX; - prScanCancelMsg->ucSeqNum = prScanInfo->ucSeqNumOfScnMsg++; - prScanCancelMsg->fgIsChannelExt = FALSE; - prScanInfo->fgIsScanRequest = FALSE; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prScanCancelMsg, - MSG_SEND_METHOD_BUF); - - - } - - - } while (FALSE); - - return; -} /* p2pFuncCancelScan */ - - -VOID -p2pFuncSwitchOPMode ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prP2pBssInfo, - IN ENUM_OP_MODE_T eOpMode, - IN BOOLEAN fgSyncToFW - ) -{ - do { - ASSERT_BREAK((prAdapter != NULL) && - (prP2pBssInfo != NULL) && - (eOpMode < OP_MODE_NUM)); - - if (prP2pBssInfo->eCurrentOPMode != eOpMode) { - DBGLOG(P2P, TRACE, ("p2pFuncSwitchOPMode: Switch to from %d, to %d.\n", prP2pBssInfo->eCurrentOPMode, eOpMode)); - - switch (prP2pBssInfo->eCurrentOPMode) { - case OP_MODE_ACCESS_POINT: - p2pFuncDissolve(prAdapter, prP2pBssInfo, TRUE, REASON_CODE_DEAUTH_LEAVING_BSS); - - p2pFsmRunEventStopAP(prAdapter, NULL); - break; - default: - break; - } - - - prP2pBssInfo->eIntendOPMode = eOpMode; - prP2pBssInfo->eCurrentOPMode = eOpMode; - switch (eOpMode) { - case OP_MODE_INFRASTRUCTURE: - DBGLOG(P2P, TRACE, ("p2pFuncSwitchOPMode: Switch to Client.\n")); - case OP_MODE_ACCESS_POINT: -// if (!IS_BSS_ACTIVE(prP2pBssInfo)) { -// SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); -// nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); -// } - - /* Change interface address. */ - if (eOpMode == OP_MODE_ACCESS_POINT) { - DBGLOG(P2P, TRACE, ("p2pFuncSwitchOPMode: Switch to AP.\n")); - prP2pBssInfo->ucSSIDLen = 0; - } - - COPY_MAC_ADDR(prP2pBssInfo->aucOwnMacAddr, prAdapter->rWifiVar.aucInterfaceAddress); - COPY_MAC_ADDR(prP2pBssInfo->aucBSSID, prAdapter->rWifiVar.aucInterfaceAddress); - - - break; - case OP_MODE_P2P_DEVICE: - { - /* Change device address. */ - DBGLOG(P2P, TRACE, ("p2pFuncSwitchOPMode: Switch back to P2P Device.\n")); - -// if (!IS_BSS_ACTIVE(prP2pBssInfo)) { -// SET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); -// nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); -// } - - p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED); - - COPY_MAC_ADDR(prP2pBssInfo->aucOwnMacAddr, prAdapter->rWifiVar.aucDeviceAddress); - COPY_MAC_ADDR(prP2pBssInfo->aucBSSID, prAdapter->rWifiVar.aucDeviceAddress); - - - } - break; - default: -// if (IS_BSS_ACTIVE(prP2pBssInfo)) { -// UNSET_NET_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX); - -// nicDeactivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); -// } - ASSERT(FALSE); - break; - } - - if (1) { - P2P_DISCONNECT_INFO rP2PDisInfo; - - rP2PDisInfo.ucRole = 2; - wlanSendSetQueryCmd(prAdapter, - CMD_ID_P2P_ABORT, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(P2P_DISCONNECT_INFO), - (PUINT_8)&rP2PDisInfo, - NULL, - 0); - } - - - DBGLOG(P2P, TRACE, ("The device address is changed to " MACSTR " \n", MAC2STR(prP2pBssInfo->aucOwnMacAddr))); - DBGLOG(P2P, TRACE, ("The BSSID is changed to " MACSTR " \n", MAC2STR(prP2pBssInfo->aucBSSID))); - - /* Update BSS INFO to FW. */ - if ((fgSyncToFW) && (eOpMode != OP_MODE_ACCESS_POINT)) { - nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX); - } - } - - } while (FALSE); - - return; -} /* p2pFuncSwitchOPMode */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will start a P2P Group Owner and send Beacon Frames. -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFuncStartGO ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo, - IN PUINT_8 pucSsidBuf, - IN UINT_8 ucSsidLen, - IN UINT_8 ucChannelNum, - IN ENUM_BAND_T eBand, - IN ENUM_CHNL_EXT_T eSco, - IN BOOLEAN fgIsPureAP - ) -{ - do { - ASSERT_BREAK((prAdapter != NULL) && (prBssInfo != NULL)); - - ASSERT(prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT); - - DBGLOG(P2P, TRACE, ("p2pFuncStartGO:\n")); - - /* AP mode started. */ - p2pFuncSwitchOPMode(prAdapter, prBssInfo, prBssInfo->eIntendOPMode, FALSE); - - prBssInfo->eIntendOPMode = OP_MODE_NUM; - - //4 <1.1> Assign SSID - COPY_SSID(prBssInfo->aucSSID, - prBssInfo->ucSSIDLen, - pucSsidBuf, - ucSsidLen); - - DBGLOG(P2P, TRACE, ("GO SSID:%s \n", prBssInfo->aucSSID)); - - //4 <1.2> Clear current AP's STA_RECORD_T and current AID - prBssInfo->prStaRecOfAP = (P_STA_RECORD_T)NULL; - prBssInfo->u2AssocId = 0; - - - //4 <1.3> Setup Channel, Band and Phy Attributes - prBssInfo->ucPrimaryChannel = ucChannelNum; - prBssInfo->eBand = eBand; - prBssInfo->eBssSCO = eSco; - - DBGLOG(P2P, TRACE, ("GO Channel:%d \n", ucChannelNum)); - - - if (prBssInfo->eBand == BAND_5G) { - prBssInfo->ucPhyTypeSet = (prAdapter->rWifiVar.ucAvailablePhyTypeSet & PHY_TYPE_SET_802_11AN); /* Depend on eBand */ - prBssInfo->ucConfigAdHocAPMode = AP_MODE_11A; /* Depend on eCurrentOPMode and ucPhyTypeSet */ - } - else if (fgIsPureAP) { - prBssInfo->ucPhyTypeSet = (prAdapter->rWifiVar.ucAvailablePhyTypeSet & PHY_TYPE_SET_802_11BGN); /* Depend on eBand */ - prBssInfo->ucConfigAdHocAPMode = AP_MODE_MIXED_11BG; /* Depend on eCurrentOPMode and ucPhyTypeSet */ - } - else { - prBssInfo->ucPhyTypeSet = (prAdapter->rWifiVar.ucAvailablePhyTypeSet & PHY_TYPE_SET_802_11GN); /* Depend on eBand */ - prBssInfo->ucConfigAdHocAPMode = AP_MODE_11G_P2P; /* Depend on eCurrentOPMode and ucPhyTypeSet */ - } - - - prBssInfo->ucNonHTBasicPhyType = (UINT_8) - rNonHTApModeAttributes[prBssInfo->ucConfigAdHocAPMode].ePhyTypeIndex; - prBssInfo->u2BSSBasicRateSet = - rNonHTApModeAttributes[prBssInfo->ucConfigAdHocAPMode].u2BSSBasicRateSet; - prBssInfo->u2OperationalRateSet = - rNonHTPhyAttributes[prBssInfo->ucNonHTBasicPhyType].u2SupportedRateSet; - - if (prBssInfo->ucAllSupportedRatesLen == 0) { - rateGetDataRatesFromRateSet(prBssInfo->u2OperationalRateSet, - prBssInfo->u2BSSBasicRateSet, - prBssInfo->aucAllSupportedRates, - &prBssInfo->ucAllSupportedRatesLen); - } - - //4 <1.5> Setup MIB for current BSS - prBssInfo->u2ATIMWindow = 0; - prBssInfo->ucBeaconTimeoutCount = 0; - - //3 <2> Update BSS_INFO_T common part -#if CFG_SUPPORT_AAA - if (!fgIsPureAP) { - prBssInfo->fgIsProtection = TRUE; /* Always enable protection at P2P GO */ - kalP2PSetCipher(prAdapter->prGlueInfo, IW_AUTH_CIPHER_CCMP); - } - else { - if (kalP2PGetCipher(prAdapter->prGlueInfo)) - prBssInfo->fgIsProtection = TRUE; - } - - // 20120106 frog: I want separate OP_Mode & Beacon TX Function. - //p2pFuncSwitchOPMode(prAdapter, prBssInfo, OP_MODE_ACCESS_POINT, FALSE); - - bssInitForAP(prAdapter, prBssInfo, FALSE); - - nicQmUpdateWmmParms(prAdapter, NETWORK_TYPE_P2P_INDEX); -#endif /* CFG_SUPPORT_AAA */ - - - //3 <3> Set MAC HW - //4 <3.1> Setup channel and bandwidth - rlmBssInitForAPandIbss(prAdapter, prBssInfo); - - //4 <3.2> Reset HW TSF Update Mode and Beacon Mode - nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX); - - //4 <3.3> Update Beacon again for network phy type confirmed. - bssUpdateBeaconContent(prAdapter, NETWORK_TYPE_P2P_INDEX); - - //4 <3.4> Setup BSSID - nicPmIndicateBssCreated(prAdapter, NETWORK_TYPE_P2P_INDEX); - - } while (FALSE); - - return; -} /* p2pFuncStartGO() */ - - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is to inform CNM that channel privilege -* has been released -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFuncReleaseCh ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_CHNL_REQ_INFO_T prChnlReqInfo - ) -{ - P_MSG_CH_ABORT_T prMsgChRelease = (P_MSG_CH_ABORT_T)NULL; - - DEBUGFUNC("p2pFuncReleaseCh()"); - - do { - ASSERT_BREAK((prAdapter != NULL) && (prChnlReqInfo != NULL)); - - if (!prChnlReqInfo->fgIsChannelRequested) { - break; - } - else { - DBGLOG(P2P, TRACE, ("P2P Release Channel\n")); - prChnlReqInfo->fgIsChannelRequested = FALSE; - } - - /* 1. return channel privilege to CNM immediately */ - prMsgChRelease = (P_MSG_CH_ABORT_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_CH_ABORT_T)); - if (!prMsgChRelease) { - ASSERT(0); // Can't release Channel to CNM - break; - } - - prMsgChRelease->rMsgHdr.eMsgId = MID_MNY_CNM_CH_ABORT; - prMsgChRelease->ucNetTypeIndex = NETWORK_TYPE_P2P_INDEX; - prMsgChRelease->ucTokenID = prChnlReqInfo->ucSeqNumOfChReq++; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prMsgChRelease, - MSG_SEND_METHOD_BUF); - - } while (FALSE); - - return; -} /* p2pFuncReleaseCh */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process of CHANNEL_REQ_JOIN Initial. Enter CHANNEL_REQ_JOIN State. -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFuncAcquireCh ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_CHNL_REQ_INFO_T prChnlReqInfo - ) -{ - P_MSG_CH_REQ_T prMsgChReq = (P_MSG_CH_REQ_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prChnlReqInfo != NULL)); - - p2pFuncReleaseCh(prAdapter, prChnlReqInfo); - - /* send message to CNM for acquiring channel */ - prMsgChReq = (P_MSG_CH_REQ_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_CH_REQ_T)); - - if (!prMsgChReq) { - ASSERT(0); // Can't indicate CNM for channel acquiring - break; - } - - prMsgChReq->rMsgHdr.eMsgId = MID_MNY_CNM_CH_REQ; - prMsgChReq->ucNetTypeIndex = NETWORK_TYPE_P2P_INDEX; - prMsgChReq->ucTokenID = ++prChnlReqInfo->ucSeqNumOfChReq; - prMsgChReq->eReqType = CH_REQ_TYPE_JOIN; - prMsgChReq->u4MaxInterval = prChnlReqInfo->u4MaxInterval; - - prMsgChReq->ucPrimaryChannel = prChnlReqInfo->ucReqChnlNum; - prMsgChReq->eRfSco = prChnlReqInfo->eChnlSco; - prMsgChReq->eRfBand = prChnlReqInfo->eBand; - - kalMemZero(prMsgChReq->aucBSSID, MAC_ADDR_LEN); - - /* Channel request join BSSID. */ - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prMsgChReq, - MSG_SEND_METHOD_BUF); - - prChnlReqInfo->fgIsChannelRequested = TRUE; - - } while (FALSE); - - return; -} /* p2pFuncAcquireCh */ - -#if 0 -WLAN_STATUS -p2pFuncBeaconUpdate( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBcnHdr, - IN UINT_32 u4HdrLen, - IN PUINT_8 pucBcnBody, - IN UINT_32 u4BodyLen, - IN UINT_32 u4DtimPeriod, - IN UINT_32 u4BcnInterval) -{ - WLAN_STATUS rResultStatus = WLAN_STATUS_INVALID_DATA; - P_WLAN_BEACON_FRAME_T prBcnFrame = (P_WLAN_BEACON_FRAME_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - P_MSDU_INFO_T prBcnMsduInfo = (P_MSDU_INFO_T)NULL; - PUINT_8 pucTIMBody = (PUINT_8)NULL; - UINT_16 u2FrameLength = 0, UINT_16 u2OldBodyLen = 0; - UINT_8 aucIEBuf[MAX_IE_LENGTH]; - - do { - ASSERT_BREAK(prAdapter != NULL); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - prBcnMsduInfo = prP2pBssInfo->prBeacon - - ASSERT_BREAK(prBcnMsduInfo != NULL); - - /* TODO: Find TIM IE pointer. */ - prBcnFrame = prBcnMsduInfo->prPacket; - - ASSERT_BREAK(prBcnFrame != NULL); - - do { - /* Ori header. */ - UINT_16 u2IELength = 0, u2Offset = 0; - PUINT_8 pucIEBuf = prBcnFrame->aucInfoElem; - - u2IELength = prBcnMsduInfo->u2FrameLength - prBcnMsduInfo->ucMacHeaderLength; - - IE_FOR_EACH(pucIEBuf, u2IELength, u2Offset) { - if ((IE_ID(pucIEBuf) == ELEM_ID_TIM) || - ((IE_ID(pucIEBuf) > ELEM_ID_IBSS_PARAM_SET)) { - pucTIMBody = pucIEBuf; - break - } - u2FrameLength += IE_SIZE(pucIEBuf); - } - - if (pucTIMBody == NULL) { - pucTIMBody = pucIEBuf; - } - - /* Body not change. */ - u2OldBodyLen = (UINT_16)((UINT_32)pucTIMBody - (UINT_32)prBcnFrame->aucInfoElem); - - // Move body. - kalMemCmp(aucIEBuf, pucTIMBody, u2OldBodyLen); - } while (FALSE); - - - if (pucBcnHdr) { - kalMemCopy(prBcnMsduInfo->prPacket, pucBcnHdr, u4HdrLen); - - pucTIMBody = (PUINT_8)((UINT_32)prBcnMsduInfo->prPacket + u4HdrLen); - - prBcnMsduInfo->ucMacHeaderLength = (WLAN_MAC_MGMT_HEADER_LEN + - (TIMESTAMP_FIELD_LEN + BEACON_INTERVAL_FIELD_LEN + CAP_INFO_FIELD_LEN)); - - u2FrameLength = u4HdrLen; /* Header + Partial Body. */ - - } - else { - /* Header not change. */ - u2FrameLength += prBcnMsduInfo->ucMacHeaderLength; - } - - - if (pucBcnBody) { - kalMemCopy(pucTIMBody, pucBcnBody, u4BodyLen); - u2FrameLength += (UINT_16)u4BodyLen; - } - else { - kalMemCopy(pucTIMBody, aucIEBuf, u2OldBodyLen); - u2FrameLength += u2OldBodyLen; - } - - /* Frame Length */ - prBcnMsduInfo->u2FrameLength = u2FrameLength; - - prBcnMsduInfo->fgIs802_11 = TRUE; - prBcnMsduInfo->ucNetworkType = NETWORK_TYPE_P2P_INDEX; - - prP2pBssInfo->u2BeaconInterval = (UINT_16)u4BcnInterval; - prP2pBssInfo->ucDTIMPeriod = (UINT_8)u4DtimPeriod; - prP2pBssInfo->u2CapInfo = prBcnFrame->u2CapInfo; - prBcnMsduInfo->ucPacketType = 3; - - rResultStatus = nicUpdateBeaconIETemplate(prAdapter, - IE_UPD_METHOD_UPDATE_ALL, - NETWORK_TYPE_P2P_INDEX, - prP2pBssInfo->u2CapInfo, - (PUINT_8)prBcnFrame->aucInfoElem, - prBcnMsduInfo->u2FrameLength - OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem)); - - if (prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) { - /* AP is created, Beacon Update. */ - nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX); - - nicPmIndicateBssCreated(prAdapter, NETWORK_TYPE_P2P_INDEX); - } - - } while (FALSE); - - return rResultStatus; -} /* p2pFuncBeaconUpdate */ - -#else -WLAN_STATUS -p2pFuncBeaconUpdate ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prP2pBssInfo, - IN P_P2P_BEACON_UPDATE_INFO_T prBcnUpdateInfo, - IN PUINT_8 pucNewBcnHdr, - IN UINT_32 u4NewHdrLen, - IN PUINT_8 pucNewBcnBody, - IN UINT_32 u4NewBodyLen - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - P_WLAN_BEACON_FRAME_T prBcnFrame = (P_WLAN_BEACON_FRAME_T)NULL; - P_MSDU_INFO_T prBcnMsduInfo = (P_MSDU_INFO_T)NULL; - PUINT_8 pucIEBuf = (PUINT_8)NULL; - UINT_8 aucIEBuf[MAX_IE_LENGTH]; - - do { - ASSERT_BREAK((prAdapter != NULL) && - (prP2pBssInfo != NULL) && - (prBcnUpdateInfo != NULL)); - - prBcnMsduInfo = prP2pBssInfo->prBeacon; - -#if DBG - if (prBcnUpdateInfo->pucBcnHdr != NULL) { - ASSERT((UINT_32)prBcnUpdateInfo->pucBcnHdr == ((UINT_32)prBcnMsduInfo->prPacket + MAC_TX_RESERVED_FIELD)); - } - - if (prBcnUpdateInfo->pucBcnBody != NULL) { - ASSERT((UINT_32)prBcnUpdateInfo->pucBcnBody == ((UINT_32)prBcnUpdateInfo->pucBcnHdr + (UINT_32)prBcnUpdateInfo->u4BcnHdrLen)); - } -#endif - prBcnFrame = (P_WLAN_BEACON_FRAME_T)((UINT_32)prBcnMsduInfo->prPacket + MAC_TX_RESERVED_FIELD); - - if (!pucNewBcnBody) { - /* Old body. */ - pucNewBcnBody = prBcnUpdateInfo->pucBcnBody; - ASSERT(u4NewBodyLen == 0); - u4NewBodyLen = prBcnUpdateInfo->u4BcnBodyLen; - } - else { - prBcnUpdateInfo->u4BcnBodyLen = u4NewBodyLen; - } - - /* Temp buffer body part. */ - kalMemCopy(aucIEBuf, pucNewBcnBody, u4NewBodyLen); - - if (pucNewBcnHdr) { - kalMemCopy(prBcnFrame, pucNewBcnHdr, u4NewHdrLen); - prBcnUpdateInfo->pucBcnHdr = (PUINT_8)prBcnFrame; - prBcnUpdateInfo->u4BcnHdrLen = u4NewHdrLen; - } - - pucIEBuf = (PUINT_8)((UINT_32)prBcnUpdateInfo->pucBcnHdr + (UINT_32)prBcnUpdateInfo->u4BcnHdrLen); - kalMemCopy(pucIEBuf, aucIEBuf, u4NewBodyLen); - prBcnUpdateInfo->pucBcnBody = pucIEBuf; - - /* Frame Length */ - prBcnMsduInfo->u2FrameLength = (UINT_16)(prBcnUpdateInfo->u4BcnHdrLen + prBcnUpdateInfo->u4BcnBodyLen); - - prBcnMsduInfo->ucPacketType = 3; - prBcnMsduInfo->fgIs802_11 = TRUE; - prBcnMsduInfo->ucNetworkType = NETWORK_TYPE_P2P_INDEX; - - - /* Update BSS INFO related information. */ - COPY_MAC_ADDR(prP2pBssInfo->aucOwnMacAddr, prBcnFrame->aucSrcAddr); - COPY_MAC_ADDR(prP2pBssInfo->aucBSSID, prBcnFrame->aucBSSID); - prP2pBssInfo->u2CapInfo = prBcnFrame->u2CapInfo; - - p2pFuncParseBeaconContent(prAdapter, - prP2pBssInfo, - (PUINT_8)prBcnFrame->aucInfoElem, - (prBcnMsduInfo->u2FrameLength - OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem))); - -#if 1 - //bssUpdateBeaconContent(prAdapter, NETWORK_TYPE_P2P_INDEX); -#else - nicUpdateBeaconIETemplate(prAdapter, - IE_UPD_METHOD_UPDATE_ALL, - NETWORK_TYPE_P2P_INDEX, - prBcnFrame->u2CapInfo, - (PUINT_8)prBcnFrame->aucInfoElem, - (prBcnMsduInfo->u2FrameLength - OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem))); -#endif - } while (FALSE); - - return rWlanStatus; -} /* p2pFuncBeaconUpdate */ - -#endif - -// TODO: We do not apply IE in deauth frame set from upper layer now. -WLAN_STATUS -p2pFuncDeauth ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucPeerMacAddr, - IN UINT_16 u2ReasonCode, - IN PUINT_8 pucIEBuf, - IN UINT_16 u2IELen, - IN BOOLEAN fgSendDeauth - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_FAILURE; - P_STA_RECORD_T prCliStaRec = (P_STA_RECORD_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - BOOLEAN fgIsStaFound = FALSE; - - do { - ASSERT_BREAK((prAdapter != NULL) && (pucPeerMacAddr != NULL)); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - prCliStaRec = cnmGetStaRecByAddress(prAdapter, - NETWORK_TYPE_P2P_INDEX, - pucPeerMacAddr); - - switch (prP2pBssInfo->eCurrentOPMode) { - case OP_MODE_ACCESS_POINT: - { - P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL; - P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL; - - prStaRecOfClientList = &(prP2pBssInfo->rStaRecOfClientList); - - LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) { - if ((UINT_32)prCliStaRec == (UINT_32)prLinkEntry) { - LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCliStaRec->rLinkEntry); - fgIsStaFound = TRUE; - break; - } - } - - } - break; - case OP_MODE_INFRASTRUCTURE: - ASSERT(prCliStaRec == prP2pBssInfo->prStaRecOfAP); - if (prCliStaRec != prP2pBssInfo->prStaRecOfAP) { - break; - } - prP2pBssInfo->prStaRecOfAP = NULL; - fgIsStaFound = TRUE; - break; - default: - break; - } - - if (fgIsStaFound) { - p2pFuncDisconnect(prAdapter, prCliStaRec, fgSendDeauth, u2ReasonCode); - } - - rWlanStatus = WLAN_STATUS_SUCCESS; - } while (FALSE); - - return rWlanStatus; -} /* p2pFuncDeauth */ - -// TODO: We do not apply IE in disassoc frame set from upper layer now. -WLAN_STATUS -p2pFuncDisassoc ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucPeerMacAddr, - IN UINT_16 u2ReasonCode, - IN PUINT_8 pucIEBuf, - IN UINT_16 u2IELen, - IN BOOLEAN fgSendDisassoc - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_FAILURE; - P_STA_RECORD_T prCliStaRec = (P_STA_RECORD_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - BOOLEAN fgIsStaFound = FALSE; - - do { - ASSERT_BREAK((prAdapter != NULL) && (pucPeerMacAddr != NULL)); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - prCliStaRec = cnmGetStaRecByAddress(prAdapter, - NETWORK_TYPE_P2P_INDEX, - pucPeerMacAddr); - - switch (prP2pBssInfo->eCurrentOPMode) { - case OP_MODE_ACCESS_POINT: - { - P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL; - P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL; - - prStaRecOfClientList = &(prP2pBssInfo->rStaRecOfClientList); - - LINK_FOR_EACH(prLinkEntry, prStaRecOfClientList) { - if ((UINT_32)prCliStaRec == (UINT_32)prLinkEntry) { - LINK_REMOVE_KNOWN_ENTRY(prStaRecOfClientList, &prCliStaRec->rLinkEntry); - fgIsStaFound = TRUE; - //p2pFuncDisconnect(prAdapter, prCliStaRec, fgSendDisassoc, u2ReasonCode); - break; - } - } - - } - break; - case OP_MODE_INFRASTRUCTURE: - ASSERT(prCliStaRec == prP2pBssInfo->prStaRecOfAP); - if (prCliStaRec != prP2pBssInfo->prStaRecOfAP) { - break; - } - - //p2pFuncDisconnect(prAdapter, prCliStaRec, fgSendDisassoc, u2ReasonCode); - prP2pBssInfo->prStaRecOfAP = NULL; - fgIsStaFound = TRUE; - break; - default: - break; - } - - if (fgIsStaFound) { - - p2pFuncDisconnect(prAdapter, prCliStaRec, fgSendDisassoc, u2ReasonCode); - //20120830 moved into p2pFuncDisconnect(). - //cnmStaRecFree(prAdapter, prCliStaRec, TRUE); - - } - - rWlanStatus = WLAN_STATUS_SUCCESS; - } while (FALSE); - - return rWlanStatus; -} /* p2pFuncDisassoc */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to dissolve from group or one group. (Would not change P2P FSM.) -* 1. GC: Disconnect from AP. (Send Deauth) -* 2. GO: Disconnect all STA -* -* @param[in] prAdapter Pointer to the adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFuncDissolve ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prP2pBssInfo, - IN BOOLEAN fgSendDeauth, - IN UINT_16 u2ReasonCode - ) -{ - DEBUGFUNC("p2pFuncDissolve()"); - - do { - - ASSERT_BREAK((prAdapter != NULL) && (prP2pBssInfo != NULL)); - - switch (prP2pBssInfo->eCurrentOPMode) { - case OP_MODE_INFRASTRUCTURE: - /* Reset station record status. */ - if (prP2pBssInfo->prStaRecOfAP) { - kalP2PGCIndicateConnectionStatus(prAdapter->prGlueInfo, - NULL, - NULL, - 0, - REASON_CODE_DEAUTH_LEAVING_BSS); - - // 2012/02/14 frog: After formation before join group, prStaRecOfAP is NULL. - p2pFuncDisconnect(prAdapter, - prP2pBssInfo->prStaRecOfAP, - fgSendDeauth, - u2ReasonCode); - } - - /* Fix possible KE when RX Beacon & call nicPmIndicateBssConnected(). hit prStaRecOfAP == NULL. */ - p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED); - - prP2pBssInfo->prStaRecOfAP = NULL; - - break; - case OP_MODE_ACCESS_POINT: - /* Under AP mode, we would net send deauthentication frame to each STA. - * We only stop the Beacon & let all stations timeout. - */ - { - P_LINK_T prStaRecOfClientList = (P_LINK_T)NULL; - - /* Send deauth. */ - authSendDeauthFrame(prAdapter, - NULL, - (P_SW_RFB_T)NULL, - u2ReasonCode, - (PFN_TX_DONE_HANDLER)NULL); - - prStaRecOfClientList = &prP2pBssInfo->rStaRecOfClientList; - - while (!LINK_IS_EMPTY(prStaRecOfClientList)) { - P_STA_RECORD_T prCurrStaRec; - - LINK_REMOVE_HEAD(prStaRecOfClientList, prCurrStaRec, P_STA_RECORD_T); - - /* Indicate to Host. */ - //kalP2PGOStationUpdate(prAdapter->prGlueInfo, prCurrStaRec, FALSE); - - p2pFuncDisconnect(prAdapter, prCurrStaRec, TRUE, u2ReasonCode); - - } - - } - - break; - default: - return; // 20110420 -- alreay in Device Mode. - } - - /* Make the deauth frame send to FW ASAP. */ - wlanAcquirePowerControl(prAdapter); - wlanProcessCommandQueue(prAdapter, &prAdapter->prGlueInfo->rCmdQueue); - wlanReleasePowerControl(prAdapter); - - kalMdelay(100); - - /* Change Connection Status. */ - p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED); - - } while (FALSE); - - return; -} /* p2pFuncDissolve */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to dissolve from group or one group. (Would not change P2P FSM.) -* 1. GC: Disconnect from AP. (Send Deauth) -* 2. GO: Disconnect all STA -* -* @param[in] prAdapter Pointer to the adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFuncDisconnect ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN BOOLEAN fgSendDeauth, - IN UINT_16 u2ReasonCode - ) -{ - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - ENUM_PARAM_MEDIA_STATE_T eOriMediaStatus; - - DBGLOG(P2P, TRACE, ("p2pFuncDisconnect()")); - - do { - ASSERT_BREAK((prAdapter != NULL) && (prStaRec != NULL)); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - eOriMediaStatus = prP2pBssInfo->eConnectionState; - - /* Indicate disconnect. */ - // TODO: -// kalP2PGOStationUpdate -// kalP2PGCIndicateConnectionStatus - //p2pIndicationOfMediaStateToHost(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED, prStaRec->aucMacAddr); - if (prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) { - kalP2PGOStationUpdate(prAdapter->prGlueInfo, prStaRec, FALSE); - } - - if (fgSendDeauth) { - /* Send deauth. */ - authSendDeauthFrame(prAdapter, - prStaRec, - (P_SW_RFB_T)NULL, - u2ReasonCode, - (PFN_TX_DONE_HANDLER)p2pFsmRunEventDeauthTxDone); - } - else { - /* Change station state. */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - - /* Reset Station Record Status. */ - p2pFuncResetStaRecStatus(prAdapter, prStaRec); - - cnmStaRecFree(prAdapter, prStaRec, TRUE); - - if ((prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) || - (prP2pBssInfo->rStaRecOfClientList.u4NumElem == 0)) { - DBGLOG(P2P, TRACE, ("No More Client, Media Status DISCONNECTED\n")); - p2pChangeMediaState(prAdapter, PARAM_MEDIA_STATE_DISCONNECTED); - } - - if (eOriMediaStatus != prP2pBssInfo->eConnectionState) { - /* Update Disconnected state to FW. */ - nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX); - } - - } - - if (prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) { - /* GO: It would stop Beacon TX. GC: Stop all BSS related PS function. */ - nicPmIndicateBssAbort(prAdapter, NETWORK_TYPE_P2P_INDEX); - - /* Reset RLM related field of BSSINFO. */ - rlmBssAborted(prAdapter, prP2pBssInfo); - } - - } while (FALSE); - - return; - -} /* p2pFuncDisconnect */ - - - - - - -WLAN_STATUS -p2pFuncTxMgmtFrame ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_MGMT_TX_REQ_INFO_T prMgmtTxReqInfo, - IN P_MSDU_INFO_T prMgmtTxMsdu, - IN UINT_64 u8Cookie - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - P_MSDU_INFO_T prTxMsduInfo = (P_MSDU_INFO_T)NULL; - P_WLAN_MAC_HEADER_T prWlanHdr = (P_WLAN_MAC_HEADER_T)NULL; - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMgmtTxReqInfo != NULL)); - - if (prMgmtTxReqInfo->fgIsMgmtTxRequested) { - - // 1. prMgmtTxReqInfo->prMgmtTxMsdu != NULL - /* Packet on driver, not done yet, drop it. */ - if ((prTxMsduInfo = prMgmtTxReqInfo->prMgmtTxMsdu) != NULL) { - - kalP2PIndicateMgmtTxStatus(prAdapter->prGlueInfo, - prMgmtTxReqInfo->u8Cookie, - FALSE, - prTxMsduInfo->prPacket, - (UINT_32)prTxMsduInfo->u2FrameLength); - - // Leave it to TX Done handler. - //cnmMgtPktFree(prAdapter, prTxMsduInfo); - prMgmtTxReqInfo->prMgmtTxMsdu = NULL; - } - - // 2. prMgmtTxReqInfo->prMgmtTxMsdu == NULL - /* Packet transmitted, wait tx done. (cookie issue) */ - // 20120105 frog - use another u8cookie to store this value. - - } - - ASSERT(prMgmtTxReqInfo->prMgmtTxMsdu == NULL); - - - - prWlanHdr = (P_WLAN_MAC_HEADER_T)((UINT_32)prMgmtTxMsdu->prPacket + MAC_TX_RESERVED_FIELD); - prStaRec = cnmGetStaRecByAddress(prAdapter, NETWORK_TYPE_P2P_INDEX, prWlanHdr->aucAddr1); - prMgmtTxMsdu->ucNetworkType = (UINT_8)NETWORK_TYPE_P2P_INDEX; - - switch (prWlanHdr->u2FrameCtrl & MASK_FRAME_TYPE) { - case MAC_FRAME_PROBE_RSP: - prMgmtTxMsdu = p2pFuncProcessP2pProbeRsp(prAdapter, prMgmtTxMsdu); - break; - default: - break; - } - - - prMgmtTxReqInfo->u8Cookie = u8Cookie; - prMgmtTxReqInfo->prMgmtTxMsdu = prMgmtTxMsdu; - prMgmtTxReqInfo->fgIsMgmtTxRequested = TRUE; - - prMgmtTxMsdu->eSrc = TX_PACKET_MGMT; - prMgmtTxMsdu->ucPacketType = HIF_TX_PACKET_TYPE_MGMT; - prMgmtTxMsdu->ucStaRecIndex = (prStaRec != NULL)?(prStaRec->ucIndex):(0xFF); - if (prStaRec != NULL) { - DBGLOG(P2P, TRACE, ("Mgmt with station record: "MACSTR" .\n", MAC2STR(prStaRec->aucMacAddr))); - } - - prMgmtTxMsdu->ucMacHeaderLength = WLAN_MAC_MGMT_HEADER_LEN; // TODO: undcertain. - prMgmtTxMsdu->fgIs802_1x = FALSE; - prMgmtTxMsdu->fgIs802_11 = TRUE; - prMgmtTxMsdu->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMgmtTxMsdu->pfTxDoneHandler = p2pFsmRunEventMgmtFrameTxDone; - prMgmtTxMsdu->fgIsBasicRate = TRUE; - DBGLOG(P2P, TRACE, ("Mgmt seq NO. %d .\n", prMgmtTxMsdu->ucTxSeqNum)); - - nicTxEnqueueMsdu(prAdapter, prMgmtTxMsdu); - - } while (FALSE); - - return rWlanStatus; -} /* p2pFuncTxMgmtFrame */ - - - -VOID -p2pFuncSetChannel ( - IN P_ADAPTER_T prAdapter, - IN P_RF_CHANNEL_INFO_T prRfChannelInfo - ) -{ - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prRfChannelInfo != NULL)); - - prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - - prP2pConnSettings->ucOperatingChnl = prRfChannelInfo->ucChannelNum; - prP2pConnSettings->eBand = prRfChannelInfo->eBand; - - - } while (FALSE); - - return; -} -/* p2pFuncSetChannel */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Retry JOIN for AUTH_MODE_AUTO_SWITCH -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @retval TRUE We will retry JOIN -* @retval FALSE We will not retry JOIN -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -p2pFuncRetryJOIN ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN P_P2P_JOIN_INFO_T prJoinInfo - ) -{ - P_MSG_JOIN_REQ_T prJoinReqMsg = (P_MSG_JOIN_REQ_T)NULL; - BOOLEAN fgRetValue = FALSE; - - do { - ASSERT_BREAK((prAdapter != NULL) && - (prStaRec != NULL) && - (prJoinInfo != NULL)); - - /* Retry other AuthType if possible */ - if (!prJoinInfo->ucAvailableAuthTypes) { - break; - } - - if (prJoinInfo->ucAvailableAuthTypes & - (UINT_8)AUTH_TYPE_SHARED_KEY) { - - DBGLOG(P2P, INFO, ("RETRY JOIN INIT: Retry Authentication with AuthType == SHARED_KEY.\n")); - - prJoinInfo->ucAvailableAuthTypes &= - ~(UINT_8)AUTH_TYPE_SHARED_KEY; - - prStaRec->ucAuthAlgNum = (UINT_8)AUTH_ALGORITHM_NUM_SHARED_KEY; - } - else { - DBGLOG(P2P, ERROR, ("RETRY JOIN INIT: Retry Authentication with Unexpected AuthType.\n")); - ASSERT(0); - break; - } - - prJoinInfo->ucAvailableAuthTypes = 0; /* No more available Auth Types */ - - /* Trigger SAA to start JOIN process. */ - prJoinReqMsg = (P_MSG_JOIN_REQ_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_JOIN_REQ_T)); - if (!prJoinReqMsg) { - ASSERT(0); // Can't trigger SAA FSM - break; - } - - prJoinReqMsg->rMsgHdr.eMsgId = MID_P2P_SAA_FSM_START; - prJoinReqMsg->ucSeqNum = ++prJoinInfo->ucSeqNumOfReqMsg; - prJoinReqMsg->prStaRec = prStaRec; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prJoinReqMsg, - MSG_SEND_METHOD_BUF); - - - fgRetValue = TRUE; - } while (FALSE); - - return fgRetValue; - - - -}/* end of p2pFuncRetryJOIN() */ - - - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will update the contain of BSS_INFO_T for AIS network once -* the association was completed. -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] prAssocRspSwRfb Pointer to SW RFB of ASSOC RESP FRAME. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFuncUpdateBssInfoForJOIN ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prAssocRspSwRfb - ) -{ - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - P_WLAN_ASSOC_RSP_FRAME_T prAssocRspFrame = (P_WLAN_ASSOC_RSP_FRAME_T)NULL; - UINT_16 u2IELength; - PUINT_8 pucIE; - - DEBUGFUNC("p2pUpdateBssInfoForJOIN()"); - - ASSERT(prAdapter); - ASSERT(prStaRec); - ASSERT(prAssocRspSwRfb); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - prAssocRspFrame = (P_WLAN_ASSOC_RSP_FRAME_T) prAssocRspSwRfb->pvHeader; - - DBGLOG(P2P, INFO, ("Update P2P_BSS_INFO_T and apply settings to MAC\n")); - - //3 <1> Update BSS_INFO_T from AIS_FSM_INFO_T or User Settings - //4 <1.1> Setup Operation Mode - prP2pBssInfo->eCurrentOPMode = OP_MODE_INFRASTRUCTURE; - - //4 <1.2> Setup SSID - COPY_SSID(prP2pBssInfo->aucSSID, - prP2pBssInfo->ucSSIDLen, - prP2pConnSettings->aucSSID, - prP2pConnSettings->ucSSIDLen); - - if (prBssDesc == NULL) { - /* Target BSS NULL. */ - DBGLOG(P2P, TRACE,("Target BSS NULL\n")); - return; - } - - - if (UNEQUAL_MAC_ADDR(prBssDesc->aucBSSID, prAssocRspFrame->aucBSSID)) { - ASSERT(FALSE); - } - - //4 <1.3> Setup Channel, Band - prP2pBssInfo->ucPrimaryChannel = prBssDesc->ucChannelNum; - prP2pBssInfo->eBand = prBssDesc->eBand; - - - //3 <2> Update BSS_INFO_T from STA_RECORD_T - //4 <2.1> Save current AP's STA_RECORD_T and current AID - prP2pBssInfo->prStaRecOfAP = prStaRec; - prP2pBssInfo->u2AssocId = prStaRec->u2AssocId; - - //4 <2.2> Setup Capability - prP2pBssInfo->u2CapInfo = prStaRec->u2CapInfo; /* Use AP's Cap Info as BSS Cap Info */ - - if (prP2pBssInfo->u2CapInfo & CAP_INFO_SHORT_PREAMBLE) { - prP2pBssInfo->fgIsShortPreambleAllowed = TRUE; - } - else { - prP2pBssInfo->fgIsShortPreambleAllowed = FALSE; - } - - //4 <2.3> Setup PHY Attributes and Basic Rate Set/Operational Rate Set - prP2pBssInfo->ucPhyTypeSet = prStaRec->ucDesiredPhyTypeSet; - - prP2pBssInfo->ucNonHTBasicPhyType = prStaRec->ucNonHTBasicPhyType; - - prP2pBssInfo->u2OperationalRateSet = prStaRec->u2OperationalRateSet; - prP2pBssInfo->u2BSSBasicRateSet = prStaRec->u2BSSBasicRateSet; - - - //3 <3> Update BSS_INFO_T from SW_RFB_T (Association Resp Frame) - //4 <3.1> Setup BSSID - COPY_MAC_ADDR(prP2pBssInfo->aucBSSID, prAssocRspFrame->aucBSSID); - - - u2IELength = (UINT_16) ((prAssocRspSwRfb->u2PacketLen - prAssocRspSwRfb->u2HeaderLen) - - (OFFSET_OF(WLAN_ASSOC_RSP_FRAME_T, aucInfoElem[0]) - WLAN_MAC_MGMT_HEADER_LEN)); - pucIE = prAssocRspFrame->aucInfoElem; - - - //4 <3.2> Parse WMM and setup QBSS flag - /* Parse WMM related IEs and configure HW CRs accordingly */ - mqmProcessAssocRsp(prAdapter, prAssocRspSwRfb, pucIE, u2IELength); - - prP2pBssInfo->fgIsQBSS = prStaRec->fgIsQoS; - - //3 <4> Update BSS_INFO_T from BSS_DESC_T - ASSERT(prBssDesc); - - prBssDesc->fgIsConnecting = FALSE; - prBssDesc->fgIsConnected = TRUE; - - //4 <4.1> Setup MIB for current BSS - prP2pBssInfo->u2BeaconInterval = prBssDesc->u2BeaconInterval; - /* NOTE: Defer ucDTIMPeriod updating to when beacon is received after connection */ - prP2pBssInfo->ucDTIMPeriod = 0; - prP2pBssInfo->u2ATIMWindow = 0; - - prP2pBssInfo->ucBeaconTimeoutCount = AIS_BEACON_TIMEOUT_COUNT_INFRA; - - //4 <4.2> Update HT information and set channel - /* Record HT related parameters in rStaRec and rBssInfo - * Note: it shall be called before nicUpdateBss() - */ - rlmProcessAssocRsp(prAdapter, prAssocRspSwRfb, pucIE, u2IELength); - - //4 <4.3> Sync with firmware for BSS-INFO - nicUpdateBss(prAdapter, NETWORK_TYPE_P2P_INDEX); - - //4 <4.4> *DEFER OPERATION* nicPmIndicateBssConnected() will be invoked - //inside scanProcessBeaconAndProbeResp() after 1st beacon is received - - return; -} /* end of p2pUpdateBssInfoForJOIN() */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will validate the Rx Auth Frame and then return -* the status code to AAA to indicate if need to perform following actions -* when the specified conditions were matched. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[in] pprStaRec Pointer to pointer of STA_RECORD_T structure. -* @param[out] pu2StatusCode The Status Code of Validation Result -* -* @retval TRUE Reply the Auth -* @retval FALSE Don't reply the Auth -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -p2pFuncValidateAuth ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN PP_STA_RECORD_T pprStaRec, - OUT PUINT_16 pu2StatusCode - ) -{ - BOOLEAN fgReplyAuth = TRUE; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - P_WLAN_AUTH_FRAME_T prAuthFrame = (P_WLAN_AUTH_FRAME_T)NULL; - - DBGLOG(P2P, TRACE, ("p2pValidate Authentication Frame\n")) - - do { - ASSERT_BREAK((prAdapter != NULL) && - (prSwRfb != NULL) && - (pprStaRec != NULL) && - (pu2StatusCode != NULL)); - - /* P2P 3.2.8 */ - *pu2StatusCode = STATUS_CODE_REQ_DECLINED; - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - prAuthFrame = (P_WLAN_AUTH_FRAME_T)prSwRfb->pvHeader; - - - if (prP2pBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) { - /* We are not under AP Mode yet. */ - fgReplyAuth = FALSE; - DBGLOG(P2P, WARN, ("Current OP mode is not under AP mode. (%d)\n", prP2pBssInfo->eCurrentOPMode)); - break; - } - - prStaRec = cnmGetStaRecByAddress(prAdapter, - (UINT_8) NETWORK_TYPE_P2P_INDEX, - prAuthFrame->aucSrcAddr); - - if (!prStaRec) { - prStaRec = cnmStaRecAlloc(prAdapter, - (UINT_8) NETWORK_TYPE_P2P_INDEX); - - /* TODO(Kevin): Error handling of allocation of STA_RECORD_T for - * exhausted case and do removal of unused STA_RECORD_T. - */ - /* Sent a message event to clean un-used STA_RECORD_T. */ - ASSERT(prStaRec); - - COPY_MAC_ADDR(prStaRec->aucMacAddr, prAuthFrame->aucSrcAddr); - - prSwRfb->ucStaRecIdx = prStaRec->ucIndex; - - prStaRec->u2BSSBasicRateSet = prP2pBssInfo->u2BSSBasicRateSet; - - prStaRec->u2DesiredNonHTRateSet = RATE_SET_ERP_P2P; - - prStaRec->u2OperationalRateSet = RATE_SET_ERP_P2P; - prStaRec->ucPhyTypeSet = PHY_TYPE_SET_802_11GN; - prStaRec->eStaType = STA_TYPE_P2P_GC; - - /* NOTE(Kevin): Better to change state here, not at TX Done */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - } - else { - prSwRfb->ucStaRecIdx = prStaRec->ucIndex; - - if ((prStaRec->ucStaState > STA_STATE_1) && (IS_STA_IN_P2P(prStaRec))) { - - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - - p2pFuncResetStaRecStatus(prAdapter, prStaRec); - - bssRemoveStaRecFromClientList(prAdapter, prP2pBssInfo, prStaRec); - } - - } - - if (prP2pBssInfo->rStaRecOfClientList.u4NumElem >= P2P_MAXIMUM_CLIENT_COUNT || - kalP2PMaxClients(prAdapter->prGlueInfo, prP2pBssInfo->rStaRecOfClientList.u4NumElem)) { - /* GROUP limit full. */ - /* P2P 3.2.8 */ - DBGLOG(P2P, WARN, ("Group Limit Full. (%d)\n", (INT_16)prP2pBssInfo->rStaRecOfClientList.u4NumElem)); - cnmStaRecFree(prAdapter, prStaRec, FALSE); - break; - } - else { - /* Hotspot Blacklist */ - if(prAuthFrame->aucSrcAddr) { - if(kalP2PCmpBlackList(prAdapter->prGlueInfo, prAuthFrame->aucSrcAddr)) { - fgReplyAuth = FALSE; - return fgReplyAuth; - } - } - } - - //prStaRec->eStaType = STA_TYPE_INFRA_CLIENT; - prStaRec->eStaType = STA_TYPE_P2P_GC; - - prStaRec->ucNetTypeIndex = NETWORK_TYPE_P2P_INDEX; - - /* Update Station Record - Status/Reason Code */ - prStaRec->u2StatusCode = STATUS_CODE_SUCCESSFUL; - - prStaRec->ucJoinFailureCount = 0; - - *pprStaRec = prStaRec; - - *pu2StatusCode = STATUS_CODE_SUCCESSFUL; - - } while (FALSE); - - - return fgReplyAuth; - -} /* p2pFuncValidateAuth */ - - - - -VOID -p2pFuncResetStaRecStatus ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - do { - if ((prAdapter == NULL) || (prStaRec == NULL)) { - ASSERT(FALSE); - break; - } - - - prStaRec->u2StatusCode = STATUS_CODE_SUCCESSFUL; - prStaRec->u2ReasonCode = REASON_CODE_RESERVED; - prStaRec->ucJoinFailureCount = 0; - prStaRec->fgTransmitKeyExist = FALSE; - - prStaRec->fgSetPwrMgtBit = FALSE; - - } while (FALSE); - - return; -} /* p2pFuncResetStaRecStatus */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief The function is used to initialize the value of the connection settings for -* P2P network -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFuncInitConnectionSettings ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_CONNECTION_SETTINGS_T prP2PConnSettings - ) -{ - P_DEVICE_TYPE_T prDevType; - UINT_8 aucDefaultDevName[] = P2P_DEFAULT_DEV_NAME; - UINT_8 aucWfaOui[] = VENDOR_OUI_WFA; - - ASSERT(prP2PConnSettings); - - /* Setup Default Device Name */ - prP2PConnSettings->ucDevNameLen = P2P_DEFAULT_DEV_NAME_LEN; - kalMemCopy(prP2PConnSettings->aucDevName, aucDefaultDevName, sizeof(aucDefaultDevName)); - - /* Setup Primary Device Type (Big-Endian) */ - prDevType = &prP2PConnSettings->rPrimaryDevTypeBE; - - prDevType->u2CategoryId = HTONS(P2P_DEFAULT_PRIMARY_CATEGORY_ID); - prDevType->u2SubCategoryId = HTONS(P2P_DEFAULT_PRIMARY_SUB_CATEGORY_ID); - - prDevType->aucOui[0] = aucWfaOui[0]; - prDevType->aucOui[1] = aucWfaOui[1]; - prDevType->aucOui[2] = aucWfaOui[2]; - prDevType->aucOui[3] = VENDOR_OUI_TYPE_WPS; - - /* Setup Secondary Device Type */ - prP2PConnSettings->ucSecondaryDevTypeCount = 0; - - /* Setup Default Config Method */ - prP2PConnSettings->eConfigMethodSelType = ENUM_CONFIG_METHOD_SEL_AUTO; - prP2PConnSettings->u2ConfigMethodsSupport = P2P_DEFAULT_CONFIG_METHOD; - prP2PConnSettings->u2TargetConfigMethod = 0; - prP2PConnSettings->u2LocalConfigMethod = 0; - prP2PConnSettings->fgIsPasswordIDRdy = FALSE; - - /* For Device Capability */ - prP2PConnSettings->fgSupportServiceDiscovery = FALSE; - prP2PConnSettings->fgSupportClientDiscoverability = TRUE; - prP2PConnSettings->fgSupportConcurrentOperation = TRUE; - prP2PConnSettings->fgSupportInfraManaged = FALSE; - prP2PConnSettings->fgSupportInvitationProcedure = FALSE; - - /* For Group Capability */ -#if CFG_SUPPORT_PERSISTENT_GROUP - prP2PConnSettings->fgSupportPersistentP2PGroup = TRUE; -#else - prP2PConnSettings->fgSupportPersistentP2PGroup = FALSE; -#endif - prP2PConnSettings->fgSupportIntraBSSDistribution = TRUE; - prP2PConnSettings->fgSupportCrossConnection = TRUE; - prP2PConnSettings->fgSupportPersistentReconnect = FALSE; - - prP2PConnSettings->fgSupportOppPS = FALSE; - prP2PConnSettings->u2CTWindow = P2P_CTWINDOW_DEFAULT; - - /* For Connection Settings. */ - prP2PConnSettings->eAuthMode = AUTH_MODE_OPEN; - - prP2PConnSettings->prTargetP2pDesc = NULL; - prP2PConnSettings->ucSSIDLen = 0; - - /* Misc */ - prP2PConnSettings->fgIsScanReqIssued = FALSE; - prP2PConnSettings->fgIsServiceDiscoverIssued = FALSE; - prP2PConnSettings->fgP2pGroupLimit = FALSE; - prP2PConnSettings->ucOperatingChnl = 0; - prP2PConnSettings->ucListenChnl = 0; - prP2PConnSettings->ucTieBreaker = (UINT_8)(kalRandomNumber() & 0x1); - - prP2PConnSettings->eFormationPolicy = ENUM_P2P_FORMATION_POLICY_AUTO; - - return; -} /* p2pFuncInitConnectionSettings */ - - - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will validate the Rx Assoc Req Frame and then return -* the status code to AAA to indicate if need to perform following actions -* when the specified conditions were matched. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[out] pu2StatusCode The Status Code of Validation Result -* -* @retval TRUE Reply the Assoc Resp -* @retval FALSE Don't reply the Assoc Resp -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -p2pFuncValidateAssocReq ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_16 pu2StatusCode - ) -{ - BOOLEAN fgReplyAssocResp = TRUE; - P_WLAN_ASSOC_REQ_FRAME_T prAssocReqFrame = (P_WLAN_ASSOC_REQ_FRAME_T)NULL; - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - - /* TODO(Kevin): Call P2P functions to check .. - 2. Check we can accept connection from thsi peer - a. If we are in PROVISION state, only accept the peer we do the GO formation previously. - b. If we are in OPERATION state, only accept the other peer when P2P_GROUP_LIMIT is 0. - 3. Check Black List here. - */ - - do { - ASSERT_BREAK((prAdapter != NULL) && - (prSwRfb != NULL) && - (pu2StatusCode != NULL)); - - *pu2StatusCode = STATUS_CODE_REQ_DECLINED; - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - prAssocReqFrame = (P_WLAN_ASSOC_REQ_FRAME_T)prSwRfb->pvHeader; - - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - - if (prStaRec == NULL) { - /* Station record should be ready while RX AUTH frame. */ - fgReplyAssocResp = FALSE; - ASSERT(FALSE); - break; - } - else { - prStaRec->ucRCPI = prSwRfb->prHifRxHdr->ucRcpi; - } - - prStaRec->u2DesiredNonHTRateSet &= prP2pBssInfo->u2OperationalRateSet; - prStaRec->ucDesiredPhyTypeSet = prStaRec->ucPhyTypeSet & prP2pBssInfo->ucPhyTypeSet; - - if (prStaRec->ucDesiredPhyTypeSet == 0) { - /* The station only support 11B rate. */ - *pu2StatusCode = STATUS_CODE_ASSOC_DENIED_RATE_NOT_SUPPORTED; - break; - } - - *pu2StatusCode = STATUS_CODE_SUCCESSFUL; - - } while (FALSE); - - return fgReplyAssocResp; - -} /* p2pFuncValidateAssocReq */ - - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to check the P2P IE -* -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -p2pFuncParseCheckForP2PInfoElem ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBuf, - OUT PUINT_8 pucOuiType - ) -{ - UINT_8 aucWfaOui[] = VENDOR_OUI_WFA_SPECIFIC; - P_IE_WFA_T prWfaIE = (P_IE_WFA_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (pucBuf != NULL) && (pucOuiType != NULL)); - - prWfaIE = (P_IE_WFA_T)pucBuf; - - if (IE_LEN(pucBuf) <= ELEM_MIN_LEN_WFA_OUI_TYPE_SUBTYPE) { - break; - } - else if (prWfaIE->aucOui[0] != aucWfaOui[0] || - prWfaIE->aucOui[1] != aucWfaOui[1] || - prWfaIE->aucOui[2] != aucWfaOui[2]) { - break; - } - - *pucOuiType = prWfaIE->ucOuiType; - - return TRUE; - } while (FALSE); - - return FALSE; -} /* p2pFuncParseCheckForP2PInfoElem */ - - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will validate the Rx Probe Request Frame and then return -* result to BSS to indicate if need to send the corresponding Probe Response -* Frame if the specified conditions were matched. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[out] pu4ControlFlags Control flags for replying the Probe Response -* -* @retval TRUE Reply the Probe Response -* @retval FALSE Don't reply the Probe Response -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -p2pFuncValidateProbeReq ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT PUINT_32 pu4ControlFlags - ) -{ - BOOLEAN fgIsReplyProbeRsp = FALSE; - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - - DEBUGFUNC("p2pFuncValidateProbeReq"); - - do { - - ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL)); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo->u4P2pPacketFilter & PARAM_PACKET_FILTER_PROBE_REQ) { - /* Leave the probe response to p2p_supplicant. */ - kalP2PIndicateRxMgmtFrame(prAdapter->prGlueInfo, prSwRfb); - } - - } while (FALSE); - - return fgIsReplyProbeRsp; - -} /* end of p2pFuncValidateProbeReq() */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will validate the Rx Probe Request Frame and then return -* result to BSS to indicate if need to send the corresponding Probe Response -* Frame if the specified conditions were matched. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prSwRfb Pointer to SW RFB data structure. -* @param[out] pu4ControlFlags Control flags for replying the Probe Response -* -* @retval TRUE Reply the Probe Response -* @retval FALSE Don't reply the Probe Response -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFuncValidateRxActionFrame ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - - DEBUGFUNC("p2pFuncValidateProbeReq"); - - do { - - ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL)); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - if (prP2pFsmInfo->u4P2pPacketFilter & PARAM_PACKET_FILTER_ACTION_FRAME) { - /* Leave the probe response to p2p_supplicant. */ - kalP2PIndicateRxMgmtFrame(prAdapter->prGlueInfo, prSwRfb); - } - - } while (FALSE); - - return; - -} /* p2pFuncValidateRxMgmtFrame */ - - - - -BOOLEAN -p2pFuncIsAPMode ( - IN P_P2P_FSM_INFO_T prP2pFsmInfo - ) -{ - if (prP2pFsmInfo) { - return prP2pFsmInfo->fgIsApMode; - } - else { - return FALSE; - } -} -/* p2pFuncIsAPMode */ - - - -VOID -p2pFuncParseBeaconContent ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prP2pBssInfo, - IN PUINT_8 pucIEInfo, - IN UINT_32 u4IELen - ) -{ - PUINT_8 pucIE = (PUINT_8)NULL; - UINT_16 u2Offset = 0; - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - BOOL ucNewSecMode = FALSE; - BOOL ucOldSecMode = FALSE; - - do { - ASSERT_BREAK((prAdapter != NULL) && - (prP2pBssInfo != NULL)); - - if (u4IELen == 0) { - break; - } - - prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; - prP2pSpecificBssInfo->u2AttributeLen = 0; - - ASSERT_BREAK(pucIEInfo != NULL); - - pucIE = pucIEInfo; - - ucOldSecMode = kalP2PGetCipher(prAdapter->prGlueInfo); - - IE_FOR_EACH(pucIE, u4IELen, u2Offset) { - switch (IE_ID(pucIE)) { - case ELEM_ID_SSID: /* 0 */ /* V */ /* Done */ - { - DBGLOG(P2P, TRACE, ("SSID update\n")); - - /* Update when starting GO. */ - COPY_SSID(prP2pBssInfo->aucSSID, - prP2pBssInfo->ucSSIDLen, - SSID_IE(pucIE)->aucSSID, - SSID_IE(pucIE)->ucLength); - - COPY_SSID(prP2pSpecificBssInfo->aucGroupSsid, - prP2pSpecificBssInfo->u2GroupSsidLen, - SSID_IE(pucIE)->aucSSID, - SSID_IE(pucIE)->ucLength); - - } - break; - case ELEM_ID_SUP_RATES: /* 1 */ /* V */ /* Done */ - { - DBGLOG(P2P, TRACE, ("Support Rate IE\n")); - kalMemCopy(prP2pBssInfo->aucAllSupportedRates, - SUP_RATES_IE(pucIE)->aucSupportedRates, - SUP_RATES_IE(pucIE)->ucLength); - - prP2pBssInfo->ucAllSupportedRatesLen = SUP_RATES_IE(pucIE)->ucLength; - - DBGLOG_MEM8(P2P, TRACE, SUP_RATES_IE(pucIE)->aucSupportedRates, SUP_RATES_IE(pucIE)->ucLength); - } - break; - case ELEM_ID_DS_PARAM_SET: /* 3 */ /* V */ /* Done */ - { - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - - DBGLOG(P2P, TRACE, ("DS PARAM IE\n")); - - ASSERT(prP2pConnSettings->ucOperatingChnl == DS_PARAM_IE(pucIE)->ucCurrChnl); - - if (prP2pConnSettings->eBand != BAND_2G4) { - ASSERT(FALSE); - break; - } - - //prP2pBssInfo->ucPrimaryChannel = DS_PARAM_IE(pucIE)->ucCurrChnl; - - //prP2pBssInfo->eBand = BAND_2G4; - } - break; - case ELEM_ID_TIM: /* 5 */ /* V */ - DBGLOG(P2P, TRACE, ("TIM IE\n")); - TIM_IE(pucIE)->ucDTIMPeriod = prP2pBssInfo->ucDTIMPeriod; - break; - case ELEM_ID_ERP_INFO: /* 42 */ /* V */ - { -#if 1 - /* This IE would dynamic change due to FW detection change is required. */ - DBGLOG(P2P, TRACE, ("ERP IE will be over write by driver\n")); - DBGLOG(P2P, TRACE, (" ucERP: %x. \n", ERP_INFO_IE(pucIE)->ucERP)); - -#else - /* This IE would dynamic change due to FW detection change is required. */ - DBGLOG(P2P, TRACE, ("ERP IE.\n")); - - prP2pBssInfo->ucPhyTypeSet |= PHY_TYPE_SET_802_11GN; - - ASSERT(prP2pBssInfo->eBand == BAND_2G4); - - prP2pBssInfo->fgObssErpProtectMode = ((ERP_INFO_IE(pucIE)->ucERP & ERP_INFO_USE_PROTECTION)? TRUE : FALSE); - - prP2pBssInfo->fgErpProtectMode = ((ERP_INFO_IE(pucIE)->ucERP & (ERP_INFO_USE_PROTECTION | ERP_INFO_NON_ERP_PRESENT))? TRUE : FALSE); -#endif - - } - break; - case ELEM_ID_HT_CAP: /* 45 */ /* V */ - { -#if 1 - DBGLOG(P2P, TRACE, ("HT CAP IE would be overwritten by driver\n")); - - DBGLOG(P2P, TRACE, ("HT Cap Info:%x, AMPDU Param:%x\n", HT_CAP_IE(pucIE)->u2HtCapInfo, HT_CAP_IE(pucIE)->ucAmpduParam)); - - DBGLOG(P2P, TRACE, ("HT Extended Cap Info:%x, TX Beamforming Cap Info:%lx, Ant Selection Cap Info%x \n", - HT_CAP_IE(pucIE)->u2HtExtendedCap, - HT_CAP_IE(pucIE)->u4TxBeamformingCap, - HT_CAP_IE(pucIE)->ucAselCap)); -#else - prP2pBssInfo->ucPhyTypeSet |= PHY_TYPE_SET_802_11N; - - /* u2HtCapInfo */ - if ((HT_CAP_IE(pucIE)->u2HtCapInfo & - (HT_CAP_INFO_SUP_CHNL_WIDTH | HT_CAP_INFO_SHORT_GI_40M | HT_CAP_INFO_DSSS_CCK_IN_40M)) == 0) { - prP2pBssInfo->fgAssoc40mBwAllowed = FALSE; - } - else { - prP2pBssInfo->fgAssoc40mBwAllowed = TRUE; - } - - if ((HT_CAP_IE(pucIE)->u2HtCapInfo & - (HT_CAP_INFO_SHORT_GI_20M | HT_CAP_INFO_SHORT_GI_40M)) == 0) { - prAdapter->rWifiVar.rConnSettings.fgRxShortGIDisabled = TRUE; - } - else { - prAdapter->rWifiVar.rConnSettings.fgRxShortGIDisabled = FALSE; - } - - /* ucAmpduParam */ - DBGLOG(P2P, TRACE, ("AMPDU setting from supplicant:0x%x, & default value:0x%x\n", (UINT_8)HT_CAP_IE(pucIE)->ucAmpduParam, (UINT_8)AMPDU_PARAM_DEFAULT_VAL)); - - /* rSupMcsSet */ - /* Can do nothing. the field is default value from other configuration. */ - //HT_CAP_IE(pucIE)->rSupMcsSet; - - /* u2HtExtendedCap */ - ASSERT(HT_CAP_IE(pucIE)->u2HtExtendedCap == (HT_EXT_CAP_DEFAULT_VAL & ~(HT_EXT_CAP_PCO | HT_EXT_CAP_PCO_TRANS_TIME_NONE))); - - /* u4TxBeamformingCap */ - ASSERT(HT_CAP_IE(pucIE)->u4TxBeamformingCap == TX_BEAMFORMING_CAP_DEFAULT_VAL); - - /* ucAselCap */ - ASSERT(HT_CAP_IE(pucIE)->ucAselCap == ASEL_CAP_DEFAULT_VAL); -#endif - } - break; - case ELEM_ID_RSN: /* 48 */ /* V */ - { - RSN_INFO_T rRsnIe; - - DBGLOG(P2P, TRACE, ("RSN IE\n")); - kalP2PSetCipher(prAdapter->prGlueInfo, IW_AUTH_CIPHER_CCMP); - ucNewSecMode = TRUE; - - if (rsnParseRsnIE(prAdapter, RSN_IE(pucIE), &rRsnIe)) { - prP2pBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]; - prP2pBssInfo->u4RsnSelectedGroupCipher = RSN_CIPHER_SUITE_CCMP; - prP2pBssInfo->u4RsnSelectedPairwiseCipher = RSN_CIPHER_SUITE_CCMP; - prP2pBssInfo->u4RsnSelectedAKMSuite = RSN_AKM_SUITE_PSK; - prP2pBssInfo->u2RsnSelectedCapInfo = rRsnIe.u2RsnCap; - } - } - break; - case ELEM_ID_EXTENDED_SUP_RATES: /* 50 */ /* V */ - /* Be attention, ELEM_ID_SUP_RATES should be placed before ELEM_ID_EXTENDED_SUP_RATES. */ - DBGLOG(P2P, TRACE, ("Ex Support Rate IE\n")); - kalMemCopy(&(prP2pBssInfo->aucAllSupportedRates[prP2pBssInfo->ucAllSupportedRatesLen]), - EXT_SUP_RATES_IE(pucIE)->aucExtSupportedRates, - EXT_SUP_RATES_IE(pucIE)->ucLength); - - DBGLOG_MEM8(P2P, TRACE, EXT_SUP_RATES_IE(pucIE)->aucExtSupportedRates, EXT_SUP_RATES_IE(pucIE)->ucLength); - - prP2pBssInfo->ucAllSupportedRatesLen += EXT_SUP_RATES_IE(pucIE)->ucLength; - break; - case ELEM_ID_HT_OP: /* 61 */ /* V */ // TODO: - { -#if 1 - DBGLOG(P2P, TRACE, ("HT OP IE would be overwritten by driver\n")); - - DBGLOG(P2P, TRACE, (" Primary Channel: %x, Info1: %x, Info2: %x, Info3: %x\n", - HT_OP_IE(pucIE)->ucPrimaryChannel, - HT_OP_IE(pucIE)->ucInfo1, - HT_OP_IE(pucIE)->u2Info2, - HT_OP_IE(pucIE)->u2Info3)); -#else - UINT_16 u2Info2 = 0; - prP2pBssInfo->ucPhyTypeSet |= PHY_TYPE_SET_802_11N; - - DBGLOG(P2P, TRACE, ("HT OP IE\n")); - - /* ucPrimaryChannel. */ - ASSERT(HT_OP_IE(pucIE)->ucPrimaryChannel == prP2pBssInfo->ucPrimaryChannel); - - /* ucInfo1 */ - prP2pBssInfo->ucHtOpInfo1 = HT_OP_IE(pucIE)->ucInfo1; - - /* u2Info2 */ - u2Info2 = HT_OP_IE(pucIE)->u2Info2; - - if (u2Info2 & HT_OP_INFO2_NON_GF_HT_STA_PRESENT) { - ASSERT(prP2pBssInfo->eGfOperationMode != GF_MODE_NORMAL); - u2Info2 &= ~HT_OP_INFO2_NON_GF_HT_STA_PRESENT; - } - - if (u2Info2 & HT_OP_INFO2_OBSS_NON_HT_STA_PRESENT) { - prP2pBssInfo->eObssHtProtectMode = HT_PROTECT_MODE_NON_MEMBER; - u2Info2 &= ~HT_OP_INFO2_OBSS_NON_HT_STA_PRESENT; - } - - switch (u2Info2 & HT_OP_INFO2_HT_PROTECTION) { - case HT_PROTECT_MODE_NON_HT: - prP2pBssInfo->eHtProtectMode = HT_PROTECT_MODE_NON_HT; - break; - case HT_PROTECT_MODE_NON_MEMBER: - prP2pBssInfo->eHtProtectMode = HT_PROTECT_MODE_NONE; - prP2pBssInfo->eObssHtProtectMode = HT_PROTECT_MODE_NON_MEMBER; - break; - default: - prP2pBssInfo->eHtProtectMode = HT_OP_IE(pucIE)->u2Info2; - break; - } - - /* u2Info3 */ - prP2pBssInfo->u2HtOpInfo3 = HT_OP_IE(pucIE)->u2Info3; - - /* aucBasicMcsSet */ - DBGLOG_MEM8(P2P, TRACE, HT_OP_IE(pucIE)->aucBasicMcsSet, 16); -#endif - } - break; - case ELEM_ID_OBSS_SCAN_PARAMS: /* 74 */ /* V */ - { - DBGLOG(P2P, TRACE, ("ELEM_ID_OBSS_SCAN_PARAMS IE would be replaced by driver\n")); - } - break; - case ELEM_ID_EXTENDED_CAP: /* 127 */ /* V */ - { - DBGLOG(P2P, TRACE, ("ELEM_ID_EXTENDED_CAP IE would be replaced by driver\n")); - } - break; - case ELEM_ID_VENDOR: /* 221 */ /* V */ - DBGLOG(P2P, TRACE, ("Vender Specific IE\n")); - { - UINT_8 ucOuiType; - UINT_16 u2SubTypeVersion; - if (rsnParseCheckForWFAInfoElem(prAdapter, pucIE, &ucOuiType, &u2SubTypeVersion)) { - if ((ucOuiType == VENDOR_OUI_TYPE_WPA) && - (u2SubTypeVersion == VERSION_WPA)) { - kalP2PSetCipher(prAdapter->prGlueInfo, IW_AUTH_CIPHER_TKIP); - ucNewSecMode = TRUE; - } - else if ((ucOuiType == VENDOR_OUI_TYPE_WPS)) { - kalP2PUpdateWSC_IE(prAdapter->prGlueInfo, 0, pucIE, IE_SIZE(pucIE)); - } - - // WMM here. - } - else if (p2pFuncParseCheckForP2PInfoElem(prAdapter, pucIE, &ucOuiType)) { - // TODO Store the whole P2P IE & generate later. - // Be aware that there may be one or more P2P IE. - if (ucOuiType == VENDOR_OUI_TYPE_P2P) { - kalMemCopy(&prP2pSpecificBssInfo->aucAttributesCache[prP2pSpecificBssInfo->u2AttributeLen], - pucIE, - IE_SIZE(pucIE)); - - prP2pSpecificBssInfo->u2AttributeLen += IE_SIZE(pucIE); - } - } - else { - - kalMemCopy(&prP2pSpecificBssInfo->aucAttributesCache[prP2pSpecificBssInfo->u2AttributeLen], - pucIE, - IE_SIZE(pucIE)); - - prP2pSpecificBssInfo->u2AttributeLen += IE_SIZE(pucIE); - DBGLOG(P2P, TRACE, ("Driver unprocessed Vender Specific IE\n")); - ASSERT(FALSE); - } - - // TODO: Store other Vender IE except for WMM Param. - } - break; - default: - DBGLOG(P2P, TRACE, ("Unprocessed element ID:%d \n", IE_ID(pucIE))); - break; - } - } - - if (!ucNewSecMode && ucOldSecMode) - kalP2PSetCipher(prAdapter->prGlueInfo, IW_AUTH_CIPHER_NONE); - - } while (FALSE); - - return; -} /* p2pFuncParseBeaconContent */ - - - - -P_BSS_DESC_T -p2pFuncKeepOnConnection ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo, - IN P_P2P_CHNL_REQ_INFO_T prChnlReqInfo, - IN P_P2P_SCAN_REQ_INFO_T prScanReqInfo - ) -{ - P_BSS_DESC_T prTargetBss = (P_BSS_DESC_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && - (prConnReqInfo != NULL) && - (prChnlReqInfo != NULL) && - (prScanReqInfo != NULL)); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - if (prP2pBssInfo->eCurrentOPMode != OP_MODE_INFRASTRUCTURE) { - break; - } - - // Update connection request information. - ASSERT(prConnReqInfo->fgIsConnRequest == TRUE); - - /* Find BSS Descriptor first. */ - prTargetBss = scanP2pSearchDesc(prAdapter, - prP2pBssInfo, - prConnReqInfo); - - if (prTargetBss == NULL) { - /* Update scan parameter... to scan target device. */ - prScanReqInfo->ucNumChannelList = 1; - prScanReqInfo->eScanType = SCAN_TYPE_ACTIVE_SCAN; - prScanReqInfo->eChannelSet = SCAN_CHANNEL_FULL; - prScanReqInfo->u4BufLength = 0; /* Prevent other P2P ID in IE. */ - prScanReqInfo->fgIsAbort = TRUE; - } - else { - prChnlReqInfo->u8Cookie = 0; - prChnlReqInfo->ucReqChnlNum = prTargetBss->ucChannelNum; - prChnlReqInfo->eBand = prTargetBss->eBand; - prChnlReqInfo->eChnlSco = prTargetBss->eSco; - prChnlReqInfo->u4MaxInterval = AIS_JOIN_CH_REQUEST_INTERVAL; - prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GC_JOIN_REQ; - } - - } while (FALSE); - - return prTargetBss; -} /* p2pFuncKeepOnConnection */ - -/* Currently Only for ASSOC Response Frame. */ -VOID -p2pFuncStoreAssocRspIEBuffer ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_P2P_JOIN_INFO_T prJoinInfo = (P_P2P_JOIN_INFO_T)NULL; - P_WLAN_ASSOC_RSP_FRAME_T prAssocRspFrame = (P_WLAN_ASSOC_RSP_FRAME_T)NULL; - INT_16 i2IELen = 0; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prSwRfb != NULL)); - - prAssocRspFrame = (P_WLAN_ASSOC_RSP_FRAME_T)prSwRfb->pvHeader; - - if (prAssocRspFrame->u2FrameCtrl != MAC_FRAME_ASSOC_RSP) { - break; - } - - i2IELen = prSwRfb->u2PacketLen - (WLAN_MAC_HEADER_LEN + - CAP_INFO_FIELD_LEN + - STATUS_CODE_FIELD_LEN + - AID_FIELD_LEN); - - - if (i2IELen <= 0) { - break; - } - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - prJoinInfo = &(prP2pFsmInfo->rJoinInfo); - prJoinInfo->u4BufLength = (UINT_32)i2IELen; - - kalMemCopy(prJoinInfo->aucIEBuf, prAssocRspFrame->aucInfoElem, prJoinInfo->u4BufLength); - - } while (FALSE); - - - return; -} /* p2pFuncStoreAssocRspIEBuffer */ - - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set Packet Filter. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] pvSetBuffer Pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_NOT_SUPPORTED -* \retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFuncMgmtFrameRegister ( - IN P_ADAPTER_T prAdapter, - IN UINT_16 u2FrameType, - IN BOOLEAN fgIsRegistered, - OUT PUINT_32 pu4P2pPacketFilter - ) -{ - UINT_32 u4NewPacketFilter = 0; - - DEBUGFUNC("p2pFuncMgmtFrameRegister"); - - do { - ASSERT_BREAK(prAdapter != NULL); - - if (pu4P2pPacketFilter) { - u4NewPacketFilter = *pu4P2pPacketFilter; - } - - switch (u2FrameType) { - case MAC_FRAME_PROBE_REQ: - if (fgIsRegistered) { - u4NewPacketFilter |= PARAM_PACKET_FILTER_PROBE_REQ; - DBGLOG(P2P, TRACE, ("Open packet filer probe request\n")); - } - else { - u4NewPacketFilter &= ~PARAM_PACKET_FILTER_PROBE_REQ; - DBGLOG(P2P, TRACE, ("Close packet filer probe request\n")); - } - break; - case MAC_FRAME_ACTION: - if (fgIsRegistered) { - u4NewPacketFilter |= PARAM_PACKET_FILTER_ACTION_FRAME; - DBGLOG(P2P, TRACE, ("Open packet filer action frame.\n")); - } - else { - u4NewPacketFilter &= ~PARAM_PACKET_FILTER_ACTION_FRAME; - DBGLOG(P2P, TRACE, ("Close packet filer action frame.\n")); - } - break; - default: - DBGLOG(P2P, TRACE, ("Ask frog to add code for mgmt:%x\n", u2FrameType)); - break; - } - - if (pu4P2pPacketFilter) { - *pu4P2pPacketFilter = u4NewPacketFilter; - } - -// u4NewPacketFilter |= prAdapter->u4OsPacketFilter; - - prAdapter->u4OsPacketFilter &= ~PARAM_PACKET_FILTER_P2P_MASK; - prAdapter->u4OsPacketFilter |= u4NewPacketFilter; - - DBGLOG(P2P, TRACE, ("P2P Set PACKET filter:0x%lx\n", prAdapter->u4OsPacketFilter)); - - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_RX_FILTER, - TRUE, - FALSE, - FALSE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(UINT_32), - (PUINT_8)&prAdapter->u4OsPacketFilter, - &u4NewPacketFilter, - sizeof(u4NewPacketFilter) - ); - - } while (FALSE); - - return; -} /* p2pFuncMgmtFrameRegister */ - - -VOID -p2pFuncUpdateMgmtFrameRegister ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4OsFilter - ) -{ - - do { - - prAdapter->rWifiVar.prP2pFsmInfo->u4P2pPacketFilter = u4OsFilter; - - if ((prAdapter->u4OsPacketFilter & PARAM_PACKET_FILTER_P2P_MASK) ^ u4OsFilter) { - - prAdapter->u4OsPacketFilter &= ~PARAM_PACKET_FILTER_P2P_MASK; - - prAdapter->u4OsPacketFilter |= (u4OsFilter & PARAM_PACKET_FILTER_P2P_MASK); - - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_RX_FILTER, - TRUE, - FALSE, - FALSE, - nicCmdEventSetCommon, - nicOidCmdTimeoutCommon, - sizeof(UINT_32), - (PUINT_8)&prAdapter->u4OsPacketFilter, - &u4OsFilter, - sizeof(u4OsFilter) - ); - DBGLOG(P2P, TRACE, ("P2P Set PACKET filter:0x%lx\n", prAdapter->u4OsPacketFilter)); - } - - } while (FALSE); - - - - - return; -} /* p2pFuncUpdateMgmtFrameRegister */ - - -VOID -p2pFuncGetStationInfo ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucMacAddr, - OUT P_P2P_STATION_INFO_T prStaInfo - ) -{ - - do { - ASSERT_BREAK((prAdapter != NULL) && - (pucMacAddr != NULL) && - (prStaInfo != NULL)); - - prStaInfo->u4InactiveTime = 0; - prStaInfo->u4RxBytes = 0; - prStaInfo->u4TxBytes = 0; - prStaInfo->u4RxPackets = 0; - prStaInfo->u4TxPackets = 0; - // TODO: - - } while (FALSE); - - return; -} /* p2pFuncGetStationInfo */ - -P_MSDU_INFO_T -p2pFuncProcessP2pProbeRsp ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMgmtTxMsdu - ) -{ - P_MSDU_INFO_T prRetMsduInfo = prMgmtTxMsdu; - P_WLAN_PROBE_RSP_FRAME_T prProbeRspFrame = (P_WLAN_PROBE_RSP_FRAME_T)NULL; - PUINT_8 pucIEBuf = (PUINT_8)NULL; - UINT_16 u2Offset = 0, u2IELength = 0, u2ProbeRspHdrLen = 0; - BOOLEAN fgIsP2PIE = FALSE, fgIsWSCIE = FALSE; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - UINT_16 u2EstimateSize = 0, u2EstimatedExtraIELen = 0; - UINT_32 u4IeArraySize = 0, u4Idx = 0; - - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMgmtTxMsdu != NULL)); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - //3 Make sure this is probe response frame. - prProbeRspFrame = (P_WLAN_PROBE_RSP_FRAME_T)((UINT_32)prMgmtTxMsdu->prPacket + MAC_TX_RESERVED_FIELD); - ASSERT_BREAK((prProbeRspFrame->u2FrameCtrl & MASK_FRAME_TYPE) == MAC_FRAME_PROBE_RSP); - - //3 Get the importent P2P IE. - u2ProbeRspHdrLen = (WLAN_MAC_MGMT_HEADER_LEN + TIMESTAMP_FIELD_LEN + BEACON_INTERVAL_FIELD_LEN + CAP_INFO_FIELD_LEN); - pucIEBuf = prProbeRspFrame->aucInfoElem; - u2IELength = prMgmtTxMsdu->u2FrameLength - u2ProbeRspHdrLen; - IE_FOR_EACH(pucIEBuf, u2IELength, u2Offset) { - switch (IE_ID(pucIEBuf)) { - case ELEM_ID_SSID: - { - - COPY_SSID(prP2pBssInfo->aucSSID, - prP2pBssInfo->ucSSIDLen, - SSID_IE(pucIEBuf)->aucSSID, - SSID_IE(pucIEBuf)->ucLength); - } - break; - case ELEM_ID_VENDOR: - { - UINT_8 ucOuiType = 0; - UINT_16 u2SubTypeVersion = 0; - if (rsnParseCheckForWFAInfoElem(prAdapter, pucIEBuf, &ucOuiType, &u2SubTypeVersion)) { - if (ucOuiType == VENDOR_OUI_TYPE_WPS) { - kalP2PUpdateWSC_IE(prAdapter->prGlueInfo, 2, pucIEBuf, IE_SIZE(pucIEBuf)); - fgIsWSCIE = TRUE; - } - - } - - else if (p2pFuncParseCheckForP2PInfoElem(prAdapter, pucIEBuf, &ucOuiType)) { - if (ucOuiType == VENDOR_OUI_TYPE_P2P) { - //2 Note(frog): I use WSC IE buffer for Probe Request to store the P2P IE for Probe Response. - kalP2PUpdateWSC_IE(prAdapter->prGlueInfo, 1, pucIEBuf, IE_SIZE(pucIEBuf)); - fgIsP2PIE = TRUE; - } - - } - - } - break; - default: - break; - } - - } - - - //3 Check the total size & current frame. - u2EstimateSize = WLAN_MAC_MGMT_HEADER_LEN + \ - TIMESTAMP_FIELD_LEN + \ - BEACON_INTERVAL_FIELD_LEN + \ - CAP_INFO_FIELD_LEN + \ - (ELEM_HDR_LEN + ELEM_MAX_LEN_SSID) + \ - (ELEM_HDR_LEN + ELEM_MAX_LEN_SUP_RATES) + \ - (ELEM_HDR_LEN + ELEM_MAX_LEN_DS_PARAMETER_SET); - - u2EstimatedExtraIELen = 0; - - u4IeArraySize = sizeof(txProbeRspIETable)/sizeof(APPEND_VAR_IE_ENTRY_T); - for (u4Idx = 0; u4Idx < u4IeArraySize; u4Idx++) { - if (txProbeRspIETable[u4Idx].u2EstimatedFixedIELen) { - u2EstimatedExtraIELen += txProbeRspIETable[u4Idx].u2EstimatedFixedIELen; - } - - else { - ASSERT(txProbeRspIETable[u4Idx].pfnCalculateVariableIELen); - - u2EstimatedExtraIELen += (UINT_16)(txProbeRspIETable[u4Idx].pfnCalculateVariableIELen(prAdapter, - NETWORK_TYPE_P2P_INDEX, - NULL)); - } - - } - - - if (fgIsWSCIE) { - u2EstimatedExtraIELen += kalP2PCalWSC_IELen(prAdapter->prGlueInfo, 2); - } - - if (fgIsP2PIE) { - u2EstimatedExtraIELen += kalP2PCalWSC_IELen(prAdapter->prGlueInfo, 1); - } - - - - - if ((u2EstimateSize += u2EstimatedExtraIELen) > (prRetMsduInfo->u2FrameLength)) { - prRetMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimateSize); - - if (prRetMsduInfo == NULL) { - DBGLOG(P2P, WARN, ("No packet for sending new probe response, use original one\n")); - prRetMsduInfo = prMgmtTxMsdu; - break; - } - - - prRetMsduInfo->ucNetworkType = NETWORK_TYPE_P2P_INDEX; - } - - - //3 Compose / Re-compose probe response frame. - bssComposeBeaconProbeRespFrameHeaderAndFF( - (PUINT_8)((UINT_32)(prRetMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD), - prProbeRspFrame->aucDestAddr, - prProbeRspFrame->aucSrcAddr, - prProbeRspFrame->aucBSSID, - prProbeRspFrame->u2BeaconInterval, - prProbeRspFrame->u2CapInfo); - - prRetMsduInfo->u2FrameLength = (WLAN_MAC_MGMT_HEADER_LEN + TIMESTAMP_FIELD_LEN + BEACON_INTERVAL_FIELD_LEN + CAP_INFO_FIELD_LEN); - - bssBuildBeaconProbeRespFrameCommonIEs(prRetMsduInfo, - prP2pBssInfo, - prProbeRspFrame->aucDestAddr); - - - for (u4Idx = 0; u4Idx < u4IeArraySize; u4Idx++) { - if (txProbeRspIETable[u4Idx].pfnAppendIE) { - txProbeRspIETable[u4Idx].pfnAppendIE(prAdapter, prRetMsduInfo); - } - - } - - - if (fgIsWSCIE) { - kalP2PGenWSC_IE(prAdapter->prGlueInfo, - 2, - (PUINT_8)((UINT_32)prRetMsduInfo->prPacket + (UINT_32)prRetMsduInfo->u2FrameLength)); - - prRetMsduInfo->u2FrameLength += (UINT_16)kalP2PCalWSC_IELen(prAdapter->prGlueInfo, 2); - } - - if (fgIsP2PIE) { - kalP2PGenWSC_IE(prAdapter->prGlueInfo, - 1, - (PUINT_8)((UINT_32)prRetMsduInfo->prPacket + (UINT_32)prRetMsduInfo->u2FrameLength)); - - prRetMsduInfo->u2FrameLength += (UINT_16)kalP2PCalWSC_IELen(prAdapter->prGlueInfo, 1); - } - - - } while (FALSE); - - if (prRetMsduInfo != prMgmtTxMsdu) { - cnmMgtPktFree(prAdapter, prMgmtTxMsdu); - } - - - return prRetMsduInfo; -} /* p2pFuncProcessP2pProbeRsp */ - - -#if 0 //LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) -UINT_32 -p2pFuncCalculateExtra_IELenForBeacon ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ) -{ - - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpeBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - UINT_32 u4IELen = 0; - - do { - ASSERT_BREAK((prAdapter != NULL) && (eNetTypeIndex == NETWORK_TYPE_P2P_INDEX)); - - if (p2pFuncIsAPMode(prAdapter->rWifiVar.prP2pFsmInfo)) { - break; - } - - prP2pSpeBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; - - u4IELen = prP2pSpeBssInfo->u2IELenForBCN; - - } while (FALSE); - - return u4IELen; -} /* p2pFuncCalculateP2p_IELenForBeacon */ - -VOID -p2pFuncGenerateExtra_IEForBeacon ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpeBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - PUINT_8 pucIEBuf = (PUINT_8)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL)); - - prP2pSpeBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; - - if (p2pFuncIsAPMode(prAdapter->rWifiVar.prP2pFsmInfo)) { - - break; - } - - pucIEBuf = (PUINT_8)((UINT_32)prMsduInfo->prPacket + (UINT_32)prMsduInfo->u2FrameLength); - - kalMemCopy(pucIEBuf, prP2pSpeBssInfo->aucBeaconIECache, prP2pSpeBssInfo->u2IELenForBCN); - - prMsduInfo->u2FrameLength += prP2pSpeBssInfo->u2IELenForBCN; - - } while (FALSE); - - return; -} /* p2pFuncGenerateExtra_IEForBeacon */ - - -#else -UINT_32 -p2pFuncCalculateP2p_IELenForBeacon ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ) -{ - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpeBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - UINT_32 u4IELen = 0; - - do { - ASSERT_BREAK((prAdapter != NULL) && (eNetTypeIndex == NETWORK_TYPE_P2P_INDEX)); - - if (!prAdapter->fgIsP2PRegistered) { - break; - } - - - if (p2pFuncIsAPMode(prAdapter->rWifiVar.prP2pFsmInfo)) { - break; - } - - prP2pSpeBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; - - u4IELen = prP2pSpeBssInfo->u2AttributeLen; - - } while (FALSE); - - return u4IELen; -} /* p2pFuncCalculateP2p_IELenForBeacon */ - - -VOID -p2pFuncGenerateP2p_IEForBeacon ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpeBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - PUINT_8 pucIEBuf = (PUINT_8)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL)); - - if (!prAdapter->fgIsP2PRegistered) { - break; - } - - prP2pSpeBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; - - if (p2pFuncIsAPMode(prAdapter->rWifiVar.prP2pFsmInfo)) { - - break; - } - - pucIEBuf = (PUINT_8)((UINT_32)prMsduInfo->prPacket + (UINT_32)prMsduInfo->u2FrameLength); - - kalMemCopy(pucIEBuf, prP2pSpeBssInfo->aucAttributesCache, prP2pSpeBssInfo->u2AttributeLen); - - prMsduInfo->u2FrameLength += prP2pSpeBssInfo->u2AttributeLen; - - } while (FALSE); - - return; -} /* p2pFuncGenerateP2p_IEForBeacon */ - - - - - -UINT_32 -p2pFuncCalculateWSC_IELenForBeacon ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ) -{ - if (eNetTypeIndex != NETWORK_TYPE_P2P_INDEX) { - return 0; - } - - return kalP2PCalWSC_IELen(prAdapter->prGlueInfo, 0); -} /* p2pFuncCalculateP2p_IELenForBeacon */ - - -VOID -p2pFuncGenerateWSC_IEForBeacon ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - PUINT_8 pucBuffer; - UINT_16 u2IELen = 0; - ASSERT(prAdapter); - ASSERT(prMsduInfo); - - if (prMsduInfo->ucNetworkType != NETWORK_TYPE_P2P_INDEX) { - return; - } - - u2IELen = (UINT_16)kalP2PCalWSC_IELen(prAdapter->prGlueInfo, 0); - - pucBuffer = (PUINT_8)((UINT_32)prMsduInfo->prPacket + - (UINT_32)prMsduInfo->u2FrameLength); - - ASSERT(pucBuffer); - - // TODO: Check P2P FSM State. - kalP2PGenWSC_IE(prAdapter->prGlueInfo, - 0, - pucBuffer); - - prMsduInfo->u2FrameLength += u2IELen; - - return; -} /* p2pFuncGenerateP2p_IEForBeacon */ - -#endif -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to calculate P2P IE length for Beacon frame. -* -* @param[in] eNetTypeIndex Specify which network -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @return The length of P2P IE added -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -p2pFuncCalculateP2p_IELenForAssocRsp ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ) -{ - - if (eNetTypeIndex != NETWORK_TYPE_P2P_INDEX) { - return 0; - } - - return p2pFuncCalculateP2P_IELen(prAdapter, - eNetTypeIndex, - prStaRec, - txAssocRspAttributesTable, - sizeof(txAssocRspAttributesTable)/sizeof(APPEND_VAR_ATTRI_ENTRY_T)); - -} /* p2pFuncCalculateP2p_IELenForAssocRsp */ - - - - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to generate P2P IE for Beacon frame. -* -* @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T. -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pFuncGenerateP2p_IEForAssocRsp ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL)); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - if (IS_STA_P2P_TYPE(prStaRec)) { - DBGLOG(P2P, TRACE, ("Generate NULL P2P IE for Assoc Rsp.\n")); - - p2pFuncGenerateP2P_IE(prAdapter, - TRUE, - &prMsduInfo->u2FrameLength, - prMsduInfo->prPacket, - 1500, - txAssocRspAttributesTable, - sizeof(txAssocRspAttributesTable)/sizeof(APPEND_VAR_ATTRI_ENTRY_T)); - } - else { - - DBGLOG(P2P, TRACE, ("Legacy device, no P2P IE.\n")); - } - - } while (FALSE); - - return; - -} /* p2pFuncGenerateP2p_IEForAssocRsp */ - - - - -UINT_32 -p2pFuncCalculateP2P_IELen ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec, - IN APPEND_VAR_ATTRI_ENTRY_T arAppendAttriTable[], - IN UINT_32 u4AttriTableSize - ) -{ - - UINT_32 u4OverallAttriLen, u4Dummy; - UINT_16 u2EstimatedFixedAttriLen; - UINT_32 i; - - - /* Overall length of all Attributes */ - u4OverallAttriLen = 0; - - for (i = 0; i < u4AttriTableSize; i++) { - u2EstimatedFixedAttriLen = arAppendAttriTable[i].u2EstimatedFixedAttriLen; - - if (u2EstimatedFixedAttriLen) { - u4OverallAttriLen += u2EstimatedFixedAttriLen; - } - else { - ASSERT(arAppendAttriTable[i].pfnCalculateVariableAttriLen); - - u4OverallAttriLen += - arAppendAttriTable[i].pfnCalculateVariableAttriLen(prAdapter, prStaRec); - } - } - - u4Dummy = u4OverallAttriLen; - u4OverallAttriLen += P2P_IE_OUI_HDR; - - for (;(u4Dummy > P2P_MAXIMUM_ATTRIBUTE_LEN);) { - u4OverallAttriLen += P2P_IE_OUI_HDR; - u4Dummy -= P2P_MAXIMUM_ATTRIBUTE_LEN; - } - - return u4OverallAttriLen; -} /* p2pFuncCalculateP2P_IELen */ - - -VOID -p2pFuncGenerateP2P_IE ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize, - IN APPEND_VAR_ATTRI_ENTRY_T arAppendAttriTable[], - IN UINT_32 u4AttriTableSize - ) -{ - PUINT_8 pucBuffer = (PUINT_8)NULL; - P_IE_P2P_T prIeP2P = (P_IE_P2P_T)NULL; - UINT_32 u4OverallAttriLen; - UINT_32 u4AttriLen; - UINT_8 aucWfaOui[] = VENDOR_OUI_WFA_SPECIFIC; - UINT_8 aucTempBuffer[P2P_MAXIMUM_ATTRIBUTE_LEN]; - UINT_32 i; - - - do { - ASSERT_BREAK((prAdapter != NULL) && (pucBuf != NULL)); - - pucBuffer = (PUINT_8)((UINT_32)pucBuf + (*pu2Offset)); - - ASSERT_BREAK(pucBuffer != NULL); - - /* Check buffer length is still enough. */ - ASSERT_BREAK((u2BufSize - (*pu2Offset)) >= P2P_IE_OUI_HDR); - - prIeP2P = (P_IE_P2P_T)pucBuffer; - - prIeP2P->ucId = ELEM_ID_P2P; - - prIeP2P->aucOui[0] = aucWfaOui[0]; - prIeP2P->aucOui[1] = aucWfaOui[1]; - prIeP2P->aucOui[2] = aucWfaOui[2]; - prIeP2P->ucOuiType = VENDOR_OUI_TYPE_P2P; - - (*pu2Offset) += P2P_IE_OUI_HDR; - - /* Overall length of all Attributes */ - u4OverallAttriLen = 0; - - - for (i = 0; i < u4AttriTableSize; i++) { - - if (arAppendAttriTable[i].pfnAppendAttri) { - u4AttriLen = arAppendAttriTable[i].pfnAppendAttri(prAdapter, fgIsAssocFrame, pu2Offset, pucBuf, u2BufSize); - - u4OverallAttriLen += u4AttriLen; - - if (u4OverallAttriLen > P2P_MAXIMUM_ATTRIBUTE_LEN) { - u4OverallAttriLen -= P2P_MAXIMUM_ATTRIBUTE_LEN; - - prIeP2P->ucLength = (VENDOR_OUI_TYPE_LEN + P2P_MAXIMUM_ATTRIBUTE_LEN); - - pucBuffer = (PUINT_8)((UINT_32)prIeP2P + (VENDOR_OUI_TYPE_LEN + P2P_MAXIMUM_ATTRIBUTE_LEN)); - - prIeP2P = (P_IE_P2P_T)((UINT_32)prIeP2P + - (ELEM_HDR_LEN + (VENDOR_OUI_TYPE_LEN + P2P_MAXIMUM_ATTRIBUTE_LEN))); - - kalMemCopy(aucTempBuffer, pucBuffer, u4OverallAttriLen); - - prIeP2P->ucId = ELEM_ID_P2P; - - prIeP2P->aucOui[0] = aucWfaOui[0]; - prIeP2P->aucOui[1] = aucWfaOui[1]; - prIeP2P->aucOui[2] = aucWfaOui[2]; - prIeP2P->ucOuiType = VENDOR_OUI_TYPE_P2P; - - kalMemCopy(prIeP2P->aucP2PAttributes, aucTempBuffer, u4OverallAttriLen); - (*pu2Offset) += P2P_IE_OUI_HDR; - } - - } - - } - - prIeP2P->ucLength = (UINT_8)(VENDOR_OUI_TYPE_LEN + u4OverallAttriLen); - - - } while (FALSE); - - return; -} /* p2pFuncGenerateP2P_IE */ - -UINT_32 -p2pFuncAppendAttriStatusForAssocRsp ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ) -{ - PUINT_8 pucBuffer; - P_P2P_ATTRI_STATUS_T prAttriStatus; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - UINT_32 u4AttriLen = 0; - - ASSERT(prAdapter); - ASSERT(pucBuf); - - prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - - if (fgIsAssocFrame) { - return u4AttriLen; - } - - // TODO: For assoc request P2P IE check in driver & return status in P2P IE. - - pucBuffer = (PUINT_8)((UINT_32)pucBuf + - (UINT_32)(*pu2Offset)); - - ASSERT(pucBuffer); - prAttriStatus = (P_P2P_ATTRI_STATUS_T)pucBuffer; - - ASSERT(u2BufSize >= ((*pu2Offset) + (UINT_16)u4AttriLen)); - - - - - prAttriStatus->ucId = P2P_ATTRI_ID_STATUS; - WLAN_SET_FIELD_16(&prAttriStatus->u2Length, P2P_ATTRI_MAX_LEN_STATUS); - - prAttriStatus->ucStatusCode = P2P_STATUS_FAIL_PREVIOUS_PROTOCOL_ERR; - - u4AttriLen = (P2P_ATTRI_HDR_LEN + P2P_ATTRI_MAX_LEN_STATUS); - - (*pu2Offset) += (UINT_16)u4AttriLen; - - return u4AttriLen; -} /* p2pFuncAppendAttriStatusForAssocRsp */ - -UINT_32 -p2pFuncAppendAttriExtListenTiming ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgIsAssocFrame, - IN PUINT_16 pu2Offset, - IN PUINT_8 pucBuf, - IN UINT_16 u2BufSize - ) -{ - UINT_32 u4AttriLen = 0; - P_P2P_ATTRI_EXT_LISTEN_TIMING_T prP2pExtListenTiming = (P_P2P_ATTRI_EXT_LISTEN_TIMING_T)NULL; - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - PUINT_8 pucBuffer = NULL; - - ASSERT(prAdapter); - ASSERT(pucBuf); - - if (fgIsAssocFrame) { - return u4AttriLen; - } - - // TODO: For extend listen timing. - - prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; - - u4AttriLen = (P2P_ATTRI_HDR_LEN + P2P_ATTRI_MAX_LEN_EXT_LISTEN_TIMING); - - ASSERT(u2BufSize >= ((*pu2Offset) + (UINT_16)u4AttriLen)); - - pucBuffer = (PUINT_8)((UINT_32)pucBuf + - (UINT_32)(*pu2Offset)); - - ASSERT(pucBuffer); - - prP2pExtListenTiming = (P_P2P_ATTRI_EXT_LISTEN_TIMING_T)pucBuffer; - - prP2pExtListenTiming->ucId = P2P_ATTRI_ID_EXT_LISTEN_TIMING; - WLAN_SET_FIELD_16(&prP2pExtListenTiming->u2Length, P2P_ATTRI_MAX_LEN_EXT_LISTEN_TIMING); - WLAN_SET_FIELD_16(&prP2pExtListenTiming->u2AvailInterval, prP2pSpecificBssInfo->u2AvailabilityInterval); - WLAN_SET_FIELD_16(&prP2pExtListenTiming->u2AvailPeriod, prP2pSpecificBssInfo->u2AvailabilityPeriod); - - (*pu2Offset) += (UINT_16)u4AttriLen; - - return u4AttriLen; -} /* p2pFuncAppendAttriExtListenTiming */ - - -P_IE_HDR_T -p2pFuncGetSpecIE ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucIEBuf, - IN UINT_16 u2BufferLen, - IN UINT_8 ucElemID, - IN PBOOLEAN pfgIsMore - ) -{ - P_IE_HDR_T prTargetIE = (P_IE_HDR_T)NULL; - PUINT_8 pucIE = (PUINT_8)NULL; - UINT_16 u2Offset = 0; - - - do { - ASSERT_BREAK((prAdapter != NULL) - && (pucIEBuf != NULL)); - - pucIE = pucIEBuf; - - if (pfgIsMore) { - *pfgIsMore = FALSE; - } - - - IE_FOR_EACH(pucIE, u2BufferLen, u2Offset) { - if (IE_ID(pucIE) == ucElemID) { - if ((prTargetIE) && (pfgIsMore)) { - - *pfgIsMore = TRUE; - break; - } - else { - prTargetIE = (P_IE_HDR_T)pucIE; - - if (pfgIsMore == NULL) { - break; - } - - } - - } - } - - } while (FALSE); - - return prTargetIE; -} /* p2pFuncGetSpecIE */ - - - -P_ATTRIBUTE_HDR_T -p2pFuncGetSpecAttri ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucOuiType, - IN PUINT_8 pucIEBuf, - IN UINT_16 u2BufferLen, - IN UINT_8 ucAttriID - ) -{ - P_IE_P2P_T prP2pIE = (P_IE_P2P_T)NULL; - P_ATTRIBUTE_HDR_T prTargetAttri = (P_ATTRIBUTE_HDR_T)NULL; - BOOLEAN fgIsMore = FALSE; - PUINT_8 pucIE = (PUINT_8)NULL, pucAttri = (PUINT_8)NULL; - UINT_16 u2OffsetAttri = 0; - UINT_8 aucWfaOui[] = VENDOR_OUI_WFA_SPECIFIC; - - do { - ASSERT_BREAK((prAdapter != NULL) - && (pucIEBuf != NULL)); - - pucIE = pucIEBuf; - - do { - prP2pIE = (P_IE_P2P_T)p2pFuncGetSpecIE(prAdapter, - pucIE, - u2BufferLen, - ELEM_ID_VENDOR, - &fgIsMore); - - if (prP2pIE) { - if (prP2pIE->ucOuiType == ucOuiType) { - switch (ucOuiType) { - case VENDOR_OUI_TYPE_WPS: - aucWfaOui[0] = 0x00; - aucWfaOui[1] = 0x50; - aucWfaOui[2] = 0xF2; - break; - case VENDOR_OUI_TYPE_P2P: - break; - case VENDOR_OUI_TYPE_WPA: - case VENDOR_OUI_TYPE_WMM: - default: - break; - } - - - if ((prP2pIE->aucOui[0] == aucWfaOui[0]) && - (prP2pIE->aucOui[1] == aucWfaOui[1]) && - (prP2pIE->aucOui[2] == aucWfaOui[2])) { - - pucAttri = prP2pIE->aucP2PAttributes; - - if (ucOuiType == VENDOR_OUI_TYPE_WPS) { - WSC_ATTRI_FOR_EACH(pucAttri, (IE_LEN(prP2pIE) - P2P_IE_OUI_HDR), u2OffsetAttri) { - if (WSC_ATTRI_ID(pucAttri) == ucAttriID) { - prTargetAttri = (P_ATTRIBUTE_HDR_T)pucAttri; - break; - } - - } - - } - - else if (ucOuiType == VENDOR_OUI_TYPE_P2P) { - P2P_ATTRI_FOR_EACH(pucAttri, (IE_LEN(prP2pIE) - P2P_IE_OUI_HDR), u2OffsetAttri) { - if (ATTRI_ID(pucAttri) == ucAttriID) { - prTargetAttri = (P_ATTRIBUTE_HDR_T)pucAttri; - break; - } - - } - - } - - else { - // Possible WiFi Display or else. - ASSERT(FALSE); - } - } - - - } - - } - - - pucIE = (PUINT_8)((UINT_32)prP2pIE + IE_LEN(prP2pIE)); - - } while (fgIsMore); - - } while (FALSE); - - return prTargetAttri; -} -/* p2pFuncGetSpecAttri */ - - -WLAN_STATUS -p2pFuncGenerateBeaconProbeRsp ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prBssInfo, - IN P_MSDU_INFO_T prMsduInfo, - IN BOOLEAN fgIsProbeRsp - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - P_WLAN_BEACON_FRAME_T prBcnFrame = (P_WLAN_BEACON_FRAME_T)NULL; -// P_APPEND_VAR_IE_ENTRY_T prAppendIeTable = (P_APPEND_VAR_IE_ENTRY_T)NULL; - - - do { - - ASSERT_BREAK((prAdapter != NULL) && - (prBssInfo != NULL) && - (prMsduInfo != NULL)); - - -// txBcnIETable - -// txProbeRspIETable - - - - prBcnFrame = (P_WLAN_BEACON_FRAME_T)prMsduInfo->prPacket; - - return nicUpdateBeaconIETemplate(prAdapter, - IE_UPD_METHOD_UPDATE_ALL, - NETWORK_TYPE_P2P_INDEX, - prBssInfo->u2CapInfo, - (PUINT_8)prBcnFrame->aucInfoElem, - prMsduInfo->u2FrameLength - OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem)); - - } while (FALSE); - - return rWlanStatus; -} /* p2pFuncGenerateBeaconProbeRsp */ - - -WLAN_STATUS -p2pFuncComposeBeaconProbeRspTemplate ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBcnBuffer, - IN UINT_32 u4BcnBufLen, - IN BOOLEAN fgIsProbeRsp, - IN P_P2P_PROBE_RSP_UPDATE_INFO_T prP2pProbeRspInfo, - IN BOOLEAN fgSynToFW - ) -{ - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - P_MSDU_INFO_T prMsduInfo = (P_MSDU_INFO_T)NULL; - P_WLAN_MAC_HEADER_T prWlanBcnFrame = (P_WLAN_MAC_HEADER_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - - PUINT_8 pucBuffer = (PUINT_8)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (pucBcnBuffer != NULL)); - - prWlanBcnFrame = (P_WLAN_MAC_HEADER_T)pucBcnBuffer; - - if ((prWlanBcnFrame->u2FrameCtrl != MAC_FRAME_BEACON) && (!fgIsProbeRsp)) { - rWlanStatus = WLAN_STATUS_INVALID_DATA; - break; - } - - else if (prWlanBcnFrame->u2FrameCtrl != MAC_FRAME_PROBE_RSP) { - rWlanStatus = WLAN_STATUS_INVALID_DATA; - break; - } - - - - if (fgIsProbeRsp) { - ASSERT_BREAK(prP2pProbeRspInfo != NULL); - - if (!prP2pProbeRspInfo->prProbeRspMsduTemplate) { - cnmMgtPktFree(prAdapter, prP2pProbeRspInfo->prProbeRspMsduTemplate); - } - - prP2pProbeRspInfo->prProbeRspMsduTemplate = cnmMgtPktAlloc(prAdapter, u4BcnBufLen); - - prMsduInfo = prP2pProbeRspInfo->prProbeRspMsduTemplate; - - prMsduInfo->eSrc = TX_PACKET_MGMT; - prMsduInfo->ucStaRecIndex = 0xFF; - prMsduInfo->ucNetworkType = NETWORK_TYPE_P2P_INDEX; - - } - else { - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - prMsduInfo = prP2pBssInfo->prBeacon; - - if (prMsduInfo == NULL) { - rWlanStatus = WLAN_STATUS_FAILURE; - break; - } - - if (u4BcnBufLen > (OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH)) { - /* Unexpected error, buffer overflow. */ - ASSERT(FALSE); - break; - } - - } - - - pucBuffer = (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD); - - kalMemCopy(pucBuffer, pucBcnBuffer, u4BcnBufLen); - - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = (UINT_16)u4BcnBufLen; - - if (fgSynToFW) { - rWlanStatus = p2pFuncGenerateBeaconProbeRsp(prAdapter, prP2pBssInfo, prMsduInfo, fgIsProbeRsp); - } - - } while (FALSE); - - return rWlanStatus; - -} /* p2pFuncComposeBeaconTemplate */ - - - - - - - - - - - - - - - - - - - diff --git a/drivers/net/wireless/mt5931/mgmt/p2p_ie.c b/drivers/net/wireless/mt5931/mgmt/p2p_ie.c deleted file mode 100755 index 6a658df56efe..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/p2p_ie.c +++ /dev/null @@ -1,72 +0,0 @@ -#include "p2p_precomp.h" - - - -UINT_32 -p2pCalculate_IEForAssocReq ( - - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN P_STA_RECORD_T prStaRec - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = (P_P2P_CONNECTION_REQ_INFO_T)NULL; - UINT_32 u4RetValue = 0; - - do { - ASSERT_BREAK((eNetTypeIndex == NETWORK_TYPE_P2P_INDEX) && (prAdapter != NULL)); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo); - - u4RetValue = prConnReqInfo->u4BufLength; - - } -while (FALSE); - - return u4RetValue; -} /* p2pCalculate_IEForAssocReq */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to generate P2P IE for Beacon frame. -* -* @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T. -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pGenerate_IEForAssocReq ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = (P_P2P_CONNECTION_REQ_INFO_T)NULL; - PUINT_8 pucIEBuf = (PUINT_8)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL)); - - prP2pFsmInfo = prAdapter->rWifiVar.prP2pFsmInfo; - - prConnReqInfo = &(prP2pFsmInfo->rConnReqInfo); - - pucIEBuf = (PUINT_8)((UINT_32)prMsduInfo->prPacket + (UINT_32)prMsduInfo->u2FrameLength); - - kalMemCopy(pucIEBuf, prConnReqInfo->aucIEBuf, prConnReqInfo->u4BufLength); - - prMsduInfo->u2FrameLength += prConnReqInfo->u4BufLength; - - } while (FALSE); - - return; - -} /* p2pGenerate_IEForAssocReq */ - - diff --git a/drivers/net/wireless/mt5931/mgmt/p2p_rlm.c b/drivers/net/wireless/mt5931/mgmt/p2p_rlm.c deleted file mode 100755 index 98941d1414e1..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/p2p_rlm.c +++ /dev/null @@ -1,1014 +0,0 @@ -/* -** $Id: @(#) p2p_rlm.c@@ -*/ - -/*! \file "p2p_rlm.c" - \brief - -*/ - - - - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -#include "precomp.h" - -extern VOID -rlmSyncOperationParams ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ); - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Init AP Bss -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmBssInitForAP( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ) -{ - ENUM_BAND_T eBand; - UINT_8 ucChannel; - ENUM_CHNL_EXT_T eSCO; - - ASSERT(prAdapter); - ASSERT(prBssInfo); - - if (prBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) { - return; - } - - /* Operation band, channel shall be ready before invoking this function. - * Bandwidth may be ready if other network is connected - */ - prBssInfo->fg40mBwAllowed = FALSE; - prBssInfo->fgAssoc40mBwAllowed = FALSE; - prBssInfo->eBssSCO = CHNL_EXT_SCN; - - if (RLM_AP_IS_BW_40_ALLOWED(prAdapter, prBssInfo)) { - /* In this case, the first BSS's SCO is 40MHz and known, so AP can - * apply 40MHz bandwidth, but the first BSS's SCO may be changed - * later if its Beacon lost timeout occurs - */ - if (cnmPreferredChannel(prAdapter, &eBand, &ucChannel, &eSCO) && - eSCO != CHNL_EXT_SCN && ucChannel == prBssInfo->ucPrimaryChannel && - eBand == prBssInfo->eBand) { - prBssInfo->eBssSCO = eSCO; - } - else if (cnmBss40mBwPermitted(prAdapter, prBssInfo->ucNetTypeIndex)) { - prBssInfo->eBssSCO = rlmDecideScoForAP(prAdapter, prBssInfo); - } - - if (prBssInfo->eBssSCO != CHNL_EXT_SCN) { - prBssInfo->fg40mBwAllowed = TRUE; - prBssInfo->fgAssoc40mBwAllowed = TRUE; - - prBssInfo->ucHtOpInfo1 = (UINT_8) - (((UINT_32) prBssInfo->eBssSCO) | HT_OP_INFO1_STA_CHNL_WIDTH); - - rlmUpdateBwByChListForAP(prAdapter, prBssInfo); - } - } - - DBGLOG(RLM, INFO, ("WLAN AP SCO=%d\n", prBssInfo->eBssSCO)); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief For probe response (GO, IBSS) and association response -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmRspGenerateObssScanIE ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ) -{ - P_BSS_INFO_T prBssInfo; - P_IE_OBSS_SCAN_PARAM_T prObssScanIe; - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - - ASSERT(prAdapter); - ASSERT(prMsduInfo); - ASSERT(IS_NET_ACTIVE(prAdapter, prMsduInfo->ucNetworkType)); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prMsduInfo->ucNetworkType]; - ASSERT(prBssInfo); - - if (RLM_NET_IS_11N(prBssInfo) && !RLM_NET_IS_BOW(prBssInfo) && - prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT && - (!prStaRec || (prStaRec->ucPhyTypeSet & PHY_TYPE_SET_802_11N)) && - prBssInfo->eBand == BAND_2G4 && - prBssInfo->eBssSCO != CHNL_EXT_SCN) { - - prObssScanIe = (P_IE_OBSS_SCAN_PARAM_T) - (((PUINT_8) prMsduInfo->prPacket) + prMsduInfo->u2FrameLength); - - /* Add 20/40 BSS coexistence IE */ - prObssScanIe->ucId = ELEM_ID_OBSS_SCAN_PARAMS; - prObssScanIe->ucLength = sizeof(IE_OBSS_SCAN_PARAM_T) - ELEM_HDR_LEN; - - prObssScanIe->u2ScanPassiveDwell = - dot11OBSSScanPassiveDwell; - prObssScanIe->u2ScanActiveDwell = - dot11OBSSScanActiveDwell; - prObssScanIe->u2TriggerScanInterval = - dot11BSSWidthTriggerScanInterval; - prObssScanIe->u2ScanPassiveTotalPerChnl = - dot11OBSSScanPassiveTotalPerChannel; - prObssScanIe->u2ScanActiveTotalPerChnl = - dot11OBSSScanActiveTotalPerChannel; - prObssScanIe->u2WidthTransDelayFactor = - dot11BSSWidthChannelTransitionDelayFactor; - prObssScanIe->u2ScanActivityThres = - dot11OBSSScanActivityThreshold; - - ASSERT(IE_SIZE(prObssScanIe) <= (ELEM_HDR_LEN+ ELEM_MAX_LEN_OBSS_SCAN)); - - prMsduInfo->u2FrameLength += IE_SIZE(prObssScanIe); - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P GO. -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rlmUpdateBwByChListForAP ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ) -{ - UINT_8 ucLevel; - BOOLEAN fgBwChange; - - ASSERT(prAdapter); - ASSERT(prBssInfo); - - fgBwChange = FALSE; - - if (prBssInfo->eBssSCO == CHNL_EXT_SCN) { - return fgBwChange; - } - - ucLevel = rlmObssChnlLevel(prBssInfo, prBssInfo->eBand, - prBssInfo->ucPrimaryChannel, prBssInfo->eBssSCO); - - if (ucLevel == CHNL_LEVEL0) { - /* Forced to 20MHz, so extended channel is SCN and STA width is zero */ - prBssInfo->fgObssActionForcedTo20M = TRUE; - - if (prBssInfo->ucHtOpInfo1 != (UINT_8) CHNL_EXT_SCN) { - prBssInfo->ucHtOpInfo1 = (UINT_8) CHNL_EXT_SCN; - fgBwChange = TRUE; - } - - cnmTimerStartTimer(prAdapter, &prBssInfo->rObssScanTimer, - OBSS_20_40M_TIMEOUT * MSEC_PER_SEC); - } - - /* Clear up all channel lists */ - prBssInfo->auc2G_20mReqChnlList[0] = 0; - prBssInfo->auc2G_NonHtChnlList[0] = 0; - prBssInfo->auc2G_PriChnlList[0] = 0; - prBssInfo->auc2G_SecChnlList[0] = 0; - prBssInfo->auc5G_20mReqChnlList[0] = 0; - prBssInfo->auc5G_NonHtChnlList[0] = 0; - prBssInfo->auc5G_PriChnlList[0] = 0; - prBssInfo->auc5G_SecChnlList[0] = 0; - - return fgBwChange; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmProcessPublicAction ( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb - ) -{ - P_ACTION_20_40_COEXIST_FRAME prRxFrame; - P_IE_20_40_COEXIST_T prCoexist; - P_IE_INTOLERANT_CHNL_REPORT_T prChnlReport; - P_BSS_INFO_T prBssInfo; - P_STA_RECORD_T prStaRec; - PUINT_8 pucIE; - UINT_16 u2IELength, u2Offset; - UINT_8 i, j; - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - prRxFrame = (P_ACTION_20_40_COEXIST_FRAME) prSwRfb->pvHeader; - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - - if (prRxFrame->ucAction != ACTION_PUBLIC_20_40_COEXIST || - !prStaRec || prStaRec->ucStaState != STA_STATE_3 || - prSwRfb->u2PacketLen < (WLAN_MAC_MGMT_HEADER_LEN + 5) || - HIF_RX_HDR_GET_NETWORK_IDX(prSwRfb->prHifRxHdr) != - NETWORK_TYPE_P2P_INDEX) { - return; - } - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]; - ASSERT(prBssInfo); - - if (!IS_BSS_ACTIVE(prBssInfo) || - prBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT || - prBssInfo->eBssSCO == CHNL_EXT_SCN) { - return; - } - - prCoexist = &prRxFrame->rBssCoexist; - if (prCoexist->ucData & (BSS_COEXIST_40M_INTOLERANT|BSS_COEXIST_20M_REQ)) { - ASSERT(prBssInfo->auc2G_20mReqChnlList[0] <= CHNL_LIST_SZ_2G); - for (i = 1; i <= prBssInfo->auc2G_20mReqChnlList[0] && - i <= CHNL_LIST_SZ_2G; i++) { - if (prBssInfo->auc2G_20mReqChnlList[i] == - prBssInfo->ucPrimaryChannel) { - break; - } - } - if ((i > prBssInfo->auc2G_20mReqChnlList[0]) && - (i <= CHNL_LIST_SZ_2G)){ - prBssInfo->auc2G_20mReqChnlList[i] = prBssInfo->ucPrimaryChannel; - prBssInfo->auc2G_20mReqChnlList[0]++; - } - } - - /* Process intolerant channel report IE */ - pucIE = (PUINT_8) &prRxFrame->rChnlReport; - u2IELength = prSwRfb->u2PacketLen - (WLAN_MAC_MGMT_HEADER_LEN + 5); - - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - switch (IE_ID(pucIE)) { - case ELEM_ID_20_40_INTOLERANT_CHNL_REPORT: - prChnlReport = (P_IE_INTOLERANT_CHNL_REPORT_T) pucIE; - - if (prChnlReport->ucLength <= 1) { - break; - } - - /* To do: process regulatory class. Now we assume 2.4G band */ - - for (j = 0; j < prChnlReport->ucLength - 1; j++) { - /* Update non-HT channel list */ - ASSERT(prBssInfo->auc2G_NonHtChnlList[0] <= CHNL_LIST_SZ_2G); - for (i = 1; i <= prBssInfo->auc2G_NonHtChnlList[0] && - i <= CHNL_LIST_SZ_2G; i++) { - if (prBssInfo->auc2G_NonHtChnlList[i] == - prChnlReport->aucChannelList[j]) { - break; - } - } - if ((i > prBssInfo->auc2G_NonHtChnlList[0]) && - (i <= CHNL_LIST_SZ_2G)) { - prBssInfo->auc2G_NonHtChnlList[i] = - prChnlReport->aucChannelList[j]; - prBssInfo->auc2G_NonHtChnlList[0]++; - } - } - break; - - default: - break; - } - } /* end of IE_FOR_EACH */ - - if (rlmUpdateBwByChListForAP(prAdapter, prBssInfo)) { - bssUpdateBeaconContent(prAdapter, prBssInfo->ucNetTypeIndex); - rlmSyncOperationParams(prAdapter, prBssInfo); - } - - /* Check if OBSS scan exemption response should be sent */ - if (prCoexist->ucData & BSS_COEXIST_OBSS_SCAN_EXEMPTION_REQ) { - rlmObssScanExemptionRsp(prAdapter, prBssInfo, prSwRfb); - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmProcessHtAction ( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb - ) -{ - P_ACTION_NOTIFY_CHNL_WIDTH_FRAME prRxFrame; - P_STA_RECORD_T prStaRec; - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - prRxFrame = (P_ACTION_NOTIFY_CHNL_WIDTH_FRAME) prSwRfb->pvHeader; - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - - if (prRxFrame->ucAction != ACTION_HT_NOTIFY_CHANNEL_WIDTH || - !prStaRec || prStaRec->ucStaState != STA_STATE_3 || - prSwRfb->u2PacketLen < sizeof(ACTION_NOTIFY_CHNL_WIDTH_FRAME)) { - return; - } - - /* To do: depending regulation class 13 and 14 based on spec - * Note: (ucChannelWidth==1) shall restored back to original capability, - * not current setting to 40MHz BW here - */ - if (prRxFrame->ucChannelWidth == 0) { - prStaRec->u2HtCapInfo &= ~HT_CAP_INFO_SUP_CHNL_WIDTH; - } - else if (prRxFrame->ucChannelWidth == 1) { - prStaRec->u2HtCapInfo |= HT_CAP_INFO_SUP_CHNL_WIDTH; - } - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_3); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmHandleObssStatusEventPkt ( - P_ADAPTER_T prAdapter, - P_EVENT_AP_OBSS_STATUS_T prObssStatus - ) -{ - P_BSS_INFO_T prBssInfo; - - ASSERT(prAdapter); - ASSERT(prObssStatus); - ASSERT(prObssStatus->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX); - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prObssStatus->ucNetTypeIndex]; - ASSERT(prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT); - - prBssInfo->fgObssErpProtectMode = - (BOOLEAN) prObssStatus->ucObssErpProtectMode; - prBssInfo->eObssHtProtectMode = - (ENUM_HT_PROTECT_MODE_T) prObssStatus->ucObssHtProtectMode; - prBssInfo->eObssGfOperationMode = - (ENUM_GF_MODE_T) prObssStatus->ucObssGfOperationMode; - prBssInfo->fgObssRifsOperationMode = - (BOOLEAN) prObssStatus->ucObssRifsOperationMode; - prBssInfo->fgObssBeaconForcedTo20M = - (BOOLEAN) prObssStatus->ucObssBeaconForcedTo20M; - - /* Check if Beacon content need to be updated */ - rlmUpdateParamsForAP(prAdapter, prBssInfo, TRUE); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief It is only for AP mode in NETWORK_TYPE_P2P_INDEX. -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmUpdateParamsForAP ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - BOOLEAN fgUpdateBeacon - ) -{ - P_LINK_T prStaList; - P_STA_RECORD_T prStaRec; - BOOLEAN fgErpProtectMode, fgSta40mIntolerant; - BOOLEAN fgUseShortPreamble, fgUseShortSlotTime; - ENUM_HT_PROTECT_MODE_T eHtProtectMode; - ENUM_GF_MODE_T eGfOperationMode; - UINT_8 ucHtOpInfo1; - - ASSERT(prAdapter); - ASSERT(prBssInfo); - - if (!IS_BSS_ACTIVE(prBssInfo) || - prBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT) { - return; - } - - fgErpProtectMode = FALSE; - eHtProtectMode = HT_PROTECT_MODE_NONE; - eGfOperationMode = GF_MODE_NORMAL; - fgSta40mIntolerant = FALSE; - fgUseShortPreamble = prBssInfo->fgIsShortPreambleAllowed; - fgUseShortSlotTime = TRUE; - ucHtOpInfo1 = (UINT_8) CHNL_EXT_SCN; - - prStaList = &prBssInfo->rStaRecOfClientList; - - LINK_FOR_EACH_ENTRY(prStaRec, prStaList, rLinkEntry, STA_RECORD_T) { - ASSERT(prStaRec); - if (prStaRec->fgIsInUse && prStaRec->ucStaState == STA_STATE_3 && - prStaRec->ucNetTypeIndex == prBssInfo->ucNetTypeIndex) { - if (!(prStaRec->ucPhyTypeSet & - (PHY_TYPE_SET_802_11GN | PHY_TYPE_SET_802_11A))) { - /* B-only mode, so mode 1 (ERP protection) */ - fgErpProtectMode = TRUE; - } - - if (!(prStaRec->ucPhyTypeSet & PHY_TYPE_SET_802_11N)) { - /* BG-only or A-only */ - eHtProtectMode = HT_PROTECT_MODE_NON_HT; - } - else if (!(prStaRec->u2HtCapInfo & HT_CAP_INFO_SUP_CHNL_WIDTH)) { - /* 20MHz-only */ - if (eHtProtectMode == HT_PROTECT_MODE_NONE) { - eHtProtectMode = HT_PROTECT_MODE_20M; - } - } - - if (!(prStaRec->u2HtCapInfo & HT_CAP_INFO_HT_GF)) { - eGfOperationMode = GF_MODE_PROTECT; - } - - if (!(prStaRec->u2CapInfo & CAP_INFO_SHORT_PREAMBLE)) { - fgUseShortPreamble = FALSE; - } - - if (!(prStaRec->u2CapInfo & CAP_INFO_SHORT_SLOT_TIME)) { - fgUseShortSlotTime = FALSE; - } - - if (prStaRec->u2HtCapInfo & HT_CAP_INFO_40M_INTOLERANT) { - fgSta40mIntolerant = TRUE; - } - } - } /* end of LINK_FOR_EACH_ENTRY */ - - /* Check if HT operation IE about 20/40M bandwidth shall be updated */ - if (prBssInfo->eBssSCO != CHNL_EXT_SCN) { - if (/*!LINK_IS_EMPTY(prStaList) && */ !fgSta40mIntolerant && - !prBssInfo->fgObssActionForcedTo20M && - !prBssInfo->fgObssBeaconForcedTo20M) { - - ucHtOpInfo1 = (UINT_8) - (((UINT_32) prBssInfo->eBssSCO) | HT_OP_INFO1_STA_CHNL_WIDTH); - } - } - - /* Check if any new parameter may be updated */ - if (prBssInfo->fgErpProtectMode != fgErpProtectMode || - prBssInfo->eHtProtectMode != eHtProtectMode || - prBssInfo->eGfOperationMode != eGfOperationMode || - prBssInfo->ucHtOpInfo1 != ucHtOpInfo1 || - prBssInfo->fgUseShortPreamble != fgUseShortPreamble || - prBssInfo->fgUseShortSlotTime != fgUseShortSlotTime) { - - prBssInfo->fgErpProtectMode = fgErpProtectMode; - prBssInfo->eHtProtectMode = eHtProtectMode; - prBssInfo->eGfOperationMode = eGfOperationMode; - prBssInfo->ucHtOpInfo1 = ucHtOpInfo1; - prBssInfo->fgUseShortPreamble = fgUseShortPreamble; - prBssInfo->fgUseShortSlotTime = fgUseShortSlotTime; - - if (fgUseShortSlotTime) { - prBssInfo->u2CapInfo |= CAP_INFO_SHORT_SLOT_TIME; - } - else { - prBssInfo->u2CapInfo &= ~CAP_INFO_SHORT_SLOT_TIME; - } - - rlmSyncOperationParams(prAdapter, prBssInfo); - fgUpdateBeacon = TRUE; - } - - /* Update Beacon content if related IE content is changed */ - if (fgUpdateBeacon) { - bssUpdateBeaconContent(prAdapter, prBssInfo->ucNetTypeIndex); - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Initial the channel list from the domain information. -* This function is called after P2P initial and Domain information changed. -* Make sure the device is disconnected while changing domain information. -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return boolean value if probe response frame is -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmFuncInitialChannelList ( - IN P_ADAPTER_T prAdapter - ) -{ - P_P2P_CONNECTION_SETTINGS_T prP2pConnSetting = (P_P2P_CONNECTION_SETTINGS_T)NULL; - P_DOMAIN_INFO_ENTRY prDomainInfoEntry = (P_DOMAIN_INFO_ENTRY)NULL; - P_DOMAIN_SUBBAND_INFO prDomainSubBand = (P_DOMAIN_SUBBAND_INFO)NULL; - P_CHANNEL_ENTRY_FIELD_T prChannelEntryField = (P_CHANNEL_ENTRY_FIELD_T)NULL; - UINT_32 u4Idx = 0, u4IdxII = 0; - UINT_8 ucBufferSize = P2P_MAX_SUPPORTED_CHANNEL_LIST_SIZE; -#if 0 - UINT_8 ucSocialChnlSupport = 0, ucAutoChnl = 0; -#endif - - do { - ASSERT_BREAK(prAdapter != NULL); - - prP2pConnSetting = prAdapter->rWifiVar.prP2PConnSettings; -#if 0 - ucAutoChnl = prP2pConnSetting->ucOperatingChnl; -#endif - - prDomainInfoEntry = rlmDomainGetDomainInfo(prAdapter); - - ASSERT_BREAK((prDomainInfoEntry != NULL) && (prP2pConnSetting != NULL)); - - prChannelEntryField = (P_CHANNEL_ENTRY_FIELD_T)prP2pConnSetting->aucChannelEntriesField; - - for (u4Idx = 0; u4Idx < MAX_SUBBAND_NUM; u4Idx++) { - prDomainSubBand = &prDomainInfoEntry->rSubBand[u4Idx]; - - - if (((prDomainSubBand->ucBand == BAND_5G) && (!prAdapter->fgEnable5GBand)) || - (prDomainSubBand->ucBand == BAND_NULL)) { - continue; - } - - - if (ucBufferSize < (P2P_ATTRI_LEN_CHANNEL_ENTRY + prDomainSubBand->ucNumChannels)) { - /* Buffer is not enough to include all supported channels. */ - break; // for - } - - prChannelEntryField->ucRegulatoryClass = prDomainSubBand->ucRegClass; - prChannelEntryField->ucNumberOfChannels = prDomainSubBand->ucNumChannels; - - for (u4IdxII = 0; u4IdxII < prDomainSubBand->ucNumChannels; u4IdxII++) { - prChannelEntryField->aucChannelList[u4IdxII] = prDomainSubBand->ucFirstChannelNum + - (u4IdxII * prDomainSubBand->ucChannelSpan); - -#if 0 - switch (prChannelEntryField->aucChannelList[u4IdxII]) { - case 1: - ucSocialChnlSupport = 1; - break; - case 6: - ucSocialChnlSupport = 6; - break; - case 11: - ucSocialChnlSupport = 11; - break; - default: - break; - } - -#endif - } - - if (ucBufferSize >= (P2P_ATTRI_LEN_CHANNEL_ENTRY + prChannelEntryField->ucNumberOfChannels)) { - ucBufferSize -= (P2P_ATTRI_LEN_CHANNEL_ENTRY + prChannelEntryField->ucNumberOfChannels); - } - else { - break; - } - - - prChannelEntryField = (P_CHANNEL_ENTRY_FIELD_T)((UINT_32)prChannelEntryField + - P2P_ATTRI_LEN_CHANNEL_ENTRY + - (UINT_32)prChannelEntryField->ucNumberOfChannels); - - } - -#if 0 - if (prP2pConnSetting->ucListenChnl == 0) { - prP2pConnSetting->ucListenChnl = P2P_DEFAULT_LISTEN_CHANNEL; - - if (ucSocialChnlSupport != 0) { - /* 1. User Not Set LISTEN channel. - * 2. Social channel is not empty. - */ - prP2pConnSetting->ucListenChnl = ucSocialChnlSupport; - } - } - -#endif - - // TODO: 20110921 frog - - /* If LISTEN channel is not set, - * a random supported channel would be set. - * If no social channel is supported, DEFAULT channel would be set. - */ - - prP2pConnSetting->ucRfChannelListSize = P2P_MAX_SUPPORTED_CHANNEL_LIST_SIZE - ucBufferSize; - -#if 0 - if (prP2pConnSetting->ucOperatingChnl == 0) { /* User not set OPERATE channel. */ - - if (scnQuerySparseChannel(prAdapter, NULL, &ucAutoChnl)) { - break; // while - } - - ucBufferSize = prP2pConnSetting->ucRfChannelListSize; - - prChannelEntryField = (P_CHANNEL_ENTRY_FIELD_T)prP2pConnSetting->aucChannelEntriesField; - - while (ucBufferSize != 0) { - if (prChannelEntryField->ucNumberOfChannels != 0) { - ucAutoChnl = prChannelEntryField->aucChannelList[0]; - break; // while - } - - else { - prChannelEntryField = (P_CHANNEL_ENTRY_FIELD_T)((UINT_32)prChannelEntryField + - P2P_ATTRI_LEN_CHANNEL_ENTRY + - (UINT_32)prChannelEntryField->ucNumberOfChannels); - - ucBufferSize -= (P2P_ATTRI_LEN_CHANNEL_ENTRY + prChannelEntryField->ucNumberOfChannels); - } - - } - - - - } - -#endif - /* We assume user would not set a channel not in the channel list. - * If so, the operating channel still depends on target deivce supporting capability. - */ - - // TODO: 20110921 frog - - /* If the Operating channel is not set, a channel from supported channel list is set automatically. - * If there is no supported channel in channel list, a DEFAULT channel is set. - */ - - } while (FALSE); - -#if 0 - prP2pConnSetting->ucOperatingChnl = ucAutoChnl; -#endif - return; -} /* rlmFuncInitialChannelList */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Find a common channel list from the local channel list info & target channel list info. -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return boolean value if probe response frame is -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmFuncCommonChannelList ( - IN P_ADAPTER_T prAdapter, - IN P_CHANNEL_ENTRY_FIELD_T prChannelEntryII, - IN UINT_8 ucChannelListSize - ) -{ - P_P2P_CONNECTION_SETTINGS_T prP2pConnSetting = (P_P2P_CONNECTION_SETTINGS_T)NULL; - P_CHANNEL_ENTRY_FIELD_T prChannelEntryI = (P_CHANNEL_ENTRY_FIELD_T)NULL, prChannelEntryIII = (P_CHANNEL_ENTRY_FIELD_T)NULL; - UINT_8 aucCommonChannelList[P2P_MAX_SUPPORTED_CHANNEL_LIST_SIZE]; - UINT_8 ucOriChnlSize = 0, ucNewChnlSize = 0; - - - do { - - ASSERT_BREAK(prAdapter != NULL); - - prP2pConnSetting = prAdapter->rWifiVar.prP2PConnSettings; - - prChannelEntryIII = (P_CHANNEL_ENTRY_FIELD_T)aucCommonChannelList; - - while (ucChannelListSize > 0) { - - prChannelEntryI = (P_CHANNEL_ENTRY_FIELD_T)prP2pConnSetting->aucChannelEntriesField; - ucOriChnlSize = prP2pConnSetting->ucRfChannelListSize; - - while (ucOriChnlSize > 0) { - if (prChannelEntryI->ucRegulatoryClass == prChannelEntryII->ucRegulatoryClass) { - prChannelEntryIII->ucRegulatoryClass = prChannelEntryI->ucRegulatoryClass; - // TODO: Currently we assume that the regulatory class the same, the channels are the same. - kalMemCopy(prChannelEntryIII->aucChannelList, prChannelEntryII->aucChannelList, prChannelEntryII->ucNumberOfChannels); - prChannelEntryIII->ucNumberOfChannels = prChannelEntryII->ucNumberOfChannels; - - ucNewChnlSize += P2P_ATTRI_LEN_CHANNEL_ENTRY + prChannelEntryIII->ucNumberOfChannels; - - prChannelEntryIII = (P_CHANNEL_ENTRY_FIELD_T)((UINT_32)prChannelEntryIII + - P2P_ATTRI_LEN_CHANNEL_ENTRY + - (UINT_32)prChannelEntryIII->ucNumberOfChannels); - } - - ucOriChnlSize -= (P2P_ATTRI_LEN_CHANNEL_ENTRY + prChannelEntryI->ucNumberOfChannels); - - prChannelEntryI = (P_CHANNEL_ENTRY_FIELD_T)((UINT_32)prChannelEntryI + - P2P_ATTRI_LEN_CHANNEL_ENTRY + - (UINT_32)prChannelEntryI->ucNumberOfChannels); - - - } - - - ucChannelListSize -= (P2P_ATTRI_LEN_CHANNEL_ENTRY + prChannelEntryII->ucNumberOfChannels); - - prChannelEntryII = (P_CHANNEL_ENTRY_FIELD_T)((UINT_32)prChannelEntryII + - P2P_ATTRI_LEN_CHANNEL_ENTRY + - (UINT_32)prChannelEntryII->ucNumberOfChannels); - - - } - - - kalMemCopy(prP2pConnSetting->aucChannelEntriesField, aucCommonChannelList, ucNewChnlSize); - prP2pConnSetting->ucRfChannelListSize = ucNewChnlSize; - - } while (FALSE); - - return; -} /* rlmFuncCommonChannelList */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -UINT_8 -rlmFuncFindOperatingClass ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucChannelNum - ) -{ - UINT_8 ucRegulatoryClass = 0, ucBufferSize = 0; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSetting = (P_P2P_CONNECTION_SETTINGS_T)NULL; - P_CHANNEL_ENTRY_FIELD_T prChannelEntryField = (P_CHANNEL_ENTRY_FIELD_T)NULL; - UINT_32 u4Idx = 0; - - do { - ASSERT_BREAK(prAdapter != NULL); - - prP2pConnSetting = prAdapter->rWifiVar.prP2PConnSettings; - ucBufferSize = prP2pConnSetting->ucRfChannelListSize; - prChannelEntryField = (P_CHANNEL_ENTRY_FIELD_T)prP2pConnSetting->aucChannelEntriesField; - - while (ucBufferSize != 0) { - - for (u4Idx = 0; u4Idx < prChannelEntryField->ucNumberOfChannels; u4Idx++) { - if (prChannelEntryField->aucChannelList[u4Idx] == ucChannelNum) { - ucRegulatoryClass = prChannelEntryField->ucRegulatoryClass; - break; - } - - } - - - if (ucRegulatoryClass != 0) { - break; //while - } - else { - prChannelEntryField = (P_CHANNEL_ENTRY_FIELD_T)((UINT_32)prChannelEntryField + - P2P_ATTRI_LEN_CHANNEL_ENTRY + - (UINT_32)prChannelEntryField->ucNumberOfChannels); - - ucBufferSize -= (P2P_ATTRI_LEN_CHANNEL_ENTRY + prChannelEntryField->ucNumberOfChannels); - } - - } - - - } while (FALSE); - - return ucRegulatoryClass; -} /* rlmFuncFindOperatingClass */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rlmFuncFindAvailableChannel ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucCheckChnl, - IN PUINT_8 pucSuggestChannel, - IN BOOLEAN fgIsSocialChannel, - IN BOOLEAN fgIsDefaultChannel - ) -{ - BOOLEAN fgIsResultAvailable = FALSE; - P_CHANNEL_ENTRY_FIELD_T prChannelEntry = (P_CHANNEL_ENTRY_FIELD_T)NULL; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSetting = (P_P2P_CONNECTION_SETTINGS_T)NULL; - UINT_8 ucBufferSize = 0, ucIdx = 0, ucChannelSelected = 0; - - do { - ASSERT_BREAK(prAdapter != NULL); - - if (fgIsDefaultChannel) { - ucChannelSelected = P2P_DEFAULT_LISTEN_CHANNEL; - } - - - prP2pConnSetting = prAdapter->rWifiVar.prP2PConnSettings; - ucBufferSize = prP2pConnSetting->ucRfChannelListSize; - prChannelEntry = (P_CHANNEL_ENTRY_FIELD_T)prP2pConnSetting->aucChannelEntriesField; - - while ((ucBufferSize != 0) && (!fgIsResultAvailable)) { - - for (ucIdx = 0; ucIdx < prChannelEntry->ucNumberOfChannels; ucIdx++) { - if ((!fgIsSocialChannel) || - (prChannelEntry->aucChannelList[ucIdx] == 1) || - (prChannelEntry->aucChannelList[ucIdx] == 6) || - (prChannelEntry->aucChannelList[ucIdx] == 11)) { - - if (prChannelEntry->aucChannelList[ucIdx] <= 11) { - /* 2.4G. */ - ucChannelSelected = prChannelEntry->aucChannelList[ucIdx]; - } - else if ((prChannelEntry->aucChannelList[ucIdx] < 52) && - (prChannelEntry->aucChannelList[ucIdx] > 14)) { - /* 2.4G + 5G. */ - ucChannelSelected = prChannelEntry->aucChannelList[ucIdx]; - } - - if (ucChannelSelected == ucCheckChnl) { - fgIsResultAvailable = TRUE; - break; - } - } - - } - - - ucBufferSize -= (P2P_ATTRI_LEN_CHANNEL_ENTRY + prChannelEntry->ucNumberOfChannels); - - prChannelEntry = (P_CHANNEL_ENTRY_FIELD_T)((UINT_32)prChannelEntry + - P2P_ATTRI_LEN_CHANNEL_ENTRY + - (UINT_32)prChannelEntry->ucNumberOfChannels); - - } - - - - if ((!fgIsResultAvailable) && (pucSuggestChannel != NULL)) { - DBGLOG(P2P, TRACE, ("The request channel %d is not available, sugguested channel:%d\n", ucCheckChnl, ucChannelSelected)); - // Given a suggested channel. - *pucSuggestChannel = ucChannelSelected; - } - - - } while (FALSE); - - return fgIsResultAvailable; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -ENUM_CHNL_EXT_T -rlmDecideScoForAP ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ) -{ - P_DOMAIN_SUBBAND_INFO prSubband; - P_DOMAIN_INFO_ENTRY prDomainInfo; - UINT_8 ucSecondChannel, i, j; - ENUM_CHNL_EXT_T eSCO; - - eSCO = CHNL_EXT_SCN; - - if (prBssInfo->eBand == BAND_2G4) { - if (prBssInfo->ucPrimaryChannel != 14) { - eSCO = (prBssInfo->ucPrimaryChannel > 7) ? - CHNL_EXT_SCB : CHNL_EXT_SCA; - } - } - else { - prDomainInfo = rlmDomainGetDomainInfo(prAdapter); - ASSERT(prDomainInfo); - - for (i = 0; i < MAX_SUBBAND_NUM; i++) { - prSubband = &prDomainInfo->rSubBand[i]; - if (prSubband->ucBand == prBssInfo->eBand) { - for (j = 0; j < prSubband->ucNumChannels; j++) { - if ((prSubband->ucFirstChannelNum + j*prSubband->ucChannelSpan) - == prBssInfo->ucPrimaryChannel) { - eSCO = (j & 1) ? CHNL_EXT_SCB : CHNL_EXT_SCA; - break; - } - } - - if (j < prSubband->ucNumChannels) { - break; /* Found */ - } - } - } - } - - /* Check if it is boundary channel and 40MHz BW is permitted */ - if (eSCO != CHNL_EXT_SCN) { - ucSecondChannel = (eSCO == CHNL_EXT_SCA) ? - (prBssInfo->ucPrimaryChannel+ 4) : (prBssInfo->ucPrimaryChannel- 4); - - if (!rlmDomainIsLegalChannel(prAdapter, prBssInfo->eBand, ucSecondChannel)){ - eSCO = CHNL_EXT_SCN; - } - } - - return eSCO; -} - diff --git a/drivers/net/wireless/mt5931/mgmt/p2p_rlm_obss.c b/drivers/net/wireless/mt5931/mgmt/p2p_rlm_obss.c deleted file mode 100755 index f9045373157b..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/p2p_rlm_obss.c +++ /dev/null @@ -1,374 +0,0 @@ -/* -** $Id: @(#) gl_p2p_cfg80211.c@@ -*/ - -/*! \file gl_p2p_cfg80211.c - \brief Main routines of Linux driver interface for Wi-Fi Direct - using cfg80211 interface - - This file contains the main routines of Linux driver for MediaTek Inc. 802.11 - Wireless LAN Adapters. -*/ - - - - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - - -#include "precomp.h" - - -static UINT_8 -rlmObssChnlLevelIn2G4 ( - P_BSS_INFO_T prBssInfo, - UINT_8 ucPriChannel, - ENUM_CHNL_EXT_T eExtend - ); - -static UINT_8 -rlmObssChnlLevelIn5G ( - P_BSS_INFO_T prBssInfo, - UINT_8 ucPriChannel, - ENUM_CHNL_EXT_T eExtend - ); - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Different concurrent network has itself channel lists, and -* concurrent networks should have been recorded in channel lists. -* If role of active P2P is GO, assume associated AP of AIS will -* record our Beacon for P2P GO because of same channel. -* -* Note: If we have scenario of different channel in the future, -* the internal FW communication channel shall be established. -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -UINT_8 -rlmObssChnlLevel ( - P_BSS_INFO_T prBssInfo, - ENUM_BAND_T eBand, - UINT_8 ucPriChannel, - ENUM_CHNL_EXT_T eExtend - ) -{ - UINT_8 ucChannelLevel; - - ASSERT(prBssInfo); - - if (eBand == BAND_2G4) { - ucChannelLevel = rlmObssChnlLevelIn2G4(prBssInfo, ucPriChannel,eExtend); - - /* (TBD) If concurrent networks permit different channel, extra - * channel judgement should be added. Please refer to - * previous version of this file. - */ - } - else if (eBand == BAND_5G) { - ucChannelLevel = rlmObssChnlLevelIn5G(prBssInfo, ucPriChannel,eExtend); - - /* (TBD) If concurrent networks permit different channel, extra - * channel judgement should be added. Please refer to - * previous version of this file. - */ - } - else { - ucChannelLevel = CHNL_LEVEL0; - } - - return ucChannelLevel; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -static UINT_8 -rlmObssChnlLevelIn2G4 ( - P_BSS_INFO_T prBssInfo, - UINT_8 ucPriChannel, - ENUM_CHNL_EXT_T eExtend - ) -{ - UINT_8 i, ucChannelLevel; - UINT_8 ucSecChannel, ucCenterChannel; - UINT_8 ucAffectedChnl_L, ucAffectedChnl_H; - - ASSERT(prBssInfo); - - ucChannelLevel = CHNL_LEVEL2; - - /* Calculate center channel for 2.4G band */ - if (eExtend == CHNL_EXT_SCA) { - ucCenterChannel = ucPriChannel + 2; - ucSecChannel = ucPriChannel + 4; - } - else if (eExtend == CHNL_EXT_SCB) { - ucCenterChannel = ucPriChannel - 2; - ucSecChannel = ucPriChannel - 4; - } - else { - return CHNL_LEVEL0; - } - ASSERT(ucCenterChannel >= 1 && ucCenterChannel <= 14); - - /* Calculated low/upper channels in affected freq range */ - ucAffectedChnl_L = (ucCenterChannel <= AFFECTED_CHNL_OFFSET) ? - 1 : (ucCenterChannel - AFFECTED_CHNL_OFFSET); - - ucAffectedChnl_H = (ucCenterChannel >= (14 - AFFECTED_CHNL_OFFSET)) ? - 14 : (ucCenterChannel + AFFECTED_CHNL_OFFSET); - - - /* Check intolerant (Non-HT) channel list */ - ASSERT(prBssInfo->auc2G_NonHtChnlList[0] <= CHNL_LIST_SZ_2G); - for (i = 1; i <= prBssInfo->auc2G_NonHtChnlList[0] && - i <= CHNL_LIST_SZ_2G; i++) { - if ((prBssInfo->auc2G_NonHtChnlList[i] >= ucAffectedChnl_L && - prBssInfo->auc2G_NonHtChnlList[i] <= ucAffectedChnl_H) && - prBssInfo->auc2G_NonHtChnlList[i] != ucPriChannel) { - - ucChannelLevel = CHNL_LEVEL0; - goto L_2G4_level_end; - } - } - - /* Check 20M BW request channel list */ - ASSERT(prBssInfo->auc2G_20mReqChnlList[0] <= CHNL_LIST_SZ_2G); - for (i = 1; i <= prBssInfo->auc2G_20mReqChnlList[0] && - i <= CHNL_LIST_SZ_2G; i++) { - if ((prBssInfo->auc2G_20mReqChnlList[i] >= ucAffectedChnl_L && - prBssInfo->auc2G_20mReqChnlList[i] <= ucAffectedChnl_H)) { - - ucChannelLevel = CHNL_LEVEL0; - goto L_2G4_level_end; - } - } - - /* Check 2.4G primary channel list */ - ASSERT(prBssInfo->auc2G_PriChnlList[0] <= CHNL_LIST_SZ_2G); - for (i = 1; i <= prBssInfo->auc2G_PriChnlList[0] && - i <= CHNL_LIST_SZ_2G; i++) { - if ((prBssInfo->auc2G_PriChnlList[i] >= ucAffectedChnl_L && - prBssInfo->auc2G_PriChnlList[i] <= ucAffectedChnl_H) && - prBssInfo->auc2G_PriChnlList[i] != ucPriChannel) { - - ucChannelLevel = CHNL_LEVEL0; - goto L_2G4_level_end; - } - } - - /* Check 2.4G secondary channel list */ - ASSERT(prBssInfo->auc2G_SecChnlList[0] <= CHNL_LIST_SZ_2G); - for (i = 1; i <= prBssInfo->auc2G_SecChnlList[0] && - i <= CHNL_LIST_SZ_2G; i++) { - if ((prBssInfo->auc2G_SecChnlList[i] >= ucAffectedChnl_L && - prBssInfo->auc2G_SecChnlList[i] <= ucAffectedChnl_H) && - prBssInfo->auc2G_SecChnlList[i] != ucSecChannel) { - - ucChannelLevel = CHNL_LEVEL0; - goto L_2G4_level_end; - } - } - -L_2G4_level_end: - - return ucChannelLevel; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -static UINT_8 -rlmObssChnlLevelIn5G ( - P_BSS_INFO_T prBssInfo, - UINT_8 ucPriChannel, - ENUM_CHNL_EXT_T eExtend - ) -{ - UINT_8 i, ucChannelLevel; - UINT_8 ucSecChannel; - - ASSERT(prBssInfo); - - ucChannelLevel = CHNL_LEVEL2; - - /* Calculate center channel for 2.4G band */ - if (eExtend == CHNL_EXT_SCA) { - ucSecChannel = ucPriChannel + 4; - } - else if (eExtend == CHNL_EXT_SCB) { - ucSecChannel = ucPriChannel - 4; - } - else { - return CHNL_LEVEL0; - } - ASSERT(ucSecChannel >= 36); - - /* Check 5G primary channel list */ - ASSERT(prBssInfo->auc5G_PriChnlList[0] <= CHNL_LIST_SZ_5G); - for (i = 1; i <= prBssInfo->auc5G_PriChnlList[0] && - i <= CHNL_LIST_SZ_5G; i++) { - if (prBssInfo->auc5G_PriChnlList[i] == ucSecChannel) { - - ucChannelLevel = CHNL_LEVEL0; - goto L_5G_level_end; - } - else if (prBssInfo->auc5G_PriChnlList[i] == ucPriChannel) { - ucChannelLevel = CHNL_LEVEL1; - } - } - - /* Check non-HT channel list */ - ASSERT(prBssInfo->auc5G_NonHtChnlList[0] <= CHNL_LIST_SZ_5G); - for (i = 1; i <= prBssInfo->auc5G_NonHtChnlList[0] && - i <= CHNL_LIST_SZ_5G; i++) { - if (prBssInfo->auc5G_NonHtChnlList[i] == ucSecChannel) { - - ucChannelLevel = CHNL_LEVEL0; - goto L_5G_level_end; - } - else if (prBssInfo->auc5G_NonHtChnlList[i] == ucPriChannel) { - ucChannelLevel = CHNL_LEVEL1; - } - } - - /* Check secondary channel list */ - ASSERT(prBssInfo->auc5G_SecChnlList[0] <= CHNL_LIST_SZ_5G); - for (i = 1; i <= prBssInfo->auc5G_SecChnlList[0] && - i <= CHNL_LIST_SZ_5G; i++) { - if (prBssInfo->auc5G_SecChnlList[i] == ucPriChannel) { - - ucChannelLevel = CHNL_LEVEL0; - goto L_5G_level_end; - } - } - -L_5G_level_end: - - return ucChannelLevel; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmObssScanExemptionRsp ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - P_SW_RFB_T prSwRfb - ) -{ - P_MSDU_INFO_T prMsduInfo; - P_ACTION_20_40_COEXIST_FRAME prTxFrame; - - /* To do: need an algorithm to do judgement. Now always reject request */ - - prMsduInfo = (P_MSDU_INFO_T) - cnmMgtPktAlloc(prAdapter, PUBLIC_ACTION_MAX_LEN); - if (prMsduInfo == NULL) { - return; - } - - DBGLOG(RLM, INFO, ("Send 20/40 coexistence rsp frame!\n")); - - prTxFrame = (P_ACTION_20_40_COEXIST_FRAME) prMsduInfo->prPacket; - - prTxFrame->u2FrameCtrl = MAC_FRAME_ACTION; - COPY_MAC_ADDR(prTxFrame->aucDestAddr, - ((P_ACTION_20_40_COEXIST_FRAME) prSwRfb->pvHeader)->aucSrcAddr); - COPY_MAC_ADDR(prTxFrame->aucSrcAddr, prBssInfo->aucOwnMacAddr); - COPY_MAC_ADDR(prTxFrame->aucBSSID, prBssInfo->aucBSSID); - - prTxFrame->ucCategory = CATEGORY_PUBLIC_ACTION; - prTxFrame->ucAction = ACTION_PUBLIC_20_40_COEXIST; - - /* To do: find correct algorithm */ - prTxFrame->rBssCoexist.ucId = ELEM_ID_20_40_BSS_COEXISTENCE; - prTxFrame->rBssCoexist.ucLength = 1; - prTxFrame->rBssCoexist.ucData = 0; - - ASSERT((WLAN_MAC_HEADER_LEN + 5) <= PUBLIC_ACTION_MAX_LEN); - - prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_MGMT; - prMsduInfo->ucStaRecIndex =prSwRfb->ucStaRecIdx; - prMsduInfo->ucNetworkType = prBssInfo->ucNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_MGMT_HEADER_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = WLAN_MAC_MGMT_HEADER_HTC_LEN + 5; - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = NULL; - prMsduInfo->fgIsBasicRate = FALSE; - - /* Send them to HW queue */ - nicTxEnqueueMsdu(prAdapter, prMsduInfo); -} - - - diff --git a/drivers/net/wireless/mt5931/mgmt/p2p_scan.c b/drivers/net/wireless/mt5931/mgmt/p2p_scan.c deleted file mode 100755 index 6e7a18e87aa0..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/p2p_scan.c +++ /dev/null @@ -1,831 +0,0 @@ -/* -** $Id: @(#) p2p_scan.c@@ -*/ - -/*! \file "p2p_scan.c" - \brief This file defines the p2p scan profile and the processing function of - scan result for SCAN Module. - - The SCAN Profile selection is part of SCAN MODULE and responsible for defining - SCAN Parameters - e.g. MIN_CHANNEL_TIME, number of scan channels. - In this file we also define the process of SCAN Result including adding, searching - and removing SCAN record from the list. -*/ - - - - - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -P_P2P_DEVICE_DESC_T -scanSearchTargetP2pDesc ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucDeviceID[], - IN PP_BSS_DESC_T pprBssDesc - ) -{ - - P_P2P_DEVICE_DESC_T prTargetP2pDesc = (P_P2P_DEVICE_DESC_T)NULL; - P_SCAN_INFO_T prScanInfo = (P_SCAN_INFO_T)NULL; - P_LINK_T prBSSDescList; - P_BSS_DESC_T prBssDesc = (P_BSS_DESC_T)NULL; - - - ASSERT(prAdapter); - ASSERT(aucDeviceID); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prBSSDescList = &prScanInfo->rBSSDescList; - - //4 <1> The outer loop to search for a candidate. - LINK_FOR_EACH_ENTRY(prBssDesc, prBSSDescList, rLinkEntry, BSS_DESC_T) { - - /* Loop for each prBssDesc */ - prTargetP2pDesc = scanFindP2pDeviceDesc(prAdapter, - prBssDesc, - aucDeviceID, - TRUE, - FALSE); - - if (prTargetP2pDesc != NULL) { - break; - } - } - - if ((pprBssDesc) && (prTargetP2pDesc != NULL)) { - /* Only valid if prTargetP2pDesc is not NULL. */ - *pprBssDesc = prBssDesc; - } - - return prTargetP2pDesc; -} /* scanSearchTargetP2pDesc */ - - - - -VOID -scanInvalidAllP2pClientDevice ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ) -{ - P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL; - P_P2P_DEVICE_DESC_T prTargetDesc = (P_P2P_DEVICE_DESC_T)NULL; - - LINK_FOR_EACH(prLinkEntry, &prBssDesc->rP2pDeviceList) { - prTargetDesc = LINK_ENTRY(prLinkEntry, P2P_DEVICE_DESC_T, rLinkEntry); - - if (prTargetDesc->fgDevInfoValid) { - prTargetDesc->fgDevInfoValid = FALSE; - } - } - - return; -} /* scanRenewP2pClientDevice */ - -VOID -scanRemoveInvalidP2pClientDevice ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ) -{ - P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL, prNexEntry = (P_LINK_ENTRY_T)NULL; - P_P2P_DEVICE_DESC_T prTargetDesc = (P_P2P_DEVICE_DESC_T)NULL; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - - prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - - LINK_FOR_EACH_SAFE(prLinkEntry, prNexEntry, &prBssDesc->rP2pDeviceList) { - prTargetDesc = LINK_ENTRY(prLinkEntry, P2P_DEVICE_DESC_T, rLinkEntry); - - if (!prTargetDesc->fgDevInfoValid) { - LINK_REMOVE_KNOWN_ENTRY(&prBssDesc->rP2pDeviceList, prLinkEntry); - if ((prP2pConnSettings) && - (prP2pConnSettings->prTargetP2pDesc == prTargetDesc)) { - prP2pConnSettings->prTargetP2pDesc = NULL; - } - kalMemFree(prTargetDesc, VIR_MEM_TYPE, sizeof(P2P_DEVICE_DESC_T)); - } - } - - return; -} /* scanRenewP2pClientDevice */ - - - -P_P2P_DEVICE_DESC_T -scanFindP2pDeviceDesc ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc, - IN UINT_8 aucMacAddr[], - IN BOOLEAN fgIsDeviceAddr, - IN BOOLEAN fgAddIfNoFound - ) -{ - - P_P2P_DEVICE_DESC_T prTargetDesc = (P_P2P_DEVICE_DESC_T)NULL; - P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && - (prBssDesc != NULL) && - (aucMacAddr != NULL)); - - LINK_FOR_EACH(prLinkEntry, &prBssDesc->rP2pDeviceList) { - prTargetDesc = LINK_ENTRY(prLinkEntry, P2P_DEVICE_DESC_T, rLinkEntry); - - if (fgIsDeviceAddr) { - if (EQUAL_MAC_ADDR(prTargetDesc->aucDeviceAddr, aucMacAddr)) { - break; - } - } - else { - if (EQUAL_MAC_ADDR(prTargetDesc->aucInterfaceAddr, aucMacAddr)) { - break; - } - } - - prTargetDesc = NULL; - } - - if ((fgAddIfNoFound) && (prTargetDesc == NULL)) { - /* Target Not Found. */ - // TODO: Use memory pool in the future. - prTargetDesc = kalMemAlloc(sizeof(P2P_DEVICE_DESC_T), VIR_MEM_TYPE); - - if (prTargetDesc) { - kalMemZero(prTargetDesc, sizeof(P2P_DEVICE_DESC_T)); - LINK_ENTRY_INITIALIZE(&(prTargetDesc->rLinkEntry)); - COPY_MAC_ADDR(prTargetDesc->aucDeviceAddr, aucMacAddr); - LINK_INSERT_TAIL(&prBssDesc->rP2pDeviceList, &prTargetDesc->rLinkEntry); - prTargetDesc->fgDevInfoValid = TRUE; - } - else { - ASSERT(FALSE); - } - } - - } while (FALSE); - - return prTargetDesc; -} /* scanFindP2pDeviceDesc */ - - -P_P2P_DEVICE_DESC_T -scanGetP2pDeviceDesc ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ) -{ - - P_P2P_DEVICE_DESC_T prTargetDesc = (P_P2P_DEVICE_DESC_T)NULL; - - ASSERT(prAdapter); - ASSERT(prBssDesc); - - if (prBssDesc->prP2pDesc == NULL) { - - prTargetDesc = kalMemAlloc(sizeof(P2P_DEVICE_DESC_T), VIR_MEM_TYPE); - - if (prTargetDesc) { - kalMemZero(prTargetDesc, sizeof(P2P_DEVICE_DESC_T)); - LINK_ENTRY_INITIALIZE(&(prTargetDesc->rLinkEntry)); - LINK_INSERT_TAIL(&prBssDesc->rP2pDeviceList, &prTargetDesc->rLinkEntry); - prTargetDesc->fgDevInfoValid = TRUE; - prBssDesc->prP2pDesc = prTargetDesc; - /* We are not sure the SrcAddr is Device Address or Interface Address. */ - COPY_MAC_ADDR(prTargetDesc->aucDeviceAddr, prBssDesc->aucSrcAddr); - COPY_MAC_ADDR(prTargetDesc->aucInterfaceAddr, prBssDesc->aucSrcAddr); - } - else { - - ASSERT(FALSE); - } - } - else { - prTargetDesc = prBssDesc->prP2pDesc; - } - - - return prTargetDesc; - -} /* scanFindP2pDeviceDesc */ - - -#if 0 -/*----------------------------------------------------------------------------*/ -/*! -* @brief Convert the Beacon or ProbeResp Frame in SW_RFB_T to Event Packet -* -* @param[in] prSwRfb Pointer to the receiving SW_RFB_T structure. -* -* @retval WLAN_STATUS_SUCCESS It is a valid Scan Result and been sent to the host. -* @retval WLAN_STATUS_FAILURE It is not a valid Scan Result. -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -scanUpdateP2pDeviceDesc ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ) -{ - P_P2P_DEVICE_DESC_T prP2pDesc = (P_P2P_DEVICE_DESC_T)NULL; - P_P2P_ATTRIBUTE_T prP2pAttribute = (P_P2P_ATTRIBUTE_T)NULL; - UINT_16 u2AttributeLen = 0; - UINT_32 u4Idx = 0; - BOOLEAN fgUpdateDevInfo = FALSE; - - P_DEVICE_NAME_TLV_T prP2pDevName = (P_DEVICE_NAME_TLV_T)NULL; - P_P2P_ATTRI_GROUP_INFO_T prP2pAttriGroupInfo = (P_P2P_ATTRI_GROUP_INFO_T)NULL; - - ASSERT(prAdapter); - - prP2pDesc = scanGetP2pDeviceDesc(prAdapter, prBssDesc); - - if (!prP2pDesc) { - ASSERT(FALSE); - return fgUpdateDevInfo; - } - - p2pGetP2PAttriList(prAdapter, prBssDesc->aucIEBuf, prBssDesc->u2IELength, (PPUINT_8)&prP2pAttribute, &u2AttributeLen); - - while (u2AttributeLen >= P2P_ATTRI_HDR_LEN) { - switch (prP2pAttribute->ucId) { - case P2P_ATTRI_ID_P2P_CAPABILITY: /* Beacon, Probe Response */ - { - P_P2P_ATTRI_CAPABILITY_T prP2pAttriCapability = (P_P2P_ATTRI_CAPABILITY_T)NULL; - - prP2pAttriCapability = (P_P2P_ATTRI_CAPABILITY_T)prP2pAttribute; - ASSERT(prP2pAttriCapability->u2Length == 2); - - prP2pDesc->ucDeviceCapabilityBitmap = prP2pAttriCapability->ucDeviceCap; - prP2pDesc->ucGroupCapabilityBitmap = prP2pAttriCapability->ucGroupCap; - } - break; - case P2P_ATTRI_ID_P2P_DEV_ID: /* Beacon */ - { - P_P2P_ATTRI_DEV_ID_T prP2pAttriDevID = (P_P2P_ATTRI_DEV_ID_T)NULL; - - prP2pAttriDevID = (P_P2P_ATTRI_DEV_ID_T)prP2pAttribute; - ASSERT(prP2pAttriDevID->u2Length == P2P_ATTRI_MAX_LEN_P2P_DEV_ID); - - kalMemCopy(prP2pDesc->aucDeviceAddr, prP2pAttriDevID->aucDevAddr, MAC_ADDR_LEN); - } - break; - case P2P_ATTRI_ID_P2P_DEV_INFO: /* Probe Response */ - { - P_P2P_ATTRI_DEV_INFO_T prP2pAttriDevInfo = (P_P2P_ATTRI_DEV_INFO_T)NULL; - P_P2P_DEVICE_TYPE_T prP2pDevType = (P_P2P_DEVICE_TYPE_T)NULL; - UINT_16 u2NameLen = 0, u2Id = 0; - - fgUpdateDevInfo = TRUE; - - prP2pAttriDevInfo = (P_P2P_ATTRI_DEV_INFO_T)prP2pAttribute; - - kalMemCopy(prP2pDesc->aucDeviceAddr, prP2pAttriDevInfo->aucDevAddr, MAC_ADDR_LEN); - - WLAN_GET_FIELD_BE16(&prP2pAttriDevInfo->u2ConfigMethodsBE, &prP2pDesc->u2ConfigMethod); - - prP2pDevType = &prP2pDesc->rPriDevType; - WLAN_GET_FIELD_BE16(&prP2pAttriDevInfo->rPrimaryDevTypeBE.u2CategoryId, &prP2pDevType->u2CategoryID); - WLAN_GET_FIELD_BE16(&prP2pAttriDevInfo->rPrimaryDevTypeBE.u2SubCategoryId, &prP2pDevType->u2SubCategoryID); - - ASSERT(prP2pAttriDevInfo->ucNumOfSecondaryDevType <= P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT); // TODO: Fixme if secondary device type is more than 2. - prP2pDesc->ucSecDevTypeNum = 0; - for (u4Idx = 0; u4Idx < prP2pAttriDevInfo->ucNumOfSecondaryDevType; u4Idx++) { - if (u4Idx < P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT) { - prP2pDevType = &(prP2pDesc->arSecDevType[u4Idx]); - WLAN_GET_FIELD_BE16(&prP2pAttriDevInfo->arSecondaryDevTypeListBE[u4Idx].u2CategoryId, &prP2pDevType->u2CategoryID); - WLAN_GET_FIELD_BE16(&prP2pAttriDevInfo->arSecondaryDevTypeListBE[u4Idx].u2SubCategoryId, &prP2pDevType->u2SubCategoryID); - prP2pDesc->ucSecDevTypeNum++; - } - - } - prP2pDevName = (P_DEVICE_NAME_TLV_T)((PUINT_8)prP2pAttriDevInfo->arSecondaryDevTypeListBE + (u4Idx * sizeof(DEVICE_TYPE_T))); - WLAN_GET_FIELD_BE16(&prP2pDevName->u2Length, &u2NameLen); - WLAN_GET_FIELD_BE16(&prP2pDevName->u2Id, &u2Id); - ASSERT(u2Id == WPS_ATTRI_ID_DEVICE_NAME); - if (u2NameLen > WPS_ATTRI_MAX_LEN_DEVICE_NAME) { - u2NameLen = WPS_ATTRI_MAX_LEN_DEVICE_NAME; - } - prP2pDesc->u2NameLength = u2NameLen; - kalMemCopy(prP2pDesc->aucName, prP2pDevName->aucName, prP2pDesc->u2NameLength); - } - break; - case P2P_ATTRI_ID_P2P_GROUP_INFO: /* Probe Response */ - prP2pAttriGroupInfo = (P_P2P_ATTRI_GROUP_INFO_T)prP2pAttribute; - break; - case P2P_ATTRI_ID_NOTICE_OF_ABSENCE: - break; - case P2P_ATTRI_ID_EXT_LISTEN_TIMING: - // TODO: Not implement yet. - //ASSERT(FALSE); - break; - default: - break; - } - - u2AttributeLen -= (prP2pAttribute->u2Length + P2P_ATTRI_HDR_LEN); - - prP2pAttribute = (P_P2P_ATTRIBUTE_T)((UINT_32)prP2pAttribute + (prP2pAttribute->u2Length + P2P_ATTRI_HDR_LEN)); - - } - - - if (prP2pAttriGroupInfo != NULL) { - P_P2P_CLIENT_INFO_DESC_T prClientInfoDesc = (P_P2P_CLIENT_INFO_DESC_T)NULL; - P_P2P_DEVICE_TYPE_T prP2pDevType = (P_P2P_DEVICE_TYPE_T)NULL; - - scanInvalidAllP2pClientDevice(prAdapter, prBssDesc); - - /* GO/Device itself. */ - prP2pDesc->fgDevInfoValid = TRUE; - - prClientInfoDesc = (P_P2P_CLIENT_INFO_DESC_T)prP2pAttriGroupInfo->arClientDesc; - u2AttributeLen = prP2pAttriGroupInfo->u2Length; - - - while (u2AttributeLen > 0) { - prP2pDesc = scanFindP2pDeviceDesc(prAdapter, prBssDesc, prClientInfoDesc->aucDevAddr, TRUE, TRUE); - - if (!prP2pDesc) { - ASSERT(FALSE); - break; /* while */ - } - - prP2pDesc->fgDevInfoValid = TRUE; - - /* Basic size for P2P client info descriptor. */ - ASSERT(u2AttributeLen >= 25); - if (u2AttributeLen < 25) { - DBGLOG(P2P, WARN, ("Length incorrect warning.\n")); - break; - } - COPY_MAC_ADDR(prP2pDesc->aucInterfaceAddr, prClientInfoDesc->aucIfAddr); - - prP2pDesc->ucDeviceCapabilityBitmap = prClientInfoDesc->ucDeviceCap; - - WLAN_GET_FIELD_BE16(&prClientInfoDesc->u2ConfigMethodsBE, &prP2pDesc->u2ConfigMethod); - - prP2pDevType = &(prP2pDesc->rPriDevType); - WLAN_GET_FIELD_BE16(&prClientInfoDesc->rPrimaryDevTypeBE.u2CategoryId, &prP2pDevType->u2CategoryID); - WLAN_GET_FIELD_BE16(&prClientInfoDesc->rPrimaryDevTypeBE.u2SubCategoryId, &prP2pDevType->u2SubCategoryID); - - ASSERT(prClientInfoDesc->ucNumOfSecondaryDevType <= P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT); - prP2pDesc->ucSecDevTypeNum = 0; - for (u4Idx = 0; u4Idx < prClientInfoDesc->ucNumOfSecondaryDevType; u4Idx++) { - if (u4Idx < P2P_GC_MAX_CACHED_SEC_DEV_TYPE_COUNT) { - prP2pDevType = &(prP2pDesc->arSecDevType[u4Idx]); - WLAN_GET_FIELD_BE16(&prClientInfoDesc->arSecondaryDevTypeListBE[u4Idx].u2CategoryId, &prP2pDevType->u2CategoryID); - WLAN_GET_FIELD_BE16(&prClientInfoDesc->arSecondaryDevTypeListBE[u4Idx].u2SubCategoryId, &prP2pDevType->u2SubCategoryID); - prP2pDesc->ucSecDevTypeNum++; - } - - } - prP2pDevName = (P_DEVICE_NAME_TLV_T)(prClientInfoDesc->arSecondaryDevTypeListBE + (u4Idx * sizeof(DEVICE_TYPE_T))); - WLAN_GET_FIELD_BE16(&prP2pDevName->u2Length, &prP2pDesc->u2NameLength); - if (prP2pDesc->u2NameLength > WPS_ATTRI_MAX_LEN_DEVICE_NAME) { - prP2pDesc->u2NameLength = WPS_ATTRI_MAX_LEN_DEVICE_NAME; - } - - kalMemCopy(prP2pDesc->aucName, prP2pDevName->aucName, prP2pDesc->u2NameLength); - - u2AttributeLen -= (prClientInfoDesc->ucLength + P2P_CLIENT_INFO_DESC_HDR_LEN); - prClientInfoDesc = (P_P2P_CLIENT_INFO_DESC_T)((UINT_32)prClientInfoDesc + (UINT_32)prClientInfoDesc->ucLength + P2P_CLIENT_INFO_DESC_HDR_LEN); - } - - scanRemoveInvalidP2pClientDevice(prAdapter, prBssDesc); - } - - return fgUpdateDevInfo; -} /* end of scanAddP2pDeviceInfo() */ - -#endif - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Convert the Beacon or ProbeResp Frame in SW_RFB_T to Event Packet -* -* @param[in] prSwRfb Pointer to the receiving SW_RFB_T structure. -* -* @retval WLAN_STATUS_SUCCESS It is a valid Scan Result and been sent to the host. -* @retval WLAN_STATUS_FAILURE It is not a valid Scan Result. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -scanSendDeviceDiscoverEvent ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc, - IN P_SW_RFB_T prSwRfb - ) -{ - EVENT_P2P_DEV_DISCOVER_RESULT_T rEventDevInfo; -#if 1 - P_LINK_ENTRY_T prLinkEntry = (P_LINK_ENTRY_T)NULL; - P_P2P_DEVICE_DESC_T prTargetDesc = (P_P2P_DEVICE_DESC_T)NULL; - - LINK_FOR_EACH(prLinkEntry, &prBssDesc->rP2pDeviceList) { - prTargetDesc = LINK_ENTRY(prLinkEntry, P2P_DEVICE_DESC_T, rLinkEntry); - - COPY_MAC_ADDR(rEventDevInfo.aucDeviceAddr, prTargetDesc->aucDeviceAddr); - COPY_MAC_ADDR(rEventDevInfo.aucInterfaceAddr, prTargetDesc->aucInterfaceAddr); - - rEventDevInfo.ucDeviceCapabilityBitmap = prTargetDesc->ucDeviceCapabilityBitmap; - rEventDevInfo.ucGroupCapabilityBitmap = prTargetDesc->ucGroupCapabilityBitmap; - rEventDevInfo.u2ConfigMethod = prTargetDesc->u2ConfigMethod; - - kalMemCopy(&rEventDevInfo.rPriDevType, - &prTargetDesc->rPriDevType, - sizeof(P2P_DEVICE_TYPE_T)); - - kalMemCopy(rEventDevInfo.arSecDevType, - prTargetDesc->arSecDevType, - (prTargetDesc->ucSecDevTypeNum * sizeof(P2P_DEVICE_TYPE_T))); - - rEventDevInfo.ucSecDevTypeNum = prTargetDesc->ucSecDevTypeNum; - - rEventDevInfo.u2NameLength = prTargetDesc->u2NameLength; - kalMemCopy(rEventDevInfo.aucName, - prTargetDesc->aucName, - prTargetDesc->u2NameLength); - - COPY_MAC_ADDR(rEventDevInfo.aucBSSID, prBssDesc->aucBSSID); - - if (prTargetDesc == prBssDesc->prP2pDesc) { - nicRxAddP2pDevice(prAdapter, - &rEventDevInfo, - prBssDesc->aucIEBuf, - prBssDesc->u2IELength); - } - else { - nicRxAddP2pDevice(prAdapter, - &rEventDevInfo, - NULL, - 0); - } - } - - kalP2PIndicateFound(prAdapter->prGlueInfo); - -#else - - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - P_P2P_ATTRIBUTE_T prP2pAttribute = (P_P2P_ATTRIBUTE_T)NULL; - UINT_16 u2AttributeLen = 0; - UINT_32 u4Idx = 0; - P_P2P_ATTRI_GROUP_INFO_T prP2pAttriGroupInfo = (P_P2P_ATTRI_GROUP_INFO_T)NULL; - P_DEVICE_NAME_TLV_T prP2pDevName = (P_DEVICE_NAME_TLV_T)NULL; - - ASSERT(prAdapter); - - prP2pSpecificBssInfo = &prAdapter->rWifiVar.rP2pSpecificBssInfo; - -#if 1 - p2pGetP2PAttriList(prAdapter, prBssDesc->aucIEBuf, prBssDesc->u2IELength, (PPUINT_8)&prP2pAttribute, &u2AttributeLen); -#else - prP2pAttribute = (P_P2P_ATTRIBUTE_T)&prP2pSpecificBssInfo->aucAttributesCache[0]; - u2AttributeLen = prP2pSpecificBssInfo->u2AttributeLen; -#endif - rEventDevInfo.fgDevInfoValid = FALSE; - - while (u2AttributeLen >= P2P_ATTRI_HDR_LEN) { - switch (prP2pAttribute->ucId) { - case P2P_ATTRI_ID_P2P_CAPABILITY: - { - P_P2P_ATTRI_CAPABILITY_T prP2pAttriCapability = (P_P2P_ATTRI_CAPABILITY_T)NULL; - - prP2pAttriCapability = (P_P2P_ATTRI_CAPABILITY_T)prP2pAttribute; - ASSERT(prP2pAttriCapability->u2Length == 2); - rEventDevInfo.ucDeviceCapabilityBitmap = prP2pAttriCapability->ucDeviceCap; - rEventDevInfo.ucGroupCapabilityBitmap = prP2pAttriCapability->ucGroupCap; - } - break; - case P2P_ATTRI_ID_P2P_DEV_ID: - { - P_P2P_ATTRI_DEV_ID_T prP2pAttriDevID = (P_P2P_ATTRI_DEV_ID_T)NULL; - - prP2pAttriDevID = (P_P2P_ATTRI_DEV_ID_T)prP2pAttribute; - ASSERT(prP2pAttriDevID->u2Length == 6); - kalMemCopy(rEventDevInfo.aucCommunicateAddr, prP2pAttriDevID->aucDevAddr, MAC_ADDR_LEN); - } - break; - case P2P_ATTRI_ID_P2P_DEV_INFO: - { - P_P2P_ATTRI_DEV_INFO_T prP2pAttriDevInfo = (P_P2P_ATTRI_DEV_INFO_T)NULL; - P_P2P_DEVICE_TYPE_T prP2pDevType = (P_P2P_DEVICE_TYPE_T)NULL; - - prP2pAttriDevInfo = (P_P2P_ATTRI_DEV_INFO_T)prP2pAttribute; - rEventDevInfo.fgDevInfoValid = TRUE; - kalMemCopy(rEventDevInfo.aucCommunicateAddr, prP2pAttriDevInfo->aucDevAddr, MAC_ADDR_LEN); - rEventDevInfo.u2ConfigMethod = prP2pAttriDevInfo->u2ConfigMethodsBE; - - prP2pDevType = &rEventDevInfo.rPriDevType; - prP2pDevType->u2CategoryID = prP2pAttriDevInfo->rPrimaryDevTypeBE.u2CategoryId; - prP2pDevType->u2SubCategoryID = prP2pAttriDevInfo->rPrimaryDevTypeBE.u2SubCategoryId; - - ASSERT(prP2pAttriDevInfo->ucNumOfSecondaryDevType <= 2); // TODO: Fixme if secondary device type is more than 2. - for (u4Idx = 0; u4Idx < prP2pAttriDevInfo->ucNumOfSecondaryDevType; u4Idx++) { - // TODO: Current sub device type can only support 2. - prP2pDevType = &rEventDevInfo.arSecDevType[u4Idx]; - prP2pDevType->u2CategoryID = prP2pAttriDevInfo->rPrimaryDevTypeBE.u2CategoryId; - prP2pDevType->u2SubCategoryID = prP2pAttriDevInfo->rPrimaryDevTypeBE.u2SubCategoryId; - } - - prP2pDevName = (P_DEVICE_NAME_TLV_T)(prP2pAttriDevInfo->arSecondaryDevTypeListBE + (u4Idx * sizeof(DEVICE_TYPE_T))); - ASSERT(prP2pDevName->u2Id == 0x1011); - ASSERT(prP2pDevName->u2Length <= 32); // TODO: Fixme if device name length is longer than 32 bytes. - kalMemCopy(rEventDevInfo.aucName, prP2pDevName->aucName, prP2pDevName->u2Length); - } - break; - case P2P_ATTRI_ID_P2P_GROUP_INFO: - prP2pAttriGroupInfo = (P_P2P_ATTRI_GROUP_INFO_T)prP2pAttribute; - break; - } - - u2AttributeLen -= (prP2pAttribute->u2Length + P2P_ATTRI_HDR_LEN); - - prP2pAttribute = (P_P2P_ATTRIBUTE_T)((UINT_32)prP2pAttribute + (prP2pAttribute->u2Length + P2P_ATTRI_HDR_LEN)); - - } - - nicRxAddP2pDevice(prAdapter, - &rEventDevInfo); - - if (prP2pAttriGroupInfo != NULL) { - P_P2P_CLIENT_INFO_DESC_T prClientInfoDesc = (P_P2P_CLIENT_INFO_DESC_T)NULL; - P_P2P_DEVICE_TYPE_T prP2pDevType = (P_P2P_DEVICE_TYPE_T)NULL; - - prClientInfoDesc = prP2pAttriGroupInfo->arClientDesc; - u2AttributeLen = prP2pAttriGroupInfo->u2Length; - - while (u2AttributeLen > 0) { - /* Basic size for P2P client info descriptor. */ - ASSERT(u2AttributeLen >= 25); - rEventDevInfo.fgDevInfoValid = TRUE; - kalMemCopy(rEventDevInfo.aucCommunicateAddr, prClientInfoDesc->aucIfAddr, MAC_ADDR_LEN); - rEventDevInfo.ucDeviceCapabilityBitmap = prClientInfoDesc->ucDeviceCap; - rEventDevInfo.u2ConfigMethod = prClientInfoDesc->u2ConfigMethodsBE; - - prP2pDevType = &rEventDevInfo.rPriDevType; - prP2pDevType->u2CategoryID = prClientInfoDesc->rPrimaryDevTypeBE.u2CategoryId; - prP2pDevType->u2SubCategoryID = prClientInfoDesc->rPrimaryDevTypeBE.u2SubCategoryId; - - ASSERT(prClientInfoDesc->ucNumOfSecondaryDevType <= 2); // TODO: Fixme if secondary device type is more than 2. - for (u4Idx = 0; u4Idx < prClientInfoDesc->ucNumOfSecondaryDevType; u4Idx++) { - // TODO: Current sub device type can only support 2. - prP2pDevType = &rEventDevInfo.arSecDevType[u4Idx]; - prP2pDevType->u2CategoryID = prClientInfoDesc->arSecondaryDevTypeListBE[u4Idx].u2CategoryId; - prP2pDevType->u2SubCategoryID = prClientInfoDesc->arSecondaryDevTypeListBE[u4Idx].u2SubCategoryId; - } - - prP2pDevName = (P_DEVICE_NAME_TLV_T)(prClientInfoDesc->arSecondaryDevTypeListBE + (u4Idx * sizeof(DEVICE_TYPE_T))); - ASSERT(prP2pDevName->u2Id == 0x1011); - ASSERT(prP2pDevName->u2Length <= 32); // TODO: Fixme if device name length is longer than 32 bytes. - kalMemCopy(&rEventDevInfo.aucName, prP2pDevName->aucName, prP2pDevName->u2Length); - - nicRxAddP2pDevice(prAdapter, - &rEventDevInfo); - - u2AttributeLen -= prP2pAttriGroupInfo->u2Length; - prP2pAttriGroupInfo = prP2pAttriGroupInfo + prP2pAttriGroupInfo->u2Length + 1; - } - - } -#endif - return WLAN_STATUS_SUCCESS; -} /* scanSendDeviceDiscoverEvent */ - -VOID -scanP2pProcessBeaconAndProbeResp( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN P_WLAN_STATUS prStatus, - IN P_BSS_DESC_T prBssDesc, - IN P_WLAN_BEACON_FRAME_T prWlanBeaconFrame - ) -{ - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - - if (prBssDesc->fgIsP2PPresent) { - - if ((!prP2pBssInfo->ucDTIMPeriod) && // First time. - (prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE) && // P2P GC - (prP2pBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED) && // Connected - ((prWlanBeaconFrame->u2FrameCtrl & MASK_FRAME_TYPE) == MAC_FRAME_BEACON) && // TX Beacon - EQUAL_SSID(prBssDesc->aucSSID, // SSID Match - prBssDesc->ucSSIDLen, - prP2pConnSettings->aucSSID, - prP2pConnSettings->ucSSIDLen)) { - - - prP2pBssInfo->ucDTIMPeriod = prBssDesc->ucDTIMPeriod; - nicPmIndicateBssConnected(prAdapter, NETWORK_TYPE_P2P_INDEX); - } - - do { - RF_CHANNEL_INFO_T rChannelInfo; - - ASSERT_BREAK((prSwRfb != NULL) && (prBssDesc != NULL)); - - if (((prWlanBeaconFrame->u2FrameCtrl & MASK_FRAME_TYPE) != MAC_FRAME_PROBE_RSP)) { - // Only report Probe Response frame to supplicant. - /* Probe response collect much more information. */ - break; - } - - rChannelInfo.ucChannelNum = prBssDesc->ucChannelNum; - rChannelInfo.eBand = prBssDesc->eBand; - - kalP2PIndicateBssInfo(prAdapter->prGlueInfo, - (PUINT_8)prSwRfb->pvHeader, - (UINT_32)prSwRfb->u2PacketLen, - &rChannelInfo, - RCPI_TO_dBm(prBssDesc->ucRCPI)); - - - } while (FALSE); - } -} - -VOID -scnEventReturnChannel ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucScnSeqNum - ) -{ - - CMD_SCAN_CANCEL rCmdScanCancel; - - /* send cancel message to firmware domain */ - rCmdScanCancel.ucSeqNum = ucScnSeqNum; - rCmdScanCancel.ucIsExtChannel = (UINT_8) FALSE; - - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SCAN_CANCEL, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_SCAN_CANCEL), - (PUINT_8)&rCmdScanCancel, - NULL, - 0); - - return; -} /* scnEventReturnChannel */ - -VOID -scanRemoveAllP2pBssDesc( - IN P_ADAPTER_T prAdapter - ) -{ - P_LINK_T prBSSDescList; - P_BSS_DESC_T prBssDesc; - P_BSS_DESC_T prBSSDescNext; - - ASSERT(prAdapter); - - prBSSDescList = &(prAdapter->rWifiVar.rScanInfo.rBSSDescList); - - /* Search BSS Desc from current SCAN result list. */ - LINK_FOR_EACH_ENTRY_SAFE(prBssDesc, prBSSDescNext, prBSSDescList, rLinkEntry, BSS_DESC_T) { - scanRemoveP2pBssDesc(prAdapter, prBssDesc); - } -} /* scanRemoveAllP2pBssDesc */ - -VOID -scanRemoveP2pBssDesc( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ) -{ - - return; -} /* scanRemoveP2pBssDesc */ - - -P_BSS_DESC_T -scanP2pSearchDesc ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prP2pBssInfo, - IN P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo - ) -{ - P_BSS_DESC_T prCandidateBssDesc = (P_BSS_DESC_T)NULL, prBssDesc = (P_BSS_DESC_T)NULL; - P_LINK_T prBssDescList = (P_LINK_T)NULL; - - do { - if ((prAdapter == NULL) || - (prP2pBssInfo == NULL) || - (prConnReqInfo == NULL)) { - break; - } - - - prBssDescList = &(prAdapter->rWifiVar.rScanInfo.rBSSDescList); - - DBGLOG(P2P, LOUD, ("Connecting to BSSID: "MACSTR"\n", MAC2STR(prConnReqInfo->aucBssid))); - DBGLOG(P2P, LOUD, ("Connecting to SSID:%s, length:%d\n", - prConnReqInfo->rSsidStruct.aucSsid, - prConnReqInfo->rSsidStruct.ucSsidLen)); - - LINK_FOR_EACH_ENTRY(prBssDesc, prBssDescList, rLinkEntry, BSS_DESC_T) { - DBGLOG(P2P, LOUD, ("Checking BSS: "MACSTR"\n", MAC2STR(prBssDesc->aucBSSID))); - - if (prBssDesc->eBSSType != BSS_TYPE_INFRASTRUCTURE) { - DBGLOG(P2P, LOUD, ("Ignore mismatch BSS type.\n")); - continue; - } - - - if (UNEQUAL_MAC_ADDR(prBssDesc->aucBSSID, prConnReqInfo->aucBssid)) { - DBGLOG(P2P, LOUD, ("Ignore mismatch BSSID.\n")); - continue; - } - - - /* SSID should be the same? SSID is vary for each connection. so... */ - if (UNEQUAL_SSID(prConnReqInfo->rSsidStruct.aucSsid, - prConnReqInfo->rSsidStruct.ucSsidLen, - prBssDesc->aucSSID, - prBssDesc->ucSSIDLen)) { - - DBGLOG(P2P, TRACE, ("Connecting to BSSID: "MACSTR"\n", MAC2STR(prConnReqInfo->aucBssid))); - DBGLOG(P2P, TRACE, ("Connecting to SSID:%s, length:%d\n", - prConnReqInfo->rSsidStruct.aucSsid, - prConnReqInfo->rSsidStruct.ucSsidLen)); - DBGLOG(P2P, TRACE, ("Checking SSID:%s, length:%d\n", - prBssDesc->aucSSID, - prBssDesc->ucSSIDLen)); - DBGLOG(P2P, TRACE, ("Ignore mismatch SSID, (But BSSID match).\n")); - ASSERT(FALSE); - break; - } - - /* Final decision. */ - prCandidateBssDesc = prBssDesc; - break; - } - - - - } while (FALSE); - - return prCandidateBssDesc; -} /* scanP2pSearchDesc */ - - - - diff --git a/drivers/net/wireless/mt5931/mgmt/p2p_state.c b/drivers/net/wireless/mt5931/mgmt/p2p_state.c deleted file mode 100755 index da30ecff152b..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/p2p_state.c +++ /dev/null @@ -1,575 +0,0 @@ -#include "p2p_precomp.h" - - -BOOLEAN -p2pStateInit_IDLE ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN P_BSS_INFO_T prP2pBssInfo, - OUT P_ENUM_P2P_STATE_T peNextState - ) -{ - BOOLEAN fgIsTransOut = FALSE; -// P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && - (prP2pFsmInfo != NULL) && - (prP2pBssInfo != NULL) && - (peNextState != NULL)); - - if ((prP2pBssInfo->eIntendOPMode == OP_MODE_ACCESS_POINT) && IS_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX)) { - P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo); - - fgIsTransOut = TRUE; - prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GO_START_BSS; - *peNextState = P2P_STATE_REQING_CHANNEL; - - } - else { -#if 0 - else if (IS_NET_PWR_STATE_ACTIVE(prAdapter, NETWORK_TYPE_P2P_INDEX)) { - - ASSERT((prP2pBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) || - (prP2pBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE)); - - prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo; - - if (prChnlReqInfo->fgIsChannelRequested) { - /* Start a timer for return channel. */ - DBGLOG(P2P, TRACE, ("start a GO channel timer.\n")); - } - - } - -#endif - cnmTimerStartTimer(prAdapter, &(prP2pFsmInfo->rP2pFsmTimeoutTimer), 5000); - } - - } while (FALSE); - - return fgIsTransOut; -} /* p2pStateInit_IDLE */ - - -VOID -p2pStateAbort_IDLE ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN ENUM_P2P_STATE_T eNextState - ) -{ - - P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && - (prP2pFsmInfo != NULL)); - - prChnlReqInfo = &prP2pFsmInfo->rChnlReqInfo; - - - if (prChnlReqInfo->fgIsChannelRequested) { - /* Release channel before timeout. */ - p2pFuncReleaseCh(prAdapter, prChnlReqInfo); - } - - - /* Stop timer for leaving this state. */ - cnmTimerStopTimer(prAdapter, &(prP2pFsmInfo->rP2pFsmTimeoutTimer)); - - } while (FALSE); - - return; -} /* p2pStateAbort_IDLE */ - - - -VOID -p2pStateInit_CHNL_ON_HAND ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_INFO_T prP2pBssInfo, - IN P_P2P_FSM_INFO_T prP2pFsmInfo - ) -{ - P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL)); - - prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo); - - /* Store the original channel info. */ - prChnlReqInfo->ucOriChnlNum = prP2pBssInfo->ucPrimaryChannel; - prChnlReqInfo->eOriBand = prP2pBssInfo->eBand; - prChnlReqInfo->eOriChnlSco = prP2pBssInfo->eBssSCO; - - /* RX Probe Request would check primary channel.*/ - prP2pBssInfo->ucPrimaryChannel = prChnlReqInfo->ucReqChnlNum; - prP2pBssInfo->eBand = prChnlReqInfo->eBand; - prP2pBssInfo->eBssSCO = prChnlReqInfo->eChnlSco; - - - DBGLOG(P2P, TRACE, ("start a channel on hand timer.\n")); - cnmTimerStartTimer(prAdapter, - &(prP2pFsmInfo->rP2pFsmTimeoutTimer), - prChnlReqInfo->u4MaxInterval); - - kalP2PIndicateChannelReady(prAdapter->prGlueInfo, - prChnlReqInfo->u8Cookie, - prChnlReqInfo->ucReqChnlNum, - prChnlReqInfo->eBand, - prChnlReqInfo->eChnlSco, - prChnlReqInfo->u4MaxInterval); - - } while (FALSE); - - return; -} /* p2pStateInit_CHNL_ON_HAND */ - - -VOID -p2pStateAbort_CHNL_ON_HAND ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN P_BSS_INFO_T prP2pBssInfo, - IN ENUM_P2P_STATE_T eNextState - ) -{ - P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL; - - - do { - ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL)); - - prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo); - - cnmTimerStopTimer(prAdapter, &(prP2pFsmInfo->rP2pFsmTimeoutTimer)); - - /* Restore the original channel info. */ - prP2pBssInfo->ucPrimaryChannel = prChnlReqInfo->ucOriChnlNum; - prP2pBssInfo->eBand = prChnlReqInfo->eOriBand; - prP2pBssInfo->eBssSCO = prChnlReqInfo->eOriChnlSco; - - if (eNextState != P2P_STATE_CHNL_ON_HAND) { - /* Indicate channel return. */ - kalP2PIndicateChannelExpired(prAdapter->prGlueInfo, &prP2pFsmInfo->rChnlReqInfo); - - // Return Channel. - p2pFuncReleaseCh(prAdapter, &(prP2pFsmInfo->rChnlReqInfo)); - } - - } while (FALSE); - return; -} /* p2pStateAbort_CHNL_ON_HAND */ - - -VOID -p2pStateAbort_REQING_CHANNEL ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN ENUM_P2P_STATE_T eNextState - ) -{ - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - - do { - - ASSERT_BREAK((prAdapter != NULL) && - (prP2pFsmInfo != NULL) && - (eNextState < P2P_STATE_NUM)); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; - - if (eNextState == P2P_STATE_IDLE) { - if (prP2pBssInfo->eIntendOPMode == OP_MODE_ACCESS_POINT) { - /* Intend to be AP. */ - /* Setup for AP mode. */ - p2pFuncStartGO(prAdapter, - prP2pBssInfo, - prP2pSpecificBssInfo->aucGroupSsid, - prP2pSpecificBssInfo->u2GroupSsidLen, - prP2pSpecificBssInfo->ucPreferredChannel, - prP2pSpecificBssInfo->eRfBand, - prP2pSpecificBssInfo->eRfSco, - prP2pFsmInfo->fgIsApMode); - - } - else { - // Return Channel. - p2pFuncReleaseCh(prAdapter, &(prP2pFsmInfo->rChnlReqInfo)); - } - - } - - - } while (FALSE); - - return; -} /* p2pStateInit_AP_CHANNEL_DETECT */ - - -VOID -p2pStateInit_AP_CHANNEL_DETECT ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo - ) -{ - P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL)); - - prScanReqInfo = &(prP2pFsmInfo->rScanReqInfo); - - prScanReqInfo->eScanType = SCAN_TYPE_PASSIVE_SCAN; - prScanReqInfo->eChannelSet = SCAN_CHANNEL_2G4; - prScanReqInfo->u2PassiveDewellTime = 50; // 50ms for passive channel load detection - prScanReqInfo->fgIsAbort = TRUE; - prScanReqInfo->fgIsScanRequest = TRUE; - prScanReqInfo->ucNumChannelList = 0; - prScanReqInfo->u4BufLength = 0; - prScanReqInfo->rSsidStruct.ucSsidLen = 0; - - p2pFuncRequestScan(prAdapter, prScanReqInfo); - - } while (FALSE); - - return; -} /* p2pStateInit_AP_CHANNEL_DETECT */ - - - -VOID -p2pStateAbort_AP_CHANNEL_DETECT ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo, - IN ENUM_P2P_STATE_T eNextState - ) -{ - P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T)NULL; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - - do { - - if (eNextState == P2P_STATE_REQING_CHANNEL) { - UINT_8 ucPreferedChnl = 0; - ENUM_BAND_T eBand = BAND_NULL; - ENUM_CHNL_EXT_T eSco = CHNL_EXT_SCN; - - prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo); - - /* Determine the channel for AP. */ - if (cnmPreferredChannel(prAdapter, - &eBand, - &ucPreferedChnl, - &eSco) == FALSE) { - - prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - - if ((ucPreferedChnl = prP2pConnSettings->ucOperatingChnl) == 0) { - - if (scnQuerySparseChannel(prAdapter, &eBand, &ucPreferedChnl) == FALSE) { - - // What to do? - ASSERT(FALSE); - // TODO: Pick up a valid channel from channel list. - } - } - } - - - prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GO_START_BSS; - prChnlReqInfo->ucReqChnlNum = prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl; - prChnlReqInfo->eBand = prP2pSpecificBssInfo->eRfBand = eBand; - prChnlReqInfo->eChnlSco = prP2pSpecificBssInfo->eRfSco = eSco; - } - else { - p2pFuncCancelScan(prAdapter, &(prP2pFsmInfo->rScanReqInfo)); - } - - - } while (FALSE); - - return; -} /* p2pStateAbort_AP_CHANNEL_DETECT */ - - -VOID -p2pStateInit_SCAN ( - - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo - ) -{ - P_P2P_SCAN_REQ_INFO_T prScanReqInfo = (P_P2P_SCAN_REQ_INFO_T)NULL; - - do { - - ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL)); - - prScanReqInfo = &prP2pFsmInfo->rScanReqInfo; - - prScanReqInfo->fgIsScanRequest = TRUE; - - p2pFuncRequestScan(prAdapter, prScanReqInfo); - - } while (FALSE); - return; -} /* p2pStateInit_SCAN */ - - -VOID -p2pStateAbort_SCAN ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN ENUM_P2P_STATE_T eNextState - ) -{ - do { - ASSERT_BREAK(prAdapter != NULL); - - // 1. Scan cancel. (Make sure the scan request is invalid. - p2pFuncCancelScan(prAdapter, &(prP2pFsmInfo->rScanReqInfo)); - - // Scan done indication. - kalP2PIndicateScanDone(prAdapter->prGlueInfo, prP2pFsmInfo->rScanReqInfo.fgIsAbort); - } while (FALSE); - - return; -} /* p2pStateAbort_SCAN */ - - -VOID -p2pStateInit_GC_JOIN ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN P_BSS_INFO_T prP2pBssInfo, - IN P_P2P_JOIN_INFO_T prJoinInfo, - IN P_BSS_DESC_T prBssDesc - ) -{ - P_MSG_JOIN_REQ_T prJoinReqMsg = (P_MSG_JOIN_REQ_T)NULL; - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - - do { - ASSERT_BREAK((prAdapter != NULL) && - (prP2pFsmInfo != NULL) && - (prP2pBssInfo != NULL) && - (prJoinInfo != NULL) && - (prBssDesc != NULL)); - - prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - - if (prBssDesc->ucSSIDLen) { - COPY_SSID(prP2pConnSettings->aucSSID, - prP2pConnSettings->ucSSIDLen, - prBssDesc->aucSSID, - prBssDesc->ucSSIDLen); - } - - - // Setup a join timer. - DBGLOG(P2P, TRACE, ("Start a join init timer\n")); - cnmTimerStartTimer(prAdapter, - &(prP2pFsmInfo->rP2pFsmTimeoutTimer), - (prP2pFsmInfo->u4GrantInterval - AIS_JOIN_CH_GRANT_THRESHOLD)); - - //2 <1> We are goin to connect to this BSS - prBssDesc->fgIsConnecting = TRUE; - - //2 <2> Setup corresponding STA_RECORD_T - prStaRec = bssCreateStaRecFromBssDesc(prAdapter, - (prBssDesc->fgIsP2PPresent?(STA_TYPE_P2P_GO):(STA_TYPE_LEGACY_AP)), - NETWORK_TYPE_P2P_INDEX, - prBssDesc); - - if (prStaRec == NULL) { - DBGLOG(P2P, TRACE, ("Create station record fail\n")); - break; - } - - - prJoinInfo->prTargetStaRec = prStaRec; - prJoinInfo->fgIsJoinComplete = FALSE; - prJoinInfo->u4BufLength = 0; - - //2 <2.1> Sync. to FW domain - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - - - if (prP2pBssInfo->eConnectionState == PARAM_MEDIA_STATE_DISCONNECTED) { - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - - prStaRec->fgIsReAssoc = FALSE; - - prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - - switch (prP2pConnSettings->eAuthMode) { - case AUTH_MODE_OPEN: /* Note: Omit break here. */ - case AUTH_MODE_WPA: - case AUTH_MODE_WPA_PSK: - case AUTH_MODE_WPA2: - case AUTH_MODE_WPA2_PSK: - prJoinInfo->ucAvailableAuthTypes = (UINT_8)AUTH_TYPE_OPEN_SYSTEM; - break; - case AUTH_MODE_SHARED: - prJoinInfo->ucAvailableAuthTypes = (UINT_8)AUTH_TYPE_SHARED_KEY; - break; - case AUTH_MODE_AUTO_SWITCH: - DBGLOG(P2P, LOUD, ("JOIN INIT: eAuthMode == AUTH_MODE_AUTO_SWITCH\n")); - prJoinInfo->ucAvailableAuthTypes = (UINT_8)(AUTH_TYPE_OPEN_SYSTEM | - AUTH_TYPE_SHARED_KEY); - break; - default: - ASSERT(!(prP2pConnSettings->eAuthMode == AUTH_MODE_WPA_NONE)); - DBGLOG(P2P, ERROR, ("JOIN INIT: Auth Algorithm : %d was not supported by JOIN\n", - prP2pConnSettings->eAuthMode)); - /* TODO(Kevin): error handling ? */ - return; - } - prStaRec->ucTxAuthAssocRetryLimit = TX_AUTH_ASSOCI_RETRY_LIMIT; - } - else { - ASSERT(FALSE); - // TODO: Shall we considering ROAMIN case for P2P Device?. - } - - - //2 <4> Use an appropriate Authentication Algorithm Number among the ucAvailableAuthTypes. - if (prJoinInfo->ucAvailableAuthTypes & - (UINT_8)AUTH_TYPE_OPEN_SYSTEM) { - - DBGLOG(P2P, TRACE, ("JOIN INIT: Try to do Authentication with AuthType == OPEN_SYSTEM.\n")); - - prJoinInfo->ucAvailableAuthTypes &= - ~(UINT_8)AUTH_TYPE_OPEN_SYSTEM; - - prStaRec->ucAuthAlgNum = (UINT_8)AUTH_ALGORITHM_NUM_OPEN_SYSTEM; - } - else if (prJoinInfo->ucAvailableAuthTypes & - (UINT_8)AUTH_TYPE_SHARED_KEY) { - - DBGLOG(P2P, TRACE, ("JOIN INIT: Try to do Authentication with AuthType == SHARED_KEY.\n")); - - prJoinInfo->ucAvailableAuthTypes &= - ~(UINT_8)AUTH_TYPE_SHARED_KEY; - - prStaRec->ucAuthAlgNum = (UINT_8)AUTH_ALGORITHM_NUM_SHARED_KEY; - } - else if (prJoinInfo->ucAvailableAuthTypes & - (UINT_8)AUTH_TYPE_FAST_BSS_TRANSITION) { - - DBGLOG(P2P, TRACE, ("JOIN INIT: Try to do Authentication with AuthType == FAST_BSS_TRANSITION.\n")); - - prJoinInfo->ucAvailableAuthTypes &= - ~(UINT_8)AUTH_TYPE_FAST_BSS_TRANSITION; - - prStaRec->ucAuthAlgNum = (UINT_8)AUTH_ALGORITHM_NUM_FAST_BSS_TRANSITION; - } - else { - ASSERT(0); - } - - - //4 <5> Overwrite Connection Setting for eConnectionPolicy == ANY (Used by Assoc Req) - if (prBssDesc->ucSSIDLen) { - COPY_SSID(prJoinInfo->rSsidStruct.aucSsid, - prJoinInfo->rSsidStruct.ucSsidLen, - prBssDesc->aucSSID, - prBssDesc->ucSSIDLen); - } - - //2 <5> Backup desired channel. - - //2 <6> Send a Msg to trigger SAA to start JOIN process. - prJoinReqMsg = (P_MSG_JOIN_REQ_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_JOIN_REQ_T)); - - if (!prJoinReqMsg) { - DBGLOG(P2P, TRACE, ("Allocation Join Message Fail\n")); - ASSERT(FALSE); - return; - } - - prJoinReqMsg->rMsgHdr.eMsgId = MID_P2P_SAA_FSM_START; - prJoinReqMsg->ucSeqNum = ++prJoinInfo->ucSeqNumOfReqMsg; - prJoinReqMsg->prStaRec = prStaRec; - - // TODO: Consider fragmentation info in station record. - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prJoinReqMsg, - MSG_SEND_METHOD_BUF); - - - - - } while (FALSE); - - return; -} /* p2pStateInit_GC_JOIN */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process of JOIN Abort. Leave JOIN State & Abort JOIN. -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pStateAbort_GC_JOIN ( - IN P_ADAPTER_T prAdapter, - IN P_P2P_FSM_INFO_T prP2pFsmInfo, - IN P_P2P_JOIN_INFO_T prJoinInfo, - IN ENUM_P2P_STATE_T eNextState - ) -{ - P_MSG_JOIN_ABORT_T prJoinAbortMsg = (P_MSG_JOIN_ABORT_T)NULL; - - - do { - ASSERT_BREAK((prAdapter != NULL) && (prP2pFsmInfo != NULL) && (prJoinInfo != NULL)); - - if (prJoinInfo->fgIsJoinComplete == FALSE) { - - prJoinAbortMsg = (P_MSG_JOIN_ABORT_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_JOIN_ABORT_T)); - if (!prJoinAbortMsg) { - DBGLOG(P2P, TRACE, ("Fail to allocate join abort message buffer\n")); - ASSERT(FALSE); - return; - } - - prJoinAbortMsg->rMsgHdr.eMsgId = MID_P2P_SAA_FSM_ABORT; - prJoinAbortMsg->ucSeqNum = prJoinInfo->ucSeqNumOfReqMsg; - prJoinAbortMsg->prStaRec = prJoinInfo->prTargetStaRec; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prJoinAbortMsg, - MSG_SEND_METHOD_BUF); - - } - - /* Stop Join Timer. */ - cnmTimerStopTimer(prAdapter, &(prP2pFsmInfo->rP2pFsmTimeoutTimer)); - - /* Release channel requested. */ - p2pFuncReleaseCh(prAdapter, &(prP2pFsmInfo->rChnlReqInfo)); - - } while (FALSE); - - return; - -} /* p2pStateAbort_GC_JOIN */ - - - diff --git a/drivers/net/wireless/mt5931/mgmt/privacy.c b/drivers/net/wireless/mt5931/mgmt/privacy.c deleted file mode 100755 index 66b33a631b71..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/privacy.c +++ /dev/null @@ -1,1024 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/privacy.c#1 $ -*/ - -/*! \file "privacy.c" - \brief This file including the protocol layer privacy function. - - This file provided the macros and functions library support for the - protocol layer security setting from rsn.c and nic_privacy.c - -*/ - - - -/* -** $Log: privacy.c $ - * - * 11 10 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * change the debug module level. - * - * 10 20 2011 terry.wu - * NULL - * Fix Hotspot deauth send failed. - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 06 28 2011 tsaiyuan.hsu - * [WCXRP00000819] [MT6620 Wi-Fi][Driver] check if staRec is NULL or not in secCheckClassError - * check if staRec is NULL or not in secCheckClassError. - * - * 06 09 2011 tsaiyuan.hsu - * [WCXRP00000760] [MT5931 Wi-Fi][FW] Refine rxmHandleMacRxDone to reduce code size - * move send_auth at rxmHandleMacRxDone in firmware to driver to reduce code size. - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Change Station Type in Station Record, Modify MACRO definition for getting station type & network type index & Role. - * - * 11 04 2010 wh.su - * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID - * adding the p2p random ssid support. - * - * 10 04 2010 cp.wu - * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by ENUM_NETWORK_TYPE_INDEX_T only - * remove ENUM_NETWORK_TYPE_T definitions - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 09 01 2010 wh.su - * NULL - * adding the wapi support for integration test. - * - * 07 24 2010 wh.su - * - * .support the Wi-Fi RSN - * - * 07 20 2010 wh.su - * - * adding the wapi code. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * modify some code for concurrent network. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * [WPD00003833][MT6620 and MT5931] Driver migration - * enable RX management frame handling. - * - * 06 19 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * adding the compiling flag for migration. - * - * 06 19 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * consdier the concurrent network setting. - * - * 06 18 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * migration the security related function from firmware. - * - * 05 28 2010 wh.su - * [BORA00000626][MT6620] Refine the remove key flow for WHQL testing - * fixed the ad-hoc wpa-none send non-encrypted frame issue. - * - * 05 24 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Refine authSendAuthFrame() for NULL STA_RECORD_T case and minimum deauth interval. - * - * 04 29 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * adjsut the pre-authentication code. - * - * 04 22 2010 wh.su - * [BORA00000626][MT6620] Refine the remove key flow for WHQL testing - * fixed the wpi same key id rx issue and fixed the remove wep key issue. - * - * 04 19 2010 kevin.huang - * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support - * Add Send Deauth for Class 3 Error and Leave Network Support - * - * 04 15 2010 wh.su - * [BORA00000680][MT6620] Support the statistic for Microsoft os query - * remove the assert code for allow ad-hoc pkt. - * - * 04 13 2010 wh.su - * [BORA00000680][MT6620] Support the statistic for Microsoft os query - * fixed the Klocwork error and refine the class error message. - * - * 03 04 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * Code refine, and remove non-used code. - * - * 03 03 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * move the AIS specific variable for security to AIS specific structure. - * - * 03 03 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * Fixed the pre-authentication timer not correctly init issue, and modify the security related callback function prototype. - * - * 03 01 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * Refine the variable and parameter for security. - * - * 02 26 2010 wh.su - * [BORA00000626][MT6620] Refine the remove key flow for WHQL testing - * change the waning message shown level, and clear the global transmit flag for CMD INFRASTRUCTURE. - * - * 02 25 2010 wh.su - * [BORA00000626][MT6620] Refine the remove key flow for WHQL testing - * For support the WHQL test, do the remove key code refine. - * - * 01 27 2010 wh.su - * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code - * add and fixed some security function. - * - * 12 25 2009 tehuang.liu - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Integrated modifications for 1st connection (mainly on FW modules MQM, TXM, and RXM) - * * * * * * * * * MQM: BA handling - * * * * * * * * * TXM: Macros updates - * * * * * * * * * RXM: Macros/Duplicate Removal updates - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * Dec 11 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * modify the cmd with result return - * - * Dec 11 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * fixed the value not initialize issue - * - * Dec 10 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * change the cmd return type - * - * Dec 8 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the function to update the auth mode and encryption status for cmd build connection - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding some code for wapi mode - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the call to check the 4th and eapol error report frame - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * rename the function name - * - * Dec 4 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the code for parsing the EAPoL frame, and do some code refine - * - * Dec 3 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the class error check - * - * Dec 3 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the cmd_802_11_pmkid code - * - * Dec 1 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * doing some function rename, and adding the code for cmd CMD_ADD_REMOVE_KEY - * - * Nov 23 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the clear pmkid function - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix eStaType check for AIS - * - * Nov 19 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the ap selection related code - * - * Nov 18 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -#if CFG_PRIVACY_MIGRATION - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to initialize the privacy-related -* parameters. -* -* \param[in] prAdapter Pointer to the Adapter structure -* \param[in] ucNetTypeIdx Pointer to netowrk type index -* -* \retval NONE -*/ -/*----------------------------------------------------------------------------*/ -VOID -secInit ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucNetTypeIdx - ) -{ - UINT_8 i; - P_CONNECTION_SETTINGS_T prConnSettings; - P_BSS_INFO_T prBssInfo; - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo; - - DEBUGFUNC("secInit"); - - ASSERT(prAdapter); - - prConnSettings = &prAdapter->rWifiVar.rConnSettings; - prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]; - prAisSpecBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - - prBssInfo->u4RsnSelectedGroupCipher = 0; - prBssInfo->u4RsnSelectedPairwiseCipher = 0; - prBssInfo->u4RsnSelectedAKMSuite = 0; - -#if CFG_ENABLE_WIFI_DIRECT - prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]; - - prBssInfo->u4RsnSelectedGroupCipher = RSN_CIPHER_SUITE_CCMP; - prBssInfo->u4RsnSelectedPairwiseCipher = RSN_CIPHER_SUITE_CCMP; - prBssInfo->u4RsnSelectedAKMSuite = RSN_AKM_SUITE_PSK; -#endif - -#if CFG_ENABLE_BT_OVER_WIFI - prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX]; - - prBssInfo->u4RsnSelectedGroupCipher = RSN_CIPHER_SUITE_CCMP; - prBssInfo->u4RsnSelectedPairwiseCipher = RSN_CIPHER_SUITE_CCMP; - prBssInfo->u4RsnSelectedAKMSuite = RSN_AKM_SUITE_PSK; -#endif - - prAdapter->rMib.dot11RSNAConfigPairwiseCiphersTable[0].dot11RSNAConfigPairwiseCipher = - WPA_CIPHER_SUITE_WEP40; - prAdapter->rMib.dot11RSNAConfigPairwiseCiphersTable[1].dot11RSNAConfigPairwiseCipher = - WPA_CIPHER_SUITE_TKIP; - prAdapter->rMib.dot11RSNAConfigPairwiseCiphersTable[2].dot11RSNAConfigPairwiseCipher = - WPA_CIPHER_SUITE_CCMP; - prAdapter->rMib.dot11RSNAConfigPairwiseCiphersTable[3].dot11RSNAConfigPairwiseCipher = - WPA_CIPHER_SUITE_WEP104; - - prAdapter->rMib.dot11RSNAConfigPairwiseCiphersTable[4].dot11RSNAConfigPairwiseCipher = - RSN_CIPHER_SUITE_WEP40; - prAdapter->rMib.dot11RSNAConfigPairwiseCiphersTable[5].dot11RSNAConfigPairwiseCipher = - RSN_CIPHER_SUITE_TKIP; - prAdapter->rMib.dot11RSNAConfigPairwiseCiphersTable[6].dot11RSNAConfigPairwiseCipher = - RSN_CIPHER_SUITE_CCMP; - prAdapter->rMib.dot11RSNAConfigPairwiseCiphersTable[7].dot11RSNAConfigPairwiseCipher = - RSN_CIPHER_SUITE_WEP104; - - for (i = 0; i < MAX_NUM_SUPPORTED_CIPHER_SUITES; i ++) { - prAdapter->rMib.dot11RSNAConfigPairwiseCiphersTable[i].dot11RSNAConfigPairwiseCipherEnabled = - FALSE; - } - - prAdapter->rMib.dot11RSNAConfigAuthenticationSuitesTable[0].dot11RSNAConfigAuthenticationSuite = - WPA_AKM_SUITE_NONE; - prAdapter->rMib.dot11RSNAConfigAuthenticationSuitesTable[1].dot11RSNAConfigAuthenticationSuite = - WPA_AKM_SUITE_802_1X; - prAdapter->rMib.dot11RSNAConfigAuthenticationSuitesTable[2].dot11RSNAConfigAuthenticationSuite = - WPA_AKM_SUITE_PSK; - prAdapter->rMib.dot11RSNAConfigAuthenticationSuitesTable[3].dot11RSNAConfigAuthenticationSuite = - RSN_AKM_SUITE_NONE; - prAdapter->rMib.dot11RSNAConfigAuthenticationSuitesTable[4].dot11RSNAConfigAuthenticationSuite = - RSN_AKM_SUITE_802_1X; - prAdapter->rMib.dot11RSNAConfigAuthenticationSuitesTable[5].dot11RSNAConfigAuthenticationSuite = - RSN_AKM_SUITE_PSK; - -#if CFG_SUPPORT_802_11W - prAdapter->rMib.dot11RSNAConfigAuthenticationSuitesTable[6].dot11RSNAConfigAuthenticationSuite = - RSN_AKM_SUITE_802_1X_SHA256; - prAdapter->rMib.dot11RSNAConfigAuthenticationSuitesTable[7].dot11RSNAConfigAuthenticationSuite = - RSN_AKM_SUITE_PSK_SHA256; -#endif - - for (i = 0; i < MAX_NUM_SUPPORTED_AKM_SUITES; i ++) { - prAdapter->rMib.dot11RSNAConfigAuthenticationSuitesTable[i].dot11RSNAConfigAuthenticationSuiteEnabled = - FALSE; - } - - secClearPmkid(prAdapter); - - cnmTimerInitTimer(prAdapter, - &prAisSpecBssInfo->rPreauthenticationTimer, - (PFN_MGMT_TIMEOUT_FUNC)rsnIndicatePmkidCand, - (UINT_32)NULL); - -#if CFG_SUPPORT_802_11W - cnmTimerInitTimer(prAdapter, - &prAisSpecBssInfo->rSaQueryTimer, - (PFN_MGMT_TIMEOUT_FUNC)rsnStartSaQueryTimer, - (UINT_32)NULL); -#endif - - prAisSpecBssInfo->fgCounterMeasure = FALSE; - prAisSpecBssInfo->ucWEPDefaultKeyID = 0; - - - #if 0 - for (i=0;iarWtbl[i].fgUsed = FALSE; - g_prWifiVar->arWtbl[i].prSta = NULL; - g_prWifiVar->arWtbl[i].ucNetTypeIdx = NETWORK_TYPE_INDEX_NUM; - - } - nicPrivacyInitialize((UINT_8)NETWORK_TYPE_INDEX_NUM); - #endif -} /* secInit */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will indicate an Event of "Rx Class Error" to SEC_FSM for -* JOIN Module. -* -* \param[in] prAdapter Pointer to the Adapter structure -* \param[in] prSwRfb Pointer to the SW RFB. -* -* \return FALSE Class Error -*/ -/*----------------------------------------------------------------------------*/ -BOOL -secCheckClassError ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN P_STA_RECORD_T prStaRec - ) -{ - ASSERT(prAdapter); - ASSERT(prSwRfb); - //ASSERT(prStaRec); - - //prStaRec = &(g_arStaRec[prSwRfb->ucStaRecIdx]); - - if ((prStaRec) && 1 /* RXM_IS_DATA_FRAME(prSwRfb) */) { - ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex = prStaRec->ucNetTypeIndex; - - if (IS_NET_ACTIVE(prAdapter, eNetTypeIndex)) { - P_BSS_INFO_T prBssInfo; - prBssInfo = &prAdapter->rWifiVar.arBssInfo[eNetTypeIndex]; - - if ((STA_STATE_3 != prStaRec->ucStaState) && - IS_BSS_ACTIVE(prBssInfo) && - prBssInfo->fgIsNetAbsent == FALSE) { - /*(IS_AP_STA(prStaRec) || IS_CLIENT_STA(prStaRec))) {*/ - - if (WLAN_STATUS_SUCCESS == authSendDeauthFrame(prAdapter, - prStaRec, - NULL, - REASON_CODE_CLASS_3_ERR, - (PFN_TX_DONE_HANDLER)NULL)) { - - DBGLOG(RSN, INFO, ("Send Deauth to MAC:["MACSTR"] for Rx Class 3 Error.\n", - MAC2STR(prStaRec->aucMacAddr))); - } - - return FALSE; - } - - return secRxPortControlCheck(prAdapter, prSwRfb); - } - } - - return FALSE; -} /* end of secCheckClassError() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to setting the sta port status. -* -* \param[in] prAdapter Pointer to the Adapter structure -* \param[in] prSta Pointer to the sta -* \param[in] fgPortBlock The port status -* -* \retval none -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -secSetPortBlocked ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta, - IN BOOLEAN fgPortBlock - ) -{ - if (prSta == NULL) - return ; - - prSta->fgPortBlock = fgPortBlock; - - DBGLOG(RSN, TRACE, ("The STA "MACSTR" port %s\n", MAC2STR(prSta->aucMacAddr), fgPortBlock == TRUE ? "BLOCK" :" OPEN")); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to report the sta port status. -* -* \param[in] prAdapter Pointer to the Adapter structure -* \param[in] prSta Pointer to the sta -* \param[out] fgPortBlock The port status -* -* \return TRUE sta exist, FALSE sta not exist -* -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -secGetPortStatus ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta, - OUT PBOOLEAN pfgPortStatus - ) -{ - if (prSta == NULL) - return FALSE; - - *pfgPortStatus = prSta->fgPortBlock; - - return TRUE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to handle Peer device Tx Security process MSDU. -* -* \param[in] prMsduInfo pointer to the packet info pointer -* -* \retval TRUE Accept the packet -* \retval FALSE Refuse the MSDU packet due port blocked -* -*/ -/*----------------------------------------------------------------------------*/ -BOOL /* ENUM_PORT_CONTROL_RESULT */ -secTxPortControlCheck( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN P_STA_RECORD_T prStaRec - ) -{ - ASSERT(prAdapter); - ASSERT(prMsduInfo); - ASSERT(prStaRec); - - if (prStaRec) { - - /* Todo:: */ - if (prMsduInfo->fgIs802_1x) - return TRUE; - - if (prStaRec->fgPortBlock == TRUE) { - DBGLOG(INIT, TRACE, ("Drop Tx packet due Port Control!\n")); - return FALSE; - } - -#if CFG_SUPPORT_WAPI - if (prAdapter->rWifiVar.rConnSettings.fgWapiMode) { - return TRUE; - } -#endif - if (IS_STA_IN_AIS(prStaRec)) { - if (!prAdapter->rWifiVar.rAisSpecificBssInfo.fgTransmitKeyExist && - (prAdapter->rWifiVar.rConnSettings.eEncStatus == ENUM_ENCRYPTION1_ENABLED)){ - DBGLOG(INIT, TRACE, ("Drop Tx packet due the key is removed!!!\n")); - return FALSE; - } - } - } - - return TRUE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to handle The Rx Security process MSDU. -* -* \param[in] prAdapter Pointer to the Adapter structure -* \param[in] prSWRfb SW rfb pinter -* -* \retval TRUE Accept the packet -* \retval FALSE Refuse the MSDU packet due port control -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -secRxPortControlCheck ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSWRfb - ) -{ - ASSERT(prSWRfb); - -#if 0 - /* whsu:Todo: Process MGMT and DATA */ - if (prSWRfb->prStaRec) { - if (prSWRfb->prStaRec->fgPortBlock == TRUE) { - if (1 /* prSWRfb->fgIsDataFrame and not 1x*/ && - (g_prWifiVar->rConnSettings.eAuthMode >= AUTH_MODE_WPA)){ - //DBGLOG(SEC, WARN, ("Drop Rx data due port control !\r\n")); - return TRUE; /* Todo: whsu FALSE; */ - } - //if (!RX_STATUS_IS_PROTECT(prSWRfb->prRxStatus)) { - // DBGLOG(RSN, WARN, ("Drop rcv non-encrypted data frame!\n")); - // return FALSE; - //} - } - } - else { - } -#endif - return TRUE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine will enable/disable the cipher suite -* -* \param[in] prAdapter Pointer to the adapter object data area. -* \param[in] u4CipherSuitesFlags flag for cipher suite -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -secSetCipherSuite ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4CipherSuitesFlags - ) -{ - UINT_32 i; - P_DOT11_RSNA_CONFIG_PAIRWISE_CIPHERS_ENTRY prEntry; - P_IEEE_802_11_MIB_T prMib; - - ASSERT(prAdapter); - - prMib = &prAdapter->rMib; - - ASSERT(prMib); - - if (u4CipherSuitesFlags == CIPHER_FLAG_NONE) { - /* Disable all the pairwise cipher suites. */ - for (i = 0; i < MAX_NUM_SUPPORTED_CIPHER_SUITES; i++) { - prMib->dot11RSNAConfigPairwiseCiphersTable[i].dot11RSNAConfigPairwiseCipherEnabled = - FALSE; - } - - /* Update the group cipher suite. */ - prMib->dot11RSNAConfigGroupCipher = WPA_CIPHER_SUITE_NONE; - - return; - } - - for (i = 0; i < MAX_NUM_SUPPORTED_CIPHER_SUITES; i++) { - prEntry = &prMib->dot11RSNAConfigPairwiseCiphersTable[i]; - - switch (prEntry->dot11RSNAConfigPairwiseCipher) { - case WPA_CIPHER_SUITE_WEP40: - case RSN_CIPHER_SUITE_WEP40: - if (u4CipherSuitesFlags & CIPHER_FLAG_WEP40) { - prEntry->dot11RSNAConfigPairwiseCipherEnabled = TRUE; - } - else { - prEntry->dot11RSNAConfigPairwiseCipherEnabled = FALSE; - } - break; - - case WPA_CIPHER_SUITE_TKIP: - case RSN_CIPHER_SUITE_TKIP: - if (u4CipherSuitesFlags & CIPHER_FLAG_TKIP) { - prEntry->dot11RSNAConfigPairwiseCipherEnabled = TRUE; - } - else { - prEntry->dot11RSNAConfigPairwiseCipherEnabled = FALSE; - } - break; - - case WPA_CIPHER_SUITE_CCMP: - case RSN_CIPHER_SUITE_CCMP: - if (u4CipherSuitesFlags & CIPHER_FLAG_CCMP) { - prEntry->dot11RSNAConfigPairwiseCipherEnabled = TRUE; - } - else { - prEntry->dot11RSNAConfigPairwiseCipherEnabled = FALSE; - } - break; - - case WPA_CIPHER_SUITE_WEP104: - case RSN_CIPHER_SUITE_WEP104: - if (u4CipherSuitesFlags & CIPHER_FLAG_WEP104) { - prEntry->dot11RSNAConfigPairwiseCipherEnabled = TRUE; - } - else { - prEntry->dot11RSNAConfigPairwiseCipherEnabled = FALSE; - } - break; - default: - break; - } - } - - /* Update the group cipher suite. */ - if (rsnSearchSupportedCipher(prAdapter, WPA_CIPHER_SUITE_CCMP, &i)) { - prMib->dot11RSNAConfigGroupCipher = WPA_CIPHER_SUITE_CCMP; - } - else if (rsnSearchSupportedCipher(prAdapter, WPA_CIPHER_SUITE_TKIP, &i)) { - prMib->dot11RSNAConfigGroupCipher = WPA_CIPHER_SUITE_TKIP; - } - else if (rsnSearchSupportedCipher(prAdapter, WPA_CIPHER_SUITE_WEP104, &i)) { - prMib->dot11RSNAConfigGroupCipher = WPA_CIPHER_SUITE_WEP104; - } - else if (rsnSearchSupportedCipher(prAdapter, WPA_CIPHER_SUITE_WEP40, &i)) { - prMib->dot11RSNAConfigGroupCipher = WPA_CIPHER_SUITE_WEP40; - } - else { - prMib->dot11RSNAConfigGroupCipher = WPA_CIPHER_SUITE_NONE; - } - -} /* secSetCipherSuite */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to handle The 2nd Tx EAPoL Frame. -* -* \param[in] prAdapter Pointer to the Adapter structure -* \param[in] prMsduInfo pointer to the packet info pointer -* \param[in] pucPayload pointer to the 1x hdr -* \param[in] u2PayloadLen the 1x payload length -* -* \retval TRUE Accept the packet -* \retval FALSE Refuse the MSDU packet due port control -* -*/ -/*----------------------------------------------------------------------------*/ -BOOL -secProcessEAPOL ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN P_STA_RECORD_T prStaRec, - IN PUINT_8 pucPayload, - IN UINT_16 u2PayloadLen -) -{ - P_EAPOL_KEY prEapol = (P_EAPOL_KEY)NULL; - P_IEEE_802_1X_HDR pr1xHdr; - UINT_16 u2KeyInfo; - - ASSERT(prMsduInfo); - ASSERT(prStaRec); - - //prStaRec = &(g_arStaRec[prMsduInfo->ucStaRecIndex]); - ASSERT(prStaRec); - - if (prStaRec && IS_AP_STA(prStaRec)) { - pr1xHdr = (P_IEEE_802_1X_HDR)pucPayload; - if ((pr1xHdr->ucType == 3) /* EAPoL key */ && ((u2PayloadLen - 4) > sizeof(EAPOL_KEY))) { - prEapol = (P_EAPOL_KEY)((PUINT_32)(pucPayload + 4)); - WLAN_GET_FIELD_BE16(prEapol->aucKeyInfo, &u2KeyInfo); - if ((prEapol->ucType == 254) && (u2KeyInfo & MASK_2ND_EAPOL)) { - if (u2KeyInfo & WPA_KEY_INFO_SECURE) { - /* 4th EAPoL check at secHandleTxDoneCallback() */ - //DBGLOG(RSN, TRACE, ("Tx 4th EAPoL frame\r\n")); - } - else if (u2PayloadLen == 123 /* Not include LLC */) { - DBGLOG(RSN, INFO, ("Tx 2nd EAPoL frame\r\n")); - secFsmEvent2ndEapolTx(prAdapter, prStaRec); - } - } - } - } - - return TRUE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will handle the 4th EAPoL Tx done and mic Error Report frame. -* -* \param[in] prAdapter Pointer to the Adapter structure -* \param[in] pMsduInfo Pointer to the Msdu Info -* \param[in] rStatus The Tx done status -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -VOID -secHandleTxDoneCallback( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN P_STA_RECORD_T prStaRec, - IN WLAN_STATUS rStatus - ) -{ - PUINT_8 pucPayload; - P_IEEE_802_1X_HDR pr1xHdr = (P_IEEE_802_1X_HDR)NULL; - P_EAPOL_KEY prEapol = (P_EAPOL_KEY)NULL; - UINT_16 u2KeyInfo; - UINT_16 u2PayloadLen; - - DEBUGFUNC("secHandleTxDoneCallback"); - - ASSERT(prMsduInfo); - //Todo:: Notice if using the TX free immediate after send to firmware, the payload may not correcttly!!!! - - ASSERT(prStaRec); - - //Todo:: This call back may not need because the order of set key and send 4th 1x can be make sure - //Todo:: Notice the LLC offset - #if 1 - pucPayload = (PUINT_8)prMsduInfo->prPacket; - ASSERT(pucPayload); - - u2PayloadLen = prMsduInfo->u2FrameLength; - - if (0 /* prMsduInfo->fgIs1xFrame */) { - - if (prStaRec && IS_AP_STA(prStaRec)) { - pr1xHdr = (P_IEEE_802_1X_HDR)(PUINT_32)(pucPayload + 8); - if ((pr1xHdr->ucType == 3) /* EAPoL key */ && ((u2PayloadLen - 4) > sizeof(EAPOL_KEY))) { - prEapol = (P_EAPOL_KEY)(PUINT_32)(pucPayload + 12); - WLAN_GET_FIELD_BE16(prEapol->aucKeyInfo, &u2KeyInfo); - if ((prEapol->ucType == 254) && (u2KeyInfo & MASK_2ND_EAPOL)) { - if (prStaRec->rSecInfo.fg2nd1xSend == TRUE && u2PayloadLen == 107 /* include LLC *//* u2KeyInfo & WPA_KEY_INFO_SECURE */) { - DBGLOG(RSN, INFO, ("Tx 4th EAPoL frame\r\n")); - secFsmEvent4ndEapolTxDone(prAdapter, prStaRec); - } - else if (prAdapter->rWifiVar.rAisSpecificBssInfo.fgCheckEAPoLTxDone){ - DBGLOG(RSN, INFO, ("Tx EAPoL Error report frame\r\n")); - //secFsmEventEapolTxDone(prAdapter, (UINT_32)prMsduInfo->prStaRec); - } - } - } - } - - } - #endif -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to initialize the pmkid parameters. -* -* \param[in] prAdapter Pointer to the Adapter structure -* -* \retval NONE -*/ -/*----------------------------------------------------------------------------*/ -VOID -secClearPmkid ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo; - - DEBUGFUNC("secClearPmkid"); - - prAisSpecBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - DBGLOG(RSN, TRACE, ("secClearPmkid\n")); - prAisSpecBssInfo->u4PmkidCandicateCount = 0; - prAisSpecBssInfo->u4PmkidCacheCount = 0; - kalMemZero((PVOID)prAisSpecBssInfo->arPmkidCandicate, sizeof(PMKID_CANDICATE_T) * CFG_MAX_PMKID_CACHE); - kalMemZero((PVOID)prAisSpecBssInfo->arPmkidCache, sizeof(PMKID_ENTRY_T) * CFG_MAX_PMKID_CACHE); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Whether WPA, or WPA2 but not WPA-None is enabled. -* -* \param[in] prAdapter Pointer to the Adapter structure -* -* \retval BOOLEAN -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -secRsnKeyHandshakeEnabled ( - IN P_ADAPTER_T prAdapter - ) -{ - P_CONNECTION_SETTINGS_T prConnSettings; - - ASSERT(prAdapter); - - prConnSettings = &prAdapter->rWifiVar.rConnSettings; - - ASSERT(prConnSettings); - - ASSERT(prConnSettings->eEncStatus < ENUM_ENCRYPTION3_KEY_ABSENT); - - if (prConnSettings->eEncStatus == ENUM_ENCRYPTION_DISABLED) { - return FALSE; - } - - ASSERT(prConnSettings->eAuthMode < AUTH_MODE_NUM); - if ((prConnSettings->eAuthMode >= AUTH_MODE_WPA) && - (prConnSettings->eAuthMode != AUTH_MODE_WPA_NONE)) { - return TRUE; - } - - return FALSE; -} /* secRsnKeyHandshakeEnabled */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Return whether the transmit key alread installed. -* -* \param[in] prAdapter Pointer to the Adapter structure -* \param[in] prSta Pointer the sta record -* -* \retval TRUE Default key or Transmit key installed -* FALSE Default key or Transmit key not installed -* -* \note: -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -secTransmitKeyExist ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - ASSERT(prSta); - - if (prSta->fgTransmitKeyExist){ - return TRUE; - } - else { - return FALSE; - } -} /* secTransmitKeyExist */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Whether 802.11 privacy is enabled. -* -* \param[in] prAdapter Pointer to the Adapter structure -* -* \retval BOOLEAN -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -secEnabledInAis ( - IN P_ADAPTER_T prAdapter - ) -{ - DEBUGFUNC("secEnabled"); - - ASSERT(prAdapter->rWifiVar.rConnSettings.eEncStatus < ENUM_ENCRYPTION3_KEY_ABSENT); - - switch (prAdapter->rWifiVar.rConnSettings.eEncStatus) { - case ENUM_ENCRYPTION_DISABLED: - return FALSE; - case ENUM_ENCRYPTION1_ENABLED: - case ENUM_ENCRYPTION2_ENABLED: - case ENUM_ENCRYPTION3_ENABLED: - return TRUE; - default: - DBGLOG(RSN, TRACE, ("Unknown encryption setting %d\n", - prAdapter->rWifiVar.rConnSettings.eEncStatus)); - break; - } - return FALSE; -} /* secEnabled */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set the privacy bit at mac header for TxM -* -* \param[in] prAdapter Pointer to the Adapter structure -* \param[in] prMsdu the msdu for known the sta record -* -* \return TRUE the privacy need to set -* FALSE the privacy no need to set -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -secIsProtectedFrame ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsdu, - IN P_STA_RECORD_T prStaRec - ) -{ - ASSERT(prAdapter); - - ASSERT(prMsdu); - - ASSERT(prStaRec); - //prStaRec = &(g_arStaRec[prMsdu->ucStaRecIndex]); - - if (prStaRec == NULL) { - if (prAdapter->rWifiVar.rAisSpecificBssInfo.fgTransmitKeyExist) - return TRUE; - return FALSE; /* No privacy bit */ - } - - /* Todo:: */ - if (0 /* prMsdu->fgIs1xFrame */){ - if (IS_STA_IN_AIS(prStaRec) && - prAdapter->rWifiVar.rConnSettings.eAuthMode < AUTH_MODE_WPA) { - DBGLOG(RSN, LOUD, ("For AIS Legacy 1x, always not encryped\n")); - return FALSE; - } - else if (!prStaRec->fgTransmitKeyExist) { - DBGLOG(RSN, LOUD, ("1x Not Protected.\n")); - return FALSE; - } - else if (prStaRec->rSecInfo.fgKeyStored) { - DBGLOG(RSN, LOUD, ("1x not Protected due key stored!\n")); - return FALSE; - } - else { - DBGLOG(RSN, LOUD, ("1x Protected.\n")); - return TRUE; - } - } - else { - if (!prStaRec->fgTransmitKeyExist) { - /* whsu , check for AIS only */ - if (prAdapter->rWifiVar.rConnSettings.eAuthMode < AUTH_MODE_WPA && - prAdapter->rWifiVar.rAisSpecificBssInfo.fgTransmitKeyExist){ - DBGLOG(RSN, LOUD, ("Protected\n")); - return TRUE; - } - } - else { - DBGLOG(RSN, LOUD, ("Protected.\n")); - return TRUE; - } - } - - /* No sec or key is removed!!! */ - return FALSE; -} -#endif diff --git a/drivers/net/wireless/mt5931/mgmt/rate.c b/drivers/net/wireless/mt5931/mgmt/rate.c deleted file mode 100755 index c63fe7b7d641..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/rate.c +++ /dev/null @@ -1,547 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/rate.c#1 $ -*/ - -/*! \file "rate.c" - \brief This file contains the transmission rate handling routines. - - This file contains the transmission rate handling routines for setting up - ACK/CTS Rate, Highest Tx Rate, Lowest Tx Rate, Initial Tx Rate and do - conversion between Rate Set and Data Rates. -*/ - - - -/* -** $Log: rate.c $ - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add rate.c. - * - * 03 16 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add AdHoc Mode - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Update comments - * - * Nov 16 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix DBGLOG - * - * Nov 5 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -** \main\maintrunk.MT5921\12 2008-12-19 17:19:32 GMT mtk01461 -** Fix the problem that do not ASSERT the length of Supported Rate IE == 8 -** \main\maintrunk.MT5921\11 2008-12-01 18:17:42 GMT mtk01088 -** fixed the lint "possible using null pointer" warning -** \main\maintrunk.MT5921\10 2008-08-20 00:16:36 GMT mtk01461 -** Update for Driver Review -** \main\maintrunk.MT5921\9 2008-04-13 21:17:13 GMT mtk01461 -** Revise GEN Link Speed OID -** \main\maintrunk.MT5921\8 2008-03-28 10:40:13 GMT mtk01461 -** Add rateGetRateSetFromDataRates() for set desired rate OID -** \main\maintrunk.MT5921\7 2008-03-26 09:16:20 GMT mtk01461 -** Add adopt operational rate as ACK rate if BasicRateSet was not found -** Add comments -** \main\maintrunk.MT5921\6 2008-02-21 15:01:39 GMT mtk01461 -** Add initial rate according rx signal quality support -** \main\maintrunk.MT5921\5 2008-01-07 15:06:44 GMT mtk01461 -** Fix typo of rate adaptation of CtrlResp Frame -** \main\maintrunk.MT5921\4 2007-10-25 18:05:12 GMT mtk01461 -** Add VOIP SCAN Support & Refine Roaming -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -/* The list of valid data rates. */ -const UINT_8 aucDataRate[] = { - RATE_1M, /* RATE_1M_INDEX = 0 */ - RATE_2M, /* RATE_2M_INDEX */ - RATE_5_5M, /* RATE_5_5M_INDEX */ - RATE_11M, /* RATE_11M_INDEX */ - RATE_22M, /* RATE_22M_INDEX */ - RATE_33M, /* RATE_33M_INDEX */ - RATE_6M, /* RATE_6M_INDEX */ - RATE_9M, /* RATE_9M_INDEX */ - RATE_12M, /* RATE_12M_INDEX */ - RATE_18M, /* RATE_18M_INDEX */ - RATE_24M, /* RATE_24M_INDEX */ - RATE_36M, /* RATE_36M_INDEX */ - RATE_48M, /* RATE_48M_INDEX */ - RATE_54M, /* RATE_54M_INDEX */ - RATE_HT_PHY /* RATE_HT_PHY_INDEX */ -}; - -static const UINT_8 aucDefaultAckCtsRateIndex[RATE_NUM] = { - RATE_1M_INDEX, /* RATE_1M_INDEX = 0 */ - RATE_2M_INDEX, /* RATE_2M_INDEX */ - RATE_5_5M_INDEX, /* RATE_5_5M_INDEX */ - RATE_11M_INDEX, /* RATE_11M_INDEX */ - RATE_1M_INDEX, /* RATE_22M_INDEX - Not supported */ - RATE_1M_INDEX, /* RATE_33M_INDEX - Not supported */ - RATE_6M_INDEX, /* RATE_6M_INDEX */ - RATE_6M_INDEX, /* RATE_9M_INDEX */ - RATE_12M_INDEX, /* RATE_12M_INDEX */ - RATE_12M_INDEX, /* RATE_18M_INDEX */ - RATE_24M_INDEX, /* RATE_24M_INDEX */ - RATE_24M_INDEX, /* RATE_36M_INDEX */ - RATE_24M_INDEX, /* RATE_48M_INDEX */ - RATE_24M_INDEX /* RATE_54M_INDEX */ -}; - -const BOOLEAN afgIsOFDMRate[RATE_NUM] = { - FALSE, /* RATE_1M_INDEX = 0 */ - FALSE, /* RATE_2M_INDEX */ - FALSE, /* RATE_5_5M_INDEX */ - FALSE, /* RATE_11M_INDEX */ - FALSE, /* RATE_22M_INDEX - Not supported */ - FALSE, /* RATE_33M_INDEX - Not supported */ - TRUE, /* RATE_6M_INDEX */ - TRUE, /* RATE_9M_INDEX */ - TRUE, /* RATE_12M_INDEX */ - TRUE, /* RATE_18M_INDEX */ - TRUE, /* RATE_24M_INDEX */ - TRUE, /* RATE_36M_INDEX */ - TRUE, /* RATE_48M_INDEX */ - TRUE /* RATE_54M_INDEX */ -}; - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/*! -* @brief Convert the given Supported Rate & Extended Supported Rate IE to the -* Operational Rate Set and Basic Rate Set, and also check if any Basic -* Rate Code is unknown by driver. -* -* @param[in] prIeSupportedRate Pointer to the Supported Rate IE -* @param[in] prIeExtSupportedRate Pointer to the Ext Supported Rate IE -* @param[out] pu2OperationalRateSet Pointer to the Operational Rate Set -* @param[out] pu2BSSBasicRateSet Pointer to the Basic Rate Set -* @param[out] pfgIsUnknownBSSBasicRate Pointer to a Flag to indicate that Basic -* Rate Set has unknown Rate Code -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -rateGetRateSetFromIEs ( - IN P_IE_SUPPORTED_RATE_T prIeSupportedRate, - IN P_IE_EXT_SUPPORTED_RATE_T prIeExtSupportedRate, - OUT PUINT_16 pu2OperationalRateSet, - OUT PUINT_16 pu2BSSBasicRateSet, - OUT PBOOLEAN pfgIsUnknownBSSBasicRate - ) -{ - UINT_16 u2OperationalRateSet = 0; - UINT_16 u2BSSBasicRateSet = 0; - BOOLEAN fgIsUnknownBSSBasicRate = FALSE; - UINT_8 ucRate; - UINT_32 i, j; - - - ASSERT(pu2OperationalRateSet); - ASSERT(pu2BSSBasicRateSet); - ASSERT(pfgIsUnknownBSSBasicRate); - - if (prIeSupportedRate) { - /* NOTE(Kevin): Buffalo WHR-G54S's supported rate set IE exceed 8. - * IE_LEN(pucIE) == 12, "1(B), 2(B), 5.5(B), 6(B), 9(B), 11(B), - * 12(B), 18(B), 24(B), 36(B), 48(B), 54(B)" - */ - //ASSERT(prIeSupportedRate->ucLength <= ELEM_MAX_LEN_SUP_RATES); - ASSERT(prIeSupportedRate->ucLength <= RATE_NUM); - - for (i = 0; i < prIeSupportedRate->ucLength; i++) { - ucRate = prIeSupportedRate->aucSupportedRates[i] & RATE_MASK; - - /* Search all valid data rates */ - for (j = 0; j < sizeof(aucDataRate)/sizeof(UINT_8); j++) { - if (ucRate == aucDataRate[j]) { - u2OperationalRateSet |= BIT(j); - - if (prIeSupportedRate->aucSupportedRates[i] & RATE_BASIC_BIT) { - u2BSSBasicRateSet |= BIT(j); - } - - break; - } - } - - if ((j == sizeof(aucDataRate)/sizeof(UINT_8)) && - (prIeSupportedRate->aucSupportedRates[i] & RATE_BASIC_BIT)) { - fgIsUnknownBSSBasicRate = TRUE; /* A data rate not list in the aucDataRate[] */ - } - } - } - - - if (prIeExtSupportedRate) { - //ASSERT(prIeExtSupportedRate->ucLength <= ELEM_MAX_LEN_EXTENDED_SUP_RATES); - - for (i = 0; i < prIeExtSupportedRate->ucLength; i++) { - ucRate = prIeExtSupportedRate->aucExtSupportedRates[i] & RATE_MASK; - - /* Search all valid data rates */ - for (j = 0; j < sizeof(aucDataRate)/sizeof(UINT_8); j++) { - if (ucRate == aucDataRate[j]) { - u2OperationalRateSet |= BIT(j); - - if (prIeExtSupportedRate->aucExtSupportedRates[i] & RATE_BASIC_BIT) { - u2BSSBasicRateSet |= BIT(j); - } - - break; - } - } - - if ((j == sizeof(aucDataRate)/sizeof(UINT_8)) && - (prIeExtSupportedRate->aucExtSupportedRates[i] & RATE_BASIC_BIT)) { - fgIsUnknownBSSBasicRate = TRUE; /* A data rate not list in the aucDataRate[] */ - } - } - } - - *pu2OperationalRateSet = u2OperationalRateSet; - *pu2BSSBasicRateSet = u2BSSBasicRateSet; - *pfgIsUnknownBSSBasicRate = fgIsUnknownBSSBasicRate; - - return; - -} /* end of rateGetRateSetFromIEs() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Convert the given Operational Rate Set & Basic Rate Set to the Rate Code -* Format for used in (Ext)Supportec Rate IE. -* -* @param[in] u2OperationalRateSet Operational Rate Set -* @param[in] u2BSSBasicRateSet Basic Rate Set -* @param[out] pucDataRates Pointer to the Data Rate Buffer -* @param[out] pucDataRatesLen Pointer to the Data Rate Buffer Length -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -rateGetDataRatesFromRateSet ( - IN UINT_16 u2OperationalRateSet, - IN UINT_16 u2BSSBasicRateSet, - OUT PUINT_8 pucDataRates, - OUT PUINT_8 pucDataRatesLen - ) -{ - UINT_32 i, j; - - - ASSERT(pucDataRates); - ASSERT(pucDataRatesLen); - - ASSERT(u2BSSBasicRateSet == (u2OperationalRateSet & u2BSSBasicRateSet)); - - for (i = RATE_1M_INDEX, j = 0; i < RATE_NUM; i++) { - if (u2OperationalRateSet & BIT(i)) { - - *(pucDataRates + j) = aucDataRate[i]; - - if (u2BSSBasicRateSet & BIT(i)) { - *(pucDataRates + j) |= RATE_BASIC_BIT; - } - - j++; - } - } - - *pucDataRatesLen = (UINT_8)j; - - return; - -} /* end of rateGetDataRatesFromRateSet() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Get the highest rate from given Rate Set. -* -* \param[in] u2RateSet Rate Set -* \param[out] pucHighestRateIndex Pointer to buffer of the Highest Rate Index -* -* \retval TRUE Highest Rate Index was found -* \retval FALSE Highest Rate Index was not found -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rateGetHighestRateIndexFromRateSet ( - IN UINT_16 u2RateSet, - OUT PUINT_8 pucHighestRateIndex - ) -{ - INT_32 i; - - - ASSERT(pucHighestRateIndex); - - for (i = RATE_54M_INDEX; i >= RATE_1M_INDEX; i--) { - if (u2RateSet & BIT(i)) { - *pucHighestRateIndex = (UINT_8)i; - return TRUE; - } - } - - return FALSE; - -} /* end of rateGetHighestRateIndexFromRateSet() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Get the lowest rate from given Rate Set. -* -* \param[in] u2RateSet Rate Set -* \param[out] pucLowestRateIndex Pointer to buffer of the Lowest Rate Index -* -* \retval TRUE Lowest Rate Index was found -* \retval FALSE Lowest Rate Index was not found -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rateGetLowestRateIndexFromRateSet ( - IN UINT_16 u2RateSet, - OUT PUINT_8 pucLowestRateIndex - ) -{ - UINT_32 i; - - ASSERT(pucLowestRateIndex); - - for (i = RATE_1M_INDEX; i <= RATE_54M_INDEX; i++) { - if (u2RateSet & BIT(i)) { - *pucLowestRateIndex = (UINT_8)i; - return TRUE; - } - } - - return FALSE; - -} /* end of rateGetLowestRateIndexFromRateSet() */ - - -#if 0 // NOTE(Kevin): For reference -/*----------------------------------------------------------------------------*/ -/*! -* \brief Convert the given Data Rates to the Rate Set. -* -* \param[in] pucDataRates Pointer to the Data Rates -* \param[in] ucDataRatesLen Length of given Data Rates -* \param[out] pu2RateSet Pointer to the Rate Set -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -rateGetRateSetFromDataRates ( - IN PUINT_8 pucDataRates, - IN UINT_8 ucDataRatesLen, - OUT PUINT_16 pu2RateSet - ) -{ - UINT_16 u2RateSet = 0; - UINT_8 ucRate; - UINT_32 i, j; - - - ASSERT(pucDataRates); - ASSERT(pu2RateSet); - - if (pucDataRates) { - for (i = 0; i < ucDataRatesLen; i++) { - ucRate = pucDataRates[i] & RATE_MASK; - - /* Search all valid data rates */ - for (j = 0; j < sizeof(aucDataRate)/sizeof(UINT_8); j++) { - if (ucRate == aucDataRate[j]) { - u2RateSet |= BIT(j); - break; - } - } - } - } - - *pu2RateSet = u2RateSet; - - return; - -} /* end of rateGetRateSetFromDataRates() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Parse the Operational Rate Set and Basic Rate Set to get the corresponding -* ACK/CTS(Respnose) TX Rates. -* -* \param[in] u2OperationalRateSet Operational Rate Set -* \param[in] u2BSSBasicRateSet Basic Rate Set -* \param[out] aucAckCtsRateIndex Pointer to the Ack/Cts Data Rate Buffer -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -rateSetAckCtsDataRatesFromRateSet ( - IN UINT_16 u2OperationalRateSet, - IN UINT_16 u2BSSBasicRateSet, - IN OUT UINT_8 aucAckCtsRateIndex[] - ) -{ - INT_32 i,j; - - - ASSERT(aucAckCtsRateIndex); - ASSERT(u2BSSBasicRateSet == (u2OperationalRateSet & u2BSSBasicRateSet)); - - /* Setup default ACK/CTS response rate */ - kalMemCopy(aucAckCtsRateIndex, (PVOID)aucDefaultAckCtsRateIndex, sizeof(aucDefaultAckCtsRateIndex)); - - - for (i = RATE_54M_INDEX; i >= RATE_1M_INDEX; i--) { - if (u2OperationalRateSet & BIT(i)) { - for (j = i; j >= RATE_1M_INDEX; j--) { - if (u2BSSBasicRateSet & BIT(j)) { - if ((afgIsOFDMRate[i] && afgIsOFDMRate[j]) || (!afgIsOFDMRate[i] && !afgIsOFDMRate[j])) // Reply ACK Frame at the same Modulation Scheme. - aucAckCtsRateIndex[i] = (UINT_8)j; - break; - } - } - - /* NOTE(Kevin 2008/03/25): Following code is used for those AP which has - * NULL BasicRateSet. - * e.g. If input Operational Rate Set = [18M 12M 9M], Basic Rate Set = NULL. - * Originally we'll get Ack Rate for [18M 12M 9M] is [12M 12M "6M"]. - * Now we'll get Ack Rate for [18M 12M 9M] is [12M 12M 9M], - * The Ack Rate for Tx Rates which are not list in Operational Rate Set is still - * use highest mandatory rate as default. - */ - if (j < RATE_1M_INDEX) { /* The ACK/CTS rate was not found in BasicRateSet */ - if (!(BIT(aucAckCtsRateIndex[i]) & u2OperationalRateSet)) { - aucAckCtsRateIndex[i] = (UINT_8)i; - } - } - } - } - - return; - -} /* end of rateSetAckCtsDataRatesFromRateSet() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Get the proper initial rate from Rate Set according to given RCPI value -* -* \param[in] u2RateSet Rate Set -* \param[in] rRcpi RCPI value from AP or Peer STA -* \param[out] pucInitialRateIndex Pointer to buffer of the initial Rate Index -* -* \retval TRUE Initial Rate Index was found -* \retval FALSE Initial Rate Index was not found -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rateGetBestInitialRateIndex ( - IN UINT_16 u2RateSet, - IN RCPI rRcpi, - OUT PUINT_8 pucInitialRateIndex - ) -{ - UINT_16 u2InitRateSet; - INT_32 i; - - - ASSERT(pucInitialRateIndex); - - DBGLOG(MGT, TRACE, ("rRcpi = %d\n", rRcpi)); - - if (rRcpi >= RCPI_100) { /* Best Signal */ - u2InitRateSet = INITIAL_RATE_SET(RCPI_100); - } - else if (rRcpi >= RCPI_80) { /* Better Signal */ - u2InitRateSet = INITIAL_RATE_SET(RCPI_80); - } - else if (rRcpi >= RCPI_60) { /* Good Signal */ - u2InitRateSet = INITIAL_RATE_SET(RCPI_60); - } - else { /* Worse Signal */ - /* NOTE(Kevin): If return FALSE, we should assign the BSS Basic Rate Index - * (prBssInfo->ucBasicRateIndex) to the initial rate. It was determined in - * function - bssUpdateTxRateForControlFrame(). - */ - return FALSE; - } - - u2RateSet &= u2InitRateSet; - - for (i = RATE_54M_INDEX; i >= RATE_1M_INDEX; i--) { - if (u2RateSet & BIT(i)) { - *pucInitialRateIndex = (UINT_8)i; - return TRUE; - } - } - - return FALSE; - -} /* end of rateGetBestInitialRateIndex() */ -#endif - diff --git a/drivers/net/wireless/mt5931/mgmt/rlm.c b/drivers/net/wireless/mt5931/mgmt/rlm.c deleted file mode 100755 index 1954f88e48dd..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/rlm.c +++ /dev/null @@ -1,1723 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/rlm.c#2 $ -*/ - -/*! \file "rlm.c" - \brief - -*/ - - - -/* -** $Log: rlm.c $ - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 11 15 2011 cm.chang - * NULL - * Check length HT cap IE about RX associate request frame - * - * 11 10 2011 cm.chang - * NULL - * Modify debug message for XLOG - * - * 11 08 2011 cm.chang - * NULL - * Add RLM and CNM debug message for XLOG - * - * 11 03 2011 cm.chang - * [WCXRP00000997] [MT6620 Wi-Fi][Driver][FW] Handle change of BSS preamble type and slot time - * Fix preamble type of STA mode - * - * 10 25 2011 cm.chang - * [WCXRP00001058] [All Wi-Fi][Driver] Fix sta_rec's phyTypeSet and OBSS scan in AP mode - * Not send ERP IE if peer STA is 802.11b-only - * - * 10 11 2011 cm.chang - * [WCXRP00001031] [All Wi-Fi][Driver] Check HT IE length to avoid wrong SCO parameter - * Ignore HT OP IE if its length field is not valid - * - * 09 28 2011 cm.chang - * NULL - * Add length check to reduce possibility to adopt wrong IE - * - * 09 20 2011 cm.chang - * [WCXRP00000997] [MT6620 Wi-Fi][Driver][FW] Handle change of BSS preamble type and slot time - * Handle client mode about preamble type and slot time - * - * 09 01 2011 cm.chang - * [WCXRP00000971] [MT6620 Wi-Fi][Driver][FW] Not set Beacon timeout interval when CPTT - * Final channel number only adopts the field from assoc response - * - * 06 10 2011 cm.chang - * [WCXRP00000773] [MT6620 Wi-Fi][Driver] Workaround some AP fill primary channel field with its secondary channel - * If DS IE exists, ignore the primary channel field in HT OP IE - * - * 05 03 2011 cm.chang - * [WCXRP00000691] [MT6620 Wi-Fi][Driver] Workaround about AP's wrong HT capability IE to have wrong channel number - * Fix compiling error - * - * 05 02 2011 cm.chang - * [WCXRP00000691] [MT6620 Wi-Fi][Driver] Workaround about AP's wrong HT capability IE to have wrong channel number - * Refine range of valid channel number - * - * 05 02 2011 cm.chang - * [WCXRP00000691] [MT6620 Wi-Fi][Driver] Workaround about AP's wrong HT capability IE to have wrong channel number - * Check if channel is valided before record ing BSS channel - * - * 04 14 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * . - * - * 04 12 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * . - * - * 03 29 2011 cm.chang - * [WCXRP00000606] [MT6620 Wi-Fi][Driver][FW] Fix klocwork warning - * As CR title - * - * 01 24 2011 cm.chang - * [WCXRP00000384] [MT6620 Wi-Fi][Driver][FW] Handle 20/40 action frame in AP mode and stop ampdu timer when sta_rec is freed - * Process received 20/40 coexistence action frame for AP mode - * - * 12 13 2010 cp.wu - * [WCXRP00000260] [MT6620 Wi-Fi][Driver][Firmware] Create V1.1 branch for both firmware and driver - * create branch for Wi-Fi driver v1.1 - * - * 12 07 2010 cm.chang - * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk - * 1. BSSINFO include RLM parameter - * 2. free all sta records when network is disconnected - * - * 12 07 2010 cm.chang - * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant - * 1. Country code is from NVRAM or supplicant - * 2. Change band definition in CMD/EVENT. - * - * 10 15 2010 cm.chang - * [WCXRP00000094] [MT6620 Wi-Fi][Driver] Connect to 2.4GHz AP, Driver crash. - * Add exception handle when no mgmt buffer in free build - * - * 10 08 2010 cm.chang - * NULL - * When 20M only setting, ignore OBSS IE - * - * 09 16 2010 cm.chang - * NULL - * Change conditional compiling options for BOW - * - * 09 10 2010 cm.chang - * NULL - * Always update Beacon content if FW sync OBSS info - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 08 23 2010 cp.wu - * NULL - * revise constant definitions to be matched with implementation (original cmd-event definition is deprecated) - * - * 08 23 2010 chinghwa.yu - * NULL - * Temporary add rlmUpdateParamByStaForBow() and rlmBssInitForBow(). - * - * 08 23 2010 chinghwa.yu - * NULL - * Add CFG_ENABLE_BT_OVER_WIFI. - * - * 08 23 2010 chinghwa.yu - * NULL - * Update for BOW. - * - * 08 20 2010 cm.chang - * NULL - * Migrate RLM code to host from FW - * - * 08 02 2010 yuche.tsai - * NULL - * P2P Group Negotiation Code Check in. - * - * 07 26 2010 yuche.tsai - * - * Fix compile error while enabling WiFi Direct function. - * - * 07 21 2010 yuche.tsai - * - * Add P2P Scan & Scan Result Parsing & Saving. - * - * 07 19 2010 cm.chang - * - * Set RLM parameters and enable CNM channel manager - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * take use of RLM module for parsing/generating HT IEs for 11n capability - * - * 07 08 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Check draft RLM code for HT cap - * - * 06 05 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Fix channel ID definition in RFB status to primary channel instead of center channel - * - * 06 02 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add TX short GI compiling option - * - * 06 02 2010 chinghwa.yu - * [BORA00000563]Add WiFi CoEx BCM module - * Roll back to remove CFG_SUPPORT_BCM_TEST. - * - * 06 01 2010 chinghwa.yu - * [BORA00000563]Add WiFi CoEx BCM module - * Update BCM Test and RW configuration. - * - * 05 31 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add some compiling options to control 11n functions - * - * 05 28 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Set RTS threshold of 2K bytes initially - * - * 05 18 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Ad-hoc Beacon should not carry HT OP and OBSS IEs - * - * 05 07 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Process 20/40 coexistence public action frame in AP mode - * - * 05 05 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * First draft support for 20/40M bandwidth for AP mode - * - * 04 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW - * - * 04 22 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * First draft code to support protection in AP mode - * - * 04 13 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Utilize status of swRfb to know channel number and band - * - * 04 07 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Different invoking order for WTBL entry of associated AP - * - * 04 07 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add virtual test for OBSS scan - * - * 04 02 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Process Beacon only ready for infra STA now - * - * 03 30 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support 2.4G OBSS scan - * - * 03 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Not carry HT cap when being associated with b/g only AP - * - * 03 24 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * fixed some WHQL testing error. - * - * 03 15 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Provide draft measurement and quiet functions - * - * 03 09 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * If bss is not 11n network, zero WTBL HT parameters - * - * 03 03 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * To support CFG_SUPPORT_BCM_STP - * - * 03 02 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Generate HT IE only depending on own phyTypeSet - * - * 03 02 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Not fill HT related IE if BssInfo does not include 11n phySet - * - * 03 01 2010 tehuang.liu - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * To store field AMPDU Parameters in STA_REC - * - * 02 26 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Enable RDG RX, but disable RDG TX for IOT and LongNAV - * - * 02 12 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Use bss info array for concurrent handle - * - * 02 05 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * 01 22 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support protection and bandwidth switch - * - * 01 07 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Modify the parameter of rlmRecAssocRspHtInfo function - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * Dec 12 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix prBssInfo->ucPrimaryChannel handle for assoc resp - * - * Dec 9 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add some function to process HT operation - * - * Nov 28 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Call rlmStatisticsInit() to handle MIB counters - * - * Nov 18 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * - * -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -static VOID -rlmFillHtCapIE ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - P_MSDU_INFO_T prMsduInfo - ); - -static VOID -rlmFillExtCapIE ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - P_MSDU_INFO_T prMsduInfo - ); - -static VOID -rlmFillHtOpIE ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - P_MSDU_INFO_T prMsduInfo - ); - -static UINT_8 -rlmRecIeInfoForClient ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - PUINT_8 pucIE, - UINT_16 u2IELength - ); - -static BOOLEAN -rlmRecBcnFromNeighborForClient ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - P_SW_RFB_T prSwRfb, - PUINT_8 pucIE, - UINT_16 u2IELength - ); - -static BOOLEAN -rlmRecBcnInfoForClient ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - P_SW_RFB_T prSwRfb, - PUINT_8 pucIE, - UINT_16 u2IELength - ); - -static VOID -rlmBssReset ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmFsmEventInit ( - P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - /* Note: assume TIMER_T structures are reset to zero or stopped - * before invoking this function. - */ - - /* Initialize OBSS FSM */ - rlmObssInit(prAdapter); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmFsmEventUninit ( - P_ADAPTER_T prAdapter - ) -{ - P_BSS_INFO_T prBssInfo; - UINT_8 ucNetIdx; - - ASSERT(prAdapter); - - RLM_NET_FOR_EACH(ucNetIdx) { - prBssInfo = &prAdapter->rWifiVar.arBssInfo[ucNetIdx]; - ASSERT(prBssInfo); - - /* Note: all RLM timers will also be stopped. - * Now only one OBSS scan timer. - */ - rlmBssReset(prAdapter, prBssInfo); - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief For probe request, association request -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmReqGenerateHtCapIE ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ) -{ - P_BSS_INFO_T prBssInfo; - P_STA_RECORD_T prStaRec; - - ASSERT(prAdapter); - ASSERT(prMsduInfo); - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prMsduInfo->ucNetworkType]; - ASSERT(prBssInfo); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - if ((prAdapter->rWifiVar.ucAvailablePhyTypeSet & PHY_TYPE_SET_802_11N) && - (!prStaRec || (prStaRec->ucPhyTypeSet & PHY_TYPE_SET_802_11N))) { - - rlmFillHtCapIE(prAdapter, prBssInfo, prMsduInfo); - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief For probe request, association request -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmReqGenerateExtCapIE ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ) -{ - P_BSS_INFO_T prBssInfo; - P_STA_RECORD_T prStaRec; - - ASSERT(prAdapter); - ASSERT(prMsduInfo); - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prMsduInfo->ucNetworkType]; - ASSERT(prBssInfo); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - if ((prAdapter->rWifiVar.ucAvailablePhyTypeSet & PHY_TYPE_SET_802_11N) && - (!prStaRec || (prStaRec->ucPhyTypeSet & PHY_TYPE_SET_802_11N))) { - - rlmFillExtCapIE(prAdapter, prBssInfo, prMsduInfo); - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief For probe response (GO, IBSS) and association response -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmRspGenerateHtCapIE ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ) -{ - P_BSS_INFO_T prBssInfo; - P_STA_RECORD_T prStaRec; - - ASSERT(prAdapter); - ASSERT(prMsduInfo); - ASSERT(IS_NET_ACTIVE(prAdapter, prMsduInfo->ucNetworkType)); - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prMsduInfo->ucNetworkType]; - ASSERT(prBssInfo); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - if (RLM_NET_IS_11N(prBssInfo) && - (!prStaRec || (prStaRec->ucPhyTypeSet & PHY_TYPE_SET_802_11N))) { - - rlmFillHtCapIE(prAdapter, prBssInfo, prMsduInfo); - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief For probe response (GO, IBSS) and association response -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmRspGenerateExtCapIE ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ) -{ - P_BSS_INFO_T prBssInfo; - P_STA_RECORD_T prStaRec; - - ASSERT(prAdapter); - ASSERT(prMsduInfo); - ASSERT(IS_NET_ACTIVE(prAdapter, prMsduInfo->ucNetworkType)); - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prMsduInfo->ucNetworkType]; - ASSERT(prBssInfo); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - if (RLM_NET_IS_11N(prBssInfo) && - (!prStaRec || (prStaRec->ucPhyTypeSet & PHY_TYPE_SET_802_11N))) { - - rlmFillExtCapIE(prAdapter, prBssInfo, prMsduInfo); - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief For probe response (GO, IBSS) and association response -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmRspGenerateHtOpIE ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ) -{ - P_BSS_INFO_T prBssInfo; - P_STA_RECORD_T prStaRec; - - ASSERT(prAdapter); - ASSERT(prMsduInfo); - ASSERT(IS_NET_ACTIVE(prAdapter, prMsduInfo->ucNetworkType)); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prMsduInfo->ucNetworkType]; - ASSERT(prBssInfo); - - if (RLM_NET_IS_11N(prBssInfo) && - (!prStaRec || (prStaRec->ucPhyTypeSet & PHY_TYPE_SET_802_11N))) { - - rlmFillHtOpIE(prAdapter, prBssInfo, prMsduInfo); - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief For probe response (GO, IBSS) and association response -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmRspGenerateErpIE ( - P_ADAPTER_T prAdapter, - P_MSDU_INFO_T prMsduInfo - ) -{ - P_BSS_INFO_T prBssInfo; - P_STA_RECORD_T prStaRec; - P_IE_ERP_T prErpIe; - - ASSERT(prAdapter); - ASSERT(prMsduInfo); - ASSERT(IS_NET_ACTIVE(prAdapter, prMsduInfo->ucNetworkType)); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prMsduInfo->ucNetworkType]; - ASSERT(prBssInfo); - - if (RLM_NET_IS_11GN(prBssInfo) && prBssInfo->eBand == BAND_2G4 && - (!prStaRec || (prStaRec->ucPhyTypeSet & PHY_TYPE_SET_802_11GN))) { - prErpIe = (P_IE_ERP_T) - (((PUINT_8) prMsduInfo->prPacket) + prMsduInfo->u2FrameLength); - - /* Add ERP IE */ - prErpIe->ucId = ELEM_ID_ERP_INFO; - prErpIe->ucLength = 1; - - prErpIe->ucERP = prBssInfo->fgObssErpProtectMode ? - ERP_INFO_USE_PROTECTION : 0; - - if (prBssInfo->fgErpProtectMode) { - prErpIe->ucERP |= - (ERP_INFO_NON_ERP_PRESENT | ERP_INFO_USE_PROTECTION); - } - - /* Handle barker preamble */ - if (!prBssInfo->fgUseShortPreamble) { - prErpIe->ucERP |= ERP_INFO_BARKER_PREAMBLE_MODE; - } - - ASSERT(IE_SIZE(prErpIe) <= (ELEM_HDR_LEN+ ELEM_MAX_LEN_ERP)); - - prMsduInfo->u2FrameLength += IE_SIZE(prErpIe); - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -static VOID -rlmFillHtCapIE ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - P_MSDU_INFO_T prMsduInfo - ) -{ - P_IE_HT_CAP_T prHtCap; - P_SUP_MCS_SET_FIELD prSupMcsSet; - BOOLEAN fg40mAllowed; - - ASSERT(prAdapter); - ASSERT(prBssInfo); - ASSERT(prMsduInfo); - - fg40mAllowed = prBssInfo->fgAssoc40mBwAllowed; - - prHtCap = (P_IE_HT_CAP_T) - (((PUINT_8) prMsduInfo->prPacket) + prMsduInfo->u2FrameLength); - - /* Add HT capabilities IE */ - prHtCap->ucId = ELEM_ID_HT_CAP; - prHtCap->ucLength = sizeof(IE_HT_CAP_T) - ELEM_HDR_LEN; - - prHtCap->u2HtCapInfo = HT_CAP_INFO_DEFAULT_VAL; - if (!fg40mAllowed) { - prHtCap->u2HtCapInfo &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH | - HT_CAP_INFO_SHORT_GI_40M | HT_CAP_INFO_DSSS_CCK_IN_40M); - } - if (prAdapter->rWifiVar.rConnSettings.fgRxShortGIDisabled) { - prHtCap->u2HtCapInfo &= - ~(HT_CAP_INFO_SHORT_GI_20M | HT_CAP_INFO_SHORT_GI_40M); - } - - prHtCap->ucAmpduParam = AMPDU_PARAM_DEFAULT_VAL; - - prSupMcsSet = &prHtCap->rSupMcsSet; - kalMemZero((PVOID)&prSupMcsSet->aucRxMcsBitmask[0], - SUP_MCS_RX_BITMASK_OCTET_NUM); - - prSupMcsSet->aucRxMcsBitmask[0] = BITS(0, 7); - - if (fg40mAllowed) { - prSupMcsSet->aucRxMcsBitmask[32/8] = BIT(0); /* MCS32 */ - } - prSupMcsSet->u2RxHighestSupportedRate = SUP_MCS_RX_DEFAULT_HIGHEST_RATE; - prSupMcsSet->u4TxRateInfo = SUP_MCS_TX_DEFAULT_VAL; - - prHtCap->u2HtExtendedCap = HT_EXT_CAP_DEFAULT_VAL; - if (!fg40mAllowed || prBssInfo->eCurrentOPMode != OP_MODE_INFRASTRUCTURE) { - prHtCap->u2HtExtendedCap &= - ~(HT_EXT_CAP_PCO | HT_EXT_CAP_PCO_TRANS_TIME_NONE); - } - - prHtCap->u4TxBeamformingCap = TX_BEAMFORMING_CAP_DEFAULT_VAL; - - prHtCap->ucAselCap = ASEL_CAP_DEFAULT_VAL; - - - ASSERT(IE_SIZE(prHtCap) <= (ELEM_HDR_LEN + ELEM_MAX_LEN_HT_CAP)); - - prMsduInfo->u2FrameLength += IE_SIZE(prHtCap); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -static VOID -rlmFillExtCapIE ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - P_MSDU_INFO_T prMsduInfo - ) -{ - P_EXT_CAP_T prExtCap; - BOOLEAN fg40mAllowed; - - ASSERT(prAdapter); - ASSERT(prMsduInfo); - - fg40mAllowed = prBssInfo->fgAssoc40mBwAllowed; - - /* Add Extended Capabilities IE */ - prExtCap = (P_EXT_CAP_T) - (((PUINT_8) prMsduInfo->prPacket) + prMsduInfo->u2FrameLength); - - prExtCap->ucId = ELEM_ID_EXTENDED_CAP; - prExtCap->ucLength = 1; - prExtCap->aucCapabilities[0] = ELEM_EXT_CAP_DEFAULT_VAL; - - if (!fg40mAllowed) { - prExtCap->aucCapabilities[0] &= ~ELEM_EXT_CAP_20_40_COEXIST_SUPPORT; - } - - if (prBssInfo->eCurrentOPMode != OP_MODE_INFRASTRUCTURE) { - prExtCap->aucCapabilities[0] &= ~ELEM_EXT_CAP_PSMP_CAP; - } - - ASSERT(IE_SIZE(prExtCap) <= (ELEM_HDR_LEN + ELEM_MAX_LEN_EXT_CAP)); - - prMsduInfo->u2FrameLength += IE_SIZE(prExtCap); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -static VOID -rlmFillHtOpIE ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - P_MSDU_INFO_T prMsduInfo - ) -{ - P_IE_HT_OP_T prHtOp; - UINT_16 i; - - ASSERT(prAdapter); - ASSERT(prBssInfo); - ASSERT(prMsduInfo); - - prHtOp = (P_IE_HT_OP_T) - (((PUINT_8) prMsduInfo->prPacket) + prMsduInfo->u2FrameLength); - - /* Add HT operation IE */ - prHtOp->ucId = ELEM_ID_HT_OP; - prHtOp->ucLength = sizeof(IE_HT_OP_T) - ELEM_HDR_LEN; - - /* RIFS and 20/40 bandwidth operations are included */ - prHtOp->ucPrimaryChannel = prBssInfo->ucPrimaryChannel; - prHtOp->ucInfo1 = prBssInfo->ucHtOpInfo1; - - /* Decide HT protection mode field */ - if (prBssInfo->eHtProtectMode == HT_PROTECT_MODE_NON_HT) { - prHtOp->u2Info2 = (UINT_8) HT_PROTECT_MODE_NON_HT; - } - else if (prBssInfo->eObssHtProtectMode == HT_PROTECT_MODE_NON_MEMBER) { - prHtOp->u2Info2 = (UINT_8) HT_PROTECT_MODE_NON_MEMBER; - } - else { - /* It may be SYS_PROTECT_MODE_NONE or SYS_PROTECT_MODE_20M */ - prHtOp->u2Info2 = (UINT_8) prBssInfo->eHtProtectMode; - } - - if (prBssInfo->eGfOperationMode != GF_MODE_NORMAL) { - /* It may be GF_MODE_PROTECT or GF_MODE_DISALLOWED - * Note: it will also be set in ad-hoc network - */ - prHtOp->u2Info2 |= HT_OP_INFO2_NON_GF_HT_STA_PRESENT; - } - - if (0 /* Regulatory class 16 */ && - prBssInfo->eObssHtProtectMode == HT_PROTECT_MODE_NON_MEMBER) { - /* (TBD) It is HT_PROTECT_MODE_NON_MEMBER, so require protection - * although it is possible to have no protection by spec. - */ - prHtOp->u2Info2 |= HT_OP_INFO2_OBSS_NON_HT_STA_PRESENT; - } - - prHtOp->u2Info3 = prBssInfo->u2HtOpInfo3; /* To do: handle L-SIG TXOP */ - - /* No basic MCSx are needed temporarily */ - for (i = 0; i < 16; i++) { - prHtOp->aucBasicMcsSet[i] = 0; - } - - ASSERT(IE_SIZE(prHtOp) <= (ELEM_HDR_LEN + ELEM_MAX_LEN_HT_OP)); - - prMsduInfo->u2FrameLength += IE_SIZE(prHtOp); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function should be invoked to update parameters of associated AP. -* (Association response and Beacon) -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -static UINT_8 -rlmRecIeInfoForClient ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - PUINT_8 pucIE, - UINT_16 u2IELength - ) -{ - UINT_16 u2Offset; - P_STA_RECORD_T prStaRec; - P_IE_HT_CAP_T prHtCap; - P_IE_HT_OP_T prHtOp; - P_IE_OBSS_SCAN_PARAM_T prObssScnParam; - UINT_8 ucERP, ucPrimaryChannel; -#if CFG_SUPPORT_QUIET && 0 - BOOLEAN fgHasQuietIE = FALSE; -#endif - - ASSERT(prAdapter); - ASSERT(prBssInfo); - ASSERT(pucIE); - - prStaRec = prBssInfo->prStaRecOfAP; - ASSERT(prStaRec); - if (!prStaRec) { - return 0; - } - - prBssInfo->fgUseShortPreamble = prBssInfo->fgIsShortPreambleAllowed; - ucPrimaryChannel = 0; - prObssScnParam = NULL; - - /* Note: HT-related members in staRec may not be zero before, so - * if following IE does not exist, they are still not zero. - * These HT-related parameters are vaild only when the corresponding - * BssInfo supports 802.11n, i.e., RLM_NET_IS_11N() - */ - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - switch (IE_ID(pucIE)) { - case ELEM_ID_HT_CAP: - if (!RLM_NET_IS_11N(prBssInfo) || - IE_LEN(pucIE) != (sizeof(IE_HT_CAP_T) - 2)) { - break; - } - prHtCap = (P_IE_HT_CAP_T) pucIE; - prStaRec->ucMcsSet = prHtCap->rSupMcsSet.aucRxMcsBitmask[0]; - prStaRec->fgSupMcs32 = - (prHtCap->rSupMcsSet.aucRxMcsBitmask[32/8] & BIT(0)) ? - TRUE : FALSE; - - prStaRec->u2HtCapInfo = prHtCap->u2HtCapInfo; - prStaRec->ucAmpduParam = prHtCap->ucAmpduParam; - prStaRec->u2HtExtendedCap = prHtCap->u2HtExtendedCap; - prStaRec->u4TxBeamformingCap = prHtCap->u4TxBeamformingCap; - prStaRec->ucAselCap = prHtCap->ucAselCap; - break; - - case ELEM_ID_HT_OP: - if (!RLM_NET_IS_11N(prBssInfo) || - IE_LEN(pucIE) != (sizeof(IE_HT_OP_T) - 2)) { - break; - } - prHtOp = (P_IE_HT_OP_T) pucIE; - /* Workaround that some APs fill primary channel field by its - * secondary channel, but its DS IE is correct 20110610 - */ - if (ucPrimaryChannel == 0) { - ucPrimaryChannel = prHtOp->ucPrimaryChannel; - } - prBssInfo->ucHtOpInfo1 = prHtOp->ucInfo1; - prBssInfo->u2HtOpInfo2 = prHtOp->u2Info2; - prBssInfo->u2HtOpInfo3 = prHtOp->u2Info3; - - if (!prBssInfo->fg40mBwAllowed) { - prBssInfo->ucHtOpInfo1 &= - ~(HT_OP_INFO1_SCO | HT_OP_INFO1_STA_CHNL_WIDTH); - } - - if ((prBssInfo->ucHtOpInfo1 & HT_OP_INFO1_SCO) != CHNL_EXT_RES) { - prBssInfo->eBssSCO = (ENUM_CHNL_EXT_T) - (prBssInfo->ucHtOpInfo1 & HT_OP_INFO1_SCO); - } - - prBssInfo->eHtProtectMode = (ENUM_HT_PROTECT_MODE_T) - (prBssInfo->u2HtOpInfo2 & HT_OP_INFO2_HT_PROTECTION); - - /* To do: process regulatory class 16 */ - if ((prBssInfo->u2HtOpInfo2 & HT_OP_INFO2_OBSS_NON_HT_STA_PRESENT) - && 0 /* && regulatory class is 16 */) { - prBssInfo->eGfOperationMode = GF_MODE_DISALLOWED; - } - else if (prBssInfo->u2HtOpInfo2&HT_OP_INFO2_NON_GF_HT_STA_PRESENT) { - prBssInfo->eGfOperationMode = GF_MODE_PROTECT; - } - else { - prBssInfo->eGfOperationMode = GF_MODE_NORMAL; - } - - prBssInfo->eRifsOperationMode = - (prBssInfo->ucHtOpInfo1 & HT_OP_INFO1_RIFS_MODE) ? - RIFS_MODE_NORMAL : RIFS_MODE_DISALLOWED; - - break; - - case ELEM_ID_20_40_BSS_COEXISTENCE: - if (!RLM_NET_IS_11N(prBssInfo)) { - break; - } - /* To do: store if scanning exemption grant to BssInfo */ - break; - - case ELEM_ID_OBSS_SCAN_PARAMS: - if (!RLM_NET_IS_11N(prBssInfo) || - IE_LEN(pucIE) != (sizeof(IE_OBSS_SCAN_PARAM_T) - 2)) { - break; - } - /* Store OBSS parameters to BssInfo */ - prObssScnParam = (P_IE_OBSS_SCAN_PARAM_T) pucIE; - break; - - case ELEM_ID_EXTENDED_CAP: - if (!RLM_NET_IS_11N(prBssInfo)) { - break; - } - /* To do: store extended capability (PSMP, coexist) to BssInfo */ - break; - - case ELEM_ID_ERP_INFO: - if (IE_LEN(pucIE) != (sizeof(IE_ERP_T) - 2) || - prBssInfo->eBand != BAND_2G4) { - break; - } - ucERP = ERP_INFO_IE(pucIE)->ucERP; - prBssInfo->fgErpProtectMode = - (ucERP & ERP_INFO_USE_PROTECTION) ? TRUE : FALSE; - - if (ucERP & ERP_INFO_BARKER_PREAMBLE_MODE) { - prBssInfo->fgUseShortPreamble = FALSE; - } - break; - - case ELEM_ID_DS_PARAM_SET: - if (IE_LEN(pucIE) == ELEM_MAX_LEN_DS_PARAMETER_SET) { - ucPrimaryChannel = DS_PARAM_IE(pucIE)->ucCurrChnl; - } - break; - - #if CFG_SUPPORT_QUIET && 0 - /* Note: RRM code should be moved to independent RRM function by - * component design rule. But we attach it to RLM temporarily - */ - case ELEM_ID_QUIET: - rrmQuietHandleQuietIE(prBssInfo, (P_IE_QUIET_T) pucIE); - fgHasQuietIE = TRUE; - break; - #endif - default: - break; - } /* end of switch */ - } /* end of IE_FOR_EACH */ - - /* Some AP will have wrong channel number (255) when running time. - * Check if correct channel number information. 20110501 - */ - if ((prBssInfo->eBand == BAND_2G4 && ucPrimaryChannel > 14) || - (prBssInfo->eBand != BAND_2G4 && (ucPrimaryChannel >= 200 || - ucPrimaryChannel <= 14))) { - ucPrimaryChannel = 0; - } - -#if CFG_SUPPORT_QUIET && 0 - if (!fgHasQuietIE) { - rrmQuietIeNotExist(prAdapter, prBssInfo); - } -#endif - - /* Check if OBSS scan process will launch */ - if (!prAdapter->fgEnOnlineScan || !prObssScnParam || - !(prStaRec->u2HtCapInfo & HT_CAP_INFO_SUP_CHNL_WIDTH) || - prBssInfo->eBand != BAND_2G4 || !prBssInfo->fg40mBwAllowed) { - - /* Note: it is ok not to stop rObssScanTimer() here */ - prBssInfo->u2ObssScanInterval = 0; - } - else { - if (prObssScnParam->u2TriggerScanInterval < OBSS_SCAN_MIN_INTERVAL) { - prObssScnParam->u2TriggerScanInterval = OBSS_SCAN_MIN_INTERVAL; - } - if (prBssInfo->u2ObssScanInterval != - prObssScnParam->u2TriggerScanInterval) { - - prBssInfo->u2ObssScanInterval = - prObssScnParam->u2TriggerScanInterval; - - /* Start timer to trigger OBSS scanning */ - cnmTimerStartTimer(prAdapter, &prBssInfo->rObssScanTimer, - prBssInfo->u2ObssScanInterval * MSEC_PER_SEC); - } - } - - return ucPrimaryChannel; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief AIS or P2P GC. -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -static BOOLEAN -rlmRecBcnFromNeighborForClient ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - P_SW_RFB_T prSwRfb, - PUINT_8 pucIE, - UINT_16 u2IELength - ) -{ - UINT_16 u2Offset, i; - UINT_8 ucPriChannel, ucSecChannel; - ENUM_CHNL_EXT_T eSCO; - BOOLEAN fgHtBss, fg20mReq; - - ASSERT(prAdapter); - ASSERT(prBssInfo && prSwRfb); - ASSERT(pucIE); - - /* Record it to channel list to change 20/40 bandwidth */ - ucPriChannel = 0; - eSCO = CHNL_EXT_SCN; - - fgHtBss = FALSE; - fg20mReq = FALSE; - - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - switch (IE_ID(pucIE)) { - case ELEM_ID_HT_CAP: - { - P_IE_HT_CAP_T prHtCap; - - if (IE_LEN(pucIE) != (sizeof(IE_HT_CAP_T) - 2)) { - break; - } - - prHtCap = (P_IE_HT_CAP_T) pucIE; - if (prHtCap->u2HtCapInfo & HT_CAP_INFO_40M_INTOLERANT) { - fg20mReq = TRUE; - } - fgHtBss = TRUE; - break; - } - case ELEM_ID_HT_OP: - { - P_IE_HT_OP_T prHtOp; - - if (IE_LEN(pucIE) != (sizeof(IE_HT_OP_T) - 2)) { - break; - } - - prHtOp = (P_IE_HT_OP_T) pucIE; - /* Workaround that some APs fill primary channel field by its - * secondary channel, but its DS IE is correct 20110610 - */ - if (ucPriChannel == 0) { - ucPriChannel = prHtOp->ucPrimaryChannel; - } - - if ((prHtOp->ucInfo1 & HT_OP_INFO1_SCO) != CHNL_EXT_RES) { - eSCO = (ENUM_CHNL_EXT_T) (prHtOp->ucInfo1 & HT_OP_INFO1_SCO); - } - break; - } - case ELEM_ID_20_40_BSS_COEXISTENCE: - { - P_IE_20_40_COEXIST_T prCoexist; - - if (IE_LEN(pucIE) != (sizeof(IE_20_40_COEXIST_T) - 2)) { - break; - } - - prCoexist = (P_IE_20_40_COEXIST_T) pucIE; - if (prCoexist->ucData & BSS_COEXIST_40M_INTOLERANT) { - fg20mReq = TRUE; - } - break; - } - case ELEM_ID_DS_PARAM_SET: - if (IE_LEN(pucIE) != (sizeof(IE_DS_PARAM_SET_T) - 2)) { - break; - } - ucPriChannel = DS_PARAM_IE(pucIE)->ucCurrChnl; - break; - - default: - break; - } - } - - - /* To do: Update channel list and 5G band. All channel lists have the same - * update procedure. We should give it the entry pointer of desired - * channel list. - */ - if (HIF_RX_HDR_GET_RF_BAND(prSwRfb->prHifRxHdr) != BAND_2G4) { - return FALSE; - } - - if (ucPriChannel == 0 || ucPriChannel > 14) { - ucPriChannel = HIF_RX_HDR_GET_CHNL_NUM(prSwRfb->prHifRxHdr); - } - - if (fgHtBss) { - ASSERT(prBssInfo->auc2G_PriChnlList[0] <= CHNL_LIST_SZ_2G); - for (i = 1; i <= prBssInfo->auc2G_PriChnlList[0] && - i <= CHNL_LIST_SZ_2G; i++) { - if (prBssInfo->auc2G_PriChnlList[i] == ucPriChannel) { - break; - } - } - if ((i > prBssInfo->auc2G_PriChnlList[0]) && (i <= CHNL_LIST_SZ_2G)) { - prBssInfo->auc2G_PriChnlList[i] = ucPriChannel; - prBssInfo->auc2G_PriChnlList[0]++; - } - - /* Update secondary channel */ - if (eSCO != CHNL_EXT_SCN) { - ucSecChannel = (eSCO == CHNL_EXT_SCA) ? - (ucPriChannel + 4) : (ucPriChannel - 4); - - ASSERT(prBssInfo->auc2G_SecChnlList[0] <= CHNL_LIST_SZ_2G); - for (i = 1; i <= prBssInfo->auc2G_SecChnlList[0] && - i <= CHNL_LIST_SZ_2G; i++) { - if (prBssInfo->auc2G_SecChnlList[i] == ucSecChannel) { - break; - } - } - if ((i > prBssInfo->auc2G_SecChnlList[0])&& (i <= CHNL_LIST_SZ_2G)){ - prBssInfo->auc2G_SecChnlList[i] = ucSecChannel; - prBssInfo->auc2G_SecChnlList[0]++; - } - } - - /* Update 20M bandwidth request channels */ - if (fg20mReq) { - ASSERT(prBssInfo->auc2G_20mReqChnlList[0] <= CHNL_LIST_SZ_2G); - for (i = 1; i <= prBssInfo->auc2G_20mReqChnlList[0] && - i <= CHNL_LIST_SZ_2G; i++) { - if (prBssInfo->auc2G_20mReqChnlList[i] == ucPriChannel) { - break; - } - } - if ((i > prBssInfo->auc2G_20mReqChnlList[0]) && - (i <= CHNL_LIST_SZ_2G)){ - prBssInfo->auc2G_20mReqChnlList[i] = ucPriChannel; - prBssInfo->auc2G_20mReqChnlList[0]++; - } - } - } - else { - /* Update non-HT channel list */ - ASSERT(prBssInfo->auc2G_NonHtChnlList[0] <= CHNL_LIST_SZ_2G); - for (i = 1; i <= prBssInfo->auc2G_NonHtChnlList[0] && - i <= CHNL_LIST_SZ_2G; i++) { - if (prBssInfo->auc2G_NonHtChnlList[i] == ucPriChannel) { - break; - } - } - if ((i > prBssInfo->auc2G_NonHtChnlList[0]) && (i <= CHNL_LIST_SZ_2G)) { - prBssInfo->auc2G_NonHtChnlList[i] = ucPriChannel; - prBssInfo->auc2G_NonHtChnlList[0]++; - } - - } - - return FALSE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief AIS or P2P GC. -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -static BOOLEAN -rlmRecBcnInfoForClient ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo, - P_SW_RFB_T prSwRfb, - PUINT_8 pucIE, - UINT_16 u2IELength - ) -{ - ASSERT(prAdapter); - ASSERT(prBssInfo && prSwRfb); - ASSERT(pucIE); - -#if 0 /* SW migration 2010/8/20 */ - /* Note: we shall not update parameters when scanning, otherwise - * channel and bandwidth will not be correct or asserted failure - * during scanning. - * Note: remove channel checking. All received Beacons should be processed - * if measurement or other actions are executed in adjacent channels - * and Beacon content checking mechanism is not disabled. - */ - if (IS_SCAN_ACTIVE() - /* || prBssInfo->ucPrimaryChannel != CHNL_NUM_BY_SWRFB(prSwRfb) */) { - return FALSE; - } -#endif - - /* Handle change of slot time */ - prBssInfo->u2CapInfo = - ((P_WLAN_BEACON_FRAME_T)(prSwRfb->pvHeader))->u2CapInfo; - prBssInfo->fgUseShortSlotTime = - (prBssInfo->u2CapInfo & CAP_INFO_SHORT_SLOT_TIME) ? TRUE : FALSE; - - rlmRecIeInfoForClient(prAdapter, prBssInfo, pucIE, u2IELength); - - return TRUE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmProcessBcn ( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb, - PUINT_8 pucIE, - UINT_16 u2IELength - ) -{ - P_BSS_INFO_T prBssInfo; - BOOLEAN fgNewParameter; - UINT_8 ucNetIdx; - - ASSERT(prAdapter); - ASSERT(prSwRfb); - ASSERT(pucIE); - - fgNewParameter = FALSE; - - /* When concurrent networks exist, GO shall have the same handle as - * the other BSS, so the Beacon shall be procesed for bandwidth and - * protection mechanism. - * Note1: we do not have 2 AP (GO) cases simultaneously now. - * Note2: If we are GO, concurrent AIS AP should detect it and reflect - * action in its Beacon, so AIS STA just follows Beacon from AP. - */ - RLM_NET_FOR_EACH_NO_BOW(ucNetIdx) { - prBssInfo = &prAdapter->rWifiVar.arBssInfo[ucNetIdx]; - ASSERT(prBssInfo); - - if (IS_BSS_ACTIVE(prBssInfo)) { - if (prBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE && - prBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED) { - /* P2P client or AIS infra STA */ - if (EQUAL_MAC_ADDR(prBssInfo->aucBSSID, - ((P_WLAN_MAC_MGMT_HEADER_T) - (prSwRfb->pvHeader))->aucBSSID)) { - - fgNewParameter = rlmRecBcnInfoForClient(prAdapter, - prBssInfo, prSwRfb, pucIE, u2IELength); - } - else { - fgNewParameter = rlmRecBcnFromNeighborForClient(prAdapter, - prBssInfo, prSwRfb, pucIE, u2IELength); - } - } - #if CFG_ENABLE_WIFI_DIRECT - else if (prAdapter->fgIsP2PRegistered && - (prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT || - prBssInfo->eCurrentOPMode == OP_MODE_P2P_DEVICE)) { - /* AP scan to check if 20/40M bandwidth is permitted */ - rlmRecBcnFromNeighborForClient(prAdapter, - prBssInfo, prSwRfb, pucIE, u2IELength); - } - #endif - else if (prBssInfo->eCurrentOPMode == OP_MODE_IBSS) { - /* To do: Ad-hoc */ - } - - /* Appy new parameters if necessary */ - if (fgNewParameter) { - rlmSyncOperationParams(prAdapter, prBssInfo); - fgNewParameter = FALSE; - } - } /* end of IS_BSS_ACTIVE() */ - } /* end of RLM_NET_FOR_EACH_NO_BOW */ -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function should be invoked after judging successful association. -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmProcessAssocRsp ( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb, - PUINT_8 pucIE, - UINT_16 u2IELength - ) -{ - P_BSS_INFO_T prBssInfo; - P_STA_RECORD_T prStaRec; - UINT_8 ucPriChannel; - - ASSERT(prAdapter); - ASSERT(prSwRfb); - ASSERT(pucIE); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - ASSERT(prStaRec); - if (!prStaRec) { - return; - } - ASSERT(prStaRec->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]; - ASSERT(prStaRec == prBssInfo->prStaRecOfAP); - - /* To do: the invoked function is used to clear all members. It may be - * done by center mechanism in invoker. - */ - rlmBssReset(prAdapter, prBssInfo); - - prBssInfo->fgUseShortSlotTime = - (prBssInfo->u2CapInfo & CAP_INFO_SHORT_SLOT_TIME) ? TRUE : FALSE; - - if ((ucPriChannel = - rlmRecIeInfoForClient(prAdapter, prBssInfo, pucIE, u2IELength)) > 0) { - prBssInfo->ucPrimaryChannel = ucPriChannel; - } - - if (!RLM_NET_IS_11N(prBssInfo) || - !(prStaRec->u2HtCapInfo & HT_CAP_INFO_SUP_CHNL_WIDTH)) { - prBssInfo->fg40mBwAllowed = FALSE; - } - - /* Note: Update its capabilities to WTBL by cnmStaRecChangeState(), which - * shall be invoked afterwards. - * Update channel, bandwidth and protection mode by nicUpdateBss() - */ -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function should be invoked after judging successful association. -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmFillSyncCmdParam ( - P_CMD_SET_BSS_RLM_PARAM_T prCmdBody, - P_BSS_INFO_T prBssInfo - ) -{ - ASSERT(prCmdBody && prBssInfo); - if (!prCmdBody || !prBssInfo) { - return; - } - - prCmdBody->ucNetTypeIndex = prBssInfo->ucNetTypeIndex; - prCmdBody->ucRfBand = (UINT_8) prBssInfo->eBand; - prCmdBody->ucPrimaryChannel = prBssInfo->ucPrimaryChannel; - prCmdBody->ucRfSco = (UINT_8) prBssInfo->eBssSCO; - prCmdBody->ucErpProtectMode = (UINT_8) prBssInfo->fgErpProtectMode; - prCmdBody->ucHtProtectMode = (UINT_8) prBssInfo->eHtProtectMode; - prCmdBody->ucGfOperationMode = (UINT_8) prBssInfo->eGfOperationMode; - prCmdBody->ucTxRifsMode = (UINT_8) prBssInfo->eRifsOperationMode; - prCmdBody->u2HtOpInfo3 = prBssInfo->u2HtOpInfo3; - prCmdBody->u2HtOpInfo2 = prBssInfo->u2HtOpInfo2; - prCmdBody->ucHtOpInfo1 = prBssInfo->ucHtOpInfo1; - prCmdBody->ucUseShortPreamble = prBssInfo->fgUseShortPreamble; - prCmdBody->ucUseShortSlotTime = prBssInfo->fgUseShortSlotTime; - prCmdBody->ucCheckId = 0x72; - - if (RLM_NET_PARAM_VALID(prBssInfo)) { - DBGLOG(RLM, INFO, ("N=%d b=%d c=%d s=%d e=%d h=%d I=0x%02x l=%d p=%d\n", - prCmdBody->ucNetTypeIndex, prCmdBody->ucRfBand, - prCmdBody->ucPrimaryChannel, prCmdBody->ucRfSco, - prCmdBody->ucErpProtectMode, prCmdBody->ucHtProtectMode, - prCmdBody->ucHtOpInfo1, prCmdBody->ucUseShortSlotTime, - prCmdBody->ucUseShortPreamble)); - } - else { - DBGLOG(RLM, INFO, ("N=%d closed\n", prCmdBody->ucNetTypeIndex)); - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will operation parameters based on situations of -* concurrent networks. Channel, bandwidth, protection mode, supported -* rate will be modified. -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmSyncOperationParams ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ) -{ - P_CMD_SET_BSS_RLM_PARAM_T prCmdBody; - WLAN_STATUS rStatus; - - ASSERT(prAdapter); - ASSERT(prBssInfo); - - prCmdBody = (P_CMD_SET_BSS_RLM_PARAM_T) - cnmMemAlloc(prAdapter, RAM_TYPE_BUF, sizeof(CMD_SET_BSS_RLM_PARAM_T)); - ASSERT(prCmdBody); - - /* To do: exception handle */ - if (!prCmdBody) { - DBGLOG(RLM, WARN, ("No buf for sync RLM params (Net=%d)\n", - prBssInfo->ucNetTypeIndex)); - return; - } - - rlmFillSyncCmdParam(prCmdBody, prBssInfo); - - rStatus = wlanSendSetQueryCmd ( - prAdapter, /* prAdapter */ - CMD_ID_SET_BSS_RLM_PARAM, /* ucCID */ - TRUE, /* fgSetQuery */ - FALSE, /* fgNeedResp */ - FALSE, /* fgIsOid */ - NULL, /* pfCmdDoneHandler */ - NULL, /* pfCmdTimeoutHandler */ - sizeof(CMD_SET_BSS_RLM_PARAM_T), /* u4SetQueryInfoLen */ - (PUINT_8) prCmdBody, /* pucInfoBuffer */ - NULL, /* pvSetQueryBuffer */ - 0 /* u4SetQueryBufferLen */ - ); - - ASSERT(rStatus == WLAN_STATUS_PENDING); - - cnmMemFree(prAdapter, prCmdBody); -} - -#if CFG_SUPPORT_AAA -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function should be invoked after judging successful association. -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmProcessAssocReq ( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb, - PUINT_8 pucIE, - UINT_16 u2IELength - ) -{ - P_BSS_INFO_T prBssInfo; - P_STA_RECORD_T prStaRec; - UINT_16 u2Offset; - P_IE_HT_CAP_T prHtCap; - - ASSERT(prAdapter); - ASSERT(prSwRfb); - ASSERT(pucIE); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - ASSERT(prStaRec); - if (!prStaRec) { - return; - } - ASSERT(prStaRec->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM); - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]; - - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - switch (IE_ID(pucIE)) { - case ELEM_ID_HT_CAP: - if (!RLM_NET_IS_11N(prBssInfo) || - IE_LEN(pucIE) != (sizeof(IE_HT_CAP_T) - 2)) { - break; - } - prHtCap = (P_IE_HT_CAP_T) pucIE; - prStaRec->ucMcsSet = prHtCap->rSupMcsSet.aucRxMcsBitmask[0]; - prStaRec->fgSupMcs32 = - (prHtCap->rSupMcsSet.aucRxMcsBitmask[32/8] & BIT(0)) ? - TRUE : FALSE; - - prStaRec->u2HtCapInfo = prHtCap->u2HtCapInfo; - prStaRec->ucAmpduParam = prHtCap->ucAmpduParam; - prStaRec->u2HtExtendedCap = prHtCap->u2HtExtendedCap; - prStaRec->u4TxBeamformingCap = prHtCap->u4TxBeamformingCap; - prStaRec->ucAselCap = prHtCap->ucAselCap; - break; - - default: - break; - } /* end of switch */ - } /* end of IE_FOR_EACH */ -} -#endif /* CFG_SUPPORT_AAA */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief It is for both STA and AP modes -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmBssInitForAPandIbss ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ) -{ - ASSERT(prAdapter); - ASSERT(prBssInfo); - -#if CFG_ENABLE_WIFI_DIRECT - if (prAdapter->fgIsP2PRegistered && - prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT) { - - rlmBssInitForAP(prAdapter, prBssInfo); - } -#endif -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief It is for both STA and AP modes -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmBssAborted ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ) -{ - ASSERT(prAdapter); - ASSERT(prBssInfo); - - rlmBssReset(prAdapter, prBssInfo); - - prBssInfo->fg40mBwAllowed = FALSE; - prBssInfo->fgAssoc40mBwAllowed = FALSE; - - /* Assume FW state is updated by CMD_ID_SET_BSS_INFO, so - * the sync CMD is not needed here. - */ -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief All RLM timers will also be stopped. -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -static VOID -rlmBssReset ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ) -{ - ASSERT(prAdapter); - ASSERT(prBssInfo); - - /* HT related parameters */ - prBssInfo->ucHtOpInfo1 = 0; /* RIFS disabled. 20MHz */ - prBssInfo->u2HtOpInfo2 = 0; - prBssInfo->u2HtOpInfo3 = 0; - - prBssInfo->eBssSCO = 0; - prBssInfo->fgErpProtectMode = 0; - prBssInfo->eHtProtectMode = 0; - prBssInfo->eGfOperationMode = 0; - prBssInfo->eRifsOperationMode = 0; - - /* OBSS related parameters */ - prBssInfo->auc2G_20mReqChnlList[0] = 0; - prBssInfo->auc2G_NonHtChnlList[0] = 0; - prBssInfo->auc2G_PriChnlList[0] = 0; - prBssInfo->auc2G_SecChnlList[0] = 0; - prBssInfo->auc5G_20mReqChnlList[0] = 0; - prBssInfo->auc5G_NonHtChnlList[0] = 0; - prBssInfo->auc5G_PriChnlList[0] = 0; - prBssInfo->auc5G_SecChnlList[0] = 0; - - /* All RLM timers will also be stopped */ - cnmTimerStopTimer(prAdapter, &prBssInfo->rObssScanTimer); - prBssInfo->u2ObssScanInterval = 0; - - prBssInfo->fgObssErpProtectMode = 0; /* GO only */ - prBssInfo->eObssHtProtectMode = 0; /* GO only */ - prBssInfo->eObssGfOperationMode = 0; /* GO only */ - prBssInfo->fgObssRifsOperationMode = 0; /* GO only */ - prBssInfo->fgObssActionForcedTo20M = 0; /* GO only */ - prBssInfo->fgObssBeaconForcedTo20M = 0; /* GO only */ -} - diff --git a/drivers/net/wireless/mt5931/mgmt/rlm_domain.c b/drivers/net/wireless/mt5931/mgmt/rlm_domain.c deleted file mode 100755 index b5f34388469b..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/rlm_domain.c +++ /dev/null @@ -1,681 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/rlm_domain.c#1 $ -*/ - -/*! \file "rlm_domain.c" - \brief - -*/ - - - -/* -** $Log: rlm_domain.c $ - * - * 11 10 2011 cm.chang - * NULL - * Modify debug message for XLOG - * - * 09 29 2011 cm.chang - * NULL - * Change the function prototype of rlmDomainGetChnlList() - * - * 09 23 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * Let channel number to zero if band is illegal - * - * 09 22 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * Exclude channel list with illegal band - * - * 09 15 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * Use defined country group to have a change to add new group - * - * 09 08 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * Use new fields ucChannelListMap and ucChannelListIndex in NVRAM - * - * 08 31 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * . - * - * 06 01 2011 cm.chang - * [WCXRP00000756] [MT6620 Wi-Fi][Driver] 1. AIS follow channel of BOW 2. Provide legal channel function - * Provide legal channel function based on domain - * - * 03 19 2011 yuche.tsai - * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct. - * Add beacon timeout support for WiFi Direct Network. - * - * 03 02 2011 terry.wu - * [WCXRP00000505] [MT6620 Wi-Fi][Driver/FW] WiFi Direct Integration - * Export rlmDomainGetDomainInfo for p2p driver. - * - * 01 12 2011 cm.chang - * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting - * User-defined bandwidth is for 2.4G and 5G individually - * - * 12 07 2010 cm.chang - * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant - * 1. Country code is from NVRAM or supplicant - * 2. Change band definition in CMD/EVENT. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Check draft RLM code for HT cap - * - * 03 25 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Filter out not supported RF freq when reporting available chnl list - * - * 01 22 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support protection and bandwidth switch - * - * 01 13 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Provide query function about full channle list. - * - * Dec 1 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * - * -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/* The following country or domain shall be set from host driver. - * And host driver should pass specified DOMAIN_INFO_ENTRY to MT6620 as - * the channel list of being a STA to do scanning/searching AP or being an - * AP to choose an adequate channel if auto-channel is set. - */ - -/* Define mapping tables between country code and its channel set - */ -static const UINT_16 g_u2CountryGroup0[] = -{ - COUNTRY_CODE_US, COUNTRY_CODE_BS, COUNTRY_CODE_BB, COUNTRY_CODE_BO, COUNTRY_CODE_DM, - COUNTRY_CODE_DO, COUNTRY_CODE_HT, COUNTRY_CODE_PR, COUNTRY_CODE_TH, COUNTRY_CODE_TW, - COUNTRY_CODE_AI, COUNTRY_CODE_AG, COUNTRY_CODE_AW, COUNTRY_CODE_BM, COUNTRY_CODE_CU, - COUNTRY_CODE_GD, COUNTRY_CODE_GY, COUNTRY_CODE_JM, COUNTRY_CODE_KN, COUNTRY_CODE_LC, - COUNTRY_CODE_VC, COUNTRY_CODE_TT, COUNTRY_CODE_SR -}; -static const UINT_16 g_u2CountryGroup1[] = -{ - COUNTRY_CODE_BR, COUNTRY_CODE_EC, COUNTRY_CODE_HK, COUNTRY_CODE_MX, COUNTRY_CODE_PE, - COUNTRY_CODE_CR, COUNTRY_CODE_MD, COUNTRY_CODE_NI, COUNTRY_CODE_PZ -}; -static const UINT_16 g_u2CountryGroup2[] = {COUNTRY_CODE_CO, COUNTRY_CODE_PY}; -static const UINT_16 g_u2CountryGroup3[] = {COUNTRY_CODE_JP}; -static const UINT_16 g_u2CountryGroup4[] = -{ - COUNTRY_CODE_CN, COUNTRY_CODE_UY, COUNTRY_CODE_MA -}; -static const UINT_16 g_u2CountryGroup5[] = {COUNTRY_CODE_AR}; -static const UINT_16 g_u2CountryGroup6[] = {COUNTRY_CODE_AU, COUNTRY_CODE_NZ}; -static const UINT_16 g_u2CountryGroup7[] = {COUNTRY_CODE_RU}; -static const UINT_16 g_u2CountryGroup8[] = -{ - COUNTRY_CODE_ID, COUNTRY_CODE_HN, COUNTRY_CODE_PG, COUNTRY_CODE_PK -}; -static const UINT_16 g_u2CountryGroup9[] = {COUNTRY_CODE_CA}; -static const UINT_16 g_u2CountryGroup10[] = -{ - COUNTRY_CODE_CL, COUNTRY_CODE_IN, COUNTRY_CODE_SA, COUNTRY_CODE_SG, COUNTRY_CODE_VE, - COUNTRY_CODE_MY, COUNTRY_CODE_VN, COUNTRY_CODE_EG -}; -static const UINT_16 g_u2CountryGroup11[] = {COUNTRY_CODE_IL, COUNTRY_CODE_UA}; -static const UINT_16 g_u2CountryGroup12[] = {COUNTRY_CODE_JO, COUNTRY_CODE_KW}; -static const UINT_16 g_u2CountryGroup13[] = {COUNTRY_CODE_KR, COUNTRY_CODE_OM}; -static const UINT_16 g_u2CountryGroup14[] = -{ - COUNTRY_CODE_EU - /* When country code is not found, this domain info will be used. - * So mark all country codes to reduce search time. 20110908 - */ - /*, COUNTRY_CODE_PH, COUNTRY_CODE_TR, COUNTRY_CODE_IR, COUNTRY_CODE_BY, - COUNTRY_CODE_LK */ -}; - - -DOMAIN_INFO_ENTRY arSupportedRegDomains[] = { - { - (PUINT_16) g_u2CountryGroup0, sizeof(g_u2CountryGroup0) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 11, FALSE }, /* CH_SET_2G4_1_11 */ - - { 115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE }, /* CH_SET_UNII_LOW_36_48 */ - { 118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE }, /* CH_SET_UNII_MID_52_64 */ - { 121, BAND_5G, CHNL_SPAN_20, 100, 11, FALSE }, /* CH_SET_UNII_WW_100_140 */ - { 125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE }, /* CH_SET_UNII_UPPER_149_165 */ - { 0, BAND_NULL, 0, 0, 0, FALSE } - } - }, - { - (PUINT_16) g_u2CountryGroup1, sizeof(g_u2CountryGroup1) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE }, /* CH_SET_2G4_1_13 */ - - { 115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE }, /* CH_SET_UNII_LOW_36_48 */ - { 118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE }, /* CH_SET_UNII_MID_52_64 */ - { 121, BAND_5G, CHNL_SPAN_20, 100, 11, FALSE }, /* CH_SET_UNII_WW_100_140 */ - { 125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE }, /* CH_SET_UNII_UPPER_149_165 */ - { 0, BAND_NULL, 0, 0, 0, FALSE } - } - }, - { - (PUINT_16) g_u2CountryGroup2, sizeof(g_u2CountryGroup2) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE }, /* CH_SET_2G4_1_13 */ - - { 115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE }, /* CH_SET_UNII_LOW_36_48 */ - { 118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE }, /* CH_SET_UNII_MID_52_64 */ - { 121, BAND_5G, CHNL_SPAN_20, 100, 11, FALSE }, /* CH_SET_UNII_WW_100_140 */ - { 125, BAND_NULL, 0, 0, 0, FALSE }, /* CH_SET_UNII_UPPER_NA */ - { 0, BAND_NULL, 0, 0, 0, FALSE } - } - }, - { - (PUINT_16) g_u2CountryGroup3, sizeof(g_u2CountryGroup3) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE }, /* CH_SET_2G4_1_14 */ - { 82, BAND_2G4, CHNL_SPAN_5, 14, 1, FALSE }, - - { 115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE }, /* CH_SET_UNII_LOW_36_48 */ - { 118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE }, /* CH_SET_UNII_MID_52_64 */ - { 121, BAND_5G, CHNL_SPAN_20, 100, 11, FALSE }, /* CH_SET_UNII_WW_100_140 */ - { 125, BAND_NULL, 0, 0, 0, FALSE } /* CH_SET_UNII_UPPER_NA */ - } - }, - { - (PUINT_16) g_u2CountryGroup4, sizeof(g_u2CountryGroup4) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE }, /* CH_SET_2G4_1_13 */ - - { 115, BAND_NULL, 0, 0, 0, FALSE }, /* CH_SET_UNII_LOW_NA */ - { 118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE }, /* CH_SET_UNII_MID_52_64 */ - { 121, BAND_5G, CHNL_SPAN_20, 100, 11, FALSE }, /* CH_SET_UNII_WW_100_140 */ - { 125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE }, /* CH_SET_UNII_UPPER_149_165 */ - { 0, BAND_NULL, 0, 0, 0, FALSE } - } - }, - { - (PUINT_16) g_u2CountryGroup5, sizeof(g_u2CountryGroup5) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE }, /* CH_SET_2G4_1_13 */ - - { 115, BAND_NULL, 0, 0, 0, FALSE }, /* CH_SET_UNII_LOW_NA */ - { 118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE }, /* CH_SET_UNII_MID_52_64 */ - { 121, BAND_NULL, 0, 0, 0, FALSE }, /* CH_SET_UNII_WW_NA */ - { 125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE }, /* CH_SET_UNII_UPPER_149_165 */ - { 0, BAND_NULL, 0, 0, 0, FALSE } - } - }, - { - (PUINT_16) g_u2CountryGroup6, sizeof(g_u2CountryGroup6) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 11, FALSE }, /* CH_SET_2G4_1_11 */ - - { 115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE }, /* CH_SET_UNII_LOW_36_48 */ - { 118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE }, /* CH_SET_UNII_MID_52_64 */ - { 121, BAND_5G, CHNL_SPAN_20, 100, 11, FALSE }, /* CH_SET_UNII_WW_100_140 */ - { 125, BAND_5G, CHNL_SPAN_20, 149, 4, FALSE }, /* CH_SET_UNII_UPPER_149_161 */ - { 0, BAND_NULL, 0, 0, 0, FALSE } - } - }, - { - (PUINT_16) g_u2CountryGroup7, sizeof(g_u2CountryGroup7) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE }, /* CH_SET_2G4_1_13 */ - - { 115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE }, /* CH_SET_UNII_LOW_36_48 */ - { 118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE }, /* CH_SET_UNII_MID_52_64 */ - { 121, BAND_5G, CHNL_SPAN_20, 100, 11, FALSE }, /* CH_SET_UNII_WW_100_140 */ - { 125, BAND_5G, CHNL_SPAN_20, 149, 4, FALSE }, /* CH_SET_UNII_UPPER_149_161 */ - { 0, BAND_NULL, 0, 0, 0, FALSE } - } - }, - { - (PUINT_16) g_u2CountryGroup8, sizeof(g_u2CountryGroup8) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE }, /* CH_SET_2G4_1_13 */ - - { 115, BAND_NULL, 0, 0, 0, FALSE }, /* CH_SET_UNII_LOW_NA */ - { 118, BAND_NULL, 0, 0, 0, FALSE }, /* CH_SET_UNII_MID_NA */ - { 121, BAND_NULL, 0, 0, 0, FALSE }, /* CH_SET_UNII_WW_NA */ - { 125, BAND_5G, CHNL_SPAN_20, 149, 4, FALSE }, /* CH_SET_UNII_UPPER_149_161 */ - { 0, BAND_NULL, 0, 0, 0, FALSE } - } - }, - { - (PUINT_16) g_u2CountryGroup9, sizeof(g_u2CountryGroup9) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 11, FALSE }, /* CH_SET_2G4_1_11 */ - - { 115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE }, /* CH_SET_UNII_LOW_36_48 */ - { 118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE }, /* CH_SET_UNII_MID_52_64 */ - { 121, BAND_5G, CHNL_SPAN_20, 100, 5, FALSE }, /* CH_SET_UNII_WW_100_116_132_140 */ - { 121, BAND_5G, CHNL_SPAN_20, 132, 5, FALSE }, - { 125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE }, /* CH_SET_UNII_UPPER_149_165 */ - } - }, - { - (PUINT_16) g_u2CountryGroup10, sizeof(g_u2CountryGroup10) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE }, /* CH_SET_2G4_1_13 */ - - { 115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE }, /* CH_SET_UNII_LOW_36_48 */ - { 118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE }, /* CH_SET_UNII_MID_52_64 */ - { 121, BAND_NULL, 0, 0, 0, FALSE }, /* CH_SET_UNII_WW_NA */ - { 125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE }, /* CH_SET_UNII_UPPER_149_165 */ - { 0, BAND_NULL, 0, 0, 0, FALSE } - } - }, - { - (PUINT_16) g_u2CountryGroup11, sizeof(g_u2CountryGroup11) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE }, /* CH_SET_2G4_1_13 */ - - { 115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE }, /* CH_SET_UNII_LOW_36_48 */ - { 118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE }, /* CH_SET_UNII_MID_52_64 */ - { 121, BAND_NULL, 0, 0, 0, FALSE }, /* CH_SET_UNII_WW_NA */ - { 125, BAND_NULL, 0, 0, 0, FALSE }, /* CH_SET_UNII_UPPER_NA */ - { 0, BAND_NULL, 0, 0, 0, FALSE } - } - }, - { - (PUINT_16) g_u2CountryGroup12, sizeof(g_u2CountryGroup12) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE }, /* CH_SET_2G4_1_13 */ - - { 115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE }, /* CH_SET_UNII_LOW_36_48 */ - { 118, BAND_NULL, 0, 0, 0, FALSE }, /* CH_SET_UNII_MID_NA */ - { 121, BAND_NULL, 0, 0, 0, FALSE }, /* CH_SET_UNII_WW_NA */ - { 125, BAND_NULL, 0, 0, 0, FALSE }, /* CH_SET_UNII_UPPER_NA */ - { 0, BAND_NULL, 0, 0, 0, FALSE } - } - }, - { - (PUINT_16) g_u2CountryGroup13, sizeof(g_u2CountryGroup13) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE }, /* CH_SET_2G4_1_13 */ - - { 115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE }, /* CH_SET_UNII_LOW_36_48 */ - { 118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE }, /* CH_SET_UNII_MID_52_64 */ - { 121, BAND_5G, CHNL_SPAN_20, 100, 8, FALSE }, /* CH_SET_UNII_WW_100_128 */ - { 125, BAND_5G, CHNL_SPAN_20, 149, 5, FALSE }, /* CH_SET_UNII_UPPER_149_165 */ - { 0, BAND_NULL, 0, 0, 0, FALSE } - } - }, - { - /* Note: The final one is for Europe union now. */ - (PUINT_16) g_u2CountryGroup14, sizeof(g_u2CountryGroup14) / 2, - { - { 81, BAND_2G4, CHNL_SPAN_5, 1, 13, FALSE }, /* CH_SET_2G4_1_13 */ - - { 115, BAND_5G, CHNL_SPAN_20, 36, 4, FALSE }, /* CH_SET_UNII_LOW_36_48 */ - { 118, BAND_5G, CHNL_SPAN_20, 52, 4, FALSE }, /* CH_SET_UNII_MID_52_64 */ - { 121, BAND_5G, CHNL_SPAN_20, 100, 11, FALSE }, /* CH_SET_UNII_WW_100_140 */ - { 125, BAND_5G, CHNL_SPAN_20, 149, 7, FALSE }, /* CH_SET_UNII_UPPER_149_173 */ - { 0, BAND_NULL, 0, 0, 0, FALSE } - } - } -}; - -#if 0 -COUNTRY_CH_SET_T arCountryChSets[] = { - /* idx=0: US, Bahamas, Barbados, Bolivia(Voluntary), Dominica (the Commonwealth of Dominica), - The Dominican Republic, Haiti */ - {CH_SET_2G4_1_11, CH_SET_UNII_LOW_36_48, CH_SET_UNII_MID_52_64, - CH_SET_UNII_WW_100_140, CH_SET_UNII_UPPER_149_165}, - /* idx=1: Brazil, Ecuador, Hong Kong, Mexico, Peru */ - {CH_SET_2G4_1_13, CH_SET_UNII_LOW_36_48, CH_SET_UNII_MID_52_64, - CH_SET_UNII_WW_100_140, CH_SET_UNII_UPPER_149_165}, - /* idx=2: JP1, Colombia(Voluntary), Paraguay */ - {CH_SET_2G4_1_13, CH_SET_UNII_LOW_36_48, CH_SET_UNII_MID_52_64, - CH_SET_UNII_WW_100_140, CH_SET_UNII_UPPER_NA}, - /* idx=3: JP2 */ - {CH_SET_2G4_1_14, CH_SET_UNII_LOW_36_48, CH_SET_UNII_MID_52_64, - CH_SET_UNII_WW_100_140, CH_SET_UNII_UPPER_NA}, - /* idx=4: CN, Uruguay, Morocco */ - {CH_SET_2G4_1_13, CH_SET_UNII_LOW_NA, CH_SET_UNII_MID_NA, - CH_SET_UNII_WW_NA, CH_SET_UNII_UPPER_149_165}, - /* idx=5: Argentina */ - {CH_SET_2G4_1_13, CH_SET_UNII_LOW_NA, CH_SET_UNII_MID_52_64, - CH_SET_UNII_WW_NA, CH_SET_UNII_UPPER_149_165}, - /* idx=6: Australia, New Zealand */ - {CH_SET_2G4_1_11, CH_SET_UNII_LOW_36_48, CH_SET_UNII_MID_52_64, - CH_SET_UNII_WW_100_140, CH_SET_UNII_UPPER_149_161}, - /* idx=7: Russia */ - {CH_SET_2G4_1_13, CH_SET_UNII_LOW_36_48, CH_SET_UNII_MID_52_64, - CH_SET_UNII_WW_100_140, CH_SET_UNII_UPPER_149_161}, - /* idx=8: Indonesia */ - {CH_SET_2G4_1_13, CH_SET_UNII_LOW_NA, CH_SET_UNII_MID_NA, - CH_SET_UNII_WW_NA, CH_SET_UNII_UPPER_149_161}, - /* idx=9: Canada */ - {CH_SET_2G4_1_11, CH_SET_UNII_LOW_36_48, CH_SET_UNII_MID_52_64, - CH_SET_UNII_WW_100_116_132_140, CH_SET_UNII_UPPER_149_165}, - /* idx=10: Chile, India, Saudi Arabia, Singapore */ - {CH_SET_2G4_1_13, CH_SET_UNII_LOW_36_48, CH_SET_UNII_MID_52_64, - CH_SET_UNII_WW_NA, CH_SET_UNII_UPPER_149_165}, - /* idx=11: Israel, Ukraine */ - {CH_SET_2G4_1_13, CH_SET_UNII_LOW_36_48, CH_SET_UNII_MID_52_64, - CH_SET_UNII_WW_NA, CH_SET_UNII_UPPER_NA}, - /* idx=12: Jordan, Kuwait */ - {CH_SET_2G4_1_13, CH_SET_UNII_LOW_36_48, CH_SET_UNII_MID_NA, - CH_SET_UNII_WW_NA, CH_SET_UNII_UPPER_NA}, - /* idx=13: South Korea */ - {CH_SET_2G4_1_13, CH_SET_UNII_LOW_36_48, CH_SET_UNII_MID_52_64, - CH_SET_UNII_WW_100_128, CH_SET_UNII_UPPER_149_165}, - /* idx=14: Taiwan */ - {CH_SET_2G4_1_11, CH_SET_UNII_LOW_NA, CH_SET_UNII_MID_52_64, - CH_SET_UNII_WW_100_140, CH_SET_UNII_UPPER_149_165}, - /* idx=15: EU all countries */ - {CH_SET_2G4_1_13, CH_SET_UNII_LOW_36_48, CH_SET_UNII_MID_52_64, - CH_SET_UNII_WW_100_140, CH_SET_UNII_UPPER_149_173} -}; -#endif - - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in/out] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -P_DOMAIN_INFO_ENTRY -rlmDomainGetDomainInfo ( - P_ADAPTER_T prAdapter - ) -{ -#define REG_DOMAIN_DEF_IDX 14 /* EU (Europe Union) */ -#define REG_DOMAIN_GROUP_NUM \ - (sizeof(arSupportedRegDomains) / sizeof(DOMAIN_INFO_ENTRY)) - - UINT_16 i, j; - P_DOMAIN_INFO_ENTRY prDomainInfo; - P_REG_INFO_T prRegInfo; - UINT_16 u2TargetCountryCode; - - ASSERT(prAdapter); - - if (prAdapter->prDomainInfo) { - return prAdapter->prDomainInfo; - } - - prRegInfo = &prAdapter->prGlueInfo->rRegInfo; - - DBGLOG(RLM, INFO, ("Domain: map=%d, idx=%d, code=0x%04x\n", - prRegInfo->eRegChannelListMap, prRegInfo->ucRegChannelListIndex, - prAdapter->rWifiVar.rConnSettings.u2CountryCode)); - - if (prRegInfo->eRegChannelListMap == REG_CH_MAP_TBL_IDX && - prRegInfo->ucRegChannelListIndex < REG_DOMAIN_GROUP_NUM) { - prDomainInfo = &arSupportedRegDomains[prRegInfo->ucRegChannelListIndex]; - goto L_set_domain_info; - } - else if (prRegInfo->eRegChannelListMap == REG_CH_MAP_CUSTOMIZED) { - prDomainInfo = &prRegInfo->rDomainInfo; - goto L_set_domain_info; - } - - u2TargetCountryCode = prAdapter->rWifiVar.rConnSettings.u2CountryCode; - - /* If no matched country code, the final one will be used - * The final one is for Europe union now. - */ - for (i = 0; i < REG_DOMAIN_GROUP_NUM; i++) { - prDomainInfo = &arSupportedRegDomains[i]; - - ASSERT((prDomainInfo->u4CountryNum && prDomainInfo->pu2CountryGroup) || - prDomainInfo->u4CountryNum == 0); - - for (j = 0; j < prDomainInfo->u4CountryNum; j++) { - if (prDomainInfo->pu2CountryGroup[j] == u2TargetCountryCode) { - break; - } - } - if (j < prDomainInfo->u4CountryNum) { - break; /* Found */ - } - } - - DATA_STRUC_INSPECTING_ASSERT(REG_DOMAIN_DEF_IDX < REG_DOMAIN_GROUP_NUM); - - if (i >= REG_DOMAIN_GROUP_NUM) { - prDomainInfo = &arSupportedRegDomains[REG_DOMAIN_DEF_IDX]; - } - -L_set_domain_info: - - prAdapter->prDomainInfo = prDomainInfo; - return prDomainInfo; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in/out] The input variable pointed by pucNumOfChannel is the max -* arrary size. The return value indciates meaning list size. -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmDomainGetChnlList ( - P_ADAPTER_T prAdapter, - ENUM_BAND_T eSpecificBand, - UINT_8 ucMaxChannelNum, - PUINT_8 pucNumOfChannel, - P_RF_CHANNEL_INFO_T paucChannelList - ) -{ - UINT_8 i, j, ucNum; - P_DOMAIN_SUBBAND_INFO prSubband; - P_DOMAIN_INFO_ENTRY prDomainInfo; - - ASSERT(prAdapter); - ASSERT(paucChannelList); - ASSERT(pucNumOfChannel); - - /* If no matched country code, the final one will be used */ - prDomainInfo = rlmDomainGetDomainInfo(prAdapter); - ASSERT(prDomainInfo); - - ucNum = 0; - for (i = 0; i < MAX_SUBBAND_NUM; i++) { - prSubband = &prDomainInfo->rSubBand[i]; - - if (prSubband->ucBand == BAND_NULL || prSubband->ucBand >= BAND_NUM || - (prSubband->ucBand == BAND_5G && !prAdapter->fgEnable5GBand)) { - continue; - } - - if (eSpecificBand == BAND_NULL || prSubband->ucBand == eSpecificBand) { - for (j = 0; j < prSubband->ucNumChannels; j++) { - if (ucNum >= ucMaxChannelNum) { - break; - } - paucChannelList[ucNum].eBand = prSubband->ucBand; - paucChannelList[ucNum].ucChannelNum = - prSubband->ucFirstChannelNum + j * prSubband->ucChannelSpan; - ucNum++; - } - } - } - - *pucNumOfChannel = ucNum; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief -* -* @param[in] -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmDomainSendCmd ( - P_ADAPTER_T prAdapter, - BOOLEAN fgIsOid - ) -{ - P_DOMAIN_INFO_ENTRY prDomainInfo; - P_CMD_SET_DOMAIN_INFO_T prCmd; - WLAN_STATUS rStatus; - UINT_8 i; - P_DOMAIN_SUBBAND_INFO prSubBand; - - prDomainInfo = rlmDomainGetDomainInfo(prAdapter); - ASSERT(prDomainInfo); - - prCmd = cnmMemAlloc(prAdapter, RAM_TYPE_BUF, sizeof(CMD_SET_DOMAIN_INFO_T)); - ASSERT(prCmd); - - /* To do: exception handle */ - if (!prCmd) { - DBGLOG(RLM, ERROR, ("Domain: no buf to send cmd\n")); - return; - } - kalMemZero(prCmd, sizeof(CMD_SET_DOMAIN_INFO_T)); - - prCmd->u2CountryCode = prAdapter->rWifiVar.rConnSettings.u2CountryCode; - prCmd->u2Reserved = 0; - prCmd->uc2G4Bandwidth = - prAdapter->rWifiVar.rConnSettings.uc2G4BandwidthMode; - prCmd->uc5GBandwidth = - prAdapter->rWifiVar.rConnSettings.uc5GBandwidthMode; - - for (i = 0; i < 6; i++) { - prSubBand = &prDomainInfo->rSubBand[i]; - - prCmd->rSubBand[i].ucRegClass = prSubBand->ucRegClass; - prCmd->rSubBand[i].ucBand = prSubBand->ucBand; - - if (prSubBand->ucBand != BAND_NULL && prSubBand->ucBand < BAND_NUM) { - prCmd->rSubBand[i].ucChannelSpan = prSubBand->ucChannelSpan; - prCmd->rSubBand[i].ucFirstChannelNum = prSubBand->ucFirstChannelNum; - prCmd->rSubBand[i].ucNumChannels = prSubBand->ucNumChannels; - } - } - - /* Update domain info to chip */ - rStatus = wlanSendSetQueryCmd ( - prAdapter, /* prAdapter */ - CMD_ID_SET_DOMAIN_INFO, /* ucCID */ - TRUE, /* fgSetQuery */ - FALSE, /* fgNeedResp */ - fgIsOid, /* fgIsOid */ - NULL, /* pfCmdDoneHandler*/ - NULL, /* pfCmdTimeoutHandler */ - sizeof(CMD_SET_DOMAIN_INFO_T), /* u4SetQueryInfoLen */ - (PUINT_8) prCmd, /* pucInfoBuffer */ - NULL, /* pvSetQueryBuffer */ - 0 /* u4SetQueryBufferLen */ - ); - - ASSERT(rStatus == WLAN_STATUS_PENDING); - - cnmMemFree(prAdapter, prCmd); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in/out] -* -* \return TRUE Legal channel -* FALSE Illegal channel for current regulatory domain -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rlmDomainIsLegalChannel ( - P_ADAPTER_T prAdapter, - ENUM_BAND_T eBand, - UINT_8 ucChannel - ) -{ - UINT_8 i, j; - P_DOMAIN_SUBBAND_INFO prSubband; - P_DOMAIN_INFO_ENTRY prDomainInfo; - - prDomainInfo = rlmDomainGetDomainInfo(prAdapter); - ASSERT(prDomainInfo); - - for (i = 0; i < MAX_SUBBAND_NUM; i++) { - prSubband = &prDomainInfo->rSubBand[i]; - - if (prSubband->ucBand == BAND_5G && !prAdapter->fgEnable5GBand) { - continue; - } - - if (prSubband->ucBand == eBand) { - for (j = 0; j < prSubband->ucNumChannels; j++) { - if ((prSubband->ucFirstChannelNum + j*prSubband->ucChannelSpan) - == ucChannel) { - return TRUE; - } - } - } - } - - return FALSE; -} - diff --git a/drivers/net/wireless/mt5931/mgmt/rlm_obss.c b/drivers/net/wireless/mt5931/mgmt/rlm_obss.c deleted file mode 100755 index 143d72104a24..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/rlm_obss.c +++ /dev/null @@ -1,461 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/rlm_obss.c#2 $ -*/ - -/*! \file "rlm_obss.c" - \brief - -*/ - - - -/* -** $Log: rlm_obss.c $ - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 11 15 2011 cm.chang - * NULL - * Avoid possible OBSS scan when BSS is switched - * - * 11 08 2011 cm.chang - * NULL - * Add RLM and CNM debug message for XLOG - * - * 10 25 2011 cm.chang - * [WCXRP00001058] [All Wi-Fi][Driver] Fix sta_rec's phyTypeSet and OBSS scan in AP mode - * Regulation class is changed to 81 in 20_40_coexistence action frame - * - * 04 12 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * . - * - * 03 29 2011 cm.chang - * [WCXRP00000606] [MT6620 Wi-Fi][Driver][FW] Fix klocwork warning - * As CR title - * - * 01 24 2011 cm.chang - * [WCXRP00000384] [MT6620 Wi-Fi][Driver][FW] Handle 20/40 action frame in AP mode and stop ampdu timer when sta_rec is freed - * Process received 20/40 coexistence action frame for AP mode - * - * 01 13 2011 cm.chang - * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module - * Refine function when rcv a 20/40M public action frame - * - * 01 13 2011 cm.chang - * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting - * Use SCO of BSS_INFO to replace user-defined setting variables - * - * 01 12 2011 cm.chang - * [WCXRP00000354] [MT6620 Wi-Fi][Driver][FW] Follow NVRAM bandwidth setting - * User-defined bandwidth is for 2.4G and 5G individually - * - * 10 18 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * use definition macro to replace hard-coded constant - * - * 09 16 2010 cm.chang - * NULL - * Change conditional compiling options for BOW - * - * 09 10 2010 cm.chang - * NULL - * Always update Beacon content if FW sync OBSS info - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 08 20 2010 cm.chang - * NULL - * Migrate RLM code to host from FW - * - * 07 26 2010 yuche.tsai - * - * Fix compile error while enabling WiFi Direct function. - * - * 07 21 2010 yuche.tsai - * - * Add P2P Scan & Scan Result Parsing & Saving. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Check draft RLM code for HT cap - * - * 05 07 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Process 20/40 coexistence public action frame in AP mode - * - * 05 05 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * First draft support for 20/40M bandwidth for AP mode - * - * 04 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW - * - * 04 13 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add more ASSERT to check exception - * - * 04 07 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add virtual test for OBSS scan - * - * 03 30 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support 2.4G OBSS scan - * - * 03 03 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * To support CFG_SUPPORT_BCM_STP - * - * 02 13 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support PCO in STA mode - * - * 02 12 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Use bss info array for concurrent handle - * - * 02 05 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * 01 25 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support protection and bandwidth switch -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -static VOID -rlmObssScanTimeout ( - P_ADAPTER_T prAdapter, - UINT_32 u4Data - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmObssInit ( - P_ADAPTER_T prAdapter - ) -{ - P_BSS_INFO_T prBssInfo; - UINT_8 ucNetIdx; - - RLM_NET_FOR_EACH(ucNetIdx) { - prBssInfo = &prAdapter->rWifiVar.arBssInfo[ucNetIdx]; - ASSERT(prBssInfo); - - cnmTimerInitTimer(prAdapter, &prBssInfo->rObssScanTimer, - rlmObssScanTimeout, (UINT_32) prBssInfo); - } /* end of RLM_NET_FOR_EACH */ -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rlmObssUpdateChnlLists ( - P_ADAPTER_T prAdapter, - P_SW_RFB_T prSwRfb - ) -{ - return TRUE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmObssScanDone ( - P_ADAPTER_T prAdapter, - P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_SCN_SCAN_DONE prScanDoneMsg; - P_BSS_INFO_T prBssInfo; - P_MSDU_INFO_T prMsduInfo; - P_ACTION_20_40_COEXIST_FRAME prTxFrame; - UINT_16 i, u2PayloadLen; - - ASSERT(prMsgHdr); - - prScanDoneMsg = (P_MSG_SCN_SCAN_DONE) prMsgHdr; - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prScanDoneMsg->ucNetTypeIndex]; - ASSERT(prBssInfo); - - DBGLOG(RLM, INFO, ("OBSS Scan Done (NetIdx=%d, Mode=%d)\n", - prScanDoneMsg->ucNetTypeIndex, prBssInfo->eCurrentOPMode)); - - cnmMemFree(prAdapter, prMsgHdr); - -#if CFG_ENABLE_WIFI_DIRECT - /* AP mode */ - if ((prAdapter->fgIsP2PRegistered) && - (IS_NET_ACTIVE(prAdapter, prBssInfo->ucNetTypeIndex)) && - (prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT)) { - return; - } -#endif - - /* STA mode */ - if (prBssInfo->eCurrentOPMode != OP_MODE_INFRASTRUCTURE || - !RLM_NET_PARAM_VALID(prBssInfo) || prBssInfo->u2ObssScanInterval == 0) { - DBGLOG(RLM, WARN, ("OBSS Scan Done (NetIdx=%d) -- Aborted!!\n", - prBssInfo->ucNetTypeIndex)); - return; - } - - /* To do: check 2.4G channel list to decide if obss mgmt should be - * sent to associated AP. Note: how to handle concurrent network? - * To do: invoke rlmObssChnlLevel() to decide if 20/40 BSS coexistence - * management frame is needed. - */ - if ((prBssInfo->auc2G_20mReqChnlList[0] > 0 || - prBssInfo->auc2G_NonHtChnlList[0] > 0) && - (prMsduInfo = (P_MSDU_INFO_T) cnmMgtPktAlloc(prAdapter, - MAC_TX_RESERVED_FIELD + PUBLIC_ACTION_MAX_LEN)) != NULL) { - - DBGLOG(RLM, INFO, ("Send 20/40 coexistence mgmt(20mReq=%d, NonHt=%d)\n", - prBssInfo->auc2G_20mReqChnlList[0], - prBssInfo->auc2G_NonHtChnlList[0])); - - prTxFrame = (P_ACTION_20_40_COEXIST_FRAME) - ((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD); - - prTxFrame->u2FrameCtrl = MAC_FRAME_ACTION; - COPY_MAC_ADDR(prTxFrame->aucDestAddr, prBssInfo->aucBSSID); - COPY_MAC_ADDR(prTxFrame->aucSrcAddr, prBssInfo->aucOwnMacAddr); - COPY_MAC_ADDR(prTxFrame->aucBSSID, prBssInfo->aucBSSID); - - prTxFrame->ucCategory = CATEGORY_PUBLIC_ACTION; - prTxFrame->ucAction = ACTION_PUBLIC_20_40_COEXIST; - - /* To do: find correct algorithm */ - prTxFrame->rBssCoexist.ucId = ELEM_ID_20_40_BSS_COEXISTENCE; - prTxFrame->rBssCoexist.ucLength = 1; - prTxFrame->rBssCoexist.ucData = - (prBssInfo->auc2G_20mReqChnlList[0] > 0) ? BSS_COEXIST_20M_REQ : 0; - - u2PayloadLen = 2 + 3; - - if (prBssInfo->auc2G_NonHtChnlList[0] > 0) { - ASSERT(prBssInfo->auc2G_NonHtChnlList[0] <= CHNL_LIST_SZ_2G); - - prTxFrame->rChnlReport.ucId = ELEM_ID_20_40_INTOLERANT_CHNL_REPORT; - prTxFrame->rChnlReport.ucLength = - prBssInfo->auc2G_NonHtChnlList[0] + 1; - prTxFrame->rChnlReport.ucRegulatoryClass = 81; /* 2.4GHz, ch1~13 */ - for (i = 0; i < prBssInfo->auc2G_NonHtChnlList[0] && - i < CHNL_LIST_SZ_2G; i++) { - prTxFrame->rChnlReport.aucChannelList[i] = - prBssInfo->auc2G_NonHtChnlList[i+1]; - } - - u2PayloadLen += IE_SIZE(&prTxFrame->rChnlReport); - } - ASSERT((WLAN_MAC_HEADER_LEN + u2PayloadLen) <= PUBLIC_ACTION_MAX_LEN); - - /* Clear up channel lists in 2.4G band */ - prBssInfo->auc2G_20mReqChnlList[0] = 0; - prBssInfo->auc2G_NonHtChnlList[0] = 0; - - - //4 Update information of MSDU_INFO_T - prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_MGMT; /* Management frame */ - prMsduInfo->ucStaRecIndex = prBssInfo->prStaRecOfAP->ucIndex; - prMsduInfo->ucNetworkType = prBssInfo->ucNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_MGMT_HEADER_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = WLAN_MAC_MGMT_HEADER_LEN + u2PayloadLen; - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = NULL; - prMsduInfo->fgIsBasicRate = FALSE; - - //4 Enqueue the frame to send this action frame. - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - } /* end of prMsduInfo != NULL */ - - if (prBssInfo->u2ObssScanInterval > 0) { - DBGLOG(RLM, INFO, ("Set OBSS timer (NetIdx=%d, %d sec)\n", - prBssInfo->ucNetTypeIndex, prBssInfo->u2ObssScanInterval)); - - cnmTimerStartTimer(prAdapter, &prBssInfo->rObssScanTimer, - prBssInfo->u2ObssScanInterval * MSEC_PER_SEC); - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -static VOID -rlmObssScanTimeout ( - P_ADAPTER_T prAdapter, - UINT_32 u4Data - ) -{ - P_BSS_INFO_T prBssInfo; - - prBssInfo = (P_BSS_INFO_T) u4Data; - ASSERT(prBssInfo); - -#if CFG_ENABLE_WIFI_DIRECT - /* AP mode */ - if (prAdapter->fgIsP2PRegistered && - (IS_NET_ACTIVE(prAdapter, prBssInfo->ucNetTypeIndex)) && - (prBssInfo->eCurrentOPMode == OP_MODE_ACCESS_POINT)) { - - prBssInfo->fgObssActionForcedTo20M = FALSE; - - /* Check if Beacon content need to be updated */ - rlmUpdateParamsForAP(prAdapter, prBssInfo, FALSE); - - return; - } -#endif /* end of CFG_ENABLE_WIFI_DIRECT */ - - - /* STA mode */ - if (prBssInfo->eCurrentOPMode != OP_MODE_INFRASTRUCTURE || - !RLM_NET_PARAM_VALID(prBssInfo) || prBssInfo->u2ObssScanInterval == 0) { - DBGLOG(RLM, WARN, ("OBSS Scan timeout (NetIdx=%d) -- Aborted!!\n", - prBssInfo->ucNetTypeIndex)); - return; - } - - rlmObssTriggerScan(prAdapter, prBssInfo); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rlmObssTriggerScan ( - P_ADAPTER_T prAdapter, - P_BSS_INFO_T prBssInfo - ) -{ - P_MSG_SCN_SCAN_REQ prScanReqMsg; - - ASSERT(prBssInfo); - - prScanReqMsg = (P_MSG_SCN_SCAN_REQ) - cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_SCN_SCAN_REQ)); - ASSERT(prScanReqMsg); - - if (!prScanReqMsg) { - DBGLOG(RLM, WARN, ("No buf for OBSS scan (NetIdx=%d)!!\n", - prBssInfo->ucNetTypeIndex)); - - cnmTimerStartTimer(prAdapter, &prBssInfo->rObssScanTimer, - prBssInfo->u2ObssScanInterval * MSEC_PER_SEC); - return; - } - - /* It is ok that ucSeqNum is set to fixed value because the same network - * OBSS scan interval is limited to OBSS_SCAN_MIN_INTERVAL (min 10 sec) - * and scan module don't care seqNum of OBSS scanning - */ - prScanReqMsg->rMsgHdr.eMsgId = MID_RLM_SCN_SCAN_REQ; - prScanReqMsg->ucSeqNum = 0x33; - prScanReqMsg->ucNetTypeIndex = prBssInfo->ucNetTypeIndex; - prScanReqMsg->eScanType = SCAN_TYPE_ACTIVE_SCAN; - prScanReqMsg->ucSSIDType = SCAN_REQ_SSID_WILDCARD; - prScanReqMsg->ucSSIDLength = 0; - prScanReqMsg->eScanChannel = SCAN_CHANNEL_2G4; - prScanReqMsg->u2IELen = 0; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prScanReqMsg, - MSG_SEND_METHOD_BUF); - - DBGLOG(RLM, INFO, ("Timeout to trigger OBSS scan (NetIdx=%d)!!\n", - prBssInfo->ucNetTypeIndex)); -} - - diff --git a/drivers/net/wireless/mt5931/mgmt/rlm_protection.c b/drivers/net/wireless/mt5931/mgmt/rlm_protection.c deleted file mode 100755 index 27ffda023bf8..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/rlm_protection.c +++ /dev/null @@ -1,108 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/rlm_protection.c#1 $ -*/ - -/*! \file "rlm_protection.c" - \brief - -*/ - - - -/* -** $Log: rlm_protection.c $ - * - * 08 20 2010 cm.chang - * NULL - * Migrate RLM code to host from FW - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Check draft RLM code for HT cap - * - * 05 28 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Set RTS threshold of 2K bytes initially - * - * 04 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW - * - * 04 22 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * First draft code to support protection in AP mode - * - * 03 31 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Enable RTS threshold temporarily for AMPDU - * - * 03 16 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add AdHoc Mode - * - * 03 03 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * To support CFG_SUPPORT_BCM_STP - * - * 02 13 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support PCO in STA mode - * - * 02 12 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Use bss info array for concurrent handle - * - * 01 25 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support protection and bandwidth switch -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - diff --git a/drivers/net/wireless/mt5931/mgmt/roaming_fsm.c b/drivers/net/wireless/mt5931/mgmt/roaming_fsm.c deleted file mode 100755 index c941873eb8f3..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/roaming_fsm.c +++ /dev/null @@ -1,583 +0,0 @@ -/* -** $Id: -*/ - -/*! \file "roaming_fsm.c" - \brief This file defines the FSM for Roaming MODULE. - - This file defines the FSM for Roaming MODULE. -*/ - - - -/* -** $Log: roaming_fsm.c $ - * - * 11 24 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * Adjust code for DBG and CONFIG_XLOG. - * - * 11 11 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * modify the xlog related code. - * - * 11 02 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * adding the code for XLOG. - * - * 08 31 2011 tsaiyuan.hsu - * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver - * remove obsolete code. - * - * 08 15 2011 tsaiyuan.hsu - * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver - * add swcr in driver reg, 0x9fxx0000, to disable roaming . - * - * 03 16 2011 tsaiyuan.hsu - * [WCXRP00000517] [MT6620 Wi-Fi][Driver][FW] Fine Tune Performance of Roaming - * remove obsolete definition and unused variables. - * - * 02 26 2011 tsaiyuan.hsu - * [WCXRP00000391] [MT6620 Wi-Fi][FW] Add Roaming Support - * not send disassoc or deauth to leaving AP so as to improve performace of roaming. - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -#if CFG_SUPPORT_ROAMING -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -#if DBG -/*lint -save -e64 Type mismatch */ -static PUINT_8 apucDebugRoamingState[ROAMING_STATE_NUM] = { - (PUINT_8)DISP_STRING("ROAMING_STATE_IDLE"), - (PUINT_8)DISP_STRING("ROAMING_STATE_DECISION"), - (PUINT_8)DISP_STRING("ROAMING_STATE_DISCOVERY"), - (PUINT_8)DISP_STRING("ROAMING_STATE_ROAM") -}; -/*lint -restore */ -#endif /* DBG */ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -#define ROAMING_ENABLE_CHECK(_roam) \ - { \ - if (!(_roam->fgIsEnableRoaming)) {return;} \ - } - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Initialize the value in ROAMING_FSM_INFO_T for ROAMING FSM operation -* -* @param [IN P_ADAPTER_T] prAdapter -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -roamingFsmInit ( - IN P_ADAPTER_T prAdapter - ) -{ - P_ROAMING_INFO_T prRoamingFsmInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - - DBGLOG(ROAMING, LOUD, ("->roamingFsmInit(): Current Time = %ld\n", kalGetTimeTick())); - - prRoamingFsmInfo = (P_ROAMING_INFO_T)&(prAdapter->rWifiVar.rRoamingInfo); - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - //4 <1> Initiate FSM - prRoamingFsmInfo->fgIsEnableRoaming = prConnSettings->fgIsEnableRoaming; - prRoamingFsmInfo->eCurrentState = ROAMING_STATE_IDLE; - prRoamingFsmInfo->rRoamingDiscoveryUpdateTime = 0; - - return; -} /* end of roamingFsmInit() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Uninitialize the value in AIS_FSM_INFO_T for AIS FSM operation -* -* @param [IN P_ADAPTER_T] prAdapter -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -roamingFsmUninit ( - IN P_ADAPTER_T prAdapter - ) -{ - P_ROAMING_INFO_T prRoamingFsmInfo; - - DBGLOG(ROAMING, LOUD, ("->roamingFsmUninit(): Current Time = %ld\n", kalGetTimeTick())); - - prRoamingFsmInfo = (P_ROAMING_INFO_T)&(prAdapter->rWifiVar.rRoamingInfo); - - prRoamingFsmInfo->eCurrentState = ROAMING_STATE_IDLE; - - return; -} /* end of roamingFsmUninit() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Send commands to firmware -* -* @param [IN P_ADAPTER_T] prAdapter -* [IN P_ROAMING_PARAM_T] prParam -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -roamingFsmSendCmd ( - IN P_ADAPTER_T prAdapter, - IN P_ROAMING_PARAM_T prParam - ) -{ - P_ROAMING_INFO_T prRoamingFsmInfo; - WLAN_STATUS rStatus; - - DBGLOG(ROAMING, LOUD, ("->roamingFsmSendCmd(): Current Time = %ld\n", kalGetTimeTick())); - - prRoamingFsmInfo = (P_ROAMING_INFO_T)&(prAdapter->rWifiVar.rRoamingInfo); - - rStatus = wlanSendSetQueryCmd ( - prAdapter, /* prAdapter */ - CMD_ID_ROAMING_TRANSIT, /* ucCID */ - TRUE, /* fgSetQuery */ - FALSE, /* fgNeedResp */ - FALSE, /* fgIsOid */ - NULL, /* pfCmdDoneHandler */ - NULL, /* pfCmdTimeoutHandler */ - sizeof(ROAMING_PARAM_T), /* u4SetQueryInfoLen */ - (PUINT_8) prParam, /* pucInfoBuffer */ - NULL, /* pvSetQueryBuffer */ - 0 /* u4SetQueryBufferLen */ - ); - - ASSERT(rStatus == WLAN_STATUS_PENDING); - - return; -} /* end of roamingFsmSendCmd() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Update the recent time when ScanDone occurred -* -* @param [IN P_ADAPTER_T] prAdapter -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -roamingFsmScanResultsUpdate ( - IN P_ADAPTER_T prAdapter - ) -{ - P_ROAMING_INFO_T prRoamingFsmInfo; - - prRoamingFsmInfo = (P_ROAMING_INFO_T)&(prAdapter->rWifiVar.rRoamingInfo); - - /* Check Roaming Conditions */ - ROAMING_ENABLE_CHECK(prRoamingFsmInfo); - - DBGLOG(ROAMING, LOUD, ("->roamingFsmScanResultsUpdate(): Current Time = %ld\n", kalGetTimeTick())); - - GET_CURRENT_SYSTIME(&prRoamingFsmInfo->rRoamingDiscoveryUpdateTime); - - return; -} /* end of roamingFsmScanResultsUpdate() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief The Core FSM engine of ROAMING for AIS Infra. -* -* @param [IN P_ADAPTER_T] prAdapter -* [IN ENUM_ROAMING_STATE_T] eNextState Enum value of next AIS STATE -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -roamingFsmSteps ( - IN P_ADAPTER_T prAdapter, - IN ENUM_ROAMING_STATE_T eNextState - ) -{ - P_ROAMING_INFO_T prRoamingFsmInfo; - ENUM_ROAMING_STATE_T ePreviousState; - BOOLEAN fgIsTransition = (BOOLEAN)FALSE; - - prRoamingFsmInfo = (P_ROAMING_INFO_T)&(prAdapter->rWifiVar.rRoamingInfo); - - do { - - /* Do entering Next State */ -#if DBG - DBGLOG(ROAMING, STATE, ("TRANSITION: [%s] -> [%s]\n", - apucDebugRoamingState[prRoamingFsmInfo->eCurrentState], - apucDebugRoamingState[eNextState])); -#else - DBGLOG(ROAMING, STATE, ("[%d] TRANSITION: [%d] -> [%d]\n", - DBG_ROAMING_IDX, - prRoamingFsmInfo->eCurrentState, - eNextState)); -#endif - /* NOTE(Kevin): This is the only place to change the eCurrentState(except initial) */ - ePreviousState = prRoamingFsmInfo->eCurrentState; - prRoamingFsmInfo->eCurrentState = eNextState; - - fgIsTransition = (BOOLEAN)FALSE; - - /* Do tasks of the State that we just entered */ - switch (prRoamingFsmInfo->eCurrentState) { - /* NOTE(Kevin): we don't have to rearrange the sequence of following - * switch case. Instead I would like to use a common lookup table of array - * of function pointer to speed up state search. - */ - case ROAMING_STATE_IDLE: - case ROAMING_STATE_DECISION: - break; - - case ROAMING_STATE_DISCOVERY: - { - OS_SYSTIME rCurrentTime; - - GET_CURRENT_SYSTIME(&rCurrentTime); - if (CHECK_FOR_TIMEOUT(rCurrentTime, prRoamingFsmInfo->rRoamingDiscoveryUpdateTime, - SEC_TO_SYSTIME(ROAMING_DISCOVERY_TIMEOUT_SEC))) { - DBGLOG(ROAMING, LOUD, ("roamingFsmSteps: DiscoveryUpdateTime Timeout")); - aisFsmRunEventRoamingDiscovery(prAdapter, TRUE); - } - else { - DBGLOG(ROAMING, LOUD, ("roamingFsmSteps: DiscoveryUpdateTime Updated")); - aisFsmRunEventRoamingDiscovery(prAdapter, FALSE); - } - } - break; - - case ROAMING_STATE_ROAM: - break; - - default: - ASSERT(0); /* Make sure we have handle all STATEs */ - } - } - while (fgIsTransition); - - return; - -} /* end of roamingFsmSteps() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Transit to Decision state after join completion -* -* @param [IN P_ADAPTER_T] prAdapter -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -roamingFsmRunEventStart ( - IN P_ADAPTER_T prAdapter - ) -{ - P_ROAMING_INFO_T prRoamingFsmInfo; - ENUM_ROAMING_STATE_T eNextState; - P_BSS_INFO_T prAisBssInfo; - ROAMING_PARAM_T rParam; - - prRoamingFsmInfo = (P_ROAMING_INFO_T)&(prAdapter->rWifiVar.rRoamingInfo); - - /* Check Roaming Conditions */ - ROAMING_ENABLE_CHECK(prRoamingFsmInfo); - - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - if (prAisBssInfo->eCurrentOPMode != OP_MODE_INFRASTRUCTURE) { - return; - } - - DBGLOG(ROAMING, EVENT, ("EVENT-ROAMING START: Current Time = %ld\n", kalGetTimeTick())); - - /* IDLE, ROAM -> DECISION */ - /* Errors as DECISION, DISCOVERY -> DECISION */ - if (!(prRoamingFsmInfo->eCurrentState == ROAMING_STATE_IDLE - || prRoamingFsmInfo->eCurrentState == ROAMING_STATE_ROAM)) { - return; - } - - eNextState = ROAMING_STATE_DECISION; - if (eNextState != prRoamingFsmInfo->eCurrentState) { - rParam.u2Event = ROAMING_EVENT_START; - roamingFsmSendCmd(prAdapter, (P_ROAMING_PARAM_T) &rParam); - - /* Step to next state */ - roamingFsmSteps(prAdapter, eNextState); - } - - return; -} /* end of roamingFsmRunEventStart() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Transit to Discovery state when deciding to find a candidate -* -* @param [IN P_ADAPTER_T] prAdapter -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -roamingFsmRunEventDiscovery ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Param - ) -{ - P_ROAMING_INFO_T prRoamingFsmInfo; - ENUM_ROAMING_STATE_T eNextState; - - prRoamingFsmInfo = (P_ROAMING_INFO_T)&(prAdapter->rWifiVar.rRoamingInfo); - - /* Check Roaming Conditions */ - ROAMING_ENABLE_CHECK(prRoamingFsmInfo); - - DBGLOG(ROAMING, EVENT, ("EVENT-ROAMING DISCOVERY: Current Time = %ld\n", kalGetTimeTick())); - - /* DECISION -> DISCOVERY */ - /* Errors as IDLE, DISCOVERY, ROAM -> DISCOVERY */ - if (prRoamingFsmInfo->eCurrentState != ROAMING_STATE_DECISION) { - return; - } - - eNextState = ROAMING_STATE_DISCOVERY; - /* DECISION -> DISCOVERY */ - if (eNextState != prRoamingFsmInfo->eCurrentState) { - P_BSS_INFO_T prAisBssInfo; - P_BSS_DESC_T prBssDesc; - - // sync. rcpi with firmware - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - prBssDesc = scanSearchBssDescByBssid(prAdapter, prAisBssInfo->aucBSSID); - if (prBssDesc) { - prBssDesc->ucRCPI = (UINT_8)(u4Param&0xff); - } - - roamingFsmSteps(prAdapter, eNextState); - } - - return; -} /* end of roamingFsmRunEventDiscovery() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Transit to Roam state after Scan Done -* -* @param [IN P_ADAPTER_T] prAdapter -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -roamingFsmRunEventRoam ( - IN P_ADAPTER_T prAdapter - ) -{ - P_ROAMING_INFO_T prRoamingFsmInfo; - ENUM_ROAMING_STATE_T eNextState; - ROAMING_PARAM_T rParam; - - prRoamingFsmInfo = (P_ROAMING_INFO_T)&(prAdapter->rWifiVar.rRoamingInfo); - - /* Check Roaming Conditions */ - ROAMING_ENABLE_CHECK(prRoamingFsmInfo); - - DBGLOG(ROAMING, EVENT, ("EVENT-ROAMING ROAM: Current Time = %ld\n", kalGetTimeTick())); - - /* IDLE, ROAM -> DECISION */ - /* Errors as IDLE, DECISION, ROAM -> ROAM */ - if (prRoamingFsmInfo->eCurrentState != ROAMING_STATE_DISCOVERY) { - return; - } - - eNextState = ROAMING_STATE_ROAM; - /* DISCOVERY -> ROAM */ - if (eNextState != prRoamingFsmInfo->eCurrentState) { - rParam.u2Event = ROAMING_EVENT_ROAM; - roamingFsmSendCmd(prAdapter, (P_ROAMING_PARAM_T) &rParam); - - /* Step to next state */ - roamingFsmSteps(prAdapter, eNextState); - } - - return; -} /* end of roamingFsmRunEventRoam() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Transit to Decision state as being failed to find out any candidate -* -* @param [IN P_ADAPTER_T] prAdapter -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -roamingFsmRunEventFail ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Param - ) -{ - P_ROAMING_INFO_T prRoamingFsmInfo; - ENUM_ROAMING_STATE_T eNextState; - ROAMING_PARAM_T rParam; - - prRoamingFsmInfo = (P_ROAMING_INFO_T)&(prAdapter->rWifiVar.rRoamingInfo); - - /* Check Roaming Conditions */ - ROAMING_ENABLE_CHECK(prRoamingFsmInfo); - - DBGLOG(ROAMING, EVENT, ("EVENT-ROAMING FAIL: reason %x Current Time = %ld\n", u4Param, kalGetTimeTick())); - - /* IDLE, ROAM -> DECISION */ - /* Errors as IDLE, DECISION, DISCOVERY -> DECISION */ - if (prRoamingFsmInfo->eCurrentState != ROAMING_STATE_ROAM) { - return; - } - - eNextState = ROAMING_STATE_DECISION; - /* ROAM -> DECISION */ - if (eNextState != prRoamingFsmInfo->eCurrentState) { - rParam.u2Event = ROAMING_EVENT_FAIL; - rParam.u2Data = (UINT_16)(u4Param&0xffff); - roamingFsmSendCmd(prAdapter, (P_ROAMING_PARAM_T) &rParam); - - /* Step to next state */ - roamingFsmSteps(prAdapter, eNextState); - } - - return; -} /* end of roamingFsmRunEventFail() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Transit to Idle state as beging aborted by other moduels, AIS -* -* @param [IN P_ADAPTER_T] prAdapter -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -roamingFsmRunEventAbort ( - IN P_ADAPTER_T prAdapter - ) -{ - P_ROAMING_INFO_T prRoamingFsmInfo; - ENUM_ROAMING_STATE_T eNextState; - ROAMING_PARAM_T rParam; - - prRoamingFsmInfo = (P_ROAMING_INFO_T)&(prAdapter->rWifiVar.rRoamingInfo); - - ROAMING_ENABLE_CHECK(prRoamingFsmInfo); - - DBGLOG(ROAMING, EVENT, ("EVENT-ROAMING ABORT: Current Time = %ld\n", kalGetTimeTick())); - - eNextState = ROAMING_STATE_IDLE; - /* IDLE, DECISION, DISCOVERY, ROAM -> IDLE */ - if (eNextState != prRoamingFsmInfo->eCurrentState) { - rParam.u2Event = ROAMING_EVENT_ABORT; - roamingFsmSendCmd(prAdapter, (P_ROAMING_PARAM_T) &rParam); - - /* Step to next state */ - roamingFsmSteps(prAdapter, eNextState); - } - - return; -} /* end of roamingFsmRunEventAbort() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process events from firmware -* -* @param [IN P_ADAPTER_T] prAdapter -* [IN P_ROAMING_PARAM_T] prParam -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -roamingFsmProcessEvent ( - IN P_ADAPTER_T prAdapter, - IN P_ROAMING_PARAM_T prParam - ) -{ - DBGLOG(ROAMING, LOUD, ("ROAMING Process Events: Current Time = %ld\n", kalGetTimeTick())); - - if (ROAMING_EVENT_DISCOVERY == prParam->u2Event) { - roamingFsmRunEventDiscovery(prAdapter, prParam->u2Data); - } - - return WLAN_STATUS_SUCCESS; -} - -#endif diff --git a/drivers/net/wireless/mt5931/mgmt/rsn.c b/drivers/net/wireless/mt5931/mgmt/rsn.c deleted file mode 100755 index ea3e8a10e70a..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/rsn.c +++ /dev/null @@ -1,2617 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/rsn.c#2 $ -*/ - -/*! \file "rsn.c" - \brief This file including the 802.11i, wpa and wpa2(rsn) related function. - - This file provided the macros and functions library support the wpa/rsn ie parsing, - cipher and AKM check to help the AP seleced deciding, tkip mic error handler and rsn PMKID support. -*/ - - - -/* -** $Log: rsn.c $ - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 03 09 2012 chinglan.wang - * NULL - * Fix the condition error. - * - * 03 02 2012 terry.wu - * NULL - * Snc CFG80211 modification for ICS migration from branch 2.2. - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 11 11 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * modify the xlog related code. - * - * 11 10 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * change the debug module level. - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 03 17 2011 chinglan.wang - * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature - * . - * - * 02 09 2011 wh.su - * [WCXRP00000432] [MT6620 Wi-Fi][Driver] Add STA privacy check at hotspot mode - * adding the code for check STA privacy bit at AP mode, . - * - * 12 24 2010 chinglan.wang - * NULL - * [MT6620][Wi-Fi] Modify the key management in the driver for WPS function. - * - * 12 13 2010 cp.wu - * [WCXRP00000260] [MT6620 Wi-Fi][Driver][Firmware] Create V1.1 branch for both firmware and driver - * create branch for Wi-Fi driver v1.1 - * - * 11 05 2010 wh.su - * [WCXRP00000165] [MT6620 Wi-Fi] [Pre-authentication] Assoc req rsn ie use wrong pmkid value - * fixed the.pmkid value mismatch issue - * - * 11 03 2010 wh.su - * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group - * Refine the HT rate disallow TKIP pairwise cipher . - * - * 10 04 2010 cp.wu - * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by ENUM_NETWORK_TYPE_INDEX_T only - * remove ENUM_NETWORK_TYPE_T definitions - * - * 09 29 2010 yuche.tsai - * NULL - * Fix compile error, remove unused pointer in rsnGenerateRSNIE(). - * - * 09 28 2010 wh.su - * NULL - * [WCXRP00000069][MT6620 Wi-Fi][Driver] Fix some code for phase 1 P2P Demo. - * - * 09 24 2010 wh.su - * NULL - * [WCXRP00005002][MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning. - * - * 09 06 2010 wh.su - * NULL - * let the p2p can set the privacy bit at beacon and rsn ie at assoc req at key handshake state. - * - * 08 30 2010 wh.su - * NULL - * remove non-used code. - * - * 08 19 2010 wh.su - * NULL - * adding the tx pkt call back handle for countermeasure. - * - * 07 24 2010 wh.su - * - * .support the Wi-Fi RSN - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * modify some code for concurrent network. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * [WPD00003833][MT6620 and MT5931] Driver migration - * enable RX management frame handling. - * - * 06 19 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * consdier the concurrent network setting. - * - * 06 18 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * [WPD00003840] [MT6620 5931] Security migration - * migration from firmware. - * - * 05 27 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * not indiate pmkid candidate while no new one scaned. - * - * 04 29 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * adjsut the pre-authentication code. - * - * 03 03 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * move the AIS specific variable for security to AIS specific structure. - * - * 03 03 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * Fixed the pre-authentication timer not correctly init issue, and modify the security related callback function prototype. - * - * 01 27 2010 wh.su - * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code - * add and fixed some security function. - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * Dec 8 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * change the name - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * using the Rx0 port to indicate event - * - * Dec 4 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * refine the code for generate the WPA/RSN IE for assoc req - * - * Dec 3 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adjust code for pmkid event - * - * Dec 1 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the code for event (mic error and pmkid indicate) and do some function rename - * - * Nov 23 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding some security function - * - * Nov 19 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding some security feature, including pmkid - * - * Nov 18 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -#if CFG_RSN_MIGRATION - -//extern PHY_ATTRIBUTE_T rPhyAttributes[]; - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to parse RSN IE. -* -* \param[in] prInfoElem Pointer to the RSN IE -* \param[out] prRsnInfo Pointer to the BSSDescription structure to store the -** RSN information from the given RSN IE -* -* \retval TRUE - Succeeded -* \retval FALSE - Failed -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rsnParseRsnIE ( - IN P_ADAPTER_T prAdapter, - IN P_RSN_INFO_ELEM_T prInfoElem, - OUT P_RSN_INFO_T prRsnInfo - ) -{ - UINT_32 i; - INT_32 u4RemainRsnIeLen; - UINT_16 u2Version; - UINT_16 u2Cap = 0; - UINT_32 u4GroupSuite = RSN_CIPHER_SUITE_CCMP; - UINT_16 u2PairSuiteCount = 0; - UINT_16 u2AuthSuiteCount = 0; - PUINT_8 pucPairSuite = NULL; - PUINT_8 pucAuthSuite = NULL; - PUINT_8 cp; - - DEBUGFUNC("rsnParseRsnIE"); - - ASSERT(prInfoElem); - ASSERT(prRsnInfo); - - /* Verify the length of the RSN IE. */ - if (prInfoElem->ucLength < 2) { - DBGLOG(RSN, TRACE, ("RSN IE length too short (length=%d)\n", prInfoElem->ucLength)); - return FALSE; - } - - /* Check RSN version: currently, we only support version 1. */ - WLAN_GET_FIELD_16(&prInfoElem->u2Version, &u2Version); - if (u2Version != 1) { - DBGLOG(RSN, TRACE,("Unsupported RSN IE version: %d\n", u2Version)); - return FALSE; - } - - cp = (PUCHAR) &prInfoElem->u4GroupKeyCipherSuite; - u4RemainRsnIeLen = (INT_32) prInfoElem->ucLength - 2; - - do { - if (u4RemainRsnIeLen == 0) { - break; - } - - /* Parse the Group Key Cipher Suite field. */ - if (u4RemainRsnIeLen < 4) { - DBGLOG(RSN, TRACE, ("Fail to parse RSN IE in group cipher suite (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - WLAN_GET_FIELD_32(cp, &u4GroupSuite); - cp += 4; - u4RemainRsnIeLen -= 4; - - if (u4RemainRsnIeLen == 0) { - break; - } - - /* Parse the Pairwise Key Cipher Suite Count field. */ - if (u4RemainRsnIeLen < 2) { - DBGLOG(RSN, TRACE,("Fail to parse RSN IE in pairwise cipher suite count (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - WLAN_GET_FIELD_16(cp, &u2PairSuiteCount); - cp += 2; - u4RemainRsnIeLen -= 2; - - /* Parse the Pairwise Key Cipher Suite List field. */ - i = (UINT_32) u2PairSuiteCount * 4; - if (u4RemainRsnIeLen < (INT_32) i) { - DBGLOG(RSN, TRACE,("Fail to parse RSN IE in pairwise cipher suite list (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - pucPairSuite = cp; - - cp += i; - u4RemainRsnIeLen -= (INT_32) i; - - if (u4RemainRsnIeLen == 0) { - break; - } - - /* Parse the Authentication and Key Management Cipher Suite Count field. */ - if (u4RemainRsnIeLen < 2) { - DBGLOG(RSN, TRACE,("Fail to parse RSN IE in auth & key mgt suite count (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - WLAN_GET_FIELD_16(cp, &u2AuthSuiteCount); - cp += 2; - u4RemainRsnIeLen -= 2; - - /* Parse the Authentication and Key Management Cipher Suite List - field. */ - i = (UINT_32) u2AuthSuiteCount * 4; - if (u4RemainRsnIeLen < (INT_32) i) { - DBGLOG(RSN, TRACE, ("Fail to parse RSN IE in auth & key mgt suite list (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - pucAuthSuite = cp; - - cp += i; - u4RemainRsnIeLen -= (INT_32) i; - - if (u4RemainRsnIeLen == 0) { - break; - } - - /* Parse the RSN u2Capabilities field. */ - if (u4RemainRsnIeLen < 2) { - DBGLOG(RSN, TRACE, ("Fail to parse RSN IE in RSN capabilities (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - WLAN_GET_FIELD_16(cp, &u2Cap); - } while (FALSE); - - /* Save the RSN information for the BSS. */ - prRsnInfo->ucElemId = ELEM_ID_RSN; - - prRsnInfo->u2Version = u2Version; - - prRsnInfo->u4GroupKeyCipherSuite = u4GroupSuite; - - DBGLOG(RSN, LOUD, ("RSN: version %d, group key cipher suite %02x-%02x-%02x-%02x\n", - u2Version, (UCHAR) (u4GroupSuite & 0x000000FF), - (UCHAR) ((u4GroupSuite >> 8) & 0x000000FF), - (UCHAR) ((u4GroupSuite >> 16) & 0x000000FF), - (UCHAR) ((u4GroupSuite >> 24) & 0x000000FF))); - - if (pucPairSuite) { - /* The information about the pairwise key cipher suites is present. */ - if (u2PairSuiteCount > MAX_NUM_SUPPORTED_CIPHER_SUITES) { - u2PairSuiteCount = MAX_NUM_SUPPORTED_CIPHER_SUITES; - } - - prRsnInfo->u4PairwiseKeyCipherSuiteCount = (UINT_32) u2PairSuiteCount; - - for (i = 0; i < (UINT_32) u2PairSuiteCount; i++) { - WLAN_GET_FIELD_32(pucPairSuite, - &prRsnInfo->au4PairwiseKeyCipherSuite[i]); - pucPairSuite += 4; - - DBGLOG(RSN, LOUD, ("RSN: pairwise key cipher suite [%d]: %02x-%02x-%02x-%02x\n", - (UINT_8)i, (UCHAR) (prRsnInfo->au4PairwiseKeyCipherSuite[i] & 0x000000FF), - (UCHAR) ((prRsnInfo->au4PairwiseKeyCipherSuite[i] >> 8) & 0x000000FF), - (UCHAR) ((prRsnInfo->au4PairwiseKeyCipherSuite[i] >> 16) & 0x000000FF), - (UCHAR) ((prRsnInfo->au4PairwiseKeyCipherSuite[i] >> 24) & 0x000000FF))); - } - } - else { - /* The information about the pairwise key cipher suites is not present. - Use the default chipher suite for RSN: CCMP. */ - prRsnInfo->u4PairwiseKeyCipherSuiteCount = 1; - prRsnInfo->au4PairwiseKeyCipherSuite[0] = RSN_CIPHER_SUITE_CCMP; - - DBGLOG(RSN, LOUD, ("RSN: pairwise key cipher suite: %02x-%02x-%02x-%02x (default)\n", - (UCHAR) (prRsnInfo->au4PairwiseKeyCipherSuite[0] & 0x000000FF), - (UCHAR) ((prRsnInfo->au4PairwiseKeyCipherSuite[0] >> 8) & 0x000000FF), - (UCHAR) ((prRsnInfo->au4PairwiseKeyCipherSuite[0] >> 16) & 0x000000FF), - (UCHAR) ((prRsnInfo->au4PairwiseKeyCipherSuite[0] >> 24) & 0x000000FF))); - } - - if (pucAuthSuite) { - /* The information about the authentication and key management suites - is present. */ - if (u2AuthSuiteCount > MAX_NUM_SUPPORTED_AKM_SUITES) { - u2AuthSuiteCount = MAX_NUM_SUPPORTED_AKM_SUITES; - } - - prRsnInfo->u4AuthKeyMgtSuiteCount = (UINT_32) u2AuthSuiteCount; - - for (i = 0; i < (UINT_32) u2AuthSuiteCount; i++) { - WLAN_GET_FIELD_32(pucAuthSuite, &prRsnInfo->au4AuthKeyMgtSuite[i]); - pucAuthSuite += 4; - - DBGLOG(RSN, LOUD, ("RSN: AKM suite [%d]: %02x-%02x-%02x-%02x\n", - (UINT_8)i, (UCHAR) (prRsnInfo->au4AuthKeyMgtSuite[i] & 0x000000FF), - (UCHAR) ((prRsnInfo->au4AuthKeyMgtSuite[i] >> 8) & 0x000000FF), - (UCHAR) ((prRsnInfo->au4AuthKeyMgtSuite[i] >> 16) & 0x000000FF), - (UCHAR) ((prRsnInfo->au4AuthKeyMgtSuite[i] >> 24) & 0x000000FF))); - } - } - else { - /* The information about the authentication and key management suites - is not present. Use the default AKM suite for RSN. */ - prRsnInfo->u4AuthKeyMgtSuiteCount = 1; - prRsnInfo->au4AuthKeyMgtSuite[0] = RSN_AKM_SUITE_802_1X; - - DBGLOG(RSN, LOUD, ("RSN: AKM suite: %02x-%02x-%02x-%02x (default)\n", - (UCHAR) (prRsnInfo->au4AuthKeyMgtSuite[0] & 0x000000FF), - (UCHAR) ((prRsnInfo->au4AuthKeyMgtSuite[0] >> 8) & 0x000000FF), - (UCHAR) ((prRsnInfo->au4AuthKeyMgtSuite[0] >> 16) & 0x000000FF), - (UCHAR) ((prRsnInfo->au4AuthKeyMgtSuite[0] >> 24) & 0x000000FF))); - } - - prRsnInfo->u2RsnCap = u2Cap; -#if CFG_SUPPORT_802_11W - prRsnInfo->fgRsnCapPresent = TRUE; -#endif - DBGLOG(RSN, LOUD, ("RSN cap: 0x%04x\n", prRsnInfo->u2RsnCap)); - - return TRUE; -} /* rsnParseRsnIE */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to parse WPA IE. -* -* \param[in] prInfoElem Pointer to the WPA IE. -* \param[out] prWpaInfo Pointer to the BSSDescription structure to store the -* WPA information from the given WPA IE. -* -* \retval TRUE Succeeded. -* \retval FALSE Failed. -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rsnParseWpaIE ( - IN P_ADAPTER_T prAdapter, - IN P_WPA_INFO_ELEM_T prInfoElem, - OUT P_RSN_INFO_T prWpaInfo - ) -{ - UINT_32 i; - INT_32 u4RemainWpaIeLen; - UINT_16 u2Version; - UINT_16 u2Cap = 0; - UINT_32 u4GroupSuite = WPA_CIPHER_SUITE_TKIP; - UINT_16 u2PairSuiteCount = 0; - UINT_16 u2AuthSuiteCount = 0; - PUCHAR pucPairSuite = NULL; - PUCHAR pucAuthSuite = NULL; - PUCHAR cp; - BOOLEAN fgCapPresent = FALSE; - - DEBUGFUNC("rsnParseWpaIE"); - - ASSERT(prInfoElem); - ASSERT(prWpaInfo); - - /* Verify the length of the WPA IE. */ - if (prInfoElem->ucLength < 6) { - DBGLOG(RSN, TRACE,("WPA IE length too short (length=%d)\n", prInfoElem->ucLength)); - return FALSE; - } - - /* Check WPA version: currently, we only support version 1. */ - WLAN_GET_FIELD_16(&prInfoElem->u2Version, &u2Version); - if (u2Version != 1) { - DBGLOG(RSN, TRACE, ("Unsupported WPA IE version: %d\n", u2Version)); - return FALSE; - } - - cp = (PUCHAR) &prInfoElem->u4GroupKeyCipherSuite; - u4RemainWpaIeLen = (INT_32) prInfoElem->ucLength - 6; - - do { - if (u4RemainWpaIeLen == 0) { - break; - } - - /* WPA_OUI : 4 - Version : 2 - GroupSuite : 4 - PairwiseCount: 2 - PairwiseSuite: 4 * pairSuiteCount - AuthCount : 2 - AuthSuite : 4 * authSuiteCount - Cap : 2 */ - - /* Parse the Group Key Cipher Suite field. */ - if (u4RemainWpaIeLen < 4) { - DBGLOG(RSN, TRACE,("Fail to parse WPA IE in group cipher suite (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - WLAN_GET_FIELD_32(cp, &u4GroupSuite); - cp += 4; - u4RemainWpaIeLen -= 4; - - if (u4RemainWpaIeLen == 0) { - break; - } - - /* Parse the Pairwise Key Cipher Suite Count field. */ - if (u4RemainWpaIeLen < 2) { - DBGLOG(RSN, TRACE,("Fail to parse WPA IE in pairwise cipher suite count (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - WLAN_GET_FIELD_16(cp, &u2PairSuiteCount); - cp += 2; - u4RemainWpaIeLen -= 2; - - /* Parse the Pairwise Key Cipher Suite List field. */ - i = (UINT_32) u2PairSuiteCount * 4; - if (u4RemainWpaIeLen < (INT_32) i) { - DBGLOG(RSN, TRACE,("Fail to parse WPA IE in pairwise cipher suite list (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - pucPairSuite = cp; - - cp += i; - u4RemainWpaIeLen -= (INT_32) i; - - if (u4RemainWpaIeLen == 0) { - break; - } - - /* Parse the Authentication and Key Management Cipher Suite Count - field. */ - if (u4RemainWpaIeLen < 2) { - DBGLOG(RSN, TRACE,("Fail to parse WPA IE in auth & key mgt suite count (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - WLAN_GET_FIELD_16(cp, &u2AuthSuiteCount); - cp += 2; - u4RemainWpaIeLen -= 2; - - /* Parse the Authentication and Key Management Cipher Suite List - field. */ - i = (UINT_32) u2AuthSuiteCount * 4; - if (u4RemainWpaIeLen < (INT_32) i) { - DBGLOG(RSN, TRACE, ("Fail to parse WPA IE in auth & key mgt suite list (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - pucAuthSuite = cp; - - cp += i; - u4RemainWpaIeLen -= (INT_32) i; - - if (u4RemainWpaIeLen == 0) { - break; - } - - /* Parse the WPA u2Capabilities field. */ - if (u4RemainWpaIeLen < 2) { - DBGLOG(RSN, TRACE, ("Fail to parse WPA IE in WPA capabilities (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - fgCapPresent = TRUE; - WLAN_GET_FIELD_16(cp, &u2Cap); - u4RemainWpaIeLen -= 2; - } while (FALSE); - - /* Save the WPA information for the BSS. */ - - prWpaInfo->ucElemId = ELEM_ID_WPA; - - prWpaInfo->u2Version = u2Version; - - prWpaInfo->u4GroupKeyCipherSuite = u4GroupSuite; - - DBGLOG(RSN, LOUD, ("WPA: version %d, group key cipher suite %02x-%02x-%02x-%02x\n", - u2Version, (UCHAR) (u4GroupSuite & 0x000000FF), - (UCHAR) ((u4GroupSuite >> 8) & 0x000000FF), - (UCHAR) ((u4GroupSuite >> 16) & 0x000000FF), - (UCHAR) ((u4GroupSuite >> 24) & 0x000000FF))); - - if (pucPairSuite) { - /* The information about the pairwise key cipher suites is present. */ - if (u2PairSuiteCount > MAX_NUM_SUPPORTED_CIPHER_SUITES) { - u2PairSuiteCount = MAX_NUM_SUPPORTED_CIPHER_SUITES; - } - - prWpaInfo->u4PairwiseKeyCipherSuiteCount = (UINT_32) u2PairSuiteCount; - - for (i = 0; i < (UINT_32) u2PairSuiteCount; i++) { - WLAN_GET_FIELD_32(pucPairSuite, - &prWpaInfo->au4PairwiseKeyCipherSuite[i]); - pucPairSuite += 4; - - DBGLOG(RSN, LOUD, ("WPA: pairwise key cipher suite [%d]: %02x-%02x-%02x-%02x\n", - (UINT_8)i, (UCHAR) (prWpaInfo->au4PairwiseKeyCipherSuite[i] & 0x000000FF), - (UCHAR) ((prWpaInfo->au4PairwiseKeyCipherSuite[i] >> 8) & 0x000000FF), - (UCHAR) ((prWpaInfo->au4PairwiseKeyCipherSuite[i] >> 16) & 0x000000FF), - (UCHAR) ((prWpaInfo->au4PairwiseKeyCipherSuite[i] >> 24) & 0x000000FF))); - } - } - else { - /* The information about the pairwise key cipher suites is not present. - Use the default chipher suite for WPA: TKIP. */ - prWpaInfo->u4PairwiseKeyCipherSuiteCount = 1; - prWpaInfo->au4PairwiseKeyCipherSuite[0] = WPA_CIPHER_SUITE_TKIP; - - DBGLOG(RSN, LOUD, ("WPA: pairwise key cipher suite: %02x-%02x-%02x-%02x (default)\n", - (UCHAR) (prWpaInfo->au4PairwiseKeyCipherSuite[0] & 0x000000FF), - (UCHAR) ((prWpaInfo->au4PairwiseKeyCipherSuite[0] >> 8) & 0x000000FF), - (UCHAR) ((prWpaInfo->au4PairwiseKeyCipherSuite[0] >> 16) & 0x000000FF), - (UCHAR) ((prWpaInfo->au4PairwiseKeyCipherSuite[0] >> 24) & 0x000000FF))); - } - - if (pucAuthSuite) { - /* The information about the authentication and key management suites - is present. */ - if (u2AuthSuiteCount > MAX_NUM_SUPPORTED_AKM_SUITES) { - u2AuthSuiteCount = MAX_NUM_SUPPORTED_AKM_SUITES; - } - - prWpaInfo->u4AuthKeyMgtSuiteCount = (UINT_32) u2AuthSuiteCount; - - for (i = 0; i < (UINT_32) u2AuthSuiteCount; i++) { - WLAN_GET_FIELD_32(pucAuthSuite, &prWpaInfo->au4AuthKeyMgtSuite[i]); - pucAuthSuite += 4; - - DBGLOG(RSN, LOUD, ("WPA: AKM suite [%d]: %02x-%02x-%02x-%02x\n", - (UINT_8)i, (UCHAR) (prWpaInfo->au4AuthKeyMgtSuite[i] & 0x000000FF), - (UCHAR) ((prWpaInfo->au4AuthKeyMgtSuite[i] >> 8) & 0x000000FF), - (UCHAR) ((prWpaInfo->au4AuthKeyMgtSuite[i] >> 16) & 0x000000FF), - (UCHAR) ((prWpaInfo->au4AuthKeyMgtSuite[i] >> 24) & 0x000000FF))); - } - } - else { - /* The information about the authentication and key management suites - is not present. Use the default AKM suite for WPA. */ - prWpaInfo->u4AuthKeyMgtSuiteCount = 1; - prWpaInfo->au4AuthKeyMgtSuite[0] = WPA_AKM_SUITE_802_1X; - - DBGLOG(RSN, LOUD, ("WPA: AKM suite: %02x-%02x-%02x-%02x (default)\n", - (UCHAR) (prWpaInfo->au4AuthKeyMgtSuite[0] & 0x000000FF), - (UCHAR) ((prWpaInfo->au4AuthKeyMgtSuite[0] >> 8) & 0x000000FF), - (UCHAR) ((prWpaInfo->au4AuthKeyMgtSuite[0] >> 16) & 0x000000FF), - (UCHAR) ((prWpaInfo->au4AuthKeyMgtSuite[0] >> 24) & 0x000000FF))); - } - - if (fgCapPresent) { - prWpaInfo->fgRsnCapPresent = TRUE; - prWpaInfo->u2RsnCap = u2Cap; - DBGLOG(RSN, LOUD, ("WPA: RSN cap: 0x%04x\n", prWpaInfo->u2RsnCap)); - } - else { - prWpaInfo->fgRsnCapPresent = FALSE; - prWpaInfo->u2RsnCap = 0; - } - - return TRUE; -} /* rsnParseWpaIE */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to search the desired pairwise -* cipher suite from the MIB Pairwise Cipher Suite -* configuration table. -* -* \param[in] u4Cipher The desired pairwise cipher suite to be searched -* \param[out] pu4Index Pointer to the index of the desired pairwise cipher in -* the table -* -* \retval TRUE - The desired pairwise cipher suite is found in the table. -* \retval FALSE - The desired pairwise cipher suite is not found in the -* table. -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rsnSearchSupportedCipher ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Cipher, - OUT PUINT_32 pu4Index - ) -{ - UINT_8 i; - P_DOT11_RSNA_CONFIG_PAIRWISE_CIPHERS_ENTRY prEntry; - - DEBUGFUNC("rsnSearchSupportedCipher"); - - ASSERT(pu4Index); - - for (i = 0; i < MAX_NUM_SUPPORTED_CIPHER_SUITES; i++) { - prEntry = &prAdapter->rMib.dot11RSNAConfigPairwiseCiphersTable[i]; - if (prEntry->dot11RSNAConfigPairwiseCipher == u4Cipher && - prEntry->dot11RSNAConfigPairwiseCipherEnabled) { - *pu4Index = i; - return TRUE; - } - } - return FALSE; -} /* rsnSearchSupportedCipher */ - - -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to search the desired -* authentication and key management (AKM) suite from the -* MIB Authentication and Key Management Suites table. -* -* \param[in] u4AkmSuite The desired AKM suite to be searched -* \param[out] pu4Index Pointer to the index of the desired AKM suite in the -* table -* -* \retval TRUE The desired AKM suite is found in the table. -* \retval FALSE The desired AKM suite is not found in the table. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rsnSearchAKMSuite ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4AkmSuite, - OUT PUINT_32 pu4Index - ) -{ - UINT_8 i; - P_DOT11_RSNA_CONFIG_AUTHENTICATION_SUITES_ENTRY prEntry; - - DEBUGFUNC("rsnSearchAKMSuite"); - - ASSERT(pu4Index); - - for (i = 0; i < MAX_NUM_SUPPORTED_AKM_SUITES; i++) { - prEntry = &prAdapter->rMib.dot11RSNAConfigAuthenticationSuitesTable[i]; - if (prEntry->dot11RSNAConfigAuthenticationSuite == u4AkmSuite && - prEntry->dot11RSNAConfigAuthenticationSuiteEnabled) { - *pu4Index = i; - return TRUE; - } - } - return FALSE; -} /* rsnSearchAKMSuite */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to perform RSNA or TSN policy -* selection for a given BSS. -* -* \param[in] prBss Pointer to the BSS description -* -* \retval TRUE - The RSNA/TSN policy selection for the given BSS is -* successful. The selected pairwise and group cipher suites -* are returned in the BSS description. -* \retval FALSE - The RSNA/TSN policy selection for the given BSS is failed. -* The driver shall not attempt to join the given BSS. -* -* \note The Encrypt status matched score will save to bss for final ap select. -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rsnPerformPolicySelection ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBss - ) -{ -#if CFG_SUPPORT_802_11W - INT_32 i; - UINT_32 j; -#else - UINT_32 i, j; -#endif - BOOLEAN fgSuiteSupported; - UINT_32 u4PairwiseCipher = 0; - UINT_32 u4GroupCipher = 0; - UINT_32 u4AkmSuite = 0; - P_RSN_INFO_T prBssRsnInfo; - ENUM_NETWORK_TYPE_INDEX_T eNetwotkType; - BOOLEAN fgIsWpsActive = (BOOLEAN)FALSE; - - DEBUGFUNC("rsnPerformPolicySelection"); - - ASSERT(prBss); - - DBGLOG(RSN, TRACE, ("rsnPerformPolicySelection\n")); - //Todo:: - eNetwotkType = NETWORK_TYPE_AIS_INDEX; - - prBss->u4RsnSelectedPairwiseCipher = 0; - prBss->u4RsnSelectedGroupCipher = 0; - prBss->u4RsnSelectedAKMSuite = 0; - prBss->ucEncLevel = 0; - -#if CFG_SUPPORT_WPS - fgIsWpsActive = kalWSCGetActiveState(prAdapter->prGlueInfo); - - /* CR1640, disable the AP select privacy check */ - if ( fgIsWpsActive && - (prAdapter->rWifiVar.rConnSettings.eAuthMode < AUTH_MODE_WPA) && - (prAdapter->rWifiVar.rConnSettings.eOPMode == NET_TYPE_INFRA)) { - DBGLOG(RSN, TRACE,("-- Skip the Protected BSS check\n")); - return TRUE; - } -#endif - - /* Protection is not required in this BSS. */ - if ((prBss->u2CapInfo & CAP_INFO_PRIVACY) == 0 ) { - - if (secEnabledInAis(prAdapter) == FALSE) { - DBGLOG(RSN, TRACE,("-- No Protected BSS\n")); - return TRUE; - } - else { - DBGLOG(RSN, TRACE,("-- Protected BSS\n")); - return FALSE; - } - } - - /* Protection is required in this BSS. */ - if ((prBss->u2CapInfo & CAP_INFO_PRIVACY) != 0) { - if (secEnabledInAis(prAdapter) == FALSE) { - DBGLOG(RSN, TRACE,("-- Protected BSS\n")); - return FALSE; - } - } - - if (prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA || - prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA_PSK || - prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA_NONE) { - - if (prBss->fgIEWPA) { - prBssRsnInfo = &prBss->rWPAInfo; - } - else { - DBGLOG(RSN, TRACE, ("WPA Information Element does not exist.\n")); - return FALSE; - } - } - else if (prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA2 || - prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA2_PSK) { - - if (prBss->fgIERSN) { - prBssRsnInfo = &prBss->rRSNInfo; - } - else { - DBGLOG(RSN, TRACE, ("RSN Information Element does not exist.\n")); - return FALSE; - } - } - else if (prAdapter->rWifiVar.rConnSettings.eEncStatus != ENUM_ENCRYPTION1_ENABLED) { - /* If the driver is configured to use WEP only, ignore this BSS. */ - DBGLOG(RSN, TRACE, ("-- Not WEP-only legacy BSS\n")); - return FALSE; - } - else if (prAdapter->rWifiVar.rConnSettings.eEncStatus == ENUM_ENCRYPTION1_ENABLED) { - /* If the driver is configured to use WEP only, use this BSS. */ - DBGLOG(RSN, TRACE, ("-- WEP-only legacy BSS\n")); - return TRUE; - } - - if (prBssRsnInfo->u4PairwiseKeyCipherSuiteCount == 1 && - GET_SELECTOR_TYPE(prBssRsnInfo->au4PairwiseKeyCipherSuite[0]) == - CIPHER_SUITE_NONE) { - /* Since the pairwise cipher use the same cipher suite as the group - cipher in the BSS, we check the group cipher suite against the - current encryption status. */ - fgSuiteSupported = FALSE; - - switch (prBssRsnInfo->u4GroupKeyCipherSuite) { - case WPA_CIPHER_SUITE_CCMP: - case RSN_CIPHER_SUITE_CCMP: - if (prAdapter->rWifiVar.rConnSettings.eEncStatus == - ENUM_ENCRYPTION3_ENABLED) { - fgSuiteSupported = TRUE; - } - break; - - case WPA_CIPHER_SUITE_TKIP: - case RSN_CIPHER_SUITE_TKIP: - if (prAdapter->rWifiVar.rConnSettings.eEncStatus == - ENUM_ENCRYPTION2_ENABLED) { - fgSuiteSupported = TRUE; - } - break; - - case WPA_CIPHER_SUITE_WEP40: - case WPA_CIPHER_SUITE_WEP104: - if (prAdapter->rWifiVar.rConnSettings.eEncStatus == - ENUM_ENCRYPTION1_ENABLED) { - fgSuiteSupported = TRUE; - } - break; - } - - if (fgSuiteSupported) { - u4PairwiseCipher = WPA_CIPHER_SUITE_NONE; - u4GroupCipher = prBssRsnInfo->u4GroupKeyCipherSuite; - } -#if DBG - else { - DBGLOG(RSN, TRACE, ("Inproper encryption status %d for group-key-only BSS\n", - prAdapter->rWifiVar.rConnSettings.eEncStatus)); - } -#endif - } - else { - fgSuiteSupported = FALSE; - - DBGLOG(RSN, TRACE, ("eEncStatus %d %d 0x%x\n", prAdapter->rWifiVar.rConnSettings.eEncStatus, - prBssRsnInfo->u4PairwiseKeyCipherSuiteCount, - prBssRsnInfo->au4PairwiseKeyCipherSuite[0])); - /* Select pairwise/group ciphers */ - switch (prAdapter->rWifiVar.rConnSettings.eEncStatus) - { - case ENUM_ENCRYPTION3_ENABLED: - for (i = 0; i < prBssRsnInfo->u4PairwiseKeyCipherSuiteCount; i++) { - if (GET_SELECTOR_TYPE(prBssRsnInfo->au4PairwiseKeyCipherSuite[i]) - == CIPHER_SUITE_CCMP) { - u4PairwiseCipher = prBssRsnInfo->au4PairwiseKeyCipherSuite[i]; - } - } - u4GroupCipher = prBssRsnInfo->u4GroupKeyCipherSuite; - break; - - case ENUM_ENCRYPTION2_ENABLED: - for (i = 0; i < prBssRsnInfo->u4PairwiseKeyCipherSuiteCount; i++) { - if (GET_SELECTOR_TYPE(prBssRsnInfo->au4PairwiseKeyCipherSuite[i]) - == CIPHER_SUITE_TKIP) { - u4PairwiseCipher = prBssRsnInfo->au4PairwiseKeyCipherSuite[i]; - } - } - if (GET_SELECTOR_TYPE(prBssRsnInfo->u4GroupKeyCipherSuite) == - CIPHER_SUITE_CCMP) { - DBGLOG(RSN, TRACE, ("Cannot join CCMP BSS\n")); - } - else { - u4GroupCipher = prBssRsnInfo->u4GroupKeyCipherSuite; - } - break; - - case ENUM_ENCRYPTION1_ENABLED: - for (i = 0; i < prBssRsnInfo->u4PairwiseKeyCipherSuiteCount; i++) { - if (GET_SELECTOR_TYPE(prBssRsnInfo->au4PairwiseKeyCipherSuite[i]) - == CIPHER_SUITE_WEP40 || - GET_SELECTOR_TYPE(prBssRsnInfo->au4PairwiseKeyCipherSuite[i]) - == CIPHER_SUITE_WEP104) { - u4PairwiseCipher = prBssRsnInfo->au4PairwiseKeyCipherSuite[i]; - } - } - if (GET_SELECTOR_TYPE(prBssRsnInfo->u4GroupKeyCipherSuite) == - CIPHER_SUITE_CCMP || - GET_SELECTOR_TYPE(prBssRsnInfo->u4GroupKeyCipherSuite) == - CIPHER_SUITE_TKIP) { - DBGLOG(RSN, TRACE, ("Cannot join CCMP/TKIP BSS\n")); - } - else { - u4GroupCipher = prBssRsnInfo->u4GroupKeyCipherSuite; - } - break; - - default: - break; - } - } - - /* Exception handler */ - /* If we cannot find proper pairwise and group cipher suites to join the - BSS, do not check the supported AKM suites. */ - if (u4PairwiseCipher == 0 || u4GroupCipher == 0) { - DBGLOG(RSN, TRACE, ("Failed to select pairwise/group cipher (0x%08lx/0x%08lx)\n", - u4PairwiseCipher, u4GroupCipher)); - return FALSE; - } - -#if CFG_ENABLE_WIFI_DIRECT - if ((prAdapter->fgIsP2PRegistered) && - (eNetwotkType == NETWORK_TYPE_P2P_INDEX)) { - if (u4PairwiseCipher != RSN_CIPHER_SUITE_CCMP || - u4GroupCipher != RSN_CIPHER_SUITE_CCMP || - u4AkmSuite != RSN_AKM_SUITE_PSK) { - DBGLOG(RSN, TRACE, ("Failed to select pairwise/group cipher for P2P network (0x%08lx/0x%08lx)\n", - u4PairwiseCipher, u4GroupCipher)); - return FALSE; - } - } -#endif - -#if CFG_ENABLE_BT_OVER_WIFI - if (eNetwotkType == NETWORK_TYPE_BOW_INDEX) { - if (u4PairwiseCipher != RSN_CIPHER_SUITE_CCMP || - u4GroupCipher != RSN_CIPHER_SUITE_CCMP || - u4AkmSuite != RSN_AKM_SUITE_PSK) { - } - DBGLOG(RSN, TRACE, ("Failed to select pairwise/group cipher for BT over Wi-Fi network (0x%08lx/0x%08lx)\n", - u4PairwiseCipher, u4GroupCipher)); - return FALSE; - } -#endif - - - /* Verify if selected pairwisse cipher is supported */ - fgSuiteSupported = rsnSearchSupportedCipher(prAdapter, u4PairwiseCipher, &i); - - /* Verify if selected group cipher is supported */ - if (fgSuiteSupported) { - fgSuiteSupported = rsnSearchSupportedCipher(prAdapter, u4GroupCipher, &i); - } - - if (!fgSuiteSupported) { - DBGLOG(RSN, TRACE, ("Failed to support selected pairwise/group cipher (0x%08lx/0x%08lx)\n", - u4PairwiseCipher, u4GroupCipher)); - return FALSE; - } - - /* Select AKM */ - /* If the driver cannot support any authentication suites advertised in - the given BSS, we fail to perform RSNA policy selection. */ - /* Attempt to find any overlapping supported AKM suite. */ -#if CFG_SUPPORT_802_11W - if (i != 0) - for (i = (prBssRsnInfo->u4AuthKeyMgtSuiteCount - 1); i >= 0; i--) -#else - for (i = 0; i < prBssRsnInfo->u4AuthKeyMgtSuiteCount; i++) -#endif - { - if (rsnSearchAKMSuite(prAdapter, - prBssRsnInfo->au4AuthKeyMgtSuite[i], - &j)) { - u4AkmSuite = prBssRsnInfo->au4AuthKeyMgtSuite[i]; - break; - } - } - - if (u4AkmSuite == 0) { - DBGLOG(RSN, TRACE, ("Cannot support any AKM suites\n")); - return FALSE; - } - - DBGLOG(RSN, TRACE, ("Selected pairwise/group cipher: %02x-%02x-%02x-%02x/%02x-%02x-%02x-%02x\n", - (UINT_8) (u4PairwiseCipher & 0x000000FF), - (UINT_8) ((u4PairwiseCipher >> 8) & 0x000000FF), - (UINT_8) ((u4PairwiseCipher >> 16) & 0x000000FF), - (UINT_8) ((u4PairwiseCipher >> 24) & 0x000000FF), - (UINT_8) (u4GroupCipher & 0x000000FF), - (UINT_8) ((u4GroupCipher >> 8) & 0x000000FF), - (UINT_8) ((u4GroupCipher >> 16) & 0x000000FF), - (UINT_8) ((u4GroupCipher >> 24) & 0x000000FF))); - - DBGLOG(RSN, TRACE, ("Selected AKM suite: %02x-%02x-%02x-%02x\n", - (UINT_8) (u4AkmSuite & 0x000000FF), - (UINT_8) ((u4AkmSuite >> 8) & 0x000000FF), - (UINT_8) ((u4AkmSuite >> 16) & 0x000000FF), - (UINT_8) ((u4AkmSuite >> 24) & 0x000000FF))); - -#if CFG_SUPPORT_802_11W - DBGLOG(RSN, TRACE, ("MFP setting = %d\n ", kalGetMfpSetting(prAdapter->prGlueInfo))); - - if (kalGetMfpSetting(prAdapter->prGlueInfo) == RSN_AUTH_MFP_REQUIRED) { - if (!prBssRsnInfo->fgRsnCapPresent) { - DBGLOG(RSN, TRACE, ("Skip RSN IE, No MFP Required Capability.\n")); - return FALSE; - } - else if (!(prBssRsnInfo->u2RsnCap & ELEM_WPA_CAP_MFPC)) { - DBGLOG(RSN, TRACE, ("Skip RSN IE, No MFP Required\n")); - return FALSE; - } - prAdapter->rWifiVar.rAisSpecificBssInfo.fgMgmtProtection = TRUE; - } - else if (kalGetMfpSetting(prAdapter->prGlueInfo) == RSN_AUTH_MFP_OPTIONAL) { - if (prBssRsnInfo->u2RsnCap && ((prBssRsnInfo->u2RsnCap & ELEM_WPA_CAP_MFPR) || - (prBssRsnInfo->u2RsnCap & ELEM_WPA_CAP_MFPC))) { - prAdapter->rWifiVar.rAisSpecificBssInfo.fgMgmtProtection = TRUE; - } - else { - prAdapter->rWifiVar.rAisSpecificBssInfo.fgMgmtProtection = FALSE; - } - } - else { - if (prBssRsnInfo->fgRsnCapPresent && (prBssRsnInfo->u2RsnCap & ELEM_WPA_CAP_MFPR)) { - DBGLOG(RSN, TRACE, ("Skip RSN IE, No MFP Required Capability\n")); - return FALSE; - } - prAdapter->rWifiVar.rAisSpecificBssInfo.fgMgmtProtection = FALSE; - } - DBGLOG(RSN, TRACE, ("fgMgmtProtection = %d\n ", prAdapter->rWifiVar.rAisSpecificBssInfo.fgMgmtProtection)); -#endif - - if (GET_SELECTOR_TYPE(u4GroupCipher) == CIPHER_SUITE_CCMP){ - prBss->ucEncLevel = 3; - } - else if (GET_SELECTOR_TYPE(u4GroupCipher) == CIPHER_SUITE_TKIP){ - prBss->ucEncLevel = 2; - } - else if (GET_SELECTOR_TYPE(u4GroupCipher) == CIPHER_SUITE_WEP40 || - GET_SELECTOR_TYPE(u4GroupCipher) == CIPHER_SUITE_WEP104) { - prBss->ucEncLevel = 1; - } - else { - ASSERT(FALSE); - } - prBss->u4RsnSelectedPairwiseCipher = u4PairwiseCipher; - prBss->u4RsnSelectedGroupCipher = u4GroupCipher; - prBss->u4RsnSelectedAKMSuite = u4AkmSuite; - - return TRUE; - -} /* rsnPerformPolicySelection */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to generate WPA IE for beacon frame. -* -* \param[in] pucIeStartAddr Pointer to put the generated WPA IE. -* -* \return The append WPA-None IE length -* \note -* Called by: JOIN module, compose beacon IE -*/ -/*----------------------------------------------------------------------------*/ -VOID -rsnGenerateWpaNoneIE ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - UINT_32 i; - P_WPA_INFO_ELEM_T prWpaIE; - UINT_32 u4Suite; - UINT_16 u2SuiteCount; - PUINT_8 cp, cp2; - UINT_8 ucExpendedLen = 0; - PUINT_8 pucBuffer; - ENUM_NETWORK_TYPE_INDEX_T eNetworkId; - - DEBUGFUNC("rsnGenerateWpaNoneIE"); - - ASSERT(prMsduInfo); - - if (prAdapter->rWifiVar.rConnSettings.eAuthMode != AUTH_MODE_WPA_NONE) { - return; - } - - eNetworkId = (ENUM_NETWORK_TYPE_INDEX_T)prMsduInfo->ucNetworkType; - - if (eNetworkId != NETWORK_TYPE_AIS_INDEX) - return; - - pucBuffer = (PUINT_8)((UINT_32)prMsduInfo->prPacket + - (UINT_32)prMsduInfo->u2FrameLength); - - ASSERT(pucBuffer); - - prWpaIE = (P_WPA_INFO_ELEM_T)(pucBuffer); - - /* Start to construct a WPA IE. */ - /* Fill the Element ID field. */ - prWpaIE->ucElemId = ELEM_ID_WPA; - - /* Fill the OUI and OUI Type fields. */ - prWpaIE->aucOui[0] = 0x00; - prWpaIE->aucOui[1] = 0x50; - prWpaIE->aucOui[2] = 0xF2; - prWpaIE->ucOuiType = VENDOR_OUI_TYPE_WPA; - - /* Fill the Version field. */ - WLAN_SET_FIELD_16(&prWpaIE->u2Version, 1); /* version 1 */ - ucExpendedLen = 6; - - /* Fill the Pairwise Key Cipher Suite List field. */ - u2SuiteCount = 0; - cp = (PUINT_8)&prWpaIE->aucPairwiseKeyCipherSuite1[0]; - - if (rsnSearchSupportedCipher(prAdapter, WPA_CIPHER_SUITE_CCMP, &i)) { - u4Suite = WPA_CIPHER_SUITE_CCMP; - } - else if (rsnSearchSupportedCipher(prAdapter, WPA_CIPHER_SUITE_TKIP, &i)) { - u4Suite = WPA_CIPHER_SUITE_TKIP; - } - else if (rsnSearchSupportedCipher(prAdapter, WPA_CIPHER_SUITE_WEP104, &i)) { - u4Suite = WPA_CIPHER_SUITE_WEP104; - } - else if (rsnSearchSupportedCipher(prAdapter, WPA_CIPHER_SUITE_WEP40, &i)) { - u4Suite = WPA_CIPHER_SUITE_WEP40; - } - else { - u4Suite = WPA_CIPHER_SUITE_TKIP; - } - - WLAN_SET_FIELD_32(cp, u4Suite); - u2SuiteCount++; - ucExpendedLen += 4; - cp += 4; - - /* Fill the Group Key Cipher Suite field as the same in pair-wise key. */ - WLAN_SET_FIELD_32(&prWpaIE->u4GroupKeyCipherSuite, u4Suite); - ucExpendedLen += 4; - - /* Fill the Pairwise Key Cipher Suite Count field. */ - WLAN_SET_FIELD_16(&prWpaIE->u2PairwiseKeyCipherSuiteCount, u2SuiteCount); - ucExpendedLen += 2; - - cp2 = cp; - - /* Fill the Authentication and Key Management Suite List field. */ - u2SuiteCount = 0; - cp += 2; - - if (rsnSearchAKMSuite(prAdapter, WPA_AKM_SUITE_802_1X, &i)) { - u4Suite = WPA_AKM_SUITE_802_1X; - } - else if (rsnSearchAKMSuite(prAdapter, WPA_AKM_SUITE_PSK, &i)) { - u4Suite = WPA_AKM_SUITE_PSK; - } - else { - u4Suite = WPA_AKM_SUITE_NONE; - } - - /* This shall be the only avaiable value for current implementation */ - ASSERT(u4Suite == WPA_AKM_SUITE_NONE); - - WLAN_SET_FIELD_32(cp, u4Suite); - u2SuiteCount++; - ucExpendedLen += 4; - cp += 4; - - /* Fill the Authentication and Key Management Suite Count field. */ - WLAN_SET_FIELD_16(cp2, u2SuiteCount); - ucExpendedLen += 2; - - /* Fill the Length field. */ - prWpaIE->ucLength = (UINT_8)ucExpendedLen; - - /* Increment the total IE length for the Element ID and Length fields. */ - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - -} /* rsnGenerateWpaNoneIE */ - - -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to generate WPA IE for -* associate request frame. -* -* \param[in] prCurrentBss The Selected BSS description -* -* \retval The append WPA IE length -* -* \note -* Called by: AIS module, Associate request -*/ -/*----------------------------------------------------------------------------*/ -VOID -rsnGenerateWPAIE ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - PUCHAR cp; - PUINT_8 pucBuffer; - ENUM_NETWORK_TYPE_INDEX_T eNetworkId; - - DEBUGFUNC("rsnGenerateWPAIE"); - - ASSERT(prMsduInfo); - - pucBuffer = (PUINT_8)((UINT_32)prMsduInfo->prPacket + - (UINT_32)prMsduInfo->u2FrameLength); - - ASSERT(pucBuffer); - - eNetworkId = (ENUM_NETWORK_TYPE_INDEX_T)prMsduInfo->ucNetworkType; - - //if (eNetworkId != NETWORK_TYPE_AIS_INDEX) - // return; - -#if CFG_ENABLE_WIFI_DIRECT - if ((1 /* prCurrentBss->fgIEWPA */ && - ((prAdapter->fgIsP2PRegistered) && - (eNetworkId == NETWORK_TYPE_P2P_INDEX) && - (kalP2PGetTkipCipher(prAdapter->prGlueInfo)))) || - ((prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA) || - (prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA_PSK))) -#else - if ((1 /* prCurrentBss->fgIEWPA */ && - ((prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA) || - (prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA_PSK)))) -#endif - { - /* Construct a WPA IE for association request frame. */ - WPA_IE(pucBuffer)->ucElemId = ELEM_ID_WPA; - WPA_IE(pucBuffer)->ucLength = ELEM_ID_WPA_LEN_FIXED; - WPA_IE(pucBuffer)->aucOui[0] = 0x00; - WPA_IE(pucBuffer)->aucOui[1] = 0x50; - WPA_IE(pucBuffer)->aucOui[2] = 0xF2; - WPA_IE(pucBuffer)->ucOuiType = VENDOR_OUI_TYPE_WPA; - WLAN_SET_FIELD_16(&WPA_IE(pucBuffer)->u2Version, 1); - -#if CFG_ENABLE_WIFI_DIRECT - if (prAdapter->fgIsP2PRegistered && eNetworkId == NETWORK_TYPE_P2P_INDEX) - { - WLAN_SET_FIELD_32(&WPA_IE(pucBuffer)->u4GroupKeyCipherSuite, WPA_CIPHER_SUITE_TKIP); - } - else -#endif - WLAN_SET_FIELD_32(&WPA_IE(pucBuffer)->u4GroupKeyCipherSuite, - prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX].u4RsnSelectedGroupCipher); - - cp = (PUCHAR) &WPA_IE(pucBuffer)->aucPairwiseKeyCipherSuite1[0]; - - WLAN_SET_FIELD_16(&WPA_IE(pucBuffer)->u2PairwiseKeyCipherSuiteCount, 1); -#if CFG_ENABLE_WIFI_DIRECT - if (prAdapter->fgIsP2PRegistered && eNetworkId == NETWORK_TYPE_P2P_INDEX) - { - WLAN_SET_FIELD_32(cp, WPA_CIPHER_SUITE_TKIP); - } - else -#endif - WLAN_SET_FIELD_32(cp, prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX].u4RsnSelectedPairwiseCipher); - cp += 4; - - WLAN_SET_FIELD_16(cp, 1); - cp += 2; -#if CFG_ENABLE_WIFI_DIRECT - if (prAdapter->fgIsP2PRegistered && eNetworkId == NETWORK_TYPE_P2P_INDEX) - { - WLAN_SET_FIELD_32(cp, WPA_AKM_SUITE_PSK); - } - else -#endif - WLAN_SET_FIELD_32(cp, prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX].u4RsnSelectedAKMSuite); - cp += 4; - - WPA_IE(pucBuffer)->ucLength = ELEM_ID_WPA_LEN_FIXED; - - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - } - -} /* rsnGenerateWPAIE */ - - -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to generate RSN IE for -* associate request frame. -* -* \param[in] prMsduInfo The Selected BSS description -* -* \retval The append RSN IE length -* -* \note -* Called by: AIS module, P2P module, BOW module Associate request -*/ -/*----------------------------------------------------------------------------*/ -VOID -rsnGenerateRSNIE ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - UINT_32 u4Entry; - PUCHAR cp; - //UINT_8 ucExpendedLen = 0; - PUINT_8 pucBuffer; - ENUM_NETWORK_TYPE_INDEX_T eNetworkId; - P_STA_RECORD_T prStaRec; - - DEBUGFUNC("rsnGenerateRSNIE"); - - ASSERT(prMsduInfo); - - pucBuffer = (PUINT_8)((UINT_32)prMsduInfo->prPacket + - (UINT_32)prMsduInfo->u2FrameLength); - - ASSERT(pucBuffer); - - /* Todo:: network id */ - eNetworkId = (ENUM_NETWORK_TYPE_INDEX_T)prMsduInfo->ucNetworkType; - - if ( -#if CFG_ENABLE_WIFI_DIRECT - ((prAdapter->fgIsP2PRegistered) && - (eNetworkId == NETWORK_TYPE_P2P_INDEX) && - (kalP2PGetCcmpCipher(prAdapter->prGlueInfo))) || -#endif -#if CFG_ENABLE_BT_OVER_WIFI - (eNetworkId == NETWORK_TYPE_BOW_INDEX) || -#endif - (eNetworkId == NETWORK_TYPE_AIS_INDEX /* prCurrentBss->fgIERSN */ && - ((prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA2) || - (prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA2_PSK)))) - { - /* Construct a RSN IE for association request frame. */ - RSN_IE(pucBuffer)->ucElemId = ELEM_ID_RSN; - RSN_IE(pucBuffer)->ucLength = ELEM_ID_RSN_LEN_FIXED; - WLAN_SET_FIELD_16(&RSN_IE(pucBuffer)->u2Version, 1); // Version - WLAN_SET_FIELD_32(&RSN_IE(pucBuffer)->u4GroupKeyCipherSuite, - prAdapter->rWifiVar.arBssInfo[eNetworkId].u4RsnSelectedGroupCipher); // Group key suite - cp = (PUCHAR) &RSN_IE(pucBuffer)->aucPairwiseKeyCipherSuite1[0]; - WLAN_SET_FIELD_16(&RSN_IE(pucBuffer)->u2PairwiseKeyCipherSuiteCount, 1); - WLAN_SET_FIELD_32(cp, prAdapter->rWifiVar.arBssInfo[eNetworkId].u4RsnSelectedPairwiseCipher); - cp += 4; - WLAN_SET_FIELD_16(cp, 1); // AKM suite count - cp += 2; - WLAN_SET_FIELD_32(cp, prAdapter->rWifiVar.arBssInfo[eNetworkId].u4RsnSelectedAKMSuite); // AKM suite - cp += 4; - WLAN_SET_FIELD_16(cp, prAdapter->rWifiVar.arBssInfo[eNetworkId].u2RsnSelectedCapInfo); // Capabilities -#if CFG_SUPPORT_802_11W - if (eNetworkId == NETWORK_TYPE_AIS_INDEX && prAdapter->rWifiVar.rAisSpecificBssInfo.fgMgmtProtection) { - if (kalGetMfpSetting(prAdapter->prGlueInfo) == RSN_AUTH_MFP_REQUIRED) { - WLAN_SET_FIELD_16(cp, ELEM_WPA_CAP_MFPC | ELEM_WPA_CAP_MFPR); // Capabilities - } - else if (kalGetMfpSetting(prAdapter->prGlueInfo) == RSN_AUTH_MFP_OPTIONAL) { - WLAN_SET_FIELD_16(cp, ELEM_WPA_CAP_MFPC); // Capabilities - } - } -#endif - cp += 2; - - if (eNetworkId == NETWORK_TYPE_AIS_INDEX) - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - if (eNetworkId == NETWORK_TYPE_AIS_INDEX && - rsnSearchPmkidEntry(prAdapter, prStaRec->aucMacAddr, &u4Entry)) { - //DBGLOG(RSN, TRACE, ("Add Pmk at assoc req\n")); - //DBGLOG(RSN, TRACE, ("addr " MACSTR" PMKID "MACSTR"\n", - // MAC2STR(prAdapter->rWifiVar.rAisSpecificBssInfo.arPmkidCache[u4Entry].rBssidInfo.arBSSID), MAC2STR(prAdapter->rWifiVar.rAisSpecificBssInfo.arPmkidCache[u4Entry].rBssidInfo.arPMKID))); - if (prAdapter->rWifiVar.rAisSpecificBssInfo.arPmkidCache[u4Entry].fgPmkidExist) { - RSN_IE(pucBuffer)->ucLength = 38; - WLAN_SET_FIELD_16(cp, 1); // PMKID count - cp += 2; - DBGLOG(RSN, TRACE, ("BSSID "MACSTR" ind=%d\n", MAC2STR(prStaRec->aucMacAddr), u4Entry)); - DBGLOG(RSN, TRACE, ("use PMKID "MACSTR"\n", MAC2STR(prAdapter->rWifiVar.rAisSpecificBssInfo.arPmkidCache[u4Entry].rBssidInfo.arPMKID))); - kalMemCopy(cp, (PVOID)prAdapter->rWifiVar.rAisSpecificBssInfo.arPmkidCache[u4Entry].rBssidInfo.arPMKID, - sizeof(PARAM_PMKID_VALUE)); - //ucExpendedLen = 40; - } - else { - WLAN_SET_FIELD_16(cp, 0); // PMKID count - //ucExpendedLen = ELEM_ID_RSN_LEN_FIXED + 2; -#if CFG_SUPPORT_802_11W - cp += 2; - RSN_IE(pucBuffer)->ucLength += 2; -#endif - } - } - else { - WLAN_SET_FIELD_16(cp, 0); // PMKID count - //ucExpendedLen = ELEM_ID_RSN_LEN_FIXED + 2; -#if CFG_SUPPORT_802_11W - cp += 2; - RSN_IE(pucBuffer)->ucLength += 2; -#endif - } - -#if CFG_SUPPORT_802_11W - if ((eNetworkId == NETWORK_TYPE_AIS_INDEX) && (kalGetMfpSetting(prAdapter->prGlueInfo) != RSN_AUTH_MFP_DISABLED) /* (mgmt_group_cipher == WPA_CIPHER_AES_128_CMAC) */ ) { - WLAN_SET_FIELD_32(cp, RSN_CIPHER_SUITE_AES_128_CMAC); - cp += 4; - RSN_IE(pucBuffer)->ucLength += 4; - } -#endif - prMsduInfo->u2FrameLength += IE_SIZE(pucBuffer); - } - -} /* rsnGenerateRSNIE */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Parse the given IE buffer and check if it is WFA IE and return Type and -* SubType for further process. -* -* \param[in] pucBuf Pointer to the buffer of WFA Information Element. -* \param[out] pucOuiType Pointer to the storage of OUI Type. -* \param[out] pu2SubTypeVersion Pointer to the storage of OUI SubType and Version. - -* \retval TRUE Parse IE ok -* \retval FALSE Parse IE fail -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rsnParseCheckForWFAInfoElem ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBuf, - OUT PUINT_8 pucOuiType, - OUT PUINT_16 pu2SubTypeVersion - ) -{ - UINT_8 aucWfaOui[] = VENDOR_OUI_WFA; - P_IE_WFA_T prWfaIE; - - ASSERT(pucBuf); - ASSERT(pucOuiType); - ASSERT(pu2SubTypeVersion); - prWfaIE = (P_IE_WFA_T)pucBuf; - - do { - if (IE_LEN(pucBuf) <= ELEM_MIN_LEN_WFA_OUI_TYPE_SUBTYPE) { - break; - } - else if (prWfaIE->aucOui[0] != aucWfaOui[0] || - prWfaIE->aucOui[1] != aucWfaOui[1] || - prWfaIE->aucOui[2] != aucWfaOui[2]) { - break; - } - - *pucOuiType = prWfaIE->ucOuiType; - WLAN_GET_FIELD_16(&prWfaIE->aucOuiSubTypeVersion[0], pu2SubTypeVersion); - - return TRUE; - } - while (FALSE); - - return FALSE; - -} /* end of rsnParseCheckForWFAInfoElem() */ - -#if CFG_SUPPORT_AAA -/*----------------------------------------------------------------------------*/ -/*! -* \brief Parse the given IE buffer and check if it is RSN IE with CCMP PSK -* -* \param[in] prAdapter Pointer to Adapter -* \param[in] prSwRfb Pointer to the rx buffer -* \param[in] pIE Pointer rthe buffer of Information Element. -* \param[out] prStatusCode Pointer to the return status code. - -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -void -rsnParserCheckForRSNCCMPPSK( - P_ADAPTER_T prAdapter, - P_RSN_INFO_ELEM_T prIe, - PUINT_16 pu2StatusCode - ) -{ - - RSN_INFO_T rRsnIe; - - ASSERT(prAdapter); - ASSERT(prIe); - ASSERT(pu2StatusCode); - - *pu2StatusCode = STATUS_CODE_INVALID_INFO_ELEMENT; - - if (rsnParseRsnIE(prAdapter, prIe, &rRsnIe)) { - if ((rRsnIe.u4PairwiseKeyCipherSuiteCount != 1) || (rRsnIe.au4PairwiseKeyCipherSuite[0] != RSN_CIPHER_SUITE_CCMP)) { - *pu2StatusCode = STATUS_CODE_INVALID_PAIRWISE_CIPHER; - return; - } - if ((rRsnIe.u4GroupKeyCipherSuite != RSN_CIPHER_SUITE_CCMP)) { - *pu2StatusCode = STATUS_CODE_INVALID_GROUP_CIPHER; - return; - } - if ((rRsnIe.u4AuthKeyMgtSuiteCount != 1) || (rRsnIe.au4AuthKeyMgtSuite[0] != RSN_AKM_SUITE_PSK)) { - *pu2StatusCode = STATUS_CODE_INVALID_AKMP; - return; - } - - DBGLOG(RSN, TRACE, ("RSN with CCMP-PSK\n" )); - *pu2StatusCode = WLAN_STATUS_SUCCESS; - } - -} -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to generate an authentication event to NDIS. -* -* \param[in] u4Flags Authentication event: \n -* PARAM_AUTH_REQUEST_REAUTH 0x01 \n -* PARAM_AUTH_REQUEST_KEYUPDATE 0x02 \n -* PARAM_AUTH_REQUEST_PAIRWISE_ERROR 0x06 \n -* PARAM_AUTH_REQUEST_GROUP_ERROR 0x0E \n -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -rsnGenMicErrorEvent ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgFlags - ) -{ - P_PARAM_AUTH_EVENT_T prAuthEvent; - - DEBUGFUNC("rsnGenMicErrorEvent"); - - prAuthEvent = (P_PARAM_AUTH_EVENT_T)prAdapter->aucIndicationEventBuffer; - - /* Status type: Authentication Event */ - prAuthEvent->rStatus.eStatusType = ENUM_STATUS_TYPE_AUTHENTICATION; - - /* Authentication request */ - prAuthEvent->arRequest[0].u4Length = sizeof(PARAM_AUTH_REQUEST_T); - kalMemCopy((PVOID)prAuthEvent->arRequest[0].arBssid, (PVOID)prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX].aucBSSID, MAC_ADDR_LEN); - - if (fgFlags == TRUE) - prAuthEvent->arRequest[0].u4Flags = PARAM_AUTH_REQUEST_GROUP_ERROR; - else - prAuthEvent->arRequest[0].u4Flags = PARAM_AUTH_REQUEST_PAIRWISE_ERROR; - - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_SPECIFIC_INDICATION, - (PVOID)prAuthEvent, - sizeof(PARAM_STATUS_INDICATION_T) + sizeof(PARAM_AUTH_REQUEST_T)); - -} /* rsnGenMicErrorEvent */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to handle TKIP MIC failures. -* -* \param[in] adapter_p Pointer to the adapter object data area. -* \param[in] prSta Pointer to the STA which occur MIC Error -* \param[in] fgErrorKeyType type of error key -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rsnTkipHandleMICFailure ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta, - IN BOOLEAN fgErrorKeyType - ) -{ - //UINT_32 u4RsnaCurrentMICFailTime; - //P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo; - - DEBUGFUNC("rsnTkipHandleMICFailure"); - - ASSERT(prAdapter); -#if 1 - rsnGenMicErrorEvent(prAdapter,/* prSta,*/ fgErrorKeyType); - - /* Generate authentication request event. */ - DBGLOG(RSN, INFO, ("Generate TKIP MIC error event (type: 0%d)\n", - fgErrorKeyType)); -#else - ASSERT(prSta); - - prAisSpecBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - - /* Record the MIC error occur time. */ - GET_CURRENT_SYSTIME(&u4RsnaCurrentMICFailTime); - - /* Generate authentication request event. */ - DBGLOG(RSN, INFO, ("Generate TKIP MIC error event (type: 0%d)\n", - fgErrorKeyType)); - - /* If less than 60 seconds have passed since a previous TKIP MIC failure, - disassociate from the AP and wait for 60 seconds before (re)associating - with the same AP. */ - if (prAisSpecBssInfo->u4RsnaLastMICFailTime != 0 && - !CHECK_FOR_TIMEOUT(u4RsnaCurrentMICFailTime, - prAisSpecBssInfo->u4RsnaLastMICFailTime, - SEC_TO_SYSTIME(TKIP_COUNTERMEASURE_SEC))) { - /* If less than 60 seconds expired since last MIC error, we have to - block traffic. */ - - DBGLOG(RSN, INFO, ("Start blocking traffic!\n")); - rsnGenMicErrorEvent( prAdapter,/* prSta,*/ fgErrorKeyType); - - secFsmEventStartCounterMeasure(prAdapter, prSta); - } - else { - rsnGenMicErrorEvent( prAdapter,/* prSta,*/ fgErrorKeyType); - DBGLOG(RSN, INFO, ("First TKIP MIC error!\n")); - } - - COPY_SYSTIME(prAisSpecBssInfo->u4RsnaLastMICFailTime, u4RsnaCurrentMICFailTime); -#endif -} /* rsnTkipHandleMICFailure */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is called to select a list of BSSID from -* the scan results for PMKID candidate list. -* -* \param[in] prBssDesc the BSS Desc at scan result list -* \param[out] pu4CandidateCount Pointer to the number of selected candidates. -* It is set to zero if no BSSID matches our requirement. -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rsnSelectPmkidCandidateList ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ) -{ - P_CONNECTION_SETTINGS_T prConnSettings; - P_AIS_BSS_INFO_T prAisBssInfo; - - DEBUGFUNC("rsnSelectPmkidCandidateList"); - - ASSERT(prBssDesc); - - prConnSettings = &prAdapter->rWifiVar.rConnSettings; - prAisBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]; - - /* Search a BSS with the same SSID from the given BSS description set. */ - //DBGLOG(RSN, TRACE, ("Check scan result ["MACSTR"]\n", - // MAC2STR(prBssDesc->aucBSSID))); - - if (UNEQUAL_SSID(prBssDesc->aucSSID, prBssDesc->ucSSIDLen, - prConnSettings->aucSSID, prConnSettings->ucSSIDLen)) { - DBGLOG(RSN, TRACE, ("-- SSID not matched\n")); - return; - } - -#if 0 - if ((prBssDesc->u2BSSBasicRateSet & - ~(rPhyAttributes[prAisBssInfo->ePhyType].u2SupportedRateSet)) || - prBssDesc->fgIsUnknownBssBasicRate) { - DBGLOG(RSN, TRACE, ("-- Rate set not matched\n")); - return; - } - - if (/* prBssDesc->u4RsnSelectedPairwiseCipher != prAisBssInfo->u4RsnSelectedPairwiseCipher ||*/ - prBssDesc->u4RsnSelectedGroupCipher != prAisBssInfo->u4RsnSelectedGroupCipher /*|| - prBssDesc->u4RsnSelectedAKMSuite != prAisBssInfo->u4RsnSelectedAKMSuite */) { - DBGLOG(RSN, TRACE, ("-- Encrypt status not matched for PMKID \n")); - return; - } -#endif - - rsnUpdatePmkidCandidateList(prAdapter, prBssDesc); - -} /* rsnSelectPmkidCandidateList */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is called to select a list of BSSID from -* the scan results for PMKID candidate list. -* -* \param[in] prBssDesc the BSS DESC at scan result list -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rsnUpdatePmkidCandidateList ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc - ) -{ - UINT_32 i; - P_CONNECTION_SETTINGS_T prConnSettings; - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo; - - DEBUGFUNC("rsnUpdatePmkidCandidateList"); - - ASSERT(prBssDesc); - - prConnSettings = &prAdapter->rWifiVar.rConnSettings; - prAisSpecBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - - if (UNEQUAL_SSID(prBssDesc->aucSSID, prBssDesc->ucSSIDLen, - prConnSettings->aucSSID, prConnSettings->ucSSIDLen)) { - DBGLOG(RSN, TRACE, ("-- SSID not matched\n")); - return; - } - - for (i = 0; i < CFG_MAX_PMKID_CACHE; i++) { - if (EQUAL_MAC_ADDR(prBssDesc->aucBSSID, prAisSpecBssInfo->arPmkidCandicate[i].aucBssid)) - return; - } - - /* If the number of selected BSSID exceed MAX_NUM_PMKID_CACHE(16), - then we only store MAX_NUM_PMKID_CACHE(16) in PMKID cache */ - if ((prAisSpecBssInfo->u4PmkidCandicateCount + 1) > CFG_MAX_PMKID_CACHE) { - prAisSpecBssInfo->u4PmkidCandicateCount --; - } - - i = prAisSpecBssInfo->u4PmkidCandicateCount; - - COPY_MAC_ADDR((PVOID)prAisSpecBssInfo->arPmkidCandicate[i].aucBssid, - (PVOID)prBssDesc->aucBSSID); - - if (prBssDesc->u2RsnCap & MASK_RSNIE_CAP_PREAUTH) { - prAisSpecBssInfo->arPmkidCandicate[i].u4PreAuthFlags = 1; - DBGLOG(RSN, TRACE, ("Add " MACSTR " with pre-auth to candidate list\n", - MAC2STR(prAisSpecBssInfo->arPmkidCandicate[i].aucBssid))); - } - else { - prAisSpecBssInfo->arPmkidCandicate[i].u4PreAuthFlags = 0; - DBGLOG(RSN, TRACE, ("Add " MACSTR " without pre-auth to candidate list\n", - MAC2STR(prAisSpecBssInfo->arPmkidCandicate[i].aucBssid))); - } - - prAisSpecBssInfo->u4PmkidCandicateCount ++; - -} /* rsnUpdatePmkidCandidateList */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to search the desired entry in -* PMKID cache according to the BSSID -* -* \param[in] pucBssid Pointer to the BSSID -* \param[out] pu4EntryIndex Pointer to place the found entry index -* -* \retval TRUE, if found one entry for specified BSSID -* \retval FALSE, if not found -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rsnSearchPmkidEntry ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBssid, - OUT PUINT_32 pu4EntryIndex - ) -{ - UINT_32 i; - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo; - - DEBUGFUNC("rsnSearchPmkidEntry"); - - ASSERT(pucBssid); - ASSERT(pu4EntryIndex); - - prAisSpecBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - - if (prAisSpecBssInfo->u4PmkidCacheCount > CFG_MAX_PMKID_CACHE) { - return FALSE; - } - - ASSERT(prAisSpecBssInfo->u4PmkidCacheCount <= CFG_MAX_PMKID_CACHE); - - /* Search for desired BSSID */ - for (i = 0; i < prAisSpecBssInfo->u4PmkidCacheCount; i++) { - if (!kalMemCmp(prAisSpecBssInfo->arPmkidCache[i].rBssidInfo.arBSSID, pucBssid, - MAC_ADDR_LEN)) { - break; - } - } - - /* If desired BSSID is found, then set the PMKID */ - if (i < prAisSpecBssInfo->u4PmkidCacheCount) { - *pu4EntryIndex = i; - - return TRUE; - } - - return FALSE; -} /* rsnSearchPmkidEntry */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to check if there is difference -* between PMKID candicate list and PMKID cache. If there -* is new candicate that no cache entry is available, then -* add a new entry for the new candicate in the PMKID cache -* and set the PMKID indication flag to TRUE. -* -* \retval TRUE, if new member in the PMKID candicate list -* \retval FALSe, if no new member in the PMKID candicate list -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rsnCheckPmkidCandicate ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo; - UINT_32 i; // Index for PMKID candicate - UINT_32 j; // Indix for PMKID cache - BOOLEAN status = FALSE; - - DEBUGFUNC("rsnCheckPmkidCandicate"); - - prAisSpecBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - - /* Check for each candicate */ - for (i = 0; i < prAisSpecBssInfo->u4PmkidCandicateCount; i++) { - for (j = 0; j < prAisSpecBssInfo->u4PmkidCacheCount; j++) { - if (!kalMemCmp(prAisSpecBssInfo->arPmkidCache[j].rBssidInfo.arBSSID, - prAisSpecBssInfo->arPmkidCandicate[i].aucBssid, - MAC_ADDR_LEN)) { - //DBGLOG(RSN, TRACE, (MACSTR" at PMKID cache!!\n", MAC2STR(prAisSpecBssInfo->arPmkidCandicate[i].aucBssid))); - break; - } - } - - /* No entry found in PMKID cache for the candicate, add new one */ - if (j == prAisSpecBssInfo->u4PmkidCacheCount && prAisSpecBssInfo->u4PmkidCacheCount < CFG_MAX_PMKID_CACHE) { - DBGLOG(RSN, TRACE, ("Add "MACSTR" to PMKID cache!!\n", MAC2STR(prAisSpecBssInfo->arPmkidCandicate[i].aucBssid))); - kalMemCopy((PVOID)prAisSpecBssInfo->arPmkidCache[prAisSpecBssInfo->u4PmkidCacheCount].rBssidInfo.arBSSID, - (PVOID)prAisSpecBssInfo->arPmkidCandicate[i].aucBssid, - MAC_ADDR_LEN); - prAisSpecBssInfo->arPmkidCache[prAisSpecBssInfo->u4PmkidCacheCount].fgPmkidExist = FALSE; - prAisSpecBssInfo->u4PmkidCacheCount++; - - status = TRUE; - } - } - - return status; -} /* rsnCheckPmkidCandicate */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is called to wait a duration to indicate the pre-auth AP candicate -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -rsnIndicatePmkidCand ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Parm - ) -{ - DBGLOG(RSN, EVENT, ("Security - Time to indicate the PMKID cand.\n")); - - /* If the authentication mode is WPA2 and indication PMKID flag - is available, then we indicate the PMKID candidate list to NDIS and - clear the flag, indicatePMKID */ - - if (prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX].eConnectionState == PARAM_MEDIA_STATE_CONNECTED && - prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA2) { - rsnGeneratePmkidIndication(prAdapter); - } - - return; -} /* end of rsnIndicatePmkidCand() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to check the BSS Desc at scan result -* with pre-auth cap at wpa2 mode. If there -* is candicate that no cache entry is available, then -* add a new entry for the new candicate in the PMKID cache -* and set the PMKID indication flag to TRUE. -* -* \param[in] prBss The BSS Desc at scan result -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rsnCheckPmkidCache ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBss - ) -{ - P_AIS_BSS_INFO_T prAisBssInfo; - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - - DEBUGFUNC("rsnCheckPmkidCandicate"); - - ASSERT(prBss); - - prConnSettings = &prAdapter->rWifiVar.rConnSettings; - prAisBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]; - prAisSpecBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - - if ((prAisBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED) && - (prConnSettings->eAuthMode == AUTH_MODE_WPA2)) { - rsnSelectPmkidCandidateList(prAdapter, prBss); - - /* Set indication flag of PMKID to TRUE, and then connHandleNetworkConnection() - will indicate this later */ - if (rsnCheckPmkidCandicate(prAdapter)) { - DBGLOG(RSN, TRACE, ("Prepare a timer to indicate candidate PMKID Candidate\n")); - cnmTimerStopTimer(prAdapter, &prAisSpecBssInfo->rPreauthenticationTimer); - cnmTimerStartTimer(prAdapter, &prAisSpecBssInfo->rPreauthenticationTimer, - SEC_TO_MSEC(WAIT_TIME_IND_PMKID_CANDICATE_SEC)); - } - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to generate an PMKID candidate list -* indication to NDIS. -* -* \param[in] prAdapter Pointer to the adapter object data area. -* \param[in] u4Flags PMKID candidate list event: -* PARAM_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01 -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -rsnGeneratePmkidIndication ( - IN P_ADAPTER_T prAdapter - ) -{ - P_PARAM_STATUS_INDICATION_T prStatusEvent; - P_PARAM_PMKID_CANDIDATE_LIST_T prPmkidEvent; - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecificBssInfo; - UINT_8 i, j = 0, count = 0; - UINT_32 u4LenOfUsedBuffer; - - DEBUGFUNC("rsnGeneratePmkidIndication"); - - ASSERT(prAdapter); - - prStatusEvent = - (P_PARAM_STATUS_INDICATION_T)prAdapter->aucIndicationEventBuffer; - - /* Status type: PMKID Candidatelist Event */ - prStatusEvent->eStatusType = ENUM_STATUS_TYPE_CANDIDATE_LIST; - ASSERT(prStatusEvent); - - prPmkidEvent = (P_PARAM_PMKID_CANDIDATE_LIST_T)(&prStatusEvent->eStatusType + 1); - ASSERT(prPmkidEvent); - - prAisSpecificBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - ASSERT(prAisSpecificBssInfo); - - for (i = 0; i < prAisSpecificBssInfo->u4PmkidCandicateCount; i++) { - for (j = 0; j < prAisSpecificBssInfo->u4PmkidCacheCount; j++) { - if (EQUAL_MAC_ADDR( prAisSpecificBssInfo->arPmkidCache[j].rBssidInfo.arBSSID, - prAisSpecificBssInfo->arPmkidCandicate[i].aucBssid) && - (prAisSpecificBssInfo->arPmkidCache[j].fgPmkidExist == TRUE)){ - break; - } - } - if (count >= CFG_MAX_PMKID_CACHE) { - break; - } - - if (j == prAisSpecificBssInfo->u4PmkidCacheCount) { - kalMemCopy((PVOID)prPmkidEvent->arCandidateList[count].arBSSID, - (PVOID)prAisSpecificBssInfo->arPmkidCandicate[i].aucBssid, - PARAM_MAC_ADDR_LEN); - prPmkidEvent->arCandidateList[count].u4Flags = - prAisSpecificBssInfo->arPmkidCandicate[i].u4PreAuthFlags; - DBGLOG(RSN, TRACE, (MACSTR" %d\n", MAC2STR(prPmkidEvent->arCandidateList[count].arBSSID), - prPmkidEvent->arCandidateList[count].u4Flags)); - count++; - } - } - - /* PMKID Candidate List */ - prPmkidEvent->u4Version = 1; - prPmkidEvent->u4NumCandidates = count; - DBGLOG(RSN, TRACE, ("rsnGeneratePmkidIndication #%d\n", prPmkidEvent->u4NumCandidates)); - u4LenOfUsedBuffer = sizeof(ENUM_STATUS_TYPE_T) + (2 * sizeof(UINT_32)) + - (count * sizeof(PARAM_PMKID_CANDIDATE_T)); - //dumpMemory8((PUINT_8)prAdapter->aucIndicationEventBuffer, u4LenOfUsedBuffer); - - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_SPECIFIC_INDICATION, - (PVOID) prAdapter->aucIndicationEventBuffer, - u4LenOfUsedBuffer); - -} /* rsnGeneratePmkidIndication */ -#endif - -#if CFG_SUPPORT_WPS2 -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to generate WSC IE for -* associate request frame. -* -* \param[in] prCurrentBss The Selected BSS description -* -* \retval The append WSC IE length -* -* \note -* Called by: AIS module, Associate request -*/ -/*----------------------------------------------------------------------------*/ -VOID -rsnGenerateWSCIE ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - PUINT_8 pucBuffer; - - ASSERT(prAdapter); - ASSERT(prMsduInfo); - - if (prMsduInfo->ucNetworkType != NETWORK_TYPE_AIS_INDEX) - return; - - pucBuffer = (PUINT_8)((UINT_32)prMsduInfo->prPacket + - (UINT_32)prMsduInfo->u2FrameLength); - - /* ASSOC INFO IE ID: 221 :0xDD */ - if (prAdapter->prGlueInfo->u2WSCAssocInfoIELen) { - kalMemCopy(pucBuffer, &prAdapter->prGlueInfo->aucWSCAssocInfoIE, prAdapter->prGlueInfo->u2WSCAssocInfoIELen); - prMsduInfo->u2FrameLength += prAdapter->prGlueInfo->u2WSCAssocInfoIELen; - } - -} -#endif - - -#if CFG_SUPPORT_802_11W - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to check if the Bip Key installed or not -* -* \param[in] -* prAdapter -* -* \return -* TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -rsnCheckBipKeyInstalled ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - if (prStaRec && prStaRec->ucNetTypeIndex == (UINT_8)NETWORK_TYPE_AIS_INDEX) - return prAdapter->rWifiVar.rAisSpecificBssInfo.fgBipKeyInstalled; - else - return FALSE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to check the Sa query timeout. -* -* -* \note -* Called by: AIS module, Handle by Sa Quert timeout -*/ -/*----------------------------------------------------------------------------*/ -UINT_8 -rsnCheckSaQueryTimeout ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_SPECIFIC_BSS_INFO_T prBssSpecInfo; - UINT_32 now; - - prBssSpecInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - ASSERT(prBssSpecInfo); - - GET_CURRENT_SYSTIME(&now); - - if (CHECK_FOR_TIMEOUT(now, - prBssSpecInfo->u4SaQueryStart, - TU_TO_MSEC(1000))) { - LOG_FUNC("association SA Query timed out\n"); - - prBssSpecInfo->ucSaQueryTimedOut = 1; - kalMemFree(prBssSpecInfo->pucSaQueryTransId, VIR_MEM_TYPE, prBssSpecInfo->u4SaQueryCount * ACTION_SA_QUERY_TR_ID_LEN); - prBssSpecInfo->pucSaQueryTransId = NULL; - prBssSpecInfo->u4SaQueryCount = 0; - cnmTimerStopTimer(prAdapter, &prBssSpecInfo->rSaQueryTimer); - /* Re-connect */ - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_DISCONNECT, - NULL, - 0); - - return 1; - } - - return 0; -} - -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to start the 802.11w sa query timer. -* -* -* \note -* Called by: AIS module, Handle Rx mgmt request -*/ -/*----------------------------------------------------------------------------*/ -void rsnStartSaQueryTimer ( - IN P_ADAPTER_T prAdapter - ) -{ - P_BSS_INFO_T prBssInfo; - P_AIS_SPECIFIC_BSS_INFO_T prBssSpecInfo; - P_MSDU_INFO_T prMsduInfo; - P_ACTION_SA_QUERY_FRAME prTxFrame; - UINT_16 u2PayloadLen; - PUINT_8 pucTmp = NULL; - UINT_8 ucTransId[ACTION_SA_QUERY_TR_ID_LEN]; - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]; - ASSERT(prBssInfo); - - prBssSpecInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - ASSERT(prBssSpecInfo); - - LOG_FUNC("MFP: Start Sa Query\n"); - - if (prBssSpecInfo->u4SaQueryCount > 0 && - rsnCheckSaQueryTimeout(prAdapter)) { - LOG_FUNC("MFP: u4SaQueryCount count =%d\n", prBssSpecInfo->u4SaQueryCount); - return; - } - - prMsduInfo = (P_MSDU_INFO_T) cnmMgtPktAlloc(prAdapter, - MAC_TX_RESERVED_FIELD + PUBLIC_ACTION_MAX_LEN); - - if (!prMsduInfo) - return; - - prTxFrame = (P_ACTION_SA_QUERY_FRAME) - ((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD); - - prTxFrame->u2FrameCtrl = MAC_FRAME_ACTION; - prTxFrame->u2FrameCtrl |= MASK_FC_PROTECTED_FRAME; - - COPY_MAC_ADDR(prTxFrame->aucDestAddr, prBssInfo->aucBSSID); - COPY_MAC_ADDR(prTxFrame->aucSrcAddr, prBssInfo->aucOwnMacAddr); - COPY_MAC_ADDR(prTxFrame->aucBSSID, prBssInfo->aucBSSID); - - prTxFrame->ucCategory = CATEGORY_SA_QUERT_ACTION; - prTxFrame->ucAction = ACTION_SA_QUERY_REQUEST; - - if (prBssSpecInfo->u4SaQueryCount == 0) { - GET_CURRENT_SYSTIME(&prBssSpecInfo->u4SaQueryStart); - } - - if (prBssSpecInfo->u4SaQueryCount) { - pucTmp = kalMemAlloc(prBssSpecInfo->u4SaQueryCount * ACTION_SA_QUERY_TR_ID_LEN, VIR_MEM_TYPE); - if (!pucTmp) { - DBGLOG(RSN, INFO, ("MFP: Fail to alloc tmp buffer for backup sa query id\n")); - return; - } - kalMemCopy(pucTmp, prBssSpecInfo->pucSaQueryTransId, prBssSpecInfo->u4SaQueryCount * ACTION_SA_QUERY_TR_ID_LEN); - } - - kalMemFree(prBssSpecInfo->pucSaQueryTransId, VIR_MEM_TYPE, prBssSpecInfo->u4SaQueryCount * ACTION_SA_QUERY_TR_ID_LEN); - - ucTransId[0] = (UINT_8)(kalRandomNumber() & 0xFF); - ucTransId[1] = (UINT_8)(kalRandomNumber() & 0xFF); - - kalMemCopy(prTxFrame->ucTransId, ucTransId, ACTION_SA_QUERY_TR_ID_LEN); - - prBssSpecInfo->u4SaQueryCount++; - - prBssSpecInfo->pucSaQueryTransId = kalMemAlloc(prBssSpecInfo->u4SaQueryCount * ACTION_SA_QUERY_TR_ID_LEN, VIR_MEM_TYPE); - if (!prBssSpecInfo->pucSaQueryTransId) { - DBGLOG(RSN, INFO, ("MFP: Fail to alloc buffer for sa query id list\n")); - return; - } - - if (pucTmp) { - kalMemCopy(prBssSpecInfo->pucSaQueryTransId, pucTmp, (prBssSpecInfo->u4SaQueryCount - 1) * ACTION_SA_QUERY_TR_ID_LEN); - kalMemCopy(&prBssSpecInfo->pucSaQueryTransId[(prBssSpecInfo->u4SaQueryCount - 1) * ACTION_SA_QUERY_TR_ID_LEN], - ucTransId, ACTION_SA_QUERY_TR_ID_LEN); - kalMemFree(pucTmp, VIR_MEM_TYPE, (prBssSpecInfo->u4SaQueryCount - 1) * ACTION_SA_QUERY_TR_ID_LEN); - } - else { - kalMemCopy(prBssSpecInfo->pucSaQueryTransId, ucTransId, ACTION_SA_QUERY_TR_ID_LEN); - } - - u2PayloadLen = 2 + ACTION_SA_QUERY_TR_ID_LEN; - - //4 Update information of MSDU_INFO_T - prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_MGMT; /* Management frame */ - prMsduInfo->ucStaRecIndex = prBssInfo->prStaRecOfAP->ucIndex; - prMsduInfo->ucNetworkType = prBssInfo->ucNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_MGMT_HEADER_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = WLAN_MAC_MGMT_HEADER_LEN + u2PayloadLen; - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = NULL; - prMsduInfo->fgIsBasicRate = FALSE; - - //4 Enqueue the frame to send this action frame. - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - - DBGLOG(RSN, TRACE, ("Set SA Query timer %d (%d sec)\n", prBssSpecInfo->u4SaQueryCount, prBssInfo->u2ObssScanInterval)); - - cnmTimerStartTimer(prAdapter, &prBssSpecInfo->rSaQueryTimer, - TU_TO_MSEC(201)); - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to start the 802.11w sa query. -* -* -* \note -* Called by: AIS module, Handle Rx mgmt request -*/ -/*----------------------------------------------------------------------------*/ -void rsnStartSaQuery ( - IN P_ADAPTER_T prAdapter - ) -{ - rsnStartSaQueryTimer(prAdapter); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to stop the 802.11w sa query. -* -* -* \note -* Called by: AIS module, Handle Rx mgmt request -*/ -/*----------------------------------------------------------------------------*/ -void rsnStopSaQuery ( - IN P_ADAPTER_T prAdapter - ) -{ - P_AIS_SPECIFIC_BSS_INFO_T prBssSpecInfo; - - prBssSpecInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - ASSERT(prBssSpecInfo); - - cnmTimerStopTimer(prAdapter, &prBssSpecInfo->rSaQueryTimer); - kalMemFree(prBssSpecInfo->pucSaQueryTransId, VIR_MEM_TYPE, prBssSpecInfo->u4SaQueryCount * ACTION_SA_QUERY_TR_ID_LEN); - prBssSpecInfo->pucSaQueryTransId = NULL; - prBssSpecInfo->u4SaQueryCount = 0; -} - -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to process the 802.11w sa query action frame. -* -* -* \note -* Called by: AIS module, Handle Rx mgmt request -*/ -/*----------------------------------------------------------------------------*/ -void -rsnSaQueryRequest ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_BSS_INFO_T prBssInfo; - P_MSDU_INFO_T prMsduInfo; - P_ACTION_SA_QUERY_FRAME prRxFrame = NULL; - UINT_16 u2PayloadLen; - P_STA_RECORD_T prStaRec; - P_ACTION_SA_QUERY_FRAME prTxFrame; - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]; - ASSERT(prBssInfo); - - prRxFrame = (P_ACTION_SA_QUERY_FRAME)prSwRfb->pvHeader; - if (!prRxFrame) - return; - - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - - DBGLOG(RSN, TRACE, ("IEEE 802.11: Received SA Query Request from " - MACSTR"\n", MAC2STR(prStaRec->aucMacAddr))); - - DBGLOG_MEM8(RSN, TRACE, prRxFrame->ucTransId, - ACTION_SA_QUERY_TR_ID_LEN); - - if (kalGetMediaStateIndicated(prAdapter->prGlueInfo) == PARAM_MEDIA_STATE_DISCONNECTED) { - DBGLOG(RSN, TRACE, ("IEEE 802.11: Ignore SA Query Request " - "from unassociated STA " MACSTR"\n", MAC2STR(prStaRec->aucMacAddr))); - return; - } - DBGLOG(RSN, TRACE, ("IEEE 802.11: Sending SA Query Response to " - MACSTR"\n", MAC2STR(prStaRec->aucMacAddr))); - - prMsduInfo = (P_MSDU_INFO_T) cnmMgtPktAlloc(prAdapter, - MAC_TX_RESERVED_FIELD + PUBLIC_ACTION_MAX_LEN); - - if (!prMsduInfo) - return; - - prTxFrame = (P_ACTION_SA_QUERY_FRAME) - ((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD); - - prTxFrame->u2FrameCtrl = MAC_FRAME_ACTION; - /* SA Query always with protected */ - prTxFrame->u2FrameCtrl |= MASK_FC_PROTECTED_FRAME; - - COPY_MAC_ADDR(prTxFrame->aucDestAddr, prBssInfo->aucBSSID); - COPY_MAC_ADDR(prTxFrame->aucSrcAddr, prBssInfo->aucOwnMacAddr); - COPY_MAC_ADDR(prTxFrame->aucBSSID, prBssInfo->aucBSSID); - - prTxFrame->ucCategory = CATEGORY_SA_QUERT_ACTION; - prTxFrame->ucAction = ACTION_SA_QUERY_RESPONSE; - - kalMemCopy(prTxFrame->ucTransId, - prRxFrame->ucTransId, - ACTION_SA_QUERY_TR_ID_LEN); - - u2PayloadLen = 2 + ACTION_SA_QUERY_TR_ID_LEN; - - //4 Update information of MSDU_INFO_T - prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_MGMT; /* Management frame */ - prMsduInfo->ucStaRecIndex = prBssInfo->prStaRecOfAP->ucIndex; - prMsduInfo->ucNetworkType = prBssInfo->ucNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_MGMT_HEADER_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = WLAN_MAC_MGMT_HEADER_LEN + u2PayloadLen; - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = NULL; - prMsduInfo->fgIsBasicRate = FALSE; - - //4 Enqueue the frame to send this action frame. - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to process the 802.11w sa query action frame. -* -* -* \note -* Called by: AIS module, Handle Rx mgmt request -*/ -/*----------------------------------------------------------------------------*/ -void -rsnSaQueryAction ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_AIS_SPECIFIC_BSS_INFO_T prBssSpecInfo; - P_ACTION_SA_QUERY_FRAME prRxFrame; - P_STA_RECORD_T prStaRec; - UINT_32 i; - - prBssSpecInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - ASSERT(prBssSpecInfo); - - prRxFrame = (P_ACTION_SA_QUERY_FRAME) prSwRfb->pvHeader; - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - - if (prSwRfb->u2PacketLen < ACTION_SA_QUERY_TR_ID_LEN) { - DBGLOG(RSN, TRACE, ("IEEE 802.11: Too short SA Query Action " - "frame (len=%lu)\n", (unsigned long) prSwRfb->u2PacketLen)); - return; - } - - if (prRxFrame->ucAction == ACTION_SA_QUERY_REQUEST) { - rsnSaQueryRequest(prAdapter, prSwRfb); - return; - } - - if (prRxFrame->ucAction != ACTION_SA_QUERY_RESPONSE) { - DBGLOG(RSN, TRACE, ("IEEE 802.11: Unexpected SA Query " - "Action %d\n", prRxFrame->ucAction)); - return; - } - - DBGLOG(RSN, TRACE, ("IEEE 802.11: Received SA Query Response from " - MACSTR"\n", MAC2STR(prStaRec->aucMacAddr))); - - DBGLOG_MEM8(RSN, TRACE, prRxFrame->ucTransId, - ACTION_SA_QUERY_TR_ID_LEN); - - /* MLME-SAQuery.confirm */ - - for (i = 0; i < prBssSpecInfo->u4SaQueryCount; i++) { - if (kalMemCmp(prBssSpecInfo->pucSaQueryTransId + - i * ACTION_SA_QUERY_TR_ID_LEN, - prRxFrame->ucTransId, - ACTION_SA_QUERY_TR_ID_LEN) == 0) - break; - } - - if (i >= prBssSpecInfo->u4SaQueryCount) { - DBGLOG(RSN, TRACE, ("IEEE 802.11: No matching SA Query " - "transaction identifier found\n")); - return; - } - - DBGLOG(RSN, TRACE, ("Reply to pending SA Query received\n")); - - rsnStopSaQuery(prAdapter); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to process the 802.11w mgmt frame. -* -* -* \note -* Called by: AIS module, Handle Rx mgmt request -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -rsnCheckRxMgmt ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN UINT_8 ucSubtype - ) -{ - P_HIF_RX_HEADER_T prHifRxHdr; - BOOLEAN fgUnicast = TRUE; - BOOLEAN fgRobustAction = FALSE; - - prHifRxHdr = prSwRfb->prHifRxHdr; - - if ((HIF_RX_HDR_GET_NETWORK_IDX(prHifRxHdr) == NETWORK_TYPE_AIS_INDEX) && - prAdapter->rWifiVar.rAisSpecificBssInfo.fgMgmtProtection /* Use MFP */) { - - P_WLAN_ASSOC_REQ_FRAME_T prAssocReqFrame; - prAssocReqFrame = (P_WLAN_ASSOC_REQ_FRAME_T) prSwRfb->pvHeader; - - if (prAssocReqFrame->aucDestAddr[0] & BIT(0)) - fgUnicast = FALSE; - - LOG_FUNC("QM RX MGT: rsnCheckRxMgmt = %d 0x%x %d ucSubtype=%x\n", fgUnicast, prHifRxHdr->ucReserved, (prHifRxHdr->ucReserved & CONTROL_FLAG_UC_MGMT_NO_ENC), ucSubtype); - - if (prHifRxHdr->ucReserved & CONTROL_FLAG_UC_MGMT_NO_ENC) { - /* "Dropped unprotected Robust Action frame from an MFP STA" */ - /* exclude Public Action */ - if (ucSubtype == 13 /* 0x1011: MAC_FRAME_ACTION */) - { - UINT_8 ucAction = *prSwRfb->pucRecvBuff; - if (ucAction != CATEGORY_PUBLIC_ACTION && ucAction != CATEGORY_HT_ACTION) { -#if DBG && CFG_RX_PKTS_DUMP - LOG_FUNC("QM RX MGT: UnProtected Robust Action frame = %d\n", ucAction); -#endif - fgRobustAction = TRUE; - return TRUE; - } - } - if (fgUnicast && ((ucSubtype == 10 /* 0x1010: MAC_FRAME_DISASSOC */) || (ucSubtype == 12 /* 0x1100: MAC_FRAME_DEAUTH */))) { - LOG_FUNC("QM RX MGT: rsnStartSaQuery\n"); - /* MFP test plan 5.3.3.5 */ - rsnStartSaQuery(prAdapter); - return TRUE; - } - } -#if 0 - else { - if (fgUnicast && ((ucSubtype == MAC_FRAME_DISASSOC) || (ucSubtype == MAC_FRAME_DEAUTH))) { - /* This done by function handler */ - //kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - // WLAN_STATUS_MEDIA_DISCONNECT, - // NULL, - // 0); - } - } -#endif - } - return FALSE; -} -#endif - diff --git a/drivers/net/wireless/mt5931/mgmt/saa_fsm.c b/drivers/net/wireless/mt5931/mgmt/saa_fsm.c deleted file mode 100755 index 65eee2b53fe3..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/saa_fsm.c +++ /dev/null @@ -1,2022 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/saa_fsm.c#2 $ -*/ - -/*! \file "saa_fsm.c" - \brief This file defines the FSM for SAA MODULE. - - This file defines the FSM for SAA MODULE. -*/ - - - -/* -** $Log: saa_fsm.c $ - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 04 20 2012 cp.wu - * [WCXRP00000913] [MT6620 Wi-Fi] create repository of source code dedicated for MT6620 E6 ASIC - * correct macro - * - * 11 24 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * Adjust code for DBG and CONFIG_XLOG. - * - * 11 11 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * modify the xlog related code. - * - * 11 04 2011 cp.wu - * [WCXRP00001086] [MT6620 Wi-Fi][Driver] On Android, indicate an extra DISCONNECT for REASSOCIATED cases as an explicit trigger for Android framework - * 1. for DEAUTH/DISASSOC cases, indicate for DISCONNECTION immediately. - * 2. (Android only) when reassociation-and-non-roaming cases happened, indicate an extra DISCONNECT indication to Android Wi-Fi framework - * - * 11 02 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * adding the code for XLOG. - * - * 09 30 2011 cm.chang - * [WCXRP00001020] [MT6620 Wi-Fi][Driver] Handle secondary channel offset of AP in 5GHz band - * Add debug message about 40MHz bandwidth allowed - * - * 05 12 2011 cp.wu - * [WCXRP00000720] [MT6620 Wi-Fi][Driver] Do not do any further operation in case STA-REC has been invalidated before SAA-FSM starts to roll - * check for valid STA-REC before SAA-FSM starts to roll. - * - * 04 21 2011 terry.wu - * [WCXRP00000674] [MT6620 Wi-Fi][Driver] Refine AAA authSendAuthFrame - * Add network type parameter to authSendAuthFrame. - * - * 04 15 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add BOW short range mode. - * - * 04 14 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * . - * - * 03 31 2011 puff.wen - * NULL - * . - * - * 02 10 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * Add RX deauthentication & disassociation process under Hot-Spot mode. - * - * 01 26 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * . - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Fix compile error of after Station Type Macro modification. - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Change Station Type in Station Record, Modify MACRO definition for getting station type & network type index & Role. - * - * 11 29 2010 cp.wu - * [WCXRP00000210] [MT6620 Wi-Fi][Driver][FW] Set RCPI value in STA_REC for initial TX rate selection of auto-rate algorithm - * update ucRcpi of STA_RECORD_T for AIS when - * 1) Beacons for IBSS merge is received - * 2) Associate Response for a connecting peer is received - * - * 10 18 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * 1. remove redundant variables in STA_REC structure - * 2. add STA-REC uninitialization routine for clearing pending events - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 30 2010 cp.wu - * NULL - * eliminate klockwork errors - * - * 08 24 2010 chinghwa.yu - * NULL - * Update for MID_SCN_BOW_SCAN_DONE mboxDummy. - * Update saa_fsm for BOW. - * - * 08 16 2010 cp.wu - * NULL - * Replace CFG_SUPPORT_BOW by CFG_ENABLE_BT_OVER_WIFI. - * There is no CFG_SUPPORT_BOW in driver domain source. - * - * 08 02 2010 yuche.tsai - * NULL - * Add support for P2P join event start. - * - * 07 12 2010 cp.wu - * - * SAA will take a record for tracking request sequence number. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * AIS-FSM integration with CNM channel request messages - * - * 06 23 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * sync. with main branch for reseting to state 1 when associating with another AP - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * refine TX-DONE callback. - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * remove duplicate variable for migration. - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 18 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * migration the security related function from firmware. - * - * 06 17 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Fix compile error when enable WiFi Direct function. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * saa_fsm.c is migrated. - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 04 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW - * - * 04 19 2010 kevin.huang - * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support - * - * * * Add Connection Policy - Any and Rx Burst Deauth Support for WHQL - * - * 03 10 2010 kevin.huang - * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support - * Add Channel Manager for arbitration of JOIN and SCAN Req - * - * 02 26 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add support of Driver STA_RECORD_T activation - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * 01 27 2010 wh.su - * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code - * add and fixed some security function. - * - * 01 12 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Fix compile warning due to declared but not used - * - * 01 11 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add Deauth and Disassoc Handler - * - * 01 08 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Refine Debug Label - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * Dec 3 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Update comment - * - * Dec 1 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * rename the function - * - * Nov 24 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Revise MGMT Handler with Retain Status - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ -#if DBG -/*lint -save -e64 Type mismatch */ -static PUINT_8 apucDebugAAState[AA_STATE_NUM] = { - (PUINT_8)DISP_STRING("AA_STATE_IDLE"), - (PUINT_8)DISP_STRING("SAA_STATE_SEND_AUTH1"), - (PUINT_8)DISP_STRING("SAA_STATE_WAIT_AUTH2"), - (PUINT_8)DISP_STRING("SAA_STATE_SEND_AUTH3"), - (PUINT_8)DISP_STRING("SAA_STATE_WAIT_AUTH4"), - (PUINT_8)DISP_STRING("SAA_STATE_SEND_ASSOC1"), - (PUINT_8)DISP_STRING("SAA_STATE_WAIT_ASSOC2"), - (PUINT_8)DISP_STRING("AAA_STATE_SEND_AUTH2"), - (PUINT_8)DISP_STRING("AAA_STATE_SEND_AUTH4"), - (PUINT_8)DISP_STRING("AAA_STATE_SEND_ASSOC2"), - (PUINT_8)DISP_STRING("AA_STATE_RESOURCE") -}; -/*lint -restore */ -#endif /* DBG */ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/*! -* @brief The Core FSM engine of SAA Module. -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] eNextState The value of Next State -* @param[in] prRetainedSwRfb Pointer to the retained SW_RFB_T for JOIN Success -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -saaFsmSteps ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN ENUM_AA_STATE_T eNextState, - IN P_SW_RFB_T prRetainedSwRfb - ) -{ - ENUM_AA_STATE_T ePreviousState; - BOOLEAN fgIsTransition; - - - ASSERT(prStaRec); - if(!prStaRec) { - return; - } - - do { - -#if DBG - DBGLOG(SAA, STATE, ("TRANSITION: [%s] -> [%s]\n", - apucDebugAAState[prStaRec->eAuthAssocState], - apucDebugAAState[eNextState])); -#else - DBGLOG(SAA, STATE, ("[%d] TRANSITION: [%d] -> [%d]\n", - DBG_SAA_IDX, - prStaRec->eAuthAssocState, - eNextState)); -#endif - ePreviousState = prStaRec->eAuthAssocState; - - /* NOTE(Kevin): This is the only place to change the eAuthAssocState(except initial) */ - prStaRec->eAuthAssocState = eNextState; - - - fgIsTransition = (BOOLEAN)FALSE; - switch (prStaRec->eAuthAssocState) { - case AA_STATE_IDLE: - { - if (ePreviousState != prStaRec->eAuthAssocState) { /* Only trigger this event once */ - - if (prRetainedSwRfb) { - - if (saaFsmSendEventJoinComplete(prAdapter, - WLAN_STATUS_SUCCESS, - prStaRec, - prRetainedSwRfb) == WLAN_STATUS_SUCCESS) { - } - else { - eNextState = AA_STATE_RESOURCE; - fgIsTransition = TRUE; - } - } - else { - if (saaFsmSendEventJoinComplete(prAdapter, - WLAN_STATUS_FAILURE, - prStaRec, - NULL) == WLAN_STATUS_RESOURCES) { - eNextState = AA_STATE_RESOURCE; - fgIsTransition = TRUE; - } - } - - } - - /* Free allocated TCM memory */ - if (prStaRec->prChallengeText) { - cnmMemFree(prAdapter, prStaRec->prChallengeText); - prStaRec->prChallengeText = (P_IE_CHALLENGE_TEXT_T)NULL; - } - } - break; - - case SAA_STATE_SEND_AUTH1: - { - /* Do tasks in INIT STATE */ - if (prStaRec->ucTxAuthAssocRetryCount >= - prStaRec->ucTxAuthAssocRetryLimit) { - - /* Record the Status Code of Authentication Request */ - prStaRec->u2StatusCode = STATUS_CODE_AUTH_TIMEOUT; - - eNextState = AA_STATE_IDLE; - fgIsTransition = TRUE; - } - else { - prStaRec->ucTxAuthAssocRetryCount++; - - /* Update Station Record - Class 1 Flag */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - -#if !CFG_SUPPORT_AAA - if (authSendAuthFrame(prAdapter, - prStaRec, - AUTH_TRANSACTION_SEQ_1) != WLAN_STATUS_SUCCESS) -#else - if (authSendAuthFrame( - prAdapter, - prStaRec, - prStaRec->ucNetTypeIndex, - NULL, - AUTH_TRANSACTION_SEQ_1, - STATUS_CODE_RESERVED) != WLAN_STATUS_SUCCESS) -#endif /* CFG_SUPPORT_AAA */ - { - - cnmTimerInitTimer(prAdapter, - &prStaRec->rTxReqDoneOrRxRespTimer, - (PFN_MGMT_TIMEOUT_FUNC)saaFsmRunEventTxReqTimeOut, - (UINT_32)prStaRec); - - cnmTimerStartTimer(prAdapter, - &prStaRec->rTxReqDoneOrRxRespTimer, - TU_TO_MSEC(TX_AUTHENTICATION_RETRY_TIMEOUT_TU)); - } - } - } - break; - - case SAA_STATE_WAIT_AUTH2: - break; - - case SAA_STATE_SEND_AUTH3: - { - /* Do tasks in INIT STATE */ - if (prStaRec->ucTxAuthAssocRetryCount >= - prStaRec->ucTxAuthAssocRetryLimit) { - - /* Record the Status Code of Authentication Request */ - prStaRec->u2StatusCode = STATUS_CODE_AUTH_TIMEOUT; - - eNextState = AA_STATE_IDLE; - fgIsTransition = TRUE; - } - else { - prStaRec->ucTxAuthAssocRetryCount++; - -#if !CFG_SUPPORT_AAA - if (authSendAuthFrame(prAdapter, - prStaRec, - AUTH_TRANSACTION_SEQ_3) != WLAN_STATUS_SUCCESS) -#else - if (authSendAuthFrame(prAdapter, - prStaRec, - prStaRec->ucNetTypeIndex, - NULL, - AUTH_TRANSACTION_SEQ_3, - STATUS_CODE_RESERVED) != WLAN_STATUS_SUCCESS) -#endif /* CFG_SUPPORT_AAA */ - { - - cnmTimerInitTimer(prAdapter, - &prStaRec->rTxReqDoneOrRxRespTimer, - (PFN_MGMT_TIMEOUT_FUNC)saaFsmRunEventTxReqTimeOut, - (UINT_32)prStaRec); - - cnmTimerStartTimer(prAdapter, - &prStaRec->rTxReqDoneOrRxRespTimer, - TU_TO_MSEC(TX_AUTHENTICATION_RETRY_TIMEOUT_TU)); - } - } - } - break; - - case SAA_STATE_WAIT_AUTH4: - break; - - case SAA_STATE_SEND_ASSOC1: - /* Do tasks in INIT STATE */ - if (prStaRec->ucTxAuthAssocRetryCount >= - prStaRec->ucTxAuthAssocRetryLimit) { - - /* Record the Status Code of Authentication Request */ - prStaRec->u2StatusCode = STATUS_CODE_ASSOC_TIMEOUT; - - eNextState = AA_STATE_IDLE; - fgIsTransition = TRUE; - } - else { - prStaRec->ucTxAuthAssocRetryCount++; - - if (assocSendReAssocReqFrame(prAdapter, prStaRec) != WLAN_STATUS_SUCCESS) { - - cnmTimerInitTimer(prAdapter, - &prStaRec->rTxReqDoneOrRxRespTimer, - (PFN_MGMT_TIMEOUT_FUNC)saaFsmRunEventTxReqTimeOut, - (UINT_32)prStaRec); - - cnmTimerStartTimer(prAdapter, - &prStaRec->rTxReqDoneOrRxRespTimer, - TU_TO_MSEC(TX_ASSOCIATION_RETRY_TIMEOUT_TU)); - } - } - - break; - - case SAA_STATE_WAIT_ASSOC2: - break; - - case AA_STATE_RESOURCE: - /* TODO(Kevin) Can setup a timer and send message later */ - break; - - default: - DBGLOG(SAA, ERROR, ("Unknown AA STATE\n")); - ASSERT(0); - break; - } - - } - while (fgIsTransition); - - return; - -} /* end of saaFsmSteps() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will send Event to AIS/BOW/P2P -* -* @param[in] rJoinStatus To indicate JOIN success or failure. -* @param[in] prStaRec Pointer to the STA_RECORD_T -* @param[in] prSwRfb Pointer to the SW_RFB_T - -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -saaFsmSendEventJoinComplete ( - IN P_ADAPTER_T prAdapter, - IN WLAN_STATUS rJoinStatus, - IN P_STA_RECORD_T prStaRec, - IN P_SW_RFB_T prSwRfb - ) -{ - P_BSS_INFO_T prBssInfo; - - ASSERT(prStaRec); - if(!prStaRec) { - return WLAN_STATUS_INVALID_PACKET; - } - - /* Store limitation about 40Mhz bandwidth capability during association */ - if (prStaRec->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM) { - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]; - - if (rJoinStatus == WLAN_STATUS_SUCCESS) { - prBssInfo->fg40mBwAllowed = prBssInfo->fgAssoc40mBwAllowed; - } - prBssInfo->fgAssoc40mBwAllowed = FALSE; - } - - if(prStaRec->ucNetTypeIndex == NETWORK_TYPE_AIS_INDEX) { - P_MSG_SAA_FSM_COMP_T prSaaFsmCompMsg; - - prSaaFsmCompMsg = cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_SAA_FSM_COMP_T)); - if (!prSaaFsmCompMsg) { - return WLAN_STATUS_RESOURCES; - } - - prSaaFsmCompMsg->rMsgHdr.eMsgId = MID_SAA_AIS_JOIN_COMPLETE; - prSaaFsmCompMsg->ucSeqNum = prStaRec->ucAuthAssocReqSeqNum; - prSaaFsmCompMsg->rJoinStatus = rJoinStatus; - prSaaFsmCompMsg->prStaRec = prStaRec; - prSaaFsmCompMsg->prSwRfb = prSwRfb; - - /* NOTE(Kevin): Set to UNBUF for immediately JOIN complete */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prSaaFsmCompMsg, - MSG_SEND_METHOD_UNBUF); - - return WLAN_STATUS_SUCCESS; - } -#if CFG_ENABLE_WIFI_DIRECT - else if ((prAdapter->fgIsP2PRegistered) && - (IS_STA_IN_P2P(prStaRec))) { - P_MSG_SAA_FSM_COMP_T prSaaFsmCompMsg; - - prSaaFsmCompMsg = cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_SAA_FSM_COMP_T)); - if (!prSaaFsmCompMsg) { - return WLAN_STATUS_RESOURCES; - } - - prSaaFsmCompMsg->rMsgHdr.eMsgId = MID_SAA_P2P_JOIN_COMPLETE; - prSaaFsmCompMsg->ucSeqNum = prStaRec->ucAuthAssocReqSeqNum; - prSaaFsmCompMsg->rJoinStatus = rJoinStatus; - prSaaFsmCompMsg->prStaRec = prStaRec; - prSaaFsmCompMsg->prSwRfb = prSwRfb; - - /* NOTE(Kevin): Set to UNBUF for immediately JOIN complete */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prSaaFsmCompMsg, - MSG_SEND_METHOD_UNBUF); - - return WLAN_STATUS_SUCCESS; - } -#endif -#if CFG_ENABLE_BT_OVER_WIFI - else if(prStaRec->ucNetTypeIndex == NETWORK_TYPE_BOW_INDEX) { - //@TODO: BOW handler - - P_MSG_SAA_FSM_COMP_T prSaaFsmCompMsg; - - prSaaFsmCompMsg = cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_SAA_FSM_COMP_T)); - if (!prSaaFsmCompMsg) { - return WLAN_STATUS_RESOURCES; - } - - prSaaFsmCompMsg->rMsgHdr.eMsgId = MID_SAA_BOW_JOIN_COMPLETE; - prSaaFsmCompMsg->ucSeqNum = prStaRec->ucAuthAssocReqSeqNum; - prSaaFsmCompMsg->rJoinStatus = rJoinStatus; - prSaaFsmCompMsg->prStaRec = prStaRec; - prSaaFsmCompMsg->prSwRfb = prSwRfb; - - /* NOTE(Kevin): Set to UNBUF for immediately JOIN complete */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prSaaFsmCompMsg, - MSG_SEND_METHOD_UNBUF); - - return WLAN_STATUS_SUCCESS; - } -#endif - else { - ASSERT(0); - return WLAN_STATUS_FAILURE; - } - -} /* end of saaFsmSendEventJoinComplete() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will handle the Start Event to SAA FSM. -* -* @param[in] prMsgHdr Message of Join Request for a particular STA. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -saaFsmRunEventStart ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_SAA_FSM_START_T prSaaFsmStartMsg; - P_STA_RECORD_T prStaRec; - P_BSS_INFO_T prBssInfo; - - ASSERT(prAdapter); - ASSERT(prMsgHdr); - - prSaaFsmStartMsg = (P_MSG_SAA_FSM_START_T)prMsgHdr; - prStaRec = prSaaFsmStartMsg->prStaRec; - - if((!prStaRec) || (prStaRec->fgIsInUse == FALSE)) { - cnmMemFree(prAdapter, prMsgHdr); - return; - } - - ASSERT(prStaRec); - - DBGLOG(SAA, LOUD, ("EVENT-START: Trigger SAA FSM.\n")); - - /* record sequence number of request message */ - prStaRec->ucAuthAssocReqSeqNum = prSaaFsmStartMsg->ucSeqNum; - - cnmMemFree(prAdapter, prMsgHdr); - - //4 <1> Validation of SAA Start Event - if (!IS_AP_STA(prStaRec)) { - - DBGLOG(SAA, ERROR, ("EVENT-START: STA Type - %d was not supported.\n", prStaRec->eStaType)); - - /* Ignore the return value because don't care the prSwRfb */ - saaFsmSendEventJoinComplete(prAdapter, WLAN_STATUS_FAILURE, prStaRec, NULL); - - return; - } - - //4 <2> The previous JOIN process is not completed ? - if (prStaRec->eAuthAssocState != AA_STATE_IDLE) { - DBGLOG(SAA, ERROR, ("EVENT-START: Reentry of SAA Module.\n")); - prStaRec->eAuthAssocState = AA_STATE_IDLE; - } - - //4 <3> Reset Status Code and Time - /* Update Station Record - Status/Reason Code */ - prStaRec->u2StatusCode = STATUS_CODE_SUCCESSFUL; - - /* Update the record join time. */ - GET_CURRENT_SYSTIME(&prStaRec->rLastJoinTime); - - prStaRec->ucTxAuthAssocRetryCount = 0; - - if (prStaRec->prChallengeText) { - cnmMemFree(prAdapter, prStaRec->prChallengeText); - prStaRec->prChallengeText = (P_IE_CHALLENGE_TEXT_T)NULL; - } - - cnmTimerStopTimer(prAdapter, &prStaRec->rTxReqDoneOrRxRespTimer); - -#if CFG_PRIVACY_MIGRATION - //4 <4> Init the sec fsm - secFsmInit(prAdapter, prStaRec); -#endif - - //4 <5> Reset the STA STATE - /* Update Station Record - Class 1 Flag */ - /* NOTE(Kevin): Moved to AIS FSM for Reconnect issue - - * We won't deactivate the same STA_RECORD_T and then activate it again for the - * case of reconnection. - */ - //cnmStaRecChangeState(prStaRec, STA_STATE_1); - - //4 <6> Decide if this BSS 20/40M bandwidth is allowed - if (prStaRec->ucNetTypeIndex < NETWORK_TYPE_INDEX_NUM) { - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]; - - if ((prAdapter->rWifiVar.ucAvailablePhyTypeSet & PHY_TYPE_SET_802_11N) - && (prStaRec->ucPhyTypeSet & PHY_TYPE_SET_802_11N)) { - prBssInfo->fgAssoc40mBwAllowed = - cnmBss40mBwPermitted(prAdapter, prBssInfo->ucNetTypeIndex); - } - else { - prBssInfo->fgAssoc40mBwAllowed = FALSE; - } - DBGLOG(RLM, INFO, ("STA 40mAllowed=%d\n", prBssInfo->fgAssoc40mBwAllowed)); - } - - //4 <7> Trigger SAA FSM - saaFsmSteps(prAdapter, prStaRec, SAA_STATE_SEND_AUTH1, (P_SW_RFB_T)NULL); - - return; -} /* end of saaFsmRunEventStart() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will handle TxDone(Auth1/Auth3/AssocReq) Event of SAA FSM. -* -* @param[in] prMsduInfo Pointer to the MSDU_INFO_T. -* @param[in] rTxDoneStatus Return TX status of the Auth1/Auth3/AssocReq frame. -* -* @retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -saaFsmRunEventTxDone ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ) -{ - - P_STA_RECORD_T prStaRec; - ENUM_AA_STATE_T eNextState; - - - ASSERT(prMsduInfo); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - if(!prStaRec) { - return WLAN_STATUS_INVALID_PACKET; - } - - ASSERT(prStaRec); - - DBGLOG(SAA, LOUD, ("EVENT-TX DONE: Current Time = %ld\n", kalGetTimeTick())); - - eNextState = prStaRec->eAuthAssocState; - - switch (prStaRec->eAuthAssocState) { - case SAA_STATE_SEND_AUTH1: - { - /* Strictly check the outgoing frame is matched with current AA STATE */ - if (authCheckTxAuthFrame(prAdapter, - prMsduInfo, - AUTH_TRANSACTION_SEQ_1) != WLAN_STATUS_SUCCESS) { - break; - } - - if (rTxDoneStatus == TX_RESULT_SUCCESS) { - eNextState = SAA_STATE_WAIT_AUTH2; - - cnmTimerStopTimer(prAdapter, - &prStaRec->rTxReqDoneOrRxRespTimer); - - cnmTimerInitTimer(prAdapter, - &prStaRec->rTxReqDoneOrRxRespTimer, - (PFN_MGMT_TIMEOUT_FUNC)saaFsmRunEventRxRespTimeOut, - (UINT_32)prStaRec); - - cnmTimerStartTimer(prAdapter, - &prStaRec->rTxReqDoneOrRxRespTimer, - TU_TO_MSEC(DOT11_AUTHENTICATION_RESPONSE_TIMEOUT_TU)); - } - - /* if TX was successful, change to next state. - * if TX was failed, do retry if possible. - */ - saaFsmSteps(prAdapter, prStaRec, eNextState, (P_SW_RFB_T)NULL); - } - break; - - case SAA_STATE_SEND_AUTH3: - { - /* Strictly check the outgoing frame is matched with current JOIN STATE */ - if (authCheckTxAuthFrame(prAdapter, - prMsduInfo, - AUTH_TRANSACTION_SEQ_3) != WLAN_STATUS_SUCCESS) { - break; - } - - if (rTxDoneStatus == TX_RESULT_SUCCESS) { - eNextState = SAA_STATE_WAIT_AUTH4; - - cnmTimerStopTimer(prAdapter, - &prStaRec->rTxReqDoneOrRxRespTimer); - - cnmTimerInitTimer(prAdapter, - &prStaRec->rTxReqDoneOrRxRespTimer, - (PFN_MGMT_TIMEOUT_FUNC)saaFsmRunEventRxRespTimeOut, - (UINT_32)prStaRec); - - cnmTimerStartTimer(prAdapter, - &prStaRec->rTxReqDoneOrRxRespTimer, - TU_TO_MSEC(DOT11_AUTHENTICATION_RESPONSE_TIMEOUT_TU)); - } - - /* if TX was successful, change to next state. - * if TX was failed, do retry if possible. - */ - saaFsmSteps(prAdapter, prStaRec, eNextState, (P_SW_RFB_T)NULL); - } - break; - - case SAA_STATE_SEND_ASSOC1: - { - /* Strictly check the outgoing frame is matched with current SAA STATE */ - if (assocCheckTxReAssocReqFrame(prAdapter, prMsduInfo) != WLAN_STATUS_SUCCESS) { - break; - } - - if (rTxDoneStatus == TX_RESULT_SUCCESS) { - eNextState = SAA_STATE_WAIT_ASSOC2; - - cnmTimerStopTimer(prAdapter, &prStaRec->rTxReqDoneOrRxRespTimer); - - cnmTimerInitTimer(prAdapter, - &prStaRec->rTxReqDoneOrRxRespTimer, - (PFN_MGMT_TIMEOUT_FUNC)saaFsmRunEventRxRespTimeOut, - (UINT_32)prStaRec); - - cnmTimerStartTimer(prAdapter, - &(prStaRec->rTxReqDoneOrRxRespTimer), - TU_TO_MSEC(DOT11_ASSOCIATION_RESPONSE_TIMEOUT_TU)); - } - - /* if TX was successful, change to next state. - * if TX was failed, do retry if possible. - */ - saaFsmSteps(prAdapter, prStaRec, eNextState, (P_SW_RFB_T)NULL); - } - break; - - default: - break; /* Ignore other cases */ - } - - - return WLAN_STATUS_SUCCESS; - -} /* end of saaFsmRunEventTxDone() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will send Tx Request Timeout Event to SAA FSM. -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -saaFsmRunEventTxReqTimeOut ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - ASSERT(prStaRec); - if(!prStaRec) { - return; - } - - DBGLOG(SAA, LOUD, ("EVENT-TIMER: TX REQ TIMEOUT, Current Time = %ld\n", kalGetTimeTick())); - - switch (prStaRec->eAuthAssocState) { - case SAA_STATE_SEND_AUTH1: - case SAA_STATE_SEND_AUTH3: - case SAA_STATE_SEND_ASSOC1: - saaFsmSteps(prAdapter, prStaRec, prStaRec->eAuthAssocState, (P_SW_RFB_T)NULL); - break; - - default: - return; - } - - return; -} /* end of saaFsmRunEventTxReqTimeOut() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will send Rx Response Timeout Event to SAA FSM. -* -* @param[in] prStaRec Pointer to the STA_RECORD_T -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -saaFsmRunEventRxRespTimeOut ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - ENUM_AA_STATE_T eNextState; - - - DBGLOG(SAA, LOUD, ("EVENT-TIMER: RX RESP TIMEOUT, Current Time = %ld\n", kalGetTimeTick())); - - ASSERT(prStaRec); - if(!prStaRec) { - return; - } - - eNextState = prStaRec->eAuthAssocState; - - switch (prStaRec->eAuthAssocState) { - case SAA_STATE_WAIT_AUTH2: - /* Record the Status Code of Authentication Request */ - prStaRec->u2StatusCode = STATUS_CODE_AUTH_TIMEOUT; - - /* Pull back to earlier state to do retry */ - eNextState = SAA_STATE_SEND_AUTH1; - break; - - case SAA_STATE_WAIT_AUTH4: - /* Record the Status Code of Authentication Request */ - prStaRec->u2StatusCode = STATUS_CODE_AUTH_TIMEOUT; - - /* Pull back to earlier state to do retry */ - eNextState = SAA_STATE_SEND_AUTH3; - break; - - case SAA_STATE_WAIT_ASSOC2: - /* Record the Status Code of Authentication Request */ - prStaRec->u2StatusCode = STATUS_CODE_ASSOC_TIMEOUT; - - /* Pull back to earlier state to do retry */ - eNextState = SAA_STATE_SEND_ASSOC1; - break; - - default: - break; /* Ignore other cases */ - } - - - if (eNextState != prStaRec->eAuthAssocState) { - saaFsmSteps(prAdapter, prStaRec, eNextState, (P_SW_RFB_T)NULL); - } - - return; -} /* end of saaFsmRunEventRxRespTimeOut() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will process the Rx Auth Response Frame and then -* trigger SAA FSM. -* -* @param[in] prSwRfb Pointer to the SW_RFB_T structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -saaFsmRunEventRxAuth ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_STA_RECORD_T prStaRec; - UINT_16 u2StatusCode; - ENUM_AA_STATE_T eNextState; - - - ASSERT(prSwRfb); - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - - /* We should have the corresponding Sta Record. */ - if (!prStaRec) { - ASSERT(0); - return; - } - - if (!IS_AP_STA(prStaRec)) { - return; - } - - switch(prStaRec->eAuthAssocState) { - case SAA_STATE_SEND_AUTH1: - case SAA_STATE_WAIT_AUTH2: - /* Check if the incoming frame is what we are waiting for */ - if (authCheckRxAuthFrameStatus(prAdapter, - prSwRfb, - AUTH_TRANSACTION_SEQ_2, - &u2StatusCode) == WLAN_STATUS_SUCCESS) { - - cnmTimerStopTimer(prAdapter, &prStaRec->rTxReqDoneOrRxRespTimer); - - /* Record the Status Code of Authentication Request */ - prStaRec->u2StatusCode = u2StatusCode; - - if (u2StatusCode == STATUS_CODE_SUCCESSFUL) { - - authProcessRxAuth2_Auth4Frame(prAdapter, prSwRfb); - - if (prStaRec->ucAuthAlgNum == - (UINT_8)AUTH_ALGORITHM_NUM_SHARED_KEY) { - - eNextState = SAA_STATE_SEND_AUTH3; - } - else { - /* Update Station Record - Class 2 Flag */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_2); - - eNextState = SAA_STATE_SEND_ASSOC1; - } - } - else { - DBGLOG(SAA, INFO, ("Auth Req was rejected by ["MACSTR"], Status Code = %d\n", - MAC2STR(prStaRec->aucMacAddr), u2StatusCode)); - - eNextState = AA_STATE_IDLE; - } - - /* Reset Send Auth/(Re)Assoc Frame Count */ - prStaRec->ucTxAuthAssocRetryCount = 0; - - saaFsmSteps(prAdapter, prStaRec, eNextState, (P_SW_RFB_T)NULL); - } - break; - - case SAA_STATE_SEND_AUTH3: - case SAA_STATE_WAIT_AUTH4: - /* Check if the incoming frame is what we are waiting for */ - if (authCheckRxAuthFrameStatus(prAdapter, - prSwRfb, - AUTH_TRANSACTION_SEQ_4, - &u2StatusCode) == WLAN_STATUS_SUCCESS) { - - cnmTimerStopTimer(prAdapter, &prStaRec->rTxReqDoneOrRxRespTimer); - - /* Record the Status Code of Authentication Request */ - prStaRec->u2StatusCode = u2StatusCode; - - if (u2StatusCode == STATUS_CODE_SUCCESSFUL) { - - authProcessRxAuth2_Auth4Frame(prAdapter, prSwRfb); /* Add for 802.11r handling */ - - /* Update Station Record - Class 2 Flag */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_2); - - eNextState = SAA_STATE_SEND_ASSOC1; - } - else { - DBGLOG(SAA, INFO, ("Auth Req was rejected by ["MACSTR"], Status Code = %d\n", - MAC2STR(prStaRec->aucMacAddr), u2StatusCode)); - - eNextState = AA_STATE_IDLE; - } - - /* Reset Send Auth/(Re)Assoc Frame Count */ - prStaRec->ucTxAuthAssocRetryCount = 0; - - saaFsmSteps(prAdapter, prStaRec, eNextState, (P_SW_RFB_T)NULL); - } - break; - - default: - break; /* Ignore other cases */ - } - - return; -} /* end of saaFsmRunEventRxAuth() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will process the Rx (Re)Association Response Frame and then -* trigger SAA FSM. -* -* @param[in] prSwRfb Pointer to the SW_RFB_T structure. -* -* @retval WLAN_STATUS_SUCCESS if the status code was not success -* @retval WLAN_STATUS_BUFFER_RETAINED if the status code was success -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -saaFsmRunEventRxAssoc ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_STA_RECORD_T prStaRec; - UINT_16 u2StatusCode; - ENUM_AA_STATE_T eNextState; - P_SW_RFB_T prRetainedSwRfb = (P_SW_RFB_T)NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - - - ASSERT(prSwRfb); - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - - /* We should have the corresponding Sta Record. */ - if (!prStaRec) { - ASSERT(0); - return rStatus; - } - - if (!IS_AP_STA(prStaRec)) { - return rStatus; - } - - switch (prStaRec->eAuthAssocState) { - case SAA_STATE_SEND_ASSOC1: - case SAA_STATE_WAIT_ASSOC2: - /* TRUE if the incoming frame is what we are waiting for */ - if (assocCheckRxReAssocRspFrameStatus(prAdapter, - prSwRfb, - &u2StatusCode) == WLAN_STATUS_SUCCESS) { - - cnmTimerStopTimer(prAdapter, &prStaRec->rTxReqDoneOrRxRespTimer); - - - /* Record the Status Code of Authentication Request */ - prStaRec->u2StatusCode = u2StatusCode; - - if (u2StatusCode == STATUS_CODE_SUCCESSFUL) { - - /* Update Station Record - Class 3 Flag */ - /* NOTE(Kevin): Moved to AIS FSM for roaming issue - - * We should deactivate the STA_RECORD_T of previous AP before - * activate new one in Driver. - */ - //cnmStaRecChangeState(prStaRec, STA_STATE_3); - - prStaRec->ucJoinFailureCount = 0; // Clear history. - - prRetainedSwRfb = prSwRfb; - rStatus = WLAN_STATUS_PENDING; - } - else { - DBGLOG(SAA, INFO, ("Assoc Req was rejected by ["MACSTR"], Status Code = %d\n", - MAC2STR(prStaRec->aucMacAddr), u2StatusCode)); - } - - /* Reset Send Auth/(Re)Assoc Frame Count */ - prStaRec->ucTxAuthAssocRetryCount = 0; - - /* update RCPI */ - prStaRec->ucRCPI = prSwRfb->prHifRxHdr->ucRcpi; - - eNextState = AA_STATE_IDLE; - - saaFsmSteps(prAdapter, prStaRec, eNextState, prRetainedSwRfb); - } - break; - - default: - break; /* Ignore other cases */ - } - - return rStatus; - -} /* end of saaFsmRunEventRxAssoc() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will check the incoming Deauth Frame. -* -* @param[in] prSwRfb Pointer to the SW_RFB_T structure. -* -* @retval WLAN_STATUS_SUCCESS Always not retain deauthentication frames -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -saaFsmRunEventRxDeauth ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_STA_RECORD_T prStaRec; -#if DBG - P_WLAN_DEAUTH_FRAME_T prDeauthFrame; -#endif /* DBG */ - - - ASSERT(prSwRfb); - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - -#if DBG - prDeauthFrame = (P_WLAN_DEAUTH_FRAME_T) prSwRfb->pvHeader; - - DBGLOG(SAA, INFO, ("Rx Deauth frame from BSSID=["MACSTR"].\n", - MAC2STR(prDeauthFrame->aucBSSID))); -#endif /* DBG */ - - do { - - /* We should have the corresponding Sta Record. */ - if (!prStaRec) { - break; - } - - if (IS_STA_IN_AIS(prStaRec)) { - P_AIS_BSS_INFO_T prAisBssInfo; - - - if (!IS_AP_STA(prStaRec)) { - break; - } - - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - - if (prStaRec->ucStaState > STA_STATE_1) { - - /* Check if this is the AP we are associated or associating with */ - if (authProcessRxDeauthFrame(prSwRfb, - prStaRec->aucMacAddr, - &prStaRec->u2ReasonCode) == WLAN_STATUS_SUCCESS) { - - if (STA_STATE_3 == prStaRec->ucStaState) { - P_MSG_AIS_ABORT_T prAisAbortMsg; - - /* NOTE(Kevin): Change state immediately to avoid starvation of - * MSG buffer because of too many deauth frames before changing - * the STA state. - */ - cnmStaRecChangeState(prAdapter, prStaRec, STA_STATE_1); - - prAisAbortMsg = (P_MSG_AIS_ABORT_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_AIS_ABORT_T)); - if (!prAisAbortMsg) { - break; - } - - prAisAbortMsg->rMsgHdr.eMsgId = MID_SAA_AIS_FSM_ABORT; - prAisAbortMsg->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_DEAUTHENTICATED; - prAisAbortMsg->fgDelayIndication = FALSE; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prAisAbortMsg, - MSG_SEND_METHOD_BUF); - } - else { - - /* TODO(Kevin): Joining Abort */ - } - - } - - } - - } -#if CFG_ENABLE_WIFI_DIRECT - else if (prAdapter->fgIsP2PRegistered && IS_STA_IN_P2P(prStaRec)) { - /* TODO(Kevin) */ - p2pFsmRunEventRxDeauthentication(prAdapter, prStaRec, prSwRfb); - } -#endif -#if CFG_ENABLE_BT_OVER_WIFI - else if (IS_STA_IN_BOW(prStaRec)) { - bowRunEventRxDeAuth(prAdapter, prStaRec, prSwRfb); - } -#endif - else { - ASSERT(0); - } - - } while (FALSE); - - return WLAN_STATUS_SUCCESS; - -} /* end of saaFsmRunEventRxDeauth() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will check the incoming Disassociation Frame. -* -* @param[in] prSwRfb Pointer to the SW_RFB_T structure. -* -* @retval WLAN_STATUS_SUCCESS Always not retain disassociation frames -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -saaFsmRunEventRxDisassoc ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_STA_RECORD_T prStaRec; -#if DBG - P_WLAN_DISASSOC_FRAME_T prDisassocFrame; -#endif /* DBG */ - - - ASSERT(prSwRfb); - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - -#if DBG - prDisassocFrame = (P_WLAN_DISASSOC_FRAME_T) prSwRfb->pvHeader; - - DBGLOG(SAA, INFO, ("Rx Disassoc frame from BSSID=["MACSTR"].\n", - MAC2STR(prDisassocFrame->aucBSSID))); -#endif /* DBG */ - - do { - - /* We should have the corresponding Sta Record. */ - if (!prStaRec) { - break; - } - - if (IS_STA_IN_AIS(prStaRec)) { - P_AIS_BSS_INFO_T prAisBssInfo; - - - if (!IS_AP_STA(prStaRec)) { - break; - } - - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - - if (prStaRec->ucStaState > STA_STATE_1) { - - /* Check if this is the AP we are associated or associating with */ - if (assocProcessRxDisassocFrame(prAdapter, - prSwRfb, - prStaRec->aucMacAddr, - &prStaRec->u2ReasonCode) == WLAN_STATUS_SUCCESS) { - - if (STA_STATE_3 == prStaRec->ucStaState) { - P_MSG_AIS_ABORT_T prAisAbortMsg; - - prAisAbortMsg = (P_MSG_AIS_ABORT_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_AIS_ABORT_T)); - if (!prAisAbortMsg) { - break; - } - - prAisAbortMsg->rMsgHdr.eMsgId = MID_SAA_AIS_FSM_ABORT; - prAisAbortMsg->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_DISASSOCIATED; - prAisAbortMsg->fgDelayIndication = FALSE; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prAisAbortMsg, - MSG_SEND_METHOD_BUF); - } - else { - - /* TODO(Kevin): Joining Abort */ - } - - } - - } - - } -#if CFG_ENABLE_WIFI_DIRECT - else if (prAdapter->fgIsP2PRegistered && IS_STA_IN_P2P(prStaRec)) { - /* TODO(Kevin) */ - p2pFsmRunEventRxDisassociation(prAdapter, prStaRec, prSwRfb); - } -#endif -#if CFG_ENABLE_BT_OVER_WIFI - else if (IS_STA_IN_BOW(prStaRec)) { - /* TODO(Kevin) */ - } -#endif - else { - ASSERT(0); - } - - } while (FALSE); - - return WLAN_STATUS_SUCCESS; - -} /* end of saaFsmRunEventRxDisassoc() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will handle the Abort Event to SAA FSM. -* -* @param[in] prMsgHdr Message of Abort Request for a particular STA. -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -saaFsmRunEventAbort ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_SAA_FSM_ABORT_T prSaaFsmAbortMsg; - P_STA_RECORD_T prStaRec; - - - ASSERT(prMsgHdr); - - prSaaFsmAbortMsg = (P_MSG_SAA_FSM_ABORT_T)prMsgHdr; - prStaRec = prSaaFsmAbortMsg->prStaRec; - - ASSERT(prStaRec); - if(!prStaRec) { - cnmMemFree(prAdapter, prMsgHdr); - return; - } - - DBGLOG(SAA, LOUD, ("EVENT-ABORT: Stop SAA FSM.\n")); - - cnmMemFree(prAdapter, prMsgHdr); - - - /* Reset Send Auth/(Re)Assoc Frame Count */ - prStaRec->ucTxAuthAssocRetryCount = 0; - - /* Cancel JOIN relative Timer */ - cnmTimerStopTimer(prAdapter, &prStaRec->rTxReqDoneOrRxRespTimer); - - if (prStaRec->eAuthAssocState != AA_STATE_IDLE) { -#if DBG - DBGLOG(SAA, LOUD, ("EVENT-ABORT: Previous Auth/Assoc State == %s.\n", - apucDebugAAState[prStaRec->eAuthAssocState])); -#else - DBGLOG(SAA, LOUD, ("EVENT-ABORT: Previous Auth/Assoc State == %d.\n", - prStaRec->eAuthAssocState)); -#endif - } - -#if 0 - /* For the Auth/Assoc State to IDLE */ - prStaRec->eAuthAssocState = AA_STATE_IDLE; -#else - /* Free this StaRec */ - cnmStaRecFree(prAdapter, prStaRec, FALSE); -#endif - - return; -} /* end of saaFsmRunEventAbort() */ - - -/* TODO(Kevin): following code will be modified and move to AIS FSM */ -#if 0 -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will send Join Timeout Event to JOIN FSM. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* -* \retval WLAN_STATUS_FAILURE Fail because of Join Timeout -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -joinFsmRunEventJoinTimeOut ( - IN P_ADAPTER_T prAdapter - ) -{ - P_JOIN_INFO_T prJoinInfo; - P_STA_RECORD_T prStaRec; - - DEBUGFUNC("joinFsmRunEventJoinTimeOut"); - - - ASSERT(prAdapter); - prJoinInfo = &prAdapter->rJoinInfo; - - DBGLOG(JOIN, EVENT, ("JOIN EVENT: JOIN TIMEOUT\n")); - - /* Get a Station Record if possible, TA == BSSID for AP */ - prStaRec = staRecGetStaRecordByAddr(prAdapter, - prJoinInfo->prBssDesc->aucBSSID); - - /* We have renew this Sta Record when in JOIN_STATE_INIT */ - ASSERT(prStaRec); - - /* Record the Status Code of Authentication Request */ - prStaRec->u2StatusCode = STATUS_CODE_JOIN_TIMEOUT; - - /* Increase Failure Count */ - prStaRec->ucJoinFailureCount++; - - /* Reset Send Auth/(Re)Assoc Frame Count */ - prJoinInfo->ucTxAuthAssocRetryCount = 0; - - /* Cancel other JOIN relative Timer */ - ARB_CANCEL_TIMER(prAdapter, - prJoinInfo->rTxRequestTimer); - - ARB_CANCEL_TIMER(prAdapter, - prJoinInfo->rRxResponseTimer); - - /* Restore original setting from current BSS_INFO_T */ - if (prAdapter->eConnectionState == MEDIA_STATE_CONNECTED) { - joinAdoptParametersFromCurrentBss(prAdapter); - } - - /* Pull back to IDLE */ - joinFsmSteps(prAdapter, JOIN_STATE_IDLE); - - return WLAN_STATUS_FAILURE; - -} /* end of joinFsmRunEventJoinTimeOut() */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will adopt the parameters from Peer BSS. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -joinAdoptParametersFromPeerBss ( - IN P_ADAPTER_T prAdapter - ) -{ - P_JOIN_INFO_T prJoinInfo; - P_BSS_DESC_T prBssDesc; - - DEBUGFUNC("joinAdoptParametersFromPeerBss"); - - - ASSERT(prAdapter); - prJoinInfo = &prAdapter->rJoinInfo; - prBssDesc = prJoinInfo->prBssDesc; - - //4 <1> Adopt Peer BSS' PHY TYPE - prAdapter->eCurrentPhyType = prBssDesc->ePhyType; - - DBGLOG(JOIN, INFO, ("Target BSS[%s]'s PhyType = %s\n", - prBssDesc->aucSSID, (prBssDesc->ePhyType == PHY_TYPE_ERP_INDEX) ? "ERP" : "HR_DSSS")); - - - //4 <2> Adopt Peer BSS' Frequency(Band/Channel) - DBGLOG(JOIN, INFO, ("Target BSS's Channel = %d, Band = %d\n", - prBssDesc->ucChannelNum, prBssDesc->eBand)); - - nicSwitchChannel(prAdapter, - prBssDesc->eBand, - prBssDesc->ucChannelNum, - 10); - - prJoinInfo->fgIsParameterAdopted = TRUE; - - return; -} /* end of joinAdoptParametersFromPeerBss() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will adopt the parameters from current associated BSS. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -joinAdoptParametersFromCurrentBss ( - IN P_ADAPTER_T prAdapter - ) -{ - //P_JOIN_INFO_T prJoinInfo = &prAdapter->rJoinInfo; - P_BSS_INFO_T prBssInfo; - - - ASSERT(prAdapter); - prBssInfo = &prAdapter->rBssInfo; - - //4 <1> Adopt current BSS' PHY TYPE - prAdapter->eCurrentPhyType = prBssInfo->ePhyType; - - //4 <2> Adopt current BSS' Frequency(Band/Channel) - DBGLOG(JOIN, INFO, ("Current BSS's Channel = %d, Band = %d\n", - prBssInfo->ucChnl, prBssInfo->eBand)); - - nicSwitchChannel(prAdapter, - prBssInfo->eBand, - prBssInfo->ucChnl, - 10); - return; -} /* end of joinAdoptParametersFromCurrentBss() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will update all the SW variables and HW MCR registers after -* the association with target BSS. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -joinComplete ( - IN P_ADAPTER_T prAdapter - ) -{ - P_JOIN_INFO_T prJoinInfo; - P_BSS_DESC_T prBssDesc; - P_PEER_BSS_INFO_T prPeerBssInfo; - P_BSS_INFO_T prBssInfo; - P_CONNECTION_SETTINGS_T prConnSettings; - P_STA_RECORD_T prStaRec; - P_TX_CTRL_T prTxCtrl; -#if CFG_SUPPORT_802_11D - P_IE_COUNTRY_T prIECountry; -#endif - - DEBUGFUNC("joinComplete"); - - - ASSERT(prAdapter); - prJoinInfo = &prAdapter->rJoinInfo; - prBssDesc = prJoinInfo->prBssDesc; - prPeerBssInfo = &prAdapter->rPeerBssInfo; - prBssInfo = &prAdapter->rBssInfo; - prConnSettings = &prAdapter->rConnSettings; - prTxCtrl = &prAdapter->rTxCtrl; - -//4 <1> Update Connecting & Connected Flag of BSS_DESC_T. - /* Remove previous AP's Connection Flags if have */ - scanRemoveConnectionFlagOfBssDescByBssid(prAdapter, prBssInfo->aucBSSID); - - prBssDesc->fgIsConnected = TRUE; /* Mask as Connected */ - - if (prBssDesc->fgIsHiddenSSID) { - /* NOTE(Kevin): This is for the case of Passive Scan and the target BSS didn't - * broadcast SSID on its Beacon Frame. - */ - COPY_SSID(prBssDesc->aucSSID, - prBssDesc->ucSSIDLen, - prAdapter->rConnSettings.aucSSID, - prAdapter->rConnSettings.ucSSIDLen); - - if (prBssDesc->ucSSIDLen) { - prBssDesc->fgIsHiddenSSID = FALSE; - } -#if DBG - else { - ASSERT(0); - } -#endif /* DBG */ - - DBGLOG(JOIN, INFO, ("Hidden SSID! - Update SSID : %s\n", prBssDesc->aucSSID)); - } - - -//4 <2> Update BSS_INFO_T from BSS_DESC_T - //4 <2.A> PHY Type - prBssInfo->ePhyType = prBssDesc->ePhyType; - - //4 <2.B> BSS Type - prBssInfo->eBSSType = BSS_TYPE_INFRASTRUCTURE; - - //4 <2.C> BSSID - COPY_MAC_ADDR(prBssInfo->aucBSSID, prBssDesc->aucBSSID); - - DBGLOG(JOIN, INFO, ("JOIN to BSSID: ["MACSTR"]\n", MAC2STR(prBssDesc->aucBSSID))); - - - //4 <2.D> SSID - COPY_SSID(prBssInfo->aucSSID, - prBssInfo->ucSSIDLen, - prBssDesc->aucSSID, - prBssDesc->ucSSIDLen); - - //4 <2.E> Channel / Band information. - prBssInfo->eBand = prBssDesc->eBand; - prBssInfo->ucChnl = prBssDesc->ucChannelNum; - - //4 <2.F> RSN/WPA information. - secFsmRunEventStart(prAdapter); - prBssInfo->u4RsnSelectedPairwiseCipher = prBssDesc->u4RsnSelectedPairwiseCipher; - prBssInfo->u4RsnSelectedGroupCipher = prBssDesc->u4RsnSelectedGroupCipher; - prBssInfo->u4RsnSelectedAKMSuite = prBssDesc->u4RsnSelectedAKMSuite; - - if (secRsnKeyHandshakeEnabled()) { - prBssInfo->fgIsWPAorWPA2Enabled = TRUE; - } - else { - prBssInfo->fgIsWPAorWPA2Enabled = FALSE; - } - - //4 <2.G> Beacon interval. - prBssInfo->u2BeaconInterval = prBssDesc->u2BeaconInterval; - - //4 <2.H> DTIM period. - prBssInfo->ucDtimPeriod = prBssDesc->ucDTIMPeriod; - - //4 <2.I> ERP Information - if ((prBssInfo->ePhyType == PHY_TYPE_ERP_INDEX) && // Our BSS's PHY_TYPE is ERP now. - (prBssDesc->fgIsERPPresent)) { - - prBssInfo->fgIsERPPresent = TRUE; - prBssInfo->ucERP = prBssDesc->ucERP; /* Save the ERP for later check */ - } - else { /* Some AP, may send ProbeResp without ERP IE. Thus prBssDesc->fgIsERPPresent is FALSE. */ - prBssInfo->fgIsERPPresent = FALSE; - prBssInfo->ucERP = 0; - } - -#if CFG_SUPPORT_802_11D - //4 <2.J> Country inforamtion of the associated AP - if (prConnSettings->fgMultiDomainCapabilityEnabled) { - DOMAIN_INFO_ENTRY rDomainInfo; - if (domainGetDomainInfoByScanResult(prAdapter, &rDomainInfo)) { - if (prBssDesc->prIECountry) { - prIECountry = prBssDesc->prIECountry; - - domainParseCountryInfoElem(prIECountry, &prBssInfo->rDomainInfo); - - /* use the domain get from the BSS info */ - prBssInfo->fgIsCountryInfoPresent = TRUE; - nicSetupOpChnlList(prAdapter, prBssInfo->rDomainInfo.u2CountryCode, FALSE); - } else { - /* use the domain get from the scan result */ - prBssInfo->fgIsCountryInfoPresent = TRUE; - nicSetupOpChnlList(prAdapter, rDomainInfo.u2CountryCode, FALSE); - } - } - } -#endif - - //4 <2.K> Signal Power of the associated AP - prBssInfo->rRcpi = prBssDesc->rRcpi; - prBssInfo->rRssi = RCPI_TO_dBm(prBssInfo->rRcpi); - GET_CURRENT_SYSTIME(&prBssInfo->rRssiLastUpdateTime); - - //4 <2.L> Capability Field of the associated AP - prBssInfo->u2CapInfo = prBssDesc->u2CapInfo; - - DBGLOG(JOIN, INFO, ("prBssInfo-> fgIsERPPresent = %d, ucERP = %02x, rRcpi = %d, rRssi = %ld\n", - prBssInfo->fgIsERPPresent, prBssInfo->ucERP, prBssInfo->rRcpi, prBssInfo->rRssi)); - - -//4 <3> Update BSS_INFO_T from PEER_BSS_INFO_T & NIC RATE FUNC - //4 <3.A> Association ID - prBssInfo->u2AssocId = prPeerBssInfo->u2AssocId; - - //4 <3.B> WMM Infomation - if (prAdapter->fgIsEnableWMM && - (prPeerBssInfo->rWmmInfo.ucWmmFlag & WMM_FLAG_SUPPORT_WMM)) { - - prBssInfo->fgIsWmmAssoc = TRUE; - prTxCtrl->rTxQForVoipAccess = TXQ_AC3; - - qosWmmInfoInit(&prBssInfo->rWmmInfo, (prBssInfo->ePhyType == PHY_TYPE_HR_DSSS_INDEX) ? TRUE : FALSE); - - if (prPeerBssInfo->rWmmInfo.ucWmmFlag & WMM_FLAG_AC_PARAM_PRESENT) { - kalMemCopy(&prBssInfo->rWmmInfo, - &prPeerBssInfo->rWmmInfo, - sizeof(WMM_INFO_T)); - } - else { - kalMemCopy(&prBssInfo->rWmmInfo, - &prPeerBssInfo->rWmmInfo, - sizeof(WMM_INFO_T) - sizeof(prPeerBssInfo->rWmmInfo.arWmmAcParams)); - } - } - else { - prBssInfo->fgIsWmmAssoc = FALSE; - prTxCtrl->rTxQForVoipAccess = TXQ_AC1; - - kalMemZero(&prBssInfo->rWmmInfo, sizeof(WMM_INFO_T)); - } - - - //4 <3.C> Operational Rate Set & BSS Basic Rate Set - prBssInfo->u2OperationalRateSet = prPeerBssInfo->u2OperationalRateSet; - prBssInfo->u2BSSBasicRateSet = prPeerBssInfo->u2BSSBasicRateSet; - - - //4 <3.D> Short Preamble - if (prBssInfo->fgIsERPPresent) { - - /* NOTE(Kevin 2007/12/24): Truth Table. - * Short Preamble Bit in - * Final Driver Setting(Short) - * TRUE FALSE FALSE FALSE(shouldn't have such case, use the AssocResp) - * TRUE FALSE TRUE FALSE - * FALSE FALSE FALSE FALSE(shouldn't have such case, use the AssocResp) - * FALSE FALSE TRUE FALSE - * TRUE TRUE FALSE TRUE(follow ERP) - * TRUE TRUE TRUE FALSE(follow ERP) - * FALSE TRUE FALSE FALSE(shouldn't have such case, and we should set to FALSE) - * FALSE TRUE TRUE FALSE(we should set to FALSE) - */ - if ((prPeerBssInfo->fgIsShortPreambleAllowed) && - ((prConnSettings->ePreambleType == PREAMBLE_TYPE_SHORT) || /* Short Preamble Option Enable is TRUE */ - ((prConnSettings->ePreambleType == PREAMBLE_TYPE_AUTO) && - (prBssDesc->u2CapInfo & CAP_INFO_SHORT_PREAMBLE)))) { - - prBssInfo->fgIsShortPreambleAllowed = TRUE; - - if (prBssInfo->ucERP & ERP_INFO_BARKER_PREAMBLE_MODE) { - prBssInfo->fgUseShortPreamble = FALSE; - } - else { - prBssInfo->fgUseShortPreamble = TRUE; - } - } - else { - prBssInfo->fgIsShortPreambleAllowed = FALSE; - prBssInfo->fgUseShortPreamble = FALSE; - } - } - else { - /* NOTE(Kevin 2007/12/24): Truth Table. - * Short Preamble Bit in - * Final Driver Setting(Short) - * TRUE FALSE FALSE - * FALSE FALSE FALSE - * TRUE TRUE TRUE - * FALSE TRUE(status success) TRUE - * --> Honor the result of prPeerBssInfo. - */ - - prBssInfo->fgIsShortPreambleAllowed = prBssInfo->fgUseShortPreamble = - prPeerBssInfo->fgIsShortPreambleAllowed; - } - - DBGLOG(JOIN, INFO, ("prBssInfo->fgIsShortPreambleAllowed = %d, prBssInfo->fgUseShortPreamble = %d\n", - prBssInfo->fgIsShortPreambleAllowed, prBssInfo->fgUseShortPreamble)); - - - //4 <3.E> Short Slot Time - prBssInfo->fgUseShortSlotTime = - prPeerBssInfo->fgUseShortSlotTime; /* AP support Short Slot Time */ - - DBGLOG(JOIN, INFO, ("prBssInfo->fgUseShortSlotTime = %d\n", - prBssInfo->fgUseShortSlotTime)); - - nicSetSlotTime(prAdapter, - prBssInfo->ePhyType, - ((prConnSettings->fgIsShortSlotTimeOptionEnable && - prBssInfo->fgUseShortSlotTime) ? TRUE : FALSE)); - - - //4 <3.F> Update Tx Rate for Control Frame - bssUpdateTxRateForControlFrame(prAdapter); - - - //4 <3.G> Save the available Auth Types during Roaming (Design for Fast BSS Transition). - //if (prAdapter->fgIsEnableRoaming) /* NOTE(Kevin): Always prepare info for roaming */ - { - - if (prJoinInfo->ucCurrAuthAlgNum == AUTH_ALGORITHM_NUM_OPEN_SYSTEM) { - prJoinInfo->ucRoamingAuthTypes |= AUTH_TYPE_OPEN_SYSTEM; - } - else if (prJoinInfo->ucCurrAuthAlgNum == AUTH_ALGORITHM_NUM_SHARED_KEY) { - prJoinInfo->ucRoamingAuthTypes |= AUTH_TYPE_SHARED_KEY; - } - - prBssInfo->ucRoamingAuthTypes = prJoinInfo->ucRoamingAuthTypes; - - - /* Set the stable time of the associated BSS. We won't do roaming decision - * during the stable time. - */ - SET_EXPIRATION_TIME(prBssInfo->rRoamingStableExpirationTime, - SEC_TO_SYSTIME(ROAMING_STABLE_TIMEOUT_SEC)); - } - - - //4 <3.H> Update Parameter for TX Fragmentation Threshold -#if CFG_TX_FRAGMENT - txFragInfoUpdate(prAdapter); -#endif /* CFG_TX_FRAGMENT */ - - -//4 <4> Update STA_RECORD_T - /* Get a Station Record if possible */ - prStaRec = staRecGetStaRecordByAddr(prAdapter, - prBssDesc->aucBSSID); - - if (prStaRec) { - UINT_16 u2OperationalRateSet, u2DesiredRateSet; - - //4 <4.A> Desired Rate Set - u2OperationalRateSet = (rPhyAttributes[prBssInfo->ePhyType].u2SupportedRateSet & - prBssInfo->u2OperationalRateSet); - - u2DesiredRateSet = (u2OperationalRateSet & prConnSettings->u2DesiredRateSet); - if (u2DesiredRateSet) { - prStaRec->u2DesiredRateSet = u2DesiredRateSet; - } - else { - /* For Error Handling - The Desired Rate Set is not covered in Operational Rate Set. */ - prStaRec->u2DesiredRateSet = u2OperationalRateSet; - } - - /* Try to set the best initial rate for this entry */ - if (!rateGetBestInitialRateIndex(prStaRec->u2DesiredRateSet, - prStaRec->rRcpi, - &prStaRec->ucCurrRate1Index)) { - - if (!rateGetLowestRateIndexFromRateSet(prStaRec->u2DesiredRateSet, - &prStaRec->ucCurrRate1Index)) { - ASSERT(0); - } - } - - DBGLOG(JOIN, INFO, ("prStaRec->ucCurrRate1Index = %d\n", - prStaRec->ucCurrRate1Index)); - - //4 <4.B> Preamble Mode - prStaRec->fgIsShortPreambleOptionEnable = - prBssInfo->fgUseShortPreamble; - - //4 <4.C> QoS Flag - prStaRec->fgIsQoS = prBssInfo->fgIsWmmAssoc; - } -#if DBG - else { - ASSERT(0); - } -#endif /* DBG */ - - -//4 <5> Update NIC - //4 <5.A> Update BSSID & Operation Mode - nicSetupBSS(prAdapter, prBssInfo); - - //4 <5.B> Update WLAN Table. - if (nicSetHwBySta(prAdapter, prStaRec) == FALSE) { - ASSERT(FALSE); - } - - //4 <5.C> Update Desired Rate Set for BT. -#if CFG_TX_FRAGMENT - if (prConnSettings->fgIsEnableTxAutoFragmentForBT) { - txRateSetInitForBT(prAdapter, prStaRec); - } -#endif /* CFG_TX_FRAGMENT */ - - //4 <5.D> TX AC Parameter and TX/RX Queue Control - if (prBssInfo->fgIsWmmAssoc) { - -#if CFG_TX_AGGREGATE_HW_FIFO - nicTxAggregateTXQ(prAdapter, FALSE); -#endif /* CFG_TX_AGGREGATE_HW_FIFO */ - - qosUpdateWMMParametersAndAssignAllowedACI(prAdapter, &prBssInfo->rWmmInfo); - } - else { - -#if CFG_TX_AGGREGATE_HW_FIFO - nicTxAggregateTXQ(prAdapter, TRUE); -#endif /* CFG_TX_AGGREGATE_HW_FIFO */ - - nicTxNonQoSAssignDefaultAdmittedTXQ(prAdapter); - - nicTxNonQoSUpdateTXQParameters(prAdapter, - prBssInfo->ePhyType); - } - -#if CFG_TX_STOP_WRITE_TX_FIFO_UNTIL_JOIN - { - prTxCtrl->fgBlockTxDuringJoin = FALSE; - - #if !CFG_TX_AGGREGATE_HW_FIFO /* TX FIFO AGGREGATE already do flush once */ - nicTxFlushStopQueues(prAdapter, (UINT_8)TXQ_DATA_MASK, (UINT_8)NULL); - #endif /* CFG_TX_AGGREGATE_HW_FIFO */ - - nicTxRetransmitOfSendWaitQue(prAdapter); - - if (prTxCtrl->fgIsPacketInOsSendQueue) { - nicTxRetransmitOfOsSendQue(prAdapter); - } - - #if CFG_SDIO_TX_ENHANCE - halTxLeftClusteredMpdu(prAdapter); - #endif /* CFG_SDIO_TX_ENHANCE */ - - } -#endif /* CFG_TX_STOP_WRITE_TX_FIFO_UNTIL_JOIN */ - - -//4 <6> Setup CONNECTION flag. - prAdapter->eConnectionState = MEDIA_STATE_CONNECTED; - prAdapter->eConnectionStateIndicated = MEDIA_STATE_CONNECTED; - - if (prJoinInfo->fgIsReAssoc) { - prAdapter->fgBypassPortCtrlForRoaming = TRUE; - } - else { - prAdapter->fgBypassPortCtrlForRoaming = FALSE; - } - - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_CONNECT, - (PVOID)NULL, - 0); - - return; -} /* end of joinComplete() */ -#endif - diff --git a/drivers/net/wireless/mt5931/mgmt/scan.c b/drivers/net/wireless/mt5931/mgmt/scan.c deleted file mode 100755 index 0e89b493497a..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/scan.c +++ /dev/null @@ -1,3025 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/scan.c#3 $ -*/ - -/*! \file "scan.c" - \brief This file defines the scan profile and the processing function of - scan result for SCAN Module. - - The SCAN Profile selection is part of SCAN MODULE and responsible for defining - SCAN Parameters - e.g. MIN_CHANNEL_TIME, number of scan channels. - In this file we also define the process of SCAN Result including adding, searching - and removing SCAN record from the list. -*/ - - - -/* -** $Log: scan.c $ - * - * 07 17 2012 yuche.tsai - * NULL - * Let netdev bring up. - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 06 25 2012 cp.wu - * [WCXRP00001258] [MT6620][MT5931][MT6628][Driver] Do not use stale scan result for deciding connection target - * drop off scan result which is older than 5 seconds when choosing which BSS to join - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 01 16 2012 cp.wu - * [WCXRP00001169] [MT6620 Wi-Fi][Driver] API and behavior modification for preferred band configuration with corresponding network configuration - * correct typo. - * - * 01 16 2012 cp.wu - * [MT6620 Wi-Fi][Driver] API and behavior modification for preferred band configuration with corresponding network configuration - * add wlanSetPreferBandByNetwork() for glue layer to invoke for setting preferred band configuration corresponding to network type. - * - * 12 05 2011 cp.wu - * [WCXRP00001131] [MT6620 Wi-Fi][Driver][AIS] Implement connect-by-BSSID path - * add CONNECT_BY_BSSID policy - * - * 11 23 2011 cp.wu - * [WCXRP00001123] [MT6620 Wi-Fi][Driver] Add option to disable beacon content change detection - * add compile option to disable beacon content change detection. - * - * 11 04 2011 cp.wu - * [WCXRP00001085] [MT6628 Wi-Fi][Driver] deprecate old BSS-DESC if timestamp is reset with received beacon/probe response frames - * deprecate old BSS-DESC when timestamp in received beacon/probe response frames showed a smaller value than before - * - * 10 11 2011 cm.chang - * [WCXRP00001031] [All Wi-Fi][Driver] Check HT IE length to avoid wrong SCO parameter - * Ignore HT OP IE if its length field is not valid - * - * 09 30 2011 cp.wu - * [WCXRP00001021] [MT5931][Driver] Correct scan result generation for conversion between BSS type and operation mode - * correct type casting issue. - * - * 08 23 2011 yuche.tsai - * NULL - * Fix multicast address list issue. - * - * 08 11 2011 cp.wu - * [WCXRP00000830] [MT6620 Wi-Fi][Firmware] Use MDRDY counter to detect empty channel for shortening scan time - * sparse channel detection: - * driver: collect sparse channel information with scan-done event - * - * 08 10 2011 cp.wu - * [WCXRP00000922] [MT6620 Wi-Fi][Driver] traverse whole BSS-DESC list for removing - * traverse whole BSS-DESC list because BSSID is not unique anymore. - * - * 07 12 2011 cp.wu - * [WCXRP00000815] [MT6620 Wi-Fi][Driver] allow single BSSID with multiple SSID settings to work around some tricky AP which use space character as hidden SSID - * for multiple BSS descriptior detecting issue: - * 1) check BSSID for infrastructure network - * 2) check SSID for AdHoc network - * - * 07 12 2011 cp.wu - * [WCXRP00000815] [MT6620 Wi-Fi][Driver] allow single BSSID with multiple SSID settings to work around some tricky AP which use space character as hidden SSID - * check for BSSID for beacons used to update DTIM - * - * 07 12 2011 cp.wu - * [WCXRP00000815] [MT6620 Wi-Fi][Driver] allow single BSSID with multiple SSID settings to work around some tricky AP which use space character as hidden SSID - * do not check BSS descriptor for connected flag due to linksys's hidden SSID will use another BSS descriptor and never connected - * - * 07 11 2011 cp.wu - * [WCXRP00000815] [MT6620 Wi-Fi][Driver] allow single BSSID with multiple SSID settings to work around some tricky AP which use space character as hidden SSID - * just pass beacons with the same BSSID. - * - * 07 11 2011 wh.su - * [WCXRP00000849] [MT6620 Wi-Fi][Driver] Remove some of the WAPI define for make sure the value is initialize, for customer not enable WAPI - * For make sure wapi initial value is set. - * - * 06 28 2011 cp.wu - * [WCXRP00000815] [MT6620 Wi-Fi][Driver] allow single BSSID with multiple SSID settings to work around some tricky AP which use space character as hidden SSID - * Do not check for SSID as beacon content change due to the existence of single BSSID with multiple SSID AP configuration - * - * 06 27 2011 cp.wu - * [WCXRP00000815] [MT6620 Wi-Fi][Driver] allow single BSSID with multiple SSID settings to work around some tricky AP which use space character as hidden SSID - * 1. correct logic - * 2. replace only BSS-DESC which doesn't have a valid SSID. - * - * 06 27 2011 cp.wu - * [WCXRP00000815] [MT6620 Wi-Fi][Driver] allow single BSSID with multiple SSID settings to work around some tricky AP which use space character as hidden SSID - * remove unused temporal variable reference. - * - * 06 27 2011 cp.wu - * [WCXRP00000815] [MT6620 Wi-Fi][Driver] allow single BSSID with multiple SSID settings to work around some tricky AP which use space character as hidden SSID - * allow to have a single BSSID with multiple SSID to be presented in scanning result - * - * 06 02 2011 cp.wu - * [WCXRP00000757] [MT6620 Wi-Fi][Driver][SCN] take use of RLM API to filter out BSS in disallowed channels - * filter out BSS in disallowed channel by - * 1. do not add to scan result array if BSS is at disallowed channel - * 2. do not allow to search for BSS-DESC in disallowed channels - * - * 05 02 2011 cm.chang - * [WCXRP00000691] [MT6620 Wi-Fi][Driver] Workaround about AP's wrong HT capability IE to have wrong channel number - * Refine range of valid channel number - * - * 05 02 2011 cp.wu - * [MT6620 Wi-Fi][Driver] Take parsed result for channel information instead of hardware channel number passed from firmware domain - * take parsed result for generating scanning result with channel information. - * - * 05 02 2011 cm.chang - * [WCXRP00000691] [MT6620 Wi-Fi][Driver] Workaround about AP's wrong HT capability IE to have wrong channel number - * Check if channel is valided before record ing BSS channel - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 04 14 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * . - * - * 04 12 2011 eddie.chen - * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma - * Fix the sta index in processing security frame - * Simple flow control for TC4 to avoid mgt frames for PS STA to occupy the TC4 - * Add debug message. - * - * 03 25 2011 yuche.tsai - * NULL - * Always update Bss Type, for Bss Type for P2P Network is changing every time. - * - * 03 23 2011 yuche.tsai - * NULL - * Fix concurrent issue when AIS scan result would overwrite p2p scan result. - * - * 03 14 2011 cp.wu - * [WCXRP00000535] [MT6620 Wi-Fi][Driver] Fixed channel operation when AIS and Tethering are operating concurrently - * filtering out other BSS coming from adjacent channels - * - * 03 11 2011 chinglan.wang - * [WCXRP00000537] [MT6620 Wi-Fi][Driver] Can not connect to 802.11b/g/n mixed AP with WEP security. - * . - * - * 03 11 2011 cp.wu - * [WCXRP00000535] [MT6620 Wi-Fi][Driver] Fixed channel operation when AIS and Tethering are operating concurrently - * When fixed channel operation is necessary, AIS-FSM would scan and only connect for BSS on the specific channel - * - * 02 24 2011 cp.wu - * [WCXRP00000490] [MT6620 Wi-Fi][Driver][Win32] modify kalMsleep() implementation because NdisMSleep() won't sleep long enough for specified interval such as 500ms - * implement beacon change detection by checking SSID and supported rate. - * - * 02 22 2011 yuche.tsai - * [WCXRP00000480] [Volunteer Patch][MT6620][Driver] WCS IE format issue - * Fix WSC big endian issue. - * - * 02 21 2011 terry.wu - * [WCXRP00000476] [MT6620 Wi-Fi][Driver] Clean P2P scan list while removing P2P - * Clean P2P scan list while removing P2P. - * - * 01 27 2011 yuche.tsai - * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate. - * Fix scan channel extension issue when p2p module is not registered. - * - * 01 26 2011 cm.chang - * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument - * . - * - * 01 21 2011 cp.wu - * [WCXRP00000380] [MT6620 Wi-Fi][Driver] SSID information should come from buffered BSS_DESC_T rather than using beacon-carried information - * SSID should come from buffered prBssDesc rather than beacon-carried information - * - * 01 14 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * Fix compile error. - * - * 01 14 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * Memfree for P2P Descriptor & P2P Descriptor List. - * - * 01 14 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * Free P2P Descriptor List & Descriptor under BSS Descriptor. - * - * 01 04 2011 cp.wu - * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands - * 1) correct typo in scan.c - * 2) TX descriptors, RX descriptos and management buffer should use virtually continous buffer instead of physically contineous one - * - * 01 04 2011 cp.wu - * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands - * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure - * - * 12 31 2010 cp.wu - * [WCXRP00000327] [MT6620 Wi-Fi][Driver] Improve HEC WHQA 6972 workaround coverage in driver side - * while being unloaded, clear all pending interrupt then set LP-own to firmware - * - * 12 21 2010 cp.wu - * [WCXRP00000280] [MT6620 Wi-Fi][Driver] Enable BSS selection with best RCPI policy in SCN module - * SCN: enable BEST RSSI selection policy support - * - * 11 29 2010 cp.wu - * [WCXRP00000210] [MT6620 Wi-Fi][Driver][FW] Set RCPI value in STA_REC for initial TX rate selection of auto-rate algorithm - * update ucRcpi of STA_RECORD_T for AIS when - * 1) Beacons for IBSS merge is received - * 2) Associate Response for a connecting peer is received - * - * 11 03 2010 wh.su - * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group - * Refine the HT rate disallow TKIP pairwise cipher . - * - * 10 12 2010 cp.wu - * [WCXRP00000091] [MT6620 Wi-Fi][Driver] Add scanning logic to filter out beacons which is received on the folding frequency - * trust HT IE if available for 5GHz band - * - * 10 11 2010 cp.wu - * [WCXRP00000091] [MT6620 Wi-Fi][Driver] Add scanning logic to filter out beacons which is received on the folding frequency - * add timing and strenght constraint for filtering out beacons with same SSID/TA but received on different channels - * - * 10 08 2010 wh.su - * [WCXRP00000085] [MT6620 Wif-Fi] [Driver] update the modified p2p state machine - * update the frog's new p2p state machine. - * - * 10 01 2010 yuche.tsai - * NULL - * [MT6620 P2P] Fix Big Endian Issue when parse P2P device name TLV. - * - * 09 24 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * eliminate unused variables which lead gcc to argue - * - * 09 08 2010 cp.wu - * NULL - * use static memory pool for storing IEs of scanning result. - * - * 09 07 2010 yuche.tsai - * NULL - * When indicate scan result, append IE buffer information in the scan result. - * - * 09 03 2010 yuche.tsai - * NULL - * 1. Update Beacon RX count when running SLT. - * 2. Ignore Beacon when running SLT, would not update information from Beacon. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 31 2010 kevin.huang - * NULL - * Use LINK LIST operation to process SCAN result - * - * 08 29 2010 yuche.tsai - * NULL - * 1. Fix P2P Descriptor List to be a link list, to avoid link corrupt after Bss Descriptor Free. - * 2.. Fix P2P Device Name Length BE issue. - * - * 08 23 2010 yuche.tsai - * NULL - * Add P2P Device Found Indication to supplicant - * - * 08 20 2010 cp.wu - * NULL - * reset BSS_DESC_T variables before parsing IE due to peer might have been reconfigured. - * - * 08 20 2010 yuche.tsai - * NULL - * Workaround for P2P Descriptor Infinite loop issue. - * - * 08 16 2010 cp.wu - * NULL - * Replace CFG_SUPPORT_BOW by CFG_ENABLE_BT_OVER_WIFI. - * There is no CFG_SUPPORT_BOW in driver domain source. - * - * 08 16 2010 yuche.tsai - * NULL - * Modify code of processing Probe Resonse frame for P2P. - * - * 08 12 2010 yuche.tsai - * NULL - * Add function to get P2P descriptor of BSS descriptor directly. - * - * 08 11 2010 yuche.tsai - * NULL - * Modify Scan result processing for P2P module. - * - * 08 05 2010 yuche.tsai - * NULL - * Update P2P Device Discovery result add function. - * - * 08 03 2010 cp.wu - * NULL - * surpress compilation warning. - * - * 07 26 2010 yuche.tsai - * - * Add support for Probe Request & Response parsing. - * - * 07 21 2010 cp.wu - * - * 1) change BG_SCAN to ONLINE_SCAN for consistent term - * 2) only clear scanning result when scan is permitted to do - * - * 07 21 2010 yuche.tsai - * - * Fix compile error for SCAN module while disabling P2P feature. - * - * 07 21 2010 yuche.tsai - * - * Add P2P Scan & Scan Result Parsing & Saving. - * - * 07 19 2010 wh.su - * - * update for security supporting. - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * Add Ad-Hoc support to AIS-FSM - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * SCN module is now able to handle multiple concurrent scanning requests - * - * 07 15 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * driver no longer generates probe request frames - * - * 07 14 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * remove timer in DRV-SCN. - * - * 07 09 2010 cp.wu - * - * 1) separate AIS_FSM state for two kinds of scanning. (OID triggered scan, and scan-for-connection) - * 2) eliminate PRE_BSS_DESC_T, Beacon/PrebResp is now parsed in single pass - * 3) implment DRV-SCN module, currently only accepts single scan request, other request will be directly dropped by returning BUSY - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * take use of RLM module for parsing/generating HT IEs for 11n capability - * - * 07 05 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) ignore RSN checking when RSN is not turned on. - * 2) set STA-REC deactivation callback as NULL - * 3) add variable initialization API based on PHY configuration - * - * 07 05 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * correct BSS_DESC_T initialization after allocated. - * - * 07 02 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) for event packet, no need to fill RFB. - * 2) when wlanAdapterStart() failed, no need to initialize state machines - * 3) after Beacon/ProbeResp parsing, corresponding BSS_DESC_T should be marked as IE-parsed - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add scan uninitialization procedure - * - * 06 30 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * if beacon/probe-resp is received in 2.4GHz bands and there is ELEM_ID_DS_PARAM_SET IE available, - * trust IE instead of RMAC information - * - * 06 29 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) sync to. CMD/EVENT document v0.03 - * 2) simplify DTIM period parsing in scan.c only, bss.c no longer parses it again. - * 3) send command packet to indicate FW-PM after - * a) 1st beacon is received after AIS has connected to an AP - * b) IBSS-ALONE has been created - * c) IBSS-MERGE has occured - * - * 06 28 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * send MMPDU in basic rate. - * - * 06 25 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * modify Beacon/ProbeResp to complete parsing, - * because host software has looser memory usage restriction - * - * 06 23 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * integrate . - * - * 06 22 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * comment out RLM APIs by CFG_RLM_MIGRATION. - * - * 06 21 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Update P2P Function call. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * RSN/PRIVACY compilation flag awareness correction - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * specify correct value for management frames. - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 18 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * migration from MT6620 firmware. - * - * 06 17 2010 yuche.tsai - * [WPD00003839][MT6620 5931][P2P] Feature migration - * Fix compile error when enable P2P function. - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * correct when ADHOC support is turned on. - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add scan.c. - * - * 06 04 2010 george.huang - * [BORA00000678][MT6620]WiFi LP integration - * [PM] Support U-APSD for STA mode - * - * 05 28 2010 wh.su - * [BORA00000680][MT6620] Support the statistic for Microsoft os query - * adding the TKIP disallow join a HT AP code. - * - * 05 14 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add more chance of JOIN retry for BG_SCAN - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 04 29 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * adjsut the pre-authentication code. - * - * 04 27 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add Set Slot Time and Beacon Timeout Support for AdHoc Mode - * - * 04 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW - * - * 04 19 2010 kevin.huang - * [BORA00000714][WIFISYS][New Feature]Beacon Timeout Support - * Add Beacon Timeout Support and will send Null frame to diagnose connection - * - * 04 13 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add new HW CH macro support - * - * 04 06 2010 wh.su - * [BORA00000680][MT6620] Support the statistic for Microsoft os query - * fixed the firmware return the broadcast frame at wrong tc. - * - * 03 29 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * let the rsn wapi IE always parsing. - * - * 03 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Not carry HT cap when being associated with b/g only AP - * - * 03 18 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Solve the compile warning for 'return non-void' function - * - * 03 16 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Add AdHoc Mode - * - * 03 10 2010 kevin.huang - * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support - * - * * * * * * * * * * * * * * * * Add Channel Manager for arbitration of JOIN and SCAN Req - * - * 03 03 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * move the AIS specific variable for security to AIS specific structure. - * - * 03 01 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * Refine the variable and parameter for security. - * - * 02 26 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Fix No PKT_INFO_T issue - * - * 02 26 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Update outgoing ProbeRequest Frame's TX data rate - * - * 02 23 2010 wh.su - * [BORA00000592][MT6620 Wi-Fi] Adding the security related code for driver - * refine the scan procedure, reduce the WPA and WAPI IE parsing, and move the parsing to the time for join. - * - * 02 23 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add support scan channel 1~14 and update scan result's frequency infou1rwduu`wvpghlqg|n`slk+mpdkb - * - * 02 04 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add AAA Module Support, Revise Net Type to Net Type Index for array lookup - * - * 01 27 2010 wh.su - * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code - * add and fixed some security function. - * - * 01 22 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Support protection and bandwidth switch - * - * 01 20 2010 kevin.huang - * [BORA00000569][WIFISYS] Phase 2 Integration Test - * Add PHASE_2_INTEGRATION_WORK_AROUND and CFG_SUPPORT_BCM flags - * - * 01 11 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add Deauth and Disassoc Handler - * - * 01 08 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * - * Refine Beacon processing, add read RF channel from RX Status - * - * 01 04 2010 tehuang.liu - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * For working out the first connection Chariot-verified version - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * Dec 12 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Modify u2EstimatedExtraIELen for probe request - * - * Dec 9 2009 mtk01104 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add HT cap IE to probe request - * - * Dec 7 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix lint warning - * - * - * Dec 3 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Update the process of SCAN Result by adding more Phy Attributes - * - * Dec 1 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adjust the function and code for meet the new define - * - * Nov 30 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Rename u4RSSI to i4RSSI - * - * Nov 30 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Report event of scan result to host - * - * Nov 26 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix SCAN Record update - * - * Nov 24 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Revise MGMT Handler with Retain Status and Integrate with TXM - * - * Nov 23 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add (Ext)Support Rate Set IE to ProbeReq - * - * Nov 20 2009 mtk02468 - * [BORA00000337] To check in codes for FPGA emulation - * Removed the use of SW_RFB->u2FrameLength - * - * Nov 20 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix uninitial aucMacAddress[] for ProbeReq - * - * Nov 16 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add scanSearchBssDescByPolicy() - * - * Nov 5 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Add Send Probe Request Frame - * - * Oct 30 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define REPLICATED_BEACON_TIME_THRESHOLD (3000) -#define REPLICATED_BEACON_FRESH_PERIOD (10000) -#define REPLICATED_BEACON_STRENGTH_THRESHOLD (32) - -#define ROAMING_NO_SWING_RCPI_STEP (10) - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used by SCN to initialize its variables -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -scnInit ( - IN P_ADAPTER_T prAdapter - ) -{ - P_SCAN_INFO_T prScanInfo; - P_BSS_DESC_T prBSSDesc; - PUINT_8 pucBSSBuff; - UINT_32 i; - - - ASSERT(prAdapter); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - pucBSSBuff = &prScanInfo->aucScanBuffer[0]; - - - DBGLOG(SCN, INFO, ("->scnInit()\n")); - - //4 <1> Reset STATE and Message List - prScanInfo->eCurrentState = SCAN_STATE_IDLE; - - prScanInfo->rLastScanCompletedTime = (OS_SYSTIME)0; - - LINK_INITIALIZE(&prScanInfo->rPendingMsgList); - - - //4 <2> Reset link list of BSS_DESC_T - kalMemZero((PVOID) pucBSSBuff, SCN_MAX_BUFFER_SIZE); - - LINK_INITIALIZE(&prScanInfo->rFreeBSSDescList); - LINK_INITIALIZE(&prScanInfo->rBSSDescList); - - for (i = 0; i < CFG_MAX_NUM_BSS_LIST; i++) { - - prBSSDesc = (P_BSS_DESC_T)pucBSSBuff; - - LINK_INSERT_TAIL(&prScanInfo->rFreeBSSDescList, &prBSSDesc->rLinkEntry); - - pucBSSBuff += ALIGN_4(sizeof(BSS_DESC_T)); - } - /* Check if the memory allocation consist with this initialization function */ - ASSERT(((UINT_32)pucBSSBuff - (UINT_32)&prScanInfo->aucScanBuffer[0]) == SCN_MAX_BUFFER_SIZE); - - /* reset freest channel information */ - prScanInfo->fgIsSparseChannelValid = FALSE; - - return; -} /* end of scnInit() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used by SCN to uninitialize its variables -* -* @param (none) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -scnUninit ( - IN P_ADAPTER_T prAdapter - ) -{ - P_SCAN_INFO_T prScanInfo; - - - ASSERT(prAdapter); - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - - DBGLOG(SCN, INFO, ("->scnUninit()\n")); - - //4 <1> Reset STATE and Message List - prScanInfo->eCurrentState = SCAN_STATE_IDLE; - - prScanInfo->rLastScanCompletedTime = (OS_SYSTIME)0; - - /* NOTE(Kevin): Check rPendingMsgList ? */ - - //4 <2> Reset link list of BSS_DESC_T - LINK_INITIALIZE(&prScanInfo->rFreeBSSDescList); - LINK_INITIALIZE(&prScanInfo->rBSSDescList); - - return; -} /* end of scnUninit() */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Find the corresponding BSS Descriptor according to given BSSID -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] aucBSSID Given BSSID. -* -* @return Pointer to BSS Descriptor, if found. NULL, if not found -*/ -/*----------------------------------------------------------------------------*/ -P_BSS_DESC_T -scanSearchBssDescByBssid ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucBSSID[] - ) -{ - return scanSearchBssDescByBssidAndSsid(prAdapter, - aucBSSID, - FALSE, - NULL); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Find the corresponding BSS Descriptor according to given BSSID -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] aucBSSID Given BSSID. -* @param[in] fgCheckSsid Need to check SSID or not. (for multiple SSID with single BSSID cases) -* @param[in] prSsid Specified SSID -* -* @return Pointer to BSS Descriptor, if found. NULL, if not found -*/ -/*----------------------------------------------------------------------------*/ -P_BSS_DESC_T -scanSearchBssDescByBssidAndSsid ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucBSSID[], - IN BOOLEAN fgCheckSsid, - IN P_PARAM_SSID_T prSsid - ) -{ - P_SCAN_INFO_T prScanInfo; - P_LINK_T prBSSDescList; - P_BSS_DESC_T prBssDesc; - P_BSS_DESC_T prDstBssDesc = (P_BSS_DESC_T)NULL; - - - ASSERT(prAdapter); - ASSERT(aucBSSID); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - - prBSSDescList = &prScanInfo->rBSSDescList; - - /* Search BSS Desc from current SCAN result list. */ - LINK_FOR_EACH_ENTRY(prBssDesc, prBSSDescList, rLinkEntry, BSS_DESC_T) { - - if (EQUAL_MAC_ADDR(prBssDesc->aucBSSID, aucBSSID)) { - if(fgCheckSsid == FALSE || prSsid == NULL) { - return prBssDesc; - } - else { - if(EQUAL_SSID(prBssDesc->aucSSID, - prBssDesc->ucSSIDLen, - prSsid->aucSsid, - prSsid->u4SsidLen)) { - return prBssDesc; - } - else if(prDstBssDesc == NULL && prBssDesc->fgIsHiddenSSID == TRUE) { - prDstBssDesc = prBssDesc; - } - else { - /* 20120206 frog: Equal BSSID but not SSID, SSID not hidden, SSID must be updated. */ - COPY_SSID(prBssDesc->aucSSID, - prBssDesc->ucSSIDLen, - prSsid->aucSsid, - prSsid->u4SsidLen); - return prBssDesc; - } - } - } - } - - return prDstBssDesc; - -} /* end of scanSearchBssDescByBssid() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Find the corresponding BSS Descriptor according to given Transmitter Address. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] aucSrcAddr Given Source Address(TA). -* -* @return Pointer to BSS Descriptor, if found. NULL, if not found -*/ -/*----------------------------------------------------------------------------*/ -P_BSS_DESC_T -scanSearchBssDescByTA ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucSrcAddr[] - ) -{ - return scanSearchBssDescByTAAndSsid(prAdapter, - aucSrcAddr, - FALSE, - NULL); -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Find the corresponding BSS Descriptor according to given Transmitter Address. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] aucSrcAddr Given Source Address(TA). -* @param[in] fgCheckSsid Need to check SSID or not. (for multiple SSID with single BSSID cases) -* @param[in] prSsid Specified SSID -* -* @return Pointer to BSS Descriptor, if found. NULL, if not found -*/ -/*----------------------------------------------------------------------------*/ -P_BSS_DESC_T -scanSearchBssDescByTAAndSsid ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucSrcAddr[], - IN BOOLEAN fgCheckSsid, - IN P_PARAM_SSID_T prSsid - ) -{ - P_SCAN_INFO_T prScanInfo; - P_LINK_T prBSSDescList; - P_BSS_DESC_T prBssDesc; - P_BSS_DESC_T prDstBssDesc = (P_BSS_DESC_T)NULL; - - - ASSERT(prAdapter); - ASSERT(aucSrcAddr); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - - prBSSDescList = &prScanInfo->rBSSDescList; - - /* Search BSS Desc from current SCAN result list. */ - LINK_FOR_EACH_ENTRY(prBssDesc, prBSSDescList, rLinkEntry, BSS_DESC_T) { - - if (EQUAL_MAC_ADDR(prBssDesc->aucSrcAddr, aucSrcAddr)) { - if(fgCheckSsid == FALSE || prSsid == NULL) { - return prBssDesc; - } - else { - if(EQUAL_SSID(prBssDesc->aucSSID, - prBssDesc->ucSSIDLen, - prSsid->aucSsid, - prSsid->u4SsidLen)) { - return prBssDesc; - } - else if(prDstBssDesc == NULL && prBssDesc->fgIsHiddenSSID == TRUE) { - prDstBssDesc = prBssDesc; - } - } - } - } - - return prDstBssDesc; - -} /* end of scanSearchBssDescByTA() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Find the corresponding BSS Descriptor according to -* given eBSSType, BSSID and Transmitter Address -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] eBSSType BSS Type of incoming Beacon/ProbeResp frame. -* @param[in] aucBSSID Given BSSID of Beacon/ProbeResp frame. -* @param[in] aucSrcAddr Given source address (TA) of Beacon/ProbeResp frame. -* -* @return Pointer to BSS Descriptor, if found. NULL, if not found -*/ -/*----------------------------------------------------------------------------*/ -P_BSS_DESC_T -scanSearchExistingBssDesc ( - IN P_ADAPTER_T prAdapter, - IN ENUM_BSS_TYPE_T eBSSType, - IN UINT_8 aucBSSID[], - IN UINT_8 aucSrcAddr[] - ) -{ - return scanSearchExistingBssDescWithSsid(prAdapter, - eBSSType, - aucBSSID, - aucSrcAddr, - FALSE, - NULL); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Find the corresponding BSS Descriptor according to -* given eBSSType, BSSID and Transmitter Address -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] eBSSType BSS Type of incoming Beacon/ProbeResp frame. -* @param[in] aucBSSID Given BSSID of Beacon/ProbeResp frame. -* @param[in] aucSrcAddr Given source address (TA) of Beacon/ProbeResp frame. -* @param[in] fgCheckSsid Need to check SSID or not. (for multiple SSID with single BSSID cases) -* @param[in] prSsid Specified SSID -* -* @return Pointer to BSS Descriptor, if found. NULL, if not found -*/ -/*----------------------------------------------------------------------------*/ -P_BSS_DESC_T -scanSearchExistingBssDescWithSsid ( - IN P_ADAPTER_T prAdapter, - IN ENUM_BSS_TYPE_T eBSSType, - IN UINT_8 aucBSSID[], - IN UINT_8 aucSrcAddr[], - IN BOOLEAN fgCheckSsid, - IN P_PARAM_SSID_T prSsid - ) -{ - P_SCAN_INFO_T prScanInfo; - P_BSS_DESC_T prBssDesc, prIBSSBssDesc; - - ASSERT(prAdapter); - ASSERT(aucSrcAddr); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - - - switch (eBSSType) { - case BSS_TYPE_P2P_DEVICE: - fgCheckSsid = FALSE; - case BSS_TYPE_INFRASTRUCTURE: - case BSS_TYPE_BOW_DEVICE: - { - prBssDesc = scanSearchBssDescByBssidAndSsid(prAdapter, aucBSSID, fgCheckSsid, prSsid); - - /* if (eBSSType == prBssDesc->eBSSType) */ - - return prBssDesc; - } - - case BSS_TYPE_IBSS: - { - prIBSSBssDesc = scanSearchBssDescByBssidAndSsid(prAdapter, aucBSSID, fgCheckSsid, prSsid); - prBssDesc = scanSearchBssDescByTAAndSsid(prAdapter, aucSrcAddr, fgCheckSsid, prSsid); - - /* NOTE(Kevin): - * Rules to maintain the SCAN Result: - * For AdHoc - - * CASE I We have TA1(BSSID1), but it change its BSSID to BSSID2 - * -> Update TA1 entry's BSSID. - * CASE II We have TA1(BSSID1), and get TA1(BSSID1) again - * -> Update TA1 entry's contain. - * CASE III We have a SCAN result TA1(BSSID1), and TA2(BSSID2). Sooner or - * later, TA2 merge into TA1, we get TA2(BSSID1) - * -> Remove TA2 first and then replace TA1 entry's TA with TA2, Still have only one entry of BSSID. - * CASE IV We have a SCAN result TA1(BSSID1), and another TA2 also merge into BSSID1. - * -> Replace TA1 entry's TA with TA2, Still have only one entry. - * CASE V New IBSS - * -> Add this one to SCAN result. - */ - if (prBssDesc) { - if ((!prIBSSBssDesc) || // CASE I - (prBssDesc == prIBSSBssDesc)) { // CASE II - - return prBssDesc; - } - else { // CASE III - P_LINK_T prBSSDescList; - P_LINK_T prFreeBSSDescList; - - - prBSSDescList = &prScanInfo->rBSSDescList; - prFreeBSSDescList = &prScanInfo->rFreeBSSDescList; - - /* Remove this BSS Desc from the BSS Desc list */ - LINK_REMOVE_KNOWN_ENTRY(prBSSDescList, prBssDesc); - - /* Return this BSS Desc to the free BSS Desc list. */ - LINK_INSERT_TAIL(prFreeBSSDescList, &prBssDesc->rLinkEntry); - - return prIBSSBssDesc; - } - } - - if (prIBSSBssDesc) { // CASE IV - - return prIBSSBssDesc; - } - - // CASE V - break; // Return NULL; - } - - default: - break; - } - - - return (P_BSS_DESC_T)NULL; - -} /* end of scanSearchExistingBssDesc() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Delete BSS Descriptors from current list according to given Remove Policy. -* -* @param[in] u4RemovePolicy Remove Policy. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -scanRemoveBssDescsByPolicy ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4RemovePolicy - ) -{ - P_CONNECTION_SETTINGS_T prConnSettings; - P_SCAN_INFO_T prScanInfo; - P_LINK_T prBSSDescList; - P_LINK_T prFreeBSSDescList; - P_BSS_DESC_T prBssDesc; - - - ASSERT(prAdapter); - - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prBSSDescList = &prScanInfo->rBSSDescList; - prFreeBSSDescList = &prScanInfo->rFreeBSSDescList; - - //DBGLOG(SCN, TRACE, ("Before Remove - Number Of SCAN Result = %ld\n", - //prBSSDescList->u4NumElem)); - - if (u4RemovePolicy & SCN_RM_POLICY_TIMEOUT) { - P_BSS_DESC_T prBSSDescNext; - OS_SYSTIME rCurrentTime; - - - GET_CURRENT_SYSTIME(&rCurrentTime); - - /* Search BSS Desc from current SCAN result list. */ - LINK_FOR_EACH_ENTRY_SAFE(prBssDesc, prBSSDescNext, prBSSDescList, rLinkEntry, BSS_DESC_T) { - - if ((u4RemovePolicy & SCN_RM_POLICY_EXCLUDE_CONNECTED) && - (prBssDesc->fgIsConnected || prBssDesc->fgIsConnecting)) { - /* Don't remove the one currently we are connected. */ - continue; - } - - if (CHECK_FOR_TIMEOUT(rCurrentTime, prBssDesc->rUpdateTime, - SEC_TO_SYSTIME(SCN_BSS_DESC_REMOVE_TIMEOUT_SEC)) ) { - - //DBGLOG(SCN, TRACE, ("Remove TIMEOUT BSS DESC(%#x): MAC: "MACSTR", Current Time = %08lx, Update Time = %08lx\n", - //prBssDesc, MAC2STR(prBssDesc->aucBSSID), rCurrentTime, prBssDesc->rUpdateTime)); - - /* Remove this BSS Desc from the BSS Desc list */ - LINK_REMOVE_KNOWN_ENTRY(prBSSDescList, prBssDesc); - - /* Return this BSS Desc to the free BSS Desc list. */ - LINK_INSERT_TAIL(prFreeBSSDescList, &prBssDesc->rLinkEntry); - } - } - } - else if (u4RemovePolicy & SCN_RM_POLICY_OLDEST_HIDDEN) { - P_BSS_DESC_T prBssDescOldest = (P_BSS_DESC_T)NULL; - - - /* Search BSS Desc from current SCAN result list. */ - LINK_FOR_EACH_ENTRY(prBssDesc, prBSSDescList, rLinkEntry, BSS_DESC_T) { - - if ((u4RemovePolicy & SCN_RM_POLICY_EXCLUDE_CONNECTED) && - (prBssDesc->fgIsConnected || prBssDesc->fgIsConnecting)) { - /* Don't remove the one currently we are connected. */ - continue; - } - - if (!prBssDesc->fgIsHiddenSSID) { - continue; - } - - if (!prBssDescOldest) { /* 1st element */ - prBssDescOldest = prBssDesc; - continue; - } - - if (TIME_BEFORE(prBssDesc->rUpdateTime, prBssDescOldest->rUpdateTime)) { - prBssDescOldest = prBssDesc; - } - } - - if (prBssDescOldest) { - - //DBGLOG(SCN, TRACE, ("Remove OLDEST HIDDEN BSS DESC(%#x): MAC: "MACSTR", Update Time = %08lx\n", - //prBssDescOldest, MAC2STR(prBssDescOldest->aucBSSID), prBssDescOldest->rUpdateTime)); - - /* Remove this BSS Desc from the BSS Desc list */ - LINK_REMOVE_KNOWN_ENTRY(prBSSDescList, prBssDescOldest); - - /* Return this BSS Desc to the free BSS Desc list. */ - LINK_INSERT_TAIL(prFreeBSSDescList, &prBssDescOldest->rLinkEntry); - } - } - else if (u4RemovePolicy & SCN_RM_POLICY_SMART_WEAKEST) { - P_BSS_DESC_T prBssDescWeakest = (P_BSS_DESC_T)NULL; - P_BSS_DESC_T prBssDescWeakestSameSSID = (P_BSS_DESC_T)NULL; - UINT_32 u4SameSSIDCount = 0; - - - /* Search BSS Desc from current SCAN result list. */ - LINK_FOR_EACH_ENTRY(prBssDesc, prBSSDescList, rLinkEntry, BSS_DESC_T) { - - if ((u4RemovePolicy & SCN_RM_POLICY_EXCLUDE_CONNECTED) && - (prBssDesc->fgIsConnected || prBssDesc->fgIsConnecting)) { - /* Don't remove the one currently we are connected. */ - continue; - } - - if ((!prBssDesc->fgIsHiddenSSID) && - (EQUAL_SSID(prBssDesc->aucSSID, - prBssDesc->ucSSIDLen, - prConnSettings->aucSSID, - prConnSettings->ucSSIDLen))) { - - u4SameSSIDCount++; - - if (!prBssDescWeakestSameSSID) { - prBssDescWeakestSameSSID = prBssDesc; - } - else if (prBssDesc->ucRCPI < prBssDescWeakestSameSSID->ucRCPI) { - prBssDescWeakestSameSSID = prBssDesc; - } - } - - if (!prBssDescWeakest) { /* 1st element */ - prBssDescWeakest = prBssDesc; - continue; - } - - if (prBssDesc->ucRCPI < prBssDescWeakest->ucRCPI) { - prBssDescWeakest = prBssDesc; - } - - } - - if ((u4SameSSIDCount >= SCN_BSS_DESC_SAME_SSID_THRESHOLD) && - (prBssDescWeakestSameSSID)) { - prBssDescWeakest = prBssDescWeakestSameSSID; - } - - if (prBssDescWeakest) { - - //DBGLOG(SCN, TRACE, ("Remove WEAKEST BSS DESC(%#x): MAC: "MACSTR", Update Time = %08lx\n", - //prBssDescOldest, MAC2STR(prBssDescOldest->aucBSSID), prBssDescOldest->rUpdateTime)); - - /* Remove this BSS Desc from the BSS Desc list */ - LINK_REMOVE_KNOWN_ENTRY(prBSSDescList, prBssDescWeakest); - - /* Return this BSS Desc to the free BSS Desc list. */ - LINK_INSERT_TAIL(prFreeBSSDescList, &prBssDescWeakest->rLinkEntry); - } - } - else if (u4RemovePolicy & SCN_RM_POLICY_ENTIRE) { - P_BSS_DESC_T prBSSDescNext; - - LINK_FOR_EACH_ENTRY_SAFE(prBssDesc, prBSSDescNext, prBSSDescList, rLinkEntry, BSS_DESC_T) { - - if ((u4RemovePolicy & SCN_RM_POLICY_EXCLUDE_CONNECTED) && - (prBssDesc->fgIsConnected || prBssDesc->fgIsConnecting)) { - /* Don't remove the one currently we are connected. */ - continue; - } - - /* Remove this BSS Desc from the BSS Desc list */ - LINK_REMOVE_KNOWN_ENTRY(prBSSDescList, prBssDesc); - - /* Return this BSS Desc to the free BSS Desc list. */ - LINK_INSERT_TAIL(prFreeBSSDescList, &prBssDesc->rLinkEntry); - } - - } - - return; - -} /* end of scanRemoveBssDescsByPolicy() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Delete BSS Descriptors from current list according to given BSSID. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] aucBSSID Given BSSID. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -scanRemoveBssDescByBssid ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucBSSID[] - ) -{ - P_SCAN_INFO_T prScanInfo; - P_LINK_T prBSSDescList; - P_LINK_T prFreeBSSDescList; - P_BSS_DESC_T prBssDesc = (P_BSS_DESC_T)NULL; - P_BSS_DESC_T prBSSDescNext; - - - ASSERT(prAdapter); - ASSERT(aucBSSID); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prBSSDescList = &prScanInfo->rBSSDescList; - prFreeBSSDescList = &prScanInfo->rFreeBSSDescList; - - /* Check if such BSS Descriptor exists in a valid list */ - LINK_FOR_EACH_ENTRY_SAFE(prBssDesc, prBSSDescNext, prBSSDescList, rLinkEntry, BSS_DESC_T) { - - if (EQUAL_MAC_ADDR(prBssDesc->aucBSSID, aucBSSID)) { - - /* Remove this BSS Desc from the BSS Desc list */ - LINK_REMOVE_KNOWN_ENTRY(prBSSDescList, prBssDesc); - - /* Return this BSS Desc to the free BSS Desc list. */ - LINK_INSERT_TAIL(prFreeBSSDescList, &prBssDesc->rLinkEntry); - - /* BSSID is not unique, so need to traverse whols link-list */ - } - } - - return; -} /* end of scanRemoveBssDescByBssid() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Delete BSS Descriptors from current list according to given band configuration -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] eBand Given band -* @param[in] eNetTypeIndex AIS - Remove IBSS/Infrastructure BSS -* BOW - Remove BOW BSS -* P2P - Remove P2P BSS -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -scanRemoveBssDescByBandAndNetwork ( - IN P_ADAPTER_T prAdapter, - IN ENUM_BAND_T eBand, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ) -{ - P_SCAN_INFO_T prScanInfo; - P_LINK_T prBSSDescList; - P_LINK_T prFreeBSSDescList; - P_BSS_DESC_T prBssDesc = (P_BSS_DESC_T)NULL; - P_BSS_DESC_T prBSSDescNext; - BOOLEAN fgToRemove; - - ASSERT(prAdapter); - ASSERT(eBand <= BAND_NUM); - ASSERT(eNetTypeIndex <= NETWORK_TYPE_INDEX_NUM); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prBSSDescList = &prScanInfo->rBSSDescList; - prFreeBSSDescList = &prScanInfo->rFreeBSSDescList; - - - if(eBand == BAND_NULL) { - return; /* no need to do anything, keep all scan result */ - } - - /* Check if such BSS Descriptor exists in a valid list */ - LINK_FOR_EACH_ENTRY_SAFE(prBssDesc, prBSSDescNext, prBSSDescList, rLinkEntry, BSS_DESC_T) { - fgToRemove = FALSE; - - if(prBssDesc->eBand == eBand) { - switch (eNetTypeIndex) { - case NETWORK_TYPE_AIS_INDEX: - if((prBssDesc->eBSSType == BSS_TYPE_INFRASTRUCTURE) - || (prBssDesc->eBSSType == BSS_TYPE_IBSS)) { - fgToRemove = TRUE; - } - break; - - case NETWORK_TYPE_P2P_INDEX: - if(prBssDesc->eBSSType == BSS_TYPE_P2P_DEVICE) { - fgToRemove = TRUE; - } - break; - - case NETWORK_TYPE_BOW_INDEX: - if(prBssDesc->eBSSType == BSS_TYPE_BOW_DEVICE) { - fgToRemove = TRUE; - } - break; - - default: - ASSERT(0); - break; - } - } - - if(fgToRemove == TRUE) { - /* Remove this BSS Desc from the BSS Desc list */ - LINK_REMOVE_KNOWN_ENTRY(prBSSDescList, prBssDesc); - - /* Return this BSS Desc to the free BSS Desc list. */ - LINK_INSERT_TAIL(prFreeBSSDescList, &prBssDesc->rLinkEntry); - } - } - - return; -} /* end of scanRemoveBssDescByBand() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Clear the CONNECTION FLAG of a specified BSS Descriptor. -* -* @param[in] aucBSSID Given BSSID. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -scanRemoveConnFlagOfBssDescByBssid ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 aucBSSID[] - ) -{ - P_SCAN_INFO_T prScanInfo; - P_LINK_T prBSSDescList; - P_BSS_DESC_T prBssDesc = (P_BSS_DESC_T)NULL; - - - ASSERT(prAdapter); - ASSERT(aucBSSID); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prBSSDescList = &prScanInfo->rBSSDescList; - - /* Search BSS Desc from current SCAN result list. */ - LINK_FOR_EACH_ENTRY(prBssDesc, prBSSDescList, rLinkEntry, BSS_DESC_T) { - - if (EQUAL_MAC_ADDR(prBssDesc->aucBSSID, aucBSSID)) { - prBssDesc->fgIsConnected = FALSE; - prBssDesc->fgIsConnecting = FALSE; - - /* BSSID is not unique, so need to traverse whols link-list */ - } - } - - return; - -} /* end of scanRemoveConnectionFlagOfBssDescByBssid() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Allocate new BSS_DESC_T -* -* @param[in] prAdapter Pointer to the Adapter structure. -* -* @return Pointer to BSS Descriptor, if has free space. NULL, if has no space. -*/ -/*----------------------------------------------------------------------------*/ -P_BSS_DESC_T -scanAllocateBssDesc ( - IN P_ADAPTER_T prAdapter - ) -{ - P_SCAN_INFO_T prScanInfo; - P_LINK_T prFreeBSSDescList; - P_BSS_DESC_T prBssDesc; - - - ASSERT(prAdapter); - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - - prFreeBSSDescList = &prScanInfo->rFreeBSSDescList; - - LINK_REMOVE_HEAD(prFreeBSSDescList, prBssDesc, P_BSS_DESC_T); - - if (prBssDesc) { - P_LINK_T prBSSDescList; - - kalMemZero(prBssDesc, sizeof(BSS_DESC_T)); - -#if CFG_ENABLE_WIFI_DIRECT - LINK_INITIALIZE(&(prBssDesc->rP2pDeviceList)); - prBssDesc->fgIsP2PPresent = FALSE; -#endif /* CFG_ENABLE_WIFI_DIRECT */ - - prBSSDescList = &prScanInfo->rBSSDescList; - - /* NOTE(Kevin): In current design, this new empty BSS_DESC_T will be - * inserted to BSSDescList immediately. - */ - LINK_INSERT_TAIL(prBSSDescList, &prBssDesc->rLinkEntry); - } - - return prBssDesc; - -} /* end of scanAllocateBssDesc() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This API parses Beacon/ProbeResp frame and insert extracted BSS_DESC_T -* with IEs into prAdapter->rWifiVar.rScanInfo.aucScanBuffer -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prSwRfb Pointer to the receiving frame buffer. -* -* @return Pointer to BSS Descriptor -* NULL if the Beacon/ProbeResp frame is invalid -*/ -/*----------------------------------------------------------------------------*/ -P_BSS_DESC_T -scanAddToBssDesc ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_BSS_DESC_T prBssDesc = NULL; - UINT_16 u2CapInfo; - ENUM_BSS_TYPE_T eBSSType = BSS_TYPE_INFRASTRUCTURE; - - PUINT_8 pucIE; - UINT_16 u2IELength; - UINT_16 u2Offset = 0; - - P_WLAN_BEACON_FRAME_T prWlanBeaconFrame = (P_WLAN_BEACON_FRAME_T)NULL; - P_IE_SSID_T prIeSsid = (P_IE_SSID_T)NULL; - P_IE_SUPPORTED_RATE_T prIeSupportedRate = (P_IE_SUPPORTED_RATE_T)NULL; - P_IE_EXT_SUPPORTED_RATE_T prIeExtSupportedRate = (P_IE_EXT_SUPPORTED_RATE_T)NULL; - P_HIF_RX_HEADER_T prHifRxHdr; - UINT_8 ucHwChannelNum = 0; - UINT_8 ucIeDsChannelNum = 0; - UINT_8 ucIeHtChannelNum = 0; - BOOLEAN fgIsValidSsid = FALSE, fgEscape = FALSE; - PARAM_SSID_T rSsid; - UINT_64 u8Timestamp; - - UINT_32 i; - UINT_8 ucSSIDChar; - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - prWlanBeaconFrame = (P_WLAN_BEACON_FRAME_T)prSwRfb->pvHeader; - - WLAN_GET_FIELD_16(&prWlanBeaconFrame->u2CapInfo, &u2CapInfo); - WLAN_GET_FIELD_64(&prWlanBeaconFrame->au4Timestamp[0], &u8Timestamp); - - // decide BSS type - switch (u2CapInfo & CAP_INFO_BSS_TYPE) { - case CAP_INFO_ESS: - /* It can also be Group Owner of P2P Group. */ - eBSSType = BSS_TYPE_INFRASTRUCTURE; - break; - - case CAP_INFO_IBSS: - eBSSType = BSS_TYPE_IBSS; - break; - case 0: - /* The P2P Device shall set the ESS bit of the Capabilities field in the Probe Response fame to 0 and IBSS bit to 0. (3.1.2.1.1) */ - eBSSType = BSS_TYPE_P2P_DEVICE; - break; - -#if CFG_ENABLE_BT_OVER_WIFI - // @TODO: add rule to identify BOW beacons -#endif - - default: - return NULL; - } - - //4 <1.1> Pre-parse SSID IE - pucIE = prWlanBeaconFrame->aucInfoElem; - u2IELength = (prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen) - - (UINT_16)OFFSET_OF(WLAN_BEACON_FRAME_BODY_T, aucInfoElem[0]); - - if (u2IELength > CFG_IE_BUFFER_SIZE) { - u2IELength = CFG_IE_BUFFER_SIZE; - } - - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - switch (IE_ID(pucIE)) { - case ELEM_ID_SSID: - if (IE_LEN(pucIE) <= ELEM_MAX_LEN_SSID) { - ucSSIDChar = '\0'; - - /* D-Link DWL-900AP+ */ - if (IE_LEN(pucIE) == 0) { - fgIsValidSsid = FALSE; - } - /* Cisco AP1230A - (IE_LEN(pucIE) == 1) && (SSID_IE(pucIE)->aucSSID[0] == '\0') */ - /* Linksys WRK54G/ASUS WL520g - (IE_LEN(pucIE) == n) && (SSID_IE(pucIE)->aucSSID[0~(n-1)] == '\0') */ - else { - for (i = 0; i < IE_LEN(pucIE); i++) { - ucSSIDChar |= SSID_IE(pucIE)->aucSSID[i]; - } - - if (ucSSIDChar) { - fgIsValidSsid = TRUE; - } - } - - /* Update SSID to BSS Descriptor only if SSID is not hidden. */ - if (fgIsValidSsid == TRUE) { - COPY_SSID(rSsid.aucSsid, - rSsid.u4SsidLen, - SSID_IE(pucIE)->aucSSID, - SSID_IE(pucIE)->ucLength); - } - } - fgEscape = TRUE; - break; - default: - break; - } - - if(fgEscape == TRUE) { - break; - } - } - - - //4 <1.2> Replace existing BSS_DESC_T or allocate a new one - prBssDesc = scanSearchExistingBssDescWithSsid(prAdapter, - eBSSType, - (PUINT_8)prWlanBeaconFrame->aucBSSID, - (PUINT_8)prWlanBeaconFrame->aucSrcAddr, - fgIsValidSsid, - fgIsValidSsid == TRUE ? &rSsid : NULL); - - if (prBssDesc == (P_BSS_DESC_T)NULL) { - do { - //4 <1.2.1> First trial of allocation - prBssDesc = scanAllocateBssDesc(prAdapter); - if (prBssDesc) { - break; - } - - //4 <1.2.2> Hidden is useless, remove the oldest hidden ssid. (for passive scan) - scanRemoveBssDescsByPolicy(prAdapter, - (SCN_RM_POLICY_EXCLUDE_CONNECTED | SCN_RM_POLICY_OLDEST_HIDDEN)); - - //4 <1.2.3> Second tail of allocation - prBssDesc = scanAllocateBssDesc(prAdapter); - if (prBssDesc) { - break; - } - - //4 <1.2.4> Remove the weakest one - /* If there are more than half of BSS which has the same ssid as connection - * setting, remove the weakest one from them. - * Else remove the weakest one. - */ - scanRemoveBssDescsByPolicy(prAdapter, - (SCN_RM_POLICY_EXCLUDE_CONNECTED | SCN_RM_POLICY_SMART_WEAKEST)); - - //4 <1.2.5> reallocation - prBssDesc = scanAllocateBssDesc(prAdapter); - if (prBssDesc) { - break; - } - - //4 <1.2.6> no space, should not happen - //ASSERT(0); // still no space available ? - return NULL; - - } - while(FALSE); - - } - else { - OS_SYSTIME rCurrentTime; - - // WCXRP00000091 - // if the received strength is much weaker than the original one, - // ignore it due to it might be received on the folding frequency - - GET_CURRENT_SYSTIME(&rCurrentTime); - - prBssDesc->eBSSType = eBSSType; - - if(HIF_RX_HDR_GET_CHNL_NUM(prSwRfb->prHifRxHdr) != prBssDesc->ucChannelNum && - prBssDesc->ucRCPI > prSwRfb->prHifRxHdr->ucRcpi) { - - // for signal strength is too much weaker and previous beacon is not stale - if((prBssDesc->ucRCPI - prSwRfb->prHifRxHdr->ucRcpi) >= REPLICATED_BEACON_STRENGTH_THRESHOLD && - rCurrentTime - prBssDesc->rUpdateTime <= REPLICATED_BEACON_FRESH_PERIOD) { - return prBssDesc; - } - // for received beacons too close in time domain - else if(rCurrentTime - prBssDesc->rUpdateTime <= REPLICATED_BEACON_TIME_THRESHOLD) { - return prBssDesc; - } - } - - /* if Timestamp has been reset, re-generate BSS DESC 'cause AP should have reset itself */ - if(prBssDesc->eBSSType == BSS_TYPE_INFRASTRUCTURE && u8Timestamp < prBssDesc->u8TimeStamp.QuadPart) { - scanRemoveBssDescByBssid(prAdapter, prBssDesc->aucBSSID); - - prBssDesc = scanAllocateBssDesc(prAdapter); - if (!prBssDesc) { - return NULL; - } - } - } - - /* NOTE: Keep consistency of Scan Record during JOIN process */ - if (prBssDesc->fgIsConnecting) { - return prBssDesc; - } - - //4 <2> Get information from Fixed Fields - prBssDesc->eBSSType = eBSSType; /* Update the latest BSS type information. */ - - COPY_MAC_ADDR(prBssDesc->aucSrcAddr, prWlanBeaconFrame->aucSrcAddr); - - COPY_MAC_ADDR(prBssDesc->aucBSSID, prWlanBeaconFrame->aucBSSID); - - prBssDesc->u8TimeStamp.QuadPart = u8Timestamp; - - WLAN_GET_FIELD_16(&prWlanBeaconFrame->u2BeaconInterval, &prBssDesc->u2BeaconInterval); - - prBssDesc->u2CapInfo = u2CapInfo; - - - //4 <2.1> Retrieve IEs for later parsing - u2IELength = (prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen) - - (UINT_16)OFFSET_OF(WLAN_BEACON_FRAME_BODY_T, aucInfoElem[0]); - - if (u2IELength > CFG_IE_BUFFER_SIZE) { - u2IELength = CFG_IE_BUFFER_SIZE; - prBssDesc->fgIsIEOverflow = TRUE; - } - else { - prBssDesc->fgIsIEOverflow = FALSE; - } - prBssDesc->u2IELength = u2IELength; - - kalMemCopy(prBssDesc->aucIEBuf, prWlanBeaconFrame->aucInfoElem, u2IELength); - - //4 <2.2> reset prBssDesc variables in case that AP has been reconfigured - prBssDesc->fgIsERPPresent = FALSE; - prBssDesc->fgIsHTPresent = FALSE; - prBssDesc->eSco = CHNL_EXT_SCN; - prBssDesc->fgIEWAPI = FALSE; -#if CFG_RSN_MIGRATION - prBssDesc->fgIERSN = FALSE; -#endif -#if CFG_PRIVACY_MIGRATION - prBssDesc->fgIEWPA = FALSE; -#endif - - - //4 <3.1> Full IE parsing on SW_RFB_T - pucIE = prWlanBeaconFrame->aucInfoElem; - - - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - - switch (IE_ID(pucIE)) { - case ELEM_ID_SSID: - if ((!prIeSsid) && /* NOTE(Kevin): for Atheros IOT #1 */ - (IE_LEN(pucIE) <= ELEM_MAX_LEN_SSID)) { - BOOLEAN fgIsHiddenSSID = FALSE; - ucSSIDChar = '\0'; - - - prIeSsid = (P_IE_SSID_T)pucIE; - - /* D-Link DWL-900AP+ */ - if (IE_LEN(pucIE) == 0) { - fgIsHiddenSSID = TRUE; - } - /* Cisco AP1230A - (IE_LEN(pucIE) == 1) && (SSID_IE(pucIE)->aucSSID[0] == '\0') */ - /* Linksys WRK54G/ASUS WL520g - (IE_LEN(pucIE) == n) && (SSID_IE(pucIE)->aucSSID[0~(n-1)] == '\0') */ - else { - for (i = 0; i < IE_LEN(pucIE); i++) { - ucSSIDChar |= SSID_IE(pucIE)->aucSSID[i]; - } - - if (!ucSSIDChar) { - fgIsHiddenSSID = TRUE; - } - } - - /* Update SSID to BSS Descriptor only if SSID is not hidden. */ - if (!fgIsHiddenSSID) { - COPY_SSID(prBssDesc->aucSSID, - prBssDesc->ucSSIDLen, - SSID_IE(pucIE)->aucSSID, - SSID_IE(pucIE)->ucLength); - } - - } - break; - - case ELEM_ID_SUP_RATES: - /* NOTE(Kevin): Buffalo WHR-G54S's supported rate set IE exceed 8. - * IE_LEN(pucIE) == 12, "1(B), 2(B), 5.5(B), 6(B), 9(B), 11(B), - * 12(B), 18(B), 24(B), 36(B), 48(B), 54(B)" - */ - /* TP-LINK will set extra and incorrect ie with ELEM_ID_SUP_RATES */ - if ((!prIeSupportedRate) && (IE_LEN(pucIE) <= RATE_NUM)) { - prIeSupportedRate = SUP_RATES_IE(pucIE); - } - break; - - case ELEM_ID_DS_PARAM_SET: - if (IE_LEN(pucIE) == ELEM_MAX_LEN_DS_PARAMETER_SET) { - ucIeDsChannelNum = DS_PARAM_IE(pucIE)->ucCurrChnl; - } - break; - - case ELEM_ID_TIM: - if (IE_LEN(pucIE) <= ELEM_MAX_LEN_TIM) { - prBssDesc->ucDTIMPeriod = TIM_IE(pucIE)->ucDTIMPeriod; - } - break; - - case ELEM_ID_IBSS_PARAM_SET: - if (IE_LEN(pucIE) == ELEM_MAX_LEN_IBSS_PARAMETER_SET){ - prBssDesc->u2ATIMWindow = IBSS_PARAM_IE(pucIE)->u2ATIMWindow; - } - break; - -#if 0 //CFG_SUPPORT_802_11D - case ELEM_ID_COUNTRY_INFO: - prBssDesc->prIECountry = (P_IE_COUNTRY_T)pucIE; - break; -#endif - - case ELEM_ID_ERP_INFO: - if (IE_LEN(pucIE) == ELEM_MAX_LEN_ERP) { - prBssDesc->fgIsERPPresent = TRUE; - } - break; - - case ELEM_ID_EXTENDED_SUP_RATES: - if (!prIeExtSupportedRate) { - prIeExtSupportedRate = EXT_SUP_RATES_IE(pucIE); - } - break; - -#if CFG_RSN_MIGRATION - case ELEM_ID_RSN: - if (rsnParseRsnIE(prAdapter, RSN_IE(pucIE), &prBssDesc->rRSNInfo)) { - prBssDesc->fgIERSN = TRUE; - prBssDesc->u2RsnCap = prBssDesc->rRSNInfo.u2RsnCap; - if (prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA2) { - rsnCheckPmkidCache(prAdapter, prBssDesc); - } - } - break; -#endif - - case ELEM_ID_HT_CAP: - prBssDesc->fgIsHTPresent = TRUE; - break; - - case ELEM_ID_HT_OP: - if (IE_LEN(pucIE) != (sizeof(IE_HT_OP_T) - 2)) { - break; - } - - if ((((P_IE_HT_OP_T) pucIE)->ucInfo1 & HT_OP_INFO1_SCO) != CHNL_EXT_RES) { - prBssDesc->eSco = (ENUM_CHNL_EXT_T) - (((P_IE_HT_OP_T) pucIE)->ucInfo1 & HT_OP_INFO1_SCO); - } - ucIeHtChannelNum = ((P_IE_HT_OP_T) pucIE)->ucPrimaryChannel; - - break; - -#if CFG_SUPPORT_WAPI - case ELEM_ID_WAPI: - if (wapiParseWapiIE(WAPI_IE(pucIE), &prBssDesc->rIEWAPI)) { - prBssDesc->fgIEWAPI = TRUE; - } - break; -#endif - - case ELEM_ID_VENDOR: // ELEM_ID_P2P, ELEM_ID_WMM - { - UINT_8 ucOuiType; - UINT_16 u2SubTypeVersion; -#if CFG_PRIVACY_MIGRATION - if (rsnParseCheckForWFAInfoElem(prAdapter, pucIE, &ucOuiType, &u2SubTypeVersion)) { - if ((ucOuiType == VENDOR_OUI_TYPE_WPA) && - (u2SubTypeVersion == VERSION_WPA)) { - - if (rsnParseWpaIE(prAdapter, WPA_IE(pucIE), &prBssDesc->rWPAInfo)) { - prBssDesc->fgIEWPA = TRUE; - } - } - } -#endif - -#if CFG_ENABLE_WIFI_DIRECT - if(prAdapter->fgIsP2PRegistered) { - if (p2pFuncParseCheckForP2PInfoElem(prAdapter, pucIE, &ucOuiType)) { - if (ucOuiType == VENDOR_OUI_TYPE_P2P) { - prBssDesc->fgIsP2PPresent = TRUE; - } - } - } -#endif /* CFG_ENABLE_WIFI_DIRECT */ - } - break; - - /* no default */ - } - } - - - //4 <3.2> Save information from IEs - SSID - /* Update Flag of Hidden SSID for used in SEARCH STATE. */ - - /* NOTE(Kevin): in current driver, the ucSSIDLen == 0 represent - * all cases of hidden SSID. - * If the fgIsHiddenSSID == TRUE, it means we didn't get the ProbeResp with - * valid SSID. - */ - if (prBssDesc->ucSSIDLen == 0) { - prBssDesc->fgIsHiddenSSID = TRUE; - } - else { - prBssDesc->fgIsHiddenSSID = FALSE; - } - - - //4 <3.3> Check rate information in related IEs. - if (prIeSupportedRate || prIeExtSupportedRate) { - rateGetRateSetFromIEs(prIeSupportedRate, - prIeExtSupportedRate, - &prBssDesc->u2OperationalRateSet, - &prBssDesc->u2BSSBasicRateSet, - &prBssDesc->fgIsUnknownBssBasicRate); - } - - - //4 <4> Update information from HIF RX Header - { - prHifRxHdr = prSwRfb->prHifRxHdr; - - ASSERT(prHifRxHdr); - - //4 <4.1> Get TSF comparison result - prBssDesc->fgIsLargerTSF = HIF_RX_HDR_GET_TCL_FLAG(prHifRxHdr); - - //4 <4.2> Get Band information - prBssDesc->eBand = HIF_RX_HDR_GET_RF_BAND(prHifRxHdr); - - //4 <4.2> Get channel and RCPI information - ucHwChannelNum = HIF_RX_HDR_GET_CHNL_NUM(prHifRxHdr); - - if (BAND_2G4 == prBssDesc->eBand) { - - /* Update RCPI if in right channel */ - if (ucIeDsChannelNum >= 1 && ucIeDsChannelNum <= 14) { - - // Receive Beacon/ProbeResp frame from adjacent channel. - if ((ucIeDsChannelNum == ucHwChannelNum) || - (prHifRxHdr->ucRcpi > prBssDesc->ucRCPI)) { - prBssDesc->ucRCPI = prHifRxHdr->ucRcpi; - } - - // trust channel information brought by IE - prBssDesc->ucChannelNum = ucIeDsChannelNum; - } - else if(ucIeHtChannelNum >= 1 && ucIeHtChannelNum <= 14) { - // Receive Beacon/ProbeResp frame from adjacent channel. - if ((ucIeHtChannelNum == ucHwChannelNum) || - (prHifRxHdr->ucRcpi > prBssDesc->ucRCPI)) { - prBssDesc->ucRCPI = prHifRxHdr->ucRcpi; - } - - // trust channel information brought by IE - prBssDesc->ucChannelNum = ucIeHtChannelNum; - } - else { - prBssDesc->ucRCPI = prHifRxHdr->ucRcpi; - - prBssDesc->ucChannelNum = ucHwChannelNum; - } - } - // 5G Band - else { - if(ucIeHtChannelNum >= 1 && ucIeHtChannelNum < 200) { - // Receive Beacon/ProbeResp frame from adjacent channel. - if ((ucIeHtChannelNum == ucHwChannelNum) || - (prHifRxHdr->ucRcpi > prBssDesc->ucRCPI)) { - prBssDesc->ucRCPI = prHifRxHdr->ucRcpi; - } - - // trust channel information brought by IE - prBssDesc->ucChannelNum = ucIeHtChannelNum; - } - else { - /* Always update RCPI */ - prBssDesc->ucRCPI = prHifRxHdr->ucRcpi; - - prBssDesc->ucChannelNum = ucHwChannelNum; - } - } - } - - - //4 <5> PHY type setting - prBssDesc->ucPhyTypeSet = 0; - - if (BAND_2G4 == prBssDesc->eBand) { - /* check if support 11n */ - if (prBssDesc->fgIsHTPresent) { - prBssDesc->ucPhyTypeSet |= PHY_TYPE_BIT_HT; - } - - /* if not 11n only */ - if (!(prBssDesc->u2BSSBasicRateSet & RATE_SET_BIT_HT_PHY)) { - /* check if support 11g */ - if ((prBssDesc->u2OperationalRateSet & RATE_SET_OFDM) || - prBssDesc->fgIsERPPresent) { - prBssDesc->ucPhyTypeSet |= PHY_TYPE_BIT_ERP; - } - - /* if not 11g only */ - if (!(prBssDesc->u2BSSBasicRateSet & RATE_SET_OFDM)) { - /* check if support 11b */ - if ((prBssDesc->u2OperationalRateSet & RATE_SET_HR_DSSS)) { - prBssDesc->ucPhyTypeSet |= PHY_TYPE_BIT_HR_DSSS; - } - } - } - } - else { /* (BAND_5G == prBssDesc->eBande) */ - /* check if support 11n */ - if (prBssDesc->fgIsHTPresent) { - prBssDesc->ucPhyTypeSet |= PHY_TYPE_BIT_HT; - } - - /* if not 11n only */ - if (!(prBssDesc->u2BSSBasicRateSet & RATE_SET_BIT_HT_PHY)) { - /* Support 11a definitely */ - prBssDesc->ucPhyTypeSet |= PHY_TYPE_BIT_OFDM; - - ASSERT(!(prBssDesc->u2OperationalRateSet & RATE_SET_HR_DSSS)); - } - } - - - //4 <6> Update BSS_DESC_T's Last Update TimeStamp. - GET_CURRENT_SYSTIME(&prBssDesc->rUpdateTime); - - return prBssDesc; -} - -#if RSSI_ENHANCE - -extern int numOfTblRssi; -extern TABLE_RSSI mTABLE_RSSI[MAX_SCAN_RSSI_NUM]; -extern int mTblRssiStatus[MAX_SCAN_RSSI_NUM]; - -#define RSSI_DEG(x...) //printk(x) - -PARAM_RSSI processAvgRssi(UINT_8 ucRCPI, PARAM_MAC_ADDRESS rMacAddr) -{ - int bFound, i; - PARAM_RSSI rRssi = RCPI_TO_dBm(ucRCPI); - PARAM_RSSI rRssi2 = rRssi; - PARAM_RSSI AvgRssiX8, AvgRssi; - - if(rRssi < -40) - rRssi += 8; - - RSSI_DEG("---- processAvgRssi ---- \n"); - - bFound = FALSE; - for(i = 0; i < numOfTblRssi; i++) { - RSSI_DEG("-%02x:%02x:%02x:%02x:%02x:%02x\n", - mTABLE_RSSI[i].arMacAddress[0], mTABLE_RSSI[i].arMacAddress[1], mTABLE_RSSI[i].arMacAddress[2], mTABLE_RSSI[i].arMacAddress[3], mTABLE_RSSI[i].arMacAddress[4], mTABLE_RSSI[i].arMacAddress[5]); - if(EQUAL_MAC_ADDR(rMacAddr, mTABLE_RSSI[i].arMacAddress)) { - bFound = TRUE; - AvgRssiX8 = mTABLE_RSSI[i].AvgRssiX8; - AvgRssi = mTABLE_RSSI[i].AvgRssi; - mTblRssiStatus[i] = 1; - break; - } - } - - if(!bFound) { - AvgRssiX8 = rRssi << 3; - AvgRssi = rRssi; - } else { - AvgRssiX8 = (AvgRssiX8 - AvgRssi) + rRssi; - } - - AvgRssi = AvgRssiX8 >> 3; - - if(!bFound) { - COPY_MAC_ADDR(mTABLE_RSSI[numOfTblRssi].arMacAddress, rMacAddr); - mTABLE_RSSI[numOfTblRssi].AvgRssi = AvgRssi; - mTABLE_RSSI[numOfTblRssi].AvgRssiX8 = AvgRssiX8; - numOfTblRssi++; - mTblRssiStatus[i] = 1; - } else { - mTABLE_RSSI[i].AvgRssi = AvgRssi; - mTABLE_RSSI[i].AvgRssiX8 = AvgRssiX8; - } - - RSSI_DEG("results : %02x:%02x:%02x:%02x:%02x:%02x %d -> %d\n", - rMacAddr[0], rMacAddr[1], rMacAddr[2], rMacAddr[3], rMacAddr[4], rMacAddr[5], rRssi2, AvgRssi); - - return AvgRssi; -} - -void sortAvgRssi(void) -{ - int i, index = 0; - - RSSI_DEG("---- sortAvgRssi numOfTblRssi = %d ---- \n", numOfTblRssi); - - for(i = 0; i < numOfTblRssi; i++) { - if(mTblRssiStatus[i] == 1) { - memmove(&mTABLE_RSSI[index++], &mTABLE_RSSI[i], sizeof(TABLE_RSSI)); - } - } - numOfTblRssi = index; - - RSSI_DEG("--numOfTblRssi = %d.\n", numOfTblRssi); - - for(i = 0; i < numOfTblRssi; i++) { - mTblRssiStatus[i] = 0; - } -} - -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Convert the Beacon or ProbeResp Frame in SW_RFB_T to scan result for query -* -* @param[in] prSwRfb Pointer to the receiving SW_RFB_T structure. -* -* @retval WLAN_STATUS_SUCCESS It is a valid Scan Result and been sent to the host. -* @retval WLAN_STATUS_FAILURE It is not a valid Scan Result. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -scanAddScanResult ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBssDesc, - IN P_SW_RFB_T prSwRfb - ) -{ - P_SCAN_INFO_T prScanInfo; - UINT_8 aucRatesEx[PARAM_MAX_LEN_RATES_EX]; - P_WLAN_BEACON_FRAME_T prWlanBeaconFrame; - PARAM_MAC_ADDRESS rMacAddr; - PARAM_SSID_T rSsid; - ENUM_PARAM_NETWORK_TYPE_T eNetworkType; - PARAM_802_11_CONFIG_T rConfiguration; - ENUM_PARAM_OP_MODE_T eOpMode; - UINT_8 ucRateLen = 0; - UINT_32 i; - PARAM_RSSI AvgRssi; - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - - if (prBssDesc->eBand == BAND_2G4) { - if ((prBssDesc->u2OperationalRateSet & RATE_SET_OFDM) - || prBssDesc->fgIsERPPresent) { - eNetworkType = PARAM_NETWORK_TYPE_OFDM24; - } - else { - eNetworkType = PARAM_NETWORK_TYPE_DS; - } - } - else { - ASSERT(prBssDesc->eBand == BAND_5G); - eNetworkType = PARAM_NETWORK_TYPE_OFDM5; - } - - if(prBssDesc->eBSSType == BSS_TYPE_P2P_DEVICE) { - /* NOTE(Kevin): Not supported by WZC(TBD) */ - return WLAN_STATUS_FAILURE; - } - - prWlanBeaconFrame = (P_WLAN_BEACON_FRAME_T)prSwRfb->pvHeader; - COPY_MAC_ADDR(rMacAddr, prWlanBeaconFrame->aucBSSID); - COPY_SSID(rSsid.aucSsid, - rSsid.u4SsidLen, - prBssDesc->aucSSID, - prBssDesc->ucSSIDLen); - - rConfiguration.u4Length = sizeof(PARAM_802_11_CONFIG_T); - rConfiguration.u4BeaconPeriod = (UINT_32) prWlanBeaconFrame->u2BeaconInterval; - rConfiguration.u4ATIMWindow = prBssDesc->u2ATIMWindow; - rConfiguration.u4DSConfig = nicChannelNum2Freq(prBssDesc->ucChannelNum); - rConfiguration.rFHConfig.u4Length = sizeof(PARAM_802_11_CONFIG_FH_T); - - rateGetDataRatesFromRateSet(prBssDesc->u2OperationalRateSet, - 0, - aucRatesEx, - &ucRateLen); - - /* NOTE(Kevin): Set unused entries, if any, at the end of the array to 0. - * from OID_802_11_BSSID_LIST - */ - for (i = ucRateLen; i < sizeof(aucRatesEx) / sizeof(aucRatesEx[0]) ; i++) { - aucRatesEx[i] = 0; - } - - switch(prBssDesc->eBSSType) { - case BSS_TYPE_IBSS: - eOpMode = NET_TYPE_IBSS; - break; - - case BSS_TYPE_INFRASTRUCTURE: - case BSS_TYPE_P2P_DEVICE: - case BSS_TYPE_BOW_DEVICE: - default: - eOpMode = NET_TYPE_INFRA; - break; - } - -#if RSSI_ENHANCE - AvgRssi = processAvgRssi(prBssDesc->ucRCPI, rMacAddr); -#endif - - kalIndicateBssInfo(prAdapter->prGlueInfo, - (PUINT_8)prSwRfb->pvHeader, - prSwRfb->u2PacketLen, - prBssDesc->ucChannelNum, -#if RSSI_ENHANCE - AvgRssi); -#else - RCPI_TO_dBm(prBssDesc->ucRCPI)); -#endif - - nicAddScanResult(prAdapter, - rMacAddr, - &rSsid, - prWlanBeaconFrame->u2CapInfo & CAP_INFO_PRIVACY ? 1 : 0, - RCPI_TO_dBm(prBssDesc->ucRCPI), - eNetworkType, - &rConfiguration, - eOpMode, - aucRatesEx, - prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen, - (PUINT_8)((UINT_32)(prSwRfb->pvHeader) + WLAN_MAC_MGMT_HEADER_LEN)); - - return WLAN_STATUS_SUCCESS; - -} /* end of scanAddScanResult() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Parse the content of given Beacon or ProbeResp Frame. -* -* @param[in] prSwRfb Pointer to the receiving SW_RFB_T structure. -* -* @retval WLAN_STATUS_SUCCESS if not report this SW_RFB_T to host -* @retval WLAN_STATUS_PENDING if report this SW_RFB_T to host as scan result -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -scanProcessBeaconAndProbeResp ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_CONNECTION_SETTINGS_T prConnSettings; - P_BSS_DESC_T prBssDesc = (P_BSS_DESC_T)NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - P_BSS_INFO_T prAisBssInfo; - P_WLAN_BEACON_FRAME_T prWlanBeaconFrame = (P_WLAN_BEACON_FRAME_T)NULL; -#if CFG_SLT_SUPPORT - P_SLT_INFO_T prSltInfo = (P_SLT_INFO_T)NULL; -#endif - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - //4 <0> Ignore invalid Beacon Frame - if ((prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen) < - (TIMESTAMP_FIELD_LEN + BEACON_INTERVAL_FIELD_LEN + CAP_INFO_FIELD_LEN)) { -#ifndef _lint - ASSERT(0); -#endif /* _lint */ - return rStatus; - } - -#if CFG_SLT_SUPPORT - prSltInfo = &prAdapter->rWifiVar.rSltInfo; - - if (prSltInfo->fgIsDUT) { - DBGLOG(P2P, INFO, ("\n\rBCN: RX\n")); - prSltInfo->u4BeaconReceiveCnt++; - return WLAN_STATUS_SUCCESS; - } - else { - return WLAN_STATUS_SUCCESS; - } -#endif - - - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - prAisBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX]); - prWlanBeaconFrame = (P_WLAN_BEACON_FRAME_T)prSwRfb->pvHeader; - - //4 <1> Parse and add into BSS_DESC_T - prBssDesc = scanAddToBssDesc(prAdapter, prSwRfb); - - if (prBssDesc) { - - //4 <1.1> Beacon Change Detection for Connected BSS - if(prAisBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED && - ((prBssDesc->eBSSType == BSS_TYPE_INFRASTRUCTURE && prConnSettings->eOPMode != NET_TYPE_IBSS) - || (prBssDesc->eBSSType == BSS_TYPE_IBSS && prConnSettings->eOPMode != NET_TYPE_INFRA)) && - EQUAL_MAC_ADDR(prBssDesc->aucBSSID, prAisBssInfo->aucBSSID) && - EQUAL_SSID(prBssDesc->aucSSID, prBssDesc->ucSSIDLen, prAisBssInfo->aucSSID, prAisBssInfo->ucSSIDLen)) { - BOOLEAN fgNeedDisconnect = FALSE; - -#if CFG_SUPPORT_BEACON_CHANGE_DETECTION - // <1.1.2> check if supported rate differs - if(prAisBssInfo->u2OperationalRateSet != prBssDesc->u2OperationalRateSet) { - fgNeedDisconnect = TRUE; - } -#endif - - // <1.1.3> beacon content change detected, disconnect immediately - if(fgNeedDisconnect == TRUE) { - aisBssBeaconTimeout(prAdapter); - } - } - - //4 <1.1> Update AIS_BSS_INFO - if(((prBssDesc->eBSSType == BSS_TYPE_INFRASTRUCTURE && prConnSettings->eOPMode != NET_TYPE_IBSS) - || (prBssDesc->eBSSType == BSS_TYPE_IBSS && prConnSettings->eOPMode != NET_TYPE_INFRA))) { - if (prAisBssInfo->eConnectionState == PARAM_MEDIA_STATE_CONNECTED) { - - /* *not* checking prBssDesc->fgIsConnected anymore, - * due to Linksys AP uses " " as hidden SSID, and would have different BSS descriptor */ - if ((!prAisBssInfo->ucDTIMPeriod) && - EQUAL_MAC_ADDR(prBssDesc->aucBSSID, prAisBssInfo->aucBSSID) && - (prAisBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE) && - ((prWlanBeaconFrame->u2FrameCtrl & MASK_FRAME_TYPE) == MAC_FRAME_BEACON)) { - - prAisBssInfo->ucDTIMPeriod = prBssDesc->ucDTIMPeriod; - - /* sync with firmware for beacon information */ - nicPmIndicateBssConnected(prAdapter, NETWORK_TYPE_AIS_INDEX); - } - } - -#if CFG_SUPPORT_ADHOC - if (EQUAL_SSID(prBssDesc->aucSSID, - prBssDesc->ucSSIDLen, - prConnSettings->aucSSID, - prConnSettings->ucSSIDLen) && - (prBssDesc->eBSSType == BSS_TYPE_IBSS) && - (prAisBssInfo->eCurrentOPMode == OP_MODE_IBSS)) { - - ibssProcessMatchedBeacon(prAdapter, prAisBssInfo, prBssDesc, prSwRfb->prHifRxHdr->ucRcpi); - } -#endif /* CFG_SUPPORT_ADHOC */ - } - - rlmProcessBcn(prAdapter, - prSwRfb, - ((P_WLAN_BEACON_FRAME_T)(prSwRfb->pvHeader))->aucInfoElem, - (prSwRfb->u2PacketLen - prSwRfb->u2HeaderLen) - - (UINT_16)(OFFSET_OF(WLAN_BEACON_FRAME_BODY_T, aucInfoElem[0]))); - - //4 <3> Send SW_RFB_T to HIF when we perform SCAN for HOST - if(prBssDesc->eBSSType == BSS_TYPE_INFRASTRUCTURE - || prBssDesc->eBSSType == BSS_TYPE_IBSS) { - /* for AIS, send to host */ - if (prConnSettings->fgIsScanReqIssued && - rlmDomainIsLegalChannel(prAdapter, prBssDesc->eBand, prBssDesc->ucChannelNum) == TRUE) { - ENUM_BAND_T eBand; - UINT_8 ucChannel; - BOOLEAN fgAddToScanResult; - - /* check ucChannelNum/eBand for adjacement channel filtering */ - if(cnmAisInfraChannelFixed(prAdapter, &eBand, &ucChannel) == TRUE && - (eBand != prBssDesc->eBand || ucChannel != prBssDesc->ucChannelNum)) { - fgAddToScanResult = FALSE; - } - else { - fgAddToScanResult = TRUE; - } - - if(fgAddToScanResult == TRUE) { - rStatus = scanAddScanResult(prAdapter, prBssDesc, prSwRfb); - } - } - } - -#if CFG_ENABLE_WIFI_DIRECT - if(prAdapter->fgIsP2PRegistered) { - scanP2pProcessBeaconAndProbeResp( - prAdapter, - prSwRfb, - &rStatus, - prBssDesc, - prWlanBeaconFrame); - } -#endif - } - - return rStatus; - -} /* end of scanProcessBeaconAndProbeResp() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Search the Candidate of BSS Descriptor for JOIN(Infrastructure) or -* MERGE(AdHoc) according to current Connection Policy. -* -* \return Pointer to BSS Descriptor, if found. NULL, if not found -*/ -/*----------------------------------------------------------------------------*/ -P_BSS_DESC_T -scanSearchBssDescByPolicy ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex - ) -{ - P_CONNECTION_SETTINGS_T prConnSettings; - P_BSS_INFO_T prBssInfo; - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo; - P_SCAN_INFO_T prScanInfo; - - P_LINK_T prBSSDescList; - - P_BSS_DESC_T prBssDesc = (P_BSS_DESC_T)NULL; - P_BSS_DESC_T prPrimaryBssDesc = (P_BSS_DESC_T)NULL; - P_BSS_DESC_T prCandidateBssDesc = (P_BSS_DESC_T)NULL; - - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - P_STA_RECORD_T prPrimaryStaRec; - P_STA_RECORD_T prCandidateStaRec = (P_STA_RECORD_T)NULL; - - OS_SYSTIME rCurrentTime; - - /* The first one reach the check point will be our candidate */ - BOOLEAN fgIsFindFirst = (BOOLEAN)FALSE; - - BOOLEAN fgIsFindBestRSSI = (BOOLEAN)FALSE; - BOOLEAN fgIsFindBestEncryptionLevel = (BOOLEAN)FALSE; - //BOOLEAN fgIsFindMinChannelLoad = (BOOLEAN)FALSE; - - /* TODO(Kevin): Support Min Channel Load */ - //UINT_8 aucChannelLoad[CHANNEL_NUM] = {0}; - - BOOLEAN fgIsFixedChannel; - ENUM_BAND_T eBand; - UINT_8 ucChannel; - - ASSERT(prAdapter); - - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[eNetTypeIndex]); - - prAisSpecBssInfo = &(prAdapter->rWifiVar.rAisSpecificBssInfo); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prBSSDescList = &prScanInfo->rBSSDescList; - - GET_CURRENT_SYSTIME(&rCurrentTime); - - /* check for fixed channel operation */ - if(eNetTypeIndex == NETWORK_TYPE_AIS_INDEX) { - fgIsFixedChannel = cnmAisInfraChannelFixed(prAdapter, &eBand, &ucChannel); - } - else { - fgIsFixedChannel = FALSE; - } - -#if DBG - if (prConnSettings->ucSSIDLen < ELEM_MAX_LEN_SSID) { - prConnSettings->aucSSID[prConnSettings->ucSSIDLen] = '\0'; - } -#endif - - DBGLOG(SCN, INFO, ("SEARCH: Num Of BSS_DESC_T = %d, Look for SSID: %s\n", - prBSSDescList->u4NumElem, prConnSettings->aucSSID)); - - - //4 <1> The outer loop to search for a candidate. - LINK_FOR_EACH_ENTRY(prBssDesc, prBSSDescList, rLinkEntry, BSS_DESC_T) { - - /* TODO(Kevin): Update Minimum Channel Load Information here */ - - DBGLOG(SCN, INFO, ("SEARCH: ["MACSTR"], SSID:%s\n", - MAC2STR(prBssDesc->aucBSSID), prBssDesc->aucSSID)); - - - //4 <2> Check PHY Type and attributes - //4 <2.1> Check Unsupported BSS PHY Type - if (!(prBssDesc->ucPhyTypeSet & (prAdapter->rWifiVar.ucAvailablePhyTypeSet))) { - - DBGLOG(SCN, INFO, ("SEARCH: Ignore unsupported ucPhyTypeSet = %x\n", - prBssDesc->ucPhyTypeSet)); - continue; - } - - //4 <2.2> Check if has unknown NonHT BSS Basic Rate Set. - if (prBssDesc->fgIsUnknownBssBasicRate) { - - continue; - } - - //4 <2.3> Check if fixed operation cases should be aware - if (fgIsFixedChannel == TRUE && - (prBssDesc->eBand != eBand || prBssDesc->ucChannelNum != ucChannel)) { - continue; - } - - //4 <2.4> Check if the channel is legal under regulatory domain - if(rlmDomainIsLegalChannel(prAdapter, prBssDesc->eBand, prBssDesc->ucChannelNum) == FALSE) { - continue; - } - - //4 <2.5> Check if this BSS_DESC_T is stale - if (CHECK_FOR_TIMEOUT(rCurrentTime, prBssDesc->rUpdateTime, - SEC_TO_SYSTIME(SCN_BSS_DESC_REMOVE_TIMEOUT_SEC)) ) { - - continue; - } - - //4 <3> Check if reach the excessive join retry limit - /* NOTE(Kevin): STA_RECORD_T is recorded by TA. */ - prStaRec = cnmGetStaRecByAddress(prAdapter, (UINT_8) eNetTypeIndex, - prBssDesc->aucSrcAddr); - - if (prStaRec) { - /* NOTE(Kevin): - * The Status Code is the result of a Previous Connection Request, we use this as SCORE for choosing a proper - * candidate (Also used for compare see <6>) - * The Reason Code is an indication of the reason why AP reject us, we use this Code for "Reject" - * a SCAN result to become our candidate(Like a blacklist). - */ -#if 0 /* TODO(Kevin): */ - if (prStaRec->u2ReasonCode != REASON_CODE_RESERVED) { - DBGLOG(SCN, INFO, ("SEARCH: Ignore BSS with previous Reason Code = %d\n", - prStaRec->u2ReasonCode)); - continue; - } - else -#endif - if (prStaRec->u2StatusCode != STATUS_CODE_SUCCESSFUL) { - /* NOTE(Kevin): greedy association - after timeout, we'll still - * try to associate to the AP whose STATUS of conection attempt - * was not success. - * We may also use (ucJoinFailureCount x JOIN_RETRY_INTERVAL_SEC) for - * time bound. - */ - if ((prStaRec->ucJoinFailureCount < JOIN_MAX_RETRY_FAILURE_COUNT) || - (CHECK_FOR_TIMEOUT(rCurrentTime, - prStaRec->rLastJoinTime, - SEC_TO_SYSTIME(JOIN_RETRY_INTERVAL_SEC)))) { - - /* NOTE(Kevin): Every JOIN_RETRY_INTERVAL_SEC interval, we can retry - * JOIN_MAX_RETRY_FAILURE_COUNT times. - */ - if (prStaRec->ucJoinFailureCount >= JOIN_MAX_RETRY_FAILURE_COUNT) { - prStaRec->ucJoinFailureCount = 0; - } - DBGLOG(SCN, INFO, ("SEARCH: Try to join BSS again which has Status Code = %d (Curr = %ld/Last Join = %ld)\n", - prStaRec->u2StatusCode, rCurrentTime, prStaRec->rLastJoinTime)); - } - else { - DBGLOG(SCN, INFO, ("SEARCH: Ignore BSS which reach maximum Join Retry Count = %d \n", - JOIN_MAX_RETRY_FAILURE_COUNT)); - continue; - } - - } - } - - - //4 <4> Check for various NETWORK conditions - if (eNetTypeIndex == NETWORK_TYPE_AIS_INDEX) { - - //4 <4.1> Check BSS Type for the corresponding Operation Mode in Connection Setting - /* NOTE(Kevin): For NET_TYPE_AUTO_SWITCH, we will always pass following check. */ - if (((prConnSettings->eOPMode == NET_TYPE_INFRA) && - (prBssDesc->eBSSType != BSS_TYPE_INFRASTRUCTURE)) || - ((prConnSettings->eOPMode == NET_TYPE_IBSS || prConnSettings->eOPMode == NET_TYPE_DEDICATED_IBSS) && - (prBssDesc->eBSSType != BSS_TYPE_IBSS))) { - - DBGLOG(SCN, INFO, ("SEARCH: Ignore eBSSType = %s\n", - ((prBssDesc->eBSSType == BSS_TYPE_INFRASTRUCTURE) ? - "INFRASTRUCTURE" : "IBSS"))); - continue; - } - - //4 <4.2> Check AP's BSSID if OID_802_11_BSSID has been set. - if ((prConnSettings->fgIsConnByBssidIssued) && - (prBssDesc->eBSSType == BSS_TYPE_INFRASTRUCTURE)) { - - if (UNEQUAL_MAC_ADDR(prConnSettings->aucBSSID, prBssDesc->aucBSSID)) { - - DBGLOG(SCN, INFO, ("SEARCH: Ignore due to BSSID was not matched!\n")); - continue; - } - } - -#if CFG_SUPPORT_ADHOC - //4 <4.3> Check for AdHoc Mode - if (prBssDesc->eBSSType == BSS_TYPE_IBSS) { - OS_SYSTIME rCurrentTime; - - //4 <4.3.1> Check if this SCAN record has been updated recently for IBSS. - /* NOTE(Kevin): Because some STA may change its BSSID frequently after it - * create the IBSS - e.g. IPN2220, so we need to make sure we get the new one. - * For BSS, if the old record was matched, however it won't be able to pass - * the Join Process later. - */ - GET_CURRENT_SYSTIME(&rCurrentTime); - if (CHECK_FOR_TIMEOUT(rCurrentTime, prBssDesc->rUpdateTime, - SEC_TO_SYSTIME(SCN_ADHOC_BSS_DESC_TIMEOUT_SEC))) { - DBGLOG(SCN, LOUD, ("SEARCH: Skip old record of BSS Descriptor - BSSID:["MACSTR"]\n\n", - MAC2STR(prBssDesc->aucBSSID))); - continue; - } - - //4 <4.3.2> Check Peer's capability - if (ibssCheckCapabilityForAdHocMode(prAdapter, prBssDesc) == WLAN_STATUS_FAILURE) { - - DBGLOG(SCN, INFO, - ("SEARCH: Ignore BSS DESC MAC: "MACSTR", Capability is not supported for current AdHoc Mode.\n", - MAC2STR(prPrimaryBssDesc->aucBSSID))); - - continue; - } - - - //4 <4.3.3> Compare TSF - if (prBssInfo->fgIsBeaconActivated && - UNEQUAL_MAC_ADDR(prBssInfo->aucBSSID, prBssDesc->aucBSSID)) { - - DBGLOG(SCN, LOUD, - ("SEARCH: prBssDesc->fgIsLargerTSF = %d\n", - prBssDesc->fgIsLargerTSF)); - - if (!prBssDesc->fgIsLargerTSF) { - DBGLOG(SCN, INFO, - ("SEARCH: Ignore BSS DESC MAC: ["MACSTR"], Smaller TSF\n", MAC2STR(prBssDesc->aucBSSID))); - continue; - } - } - } -#endif /* CFG_SUPPORT_ADHOC */ - - } - - - - -#if 0 /* TODO(Kevin): For IBSS */ - //4 <2.c> Check if this SCAN record has been updated recently for IBSS. - /* NOTE(Kevin): Because some STA may change its BSSID frequently after it - * create the IBSS, so we need to make sure we get the new one. - * For BSS, if the old record was matched, however it won't be able to pass - * the Join Process later. - */ - if (prBssDesc->eBSSType == BSS_TYPE_IBSS) { - OS_SYSTIME rCurrentTime; - - GET_CURRENT_SYSTIME(&rCurrentTime); - if (CHECK_FOR_TIMEOUT(rCurrentTime, prBssDesc->rUpdateTime, - SEC_TO_SYSTIME(BSS_DESC_TIMEOUT_SEC))) { - DBGLOG(SCAN, TRACE, ("Skip old record of BSS Descriptor - BSSID:["MACSTR"]\n\n", - MAC2STR(prBssDesc->aucBSSID))); - continue; - } - } - - if ((prBssDesc->eBSSType == BSS_TYPE_INFRASTRUCTURE) && - (prAdapter->eConnectionState == MEDIA_STATE_CONNECTED)) { - OS_SYSTIME rCurrentTime; - - GET_CURRENT_SYSTIME(&rCurrentTime); - if (CHECK_FOR_TIMEOUT(rCurrentTime, prBssDesc->rUpdateTime, - SEC_TO_SYSTIME(BSS_DESC_TIMEOUT_SEC))) { - DBGLOG(SCAN, TRACE, ("Skip old record of BSS Descriptor - BSSID:["MACSTR"]\n\n", - MAC2STR(prBssDesc->aucBSSID))); - continue; - } - } - - - //4 <4B> Check for IBSS AdHoc Mode. - /* Skip if one or more BSS Basic Rate are not supported by current AdHocMode */ - if (prPrimaryBssDesc->eBSSType == BSS_TYPE_IBSS) { - //4 <4B.1> Check if match the Capability of current IBSS AdHoc Mode. - if (ibssCheckCapabilityForAdHocMode(prAdapter, prPrimaryBssDesc) == WLAN_STATUS_FAILURE) { - - DBGLOG(SCAN, TRACE, - ("Ignore BSS DESC MAC: "MACSTR", Capability is not supported for current AdHoc Mode.\n", - MAC2STR(prPrimaryBssDesc->aucBSSID))); - - continue; - } - - - //4 <4B.2> IBSS Merge Decision Flow for SEARCH STATE. - if (prAdapter->fgIsIBSSActive && - UNEQUAL_MAC_ADDR(prBssInfo->aucBSSID, prPrimaryBssDesc->aucBSSID)) { - - if (!fgIsLocalTSFRead) { - NIC_GET_CURRENT_TSF(prAdapter, &rCurrentTsf); - - DBGLOG(SCAN, TRACE, - ("\n\nCurrent TSF : %08lx-%08lx\n\n", - rCurrentTsf.u.HighPart, rCurrentTsf.u.LowPart)); - } - - if (rCurrentTsf.QuadPart > prPrimaryBssDesc->u8TimeStamp.QuadPart) { - DBGLOG(SCAN, TRACE, - ("Ignore BSS DESC MAC: ["MACSTR"], Current BSSID: ["MACSTR"].\n", - MAC2STR(prPrimaryBssDesc->aucBSSID), MAC2STR(prBssInfo->aucBSSID))); - - DBGLOG(SCAN, TRACE, - ("\n\nBSS's TSF : %08lx-%08lx\n\n", - prPrimaryBssDesc->u8TimeStamp.u.HighPart, prPrimaryBssDesc->u8TimeStamp.u.LowPart)); - - prPrimaryBssDesc->fgIsLargerTSF = FALSE; - continue; - } - else { - prPrimaryBssDesc->fgIsLargerTSF = TRUE; - } - - } - } - - //4 <5> Check the Encryption Status. - if (rsnPerformPolicySelection(prPrimaryBssDesc)) { - - if (prPrimaryBssDesc->ucEncLevel > 0) { - fgIsFindBestEncryptionLevel = TRUE; - - fgIsFindFirst = FALSE; - } - } - else { - /* Can't pass the Encryption Status Check, get next one */ - continue; - } - - /* For RSN Pre-authentication, update the PMKID canidate list for - same SSID and encrypt status */ - /* Update PMKID candicate list. */ - if (prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA2) { - rsnUpdatePmkidCandidateList(prPrimaryBssDesc); - if (prAdapter->rWifiVar.rAisBssInfo.u4PmkidCandicateCount) { - prAdapter->rWifiVar.rAisBssInfo.fgIndicatePMKID = rsnCheckPmkidCandicate(); - } - } - -#endif - - - prPrimaryBssDesc = (P_BSS_DESC_T)NULL; - - //4 <6> Check current Connection Policy. - switch (prConnSettings->eConnectionPolicy) { - case CONNECT_BY_SSID_BEST_RSSI: - /* Choose Hidden SSID to join only if the `fgIsEnableJoin...` is TRUE */ - if (prAdapter->rWifiVar.fgEnableJoinToHiddenSSID && prBssDesc->fgIsHiddenSSID) { - /* NOTE(Kevin): following if () statement means that - * If Target is hidden, then we won't connect when user specify SSID_ANY policy. - */ - if (prConnSettings->ucSSIDLen) { - prPrimaryBssDesc = prBssDesc; - - fgIsFindBestRSSI = TRUE; - } - - } - else if (EQUAL_SSID(prBssDesc->aucSSID, - prBssDesc->ucSSIDLen, - prConnSettings->aucSSID, - prConnSettings->ucSSIDLen)) { - prPrimaryBssDesc = prBssDesc; - - fgIsFindBestRSSI = TRUE; - } - break; - - case CONNECT_BY_SSID_ANY: - /* NOTE(Kevin): In this policy, we don't know the desired - * SSID from user, so we should exclude the Hidden SSID from scan list. - * And because we refuse to connect to Hidden SSID node at the beginning, so - * when the JOIN Module deal with a BSS_DESC_T which has fgIsHiddenSSID == TRUE, - * then the Connection Settings must be valid without doubt. - */ - if (!prBssDesc->fgIsHiddenSSID) { - prPrimaryBssDesc = prBssDesc; - - fgIsFindFirst = TRUE; - } - break; - - case CONNECT_BY_BSSID: - if(EQUAL_MAC_ADDR(prBssDesc->aucBSSID, prConnSettings->aucBSSID)) { - prPrimaryBssDesc = prBssDesc; - } - break; - - default: - break; - } - - - /* Primary Candidate was not found */ - if (prPrimaryBssDesc == NULL) { - continue; - } - - //4 <7> Check the Encryption Status. - if (prPrimaryBssDesc->eBSSType == BSS_TYPE_INFRASTRUCTURE) { -#if CFG_SUPPORT_WAPI - if (prAdapter->rWifiVar.rConnSettings.fgWapiMode) { - if (wapiPerformPolicySelection(prAdapter, prPrimaryBssDesc)) { - fgIsFindFirst = TRUE; - } - else { - /* Can't pass the Encryption Status Check, get next one */ - continue; - } - } - else -#endif -#if CFG_RSN_MIGRATION - if (rsnPerformPolicySelection(prAdapter, prPrimaryBssDesc)) { - if (prAisSpecBssInfo->fgCounterMeasure) { - DBGLOG(RSN, INFO, ("Skip while at counter measure period!!!\n")); - continue; - } - - if (prPrimaryBssDesc->ucEncLevel > 0) { - fgIsFindBestEncryptionLevel = TRUE; - - fgIsFindFirst = FALSE; - } - -#if 0 - /* Update PMKID candicate list. */ - if (prAdapter->rWifiVar.rConnSettings.eAuthMode == AUTH_MODE_WPA2) { - rsnUpdatePmkidCandidateList(prPrimaryBssDesc); - if (prAisSpecBssInfo->u4PmkidCandicateCount) { - if (rsnCheckPmkidCandicate()) { - DBGLOG(RSN, WARN, ("Prepare a timer to indicate candidate "MACSTR"\n", - MAC2STR(prAisSpecBssInfo->arPmkidCache[prAisSpecBssInfo->u4PmkidCacheCount].rBssidInfo.aucBssid))); - cnmTimerStopTimer(&prAisSpecBssInfo->rPreauthenticationTimer); - cnmTimerStartTimer(&prAisSpecBssInfo->rPreauthenticationTimer, - SEC_TO_MSEC(WAIT_TIME_IND_PMKID_CANDICATE_SEC)); - } - } - } -#endif - } - else { - /* Can't pass the Encryption Status Check, get next one */ - continue; - } -#endif - } - else { - /* Todo:: P2P and BOW Policy Selection */ - } - - prPrimaryStaRec = prStaRec; - - //4 <8> Compare the Candidate and the Primary Scan Record. - if (!prCandidateBssDesc) { - prCandidateBssDesc = prPrimaryBssDesc; - prCandidateStaRec = prPrimaryStaRec; - - //4 <8.1> Condition - Get the first matched one. - if (fgIsFindFirst) { - break; - } - } - else { -#if 0 /* TODO(Kevin): For security(TBD) */ - //4 <6B> Condition - Choose the one with best Encryption Score. - if (fgIsFindBestEncryptionLevel) { - if (prCandidateBssDesc->ucEncLevel < - prPrimaryBssDesc->ucEncLevel) { - - prCandidateBssDesc = prPrimaryBssDesc; - prCandidateStaRec = prPrimaryStaRec; - continue; - } - } - - /* If reach here, that means they have the same Encryption Score. - */ - - //4 <6C> Condition - Give opportunity to the one we didn't connect before. - // For roaming, only compare the candidates other than current associated BSSID. - if (!prCandidateBssDesc->fgIsConnected && !prPrimaryBssDesc->fgIsConnected) { - if ((prCandidateStaRec != (P_STA_RECORD_T)NULL) && - (prCandidateStaRec->u2StatusCode != STATUS_CODE_SUCCESSFUL)) { - - DBGLOG(SCAN, TRACE, ("So far -BSS DESC MAC: "MACSTR" has nonzero Status Code = %d\n", - MAC2STR(prCandidateBssDesc->aucBSSID), prCandidateStaRec->u2StatusCode)); - - if (prPrimaryStaRec != (P_STA_RECORD_T)NULL) { - if (prPrimaryStaRec->u2StatusCode != STATUS_CODE_SUCCESSFUL) { - - /* Give opportunity to the one with smaller rLastJoinTime */ - if (TIME_BEFORE(prCandidateStaRec->rLastJoinTime, - prPrimaryStaRec->rLastJoinTime)) { - continue; - } - /* We've connect to CANDIDATE recently, let us try PRIMARY now */ - else { - prCandidateBssDesc = prPrimaryBssDesc; - prCandidateStaRec = prPrimaryStaRec; - continue; - } - } - /* PRIMARY's u2StatusCode = 0 */ - else { - prCandidateBssDesc = prPrimaryBssDesc; - prCandidateStaRec = prPrimaryStaRec; - continue; - } - } - /* PRIMARY has no StaRec - We didn't connet to PRIMARY before */ - else { - prCandidateBssDesc = prPrimaryBssDesc; - prCandidateStaRec = prPrimaryStaRec; - continue; - } - } - else { - if ((prPrimaryStaRec != (P_STA_RECORD_T)NULL) && - (prPrimaryStaRec->u2StatusCode != STATUS_CODE_SUCCESSFUL)) { - continue; - } - } - } -#endif - - - //4 <6D> Condition - Visible SSID win Hidden SSID. - if (prCandidateBssDesc->fgIsHiddenSSID) { - if (!prPrimaryBssDesc->fgIsHiddenSSID) { - prCandidateBssDesc = prPrimaryBssDesc; /* The non Hidden SSID win. */ - prCandidateStaRec = prPrimaryStaRec; - continue; - } - } - else { - if (prPrimaryBssDesc->fgIsHiddenSSID) { - continue; - } - } - - - //4 <6E> Condition - Choose the one with better RCPI(RSSI). - if (fgIsFindBestRSSI) { - /* TODO(Kevin): We shouldn't compare the actual value, we should - * allow some acceptable tolerance of some RSSI percentage here. - */ - DBGLOG(SCN, TRACE, ("Candidate ["MACSTR"]: RCPI = %d, Primary ["MACSTR"]: RCPI = %d\n", - MAC2STR(prCandidateBssDesc->aucBSSID), prCandidateBssDesc->ucRCPI, - MAC2STR(prPrimaryBssDesc->aucBSSID), prPrimaryBssDesc->ucRCPI)); - - ASSERT(!(prCandidateBssDesc->fgIsConnected && - prPrimaryBssDesc->fgIsConnected)); - - /* NOTE: To prevent SWING, we do roaming only if target AP has at least 5dBm larger than us. */ - if (prCandidateBssDesc->fgIsConnected) { - if (prCandidateBssDesc->ucRCPI + ROAMING_NO_SWING_RCPI_STEP <= prPrimaryBssDesc->ucRCPI) { - - prCandidateBssDesc = prPrimaryBssDesc; - prCandidateStaRec = prPrimaryStaRec; - continue; - } - } - else if (prPrimaryBssDesc->fgIsConnected) { - if (prCandidateBssDesc->ucRCPI < prPrimaryBssDesc->ucRCPI + ROAMING_NO_SWING_RCPI_STEP) { - - prCandidateBssDesc = prPrimaryBssDesc; - prCandidateStaRec = prPrimaryStaRec; - continue; - } - } - else if (prCandidateBssDesc->ucRCPI < prPrimaryBssDesc->ucRCPI) { - prCandidateBssDesc = prPrimaryBssDesc; - prCandidateStaRec = prPrimaryStaRec; - continue; - } - } - -#if 0 - /* If reach here, that means they have the same Encryption Score, and - * both RSSI value are close too. - */ - //4 <6F> Seek the minimum Channel Load for less interference. - if (fgIsFindMinChannelLoad) { - - /* TODO(Kevin): Check which one has minimum channel load in its channel */ - } -#endif - } - } - - return prCandidateBssDesc; - -} /* end of scanSearchBssDescByPolicy() */ - - diff --git a/drivers/net/wireless/mt5931/mgmt/scan_fsm.c b/drivers/net/wireless/mt5931/mgmt/scan_fsm.c deleted file mode 100755 index 98a97aaac135..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/scan_fsm.c +++ /dev/null @@ -1,1113 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/scan_fsm.c#1 $ -*/ - -/*! \file "scan_fsm.c" - \brief This file defines the state transition function for SCAN FSM. - - The SCAN FSM is part of SCAN MODULE and responsible for performing basic SCAN - behavior as metioned in IEEE 802.11 2007 11.1.3.1 & 11.1.3.2 . -*/ - - - -/* -** $Log: scan_fsm.c $ - * - * 06 13 2012 yuche.tsai - * NULL - * Update maintrunk driver. - * Add support for driver compose assoc request frame. - * - * 11 24 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * Adjust code for DBG and CONFIG_XLOG. - * - * 11 14 2011 yuche.tsai - * [WCXRP00001095] [Volunteer Patch][Driver] Always Scan before enable Hot-Spot. - * Fix bug when unregister P2P network.. - * - * 11 11 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * modify the xlog related code. - * - * 11 02 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * adding the code for XLOG. - * - * 08 11 2011 cp.wu - * [WCXRP00000830] [MT6620 Wi-Fi][Firmware] Use MDRDY counter to detect empty channel for shortening scan time - * sparse channel detection: - * driver: collect sparse channel information with scan-done event - - * - * 07 18 2011 cp.wu - * [WCXRP00000858] [MT5931][Driver][Firmware] Add support for scan to search for more than one SSID in a single scanning request - * free mailbox message afte parsing is completed. - * - * 07 18 2011 cp.wu - * [WCXRP00000858] [MT5931][Driver][Firmware] Add support for scan to search for more than one SSID in a single scanning request - * add framework in driver domain for supporting new SCAN_REQ_V2 for more than 1 SSID support as well as uProbeDelay in NDIS 6.x driver model - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 03 29 2011 cp.wu - * [WCXRP00000604] [MT6620 Wi-Fi][Driver] Surpress Klockwork Warning - * surpress klock warning with code path rewritten - * - * 03 18 2011 cm.chang - * [WCXRP00000576] [MT6620 Wi-Fi][Driver][FW] Remove P2P compile option in scan req/cancel command - * As CR title - * - * 02 18 2011 yuche.tsai - * [WCXRP00000478] [Volunteer Patch][MT6620][Driver] Probe request frame during search phase do not contain P2P wildcard SSID. - * Take P2P wildcard SSID into consideration. - * - * 01 27 2011 yuche.tsai - * [WCXRP00000399] [Volunteer Patch][MT6620/MT5931][Driver] Fix scan side effect after P2P module separate. - * Fix scan channel extension issue when p2p module is not registered. - * - * 01 26 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * . - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Fix Compile Error when DBG is disabled. - * - * 12 07 2010 cm.chang - * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant - * 1. Country code is from NVRAM or supplicant - * 2. Change band definition in CMD/EVENT. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 30 2010 cp.wu - * NULL - * eliminate klockwork errors - * - * 08 16 2010 cp.wu - * NULL - * add interface for RLM to trigger OBSS-SCAN. - * - * 08 16 2010 yuche.tsai - * NULL - * Fix bug for processing queued scan request. - * - * 08 11 2010 yuche.tsai - * NULL - * Add a function for returning channel. - * - * 08 05 2010 yuche.tsai - * NULL - * Update SCAN FSM for support P2P Device discovery scan. - * - * 08 03 2010 cp.wu - * NULL - * surpress compilation warning. - * - * 07 26 2010 yuche.tsai - * - * Add option of channel extension while cancelling scan request. - * - * 07 21 2010 yuche.tsai - * - * Add P2P Scan & Scan Result Parsing & Saving. - * - * 07 20 2010 cp.wu - * - * pass band information for scan in an efficient way by mapping ENUM_BAND_T into UINT_8.. - * - * 07 19 2010 cp.wu - * - * due to FW/DRV won't be sync. precisely, some strict assertions should be eased. - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * SCN module is now able to handle multiple concurrent scanning requests - * - * 07 16 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * bugfix for SCN migration - * 1) modify QUEUE_CONCATENATE_QUEUES() so it could be used to concatence with an empty queue - * 2) before AIS issues scan request, network(BSS) needs to be activated first - * 3) only invoke COPY_SSID when using specified SSID for scan - * - * 07 15 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * driver no longer generates probe request frames - * - * 07 14 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * pass band with channel number information as scan parameter - * - * 07 14 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * remove timer in DRV-SCN. - * - * 07 09 2010 cp.wu - * - * 1) separate AIS_FSM state for two kinds of scanning. (OID triggered scan, and scan-for-connection) - * 2) eliminate PRE_BSS_DESC_T, Beacon/PrebResp is now parsed in single pass - * 3) implment DRV-SCN module, currently only accepts single scan request, other request will be directly dropped by returning BUSY - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * take use of RLM module for parsing/generating HT IEs for 11n capability - * - * 07 02 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * when returning to SCAN_IDLE state, send a correct message to source FSM. - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * implementation of DRV-SCN and related mailbox message handling. - * - * 06 22 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * comment out RLM APIs by CFG_RLM_MIGRATION. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add scan_fsm into building. - * - * 05 14 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Refine the order of Stop TX Queue and Switch Channel - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Update pause/resume/flush API to new Bitmap API - * - * 05 12 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Add Power Management - Legacy PS-POLL support. - * - * 03 18 2010 kevin.huang - * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support - * Ignore the PROBE_DELAY state if the value of Probe Delay == 0 - * - * 03 10 2010 kevin.huang - * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support - * Add Channel Manager for arbitration of JOIN and SCAN Req - * - * 02 23 2010 kevin.huang - * [BORA00000603][WIFISYS] [New Feature] AAA Module Support - * Add support scan channel 1~14 and update scan result's frequency infou1rwduu`wvpghlqg|n`slk+mpdkb - * - * 01 08 2010 kevin.huang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * Add set RX Filter to receive BCN from different BSSID during SCAN - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * Nov 25 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Remove flag of CFG_TEST_MGMT_FSM - * - * Nov 20 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Change parameter of scanSendProbeReqFrames() - * - * Nov 16 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Update scnFsmSteps() - * - * Nov 5 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * Fix typo - * - * Nov 5 2009 mtk01461 - * [BORA00000018] Integrate WIFI part into BORA for the 1st time - * -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ -#if DBG -/*lint -save -e64 Type mismatch */ -static PUINT_8 apucDebugScanState[SCAN_STATE_NUM] = { - (PUINT_8)DISP_STRING("SCAN_STATE_IDLE"), - (PUINT_8)DISP_STRING("SCAN_STATE_SCANNING"), -}; -/*lint -restore */ -#endif /* DBG */ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -scnFsmSteps ( - IN P_ADAPTER_T prAdapter, - IN ENUM_SCAN_STATE_T eNextState - ) -{ - P_SCAN_INFO_T prScanInfo; - P_SCAN_PARAM_T prScanParam; - P_MSG_HDR_T prMsgHdr; - - BOOLEAN fgIsTransition = (BOOLEAN)FALSE; - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prScanParam = &prScanInfo->rScanParam; - - do { - -#if DBG - DBGLOG(SCN, STATE, ("TRANSITION: [%s] -> [%s]\n", - apucDebugScanState[prScanInfo->eCurrentState], - apucDebugScanState[eNextState])); -#else - DBGLOG(SCN, STATE, ("[%d] TRANSITION: [%d] -> [%d]\n", - DBG_SCN_IDX, - prScanInfo->eCurrentState, - eNextState)); -#endif - - /* NOTE(Kevin): This is the only place to change the eCurrentState(except initial) */ - prScanInfo->eCurrentState = eNextState; - - fgIsTransition = (BOOLEAN)FALSE; - - switch (prScanInfo->eCurrentState) { - case SCAN_STATE_IDLE: - /* check for pending scanning requests */ - if(!LINK_IS_EMPTY(&(prScanInfo->rPendingMsgList))) { - // load next message from pending list as scan parameters - LINK_REMOVE_HEAD(&(prScanInfo->rPendingMsgList), prMsgHdr, P_MSG_HDR_T); - - if(prMsgHdr->eMsgId == MID_AIS_SCN_SCAN_REQ - || prMsgHdr->eMsgId == MID_BOW_SCN_SCAN_REQ - || prMsgHdr->eMsgId == MID_P2P_SCN_SCAN_REQ - || prMsgHdr->eMsgId == MID_RLM_SCN_SCAN_REQ) { - scnFsmHandleScanMsg(prAdapter, (P_MSG_SCN_SCAN_REQ)prMsgHdr); - } - else { - scnFsmHandleScanMsgV2(prAdapter, (P_MSG_SCN_SCAN_REQ_V2)prMsgHdr); - } - - /* switch to next state */ - eNextState = SCAN_STATE_SCANNING; - fgIsTransition = TRUE; - - cnmMemFree(prAdapter, prMsgHdr); - } - break; - - case SCAN_STATE_SCANNING: - if(prScanParam->fgIsScanV2 == FALSE) { - scnSendScanReq(prAdapter); - } - else { - scnSendScanReqV2(prAdapter); - } - break; - - default: - ASSERT(0); - break; - - } - } - while (fgIsTransition); - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Generate CMD_ID_SCAN_REQ command -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -scnSendScanReq ( - IN P_ADAPTER_T prAdapter - ) -{ - P_SCAN_INFO_T prScanInfo; - P_SCAN_PARAM_T prScanParam; - CMD_SCAN_REQ rCmdScanReq; - UINT_32 i; - - ASSERT(prAdapter); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prScanParam = &prScanInfo->rScanParam; - - // send command packet for scan - kalMemZero(&rCmdScanReq, sizeof(CMD_SCAN_REQ)); - - rCmdScanReq.ucSeqNum = prScanParam->ucSeqNum; - rCmdScanReq.ucNetworkType = (UINT_8)prScanParam->eNetTypeIndex; - rCmdScanReq.ucScanType = (UINT_8)prScanParam->eScanType; - rCmdScanReq.ucSSIDType = prScanParam->ucSSIDType; - - if(prScanParam->ucSSIDNum == 1) { - COPY_SSID(rCmdScanReq.aucSSID, - rCmdScanReq.ucSSIDLength, - prScanParam->aucSpecifiedSSID[0], - prScanParam->ucSpecifiedSSIDLen[0]); - } - - rCmdScanReq.ucChannelType = (UINT_8)prScanParam->eScanChannel; - - if (prScanParam->eScanChannel == SCAN_CHANNEL_SPECIFIED) { - /* P2P would use: - * 1. Specified Listen Channel of passive scan for LISTEN state. - * 2. Specified Listen Channel of Target Device of active scan for SEARCH state. (Target != NULL) - */ - rCmdScanReq.ucChannelListNum = prScanParam->ucChannelListNum; - - for(i = 0 ; i < rCmdScanReq.ucChannelListNum ; i++) { - rCmdScanReq.arChannelList[i].ucBand = - (UINT_8) prScanParam->arChnlInfoList[i].eBand; - - rCmdScanReq.arChannelList[i].ucChannelNum = - (UINT_8)prScanParam->arChnlInfoList[i].ucChannelNum; - } - } - -#if CFG_ENABLE_WIFI_DIRECT - if(prScanParam->eNetTypeIndex == NETWORK_TYPE_P2P_INDEX) { - rCmdScanReq.u2ChannelDwellTime = prScanParam->u2PassiveListenInterval; - } -#endif -#if RSSI_ENHANCE - //add by gwl - rCmdScanReq.u2ChannelDwellTime = 200; - rCmdScanReq.u2ChannelMinDwellTime = 200; -#endif - if(prScanParam->u2IELen <= MAX_IE_LENGTH) { - rCmdScanReq.u2IELen = prScanParam->u2IELen; - } - else { - rCmdScanReq.u2IELen = MAX_IE_LENGTH; - } - - if (prScanParam->u2IELen) { - kalMemCopy(rCmdScanReq.aucIE, - prScanParam->aucIE, - sizeof(UINT_8) * rCmdScanReq.u2IELen); - } - - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SCAN_REQ, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - OFFSET_OF(CMD_SCAN_REQ, aucIE) + rCmdScanReq.u2IELen, - (PUINT_8)&rCmdScanReq, - NULL, - 0); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Generate CMD_ID_SCAN_REQ_V2 command -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -scnSendScanReqV2 ( - IN P_ADAPTER_T prAdapter - ) -{ - P_SCAN_INFO_T prScanInfo; - P_SCAN_PARAM_T prScanParam; - CMD_SCAN_REQ_V2 rCmdScanReq; - UINT_32 i; - - ASSERT(prAdapter); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prScanParam = &prScanInfo->rScanParam; - - // send command packet for scan - kalMemZero(&rCmdScanReq, sizeof(CMD_SCAN_REQ_V2)); - - rCmdScanReq.ucSeqNum = prScanParam->ucSeqNum; - rCmdScanReq.ucNetworkType = (UINT_8)prScanParam->eNetTypeIndex; - rCmdScanReq.ucScanType = (UINT_8)prScanParam->eScanType; - rCmdScanReq.ucSSIDType = prScanParam->ucSSIDType; - - for (i = 0 ; i < prScanParam->ucSSIDNum; i++) { - COPY_SSID(rCmdScanReq.arSSID[i].aucSsid, - rCmdScanReq.arSSID[i].u4SsidLen, - prScanParam->aucSpecifiedSSID[i], - prScanParam->ucSpecifiedSSIDLen[i]); - } - - rCmdScanReq.u2ProbeDelayTime = (UINT_8)prScanParam->u2ProbeDelayTime; - rCmdScanReq.ucChannelType = (UINT_8)prScanParam->eScanChannel; - - if (prScanParam->eScanChannel == SCAN_CHANNEL_SPECIFIED) { - /* P2P would use: - * 1. Specified Listen Channel of passive scan for LISTEN state. - * 2. Specified Listen Channel of Target Device of active scan for SEARCH state. (Target != NULL) - */ - rCmdScanReq.ucChannelListNum = prScanParam->ucChannelListNum; - - for(i = 0 ; i < rCmdScanReq.ucChannelListNum ; i++) { - rCmdScanReq.arChannelList[i].ucBand = - (UINT_8) prScanParam->arChnlInfoList[i].eBand; - - rCmdScanReq.arChannelList[i].ucChannelNum = - (UINT_8)prScanParam->arChnlInfoList[i].ucChannelNum; - } - } - -#if CFG_ENABLE_WIFI_DIRECT - if(prScanParam->eNetTypeIndex == NETWORK_TYPE_P2P_INDEX) { - rCmdScanReq.u2ChannelDwellTime = prScanParam->u2PassiveListenInterval; - } -#endif - - if(prScanParam->u2IELen <= MAX_IE_LENGTH) { - rCmdScanReq.u2IELen = prScanParam->u2IELen; - } - else { - rCmdScanReq.u2IELen = MAX_IE_LENGTH; - } - - if (prScanParam->u2IELen) { - kalMemCopy(rCmdScanReq.aucIE, - prScanParam->aucIE, - sizeof(UINT_8) * rCmdScanReq.u2IELen); - } - - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SCAN_REQ_V2, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - OFFSET_OF(CMD_SCAN_REQ_V2, aucIE) + rCmdScanReq.u2IELen, - (PUINT_8)&rCmdScanReq, - NULL, - 0); - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -scnFsmMsgStart ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_SCAN_INFO_T prScanInfo; - P_SCAN_PARAM_T prScanParam; - - ASSERT(prMsgHdr); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prScanParam = &prScanInfo->rScanParam; - - - if (prScanInfo->eCurrentState == SCAN_STATE_IDLE) { - if(prMsgHdr->eMsgId == MID_AIS_SCN_SCAN_REQ - || prMsgHdr->eMsgId == MID_BOW_SCN_SCAN_REQ - || prMsgHdr->eMsgId == MID_P2P_SCN_SCAN_REQ - || prMsgHdr->eMsgId == MID_RLM_SCN_SCAN_REQ) { - scnFsmHandleScanMsg(prAdapter, (P_MSG_SCN_SCAN_REQ)prMsgHdr); - } - else if(prMsgHdr->eMsgId == MID_AIS_SCN_SCAN_REQ_V2 - || prMsgHdr->eMsgId == MID_BOW_SCN_SCAN_REQ_V2 - || prMsgHdr->eMsgId == MID_P2P_SCN_SCAN_REQ_V2 - || prMsgHdr->eMsgId == MID_RLM_SCN_SCAN_REQ_V2) { - scnFsmHandleScanMsgV2(prAdapter, (P_MSG_SCN_SCAN_REQ_V2)prMsgHdr); - } - else { - // should not deliver to this function - ASSERT(0); - } - - cnmMemFree(prAdapter, prMsgHdr); - scnFsmSteps(prAdapter, SCAN_STATE_SCANNING); - } - else { - LINK_INSERT_TAIL(&prScanInfo->rPendingMsgList, &prMsgHdr->rLinkEntry); - } - - return; -} - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -scnFsmMsgAbort ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_HDR_T prMsgHdr - ) -{ - P_MSG_SCN_SCAN_CANCEL prScanCancel; - P_SCAN_INFO_T prScanInfo; - P_SCAN_PARAM_T prScanParam; - CMD_SCAN_CANCEL rCmdScanCancel; - - ASSERT(prMsgHdr); - - prScanCancel = (P_MSG_SCN_SCAN_CANCEL)prMsgHdr; - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prScanParam = &prScanInfo->rScanParam; - - if (prScanInfo->eCurrentState != SCAN_STATE_IDLE) { - if(prScanCancel->ucSeqNum == prScanParam->ucSeqNum && - prScanCancel->ucNetTypeIndex == (UINT_8)prScanParam->eNetTypeIndex) { - /* send cancel message to firmware domain */ - rCmdScanCancel.ucSeqNum = prScanParam->ucSeqNum; - -#if CFG_ENABLE_WIFI_DIRECT - if(prScanParam->eNetTypeIndex == NETWORK_TYPE_P2P_INDEX) { - rCmdScanCancel.ucIsExtChannel = (UINT_8) prScanCancel->fgIsChannelExt; - } - else { - rCmdScanCancel.ucIsExtChannel = (UINT_8) FALSE; - } -#endif - - wlanSendSetQueryCmd(prAdapter, - CMD_ID_SCAN_CANCEL, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_SCAN_CANCEL), - (PUINT_8)&rCmdScanCancel, - NULL, - 0); - - /* generate scan-done event for caller */ - scnFsmGenerateScanDoneMsg(prAdapter, - prScanParam->ucSeqNum, - (UINT_8)prScanParam->eNetTypeIndex, - SCAN_STATUS_CANCELLED); - - /* switch to next pending scan */ - scnFsmSteps(prAdapter, SCAN_STATE_IDLE); - } - else { - scnFsmRemovePendingMsg(prAdapter, prScanCancel->ucSeqNum, prScanCancel->ucNetTypeIndex); - } - } - - cnmMemFree(prAdapter, prMsgHdr); - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Scan Message Parsing (Legacy) -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -scnFsmHandleScanMsg ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_SCN_SCAN_REQ prScanReqMsg - ) -{ - P_SCAN_INFO_T prScanInfo; - P_SCAN_PARAM_T prScanParam; - UINT_32 i; - - ASSERT(prAdapter); - ASSERT(prScanReqMsg); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prScanParam = &prScanInfo->rScanParam; - - prScanParam->eScanType = prScanReqMsg->eScanType; - prScanParam->eNetTypeIndex = (ENUM_NETWORK_TYPE_INDEX_T)prScanReqMsg->ucNetTypeIndex; - prScanParam->ucSSIDType = prScanReqMsg->ucSSIDType; - if (prScanParam->ucSSIDType & (SCAN_REQ_SSID_SPECIFIED | SCAN_REQ_SSID_P2P_WILDCARD)) { - prScanParam->ucSSIDNum = 1; - - COPY_SSID(prScanParam->aucSpecifiedSSID[0], - prScanParam->ucSpecifiedSSIDLen[0], - prScanReqMsg->aucSSID, - prScanReqMsg->ucSSIDLength); - - // reset SSID length to zero for rest array entries - for(i = 1 ; i < SCN_SSID_MAX_NUM ; i++) { - prScanParam->ucSpecifiedSSIDLen[i] = 0; - } - } - else { - prScanParam->ucSSIDNum = 0; - - for(i = 0 ; i < SCN_SSID_MAX_NUM ; i++) { - prScanParam->ucSpecifiedSSIDLen[i] = 0; - } - } - - prScanParam->u2ProbeDelayTime = 0; - prScanParam->eScanChannel = prScanReqMsg->eScanChannel; - if(prScanParam->eScanChannel == SCAN_CHANNEL_SPECIFIED) { - if(prScanReqMsg->ucChannelListNum <= MAXIMUM_OPERATION_CHANNEL_LIST) { - prScanParam->ucChannelListNum = prScanReqMsg->ucChannelListNum; - } - else { - prScanParam->ucChannelListNum = MAXIMUM_OPERATION_CHANNEL_LIST; - } - - kalMemCopy(prScanParam->arChnlInfoList, - prScanReqMsg->arChnlInfoList, - sizeof(RF_CHANNEL_INFO_T) * prScanParam->ucChannelListNum); - } - - if(prScanReqMsg->u2IELen <= MAX_IE_LENGTH) { - prScanParam->u2IELen = prScanReqMsg->u2IELen; - } - else { - prScanParam->u2IELen = MAX_IE_LENGTH; - } - - if(prScanParam->u2IELen) { - kalMemCopy(prScanParam->aucIE, prScanReqMsg->aucIE, prScanParam->u2IELen); - } - -#if CFG_ENABLE_WIFI_DIRECT - if(prScanParam->eNetTypeIndex == NETWORK_TYPE_P2P_INDEX) { - prScanParam->u2PassiveListenInterval = prScanReqMsg->u2ChannelDwellTime; - } -#endif - prScanParam->ucSeqNum = prScanReqMsg->ucSeqNum; - - if(prScanReqMsg->rMsgHdr.eMsgId == MID_RLM_SCN_SCAN_REQ) { - prScanParam->fgIsObssScan = TRUE; - } - else { - prScanParam->fgIsObssScan = FALSE; - } - - prScanParam->fgIsScanV2 = FALSE; - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Scan Message Parsing - V2 with multiple SSID support -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -scnFsmHandleScanMsgV2 ( - IN P_ADAPTER_T prAdapter, - IN P_MSG_SCN_SCAN_REQ_V2 prScanReqMsg - ) -{ - P_SCAN_INFO_T prScanInfo; - P_SCAN_PARAM_T prScanParam; - UINT_32 i; - - ASSERT(prAdapter); - ASSERT(prScanReqMsg); - ASSERT(prScanReqMsg->ucSSIDNum <= SCN_SSID_MAX_NUM); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prScanParam = &prScanInfo->rScanParam; - - prScanParam->eScanType = prScanReqMsg->eScanType; - prScanParam->eNetTypeIndex = (ENUM_NETWORK_TYPE_INDEX_T)prScanReqMsg->ucNetTypeIndex; - prScanParam->ucSSIDType = prScanReqMsg->ucSSIDType; - prScanParam->ucSSIDNum = prScanReqMsg->ucSSIDNum; - - for(i = 0 ; i < prScanReqMsg->ucSSIDNum ; i++) { - COPY_SSID(prScanParam->aucSpecifiedSSID[i], - prScanParam->ucSpecifiedSSIDLen[i], - prScanReqMsg->prSsid[i].aucSsid, - (UINT_8)prScanReqMsg->prSsid[i].u4SsidLen); - } - - prScanParam->u2ProbeDelayTime = prScanReqMsg->u2ProbeDelay; - prScanParam->eScanChannel = prScanReqMsg->eScanChannel; - if(prScanParam->eScanChannel == SCAN_CHANNEL_SPECIFIED) { - if(prScanReqMsg->ucChannelListNum <= MAXIMUM_OPERATION_CHANNEL_LIST) { - prScanParam->ucChannelListNum = prScanReqMsg->ucChannelListNum; - } - else { - prScanParam->ucChannelListNum = MAXIMUM_OPERATION_CHANNEL_LIST; - } - - kalMemCopy(prScanParam->arChnlInfoList, - prScanReqMsg->arChnlInfoList, - sizeof(RF_CHANNEL_INFO_T) * prScanParam->ucChannelListNum); - } - - if(prScanReqMsg->u2IELen <= MAX_IE_LENGTH) { - prScanParam->u2IELen = prScanReqMsg->u2IELen; - } - else { - prScanParam->u2IELen = MAX_IE_LENGTH; - } - - if(prScanParam->u2IELen) { - kalMemCopy(prScanParam->aucIE, prScanReqMsg->aucIE, prScanParam->u2IELen); - } - -#if CFG_ENABLE_WIFI_DIRECT - if(prScanParam->eNetTypeIndex == NETWORK_TYPE_P2P_INDEX) { - prScanParam->u2PassiveListenInterval = prScanReqMsg->u2ChannelDwellTime; - } -#endif - prScanParam->ucSeqNum = prScanReqMsg->ucSeqNum; - - if(prScanReqMsg->rMsgHdr.eMsgId == MID_RLM_SCN_SCAN_REQ) { - prScanParam->fgIsObssScan = TRUE; - } - else { - prScanParam->fgIsObssScan = FALSE; - } - - prScanParam->fgIsScanV2 = TRUE; - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Remove pending scan request -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -scnFsmRemovePendingMsg ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucSeqNum, - IN UINT_8 ucNetTypeIndex - ) -{ - P_SCAN_INFO_T prScanInfo; - P_SCAN_PARAM_T prScanParam; - P_MSG_HDR_T prPendingMsgHdr, prPendingMsgHdrNext, prRemoveMsgHdr = NULL; - P_LINK_ENTRY_T prRemoveLinkEntry = NULL; - - ASSERT(prAdapter); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prScanParam = &prScanInfo->rScanParam; - - /* traverse through rPendingMsgList for removal */ - LINK_FOR_EACH_ENTRY_SAFE(prPendingMsgHdr, - prPendingMsgHdrNext, - &(prScanInfo->rPendingMsgList), - rLinkEntry, - MSG_HDR_T) { - if(prPendingMsgHdr->eMsgId == MID_AIS_SCN_SCAN_REQ - || prPendingMsgHdr->eMsgId == MID_BOW_SCN_SCAN_REQ - || prPendingMsgHdr->eMsgId == MID_P2P_SCN_SCAN_REQ - || prPendingMsgHdr->eMsgId == MID_RLM_SCN_SCAN_REQ) { - P_MSG_SCN_SCAN_REQ prScanReqMsg = (P_MSG_SCN_SCAN_REQ)prPendingMsgHdr; - - if(ucSeqNum == prScanReqMsg->ucSeqNum && - ucNetTypeIndex == prScanReqMsg->ucNetTypeIndex) { - prRemoveLinkEntry = &(prScanReqMsg->rMsgHdr.rLinkEntry); - prRemoveMsgHdr = prPendingMsgHdr; - } - } - else if(prPendingMsgHdr->eMsgId == MID_AIS_SCN_SCAN_REQ_V2 - || prPendingMsgHdr->eMsgId == MID_BOW_SCN_SCAN_REQ_V2 - || prPendingMsgHdr->eMsgId == MID_P2P_SCN_SCAN_REQ_V2 - || prPendingMsgHdr->eMsgId == MID_RLM_SCN_SCAN_REQ_V2) { - P_MSG_SCN_SCAN_REQ_V2 prScanReqMsgV2 = (P_MSG_SCN_SCAN_REQ_V2)prPendingMsgHdr; - - if(ucSeqNum == prScanReqMsgV2->ucSeqNum && - ucNetTypeIndex == prScanReqMsgV2->ucNetTypeIndex) { - prRemoveLinkEntry = &(prScanReqMsgV2->rMsgHdr.rLinkEntry); - prRemoveMsgHdr = prPendingMsgHdr; - } - } - - if(prRemoveLinkEntry) { - /* generate scan-done event for caller */ - scnFsmGenerateScanDoneMsg(prAdapter, - ucSeqNum, - ucNetTypeIndex, - SCAN_STATUS_CANCELLED); - - /* remove from pending list */ - LINK_REMOVE_KNOWN_ENTRY(&(prScanInfo->rPendingMsgList), prRemoveLinkEntry); - cnmMemFree(prAdapter, prRemoveMsgHdr); - - break; - } - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -scnEventScanDone ( - IN P_ADAPTER_T prAdapter, - IN P_EVENT_SCAN_DONE prScanDone - ) -{ - P_SCAN_INFO_T prScanInfo; - P_SCAN_PARAM_T prScanParam; - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prScanParam = &prScanInfo->rScanParam; - - // buffer empty channel information - if(prScanParam->eScanChannel == SCAN_CHANNEL_FULL - || prScanParam->eScanChannel == SCAN_CHANNEL_2G4) { - if(prScanDone->ucSparseChannelValid) { - prScanInfo->fgIsSparseChannelValid = TRUE; - prScanInfo->rSparseChannel.eBand = (ENUM_BAND_T)prScanDone->rSparseChannel.ucBand; - prScanInfo->rSparseChannel.ucChannelNum = prScanDone->rSparseChannel.ucChannelNum; - } - else { - prScanInfo->fgIsSparseChannelValid = FALSE; - } - } - - if(prScanInfo->eCurrentState == SCAN_STATE_SCANNING && - prScanDone->ucSeqNum == prScanParam->ucSeqNum) { - /* generate scan-done event for caller */ - scnFsmGenerateScanDoneMsg(prAdapter, - prScanParam->ucSeqNum, - (UINT_8)prScanParam->eNetTypeIndex, - SCAN_STATUS_DONE); - - /* switch to next pending scan */ - scnFsmSteps(prAdapter, SCAN_STATE_IDLE); - } - else { - DBGLOG(SCN, LOUD, ("Unexpected SCAN-DONE event: SeqNum = %d, Current State = %d\n", - prScanDone->ucSeqNum, - prScanInfo->eCurrentState)); - } - - return; -} /* end of scnEventScanDone */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -scnFsmGenerateScanDoneMsg ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucSeqNum, - IN UINT_8 ucNetTypeIndex, - IN ENUM_SCAN_STATUS eScanStatus - ) -{ - P_SCAN_INFO_T prScanInfo; - P_SCAN_PARAM_T prScanParam; - P_MSG_SCN_SCAN_DONE prScanDoneMsg; - - ASSERT(prAdapter); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - prScanParam = &prScanInfo->rScanParam; - - prScanDoneMsg = (P_MSG_SCN_SCAN_DONE)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_SCN_SCAN_DONE)); - if (!prScanDoneMsg) { - ASSERT(0); // Can't indicate SCAN FSM Complete - return; - } - - if(prScanParam->fgIsObssScan == TRUE) { - prScanDoneMsg->rMsgHdr.eMsgId = MID_SCN_RLM_SCAN_DONE; - } - else { - switch((ENUM_NETWORK_TYPE_INDEX_T)ucNetTypeIndex) { - case NETWORK_TYPE_AIS_INDEX: - prScanDoneMsg->rMsgHdr.eMsgId = MID_SCN_AIS_SCAN_DONE; - break; - -#if CFG_ENABLE_WIFI_DIRECT - case NETWORK_TYPE_P2P_INDEX: - prScanDoneMsg->rMsgHdr.eMsgId = MID_SCN_P2P_SCAN_DONE; - break; -#endif - -#if CFG_ENABLE_BT_OVER_WIFI - case NETWORK_TYPE_BOW_INDEX: - prScanDoneMsg->rMsgHdr.eMsgId = MID_SCN_BOW_SCAN_DONE; - break; -#endif - - default: - DBGLOG(SCN, LOUD, ("Unexpected Network Type: %d\n", ucNetTypeIndex)); - ASSERT(0); - break; - } - } - - prScanDoneMsg->ucSeqNum = ucSeqNum; - prScanDoneMsg->ucNetTypeIndex = ucNetTypeIndex; - prScanDoneMsg->eScanStatus = eScanStatus; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prScanDoneMsg, - MSG_SEND_METHOD_BUF); - -} /* end of scnFsmGenerateScanDoneMsg() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Query for most sparse channel -* -* \param[in] -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -scnQuerySparseChannel ( - IN P_ADAPTER_T prAdapter, - P_ENUM_BAND_T prSparseBand, - PUINT_8 pucSparseChannel - ) -{ - P_SCAN_INFO_T prScanInfo; - - ASSERT(prAdapter); - - prScanInfo = &(prAdapter->rWifiVar.rScanInfo); - - if(prScanInfo->fgIsSparseChannelValid == TRUE) { - if(prSparseBand) { - *prSparseBand = prScanInfo->rSparseChannel.eBand; - } - - if(pucSparseChannel) { - *pucSparseChannel = prScanInfo->rSparseChannel.ucChannelNum; - } - - return TRUE; - } - else { - return FALSE; - } -} - diff --git a/drivers/net/wireless/mt5931/mgmt/sec_fsm.c b/drivers/net/wireless/mt5931/mgmt/sec_fsm.c deleted file mode 100755 index 862b9fa64661..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/sec_fsm.c +++ /dev/null @@ -1,1255 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/sec_fsm.c#1 $ -*/ - -/*! \file "sec_fsm.c" - \brief This is the file implement security check state machine. - - In security module, do the port control check after success join to an AP, - and the path to NORMAL TR, the state machine handle these state transition. -*/ - - - -/* -** $Log: sec_fsm.c $ - * - * 11 24 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * Adjust code for DBG and CONFIG_XLOG. - * - * 11 11 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * modify the xlog related code. - * - * 11 10 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * change the debug module level. - * - * 11 02 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * adding the code for XLOG. - * - * 03 29 2011 wh.su - * [WCXRP00000248] [MT6620 Wi-Fi][FW]Fixed the Klockwork error - * fixed the kclocwork error. - * - * 01 26 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * . - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Fix Compile Error when DBG is disabled. - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Change Station Type in Station Record, Modify MACRO definition for getting station type & network type index & Role. - * - * 09 29 2010 wh.su - * [WCXRP00000072] [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue - * [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue. - * - * 09 24 2010 wh.su - * NULL - * [WCXRP00005002][MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 20 2010 wh.su - * NULL - * adding the eapol callback setting. - * - * 08 19 2010 wh.su - * NULL - * adding the tx pkt call back handle for countermeasure. - * - * 07 19 2010 wh.su - * - * fixed the compilng error at debug mode. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * modify some code for concurrent network. - * - * 06 19 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * consdier the concurrent network setting. - * - * 05 28 2010 wh.su - * [BORA00000626][MT6620] Refine the remove key flow for WHQL testing - * fixed the ad-hoc wpa-none send non-encrypted frame issue. - * - * 05 24 2010 kevin.huang - * [BORA00000794][WIFISYS][New Feature]Power Management Support - * Refine authSendAuthFrame() for NULL STA_RECORD_T case and minimum deauth interval. - * - * 04 24 2010 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * g_aprBssInfo[] depends on CFG_SUPPORT_P2P and CFG_SUPPORT_BOW - * - * 04 13 2010 wh.su - * [BORA00000680][MT6620] Support the statistic for Microsoft os query - * fixed the Klocwork error and refine the class error message. - * - * 03 03 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * move the AIS specific variable for security to AIS specific structure. - * - * 03 03 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * Fixed the pre-authentication timer not correctly init issue, and modify the security related callback function prototype. - * - * 03 01 2010 wh.su - * [BORA00000605][WIFISYS] Phase3 Integration - * Refine the variable and parameter for security. - * - * 01 27 2010 wh.su - * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code - * add and fixed some security function. - * - * 01 13 2010 wh.su - * [BORA00000476][Wi-Fi][firmware] Add the security module initialize code - * fixed the compiling warning - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * refine some code - * - * Dec 4 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * refine the code - * - * Dec 1 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * code refine - * - * Nov 23 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adjust the function name - * - * Nov 19 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adjust the state machine, to meet the firmware security design v1.1 - * - * Nov 18 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -#if CFG_RSN_MIGRATION - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ -#if DBG -/*lint -save -e64 Type mismatch */ -static PUINT_8 apucDebugSecState[SEC_STATE_NUM] = { - (PUINT_8)DISP_STRING("SEC_STATE_INIT"), - (PUINT_8)DISP_STRING("SEC_STATE_INITIATOR_PORT_BLOCKED"), - (PUINT_8)DISP_STRING("SEC_STATE_RESPONDER_PORT_BLOCKED"), - (PUINT_8)DISP_STRING("SEC_STATE_CHECK_OK"), - (PUINT_8)DISP_STRING("SEC_STATE_SEND_EAPOL"), - (PUINT_8)DISP_STRING("SEC_STATE_SEND_DEAUTH"), - (PUINT_8)DISP_STRING("SEC_STATE_COUNTERMEASURE"), -}; -/*lint -restore */ -#endif /* DBG */ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will do initialization of Security FSM and all variables in -* SEC_INFO_T. -* -* \param[in] prSta Pointer to the STA record -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -secFsmInit ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - P_SEC_INFO_T prSecInfo; - P_AIS_SPECIFIC_BSS_INFO_T prAisSpecBssInfo; - - ASSERT(prSta); - - prSecInfo = &prSta->rSecInfo; - - #if 1 /* MT6620 */ - //At MT5921, is ok, but at MT6620, firmware base ASIC, the firmware - //will lost these data, thus, driver have to keep the wep material and - //setting to firmware while awake from D3. - #endif - - prSecInfo->eCurrentState = SEC_STATE_INIT; - - prSecInfo->fg2nd1xSend = FALSE; - prSecInfo->fgKeyStored = FALSE; - - if (IS_STA_IN_AIS(prSta)) { - prAisSpecBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - - prAisSpecBssInfo->u4RsnaLastMICFailTime = 0; - prAisSpecBssInfo->fgCheckEAPoLTxDone = FALSE; - - cnmTimerInitTimer(prAdapter, - &prAdapter->rWifiVar.rAisSpecificBssInfo.rRsnaEAPoLReportTimeoutTimer, - (PFN_MGMT_TIMEOUT_FUNC)secFsmEventEapolTxTimeout, - (UINT_32)prSta); - - cnmTimerInitTimer(prAdapter, - &prAdapter->rWifiVar.rAisSpecificBssInfo.rRsnaBlockTrafficTimer, - (PFN_MGMT_TIMEOUT_FUNC)secFsmEventEndOfCounterMeasure, - (UINT_32)prSta); - - } - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will do uninitialization of Security FSM and all variables in -* SEC_INFO_T. -* -* \param[in] prSta Pointer to the STA record -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID /* whsu:Todo: */ -secFsmUnInit ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - P_SEC_INFO_T prSecInfo; - - ASSERT(prSta); - - prSecInfo = &prSta->rSecInfo; - - prSecInfo->fg2nd1xSend = FALSE; - prSecInfo->fgKeyStored = FALSE; - - //nicPrivacyRemoveWlanTable(prSta->ucWTEntry); - - if (IS_STA_IN_AIS(prSta)) { - cnmTimerStopTimer(prAdapter, - &prAdapter->rWifiVar.rAisSpecificBssInfo.rRsnaEAPoLReportTimeoutTimer); - cnmTimerStopTimer(prAdapter, - &prAdapter->rWifiVar.rAisSpecificBssInfo.rRsnaBlockTrafficTimer); - } - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will do action part while in STATE transition of -* STANDBY to CHECK_OK. -* -* \param[in] prSta Pointer to the Sta record -* -* \return - none -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -secFsmTrans_INIT_to_CHECK_OK ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - secSetPortBlocked(prAdapter, prSta, FALSE); - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will do action part while in STATE transition of -* INIT to INITIATOR_PORT_BLOCKED. -* -* \param[in] prSta Pointer to the Sta record -* -* \return - none -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -secFsmTrans_INIT_to_INITIATOR_PORT_BLOCKED ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will do action part while in STATE transition of -* INIT to RESPONDER_PORT_BLOCKED. -* -* \param[in] prSta Pointer to the Sta record -* -* \return - none -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -secFsmTrans_INIT_to_RESPONDER_PORT_BLOCKED ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will do action part while in STATE transition of -* INITIATOR_PORT_BLOCKED to CHECK_OK. -* -* \param[in] prSta Pointer to the Sta record -* -* \return - none -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -secFsmTrans_INITIATOR_PORT_BLOCKED_to_CHECK_OK ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - secSetPortBlocked(prAdapter, prSta, FALSE); - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will do action part while in STATE transition of -* RESPONDER_PORT_BLOCKED to CHECK_OK. -* -* \param[in] prSta Pointer to the Sta record -* -* \return - none -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -secFsmTrans_RESPONDER_PORT_BLOCKED_to_CHECK_OK ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - secSetPortBlocked(prAdapter, prSta, FALSE); - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will do action part while in STATE transition of -* CHECK_OK to SEND_EAPOL -* -* \param[in] prSta Pointer to the Sta record -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -secFsmTrans_CHECK_OK_to_SEND_EAPOL ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - - P_AIS_SPECIFIC_BSS_INFO_T prAisBssInfo; - - ASSERT(prAdapter); - - ASSERT(prSta); - - prAisBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - - ASSERT(prAisBssInfo); - - if (!IS_STA_IN_AIS(prSta)) { - DBGLOG(RSN, INFO, ("Counter Measure should occur at AIS network!!\n")); - //ASSERT(0); - return; - } - - prAisBssInfo->fgCheckEAPoLTxDone = TRUE; - - //cnmTimerStartTimer(prAdapter, - // &prAisBssInfo->rRsnaEAPoLReportTimeoutTimer, - // SEC_TO_MSEC(EAPOL_REPORT_SEND_TIMEOUT_INTERVAL_SEC)); - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will do action part while in STATE transition of -* SEND_EAPOL to SEND_DEAUTH. -* -* \param[in] prSta Pointer to the Sta record -* -* \return - none -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -secFsmTrans_SEND_EAPOL_to_SEND_DEAUTH ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - - if (!IS_STA_IN_AIS(prSta)) { - DBGLOG(RSN, INFO, ("Counter Measure should occur at AIS network!!\n")); - //ASSERT(0); - return; - } - - /* Compose deauth frame to AP, a call back function for tx done */ - if (authSendDeauthFrame(prAdapter, - prSta, - (P_SW_RFB_T)NULL, - REASON_CODE_MIC_FAILURE, - (PFN_TX_DONE_HANDLER)secFsmEventDeauthTxDone) != WLAN_STATUS_SUCCESS) { - ASSERT(FALSE); - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will do action part while in STATE transition of -* SEND_DEAUTH to COUNTERMEASURE. -* -* \param[in] prSta Pointer to the Sta record -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -secFsmTrans_SEND_DEAUTH_to_COUNTERMEASURE ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - ASSERT(prAdapter); - ASSERT(prSta); - - if (!IS_STA_IN_AIS(prSta)) { - DBGLOG(RSN, INFO, ("Counter Measure should occur at AIS network!!\n")); - //ASSERT(0); - return; - } - - //Start the 60 sec timer - cnmTimerStartTimer(prAdapter, - &prAdapter->rWifiVar.rAisSpecificBssInfo.rRsnaBlockTrafficTimer, - SEC_TO_MSEC(COUNTER_MEASURE_TIMEOUT_INTERVAL_SEC)); - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will do action part while in STATE transition of -* SEND_DEAUTH to COUNTERMEASURE. -* -* \param[in] prSta Pointer to the Sta record -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -__KAL_INLINE__ VOID -secFsmTrans_COUNTERMEASURE_to_INIT ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - - //Clear the counter measure flag - return; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief The Core FSM engine of security module. -* -* \param[in] prSta Pointer to the Sta record -* \param[in] eNextState Enum value of next sec STATE -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -VOID -secFsmSteps ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta, - IN ENUM_SEC_STATE_T eNextState - ) -{ - P_SEC_INFO_T prSecInfo; - BOOLEAN fgIsTransition = (BOOLEAN)FALSE; - - ASSERT(prSta); - - prSecInfo = &prSta->rSecInfo; - ASSERT(prSecInfo); - - DEBUGFUNC("secFsmSteps"); - do { - /* Do entering Next State */ - prSecInfo->ePreviousState = prSecInfo->eCurrentState; - - /* Do entering Next State */ -#if DBG - DBGLOG(RSN, STATE, ("\n"MACSTR" TRANSITION: [%s] -> [%s]\n\n", - MAC2STR(prSta->aucMacAddr), - apucDebugSecState[prSecInfo->eCurrentState], - apucDebugSecState[eNextState])); -#else - DBGLOG(RSN, STATE, ("\n"MACSTR" [%d] TRANSITION: [%d] -> [%d]\n\n", - MAC2STR(prSta->aucMacAddr), - DBG_RSN_IDX, - prSecInfo->eCurrentState, - eNextState)); -#endif - prSecInfo->eCurrentState = eNextState; - - fgIsTransition = (BOOLEAN)FALSE; -#if 0 - /* Do tasks of the State that we just entered */ - switch (prSecInfo->eCurrentState) { - case SEC_STATE_INIT: - break; - case SEC_STATE_INITIATOR_PORT_BLOCKED: - break; - case SEC_STATE_RESPONDER_PORT_BLOCKED: - break; - case SEC_STATE_CHECK_OK: - break; - case SEC_STATE_SEND_EAPOL: - break; - case SEC_STATE_SEND_DEAUTH: - break; - case SEC_STATE_COUNTERMEASURE: - break; - default: - ASSERT(0); /* Make sure we have handle all STATEs */ - break; - } -#endif - } - while (fgIsTransition); - - return; - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will do initialization of Security FSM and all variables in -* SEC_INFO_T. -* -* \param[in] prSta Pointer to the Sta record -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -secFsmEventStart ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - P_SEC_INFO_T prSecInfo; - BOOLEAN fgIsTransition = (BOOLEAN)FALSE; - ENUM_SEC_STATE_T eNextState; - - DBGLOG(RSN, TRACE, ("secFsmRunEventStart\n")); - - ASSERT(prSta); - - if (!prSta) - return; - - if (!IS_STA_IN_AIS(prSta)) - return; - - DBGLOG(RSN, TRACE, ("secFsmRunEventStart for sta "MACSTR" network %d\n", - MAC2STR(prSta->aucMacAddr), prSta->ucNetTypeIndex)); - - prSecInfo = (P_SEC_INFO_T)&prSta->rSecInfo; - - eNextState = prSecInfo->eCurrentState; - - secSetPortBlocked(prAdapter, prSta, TRUE); - - //prSta->fgTransmitKeyExist = FALSE; - //whsu:: nicPrivacySetStaDefaultWTIdx(prSta); - -#if 1 /* Since the 1x and key can set to firmware in order, always enter the check ok state */ - SEC_STATE_TRANSITION(prAdapter, prSta, INIT, CHECK_OK); -#else - if (IS_STA_IN_AIS(prSta->eStaType)) { - if (secRsnKeyHandshakeEnabled(prAdapter) == TRUE -#if CFG_SUPPORT_WAPI - || (prAdapter->rWifiVar.rConnSettings.fgWapiMode) -#endif - ) { - prSta->fgTransmitKeyExist = FALSE; - //nicPrivacyInitialize(prSta->ucNetTypeIndex); - SEC_STATE_TRANSITION(prAdapter, prSta, INIT, INITIATOR_PORT_BLOCKED); - } - else { - SEC_STATE_TRANSITION(prAdapter, prSta, INIT, CHECK_OK); - } - } -#if CFG_ENABLE_WIFI_DIRECT || CFG_ENABLE_BT_OVER_WIFI - #if CFG_ENABLE_WIFI_DIRECT && CFG_ENABLE_BT_OVER_WIFI - else if ((prSta->eStaType == STA_TYPE_BOW_CLIENT) || - (prSta->eStaType == STA_TYPE_P2P_GC)) - #elif CFG_ENABLE_WIFI_DIRECT - else if (prSta->eStaType == STA_TYPE_P2P_GC) - #elif CFG_ENABLE_BT_OVER_WIFI - else if (prSta->eStaType == STA_TYPE_BOW_CLIENT) - #endif - { - SEC_STATE_TRANSITION(prAdapter, prSta, INIT, RESPONDER_PORT_BLOCKED); - } -#endif - else { - SEC_STATE_TRANSITION(prAdapter, prSta, INIT, INITIATOR_PORT_BLOCKED); - } -#endif - if (prSecInfo->eCurrentState != eNextState) { - secFsmSteps(prAdapter, prSta, eNextState); - } - - return; -} /* secFsmRunEventStart */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function called by reset procedure to force the sec fsm enter -* idle state -* -* \param[in] ucNetTypeIdx The Specific Network type index -* \param[in] prSta Pointer to the Sta record -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -secFsmEventAbort ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - P_SEC_INFO_T prSecInfo; - - DBGLOG(RSN, TRACE, ("secFsmEventAbort for sta "MACSTR" network %d\n", - MAC2STR(prSta->aucMacAddr), prSta->ucNetTypeIndex)); - - ASSERT(prSta); - - if (!prSta) - return; - - if (!IS_STA_IN_AIS(prSta)) - return; - - prSecInfo = (P_SEC_INFO_T)&prSta->rSecInfo; - - prSta->fgTransmitKeyExist = FALSE; - - secSetPortBlocked(prAdapter, prSta, TRUE); - - if (prSecInfo == NULL) - return; - - if (IS_STA_IN_AIS(prSta)) { - - prAdapter->rWifiVar.rAisSpecificBssInfo.fgTransmitKeyExist = FALSE; - - if (prSecInfo->eCurrentState == SEC_STATE_SEND_EAPOL) { - if (prAdapter->rWifiVar.rAisSpecificBssInfo.fgCheckEAPoLTxDone == FALSE) { - DBGLOG(RSN, TRACE, ("EAPOL STATE not match the flag\n")); - //cnmTimerStopTimer(prAdapter, &prAdapter->rWifiVar.rAisSpecificBssInfo.rRsnaEAPoLReportTimeoutTimer); - } - } - } - prSecInfo->eCurrentState = SEC_STATE_INIT; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will indicate an Event of "2nd EAPoL Tx is sending" to Sec FSM. -* -* \param[in] prSta Pointer to the Sta record -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -VOID -secFsmEvent2ndEapolTx ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - P_SEC_INFO_T prSecInfo; - ENUM_SEC_STATE_T eNextState; - //BOOLEAN fgIsTransition = (BOOLEAN)FALSE; - - DEBUGFUNC("secFsmRunEvent2ndEapolTx"); - - ASSERT(prSta); - - prSecInfo = &prSta->rSecInfo; - eNextState = prSecInfo->eCurrentState; - -#if DBG - DBGLOG(RSN, TRACE, (MACSTR" Sec state %s\n", MAC2STR(prSta->aucMacAddr), - apucDebugSecState[prSecInfo->eCurrentState])); -#else - DBGLOG(RSN, TRACE, (MACSTR" Sec state [%d]\n", MAC2STR(prSta->aucMacAddr), prSecInfo->eCurrentState)); -#endif - - switch(prSecInfo->eCurrentState) { - case SEC_STATE_INITIATOR_PORT_BLOCKED : - case SEC_STATE_CHECK_OK : - prSecInfo->fg2nd1xSend = TRUE; - break; - default: -#if DBG - DBGLOG(RSN, WARN, ("Rcv 2nd EAPoL at %s\n", apucDebugSecState[prSecInfo->eCurrentState])); -#else - DBGLOG(RSN, WARN, ("Rcv 2nd EAPoL at [%d]\n", prSecInfo->eCurrentState)); -#endif - break; - } - - if (prSecInfo->eCurrentState != eNextState) { - secFsmSteps(prAdapter, prSta, eNextState); - } - - return; - -}/* secFsmRunEvent2ndEapolTx */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will indicate an Event of "4th EAPoL Tx is Tx done" to Sec FSM. -* -* \param[in] prSta Pointer to the Sta record -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -VOID -secFsmEvent4ndEapolTxDone ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - P_SEC_INFO_T prSecInfo; - ENUM_SEC_STATE_T eNextState; - BOOLEAN fgIsTransition = (BOOLEAN)FALSE; - P_CMD_802_11_KEY prStoredKey; - - DEBUGFUNC("secFsmRunEvent4ndEapolTx"); - - ASSERT(prSta); - - prSecInfo = &prSta->rSecInfo; - eNextState = prSecInfo->eCurrentState; - -#if DBG - DBGLOG(RSN, TRACE, (MACSTR " Sec state %s\n", MAC2STR(prSta->aucMacAddr), - apucDebugSecState[prSecInfo->eCurrentState])); -#else - DBGLOG(RSN, TRACE, (MACSTR " Sec state [%d]\n", MAC2STR(prSta->aucMacAddr), prSecInfo->eCurrentState)); -#endif - - switch(prSecInfo->eCurrentState) { - case SEC_STATE_INITIATOR_PORT_BLOCKED : - case SEC_STATE_CHECK_OK : - prSecInfo->fg2nd1xSend = FALSE; - if (prSecInfo->fgKeyStored) { - prStoredKey = (P_CMD_802_11_KEY)prSecInfo->aucStoredKey; - - //prSta = rxmLookupStaRecIndexFromTA(prStoredKey->aucPeerAddr); - //if (nicPrivacySetKeyEntry(prStoredKey, prSta->ucWTEntry) == FALSE) - // DBGLOG(RSN, WARN, ("nicPrivacySetKeyEntry() fail,..\n")); - - //key update - prSecInfo->fgKeyStored = FALSE; - prSta->fgTransmitKeyExist = TRUE; - } - if (prSecInfo->eCurrentState == SEC_STATE_INITIATOR_PORT_BLOCKED) { - SEC_STATE_TRANSITION(prAdapter, prSta, INITIATOR_PORT_BLOCKED, CHECK_OK); - } - break; - default: - -#if DBG - DBGLOG(RSN, WARN, ("Rcv thh EAPoL Tx done at %s\n", apucDebugSecState[prSecInfo->eCurrentState])); -#else - DBGLOG(RSN, WARN, ("Rcv thh EAPoL Tx done at [%d]\n", prSecInfo->eCurrentState)); -#endif - break; - } - - if (prSecInfo->eCurrentState != eNextState) { - secFsmSteps(prAdapter, prSta, eNextState); - } - - return; - -}/* secFsmRunEvent4ndEapolTx */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will indicate an Event of "Pairwise key installed" to SEC FSM. -* -* \param[in] prSta Pointer to the Sta record -* -* \retval TRUE The key can be installed to HW -* \retval FALSE The kay conflict with the current key, abort it -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -secFsmEventPTKInstalled ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - P_SEC_INFO_T prSecInfo; - ENUM_SEC_STATE_T eNextState; - BOOLEAN fgStatus = TRUE; - BOOLEAN fgIsTransition = (BOOLEAN)FALSE; - - ASSERT(prSta); - - prSecInfo = &prSta->rSecInfo; - if (prSecInfo == NULL) - return TRUE; /* Not PTK */ - -#if DBG - DBGLOG(RSN, TRACE, (MACSTR " Sec state %s\n", MAC2STR(prSta->aucMacAddr), - apucDebugSecState[prSecInfo->eCurrentState])); -#else - DBGLOG(RSN, TRACE, (MACSTR " Sec state [%d]\n", MAC2STR(prSta->aucMacAddr), prSecInfo->eCurrentState)); -#endif - - eNextState = prSecInfo->eCurrentState; - - switch(prSecInfo->eCurrentState) { - case SEC_STATE_INIT: - /* Legacy wep, wpa-none */ - break; - - case SEC_STATE_INITIATOR_PORT_BLOCKED: - if (prSecInfo->fg2nd1xSend) { - } - else { - SEC_STATE_TRANSITION(prAdapter, prSta, INITIATOR_PORT_BLOCKED, CHECK_OK); - } - break; - - case SEC_STATE_RESPONDER_PORT_BLOCKED: - SEC_STATE_TRANSITION(prAdapter, prSta, RESPONDER_PORT_BLOCKED, CHECK_OK); - break; - - - case SEC_STATE_CHECK_OK: - break; - - default: - fgStatus = FALSE; - break; - } - - if (prSecInfo->eCurrentState != eNextState) { - secFsmSteps(prAdapter, prSta, eNextState); - } - - return fgStatus; - -} /* end of secFsmRunEventPTKInstalled() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will indicate an Event of "Counter Measure" to SEC FSM. -* -* \param[in] prSta Pointer to the Sta record -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -VOID -secFsmEventStartCounterMeasure ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prSta - ) -{ - P_SEC_INFO_T prSecInfo; - ENUM_SEC_STATE_T eNextState; - BOOLEAN fgIsTransition = (BOOLEAN)FALSE; - - DEBUGFUNC("secFsmRunEventStartCounterMeasure"); - - ASSERT(prSta); - - if (!IS_STA_IN_AIS(prSta)) { - DBGLOG(RSN, INFO, ("Counter Measure should occur at AIS network!!\n")); - //ASSERT(0); - return; - } - - prSecInfo = &prSta->rSecInfo; - - eNextState = prSecInfo->eCurrentState; - -#if DBG - DBGLOG(RSN, TRACE, (MACSTR " Sec state %s\n", MAC2STR(prSta->aucMacAddr), - apucDebugSecState[prSecInfo->eCurrentState])); -#else - DBGLOG(RSN, TRACE, (MACSTR " Sec state [%d]\n", MAC2STR(prSta->aucMacAddr), prSecInfo->eCurrentState)); -#endif - - prAdapter->rWifiVar.rAisSpecificBssInfo.u4RsnaLastMICFailTime = 0; - - switch(prSecInfo->eCurrentState) { - case SEC_STATE_CHECK_OK: - { - prAdapter->rWifiVar.rAisSpecificBssInfo.fgCounterMeasure = TRUE; - - // dls port control - SEC_STATE_TRANSITION(prAdapter, prSta, CHECK_OK, SEND_EAPOL); - } - break; - - default: - break; - } - - /* Call arbFsmSteps() when we are going to change ARB STATE */ - if (prSecInfo->eCurrentState != eNextState) { - secFsmSteps(prAdapter, prSta, eNextState); - } - - return; - -} /* secFsmRunEventStartCounterMeasure */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will indicate an Event of "802.1x EAPoL Tx Done" to Sec FSM. -* -* \param[in] prSta Pointer to the Sta record -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -VOID -secFsmEventEapolTxDone ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ) -{ - P_SEC_INFO_T prSecInfo; - ENUM_SEC_STATE_T eNextState; - BOOLEAN fgIsTransition = (BOOLEAN)FALSE; - P_AIS_SPECIFIC_BSS_INFO_T prAisBssInfo; - - DEBUGFUNC("secFsmRunEventEapolTxDone"); - - ASSERT(prStaRec); - - if (rTxDoneStatus != TX_RESULT_SUCCESS) { - DBGLOG(RSN, INFO, ("Error EAPoL fram fail to send!!\n")); - //ASSERT(0); - return; - } - - if (!IS_STA_IN_AIS(prStaRec)) { - DBGLOG(RSN, INFO, ("Counter Measure should occur at AIS network!!\n")); - //ASSERT(0); - return; - } - - prAisBssInfo = &prAdapter->rWifiVar.rAisSpecificBssInfo; - - ASSERT(prAisBssInfo); - - prSecInfo = &prStaRec->rSecInfo; - eNextState = prSecInfo->eCurrentState; - -#if DBG - DBGLOG(RSN, TRACE, (MACSTR " Sec state %s\n", MAC2STR(prStaRec->aucMacAddr), - apucDebugSecState[prSecInfo->eCurrentState])); -#else - DBGLOG(RSN, TRACE, (MACSTR " Sec state [%d]\n", MAC2STR(prStaRec->aucMacAddr), prSecInfo->eCurrentState)); -#endif - - switch(prSecInfo->eCurrentState) { - case SEC_STATE_SEND_EAPOL: - if (prAisBssInfo->fgCheckEAPoLTxDone == FALSE) { - ASSERT(0); - } - - prAisBssInfo->fgCheckEAPoLTxDone = FALSE; - //cnmTimerStopTimer(prAdapter, &prAisBssInfo->rRsnaEAPoLReportTimeoutTimer); - - SEC_STATE_TRANSITION(prAdapter, prStaRec, SEND_EAPOL, SEND_DEAUTH); - break; - default: - break; - } - - if (prSecInfo->eCurrentState != eNextState) { - secFsmSteps(prAdapter, prStaRec, eNextState); - } - - return; - -}/* secFsmRunEventEapolTxDone */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will indicate an Event of "Deauth frame Tx Done" to Sec FSM. -* -* \param[in] pMsduInfo Pointer to the Msdu Info -* \param[in] rStatus The Tx done status -* -* \return - -* -* \note after receive deauth frame, callback function call this -*/ -/*----------------------------------------------------------------------------*/ -VOID -secFsmEventDeauthTxDone ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ) -{ - P_STA_RECORD_T prStaRec; - P_SEC_INFO_T prSecInfo; - ENUM_SEC_STATE_T eNextState; - BOOLEAN fgIsTransition = (BOOLEAN)FALSE; - - DEBUGFUNC("secFsmRunEventDeauthTxDone"); - - ASSERT(prMsduInfo); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - ASSERT(prStaRec); - - if (!prStaRec) - return; - - if (!IS_STA_IN_AIS(prStaRec)) { - DBGLOG(RSN, INFO, ("Counter Measure should occur at AIS network!!\n")); - //ASSERT(0); - return; - } - - prSecInfo = (P_SEC_INFO_T)&prStaRec->rSecInfo; - -#if DBG - DBGLOG(RSN, TRACE, (MACSTR " Sec state %s\n", MAC2STR(prStaRec->aucMacAddr), - apucDebugSecState[prSecInfo->eCurrentState])); -#else - DBGLOG(RSN, TRACE, (MACSTR " Sec state [%d]\n", MAC2STR(prStaRec->aucMacAddr), prSecInfo->eCurrentState)); -#endif - - switch(prSecInfo->eCurrentState) { - case SEC_STATE_SEND_DEAUTH: - - DBGLOG(RSN, TRACE, ("Set timer %d\n", COUNTER_MEASURE_TIMEOUT_INTERVAL_SEC)); - - SEC_STATE_TRANSITION(prAdapter, prStaRec, SEND_DEAUTH, COUNTERMEASURE); - - break; - - default: - ASSERT(0); - break; - } - - return; -}/* secFsmRunEventDeauthTxDone */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will check the eapol error frame fail to send issue. -* -* \param[in] prSta Pointer to the Sta record -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -VOID -secFsmEventEapolTxTimeout ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Parm - ) -{ - P_STA_RECORD_T prStaRec; - - DEBUGFUNC("secFsmRunEventEapolTxTimeout"); - - prStaRec = (P_STA_RECORD_T)u4Parm; - - ASSERT(prStaRec); - - /* Todo:: How to handle the Eapol Error fail to send case? */ - ASSERT(0); - - return; - -}/* secFsmEventEapolTxTimeout */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will stop the counterMeasure duration. -* -* \param[in] prSta Pointer to the Sta record -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -VOID -secFsmEventEndOfCounterMeasure ( - IN P_ADAPTER_T prAdapter, - UINT_32 u4Parm - ) -{ - P_STA_RECORD_T prSta; - P_SEC_INFO_T prSecInfo; - ENUM_SEC_STATE_T eNextState; - BOOLEAN fgIsTransition = (BOOLEAN)FALSE; - - DEBUGFUNC("secFsmRunEventEndOfCounterMeasure"); - - prSta = (P_STA_RECORD_T)u4Parm; - - ASSERT(prSta); - - if (!IS_STA_IN_AIS(prSta)) { - DBGLOG(RSN, INFO, ("Counter Measure should occur at AIS network!!\n")); - //ASSERT(0); - return; - } - - prSecInfo = &prSta->rSecInfo; - eNextState = prSecInfo->eCurrentState; - -#if DBG - DBGLOG(RSN, TRACE, (MACSTR " Sec state %s\n", MAC2STR(prSta->aucMacAddr), - apucDebugSecState[prSecInfo->eCurrentState])); -#else - DBGLOG(RSN, TRACE, (MACSTR " Sec state [%d]\n", MAC2STR(prSta->aucMacAddr), prSecInfo->eCurrentState)); -#endif - - switch(prSecInfo->eCurrentState) { - case SEC_STATE_SEND_DEAUTH: - { - prAdapter->rWifiVar.rAisSpecificBssInfo.fgCounterMeasure = FALSE; - - SEC_STATE_TRANSITION(prAdapter, prSta, COUNTERMEASURE, INIT); - } - break; - - default: - ASSERT(0); - } - - /* Call arbFsmSteps() when we are going to change ARB STATE */ - if (prSecInfo->eCurrentState != eNextState) { - secFsmSteps(prAdapter, prSta, eNextState); - } - - return; -}/* end of secFsmRunEventEndOfCounterMeasure */ -#endif diff --git a/drivers/net/wireless/mt5931/mgmt/swcr.c b/drivers/net/wireless/mt5931/mgmt/swcr.c deleted file mode 100755 index 0a65bb0b579f..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/swcr.c +++ /dev/null @@ -1,1268 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/swcr.c#1 $ -*/ - -/*! \file "swcr.c" - \brief - -*/ - - - -/* -** $Log: swcr.c $ - * - * 06 04 2012 tsaiyuan.hsu - * [WCXRP00001249] [ALPS.ICS] Daily build warning on "wlan/mgmt/swcr.c#1" - * resolve build waring for "WNM_UNIT_TEST not defined". - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 01 05 2012 tsaiyuan.hsu - * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v - * add timing measurement support for 802.11v. - * - * 11 22 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * keep debug counter setting after wake up. - * - * 11 15 2011 cm.chang - * NULL - * Fix compiling warning - * - * 11 11 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * fix debug counters of rx in driver. - * - * 11 11 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * add debug counters of bb and ar for xlog. - * - * 11 10 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Modify the QM xlog level and remove LOG_FUNC. - * - * 11 08 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * add debug counters, eCurPsProf, for PS. - * - * 11 07 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * add debug counters and periodically dump counters for debugging. - * - * 11 03 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * change the DBGLOG for "\n" and "\r\n". LABEL to LOUD for XLOG - * - * 08 31 2011 tsaiyuan.hsu - * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver - * remove obsolete code. - * - * 08 15 2011 tsaiyuan.hsu - * [WCXRP00000931] [MT5931 Wi-Fi][DRV/FW] add swcr to disable roaming from driver - * add swcr in driver reg, 0x9fxx0000, to disable roaming . - * - * 05 11 2011 eddie.chen - * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet - * Fix dest type when GO packet copying. - * - * 05 09 2011 eddie.chen - * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet - * Check free number before copying broadcast packet. - * - * 04 14 2011 eddie.chen - * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning - * Check the SW RFB free. Fix the compile warning.. - * - * 04 12 2011 eddie.chen - * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma - * Fix the sta index in processing security frame - * Simple flow control for TC4 to avoid mgt frames for PS STA to occupy the TC4 - * Add debug message. - * - * 03 28 2011 eddie.chen - * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning - * Fix Klockwork warning. - * - * 03 15 2011 eddie.chen - * [WCXRP00000554] [MT6620 Wi-Fi][DRV] Add sw control debug counter - * Add sw debug counter for QM. - * - * 01 11 2011 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, -Add per station flow control when STA is in PS - - * Add swcr for test. - * -* -*/ - - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -#if CFG_SUPPORT_SWCR - -#ifdef __GNUC__ -#pragma GCC diagnostic ignored "-Wformat" -#endif -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ -#if 0 -extern SWCR_MAP_ENTRY_T g_arRlmArSwCrMap[]; -SWCR_MOD_MAP_ENTRY_T g_arSwCrAllMaps[] = { - { SWCR_MAP_NUM(g_arRlmArSwCrMap), g_arRlmArSwCrMap}, /* 0x00nn */ - {0,NULL} -}; -#endif - -VOID swCtrlCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1); -VOID swCtrlCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1); -VOID testPsCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1); -VOID testPsCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1); -void testWNMCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1); -VOID swCtrlSwCr(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data); - -/* Support Debug */ -VOID swCrDebugCheck(P_ADAPTER_T prAdapter, P_CMD_SW_DBG_CTRL_T prCmdSwCtrl); -VOID swCrDebugCheckTimeout( - IN P_ADAPTER_T prAdapter, - UINT_32 u4Param); -VOID swCrDebugQuery( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ); -VOID swCrDebugQueryTimeout( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo); - -UINT_32 g_au4SwCr[SWCR_CR_NUM]; /*: 0: command other: data */ - -/* JB mDNS Filter*/ -UINT_32 g_u4mDNSRXFilter = 0; /* [31] 0: stop 1: start, [3] IPv6 [2] IPv4*/ - -static TIMER_T g_rSwcrDebugTimer; -static BOOLEAN g_fgSwcrDebugTimer = FALSE; -static UINT_32 g_u4SwcrDebugCheckTimeout = 0; -static ENUM_SWCR_DBG_TYPE_T g_ucSwcrDebugCheckType = 0; -static UINT_32 g_u4SwcrDebugFrameDumpType = 0; - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ -#define TEST_PS 1 - -const static PFN_CMD_RW_T g_arSwCtrlCmd[] ={ - swCtrlCmdCategory0, - swCtrlCmdCategory1 -#if TEST_PS - , testPsCmdCategory0 - , testPsCmdCategory1 -#endif -#if CFG_SUPPORT_802_11V -#if (CFG_SUPPORT_802_11V_TIMING_MEASUREMENT ==1) && (WNM_UNIT_TEST ==1) - , testWNMCmdCategory0 -#endif -#endif -}; - - -const PFN_SWCR_RW_T g_arSwCrModHandle[] = { - swCtrlSwCr, - NULL -}; - - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -enum { - SWCTRL_MAGIC, - SWCTRL_DEBUG, - SWCTRL_WIFI_VAR, - SWCTRL_ENABLE_INT, - SWCTRL_DISABLE_INT, - SWCTRL_TXM_INFO, - SWCTRL_RXM_INFO, - SWCTRL_DUMP_BSS, - SWCTRL_QM_INFO, - SWCTRL_DUMP_ALL_QUEUE_LEN, - SWCTRL_DUMP_MEM, - SWCTRL_TX_CTRL_INFO, - SWCTRL_DUMP_QUEUE, - SWCTRL_DUMP_QM_DBG_CNT, - SWCTRL_QM_DBG_CNT, - SWCTRL_RX_PKTS_DUMP, - SWCTRL_RX_MDNS_FILTER, - SWCTRL_CATA0_INDEX_NUM -}; - -enum { - SWCTRL_STA_INFO, - SWCTRL_DUMP_STA, - SWCTRL_STA_QUE_INFO, - SWCTRL_CATA1_INDEX_NUM -}; - -/* JB mDNS Filter*/ -#define RX_MDNS_FILTER_START (1<<31) -#define RX_MDNS_FILTER_IPV4 (1<<2) -#define RX_MDNS_FILTER_IPV6 (1<<3) -typedef enum _ENUM_SWCR_RX_MDNS_FILTER_CMD_T { - SWCR_RX_MDNS_FILTER_CMD_STOP = 0, - SWCR_RX_MDNS_FILTER_CMD_START, - SWCR_RX_MDNS_FILTER_CMD_ADD, - SWCR_RX_MDNS_FILTER_CMD_REMOVE, - SWCR_RX_MDNS_FILTER_NUM -} ENUM_SWCR_RX_MDNS_FILTER_CMD_T; - -#if TEST_PS -enum { - TEST_PS_MAGIC, - TEST_PS_SETUP_BSS, - TEST_PS_ENABLE_BEACON, - TEST_PS_TRIGGER_BMC, - TEST_PS_SEND_NULL, - TEST_PS_BUFFER_BMC, - TEST_PS_UPDATE_BEACON, - TEST_PS_CATA0_INDEX_NUM -}; - -enum { - TEST_PS_STA_PS, - TEST_PS_STA_ENTER_PS, - TEST_PS_STA_EXIT_PS, - TEST_PS_STA_TRIGGER_PSPOLL, - TEST_PS_STA_TRIGGER_FRAME, - TEST_PS_CATA1_INDEX_NUM -}; -#endif - -#if CFG_SUPPORT_802_11V -#if WNM_UNIT_TEST -enum { - TEST_WNM_TIMING_MEAS, - TEST_WNM_CATA0_INDEX_NUM -}; -#endif -#endif - - -#define _SWCTRL_MAGIC 0x66201642 - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -void dumpQueue(P_ADAPTER_T prAdapter) -{ - - P_TX_CTRL_T prTxCtrl; - P_QUE_MGT_T prQM; - P_GLUE_INFO_T prGlueInfo; - UINT_32 i; - UINT_32 j; - - - DEBUGFUNC("dumpQueue"); - - prTxCtrl = &prAdapter->rTxCtrl; - prQM = &prAdapter->rQM; - prGlueInfo = prAdapter->prGlueInfo; - - for(i = TC0_INDEX; i<=TC5_INDEX; i++) { - DBGLOG(SW4, INFO,( "TC %u\n",i)); - DBGLOG(SW4, INFO,( "Max %u Free %u\n", - prTxCtrl->rTc.aucMaxNumOfBuffer[i], prTxCtrl->rTc.aucFreeBufferCount[i])); - - DBGLOG(SW4, INFO,("Average %u minReserved %u CurrentTcResource %u GuaranteedTcResource %u\n", - QM_GET_TX_QUEUE_LEN(prAdapter, i), - prQM->au4MinReservedTcResource[i], - prQM->au4CurrentTcResource[i], - prQM->au4GuaranteedTcResource[i])); - - } - - - for(i = 0; iau4HeadStaRecIndex[i],prQM->au4ForwardCount[i])); - } - - DBGLOG(SW4, INFO,( "BMC or unknown TxQueue Len %u\n",prQM->arTxQueue[0].u4NumElem)); - DBGLOG(SW4, INFO,( "Pending %d\n",prGlueInfo->i4TxPendingFrameNum)); - DBGLOG(SW4, INFO,( "Pending Security %d\n",prGlueInfo->i4TxPendingSecurityFrameNum)); -#if defined(LINUX) - for(i=0;i<4;i++){ - for(j=0;jai4TxPendingFrameNumPerQueue[i][j])); - } - } -#endif - - DBGLOG(SW4, INFO,( " rFreeSwRfbList %u\n", prAdapter->rRxCtrl.rFreeSwRfbList.u4NumElem)); - DBGLOG(SW4, INFO,( " rReceivedRfbList %u\n", prAdapter->rRxCtrl.rReceivedRfbList.u4NumElem)); - DBGLOG(SW4, INFO,( " rIndicatedRfbList %u\n", prAdapter->rRxCtrl.rIndicatedRfbList.u4NumElem)); - DBGLOG(SW4, INFO,( " ucNumIndPacket %u\n", prAdapter->rRxCtrl.ucNumIndPacket)); - DBGLOG(SW4, INFO,( " ucNumRetainedPacket %u\n", prAdapter->rRxCtrl.ucNumRetainedPacket)); - - -} - - -void dumpSTA(P_ADAPTER_T prAdapter, P_STA_RECORD_T prStaRec) -{ - UINT_8 ucWTEntry; - UINT_32 i; - P_BSS_INFO_T prBssInfo; - - DEBUGFUNC("dumpSTA"); - - ASSERT(prStaRec); - ucWTEntry = prStaRec->ucWTEntry; - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]; - ASSERT(prBssInfo); - - DBGLOG(SW4, INFO,("Mac address: " MACSTR " Rcpi %u" "\n", MAC2STR(prStaRec->aucMacAddr),prStaRec->ucRCPI)); - - DBGLOG(SW4, INFO,("Idx %u Wtbl %u Used %u State %u Bss Phy 0x%x Sta DesiredPhy 0x%x\n", - prStaRec->ucIndex, ucWTEntry, - prStaRec->fgIsInUse,prStaRec->ucStaState, - prBssInfo->ucPhyTypeSet, - prStaRec->ucDesiredPhyTypeSet)); - - DBGLOG(SW4, INFO,("Sta Operation 0x%x DesiredNontHtRateSet 0x%x Mcs 0x%x u2HtCapInfo 0x%x\n", - prStaRec->u2OperationalRateSet,prStaRec->u2DesiredNonHTRateSet,prStaRec->ucMcsSet, prStaRec->u2HtCapInfo)); - - - for(i = 0; iarTxQueue[i].u4NumElem)); - } - - DBGLOG(SW4, INFO, ("BmpDeliveryAC %x\n",prStaRec->ucBmpDeliveryAC)); - DBGLOG(SW4, INFO, ("BmpTriggerAC %x\n",prStaRec->ucBmpTriggerAC)); - DBGLOG(SW4, INFO, ("UapsdSpSupproted %u\n",prStaRec->fgIsUapsdSupported)); - DBGLOG(SW4, INFO, ("IsQoS %u\n",prStaRec->fgIsQoS)); - DBGLOG(SW4, INFO, ("AssocId %u\n",prStaRec->u2AssocId)); - - DBGLOG(SW4, INFO, ("fgIsInPS %u\n",prStaRec->fgIsInPS)); - DBGLOG(SW4, INFO, ("ucFreeQuota %u\n",prStaRec->ucFreeQuota)); - DBGLOG(SW4, INFO, ("ucFreeQuotaForDelivery %u\n",prStaRec->ucFreeQuotaForDelivery)); - DBGLOG(SW4, INFO, ("ucFreeQuotaForNonDelivery %u\n",prStaRec->ucFreeQuotaForNonDelivery)); - - -#if 0 - DBGLOG(SW4, INFO, ("IsQmmSup %u\n",prStaRec->fgIsWmmSupported)); - DBGLOG(SW4, INFO, ("IsUapsdSup %u\n",prStaRec->fgIsUapsdSupported)); - DBGLOG(SW4, INFO, ("AvailabaleDeliverPkts %u\n",prStaRec->ucAvailableDeliverPkts)); - DBGLOG(SW4, INFO, ("BmpDeliverPktsAC %u\n",prStaRec->u4BmpDeliverPktsAC)); - DBGLOG(SW4, INFO, ("BmpBufferAC %u\n",prStaRec->u4BmpBufferAC)); - DBGLOG(SW4, INFO, ("BmpNonDeliverPktsAC %u\n",prStaRec->u4BmpNonDeliverPktsAC)); -#endif - - for(i=0;iaprRxReorderParamRefTbl[i]){ - DBGLOG(SW4, INFO,("RxReorder fgIsValid: %u\n",prStaRec->aprRxReorderParamRefTbl[i]->fgIsValid)); - DBGLOG(SW4, INFO,("RxReorder Tid: %u\n",prStaRec->aprRxReorderParamRefTbl[i]->ucTid)); - DBGLOG(SW4, INFO,("RxReorder rReOrderQue Len: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->rReOrderQue.u4NumElem)); - DBGLOG(SW4, INFO,("RxReorder WinStart: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinStart)); - DBGLOG(SW4, INFO,("RxReorder WinEnd: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinEnd)); - DBGLOG(SW4, INFO,("RxReorder WinSize: %u\n", prStaRec->aprRxReorderParamRefTbl[i]->u2WinSize)); - } - } - -} - - -VOID dumpBss(P_ADAPTER_T prAdapter, P_BSS_INFO_T prBssInfo) -{ - - DBGLOG(SW4, INFO, ("SSID %s\n",prBssInfo->aucSSID)); - DBGLOG(SW4, INFO, ("OWN " MACSTR"\n",MAC2STR(prBssInfo->aucOwnMacAddr))); - DBGLOG(SW4, INFO, ("BSSID " MACSTR"\n",MAC2STR(prBssInfo->aucBSSID))); - DBGLOG(SW4, INFO, ("ucNetTypeIndex %u\n",prBssInfo->ucNetTypeIndex)); - DBGLOG(SW4, INFO, ("eConnectionState %u\n",prBssInfo->eConnectionState)); - DBGLOG(SW4, INFO, ("eCurrentOPMode %u\n",prBssInfo->eCurrentOPMode)); - DBGLOG(SW4, INFO, ("fgIsQBSS %u\n",prBssInfo->fgIsQBSS)); - DBGLOG(SW4, INFO, ("fgIsShortPreambleAllowed %u\n",prBssInfo->fgIsShortPreambleAllowed)); - DBGLOG(SW4, INFO, ("fgUseShortPreamble %u\n",prBssInfo->fgUseShortPreamble)); - DBGLOG(SW4, INFO, ("fgUseShortSlotTime %u\n",prBssInfo->fgUseShortSlotTime)); - DBGLOG(SW4, INFO, ("ucNonHTBasicPhyType %x\n",prBssInfo->ucNonHTBasicPhyType)); - DBGLOG(SW4, INFO, ("u2OperationalRateSet %x\n",prBssInfo->u2OperationalRateSet)); - DBGLOG(SW4, INFO, ("u2BSSBasicRateSet %x\n",prBssInfo->u2BSSBasicRateSet)); - DBGLOG(SW4, INFO, ("ucPhyTypeSet %x\n",prBssInfo->ucPhyTypeSet)); - DBGLOG(SW4, INFO, ("rStaRecOfClientList %d\n",prBssInfo->rStaRecOfClientList.u4NumElem)); - DBGLOG(SW4, INFO, ("u2CapInfo %x\n",prBssInfo->u2CapInfo)); - DBGLOG(SW4, INFO, ("u2ATIMWindow %x\n",prBssInfo->u2ATIMWindow)); - DBGLOG(SW4, INFO, ("u2AssocId %x\n",prBssInfo->u2AssocId)); - DBGLOG(SW4, INFO, ("ucDTIMPeriod %x\n",prBssInfo->ucDTIMPeriod)); - DBGLOG(SW4, INFO, ("ucDTIMCount %x\n",prBssInfo->ucDTIMCount)); - DBGLOG(SW4, INFO, ("fgIsNetAbsent %x\n", prBssInfo->fgIsNetAbsent)); - DBGLOG(SW4, INFO, ("eBand %d\n", prBssInfo->eBand)); - DBGLOG(SW4, INFO, ("ucPrimaryChannel %d\n", prBssInfo->ucPrimaryChannel)); - DBGLOG(SW4, INFO, ("ucHtOpInfo1 %d\n", prBssInfo->ucHtOpInfo1)); - DBGLOG(SW4, INFO, ("ucHtOpInfo2 %d\n", prBssInfo->u2HtOpInfo2)); - DBGLOG(SW4, INFO, ("ucHtOpInfo3 %d\n", prBssInfo->u2HtOpInfo3)); - DBGLOG(SW4, INFO, ("fgErpProtectMode %d\n", prBssInfo->fgErpProtectMode)); - DBGLOG(SW4, INFO, ("eHtProtectMode %d\n", prBssInfo->eHtProtectMode)); - DBGLOG(SW4, INFO, ("eGfOperationMode %d\n", prBssInfo->eGfOperationMode)); - DBGLOG(SW4, INFO, ("eRifsOperationMode %d\n", prBssInfo->eRifsOperationMode)); - DBGLOG(SW4, INFO, ("fgObssErpProtectMode %d\n", prBssInfo->fgObssErpProtectMode)); - DBGLOG(SW4, INFO, ("eObssHtProtectMode %d\n", prBssInfo->eObssHtProtectMode)); - DBGLOG(SW4, INFO, ("eObssGfProtectMode %d\n", prBssInfo->eObssGfOperationMode)); - DBGLOG(SW4, INFO, ("fgObssRifsOperationMode %d\n", prBssInfo->fgObssRifsOperationMode)); - DBGLOG(SW4, INFO, ("fgAssoc40mBwAllowed %d\n", prBssInfo->fgAssoc40mBwAllowed)); - DBGLOG(SW4, INFO, ("fg40mBwAllowed %d\n", prBssInfo->fg40mBwAllowed)); - DBGLOG(SW4, INFO, ("eBssSCO %d\n", prBssInfo->eBssSCO)); - - -} - - - -VOID swCtrlCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1) -{ - UINT_8 ucIndex,ucRead; - UINT_32 i; - - DEBUGFUNC("swCtrlCmdCategory0"); - - SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex); - - i=0; - - if(ucIndex>=SWCTRL_CATA0_INDEX_NUM) return; - - if(ucRead == SWCR_WRITE) { - switch(ucIndex) { - case SWCTRL_DEBUG: -#if DBG - aucDebugModule[ucOpt0] = (UINT_8)g_au4SwCr[1]; -#endif - break; - case SWCTRL_WIFI_VAR: - break; - -#if QM_DEBUG_COUNTER - case SWCTRL_DUMP_QM_DBG_CNT: - for(i=0;irQM.au4QmDebugCounters[i] = 0; - } - break; - case SWCTRL_QM_DBG_CNT: - prAdapter->rQM.au4QmDebugCounters[ucOpt0] = g_au4SwCr[1]; - - break; -#endif -#if CFG_RX_PKTS_DUMP - case SWCTRL_RX_PKTS_DUMP: - //DBGLOG(SW4, INFO,("SWCTRL_RX_PKTS_DUMP: mask %x\n", g_au4SwCr[1])); - prAdapter->rRxCtrl.u4RxPktsDumpTypeMask = g_au4SwCr[1]; - break; -#endif - case SWCTRL_RX_MDNS_FILTER: - { - UINT_32 u4rxfilter; - BOOLEAN fgUpdate = FALSE; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - - if (ucOpt0 == SWCR_RX_MDNS_FILTER_CMD_STOP) { - g_u4mDNSRXFilter &= ~(RX_MDNS_FILTER_START); - - u4rxfilter = prAdapter->u4OsPacketFilter; - fgUpdate = TRUE; - } - else if (ucOpt0 == SWCR_RX_MDNS_FILTER_CMD_START) { - g_u4mDNSRXFilter |= (RX_MDNS_FILTER_START); - - u4rxfilter = prAdapter->u4OsPacketFilter; - if ((g_u4mDNSRXFilter & RX_MDNS_FILTER_IPV4) && - (g_u4mDNSRXFilter & RX_MDNS_FILTER_IPV6)) { - u4rxfilter &= ~(PARAM_PACKET_FILTER_ALL_MULTICAST| - PARAM_PACKET_FILTER_MULTICAST); - } - else { - u4rxfilter |= PARAM_PACKET_FILTER_ALL_MULTICAST; - } - fgUpdate = TRUE; - } - else if (ucOpt0 == SWCR_RX_MDNS_FILTER_CMD_ADD) { - if (ucOpt1 < 31) { - g_u4mDNSRXFilter |= (1<rQM; - switch(ucOpt0) { - case 0: - g_au4SwCr[1] = (QM_GET_TX_QUEUE_LEN(prAdapter, ucOpt1)) ; - g_au4SwCr[2] = prQM->au4MinReservedTcResource[ucOpt1] ; - g_au4SwCr[3] = prQM->au4CurrentTcResource[ucOpt1]; - g_au4SwCr[4] = prQM->au4GuaranteedTcResource[ucOpt1]; - break; - - case 1: - g_au4SwCr[1] = prQM->au4ForwardCount[ucOpt1]; - g_au4SwCr[2] = prQM->au4HeadStaRecIndex[ucOpt1]; - break; - - case 2: - g_au4SwCr[1] = prQM->arTxQueue[ucOpt1].u4NumElem; /* only one */ - - - break; - } - - } - case SWCTRL_TX_CTRL_INFO: - { - P_TX_CTRL_T prTxCtrl; - prTxCtrl = &prAdapter->rTxCtrl; - switch(ucOpt0) { - case 0: - g_au4SwCr[1] = prAdapter->rTxCtrl.rTc.aucFreeBufferCount[ucOpt1]; - g_au4SwCr[2] = prAdapter->rTxCtrl.rTc.aucMaxNumOfBuffer[ucOpt1]; - break; - } - - } - break; - case SWCTRL_DUMP_QUEUE: - dumpQueue(prAdapter); - - break; -#if QM_DEBUG_COUNTER - case SWCTRL_DUMP_QM_DBG_CNT: - for(i=0;irQM.au4QmDebugCounters[i])); - } - break; - - case SWCTRL_QM_DBG_CNT: - g_au4SwCr[1] = prAdapter->rQM.au4QmDebugCounters[ucOpt0]; - break; -#endif - case SWCTRL_DUMP_BSS: - { - dumpBss(prAdapter, &(prAdapter->rWifiVar.arBssInfo[ucOpt0])) ; - } - break; - - default: - break; - } - - } -} - - -VOID swCtrlCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1) -{ - UINT_8 ucIndex,ucRead; - UINT_8 ucWTEntry; - P_STA_RECORD_T prStaRec; - - DEBUGFUNC("swCtrlCmdCategory1"); - - SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex); - - if(ucOpt0>=CFG_STA_REC_NUM) return; - - //prStaRec = cnmGetStaRecByIndex (prAdapter, ucOpt0); - prStaRec = &prAdapter->arStaRec[ucOpt0]; - ucWTEntry = prStaRec->ucWTEntry; - if(ucRead == SWCR_WRITE) { - } - else { - /* Read */ - switch(ucIndex) { - case SWCTRL_STA_QUE_INFO: - { - g_au4SwCr[1] = prStaRec->arTxQueue[ucOpt1].u4NumElem; - } - break; - case SWCTRL_STA_INFO: - switch(ucOpt1) { - case 0: - g_au4SwCr[1] = prStaRec->fgIsInPS; - break; - } - - break; - - case SWCTRL_DUMP_STA: - { - dumpSTA(prAdapter, prStaRec); - } - break; - - default: - - break; - } - } - - -} - -#if TEST_PS - -VOID -testPsSendQoSNullFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN UINT_8 ucUP, - IN UINT_8 ucNetTypeIndex, - IN BOOLEAN fgBMC, - IN BOOLEAN fgIsBurstEnd, - IN BOOLEAN ucPacketType, - IN BOOLEAN ucPsSessionID, - IN BOOLEAN fgSetEOSP - ) -{ - P_MSDU_INFO_T prMsduInfo; - UINT_16 u2EstimatedFrameLen; - P_WLAN_MAC_HEADER_QOS_T prQoSNullFrame; - - - DEBUGFUNC("testPsSendQoSNullFrame"); - DBGLOG(SW4, LOUD, ("\n")); - - //4 <1> Allocate a PKT_INFO_T for Null Frame - /* Init with MGMT Header Length */ - u2EstimatedFrameLen = MAC_TX_RESERVED_FIELD + \ - WLAN_MAC_HEADER_QOS_LEN; - - /* Allocate a MSDU_INFO_T */ - if ( (prMsduInfo = cnmMgtPktAlloc(prAdapter, u2EstimatedFrameLen)) == NULL) { - DBGLOG(SW4, WARN, ("No PKT_INFO_T for sending Null Frame.\n")); - return ; - } - - //4 <2> Compose Null frame in MSDU_INfO_T. - bssComposeQoSNullFrame(prAdapter, - (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD), - prStaRec, - ucUP, - fgSetEOSP); - - - prMsduInfo->eSrc = TX_PACKET_MGMT; - //prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_DATA; - prMsduInfo->ucPacketType = ucPacketType; - prMsduInfo->ucStaRecIndex = prStaRec->ucIndex; - prMsduInfo->ucNetworkType = ucNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_HEADER_QOS_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = WLAN_MAC_HEADER_QOS_LEN; - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = NULL; - prMsduInfo->fgIsBasicRate = TRUE; - prMsduInfo->fgIsBurstEnd = fgIsBurstEnd; - prMsduInfo->ucUserPriority = ucUP; - prMsduInfo->ucPsSessionID = ucPsSessionID /* 0~7 Test 7 means NOACK*/; - - prQoSNullFrame = (P_WLAN_MAC_HEADER_QOS_T)( (PUINT_8)((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD) ); - - if(fgBMC) { - prQoSNullFrame->aucAddr1[0] = 0xfd; - } - else { - prQoSNullFrame->aucAddr1[5] = 0xdd; - } - - //4 <4> Inform TXM to send this Null frame. - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - -} - - - -VOID -testPsSetupBss( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucNetworkTypeIndex - ) -{ - P_BSS_INFO_T prBssInfo; - UINT_8 _aucZeroMacAddr[] = NULL_MAC_ADDR; - - DEBUGFUNC("testPsSetupBss()"); - DBGLOG(SW4, INFO, ("index %d\n", ucNetworkTypeIndex)); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[ucNetworkTypeIndex]); - - //4 <1.2> Initiate PWR STATE - //SET_NET_PWR_STATE_IDLE(prAdapter, ucNetworkTypeIndex); - - - //4 <2> Initiate BSS_INFO_T - common part - BSS_INFO_INIT(prAdapter, ucNetworkTypeIndex); - - prBssInfo->eConnectionState = PARAM_MEDIA_STATE_DISCONNECTED; - prBssInfo->eConnectionStateIndicated = PARAM_MEDIA_STATE_DISCONNECTED; - prBssInfo->eCurrentOPMode = OP_MODE_ACCESS_POINT; - prBssInfo->fgIsNetActive = TRUE; - prBssInfo->ucNetTypeIndex = (ucNetworkTypeIndex); - prBssInfo->ucReasonOfDisconnect = DISCONNECT_REASON_CODE_RESERVED; - - prBssInfo->ucPhyTypeSet = PHY_TYPE_SET_802_11BG; /* Depend on eBand */ - prBssInfo->ucConfigAdHocAPMode = AP_MODE_MIXED_11BG; /* Depend on eCurrentOPMode and ucPhyTypeSet */ - prBssInfo->u2BSSBasicRateSet = RATE_SET_ERP; - prBssInfo->u2OperationalRateSet = RATE_SET_OFDM; - prBssInfo->fgErpProtectMode = FALSE; - prBssInfo->fgIsQBSS = TRUE; - - //4 <1.5> Setup MIB for current BSS - prBssInfo->u2BeaconInterval = 100; - prBssInfo->ucDTIMPeriod = DOT11_DTIM_PERIOD_DEFAULT; - prBssInfo->u2ATIMWindow = 0; - - prBssInfo->ucBeaconTimeoutCount = 0; - - - bssInitForAP (prAdapter,prBssInfo, TRUE); - - COPY_MAC_ADDR(prBssInfo->aucBSSID, _aucZeroMacAddr); - LINK_INITIALIZE(&prBssInfo->rStaRecOfClientList); - prBssInfo->fgIsBeaconActivated = TRUE; - prBssInfo->ucHwDefaultFixedRateCode = RATE_CCK_1M_LONG; - - - COPY_MAC_ADDR(prBssInfo->aucOwnMacAddr, prAdapter->rWifiVar.aucMacAddress); - - //4 <3> Initiate BSS_INFO_T - private part - /* TODO */ - prBssInfo->eBand = BAND_2G4; - prBssInfo->ucPrimaryChannel = 1; - prBssInfo->prStaRecOfAP = (P_STA_RECORD_T)NULL; - - - //prBssInfo->fgErpProtectMode = eErpProectMode; - //prBssInfo->eHtProtectMode = eHtProtectMode; - //prBssInfo->eGfOperationMode = eGfOperationMode; - - - //4 <4> Allocate MSDU_INFO_T for Beacon - prBssInfo->prBeacon = cnmMgtPktAlloc(prAdapter, - OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem[0]) + MAX_IE_LENGTH); - - if (prBssInfo->prBeacon) { - prBssInfo->prBeacon->eSrc = TX_PACKET_MGMT; - prBssInfo->prBeacon->ucNetworkType = ucNetworkTypeIndex; - } - else { - DBGLOG(SW4, INFO, ("prBeacon allocation fail\n")); - } - -#if 0 - prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = PM_UAPSD_ALL; - prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC = PM_UAPSD_ALL; - prBssInfo->rPmProfSetupInfo.ucUapsdSp = WMM_MAX_SP_LENGTH_2; -#else - prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC = (UINT_8)prAdapter->u4UapsdAcBmp; - prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC =(UINT_8) prAdapter->u4UapsdAcBmp; - prBssInfo->rPmProfSetupInfo.ucUapsdSp = (UINT_8)prAdapter->u4MaxSpLen; -#endif - -#if 0 - for(eAci = 0; eAci < WMM_AC_INDEX_NUM; eAci++){ - - prBssInfo->arACQueParms[eAci].fgIsACMSet = FALSE; - prBssInfo->arACQueParms[eAci].u2Aifsn = (UINT_16) eAci; - prBssInfo->arACQueParms[eAci].u2CWmin = 7; - prBssInfo->arACQueParms[eAci].u2CWmax = 31; - prBssInfo->arACQueParms[eAci].u2TxopLimit = eAci+1; - DBGLOG(SW4, INFO, ("MQM: eAci = %d, ACM = %d, Aifsn = %d, CWmin = %d, CWmax = %d, TxopLimit = %d\n", - eAci,prBssInfo->arACQueParms[eAci].fgIsACMSet , - prBssInfo->arACQueParms[eAci].u2Aifsn, - prBssInfo->arACQueParms[eAci].u2CWmin, - prBssInfo->arACQueParms[eAci].u2CWmax, - prBssInfo->arACQueParms[eAci].u2TxopLimit)); - - } -#endif - - - DBGLOG(SW4, INFO, ("[2] ucBmpDeliveryAC:0x%x, ucBmpTriggerAC:0x%x, ucUapsdSp:0x%x", - prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC, - prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC, - prBssInfo->rPmProfSetupInfo.ucUapsdSp)); - - return; -} - - - - -VOID testPsCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1) -{ - UINT_8 ucIndex,ucRead; - P_STA_RECORD_T prStaRec; - - DEBUGFUNC("testPsCmdCategory0"); - SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex); - - DBGLOG(SW4, LOUD, ("Read %u Index %u\n",ucRead,ucIndex)); - - prStaRec = cnmGetStaRecByIndex (prAdapter, 0); - - if(ucIndex>=TEST_PS_CATA0_INDEX_NUM) return; - - if(ucRead == SWCR_WRITE) { - switch(ucIndex) { - case TEST_PS_SETUP_BSS: - testPsSetupBss(prAdapter, ucOpt0) ; - break; - - case TEST_PS_ENABLE_BEACON: - break; - - case TEST_PS_TRIGGER_BMC: - //txmForwardQueuedBmcPkts (ucOpt0); - break; - case TEST_PS_SEND_NULL: - { - - testPsSendQoSNullFrame (prAdapter,prStaRec, - (UINT_8)(g_au4SwCr[1] & 0xFF), /* UP */ - ucOpt0, - (BOOLEAN)((g_au4SwCr[1] >>8)& 0xFF), /* BMC*/ - (BOOLEAN)((g_au4SwCr[1] >>16)& 0xFF), /* BurstEnd*/ - (BOOLEAN)((g_au4SwCr[1] >>24)& 0xFF), /* Packet type*/ - (UINT_8)((g_au4SwCr[2] )& 0xFF), /* PS sesson ID 7: NOACK */ - FALSE /* EOSP */ - ); - } - break; - case TEST_PS_BUFFER_BMC: - //g_aprBssInfo[ucOpt0]->fgApToBufferBMC = (g_au4SwCr[1] & 0xFF); - break; - case TEST_PS_UPDATE_BEACON: - bssUpdateBeaconContent(prAdapter, ucOpt0 /*networktype*/ ); - break; - - default: - break; - } - } - else { - switch(ucIndex) { - - case TEST_PS_MAGIC: - g_au4SwCr[1] = 0x88660011 ; - break; - - } - } -} - -#endif //TEST_PS - -#if TEST_PS - -VOID testPsCmdCategory1(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1) -{ - UINT_8 ucIndex,ucRead; - UINT_8 ucWTEntry; - P_STA_RECORD_T prStaRec; - - DEBUGFUNC("testPsCmdCategory1"); - - SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex); - - if(ucOpt0>=CFG_STA_REC_NUM) return; - - prStaRec = cnmGetStaRecByIndex (prAdapter, ucOpt0); - ucWTEntry = prStaRec->ucWTEntry; - if(ucRead == SWCR_WRITE) { - - switch(ucIndex) { - case TEST_PS_STA_PS: - prStaRec->fgIsInPS = (BOOLEAN) (g_au4SwCr[1] & 0x1); - prStaRec->fgIsQoS = (BOOLEAN) (g_au4SwCr[1] >>8 & 0xFF); - prStaRec->fgIsUapsdSupported = (BOOLEAN) (g_au4SwCr[1] >>16 & 0xFF); - prStaRec->ucBmpDeliveryAC = (BOOLEAN) (g_au4SwCr[1] >>24 & 0xFF); - break; - - } - - } - else { - /* Read */ - switch(ucIndex) { - default: - break; - } - } - - -} - -#endif //TEST_PS - -#if CFG_SUPPORT_802_11V -#if (CFG_SUPPORT_802_11V_TIMING_MEASUREMENT ==1) && (WNM_UNIT_TEST ==1) -VOID testWNMCmdCategory0(P_ADAPTER_T prAdapter, UINT_8 ucCate, UINT_8 ucAction, UINT_8 ucOpt0,UINT_8 ucOpt1) -{ - UINT_8 ucIndex,ucRead; - P_STA_RECORD_T prStaRec; - - DEBUGFUNC("testWNMCmdCategory0"); - SWCR_GET_RW_INDEX(ucAction,ucRead,ucIndex); - - DBGLOG(SW4, INFO, ("Read %u Index %u\n",ucRead,ucIndex)); - - if(ucIndex>=TEST_WNM_CATA0_INDEX_NUM) return; - - if(ucRead == SWCR_WRITE) { - switch(ucIndex) { - case TEST_WNM_TIMING_MEAS: - wnmTimingMeasUnitTest1(prAdapter, ucOpt0) ; - break; - - default: - break; - } - } -} -#endif //TEST_WNM -#endif //CFG_SUPPORT_802_11V - -VOID swCtrlSwCr(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data) -{ - /* According other register STAIDX */ - UINT_8 ucOffset; - ucOffset = (u2Addr>>2) & 0x3F; - - if(ucOffset>= SWCR_CR_NUM) return; - - if(ucRead==SWCR_WRITE) { - g_au4SwCr[ucOffset] = *pu4Data; - if(ucOffset==0x0) { - /* Commmand [31:24]: Category */ - /* Commmand [23:23]: 1(W) 0(R) */ - /* Commmand [22:16]: Index */ - /* Commmand [15:08]: Option0 */ - /* Commmand [07:00]: Option1 */ - UINT_8 ucCate; - UINT_32 u4Cmd; - u4Cmd = g_au4SwCr[0]; - ucCate = (UINT_8)(u4Cmd >> 24) ; - if(ucCate < sizeof(g_arSwCtrlCmd)/sizeof(g_arSwCtrlCmd[0])) { - if(g_arSwCtrlCmd[ucCate]!=NULL) { - g_arSwCtrlCmd[ucCate](prAdapter, ucCate, (UINT_8)(u4Cmd>>16 & 0xFF),(UINT_8)((u4Cmd>>8) & 0xFF), (UINT_8)(u4Cmd&0xFF)); - } - } - } - } - else { - *pu4Data = g_au4SwCr[ucOffset]; - } -} - -VOID swCrReadWriteCmd(P_ADAPTER_T prAdapter, UINT_8 ucRead, UINT_16 u2Addr, UINT_32 *pu4Data) -{ - UINT_8 ucMod; - - ucMod = u2Addr >>8; - /* Address [15:8] MOD ID */ - /* Address [7:0] OFFSET */ - - DEBUGFUNC("swCrReadWriteCmd"); - DBGLOG(SW4, INFO, ("%u addr 0x%x data 0x%x\n",ucRead,u2Addr,*pu4Data)); - - if(ucMod < (sizeof(g_arSwCrModHandle)/sizeof(g_arSwCrModHandle[0])) ) { - - if(g_arSwCrModHandle[ucMod]!=NULL) { - g_arSwCrModHandle[ucMod](prAdapter, ucRead, u2Addr, pu4Data); - } - } /* ucMod */ -} - -/* Debug Support */ -VOID swCrFrameCheckEnable(P_ADAPTER_T prAdapter, UINT_32 u4DumpType) -{ - g_u4SwcrDebugFrameDumpType = u4DumpType; - prAdapter->rRxCtrl.u4RxPktsDumpTypeMask = u4DumpType; -} - -VOID swCrDebugInit(P_ADAPTER_T prAdapter) -{ - // frame dump - if (g_u4SwcrDebugFrameDumpType) { - swCrFrameCheckEnable(prAdapter, g_u4SwcrDebugFrameDumpType); - } - - // debug counter - g_fgSwcrDebugTimer = FALSE; - - cnmTimerInitTimer(prAdapter, - &g_rSwcrDebugTimer, - (PFN_MGMT_TIMEOUT_FUNC)swCrDebugCheckTimeout, - (UINT_32) NULL); - - if (g_u4SwcrDebugCheckTimeout) { - swCrDebugCheckEnable(prAdapter, TRUE, g_ucSwcrDebugCheckType, g_u4SwcrDebugCheckTimeout); - } -} - -VOID swCrDebugUninit(P_ADAPTER_T prAdapter) -{ - cnmTimerStopTimer(prAdapter, &g_rSwcrDebugTimer); - - g_fgSwcrDebugTimer = FALSE; -} - -VOID swCrDebugCheckEnable(P_ADAPTER_T prAdapter, BOOLEAN fgIsEnable, UINT_8 ucType, UINT_32 u4Timeout) -{ - if (fgIsEnable) { - g_ucSwcrDebugCheckType = ucType; - g_u4SwcrDebugCheckTimeout = u4Timeout; - if (g_fgSwcrDebugTimer == FALSE) { - swCrDebugCheckTimeout(prAdapter, 0); - } - } - else { - cnmTimerStopTimer(prAdapter, &g_rSwcrDebugTimer); - g_u4SwcrDebugCheckTimeout = 0; - } - - g_fgSwcrDebugTimer = fgIsEnable; -} - -VOID swCrDebugCheck(P_ADAPTER_T prAdapter, P_CMD_SW_DBG_CTRL_T prCmdSwCtrl) -{ - P_RX_CTRL_T prRxCtrl; - P_TX_CTRL_T prTxCtrl; - - ASSERT(prAdapter); - - prTxCtrl = &prAdapter->rTxCtrl; - prRxCtrl = &prAdapter->rRxCtrl; - - // dump counters - if (prCmdSwCtrl) { - if (prCmdSwCtrl->u4Data == SWCR_DBG_TYPE_ALL) { - - // TX Counter from fw - DBGLOG(SW4, INFO, ("TX0\n" \ - "%08x %08x %08x %08x\n" \ - "%08x %08x %08x %08x\n", - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_BCN_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_FAILED_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_RETRY_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_AGING_TIMEOUT_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_PS_OVERFLOW_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_MGNT_DROP_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_TX_ERROR_CNT])); -#if 1 - // TX Counter from drv - DBGLOG(SW4, INFO, ("TX1\n" \ - "%08x %08x %08x %08x\n", - (UINT_32)TX_GET_CNT(prTxCtrl, TX_INACTIVE_BSS_DROP), - (UINT_32)TX_GET_CNT(prTxCtrl, TX_INACTIVE_STA_DROP), - (UINT_32)TX_GET_CNT(prTxCtrl, TX_FORWARD_OVERFLOW_DROP), - (UINT_32)TX_GET_CNT(prTxCtrl, TX_AP_BORADCAST_DROP))); -#endif - - // RX Counter - DBGLOG(SW4, INFO, ("RX0\n" \ - "%08x %08x %08x %08x\n" \ - "%08x %08x %08x %08x\n" \ - "%08x %08x %08x %08x\n" \ - "%08x %08x %08x %08x\n", - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_DROP_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_DUP_DROP_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_TYPE_ERROR_DROP_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_CLASS_ERROR_DROP_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_AMPDU_ERROR_DROP_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_STATUS_ERROR_DROP_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FORMAT_ERROR_DROP_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_ICV_ERROR_DROP_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_KEY_ERROR_DROP_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_TKIP_ERROR_DROP_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_MIC_ERROR_DROP_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_BIP_ERROR_DROP_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FCSERR_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_FIFOFULL_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_RX_PFDROP_CNT])); - - DBGLOG(SW4, INFO, ("RX1\n" \ - "%08x %08x %08x %08x\n" \ - "%08x %08x %08x %08x\n", - (UINT_32)RX_GET_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT), - (UINT_32)RX_GET_CNT(prRxCtrl, RX_DATA_INDICATION_COUNT), - (UINT_32)RX_GET_CNT(prRxCtrl, RX_DATA_RETURNED_COUNT), - (UINT_32)RX_GET_CNT(prRxCtrl, RX_DATA_RETAINED_COUNT), - (UINT_32)RX_GET_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT), - (UINT_32)RX_GET_CNT(prRxCtrl, RX_TYPE_ERR_DROP_COUNT), - (UINT_32)RX_GET_CNT(prRxCtrl, RX_CLASS_ERR_DROP_COUNT), - (UINT_32)RX_GET_CNT(prRxCtrl, RX_DST_NULL_DROP_COUNT))); - - DBGLOG(SW4, INFO, ("PWR\n" \ - "%08x %08x %08x %08x\n" \ - "%08x %08x %08x %08x\n", - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PS_POLL_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_TRIGGER_NULL_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_BCN_IND_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_BCN_TIMEOUT_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PM_STATE0], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_PM_STATE1], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_CUR_PS_PROF0], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_PWR_CUR_PS_PROF1])); - - DBGLOG(SW4, INFO, ("ARM\n" \ - "%08x %08x %08x %08x\n" \ - "%08x %08x\n", - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_RATE], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_BWGI], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_AR_STA0_RX_RATE_RCPI], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_ENABLE], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_ROAM_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_ROAMING_INT_CNT])); - - DBGLOG(SW4, INFO, ("BB\n" \ - "%08x %08x %08x %08x\n" \ - "%08x %08x %08x %08x\n", - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_RX_MDRDY_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_RX_FCSERR_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_PD_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_PD_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_SFDERR_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_CCK_SIGERR_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_TAGERR_CNT], - prCmdSwCtrl->u4DebugCnt[SWCR_DBG_ALL_BB_OFDM_SIGERR_CNT])); - - } - } - - // start the next check - if (g_u4SwcrDebugCheckTimeout) { - cnmTimerStartTimer(prAdapter, &g_rSwcrDebugTimer, g_u4SwcrDebugCheckTimeout * MSEC_PER_SEC); - } -} - -VOID swCrDebugCheckTimeout( - IN P_ADAPTER_T prAdapter, - UINT_32 u4Param) -{ - CMD_SW_DBG_CTRL_T rCmdSwCtrl; - WLAN_STATUS rStatus; - - rCmdSwCtrl.u4Id = (0xb000<<16) + g_ucSwcrDebugCheckType; - rCmdSwCtrl.u4Data = 0; - rStatus = wlanSendSetQueryCmd ( - prAdapter, /* prAdapter */ - CMD_ID_SW_DBG_CTRL, /* ucCID */ - FALSE, /* fgSetQuery */ - TRUE, /* fgNeedResp */ - FALSE, /* fgIsOid */ - swCrDebugQuery, /* pfCmdDoneHandler */ - swCrDebugQueryTimeout, /* pfCmdTimeoutHandler */ - sizeof(CMD_SW_DBG_CTRL_T), /* u4SetQueryInfoLen */ - (PUINT_8)&rCmdSwCtrl, /* pucInfoBuffer */ - NULL, /* pvSetQueryBuffer */ - 0 /* u4SetQueryBufferLen */ - ); - - ASSERT(rStatus == WLAN_STATUS_PENDING); - - return; -} - -VOID swCrDebugQuery( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - ASSERT(prAdapter); - - swCrDebugCheck(prAdapter, (P_CMD_SW_DBG_CTRL_T)(pucEventBuf)); -} - -VOID swCrDebugQueryTimeout( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo) -{ - ASSERT(prAdapter); - - swCrDebugCheck(prAdapter, NULL); -} - -#endif /* CFG_SUPPORT_SWCR */ - - diff --git a/drivers/net/wireless/mt5931/mgmt/wapi.c b/drivers/net/wireless/mt5931/mgmt/wapi.c deleted file mode 100755 index abf807d31193..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/wapi.c +++ /dev/null @@ -1,514 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/mgmt/wapi.c#1 $ -*/ - -/*! \file "wapi.c" - \brief This file including the WAPI related function. - - This file provided the macros and functions library support the wapi ie parsing, - cipher and AKM check to help the AP seleced deciding. -*/ - - - -/* -** $Log: wapi.c $ - * - * 11 10 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * change the debug module level. - * - * 10 20 2010 wh.su - * [WCXRP00000067] [MT6620 Wi-Fi][Driver] Support the android+ WAPI function - * fixed the network type - * - * 09 01 2010 wh.su - * NULL - * adding the wapi support for integration test. - * - * 07 20 2010 wh.su - * - * . - * - * 04 06 2010 wh.su - * [BORA00000680][MT6620] Support the statistic for Microsoft os query - * fixed the firmware return the broadcast frame at wrong tc. - * - * 03 03 2010 wh.su - * [BORA00000637][MT6620 Wi-Fi] [Bug] WPA2 pre-authentication timer not correctly initialize - * move the AIS specific variable for security to AIS specific structure. - * - * 12 18 2009 cm.chang - * [BORA00000018]Integrate WIFI part into BORA for the 1st time - * . - * - * Dec 8 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the function to check and update the default wapi tx - * - * Dec 7 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * adding the generate wapi ie function, and replace the tabe by space - * - * Nov 23 2009 mtk01088 - * [BORA00000476] [Wi-Fi][firmware] Add the security module initialize code - * -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -#include "precomp.h" -#if CFG_SUPPORT_WAPI - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to generate WPA IE for -* associate request frame. -* -* \param[in] prCurrentBss The Selected BSS description -* -* \retval The append WPA IE length -* -* \note -* Called by: AIS module, Associate request -*/ -/*----------------------------------------------------------------------------*/ -VOID -wapiGenerateWAPIIE ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - PUINT_8 pucBuffer; - - ASSERT(prAdapter); - ASSERT(prMsduInfo); - - if (prMsduInfo->ucNetworkType != NETWORK_TYPE_AIS_INDEX) - return; - - pucBuffer = (PUINT_8)((UINT_32)prMsduInfo->prPacket + - (UINT_32)prMsduInfo->u2FrameLength); - - /* ASSOC INFO IE ID: 68 :0x44 */ - if (/* prWlanInfo->fgWapiMode && */ prAdapter->prGlueInfo->u2WapiAssocInfoIESz) { - kalMemCopy(pucBuffer, &prAdapter->prGlueInfo->aucWapiAssocInfoIEs, prAdapter->prGlueInfo->u2WapiAssocInfoIESz); - prMsduInfo->u2FrameLength += prAdapter->prGlueInfo->u2WapiAssocInfoIESz; - } - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to parse WAPI IE. -* -* \param[in] prInfoElem Pointer to the RSN IE -* \param[out] prRsnInfo Pointer to the BSSDescription structure to store the -** WAPI information from the given WAPI IE -* -* \retval TRUE - Succeeded -* \retval FALSE - Failed -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wapiParseWapiIE ( - IN P_WAPI_INFO_ELEM_T prInfoElem, - OUT P_WAPI_INFO_T prWapiInfo - ) -{ - UINT_32 i; - INT_32 u4RemainWapiIeLen; - UINT_16 u2Version; - UINT_16 u2Cap = 0; - UINT_32 u4GroupSuite = WAPI_CIPHER_SUITE_WPI; - UINT_16 u2PairSuiteCount = 0; - UINT_16 u2AuthSuiteCount = 0; - PUCHAR pucPairSuite = NULL; - PUCHAR pucAuthSuite = NULL; - PUCHAR cp; - - DEBUGFUNC("wapiParseWapiIE"); - - ASSERT(prInfoElem); - ASSERT(prWapiInfo); - - /* Verify the length of the WAPI IE. */ - if (prInfoElem->ucLength < 6) { - DBGLOG(SEC, TRACE, ("WAPI IE length too short (length=%d)\n", prInfoElem->ucLength)); - return FALSE; - } - - /* Check WAPI version: currently, we only support version 1. */ - WLAN_GET_FIELD_16(&prInfoElem->u2Version, &u2Version); - if (u2Version != 1) { - DBGLOG(SEC, TRACE, ("Unsupported WAPI IE version: %d\n", u2Version)); - return FALSE; - } - - cp = (PUCHAR) &prInfoElem->u2AuthKeyMgtSuiteCount; - u4RemainWapiIeLen = (INT_32) prInfoElem->ucLength - 2; - - do { - if (u4RemainWapiIeLen == 0) { - break; - } - - /* - AuthCount : 2 - AuthSuite : 4 * authSuiteCount - PairwiseCount: 2 - PairwiseSuite: 4 * pairSuiteCount - GroupSuite : 4 - Cap : 2 */ - - /* Parse the Authentication and Key Management Cipher Suite Count - field. */ - if (u4RemainWapiIeLen < 2) { - DBGLOG(SEC, TRACE, ("Fail to parse WAPI IE in auth & key mgt suite count (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - WLAN_GET_FIELD_16(cp, &u2AuthSuiteCount); - cp += 2; - u4RemainWapiIeLen -= 2; - - /* Parse the Authentication and Key Management Cipher Suite List - field. */ - i = (UINT_32) u2AuthSuiteCount * 4; - if (u4RemainWapiIeLen < (INT_32) i) { - DBGLOG(SEC, TRACE, ("Fail to parse WAPI IE in auth & key mgt suite list (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - pucAuthSuite = cp; - - cp += i; - u4RemainWapiIeLen -= (INT_32) i; - - if (u4RemainWapiIeLen == 0) { - break; - } - - /* Parse the Pairwise Key Cipher Suite Count field. */ - if (u4RemainWapiIeLen < 2) { - DBGLOG(SEC, TRACE, ("Fail to parse WAPI IE in pairwise cipher suite count (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - WLAN_GET_FIELD_16(cp, &u2PairSuiteCount); - cp += 2; - u4RemainWapiIeLen -= 2; - - /* Parse the Pairwise Key Cipher Suite List field. */ - i = (UINT_32) u2PairSuiteCount * 4; - if (u4RemainWapiIeLen < (INT_32) i) { - DBGLOG(SEC, TRACE, ("Fail to parse WAPI IE in pairwise cipher suite list (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - pucPairSuite = cp; - - cp += i; - u4RemainWapiIeLen -= (INT_32) i; - - /* Parse the Group Key Cipher Suite field. */ - if (u4RemainWapiIeLen < 4) { - DBGLOG(SEC, TRACE, ("Fail to parse WAPI IE in group cipher suite (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - WLAN_GET_FIELD_32(cp, &u4GroupSuite); - cp += 4; - u4RemainWapiIeLen -= 4; - - /* Parse the WAPI u2Capabilities field. */ - if (u4RemainWapiIeLen < 2) { - DBGLOG(SEC, TRACE, ("Fail to parse WAPI IE in WAPI capabilities (IE len: %d)\n", - prInfoElem->ucLength)); - return FALSE; - } - - WLAN_GET_FIELD_16(cp, &u2Cap); - u4RemainWapiIeLen -= 2; - - /* Todo:: BKID support */ - } while (FALSE); - - /* Save the WAPI information for the BSS. */ - - prWapiInfo->ucElemId = ELEM_ID_WAPI; - - prWapiInfo->u2Version = u2Version; - - prWapiInfo->u4GroupKeyCipherSuite = u4GroupSuite; - - DBGLOG(SEC, LOUD, ("WAPI: version %d, group key cipher suite %02x-%02x-%02x-%02x\n", - u2Version, (UCHAR) (u4GroupSuite & 0x000000FF), - (UCHAR) ((u4GroupSuite >> 8) & 0x000000FF), - (UCHAR) ((u4GroupSuite >> 16) & 0x000000FF), - (UCHAR) ((u4GroupSuite >> 24) & 0x000000FF))); - - if (pucPairSuite) { - /* The information about the pairwise key cipher suites is present. */ - if (u2PairSuiteCount > MAX_NUM_SUPPORTED_CIPHER_SUITES) { - u2PairSuiteCount = MAX_NUM_SUPPORTED_CIPHER_SUITES; - } - - prWapiInfo->u4PairwiseKeyCipherSuiteCount = (UINT_32) u2PairSuiteCount; - - for (i = 0; i < (UINT_32) u2PairSuiteCount; i++) { - WLAN_GET_FIELD_32(pucPairSuite, - &prWapiInfo->au4PairwiseKeyCipherSuite[i]); - pucPairSuite += 4; - - DBGLOG(SEC, LOUD,("WAPI: pairwise key cipher suite [%d]: %02x-%02x-%02x-%02x\n", - (UINT_8)i, (UCHAR) (prWapiInfo->au4PairwiseKeyCipherSuite[i] & 0x000000FF), - (UCHAR) ((prWapiInfo->au4PairwiseKeyCipherSuite[i] >> 8) & 0x000000FF), - (UCHAR) ((prWapiInfo->au4PairwiseKeyCipherSuite[i] >> 16) & 0x000000FF), - (UCHAR) ((prWapiInfo->au4PairwiseKeyCipherSuite[i] >> 24) & 0x000000FF))); - } - } - else { - /* The information about the pairwise key cipher suites is not present. - Use the default chipher suite for WAPI: WPI. */ - prWapiInfo->u4PairwiseKeyCipherSuiteCount = 1; - prWapiInfo->au4PairwiseKeyCipherSuite[0] = WAPI_CIPHER_SUITE_WPI; - - DBGLOG(SEC, LOUD, ("WAPI: pairwise key cipher suite: %02x-%02x-%02x-%02x (default)\n", - (UCHAR) (prWapiInfo->au4PairwiseKeyCipherSuite[0] & 0x000000FF), - (UCHAR) ((prWapiInfo->au4PairwiseKeyCipherSuite[0] >> 8) & 0x000000FF), - (UCHAR) ((prWapiInfo->au4PairwiseKeyCipherSuite[0] >> 16) & 0x000000FF), - (UCHAR) ((prWapiInfo->au4PairwiseKeyCipherSuite[0] >> 24) & 0x000000FF))); - } - - if (pucAuthSuite) { - /* The information about the authentication and key management suites - is present. */ - if (u2AuthSuiteCount > MAX_NUM_SUPPORTED_AKM_SUITES) { - u2AuthSuiteCount = MAX_NUM_SUPPORTED_AKM_SUITES; - } - - prWapiInfo->u4AuthKeyMgtSuiteCount = (UINT_32) u2AuthSuiteCount; - - for (i = 0; i < (UINT_32) u2AuthSuiteCount; i++) { - WLAN_GET_FIELD_32(pucAuthSuite, &prWapiInfo->au4AuthKeyMgtSuite[i]); - pucAuthSuite += 4; - - DBGLOG(SEC, LOUD, ("WAPI: AKM suite [%d]: %02x-%02x-%02x-%02x\n", - (UINT_8)i, (UCHAR) (prWapiInfo->au4AuthKeyMgtSuite[i] & 0x000000FF), - (UCHAR) ((prWapiInfo->au4AuthKeyMgtSuite[i] >> 8) & 0x000000FF), - (UCHAR) ((prWapiInfo->au4AuthKeyMgtSuite[i] >> 16) & 0x000000FF), - (UCHAR) ((prWapiInfo->au4AuthKeyMgtSuite[i] >> 24) & 0x000000FF))); - } - } - else { - /* The information about the authentication and key management suites - is not present. Use the default AKM suite for WAPI. */ - prWapiInfo->u4AuthKeyMgtSuiteCount = 1; - prWapiInfo->au4AuthKeyMgtSuite[0] = WAPI_AKM_SUITE_802_1X; - - DBGLOG(SEC, LOUD, ("WAPI: AKM suite: %02x-%02x-%02x-%02x (default)\n", - (UCHAR) (prWapiInfo->au4AuthKeyMgtSuite[0] & 0x000000FF), - (UCHAR) ((prWapiInfo->au4AuthKeyMgtSuite[0] >> 8) & 0x000000FF), - (UCHAR) ((prWapiInfo->au4AuthKeyMgtSuite[0] >> 16) & 0x000000FF), - (UCHAR) ((prWapiInfo->au4AuthKeyMgtSuite[0] >> 24) & 0x000000FF))); - } - - prWapiInfo->u2WapiCap = u2Cap; - DBGLOG(SEC, LOUD, ("WAPI: cap: 0x%04x\n", prWapiInfo->u2WapiCap)); - - return TRUE; -} /* wapiParseWapiIE */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to perform WAPI policy selection for a given BSS. -* -* \param[in] prAdapter Pointer to the adapter object data area. -* \param[in] prBss Pointer to the BSS description -* -* \retval TRUE - The WAPI policy selection for the given BSS is -* successful. The selected pairwise and group cipher suites -* are returned in the BSS description. -* \retval FALSE - The WAPI policy selection for the given BSS is failed. -* The driver shall not attempt to join the given BSS. -* -* \note The Encrypt status matched score will save to bss for final ap select. -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wapiPerformPolicySelection ( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prBss - ) -{ - UINT_32 i; - UINT_32 u4PairwiseCipher = 0; - UINT_32 u4GroupCipher = 0; - UINT_32 u4AkmSuite = 0; - P_WAPI_INFO_T prBssWapiInfo; - P_WLAN_INFO_T prWlanInfo; - - DEBUGFUNC("wapiPerformPolicySelection"); - - ASSERT(prBss); - - /* Notice!!!! WAPI AP not set the privacy bit for WAI and WAI-PSK at WZC configuration mode */ - prWlanInfo = &prAdapter->rWlanInfo; - - if (prBss->fgIEWAPI) { - prBssWapiInfo = &prBss->rIEWAPI; - } - else { - if (prAdapter->rWifiVar.rConnSettings.fgWapiMode == FALSE) { - DBGLOG(SEC, TRACE,("-- No Protected BSS\n")); - return TRUE; - } - else { - DBGLOG(SEC, TRACE, ("WAPI Information Element does not exist.\n")); - return FALSE; - } - } - - /* Select pairwise/group ciphers */ - for (i = 0; i < prBssWapiInfo->u4PairwiseKeyCipherSuiteCount; i++) { - if (prBssWapiInfo->au4PairwiseKeyCipherSuite[i] == - prAdapter->rWifiVar.rConnSettings.u4WapiSelectedPairwiseCipher) { - u4PairwiseCipher = prBssWapiInfo->au4PairwiseKeyCipherSuite[i]; - } - } - if (prBssWapiInfo->u4GroupKeyCipherSuite == - prAdapter->rWifiVar.rConnSettings.u4WapiSelectedGroupCipher) - u4GroupCipher = prBssWapiInfo->u4GroupKeyCipherSuite; - - /* Exception handler */ - /* If we cannot find proper pairwise and group cipher suites to join the - BSS, do not check the supported AKM suites. */ - if (u4PairwiseCipher == 0 || u4GroupCipher == 0) { - DBGLOG(SEC, TRACE, ("Failed to select pairwise/group cipher (0x%08lx/0x%08lx)\n", - u4PairwiseCipher, u4GroupCipher)); - return FALSE; - } - - /* Select AKM */ - /* If the driver cannot support any authentication suites advertised in - the given BSS, we fail to perform RSNA policy selection. */ - /* Attempt to find any overlapping supported AKM suite. */ - for (i = 0; i < prBssWapiInfo->u4AuthKeyMgtSuiteCount; i++) { - if (prBssWapiInfo->au4AuthKeyMgtSuite[i] == prAdapter->rWifiVar.rConnSettings.u4WapiSelectedAKMSuite) { - u4AkmSuite = prBssWapiInfo->au4AuthKeyMgtSuite[i]; - break; - } - } - - if (u4AkmSuite == 0) { - DBGLOG(SEC, TRACE, ("Cannot support any AKM suites\n")); - return FALSE; - } - - DBGLOG(SEC, TRACE, ("Selected pairwise/group cipher: %02x-%02x-%02x-%02x/%02x-%02x-%02x-%02x\n", - (UINT_8) (u4PairwiseCipher & 0x000000FF), - (UINT_8) ((u4PairwiseCipher >> 8) & 0x000000FF), - (UINT_8) ((u4PairwiseCipher >> 16) & 0x000000FF), - (UINT_8) ((u4PairwiseCipher >> 24) & 0x000000FF), - (UINT_8) (u4GroupCipher & 0x000000FF), - (UINT_8) ((u4GroupCipher >> 8) & 0x000000FF), - (UINT_8) ((u4GroupCipher >> 16) & 0x000000FF), - (UINT_8) ((u4GroupCipher >> 24) & 0x000000FF))); - - DBGLOG(SEC, TRACE, ("Selected AKM suite: %02x-%02x-%02x-%02x\n", - (UINT_8) (u4AkmSuite & 0x000000FF), - (UINT_8) ((u4AkmSuite >> 8) & 0x000000FF), - (UINT_8) ((u4AkmSuite >> 16) & 0x000000FF), - (UINT_8) ((u4AkmSuite >> 24) & 0x000000FF))); - - return TRUE; -} /* wapiPerformPolicySelection */ - -#if 0 -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is use for wapi mode, to update the current wpi tx idx ? 0 :1 . -* -* \param[in] prStaRec Pointer to the Sta record -* \param[out] ucWlanIdx The Rx status->wlanidx field -* -* \retval TRUE - Succeeded -* \retval FALSE - Failed -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wapiUpdateTxKeyIdx ( - IN P_STA_RECORD_T prStaRec, - IN UINT_8 ucWlanIdx - ) -{ - UINT_8 ucKeyId; - - if ((ucWlanIdx & BITS(0, 3)) == CIPHER_SUITE_WPI) { - - ucKeyId = ((ucWlanIdx & BITS(4, 5)) >> 4); - - if (ucKeyId != g_prWifiVar->rAisSpecificBssInfo.ucWpiActivedPWKey) { - DBGLOG(RSN, STATE, ("Change wapi key index from %d->%d\n", g_prWifiVar->rAisSpecificBssInfo.ucWpiActivedPWKey, ucKeyId)); - g_prWifiVar->rAisSpecificBssInfo.ucWpiActivedPWKey = ucKeyId; - - prStaRec->ucWTEntry = - (ucKeyId == WTBL_AIS_BSSID_WAPI_IDX_0) ? WTBL_AIS_BSSID_WAPI_IDX_0 : WTBL_AIS_BSSID_WAPI_IDX_1; - } - } -} -#endif -#endif - diff --git a/drivers/net/wireless/mt5931/mgmt/wnm.c b/drivers/net/wireless/mt5931/mgmt/wnm.c deleted file mode 100755 index c6871df87ce7..000000000000 --- a/drivers/net/wireless/mt5931/mgmt/wnm.c +++ /dev/null @@ -1,349 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/MT6620_5931_WiFi_Driver/mgmt/wnm.c#1 $ -*/ - -/*! \file "wnm.c" - \brief This file includes the 802.11v default vale and functions. -*/ - - - -/* -** $Log: wnm.c $ - * - * 01 05 2012 tsaiyuan.hsu - * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v - * add timing measurement support for 802.11v. - * - * -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -#if CFG_SUPPORT_802_11V - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -#define WNM_MAX_TOD_ERROR 0 -#define WNM_MAX_TOA_ERROR 0 -#define MICRO_TO_10NANO(x) ((x)*100) -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -static UINT_8 ucTimingMeasToken = 0; - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -WLAN_STATUS -wnmRunEventTimgingMeasTxDone ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ); - -VOID -wnmComposeTimingMeasFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN PFN_TX_DONE_HANDLER pfTxDoneHandler - ); - -VOID -wnmTimingMeasRequest ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ); -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to process the 802.11v wnm category action frame. -* -* -* \note -* Called by: Handle Rx mgmt request -*/ -/*----------------------------------------------------------------------------*/ -VOID -wnmWNMAction ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_WLAN_ACTION_FRAME prRxFrame; - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - prRxFrame = (P_WLAN_ACTION_FRAME) prSwRfb->pvHeader; - -#if CFG_SUPPORT_802_11V_TIMING_MEASUREMENT - if (prRxFrame->ucAction == ACTION_WNM_TIMING_MEASUREMENT_REQUEST) { - wnmTimingMeasRequest(prAdapter, prSwRfb); - return; - } -#endif - - DBGLOG(WNM, TRACE, ("Unsupport WNM action frame: %d\n", prRxFrame->ucAction)); -} - -#if CFG_SUPPORT_802_11V_TIMING_MEASUREMENT -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to report timing measurement data. -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -wnmReportTimingMeas ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucStaRecIndex, - IN UINT_32 u4ToD, - IN UINT_32 u4ToA - ) -{ - P_STA_RECORD_T prStaRec; - - prStaRec = cnmGetStaRecByIndex(prAdapter, ucStaRecIndex); - - if ((!prStaRec) || (!prStaRec->fgIsInUse)) { - return; - } - - DBGLOG(WNM, TRACE, ("wnmReportTimingMeas: u4ToD %x u4ToA %x", u4ToD, u4ToA)); - - if (!prStaRec->rWNMTimingMsmt.ucTrigger) - return; - - prStaRec->rWNMTimingMsmt.u4ToD = MICRO_TO_10NANO(u4ToD); - prStaRec->rWNMTimingMsmt.u4ToA = MICRO_TO_10NANO(u4ToA); -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will handle TxDone(TimingMeasurement) Event. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prMsduInfo Pointer to the MSDU_INFO_T. -* @param[in] rTxDoneStatus Return TX status of the Timing Measurement frame. -* -* @retval WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -wnmRunEventTimgingMeasTxDone ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_TX_RESULT_CODE_T rTxDoneStatus - ) -{ - P_STA_RECORD_T prStaRec; - - ASSERT(prAdapter); - ASSERT(prMsduInfo); - - DBGLOG(WNM, LOUD, ("EVENT-TX DONE: Current Time = %ld\n", kalGetTimeTick())); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - if ((!prStaRec) || (!prStaRec->fgIsInUse)) { - return WLAN_STATUS_SUCCESS; /* For the case of replying ERROR STATUS CODE */ - } - - DBGLOG(WNM, TRACE, ("wnmRunEventTimgingMeasTxDone: ucDialog %d ucFollowUp %d u4ToD %x u4ToA %x", - prStaRec->rWNMTimingMsmt.ucDialogToken, - prStaRec->rWNMTimingMsmt.ucFollowUpDialogToken, - prStaRec->rWNMTimingMsmt.u4ToD, - prStaRec->rWNMTimingMsmt.u4ToA)); - - prStaRec->rWNMTimingMsmt.ucFollowUpDialogToken = prStaRec->rWNMTimingMsmt.ucDialogToken; - prStaRec->rWNMTimingMsmt.ucDialogToken = ++ucTimingMeasToken; - - wnmComposeTimingMeasFrame(prAdapter, prStaRec, NULL); - - return WLAN_STATUS_SUCCESS; - -} /* end of wnmRunEventTimgingMeasTxDone() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will compose the Timing Measurement frame. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] prStaRec Pointer to the STA_RECORD_T. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -wnmComposeTimingMeasFrame ( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN PFN_TX_DONE_HANDLER pfTxDoneHandler - ) -{ - P_MSDU_INFO_T prMsduInfo; - P_BSS_INFO_T prBssInfo; - P_ACTION_UNPROTECTED_WNM_TIMING_MEAS_FRAME prTxFrame; - UINT_16 u2PayloadLen; - - prBssInfo = &prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]; - ASSERT(prBssInfo); - - prMsduInfo = (P_MSDU_INFO_T) cnmMgtPktAlloc(prAdapter, - MAC_TX_RESERVED_FIELD + PUBLIC_ACTION_MAX_LEN); - - if (!prMsduInfo) - return; - - prTxFrame = (P_ACTION_UNPROTECTED_WNM_TIMING_MEAS_FRAME) - ((UINT_32)(prMsduInfo->prPacket) + MAC_TX_RESERVED_FIELD); - - prTxFrame->u2FrameCtrl = MAC_FRAME_ACTION; - - COPY_MAC_ADDR(prTxFrame->aucDestAddr, prStaRec->aucMacAddr); - COPY_MAC_ADDR(prTxFrame->aucSrcAddr, prBssInfo->aucOwnMacAddr); - COPY_MAC_ADDR(prTxFrame->aucBSSID, prBssInfo->aucBSSID); - - prTxFrame->ucCategory = CATEGORY_UNPROTECTED_WNM_ACTION; - prTxFrame->ucAction = ACTION_UNPROTECTED_WNM_TIMING_MEASUREMENT; - - //3 Compose the frame body's frame. - prTxFrame->ucDialogToken = prStaRec->rWNMTimingMsmt.ucDialogToken; - prTxFrame->ucFollowUpDialogToken = prStaRec->rWNMTimingMsmt.ucFollowUpDialogToken; - prTxFrame->u4ToD = prStaRec->rWNMTimingMsmt.u4ToD; - prTxFrame->u4ToA = prStaRec->rWNMTimingMsmt.u4ToA; - prTxFrame->ucMaxToDErr = WNM_MAX_TOD_ERROR; - prTxFrame->ucMaxToAErr = WNM_MAX_TOA_ERROR; - - u2PayloadLen = 2 + ACTION_UNPROTECTED_WNM_TIMING_MEAS_LEN; - - //4 Update information of MSDU_INFO_T - prMsduInfo->ucPacketType = HIF_TX_PACKET_TYPE_MGMT; /* Management frame */ - prMsduInfo->ucStaRecIndex = prStaRec->ucIndex; - prMsduInfo->ucNetworkType = prStaRec->ucNetTypeIndex; - prMsduInfo->ucMacHeaderLength = WLAN_MAC_MGMT_HEADER_LEN; - prMsduInfo->fgIs802_1x = FALSE; - prMsduInfo->fgIs802_11 = TRUE; - prMsduInfo->u2FrameLength = WLAN_MAC_MGMT_HEADER_LEN + u2PayloadLen; - prMsduInfo->ucTxSeqNum = nicIncreaseTxSeqNum(prAdapter); - prMsduInfo->pfTxDoneHandler = pfTxDoneHandler; - prMsduInfo->fgIsBasicRate = FALSE; - - DBGLOG(WNM, TRACE, ("wnmComposeTimingMeasFrame: ucDialogToken %d ucFollowUpDialogToken %d u4ToD %x u4ToA %x\n", - prTxFrame->ucDialogToken, prTxFrame->ucFollowUpDialogToken, - prTxFrame->u4ToD, prTxFrame->u4ToA)); - - //4 Enqueue the frame to send this action frame. - nicTxEnqueueMsdu(prAdapter, prMsduInfo); - - return; - -} /* end of wnmComposeTimingMeasFrame() */ - -/*----------------------------------------------------------------------------*/ -/*! -* -* \brief This routine is called to process the 802.11v timing measurement request. -* -* -* \note -* Handle Rx mgmt request -*/ -/*----------------------------------------------------------------------------*/ -VOID -wnmTimingMeasRequest ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_ACTION_WNM_TIMING_MEAS_REQ_FRAME prRxFrame = NULL; - P_STA_RECORD_T prStaRec; - - prRxFrame = (P_ACTION_WNM_TIMING_MEAS_REQ_FRAME)prSwRfb->pvHeader; - if (!prRxFrame) - return; - - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - if ((!prStaRec) || (!prStaRec->fgIsInUse)) { - return; - } - - DBGLOG(WNM, TRACE, ("IEEE 802.11: Received Timing Measuremen Request from " - MACSTR"\n", MAC2STR(prStaRec->aucMacAddr))); - - // reset timing msmt - prStaRec->rWNMTimingMsmt.fgInitiator = TRUE; - prStaRec->rWNMTimingMsmt.ucTrigger = prRxFrame->ucTrigger; - if (!prRxFrame->ucTrigger) - return; - - prStaRec->rWNMTimingMsmt.ucDialogToken = ++ucTimingMeasToken; - prStaRec->rWNMTimingMsmt.ucFollowUpDialogToken = 0; - - wnmComposeTimingMeasFrame(prAdapter, prStaRec, wnmRunEventTimgingMeasTxDone); -} - -#if WNM_UNIT_TEST -VOID wnmTimingMeasUnitTest1(P_ADAPTER_T prAdapter, UINT_8 ucStaRecIndex) -{ - P_STA_RECORD_T prStaRec; - - prStaRec = cnmGetStaRecByIndex(prAdapter, ucStaRecIndex); - if ((!prStaRec) || (!prStaRec->fgIsInUse)) { - return; - } - - DBGLOG(WNM, INFO, ("IEEE 802.11v: Test Timing Measuremen Request from " - MACSTR"\n", MAC2STR(prStaRec->aucMacAddr))); - - prStaRec->rWNMTimingMsmt.fgInitiator = TRUE; - prStaRec->rWNMTimingMsmt.ucTrigger = 1; - - prStaRec->rWNMTimingMsmt.ucDialogToken = ++ucTimingMeasToken; - prStaRec->rWNMTimingMsmt.ucFollowUpDialogToken = 0; - - wnmComposeTimingMeasFrame(prAdapter, prStaRec, wnmRunEventTimgingMeasTxDone); -} -#endif - -#endif /* CFG_SUPPORT_802_11V_TIMING_MEASUREMENT */ - -#endif /* CFG_SUPPORT_802_11V */ diff --git a/drivers/net/wireless/mt5931/nic/cmd_buf.c b/drivers/net/wireless/mt5931/nic/cmd_buf.c deleted file mode 100755 index 62653abf608a..000000000000 --- a/drivers/net/wireless/mt5931/nic/cmd_buf.c +++ /dev/null @@ -1,218 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/nic/cmd_buf.c#1 $ -*/ - -/*! \file "cmd_buf.c" - \brief This file contain the management function of internal Command Buffer - for CMD_INFO_T. - - We'll convert the OID into Command Packet and then send to FW. Thus we need - to copy the OID information to Command Buffer for following reasons. - 1. The data structure of OID information may not equal to the data structure of - Command, we cannot use the OID buffer directly. - 2. If the Command was not generated by driver we also need a place to store the - information. - 3. Because the CMD is NOT FIFO when doing memory allocation (CMD will be generated - from OID or interrupt handler), thus we'll use the Block style of Memory Allocation - here. -*/ - - - -/* -** $Log: cmd_buf.c $ - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 02 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. clear prPendingCmdInfo properly - * * 2. while allocating memory for cmdinfo, no need to add extra 4 bytes. -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-10-13 21:59:08 GMT mtk01084 -** remove un-neceasary spaces -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-05-20 12:24:26 GMT mtk01461 -** Increase CMD Buffer - HIF_RX_HW_APPENDED_LEN when doing CMD_INFO_T allocation -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-04-21 09:41:08 GMT mtk01461 -** Add init of Driver Domain MCR flag and fix lint MTK WARN -** \main\maintrunk.MT6620WiFiDriver_Prj\1 2009-04-17 19:51:45 GMT mtk01461 -** allocation function of CMD_INFO_T -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to initial the MGMT memory pool for CMD Packet. -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cmdBufInitialize ( - IN P_ADAPTER_T prAdapter - ) -{ - P_CMD_INFO_T prCmdInfo; - UINT_32 i; - - ASSERT(prAdapter); - - QUEUE_INITIALIZE(&prAdapter->rFreeCmdList); - - for (i = 0; i < CFG_TX_MAX_CMD_PKT_NUM; i++) { - prCmdInfo = &prAdapter->arHifCmdDesc[i]; - QUEUE_INSERT_TAIL(&prAdapter->rFreeCmdList, &prCmdInfo->rQueEntry); - } - -} /* end of cmdBufInitialize() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Allocate CMD_INFO_T from a free list and MGMT memory pool. -* -* @param[in] prAdapter Pointer to the Adapter structure. -* @param[in] u4Length Length of the frame buffer to allocate. -* -* @retval NULL Pointer to the valid CMD Packet handler -* @retval !NULL Fail to allocat CMD Packet -*/ -/*----------------------------------------------------------------------------*/ -P_CMD_INFO_T -cmdBufAllocateCmdInfo ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Length - ) -{ - P_CMD_INFO_T prCmdInfo; - KAL_SPIN_LOCK_DECLARATION(); - - DEBUGFUNC("cmdBufAllocateCmdInfo"); - - - ASSERT(prAdapter); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE); - QUEUE_REMOVE_HEAD(&prAdapter->rFreeCmdList, prCmdInfo, P_CMD_INFO_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE); - - if (prCmdInfo) { - /* Setup initial value in CMD_INFO_T */ - /* Start address of allocated memory */ - prCmdInfo->pucInfoBuffer = - cnmMemAlloc(prAdapter, RAM_TYPE_BUF, u4Length); - - if (prCmdInfo->pucInfoBuffer == NULL) { - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE); - QUEUE_INSERT_TAIL(&prAdapter->rFreeCmdList, &prCmdInfo->rQueEntry); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE); - - prCmdInfo = NULL; - } - else { - prCmdInfo->u2InfoBufLen = 0; - prCmdInfo->fgIsOid = FALSE; - prCmdInfo->fgDriverDomainMCR = FALSE; - } - } - - return prCmdInfo; - -} /* end of cmdBufAllocateCmdInfo() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to free the CMD Packet to the MGMT memory pool. -* -* @param prAdapter Pointer to the Adapter structure. -* @param prCmdInfo CMD Packet handler -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -cmdBufFreeCmdInfo ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ) -{ - KAL_SPIN_LOCK_DECLARATION(); - - DEBUGFUNC("cmdBufFreeCmdInfo"); - - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - if (prCmdInfo) { - if (prCmdInfo->pucInfoBuffer) { - cnmMemFree(prAdapter, prCmdInfo->pucInfoBuffer); - prCmdInfo->pucInfoBuffer = NULL; - } - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE); - QUEUE_INSERT_TAIL(&prAdapter->rFreeCmdList, &prCmdInfo->rQueEntry); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE); - } - - return; - -} /* end of cmdBufFreeCmdPacket() */ - - diff --git a/drivers/net/wireless/mt5931/nic/nic.c b/drivers/net/wireless/mt5931/nic/nic.c deleted file mode 100755 index 139c71bae6af..000000000000 --- a/drivers/net/wireless/mt5931/nic/nic.c +++ /dev/null @@ -1,4421 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/nic/nic.c#2 $ -*/ - -/*! \file nic.c - \brief Functions that provide operation in NIC's (Network Interface Card) point of view. - - This file includes functions which unite multiple hal(Hardware) operations - and also take the responsibility of Software Resource Management in order - to keep the synchronization with Hardware Manipulation. -*/ - - - -/* -** $Log: nic.c $ - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 05 02 2012 terry.wu - * NULL - * Set the default value of AP StaRec index to "STA_REC_INDEX_NOT_FOUND" in update firmware bss command. - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 11 28 2011 cp.wu - * [WCXRP00001125] [MT6620 Wi-Fi][Firmware] Strengthen Wi-Fi power off sequence to have a clearroom environment when returining to ROM code - * 1. Due to firmware now stops HIF DMA for powering off, do not try to receive any packet from firmware - * 2. Take use of prAdapter->fgIsEnterD3ReqIssued for tracking whether it is powering off or not - * - * 11 22 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * keep debug counter setting after wake up. - * - * 11 19 2011 yuche.tsai - * NULL - * Update RSSI for P2P. - * - * 11 18 2011 yuche.tsai - * NULL - * CONFIG P2P support RSSI query, default turned off. - * - * 11 07 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * add debug counters and periodically dump counters for debugging. - * - * 11 04 2011 cp.wu - * [WCXRP00001079] [MT5931][Driver] Release pending MMPDU only when BSS is being deactivated - * pre-check for NULL before calling MMPDU free function - * - * 11 03 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * change the DBGLOG for "\n" and "\r\n". LABEL to LOUD for XLOG - * - * 11 01 2011 chinglan.wang - * NULL - * Modify the Wi-Fi method of the flush TX queue when disconnect the AP. - * If disconnect the AP and flush all the data frame in the TX queue, WPS cannot do the 4-way handshake to connect to the AP.. - * - * 10 11 2011 terry.wu - * NULL - * Rewrite Assert Dump Function for Portability. - * - * 09 20 2011 cm.chang - * [WCXRP00000997] [MT6620 Wi-Fi][Driver][FW] Handle change of BSS preamble type and slot time - * New CMD definition about RLM parameters - * - * 08 15 2011 cp.wu - * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree - * reuse firmware download logic of MT6620 for MT6628. - * - * 08 03 2011 terry.wu - * [WCXRP00000899] [MT6620] [FW] Reply probe rsp in FW for hotspot mode - * Reply Probe Rsp in FW for Hotspot Mode. - * - * - * - * 08 03 2011 terry.wu - * [WCXRP00000899] [MT6620] [FW] Reply probe rsp in FW for hotspot mode - * Reply Probe Rsp in FW for Hotspot Mode. - * - * - * 08 03 2011 terry.wu - * [WCXRP00000899] [MT6620] [FW] Reply probe rsp in FW for hotspot mode - * Reply Probe Rsp in FW for Hotspot Mode. - * - * 08 03 2011 terry.wu - * [WCXRP00000899] [MT6620] [FW] Reply probe rsp in FW for hotspot mode - * Reply Probe Rsp in FW for Hotspot Mode. - * - * 08 02 2011 yuche.tsai - * [WCXRP00000896] [Volunteer Patch][WiFi Direct][Driver] GO with multiple client, TX deauth to a disconnecting device issue. - * Fix GO send deauth frame issue. - * - * 07 18 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add CMD/Event for RDD and BWCS. - * - * 07 11 2011 wh.su - * [WCXRP00000849] [MT6620 Wi-Fi][Driver] Remove some of the WAPI define for make sure the value is initialize, for customer not enable WAPI - * For make sure wapi initial value is set. - * - * 06 27 2011 cp.wu - * [WCXRP00000815] [MT6620 Wi-Fi][Driver] allow single BSSID with multiple SSID settings to work around some tricky AP which use space character as hidden SSID - * 1. correct logic - * 2. replace only BSS-DESC which doesn't have a valid SSID. - * - * 06 27 2011 cp.wu - * [WCXRP00000815] [MT6620 Wi-Fi][Driver] allow single BSSID with multiple SSID settings to work around some tricky AP which use space character as hidden SSID - * allow to have a single BSSID with multiple SSID to be presented in scanning result - * - * 05 12 2011 puff.wen - * NULL - * FW Assert information dump to driver - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 04 15 2011 cp.wu - * [WCXRP00000651] [MT6620 Wi-Fi][Driver] Refine RSSI buffering mechanism - * ROLLBACK due to the special design is to workaround incorrect initial RCPI value coming from firmware domain. - * - * 04 14 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * . - * - * 04 14 2011 cp.wu - * [WCXRP00000598] [MT6620 Wi-Fi][Driver] Implementation of interface for communicating with user space process for RESET_START and RESET_END events - * 1. add code to put whole-chip resetting trigger when abnormal firmware assertion is detected - * 2. add dummy function for both Win32 and Linux part. - * - * 04 12 2011 cp.wu - * [WCXRP00000635] [MT6620 Wi-Fi][Driver] Clear pending security frames when QM clear pending data frames for dedicated network type - * clear pending security frames for dedicated network type when BSS is being deactivated/disconnected - * - * 04 12 2011 wh.su - * NULL - * enable the p2p check the cipher to set the bssInfo auth mode. - * - * 04 12 2011 wh.su - * NULL - * prepare the code for sync the auth mode and encryption status for P2P and BOW. - * - * 04 11 2011 yuche.tsai - * [WCXRP00000627] [Volunteer Patch][MT6620][Driver] Pending MMPUD of P2P Network may crash system issue. - * Fix kernel panic issue when MMPDU of P2P is pending in driver. - * - * 04 10 2011 george.huang - * [WCXRP00000621] [MT6620 Wi-Fi][Driver] Support P2P supplicant to set power mode - * Fix compiler issue. - * - * 04 08 2011 george.huang - * [WCXRP00000621] [MT6620 Wi-Fi][Driver] Support P2P supplicant to set power mode - * separate settings of P2P and AIS - * - * 04 08 2011 eddie.chen - * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma - * Fix for sigma - * - * 04 07 2011 cp.wu - * [WCXRP00000616] [MT6620 Wi-Fi][Driver] Free memory to pool and kernel in case any unexpected failure happend inside wlanAdapterStart - * . - * - * 04 07 2011 cp.wu - * [WCXRP00000616] [MT6620 Wi-Fi][Driver] Free memory to pool and kernel in case any unexpected failure happend inside wlanAdapterStart - * implementation of internal error handling of nicAllocateAdapterMemory. - * - * 03 31 2011 chinglan.wang - * [WCXRP00000613] [MT6620 Wi-Fi] [FW] [Driver] BssInfo can get the security mode which is WPA/WPA2/WAPI or not. - * . - * - * 03 21 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * portability improvement - * - * 03 17 2011 cp.wu - * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period - * use pre-allocated buffer for storing enhanced interrupt response as well - * - * 03 16 2011 cp.wu - * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period - * 1. pre-allocate physical continuous buffer while module is being loaded - * 2. use pre-allocated physical continuous buffer for TX/RX DMA transfer - * - * The windows part remained the same as before, but added similiar APIs to hide the difference. - * - * 03 15 2011 cp.wu - * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous memory consumption - * 1. deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK - * 2. Use common coalescing buffer for both TX/RX directions - * - * - * 03 10 2011 cm.chang - * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module - * Add some functions to let AIS/Tethering or AIS/BOW be the same channel - * - * 03 07 2011 terry.wu - * [WCXRP00000521] [MT6620 Wi-Fi][Driver] Remove non-standard debug message - * Toggle non-standard debug messages to comments. - * - * 03 02 2011 cp.wu - * [WCXRP00000503] [MT6620 Wi-Fi][Driver] Take RCPI brought by association response as initial RSSI right after connection is built. - * use RCPI brought by ASSOC-RESP after connection is built as initial RCPI to avoid using a uninitialized MAC-RX RCPI. - * - * 02 08 2011 terry.wu - * [WCXRP00000412] [MT6620 Wi-Fi][FW/Driver] Dump firmware assert info at android kernel log - * Use kalPrint to print firmware assert info. - * - * 02 01 2011 terry.wu - * [WCXRP00000412] [MT6620 Wi-Fi][FW/Driver] Dump firmware assert info at android kernel log - * . - * - * 02 01 2011 cm.chang - * [WCXRP00000415] [MT6620 Wi-Fi][Driver] Check if any memory leakage happens when uninitializing in DGB mode - * . - * - * 01 31 2011 terry.wu - * [WCXRP00000412] [MT6620 Wi-Fi][FW/Driver] Dump firmware assert info at android kernel log - * Print firmware ASSERT info at Android kernel log, driver side - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * - * 01 26 2011 cm.chang - * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument - * Allocate system RAM if fixed message or mgmt buffer is not available - * - * 01 24 2011 cp.wu - * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving - * 1. add an extra counter for tracking pending forward frames. - * 2. notify TX service thread as well when there is pending forward frame - * 3. correct build errors leaded by introduction of Wi-Fi direct separation module - * - * 01 19 2011 cp.wu - * [WCXRP00000372] [MT6620 Wi-Fi][Driver] Check bus access failure inside nicProcessIST() - * check bus error and/or card removal when retrieving interrupt status from HAL - * - * 01 04 2011 cp.wu - * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands - * 1) correct typo in scan.c - * 2) TX descriptors, RX descriptos and management buffer should use virtually continous buffer instead of physically contineous one - * - * 01 04 2011 cp.wu - * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands - * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure - * - * 12 30 2010 cp.wu - * [WCXRP00000327] [MT6620 Wi-Fi][Driver] Improve HEC WHQA 6972 workaround coverage in driver side - * host driver not to set FW-own when there is still pending interrupts - * - * 12 17 2010 cp.wu - * [WCXRP00000270] [MT6620 Wi-Fi][Driver] Clear issues after concurrent networking support has been merged - * before BSS disconnection is indicated to firmware, all correlated peer should be cleared and freed - * - * 12 07 2010 cm.chang - * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk - * 1. BSSINFO include RLM parameter - * 2. free all sta records when network is disconnected - * - * 12 02 2010 eddie.chen - * [WCXRP00000218] [MT6620 Wi-Fi][Driver] Add auto rate window control in registry - * Add more control value but dont use it now. - * - * 11 30 2010 eddie.chen - * [WCXRP00000218] [MT6620 Wi-Fi][Driver] Add auto rate window control in registry - * Add auto rate check window in registry - * - * 11 10 2010 eddie.chen - * [WCXRP00000156] [MT6620][FW] Change Auto rate window to 64 and add throughput swcr - * Use autorate parameter 1 as phy rate mask. - * - * 11 08 2010 cp.wu - * [WCXRP00000166] [MT6620 Wi-Fi][Driver] use SDIO CMD52 for enabling/disabling interrupt to reduce transaction period - * change to use CMD52 for enabling/disabling interrupt to reduce SDIO transaction time - * - * 10 26 2010 eddie.chen - * [WCXRP00000134] [MT6620 Wi-Fi][Driver] Add a registry to enable auto rate for SQA test by using E1 EVB - * Add auto rate parameter in registry. - * - * 10 18 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * 1. remove redundant variables in STA_REC structure - * 2. add STA-REC uninitialization routine for clearing pending events - * - * 10 18 2010 cp.wu - * [WCXRP00000103] [MT6620 Wi-Fi][Driver] Driver crashed when using WZC to connect to AP#B with connection with AP#A - * reset ptrs when IEs are going to be dropped - * - * 10 12 2010 cp.wu - * [WCXRP00000084] [MT6620 Wi-Fi][Driver][FW] Add fixed rate support for distance test - * add HT (802.11n) fixed rate support. - * - * 10 08 2010 cp.wu - * [WCXRP00000084] [MT6620 Wi-Fi][Driver][FW] Add fixed rate support for distance test - * adding fixed rate support for distance test. (from registry setting) - * - * 10 07 2010 cp.wu - * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection - * add firmware download for MT5931. - * - * 10 05 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * load manufacture data when CFG_SUPPORT_NVRAM is set to 1 - * - * 10 04 2010 cp.wu - * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by ENUM_NETWORK_TYPE_INDEX_T only - * remove ENUM_NETWORK_TYPE_T definitions - * - * 09 21 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * Do a complete reset with STA-REC null checking for RF test re-entry - * - * 09 08 2010 cp.wu - * NULL - * use static memory pool for storing IEs of scanning result. - * - * 09 06 2010 cp.wu - * NULL - * Androi/Linux: return current operating channel information - * - * 09 01 2010 cp.wu - * NULL - * HIFSYS Clock Source Workaround - * - * 08 26 2010 yuche.tsai - * NULL - * Fix someones coding error while enable WIFI_DIRECT. - * - * 08 25 2010 george.huang - * NULL - * update OID/ registry control path for PM related settings - * - * 08 24 2010 cm.chang - * NULL - * Support RLM initail channel of Ad-hoc, P2P and BOW - * - * 08 24 2010 chinghwa.yu - * NULL - * Update BOW for the 1st time. - * - * 08 23 2010 chinghwa.yu - * NULL - * Update for BOW. - * - * 08 20 2010 yuche.tsai - * NULL - * Add state change indication. - * - * 08 16 2010 yuche.tsai - * NULL - * Add support for P2P BSS update info. - * - * 08 12 2010 cp.wu - * NULL - * [removing debugging] not to dump beacon content. - * - * 08 12 2010 cp.wu - * NULL - * [AIS-FSM] honor registry setting for adhoc running mode. (A/B/G) - * - * 08 11 2010 cp.wu - * NULL - * 1) do not use in-stack variable for beacon updating. (for MAUI porting) - * 2) extending scanning result to 64 instead of 48 - * - * 08 04 2010 yarco.yang - * NULL - * Add TX_AMPDU and ADDBA_REJECT command - * - * 08 03 2010 cp.wu - * NULL - * surpress compilation warning. - * - * 08 03 2010 cp.wu - * NULL - * Centralize mgmt/system service procedures into independent calls. - * - * 07 28 2010 cp.wu - * NULL - * 1) eliminate redundant variable eOPMode in prAdapter->rWlanInfo - * 2) change nicMediaStateChange() API prototype - * - * 07 28 2010 cp.wu - * NULL - * sync. CMD_BSS_INFO structure change to CMD-EVENT v0.15. - * - * 07 24 2010 wh.su - * - * .support the Wi-Fi RSN - * - * 07 23 2010 cp.wu - * - * FIX: structure of CMD_SET_BSS_INFO has been changed but no follow-ups are done. - * - * 07 22 2010 george.huang - * - * . - * - * 07 22 2010 george.huang - * - * Update fgIsQoS information in BSS INFO by CMD - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * Add Ad-Hoc support to AIS-FSM - * - * 07 14 2010 yarco.yang - * - * 1. Remove CFG_MQM_MIGRATION - * 2. Add CMD_UPDATE_WMM_PARMS command - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * update prStaRecOfAP with BSS-INFO. - * - * 07 06 2010 george.huang - * [WPD00001556]Basic power managemenet function - * Update arguments for nicUpdateBeaconIETemplate() - * - * 07 06 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * STA-REC is maintained by CNM only. - * - * 07 05 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) ignore RSN checking when RSN is not turned on. - * 2) set STA-REC deactivation callback as NULL - * 3) add variable initialization API based on PHY configuration - * - * 07 01 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Support sync command of STA_REC - * - * 06 30 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * sync. with CMD/EVENT document ver0.07. - * - * 06 29 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * correct variable naming for 8-bit variable used in CMD_BEACON_TEMPLATE_UPDATE. - * - * 06 29 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) sync to. CMD/EVENT document v0.03 - * 2) simplify DTIM period parsing in scan.c only, bss.c no longer parses it again. - * 3) send command packet to indicate FW-PM after - * a) 1st beacon is received after AIS has connected to an AP - * b) IBSS-ALONE has been created - * c) IBSS-MERGE has occured - * - * 06 25 2010 george.huang - * [WPD00001556]Basic power managemenet function - * Create beacon update path, with expose bssUpdateBeaconContent() - * - * 06 22 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * fill fgIsUapsdConnection when indicating BSS-CREATE with AIS-STA mode. - * - * 06 22 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) add command warpper for STA-REC/BSS-INFO sync. - * 2) enhance command packet sending procedure for non-oid part - * 3) add command packet definitions for STA-REC/BSS-INFO sync. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * implement TX_DONE callback path. - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * remove duplicate variable for migration. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * TX descriptors are now allocated once for reducing allocation overhead - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) eliminate CFG_CMD_EVENT_VERSION_0_9 - * 2) when disconnected, indicate nic directly (no event is needed) - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 04 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) surpress compiler warning - * 2) when acqruing LP-own, keep writing WHLPCR whenever OWN is not acquired yet - * - * 04 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * surpress compiler warning - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * * * * * * * * * * 2) command sequence number is now increased atomically - * * * * * * * * * * * * * 3) private data could be hold and taken use for other purpose - * - * 04 12 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add channel frequency <-> number conversion - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer - * - * 04 06 2010 cp.wu - * [WPD00003827][MT6620 Wi-Fi] Chariot fail and following ping fail, no pkt send from driver - * correct nicProcessIST_impl() for interrupt status brought up by RX enhanced response - * - * 03 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) add ACPI D0/D3 state switching support - * * * * * * * 2) use more formal way to handle interrupt when the status is retrieved from enhanced RX response - * - * 03 17 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * always process TX interrupt first then RX interrupt. - * - * 02 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct behavior to prevent duplicated RX handling for RX0_DONE and RX1_DONE - * - * 02 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add checksum offloading support. -** \main\maintrunk.MT6620WiFiDriver_Prj\27 2009-12-16 18:03:43 GMT mtk02752 -** handling enhanced response which fields are fetched at different moments -** \main\maintrunk.MT6620WiFiDriver_Prj\26 2009-12-15 17:00:29 GMT mtk02752 -** if RX enhanced response is used, D2H interrupt status should be coming from buffered result as well -** \main\maintrunk.MT6620WiFiDriver_Prj\25 2009-12-15 12:01:55 GMT mtk02752 -** if TX_DONE bit is not set but WTSR0/WTSR1 is non-zero, then set TX_DONE bit due to time latency of interrupt status enhanced response -** \main\maintrunk.MT6620WiFiDriver_Prj\24 2009-12-10 16:52:52 GMT mtk02752 -** code clean -** \main\maintrunk.MT6620WiFiDriver_Prj\23 2009-11-24 20:51:01 GMT mtk02752 -** integrate with SD1 by invoking qmHandleMailboxRxMessage() -** \main\maintrunk.MT6620WiFiDriver_Prj\22 2009-11-16 17:32:33 GMT mtk02752 -** prepare code for invoking rxHandleMailboxRxMessage() -** \main\maintrunk.MT6620WiFiDriver_Prj\21 2009-11-11 10:36:08 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\20 2009-11-09 22:56:41 GMT mtk01084 -** modify HW access routines -** \main\maintrunk.MT6620WiFiDriver_Prj\19 2009-10-30 18:17:20 GMT mtk01084 -** prevent warning -** \main\maintrunk.MT6620WiFiDriver_Prj\18 2009-10-29 19:54:57 GMT mtk01084 -** init HIF -** \main\maintrunk.MT6620WiFiDriver_Prj\17 2009-10-23 16:08:30 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-10-13 21:59:12 GMT mtk01084 -** update for new HW design -** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-09-09 17:26:15 GMT mtk01084 -** modify for CFG_TEST_WITH_MT5921 -** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-05-19 10:55:22 GMT mtk01461 -** Unmask the unused HISR -** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-05-18 15:59:13 GMT mtk01084 -** remove debug purpose code -** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-05-18 14:05:02 GMT mtk01084 -** update for WIFI ownback part on initial -** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-05-04 21:32:57 GMT mtk01084 -** add temporarily code to set driver own on adapter initialization -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-04-28 10:35:41 GMT mtk01461 -** Add init of TX aggregation and fix RX STATUS is DW align for SDIO_STATUS_ENHANCE mode -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-04-24 21:12:10 GMT mtk01104 -** Add function nicRestoreSpiDefMode() -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-04-21 09:43:31 GMT mtk01461 -** Revise for MTK coding style - nicInitializeAdapter() -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-04-17 19:52:47 GMT mtk01461 -** Update allocate Adapter Memory for MGMT Memory pool -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-01 10:57:08 GMT mtk01461 -** Refine the order of release memory from pucRxCoalescingBufCached -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-03-19 18:32:57 GMT mtk01084 -** update for basic power management functions -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-18 21:00:14 GMT mtk01426 -** Add CFG_SDIO_RX_ENHANCE support -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-16 09:10:27 GMT mtk01461 -** Update TX PATH API -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:25:59 GMT mtk01426 -** Init for develop -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -const UINT_8 aucPhyCfg2PhyTypeSet[PHY_CONFIG_NUM] = -{ - PHY_TYPE_SET_802_11ABG, /* PHY_CONFIG_802_11ABG */ - PHY_TYPE_SET_802_11BG, /* PHY_CONFIG_802_11BG */ - PHY_TYPE_SET_802_11G, /* PHY_CONFIG_802_11G */ - PHY_TYPE_SET_802_11A, /* PHY_CONFIG_802_11A */ - PHY_TYPE_SET_802_11B, /* PHY_CONFIG_802_11B */ - PHY_TYPE_SET_802_11ABGN, /* PHY_CONFIG_802_11ABGN */ - PHY_TYPE_SET_802_11BGN, /* PHY_CONFIG_802_11BGN */ - PHY_TYPE_SET_802_11AN, /* PHY_CONFIG_802_11AN */ - PHY_TYPE_SET_802_11GN /* PHY_CONFIG_802_11GN */ -}; - -#if (MT6620_E1_ASIC_HIFSYS_WORKAROUND == 1) - #define REQ_GATING_ENABLE_H2D_INT BIT(31) - #define REQ_GATING_DISABLE_H2D_INT BIT(30) - #define ACK_GATING_ENABLE_D2H_INT BIT(31) - #define ACK_GATING_DISABLE_D2H_INT BIT(30) - - #define GATING_CONTROL_POLL_LIMIT 64 -#endif - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -static INT_EVENT_MAP_T arIntEventMapTable[] = { - {WHISR_ABNORMAL_INT, INT_EVENT_ABNORMAL}, - {WHISR_D2H_SW_INT, INT_EVENT_SW_INT}, - {WHISR_TX_DONE_INT, INT_EVENT_TX}, - {(WHISR_RX0_DONE_INT | WHISR_RX1_DONE_INT), INT_EVENT_RX} -}; - -static const UINT_8 ucIntEventMapSize = (sizeof(arIntEventMapTable) / sizeof(INT_EVENT_MAP_T)); - -static IST_EVENT_FUNCTION apfnEventFuncTable[] = { - nicProcessAbnormalInterrupt, /*!< INT_EVENT_ABNORMAL */ - nicProcessSoftwareInterrupt, /*!< INT_EVENT_SW_INT */ - nicProcessTxInterrupt, /*!< INT_EVENT_TX */ - nicProcessRxInterrupt, /*!< INT_EVENT_RX */ -}; -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -/*! This macro is used to reduce coding errors inside nicAllocateAdapterMemory() - * and also enhance the readability. - */ -#define LOCAL_NIC_ALLOCATE_MEMORY(pucMem, u4Size, eMemType, pucComment) \ - { \ - DBGLOG(INIT, INFO, ("Allocating %ld bytes for %s.\n", u4Size, pucComment)); \ - if ((pucMem = (PUINT_8)kalMemAlloc(u4Size, eMemType)) == (PUINT_8)NULL) { \ - DBGLOG(INIT, ERROR, ("Could not allocate %ld bytes for %s.\n", u4Size, pucComment)); \ - break; \ - } \ - ASSERT(((UINT_32)pucMem % 4) == 0); \ - DBGLOG(INIT, INFO, ("Virtual Address = %08lx for %s.\n", (UINT_32)pucMem, pucComment)); \ - } - - - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This routine is responsible for the allocation of the data structures -* inside the Adapter structure, include: -* 1. SW_RFB_Ts -* 2. Common coalescing buffer for TX PATH. -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @retval WLAN_STATUS_SUCCESS - Has enough memory. -* @retval WLAN_STATUS_RESOURCES - Memory is not enough. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicAllocateAdapterMemory ( - IN P_ADAPTER_T prAdapter - ) -{ - WLAN_STATUS status = WLAN_STATUS_RESOURCES; - P_RX_CTRL_T prRxCtrl; - P_TX_CTRL_T prTxCtrl; - - DEBUGFUNC("nicAllocateAdapterMemory"); - - ASSERT(prAdapter); - prRxCtrl = &prAdapter->rRxCtrl; - prTxCtrl = &prAdapter->rTxCtrl; - - do { - //4 <0> Reset all Memory Handler - #if CFG_DBG_MGT_BUF - prAdapter->u4MemFreeDynamicCount = 0; - prAdapter->u4MemAllocDynamicCount = 0; - #endif - prAdapter->pucMgtBufCached = (PUINT_8)NULL; - prRxCtrl->pucRxCached = (PUINT_8)NULL; - prAdapter->prSDIOCtrl = (P_SDIO_CTRL_T)NULL; - - - //4 <1> Memory for Management Memory Pool and CMD_INFO_T - /* Allocate memory for the CMD_INFO_T and its MGMT memory pool. */ - prAdapter->u4MgtBufCachedSize = MGT_BUFFER_SIZE; - - LOCAL_NIC_ALLOCATE_MEMORY(prAdapter->pucMgtBufCached, - prAdapter->u4MgtBufCachedSize, - VIR_MEM_TYPE, - "COMMON MGMT MEMORY POOL"); - - //4 <2> Memory for RX Descriptor - /* Initialize the number of rx buffers we will have in our queue. */ - /* We may setup ucRxPacketDescriptors by GLUE Layer, and using - * this variable directly. - */ - /* Allocate memory for the SW receive structures. */ - prRxCtrl->u4RxCachedSize = CFG_RX_MAX_PKT_NUM * \ - ALIGN_4(sizeof(SW_RFB_T)); - - LOCAL_NIC_ALLOCATE_MEMORY(prRxCtrl->pucRxCached, - prRxCtrl->u4RxCachedSize, - VIR_MEM_TYPE, - "SW_RFB_T"); - - //4 <3> Memory for TX DEscriptor - prTxCtrl->u4TxCachedSize = CFG_TX_MAX_PKT_NUM * \ - ALIGN_4(sizeof(MSDU_INFO_T)); - - LOCAL_NIC_ALLOCATE_MEMORY(prTxCtrl->pucTxCached, - prTxCtrl->u4TxCachedSize, - VIR_MEM_TYPE, - "MSDU_INFO_T"); - - //4 <4> Memory for Common Coalescing Buffer -#if CFG_COALESCING_BUFFER_SIZE || CFG_SDIO_RX_AGG - prAdapter->pucCoalescingBufCached = (PUINT_8)NULL; - - /* Allocate memory for the common coalescing buffer. */ - prAdapter->u4CoalescingBufCachedSize = CFG_COALESCING_BUFFER_SIZE > CFG_RX_COALESCING_BUFFER_SIZE ? - CFG_COALESCING_BUFFER_SIZE : CFG_RX_COALESCING_BUFFER_SIZE; - - prAdapter->pucCoalescingBufCached = - kalAllocateIOBuffer(prAdapter->u4CoalescingBufCachedSize); - - if(prAdapter->pucCoalescingBufCached == NULL) { - DBGLOG(INIT, ERROR, ("Could not allocate %ld bytes for coalescing buffer.\n", prAdapter->u4CoalescingBufCachedSize)); - break; - } -#endif /* CFG_COALESCING_BUFFER_SIZE */ - - //4 <5> Memory for enhanced interrupt response - prAdapter->prSDIOCtrl = (P_SDIO_CTRL_T) - kalAllocateIOBuffer(sizeof(ENHANCE_MODE_DATA_STRUCT_T)); - - if(prAdapter->prSDIOCtrl == NULL) { - DBGLOG(INIT, ERROR, ("Could not allocate %ld bytes for interrupt response.\n", sizeof(ENHANCE_MODE_DATA_STRUCT_T))); - break; - } - - status = WLAN_STATUS_SUCCESS; - - } - while(FALSE); - - if(status != WLAN_STATUS_SUCCESS) { - nicReleaseAdapterMemory(prAdapter); - } - - return status; - -} /* end of nicAllocateAdapterMemory() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This routine is responsible for releasing the allocated memory by -* nicAllocatedAdapterMemory(). -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicReleaseAdapterMemory ( - IN P_ADAPTER_T prAdapter - ) -{ - P_TX_CTRL_T prTxCtrl; - P_RX_CTRL_T prRxCtrl; - - ASSERT(prAdapter); - prTxCtrl = &prAdapter->rTxCtrl; - prRxCtrl = &prAdapter->rRxCtrl; - - //4 <5> Memory for enhanced interrupt response - if (prAdapter->prSDIOCtrl) { - kalReleaseIOBuffer((PVOID)prAdapter->prSDIOCtrl, sizeof(ENHANCE_MODE_DATA_STRUCT_T)); - prAdapter->prSDIOCtrl = (P_SDIO_CTRL_T)NULL; - } - - //4 <4> Memory for Common Coalescing Buffer -#if CFG_COALESCING_BUFFER_SIZE || CFG_SDIO_RX_AGG - if (prAdapter->pucCoalescingBufCached) { - kalReleaseIOBuffer((PVOID)prAdapter->pucCoalescingBufCached, prAdapter->u4CoalescingBufCachedSize); - prAdapter->pucCoalescingBufCached = (PUINT_8)NULL; - } -#endif /* CFG_COALESCING_BUFFER_SIZE */ - - //4 <3> Memory for TX Descriptor - if (prTxCtrl->pucTxCached) { - kalMemFree((PVOID)prTxCtrl->pucTxCached, - VIR_MEM_TYPE, - prTxCtrl->u4TxCachedSize); - prTxCtrl->pucTxCached = (PUINT_8)NULL; - } - - //4 <2> Memory for RX Descriptor - if (prRxCtrl->pucRxCached) { - kalMemFree((PVOID)prRxCtrl->pucRxCached, - VIR_MEM_TYPE, - prRxCtrl->u4RxCachedSize); - prRxCtrl->pucRxCached = (PUINT_8)NULL; - } - - //4 <1> Memory for Management Memory Pool - if (prAdapter->pucMgtBufCached) { - kalMemFree((PVOID)prAdapter->pucMgtBufCached, - VIR_MEM_TYPE, - prAdapter->u4MgtBufCachedSize); - prAdapter->pucMgtBufCached = (PUINT_8)NULL; - } - -#if CFG_DBG_MGT_BUF - /* Check if all allocated memories are free */ - ASSERT(prAdapter->u4MemFreeDynamicCount == - prAdapter->u4MemAllocDynamicCount); -#endif - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief disable global interrupt -* -* @param prAdapter pointer to the Adapter handler -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicDisableInterrupt ( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - HAL_BYTE_WR(prAdapter, MCR_WHLPCR, WHLPCR_INT_EN_CLR); - - prAdapter->fgIsIntEnable = FALSE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief enable global interrupt -* -* @param prAdapter pointer to the Adapter handler -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicEnableInterrupt ( - IN P_ADAPTER_T prAdapter - ) -{ - BOOLEAN fgIsIntEnableCache; - - - ASSERT(prAdapter); - fgIsIntEnableCache = prAdapter->fgIsIntEnable; - - prAdapter->fgIsIntEnable = TRUE; // NOTE(Kevin): It must be placed before MCR GINT write. - - /* If need enable INT and also set LPOwn at the same time. */ - if (prAdapter->fgIsIntEnableWithLPOwnSet) { - prAdapter->fgIsIntEnableWithLPOwnSet = FALSE; /* NOTE(Kevin): It's better to place it - * before MCR GINT write. - */ - /* If INT was enabled, only set LPOwn */ - if (fgIsIntEnableCache) { - HAL_MCR_WR(prAdapter, MCR_WHLPCR, WHLPCR_FW_OWN_REQ_SET); - prAdapter->fgIsFwOwn = TRUE; - } - /* If INT was not enabled, enable it and also set LPOwn now */ - else { - HAL_MCR_WR(prAdapter, MCR_WHLPCR, WHLPCR_FW_OWN_REQ_SET | - WHLPCR_INT_EN_SET); - prAdapter->fgIsFwOwn = TRUE; - } - } - /* If INT was not enabled, enable it now */ - else if (!fgIsIntEnableCache) { - HAL_BYTE_WR(prAdapter, MCR_WHLPCR, WHLPCR_INT_EN_SET); - } - - return; -} /* end of nicEnableInterrupt() */ - - -#if CFG_SDIO_INTR_ENHANCE -/*----------------------------------------------------------------------------*/ -/*! -* @brief For SDIO enhance mode, set the max rx len and tx status -* -* @param prAdapter a pointer to adapter private data structure. -* -* @return - none -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicSDIOInit ( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 u4Value = 0; - - ASSERT(prAdapter); - - //4 <1> Check STATUS Buffer is DW alignment. - ASSERT( IS_ALIGN_4( (UINT_32)&prAdapter->prSDIOCtrl->u4WHISR ) ); - - //4 <2> Setup STATUS count. - { - HAL_MCR_RD(prAdapter, MCR_WHCR, &u4Value); - - //4 <2.1> Setup the number of maximum RX length to be report - u4Value &= ~(WHCR_MAX_HIF_RX_LEN_NUM); - u4Value |= ((SDIO_MAXIMUM_RX_LEN_NUM << WHCR_OFFSET_MAX_HIF_RX_LEN_NUM)); - - //4 <2.2> Setup RX enhancement mode -#if CFG_SDIO_RX_ENHANCE - u4Value |= WHCR_RX_ENHANCE_MODE_EN; -#else - u4Value &= ~WHCR_RX_ENHANCE_MODE_EN; -#endif /* CFG_SDIO_RX_AGG */ - - HAL_MCR_WR(prAdapter, MCR_WHCR, u4Value); - } - - return; - -} /* end of nicSDIOInit() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Read interrupt status from hardware -* -* @param prAdapter pointer to the Adapter handler -* @param the interrupts -* -* @return N/A -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicSDIOReadIntStatus ( - IN P_ADAPTER_T prAdapter, - OUT PUINT_32 pu4IntStatus - ) -{ - P_SDIO_CTRL_T prSDIOCtrl; - - DEBUGFUNC("nicSDIOReadIntStatus"); - - ASSERT(prAdapter); - ASSERT(pu4IntStatus); - - prSDIOCtrl = prAdapter->prSDIOCtrl; - ASSERT(prSDIOCtrl); - - HAL_PORT_RD(prAdapter, - MCR_WHISR, - sizeof(ENHANCE_MODE_DATA_STRUCT_T), - (PUINT_8)prSDIOCtrl, - sizeof(ENHANCE_MODE_DATA_STRUCT_T)); - - if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - *pu4IntStatus = 0; - return; - } - - /* workaround */ - if((prSDIOCtrl->u4WHISR & WHISR_TX_DONE_INT) == 0 && - (prSDIOCtrl->rTxInfo.au4WTSR[0] | prSDIOCtrl->rTxInfo.au4WTSR[1])) { - prSDIOCtrl->u4WHISR |= WHISR_TX_DONE_INT; - } - - if((prSDIOCtrl->u4WHISR & BIT(31)) == 0 && - HAL_GET_MAILBOX_READ_CLEAR(prAdapter) == TRUE && - (prSDIOCtrl->u4RcvMailbox0 != 0 || prSDIOCtrl->u4RcvMailbox1 != 0)) { - prSDIOCtrl->u4WHISR |= BIT(31); - } - - *pu4IntStatus = prSDIOCtrl->u4WHISR; - - return; -} /* end of nicSDIOReadIntStatus() */ -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* @brief The function used to read interrupt status and then invoking -* dispatching procedure for the appropriate functions -* corresponding to specific interrupt bits -* -* @param prAdapter pointer to the Adapter handler -* -* @retval WLAN_STATUS_SUCCESS -* @retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicProcessIST ( - IN P_ADAPTER_T prAdapter - ) -{ - WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS; - UINT_32 u4IntStatus = 0; - UINT_32 i; - - DEBUGFUNC("nicProcessIST"); - //DBGLOG(INIT, LOUD, ("\n")); - - ASSERT(prAdapter); - - if (prAdapter->rAcpiState == ACPI_STATE_D3) { - DBGLOG(REQ, WARN, ("Fail in set nicProcessIST! (Adapter not ready). ACPI=D%d, Radio=%d\n", - prAdapter->rAcpiState, prAdapter->fgIsRadioOff)); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - -#if (MT6620_E1_ASIC_HIFSYS_WORKAROUND == 1) - if(prAdapter->fgIsClockGatingEnabled == TRUE) { - nicDisableClockGating(prAdapter); - } -#endif - - for (i = 0; i < CFG_IST_LOOP_COUNT; i++) { - -#if CFG_SDIO_INTR_ENHANCE - nicSDIOReadIntStatus(prAdapter, &u4IntStatus); -#else - HAL_MCR_RD(prAdapter, MCR_WHISR, &u4IntStatus); -#endif /* CFG_SDIO_INTR_ENHANCE */ - - //DBGLOG(INIT, TRACE, ("u4IntStatus: 0x%x\n", u4IntStatus)); - - if (u4IntStatus & ~(WHIER_DEFAULT | WHIER_FW_OWN_BACK_INT_EN)) { - DBGLOG(INTR, WARN, ("Un-handled HISR %#x, HISR = %#x (HIER:0x%x)\n", - (u4IntStatus & ~WHIER_DEFAULT), u4IntStatus, WHIER_DEFAULT)); - u4IntStatus &= WHIER_DEFAULT; - } - - nicProcessIST_impl(prAdapter, u4IntStatus); - - if(u4IntStatus == 0) { - if(i == 0) { - u4Status = WLAN_STATUS_NOT_INDICATING; - } - break; - } - } - -#if (MT6620_E1_ASIC_HIFSYS_WORKAROUND == 1) - if(prAdapter->fgIsClockGatingEnabled == FALSE) { - nicEnableClockGating(prAdapter); - } -#endif - - return u4Status; -} /* end of nicProcessIST() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief The function used to dispatch the appropriate functions for specific -* interrupt bits -* -* @param prAdapter pointer to the Adapter handler -* u4IntStatus interrupt status bits -* -* @retval WLAN_STATUS_SUCCESS -* @retval WLAN_STATUS_ADAPTER_NOT_READY -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicProcessIST_impl ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4IntStatus - ) -{ - UINT_32 u4IntCount = 0; - P_INT_EVENT_MAP_T prIntEventMap = NULL; - - ASSERT(prAdapter); - - prAdapter->u4IntStatus = u4IntStatus; - - /* Process each of the interrupt status consequently */ - prIntEventMap = &arIntEventMapTable[0]; - for (u4IntCount = 0; u4IntCount < ucIntEventMapSize; prIntEventMap++, u4IntCount++) { - if (prIntEventMap->u4Int & prAdapter->u4IntStatus) { - if(prIntEventMap->u4Event == INT_EVENT_RX && - prAdapter->fgIsEnterD3ReqIssued == TRUE) { - // ignore - } - else if (apfnEventFuncTable[prIntEventMap->u4Event] != NULL) { - apfnEventFuncTable[prIntEventMap->u4Event](prAdapter); - } - else { - DBGLOG(INTR , WARN, - ("Empty INTR handler! ISAR bit#: %ld, event:%d, func: 0x%x\n", - prIntEventMap->u4Int, prIntEventMap->u4Event, apfnEventFuncTable[prIntEventMap->u4Event])); - - ASSERT(0); // to trap any NULL interrupt handler - } - prAdapter->u4IntStatus &= ~prIntEventMap->u4Int; - } - } - - return WLAN_STATUS_SUCCESS; -} /* end of nicProcessIST_impl() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Verify the CHIP ID -* -* @param prAdapter a pointer to adapter private data structure. -* -* -* @retval TRUE CHIP ID is the same as the setting compiled -* @retval FALSE CHIP ID is different from the setting compiled -*/ -/*----------------------------------------------------------------------------*/ -BOOL -nicVerifyChipID ( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 u4CIR = 0; - - ASSERT(prAdapter); - - HAL_MCR_RD(prAdapter, MCR_WCIR, &u4CIR ); - - DBGLOG(INIT, TRACE,("Chip ID: 0x%x\n", u4CIR & WCIR_CHIP_ID)); - DBGLOG(INIT, TRACE,("Revision ID: 0x%x\n", ((u4CIR & WCIR_REVISION_ID) >> 16))); - - if ((u4CIR & WCIR_CHIP_ID) != MTK_CHIP_REV) { - return FALSE; - } - - prAdapter->ucRevID = (UINT_8)(((u4CIR & WCIR_REVISION_ID) >> 16) & 0xF) ; - - return TRUE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Initialize the MCR to the appropriate init value, and verify the init -* value -* -* @param prAdapter a pointer to adapter private data structure. -* -* @return - -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicMCRInit ( - IN P_ADAPTER_T prAdapter - ) -{ - - ASSERT(prAdapter); - - //4 <0> Initial value -} - -VOID -nicHifInit ( - IN P_ADAPTER_T prAdapter - ) -{ - - ASSERT(prAdapter); -#if 0 - /* reset event */ - nicPutMailbox(prAdapter, 0, 0x52455345); // RESE - nicPutMailbox(prAdapter, 1, 0x545F5746); // T_WF - nicSetSwIntr(prAdapter, BIT(16)); -#endif -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Initialize the Adapter soft variable -* -* @param prAdapter pointer to the Adapter handler -* -* @return (none) -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicInitializeAdapter ( - IN P_ADAPTER_T prAdapter - ) -{ - WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS; - - ASSERT(prAdapter); - - prAdapter->fgIsIntEnableWithLPOwnSet = FALSE; - - do { - if (!nicVerifyChipID(prAdapter)) { - u4Status = WLAN_STATUS_FAILURE; - break; - } - - //4 <1> MCR init - nicMCRInit(prAdapter); - - #if CFG_SDIO_INTR_ENHANCE - nicSDIOInit(prAdapter); - #endif /* CFG_SDIO_INTR_ENHANCE */ - - HAL_MCR_WR(prAdapter, MCR_WHIER, WHIER_DEFAULT); - - - //4 <2> init FW HIF - nicHifInit(prAdapter); - } - while (FALSE); - - - return u4Status; -} - - -#if defined(_HIF_SPI) -/*----------------------------------------------------------------------------*/ -/*! -* \brief Restore the SPI Mode Select to default mode, -* this is important while driver is unload, and this must be last mcr -* since the operation will let the hif use 8bit mode access -* -* \param[in] prAdapter a pointer to adapter private data structure. -* \param[in] eGPIO2_Mode GPIO2 operation mode -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -void -nicRestoreSpiDefMode ( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - HAL_MCR_WR(prAdapter, MCR_WCSR, SPICSR_8BIT_MODE_DATA); - -} -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process rx interrupt. When the rx -* Interrupt is asserted, it means there are frames in queue. -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicProcessAbnormalInterrupt ( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 u4Value; - - HAL_MCR_RD(prAdapter, MCR_WASR, &u4Value); - DBGLOG(REQ, WARN, ("MCR_WASR: 0x%x \n", u4Value)); -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief . -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicProcessFwOwnBackInterrupt( - IN P_ADAPTER_T prAdapter - ) -{ - - return; -} /* end of nicProcessFwOwnBackInterrupt() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief . -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicProcessSoftwareInterrupt( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 u4IntrBits; - - ASSERT(prAdapter); - - u4IntrBits = prAdapter->u4IntStatus & BITS(8, 31); - - if((u4IntrBits & WHISR_D2H_SW_ASSERT_INFO_INT) != 0) { - nicPrintFirmwareAssertInfo(prAdapter); -#if CFG_CHIP_RESET_SUPPORT - glSendResetRequest(); -#endif - } - -#if (MT6620_E1_ASIC_HIFSYS_WORKAROUND == 1) - ASSERT((u4IntrBits & (ACK_GATING_ENABLE_D2H_INT | ACK_GATING_DISABLE_D2H_INT)) - != (ACK_GATING_ENABLE_D2H_INT | ACK_GATING_DISABLE_D2H_INT)); - - if(u4IntrBits & ACK_GATING_ENABLE_D2H_INT) { - prAdapter->fgIsClockGatingEnabled = TRUE; - } - - if(u4IntrBits & ACK_GATING_DISABLE_D2H_INT) { - prAdapter->fgIsClockGatingEnabled = FALSE; - - // Indicate Service Thread for TX - if(kalGetTxPendingCmdCount(prAdapter->prGlueInfo) > 0 - || wlanGetTxPendingFrameCount(prAdapter) > 0) { - kalSetEvent(prAdapter->prGlueInfo); - } - } -#endif - - DBGLOG(REQ, WARN, ("u4IntrBits: 0x%x \n", u4IntrBits)); - - return; -} /* end of nicProcessSoftwareInterrupt() */ - -VOID -nicPutMailbox ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4MailboxNum, - IN UINT_32 u4Data - ) -{ - if (u4MailboxNum == 0) { - HAL_MCR_WR(prAdapter, MCR_H2DSM0R, u4Data); - } else if (u4MailboxNum == 1) { - HAL_MCR_WR(prAdapter, MCR_H2DSM1R, u4Data); - } else { - ASSERT(0); - } -} - -VOID -nicGetMailbox ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4MailboxNum, - OUT PUINT_32 pu4Data - ) -{ - if (u4MailboxNum == 0) { - HAL_MCR_RD(prAdapter, MCR_D2HRM0R, pu4Data); - } else if (u4MailboxNum == 1) { - HAL_MCR_RD(prAdapter, MCR_D2HRM1R, pu4Data); - } else { - ASSERT(0); - } -} - -VOID -nicSetSwIntr ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4SwIntrBitmap - ) -{ - /* NOTE: - * SW interrup in HW bit 16 is mapping to SW bit 0 (shift 16bit in HW transparancy) - * SW interrupt valid from b0~b15 - */ - ASSERT((u4SwIntrBitmap & BITS(0, 15)) == 0); -// DBGLOG(INIT, TRACE, ("u4SwIntrBitmap: 0x%08x\n", u4SwIntrBitmap)); - - HAL_MCR_WR(prAdapter, MCR_WSICR, u4SwIntrBitmap); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This procedure is used to dequeue from prAdapter->rPendingCmdQueue -* with specified sequential number -* -* @param prAdapter Pointer of ADAPTER_T -* ucSeqNum Sequential Number -* -* @retval - P_CMD_INFO_T -*/ -/*----------------------------------------------------------------------------*/ -P_CMD_INFO_T -nicGetPendingCmdInfo ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucSeqNum - ) -{ - P_QUE_T prCmdQue; - QUE_T rTempCmdQue; - P_QUE_T prTempCmdQue = &rTempCmdQue; - P_QUE_ENTRY_T prQueueEntry = (P_QUE_ENTRY_T)NULL; - P_CMD_INFO_T prCmdInfo = (P_CMD_INFO_T)NULL; - - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_PENDING); - - prCmdQue = &prAdapter->rPendingCmdQueue; - QUEUE_MOVE_ALL(prTempCmdQue, prCmdQue); - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - while (prQueueEntry) { - prCmdInfo = (P_CMD_INFO_T)prQueueEntry; - - if(prCmdInfo->ucCmdSeqNum == ucSeqNum) - break; - else { - QUEUE_INSERT_TAIL(prCmdQue, prQueueEntry); - - prCmdInfo = NULL; - } - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - } - QUEUE_CONCATENATE_QUEUES(prCmdQue, prTempCmdQue); - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_PENDING); - - return prCmdInfo; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This procedure is used to dequeue from prAdapter->rTxCtrl.rTxMgmtTxingQueue -* with specified sequential number -* -* @param prAdapter Pointer of ADAPTER_T -* ucSeqNum Sequential Number -* -* @retval - P_MSDU_INFO_T -*/ -/*----------------------------------------------------------------------------*/ -P_MSDU_INFO_T -nicGetPendingTxMsduInfo ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucSeqNum - ) -{ - P_QUE_T prTxingQue; - QUE_T rTempQue; - P_QUE_T prTempQue = &rTempQue; - P_QUE_ENTRY_T prQueueEntry = (P_QUE_ENTRY_T)NULL; - P_MSDU_INFO_T prMsduInfo = (P_MSDU_INFO_T)NULL; - - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TXING_MGMT_LIST); - - prTxingQue = &(prAdapter->rTxCtrl.rTxMgmtTxingQueue); - QUEUE_MOVE_ALL(prTempQue, prTxingQue); - - QUEUE_REMOVE_HEAD(prTempQue, prQueueEntry, P_QUE_ENTRY_T); - while (prQueueEntry) { - prMsduInfo = (P_MSDU_INFO_T)prQueueEntry; - - if(prMsduInfo->ucTxSeqNum == ucSeqNum) - break; - else { - QUEUE_INSERT_TAIL(prTxingQue, prQueueEntry); - - prMsduInfo = NULL; - } - - QUEUE_REMOVE_HEAD(prTempQue, prQueueEntry, P_QUE_ENTRY_T); - } - QUEUE_CONCATENATE_QUEUES(prTxingQue, prTempQue); - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TXING_MGMT_LIST); - - return prMsduInfo; -} - -P_MSDU_INFO_T -nicGetPendingStaMMPDU ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucStaRecIdx - ) -{ - P_MSDU_INFO_T prMsduInfoListHead = (P_MSDU_INFO_T)NULL; - P_QUE_T prTxingQue = (P_QUE_T)NULL; - QUE_T rTempQue; - P_QUE_T prTempQue = &rTempQue; - P_QUE_ENTRY_T prQueueEntry = (P_QUE_ENTRY_T)NULL; - P_MSDU_INFO_T prMsduInfo = (P_MSDU_INFO_T)NULL; - - GLUE_SPIN_LOCK_DECLARATION(); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TXING_MGMT_LIST); - do { - if (prAdapter == NULL) { - - ASSERT(FALSE); - break; - } - - prTxingQue = &(prAdapter->rTxCtrl.rTxMgmtTxingQueue); - QUEUE_MOVE_ALL(prTempQue, prTxingQue); - - QUEUE_REMOVE_HEAD(prTempQue, prQueueEntry, P_QUE_ENTRY_T); - while (prQueueEntry) { - prMsduInfo = (P_MSDU_INFO_T)prQueueEntry; - - if ((prMsduInfo->ucStaRecIndex == ucStaRecIdx) && (prMsduInfo->pfTxDoneHandler != NULL)) { - QM_TX_SET_NEXT_MSDU_INFO(prMsduInfo, - prMsduInfoListHead); - prMsduInfoListHead = prMsduInfo; - } - else { - QUEUE_INSERT_TAIL(prTxingQue, prQueueEntry); - - prMsduInfo = NULL; - } - - - QUEUE_REMOVE_HEAD(prTempQue, prQueueEntry, P_QUE_ENTRY_T); - } - - } while (FALSE); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TXING_MGMT_LIST); - - - return prMsduInfoListHead; -} /* nicGetPendingStaMMPDU */ - - -VOID -nicFreePendingTxMsduInfoByNetwork ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkType - ) -{ - P_QUE_T prTxingQue; - QUE_T rTempQue; - P_QUE_T prTempQue = &rTempQue; - P_QUE_ENTRY_T prQueueEntry = (P_QUE_ENTRY_T)NULL; - P_MSDU_INFO_T prMsduInfoListHead = (P_MSDU_INFO_T)NULL; - P_MSDU_INFO_T prMsduInfoListTail = (P_MSDU_INFO_T)NULL; - P_MSDU_INFO_T prMsduInfo = (P_MSDU_INFO_T)NULL; - - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TXING_MGMT_LIST); - - prTxingQue = &(prAdapter->rTxCtrl.rTxMgmtTxingQueue); - QUEUE_MOVE_ALL(prTempQue, prTxingQue); - - QUEUE_REMOVE_HEAD(prTempQue, prQueueEntry, P_QUE_ENTRY_T); - while (prQueueEntry) { - prMsduInfo = (P_MSDU_INFO_T)prQueueEntry; - - if((ENUM_NETWORK_TYPE_INDEX_T)(prMsduInfo->ucNetworkType) == eNetworkType) { - if(prMsduInfoListHead == NULL) { - prMsduInfoListHead = prMsduInfoListTail = prMsduInfo; - } - else { - QM_TX_SET_NEXT_MSDU_INFO(prMsduInfoListTail, prMsduInfo); - prMsduInfoListTail = prMsduInfo; - } - } - else { - QUEUE_INSERT_TAIL(prTxingQue, prQueueEntry); - - prMsduInfo = NULL; - } - - QUEUE_REMOVE_HEAD(prTempQue, prQueueEntry, P_QUE_ENTRY_T); - } - QUEUE_CONCATENATE_QUEUES(prTxingQue, prTempQue); - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TXING_MGMT_LIST); - - /* free */ - if(prMsduInfoListHead) { - nicTxFreeMsduInfoPacket(prAdapter, prMsduInfoListHead); - } - - return; - -} /* end of nicFreePendingTxMsduInfoByNetwork() */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This procedure is used to retrieve a CMD sequence number atomically -* -* @param prAdapter Pointer of ADAPTER_T -* -* @retval - UINT_8 -*/ -/*----------------------------------------------------------------------------*/ -UINT_8 -nicIncreaseCmdSeqNum ( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_8 ucRetval; - - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_SEQ_NUM); - - prAdapter->ucCmdSeqNum++; - ucRetval = prAdapter->ucCmdSeqNum; - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_SEQ_NUM); - - return ucRetval; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This procedure is used to retrieve a TX sequence number atomically -* -* @param prAdapter Pointer of ADAPTER_T -* -* @retval - UINT_8 -*/ -/*----------------------------------------------------------------------------*/ -UINT_8 -nicIncreaseTxSeqNum ( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_8 ucRetval; - - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_SEQ_NUM); - - prAdapter->ucTxSeqNum++; - ucRetval = prAdapter->ucTxSeqNum; - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_SEQ_NUM); - - return ucRetval; -} - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to handle -* media state change event -* -* @param -* -* @retval -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicMediaStateChange ( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkType, - IN P_EVENT_CONNECTION_STATUS prConnectionStatus - ) -{ - P_GLUE_INFO_T prGlueInfo; - - ASSERT(prAdapter); - prGlueInfo = prAdapter->prGlueInfo; - - switch(eNetworkType) { - case NETWORK_TYPE_AIS_INDEX: - if (prConnectionStatus->ucMediaStatus == PARAM_MEDIA_STATE_DISCONNECTED) { // disconnected - if(kalGetMediaStateIndicated(prGlueInfo) != PARAM_MEDIA_STATE_DISCONNECTED) { - - kalIndicateStatusAndComplete(prGlueInfo, - WLAN_STATUS_MEDIA_DISCONNECT, - NULL, - 0); - - prAdapter->rWlanInfo.u4SysTime = kalGetTimeTick(); - } - - /* reset buffered link quality information */ - prAdapter->fgIsLinkQualityValid = FALSE; - prAdapter->fgIsLinkRateValid = FALSE; - } - else if(prConnectionStatus->ucMediaStatus == PARAM_MEDIA_STATE_CONNECTED) { // connected - prAdapter->rWlanInfo.u4SysTime = kalGetTimeTick(); - - // fill information for association result - prAdapter->rWlanInfo.rCurrBssId.rSsid.u4SsidLen - = prConnectionStatus->ucSsidLen; - kalMemCopy(prAdapter->rWlanInfo.rCurrBssId.rSsid.aucSsid, - prConnectionStatus->aucSsid, - prConnectionStatus->ucSsidLen); - kalMemCopy(prAdapter->rWlanInfo.rCurrBssId.arMacAddress, - prConnectionStatus->aucBssid, - MAC_ADDR_LEN); - prAdapter->rWlanInfo.rCurrBssId.u4Privacy - = prConnectionStatus->ucEncryptStatus; // @FIXME - prAdapter->rWlanInfo.rCurrBssId.rRssi - = 0; //@FIXME - prAdapter->rWlanInfo.rCurrBssId.eNetworkTypeInUse - = PARAM_NETWORK_TYPE_AUTOMODE; //@FIXME - prAdapter->rWlanInfo.rCurrBssId.rConfiguration.u4BeaconPeriod - = prConnectionStatus->u2BeaconPeriod; - prAdapter->rWlanInfo.rCurrBssId.rConfiguration.u4ATIMWindow - = prConnectionStatus->u2ATIMWindow; - prAdapter->rWlanInfo.rCurrBssId.rConfiguration.u4DSConfig - = prConnectionStatus->u4FreqInKHz; - prAdapter->rWlanInfo.ucNetworkType - = prConnectionStatus->ucNetworkType; - prAdapter->rWlanInfo.rCurrBssId.eOpMode - = (ENUM_PARAM_OP_MODE_T) prConnectionStatus->ucInfraMode; - - // always indicate to OS according to MSDN (re-association/roaming) - if(kalGetMediaStateIndicated(prGlueInfo) != PARAM_MEDIA_STATE_CONNECTED) { - kalIndicateStatusAndComplete(prGlueInfo, - WLAN_STATUS_MEDIA_CONNECT, - NULL, - 0); - } - else { - /* connected -> connected : roaming ? */ - kalIndicateStatusAndComplete(prGlueInfo, - WLAN_STATUS_ROAM_OUT_FIND_BEST, - NULL, - 0); - } - } - break; - -#if CFG_ENABLE_BT_OVER_WIFI - case NETWORK_TYPE_BOW_INDEX: - break; -#endif - -#if CFG_ENABLE_WIFI_DIRECT - case NETWORK_TYPE_P2P_INDEX: - break; -#endif - default: - ASSERT(0); - } - - return WLAN_STATUS_SUCCESS; -} /* nicMediaStateChange */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to convert between -* frequency and channel number -* -* @param u4ChannelNum -* -* @retval - Frequency in unit of KHz, 0 for invalid channel number -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -nicChannelNum2Freq ( - UINT_32 u4ChannelNum - ) -{ - UINT_32 u4ChannelInMHz; - - if(u4ChannelNum >= 1 && u4ChannelNum <= 13) { - u4ChannelInMHz = 2412 + (u4ChannelNum - 1) * 5; - } - else if(u4ChannelNum == 14) { - u4ChannelInMHz = 2484; - } - else if(u4ChannelNum == 133) { - u4ChannelInMHz = 3665; // 802.11y - } - else if(u4ChannelNum == 137) { - u4ChannelInMHz = 3685; // 802.11y - } - else if(u4ChannelNum >= 34 && u4ChannelNum <= 165) { - u4ChannelInMHz = 5000 + u4ChannelNum * 5; - } - else if(u4ChannelNum >= 183 && u4ChannelNum <= 196) { - u4ChannelInMHz = 4000 + u4ChannelNum * 5; - } - else { - u4ChannelInMHz = 0; - } - - return 1000 * u4ChannelInMHz; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to convert between -* frequency and channel number -* -* @param u4FreqInKHz -* -* @retval - Frequency Number, 0 for invalid freqency -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -nicFreq2ChannelNum ( - UINT_32 u4FreqInKHz - ) -{ - switch(u4FreqInKHz) { - case 2412000: - return 1; - case 2417000: - return 2; - case 2422000: - return 3; - case 2427000: - return 4; - case 2432000: - return 5; - case 2437000: - return 6; - case 2442000: - return 7; - case 2447000: - return 8; - case 2452000: - return 9; - case 2457000: - return 10; - case 2462000: - return 11; - case 2467000: - return 12; - case 2472000: - return 13; - case 2484000: - return 14; - case 3665000: - return 133; // 802.11y - case 3685000: - return 137; // 802.11y - case 4915000: - return 183; - case 4920000: - return 184; - case 4925000: - return 185; - case 4930000: - return 186; - case 4935000: - return 187; - case 4940000: - return 188; - case 4945000: - return 189; - case 4960000: - return 192; - case 4980000: - return 196; - case 5170000: - return 34; - case 5180000: - return 36; - case 5190000: - return 38; - case 5200000: - return 40; - case 5210000: - return 42; - case 5220000: - return 44; - case 5230000: - return 46; - case 5240000: - return 48; - case 5250000: - return 50; - case 5260000: - return 52; - case 5270000: - return 54; - case 5280000: - return 56; - case 5290000: - return 58; - case 5300000: - return 60; - case 5320000: - return 64; - case 5500000: - return 100; - case 5520000: - return 104; - case 5540000: - return 108; - case 5560000: - return 112; - case 5580000: - return 116; - case 5600000: - return 120; - case 5620000: - return 124; - case 5640000: - return 128; - case 5660000: - return 132; - case 5680000: - return 136; - case 5700000: - return 140; - case 5745000: - return 149; - case 5765000: - return 153; - case 5785000: - return 157; - case 5805000: - return 161; - case 5825000: - return 165; - default: - return 0; - } -} - - -/* firmware command wrapper */ -/* NETWORK (WIFISYS) */ -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to activate WIFISYS for specified network -* -* @param prAdapter Pointer of ADAPTER_T -* eNetworkTypeIdx Index of network type -* -* @retval - -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicActivateNetwork( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ) -{ - CMD_BSS_ACTIVATE_CTRL rCmdActivateCtrl; - P_BSS_INFO_T prBssInfo; - - ASSERT(prAdapter); - ASSERT(eNetworkTypeIdx < NETWORK_TYPE_INDEX_NUM); - - rCmdActivateCtrl.ucNetTypeIndex = (UINT_8)eNetworkTypeIdx; - rCmdActivateCtrl.ucActive = 1; - - if (((UINT_8) eNetworkTypeIdx) < NETWORK_TYPE_INDEX_NUM) { - prBssInfo = &prAdapter->rWifiVar.arBssInfo[eNetworkTypeIdx]; - prBssInfo->fg40mBwAllowed = FALSE; - prBssInfo->fgAssoc40mBwAllowed = FALSE; - } - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_BSS_ACTIVATE_CTRL, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_BSS_ACTIVATE_CTRL), - (PUINT_8)&rCmdActivateCtrl, - NULL, - 0); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to deactivate WIFISYS for specified network -* -* @param prAdapter Pointer of ADAPTER_T -* eNetworkTypeIdx Index of network type -* -* @retval - -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicDeactivateNetwork( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ) -{ - WLAN_STATUS u4Status; - CMD_BSS_ACTIVATE_CTRL rCmdActivateCtrl; - - ASSERT(prAdapter); - ASSERT(eNetworkTypeIdx < NETWORK_TYPE_INDEX_NUM); - - rCmdActivateCtrl.ucNetTypeIndex = (UINT_8)eNetworkTypeIdx; - rCmdActivateCtrl.ucActive = 0; - - u4Status = wlanSendSetQueryCmd(prAdapter, - CMD_ID_BSS_ACTIVATE_CTRL, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_BSS_ACTIVATE_CTRL), - (PUINT_8)&rCmdActivateCtrl, - NULL, - 0); - - /* free all correlated station records */ - cnmStaFreeAllStaByNetType(prAdapter, eNetworkTypeIdx, FALSE); - qmFreeAllByNetType(prAdapter, eNetworkTypeIdx); - nicFreePendingTxMsduInfoByNetwork(prAdapter, eNetworkTypeIdx); - kalClearSecurityFramesByNetType(prAdapter->prGlueInfo, eNetworkTypeIdx); - - return u4Status; -} - - -/* BSS-INFO */ -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to sync bss info with firmware -* when a new BSS has been connected or disconnected -* -* @param prAdapter Pointer of ADAPTER_T -* eNetworkTypeIdx Index of BSS-INFO type -* -* @retval - -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicUpdateBss( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ) -{ - WLAN_STATUS u4Status; - P_BSS_INFO_T prBssInfo; - CMD_SET_BSS_INFO rCmdSetBssInfo; - - ASSERT(prAdapter); - ASSERT(eNetworkTypeIdx < NETWORK_TYPE_INDEX_NUM); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[eNetworkTypeIdx]); - - kalMemZero(&rCmdSetBssInfo, sizeof(CMD_SET_BSS_INFO)); - - rCmdSetBssInfo.ucNetTypeIndex = (UINT_8)eNetworkTypeIdx; - rCmdSetBssInfo.ucConnectionState = (UINT_8)prBssInfo->eConnectionState; - rCmdSetBssInfo.ucCurrentOPMode = (UINT_8)prBssInfo->eCurrentOPMode; - rCmdSetBssInfo.ucSSIDLen = (UINT_8)prBssInfo->ucSSIDLen; - kalMemCopy(rCmdSetBssInfo.aucSSID, prBssInfo->aucSSID, prBssInfo->ucSSIDLen); - COPY_MAC_ADDR(rCmdSetBssInfo.aucBSSID, prBssInfo->aucBSSID); - rCmdSetBssInfo.ucIsQBSS = (UINT_8)prBssInfo->fgIsQBSS; - rCmdSetBssInfo.ucNonHTBasicPhyType = prBssInfo->ucNonHTBasicPhyType; - rCmdSetBssInfo.u2OperationalRateSet = prBssInfo->u2OperationalRateSet; - rCmdSetBssInfo.u2BSSBasicRateSet = prBssInfo->u2BSSBasicRateSet; - rCmdSetBssInfo.ucPhyTypeSet = prBssInfo->ucPhyTypeSet; -#if CFG_ENABLE_WIFI_DIRECT - if(prAdapter->fgIsP2PRegistered) { - COPY_MAC_ADDR(rCmdSetBssInfo.aucOwnMac, prBssInfo->aucOwnMacAddr); - } -#endif - - rlmFillSyncCmdParam(&rCmdSetBssInfo.rBssRlmParam, prBssInfo); - - rCmdSetBssInfo.fgWapiMode = (UINT_8)FALSE; - - if(rCmdSetBssInfo.ucNetTypeIndex == NETWORK_TYPE_AIS_INDEX) { - P_CONNECTION_SETTINGS_T prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - rCmdSetBssInfo.ucAuthMode = (UINT_8)prConnSettings->eAuthMode; - rCmdSetBssInfo.ucEncStatus = (UINT_8)prConnSettings->eEncStatus; - rCmdSetBssInfo.fgWapiMode = (UINT_8)prConnSettings->fgWapiMode; - } -#if CFG_ENABLE_BT_OVER_WIFI - else if(rCmdSetBssInfo.ucNetTypeIndex == NETWORK_TYPE_BOW_INDEX) { - //P_CONNECTION_SETTINGS_T prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - rCmdSetBssInfo.ucAuthMode = (UINT_8)AUTH_MODE_WPA2_PSK; - rCmdSetBssInfo.ucEncStatus = (UINT_8)ENUM_ENCRYPTION3_KEY_ABSENT; - } -#endif - else { -#if CFG_ENABLE_WIFI_DIRECT - if(prAdapter->fgIsP2PRegistered) { - if (kalP2PGetCipher(prAdapter->prGlueInfo)) { - rCmdSetBssInfo.ucAuthMode = (UINT_8)AUTH_MODE_WPA2_PSK; - rCmdSetBssInfo.ucEncStatus = (UINT_8)ENUM_ENCRYPTION3_KEY_ABSENT; - } - else { - rCmdSetBssInfo.ucAuthMode = (UINT_8)AUTH_MODE_OPEN; - rCmdSetBssInfo.ucEncStatus = (UINT_8)ENUM_ENCRYPTION_DISABLED; - } - rCmdSetBssInfo.fgIsApMode = p2pFuncIsAPMode(prAdapter->rWifiVar.prP2pFsmInfo); - } -#else - rCmdSetBssInfo.ucAuthMode = (UINT_8)AUTH_MODE_WPA2_PSK; - rCmdSetBssInfo.ucEncStatus = (UINT_8)ENUM_ENCRYPTION3_KEY_ABSENT; -#endif - } - - if(eNetworkTypeIdx == NETWORK_TYPE_AIS_INDEX && - prBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE && - prBssInfo->prStaRecOfAP != NULL) { - rCmdSetBssInfo.ucStaRecIdxOfAP = prBssInfo->prStaRecOfAP->ucIndex; - - cnmAisInfraConnectNotify(prAdapter); - } -#if CFG_ENABLE_WIFI_DIRECT - else if ((prAdapter->fgIsP2PRegistered) && - (eNetworkTypeIdx == NETWORK_TYPE_P2P_INDEX) && - (prBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE) && - (prBssInfo->prStaRecOfAP != NULL)) { - rCmdSetBssInfo.ucStaRecIdxOfAP = prBssInfo->prStaRecOfAP->ucIndex; - } -#endif - -#if CFG_ENABLE_BT_OVER_WIFI - else if (eNetworkTypeIdx == NETWORK_TYPE_BOW_INDEX && - prBssInfo->eCurrentOPMode == OP_MODE_BOW && - prBssInfo->prStaRecOfAP != NULL) { - rCmdSetBssInfo.ucStaRecIdxOfAP = prBssInfo->prStaRecOfAP->ucIndex; - } -#endif - else { - rCmdSetBssInfo.ucStaRecIdxOfAP = STA_REC_INDEX_NOT_FOUND; - } - - u4Status = wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_BSS_INFO, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_SET_BSS_INFO), - (PUINT_8)&rCmdSetBssInfo, - NULL, - 0); - - /* if BSS-INFO is going to be disconnected state, free all correlated station records */ - if(prBssInfo->eConnectionState == PARAM_MEDIA_STATE_DISCONNECTED) { - /* clear client list */ - bssClearClientList(prAdapter, prBssInfo); - - /* free all correlated station records */ - cnmStaFreeAllStaByNetType(prAdapter, eNetworkTypeIdx, FALSE); - qmFreeAllByNetType(prAdapter, eNetworkTypeIdx); - kalClearSecurityFramesByNetType(prAdapter->prGlueInfo, eNetworkTypeIdx); - } - - return u4Status; -} - - -/* BSS-INFO Indication (PM) */ -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to indicate PM that -* a BSS has been created. (for AdHoc / P2P-GO) -* -* @param prAdapter Pointer of ADAPTER_T -* eNetworkTypeIdx Index of BSS-INFO -* -* @retval - -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicPmIndicateBssCreated( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ) -{ - P_BSS_INFO_T prBssInfo; - CMD_INDICATE_PM_BSS_CREATED rCmdIndicatePmBssCreated; - - ASSERT(prAdapter); - ASSERT(eNetworkTypeIdx < NETWORK_TYPE_INDEX_NUM); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[eNetworkTypeIdx]); - - rCmdIndicatePmBssCreated.ucNetTypeIndex = (UINT_8)eNetworkTypeIdx; - rCmdIndicatePmBssCreated.ucDtimPeriod = prBssInfo->ucDTIMPeriod; - rCmdIndicatePmBssCreated.u2BeaconInterval = prBssInfo->u2BeaconInterval; - rCmdIndicatePmBssCreated.u2AtimWindow = prBssInfo->u2ATIMWindow; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_INDICATE_PM_BSS_CREATED, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_INDICATE_PM_BSS_CREATED), - (PUINT_8)&rCmdIndicatePmBssCreated, - NULL, - 0); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to indicate PM that -* a BSS has been connected -* -* @param prAdapter Pointer of ADAPTER_T -* eNetworkTypeIdx Index of BSS-INFO -* -* @retval - -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicPmIndicateBssConnected( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ) -{ - P_BSS_INFO_T prBssInfo; - CMD_INDICATE_PM_BSS_CONNECTED rCmdIndicatePmBssConnected; - - ASSERT(prAdapter); - ASSERT(eNetworkTypeIdx < NETWORK_TYPE_INDEX_NUM); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[eNetworkTypeIdx]); - - rCmdIndicatePmBssConnected.ucNetTypeIndex = (UINT_8)eNetworkTypeIdx; - rCmdIndicatePmBssConnected.ucDtimPeriod = prBssInfo->ucDTIMPeriod; - rCmdIndicatePmBssConnected.u2AssocId = prBssInfo->u2AssocId; - rCmdIndicatePmBssConnected.u2BeaconInterval = prBssInfo->u2BeaconInterval; - rCmdIndicatePmBssConnected.u2AtimWindow = prBssInfo->u2ATIMWindow; - - rCmdIndicatePmBssConnected.ucBmpDeliveryAC = prBssInfo->rPmProfSetupInfo.ucBmpDeliveryAC; - rCmdIndicatePmBssConnected.ucBmpTriggerAC = prBssInfo->rPmProfSetupInfo.ucBmpTriggerAC; - - //DBGPRINTF("nicPmIndicateBssConnected: ucBmpDeliveryAC:0x%x, ucBmpTriggerAC:0x%x", - //rCmdIndicatePmBssConnected.ucBmpDeliveryAC, - //rCmdIndicatePmBssConnected.ucBmpTriggerAC); - - if ((eNetworkTypeIdx == NETWORK_TYPE_AIS_INDEX) -#if CFG_ENABLE_WIFI_DIRECT - || ((eNetworkTypeIdx == NETWORK_TYPE_P2P_INDEX) && (prAdapter->fgIsP2PRegistered)) -#endif - ) { - if(prBssInfo->eCurrentOPMode == OP_MODE_INFRASTRUCTURE) { - rCmdIndicatePmBssConnected.fgIsUapsdConnection = (UINT_8)prBssInfo->prStaRecOfAP->fgIsUapsdSupported; - } - else { - rCmdIndicatePmBssConnected.fgIsUapsdConnection = 0; //@FIXME - } - } - else { - rCmdIndicatePmBssConnected.fgIsUapsdConnection = 0; - } - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_INDICATE_PM_BSS_CONNECTED, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_INDICATE_PM_BSS_CONNECTED), - (PUINT_8)&rCmdIndicatePmBssConnected, - NULL, - 0); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to indicate PM that -* a BSS has been disconnected -* -* @param prAdapter Pointer of ADAPTER_T -* eNetworkTypeIdx Index of BSS-INFO -* -* @retval - -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicPmIndicateBssAbort( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ) -{ - CMD_INDICATE_PM_BSS_ABORT rCmdIndicatePmBssAbort; - - ASSERT(prAdapter); - ASSERT(eNetworkTypeIdx < NETWORK_TYPE_INDEX_NUM); - - rCmdIndicatePmBssAbort.ucNetTypeIndex = (UINT_8)eNetworkTypeIdx; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_INDICATE_PM_BSS_ABORT, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_INDICATE_PM_BSS_ABORT), - (PUINT_8)&rCmdIndicatePmBssAbort, - NULL, - 0); -} - -WLAN_STATUS -nicConfigPowerSaveProfile ( - IN P_ADAPTER_T prAdapter, - ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - PARAM_POWER_MODE ePwrMode, - BOOLEAN fgEnCmdEvent - ) -{ - DEBUGFUNC("nicConfigPowerSaveProfile"); - DBGLOG(INIT, TRACE, ("eNetTypeIndex:%d, ePwrMode:%d, fgEnCmdEvent:%d\n", - eNetTypeIndex, ePwrMode, fgEnCmdEvent)); - - ASSERT(prAdapter); - - if (eNetTypeIndex >= NETWORK_TYPE_INDEX_NUM) { - ASSERT(0); - return WLAN_STATUS_NOT_SUPPORTED; - } - -// prAdapter->rWlanInfo.ePowerSaveMode.ucNetTypeIndex = eNetTypeIndex; -// prAdapter->rWlanInfo.ePowerSaveMode.ucPsProfile = (UINT_8)ePwrMode; - prAdapter->rWlanInfo.arPowerSaveMode[eNetTypeIndex].ucNetTypeIndex = eNetTypeIndex; - prAdapter->rWlanInfo.arPowerSaveMode[eNetTypeIndex].ucPsProfile = (UINT_8)ePwrMode; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_POWER_SAVE_MODE, - TRUE, - FALSE, - TRUE, - (fgEnCmdEvent ? nicCmdEventSetCommon : NULL), - (fgEnCmdEvent ? nicOidCmdTimeoutCommon : NULL), - sizeof(CMD_PS_PROFILE_T), - (PUINT_8)&(prAdapter->rWlanInfo.arPowerSaveMode[eNetTypeIndex]), - NULL, - sizeof(PARAM_POWER_MODE) - ); - -} /* end of wlanoidSetAcpiDevicePowerStateMode() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to indicate firmware domain -* for beacon generation parameters -* -* @param prAdapter Pointer of ADAPTER_T -* eIeUpdMethod, Update Method -* eNetTypeIndex Index of Network -* u2Capability Capability -* aucIe Pointer to buffer of IEs -* u2IELen Length of IEs -* -* @retval - WLAN_STATUS_SUCCESS -* WLAN_STATUS_FAILURE -* WLAN_STATUS_PENDING -* WLAN_STATUS_INVALID_DATA -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicUpdateBeaconIETemplate ( - IN P_ADAPTER_T prAdapter, - IN ENUM_IE_UPD_METHOD_T eIeUpdMethod, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIndex, - IN UINT_16 u2Capability, - IN PUINT_8 aucIe, - IN UINT_16 u2IELen - ) -{ - P_CMD_BEACON_TEMPLATE_UPDATE prCmdBcnUpdate; - UINT_16 u2CmdBufLen = 0; - P_GLUE_INFO_T prGlueInfo; - P_CMD_INFO_T prCmdInfo; - P_WIFI_CMD_T prWifiCmd; - UINT_8 ucCmdSeqNum; - - DEBUGFUNC("wlanUpdateBeaconIETemplate"); - DBGLOG(INIT, LOUD, ("\n")); - - ASSERT(prAdapter); - prGlueInfo = prAdapter->prGlueInfo; - - if (u2IELen > MAX_IE_LENGTH) { - return WLAN_STATUS_INVALID_DATA; - } - - if (eIeUpdMethod == IE_UPD_METHOD_UPDATE_RANDOM - || eIeUpdMethod == IE_UPD_METHOD_UPDATE_ALL) { - u2CmdBufLen = OFFSET_OF(CMD_BEACON_TEMPLATE_UPDATE, aucIE) + u2IELen; - } - else if (eIeUpdMethod == IE_UPD_METHOD_DELETE_ALL) { - u2CmdBufLen = OFFSET_OF(CMD_BEACON_TEMPLATE_UPDATE, u2IELen); - } - else { - ASSERT(0); - return WLAN_STATUS_FAILURE; - } - - // prepare command info - prCmdInfo = cmdBufAllocateCmdInfo(prAdapter, (CMD_HDR_SIZE + u2CmdBufLen)); - if (!prCmdInfo) { - DBGLOG(INIT, ERROR, ("Allocate CMD_INFO_T ==> FAILED.\n")); - return WLAN_STATUS_FAILURE; - } - - // increase command sequence number - ucCmdSeqNum = nicIncreaseCmdSeqNum(prAdapter); - DBGLOG(REQ, TRACE, ("ucCmdSeqNum =%d\n", ucCmdSeqNum)); - - // Setup common CMD Info Packet - prCmdInfo->eCmdType = COMMAND_TYPE_NETWORK_IOCTL; - prCmdInfo->eNetworkType = eNetTypeIndex; - prCmdInfo->u2InfoBufLen = (UINT_16)(CMD_HDR_SIZE + u2CmdBufLen); - prCmdInfo->pfCmdDoneHandler = NULL; //@FIXME - prCmdInfo->pfCmdTimeoutHandler = NULL; //@FIXME - prCmdInfo->fgIsOid = FALSE; - prCmdInfo->ucCID = CMD_ID_UPDATE_BEACON_CONTENT; - prCmdInfo->fgSetQuery = TRUE; - prCmdInfo->fgNeedResp = FALSE; - prCmdInfo->fgDriverDomainMCR = FALSE; - prCmdInfo->ucCmdSeqNum = ucCmdSeqNum; - prCmdInfo->u4SetInfoLen = u2CmdBufLen; - prCmdInfo->pvInformationBuffer = NULL; - prCmdInfo->u4InformationBufferLength = 0; - - // Setup WIFI_CMD_T (no payload) - prWifiCmd = (P_WIFI_CMD_T)(prCmdInfo->pucInfoBuffer); - prWifiCmd->u2TxByteCount_UserPriority = prCmdInfo->u2InfoBufLen; - prWifiCmd->ucCID = prCmdInfo->ucCID; - prWifiCmd->ucSetQuery = prCmdInfo->fgSetQuery; - prWifiCmd->ucSeqNum = prCmdInfo->ucCmdSeqNum; - - prCmdBcnUpdate = (P_CMD_BEACON_TEMPLATE_UPDATE)(prWifiCmd->aucBuffer); - - // fill beacon updating command - prCmdBcnUpdate->ucUpdateMethod = (UINT_8) eIeUpdMethod; - prCmdBcnUpdate->ucNetTypeIndex = (UINT_8) eNetTypeIndex; - prCmdBcnUpdate->u2Capability = u2Capability; - prCmdBcnUpdate->u2IELen = u2IELen; - if(u2IELen > 0 ) { - kalMemCopy(prCmdBcnUpdate->aucIE, aucIe, u2IELen); - } - - // insert into prCmdQueue - kalEnqueueCommand(prGlueInfo, (P_QUE_ENTRY_T)prCmdInfo); - - // wakeup txServiceThread later - GLUE_SET_EVENT(prGlueInfo); - return WLAN_STATUS_PENDING; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to initialization PHY related -* varaibles -* -* @param prAdapter Pointer of ADAPTER_T -* -* @retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicSetAvailablePhyTypeSet ( - IN P_ADAPTER_T prAdapter - ) -{ - P_CONNECTION_SETTINGS_T prConnSettings; - - ASSERT(prAdapter); - - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - - if (prConnSettings->eDesiredPhyConfig >= PHY_CONFIG_NUM) { - ASSERT(0); - return; - } - - prAdapter->rWifiVar.ucAvailablePhyTypeSet = - aucPhyCfg2PhyTypeSet[prConnSettings->eDesiredPhyConfig]; - - if (prAdapter->rWifiVar.ucAvailablePhyTypeSet & PHY_TYPE_BIT_ERP) { - prAdapter->rWifiVar.eNonHTBasicPhyType2G4 = PHY_TYPE_ERP_INDEX; - } - /* NOTE(Kevin): Because we don't have N only mode, TBD */ - else /* if (ucNonHTPhyTypeSet & PHY_TYPE_HR_DSSS_INDEX) */ { - prAdapter->rWifiVar.eNonHTBasicPhyType2G4 = PHY_TYPE_HR_DSSS_INDEX; - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to update WMM Parms -* -* @param prAdapter Pointer of ADAPTER_T -* eNetworkTypeIdx Index of BSS-INFO -* -* @retval - -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicQmUpdateWmmParms( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ) -{ - P_BSS_INFO_T prBssInfo; - CMD_UPDATE_WMM_PARMS_T rCmdUpdateWmmParms; - - ASSERT(prAdapter); - ASSERT(eNetworkTypeIdx < NETWORK_TYPE_INDEX_NUM); - - DBGLOG(QM, EVENT, ("sizeof(AC_QUE_PARMS_T): %d \n", sizeof(AC_QUE_PARMS_T))); - DBGLOG(QM, EVENT, ("sizeof(CMD_UPDATE_WMM_PARMS): %d \n", sizeof(CMD_UPDATE_WMM_PARMS_T))); - DBGLOG(QM, EVENT, ("sizeof(WIFI_CMD_T): %d \n", sizeof(WIFI_CMD_T))); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[eNetworkTypeIdx]); - rCmdUpdateWmmParms.ucNetTypeIndex = (UINT_8)eNetworkTypeIdx; - kalMemCopy(&rCmdUpdateWmmParms.arACQueParms[0], &prBssInfo->arACQueParms[0], - (sizeof(AC_QUE_PARMS_T)*AC_NUM)); - - rCmdUpdateWmmParms.fgIsQBSS = prBssInfo->fgIsQBSS; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_UPDATE_WMM_PARMS, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_UPDATE_WMM_PARMS_T), - (PUINT_8)&rCmdUpdateWmmParms, - NULL, - 0); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to update TX power gain corresponding to -* each band/modulation combination -* -* @param prAdapter Pointer of ADAPTER_T -* prTxPwrParam Pointer of TX power parameters -* -* @retval WLAN_STATUS_PENDING -* WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicUpdateTxPower( - IN P_ADAPTER_T prAdapter, - IN P_CMD_TX_PWR_T prTxPwrParam - ) -{ - DEBUGFUNC("nicUpdateTxPower"); - - ASSERT(prAdapter); - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_TX_PWR, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_TX_PWR_T), - (PUINT_8)prTxPwrParam, - NULL, - 0); -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to set auto tx power parameter -* -* @param prAdapter Pointer of ADAPTER_T -* prTxPwrParam Pointer of Auto TX power parameters -* -* @retval WLAN_STATUS_PENDING -* WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicSetAutoTxPower( - IN P_ADAPTER_T prAdapter, - IN P_CMD_AUTO_POWER_PARAM_T prAutoPwrParam - ) -{ - DEBUGFUNC("nicSetAutoTxPower"); - - ASSERT(prAdapter); - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_AUTOPWR_CTRL, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_AUTO_POWER_PARAM_T), - (PUINT_8)prAutoPwrParam, - NULL, - 0); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to update TX power gain corresponding to -* each band/modulation combination -* -* @param prAdapter Pointer of ADAPTER_T -* prTxPwrParam Pointer of TX power parameters -* -* @retval WLAN_STATUS_PENDING -* WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicSetAutoTxPowerControl( - IN P_ADAPTER_T prAdapter, - IN P_CMD_TX_PWR_T prTxPwrParam - ) -{ - DEBUGFUNC("nicUpdateTxPower"); - - ASSERT(prAdapter); - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_TX_PWR, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_TX_PWR_T), - (PUINT_8)prTxPwrParam, - NULL, - 0); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to update power offset around 5GHz band -* -* @param prAdapter Pointer of ADAPTER_T -* pr5GPwrOffset Pointer of 5GHz power offset parameter -* -* @retval WLAN_STATUS_PENDING -* WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicUpdate5GOffset( - IN P_ADAPTER_T prAdapter, - IN P_CMD_5G_PWR_OFFSET_T pr5GPwrOffset - ) -{ - DEBUGFUNC("nicUpdate5GOffset"); - - ASSERT(prAdapter); - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_5G_PWR_OFFSET, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_5G_PWR_OFFSET_T), - (PUINT_8)pr5GPwrOffset, - NULL, - 0); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to update DPD calibration result -* -* @param prAdapter Pointer of ADAPTER_T -* pr5GPwrOffset Pointer of parameter for DPD calibration result -* -* @retval WLAN_STATUS_PENDING -* WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicUpdateDPD( - IN P_ADAPTER_T prAdapter, - IN P_CMD_PWR_PARAM_T prDpdCalResult - ) -{ - DEBUGFUNC("nicUpdateDPD"); - - ASSERT(prAdapter); - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_PWR_PARAM, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_PWR_PARAM_T), - (PUINT_8)prDpdCalResult, - NULL, - 0); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function starts system service such as timer and -* memory pools -* -* @param prAdapter Pointer of ADAPTER_T -* -* @retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicInitSystemService ( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - // <1> Initialize MGMT Memory pool and STA_REC - cnmMemInit(prAdapter); - cnmStaRecInit(prAdapter); - cmdBufInitialize(prAdapter); - - // <2> Mailbox Initialization - mboxInitialize(prAdapter); - - // <3> Timer Initialization - cnmTimerInitialize(prAdapter); - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function reset some specific system service, -* such as STA-REC -* -* @param prAdapter Pointer of ADAPTER_T -* -* @retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicResetSystemService ( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to update WMM Parms -* -* @param prAdapter Pointer of ADAPTER_T -* -* @retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicUninitSystemService ( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - /* Timer Destruction */ - cnmTimerDestroy(prAdapter); - - /* Mailbox Destruction */ - mboxDestroy(prAdapter); - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to update WMM Parms -* -* @param prAdapter Pointer of ADAPTER_T -* -* @retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicInitMGMT ( - IN P_ADAPTER_T prAdapter, - IN P_REG_INFO_T prRegInfo - ) -{ - ASSERT(prAdapter); - - /* CNM Module - initialization */ - cnmInit(prAdapter); - - /* RLM Module - initialization */ - rlmFsmEventInit(prAdapter); - - /* SCN Module - initialization */ - scnInit(prAdapter); - - /* AIS Module - intiailization */ - aisInitializeConnectionSettings(prAdapter, prRegInfo); - aisFsmInit(prAdapter); - -#if CFG_SUPPORT_ROAMING - /* Roaming Module - intiailization */ - roamingFsmInit(prAdapter); -#endif /* CFG_SUPPORT_ROAMING */ - -#if CFG_SUPPORT_SWCR - swCrDebugInit(prAdapter); -#endif /* CFG_SUPPORT_SWCR */ - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to update WMM Parms -* -* @param prAdapter Pointer of ADAPTER_T -* -* @retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicUninitMGMT ( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - -#if CFG_SUPPORT_SWCR - swCrDebugUninit(prAdapter); -#endif /* CFG_SUPPORT_SWCR */ - -#if CFG_SUPPORT_ROAMING - /* Roaming Module - unintiailization */ - roamingFsmUninit(prAdapter); -#endif /* CFG_SUPPORT_ROAMING */ - - /* AIS Module - unintiailization */ - aisFsmUninit(prAdapter); - - /* SCN Module - unintiailization */ - scnUninit(prAdapter); - - /* RLM Module - uninitialization */ - rlmFsmEventUninit(prAdapter); - - /* CNM Module - uninitialization */ - cnmUninit(prAdapter); - - return; -} - - -#if (MT6620_E1_ASIC_HIFSYS_WORKAROUND == 1) -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is to inform firmware to enable MCU clock gating -* -* @param prAdapter Pointer of ADAPTER_T -* -* @retval none -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicEnableClockGating ( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 i, u4WHISR = 0; - - ASSERT(prAdapter); - - if(prAdapter->fgIsClockGatingEnabled == TRUE) { - return WLAN_STATUS_SUCCESS; - } - else { - nicSetSwIntr(prAdapter, REQ_GATING_ENABLE_H2D_INT); - - i = 0; - while(i < GATING_CONTROL_POLL_LIMIT) { - if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - return WLAN_STATUS_FAILURE; - } - - HAL_READ_INTR_STATUS(prAdapter, sizeof(UINT_32), (PUINT_8)&u4WHISR); - - if(u4WHISR & ACK_GATING_ENABLE_D2H_INT) { - prAdapter->fgIsClockGatingEnabled = TRUE; - return WLAN_STATUS_SUCCESS; - } - } - - ASSERT(0); - return WLAN_STATUS_PENDING; - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is to inform firmware to disable MCU clock gating -* -* @param prAdapter Pointer of ADAPTER_T -* -* @retval none -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicDisableClockGating ( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 i, u4WHISR = 0; - - ASSERT(prAdapter); - - if(prAdapter->fgIsClockGatingEnabled == FALSE) { - return WLAN_STATUS_SUCCESS; - } - else { - nicSetSwIntr(prAdapter, REQ_GATING_DISABLE_H2D_INT); - - i = 0; - while(i < GATING_CONTROL_POLL_LIMIT) { - if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - return WLAN_STATUS_FAILURE; - } - - HAL_READ_INTR_STATUS(prAdapter, sizeof(UINT_32), (PUINT_8)&u4WHISR); - - if(u4WHISR & ACK_GATING_DISABLE_D2H_INT) { - prAdapter->fgIsClockGatingEnabled = FALSE; - return WLAN_STATUS_SUCCESS; - } - } - - ASSERT(0); - return WLAN_STATUS_PENDING; - } -} -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is invoked to buffer scan result -* -* @param prAdapter Pointer to the Adapter structure. -* @param rMacAddr BSSID -* @param prSsid Pointer to SSID -* @param u4Privacy Privacy settings (0: Open / 1: WEP/WPA/WPA2 enabled) -* @param rRssi Received Strength (-10 ~ -200 dBm) -* @param eNetworkType Network Type (a/b/g) -* @param prConfiguration Network Parameter -* @param eOpMode Infra/Ad-Hoc -* @param rSupportedRates Supported basic rates -* @param u2IELength IE Length -* @param pucIEBuf Pointer to Information Elements(IEs) -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicAddScanResult ( - IN P_ADAPTER_T prAdapter, - IN PARAM_MAC_ADDRESS rMacAddr, - IN P_PARAM_SSID_T prSsid, - IN UINT_32 u4Privacy, - IN PARAM_RSSI rRssi, - IN ENUM_PARAM_NETWORK_TYPE_T eNetworkType, - IN P_PARAM_802_11_CONFIG_T prConfiguration, - IN ENUM_PARAM_OP_MODE_T eOpMode, - IN PARAM_RATES_EX rSupportedRates, - IN UINT_16 u2IELength, - IN PUINT_8 pucIEBuf - ) -{ - BOOLEAN bReplace; - UINT_32 i; - UINT_32 u4IdxWeakest = 0; - PARAM_RSSI rWeakestRssi; - UINT_32 u4BufferSize; - - ASSERT(prAdapter); - - rWeakestRssi = (PARAM_RSSI)INT_MAX; - u4BufferSize = sizeof(prAdapter->rWlanInfo.aucScanIEBuf) / sizeof(prAdapter->rWlanInfo.aucScanIEBuf[0]); - - bReplace = FALSE; - - // decide to replace or add - for(i = 0 ; i < prAdapter->rWlanInfo.u4ScanResultNum ; i++) { - // find weakest entry && not connected one - if(UNEQUAL_MAC_ADDR(prAdapter->rWlanInfo.arScanResult[i].arMacAddress, prAdapter->rWlanInfo.rCurrBssId.arMacAddress) - && prAdapter->rWlanInfo.arScanResult[i].rRssi < rWeakestRssi) { - u4IdxWeakest = i; - rWeakestRssi = prAdapter->rWlanInfo.arScanResult[i].rRssi; - } - - if(prAdapter->rWlanInfo.arScanResult[i].eOpMode == eOpMode && - EQUAL_MAC_ADDR(&(prAdapter->rWlanInfo.arScanResult[i].arMacAddress), rMacAddr) && - (EQUAL_SSID(prAdapter->rWlanInfo.arScanResult[i].rSsid.aucSsid, - prAdapter->rWlanInfo.arScanResult[i].rSsid.u4SsidLen, - prSsid->aucSsid, - prSsid->u4SsidLen) - || prAdapter->rWlanInfo.arScanResult[i].rSsid.u4SsidLen == 0)) { - // replace entry - bReplace = TRUE; - - // free IE buffer then zero - nicFreeScanResultIE(prAdapter, i); - kalMemZero(&(prAdapter->rWlanInfo.arScanResult[i]), OFFSET_OF(PARAM_BSSID_EX_T, aucIEs)); - - // then fill buffer - prAdapter->rWlanInfo.arScanResult[i].u4Length = - OFFSET_OF(PARAM_BSSID_EX_T, aucIEs) + u2IELength; - COPY_MAC_ADDR(prAdapter->rWlanInfo.arScanResult[i].arMacAddress, rMacAddr); - COPY_SSID(prAdapter->rWlanInfo.arScanResult[i].rSsid.aucSsid, - prAdapter->rWlanInfo.arScanResult[i].rSsid.u4SsidLen, - prSsid->aucSsid, - prSsid->u4SsidLen); - prAdapter->rWlanInfo.arScanResult[i].u4Privacy = u4Privacy; - prAdapter->rWlanInfo.arScanResult[i].rRssi = rRssi; - prAdapter->rWlanInfo.arScanResult[i].eNetworkTypeInUse = eNetworkType; - kalMemCopy(&(prAdapter->rWlanInfo.arScanResult[i].rConfiguration), - prConfiguration, - sizeof(PARAM_802_11_CONFIG_T)); - prAdapter->rWlanInfo.arScanResult[i].eOpMode = eOpMode; - kalMemCopy((prAdapter->rWlanInfo.arScanResult[i].rSupportedRates), - rSupportedRates, - sizeof(PARAM_RATES_EX)); - prAdapter->rWlanInfo.arScanResult[i].u4IELength = (UINT_32)u2IELength; - - // IE - allocate buffer and update pointer - if(u2IELength > 0) { - if(ALIGN_4(u2IELength) + prAdapter->rWlanInfo.u4ScanIEBufferUsage <= u4BufferSize) { - kalMemCopy(&(prAdapter->rWlanInfo.aucScanIEBuf[prAdapter->rWlanInfo.u4ScanIEBufferUsage]), - pucIEBuf, - u2IELength); - - prAdapter->rWlanInfo.apucScanResultIEs[i] = - &(prAdapter->rWlanInfo.aucScanIEBuf[prAdapter->rWlanInfo.u4ScanIEBufferUsage]); - - prAdapter->rWlanInfo.u4ScanIEBufferUsage += ALIGN_4(u2IELength); - } - else { - // buffer is not enough - prAdapter->rWlanInfo.arScanResult[i].u4Length -= u2IELength; - prAdapter->rWlanInfo.arScanResult[i].u4IELength = 0; - prAdapter->rWlanInfo.apucScanResultIEs[i] = NULL; - } - } - else { - prAdapter->rWlanInfo.apucScanResultIEs[i] = NULL; - } - - break; - } - } - - if (bReplace == FALSE) { - if (prAdapter->rWlanInfo.u4ScanResultNum < (CFG_MAX_NUM_BSS_LIST - 1)) { - i = prAdapter->rWlanInfo.u4ScanResultNum; - - // zero - kalMemZero(&(prAdapter->rWlanInfo.arScanResult[i]), - OFFSET_OF(PARAM_BSSID_EX_T, aucIEs)); - - // then fill buffer - prAdapter->rWlanInfo.arScanResult[i].u4Length = - OFFSET_OF(PARAM_BSSID_EX_T, aucIEs) + u2IELength; - COPY_MAC_ADDR(prAdapter->rWlanInfo.arScanResult[i].arMacAddress, rMacAddr); - COPY_SSID(prAdapter->rWlanInfo.arScanResult[i].rSsid.aucSsid, - prAdapter->rWlanInfo.arScanResult[i].rSsid.u4SsidLen, - prSsid->aucSsid, - prSsid->u4SsidLen); - prAdapter->rWlanInfo.arScanResult[i].u4Privacy = u4Privacy; - prAdapter->rWlanInfo.arScanResult[i].rRssi = rRssi; - prAdapter->rWlanInfo.arScanResult[i].eNetworkTypeInUse = eNetworkType; - kalMemCopy(&(prAdapter->rWlanInfo.arScanResult[i].rConfiguration), - prConfiguration, - sizeof(PARAM_802_11_CONFIG_T)); - prAdapter->rWlanInfo.arScanResult[i].eOpMode = eOpMode; - kalMemCopy((prAdapter->rWlanInfo.arScanResult[i].rSupportedRates), - rSupportedRates, - sizeof(PARAM_RATES_EX)); - prAdapter->rWlanInfo.arScanResult[i].u4IELength = (UINT_32)u2IELength; - - // IE - allocate buffer and update pointer - if(u2IELength > 0) { - if(ALIGN_4(u2IELength) + prAdapter->rWlanInfo.u4ScanIEBufferUsage <= u4BufferSize) { - kalMemCopy(&(prAdapter->rWlanInfo.aucScanIEBuf[prAdapter->rWlanInfo.u4ScanIEBufferUsage]), - pucIEBuf, - u2IELength); - - prAdapter->rWlanInfo.apucScanResultIEs[i] = - &(prAdapter->rWlanInfo.aucScanIEBuf[prAdapter->rWlanInfo.u4ScanIEBufferUsage]); - - prAdapter->rWlanInfo.u4ScanIEBufferUsage += ALIGN_4(u2IELength); - } - else { - // buffer is not enough - prAdapter->rWlanInfo.arScanResult[i].u4Length -= u2IELength; - prAdapter->rWlanInfo.arScanResult[i].u4IELength = 0; - prAdapter->rWlanInfo.apucScanResultIEs[i] = NULL; - } - } - else { - prAdapter->rWlanInfo.apucScanResultIEs[i] = NULL; - } - - prAdapter->rWlanInfo.u4ScanResultNum++; - } - else if(rWeakestRssi != (PARAM_RSSI)INT_MAX) { - // replace weakest one - i = u4IdxWeakest; - - // free IE buffer then zero - nicFreeScanResultIE(prAdapter, i); - kalMemZero(&(prAdapter->rWlanInfo.arScanResult[i]), - OFFSET_OF(PARAM_BSSID_EX_T, aucIEs)); - - // then fill buffer - prAdapter->rWlanInfo.arScanResult[i].u4Length = - OFFSET_OF(PARAM_BSSID_EX_T, aucIEs) + u2IELength; - COPY_MAC_ADDR(prAdapter->rWlanInfo.arScanResult[i].arMacAddress, rMacAddr); - COPY_SSID(prAdapter->rWlanInfo.arScanResult[i].rSsid.aucSsid, - prAdapter->rWlanInfo.arScanResult[i].rSsid.u4SsidLen, - prSsid->aucSsid, - prSsid->u4SsidLen); - prAdapter->rWlanInfo.arScanResult[i].u4Privacy = u4Privacy; - prAdapter->rWlanInfo.arScanResult[i].rRssi = rRssi; - prAdapter->rWlanInfo.arScanResult[i].eNetworkTypeInUse = eNetworkType; - kalMemCopy(&(prAdapter->rWlanInfo.arScanResult[i].rConfiguration), - prConfiguration, - sizeof(PARAM_802_11_CONFIG_T)); - prAdapter->rWlanInfo.arScanResult[i].eOpMode = eOpMode; - kalMemCopy((prAdapter->rWlanInfo.arScanResult[i].rSupportedRates), - rSupportedRates, - sizeof(PARAM_RATES_EX)); - prAdapter->rWlanInfo.arScanResult[i].u4IELength = (UINT_32)u2IELength; - - if(u2IELength > 0) { - // IE - allocate buffer and update pointer - if(ALIGN_4(u2IELength) + prAdapter->rWlanInfo.u4ScanIEBufferUsage <= u4BufferSize) { - kalMemCopy(&(prAdapter->rWlanInfo.aucScanIEBuf[prAdapter->rWlanInfo.u4ScanIEBufferUsage]), - pucIEBuf, - u2IELength); - - prAdapter->rWlanInfo.apucScanResultIEs[i] = - &(prAdapter->rWlanInfo.aucScanIEBuf[prAdapter->rWlanInfo.u4ScanIEBufferUsage]); - - prAdapter->rWlanInfo.u4ScanIEBufferUsage += ALIGN_4(u2IELength); - } - else { - // buffer is not enough - prAdapter->rWlanInfo.arScanResult[i].u4Length -= u2IELength; - prAdapter->rWlanInfo.arScanResult[i].u4IELength = 0; - prAdapter->rWlanInfo.apucScanResultIEs[i] = NULL; - } - } - else { - prAdapter->rWlanInfo.apucScanResultIEs[i] = NULL; - } - } - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is invoked to free IE buffer for dedicated scan result -* -* @param prAdapter Pointer to the Adapter structure. -* @param u4Idx Index of Scan Result -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicFreeScanResultIE ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Idx - ) -{ - UINT_32 i; - PUINT_8 pucPivot, pucMovePivot; - UINT_32 u4MoveSize, u4FreeSize, u4ReserveSize; - - ASSERT(prAdapter); - ASSERT(u4Idx < CFG_MAX_NUM_BSS_LIST); - - if(prAdapter->rWlanInfo.arScanResult[u4Idx].u4IELength == 0 - || prAdapter->rWlanInfo.apucScanResultIEs[u4Idx] == NULL) { - return; - } - - u4FreeSize = ALIGN_4(prAdapter->rWlanInfo.arScanResult[u4Idx].u4IELength); - - pucPivot = prAdapter->rWlanInfo.apucScanResultIEs[u4Idx]; - pucMovePivot = (PUINT_8)((UINT_32)(prAdapter->rWlanInfo.apucScanResultIEs[u4Idx]) + u4FreeSize); - - u4ReserveSize = ((UINT_32)pucPivot) - (UINT_32)(&(prAdapter->rWlanInfo.aucScanIEBuf[0])); - u4MoveSize = prAdapter->rWlanInfo.u4ScanIEBufferUsage - u4ReserveSize - u4FreeSize; - - // 1. rest of buffer to move forward - kalMemCopy(pucPivot, pucMovePivot, u4MoveSize); - - // 1.1 modify pointers - for(i = 0 ; i < prAdapter->rWlanInfo.u4ScanResultNum ; i++) { - if(i != u4Idx) { - if(prAdapter->rWlanInfo.apucScanResultIEs[i] >= pucMovePivot) { - prAdapter->rWlanInfo.apucScanResultIEs[i] = - (PUINT_8)((UINT_32)(prAdapter->rWlanInfo.apucScanResultIEs[i]) - u4FreeSize); - } - } - } - - // 1.2 reset the freed one - prAdapter->rWlanInfo.arScanResult[u4Idx].u4IELength = 0; - prAdapter->rWlanInfo.apucScanResultIEs[i] = NULL; - - // 2. reduce IE buffer usage - prAdapter->rWlanInfo.u4ScanIEBufferUsage -= u4FreeSize; - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is to hack parameters for WLAN TABLE for -* fixed rate settings -* -* @param prAdapter Pointer to the Adapter structure. -* @param eRateSetting -* @param pu2DesiredNonHTRateSet, -* @param pu2BSSBasicRateSet, -* @param pucMcsSet -* @param pucSupMcs32 -* @param pu2HtCapInfo -* -* @return WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicUpdateRateParams ( - IN P_ADAPTER_T prAdapter, - IN ENUM_REGISTRY_FIXED_RATE_T eRateSetting, - IN PUINT_8 pucDesiredPhyTypeSet, - IN PUINT_16 pu2DesiredNonHTRateSet, - IN PUINT_16 pu2BSSBasicRateSet, - IN PUINT_8 pucMcsSet, - IN PUINT_8 pucSupMcs32, - IN PUINT_16 pu2HtCapInfo - ) -{ - ASSERT(prAdapter); - ASSERT(eRateSetting > FIXED_RATE_NONE && eRateSetting < FIXED_RATE_NUM); - - switch(prAdapter->rWifiVar.eRateSetting) { - case FIXED_RATE_1M: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HR_DSSS; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_1M; - *pu2BSSBasicRateSet = RATE_SET_BIT_1M; - *pucMcsSet = 0; - *pucSupMcs32 = 0; - *pu2HtCapInfo = 0; - break; - - case FIXED_RATE_2M: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HR_DSSS; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_2M; - *pu2BSSBasicRateSet = RATE_SET_BIT_2M; - *pucMcsSet = 0; - *pucSupMcs32 = 0; - *pu2HtCapInfo = 0; - break; - - case FIXED_RATE_5_5M: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HR_DSSS; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_5_5M; - *pu2BSSBasicRateSet = RATE_SET_BIT_5_5M; - *pucMcsSet = 0; - *pucSupMcs32 = 0; - *pu2HtCapInfo = 0; - break; - - case FIXED_RATE_11M: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HR_DSSS; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_11M; - *pu2BSSBasicRateSet = RATE_SET_BIT_11M; - *pucMcsSet = 0; - *pucSupMcs32 = 0; - *pu2HtCapInfo = 0; - break; - - case FIXED_RATE_6M: - if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_ERP) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_ERP; - } - else if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_OFDM) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_OFDM; - } - - *pu2DesiredNonHTRateSet = RATE_SET_BIT_6M; - *pu2BSSBasicRateSet = RATE_SET_BIT_6M; - *pucMcsSet = 0; - *pucSupMcs32 = 0; - *pu2HtCapInfo = 0; - break; - - case FIXED_RATE_9M: - if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_ERP) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_ERP; - } - else if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_OFDM) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_OFDM; - } - - *pu2DesiredNonHTRateSet = RATE_SET_BIT_9M; - *pu2BSSBasicRateSet = RATE_SET_BIT_9M; - *pucMcsSet = 0; - *pucSupMcs32 = 0; - *pu2HtCapInfo = 0; - break; - - case FIXED_RATE_12M: - if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_ERP) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_ERP; - } - else if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_OFDM) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_OFDM; - } - - *pu2DesiredNonHTRateSet = RATE_SET_BIT_12M; - *pu2BSSBasicRateSet = RATE_SET_BIT_12M; - *pucMcsSet = 0; - *pucSupMcs32 = 0; - *pu2HtCapInfo = 0; - break; - - case FIXED_RATE_18M: - if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_ERP) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_ERP; - } - else if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_OFDM) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_OFDM; - } - - *pu2DesiredNonHTRateSet = RATE_SET_BIT_18M; - *pu2BSSBasicRateSet = RATE_SET_BIT_18M; - *pucMcsSet = 0; - *pucSupMcs32 = 0; - *pu2HtCapInfo = 0; - break; - - case FIXED_RATE_24M: - if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_ERP) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_ERP; - } - else if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_OFDM) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_OFDM; - } - - *pu2DesiredNonHTRateSet = RATE_SET_BIT_24M; - *pu2BSSBasicRateSet = RATE_SET_BIT_24M; - *pucMcsSet = 0; - *pucSupMcs32 = 0; - *pu2HtCapInfo = 0; - break; - - case FIXED_RATE_36M: - if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_ERP) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_ERP; - } - else if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_OFDM) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_OFDM; - } - - *pu2DesiredNonHTRateSet = RATE_SET_BIT_36M; - *pu2BSSBasicRateSet = RATE_SET_BIT_36M; - *pucMcsSet = 0; - *pucSupMcs32 = 0; - *pu2HtCapInfo = 0; - break; - - case FIXED_RATE_48M: - if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_ERP) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_ERP; - } - else if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_OFDM) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_OFDM; - } - - *pu2DesiredNonHTRateSet = RATE_SET_BIT_48M; - *pu2BSSBasicRateSet = RATE_SET_BIT_48M; - *pucMcsSet = 0; - *pucSupMcs32 = 0; - *pu2HtCapInfo = 0; - break; - - case FIXED_RATE_54M: - if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_ERP) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_ERP; - } - else if((*pucDesiredPhyTypeSet) | PHY_TYPE_BIT_OFDM) { - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_OFDM; - } - - *pu2DesiredNonHTRateSet = RATE_SET_BIT_54M; - *pu2BSSBasicRateSet = RATE_SET_BIT_54M; - *pucMcsSet = 0; - *pucSupMcs32 = 0; - *pu2HtCapInfo = 0; - break; - - case FIXED_RATE_MCS0_20M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS0_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - break; - - case FIXED_RATE_MCS1_20M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS1_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - break; - - case FIXED_RATE_MCS2_20M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS2_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - break; - - case FIXED_RATE_MCS3_20M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS3_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - break; - - case FIXED_RATE_MCS4_20M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS4_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - break; - - case FIXED_RATE_MCS5_20M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS5_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - break; - - case FIXED_RATE_MCS6_20M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS6_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - break; - - case FIXED_RATE_MCS7_20M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS7_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - break; - - case FIXED_RATE_MCS0_20M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS0_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SHORT_GI_20M; - break; - - case FIXED_RATE_MCS1_20M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS1_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SHORT_GI_20M; - break; - - case FIXED_RATE_MCS2_20M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS2_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SHORT_GI_20M; - break; - - case FIXED_RATE_MCS3_20M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS3_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SHORT_GI_20M; - break; - - case FIXED_RATE_MCS4_20M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS4_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SHORT_GI_20M; - break; - - case FIXED_RATE_MCS5_20M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS5_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SHORT_GI_20M; - break; - - case FIXED_RATE_MCS6_20M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS6_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SHORT_GI_20M; - break; - - case FIXED_RATE_MCS7_20M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS7_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SHORT_GI_20M; - break; - - case FIXED_RATE_MCS0_40M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS0_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SUP_CHNL_WIDTH; - break; - - case FIXED_RATE_MCS1_40M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS1_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SUP_CHNL_WIDTH; - break; - - case FIXED_RATE_MCS2_40M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS2_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SUP_CHNL_WIDTH; - break; - - case FIXED_RATE_MCS3_40M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS3_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SUP_CHNL_WIDTH; - break; - - case FIXED_RATE_MCS4_40M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS4_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SUP_CHNL_WIDTH; - break; - - case FIXED_RATE_MCS5_40M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS5_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SUP_CHNL_WIDTH; - break; - - case FIXED_RATE_MCS6_40M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS6_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SUP_CHNL_WIDTH; - break; - - case FIXED_RATE_MCS7_40M_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS7_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SUP_CHNL_WIDTH; - break; - - case FIXED_RATE_MCS32_800NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS32_INDEX; - *pucSupMcs32 = 1; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_SHORT_GI_40M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= HT_CAP_INFO_SUP_CHNL_WIDTH; - break; - - case FIXED_RATE_MCS0_40M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS0_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= (HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M); - break; - - case FIXED_RATE_MCS1_40M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS1_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= (HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M); - break; - - case FIXED_RATE_MCS2_40M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS2_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= (HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M); - break; - - case FIXED_RATE_MCS3_40M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS3_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= (HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M); - break; - - case FIXED_RATE_MCS4_40M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS4_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= (HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M); - break; - - case FIXED_RATE_MCS5_40M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS5_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= (HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M); - break; - - case FIXED_RATE_MCS6_40M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS6_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= (HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M); - break; - - case FIXED_RATE_MCS7_40M_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS7_INDEX; - *pucSupMcs32 = 0; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= (HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M); - break; - - case FIXED_RATE_MCS32_400NS: - *pucDesiredPhyTypeSet = PHY_TYPE_BIT_HT; - *pu2DesiredNonHTRateSet = RATE_SET_BIT_HT_PHY; - *pu2BSSBasicRateSet = RATE_SET_BIT_HT_PHY; - *pucMcsSet = HT_RATE_MCS32_INDEX; - *pucSupMcs32 = 1; - (*pu2HtCapInfo) &= ~(HT_CAP_INFO_SHORT_GI_20M - | HT_CAP_INFO_HT_GF); - (*pu2HtCapInfo) |= (HT_CAP_INFO_SUP_CHNL_WIDTH - | HT_CAP_INFO_SHORT_GI_40M); - break; - - default: - ASSERT(0); - } - - return WLAN_STATUS_SUCCESS; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to write the register -* -* @param u4Address Register address -* u4Value the value to be written -* -* @retval WLAN_STATUS_SUCCESS -* WLAN_STATUS_FAILURE -*/ -/*----------------------------------------------------------------------------*/ - -WLAN_STATUS -nicWriteMcr ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4Address, - IN UINT_32 u4Value - ) -{ - CMD_ACCESS_REG rCmdAccessReg; - - rCmdAccessReg.u4Address = u4Address; - rCmdAccessReg.u4Data = u4Value; - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_ACCESS_REG, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_ACCESS_REG), - (PUINT_8)&rCmdAccessReg, - NULL, - 0 - ); - -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to modify the auto rate parameters -* -* @param u4ArSysParam0 see description below -* u4ArSysParam1 -* u4ArSysParam2 -* u4ArSysParam3 -* -* -* @retval WLAN_STATUS_SUCCESS -* WLAN_STATUS_FAILURE -* -* @note -* ArSysParam0[0:3] -> auto rate version (0:disable 1:version1 2:version2) -* ArSysParam0[4:5]-> auto bw version (0:disable 1:version1 2:version2) -* ArSysParam0[6:7]-> auto gi version (0:disable 1:version1 2:version2) -* ArSysParam0[8:15]-> HT rate clear mask -* ArSysParam0[16:31]-> Legacy rate clear mask -* ArSysParam1[0:7]-> Auto Rate check weighting window -* ArSysParam1[8:15]-> Auto Rate v1 Force Rate down -* ArSysParam1[16:23]-> Auto Rate v1 PerH -* ArSysParam1[24:31]-> Auto Rate v1 PerL -* -* Examples -* ArSysParam0 = 1, -* Enable auto rate version 1 -* -* ArSysParam0 = 983041, -* Enable auto rate version 1 -* Remove CCK 1M, 2M, 5.5M, 11M -* -* ArSysParam0 = 786433 -* Enable auto rate version 1 -* Remove CCK 5.5M 11M -*/ -/*----------------------------------------------------------------------------*/ - - -WLAN_STATUS -nicRlmArUpdateParms( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4ArSysParam0, - IN UINT_32 u4ArSysParam1, - IN UINT_32 u4ArSysParam2, - IN UINT_32 u4ArSysParam3 - ) -{ - UINT_8 ucArVer,ucAbwVer,ucAgiVer; - UINT_16 u2HtClrMask; - UINT_16 u2LegacyClrMask; - UINT_8 ucArCheckWindow; - UINT_8 ucArPerL; - UINT_8 ucArPerH; - UINT_8 ucArPerForceRateDownPer; - - ucArVer = (UINT_8)(u4ArSysParam0 & BITS(0,3)); - ucAbwVer = (UINT_8)((u4ArSysParam0 & BITS(4,5)) >>4); - ucAgiVer = (UINT_8)((u4ArSysParam0 & BITS(6,7)) >>6); - u2HtClrMask = (UINT_16) ((u4ArSysParam0 & BITS(8,15)) >> 8); - u2LegacyClrMask = (UINT_16) ((u4ArSysParam0 & BITS(16,31)) >> 16); - -#if 0 - ucArCheckWindow = (UINT_8) (u4ArSysParam1 & BITS(0,7)); - ucArPerForceRateDownPer = (UINT_8) ((u4ArSysParam1 & BITS(8,15)>>8)); - ucArPerH = (UINT_8) ((u4ArSysParam1 & BITS(16,23)) >>16); - ucArPerL = (UINT_8) ((u4ArSysParam1 & BITS(24,31)) >>24); -#endif - - ucArCheckWindow = (UINT_8) (u4ArSysParam1 & BITS(0,7)); - ucArPerForceRateDownPer = (UINT_8) (((u4ArSysParam1>>8) & BITS(0,7))); - ucArPerH = (UINT_8) (((u4ArSysParam1>>16) & BITS(0,7))); - ucArPerL = (UINT_8) (((u4ArSysParam1>>24) & BITS(0,7))); - - - DBGLOG(INIT, INFO, ("ArParam %u %u %u %u\n", u4ArSysParam0, u4ArSysParam1, u4ArSysParam2, u4ArSysParam3)); - DBGLOG(INIT, INFO, ("ArVer %u AbwVer %u AgiVer %u\n", ucArVer, ucAbwVer, ucAgiVer)); - DBGLOG(INIT, INFO, ("HtMask %x LegacyMask %x\n", u2HtClrMask, u2LegacyClrMask)); - DBGLOG(INIT, INFO, ("CheckWin %u RateDownPer %u PerH %u PerL %u\n", ucArCheckWindow, ucArPerForceRateDownPer, ucArPerH, ucArPerL)); - -#define SWCR_DATA_ADDR(MOD,ADDR) (0x90000000+(MOD<<8)+(ADDR)) -#define SWCR_DATA_CMD(CATE,WRITE,INDEX,OPT0,OPT1) ( (CATE<<24) | (WRITE<<23) | (INDEX<<16) | (OPT0 <<8) | OPT1 ) -#define SWCR_DATA0 0x0 -#define SWCR_DATA1 0x4 -#define SWCR_DATA2 0x8 -#define SWCR_DATA3 0xC -#define SWCR_DATA4 0x10 -#define SWCR_WRITE 1 -#define SWCR_READ 0 - - if(ucArVer > 0) { - /* dummy = WiFi.WriteMCR(&h90000104, &h00000001) */ - /* dummy = WiFi.WriteMCR(&h90000100, &h00850000)*/ - - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA1),1); - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA0),SWCR_DATA_CMD(0,SWCR_WRITE,5,0,0)); - } - else { - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA1),0); - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA0),SWCR_DATA_CMD(0,SWCR_WRITE,5,0,0)) ; - } - - /* ucArVer 0: none 1:PER 2:Rcpi */ - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA1),ucArVer); - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA0),SWCR_DATA_CMD(0,SWCR_WRITE,7,0,0)); - - /* Candidate rate Ht mask */ - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA1),u2HtClrMask); - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA0),SWCR_DATA_CMD(0,SWCR_WRITE,0x1c,0,0)); - - /* Candidate rate legacy mask */ - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA1),u2LegacyClrMask); - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA0),SWCR_DATA_CMD(0,SWCR_WRITE,0x1d,0,0)); - -#if 0 - if(ucArCheckWindow!=0) { - /* TX DONE MCS INDEX CHECK STA RATE DOWN TH */ - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA1),ucArCheckWindow); - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA0),SWCR_DATA_CMD(0,SWCR_WRITE,0x14,0,0)); - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA1),ucArCheckWindow); - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA0),SWCR_DATA_CMD(0,SWCR_WRITE,0xc,0,0)); - } - - if(ucArPerForceRateDownPer !=0) { - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA1),ucArPerForceRateDownPer); - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA0),SWCR_DATA_CMD(0,SWCR_WRITE,0x18,0,0)); - } - if(ucArPerH !=0) { - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA1),ucArPerH); - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA0),SWCR_DATA_CMD(0,SWCR_WRITE,0x1,0,0)); - } - if(ucArPerL !=0) { - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA1),ucArPerL); - nicWriteMcr (prAdapter, SWCR_DATA_ADDR(1/*MOD*/,SWCR_DATA0),SWCR_DATA_CMD(0,SWCR_WRITE,0x2,0,0)); - } -#endif - - - - return WLAN_STATUS_SUCCESS; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This utility function is used to enable roaming -* -* @param u4EnableRoaming -* -* -* @retval WLAN_STATUS_SUCCESS -* WLAN_STATUS_FAILURE -* -* @note -* u4EnableRoaming -> Enable Romaing -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicRoamingUpdateParams( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4EnableRoaming - ) -{ - P_CONNECTION_SETTINGS_T prConnSettings; - - prConnSettings = &(prAdapter->rWifiVar.rConnSettings); - prConnSettings->fgIsEnableRoaming = ((u4EnableRoaming>0)?(TRUE):(FALSE)); - - return WLAN_STATUS_SUCCESS; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief dump firmware Assert message -* -* \param[in] -* prAdapter -* -* \return -* TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicPrintFirmwareAssertInfo( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 u4MailBox0, u4MailBox1; - UINT_32 line = 0; - UINT_8 aucAssertFile[7]; - UINT_32 u4ChipId; - -#if CFG_SDIO_INTR_ENHANCE - u4MailBox0 = prAdapter->prSDIOCtrl->u4RcvMailbox0; - u4MailBox1 = prAdapter->prSDIOCtrl->u4RcvMailbox1; -#else - nicGetMailbox(prAdapter, 0, &u4MailBox0); - nicGetMailbox(prAdapter, 1, &u4MailBox1); -#endif - - line = u4MailBox0 & 0x0000FFFF; - - u4MailBox0 = ((u4MailBox0 >> 16) & 0x0000FFFF); - - kalMemCopy(&aucAssertFile[0], &u4MailBox0, 2); - kalMemCopy(&aucAssertFile[2], &u4MailBox1, 4); - - aucAssertFile[6] = '\0'; - -#if defined(MT6620) - u4ChipId = 6620; -#elif defined(MT5931) - u4ChipId = 5931; -#elif defined(MT6628) - u4ChipId = 6628; -#endif - - kalPrint("\n[MT%ld][wifi][Firmware] Assert at \"%s\" #%ld\n\n", - u4ChipId, - aucAssertFile, - line); - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to update Link Quality information -* -* @param prAdapter Pointer of Adapter Data Structure -* eNetTypeIdx -* prEventLinkQuality -* cRssi -* cLinkQuality -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicUpdateLinkQuality( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIdx, - IN P_EVENT_LINK_QUALITY prEventLinkQuality - ) -{ - ASSERT(prAdapter); - ASSERT(eNetTypeIdx < NETWORK_TYPE_INDEX_NUM); - ASSERT(prEventLinkQuality); - - switch(eNetTypeIdx) { - case NETWORK_TYPE_AIS_INDEX: - if(prAdapter->rWifiVar.arBssInfo[eNetTypeIdx].eConnectionState == PARAM_MEDIA_STATE_CONNECTED) { - /* check is to prevent RSSI to be updated by incorrect initial RSSI from hardware */ - /* buffer statistics for further query */ - if(prAdapter->fgIsLinkQualityValid == FALSE - || (kalGetTimeTick() - prAdapter->rLinkQualityUpdateTime) > CFG_LINK_QUALITY_VALID_PERIOD) { - nicUpdateRSSI(prAdapter, eNetTypeIdx, prEventLinkQuality->cRssi, prEventLinkQuality->cLinkQuality); - } - - if(prAdapter->fgIsLinkRateValid == FALSE - || (kalGetTimeTick() - prAdapter->rLinkRateUpdateTime) > CFG_LINK_QUALITY_VALID_PERIOD) { - nicUpdateLinkSpeed(prAdapter, eNetTypeIdx, prEventLinkQuality->u2LinkSpeed); - } - } - break; -#if CFG_ENABLE_WIFI_DIRECT && CFG_SUPPORT_P2P_RSSI_QUERY - case NETWORK_TYPE_P2P_INDEX: - if (prAdapter->fgIsP2pLinkQualityValid == FALSE - || (kalGetTimeTick() - prAdapter->rP2pLinkQualityUpdateTime) > CFG_LINK_QUALITY_VALID_PERIOD) { - P_EVENT_LINK_QUALITY_EX prEventLQEx = (P_EVENT_LINK_QUALITY_EX)prEventLinkQuality; - - nicUpdateRSSI(prAdapter, NETWORK_TYPE_P2P_INDEX, prEventLQEx->cRssiP2P, prEventLQEx->cLinkQualityP2P); - } - break; -#endif - default: - break; - - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to update RSSI and Link Quality information -* -* @param prAdapter Pointer of Adapter Data Structure -* eNetTypeIdx -* cRssi -* cLinkQuality -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicUpdateRSSI( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIdx, - IN INT_8 cRssi, - IN INT_8 cLinkQuality - ) -{ - ASSERT(prAdapter); - ASSERT(eNetTypeIdx < NETWORK_TYPE_INDEX_NUM); - - switch(eNetTypeIdx) { - case NETWORK_TYPE_AIS_INDEX: - if(prAdapter->rWifiVar.arBssInfo[eNetTypeIdx].eConnectionState == PARAM_MEDIA_STATE_CONNECTED) { - prAdapter->fgIsLinkQualityValid = TRUE; - prAdapter->rLinkQualityUpdateTime = kalGetTimeTick(); - - prAdapter->rLinkQuality.cRssi = cRssi; - prAdapter->rLinkQuality.cLinkQuality = cLinkQuality; - - /* indicate to glue layer */ - kalUpdateRSSI(prAdapter->prGlueInfo, - KAL_NETWORK_TYPE_AIS_INDEX, - prAdapter->rLinkQuality.cRssi, - prAdapter->rLinkQuality.cLinkQuality); - } - - break; -#if CFG_ENABLE_WIFI_DIRECT -#if CFG_SUPPORT_P2P_RSSI_QUERY - case NETWORK_TYPE_P2P_INDEX: - prAdapter->fgIsP2pLinkQualityValid = TRUE; - prAdapter->rP2pLinkQualityUpdateTime = kalGetTimeTick(); - - prAdapter->rP2pLinkQuality.cRssi= cRssi; - prAdapter->rP2pLinkQuality.cLinkQuality= cLinkQuality; - - kalUpdateRSSI(prAdapter->prGlueInfo, - KAL_NETWORK_TYPE_P2P_INDEX, - cRssi, - cLinkQuality); - break; -#endif -#endif - default: - break; - - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called to update Link Quality information -* -* @param prAdapter Pointer of Adapter Data Structure -* eNetTypeIdx -* prEventLinkQuality -* cRssi -* cLinkQuality -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicUpdateLinkSpeed( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetTypeIdx, - IN UINT_16 u2LinkSpeed - ) -{ - ASSERT(prAdapter); - ASSERT(eNetTypeIdx < NETWORK_TYPE_INDEX_NUM); - - switch(eNetTypeIdx) { - case NETWORK_TYPE_AIS_INDEX: - if(prAdapter->rWifiVar.arBssInfo[eNetTypeIdx].eConnectionState == PARAM_MEDIA_STATE_CONNECTED) { - /* buffer statistics for further query */ - prAdapter->fgIsLinkRateValid = TRUE; - prAdapter->rLinkRateUpdateTime = kalGetTimeTick(); - - prAdapter->rLinkQuality.u2LinkSpeed = u2LinkSpeed; - } - break; - - default: - break; - - } - - return; -} - -#if CFG_SUPPORT_RDD_TEST_MODE -WLAN_STATUS -nicUpdateRddTestMode( - IN P_ADAPTER_T prAdapter, - IN P_CMD_RDD_CH_T prRddChParam - ) -{ - DEBUGFUNC("nicUpdateRddTestMode.\n"); - - ASSERT(prAdapter); - -// aisFsmScanRequest(prAdapter, NULL); - - return wlanSendSetQueryCmd(prAdapter, - CMD_ID_SET_RDD_CH, - TRUE, - FALSE, - FALSE, - NULL, - NULL, - sizeof(CMD_RDD_CH_T), - (PUINT_8)prRddChParam, - NULL, - 0); -} -#endif - diff --git a/drivers/net/wireless/mt5931/nic/nic_cmd_event.c b/drivers/net/wireless/mt5931/nic/nic_cmd_event.c deleted file mode 100755 index c9743946d88c..000000000000 --- a/drivers/net/wireless/mt5931/nic/nic_cmd_event.c +++ /dev/null @@ -1,1651 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/nic/nic_cmd_event.c#1 $ -*/ - -/*! \file nic_cmd_event.c - \brief Callback functions for Command packets. - - Various Event packet handlers which will be setup in the callback function of - a command packet. -*/ - - - -/* -** $Log: nic_cmd_event.c $ - * - * 04 10 2012 yuche.tsai - * NULL - * Update address for wifi direct connection issue. - * - * 06 15 2011 cm.chang - * [WCXRP00000785] [MT6620 Wi-Fi][Driver][FW] P2P/BOW MAC address is XOR with AIS MAC address - * P2P/BOW mac address XOR with local bit instead of OR - * - * 03 05 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * add the code to get the check rsponse and indicate to app. - * - * 03 02 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * Add security check code. - * - * 02 24 2011 cp.wu - * [WCXRP00000493] [MT6620 Wi-Fi][Driver] Do not indicate redundant disconnection to host when entering into RF test mode - * only indicate DISCONNECTION to host when entering RF test if necessary (connected -> disconnected cases) - * - * 01 20 2011 eddie.chen - * [WCXRP00000374] [MT6620 Wi-Fi][DRV] SW debug control - * Add Oid for sw control debug command - * - * 12 31 2010 cp.wu - * [WCXRP00000335] [MT6620 Wi-Fi][Driver] change to use milliseconds sleep instead of delay to avoid blocking to system scheduling - * change to use msleep() and shorten waiting interval to reduce blocking to other task while Wi-Fi driver is being loaded - * - * 12 01 2010 cp.wu - * [WCXRP00000223] MT6620 Wi-Fi][Driver][FW] Adopt NVRAM parameters when enter/exit RF test mode - * reload NVRAM settings before entering RF test mode and leaving from RF test mode. - * - * 11 01 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module - * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead - * 2) Remove CNM CH-RECOVER event handling - * 3) cfg read/write API renamed with kal prefix for unified naming rules. - * - * 10 20 2010 cp.wu - * [WCXRP00000117] [MT6620 Wi-Fi][Driver] Add logic for suspending driver when MT6620 is not responding anymore - * use OID_CUSTOM_TEST_MODE as indication for driver reset - * by dropping pending TX packets - * - * 10 18 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android - * complete implementation of Android NVRAM access - * - * 09 21 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * Do a complete reset with STA-REC null checking for RF test re-entry - * - * 09 15 2010 yuche.tsai - * NULL - * Start to test AT GO only when P2P state is not IDLE. - * - * 09 09 2010 yuche.tsai - * NULL - * Add AT GO Test mode after MAC address available. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 30 2010 cp.wu - * NULL - * eliminate klockwork errors - * - * 08 16 2010 cp.wu - * NULL - * Replace CFG_SUPPORT_BOW by CFG_ENABLE_BT_OVER_WIFI. - * There is no CFG_SUPPORT_BOW in driver domain source. - * - * 08 12 2010 cp.wu - * NULL - * [AIS-FSM] honor registry setting for adhoc running mode. (A/B/G) - * - * 08 11 2010 yuche.tsai - * NULL - * Add support for P2P Device Address query from FW. - * - * 08 03 2010 cp.wu - * NULL - * Centralize mgmt/system service procedures into independent calls. - * - * 08 02 2010 cp.wu - * NULL - * reset FSMs before entering RF test mode. - * - * 07 22 2010 cp.wu - * - * 1) refine AIS-FSM indent. - * 2) when entering RF Test mode, flush 802.1X frames as well - * 3) when entering D3 state, flush 802.1X frames as well - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 05 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) change fake BSS_DESC from channel 6 to channel 1 due to channel switching is not done yet. - * 2) after MAC address is queried from firmware, all related variables in driver domain should be updated as well - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * remove duplicate variable for migration. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 29 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * change upon request: indicate as disconnected in driver domain when leaving from RF test mode - * - * 05 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * do not clear scanning list array after disassociation - * - * 05 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) disable NETWORK_LAYER_ADDRESSES handling temporally. - * 2) finish statistics OIDs - * - * 05 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * change OID behavior to meet WHQL requirement. - * - * 05 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS - * 2) buffer statistics data for 2 seconds - * 3) use default value for adhoc parameters instead of 0 - * - * 05 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) do not take timeout mechanism for power mode oids - * 2) retrieve network type from connection status - * 3) after disassciation, set radio state to off - * 4) TCP option over IPv6 is supported - * - * 05 17 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct OID_802_11_DISASSOCIATE handling. - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * 1) add timeout handler mechanism for pending command packets - * 2) add p2p add/removal key - * - * 04 16 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * treat BUS access failure as kind of card removal. - * - * 04 14 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * information buffer for query oid/ioctl is now buffered in prCmdInfo - * * * * * * instead of glue-layer variable to improve multiple oid/ioctl capability - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * * * * * * * * * * * 2) command sequence number is now increased atomically - * * * * * * * * * * * * * * 3) private data could be hold and taken use for other purpose - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * accessing to firmware load/start address, and access to OID handling information - * are now handled in glue layer - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * rWlanInfo should be placed at adapter rather than glue due to most operations - * * * * are done in adapter layer. - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add KAL API: kalFlushPendingTxPackets(), and take use of the API - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access to prGlueInfo->rWlanInfo.eLinkAttr.ucMediaStreamMode from non-glue layer. - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * improve none-glude code portability - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * sync statistics data structure definition with firmware implementation - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * code refine: fgTestMode should be at adapter rather than glue due to the device/fw is also involved - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer - * - * 03 30 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * statistics information OIDs are now handled by querying from firmware domain - * - * 03 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * indicate media stream mode after set is done - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port - * - * 03 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement custom OID: EEPROM read/write access - * - * 03 03 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement OID_802_3_MULTICAST_LIST oid handling - * - * 02 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * limit RSSI return value to microsoft defined range. - * - * 02 09 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address - * * * * * * * 2. follow MSDN defined behavior when associates to another AP - * * * * * * * 3. for firmware download, packet size could be up to 2048 bytes - * - * 01 29 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * block until firmware finished RF test enter/leave then indicate completion to upper layer - * - * 01 29 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * when entering RF test mode and leaving from RF test mode, wait for W_FUNC_RDY bit to be asserted forever until it is set or card is removed. - * - * 01 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. eliminate improper variable in rHifInfo - * * * * * * * * 2. block TX/ordinary OID when RF test mode is engaged - * * * * * * * * 3. wait until firmware finish operation when entering into and leaving from RF test mode - * * * * * * * * 4. correct some HAL implementation - * - * 01 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Under WinXP with SDIO, use prGlueInfo->rHifInfo.pvInformationBuffer instead of prGlueInfo->pvInformationBuffer - * - * 01 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement following 802.11 OIDs: - * * * * * OID_802_11_RSSI, - * * * * * OID_802_11_RSSI_TRIGGER, - * * * * * OID_802_11_STATISTICS, - * * * * * OID_802_11_DISASSOCIATE, - * * * * * OID_802_11_POWER_MODE - * - * 01 21 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement OID_802_11_MEDIA_STREAM_MODE - * - * 12 30 2009 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) According to CMD/EVENT documentation v0.8, - * * * * * * * * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used, - * * * * * * * * and result is retrieved by get ATInfo instead - * * * * * * * * 2) add 4 counter for recording aggregation statistics -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-12-10 16:47:47 GMT mtk02752 -** only handle MCR read when accessing FW domain register -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-12-08 17:37:28 GMT mtk02752 -** * refine nicCmdEventQueryMcrRead -** + add TxStatus/RxStatus for RF test QueryInformation OIDs -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-12-02 22:05:45 GMT mtk02752 -** kalOidComplete() will decrease i4OidPendingCount -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-12-01 23:02:57 GMT mtk02752 -** remove unnecessary spin locks -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-12-01 22:51:18 GMT mtk02752 -** maintein i4OidPendingCount -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-11-30 10:55:03 GMT mtk02752 -** modify for compatibility -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-11-23 14:46:32 GMT mtk02752 -** add another version of command-done handler upon new event structure -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-04-29 15:42:33 GMT mtk01461 -** Add comment -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-04-21 19:32:42 GMT mtk01461 -** Add nicCmdEventSetCommon() for general set OID -** \main\maintrunk.MT6620WiFiDriver_Prj\1 2009-04-21 01:40:35 GMT mtk01461 -** Command Done Handler -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -VOID -nicCmdEventQueryMcrRead ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - UINT_32 u4QueryInfoLen; - P_PARAM_CUSTOM_MCR_RW_STRUC_T prMcrRdInfo; - P_GLUE_INFO_T prGlueInfo; - P_CMD_ACCESS_REG prCmdAccessReg; - - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - ASSERT(pucEventBuf); - - //4 <2> Update information of OID - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - prCmdAccessReg = (P_CMD_ACCESS_REG)(pucEventBuf); - - u4QueryInfoLen = sizeof(PARAM_CUSTOM_MCR_RW_STRUC_T); - - prMcrRdInfo = (P_PARAM_CUSTOM_MCR_RW_STRUC_T) prCmdInfo->pvInformationBuffer; - prMcrRdInfo->u4McrOffset = prCmdAccessReg->u4Address; - prMcrRdInfo->u4McrData = prCmdAccessReg->u4Data; - - kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS); - } - - return; - -} - - -VOID -nicCmdEventQuerySwCtrlRead ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - UINT_32 u4QueryInfoLen; - P_PARAM_CUSTOM_SW_CTRL_STRUC_T prSwCtrlInfo; - P_GLUE_INFO_T prGlueInfo; - P_CMD_SW_DBG_CTRL_T prCmdSwCtrl; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - ASSERT(pucEventBuf); - - //4 <2> Update information of OID - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - prCmdSwCtrl = (P_CMD_SW_DBG_CTRL_T)(pucEventBuf); - - u4QueryInfoLen = sizeof(PARAM_CUSTOM_SW_CTRL_STRUC_T); - - prSwCtrlInfo = (P_PARAM_CUSTOM_SW_CTRL_STRUC_T) prCmdInfo->pvInformationBuffer; - prSwCtrlInfo->u4Id = prCmdSwCtrl->u4Id; - prSwCtrlInfo->u4Data = prCmdSwCtrl->u4Data; - - kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS); - } - - return; - -} - - - -VOID -nicCmdEventSetCommon ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - if (prCmdInfo->fgIsOid) { - /* Update Set Infomation Length */ - kalOidComplete(prAdapter->prGlueInfo, - prCmdInfo->fgSetQuery, - prCmdInfo->u4InformationBufferLength, - WLAN_STATUS_SUCCESS); - } - - return; -} - -VOID -nicCmdEventSetDisassociate ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - if (prCmdInfo->fgIsOid) { - /* Update Set Infomation Length */ - kalOidComplete(prAdapter->prGlueInfo, - prCmdInfo->fgSetQuery, - 0, - WLAN_STATUS_SUCCESS); - } - - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_DISCONNECT, - NULL, - 0); - -#if !defined(LINUX) - prAdapter->fgIsRadioOff = TRUE; -#endif - - return; -} - -VOID -nicCmdEventSetIpAddress ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - UINT_32 u4Count; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - u4Count = (prCmdInfo->u4SetInfoLen - OFFSET_OF(CMD_SET_NETWORK_ADDRESS_LIST, arNetAddress)) - / sizeof(IPV4_NETWORK_ADDRESS) ; - - if (prCmdInfo->fgIsOid) { - /* Update Set Infomation Length */ - kalOidComplete(prAdapter->prGlueInfo, - prCmdInfo->fgSetQuery, - OFFSET_OF(PARAM_NETWORK_ADDRESS_LIST, arAddress) + u4Count * - (OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(PARAM_NETWORK_ADDRESS_IP)), - WLAN_STATUS_SUCCESS); - } - - return; -} - -VOID -nicCmdEventQueryRfTestATInfo( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_EVENT_TEST_STATUS prTestStatus, prQueryBuffer; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4QueryInfoLen; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prTestStatus = (P_EVENT_TEST_STATUS)pucEventBuf; - - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - prQueryBuffer = (P_EVENT_TEST_STATUS) prCmdInfo->pvInformationBuffer; - - kalMemCopy(prQueryBuffer, prTestStatus, sizeof(EVENT_TEST_STATUS)); - - u4QueryInfoLen = sizeof(EVENT_TEST_STATUS); - - /* Update Query Infomation Length */ - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - u4QueryInfoLen, - WLAN_STATUS_SUCCESS); - } - - return; -} - -VOID -nicCmdEventQueryLinkQuality( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - PARAM_RSSI rRssi, *prRssi; - P_EVENT_LINK_QUALITY prLinkQuality; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4QueryInfoLen; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prLinkQuality = (P_EVENT_LINK_QUALITY)pucEventBuf; - - rRssi = (PARAM_RSSI)prLinkQuality->cRssi; // ranged from (-128 ~ 30) in unit of dBm - - if(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX].eConnectionState == PARAM_MEDIA_STATE_CONNECTED) { - if(rRssi > PARAM_WHQL_RSSI_MAX_DBM) - rRssi = PARAM_WHQL_RSSI_MAX_DBM; - else if(rRssi < PARAM_WHQL_RSSI_MIN_DBM) - rRssi = PARAM_WHQL_RSSI_MIN_DBM; - } - else { - rRssi = PARAM_WHQL_RSSI_MIN_DBM; - } - - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - prRssi = (PARAM_RSSI *) prCmdInfo->pvInformationBuffer; - - kalMemCopy(prRssi, &rRssi, sizeof(PARAM_RSSI)); - u4QueryInfoLen = sizeof(PARAM_RSSI); - - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - u4QueryInfoLen, - WLAN_STATUS_SUCCESS); - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This routine is in response of OID_GEN_LINK_SPEED query request -* -* @param prAdapter Pointer to the Adapter structure. -* @param prCmdInfo Pointer to the pending command info -* @param pucEventBuf -* -* @retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicCmdEventQueryLinkSpeed( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_EVENT_LINK_QUALITY prLinkQuality; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4QueryInfoLen; - PUINT_32 pu4LinkSpeed; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prLinkQuality = (P_EVENT_LINK_QUALITY)pucEventBuf; - - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - pu4LinkSpeed = (PUINT_32)(prCmdInfo->pvInformationBuffer); - - if(prLinkQuality->u2LinkSpeed == 0) { - *pu4LinkSpeed = 10000; /* 10K * 100bps = 1Mbps */ - } - else { - *pu4LinkSpeed = prLinkQuality->u2LinkSpeed * 5000; - } - - u4QueryInfoLen = sizeof(UINT_32); - - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - u4QueryInfoLen, - WLAN_STATUS_SUCCESS); - } -} - - -VOID -nicCmdEventQueryStatistics( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_PARAM_802_11_STATISTICS_STRUCT_T prStatistics; - P_EVENT_STATISTICS prEventStatistics; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4QueryInfoLen; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf; - - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - - u4QueryInfoLen = sizeof(PARAM_802_11_STATISTICS_STRUCT_T); - prStatistics = (P_PARAM_802_11_STATISTICS_STRUCT_T) prCmdInfo->pvInformationBuffer; - - prStatistics->u4Length = sizeof(PARAM_802_11_STATISTICS_STRUCT_T); - prStatistics->rTransmittedFragmentCount - = prEventStatistics->rTransmittedFragmentCount; - prStatistics->rMulticastTransmittedFrameCount - = prEventStatistics->rMulticastTransmittedFrameCount; - prStatistics->rFailedCount - = prEventStatistics->rFailedCount; - prStatistics->rRetryCount - = prEventStatistics->rRetryCount; - prStatistics->rMultipleRetryCount - = prEventStatistics->rMultipleRetryCount; - prStatistics->rRTSSuccessCount - = prEventStatistics->rRTSSuccessCount; - prStatistics->rRTSFailureCount - = prEventStatistics->rRTSFailureCount; - prStatistics->rACKFailureCount - = prEventStatistics->rACKFailureCount; - prStatistics->rFrameDuplicateCount - = prEventStatistics->rFrameDuplicateCount; - prStatistics->rReceivedFragmentCount - = prEventStatistics->rReceivedFragmentCount; - prStatistics->rMulticastReceivedFrameCount - = prEventStatistics->rMulticastReceivedFrameCount; - prStatistics->rFCSErrorCount - = prEventStatistics->rFCSErrorCount; - prStatistics->rTKIPLocalMICFailures.QuadPart - = 0; - prStatistics->rTKIPICVErrors.QuadPart - = 0; - prStatistics->rTKIPCounterMeasuresInvoked.QuadPart - = 0; - prStatistics->rTKIPReplays.QuadPart - = 0; - prStatistics->rCCMPFormatErrors.QuadPart - = 0; - prStatistics->rCCMPReplays.QuadPart - = 0; - prStatistics->rCCMPDecryptErrors.QuadPart - = 0; - prStatistics->rFourWayHandshakeFailures.QuadPart - = 0; - prStatistics->rWEPUndecryptableCount.QuadPart - = 0; - prStatistics->rWEPICVErrorCount.QuadPart - = 0; - prStatistics->rDecryptSuccessCount.QuadPart - = 0; - prStatistics->rDecryptFailureCount.QuadPart - = 0; - - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - u4QueryInfoLen, - WLAN_STATUS_SUCCESS); - } -} - -VOID -nicCmdEventEnterRfTest( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - UINT_32 u4WHISR = 0, u4Value = 0; - UINT_8 aucTxCount[8]; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - // [driver-land] - prAdapter->fgTestMode = TRUE; - - // 0. always indicate disconnection - if(kalGetMediaStateIndicated(prAdapter->prGlueInfo) != PARAM_MEDIA_STATE_DISCONNECTED) { - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_DISCONNECT, - NULL, - 0); - } - - // 1. Remove pending TX - nicTxRelease(prAdapter); - - // 1.1 clear pending Security / Management Frames - kalClearSecurityFrames(prAdapter->prGlueInfo); - kalClearMgmtFrames(prAdapter->prGlueInfo); - - // 1.2 clear pending TX packet queued in glue layer - kalFlushPendingTxPackets(prAdapter->prGlueInfo); - - // 2. Reset driver-domain FSMs - nicUninitMGMT(prAdapter); - - nicResetSystemService(prAdapter); - nicInitMGMT(prAdapter, NULL); - - // 3. Disable Interrupt - HAL_INTR_DISABLE(prAdapter); - - // 4. Block til firmware completed entering into RF test mode - kalMsleep(500); - while(1) { - HAL_MCR_RD(prAdapter, MCR_WCIR, &u4Value); - - if (u4Value & WCIR_WLAN_READY) { - break; - } - else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - if (prCmdInfo->fgIsOid) { - /* Update Set Infomation Length */ - kalOidComplete(prAdapter->prGlueInfo, - prCmdInfo->fgSetQuery, - prCmdInfo->u4SetInfoLen, - WLAN_STATUS_NOT_SUPPORTED); - - } - return; - } - else - kalMsleep(10); - } - - // 5. Clear Interrupt Status - HAL_READ_INTR_STATUS(prAdapter, 4, (PUINT_8)&u4WHISR); - if(HAL_IS_TX_DONE_INTR(u4WHISR)) { - HAL_READ_TX_RELEASED_COUNT(prAdapter, aucTxCount); - } - - // 6. Reset TX Counter - nicTxResetResource(prAdapter); - - // 7. Re-enable Interrupt - HAL_INTR_ENABLE(prAdapter); - - // 8. completion indication - if (prCmdInfo->fgIsOid) { - /* Update Set Infomation Length */ - kalOidComplete(prAdapter->prGlueInfo, - prCmdInfo->fgSetQuery, - prCmdInfo->u4SetInfoLen, - WLAN_STATUS_SUCCESS); - } - -#if CFG_SUPPORT_NVRAM - // 9. load manufacture data - wlanLoadManufactureData(prAdapter, kalGetConfiguration(prAdapter->prGlueInfo)); -#endif - - return; -} - -VOID -nicCmdEventLeaveRfTest( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - UINT_32 u4WHISR = 0, u4Value = 0; - UINT_8 aucTxCount[8]; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - // 1. Disable Interrupt - HAL_INTR_DISABLE(prAdapter); - - // 2. Block til firmware completed leaving from RF test mode - kalMsleep(500); - while(1) { - HAL_MCR_RD(prAdapter, MCR_WCIR, &u4Value); - - if (u4Value & WCIR_WLAN_READY) { - break; - } - else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - if (prCmdInfo->fgIsOid) { - /* Update Set Infomation Length */ - kalOidComplete(prAdapter->prGlueInfo, - prCmdInfo->fgSetQuery, - prCmdInfo->u4SetInfoLen, - WLAN_STATUS_NOT_SUPPORTED); - - } - return; - } - else { - kalMsleep(10); - } - } - - // 3. Clear Interrupt Status - HAL_READ_INTR_STATUS(prAdapter, 4, (PUINT_8)&u4WHISR); - if(HAL_IS_TX_DONE_INTR(u4WHISR)) { - HAL_READ_TX_RELEASED_COUNT(prAdapter, aucTxCount); - } - - // 4. Reset TX Counter - nicTxResetResource(prAdapter); - - // 5. Re-enable Interrupt - HAL_INTR_ENABLE(prAdapter); - - // 6. set driver-land variable - prAdapter->fgTestMode = FALSE; - - // 7. completion indication - if (prCmdInfo->fgIsOid) { - /* Update Set Infomation Length */ - kalOidComplete(prAdapter->prGlueInfo, - prCmdInfo->fgSetQuery, - prCmdInfo->u4SetInfoLen, - WLAN_STATUS_SUCCESS); - } - - /* 8. Indicate as disconnected */ - if(kalGetMediaStateIndicated(prAdapter->prGlueInfo) != PARAM_MEDIA_STATE_DISCONNECTED) { - - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_DISCONNECT, - NULL, - 0); - - prAdapter->rWlanInfo.u4SysTime = kalGetTimeTick(); - } - -#if CFG_SUPPORT_NVRAM - /* 9. load manufacture data */ - wlanLoadManufactureData(prAdapter, kalGetConfiguration(prAdapter->prGlueInfo)); -#endif - - /* 10. Override network address */ - wlanUpdateNetworkAddress(prAdapter); - - return; -} - -VOID -nicCmdEventQueryAddress( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - UINT_32 u4QueryInfoLen; - P_GLUE_INFO_T prGlueInfo; - P_EVENT_BASIC_CONFIG prEventBasicConfig; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - ASSERT(pucEventBuf); - - prEventBasicConfig = (P_EVENT_BASIC_CONFIG)(pucEventBuf); - - // copy to adapter - kalMemCopy(&(prAdapter->rMyMacAddr), &(prEventBasicConfig->rMyMacAddr), MAC_ADDR_LEN); - - //4 <2> Update information of OID - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - - kalMemCopy(prCmdInfo->pvInformationBuffer, &(prEventBasicConfig->rMyMacAddr), MAC_ADDR_LEN); - u4QueryInfoLen = MAC_ADDR_LEN; - - kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS); - } - - //4 <3> Update new MAC address and all 3 networks - COPY_MAC_ADDR(prAdapter->rWifiVar.aucMacAddress, prAdapter->rMyMacAddr); - COPY_MAC_ADDR(prAdapter->rWifiVar.aucDeviceAddress, prAdapter->rMyMacAddr); - prAdapter->rWifiVar.aucDeviceAddress[0] ^= MAC_ADDR_LOCAL_ADMIN; - - COPY_MAC_ADDR(prAdapter->rWifiVar.aucInterfaceAddress, prAdapter->rMyMacAddr); - prAdapter->rWifiVar.aucInterfaceAddress[0] ^= MAC_ADDR_LOCAL_ADMIN; - - COPY_MAC_ADDR(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_AIS_INDEX].aucOwnMacAddr, - prAdapter->rMyMacAddr); - -#if CFG_ENABLE_WIFI_DIRECT - if(prAdapter->fgIsP2PRegistered) { - COPY_MAC_ADDR(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX].aucOwnMacAddr, - prAdapter->rWifiVar.aucDeviceAddress); - } -#endif - -#if CFG_ENABLE_BT_OVER_WIFI - COPY_MAC_ADDR(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_BOW_INDEX].aucOwnMacAddr, - prAdapter->rWifiVar.aucDeviceAddress); -#endif - -#if CFG_TEST_WIFI_DIRECT_GO - if (prAdapter->rWifiVar.prP2pFsmInfo->eCurrentState == P2P_STATE_IDLE) { - wlanEnableP2pFunction(prAdapter); - - wlanEnableATGO(prAdapter); - } -#endif - - kalUpdateMACAddress(prAdapter->prGlueInfo, prAdapter->rWifiVar.aucMacAddress); - - return; -} - -VOID -nicCmdEventQueryMcastAddr( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - UINT_32 u4QueryInfoLen; - P_GLUE_INFO_T prGlueInfo; - P_EVENT_MAC_MCAST_ADDR prEventMacMcastAddr; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - ASSERT(pucEventBuf); - - //4 <2> Update information of OID - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - prEventMacMcastAddr = (P_EVENT_MAC_MCAST_ADDR)(pucEventBuf); - - u4QueryInfoLen = prEventMacMcastAddr->u4NumOfGroupAddr * MAC_ADDR_LEN; - - // buffer length check - if (prCmdInfo->u4InformationBufferLength < u4QueryInfoLen) { - kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_BUFFER_TOO_SHORT); - } - else { - kalMemCopy(prCmdInfo->pvInformationBuffer, - prEventMacMcastAddr->arAddress, - prEventMacMcastAddr->u4NumOfGroupAddr * MAC_ADDR_LEN); - - kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS); - } - } -} - -VOID -nicCmdEventQueryEepromRead( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - UINT_32 u4QueryInfoLen; - P_PARAM_CUSTOM_EEPROM_RW_STRUC_T prEepromRdInfo; - P_GLUE_INFO_T prGlueInfo; - P_EVENT_ACCESS_EEPROM prEventAccessEeprom; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - ASSERT(pucEventBuf); - - //4 <2> Update information of OID - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - prEventAccessEeprom = (P_EVENT_ACCESS_EEPROM)(pucEventBuf); - - u4QueryInfoLen = sizeof(PARAM_CUSTOM_EEPROM_RW_STRUC_T); - - prEepromRdInfo = (P_PARAM_CUSTOM_EEPROM_RW_STRUC_T) prCmdInfo->pvInformationBuffer; - prEepromRdInfo->ucEepromIndex = (UINT_8)(prEventAccessEeprom->u2Offset); - prEepromRdInfo->u2EepromData = prEventAccessEeprom->u2Data; - - kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS); - } - - return; - -} - - -VOID -nicCmdEventSetMediaStreamMode( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - PARAM_MEDIA_STREAMING_INDICATION rParamMediaStreamIndication; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - if (prCmdInfo->fgIsOid) { - /* Update Set Infomation Length */ - kalOidComplete(prAdapter->prGlueInfo, - prCmdInfo->fgSetQuery, - prCmdInfo->u4SetInfoLen, - WLAN_STATUS_SUCCESS); - } - - rParamMediaStreamIndication.rStatus.eStatusType = - ENUM_STATUS_TYPE_MEDIA_STREAM_MODE; - rParamMediaStreamIndication.eMediaStreamMode = - prAdapter->rWlanInfo.eLinkAttr.ucMediaStreamMode == 0 ? - ENUM_MEDIA_STREAM_OFF : ENUM_MEDIA_STREAM_ON; - - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_SPECIFIC_INDICATION, - (PVOID)&rParamMediaStreamIndication, - sizeof(PARAM_MEDIA_STREAMING_INDICATION)); -} - - -/* Statistics responder */ -VOID -nicCmdEventQueryXmitOk( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_EVENT_STATISTICS prEventStatistics; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4QueryInfoLen; - PUINT_32 pu4Data; - PUINT_64 pu8Data; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf; - - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - - if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) { - u4QueryInfoLen = sizeof(UINT_32); - - pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer; - *pu4Data = (UINT_32) prEventStatistics->rTransmittedFragmentCount.QuadPart; - } - else { - u4QueryInfoLen = sizeof(UINT_64); - - pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer; - *pu8Data = prEventStatistics->rTransmittedFragmentCount.QuadPart; - } - - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - u4QueryInfoLen, - WLAN_STATUS_SUCCESS); - } -} - - -VOID -nicCmdEventQueryRecvOk( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_EVENT_STATISTICS prEventStatistics; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4QueryInfoLen; - PUINT_32 pu4Data; - PUINT_64 pu8Data; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf; - - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - - if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) { - u4QueryInfoLen = sizeof(UINT_32); - - pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer; - *pu4Data = (UINT_32) prEventStatistics->rReceivedFragmentCount.QuadPart; - } - else { - u4QueryInfoLen = sizeof(UINT_64); - - pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer; - *pu8Data = prEventStatistics->rReceivedFragmentCount.QuadPart; - } - - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - u4QueryInfoLen, - WLAN_STATUS_SUCCESS); - } -} - -VOID -nicCmdEventQueryXmitError( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_EVENT_STATISTICS prEventStatistics; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4QueryInfoLen; - PUINT_32 pu4Data; - PUINT_64 pu8Data; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf; - - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - - if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) { - u4QueryInfoLen = sizeof(UINT_32); - - pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer; - *pu4Data = (UINT_32) prEventStatistics->rFailedCount.QuadPart; - } - else { - u4QueryInfoLen = sizeof(UINT_64); - - pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer; - *pu8Data = (UINT_64) prEventStatistics->rFailedCount.QuadPart; - } - - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - u4QueryInfoLen, - WLAN_STATUS_SUCCESS); - } -} - - -VOID -nicCmdEventQueryRecvError( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_EVENT_STATISTICS prEventStatistics; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4QueryInfoLen; - PUINT_32 pu4Data; - PUINT_64 pu8Data; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf; - - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - - if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) { - u4QueryInfoLen = sizeof(UINT_32); - - pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer; - *pu4Data = (UINT_32) prEventStatistics->rFCSErrorCount.QuadPart; - // @FIXME, RX_ERROR_DROP_COUNT/RX_FIFO_FULL_DROP_COUNT is not calculated - } - else { - u4QueryInfoLen = sizeof(UINT_64); - - pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer; - *pu8Data = prEventStatistics->rFCSErrorCount.QuadPart; - // @FIXME, RX_ERROR_DROP_COUNT/RX_FIFO_FULL_DROP_COUNT is not calculated - } - - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - u4QueryInfoLen, - WLAN_STATUS_SUCCESS); - } -} - - -VOID -nicCmdEventQueryRecvNoBuffer( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_EVENT_STATISTICS prEventStatistics; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4QueryInfoLen; - PUINT_32 pu4Data; - PUINT_64 pu8Data; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf; - - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - - if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) { - u4QueryInfoLen = sizeof(UINT_32); - - pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer; - *pu4Data = 0; // @FIXME? - } - else { - u4QueryInfoLen = sizeof(UINT_64); - - pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer; - *pu8Data = 0; //@FIXME? - } - - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - u4QueryInfoLen, - WLAN_STATUS_SUCCESS); - } -} - - -VOID -nicCmdEventQueryRecvCrcError( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_EVENT_STATISTICS prEventStatistics; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4QueryInfoLen; - PUINT_32 pu4Data; - PUINT_64 pu8Data; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf; - - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - - if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) { - u4QueryInfoLen = sizeof(UINT_32); - - pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer; - *pu4Data = (UINT_32) prEventStatistics->rFCSErrorCount.QuadPart; - } - else { - u4QueryInfoLen = sizeof(UINT_64); - - pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer; - *pu8Data = prEventStatistics->rFCSErrorCount.QuadPart; - } - - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - u4QueryInfoLen, - WLAN_STATUS_SUCCESS); - } -} - - -VOID -nicCmdEventQueryRecvErrorAlignment( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_EVENT_STATISTICS prEventStatistics; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4QueryInfoLen; - PUINT_32 pu4Data; - PUINT_64 pu8Data; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf; - - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - - if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) { - u4QueryInfoLen = sizeof(UINT_32); - - pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer; - *pu4Data = (UINT_32) 0; //@FIXME - } - else { - u4QueryInfoLen = sizeof(UINT_64); - - pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer; - *pu8Data = 0; //@FIXME - } - - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - u4QueryInfoLen, - WLAN_STATUS_SUCCESS); - } -} - - -VOID -nicCmdEventQueryXmitOneCollision( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_EVENT_STATISTICS prEventStatistics; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4QueryInfoLen; - PUINT_32 pu4Data; - PUINT_64 pu8Data; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf; - - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - - if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) { - u4QueryInfoLen = sizeof(UINT_32); - - pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer; - *pu4Data = (UINT_32) (prEventStatistics->rMultipleRetryCount.QuadPart - prEventStatistics->rRetryCount.QuadPart); - } - else { - u4QueryInfoLen = sizeof(UINT_64); - - pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer; - *pu8Data = (UINT_64) (prEventStatistics->rMultipleRetryCount.QuadPart - prEventStatistics->rRetryCount.QuadPart); - } - - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - u4QueryInfoLen, - WLAN_STATUS_SUCCESS); - } -} - - -VOID -nicCmdEventQueryXmitMoreCollisions( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_EVENT_STATISTICS prEventStatistics; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4QueryInfoLen; - PUINT_32 pu4Data; - PUINT_64 pu8Data; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf; - - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - - if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) { - u4QueryInfoLen = sizeof(UINT_32); - - pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer; - *pu4Data = (UINT_32) prEventStatistics->rMultipleRetryCount.QuadPart; - } - else { - u4QueryInfoLen = sizeof(UINT_64); - - pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer; - *pu8Data = (UINT_64) prEventStatistics->rMultipleRetryCount.QuadPart; - } - - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - u4QueryInfoLen, - WLAN_STATUS_SUCCESS); - } -} - - -VOID -nicCmdEventQueryXmitMaxCollisions( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - P_EVENT_STATISTICS prEventStatistics; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4QueryInfoLen; - PUINT_32 pu4Data; - PUINT_64 pu8Data; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prEventStatistics = (P_EVENT_STATISTICS)pucEventBuf; - - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - - if(prCmdInfo->u4InformationBufferLength == sizeof(UINT_32)) { - u4QueryInfoLen = sizeof(UINT_32); - - pu4Data = (PUINT_32) prCmdInfo->pvInformationBuffer; - *pu4Data = (UINT_32) prEventStatistics->rFailedCount.QuadPart; - } - else { - u4QueryInfoLen = sizeof(UINT_64); - - pu8Data = (PUINT_64) prCmdInfo->pvInformationBuffer; - *pu8Data = (UINT_64) prEventStatistics->rFailedCount.QuadPart; - } - - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - u4QueryInfoLen, - WLAN_STATUS_SUCCESS); - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called when command by OID/ioctl has been timeout -* -* @param prAdapter Pointer to the Adapter structure. -* @param prCmdInfo Pointer to the command information -* -* @return TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicOidCmdTimeoutCommon ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ) -{ - ASSERT(prAdapter); - - kalOidComplete(prAdapter->prGlueInfo, - prCmdInfo->fgSetQuery, - 0, - WLAN_STATUS_FAILURE); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is a generic command timeout handler -* -* @param pfnOidHandler Pointer to the OID handler -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicCmdTimeoutCommon ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ) -{ - ASSERT(prAdapter); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called when command for entering RF test has -* failed sending due to timeout (highly possibly by firmware crash) -* -* @param prAdapter Pointer to the Adapter structure. -* @param prCmdInfo Pointer to the command information -* -* @return none -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicOidCmdEnterRFTestTimeout ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo - ) -{ - ASSERT(prAdapter); - - // 1. Remove pending TX frames - nicTxRelease(prAdapter); - - // 1.1 clear pending Security / Management Frames - kalClearSecurityFrames(prAdapter->prGlueInfo); - kalClearMgmtFrames(prAdapter->prGlueInfo); - - // 1.2 clear pending TX packet queued in glue layer - kalFlushPendingTxPackets(prAdapter->prGlueInfo); - - // 2. indiate for OID failure - kalOidComplete(prAdapter->prGlueInfo, - prCmdInfo->fgSetQuery, - 0, - WLAN_STATUS_FAILURE); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is called when command for memory dump has -* replied a event. -* -* @param prAdapter Pointer to the Adapter structure. -* @param prCmdInfo Pointer to the command information -* @param pucEventBuf Pointer to event buffer -* -* @return none -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicCmdEventQueryMemDump ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN PUINT_8 pucEventBuf - ) -{ - UINT_32 u4QueryInfoLen; - P_PARAM_CUSTOM_MEM_DUMP_STRUC_T prMemDumpInfo; - P_GLUE_INFO_T prGlueInfo; - P_EVENT_DUMP_MEM_T prEventDumpMem; - static UINT_8 aucPath[256]; - static UINT_32 u4CurTimeTick; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - ASSERT(pucEventBuf); - - //4 <2> Update information of OID - if (prCmdInfo->fgIsOid) { - prGlueInfo = prAdapter->prGlueInfo; - prEventDumpMem = (P_EVENT_DUMP_MEM_T)(pucEventBuf); - - u4QueryInfoLen = sizeof(P_PARAM_CUSTOM_MEM_DUMP_STRUC_T); - - prMemDumpInfo = (P_PARAM_CUSTOM_MEM_DUMP_STRUC_T) prCmdInfo->pvInformationBuffer; - prMemDumpInfo->u4Address = prEventDumpMem->u4Address; - prMemDumpInfo->u4Length = prEventDumpMem->u4Length; - prMemDumpInfo->u4RemainLength = prEventDumpMem->u4RemainLength; - prMemDumpInfo->ucFragNum = prEventDumpMem->ucFragNum; - -#if 0 - do{ - UINT_32 i = 0; - printk("Rx dump address 0x%X, Length %d, FragNum %d, remain %d\n", - prEventDumpMem->u4Address, - prEventDumpMem->u4Length, - prEventDumpMem->ucFragNum, - prEventDumpMem->u4RemainLength); -#if 0 - for(i = 0; i < prEventDumpMem->u4Length; i++) { - printk("%02X ", prEventDumpMem->aucBuffer[i]); - if(i % 32 == 31) { - printk("\n"); - } - } -#endif - }while(FALSE); -#endif - - if(prEventDumpMem->ucFragNum == 1) { - /* Store memory dump into sdcard, - * path /sdcard/dump___.hex - */ - u4CurTimeTick = kalGetTimeTick(); - sprintf(aucPath, "/sdcard/dump_%ld_0x%08lX_%ld.hex", - u4CurTimeTick, - prEventDumpMem->u4Address, - prEventDumpMem->u4Length + prEventDumpMem->u4RemainLength); - kalWriteToFile(aucPath, FALSE, &prEventDumpMem->aucBuffer[0], prEventDumpMem->u4Length); - } - else { - /* Append current memory dump to the hex file */ - kalWriteToFile(aucPath, TRUE, &prEventDumpMem->aucBuffer[0], prEventDumpMem->u4Length); - } - - if(prEventDumpMem->u4RemainLength == 0 || - prEventDumpMem->u4Address == 0xFFFFFFFF) { - /* The request is finished or firmware response a error */ - /* Reply time tick to iwpriv */ - *((PUINT_32)prCmdInfo->pvInformationBuffer) = u4CurTimeTick; - kalOidComplete(prGlueInfo, prCmdInfo->fgSetQuery, u4QueryInfoLen, WLAN_STATUS_SUCCESS); - } - else { - /* The memory dump request is not finished, Send next command*/ - wlanSendMemDumpCmd( - prAdapter, - prCmdInfo->pvInformationBuffer, - prCmdInfo->u4InformationBufferLength); - } - } - - return; - -} - - - - diff --git a/drivers/net/wireless/mt5931/nic/nic_pwr_mgt.c b/drivers/net/wireless/mt5931/nic/nic_pwr_mgt.c deleted file mode 100755 index c7f30fbe9e50..000000000000 --- a/drivers/net/wireless/mt5931/nic/nic_pwr_mgt.c +++ /dev/null @@ -1,801 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/nic/nic_pwr_mgt.c#1 $ -*/ - -/*! \file "nic_pwr_mgt.c" - \brief In this file we define the STATE and EVENT for Power Management FSM. - - The SCAN FSM is responsible for performing SCAN behavior when the Arbiter enter - ARB_STATE_SCAN. The STATE and EVENT for SCAN FSM are defined here with detail - description. -*/ - - - -/* -** $Log: nic_pwr_mgt.c $ - * - * 11 28 2011 cp.wu - * [WCXRP00001125] [MT6620 Wi-Fi][Firmware] Strengthen Wi-Fi power off sequence to have a clearroom environment when returining to ROM code - * 1. Due to firmware now stops HIF DMA for powering off, do not try to receive any packet from firmware - * 2. Take use of prAdapter->fgIsEnterD3ReqIssued for tracking whether it is powering off or not - * - * 10 03 2011 cp.wu - * [WCXRP00001022] [MT6628 Driver][Firmware Download] Add multi section independent download functionality - * add firmware download path in divided scatters. - * - * 08 15 2011 cp.wu - * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree - * reuse firmware download logic of MT6620 for MT6628. - * - * 05 11 2011 cp.wu - * [WCXRP00000718] [MT6620 Wi-Fi] modify the behavior of setting tx power - * ACPI APIs migrate to wlan_lib.c for glue layer to invoke. - * - * 04 29 2011 cp.wu - * [WCXRP00000636] [WHQL][MT5931 Driver] 2c_PMHibernate (hang on 2h) - * fix for compilation error when applied with FW_DOWNLOAD = 0 - * - * 04 18 2011 cp.wu - * [WCXRP00000636] [WHQL][MT5931 Driver] 2c_PMHibernate (hang on 2h) - * 1) add API for glue layer to query ACPI state - * 2) Windows glue should not access to hardware after switched into D3 state - * - * 04 13 2011 cp.wu - * [WCXRP00000639] [WHQL][MT5931 Driver] 2c_PMStandby test item can not complete - * refine for MT5931/MT6620 logic separation. - * - * 04 13 2011 cp.wu - * [WCXRP00000639] [WHQL][MT5931 Driver] 2c_PMStandby test item can not complete - * bugfix: firmware download procedure for ACPI state transition is not complete. - * - * 03 15 2011 cp.wu - * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous memory consumption - * 1. deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK - * 2. Use common coalescing buffer for both TX/RX directions - * - * - * 03 07 2011 terry.wu - * [WCXRP00000521] [MT6620 Wi-Fi][Driver] Remove non-standard debug message - * Toggle non-standard debug messages to comments. - * - * 12 31 2010 cp.wu - * [WCXRP00000335] [MT6620 Wi-Fi][Driver] change to use milliseconds sleep instead of delay to avoid blocking to system scheduling - * change to use msleep() and shorten waiting interval to reduce blocking to other task while Wi-Fi driver is being loaded - * - * 12 31 2010 cp.wu - * [WCXRP00000327] [MT6620 Wi-Fi][Driver] Improve HEC WHQA 6972 workaround coverage in driver side - * check success or failure for setting fw-own - * - * 12 30 2010 cp.wu - * [WCXRP00000327] [MT6620 Wi-Fi][Driver] Improve HEC WHQA 6972 workaround coverage in driver side - * host driver not to set FW-own when there is still pending interrupts - * - * 10 07 2010 cp.wu - * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection - * add firmware download for MT5931. - * - * 09 21 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * Do a complete reset with STA-REC null checking for RF test re-entry - * - * 08 30 2010 cp.wu - * NULL - * eliminate klockwork errors - * - * 08 30 2010 cp.wu - * NULL - * reset ACPI power state before waking up MT6620 Wi-Fi firmware. - * - * 08 12 2010 cp.wu - * NULL - * [AIS-FSM] honor registry setting for adhoc running mode. (A/B/G) - * - * 08 03 2010 cp.wu - * NULL - * Centralize mgmt/system service procedures into independent calls. - * - * 07 22 2010 cp.wu - * - * 1) refine AIS-FSM indent. - * 2) when entering RF Test mode, flush 802.1X frames as well - * 3) when entering D3 state, flush 802.1X frames as well - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * change MAC address updating logic. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) when acquiring LP-own, write for clr-own with lower frequency compared to read poll - * 2) correct address list parsing - * - * 05 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * sleepy notify is only used for sleepy state, - * while wake-up state is automatically set when host needs to access device - * - * 05 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct hibernation problem. - * - * 04 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) surpress compiler warning - * 2) when acqruing LP-own, keep writing WHLPCR whenever OWN is not acquired yet - * - * 04 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * surpress compiler warning - * - * 04 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * when acquiring driver-own, wait for up to 8 seconds. - * - * 04 21 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * add for private ioctl support - * - * 04 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) remove redundant firmware image unloading - * * 2) use compile-time macros to separate logic related to accquiring own - * - * 04 16 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * treat BUS access failure as kind of card removal. - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * accessing to firmware load/start address, and access to OID handling information - * * are now handled in glue layer - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * ePowerCtrl is not necessary as a glue variable. - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add KAL API: kalFlushPendingTxPackets(), and take use of the API - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port - * - * 03 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * always send CMD_NIC_POWER_CTRL packet when nic is being halted - * - * 03 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct typo. - * - * 03 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) add ACPI D0/D3 state switching support - * * * * * * * * 2) use more formal way to handle interrupt when the status is retrieved from enhanced RX response - * - * 03 08 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) add another spin-lock to protect MsduInfoList due to it might be accessed by different thread. - * * 2) change own-back acquiring procedure to wait for up to 16.67 seconds -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-10-13 21:59:15 GMT mtk01084 -** update for new HW design -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-09-09 17:26:36 GMT mtk01084 -** remove CMD52 access -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-05-18 14:50:29 GMT mtk01084 -** modify lines in nicpmSetDriverOwn() -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-23 16:55:37 GMT mtk01084 -** modify nicpmSetDriverOwn() -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-19 18:33:00 GMT mtk01084 -** update for basic power management functions -** \main\maintrunk.MT6620WiFiDriver_Prj\1 2009-03-19 15:05:32 GMT mtk01084 -** Initial version -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to process the POWER ON procedure. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicpmSetFWOwn ( - IN P_ADAPTER_T prAdapter, - IN BOOLEAN fgEnableGlobalInt - ) -{ - UINT_32 u4RegValue; - - ASSERT(prAdapter); - - if(prAdapter->fgIsFwOwn == TRUE) { - return; - } - else { - if(nicProcessIST(prAdapter) != WLAN_STATUS_NOT_INDICATING) { - // pending interrupts - return; - } - } - - if (fgEnableGlobalInt) { - prAdapter->fgIsIntEnableWithLPOwnSet = TRUE; - } - else { - HAL_MCR_WR(prAdapter, MCR_WHLPCR, WHLPCR_FW_OWN_REQ_SET); - - HAL_MCR_RD(prAdapter, MCR_WHLPCR, &u4RegValue); - if(u4RegValue & WHLPCR_FW_OWN_REQ_SET) { - // if set firmware own not successful (possibly pending interrupts), - // indicate an own clear event - HAL_MCR_WR(prAdapter, MCR_WHLPCR, WHLPCR_FW_OWN_REQ_CLR); - - return; - } - - prAdapter->fgIsFwOwn = TRUE; - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to process the POWER OFF procedure. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -nicpmSetDriverOwn ( - IN P_ADAPTER_T prAdapter - ) -{ -#define LP_OWN_BACK_TOTAL_DELAY_MS 8192 //exponential of 2 -#define LP_OWN_BACK_LOOP_DELAY_MS 1 //exponential of 2 -#define LP_OWN_BACK_CLR_OWN_ITERATION 256 //exponential of 2 - - BOOLEAN fgStatus = TRUE; - UINT_32 i, u4CurrTick, u4RegValue = 0; - - ASSERT(prAdapter); - - if(prAdapter->fgIsFwOwn == FALSE) - return fgStatus; - - u4CurrTick = kalGetTimeTick(); - i = 0; - while(1) { - HAL_MCR_RD(prAdapter, MCR_WHLPCR, &u4RegValue); - - if (u4RegValue & WHLPCR_FW_OWN_REQ_SET) { - prAdapter->fgIsFwOwn = FALSE; - break; - } - else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE - || (kalGetTimeTick() - u4CurrTick) > LP_OWN_BACK_TOTAL_DELAY_MS) { - //ERRORLOG(("LP cannot be own back (for %ld ms)", kalGetTimeTick() - u4CurrTick)); - fgStatus = FALSE; - break; - } - else { - if((i & (LP_OWN_BACK_CLR_OWN_ITERATION - 1)) == 0) { - /* Software get LP ownership - per 256 iterations */ - HAL_MCR_WR(prAdapter, MCR_WHLPCR, WHLPCR_FW_OWN_REQ_CLR); - } - - /* Delay for LP engine to complete its operation. */ - kalMsleep(LP_OWN_BACK_LOOP_DELAY_MS); - i++; - } - } - - return fgStatus; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to set ACPI power mode to D0. -* -* \param[in] pvAdapter Pointer to the Adapter structure. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -nicpmSetAcpiPowerD0 ( - IN P_ADAPTER_T prAdapter - ) -{ - WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS; - UINT_32 u4Value = 0, u4WHISR = 0; - UINT_8 aucTxCount[8]; - UINT_32 i; -#if CFG_ENABLE_FW_DOWNLOAD - UINT_32 u4FwImgLength, u4FwLoadAddr, u4ImgSecSize; - PVOID prFwMappingHandle; - PVOID pvFwImageMapFile = NULL; - #if CFG_ENABLE_FW_DIVIDED_DOWNLOAD - UINT_32 j; - P_FIRMWARE_DIVIDED_DOWNLOAD_T prFwHead; - BOOLEAN fgValidHead; - const UINT_32 u4CRCOffset = offsetof(FIRMWARE_DIVIDED_DOWNLOAD_T, u4NumOfEntries); - #endif -#endif - - DEBUGFUNC("nicpmSetAcpiPowerD0"); - - ASSERT(prAdapter); - - do { - /* 0. Reset variables in ADAPTER_T */ - prAdapter->fgIsFwOwn = TRUE; - prAdapter->fgWiFiInSleepyState = FALSE; - prAdapter->rAcpiState = ACPI_STATE_D0; - prAdapter->fgIsEnterD3ReqIssued = FALSE; - -#if defined(MT6620) || defined(MT6628) - /* 1. Request Ownership to enter F/W download state */ - ACQUIRE_POWER_CONTROL_FROM_PM(prAdapter); - #if !CFG_ENABLE_FULL_PM - nicpmSetDriverOwn(prAdapter); - #endif - - /* 2. Initialize the Adapter */ - if ( (u4Status = nicInitializeAdapter(prAdapter)) != WLAN_STATUS_SUCCESS ) { - DBGLOG(INIT, ERROR, ("nicInitializeAdapter failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } -#endif - - #if CFG_ENABLE_FW_DOWNLOAD - prFwMappingHandle = kalFirmwareImageMapping(prAdapter->prGlueInfo, &pvFwImageMapFile, &u4FwImgLength); - if(!prFwMappingHandle) { - DBGLOG(INIT, ERROR,("Fail to load FW image from file!\n")); - pvFwImageMapFile = NULL; - } - - #if defined(MT6620) || defined(MT6628) - if (pvFwImageMapFile) { - /* 3.1 disable interrupt, download is done by polling mode only */ - nicDisableInterrupt(prAdapter); - - /* 3.2 Initialize Tx Resource to fw download state */ - nicTxInitResetResource(prAdapter); - - /* 3.3 FW download here */ - u4FwLoadAddr = kalGetFwLoadAddress(prAdapter->prGlueInfo); - - #if CFG_ENABLE_FW_DIVIDED_DOWNLOAD - // 3a. parse file header for decision of divided firmware download or not - prFwHead = (P_FIRMWARE_DIVIDED_DOWNLOAD_T)pvFwImageMapFile; - - if(prFwHead->u4Signature == MTK_WIFI_SIGNATURE && - prFwHead->u4CRC == wlanCRC32((PUINT_8)pvFwImageMapFile + u4CRCOffset, u4FwImgLength - u4CRCOffset)) { - fgValidHead = TRUE; - } - else { - fgValidHead = FALSE; - } - - /* 3b. engage divided firmware downloading */ - if(fgValidHead == TRUE) { - for(i = 0 ; i < prFwHead->u4NumOfEntries ; i++) { - #if CFG_ENABLE_FW_DOWNLOAD_AGGREGATION - if(wlanImageSectionDownloadAggregated(prAdapter, - prFwHead->arSection[i].u4DestAddr, - prFwHead->arSection[i].u4Length, - (PUINT_8)pvFwImageMapFile + prFwHead->arSection[i].u4Offset) != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, ERROR, ("Firmware scatter download failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - } - #else - for(j = 0 ; j < prFwHead->arSection[i].u4Length ; j += CMD_PKT_SIZE_FOR_IMAGE) { - if(j + CMD_PKT_SIZE_FOR_IMAGE < prFwHead->arSection[i].u4Length) - u4ImgSecSize = CMD_PKT_SIZE_FOR_IMAGE; - else - u4ImgSecSize = prFwHead->arSection[i].u4Length - j; - - if(wlanImageSectionDownload(prAdapter, - prFwHead->arSection[i].u4DestAddr + j, - u4ImgSecSize, - (PUINT_8)pvFwImageMapFile + prFwHead->arSection[i].u4Offset + j) != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, ERROR, ("Firmware scatter download failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - } - #endif - /* escape from loop if any pending error occurs */ - if(u4Status == WLAN_STATUS_FAILURE) { - break; - } - } - } - else - #endif - #if CFG_ENABLE_FW_DOWNLOAD_AGGREGATION - if(wlanImageSectionDownloadAggregated(prAdapter, - u4FwLoadAddr, - u4FwImgLength, - (PUINT_8)pvFwImageMapFile) != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, ERROR, ("Firmware scatter download failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - } - #else - for (i = 0; i < u4FwImgLength ; i += CMD_PKT_SIZE_FOR_IMAGE) { - if(i + CMD_PKT_SIZE_FOR_IMAGE < u4FwImgLength) - u4ImgSecSize = CMD_PKT_SIZE_FOR_IMAGE; - else - u4ImgSecSize = u4FwImgLength - i; - - if(wlanImageSectionDownload(prAdapter, - u4FwLoadAddr + i, - u4ImgSecSize, - (PUINT_8)pvFwImageMapFile + i) != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, ERROR, ("wlanImageSectionDownload failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - } - #endif - - if(u4Status != WLAN_STATUS_SUCCESS) { - kalFirmwareImageUnmapping(prAdapter->prGlueInfo, prFwMappingHandle, pvFwImageMapFile); - break; - } - - #if !CFG_ENABLE_FW_DOWNLOAD_ACK - // Send INIT_CMD_ID_QUERY_PENDING_ERROR command and wait for response - if(wlanImageQueryStatus(prAdapter) != WLAN_STATUS_SUCCESS) { - kalFirmwareImageUnmapping(prAdapter->prGlueInfo, prFwMappingHandle, pvFwImageMapFile); - u4Status = WLAN_STATUS_FAILURE; - break; - } - #endif - - kalFirmwareImageUnmapping(prAdapter->prGlueInfo, prFwMappingHandle, pvFwImageMapFile); - } - else { - u4Status = WLAN_STATUS_FAILURE; - break; - } - - /* 4. send Wi-Fi Start command */ - #if CFG_OVERRIDE_FW_START_ADDRESS - wlanConfigWifiFunc(prAdapter, - TRUE, - kalGetFwStartAddress(prAdapter->prGlueInfo)); - #else - wlanConfigWifiFunc(prAdapter, - FALSE, - 0); - #endif - - #elif defined(MT5931) - if (pvFwImageMapFile) { - DBGLOG(INIT, TRACE, ("Download Address: 0x%08X\n", kalGetFwLoadAddress(prAdapter->prGlueInfo))); - DBGLOG(INIT, TRACE, ("Firmware Length: 0x%08X\n", u4FwImgLength)); - - do { - /* 1.0 whole-chip reset except HIFSYS */ - HAL_MCR_WR(prAdapter, MCR_WMCSR, WMCSR_CHIP_RST); - HAL_MCR_WR(prAdapter, MCR_WMCSR, 0); - - /* 1.1 wait for INIT_RDY */ - i = 0; - while(1) { - HAL_MCR_RD(prAdapter, MCR_WMCSR, &u4Value); - - if (u4Value & WMCSR_INI_RDY) { - DBGLOG(INIT, TRACE, ("INIT-RDY detected\n")); - break; - } - else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - u4Status = WLAN_STATUS_FAILURE; - break; - } - else if(i >= CFG_RESPONSE_POLLING_TIMEOUT) { - DBGLOG(INIT, ERROR, ("Waiting for Init Ready bit: Timeout\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - else { - i++; - kalMsleep(10); - } - } - - /* 1.2 set KSEL/FLEN */ - HAL_MCR_WR(prAdapter, MCR_FWCFG, u4FwImgLength >> 6); - - /* 1.3 enable FWDL_EN */ - HAL_MCR_WR(prAdapter, MCR_WMCSR, WMCSR_FWDLEN); - - /* 1.4 wait for PLL_RDY */ - i = 0; - while(1) { - HAL_MCR_RD(prAdapter, MCR_WMCSR, &u4Value); - - if (u4Value & WMCSR_PLLRDY) { - DBGLOG(INIT, TRACE, ("PLL-RDY detected\n")); - break; - } - else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - u4Status = WLAN_STATUS_FAILURE; - break; - } - else if(i >= CFG_RESPONSE_POLLING_TIMEOUT) { - DBGLOG(INIT, ERROR, ("Waiting for PLL Ready bit: Timeout\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - else { - i++; - kalMsleep(10); - } - } - - /* 2.1 turn on HIFSYS firmware download mode */ - HAL_MCR_WR(prAdapter, MCR_FWDLSR, FWDLSR_FWDL_MODE); - - /* 2.2 set starting address */ - u4FwLoadAddr = kalGetFwLoadAddress(prAdapter->prGlueInfo); - HAL_MCR_WR(prAdapter, MCR_FWDLDSAR, u4FwLoadAddr); - - /* 3. upload firmware */ - for (i = 0; i < u4FwImgLength ; i += CMD_PKT_SIZE_FOR_IMAGE) { - if(i + CMD_PKT_SIZE_FOR_IMAGE < u4FwImgLength) - u4ImgSecSize = CMD_PKT_SIZE_FOR_IMAGE; - else - u4ImgSecSize = u4FwImgLength - i; - - if(wlanImageSectionDownload(prAdapter, - u4FwLoadAddr + i, - u4ImgSecSize, - (PUINT_8)pvFwImageMapFile + i) != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, ERROR, ("Firmware scatter download failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - } - - /* 4.1 poll FWDL_OK & FWDL_FAIL bits */ - i = 0; - while(1) { - HAL_MCR_RD(prAdapter, MCR_WMCSR, &u4Value); - - if (u4Value & WMCSR_DL_OK) { - DBGLOG(INIT, TRACE, ("DL_OK detected\n")); - break; - } - else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE - || (u4Value & WMCSR_DL_FAIL)) { - DBGLOG(INIT, ERROR, ("DL_FAIL detected: 0x%08X\n", u4Value)); - u4Status = WLAN_STATUS_FAILURE; - break; - } - else if(i >= CFG_RESPONSE_POLLING_TIMEOUT) { - DBGLOG(INIT, ERROR, ("Waiting for DL_OK/DL_FAIL bit: Timeout\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - else { - i++; - kalMsleep(10); - } - } - - /* 4.2 turn off HIFSYS download mode */ - HAL_MCR_WR(prAdapter, MCR_FWDLSR, 0); - - } while (FALSE); - } - else { - DBGLOG(INIT, ERROR, ("No Firmware found!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - - #endif - #endif - - /* 5. check Wi-Fi FW asserts ready bit */ - DBGLOG(INIT, TRACE, ("wlanAdapterStart(): Waiting for Ready bit..\n")); - i = 0; - while(1) { - HAL_MCR_RD(prAdapter, MCR_WCIR, &u4Value); - - if (u4Value & WCIR_WLAN_READY) { - DBGLOG(INIT, TRACE, ("Ready bit asserted\n")); - break; - } - else if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - u4Status = WLAN_STATUS_FAILURE; - break; - } - else if(i >= CFG_RESPONSE_POLLING_TIMEOUT) { - DBGLOG(INIT, ERROR, ("Waiting for Ready bit: Timeout\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } - else { - i++; - kalMsleep(10); - } - } - -#if defined(MT5931) - // Acquire LP-OWN - ACQUIRE_POWER_CONTROL_FROM_PM(prAdapter); - #if !CFG_ENABLE_FULL_PM - nicpmSetDriverOwn(prAdapter); - #endif - - /* 2. Initialize the Adapter */ - if ( (u4Status = nicInitializeAdapter(prAdapter)) != WLAN_STATUS_SUCCESS ) { - DBGLOG(INIT, ERROR, ("nicInitializeAdapter failed!\n")); - u4Status = WLAN_STATUS_FAILURE; - break; - } -#endif - - if(u4Status == WLAN_STATUS_SUCCESS) { - // 6.1 reset interrupt status - HAL_READ_INTR_STATUS(prAdapter, 4, (PUINT_8)&u4WHISR); - if(HAL_IS_TX_DONE_INTR(u4WHISR)) { - HAL_READ_TX_RELEASED_COUNT(prAdapter, aucTxCount); - } - - /* 6.2 reset TX Resource for normal operation */ - nicTxResetResource(prAdapter); - - /* 6.3 Enable interrupt */ - nicEnableInterrupt(prAdapter); - - /* 6.4 Override network address */ - wlanUpdateNetworkAddress(prAdapter); - - /* 6.5 indicate disconnection as default status */ - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_DISCONNECT, - NULL, - 0); - } - - RECLAIM_POWER_CONTROL_TO_PM(prAdapter, FALSE); - - /* MGMT Initialization */ - nicInitMGMT(prAdapter, NULL); - - } while(FALSE); - - if(u4Status != WLAN_STATUS_SUCCESS) { - return FALSE; - } - else { - return TRUE; - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This routine is used to set ACPI power mode to D3. -* -* @param prAdapter pointer to the Adapter handler -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -nicpmSetAcpiPowerD3 ( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 i; - - ASSERT(prAdapter); - - /* 1. MGMT - unitialization */ - nicUninitMGMT(prAdapter); - - /* 2. Disable Interrupt */ - nicDisableInterrupt(prAdapter); - - /* 3. emit CMD_NIC_POWER_CTRL command packet */ - wlanSendNicPowerCtrlCmd(prAdapter, 1); - - /* 4. Clear Interrupt Status */ - i = 0; - while(i < CFG_IST_LOOP_COUNT && nicProcessIST(prAdapter) != WLAN_STATUS_NOT_INDICATING) { - i++; - }; - - /* 5. Remove pending TX */ - nicTxRelease(prAdapter); - - // 5.1 clear pending Security / Management Frames - kalClearSecurityFrames(prAdapter->prGlueInfo); - kalClearMgmtFrames(prAdapter->prGlueInfo); - - // 5.2 clear pending TX packet queued in glue layer - kalFlushPendingTxPackets(prAdapter->prGlueInfo); - - /* 6. Set Onwership to F/W */ - nicpmSetFWOwn(prAdapter, FALSE); - - /* 7. Set variables */ - prAdapter->rAcpiState = ACPI_STATE_D3; - - return TRUE; -} - diff --git a/drivers/net/wireless/mt5931/nic/nic_rx.c b/drivers/net/wireless/mt5931/nic/nic_rx.c deleted file mode 100755 index f1799ff7f4b6..000000000000 --- a/drivers/net/wireless/mt5931/nic/nic_rx.c +++ /dev/null @@ -1,3529 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/nic/nic_rx.c#3 $ -*/ - -/*! \file nic_rx.c - \brief Functions that provide many rx-related functions - - This file includes the functions used to process RFB and dispatch RFBs to - the appropriate related rx functions for protocols. -*/ - - - -/* -** $Log: nic_rx.c $ -** -** 08 31 2012 yuche.tsai -** [ALPS00349585] [6577JB][WiFi direct][KE]Establish p2p connection while both device have connected to AP previously,one device reboots automatically with KE -** Fix possible KE when concurrent & disconnect. - * - * 07 17 2012 yuche.tsai - * NULL - * Let netdev bring up. - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 02 14 2012 cp.wu - * NULL - * remove another assertion by error message dump - * - * 01 05 2012 tsaiyuan.hsu - * [WCXRP00001157] [MT6620 Wi-Fi][FW][DRV] add timing measurement support for 802.11v - * add timing measurement support for 802.11v. - * - * 11 19 2011 yuche.tsai - * NULL - * Update RSSI for P2P. - * - * 11 18 2011 yuche.tsai - * NULL - * CONFIG P2P support RSSI query, default turned off. - * - * 11 17 2011 tsaiyuan.hsu - * [WCXRP00001115] [MT6620 Wi-Fi][DRV] avoid deactivating staRec when changing state 3 to 3. - * avoid deactivating staRec when changing state from 3 to 3. - * - * 11 11 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * modify the xlog related code. - * - * 11 10 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Modify the QM xlog level and remove LOG_FUNC. - * - * 11 09 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Add xlog for beacon timeout and sta aging timeout. - * - * 11 08 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Add xlog function. - * - * 11 07 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * add debug counters and periodically dump counters for debugging. - * - * 10 21 2011 eddie.chen - * [WCXRP00001051] [MT6620 Wi-Fi][Driver/Fw] Adjust the STA aging timeout - * Add switch to ignore the STA aging timeout. - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 08 26 2011 cp.wu - * [WCXRP00000958] [MT6620 Wi-Fi][Driver] Extend polling timeout from 25ms to 1sec due to RF calibration might took up to 600ms - * extend polling RX response timeout period from 25ms to 1000ms. - * - * 08 11 2011 cp.wu - * [WCXRP00000830] [MT6620 Wi-Fi][Firmware] Use MDRDY counter to detect empty channel for shortening scan time - * sparse channel detection: - * driver: collect sparse channel information with scan-done event - * - * 07 28 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings - * Add BWCS cmd and event. - * - * 07 27 2011 cp.wu - * [WCXRP00000876] [MT5931][Drver] Decide to retain according to currently availble RX counter and QUE_MGT used count - * correct comment. - * - * 07 27 2011 cp.wu - * [WCXRP00000876] [MT5931][Drver] Decide to retain according to currently availble RX counter and QUE_MGT used count - * take use of QUE_MGT exported function to estimate currently RX buffer usage count. - * - * 07 18 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add CMD/Event for RDD and BWCS. - * - * 06 09 2011 tsaiyuan.hsu - * [WCXRP00000760] [MT5931 Wi-Fi][FW] Refine rxmHandleMacRxDone to reduce code size - * move send_auth at rxmHandleMacRxDone in firmware to driver to reduce code size. - * - * 05 11 2011 eddie.chen - * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet - * Fix dest type when GO packet copying. - * - * 05 09 2011 eddie.chen - * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet - * Check free number before copying broadcast packet. - * - * 05 05 2011 cp.wu - * [WCXRP00000702] [MT5931][Driver] Modify initialization sequence for E1 ASIC - * add delay after whole-chip resetting for MT5931 E1 ASIC. - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 04 12 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * . - * - * 04 08 2011 yuche.tsai - * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO. - * Add device discoverability support for GO. - * - * 04 01 2011 tsaiyuan.hsu - * [WCXRP00000615] [MT 6620 Wi-Fi][Driver] Fix klocwork issues - * fix the klocwork issues, 57500, 57501, 57502 and 57503. - * - * 03 19 2011 yuche.tsai - * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct. - * Add beacon timeout support for WiFi Direct Network. - * - * 03 18 2011 wh.su - * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done - * enable the Anti_piracy check at driver . - * - * 03 17 2011 cp.wu - * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period - * use pre-allocated buffer for storing enhanced interrupt response as well - * - * 03 15 2011 cp.wu - * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous memory consumption - * 1. deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK - * 2. Use common coalescing buffer for both TX/RX directions - * - * - * 03 07 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * rename the define to anti_pviracy. - * - * 03 05 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * add the code to get the check rsponse and indicate to app. - * - * 03 02 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * Add security check code. - * - * 03 02 2011 cp.wu - * [WCXRP00000503] [MT6620 Wi-Fi][Driver] Take RCPI brought by association response as initial RSSI right after connection is built. - * use RCPI brought by ASSOC-RESP after connection is built as initial RCPI to avoid using a uninitialized MAC-RX RCPI. - * - * 02 10 2011 yuche.tsai - * [WCXRP00000419] [Volunteer Patch][MT6620/MT5931][Driver] Provide function of disconnect to target station for AAA module. - * Remove Station Record after Aging timeout. - * - * 02 10 2011 cp.wu - * [WCXRP00000434] [MT6620 Wi-Fi][Driver] Obsolete unused event packet handlers - * EVENT_ID_CONNECTION_STATUS has been obsoleted and no need to handle. - * - * 02 09 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * Add MLME deauthentication support for Hot-Spot mode. - * - * 02 09 2011 eddie.chen - * [WCXRP00000426] [MT6620 Wi-Fi][FW/Driver] Add STA aging timeout and defualtHwRatein AP mode - * Adjust variable order. - * - * 02 08 2011 eddie.chen - * [WCXRP00000426] [MT6620 Wi-Fi][FW/Driver] Add STA aging timeout and defualtHwRatein AP mode - * Add event STA agint timeout - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * - * 01 26 2011 cm.chang - * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument - * . - * - * 01 24 2011 eddie.chen - * [WCXRP00000385] [MT6620 Wi-Fi][DRV] Add destination decision for forwarding packets - * Remove comments. - * - * 01 24 2011 eddie.chen - * [WCXRP00000385] [MT6620 Wi-Fi][DRV] Add destination decision for forwarding packets - * Add destination decision in AP mode. - * - * 01 24 2011 cm.chang - * [WCXRP00000384] [MT6620 Wi-Fi][Driver][FW] Handle 20/40 action frame in AP mode and stop ampdu timer when sta_rec is freed - * Process received 20/40 coexistence action frame for AP mode - * - * 01 24 2011 cp.wu - * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving - * 1. add an extra counter for tracking pending forward frames. - * 2. notify TX service thread as well when there is pending forward frame - * 3. correct build errors leaded by introduction of Wi-Fi direct separation module - * - * 01 12 2011 cp.wu - * [WCXRP00000357] [MT6620 Wi-Fi][Driver][Bluetooth over Wi-Fi] add another net device interface for BT AMP - * implementation of separate BT_OVER_WIFI data path. - * - * 12 29 2010 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, -Add per station flow control when STA is in PS - - * 1) PS flow control event - * - * 2) WMM IE in beacon, assoc resp, probe resp - * - * 12 15 2010 george.huang - * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function - * update beacon for NoA - * - * 11 01 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module - * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead - * 2) Remove CNM CH-RECOVER event handling - * 3) cfg read/write API renamed with kal prefix for unified naming rules. - * - * 10 27 2010 george.huang - * [WCXRP00000127] [MT6620 Wi-Fi][Driver] Add a registry to disable Beacon Timeout function for SQA test by using E1 EVB - * Support registry option for disable beacon lost detection. - * - * 10 20 2010 wh.su - * NULL - * add a cmd to reset the p2p key - * - * 10 20 2010 wh.su - * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group - * Add the code to support disconnect p2p group - * - * 09 29 2010 wh.su - * [WCXRP00000072] [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue - * fixed compilier error. - * - * 09 29 2010 wh.su - * [WCXRP00000072] [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue - * [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue. - * - * 09 23 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * eliminate reference of CFG_RESPONSE_MAX_PKT_SIZE - * - * 09 21 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * release RX packet to packet pool when in RF test mode - * - * 09 21 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * Do a complete reset with STA-REC null checking for RF test re-entry - * - * 09 08 2010 cp.wu - * NULL - * use static memory pool for storing IEs of scanning result. - * - * 09 07 2010 yuche.tsai - * NULL - * Add a common buffer, store the IE of a P2P device in this common buffer. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 31 2010 kevin.huang - * NULL - * Use LINK LIST operation to process SCAN result - * - * 08 30 2010 cp.wu - * NULL - * eliminate klockwork errors - * - * 08 20 2010 cm.chang - * NULL - * Migrate RLM code to host from FW - * - * 08 20 2010 yuche.tsai - * NULL - * When enable WiFi Direct function, check each packet to tell which interface to indicate. - * - * 08 05 2010 yuche.tsai - * NULL - * Add P2P Device Discovery Function. - * - * 08 03 2010 cp.wu - * NULL - * surpress compilation warning. - * - * 08 03 2010 george.huang - * NULL - * handle event for updating NOA parameters indicated from FW - * - * 08 02 2010 yuche.tsai - * NULL - * Add support API for RX public action frame. - * - * 08 02 2010 jeffrey.chang - * NULL - * 1) modify tx service thread to avoid busy looping - * 2) add spin lock declartion for linux build - * - * 07 30 2010 cp.wu - * NULL - * 1) BoW wrapper: use definitions instead of hard-coded constant for error code - * 2) AIS-FSM: eliminate use of desired RF parameters, use prTargetBssDesc instead - * 3) add handling for RX_PKT_DESTINATION_HOST_WITH_FORWARD for GO-broadcast frames - * - * 07 26 2010 yuche.tsai - * - * Update Device Capability Bitmap & Group Capability Bitmap from 16 bits to 8 bits. - * - * 07 24 2010 wh.su - * - * .support the Wi-Fi RSN - * - * 07 23 2010 cp.wu - * - * add AIS-FSM handling for beacon timeout event. - * - * 07 21 2010 yuche.tsai - * - * Add P2P Scan & Scan Result Parsing & Saving. - * - * 07 19 2010 cm.chang - * - * Set RLM parameters and enable CNM channel manager - * - * 07 19 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration. - * Add Ad-Hoc support to AIS-FSM - * - * 07 19 2010 jeffrey.chang - * - * Linux port modification - * - * 07 16 2010 yarco.yang - * - * 1. Support BSS Absence/Presence Event - * 2. Support STA change PS mode Event - * 3. Support BMC forwarding for AP mode. - * - * 07 15 2010 cp.wu - * - * sync. bluetooth-over-Wi-Fi interface to driver interface document v0.2.6. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * fill ucStaRecIdx into SW_RFB_T. - * - * 07 02 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) for event packet, no need to fill RFB. - * 2) when wlanAdapterStart() failed, no need to initialize state machines - * 3) after Beacon/ProbeResp parsing, corresponding BSS_DESC_T should be marked as IE-parsed - * - * 07 01 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * implementation of DRV-SCN and related mailbox message handling. - * - * 06 29 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * replace g_rQM with Adpater->rQM - * - * 06 23 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Merge g_arStaRec[] into adapter->arStaRec[] - * - * 06 22 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) add command warpper for STA-REC/BSS-INFO sync. - * 2) enhance command packet sending procedure for non-oid part - * 3) add command packet definitions for STA-REC/BSS-INFO sync. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * refine TX-DONE callback. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * implement TX_DONE callback path. - * - * 06 21 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Add TX Done Event handle entry - * - * 06 21 2010 wh.su - * [WPD00003840][MT6620 5931] Security migration - * remove duplicate variable for migration. - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * . - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * . - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * saa_fsm.c is migrated. - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add management dispatching function table. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) eliminate CFG_CMD_EVENT_VERSION_0_9 - * 2) when disconnected, indicate nic directly (no event is needed) - * - * 06 08 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * cnm_timer has been migrated. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * merge wlan_def.h. - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * sync with MT6620 driver for scan result replacement policy - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) integrate OID_GEN_NETWORK_LAYER_ADDRESSES with CMD_ID_SET_IP_ADDRESS - * 2) buffer statistics data for 2 seconds - * 3) use default value for adhoc parameters instead of 0 - * - * 05 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) do not take timeout mechanism for power mode oids - * 2) retrieve network type from connection status - * 3) after disassciation, set radio state to off - * 4) TCP option over IPv6 is supported - * - * 04 29 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * fixing the PMKID candicate indicate code. - * - * 04 28 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * change prefix for data structure used to communicate with 802.11 PAL - * to avoid ambiguous naming with firmware interface - * - * 04 27 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * basic implementation for EVENT_BT_OVER_WIFI - * - * 04 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * surpress compiler warning - * - * 04 22 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * - * 1) modify rx path code for supporting Wi-Fi direct - * 2) modify config.h since Linux dont need to consider retaining packet - * - * 04 16 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * treat BUS access failure as kind of card removal. - * - * 04 14 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * nicRxProcessEvent packet doesn't access spin-lock directly from now on. - * - * 04 14 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * do not need to release the spin lock due to it is done inside nicGetPendingCmdInfo() - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * * * * * * * * * * * * 2) command sequence number is now increased atomically - * * * * * * * * * * * * * * * 3) private data could be hold and taken use for other purpose - * - * 04 12 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add channel frequency <-> number conversion - * - * 04 09 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * 1) add spinlock - * 2) add KAPI for handling association info - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * rWlanInfo should be placed at adapter rather than glue due to most operations - * * * * * are done in adapter layer. - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access to prGlueInfo->eParamMediaStateIndicated from non-glue layer - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer - * - * 04 01 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * improve Linux supplicant compliance - * - * 03 31 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * fix ioctl which may cause cmdinfo memory leak - * - * 03 30 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * remove driver-land statistics. - * - * 03 29 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * improve none-glue code portability - * - * 03 28 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * rWlanInfo is modified before data is indicated to OS - * - * 03 28 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * rWlanInfo is modified before data is indicated to OS - * - * 03 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add a temporary flag for integration with CMD/EVENT v0.9. - * - * 03 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) correct OID_802_11_CONFIGURATION with frequency setting behavior. - * * * the frequency is used for adhoc connection only - * * * 2) update with SD1 v0.9 CMD/EVENT documentation - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port - * - * 03 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * . - * - * 03 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * generate information for OID_GEN_RCV_OK & OID_GEN_XMIT_OK - * * * * - * - * 03 19 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) add ACPI D0/D3 state switching support - * * * * * * * * * 2) use more formal way to handle interrupt when the status is retrieved from enhanced RX response - * - * 03 15 2010 kevin.huang - * [WPD00003820][MT6620 Wi-Fi] Modify the code for meet the WHQL test - * Add event for activate STA_RECORD_T - * - * 03 12 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct fgSetQuery/fgNeedResp check - * - * 03 11 2010 cp.wu - * [WPD00003821][BUG] Host driver stops processing RX packets from HIF RX0 - * add RX starvation warning debug message controlled by CFG_HIF_RX_STARVATION_WARNING - * - * 03 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * code clean: removing unused variables and structure definitions - * - * 03 08 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) add another spin-lock to protect MsduInfoList due to it might be accessed by different thread. - * * * 2) change own-back acquiring procedure to wait for up to 16.67 seconds - * - * 03 02 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) the use of prPendingOid revised, all accessing are now protected by spin lock - * * * * 2) ensure wlanReleasePendingOid will clear all command queues - * - * 03 02 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add mutex to avoid multiple access to qmTxQueue simultaneously. - * - * 02 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * move EVENT_ID_ASSOC_INFO from nic_rx.c to gl_kal_ndis_51.c - * * 'cause it involves OS dependent data structure handling - * - * 02 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * correct behavior to prevent duplicated RX handling for RX0_DONE and RX1_DONE - * - * 02 24 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Updated API interfaces for qmHandleEventRxAddBa() and qmHandleEventRxDelBa() - * - * 02 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement host-side firmware download logic - * - * 02 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) remove unused function in nic_rx.c [which has been handled in que_mgt.c] - * * * * * 2) firmware image length is now retrieved via NdisFileOpen - * * * * * 3) firmware image is not structured by (P_IMG_SEC_HDR_T) anymore - * * * * * 4) nicRxWaitResponse() revised - * * * * * 5) another set of TQ counter default value is added for fw-download state - * * * * * 6) Wi-Fi load address is now retrieved from registry too - * - * 02 09 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address - * * * * * * * * 2. follow MSDN defined behavior when associates to another AP - * * * * * * * * 3. for firmware download, packet size could be up to 2048 bytes - * - * 01 27 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * . - * - * 01 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * implement following 802.11 OIDs: - * * * * * * OID_802_11_RSSI, - * * * * * * OID_802_11_RSSI_TRIGGER, - * * * * * * OID_802_11_STATISTICS, - * * * * * * OID_802_11_DISASSOCIATE, - * * * * * * OID_802_11_POWER_MODE - * - * 12 30 2009 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) According to CMD/EVENT documentation v0.8, - * * * * * * * * * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used, - * * * * * * * * * and result is retrieved by get ATInfo instead - * * * * * * * * * 2) add 4 counter for recording aggregation statistics - * - * 12 23 2009 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add a precheck: if free sw rfb is not enough, do not invoke read transactionu1rwduu`wvpghlqg|fu+rp - * - * 12 22 2009 cp.wu - * [WPD00003809][Bug] Host driver will crash when processing reordered MSDUs - * The root cause is pointer accessing by mistake. After dequeued from reordering-buffer, handling logic should access returned pointer instead of pointer which has been passed in before. -** \main\maintrunk.MT6620WiFiDriver_Prj\58 2009-12-17 13:40:33 GMT mtk02752 -** always update prAdapter->rSDIOCtrl when enhanced response is read by RX -** \main\maintrunk.MT6620WiFiDriver_Prj\57 2009-12-16 18:01:38 GMT mtk02752 -** if interrupt enhanced response is fetched by RX enhanced response, RX needs to invoke interrupt handlers too -** \main\maintrunk.MT6620WiFiDriver_Prj\56 2009-12-16 14:16:52 GMT mtk02752 -** \main\maintrunk.MT6620WiFiDriver_Prj\55 2009-12-15 20:03:12 GMT mtk02752 -** ASSERT when RX FreeSwRfb is not enough -** \main\maintrunk.MT6620WiFiDriver_Prj\54 2009-12-15 17:01:29 GMT mtk02752 -** when CFG_SDIO_RX_ENHANCE is enabled, after enhanced response is read, rx procedure should process 1) TX_DONE_INT 2) D2H INT as well -** \main\maintrunk.MT6620WiFiDriver_Prj\53 2009-12-14 20:45:28 GMT mtk02752 -** when CFG_SDIO_RX_ENHANCE is set, TC counter must be updated each time RX enhance response is read -** -** \main\maintrunk.MT6620WiFiDriver_Prj\52 2009-12-14 11:34:16 GMT mtk02752 -** correct a trivial logic issue -** \main\maintrunk.MT6620WiFiDriver_Prj\51 2009-12-14 10:28:25 GMT mtk02752 -** add a protection to avoid out-of-boundary access -** \main\maintrunk.MT6620WiFiDriver_Prj\50 2009-12-10 16:55:18 GMT mtk02752 -** code clean -** \main\maintrunk.MT6620WiFiDriver_Prj\49 2009-12-09 14:06:47 GMT MTK02468 -** Added parsing event packets with EVENT_ID_RX_ADDBA or EVENT_ID_RX_DELBA -** \main\maintrunk.MT6620WiFiDriver_Prj\48 2009-12-08 17:37:51 GMT mtk02752 -** handle EVENT_ID_TEST_STATUS as well -** \main\maintrunk.MT6620WiFiDriver_Prj\47 2009-12-04 17:59:11 GMT mtk02752 -** to pass free-build compilation check -** \main\maintrunk.MT6620WiFiDriver_Prj\46 2009-12-04 12:09:52 GMT mtk02752 -** correct trivial mistake -** \main\maintrunk.MT6620WiFiDriver_Prj\45 2009-12-04 11:53:37 GMT mtk02752 -** all API should be compilable under SD1_SD3_DATAPATH_INTEGRATION == 0 -** \main\maintrunk.MT6620WiFiDriver_Prj\44 2009-12-03 16:19:48 GMT mtk01461 -** Fix the Connected Event -** \main\maintrunk.MT6620WiFiDriver_Prj\43 2009-11-30 10:56:18 GMT mtk02752 -** 1st DW of WIFI_EVENT_T is shared with HIF_RX_HEADER_T -** \main\maintrunk.MT6620WiFiDriver_Prj\42 2009-11-30 10:11:27 GMT mtk02752 -** implement replacement for bss scan result -** \main\maintrunk.MT6620WiFiDriver_Prj\41 2009-11-27 11:08:05 GMT mtk02752 -** add flush for reset -** \main\maintrunk.MT6620WiFiDriver_Prj\40 2009-11-26 09:38:59 GMT mtk02752 -** \main\maintrunk.MT6620WiFiDriver_Prj\39 2009-11-26 09:29:40 GMT mtk02752 -** enable packet forwarding path (for AP mode) -** \main\maintrunk.MT6620WiFiDriver_Prj\38 2009-11-25 21:37:00 GMT mtk02752 -** sync. with EVENT_SCAN_RESULT_T change, and add an assert for checking event size -** \main\maintrunk.MT6620WiFiDriver_Prj\37 2009-11-25 20:17:41 GMT mtk02752 -** fill HIF_TX_HEADER_T.u2SeqNo -** \main\maintrunk.MT6620WiFiDriver_Prj\36 2009-11-25 18:18:57 GMT mtk02752 -** buffer scan result to prGlueInfo->rWlanInfo.arScanResult directly. -** \main\maintrunk.MT6620WiFiDriver_Prj\35 2009-11-24 22:42:45 GMT mtk02752 -** add nicRxAddScanResult() to prepare to handle SCAN_RESULT event (not implemented yet) -** \main\maintrunk.MT6620WiFiDriver_Prj\34 2009-11-24 20:51:41 GMT mtk02752 -** integrate with SD1's data path API -** \main\maintrunk.MT6620WiFiDriver_Prj\33 2009-11-24 19:56:17 GMT mtk02752 -** adopt P_HIF_RX_HEADER_T in new path -** \main\maintrunk.MT6620WiFiDriver_Prj\32 2009-11-23 20:31:21 GMT mtk02752 -** payload to send into pfCmdDoneHandler() will not include WIFI_EVENT_T -** \main\maintrunk.MT6620WiFiDriver_Prj\31 2009-11-23 17:51:34 GMT mtk02752 -** when event packet corresponding to some pendingOID is received, pendingOID should be cleared -** \main\maintrunk.MT6620WiFiDriver_Prj\30 2009-11-23 14:46:54 GMT mtk02752 -** implement nicRxProcessEventPacket() -** \main\maintrunk.MT6620WiFiDriver_Prj\29 2009-11-17 22:40:54 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\28 2009-11-16 21:48:22 GMT mtk02752 -** add SD1_SD3_DATAPATH_INTEGRATION data path handling -** \main\maintrunk.MT6620WiFiDriver_Prj\27 2009-11-16 15:41:18 GMT mtk01084 -** modify the length to be read in emu mode -** \main\maintrunk.MT6620WiFiDriver_Prj\26 2009-11-13 17:00:12 GMT mtk02752 -** add blank function for event packet -** \main\maintrunk.MT6620WiFiDriver_Prj\25 2009-11-13 13:54:24 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\24 2009-11-11 14:41:51 GMT mtk02752 -** fix typo -** \main\maintrunk.MT6620WiFiDriver_Prj\23 2009-11-11 14:33:46 GMT mtk02752 -** add protection when there is no packet avilable -** \main\maintrunk.MT6620WiFiDriver_Prj\22 2009-11-11 12:33:36 GMT mtk02752 -** add RX1 read path for aggregated/enhanced/normal packet read procedures -** \main\maintrunk.MT6620WiFiDriver_Prj\21 2009-11-11 10:36:18 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\20 2009-11-04 14:11:08 GMT mtk01084 -** modify lines in RX aggregation -** \main\maintrunk.MT6620WiFiDriver_Prj\19 2009-10-30 18:17:23 GMT mtk01084 -** modify RX aggregation handling -** \main\maintrunk.MT6620WiFiDriver_Prj\18 2009-10-29 19:56:12 GMT mtk01084 -** modify HAL part -** \main\maintrunk.MT6620WiFiDriver_Prj\17 2009-10-23 16:08:34 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-10-13 21:59:20 GMT mtk01084 -** update for new HW design -** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-10-02 13:59:08 GMT mtk01725 -** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-05-21 23:39:05 GMT mtk01461 -** Fix the paste error of RX STATUS in OOB of HIF Loopback CTRL -** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-05-20 12:25:32 GMT mtk01461 -** Fix process of Read Done, and add u4MaxEventBufferLen to nicRxWaitResponse() -** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-05-18 21:13:18 GMT mtk01426 -** Fixed compiler error -** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-05-18 21:05:29 GMT mtk01426 -** Fixed nicRxSDIOAggReceiveRFBs() ASSERT issue -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-04-28 10:38:43 GMT mtk01461 -** Fix RX STATUS is DW align for SDIO_STATUS_ENHANCE mode and refine nicRxSDIOAggeceiveRFBs() for RX Aggregation -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-04-22 09:12:17 GMT mtk01461 -** Fix nicRxProcessHIFLoopbackPacket(), the size of HIF CTRL LENTH field is 1 byte -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-04-14 15:51:26 GMT mtk01426 -** Update RX OOB Setting -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-04-03 14:58:58 GMT mtk01426 -** Fixed logical error -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-01 10:58:31 GMT mtk01461 -** Rename the HIF_PKT_TYPE_DATA -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-03-23 21:51:18 GMT mtk01461 -** Fix u4HeaderOffset in nicRxProcessHIFLoopbackPacket() -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-18 21:02:58 GMT mtk01426 -** Add CFG_SDIO_RX_ENHANCE and CFG_HIF_LOOPBACK support -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-17 20:20:59 GMT mtk01426 -** Add nicRxWaitResponse function -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:26:01 GMT mtk01426 -** Init for develop -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -#ifndef LINUX -#include -#else -#include -#endif - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define RX_RESPONSE_TIMEOUT (1000) - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -#if CFG_MGMT_FRAME_HANDLING -static PROCESS_RX_MGT_FUNCTION apfnProcessRxMgtFrame[MAX_NUM_OF_FC_SUBTYPES] = { - #if CFG_SUPPORT_AAA - aaaFsmRunEventRxAssoc, /* subtype 0000: Association request */ - #else - NULL, /* subtype 0000: Association request */ - #endif /* CFG_SUPPORT_AAA */ - saaFsmRunEventRxAssoc, /* subtype 0001: Association response */ - #if CFG_SUPPORT_AAA - aaaFsmRunEventRxAssoc, /* subtype 0010: Reassociation request */ - #else - NULL, /* subtype 0010: Reassociation request */ - #endif /* CFG_SUPPORT_AAA */ - saaFsmRunEventRxAssoc, /* subtype 0011: Reassociation response */ - #if CFG_SUPPORT_ADHOC - bssProcessProbeRequest, /* subtype 0100: Probe request */ - #else - NULL, /* subtype 0100: Probe request */ - #endif /* CFG_SUPPORT_ADHOC */ - scanProcessBeaconAndProbeResp, /* subtype 0101: Probe response */ - NULL, /* subtype 0110: reserved */ - NULL, /* subtype 0111: reserved */ - scanProcessBeaconAndProbeResp, /* subtype 1000: Beacon */ - NULL, /* subtype 1001: ATIM */ - saaFsmRunEventRxDisassoc, /* subtype 1010: Disassociation */ - authCheckRxAuthFrameTransSeq, /* subtype 1011: Authentication */ - saaFsmRunEventRxDeauth, /* subtype 1100: Deauthentication */ - nicRxProcessActionFrame, /* subtype 1101: Action */ - NULL, /* subtype 1110: reserved */ - NULL /* subtype 1111: reserved */ -}; -#endif - - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/*! -* @brief Initialize the RFBs -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxInitialize ( - IN P_ADAPTER_T prAdapter - ) -{ - P_RX_CTRL_T prRxCtrl; - PUINT_8 pucMemHandle; - P_SW_RFB_T prSwRfb = (P_SW_RFB_T)NULL; - UINT_32 i; - - DEBUGFUNC("nicRxInitialize"); - - ASSERT(prAdapter); - prRxCtrl = &prAdapter->rRxCtrl; - - //4 <0> Clear allocated memory. - kalMemZero((PVOID) prRxCtrl->pucRxCached, prRxCtrl->u4RxCachedSize); - - //4 <1> Initialize the RFB lists - QUEUE_INITIALIZE(&prRxCtrl->rFreeSwRfbList); - QUEUE_INITIALIZE(&prRxCtrl->rReceivedRfbList); - QUEUE_INITIALIZE(&prRxCtrl->rIndicatedRfbList); - - pucMemHandle = prRxCtrl->pucRxCached; - for (i = CFG_RX_MAX_PKT_NUM; i != 0; i--) { - prSwRfb = (P_SW_RFB_T)pucMemHandle; - - nicRxSetupRFB(prAdapter, prSwRfb); - nicRxReturnRFB(prAdapter, prSwRfb); - - pucMemHandle += ALIGN_4(sizeof(SW_RFB_T)); - } - - ASSERT(prRxCtrl->rFreeSwRfbList.u4NumElem == CFG_RX_MAX_PKT_NUM); - /* Check if the memory allocation consist with this initialization function */ - ASSERT((UINT_32)(pucMemHandle - prRxCtrl->pucRxCached) == prRxCtrl->u4RxCachedSize); - - //4 <2> Clear all RX counters - RX_RESET_ALL_CNTS(prRxCtrl); - -#if CFG_SDIO_RX_AGG - prRxCtrl->pucRxCoalescingBufPtr = prAdapter->pucCoalescingBufCached; - #if !defined(MT5931) - HAL_CFG_MAX_HIF_RX_LEN_NUM(prAdapter, CFG_SDIO_MAX_RX_AGG_NUM); - #endif -#else - #if !defined(MT5931) - HAL_CFG_MAX_HIF_RX_LEN_NUM(prAdapter, 1); - #endif -#endif - -#if CFG_HIF_STATISTICS - prRxCtrl->u4TotalRxAccessNum = 0; - prRxCtrl->u4TotalRxPacketNum = 0; -#endif - -#if CFG_HIF_RX_STARVATION_WARNING - prRxCtrl->u4QueuedCnt = 0; - prRxCtrl->u4DequeuedCnt = 0; -#endif - - return; -} /* end of nicRxInitialize() */ - - -#if defined(MT5931) -/*----------------------------------------------------------------------------*/ -/*! -* @brief Initialize HIF RX control registers explicitly -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxPostInitialize ( - IN P_ADAPTER_T prAdapter - ) -{ - P_RX_CTRL_T prRxCtrl; - DEBUGFUNC("nicRxPostInitialize"); - - ASSERT(prAdapter); - prRxCtrl = &prAdapter->rRxCtrl; - -#if CFG_SDIO_RX_AGG - HAL_CFG_MAX_HIF_RX_LEN_NUM(prAdapter, CFG_SDIO_MAX_RX_AGG_NUM); -#else - HAL_CFG_MAX_HIF_RX_LEN_NUM(prAdapter, 1); -#endif - -} /* end of nicRxPostInitialize() */ -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Uninitialize the RFBs -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxUninitialize ( - IN P_ADAPTER_T prAdapter - ) -{ - P_RX_CTRL_T prRxCtrl; - P_SW_RFB_T prSwRfb = (P_SW_RFB_T)NULL; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - prRxCtrl = &prAdapter->rRxCtrl; - ASSERT(prRxCtrl); - - nicRxFlush(prAdapter); - - do { - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - QUEUE_REMOVE_HEAD(&prRxCtrl->rReceivedRfbList, prSwRfb, P_SW_RFB_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - if (prSwRfb){ - if (prSwRfb->pvPacket) { - kalPacketFree(prAdapter->prGlueInfo, prSwRfb->pvPacket); - } - prSwRfb->pvPacket = NULL; - } - else { - break; - } - }while (TRUE); - - do { - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfb, P_SW_RFB_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - if (prSwRfb){ - if (prSwRfb->pvPacket) { - kalPacketFree(prAdapter->prGlueInfo, prSwRfb->pvPacket); - } - prSwRfb->pvPacket = NULL; - } - else { - break; - } - }while (TRUE); - - return; -} /* end of nicRxUninitialize() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Fill RFB -* -* @param prAdapter pointer to the Adapter handler -* @param prSWRfb specify the RFB to receive rx data -* -* @return (none) -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxFillRFB ( - IN P_ADAPTER_T prAdapter, - IN OUT P_SW_RFB_T prSwRfb - ) -{ - P_HIF_RX_HEADER_T prHifRxHdr; - - UINT_32 u4PktLen = 0; - UINT_32 u4MacHeaderLen; - UINT_32 u4HeaderOffset; - - DEBUGFUNC("nicRxFillRFB"); - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - prHifRxHdr = prSwRfb->prHifRxHdr; - ASSERT(prHifRxHdr); - - u4PktLen= prHifRxHdr->u2PacketLen; - - u4HeaderOffset = (UINT_32)(prHifRxHdr->ucHerderLenOffset & HIF_RX_HDR_HEADER_OFFSET_MASK); - u4MacHeaderLen = (UINT_32)(prHifRxHdr->ucHerderLenOffset & HIF_RX_HDR_HEADER_LEN) - >> HIF_RX_HDR_HEADER_LEN_OFFSET; - - //DBGLOG(RX, TRACE, ("u4HeaderOffset = %d, u4MacHeaderLen = %d\n", - // u4HeaderOffset, u4MacHeaderLen)); - - prSwRfb->u2HeaderLen = (UINT_16)u4MacHeaderLen; - prSwRfb->pvHeader = (PUINT_8)prHifRxHdr + HIF_RX_HDR_SIZE + u4HeaderOffset; - prSwRfb->u2PacketLen = (UINT_16)(u4PktLen - (HIF_RX_HDR_SIZE + u4HeaderOffset)); - - //DBGLOG(RX, TRACE, ("Dump Rx packet, u2PacketLen = %d\n", prSwRfb->u2PacketLen)); - //DBGLOG_MEM8(RX, TRACE, prSwRfb->pvHeader, prSwRfb->u2PacketLen); - -#if 0 - if (prHifRxHdr->ucReorder & HIF_RX_HDR_80211_HEADER_FORMAT){ - prSwRfb->u4HifRxHdrFlag |= HIF_RX_HDR_FLAG_802_11_FORMAT; - DBGLOG(RX, TRACE, ("HIF_RX_HDR_FLAG_802_11_FORMAT\n")); - } - - if (prHifRxHdr->ucReorder & HIF_RX_HDR_DO_REORDER){ - prSwRfb->u4HifRxHdrFlag |= HIF_RX_HDR_FLAG_DO_REORDERING; - DBGLOG(RX, TRACE, ("HIF_RX_HDR_FLAG_DO_REORDERING\n")); - - /* Get Seq. No and TID, Wlan Index info */ - if (prHifRxHdr->u2SeqNoTid & HIF_RX_HDR_BAR_FRAME){ - prSwRfb->u4HifRxHdrFlag |= HIF_RX_HDR_FLAG_BAR_FRAME; - DBGLOG(RX, TRACE, ("HIF_RX_HDR_FLAG_BAR_FRAME\n")); - } - - prSwRfb->u2SSN = prHifRxHdr->u2SeqNoTid & HIF_RX_HDR_SEQ_NO_MASK; - prSwRfb->ucTid = (UINT_8)((prHifRxHdr->u2SeqNoTid & HIF_RX_HDR_TID_MASK) - >> HIF_RX_HDR_TID_OFFSET); - DBGLOG(RX, TRACE, ("u2SSN = %d, ucTid = %d\n", - prSwRfb->u2SSN, prSwRfb->ucTid)); - } - - if (prHifRxHdr->ucReorder & HIF_RX_HDR_WDS){ - prSwRfb->u4HifRxHdrFlag |= HIF_RX_HDR_FLAG_AMP_WDS; - DBGLOG(RX, TRACE, ("HIF_RX_HDR_FLAG_AMP_WDS\n")); - } -#endif -} - - -#if CFG_TCP_IP_CHKSUM_OFFLOAD || CFG_TCP_IP_CHKSUM_OFFLOAD_NDIS_60 -/*----------------------------------------------------------------------------*/ -/*! -* @brief Fill checksum status in RFB -* -* @param prAdapter pointer to the Adapter handler -* @param prSWRfb the RFB to receive rx data -* @param u4TcpUdpIpCksStatus specify the Checksum status -* -* @return (none) -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxFillChksumStatus( - IN P_ADAPTER_T prAdapter, - IN OUT P_SW_RFB_T prSwRfb, - IN UINT_32 u4TcpUdpIpCksStatus -) -{ - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - if (prAdapter->u4CSUMFlags != CSUM_NOT_SUPPORTED){ - if (u4TcpUdpIpCksStatus & RX_CS_TYPE_IPv4) { // IPv4 packet - prSwRfb->aeCSUM[CSUM_TYPE_IPV6] = CSUM_RES_NONE; - if(u4TcpUdpIpCksStatus & RX_CS_STATUS_IP) { //IP packet csum failed - prSwRfb->aeCSUM[CSUM_TYPE_IPV4] = CSUM_RES_FAILED; - } else { - prSwRfb->aeCSUM[CSUM_TYPE_IPV4] = CSUM_RES_SUCCESS; - } - - if (u4TcpUdpIpCksStatus & RX_CS_TYPE_TCP) { //TCP packet - prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_NONE; - if(u4TcpUdpIpCksStatus & RX_CS_STATUS_TCP) { //TCP packet csum failed - prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_FAILED; - } else { - prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_SUCCESS; - } - } - else if (u4TcpUdpIpCksStatus & RX_CS_TYPE_UDP) { //UDP packet - prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_NONE; - if(u4TcpUdpIpCksStatus & RX_CS_STATUS_UDP) { //UDP packet csum failed - prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_FAILED; - } else { - prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_SUCCESS; - } - } - else { - prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_NONE; - prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_NONE; - } - } - else if (u4TcpUdpIpCksStatus & RX_CS_TYPE_IPv6) {//IPv6 packet - prSwRfb->aeCSUM[CSUM_TYPE_IPV4] = CSUM_RES_NONE; - prSwRfb->aeCSUM[CSUM_TYPE_IPV6] = CSUM_RES_SUCCESS; - - if (u4TcpUdpIpCksStatus & RX_CS_TYPE_TCP) { //TCP packet - prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_NONE; - if(u4TcpUdpIpCksStatus & RX_CS_STATUS_TCP) { //TCP packet csum failed - prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_FAILED; - } else { - prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_SUCCESS; - } - } - else if (u4TcpUdpIpCksStatus & RX_CS_TYPE_UDP) { //UDP packet - prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_NONE; - if(u4TcpUdpIpCksStatus & RX_CS_STATUS_UDP) { //UDP packet csum failed - prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_FAILED; - } else { - prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_SUCCESS; - } - } - else { - prSwRfb->aeCSUM[CSUM_TYPE_UDP] = CSUM_RES_NONE; - prSwRfb->aeCSUM[CSUM_TYPE_TCP] = CSUM_RES_NONE; - } - } - else { - prSwRfb->aeCSUM[CSUM_TYPE_IPV4] = CSUM_RES_NONE; - prSwRfb->aeCSUM[CSUM_TYPE_IPV6] = CSUM_RES_NONE; - } - } - -} -#endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process packet doesn't need to do buffer reordering -* -* @param prAdapter pointer to the Adapter handler -* @param prSWRfb the RFB to receive rx data -* -* @return (none) -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxProcessPktWithoutReorder ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_RX_CTRL_T prRxCtrl; - P_TX_CTRL_T prTxCtrl; - BOOL fgIsRetained = FALSE; - UINT_32 u4CurrentRxBufferCount; - P_STA_RECORD_T prStaRec = (P_STA_RECORD_T)NULL; - - DEBUGFUNC("nicRxProcessPktWithoutReorder"); - //DBGLOG(RX, TRACE, ("\n")); - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - prRxCtrl = &prAdapter->rRxCtrl; - ASSERT(prRxCtrl); - - prTxCtrl = &prAdapter->rTxCtrl; - ASSERT(prTxCtrl); - - u4CurrentRxBufferCount = prRxCtrl->rFreeSwRfbList.u4NumElem; - /* QM USED = $A, AVAILABLE COUNT = $B, INDICATED TO OS = $C - * TOTAL = $A + $B + $C - * - * Case #1 (Retain) - * ------------------------------------------------------- - * $A + $B < THRESHOLD := $A + $B + $C < THRESHOLD + $C := $TOTAL - THRESHOLD < $C - * => $C used too much, retain - * - * Case #2 (Non-Retain) - * ------------------------------------------------------- - * $A + $B > THRESHOLD := $A + $B + $C > THRESHOLD + $C := $TOTAL - THRESHOLD > $C - * => still availble for $C to use - * - */ - fgIsRetained = (((u4CurrentRxBufferCount + - qmGetRxReorderQueuedBufferCount(prAdapter) + - prTxCtrl->i4PendingFwdFrameCount) < CFG_RX_RETAINED_PKT_THRESHOLD) ? - TRUE : FALSE); - - //DBGLOG(RX, INFO, ("fgIsRetained = %d\n", fgIsRetained)); - - if (kalProcessRxPacket(prAdapter->prGlueInfo, - prSwRfb->pvPacket, - prSwRfb->pvHeader, - (UINT_32)prSwRfb->u2PacketLen, - fgIsRetained, - prSwRfb->aeCSUM) != WLAN_STATUS_SUCCESS) { - DBGLOG(RX, ERROR, ("kalProcessRxPacket return value != WLAN_STATUS_SUCCESS\n")); - ASSERT(0); - - nicRxReturnRFB(prAdapter, prSwRfb); - return; - } - else { - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - - if (prStaRec) { -#if CFG_ENABLE_WIFI_DIRECT - if (prStaRec->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX && - prAdapter->fgIsP2PRegistered == TRUE) { - GLUE_SET_PKT_FLAG_P2P(prSwRfb->pvPacket); - } -#endif -#if CFG_ENABLE_BT_OVER_WIFI - if (prStaRec->ucNetTypeIndex == NETWORK_TYPE_BOW_INDEX) { - GLUE_SET_PKT_FLAG_PAL(prSwRfb->pvPacket); - } -#endif - } - prRxCtrl->apvIndPacket[prRxCtrl->ucNumIndPacket] = prSwRfb->pvPacket; - prRxCtrl->ucNumIndPacket++; - } - - if (fgIsRetained) { - prRxCtrl->apvRetainedPacket[prRxCtrl->ucNumRetainedPacket] = prSwRfb->pvPacket; - prRxCtrl->ucNumRetainedPacket++; - /* TODO : error handling of nicRxSetupRFB */ - nicRxSetupRFB(prAdapter, prSwRfb); - nicRxReturnRFB(prAdapter, prSwRfb); - } - else{ - prSwRfb->pvPacket = NULL; - nicRxReturnRFB(prAdapter, prSwRfb); - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process forwarding data packet -* -* @param prAdapter pointer to the Adapter handler -* @param prSWRfb the RFB to receive rx data -* -* @return (none) -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxProcessForwardPkt ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_MSDU_INFO_T prMsduInfo, prRetMsduInfoList; - P_TX_CTRL_T prTxCtrl; - P_RX_CTRL_T prRxCtrl; - KAL_SPIN_LOCK_DECLARATION(); - - DEBUGFUNC("nicRxProcessForwardPkt"); - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - prTxCtrl = &prAdapter->rTxCtrl; - prRxCtrl = &prAdapter->rRxCtrl; - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST); - QUEUE_REMOVE_HEAD(&prTxCtrl->rFreeMsduInfoList, prMsduInfo, P_MSDU_INFO_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST); - - if(prMsduInfo && kalProcessRxPacket(prAdapter->prGlueInfo, - prSwRfb->pvPacket, - prSwRfb->pvHeader, - (UINT_32)prSwRfb->u2PacketLen, - prRxCtrl->rFreeSwRfbList.u4NumElem < CFG_RX_RETAINED_PKT_THRESHOLD ? TRUE : FALSE, - prSwRfb->aeCSUM) == WLAN_STATUS_SUCCESS) { - - prMsduInfo->eSrc = TX_PACKET_FORWARDING; - // pack into MSDU_INFO_T - nicTxFillMsduInfo(prAdapter, prMsduInfo, (P_NATIVE_PACKET)(prSwRfb->pvPacket)); - // Overwrite the ucNetworkType - prMsduInfo->ucNetworkType = HIF_RX_HDR_GET_NETWORK_IDX(prSwRfb->prHifRxHdr); - - // release RX buffer (to rIndicatedRfbList) - prSwRfb->pvPacket = NULL; - nicRxReturnRFB(prAdapter, prSwRfb); - - // increase forward frame counter - GLUE_INC_REF_CNT(prTxCtrl->i4PendingFwdFrameCount); - - // send into TX queue - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_QM_TX_QUEUE); - prRetMsduInfoList = qmEnqueueTxPackets(prAdapter, prMsduInfo); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_QM_TX_QUEUE); - - if(prRetMsduInfoList != NULL) { // TX queue refuses queuing the packet - nicTxFreeMsduInfoPacket(prAdapter, prRetMsduInfoList); - nicTxReturnMsduInfo(prAdapter, prRetMsduInfoList); - } - /* indicate service thread for sending */ - if(prTxCtrl->i4PendingFwdFrameCount > 0) { - kalSetEvent(prAdapter->prGlueInfo); - } - } - else { // no TX resource - nicRxReturnRFB(prAdapter, prSwRfb); - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process broadcast data packet for both host and forwarding -* -* @param prAdapter pointer to the Adapter handler -* @param prSWRfb the RFB to receive rx data -* -* @return (none) -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxProcessGOBroadcastPkt ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_SW_RFB_T prSwRfbDuplicated; - P_TX_CTRL_T prTxCtrl; - P_RX_CTRL_T prRxCtrl; - P_HIF_RX_HEADER_T prHifRxHdr; - - KAL_SPIN_LOCK_DECLARATION(); - - DEBUGFUNC("nicRxProcessGOBroadcastPkt"); - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - prTxCtrl = &prAdapter->rTxCtrl; - prRxCtrl = &prAdapter->rRxCtrl; - - prHifRxHdr = prSwRfb->prHifRxHdr; - ASSERT(prHifRxHdr); - - ASSERT(CFG_NUM_OF_QM_RX_PKT_NUM >= 16); - - if( prRxCtrl->rFreeSwRfbList.u4NumElem - >= (CFG_RX_MAX_PKT_NUM - (CFG_NUM_OF_QM_RX_PKT_NUM - 16 /* Reserved for others */) ) ) { - - /* 1. Duplicate SW_RFB_T */ - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfbDuplicated, P_SW_RFB_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - - if(prSwRfbDuplicated){ - kalMemCopy(prSwRfbDuplicated->pucRecvBuff, - prSwRfb->pucRecvBuff, - ALIGN_4(prHifRxHdr->u2PacketLen + HIF_RX_HW_APPENDED_LEN)); - - prSwRfbDuplicated->ucPacketType = HIF_RX_PKT_TYPE_DATA; - prSwRfbDuplicated->ucStaRecIdx = (UINT_8)(prHifRxHdr->ucStaRecIdx); - nicRxFillRFB(prAdapter, prSwRfbDuplicated); - - /* 2. Modify eDst */ - prSwRfbDuplicated->eDst = RX_PKT_DESTINATION_FORWARD; - - /* 4. Forward */ - nicRxProcessForwardPkt(prAdapter, prSwRfbDuplicated); - } - } - else { - DBGLOG(RX, WARN, ("Stop to forward BMC packet due to less free Sw Rfb %u\n", prRxCtrl->rFreeSwRfbList.u4NumElem)); - } - - /* 3. Indicate to host */ - prSwRfb->eDst = RX_PKT_DESTINATION_HOST; - nicRxProcessPktWithoutReorder(prAdapter, prSwRfb); - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process HIF data packet -* -* @param prAdapter pointer to the Adapter handler -* @param prSWRfb the RFB to receive rx data -* -* @return (none) -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxProcessDataPacket ( - IN P_ADAPTER_T prAdapter, - IN OUT P_SW_RFB_T prSwRfb - ) -{ - P_RX_CTRL_T prRxCtrl; - P_SW_RFB_T prRetSwRfb, prNextSwRfb; - P_HIF_RX_HEADER_T prHifRxHdr; - P_STA_RECORD_T prStaRec; - - DEBUGFUNC("nicRxProcessDataPacket"); - //DBGLOG(INIT, TRACE, ("\n")); - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - prHifRxHdr = prSwRfb->prHifRxHdr; - prRxCtrl = &prAdapter->rRxCtrl; - - nicRxFillRFB(prAdapter, prSwRfb); - -#if 1 /* Check 1x Pkt */ - if (prSwRfb->u2PacketLen > 14) { - PUINT_8 pc = (PUINT_8)prSwRfb->pvHeader; - UINT_16 u2Etype = 0; - - u2Etype = (pc[ETH_TYPE_LEN_OFFSET] << 8) | (pc[ETH_TYPE_LEN_OFFSET + 1]); - -#if CFG_SUPPORT_WAPI - if (u2Etype == ETH_P_1X || u2Etype == ETH_WPI_1X) { - DBGLOG(RSN, INFO, ("R1X len=%d\n", prSwRfb->u2PacketLen)); - } -#else - if (u2Etype == ETH_P_1X) { - DBGLOG(RSN, INFO, ("R1X len=%d\n", prSwRfb->u2PacketLen)); - } -#endif - else if (u2Etype == ETH_P_PRE_1X) { - DBGLOG(RSN, INFO, ("Pre R1X len=%d\n", prSwRfb->u2PacketLen)); - } - } -#endif - -#if CFG_TCP_IP_CHKSUM_OFFLOAD || CFG_TCP_IP_CHKSUM_OFFLOAD_NDIS_60 - { - UINT_32 u4TcpUdpIpCksStatus; - - u4TcpUdpIpCksStatus = *((PUINT_32)((UINT_32)prHifRxHdr + - (UINT_32)(ALIGN_4(prHifRxHdr->u2PacketLen)))); - nicRxFillChksumStatus(prAdapter, prSwRfb, u4TcpUdpIpCksStatus); - - } -#endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */ - - prStaRec = cnmGetStaRecByIndex(prAdapter, prHifRxHdr->ucStaRecIdx); - if(secCheckClassError(prAdapter, prSwRfb, prStaRec) == TRUE && - prAdapter->fgTestMode == FALSE) { -#if CFG_HIF_RX_STARVATION_WARNING - prRxCtrl->u4QueuedCnt++; -#endif - - if((prRetSwRfb = qmHandleRxPackets(prAdapter, prSwRfb)) != NULL) { - do { - // save next first - prNextSwRfb = (P_SW_RFB_T)QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T)prRetSwRfb); - - switch(prRetSwRfb->eDst) { - case RX_PKT_DESTINATION_HOST: - nicRxProcessPktWithoutReorder(prAdapter, prRetSwRfb); - break; - - case RX_PKT_DESTINATION_FORWARD: - nicRxProcessForwardPkt(prAdapter, prRetSwRfb); - break; - - case RX_PKT_DESTINATION_HOST_WITH_FORWARD: - nicRxProcessGOBroadcastPkt(prAdapter, prRetSwRfb); - break; - - case RX_PKT_DESTINATION_NULL: - nicRxReturnRFB(prAdapter, prRetSwRfb); - RX_INC_CNT(prRxCtrl, RX_DST_NULL_DROP_COUNT); - RX_INC_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT); - break; - - default: - break; - } -#if CFG_HIF_RX_STARVATION_WARNING - prRxCtrl->u4DequeuedCnt++; -#endif - prRetSwRfb = prNextSwRfb; - } while(prRetSwRfb); - } - } - else { - nicRxReturnRFB(prAdapter, prSwRfb); - RX_INC_CNT(prRxCtrl, RX_CLASS_ERR_DROP_COUNT); - RX_INC_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT); - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process HIF event packet -* -* @param prAdapter pointer to the Adapter handler -* @param prSWRfb the RFB to receive rx data -* -* @return (none) -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxProcessEventPacket ( - IN P_ADAPTER_T prAdapter, - IN OUT P_SW_RFB_T prSwRfb - ) -{ - P_CMD_INFO_T prCmdInfo; - P_MSDU_INFO_T prMsduInfo; - P_WIFI_EVENT_T prEvent; - P_GLUE_INFO_T prGlueInfo; - - DEBUGFUNC("nicRxProcessEventPacket"); - //DBGLOG(INIT, TRACE, ("\n")); - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - prEvent = (P_WIFI_EVENT_T) prSwRfb->pucRecvBuff; - prGlueInfo = prAdapter->prGlueInfo; - - // Event Handling - switch(prEvent->ucEID) { - case EVENT_ID_CMD_RESULT: - prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum); - - if(prCmdInfo != NULL) { - P_EVENT_CMD_RESULT prCmdResult; - prCmdResult = (P_EVENT_CMD_RESULT) ((PUINT_8)prEvent + EVENT_HDR_SIZE); - - /* CMD_RESULT should be only in response to Set commands */ - ASSERT(prCmdInfo->fgSetQuery == FALSE || prCmdInfo->fgNeedResp == TRUE); - - if(prCmdResult->ucStatus == 0) { // success - if(prCmdInfo->pfCmdDoneHandler) { - prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo, prEvent->aucBuffer); - } - else if(prCmdInfo->fgIsOid == TRUE) { - kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0, WLAN_STATUS_SUCCESS); - } - } - else if(prCmdResult->ucStatus == 1) { // reject - if(prCmdInfo->fgIsOid == TRUE) - kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0, WLAN_STATUS_FAILURE); - } - else if(prCmdResult->ucStatus == 2) { // unknown CMD - if(prCmdInfo->fgIsOid == TRUE) - kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0, WLAN_STATUS_NOT_SUPPORTED); - } - - // return prCmdInfo - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - } - - break; - -#if 0 - case EVENT_ID_CONNECTION_STATUS: - /* OBSELETE */ - { - P_EVENT_CONNECTION_STATUS prConnectionStatus; - prConnectionStatus = (P_EVENT_CONNECTION_STATUS) (prEvent->aucBuffer); - - DbgPrint("RX EVENT: EVENT_ID_CONNECTION_STATUS = %d\n", prConnectionStatus->ucMediaStatus); - if (prConnectionStatus->ucMediaStatus == PARAM_MEDIA_STATE_DISCONNECTED) { // disconnected - if(kalGetMediaStateIndicated(prGlueInfo) != PARAM_MEDIA_STATE_DISCONNECTED) { - - kalIndicateStatusAndComplete(prGlueInfo, - WLAN_STATUS_MEDIA_DISCONNECT, - NULL, - 0); - - prAdapter->rWlanInfo.u4SysTime = kalGetTimeTick(); - } - } - else if(prConnectionStatus->ucMediaStatus == PARAM_MEDIA_STATE_CONNECTED) { // connected - prAdapter->rWlanInfo.u4SysTime = kalGetTimeTick(); - - // fill information for association result - prAdapter->rWlanInfo.rCurrBssId.rSsid.u4SsidLen - = prConnectionStatus->ucSsidLen; - kalMemCopy(prAdapter->rWlanInfo.rCurrBssId.rSsid.aucSsid, - prConnectionStatus->aucSsid, - prConnectionStatus->ucSsidLen); - - kalMemCopy(prAdapter->rWlanInfo.rCurrBssId.arMacAddress, - prConnectionStatus->aucBssid, - MAC_ADDR_LEN); - - prAdapter->rWlanInfo.rCurrBssId.u4Privacy - = prConnectionStatus->ucEncryptStatus; // @FIXME - prAdapter->rWlanInfo.rCurrBssId.rRssi - = 0; //@FIXME - prAdapter->rWlanInfo.rCurrBssId.eNetworkTypeInUse - = PARAM_NETWORK_TYPE_AUTOMODE; //@FIXME - prAdapter->rWlanInfo.rCurrBssId.rConfiguration.u4BeaconPeriod - = prConnectionStatus->u2BeaconPeriod; - prAdapter->rWlanInfo.rCurrBssId.rConfiguration.u4ATIMWindow - = prConnectionStatus->u2ATIMWindow; - prAdapter->rWlanInfo.rCurrBssId.rConfiguration.u4DSConfig - = prConnectionStatus->u4FreqInKHz; - prAdapter->rWlanInfo.ucNetworkType - = prConnectionStatus->ucNetworkType; - - switch(prConnectionStatus->ucInfraMode) { - case 0: - prAdapter->rWlanInfo.rCurrBssId.eOpMode = NET_TYPE_IBSS; - break; - case 1: - prAdapter->rWlanInfo.rCurrBssId.eOpMode = NET_TYPE_INFRA; - break; - case 2: - default: - prAdapter->rWlanInfo.rCurrBssId.eOpMode = NET_TYPE_AUTO_SWITCH; - break; - } - // always indicate to OS according to MSDN (re-association/roaming) - kalIndicateStatusAndComplete(prGlueInfo, - WLAN_STATUS_MEDIA_CONNECT, - NULL, - 0); - } - } - break; - - case EVENT_ID_SCAN_RESULT: - /* OBSELETE */ - break; -#endif - - case EVENT_ID_RX_ADDBA: - /* The FW indicates that an RX BA agreement will be established */ - qmHandleEventRxAddBa(prAdapter, prEvent); - break; - - case EVENT_ID_RX_DELBA: - /* The FW indicates that an RX BA agreement has been deleted */ - qmHandleEventRxDelBa(prAdapter, prEvent); - break; - - case EVENT_ID_LINK_QUALITY: -#if CFG_ENABLE_WIFI_DIRECT && CFG_SUPPORT_P2P_RSSI_QUERY - if (prEvent->u2PacketLen == EVENT_HDR_SIZE + sizeof(EVENT_LINK_QUALITY_EX)) { - P_EVENT_LINK_QUALITY_EX prLqEx = (P_EVENT_LINK_QUALITY_EX)(prEvent->aucBuffer); - - if (prLqEx->ucIsLQ0Rdy) { - nicUpdateLinkQuality(prAdapter, NETWORK_TYPE_AIS_INDEX, (P_EVENT_LINK_QUALITY)prLqEx); - } - if (prLqEx->ucIsLQ1Rdy) { - nicUpdateLinkQuality(prAdapter, NETWORK_TYPE_P2P_INDEX, (P_EVENT_LINK_QUALITY)prLqEx); - } - } - else { - /* For old FW, P2P may invoke link quality query, and make driver flag becone TRUE. */ - DBGLOG(P2P, WARN, ("Old FW version, not support P2P RSSI query.\n")); - - /* Must not use NETWORK_TYPE_P2P_INDEX, cause the structure is mismatch. */ - nicUpdateLinkQuality(prAdapter, NETWORK_TYPE_AIS_INDEX, (P_EVENT_LINK_QUALITY)(prEvent->aucBuffer)); - } -#else - nicUpdateLinkQuality(prAdapter, NETWORK_TYPE_AIS_INDEX, (P_EVENT_LINK_QUALITY)(prEvent->aucBuffer)); -#endif - - /* command response handling */ - prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum); - - if(prCmdInfo != NULL) { - if (prCmdInfo->pfCmdDoneHandler) { - prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo, prEvent->aucBuffer); - } - else if(prCmdInfo->fgIsOid) { - kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0, WLAN_STATUS_SUCCESS); - } - - // return prCmdInfo - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - } - - #ifndef LINUX - if(prAdapter->rWlanInfo.eRssiTriggerType == ENUM_RSSI_TRIGGER_GREATER && - prAdapter->rWlanInfo.rRssiTriggerValue >= (PARAM_RSSI)(prAdapter->rLinkQuality.cRssi)) { - prAdapter->rWlanInfo.eRssiTriggerType = ENUM_RSSI_TRIGGER_TRIGGERED; - - kalIndicateStatusAndComplete(prGlueInfo, - WLAN_STATUS_MEDIA_SPECIFIC_INDICATION, - (PVOID) &(prAdapter->rWlanInfo.rRssiTriggerValue), sizeof(PARAM_RSSI)); - } - else if(prAdapter->rWlanInfo.eRssiTriggerType == ENUM_RSSI_TRIGGER_LESS && - prAdapter->rWlanInfo.rRssiTriggerValue <= (PARAM_RSSI)(prAdapter->rLinkQuality.cRssi)) { - prAdapter->rWlanInfo.eRssiTriggerType = ENUM_RSSI_TRIGGER_TRIGGERED; - - kalIndicateStatusAndComplete(prGlueInfo, - WLAN_STATUS_MEDIA_SPECIFIC_INDICATION, - (PVOID) &(prAdapter->rWlanInfo.rRssiTriggerValue), sizeof(PARAM_RSSI)); - } - #endif - - break; - - case EVENT_ID_MIC_ERR_INFO: - { - P_EVENT_MIC_ERR_INFO prMicError; - //P_PARAM_AUTH_EVENT_T prAuthEvent; - P_STA_RECORD_T prStaRec; - - DBGLOG(RSN, EVENT, ("EVENT_ID_MIC_ERR_INFO\n")); - - prMicError = (P_EVENT_MIC_ERR_INFO)(prEvent->aucBuffer); - prStaRec = cnmGetStaRecByAddress(prAdapter, - (UINT_8) NETWORK_TYPE_AIS_INDEX, - prAdapter->rWlanInfo.rCurrBssId.arMacAddress); - ASSERT(prStaRec); - - if (prStaRec) { - rsnTkipHandleMICFailure(prAdapter, prStaRec, (BOOLEAN)prMicError->u4Flags); - } - else { - DBGLOG(RSN, INFO, ("No STA rec!!\n")); - } -#if 0 - prAuthEvent = (P_PARAM_AUTH_EVENT_T)prAdapter->aucIndicationEventBuffer; - - /* Status type: Authentication Event */ - prAuthEvent->rStatus.eStatusType = ENUM_STATUS_TYPE_AUTHENTICATION; - - /* Authentication request */ - prAuthEvent->arRequest[0].u4Length = sizeof(PARAM_AUTH_REQUEST_T); - kalMemCopy((PVOID)prAuthEvent->arRequest[0].arBssid, - (PVOID)prAdapter->rWlanInfo.rCurrBssId.arMacAddress, /* whsu:Todo? */ - PARAM_MAC_ADDR_LEN); - - if (prMicError->u4Flags != 0) { - prAuthEvent->arRequest[0].u4Flags = PARAM_AUTH_REQUEST_GROUP_ERROR; - } - else { - prAuthEvent->arRequest[0].u4Flags = PARAM_AUTH_REQUEST_PAIRWISE_ERROR; - } - - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_SPECIFIC_INDICATION, - (PVOID)prAuthEvent, - sizeof(PARAM_STATUS_INDICATION_T) + sizeof(PARAM_AUTH_REQUEST_T)); -#endif - } - break; - - case EVENT_ID_ASSOC_INFO: - { - P_EVENT_ASSOC_INFO prAssocInfo; - prAssocInfo = (P_EVENT_ASSOC_INFO)(prEvent->aucBuffer); - - kalHandleAssocInfo(prAdapter->prGlueInfo, prAssocInfo); - } - break; - - case EVENT_ID_802_11_PMKID: - { - P_PARAM_AUTH_EVENT_T prAuthEvent; - PUINT_8 cp; - UINT_32 u4LenOfUsedBuffer; - - prAuthEvent = (P_PARAM_AUTH_EVENT_T)prAdapter->aucIndicationEventBuffer; - - prAuthEvent->rStatus.eStatusType = ENUM_STATUS_TYPE_CANDIDATE_LIST; - - u4LenOfUsedBuffer = (UINT_32)(prEvent->u2PacketLen - 8); - - prAuthEvent->arRequest[0].u4Length = u4LenOfUsedBuffer; - - cp = (PUINT_8)&prAuthEvent->arRequest[0]; - - /* Status type: PMKID Candidatelist Event */ - kalMemCopy(cp, (P_EVENT_PMKID_CANDIDATE_LIST_T)(prEvent->aucBuffer), prEvent->u2PacketLen - 8); - - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_MEDIA_SPECIFIC_INDICATION, - (PVOID)prAuthEvent, - sizeof(PARAM_STATUS_INDICATION_T) + u4LenOfUsedBuffer); - } - break; - -#if 0 - case EVENT_ID_ACTIVATE_STA_REC_T: - { - P_EVENT_ACTIVATE_STA_REC_T prActivateStaRec; - prActivateStaRec = (P_EVENT_ACTIVATE_STA_REC_T)(prEvent->aucBuffer); - - DbgPrint("RX EVENT: EVENT_ID_ACTIVATE_STA_REC_T Index:%d, MAC:["MACSTR"]\n", - prActivateStaRec->ucStaRecIdx, - MAC2STR(prActivateStaRec->aucMacAddr)); - - qmActivateStaRec(prAdapter, - (UINT_32)prActivateStaRec->ucStaRecIdx, - ((prActivateStaRec->fgIsQoS) ? TRUE: FALSE), - prActivateStaRec->ucNetworkTypeIndex, - ((prActivateStaRec->fgIsAP) ? TRUE: FALSE), - prActivateStaRec->aucMacAddr); - - } - break; - - case EVENT_ID_DEACTIVATE_STA_REC_T: - { - P_EVENT_DEACTIVATE_STA_REC_T prDeactivateStaRec; - prDeactivateStaRec = (P_EVENT_DEACTIVATE_STA_REC_T)(prEvent->aucBuffer); - - DbgPrint("RX EVENT: EVENT_ID_DEACTIVATE_STA_REC_T Index:%d, MAC:["MACSTR"]\n", - prDeactivateStaRec->ucStaRecIdx); - - qmDeactivateStaRec(prAdapter, - prDeactivateStaRec->ucStaRecIdx); - } - break; -#endif - - case EVENT_ID_SCAN_DONE: - scnEventScanDone(prAdapter, (P_EVENT_SCAN_DONE)(prEvent->aucBuffer)); - break; - - case EVENT_ID_TX_DONE: - { - P_EVENT_TX_DONE_T prTxDone; - prTxDone = (P_EVENT_TX_DONE_T)(prEvent->aucBuffer); - - DBGLOG(INIT, TRACE,("EVENT_ID_TX_DONE PacketSeq:%u ucStatus: %u SN: %u\n", - prTxDone->ucPacketSeq, prTxDone->ucStatus, prTxDone->u2SequenceNumber)); - - /* call related TX Done Handler */ - prMsduInfo = nicGetPendingTxMsduInfo(prAdapter, prTxDone->ucPacketSeq); - -#if CFG_SUPPORT_802_11V_TIMING_MEASUREMENT - DBGLOG(INIT, TRACE, ("EVENT_ID_TX_DONE u4TimeStamp = %x u2AirDelay = %x\n", - prTxDone->au4Reserved1, prTxDone->au4Reserved2)); - - wnmReportTimingMeas(prAdapter, prMsduInfo->ucStaRecIndex, - prTxDone->au4Reserved1, prTxDone->au4Reserved1 + prTxDone->au4Reserved2); -#endif - - if(prMsduInfo) { - prMsduInfo->pfTxDoneHandler(prAdapter, prMsduInfo, (ENUM_TX_RESULT_CODE_T)(prTxDone->ucStatus)); - - cnmMgtPktFree(prAdapter, prMsduInfo); - } - } - break; - - case EVENT_ID_SLEEPY_NOTIFY: - { - P_EVENT_SLEEPY_NOTIFY prEventSleepyNotify; - prEventSleepyNotify = (P_EVENT_SLEEPY_NOTIFY)(prEvent->aucBuffer); - - //DBGLOG(RX, INFO, ("ucSleepyState = %d\n", prEventSleepyNotify->ucSleepyState)); - - prAdapter->fgWiFiInSleepyState = (BOOLEAN)(prEventSleepyNotify->ucSleepyState); - } - break; - case EVENT_ID_BT_OVER_WIFI: -#if CFG_ENABLE_BT_OVER_WIFI - { - UINT_8 aucTmp[sizeof(AMPC_EVENT) + sizeof(BOW_LINK_DISCONNECTED)]; - P_EVENT_BT_OVER_WIFI prEventBtOverWifi; - P_AMPC_EVENT prBowEvent; - P_BOW_LINK_CONNECTED prBowLinkConnected; - P_BOW_LINK_DISCONNECTED prBowLinkDisconnected; - - prEventBtOverWifi = (P_EVENT_BT_OVER_WIFI)(prEvent->aucBuffer); - - // construct event header - prBowEvent = (P_AMPC_EVENT)aucTmp; - - if(prEventBtOverWifi->ucLinkStatus == 0) { - // Connection - prBowEvent->rHeader.ucEventId = BOW_EVENT_ID_LINK_CONNECTED; - prBowEvent->rHeader.ucSeqNumber = 0; - prBowEvent->rHeader.u2PayloadLength = sizeof(BOW_LINK_CONNECTED); - - // fill event body - prBowLinkConnected = (P_BOW_LINK_CONNECTED)(prBowEvent->aucPayload); - prBowLinkConnected->rChannel.ucChannelNum = prEventBtOverWifi->ucSelectedChannel; - kalMemZero(prBowLinkConnected->aucPeerAddress, MAC_ADDR_LEN); //@FIXME - - kalIndicateBOWEvent(prAdapter->prGlueInfo, prBowEvent); - } - else { - // Disconnection - prBowEvent->rHeader.ucEventId = BOW_EVENT_ID_LINK_DISCONNECTED; - prBowEvent->rHeader.ucSeqNumber = 0; - prBowEvent->rHeader.u2PayloadLength = sizeof(BOW_LINK_DISCONNECTED); - - // fill event body - prBowLinkDisconnected = (P_BOW_LINK_DISCONNECTED)(prBowEvent->aucPayload); - prBowLinkDisconnected->ucReason = 0; //@FIXME - kalMemZero(prBowLinkDisconnected->aucPeerAddress, MAC_ADDR_LEN); //@FIXME - - kalIndicateBOWEvent(prAdapter->prGlueInfo, prBowEvent); - } - } - break; -#endif - case EVENT_ID_STATISTICS: - /* buffer statistics for further query */ - prAdapter->fgIsStatValid = TRUE; - prAdapter->rStatUpdateTime = kalGetTimeTick(); - kalMemCopy(&prAdapter->rStatStruct, prEvent->aucBuffer, sizeof(EVENT_STATISTICS)); - - /* command response handling */ - prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum); - - if(prCmdInfo != NULL) { - if (prCmdInfo->pfCmdDoneHandler) { - prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo, prEvent->aucBuffer); - } - else if(prCmdInfo->fgIsOid) { - kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0, WLAN_STATUS_SUCCESS); - } - - // return prCmdInfo - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - } - - break; - - case EVENT_ID_CH_PRIVILEGE: - cnmChMngrHandleChEvent(prAdapter, prEvent); - break; - - case EVENT_ID_BSS_ABSENCE_PRESENCE: - qmHandleEventBssAbsencePresence(prAdapter, prEvent); - break; - - case EVENT_ID_STA_CHANGE_PS_MODE: - qmHandleEventStaChangePsMode(prAdapter, prEvent); - break; -#if CFG_ENABLE_WIFI_DIRECT - case EVENT_ID_STA_UPDATE_FREE_QUOTA: - qmHandleEventStaUpdateFreeQuota(prAdapter, prEvent); - break; -#endif - case EVENT_ID_BSS_BEACON_TIMEOUT: - DBGLOG(INIT, INFO,("EVENT_ID_BSS_BEACON_TIMEOUT\n")); - - if (prAdapter->fgDisBcnLostDetection == FALSE) { - P_EVENT_BSS_BEACON_TIMEOUT_T prEventBssBeaconTimeout; - prEventBssBeaconTimeout = (P_EVENT_BSS_BEACON_TIMEOUT_T)(prEvent->aucBuffer); - - if(prEventBssBeaconTimeout->ucNetTypeIndex == NETWORK_TYPE_AIS_INDEX) { - aisBssBeaconTimeout(prAdapter); - } -#if CFG_ENABLE_WIFI_DIRECT - else if((prAdapter->fgIsP2PRegistered) && - (prEventBssBeaconTimeout->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX)) { - - p2pFsmRunEventBeaconTimeout(prAdapter); - } -#endif -#if CFG_ENABLE_BT_OVER_WIFI - else if(prEventBssBeaconTimeout->ucNetTypeIndex == NETWORK_TYPE_BOW_INDEX) { - } -#endif - else { - DBGLOG(RX, ERROR, ("EVENT_ID_BSS_BEACON_TIMEOUT: (ucNetTypeIdx = %d)\n", - prEventBssBeaconTimeout->ucNetTypeIndex)); - } - } - - break; - case EVENT_ID_UPDATE_NOA_PARAMS: -#if CFG_ENABLE_WIFI_DIRECT - if(prAdapter->fgIsP2PRegistered){ - P_EVENT_UPDATE_NOA_PARAMS_T prEventUpdateNoaParam; - prEventUpdateNoaParam = (P_EVENT_UPDATE_NOA_PARAMS_T)(prEvent->aucBuffer); - - if (prEventUpdateNoaParam->ucNetTypeIndex == NETWORK_TYPE_P2P_INDEX) { - p2pProcessEvent_UpdateNOAParam(prAdapter, - prEventUpdateNoaParam->ucNetTypeIndex, - prEventUpdateNoaParam); - } else { - ASSERT(0); - } - } -#else - ASSERT(0); -#endif - break; - - case EVENT_ID_STA_AGING_TIMEOUT: -#if CFG_ENABLE_WIFI_DIRECT - { - if (prAdapter->fgDisStaAgingTimeoutDetection == FALSE) { - P_EVENT_STA_AGING_TIMEOUT_T prEventStaAgingTimeout; - P_STA_RECORD_T prStaRec; - P_BSS_INFO_T prBssInfo = (P_BSS_INFO_T)NULL; - - prEventStaAgingTimeout = (P_EVENT_STA_AGING_TIMEOUT_T)(prEvent->aucBuffer); - prStaRec = cnmGetStaRecByIndex(prAdapter, prEventStaAgingTimeout->ucStaRecIdx); - if (prStaRec == NULL) { - break; - } - - DBGLOG(INIT, INFO,("EVENT_ID_STA_AGING_TIMEOUT %u " MACSTR "\n", - prEventStaAgingTimeout->ucStaRecIdx, MAC2STR(prStaRec->aucMacAddr))); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - - bssRemoveStaRecFromClientList(prAdapter, prBssInfo, prStaRec); - - /* Call False Auth */ - if (prAdapter->fgIsP2PRegistered) { - p2pFuncDisconnect(prAdapter, prStaRec, TRUE, REASON_CODE_DISASSOC_INACTIVITY); - } - - - } /* gDisStaAgingTimeoutDetection */ - - } -#endif - break; - - case EVENT_ID_AP_OBSS_STATUS: -#if CFG_ENABLE_WIFI_DIRECT - if(prAdapter->fgIsP2PRegistered){ - rlmHandleObssStatusEventPkt(prAdapter, (P_EVENT_AP_OBSS_STATUS_T) prEvent->aucBuffer); - } -#endif - break; - - case EVENT_ID_ROAMING_STATUS: -#if CFG_SUPPORT_ROAMING - { - P_ROAMING_PARAM_T prParam; - - prParam = (P_ROAMING_PARAM_T)(prEvent->aucBuffer); - roamingFsmProcessEvent(prAdapter, prParam); - } -#endif /* CFG_SUPPORT_ROAMING */ - break; - case EVENT_ID_SEND_DEAUTH: -#if DBG - { - P_WLAN_MAC_HEADER_T prWlanMacHeader; - - prWlanMacHeader = (P_WLAN_MAC_HEADER_T)&prEvent->aucBuffer[0]; - DBGLOG(RX, INFO, ("nicRx: aucAddr1: "MACSTR"\n", MAC2STR(prWlanMacHeader->aucAddr1))); - DBGLOG(RX, INFO, ("nicRx: aucAddr2: "MACSTR"\n", MAC2STR(prWlanMacHeader->aucAddr2))); - } -#endif - /* receive packets without StaRec */ - prSwRfb->pvHeader = (P_WLAN_MAC_HEADER_T)&prEvent->aucBuffer[0]; - if (WLAN_STATUS_SUCCESS == authSendDeauthFrame(prAdapter, - NULL, - prSwRfb, - REASON_CODE_CLASS_3_ERR, - (PFN_TX_DONE_HANDLER)NULL)) { - DBGLOG(RX, INFO, ("Send Deauth Error\n")); - } - break; - -#if CFG_SUPPORT_RDD_TEST_MODE - case EVENT_ID_UPDATE_RDD_STATUS: - { - P_EVENT_RDD_STATUS_T prEventRddStatus; - - prEventRddStatus = (P_EVENT_RDD_STATUS_T) (prEvent->aucBuffer); - - prAdapter->ucRddStatus = prEventRddStatus->ucRddStatus; - } - - break; -#endif - -#if CFG_SUPPORT_BCM && CFG_SUPPORT_BCM_BWCS - case EVENT_ID_UPDATE_BWCS_STATUS: - { - P_PTA_IPC_T prEventBwcsStatus; - - prEventBwcsStatus = (P_PTA_IPC_T) (prEvent->aucBuffer); - -#if CFG_SUPPORT_BCM_BWCS_DEBUG - printk(KERN_INFO DRV_NAME "BCM BWCS Event: %02x%02x%02x%02x\n", prEventBwcsStatus->u.aucBTPParams[0], - prEventBwcsStatus->u.aucBTPParams[1], - prEventBwcsStatus->u.aucBTPParams[2], - prEventBwcsStatus->u.aucBTPParams[3]); - - printk(KERN_INFO DRV_NAME "BCM BWCS Event: aucBTPParams[0] = %02x, aucBTPParams[1] = %02x, aucBTPParams[2] = %02x, aucBTPParams[3] = %02x\n", - prEventBwcsStatus->u.aucBTPParams[0], - prEventBwcsStatus->u.aucBTPParams[1], - prEventBwcsStatus->u.aucBTPParams[2], - prEventBwcsStatus->u.aucBTPParams[3]); -#endif - - kalIndicateStatusAndComplete(prAdapter->prGlueInfo, - WLAN_STATUS_BWCS_UPDATE, - (PVOID) prEventBwcsStatus, - sizeof(PTA_IPC_T)); - } - - break; - - case EVENT_ID_UPDATE_BCM_DEBUG: - { - P_PTA_IPC_T prEventBwcsStatus; - - prEventBwcsStatus = (P_PTA_IPC_T) (prEvent->aucBuffer); - -#if CFG_SUPPORT_BCM_BWCS_DEBUG - printk(KERN_INFO DRV_NAME "BCM FW status: %02x%02x%02x%02x\n", prEventBwcsStatus->u.aucBTPParams[0], - prEventBwcsStatus->u.aucBTPParams[1], - prEventBwcsStatus->u.aucBTPParams[2], - prEventBwcsStatus->u.aucBTPParams[3]); - - printk(KERN_INFO DRV_NAME "BCM FW status: aucBTPParams[0] = %02x, aucBTPParams[1] = %02x, aucBTPParams[2] = %02x, aucBTPParams[3] = %02x\n", - prEventBwcsStatus->u.aucBTPParams[0], - prEventBwcsStatus->u.aucBTPParams[1], - prEventBwcsStatus->u.aucBTPParams[2], - prEventBwcsStatus->u.aucBTPParams[3]); -#endif - } - - break; -#endif - - case EVENT_ID_ACCESS_REG: - case EVENT_ID_NIC_CAPABILITY: - case EVENT_ID_BASIC_CONFIG: - case EVENT_ID_MAC_MCAST_ADDR: - case EVENT_ID_ACCESS_EEPROM: - case EVENT_ID_TEST_STATUS: - default: - prCmdInfo = nicGetPendingCmdInfo(prAdapter, prEvent->ucSeqNum); - - if(prCmdInfo != NULL) { - if (prCmdInfo->pfCmdDoneHandler) { - prCmdInfo->pfCmdDoneHandler(prAdapter, prCmdInfo, prEvent->aucBuffer); - } - else if(prCmdInfo->fgIsOid) { - kalOidComplete(prAdapter->prGlueInfo, prCmdInfo->fgSetQuery, 0, WLAN_STATUS_SUCCESS); - } - - // return prCmdInfo - cmdBufFreeCmdInfo(prAdapter, prCmdInfo); - } - - break; - } - - nicRxReturnRFB(prAdapter, prSwRfb); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief nicRxProcessMgmtPacket is used to dispatch management frames -* to corresponding modules -* -* @param prAdapter Pointer to the Adapter structure. -* @param prSWRfb the RFB to receive rx data -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxProcessMgmtPacket ( - IN P_ADAPTER_T prAdapter, - IN OUT P_SW_RFB_T prSwRfb - ) -{ - UINT_8 ucSubtype; -#if CFG_SUPPORT_802_11W - BOOL fgMfgDrop = FALSE; -#endif - ASSERT(prAdapter); - ASSERT(prSwRfb); - - nicRxFillRFB(prAdapter, prSwRfb); - - ucSubtype = (*(PUINT_8)(prSwRfb->pvHeader) & MASK_FC_SUBTYPE )>> OFFSET_OF_FC_SUBTYPE; - -#if CFG_RX_PKTS_DUMP - { - P_HIF_RX_HEADER_T prHifRxHdr; - UINT_16 u2TxFrameCtrl; - - prHifRxHdr = prSwRfb->prHifRxHdr; - u2TxFrameCtrl = (*(PUINT_8)(prSwRfb->pvHeader) & MASK_FRAME_TYPE); - if (prAdapter->rRxCtrl.u4RxPktsDumpTypeMask & BIT(HIF_RX_PKT_TYPE_MANAGEMENT)) { - if (u2TxFrameCtrl == MAC_FRAME_BEACON || - u2TxFrameCtrl == MAC_FRAME_PROBE_RSP) { - - DBGLOG(SW4, INFO, ("QM RX MGT: net %u sta idx %u wlan idx %u ssn %u ptype %u subtype %u 11 %u\n", - HIF_RX_HDR_GET_NETWORK_IDX(prHifRxHdr), - prHifRxHdr->ucStaRecIdx, - prSwRfb->ucWlanIdx, - HIF_RX_HDR_GET_SN(prHifRxHdr), /* The new SN of the frame */ - prSwRfb->ucPacketType, - ucSubtype, - HIF_RX_HDR_GET_80211_FLAG(prHifRxHdr))); - - DBGLOG_MEM8(SW4, TRACE, (PUINT_8)prSwRfb->pvHeader, prSwRfb->u2PacketLen); - } - } - } -#endif - - if(prAdapter->fgTestMode == FALSE) { -#if CFG_MGMT_FRAME_HANDLING -#if CFG_SUPPORT_802_11W - fgMfgDrop = rsnCheckRxMgmt(prAdapter, prSwRfb, ucSubtype); - if (fgMfgDrop) { - #if DBG - LOG_FUNC("QM RX MGT: Drop Unprotected Mgmt frame!!!\n"); - #endif - nicRxReturnRFB(prAdapter, prSwRfb); - RX_INC_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT); - return; - } - else -#endif - if(apfnProcessRxMgtFrame[ucSubtype]) { - switch(apfnProcessRxMgtFrame[ucSubtype](prAdapter, prSwRfb)){ - case WLAN_STATUS_PENDING: - return; - case WLAN_STATUS_SUCCESS: - case WLAN_STATUS_FAILURE: - break; - - default: - DBGLOG(RX, WARN, ("Unexpected MMPDU(0x%02X) returned with abnormal status\n", ucSubtype)); - break; - } - } -#endif - } - - nicRxReturnRFB(prAdapter, prSwRfb); -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief nicProcessRFBs is used to process RFBs in the rReceivedRFBList queue. -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxProcessRFBs ( - IN P_ADAPTER_T prAdapter - ) -{ - P_RX_CTRL_T prRxCtrl; - P_SW_RFB_T prSwRfb = (P_SW_RFB_T)NULL; - KAL_SPIN_LOCK_DECLARATION(); - - DEBUGFUNC("nicRxProcessRFBs"); - - ASSERT(prAdapter); - - prRxCtrl = &prAdapter->rRxCtrl; - ASSERT(prRxCtrl); - - prRxCtrl->ucNumIndPacket = 0; - prRxCtrl->ucNumRetainedPacket = 0; - - do { - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - QUEUE_REMOVE_HEAD(&prRxCtrl->rReceivedRfbList, prSwRfb, P_SW_RFB_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - - if (prSwRfb){ - switch(prSwRfb->ucPacketType){ - case HIF_RX_PKT_TYPE_DATA: - nicRxProcessDataPacket(prAdapter, prSwRfb); - break; - - case HIF_RX_PKT_TYPE_EVENT: - nicRxProcessEventPacket(prAdapter, prSwRfb); - break; - - case HIF_RX_PKT_TYPE_TX_LOOPBACK: - DBGLOG(RX, ERROR, ("ucPacketType = %d\n", prSwRfb->ucPacketType)); - break; - - case HIF_RX_PKT_TYPE_MANAGEMENT: - nicRxProcessMgmtPacket(prAdapter, prSwRfb); - break; - - default: - RX_INC_CNT(prRxCtrl, RX_TYPE_ERR_DROP_COUNT); - RX_INC_CNT(prRxCtrl, RX_DROP_TOTAL_COUNT); - DBGLOG(RX, ERROR, ("ucPacketType = %d\n", prSwRfb->ucPacketType)); - break; - } - } - else { - break; - } - }while(TRUE); - - if (prRxCtrl->ucNumIndPacket > 0) { - RX_ADD_CNT(prRxCtrl, RX_DATA_INDICATION_COUNT, prRxCtrl->ucNumIndPacket); - RX_ADD_CNT(prRxCtrl, RX_DATA_RETAINED_COUNT, prRxCtrl->ucNumRetainedPacket); - - //DBGLOG(RX, INFO, ("%d packets indicated, Retained cnt = %d\n", - // prRxCtrl->ucNumIndPacket, prRxCtrl->ucNumRetainedPacket)); - #if CFG_NATIVE_802_11 - kalRxIndicatePkts(prAdapter->prGlueInfo, (UINT_32)prRxCtrl->ucNumIndPacket, (UINT_32)prRxCtrl->ucNumRetainedPacket); - #else - kalRxIndicatePkts(prAdapter->prGlueInfo, prRxCtrl->apvIndPacket, (UINT_32)prRxCtrl->ucNumIndPacket); - #endif - } - -} /* end of nicRxProcessRFBs() */ - - -#if !CFG_SDIO_INTR_ENHANCE -/*----------------------------------------------------------------------------*/ -/*! -* @brief Read the rx data from data port and setup RFB -* -* @param prAdapter pointer to the Adapter handler -* @param prSWRfb the RFB to receive rx data -* -* @retval WLAN_STATUS_SUCCESS: SUCCESS -* @retval WLAN_STATUS_FAILURE: FAILURE -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicRxReadBuffer ( - IN P_ADAPTER_T prAdapter, - IN OUT P_SW_RFB_T prSwRfb - ) -{ - P_RX_CTRL_T prRxCtrl; - PUINT_8 pucBuf; - P_HIF_RX_HEADER_T prHifRxHdr; - UINT_32 u4PktLen = 0, u4ReadBytes; - WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS; - BOOL fgResult = TRUE; - UINT_32 u4RegValue; - UINT_32 rxNum; - - DEBUGFUNC("nicRxReadBuffer"); - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - prRxCtrl = &prAdapter->rRxCtrl; - ASSERT(prRxCtrl); - - pucBuf = prSwRfb->pucRecvBuff; - prHifRxHdr = prSwRfb->prHifRxHdr; - ASSERT(pucBuf); - DBGLOG(RX, TRACE, ("pucBuf= 0x%x, prHifRxHdr= 0x%x\n", pucBuf, prHifRxHdr)); - - do { - /* Read the RFB DW length and packet length */ - HAL_MCR_RD(prAdapter, MCR_WRPLR, &u4RegValue); - if (!fgResult) { - DBGLOG(RX, ERROR, ("Read RX Packet Lentgh Error\n")); - return WLAN_STATUS_FAILURE; - } - - //20091021 move the line to get the HIF RX header (for RX0/1) - if(u4RegValue == 0) { - DBGLOG(RX, ERROR, ("No RX packet\n")); - return WLAN_STATUS_FAILURE; - } - - u4PktLen = u4RegValue & BITS(0, 15); - if(u4PktLen != 0) { - rxNum = 0; - } - else { - rxNum = 1; - u4PktLen = (u4RegValue & BITS(16, 31)) >> 16; - } - - DBGLOG(RX, TRACE, ("RX%d: u4PktLen = %d\n", rxNum, u4PktLen)); - - //4 <4> Read Entire RFB and packet, include HW appended DW (Checksum Status) - u4ReadBytes = ALIGN_4(u4PktLen) + 4; - HAL_READ_RX_PORT(prAdapter, rxNum, u4ReadBytes, pucBuf, CFG_RX_MAX_PKT_SIZE); - - //20091021 move the line to get the HIF RX header - //u4PktLen = (UINT_32)prHifRxHdr->u2PacketLen; - if (u4PktLen != (UINT_32)prHifRxHdr->u2PacketLen) { - DBGLOG(RX, ERROR, ("Read u4PktLen = %d, prHifRxHdr->u2PacketLen: %d\n", - u4PktLen, prHifRxHdr->u2PacketLen)); - #if DBG - dumpMemory8((PUINT_8)prHifRxHdr, (prHifRxHdr->u2PacketLen > 4096) ? 4096 : prHifRxHdr->u2PacketLen); - #endif - ASSERT(0); - } - /* u4PktLen is byte unit, not inlude HW appended DW */ - - prSwRfb->ucPacketType = (UINT_8)(prHifRxHdr->u2PacketType & HIF_RX_HDR_PACKET_TYPE_MASK); - DBGLOG(RX, TRACE, ("ucPacketType = %d\n", prSwRfb->ucPacketType)); - - prSwRfb->ucStaRecIdx = (UINT_8)(prHifRxHdr->ucStaRecIdx); - - /* fgResult will be updated in MACRO */ - if (!fgResult) { - return WLAN_STATUS_FAILURE; - } - - DBGLOG(RX, TRACE, ("Dump RX buffer, length = 0x%x\n", u4ReadBytes)); - DBGLOG_MEM8(RX, TRACE, pucBuf, u4ReadBytes); - }while(FALSE); - - return u4Status; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Read frames from the data port, fill RFB -* and put each frame into the rReceivedRFBList queue. -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxReceiveRFBs ( - IN P_ADAPTER_T prAdapter - ) -{ - P_RX_CTRL_T prRxCtrl; - P_SW_RFB_T prSwRfb = (P_SW_RFB_T)NULL; - P_HIF_RX_HEADER_T prHifRxHdr; - - UINT_32 u4HwAppendDW; - - KAL_SPIN_LOCK_DECLARATION(); - - DEBUGFUNC("nicRxReceiveRFBs"); - - ASSERT(prAdapter); - - prRxCtrl = &prAdapter->rRxCtrl; - ASSERT(prRxCtrl); - - do { - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfb, P_SW_RFB_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - - if (!prSwRfb) { - DBGLOG(RX, TRACE, ("No More RFB\n")); - break; - } - - // need to consider - if (nicRxReadBuffer(prAdapter, prSwRfb) == WLAN_STATUS_FAILURE) { - DBGLOG(RX, TRACE, ("halRxFillRFB failed\n")); - nicRxReturnRFB(prAdapter, prSwRfb); - break; - } - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - QUEUE_INSERT_TAIL(&prRxCtrl->rReceivedRfbList, &prSwRfb->rQueEntry); - RX_INC_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - - prHifRxHdr = prSwRfb->prHifRxHdr; - u4HwAppendDW = *((PUINT_32)((UINT_32)prHifRxHdr + - (UINT_32)(ALIGN_4(prHifRxHdr->u2PacketLen)))); - DBGLOG(RX, TRACE, ("u4HwAppendDW = 0x%x\n", u4HwAppendDW)); - DBGLOG(RX, TRACE, ("u2PacketLen = 0x%x\n", prHifRxHdr->u2PacketLen)); - } -// while (RX_STATUS_TEST_MORE_FLAG(u4HwAppendDW)); - while (FALSE); - - return; - -} /* end of nicReceiveRFBs() */ - -#else -/*----------------------------------------------------------------------------*/ -/*! -* @brief Read frames from the data port, fill RFB -* and put each frame into the rReceivedRFBList queue. -* -* @param prAdapter Pointer to the Adapter structure. -* @param u4DataPort Specify which port to read -* @param u2RxLength Specify to the the rx packet length in Byte. -* @param prSwRfb the RFB to receive rx data. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ - -WLAN_STATUS -nicRxEnhanceReadBuffer ( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4DataPort, - IN UINT_16 u2RxLength, - IN OUT P_SW_RFB_T prSwRfb - ) -{ - P_RX_CTRL_T prRxCtrl; - PUINT_8 pucBuf; - P_HIF_RX_HEADER_T prHifRxHdr; - UINT_32 u4PktLen = 0; - WLAN_STATUS u4Status = WLAN_STATUS_FAILURE; - BOOL fgResult = TRUE; - - DEBUGFUNC("nicRxEnhanceReadBuffer"); - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - prRxCtrl = &prAdapter->rRxCtrl; - ASSERT(prRxCtrl); - - pucBuf = prSwRfb->pucRecvBuff; - ASSERT(pucBuf); - - prHifRxHdr = prSwRfb->prHifRxHdr; - ASSERT(prHifRxHdr); - - //DBGLOG(RX, TRACE, ("u2RxLength = %d\n", u2RxLength)); - - do { - //4 <1> Read RFB frame from MCR_WRDR0, include HW appended DW - HAL_READ_RX_PORT(prAdapter, - u4DataPort, - ALIGN_4(u2RxLength + HIF_RX_HW_APPENDED_LEN), - pucBuf, - CFG_RX_MAX_PKT_SIZE); - - if (!fgResult) { - DBGLOG(RX, ERROR, ("Read RX Packet Lentgh Error\n")); - break; - } - - u4PktLen = (UINT_32)(prHifRxHdr->u2PacketLen); - //DBGLOG(RX, TRACE, ("u4PktLen = %d\n", u4PktLen)); - - prSwRfb->ucPacketType = (UINT_8)(prHifRxHdr->u2PacketType & HIF_RX_HDR_PACKET_TYPE_MASK); - //DBGLOG(RX, TRACE, ("ucPacketType = %d\n", prSwRfb->ucPacketType)); - - prSwRfb->ucStaRecIdx = (UINT_8)(prHifRxHdr->ucStaRecIdx); - - //4 <2> if the RFB dw size or packet size is zero - if (u4PktLen == 0) { - DBGLOG(RX, ERROR, ("Packet Length = %d\n", u4PktLen)); - ASSERT(0); - break; - } - - //4 <3> if the packet is too large or too small - if (u4PktLen > CFG_RX_MAX_PKT_SIZE) { - DBGLOG(RX, TRACE, ("Read RX Packet Lentgh Error (%d)\n", u4PktLen)); - ASSERT(0); - break; - } - - u4Status = WLAN_STATUS_SUCCESS; - } - while (FALSE); - - DBGLOG_MEM8(RX, TRACE, pucBuf, ALIGN_4(u2RxLength + HIF_RX_HW_APPENDED_LEN)); - return u4Status; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Read frames from the data port for SDIO -* I/F, fill RFB and put each frame into the rReceivedRFBList queue. -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxSDIOReceiveRFBs ( - IN P_ADAPTER_T prAdapter - ) -{ - P_SDIO_CTRL_T prSDIOCtrl; - P_RX_CTRL_T prRxCtrl; - P_SW_RFB_T prSwRfb = (P_SW_RFB_T)NULL; - UINT_32 i, rxNum; - UINT_16 u2RxPktNum, u2RxLength = 0, u2Tmp = 0; - KAL_SPIN_LOCK_DECLARATION(); - - DEBUGFUNC("nicRxSDIOReceiveRFBs"); - - ASSERT(prAdapter); - - prSDIOCtrl = prAdapter->prSDIOCtrl; - ASSERT(prSDIOCtrl); - - prRxCtrl = &prAdapter->rRxCtrl; - ASSERT(prRxCtrl); - - for (rxNum = 0 ; rxNum < 2 ; rxNum++) { - u2RxPktNum = (rxNum == 0 ? prSDIOCtrl->rRxInfo.u.u2NumValidRx0Len : prSDIOCtrl->rRxInfo.u.u2NumValidRx1Len); - - if(u2RxPktNum == 0) { - continue; - } - - for (i = 0; i < u2RxPktNum; i++) { - if(rxNum == 0) { - HAL_READ_RX_LENGTH(prAdapter, &u2RxLength, &u2Tmp); - } - else if(rxNum == 1) { - HAL_READ_RX_LENGTH(prAdapter, &u2Tmp, &u2RxLength); - } - - if (!u2RxLength) { - break; - } - - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfb, P_SW_RFB_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - - if (!prSwRfb) { - DBGLOG(RX, TRACE, ("No More RFB\n")); - break; - } - ASSERT(prSwRfb); - - if (nicRxEnhanceReadBuffer(prAdapter, rxNum, u2RxLength, prSwRfb) == WLAN_STATUS_FAILURE) { - DBGLOG(RX, TRACE, ("nicRxEnhanceRxReadBuffer failed\n")); - nicRxReturnRFB(prAdapter, prSwRfb); - break; - } - - //prSDIOCtrl->au4RxLength[i] = 0; - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - QUEUE_INSERT_TAIL(&prRxCtrl->rReceivedRfbList, &prSwRfb->rQueEntry); - RX_INC_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - } - } - - prSDIOCtrl->rRxInfo.u.u2NumValidRx0Len = 0; - prSDIOCtrl->rRxInfo.u.u2NumValidRx1Len = 0; - - return; -}/* end of nicRxSDIOReceiveRFBs() */ - -#endif /* CFG_SDIO_INTR_ENHANCE */ - - - -#if CFG_SDIO_RX_AGG -/*----------------------------------------------------------------------------*/ -/*! -* @brief Read frames from the data port for SDIO with Rx aggregation enabled -* I/F, fill RFB and put each frame into the rReceivedRFBList queue. -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxSDIOAggReceiveRFBs ( - IN P_ADAPTER_T prAdapter - ) -{ - P_ENHANCE_MODE_DATA_STRUCT_T prEnhDataStr; - P_RX_CTRL_T prRxCtrl; - P_SDIO_CTRL_T prSDIOCtrl; - P_SW_RFB_T prSwRfb = (P_SW_RFB_T)NULL; - UINT_32 u4RxLength; - UINT_32 i, rxNum; - UINT_32 u4RxAggCount = 0, u4RxAggLength = 0; - UINT_32 u4RxAvailAggLen, u4CurrAvailFreeRfbCnt; - PUINT_8 pucSrcAddr; - P_HIF_RX_HEADER_T prHifRxHdr; - BOOL fgResult = TRUE; - BOOLEAN fgIsRxEnhanceMode; - UINT_16 u2RxPktNum; -#if CFG_SDIO_RX_ENHANCE - UINT_32 u4MaxLoopCount = CFG_MAX_RX_ENHANCE_LOOP_COUNT; -#endif - - KAL_SPIN_LOCK_DECLARATION(); - - DEBUGFUNC("nicRxSDIOAggReceiveRFBs"); - - ASSERT(prAdapter); - prEnhDataStr = prAdapter->prSDIOCtrl; - prRxCtrl = &prAdapter->rRxCtrl; - prSDIOCtrl = prAdapter->prSDIOCtrl; - -#if CFG_SDIO_RX_ENHANCE - fgIsRxEnhanceMode = TRUE; -#else - fgIsRxEnhanceMode = FALSE; -#endif - - do { -#if CFG_SDIO_RX_ENHANCE - /* to limit maximum loop for RX */ - u4MaxLoopCount--; - if (u4MaxLoopCount == 0) { - break; - } -#endif - - if(prEnhDataStr->rRxInfo.u.u2NumValidRx0Len == 0 && - prEnhDataStr->rRxInfo.u.u2NumValidRx1Len == 0) { - break; - } - - for(rxNum = 0 ; rxNum < 2 ; rxNum++) { - u2RxPktNum = (rxNum == 0 ? prEnhDataStr->rRxInfo.u.u2NumValidRx0Len : prEnhDataStr->rRxInfo.u.u2NumValidRx1Len); - //DBGLOG(RX, TRACE, ("RxPktNum %d in rxPort %d\n", u2RxPktNum, rxNum)); - - // if this assertion happened, it is most likely a F/W bug - ASSERT(u2RxPktNum <= 16); - - if (u2RxPktNum > 16) - continue; - - if(u2RxPktNum == 0) - continue; - - #if CFG_HIF_STATISTICS - prRxCtrl->u4TotalRxAccessNum++; - prRxCtrl->u4TotalRxPacketNum += u2RxPktNum; - #endif - - u4CurrAvailFreeRfbCnt = prRxCtrl->rFreeSwRfbList.u4NumElem; - - // if SwRfb is not enough, abort reading this time - if(u4CurrAvailFreeRfbCnt < u2RxPktNum) { - #if CFG_HIF_RX_STARVATION_WARNING - DbgPrint("FreeRfb is not enough: %d available, need %d\n", u4CurrAvailFreeRfbCnt, u2RxPktNum); - DbgPrint("Queued Count: %d / Dequeud Count: %d\n", prRxCtrl->u4QueuedCnt, prRxCtrl->u4DequeuedCnt); - #endif - continue; - } - -#if CFG_SDIO_RX_ENHANCE - u4RxAvailAggLen = CFG_RX_COALESCING_BUFFER_SIZE - (sizeof(ENHANCE_MODE_DATA_STRUCT_T) + 4/* extra HW padding */); -#else - u4RxAvailAggLen = CFG_RX_COALESCING_BUFFER_SIZE; -#endif - u4RxAggCount = 0; - - for (i = 0; i < u2RxPktNum ; i++) { - u4RxLength = (rxNum == 0 ? - (UINT_32)prEnhDataStr->rRxInfo.u.au2Rx0Len[i] : - (UINT_32)prEnhDataStr->rRxInfo.u.au2Rx1Len[i]); - - if (!u4RxLength) { - ASSERT(0); - break; - } - - if (ALIGN_4(u4RxLength + HIF_RX_HW_APPENDED_LEN) < u4RxAvailAggLen) { - if (u4RxAggCount < u4CurrAvailFreeRfbCnt) { - u4RxAvailAggLen -= ALIGN_4(u4RxLength + HIF_RX_HW_APPENDED_LEN); - u4RxAggCount++; - } - else { - // no FreeSwRfb for rx packet - ASSERT(0); - break; - } - } - else { - // CFG_RX_COALESCING_BUFFER_SIZE is not large enough - ASSERT(0); - break; - } - } - - u4RxAggLength = (CFG_RX_COALESCING_BUFFER_SIZE - u4RxAvailAggLen); - //DBGLOG(RX, INFO, ("u4RxAggCount = %d, u4RxAggLength = %d\n", - // u4RxAggCount, u4RxAggLength)); - - HAL_READ_RX_PORT(prAdapter, - rxNum, - u4RxAggLength, - prRxCtrl->pucRxCoalescingBufPtr, - CFG_RX_COALESCING_BUFFER_SIZE); - if (!fgResult) { - DBGLOG(RX, ERROR, ("Read RX Agg Packet Error\n")); - continue; - } - - pucSrcAddr = prRxCtrl->pucRxCoalescingBufPtr; - for (i = 0; i < u4RxAggCount; i++) { - UINT_16 u2PktLength; - - u2PktLength = (rxNum == 0 ? - prEnhDataStr->rRxInfo.u.au2Rx0Len[i] : - prEnhDataStr->rRxInfo.u.au2Rx1Len[i]); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - QUEUE_REMOVE_HEAD(&prRxCtrl->rFreeSwRfbList, prSwRfb, P_SW_RFB_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - - ASSERT(prSwRfb); - kalMemCopy(prSwRfb->pucRecvBuff, pucSrcAddr, - ALIGN_4(u2PktLength + HIF_RX_HW_APPENDED_LEN)); - - prHifRxHdr = prSwRfb->prHifRxHdr; - ASSERT(prHifRxHdr); - - prSwRfb->ucPacketType = (UINT_8)(prHifRxHdr->u2PacketType & HIF_RX_HDR_PACKET_TYPE_MASK); - //DBGLOG(RX, TRACE, ("ucPacketType = %d\n", prSwRfb->ucPacketType)); - - prSwRfb->ucStaRecIdx = (UINT_8)(prHifRxHdr->ucStaRecIdx); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - QUEUE_INSERT_TAIL(&prRxCtrl->rReceivedRfbList, &prSwRfb->rQueEntry); - RX_INC_CNT(prRxCtrl, RX_MPDU_TOTAL_COUNT); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - - pucSrcAddr += ALIGN_4(u2PktLength + HIF_RX_HW_APPENDED_LEN); - //prEnhDataStr->au4RxLength[i] = 0; - } - -#if CFG_SDIO_RX_ENHANCE - kalMemCopy(prAdapter->prSDIOCtrl, (pucSrcAddr + 4), sizeof(ENHANCE_MODE_DATA_STRUCT_T)); - - /* do the same thing what nicSDIOReadIntStatus() does */ - if((prSDIOCtrl->u4WHISR & WHISR_TX_DONE_INT) == 0 && - (prSDIOCtrl->rTxInfo.au4WTSR[0] | prSDIOCtrl->rTxInfo.au4WTSR[1])) { - prSDIOCtrl->u4WHISR |= WHISR_TX_DONE_INT; - } - - if((prSDIOCtrl->u4WHISR & BIT(31)) == 0 && - HAL_GET_MAILBOX_READ_CLEAR(prAdapter) == TRUE && - (prSDIOCtrl->u4RcvMailbox0 != 0 || prSDIOCtrl->u4RcvMailbox1 != 0)) { - prSDIOCtrl->u4WHISR |= BIT(31); - } - - /* dispatch to interrupt handler with RX bits masked */ - nicProcessIST_impl(prAdapter, prSDIOCtrl->u4WHISR & (~(WHISR_RX0_DONE_INT | WHISR_RX1_DONE_INT))); -#endif - } - -#if !CFG_SDIO_RX_ENHANCE - prEnhDataStr->rRxInfo.u.u2NumValidRx0Len = 0; - prEnhDataStr->rRxInfo.u.u2NumValidRx1Len = 0; -#endif - } - while ((prEnhDataStr->rRxInfo.u.u2NumValidRx0Len - || prEnhDataStr->rRxInfo.u.u2NumValidRx1Len) - && fgIsRxEnhanceMode); - - return; -} -#endif /* CFG_SDIO_RX_AGG */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Setup a RFB and allocate the os packet to the RFB -* -* @param prAdapter Pointer to the Adapter structure. -* @param prSwRfb Pointer to the RFB -* -* @retval WLAN_STATUS_SUCCESS -* @retval WLAN_STATUS_RESOURCES -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicRxSetupRFB ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - PVOID pvPacket; - PUINT_8 pucRecvBuff; - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - if (!prSwRfb->pvPacket) { - kalMemZero(prSwRfb, sizeof(SW_RFB_T)); - pvPacket = kalPacketAlloc(prAdapter->prGlueInfo, CFG_RX_MAX_PKT_SIZE, - &pucRecvBuff); - if (pvPacket == NULL) { - return WLAN_STATUS_RESOURCES; - } - - prSwRfb->pvPacket = pvPacket; - prSwRfb->pucRecvBuff= (PVOID)pucRecvBuff; - } - else { - kalMemZero(((PUINT_8)prSwRfb + OFFSET_OF(SW_RFB_T, prHifRxHdr)), - (sizeof(SW_RFB_T)-OFFSET_OF(SW_RFB_T, prHifRxHdr))); - } - - prSwRfb->prHifRxHdr = (P_HIF_RX_HEADER_T)(prSwRfb->pucRecvBuff); - - return WLAN_STATUS_SUCCESS; - -} /* end of nicRxSetupRFB() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This routine is called to put a RFB back onto the "RFB with Buffer" list -* or "RFB without buffer" list according to pvPacket. -* -* @param prAdapter Pointer to the Adapter structure. -* @param prSwRfb Pointer to the RFB -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxReturnRFB ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_RX_CTRL_T prRxCtrl; - P_QUE_ENTRY_T prQueEntry; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - ASSERT(prSwRfb); - prRxCtrl = &prAdapter->rRxCtrl; - prQueEntry = &prSwRfb->rQueEntry; - - ASSERT(prQueEntry); - - /* The processing on this RFB is done, so put it back on the tail of - our list */ - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - - if (prSwRfb->pvPacket) { - QUEUE_INSERT_TAIL(&prRxCtrl->rFreeSwRfbList, prQueEntry); - } - else { - QUEUE_INSERT_TAIL(&prRxCtrl->rIndicatedRfbList, prQueEntry); - } - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_RX_QUE); - return; -} /* end of nicRxReturnRFB() */ - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process rx interrupt. When the rx -* Interrupt is asserted, it means there are frames in queue. -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicProcessRxInterrupt ( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - -#if CFG_SDIO_INTR_ENHANCE - #if CFG_SDIO_RX_AGG - nicRxSDIOAggReceiveRFBs(prAdapter); - #else - nicRxSDIOReceiveRFBs(prAdapter); - #endif -#else - nicRxReceiveRFBs(prAdapter); -#endif /* CFG_SDIO_INTR_ENHANCE */ - - nicRxProcessRFBs(prAdapter); - - return; - -} /* end of nicProcessRxInterrupt() */ - - -#if CFG_TCP_IP_CHKSUM_OFFLOAD -/*----------------------------------------------------------------------------*/ -/*! -* @brief Used to update IP/TCP/UDP checksum statistics of RX Module. -* -* @param prAdapter Pointer to the Adapter structure. -* @param aeCSUM The array of checksum result. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxUpdateCSUMStatistics ( - IN P_ADAPTER_T prAdapter, - IN const ENUM_CSUM_RESULT_T aeCSUM[] - ) -{ - P_RX_CTRL_T prRxCtrl; - - ASSERT(prAdapter); - ASSERT(aeCSUM); - - prRxCtrl = &prAdapter->rRxCtrl; - ASSERT(prRxCtrl); - - if ((aeCSUM[CSUM_TYPE_IPV4] == CSUM_RES_SUCCESS) || - (aeCSUM[CSUM_TYPE_IPV6] == CSUM_RES_SUCCESS)) { - - RX_INC_CNT(prRxCtrl, RX_CSUM_IP_SUCCESS_COUNT); - } - else if ((aeCSUM[CSUM_TYPE_IPV4] == CSUM_RES_FAILED) || - (aeCSUM[CSUM_TYPE_IPV6] == CSUM_RES_FAILED)) { - - RX_INC_CNT(prRxCtrl, RX_CSUM_IP_FAILED_COUNT); - } - else if ((aeCSUM[CSUM_TYPE_IPV4] == CSUM_RES_NONE) && - (aeCSUM[CSUM_TYPE_IPV6] == CSUM_RES_NONE)) { - - RX_INC_CNT(prRxCtrl, RX_CSUM_UNKNOWN_L3_PKT_COUNT); - } - else { - ASSERT(0); - } - - if (aeCSUM[CSUM_TYPE_TCP] == CSUM_RES_SUCCESS) { - RX_INC_CNT(prRxCtrl, RX_CSUM_TCP_SUCCESS_COUNT); - } - else if (aeCSUM[CSUM_TYPE_TCP] == CSUM_RES_FAILED) { - RX_INC_CNT(prRxCtrl, RX_CSUM_TCP_FAILED_COUNT); - } - else if (aeCSUM[CSUM_TYPE_UDP] == CSUM_RES_SUCCESS) { - RX_INC_CNT(prRxCtrl, RX_CSUM_UDP_SUCCESS_COUNT); - } - else if (aeCSUM[CSUM_TYPE_UDP] == CSUM_RES_FAILED) { - RX_INC_CNT(prRxCtrl, RX_CSUM_UDP_FAILED_COUNT); - } - else if ((aeCSUM[CSUM_TYPE_UDP] == CSUM_RES_NONE) && - (aeCSUM[CSUM_TYPE_TCP] == CSUM_RES_NONE)) { - - RX_INC_CNT(prRxCtrl, RX_CSUM_UNKNOWN_L4_PKT_COUNT); - } - else { - ASSERT(0); - } - - return; -} /* end of nicRxUpdateCSUMStatistics() */ -#endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to query current status of RX Module. -* -* @param prAdapter Pointer to the Adapter structure. -* @param pucBuffer Pointer to the message buffer. -* @param pu4Count Pointer to the buffer of message length count. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxQueryStatus ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBuffer, - OUT PUINT_32 pu4Count - ) -{ - P_RX_CTRL_T prRxCtrl; - PUINT_8 pucCurrBuf = pucBuffer; - - - ASSERT(prAdapter); - prRxCtrl = &prAdapter->rRxCtrl; - ASSERT(prRxCtrl); - - //if (pucBuffer) {} /* For Windows, we'll print directly instead of sprintf() */ - ASSERT(pu4Count); - - SPRINTF(pucCurrBuf, ("\n\nRX CTRL STATUS:")); - SPRINTF(pucCurrBuf, ("\n===============")); - SPRINTF(pucCurrBuf, ("\nFREE RFB w/i BUF LIST :%9ld", prRxCtrl->rFreeSwRfbList.u4NumElem)); - SPRINTF(pucCurrBuf, ("\nFREE RFB w/o BUF LIST :%9ld", prRxCtrl->rIndicatedRfbList.u4NumElem)); - SPRINTF(pucCurrBuf, ("\nRECEIVED RFB LIST :%9ld", prRxCtrl->rReceivedRfbList.u4NumElem)); - - SPRINTF(pucCurrBuf, ("\n\n")); - - //*pu4Count = (UINT_32)((UINT_32)pucCurrBuf - (UINT_32)pucBuffer); - - return; -} /* end of nicRxQueryStatus() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Clear RX related counters -* -* @param prAdapter Pointer of Adapter Data Structure -* -* @return - (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxClearStatistics ( - IN P_ADAPTER_T prAdapter - ) -{ - P_RX_CTRL_T prRxCtrl; - - ASSERT(prAdapter); - prRxCtrl = &prAdapter->rRxCtrl; - ASSERT(prRxCtrl); - - RX_RESET_ALL_CNTS(prRxCtrl); - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to query current statistics of RX Module. -* -* @param prAdapter Pointer to the Adapter structure. -* @param pucBuffer Pointer to the message buffer. -* @param pu4Count Pointer to the buffer of message length count. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxQueryStatistics ( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucBuffer, - OUT PUINT_32 pu4Count - ) -{ - P_RX_CTRL_T prRxCtrl; - PUINT_8 pucCurrBuf = pucBuffer; - - ASSERT(prAdapter); - prRxCtrl = &prAdapter->rRxCtrl; - ASSERT(prRxCtrl); - - //if (pucBuffer) {} /* For Windows, we'll print directly instead of sprintf() */ - ASSERT(pu4Count); - -#define SPRINTF_RX_COUNTER(eCounter) \ - SPRINTF(pucCurrBuf, ("%-30s : %ld\n", #eCounter, (UINT_32)prRxCtrl->au8Statistics[eCounter])) - - SPRINTF_RX_COUNTER(RX_MPDU_TOTAL_COUNT); - SPRINTF_RX_COUNTER(RX_SIZE_ERR_DROP_COUNT); - SPRINTF_RX_COUNTER(RX_DATA_INDICATION_COUNT); - SPRINTF_RX_COUNTER(RX_DATA_RETURNED_COUNT); - SPRINTF_RX_COUNTER(RX_DATA_RETAINED_COUNT); - -#if CFG_TCP_IP_CHKSUM_OFFLOAD || CFG_TCP_IP_CHKSUM_OFFLOAD_NDIS_60 - SPRINTF_RX_COUNTER(RX_CSUM_TCP_FAILED_COUNT); - SPRINTF_RX_COUNTER(RX_CSUM_UDP_FAILED_COUNT); - SPRINTF_RX_COUNTER(RX_CSUM_IP_FAILED_COUNT); - SPRINTF_RX_COUNTER(RX_CSUM_TCP_SUCCESS_COUNT); - SPRINTF_RX_COUNTER(RX_CSUM_UDP_SUCCESS_COUNT); - SPRINTF_RX_COUNTER(RX_CSUM_IP_SUCCESS_COUNT); - SPRINTF_RX_COUNTER(RX_CSUM_UNKNOWN_L4_PKT_COUNT); - SPRINTF_RX_COUNTER(RX_CSUM_UNKNOWN_L3_PKT_COUNT); - SPRINTF_RX_COUNTER(RX_IP_V6_PKT_CCOUNT); -#endif - - //*pu4Count = (UINT_32)(pucCurrBuf - pucBuffer); - - nicRxClearStatistics(prAdapter); - - return; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Read the Response data from data port -* -* @param prAdapter pointer to the Adapter handler -* @param pucRspBuffer pointer to the Response buffer -* -* @retval WLAN_STATUS_SUCCESS: Response packet has been read -* @retval WLAN_STATUS_FAILURE: Read Response packet timeout or error occurred -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicRxWaitResponse ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucPortIdx, - OUT PUINT_8 pucRspBuffer, - IN UINT_32 u4MaxRespBufferLen, - OUT PUINT_32 pu4Length - ) -{ - UINT_32 u4Value = 0, u4PktLen = 0, i = 0; - WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS; - BOOL fgResult = TRUE; - UINT_32 u4Time, u4Current; - - DEBUGFUNC("nicRxWaitResponse"); - - ASSERT(prAdapter); - ASSERT(pucRspBuffer); - ASSERT(ucPortIdx < 2); - - u4Time = (UINT_32)kalGetTimeTick(); - - do { - /* Read the packet length */ - HAL_MCR_RD(prAdapter, MCR_WRPLR, &u4Value); - - if (!fgResult) { - DBGLOG(RX, ERROR, ("Read Response Packet Error\n")); - return WLAN_STATUS_FAILURE; - } - - if(ucPortIdx == 0) { - u4PktLen = u4Value & 0xFFFF; - } - else { - u4PktLen = (u4Value >> 16) & 0xFFFF; - } - - DBGLOG(RX, TRACE, ("i = %d, u4PktLen = %d\n", i, u4PktLen)); - - if (u4PktLen == 0) { - /* timeout exceeding check */ - u4Current = (UINT_32)kalGetTimeTick(); - - if((u4Current > u4Time) && ((u4Current - u4Time) > RX_RESPONSE_TIMEOUT)) { - return WLAN_STATUS_FAILURE; - } - else if(u4Current < u4Time && ((u4Current + (0xFFFFFFFF - u4Time)) > RX_RESPONSE_TIMEOUT)) { - return WLAN_STATUS_FAILURE; - } - - /* Response packet is not ready */ - kalUdelay(50); - - i++; - } - else if (u4PktLen > u4MaxRespBufferLen) { - DBGLOG(RX, WARN, ("Not enough Event Buffer: required length = 0x%x, available buffer length = %d\n", - u4PktLen, u4MaxRespBufferLen)); - - return WLAN_STATUS_FAILURE; - } - else { - HAL_PORT_RD(prAdapter, - ucPortIdx == 0 ? MCR_WRDR0 : MCR_WRDR1, - u4PktLen, - pucRspBuffer, - u4MaxRespBufferLen); - - /* fgResult will be updated in MACRO */ - if (!fgResult) { - DBGLOG(RX, ERROR, ("Read Response Packet Error\n")); - return WLAN_STATUS_FAILURE; - } - - DBGLOG(RX, TRACE, ("Dump Response buffer, length = 0x%x\n", - u4PktLen)); - DBGLOG_MEM8(RX, TRACE, pucRspBuffer, u4PktLen); - - *pu4Length = u4PktLen; - break; - } - } while(TRUE); - - return u4Status; -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Set filter to enable Promiscuous Mode -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxEnablePromiscuousMode ( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - return; -} /* end of nicRxEnablePromiscuousMode() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Set filter to disable Promiscuous Mode -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxDisablePromiscuousMode ( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - return; -} /* end of nicRxDisablePromiscuousMode() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief this function flushes all packets queued in reordering module -* -* @param prAdapter Pointer to the Adapter structure. -* -* @retval WLAN_STATUS_SUCCESS Flushed successfully -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicRxFlush ( - IN P_ADAPTER_T prAdapter - ) -{ - P_SW_RFB_T prSwRfb; - - ASSERT(prAdapter); - - if((prSwRfb = qmFlushRxQueues(prAdapter)) != NULL) { - do { - P_SW_RFB_T prNextSwRfb; - - // save next first - prNextSwRfb = (P_SW_RFB_T)QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T)prSwRfb); - - // free - nicRxReturnRFB(prAdapter, prSwRfb); - - prSwRfb = prNextSwRfb; - } while(prSwRfb); - } - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief -* -* @param -* -* @retval -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicRxProcessActionFrame ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb - ) -{ - P_WLAN_ACTION_FRAME prActFrame; - - ASSERT(prAdapter); - ASSERT(prSwRfb); - - if (prSwRfb->u2PacketLen < sizeof(WLAN_ACTION_FRAME) - 1) { - return WLAN_STATUS_INVALID_PACKET; - } - prActFrame = (P_WLAN_ACTION_FRAME) prSwRfb->pvHeader; - - switch (prActFrame->ucCategory) { - case CATEGORY_PUBLIC_ACTION: - - #if CFG_ENABLE_WIFI_DIRECT - if (prAdapter->fgIsP2PRegistered) { - rlmProcessPublicAction(prAdapter, prSwRfb); - - p2pFuncValidateRxActionFrame( - prAdapter, prSwRfb); - - } - #endif - break; - - case CATEGORY_HT_ACTION: - #if CFG_ENABLE_WIFI_DIRECT - if (prAdapter->fgIsP2PRegistered) { - rlmProcessHtAction(prAdapter, prSwRfb); - } - #endif - break; - case CATEGORY_VENDOR_SPECIFIC_ACTION: - #if CFG_ENABLE_WIFI_DIRECT - if (prAdapter->fgIsP2PRegistered) { - p2pFuncValidateRxActionFrame(prAdapter, prSwRfb); - } - #endif - break; -#if CFG_SUPPORT_802_11W - case CATEGORY_SA_QUERT_ACTION: - { - P_HIF_RX_HEADER_T prHifRxHdr; - - prHifRxHdr = prSwRfb->prHifRxHdr; - - if ((HIF_RX_HDR_GET_NETWORK_IDX(prHifRxHdr) == NETWORK_TYPE_AIS_INDEX) && - prAdapter->rWifiVar.rAisSpecificBssInfo.fgMgmtProtection /* Use MFP */ - ) { - if (!(prHifRxHdr->ucReserved & CONTROL_FLAG_UC_MGMT_NO_ENC)) { - /* MFP test plan 5.3.3.4 */ - rsnSaQueryAction(prAdapter, prSwRfb); - } - else { - DBGLOG(RSN, TRACE, ("Un-Protected SA Query, do nothing\n")); - } - } - } - break; -#endif -#if CFG_SUPPORT_802_11V - case CATEGORY_WNM_ACTION: - { - wnmWNMAction(prAdapter, prSwRfb); - } - break; -#endif - default: - break; - } /* end of switch case */ - - return WLAN_STATUS_SUCCESS; -} - - diff --git a/drivers/net/wireless/mt5931/nic/nic_tx.c b/drivers/net/wireless/mt5931/nic/nic_tx.c deleted file mode 100755 index 5f626798b1e6..000000000000 --- a/drivers/net/wireless/mt5931/nic/nic_tx.c +++ /dev/null @@ -1,1981 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/nic/nic_tx.c#1 $ -*/ - -/*! \file nic_tx.c - \brief Functions that provide TX operation in NIC Layer. - - This file provides TX functions which are responsible for both Hardware and - Software Resource Management and keep their Synchronization. -*/ - - - -/* -** $Log: nic_tx.c $ - * - * 06 13 2012 yuche.tsai - * NULL - * Update maintrunk driver. - * Add support for driver compose assoc request frame. - * - * 11 18 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Add log counter for tx - * - * 11 09 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Add xlog for beacon timeout and sta aging timeout. - * - * 11 08 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Add xlog function. - * - * 05 17 2011 cp.wu - * [WCXRP00000732] [MT6620 Wi-Fi][AIS] No need to switch back to IDLE state when DEAUTH frame is dropped due to bss disconnection - * when TX DONE status is TX_RESULT_DROPPED_IN_DRIVER, no need to switch back to IDLE state. - * - * 04 12 2011 eddie.chen - * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma - * Fix the sta index in processing security frame - * Simple flow control for TC4 to avoid mgt frames for PS STA to occupy the TC4 - * Add debug message. - * - * 04 12 2011 cp.wu - * [WCXRP00000631] [MT6620 Wi-Fi][Driver] Add an API for QM to retrieve current TC counter value and processing frame dropping cases for TC4 path - * remove unused variables. - * - * 04 12 2011 cp.wu - * [WCXRP00000631] [MT6620 Wi-Fi][Driver] Add an API for QM to retrieve current TC counter value and processing frame dropping cases for TC4 path - * 1. add nicTxGetResource() API for QM to make decisions. - * 2. if management frames is decided by QM for dropping, the call back is invoked to indicate such a case. - * - * 03 17 2011 cp.wu - * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period - * use pre-allocated buffer for storing enhanced interrupt response as well - * - * 03 15 2011 cp.wu - * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous memory consumption - * 1. deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK - * 2. Use common coalescing buffer for both TX/RX directions - * - * - * 02 16 2011 cp.wu - * [WCXRP00000449] [MT6620 Wi-Fi][Driver] Refine CMD queue handling by adding an extra API for checking availble count and modify behavior - * 1. add new API: nicTxGetFreeCmdCount() - * 2. when there is insufficient command descriptor, nicTxEnqueueMsdu() will drop command packets directly - * - * 01 24 2011 cp.wu - * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving - * 1. add an extra counter for tracking pending forward frames. - * 2. notify TX service thread as well when there is pending forward frame - * 3. correct build errors leaded by introduction of Wi-Fi direct separation module - * - * 01 12 2011 cp.wu - * [WCXRP00000356] [MT6620 Wi-Fi][Driver] fill mac header length for security frames 'cause hardware header translation needs such information - * fill mac header length information for 802.1x frames. - * - * 12 31 2010 cp.wu - * [WCXRP00000335] [MT6620 Wi-Fi][Driver] change to use milliseconds sleep instead of delay to avoid blocking to system scheduling - * change to use msleep() and shorten waiting interval to reduce blocking to other task while Wi-Fi driver is being loaded - * - * 11 01 2010 yarco.yang - * [WCXRP00000149] [MT6620 WI-Fi][Driver]Fine tune performance on MT6516 platform - * Add GPIO debug function - * - * 10 18 2010 cp.wu - * [WCXRP00000117] [MT6620 Wi-Fi][Driver] Add logic for suspending driver when MT6620 is not responding anymore - * 1. when wlanAdapterStop() failed to send POWER CTRL command to firmware, do not poll for ready bit dis-assertion - * 2. shorten polling count for shorter response time - * 3. if bad I/O operation is detected during TX resource polling, then further operation is aborted as well - * - * 10 06 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * code reorganization to improve isolation between GLUE and CORE layers. - * - * 09 29 2010 wh.su - * [WCXRP00000072] [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue - * [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue. - * - * 09 27 2010 wh.su - * NULL - * since the u2TxByteCount_UserPriority will or another setting, keep the overall buffer for avoid error - * - * 09 24 2010 wh.su - * NULL - * [WCXRP000000058][MT6620 Wi-Fi][Driver] Fail to handshake with WAPI AP due the 802.1x frame send to fw with extra bytes padding. - * - * 09 01 2010 cp.wu - * NULL - * HIFSYS Clock Source Workaround - * - * 08 30 2010 cp.wu - * NULL - * API added: nicTxPendingPackets(), for simplifying porting layer - * - * 08 30 2010 cp.wu - * NULL - * eliminate klockwork errors - * - * 08 20 2010 wh.su - * NULL - * adding the eapol callback setting. - * - * 08 18 2010 yarco.yang - * NULL - * 1. Fixed HW checksum offload function not work under Linux issue. - * 2. Add debug message. - * - * 08 05 2010 yuche.tsai - * NULL - * . - * - * 08 03 2010 cp.wu - * NULL - * surpress compilation warning. - * - * 08 02 2010 jeffrey.chang - * NULL - * 1) modify tx service thread to avoid busy looping - * 2) add spin lock declartion for linux build - * - * 07 29 2010 cp.wu - * NULL - * simplify post-handling after TX_DONE interrupt is handled. - * - * 07 19 2010 jeffrey.chang - * - * Linux port modification - * - * 07 13 2010 cp.wu - * - * 1) MMPDUs are now sent to MT6620 by CMD queue for keeping strict order of 1X/MMPDU/CMD packets - * 2) integrate with qmGetFrameAction() for deciding which MMPDU/1X could pass checking for sending - * 2) enhance CMD_INFO_T descriptor number from 10 to 32 to avoid descriptor underflow under concurrent network operation - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 29 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * replace g_rQM with Adpater->rQM - * - * 06 25 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add API in que_mgt to retrieve sta-rec index for security frames. - * - * 06 24 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 802.1x and bluetooth-over-Wi-Fi security frames are now delievered to firmware via command path instead of data path. - * - * 06 23 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Merge g_arStaRec[] into adapter->arStaRec[] - * - * 06 22 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) add command warpper for STA-REC/BSS-INFO sync. - * 2) enhance command packet sending procedure for non-oid part - * 3) add command packet definitions for STA-REC/BSS-INFO sync. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add checking for TX descriptor poll. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * TX descriptors are now allocated once for reducing allocation overhead - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * change zero-padding for TX port access to HAL. - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * . - * - * 06 15 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * . - * - * 06 14 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * fill extra information for revised HIF_TX_HEADER. - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 10 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * change to enqueue TX frame infinitely. - * - * 06 09 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add TX_PACKET_MGMT to indicate the frame is coming from management modules - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 10 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * fill network type field while doing frame identification. - * - * 04 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * surpress compiler warning - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * Tag the packet for QoS on Tx path - * - * 03 30 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * remove driver-land statistics. - * - * 03 29 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * improve none-glue code portability - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port - * - * 03 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * generate information for OID_GEN_RCV_OK & OID_GEN_XMIT_OK - * * * * * - * -* 03 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * code clean: removing unused variables and structure definitions - * - * 03 08 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) add another spin-lock to protect MsduInfoList due to it might be accessed by different thread. - * * * * 2) change own-back acquiring procedure to wait for up to 16.67 seconds - * - * 03 02 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add mutex to avoid multiple access to qmTxQueue simultaneously. - * - * 02 26 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * avoid refering to NDIS-specific data structure directly from non-glue layer. - * - * 02 24 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add Ethernet destination address information in packet info for TX - * - * 02 10 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) remove unused function in nic_rx.c [which has been handled in que_mgt.c] - * * * * * * 2) firmware image length is now retrieved via NdisFileOpen - * * * * * * 3) firmware image is not structured by (P_IMG_SEC_HDR_T) anymore - * * * * * * 4) nicRxWaitResponse() revised - * * * * * * 5) another set of TQ counter default value is added for fw-download state - * * * * * * 6) Wi-Fi load address is now retrieved from registry too - * - * 02 09 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. Permanent and current MAC address are now retrieved by CMD/EVENT packets instead of hard-coded address - * * * * * * * * * 2. follow MSDN defined behavior when associates to another AP - * * * * * * * * * 3. for firmware download, packet size could be up to 2048 bytes - * - * 02 08 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * prepare for implementing fw download logic - * - * 01 27 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. eliminate improper variable in rHifInfo - * * * * * * * * * 2. block TX/ordinary OID when RF test mode is engaged - * * * * * * * * * 3. wait until firmware finish operation when entering into and leaving from RF test mode - * * * * * * * * * 4. correct some HAL implementation - * - * 01 13 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Enabled the Burst_End Indication mechanism - * - * 01 13 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * TX: fill ucWlanHeaderLength/ucPktFormtId_Flags according to info provided by prMsduInfo - * - * 12 30 2009 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) According to CMD/EVENT documentation v0.8, - * * * * * * * * * * OID_CUSTOM_TEST_RX_STATUS & OID_CUSTOM_TEST_TX_STATUS is no longer used, - * * * * * * * * * * and result is retrieved by get ATInfo instead - * * * * * * * * * * 2) add 4 counter for recording aggregation statistics -** \main\maintrunk.MT6620WiFiDriver_Prj\44 2009-12-10 16:52:15 GMT mtk02752 -** remove unused API -** \main\maintrunk.MT6620WiFiDriver_Prj\43 2009-12-07 22:44:24 GMT mtk02752 -** correct assertion criterion -** \main\maintrunk.MT6620WiFiDriver_Prj\42 2009-12-07 21:15:52 GMT mtk02752 -** correct trivial mistake -** \main\maintrunk.MT6620WiFiDriver_Prj\41 2009-12-04 15:47:21 GMT mtk02752 -** + always append a dword of zero on TX path to avoid TX aggregation to triggered on uninitialized data -** + add more assertion for packet size check -** \main\maintrunk.MT6620WiFiDriver_Prj\40 2009-12-04 14:51:55 GMT mtk02752 -** nicTxMsduInfo(): save ptr for next entry before attaching to qDataPort -** \main\maintrunk.MT6620WiFiDriver_Prj\39 2009-12-04 11:54:54 GMT mtk02752 -** add 2 assertion for size check -** \main\maintrunk.MT6620WiFiDriver_Prj\38 2009-12-03 16:20:35 GMT mtk01461 -** Add debug message -** \main\maintrunk.MT6620WiFiDriver_Prj\37 2009-11-30 10:57:10 GMT mtk02752 -** 1st DW of WIFI_CMD_T is shared with HIF_TX_HEADER_T -** \main\maintrunk.MT6620WiFiDriver_Prj\36 2009-11-30 09:20:43 GMT mtk02752 -** use TC4 instead of TC5 for command packet -** \main\maintrunk.MT6620WiFiDriver_Prj\35 2009-11-27 11:08:11 GMT mtk02752 -** add flush for reset -** \main\maintrunk.MT6620WiFiDriver_Prj\34 2009-11-26 20:31:22 GMT mtk02752 -** fill prMsduInfo->ucUserPriority -** \main\maintrunk.MT6620WiFiDriver_Prj\33 2009-11-25 21:04:33 GMT mtk02752 -** fill u2SeqNo -** \main\maintrunk.MT6620WiFiDriver_Prj\32 2009-11-24 20:52:12 GMT mtk02752 -** integration with SD1's data path API -** \main\maintrunk.MT6620WiFiDriver_Prj\31 2009-11-24 19:54:25 GMT mtk02752 -** nicTxRetransmitOfOsSendQue & nicTxData but changed to use nicTxMsduInfoList -** \main\maintrunk.MT6620WiFiDriver_Prj\30 2009-11-23 17:53:18 GMT mtk02752 -** add nicTxCmd() for SD1_SD3_DATAPATH_INTEGRATION, which will append only HIF_TX_HEADER. seqNum, WIFI_CMD_T will be created inside oid handler -** \main\maintrunk.MT6620WiFiDriver_Prj\29 2009-11-20 15:10:24 GMT mtk02752 -** use TxAccquireResource instead of accessing TCQ directly. -** \main\maintrunk.MT6620WiFiDriver_Prj\28 2009-11-17 22:40:57 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\27 2009-11-17 17:35:40 GMT mtk02752 -** add nicTxMsduInfoList () implementation -** \main\maintrunk.MT6620WiFiDriver_Prj\26 2009-11-17 11:07:10 GMT mtk02752 -** add nicTxAdjustTcq() implementation -** \main\maintrunk.MT6620WiFiDriver_Prj\25 2009-11-16 22:28:38 GMT mtk02752 -** move aucFreeBufferCount/aucMaxNumOfBuffer into another structure -** \main\maintrunk.MT6620WiFiDriver_Prj\24 2009-11-16 21:45:32 GMT mtk02752 -** add SD1_SD3_DATAPATH_INTEGRATION data path handling -** \main\maintrunk.MT6620WiFiDriver_Prj\23 2009-11-13 13:29:56 GMT mtk01084 -** modify TX hdr format, fix tx retransmission issue -** \main\maintrunk.MT6620WiFiDriver_Prj\22 2009-11-11 10:36:21 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\21 2009-11-04 14:11:11 GMT mtk01084 -** modify TX SW data structure -** \main\maintrunk.MT6620WiFiDriver_Prj\20 2009-10-29 19:56:17 GMT mtk01084 -** modify HAL part -** \main\maintrunk.MT6620WiFiDriver_Prj\19 2009-10-13 21:59:23 GMT mtk01084 -** update for new HW design -** \main\maintrunk.MT6620WiFiDriver_Prj\18 2009-10-02 14:00:18 GMT mtk01725 -** \main\maintrunk.MT6620WiFiDriver_Prj\17 2009-05-20 12:26:06 GMT mtk01461 -** Assign SeqNum to CMD Packet -** \main\maintrunk.MT6620WiFiDriver_Prj\16 2009-05-19 10:54:04 GMT mtk01461 -** Add debug message -** \main\maintrunk.MT6620WiFiDriver_Prj\15 2009-05-12 09:41:55 GMT mtk01461 -** Fix Query Command need resp issue -** \main\maintrunk.MT6620WiFiDriver_Prj\14 2009-04-29 15:44:38 GMT mtk01461 -** Move OS dependent code to kalQueryTxOOBData() -** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-04-28 10:40:03 GMT mtk01461 -** Add nicTxReleaseResource() for SDIO_STATUS_ENHANCE, and also fix the TX aggregation issue for 1x packet to TX1 port -** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-04-21 09:50:47 GMT mtk01461 -** Update nicTxCmd() for moving wait RESP function call to wlanSendCommand() -** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-04-17 19:56:32 GMT mtk01461 -** Move the CMD_INFO_T related function to cmd_buf.c -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-04-17 18:14:40 GMT mtk01426 -** Update OOB query for TX packet -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-04-14 15:51:32 GMT mtk01426 -** Support PKGUIO -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-04-02 17:26:40 GMT mtk01461 -** Add virtual OOB for HIF LOOPBACK SW PRETEST -** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-04-01 10:54:43 GMT mtk01461 -** Add function for SDIO_TX_ENHANCE -** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-03-23 21:53:47 GMT mtk01461 -** Add code for retransmit of rOsSendQueue, mpSendPacket(), and add code for TX Checksum offload, Loopback Test. -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-03-23 00:33:51 GMT mtk01461 -** Add code for TX Data & Cmd Packet -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-18 20:25:40 GMT mtk01461 -** Fix LINT warning -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-16 09:10:30 GMT mtk01461 -** Update TX PATH API -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:26:04 GMT mtk01426 -** Init for develop -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will initial all variables in regard to SW TX Queues and -* all free lists of MSDU_INFO_T and SW_TFCB_T. -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicTxInitialize ( - IN P_ADAPTER_T prAdapter - ) -{ - P_TX_CTRL_T prTxCtrl; - PUINT_8 pucMemHandle; - P_MSDU_INFO_T prMsduInfo; - UINT_32 i; - KAL_SPIN_LOCK_DECLARATION(); - - DEBUGFUNC("nicTxInitialize"); - - ASSERT(prAdapter); - prTxCtrl = &prAdapter->rTxCtrl; - - //4 <1> Initialization of Traffic Class Queue Parameters - nicTxResetResource(prAdapter); - -#if CFG_SDIO_TX_AGG - prTxCtrl->pucTxCoalescingBufPtr = prAdapter->pucCoalescingBufCached; -#endif /* CFG_SDIO_TX_AGG */ - - // allocate MSDU_INFO_T and link it into rFreeMsduInfoList - QUEUE_INITIALIZE(&prTxCtrl->rFreeMsduInfoList); - - pucMemHandle = prTxCtrl->pucTxCached; - for (i = 0 ; i < CFG_TX_MAX_PKT_NUM ; i++) { - prMsduInfo = (P_MSDU_INFO_T)pucMemHandle; - kalMemZero(prMsduInfo, sizeof(MSDU_INFO_T)); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST); - QUEUE_INSERT_TAIL(&prTxCtrl->rFreeMsduInfoList, (P_QUE_ENTRY_T)prMsduInfo); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST); - - pucMemHandle += ALIGN_4(sizeof(MSDU_INFO_T)); - } - - ASSERT(prTxCtrl->rFreeMsduInfoList.u4NumElem == CFG_TX_MAX_PKT_NUM); - /* Check if the memory allocation consist with this initialization function */ - ASSERT((UINT_32)(pucMemHandle - prTxCtrl->pucTxCached) == prTxCtrl->u4TxCachedSize); - - QUEUE_INITIALIZE(&prTxCtrl->rTxMgmtTxingQueue); - prTxCtrl->i4TxMgmtPendingNum = 0; - -#if CFG_HIF_STATISTICS - prTxCtrl->u4TotalTxAccessNum = 0; - prTxCtrl->u4TotalTxPacketNum = 0; -#endif - - prTxCtrl->i4PendingFwdFrameCount = 0; - - qmInit(prAdapter); - - TX_RESET_ALL_CNTS(prTxCtrl); - - return; -} /* end of nicTxInitialize() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Driver maintain a variable that is synchronous with the usage of individual -* TC Buffer Count. This function will check if has enough TC Buffer for incoming -* packet and then update the value after promise to provide the resources. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] ucTC Specify the resource of TC -* -* \retval WLAN_STATUS_SUCCESS Resource is available and been assigned. -* \retval WLAN_STATUS_RESOURCES Resource is not available. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicTxAcquireResource ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucTC - ) -{ - P_TX_CTRL_T prTxCtrl; - WLAN_STATUS u4Status = WLAN_STATUS_RESOURCES; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - prTxCtrl = &prAdapter->rTxCtrl; - - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_RESOURCE); - -// DbgPrint("nicTxAcquireResource prTxCtrl->rTc.aucFreeBufferCount[%d]=%d\n", ucTC, prTxCtrl->rTc.aucFreeBufferCount[ucTC]); - - if (prTxCtrl->rTc.aucFreeBufferCount[ucTC]) { - - prTxCtrl->rTc.aucFreeBufferCount[ucTC]--; - - DBGLOG(TX, EVENT, ("Acquire: TC = %d aucFreeBufferCount = %d\n", - ucTC, prTxCtrl->rTc.aucFreeBufferCount[ucTC])); - - u4Status = WLAN_STATUS_SUCCESS; - } - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_RESOURCE); - - return u4Status; - -}/* end of nicTxAcquireResourceAndTFCBs() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Driver maintain a variable that is synchronous with the usage of individual -* TC Buffer Count. This function will do polling if FW has return the resource. -* Used when driver start up before enable interrupt. -* -* @param prAdapter Pointer to the Adapter structure. -* @param ucTC Specify the resource of TC -* -* @retval WLAN_STATUS_SUCCESS Resource is available. -* @retval WLAN_STATUS_FAILURE Resource is not available. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicTxPollingResource ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucTC - ) -{ - P_TX_CTRL_T prTxCtrl; - WLAN_STATUS u4Status = WLAN_STATUS_FAILURE; - INT_32 i = NIC_TX_RESOURCE_POLLING_TIMEOUT; - UINT_32 au4WTSR[2]; - - ASSERT(prAdapter); - prTxCtrl = &prAdapter->rTxCtrl; - - if (ucTC >= TC_NUM) { - return WLAN_STATUS_FAILURE; - } - - if (prTxCtrl->rTc.aucFreeBufferCount[ucTC] > 0) { - return WLAN_STATUS_SUCCESS; - } - - while (i-- > 0) { - HAL_READ_TX_RELEASED_COUNT(prAdapter, au4WTSR); - - if(kalIsCardRemoved(prAdapter->prGlueInfo) == TRUE - || fgIsBusAccessFailed == TRUE) { - u4Status = WLAN_STATUS_FAILURE; - break; - } - else if (nicTxReleaseResource(prAdapter, (PUINT_8)au4WTSR)) { - if (prTxCtrl->rTc.aucFreeBufferCount[ucTC] > 0) { - u4Status = WLAN_STATUS_SUCCESS; - break; - } - else { - kalMsleep(NIC_TX_RESOURCE_POLLING_DELAY_MSEC); - } - } - else { - kalMsleep(NIC_TX_RESOURCE_POLLING_DELAY_MSEC); - } - } - -#if DBG - { - INT_32 i4Times = NIC_TX_RESOURCE_POLLING_TIMEOUT - (i+1); - - if (i4Times) { - DBGLOG(TX, TRACE, ("Polling MCR_WTSR delay %d times, %d msec\n", - i4Times, (i4Times * NIC_TX_RESOURCE_POLLING_DELAY_MSEC))); - } - } -#endif /* DBG */ - - return u4Status; - -} /* end of nicTxPollingResource() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Driver maintain a variable that is synchronous with the usage of individual -* TC Buffer Count. This function will release TC Buffer count according to -* the given TX_STATUS COUNTER after TX Done. -* -* \param[in] prAdapter Pointer to the Adapter structure. -* \param[in] u4TxStatusCnt Value of TX STATUS -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -nicTxReleaseResource ( - IN P_ADAPTER_T prAdapter, - IN UINT_8* aucTxRlsCnt - ) -{ - PUINT_32 pu4Tmp = (PUINT_32)aucTxRlsCnt; - P_TX_CTRL_T prTxCtrl; - BOOLEAN bStatus = FALSE; - UINT_32 i; - - KAL_SPIN_LOCK_DECLARATION(); - - - ASSERT(prAdapter); - prTxCtrl = &prAdapter->rTxCtrl; - - // DBGLOG(TX, TRACE, ("\n")); - - if (pu4Tmp[0] | pu4Tmp[1]) { - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_RESOURCE); - for (i = 0; i < TC_NUM; i++) { - prTxCtrl->rTc.aucFreeBufferCount[i] += aucTxRlsCnt[i]; - - if ((i==1) || (i==5)){ - DBGLOG(TX, EVENT, ("Release: i = %d aucFreeBufferCount = %d\n", - i, prTxCtrl->rTc.aucFreeBufferCount[i])); - } - } - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_RESOURCE); -#if 0 - for (i = 0; i < TC_NUM; i++) { - DBGLOG(INIT, TRACE, ("aucFreeBufferCount[%d]: %d, aucMaxNumOfBuffer[%d]: %d\n", - i, prTxCtrl->rTc.aucFreeBufferCount[i], i, prTxCtrl->rTc.aucMaxNumOfBuffer[i])); - } - DbgPrint("prTxCtrl->rTc.aucFreeBufferCount[0]=%d\n", prTxCtrl->rTc.aucFreeBufferCount[0]); - DbgPrint("prTxCtrl->rTc.aucFreeBufferCount[1]=%d\n", prTxCtrl->rTc.aucFreeBufferCount[1]); - DbgPrint("prTxCtrl->rTc.aucFreeBufferCount[2]=%d\n", prTxCtrl->rTc.aucFreeBufferCount[2]); - DbgPrint("prTxCtrl->rTc.aucFreeBufferCount[3]=%d\n", prTxCtrl->rTc.aucFreeBufferCount[3]); - DbgPrint("prTxCtrl->rTc.aucFreeBufferCount[4]=%d\n", prTxCtrl->rTc.aucFreeBufferCount[4]); - DbgPrint("prTxCtrl->rTc.aucFreeBufferCount[5]=%d\n", prTxCtrl->rTc.aucFreeBufferCount[5]); -#endif - ASSERT(prTxCtrl->rTc.aucFreeBufferCount[TC0_INDEX] <= prTxCtrl->rTc.aucMaxNumOfBuffer[TC0_INDEX]); - ASSERT(prTxCtrl->rTc.aucFreeBufferCount[TC1_INDEX] <= prTxCtrl->rTc.aucMaxNumOfBuffer[TC1_INDEX]); - ASSERT(prTxCtrl->rTc.aucFreeBufferCount[TC2_INDEX] <= prTxCtrl->rTc.aucMaxNumOfBuffer[TC2_INDEX]); - ASSERT(prTxCtrl->rTc.aucFreeBufferCount[TC3_INDEX] <= prTxCtrl->rTc.aucMaxNumOfBuffer[TC3_INDEX]); - ASSERT(prTxCtrl->rTc.aucFreeBufferCount[TC4_INDEX] <= prTxCtrl->rTc.aucMaxNumOfBuffer[TC4_INDEX]); - ASSERT(prTxCtrl->rTc.aucFreeBufferCount[TC5_INDEX] <= prTxCtrl->rTc.aucMaxNumOfBuffer[TC5_INDEX]); - bStatus = TRUE; - } - - return bStatus; -} /* end of nicTxReleaseResource() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Reset TC Buffer Count to initialized value -* -* \param[in] prAdapter Pointer to the Adapter structure. -* -* @return WLAN_STATUS_SUCCESS -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicTxResetResource ( - IN P_ADAPTER_T prAdapter - ) -{ - P_TX_CTRL_T prTxCtrl; - - KAL_SPIN_LOCK_DECLARATION(); - - DEBUGFUNC("nicTxResetResource"); - - ASSERT(prAdapter); - prTxCtrl = &prAdapter->rTxCtrl; - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_RESOURCE); - - prTxCtrl->rTc.aucMaxNumOfBuffer[TC0_INDEX] = NIC_TX_BUFF_COUNT_TC0; - prTxCtrl->rTc.aucFreeBufferCount[TC0_INDEX] = NIC_TX_BUFF_COUNT_TC0; - - prTxCtrl->rTc.aucMaxNumOfBuffer[TC1_INDEX] = NIC_TX_BUFF_COUNT_TC1; - prTxCtrl->rTc.aucFreeBufferCount[TC1_INDEX] = NIC_TX_BUFF_COUNT_TC1; - - prTxCtrl->rTc.aucMaxNumOfBuffer[TC2_INDEX] = NIC_TX_BUFF_COUNT_TC2; - prTxCtrl->rTc.aucFreeBufferCount[TC2_INDEX] = NIC_TX_BUFF_COUNT_TC2; - - prTxCtrl->rTc.aucMaxNumOfBuffer[TC3_INDEX] = NIC_TX_BUFF_COUNT_TC3; - prTxCtrl->rTc.aucFreeBufferCount[TC3_INDEX] = NIC_TX_BUFF_COUNT_TC3; - - prTxCtrl->rTc.aucMaxNumOfBuffer[TC4_INDEX] = NIC_TX_BUFF_COUNT_TC4; - prTxCtrl->rTc.aucFreeBufferCount[TC4_INDEX] = NIC_TX_BUFF_COUNT_TC4; - - prTxCtrl->rTc.aucMaxNumOfBuffer[TC5_INDEX] = NIC_TX_BUFF_COUNT_TC5; - prTxCtrl->rTc.aucFreeBufferCount[TC5_INDEX] = NIC_TX_BUFF_COUNT_TC5; - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_RESOURCE); - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Driver maintain a variable that is synchronous with the usage of individual -* TC Buffer Count. This function will return the value for other component -* which needs this information for making decisions -* -* @param prAdapter Pointer to the Adapter structure. -* @param ucTC Specify the resource of TC -* -* @retval UINT_8 The number of corresponding TC number -*/ -/*----------------------------------------------------------------------------*/ -UINT_8 -nicTxGetResource ( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucTC - ) -{ - P_TX_CTRL_T prTxCtrl; - - ASSERT(prAdapter); - prTxCtrl = &prAdapter->rTxCtrl; - - ASSERT(prTxCtrl); - - if (ucTC >= TC_NUM) { - return 0; - } - else { - return prTxCtrl->rTc.aucFreeBufferCount[ucTC]; - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief In this function, we'll aggregate frame(PACKET_INFO_T) -* corresponding to HIF TX port -* -* @param prAdapter Pointer to the Adapter structure. -* @param prMsduInfoListHead a link list of P_MSDU_INFO_T -* -* @retval WLAN_STATUS_SUCCESS Bus access ok. -* @retval WLAN_STATUS_FAILURE Bus access fail. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicTxMsduInfoList ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfoListHead - ) -{ - P_MSDU_INFO_T prMsduInfo, prNextMsduInfo; - QUE_T qDataPort0, qDataPort1; - WLAN_STATUS status; - - ASSERT(prAdapter); - ASSERT(prMsduInfoListHead); - - prMsduInfo = prMsduInfoListHead; - - QUEUE_INITIALIZE(&qDataPort0); - QUEUE_INITIALIZE(&qDataPort1); - - // Separate MSDU_INFO_T lists into 2 categories: for Port#0 & Port#1 - while(prMsduInfo) { - prNextMsduInfo = (P_MSDU_INFO_T)QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T)prMsduInfo); -#if DBG && 0 - LOG_FUNC("nicTxMsduInfoList Acquire TC %d net %u mac len %u len %u Type %u 1x %u 11 %u\n", - prMsduInfo->ucTC, - prMsduInfo->ucNetworkType, - prMsduInfo->ucMacHeaderLength, - prMsduInfo->u2FrameLength, - prMsduInfo->ucPacketType, - prMsduInfo->fgIs802_1x, - prMsduInfo->fgIs802_11 ); - - LOG_FUNC("Dest Mac: " MACSTR "\n", - MAC2STR(prMsduInfo->aucEthDestAddr)); -#endif - - switch(prMsduInfo->ucTC) { - case TC0_INDEX: - case TC1_INDEX: - case TC2_INDEX: - case TC3_INDEX: - case TC5_INDEX: // Broadcast/multicast data packets - QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T)prMsduInfo) = NULL; - QUEUE_INSERT_TAIL(&qDataPort0, (P_QUE_ENTRY_T)prMsduInfo); - status = nicTxAcquireResource(prAdapter, prMsduInfo->ucTC); - ASSERT(status == WLAN_STATUS_SUCCESS) - - break; - - case TC4_INDEX: // Command or 802.1x packets - QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T)prMsduInfo) = NULL; - QUEUE_INSERT_TAIL(&qDataPort1, (P_QUE_ENTRY_T)prMsduInfo); - - status = nicTxAcquireResource(prAdapter, prMsduInfo->ucTC); - ASSERT(status == WLAN_STATUS_SUCCESS) - - break; - - default: - ASSERT(0); - break; - } - - prMsduInfo = prNextMsduInfo; - } - - if(qDataPort0.u4NumElem > 0) { - nicTxMsduQueue(prAdapter, 0, &qDataPort0); - } - - if(qDataPort1.u4NumElem > 0) { - nicTxMsduQueue(prAdapter, 1, &qDataPort1); - } - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief In this function, we'll write frame(PACKET_INFO_T) into HIF. -* -* @param prAdapter Pointer to the Adapter structure. -* @param ucPortIdx Port Number -* @param prQue a link list of P_MSDU_INFO_T -* -* @retval WLAN_STATUS_SUCCESS Bus access ok. -* @retval WLAN_STATUS_FAILURE Bus access fail. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicTxMsduQueue ( - IN P_ADAPTER_T prAdapter, - UINT_8 ucPortIdx, - P_QUE_T prQue - ) -{ - P_MSDU_INFO_T prMsduInfo, prNextMsduInfo; - HIF_TX_HEADER_T rHwTxHeader; - P_NATIVE_PACKET prNativePacket; - UINT_16 u2OverallBufferLength; - UINT_8 ucEtherTypeOffsetInWord; - PUINT_8 pucOutputBuf = (PUINT_8)NULL; /* Pointer to Transmit Data Structure Frame */ - UINT_32 u4TxHdrSize; - UINT_32 u4ValidBufSize; - UINT_32 u4TotalLength; - P_TX_CTRL_T prTxCtrl; - QUE_T rFreeQueue; -#if CFG_TCP_IP_CHKSUM_OFFLOAD - UINT_8 ucChksumFlag; -#endif - - ASSERT(prAdapter); - ASSERT(ucPortIdx < 2); - ASSERT(prQue); - - prTxCtrl = &prAdapter->rTxCtrl; - u4ValidBufSize = prAdapter->u4CoalescingBufCachedSize; - -#if CFG_HIF_STATISTICS - prTxCtrl->u4TotalTxAccessNum++; - prTxCtrl->u4TotalTxPacketNum += prQue->u4NumElem; -#endif - - QUEUE_INITIALIZE(&rFreeQueue); - - if(prQue->u4NumElem > 0) { - prMsduInfo = (P_MSDU_INFO_T)QUEUE_GET_HEAD(prQue); - pucOutputBuf = prTxCtrl->pucTxCoalescingBufPtr; - u4TotalLength = 0; - - while(prMsduInfo) { - - // DBGLOG(TX, TRACE, ("SN %d, len %d\n", prMsduInfo->ucTxSeqNum, prMsduInfo->u2FrameLength)); - - kalMemZero(&rHwTxHeader, sizeof(rHwTxHeader)); - - prNativePacket = prMsduInfo->prPacket; - - ASSERT(prNativePacket); - - u4TxHdrSize = TX_HDR_SIZE; - - u2OverallBufferLength = ((prMsduInfo->u2FrameLength + TX_HDR_SIZE) & - (UINT_16)HIF_TX_HDR_TX_BYTE_COUNT_MASK); - - rHwTxHeader.u2TxByteCount_UserPriority = u2OverallBufferLength; - rHwTxHeader.u2TxByteCount_UserPriority |= - ((UINT_16)prMsduInfo->ucUserPriority << HIF_TX_HDR_USER_PRIORITY_OFFSET); - - if (prMsduInfo->fgIs802_11) { - ucEtherTypeOffsetInWord = - (TX_HDR_SIZE + prMsduInfo->ucMacHeaderLength + prMsduInfo->ucLlcLength) >> 1; - } - else { - ucEtherTypeOffsetInWord = - ((ETHER_HEADER_LEN - ETHER_TYPE_LEN) + TX_HDR_SIZE) >> 1; - } - - rHwTxHeader.ucEtherTypeOffset = - ucEtherTypeOffsetInWord & HIF_TX_HDR_ETHER_TYPE_OFFSET_MASK; - - rHwTxHeader.ucResource_PktType_CSflags = (prMsduInfo->ucTC) << HIF_TX_HDR_RESOURCE_OFFSET; - rHwTxHeader.ucResource_PktType_CSflags |= - (UINT_8)(((prMsduInfo->ucPacketType) << HIF_TX_HDR_PACKET_TYPE_OFFSET) & - (HIF_TX_HDR_PACKET_TYPE_MASK)); - -#if CFG_TCP_IP_CHKSUM_OFFLOAD - if (prMsduInfo->eSrc == TX_PACKET_OS - || prMsduInfo->eSrc == TX_PACKET_FORWARDING) { - if (prAdapter->u4CSUMFlags & - (CSUM_OFFLOAD_EN_TX_TCP | - CSUM_OFFLOAD_EN_TX_UDP | - CSUM_OFFLOAD_EN_TX_IP)) { - kalQueryTxChksumOffloadParam(prNativePacket, &ucChksumFlag); - - if (ucChksumFlag & TX_CS_IP_GEN) { - rHwTxHeader.ucResource_PktType_CSflags |= (UINT_8)HIF_TX_HDR_IP_CSUM; - } - - if (ucChksumFlag & TX_CS_TCP_UDP_GEN) { - rHwTxHeader.ucResource_PktType_CSflags |= (UINT_8)HIF_TX_HDR_TCP_CSUM; - } - } - } -#endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */ - - rHwTxHeader.u2LLH = prMsduInfo->u2PalLLH; - rHwTxHeader.ucStaRecIdx = prMsduInfo->ucStaRecIndex; - rHwTxHeader.ucForwardingType_SessionID_Reserved = - (prMsduInfo->ucPsForwardingType) | ((prMsduInfo->ucPsSessionID) << HIF_TX_HDR_PS_SESSION_ID_OFFSET) - | ((prMsduInfo->fgIsBurstEnd)? HIF_TX_HDR_BURST_END_MASK : 0); - - rHwTxHeader.ucWlanHeaderLength = (prMsduInfo->ucMacHeaderLength & HIF_TX_HDR_WLAN_HEADER_LEN_MASK); - rHwTxHeader.ucPktFormtId_Flags = - (prMsduInfo->ucFormatID & HIF_TX_HDR_FORMAT_ID_MASK) - | ((prMsduInfo->ucNetworkType << HIF_TX_HDR_NETWORK_TYPE_OFFSET) & HIF_TX_HDR_NETWORK_TYPE_MASK) - | ((prMsduInfo->fgIs802_1x << HIF_TX_HDR_FLAG_1X_FRAME_OFFSET) & HIF_TX_HDR_FLAG_1X_FRAME_MASK) - | ((prMsduInfo->fgIs802_11 << HIF_TX_HDR_FLAG_802_11_FORMAT_OFFSET) & HIF_TX_HDR_FLAG_802_11_FORMAT_MASK); - - rHwTxHeader.u2SeqNo = prMsduInfo->u2AclSN; - - if(prMsduInfo->pfTxDoneHandler) { - rHwTxHeader.ucPacketSeqNo = prMsduInfo->ucTxSeqNum; - rHwTxHeader.ucAck_BIP_BasicRate = HIF_TX_HDR_NEED_ACK; - } - else { - rHwTxHeader.ucPacketSeqNo = 0; - rHwTxHeader.ucAck_BIP_BasicRate = 0; - } - - if(prMsduInfo->fgIsBIP) { - rHwTxHeader.ucAck_BIP_BasicRate |= HIF_TX_HDR_BIP; - } - - if(prMsduInfo->fgIsBasicRate) { - rHwTxHeader.ucAck_BIP_BasicRate |= HIF_TX_HDR_BASIC_RATE; - } - -#if CFG_SDIO_TX_AGG - // attach to coalescing buffer - kalMemCopy(pucOutputBuf + u4TotalLength, &rHwTxHeader, u4TxHdrSize); - u4TotalLength += u4TxHdrSize; - - if (prMsduInfo->eSrc == TX_PACKET_OS - || prMsduInfo->eSrc == TX_PACKET_FORWARDING) { - kalCopyFrame(prAdapter->prGlueInfo, - prNativePacket, - pucOutputBuf + u4TotalLength); - } - else if(prMsduInfo->eSrc == TX_PACKET_MGMT) { - kalMemCopy(pucOutputBuf + u4TotalLength, - prNativePacket, - prMsduInfo->u2FrameLength); - } - else { - ASSERT(0); - } - - u4TotalLength += ALIGN_4(prMsduInfo->u2FrameLength); - -#else - kalMemCopy(pucOutputBuf, &rHwTxHeader, u4TxHdrSize); - - /* Copy Frame Body */ - if (prMsduInfo->eSrc == TX_PACKET_OS - || prMsduInfo->eSrc == TX_PACKET_FORWARDING) { - kalCopyFrame(prAdapter->prGlueInfo, - prNativePacket, - pucOutputBuf + u4TxHdrSize); - } - else if(prMsduInfo->eSrc == TX_PACKET_MGMT) { - kalMemCopy(pucOutputBuf + u4TxHdrSize, - prNativePacket, - prMsduInfo->u2FrameLength); - } - else { - ASSERT(0); - } - - ASSERT(u2OverallBufferLength <= u4ValidBufSize); - - HAL_WRITE_TX_PORT(prAdapter, - ucPortIdx, - (UINT_32)u2OverallBufferLength, - (PUINT_8)pucOutputBuf, - u4ValidBufSize); - - // send immediately -#endif - prNextMsduInfo = (P_MSDU_INFO_T) - QUEUE_GET_NEXT_ENTRY(&prMsduInfo->rQueEntry); - - if (prMsduInfo->eSrc == TX_PACKET_MGMT) { - GLUE_DEC_REF_CNT(prTxCtrl->i4TxMgmtPendingNum); - - if (prMsduInfo->pfTxDoneHandler == NULL) { - cnmMgtPktFree(prAdapter, prMsduInfo); - } - else { - KAL_SPIN_LOCK_DECLARATION(); - DBGLOG(INIT, TRACE,("Wait TxSeqNum:%d\n", prMsduInfo->ucTxSeqNum)); - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TXING_MGMT_LIST); - QUEUE_INSERT_TAIL(&(prTxCtrl->rTxMgmtTxingQueue), (P_QUE_ENTRY_T)prMsduInfo); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TXING_MGMT_LIST); - } - } - else { - /* only free MSDU when it is not a MGMT frame */ - QUEUE_INSERT_TAIL(&rFreeQueue, (P_QUE_ENTRY_T)prMsduInfo); - - if (prMsduInfo->eSrc == TX_PACKET_OS) { - kalSendComplete(prAdapter->prGlueInfo, - prNativePacket, - WLAN_STATUS_SUCCESS); - } - else if(prMsduInfo->eSrc == TX_PACKET_FORWARDING) { - GLUE_DEC_REF_CNT(prTxCtrl->i4PendingFwdFrameCount); - } - } - - prMsduInfo = prNextMsduInfo; - } - -#if CFG_SDIO_TX_AGG - ASSERT(u4TotalLength <= u4ValidBufSize); - - #if CFG_DBG_GPIO_PINS - { - /* Start port write */ - mtk_wcn_stp_debug_gpio_assert(IDX_TX_PORT_WRITE, DBG_TIE_LOW); - kalUdelay(1); - mtk_wcn_stp_debug_gpio_assert(IDX_TX_PORT_WRITE, DBG_TIE_HIGH); - } - #endif - - // send coalescing buffer - HAL_WRITE_TX_PORT(prAdapter, - ucPortIdx, - u4TotalLength, - (PUINT_8)pucOutputBuf, - u4ValidBufSize); -#endif - - // return - nicTxReturnMsduInfo(prAdapter, (P_MSDU_INFO_T)QUEUE_GET_HEAD(&rFreeQueue)); - } - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief In this function, we'll write Command(CMD_INFO_T) into HIF. -* -* @param prAdapter Pointer to the Adapter structure. -* @param prPacketInfo Pointer of CMD_INFO_T -* @param ucTC Specify the resource of TC -* -* @retval WLAN_STATUS_SUCCESS Bus access ok. -* @retval WLAN_STATUS_FAILURE Bus access fail. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicTxCmd ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN UINT_8 ucTC - ) -{ - P_WIFI_CMD_T prWifiCmd; - UINT_16 u2OverallBufferLength; - PUINT_8 pucOutputBuf = (PUINT_8)NULL; /* Pointer to Transmit Data Structure Frame */ - UINT_8 ucPortIdx; - HIF_TX_HEADER_T rHwTxHeader; - P_NATIVE_PACKET prNativePacket; - UINT_8 ucEtherTypeOffsetInWord; - P_MSDU_INFO_T prMsduInfo; - P_TX_CTRL_T prTxCtrl; - - KAL_SPIN_LOCK_DECLARATION(); - - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - - prTxCtrl = &prAdapter->rTxCtrl; - pucOutputBuf = prTxCtrl->pucTxCoalescingBufPtr; - - // <1> Assign Data Port - if (ucTC != TC4_INDEX) { - ucPortIdx = 0; - } - else { - // Broadcast/multicast data frames, 1x frames, command packets, MMPDU - ucPortIdx = 1; - } - - if(prCmdInfo->eCmdType == COMMAND_TYPE_SECURITY_FRAME) { - // <2> Compose HIF_TX_HEADER - kalMemZero(&rHwTxHeader, sizeof(rHwTxHeader)); - - prNativePacket = prCmdInfo->prPacket; - - ASSERT(prNativePacket); - - u2OverallBufferLength = TFCB_FRAME_PAD_TO_DW((prCmdInfo->u2InfoBufLen + TX_HDR_SIZE) - & (UINT_16)HIF_TX_HDR_TX_BYTE_COUNT_MASK); - - rHwTxHeader.u2TxByteCount_UserPriority = ((prCmdInfo->u2InfoBufLen + TX_HDR_SIZE) - & (UINT_16)HIF_TX_HDR_TX_BYTE_COUNT_MASK); - ucEtherTypeOffsetInWord = ((ETHER_HEADER_LEN - ETHER_TYPE_LEN) + TX_HDR_SIZE) >> 1; - - rHwTxHeader.ucEtherTypeOffset = - ucEtherTypeOffsetInWord & HIF_TX_HDR_ETHER_TYPE_OFFSET_MASK; - - rHwTxHeader.ucResource_PktType_CSflags = (ucTC << HIF_TX_HDR_RESOURCE_OFFSET); - - rHwTxHeader.ucStaRecIdx = prCmdInfo->ucStaRecIndex; - rHwTxHeader.ucForwardingType_SessionID_Reserved = HIF_TX_HDR_BURST_END_MASK; - - rHwTxHeader.ucWlanHeaderLength = (ETH_HLEN & HIF_TX_HDR_WLAN_HEADER_LEN_MASK); - rHwTxHeader.ucPktFormtId_Flags = - (((UINT_8)(prCmdInfo->eNetworkType) << HIF_TX_HDR_NETWORK_TYPE_OFFSET) & HIF_TX_HDR_NETWORK_TYPE_MASK) - | ((1 << HIF_TX_HDR_FLAG_1X_FRAME_OFFSET) & HIF_TX_HDR_FLAG_1X_FRAME_MASK); - - rHwTxHeader.u2SeqNo = 0; - rHwTxHeader.ucPacketSeqNo = 0; - rHwTxHeader.ucAck_BIP_BasicRate = 0; - - // <2.3> Copy HIF TX HEADER - kalMemCopy((PVOID)&pucOutputBuf[0], (PVOID)&rHwTxHeader, TX_HDR_SIZE); - - // <3> Copy Frame Body Copy - kalCopyFrame(prAdapter->prGlueInfo, - prNativePacket, - pucOutputBuf + TX_HDR_SIZE); - } - else if(prCmdInfo->eCmdType == COMMAND_TYPE_MANAGEMENT_FRAME) { - prMsduInfo = (P_MSDU_INFO_T)prCmdInfo->prPacket; - - ASSERT(prMsduInfo->fgIs802_11 == TRUE); - ASSERT(prMsduInfo->eSrc == TX_PACKET_MGMT); - - // <2> Compose HIF_TX_HEADER - kalMemZero(&rHwTxHeader, sizeof(rHwTxHeader)); - - u2OverallBufferLength = ((prMsduInfo->u2FrameLength + TX_HDR_SIZE) & - (UINT_16)HIF_TX_HDR_TX_BYTE_COUNT_MASK); - - rHwTxHeader.u2TxByteCount_UserPriority = u2OverallBufferLength; - rHwTxHeader.u2TxByteCount_UserPriority |= - ((UINT_16)prMsduInfo->ucUserPriority << HIF_TX_HDR_USER_PRIORITY_OFFSET); - - ucEtherTypeOffsetInWord = - (TX_HDR_SIZE + prMsduInfo->ucMacHeaderLength + prMsduInfo->ucLlcLength) >> 1; - - rHwTxHeader.ucEtherTypeOffset = - ucEtherTypeOffsetInWord & HIF_TX_HDR_ETHER_TYPE_OFFSET_MASK; - - rHwTxHeader.ucResource_PktType_CSflags = (prMsduInfo->ucTC) << HIF_TX_HDR_RESOURCE_OFFSET; - rHwTxHeader.ucResource_PktType_CSflags |= - (UINT_8)(((prMsduInfo->ucPacketType) << HIF_TX_HDR_PACKET_TYPE_OFFSET) & - (HIF_TX_HDR_PACKET_TYPE_MASK)); - - rHwTxHeader.u2LLH = prMsduInfo->u2PalLLH; - rHwTxHeader.ucStaRecIdx = prMsduInfo->ucStaRecIndex; - rHwTxHeader.ucForwardingType_SessionID_Reserved = - (prMsduInfo->ucPsForwardingType) | ((prMsduInfo->ucPsSessionID) << HIF_TX_HDR_PS_SESSION_ID_OFFSET) - | ((prMsduInfo->fgIsBurstEnd)? HIF_TX_HDR_BURST_END_MASK : 0); - - rHwTxHeader.ucWlanHeaderLength = (prMsduInfo->ucMacHeaderLength & HIF_TX_HDR_WLAN_HEADER_LEN_MASK); - rHwTxHeader.ucPktFormtId_Flags = - (prMsduInfo->ucFormatID & HIF_TX_HDR_FORMAT_ID_MASK) - | ((prMsduInfo->ucNetworkType << HIF_TX_HDR_NETWORK_TYPE_OFFSET) & HIF_TX_HDR_NETWORK_TYPE_MASK) - | ((prMsduInfo->fgIs802_1x << HIF_TX_HDR_FLAG_1X_FRAME_OFFSET) & HIF_TX_HDR_FLAG_1X_FRAME_MASK) - | ((prMsduInfo->fgIs802_11 << HIF_TX_HDR_FLAG_802_11_FORMAT_OFFSET) & HIF_TX_HDR_FLAG_802_11_FORMAT_MASK); - - rHwTxHeader.u2SeqNo = prMsduInfo->u2AclSN; - - if(prMsduInfo->pfTxDoneHandler) { - rHwTxHeader.ucPacketSeqNo = prMsduInfo->ucTxSeqNum; - rHwTxHeader.ucAck_BIP_BasicRate = HIF_TX_HDR_NEED_ACK; - } - else { - rHwTxHeader.ucPacketSeqNo = 0; - rHwTxHeader.ucAck_BIP_BasicRate = 0; - } - - if(prMsduInfo->fgIsBIP) { - rHwTxHeader.ucAck_BIP_BasicRate |= HIF_TX_HDR_BIP; - } - - if(prMsduInfo->fgIsBasicRate) { - rHwTxHeader.ucAck_BIP_BasicRate |= HIF_TX_HDR_BASIC_RATE; - } - - // <2.3> Copy HIF TX HEADER - kalMemCopy((PVOID)&pucOutputBuf[0], (PVOID)&rHwTxHeader, TX_HDR_SIZE); - - // <3> Copy Frame Body - kalMemCopy(pucOutputBuf + TX_HDR_SIZE, - prMsduInfo->prPacket, - prMsduInfo->u2FrameLength); - - // <4> Management Frame Post-Processing - GLUE_DEC_REF_CNT(prTxCtrl->i4TxMgmtPendingNum); - - if (prMsduInfo->pfTxDoneHandler == NULL) { - cnmMgtPktFree(prAdapter, prMsduInfo); - } - else { - - DBGLOG(INIT, TRACE,("Wait Cmd TxSeqNum:%d\n", prMsduInfo->ucTxSeqNum)); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TXING_MGMT_LIST); - QUEUE_INSERT_TAIL(&(prTxCtrl->rTxMgmtTxingQueue), (P_QUE_ENTRY_T)prMsduInfo); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TXING_MGMT_LIST); - } - } - else { - prWifiCmd = (P_WIFI_CMD_T)prCmdInfo->pucInfoBuffer; - - // <2> Compose the Header of Transmit Data Structure for CMD Packet - u2OverallBufferLength = TFCB_FRAME_PAD_TO_DW( - (prCmdInfo->u2InfoBufLen) & (UINT_16)HIF_TX_HDR_TX_BYTE_COUNT_MASK); - - prWifiCmd->u2TxByteCount_UserPriority = u2OverallBufferLength; - prWifiCmd->ucEtherTypeOffset = 0; - prWifiCmd->ucResource_PktType_CSflags = (ucTC << HIF_TX_HDR_RESOURCE_OFFSET) - | (UINT_8)((HIF_TX_PKT_TYPE_CMD << HIF_TX_HDR_PACKET_TYPE_OFFSET) & (HIF_TX_HDR_PACKET_TYPE_MASK)); - - - // <3> Copy CMD Header to command buffer (by using pucCoalescingBufCached) - kalMemCopy((PVOID)&pucOutputBuf[0], - (PVOID)prCmdInfo->pucInfoBuffer, - prCmdInfo->u2InfoBufLen); - - ASSERT(u2OverallBufferLength <= prAdapter->u4CoalescingBufCachedSize); - } - - // <4> Write frame to data port - HAL_WRITE_TX_PORT(prAdapter, - ucPortIdx, - (UINT_32)u2OverallBufferLength, - (PUINT_8)pucOutputBuf, - (UINT_32)prAdapter->u4CoalescingBufCachedSize); - - return WLAN_STATUS_SUCCESS; -} /* end of nicTxCmd() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function will clean up all the pending frames in internal SW Queues -* by return the pending TX packet to the system. -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicTxRelease ( - IN P_ADAPTER_T prAdapter - ) -{ - P_TX_CTRL_T prTxCtrl; - P_MSDU_INFO_T prMsduInfo; - - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - prTxCtrl = &prAdapter->rTxCtrl; - - nicTxFlush(prAdapter); - - // free MSDU_INFO_T from rTxMgmtMsduInfoList - do { - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TXING_MGMT_LIST); - QUEUE_REMOVE_HEAD(&prTxCtrl->rTxMgmtTxingQueue, prMsduInfo, P_MSDU_INFO_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TXING_MGMT_LIST); - - if(prMsduInfo) { - // the packet must be mgmt frame with tx done callback - ASSERT(prMsduInfo->eSrc == TX_PACKET_MGMT); - ASSERT(prMsduInfo->pfTxDoneHandler != NULL); - - // invoke done handler - prMsduInfo->pfTxDoneHandler(prAdapter, prMsduInfo, TX_RESULT_LIFE_TIMEOUT); - - cnmMgtPktFree(prAdapter, prMsduInfo); - } - else { - break; - } - } while(TRUE); - - return; -} /* end of nicTxRelease() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Process the TX Done interrupt and pull in more pending frames in SW -* Queues for transmission. -* -* @param prAdapter Pointer to the Adapter structure. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicProcessTxInterrupt( - IN P_ADAPTER_T prAdapter - ) -{ - P_TX_CTRL_T prTxCtrl; -#if CFG_SDIO_INTR_ENHANCE - P_SDIO_CTRL_T prSDIOCtrl; -#else - UINT_32 au4TxCount[2]; -#endif /* CFG_SDIO_INTR_ENHANCE */ - - ASSERT(prAdapter); - - prTxCtrl = &prAdapter->rTxCtrl; - ASSERT(prTxCtrl); - - /* Get the TX STATUS */ -#if CFG_SDIO_INTR_ENHANCE - - prSDIOCtrl = prAdapter->prSDIOCtrl; - #if DBG - //dumpMemory8((PUINT_8)prSDIOCtrl, sizeof(SDIO_CTRL_T)); - #endif - - nicTxReleaseResource(prAdapter, (PUINT_8)&prSDIOCtrl->rTxInfo); - kalMemZero(&prSDIOCtrl->rTxInfo, sizeof(prSDIOCtrl->rTxInfo)); - -#else - - HAL_MCR_RD(prAdapter, MCR_WTSR0, &au4TxCount[0]); - HAL_MCR_RD(prAdapter, MCR_WTSR1, &au4TxCount[1]); - DBGLOG(EMU, TRACE, ("MCR_WTSR0: 0x%x, MCR_WTSR1: 0x%x\n", au4TxCount[0], au4TxCount[1])); - - nicTxReleaseResource(prAdapter, (PUINT_8)au4TxCount); - -#endif /* CFG_SDIO_INTR_ENHANCE */ - - nicTxAdjustTcq(prAdapter); - - // Indicate Service Thread - if(kalGetTxPendingCmdCount(prAdapter->prGlueInfo) > 0 - || wlanGetTxPendingFrameCount(prAdapter) > 0) { - kalSetEvent(prAdapter->prGlueInfo); - } - - return; -} /* end of nicProcessTxInterrupt() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief this function frees packet of P_MSDU_INFO_T linked-list -* -* @param prAdapter Pointer to the Adapter structure. -* @param prMsduInfoList a link list of P_MSDU_INFO_T -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicTxFreeMsduInfoPacket ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfoListHead - ) -{ - P_NATIVE_PACKET prNativePacket; - P_MSDU_INFO_T prMsduInfo = prMsduInfoListHead; - P_TX_CTRL_T prTxCtrl; - - - ASSERT(prAdapter); - ASSERT(prMsduInfoListHead); - - prTxCtrl = &prAdapter->rTxCtrl; - - while(prMsduInfo) { - prNativePacket = prMsduInfo->prPacket; - - if(prMsduInfo->eSrc == TX_PACKET_OS) { - kalSendComplete(prAdapter->prGlueInfo, - prNativePacket, - WLAN_STATUS_FAILURE); - } - else if(prMsduInfo->eSrc == TX_PACKET_MGMT) { - if (prMsduInfo->pfTxDoneHandler) { - prMsduInfo->pfTxDoneHandler(prAdapter, prMsduInfo, TX_RESULT_DROPPED_IN_DRIVER); - } - cnmMemFree(prAdapter, prNativePacket); - } - else if(prMsduInfo->eSrc == TX_PACKET_FORWARDING) { - GLUE_DEC_REF_CNT(prTxCtrl->i4PendingFwdFrameCount); - } - - prMsduInfo = (P_MSDU_INFO_T)QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T)prMsduInfo); - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief this function returns P_MSDU_INFO_T of MsduInfoList to TxCtrl->rfreeMsduInfoList -* -* @param prAdapter Pointer to the Adapter structure. -* @param prMsduInfoList a link list of P_MSDU_INFO_T -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicTxReturnMsduInfo ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfoListHead - ) -{ - P_TX_CTRL_T prTxCtrl; - P_MSDU_INFO_T prMsduInfo = prMsduInfoListHead, prNextMsduInfo; - - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - prTxCtrl = &prAdapter->rTxCtrl; - ASSERT(prTxCtrl); - - while(prMsduInfo) { - prNextMsduInfo = (P_MSDU_INFO_T)QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T)prMsduInfo); - - switch(prMsduInfo->eSrc) { - case TX_PACKET_FORWARDING: - wlanReturnPacket(prAdapter, prMsduInfo->prPacket); - break; - case TX_PACKET_OS: - case TX_PACKET_OS_OID: - case TX_PACKET_MGMT: - default: - break; - } - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST); - QUEUE_INSERT_TAIL(&prTxCtrl->rFreeMsduInfoList, (P_QUE_ENTRY_T)prMsduInfo); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_MSDU_INFO_LIST); - prMsduInfo = prNextMsduInfo; - }; - - return; -} - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief this function fills packet information to P_MSDU_INFO_T -* -* @param prAdapter Pointer to the Adapter structure. -* @param prMsduInfo P_MSDU_INFO_T -* @param prPacket P_NATIVE_PACKET -* -* @retval TRUE Success to extract information -* @retval FALSE Fail to extract correct information -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -nicTxFillMsduInfo ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo, - IN P_NATIVE_PACKET prPacket - ) -{ - P_GLUE_INFO_T prGlueInfo; - UINT_8 ucPriorityParam; - UINT_8 ucMacHeaderLen; - UINT_8 aucEthDestAddr[PARAM_MAC_ADDR_LEN]; - BOOLEAN fgIs1x = FALSE; - BOOLEAN fgIsPAL = FALSE; - UINT_32 u4PacketLen; - ULONG u4SysTime; - UINT_8 ucNetworkType; - - - ASSERT(prAdapter); - - prGlueInfo = prAdapter->prGlueInfo; - ASSERT(prGlueInfo); - - if (kalQoSFrameClassifierAndPacketInfo(prGlueInfo, - prPacket, - &ucPriorityParam, - &u4PacketLen, - aucEthDestAddr, - &fgIs1x, - &fgIsPAL, - &ucNetworkType) == FALSE) { - return FALSE; - } - - /* Save the value of Priority Parameter */ - GLUE_SET_PKT_TID(prPacket, ucPriorityParam); - - if (fgIs1x) { - GLUE_SET_PKT_FLAG_1X(prPacket); - } - - if (fgIsPAL) { - GLUE_SET_PKT_FLAG_PAL(prPacket); - } - - ucMacHeaderLen = ETH_HLEN; - - /* Save the value of Header Length */ - GLUE_SET_PKT_HEADER_LEN(prPacket, ucMacHeaderLen); - - /* Save the value of Frame Length */ - GLUE_SET_PKT_FRAME_LEN(prPacket, (UINT_16)u4PacketLen); - - /* Save the value of Arrival Time*/ - u4SysTime = (OS_SYSTIME)kalGetTimeTick(); - GLUE_SET_PKT_ARRIVAL_TIME(prPacket, u4SysTime); - - prMsduInfo->prPacket = prPacket; - prMsduInfo->fgIs802_1x = fgIs1x; - prMsduInfo->fgIs802_11 = FALSE; - prMsduInfo->ucNetworkType = ucNetworkType; - prMsduInfo->ucUserPriority = ucPriorityParam; - prMsduInfo->ucMacHeaderLength = ucMacHeaderLen; - prMsduInfo->u2FrameLength = (UINT_16)u4PacketLen; - COPY_MAC_ADDR(prMsduInfo->aucEthDestAddr, aucEthDestAddr); - - return TRUE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief this function update TCQ values by passing current status to txAdjustTcQuotas -* -* @param prAdapter Pointer to the Adapter structure. -* -* @retval WLAN_STATUS_SUCCESS Updated successfully -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicTxAdjustTcq ( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 u4Num; - TX_TCQ_ADJUST_T rTcqAdjust; - P_TX_CTRL_T prTxCtrl; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - prTxCtrl = &prAdapter->rTxCtrl; - ASSERT(prTxCtrl); - - qmAdjustTcQuotas(prAdapter, &rTcqAdjust, &prTxCtrl->rTc); - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_RESOURCE); - - for (u4Num = 0 ; u4Num < TC_NUM ; u4Num++) { - prTxCtrl->rTc.aucFreeBufferCount[u4Num] += rTcqAdjust.acVariation[u4Num]; - prTxCtrl->rTc.aucMaxNumOfBuffer[u4Num] += rTcqAdjust.acVariation[u4Num]; - - ASSERT(prTxCtrl->rTc.aucFreeBufferCount[u4Num] >= 0); - ASSERT(prTxCtrl->rTc.aucMaxNumOfBuffer[u4Num] >= 0); - } - - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_TX_RESOURCE); - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief this function flushes all packets queued in STA/AC queue -* -* @param prAdapter Pointer to the Adapter structure. -* -* @retval WLAN_STATUS_SUCCESS Flushed successfully -*/ -/*----------------------------------------------------------------------------*/ - -WLAN_STATUS -nicTxFlush ( - IN P_ADAPTER_T prAdapter - ) -{ - P_MSDU_INFO_T prMsduInfo; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - - // ask Per STA/AC queue to be fllushed and return all queued packets - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_QM_TX_QUEUE); - prMsduInfo = qmFlushTxQueues(prAdapter); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_QM_TX_QUEUE); - - if(prMsduInfo != NULL) { - nicTxFreeMsduInfoPacket(prAdapter, prMsduInfo); - nicTxReturnMsduInfo(prAdapter, prMsduInfo); - } - - return WLAN_STATUS_SUCCESS; -} - - -#if CFG_ENABLE_FW_DOWNLOAD -/*----------------------------------------------------------------------------*/ -/*! -* \brief In this function, we'll write Command(CMD_INFO_T) into HIF. -* However this function is used for INIT_CMD. -* -* In order to avoid further maintainance issues, these 2 functions are separated -* -* @param prAdapter Pointer to the Adapter structure. -* @param prPacketInfo Pointer of CMD_INFO_T -* @param ucTC Specify the resource of TC -* -* @retval WLAN_STATUS_SUCCESS Bus access ok. -* @retval WLAN_STATUS_FAILURE Bus access fail. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicTxInitCmd ( - IN P_ADAPTER_T prAdapter, - IN P_CMD_INFO_T prCmdInfo, - IN UINT_8 ucTC - ) -{ - P_INIT_HIF_TX_HEADER_T prInitTxHeader; - UINT_16 u2OverallBufferLength; - PUINT_8 pucOutputBuf = (PUINT_8)NULL; /* Pointer to Transmit Data Structure Frame */ - UINT_32 ucPortIdx; - P_TX_CTRL_T prTxCtrl; - - ASSERT(prAdapter); - ASSERT(prCmdInfo); - ASSERT(ucTC == TC0_INDEX); - - prTxCtrl = &prAdapter->rTxCtrl; - pucOutputBuf = prTxCtrl->pucTxCoalescingBufPtr; - prInitTxHeader = (P_INIT_HIF_TX_HEADER_T)prCmdInfo->pucInfoBuffer; - - // <1> Compose the Header of Transmit Data Structure for CMD Packet - u2OverallBufferLength = TFCB_FRAME_PAD_TO_DW( - (prCmdInfo->u2InfoBufLen) & (UINT_16)HIF_TX_HDR_TX_BYTE_COUNT_MASK); - - prInitTxHeader->u2TxByteCount = u2OverallBufferLength; - prInitTxHeader->ucEtherTypeOffset = 0; - prInitTxHeader->ucCSflags = 0; - - // <2> Assign Data Port - if (ucTC != TC4_INDEX) { - ucPortIdx = 0; - } - else { // Broadcast/multicast data packets - ucPortIdx = 1; - } - - // <3> Copy CMD Header to command buffer (by using pucCoalescingBufCached) - kalMemCopy((PVOID)&pucOutputBuf[0], - (PVOID)prCmdInfo->pucInfoBuffer, - prCmdInfo->u2InfoBufLen); - - ASSERT(u2OverallBufferLength <= prAdapter->u4CoalescingBufCachedSize); - - // <4> Write frame to data port - HAL_WRITE_TX_PORT(prAdapter, - ucPortIdx, - (UINT_32)u2OverallBufferLength, - (PUINT_8)pucOutputBuf, - (UINT_32)prAdapter->u4CoalescingBufCachedSize); - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief In this function, we'll reset TX resource counter to initial value used -* in F/W download state -* -* @param prAdapter Pointer to the Adapter structure. -* -* @retval WLAN_STATUS_SUCCESS Reset is done successfully. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicTxInitResetResource ( - IN P_ADAPTER_T prAdapter - ) -{ - P_TX_CTRL_T prTxCtrl; - - DEBUGFUNC("nicTxInitResetResource"); - - ASSERT(prAdapter); - prTxCtrl = &prAdapter->rTxCtrl; - - prTxCtrl->rTc.aucMaxNumOfBuffer[TC0_INDEX] = NIC_TX_INIT_BUFF_COUNT_TC0; - prTxCtrl->rTc.aucFreeBufferCount[TC0_INDEX] = NIC_TX_INIT_BUFF_COUNT_TC0; - - prTxCtrl->rTc.aucMaxNumOfBuffer[TC1_INDEX] = NIC_TX_INIT_BUFF_COUNT_TC1; - prTxCtrl->rTc.aucFreeBufferCount[TC1_INDEX] = NIC_TX_INIT_BUFF_COUNT_TC1; - - prTxCtrl->rTc.aucMaxNumOfBuffer[TC2_INDEX] = NIC_TX_INIT_BUFF_COUNT_TC2; - prTxCtrl->rTc.aucFreeBufferCount[TC2_INDEX] = NIC_TX_INIT_BUFF_COUNT_TC2; - - prTxCtrl->rTc.aucMaxNumOfBuffer[TC3_INDEX] = NIC_TX_INIT_BUFF_COUNT_TC3; - prTxCtrl->rTc.aucFreeBufferCount[TC3_INDEX] = NIC_TX_INIT_BUFF_COUNT_TC3; - - prTxCtrl->rTc.aucMaxNumOfBuffer[TC4_INDEX] = NIC_TX_INIT_BUFF_COUNT_TC4; - prTxCtrl->rTc.aucFreeBufferCount[TC4_INDEX] = NIC_TX_INIT_BUFF_COUNT_TC4; - - prTxCtrl->rTc.aucMaxNumOfBuffer[TC5_INDEX] = NIC_TX_INIT_BUFF_COUNT_TC5; - prTxCtrl->rTc.aucFreeBufferCount[TC5_INDEX] = NIC_TX_INIT_BUFF_COUNT_TC5; - - return WLAN_STATUS_SUCCESS; - -} - -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief this function enqueues MSDU_INFO_T into queue management, -* or command queue -* -* @param prAdapter Pointer to the Adapter structure. -* prMsduInfo Pointer to MSDU -* -* @retval WLAN_STATUS_SUCCESS Reset is done successfully. -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -nicTxEnqueueMsdu ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - P_TX_CTRL_T prTxCtrl; - P_MSDU_INFO_T prNextMsduInfo, prRetMsduInfo, prMsduInfoHead; - QUE_T qDataPort0, qDataPort1; - P_CMD_INFO_T prCmdInfo; - WLAN_STATUS u4Status = WLAN_STATUS_SUCCESS; - KAL_SPIN_LOCK_DECLARATION(); - - ASSERT(prAdapter); - ASSERT(prMsduInfo); - - prTxCtrl = &prAdapter->rTxCtrl; - ASSERT(prTxCtrl); - - QUEUE_INITIALIZE(&qDataPort0); - QUEUE_INITIALIZE(&qDataPort1); - - /* check how many management frame are being queued */ - while(prMsduInfo) { - prNextMsduInfo = (P_MSDU_INFO_T)QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T)prMsduInfo); - - QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T)prMsduInfo) = NULL; - - if(prMsduInfo->eSrc == TX_PACKET_MGMT) { - // MMPDU: force stick to TC4 - prMsduInfo->ucTC = TC4_INDEX; - - QUEUE_INSERT_TAIL(&qDataPort1, (P_QUE_ENTRY_T)prMsduInfo); - } - else { - QUEUE_INSERT_TAIL(&qDataPort0, (P_QUE_ENTRY_T)prMsduInfo); - } - - prMsduInfo = prNextMsduInfo; - } - - if(qDataPort0.u4NumElem) { - /* send to QM */ - KAL_SPIN_LOCK_DECLARATION(); - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_QM_TX_QUEUE); - prRetMsduInfo = qmEnqueueTxPackets(prAdapter, (P_MSDU_INFO_T)QUEUE_GET_HEAD(&qDataPort0)); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_QM_TX_QUEUE); - - /* post-process for dropped packets */ - if(prRetMsduInfo != NULL) { // unable to enqueue - nicTxFreeMsduInfoPacket(prAdapter, prRetMsduInfo); - nicTxReturnMsduInfo(prAdapter, prRetMsduInfo); - } - } - - if(qDataPort1.u4NumElem) { - prMsduInfoHead = (P_MSDU_INFO_T)QUEUE_GET_HEAD(&qDataPort1); - - if(qDataPort1.u4NumElem > nicTxGetFreeCmdCount(prAdapter)) { - // not enough descriptors for sending - u4Status = WLAN_STATUS_FAILURE; - - // free all MSDUs - while(prMsduInfoHead) { - prNextMsduInfo = (P_MSDU_INFO_T) QUEUE_GET_NEXT_ENTRY(&prMsduInfoHead->rQueEntry); - - if (prMsduInfoHead->pfTxDoneHandler != NULL) { - prMsduInfoHead->pfTxDoneHandler(prAdapter, prMsduInfoHead, TX_RESULT_DROPPED_IN_DRIVER); - } - - - cnmMgtPktFree(prAdapter, prMsduInfoHead); - - prMsduInfoHead = prNextMsduInfo; - } - } - else { - /* send to command queue */ - while(prMsduInfoHead) { - prNextMsduInfo = (P_MSDU_INFO_T) QUEUE_GET_NEXT_ENTRY(&prMsduInfoHead->rQueEntry); - - KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE); - QUEUE_REMOVE_HEAD(&prAdapter->rFreeCmdList, prCmdInfo, P_CMD_INFO_T); - KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_CMD_RESOURCE); - - if (prCmdInfo) { - GLUE_INC_REF_CNT(prTxCtrl->i4TxMgmtPendingNum); - - kalMemZero(prCmdInfo, sizeof(CMD_INFO_T)); - - prCmdInfo->eCmdType = COMMAND_TYPE_MANAGEMENT_FRAME; - prCmdInfo->u2InfoBufLen = prMsduInfoHead->u2FrameLength; - prCmdInfo->pucInfoBuffer = NULL; - prCmdInfo->prPacket = (P_NATIVE_PACKET)prMsduInfoHead; - prCmdInfo->ucStaRecIndex = prMsduInfoHead->ucStaRecIndex; - prCmdInfo->eNetworkType = prMsduInfoHead->ucNetworkType; - prCmdInfo->pfCmdDoneHandler = NULL; - prCmdInfo->pfCmdTimeoutHandler = NULL; - prCmdInfo->fgIsOid = FALSE; - prCmdInfo->fgSetQuery = TRUE; - prCmdInfo->fgNeedResp = FALSE; - - kalEnqueueCommand(prAdapter->prGlueInfo, (P_QUE_ENTRY_T)prCmdInfo); - } - else { - /* Cmd free count is larger than expected, but allocation fail. */ - ASSERT(0); - - u4Status = WLAN_STATUS_FAILURE; - cnmMgtPktFree(prAdapter, prMsduInfoHead); - } - - prMsduInfoHead = prNextMsduInfo; - } - } - } - - /* indicate service thread for sending */ - if(prTxCtrl->i4TxMgmtPendingNum > 0 - || kalGetTxPendingFrameCount(prAdapter->prGlueInfo) > 0) { - kalSetEvent(prAdapter->prGlueInfo); - } - - return u4Status; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief this function returns available count in command queue -* -* @param prAdapter Pointer to the Adapter structure. -* -* @retval -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -nicTxGetFreeCmdCount ( - IN P_ADAPTER_T prAdapter - ) -{ - ASSERT(prAdapter); - - return prAdapter->rFreeCmdList.u4NumElem; -} - diff --git a/drivers/net/wireless/mt5931/nic/p2p_nic.c b/drivers/net/wireless/mt5931/nic/p2p_nic.c deleted file mode 100755 index 592318b00454..000000000000 --- a/drivers/net/wireless/mt5931/nic/p2p_nic.c +++ /dev/null @@ -1,203 +0,0 @@ -/* -** $Id: @(#) p2p_nic.c@@ -*/ - -/*! \file p2p_nic.c - \brief Wi-Fi Direct Functions that provide operation in NIC's (Network Interface Card) point of view. - - This file includes functions which unite multiple hal(Hardware) operations - and also take the responsibility of Software Resource Management in order - to keep the synchronization with Hardware Manipulation. -*/ - - - - - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief When Probe Rsp & Beacon frame is received and decide a P2P device, -* this function will be invoked to buffer scan result -* -* @param prAdapter Pointer to the Adapter structure. -* @param prEventScanResult Pointer of EVENT_SCAN_RESULT_T. -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -nicRxAddP2pDevice ( - IN P_ADAPTER_T prAdapter, - IN P_EVENT_P2P_DEV_DISCOVER_RESULT_T prP2pResult, - IN PUINT_8 pucRxIEBuf, - IN UINT_16 u2RxIELength - ) -{ - P_P2P_INFO_T prP2pInfo = (P_P2P_INFO_T)NULL; - P_EVENT_P2P_DEV_DISCOVER_RESULT_T prTargetResult = (P_EVENT_P2P_DEV_DISCOVER_RESULT_T)NULL; - UINT_32 u4Idx = 0; - BOOLEAN bUpdate = FALSE; - - PUINT_8 pucIeBuf = (PUINT_8)NULL; - UINT_16 u2IELength = 0; - UINT_8 zeroMac[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; - - ASSERT(prAdapter); - - prP2pInfo = prAdapter->prP2pInfo; - - for (u4Idx = 0; u4Idx < prP2pInfo->u4DeviceNum; u4Idx++) { - prTargetResult = &prP2pInfo->arP2pDiscoverResult[u4Idx]; - - if (EQUAL_MAC_ADDR(prTargetResult->aucDeviceAddr, prP2pResult->aucDeviceAddr)) { - bUpdate = TRUE; - - /* Backup OLD buffer result. */ - pucIeBuf = prTargetResult->pucIeBuf; - u2IELength = prTargetResult->u2IELength; - - /* Update Device Info. */ - // zero - kalMemZero(prTargetResult, sizeof(EVENT_P2P_DEV_DISCOVER_RESULT_T)); - - // then buffer - kalMemCopy(prTargetResult, - (PVOID)prP2pResult, - sizeof(EVENT_P2P_DEV_DISCOVER_RESULT_T)); - - /* See if new IE length is longer or not. */ - if ((u2RxIELength > u2IELength) && (u2IELength != 0)) { - /* Buffer is not enough. */ - u2RxIELength = u2IELength; - } - else if ((u2IELength == 0) && (u2RxIELength != 0)) { - /* RX new IE buf. */ - ASSERT(pucIeBuf == NULL); - pucIeBuf = prP2pInfo->pucCurrIePtr; - - if (((UINT_32)prP2pInfo->pucCurrIePtr + (UINT_32)u2RxIELength) > - (UINT_32)&prP2pInfo->aucCommIePool[CFG_MAX_COMMON_IE_BUF_LEN]) { - /* Common Buffer is no enough. */ - u2RxIELength = (UINT_16)((UINT_32)&prP2pInfo->aucCommIePool[CFG_MAX_COMMON_IE_BUF_LEN] - (UINT_32)prP2pInfo->pucCurrIePtr); - } - - /* Step to next buffer address. */ - prP2pInfo->pucCurrIePtr = (PUINT_8)((UINT_32)prP2pInfo->pucCurrIePtr + (UINT_32)u2RxIELength); - } - - /* Restore buffer pointer. */ - prTargetResult->pucIeBuf = pucIeBuf; - - if (pucRxIEBuf) { - /* If new received IE is availabe. - * Replace the old one & update new IE length. - */ - kalMemCopy(pucIeBuf, pucRxIEBuf, u2RxIELength); - prTargetResult->u2IELength = u2RxIELength; - } - else { - /* There is no new IE information, keep the old one. */ - prTargetResult->u2IELength = u2IELength; - } - } - } - - if (!bUpdate) { - /* We would flush the whole scan result after each scan request is issued. - * If P2P device is too many, it may over the scan list. - */ - if ((u4Idx < CFG_MAX_NUM_BSS_LIST) && (UNEQUAL_MAC_ADDR(zeroMac, prP2pResult->aucDeviceAddr))) { /* whsu:XXX */ - prTargetResult = &prP2pInfo->arP2pDiscoverResult[u4Idx]; - - // zero - kalMemZero(prTargetResult, sizeof(EVENT_P2P_DEV_DISCOVER_RESULT_T)); - - // then buffer - kalMemCopy(prTargetResult, - (PVOID)prP2pResult, - sizeof(EVENT_P2P_DEV_DISCOVER_RESULT_T)); - - //printk("DVC FND %d " MACSTR", " MACSTR "\n", prP2pInfo->u4DeviceNum, MAC2STR(prP2pResult->aucDeviceAddr), MAC2STR(prTargetResult->aucDeviceAddr)); - - if (u2RxIELength) { - prTargetResult->pucIeBuf = prP2pInfo->pucCurrIePtr; - - if (((UINT_32)prP2pInfo->pucCurrIePtr + (UINT_32)u2RxIELength) > - (UINT_32)&prP2pInfo->aucCommIePool[CFG_MAX_COMMON_IE_BUF_LEN]) { - /* Common Buffer is no enough. */ - u2IELength = (UINT_16)((UINT_32)&prP2pInfo->aucCommIePool[CFG_MAX_COMMON_IE_BUF_LEN] - (UINT_32)prP2pInfo->pucCurrIePtr); - } - else { - u2IELength = u2RxIELength; - } - - prP2pInfo->pucCurrIePtr = (PUINT_8)((UINT_32)prP2pInfo->pucCurrIePtr + (UINT_32)u2IELength); - - kalMemCopy((PVOID)prTargetResult->pucIeBuf, (PVOID)pucRxIEBuf, (UINT_32)u2IELength); - prTargetResult->u2IELength = u2IELength; - } - else { - prTargetResult->pucIeBuf = NULL; - prTargetResult->u2IELength = 0; - } - - prP2pInfo->u4DeviceNum++; - - } - else { - // TODO: Fixme to replace an old one. (?) - ASSERT(FALSE); - } - } -} /* nicRxAddP2pDevice */ - - - diff --git a/drivers/net/wireless/mt5931/nic/que_mgt.c b/drivers/net/wireless/mt5931/nic/que_mgt.c deleted file mode 100755 index 74ae5aba8126..000000000000 --- a/drivers/net/wireless/mt5931/nic/que_mgt.c +++ /dev/null @@ -1,4802 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/nic/que_mgt.c#1 $ -*/ - -/*! \file "que_mgt.c" - \brief TX/RX queues management - - The main tasks of queue management include TC-based HIF TX flow control, - adaptive TC quota adjustment, HIF TX grant scheduling, Power-Save - forwarding control, RX packet reordering, and RX BA agreement management. -*/ - - - -/* -** $Log: que_mgt.c $ - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 02 23 2012 eddie.chen - * [WCXRP00001194] [MT6620][DRV/FW] follow admission control bit to change the enqueue rule - * Change the enqueue policy when ACM = 1. - * - * 11 22 2011 yuche.tsai - * NULL - * Code refine, remove one #if 0 code. - * - * 11 19 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Add xlog for tx - * - * 11 18 2011 yuche.tsai - * NULL - * CONFIG P2P support RSSI query, default turned off. - * - * 11 18 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Fix xlog format to hex format - * - * 11 17 2011 tsaiyuan.hsu - * [WCXRP00001115] [MT6620 Wi-Fi][DRV] avoid deactivating staRec when changing state 3 to 3. - * avoid deactivating staRec when changing state from 3 to 3. - * - * 11 11 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * add debug msg for xlog. - * - * 11 11 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * add debug counters of bb and ar for xlog. - * - * 11 10 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Use short name for xlog. - * - * 11 10 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Modify the QM xlog level and remove LOG_FUNC. - * - * 11 10 2011 chinglan.wang - * NULL - * [WiFi WPS]Can't switch to new AP via WPS PBC when there existing a connection to another AP. - * - * 11 09 2011 chinglan.wang - * NULL - * [WiFi direct]Can't make P2P connect via PBC. - * - * 11 08 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Add xlog function. - * - * 11 07 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * add debug counters and periodically dump counters for debugging. - * - * 11 01 2011 chinglan.wang - * NULL - * Modify the Wi-Fi method of the flush TX queue when disconnect the AP. - * If disconnect the AP and flush all the data frame in the TX queue, WPS cannot do the 4-way handshake to connect to the AP.. - * - * 10 25 2011 wh.su - * [WCXRP00001059] [MT6620 Wi-Fi][Driver][P2P] Fixed sometimes data (1x) will not indicate to upper layer due ba check un-expect - * let the Rx BA accept even the sta not valid. - * - * 09 28 2011 tsaiyuan.hsu - * [WCXRP00000900] [MT5931 Wi-Fi] Improve balance of TX and RX - * enlarge window size only by 4. - * - * 09 01 2011 tsaiyuan.hsu - * [WCXRP00000900] [MT5931 Wi-Fi] Improve balance of TX and RX - * set rx window size as twice buffer size. - * - * 08 23 2011 yuche.tsai - * NULL - * Fix multicast address list issue. - * - * 08 03 2011 tsaiyuan.hsu - * [WCXRP00000900] [MT5931 Wi-Fi] Improve balance of TX and RX - * force window size at least 16. - * - * 08 02 2011 yuche.tsai - * [WCXRP00000896] [Volunteer Patch][WiFi Direct][Driver] GO with multiple client, TX deauth to a disconnecting device issue. - * Fix GO send deauth frame issue. - * - * 07 26 2011 eddie.chen - * [WCXRP00000874] [MT5931][DRV] API for query the RX reorder queued packets counter - * API for query the RX reorder queued packets counter. - * - * 07 07 2011 eddie.chen - * [WCXRP00000834] [MT6620 Wi-Fi][DRV] Send 1x packet when peer STA is in PS. - * Add setEvent when free quota is updated. - * - * 07 05 2011 eddie.chen - * [WCXRP00000834] [MT6620 Wi-Fi][DRV] Send 1x packet when peer STA is in PS. - * Send 1x when peer STA is in PS. - * - * 05 31 2011 eddie.chen - * [WCXRP00000753] [MT5931 Wi-Fi][DRV] Adjust QM for MT5931 - * Fix the QM quota in MT5931. - * - * 05 11 2011 eddie.chen - * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet - * Fix dest type when GO packet copying. - * - * 05 09 2011 yuche.tsai - * [WCXRP00000712] [Volunteer Patch][MT6620][Driver] Sending deauth issue when Hot spot is disabled. (GO is dissolved) - * Deauthentication frame is not bound to network active status. - * - * 05 09 2011 eddie.chen - * [WCXRP00000709] [MT6620 Wi-Fi][Driver] Check free number before copying broadcast packet - * Check free number before copying broadcast packet. - * - * 04 14 2011 eddie.chen - * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning - * Check the SW RFB free. Fix the compile warning.. - * - * 04 12 2011 eddie.chen - * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma - * Fix the sta index in processing security frame - * Simple flow control for TC4 to avoid mgt frames for PS STA to occupy the TC4 - * Add debug message. - * - * 04 11 2011 yuche.tsai - * [WCXRP00000627] [Volunteer Patch][MT6620][Driver] Pending MMPUD of P2P Network may crash system issue. - * Fix kernel panic issue when MMPDU of P2P is pending in driver. - * - * 04 08 2011 eddie.chen - * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma - * Fix for sigma - * - * 03 28 2011 eddie.chen - * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning - * Fix Klockwork warning. - * - * 03 28 2011 eddie.chen - * [WCXRP00000602] [MT6620 Wi-Fi][DRV] Fix wmm parameters in beacon for BOW - * Fix wmm parameters in beacon for BOW. - * - * 03 15 2011 eddie.chen - * [WCXRP00000554] [MT6620 Wi-Fi][DRV] Add sw control debug counter - * Add sw debug counter for QM. - * - * 02 23 2011 eddie.chen - * [WCXRP00000463] [MT6620 Wi-Fi][FW/Driver][Hotspot] Cannot update WMM PS STA's partital bitmap - * Fix parsing WMM INFO and bmp delivery bitmap definition. - * - * 02 17 2011 eddie.chen - * [WCXRP00000458] [MT6620 Wi-Fi][Driver] BOW Concurrent - ProbeResp was exist in other channel - * 1) Chnage GetFrameAction decision when BSS is absent. - * 2) Check channel and resource in processing ProbeRequest - * - * 02 08 2011 eddie.chen - * [WCXRP00000426] [MT6620 Wi-Fi][FW/Driver] Add STA aging timeout and defualtHwRatein AP mode - * Add event STA agint timeout - * - * 01 27 2011 tsaiyuan.hsu - * [WCXRP00000392] [MT6620 Wi-Fi][Driver] Add Roaming Support - * add roaming fsm - * 1. not support 11r, only use strength of signal to determine roaming. - * 2. not enable CFG_SUPPORT_ROAMING until completion of full test. - * 3. in 6620, adopt work-around to avoid sign extension problem of cck of hw - * 4. assume that change of link quality in smooth way. - * - * 01 25 2011 yuche.tsai - * [WCXRP00000388] [Volunteer Patch][MT6620][Driver/Fw] change Station Type in station record. - * Change Station Type in Station Record, Modify MACRO definition for getting station type & network type index & Role. - * - * 01 24 2011 eddie.chen - * [WCXRP00000385] [MT6620 Wi-Fi][DRV] Add destination decision for forwarding packets - * Remove comments. - * - * 01 24 2011 eddie.chen - * [WCXRP00000385] [MT6620 Wi-Fi][DRV] Add destination decision for forwarding packets - * Add destination decision in AP mode. - * - * 01 14 2011 wh.su - * [WCXRP00000099] [MT6620 Wi-Fi] [Driver] workaround to let the de-authentication can be send out[WCXRP00000326] [MT6620][Wi-Fi][Driver] check in the binary format gl_sec.o.new instead of use change type!!! - * Allow 802.1x can be send even the net is not active due the drver / fw sync issue. - * - * 01 13 2011 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, -Add per station flow control when STA is in PS - * Fix typo and compile error. - * - * 01 12 2011 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, -Add per station flow control when STA is in PS - * Fix WMM parameter condition for STA - * - * 01 12 2011 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, -Add per station flow control when STA is in PS - * 1) Check Bss if support QoS before adding WMMIE - * 2) Check if support prAdapter->rWifiVar QoS and uapsd in flow control - * - * 01 12 2011 george.huang - * [WCXRP00000355] [MT6620 Wi-Fi] Set WMM-PS related setting with qualifying AP capability - * Update MQM for WMM IE generation method - * - * 01 11 2011 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, -Add per station flow control when STA is in PS - - * Add per STA flow control when STA is in PS mode - * - * 01 03 2011 george.huang - * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function - * update prStaRec->fgIsUapsdSupported flag. - * - * 12 29 2010 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, -Add per station flow control when STA is in PS - - * Add WMM parameter for broadcast. - * - * 12 29 2010 eddie.chen - * [WCXRP00000322] Add WMM IE in beacon, -Add per station flow control when STA is in PS - - * 1) PS flow control event - * - * 2) WMM IE in beacon, assoc resp, probe resp - * - * 12 23 2010 george.huang - * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function - * 1. update WMM IE parsing, with ASSOC REQ handling - * 2. extend U-APSD parameter passing from driver to FW - * - * 10 14 2010 wh.su - * [WCXRP00000099] [MT6620 Wi-Fi] [Driver] workaround to let the de-authentication can be send out - * use the #14 and modify the add code for check MMPDU. - * - * 10 14 2010 wh.su - * [WCXRP00000099] [MT6620 Wi-Fi] [Driver] workaround to let the de-authentication can be send out - * only MMPDU not check the netActive flag. - * - * 10 14 2010 wh.su - * [WCXRP00000099] [MT6620 Wi-Fi] [Driver] workaround to let the de-authentication can be send out - * not check the netActive flag for mgmt . - * - * 10 04 2010 cp.wu - * [WCXRP00000077] [MT6620 Wi-Fi][Driver][FW] Eliminate use of ENUM_NETWORK_TYPE_T and replaced by ENUM_NETWORK_TYPE_INDEX_T only - * remove ENUM_NETWORK_TYPE_T definitions - * - * 09 21 2010 kevin.huang - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * Eliminate Linux Compile Warning - * - * 08 30 2010 yarco.yang - * NULL - * Fixed klockwork error message - * - * 08 18 2010 yarco.yang - * NULL - * 1. Fixed HW checksum offload function not work under Linux issue. - * 2. Add debug message. - * - * 08 10 2010 yarco.yang - * NULL - * Code refine - * - * 08 06 2010 yarco.yang - * NULL - * Update qmGetFrameAction() to allow P2P MGMT frame w/o STA_Record still can perform TX action - * - * 07 26 2010 cp.wu - * - * AIS-FSM FIX: return channel privilege even when the privilege is not granted yet - * QM: qmGetFrameAction() won't assert when corresponding STA-REC index is not found - * - * 07 20 2010 yarco.yang - * - * Add to SetEvent when BSS is from Absent to Present or STA from PS to Awake - * - * 07 16 2010 yarco.yang - * - * 1. Support BSS Absence/Presence Event - * 2. Support STA change PS mode Event - * 3. Support BMC forwarding for AP mode. - * - * 07 14 2010 yarco.yang - * - * 1. Remove CFG_MQM_MIGRATION - * 2. Add CMD_UPDATE_WMM_PARMS command - * - * 07 13 2010 yarco.yang - * - * [WPD00003849] - * [MT6620 and MT5931] SW Migration, add qmGetFrameAction() API for CMD Queue Processing - * - * 07 09 2010 yarco.yang - * - * [MT6620 and MT5931] SW Migration: Add ADDBA support - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 07 08 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * . - * - * 07 06 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Use fgInUse instead of fgIsValid for De-queue judgement - * - * 07 06 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * For MMPDU, STA_REC will be decided by caller module - * - * 07 06 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Add MGMT Packet type for HIF_TX_HEADER - * - * 06 29 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * replace g_rQM with Adpater->rQM - * - * 06 25 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * add API in que_mgt to retrieve sta-rec index for security frames. - * - * 06 23 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Merge g_arStaRec[] into adapter->arStaRec[] - * - * 06 21 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Support CFG_MQM_MIGRATION flag - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 03 31 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Refined the debug msg - * - * 03 30 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * comment out one assertion which refer to undefined data member. - * - * 03 30 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Enabled adaptive TC resource control - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port - * -* 03 17 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Changed STA_REC index determination rules (DA=BMCAST always --> STA_REC_INDEX_BMCAST) - * - * 03 11 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Fixed buffer leak when processing BAR frames - * - * 03 02 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * For TX packets with STA_REC index = STA_REC_INDEX_NOT_FOUND, use TC5 - * - * 03 01 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Fixed STA_REC index determination bug (fgIsValid shall be checked) - * - * 02 25 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Refined function qmDetermineStaRecIndex() for BMCAST packets - * - * 02 25 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Enabled multi-STA TX path with fairness - * - * 02 24 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Enabled dynamically activating and deactivating STA_RECs - * - * 02 24 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Added code for dynamic activating and deactivating STA_RECs. - * - * 01 13 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Enabled the 802.1x path - * - * 01 13 2010 tehuang.liu - * [WPD00001943]Create WiFi test driver framework on WinXP - * Enabled the Burst_End Indication mechanism -** \main\maintrunk.MT6620WiFiDriver_Prj\13 2009-12-14 15:01:37 GMT MTK02468 -** Fixed casting for qmAddRxBaEntry() -** \main\maintrunk.MT6620WiFiDriver_Prj\12 2009-12-10 16:51:03 GMT mtk02752 -** remove SD1_SD3.. flag -** \main\maintrunk.MT6620WiFiDriver_Prj\11 2009-12-09 14:07:25 GMT MTK02468 -** Added RX buffer reordering functions -** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-12-04 13:34:16 GMT MTK02468 -** Modified Flush Queue function to let queues be reinitialized -** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-12-04 13:18:25 GMT MTK02468 -** Added flushing per-Type queues code -** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-12-02 23:39:49 GMT MTK02468 -** Added Debug msgs and fixed incorrect assert -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-11-26 23:50:27 GMT MTK02468 -** Bug fixing (qmDequeueTxPackets local variable initialization) -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-11-26 09:39:25 GMT mtk02752 -** correct and surpress PREfast warning -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-11-23 22:10:55 GMT mtk02468 -** Used SD1_SD3_DATAPATH_INTEGRATION -** \main\maintrunk.MT6620WiFiDriver_Prj\1 2009-11-23 22:02:30 GMT mtk02468 -** Initial version -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ -OS_SYSTIME g_arMissTimeout[CFG_STA_REC_NUM][CFG_RX_MAX_BA_TID_NUM]; -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -__KAL_INLINE__ VOID -qmDetermineStaRecIndex( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ); - -__KAL_INLINE__ VOID -qmDequeueTxPacketsFromPerStaQueues( - IN P_ADAPTER_T prAdapter, - OUT P_QUE_T prQue, - IN UINT_8 ucTC, - IN UINT_8 ucCurrentAvailableQuota, - IN UINT_8 ucTotalQuota - ); - -__KAL_INLINE__ VOID -qmDequeueTxPacketsFromPerTypeQueues( - IN P_ADAPTER_T prAdapter, - OUT P_QUE_T prQue, - IN UINT_8 ucTC, - IN UINT_8 ucMaxNum - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Init Queue Managment for TX -* -* \param[in] (none) -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmInit( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 u4QueArrayIdx; - UINT_32 i; - - P_QUE_MGT_T prQM = &prAdapter->rQM; - - //DbgPrint("QM: Enter qmInit()\n"); -#if CFG_SUPPORT_QOS - prAdapter->rWifiVar.fgSupportQoS = TRUE; -#else - prAdapter->rWifiVar.fgSupportQoS = FALSE; -#endif - -#if CFG_SUPPORT_AMPDU_RX - prAdapter->rWifiVar.fgSupportAmpduRx = TRUE; -#else - prAdapter->rWifiVar.fgSupportAmpduRx = FALSE; -#endif - -#if CFG_SUPPORT_AMPDU_TX - prAdapter->rWifiVar.fgSupportAmpduTx = TRUE; -#else - prAdapter->rWifiVar.fgSupportAmpduTx = FALSE; -#endif - -#if CFG_SUPPORT_TSPEC - prAdapter->rWifiVar.fgSupportTspec = TRUE; -#else - prAdapter->rWifiVar.fgSupportTspec = FALSE; -#endif - -#if CFG_SUPPORT_UAPSD - prAdapter->rWifiVar.fgSupportUAPSD= TRUE; -#else - prAdapter->rWifiVar.fgSupportUAPSD = FALSE; -#endif - -#if CFG_SUPPORT_UL_PSMP - prAdapter->rWifiVar.fgSupportULPSMP = TRUE; -#else - prAdapter->rWifiVar.fgSupportULPSMP = FALSE; -#endif - - //4 <2> Initialize other TX queues (queues not in STA_RECs) - for(u4QueArrayIdx = 0; u4QueArrayIdx < NUM_OF_PER_TYPE_TX_QUEUES; u4QueArrayIdx++){ - QUEUE_INITIALIZE(&(prQM->arTxQueue[u4QueArrayIdx])); - } - - //4 <3> Initialize the RX BA table and RX queues - /* Initialize the RX Reordering Parameters and Queues */ - for(u4QueArrayIdx = 0; u4QueArrayIdx < CFG_NUM_OF_RX_BA_AGREEMENTS; u4QueArrayIdx++){ - prQM->arRxBaTable[u4QueArrayIdx].fgIsValid = FALSE; - QUEUE_INITIALIZE(&(prQM->arRxBaTable[u4QueArrayIdx].rReOrderQue)); - prQM->arRxBaTable[u4QueArrayIdx].u2WinStart = 0xFFFF; - prQM->arRxBaTable[u4QueArrayIdx].u2WinEnd = 0xFFFF; - - prQM->arRxBaTable[u4QueArrayIdx].fgIsWaitingForPktWithSsn = FALSE; - - } - prQM->ucRxBaCount = 0; - kalMemSet(&g_arMissTimeout, 0, sizeof(g_arMissTimeout)); - -#if QM_ADAPTIVE_TC_RESOURCE_CTRL - //4 <4> Initialize TC resource control variables - for(i = 0; i < TC_NUM; i++){ - prQM->au4AverageQueLen[i] = 0; - } - prQM->u4TimeToAdjustTcResource = QM_INIT_TIME_TO_ADJUST_TC_RSC; - prQM->u4TimeToUpdateQueLen = QM_INIT_TIME_TO_UPDATE_QUE_LEN; - -// ASSERT(prQM->u4TimeToAdjust && prQM->u4TimeToUpdateQueLen); - - prQM->au4CurrentTcResource[TC0_INDEX] = NIC_TX_BUFF_COUNT_TC0; - prQM->au4CurrentTcResource[TC1_INDEX] = NIC_TX_BUFF_COUNT_TC1; - prQM->au4CurrentTcResource[TC2_INDEX] = NIC_TX_BUFF_COUNT_TC2; - prQM->au4CurrentTcResource[TC3_INDEX] = NIC_TX_BUFF_COUNT_TC3; - prQM->au4CurrentTcResource[TC4_INDEX] = NIC_TX_BUFF_COUNT_TC4; /* Not adjustable (TX port 1)*/ - prQM->au4CurrentTcResource[TC5_INDEX] = NIC_TX_BUFF_COUNT_TC5; - - prQM->au4MinReservedTcResource[TC0_INDEX] = QM_MIN_RESERVED_TC0_RESOURCE; - prQM->au4MinReservedTcResource[TC1_INDEX] = QM_MIN_RESERVED_TC1_RESOURCE; - prQM->au4MinReservedTcResource[TC2_INDEX] = QM_MIN_RESERVED_TC2_RESOURCE; - prQM->au4MinReservedTcResource[TC3_INDEX] = QM_MIN_RESERVED_TC3_RESOURCE; - prQM->au4MinReservedTcResource[TC4_INDEX] = QM_MIN_RESERVED_TC4_RESOURCE; /* Not adjustable (TX port 1)*/ - prQM->au4MinReservedTcResource[TC5_INDEX] = QM_MIN_RESERVED_TC5_RESOURCE; - - - prQM->au4GuaranteedTcResource[TC0_INDEX] = QM_GUARANTEED_TC0_RESOURCE; - prQM->au4GuaranteedTcResource[TC1_INDEX] = QM_GUARANTEED_TC1_RESOURCE; - prQM->au4GuaranteedTcResource[TC2_INDEX] = QM_GUARANTEED_TC2_RESOURCE; - prQM->au4GuaranteedTcResource[TC3_INDEX] = QM_GUARANTEED_TC3_RESOURCE; - prQM->au4GuaranteedTcResource[TC4_INDEX] = QM_GUARANTEED_TC4_RESOURCE; - prQM->au4GuaranteedTcResource[TC5_INDEX] = QM_GUARANTEED_TC5_RESOURCE; - - prQM->fgTcResourcePostAnnealing = FALSE; - - ASSERT(QM_INITIAL_RESIDUAL_TC_RESOURCE < 64); -#endif - -#if QM_TEST_MODE - prQM->u4PktCount = 0; - -#if QM_TEST_FAIR_FORWARDING - - prQM->u4CurrentStaRecIndexToEnqueue = 0; - { - UINT_8 aucMacAddr[MAC_ADDR_LEN]; - P_STA_RECORD_T prStaRec; - - /* Irrelevant in case this STA is an AIS AP (see qmDetermineStaRecIndex()) */ - aucMacAddr[0] = 0x11; - aucMacAddr[1] = 0x22; - aucMacAddr[2] = 0xAA; - aucMacAddr[3] = 0xBB; - aucMacAddr[4] = 0xCC; - aucMacAddr[5] = 0xDD; - - prStaRec = &prAdapter->arStaRec[1]; - ASSERT(prStaRec); - - prStaRec->fgIsValid = TRUE; - prStaRec->fgIsQoS = TRUE; - prStaRec->fgIsInPS = FALSE; - prStaRec->ucPsSessionID = 0xFF; - prStaRec->ucNetTypeIndex = NETWORK_TYPE_AIS_INDEX; - prStaRec->fgIsAp = TRUE; - COPY_MAC_ADDR((prStaRec)->aucMacAddr,aucMacAddr); - - } - -#endif - -#endif - -#if QM_FORWARDING_FAIRNESS -{ - UINT_32 i; - for (i=0; i < NUM_OF_PER_STA_TX_QUEUES; i++){ - prQM->au4ForwardCount[i] = 0; - prQM->au4HeadStaRecIndex[i] = 0; - } -} -#endif - -} - -#if QM_TEST_MODE -VOID -qmTestCases( - IN P_ADAPTER_T prAdapter - ) -{ - P_QUE_MGT_T prQM = &prAdapter->rQM; - - DbgPrint("QM: ** TEST MODE **\n"); - - if(QM_TEST_STA_REC_DETERMINATION){ - if(prAdapter->arStaRec[0].fgIsValid){ - prAdapter->arStaRec[0].fgIsValid = FALSE; - DbgPrint("QM: (Test) Deactivate STA_REC[0]\n"); - } - else{ - prAdapter->arStaRec[0].fgIsValid = TRUE; - DbgPrint("QM: (Test) Activate STA_REC[0]\n"); - } - } - - if(QM_TEST_STA_REC_DEACTIVATION){ - /* Note that QM_STA_REC_HARD_CODING shall be set to 1 for this test */ - - if(prAdapter->arStaRec[0].fgIsValid){ - - DbgPrint("QM: (Test) Deactivate STA_REC[0]\n"); - qmDeactivateStaRec(prAdapter,0); - } - else{ - - UINT_8 aucMacAddr[MAC_ADDR_LEN]; - - /* Irrelevant in case this STA is an AIS AP (see qmDetermineStaRecIndex()) */ - aucMacAddr[0] = 0x11; - aucMacAddr[1] = 0x22; - aucMacAddr[2] = 0xAA; - aucMacAddr[3] = 0xBB; - aucMacAddr[4] = 0xCC; - aucMacAddr[5] = 0xDD; - - DbgPrint("QM: (Test) Activate STA_REC[0]\n"); - qmActivateStaRec( - prAdapter, /* Adapter pointer */ - 0, /* STA_REC index from FW */ - TRUE, /* fgIsQoS */ - NETWORK_TYPE_AIS_INDEX, /* Network type */ - TRUE, /* fgIsAp */ - aucMacAddr /* MAC address */ - ); - } - } - - if(QM_TEST_FAIR_FORWARDING){ - if(prAdapter->arStaRec[1].fgIsValid){ - prQM->u4CurrentStaRecIndexToEnqueue ++; - prQM->u4CurrentStaRecIndexToEnqueue %= 2; - DbgPrint("QM: (Test) Switch to STA_REC[%ld]\n", prQM->u4CurrentStaRecIndexToEnqueue); - } - } - -} -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Activate a STA_REC -* -* \param[in] prAdapter Pointer to the Adapter instance -* \param[in] u4StaRecIdx The index of the STA_REC -* \param[in] fgIsQoS Set to TRUE if this is a QoS STA -* \param[in] pucMacAddr The MAC address of the STA -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmActivateStaRec( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec - ) -{ - - //4 <1> Deactivate first - ASSERT(prStaRec); - - if(prStaRec->fgIsValid){ /* The STA_REC has been activated */ - DBGLOG(QM, WARN, ("QM: (WARNING) Activating a STA_REC which has been activated \n")); - DBGLOG(QM, WARN, ("QM: (WARNING) Deactivating a STA_REC before re-activating \n")); - qmDeactivateStaRec(prAdapter, prStaRec->ucIndex); // To flush TX/RX queues and del RX BA agreements - } - - //4 <2> Activate the STA_REC - /* Init the STA_REC */ - prStaRec->fgIsValid = TRUE; - prStaRec->fgIsInPS = FALSE; - prStaRec->ucPsSessionID = 0xFF; - prStaRec->fgIsAp = (IS_AP_STA(prStaRec)) ? TRUE : FALSE;; - - /* Done in qmInit() or qmDeactivateStaRec() */ -#if 0 - /* At the beginning, no RX BA agreements have been established */ - for(i =0; iaprRxReorderParamRefTbl)[i] = NULL; - } -#endif - - DBGLOG(QM, INFO, ("QM: +STA[%ld]\n", prStaRec->ucIndex)); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Deactivate a STA_REC -* -* \param[in] prAdapter Pointer to the Adapter instance -* \param[in] u4StaRecIdx The index of the STA_REC -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmDeactivateStaRec( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4StaRecIdx - ) -{ - P_STA_RECORD_T prStaRec; - UINT_32 i; - P_MSDU_INFO_T prFlushedTxPacketList = NULL; - - ASSERT(u4StaRecIdx < CFG_NUM_OF_STA_RECORD); - - prStaRec = &prAdapter->arStaRec[u4StaRecIdx]; - ASSERT(prStaRec); - - //4<1> Flush TX queues - prFlushedTxPacketList = qmFlushStaTxQueues(prAdapter, u4StaRecIdx); - - if(prFlushedTxPacketList){ - wlanProcessQueuedMsduInfo(prAdapter, prFlushedTxPacketList); - } - - //4 <2> Flush RX queues and delete RX BA agreements - for(i =0; i < CFG_RX_MAX_BA_TID_NUM; i++){ - /* Delete the RX BA entry with TID = i */ - qmDelRxBaEntry(prAdapter, (UINT_8)u4StaRecIdx, (UINT_8)i, FALSE); - } - - //4 <3> Deactivate the STA_REC - prStaRec->fgIsValid = FALSE; - prStaRec->fgIsInPS = FALSE; - - DBGLOG(QM, INFO, ("QM: -STA[%ld]\n", u4StaRecIdx)); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Deactivate a STA_REC -* -* \param[in] prAdapter Pointer to the Adapter instance -* \param[in] u4StaRecIdx The index of the network -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ - -VOID -qmFreeAllByNetType( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ) -{ - - P_QUE_MGT_T prQM; - P_QUE_T prQue; - QUE_T rNeedToFreeQue; - QUE_T rTempQue; - P_QUE_T prNeedToFreeQue; - P_QUE_T prTempQue; - P_MSDU_INFO_T prMsduInfo; - - - prQM = &prAdapter->rQM; - prQue = &prQM->arTxQueue[TX_QUEUE_INDEX_BMCAST]; - - QUEUE_INITIALIZE(&rNeedToFreeQue); - QUEUE_INITIALIZE(&rTempQue); - - prNeedToFreeQue = &rNeedToFreeQue; - prTempQue = &rTempQue; - - QUEUE_MOVE_ALL(prTempQue, prQue); - - QUEUE_REMOVE_HEAD(prTempQue, prMsduInfo, P_MSDU_INFO_T); - while (prMsduInfo) { - - if(prMsduInfo->ucNetworkType == eNetworkTypeIdx) { - QUEUE_INSERT_TAIL(prNeedToFreeQue, (P_QUE_ENTRY_T)prMsduInfo); - } - else { - QUEUE_INSERT_TAIL(prQue, (P_QUE_ENTRY_T)prMsduInfo); - } - - QUEUE_REMOVE_HEAD(prTempQue, prMsduInfo, P_MSDU_INFO_T); - } - if(QUEUE_IS_NOT_EMPTY(prNeedToFreeQue)) { - wlanProcessQueuedMsduInfo(prAdapter, (P_MSDU_INFO_T)QUEUE_GET_HEAD(prNeedToFreeQue)); - } - -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Flush all TX queues -* -* \param[in] (none) -* -* \return The flushed packets (in a list of MSDU_INFOs) -*/ -/*----------------------------------------------------------------------------*/ -P_MSDU_INFO_T -qmFlushTxQueues( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_8 ucStaArrayIdx; - UINT_8 ucQueArrayIdx; - - P_MSDU_INFO_T prMsduInfoListHead; - P_MSDU_INFO_T prMsduInfoListTail; - - P_QUE_MGT_T prQM = &prAdapter->rQM; - - DBGLOG(QM, TRACE, ("QM: Enter qmFlushTxQueues()\n")); - - prMsduInfoListHead = NULL; - prMsduInfoListTail = NULL; - - /* Concatenate all MSDU_INFOs in per-STA queues */ - for(ucStaArrayIdx = 0; ucStaArrayIdx < CFG_NUM_OF_STA_RECORD; ucStaArrayIdx++){ - - /* Always check each STA_REC when flushing packets no matter it is inactive or active */ - #if 0 - if(!prAdapter->arStaRec[ucStaArrayIdx].fgIsValid){ - continue; /* Continue to check the next STA_REC */ - } - #endif - - for(ucQueArrayIdx = 0; ucQueArrayIdx < NUM_OF_PER_STA_TX_QUEUES; ucQueArrayIdx++){ - if(QUEUE_IS_EMPTY(&(prAdapter->arStaRec[ucStaArrayIdx].arTxQueue[ucQueArrayIdx]))){ - continue; /* Continue to check the next TX queue of the same STA */ - } - - if(!prMsduInfoListHead){ - - /* The first MSDU_INFO is found */ - prMsduInfoListHead =(P_MSDU_INFO_T) - QUEUE_GET_HEAD(&prAdapter->arStaRec[ucStaArrayIdx].arTxQueue[ucQueArrayIdx]); - prMsduInfoListTail =(P_MSDU_INFO_T) - QUEUE_GET_TAIL(&prAdapter->arStaRec[ucStaArrayIdx].arTxQueue[ucQueArrayIdx]); - } - else{ - /* Concatenate the MSDU_INFO list with the existing list */ - QM_TX_SET_NEXT_MSDU_INFO(prMsduInfoListTail, - QUEUE_GET_HEAD(&prAdapter->arStaRec[ucStaArrayIdx].arTxQueue[ucQueArrayIdx])); - - prMsduInfoListTail = (P_MSDU_INFO_T) - QUEUE_GET_TAIL(&prAdapter->arStaRec[ucStaArrayIdx].arTxQueue[ucQueArrayIdx]); - } - - QUEUE_INITIALIZE(&prAdapter->arStaRec[ucStaArrayIdx].arTxQueue[ucQueArrayIdx]); - } - } - - /* Flush per-Type queues */ - for(ucQueArrayIdx = 0; ucQueArrayIdx < NUM_OF_PER_TYPE_TX_QUEUES; ucQueArrayIdx++){ - - if(QUEUE_IS_EMPTY(&(prQM->arTxQueue[ucQueArrayIdx]))){ - continue; /* Continue to check the next TX queue of the same STA */ - } - - if(!prMsduInfoListHead){ - - /* The first MSDU_INFO is found */ - prMsduInfoListHead =(P_MSDU_INFO_T) - QUEUE_GET_HEAD(&prQM->arTxQueue[ucQueArrayIdx]); - prMsduInfoListTail =(P_MSDU_INFO_T) - QUEUE_GET_TAIL(&prQM->arTxQueue[ucQueArrayIdx]); - } - else{ - /* Concatenate the MSDU_INFO list with the existing list */ - QM_TX_SET_NEXT_MSDU_INFO(prMsduInfoListTail, - QUEUE_GET_HEAD(&prQM->arTxQueue[ucQueArrayIdx])); - - prMsduInfoListTail = (P_MSDU_INFO_T) - QUEUE_GET_TAIL(&prQM->arTxQueue[ucQueArrayIdx]); - } - - QUEUE_INITIALIZE(&prQM->arTxQueue[ucQueArrayIdx]); - - } - - if(prMsduInfoListTail){ - /* Terminate the MSDU_INFO list with a NULL pointer */ - QM_TX_SET_NEXT_MSDU_INFO(prMsduInfoListTail, NULL); - } - - return prMsduInfoListHead; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Flush TX packets for a particular STA -* -* \param[in] u4StaRecIdx STA_REC index -* -* \return The flushed packets (in a list of MSDU_INFOs) -*/ -/*----------------------------------------------------------------------------*/ -P_MSDU_INFO_T -qmFlushStaTxQueues( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4StaRecIdx - ) -{ - UINT_8 ucQueArrayIdx; - P_MSDU_INFO_T prMsduInfoListHead; - P_MSDU_INFO_T prMsduInfoListTail; - P_STA_RECORD_T prStaRec; - - DBGLOG(QM, TRACE, ("QM: Enter qmFlushStaTxQueues(%ld)\n", u4StaRecIdx)); - - ASSERT(u4StaRecIdx < CFG_NUM_OF_STA_RECORD); - - prMsduInfoListHead = NULL; - prMsduInfoListTail = NULL; - - prStaRec = &prAdapter->arStaRec[u4StaRecIdx]; - ASSERT(prStaRec); - - /* No matter whether this is an activated STA_REC, do flush */ -#if 0 - if(!prStaRec->fgIsValid){ - return NULL; - } -#endif - - /* Concatenate all MSDU_INFOs in TX queues of this STA_REC */ - for(ucQueArrayIdx = 0; ucQueArrayIdx < NUM_OF_PER_STA_TX_QUEUES; ucQueArrayIdx++){ - if(QUEUE_IS_EMPTY(&(prStaRec->arTxQueue[ucQueArrayIdx]))){ - continue; - } - - if(!prMsduInfoListHead){ - /* The first MSDU_INFO is found */ - prMsduInfoListHead =(P_MSDU_INFO_T) - QUEUE_GET_HEAD(&prStaRec->arTxQueue[ucQueArrayIdx]); - prMsduInfoListTail =(P_MSDU_INFO_T) - QUEUE_GET_TAIL(&prStaRec->arTxQueue[ucQueArrayIdx]); } - else{ - /* Concatenate the MSDU_INFO list with the existing list */ - QM_TX_SET_NEXT_MSDU_INFO(prMsduInfoListTail, - QUEUE_GET_HEAD(&prStaRec->arTxQueue[ucQueArrayIdx])); - - prMsduInfoListTail = - (P_MSDU_INFO_T)QUEUE_GET_TAIL(&prStaRec->arTxQueue[ucQueArrayIdx]); - } - - QUEUE_INITIALIZE(&prStaRec->arTxQueue[ucQueArrayIdx]); - - } - -#if 0 - if(prMsduInfoListTail){ - /* Terminate the MSDU_INFO list with a NULL pointer */ - QM_TX_SET_NEXT_MSDU_INFO(prMsduInfoListTail, nicGetPendingStaMMPDU(prAdapter, (UINT_8)u4StaRecIdx)); - } - else { - prMsduInfoListHead = nicGetPendingStaMMPDU(prAdapter, (UINT_8)u4StaRecIdx); - } -#endif - - return prMsduInfoListHead; - -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Flush RX packets -* -* \param[in] (none) -* -* \return The flushed packets (in a list of SW_RFBs) -*/ -/*----------------------------------------------------------------------------*/ -P_SW_RFB_T -qmFlushRxQueues( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 i; - P_SW_RFB_T prSwRfbListHead; - P_SW_RFB_T prSwRfbListTail; - P_QUE_MGT_T prQM = &prAdapter->rQM; - - prSwRfbListHead = prSwRfbListTail = NULL; - - DBGLOG(QM, TRACE, ("QM: Enter qmFlushRxQueues()\n")); - - for(i =0; iarRxBaTable[i].rReOrderQue))){ - if(!prSwRfbListHead){ - - /* The first MSDU_INFO is found */ - prSwRfbListHead =(P_SW_RFB_T) - QUEUE_GET_HEAD(&(prQM->arRxBaTable[i].rReOrderQue)); - prSwRfbListTail =(P_SW_RFB_T) - QUEUE_GET_TAIL(&(prQM->arRxBaTable[i].rReOrderQue)); - } - else{ - /* Concatenate the MSDU_INFO list with the existing list */ - QM_TX_SET_NEXT_MSDU_INFO(prSwRfbListTail, - QUEUE_GET_HEAD(&(prQM->arRxBaTable[i].rReOrderQue))); - - prSwRfbListTail = (P_SW_RFB_T) - QUEUE_GET_TAIL(&(prQM->arRxBaTable[i].rReOrderQue)); - } - - QUEUE_INITIALIZE(&(prQM->arRxBaTable[i].rReOrderQue)); - - } - else{ - continue; - } - } - - if(prSwRfbListTail){ - /* Terminate the MSDU_INFO list with a NULL pointer */ - QM_TX_SET_NEXT_SW_RFB(prSwRfbListTail, NULL); - } - return prSwRfbListHead; - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Flush RX packets with respect to a particular STA -* -* \param[in] u4StaRecIdx STA_REC index -* \param[in] u4Tid TID -* -* \return The flushed packets (in a list of SW_RFBs) -*/ -/*----------------------------------------------------------------------------*/ -P_SW_RFB_T -qmFlushStaRxQueue( - IN P_ADAPTER_T prAdapter, - IN UINT_32 u4StaRecIdx, - IN UINT_32 u4Tid - ) -{ - //UINT_32 i; - P_SW_RFB_T prSwRfbListHead; - P_SW_RFB_T prSwRfbListTail; - P_RX_BA_ENTRY_T prReorderQueParm; - P_STA_RECORD_T prStaRec; - - DBGLOG(QM, TRACE, ("QM: Enter qmFlushStaRxQueues(%ld)\n", u4StaRecIdx)); - - prSwRfbListHead = prSwRfbListTail = NULL; - - prStaRec = &prAdapter->arStaRec[u4StaRecIdx]; - ASSERT(prStaRec); - - /* No matter whether this is an activated STA_REC, do flush */ -#if 0 - if(!prStaRec->fgIsValid){ - return NULL; - } -#endif - - /* Obtain the RX BA Entry pointer */ - prReorderQueParm = ((prStaRec->aprRxReorderParamRefTbl)[u4Tid]); - - /* Note: For each queued packet, prCurrSwRfb->eDst equals RX_PKT_DESTINATION_HOST */ - if(prReorderQueParm){ - - if(QUEUE_IS_NOT_EMPTY(&(prReorderQueParm->rReOrderQue))){ - - prSwRfbListHead =(P_SW_RFB_T) - QUEUE_GET_HEAD(&(prReorderQueParm->rReOrderQue)); - prSwRfbListTail =(P_SW_RFB_T) - QUEUE_GET_TAIL(&(prReorderQueParm->rReOrderQue)); - - - QUEUE_INITIALIZE(&(prReorderQueParm->rReOrderQue)); - - } - } - - if(prSwRfbListTail){ - /* Terminate the MSDU_INFO list with a NULL pointer */ - QM_TX_SET_NEXT_SW_RFB(prSwRfbListTail, NULL); - } - return prSwRfbListHead; - - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Enqueue TX packets -* -* \param[in] prMsduInfoListHead Pointer to the list of TX packets -* -* \return The freed packets, which are not enqueued -*/ -/*----------------------------------------------------------------------------*/ -P_MSDU_INFO_T -qmEnqueueTxPackets( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfoListHead - ) -{ - P_MSDU_INFO_T prMsduInfoReleaseList; - P_MSDU_INFO_T prCurrentMsduInfo; - P_MSDU_INFO_T prNextMsduInfo; - - P_STA_RECORD_T prStaRec; - P_QUE_T prTxQue; - QUE_T rNotEnqueuedQue; - - - UINT_8 ucPacketType; - UINT_8 ucTC; - P_QUE_MGT_T prQM = &prAdapter->rQM; - UINT_8 aucNextUP[WMM_AC_INDEX_NUM] = { 1 /* BEtoBK*/, 1 /*na*/, 0/*VItoBE*/ , 4 /*VOtoVI*/}; - - DBGLOG(QM, LOUD, ("Enter qmEnqueueTxPackets\n")); - - ASSERT(prMsduInfoListHead); - -#if QM_ADAPTIVE_TC_RESOURCE_CTRL - { - //UINT_32 i; - //4 <0> Update TC resource control related variables - /* Keep track of the queue length */ - if (--prQM->u4TimeToUpdateQueLen == 0){ - prQM->u4TimeToUpdateQueLen = QM_INIT_TIME_TO_UPDATE_QUE_LEN; - qmUpdateAverageTxQueLen(prAdapter); - } - } -#endif - - /* Push TX packets into STA_REC (for UNICAST) or prAdapter->rQM (for BMCAST) */ - prStaRec = NULL; - prMsduInfoReleaseList = NULL; - prCurrentMsduInfo = NULL; - QUEUE_INITIALIZE(&rNotEnqueuedQue); - prNextMsduInfo = prMsduInfoListHead; - - do{ - P_BSS_INFO_T prBssInfo; - BOOLEAN fgCheckACMAgain; - ENUM_WMM_ACI_T eAci = WMM_AC_BE_INDEX; - prCurrentMsduInfo = prNextMsduInfo; - prNextMsduInfo = QM_TX_GET_NEXT_MSDU_INFO(prCurrentMsduInfo); - ucTC = TC1_INDEX; - - //4 <1> Lookup the STA_REC index - /* The ucStaRecIndex will be set in this function */ - qmDetermineStaRecIndex(prAdapter, prCurrentMsduInfo); - ucPacketType = HIF_TX_PACKET_TYPE_DATA; - - DBGLOG(QM, LOUD , ("***** ucStaRecIndex = %d *****\n", - prCurrentMsduInfo->ucStaRecIndex)); - - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prCurrentMsduInfo->ucNetworkType]); - - if(IS_NET_ACTIVE(prAdapter, prCurrentMsduInfo->ucNetworkType)) { - - switch (prCurrentMsduInfo->ucStaRecIndex){ - case STA_REC_INDEX_BMCAST: - prTxQue = &prQM->arTxQueue[TX_QUEUE_INDEX_BMCAST]; - ucTC = TC5_INDEX; -#if 0 - if(prCurrentMsduInfo->ucNetworkType == NETWORK_TYPE_P2P_INDEX - && prCurrentMsduInfo->eSrc != TX_PACKET_MGMT - ) { - if(LINK_IS_EMPTY(&prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX].rStaRecOfClientList)) { - prTxQue = &rNotEnqueuedQue; - TX_INC_CNT(&prAdapter->rTxCtrl,TX_AP_BORADCAST_DROP); - } - } -#endif - - QM_DBG_CNT_INC(prQM, QM_DBG_CNT_23); - break; - - case STA_REC_INDEX_NOT_FOUND: - ucTC = TC5_INDEX; - - if(prCurrentMsduInfo->eSrc == TX_PACKET_FORWARDING) { - - /* if the packet is the forward type. the packet should be freed */ - DBGLOG(QM, TRACE, ("Forwarding packet but Sta is STA_REC_INDEX_NOT_FOUND\n")); - //prTxQue = &rNotEnqueuedQue; - } - prTxQue = &prQM->arTxQueue[TX_QUEUE_INDEX_NO_STA_REC]; - QM_DBG_CNT_INC(prQM, QM_DBG_CNT_24); - - break; - - default: - prStaRec = QM_GET_STA_REC_PTR_FROM_INDEX(prAdapter, prCurrentMsduInfo->ucStaRecIndex); - - ASSERT(prStaRec); - ASSERT(prStaRec->fgIsValid); - - if(prCurrentMsduInfo->ucUserPriority < 8) { - QM_DBG_CNT_INC(prQM, prCurrentMsduInfo->ucUserPriority + 15); - /* QM_DBG_CNT_15 */ /* QM_DBG_CNT_16 */ /* QM_DBG_CNT_17 */ /* QM_DBG_CNT_18 */ - /* QM_DBG_CNT_19 */ /* QM_DBG_CNT_20 */ /* QM_DBG_CNT_21 */ /* QM_DBG_CNT_22 */ - } - - eAci = WMM_AC_BE_INDEX; - do { - fgCheckACMAgain = FALSE; - if (prStaRec->fgIsQoS){ - switch(prCurrentMsduInfo->ucUserPriority){ - case 1: - case 2: - prTxQue = &prStaRec->arTxQueue[TX_QUEUE_INDEX_AC0]; - ucTC = TC0_INDEX; - eAci = WMM_AC_BK_INDEX; - break; - case 0: - case 3: - prTxQue = &prStaRec->arTxQueue[TX_QUEUE_INDEX_AC1]; - ucTC = TC1_INDEX; - eAci = WMM_AC_BE_INDEX; - break; - case 4: - case 5: - prTxQue = &prStaRec->arTxQueue[TX_QUEUE_INDEX_AC2]; - ucTC = TC2_INDEX; - eAci = WMM_AC_VI_INDEX; - break; - case 6: - case 7: - prTxQue = &prStaRec->arTxQueue[TX_QUEUE_INDEX_AC3]; - ucTC = TC3_INDEX; - eAci = WMM_AC_VO_INDEX; - break; - default: - prTxQue = &prStaRec->arTxQueue[TX_QUEUE_INDEX_AC1]; - ucTC = TC1_INDEX; - eAci = WMM_AC_BE_INDEX; - ASSERT(0); - break; - } - if(prBssInfo->arACQueParms[eAci].fgIsACMSet && eAci != WMM_AC_BK_INDEX) { - prCurrentMsduInfo->ucUserPriority = aucNextUP[eAci]; - fgCheckACMAgain = TRUE; - } - } - else{ - prTxQue = &prStaRec->arTxQueue[TX_QUEUE_INDEX_AC1]; - ucTC = TC1_INDEX; - } - } - while(fgCheckACMAgain); - - //LOG_FUNC ("QoS %u UP %u TC %u",prStaRec->fgIsQoS,prCurrentMsduInfo->ucUserPriority, ucTC); - - break; /*default */ - } /* switch (prCurrentMsduInfo->ucStaRecIndex) */ - - if(prCurrentMsduInfo->eSrc == TX_PACKET_FORWARDING) { - if(prTxQue->u4NumElem > 32) { - DBGLOG(QM, INFO, ("Drop the Packet for full Tx queue (forwarding) Bss %u\n", prCurrentMsduInfo->ucNetworkType)); - prTxQue = &rNotEnqueuedQue; - TX_INC_CNT(&prAdapter->rTxCtrl,TX_FORWARD_OVERFLOW_DROP); - } - } - - } - else { - - DBGLOG(QM, INFO, ("Drop the Packet for inactive Bss %u\n", prCurrentMsduInfo->ucNetworkType)); - QM_DBG_CNT_INC(prQM, QM_DBG_CNT_31); - prTxQue = &rNotEnqueuedQue; - TX_INC_CNT(&prAdapter->rTxCtrl,TX_INACTIVE_BSS_DROP); - } - - //4 <3> Fill the MSDU_INFO for constructing HIF TX header - - /* TODO: Fill MSDU_INFO according to the network type, - * EtherType, and STA status (for PS forwarding control). - */ - - /* Note that the Network Type Index and STA_REC index are determined in - * qmDetermineStaRecIndex(prCurrentMsduInfo). - */ - QM_TX_SET_MSDU_INFO_FOR_DATA_PACKET( - prCurrentMsduInfo, /* MSDU_INFO ptr */ - ucTC, /* TC tag */ - ucPacketType, /* Packet Type */ - 0, /* Format ID */ - prCurrentMsduInfo->fgIs802_1x, /* Flag 802.1x */ - prCurrentMsduInfo->fgIs802_11, /* Flag 802.11 */ - 0, /* PAL LLH */ - 0, /* ACL SN */ - PS_FORWARDING_TYPE_NON_PS, /* PS Forwarding Type */ - 0 /* PS Session ID */ - ); - - //4 <4> Enqueue the packet - QUEUE_INSERT_TAIL(prTxQue, (P_QUE_ENTRY_T)prCurrentMsduInfo); - - -#if QM_TEST_MODE - if (++prQM->u4PktCount == QM_TEST_TRIGGER_TX_COUNT){ - prQM->u4PktCount = 0; - qmTestCases(prAdapter); - } - -#endif - - DBGLOG(QM, LOUD, ("Current queue length = %u\n", prTxQue->u4NumElem)); - }while(prNextMsduInfo); - - if( QUEUE_IS_NOT_EMPTY(&rNotEnqueuedQue) ) { - QM_TX_SET_NEXT_MSDU_INFO((P_MSDU_INFO_T)QUEUE_GET_TAIL(&rNotEnqueuedQue), NULL); - prMsduInfoReleaseList = (P_MSDU_INFO_T)QUEUE_GET_HEAD(&rNotEnqueuedQue); - } - - - return prMsduInfoReleaseList; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Determine the STA_REC index for a packet -* -* \param[in] prMsduInfo Pointer to the packet -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -static VOID -qmDetermineStaRecIndex( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - UINT_32 i; - - P_STA_RECORD_T prTempStaRec; - //P_QUE_MGT_T prQM = &prAdapter->rQM; - - prTempStaRec = NULL; - - ASSERT(prMsduInfo); - - //4 <1> DA = BMCAST - if (IS_BMCAST_MAC_ADDR(prMsduInfo->aucEthDestAddr)){ - /* For intrastructure mode and P2P (playing as a GC), BMCAST frames shall be sent to the AP. - * FW shall take care of this. The host driver is not able to distinguish these cases. */ - prMsduInfo->ucStaRecIndex = STA_REC_INDEX_BMCAST; - DBGLOG(QM, LOUD, ("TX with DA = BMCAST\n")); - return; - } - - - //4 <2> Check if an AP STA is present - for (i = 0; i < CFG_NUM_OF_STA_RECORD; i++){ - prTempStaRec = &(prAdapter->arStaRec[i]); - - if((prTempStaRec->ucNetTypeIndex == prMsduInfo->ucNetworkType) - && (prTempStaRec->fgIsAp) - && (prTempStaRec->fgIsValid)){ - prMsduInfo->ucStaRecIndex = prTempStaRec->ucIndex; - return; - } - } - - - - - //4 <3> Not BMCAST, No AP --> Compare DA (i.e., to see whether this is a unicast frame to a client) - for (i = 0; i < CFG_NUM_OF_STA_RECORD; i++){ - prTempStaRec = &(prAdapter->arStaRec[i]); - if (prTempStaRec->fgIsValid){ - if (EQUAL_MAC_ADDR(prTempStaRec->aucMacAddr, prMsduInfo->aucEthDestAddr)){ - prMsduInfo->ucStaRecIndex = prTempStaRec->ucIndex; - return; - } - } - } - - - //4 <4> No STA found, Not BMCAST --> Indicate NOT_FOUND to FW - prMsduInfo->ucStaRecIndex = STA_REC_INDEX_NOT_FOUND; - DBGLOG(QM, LOUD, ("QM: TX with STA_REC_INDEX_NOT_FOUND\n")); - - -#if (QM_TEST_MODE && QM_TEST_FAIR_FORWARDING) - prMsduInfo->ucStaRecIndex = (UINT_8)prQM->u4CurrentStaRecIndexToEnqueue; -#endif -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Dequeue TX packets from a STA_REC for a particular TC -* -* \param[out] prQue The queue to put the dequeued packets -* \param[in] ucTC The TC index (TC0_INDEX to TC5_INDEX) -* \param[in] ucMaxNum The maximum amount of dequeued packets -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -static VOID -qmDequeueTxPacketsFromPerStaQueues( - IN P_ADAPTER_T prAdapter, - OUT P_QUE_T prQue, - IN UINT_8 ucTC, - IN UINT_8 ucCurrentQuota, - IN UINT_8 ucTotalQuota - ) -{ - -#if QM_FORWARDING_FAIRNESS - UINT_32 i; /* Loop for */ - - PUINT_32 pu4HeadStaRecIndex; /* The Head STA index */ - PUINT_32 pu4HeadStaRecForwardCount; /* The total forwarded packets for the head STA */ - - P_STA_RECORD_T prStaRec; /* The current focused STA */ - P_BSS_INFO_T prBssInfo; /* The Bss for current focused STA */ - P_QUE_T prCurrQueue; /* The current TX queue to dequeue */ - P_MSDU_INFO_T prDequeuedPkt; /* The dequeued packet */ - - UINT_32 u4ForwardCount; /* To remember the total forwarded packets for a STA */ - UINT_32 u4MaxForwardCount; /* The maximum number of packets a STA can forward */ - UINT_32 u4Resource; /* The TX resource amount */ - - BOOLEAN fgChangeHeadSta; /* Whether a new head STA shall be determined at the end of the function */ - P_QUE_MGT_T prQM = &prAdapter->rQM; - - PUINT_8 pucFreeQuota; - - DBGLOG(QM, LOUD, ("Enter qmDequeueTxPacketsFromPerStaQueues (TC = %u)\n", ucTC)); - - ASSERT(ucTC == TC0_INDEX || ucTC == TC1_INDEX || - ucTC == TC2_INDEX || ucTC == TC3_INDEX || - ucTC == TC4_INDEX - ); - - if(!ucCurrentQuota){ - DBGLOG(TX, LOUD, ("@@@@@ TC = %u ucCurrentQuota = %u @@@@@\n", - ucTC, ucCurrentQuota)); - return; - } - - u4Resource = ucCurrentQuota; - - //4 <1> Determine the head STA - /* The head STA shall be an active STA */ - - pu4HeadStaRecIndex = &(prQM->au4HeadStaRecIndex[ucTC]); - pu4HeadStaRecForwardCount = &(prQM->au4ForwardCount[ucTC]); - - DBGLOG(QM, LOUD, ("(Fairness) TID = %u Init Head STA = %u Resource = %u\n", - ucTC, *pu4HeadStaRecIndex, u4Resource)); - - - /* From STA[x] to STA[x+1] to STA[x+2] to ... to STA[x] */ - for (i=0; i < CFG_NUM_OF_STA_RECORD + 1; i++){ - prStaRec = &prAdapter->arStaRec[(*pu4HeadStaRecIndex)]; - ASSERT(prStaRec); - - /* Only Data frame (1x was not included) will be queued in */ - if (prStaRec->fgIsValid){ - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - - ASSERT(prBssInfo->ucNetTypeIndex == prStaRec->ucNetTypeIndex); - - /* Determine how many packets the head STA is allowed to send in a round */ - - QM_DBG_CNT_INC(prQM, QM_DBG_CNT_25); - u4MaxForwardCount = ucTotalQuota; -#if CFG_ENABLE_WIFI_DIRECT - - pucFreeQuota = NULL; - if(prStaRec->fgIsInPS && (ucTC!=TC4_INDEX)) { - // TODO: Change the threshold in coorperation with the PS forwarding mechanism - // u4MaxForwardCount = ucTotalQuota; - /* Per STA flow control when STA in PS mode */ - /* The PHASE 1: only update from ucFreeQuota (now) */ - /* XXX The PHASE 2: Decide by ucFreeQuota and ucBmpDeliveryAC (per queue ) aucFreeQuotaPerQueue[] */ - /* NOTE: other method to set u4Resource */ - - if(prStaRec->fgIsQoS && prStaRec->fgIsUapsdSupported - /* && prAdapter->rWifiVar.fgSupportQoS - && prAdapter->rWifiVar.fgSupportUAPSD*/) { - - if( prStaRec->ucBmpTriggerAC & BIT(ucTC)) { - u4MaxForwardCount = prStaRec->ucFreeQuotaForDelivery; - pucFreeQuota = &prStaRec->ucFreeQuotaForDelivery; - } - else { - u4MaxForwardCount = prStaRec->ucFreeQuotaForNonDelivery; - pucFreeQuota = &prStaRec->ucFreeQuotaForNonDelivery; - } - - } - else { - ASSERT(prStaRec->ucFreeQuotaForDelivery == 0); - u4MaxForwardCount = prStaRec->ucFreeQuotaForNonDelivery; - pucFreeQuota = &prStaRec->ucFreeQuotaForNonDelivery; - } - - } /* fgIsInPS */ -#endif /* CFG_ENABLE_WIFI_DIRECT */ - -#if CFG_ENABLE_WIFI_DIRECT - if(prBssInfo->fgIsNetAbsent && (ucTC!=TC4_INDEX)) { - if(u4MaxForwardCount > prBssInfo->ucBssFreeQuota) { - u4MaxForwardCount = prBssInfo->ucBssFreeQuota; - } - } - -#endif /* CFG_ENABLE_WIFI_DIRECT */ - - /* Determine whether the head STA can continue to forward packets in this round */ - if((*pu4HeadStaRecForwardCount) < u4MaxForwardCount){ - break; - } - - } /* prStaRec->fgIsValid */ - else{ - /* The current Head STA has been deactivated, so search for a new head STA */ - prStaRec = NULL; - prBssInfo = NULL; - (*pu4HeadStaRecIndex) ++; - (*pu4HeadStaRecIndex) %= CFG_NUM_OF_STA_RECORD; - - /* Reset the forwarding count before searching (since this is for a new selected STA) */ - (*pu4HeadStaRecForwardCount) = 0; - } - } /* i < CFG_NUM_OF_STA_RECORD + 1 */ - - /* All STA_RECs are inactive, so exit */ - if (!prStaRec){ - /* Under concurrent, it is possible that there is no candidcated STA.*/ - //DBGLOG(TX, EVENT, ("All STA_RECs are inactive\n")); - return; - } - - DBGLOG(QM, LOUD, ("(Fairness) TID = %u Round Head STA = %lu\n", - ucTC, *pu4HeadStaRecIndex)); - - //4 <2> Dequeue packets from the head STA - - prCurrQueue = &prStaRec->arTxQueue[ucTC]; - prDequeuedPkt = NULL; - fgChangeHeadSta = FALSE; - - while(prCurrQueue){ - - -#if QM_DEBUG_COUNTER - - if(ucTC <= TC4_INDEX) { - if(QUEUE_IS_EMPTY(prCurrQueue)) { - QM_DBG_CNT_INC(prQM, ucTC); - /* QM_DBG_CNT_00 */ /* QM_DBG_CNT_01 */ /* QM_DBG_CNT_02 */ /* QM_DBG_CNT_03 */ /* QM_DBG_CNT_04 */ - } - if(u4Resource == 0) { - QM_DBG_CNT_INC(prQM, ucTC + 5); - /* QM_DBG_CNT_05 */ /* QM_DBG_CNT_06 */ /* QM_DBG_CNT_07 */ /* QM_DBG_CNT_08 */ /* QM_DBG_CNT_09 */ - } - if(((*pu4HeadStaRecForwardCount) >= u4MaxForwardCount)) { - QM_DBG_CNT_INC(prQM, ucTC + 10); - /* QM_DBG_CNT_10 */ /* QM_DBG_CNT_11 */ /* QM_DBG_CNT_12 */ /* QM_DBG_CNT_13 */ /* QM_DBG_CNT_14 */ - } - } -#endif - - - /* Three cases to break: (1) No resource (2) No packets (3) Fairness */ - if (QUEUE_IS_EMPTY(prCurrQueue) || ((*pu4HeadStaRecForwardCount) >= u4MaxForwardCount)){ - fgChangeHeadSta = TRUE; - break; - } - else if (u4Resource == 0){ - break; - } - else{ - - QUEUE_REMOVE_HEAD(prCurrQueue, prDequeuedPkt, P_MSDU_INFO_T); -#if DBG && 0 - LOG_FUNC("Deq0 TC %d queued %u net %u mac len %u len %u Type %u 1x %u 11 %u\n", - prDequeuedPkt->ucTC, - prCurrQueue->u4NumElem, - prDequeuedPkt->ucNetworkType, - prDequeuedPkt->ucMacHeaderLength, - prDequeuedPkt->u2FrameLength, - prDequeuedPkt->ucPacketType, - prDequeuedPkt->fgIs802_1x, - prDequeuedPkt->fgIs802_11 ); - - LOG_FUNC("Dest Mac: " MACSTR "\n", - MAC2STR(prDequeuedPkt->aucEthDestAddr)); - -#if LINUX - { - struct sk_buff *prSkb = (struct sk_buff *) prDequeuedPkt->prPacket; - dumpMemory8((PUINT_8)prSkb->data,prSkb->len); - } -#endif - -#endif - - ASSERT(prDequeuedPkt->ucTC == ucTC); - - if(!QUEUE_IS_EMPTY(prCurrQueue)) { - /* XXX: check all queues for STA */ - prDequeuedPkt->ucPsForwardingType = PS_FORWARDING_MORE_DATA_ENABLED; - } - - QUEUE_INSERT_TAIL(prQue,(P_QUE_ENTRY_T)prDequeuedPkt); - u4Resource--; - (*pu4HeadStaRecForwardCount) ++; - - -#if CFG_ENABLE_WIFI_DIRECT - /* XXX The PHASE 2: decrease from aucFreeQuotaPerQueue[] */ - if(prStaRec->fgIsInPS && (ucTC!=TC4_INDEX)) { - ASSERT(pucFreeQuota); - ASSERT(*pucFreeQuota>0); - if(*pucFreeQuota>0) { - *pucFreeQuota = *pucFreeQuota - 1; - } - } -#endif /* CFG_ENABLE_WIFI_DIRECT */ - -#if CFG_ENABLE_WIFI_DIRECT - if(prBssInfo->fgIsNetAbsent && (ucTC!=TC4_INDEX)) { - if(prBssInfo->ucBssFreeQuota>0) { - prBssInfo->ucBssFreeQuota--; - } - } -#endif /* CFG_ENABLE_WIFI_DIRECT */ - - } - } - - if (*pu4HeadStaRecForwardCount){ - DBGLOG(QM, LOUD, ("TC = %u Round Head STA = %lu, u4HeadStaRecForwardCount = %lu\n", ucTC, *pu4HeadStaRecIndex, (*pu4HeadStaRecForwardCount))); - } - -#if QM_BURST_END_INFO_ENABLED - /* Let FW know which packet is the last one dequeued from the STA */ - if (prDequeuedPkt){ - prDequeuedPkt->fgIsBurstEnd = TRUE; - } -#endif - - - //4 <3> Dequeue from the other STAs if there is residual TX resource - - /* Check all of the STAs to continue forwarding packets (including the head STA) */ - for (i= 0; i< CFG_NUM_OF_STA_RECORD; i++){ - /* Break in case no reasource is available */ - if (u4Resource == 0){ - break; - } - - /* The current head STA will be examined when i = CFG_NUM_OF_STA_RECORD-1 */ - prStaRec = &prAdapter->arStaRec[((*pu4HeadStaRecIndex) + i + 1) % CFG_NUM_OF_STA_RECORD]; - ASSERT(prStaRec); - - if (prStaRec->fgIsValid) { - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - ASSERT(prBssInfo->ucNetTypeIndex == prStaRec->ucNetTypeIndex); - - DBGLOG(QM, LOUD, ("(Fairness) TID = %u Sharing STA = %u Resource = %lu\n", - ucTC, prStaRec->ucIndex, u4Resource)); - - prCurrQueue = &prStaRec->arTxQueue[ucTC]; - u4ForwardCount = 0; - u4MaxForwardCount = ucTotalQuota; - -#if CFG_ENABLE_WIFI_DIRECT - pucFreeQuota = NULL; - if(prStaRec->fgIsInPS && (ucTC!=TC4_INDEX)) { - // TODO: Change the threshold in coorperation with the PS forwarding mechanism - // u4MaxForwardCount = ucTotalQuota; - /* Per STA flow control when STA in PS mode */ - /* The PHASE 1: only update from ucFreeQuota (now) */ - /* XXX The PHASE 2: Decide by ucFreeQuota and ucBmpDeliveryAC (per queue ) aucFreeQuotaPerQueue[] */ - /* NOTE: other method to set u4Resource */ - if(prStaRec->fgIsQoS && prStaRec->fgIsUapsdSupported - /* && prAdapter->rWifiVar.fgSupportQoS - && prAdapter->rWifiVar.fgSupportUAPSD*/) { - - if( prStaRec->ucBmpTriggerAC & BIT(ucTC)) { - u4MaxForwardCount = prStaRec->ucFreeQuotaForDelivery; - pucFreeQuota = &prStaRec->ucFreeQuotaForDelivery; - } - else { - u4MaxForwardCount = prStaRec->ucFreeQuotaForNonDelivery; - pucFreeQuota = &prStaRec->ucFreeQuotaForNonDelivery; - } - - } - else { - ASSERT(prStaRec->ucFreeQuotaForDelivery == 0); - u4MaxForwardCount = prStaRec->ucFreeQuotaForNonDelivery; - pucFreeQuota = &prStaRec->ucFreeQuotaForNonDelivery; - } - - } -#endif /* CFG_ENABLE_WIFI_DIRECT */ -#if CFG_ENABLE_WIFI_DIRECT - if(prBssInfo->fgIsNetAbsent && (ucTC!=TC4_INDEX)) { - if(u4MaxForwardCount > prBssInfo->ucBssFreeQuota) { - u4MaxForwardCount = prBssInfo->ucBssFreeQuota; - } - } - -#endif /* CFG_ENABLE_WIFI_DIRECT */ - } /* prStaRec->fgIsValid */ - else{ - prBssInfo = NULL; - /* Invalid STA, so check the next STA */ - continue; - } - - while(prCurrQueue){ - /* Three cases to break: (1) No resource (2) No packets (3) Fairness */ - if ((u4Resource == 0) || QUEUE_IS_EMPTY(prCurrQueue) || (u4ForwardCount >= u4MaxForwardCount)){ - break; - } - else{ - - QUEUE_REMOVE_HEAD(prCurrQueue, prDequeuedPkt, P_MSDU_INFO_T); - -#if DBG && 0 - DBGLOG(QM, LOUD, ("Deq0 TC %d queued %u net %u mac len %u len %u Type %u 1x %u 11 %u\n", - prDequeuedPkt->ucTC, - prCurrQueue->u4NumElem, - prDequeuedPkt->ucNetworkType, - prDequeuedPkt->ucMacHeaderLength, - prDequeuedPkt->u2FrameLength, - prDequeuedPkt->ucPacketType, - prDequeuedPkt->fgIs802_1x, - prDequeuedPkt->fgIs802_11 )); - - DBGLOG(QM, LOUD,("Dest Mac: " MACSTR "\n", - MAC2STR(prDequeuedPkt->aucEthDestAddr))); - -#if LINUX - { - struct sk_buff *prSkb = (struct sk_buff *) prDequeuedPkt->prPacket; - dumpMemory8((PUINT_8)prSkb->data,prSkb->len); - } -#endif - -#endif - - - ASSERT(prDequeuedPkt->ucTC == ucTC); - - if(!QUEUE_IS_EMPTY(prCurrQueue)) { - prDequeuedPkt->ucPsForwardingType = PS_FORWARDING_MORE_DATA_ENABLED; - } - - QUEUE_INSERT_TAIL(prQue,(P_QUE_ENTRY_T)prDequeuedPkt); - u4Resource--; - u4ForwardCount ++; - -#if CFG_ENABLE_WIFI_DIRECT - /* XXX The PHASE 2: decrease from aucFreeQuotaPerQueue[] */ - if(prStaRec->fgIsInPS && (ucTC!=TC4_INDEX)) { - ASSERT(pucFreeQuota); - ASSERT(*pucFreeQuota>0); - if(*pucFreeQuota>0) { - *pucFreeQuota = *pucFreeQuota - 1; - } - } -#endif /* CFG_ENABLE_WIFI_DIRECT */ - - -#if CFG_ENABLE_WIFI_DIRECT - ASSERT(prBssInfo->ucNetTypeIndex == prStaRec->ucNetTypeIndex); - if(prBssInfo->fgIsNetAbsent && (ucTC!=TC4_INDEX)) { - if(prBssInfo->ucBssFreeQuota>0) { - prBssInfo->ucBssFreeQuota--; - } - } -#endif /* CFG_ENABLE_WIFI_DIRECT */ - - } - } - -#if QM_BURST_END_INFO_ENABLED - /* Let FW know which packet is the last one dequeued from the STA */ - if (u4ForwardCount){ - prDequeuedPkt->fgIsBurstEnd = TRUE; - } -#endif - } - - - if (fgChangeHeadSta){ - (*pu4HeadStaRecIndex) ++; - (*pu4HeadStaRecIndex) %= CFG_NUM_OF_STA_RECORD; - (*pu4HeadStaRecForwardCount) = 0; - DBGLOG(QM, LOUD, ("(Fairness) TID = %u Scheduled Head STA = %lu Left Resource = %lu\n", - ucTC, (*pu4HeadStaRecIndex), u4Resource)); - } - - -/***************************************************************************************/ -#else - UINT_8 ucStaRecIndex; - P_STA_RECORD_T prStaRec; - P_QUE_T prCurrQueue; - UINT_8 ucPktCount; - P_MSDU_INFO_T prDequeuedPkt; - - DBGLOG(QM, LOUD, ("Enter qmDequeueTxPacketsFromPerStaQueues (TC = %u)\n", ucTC)); - - if (ucCurrentQuota == 0){ - return; - } - - //4 <1> Determine the queue index and the head STA - - /* The head STA */ - ucStaRecIndex = 0; /* TODO: Get the current head STA */ - prStaRec = QM_GET_STA_REC_PTR_FROM_INDEX(prAdapter, ucStaRecIndex); - ASSERT(prStaRec); - - if(prStaRec == NULL) { - return; - } - - /* The queue to pull out packets */ - ASSERT(ucTC == TC0_INDEX || ucTC == TC1_INDEX || - ucTC == TC2_INDEX || ucTC == TC3_INDEX || - ucTC == TC4_INDEX - ); - prCurrQueue = &prStaRec->arTxQueue[ucTC]; - - ucPktCount = ucCurrentQuota; - prDequeuedPkt = NULL; - - //4 <2> Dequeue packets for the head STA - while(TRUE){ - if (!(prStaRec->fgIsValid) || ucPktCount ==0 || QUEUE_IS_EMPTY(prCurrQueue)){ - break; - - } - else{ - - QUEUE_REMOVE_HEAD(prCurrQueue, prDequeuedPkt, P_MSDU_INFO_T); - //DbgPrint("QM: Remove Queue Head, TC= %d\n", prDequeuedPkt->ucTC); - ASSERT(prDequeuedPkt->ucTC == ucTC); - - QUEUE_INSERT_TAIL(prQue,(P_QUE_ENTRY_T)prDequeuedPkt); - ucPktCount--; - } - } - - //DbgPrint("QM: Remaining number of queued packets = %d\n", prCurrQueue->u4NumElem); - -#if QM_BURST_END_INFO_ENABLED - if (prDequeuedPkt){ - prDequeuedPkt->fgIsBurstEnd = TRUE; - } - -#endif - - //4 <3> Update scheduling info - /* TODO */ - - //4 <4> Utilize the remainaing TX opportunities for non-head STAs - /* TODO */ -#endif -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Dequeue TX packets from a per-Type-based Queue for a particular TC -* -* \param[out] prQue The queue to put the dequeued packets -* \param[in] ucTC The TC index (Shall always be TC5_INDEX) -* \param[in] ucMaxNum The maximum amount of dequeued packets -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -static VOID -qmDequeueTxPacketsFromPerTypeQueues( - IN P_ADAPTER_T prAdapter, - OUT P_QUE_T prQue, - IN UINT_8 ucTC, - IN UINT_8 ucMaxNum - ) -{ - //UINT_8 ucQueIndex; - //UINT_8 ucStaRecIndex; - P_BSS_INFO_T prBssInfo; - P_BSS_INFO_T parBssInfo; - P_QUE_T prCurrQueue; - UINT_8 ucPktCount; - P_MSDU_INFO_T prDequeuedPkt; - P_MSDU_INFO_T prBurstEndPkt; - QUE_T rMergeQue; - P_QUE_T prMergeQue; - P_QUE_MGT_T prQM; - - DBGLOG(QM, LOUD, ("Enter qmDequeueTxPacketsFromPerTypeQueues (TC = %d, Max = %d)\n", ucTC, ucMaxNum)); - - /* TC5: Broadcast/Multicast data packets */ - ASSERT(ucTC == TC5_INDEX); - - if (ucMaxNum == 0){ - return; - } - - prQM = &prAdapter->rQM; - //4 <1> Determine the queue - - prCurrQueue = &prQM->arTxQueue[TX_QUEUE_INDEX_BMCAST]; - ucPktCount = ucMaxNum; - prDequeuedPkt = NULL; - prBurstEndPkt = NULL; - - parBssInfo = prAdapter->rWifiVar.arBssInfo; - - QUEUE_INITIALIZE(&rMergeQue); - prMergeQue = &rMergeQue; - - //4 <2> Dequeue packets - while(TRUE){ - if(ucPktCount ==0 || QUEUE_IS_EMPTY(prCurrQueue)){ - break; - } - else{ - QUEUE_REMOVE_HEAD(prCurrQueue, prDequeuedPkt, P_MSDU_INFO_T); - ASSERT(prDequeuedPkt->ucTC == ucTC); - - ASSERT(prDequeuedPkt->ucNetworkType < NETWORK_TYPE_INDEX_NUM); - - prBssInfo = &parBssInfo[prDequeuedPkt->ucNetworkType]; - - if(IS_BSS_ACTIVE(prBssInfo)) { - if( !prBssInfo->fgIsNetAbsent){ - QUEUE_INSERT_TAIL(prQue,(P_QUE_ENTRY_T)prDequeuedPkt); - prBurstEndPkt = prDequeuedPkt; - ucPktCount--; - QM_DBG_CNT_INC(prQM, QM_DBG_CNT_26); -#if DBG && 0 - LOG_FUNC("DeqType TC %d queued %u net %u mac len %u len %u Type %u 1x %u 11 %u\n", - prDequeuedPkt->ucTC, - prCurrQueue->u4NumElem, - prDequeuedPkt->ucNetworkType, - prDequeuedPkt->ucMacHeaderLength, - prDequeuedPkt->u2FrameLength, - prDequeuedPkt->ucPacketType, - prDequeuedPkt->fgIs802_1x, - prDequeuedPkt->fgIs802_11 ); - - LOG_FUNC("Dest Mac: " MACSTR "\n", - MAC2STR(prDequeuedPkt->aucEthDestAddr)); - -#if LINUX - { - struct sk_buff *prSkb = (struct sk_buff *) prDequeuedPkt->prPacket; - dumpMemory8((PUINT_8)prSkb->data,prSkb->len); - } -#endif - -#endif - } - else { - QUEUE_INSERT_TAIL(prMergeQue,(P_QUE_ENTRY_T)prDequeuedPkt); - } - } - else { - QM_TX_SET_NEXT_MSDU_INFO(prDequeuedPkt, NULL); - wlanProcessQueuedMsduInfo(prAdapter,prDequeuedPkt); - } - } - } - - if(QUEUE_IS_NOT_EMPTY(prMergeQue)) { - QUEUE_CONCATENATE_QUEUES(prMergeQue, prCurrQueue); - QUEUE_MOVE_ALL(prCurrQueue, prMergeQue); - QM_TX_SET_NEXT_MSDU_INFO((P_MSDU_INFO_T)QUEUE_GET_TAIL(prCurrQueue), NULL); - } - -#if QM_BURST_END_INFO_ENABLED - if (prBurstEndPkt){ - prBurstEndPkt->fgIsBurstEnd = TRUE; - } -#endif -} /* qmDequeueTxPacketsFromPerTypeQueues */ - - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Dequeue TX packets to send to HIF TX -* -* \param[in] prTcqStatus Info about the maximum amount of dequeued packets -* -* \return The list of dequeued TX packets -*/ -/*----------------------------------------------------------------------------*/ -P_MSDU_INFO_T -qmDequeueTxPackets( - IN P_ADAPTER_T prAdapter, - IN P_TX_TCQ_STATUS_T prTcqStatus - ) -{ - - INT_32 i; - P_MSDU_INFO_T prReturnedPacketListHead; - QUE_T rReturnedQue; - - DBGLOG(QM, LOUD, ("Enter qmDequeueTxPackets\n")); - - QUEUE_INITIALIZE(&rReturnedQue); - - prReturnedPacketListHead = NULL; - - /* TC0 to TC4: AC0~AC3, 802.1x (commands packets are not handled by QM) */ - for(i = TC4_INDEX; i >= TC0_INDEX; i--){ - DBGLOG(QM, LOUD, ("Dequeue packets from Per-STA queue[%u]\n", i)); - - qmDequeueTxPacketsFromPerStaQueues( - prAdapter, - &rReturnedQue, - (UINT_8)i, - prTcqStatus->aucFreeBufferCount[i], - prTcqStatus->aucMaxNumOfBuffer[i] - ); - - /* The aggregate number of dequeued packets */ - DBGLOG(QM, LOUD, ("DQA)[%u](%lu)\n", i, rReturnedQue.u4NumElem)); - } - - - /* TC5 (BMCAST or STA-NOT-FOUND packets) */ - qmDequeueTxPacketsFromPerTypeQueues( - prAdapter, - &rReturnedQue, - TC5_INDEX, - prTcqStatus->aucFreeBufferCount[TC5_INDEX] - ); - - DBGLOG(QM, LOUD, ("Current total number of dequeued packets = %u\n", rReturnedQue.u4NumElem)); - - if (QUEUE_IS_NOT_EMPTY(&rReturnedQue)){ - prReturnedPacketListHead = (P_MSDU_INFO_T)QUEUE_GET_HEAD(&rReturnedQue); - QM_TX_SET_NEXT_MSDU_INFO((P_MSDU_INFO_T)QUEUE_GET_TAIL(&rReturnedQue), NULL); - } - - return prReturnedPacketListHead; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Adjust the TC quotas according to traffic demands -* -* \param[out] prTcqAdjust The resulting adjustment -* \param[in] prTcqStatus Info about the current TC quotas and counters -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmAdjustTcQuotas ( - IN P_ADAPTER_T prAdapter, - OUT P_TX_TCQ_ADJUST_T prTcqAdjust, - IN P_TX_TCQ_STATUS_T prTcqStatus - ) -{ -#if QM_ADAPTIVE_TC_RESOURCE_CTRL - UINT_32 i; - P_QUE_MGT_T prQM = &prAdapter->rQM; - - /* Must initialize */ - for (i = 0; i < TC_NUM; i++){ - prTcqAdjust->acVariation[i]= 0; - } - - //4 <1> If TC resource is not just adjusted, exit directly - if (!prQM->fgTcResourcePostAnnealing){ - return; - } - - //4 <2> Adjust TcqStatus according to the updated prQM->au4CurrentTcResource - else{ - INT_32 i4TotalExtraQuota = 0; - INT_32 ai4ExtraQuota[TC_NUM]; - BOOLEAN fgResourceRedistributed = TRUE; - - /* Obtain the free-to-distribute resource */ - for (i = 0; i < TC_NUM; i++){ - ai4ExtraQuota[i] = (INT_32)prTcqStatus->aucMaxNumOfBuffer[i] - (INT_32)prQM->au4CurrentTcResource[i]; - - if (ai4ExtraQuota[i] > 0){ /* The resource shall be reallocated to other TCs */ - if (ai4ExtraQuota[i] > prTcqStatus->aucFreeBufferCount[i]){ - ai4ExtraQuota[i] = prTcqStatus->aucFreeBufferCount[i]; - fgResourceRedistributed = FALSE; - } - - i4TotalExtraQuota += ai4ExtraQuota[i]; - prTcqAdjust->acVariation[i] = (INT_8)(-ai4ExtraQuota[i]); - } - } - - /* Distribute quotas to TCs which need extra resource according to prQM->au4CurrentTcResource */ - for (i = 0; i < TC_NUM; i++){ - if (ai4ExtraQuota[i] < 0){ - if ((-ai4ExtraQuota[i]) > i4TotalExtraQuota){ - ai4ExtraQuota[i] = (-i4TotalExtraQuota); - fgResourceRedistributed = FALSE; - } - - i4TotalExtraQuota += ai4ExtraQuota[i]; - prTcqAdjust->acVariation[i] = (INT_8)(-ai4ExtraQuota[i]); - } - } - - /* In case some TC is waiting for TX Done, continue to adjust TC quotas upon TX Done */ - prQM->fgTcResourcePostAnnealing = (!fgResourceRedistributed); - -#if QM_PRINT_TC_RESOURCE_CTRL - DBGLOG(QM, LOUD, ("QM: Curr Quota [0]=%u [1]=%u [2]=%u [3]=%u [4]=%u [5]=%u\n", - prTcqStatus->aucFreeBufferCount[0], - prTcqStatus->aucFreeBufferCount[1], - prTcqStatus->aucFreeBufferCount[2], - prTcqStatus->aucFreeBufferCount[3], - prTcqStatus->aucFreeBufferCount[4], - prTcqStatus->aucFreeBufferCount[5] - )); -#endif - } - -#else - UINT_32 i; - for (i = 0; i < TC_NUM; i++){ - prTcqAdjust->acVariation[i]= 0; - } - -#endif -} - -#if QM_ADAPTIVE_TC_RESOURCE_CTRL -/*----------------------------------------------------------------------------*/ -/*! -* \brief Update the average TX queue length for the TC resource control mechanism -* -* \param (none) -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmUpdateAverageTxQueLen( - IN P_ADAPTER_T prAdapter - ) -{ - INT_32 u4CurrQueLen, i, k; - P_STA_RECORD_T prStaRec; - P_QUE_MGT_T prQM = &prAdapter->rQM; - - //4 <1> Update the queue lengths for TC0 to TC3 (skip TC4) and TC5 */ - for (i = 0; i < NUM_OF_PER_STA_TX_QUEUES - 1; i++){ - u4CurrQueLen = 0; - - for (k = 0; k < CFG_NUM_OF_STA_RECORD; k++){ - prStaRec = &prAdapter->arStaRec[k]; - ASSERT(prStaRec); - - /* If the STA is activated, get the queue length */ - if (prStaRec->fgIsValid && - (!prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex].fgIsNetAbsent) - ) - { - - u4CurrQueLen += (prStaRec->arTxQueue[i].u4NumElem); - } - } - - if (prQM->au4AverageQueLen[i] == 0){ - prQM->au4AverageQueLen[i] = (u4CurrQueLen << QM_QUE_LEN_MOVING_AVE_FACTOR); - } - else{ - prQM->au4AverageQueLen[i] -= (prQM->au4AverageQueLen[i] >> QM_QUE_LEN_MOVING_AVE_FACTOR); - prQM->au4AverageQueLen[i] += (u4CurrQueLen); - } - - } - - /* Update the queue length for TC5 (BMCAST) */ - u4CurrQueLen = prQM->arTxQueue[TX_QUEUE_INDEX_BMCAST].u4NumElem; - - if (prQM->au4AverageQueLen[TC_NUM-1] == 0){ - prQM->au4AverageQueLen[TC_NUM-1] = (u4CurrQueLen << QM_QUE_LEN_MOVING_AVE_FACTOR); - } - else{ - prQM->au4AverageQueLen[TC_NUM-1] -= (prQM->au4AverageQueLen[TC_NUM-1] >> QM_QUE_LEN_MOVING_AVE_FACTOR); - prQM->au4AverageQueLen[TC_NUM-1] += (u4CurrQueLen); - } - - - //4 <2> Adjust TC resource assignment - /* Check whether it is time to adjust the TC resource assignment */ - if (--prQM->u4TimeToAdjustTcResource == 0){ - /* The last assignment has not been completely applied */ - if (prQM->fgTcResourcePostAnnealing){ - /* Upon the next qmUpdateAverageTxQueLen function call, do this check again */ - prQM->u4TimeToAdjustTcResource = 1; - } - - /* The last assignment has been applied */ - else{ - prQM->u4TimeToAdjustTcResource = QM_INIT_TIME_TO_ADJUST_TC_RSC; - qmReassignTcResource(prAdapter); - } - } - - /* Debug */ -#if QM_PRINT_TC_RESOURCE_CTRL - for (i=0; i= 100){ - DBGLOG(QM, LOUD, ("QM: QueLen [%ld %ld %ld %ld %ld %ld]\n", - QM_GET_TX_QUEUE_LEN(prAdapter, 0), - QM_GET_TX_QUEUE_LEN(prAdapter, 1), - QM_GET_TX_QUEUE_LEN(prAdapter, 2), - QM_GET_TX_QUEUE_LEN(prAdapter, 3), - QM_GET_TX_QUEUE_LEN(prAdapter, 4), - QM_GET_TX_QUEUE_LEN(prAdapter, 5) - )); - break; - } - } -#endif - -} - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Assign TX resource for each TC according to TX queue length and current assignment -* -* \param (none) -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmReassignTcResource( - IN P_ADAPTER_T prAdapter - ) -{ - INT_32 i4TotalResourceDemand = 0; - UINT_32 u4ResidualResource = 0; - UINT_32 i; - INT_32 ai4PerTcResourceDemand[TC_NUM]; - UINT_32 u4ShareCount = 0; - UINT_32 u4Share = 0 ; - P_QUE_MGT_T prQM = &prAdapter->rQM; - - /* Note: After the new assignment is obtained, set prQM->fgTcResourcePostAnnealing to TRUE to - * start the TC-quota adjusting procedure, which will be invoked upon every TX Done - */ - - //4 <1> Determine the demands - /* Determine the amount of extra resource to fulfill all of the demands */ - for (i=0; iau4MinReservedTcResource[i] - prQM->au4CurrentTcResource[i]); - - /* If there are queued packets, allocate extra resource for the TC (for TCP consideration) */ - if (QM_GET_TX_QUEUE_LEN(prAdapter, i)){ - ai4PerTcResourceDemand[i] += QM_EXTRA_RESERVED_RESOURCE_WHEN_BUSY; - } - - i4TotalResourceDemand += ai4PerTcResourceDemand[i]; - } - - //4 <2> Case 1: Demand <= Total Resource - if (i4TotalResourceDemand <= 0){ - //4 <2.1> Satisfy every TC - for (i = 0; i < TC_NUM; i++){ - /* Skip TC4 (not adjustable) */ - if (i == TC4_INDEX) { - continue; - } - - prQM->au4CurrentTcResource[i] += ai4PerTcResourceDemand[i]; - } - - //4 <2.2> Share the residual resource evenly - u4ShareCount= (TC_NUM - 1); /* excluding TC4 */ - u4ResidualResource = (UINT_32)(-i4TotalResourceDemand); - u4Share = (u4ResidualResource/u4ShareCount); - - for (i=0; iau4CurrentTcResource[i] += u4Share; - - /* Every TC is fully satisfied */ - ai4PerTcResourceDemand[i] = 0; - - /* The left resource will be allocated to TC3 */ - u4ResidualResource -= u4Share; - } - - //4 <2.3> Allocate the left resource to TC3 (VO) - prQM->au4CurrentTcResource[TC3_INDEX] += (u4ResidualResource); - - } - - //4 <3> Case 2: Demand > Total Resource --> Guarantee a minimum amount of resource for each TC - else{ - u4ResidualResource = QM_INITIAL_RESIDUAL_TC_RESOURCE; - - //4 <3.1> Allocated resouce amount = minimum of (guaranteed, total demand) - for (i=0; iau4CurrentTcResource[i] + ai4PerTcResourceDemand[i] < prQM->au4GuaranteedTcResource[i]){ - prQM->au4CurrentTcResource[i] += ai4PerTcResourceDemand[i]; - u4ResidualResource += (prQM->au4GuaranteedTcResource[i] - prQM->au4CurrentTcResource[i]); - ai4PerTcResourceDemand[i] = 0; - } - - /* The demand can not be fulfilled with the guaranteed resource amount */ - else{ - ai4PerTcResourceDemand[i] -= (prQM->au4GuaranteedTcResource[i] - prQM->au4CurrentTcResource[i]); - prQM->au4CurrentTcResource[i] = prQM->au4GuaranteedTcResource[i]; - u4ShareCount++; - } - } - - //4 <3.2> Allocate the residual resource - do{ - /* If there is no resource left, exit directly */ - if (u4ResidualResource == 0){ - break; - } - - /* This shall not happen */ - if (u4ShareCount == 0){ - prQM->au4CurrentTcResource[TC1_INDEX] += u4ResidualResource; - DBGLOG(QM, ERROR, ("QM: (Error) u4ShareCount = 0\n")); - break; - } - - /* Share the residual resource evenly */ - u4Share = (u4ResidualResource / u4ShareCount); - if(u4Share){ - for (i=0; iau4CurrentTcResource[i] += u4Share; - u4ResidualResource -= u4Share; - ai4PerTcResourceDemand[i] -= u4Share; - } - else{ - prQM->au4CurrentTcResource[i] += ai4PerTcResourceDemand[i]; - u4ResidualResource -= ai4PerTcResourceDemand[i]; - ai4PerTcResourceDemand[i] = 0; - } - } - } - } - - /* By priority, allocate the left resource that is not divisible by u4Share */ - if (u4ResidualResource == 0){ - break; - } - - if (ai4PerTcResourceDemand[TC3_INDEX]){ /* VO */ - prQM->au4CurrentTcResource[TC3_INDEX]++; - if (--u4ResidualResource == 0) { - break; - } - } - - if (ai4PerTcResourceDemand[TC2_INDEX]){ /* VI */ - prQM->au4CurrentTcResource[TC2_INDEX]++; - if (--u4ResidualResource == 0) { - break; - } - } - - if (ai4PerTcResourceDemand[TC5_INDEX]){ /* BMCAST */ - prQM->au4CurrentTcResource[TC5_INDEX]++; - if (--u4ResidualResource == 0) { - break; - } - } - - if (ai4PerTcResourceDemand[TC1_INDEX]){ /* BE */ - prQM->au4CurrentTcResource[TC1_INDEX]++; - if (--u4ResidualResource == 0) { - break; - } - } - - if (ai4PerTcResourceDemand[TC0_INDEX]){ /* BK */ - prQM->au4CurrentTcResource[TC0_INDEX]++; - if (--u4ResidualResource == 0) { - break; - } - } - - /* Allocate the left resource */ - prQM->au4CurrentTcResource[TC3_INDEX] += u4ResidualResource; - - }while(FALSE); - } - - prQM->fgTcResourcePostAnnealing = TRUE; - -#if QM_PRINT_TC_RESOURCE_CTRL - /* Debug print */ - DBGLOG(QM, LOUD, ("QM: TC Rsc %ld %ld %ld %ld %ld %ld\n", - prQM->au4CurrentTcResource[0], - prQM->au4CurrentTcResource[1], - prQM->au4CurrentTcResource[2], - prQM->au4CurrentTcResource[3], - prQM->au4CurrentTcResource[4], - prQM->au4CurrentTcResource[5] - )); -#endif - -} - -#endif - - -/*----------------------------------------------------------------------------*/ -/* RX-Related Queue Management */ -/*----------------------------------------------------------------------------*/ -/*----------------------------------------------------------------------------*/ -/*! -* \brief Init Queue Managment for RX -* -* \param[in] (none) -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmInitRxQueues( - IN P_ADAPTER_T prAdapter - ) -{ - //DbgPrint("QM: Enter qmInitRxQueues()\n"); - /* TODO */ -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Handle RX packets (buffer reordering) -* -* \param[in] prSwRfbListHead The list of RX packets -* -* \return The list of packets which are not buffered for reordering -*/ -/*----------------------------------------------------------------------------*/ -P_SW_RFB_T -qmHandleRxPackets( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfbListHead - ) -{ - -#if CFG_RX_REORDERING_ENABLED - //UINT_32 i; - P_SW_RFB_T prCurrSwRfb; - P_SW_RFB_T prNextSwRfb; - P_HIF_RX_HEADER_T prHifRxHdr; - QUE_T rReturnedQue; - PUINT_8 pucEthDestAddr; - - //DbgPrint("QM: Enter qmHandleRxPackets()\n"); - - DEBUGFUNC("qmHandleRxPackets"); - - ASSERT(prSwRfbListHead); - - QUEUE_INITIALIZE(&rReturnedQue); - prNextSwRfb = prSwRfbListHead; - - do{ - prCurrSwRfb = prNextSwRfb; - prNextSwRfb = QM_RX_GET_NEXT_SW_RFB(prCurrSwRfb); - - prHifRxHdr = prCurrSwRfb->prHifRxHdr; // TODO: (Tehuang) Use macro to obtain the pointer - - /* TODO: (Tehuang) Check if relaying */ - prCurrSwRfb->eDst = RX_PKT_DESTINATION_HOST; - - /* Decide the Destination */ -#if CFG_RX_PKTS_DUMP - if (prAdapter->rRxCtrl.u4RxPktsDumpTypeMask & BIT(HIF_RX_PKT_TYPE_DATA)) { - DBGLOG(SW4, INFO, ("QM RX DATA: net %u sta idx %u wlan idx %u ssn %u tid %u ptype %u 11 %u\n", - HIF_RX_HDR_GET_NETWORK_IDX(prHifRxHdr), - prHifRxHdr->ucStaRecIdx, - prCurrSwRfb->ucWlanIdx, - HIF_RX_HDR_GET_SN(prHifRxHdr), /* The new SN of the frame */ - HIF_RX_HDR_GET_TID(prHifRxHdr), - prCurrSwRfb->ucPacketType, - HIF_RX_HDR_GET_80211_FLAG(prHifRxHdr))); - - DBGLOG_MEM8(SW4, TRACE, (PUINT_8)prCurrSwRfb->pvHeader, prCurrSwRfb->u2PacketLen); - } -#endif - // DBGLOG(RX, TRACE, ("SN=%d, TID=%d\n", HIF_RX_HDR_GET_SN(prHifRxHdr), HIF_RX_HDR_GET_TID(prHifRxHdr))); - - if (!HIF_RX_HDR_GET_80211_FLAG(prHifRxHdr)){ - - UINT_8 ucNetTypeIdx; - P_BSS_INFO_T prBssInfo; - - pucEthDestAddr = prCurrSwRfb->pvHeader; - ucNetTypeIdx = HIF_RX_HDR_GET_NETWORK_IDX(prHifRxHdr); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[ucNetTypeIdx]); - //DBGLOG_MEM8(QM, TRACE,prCurrSwRfb->pvHeader, 16); - // - - if( prAdapter->rRxCtrl.rFreeSwRfbList.u4NumElem - > (CFG_RX_MAX_PKT_NUM - CFG_NUM_OF_QM_RX_PKT_NUM) ) { - - if(IS_BSS_ACTIVE(prBssInfo)) { - if(OP_MODE_ACCESS_POINT == prBssInfo->eCurrentOPMode) { - if (IS_BMCAST_MAC_ADDR(pucEthDestAddr)){ - prCurrSwRfb->eDst = RX_PKT_DESTINATION_HOST_WITH_FORWARD; - } - else if(UNEQUAL_MAC_ADDR(prBssInfo->aucOwnMacAddr,pucEthDestAddr)) { - prCurrSwRfb->eDst = RX_PKT_DESTINATION_FORWARD; - /* TODO : need to check the dst mac is valid */ - /* If src mac is invalid, the packet will be freed in fw */ - } - } /* OP_MODE_ACCESS_POINT */ - } - else { - DBGLOG(QM, TRACE, ("Mark NULL the Packet for inactive Bss %u\n",ucNetTypeIdx)); - prCurrSwRfb->eDst = RX_PKT_DESTINATION_NULL; - QUEUE_INSERT_TAIL(&rReturnedQue, (P_QUE_ENTRY_T)prCurrSwRfb); - continue; - } - - } - else { - /* Dont not occupy other SW RFB */ - DBGLOG(QM, TRACE, ("Mark NULL the Packet for less Free Sw Rfb\n")); - prCurrSwRfb->eDst = RX_PKT_DESTINATION_NULL; - QUEUE_INSERT_TAIL(&rReturnedQue, (P_QUE_ENTRY_T)prCurrSwRfb); - continue; - } - - } - - /* BAR frame */ - if(HIF_RX_HDR_GET_BAR_FLAG(prHifRxHdr)){ - prCurrSwRfb->eDst = RX_PKT_DESTINATION_NULL; - qmProcessBarFrame(prAdapter, prCurrSwRfb, &rReturnedQue); - } - /* Reordering is not required for this packet, return it without buffering */ - else if(!HIF_RX_HDR_GET_REORDER_FLAG(prHifRxHdr)){ -#if 0 - if (!HIF_RX_HDR_GET_80211_FLAG(prHifRxHdr)){ - UINT_8 ucNetTypeIdx; - P_BSS_INFO_T prBssInfo; - - pucEthDestAddr = prCurrSwRfb->pvHeader; - ucNetTypeIdx = HIF_RX_HDR_GET_NETWORK_IDX(prHifRxHdr); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[ucNetTypeIdx]); - - if (IS_BMCAST_MAC_ADDR(pucEthDestAddr) && (OP_MODE_ACCESS_POINT == prBssInfo->eCurrentOPMode)){ - prCurrSwRfb->eDst = RX_PKT_DESTINATION_HOST_WITH_FORWARD; - } - } -#endif - QUEUE_INSERT_TAIL(&rReturnedQue, (P_QUE_ENTRY_T)prCurrSwRfb); - } - /* Reordering is required for this packet */ - else{ - /* If this packet should dropped or indicated to the host immediately, - * it should be enqueued into the rReturnedQue with specific flags. If - * this packet should be buffered for reordering, it should be enqueued - * into the reordering queue in the STA_REC rather than into the - * rReturnedQue. - */ - qmProcessPktWithReordering(prAdapter, prCurrSwRfb, &rReturnedQue); - - } - }while(prNextSwRfb); - - - /* The returned list of SW_RFBs must end with a NULL pointer */ - if(QUEUE_IS_NOT_EMPTY(&rReturnedQue)){ - QM_TX_SET_NEXT_MSDU_INFO((P_SW_RFB_T)QUEUE_GET_TAIL(&rReturnedQue), NULL); - } - - return (P_SW_RFB_T)QUEUE_GET_HEAD(&rReturnedQue); - -#else - - //DbgPrint("QM: Enter qmHandleRxPackets()\n"); - return prSwRfbListHead; - -#endif - -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Reorder the received packet -* -* \param[in] prSwRfb The RX packet to process -* \param[out] prReturnedQue The queue for indicating packets -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmProcessPktWithReordering( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT P_QUE_T prReturnedQue - ) -{ - - - P_STA_RECORD_T prStaRec; - P_HIF_RX_HEADER_T prHifRxHdr; - P_RX_BA_ENTRY_T prReorderQueParm; - - UINT_32 u4SeqNo; - UINT_32 u4WinStart; - UINT_32 u4WinEnd; - P_QUE_T prReorderQue; - //P_SW_RFB_T prReorderedSwRfb; - - DEBUGFUNC("qmProcessPktWithReordering"); - - ASSERT(prSwRfb); - ASSERT(prReturnedQue); - ASSERT(prSwRfb->prHifRxHdr); - - prHifRxHdr = prSwRfb->prHifRxHdr; - prSwRfb->ucStaRecIdx = prHifRxHdr->ucStaRecIdx; - prSwRfb->u2SSN = HIF_RX_HDR_GET_SN(prHifRxHdr); /* The new SN of the frame */ - prSwRfb->ucTid = (UINT_8)(HIF_RX_HDR_GET_TID(prHifRxHdr)); - //prSwRfb->eDst = RX_PKT_DESTINATION_HOST; - - /* Incorrect STA_REC index */ - if(prSwRfb->ucStaRecIdx >= CFG_NUM_OF_STA_RECORD){ - prSwRfb->eDst = RX_PKT_DESTINATION_NULL; - QUEUE_INSERT_TAIL(prReturnedQue,(P_QUE_ENTRY_T)prSwRfb); - DBGLOG(QM, WARN,("Reordering for a NULL STA_REC, ucStaRecIdx = %d\n", - prSwRfb->ucStaRecIdx)); - //ASSERT(0); - return; - } - - /* Check whether the STA_REC is activated */ - prStaRec = &(prAdapter->arStaRec[prSwRfb->ucStaRecIdx]); - ASSERT(prStaRec); - -#if 0 - if(!(prStaRec->fgIsValid)){ - /* TODO: (Tehuang) Handle the Host-FW sync issue. */ - prSwRfb->eDst = RX_PKT_DESTINATION_NULL; - QUEUE_INSERT_TAIL(prReturnedQue,(P_QUE_ENTRY_T)prSwRfb); - DBGLOG(QM, WARN, ("Reordering for an invalid STA_REC \n")); - //ASSERT(0); - return; - } -#endif - - /* Check whether the BA agreement exists */ - prReorderQueParm = ((prStaRec->aprRxReorderParamRefTbl)[prSwRfb->ucTid]); - if(!prReorderQueParm){ - /* TODO: (Tehuang) Handle the Host-FW sync issue.*/ - prSwRfb->eDst = RX_PKT_DESTINATION_NULL; - QUEUE_INSERT_TAIL(prReturnedQue,(P_QUE_ENTRY_T)prSwRfb); - DBGLOG(QM, WARN,("Reordering for a NULL ReorderQueParm \n")); - //ASSERT(0); - return; - } - - - - /* Start to reorder packets */ - u4SeqNo = (UINT_32)(prSwRfb->u2SSN); - prReorderQue = &(prReorderQueParm->rReOrderQue); - u4WinStart = (UINT_32)(prReorderQueParm->u2WinStart); - u4WinEnd = (UINT_32)(prReorderQueParm->u2WinEnd); - - /* Debug */ - //DbgPrint("QM:(R)[%d](%ld){%ld,%ld}\n", prSwRfb->ucTid, u4SeqNo, u4WinStart, u4WinEnd); - - /* Case 1: Fall within */ - if /* 0 - start - sn - end - 4095 */ - (((u4WinStart <= u4SeqNo) && (u4SeqNo <= u4WinEnd)) - /* 0 - end - start - sn - 4095 */ - || ((u4WinEnd < u4WinStart) && (u4WinStart <= u4SeqNo)) - /* 0 - sn - end - start - 4095 */ - || ((u4SeqNo <= u4WinEnd) && (u4WinEnd < u4WinStart))){ - - qmInsertFallWithinReorderPkt(prSwRfb, prReorderQueParm, prReturnedQue); - -#if QM_RX_WIN_SSN_AUTO_ADVANCING - if(prReorderQueParm->fgIsWaitingForPktWithSsn){ - /* Let the first received packet pass the reorder check */ - DBGLOG(QM, LOUD, ("QM:(A)[%d](%ld){%ld,%ld}\n", prSwRfb->ucTid, u4SeqNo, u4WinStart, u4WinEnd)); - - prReorderQueParm->u2WinStart = (UINT_16)u4SeqNo; - prReorderQueParm->u2WinEnd = - ((prReorderQueParm->u2WinStart) + (prReorderQueParm->u2WinSize) - 1) % MAX_SEQ_NO_COUNT; - prReorderQueParm->fgIsWaitingForPktWithSsn = FALSE; - } -#endif - - - qmPopOutDueToFallWithin(prReorderQueParm, prReturnedQue); - } - /* Case 2: Fall ahead */ - else if - /* 0 - start - end - sn - (start+2048) - 4095 */ - (((u4WinStart < u4WinEnd) - && (u4WinEnd < u4SeqNo) - && (u4SeqNo < (u4WinStart + HALF_SEQ_NO_COUNT))) - /* 0 - sn - (start+2048) - start - end - 4095 */ - || ((u4SeqNo < u4WinStart) - && (u4WinStart < u4WinEnd) - && ((u4SeqNo + MAX_SEQ_NO_COUNT) < (u4WinStart + HALF_SEQ_NO_COUNT))) - /* 0 - end - sn - (start+2048) - start - 4095 */ - || ((u4WinEnd < u4SeqNo) - && (u4SeqNo < u4WinStart) - && ((u4SeqNo + MAX_SEQ_NO_COUNT) < (u4WinStart + HALF_SEQ_NO_COUNT)))){ - - -#if QM_RX_WIN_SSN_AUTO_ADVANCING - if(prReorderQueParm->fgIsWaitingForPktWithSsn){ - prReorderQueParm->fgIsWaitingForPktWithSsn = FALSE; - } -#endif - - qmInsertFallAheadReorderPkt(prSwRfb, prReorderQueParm, prReturnedQue); - - /* Advance the window after inserting a new tail */ - prReorderQueParm->u2WinEnd = (UINT_16)u4SeqNo; - prReorderQueParm->u2WinStart = - (((prReorderQueParm->u2WinEnd) - (prReorderQueParm->u2WinSize) + MAX_SEQ_NO_COUNT + 1) - % MAX_SEQ_NO_COUNT); - - qmPopOutDueToFallAhead(prReorderQueParm, prReturnedQue); - - } - /* Case 3: Fall behind */ - else{ - -#if QM_RX_WIN_SSN_AUTO_ADVANCING - #if QM_RX_INIT_FALL_BEHIND_PASS - if(prReorderQueParm->fgIsWaitingForPktWithSsn){ - //?? prSwRfb->eDst = RX_PKT_DESTINATION_HOST; - QUEUE_INSERT_TAIL(prReturnedQue,(P_QUE_ENTRY_T)prSwRfb); - //DbgPrint("QM:(P)[%d](%ld){%ld,%ld}\n", prSwRfb->ucTid, u4SeqNo, u4WinStart, u4WinEnd); - return; - } - #endif -#endif - - /* An erroneous packet */ - prSwRfb->eDst = RX_PKT_DESTINATION_NULL; - QUEUE_INSERT_TAIL(prReturnedQue,(P_QUE_ENTRY_T)prSwRfb); - //DbgPrint("QM:(D)[%d](%ld){%ld,%ld}\n", prSwRfb->ucTid, u4SeqNo, u4WinStart, u4WinEnd); - return; - } - - return; - -} - - -VOID -qmProcessBarFrame( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - OUT P_QUE_T prReturnedQue - ) -{ - - P_STA_RECORD_T prStaRec; - P_HIF_RX_HEADER_T prHifRxHdr; - P_RX_BA_ENTRY_T prReorderQueParm; - - UINT_32 u4SSN; - UINT_32 u4WinStart; - UINT_32 u4WinEnd; - P_QUE_T prReorderQue; - //P_SW_RFB_T prReorderedSwRfb; - - ASSERT(prSwRfb); - ASSERT(prReturnedQue); - ASSERT(prSwRfb->prHifRxHdr); - - prHifRxHdr = prSwRfb->prHifRxHdr; - prSwRfb->ucStaRecIdx = prHifRxHdr->ucStaRecIdx; - prSwRfb->u2SSN = HIF_RX_HDR_GET_SN(prHifRxHdr); /* The new SSN */ - prSwRfb->ucTid = (UINT_8)(HIF_RX_HDR_GET_TID(prHifRxHdr)); - - prSwRfb->eDst = RX_PKT_DESTINATION_NULL; - QUEUE_INSERT_TAIL(prReturnedQue,(P_QUE_ENTRY_T)prSwRfb); - - /* Incorrect STA_REC index */ - if(prSwRfb->ucStaRecIdx >= CFG_NUM_OF_STA_RECORD){ - DBGLOG(QM, WARN, ("QM: (Warning) BAR for a NULL STA_REC, ucStaRecIdx = %d\n", - prSwRfb->ucStaRecIdx)); - //ASSERT(0); - return; - } - - /* Check whether the STA_REC is activated */ - prStaRec = &(prAdapter->arStaRec[prSwRfb->ucStaRecIdx]); - ASSERT(prStaRec); - -#if 0 - if(!(prStaRec->fgIsValid)){ - /* TODO: (Tehuang) Handle the Host-FW sync issue. */ - DbgPrint("QM: (Warning) BAR for an invalid STA_REC \n"); - //ASSERT(0); - return; - } -#endif - - /* Check whether the BA agreement exists */ - prReorderQueParm = ((prStaRec->aprRxReorderParamRefTbl)[prSwRfb->ucTid]); - if(!prReorderQueParm){ - /* TODO: (Tehuang) Handle the Host-FW sync issue.*/ - DBGLOG(QM, WARN, ("QM: (Warning) BAR for a NULL ReorderQueParm \n")); - //ASSERT(0); - return; - } - - - u4SSN = (UINT_32)(prSwRfb->u2SSN); - prReorderQue = &(prReorderQueParm->rReOrderQue); - u4WinStart = (UINT_32)(prReorderQueParm->u2WinStart); - u4WinEnd = (UINT_32)(prReorderQueParm->u2WinEnd); - - if(qmCompareSnIsLessThan(u4WinStart,u4SSN)){ - prReorderQueParm->u2WinStart = (UINT_16)u4SSN; - prReorderQueParm->u2WinEnd = - ((prReorderQueParm->u2WinStart) + (prReorderQueParm->u2WinSize) - 1) % MAX_SEQ_NO_COUNT; - DBGLOG(QM, TRACE, ("QM:(BAR)[%d](%ld){%d,%d}\n", prSwRfb->ucTid, u4SSN, prReorderQueParm->u2WinStart, prReorderQueParm->u2WinEnd)); - qmPopOutDueToFallAhead(prReorderQueParm, prReturnedQue); - } - else{ - DBGLOG(QM, TRACE, ("QM:(BAR)(%d)(%ld){%ld,%ld}\n", prSwRfb->ucTid, u4SSN, u4WinStart, u4WinEnd)); - } -} - - - -VOID -qmInsertFallWithinReorderPkt( - IN P_SW_RFB_T prSwRfb, - IN P_RX_BA_ENTRY_T prReorderQueParm, - OUT P_QUE_T prReturnedQue - ) -{ - P_SW_RFB_T prExaminedQueuedSwRfb; - P_QUE_T prReorderQue; - ASSERT(prSwRfb); - ASSERT(prReorderQueParm); - ASSERT(prReturnedQue); - - prReorderQue = &(prReorderQueParm->rReOrderQue); - prExaminedQueuedSwRfb = (P_SW_RFB_T)QUEUE_GET_HEAD(prReorderQue); - - /* There are no packets queued in the Reorder Queue */ - if(prExaminedQueuedSwRfb == NULL){ - ((P_QUE_ENTRY_T)prSwRfb)->prPrev = NULL; - ((P_QUE_ENTRY_T)prSwRfb)->prNext = NULL; - prReorderQue->prHead = (P_QUE_ENTRY_T)prSwRfb; - prReorderQue->prTail = (P_QUE_ENTRY_T)prSwRfb; - prReorderQue->u4NumElem ++; - } - - /* Determine the insert position */ - else{ - do{ - /* Case 1: Terminate. A duplicate packet */ - if(((prExaminedQueuedSwRfb->u2SSN) == (prSwRfb->u2SSN))){ - prSwRfb->eDst = RX_PKT_DESTINATION_NULL; - QUEUE_INSERT_TAIL(prReturnedQue,(P_QUE_ENTRY_T)prSwRfb); - return; - } - - /* Case 2: Terminate. The insert point is found */ - else if(qmCompareSnIsLessThan( - (prSwRfb->u2SSN),(prExaminedQueuedSwRfb->u2SSN))){ - break; - } - - /* Case 3: Insert point not found. Check the next SW_RFB in the Reorder Queue */ - else{ - prExaminedQueuedSwRfb = - (P_SW_RFB_T)(((P_QUE_ENTRY_T)prExaminedQueuedSwRfb)->prNext); - } - }while(prExaminedQueuedSwRfb); - - /* Update the Reorder Queue Parameters according to the found insert position */ - if(prExaminedQueuedSwRfb == NULL){ - /* The received packet shall be placed at the tail */ - ((P_QUE_ENTRY_T)prSwRfb)->prPrev = prReorderQue->prTail; - ((P_QUE_ENTRY_T)prSwRfb)->prNext = NULL; - (prReorderQue->prTail)->prNext = (P_QUE_ENTRY_T)(prSwRfb); - prReorderQue->prTail = (P_QUE_ENTRY_T)(prSwRfb); - } - else{ - ((P_QUE_ENTRY_T)prSwRfb)->prPrev = ((P_QUE_ENTRY_T)prExaminedQueuedSwRfb)->prPrev; - ((P_QUE_ENTRY_T)prSwRfb)->prNext = (P_QUE_ENTRY_T)prExaminedQueuedSwRfb; - if(((P_QUE_ENTRY_T)prExaminedQueuedSwRfb) == (prReorderQue->prHead)){ - /* The received packet will become the head */ - prReorderQue->prHead = (P_QUE_ENTRY_T)prSwRfb; - } - else{ - (((P_QUE_ENTRY_T)prExaminedQueuedSwRfb)->prPrev)->prNext = (P_QUE_ENTRY_T)prSwRfb; - } - ((P_QUE_ENTRY_T)prExaminedQueuedSwRfb)->prPrev = (P_QUE_ENTRY_T)prSwRfb; - } - - prReorderQue->u4NumElem ++; - - } - -} - - -VOID -qmInsertFallAheadReorderPkt( - IN P_SW_RFB_T prSwRfb, - IN P_RX_BA_ENTRY_T prReorderQueParm, - OUT P_QUE_T prReturnedQue - ) -{ - P_QUE_T prReorderQue; - ASSERT(prSwRfb); - ASSERT(prReorderQueParm); - ASSERT(prReturnedQue); - - prReorderQue = &(prReorderQueParm->rReOrderQue); - - /* There are no packets queued in the Reorder Queue */ - if(QUEUE_IS_EMPTY(prReorderQue)){ - ((P_QUE_ENTRY_T)prSwRfb)->prPrev = NULL; - ((P_QUE_ENTRY_T)prSwRfb)->prNext = NULL; - prReorderQue->prHead = (P_QUE_ENTRY_T)prSwRfb; - } - else{ - ((P_QUE_ENTRY_T)prSwRfb)->prPrev = prReorderQue->prTail; - ((P_QUE_ENTRY_T)prSwRfb)->prNext = NULL; - (prReorderQue->prTail)->prNext = (P_QUE_ENTRY_T)(prSwRfb); - } - prReorderQue->prTail = (P_QUE_ENTRY_T)prSwRfb; - prReorderQue->u4NumElem ++; - -} - - -VOID -qmPopOutDueToFallWithin( - IN P_RX_BA_ENTRY_T prReorderQueParm, - OUT P_QUE_T prReturnedQue - ) -{ - P_SW_RFB_T prReorderedSwRfb; - P_QUE_T prReorderQue; - BOOLEAN fgDequeuHead, fgMissing; - OS_SYSTIME rCurrentTime, *prMissTimeout; - - prReorderQue = &(prReorderQueParm->rReOrderQue); - fgMissing = FALSE; - rCurrentTime = 0; - prMissTimeout = &(g_arMissTimeout[prReorderQueParm->ucStaRecIdx][prReorderQueParm->ucTid]); - if (*prMissTimeout) { - fgMissing = TRUE; - GET_CURRENT_SYSTIME(&rCurrentTime); - } - - /* Check whether any packet can be indicated to the higher layer */ - while(TRUE){ - if(QUEUE_IS_EMPTY(prReorderQue)){ - break; - } - - /* Always examine the head packet */ - prReorderedSwRfb = (P_SW_RFB_T)QUEUE_GET_HEAD(prReorderQue); - fgDequeuHead = FALSE; - - /* SN == WinStart, so the head packet shall be indicated (advance the window) */ - if((prReorderedSwRfb->u2SSN) == (prReorderQueParm->u2WinStart)){ - - fgDequeuHead = TRUE; - prReorderQueParm->u2WinStart = - (((prReorderedSwRfb->u2SSN) + 1)% MAX_SEQ_NO_COUNT); - } - /* SN > WinStart, break to update WinEnd */ - else{ - if (TRUE == fgMissing && - CHECK_FOR_TIMEOUT(rCurrentTime, (*prMissTimeout), - //MSEC_TO_SEC(QM_RX_BA_ENTRY_MISS_TIMEOUT_MS))) { - MSEC_TO_SYSTIME(QM_RX_BA_ENTRY_MISS_TIMEOUT_MS))) { - DBGLOG(QM, TRACE, ("RX BA timeout, next tid %d, SSN %d\n", - prReorderQueParm->ucTid, prReorderedSwRfb->u2SSN)); - fgDequeuHead = TRUE; - prReorderQueParm->u2WinStart = (((prReorderedSwRfb->u2SSN) + 1) % MAX_SEQ_NO_COUNT); - fgMissing = FALSE; - - } - else { - break; - } - } - - - /* Dequeue the head packet */ - if(fgDequeuHead){ - - if(((P_QUE_ENTRY_T)prReorderedSwRfb)->prNext == NULL){ - prReorderQue->prHead = NULL; - prReorderQue->prTail = NULL; - } - else{ - prReorderQue->prHead = ((P_QUE_ENTRY_T)prReorderedSwRfb)->prNext; - (((P_QUE_ENTRY_T)prReorderedSwRfb)->prNext)->prPrev = NULL; - } - prReorderQue->u4NumElem --; - //DbgPrint("QM: [%d] %d (%d)\n", prReorderQueParm->ucTid, prReorderedSwRfb->u2PacketLen, prReorderedSwRfb->u2SSN); - QUEUE_INSERT_TAIL(prReturnedQue,(P_QUE_ENTRY_T)prReorderedSwRfb); - } - } - - if (QUEUE_IS_EMPTY(prReorderQue)) { - *prMissTimeout = 0; - } - else { - if (FALSE == fgMissing) { - GET_CURRENT_SYSTIME(prMissTimeout); - } - } - /* After WinStart has been determined, update the WinEnd */ - prReorderQueParm->u2WinEnd = - (((prReorderQueParm->u2WinStart) + (prReorderQueParm->u2WinSize) -1 )% MAX_SEQ_NO_COUNT); - -} - -VOID -qmPopOutDueToFallAhead( - IN P_RX_BA_ENTRY_T prReorderQueParm, - OUT P_QUE_T prReturnedQue - ) -{ - P_SW_RFB_T prReorderedSwRfb; - P_QUE_T prReorderQue; - BOOLEAN fgDequeuHead; - - prReorderQue = &(prReorderQueParm->rReOrderQue); - - /* Check whether any packet can be indicated to the higher layer */ - while(TRUE){ - if(QUEUE_IS_EMPTY(prReorderQue)){ - break; - } - - /* Always examine the head packet */ - prReorderedSwRfb = (P_SW_RFB_T)QUEUE_GET_HEAD(prReorderQue); - fgDequeuHead = FALSE; - - /* SN == WinStart, so the head packet shall be indicated (advance the window) */ - if((prReorderedSwRfb->u2SSN) == (prReorderQueParm->u2WinStart)){ - - fgDequeuHead = TRUE; - prReorderQueParm->u2WinStart = - (((prReorderedSwRfb->u2SSN) + 1)% MAX_SEQ_NO_COUNT); - } - - /* SN < WinStart, so the head packet shall be indicated (do not advance the window) */ - else if(qmCompareSnIsLessThan( - (UINT_32)(prReorderedSwRfb->u2SSN), - (UINT_32)(prReorderQueParm->u2WinStart))){ - - fgDequeuHead = TRUE; - - } - - /* SN > WinStart, break to update WinEnd */ - else{ - break; - } - - - /* Dequeue the head packet */ - if(fgDequeuHead){ - - if(((P_QUE_ENTRY_T)prReorderedSwRfb)->prNext == NULL){ - prReorderQue->prHead = NULL; - prReorderQue->prTail = NULL; - } - else{ - prReorderQue->prHead = ((P_QUE_ENTRY_T)prReorderedSwRfb)->prNext; - (((P_QUE_ENTRY_T)prReorderedSwRfb)->prNext)->prPrev = NULL; - } - prReorderQue->u4NumElem --; - //DbgPrint("QM: [%d] %d (%d)\n", prReorderQueParm->ucTid, prReorderedSwRfb->u2PacketLen, prReorderedSwRfb->u2SSN); - QUEUE_INSERT_TAIL(prReturnedQue,(P_QUE_ENTRY_T)prReorderedSwRfb); - } - } - - /* After WinStart has been determined, update the WinEnd */ - prReorderQueParm->u2WinEnd = - (((prReorderQueParm->u2WinStart) + (prReorderQueParm->u2WinSize) -1)% MAX_SEQ_NO_COUNT); - -} - -BOOLEAN -qmCompareSnIsLessThan( - IN UINT_32 u4SnLess, - IN UINT_32 u4SnGreater - ) -{ - /* 0 <---> SnLess <--(gap>2048)--> SnGreater : SnLess > SnGreater */ - if((u4SnLess + HALF_SEQ_NO_COUNT) <= u4SnGreater){ /* Shall be <= */ - return FALSE; - } - - /* 0 <---> SnGreater <--(gap>2048)--> SnLess : SnLess < SnGreater */ - else if((u4SnGreater + HALF_SEQ_NO_COUNT) < u4SnLess){ - return TRUE; - } - - /* 0 <---> SnGreater <--(gap<2048)--> SnLess : SnLess > SnGreater */ - /* 0 <---> SnLess <--(gap<2048)--> SnGreater : SnLess < SnGreater */ - else{ - return (u4SnLess < u4SnGreater); - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Handle Mailbox RX messages -* -* \param[in] prMailboxRxMsg The received Mailbox message from the FW -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmHandleMailboxRxMessage( - IN MAILBOX_MSG_T prMailboxRxMsg - ) -{ - //DbgPrint("QM: Enter qmHandleMailboxRxMessage()\n"); - /* TODO */ -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Handle ADD RX BA Event from the FW -* -* \param[in] prAdapter Adapter pointer -* \param[in] prEvent The event packet from the FW -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmHandleEventRxAddBa( - IN P_ADAPTER_T prAdapter, - IN P_WIFI_EVENT_T prEvent - ) -{ - P_EVENT_RX_ADDBA_T prEventRxAddBa; - P_STA_RECORD_T prStaRec; - UINT_32 u4Tid; - UINT_32 u4WinSize; - - DBGLOG(QM, INFO, ("QM:Event +RxBa\n")); - - prEventRxAddBa = (P_EVENT_RX_ADDBA_T)prEvent; - prStaRec = QM_GET_STA_REC_PTR_FROM_INDEX(prAdapter, prEventRxAddBa->ucStaRecIdx); - - if(!prStaRec){ - /* Invalid STA_REC index, discard the event packet */ - //ASSERT(0); - DBGLOG(QM, INFO, ("QM: (Warning) RX ADDBA Event for a NULL STA_REC\n")); - return; - } - -#if 0 - if(!(prStaRec->fgIsValid)){ - /* TODO: (Tehuang) Handle the Host-FW synchronization issue */ - DBGLOG(QM, WARN, ("QM: (Warning) RX ADDBA Event for an invalid STA_REC\n")); - //ASSERT(0); - //return; - } -#endif - - u4Tid = (((prEventRxAddBa->u2BAParameterSet)& BA_PARAM_SET_TID_MASK) - >> BA_PARAM_SET_TID_MASK_OFFSET); - - u4WinSize = (((prEventRxAddBa->u2BAParameterSet)& BA_PARAM_SET_BUFFER_SIZE_MASK) - >> BA_PARAM_SET_BUFFER_SIZE_MASK_OFFSET); - - if(!qmAddRxBaEntry( - prAdapter, - prStaRec->ucIndex, - (UINT_8)u4Tid, - (prEventRxAddBa->u2BAStartSeqCtrl >> OFFSET_BAR_SSC_SN), - (UINT_16)u4WinSize)){ - - /* FW shall ensure the availabiilty of the free-to-use BA entry */ - DBGLOG(QM, ERROR, ("QM: (Error) qmAddRxBaEntry() failure\n")); - ASSERT(0); - } - -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Handle DEL RX BA Event from the FW -* -* \param[in] prAdapter Adapter pointer -* \param[in] prEvent The event packet from the FW -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmHandleEventRxDelBa( - IN P_ADAPTER_T prAdapter, - IN P_WIFI_EVENT_T prEvent - ) -{ - P_EVENT_RX_DELBA_T prEventRxDelBa; - P_STA_RECORD_T prStaRec; - - //DbgPrint("QM:Event -RxBa\n"); - - prEventRxDelBa = (P_EVENT_RX_DELBA_T)prEvent; - prStaRec = QM_GET_STA_REC_PTR_FROM_INDEX(prAdapter, prEventRxDelBa->ucStaRecIdx); - - if(!prStaRec){ - /* Invalid STA_REC index, discard the event packet */ - //ASSERT(0); - return; - } - -#if 0 - if(!(prStaRec->fgIsValid)){ - /* TODO: (Tehuang) Handle the Host-FW synchronization issue */ - //ASSERT(0); - return; - } -#endif - - qmDelRxBaEntry(prAdapter, prStaRec->ucIndex, prEventRxDelBa->ucTid, TRUE); - -} - -P_RX_BA_ENTRY_T -qmLookupRxBaEntry( - IN P_ADAPTER_T prAdapter, - UINT_8 ucStaRecIdx, - UINT_8 ucTid - ) -{ - int i; - P_QUE_MGT_T prQM = &prAdapter->rQM; - - //DbgPrint("QM: Enter qmLookupRxBaEntry()\n"); - - for(i=0; iarRxBaTable[i].fgIsValid){ - if((prQM->arRxBaTable[i].ucStaRecIdx == ucStaRecIdx) && - (prQM->arRxBaTable[i].ucTid == ucTid)){ - return &prQM->arRxBaTable[i]; - } - } - } - return NULL; -} - -BOOL -qmAddRxBaEntry( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucStaRecIdx, - IN UINT_8 ucTid, - IN UINT_16 u2WinStart, - IN UINT_16 u2WinSize - ) -{ - int i; - P_RX_BA_ENTRY_T prRxBaEntry = NULL; - P_STA_RECORD_T prStaRec; - P_QUE_MGT_T prQM = &prAdapter->rQM; - - ASSERT(ucStaRecIdx < CFG_NUM_OF_STA_RECORD); - - if(ucStaRecIdx >= CFG_NUM_OF_STA_RECORD){ - /* Invalid STA_REC index, discard the event packet */ - DBGLOG(QM, WARN, ("QM: (WARNING) RX ADDBA Event for a invalid ucStaRecIdx = %d\n", ucStaRecIdx)); - return FALSE; - } - - prStaRec = &prAdapter->arStaRec[ucStaRecIdx]; - ASSERT(prStaRec); - - //if(!(prStaRec->fgIsValid)){ - // DbgPrint("QM: (WARNING) Invalid STA when adding an RX BA \n"); - // return FALSE; - //} - - //4 <1> Delete before adding - /* Remove the BA entry for the same (STA, TID) tuple if it exists */ - if(qmLookupRxBaEntry(prAdapter, ucStaRecIdx,ucTid)){ - qmDelRxBaEntry(prAdapter, ucStaRecIdx, ucTid, TRUE); /* prQM->ucRxBaCount-- */ - } - - //4 <2> Add a new BA entry - /* No available entry to store the BA agreement info. Retrun FALSE. */ - if(prQM->ucRxBaCount >= CFG_NUM_OF_RX_BA_AGREEMENTS){ - DBGLOG(QM, ERROR, ("QM: **failure** (limited resource, ucRxBaCount=%d)\n", prQM->ucRxBaCount)); - return FALSE; - } - else{ - /* Find the free-to-use BA entry */ - for(i=0; iarRxBaTable[i].fgIsValid){ - prRxBaEntry = &(prQM->arRxBaTable[i]); - prQM->ucRxBaCount++; - DBGLOG(QM, LOUD, ("QM: ucRxBaCount=%d\n", prQM->ucRxBaCount)); - break; - } - } - - /* If a free-to-use entry is found, configure it and associate it with the STA_REC */ - u2WinSize += CFG_RX_BA_INC_SIZE; - if(prRxBaEntry){ - prRxBaEntry->ucStaRecIdx = ucStaRecIdx; - prRxBaEntry->ucTid = ucTid; - prRxBaEntry->u2WinStart = u2WinStart; - prRxBaEntry->u2WinSize= u2WinSize; - prRxBaEntry->u2WinEnd = ((u2WinStart + u2WinSize - 1) % MAX_SEQ_NO_COUNT); - prRxBaEntry->fgIsValid = TRUE; - prRxBaEntry->fgIsWaitingForPktWithSsn = TRUE; - - g_arMissTimeout[ucStaRecIdx][ucTid] = 0; - - DBGLOG(QM, INFO, ("QM: +RxBA(STA=%d TID=%d WinStart=%d WinEnd=%d WinSize=%d)\n", - ucStaRecIdx, ucTid, - prRxBaEntry->u2WinStart, prRxBaEntry->u2WinEnd, prRxBaEntry->u2WinSize)); - - /* Update the BA entry reference table for per-packet lookup */ - prStaRec->aprRxReorderParamRefTbl[ucTid] = prRxBaEntry; - } - else{ - /* This shall not happen because FW should keep track of the usage of RX BA entries */ - DBGLOG(QM, ERROR, ("QM: **AddBA Error** (ucRxBaCount=%d)\n", prQM->ucRxBaCount)); - return FALSE; - } - } - - return TRUE; -} -VOID -qmDelRxBaEntry( - IN P_ADAPTER_T prAdapter, - IN UINT_8 ucStaRecIdx, - IN UINT_8 ucTid, - IN BOOLEAN fgFlushToHost - ) -{ - P_RX_BA_ENTRY_T prRxBaEntry; - P_STA_RECORD_T prStaRec; - P_SW_RFB_T prFlushedPacketList = NULL; - P_QUE_MGT_T prQM = &prAdapter->rQM; - - ASSERT(ucStaRecIdx < CFG_NUM_OF_STA_RECORD); - - prStaRec = &prAdapter->arStaRec[ucStaRecIdx]; - ASSERT(prStaRec); - -#if 0 - if(!(prStaRec->fgIsValid)){ - DbgPrint("QM: (WARNING) Invalid STA when deleting an RX BA \n"); - return; - } -#endif - - /* Remove the BA entry for the same (STA, TID) tuple if it exists */ - prRxBaEntry = prStaRec->aprRxReorderParamRefTbl[ucTid]; - - if(prRxBaEntry){ - - prFlushedPacketList = qmFlushStaRxQueue(prAdapter, ucStaRecIdx, ucTid); - - if(prFlushedPacketList){ - - if(fgFlushToHost) { - wlanProcessQueuedSwRfb(prAdapter, prFlushedPacketList); - } - else { - - P_SW_RFB_T prSwRfb; - P_SW_RFB_T prNextSwRfb; - prSwRfb = prFlushedPacketList; - - do { - prNextSwRfb = (P_SW_RFB_T)QUEUE_GET_NEXT_ENTRY((P_QUE_ENTRY_T)prSwRfb); - nicRxReturnRFB(prAdapter, prSwRfb); - prSwRfb = prNextSwRfb; - } while(prSwRfb); - - } - - - } -#if ((QM_TEST_MODE == 0) && (QM_TEST_STA_REC_DEACTIVATION == 0)) - /* Update RX BA entry state. Note that RX queue flush is not done here */ - prRxBaEntry->fgIsValid = FALSE; - prQM->ucRxBaCount--; - - /* Debug */ - #if 0 - DbgPrint("QM: ucRxBaCount=%d\n", prQM->ucRxBaCount); - #endif - - /* Update STA RX BA table */ - prStaRec->aprRxReorderParamRefTbl[ucTid] = NULL; -#endif - - DBGLOG(QM, INFO, ("QM: -RxBA(STA=%d,TID=%d)\n", ucStaRecIdx, ucTid)); - - } - - - /* Debug */ - #if CFG_HIF_RX_STARVATION_WARNING - { - P_RX_CTRL_T prRxCtrl; - prRxCtrl = &prAdapter->rRxCtrl; - DBGLOG(QM, TRACE, ("QM: (RX DEBUG) Enqueued: %d / Dequeued: %d\n", prRxCtrl->u4QueuedCnt, prRxCtrl->u4DequeuedCnt)); - } - #endif -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To process WMM related IEs in ASSOC_RSP -* -* \param[in] prAdapter Adapter pointer -* \param[in] prSwRfb The received frame -* \param[in] pucIE The pointer to the first IE in the frame -* \param[in] u2IELength The total length of IEs in the frame -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -mqmProcessAssocReq ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN PUINT_8 pucIE, - IN UINT_16 u2IELength - ) -{ - P_STA_RECORD_T prStaRec; - UINT_16 u2Offset; - PUINT_8 pucIEStart; - UINT_8 aucWfaOui[] = VENDOR_OUI_WFA; - P_IE_WMM_INFO_T prIeWmmInfo; - - DEBUGFUNC("mqmProcessAssocReq"); - - ASSERT(prSwRfb); - ASSERT(pucIE); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - ASSERT(prStaRec); - - if(prStaRec == NULL) { - return; - } - - prStaRec->fgIsQoS = FALSE; - prStaRec->fgIsWmmSupported = prStaRec->fgIsUapsdSupported = FALSE; - - pucIEStart = pucIE; - - /* If the device does not support QoS or if WMM is not supported by the peer, exit.*/ - if (!prAdapter->rWifiVar.fgSupportQoS) { - return; - } - - - /* Determine whether QoS is enabled with the association */ - else{ - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - switch (IE_ID(pucIE)) { - case ELEM_ID_WMM: - - if((WMM_IE_OUI_TYPE(pucIE) == VENDOR_OUI_TYPE_WMM) && - (!kalMemCmp(WMM_IE_OUI(pucIE),aucWfaOui,3))){ - - switch(WMM_IE_OUI_SUBTYPE(pucIE)){ - case VENDOR_OUI_SUBTYPE_WMM_INFO: - { - - UINT_8 ucQosInfo; - UINT_8 ucQosInfoAC; - UINT_8 ucBmpAC; - if(IE_LEN(pucIE) != 7){ - break; /* WMM Info IE with a wrong length */ - } - prStaRec->fgIsQoS = TRUE; - prStaRec->fgIsWmmSupported = TRUE; - - prIeWmmInfo = (P_IE_WMM_INFO_T)pucIE; - ucQosInfo = prIeWmmInfo->ucQosInfo; - ucQosInfoAC = ucQosInfo & BITS(0, 3); - - prStaRec->fgIsUapsdSupported = ((ucQosInfoAC)? TRUE: FALSE) & - prAdapter->rWifiVar.fgSupportUAPSD; - - ucBmpAC = 0; - - if( ucQosInfoAC & WMM_QOS_INFO_VO_UAPSD) { - ucBmpAC |= BIT(ACI_VO); - } - if( ucQosInfoAC & WMM_QOS_INFO_VI_UAPSD) { - ucBmpAC |= BIT(ACI_VI); - } - if( ucQosInfoAC & WMM_QOS_INFO_BE_UAPSD) { - ucBmpAC |= BIT(ACI_BE); - } - if( ucQosInfoAC & WMM_QOS_INFO_BK_UAPSD) { - ucBmpAC |= BIT(ACI_BK); - } - - prStaRec->ucBmpTriggerAC = prStaRec->ucBmpDeliveryAC = ucBmpAC; - - prStaRec->ucUapsdSp = (ucQosInfo & WMM_QOS_INFO_MAX_SP_LEN_MASK) >> 5; - - } - break; - - default: - /* Other WMM QoS IEs. Ignore any */ - break; - } - } - /* else: VENDOR_OUI_TYPE_WPA, VENDOR_OUI_TYPE_WPS */ - - break; - - case ELEM_ID_HT_CAP: - /* Some client won't put the WMM IE if client is 802.11n */ - if (IE_LEN(pucIE) == (sizeof(IE_HT_CAP_T) - 2)) { - prStaRec->fgIsQoS = TRUE; - } - break; - default: - break; - } - } - - DBGLOG(QM, TRACE, ("MQM: Assoc_Req Parsing (QoS Enabled=%d)\n", prStaRec->fgIsQoS)); - - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To process WMM related IEs in ASSOC_RSP -* -* \param[in] prAdapter Adapter pointer -* \param[in] prSwRfb The received frame -* \param[in] pucIE The pointer to the first IE in the frame -* \param[in] u2IELength The total length of IEs in the frame -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -mqmProcessAssocRsp ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN PUINT_8 pucIE, - IN UINT_16 u2IELength - ) -{ - P_STA_RECORD_T prStaRec; - UINT_16 u2Offset; - PUINT_8 pucIEStart; - UINT_8 aucWfaOui[] = VENDOR_OUI_WFA; - - DEBUGFUNC("mqmProcessAssocRsp"); - - ASSERT(prSwRfb); - ASSERT(pucIE); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - ASSERT(prStaRec); - - if(prStaRec == NULL) { - return; - } - - prStaRec->fgIsQoS = FALSE; - - pucIEStart = pucIE; - - DBGLOG(QM, TRACE, ("QM: (fgIsWmmSupported=%d, fgSupportQoS=%d)\n", - prStaRec->fgIsWmmSupported, prAdapter->rWifiVar.fgSupportQoS)); - - /* If the device does not support QoS or if WMM is not supported by the peer, exit.*/ - //if((!prAdapter->rWifiVar.fgSupportQoS) || (!prStaRec->fgIsWmmSupported)) - if((!prAdapter->rWifiVar.fgSupportQoS)) - { - return; - } - - /* Determine whether QoS is enabled with the association */ - else{ - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - switch (IE_ID(pucIE)) { - case ELEM_ID_WMM: - if((WMM_IE_OUI_TYPE(pucIE) == VENDOR_OUI_TYPE_WMM) && - (!kalMemCmp(WMM_IE_OUI(pucIE),aucWfaOui,3))){ - - switch(WMM_IE_OUI_SUBTYPE(pucIE)){ - case VENDOR_OUI_SUBTYPE_WMM_PARAM: - if(IE_LEN(pucIE) != 24){ - break; /* WMM Info IE with a wrong length */ - } - prStaRec->fgIsQoS = TRUE; - break; - - case VENDOR_OUI_SUBTYPE_WMM_INFO: - if(IE_LEN(pucIE) != 7){ - break; /* WMM Info IE with a wrong length */ - } - prStaRec->fgIsQoS = TRUE; - break; - - default: - /* Other WMM QoS IEs. Ignore any */ - break; - } - } - /* else: VENDOR_OUI_TYPE_WPA, VENDOR_OUI_TYPE_WPS */ - break; - - case ELEM_ID_HT_CAP: - /* Some AP won't put the WMM IE if client is 802.11n */ - if ( IE_LEN(pucIE) == (sizeof(IE_HT_CAP_T) - 2)) { - prStaRec->fgIsQoS = TRUE; - } - break; - default: - break; - } - } - - /* Parse AC parameters and write to HW CRs */ - if((prStaRec->fgIsQoS) && (prStaRec->eStaType == STA_TYPE_LEGACY_AP)){ - mqmParseEdcaParameters(prAdapter, prSwRfb, pucIEStart, u2IELength, TRUE); - } - - DBGLOG(QM, TRACE, ("MQM: Assoc_Rsp Parsing (QoS Enabled=%d)\n", prStaRec->fgIsQoS)); - if(prStaRec->fgIsWmmSupported) { - nicQmUpdateWmmParms(prAdapter, prStaRec->ucNetTypeIndex); - } - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To parse WMM Parameter IE (in BCN or Assoc_Rsp) -* -* \param[in] prAdapter Adapter pointer -* \param[in] prSwRfb The received frame -* \param[in] pucIE The pointer to the first IE in the frame -* \param[in] u2IELength The total length of IEs in the frame -* \param[in] fgForceOverride TRUE: If EDCA parameters are found, always set to HW CRs. -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -mqmParseEdcaParameters ( - IN P_ADAPTER_T prAdapter, - IN P_SW_RFB_T prSwRfb, - IN PUINT_8 pucIE, - IN UINT_16 u2IELength, - IN BOOLEAN fgForceOverride - ) -{ - P_STA_RECORD_T prStaRec; - UINT_16 u2Offset; - UINT_8 aucWfaOui[] = VENDOR_OUI_WFA; - P_BSS_INFO_T prBssInfo; - - DEBUGFUNC("mqmParseEdcaParameters"); - - ASSERT(prSwRfb); - ASSERT(pucIE); - - prStaRec = cnmGetStaRecByIndex(prAdapter, prSwRfb->ucStaRecIdx); - ASSERT(prStaRec); - - if(prStaRec == NULL) { - return; - } - - DBGLOG(QM, TRACE, ("QM: (fgIsWmmSupported=%d, fgIsQoS=%d)\n", - prStaRec->fgIsWmmSupported, prStaRec->fgIsQoS)); - - if((!prAdapter->rWifiVar.fgSupportQoS) || (!prStaRec->fgIsWmmSupported) || (!prStaRec->fgIsQoS)){ - return; - } - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - - /* Goal: Obtain the EDCA parameters */ - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - switch (IE_ID(pucIE)) { - case ELEM_ID_WMM: - - if((WMM_IE_OUI_TYPE(pucIE) == VENDOR_OUI_TYPE_WMM) && - (!kalMemCmp(WMM_IE_OUI(pucIE),aucWfaOui,3))){ - - switch(WMM_IE_OUI_SUBTYPE(pucIE)){ - case VENDOR_OUI_SUBTYPE_WMM_PARAM: - if(IE_LEN(pucIE) != 24){ - break; /* WMM Param IE with a wrong length */ - } - else{ - P_AC_QUE_PARMS_T prAcQueParams; - P_IE_WMM_PARAM_T prIeWmmParam; - ENUM_WMM_ACI_T eAci; - PUINT_8 pucWmmParamSetCount; - //int i; - - pucWmmParamSetCount = &(prBssInfo->ucWmmParamSetCount); - - prIeWmmParam = (P_IE_WMM_PARAM_T)pucIE; - - /* Check the Parameter Set Count to determine whether EDCA parameters have been changed */ - if(!fgForceOverride){ - if(*pucWmmParamSetCount == (prIeWmmParam->ucQosInfo & WMM_QOS_INFO_PARAM_SET_CNT)){ - break; /* Ignore the IE without updating HW CRs */ - } - } - - /* Update Parameter Set Count */ - *pucWmmParamSetCount = (prIeWmmParam->ucQosInfo & WMM_QOS_INFO_PARAM_SET_CNT); - - /* Update EDCA parameters */ - for(eAci = 0; eAci < WMM_AC_INDEX_NUM; eAci++){ - - prAcQueParams = &prBssInfo->arACQueParms[eAci]; - mqmFillAcQueParam(prIeWmmParam, eAci, prAcQueParams); - - prAcQueParams->fgIsACMSet = - (prAcQueParams->u2Aifsn & WMM_ACIAIFSN_ACM) ? TRUE : FALSE; - prAcQueParams->u2Aifsn &= WMM_ACIAIFSN_AIFSN; - - DBGLOG(QM, LOUD, ("MQM: eAci = %d, ACM = %d, Aifsn = %d, CWmin = %d, CWmax = %d, TxopLimit = %d\n", - eAci, prAcQueParams->fgIsACMSet, - prAcQueParams->u2Aifsn, prAcQueParams->u2CWmin, - prAcQueParams->u2CWmax, prAcQueParams->u2TxopLimit)); - } - } - break; - - default: - /* Other WMM QoS IEs. Ignore */ - break; - } - - } - /* else: VENDOR_OUI_TYPE_WPA, VENDOR_OUI_TYPE_WPS, ... (not cared) */ - break; - default: - break; - } - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is used for parsing EDCA parameters specified in the WMM Parameter IE -* -* \param[in] prAdapter Adapter pointer -* \param[in] prIeWmmParam The pointer to the WMM Parameter IE -* \param[in] u4AcOffset The offset specifying the AC queue for parsing -* \param[in] prHwAcParams The parameter structure used to configure the HW CRs -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -mqmFillAcQueParam( - IN P_IE_WMM_PARAM_T prIeWmmParam, - IN UINT_32 u4AcOffset, - OUT P_AC_QUE_PARMS_T prAcQueParams - ) -{ - prAcQueParams->u2Aifsn = *((PUINT_8)(&(prIeWmmParam->ucAciAifsn_BE)) + (u4AcOffset * 4)); - - prAcQueParams->u2CWmax = - BIT(((*((PUINT_8)(&(prIeWmmParam->ucEcw_BE)) + (u4AcOffset * 4))) & WMM_ECW_WMAX_MASK) - >> WMM_ECW_WMAX_OFFSET)-1; - - prAcQueParams->u2CWmin = - BIT((*((PUINT_8)(&(prIeWmmParam->ucEcw_BE)) + (u4AcOffset * 4))) & WMM_ECW_WMIN_MASK)-1; - - WLAN_GET_FIELD_16(((PUINT_8)(&(prIeWmmParam->aucTxopLimit_BE)) + (u4AcOffset * 4)),&(prAcQueParams->u2TxopLimit)); - - prAcQueParams->ucGuradTime = TXM_DEFAULT_FLUSH_QUEUE_GUARD_TIME; - - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To parse WMM/11n related IEs in scan results (only for AP peers) -* -* \param[in] prAdapter Adapter pointer -* \param[in] prScanResult The scan result which shall be parsed to obtain needed info -* \param[out] prStaRec The obtained info is stored in the STA_REC -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -mqmProcessScanResult( - IN P_ADAPTER_T prAdapter, - IN P_BSS_DESC_T prScanResult, - OUT P_STA_RECORD_T prStaRec - ) -{ - PUINT_8 pucIE; - UINT_16 u2IELength; - UINT_16 u2Offset; - UINT_8 aucWfaOui[] = VENDOR_OUI_WFA; - - DEBUGFUNC("mqmProcessScanResult"); - - ASSERT(prScanResult); - ASSERT(prStaRec); - - /* Reset the flag before parsing */ - prStaRec->fgIsWmmSupported = prStaRec->fgIsUapsdSupported = FALSE; - - if (!prAdapter->rWifiVar.fgSupportQoS){ - return; - } - - u2IELength = prScanResult->u2IELength; - pucIE = prScanResult->aucIEBuf; - - /* Goal: Determine whether the peer supports WMM/QoS and UAPSDU */ - IE_FOR_EACH(pucIE, u2IELength, u2Offset) { - switch (IE_ID(pucIE)) { - case ELEM_ID_WMM: - if((WMM_IE_OUI_TYPE(pucIE) == VENDOR_OUI_TYPE_WMM) && - (!kalMemCmp(WMM_IE_OUI(pucIE),aucWfaOui,3))){ - - switch(WMM_IE_OUI_SUBTYPE(pucIE)){ - case VENDOR_OUI_SUBTYPE_WMM_PARAM: - if(IE_LEN(pucIE) != 24){ - break; /* WMM Param IE with a wrong length */ - } - else{ - prStaRec->fgIsWmmSupported = TRUE; - prStaRec->fgIsUapsdSupported = (((((P_IE_WMM_PARAM_T)pucIE)->ucQosInfo) & WMM_QOS_INFO_UAPSD)? TRUE: FALSE); - } - break; - - case VENDOR_OUI_SUBTYPE_WMM_INFO: - if(IE_LEN(pucIE) != 7){ - break; /* WMM Info IE with a wrong length */ - } - else{ - prStaRec->fgIsWmmSupported = TRUE; - prStaRec->fgIsUapsdSupported = (((((P_IE_WMM_INFO_T)pucIE)->ucQosInfo) & WMM_QOS_INFO_UAPSD)? TRUE: FALSE); - } - break; - - default: - /* A WMM QoS IE that doesn't matter. Ignore it. */ - break; - } - } - /* else: VENDOR_OUI_TYPE_WPA, VENDOR_OUI_TYPE_WPS, ... (not cared) */ - - break; - - default: - /* A WMM IE that doesn't matter. Ignore it. */ - break; - } - } - DBGLOG(QM, LOUD, ("MQM: Scan Result Parsing (WMM=%d, UAPSD=%d)\n", - prStaRec->fgIsWmmSupported, prStaRec->fgIsUapsdSupported)); - -} - -UINT_8 -qmGetStaRecIdx( - IN P_ADAPTER_T prAdapter, - IN PUINT_8 pucEthDestAddr, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkType - ) -{ - UINT_32 i; - P_STA_RECORD_T prTempStaRec; - - prTempStaRec = NULL; - - ASSERT(prAdapter); - - //4 <1> DA = BMCAST - if(IS_BMCAST_MAC_ADDR(pucEthDestAddr)){ - return STA_REC_INDEX_BMCAST; - } - - - //4 <2> Check if an AP STA is present - for(i = 0; i < CFG_NUM_OF_STA_RECORD; i++){ - prTempStaRec = &(prAdapter->arStaRec[i]); - if((prTempStaRec->ucNetTypeIndex == eNetworkType) - && (prTempStaRec->fgIsAp) - && (prTempStaRec->fgIsValid)){ - return prTempStaRec->ucIndex; - } - } - - //4 <3> Not BMCAST, No AP --> Compare DA (i.e., to see whether this is a unicast frame to a client) - for(i = 0; i < CFG_NUM_OF_STA_RECORD; i++){ - prTempStaRec = &(prAdapter->arStaRec[i]); - if(prTempStaRec->fgIsValid){ - if(EQUAL_MAC_ADDR(prTempStaRec->aucMacAddr, pucEthDestAddr)){ - return prTempStaRec->ucIndex; - } - } - } - - - //4 <4> No STA found, Not BMCAST --> Indicate NOT_FOUND to FW - return STA_REC_INDEX_NOT_FOUND; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Generate the WMM Info IE -* -* \param[in] prAdapter Adapter pointer -* @param prMsduInfo The TX MMPDU -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -mqmGenerateWmmInfoIE ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - P_IE_WMM_INFO_T prIeWmmInfo; - UINT_32 ucUapsd[] = { - WMM_QOS_INFO_BE_UAPSD, - WMM_QOS_INFO_BK_UAPSD, - WMM_QOS_INFO_VI_UAPSD, - WMM_QOS_INFO_VO_UAPSD - }; - UINT_8 aucWfaOui[] = VENDOR_OUI_WFA; - - P_PM_PROFILE_SETUP_INFO_T prPmProfSetupInfo; - P_BSS_INFO_T prBssInfo; - P_STA_RECORD_T prStaRec; - - DEBUGFUNC("mqmGenerateWmmInfoIE"); - - ASSERT(prMsduInfo); - - /* In case QoS is not turned off, exit directly */ - if(!prAdapter->rWifiVar.fgSupportQoS){ - return; - } - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - ASSERT(prStaRec); - - if(prStaRec == NULL) { - return; - } - - if(!prStaRec->fgIsWmmSupported) { - return; - } - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prStaRec->ucNetTypeIndex]); - - prPmProfSetupInfo = &prBssInfo->rPmProfSetupInfo; - - prIeWmmInfo = (P_IE_WMM_INFO_T) - ((PUINT_8) prMsduInfo->prPacket + prMsduInfo->u2FrameLength); - - prIeWmmInfo->ucId = ELEM_ID_WMM; - prIeWmmInfo->ucLength = ELEM_MAX_LEN_WMM_INFO; - - /* WMM-2.2.1 WMM Information Element Field Values */ - prIeWmmInfo->aucOui[0] = aucWfaOui[0]; - prIeWmmInfo->aucOui[1] = aucWfaOui[1]; - prIeWmmInfo->aucOui[2] = aucWfaOui[2]; - prIeWmmInfo->ucOuiType = VENDOR_OUI_TYPE_WMM; - prIeWmmInfo->ucOuiSubtype = VENDOR_OUI_SUBTYPE_WMM_INFO; - - prIeWmmInfo->ucVersion = VERSION_WMM; - prIeWmmInfo->ucQosInfo = 0; - - /* UAPSD intial queue configurations (delivery and trigger enabled)*/ -// if(prAdapter->rWifiVar.fgSupportUAPSD){ - if(prAdapter->rWifiVar.fgSupportUAPSD && prStaRec->fgIsUapsdSupported){ - - UINT_8 ucQosInfo = 0; - UINT_8 i; - - - /* Static U-APSD setting */ - for(i = ACI_BE; i <= ACI_VO; i++){ - if (prPmProfSetupInfo->ucBmpDeliveryAC & prPmProfSetupInfo->ucBmpTriggerAC & BIT(i)){ - ucQosInfo |= (UINT_8)ucUapsd[i]; - } - } - - - if (prPmProfSetupInfo->ucBmpDeliveryAC & prPmProfSetupInfo->ucBmpTriggerAC) { - switch (prPmProfSetupInfo->ucUapsdSp) { - case WMM_MAX_SP_LENGTH_ALL: - ucQosInfo |= WMM_QOS_INFO_MAX_SP_ALL; - break; - - case WMM_MAX_SP_LENGTH_2: - ucQosInfo |= WMM_QOS_INFO_MAX_SP_2; - break; - - case WMM_MAX_SP_LENGTH_4: - ucQosInfo |= WMM_QOS_INFO_MAX_SP_4; - break; - - case WMM_MAX_SP_LENGTH_6: - ucQosInfo |= WMM_QOS_INFO_MAX_SP_6; - break; - - default: - DBGLOG(QM, INFO, ("MQM: Incorrect SP length \n")); - ucQosInfo |= WMM_QOS_INFO_MAX_SP_2; - break; - } - } - prIeWmmInfo->ucQosInfo = ucQosInfo; - - } - - /* Increment the total IE length for the Element ID and Length fields. */ - prMsduInfo->u2FrameLength += IE_SIZE(prIeWmmInfo); - -} - - -#if 0 -/*----------------------------------------------------------------------------*/ -/*! -* @brief log2 calculation for CW -* -* @param[in] val value -* -* @return log2(val) -*/ -/*----------------------------------------------------------------------------*/ - -UINT_32 cwlog2(UINT_32 val) { - - UINT_32 n; - n=0; - - while (val >= 512) { n+= 9; val = val >> 9; } - while (val >= 16) { n+= 4; val >>= 4; } - while (val >= 2) { n+= 1; val >>= 1; } - return n; -} -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Generate the WMM Param IE -* -* \param[in] prAdapter Adapter pointer -* @param prMsduInfo The TX MMPDU -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -mqmGenerateWmmParamIE ( - IN P_ADAPTER_T prAdapter, - IN P_MSDU_INFO_T prMsduInfo - ) -{ - P_IE_WMM_PARAM_T prIeWmmParam; - - UINT_8 aucWfaOui[] = VENDOR_OUI_WFA; - - UINT_8 aucACI[] = { - WMM_ACI_AC_BE, - WMM_ACI_AC_BK, - WMM_ACI_AC_VI, - WMM_ACI_AC_VO - }; - - P_BSS_INFO_T prBssInfo; - P_STA_RECORD_T prStaRec; - ENUM_WMM_ACI_T eAci; - - DEBUGFUNC("mqmGenerateWmmParamIE"); - DBGLOG(QM, LOUD,("\n")); - - ASSERT(prMsduInfo); - - /* In case QoS is not turned off, exit directly */ - if(!prAdapter->rWifiVar.fgSupportQoS){ - return; - } - - prStaRec = cnmGetStaRecByIndex(prAdapter, prMsduInfo->ucStaRecIndex); - - if(prStaRec) { - if(!prStaRec->fgIsQoS) { - return; - } - } - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prMsduInfo->ucNetworkType]); - - if(!prBssInfo->fgIsQBSS) { return; } - -#if 0 // 20120220 frog: update beacon content & change OP mode is a separate event for P2P network. - if( prBssInfo->eCurrentOPMode != OP_MODE_ACCESS_POINT && - prBssInfo->eCurrentOPMode != OP_MODE_BOW) - { - return; - } -#endif - - prIeWmmParam = (P_IE_WMM_PARAM_T) - ((PUINT_8) prMsduInfo->prPacket + prMsduInfo->u2FrameLength); - - prIeWmmParam->ucId = ELEM_ID_WMM; - prIeWmmParam->ucLength = ELEM_MAX_LEN_WMM_PARAM; - - /* WMM-2.2.1 WMM Information Element Field Values */ - prIeWmmParam->aucOui[0] = aucWfaOui[0]; - prIeWmmParam->aucOui[1] = aucWfaOui[1]; - prIeWmmParam->aucOui[2] = aucWfaOui[2]; - prIeWmmParam->ucOuiType = VENDOR_OUI_TYPE_WMM; - prIeWmmParam->ucOuiSubtype = VENDOR_OUI_SUBTYPE_WMM_PARAM; - - prIeWmmParam->ucVersion = VERSION_WMM; - prIeWmmParam->ucQosInfo = (prBssInfo->ucWmmParamSetCount & WMM_QOS_INFO_PARAM_SET_CNT); - - /* UAPSD intial queue configurations (delivery and trigger enabled)*/ - if(prAdapter->rWifiVar.fgSupportUAPSD){ - - prIeWmmParam->ucQosInfo |= WMM_QOS_INFO_UAPSD; - - } - - /* EDCA parameter */ - - for(eAci = 0; eAci < WMM_AC_INDEX_NUM; eAci++){ - - //DBGLOG(QM, LOUD, ("MQM: eAci = %d, ACM = %d, Aifsn = %d, CWmin = %d, CWmax = %d, TxopLimit = %d\n", - // eAci,prBssInfo->arACQueParmsForBcast[eAci].fgIsACMSet , - // prBssInfo->arACQueParmsForBcast[eAci].u2Aifsn, - // prBssInfo->arACQueParmsForBcast[eAci].u2CWmin, - // prBssInfo->arACQueParmsForBcast[eAci].u2CWmax, - // prBssInfo->arACQueParmsForBcast[eAci].u2TxopLimit)); - - *( ((PUINT_8)(&prIeWmmParam->ucAciAifsn_BE)) + (eAci <<2) ) = (UINT_8) (aucACI[eAci] - | (prBssInfo->arACQueParmsForBcast[eAci].fgIsACMSet ? WMM_ACIAIFSN_ACM:0 ) - | (prBssInfo->arACQueParmsForBcast[eAci].u2Aifsn & (WMM_ACIAIFSN_AIFSN))); -#if 1 - *( ((PUINT_8)(&prIeWmmParam->ucEcw_BE)) + (eAci <<2) ) = (UINT_8) (0 - | (((prBssInfo->aucCWminLog2ForBcast[eAci] )) & WMM_ECW_WMIN_MASK) - | ((((prBssInfo->aucCWmaxLog2ForBcast[eAci] )) << WMM_ECW_WMAX_OFFSET ) & WMM_ECW_WMAX_MASK) - ); -#else - *( ((PUINT_8)(&prIeWmmParam->ucEcw_BE)) + (eAci <<2) ) = (UINT_8) (0 - | (cwlog2((prBssInfo->arACQueParmsForBcast[eAci].u2CWmin + 1)) & WMM_ECW_WMIN_MASK) - | ((cwlog2((prBssInfo->arACQueParmsForBcast[eAci].u2CWmax + 1)) << WMM_ECW_WMAX_OFFSET ) & WMM_ECW_WMAX_MASK) - ); -#endif - - WLAN_SET_FIELD_16( ((PUINT_8)(prIeWmmParam->aucTxopLimit_BE)) + (eAci<<2) - , prBssInfo->arACQueParmsForBcast[eAci].u2TxopLimit); - - } - - /* Increment the total IE length for the Element ID and Length fields. */ - prMsduInfo->u2FrameLength += IE_SIZE(prIeWmmParam); - -} - - - - -ENUM_FRAME_ACTION_T -qmGetFrameAction( - IN P_ADAPTER_T prAdapter, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkType, - IN UINT_8 ucStaRecIdx, - IN P_MSDU_INFO_T prMsduInfo, - IN ENUM_FRAME_TYPE_IN_CMD_Q_T eFrameType -) -{ - P_BSS_INFO_T prBssInfo; - P_STA_RECORD_T prStaRec; - P_WLAN_MAC_HEADER_T prWlanFrame; - UINT_16 u2TxFrameCtrl; - - DEBUGFUNC("qmGetFrameAction"); - -#if (NIC_TX_BUFF_COUNT_TC4 > 2) -#define QM_MGMT_QUUEUD_THRESHOLD 2 -#else -#define QM_MGMT_QUUEUD_THRESHOLD 1 -#endif - - DATA_STRUC_INSPECTING_ASSERT(QM_MGMT_QUUEUD_THRESHOLD <= (NIC_TX_BUFF_COUNT_TC4)); - DATA_STRUC_INSPECTING_ASSERT(QM_MGMT_QUUEUD_THRESHOLD > 0); - - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[eNetworkType]); - prStaRec = QM_GET_STA_REC_PTR_FROM_INDEX(prAdapter, ucStaRecIdx); - - /* XXX Check BOW P2P AIS time ot set active */ - if (!IS_BSS_ACTIVE(prBssInfo)) { - if (eFrameType == FRAME_TYPE_MMPDU) { - prWlanFrame = (P_WLAN_MAC_HEADER_T) prMsduInfo->prPacket; - u2TxFrameCtrl = (prWlanFrame->u2FrameCtrl) & MASK_FRAME_TYPE; // Optimized for ARM - if ((u2TxFrameCtrl == MAC_FRAME_DEAUTH) && (prMsduInfo->pfTxDoneHandler == NULL)) { - return FRAME_ACTION_TX_PKT; - } - - } - - DBGLOG(QM, INFO, ("Drop packets Action (Inactive %u).\n",prBssInfo->ucNetTypeIndex)); - TX_INC_CNT(&prAdapter->rTxCtrl, TX_INACTIVE_BSS_DROP); - return FRAME_ACTION_DROP_PKT; - } - - /* TODO Handle disconnect issue */ - - /* P2P probe Request frame */ - do { - if(eFrameType == FRAME_TYPE_MMPDU) { - ASSERT(prMsduInfo!=NULL); - prWlanFrame = (P_WLAN_MAC_HEADER_T) prMsduInfo->prPacket; - u2TxFrameCtrl = (prWlanFrame->u2FrameCtrl) & MASK_FRAME_TYPE; // Optimized for ARM - - if (u2TxFrameCtrl == MAC_FRAME_BEACON ) { - if( prBssInfo->fgIsNetAbsent) { - return FRAME_ACTION_DROP_PKT; - } - } - else if (u2TxFrameCtrl == MAC_FRAME_PROBE_RSP) { - if( prBssInfo->fgIsNetAbsent) { - break; - } - } - else if (u2TxFrameCtrl == MAC_FRAME_DEAUTH) { - if( prBssInfo->fgIsNetAbsent) { - break; - } - DBGLOG(P2P, LOUD, ("Sending DEAUTH Frame\n")); - return FRAME_ACTION_TX_PKT; - } - /* MMPDU with prStaRec && fgIsInUse not check fgIsNetActive */ - else if(u2TxFrameCtrl == MAC_FRAME_ASSOC_REQ - || u2TxFrameCtrl == MAC_FRAME_AUTH - || u2TxFrameCtrl == MAC_FRAME_REASSOC_REQ - || u2TxFrameCtrl == MAC_FRAME_PROBE_REQ - || u2TxFrameCtrl == MAC_FRAME_ACTION) { - - if(prStaRec){ - if(prStaRec->fgIsInPS) { - if( nicTxGetResource (prAdapter, TC4_INDEX)>= QM_MGMT_QUUEUD_THRESHOLD) { - return FRAME_ACTION_TX_PKT; - } - else { - return FRAME_ACTION_QUEUE_PKT; - } - } - } - return FRAME_ACTION_TX_PKT; - } - - if (!prStaRec){ - return FRAME_ACTION_TX_PKT; - } - else { - if (!prStaRec->fgIsInUse) { - return FRAME_ACTION_DROP_PKT; - } - } - - } /* FRAME_TYPE_MMPDU */ - else if ((eFrameType == FRAME_TYPE_802_1X)){ - - if (!prStaRec){ - return FRAME_ACTION_TX_PKT; - } - else { - if (!prStaRec->fgIsInUse) { - return FRAME_ACTION_DROP_PKT; - } - if(prStaRec->fgIsInPS) { - if( nicTxGetResource (prAdapter, TC4_INDEX)>= QM_MGMT_QUUEUD_THRESHOLD) { - return FRAME_ACTION_TX_PKT; - } - else { - return FRAME_ACTION_QUEUE_PKT; - } - } - } - - } /* FRAME_TYPE_802_1X */ - else if ((!IS_BSS_ACTIVE(prBssInfo)) - || (!prStaRec) - || (!prStaRec->fgIsInUse)){ - return FRAME_ACTION_DROP_PKT; - } - }while(0); - - if (prBssInfo->fgIsNetAbsent){ - DBGLOG(QM, LOUD, ("Queue packets (Absent %u).\n",prBssInfo->ucNetTypeIndex)); - return FRAME_ACTION_QUEUE_PKT; - } - - if (prStaRec && prStaRec->fgIsInPS){ - DBGLOG(QM, LOUD, ("Queue packets (PS %u).\n",prStaRec->fgIsInPS)); - return FRAME_ACTION_QUEUE_PKT; - } - else { - switch (eFrameType){ - case FRAME_TYPE_802_1X: - if (!prStaRec->fgIsValid){ - return FRAME_ACTION_QUEUE_PKT; - } - break; - - case FRAME_TYPE_MMPDU: - break; - - default: - ASSERT(0); - } - } - - return FRAME_ACTION_TX_PKT; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Handle BSS change operation Event from the FW -* -* \param[in] prAdapter Adapter pointer -* \param[in] prEvent The event packet from the FW -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmHandleEventBssAbsencePresence( - IN P_ADAPTER_T prAdapter, - IN P_WIFI_EVENT_T prEvent - ) -{ - P_EVENT_BSS_ABSENCE_PRESENCE_T prEventBssStatus; - P_BSS_INFO_T prBssInfo; - BOOLEAN fgIsNetAbsentOld; - - prEventBssStatus = (P_EVENT_BSS_ABSENCE_PRESENCE_T)prEvent; - prBssInfo = &(prAdapter->rWifiVar.arBssInfo[prEventBssStatus->ucNetTypeIdx]); - fgIsNetAbsentOld = prBssInfo->fgIsNetAbsent; - prBssInfo->fgIsNetAbsent = prEventBssStatus->fgIsAbsent; - prBssInfo->ucBssFreeQuota = prEventBssStatus->ucBssFreeQuota; - - //DBGLOG(QM, TRACE, ("qmHandleEventBssAbsencePresence (ucNetTypeIdx=%d, fgIsAbsent=%d, FreeQuota=%d)\n", - // prEventBssStatus->ucNetTypeIdx, prBssInfo->fgIsNetAbsent, prBssInfo->ucBssFreeQuota)); - - DBGLOG(QM, TRACE, ("NAF=%d,%d,%d\n", - prEventBssStatus->ucNetTypeIdx, prBssInfo->fgIsNetAbsent, prBssInfo->ucBssFreeQuota)); - - if(!prBssInfo->fgIsNetAbsent) { - QM_DBG_CNT_INC(&(prAdapter->rQM),QM_DBG_CNT_27); - } - else { - QM_DBG_CNT_INC(&(prAdapter->rQM),QM_DBG_CNT_28); - } - /* From Absent to Present */ - if ((fgIsNetAbsentOld) && (!prBssInfo->fgIsNetAbsent)){ - kalSetEvent(prAdapter->prGlueInfo); - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Handle STA change PS mode Event from the FW -* -* \param[in] prAdapter Adapter pointer -* \param[in] prEvent The event packet from the FW -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmHandleEventStaChangePsMode( - IN P_ADAPTER_T prAdapter, - IN P_WIFI_EVENT_T prEvent - ) -{ - P_EVENT_STA_CHANGE_PS_MODE_T prEventStaChangePsMode; - P_STA_RECORD_T prStaRec; - BOOLEAN fgIsInPSOld; - - //DbgPrint("QM:Event -RxBa\n"); - - prEventStaChangePsMode = (P_EVENT_STA_CHANGE_PS_MODE_T)prEvent; - prStaRec = QM_GET_STA_REC_PTR_FROM_INDEX(prAdapter, prEventStaChangePsMode->ucStaRecIdx); - ASSERT(prStaRec); - - if(prStaRec) { - - fgIsInPSOld = prStaRec->fgIsInPS; - prStaRec->fgIsInPS = prEventStaChangePsMode->fgIsInPs; - - qmUpdateFreeQuota( - prAdapter, - prStaRec, - prEventStaChangePsMode->ucUpdateMode, - prEventStaChangePsMode->ucFreeQuota); - - //DBGLOG(QM, TRACE, ("qmHandleEventStaChangePsMode (ucStaRecIdx=%d, fgIsInPs=%d)\n", - // prEventStaChangePsMode->ucStaRecIdx, prStaRec->fgIsInPS)); - - - //DBGLOG(QM, TRACE, ("PS=%d,%d\n", - // prEventStaChangePsMode->ucStaRecIdx, prStaRec->fgIsInPS)); - - /* From PS to Awake */ - if ((fgIsInPSOld) && (!prStaRec->fgIsInPS)){ - kalSetEvent(prAdapter->prGlueInfo); - } - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Update STA free quota Event from FW -* -* \param[in] prAdapter Adapter pointer -* \param[in] prEvent The event packet from the FW -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmHandleEventStaUpdateFreeQuota( - IN P_ADAPTER_T prAdapter, - IN P_WIFI_EVENT_T prEvent - ) -{ - P_EVENT_STA_UPDATE_FREE_QUOTA_T prEventStaUpdateFreeQuota; - P_STA_RECORD_T prStaRec; - - - prEventStaUpdateFreeQuota = (P_EVENT_STA_UPDATE_FREE_QUOTA_T)prEvent; - prStaRec = QM_GET_STA_REC_PTR_FROM_INDEX(prAdapter, prEventStaUpdateFreeQuota->ucStaRecIdx); - ASSERT(prStaRec); - - if(prStaRec) { - if(prStaRec->fgIsInPS) { - qmUpdateFreeQuota( - prAdapter, - prStaRec, - prEventStaUpdateFreeQuota->ucUpdateMode, - prEventStaUpdateFreeQuota->ucFreeQuota); - - kalSetEvent(prAdapter->prGlueInfo); - } -#if 0 - DBGLOG(QM, TRACE, ("qmHandleEventStaUpdateFreeQuota (ucStaRecIdx=%d, ucUpdateMode=%d, ucFreeQuota=%d)\n", - prEventStaUpdateFreeQuota->ucStaRecIdx, - prEventStaUpdateFreeQuota->ucUpdateMode, - prEventStaUpdateFreeQuota->ucFreeQuota)); -#endif - - DBGLOG(QM, TRACE, ("UFQ=%d,%d,%d\n", - prEventStaUpdateFreeQuota->ucStaRecIdx, - prEventStaUpdateFreeQuota->ucUpdateMode, - prEventStaUpdateFreeQuota->ucFreeQuota)); - - - } - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Update STA free quota -* -* \param[in] prStaRec the STA -* \param[in] ucUpdateMode the method to update free quota -* \param[in] ucFreeQuota the value for update -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -qmUpdateFreeQuota( - IN P_ADAPTER_T prAdapter, - IN P_STA_RECORD_T prStaRec, - IN UINT_8 ucUpdateMode, - IN UINT_8 ucFreeQuota - ) -{ - - UINT_8 ucFreeQuotaForNonDelivery; - UINT_8 ucFreeQuotaForDelivery; - - ASSERT(prStaRec); - DBGLOG(QM, LOUD, ("qmUpdateFreeQuota orig ucFreeQuota=%d Mode %u New %u\n", - prStaRec->ucFreeQuota, ucUpdateMode, ucFreeQuota )); - - if(!prStaRec->fgIsInPS)return; - - switch (ucUpdateMode) { - case FREE_QUOTA_UPDATE_MODE_INIT: - case FREE_QUOTA_UPDATE_MODE_OVERWRITE: - prStaRec->ucFreeQuota = ucFreeQuota; - break; - case FREE_QUOTA_UPDATE_MODE_INCREASE: - prStaRec->ucFreeQuota += ucFreeQuota; - break; - case FREE_QUOTA_UPDATE_MODE_DECREASE: - prStaRec->ucFreeQuota -= ucFreeQuota; - break; - default: - ASSERT(0); - } - - DBGLOG(QM, LOUD, ("qmUpdateFreeQuota new ucFreeQuota=%d)\n", - prStaRec->ucFreeQuota )); - - ucFreeQuota = prStaRec->ucFreeQuota; - - ucFreeQuotaForNonDelivery = 0; - ucFreeQuotaForDelivery = 0; - - if(ucFreeQuota > 0) { - if( prStaRec->fgIsQoS && prStaRec->fgIsUapsdSupported - /* && prAdapter->rWifiVar.fgSupportQoS - && prAdapter->rWifiVar.fgSupportUAPSD*/) { - /* XXX We should assign quota to aucFreeQuotaPerQueue[NUM_OF_PER_STA_TX_QUEUES] */ - - if(prStaRec->ucFreeQuotaForNonDelivery > 0 && prStaRec->ucFreeQuotaForDelivery > 0) { - ucFreeQuotaForNonDelivery = ucFreeQuota>>1; - ucFreeQuotaForDelivery = ucFreeQuota - ucFreeQuotaForNonDelivery; - } - else if(prStaRec->ucFreeQuotaForNonDelivery == 0 && prStaRec->ucFreeQuotaForDelivery == 0) { - ucFreeQuotaForNonDelivery = ucFreeQuota>>1; - ucFreeQuotaForDelivery = ucFreeQuota - ucFreeQuotaForNonDelivery; - } - else if(prStaRec->ucFreeQuotaForNonDelivery > 0) { - /* NonDelivery is not busy */ - if(ucFreeQuota >= 3 ) { - ucFreeQuotaForNonDelivery = 2; - ucFreeQuotaForDelivery = ucFreeQuota - ucFreeQuotaForNonDelivery ; - } - else { - ucFreeQuotaForDelivery = ucFreeQuota; - ucFreeQuotaForNonDelivery = 0; - } - } - else if(prStaRec->ucFreeQuotaForDelivery > 0) { - /* Delivery is not busy */ - if(ucFreeQuota >= 3 ) { - ucFreeQuotaForDelivery = 2; - ucFreeQuotaForNonDelivery = ucFreeQuota - ucFreeQuotaForDelivery; - } - else { - ucFreeQuotaForNonDelivery = ucFreeQuota; - ucFreeQuotaForDelivery = 0; - } - } - - } - else { - /* !prStaRec->fgIsUapsdSupported */ - ucFreeQuotaForNonDelivery = ucFreeQuota; - ucFreeQuotaForDelivery = 0; - } - } /* ucFreeQuota > 0 */ - - prStaRec->ucFreeQuotaForDelivery = ucFreeQuotaForDelivery; - prStaRec->ucFreeQuotaForNonDelivery = ucFreeQuotaForNonDelivery; - - DBGLOG(QM, LOUD, ("new QuotaForDelivery = %d QuotaForNonDelivery = %d\n", - prStaRec->ucFreeQuotaForDelivery, prStaRec->ucFreeQuotaForNonDelivery )); - -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Return the reorder queued RX packets -* -* \param[in] (none) -* -* \return The number of queued RX packets -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -qmGetRxReorderQueuedBufferCount( - IN P_ADAPTER_T prAdapter - ) -{ - UINT_32 i, u4Total; - P_QUE_MGT_T prQM = &prAdapter->rQM; - u4Total = 0; - /* XXX The summation may impact the performance */ - for(i =0; iarRxBaTable[i].rReOrderQue.u4NumElem; -#if DBG && 0 - if(QUEUE_IS_EMPTY(&(prQM->arRxBaTable[i].rReOrderQue))){ - ASSERT(prQM->arRxBaTable[i].rReOrderQue == 0); - } -#endif - } - ASSERT(u4Total <=( CFG_NUM_OF_QM_RX_PKT_NUM*2)); - return u4Total; -} - - diff --git a/drivers/net/wireless/mt5931/os/linux/gl_bow.c b/drivers/net/wireless/mt5931/os/linux/gl_bow.c deleted file mode 100755 index bdd30aa9ee72..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/gl_bow.c +++ /dev/null @@ -1,1369 +0,0 @@ -/* -** $Id: @(#) gl_bow.c@@ -*/ - -/*! \file gl_bow.c - \brief Main routines of Linux driver interface for 802.11 PAL (BT 3.0 + HS) - - This file contains the main routines of Linux driver for MediaTek Inc. 802.11 - Wireless LAN Adapters. -*/ - - - -/* -** $Log: gl_bow.c $ - * - * 02 16 2012 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * [ALPS00235223] [Rose][ICS][Cross Feature][AEE-IPANIC]The device reboot automatically and then the "KE" pops up after you turn on the "Airplane mode".(once) - * - * [Root Cause] - * PAL operates BOW char dev poll after BOW char dev is registered. - * - * [Solution] - * Rejects PAL char device operation after BOW is unregistered or when wlan GLUE_FLAG_HALT is set. - * - * This is a workaround for BOW driver robustness, happens only in ICS. - * - * Root cause should be fixed by CR [ALPS00231570] - * - * 02 03 2012 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * [ALPS00118114] [Rose][ICS][Free Test][Bluetooth]The "KE" pops up after you turn on the airplane mode.(5/5) - * - * [Root Cause] - * PAL operates BOW char dev poll after BOW char dev is registered. - * - * [Solution] - * Rejects PAL char device operation after BOW is unregistered. - * - * Happens only in ICS. - * - * Notified PAL owener to reivew MTKBT/PAL closing BOW char dev procedure. - * - * [Side Effect] - * None. - * - * 01 16 2012 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Support BOW for 5GHz band. - * - * 11 10 2011 cp.wu - * [WCXRP00001098] [MT6620 Wi-Fi][Driver] Replace printk by DBG LOG macros in linux porting layer - * 1. eliminaite direct calls to printk in porting layer. - * 2. replaced by DBGLOG, which would be XLOG on ALPS platforms. - * - * 10 25 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Modify ampc0 char device for major number 151 for all MT6575 projects. - * - * 07 28 2011 cp.wu - * [WCXRP00000884] [MT6620 Wi-Fi][Driver] Deprecate ioctl interface by unlocked ioctl - * unlocked_ioctl returns as long instead of int. - * - * 07 28 2011 cp.wu - * [WCXRP00000884] [MT6620 Wi-Fi][Driver] Deprecate ioctl interface by unlocked ioctl - * migrate to unlocked ioctl interface - * - * 04 12 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add WMM IE for BOW initiator data. - * - * 04 10 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Change Link disconnection event procedure for hotspot and change skb length check to 1514 bytes. - * - * 04 09 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Change Link connection event procedure and change skb length check to 1512 bytes. - * - * 03 27 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Support multiple physical link. - * - * 03 06 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Sync BOW Driver to latest person development branch version.. - * - * 03 03 2011 jeffrey.chang - * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue - * support concurrent network - * - * 03 03 2011 jeffrey.chang - * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue - * replace alloc_netdev to alloc_netdev_mq for BoW - * - * 03 03 2011 jeffrey.chang - * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue - * modify net device relative functions to support multiple H/W queues - * - * 02 15 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Update net register and BOW for concurrent features. - * - * 02 10 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Fix kernel API change issue. - * Before ALPS 2.2 (2.2 included), kfifo_alloc() is - * struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, spinlock_t *lock); - * After ALPS 2.3, kfifo_alloc() is changed to - * int kfifo_alloc(struct kfifo *fifo, unsigned int size, gfp_t gfp_mask); - * - * 02 09 2011 cp.wu - * [WCXRP00000430] [MT6620 Wi-Fi][Firmware][Driver] Create V1.2 branch for MT6620E1 and MT6620E3 - * create V1.2 driver branch based on label MT6620_WIFI_DRIVER_V1_2_110209_1031 - * with BOW and P2P enabled as default - * - * 02 08 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Replace kfifo_get and kfifo_put with kfifo_out and kfifo_in. - * Update BOW get MAC status, remove returning event for AIS network type. - * - * 01 12 2011 cp.wu - * [WCXRP00000357] [MT6620 Wi-Fi][Driver][Bluetooth over Wi-Fi] add another net device interface for BT AMP - * implementation of separate BT_OVER_WIFI data path. - * - * 01 12 2011 cp.wu - * [WCXRP00000356] [MT6620 Wi-Fi][Driver] fill mac header length for security frames 'cause hardware header translation needs such information - * fill mac header length information for 802.1x frames. - * - * 11 11 2010 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Fix BoW timer assert issue. - * - * 09 14 2010 chinghwa.yu - * NULL - * Add bowRunEventAAAComplete. - * - * 09 14 2010 cp.wu - * NULL - * correct typo: POLLOUT instead of POLL_OUT - * - * 09 13 2010 cp.wu - * NULL - * add waitq for poll() and read(). - * - * 08 24 2010 chinghwa.yu - * NULL - * Update BOW for the 1st time. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 05 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * change variable names for multiple physical link to match with coding convention - * - * 05 05 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * multiple BoW interfaces need to compare with peer address - * - * 04 28 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * change prefix for data structure used to communicate with 802.11 PAL - * to avoid ambiguous naming with firmware interface - * - * 04 28 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * fix kalIndicateBOWEvent. - * - * 04 27 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add multiple physical link support - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * * * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * * * * * * * * * * * * * 2) command sequence number is now increased atomically - * * * * * * * * * * * * * * * * 3) private data could be hold and taken use for other purpose -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_os.h" -#include "debug.h" -#include "wlan_lib.h" -#include "gl_wext.h" -#include "precomp.h" -#include -#include "bss.h" - -#if CFG_ENABLE_BT_OVER_WIFI - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -/* @FIXME if there is command/event with payload length > 28 */ -#define MAX_BUFFER_SIZE (64) - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -#if CFG_BOW_TEST - UINT_32 g_u4PrevSysTime = 0; - UINT_32 g_u4CurrentSysTime = 0; - UINT_32 g_arBowRevPalPacketTime[11]; -#endif - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -// forward declarations -static ssize_t -mt6620_ampc_read( - IN struct file *filp, - IN char __user *buf, - IN size_t size, - IN OUT loff_t *ppos); - -static ssize_t -mt6620_ampc_write( - IN struct file *filp, - OUT const char __user *buf, - IN size_t size, - IN OUT loff_t *ppos); - -static long -mt6620_ampc_ioctl( - IN struct file *filp, - IN unsigned int cmd, - IN OUT unsigned long arg); - -static unsigned int -mt6620_ampc_poll( - IN struct file *filp, - IN poll_table *wait); - -static int -mt6620_ampc_open( - IN struct inode *inodep, - IN struct file *filp); - -static int -mt6620_ampc_release( - IN struct inode *inodep, - IN struct file *filp); - - -// character file operations -static const struct file_operations mt6620_ampc_fops = { - //.owner = THIS_MODULE, - .read = mt6620_ampc_read, - .write = mt6620_ampc_write, - .unlocked_ioctl = mt6620_ampc_ioctl, - .poll = mt6620_ampc_poll, - .open = mt6620_ampc_open, - .release = mt6620_ampc_release, -}; - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Register for character device to communicate with 802.11 PAL -* -* \param[in] prGlueInfo Pointer to glue info -* -* \return TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -glRegisterAmpc ( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - if(prGlueInfo->rBowInfo.fgIsRegistered == TRUE) { - return FALSE; - } - else { -#if 0 - // 1. allocate major number dynamically - - if(alloc_chrdev_region(&(prGlueInfo->rBowInfo.u4DeviceNumber), - 0, // first minor number - 1, // number - GLUE_BOW_DEVICE_NAME) !=0) - - return FALSE; -#endif - -#if 1 - -#if defined (CONFIG_AMPC_CDEV_NUM) - prGlueInfo->rBowInfo.u4DeviceNumber = MKDEV(CONFIG_AMPC_CDEV_NUM, 0); -#else - prGlueInfo->rBowInfo.u4DeviceNumber = MKDEV(226, 0); -#endif - - if(register_chrdev_region(prGlueInfo->rBowInfo.u4DeviceNumber, - 1, // number - GLUE_BOW_DEVICE_NAME) !=0) - - return FALSE; -#endif - - // 2. spin-lock initialization - // spin_lock_init(&(prGlueInfo->rBowInfo.rSpinLock)); - - // 3. initialize kfifo -/* prGlueInfo->rBowInfo.prKfifo = kfifo_alloc(GLUE_BOW_KFIFO_DEPTH, - GFP_KERNEL, - &(prGlueInfo->rBowInfo.rSpinLock));*/ - if ((kfifo_alloc((struct kfifo *) &(prGlueInfo->rBowInfo.rKfifo), GLUE_BOW_KFIFO_DEPTH, GFP_KERNEL))) - goto fail_kfifo_alloc; - -// if(prGlueInfo->rBowInfo.prKfifo == NULL) - if(&(prGlueInfo->rBowInfo.rKfifo) == NULL) - goto fail_kfifo_alloc; - - // 4. initialize cdev - cdev_init(&(prGlueInfo->rBowInfo.cdev), &mt6620_ampc_fops); - // prGlueInfo->rBowInfo.cdev.owner = THIS_MODULE; - prGlueInfo->rBowInfo.cdev.ops = &mt6620_ampc_fops; - - // 5. add character device - if(cdev_add(&(prGlueInfo->rBowInfo.cdev), - prGlueInfo->rBowInfo.u4DeviceNumber, - 1)) - goto fail_cdev_add; - - - // 6. in queue initialization - init_waitqueue_head(&(prGlueInfo->rBowInfo.outq)); - - // 7. finish - prGlueInfo->rBowInfo.fgIsRegistered = TRUE; - return TRUE; - -fail_cdev_add: - kfifo_free(&(prGlueInfo->rBowInfo.rKfifo)); -// kfifo_free(prGlueInfo->rBowInfo.prKfifo); -fail_kfifo_alloc: - unregister_chrdev_region(prGlueInfo->rBowInfo.u4DeviceNumber, 1); - return FALSE; - } -} /* end of glRegisterAmpc */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Unregister character device for communicating with 802.11 PAL -* -* \param[in] prGlueInfo Pointer to glue info -* -* \return TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -glUnregisterAmpc ( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - if(prGlueInfo->rBowInfo.fgIsRegistered == FALSE) { - return FALSE; - } - else { - prGlueInfo->rBowInfo.fgIsRegistered = FALSE; - - // 1. free netdev if necessary -#if CFG_BOW_SEPARATE_DATA_PATH - kalUninitBowDevice(prGlueInfo); -#endif - - // 2. removal of character device - cdev_del(&(prGlueInfo->rBowInfo.cdev)); - - // 3. free kfifo -// kfifo_free(prGlueInfo->rBowInfo.prKfifo); - kfifo_free(&(prGlueInfo->rBowInfo.rKfifo)); -// prGlueInfo->rBowInfo.prKfifo = NULL; -// prGlueInfo->rBowInfo.rKfifo = NULL; - - // 4. free device number - unregister_chrdev_region(prGlueInfo->rBowInfo.u4DeviceNumber, 1); - - return TRUE; - } -} /* end of glUnregisterAmpc */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief read handler for character device to communicate with 802.11 PAL -* -* \param[in] -* \return -* Follows Linux Character Device Interface -* -*/ -/*----------------------------------------------------------------------------*/ -static ssize_t -mt6620_ampc_read( - IN struct file *filp, - IN char __user *buf, - IN size_t size, - IN OUT loff_t *ppos) -{ - UINT_8 aucBuffer[MAX_BUFFER_SIZE]; - ssize_t retval; - - P_GLUE_INFO_T prGlueInfo; - prGlueInfo = (P_GLUE_INFO_T)(filp->private_data); - - ASSERT(prGlueInfo); - - if ((prGlueInfo->rBowInfo.fgIsRegistered == FALSE) || (prGlueInfo->u4Flag & GLUE_FLAG_HALT)) { - return -EFAULT; - } - - // size check -// if(kfifo_len(prGlueInfo->rBowInfo.prKfifo) >= size) - if(kfifo_len(&(prGlueInfo->rBowInfo.rKfifo)) >= size) - retval = size; - else - retval = kfifo_len(&(prGlueInfo->rBowInfo.rKfifo)); -// retval = kfifo_len(prGlueInfo->rBowInfo.prKfifo); - -// kfifo_get(prGlueInfo->rBowInfo.prKfifo, aucBuffer, retval); -// kfifo_out(prGlueInfo->rBowInfo.prKfifo, aucBuffer, retval); - if (!(kfifo_out(&(prGlueInfo->rBowInfo.rKfifo), aucBuffer, retval))) - retval = -EIO; - - if(copy_to_user(buf, aucBuffer, retval)) - retval = -EIO; - - return retval; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief write handler for character device to communicate with 802.11 PAL -* -* \param[in] -* \return -* Follows Linux Character Device Interface -* -*/ -/*----------------------------------------------------------------------------*/ -static ssize_t -mt6620_ampc_write( - IN struct file *filp, - OUT const char __user *buf, - IN size_t size, - IN OUT loff_t *ppos) -{ -#if CFG_BOW_TEST - UINT_8 i; -#endif - - UINT_8 aucBuffer[MAX_BUFFER_SIZE]; - P_AMPC_COMMAND prCmd; - P_GLUE_INFO_T prGlueInfo; - - prGlueInfo = (P_GLUE_INFO_T)(filp->private_data); - ASSERT(prGlueInfo); - - if ((prGlueInfo->rBowInfo.fgIsRegistered == FALSE) || (prGlueInfo->u4Flag & GLUE_FLAG_HALT)) { - return -EFAULT; - } - - if(size > MAX_BUFFER_SIZE) - return -EINVAL; - else if(copy_from_user(aucBuffer, buf, size)) - return -EIO; - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("AMP driver CMD buffer size : %d.\n", size)); - - for(i = 0; i < MAX_BUFFER_SIZE; i++) - { - DBGLOG(BOW, EVENT, ("AMP write content : 0x%x.\n", aucBuffer[i])); - } - - DBGLOG(BOW, EVENT, ("BoW CMD write.\n")); -#endif - - prCmd = (P_AMPC_COMMAND) aucBuffer; - - #if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("AMP write content payload length : %d.\n", prCmd->rHeader.u2PayloadLength)); - - DBGLOG(BOW, EVENT, ("AMP write content header length : %d.\n", sizeof(AMPC_COMMAND_HEADER_T))); - #endif - - // size check - if(prCmd->rHeader.u2PayloadLength + sizeof(AMPC_COMMAND_HEADER_T) != size) - { - #if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("Wrong CMD total length.\n")); - #endif - - return -EINVAL; - } - - if(wlanbowHandleCommand(prGlueInfo->prAdapter, prCmd) == WLAN_STATUS_SUCCESS) - return size; - else - return -EINVAL; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief ioctl handler for character device to communicate with 802.11 PAL -* -* \param[in] -* \return -* Follows Linux Character Device Interface -* -*/ -/*----------------------------------------------------------------------------*/ -static long -mt6620_ampc_ioctl( - IN struct file *filp, - IN unsigned int cmd, - IN OUT unsigned long arg) -{ - int err = 0; - P_GLUE_INFO_T prGlueInfo; - prGlueInfo = (P_GLUE_INFO_T)(filp->private_data); - - ASSERT(prGlueInfo); - - if ((prGlueInfo->rBowInfo.fgIsRegistered == FALSE) || (prGlueInfo->u4Flag & GLUE_FLAG_HALT)) { - return -EFAULT; - } - - // permission check - if(_IOC_DIR(cmd) & _IOC_READ) - err = !access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd)); - else if (_IOC_DIR(cmd) & _IOC_WRITE) - err = !access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd)); - if (err) - return -EFAULT; - - // no ioctl is implemented yet - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief ioctl handler for character device to communicate with 802.11 PAL -* -* \param[in] -* \return -* Follows Linux Character Device Interface -* -*/ -/*----------------------------------------------------------------------------*/ -static unsigned int -mt6620_ampc_poll( - IN struct file *filp, - IN poll_table *wait) -{ - unsigned int retval; - P_GLUE_INFO_T prGlueInfo; - prGlueInfo = (P_GLUE_INFO_T)(filp->private_data); - - ASSERT(prGlueInfo); - - if ((prGlueInfo->rBowInfo.fgIsRegistered == FALSE) || (prGlueInfo->u4Flag & GLUE_FLAG_HALT)) { - return -EFAULT; - } - - poll_wait(filp, &prGlueInfo->rBowInfo.outq, wait); - - retval = (POLLOUT | POLLWRNORM); // always accepts incoming command packets - -// DBGLOG(BOW, EVENT, ("mt6620_ampc_pol, POLLOUT | POLLWRNORM, %x\n", retval)); - -// if(kfifo_len(prGlueInfo->rBowInfo.prKfifo) > 0) - if(kfifo_len(&(prGlueInfo->rBowInfo.rKfifo)) > 0) - { - retval |= (POLLIN | POLLRDNORM); - -// DBGLOG(BOW, EVENT, ("mt6620_ampc_pol, POLLIN | POLLRDNORM, %x\n", retval)); - - } - - return retval; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief open handler for character device to communicate with 802.11 PAL -* -* \param[in] -* \return -* Follows Linux Character Device Interface -* -*/ -/*----------------------------------------------------------------------------*/ -static int -mt6620_ampc_open( - IN struct inode *inodep, - IN struct file *filp) -{ - P_GLUE_INFO_T prGlueInfo; - P_GL_BOW_INFO prBowInfo; - - prBowInfo = container_of(inodep->i_cdev, GL_BOW_INFO, cdev); - ASSERT(prBowInfo); - - prGlueInfo = container_of(prBowInfo, GLUE_INFO_T, rBowInfo); - ASSERT(prGlueInfo); - - // set-up private data - filp->private_data = prGlueInfo; - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief close handler for character device to communicate with 802.11 PAL -* -* \param[in] -* \return -* Follows Linux Character Device Interface -* -*/ -/*----------------------------------------------------------------------------*/ -static int -mt6620_ampc_release( - IN struct inode *inodep, - IN struct file *filp) -{ - P_GLUE_INFO_T prGlueInfo; - prGlueInfo = (P_GLUE_INFO_T)(filp->private_data); - - ASSERT(prGlueInfo); - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to indicate event for Bluetooth over Wi-Fi -* -* \param[in] -* prGlueInfo -* prEvent -* \return -* none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalIndicateBOWEvent( - IN P_GLUE_INFO_T prGlueInfo, - IN P_AMPC_EVENT prEvent - ) -{ - size_t u4AvailSize, u4EventSize; - - ASSERT(prGlueInfo); - ASSERT(prEvent); - - // check device - if ((prGlueInfo->rBowInfo.fgIsRegistered == FALSE) || (prGlueInfo->u4Flag & GLUE_FLAG_HALT)) { - return; - } - -/* u4AvailSize = - GLUE_BOW_KFIFO_DEPTH - kfifo_len(prGlueInfo->rBowInfo.prKfifo);*/ - - u4AvailSize = - GLUE_BOW_KFIFO_DEPTH - kfifo_len(&(prGlueInfo->rBowInfo.rKfifo)); - - - u4EventSize = - prEvent->rHeader.u2PayloadLength + sizeof(AMPC_EVENT_HEADER_T); - - // check kfifo availability - if(u4AvailSize < u4EventSize) { - DBGLOG(BOW, EVENT, ("[bow] no space for event: %d/%d\n", - u4EventSize, - u4AvailSize)); - return; - } - - // queue into kfifo -// kfifo_put(prGlueInfo->rBowInfo.prKfifo, (PUINT_8)prEvent, u4EventSize); -// kfifo_in(prGlueInfo->rBowInfo.prKfifo, (PUINT_8)prEvent, u4EventSize); - kfifo_in(&(prGlueInfo->rBowInfo.rKfifo), (PUINT_8)prEvent, u4EventSize); - wake_up_interruptible(&(prGlueInfo->rBowInfo.outq)); - - return; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to retrieve Bluetooth-over-Wi-Fi state from glue layer -* -* \param[in] -* prGlueInfo -* rPeerAddr -* \return -* ENUM_BOW_DEVICE_STATE -*/ -/*----------------------------------------------------------------------------*/ -ENUM_BOW_DEVICE_STATE -kalGetBowState ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 aucPeerAddress[6] - ) -{ - UINT_8 i; - - ASSERT(prGlueInfo); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("kalGetBowState.\n")); -#endif - - for(i = 0 ; i < CFG_BOW_PHYSICAL_LINK_NUM ; i++) - { - if(EQUAL_MAC_ADDR(prGlueInfo->rBowInfo.arPeerAddr, aucPeerAddress) == 0) - { - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("kalGetBowState, aucPeerAddress %x, %x:%x:%x:%x:%x:%x.\n", i, - aucPeerAddress[0], - aucPeerAddress[1], - aucPeerAddress[2], - aucPeerAddress[3], - aucPeerAddress[4], - aucPeerAddress[5])); - - DBGLOG(BOW, EVENT, ("kalGetBowState, prGlueInfo->rBowInfo.aeState %x, %x.\n", i, prGlueInfo->rBowInfo.aeState[i])); - -#endif - - return prGlueInfo->rBowInfo.aeState[i]; - } - } - - return BOW_DEVICE_STATE_DISCONNECTED; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to set Bluetooth-over-Wi-Fi state in glue layer -* -* \param[in] -* prGlueInfo -* eBowState -* rPeerAddr -* \return -* none -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalSetBowState ( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_BOW_DEVICE_STATE eBowState, - IN UINT_8 aucPeerAddress[6] - ) -{ - UINT_8 i; - - ASSERT(prGlueInfo); - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("kalSetBowState.\n")); - - DBGLOG(BOW, EVENT, ("kalSetBowState, prGlueInfo->rBowInfo.arPeerAddr, %x:%x:%x:%x:%x:%x.\n", - prGlueInfo->rBowInfo.arPeerAddr[0], - prGlueInfo->rBowInfo.arPeerAddr[1], - prGlueInfo->rBowInfo.arPeerAddr[2], - prGlueInfo->rBowInfo.arPeerAddr[3], - prGlueInfo->rBowInfo.arPeerAddr[4], - prGlueInfo->rBowInfo.arPeerAddr[5])); - - DBGLOG(BOW, EVENT, ("kalSetBowState, aucPeerAddress, %x:%x:%x:%x:%x:%x.\n", - aucPeerAddress[0], - aucPeerAddress[1], - aucPeerAddress[2], - aucPeerAddress[3], - aucPeerAddress[4], - aucPeerAddress[5])); -#endif - - for(i = 0 ; i < CFG_BOW_PHYSICAL_LINK_NUM ; i++) - { - if(EQUAL_MAC_ADDR(prGlueInfo->rBowInfo.arPeerAddr, aucPeerAddress) == 0) - { - prGlueInfo->rBowInfo.aeState[i] = eBowState; - -#if CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("kalSetBowState, aucPeerAddress %x, %x:%x:%x:%x:%x:%x.\n", i, - aucPeerAddress[0], - aucPeerAddress[1], - aucPeerAddress[2], - aucPeerAddress[3], - aucPeerAddress[4], - aucPeerAddress[5])); - - DBGLOG(BOW, EVENT, ("kalSetBowState, prGlueInfo->rBowInfo.aeState %x, %x.\n", i, prGlueInfo->rBowInfo.aeState[i])); -#endif - - return TRUE; - } - } - - return FALSE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to retrieve Bluetooth-over-Wi-Fi global state -* -* \param[in] -* prGlueInfo -* -* \return -* BOW_DEVICE_STATE_DISCONNECTED -* in case there is no BoW connection or -* BoW connection under initialization -* -* BOW_DEVICE_STATE_STARTING -* in case there is no BoW connection but -* some BoW connection under initialization -* -* BOW_DEVICE_STATE_CONNECTED -* in case there is any BoW connection available -*/ -/*----------------------------------------------------------------------------*/ -ENUM_BOW_DEVICE_STATE -kalGetBowGlobalState ( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - UINT_32 i; - - ASSERT(prGlueInfo); - - -//Henry, can reduce this logic to indentify state change - - for(i = 0 ; i < CFG_BOW_PHYSICAL_LINK_NUM ; i++) { - if(prGlueInfo->rBowInfo.aeState[i] == BOW_DEVICE_STATE_CONNECTED) { - return BOW_DEVICE_STATE_CONNECTED; - } - } - - for(i = 0 ; i < CFG_BOW_PHYSICAL_LINK_NUM ; i++) { - if(prGlueInfo->rBowInfo.aeState[i] == BOW_DEVICE_STATE_STARTING) { - return BOW_DEVICE_STATE_STARTING; - } - } - - return BOW_DEVICE_STATE_DISCONNECTED; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to retrieve Bluetooth-over-Wi-Fi operating frequency -* -* \param[in] -* prGlueInfo -* -* \return -* in unit of KHz -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -kalGetBowFreqInKHz( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - return prGlueInfo->rBowInfo.u4FreqInKHz; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to retrieve Bluetooth-over-Wi-Fi role -* -* \param[in] -* prGlueInfo -* -* \return -* 0: Responder -* 1: Initiator -*/ -/*----------------------------------------------------------------------------*/ -UINT_8 -kalGetBowRole( - IN P_GLUE_INFO_T prGlueInfo, - IN PARAM_MAC_ADDRESS rPeerAddr - ) -{ - UINT_32 i; - - ASSERT(prGlueInfo); - - for(i = 0 ; i < CFG_BOW_PHYSICAL_LINK_NUM ; i++) { - if(EQUAL_MAC_ADDR(prGlueInfo->rBowInfo.arPeerAddr[i], rPeerAddr) == 0) { - return prGlueInfo->rBowInfo.aucRole[i]; - } - } - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to set Bluetooth-over-Wi-Fi role -* -* \param[in] -* prGlueInfo -* ucRole -* 0: Responder -* 1: Initiator -* \return -* none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalSetBowRole( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 ucRole, - IN PARAM_MAC_ADDRESS rPeerAddr - ) -{ - UINT_32 i; - - ASSERT(prGlueInfo); - ASSERT(ucRole <= 1); - - for(i = 0 ; i < CFG_BOW_PHYSICAL_LINK_NUM ; i++) { - if(EQUAL_MAC_ADDR(prGlueInfo->rBowInfo.arPeerAddr[i], rPeerAddr) == 0) { - prGlueInfo->rBowInfo.aucRole[i] = ucRole; //Henry, 0 : Responder, 1 : Initiator - } - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to get available Bluetooth-over-Wi-Fi physical link number -* -* \param[in] -* prGlueInfo -* \return -* UINT_32 -* how many physical links are aviailable -*/ -/*----------------------------------------------------------------------------*/ -UINT_8 -kalGetBowAvailablePhysicalLinkCount( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - UINT_8 i; - UINT_8 ucLinkCount = 0; - - ASSERT(prGlueInfo); - - for(i = 0 ; i < CFG_BOW_PHYSICAL_LINK_NUM ; i++) { - if(prGlueInfo->rBowInfo.aeState[i] == BOW_DEVICE_STATE_DISCONNECTED) { - ucLinkCount++; - } - } - -#if 0//CFG_BOW_TEST - DBGLOG(BOW, EVENT, ("kalGetBowAvailablePhysicalLinkCount, ucLinkCount, %c.\n", ucLinkCount)); -#endif - - return ucLinkCount; -} - -#if CFG_BOW_SEPARATE_DATA_PATH - -/* Net Device Hooks */ -/*----------------------------------------------------------------------------*/ -/*! - * \brief A function for net_device open (ifup) - * - * \param[in] prDev Pointer to struct net_device. - * - * \retval 0 The execution succeeds. - * \retval < 0 The execution failed. - */ -/*----------------------------------------------------------------------------*/ -static int -bowOpen( - IN struct net_device *prDev - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - P_ADAPTER_T prAdapter = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - /* 2. carrier on & start TX queue */ - netif_carrier_on(prDev); - netif_tx_start_all_queues(prDev); - - return 0; /* success */ -} - - -/*----------------------------------------------------------------------------*/ -/*! - * \brief A function for net_device stop (ifdown) - * - * \param[in] prDev Pointer to struct net_device. - * - * \retval 0 The execution succeeds. - * \retval < 0 The execution failed. - */ -/*----------------------------------------------------------------------------*/ -static int -bowStop( - IN struct net_device *prDev - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - P_ADAPTER_T prAdapter = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - /* 1. stop TX queue */ - netif_tx_stop_all_queues(prDev); - - /* 2. turn of carrier */ - if(netif_carrier_ok(prDev)) { - netif_carrier_off(prDev); - } - - return 0; -}; - - -/*----------------------------------------------------------------------------*/ -/*! - * \brief This function is TX entry point of NET DEVICE. - * - * \param[in] prSkb Pointer of the sk_buff to be sent - * \param[in] prDev Pointer to struct net_device - * - * \retval NETDEV_TX_OK - on success. - * \retval NETDEV_TX_BUSY - on failure, packet will be discarded by upper layer. - */ -/*----------------------------------------------------------------------------*/ -static int -bowHardStartXmit( - IN struct sk_buff *prSkb, - IN struct net_device *prDev - ) -{ - P_GLUE_INFO_T prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - - P_QUE_ENTRY_T prQueueEntry = NULL; - P_QUE_T prTxQueue = NULL; - UINT_16 u2QueueIdx = 0; - UINT_8 ucDSAP, ucSSAP, ucControl; - UINT_8 aucOUI[3]; - PUINT_8 aucLookAheadBuf = NULL; - -#if CFG_BOW_TEST - UINT_32 i; -#endif - - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prSkb); - ASSERT(prDev); - ASSERT(prGlueInfo); - - aucLookAheadBuf = prSkb->data; - - ucDSAP = *(PUINT_8) &aucLookAheadBuf[ETH_LLC_OFFSET]; - ucSSAP = *(PUINT_8) &aucLookAheadBuf[ETH_LLC_OFFSET + 1]; - ucControl = *(PUINT_8) &aucLookAheadBuf[ETH_LLC_OFFSET + 2]; - aucOUI[0] = *(PUINT_8) &aucLookAheadBuf[ETH_SNAP_OFFSET]; - aucOUI[1] = *(PUINT_8) &aucLookAheadBuf[ETH_SNAP_OFFSET + 1]; - aucOUI[2] = *(PUINT_8) &aucLookAheadBuf[ETH_SNAP_OFFSET + 2]; - - if (!(ucDSAP == ETH_LLC_DSAP_SNAP && - ucSSAP == ETH_LLC_SSAP_SNAP && - ucControl == ETH_LLC_CONTROL_UNNUMBERED_INFORMATION && - aucOUI[0] == ETH_SNAP_BT_SIG_OUI_0 && - aucOUI[1] == ETH_SNAP_BT_SIG_OUI_1 && - aucOUI[2] == ETH_SNAP_BT_SIG_OUI_2) || (prSkb->len > 1514)) - { - -#if CFG_BOW_TEST - DBGLOG(BOW, TRACE, ("Invalid BOW packet, skip tx\n")); -#endif - - dev_kfree_skb(prSkb); - return NETDEV_TX_OK; - } - - if (prGlueInfo->u4Flag & GLUE_FLAG_HALT) { - DBGLOG(BOW, TRACE, ("GLUE_FLAG_HALT skip tx\n")); - dev_kfree_skb(prSkb); - return NETDEV_TX_OK; - } - - prQueueEntry = (P_QUE_ENTRY_T) GLUE_GET_PKT_QUEUE_ENTRY(prSkb); - prTxQueue = &prGlueInfo->rTxQueue; - -#if CFG_BOW_TEST - DBGLOG(BOW, TRACE, ("Tx sk_buff->len: %d\n", prSkb->len)); - DBGLOG(BOW, TRACE, ("Tx sk_buff->data_len: %d\n", prSkb->data_len)); - DBGLOG(BOW, TRACE, ("Tx sk_buff->data:\n")); - - for(i = 0; i < prSkb->len; i++) - { - DBGLOG(BOW, TRACE, ("%4x", prSkb->data[i])); - - if((i+1)%16 ==0) - { - DBGLOG(BOW, TRACE, ("\n")); - } - } - - DBGLOG(BOW, TRACE, ("\n"); -#endif - -#if CFG_BOW_TEST -// g_u4CurrentSysTime = (OS_SYSTIME)kalGetTimeTick(); - - g_u4CurrentSysTime = (OS_SYSTIME) jiffies_to_usecs(jiffies); - - i = g_u4CurrentSysTime - g_u4PrevSysTime; - - if ( (i >> 10) > 0) - { - i = 10; - } - else - { - i = i >> 7; - } - - g_arBowRevPalPacketTime[i]++; - - g_u4PrevSysTime = g_u4CurrentSysTime; - -#endif - - if (wlanProcessSecurityFrame(prGlueInfo->prAdapter, (P_NATIVE_PACKET) prSkb) == FALSE) { - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_TX_QUE); - QUEUE_INSERT_TAIL(prTxQueue, prQueueEntry); - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_TX_QUE); - - - GLUE_INC_REF_CNT(prGlueInfo->i4TxPendingFrameNum); - GLUE_INC_REF_CNT(prGlueInfo->ai4TxPendingFrameNumPerQueue[NETWORK_TYPE_BOW_INDEX][u2QueueIdx]); - - if (prGlueInfo->ai4TxPendingFrameNumPerQueue[NETWORK_TYPE_BOW_INDEX][u2QueueIdx] >= CFG_TX_STOP_NETIF_PER_QUEUE_THRESHOLD) { - netif_stop_subqueue(prDev, u2QueueIdx); - } - } - else { - GLUE_INC_REF_CNT(prGlueInfo->i4TxPendingSecurityFrameNum); - } - - kalSetEvent(prGlueInfo); - - /* For Linux, we'll always return OK FLAG, because we'll free this skb by ourself */ - return NETDEV_TX_OK; -} - - -// callbacks for netdevice -static const struct net_device_ops bow_netdev_ops = { - .ndo_open = bowOpen, - .ndo_stop = bowStop, - .ndo_start_xmit = bowHardStartXmit, -}; - -/*----------------------------------------------------------------------------*/ -/*! -* \brief initialize net device for Bluetooth-over-Wi-Fi -* -* \param[in] -* prGlueInfo -* prDevName -* -* \return -* TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalInitBowDevice( - IN P_GLUE_INFO_T prGlueInfo, - IN const char *prDevName - ) -{ - P_ADAPTER_T prAdapter; - P_GL_HIF_INFO_T prHif; - PARAM_MAC_ADDRESS rMacAddr; - - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->rBowInfo.fgIsRegistered == TRUE); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - prHif = &prGlueInfo->rHifInfo; - ASSERT(prHif); - - if(prGlueInfo->rBowInfo.fgIsNetRegistered == FALSE) { - prGlueInfo->rBowInfo.prDevHandler = alloc_netdev_mq(sizeof(P_GLUE_INFO_T), prDevName, ether_setup, CFG_MAX_TXQ_NUM); - - if (!prGlueInfo->rBowInfo.prDevHandler) { - return FALSE; - } - else { - /* 1. setup netdev */ - /* 1.1 Point to shared glue structure */ - *((P_GLUE_INFO_T *) netdev_priv(prGlueInfo->rBowInfo.prDevHandler)) = prGlueInfo; - - /* 1.2 fill hardware address */ - COPY_MAC_ADDR(rMacAddr, prAdapter->rMyMacAddr); - rMacAddr[0] |= 0x2; // change to local administrated address - memcpy(prGlueInfo->rBowInfo.prDevHandler->dev_addr, rMacAddr, ETH_ALEN); - memcpy(prGlueInfo->rBowInfo.prDevHandler->perm_addr, prGlueInfo->rBowInfo.prDevHandler->dev_addr, ETH_ALEN); - - /* 1.3 register callback functions */ - prGlueInfo->rBowInfo.prDevHandler->netdev_ops = &bow_netdev_ops; - -#if (MTK_WCN_HIF_SDIO == 0) - SET_NETDEV_DEV(prGlueInfo->rBowInfo.prDevHandler, &(prHif->func->dev)); -#endif - - register_netdev(prGlueInfo->rBowInfo.prDevHandler); - - /* 2. net device initialize */ - netif_carrier_off(prGlueInfo->rBowInfo.prDevHandler); - netif_tx_stop_all_queues(prGlueInfo->rBowInfo.prDevHandler); - - /* 3. finish */ - prGlueInfo->rBowInfo.fgIsNetRegistered = TRUE; - } - } - - return TRUE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief uninitialize net device for Bluetooth-over-Wi-Fi -* -* \param[in] -* prGlueInfo -* -* \return -* TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalUninitBowDevice( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - //ASSERT(prGlueInfo->rBowInfo.fgIsRegistered == TRUE); - - if(prGlueInfo->rBowInfo.fgIsNetRegistered == TRUE) { - - prGlueInfo->rBowInfo.fgIsNetRegistered = FALSE; - - if(netif_carrier_ok(prGlueInfo->rBowInfo.prDevHandler)) { - netif_carrier_off(prGlueInfo->rBowInfo.prDevHandler); - } - - netif_tx_stop_all_queues(prGlueInfo->rBowInfo.prDevHandler); - - /* netdevice unregistration & free */ - unregister_netdev(prGlueInfo->rBowInfo.prDevHandler); - free_netdev(prGlueInfo->rBowInfo.prDevHandler); - prGlueInfo->rBowInfo.prDevHandler = NULL; - - return TRUE; - - } - else { - return FALSE; - } -} - -#endif // CFG_BOW_SEPARATE_DATA_PATH -#endif // CFG_ENABLE_BT_OVER_WIFI - diff --git a/drivers/net/wireless/mt5931/os/linux/gl_cfg80211.c b/drivers/net/wireless/mt5931/os/linux/gl_cfg80211.c deleted file mode 100755 index 8c8649b45443..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/gl_cfg80211.c +++ /dev/null @@ -1,1661 +0,0 @@ -/* -** $Id: @(#) gl_cfg80211.c@@ -*/ - -/*! \file gl_cfg80211.c - \brief Main routines for supporintg MT6620 cfg80211 control interface - - This file contains the support routines of Linux driver for MediaTek Inc. 802.11 - Wireless LAN Adapters. -*/ - -/******************************************************************************* -* Copyright (c) 2007 MediaTek Inc. -* -* All rights reserved. Copying, compilation, modification, distribution -* or any other use whatsoever of this material is strictly prohibited -* except in accordance with a Software License Agreement with -* MediaTek Inc. -******************************************************************************** -*/ - -/******************************************************************************* -* LEGAL DISCLAIMER -* -* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND -* AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK -* SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE -* PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY -* DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT -* LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -* PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE -* ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY -* WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK -* SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY -* WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE -* FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO -* CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. -* -* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE -* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL -* BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT -* ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY -* BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. -* -* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE -* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT -* OF LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING -* THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN -* FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE -* (ICC). -******************************************************************************** -*/ - -/* -** $Log: gl_cfg80211.c $ -** -** 08 29 2012 chinglan.wang -** [ALPS00349655] [Need Patch] [Volunteer Patch] [ALPS.JB] Daily build warning on [mt6575_phone_mhl-eng] -** . - * -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_os.h" -#include "debug.h" -#include "wlan_lib.h" -#include "gl_wext.h" -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -#if CFG_SUPPORT_WAPI - extern UINT_8 keyStructBuf[1024]; /* add/remove key shared buffer */ -#else - extern UINT_8 keyStructBuf[100]; /* add/remove key shared buffer */ -#endif - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#if RSSI_ENHANCE - -#define RSSI_DEG(x...) //printk(x) - -#define RSSI_ENHANCE_VALUE (10) -#define MAX_COUNT_OF_RSSI_HISTORY (8) -typedef struct _RSSI_HISTORY_T -{ - int counts; - int history[MAX_COUNT_OF_RSSI_HISTORY]; -} RSSI_HISTORY_T, *P_RSSI_HISTORY_T; - -RSSI_HISTORY_T gRssiHistory; - -extern void initScanRssiHistory(void); -void initRssiHistory(void) -{ - printk("initRssiHistory.\n"); - memset(&gRssiHistory, 0, sizeof(RSSI_HISTORY_T)); -} - -int processRssiHistory(int newRssi) -{ - int rstRssi, i, total = 0; - int index = gRssiHistory.counts; - int *history = &gRssiHistory.history[0]; - - RSSI_DEG("---- newRssi = %d\n", newRssi); - - if(index != 0) { - if(abs(newRssi-history[index-1]) >= 10) { // rssi change too much, discard history rssi - index = 0; - } - } - - // save new rssi - if(index >= MAX_COUNT_OF_RSSI_HISTORY) { - memmove(&history[0], &history[1], (MAX_COUNT_OF_RSSI_HISTORY-1)*sizeof(int)); - history[MAX_COUNT_OF_RSSI_HISTORY-1] = newRssi; - } else { - history[index++] = newRssi; - } - gRssiHistory.counts = index; - - // calc result rssi - for(i = 0; i < index; i++) { - RSSI_DEG("%d, ", history[i]); - total += history[i]; - } - RSSI_DEG("\n"); - - rstRssi = total/gRssiHistory.counts; - rstRssi += RSSI_ENHANCE_VALUE; - RSSI_DEG("---- rstRssi = %d\n", rstRssi); - - if(rstRssi > -10) - rstRssi = -10; - - return rstRssi; -} - -#endif - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for change STA type between - * 1. Infrastructure Client (Non-AP STA) - * 2. Ad-Hoc IBSS - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_change_iface ( - struct wiphy *wiphy, - struct net_device *ndev, - enum nl80211_iftype type, - u32 *flags, - struct vif_params *params - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - ENUM_PARAM_OP_MODE_T eOpMode; - UINT_32 u4BufLen; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - - if(type == NL80211_IFTYPE_STATION) { - eOpMode = NET_TYPE_INFRA; - } - else if(type == NL80211_IFTYPE_ADHOC) { - eOpMode = NET_TYPE_IBSS; - } - else { - return -EINVAL; - } - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetInfrastructureMode, - &eOpMode, - sizeof(eOpMode), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, WARN, ("set infrastructure mode error:%lx\n", rStatus)); - } - - /* reset wpa info */ - prGlueInfo->rWpaInfo.u4WpaVersion = IW_AUTH_WPA_VERSION_DISABLED; - prGlueInfo->rWpaInfo.u4KeyMgmt = 0; - prGlueInfo->rWpaInfo.u4CipherGroup = IW_AUTH_CIPHER_NONE; - prGlueInfo->rWpaInfo.u4CipherPairwise = IW_AUTH_CIPHER_NONE; - prGlueInfo->rWpaInfo.u4AuthAlg = IW_AUTH_ALG_OPEN_SYSTEM; -#if CFG_SUPPORT_802_11W - prGlueInfo->rWpaInfo.u4Mfp = IW_AUTH_MFP_DISABLED; -#endif - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for adding key - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_add_key ( - struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, - bool pairwise, - const u8 *mac_addr, - struct key_params *params - ) -{ - PARAM_KEY_T rKey; - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - INT_32 i4Rslt = -EINVAL; - UINT_32 u4BufLen = 0; - UINT_8 tmp1[8]; - UINT_8 tmp2[8]; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - - kalMemZero(&rKey, sizeof(PARAM_KEY_T)); - - rKey.u4KeyIndex = key_index; - - if(mac_addr) { - COPY_MAC_ADDR(rKey.arBSSID, mac_addr); - if ((rKey.arBSSID[0] == 0x00) && (rKey.arBSSID[1] == 0x00) && (rKey.arBSSID[2] == 0x00) && - (rKey.arBSSID[3] == 0x00) && (rKey.arBSSID[4] == 0x00) && (rKey.arBSSID[5] == 0x00)) { - rKey.arBSSID[0] = 0xff; - rKey.arBSSID[1] = 0xff; - rKey.arBSSID[2] = 0xff; - rKey.arBSSID[3] = 0xff; - rKey.arBSSID[4] = 0xff; - rKey.arBSSID[5] = 0xff; - } - if (rKey.arBSSID[0] != 0xFF) { - rKey.u4KeyIndex |= BIT(31); - if ((rKey.arBSSID[0] != 0x00) || (rKey.arBSSID[1] != 0x00) || (rKey.arBSSID[2] != 0x00) || - (rKey.arBSSID[3] != 0x00) || (rKey.arBSSID[4] != 0x00) || (rKey.arBSSID[5] != 0x00)) - rKey.u4KeyIndex |= BIT(30); - } - } - else { - rKey.arBSSID[0] = 0xff; - rKey.arBSSID[1] = 0xff; - rKey.arBSSID[2] = 0xff; - rKey.arBSSID[3] = 0xff; - rKey.arBSSID[4] = 0xff; - rKey.arBSSID[5] = 0xff; - //rKey.u4KeyIndex |= BIT(31); //Enable BIT 31 will make tx use bc key id, should use pairwise key id 0 - } - - if(params->key) { - //rKey.aucKeyMaterial[0] = kalMemAlloc(params->key_len, VIR_MEM_TYPE); - kalMemCopy(rKey.aucKeyMaterial, params->key, params->key_len); - if (params->key_len == 32) { - kalMemCopy(tmp1, ¶ms->key[16], 8); - kalMemCopy(tmp2, ¶ms->key[24], 8); - kalMemCopy(&rKey.aucKeyMaterial[16], tmp2, 8); - kalMemCopy(&rKey.aucKeyMaterial[24], tmp1, 8); - } - } - - rKey.u4KeyLength = params->key_len; - rKey.u4Length = ((UINT_32)&(((P_P2P_PARAM_KEY_T)0)->aucKeyMaterial)) + rKey.u4KeyLength; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetAddKey, - &rKey, - rKey.u4Length, - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus == WLAN_STATUS_SUCCESS) - i4Rslt = 0; - - return i4Rslt; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for getting key for specified STA - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_get_key ( - struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, - bool pairwise, - const u8 *mac_addr, - void *cookie, - void (*callback)(void *cookie, struct key_params*) - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - -#if 1 - printk("--> %s()\n", __func__); -#endif - - /* not implemented */ - - return -EINVAL; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for removing key for specified STA - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_del_key ( - struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, - bool pairwise, - const u8 *mac_addr - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - PARAM_REMOVE_KEY_T rRemoveKey; - UINT_32 u4BufLen = 0; - INT_32 i4Rslt = -EINVAL; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - - kalMemZero(&rRemoveKey, sizeof(PARAM_REMOVE_KEY_T)); - if(mac_addr) - COPY_MAC_ADDR(rRemoveKey.arBSSID, mac_addr); - rRemoveKey.u4KeyIndex = key_index; - rRemoveKey.u4Length = sizeof(PARAM_REMOVE_KEY_T); - - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetRemoveKey, - &rRemoveKey, - rRemoveKey.u4Length, - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, WARN, ("remove key error:%lx\n", rStatus)); - } - else { - i4Rslt = 0; - } - - return i4Rslt; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for setting default key on an interface - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_set_default_key ( - struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, - bool unicast, - bool multicast - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - -#if 1 - printk("--> %s()\n", __func__); -#endif - - /* not implemented */ - - return -EINVAL; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for getting station information such as RSSI - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ - -int -mtk_cfg80211_get_station ( - struct wiphy *wiphy, - struct net_device *ndev, - u8 *mac, - struct station_info *sinfo - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus; - PARAM_MAC_ADDRESS arBssid; - UINT_32 u4BufLen, u4Rate; - INT_32 i4Rssi; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - - kalMemZero(arBssid, MAC_ADDR_LEN); - wlanQueryInformation(prGlueInfo->prAdapter, - wlanoidQueryBssid, - &arBssid[0], - sizeof(arBssid), - &u4BufLen); - - /* 1. check BSSID */ - if(UNEQUAL_MAC_ADDR(arBssid, mac)) { - /* wrong MAC address */ - DBGLOG(REQ, WARN, ("incorrect BSSID: ["MACSTR"] currently connected BSSID["MACSTR"]\n", - MAC2STR(mac), MAC2STR(arBssid))); - return -ENOENT; - } - - /* 2. fill TX rate */ - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryLinkSpeed, - &u4Rate, - sizeof(u4Rate), - TRUE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, WARN, ("unable to retrieve link speed\n")); - } - else { - sinfo->filled |= STATION_INFO_TX_BITRATE; - sinfo->txrate.legacy = u4Rate / 1000; /* convert from 100bps to 100kbps */ - } - - if(prGlueInfo->eParamMediaStateIndicated != PARAM_MEDIA_STATE_CONNECTED) { - /* not connected */ - DBGLOG(REQ, WARN, ("not yet connected\n")); - } - else { - /* 3. fill RSSI */ - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryRssi, - &i4Rssi, - sizeof(i4Rssi), - TRUE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, WARN, ("unable to retrieve link speed\n")); - } - else { - #if RSSI_ENHANCE - i4Rssi = processRssiHistory(i4Rssi); - #endif - sinfo->filled |= STATION_INFO_SIGNAL; - sinfo->signal = i4Rssi; /* dBm */ - } - } - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for requesting to do a scan - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_scan ( - struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_scan_request *request - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus; - UINT_32 u4BufLen; - PARAM_SCAN_REQUEST_EXT_T rScanRequest; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - - kalMemZero(&rScanRequest, sizeof(PARAM_SCAN_REQUEST_EXT_T)); - - /* check if there is any pending scan not yet finished */ - if(prGlueInfo->prScanRequest != NULL) { - return -EBUSY; - } - - if(request->n_ssids == 0) { - rScanRequest.rSsid.u4SsidLen = 0; - } - else if(request->n_ssids == 1) { - COPY_SSID(rScanRequest.rSsid.aucSsid, rScanRequest.rSsid.u4SsidLen, request->ssids[0].ssid, request->ssids[0].ssid_len); - } - else { - return -EINVAL; - } - - if(request->ie_len > 0) { - rScanRequest.u4IELength = request->ie_len; - rScanRequest.pucIE = (PUINT_8)(request->ie); - } - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetBssidListScanExt, - &rScanRequest, - sizeof(PARAM_SCAN_REQUEST_EXT_T), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, WARN, ("scan error:%lx\n", rStatus)); - return -EINVAL; - } - - prGlueInfo->prScanRequest = request; - - return 0; -} - -static UINT_8 wepBuf[48]; - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for requesting to connect to - * the ESS with the specified parameters - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_connect ( - struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_connect_params *sme - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus; - UINT_32 u4BufLen; - ENUM_PARAM_ENCRYPTION_STATUS_T eEncStatus; - ENUM_PARAM_AUTH_MODE_T eAuthMode; - UINT_32 cipher; - PARAM_SSID_T rNewSsid; - BOOLEAN fgCarryWPSIE = FALSE; - ENUM_PARAM_OP_MODE_T eOpMode; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - -#if RSSI_ENHANCE - initRssiHistory(); -#endif - - if (prGlueInfo->prAdapter->rWifiVar.rConnSettings.eOPMode > NET_TYPE_AUTO_SWITCH) - eOpMode = NET_TYPE_AUTO_SWITCH; - else - eOpMode = prGlueInfo->prAdapter->rWifiVar.rConnSettings.eOPMode; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetInfrastructureMode, - &eOpMode, - sizeof(eOpMode), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("wlanoidSetInfrastructureMode fail 0x%lx\n", rStatus)); - return -EFAULT; - } - - /* after set operation mode, key table are cleared */ - - /* reset wpa info */ - prGlueInfo->rWpaInfo.u4WpaVersion = IW_AUTH_WPA_VERSION_DISABLED; - prGlueInfo->rWpaInfo.u4KeyMgmt = 0; - prGlueInfo->rWpaInfo.u4CipherGroup = IW_AUTH_CIPHER_NONE; - prGlueInfo->rWpaInfo.u4CipherPairwise = IW_AUTH_CIPHER_NONE; - prGlueInfo->rWpaInfo.u4AuthAlg = IW_AUTH_ALG_OPEN_SYSTEM; -#if CFG_SUPPORT_802_11W - prGlueInfo->rWpaInfo.u4Mfp = IW_AUTH_MFP_DISABLED; -#endif - - if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) - prGlueInfo->rWpaInfo.u4WpaVersion = IW_AUTH_WPA_VERSION_WPA; - else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) - prGlueInfo->rWpaInfo.u4WpaVersion = IW_AUTH_WPA_VERSION_WPA2; - else - prGlueInfo->rWpaInfo.u4WpaVersion = IW_AUTH_WPA_VERSION_DISABLED; - - switch (sme->auth_type) { - case NL80211_AUTHTYPE_OPEN_SYSTEM: - prGlueInfo->rWpaInfo.u4AuthAlg = IW_AUTH_ALG_OPEN_SYSTEM; - break; - case NL80211_AUTHTYPE_SHARED_KEY: - prGlueInfo->rWpaInfo.u4AuthAlg = IW_AUTH_ALG_SHARED_KEY; - break; - default: - prGlueInfo->rWpaInfo.u4AuthAlg = IW_AUTH_ALG_OPEN_SYSTEM | IW_AUTH_ALG_SHARED_KEY; - break; - } - - if (sme->crypto.n_ciphers_pairwise) { - switch (sme->crypto.ciphers_pairwise[0]) { - case WLAN_CIPHER_SUITE_WEP40: - prGlueInfo->rWpaInfo.u4CipherPairwise = IW_AUTH_CIPHER_WEP40; - break; - case WLAN_CIPHER_SUITE_WEP104: - prGlueInfo->rWpaInfo.u4CipherPairwise = IW_AUTH_CIPHER_WEP104; - break; - case WLAN_CIPHER_SUITE_TKIP: - prGlueInfo->rWpaInfo.u4CipherPairwise = IW_AUTH_CIPHER_TKIP; - break; - case WLAN_CIPHER_SUITE_CCMP: - prGlueInfo->rWpaInfo.u4CipherPairwise = IW_AUTH_CIPHER_CCMP; - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - prGlueInfo->rWpaInfo.u4CipherPairwise = IW_AUTH_CIPHER_CCMP; - break; - default: - DBGLOG(REQ, WARN, ("invalid cipher pairwise (%d)\n", - sme->crypto.ciphers_pairwise[0])); - return -EINVAL; - } - } - - if (sme->crypto.cipher_group) { - switch (sme->crypto.cipher_group) { - case WLAN_CIPHER_SUITE_WEP40: - prGlueInfo->rWpaInfo.u4CipherGroup = IW_AUTH_CIPHER_WEP40; - break; - case WLAN_CIPHER_SUITE_WEP104: - prGlueInfo->rWpaInfo.u4CipherGroup = IW_AUTH_CIPHER_WEP104; - break; - case WLAN_CIPHER_SUITE_TKIP: - prGlueInfo->rWpaInfo.u4CipherGroup = IW_AUTH_CIPHER_TKIP; - break; - case WLAN_CIPHER_SUITE_CCMP: - prGlueInfo->rWpaInfo.u4CipherGroup = IW_AUTH_CIPHER_CCMP; - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - prGlueInfo->rWpaInfo.u4CipherGroup = IW_AUTH_CIPHER_CCMP; - break; - default: - DBGLOG(REQ, WARN, ("invalid cipher group (%d)\n", - sme->crypto.cipher_group)); - return -EINVAL; - } - } - - if (sme->crypto.n_akm_suites) { - if (prGlueInfo->rWpaInfo.u4WpaVersion == IW_AUTH_WPA_VERSION_WPA) { - switch (sme->crypto.akm_suites[0]) { - case WLAN_AKM_SUITE_8021X: - eAuthMode = AUTH_MODE_WPA; - break; - case WLAN_AKM_SUITE_PSK: - eAuthMode = AUTH_MODE_WPA_PSK; - break; - default: - DBGLOG(REQ, WARN, ("invalid cipher group (%d)\n", - sme->crypto.cipher_group)); - return -EINVAL; - } - } else if (prGlueInfo->rWpaInfo.u4WpaVersion == IW_AUTH_WPA_VERSION_WPA2) { - switch (sme->crypto.akm_suites[0]) { - case WLAN_AKM_SUITE_8021X: - eAuthMode = AUTH_MODE_WPA2; - break; - case WLAN_AKM_SUITE_PSK: - eAuthMode = AUTH_MODE_WPA2_PSK; - break; - default: - DBGLOG(REQ, WARN, ("invalid cipher group (%d)\n", - sme->crypto.cipher_group)); - return -EINVAL; - } - } - } - - if (prGlueInfo->rWpaInfo.u4WpaVersion == IW_AUTH_WPA_VERSION_DISABLED) { - eAuthMode = (prGlueInfo->rWpaInfo.u4AuthAlg == IW_AUTH_ALG_OPEN_SYSTEM) ? - AUTH_MODE_OPEN : AUTH_MODE_AUTO_SWITCH; - } - - prGlueInfo->rWpaInfo.fgPrivacyInvoke = sme->privacy; - - //prGlueInfo->prAdapter->rWifiVar.rConnSettings.fgWapiMode = FALSE; - //prGlueInfo->prAdapter->prGlueInfo->u2WapiAssocInfoIESz = 0; - prGlueInfo->fgWpsActive = FALSE; - //prGlueInfo->prAdapter->prGlueInfo->u2WSCAssocInfoIELen = 0; - - if (sme->ie && sme->ie_len > 0) { - WLAN_STATUS rStatus; - UINT_32 u4BufLen; - PUINT_8 prDesiredIE = NULL; - -#if CFG_SUPPORT_WAPI - rStatus = kalIoctl(prGlueInfo, - wlanoidSetWapiAssocInfo, - sme->ie, - sme->ie_len, - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(SEC, WARN, ("[wapi] set wapi assoc info error:%lx\n", rStatus)); - } -#endif -#if CFG_SUPPORT_WPS2 - if (wextSrchDesiredWPSIE(sme->ie, - sme->ie_len, - 0xDD, - (PUINT_8 *)&prDesiredIE)) { - prGlueInfo->fgWpsActive = TRUE; - fgCarryWPSIE = TRUE; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetWSCAssocInfo, - prDesiredIE, - IE_SIZE(prDesiredIE), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(SEC, WARN, ("WSC] set WSC assoc info error:%lx\n", rStatus)); - } - } -#endif - } - - /* clear WSC Assoc IE buffer in case WPS IE is not detected */ - if(fgCarryWPSIE == FALSE) { - kalMemZero(&prGlueInfo->aucWSCAssocInfoIE, 200); - prGlueInfo->u2WSCAssocInfoIELen = 0; - } - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetAuthMode, - &eAuthMode, - sizeof(eAuthMode), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, WARN, ("set auth mode error:%lx\n", rStatus)); - } - - cipher = prGlueInfo->rWpaInfo.u4CipherGroup | prGlueInfo->rWpaInfo.u4CipherPairwise; - - if (prGlueInfo->rWpaInfo.fgPrivacyInvoke) { - if (cipher & IW_AUTH_CIPHER_CCMP) { - eEncStatus = ENUM_ENCRYPTION3_ENABLED; - } - else if (cipher & IW_AUTH_CIPHER_TKIP) { - eEncStatus = ENUM_ENCRYPTION2_ENABLED; - } - else if (cipher & (IW_AUTH_CIPHER_WEP104 | IW_AUTH_CIPHER_WEP40)) { - eEncStatus = ENUM_ENCRYPTION1_ENABLED; - } - else if (cipher & IW_AUTH_CIPHER_NONE){ - if (prGlueInfo->rWpaInfo.fgPrivacyInvoke) - eEncStatus = ENUM_ENCRYPTION1_ENABLED; - else - eEncStatus = ENUM_ENCRYPTION_DISABLED; - } - else { - eEncStatus = ENUM_ENCRYPTION_DISABLED; - } - } - else { - eEncStatus = ENUM_ENCRYPTION_DISABLED; - } - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetEncryptionStatus, - &eEncStatus, - sizeof(eEncStatus), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, WARN, ("set encryption mode error:%lx\n", rStatus)); - } - - if (sme->key_len != 0 && prGlueInfo->rWpaInfo.u4WpaVersion == IW_AUTH_WPA_VERSION_DISABLED) { - P_PARAM_WEP_T prWepKey = (P_PARAM_WEP_T) wepBuf; - - kalMemSet(prWepKey, 0, sizeof(prWepKey)); - prWepKey->u4Length = 12 + sme->key_len; - prWepKey->u4KeyLength = (UINT_32) sme->key_len; - prWepKey->u4KeyIndex = (UINT_32) sme->key_idx; - prWepKey->u4KeyIndex |= BIT(31); - if (prWepKey->u4KeyLength > 32) { - DBGLOG(REQ, WARN, ("Too long key length (%u)\n", prWepKey->u4KeyLength)); - return -EINVAL; - } - kalMemCopy(prWepKey->aucKeyMaterial, sme->key, prWepKey->u4KeyLength); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetAddWep, - prWepKey, - prWepKey->u4Length, - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("wlanoidSetAddWep fail 0x%lx\n", rStatus)); - return -EFAULT; - } - } - - if(sme->ssid_len > 0) { - /* connect by SSID */ - COPY_SSID(rNewSsid.aucSsid, rNewSsid.u4SsidLen, sme->ssid, sme->ssid_len); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetSsid, - (PVOID) &rNewSsid, - sizeof(PARAM_SSID_T), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, WARN, ("set SSID:%lx\n", rStatus)); - return -EINVAL; - } - } - else { - /* connect by BSSID */ - rStatus = kalIoctl(prGlueInfo, - wlanoidSetBssid, - (PVOID) sme->bssid, - sizeof(MAC_ADDR_LEN), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, WARN, ("set BSSID:%lx\n", rStatus)); - return -EINVAL; - } - } - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for requesting to disconnect from - * currently connected ESS - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_disconnect ( - struct wiphy *wiphy, - struct net_device *ndev, - u16 reason_code - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus; - UINT_32 u4BufLen; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - -#if RSSI_ENHANCE - initRssiHistory(); - initScanRssiHistory(); -#endif - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetDisassociate, - NULL, - 0, - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, WARN, ("disassociate error:%lx\n", rStatus)); - return -EFAULT; - } - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for requesting to join an IBSS group - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_join_ibss ( - struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_ibss_params *params - ) -{ - PARAM_SSID_T rNewSsid; - P_GLUE_INFO_T prGlueInfo = NULL; - UINT_32 u4ChnlFreq; /* Store channel or frequency information */ - UINT_32 u4BufLen = 0; - WLAN_STATUS rStatus; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - - /* set channel */ - if(params->channel) { - u4ChnlFreq = nicChannelNum2Freq(params->channel->hw_value); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetFrequency, - &u4ChnlFreq, - sizeof(u4ChnlFreq), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - } - - /* set SSID */ - kalMemCopy(rNewSsid.aucSsid, params->ssid, params->ssid_len); - rStatus = kalIoctl(prGlueInfo, - wlanoidSetSsid, - (PVOID) &rNewSsid, - sizeof(PARAM_SSID_T), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, WARN, ("set SSID:%lx\n", rStatus)); - return -EFAULT; - } - - return 0; - - - return -EINVAL; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for requesting to leave from IBSS group - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_leave_ibss ( - struct wiphy *wiphy, - struct net_device *ndev - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus; - UINT_32 u4BufLen; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetDisassociate, - NULL, - 0, - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, WARN, ("disassociate error:%lx\n", rStatus)); - return -EFAULT; - } - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for requesting to configure - * WLAN power managemenet - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_set_power_mgmt ( - struct wiphy *wiphy, - struct net_device *ndev, - bool enabled, - int timeout - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus; - UINT_32 u4BufLen; - PARAM_POWER_MODE ePowerMode; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - - if(enabled) { - if(timeout == -1) { - ePowerMode = Param_PowerModeFast_PSP; - } - else { - ePowerMode = Param_PowerModeMAX_PSP; - } - } - else { - ePowerMode = Param_PowerModeCAM; - } - - rStatus = kalIoctl(prGlueInfo, - wlanoidSet802dot11PowerSaveProfile, - &ePowerMode, - sizeof(ePowerMode), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, WARN, ("set_power_mgmt error:%lx\n", rStatus)); - return -EFAULT; - } - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for requesting to cache - * a PMKID for a BSSID - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_set_pmksa ( - struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_pmksa *pmksa - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus; - UINT_32 u4BufLen; - P_PARAM_PMKID_T prPmkid; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - - prPmkid =(P_PARAM_PMKID_T)kalMemAlloc(8 + sizeof(PARAM_BSSID_INFO_T), VIR_MEM_TYPE); - if (!prPmkid) { - DBGLOG(INIT, INFO, ("Can not alloc memory for IW_PMKSA_ADD\n")); - return -ENOMEM; - } - - prPmkid->u4Length = 8 + sizeof(PARAM_BSSID_INFO_T); - prPmkid->u4BSSIDInfoCount = 1; - kalMemCopy(prPmkid->arBSSIDInfo->arBSSID, pmksa->bssid, 6); - kalMemCopy(prPmkid->arBSSIDInfo->arPMKID, pmksa->pmkid, IW_PMKID_LEN); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetPmkid, - prPmkid, - sizeof(PARAM_PMKID_T), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("add pmkid error:%lx\n", rStatus)); - } - kalMemFree(prPmkid, VIR_MEM_TYPE, 8 + sizeof(PARAM_BSSID_INFO_T)); - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for requesting to remove - * a cached PMKID for a BSSID - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_del_pmksa ( - struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_pmksa *pmksa - ) -{ - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for requesting to flush - * all cached PMKID - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_flush_pmksa ( - struct wiphy *wiphy, - struct net_device *ndev - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus; - UINT_32 u4BufLen; - P_PARAM_PMKID_T prPmkid; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - - prPmkid =(P_PARAM_PMKID_T)kalMemAlloc(8, VIR_MEM_TYPE); - if (!prPmkid) { - DBGLOG(INIT, INFO, ("Can not alloc memory for IW_PMKSA_FLUSH\n")); - return -ENOMEM; - } - - prPmkid->u4Length = 8; - prPmkid->u4BSSIDInfoCount = 0; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetPmkid, - prPmkid, - sizeof(PARAM_PMKID_T), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("flush pmkid error:%lx\n", rStatus)); - } - kalMemFree(prPmkid, VIR_MEM_TYPE, 8); - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for requesting to stay on a - * specified channel - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_remain_on_channel ( - struct wiphy *wiphy, - struct net_device *ndev, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - unsigned int duration, - u64 *cookie - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - -#if 1 - printk("--> %s()\n", __func__); -#endif - - /* not implemented */ - - return -EINVAL; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for requesting to cancel staying - * on a specified channel - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_cancel_remain_on_channel ( - struct wiphy *wiphy, - struct net_device *ndev, - u64 cookie - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - -#if 1 - printk("--> %s()\n", __func__); -#endif - - /* not implemented */ - - return -EINVAL; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for requesting to send a management frame - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_mgmt_tx ( - struct wiphy *wiphy, - struct net_device *ndev, - struct ieee80211_channel *channel, - bool offscan, - enum nl80211_channel_type channel_type, - bool channel_type_valid, - unsigned int wait, - const u8 *buf, - size_t len, - bool no_cck, - bool dont_wait_for_ack, - u64 *cookie - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - -#if 1 - printk("--> %s()\n", __func__); -#endif - - /* not implemented */ - - return -EINVAL; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for requesting to cancel the wait time - * from transmitting a management frame on another channel - * - * @param - * - * @retval 0: successful - * others: failure - */ -/*----------------------------------------------------------------------------*/ -int -mtk_cfg80211_mgmt_tx_cancel_wait ( - struct wiphy *wiphy, - struct net_device *ndev, - u64 cookie - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - ASSERT(prGlueInfo); - -#if 1 - printk("--> %s()\n", __func__); -#endif - - /* not implemented */ - - return -EINVAL; -} - - -#if CONFIG_NL80211_TESTMODE - -#if CFG_SUPPORT_WAPI -int -mtk_cfg80211_testmode_set_key_ext( - IN struct wiphy *wiphy, - IN void *data, - IN int len) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - P_NL80211_DRIVER_SET_KEY_EXTS prParams = (P_NL80211_DRIVER_SET_KEY_EXTS)NULL; - struct iw_encode_exts *prIWEncExt = (struct iw_encode_exts *)NULL; - WLAN_STATUS rstatus = WLAN_STATUS_SUCCESS; - int fgIsValid = 0; - UINT_32 u4BufLen = 0; - - P_PARAM_WPI_KEY_T prWpiKey = (P_PARAM_WPI_KEY_T) keyStructBuf; - memset(keyStructBuf, 0, sizeof(keyStructBuf)); - - ASSERT(wiphy); - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); -#if 1 - printk("--> %s()\n", __func__); -#endif - - if(data && len) { - prParams = (P_NL80211_DRIVER_SET_KEY_EXTS)data; - } - - if(prParams) { - prIWEncExt = (struct iw_encode_exts *) &prParams->ext; - } - - if (prIWEncExt->alg == IW_ENCODE_ALG_SMS4) { - /* KeyID */ - prWpiKey->ucKeyID = prParams->key_index; - prWpiKey->ucKeyID --; - if (prWpiKey->ucKeyID > 1) { - /* key id is out of range */ - //printk(KERN_INFO "[wapi] add key error: key_id invalid %d\n", prWpiKey->ucKeyID); - return -EINVAL; - } - - if (prIWEncExt->key_len != 32) { - /* key length not valid */ - //printk(KERN_INFO "[wapi] add key error: key_len invalid %d\n", prIWEncExt->key_len); - return -EINVAL; - } - - //printk(KERN_INFO "[wapi] %d ext_flags %d\n", prEnc->flags, prIWEncExt->ext_flags); - - if (prIWEncExt->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - prWpiKey->eKeyType = ENUM_WPI_GROUP_KEY; - prWpiKey->eDirection = ENUM_WPI_RX; - } - else if (prIWEncExt->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - prWpiKey->eKeyType = ENUM_WPI_PAIRWISE_KEY; - prWpiKey->eDirection = ENUM_WPI_RX_TX; - } - -//#if CFG_SUPPORT_WAPI - //handle_sec_msg_final(prIWEncExt->key, 32, prIWEncExt->key, NULL); -//#endif - /* PN */ - memcpy(prWpiKey->aucPN, prIWEncExt->tx_seq, IW_ENCODE_SEQ_MAX_SIZE * 2); - - /* BSSID */ - memcpy(prWpiKey->aucAddrIndex, prIWEncExt->addr, 6); - - memcpy(prWpiKey->aucWPIEK, prIWEncExt->key, 16); - prWpiKey->u4LenWPIEK = 16; - - memcpy(prWpiKey->aucWPICK, &prIWEncExt->key[16], 16); - prWpiKey->u4LenWPICK = 16; - - rstatus = kalIoctl(prGlueInfo, - wlanoidSetWapiKey, - prWpiKey, - sizeof(PARAM_WPI_KEY_T), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rstatus != WLAN_STATUS_SUCCESS) { - //printk(KERN_INFO "[wapi] add key error:%lx\n", rStatus); - fgIsValid = -EFAULT; - } - - } - return fgIsValid; -} -#endif - - -int -mtk_cfg80211_testmode_sw_cmd( - IN struct wiphy *wiphy, - IN void *data, - IN int len) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - P_NL80211_DRIVER_SW_CMD_PARAMS prParams = (P_NL80211_DRIVER_SW_CMD_PARAMS)NULL; - WLAN_STATUS rstatus = WLAN_STATUS_SUCCESS; - int fgIsValid = 0; - UINT_32 u4SetInfoLen = 0; - - ASSERT(wiphy); - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - -#if 1 - printk("--> %s()\n", __func__); -#endif - - if(data && len) - prParams = (P_NL80211_DRIVER_SW_CMD_PARAMS)data; - - if(prParams) { - if(prParams->set == 1){ - rstatus = kalIoctl(prGlueInfo, - (PFN_OID_HANDLER_FUNC)wlanoidSetSwCtrlWrite, - &prParams->adr, - (UINT_32)8, - FALSE, - FALSE, - TRUE, - FALSE, - &u4SetInfoLen); - } - } - - if (WLAN_STATUS_SUCCESS != rstatus) { - fgIsValid = -EFAULT; - } - - return fgIsValid; -} - -int mtk_cfg80211_testmode_cmd( - IN struct wiphy *wiphy, - IN void *data, - IN int len - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - P_NL80211_DRIVER_TEST_MODE_PARAMS prParams = (P_NL80211_DRIVER_TEST_MODE_PARAMS)NULL; - BOOLEAN fgIsValid = 0; - - ASSERT(wiphy); - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(wiphy); - -#if 1 - printk("--> %s()\n", __func__); -#endif - - if(data && len) - prParams = (P_NL80211_DRIVER_TEST_MODE_PARAMS)data; - - /* Clear the version byte */ - prParams->index = prParams->index & ~ BITS(24,31); - - if(prParams){ - switch(prParams->index){ - case 1: /* SW cmd */ - if(mtk_cfg80211_testmode_sw_cmd(wiphy, data, len)) - fgIsValid = TRUE; - break; - case 2: /* WAPI */ -#if CFG_SUPPORT_WAPI - if(mtk_cfg80211_testmode_set_key_ext(wiphy, data, len)) - fgIsValid = TRUE; -#endif - break; - default: - fgIsValid = TRUE; - break; - } - } - - - return fgIsValid; -} -#endif - diff --git a/drivers/net/wireless/mt5931/os/linux/gl_init.c b/drivers/net/wireless/mt5931/os/linux/gl_init.c deleted file mode 100755 index d7a817fbae13..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/gl_init.c +++ /dev/null @@ -1,3399 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/gl_init.c#7 $ -*/ - -/*! \file gl_init.c - \brief Main routines of Linux driver - - This file contains the main routines of Linux driver for MediaTek Inc. 802.11 - Wireless LAN Adapters. -*/ - - - -/* -** $Log: gl_init.c $ - * - * 07 17 2012 yuche.tsai - * NULL - * Fix compile error. - * - * 07 17 2012 yuche.tsai - * NULL - * Fix compile error for JB. - * - * 07 17 2012 yuche.tsai - * NULL - * Let netdev bring up. - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 06 13 2012 yuche.tsai - * NULL - * Update maintrunk driver. - * Add support for driver compose assoc request frame. - * - * 05 25 2012 yuche.tsai - * NULL - * Fix reset KE issue. - * - * 05 11 2012 cp.wu - * [WCXRP00001237] [MT6620 Wi-Fi][Driver] Show MAC address and MAC address source for ACS's convenience - * show MAC address & source while initiliazation - * - * 03 02 2012 terry.wu - * NULL - * EXPORT_SYMBOL(rsnParseCheckForWFAInfoElem);. - * - * 03 02 2012 terry.wu - * NULL - * Snc CFG80211 modification for ICS migration from branch 2.2. - * - * 03 02 2012 terry.wu - * NULL - * Sync CFG80211 modification from branch 2,2. - * - * 03 02 2012 terry.wu - * NULL - * Enable CFG80211 Support. - * - * 12 22 2011 george.huang - * [WCXRP00000905] [MT6628 Wi-Fi][FW] Code refinement for ROM/ RAM module dependency - * using global variable instead of stack for setting wlanoidSetNetworkAddress(), due to buffer may be released before TX thread handling - * - * 11 18 2011 yuche.tsai - * NULL - * CONFIG P2P support RSSI query, default turned off. - * - * 11 14 2011 yuche.tsai - * [WCXRP00001107] [Volunteer Patch][Driver] Large Network Type index assert in FW issue. - * Fix large network type index assert in FW issue. - * - * 11 14 2011 cm.chang - * NULL - * Fix compiling warning - * - * 11 11 2011 yuche.tsai - * NULL - * Fix work thread cancel issue. - * - * 11 10 2011 cp.wu - * [WCXRP00001098] [MT6620 Wi-Fi][Driver] Replace printk by DBG LOG macros in linux porting layer - * 1. eliminaite direct calls to printk in porting layer. - * 2. replaced by DBGLOG, which would be XLOG on ALPS platforms. - * - * 10 06 2011 eddie.chen - * [WCXRP00001027] [MT6628 Wi-Fi][Firmware/Driver] Tx fragmentation - * Add rlmDomainGetChnlList symbol. - * - * 09 22 2011 cm.chang - * NULL - * Safer writng stype to avoid unitialized regitry structure - * - * 09 21 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * Avoid possible structure alignment problem - * - * 09 20 2011 chinglan.wang - * [WCXRP00000989] [WiFi Direct] [Driver] Add a new io control API to start the formation for the sigma test. - * . - * - * 09 08 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * Use new fields ucChannelListMap and ucChannelListIndex in NVRAM - * - * 08 31 2011 cm.chang - * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code - * . - * - * 08 11 2011 cp.wu - * [WCXRP00000830] [MT6620 Wi-Fi][Firmware] Use MDRDY counter to detect empty channel for shortening scan time - * expose scnQuerySparseChannel() for P2P-FSM. - * - * 08 11 2011 cp.wu - * [WCXRP00000830] [MT6620 Wi-Fi][Firmware] Use MDRDY counter to detect empty channel for shortening scan time - * sparse channel detection: - * driver: collect sparse channel information with scan-done event - * - * 08 02 2011 yuche.tsai - * [WCXRP00000896] [Volunteer Patch][WiFi Direct][Driver] GO with multiple client, TX deauth to a disconnecting device issue. - * Fix GO send deauth frame issue. - * - * 07 07 2011 wh.su - * [WCXRP00000839] [MT6620 Wi-Fi][Driver] Add the dumpMemory8 and dumpMemory32 EXPORT_SYMBOL - * Add the dumpMemory8 symbol export for debug mode. - * - * 07 06 2011 terry.wu - * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment - * Improve BoW connection establishment speed. - * - * 07 05 2011 yuche.tsai - * [WCXRP00000821] [Volunteer Patch][WiFi Direct][Driver] WiFi Direct Connection Speed Issue - * Export one symbol for enhancement. - * - * 06 13 2011 eddie.chen - * [WCXRP00000779] [MT6620 Wi-Fi][DRV] Add tx rx statistics in linux and use netif_rx_ni - * Add tx rx statistics and netif_rx_ni. - * - * 05 27 2011 cp.wu - * [WCXRP00000749] [MT6620 Wi-Fi][Driver] Add band edge tx power control to Wi-Fi NVRAM - * invoke CMD_ID_SET_EDGE_TXPWR_LIMIT when there is valid data exist in NVRAM content. - * - * 05 18 2011 cp.wu - * [WCXRP00000734] [MT6620 Wi-Fi][Driver] Pass PHY_PARAM in NVRAM to firmware domain - * pass PHY_PARAM in NVRAM from driver to firmware. - * - * 05 09 2011 jeffrey.chang - * [WCXRP00000710] [MT6620 Wi-Fi] Support pattern filter update function on IP address change - * support ARP filter through kernel notifier - * - * 05 03 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Use kalMemAlloc to allocate event buffer for kalIndicateBOWEvent. - * - * 04 27 2011 george.huang - * [WCXRP00000684] [MT6620 Wi-Fi][Driver] Support P2P setting ARP filter - * Support P2P ARP filter setting on early suspend/ late resume - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 04 15 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add BOW short range mode. - * - * 04 14 2011 yuche.tsai - * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case. - * Modify some driver connection flow or behavior to pass Sigma test more easier.. - * - * 04 12 2011 cm.chang - * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency - * . - * - * 04 11 2011 george.huang - * [WCXRP00000621] [MT6620 Wi-Fi][Driver] Support P2P supplicant to set power mode - * export wlan functions to p2p - * - * 04 08 2011 pat.lu - * [WCXRP00000623] [MT6620 Wi-Fi][Driver] use ARCH define to distinguish PC Linux driver - * Use CONFIG_X86 instead of PC_LINUX_DRIVER_USE option to have proper compile settting for PC Linux driver - * - * 04 08 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * glBusFreeIrq() should use the same pvCookie as glBusSetIrq() or request_irq()/free_irq() won't work as a pair. - * - * 04 08 2011 eddie.chen - * [WCXRP00000617] [MT6620 Wi-Fi][DRV/FW] Fix for sigma - * Fix for sigma - * - * 04 06 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * 1. do not check for pvData inside wlanNetCreate() due to it is NULL for eHPI port - * 2. update perm_addr as well for MAC address - * 3. not calling check_mem_region() anymore for eHPI - * 4. correct MSC_CS macro for 0-based notation - * - * 03 29 2011 cp.wu - * [WCXRP00000598] [MT6620 Wi-Fi][Driver] Implementation of interface for communicating with user space process for RESET_START and RESET_END events - * fix typo. - * - * 03 29 2011 cp.wu - * [WCXRP00000598] [MT6620 Wi-Fi][Driver] Implementation of interface for communicating with user space process for RESET_START and RESET_END events - * implement kernel-to-userspace communication via generic netlink socket for whole-chip resetting mechanism - * - * 03 23 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * apply multi-queue operation only for linux kernel > 2.6.26 - * - * 03 22 2011 pat.lu - * [WCXRP00000592] [MT6620 Wi-Fi][Driver] Support PC Linux Environment Driver Build - * Add a compiler option "PC_LINUX_DRIVER_USE" for building driver in PC Linux environment. - * - * 03 21 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * portability for compatible with linux 2.6.12. - * - * 03 21 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * improve portability for awareness of early version of linux kernel and wireless extension. - * - * 03 21 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * portability improvement - * - * 03 18 2011 jeffrey.chang - * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue - * remove early suspend functions - * - * 03 17 2011 cp.wu - * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period - * reverse order to prevent probing racing. - * - * 03 16 2011 cp.wu - * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period - * 1. pre-allocate physical continuous buffer while module is being loaded - * 2. use pre-allocated physical continuous buffer for TX/RX DMA transfer - * - * The windows part remained the same as before, but added similiar APIs to hide the difference. - * - * 03 15 2011 jeffrey.chang - * [WCXRP00000558] [MT6620 Wi-Fi][MT6620 Wi-Fi][Driver] refine the queue selection algorithm for WMM - * refine the queue_select function - * - * 03 10 2011 cp.wu - * [WCXRP00000532] [MT6620 Wi-Fi][Driver] Migrate NVRAM configuration procedures from MT6620 E2 to MT6620 E3 - * deprecate configuration used by MT6620 E2 - * - * 03 10 2011 terry.wu - * [WCXRP00000505] [MT6620 Wi-Fi][Driver/FW] WiFi Direct Integration - * Remove unnecessary assert and message. - * - * 03 08 2011 terry.wu - * [WCXRP00000505] [MT6620 Wi-Fi][Driver/FW] WiFi Direct Integration - * Export nicQmUpdateWmmParms. - * - * 03 03 2011 jeffrey.chang - * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue - * support concurrent network - * - * 03 03 2011 jeffrey.chang - * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue - * modify net device relative functions to support multiple H/W queues - * - * 02 24 2011 george.huang - * [WCXRP00000495] [MT6620 Wi-Fi][FW] Support pattern filter for unwanted ARP frames - * Support ARP filter during suspended - * - * 02 21 2011 cp.wu - * [WCXRP00000482] [MT6620 Wi-Fi][Driver] Simplify logic for checking NVRAM existence in driver domain - * simplify logic for checking NVRAM existence only once. - * - * 02 17 2011 terry.wu - * [WCXRP00000459] [MT6620 Wi-Fi][Driver] Fix deference null pointer problem in wlanRemove - * Fix deference a null pointer problem in wlanRemove. - * - * 02 16 2011 jeffrey.chang - * NULL - * fix compilig error - * - * 02 16 2011 jeffrey.chang - * NULL - * Add query ipv4 and ipv6 address during early suspend and late resume - * - * 02 15 2011 jeffrey.chang - * NULL - * to support early suspend in android - * - * 02 11 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * Add one more export symbol. - * - * 02 10 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * Add RX deauthentication & disassociation process under Hot-Spot mode. - * - * 02 09 2011 terry.wu - * [WCXRP00000383] [MT6620 Wi-Fi][Driver] Separate WiFi and P2P driver into two modules - * Halt p2p module init and exit until TxThread finished p2p register and unregister. - * - * 02 08 2011 george.huang - * [WCXRP00000422] [MT6620 Wi-Fi][Driver] support query power mode OID handler - * Support querying power mode OID. - * - * 02 08 2011 yuche.tsai - * [WCXRP00000421] [Volunteer Patch][MT6620][Driver] Fix incorrect SSID length Issue - * Export Deactivation Network. - * - * 02 01 2011 jeffrey.chang - * [WCXRP00000414] KAL Timer is not unregistered when driver not loaded - * Unregister the KAL timer during driver unloading - * - * 01 26 2011 cm.chang - * [WCXRP00000395] [MT6620 Wi-Fi][Driver][FW] Search STA_REC with additional net type index argument - * Allocate system RAM if fixed message or mgmt buffer is not available - * - * 01 19 2011 cp.wu - * [WCXRP00000371] [MT6620 Wi-Fi][Driver] make linux glue layer portable for Android 2.3.1 with Linux 2.6.35.7 - * add compile option to check linux version 2.6.35 for different usage of system API to improve portability - * - * 01 12 2011 cp.wu - * [WCXRP00000357] [MT6620 Wi-Fi][Driver][Bluetooth over Wi-Fi] add another net device interface for BT AMP - * implementation of separate BT_OVER_WIFI data path. - * - * 01 10 2011 cp.wu - * [WCXRP00000349] [MT6620 Wi-Fi][Driver] make kalIoctl() of linux port as a thread safe API to avoid potential issues due to multiple access - * use mutex to protect kalIoctl() for thread safe. - * - * 01 04 2011 cp.wu - * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands - * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure - * - * 12 15 2010 cp.wu - * [WCXRP00000265] [MT6620 Wi-Fi][Driver] Remove set_mac_address routine from legacy Wi-Fi Android driver - * remove set MAC address. MAC address is always loaded from NVRAM instead. - * - * 12 10 2010 kevin.huang - * [WCXRP00000128] [MT6620 Wi-Fi][Driver] Add proc support to Android Driver for debug and driver status check - * Add Linux Proc Support - * - * 11 01 2010 yarco.yang - * [WCXRP00000149] [MT6620 WI-Fi][Driver]Fine tune performance on MT6516 platform - * Add GPIO debug function - * - * 11 01 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module - * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead - * 2) Remove CNM CH-RECOVER event handling - * 3) cfg read/write API renamed with kal prefix for unified naming rules. - * - * 10 26 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW] Support NIC capability query command - * 1) update NVRAM content template to ver 1.02 - * 2) add compile option for querying NIC capability (default: off) - * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting - * 4) correct auto-rate compiler error under linux (treat warning as error) - * 5) simplify usage of NVRAM and REG_INFO_T - * 6) add version checking between driver and firmware - * - * 10 21 2010 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * . - * - * 10 19 2010 jeffrey.chang - * [WCXRP00000120] [MT6620 Wi-Fi][Driver] Refine linux kernel module to the license of MTK propietary and enable MTK HIF by default - * Refine linux kernel module to the license of MTK and enable MTK HIF - * - * 10 18 2010 jeffrey.chang - * [WCXRP00000106] [MT6620 Wi-Fi][Driver] Enable setting multicast callback in Android - * . - * - * 10 18 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android - * complete implementation of Android NVRAM access - * - * 09 27 2010 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000065] Update BoW design and settings - * Update BCM/BoW design and settings. - * - * 09 23 2010 cp.wu - * [WCXRP00000051] [MT6620 Wi-Fi][Driver] WHQL test fail in MAC address changed item - * use firmware reported mac address right after wlanAdapterStart() as permanent address - * - * 09 21 2010 kevin.huang - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * Eliminate Linux Compile Warning - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 09 01 2010 wh.su - * NULL - * adding the wapi support for integration test. - * - * 08 18 2010 yarco.yang - * NULL - * 1. Fixed HW checksum offload function not work under Linux issue. - * 2. Add debug message. - * - * 08 16 2010 yarco.yang - * NULL - * Support Linux x86 - * - * 08 02 2010 jeffrey.chang - * NULL - * 1) modify tx service thread to avoid busy looping - * 2) add spin lock declartion for linux build - * - * 07 29 2010 jeffrey.chang - * NULL - * fix memory leak for module unloading - * - * 07 28 2010 jeffrey.chang - * NULL - * 1) remove unused spinlocks - * 2) enable encyption ioctls - * 3) fix scan ioctl which may cause supplicant to hang - * - * 07 23 2010 jeffrey.chang - * - * bug fix: allocate regInfo when disabling firmware download - * - * 07 23 2010 jeffrey.chang - * - * use glue layer api to decrease or increase counter atomically - * - * 07 22 2010 jeffrey.chang - * - * add new spinlock - * - * 07 19 2010 jeffrey.chang - * - * modify cmd/data path for new design - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 26 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * 1) Modify set mac address code - * 2) remove power managment macro - * - * 05 10 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * implement basic wi-fi direct framework - * - * 05 07 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * prevent supplicant accessing driver during resume - * - * 05 07 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add basic framework for implementating P2P driver hook. - * - * 04 27 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * 1) fix firmware download bug - * 2) remove query statistics for acelerating firmware download - * - * 04 27 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * follow Linux's firmware framework, and remove unused kal API - * - * 04 21 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * add for private ioctl support - * - * 04 19 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * Query statistics from firmware - * - * 04 19 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * modify tcp/ip checksum offload flags - * - * 04 16 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * fix tcp/ip checksum offload bug - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * * * * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * * * * * * * * * * * * * * 2) command sequence number is now increased atomically - * * * * * * * * * * * * * * * * * 3) private data could be hold and taken use for other purpose - * - * 04 09 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * fix spinlock usage - * - * 04 07 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * Set MAC address from firmware - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * rWlanInfo should be placed at adapter rather than glue due to most operations - * * * * * * are done in adapter layer. - * - * 04 07 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * (1)improve none-glue code portability - * * (2) disable set Multicast address during atomic context - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * adding debug module - * - * 03 31 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * modify the wapi related code for new driver's design. - * - * 03 30 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * emulate NDIS Pending OID facility - * - * 03 26 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * fix f/w download start and load address by using config.h - * - * 03 26 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * [WPD00003826] Initial import for Linux port - * adding firmware download support - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port -** \main\maintrunk.MT5921\52 2009-10-27 22:49:59 GMT mtk01090 -** Fix compile error for Linux EHPI driver -** \main\maintrunk.MT5921\51 2009-10-20 17:38:22 GMT mtk01090 -** Refine driver unloading and clean up procedure. Block requests, stop main thread and clean up queued requests, and then stop hw. -** \main\maintrunk.MT5921\50 2009-10-08 10:33:11 GMT mtk01090 -** Avoid accessing private data of net_device directly. Replace with netdev_priv(). Add more checking for input parameters and pointers. -** \main\maintrunk.MT5921\49 2009-09-28 20:19:05 GMT mtk01090 -** Add private ioctl to carry OID structures. Restructure public/private ioctl interfaces to Linux kernel. -** \main\maintrunk.MT5921\48 2009-09-03 13:58:46 GMT mtk01088 -** remove non-used code -** \main\maintrunk.MT5921\47 2009-09-03 11:40:25 GMT mtk01088 -** adding the module parameter for wapi -** \main\maintrunk.MT5921\46 2009-08-18 22:56:41 GMT mtk01090 -** Add Linux SDIO (with mmc core) support. -** Add Linux 2.6.21, 2.6.25, 2.6.26. -** Fix compile warning in Linux. -** \main\maintrunk.MT5921\45 2009-07-06 20:53:00 GMT mtk01088 -** adding the code to check the wapi 1x frame -** \main\maintrunk.MT5921\44 2009-06-23 23:18:55 GMT mtk01090 -** Add build option BUILD_USE_EEPROM and compile option CFG_SUPPORT_EXT_CONFIG for NVRAM support -** \main\maintrunk.MT5921\43 2009-02-16 23:46:51 GMT mtk01461 -** Revise the order of increasing u4TxPendingFrameNum because of CFG_TX_RET_TX_CTRL_EARLY -** \main\maintrunk.MT5921\42 2009-01-22 13:11:59 GMT mtk01088 -** set the tid and 1x value at same packet reserved field -** \main\maintrunk.MT5921\41 2008-10-20 22:43:53 GMT mtk01104 -** Fix wrong variable name "prDev" in wlanStop() -** \main\maintrunk.MT5921\40 2008-10-16 15:37:10 GMT mtk01461 -** add handle WLAN_STATUS_SUCCESS in wlanHardStartXmit() for CFG_TX_RET_TX_CTRL_EARLY -** \main\maintrunk.MT5921\39 2008-09-25 15:56:21 GMT mtk01461 -** Update driver for Code review -** \main\maintrunk.MT5921\38 2008-09-05 17:25:07 GMT mtk01461 -** Update Driver for Code Review -** \main\maintrunk.MT5921\37 2008-09-02 10:57:06 GMT mtk01461 -** Update driver for code review -** \main\maintrunk.MT5921\36 2008-08-05 01:53:28 GMT mtk01461 -** Add support for linux statistics -** \main\maintrunk.MT5921\35 2008-08-04 16:52:58 GMT mtk01461 -** Fix ASSERT if removing module in BG_SSID_SCAN state -** \main\maintrunk.MT5921\34 2008-06-13 22:52:24 GMT mtk01461 -** Revise status code handling in wlanHardStartXmit() for WLAN_STATUS_SUCCESS -** \main\maintrunk.MT5921\33 2008-05-30 18:56:53 GMT mtk01461 -** Not use wlanoidSetCurrentAddrForLinux() -** \main\maintrunk.MT5921\32 2008-05-30 14:39:40 GMT mtk01461 -** Remove WMM Assoc Flag -** \main\maintrunk.MT5921\31 2008-05-23 10:26:40 GMT mtk01084 -** modify wlanISR interface -** \main\maintrunk.MT5921\30 2008-05-03 18:52:36 GMT mtk01461 -** Fix Unset Broadcast filter when setMulticast -** \main\maintrunk.MT5921\29 2008-05-03 15:17:26 GMT mtk01461 -** Move Query Media Status to GLUE -** \main\maintrunk.MT5921\28 2008-04-24 22:48:21 GMT mtk01461 -** Revise set multicast function by using windows oid style for LP own back -** \main\maintrunk.MT5921\27 2008-04-24 12:00:08 GMT mtk01461 -** Fix multicast setting in Linux and add comment -** \main\maintrunk.MT5921\26 2008-03-28 10:40:22 GMT mtk01461 -** Fix set mac address func in Linux -** \main\maintrunk.MT5921\25 2008-03-26 15:37:26 GMT mtk01461 -** Add set MAC Address -** \main\maintrunk.MT5921\24 2008-03-26 14:24:53 GMT mtk01461 -** For Linux, set net_device has feature with checksum offload by default -** \main\maintrunk.MT5921\23 2008-03-11 14:50:52 GMT mtk01461 -** Fix typo -** \main\maintrunk.MT5921\22 2008-02-29 15:35:20 GMT mtk01088 -** add 1x decide code for sw port control -** \main\maintrunk.MT5921\21 2008-02-21 15:01:54 GMT mtk01461 -** Rearrange the set off place of GLUE spin lock in HardStartXmit -** \main\maintrunk.MT5921\20 2008-02-12 23:26:50 GMT mtk01461 -** Add debug option - Packet Order for Linux and add debug level - Event -** \main\maintrunk.MT5921\19 2007-12-11 00:11:12 GMT mtk01461 -** Fix SPIN_LOCK protection -** \main\maintrunk.MT5921\18 2007-11-30 17:02:25 GMT mtk01425 -** 1. Set Rx multicast packets mode before setting the address list -** \main\maintrunk.MT5921\17 2007-11-26 19:44:24 GMT mtk01461 -** Add OS_TIMESTAMP to packet -** \main\maintrunk.MT5921\16 2007-11-21 15:47:20 GMT mtk01088 -** fixed the unload module issue -** \main\maintrunk.MT5921\15 2007-11-07 18:37:38 GMT mtk01461 -** Fix compile warnning -** \main\maintrunk.MT5921\14 2007-11-02 01:03:19 GMT mtk01461 -** Unify TX Path for Normal and IBSS Power Save + IBSS neighbor learning -** \main\maintrunk.MT5921\13 2007-10-30 10:42:33 GMT mtk01425 -** 1. Refine for multicast list -** \main\maintrunk.MT5921\12 2007-10-25 18:08:13 GMT mtk01461 -** Add VOIP SCAN Support & Refine Roaming -** Revision 1.4 2007/07/05 07:25:33 MTK01461 -** Add Linux initial code, modify doc, add 11BB, RF init code -** -** Revision 1.3 2007/06/27 02:18:50 MTK01461 -** Update SCAN_FSM, Initial(Can Load Module), Proc(Can do Reg R/W), TX API -** -** Revision 1.2 2007/06/25 06:16:24 MTK01461 -** Update illustrations, gl_init.c, gl_kal.c, gl_kal.h, gl_os.h and RX API -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_os.h" -#include "debug.h" -#include "wlan_lib.h" -#include "gl_wext.h" -#include "gl_cfg80211.h" -#include "precomp.h" - -#if defined(CONFIG_WIFI_CONTROL_FUNC) -#include -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) -#include -#else -#include -#endif -#endif /* CONFIG_WIFI_CONTROL_FUNC */ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -//#define MAX_IOREQ_NUM 10 -#if 1//def RK2818 - int driver_start_ok = 0; -#endif - -BOOLEAN fgIsUnderEarlierSuspend = false; - -struct semaphore g_halt_sem; -int g_u4HaltFlag = 0; - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/* Tasklet mechanism is like buttom-half in Linux. We just want to - * send a signal to OS for interrupt defer processing. All resources - * are NOT allowed reentry, so txPacket, ISR-DPC and ioctl must avoid preempty. - */ -typedef struct _WLANDEV_INFO_T { - struct net_device *prDev; -} WLANDEV_INFO_T, *P_WLANDEV_INFO_T; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -MODULE_AUTHOR(NIC_AUTHOR); -MODULE_DESCRIPTION(NIC_DESC); -MODULE_SUPPORTED_DEVICE(NIC_NAME); - -/* WCNCR 00002676, -keep OS wake up for 100ms after sdio interrupt happen, -make sure that RX & TX procedure isn't suspended -*/ -KAL_WAKE_LOCK_T isr_wakelock; - -#if 0 - MODULE_LICENSE("MTK Propietary"); -#else - MODULE_LICENSE("GPL"); -#endif - -#define NIC_INF_NAME "wlan%d" /* interface name */ - -#if DBG - UINT_8 aucDebugModule[DBG_MODULE_NUM]; - UINT_32 u4DebugModule = 0; -#endif /* DBG */ - -//4 2007/06/26, mikewu, now we don't use this, we just fix the number of wlan device to 1 -static WLANDEV_INFO_T arWlanDevInfo[CFG_MAX_WLAN_DEVICES] = {{0}}; -static UINT_32 u4WlanDevNum = 0; /* How many NICs coexist now */ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ -#if CFG_ENABLE_WIFI_DIRECT -static SUB_MODULE_HANDLER rSubModHandler[SUB_MODULE_NUM] = {{NULL}}; -#endif - -#define CHAN2G(_channel, _freq, _flags) \ - { \ - .band = IEEE80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ - } -static struct ieee80211_channel mtk_2ghz_channels[] = { - CHAN2G(1, 2412, 0), - CHAN2G(2, 2417, 0), - CHAN2G(3, 2422, 0), - CHAN2G(4, 2427, 0), - CHAN2G(5, 2432, 0), - CHAN2G(6, 2437, 0), - CHAN2G(7, 2442, 0), - CHAN2G(8, 2447, 0), - CHAN2G(9, 2452, 0), - CHAN2G(10, 2457, 0), - CHAN2G(11, 2462, 0), - CHAN2G(12, 2467, 0), - CHAN2G(13, 2472, 0), - CHAN2G(14, 2484, 0), -}; - -#define CHAN5G(_channel, _flags) \ - { \ - .band = IEEE80211_BAND_5GHZ, \ - .center_freq = 5000 + (5 * (_channel)), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ - } -static struct ieee80211_channel mtk_5ghz_channels[] = { - CHAN5G(34, 0), CHAN5G(36, 0), - CHAN5G(38, 0), CHAN5G(40, 0), - CHAN5G(42, 0), CHAN5G(44, 0), - CHAN5G(46, 0), CHAN5G(48, 0), - CHAN5G(52, 0), CHAN5G(56, 0), - CHAN5G(60, 0), CHAN5G(64, 0), - CHAN5G(100, 0), CHAN5G(104, 0), - CHAN5G(108, 0), CHAN5G(112, 0), - CHAN5G(116, 0), CHAN5G(120, 0), - CHAN5G(124, 0), CHAN5G(128, 0), - CHAN5G(132, 0), CHAN5G(136, 0), - CHAN5G(140, 0), CHAN5G(149, 0), - CHAN5G(153, 0), CHAN5G(157, 0), - CHAN5G(161, 0), CHAN5G(165, 0), - CHAN5G(169, 0), CHAN5G(173, 0), - CHAN5G(184, 0), CHAN5G(188, 0), - CHAN5G(192, 0), CHAN5G(196, 0), - CHAN5G(200, 0), CHAN5G(204, 0), - CHAN5G(208, 0), CHAN5G(212, 0), - CHAN5G(216, 0), -}; - -/* for cfg80211 - rate table */ -static struct ieee80211_rate mtk_rates[] = { - RATETAB_ENT(10, 0x1000, 0), - RATETAB_ENT(20, 0x1001, 0), - RATETAB_ENT(55, 0x1002, 0), - RATETAB_ENT(110, 0x1003, 0), /* 802.11b */ - RATETAB_ENT(60, 0x2000, 0), - RATETAB_ENT(90, 0x2001, 0), - RATETAB_ENT(120, 0x2002, 0), - RATETAB_ENT(180, 0x2003, 0), - RATETAB_ENT(240, 0x2004, 0), - RATETAB_ENT(360, 0x2005, 0), - RATETAB_ENT(480, 0x2006, 0), - RATETAB_ENT(540, 0x2007, 0), /* 802.11a/g */ -}; - -#define mtk_a_rates (mtk_rates + 4) -#define mtk_a_rates_size (sizeof(mtk_rates) / sizeof(mtk_rates[0]) - 4) -#define mtk_g_rates (mtk_rates + 0) -#define mtk_g_rates_size (sizeof(mtk_rates) / sizeof(mtk_rates[0]) - 0) - -#define MT6620_MCS_INFO \ -{ \ - .rx_mask = {0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0},\ - .rx_highest = 0, \ - .tx_params = IEEE80211_HT_MCS_TX_DEFINED, \ -} - -#define MT6620_HT_CAP \ -{ \ - .ht_supported = true, \ - .cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 \ - | IEEE80211_HT_CAP_SM_PS \ - | IEEE80211_HT_CAP_GRN_FLD \ - | IEEE80211_HT_CAP_SGI_20 \ - | IEEE80211_HT_CAP_SGI_40, \ - .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, \ - .ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE, \ - .mcs = MT6620_MCS_INFO, \ -} - -/* public for both Legacy Wi-Fi / P2P access */ -struct ieee80211_supported_band mtk_band_2ghz = { - .band = IEEE80211_BAND_2GHZ, - .channels = mtk_2ghz_channels, - .n_channels = ARRAY_SIZE(mtk_2ghz_channels), - .bitrates = mtk_g_rates, - .n_bitrates = mtk_g_rates_size, - .ht_cap = MT6620_HT_CAP, -}; - -/* public for both Legacy Wi-Fi / P2P access */ -struct ieee80211_supported_band mtk_band_5ghz = { - .band = IEEE80211_BAND_5GHZ, - .channels = mtk_5ghz_channels, - .n_channels = ARRAY_SIZE(mtk_5ghz_channels), - .bitrates = mtk_a_rates, - .n_bitrates = mtk_a_rates_size, - .ht_cap = MT6620_HT_CAP, -}; - -static const UINT_32 mtk_cipher_suites[] = { - /* keep WEP first, it may be removed below */ - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, - - /* keep last -- depends on hw flags! */ - WLAN_CIPHER_SUITE_AES_CMAC -}; - -static struct cfg80211_ops mtk_wlan_ops = { - .change_virtual_intf = mtk_cfg80211_change_iface, - .add_key = mtk_cfg80211_add_key, - .get_key = mtk_cfg80211_get_key, - .del_key = mtk_cfg80211_del_key, - .set_default_key = mtk_cfg80211_set_default_key, - .get_station = mtk_cfg80211_get_station, - .scan = mtk_cfg80211_scan, - .connect = mtk_cfg80211_connect, - .disconnect = mtk_cfg80211_disconnect, - .join_ibss = mtk_cfg80211_join_ibss, - .leave_ibss = mtk_cfg80211_leave_ibss, - .set_power_mgmt = mtk_cfg80211_set_power_mgmt, - .set_pmksa = mtk_cfg80211_set_pmksa, - .del_pmksa = mtk_cfg80211_del_pmksa, - .flush_pmksa = mtk_cfg80211_flush_pmksa, - - /* Action Frame TX/RX */ - .remain_on_channel = mtk_cfg80211_remain_on_channel, - .cancel_remain_on_channel = mtk_cfg80211_cancel_remain_on_channel, - .mgmt_tx = mtk_cfg80211_mgmt_tx, - .mgmt_tx_cancel_wait = mtk_cfg80211_mgmt_tx_cancel_wait, - #ifdef CONFIG_NL80211_TESTMODE - .testmode_cmd = mtk_cfg80211_testmode_cmd, - #endif -}; - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -#if defined(CONFIG_HAS_EARLYSUSPEND) -extern int glRegisterEarlySuspend( - struct early_suspend *prDesc, - early_suspend_callback wlanSuspend, - late_resume_callback wlanResume); - -extern int glUnregisterEarlySuspend(struct early_suspend *prDesc); -#endif - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/** - * Functions for Android WiFi card detection - */ -#if defined(CONFIG_WIFI_CONTROL_FUNC) - -static int g_wifidev_registered = 0; -static struct semaphore wifi_control_sem; -static struct wifi_platform_data *wifi_control_data = NULL; -static struct resource *wifi_irqres = NULL; - -static int wifi_add_dev(void); -static void wifi_del_dev(void); - -#define ANDROID_ERR(x) printk x -#define ANDROID_TRACE(x) printk x - -int wl_android_wifictrl_func_add(void) -{ - int ret = 0; - sema_init(&wifi_control_sem, 0); - - ret = wifi_add_dev(); - if (ret) { - ANDROID_ERR(("%s: platform_driver_register failed\n", __FUNCTION__)); - return ret; - } - g_wifidev_registered = 1; - - /* Waiting callback after platform_driver_register is done or exit with error */ - if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) { - ret = -EINVAL; - ANDROID_ERR(("%s: platform_driver_register timeout\n", __FUNCTION__)); - } - - printk("wl_android_wifictrl_func_add success.\n"); - return ret; -} - -void wl_android_wifictrl_func_del(void) -{ - if (g_wifidev_registered) - { - wifi_del_dev(); - g_wifidev_registered = 0; - } -} - -int wifi_set_power(int on, unsigned long msec) -{ - ANDROID_ERR(("%s = %d\n", __FUNCTION__, on)); - if (wifi_control_data && wifi_control_data->set_power) { - wifi_control_data->set_power(on); - } - if (msec) - msleep(msec); - return 0; -} - -int wifi_set_reset(int on, unsigned long msec) -{ - ANDROID_ERR(("%s = %d\n", __FUNCTION__, on)); - if (wifi_control_data && wifi_control_data->set_reset) { - wifi_control_data->set_reset(on); - } - if (msec) - msleep(msec); - return 0; -} - -static int wifi_set_carddetect(int on) -{ - ANDROID_ERR(("%s = %d\n", __FUNCTION__, on)); - if (wifi_control_data && wifi_control_data->set_carddetect) { - wifi_control_data->set_carddetect(on); - } - return 0; -} - -static int wifi_probe(struct platform_device *pdev) -{ - struct wifi_platform_data *wifi_ctrl = - (struct wifi_platform_data *)(pdev->dev.platform_data); - - ANDROID_ERR(("## %s\n", __FUNCTION__)); - wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "bcmdhd_wlan_irq"); - if (wifi_irqres == NULL) - wifi_irqres = platform_get_resource_byname(pdev, - IORESOURCE_IRQ, "bcm4329_wlan_irq"); - wifi_control_data = wifi_ctrl; - - //wifi_set_power(0, 0); - //wifi_set_reset(0, 10); - - wifi_set_power(1, 0); - //wifi_set_reset(1, 12); /* Power On */ - - wifi_set_carddetect(1); /* CardDetect (0->1) */ - - up(&wifi_control_sem); - return 0; -} - -static int wifi_remove(struct platform_device *pdev) -{ - struct wifi_platform_data *wifi_ctrl = - (struct wifi_platform_data *)(pdev->dev.platform_data); - - ANDROID_ERR(("## %s\n", __FUNCTION__)); - wifi_control_data = wifi_ctrl; - - wifi_set_power(0, 0); /* Power Off */ - //wifi_set_reset(0, 0); - - wifi_set_carddetect(0); /* CardDetect (1->0) */ - - return 0; -} - -static int wifi_suspend(struct platform_device *pdev, pm_message_t state) -{ - ANDROID_TRACE(("##> %s\n", __FUNCTION__)); - return 0; -} - -static int wifi_resume(struct platform_device *pdev) -{ - ANDROID_TRACE(("##> %s\n", __FUNCTION__)); - return 0; -} - -static struct platform_driver wifi_device = { - .probe = wifi_probe, - .remove = wifi_remove, - .suspend = wifi_suspend, - .resume = wifi_resume, - .driver = { - .name = "bcmdhd_wlan", - } -}; - -static struct platform_driver wifi_device_legacy = { - .probe = wifi_probe, - .remove = wifi_remove, - .suspend = wifi_suspend, - .resume = wifi_resume, - .driver = { - .name = "bcm4329_wlan", - } -}; - -static int wifi_add_dev(void) -{ - ANDROID_TRACE(("## Calling platform_driver_register\n")); - platform_driver_register(&wifi_device); - platform_driver_register(&wifi_device_legacy); - return 0; -} - -static void wifi_del_dev(void) -{ - ANDROID_TRACE(("## Unregister platform_driver_register\n")); - platform_driver_unregister(&wifi_device); - platform_driver_unregister(&wifi_device_legacy); -} -#endif /* defined(CONFIG_WIFI_CONTROL_FUNC) */ - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) -/*----------------------------------------------------------------------------*/ -/*! -* \brief Override the implementation of select queue -* -* \param[in] dev Pointer to struct net_device -* \param[in] skb Pointer to struct skb_buff -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -unsigned int _cfg80211_classify8021d(struct sk_buff *skb) -{ - unsigned int dscp = 0; - - /* skb->priority values from 256->263 are magic values - * directly indicate a specific 802.1d priority. This is - * to allow 802.1d priority to be passed directly in from - * tags - */ - - if (skb->priority >= 256 && skb->priority <= 263) { - return skb->priority - 256; - } - switch (skb->protocol) { - case htons(ETH_P_IP): - dscp = ip_hdr(skb)->tos & 0xfc; - break; - } - return dscp >> 5; -} - - -static const UINT_16 au16Wlan1dToQueueIdx[8] = { 1, 0, 0, 1, 2, 2, 3, 3 }; - -static UINT_16 -wlanSelectQueue( - struct net_device *dev, - struct sk_buff *skb) -{ - skb->priority = _cfg80211_classify8021d(skb); - - return au16Wlan1dToQueueIdx[skb->priority]; -} -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Load NVRAM data and translate it into REG_INFO_T -* -* \param[in] prGlueInfo Pointer to struct GLUE_INFO_T -* \param[out] prRegInfo Pointer to struct REG_INFO_T -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -static void -glLoadNvram ( - IN P_GLUE_INFO_T prGlueInfo, - OUT P_REG_INFO_T prRegInfo - ) -{ - UINT_32 i, j; - UINT_8 aucTmp[2]; - PUINT_8 pucDest; - - ASSERT(prGlueInfo); - ASSERT(prRegInfo); - - if((!prGlueInfo) || (!prRegInfo)) { - return; - } - - if(kalCfgDataRead16(prGlueInfo, - sizeof(WIFI_CFG_PARAM_STRUCT) - sizeof(UINT_16), - (PUINT_16)aucTmp) == TRUE) { - prGlueInfo->fgNvramAvailable = TRUE; - - // load MAC Address - for (i = 0 ; i < sizeof(PARAM_MAC_ADDR_LEN) ; i += sizeof(UINT_16)) { - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, aucMacAddress) + i, - (PUINT_16) (((PUINT_8)prRegInfo->aucMacAddr) + i)); - } - - // load country code - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, aucCountryCode[0]), - (PUINT_16)aucTmp); - - // cast to wide characters - prRegInfo->au2CountryCode[0] = (UINT_16) aucTmp[0]; - prRegInfo->au2CountryCode[1] = (UINT_16) aucTmp[1]; - - // load default normal TX power - for (i = 0 ; i < sizeof(TX_PWR_PARAM_T) ; i += sizeof(UINT_16)) { - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, rTxPwr) + i, - (PUINT_16) (((PUINT_8)&(prRegInfo->rTxPwr)) + i)); - } - - // load feature flags - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, ucTxPwrValid), - (PUINT_16)aucTmp); - prRegInfo->ucTxPwrValid = aucTmp[0]; - prRegInfo->ucSupport5GBand = aucTmp[1]; - - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, uc2G4BwFixed20M), - (PUINT_16)aucTmp); - prRegInfo->uc2G4BwFixed20M = aucTmp[0]; - prRegInfo->uc5GBwFixed20M = aucTmp[1]; - - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, ucEnable5GBand), - (PUINT_16)aucTmp); - prRegInfo->ucEnable5GBand = aucTmp[0]; - - /* load EFUSE overriding part */ - for (i = 0 ; i < sizeof(prRegInfo->aucEFUSE) ; i += sizeof(UINT_16)) { - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, aucEFUSE) + i, - (PUINT_16) (((PUINT_8)&(prRegInfo->aucEFUSE)) + i)); - } - - /* load band edge tx power control */ - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, fg2G4BandEdgePwrUsed), - (PUINT_16)aucTmp); - prRegInfo->fg2G4BandEdgePwrUsed = (BOOLEAN)aucTmp[0]; - if (aucTmp[0]) { - prRegInfo->cBandEdgeMaxPwrCCK = (INT_8)aucTmp[1]; - - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, cBandEdgeMaxPwrOFDM20), - (PUINT_16)aucTmp); - prRegInfo->cBandEdgeMaxPwrOFDM20 = (INT_8)aucTmp[0]; - prRegInfo->cBandEdgeMaxPwrOFDM40 = (INT_8)aucTmp[1]; - } - - /* load regulation subbands */ - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, ucRegChannelListMap), - (PUINT_16)aucTmp); - prRegInfo->eRegChannelListMap = (ENUM_REG_CH_MAP_T) aucTmp[0]; - prRegInfo->ucRegChannelListIndex = aucTmp[1]; - - if (prRegInfo->eRegChannelListMap == REG_CH_MAP_CUSTOMIZED) { - for (i = 0 ; i < MAX_SUBBAND_NUM; i++) { - pucDest = (PUINT_8) &prRegInfo->rDomainInfo.rSubBand[i]; - for (j = 0; j < 6; j += sizeof(UINT_16)) { - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, aucRegSubbandInfo) - + (i * 6 + j), - (PUINT_16)aucTmp); - - *pucDest++ = aucTmp[0]; - *pucDest++ = aucTmp[1]; - } - } - } - } - else { - prGlueInfo->fgNvramAvailable = FALSE; - } - - return; -} - - -#if CFG_ENABLE_WIFI_DIRECT -/*----------------------------------------------------------------------------*/ -/*! -* \brief called by txthread, run sub module init function -* -* \param[in] prGlueInfo Pointer to struct GLUE_INFO_T -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanSubModRunInit( - P_GLUE_INFO_T prGlueInfo - ) -{ - /*now, we only have p2p module*/ - if(rSubModHandler[P2P_MODULE].fgIsInited == FALSE) { - rSubModHandler[P2P_MODULE].subModInit(prGlueInfo); - rSubModHandler[P2P_MODULE].fgIsInited = TRUE; - } - -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief called by txthread, run sub module exit function -* -* \param[in] prGlueInfo Pointer to struct GLUE_INFO_T -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanSubModRunExit( - P_GLUE_INFO_T prGlueInfo - ) -{ - /*now, we only have p2p module*/ - if(rSubModHandler[P2P_MODULE].fgIsInited == TRUE) { - rSubModHandler[P2P_MODULE].subModExit(prGlueInfo); - rSubModHandler[P2P_MODULE].fgIsInited = FALSE; - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief set sub module init flag, force TxThread to run sub modle init -* -* \param[in] prGlueInfo Pointer to struct GLUE_INFO_T -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wlanSubModInit( - P_GLUE_INFO_T prGlueInfo - ) -{ - //4 Mark HALT, notify main thread to finish current job - prGlueInfo->u4Flag |= GLUE_FLAG_SUB_MOD_INIT; - /* wake up main thread */ - wake_up_interruptible(&prGlueInfo->waitq); - /* wait main thread finish sub module INIT*/ - wait_for_completion_interruptible(&prGlueInfo->rSubModComp); - -#if 0 - if(prGlueInfo->prAdapter->fgIsP2PRegistered) { - p2pNetRegister(prGlueInfo); - } -#endif - - return TRUE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief set sub module exit flag, force TxThread to run sub modle exit -* -* \param[in] prGlueInfo Pointer to struct GLUE_INFO_T -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wlanSubModExit( - P_GLUE_INFO_T prGlueInfo - ) -{ -#if 0 - if(prGlueInfo->prAdapter->fgIsP2PRegistered) { - p2pNetUnregister(prGlueInfo); - } -#endif - - //4 Mark HALT, notify main thread to finish current job - prGlueInfo->u4Flag |= GLUE_FLAG_SUB_MOD_EXIT; - /* wake up main thread */ - wake_up_interruptible(&prGlueInfo->waitq); - /* wait main thread finish sub module EXIT */ - wait_for_completion_interruptible(&prGlueInfo->rSubModComp); - - return TRUE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief set by sub module, indicate sub module is already inserted -* -* \param[in] rSubModInit, function pointer point to sub module init function -* \param[in] rSubModExit, function pointer point to sub module exit function -* \param[in] eSubModIdx, sub module index -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -wlanSubModRegisterInitExit( - SUB_MODULE_INIT rSubModInit, - SUB_MODULE_EXIT rSubModExit, - ENUM_SUB_MODULE_IDX_T eSubModIdx - ) -{ - rSubModHandler[eSubModIdx].subModInit = rSubModInit; - rSubModHandler[eSubModIdx].subModExit = rSubModExit; - rSubModHandler[eSubModIdx].fgIsInited = FALSE; -} - -#if 0 -/*----------------------------------------------------------------------------*/ -/*! -* \brief check wlan is launched or not -* -* \param[in] (none) -* -* \return TRUE, wlan is already started -* FALSE, wlan is not started yet -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wlanIsLaunched( - VOID - ) -{ - struct net_device *prDev = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - - //4 <0> Sanity check - ASSERT(u4WlanDevNum <= CFG_MAX_WLAN_DEVICES); - if (0 == u4WlanDevNum) { - return FALSE; - } - - prDev = arWlanDevInfo[u4WlanDevNum-1].prDev; - - ASSERT(prDev); - if (NULL == prDev) { - return FALSE; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - if (NULL == prGlueInfo) { - return FALSE; - } - - return prGlueInfo->prAdapter->fgIsWlanLaunched; -} - -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Export wlan GLUE_INFO_T pointer to p2p module -* -* \param[in] prGlueInfo Pointer to struct GLUE_INFO_T -* -* \return TRUE: get GlueInfo pointer successfully -* FALSE: wlan is not started yet -*/ -/*---------------------------------------------------------------------------*/ -BOOLEAN -wlanExportGlueInfo( - P_GLUE_INFO_T *prGlueInfoExpAddr - ) -{ - struct net_device *prDev = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - - if (0 == u4WlanDevNum) { - return FALSE; - } - - prDev = arWlanDevInfo[u4WlanDevNum-1].prDev; - if (NULL == prDev) { - return FALSE; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - if (NULL == prGlueInfo) { - return FALSE; - } - - if(FALSE == prGlueInfo->prAdapter->fgIsWlanLaunched) { - return FALSE; - } - - *prGlueInfoExpAddr = prGlueInfo; - return TRUE; -} - -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Release prDev from wlandev_array and free tasklet object related to it. -* -* \param[in] prDev Pointer to struct net_device -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -static void -wlanClearDevIdx ( - struct net_device *prDev - ) -{ - int i; - - ASSERT(prDev); - - for (i = 0; i < CFG_MAX_WLAN_DEVICES; i++) { - if (arWlanDevInfo[i].prDev == prDev) { - arWlanDevInfo[i].prDev = NULL; - u4WlanDevNum--; - } - } - - return; -} /* end of wlanClearDevIdx() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Allocate an unique interface index, net_device::ifindex member for this -* wlan device. Store the net_device in wlandev_array, and initialize -* tasklet object related to it. -* -* \param[in] prDev Pointer to struct net_device -* -* \retval >= 0 The device number. -* \retval -1 Fail to get index. -*/ -/*----------------------------------------------------------------------------*/ -static int -wlanGetDevIdx ( - struct net_device *prDev - ) -{ - int i; - - ASSERT(prDev); - - for (i = 0; i < CFG_MAX_WLAN_DEVICES; i++) { - if (arWlanDevInfo[i].prDev == (struct net_device *) NULL) { - /* Reserve 2 bytes space to store one digit of - * device number and NULL terminator. - */ - arWlanDevInfo[i].prDev = prDev; - u4WlanDevNum++; - return i; - } - } - - return -1; -} /* end of wlanGetDevIdx() */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief A method of struct net_device, a primary SOCKET interface to configure -* the interface lively. Handle an ioctl call on one of our devices. -* Everything Linux ioctl specific is done here. Then we pass the contents -* of the ifr->data to the request message handler. -* -* \param[in] prDev Linux kernel netdevice -* -* \param[in] prIFReq Our private ioctl request structure, typed for the generic -* struct ifreq so we can use ptr to function -* -* \param[in] cmd Command ID -* -* \retval WLAN_STATUS_SUCCESS The IOCTL command is executed successfully. -* \retval OTHER The execution of IOCTL command is failed. -*/ -/*----------------------------------------------------------------------------*/ -int -wlanDoIOCTL( - struct net_device *prDev, - struct ifreq *prIFReq, - int i4Cmd - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - int ret = 0; - - /* Verify input parameters for the following functions */ - ASSERT(prDev && prIFReq); - if (!prDev || !prIFReq) { - DBGLOG(INIT, WARN, ("%s Invalid input data\n", __FUNCTION__)); - return -EINVAL; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - if (!prGlueInfo) { - DBGLOG(INIT, WARN, ("%s No glue info\n", __FUNCTION__)); - return -EFAULT; - } - - if (prGlueInfo->u4ReadyFlag == 0) { - return -EINVAL; - } - - printk ("ioctl %x\n", i4Cmd); - - if (i4Cmd == SIOCGIWPRIV) { - /* 0x8B0D, get private ioctl table */ - ret = wext_get_priv(prDev, prIFReq); - } - else if ((i4Cmd >= SIOCIWFIRST) && (i4Cmd < SIOCIWFIRSTPRIV)) { - /* 0x8B00 ~ 0x8BDF, wireless extension region */ - ret = wext_support_ioctl(prDev, prIFReq, i4Cmd); - } - else if ((i4Cmd >= SIOCIWFIRSTPRIV) && (i4Cmd < SIOCIWLASTPRIV)) { - /* 0x8BE0 ~ 0x8BFF, private ioctl region */ - ret = priv_support_ioctl(prDev, prIFReq, i4Cmd); - } - else { - DBGLOG(INIT, WARN, ("Unexpected ioctl command: 0x%04x\n", i4Cmd)); - /* return 0 for safe? */ - } - - return ret; -} /* end of wlanDoIOCTL() */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is to set multicast list and set rx mode. -* -* \param[in] prDev Pointer to struct net_device -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ - -static struct delayed_work workq; -static struct net_device *gPrDev; - -static void -wlanSetMulticastList (struct net_device *prDev) -{ - gPrDev = prDev; - schedule_delayed_work(&workq, 0); -} - -/* FIXME: Since we cannot sleep in the wlanSetMulticastList, we arrange - * another workqueue for sleeping. We don't want to block - * tx_thread, so we can't let tx_thread to do this */ - -static void -wlanSetMulticastListWorkQueue (struct work_struct *work) { - - P_GLUE_INFO_T prGlueInfo = NULL; - UINT_32 u4PacketFilter = 0; - UINT_32 u4SetInfoLen; - struct net_device *prDev = gPrDev; - - down(&g_halt_sem); - if (g_u4HaltFlag) { - up(&g_halt_sem); - return; - } - - prGlueInfo = (NULL != prDev) ? *((P_GLUE_INFO_T *) netdev_priv(prDev)) : NULL; - ASSERT(prDev); - ASSERT(prGlueInfo); - if (!prDev || !prGlueInfo) { - DBGLOG(INIT, WARN, ("abnormal dev or skb: prDev(0x%p), prGlueInfo(0x%p)\n", - prDev, prGlueInfo)); - up(&g_halt_sem); - return; - } - - if (prDev->flags & IFF_PROMISC) { - u4PacketFilter |= PARAM_PACKET_FILTER_PROMISCUOUS; - } - - if (prDev->flags & IFF_BROADCAST) { - u4PacketFilter |= PARAM_PACKET_FILTER_BROADCAST; - } - - if (prDev->flags & IFF_MULTICAST) { - if ((prDev->flags & IFF_ALLMULTI) || -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - (netdev_mc_count(prDev) > MAX_NUM_GROUP_ADDR)) { -#else - (prDev->mc_count > MAX_NUM_GROUP_ADDR)) { -#endif - - u4PacketFilter |= PARAM_PACKET_FILTER_ALL_MULTICAST; - } - else { - u4PacketFilter |= PARAM_PACKET_FILTER_MULTICAST; - } - } - - up(&g_halt_sem); - - if (kalIoctl(prGlueInfo, - wlanoidSetCurrentPacketFilter, - &u4PacketFilter, - sizeof(u4PacketFilter), - FALSE, - FALSE, - TRUE, - FALSE, - &u4SetInfoLen) != WLAN_STATUS_SUCCESS) { - return; - } - - - if (u4PacketFilter & PARAM_PACKET_FILTER_MULTICAST) { - /* Prepare multicast address list */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - struct netdev_hw_addr *ha; -#else - struct dev_mc_list *prMcList; -#endif - PUINT_8 prMCAddrList = NULL; - UINT_32 i = 0; - - down(&g_halt_sem); - if (g_u4HaltFlag) { - up(&g_halt_sem); - return; - } - - prMCAddrList = kalMemAlloc(MAX_NUM_GROUP_ADDR * ETH_ALEN, VIR_MEM_TYPE); - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - netdev_for_each_mc_addr(ha, prDev) { - if(i < MAX_NUM_GROUP_ADDR) { - memcpy((prMCAddrList + i * ETH_ALEN), ha->addr, ETH_ALEN); - i++; - } - } -#else - for (i = 0, prMcList = prDev->mc_list; - (prMcList) && (i < prDev->mc_count) && (i < MAX_NUM_GROUP_ADDR); - i++, prMcList = prMcList->next) { - memcpy((prMCAddrList + i * ETH_ALEN), prMcList->dmi_addr, ETH_ALEN); - } -#endif - - up(&g_halt_sem); - - kalIoctl(prGlueInfo, - wlanoidSetMulticastList, - prMCAddrList, - (i * ETH_ALEN), - FALSE, - FALSE, - TRUE, - FALSE, - &u4SetInfoLen); - - kalMemFree(prMCAddrList, VIR_MEM_TYPE, MAX_NUM_GROUP_ADDR * ETH_ALEN); - } - - return; -} /* end of wlanSetMulticastList() */ - - -/* FIXME: Since we cannot sleep in the wlanSetMulticastList, we arrange - * another workqueue for sleeping. We don't want to block - * tx_thread, so we can't let tx_thread to do this */ - -void -p2pSetMulticastListWorkQueueWrapper (P_GLUE_INFO_T prGlueInfo) { - - ASSERT(prGlueInfo); - - if (!prGlueInfo) { - DBGLOG(INIT, WARN, ("abnormal dev or skb: prGlueInfo(0x%p)\n", - prGlueInfo)); - return; - } - -#if CFG_ENABLE_WIFI_DIRECT - if(prGlueInfo->prAdapter->fgIsP2PRegistered) { - mtk_p2p_wext_set_Multicastlist(prGlueInfo); - } -#endif - - return; -} /* end of p2pSetMulticastListWorkQueueWrapper() */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is TX entry point of NET DEVICE. -* -* \param[in] prSkb Pointer of the sk_buff to be sent -* \param[in] prDev Pointer to struct net_device -* -* \retval NETDEV_TX_OK - on success. -* \retval NETDEV_TX_BUSY - on failure, packet will be discarded by upper layer. -*/ -/*----------------------------------------------------------------------------*/ -int -wlanHardStartXmit( - struct sk_buff *prSkb, - struct net_device *prDev - ) -{ - P_GLUE_INFO_T prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - - P_QUE_ENTRY_T prQueueEntry = NULL; - P_QUE_T prTxQueue = NULL; - UINT_16 u2QueueIdx = 0; - -#if CFG_BOW_TEST - UINT_32 i; -#endif - - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prSkb); - ASSERT(prDev); - ASSERT(prGlueInfo); - - if (prGlueInfo->u4Flag & GLUE_FLAG_HALT) { - DBGLOG(INIT, INFO, ("GLUE_FLAG_HALT skip tx\n")); - dev_kfree_skb(prSkb); - return NETDEV_TX_OK; - } - - prQueueEntry = (P_QUE_ENTRY_T) GLUE_GET_PKT_QUEUE_ENTRY(prSkb); - prTxQueue = &prGlueInfo->rTxQueue; - -#if CFG_BOW_TEST - DBGLOG(BOW, TRACE, ("sk_buff->len: %d\n", prSkb->len)); - DBGLOG(BOW, TRACE, ("sk_buff->data_len: %d\n", prSkb->data_len)); - DBGLOG(BOW, TRACE, ("sk_buff->data:\n")); - - for(i = 0; i < prSkb->len && i < 64; i++) - { - LOG_FUNC("%02x ", prSkb->data[i]); - - if((i+1)%16 ==0) - { - LOG_FUNC("\n"); - } - } - - LOG_FUNC("\n"); -#endif - - if (wlanProcessSecurityFrame(prGlueInfo->prAdapter, (P_NATIVE_PACKET) prSkb) == FALSE) { - - #if CFG_DBG_GPIO_PINS - { - /* TX request from OS */ - mtk_wcn_stp_debug_gpio_assert(IDX_TX_REQ, DBG_TIE_LOW); - kalUdelay(1); - mtk_wcn_stp_debug_gpio_assert(IDX_TX_REQ, DBG_TIE_HIGH); - } - #endif - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 26) - u2QueueIdx = skb_get_queue_mapping(prSkb); - ASSERT(u2QueueIdx < CFG_MAX_TXQ_NUM); -#endif - - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_TX_QUE); - QUEUE_INSERT_TAIL(prTxQueue, prQueueEntry); - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_TX_QUE); - - GLUE_INC_REF_CNT(prGlueInfo->i4TxPendingFrameNum); - GLUE_INC_REF_CNT(prGlueInfo->ai4TxPendingFrameNumPerQueue[NETWORK_TYPE_AIS_INDEX][u2QueueIdx]); - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 26) - if (prGlueInfo->ai4TxPendingFrameNumPerQueue[NETWORK_TYPE_AIS_INDEX][u2QueueIdx] >= CFG_TX_STOP_NETIF_PER_QUEUE_THRESHOLD) { - netif_stop_subqueue(prDev, u2QueueIdx); - } -#else - if (prGlueInfo->i4TxPendingFrameNum >= CFG_TX_STOP_NETIF_QUEUE_THRESHOLD) { - netif_stop_queue(prDev); - } -#endif - } else { - //printk("is security frame\n"); - - GLUE_INC_REF_CNT(prGlueInfo->i4TxPendingSecurityFrameNum); - } - - DBGLOG(TX, EVENT, ("\n+++++ pending frame %d len = %d +++++\n", prGlueInfo->i4TxPendingFrameNum, prSkb->len)); - prGlueInfo->rNetDevStats.tx_bytes += prSkb->len; - prGlueInfo->rNetDevStats.tx_packets++; - - //pr->u4Flag |= GLUE_FLAG_TXREQ; - //wake_up_interruptible(&prGlueInfo->waitq); - kalSetEvent(prGlueInfo); - - - /* For Linux, we'll always return OK FLAG, because we'll free this skb by ourself */ - return NETDEV_TX_OK; -} /* end of wlanHardStartXmit() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief A method of struct net_device, to get the network interface statistical -* information. -* -* Whenever an application needs to get statistics for the interface, this method -* is called. This happens, for example, when ifconfig or netstat -i is run. -* -* \param[in] prDev Pointer to struct net_device. -* -* \return net_device_stats buffer pointer. -*/ -/*----------------------------------------------------------------------------*/ -struct net_device_stats * -wlanGetStats ( - IN struct net_device *prDev - ) -{ - P_GLUE_INFO_T prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - - #if 0 - WLAN_STATUS rStatus; - UINT_32 u4XmitError = 0; - UINT_32 u4XmitOk = 0; - UINT_32 u4RecvError = 0; - UINT_32 u4RecvOk = 0; - UINT_32 u4BufLen; - - ASSERT(prDev); - - /* @FIX ME: need a more clear way to do this */ - - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryXmitError, - &u4XmitError, - sizeof(UINT_32), - TRUE, - TRUE, - TRUE, - &u4BufLen); - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryXmitOk, - &u4XmitOk, - sizeof(UINT_32), - TRUE, - TRUE, - TRUE, - &u4BufLen); - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryRcvOk, - &u4RecvOk, - sizeof(UINT_32), - TRUE, - TRUE, - TRUE, - &u4BufLen); - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryRcvError, - &u4RecvError, - sizeof(UINT_32), - TRUE, - TRUE, - TRUE, - &u4BufLen); - prGlueInfo->rNetDevStats.rx_packets = u4RecvOk; - prGlueInfo->rNetDevStats.tx_packets = u4XmitOk; - prGlueInfo->rNetDevStats.tx_errors = u4XmitError; - prGlueInfo->rNetDevStats.rx_errors = u4RecvError; - //prGlueInfo->rNetDevStats.rx_bytes = rCustomNetDevStats.u4RxBytes; - //prGlueInfo->rNetDevStats.tx_bytes = rCustomNetDevStats.u4TxBytes; - //prGlueInfo->rNetDevStats.rx_errors = rCustomNetDevStats.u4RxErrors; - //prGlueInfo->rNetDevStats.multicast = rCustomNetDevStats.u4Multicast; - #endif - //prGlueInfo->rNetDevStats.rx_packets = 0; - //prGlueInfo->rNetDevStats.tx_packets = 0; - prGlueInfo->rNetDevStats.tx_errors = 0; - prGlueInfo->rNetDevStats.rx_errors = 0; - //prGlueInfo->rNetDevStats.rx_bytes = 0; - //prGlueInfo->rNetDevStats.tx_bytes = 0; - prGlueInfo->rNetDevStats.rx_errors = 0; - prGlueInfo->rNetDevStats.multicast = 0; - - return &prGlueInfo->rNetDevStats; - -} /* end of wlanGetStats() */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief A function for prDev->init -* -* \param[in] prDev Pointer to struct net_device. -* -* \retval 0 The execution of wlanInit succeeds. -* \retval -ENXIO No such device. -*/ -/*----------------------------------------------------------------------------*/ -static int -wlanInit( - struct net_device *prDev - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - if (!prDev) { - return -ENXIO; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 12) - INIT_DELAYED_WORK(&workq, wlanSetMulticastListWorkQueue); -#else - INIT_DELAYED_WORK(&workq, wlanSetMulticastListWorkQueue, NULL); -#endif - - return 0; /* success */ -} /* end of wlanInit() */ - -void mtk_init_delayed_work(struct delayed_work *work, void *func) -{ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 12) - INIT_DELAYED_WORK(work, func); -#else - INIT_DELAYED_WORK(work, func, NULL); -#endif -} -EXPORT_SYMBOL(mtk_init_delayed_work); - -/*----------------------------------------------------------------------------*/ -/*! -* \brief A function for prDev->uninit -* -* \param[in] prDev Pointer to struct net_device. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -static void -wlanUninit( - struct net_device *prDev - ) -{ - return; -} /* end of wlanUninit() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief A function for prDev->open -* -* \param[in] prDev Pointer to struct net_device. -* -* \retval 0 The execution of wlanOpen succeeds. -* \retval < 0 The execution of wlanOpen failed. -*/ -/*----------------------------------------------------------------------------*/ -static int -wlanOpen( - struct net_device *prDev - ) -{ - ASSERT(prDev); - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 26) - netif_tx_start_all_queues(prDev); -#else - netif_start_queue(prDev); -#endif - - return 0; /* success */ -} /* end of wlanOpen() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief A function for prDev->stop -* -* \param[in] prDev Pointer to struct net_device. -* -* \retval 0 The execution of wlanStop succeeds. -* \retval < 0 The execution of wlanStop failed. -*/ -/*----------------------------------------------------------------------------*/ -static int -wlanStop( - struct net_device *prDev - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - struct cfg80211_scan_request *prScanRequest = NULL; - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - - /* CFG80211 down */ - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_NET_DEV); - if(prGlueInfo->prScanRequest != NULL) { - prScanRequest = prGlueInfo->prScanRequest; - prGlueInfo->prScanRequest = NULL; - } - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_NET_DEV); - - if(prScanRequest) { - cfg80211_scan_done(prScanRequest, TRUE); - } - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 26) - netif_tx_stop_all_queues(prDev); -#else - netif_stop_queue(prDev); -#endif - - return 0; /* success */ -} /* end of wlanStop() */ - - -/*----------------------------------------------------------------------------*/ -/*! - * \brief Update Channel table for cfg80211 for Wi-Fi Direct based on current country code - * - * \param[in] prGlueInfo Pointer to glue info - * - * \return none - */ -/*----------------------------------------------------------------------------*/ -VOID -wlanUpdateChannelTable( - P_GLUE_INFO_T prGlueInfo - ) -{ - UINT_8 i, j; - UINT_8 ucNumOfChannel; - RF_CHANNEL_INFO_T aucChannelList[ARRAY_SIZE(mtk_2ghz_channels) + ARRAY_SIZE(mtk_5ghz_channels)]; - - // 1. Disable all channel - for(i = 0; i < ARRAY_SIZE(mtk_2ghz_channels); i++) { - mtk_2ghz_channels[i].flags |= IEEE80211_CHAN_DISABLED; - } - - for(i = 0; i < ARRAY_SIZE(mtk_5ghz_channels); i++) { - mtk_5ghz_channels[i].flags |= IEEE80211_CHAN_DISABLED; - } - - // 2. Get current domain channel list - rlmDomainGetChnlList(prGlueInfo->prAdapter, - BAND_NULL, - ARRAY_SIZE(mtk_2ghz_channels) + ARRAY_SIZE(mtk_5ghz_channels), - &ucNumOfChannel, - aucChannelList); - - // 3. Enable specific channel based on domain channel list - for(i = 0; i < ucNumOfChannel; i++) { - switch(aucChannelList[i].eBand) { - case BAND_2G4: - for(j = 0 ; j < ARRAY_SIZE(mtk_2ghz_channels) ; j++) { - if(mtk_2ghz_channels[j].hw_value == aucChannelList[i].ucChannelNum) { - mtk_2ghz_channels[j].flags &= ~IEEE80211_CHAN_DISABLED; - break; - } - } - break; - - case BAND_5G: - for(j = 0 ; j < ARRAY_SIZE(mtk_5ghz_channels) ; j++) { - if(mtk_5ghz_channels[j].hw_value == aucChannelList[i].ucChannelNum) { - mtk_5ghz_channels[j].flags &= ~IEEE80211_CHAN_DISABLED; - break; - } - } - break; - - default: - break; - } - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Register the device to the kernel and return the index. -* -* \param[in] prDev Pointer to struct net_device. -* -* \retval 0 The execution of wlanNetRegister succeeds. -* \retval < 0 The execution of wlanNetRegister failed. -*/ -/*----------------------------------------------------------------------------*/ -static INT_32 -wlanNetRegister( - struct wireless_dev *prWdev - ) -{ - P_GLUE_INFO_T prGlueInfo; - INT_32 i4DevIdx = -1; - - ASSERT(prWdev); - - - do { - if (!prWdev) { - break; - } - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(prWdev->wiphy); - - if ((i4DevIdx = wlanGetDevIdx(prWdev->netdev)) < 0) { - DBGLOG(INIT, ERROR, ("wlanNetRegister: net_device number exceeds.\n")); - break; - } - - /* adjust channel support status */ - wlanUpdateChannelTable((P_GLUE_INFO_T) wiphy_priv(prWdev->wiphy)); - - if (wiphy_register(prWdev->wiphy) < 0) { - DBGLOG(INIT, ERROR, ("wlanNetRegister: wiphy context is not registered.\n")); - wlanClearDevIdx(prWdev->netdev); - i4DevIdx = -1; - } - - if(register_netdev(prWdev->netdev) < 0) { - DBGLOG(INIT, ERROR, ("wlanNetRegister: net_device context is not registered.\n")); - - wiphy_unregister(prWdev->wiphy); - wlanClearDevIdx(prWdev->netdev); - i4DevIdx = -1; - } - - if(i4DevIdx != -1) { - prGlueInfo->fgIsRegistered = TRUE; - } - } - while(FALSE); - - return i4DevIdx; /* success */ -} /* end of wlanNetRegister() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Unregister the device from the kernel -* -* \param[in] prWdev Pointer to struct net_device. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -static VOID -wlanNetUnregister( - struct wireless_dev *prWdev - ) -{ - P_GLUE_INFO_T prGlueInfo; - - if (!prWdev) { - DBGLOG(INIT, ERROR, ("wlanNetUnregister: The device context is NULL\n")); - return; - } - - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(prWdev->wiphy); - - wlanClearDevIdx(prWdev->netdev); - unregister_netdev(prWdev->netdev); - wiphy_unregister(prWdev->wiphy); - - prGlueInfo->fgIsRegistered = FALSE; - - DBGLOG(INIT, INFO, ("unregister wireless_dev(0x%p)\n", prWdev)); - - return; -} /* end of wlanNetUnregister() */ - - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) -static const struct net_device_ops wlan_netdev_ops = { - .ndo_open = wlanOpen, - .ndo_stop = wlanStop, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - .ndo_set_rx_mode = wlanSetMulticastList, -#else - .ndo_set_multicast_list = wlanSetMulticastList, -#endif - .ndo_get_stats = wlanGetStats, - .ndo_do_ioctl = wlanDoIOCTL, - .ndo_start_xmit = wlanHardStartXmit, - .ndo_init = wlanInit, - .ndo_uninit = wlanUninit, - .ndo_select_queue = wlanSelectQueue, -}; -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief A method for creating Linux NET4 struct net_device object and the -* private data(prGlueInfo and prAdapter). Setup the IO address to the HIF. -* Assign the function pointer to the net_device object -* -* \param[in] pvData Memory address for the device -* -* \retval Not null The wireless_dev object. -* \retval NULL Fail to create wireless_dev object -*/ -/*----------------------------------------------------------------------------*/ -static struct wireless_dev * -wlanNetCreate( - PVOID pvData - ) -{ - struct wireless_dev *prWdev = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - P_ADAPTER_T prAdapter = NULL; - UINT_32 i; - struct device *prDev; - - //4 <1.1> Create wireless_dev - prWdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); - DBGLOG(INIT, INFO, ("wireless_dev prWdev(0x%p) allocated\n", prWdev)); - if (!prWdev) { - DBGLOG(INIT, ERROR, ("Allocating memory to wireless_dev context failed\n")); - return NULL; - } - - //4 <1.2> Create wiphy - prWdev->wiphy = wiphy_new(&mtk_wlan_ops, sizeof(GLUE_INFO_T)); - DBGLOG(INIT, INFO, ("wiphy (0x%p) allocated\n", prWdev->wiphy)); - if (!prWdev->wiphy) { - DBGLOG(INIT, ERROR, ("Allocating memory to wiphy device failed\n")); - kfree(prWdev); - return NULL; - } - - //4 <1.3> co-relate wiphy & prDev -#if MTK_WCN_HIF_SDIO - mtk_wcn_hif_sdio_get_dev(*((MTK_WCN_HIF_SDIO_CLTCTX *)pvData), &prDev); -#else - prDev = & ((struct sdio_func *) pvData)->dev; //mark skynine add "&" -#endif - if (!prDev) { - printk(KERN_ALERT DRV_NAME "unable to get struct dev for wlan\n"); - } - set_wiphy_dev(prWdev->wiphy, prDev); - - //4 <1.4> configure wireless_dev & wiphy - prWdev->iftype = NL80211_IFTYPE_STATION; - prWdev->wiphy->max_scan_ssids = 1; /* FIXME: for combo scan */ - prWdev->wiphy->max_scan_ie_len = 512; - prWdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); - prWdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &mtk_band_2ghz; - prWdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &mtk_band_5ghz; - prWdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - prWdev->wiphy->cipher_suites = (const u32 *)mtk_cipher_suites; - prWdev->wiphy->n_cipher_suites = ARRAY_SIZE(mtk_cipher_suites); - #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - prWdev->wiphy->flags = WIPHY_FLAG_CUSTOM_REGULATORY | WIPHY_FLAG_SUPPORTS_FW_ROAM; - #else - prWdev->wiphy->flags = WIPHY_FLAG_CUSTOM_REGULATORY; - #endif - //4 <2> Create Glue structure - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(prWdev->wiphy); - if (!prGlueInfo) { - DBGLOG(INIT, ERROR, ("Allocating memory to glue layer failed\n")); - goto netcreate_err; - } - - //4 <3> Initial Glue structure - //4 <3.1> create net device - prGlueInfo->prDevHandler = alloc_netdev_mq(sizeof(P_GLUE_INFO_T), NIC_INF_NAME, ether_setup, CFG_MAX_TXQ_NUM); - - DBGLOG(INIT, INFO, ("net_device prDev(0x%p) allocated\n", prGlueInfo->prDevHandler)); - if (!prGlueInfo->prDevHandler) { - DBGLOG(INIT, ERROR, ("Allocating memory to net_device context failed\n")); - goto netcreate_err; - } - - //4 <3.1.1> initialize net device varaiables - *((P_GLUE_INFO_T *) netdev_priv(prGlueInfo->prDevHandler)) = prGlueInfo; - - prGlueInfo->prDevHandler->netdev_ops = &wlan_netdev_ops; -#ifdef CONFIG_WIRELESS_EXT - prGlueInfo->prDevHandler->wireless_handlers = &wext_handler_def; -#endif - netif_carrier_off(prGlueInfo->prDevHandler); - netif_tx_stop_all_queues(prGlueInfo->prDevHandler); - - //4 <3.1.2> co-relate with wiphy bi-directionally - prGlueInfo->prDevHandler->ieee80211_ptr = prWdev; - prWdev->netdev = prGlueInfo->prDevHandler; - - //4 <3.1.3> co-relate net device & prDev - SET_NETDEV_DEV(prGlueInfo->prDevHandler, wiphy_dev(prWdev->wiphy)); - - //4 <3.2> initiali glue variables - prGlueInfo->eParamMediaStateIndicated = PARAM_MEDIA_STATE_DISCONNECTED; - prGlueInfo->ePowerState = ParamDeviceStateD0; - prGlueInfo->fgIsMacAddrOverride = FALSE; - prGlueInfo->fgIsRegistered = FALSE; - prGlueInfo->prScanRequest = NULL; - - init_completion(&prGlueInfo->rScanComp); - init_completion(&prGlueInfo->rHaltComp); - init_completion(&prGlueInfo->rPendComp); -#if CFG_ENABLE_WIFI_DIRECT - init_completion(&prGlueInfo->rSubModComp); -#endif - - /* initialize timer for OID timeout checker */ - kalOsTimerInitialize(prGlueInfo, kalTimeoutHandler); - - for (i = 0; i < SPIN_LOCK_NUM; i++) { - spin_lock_init(&prGlueInfo->rSpinLock[i]); - } - - /* initialize semaphore for ioctl */ - sema_init(&prGlueInfo->ioctl_sem, 1); - - /* initialize semaphore for ioctl */ - sema_init(&g_halt_sem, 1); - g_u4HaltFlag = 0; - - //4 <4> Create Adapter structure - prAdapter = (P_ADAPTER_T) wlanAdapterCreate(prGlueInfo); - - if (!prAdapter) { - DBGLOG(INIT, ERROR, ("Allocating memory to adapter failed\n")); - goto netcreate_err; - } - - prGlueInfo->prAdapter = prAdapter; - -#ifdef CONFIG_CFG80211_WEXT - //4 <5> Use wireless extension to replace IOCTL - prWdev->wiphy->wext = &wext_handler_def; -#endif - - goto netcreate_done; - -netcreate_err: - if (NULL != prAdapter) { - wlanAdapterDestroy(prAdapter); - prAdapter = NULL; - } - - if (NULL != prGlueInfo->prDevHandler) { - free_netdev(prGlueInfo->prDevHandler); - prGlueInfo->prDevHandler = NULL; - } - - if (NULL != prWdev->wiphy) { - wiphy_free(prWdev->wiphy); - prWdev->wiphy = NULL; - } - - if (NULL != prWdev) { - /* Free net_device and private data, which are allocated by - * alloc_netdev(). - */ - kfree(prWdev); - prWdev = NULL; - } - -netcreate_done: - - return prWdev; -} /* end of wlanNetCreate() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Destroying the struct net_device object and the private data. -* -* \param[in] prWdev Pointer to struct wireless_dev. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -static VOID -wlanNetDestroy( - struct wireless_dev *prWdev - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prWdev); - - if (!prWdev) { - DBGLOG(INIT, ERROR, ("wlanNetDestroy: The device context is NULL\n")); - return; - } - - /* prGlueInfo is allocated with net_device */ - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(prWdev->wiphy); - ASSERT(prGlueInfo); - - /* destroy kal OS timer */ - kalCancelTimer(prGlueInfo); - - glClearHifInfo(prGlueInfo); - - wlanAdapterDestroy(prGlueInfo->prAdapter); - prGlueInfo->prAdapter = NULL; - - /* Free net_device and private data, which are allocated by alloc_netdev(). - */ - free_netdev(prWdev->netdev); - wiphy_free(prWdev->wiphy); - - kfree(prWdev); - - return; -} /* end of wlanNetDestroy() */ - -#ifndef CONFIG_X86 -UINT_8 g_aucBufIpAddr[32] = {0}; - -static void wlanEarlySuspend(void) -{ - struct net_device *prDev = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - UINT_8 ip[4] = { 0 }; - UINT_32 u4NumIPv4 = 0; -#ifdef CONFIG_IPV6 - UINT_8 ip6[16] = { 0 }; // FIX ME: avoid to allocate large memory in stack - UINT_32 u4NumIPv6 = 0; -#endif - UINT_32 i; - P_PARAM_NETWORK_ADDRESS_IP prParamIpAddr; - - DBGLOG(INIT, INFO, ("*********wlanEarlySuspend************\n")); - - // <1> Sanity check and acquire the net_device - ASSERT(u4WlanDevNum <= CFG_MAX_WLAN_DEVICES); - if(u4WlanDevNum == 0){ - DBGLOG(INIT, ERROR, ("wlanEarlySuspend u4WlanDevNum==0 invalid!!\n")); - return; - } - prDev = arWlanDevInfo[u4WlanDevNum-1].prDev; - ASSERT(prDev); - -fgIsUnderEarlierSuspend = true; - - // <2> get the IPv4 address - if(!prDev || !(prDev->ip_ptr)||\ - !((struct in_device *)(prDev->ip_ptr))->ifa_list||\ - !(&(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local))){ - DBGLOG(INIT, INFO, ("ip is not avaliable.\n")); - return; - } - - // <3> acquire the prGlueInfo - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - // <4> copy the IPv4 address - kalMemCopy(ip, &(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local), sizeof(ip)); - DBGLOG(INIT, INFO, ("ip is %d.%d.%d.%d\n", - ip[0],ip[1],ip[2],ip[3])); - - // todo: traverse between list to find whole sets of IPv4 addresses - if (!((ip[0] == 0) && - (ip[1] == 0) && - (ip[2] == 0) && - (ip[3] == 0))) { - u4NumIPv4++; - } - -#ifdef CONFIG_IPV6 - // <5> get the IPv6 address - if(!prDev || !(prDev->ip6_ptr)||\ - !((struct in_device *)(prDev->ip6_ptr))->ifa_list||\ - !(&(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local))){ - DBGLOG(INIT, INFO, ("ipv6 is not avaliable.\n")); - return; - } - // <6> copy the IPv6 address - kalMemCopy(ip6, &(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local), sizeof(ip6)); - DBGLOG(INIT, INFO, ("ipv6 is %d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d\n", - ip6[0],ip6[1],ip6[2],ip6[3], - ip6[4],ip6[5],ip6[6],ip6[7], - ip6[8],ip6[9],ip6[10],ip6[11], - ip6[12],ip6[13],ip6[14],ip6[15] - )); - - // todo: traverse between list to find whole sets of IPv6 addresses - if (!((ip6[0] == 0) && - (ip6[1] == 0) && - (ip6[2] == 0) && - (ip6[3] == 0) && - (ip6[4] == 0) && - (ip6[5] == 0))) { - //u4NumIPv6++; - } - -#endif - - // <7> set up the ARP filter - { - WLAN_STATUS rStatus = WLAN_STATUS_FAILURE; - UINT_32 u4SetInfoLen = 0; -// UINT_8 aucBuf[32] = {0}; - UINT_32 u4Len = OFFSET_OF(PARAM_NETWORK_ADDRESS_LIST, arAddress); - P_PARAM_NETWORK_ADDRESS_LIST prParamNetAddrList = (P_PARAM_NETWORK_ADDRESS_LIST)g_aucBufIpAddr;//aucBuf; - P_PARAM_NETWORK_ADDRESS prParamNetAddr = prParamNetAddrList->arAddress; - - kalMemZero(g_aucBufIpAddr, sizeof(g_aucBufIpAddr)); - - prParamNetAddrList->u4AddressCount = u4NumIPv4 + u4NumIPv6; - prParamNetAddrList->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP; - for (i = 0; i < u4NumIPv4; i++) { - prParamNetAddr->u2AddressLength = sizeof(PARAM_NETWORK_ADDRESS_IP);//4;; - prParamNetAddr->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP;; -#if 0 - kalMemCopy(prParamNetAddr->aucAddress, ip, sizeof(ip)); - prParamNetAddr = (P_PARAM_NETWORK_ADDRESS)((UINT_32)prParamNetAddr + sizeof(ip)); - u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(ip); -#else - prParamIpAddr = (P_PARAM_NETWORK_ADDRESS_IP)prParamNetAddr->aucAddress; - kalMemCopy(&prParamIpAddr->in_addr, ip, sizeof(ip)); - prParamNetAddr = (P_PARAM_NETWORK_ADDRESS)((UINT_32)prParamNetAddr + sizeof(PARAM_NETWORK_ADDRESS)); - u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(PARAM_NETWORK_ADDRESS); -#endif - } -#ifdef CONFIG_IPV6 - for (i = 0; i < u4NumIPv6; i++) { - prParamNetAddr->u2AddressLength = 6;; - prParamNetAddr->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP;; - kalMemCopy(prParamNetAddr->aucAddress, ip6, sizeof(ip6)); - prParamNetAddr = (P_PARAM_NETWORK_ADDRESS)((UINT_32)prParamNetAddr + sizeof(ip6)); - u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(ip6); - } -#endif - ASSERT(u4Len <= sizeof(g_aucBufIpAddr/*aucBuf*/)); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetNetworkAddress, - (PVOID)prParamNetAddrList, - u4Len, - FALSE, - FALSE, - TRUE, - FALSE, - &u4SetInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("set HW pattern filter fail 0x%lx\n", rStatus)); - } - } -} - -static void wlanLateResume(void) -{ - struct net_device *prDev = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - UINT_8 ip[4] = { 0 }; -#ifdef CONFIG_IPV6 - UINT_8 ip6[16] = { 0 }; // FIX ME: avoid to allocate large memory in stack -#endif - - DBGLOG(INIT, INFO, ("*********wlanLateResume************\n")); - - // <1> Sanity check and acquire the net_device - ASSERT(u4WlanDevNum <= CFG_MAX_WLAN_DEVICES); - - if(u4WlanDevNum == 0){ - DBGLOG(INIT, ERROR, ("wlanLateResume u4WlanDevNum==0 invalid!!\n")); - return; - } - prDev = arWlanDevInfo[u4WlanDevNum-1].prDev; - ASSERT(prDev); - -fgIsUnderEarlierSuspend = false; - - // <2> get the IPv4 address - if(!prDev || !(prDev->ip_ptr)||\ - !((struct in_device *)(prDev->ip_ptr))->ifa_list||\ - !(&(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local))){ - DBGLOG(INIT, INFO, ("ip is not avaliable.\n")); - return; - } - - // <3> acquire the prGlueInfo - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - // <4> copy the IPv4 address - kalMemCopy(ip, &(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local), sizeof(ip)); - DBGLOG(INIT, INFO, ("ip is %d.%d.%d.%d\n", - ip[0],ip[1],ip[2],ip[3])); - -#ifdef CONFIG_IPV6 - // <5> get the IPv6 address - if(!prDev || !(prDev->ip6_ptr)||\ - !((struct in_device *)(prDev->ip6_ptr))->ifa_list||\ - !(&(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local))){ - DBGLOG(INIT, INFO, ("ipv6 is not avaliable.\n")); - return; - } - // <6> copy the IPv6 address - kalMemCopy(ip6, &(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local), sizeof(ip6)); - DBGLOG(INIT, INFO, ("ipv6 is %d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d\n", - ip6[0],ip6[1],ip6[2],ip6[3], - ip6[4],ip6[5],ip6[6],ip6[7], - ip6[8],ip6[9],ip6[10],ip6[11], - ip6[12],ip6[13],ip6[14],ip6[15] - )); -#endif - // <7> clear the ARP filter - { - WLAN_STATUS rStatus = WLAN_STATUS_FAILURE; - UINT_32 u4SetInfoLen = 0; -// UINT_8 aucBuf[32] = {0}; - UINT_32 u4Len = sizeof(PARAM_NETWORK_ADDRESS_LIST); - P_PARAM_NETWORK_ADDRESS_LIST prParamNetAddrList = (P_PARAM_NETWORK_ADDRESS_LIST)g_aucBufIpAddr;//aucBuf; - - kalMemZero(g_aucBufIpAddr, sizeof(g_aucBufIpAddr)); - - prParamNetAddrList->u4AddressCount = 0; - prParamNetAddrList->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP; - - ASSERT(u4Len <= sizeof(g_aucBufIpAddr/*aucBuf*/)); - rStatus = kalIoctl(prGlueInfo, - wlanoidSetNetworkAddress, - (PVOID)prParamNetAddrList, - u4Len, - FALSE, - FALSE, - TRUE, - FALSE, - &u4SetInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("set HW pattern filter fail 0x%lx\n", rStatus)); - } - } -} - -#if defined(CONFIG_HAS_EARLYSUSPEND) -static struct early_suspend mt6620_early_suspend_desc = { - .level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN, -}; - -static void wlan_early_suspend(struct early_suspend *h) -{ - DBGLOG(INIT, INFO, ("*********wlan_early_suspend************\n")); - wlanEarlySuspend(); -} - -static void wlan_late_resume(struct early_suspend *h) -{ - DBGLOG(INIT, INFO, ("*********wlan_late_resume************\n")); - wlanLateResume(); -} -#endif //defined(CONFIG_HAS_EARLYSUSPEND) -#endif //! CONFIG_X86 - -extern void wlanRegisterNotifier(void); -extern void wlanUnregisterNotifier(void); - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Wlan probe function. This function probes and initializes the device. -* -* \param[in] pvData data passed by bus driver init function -* _HIF_EHPI: NULL -* _HIF_SDIO: sdio bus driver handle -* -* \retval 0 Success -* \retval negative value Failed -*/ -/*----------------------------------------------------------------------------*/ -static INT_32 -wlanProbe( - PVOID pvData - ) -{ - struct wireless_dev *prWdev = NULL; - P_WLANDEV_INFO_T prWlandevInfo = NULL; - INT_32 i4DevIdx = 0; - P_GLUE_INFO_T prGlueInfo = NULL; - P_ADAPTER_T prAdapter = NULL; - INT_32 i4Status = 0; - BOOL bRet = FALSE; - - - do { -#if DBG - int i; - /* Initialize DEBUG CLASS of each module */ - for (i = 0; i < DBG_MODULE_NUM; i++) { - aucDebugModule[i] = DBG_CLASS_ERROR | \ - DBG_CLASS_WARN | \ - DBG_CLASS_STATE | \ - DBG_CLASS_TRACE | \ - DBG_CLASS_EVENT; - //aucDebugModule[i] = 0; - } -#if 0 - aucDebugModule[DBG_INIT_IDX] |= DBG_CLASS_TRACE | DBG_CLASS_INFO; - aucDebugModule[DBG_ARB_IDX] |= DBG_CLASS_TRACE | DBG_CLASS_INFO; - aucDebugModule[DBG_JOIN_IDX] |= DBG_CLASS_TRACE | DBG_CLASS_INFO; - //aucDebugModule[DBG_RX_IDX] |= DBG_CLASS_TRACE | DBG_CLASS_INFO; - aucDebugModule[DBG_TX_IDX] |= DBG_CLASS_TRACE | DBG_CLASS_INFO; - aucDebugModule[DBG_NIC_IDX] |= DBG_CLASS_TRACE | DBG_CLASS_INFO; - aucDebugModule[DBG_HAL_IDX] |= DBG_CLASS_TRACE | DBG_CLASS_INFO; - aucDebugModule[DBG_KEVIN_IDX] |= DBG_CLASS_TRACE | DBG_CLASS_INFO | DBG_CLASS_TEMP; - aucDebugModule[DBG_SCAN_IDX] |= DBG_CLASS_TRACE | DBG_CLASS_INFO; - aucDebugModule[DBG_REQ_IDX] |= DBG_CLASS_TRACE | DBG_CLASS_INFO; - //aucDebugModule[DBG_MGT_IDX] |= DBG_CLASS_TRACE | DBG_CLASS_INFO; - aucDebugModule[DBG_RSN_IDX] |= DBG_CLASS_TRACE; - aucDebugModule[DBG_ROAMING_IDX] |= DBG_CLASS_TRACE | DBG_CLASS_INFO; -#endif -#endif /* DBG */ - - //4 <1> Initialize the IO port of the interface - /* GeorgeKuo: pData has different meaning for _HIF_XXX: - * _HIF_EHPI: pointer to memory base variable, which will be - * initialized by glBusInit(). - * _HIF_SDIO: bus driver handle - */ - - bRet = glBusInit(pvData); - - /* Cannot get IO address from interface */ - if (FALSE == bRet) { - DBGLOG(INIT, ERROR, (KERN_ALERT "wlanProbe: glBusInit() fail\n")); - i4Status = -EIO; - break; - } - - //4 <2> Create network device, Adapter, KalInfo, prDevHandler(netdev) - if ((prWdev = wlanNetCreate(pvData)) == NULL) { - DBGLOG(INIT, ERROR, ("wlanProbe: No memory for dev and its private\n")); - i4Status = -ENOMEM; - break; - } - - //4 <2.5> Set the ioaddr to HIF Info - prGlueInfo = (P_GLUE_INFO_T) wiphy_priv(prWdev->wiphy); - gPrDev = prGlueInfo->prDevHandler; - glSetHifInfo(prGlueInfo, (UINT_32) pvData); - - - /* main thread is created in this function */ - init_waitqueue_head(&prGlueInfo->waitq); - // - - QUEUE_INITIALIZE(&prGlueInfo->rCmdQueue); - QUEUE_INITIALIZE(&prGlueInfo->rTxQueue); - - - - //prGlueInfo->main_thread = kthread_run(tx_thread, prGlueInfo->prDevHandler, "tx_thread"); - - //4 <4> Setup IRQ - prWlandevInfo = &arWlanDevInfo[i4DevIdx]; - - //i4Status = glBusSetIrq(prWdev->netdev, NULL, *((P_GLUE_INFO_T *) netdev_priv(prWdev->netdev))); - - if (i4Status != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, ERROR, ("wlanProbe: Set IRQ error\n")); - break; - } - - prGlueInfo->i4DevIdx = i4DevIdx; - - prAdapter = prGlueInfo->prAdapter; - - prGlueInfo->u4ReadyFlag = 0; - -#if CFG_TCP_IP_CHKSUM_OFFLOAD - prAdapter->u4CSUMFlags = (CSUM_OFFLOAD_EN_TX_TCP | CSUM_OFFLOAD_EN_TX_UDP | CSUM_OFFLOAD_EN_TX_IP); -#endif - - //4 <5> Start Device - // -#if CFG_ENABLE_FW_DOWNLOAD - /* before start adapter, we need to open and load firmware */ - { - UINT_32 u4FwSize = 0; - PVOID prFwBuffer = NULL; - P_REG_INFO_T prRegInfo = &prGlueInfo->rRegInfo; - - //P_REG_INFO_T prRegInfo = (P_REG_INFO_T) kmalloc(sizeof(REG_INFO_T), GFP_KERNEL); - kalMemSet(prRegInfo, 0, sizeof(REG_INFO_T)); - prRegInfo->u4StartAddress = CFG_FW_START_ADDRESS; - prRegInfo->u4LoadAddress = CFG_FW_LOAD_ADDRESS; - - // Load NVRAM content to REG_INFO_T - glLoadNvram(prGlueInfo, prRegInfo); - - //kalMemCopy(&prGlueInfo->rRegInfo, prRegInfo, sizeof(REG_INFO_T)); - - prRegInfo->u4PowerMode = CFG_INIT_POWER_SAVE_PROF; - prRegInfo->fgEnArpFilter = TRUE; - - if (kalFirmwareImageMapping(prGlueInfo, &prFwBuffer, &u4FwSize) == NULL) { - i4Status = -EIO; - goto bailout; - } else { - if (wlanAdapterStart(prAdapter, prRegInfo, prFwBuffer, u4FwSize) != WLAN_STATUS_SUCCESS) { - i4Status = -EIO; - } - } - - kalFirmwareImageUnmapping(prGlueInfo, NULL, prFwBuffer); - -bailout: - //kfree(prRegInfo); - - if (i4Status < 0) { - break; - } - } -#else - //P_REG_INFO_T prRegInfo = (P_REG_INFO_T) kmalloc(sizeof(REG_INFO_T), GFP_KERNEL); - kalMemSet(&prGlueInfo->rRegInfo, 0, sizeof(REG_INFO_T)); - P_REG_INFO_T prRegInfo = &prGlueInfo->rRegInfo; - - // Load NVRAM content to REG_INFO_T - glLoadNvram(prGlueInfo, prRegInfo); - - prRegInfo->u4PowerMode = CFG_INIT_POWER_SAVE_PROF; - - if (wlanAdapterStart(prAdapter, prRegInfo, NULL, 0) != WLAN_STATUS_SUCCESS) { - i4Status = -EIO; - break; - } -#endif - prGlueInfo->main_thread = kthread_run(tx_thread, prGlueInfo->prDevHandler, "tx_thread"); - - /* set MAC address */ - { - WLAN_STATUS rStatus = WLAN_STATUS_FAILURE; - struct sockaddr MacAddr; - UINT_32 u4SetInfoLen = 0; - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryCurrentAddr, - &MacAddr.sa_data, - PARAM_MAC_ADDR_LEN, - TRUE, - TRUE, - TRUE, - FALSE, - &u4SetInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, WARN, ("set MAC addr fail 0x%lx\n", rStatus)); - prGlueInfo->u4ReadyFlag = 0; - } else { - memcpy(prGlueInfo->prDevHandler->dev_addr, &MacAddr.sa_data, ETH_ALEN); - memcpy(prGlueInfo->prDevHandler->perm_addr, prGlueInfo->prDevHandler->dev_addr, ETH_ALEN); - - /* card is ready */ - prGlueInfo->u4ReadyFlag = 1; -#if CFG_SHOW_MACADDR_SOURCE - DBGLOG(INIT, INFO, ("MAC address: "MACSTR, MAC2STR(&MacAddr.sa_data))); -#endif - } - } - - -#if CFG_TCP_IP_CHKSUM_OFFLOAD - /* set HW checksum offload */ - { - WLAN_STATUS rStatus = WLAN_STATUS_FAILURE; - UINT_32 u4CSUMFlags = CSUM_OFFLOAD_EN_ALL; - UINT_32 u4SetInfoLen = 0; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetCSUMOffload, - (PVOID)&u4CSUMFlags, - sizeof(UINT_32), - FALSE, - FALSE, - TRUE, - FALSE, - &u4SetInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, WARN, ("set HW checksum offload fail 0x%lx\n", rStatus)); - } - } -#endif - - //4 <3> Register the card - if ((i4DevIdx = wlanNetRegister(prWdev)) < 0){ - i4Status = -ENXIO; - DBGLOG(INIT, ERROR, ("wlanProbe: Cannot register the net_device context to the kernel\n")); - break; - } - - glRegisterEarlySuspend(&mt6620_early_suspend_desc, wlan_early_suspend, wlan_late_resume); - wlanRegisterNotifier(); - //4 <6> Initialize /proc filesystem -#ifdef WLAN_INCLUDE_PROC - if ( (i4Status = procInitProcfs(prDev, NIC_DEVICE_ID_LOW)) < 0) { - DBGLOG(INIT, ERROR, ("wlanProbe: init procfs failed\n")); - break; - } -#endif /* WLAN_INCLUDE_PROC */ - -#if CFG_ENABLE_BT_OVER_WIFI - prGlueInfo->rBowInfo.fgIsNetRegistered = FALSE; - prGlueInfo->rBowInfo.fgIsRegistered = FALSE; - glRegisterAmpc(prGlueInfo); -#endif - -#if CFG_ENABLE_WIFI_DIRECT - /*wlan is launched*/ - prGlueInfo->prAdapter->fgIsWlanLaunched = TRUE; - /*if p2p module is inserted, notify tx_thread to init p2p network*/ - if(rSubModHandler[P2P_MODULE].subModInit) { - wlanSubModInit(prGlueInfo); - } -#endif - } - while (FALSE); - -#if 1//def RK2818 - if (i4Status < 0) - driver_start_ok = -1; - else - driver_start_ok = 1; -#endif - - return i4Status; -} /* end of wlanProbe() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief A method to stop driver operation and release all resources. Following -* this call, no frame should go up or down through this interface. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -static VOID -wlanRemove( - VOID - ) -{ - struct net_device *prDev = NULL; - P_WLANDEV_INFO_T prWlandevInfo = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - P_ADAPTER_T prAdapter = NULL; - - DBGLOG(INIT, INFO, ("Remove wlan!\n")); - - - //4 <0> Sanity check - ASSERT(u4WlanDevNum <= CFG_MAX_WLAN_DEVICES); - if (0 == u4WlanDevNum) { - DBGLOG(INIT, INFO, ("0 == u4WlanDevNum\n")); - return; - } - - prDev = arWlanDevInfo[u4WlanDevNum-1].prDev; - prWlandevInfo = &arWlanDevInfo[u4WlanDevNum-1]; - - ASSERT(prDev); - if (NULL == prDev) { - DBGLOG(INIT, INFO, ("NULL == prDev\n")); - return; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - if (NULL == prGlueInfo) { - DBGLOG(INIT, INFO, ("NULL == prGlueInfo\n")); - free_netdev(prDev); - return; - } - - -#if CFG_ENABLE_WIFI_DIRECT - prGlueInfo->prAdapter->fgIsWlanLaunched = FALSE; - if(prGlueInfo->prAdapter->fgIsP2PRegistered) { - p2pNetUnregister(prGlueInfo, FALSE); - p2pRemove(prGlueInfo); - } - -#if 0 - prGlueInfo->prAdapter->fgIsWlanLaunched = FALSE; - //if(prGlueInfo->prAdapter->fgIsP2PRegistered) { - if (prGlueInfo->prP2PInfo) { - //p2pRemove(prGlueInfo); - if (prGlueInfo->prP2PInfo->prDevHandler) { - free_netdev(prGlueInfo->prP2PInfo->prDevHandler); - prGlueInfo->prP2PInfo->prDevHandler = NULL; - - } - - - if(!p2PFreeInfo(prGlueInfo)) { - printk(KERN_ALERT DRV_NAME "Free memory for p2p FAILED\n"); - ASSERT(0); - return; - } - } -#endif -#endif - -#if CFG_ENABLE_BT_OVER_WIFI - if(prGlueInfo->rBowInfo.fgIsNetRegistered) { - bowNotifyAllLinkDisconnected(prGlueInfo->prAdapter); - /*wait 300ms for BoW module to send deauth*/ - kalMsleep(300); - } -#endif - - //4 <1> Stopping handling interrupt and free IRQ - glBusFreeIrq(prDev, *((P_GLUE_INFO_T *) netdev_priv(prDev))); - - kalMemSet(&(prGlueInfo->prAdapter->rWlanInfo), 0, sizeof(WLAN_INFO_T)); - - flush_delayed_work_sync(&workq); - - down(&g_halt_sem); - g_u4HaltFlag = 1; - - //4 <2> Mark HALT, notify main thread to stop, and clean up queued requests - prGlueInfo->u4Flag |= GLUE_FLAG_HALT; - /* wake up main thread */ - wake_up_interruptible(&prGlueInfo->waitq); - /* wait main thread stops */ - wait_for_completion_interruptible(&prGlueInfo->rHaltComp); - - DBGLOG(INIT, INFO, ("mtk_sdiod stopped\n")); - - //prGlueInfo->rHifInfo.main_thread = NULL; - prGlueInfo->main_thread = NULL; - -#if CFG_ENABLE_BT_OVER_WIFI - if(prGlueInfo->rBowInfo.fgIsRegistered) { - glUnregisterAmpc(prGlueInfo); - } -#endif - - - //4 <3> Remove /proc filesystem. -#ifdef WLAN_INCLUDE_PROC - procRemoveProcfs(prDev, NIC_DEVICE_ID_LOW); -#endif /* WLAN_INCLUDE_PROC */ - - //4 <4> wlanAdapterStop - prAdapter = prGlueInfo->prAdapter; - - wlanAdapterStop(prAdapter); - DBGLOG(INIT, INFO, ("Number of Stalled Packets = %ld\n", prGlueInfo->i4TxPendingFrameNum)); - - //4 <5> Release the Bus - glBusRelease(prDev); - - up(&g_halt_sem); - - //4 <6> Unregister the card - wlanNetUnregister(prDev->ieee80211_ptr); - - //4 <7> Destroy the device - wlanNetDestroy(prDev->ieee80211_ptr); - prDev = NULL; - - glUnregisterEarlySuspend(&mt6620_early_suspend_desc); - wlanUnregisterNotifier(); - return; -} /* end of wlanRemove() */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Driver entry point when the driver is configured as a Linux Module, and -* is called once at module load time, by the user-level modutils -* application: insmod or modprobe. -* -* \retval 0 Success -*/ -/*----------------------------------------------------------------------------*/ -//1 Module Entry Point - -#include "wifi_version.h" - -extern void initRssiHistory(void); -extern void initScanRssiHistory(void); -extern VOID exitWlan(void); -/*static */int initWlan(void) -{ - int ret = 0, timeout = 0; - int count = 3; - driver_start_ok = 0; - -#if RSSI_ENHANCE - initRssiHistory(); - initScanRssiHistory(); -#endif -retry_initwlan: - - //printk("=======================================================\n"); - //printk("==== Launching Wi-Fi driver! (Powered by Rockchip) ====\n"); - //printk("=======================================================\n"); - printk("MT5931 SDIO WiFi driver (Powered by Rockchip,Ver %s) init.\n", MT5931_DRV_VERSION); - - DBGLOG(INIT, INFO, ("initWlan\n")); - - -#if defined(CONFIG_WIFI_CONTROL_FUNC) - if (wl_android_wifictrl_func_add() < 0) { - ret = -1; - goto fail; - } -#endif - - /* memory pre-allocation */ - kalInitIOBuffer(); - - //return ((glRegisterBus(wlanProbe, wlanRemove) == WLAN_STATUS_SUCCESS) ? 0: -EIO); - ret = ((glRegisterBus(wlanProbe, wlanRemove) == WLAN_STATUS_SUCCESS) ? 0: -EIO); - - if (ret == -EIO) { - kalUninitIOBuffer(); - ret = -1; - goto fail; - } - -#if (CFG_CHIP_RESET_SUPPORT) - glResetInit(); -#endif - - /*WCNCR00002676, keep OS wake up for 100ms*/ - KAL_WAKE_LOCK_INIT(NULL, &isr_wakelock, "WLAN TIME 2"); - - /*for (timeout = 50; timeout >=0; timeout--) - { - if (driver_start_ok == 1) - return ret; - msleep(100); - } - if (timeout <= 0 && count > 0) - { - count--; - if (driver_start_ok == 0) - printk("No WiFi function card has been attached (5s). retry!\n"); - else if (driver_start_ok < 0) - printk("wifi driver probe processing fail. retry!\n"); - exitWlan(); - goto retry_initwlan; - }*/ - - return ret; - -fail: - -#if defined(CONFIG_WIFI_CONTROL_FUNC) - wl_android_wifictrl_func_del(); -#endif - - return ret; -} /* end of initWlan() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Driver exit point when the driver as a Linux Module is removed. Called -* at module unload time, by the user level modutils application: rmmod. -* This is our last chance to clean up after ourselves. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -//1 Module Leave Point -/*static */VOID exitWlan(void) -{ - //printk("=======================================================\n"); - //printk("== Dis-launching Wi-Fi driver! (Powered by Rockchip) ==\n"); - //printk("=======================================================\n"); - - //printk("remove %p\n", wlanRemove); -#if CFG_CHIP_RESET_SUPPORT - glResetUninit(); -#endif - - glUnregisterBus(wlanRemove); - - /*WCNCR00002676*/ - KAL_WAKE_LOCK_DESTROY(NULL, &isr_wakelock); - - /* free pre-allocated memory */ - kalUninitIOBuffer(); - -#if defined(CONFIG_WIFI_CONTROL_FUNC) - wl_android_wifictrl_func_del(); -#endif /* CONFIG_WIFI_CONTROL_FUNC */ - - DBGLOG(INIT, INFO, ("exitWlan\n")); - - return; -} /* end of exitWlan() */ - -int rockchip_wifi_init_module(void) -{ - initWlan(); -} - -int rockchip_wifi_exit_module(void) -{ - exitWlan(); -} - -EXPORT_SYMBOL(rockchip_wifi_init_module); -EXPORT_SYMBOL(rockchip_wifi_exit_module); - -//module_init(initWlan); -//module_exit(exitWlan); -#if 0 -/* export necessary symbol for p2p driver using */ -#if CFG_ENABLE_WIFI_DIRECT -EXPORT_SYMBOL(wlanSubModRegisterInitExit); -EXPORT_SYMBOL(wlanSubModExit); -EXPORT_SYMBOL(wlanSubModInit); - -EXPORT_SYMBOL(nicPmIndicateBssCreated); -EXPORT_SYMBOL(rlmProcessAssocRsp); -EXPORT_SYMBOL(kalSetEvent); -EXPORT_SYMBOL(rlmBssInitForAPandIbss); -EXPORT_SYMBOL(kalEnqueueCommand); -EXPORT_SYMBOL(nicIncreaseTxSeqNum); -EXPORT_SYMBOL(nicCmdEventQueryAddress); -EXPORT_SYMBOL(bssCreateStaRecFromBssDesc); -EXPORT_SYMBOL(rlmBssAborted); -EXPORT_SYMBOL(cnmStaRecResetStatus); -EXPORT_SYMBOL(mqmProcessAssocRsp); -EXPORT_SYMBOL(nicTxReturnMsduInfo); -EXPORT_SYMBOL(nicTxEnqueueMsdu); -EXPORT_SYMBOL(wlanProcessSecurityFrame); -EXPORT_SYMBOL(nicChannelNum2Freq); -EXPORT_SYMBOL(nicUpdateBss); -EXPORT_SYMBOL(wlanSendSetQueryCmd); -EXPORT_SYMBOL(cnmStaRecAlloc); -EXPORT_SYMBOL(cnmTimerInitTimer); -EXPORT_SYMBOL(rateGetRateSetFromIEs); -EXPORT_SYMBOL(nicOidCmdTimeoutCommon); -EXPORT_SYMBOL(cnmStaRecChangeState); -EXPORT_SYMBOL(rateGetDataRatesFromRateSet); -EXPORT_SYMBOL(cnmMgtPktAlloc); -EXPORT_SYMBOL(cnmMgtPktFree); -EXPORT_SYMBOL(wextSrchDesiredWPAIE); -EXPORT_SYMBOL(nicRxReturnRFB); -EXPORT_SYMBOL(cnmTimerStartTimer); -EXPORT_SYMBOL(cmdBufAllocateCmdInfo); -EXPORT_SYMBOL(cnmGetStaRecByAddress); -EXPORT_SYMBOL(nicMediaStateChange); -EXPORT_SYMBOL(bssUpdateBeaconContent); -EXPORT_SYMBOL(kalIoctl); -EXPORT_SYMBOL(nicActivateNetwork); -EXPORT_SYMBOL(nicDeactivateNetwork); -EXPORT_SYMBOL(kalRandomNumber); -EXPORT_SYMBOL(nicCmdEventSetCommon); -EXPORT_SYMBOL(cnmTimerStopTimer); -EXPORT_SYMBOL(nicIncreaseCmdSeqNum); -EXPORT_SYMBOL(authSendDeauthFrame); -EXPORT_SYMBOL(cnmMemAlloc); -EXPORT_SYMBOL(nicPmIndicateBssAbort); -EXPORT_SYMBOL(nicCmdEventSetIpAddress); -EXPORT_SYMBOL(mboxSendMsg); -EXPORT_SYMBOL(scanSearchBssDescByBssid); -EXPORT_SYMBOL(bssRemoveStaRecFromClientList); -EXPORT_SYMBOL(assocProcessRxDisassocFrame); -EXPORT_SYMBOL(authProcessRxDeauthFrame); -EXPORT_SYMBOL(cnmStaRecFree); -EXPORT_SYMBOL(rNonHTPhyAttributes); -EXPORT_SYMBOL(rNonHTApModeAttributes); -EXPORT_SYMBOL(cnmMemFree); -EXPORT_SYMBOL(wlanExportGlueInfo); -EXPORT_SYMBOL(bssInitForAP); -EXPORT_SYMBOL(nicPmIndicateBssConnected); -EXPORT_SYMBOL(rlmRspGenerateHtOpIE); -EXPORT_SYMBOL(bssGenerateExtSuppRate_IE); -EXPORT_SYMBOL(rlmRspGenerateErpIE); -EXPORT_SYMBOL(rlmRspGenerateHtCapIE); -EXPORT_SYMBOL(cnmGetStaRecByIndex); -EXPORT_SYMBOL(rsnGenerateWpaNoneIE); -EXPORT_SYMBOL(rlmRspGenerateExtCapIE); -EXPORT_SYMBOL(rsnGenerateRSNIE); -EXPORT_SYMBOL(rsnParseRsnIE); -#if CFG_SUPPORT_WPS -EXPORT_SYMBOL(wextSrchDesiredWPSIE); -#endif -EXPORT_SYMBOL(mboxDummy); -EXPORT_SYMBOL(saaFsmRunEventStart); -EXPORT_SYMBOL(saaFsmRunEventAbort); -EXPORT_SYMBOL(cnmP2PIsPermitted); -EXPORT_SYMBOL(cnmBss40mBwPermitted); -EXPORT_SYMBOL(mqmGenerateWmmParamIE); -EXPORT_SYMBOL(cnmPreferredChannel); -EXPORT_SYMBOL(bssAddStaRecToClientList); -EXPORT_SYMBOL(nicQmUpdateWmmParms); -EXPORT_SYMBOL(qmFreeAllByNetType); -EXPORT_SYMBOL(wlanQueryInformation); -EXPORT_SYMBOL(nicConfigPowerSaveProfile); -EXPORT_SYMBOL(scanSearchExistingBssDesc); -EXPORT_SYMBOL(scanAllocateBssDesc); -EXPORT_SYMBOL(wlanProcessCommandQueue); -EXPORT_SYMBOL(wlanAcquirePowerControl); -EXPORT_SYMBOL(wlanReleasePowerControl); -EXPORT_SYMBOL(wlanReleasePendingCMDbyNetwork); -#if DBG -EXPORT_SYMBOL(aucDebugModule); -EXPORT_SYMBOL(fgIsBusAccessFailed); -EXPORT_SYMBOL(allocatedMemSize); -EXPORT_SYMBOL(dumpMemory8); -EXPORT_SYMBOL(dumpMemory32); -#endif -EXPORT_SYMBOL(rlmDomainIsLegalChannel); -EXPORT_SYMBOL(scnQuerySparseChannel); -EXPORT_SYMBOL(rlmDomainGetChnlList); -EXPORT_SYMBOL(p2pSetMulticastListWorkQueueWrapper); -EXPORT_SYMBOL(nicUpdateRSSI); -EXPORT_SYMBOL(nicCmdEventQueryLinkQuality); -EXPORT_SYMBOL(kalGetMediaStateIndicated); -EXPORT_SYMBOL(nicFreq2ChannelNum); -EXPORT_SYMBOL(assocSendDisAssocFrame); -EXPORT_SYMBOL(nicUpdateBeaconIETemplate); -EXPORT_SYMBOL(rsnParseCheckForWFAInfoElem); -EXPORT_SYMBOL(kalClearMgmtFramesByNetType); -EXPORT_SYMBOL(kalClearSecurityFramesByNetType); -EXPORT_SYMBOL(nicFreePendingTxMsduInfoByNetwork); -EXPORT_SYMBOL(bssComposeBeaconProbeRespFrameHeaderAndFF); -EXPORT_SYMBOL(bssBuildBeaconProbeRespFrameCommonIEs); -EXPORT_SYMBOL(wlanoidSetWapiAssocInfo); -EXPORT_SYMBOL(wlanoidSetWSCAssocInfo); -#endif -#endif diff --git a/drivers/net/wireless/mt5931/os/linux/gl_kal.c b/drivers/net/wireless/mt5931/os/linux/gl_kal.c deleted file mode 100755 index f1aa99622afd..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/gl_kal.c +++ /dev/null @@ -1,3916 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/gl_kal.c#3 $ -*/ - -/*! \file gl_kal.c - \brief GLUE Layer will export the required procedures here for internal driver stack. - - This file contains all routines which are exported from GLUE Layer to internal - driver stack. -*/ - - - -/* -** $Log: gl_kal.c $ -** -** 08 20 2012 yuche.tsai -** NULL -** Fix possible KE issue. - * - * 07 17 2012 yuche.tsai - * NULL - * Let netdev bring up. - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 06 13 2012 yuche.tsai - * NULL - * Update maintrunk driver. - * Add support for driver compose assoc request frame. - * - * 05 31 2012 terry.wu - * NULL - * . - * - * 03 26 2012 cp.wu - * [WCXRP00001187] [MT6620 Wi-Fi][Driver][Android] Add error handling while firmware image doesn't exist - * invoke put_cred() after get_current_cred() calls. - * - * 03 07 2012 yuche.tsai - * NULL - * Fix compile error when WiFi Direct is off. - * - * 03 02 2012 terry.wu - * NULL - * Snc CFG80211 modification for ICS migration from branch 2.2. - * - * 02 20 2012 cp.wu - * [WCXRP00001187] [MT6620 Wi-Fi][Driver][Android] Add error handling while firmware image doesn't exist - * do not need to invoke free() while firmware image file doesn't exist - * - * 01 05 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the related ioctl / wlan oid function to set the Tx power cfg. - * - * 01 02 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the proto type function for set_int set_tx_power and get int get_ch_list. - * - * 11 21 2011 cp.wu - * [WCXRP00001118] [MT6620 Wi-Fi][Driver] Corner case protections to pass Monkey testing - * 1. wlanoidQueryBssIdList might be passed with a non-zero length but a NULL pointer of buffer - * add more checking for such cases - * - * 2. kalSendComplete() might be invoked with a packet belongs to P2P network right after P2P is unregistered. - * add some tweaking to protect such cases because that net device has become invalid. - * - * 11 18 2011 yuche.tsai - * NULL - * CONFIG P2P support RSSI query, default turned off. - * - * 11 16 2011 yuche.tsai - * NULL - * Avoid using work thread. - * - * 11 10 2011 cp.wu - * [WCXRP00001098] [MT6620 Wi-Fi][Driver] Replace printk by DBG LOG macros in linux porting layer - * 1. eliminaite direct calls to printk in porting layer. - * 2. replaced by DBGLOG, which would be XLOG on ALPS platforms. - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 09 23 2011 yuche.tsai - * [WCXRP00000998] [Volunteer Patch][WiFi Direct][FW] P2P Social Channel & country domain issue - * Regulation domain feature check in. - * - * 08 12 2011 cp.wu - * [WCXRP00000913] [MT6620 Wi-Fi] create repository of source code dedicated for MT6620 E6 ASIC - * load WIFI_RAM_CODE_E6 for MT6620 E6 ASIC. - * - * 07 18 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add CMD/Event for RDD and BWCS. - * - * 06 13 2011 eddie.chen - * [WCXRP00000779] [MT6620 Wi-Fi][DRV] Add tx rx statistics in linux and use netif_rx_ni - * Add tx rx statistics and netif_rx_ni. - * - * 04 15 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add BOW short range mode. - * - * 04 12 2011 cp.wu - * [WCXRP00000635] [MT6620 Wi-Fi][Driver] Clear pending security frames when QM clear pending data frames for dedicated network type - * clear pending security frames for dedicated network type when BSS is being deactivated/disconnected - * - * 04 08 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * correct i4TxPendingFrameNum decreasing. - * - * 03 23 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * apply multi-queue operation only for linux kernel > 2.6.26 - * - * 03 21 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * portability for compatible with linux 2.6.12. - * - * 03 21 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * improve portability for awareness of early version of linux kernel and wireless extension. - * - * 03 18 2011 cp.wu - * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period - * refix ... - * - * 03 18 2011 cp.wu - * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period - * correct compiling warning/error. - * - * 03 18 2011 cp.wu - * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period - * add more robust fault tolerance design when pre-allocation failed. (rarely happen) - * - * 03 17 2011 cp.wu - * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period - * use pre-allocated buffer for storing enhanced interrupt response as well - * - * 03 16 2011 cp.wu - * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period - * 1. pre-allocate physical continuous buffer while module is being loaded - * 2. use pre-allocated physical continuous buffer for TX/RX DMA transfer - * - * The windows part remained the same as before, but added similiar APIs to hide the difference. - * - * 03 15 2011 cp.wu - * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous memory consumption - * 1. deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK - * 2. Use common coalescing buffer for both TX/RX directions - * - * - * 03 14 2011 jeffrey.chang - * [WCXRP00000546] [MT6620 Wi-Fi][MT6620 Wi-Fi][Driver] fix kernel build warning message - * fix kernel build warning message - * - * 03 07 2011 terry.wu - * [WCXRP00000521] [MT6620 Wi-Fi][Driver] Remove non-standard debug message - * Toggle non-standard debug messages to comments. - * - * 03 06 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Sync BOW Driver to latest person development branch version.. - * - * 03 03 2011 jeffrey.chang - * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue - * support concurrent network - * - * 03 03 2011 jeffrey.chang - * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue - * modify net device relative functions to support multiple H/W queues - * - * 03 02 2011 cp.wu - * [WCXRP00000503] [MT6620 Wi-Fi][Driver] Take RCPI brought by association response as initial RSSI right after connection is built. - * use RCPI brought by ASSOC-RESP after connection is built as initial RCPI to avoid using a uninitialized MAC-RX RCPI. - * - * 02 21 2011 cp.wu - * [WCXRP00000482] [MT6620 Wi-Fi][Driver] Simplify logic for checking NVRAM existence in driver domain - * simplify logic for checking NVRAM existence only once. - * - * 01 24 2011 cp.wu - * [WCXRP00000382] [MT6620 Wi-Fi][Driver] Track forwarding packet number with notifying tx thread for serving - * 1. add an extra counter for tracking pending forward frames. - * 2. notify TX service thread as well when there is pending forward frame - * 3. correct build errors leaded by introduction of Wi-Fi direct separation module - * - * 01 19 2011 cp.wu - * [WCXRP00000371] [MT6620 Wi-Fi][Driver] make linux glue layer portable for Android 2.3.1 with Linux 2.6.35.7 - * add compile option to check linux version 2.6.35 for different usage of system API to improve portability - * - * 01 12 2011 cp.wu - * [WCXRP00000357] [MT6620 Wi-Fi][Driver][Bluetooth over Wi-Fi] add another net device interface for BT AMP - * implementation of separate BT_OVER_WIFI data path. - * - * 01 10 2011 cp.wu - * [WCXRP00000349] [MT6620 Wi-Fi][Driver] make kalIoctl() of linux port as a thread safe API to avoid potential issues due to multiple access - * use mutex to protect kalIoctl() for thread safe. - * - * 11 26 2010 cp.wu - * [WCXRP00000209] [MT6620 Wi-Fi][Driver] Modify NVRAM checking mechanism to warning only with necessary data field checking - * 1. NVRAM error is now treated as warning only, thus normal operation is still available but extra scan result used to indicate user is attached - * 2. DPD and TX-PWR are needed fields from now on, if these 2 fields are not availble then warning message is shown - * - * 11 04 2010 wh.su - * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID - * adding the p2p random ssid support. - * - * 11 02 2010 jeffrey.chang - * [WCXRP00000145] [MT6620 Wi-Fi][Driver] fix issue of byte endian in packet classifier which discards BoW packets - * . - * - * 11 01 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module - * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead - * 2) Remove CNM CH-RECOVER event handling - * 3) cfg read/write API renamed with kal prefix for unified naming rules. - * - * 11 01 2010 yarco.yang - * [WCXRP00000149] [MT6620 WI-Fi][Driver]Fine tune performance on MT6516 platform - * Add code to run WlanIST in SDIO callback. - * - * 10 26 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW] Support NIC capability query command - * 1) update NVRAM content template to ver 1.02 - * 2) add compile option for querying NIC capability (default: off) - * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting - * 4) correct auto-rate compiler error under linux (treat warning as error) - * 5) simplify usage of NVRAM and REG_INFO_T - * 6) add version checking between driver and firmware - * - * 10 25 2010 jeffrey.chang - * [WCXRP00000129] [MT6620] [Driver] Kernel panic when rmmod module on Andriod platform - * Remove redundant code which cause mismatch of power control release - * - * 10 25 2010 jeffrey.chang - * [WCXRP00000129] [MT6620] [Driver] Kernel panic when rmmod module on Andriod platform - * Remove redundant GLUE_HALT condfition to avoid unmatched release of power control - * - * 10 18 2010 jeffrey.chang - * [WCXRP00000116] [MT6620 Wi-Fi][Driver] Refine the set_scan ioctl to resolve the Android UI hanging issue - * refine the scan ioctl to prevent hanging of Android UI - * - * 10 18 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android - * complete implementation of Android NVRAM access - * - * 10 06 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * if there is NVRAM, then use MAC address on NVRAM as default MAC address. - * - * 10 06 2010 cp.wu - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * code reorganization to improve isolation between GLUE and CORE layers. - * - * 10 05 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * 1) add NVRAM access API - * 2) fake scanning result when NVRAM doesn't exist and/or version mismatch. (off by compiler option) - * 3) add OID implementation for NVRAM read/write service - * - * 09 21 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * Do a complete reset with STA-REC null checking for RF test re-entry - * - * 09 21 2010 kevin.huang - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * Eliminate Linux Compile Warning - * - * 09 07 2010 wh.su - * NULL - * adding the code for beacon/probe req/ probe rsp wsc ie at p2p. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 30 2010 cp.wu - * NULL - * API added: nicTxPendingPackets(), for simplifying porting layer - * - * 08 20 2010 yuche.tsai - * NULL - * Support second interface indicate when enabling P2P. - * - * 08 18 2010 yarco.yang - * NULL - * 1. Fixed HW checksum offload function not work under Linux issue. - * 2. Add debug message. - * - * 08 16 2010 jeffrey.chang - * NULL - * remove redundant code which cause kernel panic - * - * 08 16 2010 cp.wu - * NULL - * P2P packets are now marked when being queued into driver, and identified later without checking MAC address - * - * 08 02 2010 jeffrey.chang - * NULL - * 1) modify tx service thread to avoid busy looping - * 2) add spin lock declartion for linux build - * - * 07 29 2010 cp.wu - * NULL - * simplify post-handling after TX_DONE interrupt is handled. - * - * 07 28 2010 jeffrey.chang - * NULL - * 1) remove unused spinlocks - * 2) enable encyption ioctls - * 3) fix scan ioctl which may cause supplicant to hang - * - * 07 23 2010 cp.wu - * - * 1) re-enable AIS-FSM beacon timeout handling. - * 2) scan done API revised - * - * 07 23 2010 jeffrey.chang - * - * add new KAL api - * - * 07 23 2010 jeffrey.chang - * - * bug fix: allocate regInfo when disabling firmware download - * - * 07 23 2010 jeffrey.chang - * - * use glue layer api to decrease or increase counter atomically - * - * 07 22 2010 jeffrey.chang - * - * modify tx thread and remove some spinlock - * - * 07 22 2010 jeffrey.chang - * - * use different spin lock for security frame - * - * 07 22 2010 jeffrey.chang - * - * add new spinlock - * - * 07 19 2010 jeffrey.chang - * - * add spinlock for pending security frame count - * - * 07 19 2010 jeffrey.chang - * - * adjust the timer unit to microsecond - * - * 07 19 2010 jeffrey.chang - * - * timer should return value greater than zero - * - * 07 19 2010 jeffrey.chang - * - * add kal api for scanning done - * - * 07 19 2010 jeffrey.chang - * - * modify cmd/data path for new design - * - * 07 19 2010 jeffrey.chang - * - * add new kal api - * - * 07 19 2010 jeffrey.chang - * - * for linux driver migration - * - * 07 19 2010 jeffrey.chang - * - * Linux port modification - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 23 2010 yarco.yang - * [WPD00003837][MT6620]Data Path Refine - * Merge g_arStaRec[] into adapter->arStaRec[] - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * change MAC address updating logic. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 06 01 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * remove unused files. - * - * 05 29 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * fix private ioctl for rftest - * - * 05 29 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * workaround for fixing request_firmware() failure on android 2.1 - * - * 05 28 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * fix kernel panic when debug mode enabled - * - * 05 26 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * 1) Modify set mac address code - * 2) remove power managment macro - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * 1) add timeout handler mechanism for pending command packets - * 2) add p2p add/removal key - * - * 05 14 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * Disable network interface after disassociation - * - * 05 10 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * fill network type field while doing frame identification. - * - * 05 07 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * prevent supplicant accessing driver during resume - * - * 04 27 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * identify BT Over Wi-Fi Security frame and mark it as 802.1X frame - * - * 04 27 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * 1) fix firmware download bug - * 2) remove query statistics for acelerating firmware download - * - * 04 27 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * follow Linux's firmware framework, and remove unused kal API - * - * 04 22 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * - * 1) modify rx path code for supporting Wi-Fi direct - * 2) modify config.h since Linux dont need to consider retaining packet - * - * 04 21 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * add for private ioctl support - * - * 04 15 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * change firmware name - * - * 04 14 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * flush pending TX packets while unloading driver - * - * 04 14 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * Set driver own before handling cmd queue - * - * 04 14 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * 1) prGlueInfo->pvInformationBuffer and prGlueInfo->u4InformationBufferLength are no longer used - * 2) fix ioctl - * - * 04 14 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * information buffer for query oid/ioctl is now buffered in prCmdInfo - * * * * * * * instead of glue-layer variable to improve multiple oid/ioctl capability - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * * * * * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * * * * * * * * * * * * * * * 2) command sequence number is now increased atomically - * * * * * * * * * * * * * * * * * * 3) private data could be hold and taken use for other purpose - * - * 04 09 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * fix spinlock usage - * - * 04 09 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * add spinlock for i4TxPendingFrameNum access - * - * 04 09 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * 1) add spinlock - * * 2) add KAPI for handling association info - * - * 04 09 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * fix spinlock usage - * - * 04 09 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * adding firmware download KAPI - * - * 04 07 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * Set MAC address from firmware - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1. free cmdinfo after command is emiited. - * 2. for BoW frames, user priority is extracted from sk_buff directly. - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * finish non-glue layer access to glue variables - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * accessing to firmware load/start address, and access to OID handling information - * * * are now handled in glue layer - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * rWlanInfo should be placed at adapter rather than glue due to most operations - * * * * * * * are done in adapter layer. - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access to prGlueInfo->eParamMediaStateIndicated from non-glue layer - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * (1)deliver the kalOidComplete status to upper layer - * (2) fix spin lock - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add KAL API: kalFlushPendingTxPackets(), and take use of the API - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access to prGlueInfo->rWlanInfo.eLinkAttr.ucMediaStreamMode from non-glue layer. - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * add timeout check in the kalOidComplete - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * improve none-glue code portability - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * code refine: fgTestMode should be at adapter rather than glue due to the device/fw is also involved - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) for some OID, never do timeout expiration - * * * 2) add 2 kal API for later integration - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * raising the priority of processing interrupt - * - * 04 01 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * Bug fix: the tx thread will cause starvation of MMC thread, and the interrupt will never come in - * - * 03 30 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * emulate NDIS Pending OID facility - * - * 03 28 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * adding secondary command queue for improving non-glue code portability - * - * 03 26 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * [WPD00003826] Initial import for Linux port - * adding firmware download kal api - * - * 03 25 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add Bluetooth-over-Wifi frame header check - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port -** \main\maintrunk.MT5921\50 2009-09-28 20:19:08 GMT mtk01090 -** Add private ioctl to carry OID structures. Restructure public/private ioctl interfaces to Linux kernel. -** \main\maintrunk.MT5921\49 2009-08-18 22:56:44 GMT mtk01090 -** Add Linux SDIO (with mmc core) support. -** Add Linux 2.6.21, 2.6.25, 2.6.26. -** Fix compile warning in Linux. -** \main\maintrunk.MT5921\48 2009-06-23 23:18:58 GMT mtk01090 -** Add build option BUILD_USE_EEPROM and compile option CFG_SUPPORT_EXT_CONFIG for NVRAM support -** \main\maintrunk.MT5921\47 2008-11-19 11:55:43 GMT mtk01088 -** fixed some lint warning, and rename some variable with pre-fix to avoid the misunderstanding -** \main\maintrunk.MT5921\46 2008-09-02 21:07:42 GMT mtk01461 -** Remove ASSERT(pvBuf) in kalIndicateStatusAndComplete(), this parameter can be NULL -** \main\maintrunk.MT5921\45 2008-08-29 16:03:21 GMT mtk01088 -** remove non-used code for code review, add assert check -** \main\maintrunk.MT5921\44 2008-08-21 00:32:49 GMT mtk01461 -** \main\maintrunk.MT5921\43 2008-05-30 20:27:02 GMT mtk01461 -** Rename KAL function -** \main\maintrunk.MT5921\42 2008-05-30 15:47:29 GMT mtk01461 -** \main\maintrunk.MT5921\41 2008-05-30 15:13:04 GMT mtk01084 -** rename wlanoid -** \main\maintrunk.MT5921\40 2008-05-29 14:15:14 GMT mtk01084 -** remove un-used KAL function -** \main\maintrunk.MT5921\39 2008-05-03 15:17:30 GMT mtk01461 -** Move Query Media Status to GLUE -** \main\maintrunk.MT5921\38 2008-04-24 11:59:44 GMT mtk01461 -** change awake queue threshold and remove code which mark #if 0 -** \main\maintrunk.MT5921\37 2008-04-17 23:06:35 GMT mtk01461 -** Add iwpriv support for AdHocMode setting -** \main\maintrunk.MT5921\36 2008-04-08 15:38:56 GMT mtk01084 -** add KAL function to setting pattern search function enable/ disable -** \main\maintrunk.MT5921\35 2008-04-01 23:53:13 GMT mtk01461 -** Add comment -** \main\maintrunk.MT5921\34 2008-03-26 15:36:48 GMT mtk01461 -** Add update MAC Address for Linux -** \main\maintrunk.MT5921\33 2008-03-18 11:49:34 GMT mtk01084 -** update function for initial value access -** \main\maintrunk.MT5921\32 2008-03-18 10:25:22 GMT mtk01088 -** use kal update associate request at linux -** \main\maintrunk.MT5921\31 2008-03-06 23:43:08 GMT mtk01385 -** 1. add Query Registry Mac address function. -** \main\maintrunk.MT5921\30 2008-02-26 09:47:57 GMT mtk01084 -** modify KAL set network address/ checksum offload part -** \main\maintrunk.MT5921\29 2008-02-12 23:26:53 GMT mtk01461 -** Add debug option - Packet Order for Linux -** \main\maintrunk.MT5921\28 2008-01-09 17:54:43 GMT mtk01084 -** modify the argument of kalQueryPacketInfo() -** \main\maintrunk.MT5921\27 2007-12-24 16:02:03 GMT mtk01425 -** 1. Revise csum offload -** \main\maintrunk.MT5921\26 2007-11-30 17:03:36 GMT mtk01425 -** 1. Fix bugs -** -** \main\maintrunk.MT5921\25 2007-11-29 01:57:17 GMT mtk01461 -** Fix Windows RX multiple packet retain problem -** \main\maintrunk.MT5921\24 2007-11-20 11:24:07 GMT mtk01088 -** CR90, not doing the netif_carrier_off to let supplicant 1x pkt can be rcv at hardstattXmit -** \main\maintrunk.MT5921\23 2007-11-09 16:36:44 GMT mtk01425 -** 1. Modify for CSUM offloading with Tx Fragment -** \main\maintrunk.MT5921\22 2007-11-07 18:37:39 GMT mtk01461 -** Add Tx Fragmentation Support -** \main\maintrunk.MT5921\21 2007-11-06 19:34:06 GMT mtk01088 -** add the WPS code, indicate the mgmt frame to upper layer -** \main\maintrunk.MT5921\20 2007-11-02 01:03:21 GMT mtk01461 -** Unify TX Path for Normal and IBSS Power Save + IBSS neighbor learning -** \main\maintrunk.MT5921\19 2007-10-30 11:59:38 GMT MTK01425 -** 1. Update wlanQueryInformation -** \main\maintrunk.MT5921\18 2007-10-30 10:44:57 GMT mtk01425 -** 1. Refine multicast list code -** 2. Refine TCP/IP csum offload code -** -** Revision 1.5 2007/07/17 13:01:18 MTK01088 -** add associate req and rsp function -** -** Revision 1.4 2007/07/13 05:19:19 MTK01084 -** provide timer set functions -** -** Revision 1.3 2007/06/27 02:18:51 MTK01461 -** Update SCAN_FSM, Initial(Can Load Module), Proc(Can do Reg R/W), TX API -** -** Revision 1.2 2007/06/25 06:16:24 MTK01461 -** Update illustrations, gl_init.c, gl_kal.c, gl_kal.h, gl_os.h and RX API -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_os.h" -#include "gl_wext.h" -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ -#if DBG -int allocatedMemSize = 0; -#endif - -extern struct semaphore g_halt_sem; -extern int g_u4HaltFlag; - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ -static PVOID pvIoBuffer = NULL; -static UINT_32 pvIoBufferSize = 0; -static UINT_32 pvIoBufferUsage = 0; - - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -#if defined(MT6620) && CFG_MULTI_ECOVER_SUPPORT -typedef enum _ENUM_WMTHWVER_TYPE_T{ - WMTHWVER_MT6620_E1 = 0x0, - WMTHWVER_MT6620_E2 = 0x1, - WMTHWVER_MT6620_E3 = 0x2, - WMTHWVER_MT6620_E4 = 0x3, - WMTHWVER_MT6620_E5 = 0x4, - WMTHWVER_MT6620_E6 = 0x5, - WMTHWVER_MT6620_MAX, - WMTHWVER_INVALID = 0xff -} ENUM_WMTHWVER_TYPE_T, *P_ENUM_WMTHWVER_TYPE_T; - -extern ENUM_WMTHWVER_TYPE_T -mtk_wcn_wmt_hwver_get( - VOID - ); -#elif defined(MT5931) && CFG_MULTI_ECOVER_SUPPORT -typedef enum _ENUM_HWVER_TYPE_T{ - HWVER_MT5931_E1 = 0x1, - HWVER_MT5931_E2 = 0x2, - HWVER_MT5931_E3 = 0x3, - HWVER_MT5931_MAX, - HWVER_INVALID = 0xff -} ENUM_HWVER_TYPE_T, *P_ENUM_HWVER_TYPE_T; -#endif - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#if CFG_ENABLE_FW_DOWNLOAD - -static struct file *filp = NULL; -static uid_t orgfsuid; -static gid_t orgfsgid; -static mm_segment_t orgfs; - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is provided by GLUE Layer for internal driver stack to -* open firmware image in kernel space -* -* \param[in] prGlueInfo Pointer of GLUE Data Structure -* -* \retval WLAN_STATUS_SUCCESS. -* \retval WLAN_STATUS_FAILURE. -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -kalFirmwareOpen ( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - /* FIX ME: since we don't have hotplug script in the filesystem - * , so the request_firmware() KAPI can not work properly - */ - - /* save uid and gid used for filesystem access. - * set user and group to 0(root) */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) - orgfsuid = current->fsuid; - orgfsgid = current->fsgid; - current->fsuid = current->fsgid = 0; -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) - struct cred *cred = (struct cred *) get_current_cred(); - orgfsuid = cred->fsuid; - orgfsgid = cred->fsgid; - cred->fsuid = cred->fsgid = 0; -#else - struct cred *cred = get_task_cred(current); - orgfsuid = cred->fsuid; - orgfsgid = cred->fsgid; - cred->fsuid = cred->fsgid = 0; -#endif - - ASSERT(prGlueInfo); - - - orgfs = get_fs(); - set_fs(get_ds()); - - - /* open the fw file */ -#if defined(MT6620) & CFG_MULTI_ECOVER_SUPPORT - switch(mtk_wcn_wmt_hwver_get()) { - case WMTHWVER_MT6620_E1: - case WMTHWVER_MT6620_E2: - case WMTHWVER_MT6620_E3: - case WMTHWVER_MT6620_E4: - case WMTHWVER_MT6620_E5: - filp = filp_open("/etc/firmware/"CFG_FW_FILENAME, O_RDONLY, 0); - break; - - case WMTHWVER_MT6620_E6: - default: - filp = filp_open("/etc/firmware/"CFG_FW_FILENAME"_E6", O_RDONLY, 0); - break; - } -#elif defined(MT5931) && CFG_MULTI_ECOVER_SUPPORT - switch (wlanGetEcoVersion(prGlueInfo->prAdapter)) { - case HWVER_MT5931_E1: - case HWVER_MT5931_E2: - filp = filp_open("/etc/firmware/"CFG_FW_FILENAME"_E2", O_RDONLY, 0); - break; - case HWVER_MT5931_E3: - default: - filp = filp_open("/etc/firmware/"CFG_FW_FILENAME, O_RDONLY, 0); - break; - } -#elif defined(MT6628) - filp = filp_open("/etc/firmware/"CFG_FW_FILENAME"_MT6628", O_RDONLY, 0); -#else - filp = filp_open("/etc/firmware/"CFG_FW_FILENAME, O_RDONLY, 0); -#endif - if (IS_ERR(filp)) { - DBGLOG(INIT, INFO, ("Open FW image: %s failed\n", CFG_FW_FILENAME)); - goto error_open; - } - DBGLOG(INIT, INFO, ("Open FW image: %s done\n", CFG_FW_FILENAME)); - return WLAN_STATUS_SUCCESS; - -error_open: - /* restore */ - set_fs(orgfs); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) - current->fsuid = orgfsuid; - current->fsgid = orgfsgid; -#else - cred->fsuid = orgfsuid; - cred->fsgid = orgfsgid; - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) - put_cred(cred); - #endif -#endif - return WLAN_STATUS_FAILURE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is provided by GLUE Layer for internal driver stack to -* release firmware image in kernel space -* -* \param[in] prGlueInfo Pointer of GLUE Data Structure -* -* \retval WLAN_STATUS_SUCCESS. -* \retval WLAN_STATUS_FAILURE. -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -kalFirmwareClose ( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - if ((filp != NULL) && !IS_ERR(filp)) { - /* close firmware file */ - filp_close(filp, NULL); - - /* restore */ - set_fs(orgfs); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) - current->fsuid = orgfsuid; - current->fsgid = orgfsgid; -#else - { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) - struct cred *cred = (struct cred *) get_current_cred(); -#else - struct cred *cred = get_task_cred(current); -#endif - cred->fsuid = orgfsuid; - cred->fsgid = orgfsgid; - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) - put_cred(cred); - #endif - } -#endif - filp = NULL; - } - - return WLAN_STATUS_SUCCESS; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is provided by GLUE Layer for internal driver stack to -* load firmware image in kernel space -* -* \param[in] prGlueInfo Pointer of GLUE Data Structure -* -* \retval WLAN_STATUS_SUCCESS. -* \retval WLAN_STATUS_FAILURE. -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -kalFirmwareLoad ( - IN P_GLUE_INFO_T prGlueInfo, - OUT PVOID prBuf, - IN UINT_32 u4Offset, - OUT PUINT_32 pu4Size - ) -{ - ASSERT(prGlueInfo); - ASSERT(pu4Size); - ASSERT(prBuf); - - //l = filp->f_path.dentry->d_inode->i_size; - - /* the object must have a read method */ - if ((filp == NULL) || IS_ERR(filp) || (filp->f_op == NULL) || (filp->f_op->read == NULL)) { - goto error_read; - } else { - filp->f_pos = u4Offset; - *pu4Size = filp->f_op->read(filp, prBuf, *pu4Size, &filp->f_pos); - } - - return WLAN_STATUS_SUCCESS; - -error_read: - return WLAN_STATUS_FAILURE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is provided by GLUE Layer for internal driver stack to -* query firmware image size in kernel space -* -* \param[in] prGlueInfo Pointer of GLUE Data Structure -* -* \retval WLAN_STATUS_SUCCESS. -* \retval WLAN_STATUS_FAILURE. -* -*/ -/*----------------------------------------------------------------------------*/ - -WLAN_STATUS -kalFirmwareSize ( - IN P_GLUE_INFO_T prGlueInfo, - OUT PUINT_32 pu4Size - ) -{ - ASSERT(prGlueInfo); - ASSERT(pu4Size); - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 12) - *pu4Size = filp->f_path.dentry->d_inode->i_size; -#else - *pu4Size = filp->f_dentry->d_inode->i_size; -#endif - - return WLAN_STATUS_SUCCESS; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to load firmware image -* -* \param pvGlueInfo Pointer of GLUE Data Structure -* \param ppvMapFileBuf Pointer of pointer to memory-mapped firmware image -* \param pu4FileLength File length and memory mapped length as well - -* \retval Map File Handle, used for unammping -*/ -/*----------------------------------------------------------------------------*/ - -PVOID -kalFirmwareImageMapping ( - IN P_GLUE_INFO_T prGlueInfo, - OUT PPVOID ppvMapFileBuf, - OUT PUINT_32 pu4FileLength - ) -{ - DEBUGFUNC("kalFirmwareImageMapping"); - - ASSERT(prGlueInfo); - ASSERT(ppvMapFileBuf); - ASSERT(pu4FileLength); - - do { - /* <1> Open firmware */ - if (kalFirmwareOpen(prGlueInfo) != WLAN_STATUS_SUCCESS) { - break; - } else { - UINT_32 u4FwSize = 0; - PVOID prFwBuffer = NULL; - /* <2> Query firmare size */ - kalFirmwareSize(prGlueInfo, &u4FwSize); - /* <3> Use vmalloc for allocating large memory trunk */ - prFwBuffer = vmalloc(ALIGN_4(u4FwSize)); - /* <4> Load image binary into buffer */ - if (kalFirmwareLoad(prGlueInfo, prFwBuffer, 0, &u4FwSize) != WLAN_STATUS_SUCCESS) { - vfree(prFwBuffer); - kalFirmwareClose(prGlueInfo); - break; - } - /* <5> write back info */ - *pu4FileLength = u4FwSize; - *ppvMapFileBuf = prFwBuffer; - - return prFwBuffer; - } - - } while (FALSE); - - return NULL; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to unload firmware image mapped memory -* -* \param pvGlueInfo Pointer of GLUE Data Structure -* \param pvFwHandle Pointer to mapping handle -* \param pvMapFileBuf Pointer to memory-mapped firmware image -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ - -VOID -kalFirmwareImageUnmapping ( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID prFwHandle, - IN PVOID pvMapFileBuf - ) -{ - DEBUGFUNC("kalFirmwareImageUnmapping"); - - ASSERT(prGlueInfo); - - /* pvMapFileBuf might be NULL when file doesn't exist */ - if(pvMapFileBuf) { - vfree(pvMapFileBuf); - } - - kalFirmwareClose(prGlueInfo); -} - -#endif - -#if 0 - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to load firmware image -* -* \param pvGlueInfo Pointer of GLUE Data Structure -* \param ppvMapFileBuf Pointer of pointer to memory-mapped firmware image -* \param pu4FileLength File length and memory mapped length as well - -* \retval Map File Handle, used for unammping -*/ -/*----------------------------------------------------------------------------*/ - -PVOID -kalFirmwareImageMapping ( - IN P_GLUE_INFO_T prGlueInfo, - OUT PPVOID ppvMapFileBuf, - OUT PUINT_32 pu4FileLength - ) -{ - INT_32 i4Ret = 0; - - DEBUGFUNC("kalFirmwareImageMapping"); - - ASSERT(prGlueInfo); - ASSERT(ppvMapFileBuf); - ASSERT(pu4FileLength); - - do { - GL_HIF_INFO_T *prHifInfo = &prGlueInfo->rHifInfo; - prGlueInfo->prFw = NULL; - - /* <1> Open firmware */ - i4Ret = request_firmware(&prGlueInfo->prFw, CFG_FW_FILENAME, &prHifInfo->func->dev); - - if (i4Ret) { - printk (KERN_INFO DRV_NAME"fw %s:request failed %d\n", CFG_FW_FILENAME, i4Ret); - break; - } else { - *pu4FileLength = prGlueInfo->prFw->size; - *ppvMapFileBuf = prGlueInfo->prFw->data; - return prGlueInfo->prFw->data; - } - - } while (FALSE); - - return NULL; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to unload firmware image mapped memory -* -* \param pvGlueInfo Pointer of GLUE Data Structure -* \param pvFwHandle Pointer to mapping handle -* \param pvMapFileBuf Pointer to memory-mapped firmware image -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ - -VOID -kalFirmwareImageUnmapping ( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID prFwHandle, - IN PVOID pvMapFileBuf - ) -{ - DEBUGFUNC("kalFirmwareImageUnmapping"); - - ASSERT(prGlueInfo); - ASSERT(pvMapFileBuf); - - release_firmware(prGlueInfo->prFw); - -} -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is provided by GLUE Layer for internal driver stack to acquire -* OS SPIN_LOCK. -* -* \param[in] prGlueInfo Pointer of GLUE Data Structure -* \param[in] rLockCategory Specify which SPIN_LOCK -* \param[out] pu4Flags Pointer of a variable for saving IRQ flags -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalAcquireSpinLock ( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_SPIN_LOCK_CATEGORY_E rLockCategory, - OUT PUINT_32 pu4Flags - ) -{ - UINT_32 u4Flags = 0; - - ASSERT(prGlueInfo); - ASSERT(pu4Flags); - - if (rLockCategory < SPIN_LOCK_NUM) { - -#if CFG_USE_SPIN_LOCK_BOTTOM_HALF - spin_lock_bh(&prGlueInfo->rSpinLock[rLockCategory]); -#else /* !CFG_USE_SPIN_LOCK_BOTTOM_HALF */ - spin_lock_irqsave(&prGlueInfo->rSpinLock[rLockCategory], u4Flags); -#endif /* !CFG_USE_SPIN_LOCK_BOTTOM_HALF */ - - *pu4Flags = u4Flags; - } - - return; -} /* end of kalAcquireSpinLock() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is provided by GLUE Layer for internal driver stack to release -* OS SPIN_LOCK. -* -* \param[in] prGlueInfo Pointer of GLUE Data Structure -* \param[in] rLockCategory Specify which SPIN_LOCK -* \param[in] u4Flags Saved IRQ flags -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalReleaseSpinLock ( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_SPIN_LOCK_CATEGORY_E rLockCategory, - IN UINT_32 u4Flags - ) -{ - ASSERT(prGlueInfo); - - if (rLockCategory < SPIN_LOCK_NUM) { - -#if CFG_USE_SPIN_LOCK_BOTTOM_HALF - spin_unlock_bh(&prGlueInfo->rSpinLock[rLockCategory]); -#else /* !CFG_USE_SPIN_LOCK_BOTTOM_HALF */ - spin_unlock_irqrestore(&prGlueInfo->rSpinLock[rLockCategory], u4Flags); -#endif /* !CFG_USE_SPIN_LOCK_BOTTOM_HALF */ - - } - - return; -} /* end of kalReleaseSpinLock() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is provided by GLUE Layer for internal driver stack to update -* current MAC address. -* -* \param[in] prGlueInfo Pointer of GLUE Data Structure -* \param[in] pucMacAddr Pointer of current MAC address -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalUpdateMACAddress ( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucMacAddr - ) -{ - ASSERT(prGlueInfo); - ASSERT(pucMacAddr); - - if(UNEQUAL_MAC_ADDR(prGlueInfo->prDevHandler->dev_addr, pucMacAddr)) { - memcpy(prGlueInfo->prDevHandler->dev_addr, pucMacAddr, PARAM_MAC_ADDR_LEN); - } - - return; -} - - -#if CFG_TCP_IP_CHKSUM_OFFLOAD -/*----------------------------------------------------------------------------*/ -/*! -* \brief To query the packet information for offload related parameters. -* -* \param[in] pvPacket Pointer to the packet descriptor. -* \param[in] pucFlag Points to the offload related parameter. -* -* \return (none) -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalQueryTxChksumOffloadParam ( - IN PVOID pvPacket, - OUT PUINT_8 pucFlag - ) -{ - struct sk_buff *skb = (struct sk_buff *) pvPacket; - UINT_8 ucFlag = 0; - - ASSERT(pvPacket); - ASSERT(pucFlag); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) - if (skb->ip_summed == CHECKSUM_HW) -#else - if (skb->ip_summed == CHECKSUM_PARTIAL) -#endif - { - -#if DBG - /* Kevin: do double check, we can remove this part in Normal Driver. - * Because we register NIC feature with NETIF_F_IP_CSUM for MT5912B MAC, so - * we'll process IP packet only. - */ - if (skb->protocol != __constant_htons(ETH_P_IP)) { - //printk("Wrong skb->protocol( = %08x) for TX Checksum Offload.\n", skb->protocol); - } - else -#endif - ucFlag |= (TX_CS_IP_GEN | TX_CS_TCP_UDP_GEN); - } - - *pucFlag = ucFlag; - - return; -} /* kalQueryChksumOffloadParam */ - - -//4 2007/10/8, mikewu, this is rewritten by Mike -/*----------------------------------------------------------------------------*/ -/*! -* \brief To update the checksum offload status to the packet to be indicated to OS. -* -* \param[in] pvPacket Pointer to the packet descriptor. -* \param[in] pucFlag Points to the offload related parameter. -* -* \return (none) -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalUpdateRxCSUMOffloadParam ( - IN PVOID pvPacket, - IN ENUM_CSUM_RESULT_T aeCSUM[] - ) -{ - struct sk_buff *skb = (struct sk_buff *)pvPacket; - - ASSERT(pvPacket); - - if ( (aeCSUM[CSUM_TYPE_IPV4] == CSUM_RES_SUCCESS || aeCSUM[CSUM_TYPE_IPV6] == CSUM_RES_SUCCESS)&& - ( (aeCSUM[CSUM_TYPE_TCP] == CSUM_RES_SUCCESS) || (aeCSUM[CSUM_TYPE_UDP] == CSUM_RES_SUCCESS)) ) { - skb->ip_summed = CHECKSUM_UNNECESSARY; - } - else { - skb->ip_summed = CHECKSUM_NONE; -#if DBG - if (aeCSUM[CSUM_TYPE_IPV4] == CSUM_RES_NONE && aeCSUM[CSUM_TYPE_IPV6] == CSUM_RES_NONE) { - DBGLOG(RX, TRACE, ("RX: \"non-IPv4/IPv6\" Packet\n")); - } - else if (aeCSUM[CSUM_TYPE_IPV4] == CSUM_RES_FAILED) { - DBGLOG(RX, TRACE, ("RX: \"bad IP Checksum\" Packet\n")); - } - else if (aeCSUM[CSUM_TYPE_TCP] == CSUM_RES_FAILED) { - DBGLOG(RX, TRACE, ("RX: \"bad TCP Checksum\" Packet\n")); - } - else if (aeCSUM[CSUM_TYPE_UDP] == CSUM_RES_FAILED) { - DBGLOG(RX, TRACE, ("RX: \"bad UDP Checksum\" Packet\n")); - } - else { - - } -#endif - } - -} /* kalUpdateRxCSUMOffloadParam */ -#endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is called to free packet allocated from kalPacketAlloc. -* -* \param[in] prGlueInfo Pointer of GLUE Data Structure -* \param[in] pvPacket Pointer of the packet descriptor -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalPacketFree( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID pvPacket - ) -{ - dev_kfree_skb((struct sk_buff *) pvPacket); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Only handles driver own creating packet (coalescing buffer). -* -* \param prGlueInfo Pointer of GLUE Data Structure -* \param u4Size Pointer of Packet Handle -* \param ppucData Status Code for OS upper layer -* -* \return NULL: Failed to allocate skb, Not NULL get skb -*/ -/*----------------------------------------------------------------------------*/ -PVOID -kalPacketAlloc ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Size, - OUT PUINT_8 *ppucData - ) -{ - struct sk_buff *prSkb = dev_alloc_skb(u4Size); - - if (prSkb) { - *ppucData = (PUINT_8) (prSkb->data); - } -#if DBG -{ - PUINT_32 pu4Head = (PUINT_32)&prSkb->cb[0]; - *pu4Head = (UINT_32)prSkb->head; - DBGLOG(RX, TRACE, ("prSkb->head = %#lx, prSkb->cb = %#lx\n", (UINT_32)prSkb->head, *pu4Head)); -} -#endif - return (PVOID) prSkb; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Process the received packet for indicating to OS. -* -* \param[in] prGlueInfo Pointer to the Adapter structure. -* \param[in] pvPacket Pointer of the packet descriptor -* \param[in] pucPacketStart The starting address of the buffer of Rx packet. -* \param[in] u4PacketLen The packet length. -* \param[in] pfgIsRetain Is the packet to be retained. -* \param[in] aerCSUM The result of TCP/ IP checksum offload. -* -* \retval WLAN_STATUS_SUCCESS. -* \retval WLAN_STATUS_FAILURE. -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -kalProcessRxPacket ( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID pvPacket, - IN PUINT_8 pucPacketStart, - IN UINT_32 u4PacketLen, - //IN PBOOLEAN pfgIsRetain, - IN BOOLEAN fgIsRetain, - IN ENUM_CSUM_RESULT_T aerCSUM[] - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - struct sk_buff *skb = (struct sk_buff *)pvPacket; - - - skb->data = (unsigned char *)pucPacketStart; - skb->tail = (unsigned char *) ((UINT_32) (pucPacketStart + u4PacketLen)); - skb->len = (unsigned int)u4PacketLen; - -#if CFG_TCP_IP_CHKSUM_OFFLOAD - kalUpdateRxCSUMOffloadParam(skb, aerCSUM); -#endif - - return rStatus; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To indicate an array of received packets is available for higher -* level protocol uses. -* -* \param[in] prGlueInfo Pointer to the Adapter structure. -* \param[in] apvPkts The packet array to be indicated -* \param[in] ucPktNum The number of packets to be indicated -* -* \retval TRUE Success. -* -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -kalRxIndicatePkts ( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID apvPkts[], - IN UINT_8 ucPktNum - ) -{ - UINT_8 ucIdx = 0; - struct net_device *prNetDev = prGlueInfo->prDevHandler; - struct sk_buff *prSkb = NULL; - - ASSERT(prGlueInfo); - ASSERT(apvPkts); - -#if CFG_BOW_TEST - UINT_32 i; -#endif - - for(ucIdx = 0; ucIdx < ucPktNum; ucIdx++) { - prSkb = apvPkts[ucIdx]; -#if DBG - do { - PUINT_8 pu4Head = (PUINT_8)&prSkb->cb[0]; - UINT_32 u4HeadValue = 0; - kalMemCopy(&u4HeadValue, pu4Head, sizeof(u4HeadValue)); - DBGLOG(RX, TRACE, ("prSkb->head = 0x%p, prSkb->cb = 0x%lx\n", pu4Head, u4HeadValue)); - } while (0); -#endif - - if (GLUE_GET_PKT_IS_P2P(prSkb)) { - /* P2P */ -#if CFG_ENABLE_WIFI_DIRECT - if(prGlueInfo->prAdapter->fgIsP2PRegistered) { - prNetDev = kalP2PGetDevHdlr(prGlueInfo); - } - - prNetDev->stats.rx_bytes += prSkb->len; - prNetDev->stats.rx_packets++; - -#else - prNetDev = prGlueInfo->prDevHandler; -#endif - } - else if (GLUE_GET_PKT_IS_PAL(prSkb)) { - /* BOW */ -#if CFG_ENABLE_BT_OVER_WIFI && CFG_BOW_SEPARATE_DATA_PATH - if (prGlueInfo->rBowInfo.fgIsNetRegistered) { - prNetDev = prGlueInfo->rBowInfo.prDevHandler; - } -#else - prNetDev = prGlueInfo->prDevHandler; -#endif - } - else { - /* AIS */ - prNetDev = prGlueInfo->prDevHandler; - prGlueInfo->rNetDevStats.rx_bytes += prSkb->len; - prGlueInfo->rNetDevStats.rx_packets++; - - } - - prNetDev->last_rx = jiffies; - prSkb->protocol = eth_type_trans(prSkb, prNetDev); - prSkb->dev = prNetDev; - //DBGLOG_MEM32(RX, TRACE, (PUINT_32)prSkb->data, prSkb->len); - DBGLOG(RX, EVENT, ("kalRxIndicatePkts len = %d\n", prSkb->len)); - -#if CFG_BOW_TEST - DBGLOG(BOW, TRACE, ("Rx sk_buff->len: %d\n", prSkb->len)); - DBGLOG(BOW, TRACE, ("Rx sk_buff->data_len: %d\n", prSkb->data_len)); - DBGLOG(BOW, TRACE, ("Rx sk_buff->data:\n")); - - for(i = 0; i < prSkb->len && i < 64; i++) - { - LOG_FUNC("%02x ", prSkb->data[i]); - - if((i+1)%16 ==0) - { - LOG_FUNC("\n"); - } - } - - LOG_FUNC("\n"); -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) - if(!in_interrupt()){ - netif_rx_ni(prSkb); /* only in non-interrupt context */ - } - else { - netif_rx(prSkb); - } -#else - netif_rx(prSkb); -#endif - - wlanReturnPacket(prGlueInfo->prAdapter, NULL); - } - - return WLAN_STATUS_SUCCESS; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Called by driver to indicate event to upper layer, for example, the wpa -* supplicant or wireless tools. -* -* \param[in] pvAdapter Pointer to the adapter descriptor. -* \param[in] eStatus Indicated status. -* \param[in] pvBuf Indicated message buffer. -* \param[in] u4BufLen Indicated message buffer size. -* -* \return (none) -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalIndicateStatusAndComplete ( - IN P_GLUE_INFO_T prGlueInfo, - IN WLAN_STATUS eStatus, - IN PVOID pvBuf, - IN UINT_32 u4BufLen - ) -{ - UINT_32 bufLen; - P_PARAM_STATUS_INDICATION_T pStatus = (P_PARAM_STATUS_INDICATION_T) pvBuf; - P_PARAM_AUTH_EVENT_T pAuth = (P_PARAM_AUTH_EVENT_T) pStatus; - P_PARAM_PMKID_CANDIDATE_LIST_T pPmkid = - (P_PARAM_PMKID_CANDIDATE_LIST_T) (pStatus + 1); - PARAM_MAC_ADDRESS arBssid; - struct cfg80211_scan_request *prScanRequest = NULL; - GLUE_SPIN_LOCK_DECLARATION(); - - kalMemZero(arBssid, MAC_ADDR_LEN); - - ASSERT(prGlueInfo); - - switch (eStatus) { - case WLAN_STATUS_ROAM_OUT_FIND_BEST: - case WLAN_STATUS_MEDIA_CONNECT: - - prGlueInfo->eParamMediaStateIndicated = PARAM_MEDIA_STATE_CONNECTED; - - /* indicate assoc event */ - wlanQueryInformation(prGlueInfo->prAdapter, - wlanoidQueryBssid, - &arBssid[0], - sizeof(arBssid), - &bufLen); - wext_indicate_wext_event(prGlueInfo, SIOCGIWAP, arBssid, bufLen); - - /* switch netif on */ - netif_carrier_on(prGlueInfo->prDevHandler); - - do { - /* print message on console */ - PARAM_SSID_T ssid; - - wlanQueryInformation(prGlueInfo->prAdapter, - wlanoidQuerySsid, - &ssid, - sizeof(ssid), - &bufLen); - - ssid.aucSsid[(ssid.u4SsidLen >= PARAM_MAX_LEN_SSID) ? - (PARAM_MAX_LEN_SSID - 1) : ssid.u4SsidLen ] = '\0'; - DBGLOG(INIT, INFO, ("[wifi] %s netif_carrier_on [ssid:%s " MACSTR "]\n", - prGlueInfo->prDevHandler->name, - ssid.aucSsid, - MAC2STR(arBssid))); - } while(0); - - if(prGlueInfo->fgIsRegistered == TRUE) { - /* CFG80211 Indication */ - if(eStatus == WLAN_STATUS_MEDIA_CONNECT - && prGlueInfo->prDevHandler->ieee80211_ptr->sme_state == CFG80211_SME_CONNECTING) { - cfg80211_connect_result(prGlueInfo->prDevHandler, - arBssid, - prGlueInfo->aucReqIe, - prGlueInfo->u4ReqIeLength, - prGlueInfo->aucRspIe, - prGlueInfo->u4RspIeLength, - WLAN_STATUS_SUCCESS, - GFP_KERNEL); - } - else if(eStatus == WLAN_STATUS_ROAM_OUT_FIND_BEST - && prGlueInfo->prDevHandler->ieee80211_ptr->sme_state == CFG80211_SME_CONNECTED) { - struct ieee80211_channel *prChannel = NULL; - UINT_8 ucChannelNum = wlanGetChannelNumberByNetwork(prGlueInfo->prAdapter, NETWORK_TYPE_AIS_INDEX); - - if(ucChannelNum <= 14) { - prChannel = ieee80211_get_channel(priv_to_wiphy(prGlueInfo), ieee80211_channel_to_frequency(ucChannelNum, IEEE80211_BAND_2GHZ)); - } - else { - prChannel = ieee80211_get_channel(priv_to_wiphy(prGlueInfo), ieee80211_channel_to_frequency(ucChannelNum, IEEE80211_BAND_5GHZ)); - } - - cfg80211_roamed(prGlueInfo->prDevHandler, - prChannel, - arBssid, - prGlueInfo->aucReqIe, - prGlueInfo->u4ReqIeLength, - prGlueInfo->aucRspIe, - prGlueInfo->u4RspIeLength, - GFP_KERNEL); - } - } - - break; - - case WLAN_STATUS_MEDIA_DISCONNECT: - /* indicate disassoc event */ - wext_indicate_wext_event(prGlueInfo, SIOCGIWAP, NULL, 0); - /* For CR 90 and CR99, While supplicant do reassociate, driver will do netif_carrier_off first, - after associated success, at joinComplete(), do netif_carier_on, - but for unknown reason, the supplicant 1x pkt will not called the driver - hardStartXmit, for template workaround these bugs, add this compiling flag - */ - /* switch netif off */ - -#if 1 /* CONSOLE_MESSAGE */ - DBGLOG(INIT, INFO, ("[wifi] %s netif_carrier_off\n", prGlueInfo->prDevHandler->name)); -#endif - - netif_carrier_off(prGlueInfo->prDevHandler); - - if(prGlueInfo->fgIsRegistered == TRUE - && prGlueInfo->prDevHandler->ieee80211_ptr->sme_state == CFG80211_SME_CONNECTED) { - /* CFG80211 Indication */ - cfg80211_disconnected(prGlueInfo->prDevHandler, 0, NULL, 0, GFP_KERNEL); - } - - prGlueInfo->eParamMediaStateIndicated = PARAM_MEDIA_STATE_DISCONNECTED; - - break; - - case WLAN_STATUS_SCAN_COMPLETE: - /* indicate scan complete event */ - wext_indicate_wext_event(prGlueInfo, SIOCGIWSCAN, NULL, 0); - - /* 1. reset first for newly incoming request */ - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_NET_DEV); - if(prGlueInfo->prScanRequest != NULL) { - prScanRequest = prGlueInfo->prScanRequest; - prGlueInfo->prScanRequest = NULL; - } - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_NET_DEV); - - /* 2. then CFG80211 Indication */ - if(prScanRequest != NULL) { - cfg80211_scan_done(prScanRequest, FALSE); - } - break; - - #if 0 - case WLAN_STATUS_MSDU_OK: - if (netif_running(prGlueInfo->prDevHandler)) { - netif_wake_queue(prGlueInfo->prDevHandler); - } - break; - #endif - - case WLAN_STATUS_MEDIA_SPECIFIC_INDICATION: - if (pStatus) { - switch (pStatus->eStatusType) { - case ENUM_STATUS_TYPE_AUTHENTICATION: - /* - printk(KERN_NOTICE "ENUM_STATUS_TYPE_AUTHENTICATION: L(%ld) [" MACSTR "] F:%lx\n", - pAuth->Request[0].Length, - MAC2STR(pAuth->Request[0].Bssid), - pAuth->Request[0].Flags); - */ - /* indicate (UC/GC) MIC ERROR event only */ - if ((pAuth->arRequest[0].u4Flags == - PARAM_AUTH_REQUEST_PAIRWISE_ERROR) || - (pAuth->arRequest[0].u4Flags == - PARAM_AUTH_REQUEST_GROUP_ERROR)) { - cfg80211_michael_mic_failure(prGlueInfo->prDevHandler, NULL, - (pAuth->arRequest[0].u4Flags == PARAM_AUTH_REQUEST_PAIRWISE_ERROR) ? NL80211_KEYTYPE_PAIRWISE : NL80211_KEYTYPE_GROUP, - 0, NULL, GFP_KERNEL); - wext_indicate_wext_event(prGlueInfo, - IWEVMICHAELMICFAILURE, - (unsigned char *)&pAuth->arRequest[0], - pAuth->arRequest[0].u4Length); - } - break; - - case ENUM_STATUS_TYPE_CANDIDATE_LIST: - /* - printk(KERN_NOTICE "Param_StatusType_PMKID_CandidateList: Ver(%ld) Num(%ld)\n", - pPmkid->u2Version, - pPmkid->u4NumCandidates); - if (pPmkid->u4NumCandidates > 0) { - printk(KERN_NOTICE "candidate[" MACSTR "] preAuth Flag:%lx\n", - MAC2STR(pPmkid->arCandidateList[0].rBSSID), - pPmkid->arCandidateList[0].fgFlags); - } - */ - { - UINT_32 i = 0; - - P_PARAM_PMKID_CANDIDATE_T prPmkidCand = (P_PARAM_PMKID_CANDIDATE_T)&pPmkid->arCandidateList[0]; - - for (i=0; iu4NumCandidates; i++) { - wext_indicate_wext_event(prGlueInfo, - IWEVPMKIDCAND, - (unsigned char *)&pPmkid->arCandidateList[i], - pPmkid->u4NumCandidates); - prPmkidCand += sizeof(PARAM_PMKID_CANDIDATE_T); - } - } - break; - - default: - /* case ENUM_STATUS_TYPE_MEDIA_STREAM_MODE */ - /* - printk(KERN_NOTICE "unknown media specific indication type:%x\n", - pStatus->StatusType); - */ - break; - } - } - else { - /* - printk(KERN_WARNING "media specific indication buffer NULL\n"); - */ - } - break; - -#if CFG_SUPPORT_BCM && CFG_SUPPORT_BCM_BWCS - case WLAN_STATUS_BWCS_UPDATE: - { - wext_indicate_wext_event(prGlueInfo, IWEVCUSTOM, pvBuf, sizeof(PTA_IPC_T)); - } - - break; - -#endif - - default: - /* - printk(KERN_WARNING "unknown indication:%lx\n", eStatus); - */ - break; - } -} /* kalIndicateStatusAndComplete */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to update the (re)association request -* information to the structure used to query and set -* OID_802_11_ASSOCIATION_INFORMATION. -* -* \param[in] prGlueInfo Pointer to the Glue structure. -* \param[in] pucFrameBody Pointer to the frame body of the last (Re)Association -* Request frame from the AP. -* \param[in] u4FrameBodyLen The length of the frame body of the last -* (Re)Association Request frame. -* \param[in] fgReassocRequest TRUE, if it is a Reassociation Request frame. -* -* \return (none) -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalUpdateReAssocReqInfo ( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucFrameBody, - IN UINT_32 u4FrameBodyLen, - IN BOOLEAN fgReassocRequest - ) -{ - PUINT_8 cp; - - ASSERT(prGlueInfo); - - /* reset */ - prGlueInfo->u4ReqIeLength = 0; - - if (fgReassocRequest) { - if (u4FrameBodyLen < 15) { - /* - printk(KERN_WARNING "frameBodyLen too short:%ld\n", frameBodyLen); - */ - return; - } - } - else { - if (u4FrameBodyLen < 9) { - /* - printk(KERN_WARNING "frameBodyLen too short:%ld\n", frameBodyLen); - */ - return; - } - } - - cp = pucFrameBody; - - if (fgReassocRequest) { - /* Capability information field 2 */ - /* Listen interval field 2*/ - /* Current AP address 6 */ - cp += 10; - u4FrameBodyLen -= 10; - } - else { - /* Capability information field 2 */ - /* Listen interval field 2*/ - cp += 4; - u4FrameBodyLen -= 4; - } - - wext_indicate_wext_event(prGlueInfo, IWEVASSOCREQIE, cp, u4FrameBodyLen); - - if(u4FrameBodyLen <= CFG_CFG80211_IE_BUF_LEN) { - prGlueInfo->u4ReqIeLength = u4FrameBodyLen; - kalMemCopy(prGlueInfo->aucReqIe, cp, u4FrameBodyLen); - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This routine is called to update the (re)association -* response information to the structure used to reply with -* cfg80211_connect_result -* -* @param prGlueInfo Pointer to adapter descriptor -* @param pucFrameBody Pointer to the frame body of the last (Re)Association -* Response frame from the AP -* @param u4FrameBodyLen The length of the frame body of the last -* (Re)Association Response frame -* -* @return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalUpdateReAssocRspInfo ( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucFrameBody, - IN UINT_32 u4FrameBodyLen - ) -{ - UINT_32 u4IEOffset = 6; /* cap_info, status_code & assoc_id */ - UINT_32 u4IELength = u4FrameBodyLen - u4IEOffset; - - ASSERT(prGlueInfo); - - /* reset */ - prGlueInfo->u4RspIeLength = 0; - - if(u4IELength <= CFG_CFG80211_IE_BUF_LEN) { - prGlueInfo->u4RspIeLength = u4IELength; - kalMemCopy(prGlueInfo->aucRspIe, pucFrameBody + u4IEOffset, u4IELength); - } - -} /* kalUpdateReAssocRspInfo */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Notify OS with SendComplete event of the specific packet. Linux should -* free packets here. -* -* \param[in] prGlueInfo Pointer of GLUE Data Structure -* \param[in] pvPacket Pointer of Packet Handle -* \param[in] status Status Code for OS upper layer -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalSendCompleteAndAwakeQueue ( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID pvPacket - ) -{ - - struct net_device *prDev = NULL; - struct sk_buff *prSkb = NULL; - UINT_16 u2QueueIdx = 0; - UINT_8 ucNetworkType = 0; - BOOLEAN fgIsValidDevice = TRUE; - - - ASSERT(pvPacket); - ASSERT(prGlueInfo->i4TxPendingFrameNum); - - prSkb = (struct sk_buff *) pvPacket; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 26) - u2QueueIdx = skb_get_queue_mapping(prSkb); -#endif - ASSERT(u2QueueIdx < CFG_MAX_TXQ_NUM); - - if (GLUE_GET_PKT_IS_PAL(prSkb)) { - ucNetworkType = NETWORK_TYPE_BOW_INDEX; - } else if (GLUE_GET_PKT_IS_P2P(prSkb)) { - ucNetworkType = NETWORK_TYPE_P2P_INDEX; - -#if CFG_ENABLE_WIFI_DIRECT - /* in case packet was sent after P2P device is unregistered */ - if(prGlueInfo->prAdapter->fgIsP2PRegistered == FALSE) { - fgIsValidDevice = FALSE; - } -#endif - } else { - ucNetworkType = NETWORK_TYPE_AIS_INDEX; - } - - GLUE_DEC_REF_CNT(prGlueInfo->i4TxPendingFrameNum); - GLUE_DEC_REF_CNT(prGlueInfo->ai4TxPendingFrameNumPerQueue[ucNetworkType][u2QueueIdx]); - prDev = prSkb->dev; - - ASSERT(prDev); - - if(fgIsValidDevice == TRUE) { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 26) - if (netif_subqueue_stopped(prDev, prSkb) && - prGlueInfo->ai4TxPendingFrameNumPerQueue[ucNetworkType][u2QueueIdx] <= CFG_TX_START_NETIF_PER_QUEUE_THRESHOLD) { - netif_wake_subqueue(prDev, u2QueueIdx); - } -#else - if (prGlueInfo->i4TxPendingFrameNum < CFG_TX_STOP_NETIF_QUEUE_THRESHOLD) { - netif_wake_queue(prGlueInfo->prDevHandler); - } -#endif - } - - - dev_kfree_skb((struct sk_buff *) pvPacket); - - DBGLOG(TX, EVENT, ("----- pending frame %d -----\n", prGlueInfo->i4TxPendingFrameNum)); - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Copy Mac Address setting from registry. It's All Zeros in Linux. -* -* \param[in] prAdapter Pointer to the Adapter structure -* -* \param[out] paucMacAddr Pointer to the Mac Address buffer -* -* \retval WLAN_STATUS_SUCCESS -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalQueryRegistryMacAddr ( - IN P_GLUE_INFO_T prGlueInfo, - OUT PUINT_8 paucMacAddr - ) -{ - UINT_8 aucZeroMac[MAC_ADDR_LEN] = {0,0,0,0,0,0} - DEBUGFUNC("kalQueryRegistryMacAddr"); - - ASSERT(prGlueInfo); - ASSERT(paucMacAddr); - - kalMemCopy((PVOID) paucMacAddr, (PVOID)aucZeroMac, MAC_ADDR_LEN); - - return; -} /* end of kalQueryRegistryMacAddr() */ - -#if CFG_SUPPORT_EXT_CONFIG -/*----------------------------------------------------------------------------*/ -/*! -* \brief Read external configuration, ex. NVRAM or file -* -* \param[in] prGlueInfo Pointer of GLUE Data Structure -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -kalReadExtCfg ( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - /* External data is given from user space by ioctl or /proc, not read by - driver. - */ - if (0 != prGlueInfo->u4ExtCfgLength) { - DBGLOG(INIT, TRACE, ("Read external configuration data -- OK\n")); - } - else { - DBGLOG(INIT, TRACE, ("Read external configuration data -- fail\n")); - } - - return prGlueInfo->u4ExtCfgLength; -} -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This inline function is to extract some packet information, including -* user priority, packet length, destination address, 802.1x and BT over Wi-Fi -* or not. -* -* @param prGlueInfo Pointer to the glue structure -* @param prNdisPacket Packet descriptor -* @param pucPriorityParam User priority -* @param pu4PacketLen Packet length -* @param pucEthDestAddr Destination address -* @param pfgIs1X 802.1x packet or not -* @param pfgIsPAL BT over Wi-Fi packet or not -* -* @retval TRUE Success to extract information -* @retval FALSE Fail to extract correct information -*/ -/*----------------------------------------------------------------------------*/ - -BOOL -kalQoSFrameClassifierAndPacketInfo ( - IN P_GLUE_INFO_T prGlueInfo, - IN P_NATIVE_PACKET prPacket, - OUT PUINT_8 pucPriorityParam, - OUT PUINT_32 pu4PacketLen, - OUT PUINT_8 pucEthDestAddr, - OUT PBOOLEAN pfgIs1X, - OUT PBOOLEAN pfgIsPAL, - OUT PUINT_8 pucNetworkType - ) -{ - - UINT_32 u4PacketLen; - - - UINT_8 ucUserPriority = USER_PRIORITY_DEFAULT; /* Default */ - UINT_16 u2EtherTypeLen; - struct sk_buff *prSkb = (struct sk_buff *) prPacket; - PUINT_8 aucLookAheadBuf = NULL; - - DEBUGFUNC("kalQoSFrameClassifierAndPacketInfo"); - - u4PacketLen = prSkb->len; - - if (u4PacketLen < ETH_HLEN) { - DBGLOG(INIT, WARN, ("Invalid Ether packet length: %d\n", u4PacketLen)); - return FALSE; - } - - aucLookAheadBuf = prSkb->data; - - *pfgIs1X = FALSE; - *pfgIsPAL = FALSE; - //4 <3> Obtain the User Priority for WMM - u2EtherTypeLen = (aucLookAheadBuf[ETH_TYPE_LEN_OFFSET] << 8) | (aucLookAheadBuf[ETH_TYPE_LEN_OFFSET + 1]); - - if ((u2EtherTypeLen == ETH_P_IP) && - (u4PacketLen >= LOOK_AHEAD_LEN)) { - PUINT_8 pucIpHdr = &aucLookAheadBuf[ETH_HLEN]; - UINT_8 ucIpVersion; - - ucIpVersion = (pucIpHdr[0] & IPVH_VERSION_MASK) >> IPVH_VERSION_OFFSET; - //printk ("ip version %x\n", ucIpVersion); - if (ucIpVersion == IPVERSION) { - UINT_8 ucIpTos; - /* Get the DSCP value from the header of IP packet. */ - ucIpTos = pucIpHdr[1]; - ucUserPriority = ((ucIpTos & IPTOS_PREC_MASK) >> IPTOS_PREC_OFFSET); - } - - /* TODO(Kevin): Add TSPEC classifier here */ - } - else if (u2EtherTypeLen == ETH_P_1X) { /* For Port Control */ - //DBGLOG(REQ, TRACE, ("Tx 1x\n")); - *pfgIs1X = TRUE; - } - else if (u2EtherTypeLen == ETH_P_PRE_1X) { /* For Pre 1x pkt */ - //DBGLOG(REQ, TRACE, ("Tx Pre-1x\n")); - *pfgIs1X = TRUE; - } -#if CFG_SUPPORT_WAPI - else if (u2EtherTypeLen == ETH_WPI_1X) { - *pfgIs1X = TRUE; - } -#endif - else if (u2EtherTypeLen <= 1500) { /* 802.3 Frame */ - UINT_8 ucDSAP, ucSSAP, ucControl; - UINT_8 aucOUI[3]; - - ucDSAP = *(PUINT_8) &aucLookAheadBuf[ETH_LLC_OFFSET]; - ucSSAP = *(PUINT_8) &aucLookAheadBuf[ETH_LLC_OFFSET + 1]; - ucControl = *(PUINT_8) &aucLookAheadBuf[ETH_LLC_OFFSET + 2]; - - aucOUI[0] = *(PUINT_8) &aucLookAheadBuf[ETH_SNAP_OFFSET]; - aucOUI[1] = *(PUINT_8) &aucLookAheadBuf[ETH_SNAP_OFFSET + 1]; - aucOUI[2] = *(PUINT_8) &aucLookAheadBuf[ETH_SNAP_OFFSET + 2]; - - if(ucDSAP == ETH_LLC_DSAP_SNAP && - ucSSAP == ETH_LLC_SSAP_SNAP && - ucControl == ETH_LLC_CONTROL_UNNUMBERED_INFORMATION && - aucOUI[0] == ETH_SNAP_BT_SIG_OUI_0 && - aucOUI[1] == ETH_SNAP_BT_SIG_OUI_1 && - aucOUI[2] == ETH_SNAP_BT_SIG_OUI_2) { - - UINT_16 tmp = ((aucLookAheadBuf[ETH_SNAP_OFFSET + 3] << 8) | aucLookAheadBuf[ETH_SNAP_OFFSET + 4]); - - *pfgIsPAL = TRUE; - ucUserPriority = (UINT_8)prSkb->priority; - - if (tmp == BOW_PROTOCOL_ID_SECURITY_FRAME) { - *pfgIs1X = TRUE; - } - } - } - - //4 <4> Return the value of Priority Parameter. - *pucPriorityParam = ucUserPriority; - - //4 <5> Retrieve Packet Information - DA - /* Packet Length/ Destination Address */ - *pu4PacketLen = u4PacketLen; - - kalMemCopy(pucEthDestAddr, aucLookAheadBuf, PARAM_MAC_ADDR_LEN); - - - //<6> Network type -#if CFG_ENABLE_BT_OVER_WIFI - if(*pfgIsPAL == TRUE) { - *pucNetworkType = NETWORK_TYPE_BOW_INDEX; - } - else -#endif - { -#if CFG_ENABLE_WIFI_DIRECT - if(prGlueInfo->prAdapter->fgIsP2PRegistered && GLUE_GET_PKT_IS_P2P(prPacket)) { - *pucNetworkType = NETWORK_TYPE_P2P_INDEX; - } - else -#endif - { - *pucNetworkType = NETWORK_TYPE_AIS_INDEX; - } - } - return TRUE; -} /* end of kalQoSFrameClassifier() */ - -VOID -kalOidComplete ( - IN P_GLUE_INFO_T prGlueInfo, - IN BOOLEAN fgSetQuery, - IN UINT_32 u4SetQueryInfoLen, - IN WLAN_STATUS rOidStatus - ) -{ - - ASSERT(prGlueInfo); - /* remove timeout check timer */ - wlanoidClearTimeoutCheck(prGlueInfo->prAdapter); - - //if (prGlueInfo->u4TimeoutFlag != 1) { - prGlueInfo->rPendStatus = rOidStatus; - complete(&prGlueInfo->rPendComp); - prGlueInfo->u4OidCompleteFlag = 1; - //} - /* else let it timeout on kalIoctl entry */ -} - -VOID -kalOidClearance( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - //if (prGlueInfo->u4TimeoutFlag != 1) { - //clear_bit(GLUE_FLAG_OID_BIT, &prGlueInfo->u4Flag); - if (prGlueInfo->u4OidCompleteFlag != 1) { - complete(&prGlueInfo->rPendComp); - } - //} -} - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is used to transfer linux ioctl to OID, and we -* need to specify the behavior of the OID by ourself -* -* @param prGlueInfo Pointer to the glue structure -* @param pvInfoBuf Data buffer -* @param u4InfoBufLen Data buffer length -* @param fgRead Is this a read OID -* @param fgWaitResp does this OID need to wait for values -* @param fgCmd does this OID compose command packet -* @param pu4QryInfoLen The data length of the return values -* -* @retval TRUE Success to extract information -* @retval FALSE Fail to extract correct information -*/ -/*----------------------------------------------------------------------------*/ - -// todo: enqueue the i/o requests for multiple processes access -// -// currently, return -1 -// - -//static GL_IO_REQ_T OidEntry; - -WLAN_STATUS -kalIoctl (IN P_GLUE_INFO_T prGlueInfo, - IN PFN_OID_HANDLER_FUNC pfnOidHandler, - IN PVOID pvInfoBuf, - IN UINT_32 u4InfoBufLen, - IN BOOL fgRead, - IN BOOL fgWaitResp, - IN BOOL fgCmd, - IN BOOL fgIsP2pOid, - OUT PUINT_32 pu4QryInfoLen - ) -{ - P_GL_IO_REQ_T prIoReq = NULL; - WLAN_STATUS ret = WLAN_STATUS_SUCCESS; - - //GLUE_SPIN_LOCK_DECLARATION(); - ASSERT(prGlueInfo); - - /* <1> Check if driver is halt */ - - //if (prGlueInfo->u4Flag & GLUE_FLAG_HALT) { - // return WLAN_STATUS_ADAPTER_NOT_READY; - //} - - if (down_interruptible(&g_halt_sem)) { - return WLAN_STATUS_FAILURE; - } - - - if (g_u4HaltFlag) { - up(&g_halt_sem); - return WLAN_STATUS_ADAPTER_NOT_READY; - } - - if(down_interruptible(&prGlueInfo->ioctl_sem)) { - up(&g_halt_sem); - return WLAN_STATUS_FAILURE; - } - - /* <2> TODO: thread-safe */ - - /* <3> point to the OidEntry of Glue layer */ - - prIoReq = &(prGlueInfo->OidEntry); - - ASSERT(prIoReq); - - /* <4> Compose the I/O request */ - prIoReq->prAdapter = prGlueInfo->prAdapter; - prIoReq->pfnOidHandler = pfnOidHandler; - prIoReq->pvInfoBuf = pvInfoBuf; - prIoReq->u4InfoBufLen = u4InfoBufLen; - prIoReq->pu4QryInfoLen = pu4QryInfoLen; - prIoReq->fgRead = fgRead; - prIoReq->fgWaitResp= fgWaitResp; - prIoReq->rStatus = WLAN_STATUS_FAILURE; -#if CFG_ENABLE_WIFI_DIRECT - prIoReq->fgIsP2pOid = fgIsP2pOid; -#endif - - /* <5> Reset the status of pending OID */ - prGlueInfo->rPendStatus = WLAN_STATUS_FAILURE; - //prGlueInfo->u4TimeoutFlag = 0; - prGlueInfo->u4OidCompleteFlag = 0; - - /* <6> Check if we use the command queue */ - prIoReq->u4Flag = fgCmd; - - /* <7> schedule the OID bit */ - set_bit(GLUE_FLAG_OID_BIT, &prGlueInfo->u4Flag); - - /* <8> Wake up tx thread to handle kick start the I/O request */ - wake_up_interruptible(&prGlueInfo->waitq); - - /* <9> Block and wait for event or timeout, current the timeout is 5 secs */ - //if (wait_for_completion_interruptible_timeout(&prGlueInfo->rPendComp, 5 * KAL_HZ)) { - //if (!wait_for_completion_interruptible(&prGlueInfo->rPendComp)) { - wait_for_completion(&prGlueInfo->rPendComp); { - /* Case 1: No timeout. */ - /* if return WLAN_STATUS_PENDING, the status of cmd is stored in prGlueInfo */ - if (prIoReq->rStatus == WLAN_STATUS_PENDING) { - ret = prGlueInfo->rPendStatus; - } else { - ret = prIoReq->rStatus; - } - } - #if 0 - else { - /* Case 2: timeout */ - /* clear pending OID's cmd in CMD queue */ - if (fgCmd) { - prGlueInfo->u4TimeoutFlag = 1; - wlanReleasePendingOid(prGlueInfo->prAdapter, 0); - } - ret = WLAN_STATUS_FAILURE; - } - #endif - - up(&prGlueInfo->ioctl_sem); - up(&g_halt_sem); - - return ret; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to clear all pending security frames -* -* \param prGlueInfo Pointer of GLUE Data Structure -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalClearSecurityFrames( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - P_QUE_T prCmdQue; - QUE_T rTempCmdQue; - P_QUE_T prTempCmdQue = &rTempCmdQue; - P_QUE_ENTRY_T prQueueEntry = (P_QUE_ENTRY_T)NULL; - - P_CMD_INFO_T prCmdInfo = (P_CMD_INFO_T)NULL; - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prGlueInfo); - - // Clear pending security frames in prGlueInfo->rCmdQueue - prCmdQue = &prGlueInfo->rCmdQueue; - - - - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_CMD_QUE); - QUEUE_MOVE_ALL(prTempCmdQue, prCmdQue); - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - while (prQueueEntry) { - prCmdInfo = (P_CMD_INFO_T)prQueueEntry; - - if (prCmdInfo->eCmdType == COMMAND_TYPE_SECURITY_FRAME) { - prCmdInfo->pfCmdTimeoutHandler(prGlueInfo->prAdapter, prCmdInfo); - cmdBufFreeCmdInfo(prGlueInfo->prAdapter, prCmdInfo); - } - else { - QUEUE_INSERT_TAIL(prCmdQue, prQueueEntry); - } - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - } - - QUEUE_CONCATENATE_QUEUES(prCmdQue, prTempCmdQue); - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_CMD_QUE); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to clear pending security frames -* belongs to dedicated network type -* -* \param prGlueInfo Pointer of GLUE Data Structure -* \param eNetworkTypeIdx Network Type Index -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalClearSecurityFramesByNetType( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ) -{ - P_QUE_T prCmdQue; - QUE_T rTempCmdQue; - P_QUE_T prTempCmdQue = &rTempCmdQue; - P_QUE_ENTRY_T prQueueEntry = (P_QUE_ENTRY_T)NULL; - - P_CMD_INFO_T prCmdInfo = (P_CMD_INFO_T)NULL; - GLUE_SPIN_LOCK_DECLARATION(); - - - ASSERT(prGlueInfo); - - // Clear pending security frames in prGlueInfo->rCmdQueue - prCmdQue = &prGlueInfo->rCmdQueue; - - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_CMD_QUE); - QUEUE_MOVE_ALL(prTempCmdQue, prCmdQue); - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - while (prQueueEntry) { - prCmdInfo = (P_CMD_INFO_T)prQueueEntry; - - if (prCmdInfo->eCmdType == COMMAND_TYPE_SECURITY_FRAME && - prCmdInfo->eNetworkType == eNetworkTypeIdx) { - prCmdInfo->pfCmdTimeoutHandler(prGlueInfo->prAdapter, prCmdInfo); - cmdBufFreeCmdInfo(prGlueInfo->prAdapter, prCmdInfo); - } - else { - QUEUE_INSERT_TAIL(prCmdQue, prQueueEntry); - } - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - } - - QUEUE_CONCATENATE_QUEUES(prCmdQue, prTempCmdQue); - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_CMD_QUE); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to clear all pending management frames -* -* \param prGlueInfo Pointer of GLUE Data Structure -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalClearMgmtFrames( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - P_QUE_T prCmdQue; - QUE_T rTempCmdQue; - P_QUE_T prTempCmdQue = &rTempCmdQue; - P_QUE_ENTRY_T prQueueEntry = (P_QUE_ENTRY_T)NULL; - P_CMD_INFO_T prCmdInfo = (P_CMD_INFO_T)NULL; - - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prGlueInfo); - - // Clear pending management frames in prGlueInfo->rCmdQueue - prCmdQue = &prGlueInfo->rCmdQueue; - - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_CMD_QUE); - QUEUE_MOVE_ALL(prTempCmdQue, prCmdQue); - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - while (prQueueEntry) { - prCmdInfo = (P_CMD_INFO_T)prQueueEntry; - - if (prCmdInfo->eCmdType == COMMAND_TYPE_MANAGEMENT_FRAME) { - wlanReleaseCommand(prGlueInfo->prAdapter, prCmdInfo); - cmdBufFreeCmdInfo(prGlueInfo->prAdapter, prCmdInfo); - } - else { - QUEUE_INSERT_TAIL(prCmdQue, prQueueEntry); - } - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - } - - QUEUE_CONCATENATE_QUEUES(prCmdQue, prTempCmdQue); - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_CMD_QUE); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to clear all pending management frames -* belongs to dedicated network type -* \param prGlueInfo Pointer of GLUE Data Structure -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalClearMgmtFramesByNetType ( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ) -{ - P_QUE_T prCmdQue; - QUE_T rTempCmdQue; - P_QUE_T prTempCmdQue = &rTempCmdQue; - P_QUE_ENTRY_T prQueueEntry = (P_QUE_ENTRY_T)NULL; - P_CMD_INFO_T prCmdInfo = (P_CMD_INFO_T)NULL; - - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prGlueInfo); - - // Clear pending management frames in prGlueInfo->rCmdQueue - prCmdQue = &prGlueInfo->rCmdQueue; - - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_CMD_QUE); - QUEUE_MOVE_ALL(prTempCmdQue, prCmdQue); - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - while (prQueueEntry) { - prCmdInfo = (P_CMD_INFO_T)prQueueEntry; - - if (prCmdInfo->eCmdType == COMMAND_TYPE_MANAGEMENT_FRAME && - prCmdInfo->eNetworkType == eNetworkTypeIdx) { - wlanReleaseCommand(prGlueInfo->prAdapter, prCmdInfo); - cmdBufFreeCmdInfo(prGlueInfo->prAdapter, prCmdInfo); - } - else { - QUEUE_INSERT_TAIL(prCmdQue, prQueueEntry); - } - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - } - - QUEUE_CONCATENATE_QUEUES(prCmdQue, prTempCmdQue); - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_CMD_QUE); -} /* kalClearMgmtFramesByNetType */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* @brief This function is a kernel thread function for handling command packets -* Tx requests and interrupt events -* -* @param data data pointer to private data of tx_thread -* -* @retval If the function succeeds, the return value is 0. -* Otherwise, an error code is returned. -* -*/ -/*----------------------------------------------------------------------------*/ - -int tx_thread(void *data) -{ - struct net_device *dev = data; - P_GLUE_INFO_T prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(dev)); - - P_QUE_ENTRY_T prQueueEntry = NULL; - P_GL_IO_REQ_T prIoReq = NULL; - P_QUE_T prTxQueue = NULL; - P_QUE_T prCmdQue = NULL; - - int ret = 0; - - BOOLEAN fgNeedHwAccess = FALSE; - - struct sk_buff *prSkb = NULL; - - /* for spin lock acquire and release */ - GLUE_SPIN_LOCK_DECLARATION(); - - prTxQueue = &prGlueInfo->rTxQueue; - prCmdQue = &prGlueInfo->rCmdQueue; - - current->flags |= PF_NOFREEZE; - - DBGLOG(INIT, INFO, ("tx_thread starts running... \n")); - - while (TRUE) { - -#if CFG_ENABLE_WIFI_DIRECT - /*run p2p multicast list work. */ - if (test_and_clear_bit(GLUE_FLAG_SUB_MOD_MULTICAST_BIT, &prGlueInfo->u4Flag)) { - p2pSetMulticastListWorkQueueWrapper(prGlueInfo); - } -#endif - - if (prGlueInfo->u4Flag & GLUE_FLAG_HALT) { - DBGLOG(INIT, INFO, ("tx_thread should stop now...\n")); - break; - } - - /* - * sleep on waitqueue if no events occurred. Event contain (1) GLUE_FLAG_INT - * (2) GLUE_FLAG_OID (3) GLUE_FLAG_TXREQ (4) GLUE_FLAG_HALT - * - */ - - ret = wait_event_interruptible(prGlueInfo->waitq, - (prGlueInfo->u4Flag != 0)); - -#if CFG_DBG_GPIO_PINS - /* TX thread Wake up */ - mtk_wcn_stp_debug_gpio_assert(IDX_TX_THREAD, DBG_TIE_LOW); -#endif -#if CFG_ENABLE_WIFI_DIRECT - /*run p2p multicast list work. */ - if (test_and_clear_bit(GLUE_FLAG_SUB_MOD_MULTICAST_BIT, &prGlueInfo->u4Flag)) { - p2pSetMulticastListWorkQueueWrapper(prGlueInfo); - } - - if (test_and_clear_bit(GLUE_FLAG_FRAME_FILTER_BIT, &prGlueInfo->u4Flag)) { - p2pFuncUpdateMgmtFrameRegister(prGlueInfo->prAdapter, prGlueInfo->prP2PInfo->u4OsMgmtFrameFilter); - } - - -#endif - if (prGlueInfo->u4Flag & GLUE_FLAG_HALT) { - DBGLOG(INIT, INFO, ("<1>tx_thread should stop now...\n")); - break; - } - - fgNeedHwAccess = FALSE; - - /* Handle Interrupt */ - if (test_and_clear_bit(GLUE_FLAG_INT_BIT, &prGlueInfo->u4Flag)) { - - if (fgNeedHwAccess == FALSE) { - fgNeedHwAccess = TRUE; - - wlanAcquirePowerControl(prGlueInfo->prAdapter); - } - - /* the Wi-Fi interrupt is already disabled in mmc thread, - so we set the flag only to enable the interrupt later */ - prGlueInfo->prAdapter->fgIsIntEnable = FALSE; - //wlanISR(prGlueInfo->prAdapter, TRUE); - - if (prGlueInfo->u4Flag & GLUE_FLAG_HALT) { - /* Should stop now... skip pending interrupt */ - DBGLOG(INIT, INFO, ("ignore pending interrupt\n")); - } - else { - - wlanIST(prGlueInfo->prAdapter); - } - } - - /* transfer ioctl to OID request */ - #if 0 - if (prGlueInfo->u4Flag & GLUE_FLAG_HALT) { - printk(KERN_INFO DRV_NAME"<2>tx_thread should stop now...\n"); - break; - } - #endif - - do { - if (test_and_clear_bit(GLUE_FLAG_OID_BIT, &prGlueInfo->u4Flag)) { - /* get current prIoReq */ - prIoReq = &(prGlueInfo->OidEntry); -#if CFG_ENABLE_WIFI_DIRECT - if(prGlueInfo->prAdapter->fgIsP2PRegistered == FALSE - && prIoReq->fgIsP2pOid == TRUE) { - /* if this Oid belongs to p2p and p2p module is removed - * do nothing, - */ - } - else -#endif - { - if (FALSE == prIoReq->fgRead) { - prIoReq->rStatus = wlanSetInformation( - prIoReq->prAdapter, - prIoReq->pfnOidHandler, - prIoReq->pvInfoBuf, - prIoReq->u4InfoBufLen, - prIoReq->pu4QryInfoLen); - } else { - prIoReq->rStatus = wlanQueryInformation( - prIoReq->prAdapter, - prIoReq->pfnOidHandler, - prIoReq->pvInfoBuf, - prIoReq->u4InfoBufLen, - prIoReq->pu4QryInfoLen); - } - - if (prIoReq->rStatus != WLAN_STATUS_PENDING) { - complete(&prGlueInfo->rPendComp); - } - else { - wlanoidTimeoutCheck(prGlueInfo->prAdapter, prIoReq->pfnOidHandler); - } - } - } - - } while (FALSE); - - - /* - * - * if TX request, clear the TXREQ flag. TXREQ set by kalSetEvent/GlueSetEvent - * indicates the following requests occur - * - */ - #if 0 - if (prGlueInfo->u4Flag & GLUE_FLAG_HALT) { - printk(KERN_INFO DRV_NAME"<3>tx_thread should stop now...\n"); - break; - } - #endif - - if (test_and_clear_bit(GLUE_FLAG_TXREQ_BIT, &prGlueInfo->u4Flag)) - { - - /* Process Mailbox Messages */ - wlanProcessMboxMessage(prGlueInfo->prAdapter); - - /* Process CMD request */ - do { - if (prCmdQue->u4NumElem > 0) { - if (fgNeedHwAccess == FALSE) { - fgNeedHwAccess = TRUE; - - wlanAcquirePowerControl(prGlueInfo->prAdapter); - } - wlanProcessCommandQueue(prGlueInfo->prAdapter, prCmdQue); - } - } while (FALSE); - - /* Handle Packet Tx */ - { - while (QUEUE_IS_NOT_EMPTY(prTxQueue)) { - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_TX_QUE); - QUEUE_REMOVE_HEAD(prTxQueue, prQueueEntry, P_QUE_ENTRY_T); - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_TX_QUE); - - ASSERT(prQueueEntry); - if (NULL == prQueueEntry) { - break; - } - - prSkb = (struct sk_buff *) GLUE_GET_PKT_DESCRIPTOR(prQueueEntry); - ASSERT(prSkb); - if (NULL == prSkb) { - DBGLOG(INIT, WARN, ("prSkb == NULL in tx\n")); - continue; - } - - if(wlanEnqueueTxPacket(prGlueInfo->prAdapter, - (P_NATIVE_PACKET)prSkb) == WLAN_STATUS_RESOURCES) { - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_TX_QUE); - QUEUE_INSERT_HEAD(prTxQueue, prQueueEntry); - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_TX_QUE); - - break; - } - } - - if (wlanGetTxPendingFrameCount(prGlueInfo->prAdapter) > 0) { - wlanTxPendingPackets(prGlueInfo->prAdapter, &fgNeedHwAccess); - } - } - - } - - /* Process RX, In linux, we don't need to free sk_buff by ourself */ - - /* In linux, we don't need to free sk_buff by ourself */ - - /* In linux, we don't do reset */ - if (fgNeedHwAccess == TRUE) { - wlanReleasePowerControl(prGlueInfo->prAdapter); - } - - /* handle cnmTimer time out */ - if (test_and_clear_bit(GLUE_FLAG_TIMEOUT_BIT, &prGlueInfo->u4Flag)) { - wlanTimerTimeoutCheck(prGlueInfo->prAdapter); - } - - #if CFG_DBG_GPIO_PINS - /* TX thread go to sleep */ - if (!prGlueInfo->u4Flag){ - mtk_wcn_stp_debug_gpio_assert(IDX_TX_THREAD, DBG_TIE_HIGH); - } - #endif - } - - #if 0 - if (fgNeedHwAccess == TRUE) { - wlanReleasePowerControl(prGlueInfo->prAdapter); - } - #endif - - /* flush the pending TX packets */ - if (prGlueInfo->i4TxPendingFrameNum > 0) { - kalFlushPendingTxPackets(prGlueInfo); - } - - /* flush pending security frames */ - if (prGlueInfo->i4TxPendingSecurityFrameNum > 0) { - kalClearSecurityFrames(prGlueInfo); - } - - /* remove pending oid */ - wlanReleasePendingOid(prGlueInfo->prAdapter, 0); - - - /* In linux, we don't need to free sk_buff by ourself */ - - DBGLOG(INIT, INFO, ("mtk_sdiod stops\n")); - complete(&prGlueInfo->rHaltComp); - - return 0; - -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to check if card is removed -* -* \param pvGlueInfo Pointer of GLUE Data Structure -* -* \retval TRUE: card is removed -* FALSE: card is still attached -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalIsCardRemoved( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - return FALSE; - // Linux MMC doesn't have removal notification yet -} - -/*----------------------------------------------------------------------------*/ -/*! - * \brief This routine is used to send command to firmware for overriding netweork address - * - * \param pvGlueInfo Pointer of GLUE Data Structure - - * \retval TRUE - * FALSE - */ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalRetrieveNetworkAddress( - IN P_GLUE_INFO_T prGlueInfo, - IN OUT PARAM_MAC_ADDRESS * prMacAddr - ) -{ - ASSERT(prGlueInfo); - - if(prGlueInfo->fgIsMacAddrOverride == FALSE) { - #if !defined(CONFIG_X86) - UINT_32 i; - BOOLEAN fgIsReadError = FALSE; - - for(i = 0 ; i < MAC_ADDR_LEN ; i+=2) { - if(kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, aucMacAddress) + i, - (PUINT_16) (((PUINT_8)prMacAddr) + i)) == FALSE) { - fgIsReadError = TRUE; - break; - } - } - - if(fgIsReadError == TRUE) { - return FALSE; - } - else { - return TRUE; - } - #else - /* x86 Linux doesn't need to override network address so far */ - return FALSE; - #endif - } - else { - COPY_MAC_ADDR(prMacAddr, prGlueInfo->rMacAddrOverride); - - return TRUE; - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to flush pending TX packets in glue layer -* -* \param pvGlueInfo Pointer of GLUE Data Structure -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalFlushPendingTxPackets( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - P_QUE_T prTxQue; - P_QUE_ENTRY_T prQueueEntry; - PVOID prPacket; - - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prGlueInfo); - - prTxQue = &(prGlueInfo->rTxQueue); - - if (prGlueInfo->i4TxPendingFrameNum) { - while (TRUE) { - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_TX_QUE); - QUEUE_REMOVE_HEAD(prTxQue, prQueueEntry, P_QUE_ENTRY_T); - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_TX_QUE); - - if (prQueueEntry == NULL) { - break; - } - - prPacket = GLUE_GET_PKT_DESCRIPTOR(prQueueEntry); - - kalSendComplete(prGlueInfo, - prPacket, - WLAN_STATUS_NOT_ACCEPTED); - } - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is get indicated media state -* -* \param pvGlueInfo Pointer of GLUE Data Structure -* -* \retval -*/ -/*----------------------------------------------------------------------------*/ -ENUM_PARAM_MEDIA_STATE_T -kalGetMediaStateIndicated( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - return prGlueInfo->eParamMediaStateIndicated; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to set indicated media state -* -* \param pvGlueInfo Pointer of GLUE Data Structure -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalSetMediaStateIndicated( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_PARAM_MEDIA_STATE_T eParamMediaStateIndicate - ) -{ - ASSERT(prGlueInfo); - - prGlueInfo->eParamMediaStateIndicated = eParamMediaStateIndicate; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to clear pending OID staying in command queue -* -* \param prGlueInfo Pointer of GLUE Data Structure -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalOidCmdClearance( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - P_QUE_T prCmdQue; - QUE_T rTempCmdQue; - P_QUE_T prTempCmdQue = &rTempCmdQue; - P_QUE_ENTRY_T prQueueEntry = (P_QUE_ENTRY_T)NULL; - P_CMD_INFO_T prCmdInfo = (P_CMD_INFO_T)NULL; - - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prGlueInfo); - - prCmdQue = &prGlueInfo->rCmdQueue; - - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_CMD_QUE); - QUEUE_MOVE_ALL(prTempCmdQue, prCmdQue); - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - while (prQueueEntry) { - - if (((P_CMD_INFO_T)prQueueEntry)->fgIsOid) { - prCmdInfo = (P_CMD_INFO_T)prQueueEntry; - break; - } - else { - QUEUE_INSERT_TAIL(prCmdQue, prQueueEntry); - } - - QUEUE_REMOVE_HEAD(prTempCmdQue, prQueueEntry, P_QUE_ENTRY_T); - } - - QUEUE_CONCATENATE_QUEUES(prCmdQue, prTempCmdQue); - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_CMD_QUE); - - if (prCmdInfo) { - if (prCmdInfo->pfCmdTimeoutHandler) { - prCmdInfo->pfCmdTimeoutHandler(prGlueInfo->prAdapter, prCmdInfo); - } - else { - kalOidComplete(prGlueInfo, - prCmdInfo->fgSetQuery, - 0, - WLAN_STATUS_NOT_ACCEPTED); - } - - prGlueInfo->u4OidCompleteFlag = 1; - cmdBufFreeCmdInfo(prGlueInfo->prAdapter, prCmdInfo); - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to insert command into prCmdQueue -* -* \param prGlueInfo Pointer of GLUE Data Structure -* prQueueEntry Pointer of queue entry to be inserted -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalEnqueueCommand( - IN P_GLUE_INFO_T prGlueInfo, - IN P_QUE_ENTRY_T prQueueEntry - ) -{ - P_QUE_T prCmdQue; - - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prGlueInfo); - ASSERT(prQueueEntry); - - prCmdQue = &prGlueInfo->rCmdQueue; - - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_CMD_QUE); - QUEUE_INSERT_TAIL(prCmdQue, prQueueEntry); - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_CMD_QUE); -} - -/*----------------------------------------------------------------------------*/ -/*! -* @brief Handle EVENT_ID_ASSOC_INFO event packet by indicating to OS with -* proper information -* -* @param pvGlueInfo Pointer of GLUE Data Structure -* @param prAssocInfo Pointer of EVENT_ID_ASSOC_INFO Packet -* -* @return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalHandleAssocInfo( - IN P_GLUE_INFO_T prGlueInfo, - IN P_EVENT_ASSOC_INFO prAssocInfo - ) -{ - // to do -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to get firmware load address from registry -* -* \param prGlueInfo Pointer of GLUE Data Structure -* -* \retval -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -kalGetFwLoadAddress( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - return prGlueInfo->rRegInfo.u4LoadAddress; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to get firmware start address from registry -* -* \param prGlueInfo Pointer of GLUE Data Structure -* -* \retval -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -kalGetFwStartAddress( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - return prGlueInfo->rRegInfo.u4StartAddress; -} - -/*----------------------------------------------------------------------------*/ -/*! - * * @brief Notify OS with SendComplete event of the specific packet. Linux should - * * free packets here. - * * - * * @param pvGlueInfo Pointer of GLUE Data Structure - * * @param pvPacket Pointer of Packet Handle - * * @param status Status Code for OS upper layer - * * - * * @return none - * */ -/*----------------------------------------------------------------------------*/ - -/// Todo -VOID -kalSecurityFrameSendComplete ( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID pvPacket, - IN WLAN_STATUS rStatus - ) -{ - ASSERT(pvPacket); - - dev_kfree_skb((struct sk_buff *) pvPacket); - GLUE_DEC_REF_CNT(prGlueInfo->i4TxPendingSecurityFrameNum); -} - -UINT_32 -kalGetTxPendingFrameCount( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - return (UINT_32)(prGlueInfo->i4TxPendingFrameNum); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to retrieve the number of pending commands -* (including MMPDU, 802.1X and command packets) -* -* \param prGlueInfo Pointer of GLUE Data Structure -* -* \retval -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -kalGetTxPendingCmdCount( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - P_QUE_T prCmdQue; - - ASSERT(prGlueInfo); - prCmdQue = &prGlueInfo->rCmdQueue; - - return prCmdQue->u4NumElem; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Timer Initialization Procedure -* -* \param[in] prGlueInfo Pointer to GLUE Data Structure -* \param[in] prTimerHandler Pointer to timer handling function, whose only -* argument is "prAdapter" -* -* \retval none -* -*/ -/*----------------------------------------------------------------------------*/ - -//static struct timer_list tickfn; - -VOID -kalOsTimerInitialize ( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID prTimerHandler - ) -{ - - ASSERT(prGlueInfo); - - init_timer(&(prGlueInfo->tickfn)); - prGlueInfo->tickfn.function = prTimerHandler; - prGlueInfo->tickfn.data = (unsigned long) prGlueInfo; -} - -// Todo -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set the time to do the time out check. -* -* \param[in] prGlueInfo Pointer to GLUE Data Structure -* \param[in] rInterval Time out interval from current time. -* -* \retval TRUE Success. -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalSetTimer( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Interval - ) -{ - ASSERT(prGlueInfo); - del_timer_sync(&(prGlueInfo->tickfn)); - - prGlueInfo->tickfn.expires = jiffies + u4Interval * HZ / MSEC_PER_SEC; - add_timer(&(prGlueInfo->tickfn)); - - return TRUE; /* success */ -} -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to cancel -* -* \param[in] prGlueInfo Pointer to GLUE Data Structure -* -* \retval TRUE : Timer has been canceled -* FALAE : Timer doens't exist -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalCancelTimer( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - clear_bit(GLUE_FLAG_TIMEOUT_BIT, &prGlueInfo->u4Flag); - - if (del_timer_sync(&(prGlueInfo->tickfn)) >=0) { - return TRUE; - } else { - return FALSE; - } -} -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is a callback function for scanning done -* -* \param[in] prGlueInfo Pointer to GLUE Data Structure -* -* \retval none -* -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalScanDone( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_KAL_NETWORK_TYPE_INDEX_T eNetTypeIdx, - IN WLAN_STATUS status - ) -{ - ASSERT(prGlueInfo); - - /* check for system configuration for generating error message on scan list */ - //wlanCheckSystemConfiguration(prGlueInfo->prAdapter); - - kalIndicateStatusAndComplete(prGlueInfo, WLAN_STATUS_SCAN_COMPLETE, NULL, 0); -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is used to generate a random number -* -* \param none -* -* \retval UINT_32 -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -kalRandomNumber( - VOID - ) -{ - UINT_32 number = 0; - - get_random_bytes(&number, 4); - - return number; -} - -/*----------------------------------------------------------------------------*/ -/*! - * \brief command timeout call-back function - * - * \param[in] prGlueInfo Pointer to the GLUE data structure. - * - * \retval (none) - */ -/*----------------------------------------------------------------------------*/ -VOID -kalTimeoutHandler (unsigned long arg) -{ - - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T) arg; - - ASSERT(prGlueInfo); - - /* Notify tx thread for timeout event */ - set_bit(GLUE_FLAG_TIMEOUT_BIT, &prGlueInfo->u4Flag); - wake_up_interruptible(&prGlueInfo->waitq); - - return; -} - - -VOID -kalSetEvent (P_GLUE_INFO_T pr) { - set_bit(GLUE_FLAG_TXREQ_BIT, &pr->u4Flag); - wake_up_interruptible(&pr->waitq); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to check if configuration file (NVRAM/Registry) exists -* -* \param[in] -* prGlueInfo -* -* \return -* TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalIsConfigurationExist( - IN P_GLUE_INFO_T prGlueInfo - ) -{ -#if !defined(CONFIG_X86) - ASSERT(prGlueInfo); - - return prGlueInfo->fgNvramAvailable; -#else - /* there is no configuration data for x86-linux */ - return FALSE; -#endif -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to retrieve Registry information -* -* \param[in] -* prGlueInfo -* -* \return -* Pointer of REG_INFO_T -*/ -/*----------------------------------------------------------------------------*/ -P_REG_INFO_T -kalGetConfiguration( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - return &(prGlueInfo->rRegInfo); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to retrieve version information of corresponding configuration file -* -* \param[in] -* prGlueInfo -* -* \param[out] -* pu2Part1CfgOwnVersion -* pu2Part1CfgPeerVersion -* pu2Part2CfgOwnVersion -* pu2Part2CfgPeerVersion -* -* \return -* NONE -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalGetConfigurationVersion( - IN P_GLUE_INFO_T prGlueInfo, - OUT PUINT_16 pu2Part1CfgOwnVersion, - OUT PUINT_16 pu2Part1CfgPeerVersion, - OUT PUINT_16 pu2Part2CfgOwnVersion, - OUT PUINT_16 pu2Part2CfgPeerVersion - ) -{ - ASSERT(prGlueInfo); - - ASSERT(pu2Part1CfgOwnVersion); - ASSERT(pu2Part1CfgPeerVersion); - ASSERT(pu2Part2CfgOwnVersion); - ASSERT(pu2Part2CfgPeerVersion); - - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, u2Part1OwnVersion), - pu2Part1CfgOwnVersion); - - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, u2Part1PeerVersion), - pu2Part1CfgPeerVersion); - - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, u2Part2OwnVersion), - pu2Part2CfgOwnVersion); - - kalCfgDataRead16(prGlueInfo, - OFFSET_OF(WIFI_CFG_PARAM_STRUCT, u2Part2PeerVersion), - pu2Part2CfgPeerVersion); - - return; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to check if the WPS is active or not -* -* \param[in] -* prGlueInfo -* -* \return -* TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalWSCGetActiveState( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - return (prGlueInfo->fgWpsActive); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief update RSSI and LinkQuality to GLUE layer -* -* \param[in] -* prGlueInfo -* eNetTypeIdx -* cRssi -* cLinkQuality -* -* \return -* None -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalUpdateRSSI( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_KAL_NETWORK_TYPE_INDEX_T eNetTypeIdx, - IN INT_8 cRssi, - IN INT_8 cLinkQuality - ) -{ - struct iw_statistics *pStats = (struct iw_statistics *)NULL; - - ASSERT(prGlueInfo); - - switch(eNetTypeIdx) { - case KAL_NETWORK_TYPE_AIS_INDEX: - pStats = (struct iw_statistics *) (&(prGlueInfo->rIwStats)); - break; -#if CFG_ENABLE_WIFI_DIRECT -#if CFG_SUPPORT_P2P_RSSI_QUERY - case KAL_NETWORK_TYPE_P2P_INDEX: - pStats = (struct iw_statistics *) (&(prGlueInfo->rP2pIwStats)); - break; -#endif -#endif - default: - break; - - } - - if (pStats) { - pStats->qual.qual = cLinkQuality; - pStats->qual.noise = 0; - pStats->qual.updated = IW_QUAL_QUAL_UPDATED | IW_QUAL_NOISE_UPDATED; - pStats->qual.level = 0x100 + cRssi; - pStats->qual.updated |= IW_QUAL_LEVEL_UPDATED; - } - - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Pre-allocate I/O buffer -* -* \param[in] -* none -* -* \return -* TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalInitIOBuffer( - VOID - ) -{ - UINT_32 u4Size; - - if(CFG_COALESCING_BUFFER_SIZE >= CFG_RX_COALESCING_BUFFER_SIZE) { - u4Size = CFG_COALESCING_BUFFER_SIZE + sizeof(ENHANCE_MODE_DATA_STRUCT_T); - } - else { - u4Size = CFG_RX_COALESCING_BUFFER_SIZE + sizeof(ENHANCE_MODE_DATA_STRUCT_T); - } - - pvIoBuffer = kmalloc(u4Size, GFP_KERNEL); - if(pvIoBuffer) { - pvIoBufferSize = u4Size; - pvIoBufferUsage = 0; - - return TRUE; - } - - return FALSE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Free pre-allocated I/O buffer -* -* \param[in] -* none -* -* \return -* none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalUninitIOBuffer( - VOID - ) -{ - if(pvIoBuffer) { - kfree(pvIoBuffer); - - pvIoBuffer = (PVOID) NULL; - pvIoBufferSize = 0; - pvIoBufferUsage = 0; - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Dispatch pre-allocated I/O buffer -* -* \param[in] -* u4AllocSize -* -* \return -* PVOID for pointer of pre-allocated I/O buffer -*/ -/*----------------------------------------------------------------------------*/ -PVOID -kalAllocateIOBuffer( - IN UINT_32 u4AllocSize - ) -{ - PVOID ret = (PVOID)NULL; - - if(pvIoBuffer) { - if(u4AllocSize <= (pvIoBufferSize - pvIoBufferUsage)) { - ret = (PVOID)&(((PUINT_8)(pvIoBuffer))[pvIoBufferUsage]); - pvIoBufferUsage += u4AllocSize; - } - } - else { - /* fault tolerance */ - ret = (PVOID) kalMemAlloc(u4AllocSize, PHY_MEM_TYPE); - } - - return ret; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Release all dispatched I/O buffer -* -* \param[in] -* none -* -* \return -* none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalReleaseIOBuffer( - IN PVOID pvAddr, - IN UINT_32 u4Size - ) -{ - if(pvIoBuffer) { - pvIoBufferUsage -= u4Size; - } - else { - /* fault tolerance */ - kalMemFree(pvAddr, PHY_MEM_TYPE, u4Size); - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalGetChannelList( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_BAND_T eSpecificBand, - IN UINT_8 ucMaxChannelNum, - IN PUINT_8 pucNumOfChannel, - IN P_RF_CHANNEL_INFO_T paucChannelList - ) -{ - rlmDomainGetChnlList(prGlueInfo->prAdapter, - eSpecificBand, - ucMaxChannelNum, - pucNumOfChannel, - paucChannelList); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -BOOL -kalIsAPmode( - IN P_GLUE_INFO_T prGlueInfo - ) -{ -#if CFG_ENABLE_WIFI_DIRECT - if (IS_NET_ACTIVE(prGlueInfo->prAdapter, NETWORK_TYPE_P2P_INDEX) && - p2pFuncIsAPMode(prGlueInfo->prAdapter->rWifiVar.prP2pFsmInfo)) - return TRUE; -#endif - - return FALSE; -} - - -#if CFG_SUPPORT_802_11W -/*----------------------------------------------------------------------------*/ -/*! -* \brief to check if the MFP is active or not -* -* \param[in] -* prGlueInfo -* -* \return -* TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -kalGetMfpSetting( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - return (prGlueInfo->rWpaInfo.u4Mfp); -} -#endif - -struct file* -kalFileOpen( - const char* path, - int flags, - int rights) -{ - struct file* filp = NULL; - mm_segment_t oldfs; - int err = 0; - - oldfs = get_fs(); - set_fs(get_ds()); - filp = filp_open(path, flags, rights); - set_fs(oldfs); - if(IS_ERR(filp)) { - err = PTR_ERR(filp); - return NULL; - } - return filp; -} - -VOID -kalFileClose( - struct file* file) -{ - filp_close(file, NULL); -} - -UINT_32 -kalFileRead( - struct file* file, - unsigned long long offset, - unsigned char* data, - unsigned int size) -{ - mm_segment_t oldfs; - int ret; - - oldfs = get_fs(); - set_fs(get_ds()); - - ret = vfs_read(file, data, size, &offset); - - set_fs(oldfs); - return ret; -} - -UINT_32 -kalFileWrite( - struct file* file, - unsigned long long offset, - unsigned char* data, - unsigned int size) -{ - mm_segment_t oldfs; - int ret; - - oldfs = get_fs(); - set_fs(get_ds()); - - ret = vfs_write(file, data, size, &offset); - - set_fs(oldfs); - return ret; -} - -UINT_32 -kalWriteToFile( - const PUINT_8 pucPath, - BOOLEAN fgDoAppend, - PUINT_8 pucData, - UINT_32 u4Size) -{ - struct file* file = NULL; - UINT_32 ret; - UINT_32 u4Flags = 0; - - if(fgDoAppend) { - u4Flags = O_APPEND; - } - - file = kalFileOpen(pucPath, O_WRONLY | O_CREAT | u4Flags, S_IRWXU); - ret = kalFileWrite(file, 0, pucData, u4Size); - kalFileClose(file); - - return ret; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To indicate BSS-INFO to NL80211 as scanning result -* -* \param[in] -* prGlueInfo -* pucBeaconProbeResp -* u4FrameLen -* -* -* -* \return -* none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalIndicateBssInfo ( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucBeaconProbeResp, - IN UINT_32 u4FrameLen, - IN UINT_8 ucChannelNum, - IN INT_32 i4SignalStrength - ) -{ - struct wiphy *wiphy; - struct ieee80211_channel *prChannel = NULL; - - ASSERT(prGlueInfo); - wiphy = priv_to_wiphy(prGlueInfo); - - /* search through channel entries */ - if(ucChannelNum <= 14) { - prChannel = ieee80211_get_channel(wiphy, ieee80211_channel_to_frequency(ucChannelNum, IEEE80211_BAND_2GHZ)); - } - else { - prChannel = ieee80211_get_channel(wiphy, ieee80211_channel_to_frequency(ucChannelNum, IEEE80211_BAND_5GHZ)); - } - - if(prChannel != NULL && prGlueInfo->prScanRequest != NULL) { - struct cfg80211_bss *bss; - - /* indicate to NL80211 subsystem */ - bss = cfg80211_inform_bss_frame(wiphy, - prChannel, - (struct ieee80211_mgmt *)pucBeaconProbeResp, - u4FrameLen, - i4SignalStrength * 100, - GFP_KERNEL); - - if(!bss) { - DBGLOG(REQ, WARN, ("cfg80211_inform_bss_frame() returned with NULL\n")); - } - else { - cfg80211_put_bss(bss); - } - } - - return; -} - diff --git a/drivers/net/wireless/mt5931/os/linux/gl_p2p.c b/drivers/net/wireless/mt5931/os/linux/gl_p2p.c deleted file mode 100755 index 602d43a973bf..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/gl_p2p.c +++ /dev/null @@ -1,5498 +0,0 @@ -/* -** $Id: @(#) gl_p2p.c@@ -*/ - -/*! \file gl_p2p.c - \brief Main routines of Linux driver interface for Wi-Fi Direct - - This file contains the main routines of Linux driver for MediaTek Inc. 802.11 - Wireless LAN Adapters. -*/ - -/******************************************************************************* -* Copyright (c) 2007 MediaTek Inc. -* -* All rights reserved. Copying, compilation, modification, distribution -* or any other use whatsoever of this material is strictly prohibited -* except in accordance with a Software License Agreement with -* MediaTek Inc. -******************************************************************************** -*/ - -/******************************************************************************* -* LEGAL DISCLAIMER -* -* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND -* AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK -* SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE -* PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY -* DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT -* LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -* PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE -* ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY -* WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK -* SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY -* WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE -* FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO -* CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. -* -* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE -* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL -* BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT -* ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY -* BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. -* -* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE -* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT -* OF LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING -* THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN -* FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE -* (ICC). -******************************************************************************** -*/ - -/* -** $Log: gl_p2p.c $ -** -** 08 17 2012 yuche.tsai -** NULL -** Fix compile warning. -** -** 08 16 2012 yuche.tsai -** NULL -** Fix compile warning. -** -** 08 14 2012 yuche.tsai -** NULL -** FPB from ALPS.JB to phase 2 release. -** -** 07 26 2012 yuche.tsai -** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot -** Update driver code of ALPS.JB for hot-spot. -** -** 07 19 2012 yuche.tsai -** NULL -** Code update for JB. - * - * 07 17 2012 yuche.tsai - * NULL - * Fix compile error for JB. - * - * 07 17 2012 yuche.tsai - * NULL - * Let netdev bring up. - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 01 09 2012 terry.wu - * [WCXRP00001166] [Wi-Fi] [Driver] cfg80211 integration for p2p newtork - * cfg80211 integration for p2p network. - * - * 12 19 2011 terry.wu - * [WCXRP00001142] [Wi-Fi] [P2P Driver] XOR local admin bit to generate p2p net device MAC - * XOR local administrated bit to generate net device MAC of p2p network. - * - * 12 02 2011 yuche.tsai - * NULL - * Fix possible KE when unload p2p. - * - * 11 24 2011 yuche.tsai - * NULL - * Fix P2P IOCTL of multicast address bug, add low power driver stop control. - * - * 11 22 2011 yuche.tsai - * NULL - * Update RSSI link quality of P2P Network query method. (Bug fix) - * - * 11 19 2011 yuche.tsai - * NULL - * Add RSSI support for P2P network. - * - * 11 16 2011 yuche.tsai - * [WCXRP00001107] [Volunteer Patch][Driver] Large Network Type index assert in FW issue. - * Avoid using work thread in set p2p multicast address callback. - * - * 11 11 2011 yuche.tsai - * NULL - * Fix work thread cancel issue. - * - * 11 11 2011 yuche.tsai - * NULL - * Fix default device name issue. - * - * 11 08 2011 yuche.tsai - * [WCXRP00001094] [Volunteer Patch][Driver] Driver version & supplicant version query & set support for service discovery version check. - * Add support for driver version query & p2p supplicant verseion set. - * For new service discovery mechanism sync. - * - * 11 07 2011 yuche.tsai - * NULL - * [ALPS 00087243] KE in worker thread. - * The multicast address list is scheduled in worker thread. - * Before the worker thread is excuted, if P2P is unloaded, a KE may occur. - * - * 10 26 2011 terry.wu - * [WCXRP00001066] [MT6620 Wi-Fi] [P2P Driver] Fix P2P Oid Issue - * Fix some P2P OID functions didn't raise its flag "fgIsP2pOid" issue. - * - * 10 25 2011 cm.chang - * [WCXRP00001058] [All Wi-Fi][Driver] Fix sta_rec's phyTypeSet and OBSS scan in AP mode - * . - * - * 10 18 2011 yuche.tsai - * [WCXRP00001045] [WiFi Direct][Driver] Check 2.1 branch. - * Support Channle Query. - * - * 10 18 2011 yuche.tsai - * [WCXRP00001045] [WiFi Direct][Driver] Check 2.1 branch. - * New 2.1 branch - - * - * 08 26 2011 yuche.tsai - * NULL - * Fix bug of parsing secondary device list type issue. - * - * 08 24 2011 yuche.tsai - * [WCXRP00000919] [Volunteer Patch][WiFi Direct][Driver] Invitation New Feature. - * Invitation Abort. - * - * 08 23 2011 yuche.tsai - * NULL - * Fix multicast address list issue of P2P. - * - * 08 22 2011 chinglan.wang - * NULL - * Fix invitation indication bug.. - * - * 08 16 2011 cp.wu - * [WCXRP00000934] [MT6620 Wi-Fi][Driver][P2P] Wi-Fi hot spot with auto sparse channel residence - * auto channel decision for 2.4GHz hot spot mode - * - * 08 16 2011 chinglan.wang - * NULL - * Add the group id information in the invitation indication. - * - * 08 09 2011 yuche.tsai - * [WCXRP00000919] [Volunteer Patch][WiFi Direct][Driver] Invitation New Feature. - * Invitation Feature add on. - * - * 08 05 2011 yuche.tsai - * [WCXRP00000856] [Volunteer Patch][WiFi Direct][Driver] MT6620 WiFi Direct IOT Issue with BCM solution. - * Add Password ID check for quick connection. - * Also modify some connection policy. - * - * 07 18 2011 chinglan.wang - * NULL - * Add IOC_P2P_GO_WSC_IE (p2p capability). - * - * 06 14 2011 yuche.tsai - * NULL - * Add compile flag to disable persistent group support. - * - * 05 04 2011 chinglan.wang - * [WCXRP00000698] [MT6620 Wi-Fi][P2P][Driver] Add p2p invitation command for the p2p driver - * . - * - * 05 02 2011 yuche.tsai - * [WCXRP00000693] [Volunteer Patch][MT6620][Driver] Clear Formation Flag after TX lifetime timeout. - * Clear formation flag after formation timeout. - * - * 04 22 2011 george.huang - * [WCXRP00000621] [MT6620 Wi-Fi][Driver] Support P2P supplicant to set power mode - * . - * - * 04 21 2011 george.huang - * [WCXRP00000621] [MT6620 Wi-Fi][Driver] Support P2P supplicant to set power mode - * 1. Revise P2P power mode setting. - * 2. Revise fast-PS for concurrent - * - * 04 19 2011 wh.su - * NULL - * Adding length check before doing WPA RSN IE parsing for scan results indicate. - * - * 04 14 2011 yuche.tsai - * [WCXRP00000646] [Volunteer Patch][MT6620][FW/Driver] Sigma Test Modification for some test case. - * Connection flow refine for Sigma test. - * - * 04 08 2011 yuche.tsai - * [WCXRP00000624] [Volunteer Patch][MT6620][Driver] Add device discoverability support for GO. - * Add device discoverability support. - * - * 04 08 2011 george.huang - * [WCXRP00000621] [MT6620 Wi-Fi][Driver] Support P2P supplicant to set power mode - * separate settings of P2P and AIS - * - * 04 07 2011 terry.wu - * [WCXRP00000619] [MT6620 Wi-Fi][Driver] fix kernel panic may occur when removing wlan - * Fix kernel panic may occur when removing wlan driver. - * - * 03 31 2011 wh.su - * [WCXRP00000614] [MT6620 Wi-Fi][Driver] P2P: Update beacon content while setting WSC IE - * Update the wsc ie to beacon content. - * - * 03 25 2011 wh.su - * NULL - * add the sample code for set power mode and get power mode. - * - * 03 25 2011 yuche.tsai - * NULL - * Improve some error handleing. - * - * 03 22 2011 george.huang - * [WCXRP00000504] [MT6620 Wi-Fi][FW] Support Sigma CAPI for power saving related command - * link with supplicant commands - * - * 03 22 2011 yuche.tsai - * [WCXRP00000584] [Volunteer Patch][MT6620][Driver] Add beacon timeout support for WiFi Direct. - * Modify formation policy. - * - * 03 22 2011 yuche.tsai - * NULL - * Modify formation policy setting. - * - * 03 18 2011 yuche.tsai - * [WCXRP00000574] [Volunteer Patch][MT6620][Driver] Modify P2P FSM Connection Flow - * Modify connection flow after Group Formation Complete, or device connect to a GO. - * Instead of request channel & connect directly, we use scan to allocate channel bandwidth & connect after RX BCN. - * - * 03 15 2011 wh.su - * [WCXRP00000563] [MT6620 Wi-Fi] [P2P] Set local config method while set password Id ready - * set lccal config method method while set password Id ready. - * - * 03 15 2011 yuche.tsai - * [WCXRP00000560] [Volunteer Patch][MT6620][Driver] P2P Connection from UI using KEY/DISPLAY issue - * Fix some configure method issue. - * - * 03 15 2011 jeffrey.chang - * [WCXRP00000558] [MT6620 Wi-Fi][MT6620 Wi-Fi][Driver] refine the queue selection algorithm for WMM - * refine queue_select function - * - * 03 13 2011 wh.su - * [WCXRP00000530] [MT6620 Wi-Fi] [Driver] skip doing p2pRunEventAAAComplete after send assoc response Tx Done - * add code for avoid compiling warning. - * - * 03 10 2011 yuche.tsai - * NULL - * Add P2P API. - * - * 03 10 2011 terry.wu - * [WCXRP00000505] [MT6620 Wi-Fi][Driver/FW] WiFi Direct Integration - * Remove unnecessary assert and message. - * - * 03 08 2011 wh.su - * [WCXRP00000488] [MT6620 Wi-Fi][Driver] Support the SIGMA set p2p parameter to driver - * support the power save related p2p setting. - * - * 03 07 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * rename the define to anti_pviracy. - * - * 03 05 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * add the code to get the check rsponse and indicate to app. - * - * 03 03 2011 jeffrey.chang - * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue - * support concurrent network - * - * 03 03 2011 jeffrey.chang - * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue - * modify P2P's netdevice functions to support multiple H/W queues - * - * 03 03 2011 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * for get request, the buffer length to be copied is header + payload. - * - * 03 02 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * add code to let the beacon and probe response for Auto GO WSC . - * - * 03 02 2011 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * add a missed break. - * - * 03 01 2011 yuche.tsai - * [WCXRP00000501] [Volunteer Patch][MT6620][Driver] No common channel issue when doing GO formation - * Update channel issue when doing GO formation.. - * - * 02 25 2011 wh.su - * [WCXRP00000488] [MT6620 Wi-Fi][Driver] Support the SIGMA set p2p parameter to driver - * add the Operation channel setting. - * - * 02 23 2011 wh.su - * [WCXRP00000488] [MT6620 Wi-Fi][Driver] Support the SIGMA set p2p parameter to driver - * fixed the set int ioctl set index and value map to driver issue. - * - * 02 22 2011 wh.su - * [WCXRP00000488] [MT6620 Wi-Fi][Driver] Support the SIGMA set p2p parameter to driver - * adding the ioctl set int from supplicant, and can used to set the p2p paramters - * - * 02 21 2011 terry.wu - * [WCXRP00000476] [MT6620 Wi-Fi][Driver] Clean P2P scan list while removing P2P - * Clean P2P scan list while removing P2P. - * - * 02 18 2011 wh.su - * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE - * fixed the ioctl setting that index not map to spec defined config method. - * - * 02 17 2011 wh.su - * [WCXRP00000471] [MT6620 Wi-Fi][Driver] Add P2P Provison discovery append Config Method attribute at WSC IE - * append the WSC IE config method attribute at provision discovery request. - * - * 02 17 2011 wh.su - * [WCXRP00000448] [MT6620 Wi-Fi][Driver] Fixed WSC IE not send out at probe request - * modify the structure pointer for set WSC IE. - * - * 02 16 2011 wh.su - * [WCXRP00000448] [MT6620 Wi-Fi][Driver] Fixed WSC IE not send out at probe request - * fixed the probe request send out without WSC IE issue (at P2P). - * - * 02 09 2011 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * fix typo - * - * 02 09 2011 yuche.tsai - * [WCXRP00000431] [Volunteer Patch][MT6620][Driver] Add MLME support for deauthentication under AP(Hot-Spot) mode. - * Add Support for MLME deauthentication for Hot-Spot. - * - * 01 25 2011 terry.wu - * [WCXRP00000393] [MT6620 Wi-Fi][Driver] Add new module insert parameter - * Add a new module parameter to indicate current runnig mode, P2P or AP. - * - * 01 12 2011 yuche.tsai - * [WCXRP00000352] [Volunteer Patch][MT6620][Driver] P2P Statsion Record Client List Issue - * 1. Modify Channel Acquire Time of AP mode from 5s to 1s. - * 2. Call cnmP2pIsPermit() before active P2P network. - * 3. Add channel selection support for AP mode. - * - * 01 05 2011 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * ioctl implementations for P2P Service Discovery - * - * 01 04 2011 cp.wu - * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands - * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure - * - * 12 22 2010 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * 1. header file restructure for more clear module isolation - * 2. add function interface definition for implementing Service Discovery callbacks - * - * 12 15 2010 cp.wu - * NULL - * invoke nicEnableInterrupt() before leaving from wlanAdapterStart() - * - * 12 08 2010 yuche.tsai - * [WCXRP00000245] [MT6620][Driver] Invitation & Provision Discovery Feature Check-in - * [WCXRP000000245][MT6620][Driver] Invitation Request Feature Add - * - * 11 30 2010 yuche.tsai - * NULL - * Invitation & Provision Discovery Indication. - * - * 11 17 2010 wh.su - * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID[WCXRP00000179] [MT6620 Wi-Fi][FW] Set the Tx lowest rate at wlan table for normal operation - * fixed some ASSERT check. - * - * 11 04 2010 wh.su - * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID - * adding the p2p random ssid support. - * - * 10 20 2010 wh.su - * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group - * Add the code to support disconnect p2p group - * - * 10 04 2010 wh.su - * [WCXRP00000081] [MT6620][Driver] Fix the compiling error at WinXP while enable P2P - * add a kal function for set cipher. - * - * 10 04 2010 wh.su - * [WCXRP00000081] [MT6620][Driver] Fix the compiling error at WinXP while enable P2P - * fixed compiling error while enable p2p. - * - * 09 28 2010 wh.su - * NULL - * [WCXRP00000069][MT6620 Wi-Fi][Driver] Fix some code for phase 1 P2P Demo. - * - * 09 21 2010 kevin.huang - * [WCXRP00000054] [MT6620 Wi-Fi][Driver] Restructure driver for second Interface - * Isolate P2P related function for Hardware Software Bundle - * - * 09 21 2010 kevin.huang - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * Eliminate Linux Compile Warning - * - * 09 10 2010 george.huang - * NULL - * update iwpriv LP related - * - * 09 10 2010 wh.su - * NULL - * fixed the compiling error at win XP. - * - * 09 09 2010 cp.wu - * NULL - * add WPS/WPA/RSN IE for Wi-Fi Direct scanning result. - * - * 09 07 2010 wh.su - * NULL - * adding the code for beacon/probe req/ probe rsp wsc ie at p2p. - * - * 09 06 2010 wh.su - * NULL - * let the p2p can set the privacy bit at beacon and rsn ie at assoc req at key handshake state. - * - * 08 25 2010 cp.wu - * NULL - * add netdev_ops(NDO) for linux kernel 2.6.31 or greater - * - * 08 23 2010 cp.wu - * NULL - * revise constant definitions to be matched with implementation (original cmd-event definition is deprecated) - * - * 08 20 2010 cp.wu - * NULL - * correct typo. - * - * 08 20 2010 yuche.tsai - * NULL - * Invert Connection request provision status parameter. - * - * 08 19 2010 cp.wu - * NULL - * add set mac address interface for further possibilities of wpa_supplicant overriding interface address. - * - * 08 18 2010 cp.wu - * NULL - * modify pwp ioctls attribution by removing FIXED_SIZE. - * - * 08 18 2010 jeffrey.chang - * NULL - * support multi-function sdio - * - * 08 17 2010 cp.wu - * NULL - * correct p2p net device registration with NULL pointer access issue. - * - * 08 16 2010 cp.wu - * NULL - * P2P packets are now marked when being queued into driver, and identified later without checking MAC address - * - * 08 16 2010 cp.wu - * NULL - * add subroutines for P2P to set multicast list. - * - * 08 16 2010 george.huang - * NULL - * add wext handlers to link P2P set PS profile/ network address function (TBD) - * - * 08 16 2010 cp.wu - * NULL - * revised implementation of Wi-Fi Direct io controls. - * - * 08 12 2010 cp.wu - * NULL - * follow-up with ioctl interface update for Wi-Fi Direct application - * - * 08 06 2010 cp.wu - * NULL - * driver hook modifications corresponding to ioctl interface change. - * - * 08 03 2010 cp.wu - * NULL - * add basic support for ioctl of getting scan result. (only address and SSID are reporterd though) - * - * 08 03 2010 cp.wu - * NULL - * [Wi-Fi Direct Driver Hook] change event indication API to be consistent with supplicant - * - * 08 03 2010 cp.wu - * NULL - * surpress compilation warning. - * - * 08 03 2010 cp.wu - * NULL - * [Wi-Fi Direct] add framework for driver hooks - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 23 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * p2p interface revised to be sync. with HAL - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 06 01 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add ioctl to configure scan mode for p2p connection - * - * 05 31 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add cfg80211 interface, which is to replace WE, for further extension - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * implement private io controls for Wi-Fi Direct - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * implement get scan result. - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add basic handling framework for wireless extension ioctls. - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * 1) add timeout handler mechanism for pending command packets - * 2) add p2p add/removal key - * - * 05 14 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * implement wireless extension ioctls in iw_handler form. - * - * 05 14 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add ioctl framework for Wi-Fi Direct by reusing wireless extension ioctls as well - * - * 05 11 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * p2p ioctls revised. - * - * 05 11 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add ioctl for controlling p2p scan phase parameters - * - * 05 10 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * implement basic wi-fi direct framework - * - * 05 07 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add basic framework for implementating P2P driver hook. - * -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_os.h" -#include "debug.h" -#include "wlan_lib.h" -#include "gl_wext.h" -#include - -#include -//#include -#include "gl_p2p_ioctl.h" - -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define ARGV_MAX_NUM (4) - -/*For CFG80211 - wiphy parameters*/ -#define MAX_SCAN_LIST_NUM (1) -#define MAX_SCAN_IE_LEN (512) - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -#if CFG_ENABLE_WIFI_DIRECT_CFG_80211 -/* for cfg80211 - frequency table */ -static struct ieee80211_channel mtk_2ghz_channels[] = { - CHAN2G(1, 2412, 0), - CHAN2G(2, 2417, 0), - CHAN2G(3, 2422, 0), - CHAN2G(4, 2427, 0), - CHAN2G(5, 2432, 0), - CHAN2G(6, 2437, 0), - CHAN2G(7, 2442, 0), - CHAN2G(8, 2447, 0), - CHAN2G(9, 2452, 0), - CHAN2G(10, 2457, 0), - CHAN2G(11, 2462, 0), - CHAN2G(12, 2467, 0), - CHAN2G(13, 2472, 0), - CHAN2G(14, 2484, 0), -}; - -static struct ieee80211_channel mtk_5ghz_a_channels[] = { - CHAN5G(34, 0), CHAN5G(36, 0), - CHAN5G(38, 0), CHAN5G(40, 0), - CHAN5G(42, 0), CHAN5G(44, 0), - CHAN5G(46, 0), CHAN5G(48, 0), - CHAN5G(52, 0), CHAN5G(56, 0), - CHAN5G(60, 0), CHAN5G(64, 0), - CHAN5G(100, 0), CHAN5G(104, 0), - CHAN5G(108, 0), CHAN5G(112, 0), - CHAN5G(116, 0), CHAN5G(120, 0), - CHAN5G(124, 0), CHAN5G(128, 0), - CHAN5G(132, 0), CHAN5G(136, 0), - CHAN5G(140, 0), CHAN5G(149, 0), - CHAN5G(153, 0), CHAN5G(157, 0), - CHAN5G(161, 0), CHAN5G(165, 0), - CHAN5G(169, 0), CHAN5G(173, 0), - CHAN5G(184, 0), CHAN5G(188, 0), - CHAN5G(192, 0), CHAN5G(196, 0), - CHAN5G(200, 0), CHAN5G(204, 0), - CHAN5G(208, 0), CHAN5G(212, 0), - CHAN5G(216, 0), -}; - -/* for cfg80211 - rate table */ -static struct ieee80211_rate mtk_rates[] = { - RATETAB_ENT(10, 0x1000, 0), - RATETAB_ENT(20, 0x1001, 0), - RATETAB_ENT(55, 0x1002, 0), - RATETAB_ENT(110, 0x1003, 0), /* 802.11b */ - RATETAB_ENT(60, 0x2000, 0), - RATETAB_ENT(90, 0x2001, 0), - RATETAB_ENT(120, 0x2002, 0), - RATETAB_ENT(180, 0x2003, 0), - RATETAB_ENT(240, 0x2004, 0), - RATETAB_ENT(360, 0x2005, 0), - RATETAB_ENT(480, 0x2006, 0), - RATETAB_ENT(540, 0x2007, 0), /* 802.11a/g */ -}; - -#define mtk_a_rates (mtk_rates + 4) -#define mtk_a_rates_size (sizeof(mtk_rates) / sizeof(mtk_rates[0]) - 4) -#define mtk_g_rates (mtk_rates + 0) -#define mtk_g_rates_size (sizeof(mtk_rates) / sizeof(mtk_rates[0]) - 0) - -#define MT6620_MCS_INFO \ -{ \ - /* MCS1~7*/ \ - .rx_mask = {0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0},\ - .rx_highest = 0, \ - .tx_params = IEEE80211_HT_MCS_TX_DEFINED, \ -} - -#if 0 -/*Bandwidth 20Mhz Only*/ -#define MT6620_HT_CAP \ -{ \ - .ht_supported = true, \ - .cap = IEEE80211_HT_CAP_SM_PS \ - | IEEE80211_HT_CAP_GRN_FLD \ - | IEEE80211_HT_CAP_SGI_20, \ - .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, \ - .ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE, \ - .mcs = MT6620_MCS_INFO, \ -} -#else -/*Bandwidth 20/40Mhz*/ -#define MT6620_HT_CAP \ -{ \ - .ht_supported = true, \ - .cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 \ - | IEEE80211_HT_CAP_SM_PS \ - | IEEE80211_HT_CAP_GRN_FLD \ - | IEEE80211_HT_CAP_SGI_20 \ - | IEEE80211_HT_CAP_SGI_40, \ - .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, \ - .ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE, \ - .mcs = MT6620_MCS_INFO, \ -} -#endif - -static struct ieee80211_supported_band mtk_band_2ghz = { - .band = IEEE80211_BAND_2GHZ, - .channels = mtk_2ghz_channels, - .n_channels = ARRAY_SIZE(mtk_2ghz_channels), - .bitrates = mtk_g_rates, - .n_bitrates = mtk_g_rates_size, - .ht_cap = MT6620_HT_CAP, -}; - -static struct ieee80211_supported_band mtk_band_5ghz = { - .band = IEEE80211_BAND_5GHZ, - .channels = mtk_5ghz_a_channels, - .n_channels = ARRAY_SIZE(mtk_5ghz_a_channels), - .bitrates = mtk_a_rates, - .n_bitrates = mtk_a_rates_size, - .ht_cap = MT6620_HT_CAP, -}; - -static const UINT_32 cipher_suites[] = { - /* keep WEP first, it may be removed below */ - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, - - /* keep last -- depends on hw flags! */ - WLAN_CIPHER_SUITE_AES_CMAC -}; - -static struct cfg80211_ops mtk_p2p_config_ops = { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32) && (CFG_ENABLE_WIFI_DIRECT_CFG_80211 != 0) - /* Froyo */ - .change_virtual_intf = mtk_p2p_cfg80211_change_iface, // 1 st - .change_bss = mtk_p2p_cfg80211_change_bss, - .scan = mtk_p2p_cfg80211_scan, - .remain_on_channel = mtk_p2p_cfg80211_remain_on_channel, - .cancel_remain_on_channel = mtk_p2p_cfg80211_cancel_remain_on_channel, - .mgmt_tx = mtk_p2p_cfg80211_mgmt_tx, - .connect = mtk_p2p_cfg80211_connect, - .disconnect = mtk_p2p_cfg80211_disconnect, - .deauth = mtk_p2p_cfg80211_deauth, - .disassoc = mtk_p2p_cfg80211_disassoc, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - .start_ap = mtk_p2p_cfg80211_start_ap, - .change_beacon = mtk_p2p_cfg80211_change_beacon, - .stop_ap = mtk_p2p_cfg80211_stop_ap, -#else - .add_beacon = mtk_p2p_cfg80211_add_set_beacon, - .set_beacon = mtk_p2p_cfg80211_add_set_beacon, - .del_beacon = mtk_p2p_cfg80211_stop_ap, -#endif - .set_wiphy_params = mtk_p2p_cfg80211_set_wiphy_params, - .del_station = mtk_p2p_cfg80211_del_station, - .set_channel = mtk_p2p_cfg80211_set_channel, - .set_bitrate_mask = mtk_p2p_cfg80211_set_bitrate_mask, - .mgmt_frame_register = mtk_p2p_cfg80211_mgmt_frame_register, - .get_station = mtk_p2p_cfg80211_get_station, - // ================ - .add_key = mtk_p2p_cfg80211_add_key, - .get_key = mtk_p2p_cfg80211_get_key, - .del_key = mtk_p2p_cfg80211_del_key, - .set_default_key = mtk_p2p_cfg80211_set_default_key, - .join_ibss = mtk_p2p_cfg80211_join_ibss, - .leave_ibss = mtk_p2p_cfg80211_leave_ibss, - .set_tx_power = mtk_p2p_cfg80211_set_txpower, - .get_tx_power = mtk_p2p_cfg80211_get_txpower, - .set_power_mgmt = mtk_p2p_cfg80211_set_power_mgmt, - #ifdef CONFIG_NL80211_TESTMODE - .testmode_cmd = mtk_p2p_cfg80211_testmode_cmd, - #endif -#endif -}; - - - -/* There isn't a lot of sense in it, but you can transmit anything you like */ -static const struct ieee80211_txrx_stypes -mtk_cfg80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = { - [NL80211_IFTYPE_ADHOC] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) - }, - [NL80211_IFTYPE_STATION] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_AP] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | - BIT(IEEE80211_STYPE_ACTION >> 4) - }, - [NL80211_IFTYPE_AP_VLAN] = { - /* copy AP */ - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | - BIT(IEEE80211_STYPE_DISASSOC >> 4) | - BIT(IEEE80211_STYPE_AUTH >> 4) | - BIT(IEEE80211_STYPE_DEAUTH >> 4) | - BIT(IEEE80211_STYPE_ACTION >> 4) - }, - [NL80211_IFTYPE_P2P_CLIENT] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_P2P_GO] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | - BIT(IEEE80211_STYPE_ACTION >> 4) - } -}; - - - -#endif - -/* the legacy wireless extension stuff */ -static const iw_handler rP2PIwStandardHandler[] = { - [SIOCGIWPRIV - SIOCIWFIRST] = mtk_p2p_wext_get_priv, - [SIOCGIWSCAN - SIOCIWFIRST] = mtk_p2p_wext_discovery_results, - [SIOCSIWESSID - SIOCIWFIRST] = mtk_p2p_wext_reconnect, - [SIOCSIWAUTH - SIOCIWFIRST] = mtk_p2p_wext_set_auth, - [SIOCSIWENCODEEXT - SIOCIWFIRST] = mtk_p2p_wext_set_key, - [SIOCSIWPOWER - SIOCIWFIRST] = mtk_p2p_wext_set_powermode, - [SIOCGIWPOWER - SIOCIWFIRST] = mtk_p2p_wext_get_powermode, - [SIOCSIWTXPOW - SIOCIWFIRST] = mtk_p2p_wext_set_txpow, -#if CFG_SUPPORT_P2P_RSSI_QUERY - [SIOCGIWSTATS - SIOCIWFIRST] = mtk_p2p_wext_get_rssi, -#endif - [SIOCSIWMLME - SIOCIWFIRST] = mtk_p2p_wext_mlme_handler, -}; - -static const iw_handler rP2PIwPrivHandler[] = { - [IOC_P2P_CFG_DEVICE - SIOCIWFIRSTPRIV] = mtk_p2p_wext_set_local_dev_info, - [IOC_P2P_PROVISION_COMPLETE - SIOCIWFIRSTPRIV] = mtk_p2p_wext_set_provision_complete, - [IOC_P2P_START_STOP_DISCOVERY - SIOCIWFIRSTPRIV] = mtk_p2p_wext_start_stop_discovery, - [IOC_P2P_DISCOVERY_RESULTS - SIOCIWFIRSTPRIV] = mtk_p2p_wext_discovery_results, - [IOC_P2P_WSC_BEACON_PROBE_RSP_IE - SIOCIWFIRSTPRIV] = mtk_p2p_wext_wsc_ie, - [IOC_P2P_CONNECT_DISCONNECT - SIOCIWFIRSTPRIV] = mtk_p2p_wext_connect_disconnect, - [IOC_P2P_PASSWORD_READY - SIOCIWFIRSTPRIV] = mtk_p2p_wext_password_ready, -// [IOC_P2P_SET_PWR_MGMT_PARAM - SIOCIWFIRSTPRIV] = mtk_p2p_wext_set_pm_param, - [IOC_P2P_SET_INT - SIOCIWFIRSTPRIV] = mtk_p2p_wext_set_int, - [IOC_P2P_GET_STRUCT - SIOCIWFIRSTPRIV] = mtk_p2p_wext_get_struct, - [IOC_P2P_SET_STRUCT - SIOCIWFIRSTPRIV] = mtk_p2p_wext_set_struct, - [IOC_P2P_GET_REQ_DEVICE_INFO - SIOCIWFIRSTPRIV] = mtk_p2p_wext_request_dev_info, -}; - - -static const struct iw_priv_args rP2PIwPrivTable[] = { - { - .cmd = IOC_P2P_CFG_DEVICE, - .set_args = IW_PRIV_TYPE_BYTE | (__u16)sizeof(IW_P2P_CFG_DEVICE_TYPE), - .get_args = IW_PRIV_TYPE_NONE, - .name = "P2P_CFG_DEVICE" - }, - { - .cmd = IOC_P2P_START_STOP_DISCOVERY, - .set_args = IW_PRIV_TYPE_BYTE | (__u16)sizeof(IW_P2P_REQ_DEVICE_TYPE), - .get_args = IW_PRIV_TYPE_NONE, - .name = "P2P_DISCOVERY" - }, - { - .cmd = IOC_P2P_DISCOVERY_RESULTS, - .set_args = IW_PRIV_TYPE_NONE, - .get_args = IW_PRIV_TYPE_NONE, - .name = "P2P_RESULT" - }, - { - .cmd = IOC_P2P_WSC_BEACON_PROBE_RSP_IE, - .set_args = IW_PRIV_TYPE_BYTE | (__u16)sizeof(IW_P2P_HOSTAPD_PARAM), - .get_args = IW_PRIV_TYPE_NONE, - .name = "P2P_WSC_IE" - }, - { - .cmd = IOC_P2P_CONNECT_DISCONNECT, - .set_args = IW_PRIV_TYPE_BYTE | (__u16)sizeof(IW_P2P_CONNECT_DEVICE), - .get_args = IW_PRIV_TYPE_NONE, - .name = "P2P_CONNECT" - }, - { - .cmd = IOC_P2P_PASSWORD_READY, - .set_args = IW_PRIV_TYPE_BYTE | (__u16)sizeof(IW_P2P_PASSWORD_READY), - .get_args = IW_PRIV_TYPE_NONE, - .name = "P2P_PASSWD_RDY" - }, - { - .cmd = IOC_P2P_GET_STRUCT, - .set_args = IW_PRIV_TYPE_NONE, - .get_args = 256, - .name = "P2P_GET_STRUCT" - }, - { - .cmd = IOC_P2P_SET_STRUCT, - .set_args = 256, - .get_args = IW_PRIV_TYPE_NONE, - .name = "P2P_SET_STRUCT" - }, - { - .cmd = IOC_P2P_GET_REQ_DEVICE_INFO, - .set_args = IW_PRIV_TYPE_NONE, - .get_args = IW_PRIV_TYPE_BYTE | (__u16)sizeof(IW_P2P_DEVICE_REQ), - .name = "P2P_GET_REQDEV" - }, - { - /* SET STRUCT sub-ioctls commands */ - .cmd = PRIV_CMD_OID, - .set_args = 256, - .get_args = IW_PRIV_TYPE_NONE, - .name = "set_oid" - }, - { - /* GET STRUCT sub-ioctls commands */ - .cmd = PRIV_CMD_OID, - .set_args = IW_PRIV_TYPE_NONE, - .get_args = 256, - .name = "get_oid" - } -}; - -const struct iw_handler_def mtk_p2p_wext_handler_def = { - .num_standard = (__u16)sizeof(rP2PIwStandardHandler)/sizeof(iw_handler), - .num_private = (__u16)sizeof(rP2PIwPrivHandler)/sizeof(iw_handler), - .num_private_args = (__u16)sizeof(rP2PIwPrivTable)/sizeof(struct iw_priv_args), - .standard = rP2PIwStandardHandler, - .private = rP2PIwPrivHandler, - .private_args = rP2PIwPrivTable, -#if CFG_SUPPORT_P2P_RSSI_QUERY - .get_wireless_stats = mtk_p2p_wext_get_wireless_stats, -#else - .get_wireless_stats = NULL, -#endif -}; - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/* for IE Searching */ -extern BOOLEAN -wextSrchDesiredWPAIE ( - IN PUINT_8 pucIEStart, - IN INT_32 i4TotalIeLen, - IN UINT_8 ucDesiredElemId, - OUT PUINT_8 *ppucDesiredIE - ); - -#if CFG_SUPPORT_WPS -extern BOOLEAN -wextSrchDesiredWPSIE ( - IN PUINT_8 pucIEStart, - IN INT_32 i4TotalIeLen, - IN UINT_8 ucDesiredElemId, - OUT PUINT_8 *ppucDesiredIE - ); -#endif - -/* Net Device Hooks */ -static int -p2pOpen( - IN struct net_device *prDev - ); - -static int -p2pStop( - IN struct net_device *prDev - ); - -static struct net_device_stats * -p2pGetStats ( - IN struct net_device *prDev - ); - -static void -p2pSetMulticastList( - IN struct net_device *prDev - ); - -static int -p2pHardStartXmit( - IN struct sk_buff *prSkb, - IN struct net_device *prDev - ); - -static int -p2pDoIOCTL( - struct net_device *prDev, - struct ifreq *prIFReq, - int i4Cmd - ); - -static int -p2pSetMACAddress( - IN struct net_device *prDev, - void *addr - ); - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Override the implementation of select queue -* -* \param[in] dev Pointer to struct net_device -* \param[in] skb Pointer to struct skb_buff -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ - -unsigned int _p2p_cfg80211_classify8021d(struct sk_buff *skb) -{ - unsigned int dscp = 0; - - /* skb->priority values from 256->263 are magic values - * directly indicate a specific 802.1d priority. This is - * to allow 802.1d priority to be passed directly in from - * tags - */ - - if (skb->priority >= 256 && skb->priority <= 263) { - return skb->priority - 256; - } - switch (skb->protocol) { - case htons(ETH_P_IP): - dscp = ip_hdr(skb)->tos & 0xfc; - break; - } - return dscp >> 5; -} - - -static const UINT_16 au16Wlan1dToQueueIdx[8] = { 1, 0, 0, 1, 2, 2, 3, 3 }; - -static UINT_16 -p2pSelectQueue( - struct net_device *dev, - struct sk_buff *skb) -{ - skb->priority = _p2p_cfg80211_classify8021d(skb); - - return au16Wlan1dToQueueIdx[skb->priority]; -} - -static struct net_device *g_P2pPrDev; - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief A function for prDev->init -* -* \param[in] prDev Pointer to struct net_device. -* -* \retval 0 The execution of wlanInit succeeds. -* \retval -ENXIO No such device. -*/ -/*----------------------------------------------------------------------------*/ -static int -p2pInit( - struct net_device *prDev - ) -{ - if (!prDev) { - return -ENXIO; - } - - return 0; /* success */ -} /* end of p2pInit() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief A function for prDev->uninit -* -* \param[in] prDev Pointer to struct net_device. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -static void -p2pUninit ( - IN struct net_device *prDev - ) -{ - - - return; -} /* end of p2pUninit() */ - - - - - - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) -static const struct net_device_ops p2p_netdev_ops = { - .ndo_open = p2pOpen, - .ndo_stop = p2pStop, - .ndo_set_mac_address = p2pSetMACAddress, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - .ndo_set_rx_mode = p2pSetMulticastList, -#else - .ndo_set_multicast_list = p2pSetMulticastList, -#endif - .ndo_get_stats = p2pGetStats, - .ndo_do_ioctl = p2pDoIOCTL, - .ndo_start_xmit = p2pHardStartXmit, - .ndo_select_queue = p2pSelectQueue, - .ndo_init = p2pInit, - .ndo_uninit = p2pUninit, -}; - - -#endif - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Allocate memory for P2P_INFO, GL_P2P_INFO, P2P_CONNECTION_SETTINGS -* P2P_SPECIFIC_BSS_INFO, P2P_FSM_INFO -* -* \param[in] prGlueInfo Pointer to glue info -* -* \return TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -p2PAllocInfo ( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - P_ADAPTER_T prAdapter = NULL; - P_WIFI_VAR_T prWifiVar = NULL; - - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - prWifiVar = &(prAdapter->rWifiVar); - - ASSERT(prAdapter); - ASSERT(prWifiVar); - - do { - if (prGlueInfo == NULL) { - break; - } - - if (prGlueInfo->prP2PInfo == NULL) { - /*alloc memory for p2p info */ - prGlueInfo->prP2PInfo = - kalMemAlloc(sizeof(GL_P2P_INFO_T), VIR_MEM_TYPE); - prAdapter->prP2pInfo = - kalMemAlloc(sizeof(P2P_INFO_T), VIR_MEM_TYPE); - prWifiVar->prP2PConnSettings = - kalMemAlloc(sizeof(P2P_CONNECTION_SETTINGS_T),VIR_MEM_TYPE); - prWifiVar->prP2pFsmInfo = - kalMemAlloc(sizeof(P2P_FSM_INFO_T),VIR_MEM_TYPE); - prWifiVar->prP2pSpecificBssInfo = - kalMemAlloc(sizeof(P2P_SPECIFIC_BSS_INFO_T),VIR_MEM_TYPE); - } - else { - ASSERT(prAdapter->prP2pInfo != NULL); - ASSERT(prWifiVar->prP2PConnSettings != NULL); - ASSERT(prWifiVar->prP2pFsmInfo != NULL); - ASSERT(prWifiVar->prP2pSpecificBssInfo != NULL); - } - /*MUST set memory to 0 */ - kalMemZero(prGlueInfo->prP2PInfo, sizeof(GL_P2P_INFO_T)); - kalMemZero(prAdapter->prP2pInfo, sizeof(P2P_INFO_T)); - kalMemZero(prWifiVar->prP2PConnSettings, sizeof(P2P_CONNECTION_SETTINGS_T)); - kalMemZero(prWifiVar->prP2pFsmInfo, sizeof(P2P_FSM_INFO_T)); - kalMemZero(prWifiVar->prP2pSpecificBssInfo, sizeof(P2P_SPECIFIC_BSS_INFO_T)); - - } while (FALSE); - - - /* chk if alloc successful or not*/ - if (prGlueInfo->prP2PInfo && - prAdapter->prP2pInfo && - prWifiVar->prP2PConnSettings && - prWifiVar->prP2pFsmInfo && - prWifiVar->prP2pSpecificBssInfo) { - return TRUE; - } - else { - - if (prWifiVar->prP2pSpecificBssInfo) { - kalMemFree(prWifiVar->prP2pSpecificBssInfo, VIR_MEM_TYPE, sizeof(P2P_SPECIFIC_BSS_INFO_T)); - - prWifiVar->prP2pSpecificBssInfo = NULL; - } - if (prWifiVar->prP2pFsmInfo) { - kalMemFree(prWifiVar->prP2pFsmInfo, VIR_MEM_TYPE, sizeof(P2P_FSM_INFO_T)); - - prWifiVar->prP2pFsmInfo = NULL; - } - if (prWifiVar->prP2PConnSettings) { - kalMemFree(prWifiVar->prP2PConnSettings, VIR_MEM_TYPE, sizeof(P2P_CONNECTION_SETTINGS_T)); - - prWifiVar->prP2PConnSettings = NULL; - } - if (prGlueInfo->prP2PInfo) { - kalMemFree(prGlueInfo->prP2PInfo, VIR_MEM_TYPE, sizeof(GL_P2P_INFO_T)); - - prGlueInfo->prP2PInfo = NULL; - } - if (prAdapter->prP2pInfo) { - kalMemFree(prAdapter->prP2pInfo, VIR_MEM_TYPE, sizeof(P2P_INFO_T)); - - prAdapter->prP2pInfo = NULL; - } - return FALSE; - } - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Free memory for P2P_INFO, GL_P2P_INFO, P2P_CONNECTION_SETTINGS -* P2P_SPECIFIC_BSS_INFO, P2P_FSM_INFO -* -* \param[in] prGlueInfo Pointer to glue info -* -* \return TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -p2PFreeInfo( - P_GLUE_INFO_T prGlueInfo - ) -{ - - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->prAdapter); - - /* free memory after p2p module is ALREADY unregistered */ - if(prGlueInfo->prAdapter->fgIsP2PRegistered == FALSE) { - - kalMemFree(prGlueInfo->prAdapter->prP2pInfo, VIR_MEM_TYPE, sizeof(P2P_INFO_T)); - kalMemFree(prGlueInfo->prP2PInfo, VIR_MEM_TYPE, sizeof(GL_P2P_INFO_T)); - kalMemFree(prGlueInfo->prAdapter->rWifiVar.prP2PConnSettings, VIR_MEM_TYPE, sizeof(P2P_CONNECTION_SETTINGS_T)); - kalMemFree(prGlueInfo->prAdapter->rWifiVar.prP2pFsmInfo, VIR_MEM_TYPE, sizeof(P2P_FSM_INFO_T)); - kalMemFree(prGlueInfo->prAdapter->rWifiVar.prP2pSpecificBssInfo, VIR_MEM_TYPE, sizeof(P2P_SPECIFIC_BSS_INFO_T)); - - /*Reomve p2p bss scan list*/ - scanRemoveAllP2pBssDesc(prGlueInfo->prAdapter); - - /*reset all pointer to NULL */ - prGlueInfo->prP2PInfo = NULL; - prGlueInfo->prAdapter->prP2pInfo = NULL; - prGlueInfo->prAdapter->rWifiVar.prP2PConnSettings = NULL; - prGlueInfo->prAdapter->rWifiVar.prP2pFsmInfo = NULL; - prGlueInfo->prAdapter->rWifiVar.prP2pSpecificBssInfo = NULL; - - return TRUE; - } - else { - return FALSE; - } - -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Enable Channel for cfg80211 for Wi-Fi Direct based on current country code -* -* \param[in] prGlueInfo Pointer to glue info -* -* \return TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pEnableChannel( - PUINT_8 pucChIdx, - UINT_8 ucChannelNum, - struct ieee80211_channel *mtk_channels, - UINT_8 mtk_channel_sz -) -{ - UINT_8 ucCurChIdx = *pucChIdx; - - while(TRUE) { - (*pucChIdx)++; - (*pucChIdx) %= mtk_channel_sz; - - if(ucChannelNum == mtk_channels[*pucChIdx].hw_value) { - mtk_channels[*pucChIdx].flags &= ~IEEE80211_CHAN_DISABLED; - break; - } - - if(*pucChIdx == ucCurChIdx) { - printk(KERN_ALERT DRV_NAME "Orphan channel [%d]\n", ucChannelNum); - break; - } - } -} - - -BOOLEAN -p2pNetRegister( - P_GLUE_INFO_T prGlueInfo, - BOOLEAN fgIsRtnlLockAcquired - ) -{ - BOOLEAN fgDoRegister = FALSE; - BOOLEAN fgRollbackRtnlLock = FALSE; - BOOLEAN ret; - - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->prAdapter); - - - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_NET_DEV); - if(prGlueInfo->prAdapter->rP2PNetRegState == ENUM_NET_REG_STATE_UNREGISTERED) { - prGlueInfo->prAdapter->rP2PNetRegState = ENUM_NET_REG_STATE_REGISTERING; - fgDoRegister = TRUE; - } - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_NET_DEV); - - if(!fgDoRegister) { - return TRUE; - } - - if(fgIsRtnlLockAcquired && rtnl_is_locked()) { - fgRollbackRtnlLock = TRUE; - rtnl_unlock(); - } - - /* Here are functions which need rtnl_lock */ - wiphy_register(prGlueInfo->prP2PInfo->wdev.wiphy); - - /* net device initialize */ - netif_carrier_off(prGlueInfo->prP2PInfo->prDevHandler); - netif_tx_stop_all_queues(prGlueInfo->prP2PInfo->prDevHandler); - - /* register for net device */ - if (register_netdev(prGlueInfo->prP2PInfo->prDevHandler) < 0) { - printk(KERN_ALERT DRV_NAME "unable to register netdevice for p2p\n"); - - free_netdev(prGlueInfo->prP2PInfo->prDevHandler); - - ret = FALSE; - } - else { - prGlueInfo->prAdapter->rP2PNetRegState = ENUM_NET_REG_STATE_REGISTERED; - ret = TRUE; - } - - if(fgRollbackRtnlLock) { - rtnl_lock(); - } - - return ret; -} - -BOOLEAN -p2pNetUnregister( - P_GLUE_INFO_T prGlueInfo, - BOOLEAN fgIsRtnlLockAcquired - ) -{ - BOOLEAN fgDoUnregister = FALSE; - BOOLEAN fgRollbackRtnlLock = FALSE; - - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->prAdapter); - - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_NET_DEV); - if(prGlueInfo->prAdapter->rP2PNetRegState == ENUM_NET_REG_STATE_REGISTERED) { - prGlueInfo->prAdapter->rP2PNetRegState = ENUM_NET_REG_STATE_UNREGISTERING; - fgDoUnregister = TRUE; - } - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_NET_DEV); - - if(!fgDoUnregister) { - return TRUE; - } - - /* prepare for removal */ - if(netif_carrier_ok(prGlueInfo->prP2PInfo->prDevHandler)) { - netif_carrier_off(prGlueInfo->prP2PInfo->prDevHandler); - } - - netif_tx_stop_all_queues(prGlueInfo->prP2PInfo->prDevHandler); - - if(fgIsRtnlLockAcquired && rtnl_is_locked()) { - fgRollbackRtnlLock = TRUE; - rtnl_unlock(); - } - /* Here are functions which need rtnl_lock */ - - unregister_netdev(prGlueInfo->prP2PInfo->prDevHandler); - - wiphy_unregister(prGlueInfo->prP2PInfo->wdev.wiphy); - - if(fgRollbackRtnlLock) { - rtnl_lock(); - } - - prGlueInfo->prAdapter->rP2PNetRegState = ENUM_NET_REG_STATE_UNREGISTERED; - - return TRUE; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Update Channel table for cfg80211 for Wi-Fi Direct based on current country code -* -* \param[in] prGlueInfo Pointer to glue info -* -* \return TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pUpdateChannelTableByDomain( - P_GLUE_INFO_T prGlueInfo - ) -{ - UINT_8 i, uc2gChIdx, uc5gChIdx; - UINT_8 ucMaxChannelNum = ARRAY_SIZE(mtk_2ghz_channels) + ARRAY_SIZE(mtk_5ghz_a_channels); - UINT_8 ucNumOfChannel = ucMaxChannelNum; - RF_CHANNEL_INFO_T aucChannelList[ucMaxChannelNum]; - - uc2gChIdx = uc5gChIdx = 0; - - // 1. Disable all channel - for(i = 0; i < ARRAY_SIZE(mtk_2ghz_channels); i++) { - mtk_2ghz_channels[i].flags |= IEEE80211_CHAN_DISABLED; - } - for(i = 0; i < ARRAY_SIZE(mtk_5ghz_a_channels); i++) { - mtk_5ghz_a_channels[i].flags |= IEEE80211_CHAN_DISABLED; - } - - // 2. Get current domain channel list - rlmDomainGetChnlList(prGlueInfo->prAdapter, BAND_NULL, ucMaxChannelNum, &ucNumOfChannel, aucChannelList); - - // 3. Enable specific channel based on domain channel list - for(i = 0; i < ucNumOfChannel; i++) { - switch(aucChannelList[i].eBand) { - case BAND_2G4: - p2pEnableChannel(&uc2gChIdx, aucChannelList[i].ucChannelNum, mtk_2ghz_channels, ARRAY_SIZE(mtk_2ghz_channels)); - break; - - case BAND_5G: - p2pEnableChannel(&uc5gChIdx, aucChannelList[i].ucChannelNum, mtk_5ghz_a_channels, ARRAY_SIZE(mtk_5ghz_a_channels)); - break; - - default: - printk(KERN_ALERT DRV_NAME "Unknow band.\n"); - break; - - } - } - -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Register for cfg80211 for Wi-Fi Direct -* -* \param[in] prGlueInfo Pointer to glue info -* -* \return TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -glRegisterP2P( - P_GLUE_INFO_T prGlueInfo, - const char *prDevName, - BOOLEAN fgIsApMode - ) -{ - P_ADAPTER_T prAdapter = NULL; - P_GL_HIF_INFO_T prHif = NULL; - PARAM_MAC_ADDRESS rMacAddr; -#if CFG_ENABLE_WIFI_DIRECT_CFG_80211 - struct device *prDev; -#endif - - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - prHif = &prGlueInfo->rHifInfo; - ASSERT(prHif); - - printk("glRegisterP2P\n"); - - /*0. allocate p2pinfo */ - if(!p2PAllocInfo(prGlueInfo)) { - printk(KERN_ALERT DRV_NAME "Allocate memory for p2p FAILED\n"); - ASSERT(0); - return FALSE; - } -#if CFG_ENABLE_WIFI_DIRECT_CFG_80211 - /* 1. allocate WIPHY */ - prGlueInfo->prP2PInfo->wdev.wiphy = wiphy_new(&mtk_p2p_config_ops, sizeof(P_GLUE_INFO_T)); - if (!prGlueInfo->prP2PInfo->wdev.wiphy) { - printk(KERN_ALERT DRV_NAME "unable to allocate wiphy for p2p\n"); - - goto err_alloc_wiphy; - } - - /* 1.1 fill wiphy parameters */ -#if MTK_WCN_HIF_SDIO - mtk_wcn_hif_sdio_get_dev(prHif->cltCtx, &prDev); - if(!prDev) { - printk(KERN_ALERT DRV_NAME "unable to get struct dev for p2p\n"); - } -#else - prDev = &(prHif->func->dev); -#endif - set_wiphy_dev(prGlueInfo->prP2PInfo->wdev.wiphy, prDev); - - prGlueInfo->prP2PInfo->wdev.wiphy->interface_modes = BIT(NL80211_IFTYPE_AP) - | BIT(NL80211_IFTYPE_P2P_CLIENT) - | BIT(NL80211_IFTYPE_P2P_GO) - | BIT(NL80211_IFTYPE_STATION); - - p2pUpdateChannelTableByDomain(prGlueInfo); - prGlueInfo->prP2PInfo->wdev.wiphy->bands[IEEE80211_BAND_2GHZ] = &mtk_band_2ghz; - if(prAdapter->fgEnable5GBand) { - prGlueInfo->prP2PInfo->wdev.wiphy->bands[IEEE80211_BAND_5GHZ] = &mtk_band_5ghz; - } - - prGlueInfo->prP2PInfo->wdev.wiphy->mgmt_stypes = mtk_cfg80211_default_mgmt_stypes; - prGlueInfo->prP2PInfo->wdev.wiphy->max_remain_on_channel_duration = 5000; - prGlueInfo->prP2PInfo->wdev.wiphy->n_cipher_suites = 5; - prGlueInfo->prP2PInfo->wdev.wiphy->cipher_suites = (const u32*)cipher_suites; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) - prGlueInfo->prP2PInfo->wdev.wiphy->flags = WIPHY_FLAG_CUSTOM_REGULATORY | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; -#else - prGlueInfo->prP2PInfo->wdev.wiphy->flags = WIPHY_FLAG_CUSTOM_REGULATORY; -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32) - prGlueInfo->prP2PInfo->wdev.wiphy->max_scan_ssids = MAX_SCAN_LIST_NUM; - prGlueInfo->prP2PInfo->wdev.wiphy->max_scan_ie_len = MAX_SCAN_IE_LEN; - prGlueInfo->prP2PInfo->wdev.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; -#endif - -#if 0 - /* 2. Register WIPHY */ - if(wiphy_register(prGlueInfo->prP2PInfo->wdev.wiphy) < 0) { - printk(KERN_ALERT DRV_NAME "Couldn't register wiphy device for p2p\n"); - - goto err_reg_wiphy; - } -#endif - - /* 2.1 set priv as pointer to glue structure */ - *((P_GLUE_INFO_T *) wiphy_priv(prGlueInfo->prP2PInfo->wdev.wiphy)) = prGlueInfo; - - /* 2.2 wdev initialization */ - if(fgIsApMode) { - prGlueInfo->prP2PInfo->wdev.iftype = NL80211_IFTYPE_AP; - } else { - prGlueInfo->prP2PInfo->wdev.iftype = NL80211_IFTYPE_P2P_CLIENT; - } - -#endif /* CFG_ENABLE_WIFI_DIRECT_CFG_80211 */ - - /* 3. allocate netdev */ - prGlueInfo->prP2PInfo->prDevHandler = alloc_netdev_mq(sizeof(P_GLUE_INFO_T), prDevName, ether_setup, CFG_MAX_TXQ_NUM); - if (!prGlueInfo->prP2PInfo->prDevHandler) { - printk(KERN_ALERT DRV_NAME "unable to allocate netdevice for p2p\n"); - - printk("unable to allocate netdevice for p2p\n"); - - goto err_alloc_netdev; - } - - /* 4. setup netdev */ - /* 4.1 Point to shared glue structure */ - *((P_GLUE_INFO_T *) netdev_priv(prGlueInfo->prP2PInfo->prDevHandler)) = prGlueInfo; - - /* 4.2 fill hardware address */ - COPY_MAC_ADDR(rMacAddr, prAdapter->rMyMacAddr); - rMacAddr[0] ^= 0x2; // change to local administrated address - memcpy(prGlueInfo->prP2PInfo->prDevHandler->dev_addr, rMacAddr, ETH_ALEN); - memcpy(prGlueInfo->prP2PInfo->prDevHandler->perm_addr, prGlueInfo->prP2PInfo->prDevHandler->dev_addr, ETH_ALEN); - - /* 4.3 register callback functions */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) - prGlueInfo->prP2PInfo->prDevHandler->netdev_ops = &p2p_netdev_ops; -#else - prGlueInfo->prP2PInfo->prDevHandler->open = p2pOpen; - prGlueInfo->prP2PInfo->prDevHandler->stop = p2pStop; - prGlueInfo->prP2PInfo->prDevHandler->get_stats = p2pGetStats; - prGlueInfo->prP2PInfo->prDevHandler->set_multicast_list = p2pSetMulticastList; - prGlueInfo->prP2PInfo->prDevHandler->hard_start_xmit = p2pHardStartXmit; - prGlueInfo->prP2PInfo->prDevHandler->do_ioctl = p2pDoIOCTL; - prGlueInfo->prP2PInfo->prDevHandler->set_mac_address = p2pSetMACAddress; -#endif -// prGlueInfo->prP2PInfo->prDevHandler->wireless_handlers = &mtk_p2p_wext_handler_def; - - -#if (MTK_WCN_HIF_SDIO == 0) - SET_NETDEV_DEV(prGlueInfo->prP2PInfo->prDevHandler, &(prHif->func->dev)); -#endif - - -#if CFG_ENABLE_WIFI_DIRECT_CFG_80211 - prGlueInfo->prP2PInfo->prDevHandler->ieee80211_ptr = &(prGlueInfo->prP2PInfo->wdev); - prGlueInfo->prP2PInfo->wdev.netdev = prGlueInfo->prP2PInfo->prDevHandler; -#endif - -#if CFG_TCP_IP_CHKSUM_OFFLOAD - prGlueInfo->prP2PInfo->prDevHandler->features = NETIF_F_IP_CSUM; -#endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */ - -#if 0 - /* 7. net device initialize */ - netif_carrier_off(prGlueInfo->prP2PInfo->prDevHandler); - netif_tx_stop_all_queues(prGlueInfo->prP2PInfo->prDevHandler); - - /* 8. register for net device */ - if (register_netdev(prGlueInfo->prP2PInfo->prDevHandler) < 0) { - printk(KERN_ALERT DRV_NAME "unable to register netdevice for p2p\n"); - - goto err_reg_netdev; - } -#endif - - /* 8. set p2p net device register state */ - prGlueInfo->prAdapter->rP2PNetRegState = ENUM_NET_REG_STATE_UNREGISTERED; - - /* 9. setup running mode*/ - prGlueInfo->prAdapter->rWifiVar.prP2pFsmInfo->fgIsApMode = fgIsApMode; - - /* 10. finish */ - p2pFsmInit(prAdapter); - - p2pFuncInitConnectionSettings(prAdapter, prAdapter->rWifiVar.prP2PConnSettings); - - /* Active network too early would cause HW not able to sleep. - * Defer the network active time. - */ -// nicActivateNetwork(prAdapter, NETWORK_TYPE_P2P_INDEX); - - return TRUE; -#if 0 -err_reg_netdev: - free_netdev(prGlueInfo->prP2PInfo->prDevHandler); -#endif -err_alloc_netdev: -#if CFG_ENABLE_WIFI_DIRECT_CFG_80211 -// wiphy_unregister(prGlueInfo->prP2PInfo->wdev.wiphy); - -//err_reg_wiphy: - wiphy_free(prGlueInfo->prP2PInfo->wdev.wiphy); - prGlueInfo->prP2PInfo->wdev.wiphy = NULL; - -err_alloc_wiphy: -#endif - - return FALSE; -} /* end of glRegisterP2P() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Unregister Net Device for Wi-Fi Direct -* -* \param[in] prGlueInfo Pointer to glue info -* -* \return TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -glUnregisterP2P( - P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - p2pFsmUninit(prGlueInfo->prAdapter); - - nicDeactivateNetwork(prGlueInfo->prAdapter, NETWORK_TYPE_P2P_INDEX); - -#if 0 - /* Release command, mgmt and security frame belong to P2P network in - * prGlueInfo->prCmdQue - * prAdapter->rPendingCmdQueue - * prAdapter->rTxCtrl.rTxMgmtTxingQueue - * To ensure there is no pending CmdDone/TxDone handler to be executed after p2p module is removed. - */ - - /* Clear CmdQue*/ - kalClearMgmtFramesByNetType(prGlueInfo, NETWORK_TYPE_P2P_INDEX); - kalClearSecurityFramesByNetType(prGlueInfo, NETWORK_TYPE_P2P_INDEX); - /* Clear PendingCmdQue*/ - wlanReleasePendingCMDbyNetwork(prGlueInfo->prAdapter, NETWORK_TYPE_P2P_INDEX); - /* Clear PendingTxMsdu */ - nicFreePendingTxMsduInfoByNetwork(prGlueInfo->prAdapter, NETWORK_TYPE_P2P_INDEX); -#endif - -#if 0 - /* prepare for removal */ - if(netif_carrier_ok(prGlueInfo->prP2PInfo->prDevHandler)) { - netif_carrier_off(prGlueInfo->prP2PInfo->prDevHandler); - } - - netif_tx_stop_all_queues(prGlueInfo->prP2PInfo->prDevHandler); - - /* netdevice unregistration & free */ - unregister_netdev(prGlueInfo->prP2PInfo->prDevHandler); -#endif - free_netdev(prGlueInfo->prP2PInfo->prDevHandler); - prGlueInfo->prP2PInfo->prDevHandler = NULL; - -#if CFG_ENABLE_WIFI_DIRECT_CFG_80211 -#if 0 - wiphy_unregister(prGlueInfo->prP2PInfo->wdev.wiphy); -#endif - wiphy_free(prGlueInfo->prP2PInfo->wdev.wiphy); - prGlueInfo->prP2PInfo->wdev.wiphy = NULL; -#endif - - /* Free p2p memory */ -#if 1 - if(!p2PFreeInfo(prGlueInfo)) { - printk(KERN_ALERT DRV_NAME "Free memory for p2p FAILED\n"); - ASSERT(0); - return FALSE; - } -#endif - return TRUE; - -} /* end of glUnregisterP2P() */ - - -/*----------------------------------------------------------------------------*/ -/*! - * \brief A function for stop p2p fsm immediate - * - * \param[in] prGlueInfo Pointer to struct P_GLUE_INFO_T. - * - * \retval TRUE The execution succeeds. - * \retval FALSE The execution failed. - */ -/*----------------------------------------------------------------------------*/ -BOOLEAN -p2pStopImmediate( - P_GLUE_INFO_T prGlueInfo - ) -{ -// P_ADAPTER_T prAdapter = NULL; -// P_MSG_P2P_FUNCTION_SWITCH_T prFuncSwitch; - - ASSERT(prGlueInfo); - -// prAdapter = prGlueInfo->prAdapter; -// ASSERT(prAdapter); - - /* 1. stop TX queue */ - netif_tx_stop_all_queues(prGlueInfo->prP2PInfo->prDevHandler); - - -#if 0 - /* 2. switch P2P-FSM off */ - /* 2.1 allocate for message */ - prFuncSwitch = (P_MSG_P2P_FUNCTION_SWITCH_T) cnmMemAlloc( - prAdapter, - RAM_TYPE_MSG, - sizeof(MSG_P2P_FUNCTION_SWITCH_T)); - - if (!prFuncSwitch) { - ASSERT(0); // Can't trigger P2P FSM - printk(KERN_ALERT DRV_NAME "Allocate for p2p mesasage FAILED\n"); - //return -ENOMEM; - } - - /* 2.2 fill message */ - prFuncSwitch->rMsgHdr.eMsgId = MID_MNY_P2P_FUN_SWITCH; - prFuncSwitch->fgIsFuncOn = FALSE; - - /* 2.3 send message */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prFuncSwitch, - MSG_SEND_METHOD_UNBUF); - -#endif - - /* 3. stop queue and turn off carrier */ - prGlueInfo->prP2PInfo->eState = PARAM_MEDIA_STATE_DISCONNECTED; - - return TRUE; -} /* end of p2pStop() */ - - -/* Net Device Hooks */ -/*----------------------------------------------------------------------------*/ -/*! - * \brief A function for net_device open (ifup) - * - * \param[in] prDev Pointer to struct net_device. - * - * \retval 0 The execution succeeds. - * \retval < 0 The execution failed. - */ -/*----------------------------------------------------------------------------*/ -static int -p2pOpen( - IN struct net_device *prDev - ) -{ -// P_GLUE_INFO_T prGlueInfo = NULL; -// P_ADAPTER_T prAdapter = NULL; -// P_MSG_P2P_FUNCTION_SWITCH_T prFuncSwitch; - - ASSERT(prDev); - -#if 0 // Move after device name set. (mtk_p2p_set_local_dev_info) - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - /* 1. switch P2P-FSM on */ - /* 1.1 allocate for message */ - prFuncSwitch = (P_MSG_P2P_FUNCTION_SWITCH_T) cnmMemAlloc(prAdapter, - RAM_TYPE_MSG, - sizeof(MSG_P2P_FUNCTION_SWITCH_T)); - - if (!prFuncSwitch) { - ASSERT(0); // Can't trigger P2P FSM - return -ENOMEM; - } - - /* 1.2 fill message */ - prFuncSwitch->rMsgHdr.eMsgId = MID_MNY_P2P_FUN_SWITCH; - prFuncSwitch->fgIsFuncOn = TRUE; - - /* 1.3 send message */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prFuncSwitch, - MSG_SEND_METHOD_BUF); -#endif - - /* 2. carrier on & start TX queue */ - netif_carrier_on(prDev); - netif_tx_start_all_queues(prDev); - - return 0; /* success */ -} /* end of p2pOpen() */ - - -/*----------------------------------------------------------------------------*/ -/*! - * \brief A function for net_device stop (ifdown) - * - * \param[in] prDev Pointer to struct net_device. - * - * \retval 0 The execution succeeds. - * \retval < 0 The execution failed. - */ -/*----------------------------------------------------------------------------*/ -static int -p2pStop( - IN struct net_device *prDev - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - P_ADAPTER_T prAdapter = NULL; -// P_MSG_P2P_FUNCTION_SWITCH_T prFuncSwitch; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - /* 1. stop TX queue */ - netif_tx_stop_all_queues(prDev); -#if 0 - /* 2. switch P2P-FSM off */ - /* 2.1 allocate for message */ - prFuncSwitch = (P_MSG_P2P_FUNCTION_SWITCH_T) cnmMemAlloc(prAdapter, - RAM_TYPE_MSG, - sizeof(MSG_P2P_FUNCTION_SWITCH_T)); - - if (!prFuncSwitch) { - ASSERT(0); // Can't trigger P2P FSM - return -ENOMEM; - } - - /* 2.2 fill message */ - prFuncSwitch->rMsgHdr.eMsgId = MID_MNY_P2P_FUN_SWITCH; - prFuncSwitch->fgIsFuncOn = FALSE; - - /* 2.3 send message */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prFuncSwitch, - MSG_SEND_METHOD_BUF); -#endif - /* 3. stop queue and turn off carrier */ - prGlueInfo->prP2PInfo->eState = PARAM_MEDIA_STATE_DISCONNECTED; - - netif_tx_stop_all_queues(prDev); - if(netif_carrier_ok(prDev)) { - netif_carrier_off(prDev); - } - - return 0; -} /* end of p2pStop() */ - - -/*----------------------------------------------------------------------------*/ -/*! - * \brief A method of struct net_device, to get the network interface statistical - * information. - * - * Whenever an application needs to get statistics for the interface, this method - * is called. This happens, for example, when ifconfig or netstat -i is run. - * - * \param[in] prDev Pointer to struct net_device. - * - * \return net_device_stats buffer pointer. - */ -/*----------------------------------------------------------------------------*/ -struct net_device_stats * -p2pGetStats ( - IN struct net_device *prDev - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - -#if 1 // frog temp fix - //@FIXME - //prDev->stats.rx_packets = 0; - //prDev->stats.tx_packets = 0; - prDev->stats.tx_errors = 0; - prDev->stats.rx_errors = 0; - //prDev->stats.rx_bytes = 0; - //prDev->stats.tx_bytes = 0; - prDev->stats.multicast = 0; - - return &prDev->stats; - -#else - prGlueInfo->prP2PInfo->rNetDevStats.rx_packets = 0; - prGlueInfo->prP2PInfo->rNetDevStats.tx_packets = 0; - prGlueInfo->prP2PInfo->rNetDevStats.tx_errors = 0; - prGlueInfo->prP2PInfo->rNetDevStats.rx_errors = 0; - prGlueInfo->prP2PInfo->rNetDevStats.rx_bytes = 0; - prGlueInfo->prP2PInfo->rNetDevStats.tx_bytes = 0; - prGlueInfo->prP2PInfo->rNetDevStats.rx_errors = 0; - prGlueInfo->prP2PInfo->rNetDevStats.multicast = 0; - - return &prGlueInfo->prP2PInfo->rNetDevStats; -#endif -} /* end of p2pGetStats() */ - - - - -static void -p2pSetMulticastList ( - IN struct net_device *prDev - ) -{ - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - - prGlueInfo = (NULL != prDev) ? *((P_GLUE_INFO_T *) netdev_priv(prDev)) : NULL; - - ASSERT(prDev); - ASSERT(prGlueInfo); - if (!prDev || !prGlueInfo) { - printk(KERN_WARNING DRV_NAME" abnormal dev or skb: prDev(0x%p), prGlueInfo(0x%p)\n", prDev, prGlueInfo); - return; - } - - - g_P2pPrDev = prDev; - - //4 Mark HALT, notify main thread to finish current job - prGlueInfo->u4Flag |= GLUE_FLAG_SUB_MOD_MULTICAST; - /* wake up main thread */ - wake_up_interruptible(&prGlueInfo->waitq); - -} /* p2pSetMulticastList */ - - -/*----------------------------------------------------------------------------*/ -/*! - * \brief This function is to set multicast list and set rx mode. - * - * \param[in] prDev Pointer to struct net_device - * - * \return (none) - */ -/*----------------------------------------------------------------------------*/ -void -mtk_p2p_wext_set_Multicastlist ( - P_GLUE_INFO_T prGlueInfo - ) -{ - UINT_32 u4SetInfoLen = 0; - struct net_device *prDev = g_P2pPrDev; - - prGlueInfo = (NULL != prDev) ? *((P_GLUE_INFO_T *) netdev_priv(prDev)) : NULL; - - ASSERT(prDev); - ASSERT(prGlueInfo); - if (!prDev || !prGlueInfo) { - printk(KERN_WARNING DRV_NAME" abnormal dev or skb: prDev(0x%p), prGlueInfo(0x%p)\n", prDev, prGlueInfo); - return; - } - - - if (prDev->flags & IFF_PROMISC) { - prGlueInfo->prP2PInfo->u4PacketFilter |= PARAM_PACKET_FILTER_PROMISCUOUS; - } - - if (prDev->flags & IFF_BROADCAST) { - prGlueInfo->prP2PInfo->u4PacketFilter |= PARAM_PACKET_FILTER_BROADCAST; - } - - if (prDev->flags & IFF_MULTICAST) { - if ((prDev->flags & IFF_ALLMULTI) || -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - (netdev_mc_count(prDev) > MAX_NUM_GROUP_ADDR)) { -#else - (prDev->mc_count > MAX_NUM_GROUP_ADDR)) { -#endif - prGlueInfo->prP2PInfo->u4PacketFilter |= PARAM_PACKET_FILTER_ALL_MULTICAST; - } - else { - prGlueInfo->prP2PInfo->u4PacketFilter |= PARAM_PACKET_FILTER_MULTICAST; - } - } - - if (prGlueInfo->prP2PInfo->u4PacketFilter & PARAM_PACKET_FILTER_MULTICAST) { - /* Prepare multicast address list */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - struct netdev_hw_addr *ha; -#else - struct dev_mc_list *prMcList; -#endif - UINT_32 i = 0; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) - netdev_for_each_mc_addr(ha, prDev) { - if(i < MAX_NUM_GROUP_ADDR) { - COPY_MAC_ADDR(&(prGlueInfo->prP2PInfo->aucMCAddrList[i]), ha->addr); - i++; - } - } -#else - for (i = 0, prMcList = prDev->mc_list; - (prMcList) && (i < prDev->mc_count) && (i < MAX_NUM_GROUP_ADDR); - i++, prMcList = prMcList->next) { - COPY_MAC_ADDR(&(prGlueInfo->prP2PInfo->aucMCAddrList[i]), prMcList->dmi_addr); - } -#endif - - DBGLOG(P2P, TRACE, ("SEt Multicast Address List\n")); - - if (i >= MAX_NUM_GROUP_ADDR) { - return; - } - wlanoidSetP2PMulticastList(prGlueInfo->prAdapter, - &(prGlueInfo->prP2PInfo->aucMCAddrList[0]), - (i * ETH_ALEN), - &u4SetInfoLen); - - } - - return; -} /* end of p2pSetMulticastList() */ - - -/*----------------------------------------------------------------------------*/ -/*! - * * \brief This function is TX entry point of NET DEVICE. - * * - * * \param[in] prSkb Pointer of the sk_buff to be sent - * * \param[in] prDev Pointer to struct net_device - * * - * * \retval NETDEV_TX_OK - on success. - * * \retval NETDEV_TX_BUSY - on failure, packet will be discarded by upper layer. - * */ -/*----------------------------------------------------------------------------*/ -int -p2pHardStartXmit( - IN struct sk_buff *prSkb, - IN struct net_device *prDev - ) -{ - P_QUE_ENTRY_T prQueueEntry = NULL; - P_QUE_T prTxQueue = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - UINT_16 u2QueueIdx = 0; - - GLUE_SPIN_LOCK_DECLARATION(); - - ASSERT(prSkb); - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - - if (prGlueInfo->u4Flag & GLUE_FLAG_HALT) { - printk(KERN_INFO DRV_NAME"GLUE_FLAG_HALT skip tx\n"); - dev_kfree_skb(prSkb); - return NETDEV_TX_OK; - } - - // mark as P2P packets - GLUE_SET_PKT_FLAG_P2P(prSkb); - - prQueueEntry = (P_QUE_ENTRY_T) GLUE_GET_PKT_QUEUE_ENTRY(prSkb); - prTxQueue = &prGlueInfo->rTxQueue; - - if (wlanProcessSecurityFrame(prGlueInfo->prAdapter, (P_NATIVE_PACKET) prSkb) == FALSE) { - - u2QueueIdx = skb_get_queue_mapping(prSkb); - ASSERT(u2QueueIdx < CFG_MAX_TXQ_NUM); - - if (u2QueueIdx >= CFG_MAX_TXQ_NUM) { - printk(KERN_INFO DRV_NAME"Incorrect queue index, skip this frame\n"); - dev_kfree_skb(prSkb); - return NETDEV_TX_OK; - } - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_TX_QUE); - QUEUE_INSERT_TAIL(prTxQueue, prQueueEntry); - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_TX_QUE); - - GLUE_INC_REF_CNT(prGlueInfo->i4TxPendingFrameNum); - GLUE_INC_REF_CNT(prGlueInfo->ai4TxPendingFrameNumPerQueue[NETWORK_TYPE_P2P_INDEX][u2QueueIdx]); - - if (prGlueInfo->ai4TxPendingFrameNumPerQueue[NETWORK_TYPE_P2P_INDEX][u2QueueIdx] >= CFG_TX_STOP_NETIF_PER_QUEUE_THRESHOLD) { - netif_stop_subqueue(prDev, u2QueueIdx); - } - } - else { - GLUE_INC_REF_CNT(prGlueInfo->i4TxPendingSecurityFrameNum); - } - - kalSetEvent(prGlueInfo); - - /* Statistic usage. */ - prDev->stats.tx_bytes += prSkb->len; - prDev->stats.tx_packets++; - - return NETDEV_TX_OK; -} /* end of p2pHardStartXmit() */ - - -/*----------------------------------------------------------------------------*/ -/*! - * \brief A method of struct net_device, a primary SOCKET interface to configure - * the interface lively. Handle an ioctl call on one of our devices. - * Everything Linux ioctl specific is done here. Then we pass the contents - * of the ifr->data to the request message handler. - * - * \param[in] prDev Linux kernel netdevice - * - * \param[in] prIFReq Our private ioctl request structure, typed for the generic - * struct ifreq so we can use ptr to function - * - * \param[in] cmd Command ID - * - * \retval WLAN_STATUS_SUCCESS The IOCTL command is executed successfully. - * \retval OTHER The execution of IOCTL command is failed. - */ -/*----------------------------------------------------------------------------*/ -int -p2pDoIOCTL( - struct net_device *prDev, - struct ifreq *prIFReq, - int i4Cmd - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - int ret = 0; - char *prExtraBuf = NULL; - UINT_32 u4ExtraSize = 0; - struct iwreq *prIwReq = (struct iwreq *)prIFReq; - struct iw_request_info rIwReqInfo; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - - if (prGlueInfo->u4ReadyFlag == 0) { - // adapter not ready yet - return -EINVAL; - } - - // fill rIwReqInfo - rIwReqInfo.cmd = (__u16)i4Cmd; - rIwReqInfo.flags = 0; - - switch(i4Cmd) { - case SIOCSIWENCODEEXT: - /* Set Encryption Material after 4-way handshaking is done */ - if (prIwReq->u.encoding.pointer) { - u4ExtraSize = prIwReq->u.encoding.length; - prExtraBuf = kalMemAlloc(u4ExtraSize, VIR_MEM_TYPE); - - if (!prExtraBuf) { - ret = -ENOMEM; - break; - } - - if (copy_from_user(prExtraBuf, - prIwReq->u.encoding.pointer, - prIwReq->u.encoding.length)) { - ret = -EFAULT; - } - } - else if (prIwReq->u.encoding.length != 0) { - ret = -EINVAL; - break; - } - - if(ret == 0) { - ret = mtk_p2p_wext_set_key(prDev, &rIwReqInfo, &(prIwReq->u), prExtraBuf); - } - - kalMemFree(prExtraBuf, VIR_MEM_TYPE, u4ExtraSize); - prExtraBuf = NULL; - break; - - case SIOCSIWMLME: - /* IW_MLME_DISASSOC used for disconnection*/ - if (prIwReq->u.data.length != sizeof(struct iw_mlme)) { - printk(KERN_INFO "MLME buffer strange:%d\n", prIwReq->u.data.length); - ret = -EINVAL; - break; - } - - if (!prIwReq->u.data.pointer) { - ret = -EINVAL; - break; - } - - prExtraBuf = kalMemAlloc(sizeof(struct iw_mlme), VIR_MEM_TYPE); - if (!prExtraBuf) { - ret = - ENOMEM; - break; - } - - if (copy_from_user(prExtraBuf, prIwReq->u.data.pointer, sizeof(struct iw_mlme))) { - ret = -EFAULT; - } - else { - ret = mtk_p2p_wext_mlme_handler(prDev, &rIwReqInfo, &(prIwReq->u), prExtraBuf); - } - - kalMemFree(prExtraBuf, VIR_MEM_TYPE, sizeof(struct iw_mlme)); - prExtraBuf = NULL; - break; - - case SIOCGIWPRIV: - /* This ioctl is used to list all IW privilege ioctls */ - ret = mtk_p2p_wext_get_priv(prDev, &rIwReqInfo, &(prIwReq->u), NULL); - break; - - case SIOCGIWSCAN: - ret = mtk_p2p_wext_discovery_results(prDev, &rIwReqInfo, &(prIwReq->u), NULL); - break; - - case SIOCSIWAUTH: - ret = mtk_p2p_wext_set_auth(prDev, &rIwReqInfo, &(prIwReq->u), NULL); - break; - - case IOC_P2P_CFG_DEVICE: - case IOC_P2P_PROVISION_COMPLETE: - case IOC_P2P_START_STOP_DISCOVERY: - case IOC_P2P_DISCOVERY_RESULTS: - case IOC_P2P_WSC_BEACON_PROBE_RSP_IE: - case IOC_P2P_CONNECT_DISCONNECT: - case IOC_P2P_PASSWORD_READY: - case IOC_P2P_GET_STRUCT: - case IOC_P2P_SET_STRUCT: - case IOC_P2P_GET_REQ_DEVICE_INFO: - ret = rP2PIwPrivHandler[i4Cmd - SIOCIWFIRSTPRIV](prDev, &rIwReqInfo, &(prIwReq->u), (char *)&(prIwReq->u)); - break; -#if CFG_SUPPORT_P2P_RSSI_QUERY - case SIOCGIWSTATS: - ret = mtk_p2p_wext_get_rssi(prDev, &rIwReqInfo, &(prIwReq->u), NULL); - break; -#endif - default: - ret = -ENOTTY; - } - - return ret; -} /* end of p2pDoIOCTL() */ - - -/*----------------------------------------------------------------------------*/ -/*! - * \brief To report the private supported IOCTLs table to user space. - * - * \param[in] prDev Net device requested. - * \param[out] prIfReq Pointer to ifreq structure, content is copied back to - * user space buffer in gl_iwpriv_table. - * - * \retval 0 For success. - * \retval -E2BIG For user's buffer size is too small. - * \retval -EFAULT For fail. - * - */ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_get_priv ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - struct iw_point *prData= (struct iw_point *)&wrqu->data; - UINT_16 u2BufferSize = 0; - - ASSERT(prDev); - - u2BufferSize = prData->length; - - /* update our private table size */ - prData->length = (__u16)sizeof(rP2PIwPrivTable)/sizeof(struct iw_priv_args); - - if (u2BufferSize < prData->length) { - return -E2BIG; - } - - if (prData->length) { - if (copy_to_user(prData->pointer, rP2PIwPrivTable, sizeof(rP2PIwPrivTable))) { - return -EFAULT; - } - } - - return 0; -} /* end of mtk_p2p_wext_get_priv() */ - - -/*----------------------------------------------------------------------------*/ -/*! - * \brief To indicate P2P-FSM for re-associate to the connecting device - * - * \param[in] prDev Net device requested. - * \param[inout] wrqu Pointer to iwreq_data - * - * \retval 0 For success. - * \retval -EFAULT For fail. - * - */ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_reconnect ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ -#if 0 - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - P_MSG_HDR_T prMsgHdr; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - prMsgHdr = (P_MSG_HDR_T) cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_HDR_T)); - if (!prMsgHdr) { - ASSERT(0); // Can't trigger P2P FSM - return -ENOMEM; - } - - /* 1.2 fill message */ - - DBGLOG(P2P, TRACE, ("mtk_p2p_wext_reconnect: P2P Reconnect\n")); - - /* 1.3 send message */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prMsgHdr, - MSG_SEND_METHOD_BUF); -#endif - return 0; -} /* end of mtk_p2p_wext_reconnect() */ - - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief MLME command handler -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_mlme_handler( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ -#if 0 - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - struct iw_mlme *mlme = (struct iw_mlme *)extra; - P_MSG_P2P_CONNECTION_ABORT_T prMsgP2PConnAbt = (P_MSG_P2P_CONNECTION_ABORT_T)NULL; - P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T)NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - prP2pBssInfo = &(prAdapter->rWifiVar.arBssInfo[NETWORK_TYPE_P2P_INDEX]); - - DBGLOG(P2P, TRACE, ("mtk_p2p_wext_mlme_handler:\n")); - - switch (mlme->cmd) { - case IW_MLME_DISASSOC: - prMsgP2PConnAbt = (P_MSG_HDR_T) cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_P2P_CONNECTION_ABORT_T)); - if (!prMsgP2PConnAbt) { - ASSERT(0); // Can't trigger P2P FSM - return -ENOMEM; - } - - COPY_MAC_ADDR(prMsgP2PConnAbt->aucTargetID, mlme->addr.sa_data); - - prMsgP2PConnAbt->u2ReasonCode = mlme->reason_code; - - - if (EQUAL_MAC_ADDR(prMsgP2PConnAbt->aucTargetID, prP2pBssInfo->aucOwnMacAddr)) { - DBGLOG(P2P, TRACE, ("P2P Connection Abort:\n")); - - /* 1.2 fill message */ - prMsgP2PConnAbt->rMsgHdr.eMsgId = MID_MNY_P2P_CONNECTION_ABORT; - } - else { - DBGLOG(P2P, TRACE, ("P2P Connection Pause:\n")); - - /* 1.2 fill message */ - } - - /* 1.3 send message */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prMsgP2PConnAbt, - MSG_SEND_METHOD_BUF); - - break; - - default: - return -EOPNOTSUPP; - } -#endif - return 0; -} /* end of mtk_p2p_wext_mlme_handler() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_PROVISION_COMPLETE) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_set_provision_complete( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ -#if 0 - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - struct iw_point *prData= (struct iw_point *)&wrqu->data; - P_MSG_HDR_T prMsgHdr; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - switch(prData->flags) { - case P2P_PROVISIONING_SUCCESS: - prMsgHdr = (P_MSG_HDR_T) cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_HDR_T)); - if (!prMsgHdr) { - ASSERT(0); // Can't trigger P2P FSM - return -ENOMEM; - } - - /* 1.2 fill message */ - - prGlueInfo->prP2PInfo->u4CipherPairwise = IW_AUTH_CIPHER_CCMP; - - /* 1.3 send message */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prMsgHdr, - MSG_SEND_METHOD_BUF); - - break; - - case P2P_PROVISIONING_FAIL: - - break; - - default: - return -EOPNOTSUPP; - } -#endif - - return 0; -} /* end of mtk_p2p_wext_set_provision_complete() */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_START_STOP_DISCOVERY) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_start_stop_discovery( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ -#if 0 - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - struct iw_point *prData= (struct iw_point *)&wrqu->data; - P_IW_P2P_REQ_DEVICE_TYPE prReqDeviceType = (P_IW_P2P_REQ_DEVICE_TYPE) extra; - UINT_8 au4IeBuf[MAX_IE_LENGTH]; - P_MSG_HDR_T prMsgHdr; - P_MSG_P2P_DEVICE_DISCOVER_T prDiscoverMsg; - P_P2P_CONNECTION_SETTINGS_T prConnSettings; - UINT_8 aucNullAddr[] = NULL_MAC_ADDR; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - prConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - - if(prData->flags == P2P_STOP_DISCOVERY) { - prMsgHdr = (P_MSG_HDR_T) cnmMemAlloc(prAdapter, - RAM_TYPE_MSG, - sizeof(MSG_HDR_T)); - - if (!prMsgHdr) { - ASSERT(0); // Can't trigger P2P FSM - return -ENOMEM; - } - - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prMsgHdr, - MSG_SEND_METHOD_BUF); - } - else if(prData->flags == P2P_START_DISCOVERY) { - - /* retrieve IE for Probe Response */ - if(prReqDeviceType->probe_rsp_len > 0) { - if(prReqDeviceType->probe_rsp_len <= MAX_IE_LENGTH) { - if(copy_from_user(prGlueInfo->prP2PInfo->aucWSCIE[2], prReqDeviceType->probe_rsp_ie, prReqDeviceType->probe_rsp_len)) { - return -EFAULT; - } - prGlueInfo->prP2PInfo->u2WSCIELen[2] = prReqDeviceType->probe_rsp_len; - } - else { - return -E2BIG; - } - } - - /* retrieve IE for Probe Request */ - if(prReqDeviceType->probe_req_len > 0) { - if(prReqDeviceType->probe_req_len <= MAX_IE_LENGTH) { - if(copy_from_user(prGlueInfo->prP2PInfo->aucWSCIE[1], prReqDeviceType->probe_req_ie, prReqDeviceType->probe_req_len)) { - return -EFAULT; - } - prGlueInfo->prP2PInfo->u2WSCIELen[1] = prReqDeviceType->probe_req_len; - } - else { - return -E2BIG; - } - } - /* update IE for Probe Request */ - - if(prReqDeviceType->scan_type == P2P_LISTEN) { - /* update listening parameter */ - - /* @TODO: update prConnSettings for Probe Response IE */ - } - else { - // indicate P2P-FSM with MID_MNY_P2P_DEVICE_DISCOVERY - prDiscoverMsg = (P_MSG_P2P_DEVICE_DISCOVER_T) cnmMemAlloc(prAdapter, - RAM_TYPE_MSG, - sizeof(MSG_P2P_DEVICE_DISCOVER_T)); - - if (!prDiscoverMsg) { - ASSERT(0); // Can't trigger P2P FSM - return -ENOMEM; - } - - prDiscoverMsg->rMsgHdr.eMsgId = MID_MNY_P2P_DEVICE_DISCOVERY; - prDiscoverMsg->u4DevDiscoverTime = 0; // unlimited - prDiscoverMsg->fgIsSpecificType = TRUE; - prDiscoverMsg->rTargetDeviceType.u2CategoryID = *(PUINT_16)(&(prReqDeviceType->pri_device_type[0])); - prDiscoverMsg->rTargetDeviceType.u2SubCategoryID = *(PUINT_16)(&(prReqDeviceType->pri_device_type[6]));; - COPY_MAC_ADDR(prDiscoverMsg->aucTargetDeviceID, aucNullAddr); - - /* @FIXME: parameter to be refined, where to pass IE buffer ? */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prDiscoverMsg, - MSG_SEND_METHOD_BUF); - } - } - else { - return -EINVAL; - } -#endif - - return 0; -} /* end of mtk_p2p_wext_start_stop_discovery() */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_SET_INT) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Setting parameters not support. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_invitation_request ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - int i4Status = 0; -#if 0 - P_ADAPTER_T prAdapter = (P_ADAPTER_T)NULL; - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - struct iw_point *prData = (struct iw_point*)&wrqu->data; - P_IW_P2P_IOCTL_INVITATION_STRUCT prIoctlInvitation = (P_IW_P2P_IOCTL_INVITATION_STRUCT)NULL; - - do { - if ((prDev == NULL) || (extra == NULL)) { - ASSERT(FALSE); - i4Status = -EINVAL; - break; - } - - - prGlueInfo = *((P_GLUE_INFO_T *)netdev_priv(prDev)); - prIoctlInvitation = (P_IW_P2P_IOCTL_INVITATION_STRUCT)extra; - - if (prGlueInfo == NULL) { - i4Status = -EINVAL; - break; - } - - - prAdapter = prGlueInfo->prAdapter; - - if (prAdapter == NULL) { - i4Status = -EINVAL; - break; - } - - - if (prIoctlInvitation->ucReinvoke == 1) { - // TODO: Set Group ID - p2pFuncSetGroupID(prAdapter, prIoctlInvitation->aucGroupID, prIoctlInvitation->aucSsid, prIoctlInvitation->u4SsidLen); - } - - else { - P_MSG_P2P_INVITATION_REQUEST_T prMsgP2PInvitationReq = (P_MSG_P2P_INVITATION_REQUEST_T)NULL; - - // TODO: Do Invitation. - prMsgP2PInvitationReq = (P_MSG_P2P_INVITATION_REQUEST_T) cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_P2P_INVITATION_REQUEST_T)); - if (!prMsgP2PInvitationReq) { - ASSERT(0); // Can't trigger P2P FSM - i4Status = -ENOMEM; - break; - } - - /* 1.2 fill message */ - kalMemCopy(prMsgP2PInvitationReq->aucDeviceID, prIoctlInvitation->aucDeviceID, MAC_ADDR_LEN); - - DBGLOG(P2P, TRACE, ("mtk_p2p_wext_invitation_request: P2P Invitation Req\n")); - - /* 1.3 send message */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prMsgP2PInvitationReq, - MSG_SEND_METHOD_BUF); - - } - - - - } while (FALSE); -#endif - - return i4Status; - -} -/* mtk_p2p_wext_invitation_request */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_SET_INT) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Setting parameters not support. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_invitation_abort ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - int i4Status = 0; -#if 0 - P_ADAPTER_T prAdapter = (P_ADAPTER_T)NULL; - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - struct iw_point *prData = (struct iw_point*)&wrqu->data; - P_IW_P2P_IOCTL_ABORT_INVITATION prIoctlInvitationAbort = (P_IW_P2P_IOCTL_ABORT_INVITATION)NULL; - - UINT_8 bssid[MAC_ADDR_LEN]; - - do { - if ((prDev == NULL) || (extra == NULL)) { - ASSERT(FALSE); - i4Status = -EINVAL; - break; - } - - - prGlueInfo = *((P_GLUE_INFO_T *)netdev_priv(prDev)); - prIoctlInvitationAbort = (P_IW_P2P_IOCTL_ABORT_INVITATION)extra; - - if (prGlueInfo == NULL) { - i4Status = -EINVAL; - break; - } - - - prAdapter = prGlueInfo->prAdapter; - - if (prAdapter == NULL) { - i4Status = -EINVAL; - break; - } - else { - P_MSG_P2P_INVITATION_REQUEST_T prMsgP2PInvitationAbort = (P_MSG_P2P_INVITATION_REQUEST_T)NULL; - - prMsgP2PInvitationAbort = (P_MSG_P2P_INVITATION_REQUEST_T) cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_P2P_INVITATION_REQUEST_T)); - - if (!prMsgP2PInvitationAbort) { - ASSERT(0); // Can't trigger P2P FSM - i4Status = -ENOMEM; - break; - } - - - /* 1.2 fill message */ - kalMemCopy(prMsgP2PInvitationAbort->aucDeviceID, prIoctlInvitationAbort->dev_addr, MAC_ADDR_LEN); - - DBGLOG(P2P, TRACE, ("mtk_p2p_wext_invitation_request: P2P Invitation Req\n")); - - /* 1.3 send message */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prMsgP2PInvitationAbort, - MSG_SEND_METHOD_BUF); - - } - - - } while (FALSE); -#endif - - return i4Status; - -} -/* mtk_p2p_wext_invitation_abort */ - - - -/*----------------------------------------------------------------------------*/ -/*! - * \brief To override p2p interface address - * - * \param[in] prDev Net device requested. - * \param[in] addr Pointer to address - * - * \retval 0 For success. - * \retval -E2BIG For user's buffer size is too small. - * \retval -EFAULT For fail. - * - */ -/*----------------------------------------------------------------------------*/ -int -p2pSetMACAddress( - IN struct net_device *prDev, - void *addr - ) -{ - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - //@FIXME - return eth_mac_addr(prDev, addr); -} - - - - - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To set encryption cipher suite -* -* \param[in] prDev Net device requested. -* \param[out] -* -* \retval 0 Success. -* \retval -EINVAL Invalid parameter -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_set_auth ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - struct iw_param *prAuth = (struct iw_param *)wrqu; - - ASSERT(prDev); - ASSERT(prAuth); - if (FALSE == GLUE_CHK_PR2(prDev, prAuth)) { - return -EINVAL; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - - /* Save information to glue info and process later when ssid is set. */ - switch(prAuth->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: - break; - case IW_AUTH_CIPHER_PAIRWISE: - prGlueInfo->prP2PInfo->u4CipherPairwise = prAuth->value; - break; - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_KEY_MGMT: - case IW_AUTH_TKIP_COUNTERMEASURES: - case IW_AUTH_DROP_UNENCRYPTED: - case IW_AUTH_80211_AUTH_ALG: - case IW_AUTH_WPA_ENABLED: - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - case IW_AUTH_ROAMING_CONTROL: - case IW_AUTH_PRIVACY_INVOKED: - default: - //@TODO - break; - } - - return 0; -} /* end of mtk_p2p_wext_set_auth() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To set encryption cipher and key. -* -* \param[in] prDev Net device requested. -* \param[out] prIfReq Pointer to ifreq structure, content is copied back to -* user space buffer in gl_iwpriv_table. -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note Securiry information is stored in pEnc. -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_set_key( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - int ret = 0; - struct iw_encode_ext *prIWEncExt; - struct iw_point *prEnc; - char *prExtraBuf = NULL; - UINT_32 u4ExtraSize = 0; - UINT_8 keyStructBuf[100]; - P_PARAM_REMOVE_KEY_T prRemoveKey = (P_PARAM_REMOVE_KEY_T) keyStructBuf; - P_PARAM_KEY_T prKey = (P_PARAM_KEY_T) keyStructBuf; - P_GLUE_INFO_T prGlueInfo; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - - do { - if (wrqu->encoding.pointer) { - u4ExtraSize = wrqu->encoding.length; - prExtraBuf = kalMemAlloc(u4ExtraSize, VIR_MEM_TYPE); - - if (!prExtraBuf) { - ret = -ENOMEM; - break; - } - - if (copy_from_user(prExtraBuf, - wrqu->encoding.pointer, - wrqu->encoding.length)) { - ret = -EFAULT; - break; - } - } - else if (wrqu->encoding.length != 0) { - ret = -EINVAL; - break; - } - - prEnc = &wrqu->encoding; - prIWEncExt = (struct iw_encode_ext *) prExtraBuf; - - if (GLUE_CHK_PR3(prDev, prEnc, prExtraBuf) == TRUE) { - memset(keyStructBuf, 0, sizeof(keyStructBuf)); - - if ((prEnc->flags & IW_ENCODE_MODE) == IW_ENCODE_DISABLED) { // Key Removal - prRemoveKey->u4Length = sizeof(*prRemoveKey); - memcpy(prRemoveKey->arBSSID, prIWEncExt->addr.sa_data, 6); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetRemoveP2PKey, - prRemoveKey, - prRemoveKey->u4Length, - FALSE, - FALSE, - TRUE, - TRUE, - &u4BufLen); - - if(rStatus != WLAN_STATUS_SUCCESS) - ret = -EFAULT; - } - else { - if(prIWEncExt->alg == IW_ENCODE_ALG_CCMP) { - /* KeyID */ - prKey->u4KeyIndex = (prEnc->flags & IW_ENCODE_INDEX) ? - ((prEnc->flags & IW_ENCODE_INDEX) - 1) : 0; - if (prKey->u4KeyIndex <= 3) { - /* bit(31) and bit(30) are shared by pKey and pRemoveKey */ - /* Tx Key Bit(31)*/ - if (prIWEncExt->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - prKey->u4KeyIndex |= 0x1UL << 31; - } - - /* Pairwise Key Bit(30) */ - if (prIWEncExt->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - /* group key */ - } - else { - /* pairwise key */ - prKey->u4KeyIndex |= 0x1UL << 30; - } - - /* Rx SC Bit(29) */ - if (prIWEncExt->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { - prKey->u4KeyIndex |= 0x1UL << 29; - memcpy(&prKey->rKeyRSC, prIWEncExt->rx_seq, IW_ENCODE_SEQ_MAX_SIZE); - } - - /* BSSID */ - memcpy(prKey->arBSSID, prIWEncExt->addr.sa_data, 6); - memcpy(prKey->aucKeyMaterial, prIWEncExt->key, prIWEncExt->key_len); - - prKey->u4KeyLength = prIWEncExt->key_len; - prKey->u4Length = ((UINT_32)&(((P_PARAM_KEY_T)0)->aucKeyMaterial)) + prKey->u4KeyLength; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetAddP2PKey, - prKey, - prKey->u4Length, - FALSE, - FALSE, - TRUE, - TRUE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - ret = -EFAULT; - } - } - else { - ret = -EINVAL; - } - } - else { - ret = -EINVAL; - } - } - } - else - ret = -EINVAL; - - } while(FALSE); - - if (prExtraBuf) { - kalMemFree(prExtraBuf, VIR_MEM_TYPE, u4ExtraSize); - prExtraBuf = NULL; - } - - return ret; -} /* end of mtk_p2p_wext_set_key() */ - - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief set the p2p gc power mode -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_set_powermode( - IN struct net_device *prNetDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - //printk("set_powermode = %d, value = %d\n", wrqu->power.disabled, wrqu->power.value); - struct iw_param *prPower = (struct iw_param*)&wrqu->power; -#if 1 - PARAM_POWER_MODE ePowerMode; - INT_32 i4PowerValue; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prPower); - if (FALSE == GLUE_CHK_PR2(prNetDev, prPower)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - //printk(KERN_INFO "wext_set_power value(%d) disabled(%d) flag(0x%x)\n", - // prPower->value, prPower->disabled, prPower->flags); - - if(prPower->disabled){ - ePowerMode = Param_PowerModeCAM; - } - else { - i4PowerValue = prPower->value; -#if WIRELESS_EXT < 21 - i4PowerValue /= 1000000; -#endif - if (i4PowerValue == 0) { - ePowerMode = Param_PowerModeCAM; - } else if (i4PowerValue == 1) { - ePowerMode = Param_PowerModeMAX_PSP; - } else if (i4PowerValue == 2) { - ePowerMode = Param_PowerModeFast_PSP; - } - else { - printk(KERN_DEBUG "%s(): unsupported power management mode value = %d.\n", - __FUNCTION__, - prPower->value); - - return -EINVAL; - } - } - - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetP2pPowerSaveProfile, - &ePowerMode, - sizeof(ePowerMode), - FALSE, - FALSE, - TRUE, - TRUE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - //printk(KERN_INFO DRV_NAME"wlanoidSet802dot11PowerSaveProfile fail 0x%lx\n", rStatus); - return -EFAULT; - } - -#endif - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief get the p2p gc power mode -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_get_powermode( - IN struct net_device *prNetDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - //printk("mtk_p2p_wext_get_powermode\n"); - //wrqu->power.disabled = 0; - //wrqu->power.value = 1; - - struct iw_param *prPower = (struct iw_param*)&wrqu->power; - PARAM_POWER_MODE ePowerMode; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prPower); - if (FALSE == GLUE_CHK_PR2(prNetDev, prPower)) { - return -EINVAL; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - ASSERT(prGlueInfo); - - -#if 1 - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryP2pPowerSaveProfile, - &ePowerMode, - sizeof(ePowerMode), - TRUE, - FALSE, - FALSE, - TRUE, - &u4BufLen); -#else - rStatus = wlanQueryInformation(prGlueInfo->prAdapter, - wlanoidQueryP2pPowerSaveProfile, - &ePowerMode, - sizeof(ePowerMode), - &u4BufLen); -#endif - - prPower->value = 0; - prPower->disabled = 1; - - if (Param_PowerModeCAM == ePowerMode) { - prPower->value = 0; - prPower->disabled = 1; - } - else if (Param_PowerModeMAX_PSP == ePowerMode ) { - prPower->value = 1; - prPower->disabled = 0; - } - else if (Param_PowerModeFast_PSP == ePowerMode ) { - prPower->value = 2; - prPower->disabled = 0; - } - - prPower->flags = IW_POWER_PERIOD | IW_POWER_RELATIVE; -#if WIRELESS_EXT < 21 - prPower->value *= 1000000; -#endif - - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_CFG_DEVICE) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_set_local_dev_info( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - P_IW_P2P_CFG_DEVICE_TYPE prDeviceCfg = (P_IW_P2P_CFG_DEVICE_TYPE) extra; - P_P2P_CONNECTION_SETTINGS_T prConnSettings; - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - //P_MSG_P2P_FUNCTION_SWITCH_T prFuncSwitch = (P_MSG_P2P_FUNCTION_SWITCH_T)NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - prConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - prP2pSpecificBssInfo = prAdapter->rWifiVar.prP2pSpecificBssInfo; - - // update connection settings for P2P-FSM - // 1. update SSID - if(prDeviceCfg->ssid_len > ELEM_MAX_LEN_SSID) { - prConnSettings->ucSSIDLen = ELEM_MAX_LEN_SSID; - } - else { - prConnSettings->ucSSIDLen = prDeviceCfg->ssid_len; - } - - if(copy_from_user(prConnSettings->aucSSID, prDeviceCfg->ssid, prConnSettings->ucSSIDLen)) { - return -EFAULT; - } - - // 2. update device type (WPS IE) - kalMemCopy(&(prConnSettings->rPrimaryDevTypeBE), &(prDeviceCfg->pri_device_type), sizeof(DEVICE_TYPE_T)); -#if P2P_MAX_SUPPORTED_SEC_DEV_TYPE_COUNT - kalMemCopy(&(prConnSettings->arSecondaryDevTypeBE[0]), &(prDeviceCfg->snd_device_type), sizeof(DEVICE_TYPE_T)); -#endif - - // 3. update device name - if(prDeviceCfg->device_name_len > WPS_ATTRI_MAX_LEN_DEVICE_NAME) { - prConnSettings->ucDevNameLen = WPS_ATTRI_MAX_LEN_DEVICE_NAME; - } - else { - prConnSettings->ucDevNameLen = prDeviceCfg->device_name_len; - } - if(copy_from_user(prConnSettings->aucDevName, prDeviceCfg->device_name, prConnSettings->ucDevNameLen)) { - return -EFAULT; - } - - // 4. update GO intent - prConnSettings->ucGoIntent = prDeviceCfg->intend; - - - /* Preferred channel bandwidth */ - prAdapter->rWifiVar.rConnSettings.uc2G4BandwidthMode = - prDeviceCfg->ch_width ? CONFIG_BW_20_40M : CONFIG_BW_20M; - prAdapter->rWifiVar.rConnSettings.uc5GBandwidthMode = - prDeviceCfg->ch_width ? CONFIG_BW_20_40M : CONFIG_BW_20M; - -#if 0 - /* 1. switch P2P-FSM on */ - /* 1.1 allocate for message */ - prFuncSwitch = (P_MSG_P2P_FUNCTION_SWITCH_T) cnmMemAlloc(prAdapter, - RAM_TYPE_MSG, - sizeof(MSG_P2P_FUNCTION_SWITCH_T)); - - if (!prFuncSwitch) { - ASSERT(0); // Can't trigger P2P FSM - return -ENOMEM; - } - - /* 1.2 fill message */ - prFuncSwitch->rMsgHdr.eMsgId = MID_MNY_P2P_FUN_SWITCH; - prFuncSwitch->fgIsFuncOn = TRUE; - - /* 1.3 send message */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prFuncSwitch, - MSG_SEND_METHOD_BUF); -#endif - return 0; -} /* end of mtk_p2p_wext_set_local_dev_info() */ - - - - - - -/*----------------------------------------------------------------------------*/ -/*! - * \brief I/O Control handler for both - * IOC_P2P_START_STOP_DISCOVERY & SIOCGIWSCAN - * - * \param[in] prDev Net device requested. - * \param[inout] wrqu Pointer to iwreq_data - * - * \retval 0 Success. - * \retval -EFAULT Setting parameters to driver fail. - * \retval -EOPNOTSUPP Key size not supported. - * - * \note - */ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_discovery_results( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - struct iw_event iwe; - char *current_ev = extra; - UINT_32 i; - P_GLUE_INFO_T prGlueInfo = NULL; - P_ADAPTER_T prAdapter = NULL; - P_P2P_INFO_T prP2PInfo = (P_P2P_INFO_T)NULL; - P_EVENT_P2P_DEV_DISCOVER_RESULT_T prTargetResult = (P_EVENT_P2P_DEV_DISCOVER_RESULT_T)NULL; - P_PARAM_VARIABLE_IE_T prDesiredIE = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - prP2PInfo = prAdapter->prP2pInfo; - - for(i = 0 ; i < prP2PInfo->u4DeviceNum ; i++) { - prTargetResult = &prP2PInfo->arP2pDiscoverResult[i]; - - /* SIOCGIWAP */ - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, - prTargetResult->aucInterfaceAddr, - 6); - - current_ev = iwe_stream_add_event(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, IW_EV_ADDR_LEN); - - - /* SIOCGIWESSID */ - iwe.cmd = SIOCGIWESSID; - iwe.u.data.flags = 1; - iwe.u.data.length = prTargetResult->u2NameLength; - - current_ev = iwe_stream_add_point(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, prTargetResult->aucName); - - /* IWEVGENIE for WPA IE */ - if(prTargetResult->u2IELength <= 600 && wextSrchDesiredWPAIE(prTargetResult->pucIeBuf, - prTargetResult->u2IELength, - 0xDD, - (PUINT_8 *)&prDesiredIE)) { - - iwe.cmd = IWEVGENIE; - iwe.u.data.flags = 1; - iwe.u.data.length = 2 + (__u16)prDesiredIE->ucLength; - - current_ev = iwe_stream_add_point(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, (char *)prDesiredIE); - } - -#if CFG_SUPPORT_WPS - - /* IWEVGENIE for WPS IE */ - if((prTargetResult->u2IELength <= 600) && wextSrchDesiredWPSIE(prTargetResult->pucIeBuf, - prTargetResult->u2IELength, - 0xDD, - (PUINT_8 *)&prDesiredIE)) { - - iwe.cmd = IWEVGENIE; - iwe.u.data.flags = 1; - iwe.u.data.length = 2 + (__u16)prDesiredIE->ucLength; - - current_ev = iwe_stream_add_point(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, (char *)prDesiredIE); - } - -#endif - - /* IWEVGENIE for RSN IE */ - if((prTargetResult->u2IELength <= 600) && wextSrchDesiredWPAIE(prTargetResult->pucIeBuf, - prTargetResult->u2IELength, - 0x30, - (PUINT_8 *)&prDesiredIE)) { - - iwe.cmd = IWEVGENIE; - iwe.u.data.flags = 1; - iwe.u.data.length = 2 + (__u16)prDesiredIE->ucLength; - - current_ev = iwe_stream_add_point(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, (char *)prDesiredIE); - } - - /* IOC_P2P_GO_WSC_IE */ -#if 1 - /* device capability */ - if (1) { - UINT_8 data[40]; - - iwe.cmd = IWEVCUSTOM; - iwe.u.data.flags = 0; - iwe.u.data.length = 8 + sizeof("p2p_cap="); - - snprintf(data, iwe.u.data.length, "p2p_cap=%02x%02x%02x%02x%c", - prTargetResult->ucDeviceCapabilityBitmap, prTargetResult->ucGroupCapabilityBitmap, - (UINT_8)prTargetResult->u2ConfigMethod, (UINT_8)(prTargetResult->u2ConfigMethod >> 8), '\0' ); - current_ev = iwe_stream_add_point(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, (char *)data); - - //printk("%s\n", data); - kalMemZero(data, 40); - - iwe.cmd = IWEVCUSTOM; - iwe.u.data.flags = 0; - iwe.u.data.length = 12 + sizeof("p2p_dev_type="); - - snprintf(data, iwe.u.data.length, "p2p_dev_type=%02x%02x%02x%02x%02x%02x%c", - (UINT_8)prTargetResult->rPriDevType.u2CategoryID,(UINT_8)prTargetResult->rPriDevType.u2SubCategoryID, - (UINT_8)prTargetResult->arSecDevType[0].u2CategoryID,(UINT_8)prTargetResult->arSecDevType[0].u2SubCategoryID, - (UINT_8)prTargetResult->arSecDevType[1].u2CategoryID,(UINT_8)prTargetResult->arSecDevType[1].u2SubCategoryID, - '\0'); - current_ev = iwe_stream_add_point(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, (char *)data); - //printk("%s\n", data); - - kalMemZero(data, 40); - - iwe.cmd = IWEVCUSTOM; - iwe.u.data.flags = 0; - iwe.u.data.length = 17 + sizeof("p2p_grp_bssid="); - - snprintf(data, iwe.u.data.length, "p2p_grp_bssid="MACSTR"%c", - MAC2STR(prTargetResult->aucBSSID), '\0'); - current_ev = iwe_stream_add_point(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, (char *)data); - //printk("%s\n", data); - - } -#endif - } - - /* Length of data */ - wrqu->data.length = (current_ev - extra); - wrqu->data.flags = 0; - - return 0; -} /* end of mtk_p2p_wext_discovery_results() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_WSC_BEACON_PROBE_RSP_IE) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_wsc_ie( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - P_IW_P2P_HOSTAPD_PARAM prHostapdParam = (P_IW_P2P_HOSTAPD_PARAM)extra; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *)netdev_priv(prDev)); - ASSERT(prGlueInfo); - - if (prHostapdParam->len > 0) { - if (prHostapdParam->len <= MAX_WSC_IE_LENGTH) { - if (copy_from_user(prGlueInfo->prP2PInfo->aucWSCIE[0], prHostapdParam->data, prHostapdParam->len)) { - return -EFAULT; - } - if (copy_from_user(prGlueInfo->prP2PInfo->aucWSCIE[2], prHostapdParam->data, prHostapdParam->len)) { - return -EFAULT; - } - } - else { - return -E2BIG; - } - } - - prGlueInfo->prP2PInfo->u2WSCIELen[0] = prHostapdParam->len; - prGlueInfo->prP2PInfo->u2WSCIELen[2] = prHostapdParam->len; - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - bssUpdateBeaconContent(prAdapter, NETWORK_TYPE_P2P_INDEX); - - //@TODO: send message to P2P-FSM - - return 0; -} /* end of mtk_p2p_wext_wsc_ie() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_CONNECT_DISCONNECT) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_connect_disconnect( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - struct iw_point *prData= (struct iw_point *)&wrqu->data; -// P_IW_P2P_CONNECT_DEVICE prConnectDevice = (P_IW_P2P_CONNECT_DEVICE)extra; -// P_MSG_HDR_T prMsgHdr; -// P_MSG_P2P_CONNECTION_REQUEST_T prMsgP2PConnReq; -// P_MSG_P2P_CONNECTION_ABORT_T prMsgP2PConnAbt; -// UINT_8 aucBCAddr[] = BC_MAC_ADDR; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - if (prData->flags == P2P_CONNECT) { -#if 0 - // indicate P2P-FSM with MID_MNY_P2P_CONNECTION_REQ - prMsgP2PConnReq = (P_MSG_P2P_CONNECTION_REQUEST_T) cnmMemAlloc(prAdapter, - RAM_TYPE_MSG, - sizeof(MSG_P2P_CONNECTION_REQUEST_T)); - - if (!prMsgP2PConnReq) { - ASSERT(0); // Can't trigger P2P FSM - return -ENOMEM; - } - - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prMsgP2PConnReq, - MSG_SEND_METHOD_BUF); -#endif - } - else if(prData->flags == P2P_DISCONNECT) { -#if 0 - // indicate P2P-FSM with MID_MNY_P2P_CONNECTION_ABORT - prMsgP2PConnAbt = (P_MSG_HDR_T) cnmMemAlloc(prAdapter, - RAM_TYPE_MSG, - sizeof(MSG_P2P_CONNECTION_ABORT_T)); - - if (!prMsgP2PConnAbt) { - ASSERT(0); // Can't trigger P2P FSM - return -ENOMEM; - } - - COPY_MAC_ADDR(prMsgP2PConnAbt->aucTargetID, prConnectDevice->sta_addr); - - prMsgP2PConnAbt->rMsgHdr.eMsgId = MID_MNY_P2P_CONNECTION_ABORT; - - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prMsgP2PConnAbt, - MSG_SEND_METHOD_BUF); -#endif - } - else { - return -EINVAL; - } - - return 0; -} /* end of mtk_p2p_wext_connect_disconnect() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_PASSWORD_READY) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_password_ready( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - P_IW_P2P_PASSWORD_READY prPasswordReady = (P_IW_P2P_PASSWORD_READY)extra; - P_P2P_CONNECTION_SETTINGS_T prConnSettings; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *)netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - prConnSettings = prAdapter->rWifiVar.prP2PConnSettings; - - /* retrieve IE for Probe Request */ - if (prPasswordReady->probe_req_len > 0) { - if (prPasswordReady->probe_req_len <= MAX_WSC_IE_LENGTH) { - if (copy_from_user(prGlueInfo->prP2PInfo->aucWSCIE[1], prPasswordReady->probe_req_ie, prPasswordReady->probe_req_len)) { - return -EFAULT; - } - } - else { - return -E2BIG; - } - } - - prGlueInfo->prP2PInfo->u2WSCIELen[1] = prPasswordReady->probe_req_len; - - /* retrieve IE for Probe Response */ - if (prPasswordReady->probe_rsp_len > 0) { - if (prPasswordReady->probe_rsp_len <= MAX_WSC_IE_LENGTH) { - if (copy_from_user(prGlueInfo->prP2PInfo->aucWSCIE[2], prPasswordReady->probe_rsp_ie, prPasswordReady->probe_rsp_len)) { - return -EFAULT; - } - } - else { - return -E2BIG; - } - } - - prGlueInfo->prP2PInfo->u2WSCIELen[2] = prPasswordReady->probe_rsp_len; - - switch (prPasswordReady->active_config_method) { - case 1: - prConnSettings->u2LocalConfigMethod = WPS_ATTRI_CFG_METHOD_PUSH_BUTTON; - break; - case 2: - prConnSettings->u2LocalConfigMethod = WPS_ATTRI_CFG_METHOD_KEYPAD; - break; - case 3: - prConnSettings->u2LocalConfigMethod = WPS_ATTRI_CFG_METHOD_DISPLAY; - break; - default: - break; - } - - prConnSettings->fgIsPasswordIDRdy = TRUE; - return 0; -} /* end of mtk_p2p_wext_password_ready() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_GET_REQ_DEVICE_INFO) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_request_dev_info( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - P_IW_P2P_DEVICE_REQ prDeviceReq = (P_IW_P2P_DEVICE_REQ)extra; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - // specify data length - wrqu->data.length = sizeof(IW_P2P_DEVICE_REQ); - - // copy to upper-layer supplied buffer - kalMemCopy(prDeviceReq->name, prGlueInfo->prP2PInfo->aucConnReqDevName, prGlueInfo->prP2PInfo->u4ConnReqNameLength); - prDeviceReq->name_len = prGlueInfo->prP2PInfo->u4ConnReqNameLength; - prDeviceReq->name[prDeviceReq->name_len]='\0'; - COPY_MAC_ADDR(prDeviceReq->device_addr, prGlueInfo->prP2PInfo->rConnReqPeerAddr); - prDeviceReq->device_type = prGlueInfo->prP2PInfo->ucConnReqDevType; - prDeviceReq->config_method = prGlueInfo->prP2PInfo->i4ConnReqConfigMethod; - prDeviceReq->active_config_method = prGlueInfo->prP2PInfo->i4ConnReqActiveConfigMethod; - - return 0; -} /* end of mtk_p2p_wext_request_dev_info() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_GET_STRUCT) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_invitation_indicate( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - P_IW_P2P_IOCTL_INVITATION_INDICATE prInvIndicate = (P_IW_P2P_IOCTL_INVITATION_INDICATE)extra; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - // specify data length - wrqu->data.length = sizeof(IW_P2P_IOCTL_INVITATION_INDICATE); - - // copy to upper-layer supplied buffer - kalMemCopy(prInvIndicate->dev_name, prGlueInfo->prP2PInfo->aucConnReqDevName, prGlueInfo->prP2PInfo->u4ConnReqNameLength); - kalMemCopy(prInvIndicate->group_bssid, prGlueInfo->prP2PInfo->rConnReqGroupAddr, MAC_ADDR_LEN); - prInvIndicate->name_len = prGlueInfo->prP2PInfo->u4ConnReqNameLength; - prInvIndicate->dev_name[prInvIndicate->name_len]='\0'; - COPY_MAC_ADDR(prInvIndicate->dev_addr, prGlueInfo->prP2PInfo->rConnReqPeerAddr); - prInvIndicate->config_method = prGlueInfo->prP2PInfo->i4ConnReqConfigMethod; - prInvIndicate->operating_channel = prGlueInfo->prP2PInfo->ucOperatingChnl; - prInvIndicate->invitation_type = prGlueInfo->prP2PInfo->ucInvitationType; - - return 0; -} /* end of mtk_p2p_wext_invitation_indicate() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_GET_STRUCT) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_invitation_status( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - P_IW_P2P_IOCTL_INVITATION_STATUS prInvStatus = (P_IW_P2P_IOCTL_INVITATION_STATUS)extra; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - // specify data length - wrqu->data.length = sizeof(IW_P2P_IOCTL_INVITATION_STATUS); - - // copy to upper-layer supplied buffer - prInvStatus->status_code = prGlueInfo->prP2PInfo->u4InvStatus; - - return 0; -} /* end of mtk_p2p_wext_invitation_status() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief indicate an event to supplicant for device found -* -* \param[in] prGlueInfo Pointer of GLUE_INFO_T -* -* \retval TRUE Success. -* \retval FALSE Failure -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalP2PIndicateFound( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - union iwreq_data evt; - UINT_8 aucBuffer[IW_CUSTOM_MAX]; - - ASSERT(prGlueInfo); - - memset(&evt, 0, sizeof(evt)); - - snprintf(aucBuffer, IW_CUSTOM_MAX-1, "P2P_DVC_FND"); - evt.data.length = strlen(aucBuffer); - - /* indicate IWEVP2PDVCFND event */ - wireless_send_event(prGlueInfo->prP2PInfo->prDevHandler, - IWEVCUSTOM, - &evt, - aucBuffer); - - return FALSE; -} /* end of kalP2PIndicateFound() */ - -int -mtk_p2p_wext_set_network_address ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - //@TODO: invoke wlan_p2p functions -#if 0 - rStatus = kalIoctl(prGlueInfo, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetP2pNetworkAddress, - prKey, - prKey->u4Length, - FALSE, - FALSE, - TRUE, - &u4BufLen); -#endif - - return 0; - -} - -int -mtk_p2p_wext_set_ps_profile ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - //@TODO: invoke wlan_p2p functions -#if 0 - rStatus = kalIoctl(prGlueInfo, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetP2pPowerSaveProfile, - prKey, - prKey->u4Length, - FALSE, - FALSE, - TRUE, - &u4BufLen); -#endif - - return 0; - -} - -int -mtk_p2p_wext_set_pm_param ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - P_ADAPTER_T prAdapter = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prAdapter = prGlueInfo->prAdapter; - ASSERT(prAdapter); - - //@TODO: invoke wlan_p2p functions -#if 0 - rStatus = kalIoctl(prGlueInfo, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetP2pPowerSaveProfile, - prKey, - prKey->u4Length, - FALSE, - FALSE, - TRUE, - &u4BufLen); -#endif - - return 0; - -} - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_SET_INT) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Setting parameters not support. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_start_formation ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - int i4Status = 0; - P_ADAPTER_T prAdapter = (P_ADAPTER_T)NULL; - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; -// struct iw_point *prData = (struct iw_point*)&wrqu->data; - P_IW_P2P_IOCTL_START_FORMATION prIoctlStartFormation = (P_IW_P2P_IOCTL_START_FORMATION)NULL; - - do { - if ((prDev == NULL) || (extra == NULL)) { - ASSERT(FALSE); - i4Status = -EINVAL; - break; - } - - - prGlueInfo = *((P_GLUE_INFO_T *)netdev_priv(prDev)); - prIoctlStartFormation = (P_IW_P2P_IOCTL_START_FORMATION)extra; - - if (prGlueInfo == NULL) { - i4Status = -EINVAL; - break; - } - - - prAdapter = prGlueInfo->prAdapter; - - if (prAdapter == NULL) { - i4Status = -EINVAL; - break; - } - - - } while (FALSE); - - return i4Status; - -} -/* mtk_p2p_wext_start_formation */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_SET_INT) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Setting parameters not support. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_set_int ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - int status = 0; - UINT_32 u4SubCmd = 0; - P_GLUE_INFO_T prGlueInfo = NULL; - UINT_32 index; - INT_32 value; - PUINT_32 pu4IntBuf; - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - P_P2P_FSM_INFO_T prP2pFsmInfo = (P_P2P_FSM_INFO_T)NULL; - UINT_32 u4Leng; - - ASSERT(prDev); - ASSERT(wrqu); - - //printk("mtk_p2p_wext_set_int\n"); - pu4IntBuf = (PUINT_32) extra; - - if (FALSE == GLUE_CHK_PR2(prDev, wrqu)) { - return -EINVAL; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - prP2pSpecificBssInfo = prGlueInfo->prAdapter->rWifiVar.prP2pSpecificBssInfo; - prP2pConnSettings = prGlueInfo->prAdapter->rWifiVar.prP2PConnSettings; - prP2pFsmInfo = prGlueInfo->prAdapter->rWifiVar.prP2pFsmInfo; - - u4SubCmd = (UINT_32) wrqu->mode; - index = pu4IntBuf[1]; - value = pu4IntBuf[2]; - - printk("set parameter, u4SubCmd=%d idx=%d value=%lu\n", (INT_16)u4SubCmd, (INT_16)index, value); - - switch (u4SubCmd) { - case PRIV_CMD_INT_P2P_SET: - switch (index) { - case 0: /* Listen CH */ - { - UINT_8 ucSuggestChnl = 0; - - prP2pConnSettings->ucListenChnl = value; - - // 20110920 - frog: User configurations are placed in ConnSettings. - if (rlmFuncFindAvailableChannel(prGlueInfo->prAdapter, value, &ucSuggestChnl, TRUE, TRUE)) { - prP2pSpecificBssInfo->ucListenChannel = value; - } - else { - prP2pSpecificBssInfo->ucListenChannel = ucSuggestChnl; - } - - - break; - } - case 1: /* P2p mode */ - break; - case 4: /* Noa duration */ - prP2pSpecificBssInfo->rNoaParam.u4NoaDurationMs = value; - // only to apply setting when setting NOA count - //status = mtk_p2p_wext_set_noa_param(prDev, info, wrqu, (char *)&prP2pSpecificBssInfo->rNoaParam); - break; - case 5: /* Noa interval */ - prP2pSpecificBssInfo->rNoaParam.u4NoaIntervalMs = value; - // only to apply setting when setting NOA count - //status = mtk_p2p_wext_set_noa_param(prDev, info, wrqu, (char *)&prP2pSpecificBssInfo->rNoaParam); - break; - case 6: /* Noa count */ - prP2pSpecificBssInfo->rNoaParam.u4NoaCount = value; - status = mtk_p2p_wext_set_noa_param(prDev, info, wrqu, (char *)&prP2pSpecificBssInfo->rNoaParam); - break; - case 100: /* Oper CH */ - // 20110920 - frog: User configurations are placed in ConnSettings. - prP2pConnSettings->ucOperatingChnl = value; - break; - case 101: /* Local config Method, for P2P SDK */ - //prP2pConnSettings->u2LocalConfigMethod; - break; - case 102: /* Sigma P2p reset */ - kalMemZero(prP2pConnSettings->aucTargetDevAddr, MAC_ADDR_LEN); - //prP2pConnSettings->eConnectionPolicy = ENUM_P2P_CONNECTION_POLICY_AUTO; - break; - case 103: /* WPS MODE */ - kalP2PSetWscMode(prGlueInfo, value); - break; - case 104: /* P2p send persence, duration */ - break; - case 105: /* P2p send persence, interval */ - break; - case 106: /* P2P set sleep */ - value = 1; - kalIoctl(prGlueInfo, - wlanoidSetP2pPowerSaveProfile, - &value, - sizeof(value), - FALSE, - FALSE, - TRUE, - TRUE, - &u4Leng); - break; - case 107: /* P2P set opps, CTWindowl */ - prP2pSpecificBssInfo->rOppPsParam.u4CTwindowMs = value; - status = mtk_p2p_wext_set_oppps_param(prDev, info, wrqu, (char *)&prP2pSpecificBssInfo->rOppPsParam); - break; - case 108: /* p2p_set_power_save */ - kalIoctl(prGlueInfo, - wlanoidSetP2pPowerSaveProfile, - &value, - sizeof(value), - FALSE, - FALSE, - TRUE, - TRUE, - &u4Leng); - - break; - - default: - break; - } - break; - default: - break; - } - - return status; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_SET_STRUCT) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_set_struct ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - int status = 0; - UINT_32 u4SubCmd = 0; - P_GLUE_INFO_T prGlueInfo = NULL; - P_IW_P2P_TRANSPORT_STRUCT prP2PReq = NULL; - - ASSERT(prDev); - ASSERT(wrqu); - - if (FALSE == GLUE_CHK_PR2(prDev, wrqu)) { - return -EINVAL; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - u4SubCmd = (UINT_32) wrqu->data.flags; - - kalMemZero(&prGlueInfo->prP2PInfo->aucOidBuf[0], - sizeof(prGlueInfo->prP2PInfo->aucOidBuf)); - - switch (u4SubCmd) { - case PRIV_CMD_OID: - if (copy_from_user(&(prGlueInfo->prP2PInfo->aucOidBuf[0]), - wrqu->data.pointer, - wrqu->data.length)) { - status = -EFAULT; - break; - } - - if (!kalMemCmp(&(prGlueInfo->prP2PInfo->aucOidBuf[0]), extra, wrqu->data.length)) { - printk(KERN_INFO DRV_NAME"extra buffer is valid\n"); - } - else { - printk(KERN_INFO DRV_NAME"extra 0x%p\n", extra); - } - - prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT) (&(prGlueInfo->prP2PInfo->aucOidBuf[0])); - switch(prP2PReq->u4CmdId) { - case P2P_CMD_ID_SEND_SD_RESPONSE: - status = mtk_p2p_wext_send_service_discovery_response(prDev, info, wrqu, (char *)prP2PReq); - break; - - case P2P_CMD_ID_SEND_SD_REQUEST: - status = mtk_p2p_wext_send_service_discovery_request(prDev, info, wrqu, (char *)prP2PReq); - break; - - case P2P_CMD_ID_TERMINATE_SD_PHASE: - status = mtk_p2p_wext_terminate_service_discovery_phase(prDev, info, wrqu, (char *)prP2PReq); - break; - - case P2P_CMD_ID_INVITATION: - if (prP2PReq->inBufferLength == sizeof(IW_P2P_IOCTL_INVITATION_STRUCT)) { -// status = mtk_p2p_wext_invitation_request(prDev, info, wrqu, (char *)(prP2PReq->aucBuffer)); - } - break; - - case P2P_CMD_ID_INVITATION_ABORT: - if (prP2PReq->inBufferLength == sizeof(IW_P2P_IOCTL_ABORT_INVITATION)) { -// status = mtk_p2p_wext_invitation_abort(prDev, info, wrqu, (char *)(prP2PReq->aucBuffer)); - } - break; - - case P2P_CMD_ID_START_FORMATION: - if (prP2PReq->inBufferLength == sizeof(IW_P2P_IOCTL_START_FORMATION)) { - status = mtk_p2p_wext_start_formation(prDev, info, wrqu, (char *)(prP2PReq->aucBuffer)); - } - break; - default: - status = -EOPNOTSUPP; - } - - break; -#if CFG_SUPPORT_ANTI_PIRACY - case PRIV_SEC_CHECK_OID: - if (wrqu->data.length > 256) { - status = -EOPNOTSUPP; - break; - } - if (copy_from_user(&(prGlueInfo->prP2PInfo->aucSecCheck[0]), - wrqu->data.pointer, - wrqu->data.length)) { - status = -EFAULT; - break; - } - - if (!kalMemCmp(&(prGlueInfo->prP2PInfo->aucSecCheck[0]), extra, wrqu->data.length)) { - printk(KERN_INFO DRV_NAME"extra buffer is valid\n"); - } - else { - printk(KERN_INFO DRV_NAME"extra 0x%p\n", extra); - } - prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT) (&(prGlueInfo->prP2PInfo->aucSecCheck[0])); - - switch(prP2PReq->u4CmdId) { - case P2P_CMD_ID_SEC_CHECK: - status = mtk_p2p_wext_set_sec_check_request(prDev, info, wrqu, (char *)prP2PReq); - break; - default: - status = -EOPNOTSUPP; - } - break; -#endif - case PRIV_CMD_P2P_VERSION: - if (copy_from_user(&(prGlueInfo->prP2PInfo->aucOidBuf[0]), - wrqu->data.pointer, - wrqu->data.length)) { - status = -EFAULT; - break; - } - - if (!kalMemCmp(&(prGlueInfo->prP2PInfo->aucOidBuf[0]), extra, wrqu->data.length)) { - printk(KERN_INFO DRV_NAME"extra buffer is valid\n"); - } - else { - printk(KERN_INFO DRV_NAME"extra 0x%p\n", extra); - } - - prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT) (&(prGlueInfo->prP2PInfo->aucOidBuf[0])); - switch (prP2PReq->u4CmdId) { - case P2P_CMD_ID_P2P_VERSION: - status = mtk_p2p_wext_set_p2p_version(prDev, info, wrqu, (char *)prP2PReq); - break; - default: - status = -EOPNOTSUPP; - break; - } - break; - default: - status = -EOPNOTSUPP; - break; - } - - return status; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler (IOC_P2P_GET_STRUCT) -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_get_struct ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - int status = 0; - UINT_32 u4SubCmd = 0; - P_GLUE_INFO_T prGlueInfo = NULL; - P_IW_P2P_TRANSPORT_STRUCT prP2PReq = NULL; - - ASSERT(prDev); - ASSERT(wrqu); - - if (!prDev || !wrqu) { - printk(KERN_INFO DRV_NAME "%s(): invalid param(0x%p, 0x%p)\n", - __func__, - prDev, - wrqu); - return -EINVAL; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - u4SubCmd = (UINT_32) wrqu->data.flags; - - kalMemZero(&(prGlueInfo->prP2PInfo->aucOidBuf[0]), - sizeof(prGlueInfo->prP2PInfo->aucOidBuf)); - - switch (u4SubCmd) { - case PRIV_CMD_OID: - if (copy_from_user(&(prGlueInfo->prP2PInfo->aucOidBuf[0]), - wrqu->data.pointer, - sizeof(IW_P2P_TRANSPORT_STRUCT))) { - printk(KERN_NOTICE "%s() copy_from_user oidBuf fail\n", __func__); - return -EFAULT; - } - - prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT) (&(prGlueInfo->prP2PInfo->aucOidBuf[0])); - - switch(prP2PReq->u4CmdId) { - case P2P_CMD_ID_GET_SD_REQUEST: - status = mtk_p2p_wext_get_service_discovery_request(prDev, info, wrqu, (char *)prP2PReq); - break; - - case P2P_CMD_ID_GET_SD_RESPONSE: - status = mtk_p2p_wext_get_service_discovery_response(prDev, info, wrqu, (char *)prP2PReq); - break; - - case P2P_CMD_ID_INVITATION_INDICATE: - { - status = mtk_p2p_wext_invitation_indicate(prDev, info, wrqu, (char *)(prP2PReq->aucBuffer)); - prP2PReq->outBufferLength = wrqu->data.length; - if (copy_to_user(wrqu->data.pointer, - &(prGlueInfo->prP2PInfo->aucOidBuf[0]), - wrqu->data.length + OFFSET_OF(IW_P2P_TRANSPORT_STRUCT, aucBuffer))) { - printk(KERN_NOTICE "%s() copy_to_user() fail\n", __func__); - return -EIO; - } - else { - return 0; - } - break; - } - case P2P_CMD_ID_INVITATION_STATUS: - { - status = mtk_p2p_wext_invitation_status(prDev, info, wrqu, (char *)(prP2PReq->aucBuffer)); - prP2PReq->outBufferLength = wrqu->data.length; - if (copy_to_user(wrqu->data.pointer, - &(prGlueInfo->prP2PInfo->aucOidBuf[0]), - wrqu->data.length + OFFSET_OF(IW_P2P_TRANSPORT_STRUCT, aucBuffer))) { - printk(KERN_NOTICE "%s() copy_to_user() fail\n", __func__); - return -EIO; - } - else { - return 0; - } - break; - } - case P2P_CMD_ID_GET_CH_LIST: - { - UINT_16 i; - UINT_8 NumOfChannel = 50; - RF_CHANNEL_INFO_T aucChannelList[50]; - UINT_8 ucMaxChannelNum = 50; - PUINT_8 pucChnlList = (PUINT_8)prP2PReq->aucBuffer; - - kalGetChnlList(prGlueInfo, BAND_NULL, ucMaxChannelNum, &NumOfChannel, aucChannelList); - if (NumOfChannel > 50) - NumOfChannel = 50; - prP2PReq->outBufferLength = NumOfChannel; - - for (i=0; iaucBuffer[i] = aucChannelList[i].ucChannelNum; -#else - *pucChnlList = aucChannelList[i].ucChannelNum; - pucChnlList++; -#endif - } - if(copy_to_user(wrqu->data.pointer, - &(prGlueInfo->prP2PInfo->aucOidBuf[0]), - NumOfChannel + OFFSET_OF(IW_P2P_TRANSPORT_STRUCT, aucBuffer))) { - printk(KERN_NOTICE "%s() copy_to_user() fail\n", __func__); - return -EIO; - } - else { - return 0; - } - break; - } - - case P2P_CMD_ID_GET_OP_CH: - { - prP2PReq->inBufferLength = 4; - - status = wlanoidQueryP2pOpChannel(prGlueInfo->prAdapter, - prP2PReq->aucBuffer, - prP2PReq->inBufferLength, - &prP2PReq->outBufferLength); - - if (status == 0) { // WLAN_STATUS_SUCCESS - if (copy_to_user(wrqu->data.pointer, - &(prGlueInfo->prP2PInfo->aucOidBuf[0]), - prP2PReq->outBufferLength + OFFSET_OF(IW_P2P_TRANSPORT_STRUCT, aucBuffer))) { - printk(KERN_NOTICE "%s() copy_to_user() fail\n", __func__); - return -EIO; - } - } - else { - if (copy_to_user(wrqu->data.pointer, - &(prGlueInfo->prP2PInfo->aucOidBuf[0]), - OFFSET_OF(IW_P2P_TRANSPORT_STRUCT, aucBuffer))) { - printk(KERN_NOTICE "%s() copy_to_user() fail\n", __func__); - return -EIO; - } - } - break; - } - - default: - status = -EOPNOTSUPP; - } - - break; -#if CFG_SUPPORT_ANTI_PIRACY - case PRIV_SEC_CHECK_OID: - if (wrqu->data.length > 256) { - status = -EOPNOTSUPP; - break; - } - if (copy_from_user(&(prGlueInfo->prP2PInfo->aucSecCheck[0]), - wrqu->data.pointer, - sizeof(IW_P2P_TRANSPORT_STRUCT))) { - printk(KERN_NOTICE "%s() copy_from_user oidBuf fail\n", __func__); - return -EFAULT; - } - - prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT) (&(prGlueInfo->prP2PInfo->aucSecCheck[0])); - - switch(prP2PReq->u4CmdId) { - case P2P_CMD_ID_SEC_CHECK: - status = mtk_p2p_wext_get_sec_check_response(prDev, info, wrqu, (char *)prP2PReq); - break; - default: - status = -EOPNOTSUPP; - } - break; -#endif - case PRIV_CMD_P2P_VERSION: - if (copy_from_user(&(prGlueInfo->prP2PInfo->aucOidBuf[0]), - wrqu->data.pointer, - sizeof(IW_P2P_TRANSPORT_STRUCT))) { - printk(KERN_NOTICE "%s() copy_from_user oidBuf fail\n", __func__); - return -EFAULT; - } - - prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT) (&(prGlueInfo->prP2PInfo->aucOidBuf[0])); - - switch (prP2PReq->u4CmdId) { - case P2P_CMD_ID_P2P_VERSION: - status = mtk_p2p_wext_get_p2p_version(prDev, info, wrqu, (char *)prP2PReq); - break; - default: - status = -EOPNOTSUPP; - break; - } - - - /* Copy queried data to user. */ - if (status == 0) { // WLAN_STATUS_SUCCESS - if(copy_to_user(wrqu->data.pointer, - &(prGlueInfo->prP2PInfo->aucOidBuf[0]), - prP2PReq->outBufferLength + OFFSET_OF(IW_P2P_TRANSPORT_STRUCT, aucBuffer))) { - printk(KERN_NOTICE "%s() copy_to_user() fail\n", __func__); - return -EIO; - } - } - - else { - if(copy_to_user(wrqu->data.pointer, - &(prGlueInfo->prP2PInfo->aucOidBuf[0]), - OFFSET_OF(IW_P2P_TRANSPORT_STRUCT, aucBuffer))) { - printk(KERN_NOTICE "%s() copy_to_user() fail\n", __func__); - return -EIO; - } - } - - break; - default: - return -EOPNOTSUPP; - } - - return status; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler for -* getting service discovery request frame from driver -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_get_service_discovery_request ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4QueryInfoLen; - P_IW_P2P_TRANSPORT_STRUCT prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT)extra; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - rStatus = kalIoctl(prGlueInfo, - wlanoidGetP2PSDRequest, - prP2PReq->aucBuffer, - prP2PReq->outBufferLength, - TRUE, - FALSE, - TRUE, - TRUE, - &u4QueryInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - else { - prP2PReq->outBufferLength = u4QueryInfoLen; - - if(copy_to_user(wrqu->data.pointer, - &(prGlueInfo->prP2PInfo->aucOidBuf[0]), - u4QueryInfoLen + OFFSET_OF(IW_P2P_TRANSPORT_STRUCT, aucBuffer))) { - printk(KERN_NOTICE "%s() copy_to_user() fail\n", __func__); - return -EIO; - } - else { - return 0; - } - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler for -* getting service discovery response frame from driver -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_get_service_discovery_response ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4QueryInfoLen; - P_IW_P2P_TRANSPORT_STRUCT prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT)extra; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - rStatus = kalIoctl(prGlueInfo, - wlanoidGetP2PSDResponse, - prP2PReq->aucBuffer, - prP2PReq->outBufferLength, - TRUE, - FALSE, - TRUE, - TRUE, - &u4QueryInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - else { - prP2PReq->outBufferLength = u4QueryInfoLen; - - if(copy_to_user(wrqu->data.pointer, - &(prGlueInfo->prP2PInfo->aucOidBuf[0]), - u4QueryInfoLen + OFFSET_OF(IW_P2P_TRANSPORT_STRUCT, aucBuffer))) { - printk(KERN_NOTICE "%s() copy_to_user() fail\n", __func__); - return -EIO; - } - else { - return 0; - } - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler for -* sending service discovery request frame -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_send_service_discovery_request ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4SetInfoLen; - P_IW_P2P_TRANSPORT_STRUCT prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT)extra; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSendP2PSDRequest, - prP2PReq->aucBuffer, - prP2PReq->inBufferLength, - FALSE, - FALSE, - TRUE, - TRUE, - &u4SetInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - else { - return 0; - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler for -* sending service discovery response frame -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_send_service_discovery_response ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4SetInfoLen; - P_IW_P2P_TRANSPORT_STRUCT prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT)extra; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSendP2PSDResponse, - prP2PReq->aucBuffer, - prP2PReq->inBufferLength, - FALSE, - FALSE, - TRUE, - TRUE, - &u4SetInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - else { - return 0; - } -} - -#if CFG_SUPPORT_ANTI_PIRACY -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler for -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_set_sec_check_request ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4SetInfoLen; - P_IW_P2P_TRANSPORT_STRUCT prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT)extra; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetSecCheckRequest, - prP2PReq->aucBuffer, - prP2PReq->inBufferLength, - FALSE, - FALSE, - TRUE, - TRUE, - &u4SetInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - else { - return 0; - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler for -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_get_sec_check_response ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4QueryInfoLen; - P_IW_P2P_TRANSPORT_STRUCT prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT)extra; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - printk("mtk_p2p_wext_get_sec_check_response\n"); - rStatus = kalIoctl(prGlueInfo, - wlanoidGetSecCheckResponse, - prP2PReq->aucBuffer, - prP2PReq->outBufferLength, - TRUE, - FALSE, - TRUE, - TRUE, - &u4QueryInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - else { - prP2PReq->outBufferLength = u4QueryInfoLen; - - if(copy_to_user(wrqu->data.pointer, - prP2PReq->aucBuffer, - u4QueryInfoLen + OFFSET_OF(IW_P2P_TRANSPORT_STRUCT, aucBuffer))) { - printk(KERN_NOTICE "%s() copy_to_user() fail\n", __func__); - return -EIO; - } - else { - return 0; - } - } -} -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler for -* terminating service discovery phase -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_terminate_service_discovery_phase ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4SetInfoLen; - P_IW_P2P_TRANSPORT_STRUCT prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT)extra; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetP2PTerminateSDPhase, - prP2PReq->aucBuffer, - prP2PReq->inBufferLength, - FALSE, - FALSE, - TRUE, - TRUE, - &u4SetInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - else { - return 0; - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler for -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_set_noa_param ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4SetInfoLen; - //P_IW_P2P_TRANSPORT_STRUCT prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT)extra; - P_PARAM_CUSTOM_NOA_PARAM_STRUC_T prNoaParam = (P_PARAM_CUSTOM_NOA_PARAM_STRUC_T)extra; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - printk("mtk_p2p_wext_set_noa_param\n"); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetNoaParam, - prNoaParam, //prP2PReq->aucBuffer, - sizeof(PARAM_CUSTOM_NOA_PARAM_STRUC_T),//prP2PReq->inBufferLength, - FALSE, - FALSE, - TRUE, - TRUE, - &u4SetInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - else { - return 0; - } -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief P2P Private I/O Control handler for -* -* \param[in] prDev Net device requested. -* \param[inout] wrqu Pointer to iwreq_data -* -* \retval 0 Success. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -mtk_p2p_wext_set_oppps_param ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4SetInfoLen; -// P_IW_P2P_TRANSPORT_STRUCT prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT)extra; - P_PARAM_CUSTOM_OPPPS_PARAM_STRUC_T prOppPsParam = (P_PARAM_CUSTOM_OPPPS_PARAM_STRUC_T)extra; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - printk("mtk_p2p_wext_set_oppps_param\n"); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetOppPsParam, - prOppPsParam, //prP2PReq->aucBuffer, - sizeof(PARAM_CUSTOM_OPPPS_PARAM_STRUC_T), //prP2PReq->inBufferLength, - FALSE, - FALSE, - TRUE, - TRUE, - &u4SetInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - else { - return 0; - } -} - - -int -mtk_p2p_wext_set_p2p_version ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - P_GLUE_INFO_T prGlueInfo = NULL; - P_IW_P2P_TRANSPORT_STRUCT prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT)extra; - UINT_32 u4SetInfoLen; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetP2pSupplicantVersion, - prP2PReq->aucBuffer, - prP2PReq->inBufferLength, - FALSE, - FALSE, - TRUE, - TRUE, - &u4SetInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - else { - return rStatus; - } - - -} -/* mtk_p2p_wext_set_p2p_version */ - -int -mtk_p2p_wext_get_p2p_version ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4QueryInfoLen; - P_IW_P2P_TRANSPORT_STRUCT prP2PReq = (P_IW_P2P_TRANSPORT_STRUCT)extra; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryP2pVersion, - prP2PReq->aucBuffer, - prP2PReq->outBufferLength, - TRUE, - FALSE, - TRUE, - TRUE, - &u4QueryInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - else { - return rStatus; - } - - -} /* mtk_p2p_wext_get_p2p_version */ - -#if CFG_SUPPORT_P2P_RSSI_QUERY - -int -mtk_p2p_wext_get_rssi ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4QueryInfoLen; - struct iw_point *prData= (struct iw_point *)&wrqu->data; - UINT_16 u2BufferSize = 0; - P_GLUE_INFO_T prGlueInfo = NULL; - INT_32 i4Rssi; - struct iw_statistics *pStats = NULL; - - ASSERT(prDev); - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - - if (!prGlueInfo) { - rStatus = WLAN_STATUS_FAILURE; - goto stat_out; - } - - pStats = (struct iw_statistics *) (&(prGlueInfo->rP2pIwStats)); - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryP2pRssi, - &i4Rssi, - sizeof(i4Rssi), - TRUE, - TRUE, - TRUE, - TRUE, - &u4QueryInfoLen); - - u2BufferSize = prData->length; - - if (u2BufferSize < sizeof(struct iw_statistics)) { - return -E2BIG; - } - - - if (copy_to_user(prData->pointer, pStats, sizeof(struct iw_statistics))) { - rStatus = WLAN_STATUS_FAILURE; - } - - -stat_out: - - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - else { - return rStatus; - } - -} /* mtk_p2p_wext_get_rssi */ - -struct iw_statistics * -mtk_p2p_wext_get_wireless_stats ( - struct net_device *prDev - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_FAILURE; - P_GLUE_INFO_T prGlueInfo = NULL; - struct iw_statistics *pStats = NULL; - INT_32 i4Rssi; - UINT_32 bufLen = 0; - - prGlueInfo = *((P_GLUE_INFO_T *)netdev_priv(prDev)); - ASSERT(prGlueInfo); - if (!prGlueInfo) { - goto stat_out; - } - - pStats = (struct iw_statistics *) (&(prGlueInfo->rP2pIwStats)); - - if (!prDev || !netif_carrier_ok(prDev)) { - /* network not connected */ - goto stat_out; - } - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryP2pRssi, - &i4Rssi, - sizeof(i4Rssi), - TRUE, - TRUE, - TRUE, - TRUE, - &bufLen); - -stat_out: - return pStats; -} /* mtk_p2p_wext_get_wireless_stats */ - - -#endif /* CFG_SUPPORT_P2P_RSSI_QUERY */ - - -int -mtk_p2p_wext_set_txpow ( - IN struct net_device *prDev, - IN struct iw_request_info *prIwrInfo, - IN OUT union iwreq_data *prTxPow, - IN char *pcExtra - ) -{ - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - P_ADAPTER_T prAdapter = (P_ADAPTER_T)NULL; -#if 0 - P_MSG_P2P_FUNCTION_SWITCH_T prMsgFuncSwitch = (P_MSG_P2P_FUNCTION_SWITCH_T)NULL; -#endif - int i4Ret = 0; - - ASSERT(prDev); - ASSERT(prTxPow); - - do { - if ((!prDev) || (!prTxPow)) { - i4Ret = -EINVAL; - break; - } - - - prGlueInfo = *((P_GLUE_INFO_T *)netdev_priv(prDev)); - - if (!prGlueInfo) { - i4Ret = -EINVAL; - break; - } - - - prAdapter = prGlueInfo->prAdapter; -#if 0 - prMsgFuncSwitch = (P_MSG_P2P_FUNCTION_SWITCH_T)cnmMemAlloc(prAdapter, RAM_TYPE_MSG, sizeof(MSG_P2P_FUNCTION_SWITCH_T)); - if (!prMsgFuncSwitch) { - ASSERT(0); - return -ENOMEM; - } - - prMsgFuncSwitch->rMsgHdr.eMsgId = MID_MNY_P2P_FUN_SWITCH; - - if (prTxPow->disabled) { - /* Dissolve. */ - prMsgFuncSwitch->fgIsFuncOn = FALSE; - } - else { - - /* Re-enable function. */ - prMsgFuncSwitch->fgIsFuncOn = TRUE; - } - - /* 1.3 send message */ - mboxSendMsg(prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T) prMsgFuncSwitch, - MSG_SEND_METHOD_BUF); -#endif - - } while (FALSE); - - return i4Ret; -} /* mtk_p2p_wext_set_txpow */ - - diff --git a/drivers/net/wireless/mt5931/os/linux/gl_p2p_cfg80211.c b/drivers/net/wireless/mt5931/os/linux/gl_p2p_cfg80211.c deleted file mode 100755 index f3488998fbbd..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/gl_p2p_cfg80211.c +++ /dev/null @@ -1,2226 +0,0 @@ -/* -** $Id: @(#) gl_p2p_cfg80211.c@@ -*/ - -/*! \file gl_p2p_cfg80211.c - \brief Main routines of Linux driver interface for Wi-Fi Direct - using cfg80211 interface - - This file contains the main routines of Linux driver for MediaTek Inc. 802.11 - Wireless LAN Adapters. -*/ - -/******************************************************************************* -* Copyright (c) 2007 MediaTek Inc. -* -* All rights reserved. Copying, compilation, modification, distribution -* or any other use whatsoever of this material is strictly prohibited -* except in accordance with a Software License Agreement with -* MediaTek Inc. -******************************************************************************** -*/ - -/******************************************************************************* -* LEGAL DISCLAIMER -* -* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND -* AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK -* SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE -* PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY -* DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT -* LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -* PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE -* ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY -* WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK -* SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY -* WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE -* FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO -* CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. -* -* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE -* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL -* BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT -* ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY -* BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. -* -* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE -* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT -* OF LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING -* THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN -* FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE -* (ICC). -******************************************************************************** -*/ - -/* -** $Log: gl_p2p_cfg80211.c $ -** -** 08 31 2012 yuche.tsai -** [ALPS00349585] [6577JB][WiFi direct][KE]Establish p2p connection while both device have connected to AP previously,one device reboots automatically with KE -** Fix possible KE when concurrent & disconnect. -** -** 08 21 2012 yuche.tsai -** NULL -** Fix compile warning. -** -** 08 20 2012 yuche.tsai -** NULL -** Fix possible KE issue. -** -** 08 17 2012 yuche.tsai -** NULL -** Fix compile warning. -** -** 08 16 2012 yuche.tsai -** NULL -** Fix compile warning. -** -** 08 14 2012 yuche.tsai -** NULL -** Fix p2p bug find on ALPS.JB trunk. -** -** 07 26 2012 yuche.tsai -** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot -** Update driver code of ALPS.JB for hot-spot. -** -** 07 19 2012 yuche.tsai -** NULL -** Code update for JB. - * - * 07 17 2012 yuche.tsai - * NULL - * Fix compile error for JB. - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 09 21 2010 kevin.huang - * [WCXRP00000054] [MT6620 Wi-Fi][Driver] Restructure driver for second Interface - * Isolate P2P related function for Hardware Software Bundle - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 31 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add cfg80211 interface, which is to replace WE, for further extension - * -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -#include "config.h" - -#if CFG_ENABLE_WIFI_DIRECT && CFG_ENABLE_WIFI_DIRECT_CFG_80211 -#include -#include -#include -#include -#include - -#include "precomp.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - - -BOOLEAN -mtk_p2p_cfg80211func_channel_format_switch( - IN struct ieee80211_channel *channel, - IN enum nl80211_channel_type channel_type, - IN P_RF_CHANNEL_INFO_T prRfChnlInfo, - IN P_ENUM_CHNL_EXT_T prChnlSco - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32) -int mtk_p2p_cfg80211_add_key( - struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, - bool pairwise, - const u8 *mac_addr, - struct key_params *params - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - INT_32 i4Rslt = -EINVAL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - P2P_PARAM_KEY_T rKey; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - kalMemZero(&rKey, sizeof(P2P_PARAM_KEY_T)); - - rKey.u4KeyIndex = key_index; - if(mac_addr) { - memcpy(rKey.arBSSID, mac_addr, ETH_ALEN); - if ((rKey.arBSSID[0] == 0x00) && (rKey.arBSSID[1] == 0x00) && (rKey.arBSSID[2] == 0x00) && - (rKey.arBSSID[3] == 0x00) && (rKey.arBSSID[4] == 0x00) && (rKey.arBSSID[5] == 0x00)) { - rKey.arBSSID[0] = 0xff; - rKey.arBSSID[1] = 0xff; - rKey.arBSSID[2] = 0xff; - rKey.arBSSID[3] = 0xff; - rKey.arBSSID[4] = 0xff; - rKey.arBSSID[5] = 0xff; - } - if (rKey.arBSSID[0] != 0xFF) { - rKey.u4KeyIndex |= BIT(31); - if ((rKey.arBSSID[0] != 0x00) || (rKey.arBSSID[1] != 0x00) || (rKey.arBSSID[2] != 0x00) || - (rKey.arBSSID[3] != 0x00) || (rKey.arBSSID[4] != 0x00) || (rKey.arBSSID[5] != 0x00)) - rKey.u4KeyIndex |= BIT(30); - } - else { - rKey.u4KeyIndex |= BIT(31); - } - } - else { - rKey.arBSSID[0] = 0xff; - rKey.arBSSID[1] = 0xff; - rKey.arBSSID[2] = 0xff; - rKey.arBSSID[3] = 0xff; - rKey.arBSSID[4] = 0xff; - rKey.arBSSID[5] = 0xff; - rKey.u4KeyIndex |= BIT(31); //???? - } - if(params->key) - { - //rKey.aucKeyMaterial[0] = kalMemAlloc(params->key_len, VIR_MEM_TYPE); - kalMemCopy(rKey.aucKeyMaterial, params->key, params->key_len); - } - rKey.u4KeyLength = params->key_len; - rKey.u4Length = ((UINT_32)&(((P_P2P_PARAM_KEY_T)0)->aucKeyMaterial)) + rKey.u4KeyLength; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetAddP2PKey, - &rKey, - rKey.u4Length, - FALSE, - FALSE, - TRUE, - TRUE, - &u4BufLen); - if (rStatus == WLAN_STATUS_SUCCESS) - i4Rslt = 0; - - return i4Rslt; -} - - -int mtk_p2p_cfg80211_get_key( - struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, - bool pairwise, - const u8 *mac_addr, - void *cookie, - void (*callback)(void *cookie, struct key_params*) - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - // not implemented yet - - return -EINVAL; -} - -int mtk_p2p_cfg80211_del_key( - struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, - bool pairwise, - const u8 *mac_addr - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - PARAM_REMOVE_KEY_T prRemoveKey; - INT_32 i4Rslt = -EINVAL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - kalMemZero(&prRemoveKey, sizeof(PARAM_REMOVE_KEY_T)); - if(mac_addr) - memcpy(prRemoveKey.arBSSID, mac_addr, PARAM_MAC_ADDR_LEN); - prRemoveKey.u4KeyIndex = key_index; - prRemoveKey.u4Length = sizeof(PARAM_REMOVE_KEY_T); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetRemoveP2PKey, - &prRemoveKey, - prRemoveKey.u4Length, - FALSE, - FALSE, - TRUE, - TRUE, - &u4BufLen); - - if (rStatus == WLAN_STATUS_SUCCESS) - i4Rslt = 0; - - return i4Rslt; -} - - -int -mtk_p2p_cfg80211_set_default_key ( - struct wiphy *wiphy, - struct net_device *netdev, - u8 key_index, - bool unicast, - bool multicast - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - // not implemented yet - - return -EINVAL; -} - -int mtk_p2p_cfg80211_get_station( - struct wiphy *wiphy, - struct net_device *ndev, - u8 *mac, - struct station_info *sinfo - ) -{ - INT_32 i4RetRslt = -EINVAL; - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - P_GL_P2P_INFO_T prP2pGlueInfo = (P_GL_P2P_INFO_T)NULL; - P2P_STATION_INFO_T rP2pStaInfo; - - ASSERT(wiphy); - - do { - if ((wiphy == NULL) || - (ndev == NULL) || - (sinfo == NULL) || - (mac == NULL)) { - break; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_get_station\n")); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - prP2pGlueInfo = prGlueInfo->prP2PInfo; - - sinfo->filled = 0; - - /* Get station information. */ - /* 1. Inactive time? */ - p2pFuncGetStationInfo(prGlueInfo->prAdapter, - mac, - &rP2pStaInfo); - - /* Inactive time. */ - sinfo->filled |= STATION_INFO_INACTIVE_TIME; - sinfo->inactive_time = rP2pStaInfo.u4InactiveTime; - sinfo->generation = prP2pGlueInfo->i4Generation; - - i4RetRslt = 0; - } while (FALSE); - - return i4RetRslt; -} - -int -mtk_p2p_cfg80211_scan ( - struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_scan_request *request - ) -{ - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - P_GL_P2P_INFO_T prP2pGlueInfo = (P_GL_P2P_INFO_T)NULL; - P_MSG_P2P_SCAN_REQUEST_T prMsgScanRequest = (P_MSG_P2P_SCAN_REQUEST_T)NULL; - UINT_32 u4MsgSize = 0, u4Idx = 0; - INT_32 i4RetRslt = -EINVAL; - P_RF_CHANNEL_INFO_T prRfChannelInfo = (P_RF_CHANNEL_INFO_T)NULL; - P_P2P_SSID_STRUCT_T prSsidStruct = (P_P2P_SSID_STRUCT_T)NULL; - struct ieee80211_channel *prChannel = NULL; - struct cfg80211_ssid *prSsid = NULL; - - /* [---------Channel---------] [---------SSID---------][---------IE---------] */ - - - do { - if ((wiphy == NULL) || (request == NULL)) { - break; - } - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - prP2pGlueInfo = prGlueInfo->prP2PInfo; - - if (prP2pGlueInfo == NULL) { - ASSERT(FALSE); - break; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_scan.\n")); - - - if (prP2pGlueInfo->prScanRequest != NULL) { - /* There have been a scan request on-going processing. */ - DBGLOG(P2P, TRACE, ("There have been a scan request on-going processing.\n")); - break; - } - - prP2pGlueInfo->prScanRequest = request; - - /* Should find out why the n_channels so many? */ - if (request->n_channels > MAXIMUM_OPERATION_CHANNEL_LIST) { - request->n_channels = MAXIMUM_OPERATION_CHANNEL_LIST; - DBGLOG(P2P, TRACE, ("Channel list exceed the maximun support.\n")); - } - - u4MsgSize = sizeof(MSG_P2P_SCAN_REQUEST_T) + - (request->n_channels * sizeof(RF_CHANNEL_INFO_T)) + - (request->n_ssids * sizeof(PARAM_SSID_T)) + - request->ie_len; - - prMsgScanRequest = cnmMemAlloc(prGlueInfo->prAdapter, RAM_TYPE_MSG, u4MsgSize); - - if (prMsgScanRequest == NULL) { - ASSERT(FALSE); - i4RetRslt = -ENOMEM; - break; - } - - DBGLOG(P2P, TRACE, ("Generating scan request message.\n")); - - prMsgScanRequest->rMsgHdr.eMsgId = MID_MNY_P2P_DEVICE_DISCOVERY; - - - - DBGLOG(P2P, TRACE, ("Requesting channel number:%d.\n", request->n_channels)); - - for (u4Idx = 0; u4Idx < request->n_channels; u4Idx++) { - /* Translate Freq from MHz to channel number. */ - prRfChannelInfo = &(prMsgScanRequest->arChannelListInfo[u4Idx]); - prChannel = request->channels[u4Idx]; - - prRfChannelInfo->ucChannelNum = nicFreq2ChannelNum(prChannel->center_freq * 1000); - DBGLOG(P2P, TRACE, ("Scanning Channel:%d, freq: %d\n", - prRfChannelInfo->ucChannelNum, - prChannel->center_freq)); - switch (prChannel->band) { - case IEEE80211_BAND_2GHZ: - prRfChannelInfo->eBand = BAND_2G4; - break; - case IEEE80211_BAND_5GHZ: - prRfChannelInfo->eBand = BAND_5G; - break; - default: - DBGLOG(P2P, TRACE, ("UNKNOWN Band info from supplicant\n")); - prRfChannelInfo->eBand = BAND_NULL; - break; - } - - /* Iteration. */ - prRfChannelInfo++; - } - prMsgScanRequest->u4NumChannel = request->n_channels; - - DBGLOG(P2P, TRACE, ("Finish channel list.\n")); - - /* SSID */ - prSsid = request->ssids; - prSsidStruct = (P_P2P_SSID_STRUCT_T)prRfChannelInfo; - if (request->n_ssids) { - ASSERT(prSsidStruct == &(prMsgScanRequest->arChannelListInfo[u4Idx])); - prMsgScanRequest->prSSID = prSsidStruct; - } - - for (u4Idx = 0; u4Idx < request->n_ssids; u4Idx++) { - COPY_SSID(prSsidStruct->aucSsid, - prSsidStruct->ucSsidLen, - request->ssids->ssid, - request->ssids->ssid_len); - - prSsidStruct++; - prSsid++; - } - - prMsgScanRequest->i4SsidNum = request->n_ssids; - - DBGLOG(P2P, TRACE, ("Finish SSID list:%d.\n", request->n_ssids)); - - /* IE BUFFERS */ - prMsgScanRequest->pucIEBuf = (PUINT_8)prSsidStruct; - if (request->ie_len) { - kalMemCopy(prMsgScanRequest->pucIEBuf, request->ie, request->ie_len); - prMsgScanRequest->u4IELen = request->ie_len; - } - - DBGLOG(P2P, TRACE, ("Finish IE Buffer.\n")); - - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prMsgScanRequest, - MSG_SEND_METHOD_BUF); - - i4RetRslt = 0; - } while (FALSE); - - return i4RetRslt; -} /* mtk_p2p_cfg80211_scan */ - -int mtk_p2p_cfg80211_set_wiphy_params( - struct wiphy *wiphy, - u32 changed - ) -{ - INT_32 i4Rslt = -EINVAL; - P_GLUE_INFO_T prGlueInfo = NULL; - - - do { - if (wiphy == NULL) { - break; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_set_wiphy_params\n")); - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - if (changed & WIPHY_PARAM_RETRY_SHORT) { - // TODO: - DBGLOG(P2P, TRACE, ("The RETRY short param is changed.\n")); - } - - if (changed & WIPHY_PARAM_RETRY_LONG) { - // TODO: - DBGLOG(P2P, TRACE, ("The RETRY long param is changed.\n")); - } - - - if (changed & WIPHY_PARAM_FRAG_THRESHOLD) { - // TODO: - DBGLOG(P2P, TRACE, ("The RETRY fragmentation threshold is changed.\n")); - } - - if (changed & WIPHY_PARAM_RTS_THRESHOLD) { - // TODO: - DBGLOG(P2P, TRACE, ("The RETRY RTS threshold is changed.\n")); - } - - if (changed & WIPHY_PARAM_COVERAGE_CLASS) { - // TODO: - DBGLOG(P2P, TRACE, ("The coverage class is changed???\n")); - } - - i4Rslt = 0; - } while (FALSE); - - - - - return i4Rslt; -} /* mtk_p2p_cfg80211_set_wiphy_params */ - - - -int -mtk_p2p_cfg80211_join_ibss( - struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_ibss_params *params - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - // not implemented yet - - return -EINVAL; -} - -int -mtk_p2p_cfg80211_leave_ibss( - struct wiphy *wiphy, - struct net_device *dev - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - // not implemented yet - - return -EINVAL; -} - -int -mtk_p2p_cfg80211_set_txpower( - struct wiphy *wiphy, - enum nl80211_tx_power_setting type, - int mbm - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - // not implemented yet - - return -EINVAL; -} - -int -mtk_p2p_cfg80211_get_txpower( - struct wiphy *wiphy, - int *dbm - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - // not implemented yet - - return -EINVAL; -} - -int -mtk_p2p_cfg80211_set_power_mgmt( - struct wiphy *wiphy, - struct net_device *dev, - bool enabled, - int timeout - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - // not implemented yet - // TODO: for JB. - - return -EINVAL; -} - -//&&&&&&&&&&&&&&&&&&&&&&&&&& Add for ICS Wi-Fi Direct Support. &&&&&&&&&&&&&&&&&&&&&&& -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) -int -mtk_p2p_cfg80211_start_ap ( - struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_ap_settings *settings - ) -{ - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - INT_32 i4Rslt = -EINVAL; - P_MSG_P2P_BEACON_UPDATE_T prP2pBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)NULL; - P_MSG_P2P_START_AP_T prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)NULL; - PUINT_8 pucBuffer = (PUINT_8)NULL; -// P_IE_SSID_T prSsidIE = (P_IE_SSID_T)NULL; - - do { - if ((wiphy == NULL) || (settings == NULL)) { - break; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_start_ap.\n")); - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - prP2pBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)cnmMemAlloc( - prGlueInfo->prAdapter, - RAM_TYPE_MSG, - (sizeof(MSG_P2P_BEACON_UPDATE_T) + settings->beacon.head_len + settings->beacon.tail_len)); - - if (prP2pBcnUpdateMsg == NULL) { - ASSERT(FALSE); - i4Rslt = -ENOMEM; - break; - } - - - prP2pBcnUpdateMsg->rMsgHdr.eMsgId = MID_MNY_P2P_BEACON_UPDATE; - pucBuffer = prP2pBcnUpdateMsg->aucBuffer; - - if (settings->beacon.head_len != 0) { - kalMemCopy(pucBuffer, settings->beacon.head, settings->beacon.head_len); - - prP2pBcnUpdateMsg->u4BcnHdrLen = settings->beacon.head_len; - - prP2pBcnUpdateMsg->pucBcnHdr = pucBuffer; - - pucBuffer = (PUINT_8)((UINT_32)pucBuffer + (UINT_32)settings->beacon.head_len); - } - else { - prP2pBcnUpdateMsg->u4BcnHdrLen = 0; - - prP2pBcnUpdateMsg->pucBcnHdr = NULL; - } - - if (settings->beacon.tail_len != 0) { - UINT_8 ucLen = settings->beacon.tail_len; - - prP2pBcnUpdateMsg->pucBcnBody = pucBuffer; - - /*Add TIM IE*/ - // IEEE 802.11 2007 - 7.3.2.6 - TIM_IE(pucBuffer)->ucId = ELEM_ID_TIM; - TIM_IE(pucBuffer)->ucLength = (3 + MAX_LEN_TIM_PARTIAL_BMP)/*((u4N2 - u4N1) + 4)*/; // NOTE: fixed PVB length (AID is allocated from 8 ~ 15 only) - TIM_IE(pucBuffer)->ucDTIMCount = 0/*prBssInfo->ucDTIMCount*/; // will be overwrite by FW - TIM_IE(pucBuffer)->ucDTIMPeriod = 1; - TIM_IE(pucBuffer)->ucBitmapControl = 0/*ucBitmapControl | (UINT_8)u4N1*/; // will be overwrite by FW - ucLen += IE_SIZE(pucBuffer); - pucBuffer += IE_SIZE(pucBuffer); - - kalMemCopy(pucBuffer, settings->beacon.tail, settings->beacon.tail_len); - - prP2pBcnUpdateMsg->u4BcnBodyLen = ucLen; - } - else { - prP2pBcnUpdateMsg->u4BcnBodyLen = 0; - - prP2pBcnUpdateMsg->pucBcnBody = NULL; - } - - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prP2pBcnUpdateMsg, - MSG_SEND_METHOD_BUF); - - - prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)cnmMemAlloc( - prGlueInfo->prAdapter, - RAM_TYPE_MSG, - sizeof(MSG_P2P_START_AP_T)); - - if (prP2pStartAPMsg == NULL) { - ASSERT(FALSE); - i4Rslt = -ENOMEM; - break; - } - - prP2pStartAPMsg->rMsgHdr.eMsgId = MID_MNY_P2P_START_AP; - - prP2pStartAPMsg->fgIsPrivacy = settings->privacy; - - prP2pStartAPMsg->u4BcnInterval = settings->beacon_interval; - - prP2pStartAPMsg->u4DtimPeriod = settings->dtim_period; - - /* Copy NO SSID. */ - prP2pStartAPMsg->ucHiddenSsidType = settings->hidden_ssid; - - COPY_SSID(prP2pStartAPMsg->aucSsid, - prP2pStartAPMsg->u2SsidLen, - settings->ssid, - settings->ssid_len); - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prP2pStartAPMsg, - MSG_SEND_METHOD_BUF); - - i4Rslt = 0; - - } while (FALSE); - - return i4Rslt; - - -///////////////////////// - /** - * struct cfg80211_ap_settings - AP configuration - * - * Used to configure an AP interface. - * - * @beacon: beacon data - * @beacon_interval: beacon interval - * @dtim_period: DTIM period - * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from - * user space) - * @ssid_len: length of @ssid - * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames - * @crypto: crypto settings - * @privacy: the BSS uses privacy - * @auth_type: Authentication type (algorithm) - * @inactivity_timeout: time in seconds to determine station's inactivity. - */ -// struct cfg80211_ap_settings { -// struct cfg80211_beacon_data beacon; -// -// int beacon_interval, dtim_period; -// const u8 *ssid; -// size_t ssid_len; -// enum nl80211_hidden_ssid hidden_ssid; -// struct cfg80211_crypto_settings crypto; -// bool privacy; -// enum nl80211_auth_type auth_type; -// int inactivity_timeout; -// }; -//////////////////// - - return i4Rslt; -} /* mtk_p2p_cfg80211_start_ap */ - - -int -mtk_p2p_cfg80211_change_beacon ( - struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_beacon_data *info - ) -{ - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - INT_32 i4Rslt = -EINVAL; - P_MSG_P2P_BEACON_UPDATE_T prP2pBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)NULL; - PUINT_8 pucBuffer = (PUINT_8)NULL; - - do { - if ((wiphy == NULL) || (info == NULL)) { - break; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_change_beacon.\n")); - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - prP2pBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)cnmMemAlloc( - prGlueInfo->prAdapter, - RAM_TYPE_MSG, - (sizeof(MSG_P2P_BEACON_UPDATE_T) + info->head_len + info->tail_len)); - - - if (prP2pBcnUpdateMsg == NULL) { - ASSERT(FALSE); - i4Rslt = -ENOMEM; - break; - } - - prP2pBcnUpdateMsg->rMsgHdr.eMsgId = MID_MNY_P2P_BEACON_UPDATE; - pucBuffer = prP2pBcnUpdateMsg->aucBuffer; - - if (info->head_len != 0) { - kalMemCopy(pucBuffer, info->head, info->head_len); - - prP2pBcnUpdateMsg->u4BcnHdrLen = info->head_len; - - prP2pBcnUpdateMsg->pucBcnHdr = pucBuffer; - - pucBuffer = (PUINT_8)((UINT_32)pucBuffer + (UINT_32)info->head_len); - } - else { - prP2pBcnUpdateMsg->u4BcnHdrLen = 0; - - prP2pBcnUpdateMsg->pucBcnHdr = NULL; - } - - if (info->tail_len != 0) { - UINT_8 ucLen = info->tail_len; - - prP2pBcnUpdateMsg->pucBcnBody = pucBuffer; - - /*Add TIM IE*/ - // IEEE 802.11 2007 - 7.3.2.6 - TIM_IE(pucBuffer)->ucId = ELEM_ID_TIM; - TIM_IE(pucBuffer)->ucLength = (3 + MAX_LEN_TIM_PARTIAL_BMP)/*((u4N2 - u4N1) + 4)*/; // NOTE: fixed PVB length (AID is allocated from 8 ~ 15 only) - TIM_IE(pucBuffer)->ucDTIMCount = 0/*prBssInfo->ucDTIMCount*/; // will be overwrite by FW - TIM_IE(pucBuffer)->ucDTIMPeriod = 1; - TIM_IE(pucBuffer)->ucBitmapControl = 0/*ucBitmapControl | (UINT_8)u4N1*/; // will be overwrite by FW - ucLen += IE_SIZE(pucBuffer); - pucBuffer += IE_SIZE(pucBuffer); - - kalMemCopy(pucBuffer, info->tail, info->tail_len); - - prP2pBcnUpdateMsg->u4BcnBodyLen = ucLen; - } - else { - prP2pBcnUpdateMsg->u4BcnBodyLen = 0; - - prP2pBcnUpdateMsg->pucBcnBody = NULL; - } - - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prP2pBcnUpdateMsg, - MSG_SEND_METHOD_BUF); - -//////////////////////////// -/** - * struct cfg80211_beacon_data - beacon data - * @head: head portion of beacon (before TIM IE) - * or %NULL if not changed - * @tail: tail portion of beacon (after TIM IE) - * or %NULL if not changed - * @head_len: length of @head - * @tail_len: length of @tail - * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL - * @beacon_ies_len: length of beacon_ies in octets - * @proberesp_ies: extra information element(s) to add into Probe Response - * frames or %NULL - * @proberesp_ies_len: length of proberesp_ies in octets - * @assocresp_ies: extra information element(s) to add into (Re)Association - * Response frames or %NULL - * @assocresp_ies_len: length of assocresp_ies in octets - * @probe_resp_len: length of probe response template (@probe_resp) - * @probe_resp: probe response template (AP mode only) - */ -//struct cfg80211_beacon_data { -// const u8 *head, *tail; -// const u8 *beacon_ies; -// const u8 *proberesp_ies; -// const u8 *assocresp_ies; -// const u8 *probe_resp; - -// size_t head_len, tail_len; -// size_t beacon_ies_len; -// size_t proberesp_ies_len; -// size_t assocresp_ies_len; -// size_t probe_resp_len; -//}; - -//////////////////////////// - - } while (FALSE); - - return i4Rslt; -} /* mtk_p2p_cfg80211_change_beacon */ - -#else -int -mtk_p2p_cfg80211_add_set_beacon ( - struct wiphy *wiphy, - struct net_device *dev, - struct beacon_parameters *info - ) -{ - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - INT_32 i4Rslt = -EINVAL; - P_MSG_P2P_BEACON_UPDATE_T prP2pBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)NULL; - P_MSG_P2P_START_AP_T prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)NULL; - PUINT_8 pucBuffer = (PUINT_8)NULL; - P_IE_SSID_T prSsidIE = (P_IE_SSID_T)NULL; - - do { - if ((wiphy == NULL) || (info == NULL)) { - break; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_add_set_beacon.\n")); - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - prP2pBcnUpdateMsg = (P_MSG_P2P_BEACON_UPDATE_T)cnmMemAlloc( - prGlueInfo->prAdapter, - RAM_TYPE_MSG, - (sizeof(MSG_P2P_BEACON_UPDATE_T) + info->head_len + info->tail_len)); - - if (prP2pBcnUpdateMsg == NULL) { - ASSERT(FALSE); - i4Rslt = -ENOMEM; - break; - } - - - prP2pBcnUpdateMsg->rMsgHdr.eMsgId = MID_MNY_P2P_BEACON_UPDATE; - pucBuffer = prP2pBcnUpdateMsg->aucBuffer; - - if (info->head_len != 0) { - kalMemCopy(pucBuffer, info->head, info->head_len); - - prP2pBcnUpdateMsg->u4BcnHdrLen = info->head_len; - - prP2pBcnUpdateMsg->pucBcnHdr = pucBuffer; - - pucBuffer = (PUINT_8)((UINT_32)pucBuffer + (UINT_32)info->head_len); - } - else { - prP2pBcnUpdateMsg->u4BcnHdrLen = 0; - - prP2pBcnUpdateMsg->pucBcnHdr = NULL; - } - - if (info->tail_len != 0) { - UINT_8 ucLen = info->tail_len; - - prP2pBcnUpdateMsg->pucBcnBody = pucBuffer; - - /*Add TIM IE*/ - // IEEE 802.11 2007 - 7.3.2.6 - TIM_IE(pucBuffer)->ucId = ELEM_ID_TIM; - TIM_IE(pucBuffer)->ucLength = (3 + MAX_LEN_TIM_PARTIAL_BMP)/*((u4N2 - u4N1) + 4)*/; // NOTE: fixed PVB length (AID is allocated from 8 ~ 15 only) - TIM_IE(pucBuffer)->ucDTIMCount = 0/*prBssInfo->ucDTIMCount*/; // will be overwrite by FW - TIM_IE(pucBuffer)->ucDTIMPeriod = 1; - TIM_IE(pucBuffer)->ucBitmapControl = 0/*ucBitmapControl | (UINT_8)u4N1*/; // will be overwrite by FW - ucLen += IE_SIZE(pucBuffer); - pucBuffer += IE_SIZE(pucBuffer); - - kalMemCopy(pucBuffer, info->tail, info->tail_len); - - prP2pBcnUpdateMsg->u4BcnBodyLen = ucLen; - } - else { - prP2pBcnUpdateMsg->u4BcnBodyLen = 0; - - prP2pBcnUpdateMsg->pucBcnBody = NULL; - } - - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prP2pBcnUpdateMsg, - MSG_SEND_METHOD_BUF); - - - prP2pStartAPMsg = (P_MSG_P2P_START_AP_T)cnmMemAlloc( - prGlueInfo->prAdapter, - RAM_TYPE_MSG, - sizeof(MSG_P2P_START_AP_T)); - - if (prP2pStartAPMsg == NULL) { - ASSERT(FALSE); - i4Rslt = -ENOMEM; - break; - } - - prP2pStartAPMsg->rMsgHdr.eMsgId = MID_MNY_P2P_START_AP; - - prP2pStartAPMsg->fgIsPrivacy = FALSE; - - prP2pStartAPMsg->u4BcnInterval = info->interval; - - prP2pStartAPMsg->u4DtimPeriod = info->dtim_period; - - /* Copy NO SSID. */ - prP2pStartAPMsg->ucHiddenSsidType = ENUM_HIDDEN_SSID_NONE; - -#if 0 - if (info->head_len > OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem)) { - P_WLAN_BEACON_FRAME_T prWlanBcnFrame = info->head; - - prSsidIE = (P_IE_HDR_T)p2pFuncGetSpecIE(prGlueInfo->prAdapter, - (PUINT_8)prWlanBcnFrame->aucInfoElem, - (info->head_len - OFFSET_OF(WLAN_BEACON_FRAME_T, aucInfoElem)), - ELEM_ID_SSID, - NULL); - - kalMemCopy(prP2pStartAPMsg->aucSsid, SSID_IE(prSsidIE)->aucSSID, IE_LEN(prSsidIE)); - - } -#endif - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prP2pStartAPMsg, - MSG_SEND_METHOD_BUF); - - i4Rslt = 0; - - } while (FALSE); - - return i4Rslt; -} -/* mtk_p2p_cfg80211_add_set_beacon */ -#endif - -int -mtk_p2p_cfg80211_stop_ap ( - struct wiphy *wiphy, - struct net_device *dev - ) -{ - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - INT_32 i4Rslt = -EINVAL; - P_MSG_P2P_SWITCH_OP_MODE_T prP2pSwitchMode = (P_MSG_P2P_SWITCH_OP_MODE_T)NULL; - - do { - if (wiphy == NULL) { - break; - } - - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_stop_ap.\n")); - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - // Switch OP MOde. - prP2pSwitchMode = cnmMemAlloc(prGlueInfo->prAdapter, RAM_TYPE_MSG, sizeof(MSG_P2P_SWITCH_OP_MODE_T)); - - if (prP2pSwitchMode == NULL) { - ASSERT(FALSE); - i4Rslt = -ENOMEM; - break; - } - - prP2pSwitchMode->rMsgHdr.eMsgId = MID_MNY_P2P_STOP_AP; - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prP2pSwitchMode, - MSG_SEND_METHOD_BUF); - - i4Rslt = 0; - } while (FALSE); - - - return i4Rslt; -} /* mtk_p2p_cfg80211_stop_ap */ - -// TODO: -int -mtk_p2p_cfg80211_deauth ( - struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_deauth_request *req -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) - , void *cookie -#endif - ) -{ - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - // not implemented yet - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_deauth.\n")); - - return -EINVAL; -} /* mtk_p2p_cfg80211_deauth */ - - -// TODO: -int -mtk_p2p_cfg80211_disassoc ( - struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_disassoc_request *req -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) - , void *cookie -#endif - ) -{ - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_disassoc.\n")); - - // not implemented yet - - return -EINVAL; -} /* mtk_p2p_cfg80211_disassoc */ - - -int -mtk_p2p_cfg80211_remain_on_channel ( - struct wiphy *wiphy, - struct net_device *dev, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - unsigned int duration, - u64 *cookie - ) -{ - INT_32 i4Rslt = -EINVAL; - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - P_GL_P2P_INFO_T prGlueP2pInfo = (P_GL_P2P_INFO_T)NULL; - P_MSG_P2P_CHNL_REQUEST_T prMsgChnlReq = (P_MSG_P2P_CHNL_REQUEST_T)NULL; - - - do { - if ((wiphy == NULL) || - (dev == NULL) || - (chan == NULL) || - (cookie == NULL)) { - break; - } - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - prGlueP2pInfo = prGlueInfo->prP2PInfo; - - *cookie = prGlueP2pInfo->u8Cookie++; - - prMsgChnlReq = cnmMemAlloc(prGlueInfo->prAdapter, RAM_TYPE_MSG, sizeof(MSG_P2P_CHNL_REQUEST_T)); - - if (prMsgChnlReq == NULL) { - ASSERT(FALSE); - i4Rslt = -ENOMEM; - break; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_remain_on_channel\n")); - - prMsgChnlReq->rMsgHdr.eMsgId = MID_MNY_P2P_CHNL_REQ; - prMsgChnlReq->u8Cookie = *cookie; - prMsgChnlReq->u4Duration = duration; - - - mtk_p2p_cfg80211func_channel_format_switch(chan, - channel_type, - &prMsgChnlReq->rChannelInfo, - &prMsgChnlReq->eChnlSco); - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prMsgChnlReq, - MSG_SEND_METHOD_BUF); - - i4Rslt = 0; - - i4Rslt = 0; - } while (FALSE); - - - return i4Rslt; -} -/* mtk_p2p_cfg80211_remain_on_channel */ - - -int -mtk_p2p_cfg80211_cancel_remain_on_channel ( - struct wiphy *wiphy, - struct net_device *dev, - u64 cookie - ) -{ - INT_32 i4Rslt = -EINVAL; - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - P_MSG_P2P_CHNL_ABORT_T prMsgChnlAbort = (P_MSG_P2P_CHNL_ABORT_T)NULL; - - do { - if ((wiphy == NULL) || (dev == NULL)) { - break; - } - - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - prMsgChnlAbort = cnmMemAlloc(prGlueInfo->prAdapter, RAM_TYPE_MSG, sizeof(MSG_P2P_CHNL_ABORT_T)); - - if (prMsgChnlAbort == NULL) { - ASSERT(FALSE); - i4Rslt = -ENOMEM; - break; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_cancel_remain_on_channel\n")); - - prMsgChnlAbort->rMsgHdr.eMsgId = MID_MNY_P2P_CHNL_ABORT; - prMsgChnlAbort->u8Cookie = cookie; - - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prMsgChnlAbort, - MSG_SEND_METHOD_BUF); - - i4Rslt = 0; - } while (FALSE); - - return i4Rslt; -} /* mtk_p2p_cfg80211_cancel_remain_on_channel */ - -int -mtk_p2p_cfg80211_mgmt_tx ( - struct wiphy *wiphy, struct net_device *dev, - struct ieee80211_channel *chan, bool offchan, - enum nl80211_channel_type channel_type, - bool channel_type_valid, unsigned int wait, - const u8 *buf, - size_t len, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - bool no_cck, - bool dont_wait_for_ack, -#endif - u64 *cookie - ) -{ - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - P_GL_P2P_INFO_T prGlueP2pInfo = (P_GL_P2P_INFO_T)NULL; - INT_32 i4Rslt = -EINVAL; - P_MSG_P2P_MGMT_TX_REQUEST_T prMsgTxReq = (P_MSG_P2P_MGMT_TX_REQUEST_T)NULL; - P_MSDU_INFO_T prMgmtFrame = (P_MSDU_INFO_T)NULL; - PUINT_8 pucFrameBuf = (PUINT_8)NULL; - - do { - if ((wiphy == NULL) || - (buf == NULL) || - (len == 0) || - (dev == NULL) || - (cookie == NULL)) { - break; - } - - //DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_mgmt_tx\n")); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - prGlueP2pInfo = prGlueInfo->prP2PInfo; - - *cookie = prGlueP2pInfo->u8Cookie++; - - /* Channel & Channel Type & Wait time are ignored. */ - prMsgTxReq = cnmMemAlloc(prGlueInfo->prAdapter, RAM_TYPE_MSG, sizeof(MSG_P2P_MGMT_TX_REQUEST_T)); - - if (prMsgTxReq == NULL) { - ASSERT(FALSE); - i4Rslt = -ENOMEM; - break; - } - - prMsgTxReq->fgNoneCckRate = FALSE; - prMsgTxReq->fgIsWaitRsp = TRUE; - - prMgmtFrame = cnmMgtPktAlloc(prGlueInfo->prAdapter, (UINT_32)(len + MAC_TX_RESERVED_FIELD)); - - if ((prMsgTxReq->prMgmtMsduInfo = prMgmtFrame) == NULL) { - ASSERT(FALSE); - i4Rslt = -ENOMEM; - break; - } - - prMsgTxReq->u8Cookie = *cookie; - prMsgTxReq->rMsgHdr.eMsgId = MID_MNY_P2P_MGMT_TX; - - pucFrameBuf = (PUINT_8)((UINT_32)prMgmtFrame->prPacket + MAC_TX_RESERVED_FIELD); - - kalMemCopy(pucFrameBuf, buf, len); - - prMgmtFrame->u2FrameLength = len; - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prMsgTxReq, - MSG_SEND_METHOD_BUF); - - i4Rslt = 0; - } while (FALSE); - - if ((i4Rslt != 0) && (prMsgTxReq != NULL)) { - if (prMsgTxReq->prMgmtMsduInfo != NULL) { - cnmMgtPktFree(prGlueInfo->prAdapter, prMsgTxReq->prMgmtMsduInfo); - } - - cnmMemFree(prGlueInfo->prAdapter, prMsgTxReq); - } - - return i4Rslt; -} /* mtk_p2p_cfg80211_mgmt_tx */ - - - -int -mtk_p2p_cfg80211_change_bss ( - struct wiphy *wiphy, - struct net_device *dev, - struct bss_parameters *params - ) -{ - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - INT_32 i4Rslt = -EINVAL; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - - switch (params->use_cts_prot) { - case -1: - DBGLOG(P2P, TRACE, ("CTS protection no change\n")); - break; - case 0: - DBGLOG(P2P, TRACE, ("CTS protection disable.\n")); - break; - case 1: - DBGLOG(P2P, TRACE, ("CTS protection enable\n")); - break; - default: - DBGLOG(P2P, TRACE, ("CTS protection unknown\n")); - break; - } - - - - switch (params->use_short_preamble) { - case -1: - DBGLOG(P2P, TRACE, ("Short prreamble no change\n")); - break; - case 0: - DBGLOG(P2P, TRACE, ("Short prreamble disable.\n")); - break; - case 1: - DBGLOG(P2P, TRACE, ("Short prreamble enable\n")); - break; - default: - DBGLOG(P2P, TRACE, ("Short prreamble unknown\n")); - break; - } - - - -#if 0 - // not implemented yet - p2pFuncChangeBssParam(prGlueInfo->prAdapter, - prBssInfo->fgIsProtection, - prBssInfo->fgIsShortPreambleAllowed, - prBssInfo->fgUseShortSlotTime, - // Basic rates - // basic rates len - // ap isolate - // ht opmode. - ); -#else - i4Rslt = 0; -#endif - - return i4Rslt; -} /* mtk_p2p_cfg80211_change_bss */ - - - -int -mtk_p2p_cfg80211_del_station ( - struct wiphy *wiphy, - struct net_device *dev, - u8 *mac - ) -{ - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - INT_32 i4Rslt = -EINVAL; - P_MSG_P2P_CONNECTION_ABORT_T prDisconnectMsg = (P_MSG_P2P_CONNECTION_ABORT_T)NULL; - UINT_8 aucBcMac[] = BC_MAC_ADDR; - - - do { - if ((wiphy == NULL) || - (dev == NULL)) { - break; - } - - if (mac == NULL) { - mac = aucBcMac; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_del_station.\n")); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - //prDisconnectMsg = (P_MSG_P2P_CONNECTION_ABORT_T)kalMemAlloc(sizeof(MSG_P2P_CONNECTION_ABORT_T), VIR_MEM_TYPE); - prDisconnectMsg = (P_MSG_P2P_CONNECTION_ABORT_T)cnmMemAlloc(prGlueInfo->prAdapter, RAM_TYPE_MSG, sizeof(MSG_P2P_CONNECTION_ABORT_T)); - - if (prDisconnectMsg == NULL) { - ASSERT(FALSE); - i4Rslt = -ENOMEM; - break; - } - - prDisconnectMsg->rMsgHdr.eMsgId = MID_MNY_P2P_CONNECTION_ABORT; - COPY_MAC_ADDR(prDisconnectMsg->aucTargetID, mac); - prDisconnectMsg->u2ReasonCode = REASON_CODE_UNSPECIFIED; - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prDisconnectMsg, - MSG_SEND_METHOD_BUF); - - i4Rslt = 0; - } while (FALSE); - - return i4Rslt; - -} /* mtk_p2p_cfg80211_del_station */ - - -int -mtk_p2p_cfg80211_connect ( - struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_connect_params *sme - ) -{ - INT_32 i4Rslt = -EINVAL; - P_GLUE_INFO_T prGlueInfo = NULL; - P_MSG_P2P_CONNECTION_REQUEST_T prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)NULL; - - - do { - if ((wiphy == NULL) || - (dev == NULL) || - (sme == NULL)) { - break; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_connect.\n")); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - prConnReqMsg = (P_MSG_P2P_CONNECTION_REQUEST_T)cnmMemAlloc(prGlueInfo->prAdapter, RAM_TYPE_MSG, (sizeof(MSG_P2P_CONNECTION_REQUEST_T) + sme->ie_len)); - - if (prConnReqMsg == NULL) { - ASSERT(FALSE); - i4Rslt = -ENOMEM; - break; - } - - prConnReqMsg->rMsgHdr.eMsgId = MID_MNY_P2P_CONNECTION_REQ; - - COPY_SSID(prConnReqMsg->rSsid.aucSsid, - prConnReqMsg->rSsid.ucSsidLen, - sme->ssid, - sme->ssid_len); - - COPY_MAC_ADDR(prConnReqMsg->aucBssid, sme->bssid); - - DBGLOG(P2P, TRACE, ("Assoc Req IE Buffer Length:%d\n", sme->ie_len)); - kalMemCopy(prConnReqMsg->aucIEBuf, sme->ie, sme->ie_len); - prConnReqMsg->u4IELen = sme->ie_len; - - mtk_p2p_cfg80211func_channel_format_switch(sme->channel, - NL80211_CHAN_NO_HT, - &prConnReqMsg->rChannelInfo, - &prConnReqMsg->eChnlSco); - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prConnReqMsg, - MSG_SEND_METHOD_BUF); - - - i4Rslt = 0; - } while (FALSE); - - return i4Rslt; -} /* mtk_p2p_cfg80211_connect */ - -int -mtk_p2p_cfg80211_disconnect ( - struct wiphy *wiphy, - struct net_device *dev, - u16 reason_code - ) -{ - INT_32 i4Rslt = -EINVAL; - P_GLUE_INFO_T prGlueInfo = NULL; - P_MSG_P2P_CONNECTION_ABORT_T prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)NULL; - UINT_8 aucBCAddr[] = BC_MAC_ADDR; - - do { - if ((wiphy == NULL) || - (dev == NULL)) { - break; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_disconnect.\n")); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - -// prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)kalMemAlloc(sizeof(P_MSG_P2P_CONNECTION_ABORT_T), VIR_MEM_TYPE); - prDisconnMsg = (P_MSG_P2P_CONNECTION_ABORT_T)cnmMemAlloc(prGlueInfo->prAdapter, RAM_TYPE_MSG, sizeof(MSG_P2P_CONNECTION_ABORT_T)); - - if (prDisconnMsg == NULL) { - ASSERT(FALSE); - i4Rslt = -ENOMEM; - break; - } - - prDisconnMsg->rMsgHdr.eMsgId = MID_MNY_P2P_CONNECTION_ABORT; - prDisconnMsg->u2ReasonCode = reason_code; - prDisconnMsg->fgSendDeauth = TRUE; - COPY_MAC_ADDR(prDisconnMsg->aucTargetID, aucBCAddr); - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prDisconnMsg, - MSG_SEND_METHOD_UNBUF); - - i4Rslt = 0; - } while (FALSE); - - return i4Rslt; -} /* mtk_p2p_cfg80211_disconnect */ - - -int -mtk_p2p_cfg80211_change_iface ( - IN struct wiphy *wiphy, - IN struct net_device *ndev, - IN enum nl80211_iftype type, - IN u32 *flags, - IN struct vif_params *params - ) -{ - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - INT_32 i4Rslt = -EINVAL; - P_MSG_P2P_SWITCH_OP_MODE_T prSwitchModeMsg = (P_MSG_P2P_SWITCH_OP_MODE_T)NULL; - - do { - if ((wiphy == NULL) || - (ndev == NULL)) { - break; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_change_iface.\n")); - - if (ndev->ieee80211_ptr) { - ndev->ieee80211_ptr->iftype = type; - } - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - - // Switch OP MOde. - prSwitchModeMsg = (P_MSG_P2P_SWITCH_OP_MODE_T)cnmMemAlloc(prGlueInfo->prAdapter, RAM_TYPE_MSG, sizeof(MSG_P2P_SWITCH_OP_MODE_T)); - - if (prSwitchModeMsg == NULL) { - ASSERT(FALSE); - i4Rslt = -ENOMEM; - break; - } - - prSwitchModeMsg->rMsgHdr.eMsgId = MID_MNY_P2P_FUN_SWITCH; - - switch (type) { - case NL80211_IFTYPE_P2P_CLIENT: - DBGLOG(P2P, TRACE, ("NL80211_IFTYPE_P2P_CLIENT.\n")); - case NL80211_IFTYPE_STATION: - if (type == NL80211_IFTYPE_STATION) { - DBGLOG(P2P, TRACE, ("NL80211_IFTYPE_STATION.\n")); - } - prSwitchModeMsg->eOpMode = OP_MODE_INFRASTRUCTURE; - break; - case NL80211_IFTYPE_AP: - DBGLOG(P2P, TRACE, ("NL80211_IFTYPE_AP.\n")); - case NL80211_IFTYPE_P2P_GO: - if (type == NL80211_IFTYPE_P2P_GO) { - DBGLOG(P2P, TRACE, ("NL80211_IFTYPE_P2P_GO not AP.\n")); - } - prSwitchModeMsg->eOpMode = OP_MODE_ACCESS_POINT; - break; - default: - DBGLOG(P2P, TRACE, ("Other type :%d .\n", type)); - prSwitchModeMsg->eOpMode = OP_MODE_P2P_DEVICE; - break; - } - - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prSwitchModeMsg, - MSG_SEND_METHOD_BUF); - - i4Rslt = 0; - - } while (FALSE); - - return i4Rslt; - -} /* mtk_p2p_cfg80211_change_iface */ - - -int -mtk_p2p_cfg80211_set_channel ( - IN struct wiphy *wiphy, - IN struct net_device *dev, - IN struct ieee80211_channel *chan, - IN enum nl80211_channel_type channel_type) -{ - INT_32 i4Rslt = -EINVAL; - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - RF_CHANNEL_INFO_T rRfChnlInfo; - - do { - if ((wiphy == NULL) || - (dev == NULL) || - (chan == NULL)) { - break; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_set_channel.\n")); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - mtk_p2p_cfg80211func_channel_format_switch(chan, - channel_type, - &rRfChnlInfo, - NULL); - - p2pFuncSetChannel(prGlueInfo->prAdapter, &rRfChnlInfo); - - i4Rslt = 0; - } -while (FALSE); - - return i4Rslt; - -} -/* mtk_p2p_cfg80211_set_channel */ - -int -mtk_p2p_cfg80211_set_bitrate_mask ( - IN struct wiphy *wiphy, - IN struct net_device *dev, - IN const u8 *peer, - IN const struct cfg80211_bitrate_mask *mask - ) -{ - INT_32 i4Rslt = -EINVAL; - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - - do { - if ((wiphy == NULL) || - (dev == NULL) || - (mask == NULL)) { - break; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_set_bitrate_mask\n")); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - // TODO: Set bitrate mask of the peer? - - i4Rslt = 0; - } -while (FALSE); - - return i4Rslt; -} /* mtk_p2p_cfg80211_set_bitrate_mask */ - - -void -mtk_p2p_cfg80211_mgmt_frame_register ( - IN struct wiphy *wiphy, - IN struct net_device *dev, - IN u16 frame_type, - IN bool reg - ) -{ -#if 0 - P_MSG_P2P_MGMT_FRAME_REGISTER_T prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)NULL; -#endif - P_GLUE_INFO_T prGlueInfo = (P_GLUE_INFO_T)NULL; - - do { - if ((wiphy == NULL) || - (dev == NULL)) { - break; - } - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_mgmt_frame_register\n")); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - - switch (frame_type) { - case MAC_FRAME_PROBE_REQ: - if (reg) { - prGlueInfo->prP2PInfo->u4OsMgmtFrameFilter |= PARAM_PACKET_FILTER_PROBE_REQ; - DBGLOG(P2P, TRACE, ("Open packet filer probe request\n")); - } - else { - prGlueInfo->prP2PInfo->u4OsMgmtFrameFilter &= ~PARAM_PACKET_FILTER_PROBE_REQ; - DBGLOG(P2P, TRACE, ("Close packet filer probe request\n")); - } - break; - case MAC_FRAME_ACTION: - if (reg) { - prGlueInfo->prP2PInfo->u4OsMgmtFrameFilter |= PARAM_PACKET_FILTER_ACTION_FRAME; - DBGLOG(P2P, TRACE, ("Open packet filer action frame.\n")); - } - else { - prGlueInfo->prP2PInfo->u4OsMgmtFrameFilter &= ~PARAM_PACKET_FILTER_ACTION_FRAME; - DBGLOG(P2P, TRACE, ("Close packet filer action frame.\n")); - } - break; - default: - DBGLOG(P2P, ERROR, ("Ask frog to add code for mgmt:%x\n", frame_type)); - break; - } - - - - prGlueInfo->u4Flag |= GLUE_FLAG_FRAME_FILTER; - - /* wake up main thread */ - wake_up_interruptible(&prGlueInfo->waitq); - - if (in_interrupt()) { - DBGLOG(P2P, TRACE, ("It is in interrupt level\n")); - } - - - -#if 0 - - - prMgmtFrameRegister = (P_MSG_P2P_MGMT_FRAME_REGISTER_T)cnmMemAlloc(prGlueInfo->prAdapter, - RAM_TYPE_MSG, - sizeof(MSG_P2P_MGMT_FRAME_REGISTER_T)); - - if (prMgmtFrameRegister == NULL) { - ASSERT(FALSE); - break; - } - - prMgmtFrameRegister->rMsgHdr.eMsgId = MID_MNY_P2P_MGMT_FRAME_REGISTER; - - prMgmtFrameRegister->u2FrameType = frame_type; - prMgmtFrameRegister->fgIsRegister = reg; - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prMgmtFrameRegister, - MSG_SEND_METHOD_BUF); - -#endif - - } while (FALSE); - - - return; -} /* mtk_p2p_cfg80211_mgmt_frame_register */ - - -BOOLEAN -mtk_p2p_cfg80211func_channel_format_switch ( - IN struct ieee80211_channel *channel, - IN enum nl80211_channel_type channel_type, - IN P_RF_CHANNEL_INFO_T prRfChnlInfo, - IN P_ENUM_CHNL_EXT_T prChnlSco - ) -{ - BOOLEAN fgIsValid = FALSE; - - do { - if (channel == NULL) { - break; - } - - if (prRfChnlInfo) { - prRfChnlInfo->ucChannelNum = nicFreq2ChannelNum(channel->center_freq * 1000); - - switch (channel->band) { - case IEEE80211_BAND_2GHZ: - prRfChnlInfo->eBand = BAND_2G4; - break; - case IEEE80211_BAND_5GHZ: - prRfChnlInfo->eBand = BAND_5G; - break; - default: - prRfChnlInfo->eBand = BAND_2G4; - break; - } - - } - - - if (prChnlSco) { - - switch (channel_type) { - case NL80211_CHAN_NO_HT: - *prChnlSco = CHNL_EXT_SCN; - break; - case NL80211_CHAN_HT20: - *prChnlSco = CHNL_EXT_SCN; - break; - case NL80211_CHAN_HT40MINUS: - *prChnlSco = CHNL_EXT_SCA; - break; - case NL80211_CHAN_HT40PLUS: - *prChnlSco = CHNL_EXT_SCB; - break; - default: - ASSERT(FALSE); - *prChnlSco = CHNL_EXT_SCN; - break; - } - } - - fgIsValid = TRUE; - } -while (FALSE); - - return fgIsValid; -} -/* mtk_p2p_cfg80211func_channel_format_switch */ - - -#if CONFIG_NL80211_TESTMODE -int mtk_p2p_cfg80211_testmode_cmd( - IN struct wiphy *wiphy, - IN void *data, - IN int len - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - P_NL80211_DRIVER_TEST_PARAMS prParams = (P_NL80211_DRIVER_TEST_PARAMS)NULL; - BOOLEAN fgIsValid = FALSE; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_testmode_cmd\n")); - - if(data && len) - prParams = (P_NL80211_DRIVER_TEST_PARAMS)data; - - if(prParams->index >> 24 == 0x01) { - /* New version */ - prParams->index = prParams->index & ~ BITS(24,31); - } - else { - /* Old version*/ - mtk_p2p_cfg80211_testmode_p2p_sigma_pre_cmd(wiphy, data, len); - } - - /* Clear the version byte */ - prParams->index = prParams->index & ~ BITS(24,31); - - if(prParams){ - switch(prParams->index){ - case 1: /* P2P Simga */ - if(mtk_p2p_cfg80211_testmode_p2p_sigma_cmd(wiphy, data, len)) - fgIsValid = TRUE; - break; - case 2: /* WFD */ - break; - case 3: /* Hotspot Client Management */ - if(mtk_p2p_cfg80211_testmode_hotspot_block_list_cmd(wiphy, data, len)) - fgIsValid = TRUE; - break; - default: - fgIsValid = TRUE; - break; - } - } - - return fgIsValid; - -} - - -int mtk_p2p_cfg80211_testmode_p2p_sigma_pre_cmd( - IN struct wiphy *wiphy, - IN void *data, - IN int len - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - NL80211_DRIVER_TEST_PRE_PARAMS rParams; - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - UINT_32 index_mode; - UINT_32 index; - INT_32 value; - int status = 0; - UINT_32 u4Leng; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - kalMemZero(&rParams, sizeof(NL80211_DRIVER_TEST_PRE_PARAMS)); - - prP2pSpecificBssInfo = prGlueInfo->prAdapter->rWifiVar.prP2pSpecificBssInfo; - prP2pConnSettings = prGlueInfo->prAdapter->rWifiVar.prP2PConnSettings; - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_testmode_cmd\n")); - - if(data && len) - memcpy(&rParams, data, len); - - DBGLOG(P2P, TRACE, ("NL80211_ATTR_TESTDATA,idx_mode=%d idx=%d value=%lu\n", - (INT_16)rParams.idx_mode, (INT_16)rParams.idx, rParams.value)); - - index_mode = rParams.idx_mode; - index = rParams.idx; - value = rParams.value; - - switch (index) { - case 0: /* Listen CH */ - break; - case 1: /* P2p mode */ - break; - case 4: /* Noa duration */ - prP2pSpecificBssInfo->rNoaParam.u4NoaDurationMs = value; - // only to apply setting when setting NOA count - //status = mtk_p2p_wext_set_noa_param(prDev, info, wrqu, (char *)&prP2pSpecificBssInfo->rNoaParam); - break; - case 5: /* Noa interval */ - prP2pSpecificBssInfo->rNoaParam.u4NoaIntervalMs = value; - // only to apply setting when setting NOA count - //status = mtk_p2p_wext_set_noa_param(prDev, info, wrqu, (char *)&prP2pSpecificBssInfo->rNoaParam); - break; - case 6: /* Noa count */ - prP2pSpecificBssInfo->rNoaParam.u4NoaCount = value; - //status = mtk_p2p_wext_set_noa_param(prDev, info, wrqu, (char *)&prP2pSpecificBssInfo->rNoaParam); - break; - case 100: /* Oper CH */ - // 20110920 - frog: User configurations are placed in ConnSettings. - // prP2pConnSettings->ucOperatingChnl = value; - break; - case 101: /* Local config Method, for P2P SDK */ - prP2pConnSettings->u2LocalConfigMethod = value; - break; - case 102: /* Sigma P2p reset */ - //kalMemZero(prP2pConnSettings->aucTargetDevAddr, MAC_ADDR_LEN); - //prP2pConnSettings->eConnectionPolicy = ENUM_P2P_CONNECTION_POLICY_AUTO; - p2pFsmUninit(prGlueInfo->prAdapter); - p2pFsmInit(prGlueInfo->prAdapter); - break; - case 103: /* WPS MODE */ - kalP2PSetWscMode(prGlueInfo, value); - break; - case 104: /* P2p send persence, duration */ - break; - case 105: /* P2p send persence, interval */ - break; - case 106: /* P2P set sleep */ - value = 1; - kalIoctl(prGlueInfo, - wlanoidSetP2pPowerSaveProfile, - &value, - sizeof(value), - FALSE, - FALSE, - TRUE, - TRUE, - &u4Leng); - break; - case 107: /* P2P set opps, CTWindowl */ - prP2pSpecificBssInfo->rOppPsParam.u4CTwindowMs = value; - //status = mtk_p2p_wext_set_oppps_param(prDev, info, wrqu, (char *)&prP2pSpecificBssInfo->rOppPsParam); - break; - case 108: /* p2p_set_power_save */ - kalIoctl(prGlueInfo, - wlanoidSetP2pPowerSaveProfile, - &value, - sizeof(value), - FALSE, - FALSE, - TRUE, - TRUE, - &u4Leng); - - break; - default: - break; - } - - return status; - -} - - -int -mtk_p2p_cfg80211_testmode_p2p_sigma_cmd( - IN struct wiphy *wiphy, - IN void *data, - IN int len) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - P_NL80211_DRIVER_P2P_SIGMA_PARAMS prParams = (P_NL80211_DRIVER_P2P_SIGMA_PARAMS)NULL; - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - UINT_32 index; - INT_32 value; - int status = 0; - UINT_32 u4Leng; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - prP2pSpecificBssInfo = prGlueInfo->prAdapter->rWifiVar.prP2pSpecificBssInfo; - prP2pConnSettings = prGlueInfo->prAdapter->rWifiVar.prP2PConnSettings; - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_testmode_p2p_sigma_cmd\n")); - - if(data && len) - prParams = (P_NL80211_DRIVER_P2P_SIGMA_PARAMS)data; - - index = (INT_32)prParams->idx; - value = (INT_32)prParams->value; - - DBGLOG(P2P, TRACE, ("NL80211_ATTR_TESTDATA, idx=%lu value=%lu\n", - (INT_32)prParams->idx, (INT_32)prParams->value)); - - switch (index) { - case 0: /* Listen CH */ - break; - case 1: /* P2p mode */ - break; - case 4: /* Noa duration */ - prP2pSpecificBssInfo->rNoaParam.u4NoaDurationMs = value; - // only to apply setting when setting NOA count - //status = mtk_p2p_wext_set_noa_param(prDev, info, wrqu, (char *)&prP2pSpecificBssInfo->rNoaParam); - break; - case 5: /* Noa interval */ - prP2pSpecificBssInfo->rNoaParam.u4NoaIntervalMs = value; - // only to apply setting when setting NOA count - //status = mtk_p2p_wext_set_noa_param(prDev, info, wrqu, (char *)&prP2pSpecificBssInfo->rNoaParam); - break; - case 6: /* Noa count */ - prP2pSpecificBssInfo->rNoaParam.u4NoaCount = value; - //status = mtk_p2p_wext_set_noa_param(prDev, info, wrqu, (char *)&prP2pSpecificBssInfo->rNoaParam); - break; - case 100: /* Oper CH */ - // 20110920 - frog: User configurations are placed in ConnSettings. - // prP2pConnSettings->ucOperatingChnl = value; - break; - case 101: /* Local config Method, for P2P SDK */ - prP2pConnSettings->u2LocalConfigMethod = value; - break; - case 102: /* Sigma P2p reset */ - //kalMemZero(prP2pConnSettings->aucTargetDevAddr, MAC_ADDR_LEN); - //prP2pConnSettings->eConnectionPolicy = ENUM_P2P_CONNECTION_POLICY_AUTO; - break; - case 103: /* WPS MODE */ - kalP2PSetWscMode(prGlueInfo, value); - break; - case 104: /* P2p send persence, duration */ - break; - case 105: /* P2p send persence, interval */ - break; - case 106: /* P2P set sleep */ - value = 1; - kalIoctl(prGlueInfo, - wlanoidSetP2pPowerSaveProfile, - &value, - sizeof(value), - FALSE, - FALSE, - TRUE, - TRUE, - &u4Leng); - break; - case 107: /* P2P set opps, CTWindowl */ - prP2pSpecificBssInfo->rOppPsParam.u4CTwindowMs = value; - //status = mtk_p2p_wext_set_oppps_param(prDev, info, wrqu, (char *)&prP2pSpecificBssInfo->rOppPsParam); - break; - case 108: /* p2p_set_power_save */ - kalIoctl(prGlueInfo, - wlanoidSetP2pPowerSaveProfile, - &value, - sizeof(value), - FALSE, - FALSE, - TRUE, - TRUE, - &u4Leng); - - break; - case 109: /* Max Clients*/ - kalP2PSetMaxClients(prGlueInfo, value); - break; - default: - break; - } - - return status; - -} - - -int -mtk_p2p_cfg80211_testmode_hotspot_block_list_cmd( - IN struct wiphy *wiphy, - IN void *data, - IN int len) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - P_NL80211_DRIVER_hotspot_block_PARAMS prParams = (P_NL80211_DRIVER_hotspot_block_PARAMS)NULL; - int fgIsValid = 0; - - ASSERT(wiphy); - - prGlueInfo = *((P_GLUE_INFO_T *) wiphy_priv(wiphy)); - - if(data && len) - prParams = (P_NL80211_DRIVER_hotspot_block_PARAMS)data; - - DBGLOG(P2P, TRACE, ("mtk_p2p_cfg80211_testmode_hotspot_block_list_cmd\n")); - - fgIsValid = kalP2PSetBlackList(prGlueInfo, prParams->aucBssid, prParams->ucblocked); - - return fgIsValid; - -} - -#endif - - -#endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32) - -#endif // CFG_ENABLE_WIFI_DIRECT && CFG_ENABLE_WIFI_DIRECT_CFG_80211 diff --git a/drivers/net/wireless/mt5931/os/linux/gl_p2p_init.c b/drivers/net/wireless/mt5931/os/linux/gl_p2p_init.c deleted file mode 100755 index 8fd89a40f35a..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/gl_p2p_init.c +++ /dev/null @@ -1,518 +0,0 @@ -/* -** $Id: @(#) gl_p2p_init.c@@ -*/ - -/*! \file gl_p2p_init.c - \brief init and exit routines of Linux driver interface for Wi-Fi Direct - - This file contains the main routines of Linux driver for MediaTek Inc. 802.11 - Wireless LAN Adapters. -*/ - - - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -#include "precomp.h" - - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -#define P2P_MODE_INF_NAME "p2p%d"; -#define AP_MODE_INF_NAME "ap%d"; -//#define MAX_INF_NAME_LEN 15 -//#define MIN_INF_NAME_LEN 1 - -#define RUNNING_P2P_MODE 0 -#define RUNNING_AP_MODE 1 - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - - - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/* Get interface name and running mode from module insertion parameter -* Usage: insmod p2p.ko mode=1 -* default: interface name is p2p%d -* running mode is P2P -*/ -static PUCHAR ifname = P2P_MODE_INF_NAME; -static UINT_16 mode = RUNNING_P2P_MODE; - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -#if defined(CONFIG_HAS_EARLYSUSPEND) -extern int glRegisterEarlySuspend( - struct early_suspend *prDesc, - early_suspend_callback wlanSuspend, - late_resume_callback wlanResume); - -extern int glUnregisterEarlySuspend(struct early_suspend *prDesc); -#endif - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief check interface name parameter is valid or not -* if invalid, set ifname to P2P_MODE_INF_NAME -* -* -* \retval -*/ -/*----------------------------------------------------------------------------*/ -VOID -p2pCheckInterfaceName( - VOID - ) -{ - - if(mode) { - mode = RUNNING_AP_MODE; - ifname = AP_MODE_INF_NAME; - } -#if 0 - UINT_32 ifLen = 0; - - if(ifname) { - ifLen = strlen(ifname); - - if(ifLen > MAX_INF_NAME_LEN) { - ifname[MAX_INF_NAME_LEN] = '\0'; - } - else if( ifLen < MIN_INF_NAME_LEN ) { - ifname = P2P_MODE_INF_NAME; - } - } else { - ifname = P2P_MODE_INF_NAME; - } -#endif -} - - -extern UINT_8 g_aucBufIpAddr[32]; - -static void wlanP2PEarlySuspend(void) -{ - struct net_device *prDev = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - UINT_8 ip[4] = { 0 }; - UINT_32 u4NumIPv4 = 0; -#ifdef CONFIG_IPV6 - UINT_8 ip6[16] = { 0 }; // FIX ME: avoid to allocate large memory in stack - UINT_32 u4NumIPv6 = 0; -#endif - UINT_32 i; - P_PARAM_NETWORK_ADDRESS_IP prParamIpAddr; - - printk(KERN_INFO "*********p2pEarlySuspend************\n"); - - if(!wlanExportGlueInfo(&prGlueInfo)) { - printk(KERN_INFO "*********p2pEarlySuspend ignored************\n"); - return; - } - - ASSERT(prGlueInfo); - // <1> Sanity check and acquire the net_device - prDev = prGlueInfo->prP2PInfo->prDevHandler; - ASSERT(prDev); - - // <3> get the IPv4 address - if(!prDev || !(prDev->ip_ptr)||\ - !((struct in_device *)(prDev->ip_ptr))->ifa_list||\ - !(&(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local))){ - printk(KERN_INFO "ip is not avaliable.\n"); - return; - } - - // <4> copy the IPv4 address - kalMemCopy(ip, &(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local), sizeof(ip)); - printk(KERN_INFO"ip is %d.%d.%d.%d\n", - ip[0],ip[1],ip[2],ip[3]); - - // todo: traverse between list to find whole sets of IPv4 addresses - if (!((ip[0] == 0) && - (ip[1] == 0) && - (ip[2] == 0) && - (ip[3] == 0))) { - u4NumIPv4++; - } - -#ifdef CONFIG_IPV6 - // <5> get the IPv6 address - if(!prDev || !(prDev->ip6_ptr)||\ - !((struct in_device *)(prDev->ip6_ptr))->ifa_list||\ - !(&(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local))){ - printk(KERN_INFO "ipv6 is not avaliable.\n"); - return; - } - // <6> copy the IPv6 address - kalMemCopy(ip6, &(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local), sizeof(ip6)); - printk(KERN_INFO"ipv6 is %d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d\n", - ip6[0],ip6[1],ip6[2],ip6[3], - ip6[4],ip6[5],ip6[6],ip6[7], - ip6[8],ip6[9],ip6[10],ip6[11], - ip6[12],ip6[13],ip6[14],ip6[15] - ); - // todo: traverse between list to find whole sets of IPv6 addresses - - if (!((ip6[0] == 0) && - (ip6[1] == 0) && - (ip6[2] == 0) && - (ip6[3] == 0) && - (ip6[4] == 0) && - (ip6[5] == 0))) { - } - -#endif - // <7> set up the ARP filter - { - WLAN_STATUS rStatus = WLAN_STATUS_FAILURE; - UINT_32 u4SetInfoLen = 0; -// UINT_8 aucBuf[32] = {0}; - UINT_32 u4Len = OFFSET_OF(PARAM_NETWORK_ADDRESS_LIST, arAddress); - P_PARAM_NETWORK_ADDRESS_LIST prParamNetAddrList = (P_PARAM_NETWORK_ADDRESS_LIST)g_aucBufIpAddr;//aucBuf; - P_PARAM_NETWORK_ADDRESS prParamNetAddr = prParamNetAddrList->arAddress; - - kalMemZero(g_aucBufIpAddr, sizeof(g_aucBufIpAddr)); - - prParamNetAddrList->u4AddressCount = u4NumIPv4 + u4NumIPv6; - prParamNetAddrList->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP; - for (i = 0; i < u4NumIPv4; i++) { - prParamNetAddr->u2AddressLength = sizeof(PARAM_NETWORK_ADDRESS_IP);//4;; - prParamNetAddr->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP;; -#if 0 - kalMemCopy(prParamNetAddr->aucAddress, ip, sizeof(ip)); - prParamNetAddr = (P_PARAM_NETWORK_ADDRESS)((UINT_32)prParamNetAddr + sizeof(ip)); - u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(ip); -#else - prParamIpAddr = (P_PARAM_NETWORK_ADDRESS_IP)prParamNetAddr->aucAddress; - kalMemCopy(&prParamIpAddr->in_addr, ip, sizeof(ip)); - -// prParamNetAddr = (P_PARAM_NETWORK_ADDRESS)((UINT_32)prParamNetAddr + sizeof(PARAM_NETWORK_ADDRESS)); // TODO: frog. The pointer is not right. - - prParamNetAddr = (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prParamNetAddr + - (UINT_32) (prParamNetAddr->u2AddressLength + OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress))); - - u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(PARAM_NETWORK_ADDRESS_IP); -#endif - } -#ifdef CONFIG_IPV6 - for (i = 0; i < u4NumIPv6; i++) { - prParamNetAddr->u2AddressLength = 6;; - prParamNetAddr->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP;; - kalMemCopy(prParamNetAddr->aucAddress, ip6, sizeof(ip6)); -// prParamNetAddr = (P_PARAM_NETWORK_ADDRESS)((UINT_32)prParamNetAddr + sizeof(ip6)); - - prParamNetAddr = (P_PARAM_NETWORK_ADDRESS) ((UINT_32) prParamNetAddr + - (UINT_32) (prParamNetAddr->u2AddressLength + OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress))); - - u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(ip6); - } -#endif - ASSERT(u4Len <= sizeof(g_aucBufIpAddr/*aucBuf*/)); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetP2pSetNetworkAddress, - (PVOID)prParamNetAddrList, - u4Len, - FALSE, - FALSE, - TRUE, - TRUE, - &u4SetInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - printk(KERN_INFO DRV_NAME"set HW pattern filter fail 0x%lx\n", rStatus); - } - } -} - - -static void wlanP2PLateResume(void) -{ - struct net_device *prDev = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - UINT_8 ip[4] = { 0 }; -#ifdef CONFIG_IPV6 - UINT_8 ip6[16] = { 0 }; // FIX ME: avoid to allocate large memory in stack -#endif - - printk(KERN_INFO "*********wlanP2PLateResume************\n"); - if(!wlanExportGlueInfo(&prGlueInfo)) { - printk(KERN_INFO "*********p2pLateResume ignored************\n"); - return; - } - - ASSERT(prGlueInfo); - // <1> Sanity check and acquire the net_device - prDev = prGlueInfo->prP2PInfo->prDevHandler; - ASSERT(prDev); - - // <3> get the IPv4 address - if(!prDev || !(prDev->ip_ptr)||\ - !((struct in_device *)(prDev->ip_ptr))->ifa_list||\ - !(&(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local))){ - printk(KERN_INFO "ip is not avaliable.\n"); - return; - } - - // <4> copy the IPv4 address - kalMemCopy(ip, &(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local), sizeof(ip)); - printk(KERN_INFO"ip is %d.%d.%d.%d\n", - ip[0],ip[1],ip[2],ip[3]); - -#ifdef CONFIG_IPV6 - // <5> get the IPv6 address - if(!prDev || !(prDev->ip6_ptr)||\ - !((struct in_device *)(prDev->ip6_ptr))->ifa_list||\ - !(&(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local))){ - printk(KERN_INFO "ipv6 is not avaliable.\n"); - return; - } - // <6> copy the IPv6 address - kalMemCopy(ip6, &(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local), sizeof(ip6)); - printk(KERN_INFO"ipv6 is %d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d\n", - ip6[0],ip6[1],ip6[2],ip6[3], - ip6[4],ip6[5],ip6[6],ip6[7], - ip6[8],ip6[9],ip6[10],ip6[11], - ip6[12],ip6[13],ip6[14],ip6[15] - ); -#endif - // <7> clear the ARP filter - { - WLAN_STATUS rStatus = WLAN_STATUS_FAILURE; - UINT_32 u4SetInfoLen = 0; -// UINT_8 aucBuf[32] = {0}; - UINT_32 u4Len = sizeof(PARAM_NETWORK_ADDRESS_LIST); - P_PARAM_NETWORK_ADDRESS_LIST prParamNetAddrList = (P_PARAM_NETWORK_ADDRESS_LIST)g_aucBufIpAddr;//aucBuf; - - kalMemZero(g_aucBufIpAddr, sizeof(g_aucBufIpAddr)); - - prParamNetAddrList->u4AddressCount = 0; - prParamNetAddrList->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP; - - ASSERT(u4Len <= sizeof(g_aucBufIpAddr/*aucBuf*/)); - rStatus = kalIoctl(prGlueInfo, - wlanoidSetP2pSetNetworkAddress, - (PVOID)prParamNetAddrList, - u4Len, - FALSE, - FALSE, - TRUE, - TRUE, - &u4SetInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - printk(KERN_INFO DRV_NAME"set HW pattern filter fail 0x%lx\n", rStatus); - } - } -} - -#if defined(CONFIG_HAS_EARLYSUSPEND) -static struct early_suspend mt6620_p2p_early_suspend_desc = { - .level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN, -}; - -static void p2p_early_suspend(struct early_suspend *h) -{ - printk(KERN_INFO "*********wlanP2P_early_suspend************\n"); - wlanP2PEarlySuspend(); -} - -static void p2p_late_resume(struct early_suspend *h) -{ - printk(KERN_INFO "*********wlanP2P_late_resume************\n"); - wlanP2PLateResume(); -} -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* run p2p init procedure, include register pointer to wlan -* glue register p2p -* set p2p registered flag -* \retval 1 Success -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -p2pLaunch( - P_GLUE_INFO_T prGlueInfo - ) -{ - - printk("p2p Launch\n"); - - if(prGlueInfo->prAdapter->fgIsP2PRegistered == TRUE) { - printk("p2p already registered\n"); - return FALSE; - } - else if(glRegisterP2P(prGlueInfo, ifname, (BOOLEAN)mode)) { - prGlueInfo->prAdapter->fgIsP2PRegistered = TRUE; - - printk("Launch success, fgIsP2PRegistered TRUE.\n"); - -#if defined(CONFIG_HAS_EARLYSUSPEND) - /* Here, we register the early suspend and resume callback */ - glRegisterEarlySuspend(&mt6620_p2p_early_suspend_desc, p2p_early_suspend, p2p_late_resume); -#endif - - return TRUE; - } - else { - printk("Launch Fail\n"); - } - - return FALSE; -} - - -VOID -p2pSetMode ( - IN BOOLEAN fgIsAPMOde - ) -{ - if (fgIsAPMOde) { - mode = RUNNING_AP_MODE; - ifname = AP_MODE_INF_NAME; - } - else { - mode = RUNNING_P2P_MODE; - ifname = P2P_MODE_INF_NAME; - } - - return; -} /* p2pSetMode */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* run p2p exit procedure, include unregister pointer to wlan -* glue unregister p2p -* set p2p registered flag - -* \retval 1 Success -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -p2pRemove( - P_GLUE_INFO_T prGlueInfo - ) -{ - if(prGlueInfo->prAdapter->fgIsP2PRegistered == FALSE) { - printk("p2p is not Registered.\n"); - return FALSE; - } - else { - -#if defined(CONFIG_HAS_EARLYSUSPEND) - glUnregisterEarlySuspend(&mt6620_p2p_early_suspend_desc); -#endif - /*Check p2p fsm is stop or not. If not then stop now*/ - if(IS_P2P_ACTIVE(prGlueInfo->prAdapter)) { - p2pStopImmediate(prGlueInfo); - } - prGlueInfo->prAdapter->fgIsP2PRegistered = FALSE; - glUnregisterP2P(prGlueInfo); - /*p2p is removed successfully*/ - return TRUE; - } - return FALSE; -} - -#if 0 -/*----------------------------------------------------------------------------*/ -/*! -* \brief Driver entry point when the driver is configured as a Linux Module, and -* is called once at module load time, by the user-level modutils -* application: insmod or modprobe. -* -* \retval 0 Success -*/ -/*----------------------------------------------------------------------------*/ -static int initP2P(void) -{ - P_GLUE_INFO_T prGlueInfo; - - /*check interface name validation*/ - p2pCheckInterfaceName(); - - printk( KERN_INFO DRV_NAME "InitP2P, Ifname: %s, Mode: %s\n", ifname, mode ? "AP":"P2P"); - - /*register p2p init & exit function to wlan sub module handler*/ - wlanSubModRegisterInitExit(p2pLaunch, p2pRemove, P2P_MODULE); - - /*if wlan is not start yet, do nothing - * p2pLaunch will be called by txthread while wlan start - */ - /*if wlan is not started yet, return FALSE*/ - if(wlanExportGlueInfo(&prGlueInfo)) { - wlanSubModInit(prGlueInfo); - return ( prGlueInfo->prAdapter->fgIsP2PRegistered? 0: -EIO); - } - - return 0; -} /* end of initP2P() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Driver exit point when the driver as a Linux Module is removed. Called -* at module unload time, by the user level modutils application: rmmod. -* This is our last chance to clean up after ourselves. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -//1 Module Leave Point -static VOID __exit exitP2P(void) -{ - P_GLUE_INFO_T prGlueInfo; - - printk( KERN_INFO DRV_NAME "ExitP2P\n"); - - /*if wlan is not started yet, return FALSE*/ - if(wlanExportGlueInfo(&prGlueInfo)) { - wlanSubModExit(prGlueInfo); - } - /*UNregister p2p init & exit function to wlan sub module handler*/ - wlanSubModRegisterInitExit(NULL, NULL, P2P_MODULE); -} /* end of exitP2P() */ -#endif - diff --git a/drivers/net/wireless/mt5931/os/linux/gl_p2p_kal.c b/drivers/net/wireless/mt5931/os/linux/gl_p2p_kal.c deleted file mode 100755 index 08a5f9b271b6..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/gl_p2p_kal.c +++ /dev/null @@ -1,1629 +0,0 @@ -/* -** $Id: @(#) gl_p2p_cfg80211.c@@ -*/ - -/*! \file gl_p2p_kal.c - \brief - -*/ - - - - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "net/cfg80211.h" -#include "precomp.h" - -extern BOOLEAN -wextSrchDesiredWPAIE ( - IN PUINT_8 pucIEStart, - IN INT_32 i4TotalIeLen, - IN UINT_8 ucDesiredElemId, - OUT PUINT_8 *ppucDesiredIE - ); - -#if CFG_SUPPORT_WPS -extern BOOLEAN -wextSrchDesiredWPSIE ( - IN PUINT_8 pucIEStart, - IN INT_32 i4TotalIeLen, - IN UINT_8 ucDesiredElemId, - OUT PUINT_8 *ppucDesiredIE - ); -#endif - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -BOOLEAN -kalP2pFuncGetChannelType( - IN ENUM_CHNL_EXT_T rChnlSco, - OUT enum nl80211_channel_type *channel_type - ); - - -struct ieee80211_channel * -kalP2pFuncGetChannelEntry( - IN P_GL_P2P_INFO_T prP2pInfo, - IN P_RF_CHANNEL_INFO_T prChannelInfo - ); - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to retrieve Wi-Fi Direct state from glue layer -* -* \param[in] -* prGlueInfo -* rPeerAddr -* \return -* ENUM_BOW_DEVICE_STATE -*/ -/*----------------------------------------------------------------------------*/ -ENUM_PARAM_MEDIA_STATE_T -kalP2PGetState ( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - return prGlueInfo->prP2PInfo->eState; -} /* end of kalP2PGetState() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to update the assoc req to p2p -* -* \param[in] -* prGlueInfo -* pucFrameBody -* u4FrameBodyLen -* fgReassocRequest -* \return -* none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalP2PUpdateAssocInfo ( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucFrameBody, - IN UINT_32 u4FrameBodyLen, - IN BOOLEAN fgReassocRequest - ) -{ - union iwreq_data wrqu; - unsigned char *pucExtraInfo = NULL; - unsigned char *pucDesiredIE = NULL; -// unsigned char aucExtraInfoBuf[200]; - PUINT_8 cp; - - memset(&wrqu, 0, sizeof(wrqu)); - - if (fgReassocRequest) { - if (u4FrameBodyLen < 15) { - /* - printk(KERN_WARNING "frameBodyLen too short:%ld\n", frameBodyLen); - */ - return; - } - } - else { - if (u4FrameBodyLen < 9) { - /* - printk(KERN_WARNING "frameBodyLen too short:%ld\n", frameBodyLen); - */ - return; - } - } - - cp = pucFrameBody; - - if (fgReassocRequest) { - /* Capability information field 2 */ - /* Listen interval field 2*/ - /* Current AP address 6 */ - cp += 10; - u4FrameBodyLen -= 10; - } - else { - /* Capability information field 2 */ - /* Listen interval field 2*/ - cp += 4; - u4FrameBodyLen -= 4; - } - - /* do supplicant a favor, parse to the start of WPA/RSN IE */ - if (wextSrchDesiredWPSIE(cp, u4FrameBodyLen, 0xDD, &pucDesiredIE)) { - //printk("wextSrchDesiredWPSIE!!\n"); - /* WPS IE found */ - } - else if (wextSrchDesiredWPAIE(cp, u4FrameBodyLen, 0x30, &pucDesiredIE)) { - //printk("wextSrchDesiredWPAIE!!\n"); - /* RSN IE found */ - } - else if (wextSrchDesiredWPAIE(cp, u4FrameBodyLen, 0xDD, &pucDesiredIE)) { - //printk("wextSrchDesiredWPAIE!!\n"); - /* WPA IE found */ - } - else { - /* no WPA/RSN IE found, skip this event */ - goto skip_indicate_event; - } - - /* IWEVASSOCREQIE, indicate binary string */ - pucExtraInfo = pucDesiredIE; - wrqu.data.length = pucDesiredIE[1] + 2; - - /* Send event to user space */ - wireless_send_event(prGlueInfo->prP2PInfo->prDevHandler, IWEVASSOCREQIE, &wrqu, pucExtraInfo); - -skip_indicate_event: - return; - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to set Wi-Fi Direct state in glue layer -* -* \param[in] -* prGlueInfo -* eBowState -* rPeerAddr -* \return -* none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalP2PSetState ( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_PARAM_MEDIA_STATE_T eState, - IN PARAM_MAC_ADDRESS rPeerAddr, - IN UINT_8 ucRole - ) -{ - union iwreq_data evt; - UINT_8 aucBuffer[IW_CUSTOM_MAX]; - - ASSERT(prGlueInfo); - - memset(&evt, 0, sizeof(evt)); - - if(eState == PARAM_MEDIA_STATE_CONNECTED) { - prGlueInfo->prP2PInfo->eState = PARAM_MEDIA_STATE_CONNECTED; - - snprintf(aucBuffer, IW_CUSTOM_MAX-1, "P2P_STA_CONNECT="MACSTR, MAC2STR(rPeerAddr)); - evt.data.length = strlen(aucBuffer); - - /* indicate in IWECUSTOM event */ - wireless_send_event(prGlueInfo->prP2PInfo->prDevHandler, - IWEVCUSTOM, - &evt, - aucBuffer); - - } - else if(eState == PARAM_MEDIA_STATE_DISCONNECTED) { - snprintf(aucBuffer, IW_CUSTOM_MAX-1, "P2P_STA_DISCONNECT="MACSTR, MAC2STR(rPeerAddr)); - evt.data.length = strlen(aucBuffer); - - /* indicate in IWECUSTOM event */ - wireless_send_event(prGlueInfo->prP2PInfo->prDevHandler, - IWEVCUSTOM, - &evt, - aucBuffer); - } - else { - ASSERT(0); - } - - return; -} /* end of kalP2PSetState() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to retrieve Wi-Fi Direct operating frequency -* -* \param[in] -* prGlueInfo -* -* \return -* in unit of KHz -*/ -/*----------------------------------------------------------------------------*/ -UINT_32 -kalP2PGetFreqInKHz( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - return prGlueInfo->prP2PInfo->u4FreqInKHz; -} /* end of kalP2PGetFreqInKHz() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to retrieve Bluetooth-over-Wi-Fi role -* -* \param[in] -* prGlueInfo -* -* \return -* 0: P2P Device -* 1: Group Client -* 2: Group Owner -*/ -/*----------------------------------------------------------------------------*/ -UINT_8 -kalP2PGetRole( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - - return prGlueInfo->prP2PInfo->ucRole; -} /* end of kalP2PGetRole() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to set Wi-Fi Direct role -* -* \param[in] -* prGlueInfo -* ucResult -* 0: successful -* 1: error -* ucRole -* 0: P2P Device -* 1: Group Client -* 2: Group Owner -* -* \return -* none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalP2PSetRole( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 ucResult, - IN PUINT_8 pucSSID, - IN UINT_8 ucSSIDLen, - IN UINT_8 ucRole - ) -{ - union iwreq_data evt; - UINT_8 aucBuffer[IW_CUSTOM_MAX]; - - ASSERT(prGlueInfo); - ASSERT(ucRole <= 2); - - memset(&evt, 0, sizeof(evt)); - - if(ucResult == 0) { - prGlueInfo->prP2PInfo->ucRole = ucRole; - } - - if (pucSSID) - snprintf(aucBuffer, IW_CUSTOM_MAX-1, "P2P_FORMATION_RST=%d%d%d%c%c", ucResult, ucRole, 1/* persistence or not */, pucSSID[7], pucSSID[8]); - else - snprintf(aucBuffer, IW_CUSTOM_MAX-1, "P2P_FORMATION_RST=%d%d%d%c%c", ucResult, ucRole, 1/* persistence or not */, '0', '0'); - - evt.data.length = strlen(aucBuffer); - - //if (pucSSID) - // printk("P2P GO SSID DIRECT-%c%c\n", pucSSID[7], pucSSID[8]); - - /* indicate in IWECUSTOM event */ - wireless_send_event(prGlueInfo->prP2PInfo->prDevHandler, - IWEVCUSTOM, - &evt, - aucBuffer); - - return; -} /* end of kalP2PSetRole() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to set the cipher for p2p -* -* \param[in] -* prGlueInfo -* u4Cipher -* -* \return -* none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalP2PSetCipher( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Cipher - ) -{ - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->prP2PInfo); - - prGlueInfo->prP2PInfo->u4CipherPairwise = u4Cipher; - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to get the cipher, return for cipher is ccmp -* -* \param[in] -* prGlueInfo -* -* \return -* TRUE: cipher is ccmp -* FALSE: cipher is none -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalP2PGetCipher ( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->prP2PInfo); - - if (prGlueInfo->prP2PInfo->u4CipherPairwise == IW_AUTH_CIPHER_CCMP) - return TRUE; - - if (prGlueInfo->prP2PInfo->u4CipherPairwise == IW_AUTH_CIPHER_TKIP) - return TRUE; - - return FALSE; -} - -BOOLEAN -kalP2PGetCcmpCipher ( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->prP2PInfo); - - if (prGlueInfo->prP2PInfo->u4CipherPairwise == IW_AUTH_CIPHER_CCMP) - return TRUE; - - if (prGlueInfo->prP2PInfo->u4CipherPairwise == IW_AUTH_CIPHER_TKIP) - return FALSE; - - return FALSE; -} - - -BOOLEAN -kalP2PGetTkipCipher ( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->prP2PInfo); - - if (prGlueInfo->prP2PInfo->u4CipherPairwise == IW_AUTH_CIPHER_CCMP) - return FALSE; - - if (prGlueInfo->prP2PInfo->u4CipherPairwise == IW_AUTH_CIPHER_TKIP) - return TRUE; - - return FALSE; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to set the status of WSC -* -* \param[in] -* prGlueInfo -* -* \return -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalP2PSetWscMode ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 ucWscMode - ) -{ - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->prP2PInfo); - - prGlueInfo->prP2PInfo->ucWSCRunning = ucWscMode; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to get the status of WSC -* -* \param[in] -* prGlueInfo -* -* \return -*/ -/*----------------------------------------------------------------------------*/ -UINT_8 -kalP2PGetWscMode ( - IN P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->prP2PInfo); - - return (prGlueInfo->prP2PInfo->ucWSCRunning); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to get the wsc ie length -* -* \param[in] -* prGlueInfo -* ucType : 0 for beacon, 1 for probe req, 2 for probe resp -* -* \return -* The WSC IE length -*/ -/*----------------------------------------------------------------------------*/ -UINT_16 -kalP2PCalWSC_IELen ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 ucType - ) -{ - ASSERT(prGlueInfo); - - ASSERT(ucType < 3); - - return prGlueInfo->prP2PInfo->u2WSCIELen[ucType]; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to copy the wsc ie setting from p2p supplicant -* -* \param[in] -* prGlueInfo -* -* \return -* The WPS IE length -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalP2PGenWSC_IE ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 ucType, - IN PUINT_8 pucBuffer - ) -{ - P_GL_P2P_INFO_T prGlP2pInfo = (P_GL_P2P_INFO_T)NULL; - - do { - if ((prGlueInfo == NULL) || - (ucType >= 3) || - (pucBuffer == NULL)) { - break; - } - - - prGlP2pInfo = prGlueInfo->prP2PInfo; - - kalMemCopy(pucBuffer, prGlP2pInfo->aucWSCIE[ucType], prGlP2pInfo->u2WSCIELen[ucType]); - - } while (FALSE); - - return; -} - - -VOID -kalP2PUpdateWSC_IE ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 ucType, - IN PUINT_8 pucBuffer, - IN UINT_16 u2BufferLength - ) -{ - P_GL_P2P_INFO_T prGlP2pInfo = (P_GL_P2P_INFO_T)NULL; - - do { - if ((prGlueInfo == NULL) || - (ucType >= 3) || - ((u2BufferLength > 0) && (pucBuffer == NULL))) { - break; - } - - - if (u2BufferLength > 400) { - DBGLOG(P2P, ERROR, ("Buffer length is not enough, GLUE only 400 bytes but %d received\n", u2BufferLength)); - ASSERT(FALSE); - break; - } - - - prGlP2pInfo = prGlueInfo->prP2PInfo; - - kalMemCopy(prGlP2pInfo->aucWSCIE[ucType], pucBuffer, u2BufferLength); - - prGlP2pInfo->u2WSCIELen[ucType] = u2BufferLength; - - - } while (FALSE); - - return; -} /* kalP2PUpdateWSC_IE */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief indicate an event to supplicant for device connection request -* -* \param[in] prGlueInfo Pointer of GLUE_INFO_T -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalP2PIndicateConnReq( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucDevName, - IN INT_32 u4NameLength, - IN PARAM_MAC_ADDRESS rPeerAddr, - IN UINT_8 ucDevType, /* 0: P2P Device / 1: GC / 2: GO */ - IN INT_32 i4ConfigMethod, - IN INT_32 i4ActiveConfigMethod - ) -{ - union iwreq_data evt; - UINT_8 aucBuffer[IW_CUSTOM_MAX]; - - ASSERT(prGlueInfo); - - /* buffer peer information for later IOC_P2P_GET_REQ_DEVICE_INFO access */ - prGlueInfo->prP2PInfo->u4ConnReqNameLength = u4NameLength > 32 ? 32 : u4NameLength; - kalMemCopy(prGlueInfo->prP2PInfo->aucConnReqDevName, - pucDevName, - prGlueInfo->prP2PInfo->u4ConnReqNameLength); - COPY_MAC_ADDR(prGlueInfo->prP2PInfo->rConnReqPeerAddr, rPeerAddr); - prGlueInfo->prP2PInfo->ucConnReqDevType = ucDevType; - prGlueInfo->prP2PInfo->i4ConnReqConfigMethod = i4ConfigMethod; - prGlueInfo->prP2PInfo->i4ConnReqActiveConfigMethod = i4ActiveConfigMethod; - - // prepare event structure - memset(&evt, 0, sizeof(evt)); - - snprintf(aucBuffer, IW_CUSTOM_MAX-1, "P2P_DVC_REQ"); - evt.data.length = strlen(aucBuffer); - - /* indicate in IWEVCUSTOM event */ - wireless_send_event(prGlueInfo->prP2PInfo->prDevHandler, - IWEVCUSTOM, - &evt, - aucBuffer); - - return; -} /* end of kalP2PIndicateConnReq() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Indicate an event to supplicant for device connection request from other device. -* -* \param[in] prGlueInfo Pointer of GLUE_INFO_T -* \param[in] pucGroupBssid Only valid when invitation Type equals to 0. -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalP2PInvitationIndication ( - IN P_GLUE_INFO_T prGlueInfo, - IN P_P2P_DEVICE_DESC_T prP2pDevDesc, - IN PUINT_8 pucSsid, - IN UINT_8 ucSsidLen, - IN UINT_8 ucOperatingChnl, - IN UINT_8 ucInvitationType, - IN PUINT_8 pucGroupBssid - ) -{ -#if 1 - union iwreq_data evt; - UINT_8 aucBuffer[IW_CUSTOM_MAX]; - - ASSERT(prGlueInfo); - - /* buffer peer information for later IOC_P2P_GET_STRUCT access */ - prGlueInfo->prP2PInfo->u4ConnReqNameLength = (UINT_32)((prP2pDevDesc->u2NameLength > 32)? 32 : prP2pDevDesc->u2NameLength); - kalMemCopy(prGlueInfo->prP2PInfo->aucConnReqDevName, - prP2pDevDesc->aucName, - prGlueInfo->prP2PInfo->u4ConnReqNameLength); - COPY_MAC_ADDR(prGlueInfo->prP2PInfo->rConnReqPeerAddr, prP2pDevDesc->aucDeviceAddr); - COPY_MAC_ADDR(prGlueInfo->prP2PInfo->rConnReqGroupAddr, pucGroupBssid); - prGlueInfo->prP2PInfo->i4ConnReqConfigMethod = (INT_32)(prP2pDevDesc->u2ConfigMethod); - prGlueInfo->prP2PInfo->ucOperatingChnl = ucOperatingChnl; - prGlueInfo->prP2PInfo->ucInvitationType = ucInvitationType; - - // prepare event structure - memset(&evt, 0, sizeof(evt)); - - snprintf(aucBuffer, IW_CUSTOM_MAX-1, "P2P_INV_INDICATE"); - evt.data.length = strlen(aucBuffer); - - /* indicate in IWEVCUSTOM event */ - wireless_send_event(prGlueInfo->prP2PInfo->prDevHandler, - IWEVCUSTOM, - &evt, - aucBuffer); - return; - -#else - P_MSG_P2P_CONNECTION_REQUEST_T prP2pConnReq = (P_MSG_P2P_CONNECTION_REQUEST_T)NULL; - P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo = (P_P2P_SPECIFIC_BSS_INFO_T)NULL; - P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T)NULL; - - do { - ASSERT_BREAK((prGlueInfo != NULL) && (prP2pDevDesc != NULL)); - - - // Not a real solution - - prP2pSpecificBssInfo = prGlueInfo->prAdapter->rWifiVar.prP2pSpecificBssInfo; - prP2pConnSettings = prGlueInfo->prAdapter->rWifiVar.prP2PConnSettings; - - prP2pConnReq = (P_MSG_P2P_CONNECTION_REQUEST_T)cnmMemAlloc(prGlueInfo->prAdapter, - RAM_TYPE_MSG, - sizeof(MSG_P2P_CONNECTION_REQUEST_T)); - - if (prP2pConnReq == NULL) { - break; - } - - - kalMemZero(prP2pConnReq, sizeof(MSG_P2P_CONNECTION_REQUEST_T)); - - prP2pConnReq->rMsgHdr.eMsgId = MID_MNY_P2P_CONNECTION_REQ; - - prP2pConnReq->eFormationPolicy = ENUM_P2P_FORMATION_POLICY_AUTO; - - COPY_MAC_ADDR(prP2pConnReq->aucDeviceID, prP2pDevDesc->aucDeviceAddr); - - prP2pConnReq->u2ConfigMethod = prP2pDevDesc->u2ConfigMethod; - - if (ucInvitationType == P2P_INVITATION_TYPE_INVITATION) { - prP2pConnReq->fgIsPersistentGroup = FALSE; - prP2pConnReq->fgIsTobeGO = FALSE; - - } - - else if (ucInvitationType == P2P_INVITATION_TYPE_REINVOKE) { - DBGLOG(P2P, TRACE, ("Re-invoke Persistent Group\n")); - prP2pConnReq->fgIsPersistentGroup = TRUE; - prP2pConnReq->fgIsTobeGO = (prGlueInfo->prP2PInfo->ucRole == 2)?TRUE:FALSE; - - } - - - p2pFsmRunEventDeviceDiscoveryAbort(prGlueInfo->prAdapter, NULL); - - if (ucOperatingChnl != 0) { - prP2pSpecificBssInfo->ucPreferredChannel = ucOperatingChnl; - } - - if ((ucSsidLen < 32) && (pucSsid != NULL)) { - COPY_SSID(prP2pConnSettings->aucSSID, - prP2pConnSettings->ucSSIDLen, - pucSsid, - ucSsidLen); - } - - mboxSendMsg(prGlueInfo->prAdapter, - MBOX_ID_0, - (P_MSG_HDR_T)prP2pConnReq, - MSG_SEND_METHOD_BUF); - - - - } while (FALSE); - - // frog add. - // TODO: Invitation Indication - - return; -#endif - -} /* kalP2PInvitationIndication */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Indicate an status to supplicant for device invitation status. -* -* \param[in] prGlueInfo Pointer of GLUE_INFO_T -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalP2PInvitationStatus ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4InvStatus - ) -{ - union iwreq_data evt; - UINT_8 aucBuffer[IW_CUSTOM_MAX]; - - ASSERT(prGlueInfo); - - /* buffer peer information for later IOC_P2P_GET_STRUCT access */ - prGlueInfo->prP2PInfo->u4InvStatus = u4InvStatus; - - // prepare event structure - memset(&evt, 0, sizeof(evt)); - - snprintf(aucBuffer, IW_CUSTOM_MAX-1, "P2P_INV_STATUS"); - evt.data.length = strlen(aucBuffer); - - /* indicate in IWEVCUSTOM event */ - wireless_send_event(prGlueInfo->prP2PInfo->prDevHandler, - IWEVCUSTOM, - &evt, - aucBuffer); - - return; -} /* kalP2PInvitationStatus */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Indicate an event to supplicant for Service Discovery request from other device. -* -* \param[in] prGlueInfo Pointer of GLUE_INFO_T -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalP2PIndicateSDRequest( - IN P_GLUE_INFO_T prGlueInfo, - IN PARAM_MAC_ADDRESS rPeerAddr, - IN UINT_8 ucSeqNum - ) -{ - union iwreq_data evt; - UINT_8 aucBuffer[IW_CUSTOM_MAX]; - - ASSERT(prGlueInfo); - - memset(&evt, 0, sizeof(evt)); - - snprintf(aucBuffer, IW_CUSTOM_MAX-1, "P2P_SD_REQ %d", ucSeqNum); - evt.data.length = strlen(aucBuffer); - - /* indicate IWEVP2PSDREQ event */ - wireless_send_event(prGlueInfo->prP2PInfo->prDevHandler, - IWEVCUSTOM, - &evt, - aucBuffer); - - return; -} /* end of kalP2PIndicateSDRequest() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Indicate an event to supplicant for Service Discovery response -* from other device. -* -* \param[in] prGlueInfo Pointer of GLUE_INFO_T -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -void -kalP2PIndicateSDResponse( - IN P_GLUE_INFO_T prGlueInfo, - IN PARAM_MAC_ADDRESS rPeerAddr, - IN UINT_8 ucSeqNum - ) -{ - union iwreq_data evt; - UINT_8 aucBuffer[IW_CUSTOM_MAX]; - - ASSERT(prGlueInfo); - - memset(&evt, 0, sizeof(evt)); - - snprintf(aucBuffer, IW_CUSTOM_MAX-1, "P2P_SD_RESP %d", ucSeqNum); - evt.data.length = strlen(aucBuffer); - - /* indicate IWEVP2PSDREQ event */ - wireless_send_event(prGlueInfo->prP2PInfo->prDevHandler, - IWEVCUSTOM, - &evt, - aucBuffer); - - return; -} /* end of kalP2PIndicateSDResponse() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Indicate an event to supplicant for Service Discovery TX Done -* from other device. -* -* \param[in] prGlueInfo Pointer of GLUE_INFO_T -* \param[in] ucSeqNum Sequence number of the frame -* \param[in] ucStatus Status code for TX -* -* \retval none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalP2PIndicateTXDone( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 ucSeqNum, - IN UINT_8 ucStatus - ) -{ - union iwreq_data evt; - UINT_8 aucBuffer[IW_CUSTOM_MAX]; - - ASSERT(prGlueInfo); - - memset(&evt, 0, sizeof(evt)); - - snprintf(aucBuffer, IW_CUSTOM_MAX-1, "P2P_SD_XMITTED: %d %d", ucSeqNum, ucStatus); - evt.data.length = strlen(aucBuffer); - - /* indicate IWEVP2PSDREQ event */ - wireless_send_event(prGlueInfo->prP2PInfo->prDevHandler, - IWEVCUSTOM, - &evt, - aucBuffer); - - return; -} /* end of kalP2PIndicateSDResponse() */ - - -struct net_device* -kalP2PGetDevHdlr( - P_GLUE_INFO_T prGlueInfo - ) -{ - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->prP2PInfo); - return prGlueInfo->prP2PInfo->prDevHandler; -} - -#if CFG_SUPPORT_ANTI_PIRACY -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalP2PIndicateSecCheckRsp ( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucRsp, - IN UINT_16 u2RspLen - ) -{ - union iwreq_data evt; - UINT_8 aucBuffer[IW_CUSTOM_MAX]; - - ASSERT(prGlueInfo); - - memset(&evt, 0, sizeof(evt)); - snprintf(aucBuffer, IW_CUSTOM_MAX-1, "P2P_SEC_CHECK_RSP="); - - kalMemCopy(prGlueInfo->prP2PInfo->aucSecCheckRsp, pucRsp, u2RspLen); - evt.data.length = strlen(aucBuffer); - -#if DBG - DBGLOG_MEM8(SEC, LOUD, prGlueInfo->prP2PInfo->aucSecCheckRsp, u2RspLen); -#endif - /* indicate in IWECUSTOM event */ - wireless_send_event(prGlueInfo->prP2PInfo->prDevHandler, - IWEVCUSTOM, - &evt, - aucBuffer); - return; -} /* p2pFsmRunEventRxDisassociation */ -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief -* -* \param[in] prAdapter Pointer of ADAPTER_T -* -* \return none -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalGetChnlList( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_BAND_T eSpecificBand, - IN UINT_8 ucMaxChannelNum, - IN PUINT_8 pucNumOfChannel, - IN P_RF_CHANNEL_INFO_T paucChannelList - ) -{ - rlmDomainGetChnlList(prGlueInfo->prAdapter, - eSpecificBand, - ucMaxChannelNum, - pucNumOfChannel, - paucChannelList); -} /* kalGetChnlList */ - -//////////////////////////////////////ICS SUPPORT////////////////////////////////////// - -VOID -kalP2PIndicateChannelReady ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_64 u8SeqNum, - IN UINT_32 u4ChannelNum, - IN ENUM_BAND_T eBand, - IN ENUM_CHNL_EXT_T eSco, - IN UINT_32 u4Duration - ) -{ - struct ieee80211_channel *prIEEE80211ChnlStruct = (struct ieee80211_channel *)NULL; - RF_CHANNEL_INFO_T rChannelInfo; - enum nl80211_channel_type eChnlType = NL80211_CHAN_NO_HT; - - do { - if (prGlueInfo == NULL) { - break; - } - - - kalMemZero(&rChannelInfo, sizeof(RF_CHANNEL_INFO_T)); - - rChannelInfo.ucChannelNum = u4ChannelNum; - rChannelInfo.eBand = eBand; - - prIEEE80211ChnlStruct = kalP2pFuncGetChannelEntry(prGlueInfo->prP2PInfo, &rChannelInfo); - - kalP2pFuncGetChannelType(eSco, &eChnlType); - - cfg80211_ready_on_channel(prGlueInfo->prP2PInfo->prDevHandler, //struct net_device * dev, - u8SeqNum, //u64 cookie, - prIEEE80211ChnlStruct, //struct ieee80211_channel * chan, - eChnlType, //enum nl80211_channel_type channel_type, - u4Duration, //unsigned int duration, - GFP_KERNEL); //gfp_t gfp /* allocation flags */ - - } while (FALSE); - -} /* kalP2PIndicateChannelReady */ - -VOID -kalP2PIndicateChannelExpired ( - IN P_GLUE_INFO_T prGlueInfo, - IN P_P2P_CHNL_REQ_INFO_T prChnlReqInfo - ) -{ - - P_GL_P2P_INFO_T prGlueP2pInfo = (P_GL_P2P_INFO_T)NULL; - struct ieee80211_channel *prIEEE80211ChnlStruct = (struct ieee80211_channel *)NULL; - enum nl80211_channel_type eChnlType = NL80211_CHAN_NO_HT; - RF_CHANNEL_INFO_T rRfChannelInfo; - - do { - if ((prGlueInfo == NULL) || (prChnlReqInfo == NULL)) { - - ASSERT(FALSE); - break; - } - - prGlueP2pInfo = prGlueInfo->prP2PInfo; - - if (prGlueP2pInfo == NULL) { - ASSERT(FALSE); - break; - } - - - DBGLOG(P2P, TRACE, ("kalP2PIndicateChannelExpired\n")); - - rRfChannelInfo.eBand = prChnlReqInfo->eBand; - rRfChannelInfo.ucChannelNum = prChnlReqInfo->ucReqChnlNum; - - prIEEE80211ChnlStruct = kalP2pFuncGetChannelEntry(prGlueP2pInfo, &rRfChannelInfo); - - - kalP2pFuncGetChannelType(prChnlReqInfo->eChnlSco, - &eChnlType); - - - cfg80211_remain_on_channel_expired(prGlueP2pInfo->prDevHandler, //struct net_device * dev, - prChnlReqInfo->u8Cookie, - prIEEE80211ChnlStruct, - eChnlType, - GFP_KERNEL); - - } while (FALSE); - -} /* kalP2PIndicateChannelExpired */ - -VOID -kalP2PIndicateScanDone ( - IN P_GLUE_INFO_T prGlueInfo, - IN BOOLEAN fgIsAbort - ) -{ - P_GL_P2P_INFO_T prGlueP2pInfo = (P_GL_P2P_INFO_T)NULL; - - do { - if (prGlueInfo == NULL) { - - ASSERT(FALSE); - break; - } - - prGlueP2pInfo = prGlueInfo->prP2PInfo; - - if (prGlueP2pInfo == NULL) { - ASSERT(FALSE); - break; - } - - - if (prGlueP2pInfo->prScanRequest) { - cfg80211_scan_done(prGlueP2pInfo->prScanRequest, - fgIsAbort); - - prGlueP2pInfo->prScanRequest = NULL; - } - - } while (FALSE); - - -} /* kalP2PIndicateScanDone */ - -VOID -kalP2PIndicateBssInfo ( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucFrameBuf, - IN UINT_32 u4BufLen, - IN P_RF_CHANNEL_INFO_T prChannelInfo, - IN INT_32 i4SignalStrength - ) -{ - P_GL_P2P_INFO_T prGlueP2pInfo = (P_GL_P2P_INFO_T)NULL; - struct ieee80211_channel *prChannelEntry = (struct ieee80211_channel *)NULL; - struct ieee80211_mgmt *prBcnProbeRspFrame = (struct ieee80211_mgmt *)pucFrameBuf; - struct cfg80211_bss *prCfg80211Bss = (struct cfg80211_bss *)NULL; - - do { - if ((prGlueInfo == NULL) || (pucFrameBuf == NULL) || (prChannelInfo == NULL)) { - ASSERT(FALSE); - break; - } - - prGlueP2pInfo = prGlueInfo->prP2PInfo; - - if (prGlueP2pInfo == NULL) { - ASSERT(FALSE); - break; - } - - - prChannelEntry = kalP2pFuncGetChannelEntry(prGlueP2pInfo, prChannelInfo); - - if (prChannelEntry == NULL) { - DBGLOG(P2P, TRACE, ("Unknown channel info\n")); - break; - } - - - //rChannelInfo.center_freq = nicChannelNum2Freq((UINT_32)prChannelInfo->ucChannelNum) / 1000; - - prCfg80211Bss = cfg80211_inform_bss_frame(prGlueP2pInfo->wdev.wiphy, //struct wiphy * wiphy, - prChannelEntry, - prBcnProbeRspFrame, - u4BufLen, - i4SignalStrength, - GFP_KERNEL); - - - /* Return this structure. */ - cfg80211_put_bss(prCfg80211Bss); - - } while (FALSE); - - return; - -} /* kalP2PIndicateBssInfo */ - -VOID -kalP2PIndicateMgmtTxStatus ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_64 u8Cookie, - IN BOOLEAN fgIsAck, - IN PUINT_8 pucFrameBuf, - IN UINT_32 u4FrameLen - ) -{ - P_GL_P2P_INFO_T prGlueP2pInfo = (P_GL_P2P_INFO_T)NULL; - - do { - if ((prGlueInfo == NULL) || - (pucFrameBuf == NULL) || - (u4FrameLen == 0)) { - DBGLOG(P2P, TRACE, ("Unexpected pointer PARAM. 0x%lx, 0x%lx, %ld.", prGlueInfo, pucFrameBuf, u4FrameLen)); - ASSERT(FALSE); - break; - } - - prGlueP2pInfo = prGlueInfo->prP2PInfo; - - cfg80211_mgmt_tx_status(prGlueP2pInfo->prDevHandler, //struct net_device * dev, - u8Cookie, - pucFrameBuf, - u4FrameLen, - fgIsAck, - GFP_KERNEL); - - } while (FALSE); - -} /* kalP2PIndicateMgmtTxStatus */ - -VOID -kalP2PIndicateRxMgmtFrame ( - IN P_GLUE_INFO_T prGlueInfo, - IN P_SW_RFB_T prSwRfb - ) -{ -#define DBG_P2P_MGMT_FRAME_INDICATION 0 - P_GL_P2P_INFO_T prGlueP2pInfo = (P_GL_P2P_INFO_T)NULL; - INT_32 i4Freq = 0; - UINT_8 ucChnlNum = 0; -#if DBG_P2P_MGMT_FRAME_INDICATION - P_WLAN_MAC_HEADER_T prWlanHeader = (P_WLAN_MAC_HEADER_T)NULL; -#endif - - - do { - if ((prGlueInfo == NULL) || (prSwRfb == NULL)) { - ASSERT(FALSE); - break; - } - - prGlueP2pInfo = prGlueInfo->prP2PInfo; - - ucChnlNum = prSwRfb->prHifRxHdr->ucHwChannelNum; - -#if DBG_P2P_MGMT_FRAME_INDICATION - - prWlanHeader = (P_WLAN_MAC_HEADER_T)prSwRfb->pvHeader; - - switch (prWlanHeader->u2FrameCtrl) { - case MAC_FRAME_PROBE_REQ: - DBGLOG(P2P, TRACE, ("RX Probe Req at channel %d ", ucChnlNum)); - break; - case MAC_FRAME_PROBE_RSP: - DBGLOG(P2P, TRACE, ("RX Probe Rsp at channel %d ", ucChnlNum)); - break; - case MAC_FRAME_ACTION: - DBGLOG(P2P, TRACE, ("RX Action frame at channel %d ", ucChnlNum)); - break; - default: - DBGLOG(P2P, TRACE, ("RX Packet:%d at channel %d ", prWlanHeader->u2FrameCtrl, ucChnlNum)); - break; - } - - DBGLOG(P2P, TRACE, ("from: "MACSTR"\n", MAC2STR(prWlanHeader->aucAddr2))); -#endif - i4Freq = nicChannelNum2Freq(ucChnlNum) / 1000; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - cfg80211_rx_mgmt(prGlueP2pInfo->prDevHandler, //struct net_device * dev, - i4Freq, - RCPI_TO_dBm(prSwRfb->prHifRxHdr->ucRcpi), - prSwRfb->pvHeader, - prSwRfb->u2PacketLen, - GFP_ATOMIC); -#else - cfg80211_rx_mgmt(prGlueP2pInfo->prDevHandler, //struct net_device * dev, - i4Freq, - prSwRfb->pvHeader, - prSwRfb->u2PacketLen, - GFP_ATOMIC); -#endif - - } while (FALSE); - -} /* kalP2PIndicateRxMgmtFrame */ - -VOID -kalP2PGCIndicateConnectionStatus ( - IN P_GLUE_INFO_T prGlueInfo, - IN P_P2P_CONNECTION_REQ_INFO_T prP2pConnInfo, - IN PUINT_8 pucRxIEBuf, - IN UINT_16 u2RxIELen, - IN UINT_16 u2StatusReason - ) -{ - P_GL_P2P_INFO_T prGlueP2pInfo = (P_GL_P2P_INFO_T)NULL; - - do { - if (prGlueInfo == NULL) { - ASSERT(FALSE); - break; - } - - - prGlueP2pInfo = prGlueInfo->prP2PInfo; - - if (prP2pConnInfo) { - cfg80211_connect_result(prGlueP2pInfo->prDevHandler, //struct net_device * dev, - prP2pConnInfo->aucBssid, - prP2pConnInfo->aucIEBuf, - prP2pConnInfo->u4BufLength, - pucRxIEBuf, - u2RxIELen, - u2StatusReason, - GFP_KERNEL); //gfp_t gfp /* allocation flags */ - prP2pConnInfo->fgIsConnRequest = FALSE; - } - else { - /* Disconnect, what if u2StatusReason == 0? */ - cfg80211_disconnected(prGlueP2pInfo->prDevHandler, //struct net_device * dev, - u2StatusReason, - pucRxIEBuf, - u2RxIELen, - GFP_KERNEL); - } - - - - } while (FALSE); - - -} /* kalP2PGCIndicateConnectionStatus */ - - -VOID -kalP2PGOStationUpdate ( - IN P_GLUE_INFO_T prGlueInfo, - IN P_STA_RECORD_T prCliStaRec, - IN BOOLEAN fgIsNew - ) -{ - P_GL_P2P_INFO_T prP2pGlueInfo = (P_GL_P2P_INFO_T)NULL; - struct station_info rStationInfo; - - do { - if ((prGlueInfo == NULL) || (prCliStaRec == NULL)) { - break; - } - - - prP2pGlueInfo = prGlueInfo->prP2PInfo; - - if (fgIsNew) { - rStationInfo.filled = STATION_INFO_ASSOC_REQ_IES; - rStationInfo.generation = ++prP2pGlueInfo->i4Generation; - - rStationInfo.assoc_req_ies = prCliStaRec->pucAssocReqIe; - rStationInfo.assoc_req_ies_len = prCliStaRec->u2AssocReqIeLen; -// rStationInfo.filled |= STATION_INFO_ASSOC_REQ_IES; - - cfg80211_new_sta(prGlueInfo->prP2PInfo->prDevHandler, //struct net_device * dev, - prCliStaRec->aucMacAddr, - &rStationInfo, - GFP_KERNEL); - } - else { - ++prP2pGlueInfo->i4Generation; - - cfg80211_del_sta(prGlueInfo->prP2PInfo->prDevHandler, //struct net_device * dev, - prCliStaRec->aucMacAddr, - GFP_KERNEL); - } - - - } while (FALSE); - - return; - -} /* kalP2PGOStationUpdate */ - - - - -BOOLEAN -kalP2pFuncGetChannelType( - IN ENUM_CHNL_EXT_T rChnlSco, - OUT enum nl80211_channel_type *channel_type - ) -{ - BOOLEAN fgIsValid = FALSE; - - do { - if (channel_type) { - - switch (rChnlSco) { - case CHNL_EXT_SCN: - *channel_type = NL80211_CHAN_NO_HT; - break; - case CHNL_EXT_SCA: - *channel_type = NL80211_CHAN_HT40MINUS; - break; - case CHNL_EXT_SCB: - *channel_type = NL80211_CHAN_HT40PLUS; - break; - default: - ASSERT(FALSE); - *channel_type = NL80211_CHAN_NO_HT; - break; - } - - } - - fgIsValid = TRUE; - } while (FALSE); - - return fgIsValid; -} /* kalP2pFuncGetChannelType */ - - - - -struct ieee80211_channel * -kalP2pFuncGetChannelEntry ( - IN P_GL_P2P_INFO_T prP2pInfo, - IN P_RF_CHANNEL_INFO_T prChannelInfo - ) -{ - struct ieee80211_channel *prTargetChannelEntry = (struct ieee80211_channel *)NULL; - UINT_32 u4TblSize = 0, u4Idx = 0; - - do { - if ((prP2pInfo == NULL) || (prChannelInfo == NULL)) { - break; - } - - - switch (prChannelInfo->eBand) { - case BAND_2G4: - prTargetChannelEntry = prP2pInfo->wdev.wiphy->bands[IEEE80211_BAND_2GHZ]->channels; - u4TblSize = prP2pInfo->wdev.wiphy->bands[IEEE80211_BAND_2GHZ]->n_channels; - break; - case BAND_5G: - prTargetChannelEntry = prP2pInfo->wdev.wiphy->bands[IEEE80211_BAND_5GHZ]->channels; - u4TblSize = prP2pInfo->wdev.wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; - break; - default: - break; - } - - - if (prTargetChannelEntry == NULL) { - break; - } - - - - for (u4Idx = 0; u4Idx < u4TblSize; u4Idx++, prTargetChannelEntry++) { - if (prTargetChannelEntry->hw_value == prChannelInfo->ucChannelNum) { - break; - } - - } - - - if (u4Idx == u4TblSize) { - prTargetChannelEntry = NULL; - break; - } - - - } while (FALSE); - - return prTargetChannelEntry; -} /* kalP2pFuncGetChannelEntry */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to set the block list of Hotspot -* -* \param[in] -* prGlueInfo -* -* \return -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalP2PSetBlackList ( - IN P_GLUE_INFO_T prGlueInfo, - IN PARAM_MAC_ADDRESS rbssid, - IN BOOLEAN fgIsblock - ) -{ - UINT_8 aucNullAddr[] = NULL_MAC_ADDR; - BOOLEAN fgIsValid = FALSE; - UINT_32 i; - - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->prP2PInfo); - - if(fgIsblock) { - for(i = 0; i < 8; i++) { - if(UNEQUAL_MAC_ADDR(rbssid, aucNullAddr)) { - if(UNEQUAL_MAC_ADDR(&(prGlueInfo->prP2PInfo->aucblackMACList[i]), rbssid)) { - if(EQUAL_MAC_ADDR (&(prGlueInfo->prP2PInfo->aucblackMACList[i]), aucNullAddr)) { - COPY_MAC_ADDR(&(prGlueInfo->prP2PInfo->aucblackMACList[i]), rbssid); - fgIsValid = FALSE; - return fgIsValid; - } - } - } - } - } - else { - for(i = 0; i < 8; i++) { - if(EQUAL_MAC_ADDR(&(prGlueInfo->prP2PInfo->aucblackMACList[i]), rbssid)) { - COPY_MAC_ADDR(&(prGlueInfo->prP2PInfo->aucblackMACList[i]), aucNullAddr); - fgIsValid = FALSE; - return fgIsValid; - } - } - } - - return fgIsValid; - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to compare the black list of Hotspot -* -* \param[in] -* prGlueInfo -* -* \return -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalP2PCmpBlackList ( - IN P_GLUE_INFO_T prGlueInfo, - IN PARAM_MAC_ADDRESS rbssid - ) -{ - UINT_8 aucNullAddr[] = NULL_MAC_ADDR; - BOOLEAN fgIsExsit = FALSE; - UINT_32 i; - - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->prP2PInfo); - - for(i = 0; i < 8; i++) { - if(UNEQUAL_MAC_ADDR(rbssid, aucNullAddr)){ - if(EQUAL_MAC_ADDR(&(prGlueInfo->prP2PInfo->aucblackMACList[i]), rbssid)) { - fgIsExsit = TRUE; - return fgIsExsit; - } - } - } - - return fgIsExsit; - -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to return the max clients of Hotspot -* -* \param[in] -* prGlueInfo -* -* \return -*/ -/*----------------------------------------------------------------------------*/ -VOID -kalP2PSetMaxClients ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4MaxClient - ) -{ - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->prP2PInfo); - - if(u4MaxClient == 0 || prGlueInfo->prP2PInfo->ucMaxClients >= P2P_MAXIMUM_CLIENT_COUNT) - prGlueInfo->prP2PInfo->ucMaxClients = P2P_MAXIMUM_CLIENT_COUNT; - else - prGlueInfo->prP2PInfo->ucMaxClients = u4MaxClient; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief to return the max clients of Hotspot -* -* \param[in] -* prGlueInfo -* -* \return -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalP2PMaxClients ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4NumClient - ) -{ - ASSERT(prGlueInfo); - ASSERT(prGlueInfo->prP2PInfo); - - if(prGlueInfo->prP2PInfo->ucMaxClients) { - if((UINT_8)u4NumClient >= prGlueInfo->prP2PInfo->ucMaxClients) - return TRUE; - else - return FALSE; - } - - return FALSE; -} - - diff --git a/drivers/net/wireless/mt5931/os/linux/gl_proc.c b/drivers/net/wireless/mt5931/os/linux/gl_proc.c deleted file mode 100755 index 3e53176c8991..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/gl_proc.c +++ /dev/null @@ -1,811 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/gl_proc.c#1 $ -*/ - -/*! \file "gl_proc.c" - \brief This file defines the interface which can interact with users in /proc fs. - - Detail description. -*/ - - - -/* -** $Log: gl_proc.c $ - * - * 11 10 2011 cp.wu - * [WCXRP00001098] [MT6620 Wi-Fi][Driver] Replace printk by DBG LOG macros in linux porting layer - * 1. eliminaite direct calls to printk in porting layer. - * 2. replaced by DBGLOG, which would be XLOG on ALPS platforms. - * - * 12 10 2010 kevin.huang - * [WCXRP00000128] [MT6620 Wi-Fi][Driver] Add proc support to Android Driver for debug and driver status check - * Add Linux Proc Support -** \main\maintrunk.MT5921\19 2008-09-02 21:08:37 GMT mtk01461 -** Fix the compile error of SPRINTF() -** \main\maintrunk.MT5921\18 2008-08-10 18:48:28 GMT mtk01461 -** Update for Driver Review -** \main\maintrunk.MT5921\17 2008-08-04 16:52:01 GMT mtk01461 -** Add proc dbg print message of DOMAIN_INDEX level -** \main\maintrunk.MT5921\16 2008-07-10 00:45:16 GMT mtk01461 -** Remove the check of MCR offset, we may use the MCR address which is not align to DW boundary or proprietary usage. -** \main\maintrunk.MT5921\15 2008-06-03 20:49:44 GMT mtk01461 -** \main\maintrunk.MT5921\14 2008-06-02 22:56:00 GMT mtk01461 -** Rename some functions for linux proc -** \main\maintrunk.MT5921\13 2008-06-02 20:23:18 GMT mtk01461 -** Revise PROC mcr read / write for supporting TELNET -** \main\maintrunk.MT5921\12 2008-03-28 10:40:25 GMT mtk01461 -** Remove temporary set desired rate in linux proc -** \main\maintrunk.MT5921\11 2008-01-07 15:07:29 GMT mtk01461 -** Add User Update Desired Rate Set for QA in Linux -** \main\maintrunk.MT5921\10 2007-12-11 00:11:14 GMT mtk01461 -** Fix SPIN_LOCK protection -** \main\maintrunk.MT5921\9 2007-12-04 18:07:57 GMT mtk01461 -** Add additional debug category to proc -** \main\maintrunk.MT5921\8 2007-11-02 01:03:23 GMT mtk01461 -** Unify TX Path for Normal and IBSS Power Save + IBSS neighbor learning -** \main\maintrunk.MT5921\7 2007-10-25 18:08:14 GMT mtk01461 -** Add VOIP SCAN Support & Refine Roaming -** Revision 1.3 2007/07/05 07:25:33 MTK01461 -** Add Linux initial code, modify doc, add 11BB, RF init code -** -** Revision 1.2 2007/06/27 02:18:51 MTK01461 -** Update SCAN_FSM, Initial(Can Load Module), Proc(Can do Reg R/W), TX API -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_os.h" -#include "gl_kal.h" - -#include "wlan_lib.h" -#include "debug.h" - - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define PROC_MCR_ACCESS "mcr" -#define PROC_DRV_STATUS "status" -#define PROC_RX_STATISTICS "rx_statistics" -#define PROC_TX_STATISTICS "tx_statistics" -#define PROC_DBG_LEVEL "dbg_level" - -#define PROC_MCR_ACCESS_MAX_USER_INPUT_LEN 20 -#define PROC_RX_STATISTICS_MAX_USER_INPUT_LEN 10 -#define PROC_TX_STATISTICS_MAX_USER_INPUT_LEN 10 -#define PROC_DBG_LEVEL_MAX_USER_INPUT_LEN 20 -#define PROC_DBG_LEVEL_MAX_DISPLAY_STR_LEN 30 - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ -static UINT_32 u4McrOffset = 0; - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/*! -* \brief The PROC function for reading MCR register to User Space, the offset of -* the MCR is specified in u4McrOffset. -* -* \param[in] page Buffer provided by kernel. -* \param[in out] start Start Address to read(3 methods). -* \param[in] off Offset. -* \param[in] count Allowable number to read. -* \param[out] eof End of File indication. -* \param[in] data Pointer to the private data structure. -* -* \return number of characters print to the buffer from User Space. -*/ -/*----------------------------------------------------------------------------*/ -static int -procMCRRead ( - char *page, - char **start, - off_t off, - int count, - int *eof, - void *data - ) -{ - P_GLUE_INFO_T prGlueInfo; - PARAM_CUSTOM_MCR_RW_STRUC_T rMcrInfo; - UINT_32 u4BufLen; - char *p = page; - UINT_32 u4Count; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - - - ASSERT(data); - - // Kevin: Apply PROC read method 1. - if (off != 0) { - return 0; // To indicate end of file. - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv((struct net_device *)data)); - - rMcrInfo.u4McrOffset = u4McrOffset; - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryMcrRead, - (PVOID)&rMcrInfo, - sizeof(rMcrInfo), - TRUE, - TRUE, - TRUE, - FALSE, - &u4BufLen); - - - SPRINTF(p, ("MCR (0x%08lxh): 0x%08lx\n", - rMcrInfo.u4McrOffset, rMcrInfo.u4McrData)); - - u4Count = (UINT_32)(p - page); - - *eof = 1; - - return (int)u4Count; - -} /* end of procMCRRead() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief The PROC function for writing MCR register to HW or update u4McrOffset -* for reading MCR later. -* -* \param[in] file pointer to file. -* \param[in] buffer Buffer from user space. -* \param[in] count Number of characters to write -* \param[in] data Pointer to the private data structure. -* -* \return number of characters write from User Space. -*/ -/*----------------------------------------------------------------------------*/ -static int -procMCRWrite ( - struct file *file, - const char *buffer, - unsigned long count, - void *data - ) -{ - P_GLUE_INFO_T prGlueInfo; - char acBuf[PROC_MCR_ACCESS_MAX_USER_INPUT_LEN + 1]; // + 1 for "\0" - int i4CopySize; - PARAM_CUSTOM_MCR_RW_STRUC_T rMcrInfo; - UINT_32 u4BufLen; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - - - ASSERT(data); - - i4CopySize = (count < (sizeof(acBuf) - 1)) ? count : (sizeof(acBuf) - 1); - if (copy_from_user(acBuf, buffer, i4CopySize)) { - return 0; - } - acBuf[i4CopySize] = '\0'; - - switch (sscanf(acBuf, "0x%lx 0x%lx", - &rMcrInfo.u4McrOffset, &rMcrInfo.u4McrData)) { - case 2: - /* NOTE: Sometimes we want to test if bus will still be ok, after accessing - * the MCR which is not align to DW boundary. - */ - //if (IS_ALIGN_4(rMcrInfo.u4McrOffset)) - { - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv((struct net_device *)data)); - - u4McrOffset = rMcrInfo.u4McrOffset; - - //printk("Write 0x%lx to MCR 0x%04lx\n", - //rMcrInfo.u4McrOffset, rMcrInfo.u4McrData); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetMcrWrite, - (PVOID)&rMcrInfo, - sizeof(rMcrInfo), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - } - break; - - case 1: - //if (IS_ALIGN_4(rMcrInfo.u4McrOffset)) - { - u4McrOffset = rMcrInfo.u4McrOffset; - } - break; - - default: - break; - } - - return count; - -} /* end of procMCRWrite() */ - -#if 0 -/*----------------------------------------------------------------------------*/ -/*! -* \brief The PROC function for reading Driver Status to User Space. -* -* \param[in] page Buffer provided by kernel. -* \param[in out] start Start Address to read(3 methods). -* \param[in] off Offset. -* \param[in] count Allowable number to read. -* \param[out] eof End of File indication. -* \param[in] data Pointer to the private data structure. -* -* \return number of characters print to the buffer from User Space. -*/ -/*----------------------------------------------------------------------------*/ -static int -procDrvStatusRead ( - char *page, - char **start, - off_t off, - int count, - int *eof, - void *data - ) -{ - P_GLUE_INFO_T prGlueInfo = ((struct net_device *)data)->priv; - char *p = page; - UINT_32 u4Count; - - GLUE_SPIN_LOCK_DECLARATION(); - - - ASSERT(data); - - // Kevin: Apply PROC read method 1. - if (off != 0) { - return 0; // To indicate end of file. - } - - - SPRINTF(p, ("GLUE LAYER STATUS:")); - SPRINTF(p, ("\n==================")); - - SPRINTF(p, ("\n* Number of Pending Frames: %ld\n", - prGlueInfo->u4TxPendingFrameNum)); - - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_FSM); - - wlanoidQueryDrvStatusForLinuxProc(prGlueInfo->prAdapter, p, &u4Count); - - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_FSM); - - u4Count += (UINT_32)(p - page); - - *eof = 1; - - return (int)u4Count; - -} /* end of procDrvStatusRead() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief The PROC function for reading Driver RX Statistic Counters to User Space. -* -* \param[in] page Buffer provided by kernel. -* \param[in out] start Start Address to read(3 methods). -* \param[in] off Offset. -* \param[in] count Allowable number to read. -* \param[out] eof End of File indication. -* \param[in] data Pointer to the private data structure. -* -* \return number of characters print to the buffer from User Space. -*/ -/*----------------------------------------------------------------------------*/ -static int -procRxStatisticsRead ( - char *page, - char **start, - off_t off, - int count, - int *eof, - void *data - ) -{ - P_GLUE_INFO_T prGlueInfo = ((struct net_device *)data)->priv; - char *p = page; - UINT_32 u4Count; - - GLUE_SPIN_LOCK_DECLARATION(); - - - ASSERT(data); - - // Kevin: Apply PROC read method 1. - if (off != 0) { - return 0; // To indicate end of file. - } - - - SPRINTF(p, ("RX STATISTICS (Write 1 to clear):")); - SPRINTF(p, ("\n=================================\n")); - - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_FSM); - - wlanoidQueryRxStatisticsForLinuxProc(prGlueInfo->prAdapter, p, &u4Count); - - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_FSM); - - u4Count += (UINT_32)(p - page); - - *eof = 1; - - return (int)u4Count; - -} /* end of procRxStatisticsRead() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief The PROC function for reset Driver RX Statistic Counters. -* -* \param[in] file pointer to file. -* \param[in] buffer Buffer from user space. -* \param[in] count Number of characters to write -* \param[in] data Pointer to the private data structure. -* -* \return number of characters write from User Space. -*/ -/*----------------------------------------------------------------------------*/ -static int -procRxStatisticsWrite ( - struct file *file, - const char *buffer, - unsigned long count, - void *data - ) -{ - P_GLUE_INFO_T prGlueInfo = ((struct net_device *)data)->priv; - char acBuf[PROC_RX_STATISTICS_MAX_USER_INPUT_LEN + 1]; // + 1 for "\0" - UINT_32 u4CopySize; - UINT_32 u4ClearCounter; - - GLUE_SPIN_LOCK_DECLARATION(); - - - ASSERT(data); - - u4CopySize = (count < (sizeof(acBuf) - 1)) ? count : (sizeof(acBuf) - 1); - copy_from_user(acBuf, buffer, u4CopySize); - acBuf[u4CopySize] = '\0'; - - if (sscanf(acBuf, "%ld", &u4ClearCounter) == 1) { - if (u4ClearCounter == 1) { - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_FSM); - - wlanoidSetRxStatisticsForLinuxProc(prGlueInfo->prAdapter); - - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_FSM); - } - } - - return count; - -} /* end of procRxStatisticsWrite() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief The PROC function for reading Driver TX Statistic Counters to User Space. -* -* \param[in] page Buffer provided by kernel. -* \param[in out] start Start Address to read(3 methods). -* \param[in] off Offset. -* \param[in] count Allowable number to read. -* \param[out] eof End of File indication. -* \param[in] data Pointer to the private data structure. -* -* \return number of characters print to the buffer from User Space. -*/ -/*----------------------------------------------------------------------------*/ -static int -procTxStatisticsRead ( - char *page, - char **start, - off_t off, - int count, - int *eof, - void *data - ) -{ - P_GLUE_INFO_T prGlueInfo = ((struct net_device *)data)->priv; - char *p = page; - UINT_32 u4Count; - - GLUE_SPIN_LOCK_DECLARATION(); - - - ASSERT(data); - - // Kevin: Apply PROC read method 1. - if (off != 0) { - return 0; // To indicate end of file. - } - - - SPRINTF(p, ("TX STATISTICS (Write 1 to clear):")); - SPRINTF(p, ("\n=================================\n")); - - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_FSM); - - wlanoidQueryTxStatisticsForLinuxProc(prGlueInfo->prAdapter, p, &u4Count); - - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_FSM); - - u4Count += (UINT_32)(p - page); - - *eof = 1; - - return (int)u4Count; - -} /* end of procTxStatisticsRead() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief The PROC function for reset Driver TX Statistic Counters. -* -* \param[in] file pointer to file. -* \param[in] buffer Buffer from user space. -* \param[in] count Number of characters to write -* \param[in] data Pointer to the private data structure. -* -* \return number of characters write from User Space. -*/ -/*----------------------------------------------------------------------------*/ -static int -procTxStatisticsWrite ( - struct file *file, - const char *buffer, - unsigned long count, - void *data - ) -{ - P_GLUE_INFO_T prGlueInfo = ((struct net_device *)data)->priv; - char acBuf[PROC_RX_STATISTICS_MAX_USER_INPUT_LEN + 1]; // + 1 for "\0" - UINT_32 u4CopySize; - UINT_32 u4ClearCounter; - - GLUE_SPIN_LOCK_DECLARATION(); - - - ASSERT(data); - - u4CopySize = (count < (sizeof(acBuf) - 1)) ? count : (sizeof(acBuf) - 1); - copy_from_user(acBuf, buffer, u4CopySize); - acBuf[u4CopySize] = '\0'; - - if (sscanf(acBuf, "%ld", &u4ClearCounter) == 1) { - if (u4ClearCounter == 1) { - GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_FSM); - - wlanoidSetTxStatisticsForLinuxProc(prGlueInfo->prAdapter); - - GLUE_RELEASE_SPIN_LOCK(prGlueInfo, SPIN_LOCK_FSM); - } - } - - return count; - -} /* end of procTxStatisticsWrite() */ -#endif - - -#if DBG -static UINT_8 aucDbModuleName[][PROC_DBG_LEVEL_MAX_DISPLAY_STR_LEN] = { - "DBG_INIT_IDX", - "DBG_HAL_IDX", - "DBG_INTR_IDX", - "DBG_REQ_IDX", - "DBG_TX_IDX", - "DBG_RX_IDX", - "DBG_RFTEST_IDX", - "DBG_EMU_IDX", - "DBG_SW1_IDX", - "DBG_SW2_IDX", - "DBG_SW3_IDX", - "DBG_SW4_IDX", - "DBG_HEM_IDX", - "DBG_AIS_IDX", - "DBG_RLM_IDX", - "DBG_MEM_IDX", - "DBG_CNM_IDX", - "DBG_RSN_IDX", - "DBG_BSS_IDX", - "DBG_SCN_IDX", - "DBG_SAA_IDX", - "DBG_AAA_IDX", - "DBG_P2P_IDX", - "DBG_QM_IDX", - "DBG_SEC_IDX", - "DBG_BOW_IDX" - }; - -extern UINT_8 aucDebugModule[]; - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief The PROC function for displaying current Debug Level. -* -* \param[in] page Buffer provided by kernel. -* \param[in out] start Start Address to read(3 methods). -* \param[in] off Offset. -* \param[in] count Allowable number to read. -* \param[out] eof End of File indication. -* \param[in] data Pointer to the private data structure. -* -* \return number of characters print to the buffer from User Space. -*/ -/*----------------------------------------------------------------------------*/ -static int -procDbgLevelRead ( - char *page, - char **start, - off_t off, - int count, - int *eof, - void *data - ) -{ - char *p = page; - int i; - - - - // Kevin: Apply PROC read method 1. - if (off != 0) { - return 0; // To indicate end of file. - } - - for (i = 0; i < (sizeof(aucDbModuleName)/PROC_DBG_LEVEL_MAX_DISPLAY_STR_LEN); i++) { - SPRINTF(p, ("%c %-15s(0x%02x): %02x\n", - ((i == u4DebugModule) ? '*' : ' '), - &aucDbModuleName[i][0], - i, - aucDebugModule[i])); - } - - *eof = 1; - return (int)(p - page); -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief The PROC function for adjusting Debug Level to turn on/off debugging message. -* -* \param[in] file pointer to file. -* \param[in] buffer Buffer from user space. -* \param[in] count Number of characters to write -* \param[in] data Pointer to the private data structure. -* -* \return number of characters write from User Space. -*/ -/*----------------------------------------------------------------------------*/ -static int -procDbgLevelWrite ( - struct file *file, - const char *buffer, - unsigned long count, - void *data - ) -{ - char acBuf[PROC_DBG_LEVEL_MAX_USER_INPUT_LEN + 1]; // + 1 for "\0" - UINT_32 u4CopySize; - UINT_32 u4NewDbgModule, u4NewDbgLevel; - - - u4CopySize = (count < (sizeof(acBuf) - 1)) ? count : (sizeof(acBuf) - 1); - copy_from_user(acBuf, buffer, u4CopySize); - acBuf[u4CopySize] = '\0'; - - if (sscanf(acBuf, "0x%lx 0x%lx", &u4NewDbgModule, &u4NewDbgLevel) == 2) { - if (u4NewDbgModule < DBG_MODULE_NUM) { - u4DebugModule = u4NewDbgModule; - u4NewDbgLevel &= DBG_CLASS_MASK; - aucDebugModule[u4DebugModule] = (UINT_8)u4NewDbgLevel; - } - } - - return count; -} -#endif /* DBG */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function create a PROC fs in linux /proc/net subdirectory. -* -* \param[in] prDev Pointer to the struct net_device. -* \param[in] pucDevName Pointer to the name of net_device. -* -* \return N/A -*/ -/*----------------------------------------------------------------------------*/ -INT_32 -procInitProcfs ( - struct net_device *prDev, - char *pucDevName - ) -{ - P_GLUE_INFO_T prGlueInfo; - struct proc_dir_entry *prEntry; - - - ASSERT(prDev); - - if (init_net.proc_net == (struct proc_dir_entry *)NULL) { - DBGLOG(INIT, INFO, ("init proc fs fail: proc_net == NULL\n")); - return -ENOENT; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - - if (!prGlueInfo) { - DBGLOG(INIT, WARN, ("The OS context is NULL\n")); - return -ENOENT; - } - - - /* - /proc/net/wlan0 - |-- mcr (PROC_MCR_ACCESS) - |-- status (PROC_DRV_STATUS) - |-- rx_statistics (PROC_RX_STATISTICS) - |-- tx_statistics (PROC_TX_STATISTICS) - |-- dbg_level (PROC_DBG_LEVEL) - |-- (end) - */ - - /* - * Directory: Root (/proc/net/wlan0) - */ - - prGlueInfo->pProcRoot = proc_mkdir(pucDevName, init_net.proc_net); - if (prGlueInfo->pProcRoot == NULL) { - return -ENOENT; - } - - /* File Root/mcr (RW) */ - prEntry = create_proc_entry(PROC_MCR_ACCESS, 0, prGlueInfo->pProcRoot); - if (prEntry) { - prEntry->read_proc = procMCRRead; - prEntry->write_proc = procMCRWrite; - prEntry->data = (void *)prDev; - } - -#if 0 - /* File Root/status (RW) */ - prEntry = create_proc_read_entry(PROC_DRV_STATUS, 0, prGlueInfo->pProcRoot, - procDrvStatusRead, prDev); - - /* File Root/rx_statistics (RW) */ - prEntry = create_proc_entry(PROC_RX_STATISTICS, 0, prGlueInfo->pProcRoot); - if (prEntry) { - prEntry->read_proc = procRxStatisticsRead; - prEntry->write_proc = procRxStatisticsWrite; - prEntry->data = (void *)prDev; - } - - /* File Root/tx_statistics (RW) */ - prEntry = create_proc_entry(PROC_TX_STATISTICS, 0, prGlueInfo->pProcRoot); - if (prEntry) { - prEntry->read_proc = procTxStatisticsRead; - prEntry->write_proc = procTxStatisticsWrite; - prEntry->data = (void *)prDev; - } - -#if DBG - /* File Root/dbg_level (RW) */ - prEntry = create_proc_entry(PROC_DBG_LEVEL, 0644, prGlueInfo->pProcRoot); - if (prEntry) { - prEntry->read_proc = procDbgLevelRead; - prEntry->write_proc = procDbgLevelWrite; - } -#endif /* DBG */ -#endif - return 0; - -} /* end of procInitProcfs() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function clean up a PROC fs created by procInitProcfs(). -* -* \param[in] prDev Pointer to the struct net_device. -* \param[in] pucDevName Pointer to the name of net_device. -* -* \return N/A -*/ -/*----------------------------------------------------------------------------*/ -INT_32 -procRemoveProcfs ( - struct net_device *prDev, - char *pucDevName - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - - ASSERT(prDev); - - if (!prDev) { - return -ENOENT; - } - - if (init_net.proc_net == (struct proc_dir_entry *)NULL) { - DBGLOG(INIT, WARN, ("remove proc fs fail: proc_net == NULL\n")); - return -ENOENT; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - if (!prGlueInfo->pProcRoot) { - DBGLOG(INIT, WARN, ("The procfs root is NULL\n")); - return -ENOENT; - } -#if 0 -#if DBG - remove_proc_entry(PROC_DBG_LEVEL, prGlueInfo->pProcRoot); -#endif /* DBG */ - remove_proc_entry(PROC_TX_STATISTICS, prGlueInfo->pProcRoot); - remove_proc_entry(PROC_RX_STATISTICS, prGlueInfo->pProcRoot); - remove_proc_entry(PROC_DRV_STATUS, prGlueInfo->pProcRoot); -#endif - remove_proc_entry(PROC_MCR_ACCESS, prGlueInfo->pProcRoot); - - /* remove root directory (proc/net/wlan0) */ - remove_proc_entry(pucDevName, init_net.proc_net); - - return 0; - -} /* end of procRemoveProcfs() */ - diff --git a/drivers/net/wireless/mt5931/os/linux/gl_rst.c b/drivers/net/wireless/mt5931/os/linux/gl_rst.c deleted file mode 100755 index 80d6e6ba205c..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/gl_rst.c +++ /dev/null @@ -1,473 +0,0 @@ -/* -** $Id: @(#) gl_rst.c@@ -*/ - -/*! \file gl_rst.c - \brief Main routines for supporintg MT6620 whole-chip reset mechanism - - This file contains the support routines of Linux driver for MediaTek Inc. 802.11 - Wireless LAN Adapters. -*/ - - - -/* -** $Log: gl_rst.c $ - * - * 11 10 2011 cp.wu - * [WCXRP00001098] [MT6620 Wi-Fi][Driver] Replace printk by DBG LOG macros in linux porting layer - * 1. eliminaite direct calls to printk in porting layer. - * 2. replaced by DBGLOG, which would be XLOG on ALPS platforms. - * - * 04 22 2011 cp.wu - * [WCXRP00000598] [MT6620 Wi-Fi][Driver] Implementation of interface for communicating with user space process for RESET_START and RESET_END events - * skip power-off handshaking when RESET indication is received. - * - * 04 14 2011 cp.wu - * [WCXRP00000598] [MT6620 Wi-Fi][Driver] Implementation of interface for communicating with user space process for RESET_START and RESET_END events - * 1. add code to put whole-chip resetting trigger when abnormal firmware assertion is detected - * 2. add dummy function for both Win32 and Linux part. - * - * 03 30 2011 cp.wu - * [WCXRP00000598] [MT6620 Wi-Fi][Driver] Implementation of interface for communicating with user space process for RESET_START and RESET_END events - * use netlink unicast instead of broadcast - * -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_os.h" -#include "debug.h" -#include "wlan_lib.h" -#include "gl_wext.h" -#include "precomp.h" -#include -#include -#include - -#if CFG_CHIP_RESET_SUPPORT - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define MAX_BIND_PROCESS (4) - -#define MTK_WIFI_FAMILY_NAME "MTK_WIFI" -#define MTK_WIFI_RESET_START_NAME "RESET_START" -#define MTK_WIFI_RESET_END_NAME "RESET_END" -#define MTK_WIFI_RESET_TEST_NAME "GENETLINK_START" - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -enum { - __MTK_WIFI_ATTR_INVALID, - MTK_WIFI_ATTR_MSG, - __MTK_WIFI_ATTR_MAX, -}; -#define MTK_WIFI_ATTR_MAX (__MTK_WIFI_ATTR_MAX - 1) - - -enum { - __MTK_WIFI_COMMAND_INVALID, - MTK_WIFI_COMMAND_BIND, - MTK_WIFI_COMMAND_RESET, - __MTK_WIFI_COMMAND_MAX, -}; -#define MTK_WIFI_COMMAND_MAX (__MTK_WIFI_COMMAND_MAX - 1) - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ -static UINT_32 mtk_wifi_seqnum = 0; -static int num_bind_process = 0; -static pid_t bind_pid[MAX_BIND_PROCESS]; -static BOOLEAN fgIsResetting = FALSE; - -/* attribute policy */ -static struct nla_policy mtk_wifi_genl_policy[MTK_WIFI_ATTR_MAX + 1] = { - [MTK_WIFI_ATTR_MSG] = { .type = NLA_NUL_STRING }, -}; - -/* family definition */ -static struct genl_family mtk_wifi_gnl_family = { - .id = GENL_ID_GENERATE, - .hdrsize = 0, - .name = MTK_WIFI_FAMILY_NAME, - .version = 1, - .maxattr = MTK_WIFI_ATTR_MAX, -}; - -/* forward declaration */ -static int mtk_wifi_bind( - struct sk_buff *skb, - struct genl_info *info - ); - -static int mtk_wifi_reset( - struct sk_buff *skb, - struct genl_info *info - ); - -/* operation definition */ -static struct genl_ops mtk_wifi_gnl_ops_bind = { - .cmd = MTK_WIFI_COMMAND_BIND, - .flags = 0, - .policy = mtk_wifi_genl_policy, - .doit = mtk_wifi_bind, - .dumpit = NULL, -}; - -static struct genl_ops mtk_wifi_gnl_ops_reset = { - .cmd = MTK_WIFI_COMMAND_RESET, - .flags = 0, - .policy = mtk_wifi_genl_policy, - .doit = mtk_wifi_reset, - .dumpit = NULL, -}; - - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -extern int -mtk_wcn_wmt_msgcb_reg( - ENUM_WMTDRV_TYPE_T eType, - PF_WMT_CB pCb); - -extern int -mtk_wcn_wmt_msgcb_unreg( - ENUM_WMTDRV_TYPE_T eType - ); - -static void * -glResetCallback ( - ENUM_WMTDRV_TYPE_T eSrcType, - ENUM_WMTDRV_TYPE_T eDstType, - ENUM_WMTMSG_TYPE_T eMsgType, - void * prMsgBody, - unsigned int u4MsgLength - ); - -static BOOLEAN -glResetSendMessage ( - char *aucMsg, - u8 cmd - ); - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for - * 1. registering for reset callbacks - * 2. initialize netlink socket - * - * @param none - * - * @retval none - */ -/*----------------------------------------------------------------------------*/ -VOID -glResetInit( - VOID - ) -{ - /* 1. register for reset callback */ - mtk_wcn_wmt_msgcb_reg(WMTDRV_TYPE_WIFI, (PF_WMT_CB)glResetCallback); - - /* 2.1 registration for NETLINK_GENERIC family */ - if(genl_register_family(&mtk_wifi_gnl_family) != 0) { - DBGLOG(INIT, WARN, ("%s(): GE_NELINK family registration fail\n", __func__)); - } - else { - /* 2.2 operation registration */ - if(genl_register_ops(&mtk_wifi_gnl_family, &mtk_wifi_gnl_ops_bind) != 0) { - DBGLOG(INIT, WARN, ("%s(): BIND operation registration fail\n", __func__)); - } - - if(genl_register_ops(&mtk_wifi_gnl_family, &mtk_wifi_gnl_ops_reset) != 0) { - DBGLOG(INIT, WARN, ("%s(): RESET operation registration fail\n", __func__)); - } - } - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is responsible for - * 1. uninitialize netlink socket - * 2. deregistering for reset callbacks - * - * @param none - * - * @retval none - */ -/*----------------------------------------------------------------------------*/ -VOID -glResetUninit( - VOID - ) -{ - /* 1. release NETLINK_GENERIC family */ - genl_unregister_family(&mtk_wifi_gnl_family); - - /* 2. deregister for reset callback */ - mtk_wcn_wmt_msgcb_unreg(WMTDRV_TYPE_WIFI); - - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is invoked when there is reset messages indicated - * - * @param eSrcType - * eDstType - * eMsgType - * prMsgBody - * u4MsgLength - * - * @retval - */ -/*----------------------------------------------------------------------------*/ -static void * -glResetCallback ( - ENUM_WMTDRV_TYPE_T eSrcType, - ENUM_WMTDRV_TYPE_T eDstType, - ENUM_WMTMSG_TYPE_T eMsgType, - void * prMsgBody, - unsigned int u4MsgLength - ) -{ - switch(eMsgType) { - case WMTMSG_TYPE_RESET: - if(u4MsgLength == sizeof(ENUM_WMTRSTMSG_TYPE_T)) { - P_ENUM_WMTRSTMSG_TYPE_T prRstMsg = (P_ENUM_WMTRSTMSG_TYPE_T) prMsgBody; - - switch(*prRstMsg) { - case WMTRSTMSG_RESET_START: - fgIsResetting = TRUE; - glResetSendMessage(MTK_WIFI_RESET_START_NAME, MTK_WIFI_COMMAND_RESET); - break; - - case WMTRSTMSG_RESET_END: - glResetSendMessage(MTK_WIFI_RESET_END_NAME, MTK_WIFI_COMMAND_RESET); - fgIsResetting = FALSE; - break; - - default: - break; - } - } - - break; - - default: - break; - } - - return NULL; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine send out message via netlink socket - * - * @param aucMsg - * u4MsgLength - * - * @retval TRUE - * FALSE - */ -/*----------------------------------------------------------------------------*/ -static BOOLEAN -glResetSendMessage( - char * aucMsg, - u8 cmd - ) -{ - struct sk_buff *skb = NULL; - void *msg_head = NULL; - int rc = -1; - int i; - - if(num_bind_process == 0) { - /* no listening process */ - return FALSE; - } - - for(i = 0 ; i < num_bind_process ; i++) { - skb = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); - - if(skb) { - msg_head = genlmsg_put(skb, 0, mtk_wifi_seqnum++, &mtk_wifi_gnl_family, 0, cmd); - - if(msg_head == NULL) { - nlmsg_free(skb); - return FALSE; - } - - rc = nla_put_string(skb, MTK_WIFI_ATTR_MSG, aucMsg); - if(rc != 0) { - nlmsg_free(skb); - return FALSE; - } - - /* finalize the message */ - genlmsg_end(skb, msg_head); - - /* sending message */ - rc = genlmsg_unicast(&init_net, skb, bind_pid[i]); - if(rc != 0) { - return FALSE; - } - } - else { - return FALSE; - } - } - - return TRUE; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is called to identify PID for process binding - * - * @param skb - * info - * - * @retval 0 - * nonzero - */ -/*----------------------------------------------------------------------------*/ -int mtk_wifi_bind( - struct sk_buff *skb, - struct genl_info *info - ) -{ - struct nlattr *na; - char * mydata; - - if (info == NULL) { - goto out; - } - - /*for each attribute there is an index in info->attrs which points to a nlattr structure - *in this structure the data is given - */ - - na = info->attrs[MTK_WIFI_ATTR_MSG]; - if (na) { - mydata = (char *)nla_data(na); - - /* no need to parse mydata */ - } - - /* collect PID */ - if(num_bind_process < MAX_BIND_PROCESS) { - bind_pid[num_bind_process] = info->snd_pid; - num_bind_process++; - } - else { - DBGLOG(INIT, WARN, ("%s(): exceeding binding limit %d\n", __func__, MAX_BIND_PROCESS)); - } - -out: - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is called for reset, shout not happen - * - * @param skb - * info - * - * @retval 0 - * nonzero - */ -/*----------------------------------------------------------------------------*/ -int mtk_wifi_reset( - struct sk_buff *skb, - struct genl_info *info - ) -{ - DBGLOG(INIT, WARN, ("%s(): should not be invoked\n", __func__)); - - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is called for generating reset request to WMT - * - * @param None - * - * @retval None - */ -/*----------------------------------------------------------------------------*/ -VOID -glSendResetRequest( - VOID - ) -{ - // WMT thread would trigger whole chip resetting itself - return; -} - - -/*----------------------------------------------------------------------------*/ -/*! - * @brief This routine is called for checking if MT6620 is resetting - * - * @param None - * - * @retval TRUE - * FALSE - */ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalIsResetting( - VOID - ) -{ - return fgIsResetting; -} - - -#endif // CFG_CHIP_RESET_SUPPORT diff --git a/drivers/net/wireless/mt5931/os/linux/gl_wext.c b/drivers/net/wireless/mt5931/os/linux/gl_wext.c deleted file mode 100755 index 17e3460a6a48..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/gl_wext.c +++ /dev/null @@ -1,4527 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/gl_wext.c#3 $ -*/ - -/*! \file gl_wext.c - \brief ioctl() (mostly Linux Wireless Extensions) routines for STA driver. -*/ - - - -/* -** $Log: gl_wext.c $ - * - * 06 13 2012 yuche.tsai - * NULL - * Update maintrunk driver. - * Add support for driver compose assoc request frame. - * - * 01 16 2012 wh.su - * [WCXRP00001170] [MT6620 Wi-Fi][Driver] Adding the related code for set/get band ioctl - * Adding the template code for set / get band IOCTL (with ICS supplicant_6).. - * - * 01 05 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the related ioctl / wlan oid function to set the Tx power cfg. - * - * 01 02 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the proto type function for set_int set_tx_power and get int get_ch_list. - * - * 11 10 2011 cp.wu - * [WCXRP00001098] [MT6620 Wi-Fi][Driver] Replace printk by DBG LOG macros in linux porting layer - * 1. eliminaite direct calls to printk in porting layer. - * 2. replaced by DBGLOG, which would be XLOG on ALPS platforms. - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 09 23 2011 tsaiyuan.hsu - * [WCXRP00000979] [MT6620 Wi-Fi][DRV]] stop attempting to connect to config AP after D3 state - * avoid entering D3 state after deep sleep. - * - * 07 28 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings - * Add BWCS cmd and event. - * - * 07 27 2011 wh.su - * [WCXRP00000877] [MT6620 Wi-Fi][Driver] Remove the netif_carry_ok check for avoid the wpa_supplicant fail to query the ap address - * Remove the netif check while query bssid and ssid - * - * 07 26 2011 chinglan.wang - * NULL - * [MT6620][WiFi Driver] Do not include the WSC IE in the association info packet when not do the wps connection.. - * - * 07 18 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add CMD/Event for RDD and BWCS. - * - * 05 17 2011 eddie.chen - * [WCXRP00000603] [MT6620 Wi-Fi][DRV] Fix Klocwork warning - * Initilize the vairlabes. - * - * 05 11 2011 jeffrey.chang - * [WCXRP00000718] [MT6620 Wi-Fi] modify the behavior of setting tx power - * modify set_tx_pow ioctl - * - * 03 29 2011 terry.wu - * [WCXRP00000610] [MT 6620 Wi-Fi][Driver] Fix klocwork waring - * [MT6620 Wi-Fi][Driver] Fix klocwork warning. Add Null pointer check on wext_get_essid. Limit the upper bound of essid storage array. - * - * 03 21 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * improve portability for awareness of early version of linux kernel and wireless extension. - * - * 03 17 2011 chinglan.wang - * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature - * . - * - * 03 07 2011 terry.wu - * [WCXRP00000521] [MT6620 Wi-Fi][Driver] Remove non-standard debug message - * Toggle non-standard debug messages to comments. - * - * 02 21 2011 wh.su - * [WCXRP00000483] [MT6620 Wi-Fi][Driver] Check the kalIoctl return value before doing the memory copy at linux get essid - * fixed the potential error to do a larget memory copy while wlanoid get essid not actually running. - * - * 02 08 2011 george.huang - * [WCXRP00000422] [MT6620 Wi-Fi][Driver] support query power mode OID handler - * Support querying power mode OID. - * - * 01 29 2011 wh.su - * [WCXRP00000408] [MT6620 Wi-Fi][Driver] Not doing memory alloc while ioctl set ie with length 0 - * not doing mem alloc. while set ie length already 0 - * - * 01 20 2011 eddie.chen - * [WCXRP00000374] [MT6620 Wi-Fi][DRV] SW debug control - * Remove debug text. - * - * 01 20 2011 eddie.chen - * [WCXRP00000374] [MT6620 Wi-Fi][DRV] SW debug control - * Adjust OID order. - * - * 01 20 2011 eddie.chen - * [WCXRP00000374] [MT6620 Wi-Fi][DRV] SW debug control - * Add Oid for sw control debug command - * - * 01 11 2011 chinglan.wang - * NULL - * Modify to reslove the CR :[ALPS00028994] Use WEP security to connect Marvell 11N AP. Connection establish successfully. - * Use the WPS function to connect AP, the privacy bit always is set to 1. . - * - * 01 07 2011 cm.chang - * [WCXRP00000336] [MT6620 Wi-Fi][Driver] Add test mode commands in normal phone operation - * Add a new compiling option to control if MCR read/write is permitted - * - * 01 04 2011 cp.wu - * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands - * separate kalMemAlloc() into virtually-continous and physically-continous types - * to ease slab system pressure - * - * 01 04 2011 cp.wu - * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands - * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure - * - * 12 31 2010 cm.chang - * [WCXRP00000336] [MT6620 Wi-Fi][Driver] Add test mode commands in normal phone operation - * Add some iwpriv commands to support test mode operation - * - * 12 15 2010 george.huang - * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function - * Support set PS profile and set WMM-PS related iwpriv. - * - * 12 15 2010 george.huang - * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function - * Allow change PS profile function (throught wext_set_power()). - * - * 12 14 2010 jeffrey.chang - * [WCXRP00000262] [MT6620 Wi-Fi][Driver] modify the scan request ioctl to handle hidden SSID - * handle hidden SSID - * - * 12 13 2010 chinglan.wang - * NULL - * Add WPS 1.0 feature flag to enable the WPS 1.0 function. - * - * 12 07 2010 cm.chang - * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant - * Fix compiling error - * - * 12 07 2010 cm.chang - * [WCXRP00000238] MT6620 Wi-Fi][Driver][FW] Support regulation domain setting from NVRAM and supplicant - * 1. Country code is from NVRAM or supplicant - * 2. Change band definition in CMD/EVENT. - * - * 11 30 2010 cp.wu - * [WCXRP00000213] [MT6620 Wi-Fi][Driver] Implement scanning with specified SSID for wpa_supplicant with ap_scan=1 - * . - * - * 11 08 2010 wh.su - * [WCXRP00000171] [MT6620 Wi-Fi][Driver] Add message check code same behavior as mt5921 - * add the message check code from mt5921. - * - * 10 19 2010 jeffrey.chang - * [WCXRP00000121] [MT6620 Wi-Fi][Driver] Temporarily disable set power mode ioctl which may cause 6620 to enter power saving - * Temporarily disable set power mode ioctl which may cause MT6620 to enter power saving - * - * 10 18 2010 jeffrey.chang - * [WCXRP00000116] [MT6620 Wi-Fi][Driver] Refine the set_scan ioctl to resolve the Android UI hanging issue - * refine the scan ioctl to prevent hanging of Android UI - * - * 10 01 2010 wh.su - * [WCXRP00000067] [MT6620 Wi-Fi][Driver] Support the android+ WAPI function - * add the scan result with wapi ie. - * - * 09 30 2010 wh.su - * [WCXRP00000072] [MT6620 Wi-Fi][Driver] Fix TKIP Counter Measure EAPoL callback register issue - * fixed the wapi ie assigned issue. - * - * 09 27 2010 wh.su - * NULL - * [WCXRP00000067][MT6620 Wi-Fi][Driver] Support the android+ WAPI function. - * - * 09 21 2010 kevin.huang - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * Eliminate Linux Compile Warning - * - * 09 09 2010 cp.wu - * NULL - * add WPS/WPA/RSN IE for Wi-Fi Direct scanning result. - * - * 09 06 2010 cp.wu - * NULL - * Androi/Linux: return current operating channel information - * - * 09 01 2010 wh.su - * NULL - * adding the wapi support for integration test. - * - * 08 02 2010 jeffrey.chang - * NULL - * enable remove key ioctl - * - * 08 02 2010 jeffrey.chang - * NULL - * 1) modify tx service thread to avoid busy looping - * 2) add spin lock declartion for linux build - * - * 07 28 2010 jeffrey.chang - * NULL - * 1) enable encyption ioctls - * 2) temporarily disable remove keys ioctl to prevent TX1 busy - * - * 07 28 2010 jeffrey.chang - * NULL - * 1) remove unused spinlocks - * 2) enable encyption ioctls - * 3) fix scan ioctl which may cause supplicant to hang - * - * 07 19 2010 jeffrey.chang - * - * add kal api for scanning done - * - * 07 19 2010 jeffrey.chang - * - * for linux driver migration - * - * 07 19 2010 jeffrey.chang - * - * Linux port modification - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 28 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * remove unused macro and debug messages - * - * 05 14 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * Add dissassoication support for wpa supplicant - * - * 04 22 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * - * 1) modify rx path code for supporting Wi-Fi direct - * 2) modify config.h since Linux dont need to consider retaining packet - * - * 04 21 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * add for private ioctl support - * - * 04 19 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * Add ioctl of power management - * - * 04 19 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * remove debug message - * - * 04 14 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * 1) prGlueInfo->pvInformationBuffer and prGlueInfo->u4InformationBufferLength are no longer used - * * 2) fix ioctl - * - * 04 12 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * remove debug messages for pre-release - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * rWlanInfo should be placed at adapter rather than glue due to most operations - * * * * * * * * are done in adapter layer. - * - * 04 02 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * fix ioctl type - * - * 04 01 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * enable pmksa cache operation - * - * 03 31 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * fix ioctl which may cause cmdinfo memory leak - * - * 03 31 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * modify the wapi related code for new driver's design. - * - * 03 30 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * emulate NDIS Pending OID facility - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port -** \main\maintrunk.MT5921\38 2009-10-08 10:33:22 GMT mtk01090 -** Avoid accessing private data of net_device directly. Replace with netdev_priv(). Add more checking for input parameters and pointers. -** \main\maintrunk.MT5921\37 2009-09-29 16:49:48 GMT mtk01090 -** Remove unused variables -** \main\maintrunk.MT5921\36 2009-09-28 20:19:11 GMT mtk01090 -** Add private ioctl to carry OID structures. Restructure public/private ioctl interfaces to Linux kernel. -** \main\maintrunk.MT5921\35 2009-09-03 11:42:30 GMT mtk01088 -** adding the wapi ioctl support -** \main\maintrunk.MT5921\34 2009-08-18 22:56:50 GMT mtk01090 -** Add Linux SDIO (with mmc core) support. -** Add Linux 2.6.21, 2.6.25, 2.6.26. -** Fix compile warning in Linux. -** \main\maintrunk.MT5921\33 2009-05-14 22:43:47 GMT mtk01089 -** fix compiling warning -** \main\maintrunk.MT5921\32 2009-05-07 22:26:18 GMT mtk01089 -** Add mandatory and private IO control for Linux BWCS -** \main\maintrunk.MT5921\31 2009-02-07 15:11:14 GMT mtk01088 -** fixed the compiling error -** \main\maintrunk.MT5921\30 2009-02-07 14:46:51 GMT mtk01088 -** add the privacy setting from linux supplicant ap selection -** \main\maintrunk.MT5921\29 2008-11-19 15:18:50 GMT mtk01088 -** fixed the compling error -** \main\maintrunk.MT5921\28 2008-11-19 11:56:18 GMT mtk01088 -** rename some variable with pre-fix to avoid the misunderstanding -** \main\maintrunk.MT5921\27 2008-08-29 16:59:43 GMT mtk01088 -** fixed compiling error -** \main\maintrunk.MT5921\26 2008-08-29 14:55:53 GMT mtk01088 -** adjust the code for meet the coding style, and add assert check -** \main\maintrunk.MT5921\25 2008-06-02 11:15:19 GMT mtk01461 -** Update after wlanoidSetPowerMode changed -** \main\maintrunk.MT5921\24 2008-05-30 15:13:12 GMT mtk01084 -** rename wlanoid -** \main\maintrunk.MT5921\23 2008-03-28 10:40:28 GMT mtk01461 -** Add set desired rate in Linux STD IOCTL -** \main\maintrunk.MT5921\22 2008-03-18 10:31:24 GMT mtk01088 -** add pmkid ioctl and indicate -** \main\maintrunk.MT5921\21 2008-03-11 15:21:24 GMT mtk01461 -** \main\maintrunk.MT5921\20 2008-03-11 14:50:55 GMT mtk01461 -** Refine WPS related priv ioctl for unified interface -** -** \main\maintrunk.MT5921\19 2008-03-06 16:30:41 GMT mtk01088 -** move the configuration code from set essid function, -** remove the non-used code -** \main\maintrunk.MT5921\18 2008-02-21 15:47:09 GMT mtk01461 -** Fix CR[489] -** \main\maintrunk.MT5921\17 2008-02-12 23:38:31 GMT mtk01461 -** Add Set Frequency & Channel oid support for Linux -** \main\maintrunk.MT5921\16 2008-01-24 12:07:34 GMT mtk01461 -** \main\maintrunk.MT5921\15 2008-01-24 12:00:10 GMT mtk01461 -** Modify the wext_essid for set up correct information for IBSS, and fix the wrong input ptr for prAdapter -** \main\maintrunk.MT5921\14 2007-12-06 09:30:12 GMT mtk01425 -** 1. Branch Test -** \main\maintrunk.MT5921\13 2007-12-04 18:07:59 GMT mtk01461 -** fix typo -** \main\maintrunk.MT5921\12 2007-11-30 17:10:21 GMT mtk01425 -** 1. Fix compiling erros -** -** \main\maintrunk.MT5921\11 2007-11-27 10:43:22 GMT mtk01425 -** 1. Add WMM-PS setting -** \main\maintrunk.MT5921\10 2007-11-06 20:33:32 GMT mtk01088 -** fixed the compiler error -** \main\maintrunk.MT5921\9 2007-11-06 19:33:15 GMT mtk01088 -** add WPS code -** \main\maintrunk.MT5921\8 2007-10-30 12:00:44 GMT MTK01425 -** 1. Update wlanQueryInformation -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -#include "gl_os.h" - -#include "config.h" -#include "wlan_oid.h" - -#include "gl_wext.h" -#include "gl_wext_priv.h" - -#include "precomp.h" - -#if CFG_SUPPORT_WAPI -#include "gl_sec.h" -#endif - -/* compatibility to wireless extensions */ -#ifdef WIRELESS_EXT - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -const long channel_freq[] = { - 2412, 2417, 2422, 2427, 2432, 2437, 2442, - 2447, 2452, 2457, 2462, 2467, 2472, 2484 -}; - -#define MAP_CHANNEL_ID_TO_KHZ(ch, khz) { \ - switch (ch) \ - { \ - case 1: khz = 2412000; break; \ - case 2: khz = 2417000; break; \ - case 3: khz = 2422000; break; \ - case 4: khz = 2427000; break; \ - case 5: khz = 2432000; break; \ - case 6: khz = 2437000; break; \ - case 7: khz = 2442000; break; \ - case 8: khz = 2447000; break; \ - case 9: khz = 2452000; break; \ - case 10: khz = 2457000; break; \ - case 11: khz = 2462000; break; \ - case 12: khz = 2467000; break; \ - case 13: khz = 2472000; break; \ - case 14: khz = 2484000; break; \ - case 36: /* UNII */ khz = 5180000; break; \ - case 40: /* UNII */ khz = 5200000; break; \ - case 44: /* UNII */ khz = 5220000; break; \ - case 48: /* UNII */ khz = 5240000; break; \ - case 52: /* UNII */ khz = 5260000; break; \ - case 56: /* UNII */ khz = 5280000; break; \ - case 60: /* UNII */ khz = 5300000; break; \ - case 64: /* UNII */ khz = 5320000; break; \ - case 149: /* UNII */ khz = 5745000; break; \ - case 153: /* UNII */ khz = 5765000; break; \ - case 157: /* UNII */ khz = 5785000; break; \ - case 161: /* UNII */ khz = 5805000; break; \ - case 165: /* UNII */ khz = 5825000; break; \ - case 100: /* HiperLAN2 */ khz = 5500000; break; \ - case 104: /* HiperLAN2 */ khz = 5520000; break; \ - case 108: /* HiperLAN2 */ khz = 5540000; break; \ - case 112: /* HiperLAN2 */ khz = 5560000; break; \ - case 116: /* HiperLAN2 */ khz = 5580000; break; \ - case 120: /* HiperLAN2 */ khz = 5600000; break; \ - case 124: /* HiperLAN2 */ khz = 5620000; break; \ - case 128: /* HiperLAN2 */ khz = 5640000; break; \ - case 132: /* HiperLAN2 */ khz = 5660000; break; \ - case 136: /* HiperLAN2 */ khz = 5680000; break; \ - case 140: /* HiperLAN2 */ khz = 5700000; break; \ - case 34: /* Japan MMAC */ khz = 5170000; break; \ - case 38: /* Japan MMAC */ khz = 5190000; break; \ - case 42: /* Japan MMAC */ khz = 5210000; break; \ - case 46: /* Japan MMAC */ khz = 5230000; break; \ - case 184: /* Japan */ khz = 4920000; break; \ - case 188: /* Japan */ khz = 4940000; break; \ - case 192: /* Japan */ khz = 4960000; break; \ - case 196: /* Japan */ khz = 4980000; break; \ - case 208: /* Japan, means J08 */ khz = 5040000; break; \ - case 212: /* Japan, means J12 */ khz = 5060000; break; \ - case 216: /* Japan, means J16 */ khz = 5080000; break; \ - default: khz = 2412000; break; \ - } \ - } - - -#define NUM_CHANNELS (sizeof(channel_freq) / sizeof(channel_freq[0])) - -#define MAX_SSID_LEN 32 - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ -/* NOTE: name in iwpriv_args only have 16 bytes */ -static const struct iw_priv_args rIwPrivTable[] = { - {IOCTL_SET_INT, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, ""}, - {IOCTL_GET_INT, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, ""}, - {IOCTL_SET_INT, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, ""}, - {IOCTL_GET_INT, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, ""}, - {IOCTL_SET_INT, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, ""}, - - {IOCTL_GET_INT, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, ""}, - {IOCTL_GET_INT, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, ""}, - - {IOCTL_SET_INTS, IW_PRIV_TYPE_INT | 4, 0, ""}, - {IOCTL_GET_INT, 0, IW_PRIV_TYPE_INT | 50, ""}, - - /* added for set_oid and get_oid */ - {IOCTL_SET_STRUCT, 256, 0, ""}, - {IOCTL_GET_STRUCT, 0, 256, ""}, - - /* sub-ioctl definitions */ -#if 0 - {PRIV_CMD_REG_DOMAIN, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_reg_domain" }, - {PRIV_CMD_REG_DOMAIN, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_reg_domain" }, -#endif - -#if CFG_TCP_IP_CHKSUM_OFFLOAD - {PRIV_CMD_CSUM_OFFLOAD, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_tcp_csum" }, -#endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */ - - {PRIV_CMD_POWER_MODE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_power_mode" }, - {PRIV_CMD_POWER_MODE, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_power_mode" }, - - {PRIV_CMD_WMM_PS, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, "set_wmm_ps" }, - - {PRIV_CMD_TEST_MODE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_test_mode" }, - {PRIV_CMD_TEST_CMD, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "set_test_cmd" }, - {PRIV_CMD_TEST_CMD, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_test_result" }, -#if CFG_SUPPORT_PRIV_MCR_RW - {PRIV_CMD_ACCESS_MCR, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "set_mcr" }, - {PRIV_CMD_ACCESS_MCR, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_mcr" }, -#endif - {PRIV_CMD_SW_CTRL, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "set_sw_ctrl" }, - {PRIV_CMD_SW_CTRL, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_sw_ctrl" }, - -#if CFG_SUPPORT_BCM && CFG_SUPPORT_BCM_BWCS - {PRIV_CUSTOM_BWCS_CMD, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_bwcs"}, - /* GET STRUCT sub-ioctls commands */ - {PRIV_CUSTOM_BWCS_CMD, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_bwcs"}, -#endif - - /* SET STRUCT sub-ioctls commands */ - {PRIV_CMD_OID, 256, 0, "set_oid"}, - /* GET STRUCT sub-ioctls commands */ - {PRIV_CMD_OID, 0, 256, "get_oid"}, - - {PRIV_CMD_BAND_CONFIG, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_band" }, - {PRIV_CMD_BAND_CONFIG, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_band" }, - - {PRIV_CMD_SET_TX_POWER, IW_PRIV_TYPE_INT | 4, 0, "set_txpower" }, - {PRIV_CMD_GET_CH_LIST, 0, IW_PRIV_TYPE_INT | 50, "get_ch_list" }, - {PRIV_CMD_DUMP_MEM, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_mem" }, - -#if CFG_ENABLE_WIFI_DIRECT - {PRIV_CMD_P2P_MODE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "set_p2p_mode" }, -#endif -}; - -static const iw_handler rIwPrivHandler[] = { - [IOCTL_SET_INT - SIOCIWFIRSTPRIV] = priv_set_int, - [IOCTL_GET_INT - SIOCIWFIRSTPRIV] = priv_get_int, - [IOCTL_SET_ADDRESS - SIOCIWFIRSTPRIV] = NULL, - [IOCTL_GET_ADDRESS - SIOCIWFIRSTPRIV] = NULL, - [IOCTL_SET_STR - SIOCIWFIRSTPRIV] = NULL, - [IOCTL_GET_STR - SIOCIWFIRSTPRIV] = NULL, - [IOCTL_SET_KEY - SIOCIWFIRSTPRIV] = NULL, - [IOCTL_GET_KEY - SIOCIWFIRSTPRIV] = NULL, - [IOCTL_SET_STRUCT - SIOCIWFIRSTPRIV] = priv_set_struct, - [IOCTL_GET_STRUCT - SIOCIWFIRSTPRIV] = priv_get_struct, - [IOCTL_SET_STRUCT_FOR_EM - SIOCIWFIRSTPRIV] = priv_set_struct, - [IOCTL_SET_INTS - SIOCIWFIRSTPRIV] = priv_set_ints, - [IOCTL_GET_INTS - SIOCIWFIRSTPRIV] = priv_get_ints, -}; - -const struct iw_handler_def wext_handler_def = { - .num_standard = 0, - .num_private = (__u16)sizeof(rIwPrivHandler)/sizeof(iw_handler), - .num_private_args = (__u16)sizeof(rIwPrivTable)/sizeof(struct iw_priv_args), - .standard = (iw_handler *) NULL, - .private = rIwPrivHandler, - .private_args = rIwPrivTable, - .get_wireless_stats = wext_get_wireless_stats, -}; - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Find the desired WPA/RSN Information Element according to desiredElemID. -* -* \param[in] pucIEStart IE starting address. -* \param[in] i4TotalIeLen Total length of all the IE. -* \param[in] ucDesiredElemId Desired element ID. -* \param[out] ppucDesiredIE Pointer to the desired IE. -* -* \retval TRUE Find the desired IE. -* \retval FALSE Desired IE not found. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wextSrchDesiredWPAIE ( - IN PUINT_8 pucIEStart, - IN INT_32 i4TotalIeLen, - IN UINT_8 ucDesiredElemId, - OUT PUINT_8 *ppucDesiredIE - ) -{ - INT_32 i4InfoElemLen; - - ASSERT(pucIEStart); - ASSERT(ppucDesiredIE); - - while (i4TotalIeLen >= 2) { - i4InfoElemLen = (INT_32) pucIEStart[1] + 2; - - if (pucIEStart[0] == ucDesiredElemId && i4InfoElemLen <= i4TotalIeLen) { - if (ucDesiredElemId != 0xDD) { - /* Non 0xDD, OK! */ - *ppucDesiredIE = &pucIEStart[0]; - return TRUE; - } - else { - /* EID == 0xDD, check WPA IE */ - if (pucIEStart[1] >= 4) { - if (memcmp(&pucIEStart[2], "\x00\x50\xf2\x01", 4) == 0) { - *ppucDesiredIE = &pucIEStart[0]; - return TRUE; - } - } /* check WPA IE length */ - } /* check EID == 0xDD */ - } /* check desired EID */ - - /* Select next information element. */ - i4TotalIeLen -= i4InfoElemLen; - pucIEStart += i4InfoElemLen; - } - - return FALSE; -} /* parseSearchDesiredWPAIE */ - - -#if CFG_SUPPORT_WAPI -/*----------------------------------------------------------------------------*/ -/*! -* \brief Find the desired WAPI Information Element . -* -* \param[in] pucIEStart IE starting address. -* \param[in] i4TotalIeLen Total length of all the IE. -* \param[out] ppucDesiredIE Pointer to the desired IE. -* -* \retval TRUE Find the desired IE. -* \retval FALSE Desired IE not found. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wextSrchDesiredWAPIIE ( - IN PUINT_8 pucIEStart, - IN INT_32 i4TotalIeLen, - OUT PUINT_8 *ppucDesiredIE - ) -{ - INT_32 i4InfoElemLen; - - ASSERT(pucIEStart); - ASSERT(ppucDesiredIE); - - while (i4TotalIeLen >= 2) { - i4InfoElemLen = (INT_32) pucIEStart[1] + 2; - - if (pucIEStart[0] == ELEM_ID_WAPI && i4InfoElemLen <= i4TotalIeLen) { - *ppucDesiredIE = &pucIEStart[0]; - return TRUE; - } /* check desired EID */ - - /* Select next information element. */ - i4TotalIeLen -= i4InfoElemLen; - pucIEStart += i4InfoElemLen; - } - - return FALSE; -} /* wextSrchDesiredWAPIIE */ -#endif - - -#if CFG_SUPPORT_WPS -/*----------------------------------------------------------------------------*/ -/*! -* \brief Find the desired WPS Information Element according to desiredElemID. -* -* \param[in] pucIEStart IE starting address. -* \param[in] i4TotalIeLen Total length of all the IE. -* \param[in] ucDesiredElemId Desired element ID. -* \param[out] ppucDesiredIE Pointer to the desired IE. -* -* \retval TRUE Find the desired IE. -* \retval FALSE Desired IE not found. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -wextSrchDesiredWPSIE ( - IN PUINT_8 pucIEStart, - IN INT_32 i4TotalIeLen, - IN UINT_8 ucDesiredElemId, - OUT PUINT_8 *ppucDesiredIE) -{ - INT_32 i4InfoElemLen; - - ASSERT(pucIEStart); - ASSERT(ppucDesiredIE); - - while (i4TotalIeLen >= 2) { - i4InfoElemLen = (INT_32) pucIEStart[1] + 2; - - if (pucIEStart[0] == ucDesiredElemId && i4InfoElemLen <= i4TotalIeLen) { - if (ucDesiredElemId != 0xDD) { - /* Non 0xDD, OK! */ - *ppucDesiredIE = &pucIEStart[0]; - return TRUE; - } - else { - /* EID == 0xDD, check WPS IE */ - if (pucIEStart[1] >= 4) { - if (memcmp(&pucIEStart[2], "\x00\x50\xf2\x04", 4) == 0) { - *ppucDesiredIE = &pucIEStart[0]; - return TRUE; - } - } /* check WPS IE length */ - } /* check EID == 0xDD */ - } /* check desired EID */ - - /* Select next information element. */ - i4TotalIeLen -= i4InfoElemLen; - pucIEStart += i4InfoElemLen; - } - - return FALSE; -} /* parseSearchDesiredWPSIE */ -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Get the name of the protocol used on the air. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[out] pcName Buffer to store protocol name string -* \param[in] pcExtra NULL. -* -* \retval 0 For success. -* -* \note If netif_carrier_ok, protocol name is returned; -* otherwise, "disconnected" is returned. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_get_name ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - OUT char *pcName, - IN char *pcExtra - ) -{ - ENUM_PARAM_NETWORK_TYPE_T eNetWorkType; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(pcName); - if (FALSE == GLUE_CHK_PR2(prNetDev, pcName)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - if (netif_carrier_ok(prNetDev)) { - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryNetworkTypeInUse, - &eNetWorkType, - sizeof(eNetWorkType), - TRUE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - switch(eNetWorkType) { - case PARAM_NETWORK_TYPE_DS: - strcpy(pcName, "IEEE 802.11b"); - break; - case PARAM_NETWORK_TYPE_OFDM24: - strcpy(pcName, "IEEE 802.11bgn"); - break; - case PARAM_NETWORK_TYPE_AUTOMODE: - case PARAM_NETWORK_TYPE_OFDM5: - strcpy(pcName, "IEEE 802.11abgn"); - break; - case PARAM_NETWORK_TYPE_FH: - default: - strcpy(pcName, "IEEE 802.11"); - break; - } - } - else { - strcpy(pcName, "Disconnected"); - } - - return 0; -} /* wext_get_name */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To set the operating channel in the wireless device. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL -* \param[in] prFreq Buffer to store frequency information -* \param[in] pcExtra NULL -* -* \retval 0 For success. -* \retval -EOPNOTSUPP If infrastructure mode is not NET NET_TYPE_IBSS. -* \retval -EINVAL Invalid channel frequency. -* -* \note If infrastructure mode is IBSS, new channel frequency is set to device. -* The range of channel number depends on different regulatory domain. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_set_freq ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN struct iw_freq *prIwFreq, - IN char *pcExtra - ) -{ - -#if 0 - UINT_32 u4ChnlFreq; /* Store channel or frequency information */ - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prIwFreq); - if (FALSE == GLUE_CHK_PR2(prNetDev, prIwFreq)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - /* - printk("set m:%d, e:%d, i:%d, flags:%d\n", - prIwFreq->m, prIwFreq->e, prIwFreq->i, prIwFreq->flags); - */ - - /* If setting by frequency, convert to a channel */ - if ((prIwFreq->e == 1) && - (prIwFreq->m >= (int) 2.412e8) && - (prIwFreq->m <= (int) 2.484e8)) { - - /* Change to KHz format */ - u4ChnlFreq = (UINT_32)(prIwFreq->m / (KILO / 10)); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetFrequency, - &u4ChnlFreq, - sizeof(u4ChnlFreq), - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if (WLAN_STATUS_SUCCESS != rStatus) { - return -EINVAL; - } - } - /* Setting by channel number */ - else if ((prIwFreq->m > KILO) || (prIwFreq->e > 0)) { - return -EOPNOTSUPP; - } - else { - /* Change to channel number format */ - u4ChnlFreq = (UINT_32)prIwFreq->m; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetChannel, - &u4ChnlFreq, - sizeof(u4ChnlFreq), - FALSE, - FALSE, - FALSE, - &u4BufLen); - - - - - if (WLAN_STATUS_SUCCESS != rStatus) { - return -EINVAL; - } - } - -#endif - - return 0; - -} /* wext_set_freq */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To get the operating channel in the wireless device. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[out] prFreq Buffer to store frequency information. -* \param[in] pcExtra NULL. -* -* \retval 0 If netif_carrier_ok. -* \retval -ENOTCONN Otherwise -* -* \note If netif_carrier_ok, channel frequency information is stored in pFreq. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_get_freq ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - OUT struct iw_freq *prIwFreq, - IN char *pcExtra - ) -{ - UINT_32 u4Channel = 0; - - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prIwFreq); - if (FALSE == GLUE_CHK_PR2(prNetDev, prIwFreq)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - /* GeorgeKuo: TODO skip checking in IBSS mode */ - if (!netif_carrier_ok(prNetDev)) { - return -ENOTCONN; - } - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryFrequency, - &u4Channel, - sizeof(u4Channel), - TRUE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - prIwFreq->m = (int) u4Channel; /* freq in KHz */ - prIwFreq->e = 3; - - return 0; - -} /* wext_get_freq */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To set operating mode. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[in] pu4Mode Pointer to new operation mode. -* \param[in] pcExtra NULL. -* -* \retval 0 For success. -* \retval -EOPNOTSUPP If new mode is not supported. -* -* \note Device will run in new operation mode if it is valid. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_set_mode ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN unsigned int *pu4Mode, - IN char *pcExtra - ) -{ - ENUM_PARAM_OP_MODE_T eOpMode; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(pu4Mode); - if (FALSE == GLUE_CHK_PR2(prNetDev, pu4Mode)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - switch (*pu4Mode) { - case IW_MODE_AUTO: - eOpMode = NET_TYPE_AUTO_SWITCH; - break; - - case IW_MODE_ADHOC: - eOpMode = NET_TYPE_IBSS; - break; - - case IW_MODE_INFRA: - eOpMode = NET_TYPE_INFRA; - break; - - default: - DBGLOG(INIT, INFO, ("%s(): Set UNSUPPORTED Mode = %d.\n", __FUNCTION__, *pu4Mode)); - return -EOPNOTSUPP; - } - - //printk("%s(): Set Mode = %d\n", __FUNCTION__, *pu4Mode); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetInfrastructureMode, - &eOpMode, - sizeof(eOpMode), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - - /* after set operation mode, key table are cleared */ - - /* reset wpa info */ - prGlueInfo->rWpaInfo.u4WpaVersion = IW_AUTH_WPA_VERSION_DISABLED; - prGlueInfo->rWpaInfo.u4KeyMgmt = 0; - prGlueInfo->rWpaInfo.u4CipherGroup = IW_AUTH_CIPHER_NONE; - prGlueInfo->rWpaInfo.u4CipherPairwise = IW_AUTH_CIPHER_NONE; - prGlueInfo->rWpaInfo.u4AuthAlg = IW_AUTH_ALG_OPEN_SYSTEM; -#if CFG_SUPPORT_802_11W - prGlueInfo->rWpaInfo.u4Mfp = IW_AUTH_MFP_DISABLED; -#endif - - return 0; -} /* wext_set_mode */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To get operating mode. -* -* \param[in] prNetDev Net device requested. -* \param[in] prIwReqInfo NULL. -* \param[out] pu4Mode Buffer to store operating mode information. -* \param[in] pcExtra NULL. -* -* \retval 0 If data is valid. -* \retval -EINVAL Otherwise. -* -* \note If netif_carrier_ok, operating mode information is stored in pu4Mode. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_get_mode ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - OUT unsigned int *pu4Mode, - IN char *pcExtra - ) -{ - ENUM_PARAM_OP_MODE_T eOpMode; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(pu4Mode); - if (FALSE == GLUE_CHK_PR2(prNetDev, pu4Mode)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryInfrastructureMode, - &eOpMode, - sizeof(eOpMode), - TRUE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - - - switch (eOpMode){ - case NET_TYPE_IBSS: - *pu4Mode = IW_MODE_ADHOC; - break; - - case NET_TYPE_INFRA: - *pu4Mode = IW_MODE_INFRA; - break; - - case NET_TYPE_AUTO_SWITCH: - *pu4Mode = IW_MODE_AUTO; - break; - - default: - DBGLOG(INIT, INFO, ("%s(): Get UNKNOWN Mode.\n", __FUNCTION__)); - return -EINVAL; - } - - return 0; -} /* wext_get_mode */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To get the valid range for each configurable STA setting value. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[in] prData Pointer to iw_point structure, not used. -* \param[out] pcExtra Pointer to buffer which is allocated by caller of this -* function, wext_support_ioctl() or ioctl_standard_call() in -* wireless.c. -* -* \retval 0 If data is valid. -* -* \note The extra buffer (pcExtra) is filled with information from driver. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_get_range ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - IN struct iw_point *prData, - OUT char *pcExtra - ) -{ - struct iw_range *prRange = NULL; - PARAM_RATES_EX aucSuppRate = {0}; /* data buffers */ - int i = 0; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(pcExtra); - if (FALSE == GLUE_CHK_PR2(prNetDev, pcExtra)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - prRange = (struct iw_range *) pcExtra; - - memset(prRange, 0, sizeof(*prRange)); - prRange->throughput = 20000000; /* 20Mbps */ - prRange->min_nwid = 0; /* not used */ - prRange->max_nwid = 0; /* not used */ - - /* scan_capa not implemented */ - - /* event_capa[6]: kernel + driver capabilities */ - prRange->event_capa[0] = (IW_EVENT_CAPA_K_0 - | IW_EVENT_CAPA_MASK(SIOCGIWAP) - | IW_EVENT_CAPA_MASK(SIOCGIWSCAN) - /* can't display meaningful string in iwlist - | IW_EVENT_CAPA_MASK(SIOCGIWTXPOW) - | IW_EVENT_CAPA_MASK(IWEVMICHAELMICFAILURE) - | IW_EVENT_CAPA_MASK(IWEVASSOCREQIE) - | IW_EVENT_CAPA_MASK(IWEVPMKIDCAND) - */ - ); - prRange->event_capa[1] = IW_EVENT_CAPA_K_1; - - /* report 2.4G channel and frequency only */ - prRange->num_channels = (__u16) NUM_CHANNELS; - prRange->num_frequency = (__u8) NUM_CHANNELS; - for (i = 0; i < NUM_CHANNELS; i++) { - /* iwlib takes this number as channel number */ - prRange->freq[i].i = i + 1; - prRange->freq[i].m = channel_freq[i]; - prRange->freq[i].e = 6; /* Values in table in MHz */ - } - - rStatus = kalIoctl( - prGlueInfo, - wlanoidQuerySupportedRates, - &aucSuppRate, - sizeof(aucSuppRate), - TRUE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - - - for (i = 0; i < IW_MAX_BITRATES && i < PARAM_MAX_LEN_RATES_EX ; i++) { - if (aucSuppRate[i] == 0) { - break; - } - prRange->bitrate[i] = (aucSuppRate[i] & 0x7F) * 500000; /* 0.5Mbps */ - } - prRange->num_bitrates = i; - - prRange->min_rts = 0; - prRange->max_rts = 2347; - prRange->min_frag = 256; - prRange->max_frag = 2346; - - prRange->min_pmp = 0; /* power management by driver */ - prRange->max_pmp = 0; /* power management by driver */ - prRange->min_pmt = 0; /* power management by driver */ - prRange->max_pmt = 0; /* power management by driver */ - prRange->pmp_flags = IW_POWER_RELATIVE; /* pm default flag */ - prRange->pmt_flags = IW_POWER_ON; /* pm timeout flag */ - prRange->pm_capa = IW_POWER_ON; /* power management by driver */ - - prRange->encoding_size[0] = 5; /* wep40 */ - prRange->encoding_size[1] = 16; /* tkip */ - prRange->encoding_size[2] = 16; /* ckip */ - prRange->encoding_size[3] = 16; /* ccmp */ - prRange->encoding_size[4] = 13; /* wep104 */ - prRange->encoding_size[5] = 16; /* wep128 */ - prRange->num_encoding_sizes = 6; - prRange->max_encoding_tokens = 6; /* token? */ - -#if WIRELESS_EXT < 17 - prRange->txpower_capa = 0x0002; /* IW_TXPOW_RELATIVE */ -#else - prRange->txpower_capa = IW_TXPOW_RELATIVE; -#endif - prRange->num_txpower = 5; - prRange->txpower[0] = 0; /* minimum */ - prRange->txpower[1] = 25; /* 25% */ - prRange->txpower[2] = 50; /* 50% */ - prRange->txpower[3] = 100; /* 100% */ - - prRange->we_version_compiled = WIRELESS_EXT; - prRange->we_version_source = WIRELESS_EXT; - - prRange->retry_capa = IW_RETRY_LIMIT; - prRange->retry_flags = IW_RETRY_LIMIT; - prRange->min_retry = 7; - prRange->max_retry = 7; - prRange->r_time_flags = IW_RETRY_ON; - prRange->min_r_time = 0; - prRange->max_r_time = 0; - - /* signal strength and link quality */ - /* Just define range here, reporting value moved to wext_get_stats() */ - prRange->sensitivity = -83; /* fixed value */ - prRange->max_qual.qual = 100; /* max 100% */ - prRange->max_qual.level = (__u8)(0x100 - 0); /* max 0 dbm */ - prRange->max_qual.noise = (__u8)(0x100 - 0); /* max 0 dbm */ - - /* enc_capa */ -#if WIRELESS_EXT > 17 - prRange->enc_capa = IW_ENC_CAPA_WPA | - IW_ENC_CAPA_WPA2 | - IW_ENC_CAPA_CIPHER_TKIP | - IW_ENC_CAPA_CIPHER_CCMP; -#endif - - /* min_pms; Minimal PM saving */ - /* max_pms; Maximal PM saving */ - /* pms_flags; How to decode max/min PM saving */ - - /* modul_capa; IW_MODUL_* bit field */ - /* bitrate_capa; Types of bitrates supported */ - - return 0; -} /* wext_get_range */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To set BSSID of AP to connect. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[in] prAddr Pointer to struct sockaddr structure containing AP's BSSID. -* \param[in] pcExtra NULL. -* -* \retval 0 For success. -* -* \note Desired AP's BSSID is set to driver. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_set_ap ( - IN struct net_device *prDev, - IN struct iw_request_info *prIwrInfo, - IN struct sockaddr *prAddr, - IN char *pcExtra - ) -{ - return 0; -} /* wext_set_ap */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To get AP MAC address. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[out] prAddr Pointer to struct sockaddr structure storing AP's BSSID. -* \param[in] pcExtra NULL. -* -* \retval 0 If netif_carrier_ok. -* \retval -ENOTCONN Otherwise. -* -* \note If netif_carrier_ok, AP's mac address is stored in pAddr->sa_data. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_get_ap ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - OUT struct sockaddr *prAddr, - IN char *pcExtra - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prAddr); - if (FALSE == GLUE_CHK_PR2(prNetDev, prAddr)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - //if (!netif_carrier_ok(prNetDev)) { - // return -ENOTCONN; - //} - - if(prGlueInfo->eParamMediaStateIndicated == PARAM_MEDIA_STATE_DISCONNECTED){ - memset(prAddr, 0, 6); - return 0; - } - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryBssid, - prAddr->sa_data, - ETH_ALEN, - TRUE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - return 0; -} /* wext_get_ap */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To set mlme operation request. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[in] prData Pointer of iw_point header. -* \param[in] pcExtra Pointer to iw_mlme structure mlme request information. -* -* \retval 0 For success. -* \retval -EOPNOTSUPP unsupported IW_MLME_ command. -* \retval -EINVAL Set MLME Fail, different bssid. -* -* \note Driver will start mlme operation if valid. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_set_mlme ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - IN struct iw_point *prData, - IN char *pcExtra - ) -{ - struct iw_mlme *prMlme = NULL; - - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(pcExtra); - if (FALSE == GLUE_CHK_PR2(prNetDev, pcExtra)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - prMlme = (struct iw_mlme *)pcExtra; - if (prMlme->cmd == IW_MLME_DEAUTH || prMlme->cmd == IW_MLME_DISASSOC) { - if (!netif_carrier_ok(prNetDev)) { - DBGLOG(INIT, INFO, ("[wifi] Set MLME Deauth/Disassoc, but netif_carrier_off\n")); - return 0; - } - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetDisassociate, - NULL, - 0, - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - return 0; - } - else { - DBGLOG(INIT, INFO, ("[wifi] unsupported IW_MLME_ command :%d\n", prMlme->cmd)); - return -EOPNOTSUPP; - } -} /* wext_set_mlme */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To issue scan request. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[in] prData NULL. -* \param[in] pcExtra NULL. -* -* \retval 0 For success. -* \retval -EFAULT Tx power is off. -* -* \note Device will start scanning. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_set_scan ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - IN union iwreq_data *prData, - IN char *pcExtra - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - int essid_len = 0; - - ASSERT(prNetDev); - if (FALSE == GLUE_CHK_DEV(prNetDev)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - -#if WIRELESS_EXT > 17 - /* retrieve SSID */ - if(prData) { - essid_len = ((struct iw_scan_req *)(((struct iw_point*)prData)->pointer))->essid_len; - } -#endif - - init_completion(&prGlueInfo->rScanComp); - - // TODO: parse flags and issue different scan requests? - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetBssidListScan, - pcExtra, - essid_len, - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - //wait_for_completion_interruptible_timeout(&prGlueInfo->rScanComp, 2 * KAL_HZ); - //kalIndicateStatusAndComplete(prGlueInfo, WLAN_STATUS_SCAN_COMPLETE, NULL, 0); - - - return 0; -} /* wext_set_scan */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To write the ie to buffer -* -*/ -/*----------------------------------------------------------------------------*/ -static inline int snprintf_hex(char *buf, size_t buf_size, const u8 *data, - size_t len) -{ - size_t i; - char *pos = buf, *end = buf + buf_size; - int ret; - - if (buf_size == 0) - return 0; - - for (i = 0; i < len; i++) { - ret = snprintf(pos, end - pos, "%02x", - data[i]); - if (ret < 0 || ret >= end - pos) { - end[-1] = '\0'; - return pos - buf; - } - pos += ret; - } - end[-1] = '\0'; - return pos - buf; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To get scan results, transform results from driver's format to WE's. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[out] prData Pointer to iw_point structure, pData->length is the size of -* pcExtra buffer before used, and is updated after filling scan -* results. -* \param[out] pcExtra Pointer to buffer which is allocated by caller of this -* function, wext_support_ioctl() or ioctl_standard_call() in -* wireless.c. -* -* \retval 0 For success. -* \retval -ENOMEM If dynamic memory allocation fail. -* \retval -E2BIG Invalid length. -* -* \note Scan results is filled into pcExtra buffer, data size is updated in -* pData->length. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_get_scan ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - IN OUT struct iw_point *prData, - IN char *pcExtra - ) -{ - UINT_32 i = 0; - UINT_32 j = 0; - P_PARAM_BSSID_LIST_EX_T prList = NULL; - P_PARAM_BSSID_EX_T prBss = NULL; - P_PARAM_VARIABLE_IE_T prDesiredIE = NULL; - struct iw_event iwEvent; /* local iw_event buffer */ - - /* write pointer of extra buffer */ - char *pcCur = NULL; - /* pointer to the end of last full entry in extra buffer */ - char *pcValidEntryEnd = NULL; - char *pcEnd = NULL; /* end of extra buffer */ - - UINT_32 u4AllocBufLen = 0; - - /* arrange rate information */ - UINT_32 u4HighestRate = 0; - char aucRatesBuf[64]; - UINT_32 u4BufIndex; - - /* return value */ - int ret = 0; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prData); - ASSERT(pcExtra); - if (FALSE == GLUE_CHK_PR3(prNetDev, prData, pcExtra)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - /* Initialize local variables */ - pcCur = pcExtra; - pcValidEntryEnd = pcExtra; - pcEnd = pcExtra + prData->length; /* end of extra buffer */ - - /* Allocate another query buffer with the same size of extra buffer */ - u4AllocBufLen = prData->length; - prList = kalMemAlloc(u4AllocBufLen, VIR_MEM_TYPE); - if (prList == NULL) { - DBGLOG(INIT, INFO, ("[wifi] no memory for scan list:%d\n", prData->length)); - ret = -ENOMEM; - goto error; - } - prList->u4NumberOfItems = 0; - - /* wait scan done */ - //printk ("wait for scan results\n"); - //wait_for_completion_interruptible_timeout(&prGlueInfo->rScanComp, 4 * KAL_HZ); - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryBssidList, - prList, - u4AllocBufLen, - TRUE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if (rStatus == WLAN_STATUS_INVALID_LENGTH) { - /* Buffer length is not large enough. */ - //printk(KERN_INFO "[wifi] buf:%d result:%ld\n", pData->length, u4BufLen); - -#if WIRELESS_EXT >= 17 - /* This feature is supported in WE-17 or above, limited by iwlist. - ** Return -E2BIG and iwlist will request again with a larger buffer. - */ - ret = -E2BIG; - /* Update length to give application a hint on result length */ - prData->length = (__u16)u4BufLen; - goto error; -#else - /* Realloc a larger query buffer here, but don't write too much to extra - ** buffer when filling it later. - */ - kalMemFree(prList, VIR_MEM_TYPE, u4AllocBufLen); - - u4AllocBufLen = u4BufLen; - prList = kalMemAlloc(u4AllocBufLen, VIR_MEM_TYPE); - if (prList == NULL) { - DBGLOG(INIT, INFO, ("[wifi] no memory for larger scan list :%ld\n", u4BufLen)); - ret = -ENOMEM; - goto error; - } - prList->NumberOfItems = 0; - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryBssidList, - prList, - u4AllocBufLen, - TRUE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if (rStatus == WLAN_STATUS_INVALID_LENGTH) { - DBGLOG(INIT, INFO, ("[wifi] larger buf:%d result:%ld\n", u4AllocBufLen, u4BufLen)); - ret = -E2BIG; - prData->length = (__u16)u4BufLen; - goto error; - } -#endif /* WIRELESS_EXT >= 17 */ - - } - - - if (prList->u4NumberOfItems > CFG_MAX_NUM_BSS_LIST) { - DBGLOG(INIT, INFO, ("[wifi] strange scan result count:%ld\n", - prList->u4NumberOfItems)); - goto error; - } - - /* Copy required data from pList to pcExtra */ - prBss = &prList->arBssid[0]; /* set to the first entry */ - for (i = 0; i < prList->u4NumberOfItems; ++i) { - /* BSSID */ - iwEvent.cmd = SIOCGIWAP; - iwEvent.len = IW_EV_ADDR_LEN; - if ((pcCur + iwEvent.len) > pcEnd) - break; - iwEvent.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwEvent.u.ap_addr.sa_data, prBss->arMacAddress, ETH_ALEN); - memcpy(pcCur, &iwEvent, IW_EV_ADDR_LEN); - pcCur += IW_EV_ADDR_LEN; - - /* SSID */ - iwEvent.cmd = SIOCGIWESSID; - /* Modification to user space pointer(essid.pointer) is not needed. */ - iwEvent.u.essid.length = (__u16)prBss->rSsid.u4SsidLen; - iwEvent.len = IW_EV_POINT_LEN + iwEvent.u.essid.length; - - if ((pcCur + iwEvent.len) > pcEnd) - break; - iwEvent.u.essid.flags = 1; - iwEvent.u.essid.pointer = NULL; - -#if WIRELESS_EXT <= 18 - memcpy(pcCur, &iwEvent, iwEvent.len); -#else - memcpy(pcCur, &iwEvent, IW_EV_LCP_LEN); - memcpy(pcCur + IW_EV_LCP_LEN, - &iwEvent.u.data.length, - sizeof(struct iw_point) - IW_EV_POINT_OFF); -#endif - memcpy(pcCur + IW_EV_POINT_LEN, prBss->rSsid.aucSsid, iwEvent.u.essid.length); - pcCur += iwEvent.len; - /* Frequency */ - iwEvent.cmd = SIOCGIWFREQ; - iwEvent.len = IW_EV_FREQ_LEN; - if ((pcCur + iwEvent.len) > pcEnd) - break; - iwEvent.u.freq.m = prBss->rConfiguration.u4DSConfig; - iwEvent.u.freq.e = 3; /* (in KHz) */ - iwEvent.u.freq.i = 0; - memcpy(pcCur, &iwEvent, IW_EV_FREQ_LEN); - pcCur += IW_EV_FREQ_LEN; - - /* Operation Mode */ - iwEvent.cmd = SIOCGIWMODE; - iwEvent.len = IW_EV_UINT_LEN; - if ((pcCur + iwEvent.len) > pcEnd) - break; - if (prBss->eOpMode == NET_TYPE_IBSS) { - iwEvent.u.mode = IW_MODE_ADHOC; - } - else if (prBss->eOpMode == NET_TYPE_INFRA) { - iwEvent.u.mode = IW_MODE_INFRA; - } - else { - iwEvent.u.mode = IW_MODE_AUTO; - } - memcpy(pcCur, &iwEvent, IW_EV_UINT_LEN); - pcCur += IW_EV_UINT_LEN; - - /* Quality */ - iwEvent.cmd = IWEVQUAL; - iwEvent.len = IW_EV_QUAL_LEN; - if ((pcCur + iwEvent.len) > pcEnd) - break; - iwEvent.u.qual.qual = 0; /* Quality not available now */ - /* -100 < Rssi < -10, normalized by adding 0x100 */ - iwEvent.u.qual.level = 0x100 + prBss->rRssi; - iwEvent.u.qual.noise = 0; /* Noise not available now */ - iwEvent.u.qual.updated = IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_UPDATED \ - | IW_QUAL_NOISE_INVALID; - memcpy(pcCur, &iwEvent, IW_EV_QUAL_LEN); - pcCur += IW_EV_QUAL_LEN; - - /* Security Mode*/ - iwEvent.cmd = SIOCGIWENCODE; - iwEvent.len = IW_EV_POINT_LEN; - if ((pcCur + iwEvent.len) > pcEnd) - break; - iwEvent.u.data.pointer = NULL; - iwEvent.u.data.flags = 0; - iwEvent.u.data.length = 0; - if(!prBss->u4Privacy) { - iwEvent.u.data.flags |= IW_ENCODE_DISABLED; - } -#if WIRELESS_EXT <= 18 - memcpy(pcCur, &iwEvent, IW_EV_POINT_LEN); -#else - memcpy(pcCur, &iwEvent, IW_EV_LCP_LEN); - memcpy(pcCur + IW_EV_LCP_LEN, - &iwEvent.u.data.length, - sizeof(struct iw_point) - IW_EV_POINT_OFF); -#endif - pcCur += IW_EV_POINT_LEN; - - /* rearrange rate information */ - u4BufIndex = sprintf(aucRatesBuf, "Rates (Mb/s):"); - u4HighestRate = 0; - for (j = 0; j < PARAM_MAX_LEN_RATES_EX; ++j) { - UINT_8 curRate = prBss->rSupportedRates[j] & 0x7F; - if (curRate == 0) { - break; - } - - if (curRate > u4HighestRate) { - u4HighestRate = curRate; - } - - if (curRate == RATE_5_5M) { - u4BufIndex += sprintf(aucRatesBuf + u4BufIndex, " 5.5"); - } - else { - u4BufIndex += sprintf(aucRatesBuf + u4BufIndex, " %d", curRate / 2); - } - #if DBG - if (u4BufIndex > sizeof(aucRatesBuf)) { - //printk("rate info too long\n"); - break; - } - #endif - } - /* Report Highest Rates */ - iwEvent.cmd = SIOCGIWRATE; - iwEvent.len = IW_EV_PARAM_LEN; - if ((pcCur + iwEvent.len) > pcEnd) - break; - iwEvent.u.bitrate.value = u4HighestRate * 500000; - iwEvent.u.bitrate.fixed = 0; - iwEvent.u.bitrate.disabled = 0; - iwEvent.u.bitrate.flags = 0; - memcpy(pcCur, &iwEvent, iwEvent.len); - pcCur += iwEvent.len; - - #if WIRELESS_EXT >= 15 /* IWEVCUSTOM is available in WE-15 or above */ - /* Report Residual Rates */ - iwEvent.cmd = IWEVCUSTOM; - iwEvent.u.data.length = u4BufIndex; - iwEvent.len = IW_EV_POINT_LEN + iwEvent.u.data.length; - if ((pcCur + iwEvent.len) > pcEnd) - break; - iwEvent.u.data.flags = 0; - #if WIRELESS_EXT <= 18 - memcpy(pcCur, &iwEvent, IW_EV_POINT_LEN); - #else - memcpy(pcCur, &iwEvent, IW_EV_LCP_LEN); - memcpy(pcCur + IW_EV_LCP_LEN, - &iwEvent.u.data.length, - sizeof(struct iw_point) - IW_EV_POINT_OFF); - #endif - memcpy(pcCur + IW_EV_POINT_LEN, aucRatesBuf, u4BufIndex); - pcCur += iwEvent.len; - #endif /* WIRELESS_EXT >= 15 */ - - - if (wextSrchDesiredWPAIE(&prBss->aucIEs[sizeof(PARAM_FIXED_IEs)], - prBss->u4IELength - sizeof(PARAM_FIXED_IEs), - 0xDD, - (PUINT_8 *)&prDesiredIE)) { - iwEvent.cmd = IWEVGENIE; - iwEvent.u.data.flags = 1; - iwEvent.u.data.length = 2 + (__u16)prDesiredIE->ucLength; - iwEvent.len = IW_EV_POINT_LEN + iwEvent.u.data.length; - if ((pcCur + iwEvent.len) > pcEnd) - break; -#if WIRELESS_EXT <= 18 - memcpy(pcCur, &iwEvent, IW_EV_POINT_LEN); -#else - memcpy(pcCur, &iwEvent, IW_EV_LCP_LEN); - memcpy(pcCur + IW_EV_LCP_LEN, - &iwEvent.u.data.length, - sizeof(struct iw_point) - IW_EV_POINT_OFF); -#endif - memcpy(pcCur + IW_EV_POINT_LEN, prDesiredIE, 2 + prDesiredIE->ucLength); - pcCur += iwEvent.len; - } - -#if CFG_SUPPORT_WPS /* search WPS IE (0xDD, 221, OUI: 0x0050f204 ) */ - if (wextSrchDesiredWPSIE(&prBss->aucIEs[sizeof(PARAM_FIXED_IEs)], - prBss->u4IELength - sizeof(PARAM_FIXED_IEs), - 0xDD, - (PUINT_8 *)&prDesiredIE)) { - iwEvent.cmd = IWEVGENIE; - iwEvent.u.data.flags = 1; - iwEvent.u.data.length = 2 + (__u16)prDesiredIE->ucLength; - iwEvent.len = IW_EV_POINT_LEN + iwEvent.u.data.length; - if ((pcCur + iwEvent.len) > pcEnd) - break; -#if WIRELESS_EXT <= 18 - memcpy(pcCur, &iwEvent, IW_EV_POINT_LEN); -#else - memcpy(pcCur, &iwEvent, IW_EV_LCP_LEN); - memcpy(pcCur + IW_EV_LCP_LEN, - &iwEvent.u.data.length, - sizeof(struct iw_point) - IW_EV_POINT_OFF); -#endif - memcpy(pcCur + IW_EV_POINT_LEN, prDesiredIE, 2 + prDesiredIE->ucLength); - pcCur += iwEvent.len; - } -#endif - - - /* Search RSN IE (0x30, 48). pBss->IEs starts from timestamp. */ - /* pBss->IEs starts from timestamp */ - if (wextSrchDesiredWPAIE(&prBss->aucIEs[sizeof(PARAM_FIXED_IEs)], - prBss->u4IELength -sizeof(PARAM_FIXED_IEs), - 0x30, - (PUINT_8 *)&prDesiredIE)) { - - iwEvent.cmd = IWEVGENIE; - iwEvent.u.data.flags = 1; - iwEvent.u.data.length = 2 + (__u16)prDesiredIE->ucLength; - iwEvent.len = IW_EV_POINT_LEN + iwEvent.u.data.length; - if ((pcCur + iwEvent.len) > pcEnd) - break; -#if WIRELESS_EXT <= 18 - memcpy(pcCur, &iwEvent, IW_EV_POINT_LEN); -#else - memcpy(pcCur, &iwEvent, IW_EV_LCP_LEN); - memcpy(pcCur + IW_EV_LCP_LEN, - &iwEvent.u.data.length, - sizeof(struct iw_point) - IW_EV_POINT_OFF); -#endif - memcpy(pcCur + IW_EV_POINT_LEN, prDesiredIE, 2 + prDesiredIE->ucLength); - pcCur += iwEvent.len; - } - -#if CFG_SUPPORT_WAPI /* Android+ */ - if (wextSrchDesiredWAPIIE(&prBss->aucIEs[sizeof(PARAM_FIXED_IEs)], - prBss->u4IELength -sizeof(PARAM_FIXED_IEs), - (PUINT_8 *)&prDesiredIE)) { - -#if 0 - iwEvent.cmd = IWEVGENIE; - iwEvent.u.data.flags = 1; - iwEvent.u.data.length = 2 + (__u16)prDesiredIE->ucLength; - iwEvent.len = IW_EV_POINT_LEN + iwEvent.u.data.length; - if ((pcCur + iwEvent.len) > pcEnd) - break; -#if WIRELESS_EXT <= 18 - memcpy(pcCur, &iwEvent, IW_EV_POINT_LEN); -#else - memcpy(pcCur, &iwEvent, IW_EV_LCP_LEN); - memcpy(pcCur + IW_EV_LCP_LEN, - &iwEvent.u.data.length, - sizeof(struct iw_point) - IW_EV_POINT_OFF); -#endif - memcpy(pcCur + IW_EV_POINT_LEN, prDesiredIE, 2 + prDesiredIE->ucLength); - pcCur += iwEvent.len; -#else - iwEvent.cmd = IWEVCUSTOM; - iwEvent.u.data.length = (2 + prDesiredIE->ucLength) * 2 + 8 /* wapi_ie= */; - iwEvent.len = IW_EV_POINT_LEN + iwEvent.u.data.length; - if ((pcCur + iwEvent.len) > pcEnd) - break; - iwEvent.u.data.flags = 1; - - memcpy(pcCur, &iwEvent, IW_EV_LCP_LEN); - memcpy(pcCur + IW_EV_LCP_LEN, - &iwEvent.u.data.length, - sizeof(struct iw_point) - IW_EV_POINT_OFF); - - pcCur += (IW_EV_POINT_LEN); - - pcCur += sprintf(pcCur, "wapi_ie="); - - snprintf_hex(pcCur, pcEnd - pcCur, (UINT_8 *)prDesiredIE, prDesiredIE->ucLength + 2); - - pcCur += (2 + prDesiredIE->ucLength) * 2 /* iwEvent.len */; -#endif - } -#endif - /* Complete an entry. Update end of valid entry */ - pcValidEntryEnd = pcCur; - /* Extract next bss */ - prBss = (P_PARAM_BSSID_EX_T)((char *)prBss + prBss->u4Length); - } - - /* Update valid data length for caller function and upper layer - * applications. - */ - prData->length = (pcValidEntryEnd - pcExtra); - //printk(KERN_INFO "[wifi] buf:%d result:%ld\n", pData->length, u4BufLen); - - //kalIndicateStatusAndComplete(prGlueInfo, WLAN_STATUS_SCAN_COMPLETE, NULL, 0); - -error: - /* free local query buffer */ - if (prList) { - kalMemFree(prList, VIR_MEM_TYPE, u4AllocBufLen); - } - - return ret; -} /* wext_get_scan */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To set desired network name ESSID. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[in] prEssid Pointer of iw_point header. -* \param[in] pcExtra Pointer to buffer srtoring essid string. -* -* \retval 0 If netif_carrier_ok. -* \retval -E2BIG Essid string length is too big. -* \retval -EINVAL pcExtra is null pointer. -* \retval -EFAULT Driver fail to set new essid. -* -* \note If string lengh is ok, device will try connecting to the new network. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_set_essid ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - IN struct iw_point *prEssid, - IN char *pcExtra - ) -{ - PARAM_SSID_T rNewSsid; - UINT_32 cipher; - ENUM_PARAM_ENCRYPTION_STATUS_T eEncStatus; - ENUM_PARAM_AUTH_MODE_T eAuthMode; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prEssid); - ASSERT(pcExtra); - if (FALSE == GLUE_CHK_PR3(prNetDev, prEssid, pcExtra)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - if (prEssid->length > IW_ESSID_MAX_SIZE) { - return -E2BIG; - } - - - /* set auth mode */ - if (prGlueInfo->rWpaInfo.u4WpaVersion == IW_AUTH_WPA_VERSION_DISABLED) { - eAuthMode = (prGlueInfo->rWpaInfo.u4AuthAlg == IW_AUTH_ALG_OPEN_SYSTEM) ? - AUTH_MODE_OPEN : AUTH_MODE_AUTO_SWITCH; - //printk(KERN_INFO "IW_AUTH_WPA_VERSION_DISABLED->Param_AuthMode%s\n", - // (eAuthMode == AUTH_MODE_OPEN) ? "Open" : "Shared"); - } - else { - /* set auth mode */ - switch(prGlueInfo->rWpaInfo.u4KeyMgmt) { - case IW_AUTH_KEY_MGMT_802_1X: - eAuthMode = - (prGlueInfo->rWpaInfo.u4WpaVersion == IW_AUTH_WPA_VERSION_WPA) ? - AUTH_MODE_WPA : AUTH_MODE_WPA2; - //printk("IW_AUTH_KEY_MGMT_802_1X->AUTH_MODE_WPA%s\n", - // (eAuthMode == AUTH_MODE_WPA) ? "" : "2"); - break; - case IW_AUTH_KEY_MGMT_PSK: - eAuthMode = - (prGlueInfo->rWpaInfo.u4WpaVersion == IW_AUTH_WPA_VERSION_WPA) ? - AUTH_MODE_WPA_PSK: AUTH_MODE_WPA2_PSK; - //printk("IW_AUTH_KEY_MGMT_PSK->AUTH_MODE_WPA%sPSK\n", - // (eAuthMode == AUTH_MODE_WPA_PSK) ? "" : "2"); - break; -#if CFG_SUPPORT_WAPI /* Android+ */ - case IW_AUTH_KEY_MGMT_WAPI_PSK: - break; - case IW_AUTH_KEY_MGMT_WAPI_CERT: - break; -#endif - -//#if defined (IW_AUTH_KEY_MGMT_WPA_NONE) -// case IW_AUTH_KEY_MGMT_WPA_NONE: -// eAuthMode = AUTH_MODE_WPA_NONE; -// //printk("IW_AUTH_KEY_MGMT_WPA_NONE->AUTH_MODE_WPA_NONE\n"); -// break; -//#endif -#if CFG_SUPPORT_802_11W - case IW_AUTH_KEY_MGMT_802_1X_SHA256: - eAuthMode = AUTH_MODE_WPA2; - break; - case IW_AUTH_KEY_MGMT_PSK_SHA256: - eAuthMode = AUTH_MODE_WPA2_PSK; - break; -#endif - default: - //printk(KERN_INFO DRV_NAME"strange IW_AUTH_KEY_MGMT : %ld set auto switch\n", - // prGlueInfo->rWpaInfo.u4KeyMgmt); - eAuthMode = AUTH_MODE_AUTO_SWITCH; - break; - } - } - - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetAuthMode, - &eAuthMode, - sizeof(eAuthMode), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - /* set encryption status */ - cipher = prGlueInfo->rWpaInfo.u4CipherGroup | - prGlueInfo->rWpaInfo.u4CipherPairwise; - if (cipher & IW_AUTH_CIPHER_CCMP) { - //printk("IW_AUTH_CIPHER_CCMP->ENUM_ENCRYPTION3_ENABLED\n"); - eEncStatus = ENUM_ENCRYPTION3_ENABLED; - } - else if (cipher & IW_AUTH_CIPHER_TKIP) { - //printk("IW_AUTH_CIPHER_TKIP->ENUM_ENCRYPTION2_ENABLED\n"); - eEncStatus = ENUM_ENCRYPTION2_ENABLED; - } - else if (cipher & (IW_AUTH_CIPHER_WEP104 | IW_AUTH_CIPHER_WEP40)) { - //printk("IW_AUTH_CIPHER_WEPx->ENUM_ENCRYPTION1_ENABLED\n"); - eEncStatus = ENUM_ENCRYPTION1_ENABLED; - } - else if (cipher & IW_AUTH_CIPHER_NONE){ - //printk("IW_AUTH_CIPHER_NONE->ENUM_ENCRYPTION_DISABLED\n"); - if (prGlueInfo->rWpaInfo.fgPrivacyInvoke) - eEncStatus = ENUM_ENCRYPTION1_ENABLED; - else - eEncStatus = ENUM_ENCRYPTION_DISABLED; - } - else { - //printk("unknown IW_AUTH_CIPHER->Param_EncryptionDisabled\n"); - eEncStatus = ENUM_ENCRYPTION_DISABLED; - } - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetEncryptionStatus, - &eEncStatus, - sizeof(eEncStatus), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - -#if WIRELESS_EXT < 21 - /* GeorgeKuo: a length error bug exists in (WE < 21) cases, kernel before - ** 2.6.19. Cut the trailing '\0'. - */ - rNewSsid.u4SsidLen = (prEssid->length) ? prEssid->length - 1 : 0; -#else - rNewSsid.u4SsidLen = prEssid->length; -#endif - kalMemCopy(rNewSsid.aucSsid, pcExtra, rNewSsid.u4SsidLen); - - /* - rNewSsid.aucSsid[rNewSsid.u4SsidLen] = '\0'; - printk("set ssid(%lu): %s\n", rNewSsid.u4SsidLen, rNewSsid.aucSsid); - */ - - if (kalIoctl(prGlueInfo, - wlanoidSetSsid, - (PVOID) &rNewSsid, - sizeof(PARAM_SSID_T), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen) != WLAN_STATUS_SUCCESS) { - //printk(KERN_WARNING "Fail to set ssid\n"); - return -EFAULT; - } - - - return 0; -} /* wext_set_essid */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To get current network name ESSID. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[in] prEssid Pointer to iw_point structure containing essid information. -* \param[out] pcExtra Pointer to buffer srtoring essid string. -* -* \retval 0 If netif_carrier_ok. -* \retval -ENOTCONN Otherwise. -* -* \note If netif_carrier_ok, network essid is stored in pcExtra. -*/ -/*----------------------------------------------------------------------------*/ -//static PARAM_SSID_T ssid; -static int -wext_get_essid ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - IN struct iw_point *prEssid, - OUT char *pcExtra - ) -{ - //PARAM_SSID_T ssid; - - P_PARAM_SSID_T prSsid; - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prEssid); - ASSERT(pcExtra); - - if (FALSE == GLUE_CHK_PR3(prNetDev, prEssid, pcExtra)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - //if (!netif_carrier_ok(prNetDev)) { - // return -ENOTCONN; - //} - - prSsid = kalMemAlloc(sizeof(PARAM_SSID_T), VIR_MEM_TYPE); - - if(!prSsid) { - return -ENOMEM; - } - - rStatus = kalIoctl(prGlueInfo, - wlanoidQuerySsid, - prSsid, - sizeof(PARAM_SSID_T), - TRUE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if ((rStatus == WLAN_STATUS_SUCCESS) && (prSsid->u4SsidLen <= MAX_SSID_LEN)) { - kalMemCopy(pcExtra, prSsid->aucSsid, prSsid->u4SsidLen); - prEssid->length = prSsid->u4SsidLen; - prEssid->flags = 1; - } - - kalMemFree(prSsid, VIR_MEM_TYPE, sizeof(PARAM_SSID_T)); - - return 0; -} /* wext_get_essid */ - - -#if 0 - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To set tx desired bit rate. Three cases here -* iwconfig wlan0 auto -> Set to origianl supported rate set. -* iwconfig wlan0 18M -> Imply "fixed" case, set to 18Mbps as desired rate. -* iwconfig wlan0 18M auto -> Set to auto rate lower and equal to 18Mbps -* -* \param[in] prNetDev Pointer to the net_device handler. -* \param[in] prIwReqInfo Pointer to the Request Info. -* \param[in] prRate Pointer to the Rate Parameter. -* \param[in] pcExtra Pointer to the extra buffer. -* -* \retval 0 Update desired rate. -* \retval -EINVAL Wrong parameter -*/ -/*----------------------------------------------------------------------------*/ -int -wext_set_rate ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN struct iw_param *prRate, - IN char *pcExtra - ) -{ - PARAM_RATES_EX aucSuppRate = {0}; - PARAM_RATES_EX aucNewRate = {0}; - UINT_32 u4NewRateLen = 0; - UINT_32 i; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prRate); - if (FALSE == GLUE_CHK_PR2(prNetDev, prRate)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - /* - printk("value = %d, fixed = %d, disable = %d, flags = %d\n", - prRate->value, prRate->fixed, prRate->disabled, prRate->flags); - */ - - rStatus = wlanQueryInformation( - prGlueInfo->prAdapter, - wlanoidQuerySupportedRates, - &aucSuppRate, - sizeof(aucSuppRate), - &u4BufLen); - - /* Case: AUTO */ - if (prRate->value < 0) { - if (prRate->fixed == 0) { - /* iwconfig wlan0 rate auto */ - - /* set full supported rate to device */ - /* printk("wlanoidQuerySupportedRates():u4BufLen = %ld\n", u4BufLen); */ - rStatus = wlanSetInformation( - prGlueInfo->prAdapter, - wlanoidSetDesiredRates, - &aucSuppRate, - sizeof(aucSuppRate), - &u4BufLen); - return 0; - } - else { - /* iwconfig wlan0 rate fixed */ - - /* fix rate to what? DO NOTHING */ - return -EINVAL; - } - } - - - aucNewRate[0] = prRate->value / 500000; /* In unit of 500k */ - - for (i = 0; i < PARAM_MAX_LEN_RATES_EX; i++) { - /* check the given value is supported */ - if (aucSuppRate[i] == 0) { - break; - } - - if (aucNewRate[0] == aucSuppRate[i]) { - u4NewRateLen = 1; - break; - } - } - - if (u4NewRateLen == 0) { - /* the given value is not supported */ - /* return error or use given rate as upper bound? */ - return -EINVAL; - } - - if (prRate->fixed == 0) { - /* add all rates lower than desired rate */ - for (i = 0; i < PARAM_MAX_LEN_RATES_EX; ++i) { - if (aucSuppRate[i] == 0) { - break; - } - - if (aucSuppRate[i] < aucNewRate[0]) { - aucNewRate[u4NewRateLen++] = aucSuppRate[i]; - } - } - } - - rStatus = wlanSetInformation( - prGlueInfo->prAdapter, - wlanoidSetDesiredRates, - &aucNewRate, - sizeof(aucNewRate), - &u4BufLen); - return 0; -} /* wext_set_rate */ - -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To get current tx bit rate. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[out] prRate Pointer to iw_param structure to store current tx rate. -* \param[in] pcExtra NULL. -* -* \retval 0 If netif_carrier_ok. -* \retval -ENOTCONN Otherwise. -* -* \note If netif_carrier_ok, current tx rate is stored in pRate. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_get_rate ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - OUT struct iw_param *prRate, - IN char *pcExtra - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - UINT_32 u4Rate = 0; - - ASSERT(prNetDev); - ASSERT(prRate); - if (FALSE == GLUE_CHK_PR2(prNetDev, prRate)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - if (!netif_carrier_ok(prNetDev)) { - return -ENOTCONN; - } - - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryLinkSpeed, - &u4Rate, - sizeof(u4Rate), - TRUE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - - prRate->value = u4Rate * 100; /* u4Rate is in unit of 100bps */ - prRate->fixed = 0; - - return 0; -} /* wext_get_rate */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To set RTS/CTS theshold. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[in] prRts Pointer to iw_param structure containing rts threshold. -* \param[in] pcExtra NULL. -* -* \retval 0 For success. -* \retval -EINVAL Given value is out of range. -* -* \note If given value is valid, device will follow the new setting. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_set_rts ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - IN struct iw_param *prRts, - IN char *pcExtra - ) -{ - PARAM_RTS_THRESHOLD u4RtsThresh; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prRts); - if (FALSE == GLUE_CHK_PR2(prNetDev, prRts)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - if (prRts->disabled == 1) { - u4RtsThresh = 2347; - } - else if (prRts->value < 0 || prRts->value > 2347) { - return -EINVAL; - } - else { - u4RtsThresh = (PARAM_RTS_THRESHOLD)prRts->value; - } - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetRtsThreshold, - &u4RtsThresh, - sizeof(u4RtsThresh), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - - - prRts->value = (typeof(prRts->value ))u4RtsThresh; - prRts->disabled = (prRts->value > 2347) ? 1 : 0; - prRts->fixed = 1; - - return 0; -} /* wext_set_rts */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To get RTS/CTS theshold. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[out] prRts Pointer to iw_param structure containing rts threshold. -* \param[in] pcExtra NULL. -* -* \retval 0 Success. -* -* \note RTS threshold is stored in pRts. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_get_rts ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - OUT struct iw_param *prRts, - IN char *pcExtra - ) -{ - PARAM_RTS_THRESHOLD u4RtsThresh; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prRts); - if (FALSE == GLUE_CHK_PR2(prNetDev, prRts)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryRtsThreshold, - &u4RtsThresh, - sizeof(u4RtsThresh), - TRUE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - - - prRts->value = (typeof(prRts->value ))u4RtsThresh; - prRts->disabled = (prRts->value > 2347 || prRts->value < 0) ? 1 : 0; - prRts->fixed = 1; - - return 0; -} /* wext_get_rts */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To get fragmentation threshold. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[out] prFrag Pointer to iw_param structure containing frag threshold. -* \param[in] pcExtra NULL. -* -* \retval 0 Success. -* -* \note RTS threshold is stored in pFrag. Fragmentation is disabled. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_get_frag ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - OUT struct iw_param *prFrag, - IN char *pcExtra - ) -{ - ASSERT(prFrag); - - prFrag->value = 2346; - prFrag->fixed = 1; - prFrag->disabled = 1; - return 0; -} /* wext_get_frag */ - -#if 1 -/*----------------------------------------------------------------------------*/ -/*! -* \brief To set TX power, or enable/disable the radio. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[in] prTxPow Pointer to iw_param structure containing tx power setting. -* \param[in] pcExtra NULL. -* -* \retval 0 Success. -* -* \note Tx power is stored in pTxPow. iwconfig wlan0 txpow on/off are used -* to enable/disable the radio. -*/ -/*----------------------------------------------------------------------------*/ - -static int -wext_set_txpow ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - IN struct iw_param *prTxPow, - IN char *pcExtra - ) -{ - int ret = 0; - //PARAM_DEVICE_POWER_STATE ePowerState; - ENUM_ACPI_STATE_T ePowerState; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prTxPow); - if (FALSE == GLUE_CHK_PR2(prNetDev, prTxPow)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - if(prTxPow->disabled){ - /* <1> disconnect */ - rStatus = kalIoctl(prGlueInfo, - wlanoidSetDisassociate, - NULL, - 0, - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("######set disassoc failed\n")); - } else { - DBGLOG(INIT, INFO, ("######set assoc ok\n")); - } - - /* <2> mark to power state flag*/ - ePowerState = ACPI_STATE_D0; - DBGLOG(INIT, INFO, ("set to acpi d3(0)\n")); - wlanSetAcpiState(prGlueInfo->prAdapter, ePowerState); - - } - else { - ePowerState = ACPI_STATE_D0; - DBGLOG(INIT, INFO, ("set to acpi d0\n")); - wlanSetAcpiState(prGlueInfo->prAdapter, ePowerState); - } - - prGlueInfo->ePowerState = ePowerState; - - return ret; -} /* wext_set_txpow */ - - -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To get TX power. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[out] prTxPow Pointer to iw_param structure containing tx power setting. -* \param[in] pcExtra NULL. -* -* \retval 0 Success. -* -* \note Tx power is stored in pTxPow. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_get_txpow ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - OUT struct iw_param *prTxPow, - IN char *pcExtra - ) -{ - //PARAM_DEVICE_POWER_STATE ePowerState; - - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prNetDev); - ASSERT(prTxPow); - if (FALSE == GLUE_CHK_PR2(prNetDev, prTxPow)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - /* GeorgeKuo: wlanoidQueryAcpiDevicePowerState() reports capability, not - * current state. Use GLUE_INFO_T to store state. - */ - //ePowerState = prGlueInfo->ePowerState; - - /* TxPow parameters: Fixed at relative 100% */ -#if WIRELESS_EXT < 17 - prTxPow->flags = 0x0002; /* IW_TXPOW_RELATIVE */ -#else - prTxPow->flags = IW_TXPOW_RELATIVE; -#endif - prTxPow->value = 100; - prTxPow->fixed = 1; - //prTxPow->disabled = (ePowerState != ParamDeviceStateD3) ? FALSE : TRUE; - prTxPow->disabled = TRUE; - - return 0; -} /* wext_get_txpow */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To get encryption cipher and key. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[out] prEnc Pointer to iw_point structure containing securiry information. -* \param[in] pcExtra Buffer to store key content. -* -* \retval 0 Success. -* -* \note Securiry information is stored in pEnc except key content. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_get_encode ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - OUT struct iw_point *prEnc, - IN char *pcExtra - ) -{ -#if 1 - //ENUM_ENCRYPTION_STATUS_T eEncMode; - ENUM_PARAM_ENCRYPTION_STATUS_T eEncMode; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prEnc); - if (FALSE == GLUE_CHK_PR2(prNetDev, prEnc)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryEncryptionStatus, - &eEncMode, - sizeof(eEncMode), - TRUE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - - - switch(eEncMode) { - case ENUM_WEP_DISABLED: - prEnc->flags = IW_ENCODE_DISABLED; - break; - case ENUM_WEP_ENABLED: - prEnc->flags = IW_ENCODE_ENABLED; - break; - case ENUM_WEP_KEY_ABSENT: - prEnc->flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - break; - default: - prEnc->flags = IW_ENCODE_ENABLED; - break; - } - - /* Cipher, Key Content, Key ID can't be queried */ - prEnc->flags |= IW_ENCODE_NOKEY; -#endif - return 0; -} /* wext_get_encode */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To set encryption cipher and key. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[in] prEnc Pointer to iw_point structure containing securiry information. -* \param[in] pcExtra Pointer to key string buffer. -* -* \retval 0 Success. -* \retval -EINVAL Key ID error for WEP. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note Securiry information is stored in pEnc. -*/ -/*----------------------------------------------------------------------------*/ -static UINT_8 wepBuf[48]; - -static int -wext_set_encode ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - IN struct iw_point *prEnc, - IN char *pcExtra - ) -{ -#if 1 - ENUM_PARAM_ENCRYPTION_STATUS_T eEncStatus; - ENUM_PARAM_AUTH_MODE_T eAuthMode; - //UINT_8 wepBuf[48]; - P_PARAM_WEP_T prWepKey = (P_PARAM_WEP_T) wepBuf; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prEnc); - ASSERT(pcExtra); - if (FALSE == GLUE_CHK_PR3(prNetDev, prEnc, pcExtra)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - /* reset to default mode */ - prGlueInfo->rWpaInfo.u4WpaVersion = IW_AUTH_WPA_VERSION_DISABLED; - prGlueInfo->rWpaInfo.u4KeyMgmt = 0; - prGlueInfo->rWpaInfo.u4CipherPairwise = IW_AUTH_CIPHER_NONE; - prGlueInfo->rWpaInfo.u4CipherGroup = IW_AUTH_CIPHER_NONE; - prGlueInfo->rWpaInfo.u4AuthAlg = IW_AUTH_ALG_OPEN_SYSTEM; -#if CFG_SUPPORT_802_11W - prGlueInfo->rWpaInfo.u4Mfp = IW_AUTH_MFP_DISABLED; -#endif - - /* iwconfig wlan0 key off */ - if ( (prEnc->flags & IW_ENCODE_MODE) == IW_ENCODE_DISABLED ) { - eAuthMode = AUTH_MODE_OPEN; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetAuthMode, - &eAuthMode, - sizeof(eAuthMode), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - eEncStatus = ENUM_ENCRYPTION_DISABLED; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetEncryptionStatus, - &eEncStatus, - sizeof(eEncStatus), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - return 0; - } - - /* iwconfig wlan0 key 0123456789 */ - /* iwconfig wlan0 key s:abcde */ - /* iwconfig wlan0 key 0123456789 [1] */ - /* iwconfig wlan0 key 01234567890123456789012345 [1] */ - /* check key size for WEP */ - if (prEnc->length == 5 || prEnc->length == 13 || prEnc->length == 16) { - /* prepare PARAM_WEP key structure */ - prWepKey->u4KeyIndex = (prEnc->flags & IW_ENCODE_INDEX) ? - (prEnc->flags & IW_ENCODE_INDEX) -1 : 0; - if (prWepKey->u4KeyIndex > 3) { - /* key id is out of range */ - return -EINVAL; - } - prWepKey->u4KeyIndex |= 0x80000000; - prWepKey->u4Length = 12 + prEnc->length; - prWepKey->u4KeyLength = prEnc->length; - kalMemCopy(prWepKey->aucKeyMaterial, pcExtra, prEnc->length); - - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetAddWep, - prWepKey, - prWepKey->u4Length, - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("wlanoidSetAddWep fail 0x%lx\n", rStatus)); - return -EFAULT; - } - - /* change to auto switch */ - prGlueInfo->rWpaInfo.u4AuthAlg = IW_AUTH_ALG_SHARED_KEY | - IW_AUTH_ALG_OPEN_SYSTEM; - eAuthMode = AUTH_MODE_AUTO_SWITCH; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetAuthMode, - &eAuthMode, - sizeof(eAuthMode), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - //printk(KERN_INFO DRV_NAME"wlanoidSetAuthMode fail 0x%lx\n", rStatus); - return -EFAULT; - } - - prGlueInfo->rWpaInfo.u4CipherPairwise = - IW_AUTH_CIPHER_WEP104 | IW_AUTH_CIPHER_WEP40; - prGlueInfo->rWpaInfo.u4CipherGroup = - IW_AUTH_CIPHER_WEP104 | IW_AUTH_CIPHER_WEP40; - - eEncStatus = ENUM_WEP_ENABLED; - - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetEncryptionStatus, - &eEncStatus, - sizeof(ENUM_PARAM_ENCRYPTION_STATUS_T), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - //printk(KERN_INFO DRV_NAME"wlanoidSetEncryptionStatus fail 0x%lx\n", rStatus); - return -EFAULT; - } - - return 0; - } -#endif - return -EOPNOTSUPP; -} /* wext_set_encode */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To set power management. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[in] prPower Pointer to iw_param structure containing tx power setting. -* \param[in] pcExtra NULL. -* -* \retval 0 Success. -* -* \note New Power Management Mode is set to driver. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_set_power ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - IN struct iw_param *prPower, - IN char *pcExtra - ) -{ -#if 1 - PARAM_POWER_MODE ePowerMode; - INT_32 i4PowerValue; - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prPower); - if (FALSE == GLUE_CHK_PR2(prNetDev, prPower)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - //printk(KERN_INFO "wext_set_power value(%d) disabled(%d) flag(0x%x)\n", - // prPower->value, prPower->disabled, prPower->flags); - - if(prPower->disabled){ - ePowerMode = Param_PowerModeCAM; - } - else { - i4PowerValue = prPower->value; -#if WIRELESS_EXT < 21 - i4PowerValue /= 1000000; -#endif - if (i4PowerValue == 0) { - ePowerMode = Param_PowerModeCAM; - } else if (i4PowerValue == 1) { - ePowerMode = Param_PowerModeMAX_PSP; - } else if (i4PowerValue == 2) { - ePowerMode = Param_PowerModeFast_PSP; - } - else { - DBGLOG(INIT, INFO, ("%s(): unsupported power management mode value = %d.\n", - __FUNCTION__, - prPower->value)); - - return -EINVAL; - } - } - - - rStatus = kalIoctl(prGlueInfo, - wlanoidSet802dot11PowerSaveProfile, - &ePowerMode, - sizeof(ePowerMode), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - //printk(KERN_INFO DRV_NAME"wlanoidSet802dot11PowerSaveProfile fail 0x%lx\n", rStatus); - return -EFAULT; - } - -#endif - return 0; -} /* wext_set_power */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To get power management. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[out] prPower Pointer to iw_param structure containing tx power setting. -* \param[in] pcExtra NULL. -* -* \retval 0 Success. -* -* \note Power management mode is stored in pTxPow->value. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_get_power ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - OUT struct iw_param *prPower, - IN char *pcExtra - ) -{ - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - PARAM_POWER_MODE ePowerMode = Param_PowerModeCAM; - - ASSERT(prNetDev); - ASSERT(prPower); - if (FALSE == GLUE_CHK_PR2(prNetDev, prPower)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - -#if 0 -#if defined(_HIF_SDIO) - rStatus = sdio_io_ctrl(prGlueInfo, - wlanoidQuery802dot11PowerSaveProfile, - &ePowerMode, - sizeof(ePowerMode), - TRUE, - TRUE, - &u4BufLen); -#else - rStatus = wlanQueryInformation(prGlueInfo->prAdapter, - wlanoidQuery802dot11PowerSaveProfile, - &ePowerMode, - sizeof(ePowerMode), - &u4BufLen); -#endif -#else - rStatus = wlanQueryInformation(prGlueInfo->prAdapter, - wlanoidQuery802dot11PowerSaveProfile, - &ePowerMode, - sizeof(ePowerMode), - &u4BufLen); -#endif - - if (rStatus != WLAN_STATUS_SUCCESS) { - return -EFAULT; - } - - prPower->value = 0; - prPower->disabled = 1; - - if (Param_PowerModeCAM == ePowerMode) { - prPower->value = 0; - prPower->disabled = 1; - } - else if (Param_PowerModeMAX_PSP == ePowerMode ) { - prPower->value = 1; - prPower->disabled = 0; - } - else if (Param_PowerModeFast_PSP == ePowerMode ) { - prPower->value = 2; - prPower->disabled = 0; - } - - prPower->flags = IW_POWER_PERIOD | IW_POWER_RELATIVE; -#if WIRELESS_EXT < 21 - prPower->value *= 1000000; -#endif - - //printk(KERN_INFO "wext_get_power value(%d) disabled(%d) flag(0x%x)\n", - // prPower->value, prPower->disabled, prPower->flags); - - return 0; -} /* wext_get_power */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To set authentication parameters. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[in] rpAuth Pointer to iw_param structure containing authentication information. -* \param[in] pcExtra Pointer to key string buffer. -* -* \retval 0 Success. -* \retval -EINVAL Key ID error for WEP. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note Securiry information is stored in pEnc. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_set_auth ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - IN struct iw_param *prAuth, - IN char *pcExtra - ) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prNetDev); - ASSERT(prAuth); - if (FALSE == GLUE_CHK_PR2(prNetDev, prAuth)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - /* Save information to glue info and process later when ssid is set. */ - switch(prAuth->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: -#if CFG_SUPPORT_WAPI - if (wlanQueryWapiMode(prGlueInfo->prAdapter)){ - prGlueInfo->rWpaInfo.u4WpaVersion = IW_AUTH_WPA_VERSION_DISABLED; - prGlueInfo->rWpaInfo.u4AuthAlg = IW_AUTH_ALG_OPEN_SYSTEM; - } - else { - prGlueInfo->rWpaInfo.u4WpaVersion = prAuth->value; - } -#else - prGlueInfo->rWpaInfo.u4WpaVersion = prAuth->value; -#endif - break; - - case IW_AUTH_CIPHER_PAIRWISE: - prGlueInfo->rWpaInfo.u4CipherPairwise = prAuth->value; - break; - - case IW_AUTH_CIPHER_GROUP: - prGlueInfo->rWpaInfo.u4CipherGroup = prAuth->value; - break; - - case IW_AUTH_KEY_MGMT: - prGlueInfo->rWpaInfo.u4KeyMgmt = prAuth->value; -#if CFG_SUPPORT_WAPI - if (prGlueInfo->rWpaInfo.u4KeyMgmt == IW_AUTH_KEY_MGMT_WAPI_PSK || - prGlueInfo->rWpaInfo.u4KeyMgmt == IW_AUTH_KEY_MGMT_WAPI_CERT) { - UINT_32 u4BufLen; - WLAN_STATUS rStatus; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetWapiMode, - &prAuth->value, - sizeof(UINT_32), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - DBGLOG(INIT, INFO, ("IW_AUTH_WAPI_ENABLED :%d\n", prAuth->value)); - } -#endif - if (prGlueInfo->rWpaInfo.u4KeyMgmt == IW_AUTH_KEY_MGMT_WPS) - prGlueInfo->fgWpsActive = TRUE; - else - prGlueInfo->fgWpsActive = FALSE; - break; - - case IW_AUTH_80211_AUTH_ALG: - prGlueInfo->rWpaInfo.u4AuthAlg = prAuth->value; - break; - - case IW_AUTH_PRIVACY_INVOKED: - prGlueInfo->rWpaInfo.fgPrivacyInvoke = prAuth->value; - break; -#if CFG_SUPPORT_802_11W - case IW_AUTH_MFP: - //printk("wext_set_auth IW_AUTH_MFP=%d\n", prAuth->value); - prGlueInfo->rWpaInfo.u4Mfp = prAuth->value; - break; -#endif -#if CFG_SUPPORT_WAPI - case IW_AUTH_WAPI_ENABLED: - { - UINT_32 u4BufLen; - WLAN_STATUS rStatus; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetWapiMode, - &prAuth->value, - sizeof(UINT_32), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - } - DBGLOG(INIT, INFO, ("IW_AUTH_WAPI_ENABLED :%d\n", prAuth->value)); - break; -#endif - default: - /* - printk(KERN_INFO "[wifi] unsupported IW_AUTH_INDEX :%d\n", prAuth->flags); - */ - break; - } - return 0; -} /* wext_set_auth */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To set encryption cipher and key. -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[in] prEnc Pointer to iw_point structure containing securiry information. -* \param[in] pcExtra Pointer to key string buffer. -* -* \retval 0 Success. -* \retval -EINVAL Key ID error for WEP. -* \retval -EFAULT Setting parameters to driver fail. -* \retval -EOPNOTSUPP Key size not supported. -* -* \note Securiry information is stored in pEnc. -*/ -/*----------------------------------------------------------------------------*/ -#if CFG_SUPPORT_WAPI - UINT_8 keyStructBuf[320]; /* add/remove key shared buffer */ -#else - UINT_8 keyStructBuf[100]; /* add/remove key shared buffer */ -#endif - -static int -wext_set_encode_ext ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwrInfo, - IN struct iw_point *prEnc, - IN char *pcExtra - ) -{ - P_PARAM_REMOVE_KEY_T prRemoveKey = (P_PARAM_REMOVE_KEY_T) keyStructBuf; - P_PARAM_KEY_T prKey = (P_PARAM_KEY_T) keyStructBuf; - - - P_PARAM_WEP_T prWepKey = (P_PARAM_WEP_T) wepBuf; - - struct iw_encode_ext *prIWEncExt = (struct iw_encode_ext *) pcExtra; - - ENUM_PARAM_ENCRYPTION_STATUS_T eEncStatus; - ENUM_PARAM_AUTH_MODE_T eAuthMode; - //ENUM_PARAM_OP_MODE_T eOpMode = NET_TYPE_AUTO_SWITCH; - -#if CFG_SUPPORT_WAPI - P_PARAM_WPI_KEY_T prWpiKey = (P_PARAM_WPI_KEY_T) keyStructBuf; -#endif - - P_GLUE_INFO_T prGlueInfo = NULL; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - ASSERT(prEnc); - if (FALSE == GLUE_CHK_PR3(prNetDev, prEnc, pcExtra)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - memset(keyStructBuf, 0, sizeof(keyStructBuf)); - -#if CFG_SUPPORT_WAPI - if (prIWEncExt->alg == IW_ENCODE_ALG_SMS4) { - if (prEnc->flags & IW_ENCODE_DISABLED) { - //printk(KERN_INFO "[wapi] IW_ENCODE_DISABLED\n"); - return 0; - } - /* KeyID */ - prWpiKey->ucKeyID = (prEnc->flags & IW_ENCODE_INDEX); - prWpiKey->ucKeyID --; - if (prWpiKey->ucKeyID > 1) { - /* key id is out of range */ - //printk(KERN_INFO "[wapi] add key error: key_id invalid %d\n", prWpiKey->ucKeyID); - return -EINVAL; - } - - if (prIWEncExt->key_len != 32) { - /* key length not valid */ - //printk(KERN_INFO "[wapi] add key error: key_len invalid %d\n", prIWEncExt->key_len); - return -EINVAL; - } - - //printk(KERN_INFO "[wapi] %d ext_flags %d\n", prEnc->flags, prIWEncExt->ext_flags); - - if (prIWEncExt->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - prWpiKey->eKeyType = ENUM_WPI_GROUP_KEY; - prWpiKey->eDirection = ENUM_WPI_RX; - } - else if (prIWEncExt->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - prWpiKey->eKeyType = ENUM_WPI_PAIRWISE_KEY; - prWpiKey->eDirection = ENUM_WPI_RX_TX; - } - - /* PN */ - memcpy(prWpiKey->aucPN, prIWEncExt->tx_seq, IW_ENCODE_SEQ_MAX_SIZE * 2); - - /* BSSID */ - memcpy(prWpiKey->aucAddrIndex, prIWEncExt->addr.sa_data, 6); - - memcpy(prWpiKey->aucWPIEK, prIWEncExt->key, 16); - prWpiKey->u4LenWPIEK = 16; - - memcpy(prWpiKey->aucWPICK, &prIWEncExt->key[16], 16); - prWpiKey->u4LenWPICK = 16; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetWapiKey, - prWpiKey, - sizeof(PARAM_WPI_KEY_T), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - //printk(KERN_INFO "[wapi] add key error:%lx\n", rStatus); - } - - } - else -#endif - { - - if ( (prEnc->flags & IW_ENCODE_MODE) == IW_ENCODE_DISABLED) { - prRemoveKey->u4Length = sizeof(*prRemoveKey); - memcpy(prRemoveKey->arBSSID, prIWEncExt->addr.sa_data, 6); - /* - printk("IW_ENCODE_DISABLED: ID:%d, Addr:[" MACSTR "]\n", - prRemoveKey->KeyIndex, MAC2STR(prRemoveKey->BSSID)); - */ - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetRemoveKey, - prRemoveKey, - prRemoveKey->u4Length, - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("remove key error:%lx\n", rStatus)); - } - return 0; - } - - //return 0; - //printk ("alg %x\n", prIWEncExt->alg); - - switch (prIWEncExt->alg) { - case IW_ENCODE_ALG_NONE: - break; - case IW_ENCODE_ALG_WEP: - /* iwconfig wlan0 key 0123456789 */ - /* iwconfig wlan0 key s:abcde */ - /* iwconfig wlan0 key 0123456789 [1] */ - /* iwconfig wlan0 key 01234567890123456789012345 [1] */ - /* check key size for WEP */ - if (prIWEncExt->key_len == 5 || prIWEncExt->key_len == 13 || prIWEncExt->key_len == 16) { - /* prepare PARAM_WEP key structure */ - prWepKey->u4KeyIndex = (prEnc->flags & IW_ENCODE_INDEX) ? - (prEnc->flags & IW_ENCODE_INDEX) -1 : 0; - if (prWepKey->u4KeyIndex > 3) { - /* key id is out of range */ - return -EINVAL; - } - prWepKey->u4KeyIndex |= 0x80000000; - prWepKey->u4Length = 12 + prIWEncExt->key_len; - prWepKey->u4KeyLength = prIWEncExt->key_len; - //kalMemCopy(prWepKey->aucKeyMaterial, pcExtra, prIWEncExt->key_len); - kalMemCopy(prWepKey->aucKeyMaterial, prIWEncExt->key, prIWEncExt->key_len); - - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetAddWep, - prWepKey, - prWepKey->u4Length, - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("wlanoidSetAddWep fail 0x%lx\n", rStatus)); - return -EFAULT; - } - - /* change to auto switch */ - prGlueInfo->rWpaInfo.u4AuthAlg = IW_AUTH_ALG_SHARED_KEY | - IW_AUTH_ALG_OPEN_SYSTEM; - eAuthMode = AUTH_MODE_AUTO_SWITCH; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetAuthMode, - &eAuthMode, - sizeof(eAuthMode), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("wlanoidSetAuthMode fail 0x%lx\n", rStatus)); - return -EFAULT; - } - - prGlueInfo->rWpaInfo.u4CipherPairwise = - IW_AUTH_CIPHER_WEP104 | IW_AUTH_CIPHER_WEP40; - prGlueInfo->rWpaInfo.u4CipherGroup = - IW_AUTH_CIPHER_WEP104 | IW_AUTH_CIPHER_WEP40; - - eEncStatus = ENUM_WEP_ENABLED; - - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetEncryptionStatus, - &eEncStatus, - sizeof(ENUM_PARAM_ENCRYPTION_STATUS_T), - FALSE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("wlanoidSetEncryptionStatus fail 0x%lx\n", rStatus)); - return -EFAULT; - } - - } else { - DBGLOG(INIT, INFO, ("key length %x\n", prIWEncExt->key_len)); - DBGLOG(INIT, INFO, ("key error\n")); - } - - break; - case IW_ENCODE_ALG_TKIP: - case IW_ENCODE_ALG_CCMP: -#if CFG_SUPPORT_802_11W - case IW_ENCODE_ALG_AES_CMAC: -#endif - { - - /* KeyID */ - prKey->u4KeyIndex = (prEnc->flags & IW_ENCODE_INDEX) ? - (prEnc->flags & IW_ENCODE_INDEX) -1: 0; -#if CFG_SUPPORT_802_11W - if (prKey->u4KeyIndex > 5) -#else - if (prKey->u4KeyIndex > 3) -#endif - { - DBGLOG(INIT, INFO, ("key index error:0x%lx\n", prKey->u4KeyIndex)); - /* key id is out of range */ - return -EINVAL; - } - - /* bit(31) and bit(30) are shared by pKey and pRemoveKey */ - /* Tx Key Bit(31)*/ - if (prIWEncExt->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - prKey->u4KeyIndex |= 0x1UL << 31; - } - - /* Pairwise Key Bit(30) */ - if (prIWEncExt->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - /* group key */ - } - else { - /* pairwise key */ - prKey->u4KeyIndex |= 0x1UL << 30; - } - - } - /* Rx SC Bit(29) */ - if (prIWEncExt->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { - prKey->u4KeyIndex |= 0x1UL << 29; - memcpy(&prKey->rKeyRSC, prIWEncExt->rx_seq, IW_ENCODE_SEQ_MAX_SIZE); - } - - /* BSSID */ - memcpy(prKey->arBSSID, prIWEncExt->addr.sa_data, 6); - - /* switch tx/rx MIC key for sta */ - if (prIWEncExt->alg == IW_ENCODE_ALG_TKIP && prIWEncExt->key_len == 32) { - memcpy(prKey->aucKeyMaterial, prIWEncExt->key, 16); - memcpy(((PUINT_8)prKey->aucKeyMaterial) + 16, prIWEncExt->key + 24, 8); - memcpy((prKey->aucKeyMaterial) + 24, prIWEncExt->key + 16, 8); - } - else { - memcpy(prKey->aucKeyMaterial, prIWEncExt->key, prIWEncExt->key_len); - } - - prKey->u4KeyLength = prIWEncExt->key_len; - prKey->u4Length = ((UINT_32)&(((P_PARAM_KEY_T)0)->aucKeyMaterial)) + prKey->u4KeyLength; - - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetAddKey, - prKey, - prKey->u4Length, - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("add key error:%lx\n", rStatus)); - return -EFAULT; - } - break; - } - } - - return 0; -} /* wext_set_encode_ext */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Set country code -* -* \param[in] prDev Net device requested. -* \param[in] prIwrInfo NULL. -* \param[in] pu4Mode Pointer to new operation mode. -* \param[in] pcExtra NULL. -* -* \retval 0 For success. -* \retval -EOPNOTSUPP If new mode is not supported. -* -* \note Device will run in new operation mode if it is valid. -*/ -/*----------------------------------------------------------------------------*/ -static int -wext_set_country ( - IN struct net_device *prNetDev, - IN struct iwreq *iwr - ) -{ - P_GLUE_INFO_T prGlueInfo; - WLAN_STATUS rStatus; - UINT_32 u4BufLen; - UINT_8 aucCountry[2]; - - ASSERT(prNetDev); - - /* iwr->u.data.pointer should be like "COUNTRY US", "COUNTRY EU" - * and "COUNTRY JP" - */ - if (FALSE == GLUE_CHK_PR2(prNetDev, iwr) || - !iwr->u.data.pointer || iwr->u.data.length < 10) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - aucCountry[0] = *((PUINT_8)iwr->u.data.pointer + 8); - aucCountry[1] = *((PUINT_8)iwr->u.data.pointer + 9); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetCountryCode, - &aucCountry[0], - 2, - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - return 0; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief ioctl() (Linux Wireless Extensions) routines -* -* \param[in] prDev Net device requested. -* \param[in] ifr The ifreq structure for seeting the wireless extension. -* \param[in] i4Cmd The wireless extension ioctl command. -* -* \retval zero On success. -* \retval -EOPNOTSUPP If the cmd is not supported. -* \retval -EFAULT If copy_to_user goes wrong. -* \retval -EINVAL If any value's out of range. -* -* \note -*/ -/*----------------------------------------------------------------------------*/ -int -wext_support_ioctl ( - IN struct net_device *prDev, - IN struct ifreq *prIfReq, - IN int i4Cmd - ) -{ - /* prIfReq is verified in the caller function wlanDoIOCTL() */ - struct iwreq *iwr = (struct iwreq*)prIfReq; - struct iw_request_info rIwReqInfo; - int ret = 0; - char *prExtraBuf = NULL; - UINT_32 u4ExtraSize = 0; - - /* prDev is verified in the caller function wlanDoIOCTL() */ - - printk("%d CMD:0x%x\n", jiffies_to_msecs(jiffies), i4Cmd); - - /* Prepare the call */ - rIwReqInfo.cmd = (__u16)i4Cmd; - rIwReqInfo.flags = 0; - - switch (i4Cmd) { - case SIOCGIWNAME: /* 0x8B01, get wireless protocol name */ - ret = wext_get_name(prDev, &rIwReqInfo, (char *)&iwr->u.name, NULL); - break; - - /* case SIOCSIWNWID: 0x8B02, deprecated */ - /* case SIOCGIWNWID: 0x8B03, deprecated */ - - case SIOCSIWFREQ: /* 0x8B04, set channel */ - ret = wext_set_freq(prDev, NULL, &iwr->u.freq, NULL); - break; - - case SIOCGIWFREQ: /* 0x8B05, get channel */ - ret = wext_get_freq(prDev, NULL, &iwr->u.freq, NULL); - break; - - case SIOCSIWMODE: /* 0x8B06, set operation mode */ - ret = wext_set_mode(prDev, NULL, &iwr->u.mode, NULL); - //ret = 0; - break; - - case SIOCGIWMODE: /* 0x8B07, get operation mode */ - ret = wext_get_mode(prDev, NULL, &iwr->u.mode, NULL); - break; - - /* case SIOCSIWSENS: 0x8B08, unsupported */ - /* case SIOCGIWSENS: 0x8B09, unsupported */ - - /* case SIOCSIWRANGE: 0x8B0A, unused */ - case SIOCGIWRANGE: /* 0x8B0B, get range of parameters */ - if (iwr->u.data.pointer != NULL) { - /* Buffer size shoule be large enough */ - if (iwr->u.data.length < sizeof(struct iw_range)) { - ret = -E2BIG; - break; - } - - prExtraBuf = kalMemAlloc(sizeof(struct iw_range), VIR_MEM_TYPE); - if (!prExtraBuf) { - ret = - ENOMEM; - break; - } - - /* reset all fields */ - memset(prExtraBuf, 0, sizeof(struct iw_range)); - iwr->u.data.length = sizeof(struct iw_range); - - ret = wext_get_range(prDev, NULL, &iwr->u.data, prExtraBuf); - /* Push up to the caller */ - if (copy_to_user(iwr->u.data.pointer, - prExtraBuf, - iwr->u.data.length)) { - ret = -EFAULT; - } - - kalMemFree(prExtraBuf, VIR_MEM_TYPE, sizeof(struct iw_range)); - prExtraBuf = NULL; - } - else { - ret = -EINVAL; - } - break; - - case SIOCSIWPRIV: /* 0x8B0C, Country */ - ret = wext_set_country(prDev, iwr); - break; - - /* case SIOCGIWPRIV: 0x8B0D, handled in wlan_do_ioctl() */ - /* caes SIOCSIWSTATS: 0x8B0E, unused */ - /* case SIOCGIWSTATS: - get statistics, intercepted by wireless_process_ioctl() in wireless.c, - redirected to dev_iwstats(), dev->get_wireless_stats(). - */ - /* case SIOCSIWSPY: 0x8B10, unsupported */ - /* case SIOCGIWSPY: 0x8B11, unsupported*/ - /* case SIOCSIWTHRSPY: 0x8B12, unsupported */ - /* case SIOCGIWTHRSPY: 0x8B13, unsupported*/ - - case SIOCSIWAP: /* 0x8B14, set access point MAC addresses (BSSID) */ - if (iwr->u.ap_addr.sa_data[0] == 0 && - iwr->u.ap_addr.sa_data[1] == 0 && - iwr->u.ap_addr.sa_data[2] == 0 && - iwr->u.ap_addr.sa_data[3] == 0 && - iwr->u.ap_addr.sa_data[4] == 0 && - iwr->u.ap_addr.sa_data[5] == 0) { - /* WPA Supplicant will set 000000000000 in - ** wpa_driver_wext_deinit(), do nothing here or disassoc again? - */ - ret = 0; - break; - } - else { - ret = wext_set_ap(prDev, NULL, &iwr->u.ap_addr, NULL); - } - break; - - case SIOCGIWAP: /* 0x8B15, get access point MAC addresses (BSSID) */ - ret = wext_get_ap(prDev, NULL, &iwr->u.ap_addr, NULL); - break; - - case SIOCSIWMLME: /* 0x8B16, request MLME operation */ - /* Fixed length structure */ - if (iwr->u.data.length != sizeof(struct iw_mlme)) { - DBGLOG(INIT, INFO, ("MLME buffer strange:%d\n", iwr->u.data.length)); - ret = -EINVAL; - break; - } - - if (!iwr->u.data.pointer) { - ret = -EINVAL; - break; - } - - prExtraBuf = kalMemAlloc(sizeof(struct iw_mlme), VIR_MEM_TYPE); - if (!prExtraBuf) { - ret = - ENOMEM; - break; - } - - if (copy_from_user(prExtraBuf, iwr->u.data.pointer, sizeof(struct iw_mlme))) { - ret = -EFAULT; - } - else { - ret = wext_set_mlme(prDev, NULL, &(iwr->u.data), prExtraBuf); - } - - kalMemFree(prExtraBuf, VIR_MEM_TYPE, sizeof(struct iw_mlme)); - prExtraBuf = NULL; - break; - - /* case SIOCGIWAPLIST: 0x8B17, deprecated */ - case SIOCSIWSCAN: /* 0x8B18, scan request */ - if (iwr->u.data.pointer == NULL) { - ret = wext_set_scan(prDev, NULL, NULL, NULL); - } -#if WIRELESS_EXT > 17 - else if (iwr->u.data.length == sizeof(struct iw_scan_req)) { - prExtraBuf = kalMemAlloc(MAX_SSID_LEN, VIR_MEM_TYPE); - if (!prExtraBuf) { - ret = -ENOMEM; - break; - } - if (copy_from_user(prExtraBuf, ((struct iw_scan_req *) (iwr->u.data.pointer))->essid, - ((struct iw_scan_req *) (iwr->u.data.pointer))->essid_len)) { - ret = -EFAULT; - } else { - ret = wext_set_scan(prDev, NULL, (union iwreq_data *) &(iwr->u.data), prExtraBuf); - } - - kalMemFree(prExtraBuf, VIR_MEM_TYPE, MAX_SSID_LEN); - prExtraBuf = NULL; - } -#endif - else { - ret = -EINVAL; - } - break; -#if 1 - case SIOCGIWSCAN: /* 0x8B19, get scan results */ - if (!iwr->u.data.pointer|| !iwr->u.essid.pointer) { - ret = -EINVAL; - break; - } - - u4ExtraSize = iwr->u.data.length; - /* allocate the same size of kernel buffer to store scan results. */ - prExtraBuf = kalMemAlloc(u4ExtraSize, VIR_MEM_TYPE); - if (!prExtraBuf) { - ret = - ENOMEM; - break; - } - - /* iwr->u.data.length may be updated by wext_get_scan() */ - ret = wext_get_scan(prDev, NULL, &iwr->u.data, prExtraBuf); - if (ret != 0) { - if (ret == -E2BIG) { - DBGLOG(INIT, INFO, ("[wifi] wext_get_scan -E2BIG\n")); - } - } - else { - /* check updated length is valid */ - ASSERT(iwr->u.data.length <= u4ExtraSize); - if (iwr->u.data.length > u4ExtraSize) { - DBGLOG(INIT, INFO, ("Updated result length is larger than allocated (%d > %ld)\n", - iwr->u.data.length, u4ExtraSize)); - iwr->u.data.length = u4ExtraSize; - } - - if (copy_to_user(iwr->u.data.pointer, - prExtraBuf, - iwr->u.data.length)) { - ret = -EFAULT; - } - } - - kalMemFree(prExtraBuf, VIR_MEM_TYPE, u4ExtraSize); - prExtraBuf = NULL; - - break; - -#endif - -#if 1 - case SIOCSIWESSID: /* 0x8B1A, set SSID (network name) */ - if (iwr->u.essid.length > IW_ESSID_MAX_SIZE) { - ret = -E2BIG; - break; - } - if (!iwr->u.essid.pointer) { - ret = -EINVAL; - break; - } - - prExtraBuf = kalMemAlloc(IW_ESSID_MAX_SIZE + 4, VIR_MEM_TYPE); - if (!prExtraBuf) { - ret = - ENOMEM; - break; - } - - if (copy_from_user(prExtraBuf, - iwr->u.essid.pointer, - iwr->u.essid.length)) { - ret = -EFAULT; - } - else { - /* Add trailing '\0' for printk */ - //prExtraBuf[iwr->u.essid.length] = 0; - //printk(KERN_INFO "wext_set_essid: %s (%d)\n", prExtraBuf, iwr->u.essid.length); - ret = wext_set_essid(prDev, NULL, &iwr->u.essid, prExtraBuf); - //printk ("set essid %d\n", ret); - } - - kalMemFree(prExtraBuf, VIR_MEM_TYPE, IW_ESSID_MAX_SIZE + 4); - prExtraBuf = NULL; - break; - -#endif - - case SIOCGIWESSID: /* 0x8B1B, get SSID */ - if (!iwr->u.essid.pointer) { - ret = -EINVAL; - break; - } - - if (iwr->u.essid.length < IW_ESSID_MAX_SIZE) { - DBGLOG(INIT, INFO, ("[wifi] iwr->u.essid.length:%d too small\n", - iwr->u.essid.length)); - ret = -E2BIG; /* let caller try larger buffer */ - break; - } - - prExtraBuf = kalMemAlloc(IW_ESSID_MAX_SIZE, VIR_MEM_TYPE); - if (!prExtraBuf) { - ret = -ENOMEM; - break; - } - - /* iwr->u.essid.length is updated by wext_get_essid() */ - - ret = wext_get_essid(prDev, NULL, &iwr->u.essid, prExtraBuf); - if (ret == 0) { - if (copy_to_user(iwr->u.essid.pointer, prExtraBuf, iwr->u.essid.length)) { - ret = -EFAULT; - } - } - - kalMemFree(prExtraBuf, VIR_MEM_TYPE, IW_ESSID_MAX_SIZE); - prExtraBuf = NULL; - - break; - - /* case SIOCSIWNICKN: 0x8B1C, not supported */ - /* case SIOCGIWNICKN: 0x8B1D, not supported */ - - case SIOCSIWRATE: /* 0x8B20, set default bit rate (bps) */ - //ret = wext_set_rate(prDev, &rIwReqInfo, &iwr->u.bitrate, NULL); - break; - - case SIOCGIWRATE: /* 0x8B21, get current bit rate (bps) */ - ret = wext_get_rate(prDev, NULL, &iwr->u.bitrate, NULL); - break; - - case SIOCSIWRTS: /* 0x8B22, set rts/cts threshold */ - ret = wext_set_rts(prDev, NULL, &iwr->u.rts, NULL); - break; - - case SIOCGIWRTS: /* 0x8B23, get rts/cts threshold */ - ret = wext_get_rts(prDev, NULL, &iwr->u.rts, NULL); - break; - - /* case SIOCSIWFRAG: 0x8B24, unsupported */ - case SIOCGIWFRAG: /* 0x8B25, get frag threshold */ - ret = wext_get_frag(prDev, NULL, &iwr->u.frag, NULL); - break; - - case SIOCSIWTXPOW: /* 0x8B26, set relative tx power (in %) */ - ret = wext_set_txpow(prDev, NULL, &iwr->u.txpower, NULL); - break; - - case SIOCGIWTXPOW: /* 0x8B27, get relative tx power (in %) */ - ret = wext_get_txpow(prDev, NULL, &iwr->u.txpower, NULL); - break; - - /* case SIOCSIWRETRY: 0x8B28, unsupported */ - /* case SIOCGIWRETRY: 0x8B29, unsupported */ - -#if 1 - case SIOCSIWENCODE: /* 0x8B2A, set encoding token & mode */ - /* Only DISABLED case has NULL pointer and length == 0 */ - if (iwr->u.encoding.pointer) { - if (iwr->u.encoding.length > 16) { - ret = -E2BIG; - break; - } - - u4ExtraSize = iwr->u.encoding.length; - prExtraBuf = kalMemAlloc(u4ExtraSize, VIR_MEM_TYPE); - if (!prExtraBuf) { - ret = -ENOMEM; - break; - } - - if (copy_from_user(prExtraBuf, - iwr->u.encoding.pointer, - iwr->u.encoding.length)) { - ret = -EFAULT; - } - } - else if (iwr->u.encoding.length != 0) { - ret = -EINVAL; - break; - } - - if (ret == 0) { - ret = wext_set_encode(prDev, NULL, &iwr->u.encoding, prExtraBuf); - } - - if (prExtraBuf) { - kalMemFree(prExtraBuf, VIR_MEM_TYPE, u4ExtraSize); - prExtraBuf = NULL; - } - break; - - case SIOCGIWENCODE: /* 0x8B2B, get encoding token & mode */ - /* check pointer */ - ret = wext_get_encode(prDev, NULL, &iwr->u.encoding, NULL); - break; - - case SIOCSIWPOWER: /* 0x8B2C, set power management */ - ret = wext_set_power(prDev, NULL, &iwr->u.power, NULL); - break; - - case SIOCGIWPOWER: /* 0x8B2D, get power management */ - ret = wext_get_power(prDev, NULL, &iwr->u.power, NULL); - break; - -#if WIRELESS_EXT > 17 - case SIOCSIWGENIE: /* 0x8B30, set gen ie */ - if (iwr->u.data.pointer) { - P_GLUE_INFO_T prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - if (1 /* wlanQueryWapiMode(prGlueInfo->prAdapter) */) { - /* Fixed length structure */ -#if CFG_SUPPORT_WAPI - if (iwr->u.data.length > 42 /* The max wapi ie buffer */) { - ret = -EINVAL; - break; - } -#endif - u4ExtraSize = iwr->u.data.length; - if (u4ExtraSize) { - prExtraBuf = kalMemAlloc(u4ExtraSize, VIR_MEM_TYPE); - if (!prExtraBuf) { - ret = -ENOMEM; - break; - } - if (copy_from_user(prExtraBuf, - iwr->u.data.pointer, - iwr->u.data.length)) { - ret = -EFAULT; - } - else { - WLAN_STATUS rStatus; - UINT_32 u4BufLen; -#if CFG_SUPPORT_WAPI - rStatus = kalIoctl(prGlueInfo, - wlanoidSetWapiAssocInfo, - prExtraBuf, - u4ExtraSize, - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - //printk(KERN_INFO "[wapi] set wapi assoc info error:%lx\n", rStatus); -#endif -#if CFG_SUPPORT_WPS2 - PUINT_8 prDesiredIE = NULL; - if (wextSrchDesiredWPSIE(prExtraBuf, - u4ExtraSize, - 0xDD, - (PUINT_8 *)&prDesiredIE)) { - rStatus = kalIoctl(prGlueInfo, - wlanoidSetWSCAssocInfo, - prDesiredIE, - IE_SIZE(prDesiredIE), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - if (rStatus != WLAN_STATUS_SUCCESS) { - //printk(KERN_INFO "[WSC] set WSC assoc info error:%lx\n", rStatus); - } - } -#endif -#if CFG_SUPPORT_WAPI - } -#endif - } - kalMemFree(prExtraBuf, VIR_MEM_TYPE, u4ExtraSize); - prExtraBuf = NULL; - } - } - } - break; - - case SIOCGIWGENIE: /* 0x8B31, get gen ie, unused */ - break; - -#endif - - case SIOCSIWAUTH: /* 0x8B32, set auth mode params */ - ret = wext_set_auth(prDev, NULL, &iwr->u.param, NULL); - break; - - /* case SIOCGIWAUTH: 0x8B33, unused? */ - case SIOCSIWENCODEEXT: /* 0x8B34, set extended encoding token & mode */ - if (iwr->u.encoding.pointer) { - u4ExtraSize = iwr->u.encoding.length; - prExtraBuf = kalMemAlloc(u4ExtraSize, VIR_MEM_TYPE); - if (!prExtraBuf) { - ret = -ENOMEM; - break; - } - - if (copy_from_user(prExtraBuf, - iwr->u.encoding.pointer, - iwr->u.encoding.length)) { - ret = -EFAULT; - } - } - else if (iwr->u.encoding.length != 0) { - ret = -EINVAL; - break; - } - - if (ret == 0) { - ret = wext_set_encode_ext(prDev, NULL, &iwr->u.encoding, prExtraBuf); - } - - if (prExtraBuf) { - kalMemFree(prExtraBuf, VIR_MEM_TYPE, u4ExtraSize); - prExtraBuf = NULL; - } - break; - - /* case SIOCGIWENCODEEXT: 0x8B35, unused? */ - - case SIOCSIWPMKSA: /* 0x8B36, pmksa cache operation */ - #if 1 - if (iwr->u.data.pointer) { - /* Fixed length structure */ - if (iwr->u.data.length != sizeof(struct iw_pmksa)) { - ret = -EINVAL; - break; - } - - u4ExtraSize = sizeof(struct iw_pmksa); - prExtraBuf = kalMemAlloc(u4ExtraSize, VIR_MEM_TYPE); - if (!prExtraBuf) { - ret = -ENOMEM; - break; - } - - if (copy_from_user(prExtraBuf, - iwr->u.data.pointer, - sizeof(struct iw_pmksa))) { - ret = -EFAULT; - } - else { - switch(((struct iw_pmksa *)prExtraBuf)->cmd) { - case IW_PMKSA_ADD: - /* - printk(KERN_INFO "IW_PMKSA_ADD [" MACSTR "]\n", - MAC2STR(((struct iw_pmksa *)pExtraBuf)->bssid.sa_data)); - */ - { - P_GLUE_INFO_T prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - WLAN_STATUS rStatus; - UINT_32 u4BufLen; - P_PARAM_PMKID_T prPmkid; - - prPmkid =(P_PARAM_PMKID_T)kalMemAlloc(8 + sizeof(PARAM_BSSID_INFO_T), VIR_MEM_TYPE); - if (!prPmkid) { - DBGLOG(INIT, INFO, ("Can not alloc memory for IW_PMKSA_ADD\n")); - ret = -ENOMEM; - break; - } - - prPmkid->u4Length = 8 + sizeof(PARAM_BSSID_INFO_T); - prPmkid->u4BSSIDInfoCount = 1; - kalMemCopy(prPmkid->arBSSIDInfo->arBSSID, - ((struct iw_pmksa *)prExtraBuf)->bssid.sa_data, - 6); - kalMemCopy(prPmkid->arBSSIDInfo->arPMKID, - ((struct iw_pmksa *)prExtraBuf)->pmkid, - IW_PMKID_LEN); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetPmkid, - prPmkid, - sizeof(PARAM_PMKID_T), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("add pmkid error:%lx\n", rStatus)); - } - kalMemFree(prPmkid, VIR_MEM_TYPE, 8 + sizeof(PARAM_BSSID_INFO_T)); - } - break; - case IW_PMKSA_REMOVE: - /* - printk(KERN_INFO "IW_PMKSA_REMOVE [" MACSTR "]\n", - MAC2STR(((struct iw_pmksa *)buf)->bssid.sa_data)); - */ - break; - case IW_PMKSA_FLUSH: - /* - printk(KERN_INFO "IW_PMKSA_FLUSH\n"); - */ - { - P_GLUE_INFO_T prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - WLAN_STATUS rStatus; - UINT_32 u4BufLen; - P_PARAM_PMKID_T prPmkid; - - prPmkid =(P_PARAM_PMKID_T)kalMemAlloc(8, VIR_MEM_TYPE); - if (!prPmkid) { - DBGLOG(INIT, INFO, ("Can not alloc memory for IW_PMKSA_FLUSH\n")); - ret = -ENOMEM; - break; - } - - prPmkid->u4Length = 8; - prPmkid->u4BSSIDInfoCount = 0; - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetPmkid, - prPmkid, - sizeof(PARAM_PMKID_T), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(INIT, INFO, ("flush pmkid error:%lx\n", rStatus)); - } - kalMemFree(prPmkid, VIR_MEM_TYPE, 8); - } - break; - default: - DBGLOG(INIT, INFO, ("UNKNOWN iw_pmksa command:%d\n", - ((struct iw_pmksa *)prExtraBuf)->cmd)); - ret = -EFAULT; - break; - } - } - - if (prExtraBuf) { - kalMemFree(prExtraBuf, VIR_MEM_TYPE, u4ExtraSize); - prExtraBuf = NULL; - } - } - else if (iwr->u.data.length != 0) { - ret = -EINVAL; - break; - } - #endif - break; - -#endif - - default: - /* printk(KERN_NOTICE "unsupported IOCTL: 0x%x\n", i4Cmd); */ - ret = -EOPNOTSUPP; - break; - } - - //printk("%ld CMD:0x%x ret:%d\n", jiffies_to_msecs(jiffies), i4Cmd, ret); - - return ret; -} /* wext_support_ioctl */ - - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To send an event (RAW socket pacekt) to user process actively. -* -* \param[in] prGlueInfo Glue layer info. -* \param[in] u4cmd Whcih event command we want to indicate to user process. -* \param[in] pData Data buffer to be indicated. -* \param[in] dataLen Available data size in pData. -* -* \return (none) -* -* \note Event is indicated to upper layer if cmd is supported and data is valid. -* Using of kernel symbol wireless_send_event(), which is defined in -* after WE-14 (2.4.20). -*/ -/*----------------------------------------------------------------------------*/ -void -wext_indicate_wext_event ( - IN P_GLUE_INFO_T prGlueInfo, - IN unsigned int u4Cmd, - IN unsigned char *pucData, - IN unsigned int u4dataLen - ) -{ - union iwreq_data wrqu; - unsigned char *pucExtraInfo = NULL; -#if WIRELESS_EXT >= 15 - unsigned char *pucDesiredIE = NULL; - unsigned char aucExtraInfoBuf[200]; -#endif -#if WIRELESS_EXT < 18 - int i; -#endif - - memset(&wrqu, 0, sizeof(wrqu)); - - switch (u4Cmd) { - case SIOCGIWTXPOW: - memcpy(&wrqu.power, pucData, u4dataLen); - break; - case SIOCGIWSCAN: - complete_all(&prGlueInfo->rScanComp); - break; - - case SIOCGIWAP: - if (pucData) { - memcpy(&wrqu.ap_addr.sa_data, pucData, ETH_ALEN); - } - else { - memset(&wrqu.ap_addr.sa_data, 0, ETH_ALEN); - } - break; - - case IWEVASSOCREQIE: -#if WIRELESS_EXT < 15 - /* under WE-15, no suitable Event can be used */ - goto skip_indicate_event; -#else - /* do supplicant a favor, parse to the start of WPA/RSN IE */ - if (wextSrchDesiredWPAIE(pucData, u4dataLen, 0x30, &pucDesiredIE)) { - /* RSN IE found */ - } -#if 0 - else if (wextSrchDesiredWPSIE(pucData, u4dataLen, 0xDD, &pucDesiredIE)) { - /* WPS IE found */ - } -#endif - else if (wextSrchDesiredWPAIE(pucData, u4dataLen, 0xDD, &pucDesiredIE)) { - /* WPA IE found */ - } -#if CFG_SUPPORT_WAPI /* Android+ */ - else if (wextSrchDesiredWAPIIE(pucData, u4dataLen, &pucDesiredIE)) { - //printk("wextSrchDesiredWAPIIE!!\n"); - /* WAPI IE found */ - } -#endif - else { - /* no WPA/RSN IE found, skip this event */ - goto skip_indicate_event; - } - - #if WIRELESS_EXT < 18 - /* under WE-18, only IWEVCUSTOM can be used */ - u4Cmd = IWEVCUSTOM; - pucExtraInfo = aucExtraInfoBuf; - pucExtraInfo += sprintf(pucExtraInfo, "ASSOCINFO(ReqIEs="); - /* printk(KERN_DEBUG "assoc info buffer size needed:%d\n", infoElemLen * 2 + 17); */ - /* translate binary string to hex string, requirement of IWEVCUSTOM */ - for (i = 0; i < pucDesiredIE[1] + 2 ; ++i) { - pucExtraInfo += sprintf(pucExtraInfo, "%02x", pucDesiredIE[i]); - } - pucExtraInfo = aucExtraInfoBuf; - wrqu.data.length = 17 + (pucDesiredIE[1] + 2) * 2; - #else - /* IWEVASSOCREQIE, indicate binary string */ - pucExtraInfo = pucDesiredIE; - wrqu.data.length = pucDesiredIE[1] + 2; - #endif -#endif /* WIRELESS_EXT < 15 */ - break; - - case IWEVMICHAELMICFAILURE: -#if WIRELESS_EXT < 15 - /* under WE-15, no suitable Event can be used */ - goto skip_indicate_event; -#else - if (pucData) { - P_PARAM_AUTH_REQUEST_T pAuthReq = (P_PARAM_AUTH_REQUEST_T)pucData; - /* under WE-18, only IWEVCUSTOM can be used */ - u4Cmd = IWEVCUSTOM; - pucExtraInfo = aucExtraInfoBuf; - pucExtraInfo += sprintf(pucExtraInfo, - "MLME-MICHAELMICFAILURE.indication "); - pucExtraInfo += sprintf(pucExtraInfo, - "%s", - (pAuthReq->u4Flags == PARAM_AUTH_REQUEST_GROUP_ERROR) ? - "groupcast " : "unicast "); - - wrqu.data.length = pucExtraInfo - aucExtraInfoBuf; - pucExtraInfo = aucExtraInfoBuf; - } -#endif /* WIRELESS_EXT < 15 */ - break; - - case IWEVPMKIDCAND: - if (prGlueInfo->rWpaInfo.u4WpaVersion == IW_AUTH_WPA_VERSION_WPA2 && - prGlueInfo->rWpaInfo.u4KeyMgmt == IW_AUTH_KEY_MGMT_802_1X) { - - /* only used in WPA2 */ -#if WIRELESS_EXT >= 18 - P_PARAM_PMKID_CANDIDATE_T prPmkidCand = (P_PARAM_PMKID_CANDIDATE_T)pucData; - - struct iw_pmkid_cand rPmkidCand; - pucExtraInfo = aucExtraInfoBuf; - - rPmkidCand.flags = prPmkidCand->u4Flags; - rPmkidCand.index = 0; - kalMemCopy(rPmkidCand.bssid.sa_data, prPmkidCand->arBSSID, 6); - - kalMemCopy(pucExtraInfo, (PUINT_8)&rPmkidCand, sizeof(struct iw_pmkid_cand)); - wrqu.data.length = sizeof(struct iw_pmkid_cand); - - /* pmkid canadidate list is supported after WE-18 */ - /* indicate struct iw_pmkid_cand */ -#else - /* printk(KERN_INFO "IWEVPMKIDCAND event skipped, WE < 18\n"); */ - goto skip_indicate_event; -#endif - } - else { - /* printk(KERN_INFO "IWEVPMKIDCAND event skipped, NOT WPA2\n"); */ - goto skip_indicate_event; - } - break; - - case IWEVCUSTOM: - u4Cmd = IWEVCUSTOM; - pucExtraInfo = aucExtraInfoBuf; - kalMemCopy(pucExtraInfo, pucData, sizeof(PTA_IPC_T)); - wrqu.data.length = sizeof(PTA_IPC_T); - break; - - default: - /* printk(KERN_INFO "Unsupported wext event:%x\n", cmd); */ - goto skip_indicate_event; - } - - /* Send event to user space */ - wireless_send_event(prGlueInfo->prDevHandler, u4Cmd, &wrqu, pucExtraInfo); - -skip_indicate_event: - return; -} /* wext_indicate_wext_event */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief A method of struct net_device, to get the network interface statistical -* information. -* -* Whenever an application needs to get statistics for the interface, this method -* is called. This happens, for example, when ifconfig or netstat -i is run. -* -* \param[in] pDev Pointer to struct net_device. -* -* \return net_device_stats buffer pointer. -* -*/ -/*----------------------------------------------------------------------------*/ -struct iw_statistics * -wext_get_wireless_stats ( - struct net_device *prDev - ) -{ - - WLAN_STATUS rStatus = WLAN_STATUS_FAILURE; - P_GLUE_INFO_T prGlueInfo = NULL; - struct iw_statistics *pStats = NULL; - INT_32 i4Rssi; - UINT_32 bufLen = 0; - - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - ASSERT(prGlueInfo); - if (!prGlueInfo) { - goto stat_out; - } - - pStats = (struct iw_statistics *) (&(prGlueInfo->rIwStats)); - - if (!prDev || !netif_carrier_ok(prDev)) { - /* network not connected */ - goto stat_out; - } - - rStatus = kalIoctl(prGlueInfo, - wlanoidQueryRssi, - &i4Rssi, - sizeof(i4Rssi), - TRUE, - TRUE, - TRUE, - FALSE, - &bufLen); - -stat_out: - return pStats; -} /* wlan_get_wireless_stats */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief To report the private supported IOCTLs table to user space. -* -* \param[in] prNetDev Net device requested. -* \param[out] prIfReq Pointer to ifreq structure, content is copied back to -* user space buffer in gl_iwpriv_table. -* -* \retval 0 For success. -* \retval -E2BIG For user's buffer size is too small. -* \retval -EFAULT For fail. -* -*/ -/*----------------------------------------------------------------------------*/ -int -wext_get_priv ( - IN struct net_device *prNetDev, - IN struct ifreq *prIfReq - ) -{ - /* prIfReq is verified in the caller function wlanDoIOCTL() */ - struct iwreq *prIwReq = (struct iwreq *)prIfReq; - struct iw_point *prData= (struct iw_point *)&prIwReq->u.data; - UINT_16 u2BufferSize = 0; - - u2BufferSize = prData->length; - - /* update our private table size */ - prData->length = (__u16)sizeof(rIwPrivTable)/sizeof(struct iw_priv_args); - - if (u2BufferSize < prData->length) { - return -E2BIG; - } - - if (prData->length) { - if (copy_to_user(prData->pointer, rIwPrivTable, sizeof(rIwPrivTable))) { - return -EFAULT; - } - } - - return 0; -} /* wext_get_priv */ - -#endif /* WIRELESS_EXT */ - - - diff --git a/drivers/net/wireless/mt5931/os/linux/gl_wext_priv.c b/drivers/net/wireless/mt5931/os/linux/gl_wext_priv.c deleted file mode 100755 index aafe5696310a..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/gl_wext_priv.c +++ /dev/null @@ -1,2238 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/gl_wext_priv.c#4 $ -*/ - -/*! \file gl_wext_priv.c - \brief This file includes private ioctl support. -*/ - - - -/* -** $Log: gl_wext_priv.c $ - * - * 07 17 2012 yuche.tsai - * NULL - * Let netdev bring up. - * - * 06 13 2012 yuche.tsai - * NULL - * Update maintrunk driver. - * Add support for driver compose assoc request frame. - * - * 03 20 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function[WCXRP00001202] [MT6628 Wi-Fi][FW] Adding the New PN init code - * use return to avoid the ioctl return not supported - * - * 03 02 2012 terry.wu - * NULL - * Snc CFG80211 modification for ICS migration from branch 2.2. - * - * 01 16 2012 wh.su - * [WCXRP00001170] [MT6620 Wi-Fi][Driver] Adding the related code for set/get band ioctl - * Adding the template code for set / get band IOCTL (with ICS supplicant_6).. - * - * 01 05 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the related ioctl / wlan oid function to set the Tx power cfg. - * - * 01 02 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the proto type function for set_int set_tx_power and get int get_ch_list. - * - * 11 10 2011 cp.wu - * [WCXRP00001098] [MT6620 Wi-Fi][Driver] Replace printk by DBG LOG macros in linux porting layer - * 1. eliminaite direct calls to printk in porting layer. - * 2. replaced by DBGLOG, which would be XLOG on ALPS platforms. - * - * 11 02 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings - * Fixed typo. - * - * 09 20 2011 chinglan.wang - * [WCXRP00000989] [WiFi Direct] [Driver] Add a new io control API to start the formation for the sigma test. - * . - * - * 07 28 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings - * Add BWCS cmd and event. - * - * 07 18 2011 chinghwa.yu - * [WCXRP00000063] Update BCM CoEx design and settings[WCXRP00000612] [MT6620 Wi-Fi] [FW] CSD update SWRDD algorithm - * Add CMD/Event for RDD and BWCS. - * - * 03 17 2011 chinglan.wang - * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature - * . - * - * 03 07 2011 terry.wu - * [WCXRP00000521] [MT6620 Wi-Fi][Driver] Remove non-standard debug message - * Toggle non-standard debug messages to comments. - * - * 01 27 2011 cm.chang - * [WCXRP00000402] [MT6620 Wi-Fi][Driver] Enable MCR read/write by iwpriv by default - * . - * - * 01 26 2011 wh.su - * [WCXRP00000396] [MT6620 Wi-Fi][Driver] Support Sw Ctrl ioctl at linux - * adding the SW cmd ioctl support, use set/get structure ioctl. - * - * 01 20 2011 eddie.chen - * [WCXRP00000374] [MT6620 Wi-Fi][DRV] SW debug control - * Adjust OID order. - * - * 01 20 2011 eddie.chen - * [WCXRP00000374] [MT6620 Wi-Fi][DRV] SW debug control - * Add Oid for sw control debug command - * - * 01 07 2011 cm.chang - * [WCXRP00000336] [MT6620 Wi-Fi][Driver] Add test mode commands in normal phone operation - * Add a new compiling option to control if MCR read/write is permitted - * - * 12 31 2010 cm.chang - * [WCXRP00000336] [MT6620 Wi-Fi][Driver] Add test mode commands in normal phone operation - * Add some iwpriv commands to support test mode operation - * - * 12 15 2010 george.huang - * [WCXRP00000152] [MT6620 Wi-Fi] AP mode power saving function - * Support set PS profile and set WMM-PS related iwpriv. - * - * 11 08 2010 wh.su - * [WCXRP00000171] [MT6620 Wi-Fi][Driver] Add message check code same behavior as mt5921 - * add the message check code from mt5921. - * - * 10 18 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android - * complete implementation of Android NVRAM access - * - * 09 24 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * correct typo for NVRAM access. - * - * 09 23 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * add skeleton for NVRAM integration - * - * 08 04 2010 cp.wu - * NULL - * revert changelist #15371, efuse read/write access will be done by RF test approach - * - * 08 04 2010 cp.wu - * NULL - * add OID definitions for EFUSE read/write access. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 06 01 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * enable OID_CUSTOM_MTK_WIFI_TEST for RFTest & META tool - * - * 05 29 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * fix private ioctl for rftest - * - * 04 21 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * add for private ioctl support -** \main\maintrunk.MT5921\32 2009-10-08 10:33:25 GMT mtk01090 -** Avoid accessing private data of net_device directly. Replace with netdev_priv(). Add more checking for input parameters and pointers. -** \main\maintrunk.MT5921\31 2009-09-29 16:46:21 GMT mtk01090 -** Remove unused functions -** \main\maintrunk.MT5921\30 2009-09-29 14:46:47 GMT mtk01090 -** Fix compile warning -** \main\maintrunk.MT5921\29 2009-09-29 14:28:48 GMT mtk01090 -** Fix compile warning -** \main\maintrunk.MT5921\28 2009-09-28 22:21:38 GMT mtk01090 -** Refine lines to supress compile warning -** \main\maintrunk.MT5921\27 2009-09-28 20:19:14 GMT mtk01090 -** Add private ioctl to carry OID structures. Restructure public/private ioctl interfaces to Linux kernel. -** \main\maintrunk.MT5921\26 2009-08-18 22:56:53 GMT mtk01090 -** Add Linux SDIO (with mmc core) support. -** Add Linux 2.6.21, 2.6.25, 2.6.26. -** Fix compile warning in Linux. -** \main\maintrunk.MT5921\25 2009-05-07 22:26:15 GMT mtk01089 -** Add mandatory and private IO control for Linux BWCS -** \main\maintrunk.MT5921\24 2009-04-29 10:07:05 GMT mtk01088 -** fixed the compiling error at linux -** \main\maintrunk.MT5921\23 2009-04-24 09:09:45 GMT mtk01088 -** mark the code not used at linux supplicant v0.6.7 -** \main\maintrunk.MT5921\22 2008-11-24 21:03:51 GMT mtk01425 -** 1. Add PTA_ENABLED flag -** \main\maintrunk.MT5921\21 2008-08-29 14:55:59 GMT mtk01088 -** adjust the code for meet the coding style, and add assert check -** \main\maintrunk.MT5921\20 2008-07-16 15:23:20 GMT mtk01104 -** Support GPIO2 mode -** \main\maintrunk.MT5921\19 2008-07-15 17:43:11 GMT mtk01084 -** modify variable name -** \main\maintrunk.MT5921\18 2008-07-14 14:37:58 GMT mtk01104 -** Add exception handle about length in function priv_set_struct() -** \main\maintrunk.MT5921\17 2008-07-14 13:55:32 GMT mtk01104 -** Support PRIV_CMD_BT_COEXIST -** \main\maintrunk.MT5921\16 2008-07-09 00:20:15 GMT mtk01461 -** Add priv oid to support WMM_PS_TEST -** \main\maintrunk.MT5921\15 2008-06-02 11:15:22 GMT mtk01461 -** Update after wlanoidSetPowerMode changed -** \main\maintrunk.MT5921\14 2008-05-30 19:31:07 GMT mtk01461 -** Add IOCTL for Power Mode -** \main\maintrunk.MT5921\13 2008-05-30 18:57:15 GMT mtk01461 -** Not use wlanoidSetCSUMOffloadForLinux() -** \main\maintrunk.MT5921\12 2008-05-30 15:13:18 GMT mtk01084 -** rename wlanoid -** \main\maintrunk.MT5921\11 2008-05-29 14:16:31 GMT mtk01084 -** rename for wlanoidSetBeaconIntervalForLinux -** \main\maintrunk.MT5921\10 2008-04-17 23:06:37 GMT mtk01461 -** Add iwpriv support for AdHocMode setting -** \main\maintrunk.MT5921\9 2008-03-31 21:00:55 GMT mtk01461 -** Add priv IOCTL for VOIP setting -** \main\maintrunk.MT5921\8 2008-03-31 13:49:43 GMT mtk01461 -** Add priv ioctl to turn on / off roaming -** \main\maintrunk.MT5921\7 2008-03-26 15:35:14 GMT mtk01461 -** Add CSUM offload priv ioctl for Linux -** \main\maintrunk.MT5921\6 2008-03-11 14:50:59 GMT mtk01461 -** Unify priv ioctl -** \main\maintrunk.MT5921\5 2007-11-06 19:32:30 GMT mtk01088 -** add WPS code -** \main\maintrunk.MT5921\4 2007-10-30 12:01:39 GMT MTK01425 -** 1. Update wlanQueryInformation and wlanSetInformation -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_os.h" -#include "gl_wext_priv.h" -#if CFG_SUPPORT_WAPI -#include "gl_sec.h" -#endif -#if CFG_ENABLE_WIFI_DIRECT -#include "gl_p2p_os.h" -#endif - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define NUM_SUPPORTED_OIDS (sizeof(arWlanOidReqTable) / sizeof(WLAN_REQ_ENTRY)) - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -static int -priv_get_ndis ( - IN struct net_device *prNetDev, - IN NDIS_TRANSPORT_STRUCT* prNdisReq, - OUT PUINT_32 pu4OutputLen - ); - -static int -priv_set_ndis ( - IN struct net_device *prNetDev, - IN NDIS_TRANSPORT_STRUCT* prNdisReq, - OUT PUINT_32 pu4OutputLen - ); - -#if 0 /* CFG_SUPPORT_WPS */ -static int -priv_set_appie ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN union iwreq_data *prIwReqData, - OUT char *pcExtra - ); - -static int -priv_set_filter ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN union iwreq_data *prIwReqData, - OUT char *pcExtra - ); -#endif /* CFG_SUPPORT_WPS */ - -static BOOLEAN -reqSearchSupportedOidEntry ( - IN UINT_32 rOid, - OUT P_WLAN_REQ_ENTRY *ppWlanReqEntry - ); - -#if 0 -static WLAN_STATUS -reqExtQueryConfiguration ( - IN P_GLUE_INFO_T prGlueInfo, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ); - -static WLAN_STATUS -reqExtSetConfiguration ( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); -#endif - -static WLAN_STATUS -reqExtSetAcpiDevicePowerState ( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ); - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ -static UINT_8 aucOidBuf[4096] = {0}; - -/* OID processing table */ -/* Order is important here because the OIDs should be in order of - increasing value for binary searching. */ -static WLAN_REQ_ENTRY arWlanOidReqTable[] = { - /* - {(NDIS_OID)rOid, - (PUINT_8)pucOidName, - fgQryBufLenChecking, fgSetBufLenChecking, fgIsHandleInGlueLayerOnly, u4InfoBufLen, - pfOidQueryHandler, - pfOidSetHandler} - */ - /* General Operational Characteristics */ - - /* Ethernet Operational Characteristics */ - {OID_802_3_CURRENT_ADDRESS, - DISP_STRING("OID_802_3_CURRENT_ADDRESS"), - TRUE, TRUE, ENUM_OID_DRIVER_CORE, 6, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryCurrentAddr, - NULL}, - - /* OID_802_3_MULTICAST_LIST */ - /* OID_802_3_MAXIMUM_LIST_SIZE */ - /* Ethernet Statistics */ - - /* NDIS 802.11 Wireless LAN OIDs */ - {OID_802_11_SUPPORTED_RATES, - DISP_STRING("OID_802_11_SUPPORTED_RATES"), - TRUE, FALSE, ENUM_OID_DRIVER_CORE, sizeof(PARAM_RATES_EX), - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQuerySupportedRates, - NULL}, - /* - {OID_802_11_CONFIGURATION, - DISP_STRING("OID_802_11_CONFIGURATION"), - TRUE, TRUE, ENUM_OID_GLUE_EXTENSION, sizeof(PARAM_802_11_CONFIG_T), - (PFN_OID_HANDLER_FUNC_REQ)reqExtQueryConfiguration, - (PFN_OID_HANDLER_FUNC_REQ)reqExtSetConfiguration}, - */ - {OID_PNP_SET_POWER, - DISP_STRING("OID_PNP_SET_POWER"), - TRUE, FALSE, ENUM_OID_GLUE_EXTENSION, sizeof(PARAM_DEVICE_POWER_STATE), - NULL, - (PFN_OID_HANDLER_FUNC_REQ)reqExtSetAcpiDevicePowerState}, - - /* Custom OIDs */ - {OID_CUSTOM_OID_INTERFACE_VERSION, - DISP_STRING("OID_CUSTOM_OID_INTERFACE_VERSION"), - TRUE, FALSE, ENUM_OID_DRIVER_CORE, 4, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryOidInterfaceVersion, - NULL}, - - /* -#if PTA_ENABLED - {OID_CUSTOM_BT_COEXIST_CTRL, - DISP_STRING("OID_CUSTOM_BT_COEXIST_CTRL"), - FALSE, TRUE, ENUM_OID_DRIVER_CORE, sizeof(PARAM_CUSTOM_BT_COEXIST_T), - NULL, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetBtCoexistCtrl}, -#endif - */ - - /* - {OID_CUSTOM_POWER_MANAGEMENT_PROFILE, - DISP_STRING("OID_CUSTOM_POWER_MANAGEMENT_PROFILE"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, 0, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryPwrMgmtProfParam, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetPwrMgmtProfParam}, - {OID_CUSTOM_PATTERN_CONFIG, - DISP_STRING("OID_CUSTOM_PATTERN_CONFIG"), - TRUE, TRUE, ENUM_OID_DRIVER_CORE, sizeof(PARAM_CUSTOM_PATTERN_SEARCH_CONFIG_STRUC_T), - NULL, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetPatternConfig}, - {OID_CUSTOM_BG_SSID_SEARCH_CONFIG, - DISP_STRING("OID_CUSTOM_BG_SSID_SEARCH_CONFIG"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, 0, - NULL, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetBgSsidParam}, - {OID_CUSTOM_VOIP_SETUP, - DISP_STRING("OID_CUSTOM_VOIP_SETUP"), - TRUE, TRUE, ENUM_OID_DRIVER_CORE, 4, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryVoipConnectionStatus, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetVoipConnectionStatus}, - {OID_CUSTOM_ADD_TS, - DISP_STRING("OID_CUSTOM_ADD_TS"), - TRUE, TRUE, ENUM_OID_DRIVER_CORE, 4, - NULL, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidAddTS}, - {OID_CUSTOM_DEL_TS, - DISP_STRING("OID_CUSTOM_DEL_TS"), - TRUE, TRUE, ENUM_OID_DRIVER_CORE, 4, - NULL, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidDelTS}, - */ - - /* -#if CFG_LP_PATTERN_SEARCH_SLT - {OID_CUSTOM_SLT, - DISP_STRING("OID_CUSTOM_SLT"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, 0, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQuerySltResult, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetSltMode}, -#endif - - {OID_CUSTOM_ROAMING_EN, - DISP_STRING("OID_CUSTOM_ROAMING_EN"), - TRUE, TRUE, ENUM_OID_DRIVER_CORE, 4, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryRoamingFunction, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetRoamingFunction}, - {OID_CUSTOM_WMM_PS_TEST, - DISP_STRING("OID_CUSTOM_WMM_PS_TEST"), - TRUE, TRUE, ENUM_OID_DRIVER_CORE, 4, - NULL, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetWiFiWmmPsTest}, - {OID_CUSTOM_COUNTRY_STRING, - DISP_STRING("OID_CUSTOM_COUNTRY_STRING"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, 0, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryCurrentCountry, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetCurrentCountry}, - -#if CFG_SUPPORT_802_11D - {OID_CUSTOM_MULTI_DOMAIN_CAPABILITY, - DISP_STRING("OID_CUSTOM_MULTI_DOMAIN_CAPABILITY"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, 0, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryMultiDomainCap, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetMultiDomainCap}, -#endif - - {OID_CUSTOM_GPIO2_MODE, - DISP_STRING("OID_CUSTOM_GPIO2_MODE"), - FALSE, TRUE, ENUM_OID_DRIVER_CORE, sizeof(ENUM_PARAM_GPIO2_MODE_T), - NULL, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetGPIO2Mode}, - {OID_CUSTOM_CONTINUOUS_POLL, - DISP_STRING("OID_CUSTOM_CONTINUOUS_POLL"), - FALSE, TRUE, ENUM_OID_DRIVER_CORE, sizeof(PARAM_CONTINUOUS_POLL_T), - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryContinuousPollInterval, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetContinuousPollProfile}, - {OID_CUSTOM_DISABLE_BEACON_DETECTION, - DISP_STRING("OID_CUSTOM_DISABLE_BEACON_DETECTION"), - FALSE, TRUE, ENUM_OID_DRIVER_CORE, 4, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryDisableBeaconDetectionFunc, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetDisableBeaconDetectionFunc}, - */ - - /* WPS */ - /* - {OID_CUSTOM_DISABLE_PRIVACY_CHECK, - DISP_STRING("OID_CUSTOM_DISABLE_PRIVACY_CHECK"), - FALSE, TRUE, ENUM_OID_DRIVER_CORE, 4, - NULL, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetDisablePriavcyCheck}, - */ - - {OID_CUSTOM_MCR_RW, - DISP_STRING("OID_CUSTOM_MCR_RW"), - TRUE, TRUE, ENUM_OID_DRIVER_CORE, sizeof(PARAM_CUSTOM_MCR_RW_STRUC_T), - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryMcrRead, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetMcrWrite}, - - {OID_CUSTOM_EEPROM_RW, - DISP_STRING("OID_CUSTOM_EEPROM_RW"), - TRUE, TRUE, ENUM_OID_DRIVER_CORE, sizeof(PARAM_CUSTOM_EEPROM_RW_STRUC_T), - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryEepromRead, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetEepromWrite}, - - {OID_CUSTOM_SW_CTRL, - DISP_STRING("OID_CUSTOM_SW_CTRL"), - TRUE, TRUE, ENUM_OID_DRIVER_CORE, sizeof(PARAM_CUSTOM_SW_CTRL_STRUC_T), - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQuerySwCtrlRead, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetSwCtrlWrite}, - - {OID_CUSTOM_MEM_DUMP, - DISP_STRING("OID_CUSTOM_MEM_DUMP"), - TRUE, TRUE, ENUM_OID_DRIVER_CORE, sizeof(PARAM_CUSTOM_MEM_DUMP_STRUC_T), - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryMemDump, - NULL}, - - {OID_CUSTOM_TEST_MODE, - DISP_STRING("OID_CUSTOM_TEST_MODE"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, 0, - NULL, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidRftestSetTestMode}, - - /* - {OID_CUSTOM_TEST_RX_STATUS, - DISP_STRING("OID_CUSTOM_TEST_RX_STATUS"), - FALSE, TRUE, ENUM_OID_DRIVER_CORE, sizeof(PARAM_CUSTOM_RFTEST_RX_STATUS_STRUC_T), - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryRfTestRxStatus, - NULL}, - {OID_CUSTOM_TEST_TX_STATUS, - DISP_STRING("OID_CUSTOM_TEST_TX_STATUS"), - FALSE, TRUE, ENUM_OID_DRIVER_CORE, sizeof(PARAM_CUSTOM_RFTEST_TX_STATUS_STRUC_T), - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryRfTestTxStatus, - NULL}, - */ - {OID_CUSTOM_ABORT_TEST_MODE, - DISP_STRING("OID_CUSTOM_ABORT_TEST_MODE"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, 0, - NULL, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidRftestSetAbortTestMode}, - {OID_CUSTOM_MTK_WIFI_TEST, - DISP_STRING("OID_CUSTOM_MTK_WIFI_TEST"), - TRUE, TRUE, ENUM_OID_DRIVER_CORE, sizeof(PARAM_MTK_WIFI_TEST_STRUC_T), - (PFN_OID_HANDLER_FUNC_REQ)wlanoidRftestQueryAutoTest, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidRftestSetAutoTest}, - - /* OID_CUSTOM_EMULATION_VERSION_CONTROL */ - - /* BWCS */ -#if CFG_SUPPORT_BCM && CFG_SUPPORT_BCM_BWCS - {OID_CUSTOM_BWCS_CMD, - DISP_STRING("OID_CUSTOM_BWCS_CMD"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, sizeof(PTA_IPC_T), - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryBT, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetBT}, -#endif - -/* {OID_CUSTOM_SINGLE_ANTENNA, - DISP_STRING("OID_CUSTOM_SINGLE_ANTENNA"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, 4, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryBtSingleAntenna, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetBtSingleAntenna}, - {OID_CUSTOM_SET_PTA, - DISP_STRING("OID_CUSTOM_SET_PTA"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, 4, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryPta, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetPta}, - */ - - { OID_CUSTOM_MTK_NVRAM_RW, - DISP_STRING("OID_CUSTOM_MTK_NVRAM_RW"), - TRUE, TRUE, ENUM_OID_DRIVER_CORE, sizeof(PARAM_CUSTOM_NVRAM_RW_STRUCT_T), - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryNvramRead, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetNvramWrite }, - - { OID_CUSTOM_CFG_SRC_TYPE, - DISP_STRING("OID_CUSTOM_CFG_SRC_TYPE"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, sizeof(ENUM_CFG_SRC_TYPE_T), - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryCfgSrcType, - NULL }, - - { OID_CUSTOM_EEPROM_TYPE, - DISP_STRING("OID_CUSTOM_EEPROM_TYPE"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, sizeof(ENUM_EEPROM_TYPE_T), - (PFN_OID_HANDLER_FUNC_REQ)wlanoidQueryEepromType, - NULL }, - -#if CFG_SUPPORT_WAPI - {OID_802_11_WAPI_MODE, - DISP_STRING("OID_802_11_WAPI_MODE"), - FALSE, TRUE, ENUM_OID_DRIVER_CORE, 4, - NULL, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetWapiMode}, - {OID_802_11_WAPI_ASSOC_INFO, - DISP_STRING("OID_802_11_WAPI_ASSOC_INFO"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, 0, - NULL, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetWapiAssocInfo}, - {OID_802_11_SET_WAPI_KEY, - DISP_STRING("OID_802_11_SET_WAPI_KEY"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, sizeof(PARAM_WPI_KEY_T), - NULL, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetWapiKey}, -#endif - -#if CFG_SUPPORT_WPS2 - {OID_802_11_WSC_ASSOC_INFO, - DISP_STRING("OID_802_11_WSC_ASSOC_INFO"), - FALSE, FALSE, ENUM_OID_DRIVER_CORE, 0, - NULL, - (PFN_OID_HANDLER_FUNC_REQ)wlanoidSetWSCAssocInfo}, -#endif -}; - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Dispatching function for private ioctl region (SIOCIWFIRSTPRIV ~ -* SIOCIWLASTPRIV). -* -* \param[in] prNetDev Net device requested. -* \param[in] prIfReq Pointer to ifreq structure. -* \param[in] i4Cmd Command ID between SIOCIWFIRSTPRIV and SIOCIWLASTPRIV. -* -* \retval 0 for success. -* \retval -EOPNOTSUPP If cmd is not supported. -* \retval -EFAULT For fail. -* -*/ -/*----------------------------------------------------------------------------*/ -int -priv_support_ioctl ( - IN struct net_device *prNetDev, - IN OUT struct ifreq *prIfReq, - IN int i4Cmd - ) -{ - /* prIfReq is verified in the caller function wlanDoIOCTL() */ - struct iwreq *prIwReq = (struct iwreq *)prIfReq; - struct iw_request_info rIwReqInfo; - - /* prDev is verified in the caller function wlanDoIOCTL() */ - - /* Prepare the call */ - rIwReqInfo.cmd = (__u16)i4Cmd; - rIwReqInfo.flags = 0; - - switch (i4Cmd) { - case IOCTL_SET_INT: - /* NOTE(Kevin): 1/3 INT Type <= IFNAMSIZ, so we don't need copy_from/to_user() */ - return priv_set_int(prNetDev, &rIwReqInfo, &(prIwReq->u), (char *) &(prIwReq->u)); - - case IOCTL_GET_INT: - /* NOTE(Kevin): 1/3 INT Type <= IFNAMSIZ, so we don't need copy_from/to_user() */ - return priv_get_int(prNetDev, &rIwReqInfo, &(prIwReq->u), (char *) &(prIwReq->u)); - - case IOCTL_SET_STRUCT: - case IOCTL_SET_STRUCT_FOR_EM: - return priv_set_struct(prNetDev, &rIwReqInfo, &prIwReq->u, (char *) &(prIwReq->u)); - - case IOCTL_GET_STRUCT: - return priv_get_struct(prNetDev, &rIwReqInfo, &prIwReq->u, (char *) &(prIwReq->u)); - - default: - return -EOPNOTSUPP; - - } /* end of switch */ - -}/* priv_support_ioctl */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Private ioctl set int handler. -* -* \param[in] prNetDev Net device requested. -* \param[in] prIwReqInfo Pointer to iwreq structure. -* \param[in] prIwReqData The ioctl data structure, use the field of sub-command. -* \param[in] pcExtra The buffer with input value -* -* \retval 0 For success. -* \retval -EOPNOTSUPP If cmd is not supported. -* \retval -EINVAL If a value is out of range. -* -*/ -/*----------------------------------------------------------------------------*/ -int -priv_set_int ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN union iwreq_data *prIwReqData, - IN char *pcExtra - ) -{ - UINT_32 u4SubCmd; - PUINT_32 pu4IntBuf; - P_NDIS_TRANSPORT_STRUCT prNdisReq; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4BufLen = 0; - int status = 0; - P_PTA_IPC_T prPtaIpc; - - ASSERT(prNetDev); - ASSERT(prIwReqInfo); - ASSERT(prIwReqData); - ASSERT(pcExtra); - - if (FALSE == GLUE_CHK_PR3(prNetDev, prIwReqData, pcExtra)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - u4SubCmd = (UINT_32) prIwReqData->mode; - pu4IntBuf = (PUINT_32) pcExtra; - - switch (u4SubCmd) { - case PRIV_CMD_TEST_MODE: - //printk("TestMode=%ld\n", pu4IntBuf[1]); - prNdisReq = (P_NDIS_TRANSPORT_STRUCT) &aucOidBuf[0]; - - if (pu4IntBuf[1] == PRIV_CMD_TEST_MAGIC_KEY) { - prNdisReq->ndisOidCmd = OID_CUSTOM_TEST_MODE; - } - else if (pu4IntBuf[1] == 0) { - prNdisReq->ndisOidCmd = OID_CUSTOM_ABORT_TEST_MODE; - } - else { - status = 0; - break; - } - prNdisReq->inNdisOidlength = 0; - prNdisReq->outNdisOidLength = 0; - - /* Execute this OID */ - status = priv_set_ndis(prNetDev, prNdisReq, &u4BufLen); - break; - - case PRIV_CMD_TEST_CMD: - //printk("CMD=0x%08lx, data=0x%08lx\n", pu4IntBuf[1], pu4IntBuf[2]); - prNdisReq = (P_NDIS_TRANSPORT_STRUCT) &aucOidBuf[0]; - - kalMemCopy(&prNdisReq->ndisOidContent[0], &pu4IntBuf[1], 8); - - prNdisReq->ndisOidCmd = OID_CUSTOM_MTK_WIFI_TEST; - prNdisReq->inNdisOidlength = 8; - prNdisReq->outNdisOidLength = 8; - - /* Execute this OID */ - status = priv_set_ndis(prNetDev, prNdisReq, &u4BufLen); - break; - -#if CFG_SUPPORT_PRIV_MCR_RW - case PRIV_CMD_ACCESS_MCR: - //printk("addr=0x%08lx, data=0x%08lx\n", pu4IntBuf[1], pu4IntBuf[2]); - prNdisReq = (P_NDIS_TRANSPORT_STRUCT) &aucOidBuf[0]; - - if (!prGlueInfo->fgMcrAccessAllowed) { - if (pu4IntBuf[1] == PRIV_CMD_TEST_MAGIC_KEY && - pu4IntBuf[2] == PRIV_CMD_TEST_MAGIC_KEY) { - prGlueInfo->fgMcrAccessAllowed = TRUE; - } - status = 0; - break; - } - - kalMemCopy(&prNdisReq->ndisOidContent[0], &pu4IntBuf[1], 8); - - prNdisReq->ndisOidCmd = OID_CUSTOM_MCR_RW; - prNdisReq->inNdisOidlength = 8; - prNdisReq->outNdisOidLength = 8; - - /* Execute this OID */ - status = priv_set_ndis(prNetDev, prNdisReq, &u4BufLen); - break; -#endif - - case PRIV_CMD_SW_CTRL: - //printk("addr=0x%08lx, data=0x%08lx\n", pu4IntBuf[1], pu4IntBuf[2]); - prNdisReq = (P_NDIS_TRANSPORT_STRUCT) &aucOidBuf[0]; - - kalMemCopy(&prNdisReq->ndisOidContent[0], &pu4IntBuf[1], 8); - - prNdisReq->ndisOidCmd = OID_CUSTOM_SW_CTRL; - prNdisReq->inNdisOidlength = 8; - prNdisReq->outNdisOidLength = 8; - - /* Execute this OID */ - status = priv_set_ndis(prNetDev, prNdisReq, &u4BufLen); - break; - - - #if 0 - case PRIV_CMD_BEACON_PERIOD: - rStatus = wlanSetInformation(prGlueInfo->prAdapter, - wlanoidSetBeaconInterval, - (PVOID)&pu4IntBuf[1], /* pu4IntBuf[0] is used as input SubCmd */ - sizeof(UINT_32), - &u4BufLen); - break; - #endif - -#if CFG_TCP_IP_CHKSUM_OFFLOAD - case PRIV_CMD_CSUM_OFFLOAD: - { - UINT_32 u4CSUMFlags; - - - if (pu4IntBuf[1] == 1) { - u4CSUMFlags = CSUM_OFFLOAD_EN_ALL; - } - else if (pu4IntBuf[1] == 0) { - u4CSUMFlags = 0; - } - else { - return -EINVAL; - } - - if (kalIoctl(prGlueInfo, - wlanoidSetCSUMOffload, - (PVOID)&u4CSUMFlags, - sizeof(UINT_32), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen - ) == WLAN_STATUS_SUCCESS) { - if (pu4IntBuf[1] == 1) { - prNetDev->features |= NETIF_F_HW_CSUM; - } else if (pu4IntBuf[1] == 0) { - prNetDev->features &= ~NETIF_F_HW_CSUM; - } - } - } - break; -#endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */ - - case PRIV_CMD_POWER_MODE: - kalIoctl(prGlueInfo, - wlanoidSet802dot11PowerSaveProfile, - (PVOID)&pu4IntBuf[1], /* pu4IntBuf[0] is used as input SubCmd */ - sizeof(UINT_32), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - break; - - case PRIV_CMD_WMM_PS: - { - PARAM_CUSTOM_WMM_PS_TEST_STRUC_T rWmmPsTest; - - rWmmPsTest.bmfgApsdEnAc = (UINT_8)pu4IntBuf[1]; - rWmmPsTest.ucIsEnterPsAtOnce = (UINT_8)pu4IntBuf[2]; - rWmmPsTest.ucIsDisableUcTrigger = (UINT_8)pu4IntBuf[3]; - rWmmPsTest.reserved = 0; - - kalIoctl(prGlueInfo, - wlanoidSetWiFiWmmPsTest, - (PVOID)&rWmmPsTest, - sizeof(PARAM_CUSTOM_WMM_PS_TEST_STRUC_T), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - } - break; - - #if 0 - case PRIV_CMD_ADHOC_MODE: - rStatus = wlanSetInformation(prGlueInfo->prAdapter, - wlanoidSetAdHocMode, - (PVOID)&pu4IntBuf[1], /* pu4IntBuf[0] is used as input SubCmd */ - sizeof(UINT_32), - &u4BufLen); - break; - #endif - - case PRIV_CUSTOM_BWCS_CMD: - - DBGLOG(REQ, INFO, ("pu4IntBuf[1] = %x, size of PTA_IPC_T = %d.\n", pu4IntBuf[1], sizeof(PARAM_PTA_IPC_T))); - - prPtaIpc = (P_PTA_IPC_T) aucOidBuf; - prPtaIpc->u.aucBTPParams[0] = (UINT_8) (pu4IntBuf[1] >> 24); - prPtaIpc->u.aucBTPParams[1] = (UINT_8) (pu4IntBuf[1] >> 16); - prPtaIpc->u.aucBTPParams[2] = (UINT_8) (pu4IntBuf[1] >> 8); - prPtaIpc->u.aucBTPParams[3] = (UINT_8) (pu4IntBuf[1]); - - DBGLOG(REQ, INFO, ("BCM BWCS CMD : PRIV_CUSTOM_BWCS_CMD : aucBTPParams[0] = %02x, aucBTPParams[1] = %02x, aucBTPParams[2] = %02x, aucBTPParams[3] = %02x.\n", - prPtaIpc->u.aucBTPParams[0], - prPtaIpc->u.aucBTPParams[1], - prPtaIpc->u.aucBTPParams[2], - prPtaIpc->u.aucBTPParams[3])); - -#if 0 - status = wlanSetInformation(prGlueInfo->prAdapter, - wlanoidSetBT, - (PVOID)&aucOidBuf[0], - u4CmdLen, - &u4BufLen); -#endif - - status = wlanoidSetBT(prGlueInfo->prAdapter, - (PVOID)&aucOidBuf[0], - sizeof(PARAM_PTA_IPC_T), - &u4BufLen); - - if (WLAN_STATUS_SUCCESS != status) { - status = -EFAULT; - } - - break; - - case PRIV_CMD_BAND_CONFIG: - { - DBGLOG(INIT, INFO, ("CMD set_band=%u\n", pu4IntBuf[1])); - } - break; - -#if CFG_ENABLE_WIFI_DIRECT - case PRIV_CMD_P2P_MODE: - { - PARAM_CUSTOM_P2P_SET_STRUC_T rSetP2P; - WLAN_STATUS rWlanStatus = WLAN_STATUS_SUCCESS; - - rSetP2P.u4Enable = pu4IntBuf[1]; - rSetP2P.u4Mode = pu4IntBuf[2]; - - if(!rSetP2P.u4Enable) { - p2pNetUnregister(prGlueInfo, TRUE); - } - - rWlanStatus = kalIoctl(prGlueInfo, - wlanoidSetP2pMode, - (PVOID)&rSetP2P, /* pu4IntBuf[0] is used as input SubCmd */ - sizeof(PARAM_CUSTOM_P2P_SET_STRUC_T), - FALSE, - FALSE, - TRUE, - FALSE, - &u4BufLen); - - if(rSetP2P.u4Enable) { - p2pNetRegister(prGlueInfo, TRUE); - } - - - } - break; -#endif - - default: - return -EOPNOTSUPP; - } - - return status; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Private ioctl get int handler. -* -* \param[in] pDev Net device requested. -* \param[out] pIwReq Pointer to iwreq structure. -* \param[in] prIwReqData The ioctl req structure, use the field of sub-command. -* \param[out] pcExtra The buffer with put the return value -* -* \retval 0 For success. -* \retval -EOPNOTSUPP If cmd is not supported. -* \retval -EFAULT For fail. -* -*/ -/*----------------------------------------------------------------------------*/ -int -priv_get_int ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN union iwreq_data *prIwReqData, - IN OUT char *pcExtra - ) -{ - UINT_32 u4SubCmd; - PUINT_32 pu4IntBuf; - P_GLUE_INFO_T prGlueInfo; - UINT_32 u4BufLen = 0; - int status = 0; - P_NDIS_TRANSPORT_STRUCT prNdisReq; - INT_32 ch[50]; - - ASSERT(prNetDev); - ASSERT(prIwReqInfo); - ASSERT(prIwReqData); - ASSERT(pcExtra); - if (FALSE == GLUE_CHK_PR3(prNetDev, prIwReqData, pcExtra)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - u4SubCmd = (UINT_32) prIwReqData->mode; - pu4IntBuf = (PUINT_32) pcExtra; - - switch (u4SubCmd) { - case PRIV_CMD_TEST_CMD: - //printk("CMD=0x%08lx, data=0x%08lx\n", pu4IntBuf[1], pu4IntBuf[2]); - prNdisReq = (P_NDIS_TRANSPORT_STRUCT) &aucOidBuf[0]; - - kalMemCopy(&prNdisReq->ndisOidContent[0], &pu4IntBuf[1], 8); - - prNdisReq->ndisOidCmd = OID_CUSTOM_MTK_WIFI_TEST; - prNdisReq->inNdisOidlength = 8; - prNdisReq->outNdisOidLength = 8; - - status = priv_get_ndis(prNetDev, prNdisReq, &u4BufLen); - if (status == 0) { - //printk("Result=%ld\n", *(PUINT_32)&prNdisReq->ndisOidContent[4]); - prIwReqData->mode = *(PUINT_32)&prNdisReq->ndisOidContent[4]; - /* - if (copy_to_user(prIwReqData->data.pointer, - &prNdisReq->ndisOidContent[4], 4)) { - printk(KERN_NOTICE "priv_get_int() copy_to_user oidBuf fail(3)\n"); - return -EFAULT; - } - */ - } - return status; - -#if CFG_SUPPORT_PRIV_MCR_RW - case PRIV_CMD_ACCESS_MCR: - //printk("addr=0x%08lx\n", pu4IntBuf[1]); - prNdisReq = (P_NDIS_TRANSPORT_STRUCT) &aucOidBuf[0]; - - if (!prGlueInfo->fgMcrAccessAllowed) { - status = 0; - return status; - } - - kalMemCopy(&prNdisReq->ndisOidContent[0], &pu4IntBuf[1], 8); - - prNdisReq->ndisOidCmd = OID_CUSTOM_MCR_RW; - prNdisReq->inNdisOidlength = 8; - prNdisReq->outNdisOidLength = 8; - - status = priv_get_ndis(prNetDev, prNdisReq, &u4BufLen); - if (status == 0) { - //printk("Result=%ld\n", *(PUINT_32)&prNdisReq->ndisOidContent[4]); - prIwReqData->mode = *(PUINT_32)&prNdisReq->ndisOidContent[4]; - } - return status; -#endif - - case PRIV_CMD_DUMP_MEM: - prNdisReq = (P_NDIS_TRANSPORT_STRUCT) &aucOidBuf[0]; - -#if 1 - if (!prGlueInfo->fgMcrAccessAllowed) { - status = 0; - return status; - } -#endif - kalMemCopy(&prNdisReq->ndisOidContent[0], &pu4IntBuf[1], 8); - - prNdisReq->ndisOidCmd = OID_CUSTOM_MEM_DUMP; - prNdisReq->inNdisOidlength = 8; - prNdisReq->outNdisOidLength = 8; - - status = priv_get_ndis(prNetDev, prNdisReq, &u4BufLen); - if (status == 0) { - prIwReqData->mode = *(PUINT_32)&prNdisReq->ndisOidContent[0]; - } - return status; - - case PRIV_CMD_SW_CTRL: - //printk(" addr=0x%08lx\n", pu4IntBuf[1]); - - prNdisReq = (P_NDIS_TRANSPORT_STRUCT) &aucOidBuf[0]; - - kalMemCopy(&prNdisReq->ndisOidContent[0], &pu4IntBuf[1], 8); - - prNdisReq->ndisOidCmd = OID_CUSTOM_SW_CTRL; - prNdisReq->inNdisOidlength = 8; - prNdisReq->outNdisOidLength = 8; - - status = priv_get_ndis(prNetDev, prNdisReq, &u4BufLen); - if (status == 0) { - //printk("Result=%ld\n", *(PUINT_32)&prNdisReq->ndisOidContent[4]); - prIwReqData->mode = *(PUINT_32)&prNdisReq->ndisOidContent[4]; - } - return status; - - #if 0 - case PRIV_CMD_BEACON_PERIOD: - status = wlanQueryInformation(prGlueInfo->prAdapter, - wlanoidQueryBeaconInterval, - (PVOID)pu4IntBuf, - sizeof(UINT_32), - &u4BufLen); - return status; - - case PRIV_CMD_POWER_MODE: - status = wlanQueryInformation(prGlueInfo->prAdapter, - wlanoidQuery802dot11PowerSaveProfile, - (PVOID)pu4IntBuf, - sizeof(UINT_32), - &u4BufLen); - return status; - - case PRIV_CMD_ADHOC_MODE: - status = wlanQueryInformation(prGlueInfo->prAdapter, - wlanoidQueryAdHocMode, - (PVOID)pu4IntBuf, - sizeof(UINT_32), - &u4BufLen); - return status; - #endif - - case PRIV_CMD_BAND_CONFIG: - DBGLOG(INIT, INFO, ("CMD get_band=\n")); - prIwReqData->mode = 0; - return status; - - default: - break; - } - - u4SubCmd = (UINT_32) prIwReqData->data.flags; - - switch (u4SubCmd) { - case PRIV_CMD_GET_CH_LIST: - { - UINT_16 i, j = 0; - UINT_8 NumOfChannel = 50; - UINT_8 ucMaxChannelNum = 50; - RF_CHANNEL_INFO_T aucChannelList[50]; - - kalGetChannelList(prGlueInfo, BAND_NULL, ucMaxChannelNum, &NumOfChannel, aucChannelList); - if (NumOfChannel > 50) - NumOfChannel = 50; - - if (kalIsAPmode(prGlueInfo)) { - for (i = 0; i < NumOfChannel; i++) { - if ((aucChannelList[i].ucChannelNum <= 13) || - (aucChannelList[i].ucChannelNum == 36 || aucChannelList[i].ucChannelNum == 40 || - aucChannelList[i].ucChannelNum == 44 || aucChannelList[i].ucChannelNum == 48)) { - ch[j] = (INT_32)aucChannelList[i].ucChannelNum; - j++; - } - } - } - else { - for (j = 0; j < NumOfChannel; j++) { - ch[j] = (INT_32)aucChannelList[j].ucChannelNum; - } - } - - prIwReqData->data.length = j; - if (copy_to_user(prIwReqData->data.pointer, ch, NumOfChannel*sizeof(INT_32))) { - return -EFAULT; - } - else - return status; - } - default: - return -EOPNOTSUPP; - } - - return status; -} /* priv_get_int */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Private ioctl set int array handler. -* -* \param[in] prNetDev Net device requested. -* \param[in] prIwReqInfo Pointer to iwreq structure. -* \param[in] prIwReqData The ioctl data structure, use the field of sub-command. -* \param[in] pcExtra The buffer with input value -* -* \retval 0 For success. -* \retval -EOPNOTSUPP If cmd is not supported. -* \retval -EINVAL If a value is out of range. -* -*/ -/*----------------------------------------------------------------------------*/ -int -priv_set_ints ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN union iwreq_data *prIwReqData, - IN char *pcExtra - ) -{ - UINT_32 u4SubCmd, u4BufLen; - P_GLUE_INFO_T prGlueInfo; - int status = 0; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - P_SET_TXPWR_CTRL_T prTxpwr; - - ASSERT(prNetDev); - ASSERT(prIwReqInfo); - ASSERT(prIwReqData); - ASSERT(pcExtra); - - if (FALSE == GLUE_CHK_PR3(prNetDev, prIwReqData, pcExtra)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - u4SubCmd = (UINT_32) prIwReqData->data.flags; - - switch (u4SubCmd) { - case PRIV_CMD_SET_TX_POWER: - { - INT_32 *setting = prIwReqData->data.pointer; - UINT_16 i; - -#if 0 - printk("Tx power num = %d\n", prIwReqData->data.length); - - printk("Tx power setting = %d %d %d %d\n", - setting[0], setting[1], setting[2], setting[3]); -#endif - prTxpwr = &prGlueInfo->rTxPwr; - if (setting[0] == 0 && prIwReqData->data.length == 4 /* argc num */) { - /* 0 (All networks), 1 (legacy STA), 2 (Hotspot AP), 3 (P2P), 4 (BT over Wi-Fi) */ - if (setting[1] == 1 || setting[1] == 0) { - if (setting[2] == 0 || setting[2] == 1) - prTxpwr->c2GLegacyStaPwrOffset = setting[3]; - if (setting[2] == 0 || setting[2] == 2) - prTxpwr->c5GLegacyStaPwrOffset = setting[3]; - } - if (setting[1] == 2 || setting[1] == 0) { - if (setting[2] == 0 || setting[2] == 1) - prTxpwr->c2GHotspotPwrOffset = setting[3]; - if (setting[2] == 0 || setting[2] == 2) - prTxpwr->c5GHotspotPwrOffset = setting[3]; - } - if (setting[1] == 3 || setting[1] == 0) { - if (setting[2] == 0 || setting[2] == 1) - prTxpwr->c2GP2pPwrOffset = setting[3]; - if (setting[2] == 0 || setting[2] == 2) - prTxpwr->c5GP2pPwrOffset = setting[3]; - } - if (setting[1] == 4 || setting[1] == 0) { - if (setting[2] == 0 || setting[2] == 1) - prTxpwr->c2GBowPwrOffset = setting[3]; - if (setting[2] == 0 || setting[2] == 2) - prTxpwr->c5GBowPwrOffset = setting[3]; - } - } - else if (setting[0] == 1 && prIwReqData->data.length == 2) { - prTxpwr->ucConcurrencePolicy = setting[1]; - } - else if (setting[0] == 2 && prIwReqData->data.length == 3) { - if (setting[1] == 0) { - for (i=0; i<14; i++) - prTxpwr->acTxPwrLimit2G[i] = setting[2]; - } - else if (setting[1] <= 14) - prTxpwr->acTxPwrLimit2G[setting[1] - 1] = setting[2]; - } - else if (setting[0] == 3 && prIwReqData->data.length == 3) { - if (setting[1] == 0) { - for (i=0; i<4; i++) - prTxpwr->acTxPwrLimit5G[i] = setting[2]; - } - else if (setting[1] <= 4) - prTxpwr->acTxPwrLimit5G[setting[1] - 1] = setting[2]; - } - else if (setting[0] == 4 && prIwReqData->data.length == 2) { - if (setting[1] == 0) { - wlanDefTxPowerCfg(prGlueInfo->prAdapter); - } - rStatus = kalIoctl(prGlueInfo, - wlanoidSetTxPower, - prTxpwr, - sizeof(SET_TXPWR_CTRL_T), - TRUE, - FALSE, - FALSE, - FALSE, - &u4BufLen); - } - else - return -EFAULT; - } - return status; - default: - break; - } - - return status; -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Private ioctl get int array handler. -* -* \param[in] pDev Net device requested. -* \param[out] pIwReq Pointer to iwreq structure. -* \param[in] prIwReqData The ioctl req structure, use the field of sub-command. -* \param[out] pcExtra The buffer with put the return value -* -* \retval 0 For success. -* \retval -EOPNOTSUPP If cmd is not supported. -* \retval -EFAULT For fail. -* -*/ -/*----------------------------------------------------------------------------*/ -int -priv_get_ints ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN union iwreq_data *prIwReqData, - IN OUT char *pcExtra - ) -{ - UINT_32 u4SubCmd; - P_GLUE_INFO_T prGlueInfo; - int status = 0; - INT_32 ch[50]; - - ASSERT(prNetDev); - ASSERT(prIwReqInfo); - ASSERT(prIwReqData); - ASSERT(pcExtra); - if (FALSE == GLUE_CHK_PR3(prNetDev, prIwReqData, pcExtra)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - u4SubCmd = (UINT_32) prIwReqData->data.flags; - - switch (u4SubCmd) { - case PRIV_CMD_GET_CH_LIST: - { - UINT_16 i; - UINT_8 NumOfChannel = 50; - UINT_8 ucMaxChannelNum = 50; - RF_CHANNEL_INFO_T aucChannelList[50]; - - kalGetChannelList(prGlueInfo, BAND_NULL, ucMaxChannelNum, &NumOfChannel, aucChannelList); - if (NumOfChannel > 50) - NumOfChannel = 50; - - for (i = 0; i < NumOfChannel; i++) { - ch[i] = (INT_32)aucChannelList[i].ucChannelNum; - } - - prIwReqData->data.length = NumOfChannel; - if (copy_to_user(prIwReqData->data.pointer, ch, NumOfChannel*sizeof(INT_32))) { - return -EFAULT; - } - else - return status; - } - default: - break; - } - - return status; -} /* priv_get_int */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Private ioctl set structure handler. -* -* \param[in] pDev Net device requested. -* \param[in] prIwReqData Pointer to iwreq_data structure. -* -* \retval 0 For success. -* \retval -EOPNOTSUPP If cmd is not supported. -* \retval -EINVAL If a value is out of range. -* -*/ -/*----------------------------------------------------------------------------*/ -int -priv_set_struct ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN union iwreq_data *prIwReqData, - IN char *pcExtra - ) -{ - UINT_32 u4SubCmd = 0; - int status = 0; - //WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4CmdLen = 0; - P_NDIS_TRANSPORT_STRUCT prNdisReq; - PUINT_32 pu4IntBuf = NULL; - - P_GLUE_INFO_T prGlueInfo = NULL; - UINT_32 u4BufLen = 0; - - ASSERT(prNetDev); - //ASSERT(prIwReqInfo); - ASSERT(prIwReqData); - //ASSERT(pcExtra); - - kalMemZero(&aucOidBuf[0], sizeof(aucOidBuf)); - - if (FALSE == GLUE_CHK_PR2(prNetDev, prIwReqData)) { - return -EINVAL; - } - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - - u4SubCmd = (UINT_32) prIwReqData->data.flags; - -#if 0 - printk(KERN_INFO DRV_NAME"priv_set_struct(): prIwReqInfo->cmd(0x%X), u4SubCmd(%ld)\n", - prIwReqInfo->cmd, - u4SubCmd - ); -#endif - - switch (u4SubCmd) { -#if 0 //PTA_ENABLED - case PRIV_CMD_BT_COEXIST: - u4CmdLen = prIwReqData->data.length * sizeof(UINT_32); - ASSERT(sizeof(PARAM_CUSTOM_BT_COEXIST_T) >= u4CmdLen); - if (sizeof(PARAM_CUSTOM_BT_COEXIST_T) < u4CmdLen) { - return -EFAULT; - } - - if (copy_from_user(&aucOidBuf[0], prIwReqData->data.pointer, u4CmdLen)) { - status = -EFAULT; //return -EFAULT; - break; - } - - rStatus = wlanSetInformation(prGlueInfo->prAdapter, - wlanoidSetBtCoexistCtrl, - (PVOID)&aucOidBuf[0], - u4CmdLen, - &u4BufLen); - if (WLAN_STATUS_SUCCESS != rStatus) { - status = -EFAULT; - } - break; -#endif - - case PRIV_CUSTOM_BWCS_CMD: - u4CmdLen = prIwReqData->data.length * sizeof(UINT_32); - ASSERT(sizeof(PARAM_PTA_IPC_T) >= u4CmdLen); - if (sizeof(PARAM_PTA_IPC_T) < u4CmdLen) { - return -EFAULT; - } -#if CFG_SUPPORT_BCM && CFG_SUPPORT_BCM_BWCS && CFG_SUPPORT_BCM_BWCS_DEBUG - DBGLOG(REQ, INFO, ("ucCmdLen = %d, size of PTA_IPC_T = %d, prIwReqData->data = 0x%x.\n", u4CmdLen, sizeof(PARAM_PTA_IPC_T), prIwReqData->data)); - - DBGLOG(REQ, INFO, ("priv_set_struct(): prIwReqInfo->cmd(0x%X), u4SubCmd(%ld)\n", - prIwReqInfo->cmd, - u4SubCmd - )); - - DBGLOG(REQ, INFO, ("*pcExtra = 0x%x\n", *pcExtra)); - #endif - - if (copy_from_user(&aucOidBuf[0], prIwReqData->data.pointer, u4CmdLen)) { - status = -EFAULT; //return -EFAULT; - break; - } -#if CFG_SUPPORT_BCM && CFG_SUPPORT_BCM_BWCS && CFG_SUPPORT_BCM_BWCS_DEBUG - DBGLOG(REQ, INFO, ("priv_set_struct(): BWCS CMD = %02x%02x%02x%02x\n", - aucOidBuf[2], aucOidBuf[3], aucOidBuf[4], aucOidBuf[5])); -#endif - -#if 0 - status = wlanSetInformation(prGlueInfo->prAdapter, - wlanoidSetBT, - (PVOID)&aucOidBuf[0], - u4CmdLen, - &u4BufLen); -#endif - -#if 1 - status = wlanoidSetBT(prGlueInfo->prAdapter, - (PVOID)&aucOidBuf[0], - u4CmdLen, - &u4BufLen); -#endif - - if (WLAN_STATUS_SUCCESS != status) { - status = -EFAULT; - } - - break; - -#if CFG_SUPPORT_WPS2 - case PRIV_CMD_WSC_PROBE_REQ: - { - /* retrieve IE for Probe Request */ - if (prIwReqData->data.length > 0) { - if (copy_from_user(prGlueInfo->aucWSCIE, prIwReqData->data.pointer, - prIwReqData->data.length)) { - status = -EFAULT; - break; - } - prGlueInfo->u2WSCIELen = prIwReqData->data.length; - } - else { - prGlueInfo->u2WSCIELen = 0; - } - } - break; -#endif - case PRIV_CMD_OID: - if (copy_from_user(&aucOidBuf[0], - prIwReqData->data.pointer, - prIwReqData->data.length)) { - status = -EFAULT; - break; - } - if (!kalMemCmp(&aucOidBuf[0], pcExtra, prIwReqData->data.length)) { - DBGLOG(REQ, INFO, ("pcExtra buffer is valid\n")); - } - else - DBGLOG(REQ, INFO, ("pcExtra 0x%p\n", pcExtra)); - - /* Execute this OID */ - status = priv_set_ndis(prNetDev, (P_NDIS_TRANSPORT_STRUCT)&aucOidBuf[0], &u4BufLen); - /* Copy result to user space */ - ((P_NDIS_TRANSPORT_STRUCT)&aucOidBuf[0])->outNdisOidLength = u4BufLen; - - if (copy_to_user(prIwReqData->data.pointer, - &aucOidBuf[0], - OFFSET_OF(NDIS_TRANSPORT_STRUCT, ndisOidContent))) { - DBGLOG(REQ, INFO, ("copy_to_user oidBuf fail\n")); - status = -EFAULT; - } - - break; - - case PRIV_CMD_SW_CTRL: - pu4IntBuf = (PUINT_32)prIwReqData->data.pointer; - prNdisReq = (P_NDIS_TRANSPORT_STRUCT) &aucOidBuf[0]; - - //kalMemCopy(&prNdisReq->ndisOidContent[0], prIwReqData->data.pointer, 8); - if (copy_from_user(&prNdisReq->ndisOidContent[0], - prIwReqData->data.pointer, - prIwReqData->data.length)) { - status = -EFAULT; - break; - } - prNdisReq->ndisOidCmd = OID_CUSTOM_SW_CTRL; - prNdisReq->inNdisOidlength = 8; - prNdisReq->outNdisOidLength = 8; - - /* Execute this OID */ - status = priv_set_ndis(prNetDev, prNdisReq, &u4BufLen); - break; - - default: - return -EOPNOTSUPP; - } - - return status; -} - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Private ioctl get struct handler. -* -* \param[in] pDev Net device requested. -* \param[out] pIwReq Pointer to iwreq structure. -* \param[in] cmd Private sub-command. -* -* \retval 0 For success. -* \retval -EFAULT If copy from user space buffer fail. -* \retval -EOPNOTSUPP Parameter "cmd" not recognized. -* -*/ -/*----------------------------------------------------------------------------*/ -int -priv_get_struct ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN union iwreq_data *prIwReqData, - IN OUT char *pcExtra - ) -{ - UINT_32 u4SubCmd = 0; - P_NDIS_TRANSPORT_STRUCT prNdisReq= NULL; - - P_GLUE_INFO_T prGlueInfo = NULL; - UINT_32 u4BufLen = 0; - PUINT_32 pu4IntBuf = NULL; - int status = 0; - - kalMemZero(&aucOidBuf[0], sizeof(aucOidBuf)); - - ASSERT(prNetDev); - ASSERT(prIwReqData); - if (!prNetDev || !prIwReqData) { - DBGLOG(REQ, INFO, ("priv_get_struct(): invalid param(0x%p, 0x%p)\n", - prNetDev, prIwReqData)); - return -EINVAL; - } - - u4SubCmd = (UINT_32) prIwReqData->data.flags; - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - ASSERT(prGlueInfo); - if (!prGlueInfo) { - DBGLOG(REQ, INFO, ("priv_get_struct(): invalid prGlueInfo(0x%p, 0x%p)\n", - prNetDev, *((P_GLUE_INFO_T *) netdev_priv(prNetDev)))); - return -EINVAL; - } - -#if 0 - printk(KERN_INFO DRV_NAME"priv_get_struct(): prIwReqInfo->cmd(0x%X), u4SubCmd(%ld)\n", - prIwReqInfo->cmd, - u4SubCmd - ); -#endif - memset(aucOidBuf, 0, sizeof(aucOidBuf)); - - switch (u4SubCmd) { - case PRIV_CMD_OID: - if (copy_from_user(&aucOidBuf[0], - prIwReqData->data.pointer, - sizeof(NDIS_TRANSPORT_STRUCT))) { - DBGLOG(REQ, INFO, ("priv_get_struct() copy_from_user oidBuf fail\n")); - return -EFAULT; - } - - prNdisReq = (P_NDIS_TRANSPORT_STRUCT)&aucOidBuf[0]; -#if 0 - printk(KERN_NOTICE "\n priv_get_struct cmd 0x%02x len:%d OID:0x%08x OID Len:%d\n", - cmd, - pIwReq->u.data.length, - ndisReq->ndisOidCmd, - ndisReq->inNdisOidlength); -#endif - if (priv_get_ndis(prNetDev, prNdisReq, &u4BufLen) == 0) { - prNdisReq->outNdisOidLength = u4BufLen; - if (copy_to_user(prIwReqData->data.pointer, - &aucOidBuf[0], - u4BufLen + sizeof(NDIS_TRANSPORT_STRUCT) - sizeof(prNdisReq->ndisOidContent))) { - DBGLOG(REQ, INFO, ("priv_get_struct() copy_to_user oidBuf fail(1)\n")); - return -EFAULT; - } - return 0; - } - else { - prNdisReq->outNdisOidLength = u4BufLen; - if (copy_to_user(prIwReqData->data.pointer, - &aucOidBuf[0], - OFFSET_OF(NDIS_TRANSPORT_STRUCT, ndisOidContent))) { - DBGLOG(REQ, INFO, ("priv_get_struct() copy_to_user oidBuf fail(2)\n")); - } - return -EFAULT; - } - break; - - case PRIV_CMD_SW_CTRL: - pu4IntBuf = (PUINT_32)prIwReqData->data.pointer; - prNdisReq = (P_NDIS_TRANSPORT_STRUCT) &aucOidBuf[0]; - - if (copy_from_user(&prNdisReq->ndisOidContent[0], - prIwReqData->data.pointer, - prIwReqData->data.length)) { - DBGLOG(REQ, INFO, ("priv_get_struct() copy_from_user oidBuf fail\n")); - return -EFAULT; - } - - prNdisReq->ndisOidCmd = OID_CUSTOM_SW_CTRL; - prNdisReq->inNdisOidlength = 8; - prNdisReq->outNdisOidLength = 8; - - status = priv_get_ndis(prNetDev, prNdisReq, &u4BufLen); - if (status == 0) { - prNdisReq->outNdisOidLength = u4BufLen; - //printk("len=%d Result=%08lx\n", u4BufLen, *(PUINT_32)&prNdisReq->ndisOidContent[4]); - - if (copy_to_user(prIwReqData->data.pointer, - &prNdisReq->ndisOidContent[4], - 4 /* OFFSET_OF(NDIS_TRANSPORT_STRUCT, ndisOidContent)*/)) { - DBGLOG(REQ, INFO, ("priv_get_struct() copy_to_user oidBuf fail(2)\n")); - } - } - return 0; - break; - default: - DBGLOG(REQ, WARN, ("get struct cmd:0x%lx\n", u4SubCmd)); - return -EOPNOTSUPP; - } -} /* priv_get_struct */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief The routine handles a set operation for a single OID. -* -* \param[in] pDev Net device requested. -* \param[in] ndisReq Ndis request OID information copy from user. -* \param[out] outputLen_p If the call is successful, returns the number of -* bytes written into the query buffer. If the -* call failed due to invalid length of the query -* buffer, returns the amount of storage needed.. -* -* \retval 0 On success. -* \retval -EOPNOTSUPP If cmd is not supported. -* -*/ -/*----------------------------------------------------------------------------*/ -static int -priv_set_ndis ( - IN struct net_device *prNetDev, - IN NDIS_TRANSPORT_STRUCT* prNdisReq, - OUT PUINT_32 pu4OutputLen - ) -{ - P_WLAN_REQ_ENTRY prWlanReqEntry = NULL; - WLAN_STATUS status = WLAN_STATUS_SUCCESS; - P_GLUE_INFO_T prGlueInfo = NULL; - UINT_32 u4SetInfoLen = 0; - - ASSERT(prNetDev); - ASSERT(prNdisReq); - ASSERT(pu4OutputLen); - - if (!prNetDev || !prNdisReq || !pu4OutputLen) { - DBGLOG(REQ, INFO, ("priv_set_ndis(): invalid param(0x%p, 0x%p, 0x%p)\n", - prNetDev, prNdisReq, pu4OutputLen)); - return -EINVAL; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - ASSERT(prGlueInfo); - if (!prGlueInfo) { - DBGLOG(REQ, INFO, ("priv_set_ndis(): invalid prGlueInfo(0x%p, 0x%p)\n", - prNetDev, *((P_GLUE_INFO_T *) netdev_priv(prNetDev)))); - return -EINVAL; - } - -#if 0 - printk(KERN_INFO DRV_NAME"priv_set_ndis(): prNdisReq->ndisOidCmd(0x%lX)\n", - prNdisReq->ndisOidCmd - ); -#endif - - if (FALSE == reqSearchSupportedOidEntry(prNdisReq->ndisOidCmd, - &prWlanReqEntry)) { - //WARNLOG(("Set OID: 0x%08lx (unknown)\n", prNdisReq->ndisOidCmd)); - return -EOPNOTSUPP; - } - - if (NULL == prWlanReqEntry->pfOidSetHandler) { - //WARNLOG(("Set %s: Null set handler\n", prWlanReqEntry->pucOidName)); - return -EOPNOTSUPP; - } - -#if 0 - printk(KERN_INFO DRV_NAME"priv_set_ndis(): %s\n", - prWlanReqEntry->pucOidName - ); -#endif - - if (prWlanReqEntry->fgSetBufLenChecking) { - if (prNdisReq->inNdisOidlength != prWlanReqEntry->u4InfoBufLen) { - DBGLOG(REQ, WARN, ("Set %s: Invalid length (current=%ld, needed=%ld)\n", - prWlanReqEntry->pucOidName, - prNdisReq->inNdisOidlength, - prWlanReqEntry->u4InfoBufLen)); - - *pu4OutputLen = prWlanReqEntry->u4InfoBufLen; - return -EINVAL; - } - } - - if (prWlanReqEntry->eOidMethod == ENUM_OID_GLUE_ONLY) { - /* GLUE sw info only */ - status = prWlanReqEntry->pfOidSetHandler(prGlueInfo, - prNdisReq->ndisOidContent, - prNdisReq->inNdisOidlength, - &u4SetInfoLen); - } - else if (prWlanReqEntry->eOidMethod == ENUM_OID_GLUE_EXTENSION) { - /* multiple sw operations */ - status = prWlanReqEntry->pfOidSetHandler(prGlueInfo, - prNdisReq->ndisOidContent, - prNdisReq->inNdisOidlength, - &u4SetInfoLen); - } - else if (prWlanReqEntry->eOidMethod == ENUM_OID_DRIVER_CORE) { - /* driver core*/ - - status = kalIoctl(prGlueInfo, - (PFN_OID_HANDLER_FUNC)prWlanReqEntry->pfOidSetHandler, - prNdisReq->ndisOidContent, - prNdisReq->inNdisOidlength, - FALSE, - FALSE, - TRUE, - FALSE, - &u4SetInfoLen); - } - else { - DBGLOG(REQ, INFO, ("priv_set_ndis(): unsupported OID method:0x%x\n", - prWlanReqEntry->eOidMethod)); - return -EOPNOTSUPP; - } - - *pu4OutputLen = u4SetInfoLen; - - switch (status) { - case WLAN_STATUS_SUCCESS: - break; - - case WLAN_STATUS_INVALID_LENGTH: - //WARNLOG(("Set %s: Invalid length (current=%ld, needed=%ld)\n", - // prWlanReqEntry->pucOidName, - //prNdisReq->inNdisOidlength, - //u4SetInfoLen)); - break; - } - - if (WLAN_STATUS_SUCCESS != status) { - return -EFAULT; - } - - return 0; -} /* priv_set_ndis */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief The routine handles a query operation for a single OID. Basically we -* return information about the current state of the OID in question. -* -* \param[in] pDev Net device requested. -* \param[in] ndisReq Ndis request OID information copy from user. -* \param[out] outputLen_p If the call is successful, returns the number of -* bytes written into the query buffer. If the -* call failed due to invalid length of the query -* buffer, returns the amount of storage needed.. -* -* \retval 0 On success. -* \retval -EOPNOTSUPP If cmd is not supported. -* \retval -EINVAL invalid input parameters -* -*/ -/*----------------------------------------------------------------------------*/ -static int -priv_get_ndis ( - IN struct net_device *prNetDev, - IN NDIS_TRANSPORT_STRUCT* prNdisReq, - OUT PUINT_32 pu4OutputLen - ) -{ - P_WLAN_REQ_ENTRY prWlanReqEntry = NULL; - UINT_32 u4BufLen = 0; - WLAN_STATUS status = WLAN_STATUS_SUCCESS; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(prNetDev); - ASSERT(prNdisReq); - ASSERT(pu4OutputLen); - - if (!prNetDev || !prNdisReq || !pu4OutputLen) { - DBGLOG(REQ, INFO, ("priv_get_ndis(): invalid param(0x%p, 0x%p, 0x%p)\n", - prNetDev, prNdisReq, pu4OutputLen)); - return -EINVAL; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prNetDev)); - ASSERT(prGlueInfo); - if (!prGlueInfo) { - DBGLOG(REQ, INFO, ("priv_get_ndis(): invalid prGlueInfo(0x%p, 0x%p)\n", - prNetDev, *((P_GLUE_INFO_T *) netdev_priv(prNetDev)))); - return -EINVAL; - } - -#if 0 - printk(KERN_INFO DRV_NAME"priv_get_ndis(): prNdisReq->ndisOidCmd(0x%lX)\n", - prNdisReq->ndisOidCmd - ); -#endif - - if (FALSE == reqSearchSupportedOidEntry(prNdisReq->ndisOidCmd, - &prWlanReqEntry)) { - //WARNLOG(("Query OID: 0x%08lx (unknown)\n", prNdisReq->ndisOidCmd)); - return -EOPNOTSUPP; - } - - - if (NULL == prWlanReqEntry->pfOidQueryHandler) { - //WARNLOG(("Query %s: Null query handler\n", prWlanReqEntry->pucOidName)); - return -EOPNOTSUPP; - } - -#if 0 - printk(KERN_INFO DRV_NAME"priv_get_ndis(): %s\n", - prWlanReqEntry->pucOidName - ); -#endif - - if (prWlanReqEntry->fgQryBufLenChecking) { - if (prNdisReq->inNdisOidlength < prWlanReqEntry->u4InfoBufLen) { - /* Not enough room in InformationBuffer. Punt */ - //WARNLOG(("Query %s: Buffer too short (current=%ld, needed=%ld)\n", - //prWlanReqEntry->pucOidName, - //prNdisReq->inNdisOidlength, - //prWlanReqEntry->u4InfoBufLen)); - - *pu4OutputLen = prWlanReqEntry->u4InfoBufLen; - - status = WLAN_STATUS_INVALID_LENGTH; - return -EINVAL; - } - } - - - if (prWlanReqEntry->eOidMethod == ENUM_OID_GLUE_ONLY) { - /* GLUE sw info only */ - status = prWlanReqEntry->pfOidQueryHandler(prGlueInfo, - prNdisReq->ndisOidContent, - prNdisReq->inNdisOidlength, - &u4BufLen); - } - else if (prWlanReqEntry->eOidMethod == ENUM_OID_GLUE_EXTENSION) { - /* multiple sw operations */ - status = prWlanReqEntry->pfOidQueryHandler(prGlueInfo, - prNdisReq->ndisOidContent, - prNdisReq->inNdisOidlength, - &u4BufLen); - } - else if (prWlanReqEntry->eOidMethod == ENUM_OID_DRIVER_CORE) { - /* driver core*/ - - status = kalIoctl(prGlueInfo, - (PFN_OID_HANDLER_FUNC)prWlanReqEntry->pfOidQueryHandler, - prNdisReq->ndisOidContent, - prNdisReq->inNdisOidlength, - TRUE, - TRUE, - TRUE, - FALSE, - &u4BufLen); - } - else { - DBGLOG(REQ, INFO, ("priv_set_ndis(): unsupported OID method:0x%x\n", - prWlanReqEntry->eOidMethod)); - return -EOPNOTSUPP; - } - - *pu4OutputLen = u4BufLen; - - switch (status) { - case WLAN_STATUS_SUCCESS: - break; - - case WLAN_STATUS_INVALID_LENGTH: - //WARNLOG(("Set %s: Invalid length (current=%ld, needed=%ld)\n", - // prWlanReqEntry->pucOidName, - //prNdisReq->inNdisOidlength, - //u4BufLen)); - break; - } - - if (WLAN_STATUS_SUCCESS != status) { - return -EOPNOTSUPP; - } - - return 0; -} /* priv_get_ndis */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to search desired OID. -* -* \param rOid[in] Desired NDIS_OID -* \param ppWlanReqEntry[out] Found registered OID entry -* -* \retval TRUE: Matched OID is found -* \retval FALSE: No matched OID is found -*/ -/*----------------------------------------------------------------------------*/ -static BOOLEAN -reqSearchSupportedOidEntry ( - IN UINT_32 rOid, - OUT P_WLAN_REQ_ENTRY *ppWlanReqEntry - ) -{ - INT_32 i, j, k; - - i = 0; - j = NUM_SUPPORTED_OIDS - 1; - - while (i <= j) { - k = (i + j) / 2; - - if (rOid == arWlanOidReqTable[k].rOid) { - *ppWlanReqEntry = &arWlanOidReqTable[k]; - return TRUE; - } else if (rOid < arWlanOidReqTable[k].rOid) { - j = k - 1; - } else { - i = k + 1; - } - } - - return FALSE; -} /* reqSearchSupportedOidEntry */ - -#if 0 -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to query the radio configuration used in IBSS -* mode and RF test mode. -* -* \param[in] prGlueInfo Pointer to the GLUE_INFO_T structure. -* \param[out] pvQueryBuffer Pointer to the buffer that holds the result of the query. -* \param[in] u4QueryBufferLen The length of the query buffer. -* \param[out] pu4QueryInfoLen If the call is successful, returns the number of -* bytes written into the query buffer. If the call -* failed due to invalid length of the query buffer, -* returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -*/ -/*----------------------------------------------------------------------------*/ -static WLAN_STATUS -reqExtQueryConfiguration ( - IN P_GLUE_INFO_T prGlueInfo, - OUT PVOID pvQueryBuffer, - IN UINT_32 u4QueryBufferLen, - OUT PUINT_32 pu4QueryInfoLen - ) -{ - P_PARAM_802_11_CONFIG_T prQueryConfig = (P_PARAM_802_11_CONFIG_T)pvQueryBuffer; - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - UINT_32 u4QueryInfoLen = 0; - - DEBUGFUNC("wlanoidQueryConfiguration"); - - - ASSERT(prGlueInfo); - ASSERT(pu4QueryInfoLen); - - *pu4QueryInfoLen = sizeof(PARAM_802_11_CONFIG_T); - if (u4QueryBufferLen < sizeof(PARAM_802_11_CONFIG_T)) { - return WLAN_STATUS_INVALID_LENGTH; - } - - ASSERT(pvQueryBuffer); - - kalMemZero(prQueryConfig, sizeof(PARAM_802_11_CONFIG_T)); - - /* Update the current radio configuration. */ - prQueryConfig->u4Length = sizeof(PARAM_802_11_CONFIG_T); - -#if defined(_HIF_SDIO) - rStatus = sdio_io_ctrl(prGlueInfo, - wlanoidSetBeaconInterval, - &prQueryConfig->u4BeaconPeriod, - sizeof(UINT_32), - TRUE, - TRUE, - &u4QueryInfoLen); -#else - rStatus = wlanQueryInformation(prGlueInfo->prAdapter, - wlanoidQueryBeaconInterval, - &prQueryConfig->u4BeaconPeriod, - sizeof(UINT_32), - &u4QueryInfoLen); -#endif - if (rStatus != WLAN_STATUS_SUCCESS) { - return rStatus; - } - -#if defined(_HIF_SDIO) - rStatus = sdio_io_ctrl(prGlueInfo, - wlanoidQueryAtimWindow, - &prQueryConfig->u4ATIMWindow, - sizeof(UINT_32), - TRUE, - TRUE, - &u4QueryInfoLen); -#else - rStatus = wlanQueryInformation(prGlueInfo->prAdapter, - wlanoidQueryAtimWindow, - &prQueryConfig->u4ATIMWindow, - sizeof(UINT_32), - &u4QueryInfoLen); -#endif - if (rStatus != WLAN_STATUS_SUCCESS) { - return rStatus; - } - -#if defined(_HIF_SDIO) - rStatus = sdio_io_ctrl(prGlueInfo, - wlanoidQueryFrequency, - &prQueryConfig->u4DSConfig, - sizeof(UINT_32), - TRUE, - TRUE, - &u4QueryInfoLen); -#else - rStatus = wlanQueryInformation(prGlueInfo->prAdapter, - wlanoidQueryFrequency, - &prQueryConfig->u4DSConfig, - sizeof(UINT_32), - &u4QueryInfoLen); -#endif - if (rStatus != WLAN_STATUS_SUCCESS) { - return rStatus; - } - - prQueryConfig->rFHConfig.u4Length = sizeof(PARAM_802_11_CONFIG_FH_T); - - return rStatus; - -} /* end of reqExtQueryConfiguration() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set the radio configuration used in IBSS -* mode. -* -* \param[in] prGlueInfo Pointer to the GLUE_INFO_T structure. -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set. -* \param[in] u4SetBufferLen The length of the set buffer. -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed -* due to invalid length of the set buffer, returns -* the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_LENGTH -* \retval WLAN_STATUS_NOT_ACCEPTED -*/ -/*----------------------------------------------------------------------------*/ -static WLAN_STATUS -reqExtSetConfiguration ( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - P_PARAM_802_11_CONFIG_T prNewConfig = (P_PARAM_802_11_CONFIG_T)pvSetBuffer; - UINT_32 u4SetInfoLen = 0; - - DEBUGFUNC("wlanoidSetConfiguration"); - - - ASSERT(prGlueInfo); - ASSERT(pu4SetInfoLen); - - *pu4SetInfoLen = sizeof(PARAM_802_11_CONFIG_T); - - if (u4SetBufferLen < *pu4SetInfoLen) { - return WLAN_STATUS_INVALID_LENGTH; - } - - /* OID_802_11_CONFIGURATION. If associated, NOT_ACCEPTED shall be returned. */ - if (prGlueInfo->eParamMediaStateIndicated == PARAM_MEDIA_STATE_CONNECTED) { - return WLAN_STATUS_NOT_ACCEPTED; - } - - ASSERT(pvSetBuffer); - -#if defined(_HIF_SDIO) - rStatus = sdio_io_ctrl(prGlueInfo, - wlanoidSetBeaconInterval, - &prNewConfig->u4BeaconPeriod, - sizeof(UINT_32), - FALSE, - TRUE, - &u4SetInfoLen); -#else - rStatus = wlanSetInformation(prGlueInfo->prAdapter, - wlanoidSetBeaconInterval, - &prNewConfig->u4BeaconPeriod, - sizeof(UINT_32), - &u4SetInfoLen); -#endif - if (rStatus != WLAN_STATUS_SUCCESS) { - return rStatus; - } - -#if defined(_HIF_SDIO) - rStatus = sdio_io_ctrl(prGlueInfo, - wlanoidSetAtimWindow, - &prNewConfig->u4ATIMWindow, - sizeof(UINT_32), - FALSE, - TRUE, - &u4SetInfoLen); -#else - rStatus = wlanSetInformation(prGlueInfo->prAdapter, - wlanoidSetAtimWindow, - &prNewConfig->u4ATIMWindow, - sizeof(UINT_32), - &u4SetInfoLen); -#endif - if (rStatus != WLAN_STATUS_SUCCESS) { - return rStatus; - } - -#if defined(_HIF_SDIO) - rStatus = sdio_io_ctrl(prGlueInfo, - wlanoidSetFrequency, - &prNewConfig->u4DSConfig, - sizeof(UINT_32), - FALSE, - TRUE, - &u4SetInfoLen); -#else - rStatus = wlanSetInformation(prGlueInfo->prAdapter, - wlanoidSetFrequency, - &prNewConfig->u4DSConfig, - sizeof(UINT_32), - &u4SetInfoLen); -#endif - - if (rStatus != WLAN_STATUS_SUCCESS) { - return rStatus; - } - - return rStatus; - -} /* end of reqExtSetConfiguration() */ - -#endif -/*----------------------------------------------------------------------------*/ -/*! -* \brief This routine is called to set beacon detection function enable/disable state -* This is mainly designed for usage under BT inquiry state (disable function). -* -* \param[in] pvAdapter Pointer to the Adapter structure -* \param[in] pvSetBuffer A pointer to the buffer that holds the data to be set -* \param[in] u4SetBufferLen The length of the set buffer -* \param[out] pu4SetInfoLen If the call is successful, returns the number of -* bytes read from the set buffer. If the call failed due to invalid length of -* the set buffer, returns the amount of storage needed. -* -* \retval WLAN_STATUS_SUCCESS -* \retval WLAN_STATUS_INVALID_DATA If new setting value is wrong. -* \retval WLAN_STATUS_INVALID_LENGTH -* -*/ -/*----------------------------------------------------------------------------*/ -static WLAN_STATUS -reqExtSetAcpiDevicePowerState ( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID pvSetBuffer, - IN UINT_32 u4SetBufferLen, - OUT PUINT_32 pu4SetInfoLen - ) -{ - WLAN_STATUS rStatus = WLAN_STATUS_SUCCESS; - - ASSERT(prGlueInfo); - ASSERT(pvSetBuffer); - ASSERT(pu4SetInfoLen); - - /* WIFI is enabled, when ACPI is D0 (ParamDeviceStateD0 = 1). And vice versa */ - - //rStatus = wlanSetInformation(prGlueInfo->prAdapter, - // wlanoidSetAcpiDevicePowerState, - // pvSetBuffer, - // u4SetBufferLen, - // pu4SetInfoLen); - return rStatus; -} - diff --git a/drivers/net/wireless/mt5931/os/linux/hif/sdio/arm.c b/drivers/net/wireless/mt5931/os/linux/hif/sdio/arm.c deleted file mode 100755 index 4322fa303a71..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/hif/sdio/arm.c +++ /dev/null @@ -1,33 +0,0 @@ -/****************************************************************************** -*[File] mt6516-evb.c -*[Version] v1.0 -*[Revision Date] 2010-03-01 -*[Author] -*[Description] -* dummy file for build system -*[Copyright] -* Copyright (C) 2010 MediaTek Incorporation. All Rights Reserved. -******************************************************************************/ - - - -/* -** $Log: mt6516-evb.c $ - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 04 19 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * remove debug message - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port -** -*/ diff --git a/drivers/net/wireless/mt5931/os/linux/hif/sdio/include/hif.h b/drivers/net/wireless/mt5931/os/linux/hif/sdio/include/hif.h deleted file mode 100755 index 23eac4684d56..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/hif/sdio/include/hif.h +++ /dev/null @@ -1,225 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/hif/sdio/include/hif.h#1 $ -*/ - -/*! \file "hif.h" - \brief Functions for the driver to register bus and setup the IRQ - - Functions for the driver to register bus and setup the IRQ -*/ - - - -/* -** $Log: hif.h $ - * - * 11 01 2010 yarco.yang - * [WCXRP00000149] [MT6620 WI-Fi][Driver]Fine tune performance on MT6516 platform - * Add GPIO debug function - * - * 10 19 2010 jeffrey.chang - * [WCXRP00000120] [MT6620 Wi-Fi][Driver] Refine linux kernel module to the license of MTK propietary and enable MTK HIF by default - * Refine linux kernel module to the license of MTK and enable MTK HIF - * - * 08 18 2010 jeffrey.chang - * NULL - * support multi-function sdio - * - * 08 17 2010 cp.wu - * NULL - * add ENE SDIO host workaround for x86 linux platform. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port -** \main\maintrunk.MT5921\4 2009-10-20 17:38:28 GMT mtk01090 -** Refine driver unloading and clean up procedure. Block requests, stop main thread and clean up queued requests, and then stop hw. -** \main\maintrunk.MT5921\3 2009-09-28 20:19:20 GMT mtk01090 -** Add private ioctl to carry OID structures. Restructure public/private ioctl interfaces to Linux kernel. -** \main\maintrunk.MT5921\2 2009-08-18 22:57:05 GMT mtk01090 -** Add Linux SDIO (with mmc core) support. -** Add Linux 2.6.21, 2.6.25, 2.6.26. -** Fix compile warning in Linux. -** \main\maintrunk.MT5921\2 2008-09-22 23:18:17 GMT mtk01461 -** Update driver for code review -** Revision 1.1 2007/07/05 07:25:33 MTK01461 -** Add Linux initial code, modify doc, add 11BB, RF init code -** -** Revision 1.3 2007/06/27 02:18:51 MTK01461 -** Update SCAN_FSM, Initial(Can Load Module), Proc(Can do Reg R/W), TX API -** -*/ - -#ifndef _HIF_H -#define _HIF_H - - -#if MTK_WCN_HIF_SDIO -#include "hif_sdio.h" -#endif - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define SDIO_X86_WORKAROUND_WRITE_MCR 0x00C4 - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/* host interface's private data structure, which is attached to os glue -** layer info structure. - */ -typedef struct _GL_HIF_INFO_T { -#if MTK_WCN_HIF_SDIO - MTK_WCN_HIF_SDIO_CLTCTX cltCtx; - const MTK_WCN_HIF_SDIO_FUNCINFO *prFuncInfo; -#else - struct sdio_func *func; -#endif - BOOLEAN fgIntReadClear; - BOOLEAN fgMbxReadClear; -} GL_HIF_INFO_T, *P_GL_HIF_INFO_T; - - -#if CFG_DBG_GPIO_PINS - -extern void -mtk_wcn_stp_debug_gpio_assert(UINT_32 dwIndex, UINT_32 dwMethod); - - -/* Platform DEPENDENT configurations: MT6516 GPIO pin name */ -#define GPIO_6516(x) (GPIO##x) -#define GPIO_PLATFORM(x) GPIO_6516(x) - -/* Platform independent configurations */ -#define DBG_TIE_DIR 0x40000000UL -#define DBG_LOW 0x0UL -#define DBG_HIGH 0x1UL -#define DBG_TIE_LOW (DBG_TIE_DIR | DBG_LOW) -#define DBG_TIE_HIGH (DBG_TIE_DIR | DBG_HIGH) - -#define DBG_TOGGLE(x) (0x80000000UL | x) -#define DBG_TOGGLE_NUM(x) (x & 0xFFF) -#define GPIO_INVALID 0xFFFF - -typedef enum { - IDX_ERR = 0, - IDX_TX_THREAD, - IDX_TX_REQ, - IDX_TX_PORT_WRITE, - IDX_STP_MTX_BT, - IDX_STP_MTX_FM, /* 5 */ - IDX_STP_MTX_GPS, - IDX_STP_MTX_WIFI, - IDX_STP_MTX_WMT, - IDX_LOOP_CNT, - IDX_NO_BUF, /*10 */ - IDX_BT_TX, - IDX_BT_RX, - IDX_GPS_RX, - IDX_GPS_2, - IDX_GPS_3, - IDX_GPS_TX, - IDX_STP_MAX -} DBG_PIN; - -#define DBG_MTX_OFFSET (IDX_STP_MTX_BT) /* index of mutex0 */ -#endif -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -WLAN_STATUS -glRegisterBus( - probe_card pfProbe, - remove_card pfRemove - ); - -VOID -glUnregisterBus( - remove_card pfRemove - ); - -VOID -glSetHifInfo ( - P_GLUE_INFO_T prGlueInfo, - UINT_32 u4Cookie - ); - -VOID -glClearHifInfo ( - P_GLUE_INFO_T prGlueInfo - ); - -BOOL -glBusInit ( - PVOID pvData - ); - -VOID -glBusRelease ( - PVOID pData - ); - -INT_32 -glBusSetIrq ( - PVOID pvData, - PVOID pfnIsr, - PVOID pvCookie - ); - -VOID -glBusFreeIrq ( - PVOID pvData, - PVOID pvCookie - ); - -VOID -glSetPowerState ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 ePowerMode - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#endif /* _HIF_H */ diff --git a/drivers/net/wireless/mt5931/os/linux/hif/sdio/include/hif_sdio.h b/drivers/net/wireless/mt5931/os/linux/hif/sdio/include/hif_sdio.h deleted file mode 100755 index 0ee1060276e3..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/hif/sdio/include/hif_sdio.h +++ /dev/null @@ -1,286 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/hif/sdio/include/hif_sdio.h#2 $ -*/ - -/*! \file "hif_sdio.h" - \brief - - -*/ - -/* -** $Log: $ - * - * 06 13 2012 yuche.tsai - * NULL - * Update maintrunk driver. - * Add support for driver compose assoc request frame. - * - * 05 02 2012 terry.wu - * NULL - * Fix build error if HAVE_AEE_FEATURE = n - * - * 04 12 2012 terry.wu - * NULL - * Add AEE message support - * 1) Show AEE warning(red screen) if SDIO access error occurs - - * - * 03 02 2012 terry.wu - * NULL - * Enable CFG80211 Support. - * - * 08 18 2010 jeffrey.chang - * NULL - * support multi-function sdio - * - * 07 25 2010 george.kuo - * - * Move hif_sdio driver to linux directory. - * - * 07 23 2010 george.kuo - * - * Add MT6620 driver source tree - * , including char device driver (wmt, bt, gps), stp driver, interface driver (tty ldisc and hif_sdio), and bt hci driver. -** -** -*/ - -#ifndef _HIF_SDIO_H -#define _HIF_SDIO_H -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ -#define HIF_SDIO_DEBUG (0) /* 0:trun off debug msg and assert, 1:trun off debug msg and assert */ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "mtk_porting.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define CFG_CLIENT_COUNT (9) - -#define HIF_DEFAULT_BLK_SIZE (256) -#define HIF_DEFAULT_VENDOR (0x037A) - -#define HIF_SDIO_LOG_LOUD 4 -#define HIF_SDIO_LOG_DBG 3 -#define HIF_SDIO_LOG_INFO 2 -#define HIF_SDIO_LOG_WARN 1 -#define HIF_SDIO_LOG_ERR 0 - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/* Function info provided by client driver */ -typedef struct _MTK_WCN_HIF_SDIO_FUNCINFO MTK_WCN_HIF_SDIO_FUNCINFO; - -/* Client context provided by hif_sdio driver for the following function call */ -typedef UINT32 MTK_WCN_HIF_SDIO_CLTCTX; - -/* Callback functions provided by client driver */ -typedef INT32 (*MTK_WCN_HIF_SDIO_PROBE)(MTK_WCN_HIF_SDIO_CLTCTX, const MTK_WCN_HIF_SDIO_FUNCINFO *); -typedef INT32 (*MTK_WCN_HIF_SDIO_REMOVE)(MTK_WCN_HIF_SDIO_CLTCTX); -typedef INT32 (*MTK_WCN_HIF_SDIO_IRQ)(MTK_WCN_HIF_SDIO_CLTCTX); - -/* Function info provided by client driver */ -struct _MTK_WCN_HIF_SDIO_FUNCINFO { - UINT16 manf_id; /* TPLMID_MANF: manufacturer ID */ - UINT16 card_id; /* TPLMID_CARD: card ID */ - UINT16 func_num; /* Function Number */ - UINT16 blk_sz; /* Function block size */ -}; - -/* Client info provided by client driver */ -typedef struct _MTK_WCN_HIF_SDIO_CLTINFO { - const MTK_WCN_HIF_SDIO_FUNCINFO *func_tbl; /* supported function info table */ - UINT32 func_tbl_size; /* supported function table info element number */ - MTK_WCN_HIF_SDIO_PROBE hif_clt_probe; /* callback function for probing */ - MTK_WCN_HIF_SDIO_REMOVE hif_clt_remove; /* callback function for removing */ - MTK_WCN_HIF_SDIO_IRQ hif_clt_irq; /* callback function for interrupt handling */ -} MTK_WCN_HIF_SDIO_CLTINFO; - -/* function info provided by registed function */ -typedef struct _MTK_WCN_HIF_SDIO_REGISTINFO { - const MTK_WCN_HIF_SDIO_CLTINFO *sdio_cltinfo; /* client's MTK_WCN_HIF_SDIO_CLTINFO pointer */ - const MTK_WCN_HIF_SDIO_FUNCINFO *func_info; /* supported function info pointer */ -} MTK_WCN_HIF_SDIO_REGISTINFO; - -/* Card info provided by probed function */ -typedef struct _MTK_WCN_HIF_SDIO_PROBEINFO { - struct sdio_func* func; /* probed sdio function pointer */ - void* private_data_p; /* clt's private data pointer */ - MTK_WCN_BOOL on_by_wmt; /* TRUE: on by wmt, FALSE: not on by wmt */ - /* added for sdio irq sync and mmc single_irq workaround */ - MTK_WCN_BOOL sdio_irq_enabled; /* TRUE: can handle sdio irq; FALSE: no sdio irq handling */ - INT8 clt_idx; /* registered function table info element number (initial value is -1) */ -} MTK_WCN_HIF_SDIO_PROBEINFO; - -/* work queue info needed by worker */ -typedef struct _MTK_WCN_HIF_SDIO_CLT_PROBE_WORKERINFO { - struct work_struct probe_work; /* work queue structure */ - MTK_WCN_HIF_SDIO_REGISTINFO *registinfo_p; /* MTK_WCN_HIF_SDIO_REGISTINFO pointer of the client */ - INT8 probe_idx; /* probed function table info element number (initial value is -1) */ -} MTK_WCN_HIF_SDIO_CLT_PROBE_WORKERINFO; - -/* error code returned by hif_sdio driver (use NEGATIVE number) */ -typedef enum { - HIF_SDIO_ERR_SUCCESS = 0, - HIF_SDIO_ERR_FAIL = HIF_SDIO_ERR_SUCCESS - 1, /* generic error */ - HIF_SDIO_ERR_INVALID_PARAM = HIF_SDIO_ERR_FAIL - 1, - HIF_SDIO_ERR_DUPLICATED = HIF_SDIO_ERR_INVALID_PARAM - 1, - HIF_SDIO_ERR_UNSUP_MANF_ID = HIF_SDIO_ERR_DUPLICATED - 1, - HIF_SDIO_ERR_UNSUP_CARD_ID = HIF_SDIO_ERR_UNSUP_MANF_ID - 1, - HIF_SDIO_ERR_INVALID_FUNC_NUM = HIF_SDIO_ERR_UNSUP_CARD_ID - 1, - HIF_SDIO_ERR_INVALID_BLK_SZ = HIF_SDIO_ERR_INVALID_FUNC_NUM - 1, - HIF_SDIO_ERR_NOT_PROBED = HIF_SDIO_ERR_INVALID_BLK_SZ - 1, - HIF_SDIO_ERR_ALRDY_ON = HIF_SDIO_ERR_NOT_PROBED -1, - HIF_SDIO_ERR_ALRDY_OFF = HIF_SDIO_ERR_ALRDY_ON -1, - HIF_SDIO_ERR_CLT_NOT_REG = HIF_SDIO_ERR_ALRDY_OFF - 1, -} MTK_WCN_HIF_SDIO_ERR ; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/*! - * \brief A macro used to describe an SDIO function - * - * Fill an MTK_WCN_HIF_SDIO_FUNCINFO structure with function-specific information - * - * \param manf the 16 bit manufacturer id - * \param card the 16 bit card id - * \param func the 16 bit function number - * \param b_sz the 16 bit function block size - */ -#define MTK_WCN_HIF_SDIO_FUNC(manf, card, func, b_sz) \ - .manf_id = (manf), .card_id = (card), .func_num = (func), .blk_sz = (b_sz) - -#define HIF_SDIO_LOUD_FUNC(fmt, arg...) if (gHifSdioDbgLvl >= HIF_SDIO_LOG_LOUD) { printk(KERN_INFO SDIO_TAG"[L]%s:" fmt, __FUNCTION__ ,##arg);} -#define HIF_SDIO_DBG_FUNC(fmt, arg...) if (gHifSdioDbgLvl >= HIF_SDIO_LOG_DBG) { printk(KERN_INFO SDIO_TAG"[D]%s:" fmt, __FUNCTION__ ,##arg);} -#define HIF_SDIO_INFO_FUNC(fmt, arg...) if (gHifSdioDbgLvl >= HIF_SDIO_LOG_INFO) { printk(KERN_INFO SDIO_TAG"[I]%s:" fmt, __FUNCTION__ ,##arg);} -#define HIF_SDIO_WARN_FUNC(fmt, arg...) if (gHifSdioDbgLvl >= HIF_SDIO_LOG_WARN) { printk(KERN_WARNING SDIO_TAG"[W]%s(%d):" fmt, __FUNCTION__ , __LINE__, ##arg);} -#define HIF_SDIO_ERR_FUNC(fmt, arg...) if (gHifSdioDbgLvl >= HIF_SDIO_LOG_ERR) { printk(KERN_WARNING SDIO_TAG"[E]%s(%d):" fmt, __FUNCTION__ , __LINE__, ##arg);} - -/*! - * \brief ASSERT function definition. - * - */ -#if HIF_SDIO_DEBUG -#define HIF_SDIO_ASSERT(expr) if ( !(expr) ) { \ - printk("assertion failed! %s[%d]: %s\n",\ - __FUNCTION__, __LINE__, #expr); \ - BUG_ON( !(expr) );\ - } -#else -#define HIF_SDIO_ASSERT(expr) do {} while(0) -#endif - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/*! - * \brief MTK hif sdio client registration function - * - * Client uses this function to do hif sdio registration - * - * \param pinfo a pointer of client's information - * - * \retval 0 register successfully - * \retval < 0 error code - */ -extern INT32 mtk_wcn_hif_sdio_client_reg ( - const MTK_WCN_HIF_SDIO_CLTINFO *pinfo - ); - -extern INT32 mtk_wcn_hif_sdio_client_unreg ( - const MTK_WCN_HIF_SDIO_CLTINFO *pinfo - ); - -extern INT32 mtk_wcn_hif_sdio_readb ( - MTK_WCN_HIF_SDIO_CLTCTX ctx, - UINT32 offset, - PUINT8 pvb - ); - -extern INT32 mtk_wcn_hif_sdio_writeb ( - MTK_WCN_HIF_SDIO_CLTCTX ctx, - UINT32 offset, - UINT8 vb - ); - -extern INT32 mtk_wcn_hif_sdio_readl ( - MTK_WCN_HIF_SDIO_CLTCTX ctx, - UINT32 offset, - PUINT32 pvl - ); - -extern INT32 mtk_wcn_hif_sdio_writel ( - MTK_WCN_HIF_SDIO_CLTCTX ctx, - UINT32 offset, - UINT32 vl - ); - -extern INT32 mtk_wcn_hif_sdio_read_buf ( - MTK_WCN_HIF_SDIO_CLTCTX ctx, - UINT32 offset, - PUINT32 pbuf, - UINT32 len - ); - -extern INT32 mtk_wcn_hif_sdio_write_buf ( - MTK_WCN_HIF_SDIO_CLTCTX ctx, - UINT32 offset, - PUINT32 pbuf, - UINT32 len - ); - -extern void mtk_wcn_hif_sdio_set_drvdata( - MTK_WCN_HIF_SDIO_CLTCTX ctx, - void* private_data_p - ); - -extern void* mtk_wcn_hif_sdio_get_drvdata( - MTK_WCN_HIF_SDIO_CLTCTX ctx - ); - -extern void mtk_wcn_hif_sdio_get_dev( - MTK_WCN_HIF_SDIO_CLTCTX ctx, - struct device **dev - ); - -extern void mtk_wcn_hif_sdio_enable_irq( - MTK_WCN_HIF_SDIO_CLTCTX ctx, - MTK_WCN_BOOL enable - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#endif /* _HIF_SDIO_H */ - - - diff --git a/drivers/net/wireless/mt5931/os/linux/hif/sdio/include/mtk_porting.h b/drivers/net/wireless/mt5931/os/linux/hif/sdio/include/mtk_porting.h deleted file mode 100755 index 37f96be599e0..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/hif/sdio/include/mtk_porting.h +++ /dev/null @@ -1,52 +0,0 @@ -/* porting layer */ -/* Android */ - -#ifndef _MTK_PORTING_H_ -#define _MTK_PORTING_H_ - -#include /* include stddef.h for NULL */ - -/* Type definition for signed integers */ -typedef signed char INT8, *PINT8; -typedef signed short INT16, *PINT16; -typedef signed int INT32, *PINT32; - -/* Type definition for unsigned integers */ -typedef unsigned char UINT8, *PUINT8; -typedef unsigned short UINT16, *PUINT16; -typedef unsigned int UINT32, *PUINT32; - -//typedef void VOID, *PVOID; - -typedef int MTK_WCN_BOOL; -#ifndef MTK_WCN_BOOL_TRUE -#define MTK_WCN_BOOL_FALSE ((MTK_WCN_BOOL) 0) -#define MTK_WCN_BOOL_TRUE ((MTK_WCN_BOOL) 1) -#endif - -typedef int MTK_WCN_MUTEX; - -typedef int MTK_WCN_TIMER; - -/* system APIs */ -/* mutex */ -typedef MTK_WCN_MUTEX (*MUTEX_CREATE)(const char * const name); -typedef INT32 (*MUTEX_DESTROY)(MTK_WCN_MUTEX mtx); -typedef INT32 (*MUTEX_LOCK)(MTK_WCN_MUTEX mtx); -typedef INT32 (*MUTEX_UNLOCK)(MTK_WCN_MUTEX mtx, unsigned long flags); -/* debug */ -typedef INT32 (*DBG_PRINT)(const char *str, ...); -typedef INT32 (*DBG_ASSERT)(INT32 expr, const char *file, INT32 line); -/* timer */ -typedef void (*MTK_WCN_TIMER_CB)(void); -typedef MTK_WCN_TIMER (*TIMER_CREATE)(const char * const name); -typedef INT32 (*TIMER_DESTROY)(MTK_WCN_TIMER tmr); -typedef INT32 (*TIMER_START)(MTK_WCN_TIMER tmr, UINT32 timeout, MTK_WCN_TIMER_CB tmr_cb, void *param); -typedef INT32 (*TIMER_STOP)(MTK_WCN_TIMER tmr); -/* kernel lib */ -typedef void* (*SYS_MEMCPY)(void *dest, const void *src, UINT32 n); -typedef void* (*SYS_MEMSET)(void *s, INT32 c, UINT32 n); -typedef INT32 (*SYS_SPRINTF)(char *str, const char *format, ...); - -#endif /* _MTK_PORTING_H_ */ - diff --git a/drivers/net/wireless/mt5931/os/linux/hif/sdio/sdio.c b/drivers/net/wireless/mt5931/os/linux/hif/sdio/sdio.c deleted file mode 100755 index ebfedf3c4a47..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/hif/sdio/sdio.c +++ /dev/null @@ -1,1353 +0,0 @@ -/****************************************************************************** -*[File] sdio.c -*[Version] v1.0 -*[Revision Date] 2010-03-01 -*[Author] -*[Description] -* The program provides SDIO HIF driver -*[Copyright] -* Copyright (C) 2010 MediaTek Incorporation. All Rights Reserved. -******************************************************************************/ - - - -/* -** $Log: sdio.c $ - * - * 04 12 2012 terry.wu - * NULL - * Add AEE message support - * 1) Show AEE warning(red screen) if SDIO access error occurs - - * - * 02 14 2012 cp.wu - * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree - * include correct header file upon setting. - * - * 11 10 2011 cp.wu - * [WCXRP00001098] [MT6620 Wi-Fi][Driver] Replace printk by DBG LOG macros in linux porting layer - * 1. eliminaite direct calls to printk in porting layer. - * 2. replaced by DBGLOG, which would be XLOG on ALPS platforms. - * - * 09 20 2011 cp.wu - * [WCXRP00000994] [MT6620 Wi-Fi][Driver] dump message for bus error and reset bus error flag while re-initialized - * 1. always show error message for SDIO bus errors. - * 2. reset bus error flag when re-initialization - * - * 08 17 2011 cp.wu - * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree - * add MT6628 related definitions for Linux/Android driver. - * - * 05 18 2011 cp.wu - * [WCXRP00000702] [MT5931][Driver] Modify initialization sequence for E1 ASIC - * add device ID for MT5931. - * - * 04 08 2011 pat.lu - * [WCXRP00000623] [MT6620 Wi-Fi][Driver] use ARCH define to distinguish PC Linux driver - * Use CONFIG_X86 instead of PC_LINUX_DRIVER_USE option to have proper compile settting for PC Linux driver - * - * 03 22 2011 pat.lu - * [WCXRP00000592] [MT6620 Wi-Fi][Driver] Support PC Linux Environment Driver Build - * Add a compiler option "PC_LINUX_DRIVER_USE" for building driver in PC Linux environment. - * - * 03 18 2011 cp.wu - * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous memory consumption - * deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK. - * - * 03 15 2011 cp.wu - * [WCXRP00000559] [MT6620 Wi-Fi][Driver] Combine TX/RX DMA buffers into a single one to reduce physically continuous memory consumption - * 1. deprecate CFG_HANDLE_IST_IN_SDIO_CALLBACK - * 2. Use common coalescing buffer for both TX/RX directions - * - * - * 03 07 2011 terry.wu - * [WCXRP00000521] [MT6620 Wi-Fi][Driver] Remove non-standard debug message - * Toggle non-standard debug messages to comments. - * - * 11 15 2010 jeffrey.chang - * [WCXRP00000181] [MT6620 Wi-Fi][Driver] fix the driver message "GLUE_FLAG_HALT skip INT" during unloading - * Fix GLUE_FALG_HALT message which cause driver to hang - * - * 11 08 2010 cp.wu - * [WCXRP00000166] [MT6620 Wi-Fi][Driver] use SDIO CMD52 for enabling/disabling interrupt to reduce transaction period - * correct typo - * - * 11 08 2010 cp.wu - * [WCXRP00000166] [MT6620 Wi-Fi][Driver] use SDIO CMD52 for enabling/disabling interrupt to reduce transaction period - * change to use CMD52 for enabling/disabling interrupt to reduce SDIO transaction time - * - * 11 01 2010 yarco.yang - * [WCXRP00000149] [MT6620 WI-Fi][Driver]Fine tune performance on MT6516 platform - * Add code to run WlanIST in SDIO callback. - * - * 10 19 2010 cp.wu - * [WCXRP00000122] [MT6620 Wi-Fi][Driver] Preparation for YuSu source tree integration - * remove HIF_SDIO_ONE flags because the settings could be merged for runtime detection instead of compile-time. - * - * 10 19 2010 jeffrey.chang - * [WCXRP00000120] [MT6620 Wi-Fi][Driver] Refine linux kernel module to the license of MTK propietary and enable MTK HIF by default - * Refine linux kernel module to the license of MTK and enable MTK HIF - * - * 08 21 2010 jeffrey.chang - * NULL - * 1) add sdio two setting - * 2) bug fix of sdio glue - * - * 08 18 2010 jeffrey.chang - * NULL - * support multi-function sdio - * - * 08 18 2010 cp.wu - * NULL - * #if defined(__X86__) is not working, change to use #ifdef CONFIG_X86. - * - * 08 17 2010 cp.wu - * NULL - * add ENE SDIO host workaround for x86 linux platform. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 07 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * Fix hotplug bug - * - * 03 28 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * clear sdio interrupt - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port -** -*/ - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -#include "gl_os.h" - -#if MTK_WCN_HIF_SDIO -#include "hif_sdio.h" -#else -#include -#include -#include -#include /* sdio_readl(), etc */ -#include -#endif - -#include -//#ifndef CONFIG_X86 modify by Nicolas Luo -#ifdef CONFIG_ARM -#include -#endif - -#if defined(MT6620) - #include "mt6620_reg.h" -#elif defined(MT5931) - #include "mt5931_reg.h" -#elif defined(MT6628) - #include "mt6628_reg.h" -#endif - -#if CFG_DBG_GPIO_PINS/* FIXME: move to platform or custom header */ -#include -#endif - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -#define HIF_SDIO_ERR_TITLE_STR "["CHIP_NAME"] SDIO Access Error!" -#define HIF_SDIO_ERR_DESC_STR "**SDIO Access Error**\n" - -#if MTK_WCN_HIF_SDIO - - -/* - * function prototypes - * - */ - -static INT32 -mtk_sdio_probe(MTK_WCN_HIF_SDIO_CLTCTX, const MTK_WCN_HIF_SDIO_FUNCINFO *); - -static INT32 -mtk_sdio_remove(MTK_WCN_HIF_SDIO_CLTCTX); -static INT32 mtk_sdio_interrupt(MTK_WCN_HIF_SDIO_CLTCTX); - -/* - * sdio function info table - */ - -static MTK_WCN_HIF_SDIO_FUNCINFO funcInfo[] = { -#if defined(MT6620) - { MTK_WCN_HIF_SDIO_FUNC(0x037a, 0x020a, 0x1, 512) }, - { MTK_WCN_HIF_SDIO_FUNC(0x037a, 0x020c, 0x2, 512) }, - { MTK_WCN_HIF_SDIO_FUNC(0x037a, 0x018a, 0x1, 512) }, - { MTK_WCN_HIF_SDIO_FUNC(0x037a, 0x018c, 0x2, 512) }, -#elif defined(MT5931) - { MTK_WCN_HIF_SDIO_FUNC(0x037a, 0x5931, 0x1, 512) }, -#elif defined(MT6628) - { MTK_WCN_HIF_SDIO_FUNC(0x037a, 0x6628, 0x1, 512) }, -#endif -}; - - -static MTK_WCN_HIF_SDIO_CLTINFO cltInfo = { - .func_tbl = funcInfo, - .func_tbl_size = sizeof(funcInfo)/sizeof(MTK_WCN_HIF_SDIO_FUNCINFO), - .hif_clt_probe = mtk_sdio_probe, - .hif_clt_remove = mtk_sdio_remove, - .hif_clt_irq = mtk_sdio_interrupt, -}; - -#else - -static const struct sdio_device_id mtk_sdio_ids[] = { -#if defined(MT6620) - { SDIO_DEVICE(0x037a, 0x020a) }, /* Not an SDIO standard class device */ - { SDIO_DEVICE(0x037a, 0x020b) }, /* Not an SDIO standard class device */ - { SDIO_DEVICE(0x037a, 0x020c) }, /* Not an SDIO standard class device */ -#elif defined(MT5931) - { SDIO_DEVICE(0x037a, 0x5931) }, /* Not an SDIO standard class device */ -#elif defined(MT6628) - { SDIO_DEVICE(0x037a, 0x6628) }, /* Not an SDIO standard class device */ -#endif - { /* end: all zeroes */ }, -}; - -MODULE_DEVICE_TABLE(sdio, mtk_sdio_ids); - -#endif - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ -extern KAL_WAKE_LOCK_T isr_wakelock; -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ -static probe_card pfWlanProbe = NULL; -static remove_card pfWlanRemove = NULL; - - -#if (MTK_WCN_HIF_SDIO == 0) -static struct sdio_driver mtk_sdio_driver = { - .name = "wlan", /* "MTK SDIO WLAN Driver" */ - .id_table = mtk_sdio_ids, - .probe = NULL, - .remove = NULL, -}; -#endif - - -#if CFG_DBG_GPIO_PINS - -/* debug pins */ -UINT_32 dbgPinSTP[] = { - GPIO_PLATFORM(33)/* CMFLASH, IDX_ERR J613 */ - , GPIO_PLATFORM(62)/* EINT3, IDX_TX_THREAD */ - , GPIO_PLATFORM(80)/* SPI_CS_N, IDX_TX_REQ J613 */ - , GPIO_PLATFORM(81)/* SPI_SCK, IDX_TX_PORT_WRITE J613 */ - , GPIO_PLATFORM(17) /* CMRST, IDX_STP_MTX_BT J618 */ - , GPIO_PLATFORM(18) /* CMPDN, IDX_STP_MTX_FM J613 */ - , GPIO_PLATFORM(19) /* CMVREF,IDX_STP_MTX_GPS J613 */ - , GPIO_INVALID /* REMOVED, IDX_STP_MTX_WIFI */ - , GPIO_INVALID /* REMOVED, IDX_STP_MTX_WMT */ - , GPIO_PLATFORM(135) /* SCL2, IDX_LOOP_CNT J616 */ - , GPIO_PLATFORM(136) /* SDA2, IDX_NO_BUF J616 */ - , GPIO_PLATFORM(30) /* CAM_MECHSH0, IDX_BT_TX, J613 low-active */ - , GPIO_PLATFORM(31) /* CAM_MECHSH1, IDX_BT_RX, J613 low-active */ - , GPIO_PLATFORM(124) /* GPS_PWR_EN, ThreadDSPIn [GPS] */ - , GPIO_PLATFORM(125) /* GPS_SYNC, mtk_sys_msg_recv [GPS] */ - , GPIO_PLATFORM(21) /* GPS_EINT8, dump_nmea_data [GPS] */ - , GPIO_PLATFORM(29) /* CAM_STROBE, IDX_GPS_TX, J613 low-active */ - , GPIO_PLATFORM(20) /*CMHREF, J613 UNUSED */ -// , GPIO_6516(64) /* EINT5, REMOVED!!! for MT6620-Wi-Fi Int */ -// , GPIO_6516(122) /* BT_PWR_EN, REMOVED!!! for MT6620-PMU_EN */ -// , GPIO_6516(123) /* BT_RESET, REMOVED!!! for MT6620-RST */ -}; -#endif -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ -#if CFG_DBG_GPIO_PINS -void debug_gpio_init(void) -{ - int i; - - for (i = 0; i < sizeof(dbgPinSTP)/sizeof(dbgPinSTP[0]); ++i) { - if (GPIO_INVALID == dbgPinSTP[i]) { - continue; - } - //printk(KERN_INFO "[%s] %ld \n", __FUNCTION__, dbgPinSTP[i]); - mt_set_gpio_pull_enable(dbgPinSTP[i], 0); /* disable pull */ - mt_set_gpio_dir(dbgPinSTP[i], GPIO_DIR_OUT); /* set output */ - mt_set_gpio_mode(dbgPinSTP[i], GPIO_MODE_00); /* set gpio mode */ - - /* toggle twice to check if ok: */ - mt_set_gpio_out(dbgPinSTP[i], GPIO_OUT_ZERO); /* tie low */ - mt_set_gpio_out(dbgPinSTP[i], GPIO_OUT_ONE); /* tie high*/ - mt_set_gpio_out(dbgPinSTP[i], GPIO_OUT_ZERO); /* tie low */ - mt_set_gpio_out(dbgPinSTP[i], GPIO_OUT_ONE); /* tie high*/ - } - //printk(KERN_INFO "[%s] initialization ok \n", __FUNCTION__); -} - -void debug_gpio_deinit(void) -{ - int i; - for (i = 0; i < sizeof(dbgPinSTP)/sizeof(dbgPinSTP[0]); ++i) { - if (GPIO_INVALID == dbgPinSTP[i]) { - continue; - } - //printk(KERN_INFO "[%s] %ld \n", __FUNCTION__, dbgPinSTP[i]); - mt_set_gpio_dir(dbgPinSTP[i], GPIO_DIR_IN); - } - - //printk(KERN_INFO "[%s] k\n", __FUNCTION__); -} - -void mtk_wcn_stp_debug_gpio_assert(UINT_32 dwIndex, UINT_32 dwMethod) -{ - unsigned int i; - - if (dwIndex >= (sizeof(dbgPinSTP)/sizeof(dbgPinSTP[0]))) { - //printk(KERN_INFO "[%s] invalid dwIndex(%ld) \n", __FUNCTION__, dwIndex); - return; - } - - if (dwIndex > IDX_STP_MAX) { - //printk(KERN_INFO "[%s] dwIndex(%ld) > IDX_STP_MAX(%d) \n", __FUNCTION__, dwIndex, IDX_STP_MAX); - } - - if (GPIO_INVALID == dbgPinSTP[dwIndex]) { - return; - } - - if (dwMethod & DBG_TIE_DIR) { - if (dwMethod & DBG_HIGH) { - mt_set_gpio_out(dbgPinSTP[dwIndex], GPIO_OUT_ONE); - } - else { - mt_set_gpio_out(dbgPinSTP[dwIndex], GPIO_OUT_ZERO); - } - return; - } - - if (dwMethod & DBG_TOGGLE(0)) { - for (i = 0; i < DBG_TOGGLE_NUM(dwMethod); ++i) { - mt_set_gpio_out(dbgPinSTP[dwIndex], GPIO_OUT_ZERO); - mt_set_gpio_out(dbgPinSTP[dwIndex], GPIO_OUT_ONE); - } - return; - } - - return; -} -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is a SDIO interrupt callback function -* -* \param[in] func pointer to SDIO handle -* -* \return void -*/ -/*----------------------------------------------------------------------------*/ - -#if MTK_WCN_HIF_SDIO - -static INT32 mtk_sdio_interrupt(MTK_WCN_HIF_SDIO_CLTCTX cltCtx) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - INT32 ret = 0; - - prGlueInfo = mtk_wcn_hif_sdio_get_drvdata(cltCtx); - - ASSERT(prGlueInfo); - - if (!prGlueInfo) { - //printk(KERN_INFO DRV_NAME"No glue info in mtk_sdio_interrupt()\n"); - return (-HIF_SDIO_ERR_FAIL); - } - - if (prGlueInfo->u4Flag & GLUE_FLAG_HALT) { - //printk(KERN_INFO DRV_NAME"GLUE_FLAG_HALT skip INT\n"); - ret = mtk_wcn_hif_sdio_writel(cltCtx, MCR_WHLPCR, WHLPCR_INT_EN_CLR); - return ret; - } - - /*WCNCR 00002676*/ - KAL_WAKE_UNLOCK(NULL, &isr_wakelock); - KAL_WAKE_LOCK_TIMEOUT(NULL, &isr_wakelock, KAL_HZ/10); - - ret = mtk_wcn_hif_sdio_writel(cltCtx, MCR_WHLPCR, WHLPCR_INT_EN_CLR); - - set_bit (GLUE_FLAG_INT_BIT, &prGlueInfo->u4Flag); - - /* when we got sdio interrupt, we wake up the tx servie thread*/ - wake_up_interruptible(&prGlueInfo->waitq); - - return ret; -} - -#else - -static unsigned int in_interrupt = 0; - -static void mtk_sdio_interrupt(struct sdio_func *func) -{ - P_GLUE_INFO_T prGlueInfo = NULL; - - int ret = 0; - - prGlueInfo = sdio_get_drvdata(func); - ASSERT(prGlueInfo); - - if (!prGlueInfo) { - //printk(KERN_INFO DRV_NAME"No glue info in mtk_sdio_interrupt()\n"); - return; - } - - if (prGlueInfo->u4Flag & GLUE_FLAG_HALT) { - sdio_writel(prGlueInfo->rHifInfo.func, WHLPCR_INT_EN_CLR, MCR_WHLPCR, &ret); - //printk(KERN_INFO DRV_NAME"GLUE_FLAG_HALT skip INT\n"); - return; - } - - sdio_writel(prGlueInfo->rHifInfo.func, WHLPCR_INT_EN_CLR, MCR_WHLPCR, &ret); - - #if 0 - wlanISR(prGlueInfo->prAdapter, TRUE); - - if (prGlueInfo->u4Flag & GLUE_FLAG_HALT) { - /* Should stop now... skip pending interrupt */ - //printk(KERN_INFO DRV_NAME"ignore pending interrupt\n"); - } - else { - wlanIST(prGlueInfo->prAdapter); - } - #endif - - set_bit (GLUE_FLAG_INT_BIT, &prGlueInfo->u4Flag); - - /* when we got sdio interrupt, we wake up the tx servie thread*/ - wake_up_interruptible(&prGlueInfo->waitq); -} -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is a SDIO probe function -* -* \param[in] func pointer to SDIO handle -* \param[in] id pointer to SDIO device id table -* -* \return void -*/ -/*----------------------------------------------------------------------------*/ - -#if MTK_WCN_HIF_SDIO - -// FIXME: global variable -static const MTK_WCN_HIF_SDIO_FUNCINFO *prFunc; - - -static INT32 -mtk_sdio_probe(MTK_WCN_HIF_SDIO_CLTCTX cltCtx, const MTK_WCN_HIF_SDIO_FUNCINFO *prFuncInfo) -{ - INT32 ret = HIF_SDIO_ERR_SUCCESS; - - prFunc = prFuncInfo; - - if (pfWlanProbe((PVOID) &cltCtx) != WLAN_STATUS_SUCCESS) { - //printk(KERN_WARNING DRV_NAME"pfWlanProbe fail!call pfWlanRemove()\n"); - pfWlanRemove(); - ret = -(HIF_SDIO_ERR_FAIL); - } else { - //printk(KERN_INFO DRV_NAME"mtk_wifi_sdio_probe() done(%d)\n", ret); - } - return ret; -} -#else -static int mtk_sdio_probe ( - struct sdio_func *func, - const struct sdio_device_id *id - ) -{ - int ret = 0; - int i = 0; - - //printk(KERN_INFO DRV_NAME "mtk_sdio_probe()\n"); - - ASSERT(func); - ASSERT(id); - - //printk(KERN_INFO DRV_NAME "Basic struct size checking...\n"); - //printk(KERN_INFO DRV_NAME "sizeof(struct device) = %d\n", sizeof(struct device)); - //printk(KERN_INFO DRV_NAME "sizeof(struct mmc_host) = %d\n", sizeof(struct mmc_host)); - //printk(KERN_INFO DRV_NAME "sizeof(struct mmc_card) = %d\n", sizeof(struct mmc_card)); - //printk(KERN_INFO DRV_NAME "sizeof(struct mmc_driver) = %d\n", sizeof(struct mmc_driver)); - //printk(KERN_INFO DRV_NAME "sizeof(struct mmc_data) = %d\n", sizeof(struct mmc_data)); - //printk(KERN_INFO DRV_NAME "sizeof(struct mmc_command) = %d\n", sizeof(struct mmc_command)); - //printk(KERN_INFO DRV_NAME "sizeof(struct mmc_request) = %d\n", sizeof(struct mmc_request)); - //printk(KERN_INFO DRV_NAME "sizeof(struct sdio_func) = %d\n", sizeof(struct sdio_func)); - - //printk(KERN_INFO DRV_NAME "Card information checking...\n"); - //printk(KERN_INFO DRV_NAME "func = 0x%p\n", func); - //printk(KERN_INFO DRV_NAME "Number of info = %d:\n", func->card->num_info); - - for (i = 0; i < func->card->num_info; i++) { - //printk(KERN_INFO DRV_NAME "info[%d]: %s\n", i, func->card->info[i]); - } - - sdio_claim_host(func); - ret = sdio_enable_func(func); - sdio_release_host(func); - - if (ret) { - //printk(KERN_INFO DRV_NAME"sdio_enable_func failed!\n"); - goto out; - } - //printk(KERN_INFO DRV_NAME"sdio_enable_func done!\n"); - - if (pfWlanProbe((PVOID)func) != WLAN_STATUS_SUCCESS) { - //printk(KERN_WARNING DRV_NAME"pfWlanProbe fail!call pfWlanRemove()\n"); - pfWlanRemove(); - ret = -1; - } - else { -#if CFG_DBG_GPIO_PINS - //printk(KERN_INFO "[%s] init debug gpio, 20100815 \n", __FUNCTION__); - /* Debug pins initialization */ - debug_gpio_init(); -#endif - } - -out: - //printk(KERN_INFO DRV_NAME"mtk_sdio_probe() done(%d)\n", ret); - return ret; -} -#endif - - -#if MTK_WCN_HIF_SDIO -static INT32 -mtk_sdio_remove(MTK_WCN_HIF_SDIO_CLTCTX cltCtx) -{ - INT32 ret = HIF_SDIO_ERR_SUCCESS; - //printk(KERN_INFO DRV_NAME"pfWlanRemove done\n"); - pfWlanRemove(); - - return ret; -} -#else -static void -mtk_sdio_remove ( - struct sdio_func *func - ) -{ - //printk(KERN_INFO DRV_NAME"mtk_sdio_remove()\n"); - -#if CFG_DBG_GPIO_PINS - //printk(KERN_INFO "[%s] deinit debug gpio \n", __FUNCTION__); - debug_gpio_deinit(); -#endif - - ASSERT(func); - //printk(KERN_INFO DRV_NAME"pfWlanRemove done\n"); - pfWlanRemove(); - - sdio_claim_host(func); - sdio_disable_func(func); - //printk(KERN_INFO DRV_NAME"sdio_disable_func() done\n"); - sdio_release_host(func); - - //printk(KERN_INFO DRV_NAME"mtk_sdio_remove() done\n"); -} -#endif - -#if (MTK_WCN_HIF_SDIO == 0) -static int -mtk_sdio_suspend ( - struct device * pDev, - pm_message_t state - ) -{ - //printk(KERN_INFO "mtk_sdio: mtk_sdio_suspend dev(0x%p)\n", pDev); - //printk(KERN_INFO "mtk_sdio: MediaTek SDIO WLAN driver\n"); - - return 0; -} - -int mtk_sdio_resume ( - struct device * pDev - ) -{ - //printk(KERN_INFO "mtk_sdio: mtk_sdio_resume dev(0x%p)\n", pDev); - - return 0; -} -#endif - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will register sdio bus to the os -* -* \param[in] pfProbe Function pointer to detect card -* \param[in] pfRemove Function pointer to remove card -* -* \return The result of registering sdio bus -*/ -/*----------------------------------------------------------------------------*/ -WLAN_STATUS -glRegisterBus ( - probe_card pfProbe, - remove_card pfRemove - ) -{ - int ret = 0; - - ASSERT(pfProbe); - ASSERT(pfRemove); - - //printk(KERN_INFO "mtk_sdio: MediaTek SDIO WLAN driver\n"); - //printk(KERN_INFO "mtk_sdio: Copyright MediaTek Inc.\n"); - - pfWlanProbe = pfProbe; - pfWlanRemove = pfRemove; - -#if MTK_WCN_HIF_SDIO - /* register MTK sdio client */ - ret = ((mtk_wcn_hif_sdio_client_reg(&cltInfo) == HIF_SDIO_ERR_SUCCESS) ? WLAN_STATUS_SUCCESS : WLAN_STATUS_FAILURE); -#else - mtk_sdio_driver.probe = mtk_sdio_probe; - mtk_sdio_driver.remove = mtk_sdio_remove; - - mtk_sdio_driver.drv.suspend = mtk_sdio_suspend; - mtk_sdio_driver.drv.resume = mtk_sdio_resume; - - ret = (sdio_register_driver(&mtk_sdio_driver) == 0) ? WLAN_STATUS_SUCCESS : WLAN_STATUS_FAILURE; -#endif - - return ret; -} /* end of glRegisterBus() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will unregister sdio bus to the os -* -* \param[in] pfRemove Function pointer to remove card -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -glUnregisterBus( - remove_card pfRemove - ) -{ - ASSERT(pfRemove); - pfRemove(); - -#if MTK_WCN_HIF_SDIO - /* unregister MTK sdio client */ - mtk_wcn_hif_sdio_client_unreg(&cltInfo); -#else - sdio_unregister_driver(&mtk_sdio_driver); -#endif - - return; -} /* end of glUnregisterBus() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function stores hif related info, which is initialized before. -* -* \param[in] prGlueInfo Pointer to glue info structure -* \param[in] u4Cookie Pointer to UINT_32 memory base variable for _HIF_HPI -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -glSetHifInfo ( - P_GLUE_INFO_T prGlueInfo, - UINT_32 u4Cookie - ) -{ - P_GL_HIF_INFO_T prHif = NULL; - - prHif = &prGlueInfo->rHifInfo; - -#if MTK_WCN_HIF_SDIO - //prHif->prFuncInfo = ((MTK_WCN_HIF_SDIO_FUNCINFO *) u4Cookie); - prHif->prFuncInfo = prFunc; - prHif->cltCtx = *((MTK_WCN_HIF_SDIO_CLTCTX *) u4Cookie); - mtk_wcn_hif_sdio_set_drvdata(prHif->cltCtx, prGlueInfo); - -#else - prHif->func = (struct sdio_func *) u4Cookie; - - //printk(KERN_INFO DRV_NAME"prHif->func->dev = 0x%p\n", &prHif->func->dev); - //printk(KERN_INFO DRV_NAME"prHif->func->vendor = 0x%04X\n", prHif->func->vendor); - //printk(KERN_INFO DRV_NAME"prHif->func->device = 0x%04X\n", prHif->func->device); - //printk(KERN_INFO DRV_NAME"prHif->func->func = 0x%04X\n", prHif->func->num); - - sdio_set_drvdata(prHif->func, prGlueInfo); - - SET_NETDEV_DEV(prGlueInfo->prDevHandler, &prHif->func->dev); -#endif - - return; -} /* end of glSetHifInfo() */ - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function clears hif related info. -* -* \param[in] prGlueInfo Pointer to glue info structure -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -glClearHifInfo ( - P_GLUE_INFO_T prGlueInfo - ) -{ - //P_GL_HIF_INFO_T prHif = NULL; - //ASSERT(prGlueInfo); - //prHif = &prGlueInfo->rHifInfo; - - return; -} /* end of glClearHifInfo() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Initialize bus operation and hif related information, request resources. -* -* \param[out] pvData A pointer to HIF-specific data type buffer. -* For eHPI, pvData is a pointer to UINT_32 type and stores a -* mapped base address. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -BOOL -glBusInit ( - PVOID pvData - ) -{ -#if (MTK_WCN_HIF_SDIO == 0) - int ret = 0; - struct sdio_func *func = NULL; - - ASSERT(pvData); - - func = (struct sdio_func *) pvData; - - sdio_claim_host(func); - ret = sdio_set_block_size(func, 512); - sdio_release_host(func); - - if (ret) { - //printk(KERN_INFO DRV_NAME"sdio_set_block_size 512 failed!\n"); - } - else { - //printk(KERN_INFO DRV_NAME"sdio_set_block_size 512 done!\n"); - } - - //printk(KERN_INFO DRV_NAME"param: func->cur_blksize(%d)\n", func->cur_blksize); - //printk(KERN_INFO DRV_NAME"param: func->max_blksize(%d)\n", func->max_blksize); - //printk(KERN_INFO DRV_NAME"param: func->card->host->max_blk_size(%d)\n", func->card->host->max_blk_size); - //printk(KERN_INFO DRV_NAME"param: func->card->host->max_blk_count(%d)\n", func->card->host->max_blk_count); -#endif - return TRUE; -} /* end of glBusInit() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Stop bus operation and release resources. -* -* \param[in] pvData A pointer to struct net_device. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -glBusRelease ( - PVOID pvData - ) -{ - - return; -} /* end of glBusRelease() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Setup bus interrupt operation and interrupt handler for os. -* -* \param[in] pvData A pointer to struct net_device. -* \param[in] pfnIsr A pointer to interrupt handler function. -* \param[in] pvCookie Private data for pfnIsr function. -* -* \retval WLAN_STATUS_SUCCESS if success -* NEGATIVE_VALUE if fail -*/ -/*----------------------------------------------------------------------------*/ -INT_32 -glBusSetIrq ( - PVOID pvData, - PVOID pfnIsr, - PVOID pvCookie - ) -{ - int ret = 0; - -#if (MTK_WCN_HIF_SDIO == 0) - struct net_device *prNetDevice = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - P_GL_HIF_INFO_T prHifInfo = NULL; - - ASSERT(pvData); - if (!pvData) { - return -1; - } - prNetDevice = (struct net_device *) pvData; - prGlueInfo = (P_GLUE_INFO_T) pvCookie; - ASSERT(prGlueInfo); - if (!prGlueInfo) { - return -1; - } - - prHifInfo = &prGlueInfo->rHifInfo; - - sdio_claim_host(prHifInfo->func); - ret = sdio_claim_irq(prHifInfo->func, mtk_sdio_interrupt); - sdio_release_host(prHifInfo->func); -#else - /* hif_sdio case */ - struct net_device *prNetDevice = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(pvData); - if (!pvData) { - return -1; - } - prNetDevice = (struct net_device *) pvData; - - prGlueInfo = (P_GLUE_INFO_T) pvCookie; - ASSERT(prGlueInfo); - if (!prGlueInfo) { - return -1; - } - - mtk_wcn_hif_sdio_enable_irq(prGlueInfo->rHifInfo.cltCtx, MTK_WCN_BOOL_TRUE); - -#endif - return ret; -} /* end of glBusSetIrq() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Stop bus interrupt operation and disable interrupt handling for os. -* -* \param[in] pvData A pointer to struct net_device. -* \param[in] pvCookie Private data for pfnIsr function. -* -* \return (none) -*/ -/*----------------------------------------------------------------------------*/ -VOID -glBusFreeIrq ( - PVOID pvData, - PVOID pvCookie - ) -{ -#if (MTK_WCN_HIF_SDIO == 0) - struct net_device *prNetDevice = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - P_GL_HIF_INFO_T prHifInfo = NULL; - int ret = 0; - - ASSERT(pvData); - if (!pvData) { - //printk(KERN_INFO DRV_NAME"%s null pvData\n", __FUNCTION__); - return; - } - prNetDevice = (struct net_device *) pvData; - prGlueInfo = (P_GLUE_INFO_T) pvCookie; - ASSERT(prGlueInfo); - if (!prGlueInfo) { - //printk(KERN_INFO DRV_NAME"%s no glue info\n", __FUNCTION__); - return; - } - - prHifInfo = &prGlueInfo->rHifInfo; - - sdio_claim_host(prHifInfo->func); - ret = sdio_release_irq(prHifInfo->func); - sdio_release_host(prHifInfo->func); -#else - /* hif_sdio case */ - struct net_device *prNetDevice = NULL; - P_GLUE_INFO_T prGlueInfo = NULL; - - ASSERT(pvData); - if (!pvData) { - //printk(KERN_INFO DRV_NAME"%s null pvData\n", __FUNCTION__); - return; - } - prNetDevice = (struct net_device *) pvData; - - prGlueInfo = (P_GLUE_INFO_T) pvCookie; - ASSERT(prGlueInfo); - if (!prGlueInfo) { - //printk(KERN_INFO DRV_NAME"%s no glue info\n", __FUNCTION__); - return; - } - - mtk_wcn_hif_sdio_enable_irq(prGlueInfo->rHifInfo.cltCtx, MTK_WCN_BOOL_FALSE); -#endif - - return; -} /* end of glBusreeIrq() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Read a 32-bit device register -* -* \param[in] prGlueInfo Pointer to the GLUE_INFO_T structure. -* \param[in] u4Register Register offset -* \param[in] pu4Value Pointer to variable used to store read value -* -* \retval TRUE operation success -* \retval FALSE operation fail -*/ -/*----------------------------------------------------------------------------*/ -BOOL -kalDevRegRead ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Register, - OUT PUINT_32 pu4Value - ) -{ - int ret = 0; - int a = 0; - - ASSERT(prGlueInfo); - ASSERT(pu4Value); - -#if MTK_WCN_HIF_SDIO - ret = mtk_wcn_hif_sdio_readl(prGlueInfo->rHifInfo.cltCtx, u4Register, (PUINT32) pu4Value); -#else - if (!in_interrupt) { - sdio_claim_host(prGlueInfo->rHifInfo.func); - } - -retry: - *pu4Value = sdio_readl(prGlueInfo->rHifInfo.func, u4Register, &ret); - if (ret && a < 10) { - a++; - printk("gwl =-==============> sdio_readl retry %d!\n", a); - msleep(1); - goto retry; - } - - if (!in_interrupt) { - sdio_release_host(prGlueInfo->rHifInfo.func); - } -#endif - - if (ret) { - kalSendAeeWarning(HIF_SDIO_ERR_TITLE_STR, HIF_SDIO_ERR_DESC_STR "sdio_readl() reports error: %x", ret); - DBGLOG(HAL, ERROR, ("sdio_readl() reports error: %x", ret)); - } - - return (ret) ? FALSE : TRUE; -} /* end of kalDevRegRead() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Write a 32-bit device register -* -* \param[in] prGlueInfo Pointer to the GLUE_INFO_T structure. -* \param[in] u4Register Register offset -* \param[in] u4Value Value to be written -* -* \retval TRUE operation success -* \retval FALSE operation fail -*/ -/*----------------------------------------------------------------------------*/ -BOOL -kalDevRegWrite ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Register, - IN UINT_32 u4Value - ) -{ - int ret = 0; - int a = 0; - - ASSERT(prGlueInfo); - -#if MTK_WCN_HIF_SDIO - ret = mtk_wcn_hif_sdio_writel(prGlueInfo->rHifInfo.cltCtx, u4Register, u4Value); -#else - if (!in_interrupt) { - sdio_claim_host(prGlueInfo->rHifInfo.func); - } - -retry: - sdio_writel(prGlueInfo->rHifInfo.func, u4Value, u4Register, &ret); - if (ret && a < 10) { - a++; - printk("gwl =-==============> sdio_writel retry %d!\n", a); - msleep(1); - goto retry; - } - - if (!in_interrupt) { - sdio_release_host(prGlueInfo->rHifInfo.func); - } -#endif - - if (ret) { - kalSendAeeWarning(HIF_SDIO_ERR_TITLE_STR, HIF_SDIO_ERR_DESC_STR "sdio_writel() reports error: %x", ret); - DBGLOG(HAL, ERROR, ("sdio_writel() reports error: %x", ret)); - } - - return (ret) ? FALSE : TRUE; -} /* end of kalDevRegWrite() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Read device I/O port -* -* \param[in] prGlueInfo Pointer to the GLUE_INFO_T structure. -* \param[in] u2Port I/O port offset -* \param[in] u2Len Length to be read -* \param[out] pucBuf Pointer to read buffer -* \param[in] u2ValidOutBufSize Length of the buffer valid to be accessed -* -* \retval TRUE operation success -* \retval FALSE operation fail -*/ -/*----------------------------------------------------------------------------*/ -BOOL -kalDevPortRead ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_16 u2Port, - IN UINT_16 u2Len, - OUT PUINT_8 pucBuf, - IN UINT_16 u2ValidOutBufSize - ) -{ - P_GL_HIF_INFO_T prHifInfo = NULL; - PUINT_8 pucDst = NULL; - int count = u2Len; - int ret = 0; - int bNum = 0; - -#if (MTK_WCN_HIF_SDIO == 0) - struct sdio_func *prSdioFunc = NULL; -#endif - - #if DBG - //printk(KERN_INFO DRV_NAME"++kalDevPortRead++ buf:0x%p, port:0x%x, length:%d\n", pucBuf, u2Port, u2Len); - #endif - - ASSERT(prGlueInfo); - prHifInfo = &prGlueInfo->rHifInfo; - - ASSERT(pucBuf); - pucDst = pucBuf; - - ASSERT(u2Len <= u2ValidOutBufSize); - -#if (MTK_WCN_HIF_SDIO == 0) - prSdioFunc = prHifInfo->func; - - ASSERT(prSdioFunc->cur_blksize > 0); - - if (!in_interrupt) { - sdio_claim_host(prSdioFunc); - } - - /* Split buffer into multiple single block to workaround hifsys */ - while (count >= prSdioFunc->cur_blksize) { - count -= prSdioFunc->cur_blksize; - bNum++; - } - if (count > 0 && bNum > 0) { - bNum++; - } - - if (bNum > 0) { - ret = sdio_readsb(prSdioFunc, pucDst, u2Port, prSdioFunc->cur_blksize * bNum); - -#ifdef CONFIG_X86 - /* ENE workaround */ - { - int tmp; - sdio_writel(prSdioFunc, 0x0, SDIO_X86_WORKAROUND_WRITE_MCR, &tmp); - } -#endif - - } - else { - if(count & 0x3L) { - int aligned_count = (count+3) & (~0x3L); - ret = sdio_readsb(prSdioFunc, pucDst, u2Port, aligned_count); - } else { - ret = sdio_readsb(prSdioFunc, pucDst, u2Port, count); - } - } - - if (!in_interrupt) { - sdio_release_host(prSdioFunc); - } -#else - - /* Split buffer into multiple single block to workaround hifsys */ - while (count >= (prGlueInfo->rHifInfo).prFuncInfo->blk_sz) { - count -= ((prGlueInfo->rHifInfo).prFuncInfo->blk_sz); - bNum++; - } - if (count > 0 && bNum > 0) { - bNum++; - } - - if (bNum > 0) { - ret = mtk_wcn_hif_sdio_read_buf(prGlueInfo->rHifInfo.cltCtx, u2Port, (PUINT32) pucDst, - ((prGlueInfo->rHifInfo).prFuncInfo->blk_sz) * bNum); - } - else { - ret = mtk_wcn_hif_sdio_read_buf(prGlueInfo->rHifInfo.cltCtx, u2Port, (PUINT32) pucDst, count); - } -#endif - - if (ret) { - kalSendAeeWarning(HIF_SDIO_ERR_TITLE_STR, HIF_SDIO_ERR_DESC_STR "sdio_readsb() reports error: %x", ret); - DBGLOG(HAL, ERROR, ("sdio_readsb() reports error: %x", ret)); - } - - return (ret) ? FALSE : TRUE; -} /* end of kalDevPortRead() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Write device I/O port -* -* \param[in] prGlueInfo Pointer to the GLUE_INFO_T structure. -* \param[in] u2Port I/O port offset -* \param[in] u2Len Length to be write -* \param[in] pucBuf Pointer to write buffer -* \param[in] u2ValidInBufSize Length of the buffer valid to be accessed -* -* \retval TRUE operation success -* \retval FALSE operation fail -*/ -/*----------------------------------------------------------------------------*/ -BOOL -kalDevPortWrite ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_16 u2Port, - IN UINT_16 u2Len, - IN PUINT_8 pucBuf, - IN UINT_16 u2ValidInBufSize - ) -{ - P_GL_HIF_INFO_T prHifInfo = NULL; - PUINT_8 pucSrc = NULL; - int count = u2Len; - int ret = 0; - int bNum = 0; - -#if (MTK_WCN_HIF_SDIO == 0) - struct sdio_func *prSdioFunc = NULL; -#endif - - #if DBG - //printk(KERN_INFO DRV_NAME"++kalDevPortWrite++ buf:0x%p, port:0x%x, length:%d\n", pucBuf, u2Port, u2Len); - #endif - - ASSERT(prGlueInfo); - prHifInfo = &prGlueInfo->rHifInfo; - - ASSERT(pucBuf); - pucSrc = pucBuf; - - ASSERT(u2Len <= u2ValidInBufSize); - -#if (MTK_WCN_HIF_SDIO == 0) - prSdioFunc = prHifInfo->func; - ASSERT(prSdioFunc->cur_blksize > 0); - - if (!in_interrupt) { - sdio_claim_host(prSdioFunc); - } - - /* Split buffer into multiple single block to workaround hifsys */ - while (count >= prSdioFunc->cur_blksize) { - count -= prSdioFunc->cur_blksize; - bNum++; - } - if (count > 0 && bNum > 0) { - bNum++; - } - - if (bNum > 0) { // block mode - ret = sdio_writesb(prSdioFunc, u2Port, pucSrc, prSdioFunc->cur_blksize * bNum); - -#ifdef CONFIG_X86 - /* ENE workaround */ - { - int tmp; - sdio_writel(prSdioFunc, 0x0, SDIO_X86_WORKAROUND_WRITE_MCR, &tmp); - } -#endif - - } - else { // byte mode - if(count & 0x3L) { - int aligned_count = (count+3) & (~0x3L); - ret = sdio_writesb(prSdioFunc, u2Port, pucSrc, aligned_count); - } else { - ret = sdio_writesb(prSdioFunc, u2Port, pucSrc, count); - } - } - - if (!in_interrupt) { - sdio_release_host(prSdioFunc); - } -#else - /* Split buffer into multiple single block to workaround hifsys */ - while (count >= ((prGlueInfo->rHifInfo).prFuncInfo->blk_sz)) { - count -= ((prGlueInfo->rHifInfo).prFuncInfo->blk_sz); - bNum++; - } - if (count > 0 && bNum > 0) { - bNum++; - } - - if (bNum > 0) { // block mode - ret = mtk_wcn_hif_sdio_write_buf(prGlueInfo->rHifInfo.cltCtx, u2Port, (PUINT32) pucSrc, - ((prGlueInfo->rHifInfo).prFuncInfo->blk_sz) * bNum); - } - else { // byte mode - ret = mtk_wcn_hif_sdio_write_buf(prGlueInfo->rHifInfo.cltCtx, u2Port, (PUINT32) pucSrc, count); - } -#endif - - if (ret) { - kalSendAeeWarning(HIF_SDIO_ERR_TITLE_STR, HIF_SDIO_ERR_DESC_STR "sdio_writesb() reports error: %x", ret); - DBGLOG(HAL, ERROR, ("sdio_writesb() reports error: %x", ret)); - } - - return (ret) ? FALSE : TRUE; -} /* end of kalDevPortWrite() */ - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Write device I/O port in byte with CMD52 -* -* \param[in] prGlueInfo Pointer to the GLUE_INFO_T structure. -* \param[in] u4Addr I/O port offset -* \param[in] ucData Single byte of data to be written -* -* \retval TRUE operation success -* \retval FALSE operation fail -*/ -/*----------------------------------------------------------------------------*/ -BOOL -kalDevWriteWithSdioCmd52 ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Addr, - IN UINT_8 ucData - ) -{ - int ret = 0; - -#if (MTK_WCN_HIF_SDIO == 0) - if (!in_interrupt) { - sdio_claim_host(prGlueInfo->rHifInfo.func); - } - - sdio_writeb(prGlueInfo->rHifInfo.func, ucData, u4Addr, &ret); - - if (!in_interrupt) { - sdio_release_host(prGlueInfo->rHifInfo.func); - } -#else - ret = mtk_wcn_hif_sdio_writeb(prGlueInfo->rHifInfo.cltCtx, u4Addr, ucData); -#endif - - if (ret) { - kalSendAeeWarning(HIF_SDIO_ERR_TITLE_STR, HIF_SDIO_ERR_DESC_STR "sdio_writeb() reports error: %x", ret); - DBGLOG(HAL, ERROR, ("sdio_writeb() reports error: %x", ret)); - } - - return (ret) ? FALSE : TRUE; - -} /* end of kalDevWriteWithSdioCmd52() */ - - -VOID -glSetPowerState ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 ePowerMode - ) -{ - return; -} - diff --git a/drivers/net/wireless/mt5931/os/linux/hif/sdio/x86.c b/drivers/net/wireless/mt5931/os/linux/hif/sdio/x86.c deleted file mode 100755 index 4322fa303a71..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/hif/sdio/x86.c +++ /dev/null @@ -1,33 +0,0 @@ -/****************************************************************************** -*[File] mt6516-evb.c -*[Version] v1.0 -*[Revision Date] 2010-03-01 -*[Author] -*[Description] -* dummy file for build system -*[Copyright] -* Copyright (C) 2010 MediaTek Incorporation. All Rights Reserved. -******************************************************************************/ - - - -/* -** $Log: mt6516-evb.c $ - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 04 19 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * remove debug message - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port -** -*/ diff --git a/drivers/net/wireless/mt5931/os/linux/include/gl_cfg80211.h b/drivers/net/wireless/mt5931/os/linux/include/gl_cfg80211.h deleted file mode 100755 index 15db319c0deb..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/include/gl_cfg80211.h +++ /dev/null @@ -1,319 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/include/gl_cfg80211.h#1 $ -*/ - -/*! \file gl_cfg80211.h - \brief This file is for Portable Driver linux cfg80211 support. -*/ - -/******************************************************************************* -* Copyright (c) 2007 MediaTek Inc. -* -* All rights reserved. Copying, compilation, modification, distribution -* or any other use whatsoever of this material is strictly prohibited -* except in accordance with a Software License Agreement with -* MediaTek Inc. -******************************************************************************** -*/ - -/******************************************************************************* -* LEGAL DISCLAIMER -* -* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND -* AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK -* SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE -* PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY -* DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT -* LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -* PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE -* ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY -* WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK -* SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY -* WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE -* FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO -* CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. -* -* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE -* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL -* BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT -* ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY -* BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. -* -* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE -* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT -* OF LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING -* THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN -* FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE -* (ICC). -******************************************************************************** -*/ - -/* -** $Log: gl_cfg80211.h $ -** -** 08 29 2012 chinglan.wang -** [ALPS00349655] [Need Patch] [Volunteer Patch] [ALPS.JB] Daily build warning on [mt6575_phone_mhl-eng] -** . - * -*/ - -#ifndef _GL_CFG80211_H -#define _GL_CFG80211_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include -#include -#include -#include -#include - -#include "gl_os.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/* cfg80211 hooks */ -int -mtk_cfg80211_change_iface ( - struct wiphy *wiphy, - struct net_device *ndev, - enum nl80211_iftype type, - u32 *flags, - struct vif_params *params - ); - - -int -mtk_cfg80211_add_key ( - struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, - bool pairwise, - const u8 *mac_addr, - struct key_params *params - ); - - -int -mtk_cfg80211_get_key ( - struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, - bool pairwise, - const u8 *mac_addr, - void *cookie, - void (*callback)(void *cookie, struct key_params*) - ); - - -int -mtk_cfg80211_del_key ( - struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, - bool pairwise, - const u8 *mac_addr - ); - - -int -mtk_cfg80211_set_default_key ( - struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, - bool unicast, - bool multicast - ); - - -int -mtk_cfg80211_get_station ( - struct wiphy *wiphy, - struct net_device *ndev, - u8 *mac, - struct station_info *sinfo - ); - - -int -mtk_cfg80211_scan ( - struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_scan_request *request - ); - - -int -mtk_cfg80211_connect ( - struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_connect_params *sme - ); - - -int -mtk_cfg80211_disconnect ( - struct wiphy *wiphy, - struct net_device *ndev, - u16 reason_code - ); - - -int -mtk_cfg80211_join_ibss ( - struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_ibss_params *params - ); - - -int -mtk_cfg80211_leave_ibss ( - struct wiphy *wiphy, - struct net_device *ndev - ); - - -int -mtk_cfg80211_set_power_mgmt ( - struct wiphy *wiphy, - struct net_device *ndev, - bool enabled, - int timeout - ); - - -int -mtk_cfg80211_set_pmksa ( - struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_pmksa *pmksa - ); - - -int -mtk_cfg80211_del_pmksa ( - struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_pmksa *pmksa - ); - - -int -mtk_cfg80211_flush_pmksa ( - struct wiphy *wiphy, - struct net_device *ndev - ); - - -int -mtk_cfg80211_remain_on_channel ( - struct wiphy *wiphy, - struct net_device *ndev, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - unsigned int duration, - u64 *cookie - ); - - -int -mtk_cfg80211_cancel_remain_on_channel ( - struct wiphy *wiphy, - struct net_device *ndev, - u64 cookie - ); - - -int -mtk_cfg80211_mgmt_tx ( - struct wiphy *wiphy, - struct net_device *ndev, - struct ieee80211_channel *channel, - bool offscan, - enum nl80211_channel_type channel_type, - bool channel_type_valid, - unsigned int wait, - const u8 *buf, - size_t len, - bool no_cck, - bool dont_wait_for_ack, - u64 *cookie - ); - - -int -mtk_cfg80211_mgmt_tx_cancel_wait ( - struct wiphy *wiphy, - struct net_device *ndev, - u64 cookie - ); - -#if CONFIG_NL80211_TESTMODE -int -mtk_cfg80211_testmode_cmd( - IN struct wiphy *wiphy, - IN void *data, - IN int len - ); - -int -mtk_cfg80211_testmode_sw_cmd( - IN struct wiphy *wiphy, - IN void *data, - IN int len - ); -#if CFG_SUPPORT_WAPI -int -mtk_cfg80211_testmode_set_key_ext( - IN struct wiphy *wiphy, - IN void *data, - IN int len - ); -#endif -#else - #error "Please ENABLE kernel config (CONFIG_NL80211_TESTMODE) to support Wi-Fi Direct" -#endif - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _GL_CFG80211_H */ - diff --git a/drivers/net/wireless/mt5931/os/linux/include/gl_kal.h b/drivers/net/wireless/mt5931/os/linux/include/gl_kal.h deleted file mode 100755 index 6df16d4ef1dd..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/include/gl_kal.h +++ /dev/null @@ -1,2250 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/include/gl_kal.h#1 $ -*/ - -/*! \file gl_kal.h - \brief Declaration of KAL functions - kal*() which is provided by GLUE Layer. - - Any definitions in this file will be shared among GLUE Layer and internal Driver Stack. -*/ - - - -/* -** $Log: gl_kal.h $ - * - * 06 13 2012 yuche.tsai - * NULL - * Update maintrunk driver. - * Add support for driver compose assoc request frame. - * - * 04 12 2012 terry.wu - * NULL - * Add AEE message support - * 1) Show AEE warning(red screen) if SDIO access error occurs - - * - * 03 02 2012 terry.wu - * NULL - * Snc CFG80211 modification for ICS migration from branch 2.2. - * - * 02 06 2012 wh.su - * [WCXRP00001177] [MT6620 Wi-Fi][Driver][2.2] Adding the query channel filter for AP mode - * adding the channel query filter for AP mode. - * - * 01 02 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the proto type function for set_int set_tx_power and get int get_ch_list. - * - * 12 13 2011 cm.chang - * [WCXRP00001136] [All Wi-Fi][Driver] Add wake lock for pending timer - * Add wake lock if timer timeout value is smaller than 5 seconds - * - * 11 24 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * adjust the code for Non-DBG and no XLOG. - * - * 11 22 2011 cp.wu - * [WCXRP00001120] [MT6620 Wi-Fi][Driver] Modify roaming to AIS state transition from synchronous to asynchronous approach to avoid incomplete state termination - * 1. change RDD related compile option brace position. - * 2. when roaming is triggered, ask AIS to transit immediately only when AIS is in Normal TR state without join timeout timer ticking - * 3. otherwise, insert AIS_REQUEST into pending request queue - * - * 11 11 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * modify the xlog related code. - * - * 11 10 2011 cp.wu - * [WCXRP00001098] [MT6620 Wi-Fi][Driver] Replace printk by DBG LOG macros in linux porting layer - * 1. eliminaite direct calls to printk in porting layer. - * 2. replaced by DBGLOG, which would be XLOG on ALPS platforms. - * - * 11 10 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Modify the QM xlog level and remove LOG_FUNC. - * - * 11 10 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * Using the new XLOG define for dum Memory. - * - * 11 08 2011 eddie.chen - * [WCXRP00001096] [MT6620 Wi-Fi][Driver/FW] Enhance the log function (xlog) - * Add xlog function. - * - * 11 08 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * add debug counters, eCurPsProf, for PS. - * - * 11 08 2011 cm.chang - * NULL - * Add RLM and CNM debug message for XLOG - * - * 11 07 2011 tsaiyuan.hsu - * [WCXRP00001083] [MT6620 Wi-Fi][DRV]] dump debug counter or frames when debugging is triggered - * add debug counters and periodically dump counters for debugging. - * - * 11 03 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * Add dumpMemory8 at XLOG support. - * - * 11 02 2011 wh.su - * [WCXRP00001078] [MT6620 Wi-Fi][Driver] Adding the mediatek log improment support : XLOG - * adding the code for XLOG. - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 04 12 2011 cp.wu - * [WCXRP00000635] [MT6620 Wi-Fi][Driver] Clear pending security frames when QM clear pending data frames for dedicated network type - * include link.h for linux's port. - * - * 04 12 2011 cp.wu - * [WCXRP00000635] [MT6620 Wi-Fi][Driver] Clear pending security frames when QM clear pending data frames for dedicated network type - * clear pending security frames for dedicated network type when BSS is being deactivated/disconnected - * - * 04 01 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * 1. simplify config.h due to aggregation options could be also applied for eHPI/SPI interface - * 2. use spin-lock instead of semaphore for protecting eHPI access because of possible access from ISR - * 3. request_irq() API has some changes between linux kernel 2.6.12 and 2.6.26 - * - * 03 16 2011 cp.wu - * [WCXRP00000562] [MT6620 Wi-Fi][Driver] I/O buffer pre-allocation to avoid physically continuous memory shortage after system running for a long period - * 1. pre-allocate physical continuous buffer while module is being loaded - * 2. use pre-allocated physical continuous buffer for TX/RX DMA transfer - * - * The windows part remained the same as before, but added similiar APIs to hide the difference. - * - * 03 10 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Add BOW table. - * - * 03 07 2011 terry.wu - * [WCXRP00000521] [MT6620 Wi-Fi][Driver] Remove non-standard debug message - * Toggle non-standard debug messages to comments. - * - * 03 06 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Sync BOW Driver to latest person development branch version.. - * - * 03 02 2011 cp.wu - * [WCXRP00000503] [MT6620 Wi-Fi][Driver] Take RCPI brought by association response as initial RSSI right after connection is built. - * use RCPI brought by ASSOC-RESP after connection is built as initial RCPI to avoid using a uninitialized MAC-RX RCPI. - * - * 02 24 2011 cp.wu - * [WCXRP00000490] [MT6620 Wi-Fi][Driver][Win32] modify kalMsleep() implementation because NdisMSleep() won't sleep long enough for specified interval such as 500ms - * modify cnm_timer and hem_mbox APIs to be thread safe to ease invoking restrictions - * - * 01 12 2011 cp.wu - * [WCXRP00000357] [MT6620 Wi-Fi][Driver][Bluetooth over Wi-Fi] add another net device interface for BT AMP - * implementation of separate BT_OVER_WIFI data path. - * - * 01 04 2011 cp.wu - * [WCXRP00000338] [MT6620 Wi-Fi][Driver] Separate kalMemAlloc into kmalloc and vmalloc implementations to ease physically continous memory demands - * separate kalMemAlloc() into virtually-continous and physically-continous type to ease slab system pressure - * - * 12 31 2010 cp.wu - * [WCXRP00000335] [MT6620 Wi-Fi][Driver] change to use milliseconds sleep instead of delay to avoid blocking to system scheduling - * change to use msleep() and shorten waiting interval to reduce blocking to other task while Wi-Fi driver is being loaded - * - * 12 31 2010 jeffrey.chang - * [WCXRP00000332] [MT6620 Wi-Fi][Driver] add kal sleep function for delay which use blocking call - * modify the implementation of kalDelay to msleep - * - * 12 22 2010 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * 1. header file restructure for more clear module isolation - * 2. add function interface definition for implementing Service Discovery callbacks - * - * 11 30 2010 yuche.tsai - * NULL - * Invitation & Provision Discovery Indication. - * - * 11 26 2010 cp.wu - * [WCXRP00000209] [MT6620 Wi-Fi][Driver] Modify NVRAM checking mechanism to warning only with necessary data field checking - * 1. NVRAM error is now treated as warning only, thus normal operation is still available but extra scan result used to indicate user is attached - * 2. DPD and TX-PWR are needed fields from now on, if these 2 fields are not availble then warning message is shown - * - * 11 08 2010 cp.wu - * [WCXRP00000166] [MT6620 Wi-Fi][Driver] use SDIO CMD52 for enabling/disabling interrupt to reduce transaction period - * change to use CMD52 for enabling/disabling interrupt to reduce SDIO transaction time - * - * 11 01 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module - * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead - * 2) Remove CNM CH-RECOVER event handling - * 3) cfg read/write API renamed with kal prefix for unified naming rules. - * - * 10 05 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * 1) add NVRAM access API - * 2) fake scanning result when NVRAM doesn't exist and/or version mismatch. (off by compiler option) - * 3) add OID implementation for NVRAM read/write service - * - * 10 04 2010 wh.su - * [WCXRP00000081] [MT6620][Driver] Fix the compiling error at WinXP while enable P2P - * add a kal function for set cipher. - * - * 10 04 2010 wh.su - * [WCXRP00000081] [MT6620][Driver] Fix the compiling error at WinXP while enable P2P - * fixed compiling error while enable p2p. - * - * 09 28 2010 wh.su - * NULL - * [WCXRP00000069][MT6620 Wi-Fi][Driver] Fix some code for phase 1 P2P Demo. - * - * 09 21 2010 cp.wu - * [WCXRP00000053] [MT6620 Wi-Fi][Driver] Reset incomplete and might leads to BSOD when entering RF test with AIS associated - * Do a complete reset with STA-REC null checking for RF test re-entry - * - * 09 21 2010 kevin.huang - * [WCXRP00000052] [MT6620 Wi-Fi][Driver] Eliminate Linux Compile Warning - * Eliminate Linux Compile Warning - * - * 09 10 2010 wh.su - * NULL - * fixed the compiling error at win XP. - * - * 09 07 2010 wh.su - * NULL - * adding the code for beacon/probe req/ probe rsp wsc ie at p2p. - * - * 09 06 2010 wh.su - * NULL - * let the p2p can set the privacy bit at beacon and rsn ie at assoc req at key handshake state. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 08 06 2010 cp.wu - * NULL - * driver hook modifications corresponding to ioctl interface change. - * - * 08 03 2010 cp.wu - * NULL - * [Wi-Fi Direct Driver Hook] change event indication API to be consistent with supplicant - * - * 08 03 2010 cp.wu - * NULL - * [Wi-Fi Direct] add framework for driver hooks - * - * 08 02 2010 jeffrey.chang - * NULL - * modify kalSetEvent declaration - * - * 07 29 2010 cp.wu - * NULL - * simplify post-handling after TX_DONE interrupt is handled. - * - * 07 23 2010 cp.wu - * - * 1) re-enable AIS-FSM beacon timeout handling. - * 2) scan done API revised - * - * 07 23 2010 jeffrey.chang - * - * fix kal header file - * - * 07 22 2010 jeffrey.chang - * - * use different spin lock for security frame - * - * 07 22 2010 jeffrey.chang - * - * add new spinlock - * - * 07 19 2010 jeffrey.chang - * - * add kal api for scanning done - * - * 07 19 2010 jeffrey.chang - * - * modify cmd/data path for new design - * - * 07 19 2010 jeffrey.chang - * - * add new kal api - * - * 07 19 2010 jeffrey.chang - * - * Linux port modification - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 21 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * change MAC address updating logic. - * - * 06 18 2010 cm.chang - * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver - * Provide cnmMgtPktAlloc() and alloc/free function of msg/buf - * - * 06 11 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * 1) migrate assoc.c. - * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness - * 3) add configuration options for CNM_MEM and RSN modules - * 4) add data path for management frames - * 5) eliminate rPacketInfo of MSDU_INFO_T - * - * 06 07 2010 cp.wu - * [WPD00003833][MT6620 and MT5931] Driver migration - * gl_kal merged - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add basic handling framework for wireless extension ioctls. - * - * 05 11 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add ioctl for controlling p2p scan phase parameters - * - * 05 10 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * fill network type field while doing frame identification. - * - * 05 10 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * implement basic wi-fi direct framework - * - * 05 07 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add basic framework for implementating P2P driver hook. - * - * 05 07 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * modify kalMemAlloc method - * - * 04 28 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * change prefix for data structure used to communicate with 802.11 PAL - * to avoid ambiguous naming with firmware interface - * - * 04 27 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add multiple physical link support - * - * 04 27 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * follow Linux's firmware framework, and remove unused kal API - * - * 04 22 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * when acquiring driver-own, wait for up to 8 seconds. - * - * 04 22 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * - * 1) modify rx path code for supporting Wi-Fi direct - * 2) modify config.h since Linux dont need to consider retaining packet - * - * 04 21 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * add for private ioctl support - * - * 04 20 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * don't need SPIN_LOCK_PWR_CTRL anymore, it will raise IRQL - * * and cause SdBusSubmitRequest running at DISPATCH_LEVEL as well. - * - * 04 14 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * information buffer for query oid/ioctl is now buffered in prCmdInfo - * * * * * * * * instead of glue-layer variable to improve multiple oid/ioctl capability - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * * * * * * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * * * * * * * * * * * * * * * * 2) command sequence number is now increased atomically - * * * * * * * * * * * * * * * * * * * 3) private data could be hold and taken use for other purpose - * - * 04 09 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * 1) add spinlock - * * * 2) add KAPI for handling association info - * - * 04 09 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * adding firmware download KAPI - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * finish non-glue layer access to glue variables - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * accessing to firmware load/start address, and access to OID handling information - * * * * are now handled in glue layer - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * rWlanInfo should be placed at adapter rather than glue due to most operations - * * * * * * * * * are done in adapter layer. - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access to prGlueInfo->eParamMediaStateIndicated from non-glue layer - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * add KAL API: kalFlushPendingTxPackets(), and take use of the API - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access to prGlueInfo->rWlanInfo.eLinkAttr.ucMediaStreamMode from non-glue layer. - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * improve none-glue code portability - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * code refine: fgTestMode should be at adapter rather than glue due to the device/fw is also involved - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) for some OID, never do timeout expiration - * * * * 2) add 2 kal API for later integration - * - * 03 30 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * emulate NDIS Pending OID facility - * - * 03 26 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * [WPD00003826] Initial import for Linux port - * adding firmware download KAPI - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port -** \main\maintrunk.MT5921\41 2009-09-28 20:19:23 GMT mtk01090 -** Add private ioctl to carry OID structures. Restructure public/private ioctl interfaces to Linux kernel. -** \main\maintrunk.MT5921\40 2009-08-18 22:57:09 GMT mtk01090 -** Add Linux SDIO (with mmc core) support. -** Add Linux 2.6.21, 2.6.25, 2.6.26. -** Fix compile warning in Linux. -** \main\maintrunk.MT5921\39 2009-06-23 23:19:15 GMT mtk01090 -** Add build option BUILD_USE_EEPROM and compile option CFG_SUPPORT_EXT_CONFIG for NVRAM support -** \main\maintrunk.MT5921\38 2009-02-09 14:03:17 GMT mtk01090 -** Add KAL function kalDevSetPowerState(). It is not implemented yet. Only add an empty macro. -** -** \main\maintrunk.MT5921\37 2009-01-22 13:05:59 GMT mtk01088 -** new defeine to got 1x value at packet reserved field -** \main\maintrunk.MT5921\36 2008-12-08 16:15:02 GMT mtk01461 -** Add kalQueryValidBufferLength() macro -** \main\maintrunk.MT5921\35 2008-11-13 20:33:15 GMT mtk01104 -** Remove lint warning -** \main\maintrunk.MT5921\34 2008-10-22 11:05:52 GMT mtk01461 -** Remove unused macro -** \main\maintrunk.MT5921\33 2008-10-16 15:48:17 GMT mtk01461 -** Update driver to fix lint warning -** \main\maintrunk.MT5921\32 2008-09-02 11:50:51 GMT mtk01461 -** SPIN_LOCK_SDIO_DDK_TX_QUE -** \main\maintrunk.MT5921\31 2008-08-29 15:58:30 GMT mtk01088 -** remove non-used function for code refine -** \main\maintrunk.MT5921\30 2008-08-21 00:33:29 GMT mtk01461 -** Update for Driver Review -** \main\maintrunk.MT5921\29 2008-06-19 13:29:14 GMT mtk01425 -** 1. Add declaration of SPIN_LOCK_SDIO_DDK_TX_QUE and SPIN_LOCK_SDIO_DDK_RX_QUE -** \main\maintrunk.MT5921\28 2008-05-30 20:27:34 GMT mtk01461 -** Rename KAL function -** \main\maintrunk.MT5921\27 2008-05-30 14:42:05 GMT mtk01461 -** Remove WMM Assoc Flag in KAL -** \main\maintrunk.MT5921\26 2008-05-29 14:15:18 GMT mtk01084 -** remove un-used function -** \main\maintrunk.MT5921\25 2008-04-23 14:02:20 GMT mtk01084 -** modify KAL port access function prototype -** \main\maintrunk.MT5921\24 2008-04-17 23:06:41 GMT mtk01461 -** Add iwpriv support for AdHocMode setting -** \main\maintrunk.MT5921\23 2008-04-08 15:38:50 GMT mtk01084 -** add KAL function to setting pattern search function enable/ disable -** \main\maintrunk.MT5921\22 2008-03-26 15:34:48 GMT mtk01461 -** Add update MAC address func -** \main\maintrunk.MT5921\21 2008-03-18 15:56:15 GMT mtk01084 -** update ENUM_NIC_INITIAL_PARAM_E -** \main\maintrunk.MT5921\20 2008-03-18 11:49:28 GMT mtk01084 -** update function for initial value access -** \main\maintrunk.MT5921\19 2008-03-18 10:21:31 GMT mtk01088 -** use kal update associate request at linux -** \main\maintrunk.MT5921\18 2008-03-14 18:03:41 GMT mtk01084 -** refine register and port access function -** \main\maintrunk.MT5921\17 2008-03-11 14:51:02 GMT mtk01461 -** Add copy_to(from)_user macro -** \main\maintrunk.MT5921\16 2008-03-06 23:42:21 GMT mtk01385 -** 1. add Query Registry Mac address function. -** \main\maintrunk.MT5921\15 2008-02-26 09:48:04 GMT mtk01084 -** modify KAL set network address/ checksum offload part -** \main\maintrunk.MT5921\14 2008-01-09 17:54:58 GMT mtk01084 -** Modify the argument of kalQueryPacketInfo -** \main\maintrunk.MT5921\13 2007-11-29 02:05:20 GMT mtk01461 -** Fix Windows RX multiple packet retain problem -** \main\maintrunk.MT5921\12 2007-11-26 19:43:45 GMT mtk01461 -** Add OS_TIMESTAMP macro -** -** \main\maintrunk.MT5921\11 2007-11-09 16:36:15 GMT mtk01425 -** 1. Modify for CSUM offloading with Tx Fragment -** \main\maintrunk.MT5921\10 2007-11-07 18:38:37 GMT mtk01461 -** Add Tx Fragmentation Support -** \main\maintrunk.MT5921\9 2007-11-06 19:36:50 GMT mtk01088 -** add the WPS related code -** \main\maintrunk.MT5921\8 2007-11-02 01:03:57 GMT mtk01461 -** Unify TX Path for Normal and IBSS Power Save + IBSS neighbor learning -** Revision 1.4 2007/07/05 07:25:33 MTK01461 -** Add Linux initial code, modify doc, add 11BB, RF init code -** -** Revision 1.3 2007/06/27 02:18:50 MTK01461 -** Update SCAN_FSM, Initial(Can Load Module), Proc(Can do Reg R/W), TX API -** -** Revision 1.2 2007/06/25 06:16:23 MTK01461 -** Update illustrations, gl_init.c, gl_kal.c, gl_kal.h, gl_os.h and RX API -** -*/ - - -#ifndef _GL_KAL_H -#define _GL_KAL_H - - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "config.h" -#include "gl_typedef.h" -#include "gl_os.h" -#include "link.h" -#include "nic/mac.h" -#include "nic/wlan_def.h" -#include "wlan_lib.h" -#include "wlan_oid.h" -#include "gl_wext_priv.h" - - -#if CFG_ENABLE_BT_OVER_WIFI - #include "nic/bow.h" -#endif - -#if DBG -extern int allocatedMemSize; -#endif - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -//#define USEC_PER_MSEC (1000) - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef enum _ENUM_SPIN_LOCK_CATEGORY_E { - SPIN_LOCK_FSM = 0, - - /* FIX ME */ - SPIN_LOCK_RX_QUE, - SPIN_LOCK_TX_QUE, - SPIN_LOCK_CMD_QUE, - SPIN_LOCK_TX_RESOURCE, - SPIN_LOCK_CMD_RESOURCE, - SPIN_LOCK_QM_TX_QUEUE, - SPIN_LOCK_CMD_PENDING, - SPIN_LOCK_CMD_SEQ_NUM, - SPIN_LOCK_TX_MSDU_INFO_LIST, - SPIN_LOCK_TXING_MGMT_LIST, - SPIN_LOCK_TX_SEQ_NUM, - SPIN_LOCK_TX_COUNT, - SPIN_LOCK_TXS_COUNT, - /* end */ - SPIN_LOCK_TX, - SPIN_LOCK_IO_REQ, - SPIN_LOCK_INT, - - SPIN_LOCK_MGT_BUF, - SPIN_LOCK_MSG_BUF, - SPIN_LOCK_STA_REC, - - SPIN_LOCK_MAILBOX, - SPIN_LOCK_TIMER, - - SPIN_LOCK_BOW_TABLE, - - SPIN_LOCK_EHPI_BUS, /* only for EHPI */ - SPIN_LOCK_NET_DEV, - SPIN_LOCK_NUM -} ENUM_SPIN_LOCK_CATEGORY_E; - -/* event for assoc infomation update */ -typedef struct _EVENT_ASSOC_INFO { - UINT_8 ucAssocReq; /* 1 for assoc req, 0 for assoc rsp */ - UINT_8 ucReassoc; /* 0 for assoc, 1 for reassoc */ - UINT_16 u2Length; - PUINT_8 pucIe; -} EVENT_ASSOC_INFO, *P_EVENT_ASSOC_INFO; - -typedef enum _ENUM_KAL_NETWORK_TYPE_INDEX_T { - KAL_NETWORK_TYPE_AIS_INDEX = 0, -#if CFG_ENABLE_WIFI_DIRECT - KAL_NETWORK_TYPE_P2P_INDEX, -#endif -#if CFG_ENABLE_BT_OVER_WIFI - KAL_NETWORK_TYPE_BOW_INDEX, -#endif - KAL_NETWORK_TYPE_INDEX_NUM -} ENUM_KAL_NETWORK_TYPE_INDEX_T; - -typedef enum _ENUM_KAL_MEM_ALLOCATION_TYPE_E { - PHY_MEM_TYPE, /* physically continuous */ - VIR_MEM_TYPE, /* virtually continous */ - MEM_TYPE_NUM -} ENUM_KAL_MEM_ALLOCATION_TYPE; - -#if CONFIG_ANDROID /* Defined in Android kernel source */ -typedef struct wake_lock KAL_WAKE_LOCK_T, *P_KAL_WAKE_LOCK_T; -#else -typedef UINT_32 KAL_WAKE_LOCK_T, *P_KAL_WAKE_LOCK_T; -#endif - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Macros of SPIN LOCK operations for using in Driver Layer */ -/*----------------------------------------------------------------------------*/ -#define KAL_SPIN_LOCK_DECLARATION() UINT_32 __u4Flags - -#define KAL_ACQUIRE_SPIN_LOCK(_prAdapter, _rLockCategory) \ - kalAcquireSpinLock(((P_ADAPTER_T)_prAdapter)->prGlueInfo, _rLockCategory, &__u4Flags) - -#define KAL_RELEASE_SPIN_LOCK(_prAdapter, _rLockCategory) \ - kalReleaseSpinLock(((P_ADAPTER_T)_prAdapter)->prGlueInfo, _rLockCategory, __u4Flags) - -/*----------------------------------------------------------------------------*/ -/* Macros for accessing Reserved Fields of native packet */ -/*----------------------------------------------------------------------------*/ -#define KAL_GET_PKT_QUEUE_ENTRY(_p) GLUE_GET_PKT_QUEUE_ENTRY(_p) -#define KAL_GET_PKT_DESCRIPTOR(_prQueueEntry) GLUE_GET_PKT_DESCRIPTOR(_prQueueEntry) -#define KAL_GET_PKT_TID(_p) GLUE_GET_PKT_TID(_p) -#define KAL_GET_PKT_IS1X(_p) GLUE_GET_PKT_IS1X(_p) -#define KAL_GET_PKT_HEADER_LEN(_p) GLUE_GET_PKT_HEADER_LEN(_p) -#define KAL_GET_PKT_PAYLOAD_LEN(_p) GLUE_GET_PKT_PAYLOAD_LEN(_p) -#define KAL_GET_PKT_ARRIVAL_TIME(_p) GLUE_GET_PKT_ARRIVAL_TIME(_p) - -/*----------------------------------------------------------------------------*/ -/* Macros of wake_lock operations for using in Driver Layer */ -/*----------------------------------------------------------------------------*/ -#if CONFIG_ANDROID /* Defined in Android kernel source */ -#define KAL_WAKE_LOCK_INIT(_prAdapter, _prWakeLock, _pcName) \ - wake_lock_init(_prWakeLock, WAKE_LOCK_SUSPEND, _pcName) - -#define KAL_WAKE_LOCK_DESTROY(_prAdapter, _prWakeLock) \ - wake_lock_destroy(_prWakeLock) - -#define KAL_WAKE_LOCK(_prAdapter, _prWakeLock) \ - wake_lock(_prWakeLock) - -#define KAL_WAKE_LOCK_TIMEOUT(_prAdapter, _prWakeLock, _u4Timeout) \ - wake_lock_timeout(_prWakeLock, _u4Timeout) - -#define KAL_WAKE_UNLOCK(_prAdapter, _prWakeLock) \ - wake_unlock(_prWakeLock) - -#else -#define KAL_WAKE_LOCK_INIT(_prAdapter, _prWakeLock, _pcName) -#define KAL_WAKE_LOCK_DESTROY(_prAdapter, _prWakeLock) -#define KAL_WAKE_LOCK(_prAdapter, _prWakeLock) -#define KAL_WAKE_LOCK_TIMEOUT(_prAdapter, _prWakeLock, _u4Timeout) -#define KAL_WAKE_UNLOCK(_prAdapter, _prWakeLock) -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Cache memory allocation -* -* \param[in] u4Size Required memory size. -* \param[in] eMemType Memory allocation type -* -* \return Pointer to allocated memory -* or NULL -*/ -/*----------------------------------------------------------------------------*/ -#if DBG -#define kalMemAlloc(u4Size, eMemType) ({ \ - void *pvAddr; \ - if(eMemType == PHY_MEM_TYPE) { \ - pvAddr = kmalloc(u4Size, GFP_KERNEL); \ - } \ - else { \ - pvAddr = vmalloc(u4Size); \ - } \ - if (pvAddr) { \ - allocatedMemSize += u4Size; \ - printk(KERN_INFO DRV_NAME "0x%p(%ld) allocated (%s:%s)\n", \ - pvAddr, (UINT_32)u4Size, __FILE__, __FUNCTION__); \ - } \ - pvAddr; \ - }) -#else -#define kalMemAlloc(u4Size, eMemType) ({ \ - void *pvAddr; \ - if(eMemType == PHY_MEM_TYPE) { \ - pvAddr = kmalloc(u4Size, GFP_KERNEL); \ - } \ - else { \ - pvAddr = vmalloc(u4Size); \ - } \ - pvAddr; \ - }) -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Free allocated cache memory -* -* \param[in] pvAddr Required memory size. -* \param[in] eMemType Memory allocation type -* \param[in] u4Size Allocated memory size. -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -#if DBG -#define kalMemFree(pvAddr, eMemType, u4Size) \ - { \ - if (pvAddr) { \ - allocatedMemSize -= u4Size; \ - printk(KERN_INFO DRV_NAME "0x%p(%ld) freed (%s:%s)\n", \ - pvAddr, (UINT_32)u4Size, __FILE__, __FUNCTION__); \ - } \ - if(eMemType == PHY_MEM_TYPE) { \ - kfree(pvAddr); \ - } \ - else { \ - vfree(pvAddr); \ - } \ - } -#else -#define kalMemFree(pvAddr, eMemType, u4Size) \ - { \ - if(eMemType == PHY_MEM_TYPE) { \ - kfree(pvAddr); \ - } \ - else { \ - vfree(pvAddr); \ - } \ - } -#endif - -#define kalUdelay(u4USec) udelay(u4USec) - -#define kalMdelay(u4MSec) mdelay(u4MSec) -#define kalMsleep(u4MSec) msleep(u4MSec) - -/* Copy memory from user space to kernel space */ -#define kalMemCopyFromUser(_pvTo, _pvFrom, _u4N) copy_from_user(_pvTo, _pvFrom, _u4N) - -/* Copy memory from kernel space to user space */ -#define kalMemCopyToUser(_pvTo, _pvFrom, _u4N) copy_to_user(_pvTo, _pvFrom, _u4N) - -/* Copy memory block with specific size */ -#define kalMemCopy(pvDst, pvSrc, u4Size) memcpy(pvDst, pvSrc, u4Size) - -/* Set memory block with specific pattern */ -#define kalMemSet(pvAddr, ucPattern, u4Size) memset(pvAddr, ucPattern, u4Size) - -/* Compare two memory block with specific length. - * Return zero if they are the same. - */ -#define kalMemCmp(pvAddr1, pvAddr2, u4Size) memcmp(pvAddr1, pvAddr2, u4Size) - -/* Zero specific memory block */ -#define kalMemZero(pvAddr, u4Size) memset(pvAddr, 0, u4Size) - -/* defined for wince sdio driver only */ -#if defined(_HIF_SDIO) -#define kalDevSetPowerState(prGlueInfo, ePowerMode) glSetPowerState(prGlueInfo, ePowerMode) -#else -#define kalDevSetPowerState(prGlueInfo, ePowerMode) -#endif - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Notify OS with SendComplete event of the specific packet. Linux should -* free packets here. -* -* \param[in] prGlueInfo Pointer of GLUE Data Structure -* \param[in] pvPacket Pointer of Packet Handle -* \param[in] status Status Code for OS upper layer -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -#define kalSendComplete(prGlueInfo, pvPacket, status) \ - kalSendCompleteAndAwakeQueue(prGlueInfo, pvPacket) - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is used to locate the starting address of incoming ethernet -* frame for skb. -* -* \param[in] prGlueInfo Pointer of GLUE Data Structure -* \param[in] pvPacket Pointer of Packet Handle -* -* \return starting address of ethernet frame buffer. -*/ -/*----------------------------------------------------------------------------*/ -#define kalQueryBufferPointer(prGlueInfo, pvPacket) \ - ((PUINT_8)((struct sk_buff *)pvPacket)->data) - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is used to query the length of valid buffer which is accessible during -* port read/write. -* -* \param[in] prGlueInfo Pointer of GLUE Data Structure -* \param[in] pvPacket Pointer of Packet Handle -* -* \return starting address of ethernet frame buffer. -*/ -/*----------------------------------------------------------------------------*/ -#define kalQueryValidBufferLength(prGlueInfo, pvPacket) \ - ((UINT_32)((struct sk_buff *)pvPacket)->end - \ - (UINT_32)((struct sk_buff *)pvPacket)->data) - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function is used to copy the entire frame from skb to the destination -* address in the input parameter. -* -* \param[in] prGlueInfo Pointer of GLUE Data Structure -* \param[in] pvPacket Pointer of Packet Handle -* \param[in] pucDestBuffer Destination Address -* -* \return - -*/ -/*----------------------------------------------------------------------------*/ -#define kalCopyFrame(prGlueInfo, pvPacket, pucDestBuffer) \ - {struct sk_buff *skb = (struct sk_buff *)pvPacket; \ - memcpy(pucDestBuffer, skb->data, skb->len);} - -#define kalGetTimeTick() jiffies_to_msecs(jiffies) - -#define kalPrint printk - -#if !DBG -#if CFG_SUPPORT_XLOG -#define XLOG_TAG "wlan" - -#define XLOG_FUNC(__LEVEL, __FMT...)\ - if (__LEVEL == ANDROID_LOG_ERROR) {\ - xlog_printk(ANDROID_LOG_ERROR, XLOG_TAG, ##__FMT);\ - } \ - else if (__LEVEL == ANDROID_LOG_WARN) {\ - xlog_printk(ANDROID_LOG_WARN, XLOG_TAG, ##__FMT);\ - } \ - else if (__LEVEL == ANDROID_LOG_INFO) {\ - xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, ##__FMT);\ - } \ - else if (__LEVEL == ANDROID_LOG_DEBUG) {\ - xlog_printk(ANDROID_LOG_DEBUG, XLOG_TAG, ##__FMT);\ - } \ - else if (__LEVEL == ANDROID_LOG_VERBOSE) {\ - xlog_printk(ANDROID_LOG_VERBOSE, XLOG_TAG, ##__FMT);\ - } - -#define AIS_ERROR_LOGFUNC(_Fmt...) -#define AIS_WARN_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_WARN, XLOG_TAG, _Fmt) -#define AIS_INFO_LOGFUNC(_Fmt...) -#define AIS_STATE_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define AIS_EVENT_LOGFUNC(_Fmt...) -#define AIS_TRACE_LOGFUNC(_Fmt...) -#define AIS_LOUD_LOGFUNC(_Fmt...) -#define AIS_TEMP_LOGFUNC(_Fmt...) - -#define AIS_ERROR_LOGDUMP8(x, y) -#define AIS_WARN_LOGDUMP8(x, y) -#define AIS_INFO_LOGDUMP8(x, y) -#define AIS_STATE_LOGDUMP8(x, y) -#define AIS_EVENT_LOGDUMP8(x, y) -#define AIS_TRACE_LOGDUMP8(x, y) -#define AIS_LOUD_LOGDUMP8(x, y) -#define AIS_TEMP_LOGDUMP8(x, y) - -#define INTR_ERROR_LOGFUNC(_Fmt...) -#define INTR_WARN_LOGFUNC(_Fmt...) -#define INTR_INFO_LOGFUNC(_Fmt...) -#define INTR_STATE_LOGFUNC(_Fmt...) -#define INTR_EVENT_LOGFUNC(_Fmt...) -#define INTR_TRACE_LOGFUNC(_Fmt...) -#define INTR_LOUD_LOGFUNC(_Fmt...) -#define INTR_TEMP_LOGFUNC(_Fmt...) - -#define INTR_ERROR_LOGDUMP8(x, y) -#define INTR_WARN_LOGDUMP8(x, y) -#define INTR_INFO_LOGDUMP8(x, y) -#define INTR_STATE_LOGDUMP8(x, y) -#define INTR_EVENT_LOGDUMP8(x, y) -#define INTR_TRACE_LOGDUMP8(x, y) -#define INTR_LOUD_LOGDUMP8(x, y) -#define INTR_TEMP_LOGDUMP8(x, y) - -#define INIT_ERROR_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_ERROR, XLOG_TAG, _Fmt) -#define INIT_WARN_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_WARN, XLOG_TAG, _Fmt) -#define INIT_INFO_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define INIT_STATE_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define INIT_EVENT_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define INIT_TRACE_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_DEBUG, XLOG_TAG, _Fmt) -#define INIT_LOUD_LOGFUNC(_Fmt...) -#define INIT_TEMP_LOGFUNC(_Fmt...) - -#define INIT_ERROR_LOGDUMP8(x, y) -#define INIT_WARN_LOGDUMP8(x, y) -#define INIT_INFO_LOGDUMP8(x, y) -#define INIT_STATE_LOGDUMP8(x, y) -#define INIT_EVENT_LOGDUMP8(x, y) -#define INIT_TRACE_LOGDUMP8(x, y) -#define INIT_LOUD_LOGDUMP8(x, y) -#define INIT_TEMP_LOGDUMP8(x, y) - -#define AAA_ERROR_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_ERROR, XLOG_TAG, _Fmt) -#define AAA_WARN_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_WARN, XLOG_TAG, _Fmt) -#define AAA_INFO_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define AAA_STATE_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define AAA_EVENT_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define AAA_TRACE_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_DEBUG, XLOG_TAG, _Fmt) -#define AAA_LOUD_LOGFUNC(_Fmt...) -#define AAA_TEMP_LOGFUNC(_Fmt...) - -#define AAA_ERROR_LOGDUMP8(x, y) -#define AAA_WARN_LOGDUMP8(x, y) -#define AAA_INFO_LOGDUMP8(x, y) -#define AAA_STATE_LOGDUMP8(x, y) -#define AAA_EVENT_LOGDUMP8(x, y) -#define AAA_TRACE_LOGDUMP8(x, y) -#define AAA_LOUD_LOGDUMP8(x, y) -#define AAA_TEMP_LOGDUMP8(x, y) - -#define ROAMING_ERROR_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_ERROR, XLOG_TAG, _Fmt) -#define ROAMING_WARN_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_WARN, XLOG_TAG, _Fmt) -#define ROAMING_INFO_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define ROAMING_STATE_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define ROAMING_EVENT_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define ROAMING_TRACE_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_DEBUG, XLOG_TAG, _Fmt) -#define ROAMING_LOUD_LOGFUNC(_Fmt...) -#define ROAMING_TEMP_LOGFUNC(_Fmt...) - -#define ROAMING_ERROR_LOGDUMP8(x, y) -#define ROAMING_WARN_LOGDUMP8(x, y) -#define ROAMING_INFO_LOGDUMP8(x, y) -#define ROAMING_STATE_LOGDUMP8(x, y) -#define ROAMING_EVENT_LOGDUMP8(x, y) -#define ROAMING_TRACE_LOGDUMP8(x, y) -#define ROAMING_LOUD_LOGDUMP8(x, y) -#define ROAMING_TEMP_LOGDUMP8(x, y) - -#define REQ_ERROR_LOGFUNC(_Fmt...) -#define REQ_WARN_LOGFUNC(_Fmt...) -#define REQ_INFO_LOGFUNC(_Fmt...) -#define REQ_STATE_LOGFUNC(_Fmt...) -#define REQ_EVENT_LOGFUNC(_Fmt...) -#define REQ_TRACE_LOGFUNC(_Fmt...) -#define REQ_LOUD_LOGFUNC(_Fmt...) -#define REQ_TEMP_LOGFUNC(_Fmt...) - -#define REQ_ERROR_LOGDUMP8(x, y) -#define REQ_WARN_LOGDUMP8(x, y) -#define REQ_INFO_LOGDUMP8(x, y) -#define REQ_STATE_LOGDUMP8(x, y) -#define REQ_EVENT_LOGDUMP8(x, y) -#define REQ_TRACE_LOGDUMP8(x, y) -#define REQ_LOUD_LOGDUMP8(x, y) -#define REQ_TEMP_LOGDUMP8(x, y) - -#define TX_ERROR_LOGFUNC(_Fmt...) -#define TX_WARN_LOGFUNC(_Fmt...) -#define TX_INFO_LOGFUNC(_Fmt...) -#define TX_STATE_LOGFUNC(_Fmt...) -#define TX_EVENT_LOGFUNC(_Fmt...) -#define TX_TRACE_LOGFUNC(_Fmt...) -#define TX_LOUD_LOGFUNC(_Fmt...) -#define TX_TEMP_LOGFUNC(_Fmt...) - -#define TX_ERROR_LOGDUMP8(x, y) -#define TX_WARN_LOGDUMP8(x, y) -#define TX_INFO_LOGDUMP8(x, y) -#define TX_STATE_LOGDUMP8(x, y) -#define TX_EVENT_LOGDUMP8(x, y) -#define TX_TRACE_LOGDUMP8(x, y) -#define TX_LOUD_LOGDUMP8(x, y) -#define TX_TEMP_LOGDUMP8(x, y) - -#define RX_ERROR_LOGFUNC(_Fmt...) -#define RX_WARN_LOGFUNC(_Fmt...) -#define RX_INFO_LOGFUNC(_Fmt...) -#define RX_STATE_LOGFUNC(_Fmt...) -#define RX_EVENT_LOGFUNC(_Fmt...) -#define RX_TRACE_LOGFUNC(_Fmt...) -#define RX_LOUD_LOGFUNC(_Fmt...) -#define RX_TEMP_LOGFUNC(_Fmt...) - -#define RX_ERROR_LOGDUMP8(x, y) -#define RX_WARN_LOGDUMP8(x, y) -#define RX_INFO_LOGDUMP8(x, y) -#define RX_STATE_LOGDUMP8(x, y) -#define RX_EVENT_LOGDUMP8(x, y) -#define RX_TRACE_LOGDUMP8(x, y) -#define RX_LOUD_LOGDUMP8(x, y) -#define RX_TEMP_LOGDUMP8(x, y) - -#define RFTEST_ERROR_LOGFUNC(_Fmt...) -#define RFTEST_WARN_LOGFUNC(_Fmt...) -#define RFTEST_INFO_LOGFUNC(_Fmt...) -#define RFTEST_STATE_LOGFUNC(_Fmt...) -#define RFTEST_EVENT_LOGFUNC(_Fmt...) -#define RFTEST_TRACE_LOGFUNC(_Fmt...) -#define RFTEST_LOUD_LOGFUNC(_Fmt...) -#define RFTEST_TEMP_LOGFUNC(_Fmt...) - -#define RFTEST_ERROR_LOGDUMP8(x, y) -#define RFTEST_WARN_LOGDUMP8(x, y) -#define RFTEST_INFO_LOGDUMP8(x, y) -#define RFTEST_STATE_LOGDUMP8(x, y) -#define RFTEST_EVENT_LOGDUMP8(x, y) -#define RFTEST_TRACE_LOGDUMP8(x, y) -#define RFTEST_LOUD_LOGDUMP8(x, y) -#define RFTEST_TEMP_LOGDUMP8(x, y) - -#define EMU_ERROR_LOGFUNC(_Fmt...) -#define EMU_WARN_LOGFUNC(_Fmt...) -#define EMU_INFO_LOGFUNC(_Fmt...) -#define EMU_STATE_LOGFUNC(_Fmt...) -#define EMU_EVENT_LOGFUNC(_Fmt...) -#define EMU_TRACE_LOGFUNC(_Fmt...) -#define EMU_LOUD_LOGFUNC(_Fmt...) -#define EMU_TEMP_LOGFUNC(_Fmt...) - -#define EMU_ERROR_LOGDUMP8(x, y) -#define EMU_WARN_LOGDUMP8(x, y) -#define EMU_INFO_LOGDUMP8(x, y) -#define EMU_STATE_LOGDUMP8(x, y) -#define EMU_EVENT_LOGDUMP8(x, y) -#define EMU_TRACE_LOGDUMP8(x, y) -#define EMU_LOUD_LOGDUMP8(x, y) -#define EMU_TEMP_LOGDUMP8(x, y) - -#define HEM_ERROR_LOGFUNC(_Fmt...) -#define HEM_WARN_LOGFUNC(_Fmt...) -#define HEM_INFO_LOGFUNC(_Fmt...) -#define HEM_STATE_LOGFUNC(_Fmt...) -#define HEM_EVENT_LOGFUNC(_Fmt...) -#define HEM_TRACE_LOGFUNC(_Fmt...) -#define HEM_LOUD_LOGFUNC(_Fmt...) -#define HEM_TEMP_LOGFUNC(_Fmt...) - -#define HEM_ERROR_LOGDUMP8(x, y) -#define HEM_WARN_LOGDUMP8(x, y) -#define HEM_INFO_LOGDUMP8(x, y) -#define HEM_STATE_LOGDUMP8(x, y) -#define HEM_EVENT_LOGDUMP8(x, y) -#define HEM_TRACE_LOGDUMP8(x, y) -#define HEM_LOUD_LOGDUMP8(x, y) -#define HEM_TEMP_LOGDUMP8(x, y) - -#define RLM_ERROR_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_ERROR, XLOG_TAG, _Fmt) -#define RLM_WARN_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_WARN, XLOG_TAG, _Fmt) -#define RLM_INFO_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define RLM_STATE_LOGFUNC(_Fmt...) -#define RLM_EVENT_LOGFUNC(_Fmt...) -#define RLM_TRACE_LOGFUNC(_Fmt...) -#define RLM_LOUD_LOGFUNC(_Fmt...) -#define RLM_TEMP_LOGFUNC(_Fmt...) - -#define RLM_ERROR_LOGDUMP8(x, y) -#define RLM_WARN_LOGDUMP8(x, y) -#define RLM_INFO_LOGDUMP8(x, y) -#define RLM_STATE_LOGDUMP8(x, y) -#define RLM_EVENT_LOGDUMP8(x, y) -#define RLM_TRACE_LOGDUMP8(x, y) -#define RLM_LOUD_LOGDUMP8(x, y) -#define RLM_TEMP_LOGDUMP8(x, y) - -#define MEM_ERROR_LOGFUNC(_Fmt...) -#define MEM_WARN_LOGFUNC(_Fmt...) -#define MEM_INFO_LOGFUNC(_Fmt...) -#define MEM_STATE_LOGFUNC(_Fmt...) -#define MEM_EVENT_LOGFUNC(_Fmt...) -#define MEM_TRACE_LOGFUNC(_Fmt...) -#define MEM_LOUD_LOGFUNC(_Fmt...) -#define MEM_TEMP_LOGFUNC(_Fmt...) - -#define MEM_ERROR_LOGDUMP8(x, y) -#define MEM_WARN_LOGDUMP8(x, y) -#define MEM_INFO_LOGDUMP8(x, y) -#define MEM_STATE_LOGDUMP8(x, y) -#define MEM_EVENT_LOGDUMP8(x, y) -#define MEM_TRACE_LOGDUMP8(x, y) -#define MEM_LOUD_LOGDUMP8(x, y) -#define MEM_TEMP_LOGDUMP8(x, y) - -#define CNM_ERROR_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_ERROR, XLOG_TAG, _Fmt) -#define CNM_WARN_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_WARN, XLOG_TAG, _Fmt) -#define CNM_INFO_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define CNM_STATE_LOGFUNC(_Fmt...) -#define CNM_EVENT_LOGFUNC(_Fmt...) -#define CNM_TRACE_LOGFUNC(_Fmt...) -#define CNM_LOUD_LOGFUNC(_Fmt...) -#define CNM_TEMP_LOGFUNC(_Fmt...) - -#define CNM_ERROR_LOGDUMP8(x, y) -#define CNM_WARN_LOGDUMP8(x, y) -#define CNM_INFO_LOGDUMP8(x, y) -#define CNM_STATE_LOGDUMP8(x, y) -#define CNM_EVENT_LOGDUMP8(x, y) -#define CNM_TRACE_LOGDUMP8(x, y) -#define CNM_LOUD_LOGDUMP8(x, y) -#define CNM_TEMP_LOGDUMP8(x, y) - -#define RSN_ERROR_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_ERROR, XLOG_TAG, _Fmt) -#define RSN_WARN_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_WARN, XLOG_TAG, _Fmt) -#define RSN_INFO_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define RSN_STATE_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define RSN_EVENT_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define RSN_TRACE_LOGFUNC(_Fmt...) -#define RSN_LOUD_LOGFUNC(_Fmt...) -#define RSN_TEMP_LOGFUNC(_Fmt...) - -#define RSN_ERROR_LOGDUMP8(x, y) -#define RSN_WARN_LOGDUMP8(x, y) -#define RSN_INFO_LOGDUMP8(x, y) -#define RSN_STATE_LOGDUMP8(x, y) -#define RSN_EVENT_LOGDUMP8(x, y) -#define RSN_TRACE_LOGDUMP8(x, y) -#define RSN_LOUD_LOGDUMP8(x, y) -#define RSN_TEMP_LOGDUMP8(x, y) - -#define BSS_ERROR_LOGFUNC(_Fmt...) -#define BSS_WARN_LOGFUNC(_Fmt...) -#define BSS_INFO_LOGFUNC(_Fmt...) -#define BSS_STATE_LOGFUNC(_Fmt...) -#define BSS_EVENT_LOGFUNC(_Fmt...) -#define BSS_TRACE_LOGFUNC(_Fmt...) -#define BSS_LOUD_LOGFUNC(_Fmt...) -#define BSS_TEMP_LOGFUNC(_Fmt...) - -#define BSS_ERROR_LOGDUMP8(x, y) -#define BSS_WARN_LOGDUMP8(x, y) -#define BSS_INFO_LOGDUMP8(x, y) -#define BSS_STATE_LOGDUMP8(x, y) -#define BSS_EVENT_LOGDUMP8(x, y) -#define BSS_TRACE_LOGDUMP8(x, y) -#define BSS_LOUD_LOGDUMP8(x, y) -#define BSS_TEMP_LOGDUMP8(x, y) - -#define SCN_ERROR_LOGFUNC(_Fmt...) -#define SCN_WARN_LOGFUNC(_Fmt...) -#define SCN_INFO_LOGFUNC(_Fmt...) -#define SCN_STATE_LOGFUNC(_Fmt...) -#define SCN_EVENT_LOGFUNC(_Fmt...) -#define SCN_TRACE_LOGFUNC(_Fmt...) -#define SCN_LOUD_LOGFUNC(_Fmt...) -#define SCN_TEMP_LOGFUNC(_Fmt...) - -#define SCN_ERROR_LOGDUMP8(x, y) -#define SCN_WARN_LOGDUMP8(x, y) -#define SCN_INFO_LOGDUMP8(x, y) -#define SCN_STATE_LOGDUMP8(x, y) -#define SCN_EVENT_LOGDUMP8(x, y) -#define SCN_TRACE_LOGDUMP8(x, y) -#define SCN_LOUD_LOGDUMP8(x, y) -#define SCN_TEMP_LOGDUMP8(x, y) - -#define SAA_ERROR_LOGFUNC(_Fmt...) -#define SAA_WARN_LOGFUNC(_Fmt...) -#define SAA_INFO_LOGFUNC(_Fmt...) -#define SAA_STATE_LOGFUNC(_Fmt...) -#define SAA_EVENT_LOGFUNC(_Fmt...) -#define SAA_TRACE_LOGFUNC(_Fmt...) -#define SAA_LOUD_LOGFUNC(_Fmt...) -#define SAA_TEMP_LOGFUNC(_Fmt...) - -#define SAA_ERROR_LOGDUMP8(x, y) -#define SAA_WARN_LOGDUMP8(x, y) -#define SAA_INFO_LOGDUMP8(x, y) -#define SAA_STATE_LOGDUMP8(x, y) -#define SAA_EVENT_LOGDUMP8(x, y) -#define SAA_TRACE_LOGDUMP8(x, y) -#define SAA_LOUD_LOGDUMP8(x, y) -#define SAA_TEMP_LOGDUMP8(x, y) - -#define P2P_ERROR_LOGFUNC(_Fmt...) -#define P2P_WARN_LOGFUNC(_Fmt...) -#define P2P_INFO_LOGFUNC(_Fmt...) -#define P2P_STATE_LOGFUNC(_Fmt...) -#define P2P_EVENT_LOGFUNC(_Fmt...) -#define P2P_TRACE_LOGFUNC(_Fmt...) -#define P2P_LOUD_LOGFUNC(_Fmt...) -#define P2P_TEMP_LOGFUNC(_Fmt...) - -#define P2P_ERROR_LOGDUMP8(x, y) -#define P2P_WARN_LOGDUMP8(x, y) -#define P2P_INFO_LOGDUMP8(x, y) -#define P2P_STATE_LOGDUMP8(x, y) -#define P2P_EVENT_LOGDUMP8(x, y) -#define P2P_TRACE_LOGDUMP8(x, y) -#define P2P_LOUD_LOGDUMP8(x, y) -#define P2P_TEMP_LOGDUMP8(x, y) - -#define QM_ERROR_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_ERROR, XLOG_TAG, _Fmt) -#define QM_WARN_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_WARN, XLOG_TAG, _Fmt) -#define QM_INFO_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define QM_STATE_LOGFUNC(_Fmt...) -#define QM_EVENT_LOGFUNC(_Fmt...) -#define QM_TRACE_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_DEBUG, XLOG_TAG, _Fmt) -#define QM_LOUD_LOGFUNC(_Fmt...) -#define QM_TEMP_LOGFUNC(_Fmt...) - -#define QM_ERROR_LOGDUMP8(x, y) -#define QM_WARN_LOGDUMP8(x, y) -#define QM_INFO_LOGDUMP8(x, y) -#define QM_STATE_LOGDUMP8(x, y) -#define QM_EVENT_LOGDUMP8(x, y) -#define QM_TRACE_LOGDUMP8(x, y) -#define QM_LOUD_LOGDUMP8(x, y) -#define QM_TEMP_LOGDUMP8(x, y) - -#define SEC_ERROR_LOGFUNC(_Fmt...) -#define SEC_WARN_LOGFUNC(_Fmt...) -#define SEC_INFO_LOGFUNC(_Fmt...) -#define SEC_STATE_LOGFUNC(_Fmt...) -#define SEC_EVENT_LOGFUNC(_Fmt...) -#define SEC_TRACE_LOGFUNC(_Fmt...) -#define SEC_LOUD_LOGFUNC(_Fmt...) -#define SEC_TEMP_LOGFUNC(_Fmt...) - -#define SEC_ERROR_LOGDUMP8(x, y) -#define SEC_WARN_LOGDUMP8(x, y) -#define SEC_INFO_LOGDUMP8(x, y) -#define SEC_STATE_LOGDUMP8(x, y) -#define SEC_EVENT_LOGDUMP8(x, y) -#define SEC_TRACE_LOGDUMP8(x, y) -#define SEC_LOUD_LOGDUMP8(x, y) -#define SEC_TEMP_LOGDUMP8(x, y) - -#define BOW_ERROR_LOGFUNC(_Fmt...) -#define BOW_WARN_LOGFUNC(_Fmt...) -#define BOW_INFO_LOGFUNC(_Fmt...) -#define BOW_STATE_LOGFUNC(_Fmt...) -#define BOW_EVENT_LOGFUNC(_Fmt...) -#define BOW_TRACE_LOGFUNC(_Fmt...) -#define BOW_LOUD_LOGFUNC(_Fmt...) -#define BOW_TEMP_LOGFUNC(_Fmt...) - -#define BOW_ERROR_LOGDUMP8(x, y) -#define BOW_WARN_LOGDUMP8(x, y) -#define BOW_INFO_LOGDUMP8(x, y) -#define BOW_STATE_LOGDUMP8(x, y) -#define BOW_EVENT_LOGDUMP8(x, y) -#define BOW_TRACE_LOGDUMP8(x, y) -#define BOW_LOUD_LOGDUMP8(x, y) -#define BOW_TEMP_LOGDUMP8(x, y) - -#define HAL_ERROR_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_ERROR, XLOG_TAG, _Fmt) -#define HAL_WARN_LOGFUNC(_Fmt...) -#define HAL_INFO_LOGFUNC(_Fmt...) -#define HAL_STATE_LOGFUNC(_Fmt...) -#define HAL_EVENT_LOGFUNC(_Fmt...) -#define HAL_TRACE_LOGFUNC(_Fmt...) -#define HAL_LOUD_LOGFUNC(_Fmt...) -#define HAL_TEMP_LOGFUNC(_Fmt...) - -#define HAL_ERROR_LOGDUMP8(x, y) -#define HAL_WARN_LOGDUMP8(x, y) -#define HAL_INFO_LOGDUMP8(x, y) -#define HAL_STATE_LOGDUMP8(x, y) -#define HAL_EVENT_LOGDUMP8(x, y) -#define HAL_TRACE_LOGDUMP8(x, y) -#define HAL_LOUD_LOGDUMP8(x, y) -#define HAL_TEMP_LOGDUMP8(x, y) - -#define WAPI_ERROR_LOGFUNC(_Fmt...) -#define WAPI_WARN_LOGFUNC(_Fmt...) -#define WAPI_INFO_LOGFUNC(_Fmt...) -#define WAPI_STATE_LOGFUNC(_Fmt...) -#define WAPI_EVENT_LOGFUNC(_Fmt...) -#define WAPI_TRACE_LOGFUNC(_Fmt...) -#define WAPI_LOUD_LOGFUNC(_Fmt...) -#define WAPI_TEMP_LOGFUNC(_Fmt...) - -#define WAPI_ERROR_LOGDUMP8(x, y) -#define WAPI_WARN_LOGDUMP8(x, y) -#define WAPI_INFO_LOGDUMP8(x, y) -#define WAPI_STATE_LOGDUMP8(x, y) -#define WAPI_EVENT_LOGDUMP8(x, y) -#define WAPI_TRACE_LOGDUMP8(x, y) -#define WAPI_LOUD_LOGDUMP8(x, y) -#define WAPI_TEMP_LOGDUMP8(x, y) - -#define SW1_ERROR_LOGFUNC(_Fmt...) -#define SW1_WARN_LOGFUNC(_Fmt...) -#define SW1_INFO_LOGFUNC(_Fmt...) -#define SW1_STATE_LOGFUNC(_Fmt...) -#define SW1_EVENT_LOGFUNC(_Fmt...) -#define SW1_TRACE_LOGFUNC(_Fmt...) -#define SW1_LOUD_LOGFUNC(_Fmt...) -#define SW1_TEMP_LOGFUNC(_Fmt...) - -#define SW1_ERROR_LOGDUMP8(x, y) -#define SW1_WARN_LOGDUMP8(x, y) -#define SW1_INFO_LOGDUMP8(x, y) -#define SW1_STATE_LOGDUMP8(x, y) -#define SW1_EVENT_LOGDUMP8(x, y) -#define SW1_TRACE_LOGDUMP8(x, y) -#define SW1_LOUD_LOGDUMP8(x, y) -#define SW1_TEMP_LOGDUMP8(x, y) - -#define SW2_ERROR_LOGFUNC(_Fmt...) -#define SW2_WARN_LOGFUNC(_Fmt...) -#define SW2_INFO_LOGFUNC(_Fmt...) -#define SW2_STATE_LOGFUNC(_Fmt...) -#define SW2_EVENT_LOGFUNC(_Fmt...) -#define SW2_TRACE_LOGFUNC(_Fmt...) -#define SW2_LOUD_LOGFUNC(_Fmt...) -#define SW2_TEMP_LOGFUNC(_Fmt...) - -#define SW2_ERROR_LOGDUMP8(x, y) -#define SW2_WARN_LOGDUMP8(x, y) -#define SW2_INFO_LOGDUMP8(x, y) -#define SW2_STATE_LOGDUMP8(x, y) -#define SW2_EVENT_LOGDUMP8(x, y) -#define SW2_TRACE_LOGDUMP8(x, y) -#define SW2_LOUD_LOGDUMP8(x, y) -#define SW2_TEMP_LOGDUMP8(x, y) - -#define SW3_ERROR_LOGFUNC(_Fmt...) -#define SW3_WARN_LOGFUNC(_Fmt...) -#define SW3_INFO_LOGFUNC(_Fmt...) -#define SW3_STATE_LOGFUNC(_Fmt...) -#define SW3_EVENT_LOGFUNC(_Fmt...) -#define SW3_TRACE_LOGFUNC(_Fmt...) -#define SW3_LOUD_LOGFUNC(_Fmt...) -#define SW3_TEMP_LOGFUNC(_Fmt...) - -#define SW3_ERROR_LOGDUMP8(x, y) -#define SW3_WARN_LOGDUMP8(x, y) -#define SW3_INFO_LOGDUMP8(x, y) -#define SW3_STATE_LOGDUMP8(x, y) -#define SW3_EVENT_LOGDUMP8(x, y) -#define SW3_TRACE_LOGDUMP8(x, y) -#define SW3_LOUD_LOGDUMP8(x, y) -#define SW3_TEMP_LOGDUMP8(x, y) - -#define SW4_ERROR_LOGFUNC(_Fmt...) -#define SW4_WARN_LOGFUNC(_Fmt...) -#define SW4_INFO_LOGFUNC(_Fmt...) xlog_printk(ANDROID_LOG_INFO, XLOG_TAG, _Fmt) -#define SW4_STATE_LOGFUNC(_Fmt...) -#define SW4_EVENT_LOGFUNC(_Fmt...) -#define SW4_TRACE_LOGFUNC(_Fmt...) -#define SW4_LOUD_LOGFUNC(_Fmt...) -#define SW4_TEMP_LOGFUNC(_Fmt...) - -#define SW4_ERROR_LOGDUMP8(x, y) -#define SW4_WARN_LOGDUMP8(x, y) -#define SW4_INFO_LOGDUMP8(x, y) -#define SW4_STATE_LOGDUMP8(x, y) -#define SW4_EVENT_LOGDUMP8(x, y) -#define SW4_TRACE_LOGDUMP8(x, y) dumpMemory8(ANDROID_LOG_DEBUG, x, y) -#define SW4_LOUD_LOGDUMP8(x, y) -#define SW4_TEMP_LOGDUMP8(x, y) -#else -#define AIS_ERROR_LOGFUNC(_Fmt...) -#define AIS_WARN_LOGFUNC(_Fmt...) -#define AIS_INFO_LOGFUNC(_Fmt...) -#define AIS_STATE_LOGFUNC(_Fmt...) -#define AIS_EVENT_LOGFUNC(_Fmt...) -#define AIS_TRACE_LOGFUNC(_Fmt...) -#define AIS_LOUD_LOGFUNC(_Fmt...) -#define AIS_TEMP_LOGFUNC(_Fmt...) - -#define INTR_ERROR_LOGFUNC(_Fmt...) -#define INTR_WARN_LOGFUNC(_Fmt...) -#define INTR_INFO_LOGFUNC(_Fmt...) -#define INTR_STATE_LOGFUNC(_Fmt...) -#define INTR_EVENT_LOGFUNC(_Fmt...) -#define INTR_TRACE_LOGFUNC(_Fmt...) -#define INTR_LOUD_LOGFUNC(_Fmt...) -#define INTR_TEMP_LOGFUNC(_Fmt...) - -#define INIT_ERROR_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define INIT_WARN_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define INIT_INFO_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define INIT_STATE_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define INIT_EVENT_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define INIT_TRACE_LOGFUNC(_Fmt...) -#define INIT_LOUD_LOGFUNC(_Fmt...) -#define INIT_TEMP_LOGFUNC(_Fmt...) - -#define AAA_ERROR_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define AAA_WARN_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define AAA_INFO_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define AAA_STATE_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define AAA_EVENT_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define AAA_TRACE_LOGFUNC(_Fmt...) //kalPrint(_Fmt) -#define AAA_LOUD_LOGFUNC(_Fmt...) -#define AAA_TEMP_LOGFUNC(_Fmt...) - -#define ROAMING_ERROR_LOGFUNC(_Fmt...) -#define ROAMING_WARN_LOGFUNC(_Fmt...) -#define ROAMING_INFO_LOGFUNC(_Fmt...) -#define ROAMING_STATE_LOGFUNC(_Fmt...) -#define ROAMING_EVENT_LOGFUNC(_Fmt...) -#define ROAMING_TRACE_LOGFUNC(_Fmt...) -#define ROAMING_LOUD_LOGFUNC(_Fmt...) -#define ROAMING_TEMP_LOGFUNC(_Fmt...) - -#define REQ_ERROR_LOGFUNC(_Fmt...) -#define REQ_WARN_LOGFUNC(_Fmt...) -#define REQ_INFO_LOGFUNC(_Fmt...) -#define REQ_STATE_LOGFUNC(_Fmt...) -#define REQ_EVENT_LOGFUNC(_Fmt...) -#define REQ_TRACE_LOGFUNC(_Fmt...) -#define REQ_LOUD_LOGFUNC(_Fmt...) -#define REQ_TEMP_LOGFUNC(_Fmt...) - -#define TX_ERROR_LOGFUNC(_Fmt...) -#define TX_WARN_LOGFUNC(_Fmt...) -#define TX_INFO_LOGFUNC(_Fmt...) -#define TX_STATE_LOGFUNC(_Fmt...) -#define TX_EVENT_LOGFUNC(_Fmt...) -#define TX_TRACE_LOGFUNC(_Fmt...) -#define TX_LOUD_LOGFUNC(_Fmt...) -#define TX_TEMP_LOGFUNC(_Fmt...) - -#define RX_ERROR_LOGFUNC(_Fmt...) -#define RX_WARN_LOGFUNC(_Fmt...) -#define RX_INFO_LOGFUNC(_Fmt...) -#define RX_STATE_LOGFUNC(_Fmt...) -#define RX_EVENT_LOGFUNC(_Fmt...) -#define RX_TRACE_LOGFUNC(_Fmt...) -#define RX_LOUD_LOGFUNC(_Fmt...) -#define RX_TEMP_LOGFUNC(_Fmt...) - -#define RFTEST_ERROR_LOGFUNC(_Fmt...) -#define RFTEST_WARN_LOGFUNC(_Fmt...) -#define RFTEST_INFO_LOGFUNC(_Fmt...) -#define RFTEST_STATE_LOGFUNC(_Fmt...) -#define RFTEST_EVENT_LOGFUNC(_Fmt...) -#define RFTEST_TRACE_LOGFUNC(_Fmt...) -#define RFTEST_LOUD_LOGFUNC(_Fmt...) -#define RFTEST_TEMP_LOGFUNC(_Fmt...) - -#define EMU_ERROR_LOGFUNC(_Fmt...) -#define EMU_WARN_LOGFUNC(_Fmt...) -#define EMU_INFO_LOGFUNC(_Fmt...) -#define EMU_STATE_LOGFUNC(_Fmt...) -#define EMU_EVENT_LOGFUNC(_Fmt...) -#define EMU_TRACE_LOGFUNC(_Fmt...) -#define EMU_LOUD_LOGFUNC(_Fmt...) -#define EMU_TEMP_LOGFUNC(_Fmt...) - -#define HEM_ERROR_LOGFUNC(_Fmt...) -#define HEM_WARN_LOGFUNC(_Fmt...) -#define HEM_INFO_LOGFUNC(_Fmt...) -#define HEM_STATE_LOGFUNC(_Fmt...) -#define HEM_EVENT_LOGFUNC(_Fmt...) -#define HEM_TRACE_LOGFUNC(_Fmt...) -#define HEM_LOUD_LOGFUNC(_Fmt...) -#define HEM_TEMP_LOGFUNC(_Fmt...) - -#define RLM_ERROR_LOGFUNC(_Fmt...) -#define RLM_WARN_LOGFUNC(_Fmt...) -#define RLM_INFO_LOGFUNC(_Fmt...) -#define RLM_STATE_LOGFUNC(_Fmt...) -#define RLM_EVENT_LOGFUNC(_Fmt...) -#define RLM_TRACE_LOGFUNC(_Fmt...) -#define RLM_LOUD_LOGFUNC(_Fmt...) -#define RLM_TEMP_LOGFUNC(_Fmt...) - -#define MEM_ERROR_LOGFUNC(_Fmt...) -#define MEM_WARN_LOGFUNC(_Fmt...) -#define MEM_INFO_LOGFUNC(_Fmt...) -#define MEM_STATE_LOGFUNC(_Fmt...) -#define MEM_EVENT_LOGFUNC(_Fmt...) -#define MEM_TRACE_LOGFUNC(_Fmt...) -#define MEM_LOUD_LOGFUNC(_Fmt...) -#define MEM_TEMP_LOGFUNC(_Fmt...) - -#define CNM_ERROR_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define CNM_WARN_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define CNM_INFO_LOGFUNC(_Fmt...) //kalPrint(_Fmt) -#define CNM_STATE_LOGFUNC(_Fmt...) -#define CNM_EVENT_LOGFUNC(_Fmt...) -#define CNM_TRACE_LOGFUNC(_Fmt...) -#define CNM_LOUD_LOGFUNC(_Fmt...) -#define CNM_TEMP_LOGFUNC(_Fmt...) - -#define RSN_ERROR_LOGFUNC(_Fmt...) -#define RSN_WARN_LOGFUNC(_Fmt...) -#define RSN_INFO_LOGFUNC(_Fmt...) -#define RSN_STATE_LOGFUNC(_Fmt...) -#define RSN_EVENT_LOGFUNC(_Fmt...) -#define RSN_TRACE_LOGFUNC(_Fmt...) -#define RSN_LOUD_LOGFUNC(_Fmt...) -#define RSN_TEMP_LOGFUNC(_Fmt...) - -#define BSS_ERROR_LOGFUNC(_Fmt...) -#define BSS_WARN_LOGFUNC(_Fmt...) -#define BSS_INFO_LOGFUNC(_Fmt...) -#define BSS_STATE_LOGFUNC(_Fmt...) -#define BSS_EVENT_LOGFUNC(_Fmt...) -#define BSS_TRACE_LOGFUNC(_Fmt...) -#define BSS_LOUD_LOGFUNC(_Fmt...) -#define BSS_TEMP_LOGFUNC(_Fmt...) - -#define SCN_ERROR_LOGFUNC(_Fmt...) -#define SCN_WARN_LOGFUNC(_Fmt...) -#define SCN_INFO_LOGFUNC(_Fmt...) -#define SCN_STATE_LOGFUNC(_Fmt...) -#define SCN_EVENT_LOGFUNC(_Fmt...) -#define SCN_TRACE_LOGFUNC(_Fmt...) -#define SCN_LOUD_LOGFUNC(_Fmt...) -#define SCN_TEMP_LOGFUNC(_Fmt...) - -#define SAA_ERROR_LOGFUNC(_Fmt...) -#define SAA_WARN_LOGFUNC(_Fmt...) -#define SAA_INFO_LOGFUNC(_Fmt...) -#define SAA_STATE_LOGFUNC(_Fmt...) -#define SAA_EVENT_LOGFUNC(_Fmt...) -#define SAA_TRACE_LOGFUNC(_Fmt...) -#define SAA_LOUD_LOGFUNC(_Fmt...) -#define SAA_TEMP_LOGFUNC(_Fmt...) - -#define P2P_ERROR_LOGFUNC(_Fmt...) -#define P2P_WARN_LOGFUNC(_Fmt...) -#define P2P_INFO_LOGFUNC(_Fmt...) -#define P2P_STATE_LOGFUNC(_Fmt...) -#define P2P_EVENT_LOGFUNC(_Fmt...) -#define P2P_TRACE_LOGFUNC(_Fmt...) -#define P2P_LOUD_LOGFUNC(_Fmt...) -#define P2P_TEMP_LOGFUNC(_Fmt...) - -#define QM_ERROR_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define QM_WARN_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define QM_INFO_LOGFUNC(_Fmt...) //kalPrint(_Fmt) -#define QM_STATE_LOGFUNC(_Fmt...) -#define QM_EVENT_LOGFUNC(_Fmt...) -#define QM_TRACE_LOGFUNC(_Fmt...) //kalPrint(_Fmt) -#define QM_LOUD_LOGFUNC(_Fmt...) -#define QM_TEMP_LOGFUNC(_Fmt...) - -#define SEC_ERROR_LOGFUNC(_Fmt...) -#define SEC_WARN_LOGFUNC(_Fmt...) -#define SEC_INFO_LOGFUNC(_Fmt...) -#define SEC_STATE_LOGFUNC(_Fmt...) -#define SEC_EVENT_LOGFUNC(_Fmt...) -#define SEC_TRACE_LOGFUNC(_Fmt...) -#define SEC_LOUD_LOGFUNC(_Fmt...) -#define SEC_TEMP_LOGFUNC(_Fmt...) - -#define BOW_ERROR_LOGFUNC(_Fmt...) -#define BOW_WARN_LOGFUNC(_Fmt...) -#define BOW_INFO_LOGFUNC(_Fmt...) -#define BOW_STATE_LOGFUNC(_Fmt...) -#define BOW_EVENT_LOGFUNC(_Fmt...) -#define BOW_TRACE_LOGFUNC(_Fmt...) -#define BOW_LOUD_LOGFUNC(_Fmt...) -#define BOW_TEMP_LOGFUNC(_Fmt...) - -#define HAL_ERROR_LOGFUNC(_Fmt...) kalPrint(_Fmt) -#define HAL_WARN_LOGFUNC(_Fmt...) -#define HAL_INFO_LOGFUNC(_Fmt...) -#define HAL_STATE_LOGFUNC(_Fmt...) -#define HAL_EVENT_LOGFUNC(_Fmt...) -#define HAL_TRACE_LOGFUNC(_Fmt...) -#define HAL_LOUD_LOGFUNC(_Fmt...) -#define HAL_TEMP_LOGFUNC(_Fmt...) - -#define WAPI_ERROR_LOGFUNC(_Fmt...) -#define WAPI_WARN_LOGFUNC(_Fmt...) -#define WAPI_INFO_LOGFUNC(_Fmt...) -#define WAPI_STATE_LOGFUNC(_Fmt...) -#define WAPI_EVENT_LOGFUNC(_Fmt...) -#define WAPI_TRACE_LOGFUNC(_Fmt...) -#define WAPI_LOUD_LOGFUNC(_Fmt...) -#define WAPI_TEMP_LOGFUNC(_Fmt...) - -#define SW1_ERROR_LOGFUNC(_Fmt...) -#define SW1_WARN_LOGFUNC(_Fmt...) -#define SW1_INFO_LOGFUNC(_Fmt...) -#define SW1_STATE_LOGFUNC(_Fmt...) -#define SW1_EVENT_LOGFUNC(_Fmt...) -#define SW1_TRACE_LOGFUNC(_Fmt...) -#define SW1_LOUD_LOGFUNC(_Fmt...) -#define SW1_TEMP_LOGFUNC(_Fmt...) - -#define SW2_ERROR_LOGFUNC(_Fmt...) -#define SW2_WARN_LOGFUNC(_Fmt...) -#define SW2_INFO_LOGFUNC(_Fmt...) -#define SW2_STATE_LOGFUNC(_Fmt...) -#define SW2_EVENT_LOGFUNC(_Fmt...) -#define SW2_TRACE_LOGFUNC(_Fmt...) -#define SW2_LOUD_LOGFUNC(_Fmt...) -#define SW2_TEMP_LOGFUNC(_Fmt...) - -#define SW3_ERROR_LOGFUNC(_Fmt...) -#define SW3_WARN_LOGFUNC(_Fmt...) -#define SW3_INFO_LOGFUNC(_Fmt...) -#define SW3_STATE_LOGFUNC(_Fmt...) -#define SW3_EVENT_LOGFUNC(_Fmt...) -#define SW3_TRACE_LOGFUNC(_Fmt...) -#define SW3_LOUD_LOGFUNC(_Fmt...) -#define SW3_TEMP_LOGFUNC(_Fmt...) - -#define SW4_ERROR_LOGFUNC(_Fmt...) -#define SW4_WARN_LOGFUNC(_Fmt...) -#define SW4_INFO_LOGFUNC(_Fmt...) -#define SW4_STATE_LOGFUNC(_Fmt...) -#define SW4_EVENT_LOGFUNC(_Fmt...) -#define SW4_TRACE_LOGFUNC(_Fmt...) -#define SW4_LOUD_LOGFUNC(_Fmt...) -#define SW4_TEMP_LOGFUNC(_Fmt...) -#endif -#endif - -#define kalBreakPoint() \ - do { \ - BUG(); \ - panic("Oops"); \ - } while(0) - -#if CFG_ENABLE_AEE_MSG -#define kalSendAeeException aee_kernel_exception -#define kalSendAeeWarning aee_kernel_warning -#define kalSendAeeReminding aee_kernel_reminding -#else -#define kalSendAeeException(_module, _desc, ...) -#define kalSendAeeWarning(_module, _desc, ...) -#define kalSendAeeReminding(_module, _desc, ...) -#endif - -#define PRINTF_ARG(...) __VA_ARGS__ -#define SPRINTF(buf, arg) {buf += sprintf((char *)(buf), PRINTF_ARG arg);} - -#define USEC_TO_SYSTIME(_usec) ((_usec) / USEC_PER_MSEC) -#define MSEC_TO_SYSTIME(_msec) (_msec) - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Routines in gl_kal.c */ -/*----------------------------------------------------------------------------*/ -VOID -kalAcquireSpinLock( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_SPIN_LOCK_CATEGORY_E rLockCategory, - OUT PUINT_32 pu4Flags - ); - -VOID -kalReleaseSpinLock( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_SPIN_LOCK_CATEGORY_E rLockCategory, - IN UINT_32 u4Flags - ); - -VOID -kalUpdateMACAddress( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucMacAddr - ); - -VOID -kalPacketFree( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID pvPacket - ); - -PVOID -kalPacketAlloc( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Size, - OUT PUINT_8 *ppucData - ); - -VOID -kalOsTimerInitialize( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID prTimerHandler - ); - -BOOL -kalSetTimer( - IN P_GLUE_INFO_T prGlueInfo, - IN OS_SYSTIME rInterval - ); - -WLAN_STATUS -kalProcessRxPacket( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID pvPacket, - IN PUINT_8 pucPacketStart, - IN UINT_32 u4PacketLen, - //IN PBOOLEAN pfgIsRetain, - IN BOOLEAN fgIsRetain, - IN ENUM_CSUM_RESULT_T aeCSUM[] - ); - -WLAN_STATUS -kalRxIndicatePkts( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID apvPkts[], - IN UINT_8 ucPktNum - ); - -VOID -kalIndicateStatusAndComplete( - IN P_GLUE_INFO_T prGlueInfo, - IN WLAN_STATUS eStatus, - IN PVOID pvBuf, - IN UINT_32 u4BufLen - ); - -VOID -kalUpdateReAssocReqInfo( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucFrameBody, - IN UINT_32 u4FrameBodyLen, - IN BOOLEAN fgReassocRequest - ); - -VOID -kalUpdateReAssocRspInfo ( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucFrameBody, - IN UINT_32 u4FrameBodyLen - ); - -#if CFG_TX_FRAGMENT -BOOLEAN -kalQueryTxPacketHeader( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID pvPacket, - OUT PUINT_16 pu2EtherTypeLen, - OUT PUINT_8 pucEthDestAddr - ); -#endif /* CFG_TX_FRAGMENT */ - -VOID -kalSendCompleteAndAwakeQueue( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID pvPacket - ); - -#if CFG_TCP_IP_CHKSUM_OFFLOAD -VOID -kalQueryTxChksumOffloadParam( - IN PVOID pvPacket, - OUT PUINT_8 pucFlag); - -VOID -kalUpdateRxCSUMOffloadParam( - IN PVOID pvPacket, - IN ENUM_CSUM_RESULT_T eCSUM[] - ); -#endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */ - - -BOOLEAN -kalRetrieveNetworkAddress( - IN P_GLUE_INFO_T prGlueInfo, - IN OUT PARAM_MAC_ADDRESS * prMacAddr - ); - - -/*----------------------------------------------------------------------------*/ -/* Routines in interface - ehpi/sdio.c */ -/*----------------------------------------------------------------------------*/ -BOOL -kalDevRegRead( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Register, - OUT PUINT_32 pu4Value - ); - -BOOL -kalDevRegWrite( - P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Register, - IN UINT_32 u4Value - ); - -BOOL -kalDevPortRead( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_16 u2Port, - IN UINT_16 u2Len, - OUT PUINT_8 pucBuf, - IN UINT_16 u2ValidOutBufSize - ); - -BOOL -kalDevPortWrite( - P_GLUE_INFO_T prGlueInfo, - IN UINT_16 u2Port, - IN UINT_16 u2Len, - IN PUINT_8 pucBuf, - IN UINT_16 u2ValidInBufSize - ); - -BOOL -kalDevWriteWithSdioCmd52 ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Addr, - IN UINT_8 ucData - ); - - - #if CFG_SUPPORT_EXT_CONFIG -UINT_32 -kalReadExtCfg ( - IN P_GLUE_INFO_T prGlueInfo - ); - #endif - -BOOL -kalQoSFrameClassifierAndPacketInfo ( - IN P_GLUE_INFO_T prGlueInfo, - IN P_NATIVE_PACKET prPacket, - OUT PUINT_8 pucPriorityParam, - OUT PUINT_32 pu4PacketLen, - OUT PUINT_8 pucEthDestAddr, - OUT PBOOLEAN pfgIs1X, - OUT PBOOLEAN pfgIsPAL, - OUT PUINT_8 pucNetworkType -); - -inline VOID -kalOidComplete ( - IN P_GLUE_INFO_T prGlueInfo, - IN BOOLEAN fgSetQuery, - IN UINT_32 u4SetQueryInfoLen, - IN WLAN_STATUS rOidStatus - ); - - -WLAN_STATUS -kalIoctl (IN P_GLUE_INFO_T prGlueInfo, - IN PFN_OID_HANDLER_FUNC pfnOidHandler, - IN PVOID pvInfoBuf, - IN UINT_32 u4InfoBufLen, - IN BOOL fgRead, - IN BOOL fgWaitResp, - IN BOOL fgCmd, - IN BOOL fgIsP2pOid, - OUT PUINT_32 pu4QryInfoLen - ); - -VOID -kalHandleAssocInfo( - IN P_GLUE_INFO_T prGlueInfo, - IN P_EVENT_ASSOC_INFO prAssocInfo - ); - -#if CFG_ENABLE_FW_DOWNLOAD - -PVOID -kalFirmwareImageMapping ( - IN P_GLUE_INFO_T prGlueInfo, - OUT PPVOID ppvMapFileBuf, - OUT PUINT_32 pu4FileLength - ); - -VOID -kalFirmwareImageUnmapping ( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID prFwHandle, - IN PVOID pvMapFileBuf - ); -#endif - - -/*----------------------------------------------------------------------------*/ -/* Card Removal Check */ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalIsCardRemoved( - IN P_GLUE_INFO_T prGlueInfo - ); - - -/*----------------------------------------------------------------------------*/ -/* TX */ -/*----------------------------------------------------------------------------*/ -VOID -kalFlushPendingTxPackets( - IN P_GLUE_INFO_T prGlueInfo - ); - - -/*----------------------------------------------------------------------------*/ -/* Media State Indication */ -/*----------------------------------------------------------------------------*/ -ENUM_PARAM_MEDIA_STATE_T -kalGetMediaStateIndicated( - IN P_GLUE_INFO_T prGlueInfo - ); - - -VOID -kalSetMediaStateIndicated( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_PARAM_MEDIA_STATE_T eParamMediaStateIndicate - ); - - -/*----------------------------------------------------------------------------*/ -/* OID handling */ -/*----------------------------------------------------------------------------*/ -VOID -kalOidCmdClearance( - IN P_GLUE_INFO_T prGlueInfo - ); - -VOID -kalOidClearance( - IN P_GLUE_INFO_T prGlueInfo - ); - -VOID -kalEnqueueCommand( - IN P_GLUE_INFO_T prGlueInfo, - IN P_QUE_ENTRY_T prQueueEntry - ); - -#if CFG_ENABLE_BT_OVER_WIFI -/*----------------------------------------------------------------------------*/ -/* Bluetooth over Wi-Fi handling */ -/*----------------------------------------------------------------------------*/ -VOID -kalIndicateBOWEvent( - IN P_GLUE_INFO_T prGlueInfo, - IN P_AMPC_EVENT prEvent - ); - -ENUM_BOW_DEVICE_STATE -kalGetBowState ( - IN P_GLUE_INFO_T prGlueInfo, - IN PARAM_MAC_ADDRESS rPeerAddr - ); - -BOOLEAN -kalSetBowState ( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_BOW_DEVICE_STATE eBowState, - PARAM_MAC_ADDRESS rPeerAddr - ); - -ENUM_BOW_DEVICE_STATE -kalGetBowGlobalState ( - IN P_GLUE_INFO_T prGlueInfo - ); - -UINT_32 -kalGetBowFreqInKHz( - IN P_GLUE_INFO_T prGlueInfo - ); - -UINT_8 -kalGetBowRole( - IN P_GLUE_INFO_T prGlueInfo, - IN PARAM_MAC_ADDRESS rPeerAddr - ); - -VOID -kalSetBowRole( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 ucRole, - IN PARAM_MAC_ADDRESS rPeerAddr - ); - -UINT_8 -kalGetBowAvailablePhysicalLinkCount( - IN P_GLUE_INFO_T prGlueInfo - ); - -#if CFG_BOW_SEPARATE_DATA_PATH -/*----------------------------------------------------------------------------*/ -/* Bluetooth over Wi-Fi Net Device Init/Uninit */ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalInitBowDevice( - IN P_GLUE_INFO_T prGlueInfo, - IN const char *prDevName - ); - -BOOLEAN -kalUninitBowDevice( - IN P_GLUE_INFO_T prGlueInfo - ); -#endif // CFG_BOW_SEPARATE_DATA_PATH -#endif // CFG_ENABLE_BT_OVER_WIFI - - -/*----------------------------------------------------------------------------*/ -/* Firmware Download Handling */ -/*----------------------------------------------------------------------------*/ -UINT_32 -kalGetFwStartAddress( - IN P_GLUE_INFO_T prGlueInfo - ); - -UINT_32 -kalGetFwLoadAddress( - IN P_GLUE_INFO_T prGlueInfo - ); - -/*----------------------------------------------------------------------------*/ -/* Security Frame Clearance */ -/*----------------------------------------------------------------------------*/ -VOID -kalClearSecurityFrames( - IN P_GLUE_INFO_T prGlueInfo - ); - -VOID -kalClearSecurityFramesByNetType( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ); - -VOID -kalSecurityFrameSendComplete ( - IN P_GLUE_INFO_T prGlueInfo, - IN PVOID pvPacket, - IN WLAN_STATUS rStatus - ); - - -/*----------------------------------------------------------------------------*/ -/* Management Frame Clearance */ -/*----------------------------------------------------------------------------*/ -VOID -kalClearMgmtFrames( - IN P_GLUE_INFO_T prGlueInfo - ); - -VOID -kalClearMgmtFramesByNetType( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_NETWORK_TYPE_INDEX_T eNetworkTypeIdx - ); - -UINT_32 -kalGetTxPendingFrameCount( - IN P_GLUE_INFO_T prGlueInfo - ); - -UINT_32 -kalGetTxPendingCmdCount( - IN P_GLUE_INFO_T prGlueInfo - ); - -BOOLEAN -kalSetTimer( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Interval - ); - -BOOLEAN -kalCancelTimer( - IN P_GLUE_INFO_T prGlueInfo - ); - -VOID -kalScanDone( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_KAL_NETWORK_TYPE_INDEX_T eNetTypeIdx, - IN WLAN_STATUS status - ); - -UINT_32 -kalRandomNumber( - VOID - ); - -VOID -kalTimeoutHandler (unsigned long arg); - -VOID -kalSetEvent (P_GLUE_INFO_T pr); - - -/*----------------------------------------------------------------------------*/ -/* NVRAM/Registry Service */ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalIsConfigurationExist( - IN P_GLUE_INFO_T prGlueInfo - ); - -P_REG_INFO_T -kalGetConfiguration( - IN P_GLUE_INFO_T prGlueInfo - ); - -VOID -kalGetConfigurationVersion( - IN P_GLUE_INFO_T prGlueInfo, - OUT PUINT_16 pu2Part1CfgOwnVersion, - OUT PUINT_16 pu2Part1CfgPeerVersion, - OUT PUINT_16 pu2Part2CfgOwnVersion, - OUT PUINT_16 pu2Part2CfgPeerVersion - ); - -BOOLEAN -kalCfgDataRead16( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Offset, - OUT PUINT_16 pu2Data - ); - -BOOLEAN -kalCfgDataWrite16( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Offset, - IN UINT_16 u2Data - ); - -/*----------------------------------------------------------------------------*/ -/* WSC Connection */ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalWSCGetActiveState( - IN P_GLUE_INFO_T prGlueInfo - ); - -/*----------------------------------------------------------------------------*/ -/* RSSI Updating */ -/*----------------------------------------------------------------------------*/ -VOID -kalUpdateRSSI( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_KAL_NETWORK_TYPE_INDEX_T eNetTypeIdx, - IN INT_8 cRssi, - IN INT_8 cLinkQuality - ); - - -/*----------------------------------------------------------------------------*/ -/* I/O Buffer Pre-allocation */ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalInitIOBuffer( - VOID - ); - -VOID -kalUninitIOBuffer( - VOID - ); - -PVOID -kalAllocateIOBuffer( - IN UINT_32 u4AllocSize - ); - -VOID -kalReleaseIOBuffer( - IN PVOID pvAddr, - IN UINT_32 u4Size - ); - -VOID -kalGetChannelList( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_BAND_T eSpecificBand, - IN UINT_8 ucMaxChannelNum, - IN PUINT_8 pucNumOfChannel, - IN P_RF_CHANNEL_INFO_T paucChannelList - ); - -BOOL -kalIsAPmode( - IN P_GLUE_INFO_T prGlueInfo - ); - -#if CFG_SUPPORT_802_11W -/*----------------------------------------------------------------------------*/ -/* 802.11W */ -/*----------------------------------------------------------------------------*/ -UINT_32 -kalGetMfpSetting( - IN P_GLUE_INFO_T prGlueInfo - ); -#endif - -UINT_32 -kalWriteToFile( - const PUINT_8 pucPath, - BOOLEAN fgDoAppend, - PUINT_8 pucData, - UINT_32 u4Size - ); - - -/*----------------------------------------------------------------------------*/ -/* NL80211 */ -/*----------------------------------------------------------------------------*/ -VOID -kalIndicateBssInfo ( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucFrameBuf, - IN UINT_32 u4BufLen, - IN UINT_8 ucChannelNum, - IN INT_32 i4SignalStrength - ); - - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -int tx_thread(void *data); - -#endif /* _GL_KAL_H */ - diff --git a/drivers/net/wireless/mt5931/os/linux/include/gl_os.h b/drivers/net/wireless/mt5931/os/linux/include/gl_os.h deleted file mode 100755 index 99559dfcce79..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/include/gl_os.h +++ /dev/null @@ -1,1139 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/include/gl_os.h#2 $ -*/ - -/*! \file gl_os.h - \brief List the external reference to OS for GLUE Layer. - - In this file we define the data structure - GLUE_INFO_T to store those objects - we acquired from OS - e.g. TIMER, SPINLOCK, NET DEVICE ... . And all the - external reference (header file, extern func() ..) to OS for GLUE Layer should - also list down here. -*/ - - - -/* -** $Log: gl_os.h $ -** -** 08 20 2012 yuche.tsai -** NULL -** Fix possible KE issue. -** -** 08 20 2012 yuche.tsai -** [ALPS00339327] [Rose][6575JB][BSP Package][Free Test][KE][WIFI]There is no response when you tap the turn off/on button,wait a minutes, the device will reboot automatically and "KE" will pop up. -** Fix possible KE when netlink operate mgmt frame register. - * - * 04 12 2012 terry.wu - * NULL - * Add AEE message support - * 1) Show AEE warning(red screen) if SDIO access error occurs - - * - * 03 02 2012 terry.wu - * NULL - * Enable CFG80211 Support. - * - * 01 05 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the related ioctl / wlan oid function to set the Tx power cfg. - * - * 12 13 2011 cm.chang - * [WCXRP00001136] [All Wi-Fi][Driver] Add wake lock for pending timer - * Add wake lock if timer timeout value is smaller than 5 seconds - * - * 11 18 2011 yuche.tsai - * NULL - * CONFIG P2P support RSSI query, default turned off. - * - * 11 16 2011 yuche.tsai - * NULL - * Avoid using work thread. - * - * 11 11 2011 yuche.tsai - * NULL - * Fix work thread cancel issue. - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 09 29 2011 terry.wu - * NULL - * Show DRV_NAME by chip id. - * - * 04 18 2011 terry.wu - * [WCXRP00000660] [MT6620 Wi-Fi][Driver] Remove flag CFG_WIFI_DIRECT_MOVED - * Remove flag CFG_WIFI_DIRECT_MOVED. - * - * 03 29 2011 cp.wu - * [WCXRP00000598] [MT6620 Wi-Fi][Driver] Implementation of interface for communicating with user space process for RESET_START and RESET_END events - * implement kernel-to-userspace communication via generic netlink socket for whole-chip resetting mechanism - * - * 03 21 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * portability improvement - * - * 03 17 2011 chinglan.wang - * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature - * . - * - * 03 03 2011 jeffrey.chang - * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue - * support concurrent network - * - * 03 03 2011 jeffrey.chang - * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue - * modify net device relative functions to support multiple H/W queues - * - * 03 02 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * Add security check code. - * - * 02 21 2011 cp.wu - * [WCXRP00000482] [MT6620 Wi-Fi][Driver] Simplify logic for checking NVRAM existence in driver domain - * simplify logic for checking NVRAM existence only once. - * - * 02 16 2011 jeffrey.chang - * NULL - * Add query ipv4 and ipv6 address during early suspend and late resume - * - * 02 10 2011 chinghwa.yu - * [WCXRP00000065] Update BoW design and settings - * Fix kernel API change issue. - * Before ALPS 2.2 (2.2 included), kfifo_alloc() is - * struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, spinlock_t *lock); - * After ALPS 2.3, kfifo_alloc() is changed to - * int kfifo_alloc(struct kfifo *fifo, unsigned int size, gfp_t gfp_mask); - * - * 02 09 2011 wh.su - * [WCXRP00000433] [MT6620 Wi-Fi][Driver] Remove WAPI structure define for avoid P2P module with structure miss-align pointer issue - * always pre-allio WAPI related structure for align p2p module. - * - * 02 09 2011 terry.wu - * [WCXRP00000383] [MT6620 Wi-Fi][Driver] Separate WiFi and P2P driver into two modules - * Halt p2p module init and exit until TxThread finished p2p register and unregister. - * - * 02 01 2011 cm.chang - * [WCXRP00000415] [MT6620 Wi-Fi][Driver] Check if any memory leakage happens when uninitializing in DGB mode - * . - * - * 01 27 2011 cm.chang - * [WCXRP00000402] [MT6620 Wi-Fi][Driver] Enable MCR read/write by iwpriv by default - * . - * - * 01 12 2011 cp.wu - * [WCXRP00000357] [MT6620 Wi-Fi][Driver][Bluetooth over Wi-Fi] add another net device interface for BT AMP - * implementation of separate BT_OVER_WIFI data path. - * - * 01 12 2011 cp.wu - * [WCXRP00000356] [MT6620 Wi-Fi][Driver] fill mac header length for security frames 'cause hardware header translation needs such information - * fill mac header length information for 802.1x frames. - * - * 01 11 2011 chinglan.wang - * NULL - * Modify to reslove the CR :[ALPS00028994] Use WEP security to connect Marvell 11N AP. Connection establish successfully. - * Use the WPS function to connect AP, the privacy bit always is set to 1. - * - * 01 10 2011 cp.wu - * [WCXRP00000349] [MT6620 Wi-Fi][Driver] make kalIoctl() of linux port as a thread safe API to avoid potential issues due to multiple access - * use mutex to protect kalIoctl() for thread safe. - * - * 01 05 2011 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * ioctl implementations for P2P Service Discovery - * - * 11 04 2010 wh.su - * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID - * adding the p2p random ssid support. - * - * 10 18 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android - * complete implementation of Android NVRAM access - * - * 09 28 2010 wh.su - * NULL - * [WCXRP00000069][MT6620 Wi-Fi][Driver] Fix some code for phase 1 P2P Demo. - * - * 09 23 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * add skeleton for NVRAM integration - * - * 09 13 2010 cp.wu - * NULL - * add waitq for poll() and read(). - * - * 09 07 2010 wh.su - * NULL - * adding the code for beacon/probe req/ probe rsp wsc ie at p2p. - * - * 09 06 2010 wh.su - * NULL - * let the p2p can set the privacy bit at beacon and rsn ie at assoc req at key handshake state. - * - * 09 03 2010 kevin.huang - * NULL - * Refine #include sequence and solve recursive/nested #include issue - * - * 09 01 2010 wh.su - * NULL - * adding the wapi support for integration test. - * - * 08 31 2010 kevin.huang - * NULL - * Use LINK LIST operation to process SCAN result - * - * 08 23 2010 cp.wu - * NULL - * revise constant definitions to be matched with implementation (original cmd-event definition is deprecated) - * - * 08 16 2010 cp.wu - * NULL - * P2P packets are now marked when being queued into driver, and identified later without checking MAC address - * - * 08 16 2010 cp.wu - * NULL - * revised implementation of Wi-Fi Direct io controls. - * - * 08 11 2010 cp.wu - * NULL - * 1) do not use in-stack variable for beacon updating. (for MAUI porting) - * 2) extending scanning result to 64 instead of 48 - * - * 08 06 2010 cp.wu - * NULL - * driver hook modifications corresponding to ioctl interface change. - * - * 08 03 2010 cp.wu - * NULL - * [Wi-Fi Direct] add framework for driver hooks - * - * 08 02 2010 jeffrey.chang - * NULL - * 1) modify tx service thread to avoid busy looping - * 2) add spin lock declartion for linux build - * - * 07 23 2010 jeffrey.chang - * - * add new KAL api - * - * 07 22 2010 jeffrey.chang - * - * modify tx thread and remove some spinlock - * - * 07 19 2010 jeffrey.chang - * - * add security frame pending count - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 06 01 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add ioctl to configure scan mode for p2p connection - * - * 05 31 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add cfg80211 interface, which is to replace WE, for further extension - * - * 05 14 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add ioctl framework for Wi-Fi Direct by reusing wireless extension ioctls as well - * - * 05 11 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * p2p ioctls revised. - * - * 05 11 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add ioctl for controlling p2p scan phase parameters - * - * 05 10 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * implement basic wi-fi direct framework - * - * 05 07 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * prevent supplicant accessing driver during resume - * - * 05 07 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add basic framework for implementating P2P driver hook. - * - * 05 05 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * change variable names for multiple physical link to match with coding convention - * - * 04 27 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * identify BT Over Wi-Fi Security frame and mark it as 802.1X frame - * - * 04 27 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add multiple physical link support - * - * 04 27 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * 1) fix firmware download bug - * 2) remove query statistics for acelerating firmware download - * - * 04 27 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * follow Linux's firmware framework, and remove unused kal API - * - * 04 23 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * surpress compiler warning - * - * 04 19 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * supporting power management - * - * 04 14 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * pvInformationBuffer and u4InformationBufferLength are no longer in glue - * - * 04 13 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add framework for BT-over-Wi-Fi support. - * * * * * * * * * * * * * * * * * * * * 1) prPendingCmdInfo is replaced by queue for multiple handler capability - * * * * * * * * * * * * * * * * * * * * 2) command sequence number is now increased atomically - * * * * * * * * * * * * * * * * * * * * 3) private data could be hold and taken use for other purpose - * - * 04 07 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * rWlanInfo should be placed at adapter rather than glue due to most operations - * * * * * * * * * * are done in adapter layer. - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * Tag the packet for QoS on Tx path - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * (1)deliver the kalOidComplete status to upper layer - * * (2) fix spin lock - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * add timeout check in the kalOidComplete - * - * 04 06 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * improve none-glue code portability - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * code refine: fgTestMode should be at adapter rather than glue due to the device/fw is also involved - * - * 04 06 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * eliminate direct access for prGlueInfo->fgIsCardRemoved in non-glue layer - * - * 03 30 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * emulate NDIS Pending OID facility - * - * 03 26 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * [WPD00003826] Initial import for Linux port - * adding firmware download related data type - * - * 03 25 2010 cp.wu - * [WPD00001943]Create WiFi test driver framework on WinXP - * 1) correct OID_802_11_CONFIGURATION with frequency setting behavior. - * * * * the frequency is used for adhoc connection only - * * * * 2) update with SD1 v0.9 CMD/EVENT documentation - * - * 03 25 2010 cp.wu - * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support - * add Bluetooth-over-Wifi frame header check - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port -** \main\maintrunk.MT5921\30 2009-10-20 17:38:31 GMT mtk01090 -** Refine driver unloading and clean up procedure. Block requests, stop main thread and clean up queued requests, and then stop hw. -** \main\maintrunk.MT5921\29 2009-10-08 10:33:33 GMT mtk01090 -** Avoid accessing private data of net_device directly. Replace with netdev_priv(). Add more checking for input parameters and pointers. -** \main\maintrunk.MT5921\28 2009-09-28 20:19:26 GMT mtk01090 -** Add private ioctl to carry OID structures. Restructure public/private ioctl interfaces to Linux kernel. -** \main\maintrunk.MT5921\27 2009-08-18 22:57:12 GMT mtk01090 -** Add Linux SDIO (with mmc core) support. -** Add Linux 2.6.21, 2.6.25, 2.6.26. -** Fix compile warning in Linux. -** \main\maintrunk.MT5921\26 2009-07-06 21:42:25 GMT mtk01088 -** fixed the compiling error at linux -** \main\maintrunk.MT5921\25 2009-07-06 20:51:46 GMT mtk01088 -** adding the wapi 1x ether type define -** \main\maintrunk.MT5921\24 2009-06-23 23:19:18 GMT mtk01090 -** Add build option BUILD_USE_EEPROM and compile option CFG_SUPPORT_EXT_CONFIG for NVRAM support -** \main\maintrunk.MT5921\23 2009-02-07 15:05:06 GMT mtk01088 -** add the privacy flag to ingo driver the supplicant selected ap's security -** \main\maintrunk.MT5921\22 2009-02-05 15:34:09 GMT mtk01088 -** fixed the compiling error for using bits marco for only one parameter -** \main\maintrunk.MT5921\21 2009-01-22 13:02:13 GMT mtk01088 -** data frame is or not 802.1x value share with tid, using the same reserved byte, provide the function to set and get -** \main\maintrunk.MT5921\20 2008-10-24 12:04:16 GMT mtk01088 -** move the config.h from precomp.h to here for lint check -** \main\maintrunk.MT5921\19 2008-09-22 23:19:02 GMT mtk01461 -** Update driver for code review -** \main\maintrunk.MT5921\18 2008-09-05 17:25:13 GMT mtk01461 -** Update Driver for Code Review -** \main\maintrunk.MT5921\17 2008-08-01 13:32:47 GMT mtk01084 -** Prevent redundent driver assertion in driver logic when BUS is detached -** \main\maintrunk.MT5921\16 2008-05-30 14:41:43 GMT mtk01461 -** Remove WMM Assoc Flag in KAL -** \main\maintrunk.MT5921\15 2008-05-29 14:16:25 GMT mtk01084 -** remoev un-used variable -** \main\maintrunk.MT5921\14 2008-05-03 15:17:14 GMT mtk01461 -** Add Media Status variable in Glue Layer -** \main\maintrunk.MT5921\13 2008-04-24 11:58:41 GMT mtk01461 -** change threshold to 256 -** \main\maintrunk.MT5921\12 2008-03-11 14:51:05 GMT mtk01461 -** Remove redundant GL_CONN_INFO_T -** \main\maintrunk.MT5921\11 2008-01-07 15:07:41 GMT mtk01461 -** Adjust the netif stop threshold to 150 -** \main\maintrunk.MT5921\10 2007-11-26 19:43:46 GMT mtk01461 -** Add OS_TIMESTAMP macro -** -** \main\maintrunk.MT5921\9 2007-11-07 18:38:38 GMT mtk01461 -** Move definition -** \main\maintrunk.MT5921\8 2007-11-02 01:04:00 GMT mtk01461 -** Unify TX Path for Normal and IBSS Power Save + IBSS neighbor learning -** Revision 1.5 2007/07/12 11:04:28 MTK01084 -** update macro to delay for ms order -** -** Revision 1.4 2007/07/05 07:25:34 MTK01461 -** Add Linux initial code, modify doc, add 11BB, RF init code -** -** Revision 1.3 2007/06/27 02:18:51 MTK01461 -** Update SCAN_FSM, Initial(Can Load Module), Proc(Can do Reg R/W), TX API -** -** Revision 1.2 2007/06/25 06:16:24 MTK01461 -** Update illustrations, gl_init.c, gl_kal.c, gl_kal.h, gl_os.h and RX API -** -*/ - -#ifndef _GL_OS_H -#define _GL_OS_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ -/*------------------------------------------------------------------------------ - * Flags for LINUX(OS) dependent - *------------------------------------------------------------------------------ - */ -#define CFG_MAX_WLAN_DEVICES 1 /* number of wlan card will coexist*/ - -#define CFG_MAX_TXQ_NUM 4 /* number of tx queue for support multi-queue h/w */ - - -#define CFG_USE_SPIN_LOCK_BOTTOM_HALF 0 /* 1: Enable use of SPIN LOCK Bottom Half for LINUX - 0: Disable - use SPIN LOCK IRQ SAVE instead */ - -#define CFG_TX_PADDING_SMALL_ETH_PACKET 0 /* 1: Enable - Drop ethernet packet if it < 14 bytes. - And pad ethernet packet with dummy 0 if it < 60 bytes. - 0: Disable */ - -#define CFG_TX_STOP_NETIF_QUEUE_THRESHOLD 256 /* packets */ - -#define CFG_TX_STOP_NETIF_PER_QUEUE_THRESHOLD 64 /* packets */ -#define CFG_TX_START_NETIF_PER_QUEUE_THRESHOLD 32 /* packets */ - - -#define ETH_P_1X 0x888E -#define IPTOS_PREC_OFFSET 5 -#define USER_PRIORITY_DEFAULT 0 - -#define ETH_WPI_1X 0x88B4 - -#define ETH_HLEN 14 -#define ETH_TYPE_LEN_OFFSET 12 -#define ETH_P_IP 0x0800 -#define ETH_P_1X 0x888E -#define ETH_P_PRE_1X 0x88C7 - -#define IPVERSION 4 -#define IP_HEADER_LEN 20 - -#define IPVH_VERSION_OFFSET 4 // For Little-Endian -#define IPVH_VERSION_MASK 0xF0 -#define IPTOS_PREC_OFFSET 5 -#define IPTOS_PREC_MASK 0xE0 - -#define SOURCE_PORT_LEN 2 -/* NOTE(Kevin): Without IP Option Length */ -#define LOOK_AHEAD_LEN (ETH_HLEN + IP_HEADER_LEN + SOURCE_PORT_LEN) - -/* 802.2 LLC/SNAP */ -#define ETH_LLC_OFFSET (ETH_HLEN) -#define ETH_LLC_LEN 3 -#define ETH_LLC_DSAP_SNAP 0xAA -#define ETH_LLC_SSAP_SNAP 0xAA -#define ETH_LLC_CONTROL_UNNUMBERED_INFORMATION 0x03 - -/* Bluetooth SNAP */ -#define ETH_SNAP_OFFSET (ETH_HLEN + ETH_LLC_LEN) -#define ETH_SNAP_LEN 5 -#define ETH_SNAP_BT_SIG_OUI_0 0x00 -#define ETH_SNAP_BT_SIG_OUI_1 0x19 -#define ETH_SNAP_BT_SIG_OUI_2 0x58 - -#define BOW_PROTOCOL_ID_SECURITY_FRAME 0x0003 - - -#if defined(MT6620) - #define CHIP_NAME "MT6620" -#elif defined(MT5931) - #define CHIP_NAME "MT5931" -#elif defined(MT6628) - #define CHIP_NAME "MT6628" -#endif - -#define DRV_NAME "["CHIP_NAME"]: " - -/* Define if target platform is Android. - * It should already be defined in Android kernel source - */ -#ifndef CONFIG_ANDROID -#define CONFIG_ANDROID 0 -#endif - -/* for CFG80211 IE buffering mechanism */ -#define CFG_CFG80211_IE_BUF_LEN (512) - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include /* constant of kernel version */ - -#include /* bitops.h */ - -#include /* struct timer_list */ -#include /* jiffies */ -#include /* udelay and mdelay macro */ - -#if CONFIG_ANDROID -#include -#endif - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 12) -#include /* IRQT_FALLING */ -#include /*for in_interrupt*/ -#endif - -#include /* struct net_device, struct net_device_stats */ -#include /* for eth_type_trans() function */ -#include /* struct iw_statistics */ -#include -#include /* struct in_device */ - -#include /* struct iphdr */ - -#include /* for memcpy()/memset() function */ -#include /* for offsetof() macro */ - -#include /* The proc filesystem constants/structures */ - -#include /* for rtnl_lock() and rtnl_unlock() */ -#include /* kthread_should_stop(), kthread_run() */ -#include /* for copy_from_user() */ -#include /* for firmware download */ -#include - -#include /* for kfifo interface */ -#include /* for cdev interface */ - -#include /* for firmware download */ - -#if defined(_HIF_SDIO) -#include -#include -#endif - -#include - - -#include /* readw and writew */ - -#if WIRELESS_EXT > 12 -#include -#endif - -#include "version.h" -#include "config.h" - -#if CFG_ENABLE_WIFI_DIRECT_CFG_80211 -#include -#include -#endif - -#include - -#include "gl_typedef.h" -#include "typedef.h" -#include "queue.h" -#include "gl_kal.h" -#if CFG_CHIP_RESET_SUPPORT - #include "gl_rst.h" -#endif -#include "hif.h" - - -#include "debug.h" - -#include "wlan_lib.h" -#include "wlan_oid.h" - -#if CFG_ENABLE_AEE_MSG -#include -#endif - -extern BOOLEAN fgIsBusAccessFailed; - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define GLUE_FLAG_HALT BIT(0) -#define GLUE_FLAG_INT BIT(1) -#define GLUE_FLAG_OID BIT(2) -#define GLUE_FLAG_TIMEOUT BIT(3) -#define GLUE_FLAG_TXREQ BIT(4) -#define GLUE_FLAG_SUB_MOD_INIT BIT(5) -#define GLUE_FLAG_SUB_MOD_EXIT BIT(6) -#define GLUE_FLAG_SUB_MOD_MULTICAST BIT(7) -#define GLUE_FLAG_FRAME_FILTER BIT(8) -#define GLUE_FLAG_HALT_BIT (0) -#define GLUE_FLAG_INT_BIT (1) -#define GLUE_FLAG_OID_BIT (2) -#define GLUE_FLAG_TIMEOUT_BIT (3) -#define GLUE_FLAG_TXREQ_BIT (4) -#define GLUE_FLAG_SUB_MOD_INIT_BIT (5) -#define GLUE_FLAG_SUB_MOD_EXIT_BIT (6) -#define GLUE_FLAG_SUB_MOD_MULTICAST_BIT (7) -#define GLUE_FLAG_FRAME_FILTER_BIT (8) - - - -#define GLUE_BOW_KFIFO_DEPTH (1024) -//#define GLUE_BOW_DEVICE_NAME "MT6620 802.11 AMP" -#define GLUE_BOW_DEVICE_NAME "ampc0" - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef struct _GL_WPA_INFO_T { - UINT_32 u4WpaVersion; - UINT_32 u4KeyMgmt; - UINT_32 u4CipherGroup; - UINT_32 u4CipherPairwise; - UINT_32 u4AuthAlg; - BOOLEAN fgPrivacyInvoke; -#if CFG_SUPPORT_802_11W - UINT_32 u4Mfp; -#endif -} GL_WPA_INFO_T, *P_GL_WPA_INFO_T; - -typedef enum _ENUM_RSSI_TRIGGER_TYPE { - ENUM_RSSI_TRIGGER_NONE, - ENUM_RSSI_TRIGGER_GREATER, - ENUM_RSSI_TRIGGER_LESS, - ENUM_RSSI_TRIGGER_TRIGGERED, - ENUM_RSSI_TRIGGER_NUM -} ENUM_RSSI_TRIGGER_TYPE; - -#if CFG_ENABLE_WIFI_DIRECT -typedef enum _ENUM_SUB_MODULE_IDX_T { - P2P_MODULE = 0, - SUB_MODULE_NUM -} ENUM_SUB_MODULE_IDX_T; - -typedef enum _ENUM_NET_REG_STATE_T { - ENUM_NET_REG_STATE_UNREGISTERED, - ENUM_NET_REG_STATE_REGISTERING, - ENUM_NET_REG_STATE_REGISTERED, - ENUM_NET_REG_STATE_UNREGISTERING, - ENUM_NET_REG_STATE_NUM -} ENUM_NET_REG_STATE_T; - -#endif - -typedef struct _GL_IO_REQ_T { - QUE_ENTRY_T rQueEntry; - //wait_queue_head_t cmdwait_q; - BOOL fgRead; - BOOL fgWaitResp; -#if CFG_ENABLE_WIFI_DIRECT - BOOL fgIsP2pOid; -#endif - P_ADAPTER_T prAdapter; - PFN_OID_HANDLER_FUNC pfnOidHandler; - PVOID pvInfoBuf; - UINT_32 u4InfoBufLen; - PUINT_32 pu4QryInfoLen; - WLAN_STATUS rStatus; - UINT_32 u4Flag; -} GL_IO_REQ_T, *P_GL_IO_REQ_T; - -#if CFG_ENABLE_BT_OVER_WIFI -typedef struct _GL_BOW_INFO { - BOOLEAN fgIsRegistered; - dev_t u4DeviceNumber; /* dynamic device number */ -// struct kfifo *prKfifo; /* for buffering indicated events */ - struct kfifo rKfifo; /* for buffering indicated events */ - spinlock_t rSpinLock; /* spin lock for kfifo */ - struct cdev cdev; - UINT_32 u4FreqInKHz; /* frequency */ - - UINT_8 aucRole[CFG_BOW_PHYSICAL_LINK_NUM]; /* 0: Responder, 1: Initiator */ - ENUM_BOW_DEVICE_STATE aeState[CFG_BOW_PHYSICAL_LINK_NUM]; - PARAM_MAC_ADDRESS arPeerAddr[CFG_BOW_PHYSICAL_LINK_NUM]; - - wait_queue_head_t outq; - - #if CFG_BOW_SEPARATE_DATA_PATH - /* Device handle */ - struct net_device *prDevHandler; - BOOLEAN fgIsNetRegistered; - #endif - -} GL_BOW_INFO, *P_GL_BOW_INFO; -#endif - -/* -* type definition of pointer to p2p structure -*/ -typedef struct _GL_P2P_INFO_T GL_P2P_INFO_T, *P_GL_P2P_INFO_T; - -struct _GLUE_INFO_T { - /* Device handle */ - struct net_device *prDevHandler; - - /* Device Index(index of arWlanDevInfo[]) */ - INT_32 i4DevIdx; - - /* Device statistics */ - struct net_device_stats rNetDevStats; - - /* Wireless statistics struct net_device */ - struct iw_statistics rIwStats; - - /* spinlock to sync power save mechanism */ - spinlock_t rSpinLock[SPIN_LOCK_NUM]; - - /* semaphore for ioctl */ - struct semaphore ioctl_sem; - - UINT_32 u4Flag; /* GLUE_FLAG_XXX */ - UINT_32 u4PendFlag; - //UINT_32 u4TimeoutFlag; - UINT_32 u4OidCompleteFlag; - UINT_32 u4ReadyFlag; /* check if card is ready */ - - /* Number of pending frames, also used for debuging if any frame is - * missing during the process of unloading Driver. - * - * NOTE(Kevin): In Linux, we also use this variable as the threshold - * for manipulating the netif_stop(wake)_queue() func. - */ - INT_32 ai4TxPendingFrameNumPerQueue[4][CFG_MAX_TXQ_NUM]; - INT_32 i4TxPendingFrameNum; - INT_32 i4TxPendingSecurityFrameNum; - - /* current IO request for kalIoctl */ - GL_IO_REQ_T OidEntry; - - /* registry info*/ - REG_INFO_T rRegInfo; - - /* firmware */ - struct firmware *prFw; - - /* Host interface related information */ - /* defined in related hif header file */ - GL_HIF_INFO_T rHifInfo; - - /*! \brief wext wpa related information */ - GL_WPA_INFO_T rWpaInfo; - - - /* Pointer to ADAPTER_T - main data structure of internal protocol stack */ - P_ADAPTER_T prAdapter; - -#ifdef WLAN_INCLUDE_PROC - struct proc_dir_entry *pProcRoot; -#endif /* WLAN_INCLUDE_PROC */ - - /* Indicated media state */ - ENUM_PARAM_MEDIA_STATE_T eParamMediaStateIndicated; - - /* Device power state D0~D3 */ - PARAM_DEVICE_POWER_STATE ePowerState; - - struct completion rScanComp; /* indicate scan complete */ - struct completion rHaltComp; /* indicate main thread halt complete */ - struct completion rPendComp; /* indicate main thread halt complete */ -#if CFG_ENABLE_WIFI_DIRECT - struct completion rSubModComp; /*indicate sub module init or exit complete*/ -#endif - WLAN_STATUS rPendStatus; - - QUE_T rTxQueue; - - - /* OID related */ - QUE_T rCmdQueue; - //PVOID pvInformationBuffer; - //UINT_32 u4InformationBufferLength; - //PVOID pvOidEntry; - //PUINT_8 pucIOReqBuff; - //QUE_T rIOReqQueue; - //QUE_T rFreeIOReqQueue; - - wait_queue_head_t waitq; - struct task_struct *main_thread; - - struct timer_list tickfn; - - -#if CFG_SUPPORT_EXT_CONFIG - UINT_16 au2ExtCfg[256]; /* NVRAM data buffer */ - UINT_32 u4ExtCfgLength; /* 0 means data is NOT valid */ -#endif - -#if 1//CFG_SUPPORT_WAPI - /* Should be large than the PARAM_WAPI_ASSOC_INFO_T */ - UINT_8 aucWapiAssocInfoIEs[42]; - UINT_16 u2WapiAssocInfoIESz; -#endif - -#if CFG_ENABLE_BT_OVER_WIFI - GL_BOW_INFO rBowInfo; -#endif - -#if CFG_ENABLE_WIFI_DIRECT - P_GL_P2P_INFO_T prP2PInfo; -#if CFG_SUPPORT_P2P_RSSI_QUERY - /* Wireless statistics struct net_device */ - struct iw_statistics rP2pIwStats; -#endif -#endif - BOOLEAN fgWpsActive; - UINT_8 aucWSCIE[500]; /*for probe req*/ - UINT_16 u2WSCIELen; - UINT_8 aucWSCAssocInfoIE[200]; /*for Assoc req*/ - UINT_16 u2WSCAssocInfoIELen; - - /* NVRAM availability */ - BOOLEAN fgNvramAvailable; - - BOOLEAN fgMcrAccessAllowed; - - /* MAC Address Overriden by IOCTL */ - BOOLEAN fgIsMacAddrOverride; - PARAM_MAC_ADDRESS rMacAddrOverride; - - SET_TXPWR_CTRL_T rTxPwr; - - /* for cfg80211 scan done indication */ - struct cfg80211_scan_request *prScanRequest; - - /* to indicate registered or not */ - BOOLEAN fgIsRegistered; - - /* for cfg80211 connected indication */ - UINT_32 u4RspIeLength; - UINT_8 aucRspIe[CFG_CFG80211_IE_BUF_LEN]; - - UINT_32 u4ReqIeLength; - UINT_8 aucReqIe[CFG_CFG80211_IE_BUF_LEN]; -}; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) - /* linux 2.4 */ - typedef void (*PFN_WLANISR)(int irq, void *dev_id, struct pt_regs *regs); -#else - typedef irqreturn_t (*PFN_WLANISR)(int irq, void *dev_id, struct pt_regs *regs); -#endif - -typedef void (*PFN_LINUX_TIMER_FUNC)(unsigned long); - - -/* generic sub module init/exit handler -* now, we only have one sub module, p2p -*/ -#if CFG_ENABLE_WIFI_DIRECT -typedef BOOLEAN (*SUB_MODULE_INIT)(P_GLUE_INFO_T prGlueInfo); -typedef BOOLEAN (*SUB_MODULE_EXIT)(P_GLUE_INFO_T prGlueInfo); - -typedef struct _SUB_MODULE_HANDLER { - SUB_MODULE_INIT subModInit; - SUB_MODULE_EXIT subModExit; - BOOLEAN fgIsInited; -} SUB_MODULE_HANDLER, *P_SUB_MODULE_HANDLER; - -#endif - -#if CONFIG_NL80211_TESTMODE - -typedef struct _NL80211_DRIVER_TEST_MODE_PARAMS { - UINT_32 index; - UINT_32 buflen; -} NL80211_DRIVER_TEST_MODE_PARAMS, *P_NL80211_DRIVER_TEST_MODE_PARAMS; - -/*SW CMD */ -typedef struct _NL80211_DRIVER_SW_CMD_PARAMS { - NL80211_DRIVER_TEST_MODE_PARAMS hdr; - UINT_8 set; - unsigned long adr; - unsigned long data; -}NL80211_DRIVER_SW_CMD_PARAMS, *P_NL80211_DRIVER_SW_CMD_PARAMS; - -struct iw_encode_exts { - __u32 ext_flags; /*!< IW_ENCODE_EXT_* */ - __u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /*!< LSB first */ - __u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /*!< LSB first */ - __u8 addr[MAC_ADDR_LEN]; /*!< ff:ff:ff:ff:ff:ff for broadcast/multicast - * (group) keys or unicast address for - * individual keys */ - __u16 alg; /*!< IW_ENCODE_ALG_* */ - __u16 key_len; - __u8 key[32]; -}; - -/*SET KEY EXT */ -typedef struct _NL80211_DRIVER_SET_KEY_EXTS { - NL80211_DRIVER_TEST_MODE_PARAMS hdr; - UINT_8 key_index; - UINT_8 key_len; - struct iw_encode_exts ext; -}NL80211_DRIVER_SET_KEY_EXTS, *P_NL80211_DRIVER_SET_KEY_EXTS; - - -#endif - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Macros of SPIN LOCK operations for using in Glue Layer */ -/*----------------------------------------------------------------------------*/ -#if CFG_USE_SPIN_LOCK_BOTTOM_HALF - #define GLUE_SPIN_LOCK_DECLARATION() - #define GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, rLockCategory) \ - { \ - if (rLockCategory < SPIN_LOCK_NUM) \ - spin_lock_bh(&(prGlueInfo->rSpinLock[rLockCategory])); \ - } - #define GLUE_RELEASE_SPIN_LOCK(prGlueInfo, rLockCategory) \ - { \ - if (rLockCategory < SPIN_LOCK_NUM) \ - spin_unlock_bh(&(prGlueInfo->rSpinLock[rLockCategory])); \ - } -#else /* !CFG_USE_SPIN_LOCK_BOTTOM_HALF */ - #define GLUE_SPIN_LOCK_DECLARATION() UINT_32 __u4Flags = 0 - #define GLUE_ACQUIRE_SPIN_LOCK(prGlueInfo, rLockCategory) \ - { \ - if (rLockCategory < SPIN_LOCK_NUM) \ - spin_lock_irqsave(&(prGlueInfo)->rSpinLock[rLockCategory], __u4Flags); \ - } - #define GLUE_RELEASE_SPIN_LOCK(prGlueInfo, rLockCategory) \ - { \ - if (rLockCategory < SPIN_LOCK_NUM) \ - spin_unlock_irqrestore(&(prGlueInfo->rSpinLock[rLockCategory]), __u4Flags); \ - } -#endif /* !CFG_USE_SPIN_LOCK_BOTTOM_HALF */ - - -/*----------------------------------------------------------------------------*/ -/* Macros for accessing Reserved Fields of native packet */ -/*----------------------------------------------------------------------------*/ -#define GLUE_GET_PKT_QUEUE_ENTRY(_p) \ - (&( ((struct sk_buff *)(_p))->cb[0] )) - -#define GLUE_GET_PKT_DESCRIPTOR(_prQueueEntry) \ - ((P_NATIVE_PACKET) ((UINT_32)_prQueueEntry - offsetof(struct sk_buff, cb[0])) ) - -#define GLUE_SET_PKT_FLAG_802_11(_p) \ - (*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) |= BIT(7)) - -#define GLUE_SET_PKT_FLAG_1X(_p) \ - (*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) |= BIT(6)) - -#define GLUE_SET_PKT_FLAG_PAL(_p) \ - (*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) |= BIT(5)) - -#define GLUE_SET_PKT_FLAG_P2P(_p) \ - (*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) |= BIT(4)) - - - -#define GLUE_SET_PKT_TID(_p, _tid) \ - (*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) |= (((UINT_8)((_tid) & (BITS(0,3)))))) - - -#define GLUE_SET_PKT_FRAME_LEN(_p, _u2PayloadLen) \ - (*((PUINT_16) &( ((struct sk_buff *)(_p))->cb[6] )) = (UINT_16)(_u2PayloadLen)) - -#define GLUE_GET_PKT_FRAME_LEN(_p) \ - (*((PUINT_16) &( ((struct sk_buff *)(_p))->cb[6] )) ) - - -#define GLUE_GET_PKT_IS_802_11(_p) \ - ((*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) ) & (BIT(7))) - -#define GLUE_GET_PKT_IS_1X(_p) \ - ((*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) ) & (BIT(6))) - -#define GLUE_GET_PKT_TID(_p) \ - ((*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) ) & (BITS(0,3))) - - -#define GLUE_GET_PKT_IS_PAL(_p) \ - ((*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) ) & (BIT(5))) - -#define GLUE_GET_PKT_IS_P2P(_p) \ - ((*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[4] )) ) & (BIT(4))) - - -#define GLUE_SET_PKT_HEADER_LEN(_p, _ucMacHeaderLen) \ - (*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[5] )) = (UINT_8)(_ucMacHeaderLen)) - -#define GLUE_GET_PKT_HEADER_LEN(_p) \ - (*((PUINT_8) &( ((struct sk_buff *)(_p))->cb[5] )) ) - -#define GLUE_SET_PKT_ARRIVAL_TIME(_p, _rSysTime) \ - (*((POS_SYSTIME) &( ((struct sk_buff *)(_p))->cb[8] )) = (OS_SYSTIME)(_rSysTime)) - -#define GLUE_GET_PKT_ARRIVAL_TIME(_p) \ - (*((POS_SYSTIME) &( ((struct sk_buff *)(_p))->cb[8] )) ) - -/* Check validity of prDev, private data, and pointers */ -#define GLUE_CHK_DEV(prDev) \ - ((prDev && *((P_GLUE_INFO_T *) netdev_priv(prDev))) ? TRUE : FALSE) - -#define GLUE_CHK_PR2(prDev, pr2) \ - ((GLUE_CHK_DEV(prDev) && pr2) ? TRUE : FALSE) - -#define GLUE_CHK_PR3(prDev, pr2, pr3) \ - ((GLUE_CHK_PR2(prDev, pr2) && pr3) ? TRUE : FALSE) - -#define GLUE_CHK_PR4(prDev, pr2, pr3, pr4) \ - ((GLUE_CHK_PR3(prDev, pr2, pr3) && pr4) ? TRUE : FALSE) - -#define GLUE_SET_EVENT(pr) \ - kalSetEvent(pr) - -#define GLUE_INC_REF_CNT(_refCount) atomic_inc((atomic_t *)&(_refCount)) -#define GLUE_DEC_REF_CNT(_refCount) atomic_dec((atomic_t *)&(_refCount)) - - -#define DbgPrint(...) -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -#ifdef WLAN_INCLUDE_PROC -INT_32 -procRemoveProcfs ( - struct net_device *prDev, - char *pucDevName - ); - -INT_32 -procInitProcfs ( - struct net_device *prDev, - char *pucDevName - ); -#endif /* WLAN_INCLUDE_PROC */ - -#if CFG_ENABLE_BT_OVER_WIFI -BOOLEAN -glRegisterAmpc ( - P_GLUE_INFO_T prGlueInfo - ); - -BOOLEAN -glUnregisterAmpc ( - P_GLUE_INFO_T prGlueInfo - ); -#endif - -#if CFG_ENABLE_WIFI_DIRECT - -VOID -wlanSubModRunInit( - P_GLUE_INFO_T prGlueInfo - ); - -VOID -wlanSubModRunExit( - P_GLUE_INFO_T prGlueInfo - ); - -BOOLEAN -wlanSubModInit( - P_GLUE_INFO_T prGlueInfo - ); - -BOOLEAN -wlanSubModExit( - P_GLUE_INFO_T prGlueInfo - ); - -VOID -wlanSubModRegisterInitExit( - SUB_MODULE_INIT rSubModInit, - SUB_MODULE_EXIT rSubModExit, - ENUM_SUB_MODULE_IDX_T eSubModIdx - ); - -BOOLEAN -wlanExportGlueInfo( - P_GLUE_INFO_T *prGlueInfoExpAddr - ); - -BOOLEAN -wlanIsLaunched( - VOID - ); - -void -p2pSetMulticastListWorkQueueWrapper( - P_GLUE_INFO_T prGlueInfo - ); - - - -#endif - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _GL_OS_H */ - diff --git a/drivers/net/wireless/mt5931/os/linux/include/gl_p2p_ioctl.h b/drivers/net/wireless/mt5931/os/linux/include/gl_p2p_ioctl.h deleted file mode 100755 index 6e8bd2a3bbf1..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/include/gl_p2p_ioctl.h +++ /dev/null @@ -1,1088 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/os/linux/include/gl_p2p_ioctl.h#9 $ -*/ - -/*! \file gl_p2p_ioctl.h - \brief This file is for custom ioctls for Wi-Fi Direct only -*/ - - - -/* -** $Log: gl_p2p_ioctl.h $ -** -** 07 26 2012 yuche.tsai -** [ALPS00324337] [ALPS.JB][Hot-Spot] Driver update for Hot-Spot -** Update driver code of ALPS.JB for hot-spot. -** -** 07 19 2012 yuche.tsai -** NULL -** Code update for JB. - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 06 07 2011 yuche.tsai - * [WCXRP00000763] [Volunteer Patch][MT6620][Driver] RX Service Discovery Frame under AP mode Issue - * Fix RX SD request under AP mode issue. - * - * 03 25 2011 wh.su - * NULL - * Fix P2P IOCTL of multicast address bug, add low power driver stop control. - * - * 11 22 2011 yuche.tsai - * NULL - * Update RSSI link quality of P2P Network query method. (Bug fix) - * - * 11 19 2011 yuche.tsai - * NULL - * Add RSSI support for P2P network. - * - * 11 11 2011 yuche.tsai - * NULL - * Fix work thread cancel issue. - * - * 11 08 2011 yuche.tsai - * [WCXRP00001094] [Volunteer Patch][Driver] Driver version & supplicant version query & set support for service discovery version check. - * Add support for driver version query & p2p supplicant verseion set. - * For new service discovery mechanism sync. - * - * 10 25 2011 cm.chang - * [WCXRP00001058] [All Wi-Fi][Driver] Fix sta_rec's phyTypeSet and OBSS scan in AP mode - * . - * - * 10 18 2011 yuche.tsai - * [WCXRP00001045] [WiFi Direct][Driver] Check 2.1 branch. - * New 2.1 branch - - * - * 08 16 2011 chinglan.wang - * NULL - * Add the group id information in the invitation indication. - * - * 08 09 2011 yuche.tsai - * [WCXRP00000919] [Volunteer Patch][WiFi Direct][Driver] Invitation New Feature. - * Invitation Feature add on. - * - * 05 04 2011 chinglan.wang - * [WCXRP00000698] [MT6620 Wi-Fi][P2P][Driver] Add p2p invitation command for the p2p driver - * . - * - * 03 29 2011 wh.su - * [WCXRP00000095] [MT6620 Wi-Fi] [FW] Refine the P2P GO send broadcast protected code - * add the set power and get power function sample. - * - * 03 22 2011 george.huang - * [WCXRP00000504] [MT6620 Wi-Fi][FW] Support Sigma CAPI for power saving related command - * link with supplicant commands - * - * 03 07 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * rename the define to anti_pviracy. - * - * 03 02 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * Add Security check related code. - * - * 03 01 2011 wh.su - * [WCXRP00000488] [MT6620 Wi-Fi][Driver] Support the SIGMA set p2p parameter to driver - * fixed the ioctl sumcmd to meet the p2p_supplicant setting. - * - * 02 23 2011 wh.su - * [WCXRP00000488] [MT6620 Wi-Fi][Driver] Support the SIGMA set p2p parameter to driver - * adding the ioctl set int define for p2p parameter. - * - * 02 22 2011 wh.su - * [WCXRP00000488] [MT6620 Wi-Fi][Driver] Support the SIGMA set p2p parameter to driver - * adding the ioctl set int from supplicant, and can used to set the p2p paramters - * - * 02 17 2011 wh.su - * [WCXRP00000448] [MT6620 Wi-Fi][Driver] Fixed WSC IE not send out at probe request - * adjust the set wsc ie structure. - * - * 01 05 2011 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * ioctl implementations for P2P Service Discovery - * - * 12 22 2010 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * 1. header file restructure for more clear module isolation - * 2. add function interface definition for implementing Service Discovery callbacks - * - * 12 15 2010 cp.wu - * NULL - * invoke nicEnableInterrupt() before leaving from wlanAdapterStart() - * - * 12 07 2010 cp.wu - * [WCXRP00000237] [MT6620 Wi-Fi][Wi-Fi Direct][Driver] Add interface for supporting service discovery - * define a pair of i/o control for multiplexing layer - * - * 11 04 2010 wh.su - * [WCXRP00000164] [MT6620 Wi-Fi][Driver] Support the p2p random SSID - * adding the p2p random ssid support. - * - * 10 20 2010 wh.su - * [WCXRP00000124] [MT6620 Wi-Fi] [Driver] Support the dissolve P2P Group - * Add the code to support disconnect p2p group - * - * 09 21 2010 kevin.huang - * [WCXRP00000054] [MT6620 Wi-Fi][Driver] Restructure driver for second Interface - * Isolate P2P related function for Hardware Software Bundle - * - * 09 10 2010 george.huang - * NULL - * update iwpriv LP related - * - * 09 07 2010 wh.su - * NULL - * adding the code for beacon/probe req/ probe rsp wsc ie at p2p. - * - * 08 25 2010 cp.wu - * NULL - * add netdev_ops(NDO) for linux kernel 2.6.31 or greater - * - * 08 20 2010 yuche.tsai - * NULL - * Refine a function parameter name. - * - * 08 19 2010 cp.wu - * NULL - * add set mac address interface for further possibilities of wpa_supplicant overriding interface address. - * - * 08 16 2010 george.huang - * NULL - * add wext handlers to link P2P set PS profile/ network address function (TBD) - * - * 08 16 2010 cp.wu - * NULL - * revised implementation of Wi-Fi Direct io controls. - * - * 08 12 2010 cp.wu - * NULL - * follow-up with ioctl interface update for Wi-Fi Direct application - * - * 08 06 2010 cp.wu - * NULL - * driver hook modifications corresponding to ioctl interface change. - * - * 08 03 2010 cp.wu - * NULL - * [Wi-Fi Direct] add framework for driver hooks - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 06 01 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add ioctl to configure scan mode for p2p connection - * - * 05 31 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add cfg80211 interface, which is to replace WE, for further extension - * - * 05 17 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * implement get scan result. - * - * 05 14 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * implement wireless extension ioctls in iw_handler form. - * - * 05 14 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add ioctl framework for Wi-Fi Direct by reusing wireless extension ioctls as well - * - * 05 11 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * p2p ioctls revised. - * - * 05 11 2010 cp.wu - * [WPD00003831][MT6620 Wi-Fi] Add framework for Wi-Fi Direct support - * add ioctl for controlling p2p scan phase parameters - * -*/ - -#ifndef _GL_P2P_IOCTL_H -#define _GL_P2P_IOCTL_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include -#include -#include -#if CFG_ENABLE_WIFI_DIRECT_CFG_80211 - #include - #include -#endif - -#include "wlan_oid.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -// (WirelessExtension) Private I/O Controls -#define IOC_P2P_CFG_DEVICE (SIOCIWFIRSTPRIV+0) -#define IOC_P2P_PROVISION_COMPLETE (SIOCIWFIRSTPRIV+2) -#define IOC_P2P_START_STOP_DISCOVERY (SIOCIWFIRSTPRIV+4) -#define IOC_P2P_DISCOVERY_RESULTS (SIOCIWFIRSTPRIV+5) -#define IOC_P2P_WSC_BEACON_PROBE_RSP_IE (SIOCIWFIRSTPRIV+6) -#define IOC_P2P_GO_WSC_IE IOC_P2P_WSC_BEACON_PROBE_RSP_IE -#define IOC_P2P_CONNECT_DISCONNECT (SIOCIWFIRSTPRIV+8) -#define IOC_P2P_PASSWORD_READY (SIOCIWFIRSTPRIV+10) -//#define IOC_P2P_SET_PWR_MGMT_PARAM (SIOCIWFIRSTPRIV+12) -#define IOC_P2P_SET_INT (SIOCIWFIRSTPRIV+12) -#define IOC_P2P_GET_STRUCT (SIOCIWFIRSTPRIV+13) -#define IOC_P2P_SET_STRUCT (SIOCIWFIRSTPRIV+14) -#define IOC_P2P_GET_REQ_DEVICE_INFO (SIOCIWFIRSTPRIV+15) - -#define PRIV_CMD_INT_P2P_SET 0 - -// IOC_P2P_PROVISION_COMPLETE (iw_point . flags) -#define P2P_PROVISIONING_SUCCESS 0 -#define P2P_PROVISIONING_FAIL 1 - -// IOC_P2P_START_STOP_DISCOVERY (iw_point . flags) -#define P2P_STOP_DISCOVERY 0 -#define P2P_START_DISCOVERY 1 - -// IOC_P2P_CONNECT_DISCONNECT (iw_point . flags) -#define P2P_CONNECT 0 -#define P2P_DISCONNECT 1 - -// IOC_P2P_START_STOP_DISCOVERY (scan_type) -#define P2P_SCAN_FULL_AND_FIND 0 -#define P2P_SCAN_FULL 1 -#define P2P_SCAN_SEARCH_AND_LISTEN 2 -#define P2P_LISTEN 3 - -// IOC_P2P_GET_STRUCT/IOC_P2P_SET_STRUCT -#define P2P_SEND_SD_RESPONSE 0 -#define P2P_GET_SD_REQUEST 1 -#define P2P_SEND_SD_REQUEST 2 -#define P2P_GET_SD_RESPONSE 3 -#define P2P_TERMINATE_SD_PHASE 4 - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/*----------------------------------------------------------------------------*/ -/* Wireless Extension: Private I/O Control */ -/*----------------------------------------------------------------------------*/ -typedef struct iw_p2p_cfg_device_type { - void __user *ssid; - UINT_8 ssid_len; - UINT_8 pri_device_type[8]; - UINT_8 snd_device_type[8]; - void __user *device_name; - UINT_8 device_name_len; - UINT_8 intend; - UINT_8 persistence; - UINT_8 sec_mode; - UINT_8 ch; - UINT_8 ch_width; /* 0: 20 Mhz 1:20/40 Mhz auto */ - UINT_8 max_scb; -} IW_P2P_CFG_DEVICE_TYPE, *P_IW_P2P_CFG_DEVICE_TYPE; - -typedef struct iw_p2p_hostapd_param { - UINT_8 cmd; - UINT_8 rsv[3]; - UINT_8 sta_addr[6]; - void __user *data; - UINT_16 len; -} IW_P2P_HOSTAPD_PARAM, *P_IW_P2P_HOSTAPD_PARAM; - -typedef struct iw_p2p_req_device_type { - UINT_8 scan_type; /* 0: Full scan + Find - * 1: Full scan - * 2: Scan (Search +Listen) - * 3: Listen - * other : reserved - */ - UINT_8 pri_device_type[8]; - void __user *probe_req_ie; - UINT_16 probe_req_len; - void __user *probe_rsp_ie; - UINT_16 probe_rsp_len; -} IW_P2P_REQ_DEVICE_TYPE, *P_IW_P2P_REQ_DEVICE_TYPE; - -typedef struct iw_p2p_connect_device { - UINT_8 sta_addr[6]; - UINT_8 p2pRole; /* 0: P2P Device, 1:GC, 2: GO */ - UINT_8 needProvision; /* 0: Don't needed provision, 1: doing the wsc provision first */ - UINT_8 authPeer; /* 1: auth peer invitation request */ - UINT_8 intend_config_method; /* Request Peer Device used config method */ -} IW_P2P_CONNECT_DEVICE, *P_IW_P2P_CONNECT_DEVICE; - -typedef struct iw_p2p_password_ready { - UINT_8 active_config_method; - void __user *probe_req_ie; - UINT_16 probe_req_len; - void __user *probe_rsp_ie; - UINT_16 probe_rsp_len; -} IW_P2P_PASSWORD_READY, *P_IW_P2P_PASSWORD_READY; - -typedef struct iw_p2p_device_req { - UINT_8 name[33]; - UINT_32 name_len; - UINT_8 device_addr[6]; - UINT_8 device_type; - INT_32 config_method; - INT_32 active_config_method; -} IW_P2P_DEVICE_REQ, *P_IW_P2P_DEVICE_REQ; - -typedef struct iw_p2p_transport_struct { - UINT_32 u4CmdId; - UINT_32 inBufferLength; - UINT_32 outBufferLength; - UINT_8 aucBuffer[16]; -} IW_P2P_TRANSPORT_STRUCT, *P_IW_P2P_TRANSPORT_STRUCT; - -// For Invitation -typedef struct iw_p2p_ioctl_invitation_struct { - UINT_8 aucDeviceID[6]; - UINT_8 aucGroupID[6]; // BSSID - UINT_8 aucSsid[32]; - UINT_32 u4SsidLen; - UINT_8 ucReinvoke; -} IW_P2P_IOCTL_INVITATION_STRUCT, *P_IW_P2P_IOCTL_INVITATION_STRUCT; - -typedef struct iw_p2p_ioctl_abort_invitation { - UINT_8 dev_addr[6]; -} IW_P2P_IOCTL_ABORT_INVITATION, *P_IW_P2P_IOCTL_ABORT_INVITATION; - -typedef struct iw_p2p_ioctl_invitation_indicate { - UINT_8 dev_addr[6]; - UINT_8 group_bssid[6]; - INT_32 config_method; /* peer device supported config method */ - UINT_8 dev_name[32]; /* for reinvoke */ - UINT_32 name_len; - UINT_8 operating_channel; /* for re-invoke, target operating channel */ - UINT_8 invitation_type; /* invitation or re-invoke */ -} IW_P2P_IOCTL_INVITATION_INDICATE, *P_IW_P2P_IOCTL_INVITATION_INDICATE; - -typedef struct iw_p2p_ioctl_invitation_status { - UINT_32 status_code; -} IW_P2P_IOCTL_INVITATION_STATUS, *P_IW_P2P_IOCTL_INVITATION_STATUS; - -//For Formation -typedef struct iw_p2p_ioctl_start_formation { - UINT_8 dev_addr[6]; /* bssid */ - UINT_8 role; /* 0: P2P Device, 1:GC, 2: GO */ - UINT_8 needProvision; /* 0: Don't needed provision, 1: doing the wsc provision first */ - UINT_8 auth; /* 1: auth peer invitation request */ - UINT_8 config_method; /* Request Peer Device used config method */ -}IW_P2P_IOCTL_START_FORMATION, *P_IW_P2P_IOCTL_START_FORMATION; - -/* SET_STRUCT / GET_STRUCT */ -typedef enum _ENUM_P2P_CMD_ID_T { - P2P_CMD_ID_SEND_SD_RESPONSE = 0, /* 0x00 (Set) */ - P2P_CMD_ID_GET_SD_REQUEST, /* 0x01 (Get) */ - P2P_CMD_ID_SEND_SD_REQUEST, /* 0x02 (Set) */ - P2P_CMD_ID_GET_SD_RESPONSE, /* 0x03 (Get) */ - P2P_CMD_ID_TERMINATE_SD_PHASE, /* 0x04 (Set) */ -#if 1 /* CFG_SUPPORT_ANTI_PIRACY */ - P2P_CMD_ID_SEC_CHECK, /* 0x05(Set) */ -#endif - P2P_CMD_ID_INVITATION, /* 0x06 (Set) */ - P2P_CMD_ID_INVITATION_INDICATE, /* 0x07 (Get) */ - P2P_CMD_ID_INVITATION_STATUS, /* 0x08 (Get) */ - P2P_CMD_ID_INVITATION_ABORT, /* 0x09 (Set) */ - P2P_CMD_ID_START_FORMATION, /* 0x0A (Set) */ - P2P_CMD_ID_P2P_VERSION, /* 0x0B (Set/Get) */ - P2P_CMD_ID_GET_CH_LIST = 12, /* 0x0C (Get) */ - P2P_CMD_ID_GET_OP_CH = 14 /* 0x0E (Get) */ -} ENUM_P2P_CMD_ID_T, *P_ENUM_P2P_CMD_ID_T; - -/* Service Discovery */ -typedef struct iw_p2p_cmd_send_sd_response { - PARAM_MAC_ADDRESS rReceiverAddr; - UINT_8 fgNeedTxDoneIndication; - UINT_8 ucSeqNum; - UINT_16 u2PacketLength; - UINT_8 aucPacketContent[0]; /*native 802.11*/ -} IW_P2P_CMD_SEND_SD_RESPONSE, *P_IW_P2P_CMD_SEND_SD_RESPONSE; - -typedef struct iw_p2p_cmd_get_sd_request { - PARAM_MAC_ADDRESS rTransmitterAddr; - UINT_16 u2PacketLength; - UINT_8 aucPacketContent[0]; /*native 802.11*/ -} IW_P2P_CMD_GET_SD_REQUEST, *P_IW_P2P_CMD_GET_SD_REQUEST; - -typedef struct iw_p2p_cmd_send_service_discovery_request { - PARAM_MAC_ADDRESS rReceiverAddr; - UINT_8 fgNeedTxDoneIndication; - UINT_8 ucSeqNum; - UINT_16 u2PacketLength; - UINT_8 aucPacketContent[0]; /*native 802.11*/ -} IW_P2P_CMD_SEND_SD_REQUEST, *P_IW_P2P_CMD_SEND_SD_REQUEST; - -typedef struct iw_p2p_cmd_get_sd_response { - PARAM_MAC_ADDRESS rTransmitterAddr; - UINT_16 u2PacketLength; - UINT_8 aucPacketContent[0]; /*native 802.11*/ -} IW_P2P_CMD_GET_SD_RESPONSE, *P_IW_P2P_CMD_GET_SD_RESPONSE; - -typedef struct iw_p2p_cmd_terminate_sd_phase { - PARAM_MAC_ADDRESS rPeerAddr; -} IW_P2P_CMD_TERMINATE_SD_PHASE, *P_IW_P2P_CMD_TERMINATE_SD_PHASE; - -typedef struct iw_p2p_version { - UINT_32 u4Version; -} IW_P2P_VERSION, *P_IW_P2P_VERSION; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -/* Macros used for cfg80211 */ -#define RATETAB_ENT(_rate, _rateid, _flags) \ - { \ - .bitrate = (_rate), \ - .hw_value = (_rateid), \ - .flags = (_flags), \ - } - -#define CHAN2G(_channel, _freq, _flags) \ - { \ - .band = IEEE80211_BAND_2GHZ, \ - .center_freq = (_freq), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ - } - -#define CHAN5G(_channel, _flags) \ - { \ - .band = IEEE80211_BAND_5GHZ, \ - .center_freq = 5000 + (5 * (_channel)), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 30, \ - } - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32) && (CFG_ENABLE_WIFI_DIRECT_CFG_80211 != 0) -int mtk_p2p_cfg80211_change_iface( - struct wiphy *wiphy, - struct net_device *ndev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params - ); - -int mtk_p2p_cfg80211_add_key( - struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, - bool pairwise, - const u8 *mac_addr, - struct key_params *params - ); - -int mtk_p2p_cfg80211_get_key( - struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, - bool pairwise, - const u8 *mac_addr, - void *cookie, - void (*callback)(void *cookie, struct key_params*) - ); - -int mtk_p2p_cfg80211_del_key( - struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, - bool pairwise, - const u8 *mac_addr - ); - -int -mtk_p2p_cfg80211_set_default_key( - struct wiphy *wiphy, - struct net_device *netdev, - u8 key_index, - bool unicast, - bool multicast - ); - - -int mtk_p2p_cfg80211_get_station( - struct wiphy *wiphy, - struct net_device *ndev, - u8 *mac, - struct station_info *sinfo - ); - -int mtk_p2p_cfg80211_scan( - struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_scan_request *request - ); - -int mtk_p2p_cfg80211_set_wiphy_params( - struct wiphy *wiphy, - u32 changed - ); - -int mtk_p2p_cfg80211_connect( - struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_connect_params *sme - ); - -int mtk_p2p_cfg80211_disconnect( - struct wiphy *wiphy, - struct net_device *dev, - u16 reason_code - ); - -int mtk_p2p_cfg80211_join_ibss( - struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_ibss_params *params - ); - -int mtk_p2p_cfg80211_leave_ibss( - struct wiphy *wiphy, - struct net_device *dev - ); - -int mtk_p2p_cfg80211_set_txpower( - struct wiphy *wiphy, - enum nl80211_tx_power_setting type, - int mbm - ); - -int mtk_p2p_cfg80211_get_txpower( - struct wiphy *wiphy, - int *dbm - ); - -int mtk_p2p_cfg80211_set_power_mgmt( - struct wiphy *wiphy, - struct net_device *dev, - bool enabled, - int timeout - ); - -int -mtk_p2p_cfg80211_change_bss( - struct wiphy * wiphy, - struct net_device * dev, - struct bss_parameters * params - ); - -int -mtk_p2p_cfg80211_remain_on_channel( - struct wiphy * wiphy, - struct net_device * dev, - struct ieee80211_channel * chan, - enum nl80211_channel_type channel_type, - unsigned int duration, - u64 * cookie - ); - -int -mtk_p2p_cfg80211_cancel_remain_on_channel( - struct wiphy * wiphy, - struct net_device * dev, - u64 cookie - ); - -int -mtk_p2p_cfg80211_deauth( - struct wiphy * wiphy, - struct net_device * dev, - struct cfg80211_deauth_request * req -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) - , void *cookie -#endif - ); - - -int -mtk_p2p_cfg80211_disassoc( - struct wiphy * wiphy, - struct net_device * dev, - struct cfg80211_disassoc_request * req -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) - , void *cookie -#endif - ); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - -int -mtk_p2p_cfg80211_start_ap( - struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_ap_settings *settings - ); - - -int -mtk_p2p_cfg80211_change_beacon( - struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_beacon_data *info - ); - -int -mtk_p2p_cfg80211_mgmt_tx( - struct wiphy *wiphy, - struct net_device *dev, - struct ieee80211_channel *chan, - bool offchan, - enum nl80211_channel_type channel_type, - bool channel_type_valid, - unsigned int wait, - const u8 *buf, - size_t len, - bool no_cck, - bool dont_wait_for_ack, - u64 *cookie); - -#else -int -mtk_p2p_cfg80211_add_set_beacon( - struct wiphy *wiphy, - struct net_device *dev, - struct beacon_parameters *info - ); - -int -mtk_p2p_cfg80211_mgmt_tx( - struct wiphy * wiphy, - struct net_device * dev, - struct ieee80211_channel * chan, - bool offchan, - enum nl80211_channel_type channel_type, - bool channel_type_valid, - unsigned int wait, - const u8 * buf, - size_t len, - u64 *cookie - ); - -#endif - - -int -mtk_p2p_cfg80211_stop_ap( - struct wiphy * wiphy, - struct net_device * dev - ); - - - -int -mtk_p2p_cfg80211_del_station( - struct wiphy * wiphy, - struct net_device * dev, - u8 * mac - ); - -int -mtk_p2p_cfg80211_set_channel( - IN struct wiphy * wiphy, - IN struct net_device * dev, - IN struct ieee80211_channel * chan, - IN enum nl80211_channel_type channel_type - ); - -int -mtk_p2p_cfg80211_set_bitrate_mask( - IN struct wiphy *wiphy, - IN struct net_device *dev, - IN const u8 *peer, - IN const struct cfg80211_bitrate_mask *mask - ); - - -void -mtk_p2p_cfg80211_mgmt_frame_register( - IN struct wiphy *wiphy, - IN struct net_device *dev, - IN u16 frame_type, - IN bool reg - ); - -#if CONFIG_NL80211_TESTMODE -int -mtk_p2p_cfg80211_testmode_cmd( - IN struct wiphy *wiphy, - IN void *data, - IN int len - ); -int -mtk_p2p_cfg80211_testmode_p2p_sigma_pre_cmd( - IN struct wiphy *wiphy, - IN void *data, - IN int len - ); -int -mtk_p2p_cfg80211_testmode_p2p_sigma_cmd( - IN struct wiphy *wiphy, - IN void *data, - IN int len - ); -int -mtk_p2p_cfg80211_testmode_hotspot_block_list_cmd( - IN struct wiphy *wiphy, - IN void *data, - IN int len - ); -#else - #error "Please ENABLE kernel config (CONFIG_NL80211_TESTMODE) to support Wi-Fi Direct" -#endif - -#endif - -/* I/O control handlers */ - -int -mtk_p2p_wext_get_priv ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_reconnect ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_set_auth ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_set_key ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_mlme_handler( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_set_powermode( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_get_powermode( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -/* Private Wireless I/O Controls takes use of iw_handler */ -int -mtk_p2p_wext_set_local_dev_info( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_set_provision_complete( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_start_stop_discovery( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_discovery_results( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_wsc_ie( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_connect_disconnect( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_password_ready( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_request_dev_info( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_invitation_indicate( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_invitation_status( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_set_pm_param ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_set_ps_profile ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_set_network_address ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_set_int ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -/* Private Wireless I/O Controls for IOC_SET_STRUCT/IOC_GET_STRUCT */ -int -mtk_p2p_wext_set_struct ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_get_struct ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -/* IOC_SET_STRUCT/IOC_GET_STRUCT: Service Discovery */ -int -mtk_p2p_wext_get_service_discovery_request ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_get_service_discovery_response ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_send_service_discovery_request ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_send_service_discovery_response ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_terminate_service_discovery_phase ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -#if CFG_SUPPORT_ANTI_PIRACY -int -mtk_p2p_wext_set_sec_check_request ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_get_sec_check_response ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); -#endif - -int -mtk_p2p_wext_set_noa_param ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_set_oppps_param ( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_set_p2p_version( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -int -mtk_p2p_wext_get_p2p_version( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - - -void -mtk_p2p_wext_set_Multicastlist( - IN P_GLUE_INFO_T prGlueInfo - ); - -#if CFG_SUPPORT_P2P_RSSI_QUERY -int -mtk_p2p_wext_get_rssi( - IN struct net_device *prDev, - IN struct iw_request_info *info, - IN OUT union iwreq_data *wrqu, - IN OUT char *extra - ); - -struct iw_statistics * -mtk_p2p_wext_get_wireless_stats( - struct net_device *prDev - ); - -#endif - -int -mtk_p2p_wext_set_txpow( - IN struct net_device *prDev, - IN struct iw_request_info *prIwrInfo, - IN OUT union iwreq_data *prTxPow, - IN char *pcExtra - ); - - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _GL_P2P_IOCTL_H */ - diff --git a/drivers/net/wireless/mt5931/os/linux/include/gl_p2p_kal.h b/drivers/net/wireless/mt5931/os/linux/include/gl_p2p_kal.h deleted file mode 100755 index 9a20c26b406f..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/include/gl_p2p_kal.h +++ /dev/null @@ -1,395 +0,0 @@ -/* -** $Id: //Department/DaVinci/TRUNK/WiFi_P2P_Driver/os/linux/include/gl_p2p_kal.h#2 $ -*/ - -/*! \file gl_p2p_kal.h - \brief Declaration of KAL functions for Wi-Fi Direct support - - kal*() which is provided by GLUE Layer. - - Any definitions in this file will be shared among GLUE Layer and internal Driver Stack. -*/ - - - -/* -** $Log: gl_p2p_kal.h $ -** -** 08 29 2012 chinglan.wang -** [ALPS00349655] [Need Patch] [Volunteer Patch] [ALPS.JB] Daily build warning on [mt6575_phone_mhl-eng] -** . - * - * 07 17 2012 yuche.tsai - * NULL - * Compile no error before trial run. - * - * 10 18 2011 yuche.tsai - * [WCXRP00001045] [WiFi Direct][Driver] Check 2.1 branch. - * New 2.1 branch - - * - * 08 15 2011 yuche.tsai - * [WCXRP00000919] [Volunteer Patch][WiFi Direct][Driver] Invitation New Feature. - * Add group BSSID in invitation request indication. - * The BSSID is used for APP to decide the configure method. - * - * 08 09 2011 yuche.tsai - * [WCXRP00000919] [Volunteer Patch][WiFi Direct][Driver] Invitation New Feature. - * Invitation Feature add on. - * - * 03 19 2011 terry.wu - * [WCXRP00000577] [MT6620 Wi-Fi][Driver][FW] Create V2.0 branch for firmware and driver - * create V2.0 p2p driver release based on label "MT6620_WIFI_P2P_DRIVER_V2_0_2100_0319_2011" from main trunk. - * - * 03 07 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * rename the define to anti_pviracy. - * - * 03 05 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * add the code to get the check rsponse and indicate to app. - * - * 03 02 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * Add Security check related code. - * - * 12 22 2010 cp.wu - * [WCXRP00000283] [MT6620 Wi-Fi][Driver][Wi-Fi Direct] Implementation of interface for supporting Wi-Fi Direct Service Discovery - * 1. header file restructure for more clear module isolation - * 2. add function interface definition for implementing Service Discovery callbacks - * -*/ - -#ifndef _GL_P2P_KAL_H -#define _GL_P2P_KAL_H - - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "config.h" -#include "gl_typedef.h" -#include "gl_os.h" -#include "wlan_lib.h" -#include "wlan_oid.h" -#include "wlan_p2p.h" -#include "gl_kal.h" -#include "gl_wext_priv.h" -#include "gl_p2p_ioctl.h" -#include "nic/p2p.h" - - -#if DBG - extern int allocatedMemSize; -#endif - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/* Service Discovery */ -VOID -kalP2PIndicateSDRequest( - IN P_GLUE_INFO_T prGlueInfo, - IN PARAM_MAC_ADDRESS rPeerAddr, - IN UINT_8 ucSeqNum - ); - -void -kalP2PIndicateSDResponse( - IN P_GLUE_INFO_T prGlueInfo, - IN PARAM_MAC_ADDRESS rPeerAddr, - IN UINT_8 ucSeqNum - ); - -VOID -kalP2PIndicateTXDone( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 ucSeqNum, - IN UINT_8 ucStatus - ); - -/*----------------------------------------------------------------------------*/ -/* Wi-Fi Direct handling */ -/*----------------------------------------------------------------------------*/ -ENUM_PARAM_MEDIA_STATE_T -kalP2PGetState ( - IN P_GLUE_INFO_T prGlueInfo - ); - -VOID -kalP2PSetState ( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_PARAM_MEDIA_STATE_T eState, - IN PARAM_MAC_ADDRESS rPeerAddr, - IN UINT_8 ucRole - ); - -VOID -kalP2PUpdateAssocInfo( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucFrameBody, - IN UINT_32 u4FrameBodyLen, - IN BOOLEAN fgReassocRequest - ); - -UINT_32 -kalP2PGetFreqInKHz( - IN P_GLUE_INFO_T prGlueInfo - ); - -UINT_8 -kalP2PGetRole( - IN P_GLUE_INFO_T prGlueInfo - ); - -VOID -kalP2PSetRole( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 ucResult, - IN PUINT_8 pucSSID, - IN UINT_8 ucSSIDLen, - IN UINT_8 ucRole - ); - -VOID -kalP2PSetCipher( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Cipher - ); - -BOOLEAN -kalP2PGetCipher( - IN P_GLUE_INFO_T prGlueInfo - ); - -BOOLEAN -kalP2PGetTkipCipher( - IN P_GLUE_INFO_T prGlueInfo - ); - - -BOOLEAN -kalP2PGetCcmpCipher( - IN P_GLUE_INFO_T prGlueInfo - ); - - -VOID -kalP2PSetWscMode ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 ucWscMode - ); - -UINT_8 -kalP2PGetWscMode( - IN P_GLUE_INFO_T prGlueInfo - ); - -UINT_16 -kalP2PCalWSC_IELen( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 ucType - ); - -VOID -kalP2PGenWSC_IE( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 ucType, - IN PUINT_8 pucBuffer - ); - - -VOID -kalP2PUpdateWSC_IE( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_8 ucType, - IN PUINT_8 pucBuffer, - IN UINT_16 u2BufferLength - ); - - - -BOOLEAN -kalP2PIndicateFound( - IN P_GLUE_INFO_T prGlueInfo - ); - -VOID -kalP2PIndicateConnReq( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucDevName, - IN INT_32 u4NameLength, - IN PARAM_MAC_ADDRESS rPeerAddr, - IN UINT_8 ucDevType, /* 0: P2P Device / 1: GC / 2: GO */ - IN INT_32 i4ConfigMethod, - IN INT_32 i4ActiveConfigMethod - ); - -VOID -kalP2PInvitationStatus ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4InvStatus - ); - -VOID -kalP2PInvitationIndication( - IN P_GLUE_INFO_T prGlueInfo, - IN P_P2P_DEVICE_DESC_T prP2pDevDesc, - IN PUINT_8 pucSsid, - IN UINT_8 ucSsidLen, - IN UINT_8 ucOperatingChnl, - IN UINT_8 ucInvitationType, - IN PUINT_8 pucGroupBssid - ); - - -struct net_device* -kalP2PGetDevHdlr( - P_GLUE_INFO_T prGlueInfo - ); - -VOID -kalGetChnlList( - IN P_GLUE_INFO_T prGlueInfo, - IN ENUM_BAND_T eSpecificBand, - IN UINT_8 ucMaxChannelNum, - IN PUINT_8 pucNumOfChannel, - IN P_RF_CHANNEL_INFO_T paucChannelList - ); - -#if CFG_SUPPORT_ANTI_PIRACY -VOID -kalP2PIndicateSecCheckRsp( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucRsp, - IN UINT_16 u2RspLen - ); -#endif - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -VOID -kalP2PIndicateChannelReady( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_64 u8SeqNum, - IN UINT_32 u4ChannelNum, - IN ENUM_BAND_T eBand, - IN ENUM_CHNL_EXT_T eSco, - IN UINT_32 u4Duration - ); - -VOID -kalP2PIndicateScanDone( - IN P_GLUE_INFO_T prGlueInfo, - IN BOOLEAN fgIsAbort - ); - -VOID -kalP2PIndicateBssInfo( - IN P_GLUE_INFO_T prGlueInfo, - IN PUINT_8 pucFrameBuf, - IN UINT_32 u4BufLen, - IN P_RF_CHANNEL_INFO_T prChannelInfo, - IN INT_32 i4SignalStrength - ); - -VOID -kalP2PIndicateRxMgmtFrame( - IN P_GLUE_INFO_T prGlueInfo, - IN P_SW_RFB_T prSwRfb - ); - -VOID -kalP2PIndicateMgmtTxStatus( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_64 u8Cookie, - IN BOOLEAN fgIsAck, - IN PUINT_8 pucFrameBuf, - IN UINT_32 u4FrameLen - ); - -VOID -kalP2PIndicateChannelExpired( - IN P_GLUE_INFO_T prGlueInfo, - IN P_P2P_CHNL_REQ_INFO_T prChnlReqInfo - ); - -VOID -kalP2PGCIndicateConnectionStatus( - IN P_GLUE_INFO_T prGlueInfo, - IN P_P2P_CONNECTION_REQ_INFO_T prP2pConnInfo, - IN PUINT_8 pucRxIEBuf, - IN UINT_16 u2RxIELen, - IN UINT_16 u2StatusReason - ); - - -VOID -kalP2PGOStationUpdate( - IN P_GLUE_INFO_T prGlueInfo, - IN P_STA_RECORD_T prCliStaRec, - IN BOOLEAN fgIsNew - ); - -BOOLEAN -kalP2PSetBlackList ( - IN P_GLUE_INFO_T prGlueInfo, - IN PARAM_MAC_ADDRESS rbssid, - IN BOOLEAN fgIsblock - ); - -BOOLEAN -kalP2PCmpBlackList ( - IN P_GLUE_INFO_T prGlueInfo, - IN PARAM_MAC_ADDRESS rbssid - ); - -VOID -kalP2PSetMaxClients ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4MaxClient - ); - -BOOLEAN -kalP2PMaxClients ( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4NumClient - ); - -#endif /* _GL_P2P_KAL_H */ - diff --git a/drivers/net/wireless/mt5931/os/linux/include/gl_p2p_os.h b/drivers/net/wireless/mt5931/os/linux/include/gl_p2p_os.h deleted file mode 100755 index 49a90732c123..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/include/gl_p2p_os.h +++ /dev/null @@ -1,194 +0,0 @@ -/* -** $Id: -//Department/DaVinci/TRUNK/MT6620_5931_WiFi_Driver/os/linux/include/gl_p2p_os.h#28 $ -*/ - -/*! \file gl_p2p_os.h - \brief List the external reference to OS for p2p GLUE Layer. - - In this file we define the data structure - GLUE_INFO_T to store those objects - we acquired from OS - e.g. TIMER, SPINLOCK, NET DEVICE ... . And all the - external reference (header file, extern func() ..) to OS for GLUE Layer should - also list down here. -*/ - - - - - -#ifndef _GL_P2P_OS_H -#define _GL_P2P_OS_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - - -struct _GL_P2P_INFO_T { - - /* Device handle */ - struct net_device *prDevHandler; - - #if CFG_ENABLE_WIFI_DIRECT_CFG_80211 - /* cfg80211 */ - struct wireless_dev wdev; - - struct cfg80211_scan_request *prScanRequest; - - UINT_64 u8Cookie; - - /* Generation for station list update. */ - INT_32 i4Generation; - - UINT_32 u4OsMgmtFrameFilter; - - #endif - - /* Device statistics */ - struct net_device_stats rNetDevStats; - - /* glue layer variables */ - /*move to glueinfo->adapter*/ - // BOOLEAN fgIsRegistered; - UINT_32 u4FreqInKHz; /* frequency */ - UINT_8 ucRole; /* 0: P2P Device, 1: Group Client, 2: Group Owner */ - UINT_8 ucIntent; /* range: 0-15 */ - UINT_8 ucScanMode; /* 0: Search & Listen, 1: Scan without probe response */ - - ENUM_PARAM_MEDIA_STATE_T eState; - UINT_32 u4PacketFilter; - PARAM_MAC_ADDRESS aucMCAddrList[MAX_NUM_GROUP_ADDR]; - - /* connection-requested peer information */ - UINT_8 aucConnReqDevName[32]; - INT_32 u4ConnReqNameLength; - PARAM_MAC_ADDRESS rConnReqPeerAddr; - PARAM_MAC_ADDRESS rConnReqGroupAddr; /* For invitation group. */ - UINT_8 ucConnReqDevType; - INT_32 i4ConnReqConfigMethod; - INT_32 i4ConnReqActiveConfigMethod; - - UINT_32 u4CipherPairwise; - UINT_8 ucWSCRunning; - - UINT_8 aucWSCIE[3][400]; /* 0 for beacon, 1 for probe req, 2 for probe response */ - UINT_16 u2WSCIELen[3]; - - UINT_8 ucOperatingChnl; - UINT_8 ucInvitationType; - - UINT_32 u4InvStatus; - - /* For SET_STRUCT/GET_STRUCT */ - UINT_8 aucOidBuf[4096]; - -#if 1 /* CFG_SUPPORT_ANTI_PIRACY */ - UINT_8 aucSecCheck[256]; - UINT_8 aucSecCheckRsp[256]; -#endif - - /* Hotspot Client Management */ - PARAM_MAC_ADDRESS aucblackMACList[8]; - UINT_8 ucMaxClients; - -}; - - -BOOLEAN -p2pRegisterToWlan( - P_GLUE_INFO_T prGlueInfo - ); - -BOOLEAN -p2pUnregisterToWlan( - P_GLUE_INFO_T prGlueInfo - ); - -BOOLEAN -p2pLaunch( - P_GLUE_INFO_T prGlueInfo - ); - -BOOLEAN -p2pRemove( - P_GLUE_INFO_T prGlueInfo - ); - -VOID -p2pSetMode( - IN BOOLEAN fgIsAPMOde - ); - - -BOOLEAN -glRegisterP2P( - P_GLUE_INFO_T prGlueInfo, - const char *prDevName, - BOOLEAN fgIsApMode - ); - -BOOLEAN -glUnregisterP2P( - P_GLUE_INFO_T prGlueInfo - ); - -BOOLEAN -p2pNetRegister( - P_GLUE_INFO_T prGlueInfo, - BOOLEAN fgIsRtnlLockAcquired - ); - -BOOLEAN -p2pNetUnregister( - P_GLUE_INFO_T prGlueInfo, - BOOLEAN fgIsRtnlLockAcquired - ); - -BOOLEAN -p2pStopImmediate( - P_GLUE_INFO_T prGlueInfo - ); - -BOOLEAN -p2PFreeInfo( - P_GLUE_INFO_T prGlueInfo - ); - - -#endif diff --git a/drivers/net/wireless/mt5931/os/linux/include/gl_rst.h b/drivers/net/wireless/mt5931/os/linux/include/gl_rst.h deleted file mode 100755 index b85978a80e76..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/include/gl_rst.h +++ /dev/null @@ -1,131 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/include/gl_rst.h#1 $ -*/ - -/*! \file gl_rst.h - \brief Declaration of functions and finite state machine for - MT6620 Whole-Chip Reset Mechanism -*/ - - - - -#ifndef _GL_RST_H -#define _GL_RST_H - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include "gl_typedef.h" - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/* duplicated from wmt_exp.h for better driver isolation */ -typedef enum _ENUM_WMTDRV_TYPE_T { - WMTDRV_TYPE_BT = 0, - WMTDRV_TYPE_FM = 1, - WMTDRV_TYPE_GPS = 2, - WMTDRV_TYPE_WIFI = 3, - WMTDRV_TYPE_WMT = 4, - WMTDRV_TYPE_STP = 5, - WMTDRV_TYPE_SDIO1 = 6, - WMTDRV_TYPE_SDIO2 = 7, - WMTDRV_TYPE_LPBK = 8, - WMTDRV_TYPE_MAX -} ENUM_WMTDRV_TYPE_T, *P_ENUM_WMTDRV_TYPE_T; - -typedef enum _ENUM_WMTMSG_TYPE_T { - WMTMSG_TYPE_POWER_ON = 0, - WMTMSG_TYPE_POWER_OFF = 1, - WMTMSG_TYPE_RESET = 2, - WMTMSG_TYPE_STP_RDY= 3, - WMTMSG_TYPE_HW_FUNC_ON= 4, - WMTMSG_TYPE_MAX -} ENUM_WMTMSG_TYPE_T, *P_ENUM_WMTMSG_TYPE_T; - -typedef enum _ENUM_WMTRSTMSG_TYPE_T{ - WMTRSTMSG_RESET_START = 0x0, - WMTRSTMSG_RESET_END = 0x1, - WMTRSTMSG_RESET_MAX, - WMTRSTMSG_RESET_INVALID = 0xff -} ENUM_WMTRSTMSG_TYPE_T, *P_ENUM_WMTRSTMSG_TYPE_T; - -typedef void (*PF_WMT_CB)( - ENUM_WMTDRV_TYPE_T, /* Source driver type */ - ENUM_WMTDRV_TYPE_T, /* Destination driver type */ - ENUM_WMTMSG_TYPE_T, /* Message type */ - void *, /* READ-ONLY buffer. Buffer is allocated and freed by WMT_drv. Client - can't touch this buffer after this function return. */ - unsigned int /* Buffer size in unit of byte */ - ); - - -typedef enum _ENUM_WIFI_NETLINK_GRP_T{ - WIFI_NETLINK_GRP_RESET, - WIFI_NETLINK_GRP_MAX -} ENUM_WIFI_NETLINK_GRP_T, *P_ENUM_WIFI_NETLINK_GRP_T; - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -/*----------------------------------------------------------------------------*/ -/* Reset Initialization/Uninitialization */ -/*----------------------------------------------------------------------------*/ -VOID -glResetInit( - VOID - ); - -VOID -glResetUninit( - VOID - ); - -VOID -glSendResetRequest( - VOID - ); - -BOOLEAN -kalIsResetting( - VOID - ); - - -#endif /* _GL_RST_H */ diff --git a/drivers/net/wireless/mt5931/os/linux/include/gl_sec.h b/drivers/net/wireless/mt5931/os/linux/include/gl_sec.h deleted file mode 100755 index 16f0af93be89..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/include/gl_sec.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/include/gl_sec.h#1 $ -*/ - -/*! \file p2p_fsm.h - \brief Declaration of functions and finite state machine for P2P Module. - - Declaration of functions and finite state machine for P2P Module. -*/ - - - - -#ifndef _GL_SEC_H -#define _GL_SEC_H - -extern void handle_sec_msg_1(unsigned char *msg_in, int msg_in_len, unsigned char *msg_out, int *msg_out_len); -extern void handle_sec_msg_2(unsigned char *msg_in, int msg_in_len, unsigned char *msg_out, int *msg_out_len); -extern void handle_sec_msg_3(unsigned char *msg_in, int msg_in_len, unsigned char *msg_out, int *msg_out_len); -extern void handle_sec_msg_4(unsigned char *msg_in, int msg_in_len, unsigned char *msg_out, int *msg_out_len); -extern void handle_sec_msg_5(unsigned char *msg_in, int msg_in_len, unsigned char *msg_out, int *msg_out_len); -extern void handle_sec_msg_final(unsigned char *msg_in, int msg_in_len, unsigned char *msg_out, int *msg_out_len); - -#endif /* _GL_SEC_H */ diff --git a/drivers/net/wireless/mt5931/os/linux/include/gl_typedef.h b/drivers/net/wireless/mt5931/os/linux/include/gl_typedef.h deleted file mode 100755 index e220b43c36ca..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/include/gl_typedef.h +++ /dev/null @@ -1,279 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/include/gl_typedef.h#1 $ -*/ - -/*! \file gl_typedef.h - \brief Definition of basic data type(os dependent). - - In this file we define the basic data type. -*/ - - - -/* -** $Log: gl_typedef.h $ - * - * 06 22 2012 cp.wu - * [WCXRP00001257] [MT6620][MT5931][MT6628][Driver][Linux] Modify KAL_HZ to align ms accuracy - * modify KAL_HZ to (1000) for correct definition. - * - * 03 21 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * portability improvement - * - * 02 15 2011 jeffrey.chang - * NULL - * to support early suspend in android - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port -** \main\maintrunk.MT5921\6 2009-08-18 22:57:14 GMT mtk01090 -** Add Linux SDIO (with mmc core) support. -** Add Linux 2.6.21, 2.6.25, 2.6.26. -** Fix compile warning in Linux. -** \main\maintrunk.MT5921\5 2008-09-22 23:19:30 GMT mtk01461 -** Update comment for code review -** \main\maintrunk.MT5921\4 2008-09-05 17:25:16 GMT mtk01461 -** Update Driver for Code Review -** \main\maintrunk.MT5921\3 2007-11-09 11:00:50 GMT mtk01425 -** 1. Use macro to unify network-to-host and host-to-network related functions -** Revision 1.3 2007/06/27 02:18:51 MTK01461 -** Update SCAN_FSM, Initial(Can Load Module), Proc(Can do Reg R/W), TX API -** -** Revision 1.2 2007/06/25 06:16:24 MTK01461 -** Update illustrations, gl_init.c, gl_kal.c, gl_kal.h, gl_os.h and RX API -** -*/ - -#ifndef _GL_TYPEDEF_H -#define _GL_TYPEDEF_H - -#if defined(CONFIG_HAS_EARLYSUSPEND) -#include -#endif - -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -/* Define HZ of timer tick for function kalGetTimeTick() */ -#define KAL_HZ (1000) - -/* Miscellaneous Equates */ -#ifndef FALSE - #define FALSE ((BOOL) 0) - #define TRUE ((BOOL) 1) -#endif /* FALSE */ - -#ifndef NULL - #if defined(__cplusplus) - #define NULL 0 - #else - #define NULL ((void *) 0) - #endif -#endif - -#if defined(CONFIG_HAS_EARLYSUSPEND) -typedef void (*early_suspend_callback)(struct early_suspend *h); -typedef void (*late_resume_callback) (struct early_suspend *h); -#endif - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/* Type definition for void */ -typedef void VOID, *PVOID, **PPVOID; - -/* Type definition for Boolean */ -typedef unsigned char BOOL, *PBOOL, BOOLEAN, *PBOOLEAN; - -/* Type definition for signed integers */ -typedef signed char CHAR, *PCHAR, **PPCHAR; -typedef signed char INT_8, *PINT_8, **PPINT_8; -typedef signed short INT_16, *PINT_16, **PPINT_16; -typedef signed long INT_32, *PINT_32, **PPINT_32; -typedef signed long long INT_64, *PINT_64, **PPINT_64; - -/* Type definition for unsigned integers */ -typedef unsigned char UCHAR, *PUCHAR, **PPUCHAR; -typedef unsigned char UINT_8, *PUINT_8, **PPUINT_8, *P_UINT_8; -typedef unsigned short UINT_16, *PUINT_16, **PPUINT_16; -typedef unsigned long ULONG, UINT_32, *PUINT_32, **PPUINT_32; -typedef unsigned long long UINT_64, *PUINT_64, **PPUINT_64; - -typedef unsigned long OS_SYSTIME, *POS_SYSTIME, **PPOS_SYSTIME; - - -/* Type definition of large integer (64bits) union to be comptaible with - * Windows definition, so we won't apply our own coding style to these data types. - * NOTE: LARGE_INTEGER must NOT be floating variable. - * : Check for big-endian compatibility. - */ -typedef union _LARGE_INTEGER { - struct { - UINT_32 LowPart; - INT_32 HighPart; - } u; - INT_64 QuadPart; -} LARGE_INTEGER, *PLARGE_INTEGER; - -typedef union _ULARGE_INTEGER { - struct { - UINT_32 LowPart; - UINT_32 HighPart; - } u; - UINT_64 QuadPart; -} ULARGE_INTEGER, *PULARGE_INTEGER; - - -typedef INT_32 (*probe_card)(PVOID pvData); -typedef VOID (*remove_card)(VOID); - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ -#define IN //volatile -#define OUT //volatile - -#define __KAL_INLINE__ static __inline__ -#define __KAL_ATTRIB_PACKED__ __attribute__((__packed__)) -#define __KAL_ATTRIB_ALIGN_4__ __attribute__ ((aligned (4))) - - -#ifndef BIT -#define BIT(n) ((UINT_32) 1UL << (n)) -#endif /* BIT */ - -#ifndef BITS -/* bits range: for example BITS(16,23) = 0xFF0000 - * ==> (BIT(m)-1) = 0x0000FFFF ~(BIT(m)-1) => 0xFFFF0000 - * ==> (BIT(n+1)-1) = 0x00FFFFFF - */ -#define BITS(m,n) (~(BIT(m)-1) & ((BIT(n) - 1) | BIT(n))) -#endif /* BIT */ - - -/* This macro returns the byte offset of a named field in a known structure - type. - _type - structure name, - _field - field name of the structure */ -#ifndef OFFSET_OF - #define OFFSET_OF(_type, _field) ((UINT_32)&(((_type *)0)->_field)) -#endif /* OFFSET_OF */ - - -/* This macro returns the base address of an instance of a structure - * given the type of the structure and the address of a field within the - * containing structure. - * _addrOfField - address of current field of the structure, - * _type - structure name, - * _field - field name of the structure - */ -#ifndef ENTRY_OF - #define ENTRY_OF(_addrOfField, _type, _field) \ - ((_type *)((PINT_8)(_addrOfField) - (PINT_8)OFFSET_OF(_type, _field))) -#endif /* ENTRY_OF */ - - -/* This macro align the input value to the DW boundary. - * _value - value need to check - */ -#ifndef ALIGN_4 - #define ALIGN_4(_value) (((_value) + 3) & ~3u) -#endif /* ALIGN_4 */ - -/* This macro check the DW alignment of the input value. - * _value - value of address need to check - */ -#ifndef IS_ALIGN_4 - #define IS_ALIGN_4(_value) (((_value) & 0x3) ? FALSE : TRUE) -#endif /* IS_ALIGN_4 */ - -#ifndef IS_NOT_ALIGN_4 - #define IS_NOT_ALIGN_4(_value) (((_value) & 0x3) ? TRUE : FALSE) -#endif /* IS_NOT_ALIGN_4 */ - - -/* This macro evaluate the input length in unit of Double Word(4 Bytes). - * _value - value in unit of Byte, output will round up to DW boundary. - */ -#ifndef BYTE_TO_DWORD - #define BYTE_TO_DWORD(_value) ((_value + 3) >> 2) -#endif /* BYTE_TO_DWORD */ - -/* This macro evaluate the input length in unit of Byte. - * _value - value in unit of DW, output is in unit of Byte. - */ -#ifndef DWORD_TO_BYTE - #define DWORD_TO_BYTE(_value) ((_value) << 2) -#endif /* DWORD_TO_BYTE */ - -#if 1 // Little-Endian - #define CONST_NTOHS(_x) __constant_ntohs(_x) - - #define CONST_HTONS(_x) __constant_htons(_x) - - #define NTOHS(_x) ntohs(_x) - - #define HTONS(_x) htons(_x) - - #define NTOHL(_x) ntohl(_x) - - #define HTONL(_x) htonl(_x) - -#else // Big-Endian - - #define CONST_NTOHS(_x) - - #define CONST_HTONS(_x) - - #define NTOHS(_x) - - #define HTONS(_x) - -#endif - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _GL_TYPEDEF_H */ - diff --git a/drivers/net/wireless/mt5931/os/linux/include/gl_wext.h b/drivers/net/wireless/mt5931/os/linux/include/gl_wext.h deleted file mode 100755 index 7a5129f7a54d..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/include/gl_wext.h +++ /dev/null @@ -1,376 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/include/gl_wext.h#1 $ -*/ - -/*! \file gl_wext.h - \brief This file is for Portable Driver linux wireless extension support. -*/ - - - -/* -** $Log: gl_wext.h $ - * - * 10 12 2011 wh.su - * [WCXRP00001036] [MT6620 Wi-Fi][Driver][FW] Adding the 802.11w code for MFP - * adding the 802.11w related function and define . - * - * 09 20 2011 chinglan.wang - * [WCXRP00000989] [WiFi Direct] [Driver] Add a new io control API to start the formation for the sigma test. - * . - * - * 09 20 2011 chinglan.wang - * [WCXRP00000989] [WiFi Direct] [Driver] Add a new io control API to start the formation for the sigma test. - * . - * - * 01 11 2011 chinglan.wang - * NULL - * Modify to reslove the CR :[ALPS00028994] Use WEP security to connect Marvell 11N AP. Connection establish successfully. - * Use the WPS function to connect AP, the privacy bit always is set to 1. . - * - * 09 27 2010 wh.su - * NULL - * [WCXRP00000067][MT6620 Wi-Fi][Driver] Support the android+ WAPI function. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 03 31 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * modify the wapi related code for new driver's design. - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port -** \main\maintrunk.MT5921\12 2009-10-20 17:38:33 GMT mtk01090 -** Refine driver unloading and clean up procedure. Block requests, stop main thread and clean up queued requests, and then stop hw. -** \main\maintrunk.MT5921\11 2009-09-28 20:19:28 GMT mtk01090 -** Add private ioctl to carry OID structures. Restructure public/private ioctl interfaces to Linux kernel. -** \main\maintrunk.MT5921\10 2009-09-03 12:12:35 GMT mtk01088 -** adding the function declaration -** \main\maintrunk.MT5921\9 2009-08-18 22:57:17 GMT mtk01090 -** Add Linux SDIO (with mmc core) support. -** Add Linux 2.6.21, 2.6.25, 2.6.26. -** Fix compile warning in Linux. -** \main\maintrunk.MT5921\8 2008-08-29 16:59:07 GMT mtk01088 -** fixed compiling error -** \main\maintrunk.MT5921\7 2008-08-29 14:13:28 GMT mtk01088 -** adjust the header file for code refine -** \main\maintrunk.MT5921\6 2008-03-28 10:40:31 GMT mtk01461 -** Add set desired rate in Linux STD IOCTL -** \main\maintrunk.MT5921\5 2008-03-11 14:51:08 GMT mtk01461 -** Refine private IOCTL functions -** \main\maintrunk.MT5921\4 2008-02-12 23:45:45 GMT mtk01461 -** Add Set Frequency & Channel oid support for Linux -** \main\maintrunk.MT5921\3 2007-11-06 19:36:19 GMT mtk01088 -** add the WPS related code -*/ - -#ifndef _GL_WEXT_H -#define _GL_WEXT_H - -#ifdef WIRELESS_EXT -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define KILO 1000 -#define RATE_5_5M 11 /* 5.5M */ - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -typedef struct _PARAM_FIXED_IEs { - UINT_8 aucTimestamp[8]; - UINT_16 u2BeaconInterval; - UINT_16 u2Capabilities; -} PARAM_FIXED_IEs; - -typedef struct _PARAM_VARIABLE_IE_T { - UINT_8 ucElementID; - UINT_8 ucLength; - UINT_8 aucData[1]; -} PARAM_VARIABLE_IE_T, *P_PARAM_VARIABLE_IE_T; - - -#if WIRELESS_EXT < 18 - -#define SIOCSIWMLME 0x8B16 /* request MLME operation; uses struct iw_mlme */ -/* MLME requests (SIOCSIWMLME / struct iw_mlme) */ -#define IW_MLME_DEAUTH 0 -#define IW_MLME_DISASSOC 1 - -/*! \brief SIOCSIWMLME data */ -struct iw_mlme { - __u16 cmd; /*!< IW_MLME_* */ - __u16 reason_code; - struct sockaddr addr; -}; - -#define SIOCSIWAUTH 0x8B32 /* set authentication mode params */ -#define SIOCGIWAUTH 0x8B33 /* get authentication mode params */ -/* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */ -#define IW_AUTH_INDEX 0x0FFF -#define IW_AUTH_FLAGS 0xF000 -/* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095) - * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the - * parameter that is being set/get to; value will be read/written to - * struct iw_param value field) */ -#define IW_AUTH_WPA_VERSION 0 -#define IW_AUTH_CIPHER_PAIRWISE 1 -#define IW_AUTH_CIPHER_GROUP 2 -#define IW_AUTH_KEY_MGMT 3 -#define IW_AUTH_TKIP_COUNTERMEASURES 4 -#define IW_AUTH_DROP_UNENCRYPTED 5 -#define IW_AUTH_80211_AUTH_ALG 6 -#define IW_AUTH_WPA_ENABLED 7 -#define IW_AUTH_RX_UNENCRYPTED_EAPOL 8 -#define IW_AUTH_ROAMING_CONTROL 9 -#define IW_AUTH_PRIVACY_INVOKED 10 -#if CFG_SUPPORT_802_11W -#define IW_AUTH_MFP 12 - -#define IW_AUTH_MFP_DISABLED 0 /* MFP disabled */ -#define IW_AUTH_MFP_OPTIONAL 1 /* MFP optional */ -#define IW_AUTH_MFP_REQUIRED 2 /* MFP required */ -#endif - -/* IW_AUTH_WPA_VERSION values (bit field) */ -#define IW_AUTH_WPA_VERSION_DISABLED 0x00000001 -#define IW_AUTH_WPA_VERSION_WPA 0x00000002 -#define IW_AUTH_WPA_VERSION_WPA2 0x00000004 - -/* IW_AUTH_PAIRWISE_CIPHER and IW_AUTH_GROUP_CIPHER values (bit field) */ -#define IW_AUTH_CIPHER_NONE 0x00000001 -#define IW_AUTH_CIPHER_WEP40 0x00000002 -#define IW_AUTH_CIPHER_TKIP 0x00000004 -#define IW_AUTH_CIPHER_CCMP 0x00000008 -#define IW_AUTH_CIPHER_WEP104 0x00000010 - -/* IW_AUTH_KEY_MGMT values (bit field) */ -#define IW_AUTH_KEY_MGMT_802_1X 1 -#define IW_AUTH_KEY_MGMT_PSK 2 -#define IW_AUTH_KEY_MGMT_WPA_NONE 4 - -/* IW_AUTH_80211_AUTH_ALG values (bit field) */ -#define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001 -#define IW_AUTH_ALG_SHARED_KEY 0x00000002 -#define IW_AUTH_ALG_LEAP 0x00000004 - -/* IW_AUTH_ROAMING_CONTROL values */ -#define IW_AUTH_ROAMING_ENABLE 0 /* driver/firmware based roaming */ -#define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming - * control */ - -#define SIOCSIWENCODEEXT 0x8B34 /* set encoding token & mode */ -#define SIOCGIWENCODEEXT 0x8B35 /* get encoding token & mode */ -/* SIOCSIWENCODEEXT definitions */ -#define IW_ENCODE_SEQ_MAX_SIZE 8 -/* struct iw_encode_ext ->alg */ -#define IW_ENCODE_ALG_NONE 0 -#define IW_ENCODE_ALG_WEP 1 -#define IW_ENCODE_ALG_TKIP 2 -#define IW_ENCODE_ALG_CCMP 3 -#if CFG_SUPPORT_802_11W -#define IW_ENCODE_ALG_AES_CMAC 5 -#endif - -/* struct iw_encode_ext ->ext_flags */ -#define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001 -#define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002 -#define IW_ENCODE_EXT_GROUP_KEY 0x00000004 -#define IW_ENCODE_EXT_SET_TX_KEY 0x00000008 - -struct iw_encode_ext { - __u32 ext_flags; /*!< IW_ENCODE_EXT_* */ - __u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /*!< LSB first */ - __u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /*!< LSB first */ - struct sockaddr addr; /*!< ff:ff:ff:ff:ff:ff for broadcast/multicast - * (group) keys or unicast address for - * individual keys */ - __u16 alg; /*!< IW_ENCODE_ALG_* */ - __u16 key_len; - __u8 key[0]; -}; - -#define SIOCSIWPMKSA 0x8B36 /* PMKSA cache operation */ -#define IW_PMKSA_ADD 1 -#define IW_PMKSA_REMOVE 2 -#define IW_PMKSA_FLUSH 3 - -#define IW_PMKID_LEN 16 - -struct iw_pmksa { - __u32 cmd; /*!< IW_PMKSA_* */ - struct sockaddr bssid; - __u8 pmkid[IW_PMKID_LEN]; -}; - -#define IWEVGENIE 0x8C05 /* Generic IE (WPA, RSN, WMM, ..) - * (scan results); This includes id and - * length fields. One IWEVGENIE may - * contain more than one IE. Scan - * results may contain one or more - * IWEVGENIE events. */ -#define IWEVMICHAELMICFAILURE 0x8C06 /* Michael MIC failure - * (struct iw_michaelmicfailure) - */ -#define IWEVASSOCREQIE 0x8C07 /* IEs used in (Re)Association Request. - * The data includes id and length - * fields and may contain more than one - * IE. This event is required in - * Managed mode if the driver - * generates its own WPA/RSN IE. This - * should be sent just before - * IWEVREGISTERED event for the - * association. */ -#define IWEVASSOCRESPIE 0x8C08 /* IEs used in (Re)Association - * Response. The data includes id and - * length fields and may contain more - * than one IE. This may be sent - * between IWEVASSOCREQIE and - * IWEVREGISTERED events for the - * association. */ -#define IWEVPMKIDCAND 0x8C09 /* PMKID candidate for RSN - * pre-authentication - * (struct iw_pmkid_cand) */ - -#endif /* WIRELESS_EXT < 18 */ - -#if WIRELESS_EXT < 17 -/* Statistics flags (bitmask in updated) */ -#define IW_QUAL_QUAL_UPDATED 0x1 /* Value was updated since last read */ -#define IW_QUAL_LEVEL_UPDATED 0x2 -#define IW_QUAL_NOISE_UPDATED 0x4 -#define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */ -#define IW_QUAL_LEVEL_INVALID 0x20 -#define IW_QUAL_NOISE_INVALID 0x40 -#endif - -enum { - IEEE80211_FILTER_TYPE_BEACON = 1<<0, - IEEE80211_FILTER_TYPE_PROBE_REQ = 1<<1, - IEEE80211_FILTER_TYPE_PROBE_RESP = 1<<2, - IEEE80211_FILTER_TYPE_ASSOC_REQ = 1<<3, - IEEE80211_FILTER_TYPE_ASSOC_RESP = 1<<4, - IEEE80211_FILTER_TYPE_AUTH = 1<<5, - IEEE80211_FILTER_TYPE_DEAUTH = 1<<6, - IEEE80211_FILTER_TYPE_DISASSOC = 1<<7, - IEEE80211_FILTER_TYPE_ALL = 0xFF /* used to check the valid filter bits */ -}; - -#if CFG_SUPPORT_WAPI -#define IW_AUTH_WAPI_ENABLED 0x20 -#define IW_ENCODE_ALG_SMS4 0x20 -#endif - -#if CFG_SUPPORT_WAPI /* Android+ */ -#define IW_AUTH_KEY_MGMT_WAPI_PSK 3 -#define IW_AUTH_KEY_MGMT_WAPI_CERT 4 -#endif -#define IW_AUTH_KEY_MGMT_WPS 5 - -#if CFG_SUPPORT_802_11W -#define IW_AUTH_KEY_MGMT_802_1X_SHA256 7 -#define IW_AUTH_KEY_MGMT_PSK_SHA256 8 -#endif - - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ -extern const struct iw_handler_def wext_handler_def; - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ -/* wireless extensions' ioctls */ -int -wext_support_ioctl( - IN struct net_device *prDev, - IN struct ifreq *prIfReq, - IN int i4Cmd - ); - -int -wext_set_rate ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN struct iw_param *prRate, - IN char *pcExtra - ); - -void -wext_indicate_wext_event( - IN P_GLUE_INFO_T prGlueInfo, - IN unsigned int u4Cmd, - IN unsigned char *pucData, - IN unsigned int u4DataLen - ); - -struct iw_statistics * -wext_get_wireless_stats ( - struct net_device *prDev - ); - -int -wext_get_priv ( - IN struct net_device *prNetDev, - IN struct ifreq *prIfReq - ); - -BOOLEAN -wextSrchDesiredWPAIE ( - IN PUINT_8 pucIEStart, - IN INT_32 i4TotalIeLen, - IN UINT_8 ucDesiredElemId, - OUT PUINT_8 *ppucDesiredIE - ); - -#if CFG_SUPPORT_WPS -BOOLEAN -wextSrchDesiredWPSIE ( - IN PUINT_8 pucIEStart, - IN INT_32 i4TotalIeLen, - IN UINT_8 ucDesiredElemId, - OUT PUINT_8 *ppucDesiredIE - ); -#endif - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* WIRELESS_EXT */ - -#endif /* _GL_WEXT_H */ - diff --git a/drivers/net/wireless/mt5931/os/linux/include/gl_wext_priv.h b/drivers/net/wireless/mt5931/os/linux/include/gl_wext_priv.h deleted file mode 100755 index 4a40ce491bae..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/include/gl_wext_priv.h +++ /dev/null @@ -1,396 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/include/gl_wext_priv.h#3 $ -*/ - -/*! \file gl_wext_priv.h - \brief This file includes private ioctl support. -*/ - - - -/* -** $Log: gl_wext_priv.h $ - * - * 01 16 2012 wh.su - * [WCXRP00001170] [MT6620 Wi-Fi][Driver] Adding the related code for set/get band ioctl - * Adding the template code for set / get band IOCTL (with ICS supplicant_6).. - * - * 01 05 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the related ioctl / wlan oid function to set the Tx power cfg. - * - * 01 02 2012 wh.su - * [WCXRP00001153] [MT6620 Wi-Fi][Driver] Adding the get_ch_list and set_tx_power proto type function - * Adding the proto type function for set_int set_tx_power and get int get_ch_list. - * - * 11 08 2011 yuche.tsai - * [WCXRP00001094] [Volunteer Patch][Driver] Driver version & supplicant version query & set support for service discovery version check. - * Add a CMD ID for P2P driver version query. - * - * 03 17 2011 chinglan.wang - * [WCXRP00000570] [MT6620 Wi-Fi][Driver] Add Wi-Fi Protected Setup v2.0 feature - * . - * - * 03 02 2011 wh.su - * [WCXRP00000506] [MT6620 Wi-Fi][Driver][FW] Add Security check related code - * Add security check code. - * - * 01 27 2011 cm.chang - * [WCXRP00000402] [MT6620 Wi-Fi][Driver] Enable MCR read/write by iwpriv by default - * . - * - * 01 20 2011 eddie.chen - * [WCXRP00000374] [MT6620 Wi-Fi][DRV] SW debug control - * Add Oid for sw control debug command - * - * 01 07 2011 cm.chang - * [WCXRP00000336] [MT6620 Wi-Fi][Driver] Add test mode commands in normal phone operation - * Add a new compiling option to control if MCR read/write is permitted - * - * 12 31 2010 cm.chang - * [WCXRP00000336] [MT6620 Wi-Fi][Driver] Add test mode commands in normal phone operation - * Add some iwpriv commands to support test mode operation - * - * 11 08 2010 wh.su - * [WCXRP00000171] [MT6620 Wi-Fi][Driver] Add message check code same behavior as mt5921 - * add the message check code from mt5921. - * - * 10 18 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android - * complete implementation of Android NVRAM access - * - * 09 23 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * add skeleton for NVRAM integration - * - * 08 04 2010 cp.wu - * NULL - * revert changelist #15371, efuse read/write access will be done by RF test approach - * - * 08 04 2010 cp.wu - * NULL - * add OID definitions for EFUSE read/write access. - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base - * - * 03 31 2010 wh.su - * [WPD00003816][MT6620 Wi-Fi] Adding the security support - * modify the wapi related code for new driver's design. - * - * 03 24 2010 jeffrey.chang - * [WPD00003826]Initial import for Linux port - * initial import for Linux port -** \main\maintrunk.MT5921\16 2009-09-29 16:47:23 GMT mtk01090 -** Remove unused functions -** \main\maintrunk.MT5921\15 2009-09-28 20:19:31 GMT mtk01090 -** Add private ioctl to carry OID structures. Restructure public/private ioctl interfaces to Linux kernel. -** \main\maintrunk.MT5921\14 2009-05-07 22:26:06 GMT mtk01089 -** add private IO control for Linux BWCS -** \main\maintrunk.MT5921\13 2008-08-29 14:55:20 GMT mtk01088 -** adjust the code to meet coding style -** \main\maintrunk.MT5921\12 2008-07-16 15:23:45 GMT mtk01104 -** Support GPIO2 mode -** \main\maintrunk.MT5921\11 2008-07-14 13:55:58 GMT mtk01104 -** Support PRIV_CMD_BT_COEXIST -** \main\maintrunk.MT5921\10 2008-07-09 00:20:24 GMT mtk01461 -** Add priv oid to support WMM_PS_TEST -** \main\maintrunk.MT5921\9 2008-05-30 20:27:24 GMT mtk01461 -** Add POWER_MODE Private IOCTL cmd -** \main\maintrunk.MT5921\8 2008-04-17 23:06:44 GMT mtk01461 -** Add iwpriv support for AdHocMode setting -** \main\maintrunk.MT5921\7 2008-03-31 21:01:24 GMT mtk01461 -** Add priv IOCTL for VOIP settings -** \main\maintrunk.MT5921\6 2008-03-31 13:49:47 GMT mtk01461 -** add priv ioctl arg definition for turning on / off roaming -** \main\maintrunk.MT5921\5 2008-03-26 15:35:09 GMT mtk01461 -** Add CSUM offload priv ioctl for Linux -** \main\maintrunk.MT5921\4 2008-03-11 14:51:11 GMT mtk01461 -** Refine private IOCTL functions -** \main\maintrunk.MT5921\3 2007-11-06 19:36:25 GMT mtk01088 -** add the WPS related code -*/ - -#ifndef _GL_WEXT_PRIV_H -#define _GL_WEXT_PRIV_H -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ -/* If it is set to 1, iwpriv will support register read/write */ -#define CFG_SUPPORT_PRIV_MCR_RW 1 - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -/* New wireless extensions API - SET/GET convention (even ioctl numbers are - * root only) - */ -#define IOCTL_SET_INT (SIOCIWFIRSTPRIV + 0) -#define IOCTL_GET_INT (SIOCIWFIRSTPRIV + 1) - -#define IOCTL_SET_ADDRESS (SIOCIWFIRSTPRIV + 2) -#define IOCTL_GET_ADDRESS (SIOCIWFIRSTPRIV + 3) -#define IOCTL_SET_STR (SIOCIWFIRSTPRIV + 4) -#define IOCTL_GET_STR (SIOCIWFIRSTPRIV + 5) -#define IOCTL_SET_KEY (SIOCIWFIRSTPRIV + 6) -#define IOCTL_GET_KEY (SIOCIWFIRSTPRIV + 7) -#define IOCTL_SET_STRUCT (SIOCIWFIRSTPRIV + 8) -#define IOCTL_GET_STRUCT (SIOCIWFIRSTPRIV + 9) -#define IOCTL_SET_STRUCT_FOR_EM (SIOCIWFIRSTPRIV + 11) -#define IOCTL_SET_INTS (SIOCIWFIRSTPRIV + 12) -#define IOCTL_GET_INTS (SIOCIWFIRSTPRIV + 13) - -#define PRIV_CMD_REG_DOMAIN 0 -#define PRIV_CMD_BEACON_PERIOD 1 -#define PRIV_CMD_ADHOC_MODE 2 - -#if CFG_TCP_IP_CHKSUM_OFFLOAD - #define PRIV_CMD_CSUM_OFFLOAD 3 -#endif /* CFG_TCP_IP_CHKSUM_OFFLOAD */ - -#define PRIV_CMD_ROAMING 4 -#define PRIV_CMD_VOIP_DELAY 5 -#define PRIV_CMD_POWER_MODE 6 - -#define PRIV_CMD_WMM_PS 7 -#define PRIV_CMD_BT_COEXIST 8 -#define PRIV_GPIO2_MODE 9 - -#define PRIV_CUSTOM_SET_PTA 10 -#define PRIV_CUSTOM_CONTINUOUS_POLL 11 -#define PRIV_CUSTOM_SINGLE_ANTENNA 12 -#define PRIV_CUSTOM_BWCS_CMD 13 -#define PRIV_CUSTOM_DISABLE_BEACON_DETECTION 14//later -#define PRIV_CMD_OID 15 -#define PRIV_SEC_MSG_OID 16 - -#define PRIV_CMD_TEST_MODE 17 -#define PRIV_CMD_TEST_CMD 18 -#define PRIV_CMD_ACCESS_MCR 19 -#define PRIV_CMD_SW_CTRL 20 - -#if 1 /* ANTI_PRIVCY */ -#define PRIV_SEC_CHECK_OID 21 -#endif - -#define PRIV_CMD_WSC_PROBE_REQ 22 - -#define PRIV_CMD_P2P_VERSION 23 - -#define PRIV_CMD_GET_CH_LIST 24 - -#define PRIV_CMD_SET_TX_POWER 25 - -#define PRIV_CMD_BAND_CONFIG 26 - -#define PRIV_CMD_DUMP_MEM 27 - -#define PRIV_CMD_P2P_MODE 28 - -/* 802.3 Objects (Ethernet) */ -#define OID_802_3_CURRENT_ADDRESS 0x01010102 - -/* IEEE 802.11 OIDs */ -#define OID_802_11_SUPPORTED_RATES 0x0D01020E -#define OID_802_11_CONFIGURATION 0x0D010211 - -/* PnP and PM OIDs, NDIS default OIDS */ -#define OID_PNP_SET_POWER 0xFD010101 - -#define OID_CUSTOM_OID_INTERFACE_VERSION 0xFFA0C000 - -/* MT5921 specific OIDs */ -#define OID_CUSTOM_BT_COEXIST_CTRL 0xFFA0C580 -#define OID_CUSTOM_POWER_MANAGEMENT_PROFILE 0xFFA0C581 -#define OID_CUSTOM_PATTERN_CONFIG 0xFFA0C582 -#define OID_CUSTOM_BG_SSID_SEARCH_CONFIG 0xFFA0C583 -#define OID_CUSTOM_VOIP_SETUP 0xFFA0C584 -#define OID_CUSTOM_ADD_TS 0xFFA0C585 -#define OID_CUSTOM_DEL_TS 0xFFA0C586 -#define OID_CUSTOM_SLT 0xFFA0C587 -#define OID_CUSTOM_ROAMING_EN 0xFFA0C588 -#define OID_CUSTOM_WMM_PS_TEST 0xFFA0C589 -#define OID_CUSTOM_COUNTRY_STRING 0xFFA0C58A -#define OID_CUSTOM_MULTI_DOMAIN_CAPABILITY 0xFFA0C58B -#define OID_CUSTOM_GPIO2_MODE 0xFFA0C58C -#define OID_CUSTOM_CONTINUOUS_POLL 0xFFA0C58D -#define OID_CUSTOM_DISABLE_BEACON_DETECTION 0xFFA0C58E - -/* CR1460, WPS privacy bit check disable */ -#define OID_CUSTOM_DISABLE_PRIVACY_CHECK 0xFFA0C600 - -/* Precedent OIDs */ -#define OID_CUSTOM_MCR_RW 0xFFA0C801 -#define OID_CUSTOM_EEPROM_RW 0xFFA0C803 -#define OID_CUSTOM_SW_CTRL 0xFFA0C805 -#define OID_CUSTOM_MEM_DUMP 0xFFA0C807 - - -/* RF Test specific OIDs */ -#define OID_CUSTOM_TEST_MODE 0xFFA0C901 -#define OID_CUSTOM_TEST_RX_STATUS 0xFFA0C903 -#define OID_CUSTOM_TEST_TX_STATUS 0xFFA0C905 -#define OID_CUSTOM_ABORT_TEST_MODE 0xFFA0C906 -#define OID_CUSTOM_MTK_WIFI_TEST 0xFFA0C911 - -/* BWCS */ -#define OID_CUSTOM_BWCS_CMD 0xFFA0C931 -#define OID_CUSTOM_SINGLE_ANTENNA 0xFFA0C932 -#define OID_CUSTOM_SET_PTA 0xFFA0C933 - -/* NVRAM */ -#define OID_CUSTOM_MTK_NVRAM_RW 0xFFA0C941 -#define OID_CUSTOM_CFG_SRC_TYPE 0xFFA0C942 -#define OID_CUSTOM_EEPROM_TYPE 0xFFA0C943 - - -#if CFG_SUPPORT_WAPI -#define OID_802_11_WAPI_MODE 0xFFA0CA00 -#define OID_802_11_WAPI_ASSOC_INFO 0xFFA0CA01 -#define OID_802_11_SET_WAPI_KEY 0xFFA0CA02 -#endif - -#if CFG_SUPPORT_WPS2 -#define OID_802_11_WSC_ASSOC_INFO 0xFFA0CB00 -#endif - - -/* Define magic key of test mode (Don't change it for future compatibity) */ -#define PRIV_CMD_TEST_MAGIC_KEY 2011 - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ -/* NIC BBCR configuration entry structure */ -typedef struct _PRIV_CONFIG_ENTRY { - UINT_8 ucOffset; - UINT_8 ucValue; -} PRIV_CONFIG_ENTRY, *PPRIV_CONFIG_ENTRY; - -typedef WLAN_STATUS (*PFN_OID_HANDLER_FUNC_REQ) ( - IN PVOID prAdapter, - IN OUT PVOID pvBuf, - IN UINT_32 u4BufLen, - OUT PUINT_32 pu4OutInfoLen - ); - -typedef enum _ENUM_OID_METHOD_T { - ENUM_OID_GLUE_ONLY, - ENUM_OID_GLUE_EXTENSION, - ENUM_OID_DRIVER_CORE -} ENUM_OID_METHOD_T, *P_ENUM_OID_METHOD_T; - -/* OID set/query processing entry */ -typedef struct _WLAN_REQ_ENTRY { - UINT_32 rOid; /* OID */ - PUINT_8 pucOidName; /* OID name text */ - BOOLEAN fgQryBufLenChecking; - BOOLEAN fgSetBufLenChecking; - ENUM_OID_METHOD_T eOidMethod; - UINT_32 u4InfoBufLen; - PFN_OID_HANDLER_FUNC_REQ pfOidQueryHandler; /* PFN_OID_HANDLER_FUNC*/ - PFN_OID_HANDLER_FUNC_REQ pfOidSetHandler; /* PFN_OID_HANDLER_FUNC */ -} WLAN_REQ_ENTRY, *P_WLAN_REQ_ENTRY; - -typedef struct _NDIS_TRANSPORT_STRUCT { - UINT_32 ndisOidCmd; - UINT_32 inNdisOidlength; - UINT_32 outNdisOidLength; - UINT_8 ndisOidContent[16]; -} NDIS_TRANSPORT_STRUCT, *P_NDIS_TRANSPORT_STRUCT; - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -int -priv_set_int( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN union iwreq_data *prIwReqData, - IN char *pcExtra - ); - -int -priv_get_int( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN union iwreq_data *prIwReqData, - IN OUT char *pcExtra - ); - -int -priv_set_ints( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN union iwreq_data *prIwReqData, - IN char *pcExtra - ); - -int -priv_get_ints( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN union iwreq_data *prIwReqData, - IN OUT char *pcExtra - ); - -int -priv_set_struct( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN union iwreq_data *prIwReqData, - IN char *pcExtra - ); - -int -priv_get_struct ( - IN struct net_device *prNetDev, - IN struct iw_request_info *prIwReqInfo, - IN union iwreq_data *prIwReqData, - IN OUT char *pcExtra - ); - -int -priv_support_ioctl ( - IN struct net_device *prDev, - IN OUT struct ifreq *prReq, - IN int i4Cmd - ); - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - -#endif /* _GL_WEXT_PRIV_H */ - diff --git a/drivers/net/wireless/mt5931/os/linux/platform.c b/drivers/net/wireless/mt5931/os/linux/platform.c deleted file mode 100755 index 9eecea20333f..000000000000 --- a/drivers/net/wireless/mt5931/os/linux/platform.c +++ /dev/null @@ -1,620 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/linux/platform.c#1 $ -*/ - -/*! \file "platform.c" - \brief This file including the protocol layer privacy function. - - This file provided the macros and functions library support for the - protocol layer security setting from wlan_oid.c and for parse.c and - rsn.c and nic_privacy.c - -*/ - - - -/* -** $Log: platform.c $ - * - * 11 14 2011 cm.chang - * NULL - * Fix compiling warning - * - * 11 10 2011 cp.wu - * [WCXRP00001098] [MT6620 Wi-Fi][Driver] Replace printk by DBG LOG macros in linux porting layer - * 1. eliminaite direct calls to printk in porting layer. - * 2. replaced by DBGLOG, which would be XLOG on ALPS platforms. - * - * 09 13 2011 jeffrey.chang - * [WCXRP00000983] [MT6620][Wi-Fi Driver] invalid pointer casting causes kernel panic during p2p connection - * fix the pointer casting - * - * 06 29 2011 george.huang - * [WCXRP00000818] [MT6620 Wi-Fi][Driver] Remove unused code segment regarding CONFIG_IPV6 - * . - * - * 06 28 2011 george.huang - * [WCXRP00000818] [MT6620 Wi-Fi][Driver] Remove unused code segment regarding CONFIG_IPV6 - * remove un-used code - * - * 05 11 2011 jeffrey.chang - * NULL - * fix build error - * - * 05 09 2011 jeffrey.chang - * [WCXRP00000710] [MT6620 Wi-Fi] Support pattern filter update function on IP address change - * support ARP filter through kernel notifier - * - * 04 08 2011 pat.lu - * [WCXRP00000623] [MT6620 Wi-Fi][Driver] use ARCH define to distinguish PC Linux driver - * Use CONFIG_X86 instead of PC_LINUX_DRIVER_USE option to have proper compile settting for PC Linux driver - * - * 03 22 2011 pat.lu - * [WCXRP00000592] [MT6620 Wi-Fi][Driver] Support PC Linux Environment Driver Build - * Add a compiler option "PC_LINUX_DRIVER_USE" for building driver in PC Linux environment. - * - * 03 21 2011 cp.wu - * [WCXRP00000540] [MT5931][Driver] Add eHPI8/eHPI16 support to Linux Glue Layer - * improve portability for awareness of early version of linux kernel and wireless extension. - * - * 03 18 2011 jeffrey.chang - * [WCXRP00000512] [MT6620 Wi-Fi][Driver] modify the net device relative functions to support the H/W multiple queue - * remove early suspend functions - * - * 03 03 2011 jeffrey.chang - * NULL - * add the ARP filter callback - * - * 02 15 2011 jeffrey.chang - * NULL - * to support early suspend in android - * - * 02 01 2011 cp.wu - * [WCXRP00000413] [MT6620 Wi-Fi][Driver] Merge 1103 changes on NVRAM file path change to DaVinci main trunk and V1.1 branch - * upon Jason Zhang(NVRAM owner)'s change, ALPS has modified its NVRAM storage from /nvram/... to /data/nvram/... - * - * 11 01 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000150] [MT6620 Wi-Fi][Driver] Add implementation for querying current TX rate from firmware auto rate module - * 1) Query link speed (TX rate) from firmware directly with buffering mechanism to reduce overhead - * 2) Remove CNM CH-RECOVER event handling - * 3) cfg read/write API renamed with kal prefix for unified naming rules. - * - * 10 18 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000086] [MT6620 Wi-Fi][Driver] The mac address is all zero at android - * complete implementation of Android NVRAM access - * - * 10 05 2010 cp.wu - * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check - * 1) add NVRAM access API - * 2) fake scanning result when NVRAM doesn't exist and/or version mismatch. (off by compiler option) - * 3) add OID implementation for NVRAM read/write service - * -** -*/ -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ -#include -#include -#include -#include -#include - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 12) - #include -#endif - -#include "gl_os.h" - -#ifndef CONFIG_X86 -#if defined(CONFIG_HAS_EARLY_SUSPEND) - #include -#endif -#endif - - -extern BOOLEAN fgIsUnderEarlierSuspend; - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ -#define WIFI_NVRAM_FILE_NAME "/data/nvram/APCFG/APRDEB/WIFI" -#define WIFI_NVRAM_CUSTOM_NAME "/data/nvram/APCFG/APRDEB/WIFI_CUSTOM" - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - - - -static int netdev_event(struct notifier_block *nb, unsigned long notification, void *ptr) -{ - UINT_8 ip[4] = { 0 }; - UINT_32 u4NumIPv4 = 0; -//#ifdef CONFIG_IPV6 -#if 0 - UINT_8 ip6[16] = { 0 }; // FIX ME: avoid to allocate large memory in stack - UINT_32 u4NumIPv6 = 0; -#endif - struct in_ifaddr *ifa = (struct in_ifaddr *) ptr; - struct net_device *prDev = ifa->ifa_dev->dev; - UINT_32 i; - P_PARAM_NETWORK_ADDRESS_IP prParamIpAddr; - P_GLUE_INFO_T prGlueInfo = NULL; - - if (prDev == NULL) { - DBGLOG(REQ, INFO, ("netdev_event: device is empty.\n")); - return NOTIFY_DONE; - } - - if ((strncmp(prDev->name, "p2p", 3) != 0) && (strncmp(prDev->name, "wlan", 4) != 0)) { - DBGLOG(REQ, INFO, ("netdev_event: xxx\n")); - return NOTIFY_DONE; - } - - prGlueInfo = *((P_GLUE_INFO_T *) netdev_priv(prDev)); - - if (prGlueInfo == NULL) { - DBGLOG(REQ, INFO, ("netdev_event: prGlueInfo is empty.\n")); - return NOTIFY_DONE; - } - ASSERT(prGlueInfo); - - if (fgIsUnderEarlierSuspend == false) { - DBGLOG(REQ, INFO, ("netdev_event: PARAM_MEDIA_STATE_DISCONNECTED. (%d)\n", prGlueInfo->eParamMediaStateIndicated)); - return NOTIFY_DONE; - } - - - - // <3> get the IPv4 address - if(!prDev || !(prDev->ip_ptr)||\ - !((struct in_device *)(prDev->ip_ptr))->ifa_list||\ - !(&(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local))){ - DBGLOG(REQ, INFO, ("ip is not avaliable.\n")); - return NOTIFY_DONE; - } - - kalMemCopy(ip, &(((struct in_device *)(prDev->ip_ptr))->ifa_list->ifa_local), sizeof(ip)); - DBGLOG(REQ, INFO, ("ip is %d.%d.%d.%d\n", - ip[0],ip[1],ip[2],ip[3])); - - // todo: traverse between list to find whole sets of IPv4 addresses - if (!((ip[0] == 0) && - (ip[1] == 0) && - (ip[2] == 0) && - (ip[3] == 0))) { - u4NumIPv4++; - } - -//#ifdef CONFIG_IPV6 -#if 0 - if(!prDev || !(prDev->ip6_ptr)||\ - !((struct in_device *)(prDev->ip6_ptr))->ifa_list||\ - !(&(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local))){ - printk(KERN_INFO "ipv6 is not avaliable.\n"); - return NOTIFY_DONE; - } - - kalMemCopy(ip6, &(((struct in_device *)(prDev->ip6_ptr))->ifa_list->ifa_local), sizeof(ip6)); - printk(KERN_INFO"ipv6 is %d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d.%d\n", - ip6[0],ip6[1],ip6[2],ip6[3], - ip6[4],ip6[5],ip6[6],ip6[7], - ip6[8],ip6[9],ip6[10],ip6[11], - ip6[12],ip6[13],ip6[14],ip6[15] - ); - - // todo: traverse between list to find whole sets of IPv6 addresses - if (!((ip6[0] == 0) && - (ip6[1] == 0) && - (ip6[2] == 0) && - (ip6[3] == 0) && - (ip6[4] == 0) && - (ip6[5] == 0))) { - //u4NumIPv6++; - } -#endif - - // here we can compare the dev with other network's netdev to - // set the proper arp filter - // - // IMPORTANT: please make sure if the context can sleep, if the context can't sleep - // we should schedule a kernel thread to do this for us - - // <7> set up the ARP filter - { - WLAN_STATUS rStatus = WLAN_STATUS_FAILURE; - UINT_32 u4SetInfoLen = 0; - UINT_8 aucBuf[32] = {0}; - UINT_32 u4Len = OFFSET_OF(PARAM_NETWORK_ADDRESS_LIST, arAddress); - P_PARAM_NETWORK_ADDRESS_LIST prParamNetAddrList = (P_PARAM_NETWORK_ADDRESS_LIST)aucBuf; - P_PARAM_NETWORK_ADDRESS prParamNetAddr = prParamNetAddrList->arAddress; - -//#ifdef CONFIG_IPV6 -#if 0 - prParamNetAddrList->u4AddressCount = u4NumIPv4 + u4NumIPv6; -#else - prParamNetAddrList->u4AddressCount = u4NumIPv4; -#endif - prParamNetAddrList->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP; - for (i = 0; i < u4NumIPv4; i++) { - prParamNetAddr->u2AddressLength = sizeof(PARAM_NETWORK_ADDRESS_IP);//4;; - prParamNetAddr->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP;; -#if 0 - kalMemCopy(prParamNetAddr->aucAddress, ip, sizeof(ip)); - prParamNetAddr = (P_PARAM_NETWORK_ADDRESS)((UINT_32)prParamNetAddr + sizeof(ip)); - u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(ip); -#else - prParamIpAddr = (P_PARAM_NETWORK_ADDRESS_IP)prParamNetAddr->aucAddress; - kalMemCopy(&prParamIpAddr->in_addr, ip, sizeof(ip)); - prParamNetAddr = (P_PARAM_NETWORK_ADDRESS)((UINT_32)prParamNetAddr + sizeof(PARAM_NETWORK_ADDRESS)); - u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(PARAM_NETWORK_ADDRESS); -#endif - } -//#ifdef CONFIG_IPV6 -#if 0 - for (i = 0; i < u4NumIPv6; i++) { - prParamNetAddr->u2AddressLength = 6;; - prParamNetAddr->u2AddressType = PARAM_PROTOCOL_ID_TCP_IP;; - kalMemCopy(prParamNetAddr->aucAddress, ip6, sizeof(ip6)); - prParamNetAddr = (P_PARAM_NETWORK_ADDRESS)((UINT_32)prParamNetAddr + sizeof(ip6)); - u4Len += OFFSET_OF(PARAM_NETWORK_ADDRESS, aucAddress) + sizeof(ip6); - } -#endif - ASSERT(u4Len <= sizeof(aucBuf)); - - DBGLOG(REQ, INFO, ("kalIoctl (0x%x, 0x%x)\n", prGlueInfo, prParamNetAddrList)); - - rStatus = kalIoctl(prGlueInfo, - wlanoidSetNetworkAddress, - (PVOID)prParamNetAddrList, - u4Len, - FALSE, - FALSE, - TRUE, - FALSE, - &u4SetInfoLen); - - if (rStatus != WLAN_STATUS_SUCCESS) { - DBGLOG(REQ, INFO, ("set HW pattern filter fail 0x%lx\n", rStatus)); - } - } - - return NOTIFY_DONE; - -} - -static struct notifier_block inetaddr_notifier = { - .notifier_call = netdev_event, -}; - -void wlanRegisterNotifier(void) -{ - register_inetaddr_notifier(&inetaddr_notifier); -} - -//EXPORT_SYMBOL(wlanRegisterNotifier); - -void wlanUnregisterNotifier(void) -{ - unregister_inetaddr_notifier(&inetaddr_notifier); -} - -//EXPORT_SYMBOL(wlanUnregisterNotifier); - -#ifndef CONFIG_X86 -#if defined(CONFIG_HAS_EARLYSUSPEND) - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will register platform driver to os -* -* \param[in] wlanSuspend Function pointer to platform suspend function -* \param[in] wlanResume Function pointer to platform resume function -* -* \return The result of registering earlysuspend -*/ -/*----------------------------------------------------------------------------*/ - -int glRegisterEarlySuspend( - struct early_suspend *prDesc, - early_suspend_callback wlanSuspend, - late_resume_callback wlanResume) -{ - int ret = 0; - - if(NULL != wlanSuspend) - prDesc->suspend = wlanSuspend; - else{ - DBGLOG(REQ, INFO, ("glRegisterEarlySuspend wlanSuspend ERROR.\n")); - ret = -1; - } - - if(NULL != wlanResume) - prDesc->resume = wlanResume; - else{ - DBGLOG(REQ, INFO, ("glRegisterEarlySuspend wlanResume ERROR.\n")); - ret = -1; - } - - register_early_suspend(prDesc); - return ret; -} - -//EXPORT_SYMBOL(glRegisterEarlySuspend); - -/*----------------------------------------------------------------------------*/ -/*! -* \brief This function will un-register platform driver to os -* -* \return The result of un-registering earlysuspend -*/ -/*----------------------------------------------------------------------------*/ - -int glUnregisterEarlySuspend(struct early_suspend *prDesc) -{ - int ret = 0; - - unregister_early_suspend(prDesc); - - prDesc->suspend = NULL; - prDesc->resume = NULL; - - return ret; -} - -//EXPORT_SYMBOL(glUnregisterEarlySuspend); -#endif -#endif // !CONFIG_X86 - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Utility function for reading data from files on NVRAM-FS -* -* \param[in] -* filename -* len -* offset -* \param[out] -* buf -* \return -* actual length of data being read -*/ -/*----------------------------------------------------------------------------*/ -static int -nvram_read( - char *filename, - char *buf, - ssize_t len, - int offset) -{ -#if CFG_SUPPORT_NVRAM - struct file *fd; - int retLen = -1; - - mm_segment_t old_fs = get_fs(); - set_fs(KERNEL_DS); - - fd = filp_open(filename, O_RDONLY, 0644); - - if(IS_ERR(fd)) { - DBGLOG(INIT, INFO, ("[MT6620][nvram_read] : failed to open!!\n")); - return -1; - } - - do { - if ((fd->f_op == NULL) || (fd->f_op->read == NULL)) { - DBGLOG(INIT, INFO, ("[MT6620][nvram_read] : file can not be read!!\n")); - break; - } - - if (fd->f_pos != offset) { - if (fd->f_op->llseek) { - if(fd->f_op->llseek(fd, offset, 0) != offset) { - DBGLOG(INIT, INFO, ("[MT6620][nvram_read] : failed to seek!!\n")); - break; - } - } - else { - fd->f_pos = offset; - } - } - - retLen = fd->f_op->read(fd, - buf, - len, - &fd->f_pos); - - } while(FALSE); - - filp_close(fd, NULL); - - set_fs(old_fs); - - return retLen; - -#else // !CFG_SUPPORT_NVRAM - - return -EIO; - -#endif -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief Utility function for writing data to files on NVRAM-FS -* -* \param[in] -* filename -* buf -* len -* offset -* \return -* actual length of data being written -*/ -/*----------------------------------------------------------------------------*/ -static int -nvram_write ( - char *filename, - char *buf, - ssize_t len, - int offset) -{ -#if CFG_SUPPORT_NVRAM - struct file *fd; - int retLen = -1; - - mm_segment_t old_fs = get_fs(); - set_fs(KERNEL_DS); - - fd = filp_open(filename, O_WRONLY|O_CREAT, 0644); - - if(IS_ERR(fd)) { - DBGLOG(INIT, INFO, ("[MT6620][nvram_write] : failed to open!!\n")); - return -1; - } - - do{ - if ((fd->f_op == NULL) || (fd->f_op->write == NULL)) { - DBGLOG(INIT, INFO, ("[MT6620][nvram_write] : file can not be write!!\n")); - break; - } /* End of if */ - - if (fd->f_pos != offset) { - if (fd->f_op->llseek) { - if(fd->f_op->llseek(fd, offset, 0) != offset) { - DBGLOG(INIT, INFO, ("[MT6620][nvram_write] : failed to seek!!\n")); - break; - } - } - else { - fd->f_pos = offset; - } - } - - retLen = fd->f_op->write(fd, - buf, - len, - &fd->f_pos); - - } while(FALSE); - - filp_close(fd, NULL); - - set_fs(old_fs); - - return retLen; - -#else // !CFG_SUPPORT_NVRAMS - - return -EIO; - -#endif -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief API for reading data on NVRAM -* -* \param[in] -* prGlueInfo -* u4Offset -* \param[out] -* pu2Data -* \return -* TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalCfgDataRead16( - IN P_GLUE_INFO_T prGlueInfo, - IN UINT_32 u4Offset, - OUT PUINT_16 pu2Data - ) -{ - if(pu2Data == NULL) { - return FALSE; - } - - if(nvram_read(WIFI_NVRAM_FILE_NAME, - (char *)pu2Data, - sizeof(unsigned short), - u4Offset) != sizeof(unsigned short)) { - return FALSE; - } - else { - return TRUE; - } -} - - -/*----------------------------------------------------------------------------*/ -/*! -* \brief API for writing data on NVRAM -* -* \param[in] -* prGlueInfo -* u4Offset -* u2Data -* \return -* TRUE -* FALSE -*/ -/*----------------------------------------------------------------------------*/ -BOOLEAN -kalCfgDataWrite16( - IN P_GLUE_INFO_T prGlueInfo, - UINT_32 u4Offset, - UINT_16 u2Data - ) -{ - if(nvram_write(WIFI_NVRAM_FILE_NAME, - (char *)&u2Data, - sizeof(unsigned short), - u4Offset) != sizeof(unsigned short)) { - return FALSE; - } - else { - return TRUE; - } -} - - diff --git a/drivers/net/wireless/mt5931/os/version.h b/drivers/net/wireless/mt5931/os/version.h deleted file mode 100755 index 716a0628d755..000000000000 --- a/drivers/net/wireless/mt5931/os/version.h +++ /dev/null @@ -1,200 +0,0 @@ -/* -** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/os/version.h#1 $ -*/ - -/*! \file "version.h" - \brief Driver's version definition - -*/ - - - -/* -** $Log: version.h $ - * - * 11 01 2011 chinglan.wang - * NULL - * Change the version number to v2.0.1.1. - * - * 08 26 2011 chinglan.wang - * NULL - * Change the version number to v2.0.0.9.. - * - * 08 23 2011 chinglan.wang - * NULL - * Change the version number to v2.0.0.8. - * - * 08 15 2011 cp.wu - * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree - * correct typo. - * - * 08 15 2011 cp.wu - * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree - * for building MT6628 Win32 driver environment - * - * 08 03 2011 chinglan.wang - * NULL - * Change the version number to v2.0.0.7. - * - * 07 24 2011 puff.wen - * NULL - * [MT5931][Beta 5]Change the version number to v0.2.2.0 - * - * 06 01 2011 chinglan.wang - * NULL - * Change the version number to v2.0.0.6.. - * - * 05 09 2011 chinglan.wang - * NULL - * Change the version number to v2.0.0.5.. - * - * 04 19 2011 chinglan.wang - * NULL - * Change the version number to v2.0.0.4. - * - * 04 18 2011 chinglan.wang - * NULL - * Change the version number to v2.0.0.3. - * - * 03 25 2011 chinglan.wang - * NULL - * Change the version number to v2.0.0.2. - * - * 03 21 2011 chinglan.wang - * NULL - * Change the version number to 2.0.0.1. - * - * 03 18 2011 chinglan.wang - * NULL - * Change the version number to v2.0.0.0. - * - * 02 11 2011 chinglan.wang - * NULL - * Change to the version 1.2.0.2. - * - * 02 10 2011 chinglan.wang - * NULL - * Change the version to 1.2.0.1. - * - * 02 08 2011 cp.wu - * [WCXRP00000427] [MT6620 Wi-Fi][Driver] Modify veresion information to match with release revision number - * change version number to v1.2.0.0 for preparing v1.2 software package release. - * - * 12 10 2010 kevin.huang - * [WCXRP00000128] [MT6620 Wi-Fi][Driver] Add proc support to Android Driver for debug and driver status check - * Add Linux Proc Support - * - * 10 07 2010 cp.wu - * [WCXRP00000083] [MT5931][Driver][FW] Add necessary logic for MT5931 first connection - * [WINDDK] build system changes for MT5931 - * - * 07 08 2010 cp.wu - * - * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository. - * - * 06 06 2010 kevin.huang - * [WPD00003832][MT6620 5931] Create driver base - * [MT6620 5931] Create driver base -** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-12-14 14:10:55 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-11-17 22:41:00 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-11-13 16:20:33 GMT mtk01084 -** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:27:13 GMT mtk01426 -** Init for develop -** -*/ - -#ifndef _VERSION_H -#define _VERSION_H -/******************************************************************************* -* C O M P I L E R F L A G S -******************************************************************************** -*/ - -/******************************************************************************* -* E X T E R N A L R E F E R E N C E S -******************************************************************************** -*/ - -/******************************************************************************* -* C O N S T A N T S -******************************************************************************** -*/ - -#ifndef NIC_AUTHOR -#define NIC_AUTHOR "NIC_AUTHOR" -#endif -#ifndef NIC_DESC -#define NIC_DESC "NIC_DESC" -#endif - -#ifndef NIC_NAME - #if defined(MT6620) - #define NIC_NAME "MT6620" - #define NIC_DEVICE_ID "MT6620" - #define NIC_DEVICE_ID_LOW "mt6620" - #elif defined(MT5931) - #define NIC_NAME "MT5931" - #define NIC_DEVICE_ID "MT5931" - #define NIC_DEVICE_ID_LOW "mt5931" - #elif defined(MT6628) - #define NIC_NAME "MT6628" - #define NIC_DEVICE_ID "MT6628" - #define NIC_DEVICE_ID_LOW "mt6628" - #endif -#endif - -/* NIC driver information */ -#define NIC_VENDOR "MediaTek Inc." -#define NIC_VENDOR_OUI {0x00, 0x0C, 0xE7} - -#if defined(MT6620) - #define NIC_PRODUCT_NAME "MediaTek Inc. MT6620 Wireless LAN Adapter" - #define NIC_DRIVER_NAME "MediaTek Inc. MT6620 Wireless LAN Adapter Driver" -#elif defined(MT5931) - #define NIC_PRODUCT_NAME "MediaTek Inc. MT5931 Wireless LAN Adapter" - #define NIC_DRIVER_NAME "MediaTek Inc. MT5931 Wireless LAN Adapter Driver" -#elif defined(MT6628) - #define NIC_PRODUCT_NAME "MediaTek Inc. MT6628 Wireless LAN Adapter" - #define NIC_DRIVER_NAME "MediaTek Inc. MT6628 Wireless LAN Adapter Driver" -#endif - -/* Define our driver version */ -#define NIC_DRIVER_MAJOR_VERSION 2 -#define NIC_DRIVER_MINOR_VERSION 0 -#define NIC_DRIVER_VERSION 2,0,1,1 -#define NIC_DRIVER_VERSION_STRING "2.0.1.1" - - -/******************************************************************************* -* D A T A T Y P E S -******************************************************************************** -*/ - -/******************************************************************************* -* P U B L I C D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* P R I V A T E D A T A -******************************************************************************** -*/ - -/******************************************************************************* -* M A C R O S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N D E C L A R A T I O N S -******************************************************************************** -*/ - -/******************************************************************************* -* F U N C T I O N S -******************************************************************************** -*/ - - -#endif /* _VERSION_H */ - diff --git a/drivers/net/wireless/mt5931/os/wifi_version.h b/drivers/net/wireless/mt5931/os/wifi_version.h deleted file mode 100755 index 11a0557ebd5f..000000000000 --- a/drivers/net/wireless/mt5931/os/wifi_version.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Yongle Lai @ Rockchip - */ -#ifndef WIFI_VERSION_H -#define WIFI_VERSION_H - -/* - * Marvell MV8686 driver version. - */ -#define MT5931_DRV_VERSION "2.14" - -#endif /* WIFI_VERSION_H */ - diff --git a/drivers/net/wireless/mv8686/11d.c b/drivers/net/wireless/mv8686/11d.c deleted file mode 100755 index 4bc46a60ae2f..000000000000 --- a/drivers/net/wireless/mv8686/11d.c +++ /dev/null @@ -1,698 +0,0 @@ -/** - * This file contains functions for 802.11D. - */ -#include -#include -#include - -#include "host.h" -#include "decl.h" -#include "11d.h" -#include "dev.h" -#include "wext.h" - -#define TX_PWR_DEFAULT 10 - -static struct region_code_mapping region_code_mapping[] = { - {"US ", 0x10}, /* US FCC */ - {"CA ", 0x10}, /* IC Canada */ - {"SG ", 0x10}, /* Singapore */ - {"EU ", 0x30}, /* ETSI */ - {"AU ", 0x30}, /* Australia */ - {"KR ", 0x30}, /* Republic Of Korea */ - {"ES ", 0x31}, /* Spain */ - {"FR ", 0x32}, /* France */ - {"JP ", 0x40}, /* Japan */ -}; - -/* Following 2 structure defines the supported channels */ -static struct chan_freq_power channel_freq_power_UN_BG[] = { - {1, 2412, TX_PWR_DEFAULT}, - {2, 2417, TX_PWR_DEFAULT}, - {3, 2422, TX_PWR_DEFAULT}, - {4, 2427, TX_PWR_DEFAULT}, - {5, 2432, TX_PWR_DEFAULT}, - {6, 2437, TX_PWR_DEFAULT}, - {7, 2442, TX_PWR_DEFAULT}, - {8, 2447, TX_PWR_DEFAULT}, - {9, 2452, TX_PWR_DEFAULT}, - {10, 2457, TX_PWR_DEFAULT}, - {11, 2462, TX_PWR_DEFAULT}, - {12, 2467, TX_PWR_DEFAULT}, - {13, 2472, TX_PWR_DEFAULT}, - {14, 2484, TX_PWR_DEFAULT} -}; - -static u8 lbs_region_2_code(u8 *region) -{ - u8 i; - - for (i = 0; region[i] && i < COUNTRY_CODE_LEN; i++) - region[i] = toupper(region[i]); - - for (i = 0; i < ARRAY_SIZE(region_code_mapping); i++) { - if (!memcmp(region, region_code_mapping[i].region, - COUNTRY_CODE_LEN)) - return (region_code_mapping[i].code); - } - - /* default is US */ - return (region_code_mapping[0].code); -} - -static u8 *lbs_code_2_region(u8 code) -{ - u8 i; - - for (i = 0; i < ARRAY_SIZE(region_code_mapping); i++) { - if (region_code_mapping[i].code == code) - return (region_code_mapping[i].region); - } - /* default is US */ - return (region_code_mapping[0].region); -} - -/** - * @brief This function finds the nrchan-th chan after the firstchan - * @param band band - * @param firstchan first channel number - * @param nrchan number of channels - * @return the nrchan-th chan number -*/ -static u8 lbs_get_chan_11d(u8 firstchan, u8 nrchan, u8 *chan) -/*find the nrchan-th chan after the firstchan*/ -{ - u8 i; - struct chan_freq_power *cfp; - u8 cfp_no; - - cfp = channel_freq_power_UN_BG; - cfp_no = ARRAY_SIZE(channel_freq_power_UN_BG); - - for (i = 0; i < cfp_no; i++) { - if ((cfp + i)->channel == firstchan) { - lbs_deb_11d("firstchan found\n"); - break; - } - } - - if (i < cfp_no) { - /*if beyond the boundary */ - if (i + nrchan < cfp_no) { - *chan = (cfp + i + nrchan)->channel; - return 1; - } - } - - return 0; -} - -/** - * @brief This function Checks if chan txpwr is learned from AP/IBSS - * @param chan chan number - * @param parsed_region_chan pointer to parsed_region_chan_11d - * @return TRUE; FALSE -*/ -static u8 lbs_channel_known_11d(u8 chan, - struct parsed_region_chan_11d * parsed_region_chan) -{ - struct chan_power_11d *chanpwr = parsed_region_chan->chanpwr; - u8 nr_chan = parsed_region_chan->nr_chan; - u8 i = 0; - - lbs_deb_hex(LBS_DEB_11D, "parsed_region_chan", (char *)chanpwr, - sizeof(struct chan_power_11d) * nr_chan); - - for (i = 0; i < nr_chan; i++) { - if (chan == chanpwr[i].chan) { - lbs_deb_11d("found chan %d\n", chan); - return 1; - } - } - - lbs_deb_11d("chan %d not found\n", chan); - return 0; -} - -u32 lbs_chan_2_freq(u8 chan) -{ - struct chan_freq_power *cf; - u16 i; - u32 freq = 0; - - cf = channel_freq_power_UN_BG; - - for (i = 0; i < ARRAY_SIZE(channel_freq_power_UN_BG); i++) { - if (chan == cf[i].channel) - freq = cf[i].freq; - } - - return freq; -} - -static int generate_domain_info_11d(struct parsed_region_chan_11d - *parsed_region_chan, - struct lbs_802_11d_domain_reg *domaininfo) -{ - u8 nr_subband = 0; - - u8 nr_chan = parsed_region_chan->nr_chan; - u8 nr_parsedchan = 0; - - u8 firstchan = 0, nextchan = 0, maxpwr = 0; - - u8 i, flag = 0; - - memcpy(domaininfo->countrycode, parsed_region_chan->countrycode, - COUNTRY_CODE_LEN); - - lbs_deb_11d("nrchan %d\n", nr_chan); - lbs_deb_hex(LBS_DEB_11D, "parsed_region_chan", (char *)parsed_region_chan, - sizeof(struct parsed_region_chan_11d)); - - for (i = 0; i < nr_chan; i++) { - if (!flag) { - flag = 1; - nextchan = firstchan = - parsed_region_chan->chanpwr[i].chan; - maxpwr = parsed_region_chan->chanpwr[i].pwr; - nr_parsedchan = 1; - continue; - } - - if (parsed_region_chan->chanpwr[i].chan == nextchan + 1 && - parsed_region_chan->chanpwr[i].pwr == maxpwr) { - nextchan++; - nr_parsedchan++; - } else { - domaininfo->subband[nr_subband].firstchan = firstchan; - domaininfo->subband[nr_subband].nrchan = - nr_parsedchan; - domaininfo->subband[nr_subband].maxtxpwr = maxpwr; - nr_subband++; - nextchan = firstchan = - parsed_region_chan->chanpwr[i].chan; - maxpwr = parsed_region_chan->chanpwr[i].pwr; - } - } - - if (flag) { - domaininfo->subband[nr_subband].firstchan = firstchan; - domaininfo->subband[nr_subband].nrchan = nr_parsedchan; - domaininfo->subband[nr_subband].maxtxpwr = maxpwr; - nr_subband++; - } - domaininfo->nr_subband = nr_subband; - - lbs_deb_11d("nr_subband=%x\n", domaininfo->nr_subband); - lbs_deb_hex(LBS_DEB_11D, "domaininfo", (char *)domaininfo, - COUNTRY_CODE_LEN + 1 + - sizeof(struct ieeetypes_subbandset) * nr_subband); - return 0; -} - -/** - * @brief This function generates parsed_region_chan from Domain Info learned from AP/IBSS - * @param region_chan pointer to struct region_channel - * @param *parsed_region_chan pointer to parsed_region_chan_11d - * @return N/A -*/ -static void lbs_generate_parsed_region_chan_11d(struct region_channel *region_chan, - struct parsed_region_chan_11d * - parsed_region_chan) -{ - u8 i; - struct chan_freq_power *cfp; - - if (region_chan == NULL) { - lbs_deb_11d("region_chan is NULL\n"); - return; - } - - cfp = region_chan->CFP; - if (cfp == NULL) { - lbs_deb_11d("cfp is NULL \n"); - return; - } - - parsed_region_chan->band = region_chan->band; - parsed_region_chan->region = region_chan->region; - memcpy(parsed_region_chan->countrycode, - lbs_code_2_region(region_chan->region), COUNTRY_CODE_LEN); - - lbs_deb_11d("region 0x%x, band %d\n", parsed_region_chan->region, - parsed_region_chan->band); - - for (i = 0; i < region_chan->nrcfp; i++, cfp++) { - parsed_region_chan->chanpwr[i].chan = cfp->channel; - parsed_region_chan->chanpwr[i].pwr = cfp->maxtxpower; - lbs_deb_11d("chan %d, pwr %d\n", - parsed_region_chan->chanpwr[i].chan, - parsed_region_chan->chanpwr[i].pwr); - } - parsed_region_chan->nr_chan = region_chan->nrcfp; - - lbs_deb_11d("nrchan %d\n", parsed_region_chan->nr_chan); - - return; -} - -/** - * @brief generate parsed_region_chan from Domain Info learned from AP/IBSS - * @param region region ID - * @param band band - * @param chan chan - * @return TRUE;FALSE -*/ -static u8 lbs_region_chan_supported_11d(u8 region, u8 chan) -{ - struct chan_freq_power *cfp; - int cfp_no; - u8 idx; - int ret = 0; - - lbs_deb_enter(LBS_DEB_11D); - - cfp = lbs_get_region_cfp_table(region, &cfp_no); - if (cfp == NULL) - return 0; - - for (idx = 0; idx < cfp_no; idx++) { - if (chan == (cfp + idx)->channel) { - /* If Mrvl Chip Supported? */ - if ((cfp + idx)->unsupported) { - ret = 0; - } else { - ret = 1; - } - goto done; - } - } - - /*chan is not in the region table */ - -done: - lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret); - return ret; -} - -/** - * @brief This function checks if chan txpwr is learned from AP/IBSS - * @param chan chan number - * @param parsed_region_chan pointer to parsed_region_chan_11d - * @return 0 -*/ -static int parse_domain_info_11d(struct ieeetypes_countryinfofullset* - countryinfo, - u8 band, - struct parsed_region_chan_11d * - parsed_region_chan) -{ - u8 nr_subband, nrchan; - u8 lastchan, firstchan; - u8 region; - u8 curchan = 0; - - u8 idx = 0; /*chan index in parsed_region_chan */ - - u8 j, i; - - lbs_deb_enter(LBS_DEB_11D); - - /*validation Rules: - 1. valid region Code - 2. First Chan increment - 3. channel range no overlap - 4. channel is valid? - 5. channel is supported by region? - 6. Others - */ - - lbs_deb_hex(LBS_DEB_11D, "countryinfo", (u8 *) countryinfo, 30); - - if ((*(countryinfo->countrycode)) == 0 - || (countryinfo->len <= COUNTRY_CODE_LEN)) { - /* No region Info or Wrong region info: treat as No 11D info */ - goto done; - } - - /*Step1: check region_code */ - parsed_region_chan->region = region = - lbs_region_2_code(countryinfo->countrycode); - - lbs_deb_11d("regioncode=%x\n", (u8) parsed_region_chan->region); - lbs_deb_hex(LBS_DEB_11D, "countrycode", (char *)countryinfo->countrycode, - COUNTRY_CODE_LEN); - - parsed_region_chan->band = band; - - memcpy(parsed_region_chan->countrycode, countryinfo->countrycode, - COUNTRY_CODE_LEN); - - nr_subband = (countryinfo->len - COUNTRY_CODE_LEN) / - sizeof(struct ieeetypes_subbandset); - - for (j = 0, lastchan = 0; j < nr_subband; j++) { - - if (countryinfo->subband[j].firstchan <= lastchan) { - /*Step2&3. Check First Chan Num increment and no overlap */ - lbs_deb_11d("chan %d>%d, overlap\n", - countryinfo->subband[j].firstchan, lastchan); - continue; - } - - firstchan = countryinfo->subband[j].firstchan; - nrchan = countryinfo->subband[j].nrchan; - - for (i = 0; idx < MAX_NO_OF_CHAN && i < nrchan; i++) { - /*step4: channel is supported? */ - - if (!lbs_get_chan_11d(firstchan, i, &curchan)) { - /* Chan is not found in UN table */ - lbs_deb_11d("chan is not supported: %d \n", i); - break; - } - - lastchan = curchan; - - if (lbs_region_chan_supported_11d(region, curchan)) { - /*step5: Check if curchan is supported by mrvl in region */ - parsed_region_chan->chanpwr[idx].chan = curchan; - parsed_region_chan->chanpwr[idx].pwr = - countryinfo->subband[j].maxtxpwr; - idx++; - } else { - /*not supported and ignore the chan */ - lbs_deb_11d( - "i %d, chan %d unsupported in region %x, band %d\n", - i, curchan, region, band); - } - } - - /*Step6: Add other checking if any */ - - } - - parsed_region_chan->nr_chan = idx; - - lbs_deb_11d("nrchan=%x\n", parsed_region_chan->nr_chan); - lbs_deb_hex(LBS_DEB_11D, "parsed_region_chan", (u8 *) parsed_region_chan, - 2 + COUNTRY_CODE_LEN + sizeof(struct parsed_region_chan_11d) * idx); - -done: - lbs_deb_enter(LBS_DEB_11D); - return 0; -} - -/** - * @brief This function calculates the scan type for channels - * @param chan chan number - * @param parsed_region_chan pointer to parsed_region_chan_11d - * @return PASSIVE if chan is unknown; ACTIVE if chan is known -*/ -u8 lbs_get_scan_type_11d(u8 chan, - struct parsed_region_chan_11d * parsed_region_chan) -{ - u8 scan_type = CMD_SCAN_TYPE_PASSIVE; - - lbs_deb_enter(LBS_DEB_11D); - - if (lbs_channel_known_11d(chan, parsed_region_chan)) { - lbs_deb_11d("found, do active scan\n"); - scan_type = CMD_SCAN_TYPE_ACTIVE; - } else { - lbs_deb_11d("not found, do passive scan\n"); - } - - lbs_deb_leave_args(LBS_DEB_11D, "ret scan_type %d", scan_type); - return scan_type; - -} - -void lbs_init_11d(struct lbs_private *priv) -{ - priv->enable11d = 0; - memset(&(priv->parsed_region_chan), 0, - sizeof(struct parsed_region_chan_11d)); - return; -} - -/** - * @brief This function sets DOMAIN INFO to FW - * @param priv pointer to struct lbs_private - * @return 0; -1 -*/ -static int set_domain_info_11d(struct lbs_private *priv) -{ - int ret; - - if (!priv->enable11d) { - lbs_deb_11d("dnld domain Info with 11d disabled\n"); - return 0; - } - - ret = lbs_prepare_and_send_command(priv, CMD_802_11D_DOMAIN_INFO, - CMD_ACT_SET, - CMD_OPTION_WAITFORRSP, 0, NULL); - if (ret) - lbs_deb_11d("fail to dnld domain info\n"); - - return ret; -} - -/** - * @brief This function setups scan channels - * @param priv pointer to struct lbs_private - * @param band band - * @return 0 -*/ -int lbs_set_universaltable(struct lbs_private *priv, u8 band) -{ - u16 size = sizeof(struct chan_freq_power); - u16 i = 0; - - memset(priv->universal_channel, 0, - sizeof(priv->universal_channel)); - - priv->universal_channel[i].nrcfp = - sizeof(channel_freq_power_UN_BG) / size; - lbs_deb_11d("BG-band nrcfp %d\n", - priv->universal_channel[i].nrcfp); - - priv->universal_channel[i].CFP = channel_freq_power_UN_BG; - priv->universal_channel[i].valid = 1; - priv->universal_channel[i].region = UNIVERSAL_REGION_CODE; - priv->universal_channel[i].band = band; - i++; - - return 0; -} - -/** - * @brief This function implements command CMD_802_11D_DOMAIN_INFO - * @param priv pointer to struct lbs_private - * @param cmd pointer to cmd buffer - * @param cmdno cmd ID - * @param cmdOption cmd action - * @return 0 -*/ -int lbs_cmd_802_11d_domain_info(struct lbs_private *priv, - struct cmd_ds_command *cmd, u16 cmdno, - u16 cmdoption) -{ - struct cmd_ds_802_11d_domain_info *pdomaininfo = - &cmd->params.domaininfo; - struct mrvlietypes_domainparamset *domain = &pdomaininfo->domain; - u8 nr_subband = priv->domainreg.nr_subband; - - lbs_deb_enter(LBS_DEB_11D); - - lbs_deb_11d("nr_subband=%x\n", nr_subband); - - cmd->command = cpu_to_le16(cmdno); - pdomaininfo->action = cpu_to_le16(cmdoption); - if (cmdoption == CMD_ACT_GET) { - cmd->size = - cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN); - lbs_deb_hex(LBS_DEB_11D, "802_11D_DOMAIN_INFO", (u8 *) cmd, - le16_to_cpu(cmd->size)); - goto done; - } - - domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN); - memcpy(domain->countrycode, priv->domainreg.countrycode, - sizeof(domain->countrycode)); - - domain->header.len = - cpu_to_le16(nr_subband * sizeof(struct ieeetypes_subbandset) + - sizeof(domain->countrycode)); - - if (nr_subband) { - memcpy(domain->subband, priv->domainreg.subband, - nr_subband * sizeof(struct ieeetypes_subbandset)); - - cmd->size = cpu_to_le16(sizeof(pdomaininfo->action) + - le16_to_cpu(domain->header.len) + - sizeof(struct mrvlietypesheader) + - S_DS_GEN); - } else { - cmd->size = - cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN); - } - - lbs_deb_hex(LBS_DEB_11D, "802_11D_DOMAIN_INFO", (u8 *) cmd, le16_to_cpu(cmd->size)); - -done: - lbs_deb_enter(LBS_DEB_11D); - return 0; -} - -/** - * @brief This function parses countryinfo from AP and download country info to FW - * @param priv pointer to struct lbs_private - * @param resp pointer to command response buffer - * @return 0; -1 - */ -int lbs_ret_802_11d_domain_info(struct cmd_ds_command *resp) -{ - struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp; - struct mrvlietypes_domainparamset *domain = &domaininfo->domain; - u16 action = le16_to_cpu(domaininfo->action); - s16 ret = 0; - u8 nr_subband = 0; - - lbs_deb_enter(LBS_DEB_11D); - - lbs_deb_hex(LBS_DEB_11D, "domain info resp", (u8 *) resp, - (int)le16_to_cpu(resp->size)); - - nr_subband = (le16_to_cpu(domain->header.len) - COUNTRY_CODE_LEN) / - sizeof(struct ieeetypes_subbandset); - - lbs_deb_11d("domain info resp: nr_subband %d\n", nr_subband); - - if (nr_subband > MRVDRV_MAX_SUBBAND_802_11D) { - lbs_deb_11d("Invalid Numrer of Subband returned!!\n"); - return -1; - } - - switch (action) { - case CMD_ACT_SET: /*Proc Set action */ - break; - - case CMD_ACT_GET: - break; - default: - lbs_deb_11d("Invalid action:%d\n", domaininfo->action); - ret = -1; - break; - } - - lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret); - return ret; -} - -/** - * @brief This function parses countryinfo from AP and download country info to FW - * @param priv pointer to struct lbs_private - * @return 0; -1 - */ -int lbs_parse_dnld_countryinfo_11d(struct lbs_private *priv, - struct bss_descriptor * bss) -{ - int ret; - - lbs_deb_enter(LBS_DEB_11D); - if (priv->enable11d) { - memset(&priv->parsed_region_chan, 0, - sizeof(struct parsed_region_chan_11d)); - ret = parse_domain_info_11d(&bss->countryinfo, 0, - &priv->parsed_region_chan); - - if (ret == -1) { - lbs_deb_11d("error parsing domain_info from AP\n"); - goto done; - } - - memset(&priv->domainreg, 0, - sizeof(struct lbs_802_11d_domain_reg)); - generate_domain_info_11d(&priv->parsed_region_chan, - &priv->domainreg); - - ret = set_domain_info_11d(priv); - - if (ret) { - lbs_deb_11d("error setting domain info\n"); - goto done; - } - } - ret = 0; - -done: - lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret); - return ret; -} - -/** - * @brief This function generates 11D info from user specified regioncode and download to FW - * @param priv pointer to struct lbs_private - * @return 0; -1 - */ -int lbs_create_dnld_countryinfo_11d(struct lbs_private *priv) -{ - int ret; - struct region_channel *region_chan; - u8 j; - - lbs_deb_enter(LBS_DEB_11D); - lbs_deb_11d("curbssparams.band %d\n", priv->curbssparams.band); - - if (priv->enable11d) { - /* update parsed_region_chan_11; dnld domaininf to FW */ - - for (j = 0; j < ARRAY_SIZE(priv->region_channel); j++) { - region_chan = &priv->region_channel[j]; - - lbs_deb_11d("%d region_chan->band %d\n", j, - region_chan->band); - - if (!region_chan || !region_chan->valid - || !region_chan->CFP) - continue; - if (region_chan->band != priv->curbssparams.band) - continue; - break; - } - - if (j >= ARRAY_SIZE(priv->region_channel)) { - lbs_deb_11d("region_chan not found, band %d\n", - priv->curbssparams.band); - ret = -1; - goto done; - } - - memset(&priv->parsed_region_chan, 0, - sizeof(struct parsed_region_chan_11d)); - lbs_generate_parsed_region_chan_11d(region_chan, - &priv-> - parsed_region_chan); - - memset(&priv->domainreg, 0, - sizeof(struct lbs_802_11d_domain_reg)); - generate_domain_info_11d(&priv->parsed_region_chan, - &priv->domainreg); - - ret = set_domain_info_11d(priv); - - if (ret) { - lbs_deb_11d("error setting domain info\n"); - goto done; - } - - } - ret = 0; - -done: - lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret); - return ret; -} diff --git a/drivers/net/wireless/mv8686/11d.h b/drivers/net/wireless/mv8686/11d.h deleted file mode 100755 index 4f4f47f0f878..000000000000 --- a/drivers/net/wireless/mv8686/11d.h +++ /dev/null @@ -1,104 +0,0 @@ -/** - * This header file contains data structures and - * function declarations of 802.11d - */ -#ifndef _LBS_11D_ -#define _LBS_11D_ - -#include "types.h" -#include "defs.h" - -#define UNIVERSAL_REGION_CODE 0xff - -/** (Beaconsize(256)-5(IEId,len,contrystr(3))/3(FirstChan,NoOfChan,MaxPwr) - */ -#define MRVDRV_MAX_SUBBAND_802_11D 83 - -#define COUNTRY_CODE_LEN 3 -#define MAX_NO_OF_CHAN 40 - -struct cmd_ds_command; - -/** Data structure for Country IE*/ -struct ieeetypes_subbandset { - u8 firstchan; - u8 nrchan; - u8 maxtxpwr; -} __attribute__ ((packed)); - -struct ieeetypes_countryinfoset { - u8 element_id; - u8 len; - u8 countrycode[COUNTRY_CODE_LEN]; - struct ieeetypes_subbandset subband[1]; -}; - -struct ieeetypes_countryinfofullset { - u8 element_id; - u8 len; - u8 countrycode[COUNTRY_CODE_LEN]; - struct ieeetypes_subbandset subband[MRVDRV_MAX_SUBBAND_802_11D]; -} __attribute__ ((packed)); - -struct mrvlietypes_domainparamset { - struct mrvlietypesheader header; - u8 countrycode[COUNTRY_CODE_LEN]; - struct ieeetypes_subbandset subband[1]; -} __attribute__ ((packed)); - -struct cmd_ds_802_11d_domain_info { - __le16 action; - struct mrvlietypes_domainparamset domain; -} __attribute__ ((packed)); - -/** domain regulatory information */ -struct lbs_802_11d_domain_reg { - /** country Code*/ - u8 countrycode[COUNTRY_CODE_LEN]; - /** No. of subband*/ - u8 nr_subband; - struct ieeetypes_subbandset subband[MRVDRV_MAX_SUBBAND_802_11D]; -}; - -struct chan_power_11d { - u8 chan; - u8 pwr; -} __attribute__ ((packed)); - -struct parsed_region_chan_11d { - u8 band; - u8 region; - s8 countrycode[COUNTRY_CODE_LEN]; - struct chan_power_11d chanpwr[MAX_NO_OF_CHAN]; - u8 nr_chan; -} __attribute__ ((packed)); - -struct region_code_mapping { - u8 region[COUNTRY_CODE_LEN]; - u8 code; -}; - -struct lbs_private; - -u8 lbs_get_scan_type_11d(u8 chan, - struct parsed_region_chan_11d *parsed_region_chan); - -u32 lbs_chan_2_freq(u8 chan); - -void lbs_init_11d(struct lbs_private *priv); - -int lbs_set_universaltable(struct lbs_private *priv, u8 band); - -int lbs_cmd_802_11d_domain_info(struct lbs_private *priv, - struct cmd_ds_command *cmd, u16 cmdno, - u16 cmdOption); - -int lbs_ret_802_11d_domain_info(struct cmd_ds_command *resp); - -struct bss_descriptor; -int lbs_parse_dnld_countryinfo_11d(struct lbs_private *priv, - struct bss_descriptor * bss); - -int lbs_create_dnld_countryinfo_11d(struct lbs_private *priv); - -#endif diff --git a/drivers/net/wireless/mv8686/ChangeLog.txt b/drivers/net/wireless/mv8686/ChangeLog.txt deleted file mode 100755 index 11a07e7b3bbb..000000000000 --- a/drivers/net/wireless/mv8686/ChangeLog.txt +++ /dev/null @@ -1,716 +0,0 @@ -# -# Created by Yongle Lai in 2010-09-08 -# - -#****************************************************************************# - -1. ¿ÉÒÔͨ¹ýÈçÏÂÃüÁî²é¿´µ±Ç°Ë¯ÃßËøµÄÇé¿ö£º - echo android_power_print_locks,0xf > /sys/scu/24m/active - »ò - cat /proc/wakelocks - -#****************************************************************************# - -============================================================================== -=== Version 2.35 @ 2010-12-31 === -============================================================================== - -1. ½«Æô¶¯º¯ÊýºÍжÔغ¯Êý£¬Ä¿Ç°ÊÇΪRK28ºÍRK29·ÖΪ2Ì×£¬¿ÉÒÔ½«ÆäºÏΪһÌס£ - =>ÔÚRK29ÖУ¬ÐèÒªÔÚboard-rk29sdk.cÖеÄÒ»¸öº¯Êý£º - rk29sdk_wifi_set_carddetect - ÉèΪ·Çstatic£¬²¢ÓÃEXPORT_SYMBOLÅ׳ö¡£ - -2. ÔÚwext.cÖÐÈ¥³ý£º#if (ANDROID_POWER_SAVE == 1) Ïà¹ØµÄËùÓÐÄÚÈÝ¡£ - -3. È¥³ýwext.cÖÐµÄ - lbs_do_ioctl - lbs_ioctl_setget_oneint - lbs_auto_deep_sleep - lbs_deepsleep_ioctl - lbs_set_deepsleep - lbs_is_command_allowed - ½Ó¿Úº¯Êý¡£ - -4. -============================================================================== -=== Version 2.34 @ 2010-12-23 === -============================================================================== - -1. µ±WIFIÇý¶¯ÒÔÄ£¿é·½Ê½¼ÓÔغͱàÒëʱ£¬GPIOÏà¹ØµÄº¯ÊýÒòΪûÓÐÅ׳ö¶øµ÷Óò»µ½¡£ - ÔÚwifi_power_ops.cÖн«GPIOÏà¹Ø²Ù×÷ÐÞ¸ÄÈçÏ£º - gpio_direction_output(gpio->gpio_id, GPIO_OUT); - __gpio_set(gpio->gpio_id, sensitive); - -2. ÐèÒªÌí¼Ó¶Ô2.6.32Äں˵ÄÖ§³Ö£¬ÒòΪRK29ʹÓõÄÊÇ2.6.32Äں˵ÄLinux¡£ - -3. ÔÚµçÔ´¹ÜÀí»úÖÆÖУ¬½«¶¨Ê±Æ÷ÉèÖÃΪ10Ã룬 - #define TIMER_INTERVAL 10000 - »áÒýÆðµÄÒ»¸öÎÊÌâÊÇ£¬ÔÚIDLEʱ£¬È¥µã»÷ÍøÒ³£¬ÓÉÓÚÊÇÔÚÊ¡µç»úÖÆÏ£¬ËùÒÔÍøÂçÏ൱ - Âý£¬¿´À´´ÓIDLE±äΪBUSY£¬ÐèÒªÓнϿìµÄ·´Ó¦Ëٶȡ£ - - ¶ø´ÓIDLEתΪBUSY£¬ÔòÐèÒª³¤Ò»Ð©µÄ·´Ó¦Ê±¼ä¡£ - - ÏÖ½«Õâ¸öʱ¼ä¼ä¸ô¸ÄΪ3Ã룬¼´´ÓIDLE±äΪBUSY£¬Ö»ÐèÒª3Ã룬·´¹ýÀ´ÎÒÃÇÉèΪ15Ãë¡£ - -4. ·¢ÏÖÁËÒ»¸öBUG£ºµ±Á¬½ÓAPʱ»á·¢ÉúµôÏßÖØÁ¬£¬ÕâÖÖÇé¿öÏÂËøµÄ״̬»ú²»ÕýÈ·¡£ - (1)ÔÚpower_save_suspend / resumeÖУ¬²¢Ã»ÓгɶԳöÏÖ¡£ - (2)ÔÚPower save SUSPENDÖУ¬È¥µô¼ÓËøµÄ²Ù×÷¡£ - (3)ÔÚ½¨Á¢Á¬½Ó¿ªÊ¼µÄ״̬SYN_SENT£¬ÎÒÃÇÒ²ÐèÒªÈÏΪÍøÂ翪ʼæÁË£¬¹Ø±ÕÊ¡µçģʽ¡£ - (4)µ±ÍøÂç״̬Ϊ¿ÕÏУ¬Õâʱ¼ì²éµ½UDPÁ¬½Ó£¬ÔÚ´ò¿ªÍøÒ³Çé¿öÏ£¬ÎªDNSÇëÇó£¬ÎÒÃÇ - ÔÚÕâÖÖÇé¿öÏ£¬Ó¦¸ÃÂíÉϽ«ÍøÂçת»»ÎªÃ¦×´Ì¬¡£ - -============================================================================== -=== Version 2.33 @ 2010-12-23 === -============================================================================== - -1. ÓÐÓû§ÐèÒª½«MACµØÖ·É趨³É×ÔÒѵĶΣ¬Õâ¾ÍÒªÇóÎÒÃÇÇý¶¯¿ÉÒÔ»ñÈ¡¿Í»§µÄMACµØÖ·£¬ - ²¢½«ÆäÉ趨µ½FWºÍHOST DRIVERÖС£ - (1)ÐèҪʹÓÃÌض¨µÄLoader£ºBootloader version: 2010-12-22#90.04 - (2)ÐèÒªºÏ²¢ÃÀÓÑÌṩÁËdrivers/scu/rk28_kld.cÎļþ£¬Ìí¼Ó¶ÁMACµØÖ·µÄ¹¦ÄÜ£º - Ìí¼ÓMAC¶ÔÓ¦µÄMagicÊýºÍÊý¾Ý½á¹¹£¬Ìí¼ÓÒ»¸ö¶ÁMACµÄº¯Êý¡£ - (3)ÐÞ¸Äwifi_config.c£¬Ìí¼Ó´ÓKLDÖжÁÈ¡MAC½Ó¿ÚµÄº¯Êý£¬¼´ÈÃÓû§¿ÉÒÔ×Ô¶¨ÒåMAC - µØÖ·µÄ½Ó¿Úº¯Êý£¬¸ø³öÒ»¸ö¿É×Ô¶¨ÒåµÄ½Ó¿Ú¡£ - (4)ÔÚmain.cµÄlbs_setup_firmwareº¯Êýĩ⣬ÎÒÃÇÉ趨еÄMACµØÖ·¡£ - - ·¢ÏÖͨ¹ýPING°ü£¬µÚÒ»´ÎÆðÀ´Ê±ÎÒÃÇ¿´²»µ½Ê¹ÓÃеÄMACµØÖ·£¬ - =>½«ÕâÒ»²Ù×÷·Åµ½lbs_setup_firmware֮ǰ½øÐС£Ò²²»ÐУ¬¿´À´²»ÊÇλÖÃÎÊÌâ¡£ - =>lbs_set_mac_addressº¯ÊýµÄaddr²ÎÊý²¢²»ÊǼòµ¥µÄMAC£¬¶øÊÇstruct sockaddr *¡£ - =>ÔÚset_macaddressºó¼ÓÈçÏÂ2¾äÔòҲûÎÊÌ⣺ - //memcpy(priv->current_addr, mac, ETH_ALEN); - //memcpy(priv->dev->dev_addr, mac, ETH_ALEN); - =>ÕýÈ·µÄÓ÷¨Ó¦¸ÃÈçÏ£º - { - struct sockaddr addr; - u8 * mac = (u8 *)(addr.sa_data); - - if (wifi_customized_mac_addr(mac) == 1) - { - lbs_set_mac_address(priv->dev, &addr); - } - } - -============================================================================== -=== Version 2.32 @ 2010-12-18 === -============================================================================== - -============================================================================== -=== Version 2.31 @ 2010-12-17 === -============================================================================== - -1. Ìí¼Ó¶à²¥MulticastµÄÖ§³Ö¡£ - ´Ó2.6.31µÄ´úÂëÖÐÖ±½Ó¿½±´¹ýÀ´¡£ - (1)ÔÚÄ¿±ê°åÉÏÖ´ÐÐmcast_client£º - setsockopt: IP_ADD_MEMBERSHIP : No such device - - =>ÔÚÄÚºËÀï¼ÓÉÏ[*] IP: multicastingÑ¡Ïî¡£ - ÈÔÈ»±¨Í¬ÑùµÄ´íÎó¡£(Õâ¸öÑ¡Ïî²»´ò¿ª£¬ÈÔÈ»¿ÉÒÔÊÕµ½¶à²¥°ü¡£) - - =>route add default gw 192.168.1.1 - ¾Í¿ÉÒÔÕý³£ÔËÐÐÁË¡£ - - (2)·¢Ïֶಥ°üÓм¸¸öÌص㣺 - A. ÈÝÒ׶ª°ü£¬ÔÚÊ¡µçģʽÇé¿öÏ£¬·Ç³£ÈÝÒ׶ª°ü¡£ - B. ÔڶಥӦÓÃÖУ¬ÓÉÓÚûÓй̶¨µÄÁ¬½Ó£¬Òò¶øÎÞ·¨È·¶¨ÍøÂç´¦ÓÚæµÄ״̬¡£ - -2. Õë¶Ô¶à²¥½øÐеÄÊ¡µç»úÖƲâÊÔ£º - (1)µ±ÓжಥÁ¬½Ó£¬ÇÒÓÐÊý¾ÝÁ÷Á¿Ê±£¬ÎÒÃÇÈÏΪÍøÂçÊÇæµÄ¡£ - =>Ô­À´ÎÒÈÏΪֻҪµ¥ÏòûÓÐÊý¾ÝÁ÷£¬¼´¿ÉÈÏΪÍøÂç²»ÊÇæµÄ£¬ÕâÊÇÒòΪ֮ǰÓö - µ½ÎÞ·¨ÐÝÃßµÄÎÊÌâʱ£¬»áÓÐÊÕµ½¹ã²¥°ü»òÊÇARP°üµÈ£¬Ó°ÏìÁËÎÒÃǵÄÅжϡ£ - =>ÔڶಥµÄ¿Í»§¶Ë¹¤×÷ʱ£¬Ö»»áÓнÓÊÕ£¬²»»áÓз¢ËÍ£¬ËùÒÔÕë¶ÔÕâÖÖÇé¿öÎÒÃÇÐè - ÒªÐÞ¸ÄÅжϻúÖÆ£¬¼´Á÷Á¿²»Äܼòµ¥µØÇø·ÖÓкÍÎÞ£¬Ò²²»ÄÜÒÔµ¥ÏòΪÒÀ¾Ý¡£ - =>´Ó¶à²¥µÄ²âÊÔÇé¿öÀ´¿´£¬ÔÚ·þÎñ¶ËÒÔ1ÃëÖÓ·¢ËÍÒ»¸ö°üµÄËÙÂÊ£¬ÔÚWIFIÕâ¶Ë£¬Èç - ¹ûÊÇÔÚPS-POLL´ò¿ªµÄÇé¿öÏ£¬ÔòÔÚ10ÃëÄÚÊÕµ½2¸ö°üµÄ¸ÅÂʽϴó£¬ÊÕµ½3¸ö°üµÄ - ¸ÅÂʽÏС¡£Ä¿Ç°½«Õâ¸ö·§ÖµÉ趨Ϊ3£¬Öµ½ÏСÔòÅÂÓë¹ã²¥°üºÍARP°ü»ìÔÚÒ»Æð¡£ - - (2)¶à²¥¿Í»§¶Ë¿ªÆôʱ£¬»áÓÐÈçÏÂÁ¬½Ó£º - udp 0 0 0.0.0.0:9000 0.0.0.0:* - -============================================================================== -=== Version 2.30 @ 2010-12-14 === -============================================================================== - -1. Ìí¼Ó²¢ÑéÖ¤¶ÔADHOCÍøÂçµÄÖ§³Ö¡£ - (1)ͨ¹ýiwlistÊÇ¿ÉÒÔɨÃèµ½ADHOCÀàÐ͵ÄAPµÄ£¬µ«ÊǹØÁª²»ÉÏ¡£ - -EINVAL; - (2)¿ÉÄÜÊÇÈí¼þ¸üеÄÎÊÌ⣬¹ØÁªÃüÁîûÓÐÎÊÌâ¡£ - iwlist wlan0 scanning - iwconfig wlan0 mode ad-hoc - iwconfig wlan0 essid adhoclai - ÕâÊÇ´ÓÎÒÃÇÕâÒ»¶ËÈ¥¹ØÁªÁíÒ»¶Ë¡£ - - iwconfig wlan0 mode ad-hoc - iwconfig wlan0 essid lai - ÕâÑù¾Í¿ÉÒÔÈñðÈËËÑË÷µ½Ò»¸öÃûΪlaiµÄADHOCÃû³ÆÁË¡£ - - (3)ÑéÖ¤ADHOCÍøÂçÔÚWEP¼ÓÃÜ·½Ê½ÏµÄÓ¦Óᣠ- A. ½«adhoclaiÉèÖÃΪWEP OPENµÄ·½Ê½£¬ÃÜÔ¿ÊÇ12345£¬Ã»ÓÐÎÊÌ⣬¿ÉÕý³£PINGͨ¡£ - =>ÓмÓÃÜ·½Ê½Ï£¬»á¶ª°ü£¬µ«¶ª°üÂʲ»´ó¡£ - B. ½«adhoclaiÉèÖÃΪWEP SHAREDµÄ·½Ê½£¬ÃÜÔ¿ÊÇ12345£¬Ã»ÓÐÎÊÌâ¡£ - iwconfig wlan0 key s:12345 - iwconfig wlan0 key restricted - - (4)ÑéÖ¤Ö§³Öͨ¹ýwpa_supplicant¹ØÁªADHOCÍøÂç¡£ - =>wpa_supplicant×ÜÊǻὫÍøÂç½Ó¿ÚÀàÐ͸ü¸ÄΪManaged£¬¶ø²»ÊÇad-hocÀàÐÍ¡£ - =>ÔÚwpa_supplicantÖУ¬ÔÚ±éÀúAPÁбíʱ£¬×ÜÊǽ«IBSSÀàÐ͵ÄAPºöÂÔµô¡£ - ÐÞ¸Äevents.cÖеÄwpa_supplicant_select_bssº¯Êý: - Èç¹ûÊÇIBSSÀàÐ͵ÄAP£¬Í¬Ê±ÒªÑ¡ÔñµÄģʽ²»ÊÇIBSSʱ£¬²Å½«Õâ¸öAPºöÂÔ¡£ - - ³É¹¦: ¿ÉÒÔ¹ØÁªÉÏIBSSµÄAPÁË¡£ - -============================================================================== -=== Version 2.29 @ 2010-12-07 === -============================================================================== - -²»ÖªµÀΪʲô£¬¼Ç¼ûÓб£´æÏÂÀ´¡£ - -============================================================================== -=== Version 2.28 @ 2010-12-03 === -============================================================================== - -1. Ö»ÓÐÔÚTCPÓÐÓÐЧÁ¬½Óʱ£¬ÎÒÃDzÅȥͳ¼ÆÁ÷Á¿¡£µ±UDPÓÐÁ¬½Óʱ£¬ÎÒÃǾÍÈÏΪÍøÂç´¦ÓÚ - æ״̬£¬²»È¥Í³¼ÆÁ÷Á¿¡£ - -2. ÔÚscan.cÖн«ADHOCÏà¹ØµÄÐźÅÓï¾äÈ¥µôʱ£¬²»Ð¡ÐĽ« - start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); - Ò²×¢Ê͵ôÁË£¬Ôì³ÉÁËÔÚɨÃèÁбíÖÐÏÔʾµÄÐźÅÖµ²»×¼È·£¬ÎªÈ«0Öµ¡£ - -============================================================================== -=== Version 2.27 @ 2010-11-25 === -============================================================================== - -1. ÊÀ½¡Apple±¨¸æÒ»¸öÎÊÌ⣺ - ÔÚWIFIÐÝÃߺ󣬽«AP¹Ø±Õ»òÊÇ×ßµ½WIFIûÓÐÐźŵĵط½£¬»½ÐѺó»òÊǻص½·þÎñÇøºó£¬ - WIFIµÄÐźÅָʾûÓиı䣬¶øÇÒÏÔʾµÄ״̬ΪÁ¬½Ó£¬µ«ÎÞ·¨Á¬½ÓÍøÂç¡£ - =>ÒòΪÏÖÔÚ˯Ãßʱ»á½«ÍøÂç¶Ï¿ª£¬¶ø»½ÐѺóµÚÒ»¼þÊÂÊÇÈÃÆäÐźÅÏûʧ£¬ - =>ËùÒÔÕâ¸öÎÊÌâÊDz»´æÔڵġ£ - -2. ·¢ÏÖÓÐ˯Ãß²»Á˵ÄÇé¿ö£º - 74.125.153.188:5228 ESTABLISHED ÕâÊÇGoogleµÄÍøÕ¾£¬ÔÚÃÀ¹ú¡£ - ͨ¹ýifconfig²é¿´£¬Ã¿¸ô¼¸ÃëÖÓ»áÓÐÊý¾Ý°üÓɵ½£¬µ«Ã»Óз¢ËÍ¡£ - tcp 0 1 192.168.0.245:56599 64.233.181.100:443 CLOSE_WAIT - tcp 0 1 192.168.0.245:58436 64.233.181.100:80 CLOSE_WAIT - tcp 0 1 192.168.0.245:60600 64.233.181.138:443 CLOSE_WAIT - tcp 0 0 192.168.0.245:49446 74.125.153.188:5228 ESTABLISHED - Ç°3¸öÒªÔÚ¾­Àú3·ÖÖÓ×óÓҲŻá¶Ï¿ªÁ¬½Ó£¬¶ø×îºóÒ»¸öÔò×ÜÊDz»¿Ï¶Ï¿ªÁ¬½Ó¡£ - =>¹ýÁËÒ»¸öÍíÉ϶¼Ã»ÓжϿªÁ¬½Ó¡£»áÓÐÊý¾Ý°üÊÕ·¢£¬µ«ÊǺÜÉÙ¡£ - =>¼øÓÚÕâÖÖÇé¿ö£¬ÎÒÃÇÐèÒª¼à¿ØÍøÂçÊÕ·¢Êý¾Ý°üÁ÷Á¿£¬µ±Á÷Á¿Ð¡ÓÚÒ»¶¨ÖµÊ±£¬½«ÆäÊÓ - Ϊ¿ÕÏÐ״̬£¬ÊÍ·Å˯ÃßËø¡£ - =>¶ÔÓÚÕâ¸öIPµØÖ·µÄÁ¬½Ó£¬·¢Ïֺܳ¤Ê±¼ä¶¼Ö»ÓнÓÊÕ£¬¶øûÓз¢ËÍ£¬ÏñÊÇ·þÎñ¶ËÒ»Ñù£¬ - ²»¹ÜÈçºÎ£¬Ö»Òª²»ÊÇË«ÏòÓÐÊý¾Ý£¬Ò»¶Îʱ¼äºóÎÒÃǾͻὫÆäÈÏΪÊÇIDLEÁ¬½Ó¡£ - - =>ÏÖÔڵĴ¦Àí·½Ê½ÈçÏ£¬Èç¹ûÔÚ30ÃëÄÚûÓÐTX»òRX£¬ÔòÎÒÃÇÈÏΪWIFI¿ÉÒÔ±»ÖÃΪIDLE - ÁË£¬ÊÍ·Å˯ÃßËø£¬ÒÔÈÃϵͳ¿ÉÒÔ½øÈë¶þ¼¶Ë¯Ãß¡£ - -============================================================================== -=== Version 2.26 @ 2010-11-19 === -============================================================================== - -½â¾öSSIDÖк¬ÓÐÖÐÎÄ×Ö·ûµÄÏÔʾ¼°¹ØÁªÎÊÌâ¡£ - -1. »ų́²»ÄÜÏÔʾº¬ÓÐÖÐÎÄÃüÃûµÄ·ÓÉÆ÷£¬¶øÇÒ»ų́ҲÁ¬½Ó²»ÉϺ¬ÓÐÖÐÎÄÃüÃûµÄÍøÂç¡£ - =>ͨ¹ýiwlist¿ÉÒÔɨÃèµ½´øÓÐÖÐÎĵÄAP¡£ - =>ÔÚWIFIÉèÖýçÃæÖУ¬APÃû³ÆÖеÄÖÐÎı»ÏÔʾ³ÉÏ»®Ïß¡£ - =>WPA_SUPPÖеÄÁбíΪ£º - d8:5d:4c:38:86:48 2437 232 [WEP] tplink__ - =>Õâ˵Ã÷ÔÚÇý¶¯Öв¢Ã»ÓжÔɨÃèÁбíÖеÄAPÃû³Æ×öÏÞÖÆ£¬ÎÊÌâÔÚWPA_SUPPÉÏ¡£ - =>ÐÞ¸ÄWPA_SUPPÖÐcommon.cÖеÄwpa_ssid_txtº¯Êý£¬²»×ö×Ö·ûÀàÐ͵ÄÏÞÖÆ¡£ - WPA_SUPPÖпÉÒÔÏÔʾÖÐÎÄÃûÁË¡£ - =>µ«ÔÚAndroidÖн«ÏÔʾ³ÉÁËtplink5ÁË£¬Ó¦¸ÃÊDZ¾µØ»¯µÄÎÊÌ⣬ÔÚAndroidÖпÉÄÜʹÓà - µÄÊÇUNICODE£¬ÕâÐèÒª×öת»»¡£ - =>ÔÚÇý¶¯Öн«º¬ÖÐÎĵÄSSID´òÓ¡³öÀ´£º - tplinkÀµ = SSID=74 70 6c 69 6e 6b c0 b5 - ÆäÖÐC0 B5ÊÇÀµµÄGB2312±àÂ룬µ±È»GBKÒ²ÊÇÕâ¸ö±àÂë¡£ - =>ÔÚÇý¶¯ÖУ¬Ö±½Ó½«"tplinkÀµ"ת»»ÎªUTF-8±àÂ룬ÔÚAndroidÖоͿÉÒÔÏÔʾÖÐÎÄÁË¡£ - //UTF-8 - bss->ssid[6] = 0xE8; - bss->ssid[7] = 0xB5; - bss->ssid[8] = 0x96; - =>ÔÚÇý¶¯ÖÐÖ±½ÓʹÓÃUnicode±àÂ룺²»ÐС£ - //Unicode - bss->ssid[6] = 0x8D; - bss->ssid[7] = 0x56; - =>¿´À´Ö»ÄÜʹÓÃUTF-8±àÂëÁË¡£ - -2. ΪÁ˲»¸Ä±äAndroid£¬ÔÝʱ½«¶ÔGB2312µÄÖ§³Ö·Åµ½MV8686µÄÇý¶¯ÖÐʵÏÖ£¬µÈ¹¦ÄÜÑéÖ¤Íê - ³Éºó½«ÊÊ»ú·Åµ½WPA_SUPPÖÐʵÏÖ£¬ÒÔ±ÜÃâWIFI±äµÃÌ«¶à£¬ÕâÖÖ¹¦Äܱ¾ÉíÔÚÓ¦ÓòãʵÏÖ - ½ÏΪºÏÊÊ£¬ÒòΪÇý¶¯ÐèÒªÔËÐкܿ졣 - (1)¶ÔɨÃèµ½µÄAP£¬ÐèÒª½«ÆäSSID½øÐÐת»»¡£ - =>ÕâÀïÉæ¼°µ½Ò»¸ö±È½ÏÂé·³µÄÎÊÌâÊÇ£¬80211ЭÒéÕ»¶ÔSSIDµÄ³¤¶ÈÏÞÖÆΪ32¸ö×Ö·û¡£ - ÔÚTPLINK WR941NÖУ¬ÏÞÖƵÄÊÇ32¸ö×Ö·û£¬Ò²ÊÇ32¸öºº×Ö£¬¹²64×Ö½Ú¡£ - ¶øIEEE80211_MAX_SSID_LENµÄÏÞÖÆΪ32×Ö½Ú¡£»¹ÓÐÒ»¸ö±äÁ¿IW_ESSID_MAX_SIZE¡£ - ËùÒÔÒªÖ§³Ö - =>ÓÉÓÚÒ»¸öºº×Ö×î¶à¶ÔÓ¦6¸ö×Ö½ÚµÄUTF-8±àÂ룬ËùÒÔ¹²ÐèÒª: 32 * 8 = 256 ×Ö½Ú¡£ - (2)ÔÚset_ssidÖУ¬ÐèÒª½«UTF-8±àÂëµÄSSIDת»»ÎªGB2312±àÂëµÄSSID¡£ - network={ - ssid=e4b880e4ba8ce4b889 - key_mgmt=NONE - priority=168 - } - =>wpa_supplicant»á½«SSIDµÄUTF-8´æ´¢ÎªÈçÉϵĸñʽ¡£ - =>ÔÚset_ssidÖÐÊÕµ½µÄÉèÖÃȷʵΪe4 b8 80 e4 ba 8c e4 b8 89£¬ÕâÊÇÕýÈ·µÄ¡£ - (3)ÐÞ¸ÄÈçÏÂÍ·Îļþ£¬ÒÔ±£Ö¤Ö§³Ö×î´óµÄSSID±¾µØ»¯£º - =>ÐÞ¸Äinclude/linux/ieee80211.h: IEEE80211_MAX_SSID_LEN = 256 - =>ÐÞ¸Äinclude/linux/wireless.h: IW_ESSID_MAX_SIZE = 256 - ======= - ÓÉÓÚÇý¶¯²»Éæ¼°µ½±¾µØ»¯£¬ËùÒÔʵ¼ÊÉÏÎÒÃÇûÓбØÒªÉèÕâô´ó£¬×î´ó32¸öºº×ÖµÄ - »°£¬Ö»ÐèÒª64×Ö½Ú¡£ - =>ÐÞ¸Äinclude/linux/ieee80211.h: IEEE80211_MAX_SSID_LEN = 64 - =>ÐÞ¸Äinclude/linux/wireless.h: IW_ESSID_MAX_SIZE = 64 - -3. ͨ¹ýµÚ2µãÖеÄʵÑéÖ¤Ã÷ÔÚÇý¶¯ÖÐʵÏÖ±¾µØ»¯£¬ÊDz»ºÏÊʵģ¬»áºÜ¸´ÔÓ£¬ÒòΪ¼´Ê¹¿ÉÒÔ - Õýȷת»»£¬ÈÔÈ»ÐèÒªÐÞ¸Äwpa_supplicant£¬ÒòΪÆä´æ´¢Ê±Ê¹ÓÃÁËBLOBµÄ·½Ê½£¬¶ø´ÓÆä - ÅäÖÃÎļþ¶Á³öÀ´ºó£¬Ã»Óн«Æäת»»ÎªGB2312£¬¶øÊǵ±³É´®À´´¦Àí£¬ËùÒÔAndroidµÄÏÔʾ - ÊDz»ÕýÈ·µÄ£¬ËùÒÔ×îÖÕ¾ö¶¨½«±¾µØ»¯µÄÖ§³Ö·Åµ½WPA_SUPPÖÐʵÏÖ¡£ - =>ÔÚwpa_supplicant_ctrl_iface_scan_resultsÖн«ËÑË÷µ½µÄAPµÄSSID¸ÄΪUTF8µÄÐÎ - ʽ£¬ÒÔ±£Ö¤ºº×ÖÔÚAndroidÖпÉÒÔ±»ÕýÈ·ÏÔʾ¡£ - =>ÔÚ´ÓÅäÖÃÎļþÖжÁÈ¡ÍøÂçÅäÖÃÖУ¬½«SSID´ÓBLOBµÄ·½Ê½×ª»»ÎªGB2312µÄ·½Ê½¡£ - ÕâÆäʵӦ¸Ã´ÓAndroidÉèÖõ½WPA_SUPPʱ£¬½«Æäת»»ÎªGB2312¡£ - -4. ͨ¹ýwireless toolsÎÞ·¨ÕýÈ·²Ù×÷ÓÐÖÐÎÄ×Ö·ûµÄSSIDµÄAP¡£ - (1)iwlist¿ÉÒÔÕýÈ·ÏÔʾÓÐÖÐÎĵÄSSIDµÄAP¡£ - (2)ͨ¹ýiwconfig wlan0 essidÎÞ·¨³É¹¦¹ØÁªÉÏAP¡£ - =>assoc_req->mode == IW_MODE_INFRA - ÓÉÓÚÎÒÃǽ«MODEµÄÉèÖ÷½Ê½¸ÄµôÁË£¬ËùÒÔÔÚÏÂESSIDÃüÁîʱ£¬ÐèÒªÏÈÉèÖÃMODE¡£ - iwconfig wlan0 mode managed - (3)iwconfig¿ÉÒÔÕýÈ·ÏÔʾÒѾ­¹ØÁªÉϵÄÓÐÖÐÎÄ×Ö·ûµÄAPÃû×Ö¡£ - (4)PINGÎÞ·¨³É¹¦¡£--ÊÇÒòΪETH0µÄ´æÔÚ£¬¶øÇÒ»¹ÎªÆäÅäÖÃÁËÏàͬÍø¶ÎµÄIPµØÖ·¡£ - =>wireless tools¿ÉÒÔÕýÈ·²Ù×÷ÓÐÖÐÎÄ×Ö·ûµÄAP¡£ - -5. ²âÊÔwpa_supplicant¶ÔÖÐÎĵÄÖ§³Ö¡£ - (1)ÊÖ¶¯Ìí¼ÓÒ»¸öÍøÂç¡£ - add_network - set_network 0 ssid "tplinkÀµ" - save_config - =>Æä»á±»µ±³ÉBLOBµÄ·½Ê½½øÐб£´æ¡£ - ssid=74706c696e6bc0b5 - ÎÒÃÇÐèÒªÈÃÆä±£´æΪGB2312µÄ·½Ê½£¬¶ø²»ÊÇBLOBµÄ·½Ê½¡£ - =>Ìí¼ÓÕë¶ÔSSIDµÄparserºÍwriter£¬¶ÀÁ¢½âÎöSSID×ֶΡ£ - (2)ÊÖ¶¯ÉèÖÃÍøÂçÐèÒªÌí¼Ókey_mgmt=NONE×ֶΡ£ - -============================================================================== -=== Version 2.25 @ 2010-11-16 === -============================================================================== - -1. ´ò¿ªWIFIºóɨÃèÁбí³öµÃ½ÏÂý¡£ - -2. µ±Á¬½ÓWPAµÄAP£¬Èç¹ûÊä´íÃÜÂëµÄ»°£¬ÔòÆä·µ»ØµÄʼþΪ£º - [13586] EVENT: disassociated - µ±Ç°µÄ´¦ÀíÖжÔÓÚÕâһʼþ¾Í»áÈ¥½øÐÐÖØÁª£¬ÆäʵûÓбØÒª¡£ - - [58] lbs_ret_80211_associate: association successfully. - [59] EVENT: disassociated: connected=0 - [59] Trying to re-associate to previous AP. - [59] lbs_cmd_80211_deauthenticate: enter... - [59] lbs_mac_event_disconnected: enter........connect=0 - =>ÒÔÉÏΪµ±Ç°¹ØÁªÊ±µÄ´¦ÀíÁ÷³Ì¡£ - (1)¼´Ê¹·¢Ë͵ĹØÁªÃÜÂë²»ÕýÈ·£¬¹ØÁªÃüÁîÈÔÈ»»á·µ»Ø³É¹¦¡£ - (2)Ëæºó»áÓÐÒ»¸öDISASSOCIATEDµÄʼþ´ÓFWËÍÉÏÀ´¡£ - (3)ÓÉÓÚµÚÒ»²½ÖÐÎÒÃÇÈÏΪ¹ØÁªÒѾ­³É¹¦£¬Òò¶øÕâʱ»á½øÐÐÖØÐÂÁ¬½Ó¡£ - (4)ÖØÐÂÁ¬½Óʱ»áµ÷ÓÃdeauthenticated½øÐÐÁ¬½Ó¶Ï¿ª£¬Çå³ýÁ¬½Ó²ÎÊý¡£ - ²¢ÔÚÆäÖлáµ÷ÓÃdisconnectedÇå³ýÇý¶¯ÖеÄÏà¹ØÉèÖᣠ- - =>ÓÉÒÔÉϵķÖÎöÖУ¬ÎÒÃÇ¿ÉÒÔ¿´³öÎÊÌâËùÔÚ£º - (1)ʵ¼ÊµÄ¹ØÁª½á¹ûÓë¹ØÁªÃüÁîµÄ·µ»Øֵδ±ØÒ»Ö¡£ÕâÓ¦ÊÇ27ÖÐÓöµ½ÎÊÌâµÄÔ­Òò¡£ - - [196] lbs_ret_80211_associate: association successfully. - [197] EVENT: disassociated: connected=0 - [197] lbs_mac_event_disconnected: enter........connect=0 - [202] lbs_ret_80211_associate: association successfully. - [203] EVENT: disassociated: connected=0 - [203] lbs_mac_event_disconnected: enter........connect=0 - =>µã»÷Ò»´ÎÁ¬½Ó£¬»á·¢ËÍ2´Î¹ØÁªÃüÁÕâÈõ¯³öÃÜÂë´íÎó¿òµÄËٶȱäÂý²»ÉÙ¡£ - - =>ÔÚÊÕµ½disassociationʼþʱ£¬ÎÒÃDz»±Ø½øÐÐÖØÁª£¬ÒòΪÔÚ³ö´í³¬Ê±¶Ï¿ªµÈÎÊÌâ - ʱ£¬ÊÕµ½µÄÊÇdisconnectedʼþ¡£¶øÇÒÔÚÎÒÃǵ±Ç°µÄ˯Ãß´¦Àí·½Ê½ÖУ¬Ó¦¸Ã²»ÈÝÒ× - ³öÏÖÕâ¸öʼþ¡£³ý·ÇÒì³£·¢Éú¡£ - -3. ÔÚWEXTÖУ¬ºÜ¶àÉ趨²ÎÊý½Ó¿Ú¶¼»á´¥·¢¹ØÁª²Ù×÷£¬ÕâÊÇû±ØÒªµÄ£º - [557] lbs_set_mode: call lbs_postpone_association_work - [558] lbs_set_auth: call lbs_postpone_association_work - [558] lbs_set_encodeext: call lbs_postpone_association_work - ...... - [558] lbs_set_encodeext: call lbs_postpone_association_work - [558] lbs_set_auth: call lbs_postpone_association_work - ...... - [559] lbs_set_auth: call lbs_postpone_association_work - [559] lbs_set_mode: call lbs_postpone_association_work - [559] lbs_set_genie: call lbs_postpone_association_work - [559] lbs_set_auth: call lbs_postpone_association_work - ...... - [559] lbs_set_auth: call lbs_postpone_association_work - [559] lbs_set_freq: call lbs_postpone_association_work - [559] lbs_set_essid: call lbs_postpone_association_work - [559] lbs_set_wap: call lbs_postpone_association_work - [560] lbs_ret_80211_associate: association successfully. - - =>Ö»ÁôÏÂESSIDºÍWAPÁ½Õß¡£ - (1)Á¬½ÓûÓмÓÃܵÄAP£¬Ã»ÓÐÎÊÌâ¡£ - (2)Á¬½ÓOPEN WEP¼ÓÃܵÄAP£¬ÕýÈ·ÃÜÂëÏÂûÓÐÎÊÌ⣬´íÎóÃÜÂëÏ£¬¹ØÁª³É¹¦£¬»áÒ» - ֱͣÔÚ»ñÈ¡IP´¦£¬²»»áÌáʾ´íÎó£¬ÓÉÓÚAndroid³¬Ê±ºó϶ϿªÃüÁî¡£ - (3)Á¬½ÓSHARED WEP¼ÓÃܵÄAP£¬ÕýÈ·ÃÜÂëÏÂûÓÐÎÊÌ⣬´íÎóÃÜÂëÏ£¬·¢Ë͵ĹØÁª - ÃüÁî»áʧ°Ü£¬µ«ÎÒÃÇ»á½øÐÐÇл»Ä£Ê½È»ºóÖØйØÁª¡£²»»á»ñÈ¡IP£¬×îÖնϿª¡£ - (4)Á¬½ÓWPA¼ÓÃܵÄAP£¬ÕýÈ·ÃÜÂëÏÂÓÐÎÊÌ⣬ - lbs_set_encodeextÖе÷ÓÃlbs_do_association_workµÄµØ·½²»ÄÜÉÙ¡£ - ÃÜÂë´íÎóµÄÇé¿öÏ£¬ÒòΪһֱÔÚÖØÐÂÁ¬½Ó£¬Ö»ÓеȴýAndroid³¬Ê±£¬ËùÒÔÃÜÂë - ´íÎóÌáʾ¿ò²»»á³öÀ´¡£ÃÜÂë´íÎó¿ÉÄÜ·µ»ØdisassociationºÍdisauthenciated¡£ - -4. ¸ÄÉÆAPɨÃèµÄÎÊÌ⣺ - (1)ÔÚWIFIÉèÖÃÒ³ÃæÖУ¬µ±´ò¿ªWIFIʱ£¬APÁбíµÄÏÔʾ¡£ - =>·¢ÏÖ´ò¿ªWIFIºó£¬Çý¶¯ÒѾ­¼ÓÔØÍê³É£¬µ«ÐèÒª3Ãë¶àʱ¼ä²Å»áÊÕµ½É¨ÃèÃüÁÕâ - ½«ÒýÆðWIFI´ò¿ªºóAPÁбíÐèÒª7ÃëÖÓ²ÅÄܳöÏÖ£¬Ì«ÂýÁË¡£ - E/WifiHW ( 713): Unable to open connection to supplicant on - "wlan0": No such file or directory - D/ ( 1119): @@@WPA_SUPPLICANT@@@: main - D/WPA_SUPP( 1119): Setting scan request: 0 sec 100000 usec - D/WPA_SUPP( 1119): wpa_supplicant_scan: ap_scan=1 - D/WPA_SUPP( 1119): Starting AP scan (broadcast SSID) - D/WPA_SUPP( 1119): Trying to get current scan results first without - requesting a new scan to speed up initial association - D/WPA_SUPP( 1119): Setting scan request: 0 sec 0 usec - D/WPA_SUPP( 1119): wpa_supplicant_scan: ap_scan=1 - D/WPA_SUPP( 1119): No enabled networks - do not scan - =>ÉÏÃæµÄLOGÏÔʾÔÚWPA_SUPP»¹Ã»ÓÐÆô¶¯Íê³ÉÇ°£¬WIFIHW¾ÍÈ¥½øÐÐÁ¬½Ó£¬µ«»áʧ°Ü - Õ⽫ÒýÆðÁ÷³ÌÉϵÄʧ°Ü£¬´Ó¶øʹµÃÆô¶¯±äÂý¡£ - =>Õâ¸öÎÊÌâ֮ǰÒѾ­Óнâ¾ö¹ý£¬µ«ÊÇÔÚ×îеķþÎñÆ÷·ÖÖ§ÖÐûÓиüС£ - =>ÔÚWIFIÉèÖýçÃæÏ£¬WIFI³É¹¦´ò¿ªºóµ½APÁбí³öÏÖ£¬ÐèÒª2-3Ãë¡£ - - A. APÁбíµÄÓÐЧʱ¼äÊÇDEFAULT_MAX_SCAN_AGE£¬Îª15Ãë¡£ - B. ÔÚÇý¶¯¼ÓÔØʱ´¥·¢Ò»´ÎɨÃè²Ù×÷¡£Õâ¿ÉÄÜ»áʹµÃ¹ØÁª²Ù×÷±äÂý¡£ - C. µÚÒ»´ÎÊÕµ½É¨ÃèÃüÁîʱ£¬ÈÃÆäÁ¢¼´·µ»Ø£¬ÒÔ±ãAPÁбíÄÜ¿ìËÙ²úÉú¡£ - D. ½Ï³¤Ê±¼äºó£¬´ÓÎÞÏßÉèÖýçÃæ½øÈëWIFIÉèÖýçÃ棬ÔòÖ±½ÓËͽá¹û¡£ - - =>µ±Ôö¼ÓÁË3¸öÊÖ¶¯µÄAPºó£¬ÔÚWIFI´ò¿ªºó£¬ÐèÒª½Ï³¤µÄʱ¼ä²ÅÄܳöAPÁÐ±í¡£ - Ϊ´Ë£¬ÔÚÇý¶¯¼ÓÔØʱ£¬´¥·¢Ò»¸öɨÃè²Ù×÷¡£ - =>µ«ÔÚÒ»¶Îʱ¼äºó£¬É¨ÃèÁбíÈÔÈ»»áÏûʧµô¡£ - - (2)ÔÚÎÞÏßÉèÖÃÒ³ÃæÖУ¬´ò¿ªWIFIºó£¬½øÈëWIFIÉèÖÃÒ³ÃæʱAPÁбíµÄÏÔʾ¡£ - (3)´ÓWIFIÉèÖÃÒ³ÃæÍ˳öµ½ÎÞÏßÉèÖÃÒ³Ã棬ÔÙ½øµ½WIFIÉèÖÃÒ³Ãæʱ£¬APÁбíµÄÏÔʾ¡£ - (4)Ò³ÃæÖб£´æÁ˶à¸öÒѾ­¼ÇÒäµÄ£¬·ÇÊÖ¶¯Ìí¼ÓµÄAPʱ£¬APÁбíµÄÏÔʾ¡£ - (5)Ò³ÃæÖб£´æÁ˶à¸öÒѾ­¼ÇÒäµÄ£¬ÓÉÊÖ¶¯Ìí¼ÓµÄAPʱ£¬APÁбíµÄÏÔʾ¡£ - - =>³ýÁ˸üÐÂWIFIHWÍ⣬ûÓиı䣬ÒòΪÎÞ·¨¸Ä±ä¡£ - -5. ¹ØÁª²âÊÔ£º - (1)WPA¼ÓÃܲâÊÔ£¬ - A. ÕýÈ·ÃÜÂëÏ£¬¿ÉÒԳɹ¦Á¬½Ó¡£ - B. ´íÎóÃÜÂëÏ£¬»áÊÕµ½disauthenticatedʼþ£¬Õâʱ»á½øÐÐÖØÁª¡£×ܹ²»á¹ØÁª - 4´Î£¬ÒòΪ»á½øÐÐ3´ÎÖØÁª£¬Õ⽫ʹµÃÃÜÂë´íÎóÌáʾ¿ò»á½ÏÂýÌáʾ¡£ - -6. Ò»¸ö¹Ø½¡µÄÎÊÌâÊÇ£¬ÈçºÎÈ·¶¨¹ØÁªÈ·ÊµÊdzɹ¦µÄ£¬´ÓÓ¦Óòã½Ç¶ÈÀ´ËµÊÇDHCPÒѾ­³É - ¹¦£¬µ«ÔÚÇý¶¯ÀïÄØ£¿ - =>¶ÔÓÚWPA_SUPPÀ´Ëµ£¬WPAЭÒé»áÉæ¼°µ½4´ÎÎÕÊÖ£¬¹ØÁª»ù±¾¶¼Äܳɹ¦£¬µ«4´ÎÎÕÊÖ¾Í - δ±ØÄܹ»³É¹¦ÁË¡£ËùÒÔ²»Äܵ¥´¿´ÓASSOCIATIONÃüÁîµÄ½á¹ûÀ´È·¶¨Á¬½ÓÊÇ·ñ³É¹¦¡£ - =>ÆðÒ»¸ö8ÃëµÄ¶¨Ê±Æ÷£¬Èç¹û¶¨Ê±Æ÷³¬Ê±Ê±£¬ÈÔȻΪCONNECTED״̬£¬Ôò±íʾ¹ØÁª³É¹¦ - ·ñÔò±íʾ¹ØÁªÊ§°Ü£¬³É¹¦Çé¿öÏÂÎÒÃÇ»á½øÐÐÖØÁª¡£ - =>¹ØÁªHHYʱ»áÓöµ½ lbs_ret_80211_associate: association fail. - ·¢ÏÖÊÇHHYµÄAPËÑË÷²»µ½ÁË¡£ - -7. µÚÒ»´ÎÆô¶¯Ê±£¬¹ØÁªAP¿ÉÄÜ»áʧ°Ü¡£ - [38] lbs_ret_80211_associate: association successfully. - [41] EVENT: deauthenticated: reassoc_count=0 - [41] disconnected status. - [41] lbs_mac_event_disconnected: enter........connect=0 - [44] lbs_ret_80211_associate: association successfully. - =>ÓÉÓÚÔÚWEXTÖУ¬ÔÚÉèÖÃÿ¸ö²ÎÊýʱ¶¼»á´¥·¢¹ØÁª²Ù×÷£¬ËäÈ»²»Ò»¶¨»á´¥·¢Êµ¼ÊµÄ¹Ø - Áª£¬µ«²»Åųý¶à´Î½øÐÐʵ¼Ê´¥·¢µÄ¿ÉÄÜ¡£ - -8. ÐÞ¸Älbs_get_sense£¬ÎÒÃÇÖ»·µ»ØRSSIµÄSignalÖµ£¬¶ø²»¹ÜÔëÉù¡£ - =>ͬʱÐÞ¸Äwpa_supplicant£¬²»±Ø½øÐÐlevelÖµÓëNoiseÖµµÄSNR¼ÆËã¡£ - =>lbs_get_senseÖУº - signal level 223 noise 162 rssi 223 - ÕâʹµÃÐźÅÏÔʾµÄÖµÕýÈ·£¬ÕâʱIWCONFIG²é¿´µÄ½á¹ûΪ£º - Link Quality=100/100 Signal level=-32 dBm Noise level=-94 dBm - Ó¦¸ÃʹÓÃlbs_get_wireless_statsÖеļÆËã·½·¨¡£ - =>ʵ¼ÊÉÏÎÒÃÇ¿´µ½µÄLEVELÖµÊǸºÖµ£¬µ«±»ÒÔÕýÊý·½Ê½´ò³öÀ´ÁË£¬¶øLEVELµÄÖµ»áÓÐÒ» - ¸ö·¶Î§£¬ÔÚMV8686ÖÐÊÇ256£¬ËùÒÔʵ¼ÊÉÏÐźÅֵΪ£º-(256 - level) - ÈçÉÏÖµÖÐLEVELΪ223£¬ÔòÐźÅֵΪ: -(256 - 223) = -33dBm - -9. HHY APÔڳ³¤º£´¦£¬½ÏÔ¶£¬ÔÚ25Ã×´¦¡£¹ØÁªÊ±»áÓÐ´í£º - lbs_ret_80211_associate: association fail.status_code=2 - ASSOC_RESP: internal timer expired while waiting for the AP. - =>·¢ÏÖÔÚÁ¬½ÓÐźŲîµÄAPʱ£¬ÈÝÒ׳öÏÖÕâ¸öÎÊÌâ¡£ - Quality=77/100 Signal level=-71 dBm Noise level=-91 dBm - =>½«MRVDRV_DEFAULT_LISTEN_INTERVALµÄÖµÓÉÔ­À´µÄ10¸ÄΪ50ÊÔһϡ£²»ÐУ¬½«Æä¸Ä - Ϊ500ÊÔһϡ£»¹ÊÇûÓ㬿´À´ÓëÕâ¸ö²ÎÊýÎ޹ء£ - =>½«beacon_periodÉèÖÃΪ900£¬Á¬½ÓHHYʱ»á±¨invalid parameters¡£ - ½«Æä¸ÄΪ100£¬ÈÔÈ»ÊÇÏàͬµÄ´íÎó¡£ - Õâ¸ö²ÎÊýÓ¦¸ÃÊÇÔÚADHOCʱ²Å±»Ê¹Óá£INFRAÍøÂçÖÐÕâ¸öÖµÓÉAP¾ö¶¨¡£ - => - -10.ÓÐʱÔÚ¹ØÁªWPAµÄAPʱ£¬»áÒâÍⵯ³öÃÜÂë´íÎó¿ò£¬¼´Ê¹¿Ï¶¨Æä֮ǰ±£´æµÄÃÜÂëÊÇÕýÈ·µÄ¡£ - -ÓîÐÇ´ÓÌìÅôÊ¢´¦Äõ½µÄ²âÊÔ±¨¸æ£º - -11.»ų́²»ÄÜÏÔʾº¬ÓÐÖÐÎÄÃüÃûµÄ·ÓÉÆ÷£¬¶øÇÒ»ų́ҲÁ¬½Ó²»ÉϺ¬ÓÐÖÐÎÄÃüÃûµÄÍøÂç¡£ -12.°ÑÁ½¸ö·ÓÉÆ÷ÉèΪÏàͬµÄÃüÃû,»ųֻ́ÄܽøÈëÒ»¸öWI-FIÁ¬½Ó,ÁíÒ»¸öÁ¬½Óʧ°Ü. -13.ÔÚ¹ØÁªµÄÁ÷³ÌÉÏ£¬Ê¼ÖÕÓв»ºÏÀíµÄµØ·½£º - [65] lbs_cmd_80211_deauthenticate: enter... - [66] lbs_ret_80211_associate: association fail.status_code=1 - [66] lbs_mac_event_disconnected: enter........connect=0 - [73] lbs_ret_80211_associate: association successfully. - =>ʵ¼ÊÉϻᴥ·¢Á½´Î¹ØÁª²Ù×÷¡£ - (1)È¥µôlbs_set_freqÖд¥·¢¹ØÁªµÄ²Ù×÷£¬Ã»ÎÊÌâ¡£ - (2)È¥µôlbs_set_modeÖд¥·¢¹ØÁªµÄ²Ù×÷£¬Ã»ÎÊÌâ¡£ - ʵ¼ÊÉϲ¢²»ÊÇ´¥·¢¹ØÁª²Ù×÷£¬ÒòΪֻÓÐBSSIDºÍESSIDµÄÉèÖòÙ×÷²Å»áÒýÆðʵ¼ÊµÄ¹Ø - Áª¶¯×÷£¬ÆäÓàµÄÖ»ÊÇÉèÖÃÏà¹ØµÄ²ÎÊý¡£ - [239] lbs_set_essid: call lbs_postpone_association_work - [239] lbs_set_wap: call lbs_postpone_association_work - (1)³¹µ×È¥³ýASSOC_FLAG_MODE±êÖ¾£¬ÒòΪËü¿ÉÄÜÒýÆðDeauthenticated¡£ - -14.»á³öÏÖ²»È¥È¡IP²ÎÊýµÄÇé¿ö£º - inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0 - ʵ¼ÊÉÏÔÚAndroidÏÔʾµÄIPÈ´ÊÇ192.168.0.105¡£ - =>Ô­ÒòÓ¦¸ÃÊÇlbs_cmd_80211_deauthenticateÖÐûÓÐËÍlbs_mac_event_disconnected¡£ - -15.Á¬½Ótplinklai (WEP & SHARED)£¬ÓÐʱ»ñÈ¡IP»áºÜ³¤Ê±¼ä£¬»òÊÇʧ°Ü¡£ - -============================================================================== -=== Version 2.24 @ 2010-11-16 === -============================================================================== - -1. Ò×·½±¨¸æ˵ɨÃèAPµÄÄÜÁ¦¼õÈõ¡£ - =>½«PSģʽµÄÇл»¹Ø±Õ£¬Ñé֤һϡ£ÎÊÌâÒÀ¾É£¬µ«ÔÚ³ýÒ×·½ÍâµÄ¾©»ª¡¢ÊÀ½¡ºÍÎÒÕâÀï - ¶¼Ã»Óз¢ÏÖÕâ¸öÎÊÌâ¡£ - -2. ÔÚÒѾ­Á¬½ÓÉÏÒ»¸öAPºó£¬Çл»µ½ÁíÒ»¸öAP£¬ÃÜÂë´íÎóʱ²»»áµ¯³öÌáʾ¿ò£º - -3. ¾©»ª±¨¸æ˵£º»½ÐѺóWIFIÐźÅÏÔʾÕý³££¬µ«ÊÇË¢Íøҳʧ°Ü¡£ - (1)ÓëAR6002ÀàËƵÄ×ö·¨ÊÇϵͳ˯Ãßʱ½«WIFI¶Ï¿ª£¬»½ÐÑʱÔÙÈÃAndroid½øÐÐÖØÁª¡£ - -============================================================================== -=== Version 2.23 @ 2010-11-15 === -============================================================================== - -1. ¾©»ª±¨¸æ˵£º»½ÐѺóWIFIÐźÅÏÔʾÕý³££¬µ«ÊÇË¢Íøҳʧ°Ü¡£ - (1)ÓëAR6002ÀàËƵÄ×ö·¨ÊÇϵͳ˯Ãßʱ½«WIFI¶Ï¿ª£¬»½ÐÑʱÔÙÈÃAndroid½øÐÐÖØÁª¡£ - -2. Óöµ½Ò»¸öÇé¿ö£ºÔÚ³öÏÖLOG - EVENT: deauthenticated - ºóûÓÐÈ¥½øÐÐÖØÐÂÁ¬½Ó¡£Ö®ºó³öÏÖÒ»´Î£º - [2402] mv8686: command 0x0021 timed out - [2402] mv8686: requeueing command 0x0021 due to timeout (#1) - [2402] mv8686: Received result 0 to command 21 after 1 retries - µ«»á´ÓÕâÀï»Ö¸´¡£0x0021ÊÇCMD_802_11_PS_MODE¡£ - [1390] mv8686: command 0x001f timed out - [1390] mv8686: requeueing command 0x001f due to timeout (#1) - [1390] CMD: 52 FAIL raw_ints: 134 masked ints: 4 - 0x001FÊÇCMD_802_11_RSSI¡£ - - =>Õâ¸öÇé¿öµÄ³öÏÖ£¬ÊÇÒòΪWIFI´¦ÓÚÉî¶È˯Ãßʱ£¬ÏòÆä·¢ËÍÃüÁî¡£ - =>ÔÚlbs_threadÖУ¬´ò¿ªÔ­À´µÄÓï¾ä£¬Èç¹ûpriv->deepsleep == true - ÔòÖ÷Ïß³ÌÈÔȻ˯Ãߣ¬¶ø²»·¢ËÍÈκÎÃüÁîºÍÊý¾Ý¡£ - -3. ¿ÉÒÔͨ¹ýÈçÏÂÃüÁî²é¿´µ±Ç°Ë¯ÃßËøµÄÇé¿ö£º - echo android_power_print_locks,0xf > /sys/scu/24m/active - -4. ÔÚº¯Êýlbs_process_eventÖз¢ÏÖÒ»¸öBUG£¬¶ÔÓÚ±äÁ¿reassoc_countµÄ´¦ÀíÓеãÎÊÌ⣺ - (1)static int reassoc_count = 0; ÒÔ¾²Ì¬·½Ê½¶¨Òå¡£ - (2)if ((priv->connect_status == LBS_CONNECTED) && - (reassoc_count < 3)) - Õâ¸öÌõ¼þÂú×ãʱ½øÐÐÖØÁª£¬Í¬Ê±reassoc_count»á±»¼Ó1¡£ - (3)¿¼Âǵ½Ò»¸ö¿ÉÄܳö´íµÄÇé¿öÊÇ£ºµ±Óöµ½Õâ¸öʼþ£¬È»ºóÖØÁª£¬²¢Çҳɹ¦ÁË£¬µ«ÊÇ - Õâ¸öÖµÈÔÈ»»á±»¼Ó1£¬Õâ¾ÍÔì³É£¬µÚÈý´ÎÊÕµ½Õâ¸öʼþʱ¾Í²»»á½øÐÐÖØÁªÁË¡£ - - =>½«Õâ¸ö±äÁ¿·Åµ½lbs_privateµÄÊý¾Ý½á¹¹ÖУ¬ÔÚ¹ØÁª³É¹¦ºó»á½«Õâ¸ö±äÁ¿Çå0¡£ - - =>¿ÉÒÔÖØÏÖÕâ¸öÎÊÌâ¡£µ«ÔÚAPÁ¬½Ó˳³©µÄÇé¿öÏ£¬¹ØÁªËٶȺܿ졣¾©»ª³öÏÖµÄÓ¦¸ÃÊÇ - Æä¹ØÁªAPµÄËٶȽÏÂý£¬±ãµÃÓÉAndroid·¢ÆðµÄÖØÁªÐèÒª½Ï³¤Ê±¼ä£¬µ«ËûÃDZ¨Òª¼¸·Ö - ÖÓµÄʱ¼ä£¬ÕâºÜÒâÍâ¡£ - - =>Õâ¸öÎÊÌâ¿ÉÒÔ½â¾ö¡£ - -5. ÊÀ½¡ - AppleChen 15:57:16 - 1.ÉèÖÃÑ¡ÏîÖдò¿ª·½Ïò¹¦ÄÜ£¨ÖØÁ¦¸ÐÓ¦£© - 2.´ò¿ªWIFIÁ¬½Óij¸öAP - 3.Ñ¡ÔñÒÑÁ¬½ÓAP²¢Ö´ÐÐÍü¼Ç²Ù×÷ - 4.WIFI״̬ÌáʾΪÒѶϿªÁ¬½Ó - 5.ÐýתÉ豸¼¤»îÖØÁ¦¸ÐÓ¦¹¦ÄÜ - 6.WIFI״̬±äΪÕýÔÚɨÃè - 7.Ö´ÐÐÆäËû²Ù×÷ºóÕý³£ - =>¾­È·ÈÏAPÁбí»á³öÏÖ£¬²»Ó°ÏìʹÓᣠ- -============================================================================== -=== Version 2.22 @ 2010-11-11 === -============================================================================== - -1. Á¬½ÓWPA·½Ê½µÄAPʱ£¬Èç¹ûÃÜÂë´íÎó£¬ÐèÒªÄܹ»µ¯³öÖØÐÂÊäÈëÃÜÂëµÄÌáʾ¿ò£º - A. ÔÚ֮ǰûÓÐÈκÎÁ¬½ÓµÄÇé¿öÏ£¬ÊäÈë´íÎóµÄÃÜÂ룬»áµ¯³öÌáʾ¿ò¡£ - B. ÏȹØÁªÉÏÒ»¸öAP£¬È»ºóÁ¬½ÓÊäÈë´íÎóÃÜÂëµÄAP£¬Ò²»áµ¯³öÌáʾ¿ò¡£ - -2. δÁ¬½ÓAPÇé¿öϹرÕWIFIµÄ²âÊÔÇé¿ö»¹Ó¦¸ÃÓУ¬Á¬½ÓÉÏAPºó£¬½«Õâ¸öAP¶Ïµç£¬»òÊÇ - À뿪Õâ¸öAPµÄÐźŸ²¸Ç·¶Î§¡£ - =>APÕÒ²»µ½ºó£¬Èí¼þ»á³¢ÊÔÕÒÁíÒ»¸öÒѾ­¼ÇÒäµÄAP¡£Èç¹ûÁíÒ»¸öAP¿ÉÒÔÕÒµ½²¢¹ØÁªÉÏ - ×ÔÈ»²»»á¹Ø±ÕWIFI£¬·ñÔòÓ¦¸Ã»á¹Ø±ÕWIFI¡£ - =>ÕâÖÖÇé¿öÏÂÎÒÃǶ¼¿ÉÒÔÈÃϵͳ½øÈë¶þ¼¶Ë¯Ãߣ¬Ö»ÒªÍøÂçûÓб»Ê¹Óõ½¡£ - -3. ϵͳ½øÈë¶þ¼¶Ë¯Ãßʱ£¬ÎÒÃÇÒ²½«ÈÃWIFI½øÈë¶þ¼¶Ë¯Ãß¡£ - =>wifi_suspendÖÐÈÃWIFI½øÈëÉî¶È˯Ãߣ»ÔÚwifi_resumeÖÐÔòÈÃWIFIÍ˳öÉî¶È˯Ãß¡£ - -4. ÁíÒ»¸öÏ뿼ÂǵÄÊ¡µç»úÖÆÊÇ£¬Èç¹ûWIFIÏÐÁË£¬ÎÒÃÇ¿ÉÒÔÆô¶¯PS»úÖÆ£¬Ã¦ÁË£¬Ôò¹Ø±ÕÊ¡ - µç»úÖÆ¡£²»Ê¹ÓÃDEEP SLEEP»úÖÆ£¬ÒòΪÕâÖÖ»úÖÆÏÂÇý¶¯µÄ״̬ºÍÓ¦ÓòãµÄ״̬»á²»Ò» - Ö£¬Õ⽫µ¼Ö¿ͻ§¶ÔÕâÒ»Çé¿ö²»ÂúÒâ¡£ - (1)¿¼Âǵ½µÄÒ»ÖÖ·½Ê½ÊÇÔÚTX/RXÖмà¿ØÁ÷Á¿×´Ì¬£¬Èç¹ûСÓÚÒ»¶¨ÖµÔò´ò¿ªPS·½Ê½£¬ - Èç¹û´óÓÚÒ»¶¨ÖµÔò¹Ø±ÕPS·½Ê½¡£ÓÉÓÚÁ÷Á¿Í³¼Æ»áÉæ¼°µ½³Ë³ýÔËË㣬»áÔÚÊý¾ÝÁ÷· - ÉϺÄ×ÊÔ´£¬×îºÃÄܱÜÃâÕâÖÖ·½Ê½¡£ - (2)ÏÖÔÚÓÐÒ»¸ö10ÃëÖӵĶ¨Ê±Æ÷£¬ÓÃÓÚ¼ì²éÊÇ·ñÐèÒª¹Ø±ÕWIFI£¬¿ÉÒÔÓÃÕâ¸ö¶¨Ê±Æ÷¡£ - =>ÔÚRX/TXͨ·ÉÏͳ¼ÆRX/TXµÄÊý¾Ý°üÊý£¬Èç¹ûÔÚ¶¨Ê±Æ÷µÄ10ÃëÆÚ¼äûÓÐÊý¾Ý´«Ê䣬 - Ôò´ò¿ªPS·½Ê½£¬·´Ö®¹Ø±ÕPS·½Ê½¡£ - (3)¿ÉÒÔ¸úAndroidµÄ˯ÃßËø°ó¶¨ÔÚÒ»Æ𣬼´AndroidËøÉÏʱ£¬ÎÒÃǹرÕPS·½Ê½£¬·´Ö® - ´ò¿ªPS·½Ê½£¬ÓÉPOWER SAVEÄ£¿é»Øµ÷À´ÊµÏÖ¡£ - -5. ÔÚPOWER SAVEµÄ»Øµ÷Öе÷ÓÃPS£¬»áÓÐ: - BUG: scheduling while atomic - ÒòΪPOWER SAVEÊÇÔÚ¶¨Ê±Æ÷»Øµ÷ÖУ¬´¦ÓÚÖжÏÉÏÏÂÎÄ£¬²»ÄÜÓÐ˯Ãß¡£ - =>Ôڻص÷º¯ÊýÖÐͨ¹ýWORK QUEUEÀ´Íê³ÉPS·½Ê½µÄÇл»¡£ - -============================================================================== -=== Version 2.21 === -============================================================================== - -1. Ìí¼Ówifi_power_save_initºÍwifi_power_save_exitµÄ¹³×Ó£¬ÆôÓÃеÄÊ¡µç»úÖÆ¡£ - -2. PSģʽʱ£¬Ä¬ÈϵÄDTIMµÄֵΪ1£¬defs.hÖУº - #define MRVDRV_DEFAULT_MULTIPLE_DTIM 3 - ÏÖ½«Æä¸ÄΪ3½øÐвâÊÔ£¬Ä¿µÄÊDz»»á¶ª°ü£¬ÇÒPINGÑÓ³Ù²»»áÌ«´ó¡£ - =>DTIMΪ1ʱ£¬PING¶ª°üºÜÑÏÖØ£¬10¸ö°ü»á¶ª3¸ö×óÓÒ¡£ - =>½«DTIM¸ÄΪ3ʱ£¬¾Í²»´æÔÚ¶ª°üÁË£¬100¸öPING°ü²âÊÔ¡£µ«ÊÇÑÓ³ÙÏ൱À÷º¦¡£ - min/avg/max = 1.976/147.693/300.576 ms - µ±Ç°×î´óµÄDTIMÖµÖ§³ÖµÄ×î´óֵΪ5£¬ÕâÊÇָ˯Ãßʱ¼äµÄ³¤¶Ì¡£ - min/avg/max = 3.748/253.482/500.708 ms - ¼´Õâ¸öÖµÔ½´ó£¬PINGÑÓ³Ù¾ÍÔ½´ó¡£ - ÔÚDTIMΪ5µÄÇé¿öÏ£¬TCP TXÍÌÍÂÂÊΪ11.45Mbps£¬RXÍÌÍÂÂÊΪ13.28Mbps¡£ - =>ÔÚDTIMΪ3µÄÇé¿öÏ£¬TCP TXÍÌÍÂÂÊΪ11.82Mbps£¬RXÍÌÍÂÂÊΪ13.22Mbps¡£ - -3. ÖØйØÁªÉϺó£¬Ô­À´µÄPS״̬»á¶ªÊ§£¬±ä³ÉûÓÐPSÁË¡£µÆûÉÁ£¬µ«PINGµÄÑÓ³ÙÊÇÓС£ - =>ÕâÖ®ºóÓÃiwconfig wlan0 power off£¬PINGµÄÑÓ³ÙÒ²²»Õý³£ÁË¡£ - =>¿´À´FW»òÊÇÇý¶¯ÔÚ´¦ÀíPSÎÊÌâÉÏÈÔÈ»´æÔÚȱÏÝ¡£ - -4. WiFi´ò¿ª£¬Ã»ÓÐÁ¬½ÓÉÏAP£¬¿ÉÄÜÊÇ£º - (1)ûÓÐÑ¡ÔñAP£¬ - (2)Ò²¿ÉÄÜÒªÁ¬½ÓµÄAP²»´æÔÚ£¬ - (3)»òÊÇÁ¬½Óʧ°Ü¡£ - (4)À뿪APµÄÐźŸ²¸Ç·¶Î§£¬»òÊÇAPϵçÁË¡£ - ÕâÖÖÇé¿öÏ£¬Ó¦¸Ã֪ͨAndroid£¬½«WiFi¹Ø±Õ¡£ - =>¿¼ÂÇʹÓÃpriv->connect_statusÕâ¸ö±äÁ¿À´Çø·Ö״̬¡£ - A. lbs_ret_80211_associate: ¸ù¾Ý¹ØÁª½á¹û»á¸üбäÁ¿µÄÖµ¡£ - B. lbs_mac_event_disconnected»á½«ÆäÖÃΪ¶Ï¿ªÖµ¡£ - C. lbs_init_adapter³õʼΪ¶Ï¿ªÖµ¡£ - =>Ôö¼ÓÒ»¸ö¶¨Ê±Æ÷À´¼àÊÓÁ¬½ÓµÄÇé¿ö: - A. ÔÚinit_adapterʱ³õʼ»¯¶¨Ê±Æ÷turnoff_timer¡£ - B. ÔÚconnect_status±»ÖÃΪCONNECTEDʱ£¬É¾³ý¶¨Ê±Æ÷¡£ - C. ÔÚconnect_status±»ÖÃΪDISCONNECTEDʱ£¬Æô¶¯¶¨Ê±Æ÷¡£ - D. ÔÚ¶¨Ê±Æ÷Àï·¢ËÍʼþ¸æËßWPA_SUPP£¬Çý¶¯ÒªÇó¹Ø±ÕWIFI¡£ - E. WPA_SUPP·¢ËÍʼþ¸øAndroid£¬ÒªÇó¹Ø±ÕWIFI¡£ - F. Android½ÓÊÕµ½¹Ø±ÕÇëÇóºó£¬Ï·¢ÃüÁî¹Ø±ÕWIFI¡£ - =>¶¨Ê±Æ÷¹¤×÷·½Ê½Ð޸ģº - A. ϵͳÆô¶¯Ê±³õʼ»¯¶¨Ê±Æ÷£¬lbs_threadÖ÷Ï̹߳¤×÷ʱÆô¶¯¶¨Ê±Æ÷¡£ - B. ¶¨Ê±Æ÷ʱ¸ôΪ10Ã룬ÿ´Î¼ì²éÁ¬½ÓÇé¿ö£¬Èç¹ûÔÚÒ»¶¨Ê±¼äÄÚ¶¼ÊÇΪ¶Ï¿ª×´Ì¬£¬ - Ôò»áÏòÓ¦ÓòãÉϱ¨Ê¼þ£º - memset(wrqu.ap_addr.sa_data, 0xAB, ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); - C. ÈκÎÇé¿ö϶¨Ê±Æ÷¶¼ÔÚ¹¤×÷£¬Ö»ÓÐÇý¶¯Í˳öʱÇý¶¯²Å»á±»É¾³ý¡£ - =>ÐÞ¸Äwpa_supplicantµÄdriver_wext.c£¬Ìí¼Ó¶ÔȫΪ0xABµÄAPµØÖ·µÄÅжϣº - else if (os_memcmp(iwe->u.ap_addr.sa_data, - "\xAB\xAB\xAB\xAB\xAB\xAB", ETH_ALEN) == 0) - { - wpa_msg(ctx, MSG_INFO, WPA_EVENT_DRIVER_STATE "TURNOFF"); - } - =>AndroidÖÐÔö¼Ó¶ÔTURNOFFʼþµÄ´¦Àí£º - frameworks/base/wifi/java/android/net/wifi: - (1)WifiMonitor.java£¬handleDriverEventº¯ÊýÖÐÌí¼ÓÈçÏ´¦Àí£º - } else if (state.equals("TURNOFF")) { - mWifiStateTracker.notifyDriverTurnoff(); - (2)WifiStateTracker.java - A. Ê×ÏÈÔÚDRIVER_HUNGºóÌí¼Ó£º - private static final int DRIVER_TURNOFF = 3; - B. Ìí¼ÓnotifyDriverTurnoffº¯Êý£¬·¢ËÍDRIVER_TURNOFFʼþ¡£ - C. ÔÚhandleMessageº¯Êýº¯ÊýÖÐÌí¼Ó¶ÔDRIVER_TURNOFFʼþµÄ´¦Àí¡£ - case DRIVER_TURNOFF: - Log.e(TAG, "Wifi Driver reports turn off."); - mWM.setWifiEnabled(false); - break; - -5. Ôö¼ÓMV8686_SUPPORT_ADHOCºêÀ´¿ØÖÆADHOCµÄ´úÂ룬ÔÝʱûÓã¬ËùÒÔ²»ÐèÒª¡£ - -6. µ±Ò»¸öAPÁ¬½ÓÉÏ£¬È»ºó½«Æä¶Ï¿ªºó£¬ÔÚWIFIÇý¶¯ÖÐ: - priv->connect_statusµÄֵʼÖÕÊÇLBS_CONNECTED£¬²»»á¸Ä±ä¡£ - =>ÐèÒªÌí¼Ó¶ÔSIOCSIWMLMEÃüÁîµÄÖ§³Ö£¬ÔÚÔ­°æÇý¶¯ÖÐÊÇÓеġ£ - =>ΪÁ˶ϿªÁ¬½Ó£¬WPA_SUPP»áËÍIW_MLME_DEAUTHÃüÁî¸øÇý¶¯¡£ - =>Çý¶¯½«µ÷ÓÃlbs_cmd_80211_deauthenticateº¯Êý¶Ï¿ªÁ¬½Ó¡£ - -============================================================== -Version 2.20 -============= - -1. ¼ÓÈëwifi_power_saveÄ£¿é£¬×¼±¸ÔÚMV8686ÖÐÆôÓÃеÄÐÝÃß»úÖÆ¡£ - -2. Çý¶¯½«Óнϴó¸Ä¶¯£¬°æ±¾ºÅ¸ÄΪ2.20£¬ÒÔʾÇø±ð¡£ - -3. ¹Ø±ÕÔ­À´µÄ˯Ãß»úÖÆ£º - #define ANDROID_POWER_SAVE 0 - =>ÔÚSDK°åÉϲâÊÔ£¬´ò¿ªWIFIʱ²¢Ã»ÓÐÕÒµ½SDIOÉ豸¡£ - -4. µ±WIFIûÓйØÁªÉÏʱ£¬PSģʽ²¢²»»á±»´ò¿ª£¬ÕâʱӦ¸ÃÊÇÔÚSLEEP - ģʽ£¬Í¨¹ýIWCONFIG²é¿´£¬ÔڷǹØÁªÇé¿öÏÂΪOFF£¬¼´Ê¹ÒѾ­Í¨¹ý - iwconfig wlan0 power on - ´ò¿ªÊ¡µçģʽ¡£ - =>ÐÞ¸Älbs_get_power£¬Ôڲ鿴PS״̬ʱ£¬²»ÐèÒª½«¹ØÁªÌõ¼þ°ó¶¨¡£ - =>½«´òÓ¡ÐÅÏ¢£ºEVENT: ps awake: Media is LBS_CONNECTED.È¥µô¡£ - -============================================================== -Version 2.13 -============= -1. ÔÚа汾SDKÖУ¬Èç¹ûûÓн«AndroidµÄËøÈ¥µô£¬Ôò»á³öÏÖºÍAR6002 - Ò»Ñù£¬µ¼ÖÂϵͳËÀµô¡£ - =>²é¿´Çý¶¯£¬Ã»ÏÖÔÚÇý¶¯Ð¶ÔØʱ£¬±¾Éí¾ÍÓÐÏú»ÙAndroidËøµÄ²Ù×÷£¬ - ËùÒÔÓ¦¸Ã²»ÊÇÕâ¸öÎÊÌâ¡£ - -2. °æ±¾ºÅʹÓÃwifi_version.hÖеĶ¨Òå¡£ - -============================================================== -Version 2.12 -============= -1. ÐÞ¸ÄÁËwifi_power_ops.c£¬½«AR6002ºÍÉϵçʱÐòºÍMV8686µÄÉϵçʱÐò - ·Ö¿ªÀ´¿ØÖÆ£¬ÕâÒªÇóËûÃÇÔÚµ÷ÓÃturn_on½Ó¿Úʱָ¶¨Ð¾Æ¬µÄÀàÐÍ¡£ - -============================================================== -Version 2.11 -============= -1. ÐÞ¸ÄÁËÄ£×éµÄÉϵ缰ϵç¹æÔò£º - A. Ô­À´µÄÉϵç¹æÔò: - PWN DOWN -> POWER DOWN - PWN UP -> POWER UP - RESET - =>ÏÖÔÚµÄÉϵç¹æÔò£º - PWN UP -> POWER UP - RESET - - B. Ô­À´µÄϵç¹æÔò£º - PWN UP - POWER DOWN - PWN DOWN - RESET DOWN - =>еÄϵç¹æÔò£º - RESET DOWN - PWN DOWN - POWER DOWN - - Ð޸ĵÄÒÀ¾ÝÊÇÖØмì²éÁËMV8686µÄDS¼°AR6002µÄDS£¬·¢ÏÖÁ½ÕßÉϵç - ¼°ÏµçµÄʱÐòÒªÇóÊDz»Ò»ÑùµÄ¡£ - - ÔÚNX7007ÉÏͨÏü²âÊÔûÓÐÎÊÌâ¡£ - -============================================================== -Version 2.10 -============= -1. ¸ÄÕýÁ˵±ANDROID_POWER_SAVE±»¶¨ÒåΪ0ʱ£¬±àÒë²»¹ý£¬ÓÐЩµØ·½ - ûÓмÓÕýÈ·µÄºê±£»¤µÄ´íÎó¡£ -2. - -============================================================== -Version 2.08 - -============================================================== -Version 2.07 - diff --git a/drivers/net/wireless/mv8686/Makefile b/drivers/net/wireless/mv8686/Makefile deleted file mode 100755 index f18a69b614bb..000000000000 --- a/drivers/net/wireless/mv8686/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# -# Makefile for MV8686 wifi driver. -# - -mv8686-objs := main.o wext.o rx.o tx.o cmd.o cmdresp.o \ - scan.o 11d.o assoc.o if_sdio.o \ - ../wifi_power/wifi_power_ops.o mv8686_cis.o \ - ../wifi_power/wifi_power_save.o - -obj-$(CONFIG_MV8686) += mv8686.o ../wifi_power/wifi_power.o ../wifi_power/wifi_config.o diff --git a/drivers/net/wireless/mv8686/Makefile.kernel b/drivers/net/wireless/mv8686/Makefile.kernel deleted file mode 100755 index f18a69b614bb..000000000000 --- a/drivers/net/wireless/mv8686/Makefile.kernel +++ /dev/null @@ -1,10 +0,0 @@ -# -# Makefile for MV8686 wifi driver. -# - -mv8686-objs := main.o wext.o rx.o tx.o cmd.o cmdresp.o \ - scan.o 11d.o assoc.o if_sdio.o \ - ../wifi_power/wifi_power_ops.o mv8686_cis.o \ - ../wifi_power/wifi_power_save.o - -obj-$(CONFIG_MV8686) += mv8686.o ../wifi_power/wifi_power.o ../wifi_power/wifi_config.o diff --git a/drivers/net/wireless/mv8686/Makefile.module b/drivers/net/wireless/mv8686/Makefile.module deleted file mode 100755 index 7213eed5509f..000000000000 --- a/drivers/net/wireless/mv8686/Makefile.module +++ /dev/null @@ -1,37 +0,0 @@ -# -# Makefile for MV8686 to build driver module. -# - -KERNELDIR=/smb/rk28/newrk2808/rk2808_opensource_trunk - -############################################################################# -# Make Targets -############################################################################# - -ifneq ($(KERNELRELEASE),) - -WLANOBJS := main.o wext.o rx.o tx.o cmd.o cmdresp.o \ - scan.o 11d.o assoc.o if_sdio.o \ - ../wifi_power/wifi_power_ops.o mv8686_cis.o \ - ../wifi_power/wifi_power_save.o \ - ../wifi_power/wifi_power.o ../wifi_power/wifi_config.o - -obj-m := wlan.o - -wlan-objs := $(WLANOBJS) - -else - -default: - $(MAKE) -C $(KERNELDIR) M=$(PWD) modules - -endif - -############################################################### - -clean: - rm -f *.o *.ko .*.cmd *.mod.c - rm -f modules.order - rm -rf Module.symvers .tmp_versions - -# End of file diff --git a/drivers/net/wireless/mv8686/Makefile.mv8686 b/drivers/net/wireless/mv8686/Makefile.mv8686 deleted file mode 100755 index 061945549276..000000000000 --- a/drivers/net/wireless/mv8686/Makefile.mv8686 +++ /dev/null @@ -1,8 +0,0 @@ - -obj-$(CONFIG_MV8686) += mv8686.o wifi_power.o wifi_config.o - -$(obj)/mv8686.o: $(obj)/mv8686.uu - @echo "UUDE mv8686.uu" - @uudecode $(obj)/mv8686.uu -o $(obj)/mv8686.o - - diff --git a/drivers/net/wireless/mv8686/ReleaseNotes.txt b/drivers/net/wireless/mv8686/ReleaseNotes.txt deleted file mode 100755 index d58d4faf8017..000000000000 --- a/drivers/net/wireless/mv8686/ReleaseNotes.txt +++ /dev/null @@ -1,8 +0,0 @@ - -============================================================================== -=== Version 2.35 @ 2010-12-31 === -============================================================================== - -1. Ôö¼Ó¶ÔLinux 2.6.32Äں˵ÄÖ§³Ö¡£ - -2. \ No newline at end of file diff --git a/drivers/net/wireless/mv8686/assoc.c b/drivers/net/wireless/mv8686/assoc.c deleted file mode 100755 index 7d4494b12f3d..000000000000 --- a/drivers/net/wireless/mv8686/assoc.c +++ /dev/null @@ -1,1976 +0,0 @@ -/* Copyright (C) 2006, Red Hat, Inc. */ - -#include -#include -#include -#include -#include - -#include "lib80211.h" - -#include "assoc.h" -#include "decl.h" -#include "host.h" -#include "scan.h" -#include "cmd.h" - -/* - * Defined in main.c - */ -extern atomic_t reassoc_flag; - -#if (MV8686_SUPPORT_ADHOC == 1) -static int lbs_adhoc_post(struct lbs_private *priv, struct cmd_header *resp); -#endif - -static const u8 bssid_any[ETH_ALEN] __attribute__ ((aligned (2))) = - { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; -static const u8 bssid_off[ETH_ALEN] __attribute__ ((aligned (2))) = - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - -/* The firmware needs certain bits masked out of the beacon-derviced capability - * field when associating/joining to BSSs. - */ -#define CAPINFO_MASK (~(0xda00)) - - -/** - * @brief This function finds common rates between rates and card rates. - * - * It will fill common rates in rates as output if found. - * - * NOTE: Setting the MSB of the basic rates need to be taken - * care, either before or after calling this function - * - * @param priv A pointer to struct lbs_private structure - * @param rates the buffer which keeps input and output - * @param rates_size the size of rate1 buffer; new size of buffer on return - * - * @return 0 on success, or -1 on error - */ -static int get_common_rates(struct lbs_private *priv, - u8 *rates, - u16 *rates_size) -{ - u8 *card_rates = lbs_bg_rates; - size_t num_card_rates = sizeof(lbs_bg_rates); - int ret = 0, i, j; - u8 tmp[30]; - size_t tmp_size = 0; - - /* For each rate in card_rates that exists in rate1, copy to tmp */ - for (i = 0; card_rates[i] && (i < num_card_rates); i++) { - for (j = 0; rates[j] && (j < *rates_size); j++) { - if (rates[j] == card_rates[i]) - tmp[tmp_size++] = card_rates[i]; - } - } - - lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); - lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates); - lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); - lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); - - if (!priv->enablehwauto) { - for (i = 0; i < tmp_size; i++) { - if (tmp[i] == priv->cur_rate) - goto done; - } - lbs_pr_alert("Previously set fixed data rate %#x isn't " - "compatible with the network.\n", priv->cur_rate); - ret = -1; - goto done; - } - ret = 0; - -done: - memset(rates, 0, *rates_size); - *rates_size = min_t(int, tmp_size, *rates_size); - memcpy(rates, tmp, *rates_size); - return ret; -} - - -/** - * @brief Sets the MSB on basic rates as the firmware requires - * - * Scan through an array and set the MSB for basic data rates. - * - * @param rates buffer of data rates - * @param len size of buffer - */ -static void lbs_set_basic_rate_flags(u8 *rates, size_t len) -{ - int i; - - for (i = 0; i < len; i++) { - if (rates[i] == 0x02 || rates[i] == 0x04 || - rates[i] == 0x0b || rates[i] == 0x16) - rates[i] |= 0x80; - } -} - - -/** - * @brief Associate to a specific BSS discovered in a scan - * - * @param priv A pointer to struct lbs_private structure - * @param assoc_req The association request describing the BSS to associate with - * - * @return 0-success, otherwise fail - */ -static int lbs_associate(struct lbs_private *priv, - struct assoc_request *assoc_req) -{ - int ret; - u8 preamble = RADIO_PREAMBLE_LONG; - - lbs_deb_enter(LBS_DEB_ASSOC); - -//#if (NEW_MV8686_PS == 1) -#if 0 - assoc_retry: -#endif - - //printk("%s: sending authenticate command.\n", __func__); - ret = lbs_prepare_and_send_command(priv, CMD_802_11_AUTHENTICATE, - 0, CMD_OPTION_WAITFORRSP, - 0, assoc_req->bss.bssid); - if (ret) - goto out; - - /* Use short preamble only when both the BSS and firmware support it */ - if ((priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) && - (assoc_req->bss.capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) - preamble = RADIO_PREAMBLE_SHORT; - - ret = lbs_set_radio(priv, preamble, 1); - if (ret) - goto out; - - //printk("%s: sending associate command.\n", __func__); - ret = lbs_prepare_and_send_command(priv, CMD_802_11_ASSOCIATE, - 0, CMD_OPTION_WAITFORRSP, 0, assoc_req); - -//#if (NEW_MV8686_PS == 1) -#if 0 - if (priv->associate_retry > 0) - { - printk("%s: Need to retry association.\n", __func__); - goto assoc_retry; - } -#endif - -out: - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - -#if (MV8686_SUPPORT_ADHOC == 1) - -/** - * @brief Join an adhoc network found in a previous scan - * - * @param priv A pointer to struct lbs_private structure - * @param assoc_req The association request describing the BSS to join - * - * @return 0 on success, error on failure - */ -static int lbs_adhoc_join(struct lbs_private *priv, - struct assoc_request *assoc_req) -{ - struct cmd_ds_802_11_ad_hoc_join cmd; - struct bss_descriptor *bss = &assoc_req->bss; - u8 preamble = RADIO_PREAMBLE_LONG; - DECLARE_SSID_BUF(ssid); - u16 ratesize = 0; - int ret = 0; - - lbs_deb_enter(LBS_DEB_ASSOC); - - lbs_deb_join("current SSID '%s', ssid length %u\n", - mv8686_print_ssid(ssid, priv->curbssparams.ssid, - priv->curbssparams.ssid_len), - priv->curbssparams.ssid_len); - lbs_deb_join("requested ssid '%s', ssid length %u\n", - mv8686_print_ssid(ssid, bss->ssid, bss->ssid_len), - bss->ssid_len); - - /* check if the requested SSID is already joined */ - if (priv->curbssparams.ssid_len && - !lbs_ssid_cmp(priv->curbssparams.ssid, - priv->curbssparams.ssid_len, - bss->ssid, bss->ssid_len) && - (priv->mode == IW_MODE_ADHOC) && - (priv->connect_status == LBS_CONNECTED)) { - union iwreq_data wrqu; - - lbs_deb_join("ADHOC_J_CMD: New ad-hoc SSID is the same as " - "current, not attempting to re-join"); - - /* Send the re-association event though, because the association - * request really was successful, even if just a null-op. - */ - memset(&wrqu, 0, sizeof(wrqu)); - memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, - ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); - goto out; - } - - /* Use short preamble only when both the BSS and firmware support it */ - if ((priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) && - (bss->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) { - lbs_deb_join("AdhocJoin: Short preamble\n"); - preamble = RADIO_PREAMBLE_SHORT; - } - - ret = lbs_set_radio(priv, preamble, 1); - if (ret) - goto out; - - lbs_deb_join("AdhocJoin: channel = %d\n", assoc_req->channel); - lbs_deb_join("AdhocJoin: band = %c\n", assoc_req->band); - - priv->adhoccreate = 0; - priv->curbssparams.channel = bss->channel; - - /* Build the join command */ - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - - cmd.bss.type = CMD_BSS_TYPE_IBSS; - cmd.bss.beaconperiod = cpu_to_le16(bss->beaconperiod); - - memcpy(&cmd.bss.bssid, &bss->bssid, ETH_ALEN); - memcpy(&cmd.bss.ssid, &bss->ssid, bss->ssid_len); - - memcpy(&cmd.bss.phyparamset, &bss->phyparamset, - sizeof(union ieeetypes_phyparamset)); - - memcpy(&cmd.bss.ssparamset, &bss->ssparamset, - sizeof(union IEEEtypes_ssparamset)); - - cmd.bss.capability = cpu_to_le16(bss->capability & CAPINFO_MASK); - lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", - bss->capability, CAPINFO_MASK); - - /* information on BSSID descriptor passed to FW */ - lbs_deb_join("ADHOC_J_CMD: BSSID = %pM, SSID = '%s'\n", - cmd.bss.bssid, cmd.bss.ssid); - - /* Only v8 and below support setting these */ - if (priv->fwrelease < 0x09000000) { - /* failtimeout */ - cmd.failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); - /* probedelay */ - cmd.probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME); - } - - /* Copy Data rates from the rates recorded in scan response */ - memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates)); - ratesize = min_t(u16, sizeof(cmd.bss.rates), MAX_RATES); - memcpy(cmd.bss.rates, bss->rates, ratesize); - if (get_common_rates(priv, cmd.bss.rates, &ratesize)) { - lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n"); - ret = -1; - goto out; - } - - /* Copy the ad-hoc creation rates into Current BSS state structure */ - memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates)); - memcpy(&priv->curbssparams.rates, cmd.bss.rates, ratesize); - - /* Set MSB on basic rates as the firmware requires, but _after_ - * copying to current bss rates. - */ - lbs_set_basic_rate_flags(cmd.bss.rates, ratesize); - - cmd.bss.ssparamset.ibssparamset.atimwindow = cpu_to_le16(bss->atimwindow); - - if (assoc_req->secinfo.wep_enabled) { - u16 tmp = le16_to_cpu(cmd.bss.capability); - tmp |= WLAN_CAPABILITY_PRIVACY; - cmd.bss.capability = cpu_to_le16(tmp); - } - - if (priv->psmode == LBS802_11POWERMODEMAX_PSP) { - __le32 local_ps_mode = cpu_to_le32(LBS802_11POWERMODECAM); - - /* wake up first */ - ret = lbs_prepare_and_send_command(priv, CMD_802_11_PS_MODE, - CMD_ACT_SET, 0, 0, - &local_ps_mode); - if (ret) { - ret = -1; - goto out; - } - } - - if (lbs_parse_dnld_countryinfo_11d(priv, bss)) { - ret = -1; - goto out; - } - - ret = lbs_cmd_with_response(priv, CMD_802_11_AD_HOC_JOIN, &cmd); - if (ret == 0) - ret = lbs_adhoc_post(priv, (struct cmd_header *) &cmd); - -out: - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - -/** - * @brief Start an Adhoc Network - * - * @param priv A pointer to struct lbs_private structure - * @param assoc_req The association request describing the BSS to start - * - * @return 0 on success, error on failure - */ -static int lbs_adhoc_start(struct lbs_private *priv, - struct assoc_request *assoc_req) -{ - struct cmd_ds_802_11_ad_hoc_start cmd; - u8 preamble = RADIO_PREAMBLE_LONG; - size_t ratesize = 0; - u16 tmpcap = 0; - int ret = 0; - DECLARE_SSID_BUF(ssid); - - lbs_deb_enter(LBS_DEB_ASSOC); - - if (priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) { - lbs_deb_join("ADHOC_START: Will use short preamble\n"); - preamble = RADIO_PREAMBLE_SHORT; - } - - ret = lbs_set_radio(priv, preamble, 1); - if (ret) - goto out; - - /* Build the start command */ - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - - memcpy(cmd.ssid, assoc_req->ssid, assoc_req->ssid_len); - - lbs_deb_join("ADHOC_START: SSID '%s', ssid length %u\n", - mv8686_print_ssid(ssid, assoc_req->ssid, assoc_req->ssid_len), - assoc_req->ssid_len); - - cmd.bsstype = CMD_BSS_TYPE_IBSS; - - if (priv->beacon_period == 0) - priv->beacon_period = MRVDRV_BEACON_INTERVAL; - cmd.beaconperiod = cpu_to_le16(priv->beacon_period); - - WARN_ON(!assoc_req->channel); - - /* set Physical parameter set */ - cmd.phyparamset.dsparamset.elementid = WLAN_EID_DS_PARAMS; - cmd.phyparamset.dsparamset.len = 1; - cmd.phyparamset.dsparamset.currentchan = assoc_req->channel; - - /* set IBSS parameter set */ - cmd.ssparamset.ibssparamset.elementid = WLAN_EID_IBSS_PARAMS; - cmd.ssparamset.ibssparamset.len = 2; - cmd.ssparamset.ibssparamset.atimwindow = 0; - - /* set capability info */ - tmpcap = WLAN_CAPABILITY_IBSS; - if (assoc_req->secinfo.wep_enabled) { - lbs_deb_join("ADHOC_START: WEP enabled, setting privacy on\n"); - tmpcap |= WLAN_CAPABILITY_PRIVACY; - } else - lbs_deb_join("ADHOC_START: WEP disabled, setting privacy off\n"); - - cmd.capability = cpu_to_le16(tmpcap); - - /* Only v8 and below support setting probe delay */ - if (priv->fwrelease < 0x09000000) - cmd.probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME); - - ratesize = min(sizeof(cmd.rates), sizeof(lbs_bg_rates)); - memcpy(cmd.rates, lbs_bg_rates, ratesize); - - /* Copy the ad-hoc creating rates into Current BSS state structure */ - memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates)); - memcpy(&priv->curbssparams.rates, &cmd.rates, ratesize); - - /* Set MSB on basic rates as the firmware requires, but _after_ - * copying to current bss rates. - */ - lbs_set_basic_rate_flags(cmd.rates, ratesize); - - lbs_deb_join("ADHOC_START: rates=%02x %02x %02x %02x\n", - cmd.rates[0], cmd.rates[1], cmd.rates[2], cmd.rates[3]); - - if (lbs_create_dnld_countryinfo_11d(priv)) { - lbs_deb_join("ADHOC_START: dnld_countryinfo_11d failed\n"); - ret = -1; - goto out; - } - - lbs_deb_join("ADHOC_START: Starting Ad-Hoc BSS on channel %d, band %d\n", - assoc_req->channel, assoc_req->band); - - priv->adhoccreate = 1; - priv->mode = IW_MODE_ADHOC; - - ret = lbs_cmd_with_response(priv, CMD_802_11_AD_HOC_START, &cmd); - if (ret == 0) - ret = lbs_adhoc_post(priv, (struct cmd_header *) &cmd); - -out: - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - -/** - * @brief Stop and Ad-Hoc network and exit Ad-Hoc mode - * - * @param priv A pointer to struct lbs_private structure - * @return 0 on success, or an error - */ -int lbs_adhoc_stop(struct lbs_private *priv) -{ - struct cmd_ds_802_11_ad_hoc_stop cmd; - int ret; - - lbs_deb_enter(LBS_DEB_JOIN); - - memset(&cmd, 0, sizeof (cmd)); - cmd.hdr.size = cpu_to_le16 (sizeof (cmd)); - - ret = lbs_cmd_with_response(priv, CMD_802_11_AD_HOC_STOP, &cmd); - - /* Clean up everything even if there was an error */ - lbs_mac_event_disconnected(priv); - - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} -#endif - -static inline int match_bss_no_security(struct lbs_802_11_security *secinfo, - struct bss_descriptor *match_bss) -{ - if (!secinfo->wep_enabled && !secinfo->WPAenabled - && !secinfo->WPA2enabled - && match_bss->wpa_ie[0] != WLAN_EID_GENERIC - && match_bss->rsn_ie[0] != WLAN_EID_RSN - && !(match_bss->capability & WLAN_CAPABILITY_PRIVACY)) - return 1; - else - return 0; -} - -static inline int match_bss_static_wep(struct lbs_802_11_security *secinfo, - struct bss_descriptor *match_bss) -{ - if (secinfo->wep_enabled && !secinfo->WPAenabled - && !secinfo->WPA2enabled - && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) - return 1; - else - return 0; -} - -static inline int match_bss_wpa(struct lbs_802_11_security *secinfo, - struct bss_descriptor *match_bss) -{ - if (!secinfo->wep_enabled && secinfo->WPAenabled - && (match_bss->wpa_ie[0] == WLAN_EID_GENERIC) - /* privacy bit may NOT be set in some APs like LinkSys WRT54G - && (match_bss->capability & WLAN_CAPABILITY_PRIVACY) */ - ) - return 1; - else - return 0; -} - -static inline int match_bss_wpa2(struct lbs_802_11_security *secinfo, - struct bss_descriptor *match_bss) -{ - if (!secinfo->wep_enabled && secinfo->WPA2enabled && - (match_bss->rsn_ie[0] == WLAN_EID_RSN) - /* privacy bit may NOT be set in some APs like LinkSys WRT54G - (match_bss->capability & WLAN_CAPABILITY_PRIVACY) */ - ) - return 1; - else - return 0; -} - -static inline int match_bss_dynamic_wep(struct lbs_802_11_security *secinfo, - struct bss_descriptor *match_bss) -{ - if (!secinfo->wep_enabled && !secinfo->WPAenabled - && !secinfo->WPA2enabled - && (match_bss->wpa_ie[0] != WLAN_EID_GENERIC) - && (match_bss->rsn_ie[0] != WLAN_EID_RSN) - && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) - return 1; - else - return 0; -} - -/** - * @brief Check if a scanned network compatible with the driver settings - * - * WEP WPA WPA2 ad-hoc encrypt Network - * enabled enabled enabled AES mode privacy WPA WPA2 Compatible - * 0 0 0 0 NONE 0 0 0 yes No security - * 1 0 0 0 NONE 1 0 0 yes Static WEP - * 0 1 0 0 x 1x 1 x yes WPA - * 0 0 1 0 x 1x x 1 yes WPA2 - * 0 0 0 1 NONE 1 0 0 yes Ad-hoc AES - * 0 0 0 0 !=NONE 1 0 0 yes Dynamic WEP - * - * - * @param priv A pointer to struct lbs_private - * @param index Index in scantable to check against current driver settings - * @param mode Network mode: Infrastructure or IBSS - * - * @return Index in scantable, or error code if negative - */ -static int is_network_compatible(struct lbs_private *priv, - struct bss_descriptor *bss, uint8_t mode) -{ - int matched = 0; - - lbs_deb_enter(LBS_DEB_SCAN); - - if (bss->mode != mode) - goto done; - - matched = match_bss_no_security(&priv->secinfo, bss); - if (matched) - goto done; - matched = match_bss_static_wep(&priv->secinfo, bss); - if (matched) - goto done; - matched = match_bss_wpa(&priv->secinfo, bss); - if (matched) { - lbs_deb_scan("is_network_compatible() WPA: wpa_ie 0x%x " - "wpa2_ie 0x%x WEP %s WPA %s WPA2 %s " - "privacy 0x%x\n", bss->wpa_ie[0], bss->rsn_ie[0], - priv->secinfo.wep_enabled ? "e" : "d", - priv->secinfo.WPAenabled ? "e" : "d", - priv->secinfo.WPA2enabled ? "e" : "d", - (bss->capability & WLAN_CAPABILITY_PRIVACY)); - goto done; - } - matched = match_bss_wpa2(&priv->secinfo, bss); - if (matched) { - lbs_deb_scan("is_network_compatible() WPA2: wpa_ie 0x%x " - "wpa2_ie 0x%x WEP %s WPA %s WPA2 %s " - "privacy 0x%x\n", bss->wpa_ie[0], bss->rsn_ie[0], - priv->secinfo.wep_enabled ? "e" : "d", - priv->secinfo.WPAenabled ? "e" : "d", - priv->secinfo.WPA2enabled ? "e" : "d", - (bss->capability & WLAN_CAPABILITY_PRIVACY)); - goto done; - } - matched = match_bss_dynamic_wep(&priv->secinfo, bss); - if (matched) { - lbs_deb_scan("is_network_compatible() dynamic WEP: " - "wpa_ie 0x%x wpa2_ie 0x%x privacy 0x%x\n", - bss->wpa_ie[0], bss->rsn_ie[0], - (bss->capability & WLAN_CAPABILITY_PRIVACY)); - goto done; - } - - /* bss security settings don't match those configured on card */ - lbs_deb_scan("is_network_compatible() FAILED: wpa_ie 0x%x " - "wpa2_ie 0x%x WEP %s WPA %s WPA2 %s privacy 0x%x\n", - bss->wpa_ie[0], bss->rsn_ie[0], - priv->secinfo.wep_enabled ? "e" : "d", - priv->secinfo.WPAenabled ? "e" : "d", - priv->secinfo.WPA2enabled ? "e" : "d", - (bss->capability & WLAN_CAPABILITY_PRIVACY)); - -done: - lbs_deb_leave_args(LBS_DEB_SCAN, "matched: %d", matched); - return matched; -} - -/** - * @brief This function finds a specific compatible BSSID in the scan list - * - * Used in association code - * - * @param priv A pointer to struct lbs_private - * @param bssid BSSID to find in the scan list - * @param mode Network mode: Infrastructure or IBSS - * - * @return index in BSSID list, or error return code (< 0) - */ -static struct bss_descriptor *lbs_find_bssid_in_list(struct lbs_private *priv, - uint8_t *bssid, uint8_t mode) -{ - struct bss_descriptor *iter_bss; - struct bss_descriptor *found_bss = NULL; - - lbs_deb_enter(LBS_DEB_SCAN); - - if (!bssid) - goto out; - - lbs_deb_hex(LBS_DEB_SCAN, "looking for", bssid, ETH_ALEN); - - /* Look through the scan table for a compatible match. The loop will - * continue past a matched bssid that is not compatible in case there - * is an AP with multiple SSIDs assigned to the same BSSID - */ - mutex_lock(&priv->lock); - list_for_each_entry(iter_bss, &priv->network_list, list) { - if (compare_ether_addr(iter_bss->bssid, bssid)) - continue; /* bssid doesn't match */ - switch (mode) { - case IW_MODE_INFRA: - case IW_MODE_ADHOC: - if (!is_network_compatible(priv, iter_bss, mode)) - break; - found_bss = iter_bss; - break; - default: - found_bss = iter_bss; - break; - } - } - mutex_unlock(&priv->lock); - -out: - lbs_deb_leave_args(LBS_DEB_SCAN, "found_bss %p", found_bss); - return found_bss; -} - -/** - * @brief This function finds ssid in ssid list. - * - * Used in association code - * - * @param priv A pointer to struct lbs_private - * @param ssid SSID to find in the list - * @param bssid BSSID to qualify the SSID selection (if provided) - * @param mode Network mode: Infrastructure or IBSS - * - * @return index in BSSID list - */ -static struct bss_descriptor *lbs_find_ssid_in_list(struct lbs_private *priv, - uint8_t *ssid, uint8_t ssid_len, - uint8_t *bssid, uint8_t mode, - int channel) -{ - u32 bestrssi = 0; - struct bss_descriptor *iter_bss = NULL; - struct bss_descriptor *found_bss = NULL; - struct bss_descriptor *tmp_oldest = NULL; - - lbs_deb_enter(LBS_DEB_SCAN); - - mutex_lock(&priv->lock); - - list_for_each_entry(iter_bss, &priv->network_list, list) { - if (!tmp_oldest || - (iter_bss->last_scanned < tmp_oldest->last_scanned)) - tmp_oldest = iter_bss; - - if (lbs_ssid_cmp(iter_bss->ssid, iter_bss->ssid_len, - ssid, ssid_len) != 0) - continue; /* ssid doesn't match */ - if (bssid && compare_ether_addr(iter_bss->bssid, bssid) != 0) - continue; /* bssid doesn't match */ - if ((channel > 0) && (iter_bss->channel != channel)) - continue; /* channel doesn't match */ - - switch (mode) { - case IW_MODE_INFRA: - case IW_MODE_ADHOC: - if (!is_network_compatible(priv, iter_bss, mode)) - break; - - if (bssid) { - /* Found requested BSSID */ - found_bss = iter_bss; - goto out; - } - - if (SCAN_RSSI(iter_bss->rssi) > bestrssi) { - bestrssi = SCAN_RSSI(iter_bss->rssi); - found_bss = iter_bss; - } - break; - case IW_MODE_AUTO: - default: - if (SCAN_RSSI(iter_bss->rssi) > bestrssi) { - bestrssi = SCAN_RSSI(iter_bss->rssi); - found_bss = iter_bss; - } - break; - } - } - -out: - mutex_unlock(&priv->lock); - lbs_deb_leave_args(LBS_DEB_SCAN, "found_bss %p", found_bss); - return found_bss; -} - -static int assoc_helper_essid(struct lbs_private *priv, - struct assoc_request * assoc_req) -{ - int ret = 0; - struct bss_descriptor * bss; - int channel = -1; - DECLARE_SSID_BUF(ssid); - - lbs_deb_enter(LBS_DEB_ASSOC); - - /* FIXME: take channel into account when picking SSIDs if a channel - * is set. - */ - - if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) - channel = assoc_req->channel; - - lbs_deb_assoc - //printk - ("SSID '%s' requested\n", - mv8686_print_ssid(ssid, assoc_req->ssid, assoc_req->ssid_len)); - if (assoc_req->mode == IW_MODE_INFRA) { - /* Find in list first -- Yongle Lai */ - bss = lbs_find_ssid_in_list(priv, assoc_req->ssid, - assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel); - if (bss == NULL) - { - lbs_send_specific_ssid_scan(priv, assoc_req->ssid, assoc_req->ssid_len); - bss = lbs_find_ssid_in_list(priv, assoc_req->ssid, - assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel); - } - else - printk("Needn't special scan for this ssid to do association.\n"); - - if (bss != NULL) { - memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); - ret = lbs_associate(priv, assoc_req); - } else { - printk("WIFI-ERROR: SSID <%s> not found; cannot associate\n", assoc_req->ssid); - } - } - -#if (MV8686_SUPPORT_ADHOC == 1) - - else if (assoc_req->mode == IW_MODE_ADHOC) { - /* Scan for the network, do not save previous results. Stale - * scan data will cause us to join a non-existant adhoc network - */ - lbs_send_specific_ssid_scan(priv, assoc_req->ssid, - assoc_req->ssid_len); - - /* Search for the requested SSID in the scan table */ - bss = lbs_find_ssid_in_list(priv, assoc_req->ssid, - assoc_req->ssid_len, NULL, IW_MODE_ADHOC, channel); - if (bss != NULL) { - lbs_deb_assoc("SSID found, will join\n"); - memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); - lbs_adhoc_join(priv, assoc_req); - } else { - /* else send START command */ - lbs_deb_assoc("SSID not found, creating adhoc network\n"); - memcpy(&assoc_req->bss.ssid, &assoc_req->ssid, - IW_ESSID_MAX_SIZE); - assoc_req->bss.ssid_len = assoc_req->ssid_len; - lbs_adhoc_start(priv, assoc_req); - } - } -#endif - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - - -static int assoc_helper_bssid(struct lbs_private *priv, - struct assoc_request * assoc_req) -{ - int ret = 0; - struct bss_descriptor * bss; - - lbs_deb_enter_args(LBS_DEB_ASSOC, "BSSID %pM", assoc_req->bssid); - - /* Search for index position in list for requested MAC */ - bss = lbs_find_bssid_in_list(priv, assoc_req->bssid, - assoc_req->mode); - if (bss == NULL) { - lbs_deb_assoc("ASSOC: WAP: BSSID %pM not found, " - "cannot associate.\n", assoc_req->bssid); - goto out; - } - - memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); - if (assoc_req->mode == IW_MODE_INFRA) { - ret = lbs_associate(priv, assoc_req); - lbs_deb_assoc("ASSOC: lbs_associate(bssid) returned %d\n", ret); - } -#if (MV8686_SUPPORT_ADHOC == 1) - - else if (assoc_req->mode == IW_MODE_ADHOC) { - lbs_adhoc_join(priv, assoc_req); - } -#endif - -out: - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - - -static int assoc_helper_associate(struct lbs_private *priv, - struct assoc_request * assoc_req) -{ - int ret = 0, done = 0; - - lbs_deb_enter(LBS_DEB_ASSOC); - - /* If we're given and 'any' BSSID, try associating based on SSID */ - - if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { - if (compare_ether_addr(bssid_any, assoc_req->bssid) - && compare_ether_addr(bssid_off, assoc_req->bssid)) { - ret = assoc_helper_bssid(priv, assoc_req); - done = 1; - } - } - - if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { - ret = assoc_helper_essid(priv, assoc_req); - } - - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - -#if (NEW_MV8686_PS == 1) -static int assoc_helper_mode(struct lbs_private *priv, - struct assoc_request * assoc_req) -{ - int ret = 0; - - lbs_deb_enter(LBS_DEB_ASSOC); - - if (assoc_req->mode == priv->mode) - goto done; - - if (assoc_req->mode == IW_MODE_INFRA) { - if (priv->psstate != PS_STATE_FULL_POWER) - lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); - priv->psmode = LBS802_11POWERMODECAM; - } - - priv->mode = assoc_req->mode; - ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, assoc_req->mode); - -done: - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} -#endif - -static int assoc_helper_channel(struct lbs_private *priv, - struct assoc_request * assoc_req) -{ - int ret = 0; - - lbs_deb_enter(LBS_DEB_ASSOC); - - ret = lbs_update_channel(priv); - if (ret) { - lbs_deb_assoc("ASSOC: channel: error getting channel.\n"); - goto done; - } - - if (assoc_req->channel == priv->curbssparams.channel) - goto done; - - lbs_deb_assoc("ASSOC: channel: %d -> %d\n", - priv->curbssparams.channel, assoc_req->channel); - - ret = lbs_set_channel(priv, assoc_req->channel); - if (ret < 0) - lbs_deb_assoc("ASSOC: channel: error setting channel.\n"); - - /* FIXME: shouldn't need to grab the channel _again_ after setting - * it since the firmware is supposed to return the new channel, but - * whatever... */ - ret = lbs_update_channel(priv); - if (ret) { - lbs_deb_assoc("ASSOC: channel: error getting channel.\n"); - goto done; - } - - if (assoc_req->channel != priv->curbssparams.channel) { - lbs_deb_assoc("ASSOC: channel: failed to update channel to %d\n", - assoc_req->channel); - goto restore_mesh; - } - - if ( assoc_req->secinfo.wep_enabled - && (assoc_req->wep_keys[0].len - || assoc_req->wep_keys[1].len - || assoc_req->wep_keys[2].len - || assoc_req->wep_keys[3].len)) { - /* Make sure WEP keys are re-sent to firmware */ - set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); - } - - /* Must restart/rejoin adhoc networks after channel change */ - set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); - - restore_mesh: - done: - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - - -static int assoc_helper_wep_keys(struct lbs_private *priv, - struct assoc_request *assoc_req) -{ - int i; - int ret = 0; - - lbs_deb_enter(LBS_DEB_ASSOC); - - /* Set or remove WEP keys */ - if (assoc_req->wep_keys[0].len || assoc_req->wep_keys[1].len || - assoc_req->wep_keys[2].len || assoc_req->wep_keys[3].len) - ret = lbs_cmd_802_11_set_wep(priv, CMD_ACT_ADD, assoc_req); - else - ret = lbs_cmd_802_11_set_wep(priv, CMD_ACT_REMOVE, assoc_req); - - if (ret) - goto out; - - /* enable/disable the MAC's WEP packet filter */ - if (assoc_req->secinfo.wep_enabled) - priv->mac_control |= CMD_ACT_MAC_WEP_ENABLE; - else - priv->mac_control &= ~CMD_ACT_MAC_WEP_ENABLE; - - lbs_set_mac_control(priv); - - mutex_lock(&priv->lock); - - /* Copy WEP keys into priv wep key fields */ - for (i = 0; i < 4; i++) { - memcpy(&priv->wep_keys[i], &assoc_req->wep_keys[i], - sizeof(struct enc_key)); - } - priv->wep_tx_keyidx = assoc_req->wep_tx_keyidx; - - mutex_unlock(&priv->lock); - -out: - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - -static int assoc_helper_secinfo(struct lbs_private *priv, - struct assoc_request * assoc_req) -{ - int ret = 0; - uint16_t do_wpa; - uint16_t rsn = 0; - - lbs_deb_enter(LBS_DEB_ASSOC); - - memcpy(&priv->secinfo, &assoc_req->secinfo, - sizeof(struct lbs_802_11_security)); - - lbs_set_mac_control(priv); - - /* If RSN is already enabled, don't try to enable it again, since - * ENABLE_RSN resets internal state machines and will clobber the - * 4-way WPA handshake. - */ - - /* Get RSN enabled/disabled */ - ret = lbs_cmd_802_11_enable_rsn(priv, CMD_ACT_GET, &rsn); - if (ret) { - lbs_deb_assoc("Failed to get RSN status: %d\n", ret); - goto out; - } - - /* Don't re-enable RSN if it's already enabled */ - do_wpa = assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled; - if (do_wpa == rsn) - goto out; - - /* Set RSN enabled/disabled */ - ret = lbs_cmd_802_11_enable_rsn(priv, CMD_ACT_SET, &do_wpa); - -out: - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - - -static int assoc_helper_wpa_keys(struct lbs_private *priv, - struct assoc_request * assoc_req) -{ - int ret = 0; - unsigned int flags = assoc_req->flags; - - lbs_deb_enter(LBS_DEB_ASSOC); - - /* Work around older firmware bug where WPA unicast and multicast - * keys must be set independently. Seen in SDIO parts with firmware - * version 5.0.11p0. - */ - - if (test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { - clear_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); - ret = lbs_cmd_802_11_key_material(priv, CMD_ACT_SET, assoc_req); - assoc_req->flags = flags; - } - - if (ret) - goto out; - - if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags)) { - clear_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); - - ret = lbs_cmd_802_11_key_material(priv, CMD_ACT_SET, assoc_req); - assoc_req->flags = flags; - } - -out: - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - - -static int assoc_helper_wpa_ie(struct lbs_private *priv, - struct assoc_request * assoc_req) -{ - int ret = 0; - - lbs_deb_enter(LBS_DEB_ASSOC); - - if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { - memcpy(&priv->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len); - priv->wpa_ie_len = assoc_req->wpa_ie_len; - } else { - memset(&priv->wpa_ie, 0, MAX_WPA_IE_LEN); - priv->wpa_ie_len = 0; - } - - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - - -static int should_deauth_infrastructure(struct lbs_private *priv, - struct assoc_request * assoc_req) -{ - int ret = 0; - - if (priv->connect_status != LBS_CONNECTED) - return 0; - - lbs_deb_enter(LBS_DEB_ASSOC); - if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { - printk("Deauthenticating due to new SSID\n"); - ret = 1; - goto out; - } - - if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { - if (priv->secinfo.auth_mode != assoc_req->secinfo.auth_mode) { - printk("Deauthenticating due to new security\n"); - ret = 1; - goto out; - } - } - - if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { - printk("Deauthenticating due to new BSSID\n"); - ret = 1; - goto out; - } - - if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) { - printk("Deauthenticating due to channel switch\n"); - ret = 1; - goto out; - } - -#if (NEW_MV8686_PS == 1) - /* FIXME: deal with 'auto' mode somehow */ - if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { - if (assoc_req->mode != IW_MODE_INFRA) { - lbs_deb_assoc("Deauthenticating due to leaving " - "infra mode\n"); - ret = 1; - goto out; - } - } -#endif - -out: - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - -#if (MV8686_SUPPORT_ADHOC == 1) -static int should_stop_adhoc(struct lbs_private *priv, - struct assoc_request * assoc_req) -{ - lbs_deb_enter(LBS_DEB_ASSOC); - - if (priv->connect_status != LBS_CONNECTED) - return 0; - - if (lbs_ssid_cmp(priv->curbssparams.ssid, - priv->curbssparams.ssid_len, - assoc_req->ssid, assoc_req->ssid_len) != 0) - return 1; - - /* FIXME: deal with 'auto' mode somehow */ - if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { - if (assoc_req->mode != IW_MODE_ADHOC) - return 1; - } - - if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) { - if (assoc_req->channel != priv->curbssparams.channel) - return 1; - } - - lbs_deb_leave(LBS_DEB_ASSOC); - return 0; -} -#endif - -/** - * @brief This function finds the best SSID in the Scan List - * - * Search the scan table for the best SSID that also matches the current - * adapter network preference (infrastructure or adhoc) - * - * @param priv A pointer to struct lbs_private - * - * @return index in BSSID list - */ -static struct bss_descriptor *lbs_find_best_ssid_in_list( - struct lbs_private *priv, uint8_t mode) -{ - uint8_t bestrssi = 0; - struct bss_descriptor *iter_bss; - struct bss_descriptor *best_bss = NULL; - - lbs_deb_enter(LBS_DEB_SCAN); - - mutex_lock(&priv->lock); - - list_for_each_entry(iter_bss, &priv->network_list, list) { - switch (mode) { - case IW_MODE_INFRA: - case IW_MODE_ADHOC: - if (!is_network_compatible(priv, iter_bss, mode)) - break; - if (SCAN_RSSI(iter_bss->rssi) <= bestrssi) - break; - bestrssi = SCAN_RSSI(iter_bss->rssi); - best_bss = iter_bss; - break; - case IW_MODE_AUTO: - default: - if (SCAN_RSSI(iter_bss->rssi) <= bestrssi) - break; - bestrssi = SCAN_RSSI(iter_bss->rssi); - best_bss = iter_bss; - break; - } - } - - mutex_unlock(&priv->lock); - lbs_deb_leave_args(LBS_DEB_SCAN, "best_bss %p", best_bss); - return best_bss; -} - -/** - * @brief Find the best AP - * - * Used from association worker. - * - * @param priv A pointer to struct lbs_private structure - * @param pSSID A pointer to AP's ssid - * - * @return 0--success, otherwise--fail - */ -static int lbs_find_best_network_ssid(struct lbs_private *priv, - uint8_t *out_ssid, uint8_t *out_ssid_len, uint8_t preferred_mode, - uint8_t *out_mode) -{ - int ret = -1; - struct bss_descriptor *found; - - lbs_deb_enter(LBS_DEB_SCAN); - - priv->scan_ssid_len = 0; - lbs_scan_networks(priv, 1); - if (priv->surpriseremoved) - goto out; - - found = lbs_find_best_ssid_in_list(priv, preferred_mode); - if (found && (found->ssid_len > 0)) { - memcpy(out_ssid, &found->ssid, IW_ESSID_MAX_SIZE); - *out_ssid_len = found->ssid_len; - *out_mode = found->mode; - ret = 0; - } - -out: - lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); - return ret; -} - -int wep_assoc_retry = 0; - -void lbs_association_worker(struct work_struct *work) -{ - struct lbs_private *priv = container_of(work, struct lbs_private, - assoc_work.work); - struct assoc_request * assoc_req = NULL; - int ret = 0; - int find_any_ssid = 0; - DECLARE_SSID_BUF(ssid); - - lbs_deb_enter(LBS_DEB_ASSOC); - -tryagain: - //printk("lbs_association_worker\n"); - - mutex_lock(&priv->lock); - assoc_req = priv->pending_assoc_req; - priv->pending_assoc_req = NULL; - priv->in_progress_assoc_req = assoc_req; - mutex_unlock(&priv->lock); - - if (!assoc_req) - goto done; - - lbs_deb_assoc( - //printk( - "Association Request:\n" - " flags: 0x%08lx\n" - " SSID: '%s'\n" - " chann: %d\n" - " band: %d\n" - " mode: %d\n" - " BSSID: %pM\n" - " secinfo: %s%s%s\n" - " auth_mode: %d\n", - assoc_req->flags, - mv8686_print_ssid(ssid, assoc_req->ssid, assoc_req->ssid_len), - assoc_req->channel, assoc_req->band, assoc_req->mode, - assoc_req->bssid, - assoc_req->secinfo.WPAenabled ? " WPA" : "", - assoc_req->secinfo.WPA2enabled ? " WPA2" : "", - assoc_req->secinfo.wep_enabled ? " WEP" : "", - assoc_req->secinfo.auth_mode); - - /* If 'any' SSID was specified, find an SSID to associate with */ - if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags) && !assoc_req->ssid_len) - find_any_ssid = 1; - - /* But don't use 'any' SSID if there's a valid locked BSSID to use */ - if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) - { - if (compare_ether_addr(assoc_req->bssid, bssid_any) && - compare_ether_addr(assoc_req->bssid, bssid_off)) - find_any_ssid = 0; - } - - if (find_any_ssid) - { - u8 new_mode = assoc_req->mode; - - ret = lbs_find_best_network_ssid(priv, assoc_req->ssid, - &assoc_req->ssid_len, assoc_req->mode, &new_mode); - if (ret) { - lbs_deb_assoc("Could not find best network\n"); - ret = -ENETUNREACH; - goto out; - } - - /* Ensure we switch to the mode of the AP */ - if (assoc_req->mode == IW_MODE_AUTO) - { - set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); - assoc_req->mode = new_mode; - } - } - - /* - * Check if the attributes being changing require deauthentication - * from the currently associated infrastructure access point. - */ - if (priv->mode == IW_MODE_INFRA) - { - if (should_deauth_infrastructure(priv, assoc_req)) { - ret = lbs_cmd_80211_deauthenticate(priv, - priv->curbssparams.bssid, - WLAN_REASON_DEAUTH_LEAVING); - if (ret) { - lbs_deb_assoc("Deauthentication due to new " - "configuration request failed: %d\n", - ret); - } - } - } -#if (MV8686_SUPPORT_ADHOC == 1) - - else if (priv->mode == IW_MODE_ADHOC) { - if (should_stop_adhoc(priv, assoc_req)) { - ret = lbs_adhoc_stop(priv); - if (ret) { - lbs_deb_assoc("Teardown of AdHoc network due to " - "new configuration request failed: %d\n", - ret); - } - - } - } -#endif - -#if (NEW_MV8686_PS == 0) - assoc_req->mode = priv->mode; -#else - /* Send the various configuration bits to the firmware */ - if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { - ret = assoc_helper_mode(priv, assoc_req); - if (ret) - goto out; - } -#endif - - if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) { - ret = assoc_helper_channel(priv, assoc_req); - if (ret) - goto out; - } - - if ( test_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags) - || test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) { - ret = assoc_helper_wep_keys(priv, assoc_req); - if (ret) - goto out; - } - - if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { - ret = assoc_helper_secinfo(priv, assoc_req); - if (ret) - goto out; - } - - if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) { - ret = assoc_helper_wpa_ie(priv, assoc_req); - if (ret) - goto out; - } - - if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags) - || test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { - ret = assoc_helper_wpa_keys(priv, assoc_req); - if (ret) - goto out; - } - - /* - * SSID/BSSID should be the _last_ config option set, because they - * trigger the association attempt. - */ - if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags) - || test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { - int success = 1; - -#if 0 - if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) - printk("%s: Trigger association due to BSSID FLAG.\n", __func__); - else - printk("%s: Trigger association due to ESSID FLAG.\n", __func__); -#endif - - ret = assoc_helper_associate(priv, assoc_req); - if (ret) { - lbs_deb_assoc("ASSOC: association unsuccessful: %d\n", - ret); - success = 0; - } - - if (priv->connect_status != LBS_CONNECTED) { - lbs_deb_assoc("ASSOC: association unsuccessful, not connected\n"); - success = 0; - } - - if (success) - { - lbs_deb_assoc("associated to %pM\n", priv->curbssparams.bssid); - lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, - CMD_OPTION_WAITFORRSP, 0, NULL); -#if (AUTO_REASSOC == 1) - if (priv->prev_assoc_req && priv->in_progress_assoc_req) - memcpy(priv->prev_assoc_req, priv->in_progress_assoc_req, - sizeof(struct assoc_request)); -#endif - } else { - ret = -1; - } - } - -out: - if (ret) { - lbs_deb_assoc("ASSOC: reconfiguration attempt unsuccessful: %d\n", - ret); - } - - mutex_lock(&priv->lock); - if (wep_assoc_retry == 1) - { - //printk("We are going to try association again.\n"); - wep_assoc_retry = 0; - mutex_unlock(&priv->lock); - goto tryagain; - } - priv->in_progress_assoc_req = NULL; - mutex_unlock(&priv->lock); - kfree(assoc_req); - -done: - atomic_set(&reassoc_flag, 0); - lbs_deb_leave(LBS_DEB_ASSOC); -} - - -/* - * Caller MUST hold any necessary locks - */ -struct assoc_request *lbs_get_association_request(struct lbs_private *priv) -{ - struct assoc_request * assoc_req; - - lbs_deb_enter(LBS_DEB_ASSOC); - if (!priv->pending_assoc_req) { - priv->pending_assoc_req = kzalloc(sizeof(struct assoc_request), - GFP_KERNEL); - if (!priv->pending_assoc_req) { - lbs_pr_info("Not enough memory to allocate association" - " request!\n"); - return NULL; - } - } - - /* Copy current configuration attributes to the association request, - * but don't overwrite any that are already set. - */ - assoc_req = priv->pending_assoc_req; - if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { - memcpy(&assoc_req->ssid, &priv->curbssparams.ssid, - IW_ESSID_MAX_SIZE); - assoc_req->ssid_len = priv->curbssparams.ssid_len; - } - - if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) - assoc_req->channel = priv->curbssparams.channel; - - if (!test_bit(ASSOC_FLAG_BAND, &assoc_req->flags)) - assoc_req->band = priv->curbssparams.band; - - if (!test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) - assoc_req->mode = priv->mode; - - if (!test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { - memcpy(&assoc_req->bssid, priv->curbssparams.bssid, - ETH_ALEN); - } - - if (!test_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags)) { - int i; - for (i = 0; i < 4; i++) { - memcpy(&assoc_req->wep_keys[i], &priv->wep_keys[i], - sizeof(struct enc_key)); - } - } - - if (!test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) - assoc_req->wep_tx_keyidx = priv->wep_tx_keyidx; - - if (!test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags)) { - memcpy(&assoc_req->wpa_mcast_key, &priv->wpa_mcast_key, - sizeof(struct enc_key)); - } - - if (!test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { - memcpy(&assoc_req->wpa_unicast_key, &priv->wpa_unicast_key, - sizeof(struct enc_key)); - } - - if (!test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { - memcpy(&assoc_req->secinfo, &priv->secinfo, - sizeof(struct lbs_802_11_security)); - //printk("111assoc_req->secinfo.auth_mode=%d\n", assoc_req->secinfo.auth_mode); - } - - if (!test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) { - memcpy(&assoc_req->wpa_ie, &priv->wpa_ie, - MAX_WPA_IE_LEN); - assoc_req->wpa_ie_len = priv->wpa_ie_len; - } - - lbs_deb_leave(LBS_DEB_ASSOC); - return assoc_req; -} - - -/** - * @brief This function prepares command of authenticate. - * - * @param priv A pointer to struct lbs_private structure - * @param cmd A pointer to cmd_ds_command structure - * @param pdata_buf Void cast of pointer to a BSSID to authenticate with - * - * @return 0 or -1 - */ -int lbs_cmd_80211_authenticate(struct lbs_private *priv, - struct cmd_ds_command *cmd, - void *pdata_buf) -{ - struct cmd_ds_802_11_authenticate *pauthenticate = &cmd->params.auth; - int ret = -1; - u8 *bssid = pdata_buf; - - lbs_deb_enter(LBS_DEB_JOIN); - - cmd->command = cpu_to_le16(CMD_802_11_AUTHENTICATE); - cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_authenticate) - + S_DS_GEN); - - /* translate auth mode to 802.11 defined wire value */ - switch (priv->secinfo.auth_mode) { - case IW_AUTH_ALG_OPEN_SYSTEM: - pauthenticate->authtype = 0x00; - break; - case IW_AUTH_ALG_SHARED_KEY: - pauthenticate->authtype = 0x01; - break; - case IW_AUTH_ALG_LEAP: - pauthenticate->authtype = 0x80; - break; - default: - lbs_deb_join("AUTH_CMD: invalid auth alg 0x%X\n", - priv->secinfo.auth_mode); - goto out; - } - - memcpy(pauthenticate->macaddr, bssid, ETH_ALEN); - - lbs_deb_join("AUTH_CMD: BSSID %pM, auth 0x%x\n", - bssid, pauthenticate->authtype); - ret = 0; - -out: - lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); - return ret; -} - -/** - * @brief Deauthenticate from a specific BSS - * - * @param priv A pointer to struct lbs_private structure - * @param bssid The specific BSS to deauthenticate from - * @param reason The 802.11 sec. 7.3.1.7 Reason Code for deauthenticating - * - * @return 0 on success, error on failure - */ -int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, u8 bssid[ETH_ALEN], - u16 reason) -{ - struct cmd_ds_802_11_deauthenticate cmd; - int ret; - - printk("%s: enter...\n", __func__); - - lbs_deb_enter(LBS_DEB_JOIN); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - memcpy(cmd.macaddr, &bssid[0], ETH_ALEN); - cmd.reasoncode = cpu_to_le16(reason); - - ret = lbs_cmd_with_response(priv, CMD_802_11_DEAUTHENTICATE, &cmd); - - /* - * Clean up everything even if there was an error; can't assume that - * we're still authenticated to the AP after trying to deauth. - */ - if ((atomic_read(&reassoc_flag) == 1) || - (priv->connect_status == LBS_DISCONNECTED)) - { - printk("Needn't send disconnected event for association.\n"); - return ret; - } - else - lbs_mac_event_disconnected(priv); - - lbs_deb_leave(LBS_DEB_JOIN); - - return ret; -} - -int lbs_cmd_80211_associate(struct lbs_private *priv, - struct cmd_ds_command *cmd, void *pdata_buf) -{ - struct cmd_ds_802_11_associate *passo = &cmd->params.associate; - int ret = 0; - struct assoc_request *assoc_req = pdata_buf; - struct bss_descriptor *bss = &assoc_req->bss; - u8 *pos; - u16 tmpcap, tmplen; - struct mrvlietypes_ssidparamset *ssid; - struct mrvlietypes_phyparamset *phy; - struct mrvlietypes_ssparamset *ss; - struct mrvlietypes_ratesparamset *rates; - struct mrvlietypes_rsnparamset *rsn; - - lbs_deb_enter(LBS_DEB_ASSOC); - - pos = (u8 *) passo; - - if (!priv) { - ret = -1; - goto done; - } - - cmd->command = cpu_to_le16(CMD_802_11_ASSOCIATE); - - memcpy(passo->peerstaaddr, bss->bssid, sizeof(passo->peerstaaddr)); - pos += sizeof(passo->peerstaaddr); - - /* set the listen interval */ - passo->listeninterval = cpu_to_le16(MRVDRV_DEFAULT_LISTEN_INTERVAL); - - pos += sizeof(passo->capability); - pos += sizeof(passo->listeninterval); - pos += sizeof(passo->bcnperiod); - pos += sizeof(passo->dtimperiod); - - ssid = (struct mrvlietypes_ssidparamset *) pos; - ssid->header.type = cpu_to_le16(TLV_TYPE_SSID); - tmplen = bss->ssid_len; - ssid->header.len = cpu_to_le16(tmplen); - memcpy(ssid->ssid, bss->ssid, tmplen); - pos += sizeof(ssid->header) + tmplen; - - phy = (struct mrvlietypes_phyparamset *) pos; - phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS); - tmplen = sizeof(phy->fh_ds.dsparamset); - phy->header.len = cpu_to_le16(tmplen); - memcpy(&phy->fh_ds.dsparamset, - &bss->phyparamset.dsparamset.currentchan, - tmplen); - pos += sizeof(phy->header) + tmplen; - - ss = (struct mrvlietypes_ssparamset *) pos; - ss->header.type = cpu_to_le16(TLV_TYPE_CF); - tmplen = sizeof(ss->cf_ibss.cfparamset); - ss->header.len = cpu_to_le16(tmplen); - pos += sizeof(ss->header) + tmplen; - - rates = (struct mrvlietypes_ratesparamset *) pos; - rates->header.type = cpu_to_le16(TLV_TYPE_RATES); - memcpy(&rates->rates, &bss->rates, MAX_RATES); - tmplen = MAX_RATES; - if (get_common_rates(priv, rates->rates, &tmplen)) { - ret = -1; - goto done; - } - pos += sizeof(rates->header) + tmplen; - rates->header.len = cpu_to_le16(tmplen); - lbs_deb_assoc("ASSOC_CMD: num rates %u\n", tmplen); - - /* Copy the infra. association rates into Current BSS state structure */ - memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates)); - memcpy(&priv->curbssparams.rates, &rates->rates, tmplen); - - /* Set MSB on basic rates as the firmware requires, but _after_ - * copying to current bss rates. - */ - lbs_set_basic_rate_flags(rates->rates, tmplen); - - if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { - rsn = (struct mrvlietypes_rsnparamset *) pos; - /* WPA_IE or WPA2_IE */ - rsn->header.type = cpu_to_le16((u16) assoc_req->wpa_ie[0]); - tmplen = (u16) assoc_req->wpa_ie[1]; - rsn->header.len = cpu_to_le16(tmplen); - memcpy(rsn->rsnie, &assoc_req->wpa_ie[2], tmplen); - lbs_deb_hex(LBS_DEB_JOIN, "ASSOC_CMD: RSN IE", (u8 *) rsn, - sizeof(rsn->header) + tmplen); - pos += sizeof(rsn->header) + tmplen; - } - - /* update curbssparams */ - priv->curbssparams.channel = bss->phyparamset.dsparamset.currentchan; - - if (lbs_parse_dnld_countryinfo_11d(priv, bss)) { - ret = -1; - goto done; - } - - cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN); - - /* set the capability info */ - tmpcap = (bss->capability & CAPINFO_MASK); - if (bss->mode == IW_MODE_INFRA) - tmpcap |= WLAN_CAPABILITY_ESS; - passo->capability = cpu_to_le16(tmpcap); - lbs_deb_assoc("ASSOC_CMD: capability 0x%04x\n", tmpcap); - -done: - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - -static inline void lbs_postpone_association_work2(struct lbs_private *priv) -{ - //if (priv->surpriseremoved) - // return; - //cancel_delayed_work(&priv->assoc_work); - queue_delayed_work(priv->work_thread, &priv->assoc_work, HZ / 2); -} - -int lbs_ret_80211_associate(struct lbs_private *priv, - struct cmd_ds_command *resp) -{ - int ret = 0; - union iwreq_data wrqu; - struct ieeetypes_assocrsp *passocrsp; - struct bss_descriptor *bss; - u16 status_code; - - lbs_deb_enter(LBS_DEB_ASSOC); - - if (!priv->in_progress_assoc_req) { - lbs_deb_assoc("ASSOC_RESP: no in-progress assoc request\n"); - ret = -1; - goto done; - } - bss = &priv->in_progress_assoc_req->bss; - - passocrsp = (struct ieeetypes_assocrsp *) &resp->params; - - /* - * Older FW versions map the IEEE 802.11 Status Code in the association - * response to the following values returned in passocrsp->statuscode: - * - * IEEE Status Code Marvell Status Code - * 0 -> 0x0000 ASSOC_RESULT_SUCCESS - * 13 -> 0x0004 ASSOC_RESULT_AUTH_REFUSED - * 14 -> 0x0004 ASSOC_RESULT_AUTH_REFUSED - * 15 -> 0x0004 ASSOC_RESULT_AUTH_REFUSED - * 16 -> 0x0004 ASSOC_RESULT_AUTH_REFUSED - * others -> 0x0003 ASSOC_RESULT_REFUSED - * - * Other response codes: - * 0x0001 -> ASSOC_RESULT_INVALID_PARAMETERS (unused) - * 0x0002 -> ASSOC_RESULT_TIMEOUT (internal timer expired waiting for - * association response from the AP) - */ - - status_code = le16_to_cpu(passocrsp->statuscode); - switch (status_code) { - case 0x00: - break; - case 0x01: - lbs_deb_assoc("ASSOC_RESP: invalid parameters\n"); - //printk("ASSOC_RESP: invalid parameters\n"); - break; - case 0x02: - printk("ASSOC_RESP: internal timer expired while waiting for the AP\n"); - break; - case 0x03: - lbs_deb_assoc("ASSOC_RESP: association refused by AP\n"); - break; - case 0x04: - lbs_deb_assoc("ASSOC_RESP: authentication refused by AP\n"); - break; - default: - lbs_deb_assoc("ASSOC_RESP: failure reason 0x%02x unknown\n", status_code); - break; - } - - if (status_code) - { - struct assoc_request * assoc_req = NULL; - - //printk("Key mgmt: %d\n", priv->in_progress_assoc_req->secinfo.key_mgmt); - //printk("auth mode: %d\n", priv->in_progress_assoc_req->secinfo.auth_mode); - -//#if (NEW_MV8686_PS == 1) -#if 0 - if ((status_code == 0x02) && (priv->associate_retry < 10)) - { - priv->associate_retry++; - ret = RET_ASSOC_RETRY; - goto done; - } - else - priv->associate_retry = 0; -#endif - if ((wep_assoc_retry == 0) && - (priv->in_progress_assoc_req->secinfo.key_mgmt == 0) && - (priv->in_progress_assoc_req->secinfo.auth_mode == 2)) - { - //printk("Need to restart associate for WEP.\n"); - //mutex_lock(&priv->lock); - wep_assoc_retry = 1; - priv->in_progress_assoc_req->secinfo.auth_mode = 1; - assoc_req = priv->in_progress_assoc_req; - priv->pending_assoc_req = assoc_req; - priv->in_progress_assoc_req = NULL; - //mutex_unlock(&priv->lock); - //lbs_postpone_association_work2(priv); - } - else - { - printk("%s: association fail.status_code=%d\n", __func__, status_code); - lbs_mac_event_disconnected(priv); - ret = -1; - } - goto done; - } - - wep_assoc_retry = 0; - -#if (NEW_MV8686_PS == 1) - priv->associate_retry = 0; -#endif - - lbs_deb_hex(LBS_DEB_ASSOC, "ASSOC_RESP", (void *)&resp->params, - le16_to_cpu(resp->size) - S_DS_GEN); - - /* - * Send a Media Connected event, according to the Spec. - */ - printk("%s: association successfully.\n", __func__); - priv->connect_status = LBS_CONNECTED; - -#if (NEW_MV8686_PS == 1) - /* - * Add a timer to check previous association status. - */ - priv->need_reassoc = 0; - mod_timer(&priv->disconnect_timer, jiffies + msecs_to_jiffies(8 * 1000)); -#endif - - /* Update current SSID and BSSID */ - memcpy(&priv->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); - priv->curbssparams.ssid_len = bss->ssid_len; - memcpy(priv->curbssparams.bssid, bss->bssid, ETH_ALEN); - - priv->SNR[TYPE_RXPD][TYPE_AVG] = 0; - priv->NF[TYPE_RXPD][TYPE_AVG] = 0; - - memset(priv->rawSNR, 0x00, sizeof(priv->rawSNR)); - memset(priv->rawNF, 0x00, sizeof(priv->rawNF)); - priv->nextSNRNF = 0; - priv->numSNRNF = 0; - - netif_carrier_on(priv->dev); - if (!priv->tx_pending_len) - netif_wake_queue(priv->dev); - - memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); - -done: - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - -#if (MV8686_SUPPORT_ADHOC == 1) -static int lbs_adhoc_post(struct lbs_private *priv, struct cmd_header *resp) -{ - int ret = 0; - u16 command = le16_to_cpu(resp->command); - u16 result = le16_to_cpu(resp->result); - struct cmd_ds_802_11_ad_hoc_result *adhoc_resp; - union iwreq_data wrqu; - struct bss_descriptor *bss; - DECLARE_SSID_BUF(ssid); - - lbs_deb_enter(LBS_DEB_JOIN); - - adhoc_resp = (struct cmd_ds_802_11_ad_hoc_result *) resp; - - if (!priv->in_progress_assoc_req) { - lbs_deb_join("ADHOC_RESP: no in-progress association " - "request\n"); - ret = -1; - goto done; - } - bss = &priv->in_progress_assoc_req->bss; - - /* - * Join result code 0 --> SUCCESS - */ - if (result) { - lbs_deb_join("ADHOC_RESP: failed (result 0x%X)\n", result); - if (priv->connect_status == LBS_CONNECTED) - lbs_mac_event_disconnected(priv); - ret = -1; - goto done; - } - - /* Send a Media Connected event, according to the Spec */ - priv->connect_status = LBS_CONNECTED; - - if (command == CMD_RET(CMD_802_11_AD_HOC_START)) { - /* Update the created network descriptor with the new BSSID */ - memcpy(bss->bssid, adhoc_resp->bssid, ETH_ALEN); - } - - /* Set the BSSID from the joined/started descriptor */ - memcpy(&priv->curbssparams.bssid, bss->bssid, ETH_ALEN); - - /* Set the new SSID to current SSID */ - memcpy(&priv->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); - priv->curbssparams.ssid_len = bss->ssid_len; - - netif_carrier_on(priv->dev); - if (!priv->tx_pending_len) - netif_wake_queue(priv->dev); - - memset(&wrqu, 0, sizeof(wrqu)); - memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); - - lbs_deb_join("ADHOC_RESP: Joined/started '%s', BSSID %pM, channel %d\n", - mv8686_print_ssid(ssid, bss->ssid, bss->ssid_len), - priv->curbssparams.bssid, - priv->curbssparams.channel); - -done: - lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); - return ret; -} -#endif - diff --git a/drivers/net/wireless/mv8686/assoc.h b/drivers/net/wireless/mv8686/assoc.h deleted file mode 100755 index ef63aa81658a..000000000000 --- a/drivers/net/wireless/mv8686/assoc.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2006, Red Hat, Inc. */ - -#ifndef _LBS_ASSOC_H_ -#define _LBS_ASSOC_H_ - -#include "dev.h" - -void lbs_association_worker(struct work_struct *work); -struct assoc_request *lbs_get_association_request(struct lbs_private *priv); - -struct cmd_ds_command; -int lbs_cmd_80211_authenticate(struct lbs_private *priv, - struct cmd_ds_command *cmd, - void *pdata_buf); - -#if (MV8686_SUPPORT_ADHOC == 1) -int lbs_adhoc_stop(struct lbs_private *priv); -int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, - struct cmd_ds_command *resp); -#endif - -int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, - u8 bssid[ETH_ALEN], u16 reason); -int lbs_cmd_80211_associate(struct lbs_private *priv, - struct cmd_ds_command *cmd, - void *pdata_buf); - -int lbs_ret_80211_associate(struct lbs_private *priv, - struct cmd_ds_command *resp); - -#endif /* _LBS_ASSOC_H */ diff --git a/drivers/net/wireless/mv8686/cmd.c b/drivers/net/wireless/mv8686/cmd.c deleted file mode 100755 index afe5080a84f9..000000000000 --- a/drivers/net/wireless/mv8686/cmd.c +++ /dev/null @@ -1,2158 +0,0 @@ -/** - * This file contains the handling of command. - * It prepares command and sends it to firmware when it is ready. - */ - -#include -#include "lib80211.h" -#include -#include "host.h" -#include "hostcmd.h" -#include "decl.h" -#include "defs.h" -#include "dev.h" -#include "assoc.h" -#include "wext.h" -#include "cmd.h" - -static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv); - -/** - * @brief Simple callback that copies response back into command - * - * @param priv A pointer to struct lbs_private structure - * @param extra A pointer to the original command structure for which - * 'resp' is a response - * @param resp A pointer to the command response - * - * @return 0 on success, error on failure - */ -int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra, - struct cmd_header *resp) -{ - struct cmd_header *buf = (void *)extra; - uint16_t copy_len; - - copy_len = min(le16_to_cpu(buf->size), le16_to_cpu(resp->size)); - memcpy(buf, resp, copy_len); - return 0; -} -EXPORT_SYMBOL_GPL(lbs_cmd_copyback); - -/** - * @brief Simple callback that ignores the result. Use this if - * you just want to send a command to the hardware, but don't - * care for the result. - * - * @param priv ignored - * @param extra ignored - * @param resp ignored - * - * @return 0 for success - */ -static int lbs_cmd_async_callback(struct lbs_private *priv, unsigned long extra, - struct cmd_header *resp) -{ - return 0; -} - - -/** - * @brief Checks whether a command is allowed in Power Save mode - * - * @param command the command ID - * @return 1 if allowed, 0 if not allowed - */ -static u8 is_command_allowed_in_ps(u16 cmd) -{ - switch (cmd) { - case CMD_802_11_RSSI: - return 1; - default: - break; - } - return 0; -} - -/* - * @brief Updates the hardware details like MAC address and regulatory region - * - * @param priv A pointer to struct lbs_private structure - * - * @return 0 on success, error on failure - */ -int lbs_update_hw_spec(struct lbs_private *priv) -{ - struct cmd_ds_get_hw_spec cmd; - int ret = -1; - u32 i; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - memcpy(cmd.permanentaddr, priv->current_addr, ETH_ALEN); - ret = lbs_cmd_with_response(priv, CMD_GET_HW_SPEC, &cmd); - if (ret) - goto out; - - priv->fwcapinfo = le32_to_cpu(cmd.fwcapinfo); - - /* The firmware release is in an interesting format: the patch - * level is in the most significant nibble ... so fix that: */ - priv->fwrelease = le32_to_cpu(cmd.fwrelease); - priv->fwrelease = (priv->fwrelease << 8) | - (priv->fwrelease >> 24 & 0xff); - - /* Clamp region code to 8-bit since FW spec indicates that it should - * only ever be 8-bit, even though the field size is 16-bit. Some firmware - * returns non-zero high 8 bits here. - */ - priv->regioncode = le16_to_cpu(cmd.regioncode) & 0xFF; - - /* Some firmware capabilities: - * CF card firmware 5.0.16p0: cap 0x00000303 - * USB dongle firmware 5.110.17p2: cap 0x00000303 - */ - lbs_pr_info("%pM, fw %u.%u.%up%u, cap 0x%08x region 0x%x\n", - cmd.permanentaddr, - priv->fwrelease >> 24 & 0xff, - priv->fwrelease >> 16 & 0xff, - priv->fwrelease >> 8 & 0xff, - priv->fwrelease & 0xff, - priv->fwcapinfo, priv->regioncode); - lbs_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n", - cmd.hwifversion, cmd.version); - - for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) - { - /* use the region code to search for the index */ - if (priv->regioncode == lbs_region_code_to_index[i]) - break; - } - - /* if it's unidentified region code, use the default (USA) */ - if (i >= MRVDRV_MAX_REGION_CODE) { - priv->regioncode = 0x10; - lbs_pr_info("unidentified region code; using the default (USA)\n"); - } - - /* Yongle, set default regioncode 0x10=USA. */ - priv->regioncode = 0x10; - - if (priv->current_addr[0] == 0xff) - memmove(priv->current_addr, cmd.permanentaddr, ETH_ALEN); - - memcpy(priv->dev->dev_addr, priv->current_addr, ETH_ALEN); - - if (lbs_set_regiontable(priv, priv->regioncode, 0)) { - ret = -1; - goto out; - } - - if (lbs_set_universaltable(priv, 0)) { - ret = -1; - goto out; - } - -out: - lbs_deb_leave(LBS_DEB_CMD); - return ret; -} - -int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, - struct wol_config *p_wol_config) -{ - struct cmd_ds_host_sleep cmd_config; - int ret; - - cmd_config.hdr.size = cpu_to_le16(sizeof(cmd_config)); - cmd_config.criteria = cpu_to_le32(criteria); - cmd_config.gpio = priv->wol_gpio; - cmd_config.gap = priv->wol_gap; - - if (p_wol_config != NULL) - memcpy((uint8_t *)&cmd_config.wol_conf, (uint8_t *)p_wol_config, - sizeof(struct wol_config)); - else - cmd_config.wol_conf.action = CMD_ACT_ACTION_NONE; - - ret = lbs_cmd_with_response(priv, CMD_802_11_HOST_SLEEP_CFG, &cmd_config); - if (!ret) { - if (criteria) { - lbs_deb_cmd("Set WOL criteria to %x\n", criteria); - priv->wol_criteria = criteria; - } else - memcpy((uint8_t *) p_wol_config, - (uint8_t *)&cmd_config.wol_conf, - sizeof(struct wol_config)); - } else { - lbs_pr_info("HOST_SLEEP_CFG failed %d\n", ret); - } - - return ret; -} -EXPORT_SYMBOL_GPL(lbs_host_sleep_cfg); - -static int lbs_cmd_802_11_ps_mode(struct cmd_ds_command *cmd, - u16 cmd_action) -{ - struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode; - - lbs_deb_enter(LBS_DEB_CMD); - - cmd->command = cpu_to_le16(CMD_802_11_PS_MODE); - cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ps_mode) + - S_DS_GEN); - psm->action = cpu_to_le16(cmd_action); - psm->multipledtim = 0; - switch (cmd_action) { - case CMD_SUBCMD_ENTER_PS: - lbs_deb_cmd("PS command:" "SubCode- Enter PS\n"); - - psm->locallisteninterval = 0; - psm->nullpktinterval = 0; - psm->multipledtim = - cpu_to_le16(MRVDRV_DEFAULT_MULTIPLE_DTIM); - break; - - case CMD_SUBCMD_EXIT_PS: - lbs_deb_cmd("PS command:" "SubCode- Exit PS\n"); - break; - - case CMD_SUBCMD_SLEEP_CONFIRMED: - lbs_deb_cmd("PS command: SubCode- sleep confirm\n"); - break; - - default: - break; - } - - lbs_deb_leave(LBS_DEB_CMD); - return 0; -} - -int lbs_cmd_802_11_inactivity_timeout(struct lbs_private *priv, - uint16_t cmd_action, uint16_t *timeout) -{ - struct cmd_ds_802_11_inactivity_timeout cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CMD); - - cmd.hdr.command = cpu_to_le16(CMD_802_11_INACTIVITY_TIMEOUT); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - - cmd.action = cpu_to_le16(cmd_action); - - if (cmd_action == CMD_ACT_SET) - cmd.timeout = cpu_to_le16(*timeout); - else - cmd.timeout = 0; - - ret = lbs_cmd_with_response(priv, CMD_802_11_INACTIVITY_TIMEOUT, &cmd); - - if (!ret) - *timeout = le16_to_cpu(cmd.timeout); - - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return 0; -} - -int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, - struct sleep_params *sp) -{ - struct cmd_ds_802_11_sleep_params cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CMD); - - if (cmd_action == CMD_ACT_GET) { - memset(&cmd, 0, sizeof(cmd)); - } else { - cmd.error = cpu_to_le16(sp->sp_error); - cmd.offset = cpu_to_le16(sp->sp_offset); - cmd.stabletime = cpu_to_le16(sp->sp_stabletime); - cmd.calcontrol = sp->sp_calcontrol; - cmd.externalsleepclk = sp->sp_extsleepclk; - cmd.reserved = cpu_to_le16(sp->sp_reserved); - } - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(cmd_action); - - ret = lbs_cmd_with_response(priv, CMD_802_11_SLEEP_PARAMS, &cmd); - - if (!ret) { - lbs_deb_cmd("error 0x%x, offset 0x%x, stabletime 0x%x, " - "calcontrol 0x%x extsleepclk 0x%x\n", - le16_to_cpu(cmd.error), le16_to_cpu(cmd.offset), - le16_to_cpu(cmd.stabletime), cmd.calcontrol, - cmd.externalsleepclk); - - sp->sp_error = le16_to_cpu(cmd.error); - sp->sp_offset = le16_to_cpu(cmd.offset); - sp->sp_stabletime = le16_to_cpu(cmd.stabletime); - sp->sp_calcontrol = cmd.calcontrol; - sp->sp_extsleepclk = cmd.externalsleepclk; - sp->sp_reserved = le16_to_cpu(cmd.reserved); - } - - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return 0; -} - -int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action, - struct assoc_request *assoc) -{ - struct cmd_ds_802_11_set_wep cmd; - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.command = cpu_to_le16(CMD_802_11_SET_WEP); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - - cmd.action = cpu_to_le16(cmd_action); - - if (cmd_action == CMD_ACT_ADD) { - int i; - - /* default tx key index */ - cmd.keyindex = cpu_to_le16(assoc->wep_tx_keyidx & - CMD_WEP_KEY_INDEX_MASK); - - /* Copy key types and material to host command structure */ - for (i = 0; i < 4; i++) { - struct enc_key *pkey = &assoc->wep_keys[i]; - - switch (pkey->len) { - case KEY_LEN_WEP_40: - cmd.keytype[i] = CMD_TYPE_WEP_40_BIT; - memmove(cmd.keymaterial[i], pkey->key, pkey->len); - lbs_deb_cmd("SET_WEP: add key %d (40 bit)\n", i); - break; - case KEY_LEN_WEP_104: - cmd.keytype[i] = CMD_TYPE_WEP_104_BIT; - memmove(cmd.keymaterial[i], pkey->key, pkey->len); - lbs_deb_cmd("SET_WEP: add key %d (104 bit)\n", i); - break; - case 0: - break; - default: - lbs_deb_cmd("SET_WEP: invalid key %d, length %d\n", - i, pkey->len); - ret = -1; - goto done; - break; - } - } - } else if (cmd_action == CMD_ACT_REMOVE) { - /* ACT_REMOVE clears _all_ WEP keys */ - - /* default tx key index */ - cmd.keyindex = cpu_to_le16(priv->wep_tx_keyidx & - CMD_WEP_KEY_INDEX_MASK); - lbs_deb_cmd("SET_WEP: remove key %d\n", priv->wep_tx_keyidx); - } - - ret = lbs_cmd_with_response(priv, CMD_802_11_SET_WEP, &cmd); -done: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action, - uint16_t *enable) -{ - struct cmd_ds_802_11_enable_rsn cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CMD); - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(cmd_action); - - if (cmd_action == CMD_ACT_GET) - cmd.enable = 0; - else { - if (*enable) - cmd.enable = cpu_to_le16(CMD_ENABLE_RSN); - else - cmd.enable = cpu_to_le16(CMD_DISABLE_RSN); - lbs_deb_cmd("ENABLE_RSN: %d\n", *enable); - } - - ret = lbs_cmd_with_response(priv, CMD_802_11_ENABLE_RSN, &cmd); - if (!ret && cmd_action == CMD_ACT_GET) - *enable = le16_to_cpu(cmd.enable); - - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -static void set_one_wpa_key(struct MrvlIEtype_keyParamSet *keyparam, - struct enc_key *key) -{ - lbs_deb_enter(LBS_DEB_CMD); - - if (key->flags & KEY_INFO_WPA_ENABLED) - keyparam->keyinfo |= cpu_to_le16(KEY_INFO_WPA_ENABLED); - if (key->flags & KEY_INFO_WPA_UNICAST) - keyparam->keyinfo |= cpu_to_le16(KEY_INFO_WPA_UNICAST); - if (key->flags & KEY_INFO_WPA_MCAST) - keyparam->keyinfo |= cpu_to_le16(KEY_INFO_WPA_MCAST); - - keyparam->type = cpu_to_le16(TLV_TYPE_KEY_MATERIAL); - keyparam->keytypeid = cpu_to_le16(key->type); - keyparam->keylen = cpu_to_le16(key->len); - memcpy(keyparam->key, key->key, key->len); - - /* Length field doesn't include the {type,length} header */ - keyparam->length = cpu_to_le16(sizeof(*keyparam) - 4); - lbs_deb_leave(LBS_DEB_CMD); -} - -int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action, - struct assoc_request *assoc) -{ - struct cmd_ds_802_11_key_material cmd; - int ret = 0; - int index = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - cmd.action = cpu_to_le16(cmd_action); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - - if (cmd_action == CMD_ACT_GET) { - cmd.hdr.size = cpu_to_le16(S_DS_GEN + 2); - } else { - memset(cmd.keyParamSet, 0, sizeof(cmd.keyParamSet)); - - if (test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc->flags)) { - set_one_wpa_key(&cmd.keyParamSet[index], - &assoc->wpa_unicast_key); - index++; - } - - if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc->flags)) { - set_one_wpa_key(&cmd.keyParamSet[index], - &assoc->wpa_mcast_key); - index++; - } - - /* The common header and as many keys as we included */ - cmd.hdr.size = cpu_to_le16(offsetof(typeof(cmd), - keyParamSet[index])); - } - ret = lbs_cmd_with_response(priv, CMD_802_11_KEY_MATERIAL, &cmd); - /* Copy the returned key to driver private data */ - if (!ret && cmd_action == CMD_ACT_GET) { - void *buf_ptr = cmd.keyParamSet; - void *resp_end = &(&cmd)[1]; - - while (buf_ptr < resp_end) { - struct MrvlIEtype_keyParamSet *keyparam = buf_ptr; - struct enc_key *key; - uint16_t param_set_len = le16_to_cpu(keyparam->length); - uint16_t key_len = le16_to_cpu(keyparam->keylen); - uint16_t key_flags = le16_to_cpu(keyparam->keyinfo); - uint16_t key_type = le16_to_cpu(keyparam->keytypeid); - void *end; - - end = (void *)keyparam + sizeof(keyparam->type) - + sizeof(keyparam->length) + param_set_len; - - /* Make sure we don't access past the end of the IEs */ - if (end > resp_end) - break; - - if (key_flags & KEY_INFO_WPA_UNICAST) - key = &priv->wpa_unicast_key; - else if (key_flags & KEY_INFO_WPA_MCAST) - key = &priv->wpa_mcast_key; - else - break; - - /* Copy returned key into driver */ - memset(key, 0, sizeof(struct enc_key)); - if (key_len > sizeof(key->key)) - break; - key->type = key_type; - key->flags = key_flags; - key->len = key_len; - memcpy(key->key, keyparam->key, key->len); - - buf_ptr = end + 1; - } - } - - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -/** - * @brief Set an SNMP MIB value - * - * @param priv A pointer to struct lbs_private structure - * @param oid The OID to set in the firmware - * @param val Value to set the OID to - * - * @return 0 on success, error on failure - */ -int lbs_set_snmp_mib(struct lbs_private *priv, u32 oid, u16 val) -{ - struct cmd_ds_802_11_snmp_mib cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof (cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - cmd.oid = cpu_to_le16((u16) oid); - - switch (oid) { - case SNMP_MIB_OID_BSS_TYPE: - cmd.bufsize = cpu_to_le16(sizeof(u8)); - cmd.value[0] = (val == IW_MODE_ADHOC) ? 2 : 1; - break; - case SNMP_MIB_OID_11D_ENABLE: - case SNMP_MIB_OID_FRAG_THRESHOLD: - case SNMP_MIB_OID_RTS_THRESHOLD: - case SNMP_MIB_OID_SHORT_RETRY_LIMIT: - case SNMP_MIB_OID_LONG_RETRY_LIMIT: - cmd.bufsize = cpu_to_le16(sizeof(u16)); - *((__le16 *)(&cmd.value)) = cpu_to_le16(val); - break; - default: - lbs_deb_cmd("SNMP_CMD: (set) unhandled OID 0x%x\n", oid); - ret = -EINVAL; - goto out; - } - - lbs_deb_cmd("SNMP_CMD: (set) oid 0x%x, oid size 0x%x, value 0x%x\n", - le16_to_cpu(cmd.oid), le16_to_cpu(cmd.bufsize), val); - - ret = lbs_cmd_with_response(priv, CMD_802_11_SNMP_MIB, &cmd); - -out: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -/** - * @brief Get an SNMP MIB value - * - * @param priv A pointer to struct lbs_private structure - * @param oid The OID to retrieve from the firmware - * @param out_val Location for the returned value - * - * @return 0 on success, error on failure - */ -int lbs_get_snmp_mib(struct lbs_private *priv, u32 oid, u16 *out_val) -{ - struct cmd_ds_802_11_snmp_mib cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof (cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_GET); - cmd.oid = cpu_to_le16(oid); - - ret = lbs_cmd_with_response(priv, CMD_802_11_SNMP_MIB, &cmd); - if (ret) - goto out; - - switch (le16_to_cpu(cmd.bufsize)) { - case sizeof(u8): - if (oid == SNMP_MIB_OID_BSS_TYPE) { - if (cmd.value[0] == 2) - *out_val = IW_MODE_ADHOC; - else - *out_val = IW_MODE_INFRA; - } else - *out_val = cmd.value[0]; - break; - case sizeof(u16): - *out_val = le16_to_cpu(*((__le16 *)(&cmd.value))); - break; - default: - lbs_deb_cmd("SNMP_CMD: (get) unhandled OID 0x%x size %d\n", - oid, le16_to_cpu(cmd.bufsize)); - break; - } - -out: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -/** - * @brief Get the min, max, and current TX power - * - * @param priv A pointer to struct lbs_private structure - * @param curlevel Current power level in dBm - * @param minlevel Minimum supported power level in dBm (optional) - * @param maxlevel Maximum supported power level in dBm (optional) - * - * @return 0 on success, error on failure - */ -int lbs_get_tx_power(struct lbs_private *priv, s16 *curlevel, s16 *minlevel, - s16 *maxlevel) -{ - struct cmd_ds_802_11_rf_tx_power cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_GET); - - ret = lbs_cmd_with_response(priv, CMD_802_11_RF_TX_POWER, &cmd); - if (ret == 0) { - *curlevel = le16_to_cpu(cmd.curlevel); - if (minlevel) - *minlevel = cmd.minlevel; - if (maxlevel) - *maxlevel = cmd.maxlevel; - } - - lbs_deb_leave(LBS_DEB_CMD); - return ret; -} - -#if (NEW_MV8686_PS == 0) -int mv8686_set_mode(struct lbs_private *priv, u8 new_mode) -{ - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - if (new_mode == priv->mode) - goto done; - - if (new_mode == IW_MODE_INFRA) - { - if (priv->psstate != PS_STATE_FULL_POWER) - lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); - priv->psmode = LBS802_11POWERMODECAM; - } - - priv->mode = new_mode; - ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, new_mode); - -done: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - - return ret; -} -#endif - -/** - * @brief Set the TX power - * - * @param priv A pointer to struct lbs_private structure - * @param dbm The desired power level in dBm - * - * @return 0 on success, error on failure - */ -int lbs_set_tx_power(struct lbs_private *priv, s16 dbm) -{ - struct cmd_ds_802_11_rf_tx_power cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - cmd.curlevel = cpu_to_le16(dbm); - - lbs_deb_cmd("SET_RF_TX_POWER: %d dBm\n", dbm); - - ret = lbs_cmd_with_response(priv, CMD_802_11_RF_TX_POWER, &cmd); - - lbs_deb_leave(LBS_DEB_CMD); - return ret; -} - -static int lbs_cmd_802_11_monitor_mode(struct cmd_ds_command *cmd, - u16 cmd_action, void *pdata_buf) -{ - struct cmd_ds_802_11_monitor_mode *monitor = &cmd->params.monitor; - - cmd->command = cpu_to_le16(CMD_802_11_MONITOR_MODE); - cmd->size = - cpu_to_le16(sizeof(struct cmd_ds_802_11_monitor_mode) + - S_DS_GEN); - - monitor->action = cpu_to_le16(cmd_action); - if (cmd_action == CMD_ACT_SET) { - monitor->mode = - cpu_to_le16((u16) (*(u32 *) pdata_buf)); - } - - return 0; -} - -static __le16 lbs_rate_to_fw_bitmap(int rate, int lower_rates_ok) -{ -/* Bit Rate -* 15:13 Reserved -* 12 54 Mbps -* 11 48 Mbps -* 10 36 Mbps -* 9 24 Mbps -* 8 18 Mbps -* 7 12 Mbps -* 6 9 Mbps -* 5 6 Mbps -* 4 Reserved -* 3 11 Mbps -* 2 5.5 Mbps -* 1 2 Mbps -* 0 1 Mbps -**/ - - uint16_t ratemask; - int i = lbs_data_rate_to_fw_index(rate); - if (lower_rates_ok) - ratemask = (0x1fef >> (12 - i)); - else - ratemask = (1 << i); - return cpu_to_le16(ratemask); -} - -int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv, - uint16_t cmd_action) -{ - struct cmd_ds_802_11_rate_adapt_rateset cmd; - int ret; - - lbs_deb_enter(LBS_DEB_CMD); - - if (!priv->cur_rate && !priv->enablehwauto) - return -EINVAL; - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - - cmd.action = cpu_to_le16(cmd_action); - cmd.enablehwauto = cpu_to_le16(priv->enablehwauto); - cmd.bitmap = lbs_rate_to_fw_bitmap(priv->cur_rate, priv->enablehwauto); - ret = lbs_cmd_with_response(priv, CMD_802_11_RATE_ADAPT_RATESET, &cmd); - if (!ret && cmd_action == CMD_ACT_GET) { - priv->ratebitmap = le16_to_cpu(cmd.bitmap); - priv->enablehwauto = le16_to_cpu(cmd.enablehwauto); - } - - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} -EXPORT_SYMBOL_GPL(lbs_cmd_802_11_rate_adapt_rateset); - -/** - * @brief Set the data rate - * - * @param priv A pointer to struct lbs_private structure - * @param rate The desired data rate, or 0 to clear a locked rate - * - * @return 0 on success, error on failure - */ -int lbs_set_data_rate(struct lbs_private *priv, u8 rate) -{ - struct cmd_ds_802_11_data_rate cmd; - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - - if (rate > 0) { - cmd.action = cpu_to_le16(CMD_ACT_SET_TX_FIX_RATE); - cmd.rates[0] = lbs_data_rate_to_fw_index(rate); - if (cmd.rates[0] == 0) { - lbs_deb_cmd("DATA_RATE: invalid requested rate of" - " 0x%02X\n", rate); - ret = 0; - goto out; - } - lbs_deb_cmd("DATA_RATE: set fixed 0x%02X\n", cmd.rates[0]); - } else { - cmd.action = cpu_to_le16(CMD_ACT_SET_TX_AUTO); - lbs_deb_cmd("DATA_RATE: setting auto\n"); - } - - ret = lbs_cmd_with_response(priv, CMD_802_11_DATA_RATE, &cmd); - if (ret) - goto out; - - lbs_deb_hex(LBS_DEB_CMD, "DATA_RATE_RESP", (u8 *) &cmd, sizeof (cmd)); - - /* FIXME: get actual rates FW can do if this command actually returns - * all data rates supported. - */ - priv->cur_rate = lbs_fw_index_to_data_rate(cmd.rates[0]); - lbs_deb_cmd("DATA_RATE: current rate is 0x%02x\n", priv->cur_rate); - -out: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -/** - * @brief Get the radio channel - * - * @param priv A pointer to struct lbs_private structure - * - * @return The channel on success, error on failure - */ -int lbs_get_channel(struct lbs_private *priv) -{ - struct cmd_ds_802_11_rf_channel cmd; - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_GET); - - ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, &cmd); - if (ret) - goto out; - - ret = le16_to_cpu(cmd.channel); - lbs_deb_cmd("current radio channel is %d\n", ret); - -out: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -int lbs_update_channel(struct lbs_private *priv) -{ - int ret; - - /* the channel in f/w could be out of sync; get the current channel */ - lbs_deb_enter(LBS_DEB_ASSOC); - - ret = lbs_get_channel(priv); - if (ret > 0) { - priv->curbssparams.channel = ret; - ret = 0; - } - lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); - return ret; -} - -/** - * @brief Set the radio channel - * - * @param priv A pointer to struct lbs_private structure - * @param channel The desired channel, or 0 to clear a locked channel - * - * @return 0 on success, error on failure - */ -int lbs_set_channel(struct lbs_private *priv, u8 channel) -{ - struct cmd_ds_802_11_rf_channel cmd; -#ifdef DEBUG - u8 old_channel = priv->curbssparams.channel; -#endif - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_SET); - cmd.channel = cpu_to_le16(channel); - - ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, &cmd); - if (ret) - goto out; - - priv->curbssparams.channel = (uint8_t) le16_to_cpu(cmd.channel); - lbs_deb_cmd("channel switch from %d to %d\n", old_channel, - priv->curbssparams.channel); - -out: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -static int lbs_cmd_802_11_rssi(struct lbs_private *priv, - struct cmd_ds_command *cmd) -{ - - lbs_deb_enter(LBS_DEB_CMD); - cmd->command = cpu_to_le16(CMD_802_11_RSSI); - cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN); - cmd->params.rssi.N = cpu_to_le16(DEFAULT_BCN_AVG_FACTOR); - - /* reset Beacon SNR/NF/RSSI values */ - priv->SNR[TYPE_BEACON][TYPE_NOAVG] = 0; - priv->SNR[TYPE_BEACON][TYPE_AVG] = 0; - priv->NF[TYPE_BEACON][TYPE_NOAVG] = 0; - priv->NF[TYPE_BEACON][TYPE_AVG] = 0; - priv->RSSI[TYPE_BEACON][TYPE_NOAVG] = 0; - priv->RSSI[TYPE_BEACON][TYPE_AVG] = 0; - - lbs_deb_leave(LBS_DEB_CMD); - return 0; -} - -static int lbs_cmd_reg_access(struct cmd_ds_command *cmdptr, - u8 cmd_action, void *pdata_buf) -{ - struct lbs_offset_value *offval; - - lbs_deb_enter(LBS_DEB_CMD); - - offval = (struct lbs_offset_value *)pdata_buf; - - switch (le16_to_cpu(cmdptr->command)) { - case CMD_MAC_REG_ACCESS: - { - struct cmd_ds_mac_reg_access *macreg; - - cmdptr->size = - cpu_to_le16(sizeof (struct cmd_ds_mac_reg_access) - + S_DS_GEN); - macreg = - (struct cmd_ds_mac_reg_access *)&cmdptr->params. - macreg; - - macreg->action = cpu_to_le16(cmd_action); - macreg->offset = cpu_to_le16((u16) offval->offset); - macreg->value = cpu_to_le32(offval->value); - - break; - } - - case CMD_BBP_REG_ACCESS: - { - struct cmd_ds_bbp_reg_access *bbpreg; - - cmdptr->size = - cpu_to_le16(sizeof - (struct cmd_ds_bbp_reg_access) - + S_DS_GEN); - bbpreg = - (struct cmd_ds_bbp_reg_access *)&cmdptr->params. - bbpreg; - - bbpreg->action = cpu_to_le16(cmd_action); - bbpreg->offset = cpu_to_le16((u16) offval->offset); - bbpreg->value = (u8) offval->value; - - break; - } - - case CMD_RF_REG_ACCESS: - { - struct cmd_ds_rf_reg_access *rfreg; - - cmdptr->size = - cpu_to_le16(sizeof - (struct cmd_ds_rf_reg_access) + - S_DS_GEN); - rfreg = - (struct cmd_ds_rf_reg_access *)&cmdptr->params. - rfreg; - - rfreg->action = cpu_to_le16(cmd_action); - rfreg->offset = cpu_to_le16((u16) offval->offset); - rfreg->value = (u8) offval->value; - - break; - } - - default: - break; - } - - lbs_deb_leave(LBS_DEB_CMD); - return 0; -} - -static int lbs_cmd_bt_access(struct cmd_ds_command *cmd, - u16 cmd_action, void *pdata_buf) -{ - struct cmd_ds_bt_access *bt_access = &cmd->params.bt; - lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action); - - cmd->command = cpu_to_le16(CMD_BT_ACCESS); - cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) + S_DS_GEN); - cmd->result = 0; - bt_access->action = cpu_to_le16(cmd_action); - - switch (cmd_action) { - case CMD_ACT_BT_ACCESS_ADD: - memcpy(bt_access->addr1, pdata_buf, 2 * ETH_ALEN); - lbs_deb_hex(LBS_DEB_MESH, "BT_ADD: blinded MAC addr", bt_access->addr1, 6); - break; - case CMD_ACT_BT_ACCESS_DEL: - memcpy(bt_access->addr1, pdata_buf, 1 * ETH_ALEN); - lbs_deb_hex(LBS_DEB_MESH, "BT_DEL: blinded MAC addr", bt_access->addr1, 6); - break; - case CMD_ACT_BT_ACCESS_LIST: - bt_access->id = cpu_to_le32(*(u32 *) pdata_buf); - break; - case CMD_ACT_BT_ACCESS_RESET: - break; - case CMD_ACT_BT_ACCESS_SET_INVERT: - bt_access->id = cpu_to_le32(*(u32 *) pdata_buf); - break; - case CMD_ACT_BT_ACCESS_GET_INVERT: - break; - default: - break; - } - lbs_deb_leave(LBS_DEB_CMD); - return 0; -} - -static int lbs_cmd_fwt_access(struct cmd_ds_command *cmd, - u16 cmd_action, void *pdata_buf) -{ - struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt; - lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action); - - cmd->command = cpu_to_le16(CMD_FWT_ACCESS); - cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) + S_DS_GEN); - cmd->result = 0; - - if (pdata_buf) - memcpy(fwt_access, pdata_buf, sizeof(*fwt_access)); - else - memset(fwt_access, 0, sizeof(*fwt_access)); - - fwt_access->action = cpu_to_le16(cmd_action); - - lbs_deb_leave(LBS_DEB_CMD); - return 0; -} - -int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, - struct cmd_ds_mesh_access *cmd) -{ - int ret; - - lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action); - - cmd->hdr.command = cpu_to_le16(CMD_MESH_ACCESS); - cmd->hdr.size = cpu_to_le16(sizeof(*cmd)); - cmd->hdr.result = 0; - - cmd->action = cpu_to_le16(cmd_action); - - ret = lbs_cmd_with_response(priv, CMD_MESH_ACCESS, cmd); - - lbs_deb_leave(LBS_DEB_CMD); - return ret; -} - -static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, - struct cmd_ds_command *cmd, - u16 cmd_action) -{ - struct cmd_ds_802_11_beacon_control - *bcn_ctrl = &cmd->params.bcn_ctrl; - - lbs_deb_enter(LBS_DEB_CMD); - cmd->size = - cpu_to_le16(sizeof(struct cmd_ds_802_11_beacon_control) - + S_DS_GEN); - cmd->command = cpu_to_le16(CMD_802_11_BEACON_CTRL); - - bcn_ctrl->action = cpu_to_le16(cmd_action); - bcn_ctrl->beacon_enable = cpu_to_le16(priv->beacon_enable); - bcn_ctrl->beacon_period = cpu_to_le16(priv->beacon_period); - - lbs_deb_leave(LBS_DEB_CMD); - return 0; -} - -#if (ANDROID_POWER_SAVE == 1) - -extern int wifi_ps_status; - -#endif - -static void lbs_queue_cmd(struct lbs_private *priv, - struct cmd_ctrl_node *cmdnode) -{ - unsigned long flags; - int addtail = 1; - - lbs_deb_enter(LBS_DEB_HOST); - - if (!cmdnode) { - lbs_deb_host("QUEUE_CMD: cmdnode is NULL\n"); - goto done; - } - if (!cmdnode->cmdbuf->size) { - lbs_deb_host("DNLD_CMD: cmd size is zero\n"); - goto done; - } - cmdnode->result = 0; - - /* Exit_PS command needs to be queued in the header always. */ - if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) { - struct cmd_ds_802_11_ps_mode *psm = (void *) &cmdnode->cmdbuf[1]; - - if (psm->action == cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { - if (priv->psstate != PS_STATE_FULL_POWER) - addtail = 0; - } - } - - spin_lock_irqsave(&priv->driver_lock, flags); - - if (addtail) - list_add_tail(&cmdnode->list, &priv->cmdpendingq); - else - list_add(&cmdnode->list, &priv->cmdpendingq); - - spin_unlock_irqrestore(&priv->driver_lock, flags); - - lbs_deb_host("QUEUE_CMD: inserted command 0x%04x into cmdpendingq\n", - le16_to_cpu(cmdnode->cmdbuf->command)); - -done: - lbs_deb_leave(LBS_DEB_HOST); -} - -/** - * This function inserts command node to cmdfreeq - * after cleans it. Requires priv->driver_lock held. - */ -static void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, - struct cmd_ctrl_node *cmdnode) -{ - lbs_deb_enter(LBS_DEB_HOST); - - if (!cmdnode) - goto out; - - cmdnode->callback = NULL; - cmdnode->callback_arg = 0; - - memset(cmdnode->cmdbuf, 0, LBS_CMD_BUFFER_SIZE); - - list_add_tail(&cmdnode->list, &priv->cmdfreeq); - out: - lbs_deb_leave(LBS_DEB_HOST); -} - -static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv, - struct cmd_ctrl_node *ptempcmd) -{ - unsigned long flags; - - spin_lock_irqsave(&priv->driver_lock, flags); - __lbs_cleanup_and_insert_cmd(priv, ptempcmd); - spin_unlock_irqrestore(&priv->driver_lock, flags); -} - -static void lbs_submit_command(struct lbs_private *priv, - struct cmd_ctrl_node *cmdnode) -{ - unsigned long flags; - struct cmd_header *cmd; - uint16_t cmdsize; - uint16_t command; - int timeo = 3 * HZ; - int ret; - - lbs_deb_enter(LBS_DEB_HOST); - - cmd = cmdnode->cmdbuf; - - spin_lock_irqsave(&priv->driver_lock, flags); - priv->cur_cmd = cmdnode; - priv->cur_cmd_retcode = 0; - spin_unlock_irqrestore(&priv->driver_lock, flags); - - cmdsize = le16_to_cpu(cmd->size); - command = le16_to_cpu(cmd->command); - - /* These commands take longer */ - if (command == CMD_802_11_SCAN || - command == CMD_802_11_ASSOCIATE || - command == CMD_802_11_AUTHENTICATE) - timeo = 5 * HZ; - - lbs_deb_cmd("DNLD_CMD: command 0x%04x, seq %d, size %d\n", - command, le16_to_cpu(cmd->seqnum), cmdsize); - lbs_deb_hex(LBS_DEB_CMD, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize); - - ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); - - if (ret) { - lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret); - /* Let the timer kick in and retry, and potentially reset - the whole thing if the condition persists */ - timeo = HZ/4; - } - - /* - * Since there is no response for DEEP SLEEP command, don't add timer. - */ - if (command == CMD_802_11_DEEP_SLEEP) - { - priv->deepsleep = true; - priv->needtowakeup = true; - - lbs_complete_command(priv, cmdnode, ret); - - priv->dnld_sent = DNLD_RES_RECEIVED; - } - else - /* Setup the timer after transmit command */ - mod_timer(&priv->command_timer, jiffies + timeo); - - lbs_deb_leave(LBS_DEB_HOST); -} - -void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, - int result) -{ - if (cmd == priv->cur_cmd) - priv->cur_cmd_retcode = result; - - cmd->result = result; - cmd->cmdwaitqwoken = 1; - wake_up_interruptible(&cmd->cmdwait_q); - - if (!cmd->callback || cmd->callback == lbs_cmd_async_callback) - __lbs_cleanup_and_insert_cmd(priv, cmd); - priv->cur_cmd = NULL; -} - -int lbs_set_radio(struct lbs_private *priv, u8 preamble, u8 radio_on) -{ - struct cmd_ds_802_11_radio_control cmd; - int ret = -EINVAL; - - lbs_deb_enter(LBS_DEB_CMD); - -#if (NEW_MV8686_PS == 1) - if (priv->radio_on == radio_on) - { - //printk("%s: needn't config radio again.\n", __func__); - return 0; - } -#endif - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - - /* Only v8 and below support setting the preamble */ - if (priv->fwrelease < 0x09000000) { - switch (preamble) { - case RADIO_PREAMBLE_SHORT: - if (!(priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) - goto out; - /* Fall through */ - case RADIO_PREAMBLE_AUTO: - case RADIO_PREAMBLE_LONG: - cmd.control = cpu_to_le16(preamble); - break; - default: - goto out; - } - } - - if (radio_on) - cmd.control |= cpu_to_le16(0x1); - else { - cmd.control &= cpu_to_le16(~0x1); - priv->txpower_cur = 0; - } - - lbs_deb_cmd("RADIO_CONTROL: radio %s, preamble %d\n", - radio_on ? "ON" : "OFF", preamble); - - priv->radio_on = radio_on; - - ret = lbs_cmd_with_response(priv, CMD_802_11_RADIO_CONTROL, &cmd); - -out: - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -void lbs_set_mac_control(struct lbs_private *priv) -{ - struct cmd_ds_mac_control cmd; - - lbs_deb_enter(LBS_DEB_CMD); - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(priv->mac_control); - cmd.reserved = 0; - - lbs_cmd_async(priv, CMD_MAC_CONTROL, &cmd.hdr, sizeof(cmd)); - - lbs_deb_leave(LBS_DEB_CMD); -} - -/** - * @brief This function prepare the command before send to firmware. - * - * @param priv A pointer to struct lbs_private structure - * @param cmd_no command number - * @param cmd_action command action: GET or SET - * @param wait_option wait option: wait response or not - * @param cmd_oid cmd oid: treated as sub command - * @param pdata_buf A pointer to informaion buffer - * @return 0 or -1 - */ -int lbs_prepare_and_send_command(struct lbs_private *priv, - u16 cmd_no, - u16 cmd_action, - u16 wait_option, u32 cmd_oid, void *pdata_buf) -{ - int ret = 0; - struct cmd_ctrl_node *cmdnode; - struct cmd_ds_command *cmdptr; - unsigned long flags; - - lbs_deb_enter(LBS_DEB_HOST); - - if (!priv) { - lbs_deb_host("PREP_CMD: priv is NULL\n"); - ret = -1; - goto done; - } - - if (priv->surpriseremoved) { - lbs_deb_host("PREP_CMD: card removed\n"); - ret = -1; - goto done; - } - -#if (ANDROID_POWER_SAVE == 1) - - if (wifi_ps_status != WIFI_PS_AWAKE) - { - if ((wifi_ps_status == WIFI_PS_DRV_SLEEP) && - (priv->wifi_ps_work_req == 0)) - { - printk("Wakeup wifi for assoc.\n"); - priv->wifi_ps_work_req = WIFI_PS_PRE_WAKE; - netif_stop_queue(priv->dev); - netif_carrier_off(priv->dev); - queue_delayed_work(priv->work_thread, &priv->ps_work, - msecs_to_jiffies(5)); - msleep(900); - } - else if (wifi_ps_status == WIFI_PS_PRE_SLEEP) - { - ; /* Just go on */ - } - else - { - printk("Drop the command while in system deepsleep.\n"); - ret = -1; - goto done; - } - } - else - { - if (cmd_no != CMD_802_11_RSSI) - lbs_update_ps_timer(); - } -#endif - - cmdnode = lbs_get_cmd_ctrl_node(priv); - - if (cmdnode == NULL) { - lbs_deb_host("PREP_CMD: cmdnode is NULL\n"); - - /* Wake up main thread to execute next command */ - wake_up_interruptible(&priv->waitq); - ret = -1; - goto done; - } - - cmdnode->callback = NULL; - cmdnode->callback_arg = (unsigned long)pdata_buf; - - cmdptr = (struct cmd_ds_command *)cmdnode->cmdbuf; - - lbs_deb_host("PREP_CMD: command 0x%04x\n", cmd_no); - - /* Set sequence number, command and INT option */ - priv->seqnum++; - cmdptr->seqnum = cpu_to_le16(priv->seqnum); - - cmdptr->command = cpu_to_le16(cmd_no); - cmdptr->result = 0; - - switch (cmd_no) - { - case CMD_802_11_DEEP_SLEEP: - cmdptr->size = 8; - break; - - case CMD_802_11_PS_MODE: - ret = lbs_cmd_802_11_ps_mode(cmdptr, cmd_action); - break; - - case CMD_802_11_ASSOCIATE: - case CMD_802_11_REASSOCIATE: - ret = lbs_cmd_80211_associate(priv, cmdptr, pdata_buf); - break; - - case CMD_802_11_AUTHENTICATE: - ret = lbs_cmd_80211_authenticate(priv, cmdptr, pdata_buf); - break; - - case CMD_MAC_REG_ACCESS: - case CMD_BBP_REG_ACCESS: - case CMD_RF_REG_ACCESS: - ret = lbs_cmd_reg_access(cmdptr, cmd_action, pdata_buf); - break; - - case CMD_802_11_MONITOR_MODE: - ret = lbs_cmd_802_11_monitor_mode(cmdptr, - cmd_action, pdata_buf); - break; - - case CMD_802_11_RSSI: - ret = lbs_cmd_802_11_rssi(priv, cmdptr); - break; - - case CMD_802_11_SET_AFC: - case CMD_802_11_GET_AFC: - - cmdptr->command = cpu_to_le16(cmd_no); - cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_afc) + - S_DS_GEN); - - memmove(&cmdptr->params.afc, - pdata_buf, sizeof(struct cmd_ds_802_11_afc)); - - ret = 0; - goto done; - - case CMD_802_11D_DOMAIN_INFO: - ret = lbs_cmd_802_11d_domain_info(priv, cmdptr, - cmd_no, cmd_action); - break; - - case CMD_802_11_TPC_CFG: - cmdptr->command = cpu_to_le16(CMD_802_11_TPC_CFG); - cmdptr->size = - cpu_to_le16(sizeof(struct cmd_ds_802_11_tpc_cfg) + - S_DS_GEN); - - memmove(&cmdptr->params.tpccfg, - pdata_buf, sizeof(struct cmd_ds_802_11_tpc_cfg)); - - ret = 0; - break; - case CMD_802_11_LED_GPIO_CTRL: - { - struct mrvlietypes_ledgpio *gpio = - (struct mrvlietypes_ledgpio*) - cmdptr->params.ledgpio.data; - - memmove(&cmdptr->params.ledgpio, - pdata_buf, - sizeof(struct cmd_ds_802_11_led_ctrl)); - - cmdptr->command = - cpu_to_le16(CMD_802_11_LED_GPIO_CTRL); - -#define ACTION_NUMLED_TLVTYPE_LEN_FIELDS_LEN 8 - cmdptr->size = - cpu_to_le16(le16_to_cpu(gpio->header.len) - + S_DS_GEN - + ACTION_NUMLED_TLVTYPE_LEN_FIELDS_LEN); - gpio->header.len = gpio->header.len; - - ret = 0; - break; - } - - case CMD_BT_ACCESS: - ret = lbs_cmd_bt_access(cmdptr, cmd_action, pdata_buf); - break; - - case CMD_FWT_ACCESS: - ret = lbs_cmd_fwt_access(cmdptr, cmd_action, pdata_buf); - break; - - case CMD_GET_TSF: - cmdptr->command = cpu_to_le16(CMD_GET_TSF); - cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_get_tsf) + - S_DS_GEN); - ret = 0; - break; - case CMD_802_11_BEACON_CTRL: - ret = lbs_cmd_bcn_ctrl(priv, cmdptr, cmd_action); - break; - default: - lbs_pr_err("PREP_CMD: unknown command 0x%04x\n", cmd_no); - ret = -1; - break; - } - - /* return error, since the command preparation failed */ - if (ret != 0) { - lbs_deb_host("PREP_CMD: command preparation failed\n"); - lbs_cleanup_and_insert_cmd(priv, cmdnode); - ret = -1; - goto done; - } - - cmdnode->cmdwaitqwoken = 0; - - lbs_queue_cmd(priv, cmdnode); - wake_up_interruptible(&priv->waitq); - - if (wait_option & CMD_OPTION_WAITFORRSP) { - lbs_deb_host("PREP_CMD: wait for response\n"); - might_sleep(); - wait_event_interruptible(cmdnode->cmdwait_q, - cmdnode->cmdwaitqwoken); - } - - spin_lock_irqsave(&priv->driver_lock, flags); - if (priv->cur_cmd_retcode) { - lbs_deb_host("PREP_CMD: command failed with return code %d\n", - priv->cur_cmd_retcode); - priv->cur_cmd_retcode = 0; - ret = -1; - } - spin_unlock_irqrestore(&priv->driver_lock, flags); - -done: - lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); - return ret; -} - -/** - * @brief This function allocates the command buffer and link - * it to command free queue. - * - * @param priv A pointer to struct lbs_private structure - * @return 0 or -1 - */ -int lbs_allocate_cmd_buffer(struct lbs_private *priv) -{ - int ret = 0; - u32 bufsize; - u32 i; - struct cmd_ctrl_node *cmdarray; - - lbs_deb_enter(LBS_DEB_HOST); - - /* Allocate and initialize the command array */ - bufsize = sizeof(struct cmd_ctrl_node) * LBS_NUM_CMD_BUFFERS; - if (!(cmdarray = kzalloc(bufsize, GFP_KERNEL))) { - lbs_deb_host("ALLOC_CMD_BUF: tempcmd_array is NULL\n"); - ret = -1; - goto done; - } - priv->cmd_array = cmdarray; - - /* Allocate and initialize each command buffer in the command array */ - for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { - cmdarray[i].cmdbuf = kzalloc(LBS_CMD_BUFFER_SIZE, GFP_KERNEL); - if (!cmdarray[i].cmdbuf) { - lbs_deb_host("ALLOC_CMD_BUF: ptempvirtualaddr is NULL\n"); - ret = -1; - goto done; - } - } - - for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) { - init_waitqueue_head(&cmdarray[i].cmdwait_q); - lbs_cleanup_and_insert_cmd(priv, &cmdarray[i]); - } - ret = 0; - -done: - lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); - return ret; -} - -/** - * @brief This function frees the command buffer. - * - * @param priv A pointer to struct lbs_private structure - * @return 0 or -1 - */ -int lbs_free_cmd_buffer(struct lbs_private *priv) -{ - struct cmd_ctrl_node *cmdarray; - unsigned int i; - - lbs_deb_enter(LBS_DEB_HOST); - - /* need to check if cmd array is allocated or not */ - if (priv->cmd_array == NULL) { - lbs_deb_host("FREE_CMD_BUF: cmd_array is NULL\n"); - goto done; - } - - cmdarray = priv->cmd_array; - - /* Release shared memory buffers */ - for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) - { - if (cmdarray[i].cmdbuf) - { - kfree(cmdarray[i].cmdbuf); - cmdarray[i].cmdbuf = NULL; - } - } - - /* Release cmd_ctrl_node */ - if (priv->cmd_array) { - kfree(priv->cmd_array); - priv->cmd_array = NULL; - } - -done: - lbs_deb_leave(LBS_DEB_HOST); - return 0; -} - -/** - * @brief This function gets a free command node if available in - * command free queue. - * - * @param priv A pointer to struct lbs_private structure - * @return cmd_ctrl_node A pointer to cmd_ctrl_node structure or NULL - */ -static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv) -{ - struct cmd_ctrl_node *tempnode; - unsigned long flags; - - lbs_deb_enter(LBS_DEB_HOST); - - if (!priv) - return NULL; - - spin_lock_irqsave(&priv->driver_lock, flags); - - if (!list_empty(&priv->cmdfreeq)) { - tempnode = list_first_entry(&priv->cmdfreeq, - struct cmd_ctrl_node, list); - list_del(&tempnode->list); - } else { - lbs_deb_host("GET_CMD_NODE: cmd_ctrl_node is not available\n"); - tempnode = NULL; - } - - spin_unlock_irqrestore(&priv->driver_lock, flags); - - lbs_deb_leave(LBS_DEB_HOST); - return tempnode; -} - -extern int lbs_can_enter_deep_sleep(struct lbs_private *priv); - -/** - * @brief This function executes next command in command - * pending queue. It will put firmware back to PS mode - * if applicable. - * - * @param priv A pointer to struct lbs_private structure - * @return 0 or -1 - */ -int lbs_execute_next_command(struct lbs_private *priv) -{ - struct cmd_ctrl_node *cmdnode = NULL; - struct cmd_header *cmd; - unsigned long flags; - int ret = 0; - - /* Debug group is LBS_DEB_THREAD and not LBS_DEB_HOST, because the - * only caller to us is lbs_thread() and we get even when a - * data packet is received */ - lbs_deb_enter(LBS_DEB_THREAD); - - spin_lock_irqsave(&priv->driver_lock, flags); - - if (priv->cur_cmd) { - lbs_pr_alert( "EXEC_NEXT_CMD: already processing command!\n"); - spin_unlock_irqrestore(&priv->driver_lock, flags); - ret = -1; - goto done; - } - - if (!list_empty(&priv->cmdpendingq)) { - cmdnode = list_first_entry(&priv->cmdpendingq, - struct cmd_ctrl_node, list); - } - - spin_unlock_irqrestore(&priv->driver_lock, flags); - - if (cmdnode) - { - cmd = cmdnode->cmdbuf; - - if (is_command_allowed_in_ps(le16_to_cpu(cmd->command))) { - if ((priv->psstate == PS_STATE_SLEEP) || - (priv->psstate == PS_STATE_PRE_SLEEP)) { - lbs_deb_host( - "EXEC_NEXT_CMD: cannot send cmd 0x%04x in psstate %d\n", - le16_to_cpu(cmd->command), - priv->psstate); - ret = -1; - goto done; - } - lbs_deb_host("EXEC_NEXT_CMD: OK to send command " - "0x%04x in psstate %d\n", - le16_to_cpu(cmd->command), priv->psstate); - } else if (priv->psstate != PS_STATE_FULL_POWER) { - /* - * 1. Non-PS command: - * Queue it. set needtowakeup to TRUE if current state - * is SLEEP, otherwise call lbs_ps_wakeup to send Exit_PS. - * 2. PS command but not Exit_PS: - * Ignore it. - * 3. PS command Exit_PS: - * Set needtowakeup to TRUE if current state is SLEEP, - * otherwise send this command down to firmware - * immediately. - */ - if (cmd->command != cpu_to_le16(CMD_802_11_PS_MODE)) { - /* Prepare to send Exit PS, - * this non PS command will be sent later */ - if ((priv->psstate == PS_STATE_SLEEP) - || (priv->psstate == PS_STATE_PRE_SLEEP) - ) { - /* w/ new scheme, it will not reach here. - since it is blocked in main_thread. */ - priv->needtowakeup = 1; - } else - lbs_ps_wakeup(priv, 0); - - ret = 0; - goto done; - } else { - /* - * PS command. Ignore it if it is not Exit_PS. - * otherwise send it down immediately. - */ - struct cmd_ds_802_11_ps_mode *psm = (void *)&cmd[1]; - - lbs_deb_host( - "EXEC_NEXT_CMD: PS cmd, action 0x%02x\n", - psm->action); - if (psm->action != - cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { - lbs_deb_host( - "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); - list_del(&cmdnode->list); - spin_lock_irqsave(&priv->driver_lock, flags); - lbs_complete_command(priv, cmdnode, 0); - spin_unlock_irqrestore(&priv->driver_lock, flags); - - ret = 0; - goto done; - } - - if ((priv->psstate == PS_STATE_SLEEP) || - (priv->psstate == PS_STATE_PRE_SLEEP)) { - lbs_deb_host( - "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); - list_del(&cmdnode->list); - spin_lock_irqsave(&priv->driver_lock, flags); - lbs_complete_command(priv, cmdnode, 0); - spin_unlock_irqrestore(&priv->driver_lock, flags); - priv->needtowakeup = 1; - - ret = 0; - goto done; - } - - lbs_deb_host( - "EXEC_NEXT_CMD: sending EXIT_PS\n"); - } - } - list_del(&cmdnode->list); - lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n", - le16_to_cpu(cmd->command)); - lbs_submit_command(priv, cmdnode); - } else { - /* - * check if in power save mode, if yes, put the device back - * to PS mode. - */ - if ((priv->psmode != LBS802_11POWERMODECAM) && - (priv->psstate == PS_STATE_FULL_POWER) && - ((priv->connect_status == LBS_CONNECTED))) { - if (priv->secinfo.WPAenabled || - priv->secinfo.WPA2enabled) { - /* check for valid WPA group keys */ - if (priv->wpa_mcast_key.len || - priv->wpa_unicast_key.len) { - lbs_deb_host( - "EXEC_NEXT_CMD: WPA enabled and GTK_SET" - " go back to PS_SLEEP"); - lbs_ps_sleep(priv, 0); - } - } else { - lbs_deb_host( - "EXEC_NEXT_CMD: cmdpendingq empty, " - "go back to PS_SLEEP"); - lbs_ps_sleep(priv, 0); - } - } - else - { - if (priv->auto_deepsleep && lbs_can_enter_deep_sleep(priv)) - { - printk("Entering Auto Deep Sleep mode...\n"); - ret = lbs_prepare_and_send_command(priv, CMD_802_11_DEEP_SLEEP, 0, 0, 0, NULL); - //msleep(500); - } - } - } - - ret = 0; -done: - lbs_deb_leave(LBS_DEB_THREAD); - return ret; -} - -void lbs_send_iwevcustom_event(struct lbs_private *priv, s8 *str) -{ - union iwreq_data iwrq; - u8 buf[50]; - - lbs_deb_enter(LBS_DEB_WEXT); - - memset(&iwrq, 0, sizeof(union iwreq_data)); - memset(buf, 0, sizeof(buf)); - - snprintf(buf, sizeof(buf) - 1, "%s", str); - - iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN; - - /* Send Event to upper layer */ - lbs_deb_wext("event indication string %s\n", (char *)buf); - lbs_deb_wext("event indication length %d\n", iwrq.data.length); - lbs_deb_wext("sending wireless event IWEVCUSTOM for %s\n", str); - - wireless_send_event(priv->dev, IWEVCUSTOM, &iwrq, buf); - - lbs_deb_leave(LBS_DEB_WEXT); -} - -static void lbs_send_confirmsleep(struct lbs_private *priv) -{ - unsigned long flags; - int ret; - - lbs_deb_enter(LBS_DEB_HOST); - lbs_deb_hex(LBS_DEB_HOST, "sleep confirm", (u8 *) &confirm_sleep, - sizeof(confirm_sleep)); - - ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) &confirm_sleep, - sizeof(confirm_sleep)); - if (ret) { - lbs_pr_alert("confirm_sleep failed\n"); - goto out; - } - - spin_lock_irqsave(&priv->driver_lock, flags); - - /* We don't get a response on the sleep-confirmation */ - priv->dnld_sent = DNLD_RES_RECEIVED; - - /* If nothing to do, go back to sleep (?) */ - if (!__kfifo_len(priv->event_fifo) && !priv->resp_len[priv->resp_idx]) - priv->psstate = PS_STATE_SLEEP; - - spin_unlock_irqrestore(&priv->driver_lock, flags); - -out: - lbs_deb_leave(LBS_DEB_HOST); -} - -void lbs_ps_sleep(struct lbs_private *priv, int wait_option) -{ - lbs_deb_enter(LBS_DEB_HOST); - //printk("Enter lbs_ps_sleep\n"); - - /* - * PS is currently supported only in Infrastructure mode - * Remove this check if it is to be supported in IBSS mode also - */ - - lbs_prepare_and_send_command(priv, CMD_802_11_PS_MODE, - CMD_SUBCMD_ENTER_PS, wait_option, 0, NULL); - - lbs_deb_leave(LBS_DEB_HOST); -} - -/** - * @brief This function sends Exit_PS command to firmware. - * - * @param priv A pointer to struct lbs_private structure - * @param wait_option wait response or not - * @return n/a - */ -void lbs_ps_wakeup(struct lbs_private *priv, int wait_option) -{ - __le32 Localpsmode; - - lbs_deb_enter(LBS_DEB_HOST); - //printk("lbs_ps_wakeup.\n"); - - Localpsmode = cpu_to_le32(LBS802_11POWERMODECAM); - - lbs_prepare_and_send_command(priv, CMD_802_11_PS_MODE, - CMD_SUBCMD_EXIT_PS, - wait_option, 0, &Localpsmode); - - lbs_deb_leave(LBS_DEB_HOST); -} - -/** - * @brief This function checks condition and prepares to - * send sleep confirm command to firmware if ok. - * - * @param priv A pointer to struct lbs_private structure - * @param psmode Power Saving mode - * @return n/a - */ -void lbs_ps_confirm_sleep(struct lbs_private *priv) -{ - unsigned long flags =0; - int allowed = 1; - - lbs_deb_enter(LBS_DEB_HOST); - - spin_lock_irqsave(&priv->driver_lock, flags); - if (priv->dnld_sent) { - allowed = 0; - lbs_deb_host("dnld_sent was set\n"); - } - - /* In-progress command? */ - if (priv->cur_cmd) { - allowed = 0; - lbs_deb_host("cur_cmd was set\n"); - } - - /* Pending events or command responses? */ - if (__kfifo_len(priv->event_fifo) || priv->resp_len[priv->resp_idx]) { - allowed = 0; - lbs_deb_host("pending events or command responses\n"); - } - spin_unlock_irqrestore(&priv->driver_lock, flags); - - if (allowed) { - lbs_deb_host("sending lbs_ps_confirm_sleep\n"); - lbs_send_confirmsleep(priv); - } else { - lbs_deb_host("sleep confirm has been delayed\n"); - } - - lbs_deb_leave(LBS_DEB_HOST); -} - - -/** - * @brief Configures the transmission power control functionality. - * - * @param priv A pointer to struct lbs_private structure - * @param enable Transmission power control enable - * @param p0 Power level when link quality is good (dBm). - * @param p1 Power level when link quality is fair (dBm). - * @param p2 Power level when link quality is poor (dBm). - * @param usesnr Use Signal to Noise Ratio in TPC - * - * @return 0 on success - */ -int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1, - int8_t p2, int usesnr) -{ - struct cmd_ds_802_11_tpc_cfg cmd; - int ret; - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - cmd.enable = !!enable; - cmd.usesnr = !!usesnr; - cmd.P0 = p0; - cmd.P1 = p1; - cmd.P2 = p2; - - ret = lbs_cmd_with_response(priv, CMD_802_11_TPC_CFG, &cmd); - - return ret; -} - -/** - * @brief Configures the power adaptation settings. - * - * @param priv A pointer to struct lbs_private structure - * @param enable Power adaptation enable - * @param p0 Power level for 1, 2, 5.5 and 11 Mbps (dBm). - * @param p1 Power level for 6, 9, 12, 18, 22, 24 and 36 Mbps (dBm). - * @param p2 Power level for 48 and 54 Mbps (dBm). - * - * @return 0 on Success - */ - -int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0, - int8_t p1, int8_t p2) -{ - struct cmd_ds_802_11_pa_cfg cmd; - int ret; - - memset(&cmd, 0, sizeof(cmd)); - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - cmd.enable = !!enable; - cmd.P0 = p0; - cmd.P1 = p1; - cmd.P2 = p2; - - ret = lbs_cmd_with_response(priv, CMD_802_11_PA_CFG , &cmd); - - return ret; -} - -static struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, - uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, - int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), - unsigned long callback_arg) -{ - struct cmd_ctrl_node *cmdnode; - - lbs_deb_enter(LBS_DEB_HOST); - - if (priv->surpriseremoved) { - lbs_deb_host("PREP_CMD: card removed\n"); - cmdnode = ERR_PTR(-ENOENT); - goto done; - } - - cmdnode = lbs_get_cmd_ctrl_node(priv); - if (cmdnode == NULL) { - lbs_deb_host("PREP_CMD: cmdnode is NULL\n"); - - /* Wake up main thread to execute next command */ - wake_up_interruptible(&priv->waitq); - cmdnode = ERR_PTR(-ENOBUFS); - goto done; - } - - cmdnode->callback = callback; - cmdnode->callback_arg = callback_arg; - - /* Copy the incoming command to the buffer */ - memcpy(cmdnode->cmdbuf, in_cmd, in_cmd_size); - - /* Set sequence number, clean result, move to buffer */ - priv->seqnum++; - cmdnode->cmdbuf->command = cpu_to_le16(command); - cmdnode->cmdbuf->size = cpu_to_le16(in_cmd_size); - cmdnode->cmdbuf->seqnum = cpu_to_le16(priv->seqnum); - cmdnode->cmdbuf->result = 0; - - lbs_deb_host("PREP_CMD: command 0x%04x\n", command); - - cmdnode->cmdwaitqwoken = 0; - lbs_queue_cmd(priv, cmdnode); - wake_up_interruptible(&priv->waitq); - - done: - lbs_deb_leave_args(LBS_DEB_HOST, "ret %p", cmdnode); - return cmdnode; -} - -void lbs_cmd_async(struct lbs_private *priv, uint16_t command, - struct cmd_header *in_cmd, int in_cmd_size) -{ - lbs_deb_enter(LBS_DEB_CMD); - __lbs_cmd_async(priv, command, in_cmd, in_cmd_size, - lbs_cmd_async_callback, 0); - lbs_deb_leave(LBS_DEB_CMD); -} - -int __lbs_cmd(struct lbs_private *priv, uint16_t command, - struct cmd_header *in_cmd, int in_cmd_size, - int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), - unsigned long callback_arg) -{ - struct cmd_ctrl_node *cmdnode; - unsigned long flags; - int ret = 0; - - lbs_deb_enter(LBS_DEB_HOST); - -#if (ANDROID_POWER_SAVE == 1) - - if (wifi_ps_status != WIFI_PS_AWAKE) - { - if ((wifi_ps_status == WIFI_PS_DRV_SLEEP) && - (priv->wifi_ps_work_req == 0)) - { - printk("Wakeup wifi for assoc.\n"); - priv->wifi_ps_work_req = WIFI_PS_PRE_WAKE; - netif_stop_queue(priv->dev); - netif_carrier_off(priv->dev); - queue_delayed_work(priv->work_thread, &priv->ps_work, - msecs_to_jiffies(5)); - msleep(900); - } - else - { - printk("Drop the command while in system deepsleep.\n"); - ret = -1; - goto done; - } - } - else - { - lbs_update_ps_timer(); - } -#endif - - cmdnode = __lbs_cmd_async(priv, command, in_cmd, in_cmd_size, - callback, callback_arg); - if (IS_ERR(cmdnode)) { - ret = PTR_ERR(cmdnode); - goto done; - } - - might_sleep(); - wait_event_interruptible(cmdnode->cmdwait_q, cmdnode->cmdwaitqwoken); - - spin_lock_irqsave(&priv->driver_lock, flags); - ret = cmdnode->result; - if (ret) - lbs_pr_info("PREP_CMD: command 0x%04x failed: %d\n", - command, ret); - - __lbs_cleanup_and_insert_cmd(priv, cmdnode); - spin_unlock_irqrestore(&priv->driver_lock, flags); - -done: - lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); - return ret; -} -EXPORT_SYMBOL_GPL(__lbs_cmd); - - diff --git a/drivers/net/wireless/mv8686/cmd.h b/drivers/net/wireless/mv8686/cmd.h deleted file mode 100755 index 470afddb43e5..000000000000 --- a/drivers/net/wireless/mv8686/cmd.h +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright (C) 2007, Red Hat, Inc. */ - -#ifndef _LBS_CMD_H_ -#define _LBS_CMD_H_ - -#include "hostcmd.h" -#include "dev.h" - -/* lbs_cmd() infers the size of the buffer to copy data back into, from - the size of the target of the pointer. Since the command to be sent - may often be smaller, that size is set in cmd->size by the caller.*/ -#define lbs_cmd(priv, cmdnr, cmd, cb, cb_arg) ({ \ - uint16_t __sz = le16_to_cpu((cmd)->hdr.size); \ - (cmd)->hdr.size = cpu_to_le16(sizeof(*(cmd))); \ - __lbs_cmd(priv, cmdnr, &(cmd)->hdr, __sz, cb, cb_arg); \ -}) - -#define lbs_cmd_with_response(priv, cmdnr, cmd) \ - lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd)) - -void lbs_cmd_async(struct lbs_private *priv, uint16_t command, - struct cmd_header *in_cmd, int in_cmd_size); - -int __lbs_cmd(struct lbs_private *priv, uint16_t command, - struct cmd_header *in_cmd, int in_cmd_size, - int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), - unsigned long callback_arg); - -int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0, - int8_t p1, int8_t p2); - -int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1, - int8_t p2, int usesnr); - -int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0, - int8_t p1, int8_t p2); - -int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1, - int8_t p2, int usesnr); - -int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra, - struct cmd_header *resp); - -int lbs_update_hw_spec(struct lbs_private *priv); - -//int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, -// struct cmd_ds_mesh_access *cmd); - -int lbs_set_data_rate(struct lbs_private *priv, u8 rate); - -int lbs_get_channel(struct lbs_private *priv); -int lbs_set_channel(struct lbs_private *priv, u8 channel); - -//int lbs_mesh_config_send(struct lbs_private *priv, -// struct cmd_ds_mesh_config *cmd, -// uint16_t action, uint16_t type); -//int lbs_mesh_config(struct lbs_private *priv, uint16_t enable, uint16_t chan); - -int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, - struct wol_config *p_wol_config); -//int lbs_suspend(struct lbs_private *priv); -//void lbs_resume(struct lbs_private *priv); - -int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv, - uint16_t cmd_action); -int lbs_cmd_802_11_inactivity_timeout(struct lbs_private *priv, - uint16_t cmd_action, uint16_t *timeout); -int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, - struct sleep_params *sp); -int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action, - struct assoc_request *assoc); -int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action, - uint16_t *enable); -int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action, - struct assoc_request *assoc); - -int lbs_get_tx_power(struct lbs_private *priv, s16 *curlevel, s16 *minlevel, - s16 *maxlevel); -int lbs_set_tx_power(struct lbs_private *priv, s16 dbm); - -int lbs_set_radio(struct lbs_private *priv, u8 preamble, u8 radio_on); - -int lbs_set_snmp_mib(struct lbs_private *priv, u32 oid, u16 val); - -int lbs_get_snmp_mib(struct lbs_private *priv, u32 oid, u16 *out_val); - -int mv8686_set_mode(struct lbs_private *priv, u8 new_mode); - -#endif /* _LBS_CMD_H */ diff --git a/drivers/net/wireless/mv8686/cmdresp.c b/drivers/net/wireless/mv8686/cmdresp.c deleted file mode 100755 index 018a36eb8b05..000000000000 --- a/drivers/net/wireless/mv8686/cmdresp.c +++ /dev/null @@ -1,718 +0,0 @@ -/** - * This file contains the handling of command - * responses as well as events generated by firmware. - */ -#include -#include -#include -#include - -#include - -#include "host.h" -#include "decl.h" -#include "defs.h" -#include "dev.h" -#include "assoc.h" -#include "wext.h" - -/* - * Defined in main.c - */ -extern atomic_t reassoc_flag; - -/** - * @brief This function handles disconnect event. it - * reports disconnect to upper layer, clean tx/rx packets, - * reset link state etc. - * - * @param priv A pointer to struct lbs_private structure - * @return n/a - */ -void lbs_mac_event_disconnected(struct lbs_private *priv) -{ - union iwreq_data wrqu; - - printk("%s: enter........connect=%d\n", __func__, priv->connect_status); - - if (priv->connect_status != LBS_CONNECTED) - return; - - lbs_deb_enter(LBS_DEB_ASSOC); - - memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - - /* - * Cisco AP sends EAP failure and de-auth in less than 0.5 ms. - * It causes problem in the Supplicant - */ - - msleep_interruptible(1000); - wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); - - /* report disconnect to upper layer */ - netif_stop_queue(priv->dev); - netif_carrier_off(priv->dev); - - /* Free Tx and Rx packets */ - kfree_skb(priv->currenttxskb); - priv->currenttxskb = NULL; - priv->tx_pending_len = 0; - - /* reset SNR/NF/RSSI values */ - memset(priv->SNR, 0x00, sizeof(priv->SNR)); - memset(priv->NF, 0x00, sizeof(priv->NF)); - memset(priv->RSSI, 0x00, sizeof(priv->RSSI)); - memset(priv->rawSNR, 0x00, sizeof(priv->rawSNR)); - memset(priv->rawNF, 0x00, sizeof(priv->rawNF)); - priv->nextSNRNF = 0; - priv->numSNRNF = 0; - priv->connect_status = LBS_DISCONNECTED; - - /* Clear out associated SSID and BSSID since connection is - * no longer valid. - */ - memset(&priv->curbssparams.bssid, 0, ETH_ALEN); - memset(&priv->curbssparams.ssid, 0, IW_ESSID_MAX_SIZE); - priv->curbssparams.ssid_len = 0; - - if (priv->psstate != PS_STATE_FULL_POWER) { - /* make firmware to exit PS mode */ - lbs_deb_cmd("disconnected, so exit PS mode\n"); - lbs_ps_wakeup(priv, 0); - } - lbs_deb_leave(LBS_DEB_ASSOC); -} - -/** - * @brief This function handles MIC failure event. - * - * @param priv A pointer to struct lbs_private structure - * @para event the event id - * @return n/a - */ -static void handle_mic_failureevent(struct lbs_private *priv, u32 event) -{ - char buf[50]; - - lbs_deb_enter(LBS_DEB_CMD); - memset(buf, 0, sizeof(buf)); - - sprintf(buf, "%s", "MLME-MICHAELMICFAILURE.indication "); - - if (event == MACREG_INT_CODE_MIC_ERR_UNICAST) { - strcat(buf, "unicast "); - } else { - strcat(buf, "multicast "); - } - - lbs_send_iwevcustom_event(priv, buf); - lbs_deb_leave(LBS_DEB_CMD); -} - -static int lbs_ret_reg_access(struct lbs_private *priv, - u16 type, struct cmd_ds_command *resp) -{ - int ret = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - switch (type) { - case CMD_RET(CMD_MAC_REG_ACCESS): - { - struct cmd_ds_mac_reg_access *reg = &resp->params.macreg; - - priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); - priv->offsetvalue.value = le32_to_cpu(reg->value); - break; - } - - case CMD_RET(CMD_BBP_REG_ACCESS): - { - struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg; - - priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); - priv->offsetvalue.value = reg->value; - break; - } - - case CMD_RET(CMD_RF_REG_ACCESS): - { - struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg; - - priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); - priv->offsetvalue.value = reg->value; - break; - } - - default: - ret = -1; - } - - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - return ret; -} - -static int lbs_ret_802_11_rssi(struct lbs_private *priv, - struct cmd_ds_command *resp) -{ - struct cmd_ds_802_11_rssi_rsp *rssirsp = &resp->params.rssirsp; - - lbs_deb_enter(LBS_DEB_CMD); - - /* store the non average value */ - priv->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR); - priv->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor); - - priv->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR); - priv->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor); - - priv->RSSI[TYPE_BEACON][TYPE_NOAVG] = - CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_NOAVG], - priv->NF[TYPE_BEACON][TYPE_NOAVG]); - - priv->RSSI[TYPE_BEACON][TYPE_AVG] = - CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE, - priv->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE); - - lbs_deb_cmd("RSSI: beacon %d, avg %d\n", - priv->RSSI[TYPE_BEACON][TYPE_NOAVG], - priv->RSSI[TYPE_BEACON][TYPE_AVG]); - - lbs_deb_leave(LBS_DEB_CMD); - return 0; -} - -static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, - struct cmd_ds_command *resp) -{ - struct cmd_ds_802_11_beacon_control *bcn_ctrl = - &resp->params.bcn_ctrl; - - lbs_deb_enter(LBS_DEB_CMD); - - if (bcn_ctrl->action == CMD_ACT_GET) { - priv->beacon_enable = (u8) le16_to_cpu(bcn_ctrl->beacon_enable); - priv->beacon_period = le16_to_cpu(bcn_ctrl->beacon_period); - } - - lbs_deb_enter(LBS_DEB_CMD); - return 0; -} - -static inline int handle_cmd_response(struct lbs_private *priv, - struct cmd_header *cmd_response) -{ - struct cmd_ds_command *resp = (struct cmd_ds_command *) cmd_response; - int ret = 0; - unsigned long flags; - uint16_t respcmd = le16_to_cpu(resp->command); - - lbs_deb_enter(LBS_DEB_HOST); - - switch (respcmd) { - case CMD_RET(CMD_MAC_REG_ACCESS): - case CMD_RET(CMD_BBP_REG_ACCESS): - case CMD_RET(CMD_RF_REG_ACCESS): - ret = lbs_ret_reg_access(priv, respcmd, resp); - break; - - case CMD_RET_802_11_ASSOCIATE: - case CMD_RET(CMD_802_11_ASSOCIATE): - case CMD_RET(CMD_802_11_REASSOCIATE): - ret = lbs_ret_80211_associate(priv, resp); - break; - - case CMD_RET(CMD_802_11_SET_AFC): - case CMD_RET(CMD_802_11_GET_AFC): - spin_lock_irqsave(&priv->driver_lock, flags); - memmove((void *)priv->cur_cmd->callback_arg, &resp->params.afc, - sizeof(struct cmd_ds_802_11_afc)); - spin_unlock_irqrestore(&priv->driver_lock, flags); - - break; - - case CMD_RET(CMD_802_11_AUTHENTICATE): - case CMD_RET(CMD_802_11_BEACON_STOP): - break; - - case CMD_RET(CMD_802_11_RSSI): - ret = lbs_ret_802_11_rssi(priv, resp); - break; - - case CMD_RET(CMD_802_11D_DOMAIN_INFO): - ret = lbs_ret_802_11d_domain_info(resp); - break; - - case CMD_RET(CMD_802_11_TPC_CFG): - spin_lock_irqsave(&priv->driver_lock, flags); - memmove((void *)priv->cur_cmd->callback_arg, &resp->params.tpccfg, - sizeof(struct cmd_ds_802_11_tpc_cfg)); - spin_unlock_irqrestore(&priv->driver_lock, flags); - break; - case CMD_RET(CMD_802_11_LED_GPIO_CTRL): - spin_lock_irqsave(&priv->driver_lock, flags); - memmove((void *)priv->cur_cmd->callback_arg, &resp->params.ledgpio, - sizeof(struct cmd_ds_802_11_led_ctrl)); - spin_unlock_irqrestore(&priv->driver_lock, flags); - break; - - case CMD_RET(CMD_GET_TSF): - spin_lock_irqsave(&priv->driver_lock, flags); - memcpy((void *)priv->cur_cmd->callback_arg, - &resp->params.gettsf.tsfvalue, sizeof(u64)); - spin_unlock_irqrestore(&priv->driver_lock, flags); - break; - case CMD_RET(CMD_BT_ACCESS): - spin_lock_irqsave(&priv->driver_lock, flags); - if (priv->cur_cmd->callback_arg) - memcpy((void *)priv->cur_cmd->callback_arg, - &resp->params.bt.addr1, 2 * ETH_ALEN); - spin_unlock_irqrestore(&priv->driver_lock, flags); - break; - case CMD_RET(CMD_FWT_ACCESS): - spin_lock_irqsave(&priv->driver_lock, flags); - if (priv->cur_cmd->callback_arg) - memcpy((void *)priv->cur_cmd->callback_arg, &resp->params.fwt, - sizeof(resp->params.fwt)); - spin_unlock_irqrestore(&priv->driver_lock, flags); - break; - case CMD_RET(CMD_802_11_BEACON_CTRL): - ret = lbs_ret_802_11_bcn_ctrl(priv, resp); - break; - - default: - lbs_pr_err("CMD_RESP: unknown cmd response 0x%04x\n", - le16_to_cpu(resp->command)); - break; - } - lbs_deb_leave(LBS_DEB_HOST); - return ret; -} - -int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len) -{ - uint16_t respcmd, curcmd; - struct cmd_header *resp; - int ret = 0; - unsigned long flags; - uint16_t result; - - lbs_deb_enter(LBS_DEB_HOST); - - mutex_lock(&priv->lock); - spin_lock_irqsave(&priv->driver_lock, flags); - - if (!priv->cur_cmd) { - lbs_deb_host("CMD_RESP: cur_cmd is NULL\n"); - ret = -1; - spin_unlock_irqrestore(&priv->driver_lock, flags); - goto done; - } - - resp = (void *)data; - curcmd = le16_to_cpu(priv->cur_cmd->cmdbuf->command); - respcmd = le16_to_cpu(resp->command); - result = le16_to_cpu(resp->result); - - lbs_deb_cmd("CMD_RESP: response 0x%04x, seq %d, size %d\n", - respcmd, le16_to_cpu(resp->seqnum), len); - lbs_deb_hex(LBS_DEB_CMD, "CMD_RESP", (void *) resp, len); - - if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) { - lbs_pr_info("Received CMD_RESP with invalid sequence %d (expected %d)\n", - le16_to_cpu(resp->seqnum), le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum)); - spin_unlock_irqrestore(&priv->driver_lock, flags); - ret = -1; - goto done; - } - if (respcmd != CMD_RET(curcmd) && - respcmd != CMD_RET_802_11_ASSOCIATE && curcmd != CMD_802_11_ASSOCIATE) { - lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd); - spin_unlock_irqrestore(&priv->driver_lock, flags); - ret = -1; - goto done; - } - - if (resp->result == cpu_to_le16(0x0004)) { - /* 0x0004 means -EAGAIN. Drop the response, let it time out - and be resubmitted */ - lbs_pr_info("Firmware returns DEFER to command %x. Will let it time out...\n", - le16_to_cpu(resp->command)); - spin_unlock_irqrestore(&priv->driver_lock, flags); - ret = -1; - goto done; - } - - /* Now we got response from FW, cancel the command timer */ - del_timer(&priv->command_timer); - priv->cmd_timed_out = 0; - if (priv->nr_retries) { - lbs_pr_info("Received result %x to command %x after %d retries\n", - result, curcmd, priv->nr_retries); - priv->nr_retries = 0; - } - - /* Store the response code to cur_cmd_retcode. */ - priv->cur_cmd_retcode = result; - - if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { - struct cmd_ds_802_11_ps_mode *psmode = (void *) &resp[1]; - u16 action = le16_to_cpu(psmode->action); - - lbs_deb_host( - "CMD_RESP: PS_MODE cmd reply result 0x%x, action 0x%x\n", - result, action); - - if (result) { - lbs_deb_host("CMD_RESP: PS command failed with 0x%x\n", - result); - /* - * We should not re-try enter-ps command in - * ad-hoc mode. It takes place in - * lbs_execute_next_command(). - */ - if (priv->mode == IW_MODE_ADHOC && - action == CMD_SUBCMD_ENTER_PS) - priv->psmode = LBS802_11POWERMODECAM; - } else if (action == CMD_SUBCMD_ENTER_PS) { - priv->needtowakeup = 0; - priv->psstate = PS_STATE_AWAKE; - - lbs_deb_host("CMD_RESP: ENTER_PS command response\n"); - if (priv->connect_status != LBS_CONNECTED) { - /* - * When Deauth Event received before Enter_PS command - * response, We need to wake up the firmware. - */ - lbs_deb_host( - "disconnected, invoking lbs_ps_wakeup\n"); - - spin_unlock_irqrestore(&priv->driver_lock, flags); - mutex_unlock(&priv->lock); - lbs_ps_wakeup(priv, 0); - mutex_lock(&priv->lock); - spin_lock_irqsave(&priv->driver_lock, flags); - } - } else if (action == CMD_SUBCMD_EXIT_PS) { - priv->needtowakeup = 0; - priv->psstate = PS_STATE_FULL_POWER; - lbs_deb_host("CMD_RESP: EXIT_PS command response\n"); - } else { - lbs_deb_host("CMD_RESP: PS action 0x%X\n", action); - } - - lbs_complete_command(priv, priv->cur_cmd, result); - spin_unlock_irqrestore(&priv->driver_lock, flags); - - ret = 0; - goto done; - } - - /* If the command is not successful, cleanup and return failure */ - if ((result != 0 || !(respcmd & 0x8000))) { - lbs_deb_host("CMD_RESP: error 0x%04x in command reply 0x%04x\n", - result, respcmd); - /* - * Handling errors here - */ - switch (respcmd) { - case CMD_RET(CMD_GET_HW_SPEC): - case CMD_RET(CMD_802_11_RESET): - lbs_deb_host("CMD_RESP: reset failed\n"); - break; - - } - lbs_complete_command(priv, priv->cur_cmd, result); - spin_unlock_irqrestore(&priv->driver_lock, flags); - - ret = -1; - goto done; - } - - spin_unlock_irqrestore(&priv->driver_lock, flags); - - if (priv->cur_cmd && priv->cur_cmd->callback) { - ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg, - resp); - } else - ret = handle_cmd_response(priv, resp); - - spin_lock_irqsave(&priv->driver_lock, flags); - - if (priv->cur_cmd) { - /* Clean up and Put current command back to cmdfreeq */ - lbs_complete_command(priv, priv->cur_cmd, result); - } - spin_unlock_irqrestore(&priv->driver_lock, flags); - -done: - mutex_unlock(&priv->lock); - lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); - return ret; -} - -static int lbs_send_confirmwake(struct lbs_private *priv) -{ - struct cmd_header cmd; - int ret = 0; - - lbs_deb_enter(LBS_DEB_HOST); - - cmd.command = cpu_to_le16(CMD_802_11_WAKEUP_CONFIRM); - cmd.size = cpu_to_le16(sizeof(cmd)); - cmd.seqnum = cpu_to_le16(++priv->seqnum); - cmd.result = 0; - - lbs_deb_hex(LBS_DEB_HOST, "wake confirm", (u8 *) &cmd, - sizeof(cmd)); - - ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) &cmd, sizeof(cmd)); - if (ret) - lbs_pr_alert("SEND_WAKEC_CMD: Host to Card failed for Confirm Wake\n"); - - lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); - return ret; -} - -#if (AUTO_REASSOC == 1) - -#if (ANDROID_POWER_SAVE == 1) -extern int wifi_ps_status; -#endif - -static inline void lbs_postpone_association_work(struct lbs_private *priv) -{ - if (priv->surpriseremoved) - return; - -#if (ANDROID_POWER_SAVE == 1) - - if (wifi_ps_status != WIFI_PS_AWAKE) - { - if ((wifi_ps_status == WIFI_PS_DRV_SLEEP) && - (priv->wifi_ps_work_req == 0)) - { - printk("Wakeup wifi for assoc.\n"); - priv->wifi_ps_work_req = WIFI_PS_PRE_WAKE; - /* - * Carrier off will make dhcpcd do discover....Yongle Lai. - */ - netif_stop_queue(priv->dev); - //netif_carrier_off(priv->dev); - queue_delayed_work(priv->work_thread, &priv->ps_work, - msecs_to_jiffies(5)); - msleep(900); - } - } - else - lbs_update_ps_timer(); -#endif - //printk("Got a assoc related command....\n"); - cancel_delayed_work(&priv->assoc_work); - queue_delayed_work(priv->work_thread, &priv->assoc_work, 10); -} - -int lbs_disconnect_prepare(struct lbs_private *priv) -{ - struct assoc_request *assoc_req; - - if (priv->prev_assoc_req->flags != 0) - { - assoc_req = lbs_get_association_request(priv); - if ((assoc_req != NULL) && priv->prev_assoc_req) - { - printk("Trying to re-associate to previous AP.\n"); - memcpy(assoc_req, priv->prev_assoc_req, sizeof(struct assoc_request)); - priv->prev_assoc_req->flags = 0; /* Clear this association. */ - lbs_postpone_association_work(priv); - return 1; - } - } - atomic_set(&reassoc_flag, 0); - printk("%s: go to be disconnected.\n", __func__); - - lbs_mac_event_disconnected(priv); - - return 0; -} -#endif - -extern int lbs_reset_deep_sleep_wakeup(struct lbs_private * priv); - -int lbs_process_event(struct lbs_private *priv, u32 event) -{ - int ret = 0; - //static int reassoc_count = 0; - - lbs_deb_enter(LBS_DEB_CMD); - - switch (event) { - case MACREG_INT_CODE_LINK_SENSED: - lbs_deb_cmd("EVENT: link sensed\n"); - printk("EVENT: link sensed\n"); - break; - - case MACREG_INT_CODE_DISASSOCIATED: - printk("EVENT: disassociated: connected=%d\n", priv->connect_status); - lbs_mac_event_disconnected(priv); -#if 0 -#if (AUTO_REASSOC == 1) - if (priv->connect_status == LBS_CONNECTED) - lbs_disconnect_prepare(priv); - else - { - printk("disconnected status.\n"); - lbs_mac_event_disconnected(priv); - } -#else - lbs_mac_event_disconnected(priv); -#endif -#endif - break; - - case MACREG_INT_CODE_LINK_LOST_NO_SCAN: - case MACREG_INT_CODE_DEAUTHENTICATED: - /* - * The DEAUTHENTICATED event will be triggered by conditions: - * 1. Authentication was failed. - * 2. Authentication was expired. - */ - if (event == MACREG_INT_CODE_DEAUTHENTICATED) - printk("EVENT: deauthenticated: "); - else - printk("EVENT: link lost: "); - -#if (AUTO_REASSOC == 1) - - printk("reassoc_count=%d\n", priv->reassoc_count); - - if ((priv->connect_status == LBS_CONNECTED) && - (priv->reassoc_count < 2) && - (priv->need_reassoc == 1)) - { - atomic_set(&reassoc_flag, 1); - lbs_disconnect_prepare(priv); - priv->reassoc_count++; - } - else - { - printk("disconnected status.\n"); - lbs_mac_event_disconnected(priv); - priv->reassoc_count = 0; - } -#else - printk("\n"); - lbs_mac_event_disconnected(priv); -#endif - break; - - case MACREG_INT_CODE_PS_SLEEP: - lbs_deb_cmd("EVENT: ps sleep\n"); - - /* handle unexpected PS SLEEP event */ - if (priv->psstate == PS_STATE_FULL_POWER) { - lbs_deb_cmd( - "EVENT: in FULL POWER mode, ignoreing PS_SLEEP\n"); - break; - } - priv->psstate = PS_STATE_PRE_SLEEP; - - lbs_ps_confirm_sleep(priv); - - break; - - case MACREG_INT_CODE_HOST_AWAKE: - lbs_deb_cmd("EVENT: host awake\n"); - lbs_send_confirmwake(priv); - break; - - case MACREG_INT_CODE_PS_AWAKE: - lbs_deb_cmd("EVENT: ps awake\n"); -#if 0 - printk("EVENT: ps awake: "); - if (priv->connect_status == LBS_CONNECTED) - printk("Media is LBS_CONNECTED.\n"); - else - printk("Media is LBS_DISCONNECTED.\n"); -#endif - /* - * Handle unexpected PS AWAKE event. - */ - if (priv->psstate == PS_STATE_FULL_POWER) { - lbs_deb_cmd("EVENT: In FULL POWER mode - ignore PS AWAKE\n"); - break; - } - - priv->psstate = PS_STATE_AWAKE; - - if (priv->needtowakeup) { - /* - * wait for the command processing to finish - * before resuming sending - * priv->needtowakeup will be set to FALSE - * in lbs_ps_wakeup() - */ - lbs_deb_cmd("waking up ...\n"); - lbs_ps_wakeup(priv, 0); - } - break; - - case MACREG_INT_CODE_MIC_ERR_UNICAST: - lbs_deb_cmd("EVENT: UNICAST MIC ERROR\n"); - handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST); - break; - - case MACREG_INT_CODE_MIC_ERR_MULTICAST: - lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n"); - handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST); - break; - - case MACREG_INT_CODE_MIB_CHANGED: - lbs_deb_cmd("EVENT: MIB CHANGED\n"); - break; - case MACREG_INT_CODE_INIT_DONE: - lbs_deb_cmd("EVENT: INIT DONE\n"); - break; - case MACREG_INT_CODE_ADHOC_BCN_LOST: - lbs_deb_cmd("EVENT: ADHOC beacon lost\n"); - break; - case MACREG_INT_CODE_RSSI_LOW: - lbs_pr_alert("EVENT: rssi low\n"); - break; - case MACREG_INT_CODE_SNR_LOW: - lbs_pr_alert("EVENT: snr low\n"); - break; - case MACREG_INT_CODE_MAX_FAIL: - printk("EVENT: max fail\n"); - break; - case MACREG_INT_CODE_RSSI_HIGH: - lbs_pr_alert("EVENT: rssi high\n"); - break; - case MACREG_INT_CODE_SNR_HIGH: - lbs_pr_alert("EVENT: snr high\n"); - break; - - case MACREG_INT_CODE_DEEP_SLEEP_AWAKE: - lbs_reset_deep_sleep_wakeup(priv); - if (priv->deepsleep == true) - { - priv->deepsleep = false; - priv->needtowakeup = 0; - } - printk("DEEP SLEEP AWAKE: Wakeup the caller.\n"); - wake_up_interruptible(&priv->ds_waitq); - - break; - - default: - printk("EVENT: unknown event id %d\n", event); - break; - } - - lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); - - return ret; -} - diff --git a/drivers/net/wireless/mv8686/debugfs.c b/drivers/net/wireless/mv8686/debugfs.c deleted file mode 100755 index 2f76874a8b32..000000000000 --- a/drivers/net/wireless/mv8686/debugfs.c +++ /dev/null @@ -1,969 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "lib80211.h" - -#include "dev.h" -#include "decl.h" -#include "host.h" -#include "debugfs.h" -#include "cmd.h" - -static struct dentry *lbs_dir; -static char *szStates[] = { - "Connected", - "Disconnected" -}; - -#ifdef PROC_DEBUG -static void lbs_debug_init(struct lbs_private *priv); -#endif - -static int open_file_generic(struct inode *inode, struct file *file) -{ - file->private_data = inode->i_private; - return 0; -} - -static ssize_t write_file_dummy(struct file *file, const char __user *buf, - size_t count, loff_t *ppos) -{ - return -EINVAL; -} - -static const size_t len = PAGE_SIZE; - -static ssize_t lbs_dev_info(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - size_t pos = 0; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - ssize_t res; - - pos += snprintf(buf+pos, len-pos, "state = %s\n", - szStates[priv->connect_status]); - pos += snprintf(buf+pos, len-pos, "region_code = %02x\n", - (u32) priv->regioncode); - - res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - - free_page(addr); - return res; -} - - -static ssize_t lbs_getscantable(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - size_t pos = 0; - int numscansdone = 0, res; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - DECLARE_SSID_BUF(ssid); - struct bss_descriptor * iter_bss; - - pos += snprintf(buf+pos, len-pos, - "# | ch | rssi | bssid | cap | Qual | SSID \n"); - - mutex_lock(&priv->lock); - list_for_each_entry (iter_bss, &priv->network_list, list) { - u16 ibss = (iter_bss->capability & WLAN_CAPABILITY_IBSS); - u16 privacy = (iter_bss->capability & WLAN_CAPABILITY_PRIVACY); - u16 spectrum_mgmt = (iter_bss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT); - - pos += snprintf(buf+pos, len-pos, "%02u| %03d | %04d | %pM |", - numscansdone, iter_bss->channel, iter_bss->rssi, - iter_bss->bssid); - pos += snprintf(buf+pos, len-pos, " %04x-", iter_bss->capability); - pos += snprintf(buf+pos, len-pos, "%c%c%c |", - ibss ? 'A' : 'I', privacy ? 'P' : ' ', - spectrum_mgmt ? 'S' : ' '); - pos += snprintf(buf+pos, len-pos, " %04d |", SCAN_RSSI(iter_bss->rssi)); - pos += snprintf(buf+pos, len-pos, " %s\n", - mv8686_print_ssid(ssid, iter_bss->ssid, - iter_bss->ssid_len)); - - numscansdone++; - } - mutex_unlock(&priv->lock); - - res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - - free_page(addr); - return res; -} - -static ssize_t lbs_sleepparams_write(struct file *file, - const char __user *user_buf, size_t count, - loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t buf_size, ret; - struct sleep_params sp; - int p1, p2, p3, p4, p5, p6; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, user_buf, buf_size)) { - ret = -EFAULT; - goto out_unlock; - } - ret = sscanf(buf, "%d %d %d %d %d %d", &p1, &p2, &p3, &p4, &p5, &p6); - if (ret != 6) { - ret = -EINVAL; - goto out_unlock; - } - sp.sp_error = p1; - sp.sp_offset = p2; - sp.sp_stabletime = p3; - sp.sp_calcontrol = p4; - sp.sp_extsleepclk = p5; - sp.sp_reserved = p6; - - ret = lbs_cmd_802_11_sleep_params(priv, CMD_ACT_SET, &sp); - if (!ret) - ret = count; - else if (ret > 0) - ret = -EINVAL; - -out_unlock: - free_page(addr); - return ret; -} - -static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t ret; - size_t pos = 0; - struct sleep_params sp; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - ret = lbs_cmd_802_11_sleep_params(priv, CMD_ACT_GET, &sp); - if (ret) - goto out_unlock; - - pos += snprintf(buf, len, "%d %d %d %d %d %d\n", sp.sp_error, - sp.sp_offset, sp.sp_stabletime, - sp.sp_calcontrol, sp.sp_extsleepclk, - sp.sp_reserved); - - ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - -out_unlock: - free_page(addr); - return ret; -} - -/* - * When calling CMD_802_11_SUBSCRIBE_EVENT with CMD_ACT_GET, me might - * get a bunch of vendor-specific TLVs (a.k.a. IEs) back from the - * firmware. Here's an example: - * 04 01 02 00 00 00 05 01 02 00 00 00 06 01 02 00 - * 00 00 07 01 02 00 3c 00 00 00 00 00 00 00 03 03 - * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - * - * The 04 01 is the TLV type (here TLV_TYPE_RSSI_LOW), 02 00 is the length, - * 00 00 are the data bytes of this TLV. For this TLV, their meaning is - * defined in mrvlietypes_thresholds - * - * This function searches in this TLV data chunk for a given TLV type - * and returns a pointer to the first data byte of the TLV, or to NULL - * if the TLV hasn't been found. - */ -static void *lbs_tlv_find(uint16_t tlv_type, const uint8_t *tlv, uint16_t size) -{ - struct mrvlietypesheader *tlv_h; - uint16_t length; - ssize_t pos = 0; - - while (pos < size) { - tlv_h = (struct mrvlietypesheader *) tlv; - if (!tlv_h->len) - return NULL; - if (tlv_h->type == cpu_to_le16(tlv_type)) - return tlv_h; - length = le16_to_cpu(tlv_h->len) + sizeof(*tlv_h); - pos += length; - tlv += length; - } - return NULL; -} - - -static ssize_t lbs_threshold_read(uint16_t tlv_type, uint16_t event_mask, - struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct cmd_ds_802_11_subscribe_event *subscribed; - struct mrvlietypes_thresholds *got; - struct lbs_private *priv = file->private_data; - ssize_t ret = 0; - size_t pos = 0; - char *buf; - u8 value; - u8 freq; - int events = 0; - - buf = (char *)get_zeroed_page(GFP_KERNEL); - if (!buf) - return -ENOMEM; - - subscribed = kzalloc(sizeof(*subscribed), GFP_KERNEL); - if (!subscribed) { - ret = -ENOMEM; - goto out_page; - } - - subscribed->hdr.size = cpu_to_le16(sizeof(*subscribed)); - subscribed->action = cpu_to_le16(CMD_ACT_GET); - - ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, subscribed); - if (ret) - goto out_cmd; - - got = lbs_tlv_find(tlv_type, subscribed->tlv, sizeof(subscribed->tlv)); - if (got) { - value = got->value; - freq = got->freq; - events = le16_to_cpu(subscribed->events); - - pos += snprintf(buf, len, "%d %d %d\n", value, freq, - !!(events & event_mask)); - } - - ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - - out_cmd: - kfree(subscribed); - - out_page: - free_page((unsigned long)buf); - return ret; -} - - -static ssize_t lbs_threshold_write(uint16_t tlv_type, uint16_t event_mask, - struct file *file, - const char __user *userbuf, size_t count, - loff_t *ppos) -{ - struct cmd_ds_802_11_subscribe_event *events; - struct mrvlietypes_thresholds *tlv; - struct lbs_private *priv = file->private_data; - ssize_t buf_size; - int value, freq, new_mask; - uint16_t curr_mask; - char *buf; - int ret; - - buf = (char *)get_zeroed_page(GFP_KERNEL); - if (!buf) - return -ENOMEM; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - ret = -EFAULT; - goto out_page; - } - ret = sscanf(buf, "%d %d %d", &value, &freq, &new_mask); - if (ret != 3) { - ret = -EINVAL; - goto out_page; - } - events = kzalloc(sizeof(*events), GFP_KERNEL); - if (!events) { - ret = -ENOMEM; - goto out_page; - } - - events->hdr.size = cpu_to_le16(sizeof(*events)); - events->action = cpu_to_le16(CMD_ACT_GET); - - ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, events); - if (ret) - goto out_events; - - curr_mask = le16_to_cpu(events->events); - - if (new_mask) - new_mask = curr_mask | event_mask; - else - new_mask = curr_mask & ~event_mask; - - /* Now everything is set and we can send stuff down to the firmware */ - - tlv = (void *)events->tlv; - - events->action = cpu_to_le16(CMD_ACT_SET); - events->events = cpu_to_le16(new_mask); - tlv->header.type = cpu_to_le16(tlv_type); - tlv->header.len = cpu_to_le16(sizeof(*tlv) - sizeof(tlv->header)); - tlv->value = value; - if (tlv_type != TLV_TYPE_BCNMISS) - tlv->freq = freq; - - /* The command header, the action, the event mask, and one TLV */ - events->hdr.size = cpu_to_le16(sizeof(events->hdr) + 4 + sizeof(*tlv)); - - ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, events); - - if (!ret) - ret = count; - out_events: - kfree(events); - out_page: - free_page((unsigned long)buf); - return ret; -} - - -static ssize_t lbs_lowrssi_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_read(TLV_TYPE_RSSI_LOW, CMD_SUBSCRIBE_RSSI_LOW, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_lowrssi_write(struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_write(TLV_TYPE_RSSI_LOW, CMD_SUBSCRIBE_RSSI_LOW, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_lowsnr_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_read(TLV_TYPE_SNR_LOW, CMD_SUBSCRIBE_SNR_LOW, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_lowsnr_write(struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_write(TLV_TYPE_SNR_LOW, CMD_SUBSCRIBE_SNR_LOW, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_failcount_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_read(TLV_TYPE_FAILCOUNT, CMD_SUBSCRIBE_FAILCOUNT, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_failcount_write(struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_write(TLV_TYPE_FAILCOUNT, CMD_SUBSCRIBE_FAILCOUNT, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_highrssi_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_read(TLV_TYPE_RSSI_HIGH, CMD_SUBSCRIBE_RSSI_HIGH, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_highrssi_write(struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_write(TLV_TYPE_RSSI_HIGH, CMD_SUBSCRIBE_RSSI_HIGH, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_highsnr_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_read(TLV_TYPE_SNR_HIGH, CMD_SUBSCRIBE_SNR_HIGH, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_highsnr_write(struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_write(TLV_TYPE_SNR_HIGH, CMD_SUBSCRIBE_SNR_HIGH, - file, userbuf, count, ppos); -} - -static ssize_t lbs_bcnmiss_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_read(TLV_TYPE_BCNMISS, CMD_SUBSCRIBE_BCNMISS, - file, userbuf, count, ppos); -} - - -static ssize_t lbs_bcnmiss_write(struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) -{ - return lbs_threshold_write(TLV_TYPE_BCNMISS, CMD_SUBSCRIBE_BCNMISS, - file, userbuf, count, ppos); -} - - - -static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - struct lbs_offset_value offval; - ssize_t pos = 0; - int ret; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - offval.offset = priv->mac_offset; - offval.value = 0; - - ret = lbs_prepare_and_send_command(priv, - CMD_MAC_REG_ACCESS, 0, - CMD_OPTION_WAITFORRSP, 0, &offval); - mdelay(10); - pos += snprintf(buf+pos, len-pos, "MAC[0x%x] = 0x%08x\n", - priv->mac_offset, priv->offsetvalue.value); - - ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - free_page(addr); - return ret; -} - -static ssize_t lbs_rdmac_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t res, buf_size; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - priv->mac_offset = simple_strtoul((char *)buf, NULL, 16); - res = count; -out_unlock: - free_page(addr); - return res; -} - -static ssize_t lbs_wrmac_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - - struct lbs_private *priv = file->private_data; - ssize_t res, buf_size; - u32 offset, value; - struct lbs_offset_value offval; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - res = sscanf(buf, "%x %x", &offset, &value); - if (res != 2) { - res = -EFAULT; - goto out_unlock; - } - - offval.offset = offset; - offval.value = value; - res = lbs_prepare_and_send_command(priv, - CMD_MAC_REG_ACCESS, 1, - CMD_OPTION_WAITFORRSP, 0, &offval); - mdelay(10); - - res = count; -out_unlock: - free_page(addr); - return res; -} - -static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - struct lbs_offset_value offval; - ssize_t pos = 0; - int ret; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - offval.offset = priv->bbp_offset; - offval.value = 0; - - ret = lbs_prepare_and_send_command(priv, - CMD_BBP_REG_ACCESS, 0, - CMD_OPTION_WAITFORRSP, 0, &offval); - mdelay(10); - pos += snprintf(buf+pos, len-pos, "BBP[0x%x] = 0x%08x\n", - priv->bbp_offset, priv->offsetvalue.value); - - ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - free_page(addr); - - return ret; -} - -static ssize_t lbs_rdbbp_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t res, buf_size; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - priv->bbp_offset = simple_strtoul((char *)buf, NULL, 16); - res = count; -out_unlock: - free_page(addr); - return res; -} - -static ssize_t lbs_wrbbp_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - - struct lbs_private *priv = file->private_data; - ssize_t res, buf_size; - u32 offset, value; - struct lbs_offset_value offval; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - res = sscanf(buf, "%x %x", &offset, &value); - if (res != 2) { - res = -EFAULT; - goto out_unlock; - } - - offval.offset = offset; - offval.value = value; - res = lbs_prepare_and_send_command(priv, - CMD_BBP_REG_ACCESS, 1, - CMD_OPTION_WAITFORRSP, 0, &offval); - mdelay(10); - - res = count; -out_unlock: - free_page(addr); - return res; -} - -static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - struct lbs_offset_value offval; - ssize_t pos = 0; - int ret; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - offval.offset = priv->rf_offset; - offval.value = 0; - - ret = lbs_prepare_and_send_command(priv, - CMD_RF_REG_ACCESS, 0, - CMD_OPTION_WAITFORRSP, 0, &offval); - mdelay(10); - pos += snprintf(buf+pos, len-pos, "RF[0x%x] = 0x%08x\n", - priv->rf_offset, priv->offsetvalue.value); - - ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - free_page(addr); - - return ret; -} - -static ssize_t lbs_rdrf_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct lbs_private *priv = file->private_data; - ssize_t res, buf_size; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - priv->rf_offset = simple_strtoul(buf, NULL, 16); - res = count; -out_unlock: - free_page(addr); - return res; -} - -static ssize_t lbs_wrrf_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) -{ - - struct lbs_private *priv = file->private_data; - ssize_t res, buf_size; - u32 offset, value; - struct lbs_offset_value offval; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - buf_size = min(count, len - 1); - if (copy_from_user(buf, userbuf, buf_size)) { - res = -EFAULT; - goto out_unlock; - } - res = sscanf(buf, "%x %x", &offset, &value); - if (res != 2) { - res = -EFAULT; - goto out_unlock; - } - - offval.offset = offset; - offval.value = value; - res = lbs_prepare_and_send_command(priv, - CMD_RF_REG_ACCESS, 1, - CMD_OPTION_WAITFORRSP, 0, &offval); - mdelay(10); - - res = count; -out_unlock: - free_page(addr); - return res; -} - -#define FOPS(fread, fwrite) { \ - .owner = THIS_MODULE, \ - .open = open_file_generic, \ - .read = (fread), \ - .write = (fwrite), \ -} - -struct lbs_debugfs_files { - const char *name; - int perm; - struct file_operations fops; -}; - -static const struct lbs_debugfs_files debugfs_files[] = { - { "info", 0444, FOPS(lbs_dev_info, write_file_dummy), }, - { "getscantable", 0444, FOPS(lbs_getscantable, - write_file_dummy), }, - { "sleepparams", 0644, FOPS(lbs_sleepparams_read, - lbs_sleepparams_write), }, -}; - -static const struct lbs_debugfs_files debugfs_events_files[] = { - {"low_rssi", 0644, FOPS(lbs_lowrssi_read, - lbs_lowrssi_write), }, - {"low_snr", 0644, FOPS(lbs_lowsnr_read, - lbs_lowsnr_write), }, - {"failure_count", 0644, FOPS(lbs_failcount_read, - lbs_failcount_write), }, - {"beacon_missed", 0644, FOPS(lbs_bcnmiss_read, - lbs_bcnmiss_write), }, - {"high_rssi", 0644, FOPS(lbs_highrssi_read, - lbs_highrssi_write), }, - {"high_snr", 0644, FOPS(lbs_highsnr_read, - lbs_highsnr_write), }, -}; - -static const struct lbs_debugfs_files debugfs_regs_files[] = { - {"rdmac", 0644, FOPS(lbs_rdmac_read, lbs_rdmac_write), }, - {"wrmac", 0600, FOPS(NULL, lbs_wrmac_write), }, - {"rdbbp", 0644, FOPS(lbs_rdbbp_read, lbs_rdbbp_write), }, - {"wrbbp", 0600, FOPS(NULL, lbs_wrbbp_write), }, - {"rdrf", 0644, FOPS(lbs_rdrf_read, lbs_rdrf_write), }, - {"wrrf", 0600, FOPS(NULL, lbs_wrrf_write), }, -}; - -void lbs_debugfs_init(void) -{ - if (!lbs_dir) - lbs_dir = debugfs_create_dir("lbs_wireless", NULL); - - return; -} - -void lbs_debugfs_remove(void) -{ - if (lbs_dir) - debugfs_remove(lbs_dir); - return; -} - -void lbs_debugfs_init_one(struct lbs_private *priv, struct net_device *dev) -{ - int i; - const struct lbs_debugfs_files *files; - if (!lbs_dir) - goto exit; - - priv->debugfs_dir = debugfs_create_dir(dev->name, lbs_dir); - if (!priv->debugfs_dir) - goto exit; - - for (i=0; idebugfs_files[i] = debugfs_create_file(files->name, - files->perm, - priv->debugfs_dir, - priv, - &files->fops); - } - - priv->events_dir = debugfs_create_dir("subscribed_events", priv->debugfs_dir); - if (!priv->events_dir) - goto exit; - - for (i=0; idebugfs_events_files[i] = debugfs_create_file(files->name, - files->perm, - priv->events_dir, - priv, - &files->fops); - } - - priv->regs_dir = debugfs_create_dir("registers", priv->debugfs_dir); - if (!priv->regs_dir) - goto exit; - - for (i=0; idebugfs_regs_files[i] = debugfs_create_file(files->name, - files->perm, - priv->regs_dir, - priv, - &files->fops); - } - -#ifdef PROC_DEBUG - lbs_debug_init(priv); -#endif -exit: - return; -} - -void lbs_debugfs_remove_one(struct lbs_private *priv) -{ - int i; - - for(i=0; idebugfs_regs_files[i]); - - debugfs_remove(priv->regs_dir); - - for(i=0; idebugfs_events_files[i]); - - debugfs_remove(priv->events_dir); -#ifdef PROC_DEBUG - debugfs_remove(priv->debugfs_debug); -#endif - for(i=0; idebugfs_files[i]); - debugfs_remove(priv->debugfs_dir); -} - - - -/* debug entry */ - -#ifdef PROC_DEBUG - -#define item_size(n) (FIELD_SIZEOF(struct lbs_private, n)) -#define item_addr(n) (offsetof(struct lbs_private, n)) - - -struct debug_data { - char name[32]; - u32 size; - size_t addr; -}; - -/* To debug any member of struct lbs_private, simply add one line here. - */ -static struct debug_data items[] = { - {"psmode", item_size(psmode), item_addr(psmode)}, - {"psstate", item_size(psstate), item_addr(psstate)}, -}; - -static int num_of_items = ARRAY_SIZE(items); - -/** - * @brief proc read function - * - * @param page pointer to buffer - * @param s read data starting position - * @param off offset - * @param cnt counter - * @param eof end of file flag - * @param data data to output - * @return number of output data - */ -static ssize_t lbs_debugfs_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - int val = 0; - size_t pos = 0; - ssize_t res; - char *p; - int i; - struct debug_data *d; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - p = buf; - - d = (struct debug_data *)file->private_data; - - for (i = 0; i < num_of_items; i++) { - if (d[i].size == 1) - val = *((u8 *) d[i].addr); - else if (d[i].size == 2) - val = *((u16 *) d[i].addr); - else if (d[i].size == 4) - val = *((u32 *) d[i].addr); - else if (d[i].size == 8) - val = *((u64 *) d[i].addr); - - pos += sprintf(p + pos, "%s=%d\n", d[i].name, val); - } - - res = simple_read_from_buffer(userbuf, count, ppos, p, pos); - - free_page(addr); - return res; -} - -/** - * @brief proc write function - * - * @param f file pointer - * @param buf pointer to data buffer - * @param cnt data number to write - * @param data data to write - * @return number of data - */ -static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf, - size_t cnt, loff_t *ppos) -{ - int r, i; - char *pdata; - char *p; - char *p0; - char *p1; - char *p2; - struct debug_data *d = (struct debug_data *)f->private_data; - - pdata = kmalloc(cnt, GFP_KERNEL); - if (pdata == NULL) - return 0; - - if (copy_from_user(pdata, buf, cnt)) { - lbs_deb_debugfs("Copy from user failed\n"); - kfree(pdata); - return 0; - } - - p0 = pdata; - for (i = 0; i < num_of_items; i++) { - do { - p = strstr(p0, d[i].name); - if (p == NULL) - break; - p1 = strchr(p, '\n'); - if (p1 == NULL) - break; - p0 = p1++; - p2 = strchr(p, '='); - if (!p2) - break; - p2++; - r = simple_strtoul(p2, NULL, 0); - if (d[i].size == 1) - *((u8 *) d[i].addr) = (u8) r; - else if (d[i].size == 2) - *((u16 *) d[i].addr) = (u16) r; - else if (d[i].size == 4) - *((u32 *) d[i].addr) = (u32) r; - else if (d[i].size == 8) - *((u64 *) d[i].addr) = (u64) r; - break; - } while (1); - } - kfree(pdata); - - return (ssize_t)cnt; -} - -static const struct file_operations lbs_debug_fops = { - .owner = THIS_MODULE, - .open = open_file_generic, - .write = lbs_debugfs_write, - .read = lbs_debugfs_read, -}; - -/** - * @brief create debug proc file - * - * @param priv pointer struct lbs_private - * @param dev pointer net_device - * @return N/A - */ -static void lbs_debug_init(struct lbs_private *priv) -{ - int i; - - if (!priv->debugfs_dir) - return; - - for (i = 0; i < num_of_items; i++) - items[i].addr += (size_t) priv; - - priv->debugfs_debug = debugfs_create_file("debug", 0644, - priv->debugfs_dir, &items[0], - &lbs_debug_fops); -} -#endif diff --git a/drivers/net/wireless/mv8686/debugfs.h b/drivers/net/wireless/mv8686/debugfs.h deleted file mode 100755 index f2b9c7ffe0fd..000000000000 --- a/drivers/net/wireless/mv8686/debugfs.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _LBS_DEBUGFS_H_ -#define _LBS_DEBUGFS_H_ - -void lbs_debugfs_init(void); -void lbs_debugfs_remove(void); - -void lbs_debugfs_init_one(struct lbs_private *priv, struct net_device *dev); -void lbs_debugfs_remove_one(struct lbs_private *priv); - -#endif diff --git a/drivers/net/wireless/mv8686/decl.h b/drivers/net/wireless/mv8686/decl.h deleted file mode 100755 index 1f81b09d196d..000000000000 --- a/drivers/net/wireless/mv8686/decl.h +++ /dev/null @@ -1,80 +0,0 @@ -/** - * This file contains declaration referring to - * functions defined in other source files - */ - -#ifndef _LBS_DECL_H_ -#define _LBS_DECL_H_ - -#include - -#include "defs.h" - -/** Function Prototype Declaration */ -struct lbs_private; -struct sk_buff; -struct net_device; -struct cmd_ctrl_node; -struct cmd_ds_command; - -void lbs_set_mac_control(struct lbs_private *priv); - -void lbs_send_tx_feedback(struct lbs_private *priv, u32 try_count); - -int lbs_free_cmd_buffer(struct lbs_private *priv); - -int lbs_prepare_and_send_command(struct lbs_private *priv, - u16 cmd_no, - u16 cmd_action, - u16 wait_option, u32 cmd_oid, void *pdata_buf); - -int lbs_allocate_cmd_buffer(struct lbs_private *priv); -int lbs_execute_next_command(struct lbs_private *priv); -int lbs_process_event(struct lbs_private *priv, u32 event); -void lbs_queue_event(struct lbs_private *priv, u32 event); -void lbs_notify_command_response(struct lbs_private *priv, u8 resp_idx); - -u32 lbs_fw_index_to_data_rate(u8 index); -u8 lbs_data_rate_to_fw_index(u32 rate); - -/** The proc fs interface */ -int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len); -void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, - int result); -int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); -int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band); - -int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *); - -void lbs_ps_sleep(struct lbs_private *priv, int wait_option); -void lbs_ps_confirm_sleep(struct lbs_private *priv); -void lbs_ps_wakeup(struct lbs_private *priv, int wait_option); - -struct chan_freq_power *lbs_find_cfp_by_band_and_channel( - struct lbs_private *priv, - u8 band, - u16 channel); - -void lbs_mac_event_disconnected(struct lbs_private *priv); - -void lbs_send_iwevcustom_event(struct lbs_private *priv, s8 *str); - -/* persistcfg.c */ -void lbs_persist_config_init(struct net_device *net); -void lbs_persist_config_remove(struct net_device *net); - -/* main.c */ -struct chan_freq_power *lbs_get_region_cfp_table(u8 region, - int *cfp_no); -struct lbs_private *lbs_add_card(void *card, struct device *dmdev); -void lbs_remove_card(struct lbs_private *priv); -int lbs_start_card(struct lbs_private *priv); -void lbs_stop_card(struct lbs_private *priv); -void lbs_host_to_card_done(struct lbs_private *priv); - -int lbs_update_channel(struct lbs_private *priv); -void lbs_update_ps_timer(void); -int lbs_exit_deep_sleep(struct lbs_private * priv); -int lbs_set_deepsleep(struct lbs_private * priv, u8 enable); - -#endif diff --git a/drivers/net/wireless/mv8686/defs.h b/drivers/net/wireless/mv8686/defs.h deleted file mode 100755 index f722900f5426..000000000000 --- a/drivers/net/wireless/mv8686/defs.h +++ /dev/null @@ -1,442 +0,0 @@ -/** - * This header file contains global constant/enum definitions, - * global variable declaration. - */ -#ifndef _LBS_DEFS_H_ -#define _LBS_DEFS_H_ - -#include - -#ifdef CONFIG_LIBERTAS_DEBUG -#define DEBUG -#define PROC_DEBUG -#endif - -#ifndef DRV_NAME -#define DRV_NAME "mv8686" -#endif - -#define RET_ASSOC_RETRY 0x101 - -/* - * Evaluate downloading speed for WiFi firmware. - */ -#define SDIO_SPEED_EVUL 1 - -/* - * When deauthenticate Event was received, we will - * try to re-associate once. - */ -#define AUTO_REASSOC 1 - -#define MV8686_SUPPORT_ADHOC 0 - -#define MV8686_SUPPORT_MCAST 0 - -/* - * According to Android's power management scheme. - */ -#define ANDROID_POWER_SAVE 0 - -#define WIFI_PS_AWAKE 0 -#define WIFI_PS_PRE_SLEEP 1 -#define WIFI_PS_SYS_PRE_SLEEP 2 -#define WIFI_PS_DRV_PRE_SLEEP 3 -#define WIFI_PS_SYS_SLEEP 4 -#define WIFI_PS_DRV_SLEEP 5 -#define WIFI_PS_PRE_WAKE 6 -#define WIFI_PS_DRV_PRE_WAKE 7 - -/* - * New power save scheme will be used. - */ -#define NEW_MV8686_PS 1 - -/* - * WIFI driver decide power save operation via a timer. - */ -#define DRIVER_DECIDE_POWER_SAVE 0 -//#define DRIVER_PS_TIMEOUT 240 * HZ -#define DRIVER_PS_TIMEOUT 120 * HZ -#define DRIVER_PS_FULLPOWER 0 -#define DRIVER_PS_POWERSAVE 1 -#define DRIVER_PS_AUTODP 2 -#define DRIVER_PS_WAKEUP 3 - -#define LBS_DEB_ENTER 0x00000001 -#define LBS_DEB_LEAVE 0x00000002 -#define LBS_DEB_MAIN 0x00000004 -#define LBS_DEB_NET 0x00000008 -#define LBS_DEB_MESH 0x00000010 -#define LBS_DEB_WEXT 0x00000020 -#define LBS_DEB_IOCTL 0x00000040 -#define LBS_DEB_SCAN 0x00000080 -#define LBS_DEB_ASSOC 0x00000100 -#define LBS_DEB_JOIN 0x00000200 -#define LBS_DEB_11D 0x00000400 -#define LBS_DEB_DEBUGFS 0x00000800 -#define LBS_DEB_ETHTOOL 0x00001000 -#define LBS_DEB_HOST 0x00002000 -#define LBS_DEB_CMD 0x00004000 -#define LBS_DEB_RX 0x00008000 -#define LBS_DEB_TX 0x00010000 -#define LBS_DEB_USB 0x00020000 -#define LBS_DEB_CS 0x00040000 -#define LBS_DEB_FW 0x00080000 -#define LBS_DEB_THREAD 0x00100000 -#define LBS_DEB_HEX 0x00200000 -#define LBS_DEB_SDIO 0x00400000 -#define LBS_DEB_SYSFS 0x00800000 -#define LBS_DEB_SPI 0x01000000 - -extern unsigned int lbs_debug; - -#ifdef DEBUG -#define LBS_DEB_LL(grp, grpnam, fmt, args...) \ -do { if ((lbs_debug & (grp)) == (grp)) \ - printk(KERN_DEBUG DRV_NAME grpnam "%s: " fmt, \ - in_interrupt() ? " (INT)" : "", ## args); } while (0) -#else -#define LBS_DEB_LL(grp, grpnam, fmt, args...) do {} while (0) -#endif - -#define lbs_deb_enter(grp) \ - LBS_DEB_LL(grp | LBS_DEB_ENTER, " enter", "%s()\n", __func__); -#define lbs_deb_enter_args(grp, fmt, args...) \ - LBS_DEB_LL(grp | LBS_DEB_ENTER, " enter", "%s(" fmt ")\n", __func__, ## args); -#define lbs_deb_leave(grp) \ - LBS_DEB_LL(grp | LBS_DEB_LEAVE, " leave", "%s()\n", __func__); -#define lbs_deb_leave_args(grp, fmt, args...) \ - LBS_DEB_LL(grp | LBS_DEB_LEAVE, " leave", "%s(), " fmt "\n", \ - __func__, ##args); -#define lbs_deb_main(fmt, args...) LBS_DEB_LL(LBS_DEB_MAIN, " main", fmt, ##args) -#define lbs_deb_net(fmt, args...) LBS_DEB_LL(LBS_DEB_NET, " net", fmt, ##args) -#define lbs_deb_mesh(fmt, args...) LBS_DEB_LL(LBS_DEB_MESH, " mesh", fmt, ##args) -#define lbs_deb_wext(fmt, args...) LBS_DEB_LL(LBS_DEB_WEXT, " wext", fmt, ##args) -#define lbs_deb_ioctl(fmt, args...) LBS_DEB_LL(LBS_DEB_IOCTL, " ioctl", fmt, ##args) -#define lbs_deb_scan(fmt, args...) LBS_DEB_LL(LBS_DEB_SCAN, " scan", fmt, ##args) -#define lbs_deb_assoc(fmt, args...) LBS_DEB_LL(LBS_DEB_ASSOC, " assoc", fmt, ##args) -#define lbs_deb_join(fmt, args...) LBS_DEB_LL(LBS_DEB_JOIN, " join", fmt, ##args) -#define lbs_deb_11d(fmt, args...) LBS_DEB_LL(LBS_DEB_11D, " 11d", fmt, ##args) -#define lbs_deb_debugfs(fmt, args...) LBS_DEB_LL(LBS_DEB_DEBUGFS, " debugfs", fmt, ##args) -#define lbs_deb_ethtool(fmt, args...) LBS_DEB_LL(LBS_DEB_ETHTOOL, " ethtool", fmt, ##args) -#define lbs_deb_host(fmt, args...) LBS_DEB_LL(LBS_DEB_HOST, " host", fmt, ##args) -#define lbs_deb_cmd(fmt, args...) LBS_DEB_LL(LBS_DEB_CMD, " cmd", fmt, ##args) -#define lbs_deb_rx(fmt, args...) LBS_DEB_LL(LBS_DEB_RX, " rx", fmt, ##args) -#define lbs_deb_tx(fmt, args...) LBS_DEB_LL(LBS_DEB_TX, " tx", fmt, ##args) -#define lbs_deb_fw(fmt, args...) LBS_DEB_LL(LBS_DEB_FW, " fw", fmt, ##args) -#define lbs_deb_usb(fmt, args...) LBS_DEB_LL(LBS_DEB_USB, " usb", fmt, ##args) -#define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, " usbd", "%s:" fmt, dev_name(dev), ##args) -#define lbs_deb_cs(fmt, args...) LBS_DEB_LL(LBS_DEB_CS, " cs", fmt, ##args) -#define lbs_deb_thread(fmt, args...) LBS_DEB_LL(LBS_DEB_THREAD, " thread", fmt, ##args) -#define lbs_deb_sdio(fmt, args...) LBS_DEB_LL(LBS_DEB_SDIO, " sdio", fmt, ##args) -#define lbs_deb_sysfs(fmt, args...) LBS_DEB_LL(LBS_DEB_SYSFS, " sysfs", fmt, ##args) -#define lbs_deb_spi(fmt, args...) LBS_DEB_LL(LBS_DEB_SPI, " spi", fmt, ##args) - -#define lbs_pr_info(format, args...) \ - printk(KERN_INFO DRV_NAME": " format, ## args) -#define lbs_pr_err(format, args...) \ - printk(KERN_ERR DRV_NAME": " format, ## args) -#define lbs_pr_alert(format, args...) \ - printk(KERN_ALERT DRV_NAME": " format, ## args) - -#ifdef DEBUG -static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len) -{ - int i = 0; - - if (len && - (lbs_debug & LBS_DEB_HEX) && - (lbs_debug & grp)) - { - for (i = 1; i <= len; i++) { - if ((i & 0xf) == 1) { - if (i != 1) - printk("\n"); - printk(DRV_NAME " %s: ", prompt); - } - printk("%02x ", (u8) * buf); - buf++; - } - printk("\n"); - } -} -#else -#define lbs_deb_hex(grp,prompt,buf,len) do {} while (0) -#endif - - - -/** Buffer Constants */ - -/* The size of SQ memory PPA, DPA are 8 DWORDs, that keep the physical -* addresses of TxPD buffers. Station has only 8 TxPD available, Whereas -* driver has more local TxPDs. Each TxPD on the host memory is associated -* with a Tx control node. The driver maintains 8 RxPD descriptors for -* station firmware to store Rx packet information. -* -* Current version of MAC has a 32x6 multicast address buffer. -* -* 802.11b can have up to 14 channels, the driver keeps the -* BSSID(MAC address) of each APs or Ad hoc stations it has sensed. -*/ - -#define MRVDRV_MAX_MULTICAST_LIST_SIZE 32 -#define LBS_NUM_CMD_BUFFERS 10 -#define LBS_CMD_BUFFER_SIZE (2 * 1024) -#define MRVDRV_MAX_CHANNEL_SIZE 14 -#define MRVDRV_ASSOCIATION_TIME_OUT 255 -#define MRVDRV_SNAP_HEADER_LEN 8 - -#define LBS_UPLD_SIZE 2312 -#define DEV_NAME_LEN 32 - -/* Wake criteria for HOST_SLEEP_CFG command */ -#define EHS_WAKE_ON_BROADCAST_DATA 0x0001 -#define EHS_WAKE_ON_UNICAST_DATA 0x0002 -#define EHS_WAKE_ON_MAC_EVENT 0x0004 -#define EHS_WAKE_ON_MULTICAST_DATA 0x0008 -#define EHS_REMOVE_WAKEUP 0xFFFFFFFF -/* Wake rules for Host_Sleep_CFG command */ -#define WOL_RULE_NET_TYPE_INFRA_OR_IBSS 0x00 -#define WOL_RULE_NET_TYPE_MESH 0x10 -#define WOL_RULE_ADDR_TYPE_BCAST 0x01 -#define WOL_RULE_ADDR_TYPE_MCAST 0x08 -#define WOL_RULE_ADDR_TYPE_UCAST 0x02 -#define WOL_RULE_OP_AND 0x01 -#define WOL_RULE_OP_OR 0x02 -#define WOL_RULE_OP_INVALID 0xFF -#define WOL_RESULT_VALID_CMD 0 -#define WOL_RESULT_NOSPC_ERR 1 -#define WOL_RESULT_EEXIST_ERR 2 - -/** Misc constants */ -/* This section defines 802.11 specific contants */ - -#define MRVDRV_MAX_BSS_DESCRIPTS 16 -#define MRVDRV_MAX_REGION_CODE 6 - -#define MRVDRV_IGNORE_MULTIPLE_DTIM 0xFFFE -#define MRVDRV_MIN_MULTIPLE_DTIM 1 -#define MRVDRV_MAX_MULTIPLE_DTIM 5 -//#define MRVDRV_DEFAULT_MULTIPLE_DTIM 1 -#define MRVDRV_DEFAULT_MULTIPLE_DTIM 3 - -#define MRVDRV_DEFAULT_LISTEN_INTERVAL 10 - -#define MRVDRV_CHANNELS_PER_SCAN 4 -#define MRVDRV_MAX_CHANNELS_PER_SCAN 14 - -#define MRVDRV_MIN_BEACON_INTERVAL 20 -#define MRVDRV_MAX_BEACON_INTERVAL 1000 -#define MRVDRV_BEACON_INTERVAL 100 - -#define MARVELL_MESH_IE_LENGTH 9 - -/* Values used to populate the struct mrvl_mesh_ie. The only time you need this - * is when enabling the mesh using CMD_MESH_CONFIG. - */ -#define MARVELL_MESH_IE_TYPE 4 -#define MARVELL_MESH_IE_SUBTYPE 0 -#define MARVELL_MESH_IE_VERSION 0 -#define MARVELL_MESH_PROTO_ID_HWMP 0 -#define MARVELL_MESH_METRIC_ID 0 -#define MARVELL_MESH_CAPABILITY 0 - -/** INT status Bit Definition*/ -#define MRVDRV_TX_DNLD_RDY 0x0001 -#define MRVDRV_RX_UPLD_RDY 0x0002 -#define MRVDRV_CMD_DNLD_RDY 0x0004 -#define MRVDRV_CMD_UPLD_RDY 0x0008 -#define MRVDRV_CARDEVENT 0x0010 - -/* Automatic TX control default levels */ -#define POW_ADAPT_DEFAULT_P0 13 -#define POW_ADAPT_DEFAULT_P1 15 -#define POW_ADAPT_DEFAULT_P2 18 -#define TPC_DEFAULT_P0 5 -#define TPC_DEFAULT_P1 10 -#define TPC_DEFAULT_P2 13 - -/** TxPD status */ - -/* Station firmware use TxPD status field to report final Tx transmit -* result, Bit masks are used to present combined situations. -*/ - -#define MRVDRV_TxPD_POWER_MGMT_NULL_PACKET 0x01 -#define MRVDRV_TxPD_POWER_MGMT_LAST_PACKET 0x08 - -/** Tx mesh flag */ -/* Currently we are using normal WDS flag as mesh flag. - * TODO: change to proper mesh flag when MAC understands it. - */ -#define TxPD_CONTROL_WDS_FRAME (1<<17) -#define TxPD_MESH_FRAME TxPD_CONTROL_WDS_FRAME - -/** RxPD status */ - -#define MRVDRV_RXPD_STATUS_OK 0x0001 - -/** RxPD status - Received packet types */ -/** Rx mesh flag */ -/* Currently we are using normal WDS flag as mesh flag. - * TODO: change to proper mesh flag when MAC understands it. - */ -#define RxPD_CONTROL_WDS_FRAME (0x40) -#define RxPD_MESH_FRAME RxPD_CONTROL_WDS_FRAME - -/** RSSI-related defines */ -/* RSSI constants are used to implement 802.11 RSSI threshold -* indication. if the Rx packet signal got too weak for 5 consecutive -* times, miniport driver (driver) will report this event to wrapper -*/ - -#define MRVDRV_NF_DEFAULT_SCAN_VALUE (-96) - -/** RTS/FRAG related defines */ -#define MRVDRV_RTS_MIN_VALUE 0 -#define MRVDRV_RTS_MAX_VALUE 2347 -#define MRVDRV_FRAG_MIN_VALUE 256 -#define MRVDRV_FRAG_MAX_VALUE 2346 - -/* This is for firmware specific length */ -#define EXTRA_LEN 36 - -#define MRVDRV_ETH_TX_PACKET_BUFFER_SIZE \ - (ETH_FRAME_LEN + sizeof(struct txpd) + EXTRA_LEN) - -#define MRVDRV_ETH_RX_PACKET_BUFFER_SIZE \ - (ETH_FRAME_LEN + sizeof(struct rxpd) \ - + MRVDRV_SNAP_HEADER_LEN + EXTRA_LEN) - -#define CMD_F_HOSTCMD (1 << 0) -#define FW_CAPINFO_WPA (1 << 0) -#define FW_CAPINFO_PS (1 << 1) -#define FW_CAPINFO_FIRMWARE_UPGRADE (1 << 13) -#define FW_CAPINFO_BOOT2_UPGRADE (1<<14) -#define FW_CAPINFO_PERSISTENT_CONFIG (1<<15) - -#define KEY_LEN_WPA_AES 16 -#define KEY_LEN_WPA_TKIP 32 -#define KEY_LEN_WEP_104 13 -#define KEY_LEN_WEP_40 5 - -#define RF_ANTENNA_1 0x1 -#define RF_ANTENNA_2 0x2 -#define RF_ANTENNA_AUTO 0xFFFF - -#define BAND_B (0x01) -#define BAND_G (0x02) -#define ALL_802_11_BANDS (BAND_B | BAND_G) - -/** MACRO DEFINITIONS */ -#define CAL_NF(NF) ((s32)(-(s32)(NF))) -#define CAL_RSSI(SNR, NF) ((s32)((s32)(SNR) + CAL_NF(NF))) -#define SCAN_RSSI(RSSI) (0x100 - ((u8)(RSSI))) - -#define DEFAULT_BCN_AVG_FACTOR 8 -#define DEFAULT_DATA_AVG_FACTOR 8 -#define AVG_SCALE 100 -#define CAL_AVG_SNR_NF(AVG, SNRNF, N) \ - (((AVG) == 0) ? ((u16)(SNRNF) * AVG_SCALE) : \ - ((((int)(AVG) * (N -1)) + ((u16)(SNRNF) * \ - AVG_SCALE)) / N)) - -#define MAX_RATES 14 - -#define MAX_LEDS 8 - -/** Global Variable Declaration */ -extern u16 lbs_region_code_to_index[MRVDRV_MAX_REGION_CODE]; - -extern u8 lbs_bg_rates[MAX_RATES]; - -/** ENUM definition*/ -/** SNRNF_TYPE */ -enum SNRNF_TYPE { - TYPE_BEACON = 0, - TYPE_RXPD, - MAX_TYPE_B -}; - -/** SNRNF_DATA*/ -enum SNRNF_DATA { - TYPE_NOAVG = 0, - TYPE_AVG, - MAX_TYPE_AVG -}; - -/** LBS_802_11_POWER_MODE */ -enum LBS_802_11_POWER_MODE { - LBS802_11POWERMODECAM, - LBS802_11POWERMODEMAX_PSP, - LBS802_11POWERMODEFAST_PSP, - /*not a real mode, defined as an upper bound */ - LBS802_11POWEMODEMAX -}; - -/** PS_STATE */ -enum PS_STATE { - PS_STATE_FULL_POWER, - PS_STATE_AWAKE, - PS_STATE_PRE_SLEEP, - PS_STATE_SLEEP -}; - -/** DNLD_STATE */ -enum DNLD_STATE { - DNLD_RES_RECEIVED, - DNLD_DATA_SENT, - DNLD_CMD_SENT, - DNLD_BOOTCMD_SENT, -}; - -/** LBS_MEDIA_STATE */ -enum LBS_MEDIA_STATE { - LBS_CONNECTED, - LBS_DISCONNECTED -}; - -/** LBS_802_11_PRIVACY_FILTER */ -enum LBS_802_11_PRIVACY_FILTER { - LBS802_11PRIVFILTERACCEPTALL, - LBS802_11PRIVFILTER8021XWEP -}; - -/** mv_ms_type */ -enum mv_ms_type { - MVMS_DAT = 0, - MVMS_CMD = 1, - MVMS_TXDONE = 2, - MVMS_EVENT -}; - -/** KEY_TYPE_ID */ -enum KEY_TYPE_ID { - KEY_TYPE_ID_WEP = 0, - KEY_TYPE_ID_TKIP, - KEY_TYPE_ID_AES -}; - -/** KEY_INFO_WPA (applies to both TKIP and AES/CCMP) */ -enum KEY_INFO_WPA { - KEY_INFO_WPA_MCAST = 0x01, - KEY_INFO_WPA_UNICAST = 0x02, - KEY_INFO_WPA_ENABLED = 0x04 -}; - -/* Default values for fwt commands. */ -#define FWT_DEFAULT_METRIC 0 -#define FWT_DEFAULT_DIR 1 -/* Default Rate, 11Mbps */ -#define FWT_DEFAULT_RATE 3 -#define FWT_DEFAULT_SSN 0xffffffff -#define FWT_DEFAULT_DSN 0 -#define FWT_DEFAULT_HOPCOUNT 0 -#define FWT_DEFAULT_TTL 0 -#define FWT_DEFAULT_EXPIRATION 0 -#define FWT_DEFAULT_SLEEPMODE 0 -#define FWT_DEFAULT_SNR 0 - -#endif diff --git a/drivers/net/wireless/mv8686/dev.h b/drivers/net/wireless/mv8686/dev.h deleted file mode 100755 index 5dd21434a11c..000000000000 --- a/drivers/net/wireless/mv8686/dev.h +++ /dev/null @@ -1,430 +0,0 @@ -/** - * This file contains definitions and data structures specific - * to Marvell 802.11 NIC. It contains the Device Information - * structure struct lbs_private.. - */ -#ifndef _LBS_DEV_H_ -#define _LBS_DEV_H_ - -#include -#include -#include -#include -#include -#include - -#include "defs.h" -#include "hostcmd.h" - -extern struct ethtool_ops lbs_ethtool_ops; - -#define MAX_BSSID_PER_CHANNEL 16 - -#define NR_TX_QUEUE 3 - -/* For the extended Scan */ -#define MAX_EXTENDED_SCAN_BSSID_LIST MAX_BSSID_PER_CHANNEL * \ - MRVDRV_MAX_CHANNEL_SIZE + 1 - -#define MAX_REGION_CHANNEL_NUM 2 - -/** Chan-freq-TxPower mapping table*/ -struct chan_freq_power { - /** channel Number */ - u16 channel; - /** frequency of this channel */ - u32 freq; - /** Max allowed Tx power level */ - u16 maxtxpower; - /** TRUE:channel unsupported; FLASE:supported*/ - u8 unsupported; -}; - -/** region-band mapping table*/ -struct region_channel { - /** TRUE if this entry is valid */ - u8 valid; - /** region code for US, Japan ... */ - u8 region; - /** band B/G/A, used for BAND_CONFIG cmd */ - u8 band; - /** Actual No. of elements in the array below */ - u8 nrcfp; - /** chan-freq-txpower mapping table*/ - struct chan_freq_power *CFP; -}; - -struct lbs_802_11_security { - u8 WPAenabled; - u8 WPA2enabled; - u8 wep_enabled; - u8 auth_mode; - u32 key_mgmt; -}; - -/** Current Basic Service Set State Structure */ -struct current_bss_params { - /** bssid */ - u8 bssid[ETH_ALEN]; - /** ssid */ - u8 ssid[IW_ESSID_MAX_SIZE + 1]; - u8 ssid_len; - - /** band */ - u8 band; - /** channel */ - u8 channel; - /** zero-terminated array of supported data rates */ - u8 rates[MAX_RATES + 1]; -}; - -/** sleep_params */ -struct sleep_params { - uint16_t sp_error; - uint16_t sp_offset; - uint16_t sp_stabletime; - uint8_t sp_calcontrol; - uint8_t sp_extsleepclk; - uint16_t sp_reserved; -}; - -#define MAX_SCAN_REQ 16 - -struct lbs_scan_req -{ - struct list_head list; - int ssid_len; /* ssid_len == 0 means broadcast scanning */ - char ssid[IW_ESSID_MAX_SIZE+1]; -}; - -/** Private structure for the MV device */ -struct lbs_private -{ - int infra_open; - - char name[DEV_NAME_LEN]; - - void *card; - struct net_device *dev; - - struct iw_statistics wstats; - struct dentry *debugfs_dir; - struct dentry *debugfs_debug; - struct dentry *debugfs_files[6]; - - struct dentry *events_dir; - struct dentry *debugfs_events_files[6]; - - struct dentry *regs_dir; - struct dentry *debugfs_regs_files[6]; - - u32 mac_offset; - u32 bbp_offset; - u32 rf_offset; - - /* Download sent: - bit0 1/0=data_sent/data_tx_done, - bit1 1/0=cmd_sent/cmd_tx_done, - all other bits reserved 0 */ - u8 dnld_sent; - - /** thread to service interrupts */ - struct task_struct *main_thread; - wait_queue_head_t waitq; - struct workqueue_struct *work_thread; - -#if (MV8686_SUPPORT_MCAST == 1) - struct work_struct mcast_work; -#endif - - /** Scanning */ - struct delayed_work scan_work; - spinlock_t scan_work_lock; - struct delayed_work assoc_work; - struct work_struct sync_channel; - - /* remember which channel was scanned last, != 0 if currently scanning */ - int scan_channel; - u8 scan_ssid[IW_ESSID_MAX_SIZE + 1]; - u8 scan_ssid_len; - - /** Hardware access */ - int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb); - void (*reset_card) (struct lbs_private *priv); - - /* Wake On LAN */ - uint32_t wol_criteria; - uint8_t wol_gpio; - uint8_t wol_gap; - - /** Wlan adapter data structure*/ - /** STATUS variables */ - u32 fwrelease; - u32 fwcapinfo; - - struct mutex lock; - - /* TX packet ready to be sent... */ - int tx_pending_len; /* -1 while building packet */ - u8 tx_pending_buf[LBS_UPLD_SIZE]; - /* protected by hard_start_xmit serialization */ - - /* command-related variables */ - u16 seqnum; - - /* - * Command materials - */ - struct cmd_ctrl_node *cmd_array; /* Allocated buffer for cmds */ - struct cmd_ctrl_node *cur_cmd; /* Current command */ - int cur_cmd_retcode; /* Return code for current cmd */ - struct list_head cmdfreeq; /* Free command buffers */ - struct list_head cmdpendingq; /* Pending command buffers */ - wait_queue_head_t cmd_pending; - u8 resp_idx; /* Cmd responses sent from the -- */ - u8 resp_buf[2][LBS_UPLD_SIZE]; /* hardware to the driver */ - u32 resp_len[2]; - - struct timer_list command_timer; /* Command timeout timers */ - int nr_retries; - int cmd_timed_out; - - /* Events sent from hardware to driver */ - struct kfifo *event_fifo; - - /* nickname */ - u8 nodename[16]; - - /** spin locks */ - spinlock_t driver_lock; - - /** current ssid/bssid related parameters*/ - struct current_bss_params curbssparams; - - /* IW_MODE_* */ - u8 mode; - - /* Scan results list */ - struct list_head network_list; - struct list_head network_free_list; - struct bss_descriptor *networks; - - struct list_head scan_req_list; - struct list_head scan_req_free_list; - struct lbs_scan_req *scan_req; - - u16 beacon_period; - u8 beacon_enable; - u8 adhoccreate; - - /** capability Info used in Association, start, join */ - u16 capability; - - /** MAC address information */ - u8 current_addr[ETH_ALEN]; - u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN]; - u32 nr_of_multicastmacaddr; - - uint16_t enablehwauto; - uint16_t ratebitmap; - - u8 txretrycount; - - /** Tx-related variables (for single packet tx) */ - struct sk_buff *currenttxskb; - - /** NIC Operation characteristics */ - u16 mac_control; - u32 connect_status; - u16 regioncode; - s16 txpower_cur; - s16 txpower_min; - s16 txpower_max; - - /** POWER MANAGEMENT AND PnP SUPPORT */ - u8 surpriseremoved; - - u16 psmode; /* Wlan802_11PowermodeCAM=disable - Wlan802_11PowermodeMAX_PSP=enable */ - u32 psstate; - - u8 deepsleep; /* Deep sleep status : true (on) : false (off) */ - u8 auto_deepsleep; /* */ - wait_queue_head_t ds_waitq; /* Deep sleep wakeup queue */ - - char ps_supported; - u8 needtowakeup; - -#if (NEW_MV8686_PS == 1) - struct timer_list turnoff_timer; - u8 turnoff_idle_count; - u8 wifi_state; //0-busy 1-idle - struct delayed_work ps_work; - unsigned long scan_result_timeout; - u8 need_reassoc; //0-no 1-yes - struct timer_list disconnect_timer; //check association whether is successful. - u8 associate_retry; - u8 needto_notify_upper; -#endif - -#if (ANDROID_POWER_SAVE == 1) - struct timer_list ps_timer; /* Power save timer. */ - struct delayed_work ps_work; /* Worker to do auto power save. */ - int wifi_ps_work_req; /* Which request to the ps_work. */ - spinlock_t ps_lock; /* Lock for power save. */ -#endif - - struct assoc_request * pending_assoc_req; - struct assoc_request * in_progress_assoc_req; -#if (AUTO_REASSOC == 1) - struct assoc_request * prev_assoc_req; - int reassoc_count; -#endif - - /** Encryption parameter */ - struct lbs_802_11_security secinfo; - - /** WEP keys */ - struct enc_key wep_keys[4]; - u16 wep_tx_keyidx; - - /** WPA keys */ - struct enc_key wpa_mcast_key; - struct enc_key wpa_unicast_key; - -/* - * In theory, the IE is limited to the IE length, 255, - * but in practice 64 bytes are enough. - */ -#define MAX_WPA_IE_LEN 64 - - /** WPA Information Elements*/ - u8 wpa_ie[MAX_WPA_IE_LEN]; - u8 wpa_ie_len; - - /** Requested Signal Strength*/ - u16 SNR[MAX_TYPE_B][MAX_TYPE_AVG]; - u16 NF[MAX_TYPE_B][MAX_TYPE_AVG]; - u8 RSSI[MAX_TYPE_B][MAX_TYPE_AVG]; - u8 rawSNR[DEFAULT_DATA_AVG_FACTOR]; - u8 rawNF[DEFAULT_DATA_AVG_FACTOR]; - u16 nextSNRNF; - u16 numSNRNF; - - u8 radio_on; - - /** data rate stuff */ - u8 cur_rate; - - /** RF calibration data */ - -#define MAX_REGION_CHANNEL_NUM 2 - /** region channel data */ - struct region_channel region_channel[MAX_REGION_CHANNEL_NUM]; - - struct region_channel universal_channel[MAX_REGION_CHANNEL_NUM]; - - /** 11D and Domain Regulatory Data */ - struct lbs_802_11d_domain_reg domainreg; - struct parsed_region_chan_11d parsed_region_chan; - - /** FSM variable for 11d support */ - u32 enable11d; - - /** MISCELLANEOUS */ - struct lbs_offset_value offsetvalue; - - u32 monitormode; - u8 fw_ready; -}; - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) -#define GET_PRIV_FROM_NETDEV(dev) (struct lbs_private *)(dev)->priv -#else -#define GET_PRIV_FROM_NETDEV(dev) (struct lbs_private *)(dev)->ml_priv -#endif - -extern struct cmd_confirm_sleep confirm_sleep; - -/** - * @brief Structure used to store information for each beacon/probe response - */ -struct bss_descriptor { - u8 bssid[ETH_ALEN]; - - u8 ssid[IW_ESSID_MAX_SIZE + 1]; - u8 ssid_len; - - u16 capability; - u32 rssi; - u32 channel; - u16 beaconperiod; - u32 atimwindow; - - /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */ - u8 mode; - - /* zero-terminated array of supported data rates */ - u8 rates[MAX_RATES + 1]; - - unsigned long last_scanned; - - union ieeetypes_phyparamset phyparamset; - union IEEEtypes_ssparamset ssparamset; - - struct ieeetypes_countryinfofullset countryinfo; - - u8 wpa_ie[MAX_WPA_IE_LEN]; - size_t wpa_ie_len; - u8 rsn_ie[MAX_WPA_IE_LEN]; - size_t rsn_ie_len; - - struct list_head list; -}; - -/** Association request - * - * Encapsulates all the options that describe a specific assocation request - * or configuration of the wireless card's radio, mode, and security settings. - */ -#define ASSOC_FLAG_SSID 1 -#define ASSOC_FLAG_CHANNEL 2 -#define ASSOC_FLAG_BAND 3 -#define ASSOC_FLAG_MODE 4 -#define ASSOC_FLAG_BSSID 5 -#define ASSOC_FLAG_WEP_KEYS 6 -#define ASSOC_FLAG_WEP_TX_KEYIDX 7 -#define ASSOC_FLAG_WPA_MCAST_KEY 8 -#define ASSOC_FLAG_WPA_UCAST_KEY 9 -#define ASSOC_FLAG_SECINFO 10 -#define ASSOC_FLAG_WPA_IE 11 - -struct assoc_request { - unsigned long flags; - - u8 ssid[IW_ESSID_MAX_SIZE + 1]; - u8 ssid_len; - u8 channel; - u8 band; - u8 mode; - u8 bssid[ETH_ALEN] __attribute__ ((aligned (2))); - - /** WEP keys */ - struct enc_key wep_keys[4]; - u16 wep_tx_keyidx; - - /** WPA keys */ - struct enc_key wpa_mcast_key; - struct enc_key wpa_unicast_key; - - struct lbs_802_11_security secinfo; - - /** WPA Information Elements*/ - u8 wpa_ie[MAX_WPA_IE_LEN]; - u8 wpa_ie_len; - - /* BSS to associate with for infrastructure of Ad-Hoc join */ - struct bss_descriptor bss; -}; - -#endif diff --git a/drivers/net/wireless/mv8686/host.h b/drivers/net/wireless/mv8686/host.h deleted file mode 100755 index 9e3dcd70aa51..000000000000 --- a/drivers/net/wireless/mv8686/host.h +++ /dev/null @@ -1,303 +0,0 @@ -/** - * This file contains definitions of WLAN commands. - */ - -#ifndef _LBS_HOST_H_ -#define _LBS_HOST_H_ - -/** PUBLIC DEFINITIONS */ -#define DEFAULT_AD_HOC_CHANNEL 6 -#define DEFAULT_AD_HOC_CHANNEL_A 36 - -#define CMD_OPTION_WAITFORRSP 0x0002 - -/** Host command IDs */ - -/* Return command are almost always the same as the host command, but with - * bit 15 set high. There are a few exceptions, though... - */ -#define CMD_RET(cmd) (0x8000 | cmd) - -/* Return command convention exceptions: */ -#define CMD_RET_802_11_ASSOCIATE 0x8012 - -/* Command codes */ -#define CMD_GET_HW_SPEC 0x0003 -#define CMD_EEPROM_UPDATE 0x0004 -#define CMD_802_11_RESET 0x0005 -#define CMD_802_11_SCAN 0x0006 -#define CMD_802_11_GET_LOG 0x000b -#define CMD_MAC_MULTICAST_ADR 0x0010 -#define CMD_802_11_AUTHENTICATE 0x0011 -#define CMD_802_11_EEPROM_ACCESS 0x0059 -#define CMD_802_11_ASSOCIATE 0x0050 -#define CMD_802_11_SET_WEP 0x0013 -#define CMD_802_11_GET_STAT 0x0014 -#define CMD_802_3_GET_STAT 0x0015 -#define CMD_802_11_SNMP_MIB 0x0016 -#define CMD_MAC_REG_MAP 0x0017 -#define CMD_BBP_REG_MAP 0x0018 -#define CMD_MAC_REG_ACCESS 0x0019 -#define CMD_BBP_REG_ACCESS 0x001a -#define CMD_RF_REG_ACCESS 0x001b -#define CMD_802_11_RADIO_CONTROL 0x001c -#define CMD_802_11_RF_CHANNEL 0x001d -#define CMD_802_11_RF_TX_POWER 0x001e -#define CMD_802_11_RSSI 0x001f -#define CMD_802_11_RF_ANTENNA 0x0020 -#define CMD_802_11_PS_MODE 0x0021 -#define CMD_802_11_DATA_RATE 0x0022 -#define CMD_RF_REG_MAP 0x0023 -#define CMD_802_11_DEAUTHENTICATE 0x0024 -#define CMD_802_11_REASSOCIATE 0x0025 -#define CMD_MAC_CONTROL 0x0028 -#define CMD_802_11_AD_HOC_START 0x002b -#define CMD_802_11_AD_HOC_JOIN 0x002c -#define CMD_802_11_QUERY_TKIP_REPLY_CNTRS 0x002e -#define CMD_802_11_ENABLE_RSN 0x002f -#define CMD_802_11_SET_AFC 0x003c -#define CMD_802_11_GET_AFC 0x003d -#define CMD_802_11_DEEP_SLEEP 0x003e -#define CMD_802_11_AD_HOC_STOP 0x0040 -#define CMD_802_11_HOST_SLEEP_CFG 0x0043 -#define CMD_802_11_WAKEUP_CONFIRM 0x0044 -#define CMD_802_11_HOST_SLEEP_ACTIVATE 0x0045 -#define CMD_802_11_BEACON_STOP 0x0049 -#define CMD_802_11_MAC_ADDRESS 0x004d -#define CMD_802_11_LED_GPIO_CTRL 0x004e -#define CMD_802_11_EEPROM_ACCESS 0x0059 -#define CMD_802_11_BAND_CONFIG 0x0058 -#define CMD_GSPI_BUS_CONFIG 0x005a -#define CMD_802_11D_DOMAIN_INFO 0x005b -#define CMD_802_11_KEY_MATERIAL 0x005e -#define CMD_802_11_SLEEP_PARAMS 0x0066 -#define CMD_802_11_INACTIVITY_TIMEOUT 0x0067 -#define CMD_802_11_SLEEP_PERIOD 0x0068 -#define CMD_802_11_TPC_CFG 0x0072 -#define CMD_802_11_PA_CFG 0x0073 -#define CMD_802_11_FW_WAKE_METHOD 0x0074 -#define CMD_802_11_SUBSCRIBE_EVENT 0x0075 -#define CMD_802_11_RATE_ADAPT_RATESET 0x0076 -#define CMD_802_11_TX_RATE_QUERY 0x007f -#define CMD_GET_TSF 0x0080 -#define CMD_BT_ACCESS 0x0087 -#define CMD_FWT_ACCESS 0x0095 -#define CMD_802_11_MONITOR_MODE 0x0098 -#define CMD_MESH_ACCESS 0x009b -#define CMD_MESH_CONFIG 0x00a3 -#define CMD_SET_BOOT2_VER 0x00a5 -#define CMD_802_11_BEACON_CTRL 0x00b0 - -/* For the IEEE Power Save */ -#define CMD_SUBCMD_ENTER_PS 0x0030 -#define CMD_SUBCMD_EXIT_PS 0x0031 -#define CMD_SUBCMD_SLEEP_CONFIRMED 0x0034 -#define CMD_SUBCMD_FULL_POWERDOWN 0x0035 -#define CMD_SUBCMD_FULL_POWERUP 0x0036 - -#define CMD_ENABLE_RSN 0x0001 -#define CMD_DISABLE_RSN 0x0000 - -#define CMD_ACT_GET 0x0000 -#define CMD_ACT_SET 0x0001 -#define CMD_ACT_GET_AES 0x0002 -#define CMD_ACT_SET_AES 0x0003 -#define CMD_ACT_REMOVE_AES 0x0004 - -/* Define action or option for CMD_802_11_SET_WEP */ -#define CMD_ACT_ADD 0x0002 -#define CMD_ACT_REMOVE 0x0004 -#define CMD_ACT_USE_DEFAULT 0x0008 - -#define CMD_TYPE_WEP_40_BIT 0x01 -#define CMD_TYPE_WEP_104_BIT 0x02 - -#define CMD_NUM_OF_WEP_KEYS 4 - -#define CMD_WEP_KEY_INDEX_MASK 0x3fff - -/* Define action or option for CMD_802_11_RESET */ -#define CMD_ACT_HALT 0x0003 - -/* Define action or option for CMD_802_11_SCAN */ -#define CMD_BSS_TYPE_BSS 0x0001 -#define CMD_BSS_TYPE_IBSS 0x0002 -#define CMD_BSS_TYPE_ANY 0x0003 - -/* Define action or option for CMD_802_11_SCAN */ -#define CMD_SCAN_TYPE_ACTIVE 0x0000 -#define CMD_SCAN_TYPE_PASSIVE 0x0001 - -#define CMD_SCAN_RADIO_TYPE_BG 0 - -#define CMD_SCAN_PROBE_DELAY_TIME 0 - -/* Define action or option for CMD_MAC_CONTROL */ -#define CMD_ACT_MAC_RX_ON 0x0001 -#define CMD_ACT_MAC_TX_ON 0x0002 -#define CMD_ACT_MAC_LOOPBACK_ON 0x0004 -#define CMD_ACT_MAC_WEP_ENABLE 0x0008 -#define CMD_ACT_MAC_INT_ENABLE 0x0010 -#define CMD_ACT_MAC_MULTICAST_ENABLE 0x0020 -#define CMD_ACT_MAC_BROADCAST_ENABLE 0x0040 -#define CMD_ACT_MAC_PROMISCUOUS_ENABLE 0x0080 -#define CMD_ACT_MAC_ALL_MULTICAST_ENABLE 0x0100 -#define CMD_ACT_MAC_STRICT_PROTECTION_ENABLE 0x0400 - -/* Event flags for CMD_802_11_SUBSCRIBE_EVENT */ -#define CMD_SUBSCRIBE_RSSI_LOW 0x0001 -#define CMD_SUBSCRIBE_SNR_LOW 0x0002 -#define CMD_SUBSCRIBE_FAILCOUNT 0x0004 -#define CMD_SUBSCRIBE_BCNMISS 0x0008 -#define CMD_SUBSCRIBE_RSSI_HIGH 0x0010 -#define CMD_SUBSCRIBE_SNR_HIGH 0x0020 - -#define RADIO_PREAMBLE_LONG 0x00 -#define RADIO_PREAMBLE_SHORT 0x02 -#define RADIO_PREAMBLE_AUTO 0x04 - -/* Define action or option for CMD_802_11_RF_CHANNEL */ -#define CMD_OPT_802_11_RF_CHANNEL_GET 0x00 -#define CMD_OPT_802_11_RF_CHANNEL_SET 0x01 - -/* Define action or option for CMD_802_11_DATA_RATE */ -#define CMD_ACT_SET_TX_AUTO 0x0000 -#define CMD_ACT_SET_TX_FIX_RATE 0x0001 -#define CMD_ACT_GET_TX_RATE 0x0002 - -#define CMD_ACT_SET_RX 0x0001 -#define CMD_ACT_SET_TX 0x0002 -#define CMD_ACT_SET_BOTH 0x0003 -#define CMD_ACT_GET_RX 0x0004 -#define CMD_ACT_GET_TX 0x0008 -#define CMD_ACT_GET_BOTH 0x000c - -/* Define action or option for CMD_802_11_PS_MODE */ -#define CMD_TYPE_CAM 0x0000 -#define CMD_TYPE_MAX_PSP 0x0001 -#define CMD_TYPE_FAST_PSP 0x0002 - -/* Options for CMD_802_11_FW_WAKE_METHOD */ -#define CMD_WAKE_METHOD_UNCHANGED 0x0000 -#define CMD_WAKE_METHOD_COMMAND_INT 0x0001 -#define CMD_WAKE_METHOD_GPIO 0x0002 - -/* Object IDs for CMD_802_11_SNMP_MIB */ -#define SNMP_MIB_OID_BSS_TYPE 0x0000 -#define SNMP_MIB_OID_OP_RATE_SET 0x0001 -#define SNMP_MIB_OID_BEACON_PERIOD 0x0002 /* Reserved on v9+ */ -#define SNMP_MIB_OID_DTIM_PERIOD 0x0003 /* Reserved on v9+ */ -#define SNMP_MIB_OID_ASSOC_TIMEOUT 0x0004 /* Reserved on v9+ */ -#define SNMP_MIB_OID_RTS_THRESHOLD 0x0005 -#define SNMP_MIB_OID_SHORT_RETRY_LIMIT 0x0006 -#define SNMP_MIB_OID_LONG_RETRY_LIMIT 0x0007 -#define SNMP_MIB_OID_FRAG_THRESHOLD 0x0008 -#define SNMP_MIB_OID_11D_ENABLE 0x0009 -#define SNMP_MIB_OID_11H_ENABLE 0x000A - -/* Define action or option for CMD_BT_ACCESS */ -enum cmd_bt_access_opts { - /* The bt commands start at 5 instead of 1 because the old dft commands - * are mapped to 1-4. These old commands are no longer maintained and - * should not be called. - */ - CMD_ACT_BT_ACCESS_ADD = 5, - CMD_ACT_BT_ACCESS_DEL, - CMD_ACT_BT_ACCESS_LIST, - CMD_ACT_BT_ACCESS_RESET, - CMD_ACT_BT_ACCESS_SET_INVERT, - CMD_ACT_BT_ACCESS_GET_INVERT -}; - -/* Define action or option for CMD_FWT_ACCESS */ -enum cmd_fwt_access_opts { - CMD_ACT_FWT_ACCESS_ADD = 1, - CMD_ACT_FWT_ACCESS_DEL, - CMD_ACT_FWT_ACCESS_LOOKUP, - CMD_ACT_FWT_ACCESS_LIST, - CMD_ACT_FWT_ACCESS_LIST_ROUTE, - CMD_ACT_FWT_ACCESS_LIST_NEIGHBOR, - CMD_ACT_FWT_ACCESS_RESET, - CMD_ACT_FWT_ACCESS_CLEANUP, - CMD_ACT_FWT_ACCESS_TIME, -}; - -/* Define action or option for CMD_802_11_HOST_SLEEP_CFG */ -enum cmd_wol_cfg_opts { - CMD_ACT_ACTION_NONE = 0, - CMD_ACT_SET_WOL_RULE, - CMD_ACT_GET_WOL_RULE, - CMD_ACT_RESET_WOL_RULE, -}; - -/* Define action or option for CMD_MESH_ACCESS */ -enum cmd_mesh_access_opts { - CMD_ACT_MESH_GET_TTL = 1, - CMD_ACT_MESH_SET_TTL, - CMD_ACT_MESH_GET_STATS, - CMD_ACT_MESH_GET_ANYCAST, - CMD_ACT_MESH_SET_ANYCAST, - CMD_ACT_MESH_SET_LINK_COSTS, - CMD_ACT_MESH_GET_LINK_COSTS, - CMD_ACT_MESH_SET_BCAST_RATE, - CMD_ACT_MESH_GET_BCAST_RATE, - CMD_ACT_MESH_SET_RREQ_DELAY, - CMD_ACT_MESH_GET_RREQ_DELAY, - CMD_ACT_MESH_SET_ROUTE_EXP, - CMD_ACT_MESH_GET_ROUTE_EXP, - CMD_ACT_MESH_SET_AUTOSTART_ENABLED, - CMD_ACT_MESH_GET_AUTOSTART_ENABLED, - CMD_ACT_MESH_SET_GET_PRB_RSP_LIMIT = 17, -}; - -/* Define actions and types for CMD_MESH_CONFIG */ -enum cmd_mesh_config_actions { - CMD_ACT_MESH_CONFIG_STOP = 0, - CMD_ACT_MESH_CONFIG_START, - CMD_ACT_MESH_CONFIG_SET, - CMD_ACT_MESH_CONFIG_GET, -}; - -enum cmd_mesh_config_types { - CMD_TYPE_MESH_SET_BOOTFLAG = 1, - CMD_TYPE_MESH_SET_BOOTTIME, - CMD_TYPE_MESH_SET_DEF_CHANNEL, - CMD_TYPE_MESH_SET_MESH_IE, - CMD_TYPE_MESH_GET_DEFAULTS, - CMD_TYPE_MESH_GET_MESH_IE, /* GET_DEFAULTS is superset of GET_MESHIE */ -}; - -/** Card Event definition */ -#define MACREG_INT_CODE_TX_PPA_FREE 0 -#define MACREG_INT_CODE_TX_DMA_DONE 1 -#define MACREG_INT_CODE_LINK_LOST_W_SCAN 2 -#define MACREG_INT_CODE_LINK_LOST_NO_SCAN 3 -#define MACREG_INT_CODE_LINK_SENSED 4 -#define MACREG_INT_CODE_CMD_FINISHED 5 -#define MACREG_INT_CODE_MIB_CHANGED 6 -#define MACREG_INT_CODE_INIT_DONE 7 -#define MACREG_INT_CODE_DEAUTHENTICATED 8 -#define MACREG_INT_CODE_DISASSOCIATED 9 -#define MACREG_INT_CODE_PS_AWAKE 10 -#define MACREG_INT_CODE_PS_SLEEP 11 -#define MACREG_INT_CODE_MIC_ERR_MULTICAST 13 -#define MACREG_INT_CODE_MIC_ERR_UNICAST 14 -#define MACREG_INT_CODE_WM_AWAKE 15 -#define MACREG_INT_CODE_DEEP_SLEEP_AWAKE 16 -#define MACREG_INT_CODE_ADHOC_BCN_LOST 17 -#define MACREG_INT_CODE_HOST_AWAKE 18 -#define MACREG_INT_CODE_STOP_TX 19 -#define MACREG_INT_CODE_START_TX 20 -#define MACREG_INT_CODE_CHANNEL_SWITCH 21 -#define MACREG_INT_CODE_MEASUREMENT_RDY 22 -#define MACREG_INT_CODE_WMM_CHANGE 23 -#define MACREG_INT_CODE_BG_SCAN_REPORT 24 -#define MACREG_INT_CODE_RSSI_LOW 25 -#define MACREG_INT_CODE_SNR_LOW 26 -#define MACREG_INT_CODE_MAX_FAIL 27 -#define MACREG_INT_CODE_RSSI_HIGH 28 -#define MACREG_INT_CODE_SNR_HIGH 29 -#define MACREG_INT_CODE_MESH_AUTO_STARTED 35 -#define MACREG_INT_CODE_FIRMWARE_READY 48 - -#endif diff --git a/drivers/net/wireless/mv8686/hostcmd.h b/drivers/net/wireless/mv8686/hostcmd.h deleted file mode 100755 index a899aeb676bb..000000000000 --- a/drivers/net/wireless/mv8686/hostcmd.h +++ /dev/null @@ -1,775 +0,0 @@ -/* - * This file contains the function prototypes, data structure - * and defines for all the host/station commands - */ -#ifndef _LBS_HOSTCMD_H -#define _LBS_HOSTCMD_H - -#include -#include "11d.h" -#include "types.h" - -/* 802.11-related definitions */ - -/* TxPD descriptor */ -struct txpd { - /* Current Tx packet status */ - __le32 tx_status; - /* Tx control */ - __le32 tx_control; - __le32 tx_packet_location; - /* Tx packet length */ - __le16 tx_packet_length; - /* First 2 byte of destination MAC address */ - u8 tx_dest_addr_high[2]; - /* Last 4 byte of destination MAC address */ - u8 tx_dest_addr_low[4]; - /* Pkt Priority */ - u8 priority; - /* Pkt Trasnit Power control */ - u8 powermgmt; - /* Amount of time the packet has been queued in the driver (units = 2ms) */ - u8 pktdelay_2ms; - /* reserved */ - u8 reserved1; -} __attribute__ ((packed)); - -/* RxPD Descriptor */ -struct rxpd { - /* Current Rx packet status */ - __le16 status; - - /* SNR */ - u8 snr; - - /* Tx control */ - u8 rx_control; - - /* Pkt length */ - __le16 pkt_len; - - /* Noise Floor */ - u8 nf; - - /* Rx Packet Rate */ - u8 rx_rate; - - /* Pkt addr */ - __le32 pkt_ptr; - - /* Next Rx RxPD addr */ - __le32 next_rxpd_ptr; - - /* Pkt Priority */ - u8 priority; - u8 reserved[3]; -} __attribute__ ((packed)); - -struct cmd_header { - __le16 command; - __le16 size; - __le16 seqnum; - __le16 result; -} __attribute__ ((packed)); - -struct cmd_ctrl_node { - struct list_head list; - int result; - /* command response */ - int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *); - unsigned long callback_arg; - /* command data */ - struct cmd_header *cmdbuf; - /* wait queue */ - u16 cmdwaitqwoken; - wait_queue_head_t cmdwait_q; -}; - -/* Generic structure to hold all key types. */ -struct enc_key { - u16 len; - u16 flags; /* KEY_INFO_* from defs.h */ - u16 type; /* KEY_TYPE_* from defs.h */ - u8 key[32]; -}; - -/* lbs_offset_value */ -struct lbs_offset_value { - u32 offset; - u32 value; -} __attribute__ ((packed)); - -/* Define general data structure */ -/* cmd_DS_GEN */ -struct cmd_ds_gen { - __le16 command; - __le16 size; - __le16 seqnum; - __le16 result; - void *cmdresp[0]; -} __attribute__ ((packed)); - -#define S_DS_GEN sizeof(struct cmd_ds_gen) - - -/* - * Define data structure for CMD_GET_HW_SPEC - * This structure defines the response for the GET_HW_SPEC command - */ -struct cmd_ds_get_hw_spec { - struct cmd_header hdr; - - /* HW Interface version number */ - __le16 hwifversion; - /* HW version number */ - __le16 version; - /* Max number of TxPD FW can handle */ - __le16 nr_txpd; - /* Max no of Multicast address */ - __le16 nr_mcast_adr; - /* MAC address */ - u8 permanentaddr[6]; - - /* region Code */ - __le16 regioncode; - - /* Number of antenna used */ - __le16 nr_antenna; - - /* FW release number, example 0x01030304 = 2.3.4p1 */ - __le32 fwrelease; - - /* Base Address of TxPD queue */ - __le32 wcb_base; - /* Read Pointer of RxPd queue */ - __le32 rxpd_rdptr; - - /* Write Pointer of RxPd queue */ - __le32 rxpd_wrptr; - - /*FW/HW capability */ - __le32 fwcapinfo; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_subscribe_event { - struct cmd_header hdr; - - __le16 action; - __le16 events; - - /* A TLV to the CMD_802_11_SUBSCRIBE_EVENT command can contain a - * number of TLVs. From the v5.1 manual, those TLVs would add up to - * 40 bytes. However, future firmware might add additional TLVs, so I - * bump this up a bit. - */ - uint8_t tlv[128]; -} __attribute__ ((packed)); - -/* - * This scan handle Country Information IE(802.11d compliant) - * Define data structure for CMD_802_11_SCAN - */ -struct cmd_ds_802_11_scan { - struct cmd_header hdr; - - uint8_t bsstype; - uint8_t bssid[ETH_ALEN]; - uint8_t tlvbuffer[0]; -#if 0 - mrvlietypes_ssidparamset_t ssidParamSet; - mrvlietypes_chanlistparamset_t ChanListParamSet; - mrvlietypes_ratesparamset_t OpRateSet; -#endif -} __attribute__ ((packed)); - -struct cmd_ds_802_11_scan_rsp { - struct cmd_header hdr; - - __le16 bssdescriptsize; - uint8_t nr_sets; - uint8_t bssdesc_and_tlvbuffer[0]; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_get_log { - struct cmd_header hdr; - - __le32 mcasttxframe; - __le32 failed; - __le32 retry; - __le32 multiretry; - __le32 framedup; - __le32 rtssuccess; - __le32 rtsfailure; - __le32 ackfailure; - __le32 rxfrag; - __le32 mcastrxframe; - __le32 fcserror; - __le32 txframe; - __le32 wepundecryptable; -} __attribute__ ((packed)); - -struct cmd_ds_mac_control { - struct cmd_header hdr; - __le16 action; - u16 reserved; -} __attribute__ ((packed)); - -struct cmd_ds_mac_multicast_adr { - struct cmd_header hdr; - __le16 action; - __le16 nr_of_adrs; - u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE]; -} __attribute__ ((packed)); - -struct cmd_ds_gspi_bus_config { - struct cmd_header hdr; - __le16 action; - __le16 bus_delay_mode; - __le16 host_time_delay_to_read_port; - __le16 host_time_delay_to_read_register; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_authenticate { - u8 macaddr[ETH_ALEN]; - u8 authtype; - u8 reserved[10]; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_deauthenticate { - struct cmd_header hdr; - - u8 macaddr[ETH_ALEN]; - __le16 reasoncode; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_associate { - u8 peerstaaddr[6]; - __le16 capability; - __le16 listeninterval; - __le16 bcnperiod; - u8 dtimperiod; - -#if 0 - mrvlietypes_ssidparamset_t ssidParamSet; - mrvlietypes_phyparamset_t phyparamset; - mrvlietypes_ssparamset_t ssparamset; - mrvlietypes_ratesparamset_t ratesParamSet; -#endif -} __attribute__ ((packed)); - -struct cmd_ds_802_11_associate_rsp { - struct ieeetypes_assocrsp assocRsp; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_set_wep { - struct cmd_header hdr; - - /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */ - __le16 action; - - /* key Index selected for Tx */ - __le16 keyindex; - - /* 40, 128bit or TXWEP */ - uint8_t keytype[4]; - uint8_t keymaterial[4][16]; -} __attribute__ ((packed)); - -struct cmd_ds_802_3_get_stat { - __le32 xmitok; - __le32 rcvok; - __le32 xmiterror; - __le32 rcverror; - __le32 rcvnobuffer; - __le32 rcvcrcerror; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_get_stat { - __le32 txfragmentcnt; - __le32 mcasttxframecnt; - __le32 failedcnt; - __le32 retrycnt; - __le32 Multipleretrycnt; - __le32 rtssuccesscnt; - __le32 rtsfailurecnt; - __le32 ackfailurecnt; - __le32 frameduplicatecnt; - __le32 rxfragmentcnt; - __le32 mcastrxframecnt; - __le32 fcserrorcnt; - __le32 bcasttxframecnt; - __le32 bcastrxframecnt; - __le32 txbeacon; - __le32 rxbeacon; - __le32 wepundecryptable; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_snmp_mib { - struct cmd_header hdr; - - __le16 action; - __le16 oid; - __le16 bufsize; - u8 value[128]; -} __attribute__ ((packed)); - -struct cmd_ds_mac_reg_map { - __le16 buffersize; - u8 regmap[128]; - __le16 reserved; -} __attribute__ ((packed)); - -struct cmd_ds_bbp_reg_map { - __le16 buffersize; - u8 regmap[128]; - __le16 reserved; -} __attribute__ ((packed)); - -struct cmd_ds_rf_reg_map { - __le16 buffersize; - u8 regmap[64]; - __le16 reserved; -} __attribute__ ((packed)); - -struct cmd_ds_mac_reg_access { - __le16 action; - __le16 offset; - __le32 value; -} __attribute__ ((packed)); - -struct cmd_ds_bbp_reg_access { - __le16 action; - __le16 offset; - u8 value; - u8 reserved[3]; -} __attribute__ ((packed)); - -struct cmd_ds_rf_reg_access { - __le16 action; - __le16 offset; - u8 value; - u8 reserved[3]; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_radio_control { - struct cmd_header hdr; - - __le16 action; - __le16 control; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_beacon_control { - __le16 action; - __le16 beacon_enable; - __le16 beacon_period; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_sleep_params { - struct cmd_header hdr; - - /* ACT_GET/ACT_SET */ - __le16 action; - - /* Sleep clock error in ppm */ - __le16 error; - - /* Wakeup offset in usec */ - __le16 offset; - - /* Clock stabilization time in usec */ - __le16 stabletime; - - /* control periodic calibration */ - uint8_t calcontrol; - - /* control the use of external sleep clock */ - uint8_t externalsleepclk; - - /* reserved field, should be set to zero */ - __le16 reserved; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_inactivity_timeout { - struct cmd_header hdr; - - /* ACT_GET/ACT_SET */ - __le16 action; - - /* Inactivity timeout in msec */ - __le16 timeout; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_rf_channel { - struct cmd_header hdr; - - __le16 action; - __le16 channel; - __le16 rftype; /* unused */ - __le16 reserved; /* unused */ - u8 channellist[32]; /* unused */ -} __attribute__ ((packed)); - -struct cmd_ds_802_11_rssi { - /* weighting factor */ - __le16 N; - - __le16 reserved_0; - __le16 reserved_1; - __le16 reserved_2; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_rssi_rsp { - __le16 SNR; - __le16 noisefloor; - __le16 avgSNR; - __le16 avgnoisefloor; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_mac_address { - struct cmd_header hdr; - - __le16 action; - u8 macadd[ETH_ALEN]; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_rf_tx_power { - struct cmd_header hdr; - - __le16 action; - __le16 curlevel; - s8 maxlevel; - s8 minlevel; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_rf_antenna { - __le16 action; - - /* Number of antennas or 0xffff(diversity) */ - __le16 antennamode; - -} __attribute__ ((packed)); - -struct cmd_ds_802_11_monitor_mode { - __le16 action; - __le16 mode; -} __attribute__ ((packed)); - -struct cmd_ds_set_boot2_ver { - struct cmd_header hdr; - - __le16 action; - __le16 version; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_fw_wake_method { - struct cmd_header hdr; - - __le16 action; - __le16 method; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_sleep_period { - struct cmd_header hdr; - - __le16 action; - __le16 period; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_ps_mode { - __le16 action; - __le16 nullpktinterval; - __le16 multipledtim; - __le16 reserved; - __le16 locallisteninterval; -} __attribute__ ((packed)); - -struct cmd_confirm_sleep { - struct cmd_header hdr; - - __le16 action; - __le16 nullpktinterval; - __le16 multipledtim; - __le16 reserved; - __le16 locallisteninterval; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_data_rate { - struct cmd_header hdr; - - __le16 action; - __le16 reserved; - u8 rates[MAX_RATES]; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_rate_adapt_rateset { - struct cmd_header hdr; - __le16 action; - __le16 enablehwauto; - __le16 bitmap; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_ad_hoc_start { - struct cmd_header hdr; - - u8 ssid[IW_ESSID_MAX_SIZE]; - u8 bsstype; - __le16 beaconperiod; - u8 dtimperiod; /* Reserved on v9 and later */ - union IEEEtypes_ssparamset ssparamset; - union ieeetypes_phyparamset phyparamset; - __le16 probedelay; - __le16 capability; - u8 rates[MAX_RATES]; - u8 tlv_memory_size_pad[100]; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_ad_hoc_result { - struct cmd_header hdr; - - u8 pad[3]; - u8 bssid[ETH_ALEN]; -} __attribute__ ((packed)); - -struct adhoc_bssdesc { - u8 bssid[ETH_ALEN]; - u8 ssid[IW_ESSID_MAX_SIZE]; - u8 type; - __le16 beaconperiod; - u8 dtimperiod; - __le64 timestamp; - __le64 localtime; - union ieeetypes_phyparamset phyparamset; - union IEEEtypes_ssparamset ssparamset; - __le16 capability; - u8 rates[MAX_RATES]; - - /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the - * Adhoc join command and will cause a binary layout mismatch with - * the firmware - */ -} __attribute__ ((packed)); - -struct cmd_ds_802_11_ad_hoc_join { - struct cmd_header hdr; - - struct adhoc_bssdesc bss; - __le16 failtimeout; /* Reserved on v9 and later */ - __le16 probedelay; /* Reserved on v9 and later */ -} __attribute__ ((packed)); - -struct cmd_ds_802_11_ad_hoc_stop { - struct cmd_header hdr; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_enable_rsn { - struct cmd_header hdr; - - __le16 action; - __le16 enable; -} __attribute__ ((packed)); - -struct MrvlIEtype_keyParamSet { - /* type ID */ - __le16 type; - - /* length of Payload */ - __le16 length; - - /* type of key: WEP=0, TKIP=1, AES=2 */ - __le16 keytypeid; - - /* key control Info specific to a keytypeid */ - __le16 keyinfo; - - /* length of key */ - __le16 keylen; - - /* key material of size keylen */ - u8 key[32]; -} __attribute__ ((packed)); - -#define MAX_WOL_RULES 16 - -struct host_wol_rule { - uint8_t rule_no; - uint8_t rule_ops; - __le16 sig_offset; - __le16 sig_length; - __le16 reserve; - __be32 sig_mask; - __be32 signature; -} __attribute__ ((packed)); - -struct wol_config { - uint8_t action; - uint8_t pattern; - uint8_t no_rules_in_cmd; - uint8_t result; - struct host_wol_rule rule[MAX_WOL_RULES]; -} __attribute__ ((packed)); - -struct cmd_ds_host_sleep { - struct cmd_header hdr; - __le32 criteria; - uint8_t gpio; - uint16_t gap; - struct wol_config wol_conf; -} __attribute__ ((packed)); - - - -struct cmd_ds_802_11_key_material { - struct cmd_header hdr; - - __le16 action; - struct MrvlIEtype_keyParamSet keyParamSet[2]; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_eeprom_access { - struct cmd_header hdr; - __le16 action; - __le16 offset; - __le16 len; - /* firmware says it returns a maximum of 20 bytes */ -#define LBS_EEPROM_READ_LEN 20 - u8 value[LBS_EEPROM_READ_LEN]; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_tpc_cfg { - struct cmd_header hdr; - - __le16 action; - uint8_t enable; - int8_t P0; - int8_t P1; - int8_t P2; - uint8_t usesnr; -} __attribute__ ((packed)); - - -struct cmd_ds_802_11_pa_cfg { - struct cmd_header hdr; - - __le16 action; - uint8_t enable; - int8_t P0; - int8_t P1; - int8_t P2; -} __attribute__ ((packed)); - - -struct cmd_ds_802_11_led_ctrl { - __le16 action; - __le16 numled; - u8 data[256]; -} __attribute__ ((packed)); - -struct cmd_ds_802_11_afc { - __le16 afc_auto; - union { - struct { - __le16 threshold; - __le16 period; - }; - struct { - __le16 timing_offset; /* signed */ - __le16 carrier_offset; /* signed */ - }; - }; -} __attribute__ ((packed)); - -struct cmd_tx_rate_query { - __le16 txrate; -} __attribute__ ((packed)); - -struct cmd_ds_get_tsf { - __le64 tsfvalue; -} __attribute__ ((packed)); - -struct cmd_ds_bt_access { - __le16 action; - __le32 id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; -} __attribute__ ((packed)); - -struct cmd_ds_fwt_access { - __le16 action; - __le32 id; - u8 valid; - u8 da[ETH_ALEN]; - u8 dir; - u8 ra[ETH_ALEN]; - __le32 ssn; - __le32 dsn; - __le32 metric; - u8 rate; - u8 hopcount; - u8 ttl; - __le32 expiration; - u8 sleepmode; - __le32 snr; - __le32 references; - u8 prec[ETH_ALEN]; -} __attribute__ ((packed)); - - -struct cmd_ds_mesh_config { - struct cmd_header hdr; - - __le16 action; - __le16 channel; - __le16 type; - __le16 length; - u8 data[128]; /* last position reserved */ -} __attribute__ ((packed)); - - -struct cmd_ds_mesh_access { - struct cmd_header hdr; - - __le16 action; - __le32 data[32]; /* last position reserved */ -} __attribute__ ((packed)); - -/* Number of stats counters returned by the firmware */ -#define MESH_STATS_NUM 8 - -struct cmd_ds_command { - /* command header */ - __le16 command; - __le16 size; - __le16 seqnum; - __le16 result; - - /* command Body */ - union { - struct cmd_ds_802_11_ps_mode psmode; - struct cmd_ds_802_11_associate associate; - struct cmd_ds_802_11_authenticate auth; - struct cmd_ds_802_11_get_stat gstat; - struct cmd_ds_802_3_get_stat gstat_8023; - struct cmd_ds_802_11_rf_antenna rant; - struct cmd_ds_802_11_monitor_mode monitor; - struct cmd_ds_802_11_rssi rssi; - struct cmd_ds_802_11_rssi_rsp rssirsp; - struct cmd_ds_mac_reg_access macreg; - struct cmd_ds_bbp_reg_access bbpreg; - struct cmd_ds_rf_reg_access rfreg; - - struct cmd_ds_802_11d_domain_info domaininfo; - struct cmd_ds_802_11d_domain_info domaininforesp; - - struct cmd_ds_802_11_tpc_cfg tpccfg; - struct cmd_ds_802_11_afc afc; - struct cmd_ds_802_11_led_ctrl ledgpio; - - struct cmd_tx_rate_query txrate; - struct cmd_ds_bt_access bt; - struct cmd_ds_fwt_access fwt; - struct cmd_ds_get_tsf gettsf; - struct cmd_ds_802_11_beacon_control bcn_ctrl; - } params; -} __attribute__ ((packed)); - -#endif diff --git a/drivers/net/wireless/mv8686/if_sdio.c b/drivers/net/wireless/mv8686/if_sdio.c deleted file mode 100755 index d7bfcf13ad38..000000000000 --- a/drivers/net/wireless/mv8686/if_sdio.c +++ /dev/null @@ -1,1392 +0,0 @@ -/* - * linux/drivers/net/wireless/mv8686/if_sdio.c - * - * Copyright 2007-2008 Pierre Ossman - * - * Inspired by if_cs.c, Copyright 2007 Holger Schurig - * - * This hardware has more or less no CMD53 support, so all registers - * must be accessed using sdio_readb()/sdio_writeb(). - * - * Transfers must be in one transaction or the firmware goes bonkers. - * This means that the transfer must either be small enough to do a - * byte based transfer or it must be padded to a multiple of the - * current block size. - * - * As SDIO is still new to the kernel, it is unfortunately common with - * bugs in the host controllers related to that. One such bug is that - * controllers cannot do transfers that aren't a multiple of 4 bytes. - * If you don't have time to fix the host controller driver, you can - * work around the problem by modifying if_sdio_host_to_card() and - * if_sdio_card_to_host() to pad the data. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "host.h" -#include "decl.h" -#include "defs.h" -#include "dev.h" -#include "if_sdio.h" -#include "wifi_power.h" - -#if (SDIO_SPEED_EVUL == 1) -#include -#endif - -struct sdio_func *wifi_sdio_func = NULL; -EXPORT_SYMBOL(wifi_sdio_func); - -/* - * Externs from MMC core. - */ -extern struct mmc_host *wifi_mmc_host; - -static const struct sdio_device_id if_sdio_ids[] = -{ - { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, SDIO_DEVICE_ID_MARVELL_LIBERTAS) }, - { /* end: all zeroes */ }, -}; -MODULE_DEVICE_TABLE(sdio, if_sdio_ids); - -struct if_sdio_model -{ - int model; - const char *helper; - const char *firmware; -}; - -static struct if_sdio_model if_sdio_models[] = -{ - { /* 8686 */ - .model = 0x0B, - .helper = "sd8686_helper.bin", - .firmware = "sd8686.bin", - }, -}; - -struct if_sdio_packet -{ - struct if_sdio_packet *next; - u16 nb; - u8 buffer[0] __attribute__((aligned(4))); -}; - -struct if_sdio_card -{ - struct sdio_func *func; - struct lbs_private *priv; - - int model; - unsigned long ioport; - - const char *helper; - const char *firmware; - - u8 buffer[65536]; /* buffer for rx packet/resp */ - - spinlock_t lock; - struct if_sdio_packet *packets; - - struct workqueue_struct *workqueue; - struct work_struct packet_worker; -}; - -/********************************************************************/ -/* I/O */ -/********************************************************************/ - -int lbs_reset_deep_sleep_wakeup(struct lbs_private * priv) -{ - int ret = 0; - struct if_sdio_card *card = (struct if_sdio_card *)priv->card; - - sdio_claim_host(card->func); - sdio_writeb(card->func, IF_SDIO_HOST_RESET, IF_SDIO_CONFIGURE, &ret); - sdio_release_host(card->func); - - return ret; -} - -int lbs_exit_deep_sleep(struct lbs_private * priv) -{ - int ret; - struct if_sdio_card *card = (struct if_sdio_card *)priv->card; - - sdio_claim_host(card->func); - sdio_writeb(card->func, IF_SDIO_HOST_UP, IF_SDIO_CONFIGURE, &ret); - sdio_release_host(card->func); - - return ret; -} - -static u16 if_sdio_read_scratch(struct if_sdio_card *card, int *err) -{ - int ret = 0; - u16 scratch; - - scratch = sdio_readb(card->func, IF_SDIO_SCRATCH, &ret); - if (!ret) - scratch |= sdio_readb(card->func, IF_SDIO_SCRATCH + 1, &ret) << 8; - - if (err) - *err = ret; - - if (ret) - return 0xffff; - - return scratch; -} - -static int if_sdio_handle_cmd(struct if_sdio_card *card, - u8 *buffer, unsigned size) -{ - struct lbs_private *priv = card->priv; - int ret = 0; - unsigned long flags; - u8 i; - - lbs_deb_enter(LBS_DEB_SDIO); - - if (size > LBS_CMD_BUFFER_SIZE) - { - lbs_deb_sdio("Cmd resp pkt is too large (%d bytes)\n", (int)size); - ret = -E2BIG; - goto out; - } - - spin_lock_irqsave(&priv->driver_lock, flags); - - i = (priv->resp_idx == 0) ? 1 : 0; - //BUG_ON(priv->resp_len[i]); - priv->resp_len[i] = size; - memcpy(priv->resp_buf[i], buffer, size); - lbs_notify_command_response(priv, i); - - spin_unlock_irqrestore(&card->priv->driver_lock, flags); - -out: - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; -} - -static int if_sdio_handle_data(struct if_sdio_card *card, - u8 *buffer, u32 size) -{ - int ret = 0; - struct sk_buff *skb; - char *data; - - lbs_deb_enter(LBS_DEB_SDIO); - - if (size > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) - { - lbs_deb_sdio("Data resp pkt is too large (%d bytes)\n", (int)size); - ret = -E2BIG; - goto out; - } - - skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + NET_IP_ALIGN); - if (!skb) - { - ret = -ENOMEM; - goto out; - } - - skb_reserve(skb, NET_IP_ALIGN); - - data = skb_put(skb, size); - - memcpy(data, buffer, size); - - lbs_process_rxed_packet(card->priv, skb); - -out: - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; -} - -static int if_sdio_handle_event(struct if_sdio_card *card, - u8 *buffer, u32 size) -{ - int ret = 0; - u32 event; - - lbs_deb_enter(LBS_DEB_SDIO); - - if (size < 4) - { - lbs_deb_sdio("event packet too small (%d bytes)\n", - (int)size); - ret = -EINVAL; - goto out; - } - event = buffer[3] << 24; - event |= buffer[2] << 16; - event |= buffer[1] << 8; - event |= buffer[0]; - - lbs_queue_event(card->priv, event & 0xFF); - -out: - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; -} - -static int if_sdio_card_to_host(struct if_sdio_card *card) -{ - int ret = 0; - u8 status; - u16 size, type, chunk; - unsigned long timeout; - - lbs_deb_enter(LBS_DEB_SDIO); - - size = if_sdio_read_scratch(card, &ret); - if (ret) - goto out; - - if (size < 4) - { - lbs_deb_sdio("Invalid pkt size (%d bytes) from FW.\n", (int)size); - ret = -EINVAL; - goto out; - } - - timeout = jiffies + HZ; - while (1) - { - status = sdio_readb(card->func, IF_SDIO_STATUS, &ret); - if (ret) - { - printk("Card to host: read sdio_status failed.\n"); - goto out; - } - - if (status & IF_SDIO_IO_RDY) - break; - - if (time_after(jiffies, timeout)) - { - ret = -ETIMEDOUT; - goto out; - } - //mdelay(1); - } - - /* - * The transfer must be in one transaction or the firmware - * goes suicidal. There's no way to guarantee that for all - * controllers, but we can at least try. - */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - chunk = size; -#else - chunk = sdio_align_size(card->func, size); -#endif - if ((chunk > card->func->cur_blksize) || (chunk > 512)) - { - chunk = (chunk + card->func->cur_blksize - 1) / - card->func->cur_blksize * card->func->cur_blksize; - } - - ret = sdio_readsb(card->func, card->buffer, card->ioport, chunk); - if (ret) - goto out; - - chunk = card->buffer[0] | (card->buffer[1] << 8); - type = card->buffer[2] | (card->buffer[3] << 8); - - lbs_deb_sdio("packet of type %d and size %d bytes\n", (int)type, (int)chunk); - - if (chunk > size) { - lbs_deb_sdio("packet fragment (%d > %d)\n", (int)chunk, (int)size); - ret = -EINVAL; - goto out; - } - - if (chunk < size) { - lbs_deb_sdio("packet fragment (%d < %d)\n", - (int)chunk, (int)size); - } - - switch (type) - { - case MVMS_CMD: - ret = if_sdio_handle_cmd(card, card->buffer + 4, chunk - 4); - if (ret) - goto out; - break; - case MVMS_DAT: - ret = if_sdio_handle_data(card, card->buffer + 4, chunk - 4); - if (ret) - goto out; - break; - case MVMS_EVENT: - ret = if_sdio_handle_event(card, card->buffer + 4, chunk - 4); - if (ret) - goto out; - break; - default: - lbs_deb_sdio("Invalid type (%d) from FW.\n", (int)type); - ret = -EINVAL; - goto out; - } - -out: - if (ret) - printk("Problem fetching packet from FW: ret=%d\n", ret); - - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; -} - -static void if_sdio_host_to_card_worker(struct work_struct *work) -{ - struct if_sdio_card *card; - struct if_sdio_packet *packet; - unsigned long timeout; - u8 status; - int ret; - unsigned long flags; - - lbs_deb_enter(LBS_DEB_SDIO); - - card = container_of(work, struct if_sdio_card, packet_worker); - - while (1) - { - spin_lock_irqsave(&card->lock, flags); - packet = card->packets; - if (packet) - card->packets = packet->next; - spin_unlock_irqrestore(&card->lock, flags); - - if (!packet) - break; - - sdio_claim_host(card->func); - - timeout = jiffies + HZ; - while (1) - { - status = sdio_readb(card->func, IF_SDIO_STATUS, &ret); - if (ret) - { - printk("Host to card worker: read sdio_status failed.\n"); - goto release; - } - - if (status & IF_SDIO_IO_RDY) - break; - if (time_after(jiffies, timeout)) - { - ret = -ETIMEDOUT; - goto release; - } - //mdelay(1); - } - - ret = sdio_writesb(card->func, card->ioport, packet->buffer, packet->nb); - if (ret) - goto release; -release: - sdio_release_host(card->func); - - kfree(packet); - } - - lbs_deb_leave(LBS_DEB_SDIO); -} - -/********************************************************************/ -/* Firmware */ -/********************************************************************/ - -inline int if_sdio_wait_dnld_ready(struct if_sdio_card *card) -{ - int ret; - unsigned long timeout; - volatile u32 status; - - timeout = jiffies + HZ; - - while (1) - { - status = sdio_readb(card->func, IF_SDIO_STATUS, &ret); - if (ret) - return 1; - - if ((status & IF_SDIO_IO_RDY) && (status & IF_SDIO_DL_RDY)) - return 0; - - if (time_after(jiffies, timeout)) - return 2; - - //mdelay(1); - } - - return -1; -} - -/* - * Download WIFI helper to module via SDIO. - */ -static int if_sdio_prog_helper(struct if_sdio_card *card) -{ - int ret; - const struct firmware *fw; - unsigned long timeout; - u8 *chunk_buffer; - u32 chunk_size, tx_len; - const u8 *firmware; - size_t size; - - lbs_deb_enter(LBS_DEB_SDIO); - - ret = request_firmware(&fw, card->helper, &card->func->dev); - if (ret) - { - printk("Fail to request helper firmware.\n"); - goto out; - } - printk("%s: request fw ok.\n", __func__); - - tx_len = SD_BLOCK_SIZE * FW_TRANSFER_NBLOCK; //SDIO frame length. - - chunk_buffer = kzalloc(tx_len, GFP_KERNEL); - if (!chunk_buffer) - { - printk("kzalloc for chunk buffer failed.\n"); - ret = -ENOMEM; - goto release_fw; - } - - sdio_claim_host(card->func); - - /* Here, we need to make sure the block-size is 256. */ - ret = sdio_set_block_size(card->func, 0); - if (ret) - { - printk("Set block size to 256 for download firmware failed.\n"); - goto release; - } - - firmware = fw->data; - size = fw->size; - - while (size) - { - ret = if_sdio_wait_dnld_ready(card); - if (ret != 0) - { - printk("Waiting for DNLD READY failed: %d\n", ret); - goto release; - } - - chunk_size = min(size, (size_t)(tx_len - SDIO_HEADER_LEN)); - - *((__le32*)chunk_buffer) = cpu_to_le32(chunk_size); - memcpy(chunk_buffer + 4, firmware, chunk_size); - - ret = sdio_writesb(card->func, card->ioport, chunk_buffer, tx_len); - if (ret) - goto release; - - firmware += chunk_size; - size -= chunk_size; - } - - /* an empty block marks the end of the transfer */ - memset(chunk_buffer, 0, 4); - ret = sdio_writesb(card->func, card->ioport, chunk_buffer, tx_len); - if (ret) - goto release; - - /* wait for the helper to boot by looking at the size register */ - timeout = jiffies + HZ; - while (1) - { - u16 req_size; - - req_size = sdio_readb(card->func, IF_SDIO_RD_BASE, &ret); - if (ret) - goto release; - - req_size |= sdio_readb(card->func, IF_SDIO_RD_BASE + 1, &ret) << 8; - if (ret) - goto release; - - if (req_size != 0) - break; - - if (time_after(jiffies, timeout)) - { - ret = -ETIMEDOUT; - goto release; - } - //msleep(10); - } - - ret = 0; - -release: - sdio_release_host(card->func); - kfree(chunk_buffer); - -release_fw: - release_firmware(fw); - -out: - if (ret) - printk("Failed to download helper firmware.\n"); - - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; -} - -static int if_sdio_prog_real(struct if_sdio_card *card) -{ - int ret; - const struct firmware *fw; - unsigned long timeout; - u8 *chunk_buffer; - u32 chunk_size; - const u8 *firmware; - size_t size, req_size; -#if (SDIO_SPEED_EVUL == 1) - struct timeval sdio_start_tv, sdio_stop_tv; - unsigned long download_time, download_second; -#endif - - lbs_deb_enter(LBS_DEB_SDIO); - - ret = request_firmware(&fw, card->firmware, &card->func->dev); - if (ret) - { - printk("Fail to request real firmware.\n"); - goto out; - } - - chunk_buffer = kzalloc(512, GFP_KERNEL); - if (!chunk_buffer) { - ret = -ENOMEM; - goto release_fw; - } - - sdio_claim_host(card->func); - - /* Here, we need to make sure the block-size is 256. */ - ret = sdio_set_block_size(card->func, 0); - if (ret) - { - printk("Set block size to 256 for download FW failed.\n"); - goto release; - } - - firmware = fw->data; - size = fw->size; - -#if (SDIO_SPEED_EVUL == 1) - do_gettimeofday(&sdio_start_tv); -#endif - - while (size) - { - ret = if_sdio_wait_dnld_ready(card); - if (ret != 0) - { - printk("Waiting for DNLD READY failed: %d\n", ret); - goto release; - } - - req_size = sdio_readb(card->func, IF_SDIO_RD_BASE, &ret); - if (ret) - goto release; - - req_size |= sdio_readb(card->func, IF_SDIO_RD_BASE + 1, &ret) << 8; - if (ret) - goto release; -/* - lbs_deb_sdio("firmware wants %d bytes\n", (int)req_size); -*/ - if (req_size == 0) { - lbs_deb_sdio("firmware helper gave up early\n"); - ret = -EIO; - goto release; - } - - if (req_size & 0x01) { - lbs_deb_sdio("firmware helper signalled error\n"); - ret = -EIO; - goto release; - } - - if (req_size > size) - req_size = size; - - while (req_size) - { - chunk_size = min(req_size, (size_t)512); - - memcpy(chunk_buffer, firmware, chunk_size); -/* - lbs_deb_sdio("sending %d bytes (%d bytes) chunk\n", - chunk_size, (chunk_size + 31) / 32 * 32); -*/ - ret = sdio_writesb(card->func, card->ioport, - chunk_buffer, roundup(chunk_size, SD_BLOCK_SIZE)); - if (ret) - goto release; - - firmware += chunk_size; - size -= chunk_size; - req_size -= chunk_size; - } - } -#if (SDIO_SPEED_EVUL == 1) - do_gettimeofday(&sdio_stop_tv); - - if (sdio_stop_tv.tv_usec < sdio_start_tv.tv_usec) - { - sdio_stop_tv.tv_sec -= 1; - } - download_second = sdio_stop_tv.tv_sec - sdio_start_tv.tv_sec; - - if (sdio_stop_tv.tv_usec < sdio_start_tv.tv_usec) - { - download_time = 1*1000*1000 - sdio_start_tv.tv_usec; - download_time += sdio_stop_tv.tv_usec; - } - else - { - download_time = sdio_stop_tv.tv_usec - sdio_start_tv.tv_usec; - - } - download_time /= 1000; //ms - printk("Data size = %d bytes, Time = %2lu.%03lu seconds, Rate = %lu kbps\n", - fw->size, download_second, download_time, - (fw->size * 8 * 1000) / (download_second * 1000 + download_time) / 1000); -#endif - - ret = 0; - - //lbs_deb_sdio("waiting for firmware to boot...\n"); - //printk("waiting for firmware to boot...\n"); - - /* wait for the firmware to boot */ - timeout = jiffies + HZ; - while (1) - { - u16 scratch; - - scratch = if_sdio_read_scratch(card, &ret); - if (ret) - goto release; - - if (scratch == IF_SDIO_FIRMWARE_OK) - break; - - if (time_after(jiffies, timeout)) { - ret = -ETIMEDOUT; - goto release; - } - //msleep(10); - } - - ret = 0; - -release: - sdio_release_host(card->func); - kfree(chunk_buffer); -release_fw: - release_firmware(fw); - -out: - if (ret) - printk("Failed to download firmware.\n"); - //else - //printk("Success to download firmware.\n"); - - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; -} - -static int if_sdio_prog_firmware(struct if_sdio_card *card) -{ - int ret; - u16 scratch; - - lbs_deb_enter(LBS_DEB_SDIO); - - sdio_claim_host(card->func); - scratch = if_sdio_read_scratch(card, &ret); - sdio_release_host(card->func); - - if (ret) - goto out; - - if (scratch == IF_SDIO_FIRMWARE_OK) - { - lbs_deb_sdio("firmware already loaded\n"); - goto success; - } - - ret = if_sdio_prog_helper(card); - if (ret) - goto out; - - ret = if_sdio_prog_real(card); - if (ret) - goto out; - -success: - ret = 0; - -out: - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; -} - -/*******************************************************************/ -/* HIF callbacks */ -/*******************************************************************/ - -static int if_sdio_host_to_card(struct lbs_private *priv, - u8 type, u8 *buf, u16 nb) -{ - int ret; - struct if_sdio_card *card; - struct if_sdio_packet *packet, *cur; - u16 size; - unsigned long flags; - - lbs_deb_enter_args(LBS_DEB_SDIO, "type %d, bytes %d", type, nb); - - card = priv->card; - - if (nb > (65536 - sizeof(struct if_sdio_packet) - 4)) - { - ret = -EINVAL; - goto out; - } - - /* - * The transfer must be in one transaction or the firmware - * goes suicidal. There's no way to guarantee that for all - * controllers, but we can at least try. - */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - size = nb + 4; -#else - size = sdio_align_size(card->func, nb + 4); -#endif - if ((size > card->func->cur_blksize) || (size > 512)) - { - size = (size + card->func->cur_blksize - 1) / - card->func->cur_blksize * card->func->cur_blksize; - } - - packet = kzalloc(sizeof(struct if_sdio_packet) + size, GFP_ATOMIC); - if (!packet) { - ret = -ENOMEM; - goto out; - } - - packet->next = NULL; - packet->nb = size; - - /* - * SDIO specific header. - */ - packet->buffer[0] = (nb + 4) & 0xff; - packet->buffer[1] = ((nb + 4) >> 8) & 0xff; - packet->buffer[2] = type; - packet->buffer[3] = 0; - - memcpy(packet->buffer + 4, buf, nb); - - spin_lock_irqsave(&card->lock, flags); - - if (!card->packets) - card->packets = packet; - else { - cur = card->packets; - while (cur->next) - cur = cur->next; - cur->next = packet; - } - - switch (type) - { - case MVMS_CMD: - priv->dnld_sent = DNLD_CMD_SENT; - break; - case MVMS_DAT: - priv->dnld_sent = DNLD_DATA_SENT; - break; - default: - lbs_deb_sdio("unknown packet type %d\n", (int)type); - } - - spin_unlock_irqrestore(&card->lock, flags); - - queue_work(card->workqueue, &card->packet_worker); - - ret = 0; - -out: - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; -} - -/*******************************************************************/ -/* SDIO callbacks */ -/*******************************************************************/ - -static void if_sdio_interrupt(struct sdio_func *func) -{ - int ret; - struct if_sdio_card *card; - u8 cause; - - lbs_deb_enter(LBS_DEB_SDIO); - - card = sdio_get_drvdata(func); - - cause = sdio_readb(card->func, IF_SDIO_H_INT_STATUS, &ret); - if (ret) - goto out; - - lbs_deb_sdio("interrupt: 0x%X\n", (unsigned)cause); - - sdio_writeb(card->func, ~cause, IF_SDIO_H_INT_STATUS, &ret); - if (ret) - goto out; - - /* - * Ignore the define name, this really means the card has - * successfully received the command. - */ - if (cause & IF_SDIO_H_INT_DNLD) - lbs_host_to_card_done(card->priv); - - - if (cause & IF_SDIO_H_INT_UPLD) { - ret = if_sdio_card_to_host(card); - if (ret) - goto out; - } - - ret = 0; - -out: - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); -} - -static int if_sdio_probe(struct sdio_func *func, - const struct sdio_device_id *id) -{ - struct if_sdio_card *card; - struct lbs_private *priv; - int ret, i; - unsigned int model; - struct if_sdio_packet *packet; - - lbs_deb_enter(LBS_DEB_SDIO); - - printk("%s: enter.\n", __func__); - - for (i = 0;i < func->card->num_info;i++) - { - if (sscanf(func->card->info[i], - "802.11 SDIO ID: %x", &model) == 1) - break; - if (sscanf(func->card->info[i], - "ID: %x", &model) == 1) - break; - if (!strcmp(func->card->info[i], "IBIS Wireless SDIO Card")) - { - model = 4; - break; - } - } - - if (i == func->card->num_info) - { - lbs_pr_err("unable to identify card model\n"); - return -ENODEV; - } - - card = kzalloc(sizeof(struct if_sdio_card), GFP_KERNEL); - if (!card) - return -ENOMEM; - - card->func = func; - card->model = model; - spin_lock_init(&card->lock); - card->workqueue = create_workqueue("mv8686_sdio"); - INIT_WORK(&card->packet_worker, if_sdio_host_to_card_worker); - - for (i = 0;i < ARRAY_SIZE(if_sdio_models);i++) - { - if (card->model == if_sdio_models[i].model) - break; - } - - if (i == ARRAY_SIZE(if_sdio_models)) - { - lbs_pr_err("unkown card model 0x%x\n", card->model); - ret = -ENODEV; - goto free; - } - - card->helper = if_sdio_models[i].helper; - card->firmware = if_sdio_models[i].firmware; - - sdio_claim_host(func); - - ret = sdio_enable_func(func); - if (ret) - goto release; - - ret = sdio_claim_irq(func, if_sdio_interrupt); - if (ret) - goto disable; - - card->ioport = sdio_readb(func, IF_SDIO_IOPORT, &ret); - if (ret) - goto release_int; - - card->ioport |= sdio_readb(func, IF_SDIO_IOPORT + 1, &ret) << 8; - if (ret) - goto release_int; - - card->ioport |= sdio_readb(func, IF_SDIO_IOPORT + 2, &ret) << 16; - if (ret) - goto release_int; - - sdio_release_host(func); - - sdio_set_drvdata(func, card); - - lbs_deb_sdio("class = 0x%X, vendor = 0x%X, " - "device = 0x%X, model = 0x%X, ioport = 0x%X\n", - func->class, func->vendor, func->device, - model, (unsigned)card->ioport); - - ret = if_sdio_prog_firmware(card); - if (ret) - goto reclaim; - - priv = lbs_add_card(card, &func->dev); - if (!priv) { - ret = -ENOMEM; - goto reclaim; - } - - card->priv = priv; - - priv->card = card; - priv->hw_host_to_card = if_sdio_host_to_card; - - priv->fw_ready = 1; - - /* - * Enable interrupts now that everything is set up - */ - sdio_claim_host(func); - sdio_writeb(func, 0x0f, IF_SDIO_H_INT_MASK, &ret); - sdio_release_host(func); - if (ret) - goto reclaim; - - ret = lbs_start_card(priv); - if (ret) - goto err_activate_card; - - if (priv->fwcapinfo & FW_CAPINFO_PS) - priv->ps_supported = 1; - - wifi_sdio_func = func; - -out: - lbs_deb_leave_args(LBS_DEB_SDIO, "ret %d", ret); - - return ret; - -err_activate_card: - flush_workqueue(card->workqueue); - lbs_remove_card(priv); -reclaim: - sdio_claim_host(func); -release_int: - sdio_release_irq(func); -disable: - sdio_disable_func(func); -release: - sdio_release_host(func); -free: - destroy_workqueue(card->workqueue); - - while (card->packets) - { - packet = card->packets; - card->packets = card->packets->next; - kfree(packet); - } - - kfree(card); - - goto out; -} - -int wifi_func_removed; - -static void if_sdio_remove(struct sdio_func *func) -{ - struct if_sdio_card *card; - struct if_sdio_packet *packet; - - lbs_deb_enter(LBS_DEB_SDIO); - - card = sdio_get_drvdata(func); - card->priv->surpriseremoved = 1; - - wifi_sdio_func = NULL; - - /* - * Remove netdev, break wext and socket path. - */ - lbs_stop_card(card->priv); - - /* - * Destroy the driver completely. - */ - lbs_remove_card(card->priv); - - flush_scheduled_work(); - if (card->workqueue != NULL) - destroy_workqueue(card->workqueue); - - sdio_claim_host(func); - sdio_release_irq(func); - sdio_disable_func(func); - sdio_release_host(func); - - while (card->packets) - { - packet = card->packets; - card->packets = card->packets->next; - kfree(packet); - } - kfree(card); - - wifi_func_removed = 1; - - lbs_deb_leave(LBS_DEB_SDIO); -} - -static struct sdio_driver if_sdio_driver = -{ - .name = "mv8686_sdio", - .id_table = if_sdio_ids, - .probe = if_sdio_probe, - .remove = if_sdio_remove, -}; - -/*******************************************************************/ -/* Module functions */ -/*******************************************************************/ - -/* - * Whether a GPIO is used to control the power of WiFi. - */ -int wifi_no_power_gpio = 0; /* 0-No 1-Yes */ - -extern int wifi_ps_status; - -#include "wifi_version.h" - -extern int mv8686_main_init(void); -extern void mv8686_main_exit(void); - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) -extern int rk29sdk_wifi_set_carddetect(int val); -#endif - -int rockchip_wifi_init_module(void) -{ - int ret = 0, timeout; - - mv8686_main_init(); - - wifi_func_removed = 0; - wifi_sdio_func = NULL; - wifi_no_power_gpio = 0; - - /* Make sure we are in awake. -- Yongle Lai */ - wifi_ps_status = WIFI_PS_AWAKE; - - printk("MV8686 WiFi driver (Powered by Rockchip,Ver %s) init.\n", MV8686_DRV_VERSION); - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - - if (wifi_mmc_host == NULL) - { - printk("SDIO host (mmc1) for WiFi is inactive.\n"); - return -ENODEV; - } -#endif - - ret = sdio_register_driver(&if_sdio_driver); - if (ret != 0) - { - printk("Register SDIO driver for WIFI failed.\n"); - return -ENODEV; - } - -#ifdef WIFI_GPIO_POWER_CONTROL - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - - if (wifi_mmc_host->bus_ops != NULL) /* mmc/card is attached already. */ - { - printk("SDIO maybe be attached already.\n"); - wifi_no_power_gpio = 1; - //return 0; - goto wait_wifi; - } -#endif - - wifi_turn_on_card(WIFI_CHIP_MV8686); - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - mmc_detect_change(wifi_mmc_host, 1); -#else - rk29sdk_wifi_set_carddetect(1); -#endif - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) -wait_wifi: -#endif - //printk("Waiting for SDIO card to be attached.\n"); - for (timeout = 100; timeout >=0; timeout--) - { - if (wifi_sdio_func != NULL) - break; - msleep(100); - } - if (timeout <= 0) - { - printk("No WiFi function card has been attached (10s).\n"); - - sdio_unregister_driver(&if_sdio_driver); - - wifi_turn_off_card(); -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - mmc_detect_change(wifi_mmc_host, 1); -#else - rk29sdk_wifi_set_carddetect(0); -#endif - return -ENODEV; - } - //printk("%s: timeout = %d (interval = 100 ms)\n", __func__, timeout); - -#endif - - /* - * Make sure system is awake when we're start up. - */ -#if (NEW_MV8686_PS == 1) - wifi_power_save_init(); -#endif - - - return 0; -} - -void rockchip_wifi_exit_module(void) -{ - int timeout; - - lbs_deb_enter(LBS_DEB_SDIO); - -#if (NEW_MV8686_PS == 1) - wifi_power_save_stop(); -#endif - -#if (ANDROID_POWER_SAVE == 1) - wifi_ps_status = WIFI_PS_AWAKE; -#endif - - sdio_unregister_driver(&if_sdio_driver); - -#ifdef WIFI_GPIO_POWER_CONTROL - - //if (wifi_no_power_gpio == 1) - // return; -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - if (wifi_mmc_host == NULL) - { - printk("No SDIO host is present.\n"); - goto out; - } -#endif - wifi_turn_off_card(); -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - mmc_detect_change(wifi_mmc_host, 2); -#else - rk29sdk_wifi_set_carddetect(0); -#endif - - //printk("Waiting for sdio card to be released ... \n"); - for (timeout = 40; timeout >= 0; timeout--) - { - msleep(100); -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - if (wifi_mmc_host->bus_ops == NULL) -#else - if (wifi_func_removed == 1) -#endif - break; - } - if (timeout < 0) - printk("Fail to release SDIO card.\n"); - //else - //printk("Success to release SDIO card.\n"); - printk("%s: timeout = %d (interval = 100 ms)\n", __func__, timeout); -#endif - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) -out: -#endif - -#if (NEW_MV8686_PS == 1) - wifi_power_save_exit(); -#endif - - mv8686_main_exit(); - - lbs_deb_leave(LBS_DEB_SDIO); -} - -#if 0 - -extern int rk29sdk_wifi_set_carddetect(int val); - -int rockchip_wifi_init_module(void) -{ - int ret, timeout; - - printk("MV8686 WiFi driver (Powered by Rockchip,Ver %s) init.\n", MV8686_DRV_VERSION); - - wifi_func_removed = 0; - mv8686_main_init(); - wifi_sdio_func = NULL; - wifi_no_power_gpio = 0; - - /* Make sure we are in awake. -- Yongle Lai */ - wifi_ps_status = WIFI_PS_AWAKE; - - ret = sdio_register_driver(&if_sdio_driver); - if (ret != 0) - { - printk("Register SDIO driver for WIFI failed.\n"); - return -ENODEV; - } - - wifi_turn_on_card(WIFI_CHIP_MV8686); - - rk29sdk_wifi_set_carddetect(1); - - for (timeout = 100; timeout >=0; timeout--) - { - if (wifi_sdio_func != NULL) - break; - msleep(100); - } - if (timeout <= 0) - { - printk("No WiFi function card has been attached (10s).\n"); - - sdio_unregister_driver(&if_sdio_driver); - - wifi_turn_off_card(); - rk29sdk_wifi_set_carddetect(0); - - wifi_func_removed = 1; - - return -ENODEV; - } - - return 0; -} - -void rockchip_wifi_exit_module(void) -{ - int timeout; - - sdio_unregister_driver(&if_sdio_driver); - - wifi_turn_off_card(); - - rk29sdk_wifi_set_carddetect(0); - - for (timeout = 40; timeout >= 0; timeout--) - { - msleep(100); - if (wifi_func_removed == 1) - break; - } - if (timeout < 0) - printk("Fail to release SDIO card.\n"); - - mv8686_main_exit(); - - printk("%s: timeout = %d (interval = 100 ms)\n", __func__, timeout); -} -#endif - -int mv88w8686_if_sdio_init_module(void) -{ - return rockchip_wifi_init_module(); -} - -void mv88w8686_if_sdio_exit_module(void) -{ - rockchip_wifi_exit_module(); -} - -#ifndef MODULE -EXPORT_SYMBOL(rockchip_wifi_init_module); -EXPORT_SYMBOL(rockchip_wifi_exit_module); -EXPORT_SYMBOL(mv88w8686_if_sdio_init_module); -EXPORT_SYMBOL(mv88w8686_if_sdio_exit_module); -#endif - -#ifdef MODULE -module_init(rockchip_wifi_init_module); -module_exit(rockchip_wifi_exit_module); -#endif - -MODULE_DESCRIPTION("MV8686 SDIO WLAN Driver"); -MODULE_AUTHOR("Yongle Lai"); -MODULE_LICENSE("GPL"); - diff --git a/drivers/net/wireless/mv8686/if_sdio.h b/drivers/net/wireless/mv8686/if_sdio.h deleted file mode 100755 index e12b55a0f508..000000000000 --- a/drivers/net/wireless/mv8686/if_sdio.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * linux/drivers/net/wireless/libertas/if_sdio.h - * - * Copyright 2007 Pierre Ossman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - */ - -#ifndef _LBS_IF_SDIO_H -#define _LBS_IF_SDIO_H - -#define IF_SDIO_IOPORT 0x00 - -#define IF_SDIO_CONFIGURE 0x03 -#define IF_SDIO_HOST_UP 0x02 -#define IF_SDIO_HOST_DOWN 0x01 -#define IF_SDIO_HOST_RESET 0x00 - -#define IF_SDIO_H_INT_MASK 0x04 -#define IF_SDIO_H_INT_OFLOW 0x08 -#define IF_SDIO_H_INT_UFLOW 0x04 -#define IF_SDIO_H_INT_DNLD 0x02 -#define IF_SDIO_H_INT_UPLD 0x01 - -#define IF_SDIO_H_INT_STATUS 0x05 -#define IF_SDIO_H_INT_RSR 0x06 -#define IF_SDIO_H_INT_STATUS2 0x07 - -#define IF_SDIO_RD_BASE 0x10 - -#define IF_SDIO_STATUS 0x20 -#define IF_SDIO_IO_RDY 0x08 -#define IF_SDIO_CIS_RDY 0x04 -#define IF_SDIO_UL_RDY 0x02 -#define IF_SDIO_DL_RDY 0x01 - -#define IF_SDIO_C_INT_MASK 0x24 -#define IF_SDIO_C_INT_STATUS 0x28 -#define IF_SDIO_C_INT_RSR 0x2C - -#define IF_SDIO_SCRATCH 0x34 -#define IF_SDIO_SCRATCH_OLD 0x80fe -#define IF_SDIO_FIRMWARE_OK 0xfedc - -#define IF_SDIO_EVENT 0x80fc - -/** Number of firmware blocks to transfer */ -#define FW_TRANSFER_NBLOCK 2 -#define SD_BLOCK_SIZE 256 - -/** The number of times to try when polling for status bits */ -#define MAX_POLL_TRIES 100 - -/** SDIO header length */ -#define SDIO_HEADER_LEN 4 - -/** Macros for Data Alignment : address */ -#define ALIGN_ADDR(p, a) \ - ((((u32)(p)) + (((u32)(a)) - 1)) & ~(((u32)(a)) - 1)) - -#endif diff --git a/drivers/net/wireless/mv8686/iwpriv.h b/drivers/net/wireless/mv8686/iwpriv.h deleted file mode 100755 index f5a6bb0e7f24..000000000000 --- a/drivers/net/wireless/mv8686/iwpriv.h +++ /dev/null @@ -1,18 +0,0 @@ - -#ifndef IW_PRIV_H -#define IW_PRIV_H - -#define TRUE 1 -#define FALSE 0 - -/** PRIVATE CMD ID */ -#define WLANIOCTL 0x8BE0 - -#define WLANDEEPSLEEP (WLANIOCTL + 1) -#define WLAN_SETONEINT_GETONEINT (WLANIOCTL + 2) -#define WLAN_AUTODEEPSLEEP 1 -#define WLAN_SUSPEND_RESUME (WLANIOCTL + 3) -#define WLAN_SUSPEND 1 -#define WLAN_RESUME 2 - -#endif /* IW_PRIV_H */ diff --git a/drivers/net/wireless/mv8686/lib80211.h b/drivers/net/wireless/mv8686/lib80211.h deleted file mode 100755 index 55c03370588b..000000000000 --- a/drivers/net/wireless/mv8686/lib80211.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * lib80211.h -- common bits for IEEE802.11 wireless drivers - * - * Copyright (c) 2008, John W. Linville - * - * Some bits copied from old ieee80211 component, w/ original copyright - * notices below: - * - * Original code based on Host AP (software wireless LAN access point) driver - * for Intersil Prism2/2.5/3. - * - * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen - * - * Copyright (c) 2002-2003, Jouni Malinen - * - * Adaption to a generic IEEE 802.11 stack by James Ketrenos - * - * - * Copyright (c) 2004, Intel Corporation - * - */ - -#ifndef LIB80211_H -#define LIB80211_H - -#include -#include -#include -#include -#include -#include -#include -#include -/* print_ssid() is intended to be used in debug (and possibly error) - * messages. It should never be used for passing ssid to user space. */ -const char *mv8686_print_ssid(char *buf, const char *ssid, u8 ssid_len); -#define DECLARE_SSID_BUF(var) char var[IEEE80211_MAX_SSID_LEN * 4 + 1] __maybe_unused - -#define NUM_WEP_KEYS 4 - -enum { - IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), -}; - -struct lib80211_crypto_ops { - const char *name; - struct list_head list; - - /* init new crypto context (e.g., allocate private data space, - * select IV, etc.); returns NULL on failure or pointer to allocated - * private data on success */ - void *(*init) (int keyidx); - - /* deinitialize crypto context and free allocated private data */ - void (*deinit) (void *priv); - - int (*build_iv) (struct sk_buff * skb, int hdr_len, - u8 *key, int keylen, void *priv); - - /* encrypt/decrypt return < 0 on error or >= 0 on success. The return - * value from decrypt_mpdu is passed as the keyidx value for - * decrypt_msdu. skb must have enough head and tail room for the - * encryption; if not, error will be returned; these functions are - * called for all MPDUs (i.e., fragments). - */ - int (*encrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv); - int (*decrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv); - - /* These functions are called for full MSDUs, i.e. full frames. - * These can be NULL if full MSDU operations are not needed. */ - int (*encrypt_msdu) (struct sk_buff * skb, int hdr_len, void *priv); - int (*decrypt_msdu) (struct sk_buff * skb, int keyidx, int hdr_len, - void *priv); - - int (*set_key) (void *key, int len, u8 * seq, void *priv); - int (*get_key) (void *key, int len, u8 * seq, void *priv); - - /* procfs handler for printing out key information and possible - * statistics */ - char *(*print_stats) (char *p, void *priv); - - /* Crypto specific flag get/set for configuration settings */ - unsigned long (*get_flags) (void *priv); - unsigned long (*set_flags) (unsigned long flags, void *priv); - - /* maximum number of bytes added by encryption; encrypt buf is - * allocated with extra_prefix_len bytes, copy of in_buf, and - * extra_postfix_len; encrypt need not use all this space, but - * the result must start at the beginning of the buffer and correct - * length must be returned */ - int extra_mpdu_prefix_len, extra_mpdu_postfix_len; - int extra_msdu_prefix_len, extra_msdu_postfix_len; - - struct module *owner; -}; - -struct lib80211_crypt_data { - struct list_head list; /* delayed deletion list */ - struct lib80211_crypto_ops *ops; - void *priv; - atomic_t refcnt; -}; - -struct lib80211_crypt_info { - char *name; - /* Most clients will already have a lock, - so just point to that. */ - spinlock_t *lock; - - struct lib80211_crypt_data *crypt[NUM_WEP_KEYS]; - int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ - struct list_head crypt_deinit_list; - struct timer_list crypt_deinit_timer; - int crypt_quiesced; -}; - -int lib80211_crypt_info_init(struct lib80211_crypt_info *info, char *name, - spinlock_t *lock); -void lib80211_crypt_info_free(struct lib80211_crypt_info *info); -int lib80211_register_crypto_ops(struct lib80211_crypto_ops *ops); -int lib80211_unregister_crypto_ops(struct lib80211_crypto_ops *ops); -struct lib80211_crypto_ops *lib80211_get_crypto_ops(const char *name); -void lib80211_crypt_deinit_entries(struct lib80211_crypt_info *, int); -void lib80211_crypt_deinit_handler(unsigned long); -void lib80211_crypt_delayed_deinit(struct lib80211_crypt_info *info, - struct lib80211_crypt_data **crypt); -void lib80211_crypt_quiescing(struct lib80211_crypt_info *info); - -#endif /* LIB80211_H */ diff --git a/drivers/net/wireless/mv8686/main.c b/drivers/net/wireless/mv8686/main.c deleted file mode 100755 index 16a126e383a1..000000000000 --- a/drivers/net/wireless/mv8686/main.c +++ /dev/null @@ -1,2056 +0,0 @@ -/** - * This file contains the major functions in WLAN - * driver. It includes init, exit, open, close and main thread etc.. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "host.h" -#include "decl.h" -#include "dev.h" -#include "wext.h" -#include "scan.h" -#include "assoc.h" -#include "cmd.h" - -#include "wifi_power.h" - -/* Module parameters */ -unsigned int lbs_debug = 0xFFFFFFFF; -EXPORT_SYMBOL_GPL(lbs_debug); - -extern int wifi_customized_mac_addr(u8 *mac); - -struct lbs_private *lbs_wifi_priv = NULL; - -/* This global structure is used to send the confirm_sleep command as - * fast as possible down to the firmware. */ -struct cmd_confirm_sleep confirm_sleep; - -/* - * When we receive a deauthenticated event, we may get to - * re-association to the previous AP. This atom will be set to 1 when - * we are doing association, else it will be set to 1. - */ -atomic_t reassoc_flag; - -#define LBS_TX_PWR_DEFAULT 20 /*100mW */ -#define LBS_TX_PWR_US_DEFAULT 20 /*100mW */ -#define LBS_TX_PWR_JP_DEFAULT 16 /*50mW */ -#define LBS_TX_PWR_FR_DEFAULT 20 /*100mW */ -#define LBS_TX_PWR_EMEA_DEFAULT 20 /*100mW */ - -/* Format { channel, frequency (MHz), maxtxpower } */ -/* band: 'B/G', region: USA FCC/Canada IC */ -static struct chan_freq_power channel_freq_power_US_BG[] = { - {1, 2412, LBS_TX_PWR_US_DEFAULT}, - {2, 2417, LBS_TX_PWR_US_DEFAULT}, - {3, 2422, LBS_TX_PWR_US_DEFAULT}, - {4, 2427, LBS_TX_PWR_US_DEFAULT}, - {5, 2432, LBS_TX_PWR_US_DEFAULT}, - {6, 2437, LBS_TX_PWR_US_DEFAULT}, - {7, 2442, LBS_TX_PWR_US_DEFAULT}, - {8, 2447, LBS_TX_PWR_US_DEFAULT}, - {9, 2452, LBS_TX_PWR_US_DEFAULT}, - {10, 2457, LBS_TX_PWR_US_DEFAULT}, - {11, 2462, LBS_TX_PWR_US_DEFAULT}, - {12, 2467, LBS_TX_PWR_US_DEFAULT}, - {13, 2472, LBS_TX_PWR_US_DEFAULT}, - {14, 2484, LBS_TX_PWR_US_DEFAULT} -}; - -/* band: 'B/G', region: Europe ETSI */ -static struct chan_freq_power channel_freq_power_EU_BG[] = { - {1, 2412, LBS_TX_PWR_EMEA_DEFAULT}, - {2, 2417, LBS_TX_PWR_EMEA_DEFAULT}, - {3, 2422, LBS_TX_PWR_EMEA_DEFAULT}, - {4, 2427, LBS_TX_PWR_EMEA_DEFAULT}, - {5, 2432, LBS_TX_PWR_EMEA_DEFAULT}, - {6, 2437, LBS_TX_PWR_EMEA_DEFAULT}, - {7, 2442, LBS_TX_PWR_EMEA_DEFAULT}, - {8, 2447, LBS_TX_PWR_EMEA_DEFAULT}, - {9, 2452, LBS_TX_PWR_EMEA_DEFAULT}, - {10, 2457, LBS_TX_PWR_EMEA_DEFAULT}, - {11, 2462, LBS_TX_PWR_EMEA_DEFAULT}, - {12, 2467, LBS_TX_PWR_EMEA_DEFAULT}, - {13, 2472, LBS_TX_PWR_EMEA_DEFAULT}, - {14, 2484, LBS_TX_PWR_EMEA_DEFAULT} -}; - -/* band: 'B/G', region: Spain */ -static struct chan_freq_power channel_freq_power_SPN_BG[] = { - {10, 2457, LBS_TX_PWR_DEFAULT}, - {11, 2462, LBS_TX_PWR_DEFAULT} -}; - -/* band: 'B/G', region: France */ -static struct chan_freq_power channel_freq_power_FR_BG[] = { - {10, 2457, LBS_TX_PWR_FR_DEFAULT}, - {11, 2462, LBS_TX_PWR_FR_DEFAULT}, - {12, 2467, LBS_TX_PWR_FR_DEFAULT}, - {13, 2472, LBS_TX_PWR_FR_DEFAULT} -}; - -/* band: 'B/G', region: Japan */ -static struct chan_freq_power channel_freq_power_JPN_BG[] = { - {1, 2412, LBS_TX_PWR_JP_DEFAULT}, - {2, 2417, LBS_TX_PWR_JP_DEFAULT}, - {3, 2422, LBS_TX_PWR_JP_DEFAULT}, - {4, 2427, LBS_TX_PWR_JP_DEFAULT}, - {5, 2432, LBS_TX_PWR_JP_DEFAULT}, - {6, 2437, LBS_TX_PWR_JP_DEFAULT}, - {7, 2442, LBS_TX_PWR_JP_DEFAULT}, - {8, 2447, LBS_TX_PWR_JP_DEFAULT}, - {9, 2452, LBS_TX_PWR_JP_DEFAULT}, - {10, 2457, LBS_TX_PWR_JP_DEFAULT}, - {11, 2462, LBS_TX_PWR_JP_DEFAULT}, - {12, 2467, LBS_TX_PWR_JP_DEFAULT}, - {13, 2472, LBS_TX_PWR_JP_DEFAULT}, - {14, 2484, LBS_TX_PWR_JP_DEFAULT} -}; - -/* - * the structure for channel, frequency and power - */ -struct region_cfp_table -{ - u8 region; - struct chan_freq_power *cfp_BG; - int cfp_no_BG; -}; - -/** - * the structure for the mapping between region and CFP - */ -static struct region_cfp_table region_cfp_table[] = -{ - {0x10, /*US FCC */ - channel_freq_power_US_BG, - ARRAY_SIZE(channel_freq_power_US_BG), - } - , - {0x20, /*CANADA IC */ - channel_freq_power_US_BG, - ARRAY_SIZE(channel_freq_power_US_BG), - } - , - {0x30, /*EU*/ channel_freq_power_EU_BG, - ARRAY_SIZE(channel_freq_power_EU_BG), - } - , - {0x31, /*SPAIN*/ channel_freq_power_SPN_BG, - ARRAY_SIZE(channel_freq_power_SPN_BG), - } - , - {0x32, /*FRANCE*/ channel_freq_power_FR_BG, - ARRAY_SIZE(channel_freq_power_FR_BG), - } - , - {0x40, /*JAPAN*/ channel_freq_power_JPN_BG, - ARRAY_SIZE(channel_freq_power_JPN_BG), - } - , -/*Add new region here */ -}; - -/** - * the table to keep region code - */ -u16 lbs_region_code_to_index[MRVDRV_MAX_REGION_CODE] = - { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 }; - -/** - * 802.11b/g supported bitrates (in 500Kb/s units) - */ -u8 lbs_bg_rates[MAX_RATES] = - { 0x02, 0x04, 0x0b, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c, -0x00, 0x00 }; - -/** - * FW rate table. FW refers to rates by their index in this table, not by the - * rate value itself. Values of 0x00 are - * reserved positions. - */ -static u8 fw_data_rates[MAX_RATES] = - { 0x02, 0x04, 0x0B, 0x16, 0x00, 0x0C, 0x12, - 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x00 -}; - -#if (ANDROID_POWER_SAVE == 1) -extern unsigned long driver_ps_timeout; - -#include -android_suspend_lock_t wifi_android_lock; -#endif - -int wifi_ps_status = 0; - -#if (ANDROID_POWER_SAVE == 1) - -int wifi_real_suspend(int state) -{ - int ret = 0, i; - struct lbs_private *priv = lbs_wifi_priv; - - printk("System want WIFI to suspend.\n"); - - if (priv == NULL) - { - printk("lbs_wifi_priv is NULL.\n"); - return 0; - } - - if (priv->deepsleep == true) - { - printk("Wifi is in deepsleep already.\n"); - return 0; - } - - wifi_ps_status = WIFI_PS_PRE_SLEEP; - - /* - * Block data. - */ - netif_stop_queue(priv->dev); - netif_carrier_off(priv->dev); - - /* - * Block command is done via lbs_queue_command. - */ - - /* - * Waiting for current scan command to be done. - */ - for (i = 0; i < 20; i++) - { - if (priv->scan_channel == 0) - break; - printk("Waiting for scan to be done.\n"); - msleep(500); - } - if (i >= 20) - { - printk("Waiting for scan to be done timeout.\n"); - ret = -1; - goto out; - } - - /* - * Make sure command queue is empty. - */ - for (i = 0; i < 50; i++) - { - if (!list_empty(&priv->cmdpendingq)) - { - printk("Command queue is not empty.\n"); - wake_up_interruptible(&priv->waitq); - } - else - break; - msleep(100); - } - if (i >= 50) - { - printk("Waiting for command queue to empty timeout.\n"); - ret = -1; - goto out; - } - - /* - * Make sure no command is being run. - */ - for (i = 0; i < 50; i++) - { - if (priv->cur_cmd) - { - printk("Command is in process!!!\n"); - msleep(100); - } - else - break; - } - if (i >= 50) - { - printk("Waiting for current command timeout.\n"); - ret = -1; - goto out; - } - - if (priv->surpriseremoved) - { - printk("We are going to be removed.\n"); - ret = -1; - goto out; - } - - ret = lbs_prepare_and_send_command(priv, CMD_802_11_DEEP_SLEEP, 0, 0, 0, NULL); - if (ret) - { - printk("Send DEEP_SLEEP command failed.\n"); - wifi_ps_status = 0; - goto out; - } - wake_up_interruptible(&priv->waitq); //Wake up main thread. - - priv->deepsleep = true; - msleep(800); - - wifi_ps_status = WIFI_PS_DRV_SLEEP; - - android_unlock_suspend(&wifi_android_lock); -out: - netif_carrier_on(priv->dev); - netif_wake_queue(priv->dev); - - return ret; -} -#endif - -/* - * Suspend request from android power manager. - */ -#if (ANDROID_POWER_SAVE == 1) -int wifi_suspend(suspend_state_t state) -{ - struct lbs_private *priv = lbs_wifi_priv; - - if (priv == NULL) - { - printk("WiFi is disabled for now.\n"); - return 0; - } - - if (wifi_ps_status == WIFI_PS_DRV_SLEEP) - { - printk("WiFi is in driver sleep already.\n"); - return 0; - } - else /* This should be never occured. */ - { - printk("ERROR: WiFi is active for now!!!!!!!!!!\n"); - return 1; - } - - return 0; -} -#elif (NEW_MV8686_PS == 1) -int wifi_suspend(suspend_state_t state) -{ - int ret = 0, i; - struct lbs_private *priv = lbs_wifi_priv; - - printk("%s: NEW_MV8686_PS\n", __func__); - - /* - * Since system want to be IDLE, we will make WIFI be - * deep sleep here. --Yongle Lai - */ - - //printk("System want WIFI to suspend.\n"); - - if (priv == NULL) - { - printk("lbs_wifi_priv is NULL.\n"); - return 0; - } - - if (priv->deepsleep == true) - { - printk("Wifi is in deepsleep already.\n"); - return 0; - } - - wifi_ps_status = WIFI_PS_PRE_SLEEP; - - /* - * Block data. - */ - netif_stop_queue(priv->dev); - netif_carrier_off(priv->dev); - - /* - * Block command is done via lbs_queue_command. - */ - - /* - * Waiting for current scan command to be done. - */ - for (i = 0; i < 20; i++) - { - if (priv->scan_channel == 0) - break; - printk("Waiting for scan to be done.\n"); - msleep(500); - } - if (i >= 20) - { - printk("Waiting for scan to be done timeout.\n"); - ret = -1; - goto out; - } - - /* - * Make sure command queue is empty. - */ - for (i = 0; i < 50; i++) - { - if (!list_empty(&priv->cmdpendingq)) - { - printk("Command queue is not empty.\n"); - wake_up_interruptible(&priv->waitq); - } - else - break; - msleep(100); - } - if (i >= 50) - { - printk("Waiting for command queue to empty timeout.\n"); - ret = -1; - goto out; - } - - /* - * Make sure no command is being run. - */ - for (i = 0; i < 50; i++) - { - if (priv->cur_cmd) - { - printk("Command is in process!!!\n"); - msleep(100); - } - else - break; - } - if (i >= 50) - { - printk("Waiting for current command timeout.\n"); - ret = -1; - goto out; - } - - if (priv->surpriseremoved) - { - printk("We are going to be removed.\n"); - ret = -1; - goto out; - } - /* - * Before we go to deep sleep, we should leave PS mode if we are. - */ - priv->psmode = LBS802_11POWERMODECAM; - if (priv->psstate != PS_STATE_FULL_POWER) { - lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); - } - - ret = lbs_cmd_80211_deauthenticate(priv, - priv->curbssparams.bssid, - WLAN_REASON_DEAUTH_LEAVING); - if (ret) - printk("%s: Disconnect fail.\n", __func__); - - ret = lbs_prepare_and_send_command(priv, CMD_802_11_DEEP_SLEEP, 0, 0, 0, NULL); - if (ret) - { - printk("Send DEEP_SLEEP command failed.\n"); - wifi_ps_status = 0; - goto out; - } - wake_up_interruptible(&priv->waitq); //Wake up main thread. - - priv->deepsleep = true; - msleep(800); - - wifi_ps_status = WIFI_PS_DRV_SLEEP; -out: - netif_carrier_on(priv->dev); - netif_wake_queue(priv->dev); - - return ret; -} -#else -int wifi_suspend(suspend_state_t state) -{ - return 0; -} -#endif - -#if (ANDROID_POWER_SAVE == 1) -int wifi_driver_suspend(suspend_state_t state) -{ - int ret; - - if ((wifi_ps_status == WIFI_PS_SYS_SLEEP) || - (wifi_ps_status == WIFI_PS_DRV_SLEEP)) - { - printk("WiFi is in deep sleep already.\n"); - return 0; - } - - ret = wifi_real_suspend(WIFI_PS_DRV_PRE_SLEEP); - if (ret == 0) - { - wifi_ps_status = WIFI_PS_DRV_SLEEP; - } - else - { - wifi_ps_status = WIFI_PS_AWAKE; - } - - return ret; -} -#endif - -#if (NEW_MV8686_PS == 1) -void wifi_resume(void) -{ - union iwreq_data wrqu; - struct lbs_private *priv = lbs_wifi_priv; - - printk("%s: NEW_MV8686_PS\n", __func__); - - if (priv == NULL) - { - printk("lbs_wifi_priv is NULL.\n"); - return; - } - - if (priv->deepsleep == false) - { - printk("Wifi isn't in deepsleep yet.\n"); - return; - } - - if ((wifi_ps_status != WIFI_PS_SYS_SLEEP) && - (wifi_ps_status != WIFI_PS_DRV_SLEEP)) - { - printk("WiFi is not in deep sleep yet.\n"); - return; - } - - wifi_power_save_suspend(); - - memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); - wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); - - lbs_exit_deep_sleep(priv); - msleep(100); - priv->deepsleep = false; - //msleep(600); - - wifi_ps_status = WIFI_PS_AWAKE; - - netif_carrier_on(priv->dev); - netif_wake_queue(priv->dev); - - wake_up_interruptible(&priv->waitq); //Wake up main thread. - - wifi_power_save_resume(); -} -#else -void wifi_resume(void) -{ - printk("Android want wifi to be resumed.\n"); -} -#endif - -/* - * Wakeup Wifi from deepsleep. - */ -#if (ANDROID_POWER_SAVE == 1) - -void wifi_driver_resume(void) -{ - - struct lbs_private *priv = lbs_wifi_priv; - - printk("System want WIFI to resume.\n"); - - if (priv == NULL) - { - printk("lbs_wifi_priv is NULL.\n"); - return; - } - - if (priv->deepsleep == false) - { - printk("Wifi isn't in deepsleep yet.\n"); - return; - } - - if ((wifi_ps_status != WIFI_PS_SYS_SLEEP) && - (wifi_ps_status != WIFI_PS_DRV_SLEEP)) - { - printk("WiFi is not in deep sleep yet.\n"); - return; - } - - /* - * Update timer. - */ - lbs_update_ps_timer(); - - lbs_exit_deep_sleep(priv); - priv->deepsleep = false; - msleep(600); - - wifi_ps_status = WIFI_PS_AWAKE; - - android_lock_suspend(&wifi_android_lock); - - netif_carrier_on(priv->dev); - netif_wake_queue(priv->dev); - - wake_up_interruptible(&priv->waitq); //Wake up main thread. -} - -void lbs_update_ps_timer(void) -{ - struct lbs_private *priv = lbs_wifi_priv; - - if (priv == NULL) - return; - - if (priv->surpriseremoved) - return; - - if (wifi_ps_status != WIFI_PS_AWAKE) - return; - - if (priv->ps_timer.function == NULL) - return; - - mod_timer(&priv->ps_timer, jiffies + msecs_to_jiffies(driver_ps_timeout)); -} - -void lbs_ps_worker(struct work_struct *work) -{ - struct lbs_private *priv = lbs_wifi_priv; - - printk("lbs_ps_worker\n"); - - if (priv->wifi_ps_work_req == WIFI_PS_PRE_WAKE) - wifi_driver_resume(); - else - wifi_driver_suspend(0); - - priv->wifi_ps_work_req = 0; -} - -static void ps_timer_fn(unsigned long data) -{ - struct lbs_private *priv = (struct lbs_private *)data; - - printk("ps_timer_function.\n"); - - priv->wifi_ps_work_req = WIFI_PS_DRV_PRE_SLEEP; - - queue_delayed_work(priv->work_thread, &priv->ps_work, - msecs_to_jiffies(5)); -} -#endif - -#if (NEW_MV8686_PS == 1) - -static void disconnect_timer_fn(unsigned long data) -{ - struct lbs_private *priv = (struct lbs_private *)data; - - if (priv->surpriseremoved) - return; - - if (priv == NULL) - { - printk("lbs_wifi_priv is NULL.\n"); - return; - } - - /* Here we check the previous association status. */ - if (priv->connect_status == LBS_CONNECTED) - { - priv->need_reassoc = 1; - priv->reassoc_count = 0; - } - else - priv->need_reassoc = 0; -} - -extern int wifi_turnoff_timeout; //from wifi_config.c - -static void turnoff_timer_fn(unsigned long data) -{ - union iwreq_data wrqu; - struct lbs_private *priv = (struct lbs_private *)data; - //static u32 trans_pkts = 0; - - if (priv->surpriseremoved) - return; - - if (priv->connect_status == LBS_CONNECTED) - { - //printk("%s: wifi is LBS_CONNECTED.\n", __func__); - priv->turnoff_idle_count = 0; - } - else - { - //printk("%s: wifi is LBS_DISCONNECTED.\n", __func__); - priv->turnoff_idle_count += 1; - } - - if (priv->turnoff_idle_count > wifi_turnoff_timeout) - { - //printk("%s: Send request to Android for turn-off WiFi.\n", __func__); - memset(wrqu.ap_addr.sa_data, 0xAB, ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); - } - -#if 0 - /* - * Monitor WIFI throughput. - */ - if (trans_pkts > (priv->dev->stats.tx_packets + - priv->dev->stats.rx_packets)) - { - trans_pkts = priv->dev->stats.tx_packets + - priv->dev->stats.rx_packets; - } - else if (trans_pkts < (priv->dev->stats.tx_packets + - priv->dev->stats.rx_packets)) - { - printk("%s: we are serving...\n", __func__); - trans_pkts = priv->dev->stats.tx_packets + - priv->dev->stats.rx_packets; - } - else - { - printk("%s: we are idle...\n", __func__); - } -#endif - - /* - * Even we have ask Android to turn off wifi, - * we keep timer still for send request again. - */ - mod_timer(&priv->turnoff_timer, jiffies + msecs_to_jiffies(10 * 1000)); -} - -/* - * Because we are interrupt context, to make sure all - * functions can be callbacked, we use workqueue to - * call handler. - */ - -void mv8686_ps_real_callback(struct work_struct *work) -{ - struct lbs_private *priv = lbs_wifi_priv; - - if (priv->surpriseremoved) - return; - - if (priv == NULL) - { - printk("lbs_wifi_priv is NULL.\n"); - return; - } - - if (priv->wifi_state == WIFI_NETWORK_IDLE) - { - //printk("%s: we are idle...\n", __func__); - - priv->wifi_state = WIFI_NETWORK_IDLE; - - if (priv->psmode != LBS802_11POWERMODECAM) - return; - - priv->psmode = LBS802_11POWERMODEMAX_PSP; - - if (priv->connect_status == LBS_CONNECTED) { - lbs_ps_sleep(priv, CMD_OPTION_WAITFORRSP); - } - } - else - { - //printk("%s: we are serving...\n", __func__); - - priv->psmode = LBS802_11POWERMODECAM; - if (priv->psstate != PS_STATE_FULL_POWER) { - lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); - } - } -} - -int mv8686_ps_callback(int status) -{ - struct lbs_private *priv = lbs_wifi_priv; - - if (priv->surpriseremoved) - return 0; - - if (priv == NULL) - { - printk("lbs_wifi_priv is NULL.\n"); - return 0; - } - - priv->wifi_state = status; - - schedule_delayed_work(&priv->ps_work, msecs_to_jiffies(2)); - - return 0; -} -#endif - -/** - * @brief use index to get the data rate - * - * @param idx The index of data rate - * @return data rate or 0 - */ -u32 lbs_fw_index_to_data_rate(u8 idx) -{ - if (idx >= sizeof(fw_data_rates)) - idx = 0; - return fw_data_rates[idx]; -} - -/** - * @brief use rate to get the index - * - * @param rate data rate - * @return index or 0 - */ -u8 lbs_data_rate_to_fw_index(u32 rate) -{ - u8 i; - - if (!rate) - return 0; - - for (i = 0; i < sizeof(fw_data_rates); i++) - { - if (rate == fw_data_rates[i]) - return i; - } - return 0; -} - -/** - * @brief This function opens the ethX or mshX interface - * - * @param dev A pointer to net_device structure - * @return 0 or -EBUSY if monitor mode active - */ -static int lbs_dev_open(struct net_device *dev) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - int ret = 0; - - lbs_deb_enter(LBS_DEB_NET); - - spin_lock_irq(&priv->driver_lock); - - if (priv->monitormode) { - ret = -EBUSY; - goto out; - } - - priv->infra_open = 1; - - if (priv->connect_status == LBS_CONNECTED) - netif_carrier_on(dev); - else - netif_carrier_off(dev); - - if (!priv->tx_pending_len) - netif_wake_queue(dev); - out: - - spin_unlock_irq(&priv->driver_lock); - lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); - - return ret; -} - -/** - * @brief This function closes the ethX interface - * - * @param dev A pointer to net_device structure - * @return 0 - */ -static int lbs_eth_stop(struct net_device *dev) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - - lbs_deb_enter(LBS_DEB_NET); - - spin_lock_irq(&priv->driver_lock); - priv->infra_open = 0; - netif_stop_queue(dev); - spin_unlock_irq(&priv->driver_lock); - - //schedule_work(&priv->mcast_work); - - lbs_deb_leave(LBS_DEB_NET); - return 0; -} - -static void lbs_tx_timeout(struct net_device *dev) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - - lbs_deb_enter(LBS_DEB_TX); - - lbs_pr_err("tx watch dog timeout\n"); - - dev->trans_start = jiffies; - - if (priv->currenttxskb) - lbs_send_tx_feedback(priv, 0); - - /* XX: Shouldn't we also call into the hw-specific driver - to kick it somehow? */ - lbs_host_to_card_done(priv); - - /* More often than not, this actually happens because the - firmware has crapped itself -- rather than just a very - busy medium. So send a harmless command, and if/when - _that_ times out, we'll kick it in the head. */ - lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, - 0, 0, NULL); - - lbs_deb_leave(LBS_DEB_TX); -} - -void lbs_host_to_card_done(struct lbs_private *priv) -{ - unsigned long flags; - - lbs_deb_enter(LBS_DEB_THREAD); - - spin_lock_irqsave(&priv->driver_lock, flags); - - priv->dnld_sent = DNLD_RES_RECEIVED; - - /* Wake main thread if commands are pending */ - if (!priv->cur_cmd || priv->tx_pending_len > 0) - wake_up_interruptible(&priv->waitq); - - spin_unlock_irqrestore(&priv->driver_lock, flags); - lbs_deb_leave(LBS_DEB_THREAD); -} -EXPORT_SYMBOL_GPL(lbs_host_to_card_done); - -static int lbs_set_mac_address(struct net_device *dev, void *addr) -{ - int ret = 0; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - struct sockaddr *phwaddr = addr; - struct cmd_ds_802_11_mac_address cmd; - - lbs_deb_enter(LBS_DEB_NET); - - /* In case it was called from the mesh device */ - dev = priv->dev; - - cmd.hdr.size = cpu_to_le16(sizeof(cmd)); - cmd.action = cpu_to_le16(CMD_ACT_SET); - memcpy(cmd.macadd, phwaddr->sa_data, ETH_ALEN); - - ret = lbs_cmd_with_response(priv, CMD_802_11_MAC_ADDRESS, &cmd); - if (ret) { - printk("set MAC address failed\n"); - goto done; - } - - memcpy(priv->current_addr, phwaddr->sa_data, ETH_ALEN); - memcpy(dev->dev_addr, phwaddr->sa_data, ETH_ALEN); - -done: - lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); - return ret; -} - - -static inline int mac_in_list(unsigned char *list, int list_len, - unsigned char *mac) -{ - while (list_len) { - if (!memcmp(list, mac, ETH_ALEN)) - return 1; - list += ETH_ALEN; - list_len--; - } - return 0; -} - -int lbs_can_enter_deep_sleep(struct lbs_private *priv) -{ - if (priv->cur_cmd) - { - printk("Current command is running.\n"); - return false; - } - - if (priv->connect_status == LBS_CONNECTED) - { - printk("Media is connected.\n"); - //return false; - } - - //if (priv->resp_len[priv->resp_idx]) - // return false; - - return true; -} - -/** - * @brief This function handles the major jobs in the LBS driver. - * It handles all events generated by firmware, RX data received - * from firmware and TX data sent from kernel. - * - * @param data A pointer to lbs_thread structure - * @return 0 - */ -static int lbs_thread(void *data) -{ - struct net_device *dev = data; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - wait_queue_t wait; - - lbs_deb_enter(LBS_DEB_THREAD); - - init_waitqueue_entry(&wait, current); - -#if (ANDROID_POWER_SAVE == 1) - mod_timer(&priv->ps_timer, jiffies + msecs_to_jiffies(driver_ps_timeout) + 10 * HZ); - - wifi_android_lock.name = "wifidev"; - android_init_suspend_lock(&wifi_android_lock); - - android_lock_suspend(&wifi_android_lock); -#endif - -#if (NEW_MV8686_PS == 1) - mod_timer(&priv->turnoff_timer, jiffies + msecs_to_jiffies(10 * 1000)); -#endif - - for (;;) - { - int shouldsleep; - u8 resp_idx; - - lbs_deb_thread("1: currenttxskb %p, dnld_sent %d\n", - priv->currenttxskb, priv->dnld_sent); - - add_wait_queue(&priv->waitq, &wait); - set_current_state(TASK_INTERRUPTIBLE); - spin_lock_irq(&priv->driver_lock); - - if (kthread_should_stop()) - shouldsleep = 0; /* Bye */ - else if (priv->surpriseremoved) - shouldsleep = 1; /* We need to wait until we're _told_ to die */ - else if (priv->psstate == PS_STATE_SLEEP) - shouldsleep = 1; /* Sleep mode. Nothing we can do till it wakes */ -#if (NEW_MV8686_PS == 1) - else if (priv->deepsleep == true) - shouldsleep = 1; /* Deep Sleep mode. Nothing we can do till it wakes */ -#endif - else if (priv->cmd_timed_out) - shouldsleep = 0; /* Command timed out. Recover */ - else if (!priv->fw_ready) - shouldsleep = 1; /* Firmware not ready. We're waiting for it */ - else if (priv->dnld_sent) - shouldsleep = 1; /* Something is en route to the device already */ - else if (priv->tx_pending_len > 0) - shouldsleep = 0; /* We've a packet to send */ - else if (priv->resp_len[priv->resp_idx]) - shouldsleep = 0; /* We have a command response */ - else if (priv->cur_cmd) - shouldsleep = 1; /* Can't send a command; one already running */ - else if (!list_empty(&priv->cmdpendingq)) - shouldsleep = 0; /* We have a command to send */ - else if (__kfifo_len(priv->event_fifo)) - shouldsleep = 0; /* We have an event to process */ - else - shouldsleep = 1; /* No command */ - - if (shouldsleep) { - lbs_deb_thread("sleeping, connect_status %d, " - "psmode %d, psstate %d\n", - priv->connect_status, - priv->psmode, priv->psstate); - spin_unlock_irq(&priv->driver_lock); - schedule(); - } else - spin_unlock_irq(&priv->driver_lock); - - lbs_deb_thread("2: currenttxskb %p, dnld_send %d\n", - priv->currenttxskb, priv->dnld_sent); - - set_current_state(TASK_RUNNING); - remove_wait_queue(&priv->waitq, &wait); - - lbs_deb_thread("3: currenttxskb %p, dnld_sent %d\n", - priv->currenttxskb, priv->dnld_sent); - - if (kthread_should_stop()) { - lbs_deb_thread("break from main thread\n"); - break; - } - - if (priv->surpriseremoved) { - lbs_deb_thread("adapter removed; waiting to die...\n"); - continue; - } - - lbs_deb_thread("4: currenttxskb %p, dnld_sent %d\n", - priv->currenttxskb, priv->dnld_sent); - - /* Process any pending command response */ - spin_lock_irq(&priv->driver_lock); - resp_idx = priv->resp_idx; - if (priv->resp_len[resp_idx]) { - spin_unlock_irq(&priv->driver_lock); - lbs_process_command_response(priv, - priv->resp_buf[resp_idx], - priv->resp_len[resp_idx]); - spin_lock_irq(&priv->driver_lock); - priv->resp_len[resp_idx] = 0; - } - spin_unlock_irq(&priv->driver_lock); - - /* command timeout stuff */ - if (priv->cmd_timed_out && priv->cur_cmd) { - struct cmd_ctrl_node *cmdnode = priv->cur_cmd; - - if ((++priv->nr_retries > 3) || (priv->surpriseremoved == 1)) - { - lbs_pr_info("Excessive timeouts submitting command 0x%04x\n", - le16_to_cpu(cmdnode->cmdbuf->command)); - lbs_complete_command(priv, cmdnode, -ETIMEDOUT); - priv->nr_retries = 0; - if (priv->reset_card) - priv->reset_card(priv); - } else { - priv->cur_cmd = NULL; - priv->dnld_sent = DNLD_RES_RECEIVED; - lbs_pr_info("requeueing command 0x%04x due " - "to timeout (#%d)\n", - le16_to_cpu(cmdnode->cmdbuf->command), - priv->nr_retries); - - /* Stick it back at the _top_ of the pending queue - for immediate resubmission */ - list_add(&cmdnode->list, &priv->cmdpendingq); - } - } - priv->cmd_timed_out = 0; - - /* Process hardware events, e.g. card removed, link lost */ - spin_lock_irq(&priv->driver_lock); - while (__kfifo_len(priv->event_fifo)) { - u32 event; - - __kfifo_get(priv->event_fifo, (unsigned char *) &event, - sizeof(event)); - spin_unlock_irq(&priv->driver_lock); - lbs_process_event(priv, event); - spin_lock_irq(&priv->driver_lock); - } - spin_unlock_irq(&priv->driver_lock); - - if (!priv->fw_ready) - continue; - - /* Check if we need to confirm Sleep Request received previously */ - if (priv->psstate == PS_STATE_PRE_SLEEP && - !priv->dnld_sent && !priv->cur_cmd) { - if (priv->connect_status == LBS_CONNECTED) { - lbs_deb_thread("pre-sleep, currenttxskb %p, " - "dnld_sent %d, cur_cmd %p\n", - priv->currenttxskb, priv->dnld_sent, - priv->cur_cmd); - - lbs_ps_confirm_sleep(priv); - } else { - /* workaround for firmware sending - * deauth/linkloss event immediately - * after sleep request; remove this - * after firmware fixes it - */ - priv->psstate = PS_STATE_AWAKE; - lbs_pr_alert("ignore PS_SleepConfirm in " - "non-connected state\n"); - } - } - - /* The PS state is changed during processing of Sleep Request - * event above - */ - if ((priv->psstate == PS_STATE_SLEEP) || - (priv->psstate == PS_STATE_PRE_SLEEP)) - continue; - - /* Execute the next command */ - if (!priv->dnld_sent && !priv->cur_cmd) - lbs_execute_next_command(priv); - - /* Wake-up command waiters which can't sleep in - * lbs_prepare_and_send_command - */ - if (!list_empty(&priv->cmdpendingq)) - wake_up_all(&priv->cmd_pending); - - spin_lock_irq(&priv->driver_lock); - if (!priv->dnld_sent && priv->tx_pending_len > 0) { - int ret = priv->hw_host_to_card(priv, MVMS_DAT, - priv->tx_pending_buf, - priv->tx_pending_len); - if (ret) { - lbs_deb_tx("host_to_card failed %d\n", ret); - priv->dnld_sent = DNLD_RES_RECEIVED; - } - priv->tx_pending_len = 0; - if (!priv->currenttxskb) { - /* We can wake the queues immediately if we aren't - waiting for TX feedback */ - if (priv->connect_status == LBS_CONNECTED) - netif_wake_queue(priv->dev); - } - } - spin_unlock_irq(&priv->driver_lock); - } - - del_timer(&priv->command_timer); - wake_up_all(&priv->cmd_pending); - - lbs_deb_leave(LBS_DEB_THREAD); - - return 0; -} - -#if 0 - -static int lbs_suspend_callback(struct lbs_private *priv, unsigned long dummy, - struct cmd_header *cmd) -{ - lbs_deb_enter(LBS_DEB_FW); - - netif_device_detach(priv->dev); - - priv->fw_ready = 0; - lbs_deb_leave(LBS_DEB_FW); - return 0; -} - -int lbs_suspend(struct lbs_private *priv) -{ - struct cmd_header cmd; - int ret; - - lbs_deb_enter(LBS_DEB_FW); - - if (priv->wol_criteria == 0xffffffff) { - lbs_pr_info("Suspend attempt without configuring wake params!\n"); - return -EINVAL; - } - - memset(&cmd, 0, sizeof(cmd)); - - ret = __lbs_cmd(priv, CMD_802_11_HOST_SLEEP_ACTIVATE, &cmd, - sizeof(cmd), lbs_suspend_callback, 0); - if (ret) - lbs_pr_info("HOST_SLEEP_ACTIVATE failed: %d\n", ret); - - lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); - return ret; -} -EXPORT_SYMBOL_GPL(lbs_suspend); - -void lbs_resume(struct lbs_private *priv) -{ - lbs_deb_enter(LBS_DEB_FW); - - priv->fw_ready = 1; - - /* Firmware doesn't seem to give us RX packets any more - until we send it some command. Might as well update */ - lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, - 0, 0, NULL); - - netif_device_attach(priv->dev); - - lbs_deb_leave(LBS_DEB_FW); -} -EXPORT_SYMBOL_GPL(lbs_resume); -#endif - -/** - * @brief This function gets the HW spec from the firmware and sets - * some basic parameters. - * - * @param priv A pointer to struct lbs_private structure - * @return 0 or -1 - */ -static int lbs_setup_firmware(struct lbs_private *priv) -{ - int ret = -1; - s16 curlevel = 0, minlevel = 0, maxlevel = 0; - - lbs_deb_enter(LBS_DEB_FW); - - /* Read MAC address from firmware */ - memset(priv->current_addr, 0xff, ETH_ALEN); - ret = lbs_update_hw_spec(priv); - if (ret) - goto done; - - { - struct sockaddr addr; - u8 * mac = (u8 *)(addr.sa_data); - - if (wifi_customized_mac_addr(mac) == 1) - { - lbs_set_mac_address(priv->dev, &addr); - } - } - - /* Read power levels if available */ - ret = lbs_get_tx_power(priv, &curlevel, &minlevel, &maxlevel); - if (ret == 0) { - priv->txpower_cur = curlevel; - priv->txpower_min = minlevel; - priv->txpower_max = maxlevel; - } - - lbs_set_mac_control(priv); - -done: - lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret); - return ret; -} - -/** - * This function handles the timeout of command sending. - * It will re-send the same command again. - */ -static void command_timer_fn(unsigned long data) -{ - struct lbs_private *priv = (struct lbs_private *)data; - unsigned long flags; - - lbs_deb_enter(LBS_DEB_CMD); - spin_lock_irqsave(&priv->driver_lock, flags); - - if (!priv->cur_cmd) - goto out; - - lbs_pr_info("command 0x%04x timed out\n", - le16_to_cpu(priv->cur_cmd->cmdbuf->command)); - - priv->cmd_timed_out = 1; - wake_up_interruptible(&priv->waitq); -out: - spin_unlock_irqrestore(&priv->driver_lock, flags); - lbs_deb_leave(LBS_DEB_CMD); -} - -static void lbs_sync_channel_worker(struct work_struct *work) -{ - struct lbs_private *priv = container_of(work, struct lbs_private, - sync_channel); - - lbs_deb_enter(LBS_DEB_MAIN); - if (lbs_update_channel(priv)) - lbs_pr_info("Channel synchronization failed."); - lbs_deb_leave(LBS_DEB_MAIN); -} - - -static int lbs_init_adapter(struct lbs_private *priv) -{ - size_t bufsize; - int i, ret = 0; - - lbs_deb_enter(LBS_DEB_MAIN); - - /* Allocate buffer to store the BSSID list */ - bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor); - priv->networks = kzalloc(bufsize, GFP_KERNEL); - if (!priv->networks) { - lbs_pr_err("Out of memory allocating beacons\n"); - ret = -1; - goto out; - } - - /* Initialize scan result lists */ - INIT_LIST_HEAD(&priv->network_free_list); - INIT_LIST_HEAD(&priv->network_list); - for (i = 0; i < MAX_NETWORK_COUNT; i++) { - list_add_tail(&priv->networks[i].list, - &priv->network_free_list); - } - - /* Allocate buffer to store the scan request list */ - bufsize = MAX_SCAN_REQ * sizeof(struct lbs_scan_req); - priv->scan_req = kzalloc(bufsize, GFP_KERNEL); - if (!priv->scan_req) { - lbs_pr_err("Out of memory allocating scan request\n"); - ret = -1; - goto out; - } - - /* Initialize scan result lists */ - INIT_LIST_HEAD(&priv->scan_req_free_list); - INIT_LIST_HEAD(&priv->scan_req_list); - for (i = 0; i < MAX_SCAN_REQ; i++) { - list_add_tail(&priv->scan_req[i].list, - &priv->scan_req_free_list); - } - - memset(priv->current_addr, 0xff, ETH_ALEN); - - priv->connect_status = LBS_DISCONNECTED; - priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - priv->mode = IW_MODE_AUTO; //IW_MODE_INFRA; -- Yongle Lai - priv->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL; - priv->mac_control = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON; - priv->radio_on = 1; - priv->enablehwauto = 1; - priv->capability = WLAN_CAPABILITY_SHORT_PREAMBLE; - priv->psmode = LBS802_11POWERMODECAM; - priv->psstate = PS_STATE_FULL_POWER; - - mutex_init(&priv->lock); - - setup_timer(&priv->command_timer, command_timer_fn, (unsigned long)priv); - -#if (NEW_MV8686_PS == 1) - setup_timer(&priv->turnoff_timer, turnoff_timer_fn, (unsigned long)priv); - priv->turnoff_idle_count = 0; - wifi_power_save_register_callback(mv8686_ps_callback); - setup_timer(&priv->disconnect_timer, disconnect_timer_fn, (unsigned long)priv); -#endif - -#if (ANDROID_POWER_SAVE == 1) - setup_timer(&priv->ps_timer, ps_timer_fn, (unsigned long)priv); -#endif - - INIT_LIST_HEAD(&priv->cmdfreeq); - INIT_LIST_HEAD(&priv->cmdpendingq); - - spin_lock_init(&priv->driver_lock); - init_waitqueue_head(&priv->cmd_pending); - - /* Allocate the command buffers */ - if (lbs_allocate_cmd_buffer(priv)) - { - lbs_pr_err("Out of memory allocating command buffers\n"); - ret = -ENOMEM; - goto out; - } - priv->resp_idx = 0; - priv->resp_len[0] = priv->resp_len[1] = 0; - - /* Create the event FIFO */ - priv->event_fifo = kfifo_alloc(sizeof(u32) * 16, GFP_KERNEL, NULL); - if (IS_ERR(priv->event_fifo)) - { - lbs_pr_err("Out of memory allocating event FIFO buffer\n"); - ret = -ENOMEM; - goto out; - } - -out: - lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); - - return ret; -} - -static void lbs_free_adapter(struct lbs_private *priv) -{ - lbs_deb_enter(LBS_DEB_MAIN); - - lbs_free_cmd_buffer(priv); - if (priv->event_fifo) - kfifo_free(priv->event_fifo); - del_timer(&priv->command_timer); - - if (priv->networks) - kfree(priv->networks); - priv->networks = NULL; - - if (priv->scan_req) - kfree(priv->scan_req); - priv->scan_req = NULL; - - lbs_deb_leave(LBS_DEB_MAIN); -} - -#if (MV8686_SUPPORT_MCAST == 1) -static int mv8686_add_mcast_addrs(struct cmd_ds_mac_multicast_adr *cmd, - struct net_device *dev, int nr_addrs) -{ - int i = nr_addrs; - struct dev_mc_list *mc_list; - - if ((dev->flags & (IFF_UP|IFF_MULTICAST)) != (IFF_UP|IFF_MULTICAST)) - return nr_addrs; - - //printk("Warning lock is commeted...........\n"); - //netif_addr_lock_bh(dev); - for (mc_list = dev->mc_list; mc_list; mc_list = mc_list->next) - { - if (mac_in_list(cmd->maclist, nr_addrs, mc_list->dmi_addr)) - { - lbs_deb_net("mcast address %s:%pM skipped\n", dev->name, mc_list->dmi_addr); - continue; - } - if (i == MRVDRV_MAX_MULTICAST_LIST_SIZE) - break; - memcpy(&cmd->maclist[6*i], mc_list->dmi_addr, ETH_ALEN); - lbs_deb_net("mcast address %s:%pM added to filter\n", dev->name, mc_list->dmi_addr); - i++; - } - //netif_addr_unlock_bh(dev); - - if (mc_list) - return -EOVERFLOW; - - return i; -} - -static void mv8686_set_mcast_worker(struct work_struct *work) -{ - struct lbs_private *priv = container_of(work, struct lbs_private, mcast_work); - struct cmd_ds_mac_multicast_adr mcast_cmd; - int dev_flags; int nr_addrs; - int old_mac_control = priv->mac_control; - - lbs_deb_enter(LBS_DEB_NET); - - dev_flags = priv->dev->flags; - - if (dev_flags & IFF_PROMISC) - { - priv->mac_control |= CMD_ACT_MAC_PROMISCUOUS_ENABLE; - priv->mac_control &= ~(CMD_ACT_MAC_ALL_MULTICAST_ENABLE | - CMD_ACT_MAC_MULTICAST_ENABLE); - goto out_set_mac_control; - } - else if (dev_flags & IFF_ALLMULTI) - { -do_allmulti: - priv->mac_control |= CMD_ACT_MAC_ALL_MULTICAST_ENABLE; - priv->mac_control &= ~(CMD_ACT_MAC_PROMISCUOUS_ENABLE | - CMD_ACT_MAC_MULTICAST_ENABLE); - goto out_set_mac_control; - } - - /* Once for priv->dev, again for priv->mesh_dev if it exists */ - nr_addrs = mv8686_add_mcast_addrs(&mcast_cmd, priv->dev, 0); - - if (nr_addrs < 0) - goto do_allmulti; - - if (nr_addrs) - { - int size = offsetof(struct cmd_ds_mac_multicast_adr, maclist[6*nr_addrs]); - mcast_cmd.action = cpu_to_le16(CMD_ACT_SET); - mcast_cmd.hdr.size = cpu_to_le16(size); - mcast_cmd.nr_of_adrs = cpu_to_le16(nr_addrs); - - lbs_cmd_async(priv, CMD_MAC_MULTICAST_ADR, &mcast_cmd.hdr, size); - - priv->mac_control |= CMD_ACT_MAC_MULTICAST_ENABLE; - } else - priv->mac_control &= ~CMD_ACT_MAC_MULTICAST_ENABLE; - - priv->mac_control &= ~(CMD_ACT_MAC_PROMISCUOUS_ENABLE | - CMD_ACT_MAC_ALL_MULTICAST_ENABLE); -out_set_mac_control: - if (priv->mac_control != old_mac_control) - lbs_set_mac_control(priv); - - lbs_deb_leave(LBS_DEB_NET); -} - -static void mv8686_set_multicast_list(struct net_device *dev) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - - schedule_work(&priv->mcast_work); -} -#endif - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) -static const struct net_device_ops lbs_netdev_ops = { - .ndo_open = lbs_dev_open, - .ndo_stop = lbs_eth_stop, - .ndo_start_xmit = lbs_hard_start_xmit, - .ndo_set_mac_address = lbs_set_mac_address, - .ndo_tx_timeout = lbs_tx_timeout, -#if (MV8686_SUPPORT_MCAST == 1) - .ndo_set_multicast_list = mv8686_set_multicast_list, -#endif - //.ndo_change_mtu = eth_change_mtu, - //.ndo_validate_addr = eth_validate_addr, -}; -#endif - -/** - * @brief This function adds the card. it will probe the - * card, allocate the lbs_priv and initialize the device. - * - * @param card A pointer to card - * @return A pointer to struct lbs_private structure - */ -struct lbs_private *lbs_add_card(void *card, struct device *dmdev) -{ - struct net_device *dev = NULL; - struct lbs_private *priv = NULL; - - lbs_deb_enter(LBS_DEB_MAIN); - - /* Allocate an Ethernet device and register it */ - dev = alloc_etherdev(sizeof(struct lbs_private)); - if (!dev) - { - lbs_pr_err("init ethX device failed\n"); - goto done; - } - priv = netdev_priv(dev); - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - dev->priv = priv; -#else - dev->ml_priv = priv; -#endif - - if (lbs_init_adapter(priv)) - { - lbs_pr_err("failed to initialize adapter structure.\n"); - goto err_init_adapter; - } - - //We don't like the name as ethN for wireless. Yongle Lai - dev_alloc_name(dev, "wlan%d"); - - priv->dev = dev; - priv->card = card; - priv->infra_open = 0; - - /* Setup the OS Interface to our functions */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - dev->open = lbs_dev_open; - dev->hard_start_xmit = lbs_hard_start_xmit; - dev->stop = lbs_eth_stop; - dev->set_mac_address = lbs_set_mac_address; - dev->tx_timeout = lbs_tx_timeout; - - //dev->ethtool_ops = &lbs_ethtool_ops; - - //dev->do_ioctl = lbs_do_ioctl; /* Yongle Lai */ - -#if (MV8686_SUPPORT_MCAST == 1) - dev->set_multicast_list = mv8686_set_multicast_list; -#endif - -#else /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) */ - dev->netdev_ops = &lbs_netdev_ops; -#endif - - dev->watchdog_timeo = 5 * HZ; - -#ifdef WIRELESS_EXT - dev->wireless_handlers = &lbs_handler_def; -#endif - dev->flags |= IFF_BROADCAST | IFF_MULTICAST; - - SET_NETDEV_DEV(dev, dmdev); - - lbs_deb_thread("Starting main thread...\n"); - init_waitqueue_head(&priv->waitq); - - init_waitqueue_head(&priv->ds_waitq); - priv->ps_supported = true; - -#if (AUTO_REASSOC == 1) - priv->prev_assoc_req = kzalloc(sizeof(struct assoc_request), GFP_KERNEL); - if (priv->prev_assoc_req == NULL) - { - printk("Alloc for prev_assoc_req failed.\n"); - } -#endif - - priv->main_thread = kthread_run(lbs_thread, dev, "lbs_main"); - if (IS_ERR(priv->main_thread)) - { - lbs_deb_thread("Error creating main thread.\n"); - goto err_init_adapter; - } - - priv->work_thread = create_singlethread_workqueue("lbs_worker"); - INIT_DELAYED_WORK(&priv->assoc_work, lbs_association_worker); - INIT_DELAYED_WORK(&priv->scan_work, lbs_scan_worker); -#if (NEW_MV8686_PS == 1) - INIT_DELAYED_WORK(&priv->ps_work, mv8686_ps_real_callback); -#endif - -#if (ANDROID_POWER_SAVE == 1) - INIT_DELAYED_WORK(&priv->ps_work, lbs_ps_worker); -#endif - -#if (MV8686_SUPPORT_MCAST == 1) - INIT_WORK(&priv->mcast_work, mv8686_set_mcast_worker); -#endif - INIT_WORK(&priv->sync_channel, lbs_sync_channel_worker); - - priv->wol_criteria = 0xffffffff; - priv->wol_gpio = 0xff; - - lbs_wifi_priv = priv; - - goto done; - -err_init_adapter: - lbs_free_adapter(priv); - free_netdev(dev); - priv = NULL; - -done: - lbs_deb_leave_args(LBS_DEB_MAIN, "priv %p", priv); - return priv; -} -EXPORT_SYMBOL_GPL(lbs_add_card); - -extern int lbs_exit_deep_sleep(struct lbs_private * priv); - -void lbs_remove_card(struct lbs_private *priv) -{ - struct net_device *dev = priv->dev; -#if (NEW_MV8686_PS == 0) - union iwreq_data wrqu; -#endif - - printk("Before lbs_remove_card.\n"); - - lbs_deb_enter(LBS_DEB_MAIN); - - lbs_wifi_priv = NULL; - - dev = priv->dev; - - cancel_delayed_work_sync(&priv->scan_work); - cancel_delayed_work_sync(&priv->assoc_work); - //cancel_work_sync(&priv->mcast_work); -#if (ANDROID_POWER_SAVE == 1) - cancel_delayed_work_sync(&priv->ps_work); -#endif - - /* worker thread destruction blocks on the in-flight command which - * should have been cleared already in lbs_stop_card(). - */ - lbs_deb_main("destroying worker thread\n"); - - //if (priv->work_thread == NULL) - // printk("You want to destroy NULL workqueue.\n"); - - if (priv->work_thread != NULL) - destroy_workqueue(priv->work_thread); - - lbs_deb_main("done destroying worker thread\n"); - - if (priv->psmode == LBS802_11POWERMODEMAX_PSP) - { - priv->psmode = LBS802_11POWERMODECAM; - lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); - } - - /* - * In Android, all 0xaa as AP BSSID should be considered - * as DRIVER_HUNG, it will restart WIFI. - * - * Since we are turn-off WiFi, so this event shouldn't be sent. - */ -#if (NEW_MV8686_PS == 0) - memset(wrqu.ap_addr.sa_data, 0xaa, ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); -#endif - - /* Stop the thread servicing the interrupts */ - priv->surpriseremoved = 1; - kthread_stop(priv->main_thread); - - lbs_free_adapter(priv); - - priv->dev = NULL; - -#if (AUTO_REASSOC == 1) - if (priv->prev_assoc_req) - kfree(priv->prev_assoc_req); -#endif - - free_netdev(dev); - - lbs_deb_leave(LBS_DEB_MAIN); -} -EXPORT_SYMBOL_GPL(lbs_remove_card); - -int lbs_start_card(struct lbs_private *priv) -{ - struct net_device *dev = priv->dev; - int ret = -1; - - lbs_deb_enter(LBS_DEB_MAIN); - - /* poke the firmware */ - ret = lbs_setup_firmware(priv); - if (ret) - goto done; - - /* init 802.11d */ - lbs_init_11d(priv); - -//#if (NEW_MV8686_PS == 1) -#if 0 - /* - * Kick off a scan to speed up AP list is showing. - */ - queue_delayed_work(priv->work_thread, &priv->scan_work, msecs_to_jiffies(1)); -#endif - - if (register_netdev(dev)) { - lbs_pr_err("cannot register ethX device\n"); - goto done; - } - - lbs_update_channel(priv); - - lbs_pr_info("%s: Marvell WLAN 802.11 adapter\n", dev->name); - - ret = 0; - -done: - lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); - return ret; -} -EXPORT_SYMBOL_GPL(lbs_start_card); - -void lbs_stop_card(struct lbs_private *priv) -{ - struct net_device *dev; - struct cmd_ctrl_node *cmdnode; - unsigned long flags; - - lbs_deb_enter(LBS_DEB_MAIN); - - printk("Before lbs_stop_card.\n"); - - if (!priv) - goto out; - dev = priv->dev; - - netif_stop_queue(dev); - //netif_carrier_off(dev); - -#if (NEW_MV8686_PS == 1) - del_timer_sync(&priv->turnoff_timer); - del_timer_sync(&priv->disconnect_timer); -#endif - -#if (ANDROID_POWER_SAVE == 1) - del_timer_sync(&priv->ps_timer); - - cancel_delayed_work_sync(&priv->ps_work); - - android_unlock_suspend(&wifi_android_lock); - android_uninit_suspend_lock(&wifi_android_lock); -#endif - -#if (MV8686_SUPPORT_MCAST == 1) - cancel_work_sync(&priv->mcast_work); -#endif - - /* Delete the timeout of the currently processing command */ - del_timer_sync(&priv->command_timer); - - /* Flush pending command nodes */ - spin_lock_irqsave(&priv->driver_lock, flags); - lbs_deb_main("clearing pending commands\n"); - - list_for_each_entry(cmdnode, &priv->cmdpendingq, list) - { - cmdnode->result = -ENOENT; - cmdnode->cmdwaitqwoken = 1; - wake_up_interruptible(&cmdnode->cmdwait_q); - } - - /* Flush the command the card is currently processing */ - if (priv->cur_cmd) - { - printk("Current command is being processed.\n"); - lbs_deb_main("clearing current command\n"); - priv->cur_cmd->result = -ENOENT; - priv->cur_cmd->cmdwaitqwoken = 1; - wake_up_interruptible(&priv->cur_cmd->cmdwait_q); - } - lbs_deb_main("done clearing commands\n"); - spin_unlock_irqrestore(&priv->driver_lock, flags); - - unregister_netdev(dev); - -out: - lbs_deb_leave(LBS_DEB_MAIN); -} -EXPORT_SYMBOL_GPL(lbs_stop_card); - -/** - * @brief This function finds the CFP in - * region_cfp_table based on region and band parameter. - * - * @param region The region code - * @param band The band - * @param cfp_no A pointer to CFP number - * @return A pointer to CFP - */ -struct chan_freq_power *lbs_get_region_cfp_table(u8 region, int *cfp_no) -{ - int i, end; - - lbs_deb_enter(LBS_DEB_MAIN); - - end = ARRAY_SIZE(region_cfp_table); - - for (i = 0; i < end ; i++) { - lbs_deb_main("region_cfp_table[i].region=%d\n", - region_cfp_table[i].region); - if (region_cfp_table[i].region == region) { - *cfp_no = region_cfp_table[i].cfp_no_BG; - lbs_deb_leave(LBS_DEB_MAIN); - return region_cfp_table[i].cfp_BG; - } - } - - lbs_deb_leave_args(LBS_DEB_MAIN, "ret NULL"); - return NULL; -} - -int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band) -{ - int ret = 0; - int i = 0; - - struct chan_freq_power *cfp; - int cfp_no; - - lbs_deb_enter(LBS_DEB_MAIN); - - memset(priv->region_channel, 0, sizeof(priv->region_channel)); - - cfp = lbs_get_region_cfp_table(region, &cfp_no); - if (cfp != NULL) { - priv->region_channel[i].nrcfp = cfp_no; - priv->region_channel[i].CFP = cfp; - } else { - lbs_deb_main("wrong region code %#x in band B/G\n", - region); - ret = -1; - goto out; - } - priv->region_channel[i].valid = 1; - priv->region_channel[i].region = region; - priv->region_channel[i].band = band; - i++; -out: - lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); - return ret; -} - -void lbs_queue_event(struct lbs_private *priv, u32 event) -{ - unsigned long flags; - - lbs_deb_enter(LBS_DEB_THREAD); - spin_lock_irqsave(&priv->driver_lock, flags); - - if (priv->psstate == PS_STATE_SLEEP) - priv->psstate = PS_STATE_AWAKE; - - __kfifo_put(priv->event_fifo, (unsigned char *) &event, sizeof(u32)); - - wake_up_interruptible(&priv->waitq); - - spin_unlock_irqrestore(&priv->driver_lock, flags); - lbs_deb_leave(LBS_DEB_THREAD); -} -EXPORT_SYMBOL_GPL(lbs_queue_event); - -void lbs_notify_command_response(struct lbs_private *priv, u8 resp_idx) -{ - lbs_deb_enter(LBS_DEB_THREAD); - - if (priv->psstate == PS_STATE_SLEEP) - priv->psstate = PS_STATE_AWAKE; - - /* Swap buffers by flipping the response index */ - BUG_ON(resp_idx > 1); - priv->resp_idx = resp_idx; - - wake_up_interruptible(&priv->waitq); - - lbs_deb_leave(LBS_DEB_THREAD); -} -EXPORT_SYMBOL_GPL(lbs_notify_command_response); - -//static int __init lbs_init_module(void) -int mv8686_main_init(void) -{ - lbs_deb_enter(LBS_DEB_MAIN); - memset(&confirm_sleep, 0, sizeof(confirm_sleep)); - confirm_sleep.hdr.command = cpu_to_le16(CMD_802_11_PS_MODE); - confirm_sleep.hdr.size = cpu_to_le16(sizeof(confirm_sleep)); - confirm_sleep.action = cpu_to_le16(CMD_SUBCMD_SLEEP_CONFIRMED); - - atomic_set(&reassoc_flag, 0); - - lbs_deb_leave(LBS_DEB_MAIN); - return 0; -} - -//static void __exit lbs_exit_module(void) -void mv8686_main_exit(void) -{ - lbs_deb_enter(LBS_DEB_MAIN); - - atomic_set(&reassoc_flag, 0); - - lbs_deb_leave(LBS_DEB_MAIN); -} - -//module_init(lbs_init_module); -//module_exit(lbs_exit_module); - -MODULE_DESCRIPTION("Libertas WLAN Driver Library"); -MODULE_AUTHOR("Marvell International Ltd."); -MODULE_LICENSE("GPL"); - diff --git a/drivers/net/wireless/mv8686/mkclean.sh b/drivers/net/wireless/mv8686/mkclean.sh deleted file mode 100755 index 87b6d1aab1e4..000000000000 --- a/drivers/net/wireless/mv8686/mkclean.sh +++ /dev/null @@ -1,10 +0,0 @@ - - -rm -f *.o -rm -f ../wifi_power/*.o -rm -f ../wifi_power/.*.cmd -rm -f *.uu -rm -f mv8686/* -rm -f .*.cmd -rm -f modules.order -rm -rf mv8686 diff --git a/drivers/net/wireless/mv8686/mkpkg.sh b/drivers/net/wireless/mv8686/mkpkg.sh deleted file mode 100755 index d2f11041a838..000000000000 --- a/drivers/net/wireless/mv8686/mkpkg.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -echo "Begin to make MV8686 wifi driver package ..." - -mkdir -p mv8686 -rm -f mv8686/* - -cp ReleaseNotes.txt mv8686/ -cp Makefile.mv8686 mv8686/Makefile -cp ../wifi_power/wifi_power.h mv8686/ -cp ../wifi_power/wifi_power.c mv8686/ -cp ../wifi_power/wifi_config.c mv8686/ -uuencode mv8686.o mv8686.o > mv8686.uu -cp mv8686.uu mv8686/ - -echo "Done" - diff --git a/drivers/net/wireless/mv8686/mv8686_cis.c b/drivers/net/wireless/mv8686/mv8686_cis.c deleted file mode 100755 index 8d30b847fdaf..000000000000 --- a/drivers/net/wireless/mv8686/mv8686_cis.c +++ /dev/null @@ -1,188 +0,0 @@ -#include - -#include -#include -#include -#include - -/* - * common CIS. - */ -unsigned char mv8686_cis_vers1[32] = //0x15 -{0x01, 0x00, 0x4d, 0x61, 0x72, 0x76, 0x65, 0x6c, 0x6c, 0x00, 0x38, 0x30, 0x32, - 0x2e, 0x31, 0x31, 0x20, 0x53, 0x44, 0x49, 0x4f, 0x20, 0x49, 0x44, 0x3a, 0x20, - 0x30, 0x42, 0x00, 0x00, 0xff -}; -unsigned char mv8686_cis_manfid[4] = {0xdf, 0x02, 0x03, 0x91}; //0x20 -unsigned char mv8686_cis_funcid[4] = {0x0c, 0x00}; //0x21 -unsigned char mv8686_cis_funce[4] = {0x00, 0x00, 0x01, 0x32}; //0x22 - -/* - * Function CIS. - */ -unsigned char mv8686_fcis_funcid[4] = {0x0c, 0x00}; //0x21 -unsigned char mv8686_fcis_funce[28] = //0x22 -{0x01, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static int mv8686_cistpl_vers_1(struct mmc_card *card, struct sdio_func *func, - const unsigned char *buf, unsigned size) -{ - unsigned i, nr_strings; - char **buffer, *string; - - buf += 2; - size -= 2; - -/* - printk("CIS VERS 1: "); - for (i = 0; i < size; i++) - printk("%2.2x ", buf[i]); - printk("\n"); -*/ - - nr_strings = 0; - for (i = 0; i < size; i++) - { - if (buf[i] == 0xff) - break; - - if (buf[i] == 0) - nr_strings++; - } - - if (buf[i-1] != '\0') - { - printk(KERN_WARNING "SDIO: ignoring broken CISTPL_VERS_1\n"); - return 0; - } - - size = i; - - buffer = kzalloc(sizeof(char*) * nr_strings + size, GFP_KERNEL); - if (!buffer) - return -ENOMEM; - - string = (char*)(buffer + nr_strings); - - for (i = 0; i < nr_strings; i++) - { - buffer[i] = string; - strcpy(string, buf); - string += strlen(string) + 1; - buf += strlen(buf) + 1; - } - - if (func) - { - func->num_info = nr_strings; - func->info = (const char**)buffer; - } else { - card->num_info = nr_strings; - card->info = (const char**)buffer; - } - - return 0; -} - -static int mv8686_cistpl_manfid(struct mmc_card *card, struct sdio_func *func, - const unsigned char *buf, unsigned size) -{ - unsigned int vendor, device; - - /* TPLMID_MANF */ - vendor = buf[0] | (buf[1] << 8); - - /* TPLMID_CARD */ - device = buf[2] | (buf[3] << 8); - - if (func) { - func->vendor = vendor; - func->device = device; - } else { - card->cis.vendor = vendor; - card->cis.device = device; - } - - return 0; -} - -static const unsigned char mv8686_speed_val[16] = - { 0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80 }; -static const unsigned int mv8686_speed_unit[8] = - { 10000, 100000, 1000000, 10000000, 0, 0, 0, 0 }; - -static int mv8686_cistpl_funce_common(struct mmc_card *card, - const unsigned char *buf, unsigned size) -{ - if (size < 0x04 || buf[0] != 0) - return -EINVAL; - - /* TPLFE_FN0_BLK_SIZE */ - card->cis.blksize = buf[1] | (buf[2] << 8); - - /* TPLFE_MAX_TRAN_SPEED */ - card->cis.max_dtr = mv8686_speed_val[(buf[3] >> 3) & 15] * - mv8686_speed_unit[buf[3] & 7]; - - return 0; -} - -static int mv8686_cistpl_funce_func(struct sdio_func *func, - const unsigned char *buf, unsigned size) -{ - unsigned vsn; - unsigned min_size; - - vsn = func->card->cccr.sdio_vsn; - min_size = (vsn == SDIO_SDIO_REV_1_00) ? 28 : 42; - - if (size < min_size || buf[0] != 1) - return -EINVAL; - - /* TPLFE_MAX_BLK_SIZE */ - func->max_blksize = buf[12] | (buf[13] << 8); - - return 0; -} - -static int mv8686_cistpl_funce(struct mmc_card *card, struct sdio_func *func, - const unsigned char *buf, unsigned size) -{ - int ret; - - /* - * There should be two versions of the CISTPL_FUNCE tuple, - * one for the common CIS (function 0) and a version used by - * the individual function's CIS (1-7). Yet, the later has a - * different length depending on the SDIO spec version. - */ - if (func) - ret = mv8686_cistpl_funce_func(func, buf, size); - else - ret = mv8686_cistpl_funce_common(card, buf, size); - - if (ret) { - printk(KERN_ERR "%s: bad CISTPL_FUNCE size %u " - "type %u\n", mmc_hostname(card->host), size, buf[0]); - return ret; - } - - return 0; -} - -int mv8686_read_common_cis(struct mmc_card *card) -{ - mv8686_cistpl_vers_1(card, NULL, mv8686_cis_vers1, 31); - mv8686_cistpl_manfid(card, NULL, mv8686_cis_manfid, 4); - mv8686_cistpl_funce(card, NULL, mv8686_cis_funce, 4); - - return 0; -} - -int mv8686_read_func_cis(struct sdio_func *func) -{ - mv8686_cistpl_funce(func->card, func, mv8686_fcis_funce, 28); - - return 0; -} diff --git a/drivers/net/wireless/mv8686/radiotap.h b/drivers/net/wireless/mv8686/radiotap.h deleted file mode 100755 index 9b70d6fc3e01..000000000000 --- a/drivers/net/wireless/mv8686/radiotap.h +++ /dev/null @@ -1,46 +0,0 @@ -#include - -#define IEEE80211_RADIOTAP_F_BADFCS 0x40 /* bad FCS */ - -struct tx_radiotap_hdr { - struct ieee80211_radiotap_header hdr; - u8 rate; - u8 txpower; - u8 rts_retries; - u8 data_retries; -} __attribute__ ((packed)); - -#define TX_RADIOTAP_PRESENT ( \ - (1 << IEEE80211_RADIOTAP_RATE) | \ - (1 << IEEE80211_RADIOTAP_DBM_TX_POWER) | \ - (1 << IEEE80211_RADIOTAP_RTS_RETRIES) | \ - (1 << IEEE80211_RADIOTAP_DATA_RETRIES) | \ - 0) - -#define IEEE80211_FC_VERSION_MASK 0x0003 -#define IEEE80211_FC_TYPE_MASK 0x000c -#define IEEE80211_FC_TYPE_MGT 0x0000 -#define IEEE80211_FC_TYPE_CTL 0x0004 -#define IEEE80211_FC_TYPE_DATA 0x0008 -#define IEEE80211_FC_SUBTYPE_MASK 0x00f0 -#define IEEE80211_FC_TOFROMDS_MASK 0x0300 -#define IEEE80211_FC_TODS_MASK 0x0100 -#define IEEE80211_FC_FROMDS_MASK 0x0200 -#define IEEE80211_FC_NODS 0x0000 -#define IEEE80211_FC_TODS 0x0100 -#define IEEE80211_FC_FROMDS 0x0200 -#define IEEE80211_FC_DSTODS 0x0300 - -struct rx_radiotap_hdr { - struct ieee80211_radiotap_header hdr; - u8 flags; - u8 rate; - u8 antsignal; -} __attribute__ ((packed)); - -#define RX_RADIOTAP_PRESENT ( \ - (1 << IEEE80211_RADIOTAP_FLAGS) | \ - (1 << IEEE80211_RADIOTAP_RATE) | \ - (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) |\ - 0) - diff --git a/drivers/net/wireless/mv8686/rx.c b/drivers/net/wireless/mv8686/rx.c deleted file mode 100755 index 372ec83b429e..000000000000 --- a/drivers/net/wireless/mv8686/rx.c +++ /dev/null @@ -1,470 +0,0 @@ -/** - * This file contains the handling of RX in wlan driver. - */ -#include -#include - -#include "hostcmd.h" -#include "radiotap.h" -#include "decl.h" -#include "dev.h" -#include "wext.h" - -struct eth803hdr { - u8 dest_addr[6]; - u8 src_addr[6]; - u16 h803_len; -} __attribute__ ((packed)); - -struct rfc1042hdr { - u8 llc_dsap; - u8 llc_ssap; - u8 llc_ctrl; - u8 snap_oui[3]; - u16 snap_type; -} __attribute__ ((packed)); - -struct rxpackethdr { - struct rxpd rx_pd; - struct eth803hdr eth803_hdr; - struct rfc1042hdr rfc1042_hdr; -} __attribute__ ((packed)); - -struct rx80211packethdr { - struct rxpd rx_pd; - void *eth80211_hdr; -} __attribute__ ((packed)); - -static int process_rxed_802_11_packet(struct lbs_private *priv, - struct sk_buff *skb); - -/** - * @brief This function computes the avgSNR . - * - * @param priv A pointer to struct lbs_private structure - * @return avgSNR - */ -static u8 lbs_getavgsnr(struct lbs_private *priv) -{ - u8 i; - u16 temp = 0; - if (priv->numSNRNF == 0) - return 0; - for (i = 0; i < priv->numSNRNF; i++) - temp += priv->rawSNR[i]; - return (u8) (temp / priv->numSNRNF); - -} - -/** - * @brief This function computes the AvgNF - * - * @param priv A pointer to struct lbs_private structure - * @return AvgNF - */ -static u8 lbs_getavgnf(struct lbs_private *priv) -{ - u8 i; - u16 temp = 0; - if (priv->numSNRNF == 0) - return 0; - for (i = 0; i < priv->numSNRNF; i++) - temp += priv->rawNF[i]; - return (u8) (temp / priv->numSNRNF); - -} - -/** - * @brief This function save the raw SNR/NF to our internel buffer - * - * @param priv A pointer to struct lbs_private structure - * @param prxpd A pointer to rxpd structure of received packet - * @return n/a - */ -static void lbs_save_rawSNRNF(struct lbs_private *priv, struct rxpd *p_rx_pd) -{ - if (priv->numSNRNF < DEFAULT_DATA_AVG_FACTOR) - priv->numSNRNF++; - priv->rawSNR[priv->nextSNRNF] = p_rx_pd->snr; - priv->rawNF[priv->nextSNRNF] = p_rx_pd->nf; - priv->nextSNRNF++; - if (priv->nextSNRNF >= DEFAULT_DATA_AVG_FACTOR) - priv->nextSNRNF = 0; - return; -} - -/** - * @brief This function computes the RSSI in received packet. - * - * @param priv A pointer to struct lbs_private structure - * @param prxpd A pointer to rxpd structure of received packet - * @return n/a - */ -static void lbs_compute_rssi(struct lbs_private *priv, struct rxpd *p_rx_pd) -{ - - lbs_deb_enter(LBS_DEB_RX); - - lbs_deb_rx("rxpd: SNR %d, NF %d\n", p_rx_pd->snr, p_rx_pd->nf); - lbs_deb_rx("before computing SNR: SNR-avg = %d, NF-avg = %d\n", - priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, - priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); - - priv->SNR[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->snr; - priv->NF[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->nf; - lbs_save_rawSNRNF(priv, p_rx_pd); - - priv->SNR[TYPE_RXPD][TYPE_AVG] = lbs_getavgsnr(priv) * AVG_SCALE; - priv->NF[TYPE_RXPD][TYPE_AVG] = lbs_getavgnf(priv) * AVG_SCALE; - lbs_deb_rx("after computing SNR: SNR-avg = %d, NF-avg = %d\n", - priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, - priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); - - priv->RSSI[TYPE_RXPD][TYPE_NOAVG] = - CAL_RSSI(priv->SNR[TYPE_RXPD][TYPE_NOAVG], - priv->NF[TYPE_RXPD][TYPE_NOAVG]); - - priv->RSSI[TYPE_RXPD][TYPE_AVG] = - CAL_RSSI(priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, - priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); - - lbs_deb_leave(LBS_DEB_RX); -} - -//#define RX_PKT_SIZE_SUMM - -#ifdef RX_PKT_SIZE_SUMM -struct rxpkt_summ -{ - int init_flag; - u32 less_64; - u32 less_128; - u32 less_256; - u32 less_512; - u32 less_1024; - u32 less_1512; - u32 large_1512; -}; - -struct rxpkt_summ rxsumm = {-1, 0, 0, 0, 0, 0, 0, 0}; - -#endif - -/** - * @brief This function processes received packet and forwards it - * to kernel/upper layer - * - * @param priv A pointer to struct lbs_private - * @param skb A pointer to skb which includes the received packet - * @return 0 or -1 - */ -#if (NEW_MV8686_PS == 1) -extern unsigned long wifi_iprx_packets; -#endif - -int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) -{ - int ret = 0; - struct net_device *dev = priv->dev; - struct rxpackethdr *p_rx_pkt; - struct rxpd *p_rx_pd; - int hdrchop; - struct ethhdr *p_ethhdr; - const u8 rfc1042_eth_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; - - lbs_deb_enter(LBS_DEB_RX); - - BUG_ON(!skb); - - skb->ip_summed = CHECKSUM_NONE; - - if (priv->monitormode) - return process_rxed_802_11_packet(priv, skb); - - p_rx_pkt = (struct rxpackethdr *) skb->data; - p_rx_pd = &p_rx_pkt->rx_pd; - - lbs_deb_hex(LBS_DEB_RX, "RX Data: Before chop rxpd", skb->data, - min_t(unsigned int, skb->len, 100)); - - if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { - lbs_deb_rx("rx err: frame received with bad length\n"); - dev->stats.rx_length_errors++; - ret = 0; - dev_kfree_skb(skb); - goto done; - } - - /* - * Check rxpd status and update 802.3 stat, - */ - if (!(p_rx_pd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) { - lbs_deb_rx("rx err: frame received with bad status\n"); - lbs_pr_alert("rxpd not ok\n"); - dev->stats.rx_errors++; - ret = 0; - dev_kfree_skb(skb); - goto done; - } - - lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n", - skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); - - lbs_deb_hex(LBS_DEB_RX, "RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr, - sizeof(p_rx_pkt->eth803_hdr.dest_addr)); - lbs_deb_hex(LBS_DEB_RX, "RX Data: Src", p_rx_pkt->eth803_hdr.src_addr, - sizeof(p_rx_pkt->eth803_hdr.src_addr)); - - if (memcmp(&p_rx_pkt->rfc1042_hdr, - rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr)) == 0) { - /* - * Replace the 803 header and rfc1042 header (llc/snap) with an - * EthernetII header, keep the src/dst and snap_type (ethertype) - * - * The firmware only passes up SNAP frames converting - * all RX Data from 802.11 to 802.2/LLC/SNAP frames. - * - * To create the Ethernet II, just move the src, dst address right - * before the snap_type. - */ - p_ethhdr = (struct ethhdr *) - ((u8 *) & p_rx_pkt->eth803_hdr - + sizeof(p_rx_pkt->eth803_hdr) + sizeof(p_rx_pkt->rfc1042_hdr) - - sizeof(p_rx_pkt->eth803_hdr.dest_addr) - - sizeof(p_rx_pkt->eth803_hdr.src_addr) - - sizeof(p_rx_pkt->rfc1042_hdr.snap_type)); - - memcpy(p_ethhdr->h_source, p_rx_pkt->eth803_hdr.src_addr, - sizeof(p_ethhdr->h_source)); - memcpy(p_ethhdr->h_dest, p_rx_pkt->eth803_hdr.dest_addr, - sizeof(p_ethhdr->h_dest)); - - /* Chop off the rxpd + the excess memory from the 802.2/llc/snap header - * that was removed - */ - hdrchop = (u8 *) p_ethhdr - (u8 *) p_rx_pkt; - } else { - lbs_deb_hex(LBS_DEB_RX, "RX Data: LLC/SNAP", - (u8 *) & p_rx_pkt->rfc1042_hdr, - sizeof(p_rx_pkt->rfc1042_hdr)); - - /* Chop off the rxpd */ - hdrchop = (u8 *) & p_rx_pkt->eth803_hdr - (u8 *) p_rx_pkt; - } - - /* Chop off the leading header bytes so the skb points to the start of - * either the reconstructed EthII frame or the 802.2/llc/snap frame - */ - skb_pull(skb, hdrchop); - - /* Take the data rate from the rxpd structure - * only if the rate is auto - */ - if (priv->enablehwauto) - priv->cur_rate = lbs_fw_index_to_data_rate(p_rx_pd->rx_rate); - - lbs_compute_rssi(priv, p_rx_pd); - - lbs_deb_rx("rx data: size of actual packet %d\n", skb->len); - dev->stats.rx_bytes += skb->len; - dev->stats.rx_packets++; - -#ifdef RX_PKT_SIZE_SUMM - if (rxsumm.init_flag == -1) - { - memset(&rxsumm, 0, sizeof(rxsumm)); - } - if (skb->len <= 64) - rxsumm.less_64++; - else if (skb->len <= 128) - rxsumm.less_128++; - else if (skb->len <= 256) - rxsumm.less_256++; - else if (skb->len <= 512) - rxsumm.less_512++; - else if (skb->len <= 1024) - rxsumm.less_1024++; - else if (skb->len <= 1512) - rxsumm.less_1512++; - else - rxsumm.large_1512++; - rxsumm.init_flag++; - - if ((rxsumm.init_flag > 0) && (rxsumm.init_flag % 200 == 0)) - { - printk("Total (%s) data request: %u\n", "WIFI-RX", rxsumm.init_flag); - printk(" <=64 : %7u %2d%%\n", rxsumm.less_64, - (rxsumm.less_64 * 100) / rxsumm.init_flag); - printk(" <=128 : %7u %2d%%\n", rxsumm.less_128, - (rxsumm.less_128 * 100) / rxsumm.init_flag); - printk(" <=256 : %7u %2d%%\n", rxsumm.less_256, - (rxsumm.less_256 * 100) / rxsumm.init_flag); - printk(" <=512 : %7u %2d%%\n", rxsumm.less_512, - (rxsumm.less_512 * 100) / rxsumm.init_flag); - printk(" <=1024 : %7u %2d%%\n", rxsumm.less_1024, - (rxsumm.less_1024 * 100) / rxsumm.init_flag); - printk(" <=1512 : %7u %2d%%\n", rxsumm.less_1512, - (rxsumm.less_1512 * 100) / rxsumm.init_flag); - printk(" >1512 : %7u %2d%%\n", rxsumm.large_1512, - (rxsumm.large_1512 * 100) / rxsumm.init_flag); - } -#endif - - skb->protocol = eth_type_trans(skb, dev); - -#if (NEW_MV8686_PS == 1) - if (skb->protocol == 0x0008) //ETH_P_IP - wifi_iprx_packets++; - //else - // printk("Got a not IP packet: %x\n", skb->protocol); -#endif - - if (in_interrupt()) - netif_rx(skb); - else - netif_rx_ni(skb); - - ret = 0; -done: - lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret); - return ret; -} -EXPORT_SYMBOL_GPL(lbs_process_rxed_packet); - -/** - * @brief This function converts Tx/Rx rates from the Marvell WLAN format - * (see Table 2 in Section 3.1) to IEEE80211_RADIOTAP_RATE units (500 Kb/s) - * - * @param rate Input rate - * @return Output Rate (0 if invalid) - */ -static u8 convert_mv_rate_to_radiotap(u8 rate) -{ - switch (rate) { - case 0: /* 1 Mbps */ - return 2; - case 1: /* 2 Mbps */ - return 4; - case 2: /* 5.5 Mbps */ - return 11; - case 3: /* 11 Mbps */ - return 22; - /* case 4: reserved */ - case 5: /* 6 Mbps */ - return 12; - case 6: /* 9 Mbps */ - return 18; - case 7: /* 12 Mbps */ - return 24; - case 8: /* 18 Mbps */ - return 36; - case 9: /* 24 Mbps */ - return 48; - case 10: /* 36 Mbps */ - return 72; - case 11: /* 48 Mbps */ - return 96; - case 12: /* 54 Mbps */ - return 108; - } - lbs_pr_alert("Invalid Marvell WLAN rate %i\n", rate); - return 0; -} - -/** - * @brief This function processes a received 802.11 packet and forwards it - * to kernel/upper layer - * - * @param priv A pointer to struct lbs_private - * @param skb A pointer to skb which includes the received packet - * @return 0 or -1 - */ -static int process_rxed_802_11_packet(struct lbs_private *priv, - struct sk_buff *skb) -{ - int ret = 0; - struct net_device *dev = priv->dev; - struct rx80211packethdr *p_rx_pkt; - struct rxpd *prxpd; - struct rx_radiotap_hdr radiotap_hdr; - struct rx_radiotap_hdr *pradiotap_hdr; - - lbs_deb_enter(LBS_DEB_RX); - - p_rx_pkt = (struct rx80211packethdr *) skb->data; - prxpd = &p_rx_pkt->rx_pd; - - // lbs_deb_hex(LBS_DEB_RX, "RX Data: Before chop rxpd", skb->data, min(skb->len, 100)); - - if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { - lbs_deb_rx("rx err: frame received with bad length\n"); - dev->stats.rx_length_errors++; - ret = -EINVAL; - kfree_skb(skb); - goto done; - } - - /* - * Check rxpd status and update 802.3 stat, - */ - if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) { - //lbs_deb_rx("rx err: frame received with bad status\n"); - dev->stats.rx_errors++; - } - - lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n", - skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); - - /* create the exported radio header */ - - /* radiotap header */ - radiotap_hdr.hdr.it_version = 0; - /* XXX must check this value for pad */ - radiotap_hdr.hdr.it_pad = 0; - radiotap_hdr.hdr.it_len = cpu_to_le16 (sizeof(struct rx_radiotap_hdr)); - radiotap_hdr.hdr.it_present = cpu_to_le32 (RX_RADIOTAP_PRESENT); - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) - radiotap_hdr.flags |= IEEE80211_RADIOTAP_F_RX_BADFCS; //IEEE80211_RADIOTAP_F_BADFCS; -#endif - - radiotap_hdr.rate = convert_mv_rate_to_radiotap(prxpd->rx_rate); - /* XXX must check no carryout */ - radiotap_hdr.antsignal = prxpd->snr + prxpd->nf; - - /* chop the rxpd */ - skb_pull(skb, sizeof(struct rxpd)); - - /* add space for the new radio header */ - if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) && - pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0, GFP_ATOMIC)) { - lbs_pr_alert("%s: couldn't pskb_expand_head\n", __func__); - ret = -ENOMEM; - kfree_skb(skb); - goto done; - } - - pradiotap_hdr = (void *)skb_push(skb, sizeof(struct rx_radiotap_hdr)); - memcpy(pradiotap_hdr, &radiotap_hdr, sizeof(struct rx_radiotap_hdr)); - - /* Take the data rate from the rxpd structure - * only if the rate is auto - */ - if (priv->enablehwauto) - priv->cur_rate = lbs_fw_index_to_data_rate(prxpd->rx_rate); - - lbs_compute_rssi(priv, prxpd); - - lbs_deb_rx("rx data: size of actual packet %d\n", skb->len); - dev->stats.rx_bytes += skb->len; - dev->stats.rx_packets++; - - netif_rx(skb); - - ret = 0; - -done: - lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret); - return ret; -} diff --git a/drivers/net/wireless/mv8686/scan.c b/drivers/net/wireless/mv8686/scan.c deleted file mode 100755 index 811909ad1b6e..000000000000 --- a/drivers/net/wireless/mv8686/scan.c +++ /dev/null @@ -1,1458 +0,0 @@ -/** - * Functions implementing wlan scan IOCTL and firmware command APIs - * - * IOCTL handlers as well as command preperation and response routines - * for sending scan commands to the firmware. - */ -#include -#include -#include -#include -#include "lib80211.h" - -#include "host.h" -#include "decl.h" -#include "dev.h" -#include "scan.h" -#include "cmd.h" - -//! Approximate amount of data needed to pass a scan result back to iwlist -#define MAX_SCAN_CELL_SIZE (IW_EV_ADDR_LEN \ - + IW_ESSID_MAX_SIZE \ - + IW_EV_UINT_LEN \ - + IW_EV_FREQ_LEN \ - + IW_EV_QUAL_LEN \ - + IW_ESSID_MAX_SIZE \ - + IW_EV_PARAM_LEN \ - + 40) /* 40 for WPAIE */ - -//! Memory needed to store a max sized channel List TLV for a firmware scan -#define CHAN_TLV_MAX_SIZE (sizeof(struct mrvlietypesheader) \ - + (MRVDRV_MAX_CHANNELS_PER_SCAN \ - * sizeof(struct chanscanparamset))) - -//! Memory needed to store a max number/size SSID TLV for a firmware scan -#define SSID_TLV_MAX_SIZE (1 * sizeof(struct mrvlietypes_ssidparamset)) - -//! Maximum memory needed for a cmd_ds_802_11_scan with all TLVs at max -#define MAX_SCAN_CFG_ALLOC (sizeof(struct cmd_ds_802_11_scan) \ - + CHAN_TLV_MAX_SIZE + SSID_TLV_MAX_SIZE) - -//! The maximum number of channels the firmware can scan per command -#define MRVDRV_MAX_CHANNELS_PER_SCAN 14 - -/** - * @brief Number of channels to scan per firmware scan command issuance. - * - * Number restricted to prevent hitting the limit on the amount of scan data - * returned in a single firmware scan command. - */ -#define MRVDRV_CHANNELS_PER_SCAN_CMD 4 - -//! Scan time specified in the channel TLV for each channel for passive scans -#define MRVDRV_PASSIVE_SCAN_CHAN_TIME 100 - -//! Scan time specified in the channel TLV for each channel for active scans -#define MRVDRV_ACTIVE_SCAN_CHAN_TIME 100 - -#define DEFAULT_MAX_SCAN_AGE (30 * HZ) //(15 * HZ) = 15 seconds - -#if (ANDROID_POWER_SAVE == 1) -extern int wifi_ps_status; -#endif - -static int lbs_ret_80211_scan(struct lbs_private *priv, unsigned long dummy, - struct cmd_header *resp); -#define isprint(c) ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || \ - (c >= '0' && c <= '9')) || (c == '_') - -const char *mv8686_print_ssid(char *buf, const char *ssid, u8 ssid_len) -{ - const char *s = ssid; - char *d = buf; - - ssid_len = min_t(u8, ssid_len, IEEE80211_MAX_SSID_LEN); - while (ssid_len--) { - if (isprint(*s)) { - *d++ = *s++; - continue; - } - - *d++ = '\\'; - if (*s == '\0') - *d++ = '0'; - else if (*s == '\n') - *d++ = 'n'; - else if (*s == '\r') - *d++ = 'r'; - else if (*s == '\t') - *d++ = 't'; - else if (*s == '\\') - *d++ = '\\'; - else - d += snprintf(d, 3, "%03o", *s); - s++; - } - *d = '\0'; - return buf; -} -EXPORT_SYMBOL(mv8686_print_ssid); - -/*********************************************************************/ -/* */ -/* Misc helper functions */ -/* */ -/*********************************************************************/ - -/** - * @brief Unsets the MSB on basic rates - * - * Scan through an array and unset the MSB for basic data rates. - * - * @param rates buffer of data rates - * @param len size of buffer - */ -static void lbs_unset_basic_rate_flags(u8 *rates, size_t len) -{ - int i; - - for (i = 0; i < len; i++) - rates[i] &= 0x7f; -} - - -static inline void clear_bss_descriptor(struct bss_descriptor *bss) -{ - /* Don't blow away ->list, just BSS data */ - memset(bss, 0, offsetof(struct bss_descriptor, list)); -} - -/** - * @brief Compare two SSIDs - * - * @param ssid1 A pointer to ssid to compare - * @param ssid2 A pointer to ssid to compare - * - * @return 0: ssid is same, otherwise is different - */ -int lbs_ssid_cmp(uint8_t *ssid1, uint8_t ssid1_len, uint8_t *ssid2, - uint8_t ssid2_len) -{ - if (ssid1_len != ssid2_len) - return -1; - - return memcmp(ssid1, ssid2, ssid1_len); -} - -static inline int is_same_network(struct bss_descriptor *src, - struct bss_descriptor *dst) -{ - /* A network is only a duplicate if the channel, BSSID, and ESSID - * all match. We treat all with the same BSSID and channel - * as one network */ - return ((src->ssid_len == dst->ssid_len) && - (src->channel == dst->channel) && - !compare_ether_addr(src->bssid, dst->bssid) && - !memcmp(src->ssid, dst->ssid, src->ssid_len)); -} - -/*********************************************************************/ -/* */ -/* Main scanning support */ -/* */ -/*********************************************************************/ - -/** - * @brief Create a channel list for the driver to scan based on region info - * - * Only used from lbs_scan_setup_scan_config() - * - * Use the driver region/band information to construct a comprehensive list - * of channels to scan. This routine is used for any scan that is not - * provided a specific channel list to scan. - * - * @param priv A pointer to struct lbs_private structure - * @param scanchanlist Output parameter: resulting channel list to scan - * - * @return void - */ -static int lbs_scan_create_channel_list(struct lbs_private *priv, - struct chanscanparamset *scanchanlist) -{ - struct region_channel *scanregion; - struct chan_freq_power *cfp; - int rgnidx; - int chanidx; - int nextchan; - uint8_t scantype; - - chanidx = 0; - - /* Set the default scan type to the user specified type, will later - * be changed to passive on a per channel basis if restricted by - * regulatory requirements (11d or 11h) - */ - scantype = CMD_SCAN_TYPE_ACTIVE; - - for (rgnidx = 0; rgnidx < ARRAY_SIZE(priv->region_channel); rgnidx++) { - if (priv->enable11d && (priv->connect_status != LBS_CONNECTED)) { - /* Scan all the supported chan for the first scan */ - if (!priv->universal_channel[rgnidx].valid) - continue; - scanregion = &priv->universal_channel[rgnidx]; - - /* clear the parsed_region_chan for the first scan */ - memset(&priv->parsed_region_chan, 0x00, - sizeof(priv->parsed_region_chan)); - } else { - if (!priv->region_channel[rgnidx].valid) - continue; - scanregion = &priv->region_channel[rgnidx]; - } - - for (nextchan = 0; nextchan < scanregion->nrcfp; nextchan++, chanidx++) { - struct chanscanparamset *chan = &scanchanlist[chanidx]; - - cfp = scanregion->CFP + nextchan; - - if (priv->enable11d) - scantype = lbs_get_scan_type_11d(cfp->channel, - &priv->parsed_region_chan); - - if (scanregion->band == BAND_B || scanregion->band == BAND_G) - chan->radiotype = CMD_SCAN_RADIO_TYPE_BG; - - if (scantype == CMD_SCAN_TYPE_PASSIVE) { - chan->maxscantime = cpu_to_le16(MRVDRV_PASSIVE_SCAN_CHAN_TIME); - chan->chanscanmode.passivescan = 1; - } else { - chan->maxscantime = cpu_to_le16(MRVDRV_ACTIVE_SCAN_CHAN_TIME); - chan->chanscanmode.passivescan = 0; - } - - chan->channumber = cfp->channel; - } - } - return chanidx; -} - -/* - * Add SSID TLV of the form: - * - * TLV-ID SSID 00 00 - * length 06 00 - * ssid 4d 4e 54 45 53 54 - */ -static int lbs_scan_add_ssid_tlv(struct lbs_private *priv, u8 *tlv) -{ - struct mrvlietypes_ssidparamset *ssid_tlv = (void *)tlv; - - ssid_tlv->header.type = cpu_to_le16(TLV_TYPE_SSID); - ssid_tlv->header.len = cpu_to_le16(priv->scan_ssid_len); - memcpy(ssid_tlv->ssid, priv->scan_ssid, priv->scan_ssid_len); - return sizeof(ssid_tlv->header) + priv->scan_ssid_len; -} - -/* - * Add CHANLIST TLV of the form - * - * TLV-ID CHANLIST 01 01 - * length 5b 00 - * channel 1 00 01 00 00 00 64 00 - * radio type 00 - * channel 01 - * scan type 00 - * min scan time 00 00 - * max scan time 64 00 - * channel 2 00 02 00 00 00 64 00 - * channel 3 00 03 00 00 00 64 00 - * channel 4 00 04 00 00 00 64 00 - * channel 5 00 05 00 00 00 64 00 - * channel 6 00 06 00 00 00 64 00 - * channel 7 00 07 00 00 00 64 00 - * channel 8 00 08 00 00 00 64 00 - * channel 9 00 09 00 00 00 64 00 - * channel 10 00 0a 00 00 00 64 00 - * channel 11 00 0b 00 00 00 64 00 - * channel 12 00 0c 00 00 00 64 00 - * channel 13 00 0d 00 00 00 64 00 - * - */ -static int lbs_scan_add_chanlist_tlv(uint8_t *tlv, - struct chanscanparamset *chan_list, - int chan_count) -{ - size_t size = sizeof(struct chanscanparamset) *chan_count; - struct mrvlietypes_chanlistparamset *chan_tlv = (void *)tlv; - - chan_tlv->header.type = cpu_to_le16(TLV_TYPE_CHANLIST); - memcpy(chan_tlv->chanscanparam, chan_list, size); - chan_tlv->header.len = cpu_to_le16(size); - return sizeof(chan_tlv->header) + size; -} - -/* - * Add RATES TLV of the form - * - * TLV-ID RATES 01 00 - * length 0e 00 - * rates 82 84 8b 96 0c 12 18 24 30 48 60 6c - * - * The rates are in lbs_bg_rates[], but for the 802.11b - * rates the high bit isn't set. - */ -static int lbs_scan_add_rates_tlv(uint8_t *tlv) -{ - int i; - struct mrvlietypes_ratesparamset *rate_tlv = (void *)tlv; - - rate_tlv->header.type = cpu_to_le16(TLV_TYPE_RATES); - tlv += sizeof(rate_tlv->header); - for (i = 0; i < MAX_RATES; i++) { - *tlv = lbs_bg_rates[i]; - if (*tlv == 0) - break; - /* This code makes sure that the 802.11b rates (1 MBit/s, 2 - MBit/s, 5.5 MBit/s and 11 MBit/s get's the high bit set. - Note that the values are MBit/s * 2, to mark them as - basic rates so that the firmware likes it better */ - if (*tlv == 0x02 || *tlv == 0x04 || - *tlv == 0x0b || *tlv == 0x16) - *tlv |= 0x80; - tlv++; - } - rate_tlv->header.len = cpu_to_le16(i); - return sizeof(rate_tlv->header) + i; -} - -/* - * Generate the CMD_802_11_SCAN command with the proper tlv - * for a bunch of channels. - */ -static int lbs_do_scan(struct lbs_private *priv, uint8_t bsstype, - struct chanscanparamset *chan_list, int chan_count) -{ - int ret = -ENOMEM; - struct cmd_ds_802_11_scan *scan_cmd; - uint8_t *tlv; /* pointer into our current, growing TLV storage area */ - - lbs_deb_enter_args(LBS_DEB_SCAN, "bsstype %d, chanlist[].chan %d, chan_count %d", - bsstype, chan_list ? chan_list[0].channumber : -1, - chan_count); - - /* create the fixed part for scan command */ - scan_cmd = kzalloc(MAX_SCAN_CFG_ALLOC, GFP_KERNEL); - if (scan_cmd == NULL) - goto out; - - tlv = scan_cmd->tlvbuffer; - /* TODO: do we need to scan for a specific BSSID? - memcpy(scan_cmd->bssid, priv->scan_bssid, ETH_ALEN); */ - scan_cmd->bsstype = bsstype; - - /* add TLVs */ - if (priv->scan_ssid_len) - tlv += lbs_scan_add_ssid_tlv(priv, tlv); - if (chan_list && chan_count) - tlv += lbs_scan_add_chanlist_tlv(tlv, chan_list, chan_count); - tlv += lbs_scan_add_rates_tlv(tlv); - - /* This is the final data we are about to send */ - scan_cmd->hdr.size = cpu_to_le16(tlv - (uint8_t *)scan_cmd); - lbs_deb_hex(LBS_DEB_SCAN, "SCAN_CMD", (void *)scan_cmd, - sizeof(*scan_cmd)); - lbs_deb_hex(LBS_DEB_SCAN, "SCAN_TLV", scan_cmd->tlvbuffer, - tlv - scan_cmd->tlvbuffer); - - ret = __lbs_cmd(priv, CMD_802_11_SCAN, &scan_cmd->hdr, - le16_to_cpu(scan_cmd->hdr.size), - lbs_ret_80211_scan, 0); - -out: - kfree(scan_cmd); - lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); - return ret; -} - -/** - * @brief Internal function used to start a scan based on an input config - * - * Use the input user scan configuration information when provided in - * order to send the appropriate scan commands to firmware to populate or - * update the internal driver scan table - * - * @param priv A pointer to struct lbs_private structure - * @param full_scan Do a full-scan (blocking) - * - * @return 0 or < 0 if error - */ -int lbs_scan_networks(struct lbs_private *priv, int full_scan) -{ - int ret = -ENOMEM; - struct chanscanparamset *chan_list; - struct chanscanparamset *curr_chans; - int chan_count; - uint8_t bsstype = CMD_BSS_TYPE_ANY; - int numchannels = MRVDRV_CHANNELS_PER_SCAN_CMD; - union iwreq_data wrqu; -#ifdef CONFIG_LIBERTAS_DEBUG - struct bss_descriptor *iter; - int i = 0; - DECLARE_SSID_BUF(ssid); -#endif - - lbs_deb_enter_args(LBS_DEB_SCAN, "full_scan %d", full_scan); - -#if (ANDROID_POWER_SAVE == 1) - - if (wifi_ps_status != WIFI_PS_AWAKE) - { - printk("Ignore this scan due to sleep.\n"); - memset(&wrqu, 0, sizeof(union iwreq_data)); - wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); - - priv->scan_channel = 0; - - return 0; - } -#endif - - /* Cancel any partial outstanding partial scans if this scan - * is a full scan. - */ - //if (full_scan && delayed_work_pending(&priv->scan_work)) - // cancel_delayed_work(&priv->scan_work); - - /* User-specified bsstype or channel list - TODO: this can be implemented if some user-space application - need the feature. Formerly, it was accessible from debugfs, - but then nowhere used. - if (user_cfg) { - if (user_cfg->bsstype) - bsstype = user_cfg->bsstype; - } */ - - lbs_deb_scan("numchannels %d, bsstype %d\n", numchannels, bsstype); - - /* Create list of channels to scan */ - chan_list = kzalloc(sizeof(struct chanscanparamset) * - LBS_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL); - if (!chan_list) { - lbs_pr_alert("SCAN: chan_list empty\n"); - goto out; - } - - /* We want to scan all channels */ - chan_count = lbs_scan_create_channel_list(priv, chan_list); - - netif_stop_queue(priv->dev); - netif_carrier_off(priv->dev); - - /* Prepare to continue an interrupted scan */ - lbs_deb_scan("chan_count %d, scan_channel %d\n", - chan_count, priv->scan_channel); - curr_chans = chan_list; - /* advance channel list by already-scanned-channels */ - if (priv->scan_channel > 0) { - curr_chans += priv->scan_channel; - chan_count -= priv->scan_channel; - } - - /* Send scan command(s) - * numchannels contains the number of channels we should maximally scan - * chan_count is the total number of channels to scan - */ - - while (chan_count) { - int to_scan = min(numchannels, chan_count); - lbs_deb_scan("scanning %d of %d channels\n", - to_scan, chan_count); - ret = lbs_do_scan(priv, bsstype, curr_chans, to_scan); - if (ret) { - lbs_pr_err("SCAN_CMD failed\n"); - goto out2; - } - curr_chans += to_scan; - chan_count -= to_scan; - - /* somehow schedule the next part of the scan */ - if (chan_count && !full_scan && - !priv->surpriseremoved) { - /* -1 marks just that we're currently scanning */ - if (priv->scan_channel < 0) - priv->scan_channel = to_scan; - else - priv->scan_channel += to_scan; - cancel_delayed_work(&priv->scan_work); - queue_delayed_work(priv->work_thread, &priv->scan_work, - msecs_to_jiffies(300)); - /* skip over GIWSCAN event */ - goto out; - } - - } - - memset(&wrqu, 0, sizeof(union iwreq_data)); - wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); - -//#if (NEW_MV8686_PS == 1) -#if 0 - if (full_scan == 1) - { - //printk("%s: broadcast scan complete:%lu.\n", __func__, jiffies); - priv->scan_result_timeout = jiffies + msecs_to_jiffies(8000); - } -#endif - -#if 0 -#ifdef CONFIG_LIBERTAS_DEBUG - /* Dump the scan table */ - mutex_lock(&priv->lock); - lbs_deb_scan("scan table:\n"); - list_for_each_entry(iter, &priv->network_list, list) - lbs_deb_scan("%02d: BSSID %pM, RSSI %d, SSID '%s'\n", - i++, iter->bssid, iter->rssi, - mv8686_print_ssid(ssid, iter->ssid, iter->ssid_len)); - mutex_unlock(&priv->lock); -#endif -#endif - -out2: - priv->scan_channel = 0; - -out: - if (priv->connect_status == LBS_CONNECTED) { - netif_carrier_on(priv->dev); - if (!priv->tx_pending_len) - netif_wake_queue(priv->dev); - } - kfree(chan_list); - - lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); - return ret; -} - -int scan_status = 0; - -void lbs_scan_worker(struct work_struct *work) -{ - struct lbs_private *priv = - container_of(work, struct lbs_private, scan_work.work); - - if (scan_status == 1) - { - printk("Scan worker is busy!!!!!!!!!!\n"); - return; - } - - lbs_deb_enter(LBS_DEB_SCAN); - scan_status = 1; - lbs_scan_networks(priv, 1); - scan_status = 0; - lbs_deb_leave(LBS_DEB_SCAN); -} - - -/*********************************************************************/ -/* */ -/* Result interpretation */ -/* */ -/*********************************************************************/ - -/** - * @brief Interpret a BSS scan response returned from the firmware - * - * Parse the various fixed fields and IEs passed back for a a BSS probe - * response or beacon from the scan command. Record information as needed - * in the scan table struct bss_descriptor for that entry. - * - * @param bss Output parameter: Pointer to the BSS Entry - * - * @return 0 or -1 - */ -static int lbs_process_bss(struct bss_descriptor *bss, - uint8_t **pbeaconinfo, int *bytesleft) -{ - struct ieeetypes_fhparamset *pFH; - struct ieeetypes_dsparamset *pDS; - struct ieeetypes_cfparamset *pCF; - struct ieeetypes_ibssparamset *pibss; - DECLARE_SSID_BUF(ssid); - struct ieeetypes_countryinfoset *pcountryinfo; - uint8_t *pos, *end, *p; - uint8_t n_ex_rates = 0, got_basic_rates = 0, n_basic_rates = 0; - uint16_t beaconsize = 0; - int ret; - - lbs_deb_enter(LBS_DEB_SCAN); - - if (*bytesleft >= sizeof(beaconsize)) { - /* Extract & convert beacon size from the command buffer */ - beaconsize = le16_to_cpu(get_unaligned((__le16 *)*pbeaconinfo)); //get_unaligned_le16(*pbeaconinfo) - *bytesleft -= sizeof(beaconsize); - *pbeaconinfo += sizeof(beaconsize); - } - - if (beaconsize == 0 || beaconsize > *bytesleft) { - *pbeaconinfo += *bytesleft; - *bytesleft = 0; - ret = -1; - goto done; - } - - /* Initialize the current working beacon pointer for this BSS iteration */ - pos = *pbeaconinfo; - end = pos + beaconsize; - - /* Advance the return beacon pointer past the current beacon */ - *pbeaconinfo += beaconsize; - *bytesleft -= beaconsize; - - memcpy(bss->bssid, pos, ETH_ALEN); - lbs_deb_scan("process_bss: BSSID %pM\n", bss->bssid); - pos += ETH_ALEN; - - if ((end - pos) < 12) { - lbs_deb_scan("process_bss: Not enough bytes left\n"); - ret = -1; - goto done; - } - - /* - * next 4 fields are RSSI, time stamp, beacon interval, - * and capability information - */ - - /* RSSI is 1 byte long */ - bss->rssi = *pos; - lbs_deb_scan("process_bss: RSSI %d\n", *pos); - pos++; - - /* time stamp is 8 bytes long */ - pos += 8; - - /* beacon interval is 2 bytes long */ - bss->beaconperiod = le16_to_cpup((void *) pos);//get_unaligned_le16(pos); - pos += 2; - - /* capability information is 2 bytes long */ - bss->capability = le16_to_cpup((void *) pos);//get_unaligned_le16(pos); - lbs_deb_scan("process_bss: capabilities 0x%04x\n", bss->capability); - pos += 2; - - if (bss->capability & WLAN_CAPABILITY_PRIVACY) - lbs_deb_scan("process_bss: WEP enabled\n"); - if (bss->capability & WLAN_CAPABILITY_IBSS) - bss->mode = IW_MODE_ADHOC; - else - bss->mode = IW_MODE_INFRA; - - /* rest of the current buffer are IE's */ - lbs_deb_scan("process_bss: IE len %zd\n", end - pos); - lbs_deb_hex(LBS_DEB_SCAN, "process_bss: IE info", pos, end - pos); - - /* process variable IE */ - while (pos <= end - 2) { - if (pos + pos[1] > end) { - lbs_deb_scan("process_bss: error in processing IE, " - "bytes left < IE length\n"); - break; - } - - switch (pos[0]) { - case WLAN_EID_SSID: - bss->ssid_len = min_t(int, IEEE80211_MAX_SSID_LEN, pos[1]); - memcpy(bss->ssid, pos + 2, bss->ssid_len); - lbs_deb_scan("got SSID IE: '%s', len %u\n", - mv8686_print_ssid(ssid, bss->ssid, bss->ssid_len), - bss->ssid_len); - break; - - case WLAN_EID_SUPP_RATES: - n_basic_rates = min_t(uint8_t, MAX_RATES, pos[1]); - memcpy(bss->rates, pos + 2, n_basic_rates); - got_basic_rates = 1; - lbs_deb_scan("got RATES IE\n"); - break; - - case WLAN_EID_FH_PARAMS: - pFH = (struct ieeetypes_fhparamset *) pos; - memmove(&bss->phyparamset.fhparamset, pFH, - sizeof(struct ieeetypes_fhparamset)); - lbs_deb_scan("got FH IE\n"); - break; - - case WLAN_EID_DS_PARAMS: - pDS = (struct ieeetypes_dsparamset *) pos; - bss->channel = pDS->currentchan; - memcpy(&bss->phyparamset.dsparamset, pDS, - sizeof(struct ieeetypes_dsparamset)); - lbs_deb_scan("got DS IE, channel %d\n", bss->channel); - break; - - case WLAN_EID_CF_PARAMS: - pCF = (struct ieeetypes_cfparamset *) pos; - memcpy(&bss->ssparamset.cfparamset, pCF, - sizeof(struct ieeetypes_cfparamset)); - lbs_deb_scan("got CF IE\n"); - break; - - case WLAN_EID_IBSS_PARAMS: - pibss = (struct ieeetypes_ibssparamset *) pos; - bss->atimwindow = le16_to_cpu(pibss->atimwindow); - memmove(&bss->ssparamset.ibssparamset, pibss, - sizeof(struct ieeetypes_ibssparamset)); - lbs_deb_scan("got IBSS IE\n"); - break; - - case WLAN_EID_COUNTRY: - pcountryinfo = (struct ieeetypes_countryinfoset *) pos; - lbs_deb_scan("got COUNTRY IE\n"); - if (pcountryinfo->len < sizeof(pcountryinfo->countrycode) - || pcountryinfo->len > 254) { - lbs_deb_scan("process_bss: 11D- Err CountryInfo len %d, min %zd, max 254\n", - pcountryinfo->len, sizeof(pcountryinfo->countrycode)); - ret = -1; - goto done; - } - - memcpy(&bss->countryinfo, pcountryinfo, pcountryinfo->len + 2); - lbs_deb_hex(LBS_DEB_SCAN, "process_bss: 11d countryinfo", - (uint8_t *) pcountryinfo, - (int) (pcountryinfo->len + 2)); - break; - - case WLAN_EID_EXT_SUPP_RATES: - /* only process extended supported rate if data rate is - * already found. Data rate IE should come before - * extended supported rate IE - */ - lbs_deb_scan("got RATESEX IE\n"); - if (!got_basic_rates) { - lbs_deb_scan("... but ignoring it\n"); - break; - } - - n_ex_rates = pos[1]; - if (n_basic_rates + n_ex_rates > MAX_RATES) - n_ex_rates = MAX_RATES - n_basic_rates; - - p = bss->rates + n_basic_rates; - memcpy(p, pos + 2, n_ex_rates); - break; - - case WLAN_EID_GENERIC: - if (pos[1] >= 4 && - pos[2] == 0x00 && pos[3] == 0x50 && - pos[4] == 0xf2 && pos[5] == 0x01) { - bss->wpa_ie_len = min(pos[1] + 2, MAX_WPA_IE_LEN); - memcpy(bss->wpa_ie, pos, bss->wpa_ie_len); - lbs_deb_scan("got WPA IE\n"); - lbs_deb_hex(LBS_DEB_SCAN, "WPA IE", bss->wpa_ie, - bss->wpa_ie_len); - } else { - lbs_deb_scan("got generic IE: %02x:%02x:%02x:%02x, len %d\n", - pos[2], pos[3], - pos[4], pos[5], - pos[1]); - } - break; - - case WLAN_EID_RSN: - lbs_deb_scan("got RSN IE\n"); - bss->rsn_ie_len = min(pos[1] + 2, MAX_WPA_IE_LEN); - memcpy(bss->rsn_ie, pos, bss->rsn_ie_len); - lbs_deb_hex(LBS_DEB_SCAN, "process_bss: RSN_IE", - bss->rsn_ie, bss->rsn_ie_len); - break; - - default: - lbs_deb_scan("got IE 0x%04x, len %d\n", - pos[0], pos[1]); - break; - } - - pos += pos[1] + 2; - } - - /* Timestamp */ - bss->last_scanned = jiffies; - lbs_unset_basic_rate_flags(bss->rates, sizeof(bss->rates)); - - ret = 0; - -done: - lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); - return ret; -} - -/** - * @brief Send a scan command for all available channels filtered on a spec - * - * Used in association code and from debugfs - * - * @param priv A pointer to struct lbs_private structure - * @param ssid A pointer to the SSID to scan for - * @param ssid_len Length of the SSID - * - * @return 0-success, otherwise fail - */ -int lbs_send_specific_ssid_scan(struct lbs_private *priv, uint8_t *ssid, - uint8_t ssid_len) -{ - DECLARE_SSID_BUF(ssid_buf); - int ret = 0; - - lbs_deb_enter_args(LBS_DEB_SCAN, "SSID '%s'\n", - mv8686_print_ssid(ssid_buf, ssid, ssid_len)); - - if (!ssid_len) - goto out; - - memcpy(priv->scan_ssid, ssid, ssid_len); - priv->scan_ssid_len = ssid_len; - - lbs_scan_networks(priv, 1); - if (priv->surpriseremoved) { - ret = -1; - goto out; - } - -out: - lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); - return ret; -} - - - - -/*********************************************************************/ -/* */ -/* Support for Wireless Extensions */ -/* */ -/*********************************************************************/ - - -#define MAX_CUSTOM_LEN 64 - -static inline char *lbs_translate_scan(struct lbs_private *priv, - struct iw_request_info *info, - char *start, char *stop, - struct bss_descriptor *bss) -{ - struct chan_freq_power *cfp; - char *current_val; /* For rates */ - struct iw_event iwe; /* Temporary buffer */ - int j; -#define PERFECT_RSSI ((uint8_t)50) -#define WORST_RSSI ((uint8_t)0) -#define RSSI_DIFF ((uint8_t)(PERFECT_RSSI - WORST_RSSI)) - uint8_t rssi; - - lbs_deb_enter(LBS_DEB_SCAN); - - cfp = lbs_find_cfp_by_band_and_channel(priv, 0, bss->channel); - if (!cfp) { - lbs_deb_scan("Invalid channel number %d\n", bss->channel); - start = NULL; - goto out; - } - - /* First entry *MUST* be the BSSID */ - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, &bss->bssid, ETH_ALEN); - start = iwe_stream_add_event( -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) - info, -#endif - start, stop, &iwe, IW_EV_ADDR_LEN); - - /* SSID */ - iwe.cmd = SIOCGIWESSID; - iwe.u.data.flags = 1; - iwe.u.data.length = min((uint32_t) bss->ssid_len, (uint32_t) IW_ESSID_MAX_SIZE); - start = iwe_stream_add_point( -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) - info, -#endif - start, stop, &iwe, bss->ssid); - - /* Mode */ - iwe.cmd = SIOCGIWMODE; - iwe.u.mode = bss->mode; - start = iwe_stream_add_event( -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) - info, -#endif - start, stop, &iwe, IW_EV_UINT_LEN); - - /* Frequency */ - iwe.cmd = SIOCGIWFREQ; - iwe.u.freq.m = (long)cfp->freq * 100000; - iwe.u.freq.e = 1; - start = iwe_stream_add_event( -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) - info, -#endif - start, stop, &iwe, IW_EV_FREQ_LEN); - - /* Add quality statistics */ - iwe.cmd = IWEVQUAL; - iwe.u.qual.updated = IW_QUAL_ALL_UPDATED; - iwe.u.qual.level = SCAN_RSSI(bss->rssi); - - rssi = iwe.u.qual.level - MRVDRV_NF_DEFAULT_SCAN_VALUE; - iwe.u.qual.qual = - (100 * RSSI_DIFF * RSSI_DIFF - (PERFECT_RSSI - rssi) * - (15 * (RSSI_DIFF) + 62 * (PERFECT_RSSI - rssi))) / - (RSSI_DIFF * RSSI_DIFF); - if (iwe.u.qual.qual > 100) - iwe.u.qual.qual = 100; - - if (priv->NF[TYPE_BEACON][TYPE_NOAVG] == 0) { - iwe.u.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE; - } else { - iwe.u.qual.noise = CAL_NF(priv->NF[TYPE_BEACON][TYPE_NOAVG]); - } - -#if (MV8686_SUPPORT_ADHOC == 1) - /* Locally created ad-hoc BSSs won't have beacons if this is the - * only station in the adhoc network; so get signal strength - * from receive statistics. - */ - if ((priv->mode == IW_MODE_ADHOC) && priv->adhoccreate - && !lbs_ssid_cmp(priv->curbssparams.ssid, - priv->curbssparams.ssid_len, - bss->ssid, bss->ssid_len)) { - int snr, nf; - snr = priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; - nf = priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; - iwe.u.qual.level = CAL_RSSI(snr, nf); - } -#endif - - start = iwe_stream_add_event( -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) - info, -#endif - start, stop, &iwe, IW_EV_QUAL_LEN); - - /* Add encryption capability */ - iwe.cmd = SIOCGIWENCODE; - if (bss->capability & WLAN_CAPABILITY_PRIVACY) { - iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - } else { - iwe.u.data.flags = IW_ENCODE_DISABLED; - } - iwe.u.data.length = 0; - start = iwe_stream_add_point( -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) - info, -#endif - start, stop, &iwe, bss->ssid); - - current_val = start + IW_EV_LCP_LEN;//iwe_stream_lcp_len(info); - - iwe.cmd = SIOCGIWRATE; - iwe.u.bitrate.fixed = 0; - iwe.u.bitrate.disabled = 0; - iwe.u.bitrate.value = 0; - - for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) { - /* Bit rate given in 500 kb/s units */ - iwe.u.bitrate.value = bss->rates[j] * 500000; - current_val = iwe_stream_add_value( -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) - info, -#endif - start, current_val, stop, &iwe, IW_EV_PARAM_LEN); - } -#if (MV8686_SUPPORT_ADHOC == 1) - if ((bss->mode == IW_MODE_ADHOC) && priv->adhoccreate - && !lbs_ssid_cmp(priv->curbssparams.ssid, - priv->curbssparams.ssid_len, - bss->ssid, bss->ssid_len)) { - iwe.u.bitrate.value = 22 * 500000; - current_val = iwe_stream_add_value( -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) - info, -#endif - start, current_val, stop, &iwe, IW_EV_PARAM_LEN); - } -#endif - - /* Check if we added any event */ - if ((current_val - start) > IW_EV_LCP_LEN)//iwe_stream_lcp_len(info)) - start = current_val; - - memset(&iwe, 0, sizeof(iwe)); - if (bss->wpa_ie_len) { - char buf[MAX_WPA_IE_LEN]; - memcpy(buf, bss->wpa_ie, bss->wpa_ie_len); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = bss->wpa_ie_len; - start = iwe_stream_add_point( -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) - info, -#endif - start, stop, &iwe, buf); - } - - memset(&iwe, 0, sizeof(iwe)); - if (bss->rsn_ie_len) { - char buf[MAX_WPA_IE_LEN]; - memcpy(buf, bss->rsn_ie, bss->rsn_ie_len); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = bss->rsn_ie_len; - start = iwe_stream_add_point( -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) - info, -#endif - start, stop, &iwe, buf); - } - -out: - lbs_deb_leave_args(LBS_DEB_SCAN, "start %p", start); - return start; -} - - -/** - * @brief Handle Scan Network ioctl - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * - * @return 0 --success, otherwise fail - */ - -extern int wifi_ps_status; - -void lbs_dump_scan_req_queue(struct lbs_private *priv) -{ - int i = 0; - struct lbs_scan_req *req; - - printk("Dumping scan request queue:\n"); - list_for_each_entry (req, &priv->scan_req_list, list) - { - printk("[%2d] ssid_len: %2d ssid: %s\n", i++, - req->ssid_len, req->ssid_len ? req->ssid : " "); - } -} - -int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - DECLARE_SSID_BUF(ssid); - DECLARE_SSID_BUF(scan_ssid); - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - int ret = 0, scan_ssid_len = 0, needtoqueue = 1; -#if (ANDROID_POWER_SAVE == 1) - union iwreq_data rwrqu; -#endif - struct lbs_scan_req *scan_req; - - lbs_deb_enter(LBS_DEB_WEXT); - - //printk("%s: Scan request from application.\n", __func__); - - if (priv->surpriseremoved) - { - printk("Warning: priv->surpriseremoved\n"); - return -EIO; - } - -#if (ANDROID_POWER_SAVE == 1) - - if (wifi_ps_status != WIFI_PS_AWAKE) - { - printk("set_scan: Ignore this scan due to deep sleep.\n"); - memset(&rwrqu, 0, sizeof(union iwreq_data)); - wireless_send_event(priv->dev, SIOCGIWSCAN, &rwrqu, NULL); - - if ((wifi_ps_status == WIFI_PS_DRV_SLEEP) && - (priv->wifi_ps_work_req == 0)) - { - printk("Wakeup wifi for scan.\n"); - priv->wifi_ps_work_req = WIFI_PS_PRE_WAKE; - netif_stop_queue(priv->dev); - netif_carrier_off(priv->dev); - queue_delayed_work(priv->work_thread, &priv->ps_work, - msecs_to_jiffies(5)); - } - return 0; - } - else - { - lbs_update_ps_timer(); - } -#endif - - if (!priv->radio_on) { - printk("set_scan: radio is off.\n"); - ret = -EINVAL; - goto out; - } - - if (wrqu->data.length == sizeof(struct iw_scan_req) && - wrqu->data.flags & IW_SCAN_THIS_ESSID) - { - struct iw_scan_req *req = (struct iw_scan_req *)extra; - - scan_ssid_len = req->essid_len; - memcpy(scan_ssid, req->essid, scan_ssid_len); - } - else - { - scan_ssid_len = 0; - memset(scan_ssid, 0, sizeof(scan_ssid)); -//#if (NEW_MV8686_PS == 1) -#if 0 - //if ((priv->scan_result_timeout > 0) && - // time_before(jiffies, priv->scan_result_timeout)) - if (priv->scan_result_timeout > 0) - { - union iwreq_data rwrqu; - - //printk("The previous scan result is fresh still.\n"); - //printk("jiffies=%lu timeout=%lu\n", jiffies, priv->scan_result_timeout); - - memset(&rwrqu, 0, sizeof(union iwreq_data)); - wireless_send_event(priv->dev, SIOCGIWSCAN, &rwrqu, NULL); - } -#endif - } - - /* - * Check if there is a same item. - */ - list_for_each_entry (scan_req, &priv->scan_req_list, list) - { - if (scan_ssid_len == scan_req->ssid_len) - { - //printk("Length is equal, ssid: %s\n", scan_ssid); - if ((scan_ssid_len == 0) || - (memcmp(scan_ssid, scan_req->ssid, scan_ssid_len) == 0)) - { - needtoqueue = 0; - //printk("Ignore this scan request due to duplicate item.\n"); - break; - } - } - } - - - if ((needtoqueue == 1) && !list_empty(&(priv->scan_req_free_list))) - { - /* Queue the scan request */ - scan_req = list_entry(priv->scan_req_free_list.next, struct lbs_scan_req, list); - scan_req->ssid_len = scan_ssid_len; - memcpy(scan_req->ssid, scan_ssid, scan_ssid_len); - scan_req->ssid[scan_ssid_len] = 0; - - list_move_tail(&scan_req->list, &priv->scan_req_list); - } - //else - // printk("Ignore this request due to queue maybe full.\n"); - - //lbs_dump_scan_req_queue(priv); - - if (!delayed_work_pending(&priv->scan_work) && - !list_empty(&(priv->scan_req_list)) && (scan_status == 0)) - { - /* De-queue the first scan request */ - //printk("De-queue scan request>>>>> scan_status=%d\n", scan_status); - scan_req = list_entry(priv->scan_req_list.next, struct lbs_scan_req, list); - list_move_tail(&scan_req->list, &priv->scan_req_free_list); - - priv->scan_ssid_len = scan_req->ssid_len; - strcpy(priv->scan_ssid, scan_req->ssid); - - queue_delayed_work(priv->work_thread, &priv->scan_work, msecs_to_jiffies(5)); - /* set marker that currently a scan is taking place */ - priv->scan_channel = -1; - } - - //lbs_dump_scan_req_queue(priv); - -out: - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - - -/** - * @brief Handle Retrieve scan table ioctl - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param dwrq A pointer to iw_point structure - * @param extra A pointer to extra data buf - * - * @return 0 --success, otherwise fail - */ -int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ -#define SCAN_ITEM_SIZE 128 - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - int err = 0; - char *ev = extra; - char *stop = ev + dwrq->length; - struct bss_descriptor *iter_bss; - struct bss_descriptor *safe; - - lbs_deb_enter(LBS_DEB_WEXT); - - if (priv->surpriseremoved) - return -EIO; - -#if (NEW_MV8686_PS == 0) - /* iwlist should wait until the current scan is finished */ - if (priv->scan_channel) - { - //printk("Scanning, please try again.\n"); - return -EAGAIN; - } -#endif - -#if (MV8686_SUPPORT_ADHOC == 1) - /* Update RSSI if current BSS is a locally created ad-hoc BSS */ - if ((priv->mode == IW_MODE_ADHOC) && priv->adhoccreate) - lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, - CMD_OPTION_WAITFORRSP, 0, NULL); -#endif - - mutex_lock(&priv->lock); - list_for_each_entry_safe (iter_bss, safe, &priv->network_list, list) - { - char *next_ev; - unsigned long stale_time; - - if (stop - ev < SCAN_ITEM_SIZE) { - err = -E2BIG; - break; - } - - /* Prune old an old scan result */ - stale_time = iter_bss->last_scanned + DEFAULT_MAX_SCAN_AGE; - if (time_after(jiffies, stale_time)) { - list_move_tail(&iter_bss->list, &priv->network_free_list); - clear_bss_descriptor(iter_bss); - continue; - } - - /* Translate to WE format this entry */ - next_ev = lbs_translate_scan(priv, info, ev, stop, iter_bss); - if (next_ev == NULL) - continue; - ev = next_ev; - } - mutex_unlock(&priv->lock); - - dwrq->length = (ev - extra); - dwrq->flags = 0; - - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", err); - return err; -} - -/*********************************************************************/ -/* */ -/* Command execution */ -/* */ -/*********************************************************************/ - -/** - * @brief This function handles the command response of scan - * - * Called from handle_cmd_response() in cmdrespc. - * - * The response buffer for the scan command has the following - * memory layout: - * - * .-----------------------------------------------------------. - * | header (4 * sizeof(u16)): Standard command response hdr | - * .-----------------------------------------------------------. - * | bufsize (u16) : sizeof the BSS Description data | - * .-----------------------------------------------------------. - * | NumOfSet (u8) : Number of BSS Descs returned | - * .-----------------------------------------------------------. - * | BSSDescription data (variable, size given in bufsize) | - * .-----------------------------------------------------------. - * | TLV data (variable, size calculated using header->size, | - * | bufsize and sizeof the fixed fields above) | - * .-----------------------------------------------------------. - * - * @param priv A pointer to struct lbs_private structure - * @param resp A pointer to cmd_ds_command - * - * @return 0 or -1 - */ -static int lbs_ret_80211_scan(struct lbs_private *priv, unsigned long dummy, - struct cmd_header *resp) -{ - struct cmd_ds_802_11_scan_rsp *scanresp = (void *)resp; - struct bss_descriptor *iter_bss; - struct bss_descriptor *safe; - uint8_t *bssinfo; - uint16_t scanrespsize; - int bytesleft; - int idx; - int tlvbufsize; - int ret; - - lbs_deb_enter(LBS_DEB_SCAN); - - if (priv->surpriseremoved) - ret = -EIO; - - //printk("Got scanned AP number: %d\n", scanresp->nr_sets); - - if (scanresp->nr_sets <= 0) - { - //printk("0 AP was found.\n"); - return 0; - } - -#if 0 - printk("Iterating network_list: \n"); - list_for_each_entry (iter_bss, &priv->network_list, list) { - unsigned long stale_time = iter_bss->last_scanned + 10 * DEFAULT_MAX_SCAN_AGE; - printk(" SSID: %15s BSSID: %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x ", - iter_bss->ssid, - iter_bss->bssid[0], iter_bss->bssid[1], iter_bss->bssid[2], - iter_bss->bssid[3], iter_bss->bssid[4], iter_bss->bssid[5]); - if (time_before(jiffies, stale_time)) - printk("Not timeout\n"); - else - printk("Timeout\n"); - } -#endif - /* Prune old entries from scan table */ - list_for_each_entry_safe (iter_bss, safe, &priv->network_list, list) - { - unsigned long stale_time = iter_bss->last_scanned + DEFAULT_MAX_SCAN_AGE; - if (time_before(jiffies, stale_time)) - continue; - list_move_tail (&iter_bss->list, &priv->network_free_list); - clear_bss_descriptor(iter_bss); - } -#if 0 - printk("Iterating network_free_list: \n"); - list_for_each_entry (iter_bss, &priv->network_free_list, list) { - if (strlen(iter_bss->ssid) <= 0) - continue; - printk(" SSID: %15s BSSID: %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x ", - iter_bss->ssid, - iter_bss->bssid[0], iter_bss->bssid[1], iter_bss->bssid[2], - iter_bss->bssid[3], iter_bss->bssid[4], iter_bss->bssid[5]); - printk("Timeout\n"); - } -#endif - if (scanresp->nr_sets > MAX_NETWORK_COUNT) { - lbs_deb_scan("SCAN_RESP: too many scan results (%d, max %d)\n", - scanresp->nr_sets, MAX_NETWORK_COUNT); - ret = -1; - goto done; - } - - bytesleft = le16_to_cpu(scanresp->bssdescriptsize); - lbs_deb_scan("SCAN_RESP: bssdescriptsize %d\n", bytesleft); - - scanrespsize = le16_to_cpu(resp->size); - lbs_deb_scan("SCAN_RESP: scan results %d\n", scanresp->nr_sets); - - bssinfo = scanresp->bssdesc_and_tlvbuffer; - - /* The size of the TLV buffer is equal to the entire command response - * size (scanrespsize) minus the fixed fields (sizeof()'s), the - * BSS Descriptions (bssdescriptsize as bytesLef) and the command - * response header (S_DS_GEN) - */ - tlvbufsize = scanrespsize - (bytesleft + sizeof(scanresp->bssdescriptsize) - + sizeof(scanresp->nr_sets) - + S_DS_GEN); - - /* - * Process each scan response returned (scanresp->nr_sets). Save - * the information in the newbssentry and then insert into the - * driver scan table either as an update to an existing entry - * or as an addition at the end of the table - */ - //printk("Dump scanned SSIDs: num=%d\n", scanresp->nr_sets); - for (idx = 0; idx < scanresp->nr_sets && bytesleft; idx++) - { - struct bss_descriptor new; - struct bss_descriptor *found = NULL; - struct bss_descriptor *oldest = NULL; - - /* Process the data fields and IEs returned for this BSS */ - memset(&new, 0, sizeof (struct bss_descriptor)); - if (lbs_process_bss(&new, &bssinfo, &bytesleft) != 0) { - /* error parsing the scan response, skipped */ - lbs_deb_scan("SCAN_RESP: process_bss returned ERROR\n"); - continue; - } - //printk(" Found SSID: %15s BSSID: %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n", - // new.ssid, - // new.bssid[0], new.bssid[1], new.bssid[2], - // new.bssid[3], new.bssid[4], new.bssid[5]); - if (strlen(new.ssid) <= 0) - continue; - - /* Try to find this bss in the scan table */ - list_for_each_entry (iter_bss, &priv->network_list, list) { - if (is_same_network(iter_bss, &new)) { - found = iter_bss; - break; - } - - if ((oldest == NULL) || - (iter_bss->last_scanned < oldest->last_scanned)) - oldest = iter_bss; - } - - if (found) { - /* found, clear it */ - clear_bss_descriptor(found); - } else if (!list_empty(&priv->network_free_list)) { - /* Pull one from the free list */ - found = list_entry(priv->network_free_list.next, - struct bss_descriptor, list); - list_move_tail(&found->list, &priv->network_list); - } else if (oldest) { - /* If there are no more slots, expire the oldest */ - found = oldest; - clear_bss_descriptor(found); - list_move_tail(&found->list, &priv->network_list); - } else { - continue; - } - - lbs_deb_scan("SCAN_RESP: BSSID %pM\n", new.bssid); - - /* Copy the locally created newbssentry to the scan table */ - memcpy(found, &new, offsetof(struct bss_descriptor, list)); - } - -#if 0 - if (priv->scan_result_timeout == 0) - { - union iwreq_data rwrqu; - - memset(&rwrqu, 0, sizeof(union iwreq_data)); - wireless_send_event(priv->dev, SIOCGIWSCAN, &rwrqu, NULL); - } -#endif - - ret = 0; - -done: - lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); - return ret; -} diff --git a/drivers/net/wireless/mv8686/scan.h b/drivers/net/wireless/mv8686/scan.h deleted file mode 100755 index fab7d5d097fc..000000000000 --- a/drivers/net/wireless/mv8686/scan.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Interface for the wlan network scan routines - * - * Driver interface functions and type declarations for the scan module - * implemented in scan.c. - */ -#ifndef _LBS_SCAN_H -#define _LBS_SCAN_H - -#include - -#define MAX_NETWORK_COUNT 128 - -/** - * @brief Maximum number of channels that can be sent in a setuserscan ioctl - */ -#define LBS_IOCTL_USER_SCAN_CHAN_MAX 50 - -int lbs_ssid_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len); - -int lbs_send_specific_ssid_scan(struct lbs_private *priv, u8 *ssid, - u8 ssid_len); - -int lbs_get_scan(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra); -int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); - -int lbs_scan_networks(struct lbs_private *priv, int full_scan); - -void lbs_scan_worker(struct work_struct *work); - -#endif diff --git a/drivers/net/wireless/mv8686/tx.c b/drivers/net/wireless/mv8686/tx.c deleted file mode 100755 index 8f8ab141e085..000000000000 --- a/drivers/net/wireless/mv8686/tx.c +++ /dev/null @@ -1,179 +0,0 @@ -/** - * This file contains the handling of TX in wlan driver. - */ -#include -#include - -#include "hostcmd.h" -#include "radiotap.h" -#include "decl.h" -#include "defs.h" -#include "dev.h" -#include "wext.h" - -/** - * @brief This function checks the conditions and sends packet to IF - * layer if everything is ok. - * - * @param priv A pointer to struct lbs_private structure - * @param skb A pointer to skb which includes TX packet - * @return 0 or -1 - */ -#if (NEW_MV8686_PS == 1) -extern unsigned long wifi_iptx_packets; -#endif - -int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) -{ - unsigned long flags; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - struct txpd *txpd; - char *p802x_hdr; - uint16_t pkt_len; - int ret; - - lbs_deb_enter(LBS_DEB_TX); - -#if (ANDROID_POWER_SAVE == 1) - - if (priv->deepsleep == false) - lbs_update_ps_timer(); - else - { - if (priv->wifi_ps_work_req == 0) - { - printk("Need to wakeup for xmit: ether_proto=%x.\n", skb->protocol); - priv->wifi_ps_work_req = WIFI_PS_PRE_WAKE; - /* - * If no netif_carrier_off, upper layer will try again, - * and this may cause tx timeout and trigger watchdog. - */ - netif_stop_queue(priv->dev); - netif_carrier_off(priv->dev); - queue_delayed_work(priv->work_thread, &priv->ps_work, - msecs_to_jiffies(5)); - } - return NETDEV_TX_BUSY; - } -#endif - - ret = NETDEV_TX_OK; - - /* We need to protect against the queues being restarted before - we get round to stopping them */ - spin_lock_irqsave(&priv->driver_lock, flags); - - if (priv->surpriseremoved) - goto free; - - if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { - lbs_deb_tx("tx err: skb length %d 0 or > %zd\n", - skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); - /* We'll never manage to send this one; drop it and return 'OK' */ - - dev->stats.tx_dropped++; - dev->stats.tx_errors++; - goto free; - } - - - netif_stop_queue(priv->dev); - - if (priv->tx_pending_len) { - /* This can happen if packets come in on the mesh and eth - device simultaneously -- there's no mutual exclusion on - hard_start_xmit() calls between devices. */ - lbs_deb_tx("Packet on %s while busy\n", dev->name); - ret = NETDEV_TX_BUSY; - goto unlock; - } - - priv->tx_pending_len = -1; - spin_unlock_irqrestore(&priv->driver_lock, flags); - - lbs_deb_hex(LBS_DEB_TX, "TX Data", skb->data, min_t(unsigned int, skb->len, 100)); - - txpd = (void *)priv->tx_pending_buf; - memset(txpd, 0, sizeof(struct txpd)); - - p802x_hdr = skb->data; - pkt_len = skb->len; - - /* copy destination address from 802.3 header */ - memcpy(txpd->tx_dest_addr_high, p802x_hdr, ETH_ALEN); - - txpd->tx_packet_length = cpu_to_le16(pkt_len); - txpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd)); - - lbs_deb_hex(LBS_DEB_TX, "txpd", (u8 *) &txpd, sizeof(struct txpd)); - - lbs_deb_hex(LBS_DEB_TX, "Tx Data", (u8 *) p802x_hdr, le16_to_cpu(txpd->tx_packet_length)); - - memcpy(&txpd[1], p802x_hdr, le16_to_cpu(txpd->tx_packet_length)); - - spin_lock_irqsave(&priv->driver_lock, flags); - priv->tx_pending_len = pkt_len + sizeof(struct txpd); - - lbs_deb_tx("%s lined up packet\n", __func__); - -#if (NEW_MV8686_PS == 1) - if (skb->protocol == 0x0008) //ETH_P_IP - wifi_iptx_packets++; - //else - // printk("Send a not IP packet: %x\n", skb->protocol); -#endif - - dev->stats.tx_packets++; - dev->stats.tx_bytes += skb->len; - - dev->trans_start = jiffies; - - if (priv->monitormode) { - /* Keep the skb to echo it back once Tx feedback is - received from FW */ - skb_orphan(skb); - - /* Keep the skb around for when we get feedback */ - priv->currenttxskb = skb; - } else { - free: - dev_kfree_skb_any(skb); - } - unlock: - spin_unlock_irqrestore(&priv->driver_lock, flags); - wake_up(&priv->waitq); - - lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret); - return ret; -} - -/** - * @brief This function sends to the host the last transmitted packet, - * filling the radiotap headers with transmission information. - * - * @param priv A pointer to struct lbs_private structure - * @param status A 32 bit value containing transmission status. - * - * @returns void - */ -void lbs_send_tx_feedback(struct lbs_private *priv, u32 try_count) -{ - struct tx_radiotap_hdr *radiotap_hdr; - - if (!priv->monitormode || priv->currenttxskb == NULL) - return; - - radiotap_hdr = (struct tx_radiotap_hdr *)priv->currenttxskb->data; - - radiotap_hdr->data_retries = try_count ? - (1 + priv->txretrycount - try_count) : 0; - - netif_rx(priv->currenttxskb); - - priv->currenttxskb = NULL; - - if (priv->connect_status == LBS_CONNECTED) - netif_wake_queue(priv->dev); - -} -EXPORT_SYMBOL_GPL(lbs_send_tx_feedback); diff --git a/drivers/net/wireless/mv8686/types.h b/drivers/net/wireless/mv8686/types.h deleted file mode 100755 index fb7a2d1a2525..000000000000 --- a/drivers/net/wireless/mv8686/types.h +++ /dev/null @@ -1,284 +0,0 @@ -/** - * This header file contains definition for global types - */ -#ifndef _LBS_TYPES_H_ -#define _LBS_TYPES_H_ - -#include -#include -#include - -struct ieeetypes_cfparamset { - u8 elementid; - u8 len; - u8 cfpcnt; - u8 cfpperiod; - __le16 cfpmaxduration; - __le16 cfpdurationremaining; -} __attribute__ ((packed)); - - -struct ieeetypes_ibssparamset { - u8 elementid; - u8 len; - __le16 atimwindow; -} __attribute__ ((packed)); - -union IEEEtypes_ssparamset { - struct ieeetypes_cfparamset cfparamset; - struct ieeetypes_ibssparamset ibssparamset; -} __attribute__ ((packed)); - -struct ieeetypes_fhparamset { - u8 elementid; - u8 len; - __le16 dwelltime; - u8 hopset; - u8 hoppattern; - u8 hopindex; -} __attribute__ ((packed)); - -struct ieeetypes_dsparamset { - u8 elementid; - u8 len; - u8 currentchan; -} __attribute__ ((packed)); - -union ieeetypes_phyparamset { - struct ieeetypes_fhparamset fhparamset; - struct ieeetypes_dsparamset dsparamset; -} __attribute__ ((packed)); - -struct ieeetypes_assocrsp { - __le16 capability; - __le16 statuscode; - __le16 aid; - u8 iebuffer[1]; -} __attribute__ ((packed)); - -/** TLV type ID definition */ -#define PROPRIETARY_TLV_BASE_ID 0x0100 - -/* Terminating TLV type */ -#define MRVL_TERMINATE_TLV_ID 0xffff - -#define TLV_TYPE_SSID 0x0000 -#define TLV_TYPE_RATES 0x0001 -#define TLV_TYPE_PHY_FH 0x0002 -#define TLV_TYPE_PHY_DS 0x0003 -#define TLV_TYPE_CF 0x0004 -#define TLV_TYPE_IBSS 0x0006 - -#define TLV_TYPE_DOMAIN 0x0007 - -#define TLV_TYPE_POWER_CAPABILITY 0x0021 - -#define TLV_TYPE_KEY_MATERIAL (PROPRIETARY_TLV_BASE_ID + 0) -#define TLV_TYPE_CHANLIST (PROPRIETARY_TLV_BASE_ID + 1) -#define TLV_TYPE_NUMPROBES (PROPRIETARY_TLV_BASE_ID + 2) -#define TLV_TYPE_RSSI_LOW (PROPRIETARY_TLV_BASE_ID + 4) -#define TLV_TYPE_SNR_LOW (PROPRIETARY_TLV_BASE_ID + 5) -#define TLV_TYPE_FAILCOUNT (PROPRIETARY_TLV_BASE_ID + 6) -#define TLV_TYPE_BCNMISS (PROPRIETARY_TLV_BASE_ID + 7) -#define TLV_TYPE_LED_GPIO (PROPRIETARY_TLV_BASE_ID + 8) -#define TLV_TYPE_LEDBEHAVIOR (PROPRIETARY_TLV_BASE_ID + 9) -#define TLV_TYPE_PASSTHROUGH (PROPRIETARY_TLV_BASE_ID + 10) -#define TLV_TYPE_REASSOCAP (PROPRIETARY_TLV_BASE_ID + 11) -#define TLV_TYPE_POWER_TBL_2_4GHZ (PROPRIETARY_TLV_BASE_ID + 12) -#define TLV_TYPE_POWER_TBL_5GHZ (PROPRIETARY_TLV_BASE_ID + 13) -#define TLV_TYPE_BCASTPROBE (PROPRIETARY_TLV_BASE_ID + 14) -#define TLV_TYPE_NUMSSID_PROBE (PROPRIETARY_TLV_BASE_ID + 15) -#define TLV_TYPE_WMMQSTATUS (PROPRIETARY_TLV_BASE_ID + 16) -#define TLV_TYPE_CRYPTO_DATA (PROPRIETARY_TLV_BASE_ID + 17) -#define TLV_TYPE_WILDCARDSSID (PROPRIETARY_TLV_BASE_ID + 18) -#define TLV_TYPE_TSFTIMESTAMP (PROPRIETARY_TLV_BASE_ID + 19) -#define TLV_TYPE_RSSI_HIGH (PROPRIETARY_TLV_BASE_ID + 22) -#define TLV_TYPE_SNR_HIGH (PROPRIETARY_TLV_BASE_ID + 23) - -/** TLV related data structures*/ -struct mrvlietypesheader { - __le16 type; - __le16 len; -} __attribute__ ((packed)); - -struct mrvlietypes_data { - struct mrvlietypesheader header; - u8 Data[1]; -} __attribute__ ((packed)); - -struct mrvlietypes_ratesparamset { - struct mrvlietypesheader header; - u8 rates[1]; -} __attribute__ ((packed)); - -struct mrvlietypes_ssidparamset { - struct mrvlietypesheader header; - u8 ssid[1]; -} __attribute__ ((packed)); - -struct mrvlietypes_wildcardssidparamset { - struct mrvlietypesheader header; - u8 MaxSsidlength; - u8 ssid[1]; -} __attribute__ ((packed)); - -struct chanscanmode { -#ifdef __BIG_ENDIAN_BITFIELD - u8 reserved_2_7:6; - u8 disablechanfilt:1; - u8 passivescan:1; -#else - u8 passivescan:1; - u8 disablechanfilt:1; - u8 reserved_2_7:6; -#endif -} __attribute__ ((packed)); - -struct chanscanparamset { - u8 radiotype; - u8 channumber; - struct chanscanmode chanscanmode; - __le16 minscantime; - __le16 maxscantime; -} __attribute__ ((packed)); - -struct mrvlietypes_chanlistparamset { - struct mrvlietypesheader header; - struct chanscanparamset chanscanparam[1]; -} __attribute__ ((packed)); - -struct cfparamset { - u8 cfpcnt; - u8 cfpperiod; - __le16 cfpmaxduration; - __le16 cfpdurationremaining; -} __attribute__ ((packed)); - -struct ibssparamset { - __le16 atimwindow; -} __attribute__ ((packed)); - -struct mrvlietypes_ssparamset { - struct mrvlietypesheader header; - union { - struct cfparamset cfparamset[1]; - struct ibssparamset ibssparamset[1]; - } cf_ibss; -} __attribute__ ((packed)); - -struct fhparamset { - __le16 dwelltime; - u8 hopset; - u8 hoppattern; - u8 hopindex; -} __attribute__ ((packed)); - -struct dsparamset { - u8 currentchan; -} __attribute__ ((packed)); - -struct mrvlietypes_phyparamset { - struct mrvlietypesheader header; - union { - struct fhparamset fhparamset[1]; - struct dsparamset dsparamset[1]; - } fh_ds; -} __attribute__ ((packed)); - -struct mrvlietypes_rsnparamset { - struct mrvlietypesheader header; - u8 rsnie[1]; -} __attribute__ ((packed)); - -struct mrvlietypes_tsftimestamp { - struct mrvlietypesheader header; - __le64 tsftable[1]; -} __attribute__ ((packed)); - -/** Local Power capability */ -struct mrvlietypes_powercapability { - struct mrvlietypesheader header; - s8 minpower; - s8 maxpower; -} __attribute__ ((packed)); - -/* used in CMD_802_11_SUBSCRIBE_EVENT for SNR, RSSI and Failure */ -struct mrvlietypes_thresholds { - struct mrvlietypesheader header; - u8 value; - u8 freq; -} __attribute__ ((packed)); - -struct mrvlietypes_beaconsmissed { - struct mrvlietypesheader header; - u8 beaconmissed; - u8 reserved; -} __attribute__ ((packed)); - -struct mrvlietypes_numprobes { - struct mrvlietypesheader header; - __le16 numprobes; -} __attribute__ ((packed)); - -struct mrvlietypes_bcastprobe { - struct mrvlietypesheader header; - __le16 bcastprobe; -} __attribute__ ((packed)); - -struct mrvlietypes_numssidprobe { - struct mrvlietypesheader header; - __le16 numssidprobe; -} __attribute__ ((packed)); - -struct led_pin { - u8 led; - u8 pin; -} __attribute__ ((packed)); - -struct mrvlietypes_ledgpio { - struct mrvlietypesheader header; - struct led_pin ledpin[1]; -} __attribute__ ((packed)); - -struct led_bhv { - uint8_t firmwarestate; - uint8_t led; - uint8_t ledstate; - uint8_t ledarg; -} __attribute__ ((packed)); - - -struct mrvlietypes_ledbhv { - struct mrvlietypesheader header; - struct led_bhv ledbhv[1]; -} __attribute__ ((packed)); - -/* Meant to be packed as the value member of a struct ieee80211_info_element. - * Note that the len member of the ieee80211_info_element varies depending on - * the mesh_id_len */ -struct mrvl_meshie_val { - uint8_t oui[3]; - uint8_t type; - uint8_t subtype; - uint8_t version; - uint8_t active_protocol_id; - uint8_t active_metric_id; - uint8_t mesh_capability; - uint8_t mesh_id_len; - uint8_t mesh_id[IW_ESSID_MAX_SIZE]; -} __attribute__ ((packed)); - -struct mrvl_meshie { - u8 id, len; - struct mrvl_meshie_val val; -} __attribute__ ((packed)); - -struct mrvl_mesh_defaults { - __le32 bootflag; - uint8_t boottime; - uint8_t reserved; - __le16 channel; - struct mrvl_meshie meshie; -} __attribute__ ((packed)); - -#endif diff --git a/drivers/net/wireless/mv8686/wext.c b/drivers/net/wireless/mv8686/wext.c deleted file mode 100755 index 3a74a90f4ad9..000000000000 --- a/drivers/net/wireless/mv8686/wext.c +++ /dev/null @@ -1,2263 +0,0 @@ -/** - * This file contains ioctl functions - */ -#include -#include -#include -#include -#include -#include -#include - -#include "lib80211.h" -#include - -#include "host.h" -#include "radiotap.h" -#include "decl.h" -#include "defs.h" -#include "dev.h" -#include "wext.h" -#include "scan.h" -#include "assoc.h" -#include "cmd.h" - -#include "iwpriv.h" - -/* - * Defined in main.c - */ -extern atomic_t reassoc_flag; - -static inline void lbs_postpone_association_work(struct lbs_private *priv) -{ - if (priv->surpriseremoved) - return; - - cancel_delayed_work(&priv->assoc_work); - queue_delayed_work(priv->work_thread, &priv->assoc_work, HZ / 2); -} - -static inline void lbs_do_association_work(struct lbs_private *priv) -{ - if (priv->surpriseremoved) - return; - - cancel_delayed_work(&priv->assoc_work); - queue_delayed_work(priv->work_thread, &priv->assoc_work, 0); -} - -static inline void lbs_cancel_association_work(struct lbs_private *priv) -{ - cancel_delayed_work(&priv->assoc_work); - if (priv->pending_assoc_req != NULL) - kfree(priv->pending_assoc_req); - priv->pending_assoc_req = NULL; -} - - -/** - * @brief Find the channel frequency power info with specific channel - * - * @param priv A pointer to struct lbs_private structure - * @param band it can be BAND_A, BAND_G or BAND_B - * @param channel the channel for looking - * @return A pointer to struct chan_freq_power structure or NULL if not find. - */ -struct chan_freq_power *lbs_find_cfp_by_band_and_channel( - struct lbs_private *priv, u8 band, u16 channel) -{ - struct chan_freq_power *cfp = NULL; - struct region_channel *rc; - int i, j; - - for (j = 0; !cfp && (j < ARRAY_SIZE(priv->region_channel)); j++) - { - rc = &priv->region_channel[j]; - - if (priv->enable11d) - rc = &priv->universal_channel[j]; - if (!rc->valid || !rc->CFP) - continue; - if (rc->band != band) - continue; - for (i = 0; i < rc->nrcfp; i++) { - if (rc->CFP[i].channel == channel) { - cfp = &rc->CFP[i]; - break; - } - } - } - - if (!cfp && channel) - lbs_deb_wext("lbs_find_cfp_by_band_and_channel: can't find " - "cfp by band %d / channel %d\n", band, channel); - - return cfp; -} - -/** - * @brief Find the channel frequency power info with specific frequency - * - * @param priv A pointer to struct lbs_private structure - * @param band it can be BAND_A, BAND_G or BAND_B - * @param freq the frequency for looking - * @return A pointer to struct chan_freq_power structure or NULL if not find. - */ -static struct chan_freq_power *find_cfp_by_band_and_freq( - struct lbs_private *priv, - u8 band, - u32 freq) -{ - struct chan_freq_power *cfp = NULL; - struct region_channel *rc; - int i, j; - - for (j = 0; !cfp && (j < ARRAY_SIZE(priv->region_channel)); j++) { - rc = &priv->region_channel[j]; - - if (priv->enable11d) - rc = &priv->universal_channel[j]; - if (!rc->valid || !rc->CFP) - continue; - if (rc->band != band) - continue; - for (i = 0; i < rc->nrcfp; i++) { - if (rc->CFP[i].freq == freq) { - cfp = &rc->CFP[i]; - break; - } - } - } - - if (!cfp && freq) - lbs_deb_wext("find_cfp_by_band_and_freql: can't find cfp by " - "band %d / freq %d\n", band, freq); - - return cfp; -} - -/** - * @brief Copy active data rates based on adapter mode and status - * - * @param priv A pointer to struct lbs_private structure - * @param rate The buf to return the active rates - */ -static void copy_active_data_rates(struct lbs_private *priv, u8 *rates) -{ - lbs_deb_enter(LBS_DEB_WEXT); - - if (priv->connect_status != LBS_CONNECTED) - memcpy(rates, lbs_bg_rates, MAX_RATES); - else - memcpy(rates, priv->curbssparams.rates, MAX_RATES); - - lbs_deb_leave(LBS_DEB_WEXT); -} - -static int lbs_get_name(struct net_device *dev, struct iw_request_info *info, - char *cwrq, char *extra) -{ - lbs_deb_enter(LBS_DEB_WEXT); - - /* We could add support for 802.11n here as needed. Jean II */ - snprintf(cwrq, IFNAMSIZ, "IEEE 802.11b/g"); - - lbs_deb_leave(LBS_DEB_WEXT); - - return 0; -} - -static int lbs_get_freq(struct net_device *dev, struct iw_request_info *info, - struct iw_freq *fwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - struct chan_freq_power *cfp; - - lbs_deb_enter(LBS_DEB_WEXT); - - cfp = lbs_find_cfp_by_band_and_channel(priv, 0, - priv->curbssparams.channel); - - if (!cfp) { - if (priv->curbssparams.channel) - lbs_deb_wext("invalid channel %d\n", - priv->curbssparams.channel); - return -EINVAL; - } - - fwrq->m = (long)cfp->freq * 100000; - fwrq->e = 1; - - lbs_deb_wext("freq %u\n", fwrq->m); - lbs_deb_leave(LBS_DEB_WEXT); - return 0; -} - -static int lbs_get_wap(struct net_device *dev, struct iw_request_info *info, - struct sockaddr *awrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - - lbs_deb_enter(LBS_DEB_WEXT); - - if (priv->connect_status == LBS_CONNECTED) { - memcpy(awrq->sa_data, priv->curbssparams.bssid, ETH_ALEN); - } else { - memset(awrq->sa_data, 0, ETH_ALEN); - } - awrq->sa_family = ARPHRD_ETHER; - - lbs_deb_leave(LBS_DEB_WEXT); - return 0; -} - -static int lbs_set_nick(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - - lbs_deb_enter(LBS_DEB_WEXT); - - /* - * Check the size of the string - */ - - if (dwrq->length > 16) { - return -E2BIG; - } - - mutex_lock(&priv->lock); - memset(priv->nodename, 0, sizeof(priv->nodename)); - memcpy(priv->nodename, extra, dwrq->length); - mutex_unlock(&priv->lock); - - lbs_deb_leave(LBS_DEB_WEXT); - return 0; -} - -static int lbs_get_nick(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - - lbs_deb_enter(LBS_DEB_WEXT); - - dwrq->length = strlen(priv->nodename); - memcpy(extra, priv->nodename, dwrq->length); - extra[dwrq->length] = '\0'; - - dwrq->flags = 1; /* active */ - - lbs_deb_leave(LBS_DEB_WEXT); - return 0; -} - -static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - int ret = 0; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - u32 val = vwrq->value; - - lbs_deb_enter(LBS_DEB_WEXT); - - if (vwrq->disabled) - val = MRVDRV_RTS_MAX_VALUE; - - if (val > MRVDRV_RTS_MAX_VALUE) /* min rts value is 0 */ - return -EINVAL; - - ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_RTS_THRESHOLD, (u16) val); - - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -static int lbs_get_rts(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - int ret = 0; - u16 val = 0; - - lbs_deb_enter(LBS_DEB_WEXT); - - ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_RTS_THRESHOLD, &val); - if (ret) - goto out; - - vwrq->value = val; - vwrq->disabled = val > MRVDRV_RTS_MAX_VALUE; /* min rts value is 0 */ - vwrq->fixed = 1; - -out: - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - int ret = 0; - u32 val = vwrq->value; - - lbs_deb_enter(LBS_DEB_WEXT); - - if (vwrq->disabled) - val = MRVDRV_FRAG_MAX_VALUE; - - if (val < MRVDRV_FRAG_MIN_VALUE || val > MRVDRV_FRAG_MAX_VALUE) - return -EINVAL; - - ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_FRAG_THRESHOLD, (u16) val); - - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - int ret = 0; - u16 val = 0; - - lbs_deb_enter(LBS_DEB_WEXT); - - ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_FRAG_THRESHOLD, &val); - if (ret) - goto out; - - vwrq->value = val; - vwrq->disabled = ((val < MRVDRV_FRAG_MIN_VALUE) - || (val > MRVDRV_FRAG_MAX_VALUE)); - vwrq->fixed = 1; - -out: - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -static int lbs_get_mode(struct net_device *dev, - struct iw_request_info *info, u32 * uwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - - lbs_deb_enter(LBS_DEB_WEXT); - - *uwrq = priv->mode; - - lbs_deb_leave(LBS_DEB_WEXT); - return 0; -} - -static int lbs_get_txpow(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - s16 curlevel = 0; - int ret = 0; - - lbs_deb_enter(LBS_DEB_WEXT); - - if (!priv->radio_on) { - lbs_deb_wext("tx power off\n"); - vwrq->value = 0; - vwrq->disabled = 1; - goto out; - } - - ret = lbs_get_tx_power(priv, &curlevel, NULL, NULL); - if (ret) - goto out; - - lbs_deb_wext("tx power level %d dbm\n", curlevel); - priv->txpower_cur = curlevel; - - vwrq->value = curlevel; - vwrq->fixed = 1; - vwrq->disabled = 0; - vwrq->flags = IW_TXPOW_DBM; - -out: - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - int ret = 0; - u16 slimit = 0, llimit = 0; - - lbs_deb_enter(LBS_DEB_WEXT); - - if ((vwrq->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT) - return -EOPNOTSUPP; - - /* The MAC has a 4-bit Total_Tx_Count register - Total_Tx_Count = 1 + Tx_Retry_Count */ -#define TX_RETRY_MIN 0 -#define TX_RETRY_MAX 14 - if (vwrq->value < TX_RETRY_MIN || vwrq->value > TX_RETRY_MAX) - return -EINVAL; - - /* Add 1 to convert retry count to try count */ - if (vwrq->flags & IW_RETRY_SHORT) - slimit = (u16) (vwrq->value + 1); - else if (vwrq->flags & IW_RETRY_LONG) - llimit = (u16) (vwrq->value + 1); - else - slimit = llimit = (u16) (vwrq->value + 1); /* set both */ - - if (llimit) { - ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_LONG_RETRY_LIMIT, - llimit); - if (ret) - goto out; - } - - if (slimit) { - /* txretrycount follows the short retry limit */ - priv->txretrycount = slimit; - ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_SHORT_RETRY_LIMIT, - slimit); - if (ret) - goto out; - } - -out: - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - int ret = 0; - u16 val = 0; - - lbs_deb_enter(LBS_DEB_WEXT); - - vwrq->disabled = 0; - - if (vwrq->flags & IW_RETRY_LONG) { - ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_LONG_RETRY_LIMIT, &val); - if (ret) - goto out; - - /* Subtract 1 to convert try count to retry count */ - vwrq->value = val - 1; - vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; - } else { - ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_SHORT_RETRY_LIMIT, &val); - if (ret) - goto out; - - /* txretry count follows the short retry limit */ - priv->txretrycount = val; - /* Subtract 1 to convert try count to retry count */ - vwrq->value = val - 1; - vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; - } - -out: - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -static inline void sort_channels(struct iw_freq *freq, int num) -{ - int i, j; - struct iw_freq temp; - - for (i = 0; i < num; i++) - for (j = i + 1; j < num; j++) - if (freq[i].i > freq[j].i) { - temp.i = freq[i].i; - temp.m = freq[i].m; - - freq[i].i = freq[j].i; - freq[i].m = freq[j].m; - - freq[j].i = temp.i; - freq[j].m = temp.m; - } -} - -/* data rate listing - MULTI_BANDS: - abg a b b/g - Infra G(12) A(8) B(4) G(12) - Adhoc A+B(12) A(8) B(4) B(4) - - non-MULTI_BANDS: - b b/g - Infra B(4) G(12) - Adhoc B(4) B(4) - */ -/** - * @brief Get Range Info - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * @return 0 --success, otherwise fail - */ -static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - int i, j; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - struct iw_range *range = (struct iw_range *)extra; - struct chan_freq_power *cfp; - u8 rates[MAX_RATES + 1]; - - u8 flag = 0; - - lbs_deb_enter(LBS_DEB_WEXT); - - dwrq->length = sizeof(struct iw_range); - memset(range, 0, sizeof(struct iw_range)); - - range->min_nwid = 0; - range->max_nwid = 0; - - memset(rates, 0, sizeof(rates)); - copy_active_data_rates(priv, rates); - range->num_bitrates = strnlen(rates, IW_MAX_BITRATES); - for (i = 0; i < range->num_bitrates; i++) - range->bitrate[i] = rates[i] * 500000; - range->num_bitrates = i; - lbs_deb_wext("IW_MAX_BITRATES %d, num_bitrates %d\n", IW_MAX_BITRATES, - range->num_bitrates); - - range->num_frequency = 0; - - range->scan_capa = IW_SCAN_CAPA_ESSID; - - if (priv->enable11d && - (priv->connect_status == LBS_CONNECTED)) { - u8 chan_no; - u8 band; - - struct parsed_region_chan_11d *parsed_region_chan = - &priv->parsed_region_chan; - - if (parsed_region_chan == NULL) { - lbs_deb_wext("11d: parsed_region_chan is NULL\n"); - goto out; - } - band = parsed_region_chan->band; - lbs_deb_wext("band %d, nr_char %d\n", band, - parsed_region_chan->nr_chan); - - for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) - && (i < parsed_region_chan->nr_chan); i++) { - chan_no = parsed_region_chan->chanpwr[i].chan; - lbs_deb_wext("chan_no %d\n", chan_no); - range->freq[range->num_frequency].i = (long)chan_no; - range->freq[range->num_frequency].m = - (long)lbs_chan_2_freq(chan_no) * 100000; - range->freq[range->num_frequency].e = 1; - range->num_frequency++; - } - flag = 1; - } - if (!flag) { - for (j = 0; (range->num_frequency < IW_MAX_FREQUENCIES) - && (j < ARRAY_SIZE(priv->region_channel)); j++) { - cfp = priv->region_channel[j].CFP; - for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) - && priv->region_channel[j].valid - && cfp - && (i < priv->region_channel[j].nrcfp); i++) { - range->freq[range->num_frequency].i = - (long)cfp->channel; - range->freq[range->num_frequency].m = - (long)cfp->freq * 100000; - range->freq[range->num_frequency].e = 1; - cfp++; - range->num_frequency++; - } - } - } - - lbs_deb_wext("IW_MAX_FREQUENCIES %d, num_frequency %d\n", - IW_MAX_FREQUENCIES, range->num_frequency); - - range->num_channels = range->num_frequency; - - sort_channels(&range->freq[0], range->num_frequency); - - /* - * Set an indication of the max TCP throughput in bit/s that we can - * expect using this interface - */ - if (i > 2) - range->throughput = 5000 * 1000; - else - range->throughput = 1500 * 1000; - - range->min_rts = MRVDRV_RTS_MIN_VALUE; - range->max_rts = MRVDRV_RTS_MAX_VALUE; - range->min_frag = MRVDRV_FRAG_MIN_VALUE; - range->max_frag = MRVDRV_FRAG_MAX_VALUE; - - range->encoding_size[0] = 5; - range->encoding_size[1] = 13; - range->num_encoding_sizes = 2; - range->max_encoding_tokens = 4; - - /* - * Right now we support only "iwconfig ethX power on|off" - */ - range->pm_capa = IW_POWER_ON; - - /* - * Minimum version we recommend - */ - range->we_version_source = 15; - - /* - * Version we are compiled with - */ - range->we_version_compiled = WIRELESS_EXT; - - range->retry_capa = IW_RETRY_LIMIT; - range->retry_flags = IW_RETRY_LIMIT | IW_RETRY_MAX; - - range->min_retry = TX_RETRY_MIN; - range->max_retry = TX_RETRY_MAX; - - /* - * Set the qual, level and noise range values - */ - range->max_qual.qual = 100; - range->max_qual.level = 0; - range->max_qual.noise = 0; - range->max_qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; - - range->avg_qual.qual = 70; - /* TODO: Find real 'good' to 'bad' threshold value for RSSI */ - range->avg_qual.level = 0; - range->avg_qual.noise = 0; - range->avg_qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; - - range->sensitivity = 0; - - /* Setup the supported power level ranges */ - memset(range->txpower, 0, sizeof(range->txpower)); - range->txpower_capa = IW_TXPOW_DBM | IW_TXPOW_RANGE; - range->txpower[0] = priv->txpower_min; - range->txpower[1] = priv->txpower_max; - range->num_txpower = 2; - - range->event_capa[0] = (IW_EVENT_CAPA_K_0 | - IW_EVENT_CAPA_MASK(SIOCGIWAP) | - IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); - range->event_capa[1] = IW_EVENT_CAPA_K_1; - - if (priv->fwcapinfo & FW_CAPINFO_WPA) { - range->enc_capa = IW_ENC_CAPA_WPA - | IW_ENC_CAPA_WPA2 - | IW_ENC_CAPA_CIPHER_TKIP - | IW_ENC_CAPA_CIPHER_CCMP; - } - -out: - lbs_deb_leave(LBS_DEB_WEXT); - return 0; -} - -static int lbs_set_power(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - - lbs_deb_enter(LBS_DEB_WEXT); - - if (!priv->ps_supported) { - if (vwrq->disabled) - return 0; - else - return -EINVAL; - } - - /* PS is currently supported only in Infrastructure mode - * Remove this check if it is to be supported in IBSS mode also - */ - - if (vwrq->disabled) { - priv->psmode = LBS802_11POWERMODECAM; - if (priv->psstate != PS_STATE_FULL_POWER) { - lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); - } - - return 0; - } - - if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { - lbs_deb_wext( - "setting power timeout is not supported\n"); - return -EINVAL; - } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { - lbs_deb_wext("setting power period not supported\n"); - return -EINVAL; - } - - if (priv->psmode != LBS802_11POWERMODECAM) { - return 0; - } - - priv->psmode = LBS802_11POWERMODEMAX_PSP; - - if (priv->connect_status == LBS_CONNECTED) { - lbs_ps_sleep(priv, CMD_OPTION_WAITFORRSP); - } - - lbs_deb_leave(LBS_DEB_WEXT); - - return 0; -} - -static int lbs_get_power(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - - lbs_deb_enter(LBS_DEB_WEXT); - - vwrq->value = 0; - vwrq->flags = 0; -#if (NEW_MV8686_PS == 1) - if (priv->psmode == LBS802_11POWERMODECAM) - vwrq->disabled = 1; - else - vwrq->disabled = 0; -#else - vwrq->disabled = priv->psmode == LBS802_11POWERMODECAM - || priv->connect_status == LBS_DISCONNECTED; -#endif - lbs_deb_leave(LBS_DEB_WEXT); - - return 0; -} - -static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev) -{ - enum { - POOR = 30, - FAIR = 60, - GOOD = 80, - VERY_GOOD = 90, - EXCELLENT = 95, - PERFECT = 100 - }; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - u32 rssi_qual; - u32 tx_qual; - u32 quality = 0; - int stats_valid = 0; - u8 rssi; - u32 tx_retries; - struct cmd_ds_802_11_get_log log; - - lbs_deb_enter(LBS_DEB_WEXT); - - priv->wstats.status = priv->mode; - - /* If we're not associated, all quality values are meaningless */ - if (priv->connect_status != LBS_CONNECTED) - goto out; - - /* Quality by RSSI */ - priv->wstats.qual.level = - CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_NOAVG], - priv->NF[TYPE_BEACON][TYPE_NOAVG]); - - if (priv->NF[TYPE_BEACON][TYPE_NOAVG] == 0) { - priv->wstats.qual.noise = MRVDRV_NF_DEFAULT_SCAN_VALUE; - } else { - priv->wstats.qual.noise = - CAL_NF(priv->NF[TYPE_BEACON][TYPE_NOAVG]); - } - - lbs_deb_wext("signal level %#x\n", priv->wstats.qual.level); - lbs_deb_wext("noise %#x\n", priv->wstats.qual.noise); - - rssi = priv->wstats.qual.level - priv->wstats.qual.noise; - if (rssi < 15) - rssi_qual = rssi * POOR / 10; - else if (rssi < 20) - rssi_qual = (rssi - 15) * (FAIR - POOR) / 5 + POOR; - else if (rssi < 30) - rssi_qual = (rssi - 20) * (GOOD - FAIR) / 5 + FAIR; - else if (rssi < 40) - rssi_qual = (rssi - 30) * (VERY_GOOD - GOOD) / - 10 + GOOD; - else - rssi_qual = (rssi - 40) * (PERFECT - VERY_GOOD) / - 10 + VERY_GOOD; - quality = rssi_qual; - - /* Quality by TX errors */ - priv->wstats.discard.retries = dev->stats.tx_errors; - - memset(&log, 0, sizeof(log)); - log.hdr.size = cpu_to_le16(sizeof(log)); - lbs_cmd_with_response(priv, CMD_802_11_GET_LOG, &log); - - tx_retries = le32_to_cpu(log.retry); - - if (tx_retries > 75) - tx_qual = (90 - tx_retries) * POOR / 15; - else if (tx_retries > 70) - tx_qual = (75 - tx_retries) * (FAIR - POOR) / 5 + POOR; - else if (tx_retries > 65) - tx_qual = (70 - tx_retries) * (GOOD - FAIR) / 5 + FAIR; - else if (tx_retries > 50) - tx_qual = (65 - tx_retries) * (VERY_GOOD - GOOD) / - 15 + GOOD; - else - tx_qual = (50 - tx_retries) * - (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; - quality = min(quality, tx_qual); - - priv->wstats.discard.code = le32_to_cpu(log.wepundecryptable); - priv->wstats.discard.retries = tx_retries; - priv->wstats.discard.misc = le32_to_cpu(log.ackfailure); - - /* Calculate quality */ - priv->wstats.qual.qual = min_t(u8, quality, 100); - priv->wstats.qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; - stats_valid = 1; - - /* update stats asynchronously for future calls */ - lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, - 0, 0, NULL); -out: - if (!stats_valid) { - priv->wstats.miss.beacon = 0; - priv->wstats.discard.retries = 0; - priv->wstats.qual.qual = 0; - priv->wstats.qual.level = 0; - priv->wstats.qual.noise = 0; - priv->wstats.qual.updated = IW_QUAL_ALL_UPDATED; - priv->wstats.qual.updated |= IW_QUAL_NOISE_INVALID | - IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; - } - - lbs_deb_leave(LBS_DEB_WEXT); - return &priv->wstats; - - -} - -static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info, - struct iw_freq *fwrq, char *extra) -{ - int ret = -EINVAL; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - struct chan_freq_power *cfp; - struct assoc_request * assoc_req; - - lbs_deb_enter(LBS_DEB_WEXT); - - mutex_lock(&priv->lock); - assoc_req = lbs_get_association_request(priv); - if (!assoc_req) { - ret = -ENOMEM; - goto out; - } - - /* If setting by frequency, convert to a channel */ - if (fwrq->e == 1) { - long f = fwrq->m / 100000; - - cfp = find_cfp_by_band_and_freq(priv, 0, f); - if (!cfp) { - lbs_deb_wext("invalid freq %ld\n", f); - goto out; - } - - fwrq->e = 0; - fwrq->m = (int) cfp->channel; - } - - /* Setting by channel number */ - if (fwrq->m > 1000 || fwrq->e > 0) { - goto out; - } - - cfp = lbs_find_cfp_by_band_and_channel(priv, 0, fwrq->m); - if (!cfp) { - goto out; - } - - assoc_req->channel = fwrq->m; - ret = 0; - -out: - - if (ret == 0) { - set_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags); -#if (NEW_MV8686_PS == 0) - //printk("%s: call lbs_postpone_association_work\n", __func__); - lbs_postpone_association_work(priv); - } else { - lbs_cancel_association_work(priv); -#endif - } - - mutex_unlock(&priv->lock); - - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - u8 new_rate = 0; - int ret = -EINVAL; - u8 rates[MAX_RATES + 1]; - - lbs_deb_enter(LBS_DEB_WEXT); - lbs_deb_wext("vwrq->value %d\n", vwrq->value); - lbs_deb_wext("vwrq->fixed %d\n", vwrq->fixed); - - if (vwrq->fixed && vwrq->value == -1) - goto out; - - /* Auto rate? */ - priv->enablehwauto = !vwrq->fixed; - - if (vwrq->value == -1) - priv->cur_rate = 0; - else { - if (vwrq->value % 100000) - goto out; - - new_rate = vwrq->value / 500000; - priv->cur_rate = new_rate; - /* the rest is only needed for lbs_set_data_rate() */ - memset(rates, 0, sizeof(rates)); - copy_active_data_rates(priv, rates); - if (!memchr(rates, new_rate, sizeof(rates))) { - lbs_pr_alert("fixed data rate 0x%X out of range\n", - new_rate); - goto out; - } - if (priv->fwrelease < 0x09000000) { - ret = lbs_set_power_adapt_cfg(priv, 0, - POW_ADAPT_DEFAULT_P0, - POW_ADAPT_DEFAULT_P1, - POW_ADAPT_DEFAULT_P2); - if (ret) - goto out; - } - ret = lbs_set_tpc_cfg(priv, 0, TPC_DEFAULT_P0, TPC_DEFAULT_P1, - TPC_DEFAULT_P2, 1); - if (ret) - goto out; - } - - /* Try the newer command first (Firmware Spec 5.1 and above) */ - ret = lbs_cmd_802_11_rate_adapt_rateset(priv, CMD_ACT_SET); - - /* Fallback to older version */ - if (ret) - ret = lbs_set_data_rate(priv, new_rate); - -out: - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -//extern int pm_onelevel_status; -//#include - -static int lbs_get_sense(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - static int previous_rssi = 60; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - - lbs_deb_enter(LBS_DEB_WEXT); - - //printk("%s: reassoc_flag is %d\n", __func__, atomic_read(&reassoc_flag)); -#if 1 - - if (priv->connect_status == LBS_CONNECTED) - { - /* We are in reassociating. */ - if (atomic_read(&reassoc_flag) == 1) - { - vwrq->value = previous_rssi; - return 1; - } - - if (priv->deepsleep == false) - lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0, - CMD_OPTION_WAITFORRSP, 0, NULL); - - /* Quality by RSSI */ - priv->wstats.qual.level = - CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_NOAVG], - priv->NF[TYPE_BEACON][TYPE_NOAVG]); - -#if (NEW_MV8686_PS == 1) - /* - * In MV8686 FW, the level range is 256. - * We got the negative level, but it's considered as positive. - */ - vwrq->value = 256 - priv->wstats.qual.level; -#endif - previous_rssi = vwrq->value; - -#if 0 - printk("signal level %d ", priv->wstats.qual.level); - printk("noise %d ", priv->wstats.qual.noise); - printk("rssi %d\n", vwrq->value); -#endif - } - else - { - vwrq->value = 30; - //printk("%s: return default rssi=30\n", __func__); - } -#else - vwrq->value = 60; -#endif - - lbs_deb_leave(LBS_DEB_WEXT); - - return 1; -} - -static int lbs_get_rate(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - - lbs_deb_enter(LBS_DEB_WEXT); - - if (priv->connect_status == LBS_CONNECTED) { - vwrq->value = priv->cur_rate * 500000; - - if (priv->enablehwauto) - vwrq->fixed = 0; - else - vwrq->fixed = 1; - - } else { - vwrq->fixed = 0; - vwrq->value = 0; - } - - lbs_deb_leave(LBS_DEB_WEXT); - return 0; -} - -static int lbs_set_mode(struct net_device *dev, - struct iw_request_info *info, u32 * uwrq, char *extra) -{ - int ret = 0; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); -#if (NEW_MV8686_PS == 1) - struct assoc_request * assoc_req; -#endif - - lbs_deb_enter(LBS_DEB_WEXT); - - if ( (*uwrq != IW_MODE_ADHOC) - && (*uwrq != IW_MODE_INFRA) - && (*uwrq != IW_MODE_AUTO)) { - lbs_deb_wext("Invalid mode: 0x%x\n", *uwrq); - ret = -EINVAL; - goto out; - } - -#if (MV8686_SUPPORT_ADHOC == 0) - if (*uwrq == IW_MODE_ADHOC) - { - printk("Ad-hoc isn't supported for now.\n"); - return -EINVAL; - } -#endif - -#if (NEW_MV8686_PS == 1) - mutex_lock(&priv->lock); - - assoc_req = lbs_get_association_request(priv); - if (!assoc_req) { - ret = -ENOMEM; - lbs_cancel_association_work(priv); - } else { - assoc_req->mode = *uwrq; - set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); - lbs_postpone_association_work(priv); - - //lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq); - //printk("Switching to mode: 0x%x\n", *uwrq); - } - mutex_unlock(&priv->lock); -#endif - -out: - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - - -/** - * @brief Get Encryption key - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * @return 0 --success, otherwise fail - */ -static int lbs_get_encode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, u8 * extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - - lbs_deb_enter(LBS_DEB_WEXT); - - lbs_deb_wext("flags 0x%x, index %d, length %d, wep_tx_keyidx %d\n", - dwrq->flags, index, dwrq->length, priv->wep_tx_keyidx); - - dwrq->flags = 0; - - /* Authentication method */ - switch (priv->secinfo.auth_mode) { - case IW_AUTH_ALG_OPEN_SYSTEM: - dwrq->flags = IW_ENCODE_OPEN; - break; - - case IW_AUTH_ALG_SHARED_KEY: - case IW_AUTH_ALG_LEAP: - dwrq->flags = IW_ENCODE_RESTRICTED; - break; - default: - dwrq->flags = IW_ENCODE_DISABLED | IW_ENCODE_OPEN; - break; - } - - memset(extra, 0, 16); - - mutex_lock(&priv->lock); - - /* Default to returning current transmit key */ - if (index < 0) - index = priv->wep_tx_keyidx; - - if ((priv->wep_keys[index].len) && priv->secinfo.wep_enabled) { - memcpy(extra, priv->wep_keys[index].key, - priv->wep_keys[index].len); - dwrq->length = priv->wep_keys[index].len; - - dwrq->flags |= (index + 1); - /* Return WEP enabled */ - dwrq->flags &= ~IW_ENCODE_DISABLED; - } else if ((priv->secinfo.WPAenabled) - || (priv->secinfo.WPA2enabled)) { - /* return WPA enabled */ - dwrq->flags &= ~IW_ENCODE_DISABLED; - dwrq->flags |= IW_ENCODE_NOKEY; - } else { - dwrq->flags |= IW_ENCODE_DISABLED; - } - - mutex_unlock(&priv->lock); - - lbs_deb_wext("key: %02x:%02x:%02x:%02x:%02x:%02x, keylen %d\n", - extra[0], extra[1], extra[2], - extra[3], extra[4], extra[5], dwrq->length); - - lbs_deb_wext("return flags 0x%x\n", dwrq->flags); - - lbs_deb_leave(LBS_DEB_WEXT); - return 0; -} - -/** - * @brief Set Encryption key (internal) - * - * @param priv A pointer to private card structure - * @param key_material A pointer to key material - * @param key_length length of key material - * @param index key index to set - * @param set_tx_key Force set TX key (1 = yes, 0 = no) - * @return 0 --success, otherwise fail - */ -static int lbs_set_wep_key(struct assoc_request *assoc_req, - const char *key_material, - u16 key_length, - u16 index, - int set_tx_key) -{ - int ret = 0; - struct enc_key *pkey; - - lbs_deb_enter(LBS_DEB_WEXT); - - /* Paranoid validation of key index */ - if (index > 3) { - ret = -EINVAL; - goto out; - } - - /* validate max key length */ - if (key_length > KEY_LEN_WEP_104) { - ret = -EINVAL; - goto out; - } - - pkey = &assoc_req->wep_keys[index]; - - if (key_length > 0) { - memset(pkey, 0, sizeof(struct enc_key)); - pkey->type = KEY_TYPE_ID_WEP; - - /* Standardize the key length */ - pkey->len = (key_length > KEY_LEN_WEP_40) ? - KEY_LEN_WEP_104 : KEY_LEN_WEP_40; - memcpy(pkey->key, key_material, key_length); - } - - if (set_tx_key) { - /* Ensure the chosen key is valid */ - if (!pkey->len) { - lbs_deb_wext("key not set, so cannot enable it\n"); - ret = -EINVAL; - goto out; - } - assoc_req->wep_tx_keyidx = index; - } - - assoc_req->secinfo.wep_enabled = 1; - -out: - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -static int validate_key_index(u16 def_index, u16 raw_index, - u16 *out_index, u16 *is_default) -{ - if (!out_index || !is_default) - return -EINVAL; - - /* Verify index if present, otherwise use default TX key index */ - if (raw_index > 0) { - if (raw_index > 4) - return -EINVAL; - *out_index = raw_index - 1; - } else { - *out_index = def_index; - *is_default = 1; - } - return 0; -} - -static void disable_wep(struct assoc_request *assoc_req) -{ - int i; - - lbs_deb_enter(LBS_DEB_WEXT); - - /* Set Open System auth mode */ - //printk("disable_wep\n"); - //assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - - /* Clear WEP keys and mark WEP as disabled */ - assoc_req->secinfo.wep_enabled = 0; - for (i = 0; i < 4; i++) - assoc_req->wep_keys[i].len = 0; - - set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); - set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); - - lbs_deb_leave(LBS_DEB_WEXT); -} - -static void disable_wpa(struct assoc_request *assoc_req) -{ - lbs_deb_enter(LBS_DEB_WEXT); - - memset(&assoc_req->wpa_mcast_key, 0, sizeof (struct enc_key)); - assoc_req->wpa_mcast_key.flags = KEY_INFO_WPA_MCAST; - set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); - - memset(&assoc_req->wpa_unicast_key, 0, sizeof (struct enc_key)); - assoc_req->wpa_unicast_key.flags = KEY_INFO_WPA_UNICAST; - set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); - - assoc_req->secinfo.WPAenabled = 0; - assoc_req->secinfo.WPA2enabled = 0; - set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); - - lbs_deb_leave(LBS_DEB_WEXT); -} - -/** - * @brief Set Encryption key - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * @return 0 --success, otherwise fail - */ -static int lbs_set_encode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - int ret = 0; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - struct assoc_request * assoc_req; - u16 is_default = 0, index = 0, set_tx_key = 0; - - lbs_deb_enter(LBS_DEB_WEXT); - - mutex_lock(&priv->lock); - assoc_req = lbs_get_association_request(priv); - if (!assoc_req) { - ret = -ENOMEM; - goto out; - } - - if (dwrq->flags & IW_ENCODE_DISABLED) { - disable_wep (assoc_req); - disable_wpa (assoc_req); - goto out; - } - - ret = validate_key_index(assoc_req->wep_tx_keyidx, - (dwrq->flags & IW_ENCODE_INDEX), - &index, &is_default); - if (ret) { - ret = -EINVAL; - goto out; - } - - /* If WEP isn't enabled, or if there is no key data but a valid - * index, set the TX key. - */ - if (!assoc_req->secinfo.wep_enabled || (dwrq->length == 0 && !is_default)) - set_tx_key = 1; - - ret = lbs_set_wep_key(assoc_req, extra, dwrq->length, index, set_tx_key); - if (ret) - goto out; - - if (dwrq->length) - set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); - - if (set_tx_key) - set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); - - if (dwrq->flags & IW_ENCODE_RESTRICTED) { - assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; - //printk("Set encode: IW_AUTH_ALG_SHARED_KEY\n"); - } else if (dwrq->flags & IW_ENCODE_OPEN) { - assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - //printk("Set encode: IW_AUTH_ALG_OPEN_SYSTEM\n"); - } - -out: - if (ret == 0) { - set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); -#if (NEW_MV8686_PS == 1) - printk("%s: call lbs_postpone_association_work\n", __func__); - lbs_postpone_association_work(priv); -#endif - } else { - lbs_cancel_association_work(priv); - } - mutex_unlock(&priv->lock); - - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -/** - * @brief Get Extended Encryption key (WPA/802.1x and WEP) - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * @return 0 on success, otherwise failure - */ -static int lbs_get_encodeext(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - int ret = -EINVAL; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int index, max_key_len; - - lbs_deb_enter(LBS_DEB_WEXT); - - max_key_len = dwrq->length - sizeof(*ext); - if (max_key_len < 0) - goto out; - - index = dwrq->flags & IW_ENCODE_INDEX; - if (index) { - if (index < 1 || index > 4) - goto out; - index--; - } else { - index = priv->wep_tx_keyidx; - } - - if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) && - ext->alg != IW_ENCODE_ALG_WEP) { - if (index != 0 || priv->mode != IW_MODE_INFRA) - goto out; - } - - dwrq->flags = index + 1; - memset(ext, 0, sizeof(*ext)); - - if ( !priv->secinfo.wep_enabled - && !priv->secinfo.WPAenabled - && !priv->secinfo.WPA2enabled) { - ext->alg = IW_ENCODE_ALG_NONE; - ext->key_len = 0; - dwrq->flags |= IW_ENCODE_DISABLED; - } else { - u8 *key = NULL; - - if ( priv->secinfo.wep_enabled - && !priv->secinfo.WPAenabled - && !priv->secinfo.WPA2enabled) { - /* WEP */ - ext->alg = IW_ENCODE_ALG_WEP; - ext->key_len = priv->wep_keys[index].len; - key = &priv->wep_keys[index].key[0]; - } else if ( !priv->secinfo.wep_enabled - && (priv->secinfo.WPAenabled || - priv->secinfo.WPA2enabled)) { - /* WPA */ - struct enc_key * pkey = NULL; - - if ( priv->wpa_mcast_key.len - && (priv->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED)) - pkey = &priv->wpa_mcast_key; - else if ( priv->wpa_unicast_key.len - && (priv->wpa_unicast_key.flags & KEY_INFO_WPA_ENABLED)) - pkey = &priv->wpa_unicast_key; - - if (pkey) { - if (pkey->type == KEY_TYPE_ID_AES) { - ext->alg = IW_ENCODE_ALG_CCMP; - } else { - ext->alg = IW_ENCODE_ALG_TKIP; - } - ext->key_len = pkey->len; - key = &pkey->key[0]; - } else { - ext->alg = IW_ENCODE_ALG_TKIP; - ext->key_len = 0; - } - } else { - goto out; - } - - if (ext->key_len > max_key_len) { - ret = -E2BIG; - goto out; - } - - if (ext->key_len) - memcpy(ext->key, key, ext->key_len); - else - dwrq->flags |= IW_ENCODE_NOKEY; - dwrq->flags |= IW_ENCODE_ENABLED; - } - ret = 0; - -out: - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -/** - * @brief Set Encryption key Extended (WPA/802.1x and WEP) - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * @return 0 --success, otherwise fail - */ -static int lbs_set_encodeext(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - int ret = 0; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int alg = ext->alg; - struct assoc_request * assoc_req; - - lbs_deb_enter(LBS_DEB_WEXT); - - mutex_lock(&priv->lock); - assoc_req = lbs_get_association_request(priv); - if (!assoc_req) { - ret = -ENOMEM; - goto out; - } - - if ((alg == IW_ENCODE_ALG_NONE) || (dwrq->flags & IW_ENCODE_DISABLED)) { - disable_wep (assoc_req); - disable_wpa (assoc_req); - } else if (alg == IW_ENCODE_ALG_WEP) { - u16 is_default = 0, index, set_tx_key = 0; - - ret = validate_key_index(assoc_req->wep_tx_keyidx, - (dwrq->flags & IW_ENCODE_INDEX), - &index, &is_default); - if (ret) - goto out; - - /* If WEP isn't enabled, or if there is no key data but a valid - * index, or if the set-TX-key flag was passed, set the TX key. - */ - if ( !assoc_req->secinfo.wep_enabled - || (dwrq->length == 0 && !is_default) - || (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)) - set_tx_key = 1; - - /* Copy key to driver */ - ret = lbs_set_wep_key(assoc_req, ext->key, ext->key_len, index, - set_tx_key); - if (ret) - goto out; - - if (dwrq->flags & IW_ENCODE_RESTRICTED) { - assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; - } else if (dwrq->flags & IW_ENCODE_OPEN) { - assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - //printk("encodeext.\n"); - } - - /* Mark the various WEP bits as modified */ - set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); - if (dwrq->length) - set_bit(ASSOC_FLAG_WEP_KEYS, &assoc_req->flags); - if (set_tx_key) - set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags); - } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) { - struct enc_key * pkey; - - /* validate key length */ - if (((alg == IW_ENCODE_ALG_TKIP) - && (ext->key_len != KEY_LEN_WPA_TKIP)) - || ((alg == IW_ENCODE_ALG_CCMP) - && (ext->key_len != KEY_LEN_WPA_AES))) { - lbs_deb_wext("invalid size %d for key of alg " - "type %d\n", - ext->key_len, - alg); - ret = -EINVAL; - goto out; - } - - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - pkey = &assoc_req->wpa_mcast_key; - set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags); - } else { - pkey = &assoc_req->wpa_unicast_key; - set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags); - } - - memset(pkey, 0, sizeof (struct enc_key)); - memcpy(pkey->key, ext->key, ext->key_len); - pkey->len = ext->key_len; - if (pkey->len) - pkey->flags |= KEY_INFO_WPA_ENABLED; - - /* Do this after zeroing key structure */ - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - pkey->flags |= KEY_INFO_WPA_MCAST; - } else { - pkey->flags |= KEY_INFO_WPA_UNICAST; - } - - if (alg == IW_ENCODE_ALG_TKIP) { - pkey->type = KEY_TYPE_ID_TKIP; - } else if (alg == IW_ENCODE_ALG_CCMP) { - pkey->type = KEY_TYPE_ID_AES; - } - - /* If WPA isn't enabled yet, do that now */ - if ( assoc_req->secinfo.WPAenabled == 0 - && assoc_req->secinfo.WPA2enabled == 0) { - assoc_req->secinfo.WPAenabled = 1; - assoc_req->secinfo.WPA2enabled = 1; - set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); - } - - /* Only disable wep if necessary: can't waste time here. */ - if (priv->mac_control & CMD_ACT_MAC_WEP_ENABLE) - disable_wep(assoc_req); - } - -out: - if (ret == 0) { - /* 802.1x and WPA rekeying must happen as quickly as possible, - * especially during the 4-way handshake; thus if in - * infrastructure mode, and either (a) 802.1x is enabled or - * (b) WPA is being used, set the key right away. - */ -#if (NEW_MV8686_PS == 1) - if (assoc_req->mode == IW_MODE_INFRA && - ((assoc_req->secinfo.key_mgmt & IW_AUTH_KEY_MGMT_802_1X) || - (assoc_req->secinfo.key_mgmt & IW_AUTH_KEY_MGMT_PSK) || - assoc_req->secinfo.WPAenabled || - assoc_req->secinfo.WPA2enabled)) { - lbs_do_association_work(priv); - } - else { - //printk("%s: call lbs_postpone_association_work\n", __func__); - lbs_postpone_association_work(priv); - } -#endif - } else { - lbs_cancel_association_work(priv); - } - mutex_unlock(&priv->lock); - - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - - -static int lbs_set_genie(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - int ret = 0; - struct assoc_request * assoc_req; - - lbs_deb_enter(LBS_DEB_WEXT); - - mutex_lock(&priv->lock); - assoc_req = lbs_get_association_request(priv); - if (!assoc_req) { - ret = -ENOMEM; - goto out; - } - - if (dwrq->length > MAX_WPA_IE_LEN || - (dwrq->length && extra == NULL)) { - ret = -EINVAL; - goto out; - } - - if (dwrq->length) { - memcpy(&assoc_req->wpa_ie[0], extra, dwrq->length); - assoc_req->wpa_ie_len = dwrq->length; - } else { - memset(&assoc_req->wpa_ie[0], 0, sizeof(priv->wpa_ie)); - assoc_req->wpa_ie_len = 0; - } - -out: - if (ret == 0) { - set_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags); -#if (NEW_MV8686_PS == 1) - //printk("%s: call lbs_postpone_association_work\n", __func__); - lbs_postpone_association_work(priv); -#endif - } else { - lbs_cancel_association_work(priv); - } - mutex_unlock(&priv->lock); - - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -static int lbs_get_genie(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - int ret = 0; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - - lbs_deb_enter(LBS_DEB_WEXT); - - if (priv->wpa_ie_len == 0) { - dwrq->length = 0; - goto out; - } - - if (dwrq->length < priv->wpa_ie_len) { - ret = -E2BIG; - goto out; - } - - dwrq->length = priv->wpa_ie_len; - memcpy(extra, &priv->wpa_ie[0], priv->wpa_ie_len); - -out: - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - - -static int lbs_set_auth(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *dwrq, - char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - struct assoc_request * assoc_req; - int ret = 0; - int updated = 0; - - lbs_deb_enter(LBS_DEB_WEXT); - - mutex_lock(&priv->lock); - assoc_req = lbs_get_association_request(priv); - if (!assoc_req) { - ret = -ENOMEM; - goto out; - } - - //printk("dwrq->flags & IW_AUTH_INDEX = %x\n", dwrq->flags & IW_AUTH_INDEX); - - switch (dwrq->flags & IW_AUTH_INDEX) { - case IW_AUTH_TKIP_COUNTERMEASURES: - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_DROP_UNENCRYPTED: - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - case IW_AUTH_PRIVACY_INVOKED: - /* - * libertas does not use these parameters - */ - break; - - case IW_AUTH_KEY_MGMT: - assoc_req->secinfo.key_mgmt = dwrq->value; - updated = 1; - break; - - case IW_AUTH_WPA_VERSION: - if (dwrq->value & IW_AUTH_WPA_VERSION_DISABLED) { - assoc_req->secinfo.WPAenabled = 0; - assoc_req->secinfo.WPA2enabled = 0; - disable_wpa (assoc_req); - } - if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) { - assoc_req->secinfo.WPAenabled = 1; - assoc_req->secinfo.wep_enabled = 0; - assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - //printk("openopen.\n"); - } - if (dwrq->value & IW_AUTH_WPA_VERSION_WPA2) { - assoc_req->secinfo.WPA2enabled = 1; - assoc_req->secinfo.wep_enabled = 0; - assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - } - updated = 1; - break; - - case IW_AUTH_80211_AUTH_ALG: - //printk("AUTH ALG: %x\n", dwrq->value); - if (dwrq->value & IW_AUTH_ALG_SHARED_KEY) { - assoc_req->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; - //printk("IW_AUTH_ALG_SHARED_KEY\n"); - } else if (dwrq->value & IW_AUTH_ALG_OPEN_SYSTEM) { - assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - //printk("IW_AUTH_ALG_OPEN_SYSTEM\n"); - } else if (dwrq->value & IW_AUTH_ALG_LEAP) { - assoc_req->secinfo.auth_mode = IW_AUTH_ALG_LEAP; - } else { - ret = -EINVAL; - } - updated = 1; - break; - - case IW_AUTH_WPA_ENABLED: - if (dwrq->value) { - if (!assoc_req->secinfo.WPAenabled && - !assoc_req->secinfo.WPA2enabled) { - assoc_req->secinfo.WPAenabled = 1; - assoc_req->secinfo.WPA2enabled = 1; - assoc_req->secinfo.wep_enabled = 0; - assoc_req->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - //printk("OPENOPEN\n"); - } - } else { - assoc_req->secinfo.WPAenabled = 0; - assoc_req->secinfo.WPA2enabled = 0; - disable_wpa (assoc_req); - } - updated = 1; - break; - - default: - ret = -EOPNOTSUPP; - break; - } - -out: - if (ret == 0) { - if (updated) - set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags); -#if (NEW_MV8686_PS == 1) - //printk("%s: call lbs_postpone_association_work\n", __func__); - lbs_postpone_association_work(priv); -#endif - } else if (ret != -EOPNOTSUPP) { - lbs_cancel_association_work(priv); - } - mutex_unlock(&priv->lock); - - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -static int lbs_get_auth(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *dwrq, - char *extra) -{ - int ret = 0; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - - lbs_deb_enter(LBS_DEB_WEXT); - - switch (dwrq->flags & IW_AUTH_INDEX) { - case IW_AUTH_KEY_MGMT: - dwrq->value = priv->secinfo.key_mgmt; - break; - - case IW_AUTH_WPA_VERSION: - dwrq->value = 0; - if (priv->secinfo.WPAenabled) - dwrq->value |= IW_AUTH_WPA_VERSION_WPA; - if (priv->secinfo.WPA2enabled) - dwrq->value |= IW_AUTH_WPA_VERSION_WPA2; - if (!dwrq->value) - dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED; - break; - - case IW_AUTH_80211_AUTH_ALG: - dwrq->value = priv->secinfo.auth_mode; - break; - - case IW_AUTH_WPA_ENABLED: - if (priv->secinfo.WPAenabled && priv->secinfo.WPA2enabled) - dwrq->value = 1; - break; - - default: - ret = -EOPNOTSUPP; - } - - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - - -static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - int ret = 0; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - s16 dbm = (s16) vwrq->value; - - lbs_deb_enter(LBS_DEB_WEXT); - - if (vwrq->disabled) { - lbs_set_radio(priv, RADIO_PREAMBLE_AUTO, 0); - goto out; - } - - if (vwrq->fixed == 0) { - /* User requests automatic tx power control, however there are - * many auto tx settings. For now use firmware defaults until - * we come up with a good way to expose these to the user. */ - if (priv->fwrelease < 0x09000000) { - ret = lbs_set_power_adapt_cfg(priv, 1, - POW_ADAPT_DEFAULT_P0, - POW_ADAPT_DEFAULT_P1, - POW_ADAPT_DEFAULT_P2); - if (ret) - goto out; - } - ret = lbs_set_tpc_cfg(priv, 0, TPC_DEFAULT_P0, TPC_DEFAULT_P1, - TPC_DEFAULT_P2, 1); - if (ret) - goto out; - dbm = priv->txpower_max; - } else { - /* Userspace check in iwrange if it should use dBm or mW, - * therefore this should never happen... Jean II */ - if ((vwrq->flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) { - ret = -EOPNOTSUPP; - goto out; - } - - /* Validate requested power level against firmware allowed - * levels */ - if (priv->txpower_min && (dbm < priv->txpower_min)) { - ret = -EINVAL; - goto out; - } - - if (priv->txpower_max && (dbm > priv->txpower_max)) { - ret = -EINVAL; - goto out; - } - if (priv->fwrelease < 0x09000000) { - ret = lbs_set_power_adapt_cfg(priv, 0, - POW_ADAPT_DEFAULT_P0, - POW_ADAPT_DEFAULT_P1, - POW_ADAPT_DEFAULT_P2); - if (ret) - goto out; - } - ret = lbs_set_tpc_cfg(priv, 0, TPC_DEFAULT_P0, TPC_DEFAULT_P1, - TPC_DEFAULT_P2, 1); - if (ret) - goto out; - } - - /* If the radio was off, turn it on */ - if (!priv->radio_on) { - ret = lbs_set_radio(priv, RADIO_PREAMBLE_AUTO, 1); - if (ret) - goto out; - } - - lbs_deb_wext("txpower set %d dBm\n", dbm); - - ret = lbs_set_tx_power(priv, dbm); - -out: - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - - lbs_deb_enter(LBS_DEB_WEXT); - - /* - * Note : if dwrq->flags != 0, we should get the relevant SSID from - * the SSID list... - */ - - /* - * Get the current SSID - */ - if (priv->connect_status == LBS_CONNECTED) { - memcpy(extra, priv->curbssparams.ssid, - priv->curbssparams.ssid_len); - extra[priv->curbssparams.ssid_len] = '\0'; - } else { - memset(extra, 0, IW_ESSID_MAX_SIZE); - extra[priv->curbssparams.ssid_len] = '\0'; - } - /* - * If none, we may want to get the one that was set - */ - - dwrq->length = priv->curbssparams.ssid_len; - - dwrq->flags = 1; /* active */ - - lbs_deb_leave(LBS_DEB_WEXT); - return 0; -} - -static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - int ret = 0; - u8 ssid[IW_ESSID_MAX_SIZE]; - u8 ssid_len = 0; - struct assoc_request * assoc_req; - int in_ssid_len = dwrq->length; - DECLARE_SSID_BUF(ssid_buf); - - lbs_deb_enter(LBS_DEB_WEXT); - - if (!priv->radio_on) { - ret = -EINVAL; - goto out; - } - - /* Check the size of the string */ - if (in_ssid_len > IW_ESSID_MAX_SIZE) { - ret = -E2BIG; - goto out; - } - - memset(&ssid, 0, sizeof(ssid)); - - if (!dwrq->flags || !in_ssid_len) { - /* "any" SSID requested; leave SSID blank */ - } else { - /* Specific SSID requested */ -#if 0 - int i; - - printk("%s: Request SSID: ", __func__); - for (i = 0; i < in_ssid_len; i++) - { - printk("%2.2x ", extra[i]); - } - printk("\n"); -#endif - memcpy(&ssid, extra, in_ssid_len); - ssid_len = in_ssid_len; - } - - if (!ssid_len) { - lbs_deb_wext("requested any SSID\n"); - } else { - lbs_deb_wext("requested SSID '%s'\n", - mv8686_print_ssid(ssid_buf, ssid, ssid_len)); - } - -out: - mutex_lock(&priv->lock); - if (ret == 0) { - /* Get or create the current association request */ - assoc_req = lbs_get_association_request(priv); - if (!assoc_req) { - ret = -ENOMEM; - } else { - /* Copy the SSID to the association request */ - memcpy(&assoc_req->ssid, &ssid, IW_ESSID_MAX_SIZE); - assoc_req->ssid_len = ssid_len; - set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); - //printk("%s: call lbs_postpone_association_work\n", __func__); - lbs_postpone_association_work(priv); - } - } - - /* Cancel the association request if there was an error */ - if (ret != 0) { - lbs_cancel_association_work(priv); - } - - mutex_unlock(&priv->lock); - - lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret); - return ret; -} - -/** - * @brief Connect to the AP or Ad-hoc Network with specific bssid - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param awrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * @return 0 --success, otherwise fail - */ -static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info, - struct sockaddr *awrq, char *extra) -{ - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - struct assoc_request * assoc_req; - int ret = 0; - - lbs_deb_enter(LBS_DEB_WEXT); - - if (!priv->radio_on) - return -EINVAL; - - if (awrq->sa_family != ARPHRD_ETHER) - return -EINVAL; - - lbs_deb_wext("ASSOC: WAP: sa_data %pM\n", awrq->sa_data); - - mutex_lock(&priv->lock); - - /* Get or create the current association request */ - assoc_req = lbs_get_association_request(priv); - if (!assoc_req) { - lbs_cancel_association_work(priv); - ret = -ENOMEM; - } else { - /* Copy the BSSID to the association request */ - memcpy(&assoc_req->bssid, awrq->sa_data, ETH_ALEN); - set_bit(ASSOC_FLAG_BSSID, &assoc_req->flags); - //printk("%s: call lbs_postpone_association_work\n", __func__); - lbs_postpone_association_work(priv); - } - - mutex_unlock(&priv->lock); - - return ret; -} - -#if (NEW_MV8686_PS == 1) -static int mv8686_set_mlme(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - int ret; - struct lbs_private *priv = GET_PRIV_FROM_NETDEV(dev); - struct iw_mlme *mlme = (struct iw_mlme *) extra; - - if ((mlme->cmd == IW_MLME_DEAUTH) || (mlme->cmd == IW_MLME_DISASSOC)) - { - printk("%s: Customer want to disconnect WiFi.\n", __func__); - priv->needto_notify_upper = 1; - - ret = lbs_cmd_80211_deauthenticate(priv, - priv->curbssparams.bssid, - WLAN_REASON_DEAUTH_LEAVING); - if (ret) - printk("%s: deauthenticate fail.\n", __func__); - } - - return 0; -} -#endif - -/* - * iwconfig settable callbacks - */ -static const iw_handler lbs_handler[] = -{ - (iw_handler) NULL, /* SIOCSIWCOMMIT */ - (iw_handler) lbs_get_name, /* SIOCGIWNAME */ - (iw_handler) NULL, /* SIOCSIWNWID */ - (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) lbs_set_freq, /* SIOCSIWFREQ */ - (iw_handler) lbs_get_freq, /* SIOCGIWFREQ */ - (iw_handler) lbs_set_mode, /* SIOCSIWMODE */ - (iw_handler) lbs_get_mode, /* SIOCGIWMODE */ - (iw_handler) NULL, /* SIOCSIWSENS */ - (iw_handler) lbs_get_sense, /* SIOCGIWSENS */ - (iw_handler) NULL, /* SIOCSIWRANGE */ - (iw_handler) lbs_get_range, /* SIOCGIWRANGE */ - (iw_handler) NULL, /* SIOCSIWPRIV */ - (iw_handler) NULL, /* SIOCGIWPRIV */ - (iw_handler) NULL, /* SIOCSIWSTATS */ - (iw_handler) NULL, /* SIOCGIWSTATS */ - iw_handler_set_spy, /* SIOCSIWSPY */ - iw_handler_get_spy, /* SIOCGIWSPY */ - iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ - iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ - (iw_handler) lbs_set_wap, /* SIOCSIWAP */ - (iw_handler) lbs_get_wap, /* SIOCGIWAP */ -#if (NEW_MV8686_PS == 1) - (iw_handler) mv8686_set_mlme, /* SIOCSIWMLME */ -#else - (iw_handler) NULL, /* SIOCSIWMLME */ -#endif - (iw_handler) NULL, /* SIOCGIWAPLIST - deprecated */ - (iw_handler) lbs_set_scan, /* SIOCSIWSCAN */ - (iw_handler) lbs_get_scan, /* SIOCGIWSCAN */ - (iw_handler) lbs_set_essid, /* SIOCSIWESSID */ - (iw_handler) lbs_get_essid, /* SIOCGIWESSID */ - (iw_handler) lbs_set_nick, /* SIOCSIWNICKN */ - (iw_handler) lbs_get_nick, /* SIOCGIWNICKN */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) lbs_set_rate, /* SIOCSIWRATE */ - (iw_handler) lbs_get_rate, /* SIOCGIWRATE */ - (iw_handler) lbs_set_rts, /* SIOCSIWRTS */ - (iw_handler) lbs_get_rts, /* SIOCGIWRTS */ - (iw_handler) lbs_set_frag, /* SIOCSIWFRAG */ - (iw_handler) lbs_get_frag, /* SIOCGIWFRAG */ - (iw_handler) lbs_set_txpow, /* SIOCSIWTXPOW */ - (iw_handler) lbs_get_txpow, /* SIOCGIWTXPOW */ - (iw_handler) lbs_set_retry, /* SIOCSIWRETRY */ - (iw_handler) lbs_get_retry, /* SIOCGIWRETRY */ - (iw_handler) lbs_set_encode, /* SIOCSIWENCODE */ - (iw_handler) lbs_get_encode, /* SIOCGIWENCODE */ - (iw_handler) lbs_set_power, /* SIOCSIWPOWER */ - (iw_handler) lbs_get_power, /* SIOCGIWPOWER */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) lbs_set_genie, /* SIOCSIWGENIE */ - (iw_handler) lbs_get_genie, /* SIOCGIWGENIE */ - (iw_handler) lbs_set_auth, /* SIOCSIWAUTH */ - (iw_handler) lbs_get_auth, /* SIOCGIWAUTH */ - (iw_handler) lbs_set_encodeext,/* SIOCSIWENCODEEXT */ - (iw_handler) lbs_get_encodeext,/* SIOCGIWENCODEEXT */ - (iw_handler) NULL, /* SIOCSIWPMKSA */ -}; - -/* - * iwpriv settable callbacks - */ - -static const iw_handler lbs_private_handler[] = -{ - NULL, /* SIOCIWFIRSTPRIV */ -}; - -/* cmd set_arg get_arg name */ -static const struct iw_priv_args lbs_private_args[] = -{ - { - WLANDEEPSLEEP, - IW_PRIV_TYPE_CHAR | 1, - IW_PRIV_TYPE_CHAR | 6, - "deepsleep"}, - { - WLAN_SETONEINT_GETONEINT, - IW_PRIV_TYPE_INT | 1, - IW_PRIV_TYPE_INT | 1, - ""}, - { - WLAN_AUTODEEPSLEEP, - IW_PRIV_TYPE_INT | 1, - IW_PRIV_TYPE_INT | 1, - "autodeepsleep"}, -}; - -struct iw_handler_def lbs_handler_def = -{ - .num_standard = ARRAY_SIZE(lbs_handler), - .num_private = sizeof(lbs_private_handler) / sizeof(iw_handler), - .num_private_args = sizeof(lbs_private_args) / - sizeof(struct iw_priv_args), - - .standard = (iw_handler *) lbs_handler, - .private = (iw_handler *) lbs_private_handler, - .private_args = (struct iw_priv_args *) lbs_private_args, - - .get_wireless_stats = lbs_get_wireless_stats, -}; diff --git a/drivers/net/wireless/mv8686/wext.h b/drivers/net/wireless/mv8686/wext.h deleted file mode 100755 index 4c08db497606..000000000000 --- a/drivers/net/wireless/mv8686/wext.h +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file contains definition for IOCTL call. - */ -#ifndef _LBS_WEXT_H_ -#define _LBS_WEXT_H_ - -extern struct iw_handler_def lbs_handler_def; -extern struct iw_handler_def mesh_handler_def; - -#endif diff --git a/drivers/net/wireless/mv8686/wifi_power.h b/drivers/net/wireless/mv8686/wifi_power.h deleted file mode 120000 index 4ca35061c536..000000000000 --- a/drivers/net/wireless/mv8686/wifi_power.h +++ /dev/null @@ -1 +0,0 @@ -../wifi_power/wifi_power.h \ No newline at end of file diff --git a/drivers/net/wireless/mv8686/wifi_version.h b/drivers/net/wireless/mv8686/wifi_version.h deleted file mode 120000 index 5c652aef0bf4..000000000000 --- a/drivers/net/wireless/mv8686/wifi_version.h +++ /dev/null @@ -1 +0,0 @@ -../wifi_power/wifi_version.h \ No newline at end of file diff --git a/drivers/net/wireless/mwifiex/11ac.c b/drivers/net/wireless/mwifiex/11ac.c deleted file mode 100644 index 5e0eec4d71c7..000000000000 --- a/drivers/net/wireless/mwifiex/11ac.c +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Marvell Wireless LAN device driver: 802.11ac - * - * Copyright (C) 2013, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "fw.h" -#include "main.h" -#include "11ac.h" - -/* This function converts the 2-bit MCS map to the highest long GI - * VHT data rate. - */ -static u16 -mwifiex_convert_mcsmap_to_maxrate(struct mwifiex_private *priv, - u8 bands, u16 mcs_map) -{ - u8 i, nss, max_mcs; - u16 max_rate = 0; - u32 usr_vht_cap_info = 0; - struct mwifiex_adapter *adapter = priv->adapter; - /* tables of the MCS map to the highest data rate (in Mbps) - * supported for long GI - */ - u16 max_rate_lgi_80MHZ[8][3] = { - {0x124, 0x15F, 0x186}, /* NSS = 1 */ - {0x249, 0x2BE, 0x30C}, /* NSS = 2 */ - {0x36D, 0x41D, 0x492}, /* NSS = 3 */ - {0x492, 0x57C, 0x618}, /* NSS = 4 */ - {0x5B6, 0x6DB, 0x79E}, /* NSS = 5 */ - {0x6DB, 0x83A, 0x0}, /* NSS = 6 */ - {0x7FF, 0x999, 0xAAA}, /* NSS = 7 */ - {0x924, 0xAF8, 0xC30} /* NSS = 8 */ - }; - u16 max_rate_lgi_160MHZ[8][3] = { - {0x249, 0x2BE, 0x30C}, /* NSS = 1 */ - {0x492, 0x57C, 0x618}, /* NSS = 2 */ - {0x6DB, 0x83A, 0x0}, /* NSS = 3 */ - {0x924, 0xAF8, 0xC30}, /* NSS = 4 */ - {0xB6D, 0xDB6, 0xF3C}, /* NSS = 5 */ - {0xDB6, 0x1074, 0x1248}, /* NSS = 6 */ - {0xFFF, 0x1332, 0x1554}, /* NSS = 7 */ - {0x1248, 0x15F0, 0x1860} /* NSS = 8 */ - }; - - if (bands & BAND_AAC) - usr_vht_cap_info = adapter->usr_dot_11ac_dev_cap_a; - else - usr_vht_cap_info = adapter->usr_dot_11ac_dev_cap_bg; - - /* find the max NSS supported */ - nss = 0; - for (i = 0; i < 8; i++) { - max_mcs = (mcs_map >> (2 * i)) & 0x3; - if (max_mcs < 3) - nss = i; - } - max_mcs = (mcs_map >> (2 * nss)) & 0x3; - - /* if max_mcs is 3, nss must be 0 (SS = 1). Thus, max mcs is MCS 9 */ - if (max_mcs >= 3) - max_mcs = 2; - - if (GET_VHTCAP_CHWDSET(usr_vht_cap_info)) { - /* support 160 MHz */ - max_rate = max_rate_lgi_160MHZ[nss][max_mcs]; - if (!max_rate) - /* MCS9 is not supported in NSS6 */ - max_rate = max_rate_lgi_160MHZ[nss][max_mcs - 1]; - } else { - max_rate = max_rate_lgi_80MHZ[nss][max_mcs]; - if (!max_rate) - /* MCS9 is not supported in NSS3 */ - max_rate = max_rate_lgi_80MHZ[nss][max_mcs - 1]; - } - - return max_rate; -} - -static void -mwifiex_fill_vht_cap_info(struct mwifiex_private *priv, - struct mwifiex_ie_types_vhtcap *vht_cap, u8 bands) -{ - struct mwifiex_adapter *adapter = priv->adapter; - - if (bands & BAND_A) - vht_cap->vht_cap.vht_cap_info = - cpu_to_le32(adapter->usr_dot_11ac_dev_cap_a); - else - vht_cap->vht_cap.vht_cap_info = - cpu_to_le32(adapter->usr_dot_11ac_dev_cap_bg); -} - -static void -mwifiex_fill_vht_cap_tlv(struct mwifiex_private *priv, - struct mwifiex_ie_types_vhtcap *vht_cap, u8 bands) -{ - struct mwifiex_adapter *adapter = priv->adapter; - u16 mcs_map_user, mcs_map_resp, mcs_map_result; - u16 mcs_user, mcs_resp, nss, tmp; - - /* Fill VHT cap info */ - mwifiex_fill_vht_cap_info(priv, vht_cap, bands); - - /* rx MCS Set: find the minimum of the user rx mcs and ap rx mcs */ - mcs_map_user = GET_DEVRXMCSMAP(adapter->usr_dot_11ac_mcs_support); - mcs_map_resp = le16_to_cpu(vht_cap->vht_cap.supp_mcs.rx_mcs_map); - mcs_map_result = 0; - - for (nss = 1; nss <= 8; nss++) { - mcs_user = GET_VHTNSSMCS(mcs_map_user, nss); - mcs_resp = GET_VHTNSSMCS(mcs_map_resp, nss); - - if ((mcs_user == NO_NSS_SUPPORT) || - (mcs_resp == NO_NSS_SUPPORT)) - SET_VHTNSSMCS(mcs_map_result, nss, NO_NSS_SUPPORT); - else - SET_VHTNSSMCS(mcs_map_result, nss, - min(mcs_user, mcs_resp)); - } - - vht_cap->vht_cap.supp_mcs.rx_mcs_map = cpu_to_le16(mcs_map_result); - - tmp = mwifiex_convert_mcsmap_to_maxrate(priv, bands, mcs_map_result); - vht_cap->vht_cap.supp_mcs.rx_highest = cpu_to_le16(tmp); - - /* tx MCS Set: find the minimum of the user tx mcs and ap tx mcs */ - mcs_map_user = GET_DEVTXMCSMAP(adapter->usr_dot_11ac_mcs_support); - mcs_map_resp = le16_to_cpu(vht_cap->vht_cap.supp_mcs.tx_mcs_map); - mcs_map_result = 0; - - for (nss = 1; nss <= 8; nss++) { - mcs_user = GET_VHTNSSMCS(mcs_map_user, nss); - mcs_resp = GET_VHTNSSMCS(mcs_map_resp, nss); - if ((mcs_user == NO_NSS_SUPPORT) || - (mcs_resp == NO_NSS_SUPPORT)) - SET_VHTNSSMCS(mcs_map_result, nss, NO_NSS_SUPPORT); - else - SET_VHTNSSMCS(mcs_map_result, nss, - min(mcs_user, mcs_resp)); - } - - vht_cap->vht_cap.supp_mcs.tx_mcs_map = cpu_to_le16(mcs_map_result); - - tmp = mwifiex_convert_mcsmap_to_maxrate(priv, bands, mcs_map_result); - vht_cap->vht_cap.supp_mcs.tx_highest = cpu_to_le16(tmp); - - return; -} - -int mwifiex_cmd_append_11ac_tlv(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc, - u8 **buffer) -{ - struct mwifiex_ie_types_vhtcap *vht_cap; - struct mwifiex_ie_types_oper_mode_ntf *oper_ntf; - struct ieee_types_oper_mode_ntf *ieee_oper_ntf; - struct mwifiex_ie_types_vht_oper *vht_op; - struct mwifiex_adapter *adapter = priv->adapter; - u8 supp_chwd_set; - u32 usr_vht_cap_info; - int ret_len = 0; - - if (bss_desc->bss_band & BAND_A) - usr_vht_cap_info = adapter->usr_dot_11ac_dev_cap_a; - else - usr_vht_cap_info = adapter->usr_dot_11ac_dev_cap_bg; - - /* VHT Capabilities IE */ - if (bss_desc->bcn_vht_cap) { - vht_cap = (struct mwifiex_ie_types_vhtcap *)*buffer; - memset(vht_cap, 0, sizeof(*vht_cap)); - vht_cap->header.type = cpu_to_le16(WLAN_EID_VHT_CAPABILITY); - vht_cap->header.len = - cpu_to_le16(sizeof(struct ieee80211_vht_cap)); - memcpy((u8 *)vht_cap + sizeof(struct mwifiex_ie_types_header), - (u8 *)bss_desc->bcn_vht_cap + - sizeof(struct ieee_types_header), - le16_to_cpu(vht_cap->header.len)); - - mwifiex_fill_vht_cap_tlv(priv, vht_cap, bss_desc->bss_band); - *buffer += sizeof(*vht_cap); - ret_len += sizeof(*vht_cap); - } - - /* VHT Operation IE */ - if (bss_desc->bcn_vht_oper) { - if (priv->bss_mode == NL80211_IFTYPE_STATION) { - vht_op = (struct mwifiex_ie_types_vht_oper *)*buffer; - memset(vht_op, 0, sizeof(*vht_op)); - vht_op->header.type = - cpu_to_le16(WLAN_EID_VHT_OPERATION); - vht_op->header.len = cpu_to_le16(sizeof(*vht_op) - - sizeof(struct mwifiex_ie_types_header)); - memcpy((u8 *)vht_op + - sizeof(struct mwifiex_ie_types_header), - (u8 *)bss_desc->bcn_vht_oper + - sizeof(struct ieee_types_header), - le16_to_cpu(vht_op->header.len)); - - /* negotiate the channel width and central freq - * and keep the central freq as the peer suggests - */ - supp_chwd_set = GET_VHTCAP_CHWDSET(usr_vht_cap_info); - - switch (supp_chwd_set) { - case 0: - vht_op->chan_width = - min_t(u8, IEEE80211_VHT_CHANWIDTH_80MHZ, - bss_desc->bcn_vht_oper->chan_width); - break; - case 1: - vht_op->chan_width = - min_t(u8, IEEE80211_VHT_CHANWIDTH_160MHZ, - bss_desc->bcn_vht_oper->chan_width); - break; - case 2: - vht_op->chan_width = - min_t(u8, IEEE80211_VHT_CHANWIDTH_80P80MHZ, - bss_desc->bcn_vht_oper->chan_width); - break; - default: - vht_op->chan_width = - IEEE80211_VHT_CHANWIDTH_USE_HT; - break; - } - - *buffer += sizeof(*vht_op); - ret_len += sizeof(*vht_op); - } - } - - /* Operating Mode Notification IE */ - if (bss_desc->oper_mode) { - ieee_oper_ntf = bss_desc->oper_mode; - oper_ntf = (void *)*buffer; - memset(oper_ntf, 0, sizeof(*oper_ntf)); - oper_ntf->header.type = cpu_to_le16(WLAN_EID_OPMODE_NOTIF); - oper_ntf->header.len = cpu_to_le16(sizeof(u8)); - oper_ntf->oper_mode = ieee_oper_ntf->oper_mode; - *buffer += sizeof(*oper_ntf); - ret_len += sizeof(*oper_ntf); - } - - return ret_len; -} - -int mwifiex_cmd_11ac_cfg(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, u16 cmd_action, - struct mwifiex_11ac_vht_cfg *cfg) -{ - struct host_cmd_11ac_vht_cfg *vhtcfg = &cmd->params.vht_cfg; - - cmd->command = cpu_to_le16(HostCmd_CMD_11AC_CFG); - cmd->size = cpu_to_le16(sizeof(struct host_cmd_11ac_vht_cfg) + - S_DS_GEN); - vhtcfg->action = cpu_to_le16(cmd_action); - vhtcfg->band_config = cfg->band_config; - vhtcfg->misc_config = cfg->misc_config; - vhtcfg->cap_info = cpu_to_le32(cfg->cap_info); - vhtcfg->mcs_tx_set = cpu_to_le32(cfg->mcs_tx_set); - vhtcfg->mcs_rx_set = cpu_to_le32(cfg->mcs_rx_set); - - return 0; -} - -/* This function initializes the BlockACK setup information for given - * mwifiex_private structure for 11ac enabled networks. - */ -void mwifiex_set_11ac_ba_params(struct mwifiex_private *priv) -{ - priv->add_ba_param.timeout = MWIFIEX_DEFAULT_BLOCK_ACK_TIMEOUT; - - if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) { - priv->add_ba_param.tx_win_size = - MWIFIEX_11AC_UAP_AMPDU_DEF_TXWINSIZE; - priv->add_ba_param.rx_win_size = - MWIFIEX_11AC_UAP_AMPDU_DEF_RXWINSIZE; - } else { - priv->add_ba_param.tx_win_size = - MWIFIEX_11AC_STA_AMPDU_DEF_TXWINSIZE; - priv->add_ba_param.rx_win_size = - MWIFIEX_11AC_STA_AMPDU_DEF_RXWINSIZE; - } - - return; -} diff --git a/drivers/net/wireless/mwifiex/11ac.h b/drivers/net/wireless/mwifiex/11ac.h deleted file mode 100644 index 7c2c69b5b3eb..000000000000 --- a/drivers/net/wireless/mwifiex/11ac.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Marvell Wireless LAN device driver: 802.11ac - * - * Copyright (C) 2013, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef _MWIFIEX_11AC_H_ -#define _MWIFIEX_11AC_H_ - -#define VHT_CFG_2GHZ BIT(0) -#define VHT_CFG_5GHZ BIT(1) - -enum vht_cfg_misc_config { - VHT_CAP_TX_OPERATION = 1, - VHT_CAP_ASSOCIATION, - VHT_CAP_UAP_ONLY -}; - -#define DEFAULT_VHT_MCS_SET 0xfffa -#define DISABLE_VHT_MCS_SET 0xffff - -#define VHT_BW_80_160_80P80 BIT(2) - -int mwifiex_cmd_append_11ac_tlv(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc, - u8 **buffer); -int mwifiex_cmd_11ac_cfg(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, u16 cmd_action, - struct mwifiex_11ac_vht_cfg *cfg); -#endif /* _MWIFIEX_11AC_H_ */ diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c deleted file mode 100644 index 41e9d25a2d8e..000000000000 --- a/drivers/net/wireless/mwifiex/11n.c +++ /dev/null @@ -1,703 +0,0 @@ -/* - * Marvell Wireless LAN device driver: 802.11n - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" -#include "11n.h" - -/* - * Fills HT capability information field, AMPDU Parameters field, HT extended - * capability field, and supported MCS set fields. - * - * HT capability information field, AMPDU Parameters field, supported MCS set - * fields are retrieved from cfg80211 stack - * - * RD responder bit to set to clear in the extended capability header. - */ -void -mwifiex_fill_cap_info(struct mwifiex_private *priv, u8 radio_type, - struct mwifiex_ie_types_htcap *ht_cap) -{ - uint16_t ht_ext_cap = le16_to_cpu(ht_cap->ht_cap.extended_ht_cap_info); - struct ieee80211_supported_band *sband = - priv->wdev->wiphy->bands[radio_type]; - - ht_cap->ht_cap.ampdu_params_info = - (sband->ht_cap.ampdu_factor & - IEEE80211_HT_AMPDU_PARM_FACTOR) | - ((sband->ht_cap.ampdu_density << - IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT) & - IEEE80211_HT_AMPDU_PARM_DENSITY); - - memcpy((u8 *) &ht_cap->ht_cap.mcs, &sband->ht_cap.mcs, - sizeof(sband->ht_cap.mcs)); - - if (priv->bss_mode == NL80211_IFTYPE_STATION || - (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 && - (priv->adapter->sec_chan_offset != - IEEE80211_HT_PARAM_CHA_SEC_NONE))) - /* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */ - SETHT_MCS32(ht_cap->ht_cap.mcs.rx_mask); - - /* Clear RD responder bit */ - ht_ext_cap &= ~IEEE80211_HT_EXT_CAP_RD_RESPONDER; - - ht_cap->ht_cap.cap_info = cpu_to_le16(sband->ht_cap.cap); - ht_cap->ht_cap.extended_ht_cap_info = cpu_to_le16(ht_ext_cap); -} - -/* - * This function returns the pointer to an entry in BA Stream - * table which matches the requested BA status. - */ -static struct mwifiex_tx_ba_stream_tbl * -mwifiex_get_ba_status(struct mwifiex_private *priv, - enum mwifiex_ba_status ba_status) -{ - struct mwifiex_tx_ba_stream_tbl *tx_ba_tsr_tbl; - unsigned long flags; - - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); - list_for_each_entry(tx_ba_tsr_tbl, &priv->tx_ba_stream_tbl_ptr, list) { - if (tx_ba_tsr_tbl->ba_status == ba_status) { - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, - flags); - return tx_ba_tsr_tbl; - } - } - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); - return NULL; -} - -/* - * This function handles the command response of delete a block - * ack request. - * - * The function checks the response success status and takes action - * accordingly (send an add BA request in case of success, or recreate - * the deleted stream in case of failure, if the add BA was also - * initiated by us). - */ -int mwifiex_ret_11n_delba(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - int tid; - struct mwifiex_tx_ba_stream_tbl *tx_ba_tbl; - struct host_cmd_ds_11n_delba *del_ba = &resp->params.del_ba; - uint16_t del_ba_param_set = le16_to_cpu(del_ba->del_ba_param_set); - - tid = del_ba_param_set >> DELBA_TID_POS; - if (del_ba->del_result == BA_RESULT_SUCCESS) { - mwifiex_del_ba_tbl(priv, tid, del_ba->peer_mac_addr, - TYPE_DELBA_SENT, - INITIATOR_BIT(del_ba_param_set)); - - tx_ba_tbl = mwifiex_get_ba_status(priv, BA_SETUP_INPROGRESS); - if (tx_ba_tbl) - mwifiex_send_addba(priv, tx_ba_tbl->tid, - tx_ba_tbl->ra); - } else { /* - * In case of failure, recreate the deleted stream in case - * we initiated the ADDBA - */ - if (!INITIATOR_BIT(del_ba_param_set)) - return 0; - - mwifiex_create_ba_tbl(priv, del_ba->peer_mac_addr, tid, - BA_SETUP_INPROGRESS); - - tx_ba_tbl = mwifiex_get_ba_status(priv, BA_SETUP_INPROGRESS); - - if (tx_ba_tbl) - mwifiex_del_ba_tbl(priv, tx_ba_tbl->tid, tx_ba_tbl->ra, - TYPE_DELBA_SENT, true); - } - - return 0; -} - -/* - * This function handles the command response of add a block - * ack request. - * - * Handling includes changing the header fields to CPU formats, checking - * the response success status and taking actions accordingly (delete the - * BA stream table in case of failure). - */ -int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - int tid; - struct host_cmd_ds_11n_addba_rsp *add_ba_rsp = &resp->params.add_ba_rsp; - struct mwifiex_tx_ba_stream_tbl *tx_ba_tbl; - - add_ba_rsp->ssn = cpu_to_le16((le16_to_cpu(add_ba_rsp->ssn)) - & SSN_MASK); - - tid = (le16_to_cpu(add_ba_rsp->block_ack_param_set) - & IEEE80211_ADDBA_PARAM_TID_MASK) - >> BLOCKACKPARAM_TID_POS; - if (le16_to_cpu(add_ba_rsp->status_code) == BA_RESULT_SUCCESS) { - tx_ba_tbl = mwifiex_get_ba_tbl(priv, tid, - add_ba_rsp->peer_mac_addr); - if (tx_ba_tbl) { - dev_dbg(priv->adapter->dev, "info: BA stream complete\n"); - tx_ba_tbl->ba_status = BA_SETUP_COMPLETE; - } else { - dev_err(priv->adapter->dev, "BA stream not created\n"); - } - } else { - mwifiex_del_ba_tbl(priv, tid, add_ba_rsp->peer_mac_addr, - TYPE_DELBA_SENT, true); - if (add_ba_rsp->add_rsp_result != BA_RESULT_TIMEOUT) - priv->aggr_prio_tbl[tid].ampdu_ap = - BA_STREAM_NOT_ALLOWED; - } - - return 0; -} - -/* - * This function prepares command of reconfigure Tx buffer. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting Tx buffer size (for SET only) - * - Ensuring correct endian-ness - */ -int mwifiex_cmd_recfg_tx_buf(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, int cmd_action, - u16 *buf_size) -{ - struct host_cmd_ds_txbuf_cfg *tx_buf = &cmd->params.tx_buf; - u16 action = (u16) cmd_action; - - cmd->command = cpu_to_le16(HostCmd_CMD_RECONFIGURE_TX_BUFF); - cmd->size = - cpu_to_le16(sizeof(struct host_cmd_ds_txbuf_cfg) + S_DS_GEN); - tx_buf->action = cpu_to_le16(action); - switch (action) { - case HostCmd_ACT_GEN_SET: - dev_dbg(priv->adapter->dev, "cmd: set tx_buf=%d\n", *buf_size); - tx_buf->buff_size = cpu_to_le16(*buf_size); - break; - case HostCmd_ACT_GEN_GET: - default: - tx_buf->buff_size = 0; - break; - } - return 0; -} - -/* - * This function prepares command of AMSDU aggregation control. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting AMSDU control parameters (for SET only) - * - Ensuring correct endian-ness - */ -int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd, - int cmd_action, - struct mwifiex_ds_11n_amsdu_aggr_ctrl *aa_ctrl) -{ - struct host_cmd_ds_amsdu_aggr_ctrl *amsdu_ctrl = - &cmd->params.amsdu_aggr_ctrl; - u16 action = (u16) cmd_action; - - cmd->command = cpu_to_le16(HostCmd_CMD_AMSDU_AGGR_CTRL); - cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_amsdu_aggr_ctrl) - + S_DS_GEN); - amsdu_ctrl->action = cpu_to_le16(action); - switch (action) { - case HostCmd_ACT_GEN_SET: - amsdu_ctrl->enable = cpu_to_le16(aa_ctrl->enable); - amsdu_ctrl->curr_buf_size = 0; - break; - case HostCmd_ACT_GEN_GET: - default: - amsdu_ctrl->curr_buf_size = 0; - break; - } - return 0; -} - -/* - * This function prepares 11n configuration command. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting HT Tx capability and HT Tx information fields - * - Ensuring correct endian-ness - */ -int mwifiex_cmd_11n_cfg(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, u16 cmd_action, - struct mwifiex_ds_11n_tx_cfg *txcfg) -{ - struct host_cmd_ds_11n_cfg *htcfg = &cmd->params.htcfg; - - cmd->command = cpu_to_le16(HostCmd_CMD_11N_CFG); - cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_11n_cfg) + S_DS_GEN); - htcfg->action = cpu_to_le16(cmd_action); - htcfg->ht_tx_cap = cpu_to_le16(txcfg->tx_htcap); - htcfg->ht_tx_info = cpu_to_le16(txcfg->tx_htinfo); - - if (priv->adapter->is_hw_11ac_capable) - htcfg->misc_config = cpu_to_le16(txcfg->misc_config); - - return 0; -} - -/* - * This function appends an 11n TLV to a buffer. - * - * Buffer allocation is responsibility of the calling - * function. No size validation is made here. - * - * The function fills up the following sections, if applicable - - * - HT capability IE - * - HT information IE (with channel list) - * - 20/40 BSS Coexistence IE - * - HT Extended Capabilities IE - */ -int -mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc, - u8 **buffer) -{ - struct mwifiex_ie_types_htcap *ht_cap; - struct mwifiex_ie_types_htinfo *ht_info; - struct mwifiex_ie_types_chan_list_param_set *chan_list; - struct mwifiex_ie_types_2040bssco *bss_co_2040; - struct mwifiex_ie_types_extcap *ext_cap; - int ret_len = 0; - struct ieee80211_supported_band *sband; - u8 radio_type; - - if (!buffer || !*buffer) - return ret_len; - - radio_type = mwifiex_band_to_radio_type((u8) bss_desc->bss_band); - sband = priv->wdev->wiphy->bands[radio_type]; - - if (bss_desc->bcn_ht_cap) { - ht_cap = (struct mwifiex_ie_types_htcap *) *buffer; - memset(ht_cap, 0, sizeof(struct mwifiex_ie_types_htcap)); - ht_cap->header.type = cpu_to_le16(WLAN_EID_HT_CAPABILITY); - ht_cap->header.len = - cpu_to_le16(sizeof(struct ieee80211_ht_cap)); - memcpy((u8 *) ht_cap + sizeof(struct mwifiex_ie_types_header), - (u8 *) bss_desc->bcn_ht_cap + - sizeof(struct ieee_types_header), - le16_to_cpu(ht_cap->header.len)); - - mwifiex_fill_cap_info(priv, radio_type, ht_cap); - - *buffer += sizeof(struct mwifiex_ie_types_htcap); - ret_len += sizeof(struct mwifiex_ie_types_htcap); - } - - if (bss_desc->bcn_ht_oper) { - if (priv->bss_mode == NL80211_IFTYPE_ADHOC) { - ht_info = (struct mwifiex_ie_types_htinfo *) *buffer; - memset(ht_info, 0, - sizeof(struct mwifiex_ie_types_htinfo)); - ht_info->header.type = - cpu_to_le16(WLAN_EID_HT_OPERATION); - ht_info->header.len = - cpu_to_le16( - sizeof(struct ieee80211_ht_operation)); - - memcpy((u8 *) ht_info + - sizeof(struct mwifiex_ie_types_header), - (u8 *) bss_desc->bcn_ht_oper + - sizeof(struct ieee_types_header), - le16_to_cpu(ht_info->header.len)); - - if (!(sband->ht_cap.cap & - IEEE80211_HT_CAP_SUP_WIDTH_20_40)) - ht_info->ht_oper.ht_param &= - ~(IEEE80211_HT_PARAM_CHAN_WIDTH_ANY | - IEEE80211_HT_PARAM_CHA_SEC_OFFSET); - - *buffer += sizeof(struct mwifiex_ie_types_htinfo); - ret_len += sizeof(struct mwifiex_ie_types_htinfo); - } - - chan_list = - (struct mwifiex_ie_types_chan_list_param_set *) *buffer; - memset(chan_list, 0, - sizeof(struct mwifiex_ie_types_chan_list_param_set)); - chan_list->header.type = cpu_to_le16(TLV_TYPE_CHANLIST); - chan_list->header.len = cpu_to_le16( - sizeof(struct mwifiex_ie_types_chan_list_param_set) - - sizeof(struct mwifiex_ie_types_header)); - chan_list->chan_scan_param[0].chan_number = - bss_desc->bcn_ht_oper->primary_chan; - chan_list->chan_scan_param[0].radio_type = - mwifiex_band_to_radio_type((u8) bss_desc->bss_band); - - if (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 && - bss_desc->bcn_ht_oper->ht_param & - IEEE80211_HT_PARAM_CHAN_WIDTH_ANY) - SET_SECONDARYCHAN(chan_list->chan_scan_param[0]. - radio_type, - (bss_desc->bcn_ht_oper->ht_param & - IEEE80211_HT_PARAM_CHA_SEC_OFFSET)); - - *buffer += sizeof(struct mwifiex_ie_types_chan_list_param_set); - ret_len += sizeof(struct mwifiex_ie_types_chan_list_param_set); - } - - if (bss_desc->bcn_bss_co_2040) { - bss_co_2040 = (struct mwifiex_ie_types_2040bssco *) *buffer; - memset(bss_co_2040, 0, - sizeof(struct mwifiex_ie_types_2040bssco)); - bss_co_2040->header.type = cpu_to_le16(WLAN_EID_BSS_COEX_2040); - bss_co_2040->header.len = - cpu_to_le16(sizeof(bss_co_2040->bss_co_2040)); - - memcpy((u8 *) bss_co_2040 + - sizeof(struct mwifiex_ie_types_header), - bss_desc->bcn_bss_co_2040 + - sizeof(struct ieee_types_header), - le16_to_cpu(bss_co_2040->header.len)); - - *buffer += sizeof(struct mwifiex_ie_types_2040bssco); - ret_len += sizeof(struct mwifiex_ie_types_2040bssco); - } - - if (bss_desc->bcn_ext_cap) { - ext_cap = (struct mwifiex_ie_types_extcap *) *buffer; - memset(ext_cap, 0, sizeof(struct mwifiex_ie_types_extcap)); - ext_cap->header.type = cpu_to_le16(WLAN_EID_EXT_CAPABILITY); - ext_cap->header.len = cpu_to_le16(sizeof(ext_cap->ext_cap)); - - memcpy((u8 *)ext_cap + sizeof(struct mwifiex_ie_types_header), - bss_desc->bcn_ext_cap + sizeof(struct ieee_types_header), - le16_to_cpu(ext_cap->header.len)); - - *buffer += sizeof(struct mwifiex_ie_types_extcap); - ret_len += sizeof(struct mwifiex_ie_types_extcap); - } - - return ret_len; -} - -/* - * This function checks if the given pointer is valid entry of - * Tx BA Stream table. - */ -static int mwifiex_is_tx_ba_stream_ptr_valid(struct mwifiex_private *priv, - struct mwifiex_tx_ba_stream_tbl *tx_tbl_ptr) -{ - struct mwifiex_tx_ba_stream_tbl *tx_ba_tsr_tbl; - - list_for_each_entry(tx_ba_tsr_tbl, &priv->tx_ba_stream_tbl_ptr, list) { - if (tx_ba_tsr_tbl == tx_tbl_ptr) - return true; - } - - return false; -} - -/* - * This function deletes the given entry in Tx BA Stream table. - * - * The function also performs a validity check on the supplied - * pointer before trying to delete. - */ -void mwifiex_11n_delete_tx_ba_stream_tbl_entry(struct mwifiex_private *priv, - struct mwifiex_tx_ba_stream_tbl *tx_ba_tsr_tbl) -{ - if (!tx_ba_tsr_tbl && - mwifiex_is_tx_ba_stream_ptr_valid(priv, tx_ba_tsr_tbl)) - return; - - dev_dbg(priv->adapter->dev, "info: tx_ba_tsr_tbl %p\n", tx_ba_tsr_tbl); - - list_del(&tx_ba_tsr_tbl->list); - - kfree(tx_ba_tsr_tbl); -} - -/* - * This function deletes all the entries in Tx BA Stream table. - */ -void mwifiex_11n_delete_all_tx_ba_stream_tbl(struct mwifiex_private *priv) -{ - int i; - struct mwifiex_tx_ba_stream_tbl *del_tbl_ptr, *tmp_node; - unsigned long flags; - - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); - list_for_each_entry_safe(del_tbl_ptr, tmp_node, - &priv->tx_ba_stream_tbl_ptr, list) - mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv, del_tbl_ptr); - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); - - INIT_LIST_HEAD(&priv->tx_ba_stream_tbl_ptr); - - for (i = 0; i < MAX_NUM_TID; ++i) - priv->aggr_prio_tbl[i].ampdu_ap = - priv->aggr_prio_tbl[i].ampdu_user; -} - -/* - * This function returns the pointer to an entry in BA Stream - * table which matches the given RA/TID pair. - */ -struct mwifiex_tx_ba_stream_tbl * -mwifiex_get_ba_tbl(struct mwifiex_private *priv, int tid, u8 *ra) -{ - struct mwifiex_tx_ba_stream_tbl *tx_ba_tsr_tbl; - unsigned long flags; - - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); - list_for_each_entry(tx_ba_tsr_tbl, &priv->tx_ba_stream_tbl_ptr, list) { - if (!memcmp(tx_ba_tsr_tbl->ra, ra, ETH_ALEN) && - tx_ba_tsr_tbl->tid == tid) { - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, - flags); - return tx_ba_tsr_tbl; - } - } - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); - return NULL; -} - -/* - * This function creates an entry in Tx BA stream table for the - * given RA/TID pair. - */ -void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid, - enum mwifiex_ba_status ba_status) -{ - struct mwifiex_tx_ba_stream_tbl *new_node; - unsigned long flags; - - if (!mwifiex_get_ba_tbl(priv, tid, ra)) { - new_node = kzalloc(sizeof(struct mwifiex_tx_ba_stream_tbl), - GFP_ATOMIC); - if (!new_node) - return; - - INIT_LIST_HEAD(&new_node->list); - - new_node->tid = tid; - new_node->ba_status = ba_status; - memcpy(new_node->ra, ra, ETH_ALEN); - - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); - list_add_tail(&new_node->list, &priv->tx_ba_stream_tbl_ptr); - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); - } -} - -/* - * This function sends an add BA request to the given TID/RA pair. - */ -int mwifiex_send_addba(struct mwifiex_private *priv, int tid, u8 *peer_mac) -{ - struct host_cmd_ds_11n_addba_req add_ba_req; - static u8 dialog_tok; - int ret; - - dev_dbg(priv->adapter->dev, "cmd: %s: tid %d\n", __func__, tid); - - add_ba_req.block_ack_param_set = cpu_to_le16( - (u16) ((tid << BLOCKACKPARAM_TID_POS) | - (priv->add_ba_param. - tx_win_size << BLOCKACKPARAM_WINSIZE_POS) | - IMMEDIATE_BLOCK_ACK)); - add_ba_req.block_ack_tmo = cpu_to_le16((u16)priv->add_ba_param.timeout); - - ++dialog_tok; - - if (dialog_tok == 0) - dialog_tok = 1; - - add_ba_req.dialog_token = dialog_tok; - memcpy(&add_ba_req.peer_mac_addr, peer_mac, ETH_ALEN); - - /* We don't wait for the response of this command */ - ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_ADDBA_REQ, - 0, 0, &add_ba_req); - - return ret; -} - -/* - * This function sends a delete BA request to the given TID/RA pair. - */ -int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac, - int initiator) -{ - struct host_cmd_ds_11n_delba delba; - int ret; - uint16_t del_ba_param_set; - - memset(&delba, 0, sizeof(delba)); - delba.del_ba_param_set = cpu_to_le16(tid << DELBA_TID_POS); - - del_ba_param_set = le16_to_cpu(delba.del_ba_param_set); - if (initiator) - del_ba_param_set |= IEEE80211_DELBA_PARAM_INITIATOR_MASK; - else - del_ba_param_set &= ~IEEE80211_DELBA_PARAM_INITIATOR_MASK; - - memcpy(&delba.peer_mac_addr, peer_mac, ETH_ALEN); - - /* We don't wait for the response of this command */ - ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_DELBA, - HostCmd_ACT_GEN_SET, 0, &delba); - - return ret; -} - -/* - * This function handles the command response of a delete BA request. - */ -void mwifiex_11n_delete_ba_stream(struct mwifiex_private *priv, u8 *del_ba) -{ - struct host_cmd_ds_11n_delba *cmd_del_ba = - (struct host_cmd_ds_11n_delba *) del_ba; - uint16_t del_ba_param_set = le16_to_cpu(cmd_del_ba->del_ba_param_set); - int tid; - - tid = del_ba_param_set >> DELBA_TID_POS; - - mwifiex_del_ba_tbl(priv, tid, cmd_del_ba->peer_mac_addr, - TYPE_DELBA_RECEIVE, INITIATOR_BIT(del_ba_param_set)); -} - -/* - * This function retrieves the Rx reordering table. - */ -int mwifiex_get_rx_reorder_tbl(struct mwifiex_private *priv, - struct mwifiex_ds_rx_reorder_tbl *buf) -{ - int i; - struct mwifiex_ds_rx_reorder_tbl *rx_reo_tbl = buf; - struct mwifiex_rx_reorder_tbl *rx_reorder_tbl_ptr; - int count = 0; - unsigned long flags; - - spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); - list_for_each_entry(rx_reorder_tbl_ptr, &priv->rx_reorder_tbl_ptr, - list) { - rx_reo_tbl->tid = (u16) rx_reorder_tbl_ptr->tid; - memcpy(rx_reo_tbl->ta, rx_reorder_tbl_ptr->ta, ETH_ALEN); - rx_reo_tbl->start_win = rx_reorder_tbl_ptr->start_win; - rx_reo_tbl->win_size = rx_reorder_tbl_ptr->win_size; - for (i = 0; i < rx_reorder_tbl_ptr->win_size; ++i) { - if (rx_reorder_tbl_ptr->rx_reorder_ptr[i]) - rx_reo_tbl->buffer[i] = true; - else - rx_reo_tbl->buffer[i] = false; - } - rx_reo_tbl++; - count++; - - if (count >= MWIFIEX_MAX_RX_BASTREAM_SUPPORTED) - break; - } - spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); - - return count; -} - -/* - * This function retrieves the Tx BA stream table. - */ -int mwifiex_get_tx_ba_stream_tbl(struct mwifiex_private *priv, - struct mwifiex_ds_tx_ba_stream_tbl *buf) -{ - struct mwifiex_tx_ba_stream_tbl *tx_ba_tsr_tbl; - struct mwifiex_ds_tx_ba_stream_tbl *rx_reo_tbl = buf; - int count = 0; - unsigned long flags; - - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); - list_for_each_entry(tx_ba_tsr_tbl, &priv->tx_ba_stream_tbl_ptr, list) { - rx_reo_tbl->tid = (u16) tx_ba_tsr_tbl->tid; - dev_dbg(priv->adapter->dev, "data: %s tid=%d\n", - __func__, rx_reo_tbl->tid); - memcpy(rx_reo_tbl->ra, tx_ba_tsr_tbl->ra, ETH_ALEN); - rx_reo_tbl++; - count++; - if (count >= MWIFIEX_MAX_TX_BASTREAM_SUPPORTED) - break; - } - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); - - return count; -} - -/* - * This function retrieves the entry for specific tx BA stream table by RA and - * deletes it. - */ -void mwifiex_del_tx_ba_stream_tbl_by_ra(struct mwifiex_private *priv, u8 *ra) -{ - struct mwifiex_tx_ba_stream_tbl *tbl, *tmp; - unsigned long flags; - - if (!ra) - return; - - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); - list_for_each_entry_safe(tbl, tmp, &priv->tx_ba_stream_tbl_ptr, list) { - if (!memcmp(tbl->ra, ra, ETH_ALEN)) { - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, - flags); - mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv, tbl); - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); - } - } - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); - - return; -} - -/* This function initializes the BlockACK setup information for given - * mwifiex_private structure. - */ -void mwifiex_set_ba_params(struct mwifiex_private *priv) -{ - priv->add_ba_param.timeout = MWIFIEX_DEFAULT_BLOCK_ACK_TIMEOUT; - - if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) { - priv->add_ba_param.tx_win_size = - MWIFIEX_UAP_AMPDU_DEF_TXWINSIZE; - priv->add_ba_param.rx_win_size = - MWIFIEX_UAP_AMPDU_DEF_RXWINSIZE; - } else { - priv->add_ba_param.tx_win_size = - MWIFIEX_STA_AMPDU_DEF_TXWINSIZE; - priv->add_ba_param.rx_win_size = - MWIFIEX_STA_AMPDU_DEF_RXWINSIZE; - } - - return; -} diff --git a/drivers/net/wireless/mwifiex/11n.h b/drivers/net/wireless/mwifiex/11n.h deleted file mode 100644 index 375db01442bf..000000000000 --- a/drivers/net/wireless/mwifiex/11n.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Marvell Wireless LAN device driver: 802.11n - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef _MWIFIEX_11N_H_ -#define _MWIFIEX_11N_H_ - -#include "11n_aggr.h" -#include "11n_rxreorder.h" -#include "wmm.h" - -int mwifiex_ret_11n_delba(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp); -int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp); -int mwifiex_cmd_11n_cfg(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, u16 cmd_action, - struct mwifiex_ds_11n_tx_cfg *txcfg); -int mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc, - u8 **buffer); -void mwifiex_fill_cap_info(struct mwifiex_private *, u8 radio_type, - struct mwifiex_ie_types_htcap *); -int mwifiex_set_get_11n_htcap_cfg(struct mwifiex_private *priv, - u16 action, int *htcap_cfg); -void mwifiex_11n_delete_tx_ba_stream_tbl_entry(struct mwifiex_private *priv, - struct mwifiex_tx_ba_stream_tbl - *tx_tbl); -void mwifiex_11n_delete_all_tx_ba_stream_tbl(struct mwifiex_private *priv); -struct mwifiex_tx_ba_stream_tbl *mwifiex_get_ba_tbl(struct - mwifiex_private - *priv, int tid, - u8 *ra); -void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid, - enum mwifiex_ba_status ba_status); -int mwifiex_send_addba(struct mwifiex_private *priv, int tid, u8 *peer_mac); -int mwifiex_send_delba(struct mwifiex_private *priv, int tid, u8 *peer_mac, - int initiator); -void mwifiex_11n_delete_ba_stream(struct mwifiex_private *priv, u8 *del_ba); -int mwifiex_get_rx_reorder_tbl(struct mwifiex_private *priv, - struct mwifiex_ds_rx_reorder_tbl *buf); -int mwifiex_get_tx_ba_stream_tbl(struct mwifiex_private *priv, - struct mwifiex_ds_tx_ba_stream_tbl *buf); -int mwifiex_cmd_recfg_tx_buf(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - int cmd_action, u16 *buf_size); -int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd, - int cmd_action, - struct mwifiex_ds_11n_amsdu_aggr_ctrl *aa_ctrl); -void mwifiex_del_tx_ba_stream_tbl_by_ra(struct mwifiex_private *priv, u8 *ra); - -/* - * This function checks whether AMPDU is allowed or not for a particular TID. - */ -static inline u8 -mwifiex_is_ampdu_allowed(struct mwifiex_private *priv, int tid) -{ - return ((priv->aggr_prio_tbl[tid].ampdu_ap != BA_STREAM_NOT_ALLOWED) - ? true : false); -} - -/* - * This function checks whether AMSDU is allowed or not for a particular TID. - */ -static inline u8 -mwifiex_is_amsdu_allowed(struct mwifiex_private *priv, int tid) -{ - return (((priv->aggr_prio_tbl[tid].amsdu != BA_STREAM_NOT_ALLOWED) && - (priv->is_data_rate_auto || !(priv->bitmap_rates[2] & 0x03))) - ? true : false); -} - -/* - * This function checks whether a space is available for new BA stream or not. - */ -static inline u8 mwifiex_space_avail_for_new_ba_stream( - struct mwifiex_adapter *adapter) -{ - struct mwifiex_private *priv; - u8 i; - u32 ba_stream_num = 0; - - for (i = 0; i < adapter->priv_num; i++) { - priv = adapter->priv[i]; - if (priv) - ba_stream_num += mwifiex_wmm_list_len( - &priv->tx_ba_stream_tbl_ptr); - } - - return ((ba_stream_num < - MWIFIEX_MAX_TX_BASTREAM_SUPPORTED) ? true : false); -} - -/* - * This function finds the correct Tx BA stream to delete. - * - * Upon successfully locating, both the TID and the RA are returned. - */ -static inline u8 -mwifiex_find_stream_to_delete(struct mwifiex_private *priv, int ptr_tid, - int *ptid, u8 *ra) -{ - int tid; - u8 ret = false; - struct mwifiex_tx_ba_stream_tbl *tx_tbl; - unsigned long flags; - - tid = priv->aggr_prio_tbl[ptr_tid].ampdu_user; - - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); - list_for_each_entry(tx_tbl, &priv->tx_ba_stream_tbl_ptr, list) { - if (tid > priv->aggr_prio_tbl[tx_tbl->tid].ampdu_user) { - tid = priv->aggr_prio_tbl[tx_tbl->tid].ampdu_user; - *ptid = tx_tbl->tid; - memcpy(ra, tx_tbl->ra, ETH_ALEN); - ret = true; - } - } - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); - - return ret; -} - -/* - * This function checks whether BA stream is set up or not. - */ -static inline int -mwifiex_is_ba_stream_setup(struct mwifiex_private *priv, - struct mwifiex_ra_list_tbl *ptr, int tid) -{ - struct mwifiex_tx_ba_stream_tbl *tx_tbl; - - tx_tbl = mwifiex_get_ba_tbl(priv, tid, ptr->ra); - if (tx_tbl && IS_BASTREAM_SETUP(tx_tbl)) - return true; - - return false; -} - -/* - * This function checks whether associated station is 11n enabled - */ -static inline int mwifiex_is_sta_11n_enabled(struct mwifiex_private *priv, - struct mwifiex_sta_node *node) -{ - - if (!node || (priv->bss_role != MWIFIEX_BSS_ROLE_UAP) || - !priv->ap_11n_enabled) - return 0; - - return node->is_11n_enabled; -} -#endif /* !_MWIFIEX_11N_H_ */ diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c deleted file mode 100644 index d69d02435b6b..000000000000 --- a/drivers/net/wireless/mwifiex/11n_aggr.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Marvell Wireless LAN device driver: 802.11n Aggregation - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" -#include "11n.h" -#include "11n_aggr.h" - -/* - * Creates an AMSDU subframe for aggregation into one AMSDU packet. - * - * The resultant AMSDU subframe format is - - * - * +---- ~ -----+---- ~ ------+---- ~ -----+----- ~ -----+---- ~ -----+ - * | DA | SA | Length | SNAP header | MSDU | - * | data[0..5] | data[6..11] | | | data[14..] | - * +---- ~ -----+---- ~ ------+---- ~ -----+----- ~ -----+---- ~ -----+ - * <--6-bytes--> <--6-bytes--> <--2-bytes--><--8-bytes--> <--n-bytes--> - * - * This function also computes the amount of padding required to make the - * buffer length multiple of 4 bytes. - * - * Data => |DA|SA|SNAP-TYPE|........ .| - * MSDU => |DA|SA|Length|SNAP|...... ..| - */ -static int -mwifiex_11n_form_amsdu_pkt(struct sk_buff *skb_aggr, - struct sk_buff *skb_src, int *pad) - -{ - int dt_offset; - struct rfc_1042_hdr snap = { - 0xaa, /* LLC DSAP */ - 0xaa, /* LLC SSAP */ - 0x03, /* LLC CTRL */ - {0x00, 0x00, 0x00}, /* SNAP OUI */ - 0x0000 /* SNAP type */ - /* - * This field will be overwritten - * later with ethertype - */ - }; - struct tx_packet_hdr *tx_header; - - tx_header = (void *)skb_put(skb_aggr, sizeof(*tx_header)); - - /* Copy DA and SA */ - dt_offset = 2 * ETH_ALEN; - memcpy(&tx_header->eth803_hdr, skb_src->data, dt_offset); - - /* Copy SNAP header */ - snap.snap_type = *(u16 *) ((u8 *)skb_src->data + dt_offset); - dt_offset += sizeof(u16); - - memcpy(&tx_header->rfc1042_hdr, &snap, sizeof(struct rfc_1042_hdr)); - - skb_pull(skb_src, dt_offset); - - /* Update Length field */ - tx_header->eth803_hdr.h_proto = htons(skb_src->len + LLC_SNAP_LEN); - - /* Add payload */ - memcpy(skb_put(skb_aggr, skb_src->len), skb_src->data, skb_src->len); - - /* Add padding for new MSDU to start from 4 byte boundary */ - *pad = (4 - ((unsigned long)skb_aggr->tail & 0x3)) % 4; - - return skb_aggr->len + *pad; -} - -/* - * Adds TxPD to AMSDU header. - * - * Each AMSDU packet will contain one TxPD at the beginning, - * followed by multiple AMSDU subframes. - */ -static void -mwifiex_11n_form_amsdu_txpd(struct mwifiex_private *priv, - struct sk_buff *skb) -{ - struct txpd *local_tx_pd; - - skb_push(skb, sizeof(*local_tx_pd)); - - local_tx_pd = (struct txpd *) skb->data; - memset(local_tx_pd, 0, sizeof(struct txpd)); - - /* Original priority has been overwritten */ - local_tx_pd->priority = (u8) skb->priority; - local_tx_pd->pkt_delay_2ms = - mwifiex_wmm_compute_drv_pkt_delay(priv, skb); - local_tx_pd->bss_num = priv->bss_num; - local_tx_pd->bss_type = priv->bss_type; - /* Always zero as the data is followed by struct txpd */ - local_tx_pd->tx_pkt_offset = cpu_to_le16(sizeof(struct txpd)); - local_tx_pd->tx_pkt_type = cpu_to_le16(PKT_TYPE_AMSDU); - local_tx_pd->tx_pkt_length = cpu_to_le16(skb->len - - sizeof(*local_tx_pd)); - - if (local_tx_pd->tx_control == 0) - /* TxCtrl set by user or default */ - local_tx_pd->tx_control = cpu_to_le32(priv->pkt_tx_ctrl); - - if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA && - priv->adapter->pps_uapsd_mode) { - if (true == mwifiex_check_last_packet_indication(priv)) { - priv->adapter->tx_lock_flag = true; - local_tx_pd->flags = - MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET; - } - } -} - -/* - * Create aggregated packet. - * - * This function creates an aggregated MSDU packet, by combining buffers - * from the RA list. Each individual buffer is encapsulated as an AMSDU - * subframe and all such subframes are concatenated together to form the - * AMSDU packet. - * - * A TxPD is also added to the front of the resultant AMSDU packets for - * transmission. The resultant packets format is - - * - * +---- ~ ----+------ ~ ------+------ ~ ------+-..-+------ ~ ------+ - * | TxPD |AMSDU sub-frame|AMSDU sub-frame| .. |AMSDU sub-frame| - * | | 1 | 2 | .. | n | - * +---- ~ ----+------ ~ ------+------ ~ ------+ .. +------ ~ ------+ - */ -int -mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, - struct mwifiex_ra_list_tbl *pra_list, - int ptrindex, unsigned long ra_list_flags) - __releases(&priv->wmm.ra_list_spinlock) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct sk_buff *skb_aggr, *skb_src; - struct mwifiex_txinfo *tx_info_aggr, *tx_info_src; - int pad = 0, ret; - struct mwifiex_tx_param tx_param; - struct txpd *ptx_pd = NULL; - int headroom = adapter->iface_type == MWIFIEX_USB ? 0 : INTF_HEADER_LEN; - - skb_src = skb_peek(&pra_list->skb_head); - if (!skb_src) { - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, - ra_list_flags); - return 0; - } - - tx_info_src = MWIFIEX_SKB_TXCB(skb_src); - skb_aggr = dev_alloc_skb(adapter->tx_buf_size); - if (!skb_aggr) { - dev_err(adapter->dev, "%s: alloc skb_aggr\n", __func__); - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, - ra_list_flags); - return -1; - } - skb_reserve(skb_aggr, headroom + sizeof(struct txpd)); - tx_info_aggr = MWIFIEX_SKB_TXCB(skb_aggr); - - tx_info_aggr->bss_type = tx_info_src->bss_type; - tx_info_aggr->bss_num = tx_info_src->bss_num; - skb_aggr->priority = skb_src->priority; - - do { - /* Check if AMSDU can accommodate this MSDU */ - if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN)) - break; - - skb_src = skb_dequeue(&pra_list->skb_head); - - pra_list->total_pkts_size -= skb_src->len; - - atomic_dec(&priv->wmm.tx_pkts_queued); - - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, - ra_list_flags); - mwifiex_11n_form_amsdu_pkt(skb_aggr, skb_src, &pad); - - mwifiex_write_data_complete(adapter, skb_src, 0, 0); - - spin_lock_irqsave(&priv->wmm.ra_list_spinlock, ra_list_flags); - - if (!mwifiex_is_ralist_valid(priv, pra_list, ptrindex)) { - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, - ra_list_flags); - return -1; - } - - if (skb_tailroom(skb_aggr) < pad) { - pad = 0; - break; - } - skb_put(skb_aggr, pad); - - skb_src = skb_peek(&pra_list->skb_head); - - } while (skb_src); - - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags); - - /* Last AMSDU packet does not need padding */ - skb_trim(skb_aggr, skb_aggr->len - pad); - - /* Form AMSDU */ - mwifiex_11n_form_amsdu_txpd(priv, skb_aggr); - if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) - ptx_pd = (struct txpd *)skb_aggr->data; - - skb_push(skb_aggr, headroom); - - if (adapter->iface_type == MWIFIEX_USB) { - adapter->data_sent = true; - ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA, - skb_aggr, NULL); - } else { - /* - * Padding per MSDU will affect the length of next - * packet and hence the exact length of next packet - * is uncertain here. - * - * Also, aggregation of transmission buffer, while - * downloading the data to the card, wont gain much - * on the AMSDU packets as the AMSDU packets utilizes - * the transmission buffer space to the maximum - * (adapter->tx_buf_size). - */ - tx_param.next_pkt_len = 0; - - ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, - skb_aggr, &tx_param); - } - switch (ret) { - case -EBUSY: - spin_lock_irqsave(&priv->wmm.ra_list_spinlock, ra_list_flags); - if (!mwifiex_is_ralist_valid(priv, pra_list, ptrindex)) { - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, - ra_list_flags); - mwifiex_write_data_complete(adapter, skb_aggr, 1, -1); - return -1; - } - if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA && - adapter->pps_uapsd_mode && adapter->tx_lock_flag) { - priv->adapter->tx_lock_flag = false; - if (ptx_pd) - ptx_pd->flags = 0; - } - - skb_queue_tail(&pra_list->skb_head, skb_aggr); - - pra_list->total_pkts_size += skb_aggr->len; - - atomic_inc(&priv->wmm.tx_pkts_queued); - - tx_info_aggr->flags |= MWIFIEX_BUF_FLAG_REQUEUED_PKT; - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, - ra_list_flags); - dev_dbg(adapter->dev, "data: -EBUSY is returned\n"); - break; - case -1: - if (adapter->iface_type != MWIFIEX_PCIE) - adapter->data_sent = false; - dev_err(adapter->dev, "%s: host_to_card failed: %#x\n", - __func__, ret); - adapter->dbg.num_tx_host_to_card_failure++; - mwifiex_write_data_complete(adapter, skb_aggr, 1, ret); - return 0; - case -EINPROGRESS: - if (adapter->iface_type != MWIFIEX_PCIE) - adapter->data_sent = false; - break; - case 0: - mwifiex_write_data_complete(adapter, skb_aggr, 1, ret); - break; - default: - break; - } - if (ret != -EBUSY) { - mwifiex_rotate_priolists(priv, pra_list, ptrindex); - } - - return 0; -} diff --git a/drivers/net/wireless/mwifiex/11n_aggr.h b/drivers/net/wireless/mwifiex/11n_aggr.h deleted file mode 100644 index 892098d6a696..000000000000 --- a/drivers/net/wireless/mwifiex/11n_aggr.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Marvell Wireless LAN device driver: 802.11n Aggregation - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef _MWIFIEX_11N_AGGR_H_ -#define _MWIFIEX_11N_AGGR_H_ - -#define PKT_TYPE_AMSDU 0xE6 -#define MIN_NUM_AMSDU 2 - -int mwifiex_11n_deaggregate_pkt(struct mwifiex_private *priv, - struct sk_buff *skb); -int mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, - struct mwifiex_ra_list_tbl *ptr, - int ptr_index, unsigned long flags) - __releases(&priv->wmm.ra_list_spinlock); - -#endif /* !_MWIFIEX_11N_AGGR_H_ */ diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c deleted file mode 100644 index ada809f576fe..000000000000 --- a/drivers/net/wireless/mwifiex/11n_rxreorder.c +++ /dev/null @@ -1,667 +0,0 @@ -/* - * Marvell Wireless LAN device driver: 802.11n RX Re-ordering - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" -#include "11n.h" -#include "11n_rxreorder.h" - -/* - * This function dispatches all packets in the Rx reorder table until the - * start window. - * - * There could be holes in the buffer, which are skipped by the function. - * Since the buffer is linear, the function uses rotation to simulate - * circular buffer. - */ -static void -mwifiex_11n_dispatch_pkt(struct mwifiex_private *priv, - struct mwifiex_rx_reorder_tbl *tbl, int start_win) -{ - int pkt_to_send, i; - void *rx_tmp_ptr; - unsigned long flags; - - pkt_to_send = (start_win > tbl->start_win) ? - min((start_win - tbl->start_win), tbl->win_size) : - tbl->win_size; - - for (i = 0; i < pkt_to_send; ++i) { - spin_lock_irqsave(&priv->rx_pkt_lock, flags); - rx_tmp_ptr = NULL; - if (tbl->rx_reorder_ptr[i]) { - rx_tmp_ptr = tbl->rx_reorder_ptr[i]; - tbl->rx_reorder_ptr[i] = NULL; - } - spin_unlock_irqrestore(&priv->rx_pkt_lock, flags); - if (rx_tmp_ptr) { - if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP) - mwifiex_handle_uap_rx_forward(priv, rx_tmp_ptr); - else - mwifiex_process_rx_packet(priv, rx_tmp_ptr); - } - } - - spin_lock_irqsave(&priv->rx_pkt_lock, flags); - /* - * We don't have a circular buffer, hence use rotation to simulate - * circular buffer - */ - for (i = 0; i < tbl->win_size - pkt_to_send; ++i) { - tbl->rx_reorder_ptr[i] = tbl->rx_reorder_ptr[pkt_to_send + i]; - tbl->rx_reorder_ptr[pkt_to_send + i] = NULL; - } - - tbl->start_win = start_win; - spin_unlock_irqrestore(&priv->rx_pkt_lock, flags); -} - -/* - * This function dispatches all packets in the Rx reorder table until - * a hole is found. - * - * The start window is adjusted automatically when a hole is located. - * Since the buffer is linear, the function uses rotation to simulate - * circular buffer. - */ -static void -mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv, - struct mwifiex_rx_reorder_tbl *tbl) -{ - int i, j, xchg; - void *rx_tmp_ptr; - unsigned long flags; - - for (i = 0; i < tbl->win_size; ++i) { - spin_lock_irqsave(&priv->rx_pkt_lock, flags); - if (!tbl->rx_reorder_ptr[i]) { - spin_unlock_irqrestore(&priv->rx_pkt_lock, flags); - break; - } - rx_tmp_ptr = tbl->rx_reorder_ptr[i]; - tbl->rx_reorder_ptr[i] = NULL; - spin_unlock_irqrestore(&priv->rx_pkt_lock, flags); - - if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP) - mwifiex_handle_uap_rx_forward(priv, rx_tmp_ptr); - else - mwifiex_process_rx_packet(priv, rx_tmp_ptr); - } - - spin_lock_irqsave(&priv->rx_pkt_lock, flags); - /* - * We don't have a circular buffer, hence use rotation to simulate - * circular buffer - */ - if (i > 0) { - xchg = tbl->win_size - i; - for (j = 0; j < xchg; ++j) { - tbl->rx_reorder_ptr[j] = tbl->rx_reorder_ptr[i + j]; - tbl->rx_reorder_ptr[i + j] = NULL; - } - } - tbl->start_win = (tbl->start_win + i) & (MAX_TID_VALUE - 1); - spin_unlock_irqrestore(&priv->rx_pkt_lock, flags); -} - -/* - * This function deletes the Rx reorder table and frees the memory. - * - * The function stops the associated timer and dispatches all the - * pending packets in the Rx reorder table before deletion. - */ -static void -mwifiex_del_rx_reorder_entry(struct mwifiex_private *priv, - struct mwifiex_rx_reorder_tbl *tbl) -{ - unsigned long flags; - - if (!tbl) - return; - - mwifiex_11n_dispatch_pkt(priv, tbl, (tbl->start_win + tbl->win_size) & - (MAX_TID_VALUE - 1)); - - del_timer(&tbl->timer_context.timer); - - spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); - list_del(&tbl->list); - spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); - - kfree(tbl->rx_reorder_ptr); - kfree(tbl); -} - -/* - * This function returns the pointer to an entry in Rx reordering - * table which matches the given TA/TID pair. - */ -struct mwifiex_rx_reorder_tbl * -mwifiex_11n_get_rx_reorder_tbl(struct mwifiex_private *priv, int tid, u8 *ta) -{ - struct mwifiex_rx_reorder_tbl *tbl; - unsigned long flags; - - spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); - list_for_each_entry(tbl, &priv->rx_reorder_tbl_ptr, list) { - if (!memcmp(tbl->ta, ta, ETH_ALEN) && tbl->tid == tid) { - spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, - flags); - return tbl; - } - } - spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); - - return NULL; -} - -/* This function retrieves the pointer to an entry in Rx reordering - * table which matches the given TA and deletes it. - */ -void mwifiex_11n_del_rx_reorder_tbl_by_ta(struct mwifiex_private *priv, u8 *ta) -{ - struct mwifiex_rx_reorder_tbl *tbl, *tmp; - unsigned long flags; - - if (!ta) - return; - - spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); - list_for_each_entry_safe(tbl, tmp, &priv->rx_reorder_tbl_ptr, list) { - if (!memcmp(tbl->ta, ta, ETH_ALEN)) { - spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, - flags); - mwifiex_del_rx_reorder_entry(priv, tbl); - spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); - } - } - spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); - - return; -} - -/* - * This function finds the last sequence number used in the packets - * buffered in Rx reordering table. - */ -static int -mwifiex_11n_find_last_seq_num(struct mwifiex_rx_reorder_tbl *rx_reorder_tbl_ptr) -{ - int i; - - for (i = (rx_reorder_tbl_ptr->win_size - 1); i >= 0; --i) - if (rx_reorder_tbl_ptr->rx_reorder_ptr[i]) - return i; - - return -1; -} - -/* - * This function flushes all the packets in Rx reordering table. - * - * The function checks if any packets are currently buffered in the - * table or not. In case there are packets available, it dispatches - * them and then dumps the Rx reordering table. - */ -static void -mwifiex_flush_data(unsigned long context) -{ - struct reorder_tmr_cnxt *ctx = - (struct reorder_tmr_cnxt *) context; - int start_win; - - start_win = mwifiex_11n_find_last_seq_num(ctx->ptr); - - if (start_win < 0) - return; - - dev_dbg(ctx->priv->adapter->dev, "info: flush data %d\n", start_win); - mwifiex_11n_dispatch_pkt(ctx->priv, ctx->ptr, - (ctx->ptr->start_win + start_win + 1) & - (MAX_TID_VALUE - 1)); -} - -/* - * This function creates an entry in Rx reordering table for the - * given TA/TID. - * - * The function also initializes the entry with sequence number, window - * size as well as initializes the timer. - * - * If the received TA/TID pair is already present, all the packets are - * dispatched and the window size is moved until the SSN. - */ -static void -mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta, - int tid, int win_size, int seq_num) -{ - int i; - struct mwifiex_rx_reorder_tbl *tbl, *new_node; - u16 last_seq = 0; - unsigned long flags; - struct mwifiex_sta_node *node; - - /* - * If we get a TID, ta pair which is already present dispatch all the - * the packets and move the window size until the ssn - */ - tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid, ta); - if (tbl) { - mwifiex_11n_dispatch_pkt(priv, tbl, seq_num); - return; - } - /* if !tbl then create one */ - new_node = kzalloc(sizeof(struct mwifiex_rx_reorder_tbl), GFP_KERNEL); - if (!new_node) - return; - - INIT_LIST_HEAD(&new_node->list); - new_node->tid = tid; - memcpy(new_node->ta, ta, ETH_ALEN); - new_node->start_win = seq_num; - - if (mwifiex_queuing_ra_based(priv)) { - dev_dbg(priv->adapter->dev, - "info: AP/ADHOC:last_seq=%d start_win=%d\n", - last_seq, new_node->start_win); - if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP) { - node = mwifiex_get_sta_entry(priv, ta); - if (node) - last_seq = node->rx_seq[tid]; - } - } else { - last_seq = priv->rx_seq[tid]; - } - - if (last_seq != MWIFIEX_DEF_11N_RX_SEQ_NUM && - last_seq >= new_node->start_win) - new_node->start_win = last_seq + 1; - - new_node->win_size = win_size; - new_node->flags = 0; - - new_node->rx_reorder_ptr = kzalloc(sizeof(void *) * win_size, - GFP_KERNEL); - if (!new_node->rx_reorder_ptr) { - kfree((u8 *) new_node); - dev_err(priv->adapter->dev, - "%s: failed to alloc reorder_ptr\n", __func__); - return; - } - - new_node->timer_context.ptr = new_node; - new_node->timer_context.priv = priv; - - init_timer(&new_node->timer_context.timer); - new_node->timer_context.timer.function = mwifiex_flush_data; - new_node->timer_context.timer.data = - (unsigned long) &new_node->timer_context; - - for (i = 0; i < win_size; ++i) - new_node->rx_reorder_ptr[i] = NULL; - - spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); - list_add_tail(&new_node->list, &priv->rx_reorder_tbl_ptr); - spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); -} - -/* - * This function prepares command for adding a BA request. - * - * Preparation includes - - * - Setting command ID and proper size - * - Setting add BA request buffer - * - Ensuring correct endian-ness - */ -int mwifiex_cmd_11n_addba_req(struct host_cmd_ds_command *cmd, void *data_buf) -{ - struct host_cmd_ds_11n_addba_req *add_ba_req = &cmd->params.add_ba_req; - - cmd->command = cpu_to_le16(HostCmd_CMD_11N_ADDBA_REQ); - cmd->size = cpu_to_le16(sizeof(*add_ba_req) + S_DS_GEN); - memcpy(add_ba_req, data_buf, sizeof(*add_ba_req)); - - return 0; -} - -/* - * This function prepares command for adding a BA response. - * - * Preparation includes - - * - Setting command ID and proper size - * - Setting add BA response buffer - * - Ensuring correct endian-ness - */ -int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - struct host_cmd_ds_11n_addba_req - *cmd_addba_req) -{ - struct host_cmd_ds_11n_addba_rsp *add_ba_rsp = &cmd->params.add_ba_rsp; - u8 tid; - int win_size; - uint16_t block_ack_param_set; - - cmd->command = cpu_to_le16(HostCmd_CMD_11N_ADDBA_RSP); - cmd->size = cpu_to_le16(sizeof(*add_ba_rsp) + S_DS_GEN); - - memcpy(add_ba_rsp->peer_mac_addr, cmd_addba_req->peer_mac_addr, - ETH_ALEN); - add_ba_rsp->dialog_token = cmd_addba_req->dialog_token; - add_ba_rsp->block_ack_tmo = cmd_addba_req->block_ack_tmo; - add_ba_rsp->ssn = cmd_addba_req->ssn; - - block_ack_param_set = le16_to_cpu(cmd_addba_req->block_ack_param_set); - tid = (block_ack_param_set & IEEE80211_ADDBA_PARAM_TID_MASK) - >> BLOCKACKPARAM_TID_POS; - add_ba_rsp->status_code = cpu_to_le16(ADDBA_RSP_STATUS_ACCEPT); - block_ack_param_set &= ~IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK; - /* We donot support AMSDU inside AMPDU, hence reset the bit */ - block_ack_param_set &= ~BLOCKACKPARAM_AMSDU_SUPP_MASK; - block_ack_param_set |= (priv->add_ba_param.rx_win_size << - BLOCKACKPARAM_WINSIZE_POS); - add_ba_rsp->block_ack_param_set = cpu_to_le16(block_ack_param_set); - win_size = (le16_to_cpu(add_ba_rsp->block_ack_param_set) - & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) - >> BLOCKACKPARAM_WINSIZE_POS; - cmd_addba_req->block_ack_param_set = cpu_to_le16(block_ack_param_set); - - mwifiex_11n_create_rx_reorder_tbl(priv, cmd_addba_req->peer_mac_addr, - tid, win_size, - le16_to_cpu(cmd_addba_req->ssn)); - return 0; -} - -/* - * This function prepares command for deleting a BA request. - * - * Preparation includes - - * - Setting command ID and proper size - * - Setting del BA request buffer - * - Ensuring correct endian-ness - */ -int mwifiex_cmd_11n_delba(struct host_cmd_ds_command *cmd, void *data_buf) -{ - struct host_cmd_ds_11n_delba *del_ba = &cmd->params.del_ba; - - cmd->command = cpu_to_le16(HostCmd_CMD_11N_DELBA); - cmd->size = cpu_to_le16(sizeof(*del_ba) + S_DS_GEN); - memcpy(del_ba, data_buf, sizeof(*del_ba)); - - return 0; -} - -/* - * This function identifies if Rx reordering is needed for a received packet. - * - * In case reordering is required, the function will do the reordering - * before sending it to kernel. - * - * The Rx reorder table is checked first with the received TID/TA pair. If - * not found, the received packet is dispatched immediately. But if found, - * the packet is reordered and all the packets in the updated Rx reordering - * table is dispatched until a hole is found. - * - * For sequence number less than the starting window, the packet is dropped. - */ -int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv, - u16 seq_num, u16 tid, - u8 *ta, u8 pkt_type, void *payload) -{ - struct mwifiex_rx_reorder_tbl *tbl; - int start_win, end_win, win_size; - u16 pkt_index; - - tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid, ta); - if (!tbl) { - if (pkt_type != PKT_TYPE_BAR) { - if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP) - mwifiex_handle_uap_rx_forward(priv, payload); - else - mwifiex_process_rx_packet(priv, payload); - } - return 0; - } - start_win = tbl->start_win; - win_size = tbl->win_size; - end_win = ((start_win + win_size) - 1) & (MAX_TID_VALUE - 1); - del_timer(&tbl->timer_context.timer); - mod_timer(&tbl->timer_context.timer, - jiffies + msecs_to_jiffies(MIN_FLUSH_TIMER_MS * win_size)); - - /* - * If seq_num is less then starting win then ignore and drop the - * packet - */ - if (tbl->flags & RXREOR_FORCE_NO_DROP) { - dev_dbg(priv->adapter->dev, - "RXREOR_FORCE_NO_DROP when HS is activated\n"); - tbl->flags &= ~RXREOR_FORCE_NO_DROP; - } else { - if ((start_win + TWOPOW11) > (MAX_TID_VALUE - 1)) { - if (seq_num >= ((start_win + TWOPOW11) & - (MAX_TID_VALUE - 1)) && - seq_num < start_win) - return -1; - } else if ((seq_num < start_win) || - (seq_num > (start_win + TWOPOW11))) { - return -1; - } - } - - /* - * If this packet is a BAR we adjust seq_num as - * WinStart = seq_num - */ - if (pkt_type == PKT_TYPE_BAR) - seq_num = ((seq_num + win_size) - 1) & (MAX_TID_VALUE - 1); - - if (((end_win < start_win) && - (seq_num < start_win) && (seq_num > end_win)) || - ((end_win > start_win) && ((seq_num > end_win) || - (seq_num < start_win)))) { - end_win = seq_num; - if (((seq_num - win_size) + 1) >= 0) - start_win = (end_win - win_size) + 1; - else - start_win = (MAX_TID_VALUE - (win_size - seq_num)) + 1; - mwifiex_11n_dispatch_pkt(priv, tbl, start_win); - } - - if (pkt_type != PKT_TYPE_BAR) { - if (seq_num >= start_win) - pkt_index = seq_num - start_win; - else - pkt_index = (seq_num+MAX_TID_VALUE) - start_win; - - if (tbl->rx_reorder_ptr[pkt_index]) - return -1; - - tbl->rx_reorder_ptr[pkt_index] = payload; - } - - /* - * Dispatch all packets sequentially from start_win until a - * hole is found and adjust the start_win appropriately - */ - mwifiex_11n_scan_and_dispatch(priv, tbl); - - return 0; -} - -/* - * This function deletes an entry for a given TID/TA pair. - * - * The TID/TA are taken from del BA event body. - */ -void -mwifiex_del_ba_tbl(struct mwifiex_private *priv, int tid, u8 *peer_mac, - u8 type, int initiator) -{ - struct mwifiex_rx_reorder_tbl *tbl; - struct mwifiex_tx_ba_stream_tbl *ptx_tbl; - u8 cleanup_rx_reorder_tbl; - unsigned long flags; - - if (type == TYPE_DELBA_RECEIVE) - cleanup_rx_reorder_tbl = (initiator) ? true : false; - else - cleanup_rx_reorder_tbl = (initiator) ? false : true; - - dev_dbg(priv->adapter->dev, "event: DELBA: %pM tid=%d initiator=%d\n", - peer_mac, tid, initiator); - - if (cleanup_rx_reorder_tbl) { - tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid, - peer_mac); - if (!tbl) { - dev_dbg(priv->adapter->dev, - "event: TID, TA not found in table\n"); - return; - } - mwifiex_del_rx_reorder_entry(priv, tbl); - } else { - ptx_tbl = mwifiex_get_ba_tbl(priv, tid, peer_mac); - if (!ptx_tbl) { - dev_dbg(priv->adapter->dev, - "event: TID, RA not found in table\n"); - return; - } - - spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags); - mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv, ptx_tbl); - spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags); - } -} - -/* - * This function handles the command response of an add BA response. - * - * Handling includes changing the header fields into CPU format and - * creating the stream, provided the add BA is accepted. - */ -int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct host_cmd_ds_11n_addba_rsp *add_ba_rsp = &resp->params.add_ba_rsp; - int tid, win_size; - struct mwifiex_rx_reorder_tbl *tbl; - uint16_t block_ack_param_set; - - block_ack_param_set = le16_to_cpu(add_ba_rsp->block_ack_param_set); - - tid = (block_ack_param_set & IEEE80211_ADDBA_PARAM_TID_MASK) - >> BLOCKACKPARAM_TID_POS; - /* - * Check if we had rejected the ADDBA, if yes then do not create - * the stream - */ - if (le16_to_cpu(add_ba_rsp->status_code) == BA_RESULT_SUCCESS) { - win_size = (block_ack_param_set & - IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) - >> BLOCKACKPARAM_WINSIZE_POS; - - dev_dbg(priv->adapter->dev, - "cmd: ADDBA RSP: %pM tid=%d ssn=%d win_size=%d\n", - add_ba_rsp->peer_mac_addr, tid, - add_ba_rsp->ssn, win_size); - } else { - dev_err(priv->adapter->dev, "ADDBA RSP: failed %pM tid=%d)\n", - add_ba_rsp->peer_mac_addr, tid); - - tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid, - add_ba_rsp->peer_mac_addr); - if (tbl) - mwifiex_del_rx_reorder_entry(priv, tbl); - } - - return 0; -} - -/* - * This function handles BA stream timeout event by preparing and sending - * a command to the firmware. - */ -void mwifiex_11n_ba_stream_timeout(struct mwifiex_private *priv, - struct host_cmd_ds_11n_batimeout *event) -{ - struct host_cmd_ds_11n_delba delba; - - memset(&delba, 0, sizeof(struct host_cmd_ds_11n_delba)); - memcpy(delba.peer_mac_addr, event->peer_mac_addr, ETH_ALEN); - - delba.del_ba_param_set |= - cpu_to_le16((u16) event->tid << DELBA_TID_POS); - delba.del_ba_param_set |= cpu_to_le16( - (u16) event->origninator << DELBA_INITIATOR_POS); - delba.reason_code = cpu_to_le16(WLAN_REASON_QSTA_TIMEOUT); - mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_DELBA, 0, 0, &delba); -} - -/* - * This function cleans up the Rx reorder table by deleting all the entries - * and re-initializing. - */ -void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv) -{ - struct mwifiex_rx_reorder_tbl *del_tbl_ptr, *tmp_node; - unsigned long flags; - - spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); - list_for_each_entry_safe(del_tbl_ptr, tmp_node, - &priv->rx_reorder_tbl_ptr, list) { - spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); - mwifiex_del_rx_reorder_entry(priv, del_tbl_ptr); - spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); - } - spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); - - INIT_LIST_HEAD(&priv->rx_reorder_tbl_ptr); - mwifiex_reset_11n_rx_seq_num(priv); -} - -/* - * This function updates all rx_reorder_tbl's flags. - */ -void mwifiex_update_rxreor_flags(struct mwifiex_adapter *adapter, u8 flags) -{ - struct mwifiex_private *priv; - struct mwifiex_rx_reorder_tbl *tbl; - unsigned long lock_flags; - int i; - - for (i = 0; i < adapter->priv_num; i++) { - priv = adapter->priv[i]; - if (!priv) - continue; - if (list_empty(&priv->rx_reorder_tbl_ptr)) - continue; - - spin_lock_irqsave(&priv->rx_reorder_tbl_lock, lock_flags); - list_for_each_entry(tbl, &priv->rx_reorder_tbl_ptr, list) - tbl->flags = flags; - spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, lock_flags); - } - - return; -} diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.h b/drivers/net/wireless/mwifiex/11n_rxreorder.h deleted file mode 100644 index 4064041ac852..000000000000 --- a/drivers/net/wireless/mwifiex/11n_rxreorder.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Marvell Wireless LAN device driver: 802.11n RX Re-ordering - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef _MWIFIEX_11N_RXREORDER_H_ -#define _MWIFIEX_11N_RXREORDER_H_ - -#define MIN_FLUSH_TIMER_MS 50 - -#define PKT_TYPE_BAR 0xE7 -#define MAX_TID_VALUE (2 << 11) -#define TWOPOW11 (2 << 10) - -#define BLOCKACKPARAM_TID_POS 2 -#define BLOCKACKPARAM_AMSDU_SUPP_MASK 0x1 -#define BLOCKACKPARAM_WINSIZE_POS 6 -#define DELBA_TID_POS 12 -#define DELBA_INITIATOR_POS 11 -#define TYPE_DELBA_SENT 1 -#define TYPE_DELBA_RECEIVE 2 -#define IMMEDIATE_BLOCK_ACK 0x2 - -#define ADDBA_RSP_STATUS_ACCEPT 0 - -#define MWIFIEX_DEF_11N_RX_SEQ_NUM 0xffff -#define BA_SETUP_MAX_PACKET_THRESHOLD 16 -#define BA_SETUP_PACKET_OFFSET 16 - -enum mwifiex_rxreor_flags { - RXREOR_FORCE_NO_DROP = 1<<0, -}; - -static inline void mwifiex_reset_11n_rx_seq_num(struct mwifiex_private *priv) -{ - memset(priv->rx_seq, 0xff, sizeof(priv->rx_seq)); -} - -int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *, - u16 seqNum, - u16 tid, u8 *ta, - u8 pkttype, void *payload); -void mwifiex_del_ba_tbl(struct mwifiex_private *priv, int Tid, - u8 *PeerMACAddr, u8 type, int initiator); -void mwifiex_11n_ba_stream_timeout(struct mwifiex_private *priv, - struct host_cmd_ds_11n_batimeout *event); -int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv, - struct host_cmd_ds_command - *resp); -int mwifiex_cmd_11n_delba(struct host_cmd_ds_command *cmd, - void *data_buf); -int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - struct host_cmd_ds_11n_addba_req - *cmd_addba_req); -int mwifiex_cmd_11n_addba_req(struct host_cmd_ds_command *cmd, - void *data_buf); -void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv); -struct mwifiex_rx_reorder_tbl *mwifiex_11n_get_rxreorder_tbl(struct - mwifiex_private - *priv, int tid, - u8 *ta); -struct mwifiex_rx_reorder_tbl * -mwifiex_11n_get_rx_reorder_tbl(struct mwifiex_private *priv, int tid, u8 *ta); -void mwifiex_11n_del_rx_reorder_tbl_by_ta(struct mwifiex_private *priv, u8 *ta); -void mwifiex_update_rxreor_flags(struct mwifiex_adapter *adapter, u8 flags); - -#endif /* _MWIFIEX_11N_RXREORDER_H_ */ diff --git a/drivers/net/wireless/mwifiex/Kconfig b/drivers/net/wireless/mwifiex/Kconfig deleted file mode 100644 index 4f614aad9ded..000000000000 --- a/drivers/net/wireless/mwifiex/Kconfig +++ /dev/null @@ -1,42 +0,0 @@ -config MWIFIEX - tristate "Marvell WiFi-Ex Driver" - depends on CFG80211 - ---help--- - This adds support for wireless adapters based on Marvell - 802.11n chipsets. - - If you choose to build it as a module, it will be called - mwifiex. - -config MWIFIEX_SDIO - tristate "Marvell WiFi-Ex Driver for SD8786/SD8787/SD8797" - depends on MWIFIEX && MMC - select FW_LOADER - ---help--- - This adds support for wireless adapters based on Marvell - 8786/8787/8797 chipsets with SDIO interface. - - If you choose to build it as a module, it will be called - mwifiex_sdio. - -config MWIFIEX_PCIE - tristate "Marvell WiFi-Ex Driver for PCIE 8766/8897" - depends on MWIFIEX && PCI - select FW_LOADER - ---help--- - This adds support for wireless adapters based on Marvell - 8766/8897 chipsets with PCIe interface. - - If you choose to build it as a module, it will be called - mwifiex_pcie. - -config MWIFIEX_USB - tristate "Marvell WiFi-Ex Driver for USB8797" - depends on MWIFIEX && USB - select FW_LOADER - ---help--- - This adds support for wireless adapters based on Marvell - Avastar 88W8797 chipset with USB interface. - - If you choose to build it as a module, it will be called - mwifiex_usb. diff --git a/drivers/net/wireless/mwifiex/Makefile b/drivers/net/wireless/mwifiex/Makefile deleted file mode 100644 index ecf28464367f..000000000000 --- a/drivers/net/wireless/mwifiex/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# -# Copyright (C) 2011, Marvell International Ltd. -# -# This software file (the "File") is distributed by Marvell International -# Ltd. under the terms of the GNU General Public License Version 2, June 1991 -# (the "License"). You may use, redistribute and/or modify this File in -# accordance with the terms and conditions of the License, a copy of which -# is available by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the -# worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. -# -# THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE -# IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE -# ARE EXPRESSLY DISCLAIMED. The License provides additional details about -# this warranty disclaimer. - - -mwifiex-y += main.o -mwifiex-y += init.o -mwifiex-y += cfp.o -mwifiex-y += cmdevt.o -mwifiex-y += util.o -mwifiex-y += txrx.o -mwifiex-y += wmm.o -mwifiex-y += 11n.o -mwifiex-y += 11ac.o -mwifiex-y += 11n_aggr.o -mwifiex-y += 11n_rxreorder.o -mwifiex-y += scan.o -mwifiex-y += join.o -mwifiex-y += sta_ioctl.o -mwifiex-y += sta_cmd.o -mwifiex-y += uap_cmd.o -mwifiex-y += ie.o -mwifiex-y += sta_cmdresp.o -mwifiex-y += sta_event.o -mwifiex-y += uap_event.o -mwifiex-y += sta_tx.o -mwifiex-y += sta_rx.o -mwifiex-y += uap_txrx.o -mwifiex-y += cfg80211.o -mwifiex-y += ethtool.o -mwifiex-$(CONFIG_DEBUG_FS) += debugfs.o -obj-$(CONFIG_MWIFIEX) += mwifiex.o - -mwifiex_sdio-y += sdio.o -obj-$(CONFIG_MWIFIEX_SDIO) += mwifiex_sdio.o - -mwifiex_pcie-y += pcie.o -obj-$(CONFIG_MWIFIEX_PCIE) += mwifiex_pcie.o - -mwifiex_usb-y += usb.o -obj-$(CONFIG_MWIFIEX_USB) += mwifiex_usb.o diff --git a/drivers/net/wireless/mwifiex/README b/drivers/net/wireless/mwifiex/README deleted file mode 100644 index 3d64613ebb29..000000000000 --- a/drivers/net/wireless/mwifiex/README +++ /dev/null @@ -1,203 +0,0 @@ -# Copyright (C) 2011, Marvell International Ltd. -# -# This software file (the "File") is distributed by Marvell International -# Ltd. under the terms of the GNU General Public License Version 2, June 1991 -# (the "License"). You may use, redistribute and/or modify this File in -# accordance with the terms and conditions of the License, a copy of which -# is available by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the -# worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. -# -# THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE -# IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE -# ARE EXPRESSLY DISCLAIMED. The License provides additional details about -# this warranty disclaimer. - - -=============================================================================== - U S E R M A N U A L - -1) FOR DRIVER INSTALL - - a) Copy sd8787.bin to /lib/firmware/mrvl/ directory, - create the directory if it doesn't exist. - b) Install WLAN driver, - insmod mwifiex.ko - c) Uninstall WLAN driver, - ifconfig mlanX down - rmmod mwifiex - - -2) FOR DRIVER CONFIGURATION AND INFO - The configurations can be done either using the 'iw' user space - utility or debugfs. - - a) 'iw' utility commands - - Following are some useful iw commands:- - -iw dev mlan0 scan - - This command will trigger a scan. - The command will then display the scan table entries - -iw dev mlan0 connect -w [] [] [key 0:abcde d:1123456789a] - The above command can be used to connect to an AP with a particular SSID. - Ap's operating frequency can be specified or even the bssid. If the AP is using - WEP encryption, wep keys can be specified in the command. - Note: Every time before connecting to an AP scan command (iw dev mlan0 scan) should be used by user. - -iw dev mlan0 disconnect - This command will be used to disconnect from an AP. - - -iw dev mlan0 ibss join [fixed-freq] [fixed-bssid] [key 0:abcde] - The command will be used to join or create an ibss. Optionally, operating frequency, - bssid and the security related parameters can be specified while joining/creating - and ibss. - -iw dev mlan0 ibss leave - The command will be used to leave an ibss network. - -iw dev mlan0 link - The command will be used to get the connection status. The command will return parameters - such as SSID, operating frequency, rx/tx packets, signal strength, tx bitrate. - - Apart from the iw utility all standard configurations using the 'iwconfig' utility are also supported. - - b) Debugfs interface - - The debugfs interface can be used for configurations and for getting - some useful information from the driver. - The section below explains the configurations that can be - done. - - Mount debugfs to /debugfs mount point: - - mkdir /debugfs - mount -t debugfs debugfs /debugfs - - The information is provided in /debugfs/mwifiex/mlanX/: - -iw reg set - The command will be used to change the regulatory domain. - -iw reg get - The command will be used to get current regulatory domain. - -info - This command is used to get driver info. - - Usage: - cat info - - driver_name = "mwifiex" - driver_version = - interface_name = "mlanX" - bss_mode = "Ad-hoc" | "Managed" | "Auto" | "Unknown" - media_state = "Disconnected" | "Connected" - mac_address = <6-byte adapter MAC address> - multicase_count = - essid = - bssid = - channel = - region_code = - multicasr_address[n] = - num_tx_bytes = - num_rx_bytes = - num_tx_pkts = - num_rx_pkts = - num_tx_pkts_dropped = - num_rx_pkts_dropped = - num_tx_pkts_err = - num_rx_pkts_err = - carrier "on" | "off" - tx queue "stopped" | "started" - - The following debug info are provided in /debugfs/mwifiex/mlanX/debug: - - int_counter = - wmm_ac_vo = - wmm_ac_vi = - wmm_ac_be = - wmm_ac_bk = - tx_buf_size = - curr_tx_buf_size = - ps_mode = <0/1, CAM mode/PS mode> - ps_state = <0/1/2/3, full power state/awake state/pre-sleep state/sleep state> - is_deep_sleep = <0/1, not deep sleep state/deep sleep state> - wakeup_dev_req = <0/1, wakeup device not required/required> - wakeup_tries = - hs_configured = <0/1, host sleep not configured/configured> - hs_activated = <0/1, extended host sleep not activated/activated> - num_tx_timeout = - num_cmd_timeout = - timeout_cmd_id = - timeout_cmd_act = - last_cmd_id = - last_cmd_act = - last_cmd_index = <0 based last command index> - last_cmd_resp_id = - last_cmd_resp_index = <0 based last command response index> - last_event = - last_event_index = <0 based last event index> - num_cmd_h2c_fail = - num_cmd_sleep_cfm_fail = - num_tx_h2c_fail = - num_evt_deauth = - num_evt_disassoc = - num_evt_link_lost = - num_cmd_deauth = - num_cmd_assoc_ok = - num_cmd_assoc_fail = - cmd_sent = <0/1, send command resources available/sending command to device> - data_sent = <0/1, send data resources available/sending data to device> - mp_rd_bitmap = - mp_wr_bitmap = - cmd_resp_received = <0/1, no cmd response to process/response received and yet to process> - event_received = <0/1, no event to process/event received and yet to process> - cmd_pending = - tx_pending = - rx_pending = - - -3) FOR DRIVER CONFIGURATION - -regrdwr - This command is used to read/write the adapter register. - - Usage: - echo " [value]" > regrdwr - cat regrdwr - - where the parameters are, - : 1:MAC/SOC, 2:BBP, 3:RF, 4:PMIC, 5:CAU - : offset of register - [value]: value to be written - - Examples: - echo "1 0xa060" > regrdwr : Read the MAC register - echo "1 0xa060 0x12" > regrdwr : Write the MAC register - echo "1 0xa794 0x80000000" > regrdwr - : Write 0x80000000 to MAC register -rdeeprom - This command is used to read the EEPROM contents of the card. - - Usage: - echo " " > rdeeprom - cat rdeeprom - - where the parameters are, - : multiples of 4 - : 4-20, multiples of 4 - - Example: - echo "0 20" > rdeeprom : Read 20 bytes of EEPROM data from offset 0 - -getlog - This command is used to get the statistics available in the station. - Usage: - - cat getlog - -=============================================================================== diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c deleted file mode 100644 index e7f7cdfafd51..000000000000 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ /dev/null @@ -1,2529 +0,0 @@ -/* - * Marvell Wireless LAN device driver: CFG80211 - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "cfg80211.h" -#include "main.h" - -static const struct ieee80211_iface_limit mwifiex_ap_sta_limits[] = { - { - .max = 2, .types = BIT(NL80211_IFTYPE_STATION), - }, - { - .max = 1, .types = BIT(NL80211_IFTYPE_AP), - }, -}; - -static const struct ieee80211_iface_combination mwifiex_iface_comb_ap_sta = { - .limits = mwifiex_ap_sta_limits, - .num_different_channels = 1, - .n_limits = ARRAY_SIZE(mwifiex_ap_sta_limits), - .max_interfaces = MWIFIEX_MAX_BSS_NUM, - .beacon_int_infra_match = true, -}; - -static const struct ieee80211_regdomain mwifiex_world_regdom_custom = { - .n_reg_rules = 7, - .alpha2 = "99", - .reg_rules = { - /* Channel 1 - 11 */ - REG_RULE(2412-10, 2462+10, 40, 3, 20, 0), - /* Channel 12 - 13 */ - REG_RULE(2467-10, 2472+10, 20, 3, 20, - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS), - /* Channel 14 */ - REG_RULE(2484-10, 2484+10, 20, 3, 20, - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS | - NL80211_RRF_NO_OFDM), - /* Channel 36 - 48 */ - REG_RULE(5180-10, 5240+10, 40, 3, 20, - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS), - /* Channel 149 - 165 */ - REG_RULE(5745-10, 5825+10, 40, 3, 20, - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS), - /* Channel 52 - 64 */ - REG_RULE(5260-10, 5320+10, 40, 3, 30, - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS | - NL80211_RRF_DFS), - /* Channel 100 - 140 */ - REG_RULE(5500-10, 5700+10, 40, 3, 30, - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS | - NL80211_RRF_DFS), - } -}; - -/* - * This function maps the nl802.11 channel type into driver channel type. - * - * The mapping is as follows - - * NL80211_CHAN_NO_HT -> IEEE80211_HT_PARAM_CHA_SEC_NONE - * NL80211_CHAN_HT20 -> IEEE80211_HT_PARAM_CHA_SEC_NONE - * NL80211_CHAN_HT40PLUS -> IEEE80211_HT_PARAM_CHA_SEC_ABOVE - * NL80211_CHAN_HT40MINUS -> IEEE80211_HT_PARAM_CHA_SEC_BELOW - * Others -> IEEE80211_HT_PARAM_CHA_SEC_NONE - */ -u8 mwifiex_chan_type_to_sec_chan_offset(enum nl80211_channel_type chan_type) -{ - switch (chan_type) { - case NL80211_CHAN_NO_HT: - case NL80211_CHAN_HT20: - return IEEE80211_HT_PARAM_CHA_SEC_NONE; - case NL80211_CHAN_HT40PLUS: - return IEEE80211_HT_PARAM_CHA_SEC_ABOVE; - case NL80211_CHAN_HT40MINUS: - return IEEE80211_HT_PARAM_CHA_SEC_BELOW; - default: - return IEEE80211_HT_PARAM_CHA_SEC_NONE; - } -} - -/* - * This function checks whether WEP is set. - */ -static int -mwifiex_is_alg_wep(u32 cipher) -{ - switch (cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - return 1; - default: - break; - } - - return 0; -} - -/* - * This function retrieves the private structure from kernel wiphy structure. - */ -static void *mwifiex_cfg80211_get_adapter(struct wiphy *wiphy) -{ - return (void *) (*(unsigned long *) wiphy_priv(wiphy)); -} - -/* - * CFG802.11 operation handler to delete a network key. - */ -static int -mwifiex_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev, - u8 key_index, bool pairwise, const u8 *mac_addr) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev); - const u8 bc_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - const u8 *peer_mac = pairwise ? mac_addr : bc_mac; - - if (mwifiex_set_encode(priv, NULL, NULL, 0, key_index, peer_mac, 1)) { - wiphy_err(wiphy, "deleting the crypto keys\n"); - return -EFAULT; - } - - wiphy_dbg(wiphy, "info: crypto keys deleted\n"); - return 0; -} - -/* - * This function forms an skb for management frame. - */ -static int -mwifiex_form_mgmt_frame(struct sk_buff *skb, const u8 *buf, size_t len) -{ - u8 addr[ETH_ALEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - u16 pkt_len; - u32 tx_control = 0, pkt_type = PKT_TYPE_MGMT; - struct timeval tv; - - pkt_len = len + ETH_ALEN; - - skb_reserve(skb, MWIFIEX_MIN_DATA_HEADER_LEN + - MWIFIEX_MGMT_FRAME_HEADER_SIZE + sizeof(pkt_len)); - memcpy(skb_push(skb, sizeof(pkt_len)), &pkt_len, sizeof(pkt_len)); - - memcpy(skb_push(skb, sizeof(tx_control)), - &tx_control, sizeof(tx_control)); - - memcpy(skb_push(skb, sizeof(pkt_type)), &pkt_type, sizeof(pkt_type)); - - /* Add packet data and address4 */ - memcpy(skb_put(skb, sizeof(struct ieee80211_hdr_3addr)), buf, - sizeof(struct ieee80211_hdr_3addr)); - memcpy(skb_put(skb, ETH_ALEN), addr, ETH_ALEN); - memcpy(skb_put(skb, len - sizeof(struct ieee80211_hdr_3addr)), - buf + sizeof(struct ieee80211_hdr_3addr), - len - sizeof(struct ieee80211_hdr_3addr)); - - skb->priority = LOW_PRIO_TID; - do_gettimeofday(&tv); - skb->tstamp = timeval_to_ktime(tv); - - return 0; -} - -/* - * CFG802.11 operation handler to transmit a management frame. - */ -static int -mwifiex_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, - struct ieee80211_channel *chan, bool offchan, - unsigned int wait, const u8 *buf, size_t len, - bool no_cck, bool dont_wait_for_ack, u64 *cookie) -{ - struct sk_buff *skb; - u16 pkt_len; - const struct ieee80211_mgmt *mgmt; - struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); - - if (!buf || !len) { - wiphy_err(wiphy, "invalid buffer and length\n"); - return -EFAULT; - } - - mgmt = (const struct ieee80211_mgmt *)buf; - if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA && - ieee80211_is_probe_resp(mgmt->frame_control)) { - /* Since we support offload probe resp, we need to skip probe - * resp in AP or GO mode */ - wiphy_dbg(wiphy, - "info: skip to send probe resp in AP or GO mode\n"); - return 0; - } - - pkt_len = len + ETH_ALEN; - skb = dev_alloc_skb(MWIFIEX_MIN_DATA_HEADER_LEN + - MWIFIEX_MGMT_FRAME_HEADER_SIZE + - pkt_len + sizeof(pkt_len)); - - if (!skb) { - wiphy_err(wiphy, "allocate skb failed for management frame\n"); - return -ENOMEM; - } - - mwifiex_form_mgmt_frame(skb, buf, len); - mwifiex_queue_tx_pkt(priv, skb); - - *cookie = prandom_u32() | 1; - cfg80211_mgmt_tx_status(wdev, *cookie, buf, len, true, GFP_ATOMIC); - - wiphy_dbg(wiphy, "info: management frame transmitted\n"); - return 0; -} - -/* - * CFG802.11 operation handler to register a mgmt frame. - */ -static void -mwifiex_cfg80211_mgmt_frame_register(struct wiphy *wiphy, - struct wireless_dev *wdev, - u16 frame_type, bool reg) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); - - if (reg) - priv->mgmt_frame_mask |= BIT(frame_type >> 4); - else - priv->mgmt_frame_mask &= ~BIT(frame_type >> 4); - - mwifiex_send_cmd_async(priv, HostCmd_CMD_MGMT_FRAME_REG, - HostCmd_ACT_GEN_SET, 0, &priv->mgmt_frame_mask); - - wiphy_dbg(wiphy, "info: mgmt frame registered\n"); -} - -/* - * CFG802.11 operation handler to remain on channel. - */ -static int -mwifiex_cfg80211_remain_on_channel(struct wiphy *wiphy, - struct wireless_dev *wdev, - struct ieee80211_channel *chan, - unsigned int duration, u64 *cookie) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); - int ret; - - if (!chan || !cookie) { - wiphy_err(wiphy, "Invalid parameter for ROC\n"); - return -EINVAL; - } - - if (priv->roc_cfg.cookie) { - wiphy_dbg(wiphy, "info: ongoing ROC, cookie = 0x%llu\n", - priv->roc_cfg.cookie); - return -EBUSY; - } - - ret = mwifiex_remain_on_chan_cfg(priv, HostCmd_ACT_GEN_SET, chan, - duration); - - if (!ret) { - *cookie = prandom_u32() | 1; - priv->roc_cfg.cookie = *cookie; - priv->roc_cfg.chan = *chan; - - cfg80211_ready_on_channel(wdev, *cookie, chan, - duration, GFP_ATOMIC); - - wiphy_dbg(wiphy, "info: ROC, cookie = 0x%llx\n", *cookie); - } - - return ret; -} - -/* - * CFG802.11 operation handler to cancel remain on channel. - */ -static int -mwifiex_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, - struct wireless_dev *wdev, u64 cookie) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); - int ret; - - if (cookie != priv->roc_cfg.cookie) - return -ENOENT; - - ret = mwifiex_remain_on_chan_cfg(priv, HostCmd_ACT_GEN_REMOVE, - &priv->roc_cfg.chan, 0); - - if (!ret) { - cfg80211_remain_on_channel_expired(wdev, cookie, - &priv->roc_cfg.chan, - GFP_ATOMIC); - - memset(&priv->roc_cfg, 0, sizeof(struct mwifiex_roc_cfg)); - - wiphy_dbg(wiphy, "info: cancel ROC, cookie = 0x%llx\n", cookie); - } - - return ret; -} - -/* - * CFG802.11 operation handler to set Tx power. - */ -static int -mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy, - struct wireless_dev *wdev, - enum nl80211_tx_power_setting type, - int mbm) -{ - struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - struct mwifiex_private *priv; - struct mwifiex_power_cfg power_cfg; - int dbm = MBM_TO_DBM(mbm); - - if (type == NL80211_TX_POWER_FIXED) { - power_cfg.is_power_auto = 0; - power_cfg.power_level = dbm; - } else { - power_cfg.is_power_auto = 1; - } - - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - - return mwifiex_set_tx_power(priv, &power_cfg); -} - -/* - * CFG802.11 operation handler to set Power Save option. - * - * The timeout value, if provided, is currently ignored. - */ -static int -mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy, - struct net_device *dev, - bool enabled, int timeout) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - u32 ps_mode; - - if (timeout) - wiphy_dbg(wiphy, - "info: ignore timeout value for IEEE Power Save\n"); - - ps_mode = enabled; - - return mwifiex_drv_set_power(priv, &ps_mode); -} - -/* - * CFG802.11 operation handler to set the default network key. - */ -static int -mwifiex_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *netdev, - u8 key_index, bool unicast, - bool multicast) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev); - - /* Return if WEP key not configured */ - if (!priv->sec_info.wep_enabled) - return 0; - - if (priv->bss_type == MWIFIEX_BSS_TYPE_UAP) { - priv->wep_key_curr_index = key_index; - } else if (mwifiex_set_encode(priv, NULL, NULL, 0, key_index, - NULL, 0)) { - wiphy_err(wiphy, "set default Tx key index\n"); - return -EFAULT; - } - - return 0; -} - -/* - * CFG802.11 operation handler to add a network key. - */ -static int -mwifiex_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev, - u8 key_index, bool pairwise, const u8 *mac_addr, - struct key_params *params) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev); - struct mwifiex_wep_key *wep_key; - const u8 bc_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - const u8 *peer_mac = pairwise ? mac_addr : bc_mac; - - if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP && - (params->cipher == WLAN_CIPHER_SUITE_WEP40 || - params->cipher == WLAN_CIPHER_SUITE_WEP104)) { - if (params->key && params->key_len) { - wep_key = &priv->wep_key[key_index]; - memset(wep_key, 0, sizeof(struct mwifiex_wep_key)); - memcpy(wep_key->key_material, params->key, - params->key_len); - wep_key->key_index = key_index; - wep_key->key_length = params->key_len; - priv->sec_info.wep_enabled = 1; - } - return 0; - } - - if (mwifiex_set_encode(priv, params, params->key, params->key_len, - key_index, peer_mac, 0)) { - wiphy_err(wiphy, "crypto keys added\n"); - return -EFAULT; - } - - return 0; -} - -/* - * This function sends domain information to the firmware. - * - * The following information are passed to the firmware - - * - Country codes - * - Sub bands (first channel, number of channels, maximum Tx power) - */ -static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy) -{ - u8 no_of_triplet = 0; - struct ieee80211_country_ie_triplet *t; - u8 no_of_parsed_chan = 0; - u8 first_chan = 0, next_chan = 0, max_pwr = 0; - u8 i, flag = 0; - enum ieee80211_band band; - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch; - struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - struct mwifiex_private *priv; - struct mwifiex_802_11d_domain_reg *domain_info = &adapter->domain_reg; - - /* Set country code */ - domain_info->country_code[0] = adapter->country_code[0]; - domain_info->country_code[1] = adapter->country_code[1]; - domain_info->country_code[2] = ' '; - - band = mwifiex_band_to_radio_type(adapter->config_bands); - if (!wiphy->bands[band]) { - wiphy_err(wiphy, "11D: setting domain info in FW\n"); - return -1; - } - - sband = wiphy->bands[band]; - - for (i = 0; i < sband->n_channels ; i++) { - ch = &sband->channels[i]; - if (ch->flags & IEEE80211_CHAN_DISABLED) - continue; - - if (!flag) { - flag = 1; - first_chan = (u32) ch->hw_value; - next_chan = first_chan; - max_pwr = ch->max_power; - no_of_parsed_chan = 1; - continue; - } - - if (ch->hw_value == next_chan + 1 && - ch->max_power == max_pwr) { - next_chan++; - no_of_parsed_chan++; - } else { - t = &domain_info->triplet[no_of_triplet]; - t->chans.first_channel = first_chan; - t->chans.num_channels = no_of_parsed_chan; - t->chans.max_power = max_pwr; - no_of_triplet++; - first_chan = (u32) ch->hw_value; - next_chan = first_chan; - max_pwr = ch->max_power; - no_of_parsed_chan = 1; - } - } - - if (flag) { - t = &domain_info->triplet[no_of_triplet]; - t->chans.first_channel = first_chan; - t->chans.num_channels = no_of_parsed_chan; - t->chans.max_power = max_pwr; - no_of_triplet++; - } - - domain_info->no_of_triplet = no_of_triplet; - - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - - if (mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11D_DOMAIN_INFO, - HostCmd_ACT_GEN_SET, 0, NULL)) { - wiphy_err(wiphy, "11D: setting domain info in FW\n"); - return -1; - } - - return 0; -} - -/* - * CFG802.11 regulatory domain callback function. - * - * This function is called when the regulatory domain is changed due to the - * following reasons - - * - Set by driver - * - Set by system core - * - Set by user - * - Set bt Country IE - */ -static void mwifiex_reg_notifier(struct wiphy *wiphy, - struct regulatory_request *request) -{ - struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - - wiphy_dbg(wiphy, "info: cfg80211 regulatory domain callback for %c%c\n", - request->alpha2[0], request->alpha2[1]); - - memcpy(adapter->country_code, request->alpha2, sizeof(request->alpha2)); - - switch (request->initiator) { - case NL80211_REGDOM_SET_BY_DRIVER: - case NL80211_REGDOM_SET_BY_CORE: - case NL80211_REGDOM_SET_BY_USER: - break; - /* Todo: apply driver specific changes in channel flags based - on the request initiator if necessary. */ - case NL80211_REGDOM_SET_BY_COUNTRY_IE: - break; - } - mwifiex_send_domain_info_cmd_fw(wiphy); -} - -/* - * This function sets the fragmentation threshold. - * - * The fragmentation threshold value must lie between MWIFIEX_FRAG_MIN_VALUE - * and MWIFIEX_FRAG_MAX_VALUE. - */ -static int -mwifiex_set_frag(struct mwifiex_private *priv, u32 frag_thr) -{ - if (frag_thr < MWIFIEX_FRAG_MIN_VALUE || - frag_thr > MWIFIEX_FRAG_MAX_VALUE) - frag_thr = MWIFIEX_FRAG_MAX_VALUE; - - return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB, - HostCmd_ACT_GEN_SET, FRAG_THRESH_I, - &frag_thr); -} - -/* - * This function sets the RTS threshold. - - * The rts value must lie between MWIFIEX_RTS_MIN_VALUE - * and MWIFIEX_RTS_MAX_VALUE. - */ -static int -mwifiex_set_rts(struct mwifiex_private *priv, u32 rts_thr) -{ - if (rts_thr < MWIFIEX_RTS_MIN_VALUE || rts_thr > MWIFIEX_RTS_MAX_VALUE) - rts_thr = MWIFIEX_RTS_MAX_VALUE; - - return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB, - HostCmd_ACT_GEN_SET, RTS_THRESH_I, - &rts_thr); -} - -/* - * CFG802.11 operation handler to set wiphy parameters. - * - * This function can be used to set the RTS threshold and the - * Fragmentation threshold of the driver. - */ -static int -mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) -{ - struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - struct mwifiex_private *priv; - struct mwifiex_uap_bss_param *bss_cfg; - int ret, bss_started, i; - - for (i = 0; i < adapter->priv_num; i++) { - priv = adapter->priv[i]; - - switch (priv->bss_role) { - case MWIFIEX_BSS_ROLE_UAP: - bss_cfg = kzalloc(sizeof(struct mwifiex_uap_bss_param), - GFP_KERNEL); - if (!bss_cfg) - return -ENOMEM; - - mwifiex_set_sys_config_invalid_data(bss_cfg); - - if (changed & WIPHY_PARAM_RTS_THRESHOLD) - bss_cfg->rts_threshold = wiphy->rts_threshold; - if (changed & WIPHY_PARAM_FRAG_THRESHOLD) - bss_cfg->frag_threshold = wiphy->frag_threshold; - if (changed & WIPHY_PARAM_RETRY_LONG) - bss_cfg->retry_limit = wiphy->retry_long; - - bss_started = priv->bss_started; - - ret = mwifiex_send_cmd_sync(priv, - HostCmd_CMD_UAP_BSS_STOP, - HostCmd_ACT_GEN_SET, 0, - NULL); - if (ret) { - wiphy_err(wiphy, "Failed to stop the BSS\n"); - kfree(bss_cfg); - return ret; - } - - ret = mwifiex_send_cmd_async(priv, - HostCmd_CMD_UAP_SYS_CONFIG, - HostCmd_ACT_GEN_SET, - UAP_BSS_PARAMS_I, bss_cfg); - - kfree(bss_cfg); - - if (ret) { - wiphy_err(wiphy, "Failed to set bss config\n"); - return ret; - } - - if (!bss_started) - break; - - ret = mwifiex_send_cmd_async(priv, - HostCmd_CMD_UAP_BSS_START, - HostCmd_ACT_GEN_SET, 0, - NULL); - if (ret) { - wiphy_err(wiphy, "Failed to start BSS\n"); - return ret; - } - - break; - case MWIFIEX_BSS_ROLE_STA: - if (changed & WIPHY_PARAM_RTS_THRESHOLD) { - ret = mwifiex_set_rts(priv, - wiphy->rts_threshold); - if (ret) - return ret; - } - if (changed & WIPHY_PARAM_FRAG_THRESHOLD) { - ret = mwifiex_set_frag(priv, - wiphy->frag_threshold); - if (ret) - return ret; - } - break; - } - } - - return 0; -} - -static int -mwifiex_cfg80211_deinit_p2p(struct mwifiex_private *priv) -{ - u16 mode = P2P_MODE_DISABLE; - - if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) - mwifiex_set_bss_role(priv, MWIFIEX_BSS_ROLE_STA); - - if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_P2P_MODE_CFG, - HostCmd_ACT_GEN_SET, 0, &mode)) - return -1; - - return 0; -} - -/* - * This function initializes the functionalities for P2P client. - * The P2P client initialization sequence is: - * disable -> device -> client - */ -static int -mwifiex_cfg80211_init_p2p_client(struct mwifiex_private *priv) -{ - u16 mode; - - if (mwifiex_cfg80211_deinit_p2p(priv)) - return -1; - - mode = P2P_MODE_DEVICE; - if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_P2P_MODE_CFG, - HostCmd_ACT_GEN_SET, 0, &mode)) - return -1; - - mode = P2P_MODE_CLIENT; - if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_P2P_MODE_CFG, - HostCmd_ACT_GEN_SET, 0, &mode)) - return -1; - - return 0; -} - -/* - * This function initializes the functionalities for P2P GO. - * The P2P GO initialization sequence is: - * disable -> device -> GO - */ -static int -mwifiex_cfg80211_init_p2p_go(struct mwifiex_private *priv) -{ - u16 mode; - - if (mwifiex_cfg80211_deinit_p2p(priv)) - return -1; - - mode = P2P_MODE_DEVICE; - if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_P2P_MODE_CFG, - HostCmd_ACT_GEN_SET, 0, &mode)) - return -1; - - mode = P2P_MODE_GO; - if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_P2P_MODE_CFG, - HostCmd_ACT_GEN_SET, 0, &mode)) - return -1; - - if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_UAP) - mwifiex_set_bss_role(priv, MWIFIEX_BSS_ROLE_UAP); - - return 0; -} - -/* - * CFG802.11 operation handler to change interface type. - */ -static int -mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, - struct net_device *dev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -{ - int ret; - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - - switch (dev->ieee80211_ptr->iftype) { - case NL80211_IFTYPE_ADHOC: - switch (type) { - case NL80211_IFTYPE_STATION: - break; - case NL80211_IFTYPE_UNSPECIFIED: - wiphy_warn(wiphy, "%s: kept type as IBSS\n", dev->name); - case NL80211_IFTYPE_ADHOC: /* This shouldn't happen */ - return 0; - case NL80211_IFTYPE_AP: - default: - wiphy_err(wiphy, "%s: changing to %d not supported\n", - dev->name, type); - return -EOPNOTSUPP; - } - break; - case NL80211_IFTYPE_STATION: - switch (type) { - case NL80211_IFTYPE_ADHOC: - break; - case NL80211_IFTYPE_P2P_CLIENT: - if (mwifiex_cfg80211_init_p2p_client(priv)) - return -EFAULT; - dev->ieee80211_ptr->iftype = type; - return 0; - case NL80211_IFTYPE_P2P_GO: - if (mwifiex_cfg80211_init_p2p_go(priv)) - return -EFAULT; - dev->ieee80211_ptr->iftype = type; - return 0; - case NL80211_IFTYPE_UNSPECIFIED: - wiphy_warn(wiphy, "%s: kept type as STA\n", dev->name); - case NL80211_IFTYPE_STATION: /* This shouldn't happen */ - return 0; - case NL80211_IFTYPE_AP: - default: - wiphy_err(wiphy, "%s: changing to %d not supported\n", - dev->name, type); - return -EOPNOTSUPP; - } - break; - case NL80211_IFTYPE_AP: - switch (type) { - case NL80211_IFTYPE_UNSPECIFIED: - wiphy_warn(wiphy, "%s: kept type as AP\n", dev->name); - case NL80211_IFTYPE_AP: /* This shouldn't happen */ - return 0; - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_STATION: - default: - wiphy_err(wiphy, "%s: changing to %d not supported\n", - dev->name, type); - return -EOPNOTSUPP; - } - break; - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_P2P_GO: - switch (type) { - case NL80211_IFTYPE_STATION: - if (mwifiex_cfg80211_deinit_p2p(priv)) - return -EFAULT; - dev->ieee80211_ptr->iftype = type; - return 0; - default: - return -EOPNOTSUPP; - } - break; - default: - wiphy_err(wiphy, "%s: unknown iftype: %d\n", - dev->name, dev->ieee80211_ptr->iftype); - return -EOPNOTSUPP; - } - - dev->ieee80211_ptr->iftype = type; - priv->bss_mode = type; - mwifiex_deauthenticate(priv, NULL); - - priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM; - - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_SET_BSS_MODE, - HostCmd_ACT_GEN_SET, 0, NULL); - - return ret; -} - -static void -mwifiex_parse_htinfo(struct mwifiex_private *priv, u8 tx_htinfo, - struct rate_info *rate) -{ - struct mwifiex_adapter *adapter = priv->adapter; - - if (adapter->is_hw_11ac_capable) { - /* bit[1-0]: 00=LG 01=HT 10=VHT */ - if (tx_htinfo & BIT(0)) { - /* HT */ - rate->mcs = priv->tx_rate; - rate->flags |= RATE_INFO_FLAGS_MCS; - } - if (tx_htinfo & BIT(1)) { - /* VHT */ - rate->mcs = priv->tx_rate & 0x0F; - rate->flags |= RATE_INFO_FLAGS_VHT_MCS; - } - - if (tx_htinfo & (BIT(1) | BIT(0))) { - /* HT or VHT */ - switch (tx_htinfo & (BIT(3) | BIT(2))) { - case 0: - /* This will be 20MHz */ - break; - case (BIT(2)): - rate->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; - break; - case (BIT(3)): - rate->flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; - break; - case (BIT(3) | BIT(2)): - rate->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH; - break; - } - - if (tx_htinfo & BIT(4)) - rate->flags |= RATE_INFO_FLAGS_SHORT_GI; - - if ((priv->tx_rate >> 4) == 1) - rate->nss = 2; - else - rate->nss = 1; - } - } else { - /* - * Bit 0 in tx_htinfo indicates that current Tx rate - * is 11n rate. Valid MCS index values for us are 0 to 15. - */ - if ((tx_htinfo & BIT(0)) && (priv->tx_rate < 16)) { - rate->mcs = priv->tx_rate; - rate->flags |= RATE_INFO_FLAGS_MCS; - if (tx_htinfo & BIT(1)) - rate->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; - if (tx_htinfo & BIT(2)) - rate->flags |= RATE_INFO_FLAGS_SHORT_GI; - } - } -} - -/* - * This function dumps the station information on a buffer. - * - * The following information are shown - - * - Total bytes transmitted - * - Total bytes received - * - Total packets transmitted - * - Total packets received - * - Signal quality level - * - Transmission rate - */ -static int -mwifiex_dump_station_info(struct mwifiex_private *priv, - struct station_info *sinfo) -{ - u32 rate; - - sinfo->filled = STATION_INFO_RX_BYTES | STATION_INFO_TX_BYTES | - STATION_INFO_RX_PACKETS | STATION_INFO_TX_PACKETS | - STATION_INFO_TX_BITRATE | - STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG; - - /* Get signal information from the firmware */ - if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_RSSI_INFO, - HostCmd_ACT_GEN_GET, 0, NULL)) { - dev_err(priv->adapter->dev, "failed to get signal information\n"); - return -EFAULT; - } - - if (mwifiex_drv_get_data_rate(priv, &rate)) { - dev_err(priv->adapter->dev, "getting data rate\n"); - return -EFAULT; - } - - /* Get DTIM period information from firmware */ - mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB, - HostCmd_ACT_GEN_GET, DTIM_PERIOD_I, - &priv->dtim_period); - - mwifiex_parse_htinfo(priv, priv->tx_htinfo, &sinfo->txrate); - - sinfo->signal_avg = priv->bcn_rssi_avg; - sinfo->rx_bytes = priv->stats.rx_bytes; - sinfo->tx_bytes = priv->stats.tx_bytes; - sinfo->rx_packets = priv->stats.rx_packets; - sinfo->tx_packets = priv->stats.tx_packets; - sinfo->signal = priv->bcn_rssi_avg; - /* bit rate is in 500 kb/s units. Convert it to 100kb/s units */ - sinfo->txrate.legacy = rate * 5; - - if (priv->bss_mode == NL80211_IFTYPE_STATION) { - sinfo->filled |= STATION_INFO_BSS_PARAM; - sinfo->bss_param.flags = 0; - if (priv->curr_bss_params.bss_descriptor.cap_info_bitmap & - WLAN_CAPABILITY_SHORT_PREAMBLE) - sinfo->bss_param.flags |= - BSS_PARAM_FLAGS_SHORT_PREAMBLE; - if (priv->curr_bss_params.bss_descriptor.cap_info_bitmap & - WLAN_CAPABILITY_SHORT_SLOT_TIME) - sinfo->bss_param.flags |= - BSS_PARAM_FLAGS_SHORT_SLOT_TIME; - sinfo->bss_param.dtim_period = priv->dtim_period; - sinfo->bss_param.beacon_interval = - priv->curr_bss_params.bss_descriptor.beacon_period; - } - - return 0; -} - -/* - * CFG802.11 operation handler to get station information. - * - * This function only works in connected mode, and dumps the - * requested station information, if available. - */ -static int -mwifiex_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, - u8 *mac, struct station_info *sinfo) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - - if (!priv->media_connected) - return -ENOENT; - if (memcmp(mac, priv->cfg_bssid, ETH_ALEN)) - return -ENOENT; - - return mwifiex_dump_station_info(priv, sinfo); -} - -/* - * CFG802.11 operation handler to dump station information. - */ -static int -mwifiex_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev, - int idx, u8 *mac, struct station_info *sinfo) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - - if (!priv->media_connected || idx) - return -ENOENT; - - memcpy(mac, priv->cfg_bssid, ETH_ALEN); - - return mwifiex_dump_station_info(priv, sinfo); -} - -/* Supported rates to be advertised to the cfg80211 */ -static struct ieee80211_rate mwifiex_rates[] = { - {.bitrate = 10, .hw_value = 2, }, - {.bitrate = 20, .hw_value = 4, }, - {.bitrate = 55, .hw_value = 11, }, - {.bitrate = 110, .hw_value = 22, }, - {.bitrate = 60, .hw_value = 12, }, - {.bitrate = 90, .hw_value = 18, }, - {.bitrate = 120, .hw_value = 24, }, - {.bitrate = 180, .hw_value = 36, }, - {.bitrate = 240, .hw_value = 48, }, - {.bitrate = 360, .hw_value = 72, }, - {.bitrate = 480, .hw_value = 96, }, - {.bitrate = 540, .hw_value = 108, }, -}; - -/* Channel definitions to be advertised to cfg80211 */ -static struct ieee80211_channel mwifiex_channels_2ghz[] = { - {.center_freq = 2412, .hw_value = 1, }, - {.center_freq = 2417, .hw_value = 2, }, - {.center_freq = 2422, .hw_value = 3, }, - {.center_freq = 2427, .hw_value = 4, }, - {.center_freq = 2432, .hw_value = 5, }, - {.center_freq = 2437, .hw_value = 6, }, - {.center_freq = 2442, .hw_value = 7, }, - {.center_freq = 2447, .hw_value = 8, }, - {.center_freq = 2452, .hw_value = 9, }, - {.center_freq = 2457, .hw_value = 10, }, - {.center_freq = 2462, .hw_value = 11, }, - {.center_freq = 2467, .hw_value = 12, }, - {.center_freq = 2472, .hw_value = 13, }, - {.center_freq = 2484, .hw_value = 14, }, -}; - -static struct ieee80211_supported_band mwifiex_band_2ghz = { - .channels = mwifiex_channels_2ghz, - .n_channels = ARRAY_SIZE(mwifiex_channels_2ghz), - .bitrates = mwifiex_rates, - .n_bitrates = ARRAY_SIZE(mwifiex_rates), -}; - -static struct ieee80211_channel mwifiex_channels_5ghz[] = { - {.center_freq = 5040, .hw_value = 8, }, - {.center_freq = 5060, .hw_value = 12, }, - {.center_freq = 5080, .hw_value = 16, }, - {.center_freq = 5170, .hw_value = 34, }, - {.center_freq = 5190, .hw_value = 38, }, - {.center_freq = 5210, .hw_value = 42, }, - {.center_freq = 5230, .hw_value = 46, }, - {.center_freq = 5180, .hw_value = 36, }, - {.center_freq = 5200, .hw_value = 40, }, - {.center_freq = 5220, .hw_value = 44, }, - {.center_freq = 5240, .hw_value = 48, }, - {.center_freq = 5260, .hw_value = 52, }, - {.center_freq = 5280, .hw_value = 56, }, - {.center_freq = 5300, .hw_value = 60, }, - {.center_freq = 5320, .hw_value = 64, }, - {.center_freq = 5500, .hw_value = 100, }, - {.center_freq = 5520, .hw_value = 104, }, - {.center_freq = 5540, .hw_value = 108, }, - {.center_freq = 5560, .hw_value = 112, }, - {.center_freq = 5580, .hw_value = 116, }, - {.center_freq = 5600, .hw_value = 120, }, - {.center_freq = 5620, .hw_value = 124, }, - {.center_freq = 5640, .hw_value = 128, }, - {.center_freq = 5660, .hw_value = 132, }, - {.center_freq = 5680, .hw_value = 136, }, - {.center_freq = 5700, .hw_value = 140, }, - {.center_freq = 5745, .hw_value = 149, }, - {.center_freq = 5765, .hw_value = 153, }, - {.center_freq = 5785, .hw_value = 157, }, - {.center_freq = 5805, .hw_value = 161, }, - {.center_freq = 5825, .hw_value = 165, }, -}; - -static struct ieee80211_supported_band mwifiex_band_5ghz = { - .channels = mwifiex_channels_5ghz, - .n_channels = ARRAY_SIZE(mwifiex_channels_5ghz), - .bitrates = mwifiex_rates + 4, - .n_bitrates = ARRAY_SIZE(mwifiex_rates) - 4, -}; - - -/* Supported crypto cipher suits to be advertised to cfg80211 */ -static const u32 mwifiex_cipher_suites[] = { - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, - WLAN_CIPHER_SUITE_AES_CMAC, -}; - -/* Supported mgmt frame types to be advertised to cfg80211 */ -static const struct ieee80211_txrx_stypes -mwifiex_mgmt_stypes[NUM_NL80211_IFTYPES] = { - [NL80211_IFTYPE_STATION] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4), - }, - [NL80211_IFTYPE_AP] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4), - }, - [NL80211_IFTYPE_P2P_CLIENT] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4), - }, - [NL80211_IFTYPE_P2P_GO] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4), - }, -}; - -/* - * CFG802.11 operation handler for setting bit rates. - * - * Function configures data rates to firmware using bitrate mask - * provided by cfg80211. - */ -static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy, - struct net_device *dev, - const u8 *peer, - const struct cfg80211_bitrate_mask *mask) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - u16 bitmap_rates[MAX_BITMAP_RATES_SIZE]; - enum ieee80211_band band; - - if (!priv->media_connected) { - dev_err(priv->adapter->dev, - "Can not set Tx data rate in disconnected state\n"); - return -EINVAL; - } - - band = mwifiex_band_to_radio_type(priv->curr_bss_params.band); - - memset(bitmap_rates, 0, sizeof(bitmap_rates)); - - /* Fill HR/DSSS rates. */ - if (band == IEEE80211_BAND_2GHZ) - bitmap_rates[0] = mask->control[band].legacy & 0x000f; - - /* Fill OFDM rates */ - if (band == IEEE80211_BAND_2GHZ) - bitmap_rates[1] = (mask->control[band].legacy & 0x0ff0) >> 4; - else - bitmap_rates[1] = mask->control[band].legacy; - - /* Fill MCS rates */ - bitmap_rates[2] = mask->control[band].mcs[0]; - if (priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2) - bitmap_rates[2] |= mask->control[band].mcs[1] << 8; - - return mwifiex_send_cmd_sync(priv, HostCmd_CMD_TX_RATE_CFG, - HostCmd_ACT_GEN_SET, 0, bitmap_rates); -} - -/* - * CFG802.11 operation handler for connection quality monitoring. - * - * This function subscribes/unsubscribes HIGH_RSSI and LOW_RSSI - * events to FW. - */ -static int mwifiex_cfg80211_set_cqm_rssi_config(struct wiphy *wiphy, - struct net_device *dev, - s32 rssi_thold, u32 rssi_hyst) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - struct mwifiex_ds_misc_subsc_evt subsc_evt; - - priv->cqm_rssi_thold = rssi_thold; - priv->cqm_rssi_hyst = rssi_hyst; - - memset(&subsc_evt, 0x00, sizeof(struct mwifiex_ds_misc_subsc_evt)); - subsc_evt.events = BITMASK_BCN_RSSI_LOW | BITMASK_BCN_RSSI_HIGH; - - /* Subscribe/unsubscribe low and high rssi events */ - if (rssi_thold && rssi_hyst) { - subsc_evt.action = HostCmd_ACT_BITWISE_SET; - subsc_evt.bcn_l_rssi_cfg.abs_value = abs(rssi_thold); - subsc_evt.bcn_h_rssi_cfg.abs_value = abs(rssi_thold); - subsc_evt.bcn_l_rssi_cfg.evt_freq = 1; - subsc_evt.bcn_h_rssi_cfg.evt_freq = 1; - return mwifiex_send_cmd_sync(priv, - HostCmd_CMD_802_11_SUBSCRIBE_EVENT, - 0, 0, &subsc_evt); - } else { - subsc_evt.action = HostCmd_ACT_BITWISE_CLR; - return mwifiex_send_cmd_sync(priv, - HostCmd_CMD_802_11_SUBSCRIBE_EVENT, - 0, 0, &subsc_evt); - } - - return 0; -} - -/* cfg80211 operation handler for change_beacon. - * Function retrieves and sets modified management IEs to FW. - */ -static int mwifiex_cfg80211_change_beacon(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_beacon_data *data) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - - if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_UAP) { - wiphy_err(wiphy, "%s: bss_type mismatched\n", __func__); - return -EINVAL; - } - - if (!priv->bss_started) { - wiphy_err(wiphy, "%s: bss not started\n", __func__); - return -EINVAL; - } - - if (mwifiex_set_mgmt_ies(priv, data)) { - wiphy_err(wiphy, "%s: setting mgmt ies failed\n", __func__); - return -EFAULT; - } - - return 0; -} - -static int -mwifiex_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) -{ - struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - struct mwifiex_private *priv = mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_ANY); - struct mwifiex_ds_ant_cfg ant_cfg; - - if (!tx_ant || !rx_ant) - return -EOPNOTSUPP; - - if (adapter->hw_dev_mcs_support != HT_STREAM_2X2) { - /* Not a MIMO chip. User should provide specific antenna number - * for Tx/Rx path or enable all antennas for diversity - */ - if (tx_ant != rx_ant) - return -EOPNOTSUPP; - - if ((tx_ant & (tx_ant - 1)) && - (tx_ant != BIT(adapter->number_of_antenna) - 1)) - return -EOPNOTSUPP; - - if ((tx_ant == BIT(adapter->number_of_antenna) - 1) && - (priv->adapter->number_of_antenna > 1)) { - tx_ant = RF_ANTENNA_AUTO; - rx_ant = RF_ANTENNA_AUTO; - } - } - - ant_cfg.tx_ant = tx_ant; - ant_cfg.rx_ant = rx_ant; - - return mwifiex_send_cmd_sync(priv, HostCmd_CMD_RF_ANTENNA, - HostCmd_ACT_GEN_SET, 0, &ant_cfg); -} - -/* cfg80211 operation handler for stop ap. - * Function stops BSS running at uAP interface. - */ -static int mwifiex_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - - if (mwifiex_del_mgmt_ies(priv)) - wiphy_err(wiphy, "Failed to delete mgmt IEs!\n"); - - priv->ap_11n_enabled = 0; - - if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_UAP_BSS_STOP, - HostCmd_ACT_GEN_SET, 0, NULL)) { - wiphy_err(wiphy, "Failed to stop the BSS\n"); - return -1; - } - - return 0; -} - -/* cfg80211 operation handler for start_ap. - * Function sets beacon period, DTIM period, SSID and security into - * AP config structure. - * AP is configured with these settings and BSS is started. - */ -static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_ap_settings *params) -{ - struct mwifiex_uap_bss_param *bss_cfg; - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - u8 config_bands = 0; - - if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_UAP) - return -1; - if (mwifiex_set_mgmt_ies(priv, ¶ms->beacon)) - return -1; - - bss_cfg = kzalloc(sizeof(struct mwifiex_uap_bss_param), GFP_KERNEL); - if (!bss_cfg) - return -ENOMEM; - - mwifiex_set_sys_config_invalid_data(bss_cfg); - - if (params->beacon_interval) - bss_cfg->beacon_period = params->beacon_interval; - if (params->dtim_period) - bss_cfg->dtim_period = params->dtim_period; - - if (params->ssid && params->ssid_len) { - memcpy(bss_cfg->ssid.ssid, params->ssid, params->ssid_len); - bss_cfg->ssid.ssid_len = params->ssid_len; - } - - switch (params->hidden_ssid) { - case NL80211_HIDDEN_SSID_NOT_IN_USE: - bss_cfg->bcast_ssid_ctl = 1; - break; - case NL80211_HIDDEN_SSID_ZERO_LEN: - bss_cfg->bcast_ssid_ctl = 0; - break; - case NL80211_HIDDEN_SSID_ZERO_CONTENTS: - /* firmware doesn't support this type of hidden SSID */ - default: - kfree(bss_cfg); - return -EINVAL; - } - - bss_cfg->channel = ieee80211_frequency_to_channel( - params->chandef.chan->center_freq); - - /* Set appropriate bands */ - if (params->chandef.chan->band == IEEE80211_BAND_2GHZ) { - bss_cfg->band_cfg = BAND_CONFIG_BG; - config_bands = BAND_B | BAND_G; - - if (params->chandef.width > NL80211_CHAN_WIDTH_20_NOHT) - config_bands |= BAND_GN; - - if (params->chandef.width > NL80211_CHAN_WIDTH_40) - config_bands |= BAND_GAC; - } else { - bss_cfg->band_cfg = BAND_CONFIG_A; - config_bands = BAND_A; - - if (params->chandef.width > NL80211_CHAN_WIDTH_20_NOHT) - config_bands |= BAND_AN; - - if (params->chandef.width > NL80211_CHAN_WIDTH_40) - config_bands |= BAND_AAC; - } - - if (!((config_bands | priv->adapter->fw_bands) & - ~priv->adapter->fw_bands)) - priv->adapter->config_bands = config_bands; - - mwifiex_set_uap_rates(bss_cfg, params); - mwifiex_send_domain_info_cmd_fw(wiphy); - - if (mwifiex_set_secure_params(priv, bss_cfg, params)) { - kfree(bss_cfg); - wiphy_err(wiphy, "Failed to parse secuirty parameters!\n"); - return -1; - } - - mwifiex_set_ht_params(priv, bss_cfg, params); - - if (priv->adapter->is_hw_11ac_capable) { - mwifiex_set_vht_params(priv, bss_cfg, params); - mwifiex_set_vht_width(priv, params->chandef.width, - priv->ap_11ac_enabled); - } - - if (priv->ap_11ac_enabled) - mwifiex_set_11ac_ba_params(priv); - else - mwifiex_set_ba_params(priv); - - mwifiex_set_wmm_params(priv, bss_cfg, params); - - if (params->inactivity_timeout > 0) { - /* sta_ao_timer/ps_sta_ao_timer is in unit of 100ms */ - bss_cfg->sta_ao_timer = 10 * params->inactivity_timeout; - bss_cfg->ps_sta_ao_timer = 10 * params->inactivity_timeout; - } - - if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_UAP_BSS_STOP, - HostCmd_ACT_GEN_SET, 0, NULL)) { - wiphy_err(wiphy, "Failed to stop the BSS\n"); - kfree(bss_cfg); - return -1; - } - - if (mwifiex_send_cmd_async(priv, HostCmd_CMD_UAP_SYS_CONFIG, - HostCmd_ACT_GEN_SET, - UAP_BSS_PARAMS_I, bss_cfg)) { - wiphy_err(wiphy, "Failed to set the SSID\n"); - kfree(bss_cfg); - return -1; - } - - kfree(bss_cfg); - - if (mwifiex_send_cmd_async(priv, HostCmd_CMD_UAP_BSS_START, - HostCmd_ACT_GEN_SET, 0, NULL)) { - wiphy_err(wiphy, "Failed to start the BSS\n"); - return -1; - } - - if (priv->sec_info.wep_enabled) - priv->curr_pkt_filter |= HostCmd_ACT_MAC_WEP_ENABLE; - else - priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_WEP_ENABLE; - - if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_MAC_CONTROL, - HostCmd_ACT_GEN_SET, 0, - &priv->curr_pkt_filter)) - return -1; - - return 0; -} - -/* - * CFG802.11 operation handler for disconnection request. - * - * This function does not work when there is already a disconnection - * procedure going on. - */ -static int -mwifiex_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, - u16 reason_code) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - - if (mwifiex_deauthenticate(priv, NULL)) - return -EFAULT; - - wiphy_dbg(wiphy, "info: successfully disconnected from %pM:" - " reason code %d\n", priv->cfg_bssid, reason_code); - - memset(priv->cfg_bssid, 0, ETH_ALEN); - - return 0; -} - -/* - * This function informs the CFG802.11 subsystem of a new IBSS. - * - * The following information are sent to the CFG802.11 subsystem - * to register the new IBSS. If we do not register the new IBSS, - * a kernel panic will result. - * - SSID - * - SSID length - * - BSSID - * - Channel - */ -static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv) -{ - struct ieee80211_channel *chan; - struct mwifiex_bss_info bss_info; - struct cfg80211_bss *bss; - int ie_len; - u8 ie_buf[IEEE80211_MAX_SSID_LEN + sizeof(struct ieee_types_header)]; - enum ieee80211_band band; - - if (mwifiex_get_bss_info(priv, &bss_info)) - return -1; - - ie_buf[0] = WLAN_EID_SSID; - ie_buf[1] = bss_info.ssid.ssid_len; - - memcpy(&ie_buf[sizeof(struct ieee_types_header)], - &bss_info.ssid.ssid, bss_info.ssid.ssid_len); - ie_len = ie_buf[1] + sizeof(struct ieee_types_header); - - band = mwifiex_band_to_radio_type(priv->curr_bss_params.band); - chan = __ieee80211_get_channel(priv->wdev->wiphy, - ieee80211_channel_to_frequency(bss_info.bss_chan, - band)); - - bss = cfg80211_inform_bss(priv->wdev->wiphy, chan, - bss_info.bssid, 0, WLAN_CAPABILITY_IBSS, - 0, ie_buf, ie_len, 0, GFP_KERNEL); - cfg80211_put_bss(priv->wdev->wiphy, bss); - memcpy(priv->cfg_bssid, bss_info.bssid, ETH_ALEN); - - return 0; -} - -/* - * This function connects with a BSS. - * - * This function handles both Infra and Ad-Hoc modes. It also performs - * validity checking on the provided parameters, disconnects from the - * current BSS (if any), sets up the association/scan parameters, - * including security settings, and performs specific SSID scan before - * trying to connect. - * - * For Infra mode, the function returns failure if the specified SSID - * is not found in scan table. However, for Ad-Hoc mode, it can create - * the IBSS if it does not exist. On successful completion in either case, - * the function notifies the CFG802.11 subsystem of the new BSS connection. - */ -static int -mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, - u8 *bssid, int mode, struct ieee80211_channel *channel, - struct cfg80211_connect_params *sme, bool privacy) -{ - struct cfg80211_ssid req_ssid; - int ret, auth_type = 0; - struct cfg80211_bss *bss = NULL; - u8 is_scanning_required = 0; - - memset(&req_ssid, 0, sizeof(struct cfg80211_ssid)); - - req_ssid.ssid_len = ssid_len; - if (ssid_len > IEEE80211_MAX_SSID_LEN) { - dev_err(priv->adapter->dev, "invalid SSID - aborting\n"); - return -EINVAL; - } - - memcpy(req_ssid.ssid, ssid, ssid_len); - if (!req_ssid.ssid_len || req_ssid.ssid[0] < 0x20) { - dev_err(priv->adapter->dev, "invalid SSID - aborting\n"); - return -EINVAL; - } - - /* disconnect before try to associate */ - mwifiex_deauthenticate(priv, NULL); - - /* As this is new association, clear locally stored - * keys and security related flags */ - priv->sec_info.wpa_enabled = false; - priv->sec_info.wpa2_enabled = false; - priv->wep_key_curr_index = 0; - priv->sec_info.encryption_mode = 0; - priv->sec_info.is_authtype_auto = 0; - ret = mwifiex_set_encode(priv, NULL, NULL, 0, 0, NULL, 1); - - if (mode == NL80211_IFTYPE_ADHOC) { - /* "privacy" is set only for ad-hoc mode */ - if (privacy) { - /* - * Keep WLAN_CIPHER_SUITE_WEP104 for now so that - * the firmware can find a matching network from the - * scan. The cfg80211 does not give us the encryption - * mode at this stage so just setting it to WEP here. - */ - priv->sec_info.encryption_mode = - WLAN_CIPHER_SUITE_WEP104; - priv->sec_info.authentication_mode = - NL80211_AUTHTYPE_OPEN_SYSTEM; - } - - goto done; - } - - /* Now handle infra mode. "sme" is valid for infra mode only */ - if (sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC) { - auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM; - priv->sec_info.is_authtype_auto = 1; - } else { - auth_type = sme->auth_type; - } - - if (sme->crypto.n_ciphers_pairwise) { - priv->sec_info.encryption_mode = - sme->crypto.ciphers_pairwise[0]; - priv->sec_info.authentication_mode = auth_type; - } - - if (sme->crypto.cipher_group) { - priv->sec_info.encryption_mode = sme->crypto.cipher_group; - priv->sec_info.authentication_mode = auth_type; - } - if (sme->ie) - ret = mwifiex_set_gen_ie(priv, sme->ie, sme->ie_len); - - if (sme->key) { - if (mwifiex_is_alg_wep(priv->sec_info.encryption_mode)) { - dev_dbg(priv->adapter->dev, - "info: setting wep encryption" - " with key len %d\n", sme->key_len); - priv->wep_key_curr_index = sme->key_idx; - ret = mwifiex_set_encode(priv, NULL, sme->key, - sme->key_len, sme->key_idx, - NULL, 0); - } - } -done: - /* - * Scan entries are valid for some time (15 sec). So we can save one - * active scan time if we just try cfg80211_get_bss first. If it fails - * then request scan and cfg80211_get_bss() again for final output. - */ - while (1) { - if (is_scanning_required) { - /* Do specific SSID scanning */ - if (mwifiex_request_scan(priv, &req_ssid)) { - dev_err(priv->adapter->dev, "scan error\n"); - return -EFAULT; - } - } - - /* Find the BSS we want using available scan results */ - if (mode == NL80211_IFTYPE_ADHOC) - bss = cfg80211_get_bss(priv->wdev->wiphy, channel, - bssid, ssid, ssid_len, - WLAN_CAPABILITY_IBSS, - WLAN_CAPABILITY_IBSS); - else - bss = cfg80211_get_bss(priv->wdev->wiphy, channel, - bssid, ssid, ssid_len, - WLAN_CAPABILITY_ESS, - WLAN_CAPABILITY_ESS); - - if (!bss) { - if (is_scanning_required) { - dev_warn(priv->adapter->dev, - "assoc: requested bss not found in scan results\n"); - break; - } - is_scanning_required = 1; - } else { - dev_dbg(priv->adapter->dev, - "info: trying to associate to '%s' bssid %pM\n", - (char *) req_ssid.ssid, bss->bssid); - memcpy(&priv->cfg_bssid, bss->bssid, ETH_ALEN); - break; - } - } - - ret = mwifiex_bss_start(priv, bss, &req_ssid); - if (ret) - return ret; - - if (mode == NL80211_IFTYPE_ADHOC) { - /* Inform the BSS information to kernel, otherwise - * kernel will give a panic after successful assoc */ - if (mwifiex_cfg80211_inform_ibss_bss(priv)) - return -EFAULT; - } - - return ret; -} - -/* - * CFG802.11 operation handler for association request. - * - * This function does not work when the current mode is set to Ad-Hoc, or - * when there is already an association procedure going on. The given BSS - * information is used to associate. - */ -static int -mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_connect_params *sme) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - int ret; - - if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) { - wiphy_err(wiphy, - "%s: reject infra assoc request in non-STA role\n", - dev->name); - return -EINVAL; - } - - wiphy_dbg(wiphy, "info: Trying to associate to %s and bssid %pM\n", - (char *) sme->ssid, sme->bssid); - - ret = mwifiex_cfg80211_assoc(priv, sme->ssid_len, sme->ssid, sme->bssid, - priv->bss_mode, sme->channel, sme, 0); - if (!ret) { - cfg80211_connect_result(priv->netdev, priv->cfg_bssid, NULL, 0, - NULL, 0, WLAN_STATUS_SUCCESS, - GFP_KERNEL); - dev_dbg(priv->adapter->dev, - "info: associated to bssid %pM successfully\n", - priv->cfg_bssid); - } else { - dev_dbg(priv->adapter->dev, - "info: association to bssid %pM failed\n", - priv->cfg_bssid); - memset(priv->cfg_bssid, 0, ETH_ALEN); - - if (ret > 0) - cfg80211_connect_result(priv->netdev, priv->cfg_bssid, - NULL, 0, NULL, 0, ret, - GFP_KERNEL); - else - cfg80211_connect_result(priv->netdev, priv->cfg_bssid, - NULL, 0, NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, - GFP_KERNEL); - } - - return 0; -} - -/* - * This function sets following parameters for ibss network. - * - channel - * - start band - * - 11n flag - * - secondary channel offset - */ -static int mwifiex_set_ibss_params(struct mwifiex_private *priv, - struct cfg80211_ibss_params *params) -{ - struct wiphy *wiphy = priv->wdev->wiphy; - struct mwifiex_adapter *adapter = priv->adapter; - int index = 0, i; - u8 config_bands = 0; - - if (params->chandef.chan->band == IEEE80211_BAND_2GHZ) { - if (!params->basic_rates) { - config_bands = BAND_B | BAND_G; - } else { - for (i = 0; i < mwifiex_band_2ghz.n_bitrates; i++) { - /* - * Rates below 6 Mbps in the table are CCK - * rates; 802.11b and from 6 they are OFDM; - * 802.11G - */ - if (mwifiex_rates[i].bitrate == 60) { - index = 1 << i; - break; - } - } - - if (params->basic_rates < index) { - config_bands = BAND_B; - } else { - config_bands = BAND_G; - if (params->basic_rates % index) - config_bands |= BAND_B; - } - } - - if (cfg80211_get_chandef_type(¶ms->chandef) != - NL80211_CHAN_NO_HT) - config_bands |= BAND_G | BAND_GN; - } else { - if (cfg80211_get_chandef_type(¶ms->chandef) == - NL80211_CHAN_NO_HT) - config_bands = BAND_A; - else - config_bands = BAND_AN | BAND_A; - } - - if (!((config_bands | adapter->fw_bands) & ~adapter->fw_bands)) { - adapter->config_bands = config_bands; - adapter->adhoc_start_band = config_bands; - - if ((config_bands & BAND_GN) || (config_bands & BAND_AN)) - adapter->adhoc_11n_enabled = true; - else - adapter->adhoc_11n_enabled = false; - } - - adapter->sec_chan_offset = - mwifiex_chan_type_to_sec_chan_offset( - cfg80211_get_chandef_type(¶ms->chandef)); - priv->adhoc_channel = ieee80211_frequency_to_channel( - params->chandef.chan->center_freq); - - wiphy_dbg(wiphy, "info: set ibss band %d, chan %d, chan offset %d\n", - config_bands, priv->adhoc_channel, adapter->sec_chan_offset); - - return 0; -} - -/* - * CFG802.11 operation handler to join an IBSS. - * - * This function does not work in any mode other than Ad-Hoc, or if - * a join operation is already in progress. - */ -static int -mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ibss_params *params) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - int ret = 0; - - if (priv->bss_mode != NL80211_IFTYPE_ADHOC) { - wiphy_err(wiphy, "request to join ibss received " - "when station is not in ibss mode\n"); - goto done; - } - - wiphy_dbg(wiphy, "info: trying to join to %s and bssid %pM\n", - (char *) params->ssid, params->bssid); - - mwifiex_set_ibss_params(priv, params); - - ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid, - params->bssid, priv->bss_mode, - params->chandef.chan, NULL, - params->privacy); -done: - if (!ret) { - cfg80211_ibss_joined(priv->netdev, priv->cfg_bssid, GFP_KERNEL); - dev_dbg(priv->adapter->dev, - "info: joined/created adhoc network with bssid" - " %pM successfully\n", priv->cfg_bssid); - } else { - dev_dbg(priv->adapter->dev, - "info: failed creating/joining adhoc network\n"); - } - - return ret; -} - -/* - * CFG802.11 operation handler to leave an IBSS. - * - * This function does not work if a leave operation is - * already in progress. - */ -static int -mwifiex_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - - wiphy_dbg(wiphy, "info: disconnecting from essid %pM\n", - priv->cfg_bssid); - if (mwifiex_deauthenticate(priv, NULL)) - return -EFAULT; - - memset(priv->cfg_bssid, 0, ETH_ALEN); - - return 0; -} - -/* - * CFG802.11 operation handler for scan request. - * - * This function issues a scan request to the firmware based upon - * the user specified scan configuration. On successfull completion, - * it also informs the results. - */ -static int -mwifiex_cfg80211_scan(struct wiphy *wiphy, - struct cfg80211_scan_request *request) -{ - struct net_device *dev = request->wdev->netdev; - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - int i, offset, ret; - struct ieee80211_channel *chan; - struct ieee_types_header *ie; - - wiphy_dbg(wiphy, "info: received scan request on %s\n", dev->name); - - if ((request->flags & NL80211_SCAN_FLAG_LOW_PRIORITY) && - atomic_read(&priv->wmm.tx_pkts_queued) >= - MWIFIEX_MIN_TX_PENDING_TO_CANCEL_SCAN) { - dev_dbg(priv->adapter->dev, "scan rejected due to traffic\n"); - return -EBUSY; - } - - if (priv->user_scan_cfg) { - dev_err(priv->adapter->dev, "cmd: Scan already in process..\n"); - return -EBUSY; - } - - priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), - GFP_KERNEL); - if (!priv->user_scan_cfg) - return -ENOMEM; - - priv->scan_request = request; - - priv->user_scan_cfg->num_ssids = request->n_ssids; - priv->user_scan_cfg->ssid_list = request->ssids; - - if (request->ie && request->ie_len) { - offset = 0; - for (i = 0; i < MWIFIEX_MAX_VSIE_NUM; i++) { - if (priv->vs_ie[i].mask != MWIFIEX_VSIE_MASK_CLEAR) - continue; - priv->vs_ie[i].mask = MWIFIEX_VSIE_MASK_SCAN; - ie = (struct ieee_types_header *)(request->ie + offset); - memcpy(&priv->vs_ie[i].ie, ie, sizeof(*ie) + ie->len); - offset += sizeof(*ie) + ie->len; - - if (offset >= request->ie_len) - break; - } - } - - for (i = 0; i < min_t(u32, request->n_channels, - MWIFIEX_USER_SCAN_CHAN_MAX); i++) { - chan = request->channels[i]; - priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value; - priv->user_scan_cfg->chan_list[i].radio_type = chan->band; - - if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) - priv->user_scan_cfg->chan_list[i].scan_type = - MWIFIEX_SCAN_TYPE_PASSIVE; - else - priv->user_scan_cfg->chan_list[i].scan_type = - MWIFIEX_SCAN_TYPE_ACTIVE; - - priv->user_scan_cfg->chan_list[i].scan_time = 0; - } - - ret = mwifiex_scan_networks(priv, priv->user_scan_cfg); - if (ret) { - dev_err(priv->adapter->dev, "scan failed: %d\n", ret); - priv->scan_request = NULL; - kfree(priv->user_scan_cfg); - priv->user_scan_cfg = NULL; - return ret; - } - - if (request->ie && request->ie_len) { - for (i = 0; i < MWIFIEX_MAX_VSIE_NUM; i++) { - if (priv->vs_ie[i].mask == MWIFIEX_VSIE_MASK_SCAN) { - priv->vs_ie[i].mask = MWIFIEX_VSIE_MASK_CLEAR; - memset(&priv->vs_ie[i].ie, 0, - MWIFIEX_MAX_VSIE_LEN); - } - } - } - return 0; -} - -static void mwifiex_setup_vht_caps(struct ieee80211_sta_vht_cap *vht_info, - struct mwifiex_private *priv) -{ - struct mwifiex_adapter *adapter = priv->adapter; - - vht_info->vht_supported = true; - - vht_info->cap = adapter->hw_dot_11ac_dev_cap; - /* Update MCS support for VHT */ - vht_info->vht_mcs.rx_mcs_map = cpu_to_le16( - adapter->hw_dot_11ac_mcs_support & 0xFFFF); - vht_info->vht_mcs.rx_highest = 0; - vht_info->vht_mcs.tx_mcs_map = cpu_to_le16( - adapter->hw_dot_11ac_mcs_support >> 16); - vht_info->vht_mcs.tx_highest = 0; -} - -/* - * This function sets up the CFG802.11 specific HT capability fields - * with default values. - * - * The following default values are set - - * - HT Supported = True - * - Maximum AMPDU length factor = IEEE80211_HT_MAX_AMPDU_64K - * - Minimum AMPDU spacing = IEEE80211_HT_MPDU_DENSITY_NONE - * - HT Capabilities supported by firmware - * - MCS information, Rx mask = 0xff - * - MCD information, Tx parameters = IEEE80211_HT_MCS_TX_DEFINED (0x01) - */ -static void -mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info, - struct mwifiex_private *priv) -{ - int rx_mcs_supp; - struct ieee80211_mcs_info mcs_set; - u8 *mcs = (u8 *)&mcs_set; - struct mwifiex_adapter *adapter = priv->adapter; - - ht_info->ht_supported = true; - ht_info->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; - ht_info->ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE; - - memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); - - /* Fill HT capability information */ - if (ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap)) - ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; - else - ht_info->cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; - - if (ISSUPP_SHORTGI20(adapter->hw_dot_11n_dev_cap)) - ht_info->cap |= IEEE80211_HT_CAP_SGI_20; - else - ht_info->cap &= ~IEEE80211_HT_CAP_SGI_20; - - if (ISSUPP_SHORTGI40(adapter->hw_dot_11n_dev_cap)) - ht_info->cap |= IEEE80211_HT_CAP_SGI_40; - else - ht_info->cap &= ~IEEE80211_HT_CAP_SGI_40; - - if (ISSUPP_RXSTBC(adapter->hw_dot_11n_dev_cap)) - ht_info->cap |= 1 << IEEE80211_HT_CAP_RX_STBC_SHIFT; - else - ht_info->cap &= ~(3 << IEEE80211_HT_CAP_RX_STBC_SHIFT); - - if (ISSUPP_TXSTBC(adapter->hw_dot_11n_dev_cap)) - ht_info->cap |= IEEE80211_HT_CAP_TX_STBC; - else - ht_info->cap &= ~IEEE80211_HT_CAP_TX_STBC; - - if (ISSUPP_GREENFIELD(adapter->hw_dot_11n_dev_cap)) - ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD; - else - ht_info->cap &= ~IEEE80211_HT_CAP_GRN_FLD; - - if (ISENABLED_40MHZ_INTOLERANT(adapter->hw_dot_11n_dev_cap)) - ht_info->cap |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; - else - ht_info->cap &= ~IEEE80211_HT_CAP_40MHZ_INTOLERANT; - - if (ISSUPP_RXLDPC(adapter->hw_dot_11n_dev_cap)) - ht_info->cap |= IEEE80211_HT_CAP_LDPC_CODING; - else - ht_info->cap &= ~IEEE80211_HT_CAP_LDPC_CODING; - - ht_info->cap &= ~IEEE80211_HT_CAP_MAX_AMSDU; - ht_info->cap |= IEEE80211_HT_CAP_SM_PS; - - rx_mcs_supp = GET_RXMCSSUPP(adapter->hw_dev_mcs_support); - /* Set MCS for 1x1 */ - memset(mcs, 0xff, rx_mcs_supp); - /* Clear all the other values */ - memset(&mcs[rx_mcs_supp], 0, - sizeof(struct ieee80211_mcs_info) - rx_mcs_supp); - if (priv->bss_mode == NL80211_IFTYPE_STATION || - ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap)) - /* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */ - SETHT_MCS32(mcs_set.rx_mask); - - memcpy((u8 *) &ht_info->mcs, mcs, sizeof(struct ieee80211_mcs_info)); - - ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; -} - -/* - * create a new virtual interface with the given name - */ -struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, - const char *name, - enum nl80211_iftype type, - u32 *flags, - struct vif_params *params) -{ - struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - struct mwifiex_private *priv; - struct net_device *dev; - void *mdev_priv; - struct wireless_dev *wdev; - - if (!adapter) - return ERR_PTR(-EFAULT); - - switch (type) { - case NL80211_IFTYPE_UNSPECIFIED: - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_ADHOC: - priv = adapter->priv[MWIFIEX_BSS_TYPE_STA]; - if (priv->bss_mode) { - wiphy_err(wiphy, - "cannot create multiple sta/adhoc ifaces\n"); - return ERR_PTR(-EINVAL); - } - - wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); - if (!wdev) - return ERR_PTR(-ENOMEM); - - wdev->wiphy = wiphy; - priv->wdev = wdev; - wdev->iftype = NL80211_IFTYPE_STATION; - - if (type == NL80211_IFTYPE_UNSPECIFIED) - priv->bss_mode = NL80211_IFTYPE_STATION; - else - priv->bss_mode = type; - - priv->bss_type = MWIFIEX_BSS_TYPE_STA; - priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II; - priv->bss_priority = 0; - priv->bss_role = MWIFIEX_BSS_ROLE_STA; - priv->bss_num = 0; - - break; - case NL80211_IFTYPE_AP: - priv = adapter->priv[MWIFIEX_BSS_TYPE_UAP]; - - if (priv->bss_mode) { - wiphy_err(wiphy, "Can't create multiple AP interfaces"); - return ERR_PTR(-EINVAL); - } - - wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); - if (!wdev) - return ERR_PTR(-ENOMEM); - - priv->wdev = wdev; - wdev->wiphy = wiphy; - wdev->iftype = NL80211_IFTYPE_AP; - - priv->bss_type = MWIFIEX_BSS_TYPE_UAP; - priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II; - priv->bss_priority = 0; - priv->bss_role = MWIFIEX_BSS_ROLE_UAP; - priv->bss_started = 0; - priv->bss_num = 0; - priv->bss_mode = type; - - break; - case NL80211_IFTYPE_P2P_CLIENT: - priv = adapter->priv[MWIFIEX_BSS_TYPE_P2P]; - - if (priv->bss_mode) { - wiphy_err(wiphy, "Can't create multiple P2P ifaces"); - return ERR_PTR(-EINVAL); - } - - wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); - if (!wdev) - return ERR_PTR(-ENOMEM); - - priv->wdev = wdev; - wdev->wiphy = wiphy; - - /* At start-up, wpa_supplicant tries to change the interface - * to NL80211_IFTYPE_STATION if it is not managed mode. - */ - wdev->iftype = NL80211_IFTYPE_P2P_CLIENT; - priv->bss_mode = NL80211_IFTYPE_P2P_CLIENT; - - /* Setting bss_type to P2P tells firmware that this interface - * is receiving P2P peers found during find phase and doing - * action frame handshake. - */ - priv->bss_type = MWIFIEX_BSS_TYPE_P2P; - - priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II; - priv->bss_priority = MWIFIEX_BSS_ROLE_STA; - priv->bss_role = MWIFIEX_BSS_ROLE_STA; - priv->bss_started = 0; - priv->bss_num = 0; - - if (mwifiex_cfg80211_init_p2p_client(priv)) - return ERR_PTR(-EFAULT); - - break; - default: - wiphy_err(wiphy, "type not supported\n"); - return ERR_PTR(-EINVAL); - } - - dev = alloc_netdev_mqs(sizeof(struct mwifiex_private *), name, - ether_setup, IEEE80211_NUM_ACS, 1); - if (!dev) { - wiphy_err(wiphy, "no memory available for netdevice\n"); - priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; - return ERR_PTR(-ENOMEM); - } - - mwifiex_init_priv_params(priv, dev); - priv->netdev = dev; - - mwifiex_setup_ht_caps(&wiphy->bands[IEEE80211_BAND_2GHZ]->ht_cap, priv); - if (adapter->is_hw_11ac_capable) - mwifiex_setup_vht_caps( - &wiphy->bands[IEEE80211_BAND_2GHZ]->vht_cap, priv); - - if (adapter->config_bands & BAND_A) - mwifiex_setup_ht_caps( - &wiphy->bands[IEEE80211_BAND_5GHZ]->ht_cap, priv); - - if ((adapter->config_bands & BAND_A) && adapter->is_hw_11ac_capable) - mwifiex_setup_vht_caps( - &wiphy->bands[IEEE80211_BAND_5GHZ]->vht_cap, priv); - - dev_net_set(dev, wiphy_net(wiphy)); - dev->ieee80211_ptr = priv->wdev; - dev->ieee80211_ptr->iftype = priv->bss_mode; - memcpy(dev->dev_addr, wiphy->perm_addr, ETH_ALEN); - SET_NETDEV_DEV(dev, wiphy_dev(wiphy)); - - dev->flags |= IFF_BROADCAST | IFF_MULTICAST; - dev->watchdog_timeo = MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT; - dev->hard_header_len += MWIFIEX_MIN_DATA_HEADER_LEN; - dev->ethtool_ops = &mwifiex_ethtool_ops; - - mdev_priv = netdev_priv(dev); - *((unsigned long *) mdev_priv) = (unsigned long) priv; - - SET_NETDEV_DEV(dev, adapter->dev); - - /* Register network device */ - if (register_netdevice(dev)) { - wiphy_err(wiphy, "cannot register virtual network device\n"); - free_netdev(dev); - priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; - return ERR_PTR(-EFAULT); - } - - sema_init(&priv->async_sem, 1); - - dev_dbg(adapter->dev, "info: %s: Marvell 802.11 Adapter\n", dev->name); - -#ifdef CONFIG_DEBUG_FS - mwifiex_dev_debugfs_init(priv); -#endif - return wdev; -} -EXPORT_SYMBOL_GPL(mwifiex_add_virtual_intf); - -/* - * del_virtual_intf: remove the virtual interface determined by dev - */ -int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); - -#ifdef CONFIG_DEBUG_FS - mwifiex_dev_debugfs_remove(priv); -#endif - - mwifiex_stop_net_dev_queue(priv->netdev, priv->adapter); - - if (netif_carrier_ok(priv->netdev)) - netif_carrier_off(priv->netdev); - - if (wdev->netdev->reg_state == NETREG_REGISTERED) - unregister_netdevice(wdev->netdev); - - /* Clear the priv in adapter */ - priv->netdev = NULL; - - priv->media_connected = false; - - priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; - - return 0; -} -EXPORT_SYMBOL_GPL(mwifiex_del_virtual_intf); - -#ifdef CONFIG_PM -static bool -mwifiex_is_pattern_supported(struct cfg80211_wowlan_trig_pkt_pattern *pat, - s8 *byte_seq) -{ - int j, k, valid_byte_cnt = 0; - bool dont_care_byte = false; - - for (j = 0; j < DIV_ROUND_UP(pat->pattern_len, 8); j++) { - for (k = 0; k < 8; k++) { - if (pat->mask[j] & 1 << k) { - memcpy(byte_seq + valid_byte_cnt, - &pat->pattern[j * 8 + k], 1); - valid_byte_cnt++; - if (dont_care_byte) - return false; - } else { - if (valid_byte_cnt) - dont_care_byte = true; - } - - if (valid_byte_cnt > MAX_BYTESEQ) - return false; - } - } - - byte_seq[MAX_BYTESEQ] = valid_byte_cnt; - - return true; -} - -static int mwifiex_cfg80211_suspend(struct wiphy *wiphy, - struct cfg80211_wowlan *wowlan) -{ - struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - struct mwifiex_ds_mef_cfg mef_cfg; - struct mwifiex_mef_entry *mef_entry; - int i, filt_num = 0, ret; - bool first_pat = true; - u8 byte_seq[MAX_BYTESEQ + 1]; - const u8 ipv4_mc_mac[] = {0x33, 0x33}; - const u8 ipv6_mc_mac[] = {0x01, 0x00, 0x5e}; - struct mwifiex_private *priv = - mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA); - - if (!wowlan) { - dev_warn(adapter->dev, "None of the WOWLAN triggers enabled\n"); - return 0; - } - - if (!priv->media_connected) { - dev_warn(adapter->dev, - "Can not configure WOWLAN in disconnected state\n"); - return 0; - } - - mef_entry = kzalloc(sizeof(*mef_entry), GFP_KERNEL); - if (!mef_entry) - return -ENOMEM; - - memset(&mef_cfg, 0, sizeof(mef_cfg)); - mef_cfg.num_entries = 1; - mef_cfg.mef_entry = mef_entry; - mef_entry->mode = MEF_MODE_HOST_SLEEP; - mef_entry->action = MEF_ACTION_ALLOW_AND_WAKEUP_HOST; - - for (i = 0; i < wowlan->n_patterns; i++) { - memset(byte_seq, 0, sizeof(byte_seq)); - if (!mwifiex_is_pattern_supported(&wowlan->patterns[i], - byte_seq)) { - wiphy_err(wiphy, "Pattern not supported\n"); - kfree(mef_entry); - return -EOPNOTSUPP; - } - - if (!wowlan->patterns[i].pkt_offset) { - if (!(byte_seq[0] & 0x01) && - (byte_seq[MAX_BYTESEQ] == 1)) { - mef_cfg.criteria |= MWIFIEX_CRITERIA_UNICAST; - continue; - } else if (is_broadcast_ether_addr(byte_seq)) { - mef_cfg.criteria |= MWIFIEX_CRITERIA_BROADCAST; - continue; - } else if ((!memcmp(byte_seq, ipv4_mc_mac, 2) && - (byte_seq[MAX_BYTESEQ] == 2)) || - (!memcmp(byte_seq, ipv6_mc_mac, 3) && - (byte_seq[MAX_BYTESEQ] == 3))) { - mef_cfg.criteria |= MWIFIEX_CRITERIA_MULTICAST; - continue; - } - } - - mef_entry->filter[filt_num].repeat = 1; - mef_entry->filter[filt_num].offset = - wowlan->patterns[i].pkt_offset; - memcpy(mef_entry->filter[filt_num].byte_seq, byte_seq, - sizeof(byte_seq)); - mef_entry->filter[filt_num].filt_type = TYPE_EQ; - - if (first_pat) - first_pat = false; - else - mef_entry->filter[filt_num].filt_action = TYPE_AND; - - filt_num++; - } - - if (wowlan->magic_pkt) { - mef_cfg.criteria |= MWIFIEX_CRITERIA_UNICAST; - mef_entry->filter[filt_num].repeat = 16; - memcpy(mef_entry->filter[filt_num].byte_seq, priv->curr_addr, - ETH_ALEN); - mef_entry->filter[filt_num].byte_seq[MAX_BYTESEQ] = ETH_ALEN; - mef_entry->filter[filt_num].offset = 14; - mef_entry->filter[filt_num].filt_type = TYPE_EQ; - if (filt_num) - mef_entry->filter[filt_num].filt_action = TYPE_OR; - } - - if (!mef_cfg.criteria) - mef_cfg.criteria = MWIFIEX_CRITERIA_BROADCAST | - MWIFIEX_CRITERIA_UNICAST | - MWIFIEX_CRITERIA_MULTICAST; - - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_MEF_CFG, - HostCmd_ACT_GEN_SET, 0, - &mef_cfg); - - kfree(mef_entry); - return ret; -} - -static int mwifiex_cfg80211_resume(struct wiphy *wiphy) -{ - return 0; -} - -static void mwifiex_cfg80211_set_wakeup(struct wiphy *wiphy, - bool enabled) -{ - struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - - device_set_wakeup_enable(adapter->dev, enabled); -} -#endif - -/* station cfg80211 operations */ -static struct cfg80211_ops mwifiex_cfg80211_ops = { - .add_virtual_intf = mwifiex_add_virtual_intf, - .del_virtual_intf = mwifiex_del_virtual_intf, - .change_virtual_intf = mwifiex_cfg80211_change_virtual_intf, - .scan = mwifiex_cfg80211_scan, - .connect = mwifiex_cfg80211_connect, - .disconnect = mwifiex_cfg80211_disconnect, - .get_station = mwifiex_cfg80211_get_station, - .dump_station = mwifiex_cfg80211_dump_station, - .set_wiphy_params = mwifiex_cfg80211_set_wiphy_params, - .join_ibss = mwifiex_cfg80211_join_ibss, - .leave_ibss = mwifiex_cfg80211_leave_ibss, - .add_key = mwifiex_cfg80211_add_key, - .del_key = mwifiex_cfg80211_del_key, - .mgmt_tx = mwifiex_cfg80211_mgmt_tx, - .mgmt_frame_register = mwifiex_cfg80211_mgmt_frame_register, - .remain_on_channel = mwifiex_cfg80211_remain_on_channel, - .cancel_remain_on_channel = mwifiex_cfg80211_cancel_remain_on_channel, - .set_default_key = mwifiex_cfg80211_set_default_key, - .set_power_mgmt = mwifiex_cfg80211_set_power_mgmt, - .set_tx_power = mwifiex_cfg80211_set_tx_power, - .set_bitrate_mask = mwifiex_cfg80211_set_bitrate_mask, - .start_ap = mwifiex_cfg80211_start_ap, - .stop_ap = mwifiex_cfg80211_stop_ap, - .change_beacon = mwifiex_cfg80211_change_beacon, - .set_cqm_rssi_config = mwifiex_cfg80211_set_cqm_rssi_config, - .set_antenna = mwifiex_cfg80211_set_antenna, -#ifdef CONFIG_PM - .suspend = mwifiex_cfg80211_suspend, - .resume = mwifiex_cfg80211_resume, - .set_wakeup = mwifiex_cfg80211_set_wakeup, -#endif -}; - -/* - * This function registers the device with CFG802.11 subsystem. - * - * The function creates the wireless device/wiphy, populates it with - * default parameters and handler function pointers, and finally - * registers the device. - */ - -int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) -{ - int ret; - void *wdev_priv; - struct wiphy *wiphy; - struct mwifiex_private *priv = adapter->priv[MWIFIEX_BSS_TYPE_STA]; - u8 *country_code; - - /* create a new wiphy for use with cfg80211 */ - wiphy = wiphy_new(&mwifiex_cfg80211_ops, - sizeof(struct mwifiex_adapter *)); - if (!wiphy) { - dev_err(adapter->dev, "%s: creating new wiphy\n", __func__); - return -ENOMEM; - } - wiphy->max_scan_ssids = MWIFIEX_MAX_SSID_LIST_LENGTH; - wiphy->max_scan_ie_len = MWIFIEX_MAX_VSIE_LEN; - wiphy->mgmt_stypes = mwifiex_mgmt_stypes; - wiphy->max_remain_on_channel_duration = 5000; - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_P2P_GO) | - BIT(NL80211_IFTYPE_AP); - - wiphy->bands[IEEE80211_BAND_2GHZ] = &mwifiex_band_2ghz; - if (adapter->config_bands & BAND_A) - wiphy->bands[IEEE80211_BAND_5GHZ] = &mwifiex_band_5ghz; - else - wiphy->bands[IEEE80211_BAND_5GHZ] = NULL; - - wiphy->iface_combinations = &mwifiex_iface_comb_ap_sta; - wiphy->n_iface_combinations = 1; - - /* Initialize cipher suits */ - wiphy->cipher_suites = mwifiex_cipher_suites; - wiphy->n_cipher_suites = ARRAY_SIZE(mwifiex_cipher_suites); - - memcpy(wiphy->perm_addr, priv->curr_addr, ETH_ALEN); - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME | - WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD | - WIPHY_FLAG_AP_UAPSD | - WIPHY_FLAG_CUSTOM_REGULATORY | - WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; - - wiphy_apply_custom_regulatory(wiphy, &mwifiex_world_regdom_custom); - -#ifdef CONFIG_PM - wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT; - wiphy->wowlan.n_patterns = MWIFIEX_MAX_FILTERS; - wiphy->wowlan.pattern_min_len = 1; - wiphy->wowlan.pattern_max_len = MWIFIEX_MAX_PATTERN_LEN; - wiphy->wowlan.max_pkt_offset = MWIFIEX_MAX_OFFSET_LEN; -#endif - - wiphy->probe_resp_offload = NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS | - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 | - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P; - - wiphy->available_antennas_tx = BIT(adapter->number_of_antenna) - 1; - wiphy->available_antennas_rx = BIT(adapter->number_of_antenna) - 1; - - wiphy->features |= NL80211_FEATURE_HT_IBSS | - NL80211_FEATURE_INACTIVITY_TIMER | - NL80211_FEATURE_LOW_PRIORITY_SCAN; - - /* Reserve space for mwifiex specific private data for BSS */ - wiphy->bss_priv_size = sizeof(struct mwifiex_bss_priv); - - wiphy->reg_notifier = mwifiex_reg_notifier; - - /* Set struct mwifiex_adapter pointer in wiphy_priv */ - wdev_priv = wiphy_priv(wiphy); - *(unsigned long *)wdev_priv = (unsigned long)adapter; - - set_wiphy_dev(wiphy, priv->adapter->dev); - - ret = wiphy_register(wiphy); - if (ret < 0) { - dev_err(adapter->dev, - "%s: wiphy_register failed: %d\n", __func__, ret); - wiphy_free(wiphy); - return ret; - } - country_code = mwifiex_11d_code_2_region(priv->adapter->region_code); - if (country_code) - dev_info(adapter->dev, - "ignoring F/W country code %2.2s\n", country_code); - - adapter->wiphy = wiphy; - return ret; -} diff --git a/drivers/net/wireless/mwifiex/cfg80211.h b/drivers/net/wireless/mwifiex/cfg80211.h deleted file mode 100644 index c5848934f111..000000000000 --- a/drivers/net/wireless/mwifiex/cfg80211.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Marvell Wireless LAN device driver: CFG80211 - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef __MWIFIEX_CFG80211__ -#define __MWIFIEX_CFG80211__ - -#include - -#include "main.h" - -int mwifiex_register_cfg80211(struct mwifiex_adapter *); - -#endif diff --git a/drivers/net/wireless/mwifiex/cfp.c b/drivers/net/wireless/mwifiex/cfp.c deleted file mode 100644 index 5178c4630d89..000000000000 --- a/drivers/net/wireless/mwifiex/cfp.c +++ /dev/null @@ -1,504 +0,0 @@ -/* - * Marvell Wireless LAN device driver: Channel, Frequence and Power - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "cfg80211.h" - -/* 100mW */ -#define MWIFIEX_TX_PWR_DEFAULT 20 -/* 100mW */ -#define MWIFIEX_TX_PWR_US_DEFAULT 20 -/* 50mW */ -#define MWIFIEX_TX_PWR_JP_DEFAULT 16 -/* 100mW */ -#define MWIFIEX_TX_PWR_FR_100MW 20 -/* 10mW */ -#define MWIFIEX_TX_PWR_FR_10MW 10 -/* 100mW */ -#define MWIFIEX_TX_PWR_EMEA_DEFAULT 20 - -static u8 adhoc_rates_b[B_SUPPORTED_RATES] = { 0x82, 0x84, 0x8b, 0x96, 0 }; - -static u8 adhoc_rates_g[G_SUPPORTED_RATES] = { 0x8c, 0x12, 0x98, 0x24, - 0xb0, 0x48, 0x60, 0x6c, 0 }; - -static u8 adhoc_rates_bg[BG_SUPPORTED_RATES] = { 0x82, 0x84, 0x8b, 0x96, - 0x0c, 0x12, 0x18, 0x24, - 0x30, 0x48, 0x60, 0x6c, 0 }; - -static u8 adhoc_rates_a[A_SUPPORTED_RATES] = { 0x8c, 0x12, 0x98, 0x24, - 0xb0, 0x48, 0x60, 0x6c, 0 }; -static u8 supported_rates_a[A_SUPPORTED_RATES] = { 0x0c, 0x12, 0x18, 0x24, - 0xb0, 0x48, 0x60, 0x6c, 0 }; -static u16 mwifiex_data_rates[MWIFIEX_SUPPORTED_RATES_EXT] = { 0x02, 0x04, - 0x0B, 0x16, 0x00, 0x0C, 0x12, 0x18, - 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90, - 0x0D, 0x1A, 0x27, 0x34, 0x4E, 0x68, - 0x75, 0x82, 0x0C, 0x1B, 0x36, 0x51, - 0x6C, 0xA2, 0xD8, 0xF3, 0x10E, 0x00 }; - -static u8 supported_rates_b[B_SUPPORTED_RATES] = { 0x02, 0x04, 0x0b, 0x16, 0 }; - -static u8 supported_rates_g[G_SUPPORTED_RATES] = { 0x0c, 0x12, 0x18, 0x24, - 0x30, 0x48, 0x60, 0x6c, 0 }; - -static u8 supported_rates_bg[BG_SUPPORTED_RATES] = { 0x02, 0x04, 0x0b, 0x0c, - 0x12, 0x16, 0x18, 0x24, 0x30, 0x48, - 0x60, 0x6c, 0 }; - -u16 region_code_index[MWIFIEX_MAX_REGION_CODE] = { 0x10, 0x20, 0x30, - 0x32, 0x40, 0x41, 0xff }; - -static u8 supported_rates_n[N_SUPPORTED_RATES] = { 0x02, 0x04, 0 }; - -struct region_code_mapping { - u8 code; - u8 region[IEEE80211_COUNTRY_STRING_LEN]; -}; - -static struct region_code_mapping region_code_mapping_t[] = { - { 0x10, "US " }, /* US FCC */ - { 0x20, "CA " }, /* IC Canada */ - { 0x30, "EU " }, /* ETSI */ - { 0x31, "ES " }, /* Spain */ - { 0x32, "FR " }, /* France */ - { 0x40, "JP " }, /* Japan */ - { 0x41, "JP " }, /* Japan */ - { 0x50, "CN " }, /* China */ -}; - -/* This function converts integer code to region string */ -u8 *mwifiex_11d_code_2_region(u8 code) -{ - u8 i; - u8 size = sizeof(region_code_mapping_t)/ - sizeof(struct region_code_mapping); - - /* Look for code in mapping table */ - for (i = 0; i < size; i++) - if (region_code_mapping_t[i].code == code) - return region_code_mapping_t[i].region; - - return NULL; -} - -/* - * This function maps an index in supported rates table into - * the corresponding data rate. - */ -u32 mwifiex_index_to_acs_data_rate(struct mwifiex_private *priv, - u8 index, u8 ht_info) -{ - /* - * For every mcs_rate line, the first 8 bytes are for stream 1x1, - * and all 16 bytes are for stream 2x2. - */ - u16 mcs_rate[4][16] = { - /* LGI 40M */ - { 0x1b, 0x36, 0x51, 0x6c, 0xa2, 0xd8, 0xf3, 0x10e, - 0x36, 0x6c, 0xa2, 0xd8, 0x144, 0x1b0, 0x1e6, 0x21c }, - - /* SGI 40M */ - { 0x1e, 0x3c, 0x5a, 0x78, 0xb4, 0xf0, 0x10e, 0x12c, - 0x3c, 0x78, 0xb4, 0xf0, 0x168, 0x1e0, 0x21c, 0x258 }, - - /* LGI 20M */ - { 0x0d, 0x1a, 0x27, 0x34, 0x4e, 0x68, 0x75, 0x82, - 0x1a, 0x34, 0x4e, 0x68, 0x9c, 0xd0, 0xea, 0x104 }, - - /* SGI 20M */ - { 0x0e, 0x1c, 0x2b, 0x39, 0x56, 0x73, 0x82, 0x90, - 0x1c, 0x39, 0x56, 0x73, 0xad, 0xe7, 0x104, 0x120 } - }; - /* AC rates */ - u16 ac_mcs_rate_nss1[8][10] = { - /* LG 160M */ - { 0x75, 0xEA, 0x15F, 0x1D4, 0x2BE, 0x3A8, 0x41D, - 0x492, 0x57C, 0x618 }, - - /* SG 160M */ - { 0x82, 0x104, 0x186, 0x208, 0x30C, 0x410, 0x492, - 0x514, 0x618, 0x6C6 }, - - /* LG 80M */ - { 0x3B, 0x75, 0xB0, 0xEA, 0x15F, 0x1D4, 0x20F, - 0x249, 0x2BE, 0x30C }, - - /* SG 80M */ - { 0x41, 0x82, 0xC3, 0x104, 0x186, 0x208, 0x249, - 0x28A, 0x30C, 0x363 }, - - /* LG 40M */ - { 0x1B, 0x36, 0x51, 0x6C, 0xA2, 0xD8, 0xF3, - 0x10E, 0x144, 0x168 }, - - /* SG 40M */ - { 0x1E, 0x3C, 0x5A, 0x78, 0xB4, 0xF0, 0x10E, - 0x12C, 0x168, 0x190 }, - - /* LG 20M */ - { 0xD, 0x1A, 0x27, 0x34, 0x4E, 0x68, 0x75, 0x82, 0x9C, 0x00 }, - - /* SG 20M */ - { 0xF, 0x1D, 0x2C, 0x3A, 0x57, 0x74, 0x82, 0x91, 0xAE, 0x00 }, - }; - /* NSS2 note: the value in the table is 2 multiplier of the actual - * rate - */ - u16 ac_mcs_rate_nss2[8][10] = { - /* LG 160M */ - { 0xEA, 0x1D4, 0x2BE, 0x3A8, 0x57C, 0x750, 0x83A, - 0x924, 0xAF8, 0xC30 }, - - /* SG 160M */ - { 0x104, 0x208, 0x30C, 0x410, 0x618, 0x820, 0x924, - 0xA28, 0xC30, 0xD8B }, - - /* LG 80M */ - { 0x75, 0xEA, 0x15F, 0x1D4, 0x2BE, 0x3A8, 0x41D, - 0x492, 0x57C, 0x618 }, - - /* SG 80M */ - { 0x82, 0x104, 0x186, 0x208, 0x30C, 0x410, 0x492, - 0x514, 0x618, 0x6C6 }, - - /* LG 40M */ - { 0x36, 0x6C, 0xA2, 0xD8, 0x144, 0x1B0, 0x1E6, - 0x21C, 0x288, 0x2D0 }, - - /* SG 40M */ - { 0x3C, 0x78, 0xB4, 0xF0, 0x168, 0x1E0, 0x21C, - 0x258, 0x2D0, 0x320 }, - - /* LG 20M */ - { 0x1A, 0x34, 0x4A, 0x68, 0x9C, 0xD0, 0xEA, 0x104, - 0x138, 0x00 }, - - /* SG 20M */ - { 0x1D, 0x3A, 0x57, 0x74, 0xAE, 0xE6, 0x104, 0x121, - 0x15B, 0x00 }, - }; - u32 rate = 0; - u8 mcs_index = 0; - u8 bw = 0; - u8 gi = 0; - - if ((ht_info & 0x3) == MWIFIEX_RATE_FORMAT_VHT) { - mcs_index = min(index & 0xF, 9); - - /* 20M: bw=0, 40M: bw=1, 80M: bw=2, 160M: bw=3 */ - bw = (ht_info & 0xC) >> 2; - - /* LGI: gi =0, SGI: gi = 1 */ - gi = (ht_info & 0x10) >> 4; - - if ((index >> 4) == 1) /* NSS = 2 */ - rate = ac_mcs_rate_nss2[2 * (3 - bw) + gi][mcs_index]; - else /* NSS = 1 */ - rate = ac_mcs_rate_nss1[2 * (3 - bw) + gi][mcs_index]; - } else if ((ht_info & 0x3) == MWIFIEX_RATE_FORMAT_HT) { - /* 20M: bw=0, 40M: bw=1 */ - bw = (ht_info & 0xC) >> 2; - - /* LGI: gi =0, SGI: gi = 1 */ - gi = (ht_info & 0x10) >> 4; - - if (index == MWIFIEX_RATE_BITMAP_MCS0) { - if (gi == 1) - rate = 0x0D; /* MCS 32 SGI rate */ - else - rate = 0x0C; /* MCS 32 LGI rate */ - } else if (index < 16) { - if ((bw == 1) || (bw == 0)) - rate = mcs_rate[2 * (1 - bw) + gi][index]; - else - rate = mwifiex_data_rates[0]; - } else { - rate = mwifiex_data_rates[0]; - } - } else { - /* 11n non-HT rates */ - if (index >= MWIFIEX_SUPPORTED_RATES_EXT) - index = 0; - rate = mwifiex_data_rates[index]; - } - - return rate; -} - -/* This function maps an index in supported rates table into - * the corresponding data rate. - */ -u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv, - u8 index, u8 ht_info) -{ - /* For every mcs_rate line, the first 8 bytes are for stream 1x1, - * and all 16 bytes are for stream 2x2. - */ - u16 mcs_rate[4][16] = { - /* LGI 40M */ - { 0x1b, 0x36, 0x51, 0x6c, 0xa2, 0xd8, 0xf3, 0x10e, - 0x36, 0x6c, 0xa2, 0xd8, 0x144, 0x1b0, 0x1e6, 0x21c }, - - /* SGI 40M */ - { 0x1e, 0x3c, 0x5a, 0x78, 0xb4, 0xf0, 0x10e, 0x12c, - 0x3c, 0x78, 0xb4, 0xf0, 0x168, 0x1e0, 0x21c, 0x258 }, - - /* LGI 20M */ - { 0x0d, 0x1a, 0x27, 0x34, 0x4e, 0x68, 0x75, 0x82, - 0x1a, 0x34, 0x4e, 0x68, 0x9c, 0xd0, 0xea, 0x104 }, - - /* SGI 20M */ - { 0x0e, 0x1c, 0x2b, 0x39, 0x56, 0x73, 0x82, 0x90, - 0x1c, 0x39, 0x56, 0x73, 0xad, 0xe7, 0x104, 0x120 } - }; - u32 mcs_num_supp = - (priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2) ? 16 : 8; - u32 rate; - - if (priv->adapter->is_hw_11ac_capable) - return mwifiex_index_to_acs_data_rate(priv, index, ht_info); - - if (ht_info & BIT(0)) { - if (index == MWIFIEX_RATE_BITMAP_MCS0) { - if (ht_info & BIT(2)) - rate = 0x0D; /* MCS 32 SGI rate */ - else - rate = 0x0C; /* MCS 32 LGI rate */ - } else if (index < mcs_num_supp) { - if (ht_info & BIT(1)) { - if (ht_info & BIT(2)) - /* SGI, 40M */ - rate = mcs_rate[1][index]; - else - /* LGI, 40M */ - rate = mcs_rate[0][index]; - } else { - if (ht_info & BIT(2)) - /* SGI, 20M */ - rate = mcs_rate[3][index]; - else - /* LGI, 20M */ - rate = mcs_rate[2][index]; - } - } else - rate = mwifiex_data_rates[0]; - } else { - if (index >= MWIFIEX_SUPPORTED_RATES_EXT) - index = 0; - rate = mwifiex_data_rates[index]; - } - return rate; -} - -/* - * This function returns the current active data rates. - * - * The result may vary depending upon connection status. - */ -u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv, u8 *rates) -{ - if (!priv->media_connected) - return mwifiex_get_supported_rates(priv, rates); - else - return mwifiex_copy_rates(rates, 0, - priv->curr_bss_params.data_rates, - priv->curr_bss_params.num_of_rates); -} - -/* - * This function locates the Channel-Frequency-Power triplet based upon - * band and channel/frequency parameters. - */ -struct mwifiex_chan_freq_power * -mwifiex_get_cfp(struct mwifiex_private *priv, u8 band, u16 channel, u32 freq) -{ - struct mwifiex_chan_freq_power *cfp = NULL; - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch = NULL; - int i; - - if (!channel && !freq) - return cfp; - - if (mwifiex_band_to_radio_type(band) == HostCmd_SCAN_RADIO_TYPE_BG) - sband = priv->wdev->wiphy->bands[IEEE80211_BAND_2GHZ]; - else - sband = priv->wdev->wiphy->bands[IEEE80211_BAND_5GHZ]; - - if (!sband) { - dev_err(priv->adapter->dev, "%s: cannot find cfp by band %d\n", - __func__, band); - return cfp; - } - - for (i = 0; i < sband->n_channels; i++) { - ch = &sband->channels[i]; - - if (ch->flags & IEEE80211_CHAN_DISABLED) - continue; - - if (freq) { - if (ch->center_freq == freq) - break; - } else { - /* find by valid channel*/ - if (ch->hw_value == channel || - channel == FIRST_VALID_CHANNEL) - break; - } - } - if (i == sband->n_channels) { - dev_err(priv->adapter->dev, "%s: cannot find cfp by band %d" - " & channel=%d freq=%d\n", __func__, band, channel, - freq); - } else { - if (!ch) - return cfp; - - priv->cfp.channel = ch->hw_value; - priv->cfp.freq = ch->center_freq; - priv->cfp.max_tx_power = ch->max_power; - cfp = &priv->cfp; - } - - return cfp; -} - -/* - * This function checks if the data rate is set to auto. - */ -u8 -mwifiex_is_rate_auto(struct mwifiex_private *priv) -{ - u32 i; - int rate_num = 0; - - for (i = 0; i < ARRAY_SIZE(priv->bitmap_rates); i++) - if (priv->bitmap_rates[i]) - rate_num++; - - if (rate_num > 1) - return true; - else - return false; -} - -/* - * This function gets the supported data rates. - * - * The function works in both Ad-Hoc and infra mode by printing the - * band and returning the data rates. - */ -u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates) -{ - u32 k = 0; - struct mwifiex_adapter *adapter = priv->adapter; - - if (priv->bss_mode == NL80211_IFTYPE_STATION || - priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) { - switch (adapter->config_bands) { - case BAND_B: - dev_dbg(adapter->dev, "info: infra band=%d " - "supported_rates_b\n", adapter->config_bands); - k = mwifiex_copy_rates(rates, k, supported_rates_b, - sizeof(supported_rates_b)); - break; - case BAND_G: - case BAND_G | BAND_GN: - case BAND_G | BAND_GN | BAND_GAC: - dev_dbg(adapter->dev, "info: infra band=%d " - "supported_rates_g\n", adapter->config_bands); - k = mwifiex_copy_rates(rates, k, supported_rates_g, - sizeof(supported_rates_g)); - break; - case BAND_B | BAND_G: - case BAND_A | BAND_B | BAND_G: - case BAND_A | BAND_B: - case BAND_A | BAND_B | BAND_G | BAND_GN | BAND_AN: - case BAND_A | BAND_B | BAND_G | BAND_GN | BAND_AN | BAND_AAC: - case BAND_A | BAND_B | BAND_G | BAND_GN | BAND_AN | - BAND_AAC | BAND_GAC: - case BAND_B | BAND_G | BAND_GN: - case BAND_B | BAND_G | BAND_GN | BAND_GAC: - dev_dbg(adapter->dev, "info: infra band=%d " - "supported_rates_bg\n", adapter->config_bands); - k = mwifiex_copy_rates(rates, k, supported_rates_bg, - sizeof(supported_rates_bg)); - break; - case BAND_A: - case BAND_A | BAND_G: - dev_dbg(adapter->dev, "info: infra band=%d " - "supported_rates_a\n", adapter->config_bands); - k = mwifiex_copy_rates(rates, k, supported_rates_a, - sizeof(supported_rates_a)); - break; - case BAND_AN: - case BAND_A | BAND_AN: - case BAND_A | BAND_AN | BAND_AAC: - case BAND_A | BAND_G | BAND_AN | BAND_GN: - case BAND_A | BAND_G | BAND_AN | BAND_GN | BAND_AAC: - dev_dbg(adapter->dev, "info: infra band=%d " - "supported_rates_a\n", adapter->config_bands); - k = mwifiex_copy_rates(rates, k, supported_rates_a, - sizeof(supported_rates_a)); - break; - case BAND_GN: - case BAND_GN | BAND_GAC: - dev_dbg(adapter->dev, "info: infra band=%d " - "supported_rates_n\n", adapter->config_bands); - k = mwifiex_copy_rates(rates, k, supported_rates_n, - sizeof(supported_rates_n)); - break; - } - } else { - /* Ad-hoc mode */ - switch (adapter->adhoc_start_band) { - case BAND_B: - dev_dbg(adapter->dev, "info: adhoc B\n"); - k = mwifiex_copy_rates(rates, k, adhoc_rates_b, - sizeof(adhoc_rates_b)); - break; - case BAND_G: - case BAND_G | BAND_GN: - dev_dbg(adapter->dev, "info: adhoc G only\n"); - k = mwifiex_copy_rates(rates, k, adhoc_rates_g, - sizeof(adhoc_rates_g)); - break; - case BAND_B | BAND_G: - case BAND_B | BAND_G | BAND_GN: - dev_dbg(adapter->dev, "info: adhoc BG\n"); - k = mwifiex_copy_rates(rates, k, adhoc_rates_bg, - sizeof(adhoc_rates_bg)); - break; - case BAND_A: - case BAND_A | BAND_AN: - dev_dbg(adapter->dev, "info: adhoc A\n"); - k = mwifiex_copy_rates(rates, k, adhoc_rates_a, - sizeof(adhoc_rates_a)); - break; - } - } - - return k; -} diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c deleted file mode 100644 index 7a97f6cba089..000000000000 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ /dev/null @@ -1,1546 +0,0 @@ -/* - * Marvell Wireless LAN device driver: commands and events - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" -#include "11n.h" -#include "11ac.h" - -/* - * This function initializes a command node. - * - * The actual allocation of the node is not done by this function. It only - * initiates a node by filling it with default parameters. Similarly, - * allocation of the different buffers used (IOCTL buffer, data buffer) are - * not done by this function either. - */ -static void -mwifiex_init_cmd_node(struct mwifiex_private *priv, - struct cmd_ctrl_node *cmd_node, - u32 cmd_oid, void *data_buf) -{ - cmd_node->priv = priv; - cmd_node->cmd_oid = cmd_oid; - if (priv->adapter->cmd_wait_q_required) { - cmd_node->wait_q_enabled = priv->adapter->cmd_wait_q_required; - priv->adapter->cmd_wait_q_required = false; - cmd_node->cmd_wait_q_woken = false; - cmd_node->condition = &cmd_node->cmd_wait_q_woken; - } - cmd_node->data_buf = data_buf; - cmd_node->cmd_skb = cmd_node->skb; -} - -/* - * This function returns a command node from the free queue depending upon - * availability. - */ -static struct cmd_ctrl_node * -mwifiex_get_cmd_node(struct mwifiex_adapter *adapter) -{ - struct cmd_ctrl_node *cmd_node; - unsigned long flags; - - spin_lock_irqsave(&adapter->cmd_free_q_lock, flags); - if (list_empty(&adapter->cmd_free_q)) { - dev_err(adapter->dev, "GET_CMD_NODE: cmd node not available\n"); - spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags); - return NULL; - } - cmd_node = list_first_entry(&adapter->cmd_free_q, - struct cmd_ctrl_node, list); - list_del(&cmd_node->list); - spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags); - - return cmd_node; -} - -/* - * This function cleans up a command node. - * - * The function resets the fields including the buffer pointers. - * This function does not try to free the buffers. They must be - * freed before calling this function. - * - * This function will however call the receive completion callback - * in case a response buffer is still available before resetting - * the pointer. - */ -static void -mwifiex_clean_cmd_node(struct mwifiex_adapter *adapter, - struct cmd_ctrl_node *cmd_node) -{ - cmd_node->cmd_oid = 0; - cmd_node->cmd_flag = 0; - cmd_node->data_buf = NULL; - cmd_node->wait_q_enabled = false; - - if (cmd_node->cmd_skb) - skb_trim(cmd_node->cmd_skb, 0); - - if (cmd_node->resp_skb) { - adapter->if_ops.cmdrsp_complete(adapter, cmd_node->resp_skb); - cmd_node->resp_skb = NULL; - } -} - -/* - * This function sends a host command to the firmware. - * - * The function copies the host command into the driver command - * buffer, which will be transferred to the firmware later by the - * main thread. - */ -static int mwifiex_cmd_host_cmd(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - struct mwifiex_ds_misc_cmd *pcmd_ptr) -{ - /* Copy the HOST command to command buffer */ - memcpy(cmd, pcmd_ptr->cmd, pcmd_ptr->len); - dev_dbg(priv->adapter->dev, "cmd: host cmd size = %d\n", pcmd_ptr->len); - return 0; -} - -/* - * This function downloads a command to the firmware. - * - * The function performs sanity tests, sets the command sequence - * number and size, converts the header fields to CPU format before - * sending. Afterwards, it logs the command ID and action for debugging - * and sets up the command timeout timer. - */ -static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv, - struct cmd_ctrl_node *cmd_node) -{ - - struct mwifiex_adapter *adapter = priv->adapter; - int ret; - struct host_cmd_ds_command *host_cmd; - uint16_t cmd_code; - uint16_t cmd_size; - struct timeval tstamp; - unsigned long flags; - __le32 tmp; - - if (!adapter || !cmd_node) - return -1; - - host_cmd = (struct host_cmd_ds_command *) (cmd_node->cmd_skb->data); - - /* Sanity test */ - if (host_cmd == NULL || host_cmd->size == 0) { - dev_err(adapter->dev, "DNLD_CMD: host_cmd is null" - " or cmd size is 0, not sending\n"); - if (cmd_node->wait_q_enabled) - adapter->cmd_wait_q.status = -1; - mwifiex_recycle_cmd_node(adapter, cmd_node); - return -1; - } - - cmd_code = le16_to_cpu(host_cmd->command); - cmd_size = le16_to_cpu(host_cmd->size); - - if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET && - cmd_code != HostCmd_CMD_FUNC_SHUTDOWN && - cmd_code != HostCmd_CMD_FUNC_INIT) { - dev_err(adapter->dev, - "DNLD_CMD: FW in reset state, ignore cmd %#x\n", - cmd_code); - mwifiex_complete_cmd(adapter, cmd_node); - mwifiex_recycle_cmd_node(adapter, cmd_node); - return -1; - } - - /* Set command sequence number */ - adapter->seq_num++; - host_cmd->seq_num = cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO - (adapter->seq_num, - cmd_node->priv->bss_num, - cmd_node->priv->bss_type)); - - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); - adapter->curr_cmd = cmd_node; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); - - /* Adjust skb length */ - if (cmd_node->cmd_skb->len > cmd_size) - /* - * cmd_size is less than sizeof(struct host_cmd_ds_command). - * Trim off the unused portion. - */ - skb_trim(cmd_node->cmd_skb, cmd_size); - else if (cmd_node->cmd_skb->len < cmd_size) - /* - * cmd_size is larger than sizeof(struct host_cmd_ds_command) - * because we have appended custom IE TLV. Increase skb length - * accordingly. - */ - skb_put(cmd_node->cmd_skb, cmd_size - cmd_node->cmd_skb->len); - - do_gettimeofday(&tstamp); - dev_dbg(adapter->dev, "cmd: DNLD_CMD: (%lu.%lu): %#x, act %#x, len %d," - " seqno %#x\n", - tstamp.tv_sec, tstamp.tv_usec, cmd_code, - le16_to_cpu(*(__le16 *) ((u8 *) host_cmd + S_DS_GEN)), cmd_size, - le16_to_cpu(host_cmd->seq_num)); - - if (adapter->iface_type == MWIFIEX_USB) { - tmp = cpu_to_le32(MWIFIEX_USB_TYPE_CMD); - skb_push(cmd_node->cmd_skb, MWIFIEX_TYPE_LEN); - memcpy(cmd_node->cmd_skb->data, &tmp, MWIFIEX_TYPE_LEN); - adapter->cmd_sent = true; - ret = adapter->if_ops.host_to_card(adapter, - MWIFIEX_USB_EP_CMD_EVENT, - cmd_node->cmd_skb, NULL); - skb_pull(cmd_node->cmd_skb, MWIFIEX_TYPE_LEN); - if (ret == -EBUSY) - cmd_node->cmd_skb = NULL; - } else { - skb_push(cmd_node->cmd_skb, INTF_HEADER_LEN); - ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, - cmd_node->cmd_skb, NULL); - skb_pull(cmd_node->cmd_skb, INTF_HEADER_LEN); - } - - if (ret == -1) { - dev_err(adapter->dev, "DNLD_CMD: host to card failed\n"); - if (adapter->iface_type == MWIFIEX_USB) - adapter->cmd_sent = false; - if (cmd_node->wait_q_enabled) - adapter->cmd_wait_q.status = -1; - mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); - - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); - adapter->curr_cmd = NULL; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); - - adapter->dbg.num_cmd_host_to_card_failure++; - return -1; - } - - /* Save the last command id and action to debug log */ - adapter->dbg.last_cmd_index = - (adapter->dbg.last_cmd_index + 1) % DBG_CMD_NUM; - adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index] = cmd_code; - adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index] = - le16_to_cpu(*(__le16 *) ((u8 *) host_cmd + S_DS_GEN)); - - /* Clear BSS_NO_BITS from HostCmd */ - cmd_code &= HostCmd_CMD_ID_MASK; - - /* Setup the timer after transmit command */ - mod_timer(&adapter->cmd_timer, - jiffies + msecs_to_jiffies(MWIFIEX_TIMER_10S)); - - return 0; -} - -/* - * This function downloads a sleep confirm command to the firmware. - * - * The function performs sanity tests, sets the command sequence - * number and size, converts the header fields to CPU format before - * sending. - * - * No responses are needed for sleep confirm command. - */ -static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) -{ - int ret; - struct mwifiex_private *priv; - struct mwifiex_opt_sleep_confirm *sleep_cfm_buf = - (struct mwifiex_opt_sleep_confirm *) - adapter->sleep_cfm->data; - struct sk_buff *sleep_cfm_tmp; - __le32 tmp; - - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - - sleep_cfm_buf->seq_num = - cpu_to_le16((HostCmd_SET_SEQ_NO_BSS_INFO - (adapter->seq_num, priv->bss_num, - priv->bss_type))); - adapter->seq_num++; - - if (adapter->iface_type == MWIFIEX_USB) { - sleep_cfm_tmp = - dev_alloc_skb(sizeof(struct mwifiex_opt_sleep_confirm) - + MWIFIEX_TYPE_LEN); - skb_put(sleep_cfm_tmp, sizeof(struct mwifiex_opt_sleep_confirm) - + MWIFIEX_TYPE_LEN); - tmp = cpu_to_le32(MWIFIEX_USB_TYPE_CMD); - memcpy(sleep_cfm_tmp->data, &tmp, MWIFIEX_TYPE_LEN); - memcpy(sleep_cfm_tmp->data + MWIFIEX_TYPE_LEN, - adapter->sleep_cfm->data, - sizeof(struct mwifiex_opt_sleep_confirm)); - ret = adapter->if_ops.host_to_card(adapter, - MWIFIEX_USB_EP_CMD_EVENT, - sleep_cfm_tmp, NULL); - if (ret != -EBUSY) - dev_kfree_skb_any(sleep_cfm_tmp); - } else { - skb_push(adapter->sleep_cfm, INTF_HEADER_LEN); - ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_CMD, - adapter->sleep_cfm, NULL); - skb_pull(adapter->sleep_cfm, INTF_HEADER_LEN); - } - - if (ret == -1) { - dev_err(adapter->dev, "SLEEP_CFM: failed\n"); - adapter->dbg.num_cmd_sleep_cfm_host_to_card_failure++; - return -1; - } - if (GET_BSS_ROLE(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY)) - == MWIFIEX_BSS_ROLE_STA) { - if (!sleep_cfm_buf->resp_ctrl) - /* Response is not needed for sleep - confirm command */ - adapter->ps_state = PS_STATE_SLEEP; - else - adapter->ps_state = PS_STATE_SLEEP_CFM; - - if (!sleep_cfm_buf->resp_ctrl && - (adapter->is_hs_configured && - !adapter->sleep_period.period)) { - adapter->pm_wakeup_card_req = true; - mwifiex_hs_activated_event(mwifiex_get_priv - (adapter, MWIFIEX_BSS_ROLE_STA), true); - } - } - - return ret; -} - -/* - * This function allocates the command buffers and links them to - * the command free queue. - * - * The driver uses a pre allocated number of command buffers, which - * are created at driver initializations and freed at driver cleanup. - * Every command needs to obtain a command buffer from this pool before - * it can be issued. The command free queue lists the command buffers - * currently free to use, while the command pending queue lists the - * command buffers already in use and awaiting handling. Command buffers - * are returned to the free queue after use. - */ -int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter) -{ - struct cmd_ctrl_node *cmd_array; - u32 i; - - /* Allocate and initialize struct cmd_ctrl_node */ - cmd_array = kcalloc(MWIFIEX_NUM_OF_CMD_BUFFER, - sizeof(struct cmd_ctrl_node), GFP_KERNEL); - if (!cmd_array) - return -ENOMEM; - - adapter->cmd_pool = cmd_array; - - /* Allocate and initialize command buffers */ - for (i = 0; i < MWIFIEX_NUM_OF_CMD_BUFFER; i++) { - cmd_array[i].skb = dev_alloc_skb(MWIFIEX_SIZE_OF_CMD_BUFFER); - if (!cmd_array[i].skb) { - dev_err(adapter->dev, "ALLOC_CMD_BUF: out of memory\n"); - return -1; - } - } - - for (i = 0; i < MWIFIEX_NUM_OF_CMD_BUFFER; i++) - mwifiex_insert_cmd_to_free_q(adapter, &cmd_array[i]); - - return 0; -} - -/* - * This function frees the command buffers. - * - * The function calls the completion callback for all the command - * buffers that still have response buffers associated with them. - */ -int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter) -{ - struct cmd_ctrl_node *cmd_array; - u32 i; - - /* Need to check if cmd pool is allocated or not */ - if (!adapter->cmd_pool) { - dev_dbg(adapter->dev, "info: FREE_CMD_BUF: cmd_pool is null\n"); - return 0; - } - - cmd_array = adapter->cmd_pool; - - /* Release shared memory buffers */ - for (i = 0; i < MWIFIEX_NUM_OF_CMD_BUFFER; i++) { - if (cmd_array[i].skb) { - dev_dbg(adapter->dev, "cmd: free cmd buffer %d\n", i); - dev_kfree_skb_any(cmd_array[i].skb); - } - if (!cmd_array[i].resp_skb) - continue; - - if (adapter->iface_type == MWIFIEX_USB) - adapter->if_ops.cmdrsp_complete(adapter, - cmd_array[i].resp_skb); - else - dev_kfree_skb_any(cmd_array[i].resp_skb); - } - /* Release struct cmd_ctrl_node */ - if (adapter->cmd_pool) { - dev_dbg(adapter->dev, "cmd: free cmd pool\n"); - kfree(adapter->cmd_pool); - adapter->cmd_pool = NULL; - } - - return 0; -} - -/* - * This function handles events generated by firmware. - * - * Event body of events received from firmware are not used (though they are - * saved), only the event ID is used. Some events are re-invoked by - * the driver, with a new event body. - * - * After processing, the function calls the completion callback - * for cleanup. - */ -int mwifiex_process_event(struct mwifiex_adapter *adapter) -{ - int ret; - struct mwifiex_private *priv = - mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - struct sk_buff *skb = adapter->event_skb; - u32 eventcause = adapter->event_cause; - struct timeval tstamp; - struct mwifiex_rxinfo *rx_info; - - /* Save the last event to debug log */ - adapter->dbg.last_event_index = - (adapter->dbg.last_event_index + 1) % DBG_CMD_NUM; - adapter->dbg.last_event[adapter->dbg.last_event_index] = - (u16) eventcause; - - /* Get BSS number and corresponding priv */ - priv = mwifiex_get_priv_by_id(adapter, EVENT_GET_BSS_NUM(eventcause), - EVENT_GET_BSS_TYPE(eventcause)); - if (!priv) - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - /* Clear BSS_NO_BITS from event */ - eventcause &= EVENT_ID_MASK; - adapter->event_cause = eventcause; - - if (skb) { - rx_info = MWIFIEX_SKB_RXCB(skb); - rx_info->bss_num = priv->bss_num; - rx_info->bss_type = priv->bss_type; - } - - if (eventcause != EVENT_PS_SLEEP && eventcause != EVENT_PS_AWAKE) { - do_gettimeofday(&tstamp); - dev_dbg(adapter->dev, "event: %lu.%lu: cause: %#x\n", - tstamp.tv_sec, tstamp.tv_usec, eventcause); - } else { - /* Handle PS_SLEEP/AWAKE events on STA */ - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA); - if (!priv) - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - } - - if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP) - ret = mwifiex_process_uap_event(priv); - else - ret = mwifiex_process_sta_event(priv); - - adapter->event_cause = 0; - adapter->event_skb = NULL; - adapter->if_ops.event_complete(adapter, skb); - - return ret; -} - -/* - * This function is used to send synchronous command to the firmware. - * - * it allocates a wait queue for the command and wait for the command - * response. - */ -int mwifiex_send_cmd_sync(struct mwifiex_private *priv, uint16_t cmd_no, - u16 cmd_action, u32 cmd_oid, void *data_buf) -{ - int ret = 0; - struct mwifiex_adapter *adapter = priv->adapter; - - adapter->cmd_wait_q_required = true; - - ret = mwifiex_send_cmd_async(priv, cmd_no, cmd_action, cmd_oid, - data_buf); - - return ret; -} - - -/* - * This function prepares a command and asynchronously send it to the firmware. - * - * Preparation includes - - * - Sanity tests to make sure the card is still present or the FW - * is not reset - * - Getting a new command node from the command free queue - * - Initializing the command node for default parameters - * - Fill up the non-default parameters and buffer pointers - * - Add the command to pending queue - */ -int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no, - u16 cmd_action, u32 cmd_oid, void *data_buf) -{ - int ret; - struct mwifiex_adapter *adapter = priv->adapter; - struct cmd_ctrl_node *cmd_node; - struct host_cmd_ds_command *cmd_ptr; - - if (!adapter) { - pr_err("PREP_CMD: adapter is NULL\n"); - return -1; - } - - if (adapter->is_suspended) { - dev_err(adapter->dev, "PREP_CMD: device in suspended state\n"); - return -1; - } - - if (adapter->surprise_removed) { - dev_err(adapter->dev, "PREP_CMD: card is removed\n"); - return -1; - } - - if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET) { - if (cmd_no != HostCmd_CMD_FUNC_INIT) { - dev_err(adapter->dev, "PREP_CMD: FW in reset state\n"); - return -1; - } - } - - /* Get a new command node */ - cmd_node = mwifiex_get_cmd_node(adapter); - - if (!cmd_node) { - dev_err(adapter->dev, "PREP_CMD: no free cmd node\n"); - return -1; - } - - /* Initialize the command node */ - mwifiex_init_cmd_node(priv, cmd_node, cmd_oid, data_buf); - - if (!cmd_node->cmd_skb) { - dev_err(adapter->dev, "PREP_CMD: no free cmd buf\n"); - return -1; - } - - memset(skb_put(cmd_node->cmd_skb, sizeof(struct host_cmd_ds_command)), - 0, sizeof(struct host_cmd_ds_command)); - - cmd_ptr = (struct host_cmd_ds_command *) (cmd_node->cmd_skb->data); - cmd_ptr->command = cpu_to_le16(cmd_no); - cmd_ptr->result = 0; - - /* Prepare command */ - if (cmd_no) { - switch (cmd_no) { - case HostCmd_CMD_UAP_SYS_CONFIG: - case HostCmd_CMD_UAP_BSS_START: - case HostCmd_CMD_UAP_BSS_STOP: - ret = mwifiex_uap_prepare_cmd(priv, cmd_no, cmd_action, - cmd_oid, data_buf, - cmd_ptr); - break; - default: - ret = mwifiex_sta_prepare_cmd(priv, cmd_no, cmd_action, - cmd_oid, data_buf, - cmd_ptr); - break; - } - } else { - ret = mwifiex_cmd_host_cmd(priv, cmd_ptr, data_buf); - cmd_node->cmd_flag |= CMD_F_HOSTCMD; - } - - /* Return error, since the command preparation failed */ - if (ret) { - dev_err(adapter->dev, "PREP_CMD: cmd %#x preparation failed\n", - cmd_no); - mwifiex_insert_cmd_to_free_q(adapter, cmd_node); - return -1; - } - - /* Send command */ - if (cmd_no == HostCmd_CMD_802_11_SCAN) { - mwifiex_queue_scan_cmd(priv, cmd_node); - } else { - mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, true); - queue_work(adapter->workqueue, &adapter->main_work); - if (cmd_node->wait_q_enabled) - ret = mwifiex_wait_queue_complete(adapter, cmd_node); - } - - return ret; -} - -/* - * This function returns a command to the command free queue. - * - * The function also calls the completion callback if required, before - * cleaning the command node and re-inserting it into the free queue. - */ -void -mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter, - struct cmd_ctrl_node *cmd_node) -{ - unsigned long flags; - - if (!cmd_node) - return; - - if (cmd_node->wait_q_enabled) - mwifiex_complete_cmd(adapter, cmd_node); - /* Clean the node */ - mwifiex_clean_cmd_node(adapter, cmd_node); - - /* Insert node into cmd_free_q */ - spin_lock_irqsave(&adapter->cmd_free_q_lock, flags); - list_add_tail(&cmd_node->list, &adapter->cmd_free_q); - spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags); -} - -/* This function reuses a command node. */ -void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter, - struct cmd_ctrl_node *cmd_node) -{ - struct host_cmd_ds_command *host_cmd = (void *)cmd_node->cmd_skb->data; - - mwifiex_insert_cmd_to_free_q(adapter, cmd_node); - - atomic_dec(&adapter->cmd_pending); - dev_dbg(adapter->dev, "cmd: FREE_CMD: cmd=%#x, cmd_pending=%d\n", - le16_to_cpu(host_cmd->command), - atomic_read(&adapter->cmd_pending)); -} - -/* - * This function queues a command to the command pending queue. - * - * This in effect adds the command to the command list to be executed. - * Exit PS command is handled specially, by placing it always to the - * front of the command queue. - */ -void -mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter, - struct cmd_ctrl_node *cmd_node, u32 add_tail) -{ - struct host_cmd_ds_command *host_cmd = NULL; - u16 command; - unsigned long flags; - - host_cmd = (struct host_cmd_ds_command *) (cmd_node->cmd_skb->data); - if (!host_cmd) { - dev_err(adapter->dev, "QUEUE_CMD: host_cmd is NULL\n"); - return; - } - - command = le16_to_cpu(host_cmd->command); - - /* Exit_PS command needs to be queued in the header always. */ - if (command == HostCmd_CMD_802_11_PS_MODE_ENH) { - struct host_cmd_ds_802_11_ps_mode_enh *pm = - &host_cmd->params.psmode_enh; - if ((le16_to_cpu(pm->action) == DIS_PS) || - (le16_to_cpu(pm->action) == DIS_AUTO_PS)) { - if (adapter->ps_state != PS_STATE_AWAKE) - add_tail = false; - } - } - - spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags); - if (add_tail) - list_add_tail(&cmd_node->list, &adapter->cmd_pending_q); - else - list_add(&cmd_node->list, &adapter->cmd_pending_q); - spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); - - atomic_inc(&adapter->cmd_pending); - dev_dbg(adapter->dev, "cmd: QUEUE_CMD: cmd=%#x, cmd_pending=%d\n", - command, atomic_read(&adapter->cmd_pending)); -} - -/* - * This function executes the next command in command pending queue. - * - * This function will fail if a command is already in processing stage, - * otherwise it will dequeue the first command from the command pending - * queue and send to the firmware. - * - * If the device is currently in host sleep mode, any commands, except the - * host sleep configuration command will de-activate the host sleep. For PS - * mode, the function will put the firmware back to sleep if applicable. - */ -int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter) -{ - struct mwifiex_private *priv; - struct cmd_ctrl_node *cmd_node; - int ret = 0; - struct host_cmd_ds_command *host_cmd; - unsigned long cmd_flags; - unsigned long cmd_pending_q_flags; - - /* Check if already in processing */ - if (adapter->curr_cmd) { - dev_err(adapter->dev, "EXEC_NEXT_CMD: cmd in processing\n"); - return -1; - } - - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); - /* Check if any command is pending */ - spin_lock_irqsave(&adapter->cmd_pending_q_lock, cmd_pending_q_flags); - if (list_empty(&adapter->cmd_pending_q)) { - spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, - cmd_pending_q_flags); - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); - return 0; - } - cmd_node = list_first_entry(&adapter->cmd_pending_q, - struct cmd_ctrl_node, list); - spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, - cmd_pending_q_flags); - - host_cmd = (struct host_cmd_ds_command *) (cmd_node->cmd_skb->data); - priv = cmd_node->priv; - - if (adapter->ps_state != PS_STATE_AWAKE) { - dev_err(adapter->dev, "%s: cannot send cmd in sleep state," - " this should not happen\n", __func__); - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); - return ret; - } - - spin_lock_irqsave(&adapter->cmd_pending_q_lock, cmd_pending_q_flags); - list_del(&cmd_node->list); - spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, - cmd_pending_q_flags); - - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); - ret = mwifiex_dnld_cmd_to_fw(priv, cmd_node); - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - /* Any command sent to the firmware when host is in sleep - * mode should de-configure host sleep. We should skip the - * host sleep configuration command itself though - */ - if (priv && (host_cmd->command != - cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH))) { - if (adapter->hs_activated) { - adapter->is_hs_configured = false; - mwifiex_hs_activated_event(priv, false); - } - } - - return ret; -} - -/* - * This function handles the command response. - * - * After processing, the function cleans the command node and puts - * it back to the command free queue. - */ -int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter) -{ - struct host_cmd_ds_command *resp; - struct mwifiex_private *priv = - mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - int ret = 0; - uint16_t orig_cmdresp_no; - uint16_t cmdresp_no; - uint16_t cmdresp_result; - struct timeval tstamp; - unsigned long flags; - - /* Now we got response from FW, cancel the command timer */ - del_timer(&adapter->cmd_timer); - - if (!adapter->curr_cmd || !adapter->curr_cmd->resp_skb) { - resp = (struct host_cmd_ds_command *) adapter->upld_buf; - dev_err(adapter->dev, "CMD_RESP: NULL curr_cmd, %#x\n", - le16_to_cpu(resp->command)); - return -1; - } - - adapter->num_cmd_timeout = 0; - - resp = (struct host_cmd_ds_command *) adapter->curr_cmd->resp_skb->data; - if (adapter->curr_cmd->cmd_flag & CMD_F_CANCELED) { - dev_err(adapter->dev, "CMD_RESP: %#x been canceled\n", - le16_to_cpu(resp->command)); - mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); - adapter->curr_cmd = NULL; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); - return -1; - } - - if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { - /* Copy original response back to response buffer */ - struct mwifiex_ds_misc_cmd *hostcmd; - uint16_t size = le16_to_cpu(resp->size); - dev_dbg(adapter->dev, "info: host cmd resp size = %d\n", size); - size = min_t(u16, size, MWIFIEX_SIZE_OF_CMD_BUFFER); - if (adapter->curr_cmd->data_buf) { - hostcmd = adapter->curr_cmd->data_buf; - hostcmd->len = size; - memcpy(hostcmd->cmd, resp, size); - } - } - orig_cmdresp_no = le16_to_cpu(resp->command); - - /* Get BSS number and corresponding priv */ - priv = mwifiex_get_priv_by_id(adapter, - HostCmd_GET_BSS_NO(le16_to_cpu(resp->seq_num)), - HostCmd_GET_BSS_TYPE(le16_to_cpu(resp->seq_num))); - if (!priv) - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - /* Clear RET_BIT from HostCmd */ - resp->command = cpu_to_le16(orig_cmdresp_no & HostCmd_CMD_ID_MASK); - - cmdresp_no = le16_to_cpu(resp->command); - cmdresp_result = le16_to_cpu(resp->result); - - /* Save the last command response to debug log */ - adapter->dbg.last_cmd_resp_index = - (adapter->dbg.last_cmd_resp_index + 1) % DBG_CMD_NUM; - adapter->dbg.last_cmd_resp_id[adapter->dbg.last_cmd_resp_index] = - orig_cmdresp_no; - - do_gettimeofday(&tstamp); - dev_dbg(adapter->dev, "cmd: CMD_RESP: (%lu.%lu): 0x%x, result %d," - " len %d, seqno 0x%x\n", - tstamp.tv_sec, tstamp.tv_usec, orig_cmdresp_no, cmdresp_result, - le16_to_cpu(resp->size), le16_to_cpu(resp->seq_num)); - - if (!(orig_cmdresp_no & HostCmd_RET_BIT)) { - dev_err(adapter->dev, "CMD_RESP: invalid cmd resp\n"); - if (adapter->curr_cmd->wait_q_enabled) - adapter->cmd_wait_q.status = -1; - - mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); - adapter->curr_cmd = NULL; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); - return -1; - } - - if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { - adapter->curr_cmd->cmd_flag &= ~CMD_F_HOSTCMD; - if ((cmdresp_result == HostCmd_RESULT_OK) && - (cmdresp_no == HostCmd_CMD_802_11_HS_CFG_ENH)) - ret = mwifiex_ret_802_11_hs_cfg(priv, resp); - } else { - /* handle response */ - ret = mwifiex_process_sta_cmdresp(priv, cmdresp_no, resp); - } - - /* Check init command response */ - if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) { - if (ret) { - dev_err(adapter->dev, "%s: cmd %#x failed during " - "initialization\n", __func__, cmdresp_no); - mwifiex_init_fw_complete(adapter); - return -1; - } else if (adapter->last_init_cmd == cmdresp_no) - adapter->hw_status = MWIFIEX_HW_STATUS_INIT_DONE; - } - - if (adapter->curr_cmd) { - if (adapter->curr_cmd->wait_q_enabled) - adapter->cmd_wait_q.status = ret; - - mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); - - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); - adapter->curr_cmd = NULL; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); - } - - return ret; -} - -/* - * This function handles the timeout of command sending. - * - * It will re-send the same command again. - */ -void -mwifiex_cmd_timeout_func(unsigned long function_context) -{ - struct mwifiex_adapter *adapter = - (struct mwifiex_adapter *) function_context; - struct cmd_ctrl_node *cmd_node; - struct timeval tstamp; - - adapter->num_cmd_timeout++; - adapter->dbg.num_cmd_timeout++; - if (!adapter->curr_cmd) { - dev_dbg(adapter->dev, "cmd: empty curr_cmd\n"); - return; - } - cmd_node = adapter->curr_cmd; - if (cmd_node) { - adapter->dbg.timeout_cmd_id = - adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index]; - adapter->dbg.timeout_cmd_act = - adapter->dbg.last_cmd_act[adapter->dbg.last_cmd_index]; - do_gettimeofday(&tstamp); - dev_err(adapter->dev, - "%s: Timeout cmd id (%lu.%lu) = %#x, act = %#x\n", - __func__, tstamp.tv_sec, tstamp.tv_usec, - adapter->dbg.timeout_cmd_id, - adapter->dbg.timeout_cmd_act); - - dev_err(adapter->dev, "num_data_h2c_failure = %d\n", - adapter->dbg.num_tx_host_to_card_failure); - dev_err(adapter->dev, "num_cmd_h2c_failure = %d\n", - adapter->dbg.num_cmd_host_to_card_failure); - - dev_err(adapter->dev, "num_cmd_timeout = %d\n", - adapter->dbg.num_cmd_timeout); - dev_err(adapter->dev, "num_tx_timeout = %d\n", - adapter->dbg.num_tx_timeout); - - dev_err(adapter->dev, "last_cmd_index = %d\n", - adapter->dbg.last_cmd_index); - dev_err(adapter->dev, "last_cmd_id: %*ph\n", - (int)sizeof(adapter->dbg.last_cmd_id), - adapter->dbg.last_cmd_id); - dev_err(adapter->dev, "last_cmd_act: %*ph\n", - (int)sizeof(adapter->dbg.last_cmd_act), - adapter->dbg.last_cmd_act); - - dev_err(adapter->dev, "last_cmd_resp_index = %d\n", - adapter->dbg.last_cmd_resp_index); - dev_err(adapter->dev, "last_cmd_resp_id: %*ph\n", - (int)sizeof(adapter->dbg.last_cmd_resp_id), - adapter->dbg.last_cmd_resp_id); - - dev_err(adapter->dev, "last_event_index = %d\n", - adapter->dbg.last_event_index); - dev_err(adapter->dev, "last_event: %*ph\n", - (int)sizeof(adapter->dbg.last_event), - adapter->dbg.last_event); - - dev_err(adapter->dev, "data_sent=%d cmd_sent=%d\n", - adapter->data_sent, adapter->cmd_sent); - - dev_err(adapter->dev, "ps_mode=%d ps_state=%d\n", - adapter->ps_mode, adapter->ps_state); - - if (cmd_node->wait_q_enabled) { - adapter->cmd_wait_q.status = -ETIMEDOUT; - wake_up_interruptible(&adapter->cmd_wait_q.wait); - mwifiex_cancel_pending_ioctl(adapter); - /* reset cmd_sent flag to unblock new commands */ - adapter->cmd_sent = false; - } - } - if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) - mwifiex_init_fw_complete(adapter); - - if (adapter->if_ops.card_reset) - adapter->if_ops.card_reset(adapter); -} - -/* - * This function cancels all the pending commands. - * - * The current command, all commands in command pending queue and all scan - * commands in scan pending queue are cancelled. All the completion callbacks - * are called with failure status to ensure cleanup. - */ -void -mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter) -{ - struct cmd_ctrl_node *cmd_node = NULL, *tmp_node; - unsigned long flags; - - /* Cancel current cmd */ - if ((adapter->curr_cmd) && (adapter->curr_cmd->wait_q_enabled)) { - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); - adapter->curr_cmd->wait_q_enabled = false; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); - adapter->cmd_wait_q.status = -1; - mwifiex_complete_cmd(adapter, adapter->curr_cmd); - } - /* Cancel all pending command */ - spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags); - list_for_each_entry_safe(cmd_node, tmp_node, - &adapter->cmd_pending_q, list) { - list_del(&cmd_node->list); - spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); - - if (cmd_node->wait_q_enabled) { - adapter->cmd_wait_q.status = -1; - mwifiex_complete_cmd(adapter, cmd_node); - cmd_node->wait_q_enabled = false; - } - mwifiex_recycle_cmd_node(adapter, cmd_node); - spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags); - } - spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); - - /* Cancel all pending scan command */ - spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); - list_for_each_entry_safe(cmd_node, tmp_node, - &adapter->scan_pending_q, list) { - list_del(&cmd_node->list); - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); - - cmd_node->wait_q_enabled = false; - mwifiex_insert_cmd_to_free_q(adapter, cmd_node); - spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); - } - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); - - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); - adapter->scan_processing = false; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); -} - -/* - * This function cancels all pending commands that matches with - * the given IOCTL request. - * - * Both the current command buffer and the pending command queue are - * searched for matching IOCTL request. The completion callback of - * the matched command is called with failure status to ensure cleanup. - * In case of scan commands, all pending commands in scan pending queue - * are cancelled. - */ -void -mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) -{ - struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL; - unsigned long cmd_flags; - unsigned long scan_pending_q_flags; - uint16_t cancel_scan_cmd = false; - - if ((adapter->curr_cmd) && - (adapter->curr_cmd->wait_q_enabled)) { - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); - cmd_node = adapter->curr_cmd; - cmd_node->wait_q_enabled = false; - cmd_node->cmd_flag |= CMD_F_CANCELED; - mwifiex_recycle_cmd_node(adapter, cmd_node); - mwifiex_complete_cmd(adapter, adapter->curr_cmd); - adapter->curr_cmd = NULL; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); - } - - /* Cancel all pending scan command */ - spin_lock_irqsave(&adapter->scan_pending_q_lock, - scan_pending_q_flags); - list_for_each_entry_safe(cmd_node, tmp_node, - &adapter->scan_pending_q, list) { - list_del(&cmd_node->list); - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, - scan_pending_q_flags); - cmd_node->wait_q_enabled = false; - mwifiex_insert_cmd_to_free_q(adapter, cmd_node); - spin_lock_irqsave(&adapter->scan_pending_q_lock, - scan_pending_q_flags); - cancel_scan_cmd = true; - } - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, - scan_pending_q_flags); - - if (cancel_scan_cmd) { - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags); - adapter->scan_processing = false; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); - } - adapter->cmd_wait_q.status = -1; -} - -/* - * This function sends the sleep confirm command to firmware, if - * possible. - * - * The sleep confirm command cannot be issued if command response, - * data response or event response is awaiting handling, or if we - * are in the middle of sending a command, or expecting a command - * response. - */ -void -mwifiex_check_ps_cond(struct mwifiex_adapter *adapter) -{ - if (!adapter->cmd_sent && - !adapter->curr_cmd && !IS_CARD_RX_RCVD(adapter)) - mwifiex_dnld_sleep_confirm_cmd(adapter); - else - dev_dbg(adapter->dev, - "cmd: Delay Sleep Confirm (%s%s%s)\n", - (adapter->cmd_sent) ? "D" : "", - (adapter->curr_cmd) ? "C" : "", - (IS_CARD_RX_RCVD(adapter)) ? "R" : ""); -} - -/* - * This function sends a Host Sleep activated event to applications. - * - * This event is generated by the driver, with a blank event body. - */ -void -mwifiex_hs_activated_event(struct mwifiex_private *priv, u8 activated) -{ - if (activated) { - if (priv->adapter->is_hs_configured) { - priv->adapter->hs_activated = true; - mwifiex_update_rxreor_flags(priv->adapter, - RXREOR_FORCE_NO_DROP); - dev_dbg(priv->adapter->dev, "event: hs_activated\n"); - priv->adapter->hs_activate_wait_q_woken = true; - wake_up_interruptible( - &priv->adapter->hs_activate_wait_q); - } else { - dev_dbg(priv->adapter->dev, "event: HS not configured\n"); - } - } else { - dev_dbg(priv->adapter->dev, "event: hs_deactivated\n"); - priv->adapter->hs_activated = false; - } -} - -/* - * This function handles the command response of a Host Sleep configuration - * command. - * - * Handling includes changing the header fields into CPU format - * and setting the current host sleep activation status in driver. - * - * In case host sleep status change, the function generates an event to - * notify the applications. - */ -int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct host_cmd_ds_802_11_hs_cfg_enh *phs_cfg = - &resp->params.opt_hs_cfg; - uint32_t conditions = le32_to_cpu(phs_cfg->params.hs_config.conditions); - - if (phs_cfg->action == cpu_to_le16(HS_ACTIVATE) && - adapter->iface_type != MWIFIEX_USB) { - mwifiex_hs_activated_event(priv, true); - return 0; - } else { - dev_dbg(adapter->dev, "cmd: CMD_RESP: HS_CFG cmd reply" - " result=%#x, conditions=0x%x gpio=0x%x gap=0x%x\n", - resp->result, conditions, - phs_cfg->params.hs_config.gpio, - phs_cfg->params.hs_config.gap); - } - if (conditions != HS_CFG_CANCEL) { - adapter->is_hs_configured = true; - if (adapter->iface_type == MWIFIEX_USB) - mwifiex_hs_activated_event(priv, true); - } else { - adapter->is_hs_configured = false; - if (adapter->hs_activated) - mwifiex_hs_activated_event(priv, false); - } - - return 0; -} - -/* - * This function wakes up the adapter and generates a Host Sleep - * cancel event on receiving the power up interrupt. - */ -void -mwifiex_process_hs_config(struct mwifiex_adapter *adapter) -{ - dev_dbg(adapter->dev, "info: %s: auto cancelling host sleep" - " since there is interrupt from the firmware\n", __func__); - - adapter->if_ops.wakeup(adapter); - adapter->hs_activated = false; - adapter->is_hs_configured = false; - adapter->is_suspended = false; - mwifiex_hs_activated_event(mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_ANY), - false); -} -EXPORT_SYMBOL_GPL(mwifiex_process_hs_config); - -/* - * This function handles the command response of a sleep confirm command. - * - * The function sets the card state to SLEEP if the response indicates success. - */ -void -mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *adapter, - u8 *pbuf, u32 upld_len) -{ - struct host_cmd_ds_command *cmd = (struct host_cmd_ds_command *) pbuf; - struct mwifiex_private *priv = - mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - uint16_t result = le16_to_cpu(cmd->result); - uint16_t command = le16_to_cpu(cmd->command); - uint16_t seq_num = le16_to_cpu(cmd->seq_num); - - if (!upld_len) { - dev_err(adapter->dev, "%s: cmd size is 0\n", __func__); - return; - } - - /* Get BSS number and corresponding priv */ - priv = mwifiex_get_priv_by_id(adapter, HostCmd_GET_BSS_NO(seq_num), - HostCmd_GET_BSS_TYPE(seq_num)); - if (!priv) - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - - /* Update sequence number */ - seq_num = HostCmd_GET_SEQ_NO(seq_num); - /* Clear RET_BIT from HostCmd */ - command &= HostCmd_CMD_ID_MASK; - - if (command != HostCmd_CMD_802_11_PS_MODE_ENH) { - dev_err(adapter->dev, - "%s: rcvd unexpected resp for cmd %#x, result = %x\n", - __func__, command, result); - return; - } - - if (result) { - dev_err(adapter->dev, "%s: sleep confirm cmd failed\n", - __func__); - adapter->pm_wakeup_card_req = false; - adapter->ps_state = PS_STATE_AWAKE; - return; - } - adapter->pm_wakeup_card_req = true; - if (adapter->is_hs_configured) - mwifiex_hs_activated_event(mwifiex_get_priv - (adapter, MWIFIEX_BSS_ROLE_ANY), - true); - adapter->ps_state = PS_STATE_SLEEP; - cmd->command = cpu_to_le16(command); - cmd->seq_num = cpu_to_le16(seq_num); -} -EXPORT_SYMBOL_GPL(mwifiex_process_sleep_confirm_resp); - -/* - * This function prepares an enhanced power mode command. - * - * This function can be used to disable power save or to configure - * power save with auto PS or STA PS or auto deep sleep. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting Power Save bitmap, PS parameters TLV, PS mode TLV, - * auto deep sleep TLV (as required) - * - Ensuring correct endian-ness - */ -int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - u16 cmd_action, uint16_t ps_bitmap, - struct mwifiex_ds_auto_ds *auto_ds) -{ - struct host_cmd_ds_802_11_ps_mode_enh *psmode_enh = - &cmd->params.psmode_enh; - u8 *tlv; - u16 cmd_size = 0; - - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_PS_MODE_ENH); - if (cmd_action == DIS_AUTO_PS) { - psmode_enh->action = cpu_to_le16(DIS_AUTO_PS); - psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap); - cmd->size = cpu_to_le16(S_DS_GEN + sizeof(psmode_enh->action) + - sizeof(psmode_enh->params.ps_bitmap)); - } else if (cmd_action == GET_PS) { - psmode_enh->action = cpu_to_le16(GET_PS); - psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap); - cmd->size = cpu_to_le16(S_DS_GEN + sizeof(psmode_enh->action) + - sizeof(psmode_enh->params.ps_bitmap)); - } else if (cmd_action == EN_AUTO_PS) { - psmode_enh->action = cpu_to_le16(EN_AUTO_PS); - psmode_enh->params.ps_bitmap = cpu_to_le16(ps_bitmap); - cmd_size = S_DS_GEN + sizeof(psmode_enh->action) + - sizeof(psmode_enh->params.ps_bitmap); - tlv = (u8 *) cmd + cmd_size; - if (ps_bitmap & BITMAP_STA_PS) { - struct mwifiex_adapter *adapter = priv->adapter; - struct mwifiex_ie_types_ps_param *ps_tlv = - (struct mwifiex_ie_types_ps_param *) tlv; - struct mwifiex_ps_param *ps_mode = &ps_tlv->param; - ps_tlv->header.type = cpu_to_le16(TLV_TYPE_PS_PARAM); - ps_tlv->header.len = cpu_to_le16(sizeof(*ps_tlv) - - sizeof(struct mwifiex_ie_types_header)); - cmd_size += sizeof(*ps_tlv); - tlv += sizeof(*ps_tlv); - dev_dbg(adapter->dev, "cmd: PS Command: Enter PS\n"); - ps_mode->null_pkt_interval = - cpu_to_le16(adapter->null_pkt_interval); - ps_mode->multiple_dtims = - cpu_to_le16(adapter->multiple_dtim); - ps_mode->bcn_miss_timeout = - cpu_to_le16(adapter->bcn_miss_time_out); - ps_mode->local_listen_interval = - cpu_to_le16(adapter->local_listen_interval); - ps_mode->adhoc_wake_period = - cpu_to_le16(adapter->adhoc_awake_period); - ps_mode->delay_to_ps = - cpu_to_le16(adapter->delay_to_ps); - ps_mode->mode = cpu_to_le16(adapter->enhanced_ps_mode); - - } - if (ps_bitmap & BITMAP_AUTO_DS) { - struct mwifiex_ie_types_auto_ds_param *auto_ds_tlv = - (struct mwifiex_ie_types_auto_ds_param *) tlv; - u16 idletime = 0; - - auto_ds_tlv->header.type = - cpu_to_le16(TLV_TYPE_AUTO_DS_PARAM); - auto_ds_tlv->header.len = - cpu_to_le16(sizeof(*auto_ds_tlv) - - sizeof(struct mwifiex_ie_types_header)); - cmd_size += sizeof(*auto_ds_tlv); - tlv += sizeof(*auto_ds_tlv); - if (auto_ds) - idletime = auto_ds->idle_time; - dev_dbg(priv->adapter->dev, - "cmd: PS Command: Enter Auto Deep Sleep\n"); - auto_ds_tlv->deep_sleep_timeout = cpu_to_le16(idletime); - } - cmd->size = cpu_to_le16(cmd_size); - } - return 0; -} - -/* - * This function handles the command response of an enhanced power mode - * command. - * - * Handling includes changing the header fields into CPU format - * and setting the current enhanced power mode in driver. - */ -int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp, - struct mwifiex_ds_pm_cfg *pm_cfg) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct host_cmd_ds_802_11_ps_mode_enh *ps_mode = - &resp->params.psmode_enh; - uint16_t action = le16_to_cpu(ps_mode->action); - uint16_t ps_bitmap = le16_to_cpu(ps_mode->params.ps_bitmap); - uint16_t auto_ps_bitmap = - le16_to_cpu(ps_mode->params.ps_bitmap); - - dev_dbg(adapter->dev, - "info: %s: PS_MODE cmd reply result=%#x action=%#X\n", - __func__, resp->result, action); - if (action == EN_AUTO_PS) { - if (auto_ps_bitmap & BITMAP_AUTO_DS) { - dev_dbg(adapter->dev, "cmd: Enabled auto deep sleep\n"); - priv->adapter->is_deep_sleep = true; - } - if (auto_ps_bitmap & BITMAP_STA_PS) { - dev_dbg(adapter->dev, "cmd: Enabled STA power save\n"); - if (adapter->sleep_period.period) - dev_dbg(adapter->dev, - "cmd: set to uapsd/pps mode\n"); - } - } else if (action == DIS_AUTO_PS) { - if (ps_bitmap & BITMAP_AUTO_DS) { - priv->adapter->is_deep_sleep = false; - dev_dbg(adapter->dev, "cmd: Disabled auto deep sleep\n"); - } - if (ps_bitmap & BITMAP_STA_PS) { - dev_dbg(adapter->dev, "cmd: Disabled STA power save\n"); - if (adapter->sleep_period.period) { - adapter->delay_null_pkt = false; - adapter->tx_lock_flag = false; - adapter->pps_uapsd_mode = false; - } - } - } else if (action == GET_PS) { - if (ps_bitmap & BITMAP_STA_PS) - adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP; - else - adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; - - dev_dbg(adapter->dev, "cmd: ps_bitmap=%#x\n", ps_bitmap); - - if (pm_cfg) { - /* This section is for get power save mode */ - if (ps_bitmap & BITMAP_STA_PS) - pm_cfg->param.ps_mode = 1; - else - pm_cfg->param.ps_mode = 0; - } - } - return 0; -} - -/* - * This function prepares command to get hardware specifications. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting permanent address parameter - * - Ensuring correct endian-ness - */ -int mwifiex_cmd_get_hw_spec(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd) -{ - struct host_cmd_ds_get_hw_spec *hw_spec = &cmd->params.hw_spec; - - cmd->command = cpu_to_le16(HostCmd_CMD_GET_HW_SPEC); - cmd->size = - cpu_to_le16(sizeof(struct host_cmd_ds_get_hw_spec) + S_DS_GEN); - memcpy(hw_spec->permanent_addr, priv->curr_addr, ETH_ALEN); - - return 0; -} - -/* - * This function handles the command response of get hardware - * specifications. - * - * Handling includes changing the header fields into CPU format - * and saving/updating the following parameters in driver - - * - Firmware capability information - * - Firmware band settings - * - Ad-hoc start band and channel - * - Ad-hoc 11n activation status - * - Firmware release number - * - Number of antennas - * - Hardware address - * - Hardware interface version - * - Firmware version - * - Region code - * - 11n capabilities - * - MCS support fields - * - MP end port - */ -int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct host_cmd_ds_get_hw_spec *hw_spec = &resp->params.hw_spec; - struct mwifiex_adapter *adapter = priv->adapter; - int i; - - adapter->fw_cap_info = le32_to_cpu(hw_spec->fw_cap_info); - - if (IS_SUPPORT_MULTI_BANDS(adapter)) - adapter->fw_bands = (u8) GET_FW_DEFAULT_BANDS(adapter); - else - adapter->fw_bands = BAND_B; - - adapter->config_bands = adapter->fw_bands; - - if (adapter->fw_bands & BAND_A) { - if (adapter->fw_bands & BAND_GN) { - adapter->config_bands |= BAND_AN; - adapter->fw_bands |= BAND_AN; - } - if (adapter->fw_bands & BAND_AN) { - adapter->adhoc_start_band = BAND_A | BAND_AN; - adapter->adhoc_11n_enabled = true; - } else { - adapter->adhoc_start_band = BAND_A; - } - priv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL_A; - } else if (adapter->fw_bands & BAND_GN) { - adapter->adhoc_start_band = BAND_G | BAND_B | BAND_GN; - priv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL; - adapter->adhoc_11n_enabled = true; - } else if (adapter->fw_bands & BAND_G) { - adapter->adhoc_start_band = BAND_G | BAND_B; - priv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL; - } else if (adapter->fw_bands & BAND_B) { - adapter->adhoc_start_band = BAND_B; - priv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL; - } - - adapter->fw_release_number = le32_to_cpu(hw_spec->fw_release_number); - adapter->number_of_antenna = le16_to_cpu(hw_spec->number_of_antenna); - - if (le32_to_cpu(hw_spec->dot_11ac_dev_cap)) { - adapter->is_hw_11ac_capable = true; - - /* Copy 11AC cap */ - adapter->hw_dot_11ac_dev_cap = - le32_to_cpu(hw_spec->dot_11ac_dev_cap); - adapter->usr_dot_11ac_dev_cap_bg = adapter->hw_dot_11ac_dev_cap; - adapter->usr_dot_11ac_dev_cap_a = adapter->hw_dot_11ac_dev_cap; - - /* Copy 11AC mcs */ - adapter->hw_dot_11ac_mcs_support = - le32_to_cpu(hw_spec->dot_11ac_mcs_support); - adapter->usr_dot_11ac_mcs_support = - adapter->hw_dot_11ac_mcs_support; - } else { - adapter->is_hw_11ac_capable = false; - } - - dev_dbg(adapter->dev, "info: GET_HW_SPEC: fw_release_number- %#x\n", - adapter->fw_release_number); - dev_dbg(adapter->dev, "info: GET_HW_SPEC: permanent addr: %pM\n", - hw_spec->permanent_addr); - dev_dbg(adapter->dev, - "info: GET_HW_SPEC: hw_if_version=%#x version=%#x\n", - le16_to_cpu(hw_spec->hw_if_version), - le16_to_cpu(hw_spec->version)); - - if (priv->curr_addr[0] == 0xff) - memmove(priv->curr_addr, hw_spec->permanent_addr, ETH_ALEN); - - adapter->region_code = le16_to_cpu(hw_spec->region_code); - - for (i = 0; i < MWIFIEX_MAX_REGION_CODE; i++) - /* Use the region code to search for the index */ - if (adapter->region_code == region_code_index[i]) - break; - - /* If it's unidentified region code, use the default (USA) */ - if (i >= MWIFIEX_MAX_REGION_CODE) { - adapter->region_code = 0x10; - dev_dbg(adapter->dev, - "cmd: unknown region code, use default (USA)\n"); - } - - adapter->hw_dot_11n_dev_cap = le32_to_cpu(hw_spec->dot_11n_dev_cap); - adapter->hw_dev_mcs_support = hw_spec->dev_mcs_support; - - if (adapter->if_ops.update_mp_end_port) - adapter->if_ops.update_mp_end_port(adapter, - le16_to_cpu(hw_spec->mp_end_port)); - - return 0; -} diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c deleted file mode 100644 index a5f9875cfd6e..000000000000 --- a/drivers/net/wireless/mwifiex/debugfs.c +++ /dev/null @@ -1,757 +0,0 @@ -/* - * Marvell Wireless LAN device driver: debugfs - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include - -#include "main.h" -#include "11n.h" - - -static struct dentry *mwifiex_dfs_dir; - -static char *bss_modes[] = { - "UNSPECIFIED", - "ADHOC", - "STATION", - "AP", - "AP_VLAN", - "WDS", - "MONITOR", - "MESH_POINT", - "P2P_CLIENT", - "P2P_GO", - "P2P_DEVICE", -}; - -/* size/addr for mwifiex_debug_info */ -#define item_size(n) (FIELD_SIZEOF(struct mwifiex_debug_info, n)) -#define item_addr(n) (offsetof(struct mwifiex_debug_info, n)) - -/* size/addr for struct mwifiex_adapter */ -#define adapter_item_size(n) (FIELD_SIZEOF(struct mwifiex_adapter, n)) -#define adapter_item_addr(n) (offsetof(struct mwifiex_adapter, n)) - -struct mwifiex_debug_data { - char name[32]; /* variable/array name */ - u32 size; /* size of the variable/array */ - size_t addr; /* address of the variable/array */ - int num; /* number of variables in an array */ -}; - -static struct mwifiex_debug_data items[] = { - {"int_counter", item_size(int_counter), - item_addr(int_counter), 1}, - {"wmm_ac_vo", item_size(packets_out[WMM_AC_VO]), - item_addr(packets_out[WMM_AC_VO]), 1}, - {"wmm_ac_vi", item_size(packets_out[WMM_AC_VI]), - item_addr(packets_out[WMM_AC_VI]), 1}, - {"wmm_ac_be", item_size(packets_out[WMM_AC_BE]), - item_addr(packets_out[WMM_AC_BE]), 1}, - {"wmm_ac_bk", item_size(packets_out[WMM_AC_BK]), - item_addr(packets_out[WMM_AC_BK]), 1}, - {"tx_buf_size", item_size(tx_buf_size), - item_addr(tx_buf_size), 1}, - {"curr_tx_buf_size", item_size(curr_tx_buf_size), - item_addr(curr_tx_buf_size), 1}, - {"ps_mode", item_size(ps_mode), - item_addr(ps_mode), 1}, - {"ps_state", item_size(ps_state), - item_addr(ps_state), 1}, - {"is_deep_sleep", item_size(is_deep_sleep), - item_addr(is_deep_sleep), 1}, - {"wakeup_dev_req", item_size(pm_wakeup_card_req), - item_addr(pm_wakeup_card_req), 1}, - {"wakeup_tries", item_size(pm_wakeup_fw_try), - item_addr(pm_wakeup_fw_try), 1}, - {"hs_configured", item_size(is_hs_configured), - item_addr(is_hs_configured), 1}, - {"hs_activated", item_size(hs_activated), - item_addr(hs_activated), 1}, - {"num_tx_timeout", item_size(num_tx_timeout), - item_addr(num_tx_timeout), 1}, - {"num_cmd_timeout", item_size(num_cmd_timeout), - item_addr(num_cmd_timeout), 1}, - {"timeout_cmd_id", item_size(timeout_cmd_id), - item_addr(timeout_cmd_id), 1}, - {"timeout_cmd_act", item_size(timeout_cmd_act), - item_addr(timeout_cmd_act), 1}, - {"last_cmd_id", item_size(last_cmd_id), - item_addr(last_cmd_id), DBG_CMD_NUM}, - {"last_cmd_act", item_size(last_cmd_act), - item_addr(last_cmd_act), DBG_CMD_NUM}, - {"last_cmd_index", item_size(last_cmd_index), - item_addr(last_cmd_index), 1}, - {"last_cmd_resp_id", item_size(last_cmd_resp_id), - item_addr(last_cmd_resp_id), DBG_CMD_NUM}, - {"last_cmd_resp_index", item_size(last_cmd_resp_index), - item_addr(last_cmd_resp_index), 1}, - {"last_event", item_size(last_event), - item_addr(last_event), DBG_CMD_NUM}, - {"last_event_index", item_size(last_event_index), - item_addr(last_event_index), 1}, - {"num_cmd_h2c_fail", item_size(num_cmd_host_to_card_failure), - item_addr(num_cmd_host_to_card_failure), 1}, - {"num_cmd_sleep_cfm_fail", - item_size(num_cmd_sleep_cfm_host_to_card_failure), - item_addr(num_cmd_sleep_cfm_host_to_card_failure), 1}, - {"num_tx_h2c_fail", item_size(num_tx_host_to_card_failure), - item_addr(num_tx_host_to_card_failure), 1}, - {"num_evt_deauth", item_size(num_event_deauth), - item_addr(num_event_deauth), 1}, - {"num_evt_disassoc", item_size(num_event_disassoc), - item_addr(num_event_disassoc), 1}, - {"num_evt_link_lost", item_size(num_event_link_lost), - item_addr(num_event_link_lost), 1}, - {"num_cmd_deauth", item_size(num_cmd_deauth), - item_addr(num_cmd_deauth), 1}, - {"num_cmd_assoc_ok", item_size(num_cmd_assoc_success), - item_addr(num_cmd_assoc_success), 1}, - {"num_cmd_assoc_fail", item_size(num_cmd_assoc_failure), - item_addr(num_cmd_assoc_failure), 1}, - {"cmd_sent", item_size(cmd_sent), - item_addr(cmd_sent), 1}, - {"data_sent", item_size(data_sent), - item_addr(data_sent), 1}, - {"cmd_resp_received", item_size(cmd_resp_received), - item_addr(cmd_resp_received), 1}, - {"event_received", item_size(event_received), - item_addr(event_received), 1}, - - /* variables defined in struct mwifiex_adapter */ - {"cmd_pending", adapter_item_size(cmd_pending), - adapter_item_addr(cmd_pending), 1}, - {"tx_pending", adapter_item_size(tx_pending), - adapter_item_addr(tx_pending), 1}, - {"rx_pending", adapter_item_size(rx_pending), - adapter_item_addr(rx_pending), 1}, -}; - -static int num_of_items = ARRAY_SIZE(items); - -/* - * Proc info file read handler. - * - * This function is called when the 'info' file is opened for reading. - * It prints the following driver related information - - * - Driver name - * - Driver version - * - Driver extended version - * - Interface name - * - BSS mode - * - Media state (connected or disconnected) - * - MAC address - * - Total number of Tx bytes - * - Total number of Rx bytes - * - Total number of Tx packets - * - Total number of Rx packets - * - Total number of dropped Tx packets - * - Total number of dropped Rx packets - * - Total number of corrupted Tx packets - * - Total number of corrupted Rx packets - * - Carrier status (on or off) - * - Tx queue status (started or stopped) - * - * For STA mode drivers, it also prints the following extra - - * - ESSID - * - BSSID - * - Channel - * - Region code - * - Multicast count - * - Multicast addresses - */ -static ssize_t -mwifiex_info_read(struct file *file, char __user *ubuf, - size_t count, loff_t *ppos) -{ - struct mwifiex_private *priv = - (struct mwifiex_private *) file->private_data; - struct net_device *netdev = priv->netdev; - struct netdev_hw_addr *ha; - struct netdev_queue *txq; - unsigned long page = get_zeroed_page(GFP_KERNEL); - char *p = (char *) page, fmt[64]; - struct mwifiex_bss_info info; - ssize_t ret; - int i = 0; - - if (!p) - return -ENOMEM; - - memset(&info, 0, sizeof(info)); - ret = mwifiex_get_bss_info(priv, &info); - if (ret) - goto free_and_exit; - - mwifiex_drv_get_driver_version(priv->adapter, fmt, sizeof(fmt) - 1); - - if (!priv->version_str[0]) - mwifiex_get_ver_ext(priv); - - p += sprintf(p, "driver_name = " "\"mwifiex\"\n"); - p += sprintf(p, "driver_version = %s", fmt); - p += sprintf(p, "\nverext = %s", priv->version_str); - p += sprintf(p, "\ninterface_name=\"%s\"\n", netdev->name); - - if (info.bss_mode >= ARRAY_SIZE(bss_modes)) - p += sprintf(p, "bss_mode=\"%d\"\n", info.bss_mode); - else - p += sprintf(p, "bss_mode=\"%s\"\n", bss_modes[info.bss_mode]); - - p += sprintf(p, "media_state=\"%s\"\n", - (!priv->media_connected ? "Disconnected" : "Connected")); - p += sprintf(p, "mac_address=\"%pM\"\n", netdev->dev_addr); - - if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) { - p += sprintf(p, "multicast_count=\"%d\"\n", - netdev_mc_count(netdev)); - p += sprintf(p, "essid=\"%s\"\n", info.ssid.ssid); - p += sprintf(p, "bssid=\"%pM\"\n", info.bssid); - p += sprintf(p, "channel=\"%d\"\n", (int) info.bss_chan); - p += sprintf(p, "country_code = \"%s\"\n", info.country_code); - - netdev_for_each_mc_addr(ha, netdev) - p += sprintf(p, "multicast_address[%d]=\"%pM\"\n", - i++, ha->addr); - } - - p += sprintf(p, "num_tx_bytes = %lu\n", priv->stats.tx_bytes); - p += sprintf(p, "num_rx_bytes = %lu\n", priv->stats.rx_bytes); - p += sprintf(p, "num_tx_pkts = %lu\n", priv->stats.tx_packets); - p += sprintf(p, "num_rx_pkts = %lu\n", priv->stats.rx_packets); - p += sprintf(p, "num_tx_pkts_dropped = %lu\n", priv->stats.tx_dropped); - p += sprintf(p, "num_rx_pkts_dropped = %lu\n", priv->stats.rx_dropped); - p += sprintf(p, "num_tx_pkts_err = %lu\n", priv->stats.tx_errors); - p += sprintf(p, "num_rx_pkts_err = %lu\n", priv->stats.rx_errors); - p += sprintf(p, "carrier %s\n", ((netif_carrier_ok(priv->netdev)) - ? "on" : "off")); - p += sprintf(p, "tx queue"); - for (i = 0; i < netdev->num_tx_queues; i++) { - txq = netdev_get_tx_queue(netdev, i); - p += sprintf(p, " %d:%s", i, netif_tx_queue_stopped(txq) ? - "stopped" : "started"); - } - p += sprintf(p, "\n"); - - ret = simple_read_from_buffer(ubuf, count, ppos, (char *) page, - (unsigned long) p - page); - -free_and_exit: - free_page(page); - return ret; -} - -/* - * Proc getlog file read handler. - * - * This function is called when the 'getlog' file is opened for reading - * It prints the following log information - - * - Number of multicast Tx frames - * - Number of failed packets - * - Number of Tx retries - * - Number of multicast Tx retries - * - Number of duplicate frames - * - Number of RTS successes - * - Number of RTS failures - * - Number of ACK failures - * - Number of fragmented Rx frames - * - Number of multicast Rx frames - * - Number of FCS errors - * - Number of Tx frames - * - WEP ICV error counts - */ -static ssize_t -mwifiex_getlog_read(struct file *file, char __user *ubuf, - size_t count, loff_t *ppos) -{ - struct mwifiex_private *priv = - (struct mwifiex_private *) file->private_data; - unsigned long page = get_zeroed_page(GFP_KERNEL); - char *p = (char *) page; - ssize_t ret; - struct mwifiex_ds_get_stats stats; - - if (!p) - return -ENOMEM; - - memset(&stats, 0, sizeof(stats)); - ret = mwifiex_get_stats_info(priv, &stats); - if (ret) - goto free_and_exit; - - p += sprintf(p, "\n" - "mcasttxframe %u\n" - "failed %u\n" - "retry %u\n" - "multiretry %u\n" - "framedup %u\n" - "rtssuccess %u\n" - "rtsfailure %u\n" - "ackfailure %u\n" - "rxfrag %u\n" - "mcastrxframe %u\n" - "fcserror %u\n" - "txframe %u\n" - "wepicverrcnt-1 %u\n" - "wepicverrcnt-2 %u\n" - "wepicverrcnt-3 %u\n" - "wepicverrcnt-4 %u\n", - stats.mcast_tx_frame, - stats.failed, - stats.retry, - stats.multi_retry, - stats.frame_dup, - stats.rts_success, - stats.rts_failure, - stats.ack_failure, - stats.rx_frag, - stats.mcast_rx_frame, - stats.fcs_error, - stats.tx_frame, - stats.wep_icv_error[0], - stats.wep_icv_error[1], - stats.wep_icv_error[2], - stats.wep_icv_error[3]); - - - ret = simple_read_from_buffer(ubuf, count, ppos, (char *) page, - (unsigned long) p - page); - -free_and_exit: - free_page(page); - return ret; -} - -static struct mwifiex_debug_info info; - -/* - * Proc debug file read handler. - * - * This function is called when the 'debug' file is opened for reading - * It prints the following log information - - * - Interrupt count - * - WMM AC VO packets count - * - WMM AC VI packets count - * - WMM AC BE packets count - * - WMM AC BK packets count - * - Maximum Tx buffer size - * - Tx buffer size - * - Current Tx buffer size - * - Power Save mode - * - Power Save state - * - Deep Sleep status - * - Device wakeup required status - * - Number of wakeup tries - * - Host Sleep configured status - * - Host Sleep activated status - * - Number of Tx timeouts - * - Number of command timeouts - * - Last timed out command ID - * - Last timed out command action - * - Last command ID - * - Last command action - * - Last command index - * - Last command response ID - * - Last command response index - * - Last event - * - Last event index - * - Number of host to card command failures - * - Number of sleep confirm command failures - * - Number of host to card data failure - * - Number of deauthentication events - * - Number of disassociation events - * - Number of link lost events - * - Number of deauthentication commands - * - Number of association success commands - * - Number of association failure commands - * - Number of commands sent - * - Number of data packets sent - * - Number of command responses received - * - Number of events received - * - Tx BA stream table (TID, RA) - * - Rx reorder table (TID, TA, Start window, Window size, Buffer) - */ -static ssize_t -mwifiex_debug_read(struct file *file, char __user *ubuf, - size_t count, loff_t *ppos) -{ - struct mwifiex_private *priv = - (struct mwifiex_private *) file->private_data; - struct mwifiex_debug_data *d = &items[0]; - unsigned long page = get_zeroed_page(GFP_KERNEL); - char *p = (char *) page; - ssize_t ret; - size_t size, addr; - long val; - int i, j; - - if (!p) - return -ENOMEM; - - ret = mwifiex_get_debug_info(priv, &info); - if (ret) - goto free_and_exit; - - for (i = 0; i < num_of_items; i++) { - p += sprintf(p, "%s=", d[i].name); - - size = d[i].size / d[i].num; - - if (i < (num_of_items - 3)) - addr = d[i].addr + (size_t) &info; - else /* The last 3 items are struct mwifiex_adapter variables */ - addr = d[i].addr + (size_t) priv->adapter; - - for (j = 0; j < d[i].num; j++) { - switch (size) { - case 1: - val = *((u8 *) addr); - break; - case 2: - val = *((u16 *) addr); - break; - case 4: - val = *((u32 *) addr); - break; - case 8: - val = *((long long *) addr); - break; - default: - val = -1; - break; - } - - p += sprintf(p, "%#lx ", val); - addr += size; - } - - p += sprintf(p, "\n"); - } - - if (info.tx_tbl_num) { - p += sprintf(p, "Tx BA stream table:\n"); - for (i = 0; i < info.tx_tbl_num; i++) - p += sprintf(p, "tid = %d, ra = %pM\n", - info.tx_tbl[i].tid, info.tx_tbl[i].ra); - } - - if (info.rx_tbl_num) { - p += sprintf(p, "Rx reorder table:\n"); - for (i = 0; i < info.rx_tbl_num; i++) { - p += sprintf(p, "tid = %d, ta = %pM, " - "start_win = %d, " - "win_size = %d, buffer: ", - info.rx_tbl[i].tid, - info.rx_tbl[i].ta, - info.rx_tbl[i].start_win, - info.rx_tbl[i].win_size); - - for (j = 0; j < info.rx_tbl[i].win_size; j++) - p += sprintf(p, "%c ", - info.rx_tbl[i].buffer[j] ? - '1' : '0'); - - p += sprintf(p, "\n"); - } - } - - ret = simple_read_from_buffer(ubuf, count, ppos, (char *) page, - (unsigned long) p - page); - -free_and_exit: - free_page(page); - return ret; -} - -static u32 saved_reg_type, saved_reg_offset, saved_reg_value; - -/* - * Proc regrdwr file write handler. - * - * This function is called when the 'regrdwr' file is opened for writing - * - * This function can be used to write to a register. - */ -static ssize_t -mwifiex_regrdwr_write(struct file *file, - const char __user *ubuf, size_t count, loff_t *ppos) -{ - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *) addr; - size_t buf_size = min(count, (size_t) (PAGE_SIZE - 1)); - int ret; - u32 reg_type = 0, reg_offset = 0, reg_value = UINT_MAX; - - if (!buf) - return -ENOMEM; - - - if (copy_from_user(buf, ubuf, buf_size)) { - ret = -EFAULT; - goto done; - } - - sscanf(buf, "%u %x %x", ®_type, ®_offset, ®_value); - - if (reg_type == 0 || reg_offset == 0) { - ret = -EINVAL; - goto done; - } else { - saved_reg_type = reg_type; - saved_reg_offset = reg_offset; - saved_reg_value = reg_value; - ret = count; - } -done: - free_page(addr); - return ret; -} - -/* - * Proc regrdwr file read handler. - * - * This function is called when the 'regrdwr' file is opened for reading - * - * This function can be used to read from a register. - */ -static ssize_t -mwifiex_regrdwr_read(struct file *file, char __user *ubuf, - size_t count, loff_t *ppos) -{ - struct mwifiex_private *priv = - (struct mwifiex_private *) file->private_data; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *) addr; - int pos = 0, ret = 0; - u32 reg_value; - - if (!buf) - return -ENOMEM; - - if (!saved_reg_type) { - /* No command has been given */ - pos += snprintf(buf, PAGE_SIZE, "0"); - goto done; - } - /* Set command has been given */ - if (saved_reg_value != UINT_MAX) { - ret = mwifiex_reg_write(priv, saved_reg_type, saved_reg_offset, - saved_reg_value); - - pos += snprintf(buf, PAGE_SIZE, "%u 0x%x 0x%x\n", - saved_reg_type, saved_reg_offset, - saved_reg_value); - - ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos); - - goto done; - } - /* Get command has been given */ - ret = mwifiex_reg_read(priv, saved_reg_type, - saved_reg_offset, ®_value); - if (ret) { - ret = -EINVAL; - goto done; - } - - pos += snprintf(buf, PAGE_SIZE, "%u 0x%x 0x%x\n", saved_reg_type, - saved_reg_offset, reg_value); - - ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos); - -done: - free_page(addr); - return ret; -} - -static u32 saved_offset = -1, saved_bytes = -1; - -/* - * Proc rdeeprom file write handler. - * - * This function is called when the 'rdeeprom' file is opened for writing - * - * This function can be used to write to a RDEEPROM location. - */ -static ssize_t -mwifiex_rdeeprom_write(struct file *file, - const char __user *ubuf, size_t count, loff_t *ppos) -{ - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *) addr; - size_t buf_size = min(count, (size_t) (PAGE_SIZE - 1)); - int ret = 0; - int offset = -1, bytes = -1; - - if (!buf) - return -ENOMEM; - - - if (copy_from_user(buf, ubuf, buf_size)) { - ret = -EFAULT; - goto done; - } - - sscanf(buf, "%d %d", &offset, &bytes); - - if (offset == -1 || bytes == -1) { - ret = -EINVAL; - goto done; - } else { - saved_offset = offset; - saved_bytes = bytes; - ret = count; - } -done: - free_page(addr); - return ret; -} - -/* - * Proc rdeeprom read write handler. - * - * This function is called when the 'rdeeprom' file is opened for reading - * - * This function can be used to read from a RDEEPROM location. - */ -static ssize_t -mwifiex_rdeeprom_read(struct file *file, char __user *ubuf, - size_t count, loff_t *ppos) -{ - struct mwifiex_private *priv = - (struct mwifiex_private *) file->private_data; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *) addr; - int pos = 0, ret = 0, i; - u8 value[MAX_EEPROM_DATA]; - - if (!buf) - return -ENOMEM; - - if (saved_offset == -1) { - /* No command has been given */ - pos += snprintf(buf, PAGE_SIZE, "0"); - goto done; - } - - /* Get command has been given */ - ret = mwifiex_eeprom_read(priv, (u16) saved_offset, - (u16) saved_bytes, value); - if (ret) { - ret = -EINVAL; - goto done; - } - - pos += snprintf(buf, PAGE_SIZE, "%d %d ", saved_offset, saved_bytes); - - for (i = 0; i < saved_bytes; i++) - pos += snprintf(buf + strlen(buf), PAGE_SIZE, "%d ", value[i]); - - ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos); - -done: - free_page(addr); - return ret; -} - - -#define MWIFIEX_DFS_ADD_FILE(name) do { \ - if (!debugfs_create_file(#name, 0644, priv->dfs_dev_dir, \ - priv, &mwifiex_dfs_##name##_fops)) \ - return; \ -} while (0); - -#define MWIFIEX_DFS_FILE_OPS(name) \ -static const struct file_operations mwifiex_dfs_##name##_fops = { \ - .read = mwifiex_##name##_read, \ - .write = mwifiex_##name##_write, \ - .open = simple_open, \ -}; - -#define MWIFIEX_DFS_FILE_READ_OPS(name) \ -static const struct file_operations mwifiex_dfs_##name##_fops = { \ - .read = mwifiex_##name##_read, \ - .open = simple_open, \ -}; - -#define MWIFIEX_DFS_FILE_WRITE_OPS(name) \ -static const struct file_operations mwifiex_dfs_##name##_fops = { \ - .write = mwifiex_##name##_write, \ - .open = simple_open, \ -}; - - -MWIFIEX_DFS_FILE_READ_OPS(info); -MWIFIEX_DFS_FILE_READ_OPS(debug); -MWIFIEX_DFS_FILE_READ_OPS(getlog); -MWIFIEX_DFS_FILE_OPS(regrdwr); -MWIFIEX_DFS_FILE_OPS(rdeeprom); - -/* - * This function creates the debug FS directory structure and the files. - */ -void -mwifiex_dev_debugfs_init(struct mwifiex_private *priv) -{ - if (!mwifiex_dfs_dir || !priv) - return; - - priv->dfs_dev_dir = debugfs_create_dir(priv->netdev->name, - mwifiex_dfs_dir); - - if (!priv->dfs_dev_dir) - return; - - MWIFIEX_DFS_ADD_FILE(info); - MWIFIEX_DFS_ADD_FILE(debug); - MWIFIEX_DFS_ADD_FILE(getlog); - MWIFIEX_DFS_ADD_FILE(regrdwr); - MWIFIEX_DFS_ADD_FILE(rdeeprom); -} - -/* - * This function removes the debug FS directory structure and the files. - */ -void -mwifiex_dev_debugfs_remove(struct mwifiex_private *priv) -{ - if (!priv) - return; - - debugfs_remove_recursive(priv->dfs_dev_dir); -} - -/* - * This function creates the top level proc directory. - */ -void -mwifiex_debugfs_init(void) -{ - if (!mwifiex_dfs_dir) - mwifiex_dfs_dir = debugfs_create_dir("mwifiex", NULL); -} - -/* - * This function removes the top level proc directory. - */ -void -mwifiex_debugfs_remove(void) -{ - if (mwifiex_dfs_dir) - debugfs_remove(mwifiex_dfs_dir); -} diff --git a/drivers/net/wireless/mwifiex/decl.h b/drivers/net/wireless/mwifiex/decl.h deleted file mode 100644 index 94cc09d48444..000000000000 --- a/drivers/net/wireless/mwifiex/decl.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Marvell Wireless LAN device driver: generic data structures and APIs - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef _MWIFIEX_DECL_H_ -#define _MWIFIEX_DECL_H_ - -#undef pr_fmt -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include - - -#define MWIFIEX_MAX_BSS_NUM (3) - -#define MWIFIEX_MIN_DATA_HEADER_LEN 36 /* sizeof(mwifiex_txpd) - * + 4 byte alignment - */ -#define MWIFIEX_MGMT_FRAME_HEADER_SIZE 8 /* sizeof(pkt_type) - * + sizeof(tx_control) - */ - -#define MWIFIEX_MAX_TX_BASTREAM_SUPPORTED 2 -#define MWIFIEX_MAX_RX_BASTREAM_SUPPORTED 16 - -#define MWIFIEX_STA_AMPDU_DEF_TXWINSIZE 16 -#define MWIFIEX_STA_AMPDU_DEF_RXWINSIZE 32 -#define MWIFIEX_UAP_AMPDU_DEF_TXWINSIZE 32 -#define MWIFIEX_UAP_AMPDU_DEF_RXWINSIZE 16 -#define MWIFIEX_11AC_STA_AMPDU_DEF_TXWINSIZE 32 -#define MWIFIEX_11AC_STA_AMPDU_DEF_RXWINSIZE 48 -#define MWIFIEX_11AC_UAP_AMPDU_DEF_TXWINSIZE 48 -#define MWIFIEX_11AC_UAP_AMPDU_DEF_RXWINSIZE 32 - -#define MWIFIEX_DEFAULT_BLOCK_ACK_TIMEOUT 0xffff - -#define MWIFIEX_RATE_BITMAP_MCS0 32 - -#define MWIFIEX_RX_DATA_BUF_SIZE (4 * 1024) -#define MWIFIEX_RX_CMD_BUF_SIZE (2 * 1024) - -#define MAX_BEACON_PERIOD (4000) -#define MIN_BEACON_PERIOD (50) -#define MAX_DTIM_PERIOD (100) -#define MIN_DTIM_PERIOD (1) - -#define MWIFIEX_RTS_MIN_VALUE (0) -#define MWIFIEX_RTS_MAX_VALUE (2347) -#define MWIFIEX_FRAG_MIN_VALUE (256) -#define MWIFIEX_FRAG_MAX_VALUE (2346) -#define MWIFIEX_WMM_VERSION 0x01 -#define MWIFIEX_WMM_SUBTYPE 0x01 - -#define MWIFIEX_RETRY_LIMIT 14 -#define MWIFIEX_SDIO_BLOCK_SIZE 256 - -#define MWIFIEX_BUF_FLAG_REQUEUED_PKT BIT(0) -#define MWIFIEX_BUF_FLAG_BRIDGED_PKT BIT(1) - -#define MWIFIEX_BRIDGED_PKTS_THRESHOLD 1024 - -enum mwifiex_bss_type { - MWIFIEX_BSS_TYPE_STA = 0, - MWIFIEX_BSS_TYPE_UAP = 1, - MWIFIEX_BSS_TYPE_P2P = 2, - MWIFIEX_BSS_TYPE_ANY = 0xff, -}; - -enum mwifiex_bss_role { - MWIFIEX_BSS_ROLE_STA = 0, - MWIFIEX_BSS_ROLE_UAP = 1, - MWIFIEX_BSS_ROLE_ANY = 0xff, -}; - -#define BSS_ROLE_BIT_MASK BIT(0) - -#define GET_BSS_ROLE(priv) ((priv)->bss_role & BSS_ROLE_BIT_MASK) - -enum mwifiex_data_frame_type { - MWIFIEX_DATA_FRAME_TYPE_ETH_II = 0, - MWIFIEX_DATA_FRAME_TYPE_802_11, -}; - -struct mwifiex_fw_image { - u8 *helper_buf; - u32 helper_len; - u8 *fw_buf; - u32 fw_len; -}; - -struct mwifiex_802_11_ssid { - u32 ssid_len; - u8 ssid[IEEE80211_MAX_SSID_LEN]; -}; - -struct mwifiex_wait_queue { - wait_queue_head_t wait; - int status; -}; - -struct mwifiex_rxinfo { - u8 bss_num; - u8 bss_type; - struct sk_buff *parent; - u8 use_count; -}; - -struct mwifiex_txinfo { - u32 status_code; - u8 flags; - u8 bss_num; - u8 bss_type; -}; - -enum mwifiex_wmm_ac_e { - WMM_AC_BK, - WMM_AC_BE, - WMM_AC_VI, - WMM_AC_VO -} __packed; - -struct ieee_types_wmm_ac_parameters { - u8 aci_aifsn_bitmap; - u8 ecw_bitmap; - __le16 tx_op_limit; -} __packed; - -struct mwifiex_types_wmm_info { - u8 oui[4]; - u8 subtype; - u8 version; - u8 qos_info; - u8 reserved; - struct ieee_types_wmm_ac_parameters ac_params[IEEE80211_NUM_ACS]; -} __packed; -#endif /* !_MWIFIEX_DECL_H_ */ diff --git a/drivers/net/wireless/mwifiex/ethtool.c b/drivers/net/wireless/mwifiex/ethtool.c deleted file mode 100644 index bfb39908b2c6..000000000000 --- a/drivers/net/wireless/mwifiex/ethtool.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Marvell Wireless LAN device driver: ethtool - * - * Copyright (C) 2013, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "main.h" - -static void mwifiex_ethtool_get_wol(struct net_device *dev, - struct ethtool_wolinfo *wol) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - u32 conditions = le32_to_cpu(priv->adapter->hs_cfg.conditions); - - wol->supported = WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY; - - if (conditions == HS_CFG_COND_DEF) - return; - - if (conditions & HS_CFG_COND_UNICAST_DATA) - wol->wolopts |= WAKE_UCAST; - if (conditions & HS_CFG_COND_MULTICAST_DATA) - wol->wolopts |= WAKE_MCAST; - if (conditions & HS_CFG_COND_BROADCAST_DATA) - wol->wolopts |= WAKE_BCAST; - if (conditions & HS_CFG_COND_MAC_EVENT) - wol->wolopts |= WAKE_PHY; -} - -static int mwifiex_ethtool_set_wol(struct net_device *dev, - struct ethtool_wolinfo *wol) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - u32 conditions = 0; - - if (wol->wolopts & ~(WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY)) - return -EOPNOTSUPP; - - if (wol->wolopts & WAKE_UCAST) - conditions |= HS_CFG_COND_UNICAST_DATA; - if (wol->wolopts & WAKE_MCAST) - conditions |= HS_CFG_COND_MULTICAST_DATA; - if (wol->wolopts & WAKE_BCAST) - conditions |= HS_CFG_COND_BROADCAST_DATA; - if (wol->wolopts & WAKE_PHY) - conditions |= HS_CFG_COND_MAC_EVENT; - if (wol->wolopts == 0) - conditions |= HS_CFG_COND_DEF; - priv->adapter->hs_cfg.conditions = cpu_to_le32(conditions); - - return 0; -} - -const struct ethtool_ops mwifiex_ethtool_ops = { - .get_wol = mwifiex_ethtool_get_wol, - .set_wol = mwifiex_ethtool_set_wol, -}; diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h deleted file mode 100644 index 1f7578d553ec..000000000000 --- a/drivers/net/wireless/mwifiex/fw.h +++ /dev/null @@ -1,1645 +0,0 @@ -/* - * Marvell Wireless LAN device driver: Firmware specific macros & structures - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef _MWIFIEX_FW_H_ -#define _MWIFIEX_FW_H_ - -#include - - -#define INTF_HEADER_LEN 4 - -struct rfc_1042_hdr { - u8 llc_dsap; - u8 llc_ssap; - u8 llc_ctrl; - u8 snap_oui[3]; - u16 snap_type; -}; - -struct rx_packet_hdr { - struct ethhdr eth803_hdr; - struct rfc_1042_hdr rfc1042_hdr; -}; - -struct tx_packet_hdr { - struct ethhdr eth803_hdr; - struct rfc_1042_hdr rfc1042_hdr; -}; - -#define B_SUPPORTED_RATES 5 -#define G_SUPPORTED_RATES 9 -#define BG_SUPPORTED_RATES 13 -#define A_SUPPORTED_RATES 9 -#define HOSTCMD_SUPPORTED_RATES 14 -#define N_SUPPORTED_RATES 3 -#define ALL_802_11_BANDS (BAND_A | BAND_B | BAND_G | BAND_GN | \ - BAND_AN | BAND_GAC | BAND_AAC) - -#define FW_MULTI_BANDS_SUPPORT (BIT(8) | BIT(9) | BIT(10) | BIT(11) | \ - BIT(12) | BIT(13)) -#define IS_SUPPORT_MULTI_BANDS(adapter) \ - (adapter->fw_cap_info & FW_MULTI_BANDS_SUPPORT) - -/* shift bit 12 and bit 13 in fw_cap_info from the firmware to bit 13 and 14 - * for 11ac so that bit 11 is for GN, bit 12 for AN, bit 13 for GAC, and bit - * bit 14 for AAC, in order to be compatible with the band capability - * defined in the driver after right shift of 8 bits. - */ -#define GET_FW_DEFAULT_BANDS(adapter) \ - (((((adapter->fw_cap_info & 0x3000) << 1) | \ - (adapter->fw_cap_info & ~0xF000)) >> 8) & \ - ALL_802_11_BANDS) - -#define HostCmd_WEP_KEY_INDEX_MASK 0x3fff - -#define KEY_INFO_ENABLED 0x01 -enum KEY_TYPE_ID { - KEY_TYPE_ID_WEP = 0, - KEY_TYPE_ID_TKIP, - KEY_TYPE_ID_AES, - KEY_TYPE_ID_WAPI, - KEY_TYPE_ID_AES_CMAC, -}; -#define KEY_MCAST BIT(0) -#define KEY_UNICAST BIT(1) -#define KEY_ENABLED BIT(2) -#define KEY_IGTK BIT(10) - -#define WAPI_KEY_LEN 50 - -#define MAX_POLL_TRIES 100 - -#define MAX_MULTI_INTERFACE_POLL_TRIES 1000 - -#define MAX_FIRMWARE_POLL_TRIES 100 - -#define FIRMWARE_READY_SDIO 0xfedc -#define FIRMWARE_READY_PCIE 0xfedcba00 - -enum mwifiex_usb_ep { - MWIFIEX_USB_EP_CMD_EVENT = 1, - MWIFIEX_USB_EP_DATA = 2, -}; - -enum MWIFIEX_802_11_PRIVACY_FILTER { - MWIFIEX_802_11_PRIV_FILTER_ACCEPT_ALL, - MWIFIEX_802_11_PRIV_FILTER_8021X_WEP -}; - -#define CAL_SNR(RSSI, NF) ((s16)((s16)(RSSI)-(s16)(NF))) -#define CAL_RSSI(SNR, NF) ((s16)((s16)(SNR)+(s16)(NF))) - -#define UAP_BSS_PARAMS_I 0 -#define UAP_CUSTOM_IE_I 1 -#define MWIFIEX_AUTO_IDX_MASK 0xffff -#define MWIFIEX_DELETE_MASK 0x0000 -#define MGMT_MASK_ASSOC_REQ 0x01 -#define MGMT_MASK_REASSOC_REQ 0x04 -#define MGMT_MASK_ASSOC_RESP 0x02 -#define MGMT_MASK_REASSOC_RESP 0x08 -#define MGMT_MASK_PROBE_REQ 0x10 -#define MGMT_MASK_PROBE_RESP 0x20 -#define MGMT_MASK_BEACON 0x100 - -#define TLV_TYPE_UAP_SSID 0x0000 -#define TLV_TYPE_UAP_RATES 0x0001 - -#define PROPRIETARY_TLV_BASE_ID 0x0100 -#define TLV_TYPE_KEY_MATERIAL (PROPRIETARY_TLV_BASE_ID + 0) -#define TLV_TYPE_CHANLIST (PROPRIETARY_TLV_BASE_ID + 1) -#define TLV_TYPE_NUMPROBES (PROPRIETARY_TLV_BASE_ID + 2) -#define TLV_TYPE_RSSI_LOW (PROPRIETARY_TLV_BASE_ID + 4) -#define TLV_TYPE_PASSTHROUGH (PROPRIETARY_TLV_BASE_ID + 10) -#define TLV_TYPE_WMMQSTATUS (PROPRIETARY_TLV_BASE_ID + 16) -#define TLV_TYPE_WILDCARDSSID (PROPRIETARY_TLV_BASE_ID + 18) -#define TLV_TYPE_TSFTIMESTAMP (PROPRIETARY_TLV_BASE_ID + 19) -#define TLV_TYPE_RSSI_HIGH (PROPRIETARY_TLV_BASE_ID + 22) -#define TLV_TYPE_AUTH_TYPE (PROPRIETARY_TLV_BASE_ID + 31) -#define TLV_TYPE_STA_MAC_ADDR (PROPRIETARY_TLV_BASE_ID + 32) -#define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 42) -#define TLV_TYPE_UAP_BEACON_PERIOD (PROPRIETARY_TLV_BASE_ID + 44) -#define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 45) -#define TLV_TYPE_UAP_BCAST_SSID (PROPRIETARY_TLV_BASE_ID + 48) -#define TLV_TYPE_UAP_RTS_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 51) -#define TLV_TYPE_UAP_AO_TIMER (PROPRIETARY_TLV_BASE_ID + 57) -#define TLV_TYPE_UAP_WEP_KEY (PROPRIETARY_TLV_BASE_ID + 59) -#define TLV_TYPE_UAP_WPA_PASSPHRASE (PROPRIETARY_TLV_BASE_ID + 60) -#define TLV_TYPE_UAP_ENCRY_PROTOCOL (PROPRIETARY_TLV_BASE_ID + 64) -#define TLV_TYPE_UAP_AKMP (PROPRIETARY_TLV_BASE_ID + 65) -#define TLV_TYPE_UAP_FRAG_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 70) -#define TLV_TYPE_RATE_DROP_CONTROL (PROPRIETARY_TLV_BASE_ID + 82) -#define TLV_TYPE_RATE_SCOPE (PROPRIETARY_TLV_BASE_ID + 83) -#define TLV_TYPE_POWER_GROUP (PROPRIETARY_TLV_BASE_ID + 84) -#define TLV_TYPE_UAP_RETRY_LIMIT (PROPRIETARY_TLV_BASE_ID + 93) -#define TLV_TYPE_WAPI_IE (PROPRIETARY_TLV_BASE_ID + 94) -#define TLV_TYPE_UAP_MGMT_FRAME (PROPRIETARY_TLV_BASE_ID + 104) -#define TLV_TYPE_MGMT_IE (PROPRIETARY_TLV_BASE_ID + 105) -#define TLV_TYPE_AUTO_DS_PARAM (PROPRIETARY_TLV_BASE_ID + 113) -#define TLV_TYPE_PS_PARAM (PROPRIETARY_TLV_BASE_ID + 114) -#define TLV_TYPE_UAP_PS_AO_TIMER (PROPRIETARY_TLV_BASE_ID + 123) -#define TLV_TYPE_PWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 145) -#define TLV_TYPE_GWK_CIPHER (PROPRIETARY_TLV_BASE_ID + 146) - -#define MWIFIEX_TX_DATA_BUF_SIZE_2K 2048 - -#define SSN_MASK 0xfff0 - -#define BA_RESULT_SUCCESS 0x0 -#define BA_RESULT_TIMEOUT 0x2 - -#define IS_BASTREAM_SETUP(ptr) (ptr->ba_status) - -#define BA_STREAM_NOT_ALLOWED 0xff - -#define IS_11N_ENABLED(priv) ((priv->adapter->config_bands & BAND_GN || \ - priv->adapter->config_bands & BAND_AN) && \ - priv->curr_bss_params.bss_descriptor.bcn_ht_cap) -#define INITIATOR_BIT(DelBAParamSet) (((DelBAParamSet) &\ - BIT(DELBA_INITIATOR_POS)) >> DELBA_INITIATOR_POS) - -#define MWIFIEX_TX_DATA_BUF_SIZE_4K 4096 -#define MWIFIEX_TX_DATA_BUF_SIZE_8K 8192 - -#define ISSUPP_11NENABLED(FwCapInfo) (FwCapInfo & BIT(11)) - -#define MWIFIEX_DEF_HT_CAP (IEEE80211_HT_CAP_DSSSCCK40 | \ - (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT) | \ - IEEE80211_HT_CAP_SM_PS) - -#define MWIFIEX_DEF_AMPDU IEEE80211_HT_AMPDU_PARM_FACTOR - -/* dev_cap bitmap - * BIT - * 0-16 reserved - * 17 IEEE80211_HT_CAP_SUP_WIDTH_20_40 - * 18-22 reserved - * 23 IEEE80211_HT_CAP_SGI_20 - * 24 IEEE80211_HT_CAP_SGI_40 - * 25 IEEE80211_HT_CAP_TX_STBC - * 26 IEEE80211_HT_CAP_RX_STBC - * 27-28 reserved - * 29 IEEE80211_HT_CAP_GRN_FLD - * 30-31 reserved - */ -#define ISSUPP_CHANWIDTH40(Dot11nDevCap) (Dot11nDevCap & BIT(17)) -#define ISSUPP_SHORTGI20(Dot11nDevCap) (Dot11nDevCap & BIT(23)) -#define ISSUPP_SHORTGI40(Dot11nDevCap) (Dot11nDevCap & BIT(24)) -#define ISSUPP_TXSTBC(Dot11nDevCap) (Dot11nDevCap & BIT(25)) -#define ISSUPP_RXSTBC(Dot11nDevCap) (Dot11nDevCap & BIT(26)) -#define ISSUPP_GREENFIELD(Dot11nDevCap) (Dot11nDevCap & BIT(29)) -#define ISENABLED_40MHZ_INTOLERANT(Dot11nDevCap) (Dot11nDevCap & BIT(8)) -#define ISSUPP_RXLDPC(Dot11nDevCap) (Dot11nDevCap & BIT(22)) - -/* httxcfg bitmap - * 0 reserved - * 1 20/40 Mhz enable(1)/disable(0) - * 2-3 reserved - * 4 green field enable(1)/disable(0) - * 5 short GI in 20 Mhz enable(1)/disable(0) - * 6 short GI in 40 Mhz enable(1)/disable(0) - * 7-15 reserved - */ -#define MWIFIEX_FW_DEF_HTTXCFG (BIT(1) | BIT(4) | BIT(5) | BIT(6)) - -#define GET_RXMCSSUPP(DevMCSSupported) (DevMCSSupported & 0x0f) -#define SETHT_MCS32(x) (x[4] |= 1) -#define HT_STREAM_2X2 0x22 - -#define SET_SECONDARYCHAN(RadioType, SECCHAN) (RadioType |= (SECCHAN << 4)) - -#define LLC_SNAP_LEN 8 - -/* HW_SPEC fw_cap_info */ - -#define ISSUPP_11ACENABLED(fw_cap_info) (fw_cap_info & (BIT(13)|BIT(14))) - -#define GET_VHTCAP_CHWDSET(vht_cap_info) ((vht_cap_info >> 2) & 0x3) -#define GET_VHTNSSMCS(mcs_mapset, nss) ((mcs_mapset >> (2 * (nss - 1))) & 0x3) -#define SET_VHTNSSMCS(mcs_mapset, nss, value) (mcs_mapset |= (value & 0x3) << \ - (2 * (nss - 1))) -#define NO_NSS_SUPPORT 0x3 - -#define GET_DEVTXMCSMAP(dev_mcs_map) (dev_mcs_map >> 16) -#define GET_DEVRXMCSMAP(dev_mcs_map) (dev_mcs_map & 0xFFFF) - -#define MOD_CLASS_HR_DSSS 0x03 -#define MOD_CLASS_OFDM 0x07 -#define MOD_CLASS_HT 0x08 -#define HT_BW_20 0 -#define HT_BW_40 1 - -#define HostCmd_CMD_GET_HW_SPEC 0x0003 -#define HostCmd_CMD_802_11_SCAN 0x0006 -#define HostCmd_CMD_802_11_GET_LOG 0x000b -#define HostCmd_CMD_MAC_MULTICAST_ADR 0x0010 -#define HostCmd_CMD_802_11_EEPROM_ACCESS 0x0059 -#define HostCmd_CMD_802_11_ASSOCIATE 0x0012 -#define HostCmd_CMD_802_11_SNMP_MIB 0x0016 -#define HostCmd_CMD_MAC_REG_ACCESS 0x0019 -#define HostCmd_CMD_BBP_REG_ACCESS 0x001a -#define HostCmd_CMD_RF_REG_ACCESS 0x001b -#define HostCmd_CMD_PMIC_REG_ACCESS 0x00ad -#define HostCmd_CMD_RF_TX_PWR 0x001e -#define HostCmd_CMD_RF_ANTENNA 0x0020 -#define HostCmd_CMD_802_11_DEAUTHENTICATE 0x0024 -#define HostCmd_CMD_MAC_CONTROL 0x0028 -#define HostCmd_CMD_802_11_AD_HOC_START 0x002b -#define HostCmd_CMD_802_11_AD_HOC_JOIN 0x002c -#define HostCmd_CMD_802_11_AD_HOC_STOP 0x0040 -#define HostCmd_CMD_802_11_MAC_ADDRESS 0x004D -#define HostCmd_CMD_802_11D_DOMAIN_INFO 0x005b -#define HostCmd_CMD_802_11_KEY_MATERIAL 0x005e -#define HostCmd_CMD_802_11_BG_SCAN_QUERY 0x006c -#define HostCmd_CMD_WMM_GET_STATUS 0x0071 -#define HostCmd_CMD_802_11_SUBSCRIBE_EVENT 0x0075 -#define HostCmd_CMD_802_11_TX_RATE_QUERY 0x007f -#define HostCmd_CMD_802_11_IBSS_COALESCING_STATUS 0x0083 -#define HostCmd_CMD_VERSION_EXT 0x0097 -#define HostCmd_CMD_MEF_CFG 0x009a -#define HostCmd_CMD_RSSI_INFO 0x00a4 -#define HostCmd_CMD_FUNC_INIT 0x00a9 -#define HostCmd_CMD_FUNC_SHUTDOWN 0x00aa -#define HostCmd_CMD_UAP_SYS_CONFIG 0x00b0 -#define HostCmd_CMD_UAP_BSS_START 0x00b1 -#define HostCmd_CMD_UAP_BSS_STOP 0x00b2 -#define HostCmd_CMD_11N_CFG 0x00cd -#define HostCmd_CMD_11N_ADDBA_REQ 0x00ce -#define HostCmd_CMD_11N_ADDBA_RSP 0x00cf -#define HostCmd_CMD_11N_DELBA 0x00d0 -#define HostCmd_CMD_RECONFIGURE_TX_BUFF 0x00d9 -#define HostCmd_CMD_AMSDU_AGGR_CTRL 0x00df -#define HostCmd_CMD_TXPWR_CFG 0x00d1 -#define HostCmd_CMD_TX_RATE_CFG 0x00d6 -#define HostCmd_CMD_802_11_PS_MODE_ENH 0x00e4 -#define HostCmd_CMD_802_11_HS_CFG_ENH 0x00e5 -#define HostCmd_CMD_P2P_MODE_CFG 0x00eb -#define HostCmd_CMD_CAU_REG_ACCESS 0x00ed -#define HostCmd_CMD_SET_BSS_MODE 0x00f7 -#define HostCmd_CMD_PCIE_DESC_DETAILS 0x00fa -#define HostCmd_CMD_MGMT_FRAME_REG 0x010c -#define HostCmd_CMD_REMAIN_ON_CHAN 0x010d -#define HostCmd_CMD_11AC_CFG 0x0112 - -#define PROTOCOL_NO_SECURITY 0x01 -#define PROTOCOL_STATIC_WEP 0x02 -#define PROTOCOL_WPA 0x08 -#define PROTOCOL_WPA2 0x20 -#define PROTOCOL_WPA2_MIXED 0x28 -#define PROTOCOL_EAP 0x40 -#define KEY_MGMT_NONE 0x04 -#define KEY_MGMT_PSK 0x02 -#define KEY_MGMT_EAP 0x01 -#define CIPHER_TKIP 0x04 -#define CIPHER_AES_CCMP 0x08 -#define VALID_CIPHER_BITMAP 0x0c - -enum ENH_PS_MODES { - EN_PS = 1, - DIS_PS = 2, - EN_AUTO_DS = 3, - DIS_AUTO_DS = 4, - SLEEP_CONFIRM = 5, - GET_PS = 0, - EN_AUTO_PS = 0xff, - DIS_AUTO_PS = 0xfe, -}; - -enum P2P_MODES { - P2P_MODE_DISABLE = 0, - P2P_MODE_DEVICE = 1, - P2P_MODE_GO = 2, - P2P_MODE_CLIENT = 3, -}; - -#define HostCmd_RET_BIT 0x8000 -#define HostCmd_ACT_GEN_GET 0x0000 -#define HostCmd_ACT_GEN_SET 0x0001 -#define HostCmd_ACT_GEN_REMOVE 0x0004 -#define HostCmd_ACT_BITWISE_SET 0x0002 -#define HostCmd_ACT_BITWISE_CLR 0x0003 -#define HostCmd_RESULT_OK 0x0000 - -#define HostCmd_ACT_MAC_RX_ON 0x0001 -#define HostCmd_ACT_MAC_TX_ON 0x0002 -#define HostCmd_ACT_MAC_WEP_ENABLE 0x0008 -#define HostCmd_ACT_MAC_ETHERNETII_ENABLE 0x0010 -#define HostCmd_ACT_MAC_PROMISCUOUS_ENABLE 0x0080 -#define HostCmd_ACT_MAC_ALL_MULTICAST_ENABLE 0x0100 -#define HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON 0x2000 - -#define HostCmd_BSS_MODE_IBSS 0x0002 -#define HostCmd_BSS_MODE_ANY 0x0003 - -#define HostCmd_SCAN_RADIO_TYPE_BG 0 -#define HostCmd_SCAN_RADIO_TYPE_A 1 - -#define HS_CFG_CANCEL 0xffffffff -#define HS_CFG_COND_DEF 0x00000000 -#define HS_CFG_GPIO_DEF 0xff -#define HS_CFG_GAP_DEF 0 -#define HS_CFG_COND_BROADCAST_DATA 0x00000001 -#define HS_CFG_COND_UNICAST_DATA 0x00000002 -#define HS_CFG_COND_MAC_EVENT 0x00000004 -#define HS_CFG_COND_MULTICAST_DATA 0x00000008 - -#define MWIFIEX_TIMEOUT_FOR_AP_RESP 0xfffc -#define MWIFIEX_STATUS_CODE_AUTH_TIMEOUT 2 - -#define CMD_F_HOSTCMD (1 << 0) -#define CMD_F_CANCELED (1 << 1) - -#define HostCmd_CMD_ID_MASK 0x0fff - -#define HostCmd_SEQ_NUM_MASK 0x00ff - -#define HostCmd_BSS_NUM_MASK 0x0f00 - -#define HostCmd_BSS_TYPE_MASK 0xf000 - -#define HostCmd_ACT_SET_RX 0x0001 -#define HostCmd_ACT_SET_TX 0x0002 -#define HostCmd_ACT_SET_BOTH 0x0003 - -#define RF_ANTENNA_AUTO 0xFFFF - -#define HostCmd_SET_SEQ_NO_BSS_INFO(seq, num, type) { \ - (((seq) & 0x00ff) | \ - (((num) & 0x000f) << 8)) | \ - (((type) & 0x000f) << 12); } - -#define HostCmd_GET_SEQ_NO(seq) \ - ((seq) & HostCmd_SEQ_NUM_MASK) - -#define HostCmd_GET_BSS_NO(seq) \ - (((seq) & HostCmd_BSS_NUM_MASK) >> 8) - -#define HostCmd_GET_BSS_TYPE(seq) \ - (((seq) & HostCmd_BSS_TYPE_MASK) >> 12) - -#define EVENT_DUMMY_HOST_WAKEUP_SIGNAL 0x00000001 -#define EVENT_LINK_LOST 0x00000003 -#define EVENT_LINK_SENSED 0x00000004 -#define EVENT_MIB_CHANGED 0x00000006 -#define EVENT_INIT_DONE 0x00000007 -#define EVENT_DEAUTHENTICATED 0x00000008 -#define EVENT_DISASSOCIATED 0x00000009 -#define EVENT_PS_AWAKE 0x0000000a -#define EVENT_PS_SLEEP 0x0000000b -#define EVENT_MIC_ERR_MULTICAST 0x0000000d -#define EVENT_MIC_ERR_UNICAST 0x0000000e -#define EVENT_DEEP_SLEEP_AWAKE 0x00000010 -#define EVENT_ADHOC_BCN_LOST 0x00000011 - -#define EVENT_WMM_STATUS_CHANGE 0x00000017 -#define EVENT_BG_SCAN_REPORT 0x00000018 -#define EVENT_RSSI_LOW 0x00000019 -#define EVENT_SNR_LOW 0x0000001a -#define EVENT_MAX_FAIL 0x0000001b -#define EVENT_RSSI_HIGH 0x0000001c -#define EVENT_SNR_HIGH 0x0000001d -#define EVENT_IBSS_COALESCED 0x0000001e -#define EVENT_DATA_RSSI_LOW 0x00000024 -#define EVENT_DATA_SNR_LOW 0x00000025 -#define EVENT_DATA_RSSI_HIGH 0x00000026 -#define EVENT_DATA_SNR_HIGH 0x00000027 -#define EVENT_LINK_QUALITY 0x00000028 -#define EVENT_PORT_RELEASE 0x0000002b -#define EVENT_UAP_STA_DEAUTH 0x0000002c -#define EVENT_UAP_STA_ASSOC 0x0000002d -#define EVENT_UAP_BSS_START 0x0000002e -#define EVENT_PRE_BEACON_LOST 0x00000031 -#define EVENT_ADDBA 0x00000033 -#define EVENT_DELBA 0x00000034 -#define EVENT_BA_STREAM_TIEMOUT 0x00000037 -#define EVENT_AMSDU_AGGR_CTRL 0x00000042 -#define EVENT_UAP_BSS_IDLE 0x00000043 -#define EVENT_UAP_BSS_ACTIVE 0x00000044 -#define EVENT_WEP_ICV_ERR 0x00000046 -#define EVENT_HS_ACT_REQ 0x00000047 -#define EVENT_BW_CHANGE 0x00000048 -#define EVENT_UAP_MIC_COUNTERMEASURES 0x0000004c -#define EVENT_HOSTWAKE_STAIE 0x0000004d -#define EVENT_REMAIN_ON_CHAN_EXPIRED 0x0000005f - -#define EVENT_ID_MASK 0xffff -#define BSS_NUM_MASK 0xf - -#define EVENT_GET_BSS_NUM(event_cause) \ - (((event_cause) >> 16) & BSS_NUM_MASK) - -#define EVENT_GET_BSS_TYPE(event_cause) \ - (((event_cause) >> 24) & 0x00ff) - -#define MWIFIEX_MAX_PATTERN_LEN 20 -#define MWIFIEX_MAX_OFFSET_LEN 50 -#define STACK_NBYTES 100 -#define TYPE_DNUM 1 -#define TYPE_BYTESEQ 2 -#define MAX_OPERAND 0x40 -#define TYPE_EQ (MAX_OPERAND+1) -#define TYPE_EQ_DNUM (MAX_OPERAND+2) -#define TYPE_EQ_BIT (MAX_OPERAND+3) -#define TYPE_AND (MAX_OPERAND+4) -#define TYPE_OR (MAX_OPERAND+5) -#define MEF_MODE_HOST_SLEEP 1 -#define MEF_ACTION_ALLOW_AND_WAKEUP_HOST 3 -#define MWIFIEX_CRITERIA_BROADCAST BIT(0) -#define MWIFIEX_CRITERIA_UNICAST BIT(1) -#define MWIFIEX_CRITERIA_MULTICAST BIT(3) - -struct mwifiex_ie_types_header { - __le16 type; - __le16 len; -} __packed; - -struct mwifiex_ie_types_data { - struct mwifiex_ie_types_header header; - u8 data[1]; -} __packed; - -#define MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET 0x01 -#define MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET 0x08 - -struct txpd { - u8 bss_type; - u8 bss_num; - __le16 tx_pkt_length; - __le16 tx_pkt_offset; - __le16 tx_pkt_type; - __le32 tx_control; - u8 priority; - u8 flags; - u8 pkt_delay_2ms; - u8 reserved1; -} __packed; - -struct rxpd { - u8 bss_type; - u8 bss_num; - __le16 rx_pkt_length; - __le16 rx_pkt_offset; - __le16 rx_pkt_type; - __le16 seq_num; - u8 priority; - u8 rx_rate; - s8 snr; - s8 nf; - - /* For: Non-802.11 AC cards - * - * Ht Info [Bit 0] RxRate format: LG=0, HT=1 - * [Bit 1] HT Bandwidth: BW20 = 0, BW40 = 1 - * [Bit 2] HT Guard Interval: LGI = 0, SGI = 1 - * - * For: 802.11 AC cards - * [Bit 1] [Bit 0] RxRate format: legacy rate = 00 HT = 01 VHT = 10 - * [Bit 3] [Bit 2] HT/VHT Bandwidth BW20 = 00 BW40 = 01 - * BW80 = 10 BW160 = 11 - * [Bit 4] HT/VHT Guard interval LGI = 0 SGI = 1 - * [Bit 5] STBC support Enabled = 1 - * [Bit 6] LDPC support Enabled = 1 - * [Bit 7] Reserved - */ - u8 ht_info; - u8 reserved; -} __packed; - -struct uap_txpd { - u8 bss_type; - u8 bss_num; - __le16 tx_pkt_length; - __le16 tx_pkt_offset; - __le16 tx_pkt_type; - __le32 tx_control; - u8 priority; - u8 flags; - u8 pkt_delay_2ms; - u8 reserved1; - __le32 reserved2; -}; - -struct uap_rxpd { - u8 bss_type; - u8 bss_num; - __le16 rx_pkt_length; - __le16 rx_pkt_offset; - __le16 rx_pkt_type; - __le16 seq_num; - u8 priority; - u8 reserved1; -}; - -enum mwifiex_chan_scan_mode_bitmasks { - MWIFIEX_PASSIVE_SCAN = BIT(0), - MWIFIEX_DISABLE_CHAN_FILT = BIT(1), -}; - -struct mwifiex_chan_scan_param_set { - u8 radio_type; - u8 chan_number; - u8 chan_scan_mode_bitmap; - __le16 min_scan_time; - __le16 max_scan_time; -} __packed; - -struct mwifiex_ie_types_chan_list_param_set { - struct mwifiex_ie_types_header header; - struct mwifiex_chan_scan_param_set chan_scan_param[1]; -} __packed; - -struct chan_band_param_set { - u8 radio_type; - u8 chan_number; -}; - -struct mwifiex_ie_types_chan_band_list_param_set { - struct mwifiex_ie_types_header header; - struct chan_band_param_set chan_band_param[1]; -} __packed; - -struct mwifiex_ie_types_rates_param_set { - struct mwifiex_ie_types_header header; - u8 rates[1]; -} __packed; - -struct mwifiex_ie_types_ssid_param_set { - struct mwifiex_ie_types_header header; - u8 ssid[1]; -} __packed; - -struct mwifiex_ie_types_num_probes { - struct mwifiex_ie_types_header header; - __le16 num_probes; -} __packed; - -struct mwifiex_ie_types_wildcard_ssid_params { - struct mwifiex_ie_types_header header; - u8 max_ssid_length; - u8 ssid[1]; -} __packed; - -#define TSF_DATA_SIZE 8 -struct mwifiex_ie_types_tsf_timestamp { - struct mwifiex_ie_types_header header; - u8 tsf_data[1]; -} __packed; - -struct mwifiex_cf_param_set { - u8 cfp_cnt; - u8 cfp_period; - u16 cfp_max_duration; - u16 cfp_duration_remaining; -} __packed; - -struct mwifiex_ibss_param_set { - u16 atim_window; -} __packed; - -struct mwifiex_ie_types_ss_param_set { - struct mwifiex_ie_types_header header; - union { - struct mwifiex_cf_param_set cf_param_set[1]; - struct mwifiex_ibss_param_set ibss_param_set[1]; - } cf_ibss; -} __packed; - -struct mwifiex_fh_param_set { - u16 dwell_time; - u8 hop_set; - u8 hop_pattern; - u8 hop_index; -} __packed; - -struct mwifiex_ds_param_set { - u8 current_chan; -} __packed; - -struct mwifiex_ie_types_phy_param_set { - struct mwifiex_ie_types_header header; - union { - struct mwifiex_fh_param_set fh_param_set[1]; - struct mwifiex_ds_param_set ds_param_set[1]; - } fh_ds; -} __packed; - -struct mwifiex_ie_types_auth_type { - struct mwifiex_ie_types_header header; - __le16 auth_type; -} __packed; - -struct mwifiex_ie_types_vendor_param_set { - struct mwifiex_ie_types_header header; - u8 ie[MWIFIEX_MAX_VSIE_LEN]; -}; - -struct mwifiex_ie_types_rsn_param_set { - struct mwifiex_ie_types_header header; - u8 rsn_ie[1]; -} __packed; - -#define KEYPARAMSET_FIXED_LEN 6 - -struct mwifiex_ie_type_key_param_set { - __le16 type; - __le16 length; - __le16 key_type_id; - __le16 key_info; - __le16 key_len; - u8 key[50]; -} __packed; - -#define IGTK_PN_LEN 8 - -struct mwifiex_cmac_param { - u8 ipn[IGTK_PN_LEN]; - u8 key[WLAN_KEY_LEN_AES_CMAC]; -} __packed; - -struct host_cmd_ds_802_11_key_material { - __le16 action; - struct mwifiex_ie_type_key_param_set key_param_set; -} __packed; - -struct host_cmd_ds_gen { - u16 command; - u16 size; - u16 seq_num; - u16 result; -}; - -#define S_DS_GEN sizeof(struct host_cmd_ds_gen) - -enum sleep_resp_ctrl { - RESP_NOT_NEEDED = 0, - RESP_NEEDED, -}; - -struct mwifiex_ps_param { - __le16 null_pkt_interval; - __le16 multiple_dtims; - __le16 bcn_miss_timeout; - __le16 local_listen_interval; - __le16 adhoc_wake_period; - __le16 mode; - __le16 delay_to_ps; -}; - -#define BITMAP_AUTO_DS 0x01 -#define BITMAP_STA_PS 0x10 - -struct mwifiex_ie_types_auto_ds_param { - struct mwifiex_ie_types_header header; - __le16 deep_sleep_timeout; -} __packed; - -struct mwifiex_ie_types_ps_param { - struct mwifiex_ie_types_header header; - struct mwifiex_ps_param param; -} __packed; - -struct host_cmd_ds_802_11_ps_mode_enh { - __le16 action; - - union { - struct mwifiex_ps_param opt_ps; - __le16 ps_bitmap; - } params; -} __packed; - -struct host_cmd_ds_get_hw_spec { - __le16 hw_if_version; - __le16 version; - __le16 reserved; - __le16 num_of_mcast_adr; - u8 permanent_addr[ETH_ALEN]; - __le16 region_code; - __le16 number_of_antenna; - __le32 fw_release_number; - __le32 reserved_1; - __le32 reserved_2; - __le32 reserved_3; - __le32 fw_cap_info; - __le32 dot_11n_dev_cap; - u8 dev_mcs_support; - __le16 mp_end_port; /* SDIO only, reserved for other interfacces */ - __le16 mgmt_buf_count; /* mgmt IE buffer count */ - __le32 reserved_5; - __le32 reserved_6; - __le32 dot_11ac_dev_cap; - __le32 dot_11ac_mcs_support; -} __packed; - -struct host_cmd_ds_802_11_rssi_info { - __le16 action; - __le16 ndata; - __le16 nbcn; - __le16 reserved[9]; - long long reserved_1; -}; - -struct host_cmd_ds_802_11_rssi_info_rsp { - __le16 action; - __le16 ndata; - __le16 nbcn; - __le16 data_rssi_last; - __le16 data_nf_last; - __le16 data_rssi_avg; - __le16 data_nf_avg; - __le16 bcn_rssi_last; - __le16 bcn_nf_last; - __le16 bcn_rssi_avg; - __le16 bcn_nf_avg; - long long tsf_bcn; -}; - -struct host_cmd_ds_802_11_mac_address { - __le16 action; - u8 mac_addr[ETH_ALEN]; -}; - -struct host_cmd_ds_mac_control { - __le16 action; - __le16 reserved; -}; - -struct host_cmd_ds_mac_multicast_adr { - __le16 action; - __le16 num_of_adrs; - u8 mac_list[MWIFIEX_MAX_MULTICAST_LIST_SIZE][ETH_ALEN]; -} __packed; - -struct host_cmd_ds_802_11_deauthenticate { - u8 mac_addr[ETH_ALEN]; - __le16 reason_code; -} __packed; - -struct host_cmd_ds_802_11_associate { - u8 peer_sta_addr[ETH_ALEN]; - __le16 cap_info_bitmap; - __le16 listen_interval; - __le16 beacon_period; - u8 dtim_period; -} __packed; - -struct ieee_types_assoc_rsp { - __le16 cap_info_bitmap; - __le16 status_code; - __le16 a_id; - u8 ie_buffer[1]; -} __packed; - -struct host_cmd_ds_802_11_associate_rsp { - struct ieee_types_assoc_rsp assoc_rsp; -} __packed; - -struct ieee_types_cf_param_set { - u8 element_id; - u8 len; - u8 cfp_cnt; - u8 cfp_period; - u16 cfp_max_duration; - u16 cfp_duration_remaining; -} __packed; - -struct ieee_types_ibss_param_set { - u8 element_id; - u8 len; - __le16 atim_window; -} __packed; - -union ieee_types_ss_param_set { - struct ieee_types_cf_param_set cf_param_set; - struct ieee_types_ibss_param_set ibss_param_set; -} __packed; - -struct ieee_types_fh_param_set { - u8 element_id; - u8 len; - __le16 dwell_time; - u8 hop_set; - u8 hop_pattern; - u8 hop_index; -} __packed; - -struct ieee_types_ds_param_set { - u8 element_id; - u8 len; - u8 current_chan; -} __packed; - -union ieee_types_phy_param_set { - struct ieee_types_fh_param_set fh_param_set; - struct ieee_types_ds_param_set ds_param_set; -} __packed; - -struct ieee_types_oper_mode_ntf { - u8 element_id; - u8 len; - u8 oper_mode; -} __packed; - -struct host_cmd_ds_802_11_ad_hoc_start { - u8 ssid[IEEE80211_MAX_SSID_LEN]; - u8 bss_mode; - __le16 beacon_period; - u8 dtim_period; - union ieee_types_ss_param_set ss_param_set; - union ieee_types_phy_param_set phy_param_set; - u16 reserved1; - __le16 cap_info_bitmap; - u8 data_rate[HOSTCMD_SUPPORTED_RATES]; -} __packed; - -struct host_cmd_ds_802_11_ad_hoc_result { - u8 pad[3]; - u8 bssid[ETH_ALEN]; -} __packed; - -struct adhoc_bss_desc { - u8 bssid[ETH_ALEN]; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - u8 bss_mode; - __le16 beacon_period; - u8 dtim_period; - u8 time_stamp[8]; - u8 local_time[8]; - union ieee_types_phy_param_set phy_param_set; - union ieee_types_ss_param_set ss_param_set; - __le16 cap_info_bitmap; - u8 data_rates[HOSTCMD_SUPPORTED_RATES]; - - /* - * DO NOT ADD ANY FIELDS TO THIS STRUCTURE. - * It is used in the Adhoc join command and will cause a - * binary layout mismatch with the firmware - */ -} __packed; - -struct host_cmd_ds_802_11_ad_hoc_join { - struct adhoc_bss_desc bss_descriptor; - u16 reserved1; - u16 reserved2; -} __packed; - -struct host_cmd_ds_802_11_get_log { - __le32 mcast_tx_frame; - __le32 failed; - __le32 retry; - __le32 multi_retry; - __le32 frame_dup; - __le32 rts_success; - __le32 rts_failure; - __le32 ack_failure; - __le32 rx_frag; - __le32 mcast_rx_frame; - __le32 fcs_error; - __le32 tx_frame; - __le32 reserved; - __le32 wep_icv_err_cnt[4]; -}; - -/* Enumeration for rate format */ -enum _mwifiex_rate_format { - MWIFIEX_RATE_FORMAT_LG = 0, - MWIFIEX_RATE_FORMAT_HT, - MWIFIEX_RATE_FORMAT_VHT, - MWIFIEX_RATE_FORMAT_AUTO = 0xFF, -}; - -struct host_cmd_ds_tx_rate_query { - u8 tx_rate; - /* Tx Rate Info: For 802.11 AC cards - * - * [Bit 0-1] tx rate formate: LG = 0, HT = 1, VHT = 2 - * [Bit 2-3] HT/VHT Bandwidth: BW20 = 0, BW40 = 1, BW80 = 2, BW160 = 3 - * [Bit 4] HT/VHT Guard Interval: LGI = 0, SGI = 1 - * - * For non-802.11 AC cards - * Ht Info [Bit 0] RxRate format: LG=0, HT=1 - * [Bit 1] HT Bandwidth: BW20 = 0, BW40 = 1 - * [Bit 2] HT Guard Interval: LGI = 0, SGI = 1 - */ - u8 ht_info; -} __packed; - -enum Host_Sleep_Action { - HS_CONFIGURE = 0x0001, - HS_ACTIVATE = 0x0002, -}; - -struct mwifiex_hs_config_param { - __le32 conditions; - u8 gpio; - u8 gap; -} __packed; - -struct hs_activate_param { - u16 resp_ctrl; -} __packed; - -struct host_cmd_ds_802_11_hs_cfg_enh { - __le16 action; - - union { - struct mwifiex_hs_config_param hs_config; - struct hs_activate_param hs_activate; - } params; -} __packed; - -enum SNMP_MIB_INDEX { - OP_RATE_SET_I = 1, - DTIM_PERIOD_I = 3, - RTS_THRESH_I = 5, - SHORT_RETRY_LIM_I = 6, - LONG_RETRY_LIM_I = 7, - FRAG_THRESH_I = 8, - DOT11D_I = 9, -}; - -#define MAX_SNMP_BUF_SIZE 128 - -struct host_cmd_ds_802_11_snmp_mib { - __le16 query_type; - __le16 oid; - __le16 buf_size; - u8 value[1]; -} __packed; - -struct mwifiex_rate_scope { - __le16 type; - __le16 length; - __le16 hr_dsss_rate_bitmap; - __le16 ofdm_rate_bitmap; - __le16 ht_mcs_rate_bitmap[8]; -} __packed; - -struct mwifiex_rate_drop_pattern { - __le16 type; - __le16 length; - __le32 rate_drop_mode; -} __packed; - -struct host_cmd_ds_tx_rate_cfg { - __le16 action; - __le16 cfg_index; -} __packed; - -struct mwifiex_power_group { - u8 modulation_class; - u8 first_rate_code; - u8 last_rate_code; - s8 power_step; - s8 power_min; - s8 power_max; - u8 ht_bandwidth; - u8 reserved; -} __packed; - -struct mwifiex_types_power_group { - u16 type; - u16 length; -} __packed; - -struct host_cmd_ds_txpwr_cfg { - __le16 action; - __le16 cfg_index; - __le32 mode; -} __packed; - -struct host_cmd_ds_rf_tx_pwr { - __le16 action; - __le16 cur_level; - u8 max_power; - u8 min_power; -} __packed; - -struct host_cmd_ds_rf_ant_mimo { - __le16 action_tx; - __le16 tx_ant_mode; - __le16 action_rx; - __le16 rx_ant_mode; -}; - -struct host_cmd_ds_rf_ant_siso { - __le16 action; - __le16 ant_mode; -}; - -struct mwifiex_bcn_param { - u8 bssid[ETH_ALEN]; - u8 rssi; - __le64 timestamp; - __le16 beacon_period; - __le16 cap_info_bitmap; -} __packed; - -#define MWIFIEX_USER_SCAN_CHAN_MAX 50 - -#define MWIFIEX_MAX_SSID_LIST_LENGTH 10 - -struct mwifiex_scan_cmd_config { - /* - * BSS mode to be sent in the firmware command - */ - u8 bss_mode; - - /* Specific BSSID used to filter scan results in the firmware */ - u8 specific_bssid[ETH_ALEN]; - - /* Length of TLVs sent in command starting at tlvBuffer */ - u32 tlv_buf_len; - - /* - * SSID TLV(s) and ChanList TLVs to be sent in the firmware command - * - * TLV_TYPE_CHANLIST, mwifiex_ie_types_chan_list_param_set - * WLAN_EID_SSID, mwifiex_ie_types_ssid_param_set - */ - u8 tlv_buf[1]; /* SSID TLV(s) and ChanList TLVs are stored - here */ -} __packed; - -struct mwifiex_user_scan_chan { - u8 chan_number; - u8 radio_type; - u8 scan_type; - u8 reserved; - u32 scan_time; -} __packed; - -struct mwifiex_user_scan_cfg { - /* - * BSS mode to be sent in the firmware command - */ - u8 bss_mode; - /* Configure the number of probe requests for active chan scans */ - u8 num_probes; - u8 reserved; - /* BSSID filter sent in the firmware command to limit the results */ - u8 specific_bssid[ETH_ALEN]; - /* SSID filter list used in the firmware to limit the scan results */ - struct cfg80211_ssid *ssid_list; - u8 num_ssids; - /* Variable number (fixed maximum) of channels to scan up */ - struct mwifiex_user_scan_chan chan_list[MWIFIEX_USER_SCAN_CHAN_MAX]; -} __packed; - -struct ie_body { - u8 grp_key_oui[4]; - u8 ptk_cnt[2]; - u8 ptk_body[4]; -} __packed; - -struct host_cmd_ds_802_11_scan { - u8 bss_mode; - u8 bssid[ETH_ALEN]; - u8 tlv_buffer[1]; -} __packed; - -struct host_cmd_ds_802_11_scan_rsp { - __le16 bss_descript_size; - u8 number_of_sets; - u8 bss_desc_and_tlv_buffer[1]; -} __packed; - -struct host_cmd_ds_802_11_bg_scan_query { - u8 flush; -} __packed; - -struct host_cmd_ds_802_11_bg_scan_query_rsp { - u32 report_condition; - struct host_cmd_ds_802_11_scan_rsp scan_resp; -} __packed; - -struct mwifiex_ietypes_domain_param_set { - struct mwifiex_ie_types_header header; - u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; - struct ieee80211_country_ie_triplet triplet[1]; -} __packed; - -struct host_cmd_ds_802_11d_domain_info { - __le16 action; - struct mwifiex_ietypes_domain_param_set domain; -} __packed; - -struct host_cmd_ds_802_11d_domain_info_rsp { - __le16 action; - struct mwifiex_ietypes_domain_param_set domain; -} __packed; - -struct host_cmd_ds_11n_addba_req { - u8 add_req_result; - u8 peer_mac_addr[ETH_ALEN]; - u8 dialog_token; - __le16 block_ack_param_set; - __le16 block_ack_tmo; - __le16 ssn; -} __packed; - -struct host_cmd_ds_11n_addba_rsp { - u8 add_rsp_result; - u8 peer_mac_addr[ETH_ALEN]; - u8 dialog_token; - __le16 status_code; - __le16 block_ack_param_set; - __le16 block_ack_tmo; - __le16 ssn; -} __packed; - -struct host_cmd_ds_11n_delba { - u8 del_result; - u8 peer_mac_addr[ETH_ALEN]; - __le16 del_ba_param_set; - __le16 reason_code; - u8 reserved; -} __packed; - -struct host_cmd_ds_11n_batimeout { - u8 tid; - u8 peer_mac_addr[ETH_ALEN]; - u8 origninator; -} __packed; - -struct host_cmd_ds_11n_cfg { - __le16 action; - __le16 ht_tx_cap; - __le16 ht_tx_info; - __le16 misc_config; /* Needed for 802.11AC cards only */ -} __packed; - -struct host_cmd_ds_txbuf_cfg { - __le16 action; - __le16 buff_size; - __le16 mp_end_port; /* SDIO only, reserved for other interfacces */ - __le16 reserved3; -} __packed; - -struct host_cmd_ds_amsdu_aggr_ctrl { - __le16 action; - __le16 enable; - __le16 curr_buf_size; -} __packed; - -struct mwifiex_ie_types_wmm_param_set { - struct mwifiex_ie_types_header header; - u8 wmm_ie[1]; -}; - -struct mwifiex_ie_types_wmm_queue_status { - struct mwifiex_ie_types_header header; - u8 queue_index; - u8 disabled; - u16 medium_time; - u8 flow_required; - u8 flow_created; - u32 reserved; -}; - -struct ieee_types_vendor_header { - u8 element_id; - u8 len; - u8 oui[4]; /* 0~2: oui, 3: oui_type */ - u8 oui_subtype; - u8 version; -} __packed; - -struct ieee_types_wmm_parameter { - /* - * WMM Parameter IE - Vendor Specific Header: - * element_id [221/0xdd] - * Len [24] - * Oui [00:50:f2] - * OuiType [2] - * OuiSubType [1] - * Version [1] - */ - struct ieee_types_vendor_header vend_hdr; - u8 qos_info_bitmap; - u8 reserved; - struct ieee_types_wmm_ac_parameters ac_params[IEEE80211_NUM_ACS]; -} __packed; - -struct ieee_types_wmm_info { - - /* - * WMM Info IE - Vendor Specific Header: - * element_id [221/0xdd] - * Len [7] - * Oui [00:50:f2] - * OuiType [2] - * OuiSubType [0] - * Version [1] - */ - struct ieee_types_vendor_header vend_hdr; - - u8 qos_info_bitmap; -} __packed; - -struct host_cmd_ds_wmm_get_status { - u8 queue_status_tlv[sizeof(struct mwifiex_ie_types_wmm_queue_status) * - IEEE80211_NUM_ACS]; - u8 wmm_param_tlv[sizeof(struct ieee_types_wmm_parameter) + 2]; -} __packed; - -struct mwifiex_wmm_ac_status { - u8 disabled; - u8 flow_required; - u8 flow_created; -}; - -struct mwifiex_ie_types_htcap { - struct mwifiex_ie_types_header header; - struct ieee80211_ht_cap ht_cap; -} __packed; - -struct mwifiex_ie_types_vhtcap { - struct mwifiex_ie_types_header header; - struct ieee80211_vht_cap vht_cap; -} __packed; - -struct mwifiex_ie_types_oper_mode_ntf { - struct mwifiex_ie_types_header header; - u8 oper_mode; -} __packed; - -/* VHT Operations IE */ -struct mwifiex_ie_types_vht_oper { - struct mwifiex_ie_types_header header; - u8 chan_width; - u8 chan_center_freq_1; - u8 chan_center_freq_2; - /* Basic MCS set map, each 2 bits stands for a NSS */ - u16 basic_mcs_map; -} __packed; - -struct mwifiex_ie_types_wmmcap { - struct mwifiex_ie_types_header header; - struct mwifiex_types_wmm_info wmm_info; -} __packed; - -struct mwifiex_ie_types_htinfo { - struct mwifiex_ie_types_header header; - struct ieee80211_ht_operation ht_oper; -} __packed; - -struct mwifiex_ie_types_2040bssco { - struct mwifiex_ie_types_header header; - u8 bss_co_2040; -} __packed; - -struct mwifiex_ie_types_extcap { - struct mwifiex_ie_types_header header; - u8 ext_cap; -} __packed; - -struct host_cmd_ds_mac_reg_access { - __le16 action; - __le16 offset; - __le32 value; -} __packed; - -struct host_cmd_ds_bbp_reg_access { - __le16 action; - __le16 offset; - u8 value; - u8 reserved[3]; -} __packed; - -struct host_cmd_ds_rf_reg_access { - __le16 action; - __le16 offset; - u8 value; - u8 reserved[3]; -} __packed; - -struct host_cmd_ds_pmic_reg_access { - __le16 action; - __le16 offset; - u8 value; - u8 reserved[3]; -} __packed; - -struct host_cmd_ds_802_11_eeprom_access { - __le16 action; - - __le16 offset; - __le16 byte_count; - u8 value; -} __packed; - -struct host_cmd_tlv { - __le16 type; - __le16 len; -} __packed; - -struct mwifiex_assoc_event { - u8 sta_addr[ETH_ALEN]; - __le16 type; - __le16 len; - __le16 frame_control; - __le16 cap_info; - __le16 listen_interval; - u8 data[0]; -} __packed; - -struct host_cmd_ds_sys_config { - __le16 action; - u8 tlv[0]; -}; - -struct host_cmd_11ac_vht_cfg { - __le16 action; - u8 band_config; - u8 misc_config; - __le32 cap_info; - __le32 mcs_tx_set; - __le32 mcs_rx_set; -} __packed; - -struct host_cmd_tlv_akmp { - struct host_cmd_tlv tlv; - __le16 key_mgmt; - __le16 key_mgmt_operation; -} __packed; - -struct host_cmd_tlv_pwk_cipher { - struct host_cmd_tlv tlv; - __le16 proto; - u8 cipher; - u8 reserved; -} __packed; - -struct host_cmd_tlv_gwk_cipher { - struct host_cmd_tlv tlv; - u8 cipher; - u8 reserved; -} __packed; - -struct host_cmd_tlv_passphrase { - struct host_cmd_tlv tlv; - u8 passphrase[0]; -} __packed; - -struct host_cmd_tlv_wep_key { - struct host_cmd_tlv tlv; - u8 key_index; - u8 is_default; - u8 key[1]; -}; - -struct host_cmd_tlv_auth_type { - struct host_cmd_tlv tlv; - u8 auth_type; -} __packed; - -struct host_cmd_tlv_encrypt_protocol { - struct host_cmd_tlv tlv; - __le16 proto; -} __packed; - -struct host_cmd_tlv_ssid { - struct host_cmd_tlv tlv; - u8 ssid[0]; -} __packed; - -struct host_cmd_tlv_rates { - struct host_cmd_tlv tlv; - u8 rates[0]; -} __packed; - -struct host_cmd_tlv_bcast_ssid { - struct host_cmd_tlv tlv; - u8 bcast_ctl; -} __packed; - -struct host_cmd_tlv_beacon_period { - struct host_cmd_tlv tlv; - __le16 period; -} __packed; - -struct host_cmd_tlv_dtim_period { - struct host_cmd_tlv tlv; - u8 period; -} __packed; - -struct host_cmd_tlv_frag_threshold { - struct host_cmd_tlv tlv; - __le16 frag_thr; -} __packed; - -struct host_cmd_tlv_rts_threshold { - struct host_cmd_tlv tlv; - __le16 rts_thr; -} __packed; - -struct host_cmd_tlv_retry_limit { - struct host_cmd_tlv tlv; - u8 limit; -} __packed; - -struct host_cmd_tlv_mac_addr { - struct host_cmd_tlv tlv; - u8 mac_addr[ETH_ALEN]; -} __packed; - -struct host_cmd_tlv_channel_band { - struct host_cmd_tlv tlv; - u8 band_config; - u8 channel; -} __packed; - -struct host_cmd_tlv_ageout_timer { - struct host_cmd_tlv tlv; - __le32 sta_ao_timer; -} __packed; - -struct host_cmd_ds_version_ext { - u8 version_str_sel; - char version_str[128]; -} __packed; - -struct host_cmd_ds_mgmt_frame_reg { - __le16 action; - __le32 mask; -} __packed; - -struct host_cmd_ds_p2p_mode_cfg { - __le16 action; - __le16 mode; -} __packed; - -struct host_cmd_ds_remain_on_chan { - __le16 action; - u8 status; - u8 reserved; - u8 band_cfg; - u8 channel; - __le32 duration; -} __packed; - -struct host_cmd_ds_802_11_ibss_status { - __le16 action; - __le16 enable; - u8 bssid[ETH_ALEN]; - __le16 beacon_interval; - __le16 atim_window; - __le16 use_g_rate_protect; -} __packed; - -struct mwifiex_fw_mef_entry { - u8 mode; - u8 action; - __le16 exprsize; - u8 expr[0]; -} __packed; - -struct host_cmd_ds_mef_cfg { - __le32 criteria; - __le16 num_entries; - struct mwifiex_fw_mef_entry mef_entry[0]; -} __packed; - -#define CONNECTION_TYPE_INFRA 0 -#define CONNECTION_TYPE_ADHOC 1 -#define CONNECTION_TYPE_AP 2 - -struct host_cmd_ds_set_bss_mode { - u8 con_type; -} __packed; - -struct host_cmd_ds_pcie_details { - /* TX buffer descriptor ring address */ - u32 txbd_addr_lo; - u32 txbd_addr_hi; - /* TX buffer descriptor ring count */ - u32 txbd_count; - - /* RX buffer descriptor ring address */ - u32 rxbd_addr_lo; - u32 rxbd_addr_hi; - /* RX buffer descriptor ring count */ - u32 rxbd_count; - - /* Event buffer descriptor ring address */ - u32 evtbd_addr_lo; - u32 evtbd_addr_hi; - /* Event buffer descriptor ring count */ - u32 evtbd_count; - - /* Sleep cookie buffer physical address */ - u32 sleep_cookie_addr_lo; - u32 sleep_cookie_addr_hi; -} __packed; - -struct mwifiex_ie_types_rssi_threshold { - struct mwifiex_ie_types_header header; - u8 abs_value; - u8 evt_freq; -} __packed; - -struct host_cmd_ds_802_11_subsc_evt { - __le16 action; - __le16 events; -} __packed; - -struct mwifiex_ie { - __le16 ie_index; - __le16 mgmt_subtype_mask; - __le16 ie_length; - u8 ie_buffer[IEEE_MAX_IE_SIZE]; -} __packed; - -#define MAX_MGMT_IE_INDEX 16 -struct mwifiex_ie_list { - __le16 type; - __le16 len; - struct mwifiex_ie ie_list[MAX_MGMT_IE_INDEX]; -} __packed; - -struct host_cmd_ds_command { - __le16 command; - __le16 size; - __le16 seq_num; - __le16 result; - union { - struct host_cmd_ds_get_hw_spec hw_spec; - struct host_cmd_ds_mac_control mac_ctrl; - struct host_cmd_ds_802_11_mac_address mac_addr; - struct host_cmd_ds_mac_multicast_adr mc_addr; - struct host_cmd_ds_802_11_get_log get_log; - struct host_cmd_ds_802_11_rssi_info rssi_info; - struct host_cmd_ds_802_11_rssi_info_rsp rssi_info_rsp; - struct host_cmd_ds_802_11_snmp_mib smib; - struct host_cmd_ds_tx_rate_query tx_rate; - struct host_cmd_ds_tx_rate_cfg tx_rate_cfg; - struct host_cmd_ds_txpwr_cfg txp_cfg; - struct host_cmd_ds_rf_tx_pwr txp; - struct host_cmd_ds_rf_ant_mimo ant_mimo; - struct host_cmd_ds_rf_ant_siso ant_siso; - struct host_cmd_ds_802_11_ps_mode_enh psmode_enh; - struct host_cmd_ds_802_11_hs_cfg_enh opt_hs_cfg; - struct host_cmd_ds_802_11_scan scan; - struct host_cmd_ds_802_11_scan_rsp scan_resp; - struct host_cmd_ds_802_11_bg_scan_query bg_scan_query; - struct host_cmd_ds_802_11_bg_scan_query_rsp bg_scan_query_resp; - struct host_cmd_ds_802_11_associate associate; - struct host_cmd_ds_802_11_associate_rsp associate_rsp; - struct host_cmd_ds_802_11_deauthenticate deauth; - struct host_cmd_ds_802_11_ad_hoc_start adhoc_start; - struct host_cmd_ds_802_11_ad_hoc_result adhoc_result; - struct host_cmd_ds_802_11_ad_hoc_join adhoc_join; - struct host_cmd_ds_802_11d_domain_info domain_info; - struct host_cmd_ds_802_11d_domain_info_rsp domain_info_resp; - struct host_cmd_ds_11n_addba_req add_ba_req; - struct host_cmd_ds_11n_addba_rsp add_ba_rsp; - struct host_cmd_ds_11n_delba del_ba; - struct host_cmd_ds_txbuf_cfg tx_buf; - struct host_cmd_ds_amsdu_aggr_ctrl amsdu_aggr_ctrl; - struct host_cmd_ds_11n_cfg htcfg; - struct host_cmd_ds_wmm_get_status get_wmm_status; - struct host_cmd_ds_802_11_key_material key_material; - struct host_cmd_ds_version_ext verext; - struct host_cmd_ds_mgmt_frame_reg reg_mask; - struct host_cmd_ds_remain_on_chan roc_cfg; - struct host_cmd_ds_p2p_mode_cfg mode_cfg; - struct host_cmd_ds_802_11_ibss_status ibss_coalescing; - struct host_cmd_ds_mef_cfg mef_cfg; - struct host_cmd_ds_mac_reg_access mac_reg; - struct host_cmd_ds_bbp_reg_access bbp_reg; - struct host_cmd_ds_rf_reg_access rf_reg; - struct host_cmd_ds_pmic_reg_access pmic_reg; - struct host_cmd_ds_set_bss_mode bss_mode; - struct host_cmd_ds_pcie_details pcie_host_spec; - struct host_cmd_ds_802_11_eeprom_access eeprom; - struct host_cmd_ds_802_11_subsc_evt subsc_evt; - struct host_cmd_ds_sys_config uap_sys_config; - struct host_cmd_11ac_vht_cfg vht_cfg; - } params; -} __packed; - -struct mwifiex_opt_sleep_confirm { - __le16 command; - __le16 size; - __le16 seq_num; - __le16 result; - __le16 action; - __le16 resp_ctrl; -} __packed; -#endif /* !_MWIFIEX_FW_H_ */ diff --git a/drivers/net/wireless/mwifiex/ie.c b/drivers/net/wireless/mwifiex/ie.c deleted file mode 100644 index e38342f86c51..000000000000 --- a/drivers/net/wireless/mwifiex/ie.c +++ /dev/null @@ -1,443 +0,0 @@ -/* - * Marvell Wireless LAN device driver: management IE handling- setting and - * deleting IE. - * - * Copyright (C) 2012, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "main.h" - -/* This function checks if current IE index is used by any on other interface. - * Return: -1: yes, current IE index is used by someone else. - * 0: no, current IE index is NOT used by other interface. - */ -static int -mwifiex_ie_index_used_by_other_intf(struct mwifiex_private *priv, u16 idx) -{ - int i; - struct mwifiex_adapter *adapter = priv->adapter; - struct mwifiex_ie *ie; - - for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i] != priv) { - ie = &adapter->priv[i]->mgmt_ie[idx]; - if (ie->mgmt_subtype_mask && ie->ie_length) - return -1; - } - } - - return 0; -} - -/* Get unused IE index. This index will be used for setting new IE */ -static int -mwifiex_ie_get_autoidx(struct mwifiex_private *priv, u16 subtype_mask, - struct mwifiex_ie *ie, u16 *index) -{ - u16 mask, len, i; - - for (i = 0; i < priv->adapter->max_mgmt_ie_index; i++) { - mask = le16_to_cpu(priv->mgmt_ie[i].mgmt_subtype_mask); - len = le16_to_cpu(ie->ie_length); - - if (mask == MWIFIEX_AUTO_IDX_MASK) - continue; - - if (mask == subtype_mask) { - if (len > IEEE_MAX_IE_SIZE) - continue; - - *index = i; - return 0; - } - - if (!priv->mgmt_ie[i].ie_length) { - if (mwifiex_ie_index_used_by_other_intf(priv, i)) - continue; - - *index = i; - return 0; - } - } - - return -1; -} - -/* This function prepares IE data buffer for command to be sent to FW */ -static int -mwifiex_update_autoindex_ies(struct mwifiex_private *priv, - struct mwifiex_ie_list *ie_list) -{ - u16 travel_len, index, mask; - s16 input_len; - struct mwifiex_ie *ie; - u8 *tmp; - - input_len = le16_to_cpu(ie_list->len); - travel_len = sizeof(struct host_cmd_tlv); - - ie_list->len = 0; - - while (input_len > 0) { - ie = (struct mwifiex_ie *)(((u8 *)ie_list) + travel_len); - input_len -= le16_to_cpu(ie->ie_length) + MWIFIEX_IE_HDR_SIZE; - travel_len += le16_to_cpu(ie->ie_length) + MWIFIEX_IE_HDR_SIZE; - - index = le16_to_cpu(ie->ie_index); - mask = le16_to_cpu(ie->mgmt_subtype_mask); - - if (index == MWIFIEX_AUTO_IDX_MASK) { - /* automatic addition */ - if (mwifiex_ie_get_autoidx(priv, mask, ie, &index)) - return -1; - if (index == MWIFIEX_AUTO_IDX_MASK) - return -1; - - tmp = (u8 *)&priv->mgmt_ie[index].ie_buffer; - memcpy(tmp, &ie->ie_buffer, le16_to_cpu(ie->ie_length)); - priv->mgmt_ie[index].ie_length = ie->ie_length; - priv->mgmt_ie[index].ie_index = cpu_to_le16(index); - priv->mgmt_ie[index].mgmt_subtype_mask = - cpu_to_le16(mask); - - ie->ie_index = cpu_to_le16(index); - } else { - if (mask != MWIFIEX_DELETE_MASK) - return -1; - /* - * Check if this index is being used on any - * other interface. - */ - if (mwifiex_ie_index_used_by_other_intf(priv, index)) - return -1; - - ie->ie_length = 0; - memcpy(&priv->mgmt_ie[index], ie, - sizeof(struct mwifiex_ie)); - } - - le16_add_cpu(&ie_list->len, - le16_to_cpu(priv->mgmt_ie[index].ie_length) + - MWIFIEX_IE_HDR_SIZE); - } - - if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) - return mwifiex_send_cmd_async(priv, HostCmd_CMD_UAP_SYS_CONFIG, - HostCmd_ACT_GEN_SET, - UAP_CUSTOM_IE_I, ie_list); - - return 0; -} - -/* Copy individual custom IEs for beacon, probe response and assoc response - * and prepare single structure for IE setting. - * This function also updates allocated IE indices from driver. - */ -static int -mwifiex_update_uap_custom_ie(struct mwifiex_private *priv, - struct mwifiex_ie *beacon_ie, u16 *beacon_idx, - struct mwifiex_ie *pr_ie, u16 *probe_idx, - struct mwifiex_ie *ar_ie, u16 *assoc_idx) -{ - struct mwifiex_ie_list *ap_custom_ie; - u8 *pos; - u16 len; - int ret; - - ap_custom_ie = kzalloc(sizeof(*ap_custom_ie), GFP_KERNEL); - if (!ap_custom_ie) - return -ENOMEM; - - ap_custom_ie->type = cpu_to_le16(TLV_TYPE_MGMT_IE); - pos = (u8 *)ap_custom_ie->ie_list; - - if (beacon_ie) { - len = sizeof(struct mwifiex_ie) - IEEE_MAX_IE_SIZE + - le16_to_cpu(beacon_ie->ie_length); - memcpy(pos, beacon_ie, len); - pos += len; - le16_add_cpu(&ap_custom_ie->len, len); - } - if (pr_ie) { - len = sizeof(struct mwifiex_ie) - IEEE_MAX_IE_SIZE + - le16_to_cpu(pr_ie->ie_length); - memcpy(pos, pr_ie, len); - pos += len; - le16_add_cpu(&ap_custom_ie->len, len); - } - if (ar_ie) { - len = sizeof(struct mwifiex_ie) - IEEE_MAX_IE_SIZE + - le16_to_cpu(ar_ie->ie_length); - memcpy(pos, ar_ie, len); - pos += len; - le16_add_cpu(&ap_custom_ie->len, len); - } - - ret = mwifiex_update_autoindex_ies(priv, ap_custom_ie); - - pos = (u8 *)(&ap_custom_ie->ie_list[0].ie_index); - if (beacon_ie && *beacon_idx == MWIFIEX_AUTO_IDX_MASK) { - /* save beacon ie index after auto-indexing */ - *beacon_idx = le16_to_cpu(ap_custom_ie->ie_list[0].ie_index); - len = sizeof(*beacon_ie) - IEEE_MAX_IE_SIZE + - le16_to_cpu(beacon_ie->ie_length); - pos += len; - } - if (pr_ie && le16_to_cpu(pr_ie->ie_index) == MWIFIEX_AUTO_IDX_MASK) { - /* save probe resp ie index after auto-indexing */ - *probe_idx = *((u16 *)pos); - len = sizeof(*pr_ie) - IEEE_MAX_IE_SIZE + - le16_to_cpu(pr_ie->ie_length); - pos += len; - } - if (ar_ie && le16_to_cpu(ar_ie->ie_index) == MWIFIEX_AUTO_IDX_MASK) - /* save assoc resp ie index after auto-indexing */ - *assoc_idx = *((u16 *)pos); - - kfree(ap_custom_ie); - return ret; -} - -/* This function checks if the vendor specified IE is present in passed buffer - * and copies it to mwifiex_ie structure. - * Function takes pointer to struct mwifiex_ie pointer as argument. - * If the vendor specified IE is present then memory is allocated for - * mwifiex_ie pointer and filled in with IE. Caller should take care of freeing - * this memory. - */ -static int mwifiex_update_vs_ie(const u8 *ies, int ies_len, - struct mwifiex_ie **ie_ptr, u16 mask, - unsigned int oui, u8 oui_type) -{ - struct ieee_types_header *vs_ie; - struct mwifiex_ie *ie = *ie_ptr; - const u8 *vendor_ie; - - vendor_ie = cfg80211_find_vendor_ie(oui, oui_type, ies, ies_len); - if (vendor_ie) { - if (!*ie_ptr) { - *ie_ptr = kzalloc(sizeof(struct mwifiex_ie), - GFP_KERNEL); - if (!*ie_ptr) - return -ENOMEM; - ie = *ie_ptr; - } - - vs_ie = (struct ieee_types_header *)vendor_ie; - memcpy(ie->ie_buffer + le16_to_cpu(ie->ie_length), - vs_ie, vs_ie->len + 2); - le16_add_cpu(&ie->ie_length, vs_ie->len + 2); - ie->mgmt_subtype_mask = cpu_to_le16(mask); - ie->ie_index = cpu_to_le16(MWIFIEX_AUTO_IDX_MASK); - } - - *ie_ptr = ie; - return 0; -} - -/* This function parses beacon IEs, probe response IEs, association response IEs - * from cfg80211_ap_settings->beacon and sets these IE to FW. - */ -static int mwifiex_set_mgmt_beacon_data_ies(struct mwifiex_private *priv, - struct cfg80211_beacon_data *data) -{ - struct mwifiex_ie *beacon_ie = NULL, *pr_ie = NULL, *ar_ie = NULL; - u16 beacon_idx = MWIFIEX_AUTO_IDX_MASK, pr_idx = MWIFIEX_AUTO_IDX_MASK; - u16 ar_idx = MWIFIEX_AUTO_IDX_MASK; - int ret = 0; - - if (data->beacon_ies && data->beacon_ies_len) { - mwifiex_update_vs_ie(data->beacon_ies, data->beacon_ies_len, - &beacon_ie, MGMT_MASK_BEACON, - WLAN_OUI_MICROSOFT, - WLAN_OUI_TYPE_MICROSOFT_WPS); - mwifiex_update_vs_ie(data->beacon_ies, data->beacon_ies_len, - &beacon_ie, MGMT_MASK_BEACON, - WLAN_OUI_WFA, WLAN_OUI_TYPE_WFA_P2P); - } - - if (data->proberesp_ies && data->proberesp_ies_len) { - mwifiex_update_vs_ie(data->proberesp_ies, - data->proberesp_ies_len, &pr_ie, - MGMT_MASK_PROBE_RESP, WLAN_OUI_MICROSOFT, - WLAN_OUI_TYPE_MICROSOFT_WPS); - mwifiex_update_vs_ie(data->proberesp_ies, - data->proberesp_ies_len, &pr_ie, - MGMT_MASK_PROBE_RESP, - WLAN_OUI_WFA, WLAN_OUI_TYPE_WFA_P2P); - } - - if (data->assocresp_ies && data->assocresp_ies_len) { - mwifiex_update_vs_ie(data->assocresp_ies, - data->assocresp_ies_len, &ar_ie, - MGMT_MASK_ASSOC_RESP | - MGMT_MASK_REASSOC_RESP, - WLAN_OUI_MICROSOFT, - WLAN_OUI_TYPE_MICROSOFT_WPS); - mwifiex_update_vs_ie(data->assocresp_ies, - data->assocresp_ies_len, &ar_ie, - MGMT_MASK_ASSOC_RESP | - MGMT_MASK_REASSOC_RESP, WLAN_OUI_WFA, - WLAN_OUI_TYPE_WFA_P2P); - } - - if (beacon_ie || pr_ie || ar_ie) { - ret = mwifiex_update_uap_custom_ie(priv, beacon_ie, - &beacon_idx, pr_ie, - &pr_idx, ar_ie, &ar_idx); - if (ret) - goto done; - } - - priv->beacon_idx = beacon_idx; - priv->proberesp_idx = pr_idx; - priv->assocresp_idx = ar_idx; - -done: - kfree(beacon_ie); - kfree(pr_ie); - kfree(ar_ie); - - return ret; -} - -/* This function parses different IEs-tail IEs, beacon IEs, probe response IEs, - * association response IEs from cfg80211_ap_settings function and sets these IE - * to FW. - */ -int mwifiex_set_mgmt_ies(struct mwifiex_private *priv, - struct cfg80211_beacon_data *info) -{ - struct mwifiex_ie *gen_ie; - struct ieee_types_header *rsn_ie, *wpa_ie = NULL; - u16 rsn_idx = MWIFIEX_AUTO_IDX_MASK, ie_len = 0; - const u8 *vendor_ie; - - if (info->tail && info->tail_len) { - gen_ie = kzalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); - if (!gen_ie) - return -ENOMEM; - gen_ie->ie_index = cpu_to_le16(rsn_idx); - gen_ie->mgmt_subtype_mask = cpu_to_le16(MGMT_MASK_BEACON | - MGMT_MASK_PROBE_RESP | - MGMT_MASK_ASSOC_RESP); - - rsn_ie = (void *)cfg80211_find_ie(WLAN_EID_RSN, - info->tail, info->tail_len); - if (rsn_ie) { - memcpy(gen_ie->ie_buffer, rsn_ie, rsn_ie->len + 2); - ie_len = rsn_ie->len + 2; - gen_ie->ie_length = cpu_to_le16(ie_len); - } - - vendor_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT, - WLAN_OUI_TYPE_MICROSOFT_WPA, - info->tail, - info->tail_len); - if (vendor_ie) { - wpa_ie = (struct ieee_types_header *)vendor_ie; - memcpy(gen_ie->ie_buffer + ie_len, - wpa_ie, wpa_ie->len + 2); - ie_len += wpa_ie->len + 2; - gen_ie->ie_length = cpu_to_le16(ie_len); - } - - if (rsn_ie || wpa_ie) { - if (mwifiex_update_uap_custom_ie(priv, gen_ie, &rsn_idx, - NULL, NULL, - NULL, NULL)) { - kfree(gen_ie); - return -1; - } - priv->rsn_idx = rsn_idx; - } - - kfree(gen_ie); - } - - return mwifiex_set_mgmt_beacon_data_ies(priv, info); -} - -/* This function removes management IE set */ -int mwifiex_del_mgmt_ies(struct mwifiex_private *priv) -{ - struct mwifiex_ie *beacon_ie = NULL, *pr_ie = NULL; - struct mwifiex_ie *ar_ie = NULL, *rsn_ie = NULL; - int ret = 0; - - if (priv->rsn_idx != MWIFIEX_AUTO_IDX_MASK) { - rsn_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); - if (!rsn_ie) - return -ENOMEM; - - rsn_ie->ie_index = cpu_to_le16(priv->rsn_idx); - rsn_ie->mgmt_subtype_mask = cpu_to_le16(MWIFIEX_DELETE_MASK); - rsn_ie->ie_length = 0; - if (mwifiex_update_uap_custom_ie(priv, rsn_ie, &priv->rsn_idx, - NULL, &priv->proberesp_idx, - NULL, &priv->assocresp_idx)) { - ret = -1; - goto done; - } - - priv->rsn_idx = MWIFIEX_AUTO_IDX_MASK; - } - - if (priv->beacon_idx != MWIFIEX_AUTO_IDX_MASK) { - beacon_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); - if (!beacon_ie) { - ret = -ENOMEM; - goto done; - } - beacon_ie->ie_index = cpu_to_le16(priv->beacon_idx); - beacon_ie->mgmt_subtype_mask = cpu_to_le16(MWIFIEX_DELETE_MASK); - beacon_ie->ie_length = 0; - } - if (priv->proberesp_idx != MWIFIEX_AUTO_IDX_MASK) { - pr_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); - if (!pr_ie) { - ret = -ENOMEM; - goto done; - } - pr_ie->ie_index = cpu_to_le16(priv->proberesp_idx); - pr_ie->mgmt_subtype_mask = cpu_to_le16(MWIFIEX_DELETE_MASK); - pr_ie->ie_length = 0; - } - if (priv->assocresp_idx != MWIFIEX_AUTO_IDX_MASK) { - ar_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); - if (!ar_ie) { - ret = -ENOMEM; - goto done; - } - ar_ie->ie_index = cpu_to_le16(priv->assocresp_idx); - ar_ie->mgmt_subtype_mask = cpu_to_le16(MWIFIEX_DELETE_MASK); - ar_ie->ie_length = 0; - } - - if (beacon_ie || pr_ie || ar_ie) - ret = mwifiex_update_uap_custom_ie(priv, - beacon_ie, &priv->beacon_idx, - pr_ie, &priv->proberesp_idx, - ar_ie, &priv->assocresp_idx); - -done: - kfree(beacon_ie); - kfree(pr_ie); - kfree(ar_ie); - kfree(rsn_ie); - - return ret; -} diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c deleted file mode 100644 index 9f44fda19db9..000000000000 --- a/drivers/net/wireless/mwifiex/init.c +++ /dev/null @@ -1,809 +0,0 @@ -/* - * Marvell Wireless LAN device driver: HW/FW Initialization - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" -#include "11n.h" - -/* - * This function adds a BSS priority table to the table list. - * - * The function allocates a new BSS priority table node and adds it to - * the end of BSS priority table list, kept in driver memory. - */ -static int mwifiex_add_bss_prio_tbl(struct mwifiex_private *priv) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct mwifiex_bss_prio_node *bss_prio; - struct mwifiex_bss_prio_tbl *tbl = adapter->bss_prio_tbl; - unsigned long flags; - - bss_prio = kzalloc(sizeof(struct mwifiex_bss_prio_node), GFP_KERNEL); - if (!bss_prio) - return -ENOMEM; - - bss_prio->priv = priv; - INIT_LIST_HEAD(&bss_prio->list); - - spin_lock_irqsave(&tbl[priv->bss_priority].bss_prio_lock, flags); - list_add_tail(&bss_prio->list, &tbl[priv->bss_priority].bss_prio_head); - spin_unlock_irqrestore(&tbl[priv->bss_priority].bss_prio_lock, flags); - - return 0; -} - -static void scan_delay_timer_fn(unsigned long data) -{ - struct mwifiex_private *priv = (struct mwifiex_private *)data; - struct mwifiex_adapter *adapter = priv->adapter; - struct cmd_ctrl_node *cmd_node, *tmp_node; - unsigned long flags; - - if (adapter->scan_delay_cnt == MWIFIEX_MAX_SCAN_DELAY_CNT) { - /* - * Abort scan operation by cancelling all pending scan - * commands - */ - spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); - list_for_each_entry_safe(cmd_node, tmp_node, - &adapter->scan_pending_q, list) { - list_del(&cmd_node->list); - mwifiex_insert_cmd_to_free_q(adapter, cmd_node); - } - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); - - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); - adapter->scan_processing = false; - adapter->scan_delay_cnt = 0; - adapter->empty_tx_q_cnt = 0; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); - - if (priv->user_scan_cfg) { - if (priv->scan_request) { - dev_dbg(priv->adapter->dev, - "info: aborting scan\n"); - cfg80211_scan_done(priv->scan_request, 1); - priv->scan_request = NULL; - } else { - dev_dbg(priv->adapter->dev, - "info: scan already aborted\n"); - } - - kfree(priv->user_scan_cfg); - priv->user_scan_cfg = NULL; - } - goto done; - } - - if (!atomic_read(&priv->adapter->is_tx_received)) { - adapter->empty_tx_q_cnt++; - if (adapter->empty_tx_q_cnt == MWIFIEX_MAX_EMPTY_TX_Q_CNT) { - /* - * No Tx traffic for 200msec. Get scan command from - * scan pending queue and put to cmd pending queue to - * resume scan operation - */ - adapter->scan_delay_cnt = 0; - adapter->empty_tx_q_cnt = 0; - spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); - cmd_node = list_first_entry(&adapter->scan_pending_q, - struct cmd_ctrl_node, list); - list_del(&cmd_node->list); - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, - flags); - - mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, - true); - queue_work(adapter->workqueue, &adapter->main_work); - goto done; - } - } else { - adapter->empty_tx_q_cnt = 0; - } - - /* Delay scan operation further by 20msec */ - mod_timer(&priv->scan_delay_timer, jiffies + - msecs_to_jiffies(MWIFIEX_SCAN_DELAY_MSEC)); - adapter->scan_delay_cnt++; - -done: - if (atomic_read(&priv->adapter->is_tx_received)) - atomic_set(&priv->adapter->is_tx_received, false); - - return; -} - -/* - * This function initializes the private structure and sets default - * values to the members. - * - * Additionally, it also initializes all the locks and sets up all the - * lists. - */ -int mwifiex_init_priv(struct mwifiex_private *priv) -{ - u32 i; - - priv->media_connected = false; - memset(priv->curr_addr, 0xff, ETH_ALEN); - - priv->pkt_tx_ctrl = 0; - priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; - priv->data_rate = 0; /* Initially indicate the rate as auto */ - priv->is_data_rate_auto = true; - priv->bcn_avg_factor = DEFAULT_BCN_AVG_FACTOR; - priv->data_avg_factor = DEFAULT_DATA_AVG_FACTOR; - - priv->sec_info.wep_enabled = 0; - priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM; - priv->sec_info.encryption_mode = 0; - for (i = 0; i < ARRAY_SIZE(priv->wep_key); i++) - memset(&priv->wep_key[i], 0, sizeof(struct mwifiex_wep_key)); - priv->wep_key_curr_index = 0; - priv->curr_pkt_filter = HostCmd_ACT_MAC_RX_ON | HostCmd_ACT_MAC_TX_ON | - HostCmd_ACT_MAC_ETHERNETII_ENABLE; - - priv->beacon_period = 100; /* beacon interval */ ; - priv->attempted_bss_desc = NULL; - memset(&priv->curr_bss_params, 0, sizeof(priv->curr_bss_params)); - priv->listen_interval = MWIFIEX_DEFAULT_LISTEN_INTERVAL; - - memset(&priv->prev_ssid, 0, sizeof(priv->prev_ssid)); - memset(&priv->prev_bssid, 0, sizeof(priv->prev_bssid)); - memset(&priv->assoc_rsp_buf, 0, sizeof(priv->assoc_rsp_buf)); - priv->assoc_rsp_size = 0; - priv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL; - priv->atim_window = 0; - priv->adhoc_state = ADHOC_IDLE; - priv->tx_power_level = 0; - priv->max_tx_power_level = 0; - priv->min_tx_power_level = 0; - priv->tx_rate = 0; - priv->rxpd_htinfo = 0; - priv->rxpd_rate = 0; - priv->rate_bitmap = 0; - priv->data_rssi_last = 0; - priv->data_rssi_avg = 0; - priv->data_nf_avg = 0; - priv->data_nf_last = 0; - priv->bcn_rssi_last = 0; - priv->bcn_rssi_avg = 0; - priv->bcn_nf_avg = 0; - priv->bcn_nf_last = 0; - memset(&priv->wpa_ie, 0, sizeof(priv->wpa_ie)); - memset(&priv->aes_key, 0, sizeof(priv->aes_key)); - priv->wpa_ie_len = 0; - priv->wpa_is_gtk_set = false; - - memset(&priv->assoc_tlv_buf, 0, sizeof(priv->assoc_tlv_buf)); - priv->assoc_tlv_buf_len = 0; - memset(&priv->wps, 0, sizeof(priv->wps)); - memset(&priv->gen_ie_buf, 0, sizeof(priv->gen_ie_buf)); - priv->gen_ie_buf_len = 0; - memset(priv->vs_ie, 0, sizeof(priv->vs_ie)); - - priv->wmm_required = true; - priv->wmm_enabled = false; - priv->wmm_qosinfo = 0; - priv->curr_bcn_buf = NULL; - priv->curr_bcn_size = 0; - priv->wps_ie = NULL; - priv->wps_ie_len = 0; - priv->ap_11n_enabled = 0; - memset(&priv->roc_cfg, 0, sizeof(priv->roc_cfg)); - - priv->scan_block = false; - - setup_timer(&priv->scan_delay_timer, scan_delay_timer_fn, - (unsigned long)priv); - - return mwifiex_add_bss_prio_tbl(priv); -} - -/* - * This function allocates buffers for members of the adapter - * structure. - * - * The memory allocated includes scan table, command buffers, and - * sleep confirm command buffer. In addition, the queues are - * also initialized. - */ -static int mwifiex_allocate_adapter(struct mwifiex_adapter *adapter) -{ - int ret; - - /* Allocate command buffer */ - ret = mwifiex_alloc_cmd_buffer(adapter); - if (ret) { - dev_err(adapter->dev, "%s: failed to alloc cmd buffer\n", - __func__); - return -1; - } - - adapter->sleep_cfm = - dev_alloc_skb(sizeof(struct mwifiex_opt_sleep_confirm) - + INTF_HEADER_LEN); - - if (!adapter->sleep_cfm) { - dev_err(adapter->dev, "%s: failed to alloc sleep cfm" - " cmd buffer\n", __func__); - return -1; - } - skb_reserve(adapter->sleep_cfm, INTF_HEADER_LEN); - - return 0; -} - -/* - * This function initializes the adapter structure and sets default - * values to the members of adapter. - * - * This also initializes the WMM related parameters in the driver private - * structures. - */ -static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) -{ - struct mwifiex_opt_sleep_confirm *sleep_cfm_buf = NULL; - - skb_put(adapter->sleep_cfm, sizeof(struct mwifiex_opt_sleep_confirm)); - - adapter->cmd_sent = false; - - if (adapter->iface_type == MWIFIEX_SDIO) - adapter->data_sent = true; - else - adapter->data_sent = false; - - adapter->cmd_resp_received = false; - adapter->event_received = false; - adapter->data_received = false; - - adapter->surprise_removed = false; - - adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; - - adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; - adapter->ps_state = PS_STATE_AWAKE; - adapter->need_to_wakeup = false; - - adapter->scan_mode = HostCmd_BSS_MODE_ANY; - adapter->specific_scan_time = MWIFIEX_SPECIFIC_SCAN_CHAN_TIME; - adapter->active_scan_time = MWIFIEX_ACTIVE_SCAN_CHAN_TIME; - adapter->passive_scan_time = MWIFIEX_PASSIVE_SCAN_CHAN_TIME; - - adapter->scan_probes = 1; - - adapter->multiple_dtim = 1; - - adapter->local_listen_interval = 0; /* default value in firmware - will be used */ - - adapter->is_deep_sleep = false; - - adapter->delay_null_pkt = false; - adapter->delay_to_ps = 1000; - adapter->enhanced_ps_mode = PS_MODE_AUTO; - - adapter->gen_null_pkt = false; /* Disable NULL Pkg generation by - default */ - adapter->pps_uapsd_mode = false; /* Disable pps/uapsd mode by - default */ - adapter->pm_wakeup_card_req = false; - - adapter->pm_wakeup_fw_try = false; - - adapter->tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K; - adapter->curr_tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K; - - adapter->is_hs_configured = false; - adapter->hs_cfg.conditions = cpu_to_le32(HS_CFG_COND_DEF); - adapter->hs_cfg.gpio = HS_CFG_GPIO_DEF; - adapter->hs_cfg.gap = HS_CFG_GAP_DEF; - adapter->hs_activated = false; - - memset(adapter->event_body, 0, sizeof(adapter->event_body)); - adapter->hw_dot_11n_dev_cap = 0; - adapter->hw_dev_mcs_support = 0; - adapter->sec_chan_offset = 0; - adapter->adhoc_11n_enabled = false; - - mwifiex_wmm_init(adapter); - - if (adapter->sleep_cfm) { - sleep_cfm_buf = (struct mwifiex_opt_sleep_confirm *) - adapter->sleep_cfm->data; - memset(sleep_cfm_buf, 0, adapter->sleep_cfm->len); - sleep_cfm_buf->command = - cpu_to_le16(HostCmd_CMD_802_11_PS_MODE_ENH); - sleep_cfm_buf->size = - cpu_to_le16(adapter->sleep_cfm->len); - sleep_cfm_buf->result = 0; - sleep_cfm_buf->action = cpu_to_le16(SLEEP_CONFIRM); - sleep_cfm_buf->resp_ctrl = cpu_to_le16(RESP_NEEDED); - } - memset(&adapter->sleep_params, 0, sizeof(adapter->sleep_params)); - memset(&adapter->sleep_period, 0, sizeof(adapter->sleep_period)); - adapter->tx_lock_flag = false; - adapter->null_pkt_interval = 0; - adapter->fw_bands = 0; - adapter->config_bands = 0; - adapter->adhoc_start_band = 0; - adapter->scan_channels = NULL; - adapter->fw_release_number = 0; - adapter->fw_cap_info = 0; - memset(&adapter->upld_buf, 0, sizeof(adapter->upld_buf)); - adapter->event_cause = 0; - adapter->region_code = 0; - adapter->bcn_miss_time_out = DEFAULT_BCN_MISS_TIMEOUT; - adapter->adhoc_awake_period = 0; - memset(&adapter->arp_filter, 0, sizeof(adapter->arp_filter)); - adapter->arp_filter_size = 0; - adapter->max_mgmt_ie_index = MAX_MGMT_IE_INDEX; - adapter->empty_tx_q_cnt = 0; -} - -/* - * This function sets trans_start per tx_queue - */ -void mwifiex_set_trans_start(struct net_device *dev) -{ - int i; - - for (i = 0; i < dev->num_tx_queues; i++) - netdev_get_tx_queue(dev, i)->trans_start = jiffies; - - dev->trans_start = jiffies; -} - -/* - * This function wakes up all queues in net_device - */ -void mwifiex_wake_up_net_dev_queue(struct net_device *netdev, - struct mwifiex_adapter *adapter) -{ - unsigned long dev_queue_flags; - unsigned int i; - - spin_lock_irqsave(&adapter->queue_lock, dev_queue_flags); - - for (i = 0; i < netdev->num_tx_queues; i++) { - struct netdev_queue *txq = netdev_get_tx_queue(netdev, i); - - if (netif_tx_queue_stopped(txq)) - netif_tx_wake_queue(txq); - } - - spin_unlock_irqrestore(&adapter->queue_lock, dev_queue_flags); -} - -/* - * This function stops all queues in net_device - */ -void mwifiex_stop_net_dev_queue(struct net_device *netdev, - struct mwifiex_adapter *adapter) -{ - unsigned long dev_queue_flags; - unsigned int i; - - spin_lock_irqsave(&adapter->queue_lock, dev_queue_flags); - - for (i = 0; i < netdev->num_tx_queues; i++) { - struct netdev_queue *txq = netdev_get_tx_queue(netdev, i); - - if (!netif_tx_queue_stopped(txq)) - netif_tx_stop_queue(txq); - } - - spin_unlock_irqrestore(&adapter->queue_lock, dev_queue_flags); -} - -/* - * This function releases the lock variables and frees the locks and - * associated locks. - */ -static void mwifiex_free_lock_list(struct mwifiex_adapter *adapter) -{ - struct mwifiex_private *priv; - s32 i, j; - - /* Free lists */ - list_del(&adapter->cmd_free_q); - list_del(&adapter->cmd_pending_q); - list_del(&adapter->scan_pending_q); - - for (i = 0; i < adapter->priv_num; i++) - list_del(&adapter->bss_prio_tbl[i].bss_prio_head); - - for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - priv = adapter->priv[i]; - for (j = 0; j < MAX_NUM_TID; ++j) - list_del(&priv->wmm.tid_tbl_ptr[j].ra_list); - list_del(&priv->tx_ba_stream_tbl_ptr); - list_del(&priv->rx_reorder_tbl_ptr); - list_del(&priv->sta_list); - } - } -} - -/* - * This function frees the adapter structure. - * - * The freeing operation is done recursively, by canceling all - * pending commands, freeing the member buffers previously - * allocated (command buffers, scan table buffer, sleep confirm - * command buffer), stopping the timers and calling the cleanup - * routines for every interface, before the actual adapter - * structure is freed. - */ -static void -mwifiex_free_adapter(struct mwifiex_adapter *adapter) -{ - if (!adapter) { - pr_err("%s: adapter is NULL\n", __func__); - return; - } - - mwifiex_cancel_all_pending_cmd(adapter); - - /* Free lock variables */ - mwifiex_free_lock_list(adapter); - - /* Free command buffer */ - dev_dbg(adapter->dev, "info: free cmd buffer\n"); - mwifiex_free_cmd_buffer(adapter); - - del_timer(&adapter->cmd_timer); - - dev_dbg(adapter->dev, "info: free scan table\n"); - - if (adapter->if_ops.cleanup_if) - adapter->if_ops.cleanup_if(adapter); - - if (adapter->sleep_cfm) - dev_kfree_skb_any(adapter->sleep_cfm); -} - -/* - * This function intializes the lock variables and - * the list heads. - */ -int mwifiex_init_lock_list(struct mwifiex_adapter *adapter) -{ - struct mwifiex_private *priv; - s32 i, j; - - spin_lock_init(&adapter->mwifiex_lock); - spin_lock_init(&adapter->int_lock); - spin_lock_init(&adapter->main_proc_lock); - spin_lock_init(&adapter->mwifiex_cmd_lock); - spin_lock_init(&adapter->queue_lock); - for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - priv = adapter->priv[i]; - spin_lock_init(&priv->rx_pkt_lock); - spin_lock_init(&priv->wmm.ra_list_spinlock); - spin_lock_init(&priv->curr_bcn_buf_lock); - spin_lock_init(&priv->sta_list_spinlock); - } - } - - /* Initialize cmd_free_q */ - INIT_LIST_HEAD(&adapter->cmd_free_q); - /* Initialize cmd_pending_q */ - INIT_LIST_HEAD(&adapter->cmd_pending_q); - /* Initialize scan_pending_q */ - INIT_LIST_HEAD(&adapter->scan_pending_q); - - spin_lock_init(&adapter->cmd_free_q_lock); - spin_lock_init(&adapter->cmd_pending_q_lock); - spin_lock_init(&adapter->scan_pending_q_lock); - - skb_queue_head_init(&adapter->usb_rx_data_q); - - for (i = 0; i < adapter->priv_num; ++i) { - INIT_LIST_HEAD(&adapter->bss_prio_tbl[i].bss_prio_head); - spin_lock_init(&adapter->bss_prio_tbl[i].bss_prio_lock); - } - - for (i = 0; i < adapter->priv_num; i++) { - if (!adapter->priv[i]) - continue; - priv = adapter->priv[i]; - for (j = 0; j < MAX_NUM_TID; ++j) - INIT_LIST_HEAD(&priv->wmm.tid_tbl_ptr[j].ra_list); - INIT_LIST_HEAD(&priv->tx_ba_stream_tbl_ptr); - INIT_LIST_HEAD(&priv->rx_reorder_tbl_ptr); - INIT_LIST_HEAD(&priv->sta_list); - - spin_lock_init(&priv->tx_ba_stream_tbl_lock); - spin_lock_init(&priv->rx_reorder_tbl_lock); - } - - return 0; -} - -/* - * This function initializes the firmware. - * - * The following operations are performed sequentially - - * - Allocate adapter structure - * - Initialize the adapter structure - * - Initialize the private structure - * - Add BSS priority tables to the adapter structure - * - For each interface, send the init commands to firmware - * - Send the first command in command pending queue, if available - */ -int mwifiex_init_fw(struct mwifiex_adapter *adapter) -{ - int ret; - struct mwifiex_private *priv; - u8 i, first_sta = true; - int is_cmd_pend_q_empty; - unsigned long flags; - - adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; - - /* Allocate memory for member of adapter structure */ - ret = mwifiex_allocate_adapter(adapter); - if (ret) - return -1; - - /* Initialize adapter structure */ - mwifiex_init_adapter(adapter); - - for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - priv = adapter->priv[i]; - - /* Initialize private structure */ - ret = mwifiex_init_priv(priv); - if (ret) - return -1; - } - } - - if (adapter->if_ops.init_fw_port) { - if (adapter->if_ops.init_fw_port(adapter)) - return -1; - } - - for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - ret = mwifiex_sta_init_cmd(adapter->priv[i], first_sta); - if (ret == -1) - return -1; - - first_sta = false; - } - } - - spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags); - is_cmd_pend_q_empty = list_empty(&adapter->cmd_pending_q); - spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); - if (!is_cmd_pend_q_empty) { - /* Send the first command in queue and return */ - if (mwifiex_main_process(adapter) != -1) - ret = -EINPROGRESS; - } else { - adapter->hw_status = MWIFIEX_HW_STATUS_READY; - } - - return ret; -} - -/* - * This function deletes the BSS priority tables. - * - * The function traverses through all the allocated BSS priority nodes - * in every BSS priority table and frees them. - */ -static void mwifiex_delete_bss_prio_tbl(struct mwifiex_private *priv) -{ - int i; - struct mwifiex_adapter *adapter = priv->adapter; - struct mwifiex_bss_prio_node *bssprio_node, *tmp_node; - struct list_head *head; - spinlock_t *lock; /* bss priority lock */ - unsigned long flags; - - for (i = 0; i < adapter->priv_num; ++i) { - head = &adapter->bss_prio_tbl[i].bss_prio_head; - lock = &adapter->bss_prio_tbl[i].bss_prio_lock; - dev_dbg(adapter->dev, "info: delete BSS priority table," - " bss_type = %d, bss_num = %d, i = %d," - " head = %p\n", - priv->bss_type, priv->bss_num, i, head); - - { - spin_lock_irqsave(lock, flags); - if (list_empty(head)) { - spin_unlock_irqrestore(lock, flags); - continue; - } - list_for_each_entry_safe(bssprio_node, tmp_node, head, - list) { - if (bssprio_node->priv == priv) { - dev_dbg(adapter->dev, "info: Delete " - "node %p, next = %p\n", - bssprio_node, tmp_node); - list_del(&bssprio_node->list); - kfree(bssprio_node); - } - } - spin_unlock_irqrestore(lock, flags); - } - } -} - -/* - * This function frees the private structure, including cleans - * up the TX and RX queues and frees the BSS priority tables. - */ -void mwifiex_free_priv(struct mwifiex_private *priv) -{ - mwifiex_clean_txrx(priv); - mwifiex_delete_bss_prio_tbl(priv); - mwifiex_free_curr_bcn(priv); -} - -/* - * This function is used to shutdown the driver. - * - * The following operations are performed sequentially - - * - Check if already shut down - * - Make sure the main process has stopped - * - Clean up the Tx and Rx queues - * - Delete BSS priority tables - * - Free the adapter - * - Notify completion - */ -int -mwifiex_shutdown_drv(struct mwifiex_adapter *adapter) -{ - int ret = -EINPROGRESS; - struct mwifiex_private *priv; - s32 i; - unsigned long flags; - struct sk_buff *skb; - - /* mwifiex already shutdown */ - if (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY) - return 0; - - adapter->hw_status = MWIFIEX_HW_STATUS_CLOSING; - /* wait for mwifiex_process to complete */ - if (adapter->mwifiex_processing) { - dev_warn(adapter->dev, "main process is still running\n"); - return ret; - } - - /* cancel current command */ - if (adapter->curr_cmd) { - dev_warn(adapter->dev, "curr_cmd is still in processing\n"); - del_timer(&adapter->cmd_timer); - mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); - adapter->curr_cmd = NULL; - } - - /* shut down mwifiex */ - dev_dbg(adapter->dev, "info: shutdown mwifiex...\n"); - - /* Clean up Tx/Rx queues and delete BSS priority table */ - for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - priv = adapter->priv[i]; - - mwifiex_clean_txrx(priv); - mwifiex_delete_bss_prio_tbl(priv); - } - } - - spin_lock_irqsave(&adapter->mwifiex_lock, flags); - - if (adapter->if_ops.data_complete) { - while ((skb = skb_dequeue(&adapter->usb_rx_data_q))) { - struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb); - - priv = adapter->priv[rx_info->bss_num]; - if (priv) - priv->stats.rx_dropped++; - - adapter->if_ops.data_complete(adapter, skb); - } - } - - /* Free adapter structure */ - mwifiex_free_adapter(adapter); - - spin_unlock_irqrestore(&adapter->mwifiex_lock, flags); - - /* Notify completion */ - ret = mwifiex_shutdown_fw_complete(adapter); - - return ret; -} - -/* - * This function downloads the firmware to the card. - * - * The actual download is preceded by two sanity checks - - * - Check if firmware is already running - * - Check if the interface is the winner to download the firmware - * - * ...and followed by another - - * - Check if the firmware is downloaded successfully - * - * After download is successfully completed, the host interrupts are enabled. - */ -int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, - struct mwifiex_fw_image *pmfw) -{ - int ret; - u32 poll_num = 1; - - if (adapter->if_ops.check_fw_status) { - adapter->winner = 0; - - /* check if firmware is already running */ - ret = adapter->if_ops.check_fw_status(adapter, poll_num); - if (!ret) { - dev_notice(adapter->dev, - "WLAN FW already running! Skip FW dnld\n"); - goto done; - } - - poll_num = MAX_FIRMWARE_POLL_TRIES; - - /* check if we are the winner for downloading FW */ - if (!adapter->winner) { - dev_notice(adapter->dev, - "FW already running! Skip FW dnld\n"); - poll_num = MAX_MULTI_INTERFACE_POLL_TRIES; - goto poll_fw; - } - } - - if (pmfw) { - /* Download firmware with helper */ - ret = adapter->if_ops.prog_fw(adapter, pmfw); - if (ret) { - dev_err(adapter->dev, "prog_fw failed ret=%#x\n", ret); - return ret; - } - } - -poll_fw: - /* Check if the firmware is downloaded successfully or not */ - ret = adapter->if_ops.check_fw_status(adapter, poll_num); - if (ret) { - dev_err(adapter->dev, "FW failed to be active in time\n"); - return -1; - } -done: - /* re-enable host interrupt for mwifiex after fw dnld is successful */ - if (adapter->if_ops.enable_int) - adapter->if_ops.enable_int(adapter); - - return ret; -} diff --git a/drivers/net/wireless/mwifiex/ioctl.h b/drivers/net/wireless/mwifiex/ioctl.h deleted file mode 100644 index 7f27e45680b5..000000000000 --- a/drivers/net/wireless/mwifiex/ioctl.h +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Marvell Wireless LAN device driver: ioctl data structures & APIs - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef _MWIFIEX_IOCTL_H_ -#define _MWIFIEX_IOCTL_H_ - -#include - -enum { - MWIFIEX_SCAN_TYPE_UNCHANGED = 0, - MWIFIEX_SCAN_TYPE_ACTIVE, - MWIFIEX_SCAN_TYPE_PASSIVE -}; - -struct mwifiex_user_scan { - u32 scan_cfg_len; - u8 scan_cfg_buf[1]; -}; - -#define MWIFIEX_PROMISC_MODE 1 -#define MWIFIEX_MULTICAST_MODE 2 -#define MWIFIEX_ALL_MULTI_MODE 4 -#define MWIFIEX_MAX_MULTICAST_LIST_SIZE 32 - -struct mwifiex_multicast_list { - u32 mode; - u32 num_multicast_addr; - u8 mac_list[MWIFIEX_MAX_MULTICAST_LIST_SIZE][ETH_ALEN]; -}; - -struct mwifiex_chan_freq { - u32 channel; - u32 freq; -}; - -struct mwifiex_ssid_bssid { - struct cfg80211_ssid ssid; - u8 bssid[ETH_ALEN]; -}; - -enum { - BAND_B = 1, - BAND_G = 2, - BAND_A = 4, - BAND_GN = 8, - BAND_AN = 16, - BAND_GAC = 32, - BAND_AAC = 64, -}; - -#define MWIFIEX_WPA_PASSHPHRASE_LEN 64 -struct wpa_param { - u8 pairwise_cipher_wpa; - u8 pairwise_cipher_wpa2; - u8 group_cipher; - u32 length; - u8 passphrase[MWIFIEX_WPA_PASSHPHRASE_LEN]; -}; - -struct wep_key { - u8 key_index; - u8 is_default; - u16 length; - u8 key[WLAN_KEY_LEN_WEP104]; -}; - -#define KEY_MGMT_ON_HOST 0x03 -#define MWIFIEX_AUTH_MODE_AUTO 0xFF -#define BAND_CONFIG_BG 0x00 -#define BAND_CONFIG_A 0x01 -#define MWIFIEX_SUPPORTED_RATES 14 -#define MWIFIEX_SUPPORTED_RATES_EXT 32 - -struct mwifiex_uap_bss_param { - u8 channel; - u8 band_cfg; - u16 rts_threshold; - u16 frag_threshold; - u8 retry_limit; - struct mwifiex_802_11_ssid ssid; - u8 bcast_ssid_ctl; - u8 radio_ctl; - u8 dtim_period; - u16 beacon_period; - u16 auth_mode; - u16 protocol; - u16 key_mgmt; - u16 key_mgmt_operation; - struct wpa_param wpa_cfg; - struct wep_key wep_cfg[NUM_WEP_KEYS]; - struct ieee80211_ht_cap ht_cap; - struct ieee80211_vht_cap vht_cap; - u8 rates[MWIFIEX_SUPPORTED_RATES]; - u32 sta_ao_timer; - u32 ps_sta_ao_timer; - u8 qos_info; - struct mwifiex_types_wmm_info wmm_info; -}; - -enum { - ADHOC_IDLE, - ADHOC_STARTED, - ADHOC_JOINED, - ADHOC_COALESCED -}; - -struct mwifiex_ds_get_stats { - u32 mcast_tx_frame; - u32 failed; - u32 retry; - u32 multi_retry; - u32 frame_dup; - u32 rts_success; - u32 rts_failure; - u32 ack_failure; - u32 rx_frag; - u32 mcast_rx_frame; - u32 fcs_error; - u32 tx_frame; - u32 wep_icv_error[4]; -}; - -#define MWIFIEX_MAX_VER_STR_LEN 128 - -struct mwifiex_ver_ext { - u32 version_str_sel; - char version_str[MWIFIEX_MAX_VER_STR_LEN]; -}; - -struct mwifiex_bss_info { - u32 bss_mode; - struct cfg80211_ssid ssid; - u32 bss_chan; - u8 country_code[3]; - u32 media_connected; - u32 max_power_level; - u32 min_power_level; - u32 adhoc_state; - signed int bcn_nf_last; - u32 wep_status; - u32 is_hs_configured; - u32 is_deep_sleep; - u8 bssid[ETH_ALEN]; -}; - -#define MAX_NUM_TID 8 - -#define MAX_RX_WINSIZE 64 - -struct mwifiex_ds_rx_reorder_tbl { - u16 tid; - u8 ta[ETH_ALEN]; - u32 start_win; - u32 win_size; - u32 buffer[MAX_RX_WINSIZE]; -}; - -struct mwifiex_ds_tx_ba_stream_tbl { - u16 tid; - u8 ra[ETH_ALEN]; -}; - -#define DBG_CMD_NUM 5 - -struct mwifiex_debug_info { - u32 int_counter; - u32 packets_out[MAX_NUM_TID]; - u32 tx_buf_size; - u32 curr_tx_buf_size; - u32 tx_tbl_num; - struct mwifiex_ds_tx_ba_stream_tbl - tx_tbl[MWIFIEX_MAX_TX_BASTREAM_SUPPORTED]; - u32 rx_tbl_num; - struct mwifiex_ds_rx_reorder_tbl rx_tbl - [MWIFIEX_MAX_RX_BASTREAM_SUPPORTED]; - u16 ps_mode; - u32 ps_state; - u8 is_deep_sleep; - u8 pm_wakeup_card_req; - u32 pm_wakeup_fw_try; - u8 is_hs_configured; - u8 hs_activated; - u32 num_cmd_host_to_card_failure; - u32 num_cmd_sleep_cfm_host_to_card_failure; - u32 num_tx_host_to_card_failure; - u32 num_event_deauth; - u32 num_event_disassoc; - u32 num_event_link_lost; - u32 num_cmd_deauth; - u32 num_cmd_assoc_success; - u32 num_cmd_assoc_failure; - u32 num_tx_timeout; - u32 num_cmd_timeout; - u16 timeout_cmd_id; - u16 timeout_cmd_act; - u16 last_cmd_id[DBG_CMD_NUM]; - u16 last_cmd_act[DBG_CMD_NUM]; - u16 last_cmd_index; - u16 last_cmd_resp_id[DBG_CMD_NUM]; - u16 last_cmd_resp_index; - u16 last_event[DBG_CMD_NUM]; - u16 last_event_index; - u8 data_sent; - u8 cmd_sent; - u8 cmd_resp_received; - u8 event_received; -}; - -#define MWIFIEX_KEY_INDEX_UNICAST 0x40000000 -#define PN_LEN 16 - -struct mwifiex_ds_encrypt_key { - u32 key_disable; - u32 key_index; - u32 key_len; - u8 key_material[WLAN_MAX_KEY_LEN]; - u8 mac_addr[ETH_ALEN]; - u32 is_wapi_key; - u8 pn[PN_LEN]; /* packet number */ - u8 is_igtk_key; -}; - -struct mwifiex_power_cfg { - u32 is_power_auto; - u32 power_level; -}; - -struct mwifiex_ds_hs_cfg { - u32 is_invoke_hostcmd; - /* Bit0: non-unicast data - * Bit1: unicast data - * Bit2: mac events - * Bit3: magic packet - */ - u32 conditions; - u32 gpio; - u32 gap; -}; - -#define DEEP_SLEEP_ON 1 -#define DEEP_SLEEP_OFF 0 -#define DEEP_SLEEP_IDLE_TIME 100 -#define PS_MODE_AUTO 1 - -struct mwifiex_ds_auto_ds { - u16 auto_ds; - u16 idle_time; -}; - -struct mwifiex_ds_pm_cfg { - union { - u32 ps_mode; - struct mwifiex_ds_hs_cfg hs_cfg; - struct mwifiex_ds_auto_ds auto_deep_sleep; - u32 sleep_period; - } param; -}; - -struct mwifiex_11ac_vht_cfg { - u8 band_config; - u8 misc_config; - u32 cap_info; - u32 mcs_tx_set; - u32 mcs_rx_set; -}; - -struct mwifiex_ds_11n_tx_cfg { - u16 tx_htcap; - u16 tx_htinfo; - u16 misc_config; /* Needed for 802.11AC cards only */ -}; - -struct mwifiex_ds_11n_amsdu_aggr_ctrl { - u16 enable; - u16 curr_buf_size; -}; - -struct mwifiex_ds_ant_cfg { - u32 tx_ant; - u32 rx_ant; -}; - -#define MWIFIEX_NUM_OF_CMD_BUFFER 20 -#define MWIFIEX_SIZE_OF_CMD_BUFFER 2048 - -enum { - MWIFIEX_IE_TYPE_GEN_IE = 0, - MWIFIEX_IE_TYPE_ARP_FILTER, -}; - -enum { - MWIFIEX_REG_MAC = 1, - MWIFIEX_REG_BBP, - MWIFIEX_REG_RF, - MWIFIEX_REG_PMIC, - MWIFIEX_REG_CAU, -}; - -struct mwifiex_ds_reg_rw { - __le32 type; - __le32 offset; - __le32 value; -}; - -#define MAX_EEPROM_DATA 256 - -struct mwifiex_ds_read_eeprom { - __le16 offset; - __le16 byte_count; - u8 value[MAX_EEPROM_DATA]; -}; - -#define IEEE_MAX_IE_SIZE 256 - -#define MWIFIEX_IE_HDR_SIZE (sizeof(struct mwifiex_ie) - IEEE_MAX_IE_SIZE) - -struct mwifiex_ds_misc_gen_ie { - u32 type; - u32 len; - u8 ie_data[IEEE_MAX_IE_SIZE]; -}; - -struct mwifiex_ds_misc_cmd { - u32 len; - u8 cmd[MWIFIEX_SIZE_OF_CMD_BUFFER]; -}; - -#define BITMASK_BCN_RSSI_LOW BIT(0) -#define BITMASK_BCN_RSSI_HIGH BIT(4) - -enum subsc_evt_rssi_state { - EVENT_HANDLED, - RSSI_LOW_RECVD, - RSSI_HIGH_RECVD -}; - -struct subsc_evt_cfg { - u8 abs_value; - u8 evt_freq; -}; - -struct mwifiex_ds_misc_subsc_evt { - u16 action; - u16 events; - struct subsc_evt_cfg bcn_l_rssi_cfg; - struct subsc_evt_cfg bcn_h_rssi_cfg; -}; - -#define MAX_BYTESEQ 6 /* non-adjustable */ -#define MWIFIEX_MAX_FILTERS 10 - -struct mwifiex_mef_filter { - u16 repeat; - u16 offset; - s8 byte_seq[MAX_BYTESEQ + 1]; - u8 filt_type; - u8 filt_action; -}; - -struct mwifiex_mef_entry { - u8 mode; - u8 action; - struct mwifiex_mef_filter filter[MWIFIEX_MAX_FILTERS]; -}; - -struct mwifiex_ds_mef_cfg { - u32 criteria; - u16 num_entries; - struct mwifiex_mef_entry *mef_entry; -}; - -#define MWIFIEX_MAX_VSIE_LEN (256) -#define MWIFIEX_MAX_VSIE_NUM (8) -#define MWIFIEX_VSIE_MASK_CLEAR 0x00 -#define MWIFIEX_VSIE_MASK_SCAN 0x01 -#define MWIFIEX_VSIE_MASK_ASSOC 0x02 -#define MWIFIEX_VSIE_MASK_ADHOC 0x04 - -enum { - MWIFIEX_FUNC_INIT = 1, - MWIFIEX_FUNC_SHUTDOWN, -}; - -#endif /* !_MWIFIEX_IOCTL_H_ */ diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c deleted file mode 100644 index 96bda6ca316d..000000000000 --- a/drivers/net/wireless/mwifiex/join.c +++ /dev/null @@ -1,1463 +0,0 @@ -/* - * Marvell Wireless LAN device driver: association and ad-hoc start/join - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" -#include "11n.h" -#include "11ac.h" - -#define CAPINFO_MASK (~(BIT(15) | BIT(14) | BIT(12) | BIT(11) | BIT(9))) - -/* - * Append a generic IE as a pass through TLV to a TLV buffer. - * - * This function is called from the network join command preparation routine. - * - * If the IE buffer has been setup by the application, this routine appends - * the buffer as a pass through TLV type to the request. - */ -static int -mwifiex_cmd_append_generic_ie(struct mwifiex_private *priv, u8 **buffer) -{ - int ret_len = 0; - struct mwifiex_ie_types_header ie_header; - - /* Null Checks */ - if (!buffer) - return 0; - if (!(*buffer)) - return 0; - - /* - * If there is a generic ie buffer setup, append it to the return - * parameter buffer pointer. - */ - if (priv->gen_ie_buf_len) { - dev_dbg(priv->adapter->dev, - "info: %s: append generic ie len %d to %p\n", - __func__, priv->gen_ie_buf_len, *buffer); - - /* Wrap the generic IE buffer with a pass through TLV type */ - ie_header.type = cpu_to_le16(TLV_TYPE_PASSTHROUGH); - ie_header.len = cpu_to_le16(priv->gen_ie_buf_len); - memcpy(*buffer, &ie_header, sizeof(ie_header)); - - /* Increment the return size and the return buffer pointer - param */ - *buffer += sizeof(ie_header); - ret_len += sizeof(ie_header); - - /* Copy the generic IE buffer to the output buffer, advance - pointer */ - memcpy(*buffer, priv->gen_ie_buf, priv->gen_ie_buf_len); - - /* Increment the return size and the return buffer pointer - param */ - *buffer += priv->gen_ie_buf_len; - ret_len += priv->gen_ie_buf_len; - - /* Reset the generic IE buffer */ - priv->gen_ie_buf_len = 0; - } - - /* return the length appended to the buffer */ - return ret_len; -} - -/* - * Append TSF tracking info from the scan table for the target AP. - * - * This function is called from the network join command preparation routine. - * - * The TSF table TSF sent to the firmware contains two TSF values: - * - The TSF of the target AP from its previous beacon/probe response - * - The TSF timestamp of our local MAC at the time we observed the - * beacon/probe response. - * - * The firmware uses the timestamp values to set an initial TSF value - * in the MAC for the new association after a reassociation attempt. - */ -static int -mwifiex_cmd_append_tsf_tlv(struct mwifiex_private *priv, u8 **buffer, - struct mwifiex_bssdescriptor *bss_desc) -{ - struct mwifiex_ie_types_tsf_timestamp tsf_tlv; - __le64 tsf_val; - - /* Null Checks */ - if (buffer == NULL) - return 0; - if (*buffer == NULL) - return 0; - - memset(&tsf_tlv, 0x00, sizeof(struct mwifiex_ie_types_tsf_timestamp)); - - tsf_tlv.header.type = cpu_to_le16(TLV_TYPE_TSFTIMESTAMP); - tsf_tlv.header.len = cpu_to_le16(2 * sizeof(tsf_val)); - - memcpy(*buffer, &tsf_tlv, sizeof(tsf_tlv.header)); - *buffer += sizeof(tsf_tlv.header); - - /* TSF at the time when beacon/probe_response was received */ - tsf_val = cpu_to_le64(bss_desc->fw_tsf); - memcpy(*buffer, &tsf_val, sizeof(tsf_val)); - *buffer += sizeof(tsf_val); - - tsf_val = cpu_to_le64(bss_desc->timestamp); - - dev_dbg(priv->adapter->dev, - "info: %s: TSF offset calc: %016llx - %016llx\n", - __func__, bss_desc->timestamp, bss_desc->fw_tsf); - - memcpy(*buffer, &tsf_val, sizeof(tsf_val)); - *buffer += sizeof(tsf_val); - - return sizeof(tsf_tlv.header) + (2 * sizeof(tsf_val)); -} - -/* - * This function finds out the common rates between rate1 and rate2. - * - * It will fill common rates in rate1 as output if found. - * - * NOTE: Setting the MSB of the basic rates needs to be taken - * care of, either before or after calling this function. - */ -static int mwifiex_get_common_rates(struct mwifiex_private *priv, u8 *rate1, - u32 rate1_size, u8 *rate2, u32 rate2_size) -{ - int ret; - u8 *ptr = rate1, *tmp; - u32 i, j; - - tmp = kmemdup(rate1, rate1_size, GFP_KERNEL); - if (!tmp) { - dev_err(priv->adapter->dev, "failed to alloc tmp buf\n"); - return -ENOMEM; - } - - memset(rate1, 0, rate1_size); - - for (i = 0; i < rate2_size && rate2[i]; i++) { - for (j = 0; j < rate1_size && tmp[j]; j++) { - /* Check common rate, excluding the bit for - basic rate */ - if ((rate2[i] & 0x7F) == (tmp[j] & 0x7F)) { - *rate1++ = tmp[j]; - break; - } - } - } - - dev_dbg(priv->adapter->dev, "info: Tx data rate set to %#x\n", - priv->data_rate); - - if (!priv->is_data_rate_auto) { - while (*ptr) { - if ((*ptr & 0x7f) == priv->data_rate) { - ret = 0; - goto done; - } - ptr++; - } - dev_err(priv->adapter->dev, "previously set fixed data rate %#x" - " is not compatible with the network\n", - priv->data_rate); - - ret = -1; - goto done; - } - - ret = 0; -done: - kfree(tmp); - return ret; -} - -/* - * This function creates the intersection of the rates supported by a - * target BSS and our adapter settings for use in an assoc/join command. - */ -static int -mwifiex_setup_rates_from_bssdesc(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc, - u8 *out_rates, u32 *out_rates_size) -{ - u8 card_rates[MWIFIEX_SUPPORTED_RATES]; - u32 card_rates_size; - - /* Copy AP supported rates */ - memcpy(out_rates, bss_desc->supported_rates, MWIFIEX_SUPPORTED_RATES); - /* Get the STA supported rates */ - card_rates_size = mwifiex_get_active_data_rates(priv, card_rates); - /* Get the common rates between AP and STA supported rates */ - if (mwifiex_get_common_rates(priv, out_rates, MWIFIEX_SUPPORTED_RATES, - card_rates, card_rates_size)) { - *out_rates_size = 0; - dev_err(priv->adapter->dev, "%s: cannot get common rates\n", - __func__); - return -1; - } - - *out_rates_size = - min_t(size_t, strlen(out_rates), MWIFIEX_SUPPORTED_RATES); - - return 0; -} - -/* - * This function appends a WPS IE. It is called from the network join command - * preparation routine. - * - * If the IE buffer has been setup by the application, this routine appends - * the buffer as a WPS TLV type to the request. - */ -static int -mwifiex_cmd_append_wps_ie(struct mwifiex_private *priv, u8 **buffer) -{ - int retLen = 0; - struct mwifiex_ie_types_header ie_header; - - if (!buffer || !*buffer) - return 0; - - /* - * If there is a wps ie buffer setup, append it to the return - * parameter buffer pointer. - */ - if (priv->wps_ie_len) { - dev_dbg(priv->adapter->dev, "cmd: append wps ie %d to %p\n", - priv->wps_ie_len, *buffer); - - /* Wrap the generic IE buffer with a pass through TLV type */ - ie_header.type = cpu_to_le16(TLV_TYPE_MGMT_IE); - ie_header.len = cpu_to_le16(priv->wps_ie_len); - memcpy(*buffer, &ie_header, sizeof(ie_header)); - *buffer += sizeof(ie_header); - retLen += sizeof(ie_header); - - memcpy(*buffer, priv->wps_ie, priv->wps_ie_len); - *buffer += priv->wps_ie_len; - retLen += priv->wps_ie_len; - - } - - kfree(priv->wps_ie); - priv->wps_ie_len = 0; - return retLen; -} - -/* - * This function appends a WAPI IE. - * - * This function is called from the network join command preparation routine. - * - * If the IE buffer has been setup by the application, this routine appends - * the buffer as a WAPI TLV type to the request. - */ -static int -mwifiex_cmd_append_wapi_ie(struct mwifiex_private *priv, u8 **buffer) -{ - int retLen = 0; - struct mwifiex_ie_types_header ie_header; - - /* Null Checks */ - if (buffer == NULL) - return 0; - if (*buffer == NULL) - return 0; - - /* - * If there is a wapi ie buffer setup, append it to the return - * parameter buffer pointer. - */ - if (priv->wapi_ie_len) { - dev_dbg(priv->adapter->dev, "cmd: append wapi ie %d to %p\n", - priv->wapi_ie_len, *buffer); - - /* Wrap the generic IE buffer with a pass through TLV type */ - ie_header.type = cpu_to_le16(TLV_TYPE_WAPI_IE); - ie_header.len = cpu_to_le16(priv->wapi_ie_len); - memcpy(*buffer, &ie_header, sizeof(ie_header)); - - /* Increment the return size and the return buffer pointer - param */ - *buffer += sizeof(ie_header); - retLen += sizeof(ie_header); - - /* Copy the wapi IE buffer to the output buffer, advance - pointer */ - memcpy(*buffer, priv->wapi_ie, priv->wapi_ie_len); - - /* Increment the return size and the return buffer pointer - param */ - *buffer += priv->wapi_ie_len; - retLen += priv->wapi_ie_len; - - } - /* return the length appended to the buffer */ - return retLen; -} - -/* - * This function appends rsn ie tlv for wpa/wpa2 security modes. - * It is called from the network join command preparation routine. - */ -static int mwifiex_append_rsn_ie_wpa_wpa2(struct mwifiex_private *priv, - u8 **buffer) -{ - struct mwifiex_ie_types_rsn_param_set *rsn_ie_tlv; - int rsn_ie_len; - - if (!buffer || !(*buffer)) - return 0; - - rsn_ie_tlv = (struct mwifiex_ie_types_rsn_param_set *) (*buffer); - rsn_ie_tlv->header.type = cpu_to_le16((u16) priv->wpa_ie[0]); - rsn_ie_tlv->header.type = cpu_to_le16( - le16_to_cpu(rsn_ie_tlv->header.type) & 0x00FF); - rsn_ie_tlv->header.len = cpu_to_le16((u16) priv->wpa_ie[1]); - rsn_ie_tlv->header.len = cpu_to_le16(le16_to_cpu(rsn_ie_tlv->header.len) - & 0x00FF); - if (le16_to_cpu(rsn_ie_tlv->header.len) <= (sizeof(priv->wpa_ie) - 2)) - memcpy(rsn_ie_tlv->rsn_ie, &priv->wpa_ie[2], - le16_to_cpu(rsn_ie_tlv->header.len)); - else - return -1; - - rsn_ie_len = sizeof(rsn_ie_tlv->header) + - le16_to_cpu(rsn_ie_tlv->header.len); - *buffer += rsn_ie_len; - - return rsn_ie_len; -} - -/* - * This function prepares command for association. - * - * This sets the following parameters - - * - Peer MAC address - * - Listen interval - * - Beacon interval - * - Capability information - * - * ...and the following TLVs, as required - - * - SSID TLV - * - PHY TLV - * - SS TLV - * - Rates TLV - * - Authentication TLV - * - Channel TLV - * - WPA/WPA2 IE - * - 11n TLV - * - Vendor specific TLV - * - WMM TLV - * - WAPI IE - * - Generic IE - * - TSF TLV - * - * Preparation also includes - - * - Setting command ID and proper size - * - Ensuring correct endian-ness - */ -int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - struct mwifiex_bssdescriptor *bss_desc) -{ - struct host_cmd_ds_802_11_associate *assoc = &cmd->params.associate; - struct mwifiex_ie_types_ssid_param_set *ssid_tlv; - struct mwifiex_ie_types_phy_param_set *phy_tlv; - struct mwifiex_ie_types_ss_param_set *ss_tlv; - struct mwifiex_ie_types_rates_param_set *rates_tlv; - struct mwifiex_ie_types_auth_type *auth_tlv; - struct mwifiex_ie_types_chan_list_param_set *chan_tlv; - u8 rates[MWIFIEX_SUPPORTED_RATES]; - u32 rates_size; - u16 tmp_cap; - u8 *pos; - int rsn_ie_len = 0; - - pos = (u8 *) assoc; - - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_ASSOCIATE); - - /* Save so we know which BSS Desc to use in the response handler */ - priv->attempted_bss_desc = bss_desc; - - memcpy(assoc->peer_sta_addr, - bss_desc->mac_address, sizeof(assoc->peer_sta_addr)); - pos += sizeof(assoc->peer_sta_addr); - - /* Set the listen interval */ - assoc->listen_interval = cpu_to_le16(priv->listen_interval); - /* Set the beacon period */ - assoc->beacon_period = cpu_to_le16(bss_desc->beacon_period); - - pos += sizeof(assoc->cap_info_bitmap); - pos += sizeof(assoc->listen_interval); - pos += sizeof(assoc->beacon_period); - pos += sizeof(assoc->dtim_period); - - ssid_tlv = (struct mwifiex_ie_types_ssid_param_set *) pos; - ssid_tlv->header.type = cpu_to_le16(WLAN_EID_SSID); - ssid_tlv->header.len = cpu_to_le16((u16) bss_desc->ssid.ssid_len); - memcpy(ssid_tlv->ssid, bss_desc->ssid.ssid, - le16_to_cpu(ssid_tlv->header.len)); - pos += sizeof(ssid_tlv->header) + le16_to_cpu(ssid_tlv->header.len); - - phy_tlv = (struct mwifiex_ie_types_phy_param_set *) pos; - phy_tlv->header.type = cpu_to_le16(WLAN_EID_DS_PARAMS); - phy_tlv->header.len = cpu_to_le16(sizeof(phy_tlv->fh_ds.ds_param_set)); - memcpy(&phy_tlv->fh_ds.ds_param_set, - &bss_desc->phy_param_set.ds_param_set.current_chan, - sizeof(phy_tlv->fh_ds.ds_param_set)); - pos += sizeof(phy_tlv->header) + le16_to_cpu(phy_tlv->header.len); - - ss_tlv = (struct mwifiex_ie_types_ss_param_set *) pos; - ss_tlv->header.type = cpu_to_le16(WLAN_EID_CF_PARAMS); - ss_tlv->header.len = cpu_to_le16(sizeof(ss_tlv->cf_ibss.cf_param_set)); - pos += sizeof(ss_tlv->header) + le16_to_cpu(ss_tlv->header.len); - - /* Get the common rates supported between the driver and the BSS Desc */ - if (mwifiex_setup_rates_from_bssdesc - (priv, bss_desc, rates, &rates_size)) - return -1; - - /* Save the data rates into Current BSS state structure */ - priv->curr_bss_params.num_of_rates = rates_size; - memcpy(&priv->curr_bss_params.data_rates, rates, rates_size); - - /* Setup the Rates TLV in the association command */ - rates_tlv = (struct mwifiex_ie_types_rates_param_set *) pos; - rates_tlv->header.type = cpu_to_le16(WLAN_EID_SUPP_RATES); - rates_tlv->header.len = cpu_to_le16((u16) rates_size); - memcpy(rates_tlv->rates, rates, rates_size); - pos += sizeof(rates_tlv->header) + rates_size; - dev_dbg(priv->adapter->dev, "info: ASSOC_CMD: rates size = %d\n", - rates_size); - - /* Add the Authentication type to be used for Auth frames */ - auth_tlv = (struct mwifiex_ie_types_auth_type *) pos; - auth_tlv->header.type = cpu_to_le16(TLV_TYPE_AUTH_TYPE); - auth_tlv->header.len = cpu_to_le16(sizeof(auth_tlv->auth_type)); - if (priv->sec_info.wep_enabled) - auth_tlv->auth_type = cpu_to_le16( - (u16) priv->sec_info.authentication_mode); - else - auth_tlv->auth_type = cpu_to_le16(NL80211_AUTHTYPE_OPEN_SYSTEM); - - pos += sizeof(auth_tlv->header) + le16_to_cpu(auth_tlv->header.len); - - if (IS_SUPPORT_MULTI_BANDS(priv->adapter) && - !(ISSUPP_11NENABLED(priv->adapter->fw_cap_info) && - (!bss_desc->disable_11n) && - (priv->adapter->config_bands & BAND_GN || - priv->adapter->config_bands & BAND_AN) && - (bss_desc->bcn_ht_cap) - ) - ) { - /* Append a channel TLV for the channel the attempted AP was - found on */ - chan_tlv = (struct mwifiex_ie_types_chan_list_param_set *) pos; - chan_tlv->header.type = cpu_to_le16(TLV_TYPE_CHANLIST); - chan_tlv->header.len = - cpu_to_le16(sizeof(struct mwifiex_chan_scan_param_set)); - - memset(chan_tlv->chan_scan_param, 0x00, - sizeof(struct mwifiex_chan_scan_param_set)); - chan_tlv->chan_scan_param[0].chan_number = - (bss_desc->phy_param_set.ds_param_set.current_chan); - dev_dbg(priv->adapter->dev, "info: Assoc: TLV Chan = %d\n", - chan_tlv->chan_scan_param[0].chan_number); - - chan_tlv->chan_scan_param[0].radio_type = - mwifiex_band_to_radio_type((u8) bss_desc->bss_band); - - dev_dbg(priv->adapter->dev, "info: Assoc: TLV Band = %d\n", - chan_tlv->chan_scan_param[0].radio_type); - pos += sizeof(chan_tlv->header) + - sizeof(struct mwifiex_chan_scan_param_set); - } - - if (!priv->wps.session_enable) { - if (priv->sec_info.wpa_enabled || priv->sec_info.wpa2_enabled) - rsn_ie_len = mwifiex_append_rsn_ie_wpa_wpa2(priv, &pos); - - if (rsn_ie_len == -1) - return -1; - } - - if (ISSUPP_11NENABLED(priv->adapter->fw_cap_info) && - (!bss_desc->disable_11n) && - (priv->adapter->config_bands & BAND_GN || - priv->adapter->config_bands & BAND_AN)) - mwifiex_cmd_append_11n_tlv(priv, bss_desc, &pos); - - if (ISSUPP_11ACENABLED(priv->adapter->fw_cap_info) && - !bss_desc->disable_11n && !bss_desc->disable_11ac && - (priv->adapter->config_bands & BAND_GAC || - priv->adapter->config_bands & BAND_AAC)) - mwifiex_cmd_append_11ac_tlv(priv, bss_desc, &pos); - - /* Append vendor specific IE TLV */ - mwifiex_cmd_append_vsie_tlv(priv, MWIFIEX_VSIE_MASK_ASSOC, &pos); - - mwifiex_wmm_process_association_req(priv, &pos, &bss_desc->wmm_ie, - bss_desc->bcn_ht_cap); - if (priv->sec_info.wapi_enabled && priv->wapi_ie_len) - mwifiex_cmd_append_wapi_ie(priv, &pos); - - if (priv->wps.session_enable && priv->wps_ie_len) - mwifiex_cmd_append_wps_ie(priv, &pos); - - mwifiex_cmd_append_generic_ie(priv, &pos); - - mwifiex_cmd_append_tsf_tlv(priv, &pos, bss_desc); - - cmd->size = cpu_to_le16((u16) (pos - (u8 *) assoc) + S_DS_GEN); - - /* Set the Capability info at last */ - tmp_cap = bss_desc->cap_info_bitmap; - - if (priv->adapter->config_bands == BAND_B) - tmp_cap &= ~WLAN_CAPABILITY_SHORT_SLOT_TIME; - - tmp_cap &= CAPINFO_MASK; - dev_dbg(priv->adapter->dev, "info: ASSOC_CMD: tmp_cap=%4X CAPINFO_MASK=%4lX\n", - tmp_cap, CAPINFO_MASK); - assoc->cap_info_bitmap = cpu_to_le16(tmp_cap); - - return 0; -} - -/* - * Association firmware command response handler - * - * The response buffer for the association command has the following - * memory layout. - * - * For cases where an association response was not received (indicated - * by the CapInfo and AId field): - * - * .------------------------------------------------------------. - * | Header(4 * sizeof(t_u16)): Standard command response hdr | - * .------------------------------------------------------------. - * | cap_info/Error Return(t_u16): | - * | 0xFFFF(-1): Internal error | - * | 0xFFFE(-2): Authentication unhandled message | - * | 0xFFFD(-3): Authentication refused | - * | 0xFFFC(-4): Timeout waiting for AP response | - * .------------------------------------------------------------. - * | status_code(t_u16): | - * | If cap_info is -1: | - * | An internal firmware failure prevented the | - * | command from being processed. The status_code | - * | will be set to 1. | - * | | - * | If cap_info is -2: | - * | An authentication frame was received but was | - * | not handled by the firmware. IEEE Status | - * | code for the failure is returned. | - * | | - * | If cap_info is -3: | - * | An authentication frame was received and the | - * | status_code is the IEEE Status reported in the | - * | response. | - * | | - * | If cap_info is -4: | - * | (1) Association response timeout | - * | (2) Authentication response timeout | - * .------------------------------------------------------------. - * | a_id(t_u16): 0xFFFF | - * .------------------------------------------------------------. - * - * - * For cases where an association response was received, the IEEE - * standard association response frame is returned: - * - * .------------------------------------------------------------. - * | Header(4 * sizeof(t_u16)): Standard command response hdr | - * .------------------------------------------------------------. - * | cap_info(t_u16): IEEE Capability | - * .------------------------------------------------------------. - * | status_code(t_u16): IEEE Status Code | - * .------------------------------------------------------------. - * | a_id(t_u16): IEEE Association ID | - * .------------------------------------------------------------. - * | IEEE IEs(variable): Any received IEs comprising the | - * | remaining portion of a received | - * | association response frame. | - * .------------------------------------------------------------. - * - * For simplistic handling, the status_code field can be used to determine - * an association success (0) or failure (non-zero). - */ -int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct mwifiex_adapter *adapter = priv->adapter; - int ret = 0; - struct ieee_types_assoc_rsp *assoc_rsp; - struct mwifiex_bssdescriptor *bss_desc; - u8 enable_data = true; - u16 cap_info, status_code; - - assoc_rsp = (struct ieee_types_assoc_rsp *) &resp->params; - - cap_info = le16_to_cpu(assoc_rsp->cap_info_bitmap); - status_code = le16_to_cpu(assoc_rsp->status_code); - - priv->assoc_rsp_size = min(le16_to_cpu(resp->size) - S_DS_GEN, - sizeof(priv->assoc_rsp_buf)); - - memcpy(priv->assoc_rsp_buf, &resp->params, priv->assoc_rsp_size); - - if (status_code) { - priv->adapter->dbg.num_cmd_assoc_failure++; - dev_err(priv->adapter->dev, - "ASSOC_RESP: failed, status code=%d err=%#x a_id=%#x\n", - status_code, cap_info, le16_to_cpu(assoc_rsp->a_id)); - - if (cap_info == MWIFIEX_TIMEOUT_FOR_AP_RESP) { - if (status_code == MWIFIEX_STATUS_CODE_AUTH_TIMEOUT) - ret = WLAN_STATUS_AUTH_TIMEOUT; - else - ret = WLAN_STATUS_UNSPECIFIED_FAILURE; - } else { - ret = status_code; - } - - goto done; - } - - /* Send a Media Connected event, according to the Spec */ - priv->media_connected = true; - - priv->adapter->ps_state = PS_STATE_AWAKE; - priv->adapter->pps_uapsd_mode = false; - priv->adapter->tx_lock_flag = false; - - /* Set the attempted BSSID Index to current */ - bss_desc = priv->attempted_bss_desc; - - dev_dbg(priv->adapter->dev, "info: ASSOC_RESP: %s\n", - bss_desc->ssid.ssid); - - /* Make a copy of current BSSID descriptor */ - memcpy(&priv->curr_bss_params.bss_descriptor, - bss_desc, sizeof(struct mwifiex_bssdescriptor)); - - /* Update curr_bss_params */ - priv->curr_bss_params.bss_descriptor.channel - = bss_desc->phy_param_set.ds_param_set.current_chan; - - priv->curr_bss_params.band = (u8) bss_desc->bss_band; - - if (bss_desc->wmm_ie.vend_hdr.element_id == WLAN_EID_VENDOR_SPECIFIC) - priv->curr_bss_params.wmm_enabled = true; - else - priv->curr_bss_params.wmm_enabled = false; - - if ((priv->wmm_required || bss_desc->bcn_ht_cap) && - priv->curr_bss_params.wmm_enabled) - priv->wmm_enabled = true; - else - priv->wmm_enabled = false; - - priv->curr_bss_params.wmm_uapsd_enabled = false; - - if (priv->wmm_enabled) - priv->curr_bss_params.wmm_uapsd_enabled - = ((bss_desc->wmm_ie.qos_info_bitmap & - IEEE80211_WMM_IE_AP_QOSINFO_UAPSD) ? 1 : 0); - - dev_dbg(priv->adapter->dev, "info: ASSOC_RESP: curr_pkt_filter is %#x\n", - priv->curr_pkt_filter); - if (priv->sec_info.wpa_enabled || priv->sec_info.wpa2_enabled) - priv->wpa_is_gtk_set = false; - - if (priv->wmm_enabled) { - /* Don't re-enable carrier until we get the WMM_GET_STATUS - event */ - enable_data = false; - } else { - /* Since WMM is not enabled, setup the queues with the - defaults */ - mwifiex_wmm_setup_queue_priorities(priv, NULL); - mwifiex_wmm_setup_ac_downgrade(priv); - } - - if (enable_data) - dev_dbg(priv->adapter->dev, - "info: post association, re-enabling data flow\n"); - - /* Reset SNR/NF/RSSI values */ - priv->data_rssi_last = 0; - priv->data_nf_last = 0; - priv->data_rssi_avg = 0; - priv->data_nf_avg = 0; - priv->bcn_rssi_last = 0; - priv->bcn_nf_last = 0; - priv->bcn_rssi_avg = 0; - priv->bcn_nf_avg = 0; - priv->rxpd_rate = 0; - priv->rxpd_htinfo = 0; - - mwifiex_save_curr_bcn(priv); - - priv->adapter->dbg.num_cmd_assoc_success++; - - dev_dbg(priv->adapter->dev, "info: ASSOC_RESP: associated\n"); - - /* Add the ra_list here for infra mode as there will be only 1 ra - always */ - mwifiex_ralist_add(priv, - priv->curr_bss_params.bss_descriptor.mac_address); - - if (!netif_carrier_ok(priv->netdev)) - netif_carrier_on(priv->netdev); - mwifiex_wake_up_net_dev_queue(priv->netdev, adapter); - - if (priv->sec_info.wpa_enabled || priv->sec_info.wpa2_enabled) - priv->scan_block = true; - -done: - /* Need to indicate IOCTL complete */ - if (adapter->curr_cmd->wait_q_enabled) { - if (ret) - adapter->cmd_wait_q.status = -1; - else - adapter->cmd_wait_q.status = 0; - } - - return ret; -} - -/* - * This function prepares command for ad-hoc start. - * - * Driver will fill up SSID, BSS mode, IBSS parameters, physical - * parameters, probe delay, and capability information. Firmware - * will fill up beacon period, basic rates and operational rates. - * - * In addition, the following TLVs are added - - * - Channel TLV - * - Vendor specific IE - * - WPA/WPA2 IE - * - HT Capabilities IE - * - HT Information IE - * - * Preparation also includes - - * - Setting command ID and proper size - * - Ensuring correct endian-ness - */ -int -mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - struct cfg80211_ssid *req_ssid) -{ - int rsn_ie_len = 0; - struct mwifiex_adapter *adapter = priv->adapter; - struct host_cmd_ds_802_11_ad_hoc_start *adhoc_start = - &cmd->params.adhoc_start; - struct mwifiex_bssdescriptor *bss_desc; - u32 cmd_append_size = 0; - u32 i; - u16 tmp_cap; - struct mwifiex_ie_types_chan_list_param_set *chan_tlv; - u8 radio_type; - - struct mwifiex_ie_types_htcap *ht_cap; - struct mwifiex_ie_types_htinfo *ht_info; - u8 *pos = (u8 *) adhoc_start + - sizeof(struct host_cmd_ds_802_11_ad_hoc_start); - - if (!adapter) - return -1; - - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_AD_HOC_START); - - bss_desc = &priv->curr_bss_params.bss_descriptor; - priv->attempted_bss_desc = bss_desc; - - /* - * Fill in the parameters for 2 data structures: - * 1. struct host_cmd_ds_802_11_ad_hoc_start command - * 2. bss_desc - * Driver will fill up SSID, bss_mode,IBSS param, Physical Param, - * probe delay, and Cap info. - * Firmware will fill up beacon period, Basic rates - * and operational rates. - */ - - memset(adhoc_start->ssid, 0, IEEE80211_MAX_SSID_LEN); - - memcpy(adhoc_start->ssid, req_ssid->ssid, req_ssid->ssid_len); - - dev_dbg(adapter->dev, "info: ADHOC_S_CMD: SSID = %s\n", - adhoc_start->ssid); - - memset(bss_desc->ssid.ssid, 0, IEEE80211_MAX_SSID_LEN); - memcpy(bss_desc->ssid.ssid, req_ssid->ssid, req_ssid->ssid_len); - - bss_desc->ssid.ssid_len = req_ssid->ssid_len; - - /* Set the BSS mode */ - adhoc_start->bss_mode = HostCmd_BSS_MODE_IBSS; - bss_desc->bss_mode = NL80211_IFTYPE_ADHOC; - adhoc_start->beacon_period = cpu_to_le16(priv->beacon_period); - bss_desc->beacon_period = priv->beacon_period; - - /* Set Physical param set */ -/* Parameter IE Id */ -#define DS_PARA_IE_ID 3 -/* Parameter IE length */ -#define DS_PARA_IE_LEN 1 - - adhoc_start->phy_param_set.ds_param_set.element_id = DS_PARA_IE_ID; - adhoc_start->phy_param_set.ds_param_set.len = DS_PARA_IE_LEN; - - if (!mwifiex_get_cfp(priv, adapter->adhoc_start_band, - (u16) priv->adhoc_channel, 0)) { - struct mwifiex_chan_freq_power *cfp; - cfp = mwifiex_get_cfp(priv, adapter->adhoc_start_band, - FIRST_VALID_CHANNEL, 0); - if (cfp) - priv->adhoc_channel = (u8) cfp->channel; - } - - if (!priv->adhoc_channel) { - dev_err(adapter->dev, "ADHOC_S_CMD: adhoc_channel cannot be 0\n"); - return -1; - } - - dev_dbg(adapter->dev, "info: ADHOC_S_CMD: creating ADHOC on channel %d\n", - priv->adhoc_channel); - - priv->curr_bss_params.bss_descriptor.channel = priv->adhoc_channel; - priv->curr_bss_params.band = adapter->adhoc_start_band; - - bss_desc->channel = priv->adhoc_channel; - adhoc_start->phy_param_set.ds_param_set.current_chan = - priv->adhoc_channel; - - memcpy(&bss_desc->phy_param_set, &adhoc_start->phy_param_set, - sizeof(union ieee_types_phy_param_set)); - - /* Set IBSS param set */ -/* IBSS parameter IE Id */ -#define IBSS_PARA_IE_ID 6 -/* IBSS parameter IE length */ -#define IBSS_PARA_IE_LEN 2 - - adhoc_start->ss_param_set.ibss_param_set.element_id = IBSS_PARA_IE_ID; - adhoc_start->ss_param_set.ibss_param_set.len = IBSS_PARA_IE_LEN; - adhoc_start->ss_param_set.ibss_param_set.atim_window - = cpu_to_le16(priv->atim_window); - memcpy(&bss_desc->ss_param_set, &adhoc_start->ss_param_set, - sizeof(union ieee_types_ss_param_set)); - - /* Set Capability info */ - bss_desc->cap_info_bitmap |= WLAN_CAPABILITY_IBSS; - tmp_cap = le16_to_cpu(adhoc_start->cap_info_bitmap); - tmp_cap &= ~WLAN_CAPABILITY_ESS; - tmp_cap |= WLAN_CAPABILITY_IBSS; - - /* Set up privacy in bss_desc */ - if (priv->sec_info.encryption_mode) { - /* Ad-Hoc capability privacy on */ - dev_dbg(adapter->dev, - "info: ADHOC_S_CMD: wep_status set privacy to WEP\n"); - bss_desc->privacy = MWIFIEX_802_11_PRIV_FILTER_8021X_WEP; - tmp_cap |= WLAN_CAPABILITY_PRIVACY; - } else { - dev_dbg(adapter->dev, "info: ADHOC_S_CMD: wep_status NOT set," - " setting privacy to ACCEPT ALL\n"); - bss_desc->privacy = MWIFIEX_802_11_PRIV_FILTER_ACCEPT_ALL; - } - - memset(adhoc_start->data_rate, 0, sizeof(adhoc_start->data_rate)); - mwifiex_get_active_data_rates(priv, adhoc_start->data_rate); - if ((adapter->adhoc_start_band & BAND_G) && - (priv->curr_pkt_filter & HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON)) { - if (mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL, - HostCmd_ACT_GEN_SET, 0, - &priv->curr_pkt_filter)) { - dev_err(adapter->dev, - "ADHOC_S_CMD: G Protection config failed\n"); - return -1; - } - } - /* Find the last non zero */ - for (i = 0; i < sizeof(adhoc_start->data_rate); i++) - if (!adhoc_start->data_rate[i]) - break; - - priv->curr_bss_params.num_of_rates = i; - - /* Copy the ad-hoc creating rates into Current BSS rate structure */ - memcpy(&priv->curr_bss_params.data_rates, - &adhoc_start->data_rate, priv->curr_bss_params.num_of_rates); - - dev_dbg(adapter->dev, "info: ADHOC_S_CMD: rates=%02x %02x %02x %02x\n", - adhoc_start->data_rate[0], adhoc_start->data_rate[1], - adhoc_start->data_rate[2], adhoc_start->data_rate[3]); - - dev_dbg(adapter->dev, "info: ADHOC_S_CMD: AD-HOC Start command is ready\n"); - - if (IS_SUPPORT_MULTI_BANDS(adapter)) { - /* Append a channel TLV */ - chan_tlv = (struct mwifiex_ie_types_chan_list_param_set *) pos; - chan_tlv->header.type = cpu_to_le16(TLV_TYPE_CHANLIST); - chan_tlv->header.len = - cpu_to_le16(sizeof(struct mwifiex_chan_scan_param_set)); - - memset(chan_tlv->chan_scan_param, 0x00, - sizeof(struct mwifiex_chan_scan_param_set)); - chan_tlv->chan_scan_param[0].chan_number = - (u8) priv->curr_bss_params.bss_descriptor.channel; - - dev_dbg(adapter->dev, "info: ADHOC_S_CMD: TLV Chan = %d\n", - chan_tlv->chan_scan_param[0].chan_number); - - chan_tlv->chan_scan_param[0].radio_type - = mwifiex_band_to_radio_type(priv->curr_bss_params.band); - if (adapter->adhoc_start_band & BAND_GN || - adapter->adhoc_start_band & BAND_AN) { - if (adapter->sec_chan_offset == - IEEE80211_HT_PARAM_CHA_SEC_ABOVE) - chan_tlv->chan_scan_param[0].radio_type |= - (IEEE80211_HT_PARAM_CHA_SEC_ABOVE << 4); - else if (adapter->sec_chan_offset == - IEEE80211_HT_PARAM_CHA_SEC_ABOVE) - chan_tlv->chan_scan_param[0].radio_type |= - (IEEE80211_HT_PARAM_CHA_SEC_BELOW << 4); - } - dev_dbg(adapter->dev, "info: ADHOC_S_CMD: TLV Band = %d\n", - chan_tlv->chan_scan_param[0].radio_type); - pos += sizeof(chan_tlv->header) + - sizeof(struct mwifiex_chan_scan_param_set); - cmd_append_size += - sizeof(chan_tlv->header) + - sizeof(struct mwifiex_chan_scan_param_set); - } - - /* Append vendor specific IE TLV */ - cmd_append_size += mwifiex_cmd_append_vsie_tlv(priv, - MWIFIEX_VSIE_MASK_ADHOC, &pos); - - if (priv->sec_info.wpa_enabled) { - rsn_ie_len = mwifiex_append_rsn_ie_wpa_wpa2(priv, &pos); - if (rsn_ie_len == -1) - return -1; - cmd_append_size += rsn_ie_len; - } - - if (adapter->adhoc_11n_enabled) { - /* Fill HT CAPABILITY */ - ht_cap = (struct mwifiex_ie_types_htcap *) pos; - memset(ht_cap, 0, sizeof(struct mwifiex_ie_types_htcap)); - ht_cap->header.type = cpu_to_le16(WLAN_EID_HT_CAPABILITY); - ht_cap->header.len = - cpu_to_le16(sizeof(struct ieee80211_ht_cap)); - radio_type = mwifiex_band_to_radio_type( - priv->adapter->config_bands); - mwifiex_fill_cap_info(priv, radio_type, ht_cap); - - if (adapter->sec_chan_offset == - IEEE80211_HT_PARAM_CHA_SEC_NONE) { - u16 tmp_ht_cap; - - tmp_ht_cap = le16_to_cpu(ht_cap->ht_cap.cap_info); - tmp_ht_cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; - tmp_ht_cap &= ~IEEE80211_HT_CAP_SGI_40; - ht_cap->ht_cap.cap_info = cpu_to_le16(tmp_ht_cap); - } - - pos += sizeof(struct mwifiex_ie_types_htcap); - cmd_append_size += sizeof(struct mwifiex_ie_types_htcap); - - /* Fill HT INFORMATION */ - ht_info = (struct mwifiex_ie_types_htinfo *) pos; - memset(ht_info, 0, sizeof(struct mwifiex_ie_types_htinfo)); - ht_info->header.type = cpu_to_le16(WLAN_EID_HT_OPERATION); - ht_info->header.len = - cpu_to_le16(sizeof(struct ieee80211_ht_operation)); - - ht_info->ht_oper.primary_chan = - (u8) priv->curr_bss_params.bss_descriptor.channel; - if (adapter->sec_chan_offset) { - ht_info->ht_oper.ht_param = adapter->sec_chan_offset; - ht_info->ht_oper.ht_param |= - IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; - } - ht_info->ht_oper.operation_mode = - cpu_to_le16(IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); - ht_info->ht_oper.basic_set[0] = 0xff; - pos += sizeof(struct mwifiex_ie_types_htinfo); - cmd_append_size += - sizeof(struct mwifiex_ie_types_htinfo); - } - - cmd->size = - cpu_to_le16((u16)(sizeof(struct host_cmd_ds_802_11_ad_hoc_start) - + S_DS_GEN + cmd_append_size)); - - if (adapter->adhoc_start_band == BAND_B) - tmp_cap &= ~WLAN_CAPABILITY_SHORT_SLOT_TIME; - else - tmp_cap |= WLAN_CAPABILITY_SHORT_SLOT_TIME; - - adhoc_start->cap_info_bitmap = cpu_to_le16(tmp_cap); - - return 0; -} - -/* - * This function prepares command for ad-hoc join. - * - * Most of the parameters are set up by copying from the target BSS descriptor - * from the scan response. - * - * In addition, the following TLVs are added - - * - Channel TLV - * - Vendor specific IE - * - WPA/WPA2 IE - * - 11n IE - * - * Preparation also includes - - * - Setting command ID and proper size - * - Ensuring correct endian-ness - */ -int -mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - struct mwifiex_bssdescriptor *bss_desc) -{ - int rsn_ie_len = 0; - struct host_cmd_ds_802_11_ad_hoc_join *adhoc_join = - &cmd->params.adhoc_join; - struct mwifiex_ie_types_chan_list_param_set *chan_tlv; - u32 cmd_append_size = 0; - u16 tmp_cap; - u32 i, rates_size = 0; - u16 curr_pkt_filter; - u8 *pos = - (u8 *) adhoc_join + - sizeof(struct host_cmd_ds_802_11_ad_hoc_join); - -/* Use G protection */ -#define USE_G_PROTECTION 0x02 - if (bss_desc->erp_flags & USE_G_PROTECTION) { - curr_pkt_filter = - priv-> - curr_pkt_filter | HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON; - - if (mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL, - HostCmd_ACT_GEN_SET, 0, - &curr_pkt_filter)) { - dev_err(priv->adapter->dev, - "ADHOC_J_CMD: G Protection config failed\n"); - return -1; - } - } - - priv->attempted_bss_desc = bss_desc; - - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_AD_HOC_JOIN); - - adhoc_join->bss_descriptor.bss_mode = HostCmd_BSS_MODE_IBSS; - - adhoc_join->bss_descriptor.beacon_period - = cpu_to_le16(bss_desc->beacon_period); - - memcpy(&adhoc_join->bss_descriptor.bssid, - &bss_desc->mac_address, ETH_ALEN); - - memcpy(&adhoc_join->bss_descriptor.ssid, - &bss_desc->ssid.ssid, bss_desc->ssid.ssid_len); - - memcpy(&adhoc_join->bss_descriptor.phy_param_set, - &bss_desc->phy_param_set, - sizeof(union ieee_types_phy_param_set)); - - memcpy(&adhoc_join->bss_descriptor.ss_param_set, - &bss_desc->ss_param_set, sizeof(union ieee_types_ss_param_set)); - - tmp_cap = bss_desc->cap_info_bitmap; - - tmp_cap &= CAPINFO_MASK; - - dev_dbg(priv->adapter->dev, - "info: ADHOC_J_CMD: tmp_cap=%4X CAPINFO_MASK=%4lX\n", - tmp_cap, CAPINFO_MASK); - - /* Information on BSSID descriptor passed to FW */ - dev_dbg(priv->adapter->dev, "info: ADHOC_J_CMD: BSSID=%pM, SSID='%s'\n", - adhoc_join->bss_descriptor.bssid, - adhoc_join->bss_descriptor.ssid); - - for (i = 0; i < MWIFIEX_SUPPORTED_RATES && - bss_desc->supported_rates[i]; i++) - ; - rates_size = i; - - /* Copy Data Rates from the Rates recorded in scan response */ - memset(adhoc_join->bss_descriptor.data_rates, 0, - sizeof(adhoc_join->bss_descriptor.data_rates)); - memcpy(adhoc_join->bss_descriptor.data_rates, - bss_desc->supported_rates, rates_size); - - /* Copy the adhoc join rates into Current BSS state structure */ - priv->curr_bss_params.num_of_rates = rates_size; - memcpy(&priv->curr_bss_params.data_rates, bss_desc->supported_rates, - rates_size); - - /* Copy the channel information */ - priv->curr_bss_params.bss_descriptor.channel = bss_desc->channel; - priv->curr_bss_params.band = (u8) bss_desc->bss_band; - - if (priv->sec_info.wep_enabled || priv->sec_info.wpa_enabled) - tmp_cap |= WLAN_CAPABILITY_PRIVACY; - - if (IS_SUPPORT_MULTI_BANDS(priv->adapter)) { - /* Append a channel TLV */ - chan_tlv = (struct mwifiex_ie_types_chan_list_param_set *) pos; - chan_tlv->header.type = cpu_to_le16(TLV_TYPE_CHANLIST); - chan_tlv->header.len = - cpu_to_le16(sizeof(struct mwifiex_chan_scan_param_set)); - - memset(chan_tlv->chan_scan_param, 0x00, - sizeof(struct mwifiex_chan_scan_param_set)); - chan_tlv->chan_scan_param[0].chan_number = - (bss_desc->phy_param_set.ds_param_set.current_chan); - dev_dbg(priv->adapter->dev, "info: ADHOC_J_CMD: TLV Chan=%d\n", - chan_tlv->chan_scan_param[0].chan_number); - - chan_tlv->chan_scan_param[0].radio_type = - mwifiex_band_to_radio_type((u8) bss_desc->bss_band); - - dev_dbg(priv->adapter->dev, "info: ADHOC_J_CMD: TLV Band=%d\n", - chan_tlv->chan_scan_param[0].radio_type); - pos += sizeof(chan_tlv->header) + - sizeof(struct mwifiex_chan_scan_param_set); - cmd_append_size += sizeof(chan_tlv->header) + - sizeof(struct mwifiex_chan_scan_param_set); - } - - if (priv->sec_info.wpa_enabled) - rsn_ie_len = mwifiex_append_rsn_ie_wpa_wpa2(priv, &pos); - if (rsn_ie_len == -1) - return -1; - cmd_append_size += rsn_ie_len; - - if (ISSUPP_11NENABLED(priv->adapter->fw_cap_info)) - cmd_append_size += mwifiex_cmd_append_11n_tlv(priv, - bss_desc, &pos); - - /* Append vendor specific IE TLV */ - cmd_append_size += mwifiex_cmd_append_vsie_tlv(priv, - MWIFIEX_VSIE_MASK_ADHOC, &pos); - - cmd->size = cpu_to_le16 - ((u16) (sizeof(struct host_cmd_ds_802_11_ad_hoc_join) - + S_DS_GEN + cmd_append_size)); - - adhoc_join->bss_descriptor.cap_info_bitmap = cpu_to_le16(tmp_cap); - - return 0; -} - -/* - * This function handles the command response of ad-hoc start and - * ad-hoc join. - * - * The function generates a device-connected event to notify - * the applications, in case of successful ad-hoc start/join, and - * saves the beacon buffer. - */ -int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - int ret = 0; - struct mwifiex_adapter *adapter = priv->adapter; - struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result; - struct mwifiex_bssdescriptor *bss_desc; - u16 reason_code; - - adhoc_result = &resp->params.adhoc_result; - - bss_desc = priv->attempted_bss_desc; - - /* Join result code 0 --> SUCCESS */ - reason_code = le16_to_cpu(resp->result); - if (reason_code) { - dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n"); - if (priv->media_connected) - mwifiex_reset_connect_state(priv, reason_code); - - memset(&priv->curr_bss_params.bss_descriptor, - 0x00, sizeof(struct mwifiex_bssdescriptor)); - - ret = -1; - goto done; - } - - /* Send a Media Connected event, according to the Spec */ - priv->media_connected = true; - - if (le16_to_cpu(resp->command) == HostCmd_CMD_802_11_AD_HOC_START) { - dev_dbg(priv->adapter->dev, "info: ADHOC_S_RESP %s\n", - bss_desc->ssid.ssid); - - /* Update the created network descriptor with the new BSSID */ - memcpy(bss_desc->mac_address, - adhoc_result->bssid, ETH_ALEN); - - priv->adhoc_state = ADHOC_STARTED; - } else { - /* - * Now the join cmd should be successful. - * If BSSID has changed use SSID to compare instead of BSSID - */ - dev_dbg(priv->adapter->dev, "info: ADHOC_J_RESP %s\n", - bss_desc->ssid.ssid); - - /* - * Make a copy of current BSSID descriptor, only needed for - * join since the current descriptor is already being used - * for adhoc start - */ - memcpy(&priv->curr_bss_params.bss_descriptor, - bss_desc, sizeof(struct mwifiex_bssdescriptor)); - - priv->adhoc_state = ADHOC_JOINED; - } - - dev_dbg(priv->adapter->dev, "info: ADHOC_RESP: channel = %d\n", - priv->adhoc_channel); - dev_dbg(priv->adapter->dev, "info: ADHOC_RESP: BSSID = %pM\n", - priv->curr_bss_params.bss_descriptor.mac_address); - - if (!netif_carrier_ok(priv->netdev)) - netif_carrier_on(priv->netdev); - mwifiex_wake_up_net_dev_queue(priv->netdev, adapter); - - mwifiex_save_curr_bcn(priv); - -done: - /* Need to indicate IOCTL complete */ - if (adapter->curr_cmd->wait_q_enabled) { - if (ret) - adapter->cmd_wait_q.status = -1; - else - adapter->cmd_wait_q.status = 0; - - } - - return ret; -} - -/* - * This function associates to a specific BSS discovered in a scan. - * - * It clears any past association response stored for application - * retrieval and calls the command preparation routine to send the - * command to firmware. - */ -int mwifiex_associate(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc) -{ - u8 current_bssid[ETH_ALEN]; - - /* Return error if the adapter is not STA role or table entry - * is not marked as infra. - */ - if ((GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) || - (bss_desc->bss_mode != NL80211_IFTYPE_STATION)) - return -1; - - if (ISSUPP_11ACENABLED(priv->adapter->fw_cap_info) && - !bss_desc->disable_11n && !bss_desc->disable_11ac && - (priv->adapter->config_bands & BAND_GAC || - priv->adapter->config_bands & BAND_AAC)) - mwifiex_set_11ac_ba_params(priv); - else - mwifiex_set_ba_params(priv); - - memcpy(¤t_bssid, - &priv->curr_bss_params.bss_descriptor.mac_address, - sizeof(current_bssid)); - - /* Clear any past association response stored for application - retrieval */ - priv->assoc_rsp_size = 0; - - return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_ASSOCIATE, - HostCmd_ACT_GEN_SET, 0, bss_desc); -} - -/* - * This function starts an ad-hoc network. - * - * It calls the command preparation routine to send the command to firmware. - */ -int -mwifiex_adhoc_start(struct mwifiex_private *priv, - struct cfg80211_ssid *adhoc_ssid) -{ - dev_dbg(priv->adapter->dev, "info: Adhoc Channel = %d\n", - priv->adhoc_channel); - dev_dbg(priv->adapter->dev, "info: curr_bss_params.channel = %d\n", - priv->curr_bss_params.bss_descriptor.channel); - dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %d\n", - priv->curr_bss_params.band); - - if (ISSUPP_11ACENABLED(priv->adapter->fw_cap_info) && - (priv->adapter->config_bands & BAND_GAC || - priv->adapter->config_bands & BAND_AAC)) - mwifiex_set_11ac_ba_params(priv); - else - mwifiex_set_ba_params(priv); - - return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_AD_HOC_START, - HostCmd_ACT_GEN_SET, 0, adhoc_ssid); -} - -/* - * This function joins an ad-hoc network found in a previous scan. - * - * It calls the command preparation routine to send the command to firmware, - * if already not connected to the requested SSID. - */ -int mwifiex_adhoc_join(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc) -{ - dev_dbg(priv->adapter->dev, "info: adhoc join: curr_bss ssid =%s\n", - priv->curr_bss_params.bss_descriptor.ssid.ssid); - dev_dbg(priv->adapter->dev, "info: adhoc join: curr_bss ssid_len =%u\n", - priv->curr_bss_params.bss_descriptor.ssid.ssid_len); - dev_dbg(priv->adapter->dev, "info: adhoc join: ssid =%s\n", - bss_desc->ssid.ssid); - dev_dbg(priv->adapter->dev, "info: adhoc join: ssid_len =%u\n", - bss_desc->ssid.ssid_len); - - /* Check if the requested SSID is already joined */ - if (priv->curr_bss_params.bss_descriptor.ssid.ssid_len && - !mwifiex_ssid_cmp(&bss_desc->ssid, - &priv->curr_bss_params.bss_descriptor.ssid) && - (priv->curr_bss_params.bss_descriptor.bss_mode == - NL80211_IFTYPE_ADHOC)) { - dev_dbg(priv->adapter->dev, "info: ADHOC_J_CMD: new ad-hoc SSID" - " is the same as current; not attempting to re-join\n"); - return -1; - } - - if (ISSUPP_11ACENABLED(priv->adapter->fw_cap_info) && - !bss_desc->disable_11n && !bss_desc->disable_11ac && - (priv->adapter->config_bands & BAND_GAC || - priv->adapter->config_bands & BAND_AAC)) - mwifiex_set_11ac_ba_params(priv); - else - mwifiex_set_ba_params(priv); - - dev_dbg(priv->adapter->dev, "info: curr_bss_params.channel = %d\n", - priv->curr_bss_params.bss_descriptor.channel); - dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %c\n", - priv->curr_bss_params.band); - - return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_AD_HOC_JOIN, - HostCmd_ACT_GEN_SET, 0, bss_desc); -} - -/* - * This function deauthenticates/disconnects from infra network by sending - * deauthentication request. - */ -static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, u8 *mac) -{ - u8 mac_address[ETH_ALEN]; - int ret; - - if (!mac || is_zero_ether_addr(mac)) - memcpy(mac_address, - priv->curr_bss_params.bss_descriptor.mac_address, - ETH_ALEN); - else - memcpy(mac_address, mac, ETH_ALEN); - - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_DEAUTHENTICATE, - HostCmd_ACT_GEN_SET, 0, mac_address); - - return ret; -} - -/* - * This function deauthenticates/disconnects from a BSS. - * - * In case of infra made, it sends deauthentication request, and - * in case of ad-hoc mode, a stop network request is sent to the firmware. - * In AP mode, a command to stop bss is sent to firmware. - */ -int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac) -{ - if (!priv->media_connected) - return 0; - - switch (priv->bss_mode) { - case NL80211_IFTYPE_STATION: - return mwifiex_deauthenticate_infra(priv, mac); - case NL80211_IFTYPE_ADHOC: - return mwifiex_send_cmd_sync(priv, - HostCmd_CMD_802_11_AD_HOC_STOP, - HostCmd_ACT_GEN_SET, 0, NULL); - case NL80211_IFTYPE_AP: - return mwifiex_send_cmd_sync(priv, HostCmd_CMD_UAP_BSS_STOP, - HostCmd_ACT_GEN_SET, 0, NULL); - default: - break; - } - - return 0; -} -EXPORT_SYMBOL_GPL(mwifiex_deauthenticate); - -/* - * This function converts band to radio type used in channel TLV. - */ -u8 -mwifiex_band_to_radio_type(u8 band) -{ - switch (band) { - case BAND_A: - case BAND_AN: - case BAND_A | BAND_AN: - case BAND_A | BAND_AN | BAND_AAC: - return HostCmd_SCAN_RADIO_TYPE_A; - case BAND_B: - case BAND_G: - case BAND_B | BAND_G: - default: - return HostCmd_SCAN_RADIO_TYPE_BG; - } -} diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c deleted file mode 100644 index fc3fe8ddcf62..000000000000 --- a/drivers/net/wireless/mwifiex/main.c +++ /dev/null @@ -1,918 +0,0 @@ -/* - * Marvell Wireless LAN device driver: major functions - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "main.h" -#include "wmm.h" -#include "cfg80211.h" -#include "11n.h" - -#define VERSION "1.0" - -const char driver_version[] = "mwifiex " VERSION " (%s) "; - -/* - * This function registers the device and performs all the necessary - * initializations. - * - * The following initialization operations are performed - - * - Allocate adapter structure - * - Save interface specific operations table in adapter - * - Call interface specific initialization routine - * - Allocate private structures - * - Set default adapter structure parameters - * - Initialize locks - * - * In case of any errors during inittialization, this function also ensures - * proper cleanup before exiting. - */ -static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops, - void **padapter) -{ - struct mwifiex_adapter *adapter; - int i; - - adapter = kzalloc(sizeof(struct mwifiex_adapter), GFP_KERNEL); - if (!adapter) - return -ENOMEM; - - *padapter = adapter; - adapter->card = card; - - /* Save interface specific operations in adapter */ - memmove(&adapter->if_ops, if_ops, sizeof(struct mwifiex_if_ops)); - - /* card specific initialization has been deferred until now .. */ - if (adapter->if_ops.init_if) - if (adapter->if_ops.init_if(adapter)) - goto error; - - adapter->priv_num = 0; - - for (i = 0; i < MWIFIEX_MAX_BSS_NUM; i++) { - /* Allocate memory for private structure */ - adapter->priv[i] = - kzalloc(sizeof(struct mwifiex_private), GFP_KERNEL); - if (!adapter->priv[i]) - goto error; - - adapter->priv[i]->adapter = adapter; - adapter->priv_num++; - } - mwifiex_init_lock_list(adapter); - - init_timer(&adapter->cmd_timer); - adapter->cmd_timer.function = mwifiex_cmd_timeout_func; - adapter->cmd_timer.data = (unsigned long) adapter; - - return 0; - -error: - dev_dbg(adapter->dev, "info: leave mwifiex_register with error\n"); - - for (i = 0; i < adapter->priv_num; i++) - kfree(adapter->priv[i]); - - kfree(adapter); - - return -1; -} - -/* - * This function unregisters the device and performs all the necessary - * cleanups. - * - * The following cleanup operations are performed - - * - Free the timers - * - Free beacon buffers - * - Free private structures - * - Free adapter structure - */ -static int mwifiex_unregister(struct mwifiex_adapter *adapter) -{ - s32 i; - - del_timer(&adapter->cmd_timer); - - /* Free private structures */ - for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - mwifiex_free_curr_bcn(adapter->priv[i]); - kfree(adapter->priv[i]); - } - } - - kfree(adapter); - return 0; -} - -/* - * The main process. - * - * This function is the main procedure of the driver and handles various driver - * operations. It runs in a loop and provides the core functionalities. - * - * The main responsibilities of this function are - - * - Ensure concurrency control - * - Handle pending interrupts and call interrupt handlers - * - Wake up the card if required - * - Handle command responses and call response handlers - * - Handle events and call event handlers - * - Execute pending commands - * - Transmit pending data packets - */ -int mwifiex_main_process(struct mwifiex_adapter *adapter) -{ - int ret = 0; - unsigned long flags; - struct sk_buff *skb; - - spin_lock_irqsave(&adapter->main_proc_lock, flags); - - /* Check if already processing */ - if (adapter->mwifiex_processing) { - spin_unlock_irqrestore(&adapter->main_proc_lock, flags); - goto exit_main_proc; - } else { - adapter->mwifiex_processing = true; - spin_unlock_irqrestore(&adapter->main_proc_lock, flags); - } -process_start: - do { - if ((adapter->hw_status == MWIFIEX_HW_STATUS_CLOSING) || - (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY)) - break; - - /* Handle pending interrupt if any */ - if (adapter->int_status) { - if (adapter->hs_activated) - mwifiex_process_hs_config(adapter); - if (adapter->if_ops.process_int_status) - adapter->if_ops.process_int_status(adapter); - } - - /* Need to wake up the card ? */ - if ((adapter->ps_state == PS_STATE_SLEEP) && - (adapter->pm_wakeup_card_req && - !adapter->pm_wakeup_fw_try) && - (is_command_pending(adapter) || - !mwifiex_wmm_lists_empty(adapter))) { - adapter->pm_wakeup_fw_try = true; - adapter->if_ops.wakeup(adapter); - continue; - } - - if (IS_CARD_RX_RCVD(adapter)) { - adapter->pm_wakeup_fw_try = false; - if (adapter->ps_state == PS_STATE_SLEEP) - adapter->ps_state = PS_STATE_AWAKE; - } else { - /* We have tried to wakeup the card already */ - if (adapter->pm_wakeup_fw_try) - break; - if (adapter->ps_state != PS_STATE_AWAKE || - adapter->tx_lock_flag) - break; - - if ((adapter->scan_processing && - !adapter->scan_delay_cnt) || adapter->data_sent || - mwifiex_wmm_lists_empty(adapter)) { - if (adapter->cmd_sent || adapter->curr_cmd || - (!is_command_pending(adapter))) - break; - } - } - - /* Check Rx data for USB */ - if (adapter->iface_type == MWIFIEX_USB) - while ((skb = skb_dequeue(&adapter->usb_rx_data_q))) - mwifiex_handle_rx_packet(adapter, skb); - - /* Check for Cmd Resp */ - if (adapter->cmd_resp_received) { - adapter->cmd_resp_received = false; - mwifiex_process_cmdresp(adapter); - - /* call mwifiex back when init_fw is done */ - if (adapter->hw_status == MWIFIEX_HW_STATUS_INIT_DONE) { - adapter->hw_status = MWIFIEX_HW_STATUS_READY; - mwifiex_init_fw_complete(adapter); - } - } - - /* Check for event */ - if (adapter->event_received) { - adapter->event_received = false; - mwifiex_process_event(adapter); - } - - /* Check if we need to confirm Sleep Request - received previously */ - if (adapter->ps_state == PS_STATE_PRE_SLEEP) { - if (!adapter->cmd_sent && !adapter->curr_cmd) - mwifiex_check_ps_cond(adapter); - } - - /* * The ps_state may have been changed during processing of - * Sleep Request event. - */ - if ((adapter->ps_state == PS_STATE_SLEEP) || - (adapter->ps_state == PS_STATE_PRE_SLEEP) || - (adapter->ps_state == PS_STATE_SLEEP_CFM) || - adapter->tx_lock_flag) - continue; - - if (!adapter->cmd_sent && !adapter->curr_cmd) { - if (mwifiex_exec_next_cmd(adapter) == -1) { - ret = -1; - break; - } - } - - if ((!adapter->scan_processing || adapter->scan_delay_cnt) && - !adapter->data_sent && !mwifiex_wmm_lists_empty(adapter)) { - mwifiex_wmm_process_tx(adapter); - if (adapter->hs_activated) { - adapter->is_hs_configured = false; - mwifiex_hs_activated_event - (mwifiex_get_priv - (adapter, MWIFIEX_BSS_ROLE_ANY), - false); - } - } - - if (adapter->delay_null_pkt && !adapter->cmd_sent && - !adapter->curr_cmd && !is_command_pending(adapter) && - mwifiex_wmm_lists_empty(adapter)) { - if (!mwifiex_send_null_packet - (mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), - MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET | - MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET)) { - adapter->delay_null_pkt = false; - adapter->ps_state = PS_STATE_SLEEP; - } - break; - } - } while (true); - - spin_lock_irqsave(&adapter->main_proc_lock, flags); - if ((adapter->int_status) || IS_CARD_RX_RCVD(adapter)) { - spin_unlock_irqrestore(&adapter->main_proc_lock, flags); - goto process_start; - } - - adapter->mwifiex_processing = false; - spin_unlock_irqrestore(&adapter->main_proc_lock, flags); - -exit_main_proc: - if (adapter->hw_status == MWIFIEX_HW_STATUS_CLOSING) - mwifiex_shutdown_drv(adapter); - return ret; -} -EXPORT_SYMBOL_GPL(mwifiex_main_process); - -/* - * This function frees the adapter structure. - * - * Additionally, this closes the netlink socket, frees the timers - * and private structures. - */ -static void mwifiex_free_adapter(struct mwifiex_adapter *adapter) -{ - if (!adapter) { - pr_err("%s: adapter is NULL\n", __func__); - return; - } - - mwifiex_unregister(adapter); - pr_debug("info: %s: free adapter\n", __func__); -} - -/* - * This function gets firmware and initializes it. - * - * The main initialization steps followed are - - * - Download the correct firmware to card - * - Issue the init commands to firmware - */ -static void mwifiex_fw_dpc(const struct firmware *firmware, void *context) -{ - int ret; - char fmt[64]; - struct mwifiex_private *priv; - struct mwifiex_adapter *adapter = context; - struct mwifiex_fw_image fw; - - if (!firmware) { - dev_err(adapter->dev, - "Failed to get firmware %s\n", adapter->fw_name); - goto done; - } - - memset(&fw, 0, sizeof(struct mwifiex_fw_image)); - adapter->firmware = firmware; - fw.fw_buf = (u8 *) adapter->firmware->data; - fw.fw_len = adapter->firmware->size; - - if (adapter->if_ops.dnld_fw) - ret = adapter->if_ops.dnld_fw(adapter, &fw); - else - ret = mwifiex_dnld_fw(adapter, &fw); - if (ret == -1) - goto done; - - dev_notice(adapter->dev, "WLAN FW is active\n"); - - adapter->init_wait_q_woken = false; - ret = mwifiex_init_fw(adapter); - if (ret == -1) { - goto done; - } else if (!ret) { - adapter->hw_status = MWIFIEX_HW_STATUS_READY; - goto done; - } - /* Wait for mwifiex_init to complete */ - wait_event_interruptible(adapter->init_wait_q, - adapter->init_wait_q_woken); - if (adapter->hw_status != MWIFIEX_HW_STATUS_READY) - goto done; - - priv = adapter->priv[MWIFIEX_BSS_ROLE_STA]; - if (mwifiex_register_cfg80211(adapter)) { - dev_err(adapter->dev, "cannot register with cfg80211\n"); - goto err_init_fw; - } - - rtnl_lock(); - /* Create station interface by default */ - if (!mwifiex_add_virtual_intf(adapter->wiphy, "mlan%d", - NL80211_IFTYPE_STATION, NULL, NULL)) { - dev_err(adapter->dev, "cannot create default STA interface\n"); - goto err_add_intf; - } - rtnl_unlock(); - - mwifiex_drv_get_driver_version(adapter, fmt, sizeof(fmt) - 1); - dev_notice(adapter->dev, "driver_version = %s\n", fmt); - goto done; - -err_add_intf: - mwifiex_del_virtual_intf(adapter->wiphy, priv->wdev); - rtnl_unlock(); -err_init_fw: - pr_debug("info: %s: unregister device\n", __func__); - adapter->if_ops.unregister_dev(adapter); -done: - release_firmware(adapter->firmware); - complete(&adapter->fw_load); - return; -} - -/* - * This function initializes the hardware and gets firmware. - */ -static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter) -{ - int ret; - - init_completion(&adapter->fw_load); - ret = request_firmware_nowait(THIS_MODULE, 1, adapter->fw_name, - adapter->dev, GFP_KERNEL, adapter, - mwifiex_fw_dpc); - if (ret < 0) - dev_err(adapter->dev, - "request_firmware_nowait() returned error %d\n", ret); - return ret; -} - -/* - * CFG802.11 network device handler for open. - * - * Starts the data queue. - */ -static int -mwifiex_open(struct net_device *dev) -{ - netif_tx_start_all_queues(dev); - return 0; -} - -/* - * CFG802.11 network device handler for close. - */ -static int -mwifiex_close(struct net_device *dev) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - - if (priv->scan_request) { - dev_dbg(priv->adapter->dev, "aborting scan on ndo_stop\n"); - cfg80211_scan_done(priv->scan_request, 1); - priv->scan_request = NULL; - } - - return 0; -} - -/* - * Add buffer into wmm tx queue and queue work to transmit it. - */ -int mwifiex_queue_tx_pkt(struct mwifiex_private *priv, struct sk_buff *skb) -{ - struct netdev_queue *txq; - int index = mwifiex_1d_to_wmm_queue[skb->priority]; - - if (atomic_inc_return(&priv->wmm_tx_pending[index]) >= MAX_TX_PENDING) { - txq = netdev_get_tx_queue(priv->netdev, index); - if (!netif_tx_queue_stopped(txq)) { - netif_tx_stop_queue(txq); - dev_dbg(priv->adapter->dev, "stop queue: %d\n", index); - } - } - - atomic_inc(&priv->adapter->tx_pending); - mwifiex_wmm_add_buf_txqueue(priv, skb); - - if (priv->adapter->scan_delay_cnt) - atomic_set(&priv->adapter->is_tx_received, true); - - queue_work(priv->adapter->workqueue, &priv->adapter->main_work); - - return 0; -} - -/* - * CFG802.11 network device handler for data transmission. - */ -static int -mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - struct sk_buff *new_skb; - struct mwifiex_txinfo *tx_info; - struct timeval tv; - - dev_dbg(priv->adapter->dev, "data: %lu BSS(%d-%d): Data <= kernel\n", - jiffies, priv->bss_type, priv->bss_num); - - if (priv->adapter->surprise_removed) { - kfree_skb(skb); - priv->stats.tx_dropped++; - return 0; - } - if (!skb->len || (skb->len > ETH_FRAME_LEN)) { - dev_err(priv->adapter->dev, "Tx: bad skb len %d\n", skb->len); - kfree_skb(skb); - priv->stats.tx_dropped++; - return 0; - } - if (skb_headroom(skb) < MWIFIEX_MIN_DATA_HEADER_LEN) { - dev_dbg(priv->adapter->dev, - "data: Tx: insufficient skb headroom %d\n", - skb_headroom(skb)); - /* Insufficient skb headroom - allocate a new skb */ - new_skb = - skb_realloc_headroom(skb, MWIFIEX_MIN_DATA_HEADER_LEN); - if (unlikely(!new_skb)) { - dev_err(priv->adapter->dev, "Tx: cannot alloca new_skb\n"); - kfree_skb(skb); - priv->stats.tx_dropped++; - return 0; - } - kfree_skb(skb); - skb = new_skb; - dev_dbg(priv->adapter->dev, "info: new skb headroomd %d\n", - skb_headroom(skb)); - } - - tx_info = MWIFIEX_SKB_TXCB(skb); - tx_info->bss_num = priv->bss_num; - tx_info->bss_type = priv->bss_type; - - /* Record the current time the packet was queued; used to - * determine the amount of time the packet was queued in - * the driver before it was sent to the firmware. - * The delay is then sent along with the packet to the - * firmware for aggregate delay calculation for stats and - * MSDU lifetime expiry. - */ - do_gettimeofday(&tv); - skb->tstamp = timeval_to_ktime(tv); - - mwifiex_queue_tx_pkt(priv, skb); - - return 0; -} - -/* - * CFG802.11 network device handler for setting MAC address. - */ -static int -mwifiex_set_mac_address(struct net_device *dev, void *addr) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - struct sockaddr *hw_addr = addr; - int ret; - - memcpy(priv->curr_addr, hw_addr->sa_data, ETH_ALEN); - - /* Send request to firmware */ - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_MAC_ADDRESS, - HostCmd_ACT_GEN_SET, 0, NULL); - - if (!ret) - memcpy(priv->netdev->dev_addr, priv->curr_addr, ETH_ALEN); - else - dev_err(priv->adapter->dev, - "set mac address failed: ret=%d\n", ret); - - memcpy(dev->dev_addr, priv->curr_addr, ETH_ALEN); - - return ret; -} - -/* - * CFG802.11 network device handler for setting multicast list. - */ -static void mwifiex_set_multicast_list(struct net_device *dev) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - struct mwifiex_multicast_list mcast_list; - - if (dev->flags & IFF_PROMISC) { - mcast_list.mode = MWIFIEX_PROMISC_MODE; - } else if (dev->flags & IFF_ALLMULTI || - netdev_mc_count(dev) > MWIFIEX_MAX_MULTICAST_LIST_SIZE) { - mcast_list.mode = MWIFIEX_ALL_MULTI_MODE; - } else { - mcast_list.mode = MWIFIEX_MULTICAST_MODE; - mcast_list.num_multicast_addr = - mwifiex_copy_mcast_addr(&mcast_list, dev); - } - mwifiex_request_set_multicast_list(priv, &mcast_list); -} - -/* - * CFG802.11 network device handler for transmission timeout. - */ -static void -mwifiex_tx_timeout(struct net_device *dev) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - - priv->num_tx_timeout++; - priv->tx_timeout_cnt++; - dev_err(priv->adapter->dev, - "%lu : Tx timeout(#%d), bss_type-num = %d-%d\n", - jiffies, priv->tx_timeout_cnt, priv->bss_type, priv->bss_num); - mwifiex_set_trans_start(dev); - - if (priv->tx_timeout_cnt > TX_TIMEOUT_THRESHOLD && - priv->adapter->if_ops.card_reset) { - dev_err(priv->adapter->dev, - "tx_timeout_cnt exceeds threshold. Triggering card reset!\n"); - priv->adapter->if_ops.card_reset(priv->adapter); - } -} - -/* - * CFG802.11 network device handler for statistics retrieval. - */ -static struct net_device_stats *mwifiex_get_stats(struct net_device *dev) -{ - struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); - - return &priv->stats; -} - -static u16 -mwifiex_netdev_select_wmm_queue(struct net_device *dev, struct sk_buff *skb) -{ - skb->priority = cfg80211_classify8021d(skb); - return mwifiex_1d_to_wmm_queue[skb->priority]; -} - -/* Network device handlers */ -static const struct net_device_ops mwifiex_netdev_ops = { - .ndo_open = mwifiex_open, - .ndo_stop = mwifiex_close, - .ndo_start_xmit = mwifiex_hard_start_xmit, - .ndo_set_mac_address = mwifiex_set_mac_address, - .ndo_tx_timeout = mwifiex_tx_timeout, - .ndo_get_stats = mwifiex_get_stats, - .ndo_set_rx_mode = mwifiex_set_multicast_list, - .ndo_select_queue = mwifiex_netdev_select_wmm_queue, -}; - -/* - * This function initializes the private structure parameters. - * - * The following wait queues are initialized - - * - IOCTL wait queue - * - Command wait queue - * - Statistics wait queue - * - * ...and the following default parameters are set - - * - Current key index : Set to 0 - * - Rate index : Set to auto - * - Media connected : Set to disconnected - * - Adhoc link sensed : Set to false - * - Nick name : Set to null - * - Number of Tx timeout : Set to 0 - * - Device address : Set to current address - * - * In addition, the CFG80211 work queue is also created. - */ -void mwifiex_init_priv_params(struct mwifiex_private *priv, - struct net_device *dev) -{ - dev->netdev_ops = &mwifiex_netdev_ops; - dev->destructor = free_netdev; - /* Initialize private structure */ - priv->current_key_index = 0; - priv->media_connected = false; - memset(&priv->nick_name, 0, sizeof(priv->nick_name)); - memset(priv->mgmt_ie, 0, - sizeof(struct mwifiex_ie) * MAX_MGMT_IE_INDEX); - priv->beacon_idx = MWIFIEX_AUTO_IDX_MASK; - priv->proberesp_idx = MWIFIEX_AUTO_IDX_MASK; - priv->assocresp_idx = MWIFIEX_AUTO_IDX_MASK; - priv->rsn_idx = MWIFIEX_AUTO_IDX_MASK; - priv->num_tx_timeout = 0; - memcpy(dev->dev_addr, priv->curr_addr, ETH_ALEN); -} - -/* - * This function check if command is pending. - */ -int is_command_pending(struct mwifiex_adapter *adapter) -{ - unsigned long flags; - int is_cmd_pend_q_empty; - - spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags); - is_cmd_pend_q_empty = list_empty(&adapter->cmd_pending_q); - spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags); - - return !is_cmd_pend_q_empty; -} - -/* - * This is the main work queue function. - * - * It handles the main process, which in turn handles the complete - * driver operations. - */ -static void mwifiex_main_work_queue(struct work_struct *work) -{ - struct mwifiex_adapter *adapter = - container_of(work, struct mwifiex_adapter, main_work); - - if (adapter->surprise_removed) - return; - mwifiex_main_process(adapter); -} - -/* - * This function cancels all works in the queue and destroys - * the main workqueue. - */ -static void -mwifiex_terminate_workqueue(struct mwifiex_adapter *adapter) -{ - flush_workqueue(adapter->workqueue); - destroy_workqueue(adapter->workqueue); - adapter->workqueue = NULL; -} - -/* - * This function adds the card. - * - * This function follows the following major steps to set up the device - - * - Initialize software. This includes probing the card, registering - * the interface operations table, and allocating/initializing the - * adapter structure - * - Set up the netlink socket - * - Create and start the main work queue - * - Register the device - * - Initialize firmware and hardware - * - Add logical interfaces - */ -int -mwifiex_add_card(void *card, struct semaphore *sem, - struct mwifiex_if_ops *if_ops, u8 iface_type) -{ - struct mwifiex_adapter *adapter; - - if (down_interruptible(sem)) - goto exit_sem_err; - - if (mwifiex_register(card, if_ops, (void **)&adapter)) { - pr_err("%s: software init failed\n", __func__); - goto err_init_sw; - } - - adapter->iface_type = iface_type; - - adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING; - adapter->surprise_removed = false; - init_waitqueue_head(&adapter->init_wait_q); - adapter->is_suspended = false; - adapter->hs_activated = false; - init_waitqueue_head(&adapter->hs_activate_wait_q); - adapter->cmd_wait_q_required = false; - init_waitqueue_head(&adapter->cmd_wait_q.wait); - adapter->cmd_wait_q.status = 0; - adapter->scan_wait_q_woken = false; - - adapter->workqueue = create_workqueue("MWIFIEX_WORK_QUEUE"); - if (!adapter->workqueue) - goto err_kmalloc; - - INIT_WORK(&adapter->main_work, mwifiex_main_work_queue); - - /* Register the device. Fill up the private data structure with relevant - information from the card and request for the required IRQ. */ - if (adapter->if_ops.register_dev(adapter)) { - pr_err("%s: failed to register mwifiex device\n", __func__); - goto err_registerdev; - } - - if (mwifiex_init_hw_fw(adapter)) { - pr_err("%s: firmware init failed\n", __func__); - goto err_init_fw; - } - - up(sem); - return 0; - -err_init_fw: - pr_debug("info: %s: unregister device\n", __func__); - if (adapter->if_ops.unregister_dev) - adapter->if_ops.unregister_dev(adapter); -err_registerdev: - adapter->surprise_removed = true; - mwifiex_terminate_workqueue(adapter); -err_kmalloc: - if ((adapter->hw_status == MWIFIEX_HW_STATUS_FW_READY) || - (adapter->hw_status == MWIFIEX_HW_STATUS_READY)) { - pr_debug("info: %s: shutdown mwifiex\n", __func__); - adapter->init_wait_q_woken = false; - - if (mwifiex_shutdown_drv(adapter) == -EINPROGRESS) - wait_event_interruptible(adapter->init_wait_q, - adapter->init_wait_q_woken); - } - - mwifiex_free_adapter(adapter); - -err_init_sw: - up(sem); - -exit_sem_err: - return -1; -} -EXPORT_SYMBOL_GPL(mwifiex_add_card); - -/* - * This function removes the card. - * - * This function follows the following major steps to remove the device - - * - Stop data traffic - * - Shutdown firmware - * - Remove the logical interfaces - * - Terminate the work queue - * - Unregister the device - * - Free the adapter structure - */ -int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) -{ - struct mwifiex_private *priv = NULL; - int i; - - if (down_interruptible(sem)) - goto exit_sem_err; - - if (!adapter) - goto exit_remove; - - adapter->surprise_removed = true; - - /* Stop data */ - for (i = 0; i < adapter->priv_num; i++) { - priv = adapter->priv[i]; - if (priv && priv->netdev) { - mwifiex_stop_net_dev_queue(priv->netdev, adapter); - if (netif_carrier_ok(priv->netdev)) - netif_carrier_off(priv->netdev); - } - } - - dev_dbg(adapter->dev, "cmd: calling mwifiex_shutdown_drv...\n"); - adapter->init_wait_q_woken = false; - - if (mwifiex_shutdown_drv(adapter) == -EINPROGRESS) - wait_event_interruptible(adapter->init_wait_q, - adapter->init_wait_q_woken); - dev_dbg(adapter->dev, "cmd: mwifiex_shutdown_drv done\n"); - if (atomic_read(&adapter->rx_pending) || - atomic_read(&adapter->tx_pending) || - atomic_read(&adapter->cmd_pending)) { - dev_err(adapter->dev, "rx_pending=%d, tx_pending=%d, " - "cmd_pending=%d\n", - atomic_read(&adapter->rx_pending), - atomic_read(&adapter->tx_pending), - atomic_read(&adapter->cmd_pending)); - } - - for (i = 0; i < adapter->priv_num; i++) { - priv = adapter->priv[i]; - - if (!priv) - continue; - - rtnl_lock(); - if (priv->wdev && priv->netdev) - mwifiex_del_virtual_intf(adapter->wiphy, priv->wdev); - rtnl_unlock(); - } - - priv = adapter->priv[0]; - if (!priv || !priv->wdev) - goto exit_remove; - - wiphy_unregister(priv->wdev->wiphy); - wiphy_free(priv->wdev->wiphy); - - for (i = 0; i < adapter->priv_num; i++) { - priv = adapter->priv[i]; - if (priv) - kfree(priv->wdev); - } - - mwifiex_terminate_workqueue(adapter); - - /* Unregister device */ - dev_dbg(adapter->dev, "info: unregister device\n"); - if (adapter->if_ops.unregister_dev) - adapter->if_ops.unregister_dev(adapter); - /* Free adapter structure */ - dev_dbg(adapter->dev, "info: free adapter\n"); - mwifiex_free_adapter(adapter); - -exit_remove: - up(sem); -exit_sem_err: - return 0; -} -EXPORT_SYMBOL_GPL(mwifiex_remove_card); - -/* - * This function initializes the module. - * - * The debug FS is also initialized if configured. - */ -static int -mwifiex_init_module(void) -{ -#ifdef CONFIG_DEBUG_FS - mwifiex_debugfs_init(); -#endif - return 0; -} - -/* - * This function cleans up the module. - * - * The debug FS is removed if available. - */ -static void -mwifiex_cleanup_module(void) -{ -#ifdef CONFIG_DEBUG_FS - mwifiex_debugfs_remove(); -#endif -} - -module_init(mwifiex_init_module); -module_exit(mwifiex_cleanup_module); - -MODULE_AUTHOR("Marvell International Ltd."); -MODULE_DESCRIPTION("Marvell WiFi-Ex Driver version " VERSION); -MODULE_VERSION(VERSION); -MODULE_LICENSE("GPL v2"); diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h deleted file mode 100644 index 4ef67fca06d3..000000000000 --- a/drivers/net/wireless/mwifiex/main.h +++ /dev/null @@ -1,1128 +0,0 @@ -/* - * Marvell Wireless LAN device driver: major data structures and prototypes - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef _MWIFIEX_MAIN_H_ -#define _MWIFIEX_MAIN_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "pcie.h" - -extern const char driver_version[]; - -enum { - MWIFIEX_ASYNC_CMD, - MWIFIEX_SYNC_CMD -}; - -#define MWIFIEX_MAX_AP 64 - -#define MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT (5 * HZ) - -#define MWIFIEX_TIMER_10S 10000 -#define MWIFIEX_TIMER_1S 1000 - -#define MAX_TX_PENDING 100 -#define LOW_TX_PENDING 80 - -#define MWIFIEX_UPLD_SIZE (2312) - -#define MAX_EVENT_SIZE 1024 - -#define ARP_FILTER_MAX_BUF_SIZE 68 - -#define MWIFIEX_KEY_BUFFER_SIZE 16 -#define MWIFIEX_DEFAULT_LISTEN_INTERVAL 10 -#define MWIFIEX_MAX_REGION_CODE 7 - -#define DEFAULT_BCN_AVG_FACTOR 8 -#define DEFAULT_DATA_AVG_FACTOR 8 - -#define FIRST_VALID_CHANNEL 0xff -#define DEFAULT_AD_HOC_CHANNEL 6 -#define DEFAULT_AD_HOC_CHANNEL_A 36 - -#define DEFAULT_BCN_MISS_TIMEOUT 5 - -#define MAX_SCAN_BEACON_BUFFER 8000 - -#define SCAN_BEACON_ENTRY_PAD 6 - -#define MWIFIEX_PASSIVE_SCAN_CHAN_TIME 110 -#define MWIFIEX_ACTIVE_SCAN_CHAN_TIME 30 -#define MWIFIEX_SPECIFIC_SCAN_CHAN_TIME 30 - -#define SCAN_RSSI(RSSI) (0x100 - ((u8)(RSSI))) - -#define MWIFIEX_MAX_TOTAL_SCAN_TIME (MWIFIEX_TIMER_10S - MWIFIEX_TIMER_1S) - -#define MWIFIEX_MAX_SCAN_DELAY_CNT 50 -#define MWIFIEX_MAX_EMPTY_TX_Q_CNT 10 -#define MWIFIEX_SCAN_DELAY_MSEC 20 - -#define MWIFIEX_MIN_TX_PENDING_TO_CANCEL_SCAN 2 - -#define RSN_GTK_OUI_OFFSET 2 - -#define MWIFIEX_OUI_NOT_PRESENT 0 -#define MWIFIEX_OUI_PRESENT 1 - -#define PKT_TYPE_MGMT 0xE5 - -/* - * Do not check for data_received for USB, as data_received - * is handled in mwifiex_usb_recv for USB - */ -#define IS_CARD_RX_RCVD(adapter) (adapter->cmd_resp_received || \ - adapter->event_received || \ - ((adapter->iface_type != MWIFIEX_USB) && \ - adapter->data_received) || \ - ((adapter->iface_type == MWIFIEX_USB) && \ - !skb_queue_empty(&adapter->usb_rx_data_q))) - -#define MWIFIEX_TYPE_CMD 1 -#define MWIFIEX_TYPE_DATA 0 -#define MWIFIEX_TYPE_EVENT 3 - -#define MAX_BITMAP_RATES_SIZE 10 - -#define MAX_CHANNEL_BAND_BG 14 -#define MAX_CHANNEL_BAND_A 165 - -#define MAX_FREQUENCY_BAND_BG 2484 - -#define MWIFIEX_EVENT_HEADER_LEN 4 -#define MWIFIEX_UAP_EVENT_EXTRA_HEADER 2 - -#define MWIFIEX_TYPE_LEN 4 -#define MWIFIEX_USB_TYPE_CMD 0xF00DFACE -#define MWIFIEX_USB_TYPE_DATA 0xBEADC0DE -#define MWIFIEX_USB_TYPE_EVENT 0xBEEFFACE - -/* Threshold for tx_timeout_cnt before we trigger a card reset */ -#define TX_TIMEOUT_THRESHOLD 6 - -struct mwifiex_dbg { - u32 num_cmd_host_to_card_failure; - u32 num_cmd_sleep_cfm_host_to_card_failure; - u32 num_tx_host_to_card_failure; - u32 num_event_deauth; - u32 num_event_disassoc; - u32 num_event_link_lost; - u32 num_cmd_deauth; - u32 num_cmd_assoc_success; - u32 num_cmd_assoc_failure; - u32 num_tx_timeout; - u32 num_cmd_timeout; - u16 timeout_cmd_id; - u16 timeout_cmd_act; - u16 last_cmd_id[DBG_CMD_NUM]; - u16 last_cmd_act[DBG_CMD_NUM]; - u16 last_cmd_index; - u16 last_cmd_resp_id[DBG_CMD_NUM]; - u16 last_cmd_resp_index; - u16 last_event[DBG_CMD_NUM]; - u16 last_event_index; -}; - -enum MWIFIEX_HARDWARE_STATUS { - MWIFIEX_HW_STATUS_READY, - MWIFIEX_HW_STATUS_INITIALIZING, - MWIFIEX_HW_STATUS_FW_READY, - MWIFIEX_HW_STATUS_INIT_DONE, - MWIFIEX_HW_STATUS_RESET, - MWIFIEX_HW_STATUS_CLOSING, - MWIFIEX_HW_STATUS_NOT_READY -}; - -enum MWIFIEX_802_11_POWER_MODE { - MWIFIEX_802_11_POWER_MODE_CAM, - MWIFIEX_802_11_POWER_MODE_PSP -}; - -struct mwifiex_tx_param { - u32 next_pkt_len; -}; - -enum MWIFIEX_PS_STATE { - PS_STATE_AWAKE, - PS_STATE_PRE_SLEEP, - PS_STATE_SLEEP_CFM, - PS_STATE_SLEEP -}; - -enum mwifiex_iface_type { - MWIFIEX_SDIO, - MWIFIEX_PCIE, - MWIFIEX_USB -}; - -struct mwifiex_add_ba_param { - u32 tx_win_size; - u32 rx_win_size; - u32 timeout; -}; - -struct mwifiex_tx_aggr { - u8 ampdu_user; - u8 ampdu_ap; - u8 amsdu; -}; - -struct mwifiex_ra_list_tbl { - struct list_head list; - struct sk_buff_head skb_head; - u8 ra[ETH_ALEN]; - u32 total_pkts_size; - u32 is_11n_enabled; - u16 max_amsdu; - u16 pkt_count; - u8 ba_packet_thr; -}; - -struct mwifiex_tid_tbl { - struct list_head ra_list; -}; - -#define WMM_HIGHEST_PRIORITY 7 -#define HIGH_PRIO_TID 7 -#define LOW_PRIO_TID 0 - -struct mwifiex_wmm_desc { - struct mwifiex_tid_tbl tid_tbl_ptr[MAX_NUM_TID]; - u32 packets_out[MAX_NUM_TID]; - /* spin lock to protect ra_list */ - spinlock_t ra_list_spinlock; - struct mwifiex_wmm_ac_status ac_status[IEEE80211_NUM_ACS]; - enum mwifiex_wmm_ac_e ac_down_graded_vals[IEEE80211_NUM_ACS]; - u32 drv_pkt_delay_max; - u8 queue_priority[IEEE80211_NUM_ACS]; - u32 user_pri_pkt_tx_ctrl[WMM_HIGHEST_PRIORITY + 1]; /* UP: 0 to 7 */ - /* Number of transmit packets queued */ - atomic_t tx_pkts_queued; - /* Tracks highest priority with a packet queued */ - atomic_t highest_queued_prio; -}; - -struct mwifiex_802_11_security { - u8 wpa_enabled; - u8 wpa2_enabled; - u8 wapi_enabled; - u8 wapi_key_on; - u8 wep_enabled; - u32 authentication_mode; - u8 is_authtype_auto; - u32 encryption_mode; -}; - -struct ieee_types_header { - u8 element_id; - u8 len; -} __packed; - -struct ieee_types_vendor_specific { - struct ieee_types_vendor_header vend_hdr; - u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_vendor_header)]; -} __packed; - -struct ieee_types_generic { - struct ieee_types_header ieee_hdr; - u8 data[IEEE_MAX_IE_SIZE - sizeof(struct ieee_types_header)]; -} __packed; - -struct mwifiex_bssdescriptor { - u8 mac_address[ETH_ALEN]; - struct cfg80211_ssid ssid; - u32 privacy; - s32 rssi; - u32 channel; - u32 freq; - u16 beacon_period; - u8 erp_flags; - u32 bss_mode; - u8 supported_rates[MWIFIEX_SUPPORTED_RATES]; - u8 data_rates[MWIFIEX_SUPPORTED_RATES]; - /* Network band. - * BAND_B(0x01): 'b' band - * BAND_G(0x02): 'g' band - * BAND_A(0X04): 'a' band - */ - u16 bss_band; - u64 fw_tsf; - u64 timestamp; - union ieee_types_phy_param_set phy_param_set; - union ieee_types_ss_param_set ss_param_set; - u16 cap_info_bitmap; - struct ieee_types_wmm_parameter wmm_ie; - u8 disable_11n; - struct ieee80211_ht_cap *bcn_ht_cap; - u16 ht_cap_offset; - struct ieee80211_ht_operation *bcn_ht_oper; - u16 ht_info_offset; - u8 *bcn_bss_co_2040; - u16 bss_co_2040_offset; - u8 *bcn_ext_cap; - u16 ext_cap_offset; - struct ieee80211_vht_cap *bcn_vht_cap; - u16 vht_cap_offset; - struct ieee80211_vht_operation *bcn_vht_oper; - u16 vht_info_offset; - struct ieee_types_oper_mode_ntf *oper_mode; - u16 oper_mode_offset; - u8 disable_11ac; - struct ieee_types_vendor_specific *bcn_wpa_ie; - u16 wpa_offset; - struct ieee_types_generic *bcn_rsn_ie; - u16 rsn_offset; - struct ieee_types_generic *bcn_wapi_ie; - u16 wapi_offset; - u8 *beacon_buf; - u32 beacon_buf_size; -}; - -struct mwifiex_current_bss_params { - struct mwifiex_bssdescriptor bss_descriptor; - u8 wmm_enabled; - u8 wmm_uapsd_enabled; - u8 band; - u32 num_of_rates; - u8 data_rates[MWIFIEX_SUPPORTED_RATES]; -}; - -struct mwifiex_sleep_params { - u16 sp_error; - u16 sp_offset; - u16 sp_stable_time; - u8 sp_cal_control; - u8 sp_ext_sleep_clk; - u16 sp_reserved; -}; - -struct mwifiex_sleep_period { - u16 period; - u16 reserved; -}; - -struct mwifiex_wep_key { - u32 length; - u32 key_index; - u32 key_length; - u8 key_material[MWIFIEX_KEY_BUFFER_SIZE]; -}; - -#define MAX_REGION_CHANNEL_NUM 2 - -struct mwifiex_chan_freq_power { - u16 channel; - u32 freq; - u16 max_tx_power; - u8 unsupported; -}; - -enum state_11d_t { - DISABLE_11D = 0, - ENABLE_11D = 1, -}; - -#define MWIFIEX_MAX_TRIPLET_802_11D 83 - -struct mwifiex_802_11d_domain_reg { - u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; - u8 no_of_triplet; - struct ieee80211_country_ie_triplet - triplet[MWIFIEX_MAX_TRIPLET_802_11D]; -}; - -struct mwifiex_vendor_spec_cfg_ie { - u16 mask; - u16 flag; - u8 ie[MWIFIEX_MAX_VSIE_LEN]; -}; - -struct wps { - u8 session_enable; -}; - -struct mwifiex_roc_cfg { - u64 cookie; - struct ieee80211_channel chan; -}; - -struct mwifiex_adapter; -struct mwifiex_private; - -struct mwifiex_private { - struct mwifiex_adapter *adapter; - u8 bss_type; - u8 bss_role; - u8 bss_priority; - u8 bss_num; - u8 bss_started; - u8 frame_type; - u8 curr_addr[ETH_ALEN]; - u8 media_connected; - u32 num_tx_timeout; - /* track consecutive timeout */ - u8 tx_timeout_cnt; - struct net_device *netdev; - struct net_device_stats stats; - u16 curr_pkt_filter; - u32 bss_mode; - u32 pkt_tx_ctrl; - u16 tx_power_level; - u8 max_tx_power_level; - u8 min_tx_power_level; - u8 tx_rate; - u8 tx_htinfo; - u8 rxpd_htinfo; - u8 rxpd_rate; - u16 rate_bitmap; - u16 bitmap_rates[MAX_BITMAP_RATES_SIZE]; - u32 data_rate; - u8 is_data_rate_auto; - u16 bcn_avg_factor; - u16 data_avg_factor; - s16 data_rssi_last; - s16 data_nf_last; - s16 data_rssi_avg; - s16 data_nf_avg; - s16 bcn_rssi_last; - s16 bcn_nf_last; - s16 bcn_rssi_avg; - s16 bcn_nf_avg; - struct mwifiex_bssdescriptor *attempted_bss_desc; - struct cfg80211_ssid prev_ssid; - u8 prev_bssid[ETH_ALEN]; - struct mwifiex_current_bss_params curr_bss_params; - u16 beacon_period; - u8 dtim_period; - u16 listen_interval; - u16 atim_window; - u8 adhoc_channel; - u8 adhoc_is_link_sensed; - u8 adhoc_state; - struct mwifiex_802_11_security sec_info; - struct mwifiex_wep_key wep_key[NUM_WEP_KEYS]; - u16 wep_key_curr_index; - u8 wpa_ie[256]; - u8 wpa_ie_len; - u8 wpa_is_gtk_set; - struct host_cmd_ds_802_11_key_material aes_key; - u8 wapi_ie[256]; - u8 wapi_ie_len; - u8 *wps_ie; - u8 wps_ie_len; - u8 wmm_required; - u8 wmm_enabled; - u8 wmm_qosinfo; - struct mwifiex_wmm_desc wmm; - atomic_t wmm_tx_pending[IEEE80211_NUM_ACS]; - struct list_head sta_list; - /* spin lock for associated station list */ - spinlock_t sta_list_spinlock; - struct list_head tx_ba_stream_tbl_ptr; - /* spin lock for tx_ba_stream_tbl_ptr queue */ - spinlock_t tx_ba_stream_tbl_lock; - struct mwifiex_tx_aggr aggr_prio_tbl[MAX_NUM_TID]; - struct mwifiex_add_ba_param add_ba_param; - u16 rx_seq[MAX_NUM_TID]; - struct list_head rx_reorder_tbl_ptr; - /* spin lock for rx_reorder_tbl_ptr queue */ - spinlock_t rx_reorder_tbl_lock; - /* spin lock for Rx packets */ - spinlock_t rx_pkt_lock; - -#define MWIFIEX_ASSOC_RSP_BUF_SIZE 500 - u8 assoc_rsp_buf[MWIFIEX_ASSOC_RSP_BUF_SIZE]; - u32 assoc_rsp_size; - -#define MWIFIEX_GENIE_BUF_SIZE 256 - u8 gen_ie_buf[MWIFIEX_GENIE_BUF_SIZE]; - u8 gen_ie_buf_len; - - struct mwifiex_vendor_spec_cfg_ie vs_ie[MWIFIEX_MAX_VSIE_NUM]; - -#define MWIFIEX_ASSOC_TLV_BUF_SIZE 256 - u8 assoc_tlv_buf[MWIFIEX_ASSOC_TLV_BUF_SIZE]; - u8 assoc_tlv_buf_len; - - u8 *curr_bcn_buf; - u32 curr_bcn_size; - /* spin lock for beacon buffer */ - spinlock_t curr_bcn_buf_lock; - struct wireless_dev *wdev; - struct mwifiex_chan_freq_power cfp; - char version_str[128]; -#ifdef CONFIG_DEBUG_FS - struct dentry *dfs_dev_dir; -#endif - u8 nick_name[16]; - u16 current_key_index; - struct semaphore async_sem; - u8 report_scan_result; - struct cfg80211_scan_request *scan_request; - struct mwifiex_user_scan_cfg *user_scan_cfg; - u8 cfg_bssid[6]; - struct wps wps; - u8 scan_block; - s32 cqm_rssi_thold; - u32 cqm_rssi_hyst; - u8 subsc_evt_rssi_state; - struct mwifiex_ds_misc_subsc_evt async_subsc_evt_storage; - struct mwifiex_ie mgmt_ie[MAX_MGMT_IE_INDEX]; - u16 beacon_idx; - u16 proberesp_idx; - u16 assocresp_idx; - u16 rsn_idx; - struct timer_list scan_delay_timer; - u8 ap_11n_enabled; - u8 ap_11ac_enabled; - u32 mgmt_frame_mask; - struct mwifiex_roc_cfg roc_cfg; -}; - -enum mwifiex_ba_status { - BA_SETUP_NONE = 0, - BA_SETUP_INPROGRESS, - BA_SETUP_COMPLETE -}; - -struct mwifiex_tx_ba_stream_tbl { - struct list_head list; - int tid; - u8 ra[ETH_ALEN]; - enum mwifiex_ba_status ba_status; -}; - -struct mwifiex_rx_reorder_tbl; - -struct reorder_tmr_cnxt { - struct timer_list timer; - struct mwifiex_rx_reorder_tbl *ptr; - struct mwifiex_private *priv; -}; - -struct mwifiex_rx_reorder_tbl { - struct list_head list; - int tid; - u8 ta[ETH_ALEN]; - int start_win; - int win_size; - void **rx_reorder_ptr; - struct reorder_tmr_cnxt timer_context; - u8 flags; -}; - -struct mwifiex_bss_prio_node { - struct list_head list; - struct mwifiex_private *priv; -}; - -struct mwifiex_bss_prio_tbl { - struct list_head bss_prio_head; - /* spin lock for bss priority */ - spinlock_t bss_prio_lock; - struct mwifiex_bss_prio_node *bss_prio_cur; -}; - -struct cmd_ctrl_node { - struct list_head list; - struct mwifiex_private *priv; - u32 cmd_oid; - u32 cmd_flag; - struct sk_buff *cmd_skb; - struct sk_buff *resp_skb; - void *data_buf; - u32 wait_q_enabled; - struct sk_buff *skb; - u8 *condition; - u8 cmd_wait_q_woken; -}; - -struct mwifiex_bss_priv { - u8 band; - u64 fw_tsf; -}; - -/* This is AP specific structure which stores information - * about associated STA - */ -struct mwifiex_sta_node { - struct list_head list; - u8 mac_addr[ETH_ALEN]; - u8 is_wmm_enabled; - u8 is_11n_enabled; - u8 ampdu_sta[MAX_NUM_TID]; - u16 rx_seq[MAX_NUM_TID]; - u16 max_amsdu; -}; - -struct mwifiex_if_ops { - int (*init_if) (struct mwifiex_adapter *); - void (*cleanup_if) (struct mwifiex_adapter *); - int (*check_fw_status) (struct mwifiex_adapter *, u32); - int (*prog_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *); - int (*register_dev) (struct mwifiex_adapter *); - void (*unregister_dev) (struct mwifiex_adapter *); - int (*enable_int) (struct mwifiex_adapter *); - int (*process_int_status) (struct mwifiex_adapter *); - int (*host_to_card) (struct mwifiex_adapter *, u8, struct sk_buff *, - struct mwifiex_tx_param *); - int (*wakeup) (struct mwifiex_adapter *); - int (*wakeup_complete) (struct mwifiex_adapter *); - - /* Interface specific functions */ - void (*update_mp_end_port) (struct mwifiex_adapter *, u16); - void (*cleanup_mpa_buf) (struct mwifiex_adapter *); - int (*cmdrsp_complete) (struct mwifiex_adapter *, struct sk_buff *); - int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *); - int (*data_complete) (struct mwifiex_adapter *, struct sk_buff *); - int (*init_fw_port) (struct mwifiex_adapter *); - int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *); - void (*card_reset) (struct mwifiex_adapter *); - int (*clean_pcie_ring) (struct mwifiex_adapter *adapter); -}; - -struct mwifiex_adapter { - u8 iface_type; - struct mwifiex_private *priv[MWIFIEX_MAX_BSS_NUM]; - u8 priv_num; - const struct firmware *firmware; - char fw_name[32]; - int winner; - struct device *dev; - struct wiphy *wiphy; - bool surprise_removed; - u32 fw_release_number; - u16 init_wait_q_woken; - wait_queue_head_t init_wait_q; - void *card; - struct mwifiex_if_ops if_ops; - atomic_t rx_pending; - atomic_t tx_pending; - atomic_t cmd_pending; - struct workqueue_struct *workqueue; - struct work_struct main_work; - struct mwifiex_bss_prio_tbl bss_prio_tbl[MWIFIEX_MAX_BSS_NUM]; - /* spin lock for init/shutdown */ - spinlock_t mwifiex_lock; - /* spin lock for main process */ - spinlock_t main_proc_lock; - u32 mwifiex_processing; - u16 tx_buf_size; - u16 curr_tx_buf_size; - u32 ioport; - enum MWIFIEX_HARDWARE_STATUS hw_status; - u16 number_of_antenna; - u32 fw_cap_info; - /* spin lock for interrupt handling */ - spinlock_t int_lock; - u8 int_status; - u32 event_cause; - struct sk_buff *event_skb; - u8 upld_buf[MWIFIEX_UPLD_SIZE]; - u8 data_sent; - u8 cmd_sent; - u8 cmd_resp_received; - u8 event_received; - u8 data_received; - u16 seq_num; - struct cmd_ctrl_node *cmd_pool; - struct cmd_ctrl_node *curr_cmd; - /* spin lock for command */ - spinlock_t mwifiex_cmd_lock; - u32 num_cmd_timeout; - u16 last_init_cmd; - struct timer_list cmd_timer; - struct list_head cmd_free_q; - /* spin lock for cmd_free_q */ - spinlock_t cmd_free_q_lock; - struct list_head cmd_pending_q; - /* spin lock for cmd_pending_q */ - spinlock_t cmd_pending_q_lock; - struct list_head scan_pending_q; - /* spin lock for scan_pending_q */ - spinlock_t scan_pending_q_lock; - struct sk_buff_head usb_rx_data_q; - u32 scan_processing; - u16 region_code; - struct mwifiex_802_11d_domain_reg domain_reg; - u16 scan_probes; - u32 scan_mode; - u16 specific_scan_time; - u16 active_scan_time; - u16 passive_scan_time; - u8 fw_bands; - u8 adhoc_start_band; - u8 config_bands; - struct mwifiex_chan_scan_param_set *scan_channels; - u8 tx_lock_flag; - struct mwifiex_sleep_params sleep_params; - struct mwifiex_sleep_period sleep_period; - u16 ps_mode; - u32 ps_state; - u8 need_to_wakeup; - u16 multiple_dtim; - u16 local_listen_interval; - u16 null_pkt_interval; - struct sk_buff *sleep_cfm; - u16 bcn_miss_time_out; - u16 adhoc_awake_period; - u8 is_deep_sleep; - u8 delay_null_pkt; - u16 delay_to_ps; - u16 enhanced_ps_mode; - u8 pm_wakeup_card_req; - u16 gen_null_pkt; - u16 pps_uapsd_mode; - u32 pm_wakeup_fw_try; - u8 is_hs_configured; - struct mwifiex_hs_config_param hs_cfg; - u8 hs_activated; - u16 hs_activate_wait_q_woken; - wait_queue_head_t hs_activate_wait_q; - bool is_suspended; - u8 event_body[MAX_EVENT_SIZE]; - u32 hw_dot_11n_dev_cap; - u8 hw_dev_mcs_support; - u8 adhoc_11n_enabled; - u8 sec_chan_offset; - struct mwifiex_dbg dbg; - u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE]; - u32 arp_filter_size; - u16 cmd_wait_q_required; - struct mwifiex_wait_queue cmd_wait_q; - u8 scan_wait_q_woken; - spinlock_t queue_lock; /* lock for tx queues */ - struct completion fw_load; - u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; - u16 max_mgmt_ie_index; - u8 scan_delay_cnt; - u8 empty_tx_q_cnt; - - /* 11AC */ - u32 is_hw_11ac_capable; - u32 hw_dot_11ac_dev_cap; - u32 hw_dot_11ac_mcs_support; - u32 usr_dot_11ac_dev_cap_bg; - u32 usr_dot_11ac_dev_cap_a; - u32 usr_dot_11ac_mcs_support; - - atomic_t is_tx_received; - atomic_t pending_bridged_pkts; -}; - -int mwifiex_init_lock_list(struct mwifiex_adapter *adapter); - -void mwifiex_set_trans_start(struct net_device *dev); - -void mwifiex_stop_net_dev_queue(struct net_device *netdev, - struct mwifiex_adapter *adapter); - -void mwifiex_wake_up_net_dev_queue(struct net_device *netdev, - struct mwifiex_adapter *adapter); - -int mwifiex_init_priv(struct mwifiex_private *priv); -void mwifiex_free_priv(struct mwifiex_private *priv); - -int mwifiex_init_fw(struct mwifiex_adapter *adapter); - -int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter); - -int mwifiex_shutdown_drv(struct mwifiex_adapter *adapter); - -int mwifiex_shutdown_fw_complete(struct mwifiex_adapter *adapter); - -int mwifiex_dnld_fw(struct mwifiex_adapter *, struct mwifiex_fw_image *); - -int mwifiex_recv_packet(struct mwifiex_private *priv, struct sk_buff *skb); - -int mwifiex_process_mgmt_packet(struct mwifiex_private *priv, - struct sk_buff *skb); - -int mwifiex_process_event(struct mwifiex_adapter *adapter); - -int mwifiex_complete_cmd(struct mwifiex_adapter *adapter, - struct cmd_ctrl_node *cmd_node); - -int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no, - u16 cmd_action, u32 cmd_oid, void *data_buf); - -int mwifiex_send_cmd_sync(struct mwifiex_private *priv, uint16_t cmd_no, - u16 cmd_action, u32 cmd_oid, void *data_buf); - -void mwifiex_cmd_timeout_func(unsigned long function_context); - -int mwifiex_get_debug_info(struct mwifiex_private *, - struct mwifiex_debug_info *); - -int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter); -int mwifiex_free_cmd_buffer(struct mwifiex_adapter *adapter); -void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter); -void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter); - -void mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter, - struct cmd_ctrl_node *cmd_node); -void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter, - struct cmd_ctrl_node *cmd_node); - -void mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter, - struct cmd_ctrl_node *cmd_node, - u32 addtail); - -int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter); -int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter); -int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter, - struct sk_buff *skb); -int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb, - struct mwifiex_tx_param *tx_param); -int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags); -int mwifiex_write_data_complete(struct mwifiex_adapter *adapter, - struct sk_buff *skb, int aggr, int status); -void mwifiex_clean_txrx(struct mwifiex_private *priv); -u8 mwifiex_check_last_packet_indication(struct mwifiex_private *priv); -void mwifiex_check_ps_cond(struct mwifiex_adapter *adapter); -void mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *, u8 *, - u32); -int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - u16 cmd_action, uint16_t ps_bitmap, - struct mwifiex_ds_auto_ds *auto_ds); -int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp, - struct mwifiex_ds_pm_cfg *pm_cfg); -void mwifiex_process_hs_config(struct mwifiex_adapter *adapter); -void mwifiex_hs_activated_event(struct mwifiex_private *priv, - u8 activated); -int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp); -int mwifiex_process_rx_packet(struct mwifiex_private *priv, - struct sk_buff *skb); -int mwifiex_sta_prepare_cmd(struct mwifiex_private *, uint16_t cmd_no, - u16 cmd_action, u32 cmd_oid, - void *data_buf, void *cmd_buf); -int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no, - u16 cmd_action, u32 cmd_oid, - void *data_buf, void *cmd_buf); -int mwifiex_process_sta_cmdresp(struct mwifiex_private *, u16 cmdresp_no, - struct host_cmd_ds_command *resp); -int mwifiex_process_sta_rx_packet(struct mwifiex_private *, - struct sk_buff *skb); -int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv, - struct sk_buff *skb); -int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv, - struct sk_buff *skb); -int mwifiex_process_sta_event(struct mwifiex_private *); -int mwifiex_process_uap_event(struct mwifiex_private *); -struct mwifiex_sta_node * -mwifiex_get_sta_entry(struct mwifiex_private *priv, u8 *mac); -void mwifiex_delete_all_station_list(struct mwifiex_private *priv); -void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb); -void *mwifiex_process_uap_txpd(struct mwifiex_private *, struct sk_buff *skb); -int mwifiex_sta_init_cmd(struct mwifiex_private *, u8 first_sta); -int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd, - struct mwifiex_scan_cmd_config *scan_cfg); -void mwifiex_queue_scan_cmd(struct mwifiex_private *priv, - struct cmd_ctrl_node *cmd_node); -int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp); -s32 mwifiex_ssid_cmp(struct cfg80211_ssid *ssid1, struct cfg80211_ssid *ssid2); -int mwifiex_associate(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc); -int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - struct mwifiex_bssdescriptor *bss_desc); -int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp); -void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason); -u8 mwifiex_band_to_radio_type(u8 band); -int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac); -int mwifiex_adhoc_start(struct mwifiex_private *priv, - struct cfg80211_ssid *adhoc_ssid); -int mwifiex_adhoc_join(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc); -int mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - struct cfg80211_ssid *req_ssid); -int mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - struct mwifiex_bssdescriptor *bss_desc); -int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp); -int mwifiex_cmd_802_11_bg_scan_query(struct host_cmd_ds_command *cmd); -struct mwifiex_chan_freq_power *mwifiex_get_cfp(struct mwifiex_private *priv, - u8 band, u16 channel, u32 freq); -u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv, - u8 index, u8 ht_info); -u32 mwifiex_index_to_acs_data_rate(struct mwifiex_private *priv, - u8 index, u8 ht_info); -u32 mwifiex_find_freq_from_band_chan(u8, u8); -int mwifiex_cmd_append_vsie_tlv(struct mwifiex_private *priv, u16 vsie_mask, - u8 **buffer); -u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv, - u8 *rates); -u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates); -u8 mwifiex_is_rate_auto(struct mwifiex_private *priv); -extern u16 region_code_index[MWIFIEX_MAX_REGION_CODE]; -void mwifiex_save_curr_bcn(struct mwifiex_private *priv); -void mwifiex_free_curr_bcn(struct mwifiex_private *priv); -int mwifiex_cmd_get_hw_spec(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd); -int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp); -int is_command_pending(struct mwifiex_adapter *adapter); -void mwifiex_init_priv_params(struct mwifiex_private *priv, - struct net_device *dev); -int mwifiex_set_secure_params(struct mwifiex_private *priv, - struct mwifiex_uap_bss_param *bss_config, - struct cfg80211_ap_settings *params); -void mwifiex_set_ht_params(struct mwifiex_private *priv, - struct mwifiex_uap_bss_param *bss_cfg, - struct cfg80211_ap_settings *params); -void mwifiex_set_vht_params(struct mwifiex_private *priv, - struct mwifiex_uap_bss_param *bss_cfg, - struct cfg80211_ap_settings *params); -void mwifiex_set_uap_rates(struct mwifiex_uap_bss_param *bss_cfg, - struct cfg80211_ap_settings *params); -void mwifiex_set_vht_width(struct mwifiex_private *priv, - enum nl80211_chan_width width, - bool ap_11ac_disable); -void -mwifiex_set_wmm_params(struct mwifiex_private *priv, - struct mwifiex_uap_bss_param *bss_cfg, - struct cfg80211_ap_settings *params); -void mwifiex_set_ba_params(struct mwifiex_private *priv); -void mwifiex_set_11ac_ba_params(struct mwifiex_private *priv); - -/* - * This function checks if the queuing is RA based or not. - */ -static inline u8 -mwifiex_queuing_ra_based(struct mwifiex_private *priv) -{ - /* - * Currently we assume if we are in Infra, then DA=RA. This might not be - * true in the future - */ - if ((priv->bss_mode == NL80211_IFTYPE_STATION) && - (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA)) - return false; - - return true; -} - -/* - * This function copies rates. - */ -static inline u32 -mwifiex_copy_rates(u8 *dest, u32 pos, u8 *src, int len) -{ - int i; - - for (i = 0; i < len && src[i]; i++, pos++) { - if (pos >= MWIFIEX_SUPPORTED_RATES) - break; - dest[pos] = src[i]; - } - - return pos; -} - -/* - * This function returns the correct private structure pointer based - * upon the BSS type and BSS number. - */ -static inline struct mwifiex_private * -mwifiex_get_priv_by_id(struct mwifiex_adapter *adapter, - u8 bss_num, u8 bss_type) -{ - int i; - - for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - if ((adapter->priv[i]->bss_num == bss_num) && - (adapter->priv[i]->bss_type == bss_type)) - break; - } - } - return ((i < adapter->priv_num) ? adapter->priv[i] : NULL); -} - -/* - * This function returns the first available private structure pointer - * based upon the BSS role. - */ -static inline struct mwifiex_private * -mwifiex_get_priv(struct mwifiex_adapter *adapter, - enum mwifiex_bss_role bss_role) -{ - int i; - - for (i = 0; i < adapter->priv_num; i++) { - if (adapter->priv[i]) { - if (bss_role == MWIFIEX_BSS_ROLE_ANY || - GET_BSS_ROLE(adapter->priv[i]) == bss_role) - break; - } - } - - return ((i < adapter->priv_num) ? adapter->priv[i] : NULL); -} - -/* - * This function returns the driver private structure of a network device. - */ -static inline struct mwifiex_private * -mwifiex_netdev_get_priv(struct net_device *dev) -{ - return (struct mwifiex_private *) (*(unsigned long *) netdev_priv(dev)); -} - -/* - * This function checks if a skb holds a management frame. - */ -static inline bool mwifiex_is_skb_mgmt_frame(struct sk_buff *skb) -{ - return (*(u32 *)skb->data == PKT_TYPE_MGMT); -} - -int mwifiex_init_shutdown_fw(struct mwifiex_private *priv, - u32 func_init_shutdown); -int mwifiex_add_card(void *, struct semaphore *, struct mwifiex_if_ops *, u8); -int mwifiex_remove_card(struct mwifiex_adapter *, struct semaphore *); - -void mwifiex_get_version(struct mwifiex_adapter *adapter, char *version, - int maxlen); -int mwifiex_request_set_multicast_list(struct mwifiex_private *priv, - struct mwifiex_multicast_list *mcast_list); -int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, - struct net_device *dev); -int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter, - struct cmd_ctrl_node *cmd_queued); -int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, - struct cfg80211_ssid *req_ssid); -int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type); -int mwifiex_enable_hs(struct mwifiex_adapter *adapter); -int mwifiex_disable_auto_ds(struct mwifiex_private *priv); -int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, u32 *rate); -int mwifiex_request_scan(struct mwifiex_private *priv, - struct cfg80211_ssid *req_ssid); -int mwifiex_scan_networks(struct mwifiex_private *priv, - const struct mwifiex_user_scan_cfg *user_scan_in); -int mwifiex_set_radio(struct mwifiex_private *priv, u8 option); - -int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp, - const u8 *key, int key_len, u8 key_index, - const u8 *mac_addr, int disable); - -int mwifiex_set_gen_ie(struct mwifiex_private *priv, u8 *ie, int ie_len); - -int mwifiex_get_ver_ext(struct mwifiex_private *priv); - -int mwifiex_remain_on_chan_cfg(struct mwifiex_private *priv, u16 action, - struct ieee80211_channel *chan, - unsigned int duration); - -int mwifiex_set_bss_role(struct mwifiex_private *priv, u8 bss_role); - -int mwifiex_get_stats_info(struct mwifiex_private *priv, - struct mwifiex_ds_get_stats *log); - -int mwifiex_reg_write(struct mwifiex_private *priv, u32 reg_type, - u32 reg_offset, u32 reg_value); - -int mwifiex_reg_read(struct mwifiex_private *priv, u32 reg_type, - u32 reg_offset, u32 *value); - -int mwifiex_eeprom_read(struct mwifiex_private *priv, u16 offset, u16 bytes, - u8 *value); - -int mwifiex_set_11n_httx_cfg(struct mwifiex_private *priv, int data); - -int mwifiex_get_11n_httx_cfg(struct mwifiex_private *priv, int *data); - -int mwifiex_set_tx_rate_cfg(struct mwifiex_private *priv, int tx_rate_index); - -int mwifiex_get_tx_rate_cfg(struct mwifiex_private *priv, int *tx_rate_index); - -int mwifiex_drv_set_power(struct mwifiex_private *priv, u32 *ps_mode); - -int mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter, - char *version, int max_len); - -int mwifiex_set_tx_power(struct mwifiex_private *priv, - struct mwifiex_power_cfg *power_cfg); - -int mwifiex_main_process(struct mwifiex_adapter *); - -int mwifiex_queue_tx_pkt(struct mwifiex_private *priv, struct sk_buff *skb); - -int mwifiex_get_bss_info(struct mwifiex_private *, - struct mwifiex_bss_info *); -int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, - struct cfg80211_bss *bss, - struct mwifiex_bssdescriptor *bss_desc); -int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter, - struct mwifiex_bssdescriptor *bss_entry); -int mwifiex_check_network_compatibility(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc); - -u8 mwifiex_chan_type_to_sec_chan_offset(enum nl80211_channel_type chan_type); - -struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, - const char *name, - enum nl80211_iftype type, - u32 *flags, - struct vif_params *params); -int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev); - -void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config); - -int mwifiex_add_wowlan_magic_pkt_filter(struct mwifiex_adapter *adapter); - -int mwifiex_set_mgmt_ies(struct mwifiex_private *priv, - struct cfg80211_beacon_data *data); -int mwifiex_del_mgmt_ies(struct mwifiex_private *priv); -u8 *mwifiex_11d_code_2_region(u8 code); - -extern const struct ethtool_ops mwifiex_ethtool_ops; - -#ifdef CONFIG_DEBUG_FS -void mwifiex_debugfs_init(void); -void mwifiex_debugfs_remove(void); - -void mwifiex_dev_debugfs_init(struct mwifiex_private *priv); -void mwifiex_dev_debugfs_remove(struct mwifiex_private *priv); -#endif -#endif /* !_MWIFIEX_MAIN_H_ */ diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c deleted file mode 100644 index 20c9c4c7b0b2..000000000000 --- a/drivers/net/wireless/mwifiex/pcie.c +++ /dev/null @@ -1,2434 +0,0 @@ -/* - * Marvell Wireless LAN device driver: PCIE specific handling - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" -#include "11n.h" -#include "pcie.h" - -#define PCIE_VERSION "1.0" -#define DRV_NAME "Marvell mwifiex PCIe" - -static u8 user_rmmod; - -static struct mwifiex_if_ops pcie_ops; - -static struct semaphore add_remove_card_sem; - -static int -mwifiex_map_pci_memory(struct mwifiex_adapter *adapter, struct sk_buff *skb, - int size, int flags) -{ - struct pcie_service_card *card = adapter->card; - dma_addr_t buf_pa; - - buf_pa = pci_map_single(card->dev, skb->data, size, flags); - if (pci_dma_mapping_error(card->dev, buf_pa)) { - dev_err(adapter->dev, "failed to map pci memory!\n"); - return -1; - } - memcpy(skb->cb, &buf_pa, sizeof(dma_addr_t)); - return 0; -} - -/* - * This function reads sleep cookie and checks if FW is ready - */ -static bool mwifiex_pcie_ok_to_access_hw(struct mwifiex_adapter *adapter) -{ - u32 *cookie_addr; - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - if (!reg->sleep_cookie) - return true; - - if (card->sleep_cookie_vbase) { - cookie_addr = (u32 *)card->sleep_cookie_vbase; - dev_dbg(adapter->dev, "info: ACCESS_HW: sleep cookie=0x%x\n", - *cookie_addr); - if (*cookie_addr == FW_AWAKE_COOKIE) - return true; - } - - return false; -} - -#ifdef CONFIG_PM -/* - * Kernel needs to suspend all functions separately. Therefore all - * registered functions must have drivers with suspend and resume - * methods. Failing that the kernel simply removes the whole card. - * - * If already not suspended, this function allocates and sends a host - * sleep activate request to the firmware and turns off the traffic. - */ -static int mwifiex_pcie_suspend(struct pci_dev *pdev, pm_message_t state) -{ - struct mwifiex_adapter *adapter; - struct pcie_service_card *card; - int hs_actived; - - if (pdev) { - card = (struct pcie_service_card *) pci_get_drvdata(pdev); - if (!card || !card->adapter) { - pr_err("Card or adapter structure is not valid\n"); - return 0; - } - } else { - pr_err("PCIE device is not specified\n"); - return 0; - } - - adapter = card->adapter; - - hs_actived = mwifiex_enable_hs(adapter); - - /* Indicate device suspended */ - adapter->is_suspended = true; - - return 0; -} - -/* - * Kernel needs to suspend all functions separately. Therefore all - * registered functions must have drivers with suspend and resume - * methods. Failing that the kernel simply removes the whole card. - * - * If already not resumed, this function turns on the traffic and - * sends a host sleep cancel request to the firmware. - */ -static int mwifiex_pcie_resume(struct pci_dev *pdev) -{ - struct mwifiex_adapter *adapter; - struct pcie_service_card *card; - - if (pdev) { - card = (struct pcie_service_card *) pci_get_drvdata(pdev); - if (!card || !card->adapter) { - pr_err("Card or adapter structure is not valid\n"); - return 0; - } - } else { - pr_err("PCIE device is not specified\n"); - return 0; - } - - adapter = card->adapter; - - if (!adapter->is_suspended) { - dev_warn(adapter->dev, "Device already resumed\n"); - return 0; - } - - adapter->is_suspended = false; - - mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), - MWIFIEX_ASYNC_CMD); - - return 0; -} -#endif - -/* - * This function probes an mwifiex device and registers it. It allocates - * the card structure, enables PCIE function number and initiates the - * device registration and initialization procedure by adding a logical - * interface. - */ -static int mwifiex_pcie_probe(struct pci_dev *pdev, - const struct pci_device_id *ent) -{ - struct pcie_service_card *card; - - pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n", - pdev->vendor, pdev->device, pdev->revision); - - card = kzalloc(sizeof(struct pcie_service_card), GFP_KERNEL); - if (!card) - return -ENOMEM; - - card->dev = pdev; - - if (ent->driver_data) { - struct mwifiex_pcie_device *data = (void *)ent->driver_data; - card->pcie.firmware = data->firmware; - card->pcie.reg = data->reg; - card->pcie.blksz_fw_dl = data->blksz_fw_dl; - } - - if (mwifiex_add_card(card, &add_remove_card_sem, &pcie_ops, - MWIFIEX_PCIE)) { - pr_err("%s failed\n", __func__); - kfree(card); - return -1; - } - - return 0; -} - -/* - * This function removes the interface and frees up the card structure. - */ -static void mwifiex_pcie_remove(struct pci_dev *pdev) -{ - struct pcie_service_card *card; - struct mwifiex_adapter *adapter; - struct mwifiex_private *priv; - int i; - - card = pci_get_drvdata(pdev); - if (!card) - return; - - adapter = card->adapter; - if (!adapter || !adapter->priv_num) - return; - - /* In case driver is removed when asynchronous FW load is in progress */ - wait_for_completion(&adapter->fw_load); - - if (user_rmmod) { -#ifdef CONFIG_PM - if (adapter->is_suspended) - mwifiex_pcie_resume(pdev); -#endif - - for (i = 0; i < adapter->priv_num; i++) - if ((GET_BSS_ROLE(adapter->priv[i]) == - MWIFIEX_BSS_ROLE_STA) && - adapter->priv[i]->media_connected) - mwifiex_deauthenticate(adapter->priv[i], NULL); - - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - - mwifiex_disable_auto_ds(priv); - - mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN); - } - - mwifiex_remove_card(card->adapter, &add_remove_card_sem); - kfree(card); -} - -static DEFINE_PCI_DEVICE_TABLE(mwifiex_ids) = { - { - PCIE_VENDOR_ID_MARVELL, PCIE_DEVICE_ID_MARVELL_88W8766P, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - .driver_data = (unsigned long) &mwifiex_pcie8766, - }, - { - PCIE_VENDOR_ID_MARVELL, PCIE_DEVICE_ID_MARVELL_88W8897, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - .driver_data = (unsigned long) &mwifiex_pcie8897, - }, - {}, -}; - -MODULE_DEVICE_TABLE(pci, mwifiex_ids); - -/* PCI Device Driver */ -static struct pci_driver __refdata mwifiex_pcie = { - .name = "mwifiex_pcie", - .id_table = mwifiex_ids, - .probe = mwifiex_pcie_probe, - .remove = mwifiex_pcie_remove, -#ifdef CONFIG_PM - /* Power Management Hooks */ - .suspend = mwifiex_pcie_suspend, - .resume = mwifiex_pcie_resume, -#endif -}; - -/* - * This function writes data into PCIE card register. - */ -static int mwifiex_write_reg(struct mwifiex_adapter *adapter, int reg, u32 data) -{ - struct pcie_service_card *card = adapter->card; - - iowrite32(data, card->pci_mmap1 + reg); - - return 0; -} - -/* - * This function reads data from PCIE card register. - */ -static int mwifiex_read_reg(struct mwifiex_adapter *adapter, int reg, u32 *data) -{ - struct pcie_service_card *card = adapter->card; - - *data = ioread32(card->pci_mmap1 + reg); - - return 0; -} - -/* - * This function adds delay loop to ensure FW is awake before proceeding. - */ -static void mwifiex_pcie_dev_wakeup_delay(struct mwifiex_adapter *adapter) -{ - int i = 0; - - while (mwifiex_pcie_ok_to_access_hw(adapter)) { - i++; - usleep_range(10, 20); - /* 50ms max wait */ - if (i == 5000) - break; - } - - return; -} - -/* This function wakes up the card by reading fw_status register. */ -static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter) -{ - u32 fw_status; - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - dev_dbg(adapter->dev, "event: Wakeup device...\n"); - - if (reg->sleep_cookie) - mwifiex_pcie_dev_wakeup_delay(adapter); - - /* Reading fw_status register will wakeup device */ - if (mwifiex_read_reg(adapter, reg->fw_status, &fw_status)) { - dev_warn(adapter->dev, "Reading fw_status register failed\n"); - return -1; - } - - if (reg->sleep_cookie) { - mwifiex_pcie_dev_wakeup_delay(adapter); - dev_dbg(adapter->dev, "PCIE wakeup: Setting PS_STATE_AWAKE\n"); - adapter->ps_state = PS_STATE_AWAKE; - } - - return 0; -} - -/* - * This function is called after the card has woken up. - * - * The card configuration register is reset. - */ -static int mwifiex_pm_wakeup_card_complete(struct mwifiex_adapter *adapter) -{ - dev_dbg(adapter->dev, "cmd: Wakeup device completed\n"); - - return 0; -} - -/* - * This function disables the host interrupt. - * - * The host interrupt mask is read, the disable bit is reset and - * written back to the card host interrupt mask register. - */ -static int mwifiex_pcie_disable_host_int(struct mwifiex_adapter *adapter) -{ - if (mwifiex_pcie_ok_to_access_hw(adapter)) { - if (mwifiex_write_reg(adapter, PCIE_HOST_INT_MASK, - 0x00000000)) { - dev_warn(adapter->dev, "Disable host interrupt failed\n"); - return -1; - } - } - - return 0; -} - -/* - * This function enables the host interrupt. - * - * The host interrupt enable mask is written to the card - * host interrupt mask register. - */ -static int mwifiex_pcie_enable_host_int(struct mwifiex_adapter *adapter) -{ - if (mwifiex_pcie_ok_to_access_hw(adapter)) { - /* Simply write the mask to the register */ - if (mwifiex_write_reg(adapter, PCIE_HOST_INT_MASK, - HOST_INTR_MASK)) { - dev_warn(adapter->dev, "Enable host interrupt failed\n"); - return -1; - } - } - - return 0; -} - -/* - * This function initializes TX buffer ring descriptors - */ -static int mwifiex_init_txq_ring(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - struct mwifiex_pcie_buf_desc *desc; - struct mwifiex_pfu_buf_desc *desc2; - int i; - - for (i = 0; i < MWIFIEX_MAX_TXRX_BD; i++) { - card->tx_buf_list[i] = NULL; - if (reg->pfu_enabled) { - card->txbd_ring[i] = (void *)card->txbd_ring_vbase + - (sizeof(*desc2) * i); - desc2 = card->txbd_ring[i]; - memset(desc2, 0, sizeof(*desc2)); - } else { - card->txbd_ring[i] = (void *)card->txbd_ring_vbase + - (sizeof(*desc) * i); - desc = card->txbd_ring[i]; - memset(desc, 0, sizeof(*desc)); - } - } - - return 0; -} - -/* This function initializes RX buffer ring descriptors. Each SKB is allocated - * here and after mapping PCI memory, its physical address is assigned to - * PCIE Rx buffer descriptor's physical address. - */ -static int mwifiex_init_rxq_ring(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - struct sk_buff *skb; - struct mwifiex_pcie_buf_desc *desc; - struct mwifiex_pfu_buf_desc *desc2; - dma_addr_t buf_pa; - int i; - - for (i = 0; i < MWIFIEX_MAX_TXRX_BD; i++) { - /* Allocate skb here so that firmware can DMA data from it */ - skb = dev_alloc_skb(MWIFIEX_RX_DATA_BUF_SIZE); - if (!skb) { - dev_err(adapter->dev, - "Unable to allocate skb for RX ring.\n"); - kfree(card->rxbd_ring_vbase); - return -ENOMEM; - } - - if (mwifiex_map_pci_memory(adapter, skb, - MWIFIEX_RX_DATA_BUF_SIZE, - PCI_DMA_FROMDEVICE)) - return -1; - - MWIFIEX_SKB_PACB(skb, &buf_pa); - - dev_dbg(adapter->dev, - "info: RX ring: skb=%p len=%d data=%p buf_pa=%#x:%x\n", - skb, skb->len, skb->data, (u32)buf_pa, - (u32)((u64)buf_pa >> 32)); - - card->rx_buf_list[i] = skb; - if (reg->pfu_enabled) { - card->rxbd_ring[i] = (void *)card->rxbd_ring_vbase + - (sizeof(*desc2) * i); - desc2 = card->rxbd_ring[i]; - desc2->paddr = buf_pa; - desc2->len = (u16)skb->len; - desc2->frag_len = (u16)skb->len; - desc2->flags = reg->ring_flag_eop | reg->ring_flag_sop; - desc2->offset = 0; - } else { - card->rxbd_ring[i] = (void *)(card->rxbd_ring_vbase + - (sizeof(*desc) * i)); - desc = card->rxbd_ring[i]; - desc->paddr = buf_pa; - desc->len = (u16)skb->len; - desc->flags = 0; - } - } - - return 0; -} - -/* This function initializes event buffer ring descriptors. Each SKB is - * allocated here and after mapping PCI memory, its physical address is assigned - * to PCIE Rx buffer descriptor's physical address - */ -static int mwifiex_pcie_init_evt_ring(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - struct mwifiex_evt_buf_desc *desc; - struct sk_buff *skb; - dma_addr_t buf_pa; - int i; - - for (i = 0; i < MWIFIEX_MAX_EVT_BD; i++) { - /* Allocate skb here so that firmware can DMA data from it */ - skb = dev_alloc_skb(MAX_EVENT_SIZE); - if (!skb) { - dev_err(adapter->dev, - "Unable to allocate skb for EVENT buf.\n"); - kfree(card->evtbd_ring_vbase); - return -ENOMEM; - } - skb_put(skb, MAX_EVENT_SIZE); - - if (mwifiex_map_pci_memory(adapter, skb, MAX_EVENT_SIZE, - PCI_DMA_FROMDEVICE)) - return -1; - - MWIFIEX_SKB_PACB(skb, &buf_pa); - - dev_dbg(adapter->dev, - "info: EVT ring: skb=%p len=%d data=%p buf_pa=%#x:%x\n", - skb, skb->len, skb->data, (u32)buf_pa, - (u32)((u64)buf_pa >> 32)); - - card->evt_buf_list[i] = skb; - card->evtbd_ring[i] = (void *)(card->evtbd_ring_vbase + - (sizeof(*desc) * i)); - desc = card->evtbd_ring[i]; - desc->paddr = buf_pa; - desc->len = (u16)skb->len; - desc->flags = 0; - } - - return 0; -} - -/* This function cleans up TX buffer rings. If any of the buffer list has valid - * SKB address, associated SKB is freed. - */ -static void mwifiex_cleanup_txq_ring(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - struct sk_buff *skb; - struct mwifiex_pcie_buf_desc *desc; - struct mwifiex_pfu_buf_desc *desc2; - int i; - - for (i = 0; i < MWIFIEX_MAX_TXRX_BD; i++) { - if (reg->pfu_enabled) { - desc2 = card->txbd_ring[i]; - if (card->tx_buf_list[i]) { - skb = card->tx_buf_list[i]; - pci_unmap_single(card->dev, desc2->paddr, - skb->len, PCI_DMA_TODEVICE); - dev_kfree_skb_any(skb); - } - memset(desc2, 0, sizeof(*desc2)); - } else { - desc = card->txbd_ring[i]; - if (card->tx_buf_list[i]) { - skb = card->tx_buf_list[i]; - pci_unmap_single(card->dev, desc->paddr, - skb->len, PCI_DMA_TODEVICE); - dev_kfree_skb_any(skb); - } - memset(desc, 0, sizeof(*desc)); - } - card->tx_buf_list[i] = NULL; - } - - return; -} - -/* This function cleans up RX buffer rings. If any of the buffer list has valid - * SKB address, associated SKB is freed. - */ -static void mwifiex_cleanup_rxq_ring(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - struct mwifiex_pcie_buf_desc *desc; - struct mwifiex_pfu_buf_desc *desc2; - struct sk_buff *skb; - int i; - - for (i = 0; i < MWIFIEX_MAX_TXRX_BD; i++) { - if (reg->pfu_enabled) { - desc2 = card->rxbd_ring[i]; - if (card->rx_buf_list[i]) { - skb = card->rx_buf_list[i]; - pci_unmap_single(card->dev, desc2->paddr, - skb->len, PCI_DMA_FROMDEVICE); - dev_kfree_skb_any(skb); - } - memset(desc2, 0, sizeof(*desc2)); - } else { - desc = card->rxbd_ring[i]; - if (card->rx_buf_list[i]) { - skb = card->rx_buf_list[i]; - pci_unmap_single(card->dev, desc->paddr, - skb->len, PCI_DMA_FROMDEVICE); - dev_kfree_skb_any(skb); - } - memset(desc, 0, sizeof(*desc)); - } - card->rx_buf_list[i] = NULL; - } - - return; -} - -/* This function cleans up event buffer rings. If any of the buffer list has - * valid SKB address, associated SKB is freed. - */ -static void mwifiex_cleanup_evt_ring(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - struct mwifiex_evt_buf_desc *desc; - struct sk_buff *skb; - int i; - - for (i = 0; i < MWIFIEX_MAX_EVT_BD; i++) { - desc = card->evtbd_ring[i]; - if (card->evt_buf_list[i]) { - skb = card->evt_buf_list[i]; - pci_unmap_single(card->dev, desc->paddr, MAX_EVENT_SIZE, - PCI_DMA_FROMDEVICE); - dev_kfree_skb_any(skb); - } - card->evt_buf_list[i] = NULL; - memset(desc, 0, sizeof(*desc)); - } - - return; -} - -/* This function creates buffer descriptor ring for TX - */ -static int mwifiex_pcie_create_txbd_ring(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - /* - * driver maintaines the write pointer and firmware maintaines the read - * pointer. The write pointer starts at 0 (zero) while the read pointer - * starts at zero with rollover bit set - */ - card->txbd_wrptr = 0; - - if (reg->pfu_enabled) - card->txbd_rdptr = 0; - else - card->txbd_rdptr |= reg->tx_rollover_ind; - - /* allocate shared memory for the BD ring and divide the same in to - several descriptors */ - if (reg->pfu_enabled) - card->txbd_ring_size = sizeof(struct mwifiex_pfu_buf_desc) * - MWIFIEX_MAX_TXRX_BD; - else - card->txbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * - MWIFIEX_MAX_TXRX_BD; - - dev_dbg(adapter->dev, "info: txbd_ring: Allocating %d bytes\n", - card->txbd_ring_size); - card->txbd_ring_vbase = pci_alloc_consistent(card->dev, - card->txbd_ring_size, - &card->txbd_ring_pbase); - if (!card->txbd_ring_vbase) { - dev_err(adapter->dev, - "allocate consistent memory (%d bytes) failed!\n", - card->txbd_ring_size); - return -ENOMEM; - } - dev_dbg(adapter->dev, - "info: txbd_ring - base: %p, pbase: %#x:%x, len: %x\n", - card->txbd_ring_vbase, (unsigned int)card->txbd_ring_pbase, - (u32)((u64)card->txbd_ring_pbase >> 32), card->txbd_ring_size); - - return mwifiex_init_txq_ring(adapter); -} - -static int mwifiex_pcie_delete_txbd_ring(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - mwifiex_cleanup_txq_ring(adapter); - - if (card->txbd_ring_vbase) - pci_free_consistent(card->dev, card->txbd_ring_size, - card->txbd_ring_vbase, - card->txbd_ring_pbase); - card->txbd_ring_size = 0; - card->txbd_wrptr = 0; - card->txbd_rdptr = 0 | reg->tx_rollover_ind; - card->txbd_ring_vbase = NULL; - card->txbd_ring_pbase = 0; - - return 0; -} - -/* - * This function creates buffer descriptor ring for RX - */ -static int mwifiex_pcie_create_rxbd_ring(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - /* - * driver maintaines the read pointer and firmware maintaines the write - * pointer. The write pointer starts at 0 (zero) while the read pointer - * starts at zero with rollover bit set - */ - card->rxbd_wrptr = 0; - card->rxbd_rdptr = reg->rx_rollover_ind; - - if (reg->pfu_enabled) - card->rxbd_ring_size = sizeof(struct mwifiex_pfu_buf_desc) * - MWIFIEX_MAX_TXRX_BD; - else - card->rxbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * - MWIFIEX_MAX_TXRX_BD; - - dev_dbg(adapter->dev, "info: rxbd_ring: Allocating %d bytes\n", - card->rxbd_ring_size); - card->rxbd_ring_vbase = pci_alloc_consistent(card->dev, - card->rxbd_ring_size, - &card->rxbd_ring_pbase); - if (!card->rxbd_ring_vbase) { - dev_err(adapter->dev, - "allocate consistent memory (%d bytes) failed!\n", - card->rxbd_ring_size); - return -ENOMEM; - } - - dev_dbg(adapter->dev, - "info: rxbd_ring - base: %p, pbase: %#x:%x, len: %#x\n", - card->rxbd_ring_vbase, (u32)card->rxbd_ring_pbase, - (u32)((u64)card->rxbd_ring_pbase >> 32), - card->rxbd_ring_size); - - return mwifiex_init_rxq_ring(adapter); -} - -/* - * This function deletes Buffer descriptor ring for RX - */ -static int mwifiex_pcie_delete_rxbd_ring(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - mwifiex_cleanup_rxq_ring(adapter); - - if (card->rxbd_ring_vbase) - pci_free_consistent(card->dev, card->rxbd_ring_size, - card->rxbd_ring_vbase, - card->rxbd_ring_pbase); - card->rxbd_ring_size = 0; - card->rxbd_wrptr = 0; - card->rxbd_rdptr = 0 | reg->rx_rollover_ind; - card->rxbd_ring_vbase = NULL; - card->rxbd_ring_pbase = 0; - - return 0; -} - -/* - * This function creates buffer descriptor ring for Events - */ -static int mwifiex_pcie_create_evtbd_ring(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - /* - * driver maintaines the read pointer and firmware maintaines the write - * pointer. The write pointer starts at 0 (zero) while the read pointer - * starts at zero with rollover bit set - */ - card->evtbd_wrptr = 0; - card->evtbd_rdptr = reg->evt_rollover_ind; - - card->evtbd_ring_size = sizeof(struct mwifiex_evt_buf_desc) * - MWIFIEX_MAX_EVT_BD; - - dev_dbg(adapter->dev, "info: evtbd_ring: Allocating %d bytes\n", - card->evtbd_ring_size); - card->evtbd_ring_vbase = pci_alloc_consistent(card->dev, - card->evtbd_ring_size, - &card->evtbd_ring_pbase); - if (!card->evtbd_ring_vbase) { - dev_err(adapter->dev, - "allocate consistent memory (%d bytes) failed!\n", - card->evtbd_ring_size); - return -ENOMEM; - } - - dev_dbg(adapter->dev, - "info: CMDRSP/EVT bd_ring - base: %p pbase: %#x:%x len: %#x\n", - card->evtbd_ring_vbase, (u32)card->evtbd_ring_pbase, - (u32)((u64)card->evtbd_ring_pbase >> 32), - card->evtbd_ring_size); - - return mwifiex_pcie_init_evt_ring(adapter); -} - -/* - * This function deletes Buffer descriptor ring for Events - */ -static int mwifiex_pcie_delete_evtbd_ring(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - mwifiex_cleanup_evt_ring(adapter); - - if (card->evtbd_ring_vbase) - pci_free_consistent(card->dev, card->evtbd_ring_size, - card->evtbd_ring_vbase, - card->evtbd_ring_pbase); - card->evtbd_wrptr = 0; - card->evtbd_rdptr = 0 | reg->evt_rollover_ind; - card->evtbd_ring_size = 0; - card->evtbd_ring_vbase = NULL; - card->evtbd_ring_pbase = 0; - - return 0; -} - -/* - * This function allocates a buffer for CMDRSP - */ -static int mwifiex_pcie_alloc_cmdrsp_buf(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - struct sk_buff *skb; - - /* Allocate memory for receiving command response data */ - skb = dev_alloc_skb(MWIFIEX_UPLD_SIZE); - if (!skb) { - dev_err(adapter->dev, - "Unable to allocate skb for command response data.\n"); - return -ENOMEM; - } - skb_put(skb, MWIFIEX_UPLD_SIZE); - if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, - PCI_DMA_FROMDEVICE)) - return -1; - - card->cmdrsp_buf = skb; - - return 0; -} - -/* - * This function deletes a buffer for CMDRSP - */ -static int mwifiex_pcie_delete_cmdrsp_buf(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card; - dma_addr_t buf_pa; - - if (!adapter) - return 0; - - card = adapter->card; - - if (card && card->cmdrsp_buf) { - MWIFIEX_SKB_PACB(card->cmdrsp_buf, &buf_pa); - pci_unmap_single(card->dev, buf_pa, MWIFIEX_UPLD_SIZE, - PCI_DMA_FROMDEVICE); - dev_kfree_skb_any(card->cmdrsp_buf); - } - - if (card && card->cmd_buf) { - MWIFIEX_SKB_PACB(card->cmd_buf, &buf_pa); - pci_unmap_single(card->dev, buf_pa, card->cmd_buf->len, - PCI_DMA_TODEVICE); - } - return 0; -} - -/* - * This function allocates a buffer for sleep cookie - */ -static int mwifiex_pcie_alloc_sleep_cookie_buf(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - - card->sleep_cookie_vbase = pci_alloc_consistent(card->dev, sizeof(u32), - &card->sleep_cookie_pbase); - if (!card->sleep_cookie_vbase) { - dev_err(adapter->dev, "pci_alloc_consistent failed!\n"); - return -ENOMEM; - } - /* Init val of Sleep Cookie */ - *(u32 *)card->sleep_cookie_vbase = FW_AWAKE_COOKIE; - - dev_dbg(adapter->dev, "alloc_scook: sleep cookie=0x%x\n", - *((u32 *)card->sleep_cookie_vbase)); - - return 0; -} - -/* - * This function deletes buffer for sleep cookie - */ -static int mwifiex_pcie_delete_sleep_cookie_buf(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card; - - if (!adapter) - return 0; - - card = adapter->card; - - if (card && card->sleep_cookie_vbase) { - pci_free_consistent(card->dev, sizeof(u32), - card->sleep_cookie_vbase, - card->sleep_cookie_pbase); - card->sleep_cookie_vbase = NULL; - } - - return 0; -} - -/* This function flushes the TX buffer descriptor ring - * This function defined as handler is also called while cleaning TXRX - * during disconnect/ bss stop. - */ -static int mwifiex_clean_pcie_ring_buf(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - - if (!mwifiex_pcie_txbd_empty(card, card->txbd_rdptr)) { - card->txbd_flush = 1; - /* write pointer already set at last send - * send dnld-rdy intr again, wait for completion. - */ - if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, - CPU_INTR_DNLD_RDY)) { - dev_err(adapter->dev, - "failed to assert dnld-rdy interrupt.\n"); - return -1; - } - } - return 0; -} - -/* - * This function unmaps and frees downloaded data buffer - */ -static int mwifiex_pcie_send_data_complete(struct mwifiex_adapter *adapter) -{ - struct sk_buff *skb; - dma_addr_t buf_pa; - u32 wrdoneidx, rdptr, num_tx_buffs, unmap_count = 0; - struct mwifiex_pcie_buf_desc *desc; - struct mwifiex_pfu_buf_desc *desc2; - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - if (!mwifiex_pcie_ok_to_access_hw(adapter)) - mwifiex_pm_wakeup_card(adapter); - - /* Read the TX ring read pointer set by firmware */ - if (mwifiex_read_reg(adapter, reg->tx_rdptr, &rdptr)) { - dev_err(adapter->dev, - "SEND COMP: failed to read reg->tx_rdptr\n"); - return -1; - } - - dev_dbg(adapter->dev, "SEND COMP: rdptr_prev=0x%x, rdptr=0x%x\n", - card->txbd_rdptr, rdptr); - - num_tx_buffs = MWIFIEX_MAX_TXRX_BD << reg->tx_start_ptr; - /* free from previous txbd_rdptr to current txbd_rdptr */ - while (((card->txbd_rdptr & reg->tx_mask) != - (rdptr & reg->tx_mask)) || - ((card->txbd_rdptr & reg->tx_rollover_ind) != - (rdptr & reg->tx_rollover_ind))) { - wrdoneidx = (card->txbd_rdptr & reg->tx_mask) >> - reg->tx_start_ptr; - - skb = card->tx_buf_list[wrdoneidx]; - if (skb) { - dev_dbg(adapter->dev, - "SEND COMP: Detach skb %p at txbd_rdidx=%d\n", - skb, wrdoneidx); - MWIFIEX_SKB_PACB(skb, &buf_pa); - pci_unmap_single(card->dev, buf_pa, skb->len, - PCI_DMA_TODEVICE); - - unmap_count++; - - if (card->txbd_flush) - mwifiex_write_data_complete(adapter, skb, 0, - -1); - else - mwifiex_write_data_complete(adapter, skb, 0, 0); - } - - card->tx_buf_list[wrdoneidx] = NULL; - - if (reg->pfu_enabled) { - desc2 = (void *)card->txbd_ring[wrdoneidx]; - memset(desc2, 0, sizeof(*desc2)); - } else { - desc = card->txbd_ring[wrdoneidx]; - memset(desc, 0, sizeof(*desc)); - } - switch (card->dev->device) { - case PCIE_DEVICE_ID_MARVELL_88W8766P: - card->txbd_rdptr++; - break; - case PCIE_DEVICE_ID_MARVELL_88W8897: - card->txbd_rdptr += reg->ring_tx_start_ptr; - break; - } - - - if ((card->txbd_rdptr & reg->tx_mask) == num_tx_buffs) - card->txbd_rdptr = ((card->txbd_rdptr & - reg->tx_rollover_ind) ^ - reg->tx_rollover_ind); - } - - if (unmap_count) - adapter->data_sent = false; - - if (card->txbd_flush) { - if (mwifiex_pcie_txbd_empty(card, card->txbd_rdptr)) - card->txbd_flush = 0; - else - mwifiex_clean_pcie_ring_buf(adapter); - } - - return 0; -} - -/* This function sends data buffer to device. First 4 bytes of payload - * are filled with payload length and payload type. Then this payload - * is mapped to PCI device memory. Tx ring pointers are advanced accordingly. - * Download ready interrupt to FW is deffered if Tx ring is not full and - * additional payload can be accomodated. - */ -static int -mwifiex_pcie_send_data(struct mwifiex_adapter *adapter, struct sk_buff *skb, - struct mwifiex_tx_param *tx_param) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - u32 wrindx, num_tx_buffs, rx_val; - int ret; - dma_addr_t buf_pa; - struct mwifiex_pcie_buf_desc *desc = NULL; - struct mwifiex_pfu_buf_desc *desc2 = NULL; - __le16 *tmp; - - if (!(skb->data && skb->len)) { - dev_err(adapter->dev, "%s(): invalid parameter <%p, %#x>\n", - __func__, skb->data, skb->len); - return -1; - } - - if (!mwifiex_pcie_ok_to_access_hw(adapter)) - mwifiex_pm_wakeup_card(adapter); - - num_tx_buffs = MWIFIEX_MAX_TXRX_BD << reg->tx_start_ptr; - dev_dbg(adapter->dev, "info: SEND DATA: \n", - card->txbd_rdptr, card->txbd_wrptr); - if (mwifiex_pcie_txbd_not_full(card)) { - u8 *payload; - - adapter->data_sent = true; - payload = skb->data; - tmp = (__le16 *)&payload[0]; - *tmp = cpu_to_le16((u16)skb->len); - tmp = (__le16 *)&payload[2]; - *tmp = cpu_to_le16(MWIFIEX_TYPE_DATA); - - if (mwifiex_map_pci_memory(adapter, skb, skb->len , - PCI_DMA_TODEVICE)) - return -1; - - wrindx = (card->txbd_wrptr & reg->tx_mask) >> reg->tx_start_ptr; - MWIFIEX_SKB_PACB(skb, &buf_pa); - card->tx_buf_list[wrindx] = skb; - - if (reg->pfu_enabled) { - desc2 = (void *)card->txbd_ring[wrindx]; - desc2->paddr = buf_pa; - desc2->len = (u16)skb->len; - desc2->frag_len = (u16)skb->len; - desc2->offset = 0; - desc2->flags = MWIFIEX_BD_FLAG_FIRST_DESC | - MWIFIEX_BD_FLAG_LAST_DESC; - } else { - desc = card->txbd_ring[wrindx]; - desc->paddr = buf_pa; - desc->len = (u16)skb->len; - desc->flags = MWIFIEX_BD_FLAG_FIRST_DESC | - MWIFIEX_BD_FLAG_LAST_DESC; - } - - switch (card->dev->device) { - case PCIE_DEVICE_ID_MARVELL_88W8766P: - card->txbd_wrptr++; - break; - case PCIE_DEVICE_ID_MARVELL_88W8897: - card->txbd_wrptr += reg->ring_tx_start_ptr; - break; - } - - if ((card->txbd_wrptr & reg->tx_mask) == num_tx_buffs) - card->txbd_wrptr = ((card->txbd_wrptr & - reg->tx_rollover_ind) ^ - reg->tx_rollover_ind); - - rx_val = card->rxbd_rdptr & reg->rx_wrap_mask; - /* Write the TX ring write pointer in to reg->tx_wrptr */ - if (mwifiex_write_reg(adapter, reg->tx_wrptr, - card->txbd_wrptr | rx_val)) { - dev_err(adapter->dev, - "SEND DATA: failed to write reg->tx_wrptr\n"); - ret = -1; - goto done_unmap; - } - if ((mwifiex_pcie_txbd_not_full(card)) && - tx_param->next_pkt_len) { - /* have more packets and TxBD still can hold more */ - dev_dbg(adapter->dev, - "SEND DATA: delay dnld-rdy interrupt.\n"); - adapter->data_sent = false; - } else { - /* Send the TX ready interrupt */ - if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, - CPU_INTR_DNLD_RDY)) { - dev_err(adapter->dev, - "SEND DATA: failed to assert dnld-rdy interrupt.\n"); - ret = -1; - goto done_unmap; - } - } - dev_dbg(adapter->dev, "info: SEND DATA: Updated and sent packet to firmware successfully\n", - card->txbd_rdptr, card->txbd_wrptr); - } else { - dev_dbg(adapter->dev, - "info: TX Ring full, can't send packets to fw\n"); - adapter->data_sent = true; - /* Send the TX ready interrupt */ - if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, - CPU_INTR_DNLD_RDY)) - dev_err(adapter->dev, - "SEND DATA: failed to assert door-bell intr\n"); - return -EBUSY; - } - - return -EINPROGRESS; -done_unmap: - MWIFIEX_SKB_PACB(skb, &buf_pa); - pci_unmap_single(card->dev, buf_pa, skb->len, PCI_DMA_TODEVICE); - card->tx_buf_list[wrindx] = NULL; - if (reg->pfu_enabled) - memset(desc2, 0, sizeof(*desc2)); - else - memset(desc, 0, sizeof(*desc)); - - return ret; -} - -/* - * This function handles received buffer ring and - * dispatches packets to upper - */ -static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - u32 wrptr, rd_index, tx_val; - dma_addr_t buf_pa; - int ret = 0; - struct sk_buff *skb_tmp = NULL; - struct mwifiex_pcie_buf_desc *desc; - struct mwifiex_pfu_buf_desc *desc2; - - if (!mwifiex_pcie_ok_to_access_hw(adapter)) - mwifiex_pm_wakeup_card(adapter); - - /* Read the RX ring Write pointer set by firmware */ - if (mwifiex_read_reg(adapter, reg->rx_wrptr, &wrptr)) { - dev_err(adapter->dev, - "RECV DATA: failed to read reg->rx_wrptr\n"); - ret = -1; - goto done; - } - card->rxbd_wrptr = wrptr; - - while (((wrptr & reg->rx_mask) != - (card->rxbd_rdptr & reg->rx_mask)) || - ((wrptr & reg->rx_rollover_ind) == - (card->rxbd_rdptr & reg->rx_rollover_ind))) { - struct sk_buff *skb_data; - u16 rx_len; - __le16 pkt_len; - - rd_index = card->rxbd_rdptr & reg->rx_mask; - skb_data = card->rx_buf_list[rd_index]; - - MWIFIEX_SKB_PACB(skb_data, &buf_pa); - pci_unmap_single(card->dev, buf_pa, MWIFIEX_RX_DATA_BUF_SIZE, - PCI_DMA_FROMDEVICE); - card->rx_buf_list[rd_index] = NULL; - - /* Get data length from interface header - - * first 2 bytes for len, next 2 bytes is for type - */ - pkt_len = *((__le16 *)skb_data->data); - rx_len = le16_to_cpu(pkt_len); - skb_put(skb_data, rx_len); - dev_dbg(adapter->dev, - "info: RECV DATA: Rd=%#x, Wr=%#x, Len=%d\n", - card->rxbd_rdptr, wrptr, rx_len); - skb_pull(skb_data, INTF_HEADER_LEN); - mwifiex_handle_rx_packet(adapter, skb_data); - - skb_tmp = dev_alloc_skb(MWIFIEX_RX_DATA_BUF_SIZE); - if (!skb_tmp) { - dev_err(adapter->dev, - "Unable to allocate skb.\n"); - return -ENOMEM; - } - - if (mwifiex_map_pci_memory(adapter, skb_tmp, - MWIFIEX_RX_DATA_BUF_SIZE, - PCI_DMA_FROMDEVICE)) - return -1; - - MWIFIEX_SKB_PACB(skb_tmp, &buf_pa); - - dev_dbg(adapter->dev, - "RECV DATA: Attach new sk_buff %p at rxbd_rdidx=%d\n", - skb_tmp, rd_index); - card->rx_buf_list[rd_index] = skb_tmp; - - if (reg->pfu_enabled) { - desc2 = (void *)card->rxbd_ring[rd_index]; - desc2->paddr = buf_pa; - desc2->len = skb_tmp->len; - desc2->frag_len = skb_tmp->len; - desc2->offset = 0; - desc2->flags = reg->ring_flag_sop | reg->ring_flag_eop; - } else { - desc = card->rxbd_ring[rd_index]; - desc->paddr = buf_pa; - desc->len = skb_tmp->len; - desc->flags = 0; - } - - if ((++card->rxbd_rdptr & reg->rx_mask) == - MWIFIEX_MAX_TXRX_BD) { - card->rxbd_rdptr = ((card->rxbd_rdptr & - reg->rx_rollover_ind) ^ - reg->rx_rollover_ind); - } - dev_dbg(adapter->dev, "info: RECV DATA: \n", - card->rxbd_rdptr, wrptr); - - tx_val = card->txbd_wrptr & reg->tx_wrap_mask; - /* Write the RX ring read pointer in to reg->rx_rdptr */ - if (mwifiex_write_reg(adapter, reg->rx_rdptr, - card->rxbd_rdptr | tx_val)) { - dev_err(adapter->dev, - "RECV DATA: failed to write reg->rx_rdptr\n"); - ret = -1; - goto done; - } - - /* Read the RX ring Write pointer set by firmware */ - if (mwifiex_read_reg(adapter, reg->rx_wrptr, &wrptr)) { - dev_err(adapter->dev, - "RECV DATA: failed to read reg->rx_wrptr\n"); - ret = -1; - goto done; - } - dev_dbg(adapter->dev, - "info: RECV DATA: Rcvd packet from fw successfully\n"); - card->rxbd_wrptr = wrptr; - } - -done: - return ret; -} - -/* - * This function downloads the boot command to device - */ -static int -mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) -{ - dma_addr_t buf_pa; - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - if (!(skb->data && skb->len)) { - dev_err(adapter->dev, - "Invalid parameter in %s <%p. len %d>\n", - __func__, skb->data, skb->len); - return -1; - } - - if (mwifiex_map_pci_memory(adapter, skb, skb->len , PCI_DMA_TODEVICE)) - return -1; - - MWIFIEX_SKB_PACB(skb, &buf_pa); - - /* Write the lower 32bits of the physical address to low command - * address scratch register - */ - if (mwifiex_write_reg(adapter, reg->cmd_addr_lo, (u32)buf_pa)) { - dev_err(adapter->dev, - "%s: failed to write download command to boot code.\n", - __func__); - pci_unmap_single(card->dev, buf_pa, MWIFIEX_UPLD_SIZE, - PCI_DMA_TODEVICE); - return -1; - } - - /* Write the upper 32bits of the physical address to high command - * address scratch register - */ - if (mwifiex_write_reg(adapter, reg->cmd_addr_hi, - (u32)((u64)buf_pa >> 32))) { - dev_err(adapter->dev, - "%s: failed to write download command to boot code.\n", - __func__); - pci_unmap_single(card->dev, buf_pa, MWIFIEX_UPLD_SIZE, - PCI_DMA_TODEVICE); - return -1; - } - - /* Write the command length to cmd_size scratch register */ - if (mwifiex_write_reg(adapter, reg->cmd_size, skb->len)) { - dev_err(adapter->dev, - "%s: failed to write command len to cmd_size scratch reg\n", - __func__); - pci_unmap_single(card->dev, buf_pa, MWIFIEX_UPLD_SIZE, - PCI_DMA_TODEVICE); - return -1; - } - - /* Ring the door bell */ - if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, - CPU_INTR_DOOR_BELL)) { - dev_err(adapter->dev, - "%s: failed to assert door-bell intr\n", __func__); - pci_unmap_single(card->dev, buf_pa, - MWIFIEX_UPLD_SIZE, PCI_DMA_TODEVICE); - return -1; - } - - return 0; -} - -/* This function init rx port in firmware which in turn enables to receive data - * from device before transmitting any packet. - */ -static int mwifiex_pcie_init_fw_port(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - int tx_wrap = card->txbd_wrptr & reg->tx_wrap_mask; - - /* Write the RX ring read pointer in to reg->rx_rdptr */ - if (mwifiex_write_reg(adapter, reg->rx_rdptr, card->rxbd_rdptr | - tx_wrap)) { - dev_err(adapter->dev, - "RECV DATA: failed to write reg->rx_rdptr\n"); - return -1; - } - return 0; -} - -/* This function downloads commands to the device - */ -static int -mwifiex_pcie_send_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - int ret = 0; - dma_addr_t cmd_buf_pa, cmdrsp_buf_pa; - u8 *payload = (u8 *)skb->data; - - if (!(skb->data && skb->len)) { - dev_err(adapter->dev, "Invalid parameter in %s <%p, %#x>\n", - __func__, skb->data, skb->len); - return -1; - } - - /* Make sure a command response buffer is available */ - if (!card->cmdrsp_buf) { - dev_err(adapter->dev, - "No response buffer available, send command failed\n"); - return -EBUSY; - } - - if (!mwifiex_pcie_ok_to_access_hw(adapter)) - mwifiex_pm_wakeup_card(adapter); - - adapter->cmd_sent = true; - - *(__le16 *)&payload[0] = cpu_to_le16((u16)skb->len); - *(__le16 *)&payload[2] = cpu_to_le16(MWIFIEX_TYPE_CMD); - - if (mwifiex_map_pci_memory(adapter, skb, skb->len, PCI_DMA_TODEVICE)) - return -1; - - card->cmd_buf = skb; - - /* To send a command, the driver will: - 1. Write the 64bit physical address of the data buffer to - cmd response address low + cmd response address high - 2. Ring the door bell (i.e. set the door bell interrupt) - - In response to door bell interrupt, the firmware will perform - the DMA of the command packet (first header to obtain the total - length and then rest of the command). - */ - - if (card->cmdrsp_buf) { - MWIFIEX_SKB_PACB(card->cmdrsp_buf, &cmdrsp_buf_pa); - /* Write the lower 32bits of the cmdrsp buffer physical - address */ - if (mwifiex_write_reg(adapter, reg->cmdrsp_addr_lo, - (u32)cmdrsp_buf_pa)) { - dev_err(adapter->dev, - "Failed to write download cmd to boot code.\n"); - ret = -1; - goto done; - } - /* Write the upper 32bits of the cmdrsp buffer physical - address */ - if (mwifiex_write_reg(adapter, reg->cmdrsp_addr_hi, - (u32)((u64)cmdrsp_buf_pa >> 32))) { - dev_err(adapter->dev, - "Failed to write download cmd to boot code.\n"); - ret = -1; - goto done; - } - } - - MWIFIEX_SKB_PACB(card->cmd_buf, &cmd_buf_pa); - /* Write the lower 32bits of the physical address to reg->cmd_addr_lo */ - if (mwifiex_write_reg(adapter, reg->cmd_addr_lo, - (u32)cmd_buf_pa)) { - dev_err(adapter->dev, - "Failed to write download cmd to boot code.\n"); - ret = -1; - goto done; - } - /* Write the upper 32bits of the physical address to reg->cmd_addr_hi */ - if (mwifiex_write_reg(adapter, reg->cmd_addr_hi, - (u32)((u64)cmd_buf_pa >> 32))) { - dev_err(adapter->dev, - "Failed to write download cmd to boot code.\n"); - ret = -1; - goto done; - } - - /* Write the command length to reg->cmd_size */ - if (mwifiex_write_reg(adapter, reg->cmd_size, - card->cmd_buf->len)) { - dev_err(adapter->dev, - "Failed to write cmd len to reg->cmd_size\n"); - ret = -1; - goto done; - } - - /* Ring the door bell */ - if (mwifiex_write_reg(adapter, PCIE_CPU_INT_EVENT, - CPU_INTR_DOOR_BELL)) { - dev_err(adapter->dev, - "Failed to assert door-bell intr\n"); - ret = -1; - goto done; - } - -done: - if (ret) - adapter->cmd_sent = false; - - return 0; -} - -/* - * This function handles command complete interrupt - */ -static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - struct sk_buff *skb = card->cmdrsp_buf; - int count = 0; - u16 rx_len; - __le16 pkt_len; - dma_addr_t buf_pa; - - dev_dbg(adapter->dev, "info: Rx CMD Response\n"); - - MWIFIEX_SKB_PACB(skb, &buf_pa); - pci_unmap_single(card->dev, buf_pa, MWIFIEX_UPLD_SIZE, - PCI_DMA_FROMDEVICE); - - pkt_len = *((__le16 *)skb->data); - rx_len = le16_to_cpu(pkt_len); - skb_trim(skb, rx_len); - skb_pull(skb, INTF_HEADER_LEN); - - if (!adapter->curr_cmd) { - if (adapter->ps_state == PS_STATE_SLEEP_CFM) { - mwifiex_process_sleep_confirm_resp(adapter, skb->data, - skb->len); - while (reg->sleep_cookie && (count++ < 10) && - mwifiex_pcie_ok_to_access_hw(adapter)) - usleep_range(50, 60); - } else { - dev_err(adapter->dev, - "There is no command but got cmdrsp\n"); - } - memcpy(adapter->upld_buf, skb->data, - min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len)); - skb_push(skb, INTF_HEADER_LEN); - if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, - PCI_DMA_FROMDEVICE)) - return -1; - - MWIFIEX_SKB_PACB(skb, &buf_pa); - } else if (mwifiex_pcie_ok_to_access_hw(adapter)) { - adapter->curr_cmd->resp_skb = skb; - adapter->cmd_resp_received = true; - /* Take the pointer and set it to CMD node and will - return in the response complete callback */ - card->cmdrsp_buf = NULL; - - /* Clear the cmd-rsp buffer address in scratch registers. This - will prevent firmware from writing to the same response - buffer again. */ - if (mwifiex_write_reg(adapter, reg->cmdrsp_addr_lo, 0)) { - dev_err(adapter->dev, - "cmd_done: failed to clear cmd_rsp_addr_lo\n"); - return -1; - } - /* Write the upper 32bits of the cmdrsp buffer physical - address */ - if (mwifiex_write_reg(adapter, reg->cmdrsp_addr_hi, 0)) { - dev_err(adapter->dev, - "cmd_done: failed to clear cmd_rsp_addr_hi\n"); - return -1; - } - } - - return 0; -} - -/* - * Command Response processing complete handler - */ -static int mwifiex_pcie_cmdrsp_complete(struct mwifiex_adapter *adapter, - struct sk_buff *skb) -{ - struct pcie_service_card *card = adapter->card; - dma_addr_t buf_pa; - struct sk_buff *skb_tmp; - - if (skb) { - card->cmdrsp_buf = skb; - skb_push(card->cmdrsp_buf, INTF_HEADER_LEN); - if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, - PCI_DMA_FROMDEVICE)) - return -1; - } - - skb_tmp = card->cmd_buf; - if (skb_tmp) { - MWIFIEX_SKB_PACB(skb_tmp, &buf_pa); - pci_unmap_single(card->dev, buf_pa, skb_tmp->len, - PCI_DMA_FROMDEVICE); - card->cmd_buf = NULL; - } - - return 0; -} - -/* - * This function handles firmware event ready interrupt - */ -static int mwifiex_pcie_process_event_ready(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - u32 rdptr = card->evtbd_rdptr & MWIFIEX_EVTBD_MASK; - u32 wrptr, event; - dma_addr_t buf_pa; - struct mwifiex_evt_buf_desc *desc; - - if (!mwifiex_pcie_ok_to_access_hw(adapter)) - mwifiex_pm_wakeup_card(adapter); - - if (adapter->event_received) { - dev_dbg(adapter->dev, "info: Event being processed, " - "do not process this interrupt just yet\n"); - return 0; - } - - if (rdptr >= MWIFIEX_MAX_EVT_BD) { - dev_dbg(adapter->dev, "info: Invalid read pointer...\n"); - return -1; - } - - /* Read the event ring write pointer set by firmware */ - if (mwifiex_read_reg(adapter, reg->evt_wrptr, &wrptr)) { - dev_err(adapter->dev, - "EventReady: failed to read reg->evt_wrptr\n"); - return -1; - } - - dev_dbg(adapter->dev, "info: EventReady: Initial ", - card->evtbd_rdptr, wrptr); - if (((wrptr & MWIFIEX_EVTBD_MASK) != (card->evtbd_rdptr - & MWIFIEX_EVTBD_MASK)) || - ((wrptr & reg->evt_rollover_ind) == - (card->evtbd_rdptr & reg->evt_rollover_ind))) { - struct sk_buff *skb_cmd; - __le16 data_len = 0; - u16 evt_len; - - dev_dbg(adapter->dev, "info: Read Index: %d\n", rdptr); - skb_cmd = card->evt_buf_list[rdptr]; - MWIFIEX_SKB_PACB(skb_cmd, &buf_pa); - pci_unmap_single(card->dev, buf_pa, MAX_EVENT_SIZE, - PCI_DMA_FROMDEVICE); - - /* Take the pointer and set it to event pointer in adapter - and will return back after event handling callback */ - card->evt_buf_list[rdptr] = NULL; - desc = card->evtbd_ring[rdptr]; - memset(desc, 0, sizeof(*desc)); - - event = *(u32 *) &skb_cmd->data[INTF_HEADER_LEN]; - adapter->event_cause = event; - /* The first 4bytes will be the event transfer header - len is 2 bytes followed by type which is 2 bytes */ - memcpy(&data_len, skb_cmd->data, sizeof(__le16)); - evt_len = le16_to_cpu(data_len); - - skb_pull(skb_cmd, INTF_HEADER_LEN); - dev_dbg(adapter->dev, "info: Event length: %d\n", evt_len); - - if ((evt_len > 0) && (evt_len < MAX_EVENT_SIZE)) - memcpy(adapter->event_body, skb_cmd->data + - MWIFIEX_EVENT_HEADER_LEN, evt_len - - MWIFIEX_EVENT_HEADER_LEN); - - adapter->event_received = true; - adapter->event_skb = skb_cmd; - - /* Do not update the event read pointer here, wait till the - buffer is released. This is just to make things simpler, - we need to find a better method of managing these buffers. - */ - } - - return 0; -} - -/* - * Event processing complete handler - */ -static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter, - struct sk_buff *skb) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - int ret = 0; - u32 rdptr = card->evtbd_rdptr & MWIFIEX_EVTBD_MASK; - u32 wrptr; - dma_addr_t buf_pa; - struct mwifiex_evt_buf_desc *desc; - - if (!skb) - return 0; - - if (rdptr >= MWIFIEX_MAX_EVT_BD) { - dev_err(adapter->dev, "event_complete: Invalid rdptr 0x%x\n", - rdptr); - return -EINVAL; - } - - /* Read the event ring write pointer set by firmware */ - if (mwifiex_read_reg(adapter, reg->evt_wrptr, &wrptr)) { - dev_err(adapter->dev, - "event_complete: failed to read reg->evt_wrptr\n"); - return -1; - } - - if (!card->evt_buf_list[rdptr]) { - skb_push(skb, INTF_HEADER_LEN); - if (mwifiex_map_pci_memory(adapter, skb, - MAX_EVENT_SIZE, - PCI_DMA_FROMDEVICE)) - return -1; - MWIFIEX_SKB_PACB(skb, &buf_pa); - card->evt_buf_list[rdptr] = skb; - MWIFIEX_SKB_PACB(skb, &buf_pa); - desc = card->evtbd_ring[rdptr]; - desc->paddr = buf_pa; - desc->len = (u16)skb->len; - desc->flags = 0; - skb = NULL; - } else { - dev_dbg(adapter->dev, - "info: ERROR: buf still valid at index %d, <%p, %p>\n", - rdptr, card->evt_buf_list[rdptr], skb); - } - - if ((++card->evtbd_rdptr & MWIFIEX_EVTBD_MASK) == MWIFIEX_MAX_EVT_BD) { - card->evtbd_rdptr = ((card->evtbd_rdptr & - reg->evt_rollover_ind) ^ - reg->evt_rollover_ind); - } - - dev_dbg(adapter->dev, "info: Updated ", - card->evtbd_rdptr, wrptr); - - /* Write the event ring read pointer in to reg->evt_rdptr */ - if (mwifiex_write_reg(adapter, reg->evt_rdptr, - card->evtbd_rdptr)) { - dev_err(adapter->dev, - "event_complete: failed to read reg->evt_rdptr\n"); - return -1; - } - - dev_dbg(adapter->dev, "info: Check Events Again\n"); - ret = mwifiex_pcie_process_event_ready(adapter); - - return ret; -} - -/* - * This function downloads the firmware to the card. - * - * Firmware is downloaded to the card in blocks. Every block download - * is tested for CRC errors, and retried a number of times before - * returning failure. - */ -static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, - struct mwifiex_fw_image *fw) -{ - int ret; - u8 *firmware = fw->fw_buf; - u32 firmware_len = fw->fw_len; - u32 offset = 0; - struct sk_buff *skb; - u32 txlen, tx_blocks = 0, tries, len; - u32 block_retry_cnt = 0; - dma_addr_t buf_pa; - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - if (!firmware || !firmware_len) { - dev_err(adapter->dev, - "No firmware image found! Terminating download\n"); - return -1; - } - - dev_dbg(adapter->dev, "info: Downloading FW image (%d bytes)\n", - firmware_len); - - if (mwifiex_pcie_disable_host_int(adapter)) { - dev_err(adapter->dev, - "%s: Disabling interrupts failed.\n", __func__); - return -1; - } - - skb = dev_alloc_skb(MWIFIEX_UPLD_SIZE); - if (!skb) { - ret = -ENOMEM; - goto done; - } - - /* Perform firmware data transfer */ - do { - u32 ireg_intr = 0; - - /* More data? */ - if (offset >= firmware_len) - break; - - for (tries = 0; tries < MAX_POLL_TRIES; tries++) { - ret = mwifiex_read_reg(adapter, reg->cmd_size, - &len); - if (ret) { - dev_warn(adapter->dev, - "Failed reading len from boot code\n"); - goto done; - } - if (len) - break; - usleep_range(10, 20); - } - - if (!len) { - break; - } else if (len > MWIFIEX_UPLD_SIZE) { - pr_err("FW download failure @ %d, invalid length %d\n", - offset, len); - ret = -1; - goto done; - } - - txlen = len; - - if (len & BIT(0)) { - block_retry_cnt++; - if (block_retry_cnt > MAX_WRITE_IOMEM_RETRY) { - pr_err("FW download failure @ %d, over max " - "retry count\n", offset); - ret = -1; - goto done; - } - dev_err(adapter->dev, "FW CRC error indicated by the " - "helper: len = 0x%04X, txlen = %d\n", - len, txlen); - len &= ~BIT(0); - /* Setting this to 0 to resend from same offset */ - txlen = 0; - } else { - block_retry_cnt = 0; - /* Set blocksize to transfer - checking for - last block */ - if (firmware_len - offset < txlen) - txlen = firmware_len - offset; - - dev_dbg(adapter->dev, "."); - - tx_blocks = (txlen + card->pcie.blksz_fw_dl - 1) / - card->pcie.blksz_fw_dl; - - /* Copy payload to buffer */ - memmove(skb->data, &firmware[offset], txlen); - } - - skb_put(skb, MWIFIEX_UPLD_SIZE - skb->len); - skb_trim(skb, tx_blocks * card->pcie.blksz_fw_dl); - - /* Send the boot command to device */ - if (mwifiex_pcie_send_boot_cmd(adapter, skb)) { - dev_err(adapter->dev, - "Failed to send firmware download command\n"); - ret = -1; - goto done; - } - - MWIFIEX_SKB_PACB(skb, &buf_pa); - - /* Wait for the command done interrupt */ - do { - if (mwifiex_read_reg(adapter, PCIE_CPU_INT_STATUS, - &ireg_intr)) { - dev_err(adapter->dev, "%s: Failed to read " - "interrupt status during fw dnld.\n", - __func__); - pci_unmap_single(card->dev, buf_pa, skb->len, - PCI_DMA_TODEVICE); - ret = -1; - goto done; - } - } while ((ireg_intr & CPU_INTR_DOOR_BELL) == - CPU_INTR_DOOR_BELL); - - pci_unmap_single(card->dev, buf_pa, skb->len, - PCI_DMA_TODEVICE); - - offset += txlen; - } while (true); - - dev_dbg(adapter->dev, "info:\nFW download over, size %d bytes\n", - offset); - - ret = 0; - -done: - dev_kfree_skb_any(skb); - return ret; -} - -/* - * This function checks the firmware status in card. - * - * The winner interface is also determined by this function. - */ -static int -mwifiex_check_fw_status(struct mwifiex_adapter *adapter, u32 poll_num) -{ - int ret = 0; - u32 firmware_stat, winner_status; - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - u32 tries; - - /* Mask spurios interrupts */ - if (mwifiex_write_reg(adapter, PCIE_HOST_INT_STATUS_MASK, - HOST_INTR_MASK)) { - dev_warn(adapter->dev, "Write register failed\n"); - return -1; - } - - dev_dbg(adapter->dev, "Setting driver ready signature\n"); - if (mwifiex_write_reg(adapter, reg->drv_rdy, - FIRMWARE_READY_PCIE)) { - dev_err(adapter->dev, - "Failed to write driver ready signature\n"); - return -1; - } - - /* Wait for firmware initialization event */ - for (tries = 0; tries < poll_num; tries++) { - if (mwifiex_read_reg(adapter, reg->fw_status, - &firmware_stat)) - ret = -1; - else - ret = 0; - if (ret) - continue; - if (firmware_stat == FIRMWARE_READY_PCIE) { - ret = 0; - break; - } else { - mdelay(100); - ret = -1; - } - } - - if (ret) { - if (mwifiex_read_reg(adapter, reg->fw_status, - &winner_status)) - ret = -1; - else if (!winner_status) { - dev_err(adapter->dev, "PCI-E is the winner\n"); - adapter->winner = 1; - ret = -1; - } else { - dev_err(adapter->dev, - "PCI-E is not the winner <%#x,%d>, exit dnld\n", - ret, adapter->winner); - ret = 0; - } - } - - return ret; -} - -/* - * This function reads the interrupt status from card. - */ -static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter) -{ - u32 pcie_ireg; - unsigned long flags; - - if (!mwifiex_pcie_ok_to_access_hw(adapter)) - return; - - if (mwifiex_read_reg(adapter, PCIE_HOST_INT_STATUS, &pcie_ireg)) { - dev_warn(adapter->dev, "Read register failed\n"); - return; - } - - if ((pcie_ireg != 0xFFFFFFFF) && (pcie_ireg)) { - - mwifiex_pcie_disable_host_int(adapter); - - /* Clear the pending interrupts */ - if (mwifiex_write_reg(adapter, PCIE_HOST_INT_STATUS, - ~pcie_ireg)) { - dev_warn(adapter->dev, "Write register failed\n"); - return; - } - spin_lock_irqsave(&adapter->int_lock, flags); - adapter->int_status |= pcie_ireg; - spin_unlock_irqrestore(&adapter->int_lock, flags); - - if (pcie_ireg & HOST_INTR_CMD_DONE) { - if ((adapter->ps_state == PS_STATE_SLEEP_CFM) || - (adapter->ps_state == PS_STATE_SLEEP)) { - mwifiex_pcie_enable_host_int(adapter); - if (mwifiex_write_reg(adapter, - PCIE_CPU_INT_EVENT, - CPU_INTR_SLEEP_CFM_DONE) - ) { - dev_warn(adapter->dev, - "Write register failed\n"); - return; - - } - } - } else if (!adapter->pps_uapsd_mode && - adapter->ps_state == PS_STATE_SLEEP && - mwifiex_pcie_ok_to_access_hw(adapter)) { - /* Potentially for PCIe we could get other - * interrupts like shared. Don't change power - * state until cookie is set */ - adapter->ps_state = PS_STATE_AWAKE; - adapter->pm_wakeup_fw_try = false; - } - } -} - -/* - * Interrupt handler for PCIe root port - * - * This function reads the interrupt status from firmware and assigns - * the main process in workqueue which will handle the interrupt. - */ -static irqreturn_t mwifiex_pcie_interrupt(int irq, void *context) -{ - struct pci_dev *pdev = (struct pci_dev *)context; - struct pcie_service_card *card; - struct mwifiex_adapter *adapter; - - if (!pdev) { - pr_debug("info: %s: pdev is NULL\n", (u8 *)pdev); - goto exit; - } - - card = (struct pcie_service_card *) pci_get_drvdata(pdev); - if (!card || !card->adapter) { - pr_debug("info: %s: card=%p adapter=%p\n", __func__, card, - card ? card->adapter : NULL); - goto exit; - } - adapter = card->adapter; - - if (adapter->surprise_removed) - goto exit; - - mwifiex_interrupt_status(adapter); - queue_work(adapter->workqueue, &adapter->main_work); - -exit: - return IRQ_HANDLED; -} - -/* - * This function checks the current interrupt status. - * - * The following interrupts are checked and handled by this function - - * - Data sent - * - Command sent - * - Command received - * - Packets received - * - Events received - * - * In case of Rx packets received, the packets are uploaded from card to - * host and processed accordingly. - */ -static int mwifiex_process_int_status(struct mwifiex_adapter *adapter) -{ - int ret; - u32 pcie_ireg; - unsigned long flags; - - spin_lock_irqsave(&adapter->int_lock, flags); - /* Clear out unused interrupts */ - pcie_ireg = adapter->int_status; - adapter->int_status = 0; - spin_unlock_irqrestore(&adapter->int_lock, flags); - - while (pcie_ireg & HOST_INTR_MASK) { - if (pcie_ireg & HOST_INTR_DNLD_DONE) { - pcie_ireg &= ~HOST_INTR_DNLD_DONE; - dev_dbg(adapter->dev, "info: TX DNLD Done\n"); - ret = mwifiex_pcie_send_data_complete(adapter); - if (ret) - return ret; - } - if (pcie_ireg & HOST_INTR_UPLD_RDY) { - pcie_ireg &= ~HOST_INTR_UPLD_RDY; - dev_dbg(adapter->dev, "info: Rx DATA\n"); - ret = mwifiex_pcie_process_recv_data(adapter); - if (ret) - return ret; - } - if (pcie_ireg & HOST_INTR_EVENT_RDY) { - pcie_ireg &= ~HOST_INTR_EVENT_RDY; - dev_dbg(adapter->dev, "info: Rx EVENT\n"); - ret = mwifiex_pcie_process_event_ready(adapter); - if (ret) - return ret; - } - - if (pcie_ireg & HOST_INTR_CMD_DONE) { - pcie_ireg &= ~HOST_INTR_CMD_DONE; - if (adapter->cmd_sent) { - dev_dbg(adapter->dev, - "info: CMD sent Interrupt\n"); - adapter->cmd_sent = false; - } - /* Handle command response */ - ret = mwifiex_pcie_process_cmd_complete(adapter); - if (ret) - return ret; - } - - if (mwifiex_pcie_ok_to_access_hw(adapter)) { - if (mwifiex_read_reg(adapter, PCIE_HOST_INT_STATUS, - &pcie_ireg)) { - dev_warn(adapter->dev, - "Read register failed\n"); - return -1; - } - - if ((pcie_ireg != 0xFFFFFFFF) && (pcie_ireg)) { - if (mwifiex_write_reg(adapter, - PCIE_HOST_INT_STATUS, - ~pcie_ireg)) { - dev_warn(adapter->dev, - "Write register failed\n"); - return -1; - } - } - - } - } - dev_dbg(adapter->dev, "info: cmd_sent=%d data_sent=%d\n", - adapter->cmd_sent, adapter->data_sent); - if (adapter->ps_state != PS_STATE_SLEEP) - mwifiex_pcie_enable_host_int(adapter); - - return 0; -} - -/* - * This function downloads data from driver to card. - * - * Both commands and data packets are transferred to the card by this - * function. - * - * This function adds the PCIE specific header to the front of the buffer - * before transferring. The header contains the length of the packet and - * the type. The firmware handles the packets based upon this set type. - */ -static int mwifiex_pcie_host_to_card(struct mwifiex_adapter *adapter, u8 type, - struct sk_buff *skb, - struct mwifiex_tx_param *tx_param) -{ - if (!skb) { - dev_err(adapter->dev, "Passed NULL skb to %s\n", __func__); - return -1; - } - - if (type == MWIFIEX_TYPE_DATA) - return mwifiex_pcie_send_data(adapter, skb, tx_param); - else if (type == MWIFIEX_TYPE_CMD) - return mwifiex_pcie_send_cmd(adapter, skb); - - return 0; -} - -/* - * This function initializes the PCI-E host memory space, WCB rings, etc. - * - * The following initializations steps are followed - - * - Allocate TXBD ring buffers - * - Allocate RXBD ring buffers - * - Allocate event BD ring buffers - * - Allocate command response ring buffer - * - Allocate sleep cookie buffer - */ -static int mwifiex_pcie_init(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - int ret; - struct pci_dev *pdev = card->dev; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - pci_set_drvdata(pdev, card); - - ret = pci_enable_device(pdev); - if (ret) - goto err_enable_dev; - - pci_set_master(pdev); - - dev_dbg(adapter->dev, "try set_consistent_dma_mask(32)\n"); - ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); - if (ret) { - dev_err(adapter->dev, "set_dma_mask(32) failed\n"); - goto err_set_dma_mask; - } - - ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); - if (ret) { - dev_err(adapter->dev, "set_consistent_dma_mask(64) failed\n"); - goto err_set_dma_mask; - } - - ret = pci_request_region(pdev, 0, DRV_NAME); - if (ret) { - dev_err(adapter->dev, "req_reg(0) error\n"); - goto err_req_region0; - } - card->pci_mmap = pci_iomap(pdev, 0, 0); - if (!card->pci_mmap) { - dev_err(adapter->dev, "iomap(0) error\n"); - ret = -EIO; - goto err_iomap0; - } - ret = pci_request_region(pdev, 2, DRV_NAME); - if (ret) { - dev_err(adapter->dev, "req_reg(2) error\n"); - goto err_req_region2; - } - card->pci_mmap1 = pci_iomap(pdev, 2, 0); - if (!card->pci_mmap1) { - dev_err(adapter->dev, "iomap(2) error\n"); - ret = -EIO; - goto err_iomap2; - } - - dev_dbg(adapter->dev, - "PCI memory map Virt0: %p PCI memory map Virt2: %p\n", - card->pci_mmap, card->pci_mmap1); - - card->cmdrsp_buf = NULL; - ret = mwifiex_pcie_create_txbd_ring(adapter); - if (ret) - goto err_cre_txbd; - ret = mwifiex_pcie_create_rxbd_ring(adapter); - if (ret) - goto err_cre_rxbd; - ret = mwifiex_pcie_create_evtbd_ring(adapter); - if (ret) - goto err_cre_evtbd; - ret = mwifiex_pcie_alloc_cmdrsp_buf(adapter); - if (ret) - goto err_alloc_cmdbuf; - if (reg->sleep_cookie) { - ret = mwifiex_pcie_alloc_sleep_cookie_buf(adapter); - if (ret) - goto err_alloc_cookie; - } else { - card->sleep_cookie_vbase = NULL; - } - return ret; - -err_alloc_cookie: - mwifiex_pcie_delete_cmdrsp_buf(adapter); -err_alloc_cmdbuf: - mwifiex_pcie_delete_evtbd_ring(adapter); -err_cre_evtbd: - mwifiex_pcie_delete_rxbd_ring(adapter); -err_cre_rxbd: - mwifiex_pcie_delete_txbd_ring(adapter); -err_cre_txbd: - pci_iounmap(pdev, card->pci_mmap1); -err_iomap2: - pci_release_region(pdev, 2); -err_req_region2: - pci_iounmap(pdev, card->pci_mmap); -err_iomap0: - pci_release_region(pdev, 0); -err_req_region0: -err_set_dma_mask: - pci_disable_device(pdev); -err_enable_dev: - pci_set_drvdata(pdev, NULL); - return ret; -} - -/* - * This function cleans up the allocated card buffers. - * - * The following are freed by this function - - * - TXBD ring buffers - * - RXBD ring buffers - * - Event BD ring buffers - * - Command response ring buffer - * - Sleep cookie buffer - */ -static void mwifiex_pcie_cleanup(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - struct pci_dev *pdev = card->dev; - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - if (user_rmmod) { - dev_dbg(adapter->dev, "Clearing driver ready signature\n"); - if (mwifiex_write_reg(adapter, reg->drv_rdy, 0x00000000)) - dev_err(adapter->dev, - "Failed to write driver not-ready signature\n"); - } - - if (pdev) { - pci_iounmap(pdev, card->pci_mmap); - pci_iounmap(pdev, card->pci_mmap1); - pci_disable_device(pdev); - pci_release_region(pdev, 2); - pci_release_region(pdev, 0); - pci_set_drvdata(pdev, NULL); - } -} - -/* - * This function registers the PCIE device. - * - * PCIE IRQ is claimed, block size is set and driver data is initialized. - */ -static int mwifiex_register_dev(struct mwifiex_adapter *adapter) -{ - int ret; - struct pcie_service_card *card = adapter->card; - struct pci_dev *pdev = card->dev; - - /* save adapter pointer in card */ - card->adapter = adapter; - - ret = request_irq(pdev->irq, mwifiex_pcie_interrupt, IRQF_SHARED, - "MRVL_PCIE", pdev); - if (ret) { - pr_err("request_irq failed: ret=%d\n", ret); - adapter->card = NULL; - return -1; - } - - adapter->dev = &pdev->dev; - strcpy(adapter->fw_name, card->pcie.firmware); - - return 0; -} - -/* - * This function unregisters the PCIE device. - * - * The PCIE IRQ is released, the function is disabled and driver - * data is set to null. - */ -static void mwifiex_unregister_dev(struct mwifiex_adapter *adapter) -{ - struct pcie_service_card *card = adapter->card; - const struct mwifiex_pcie_card_reg *reg; - - if (card) { - dev_dbg(adapter->dev, "%s(): calling free_irq()\n", __func__); - free_irq(card->dev->irq, card->dev); - - reg = card->pcie.reg; - if (reg->sleep_cookie) - mwifiex_pcie_delete_sleep_cookie_buf(adapter); - - mwifiex_pcie_delete_cmdrsp_buf(adapter); - mwifiex_pcie_delete_evtbd_ring(adapter); - mwifiex_pcie_delete_rxbd_ring(adapter); - mwifiex_pcie_delete_txbd_ring(adapter); - card->cmdrsp_buf = NULL; - } -} - -static struct mwifiex_if_ops pcie_ops = { - .init_if = mwifiex_pcie_init, - .cleanup_if = mwifiex_pcie_cleanup, - .check_fw_status = mwifiex_check_fw_status, - .prog_fw = mwifiex_prog_fw_w_helper, - .register_dev = mwifiex_register_dev, - .unregister_dev = mwifiex_unregister_dev, - .enable_int = mwifiex_pcie_enable_host_int, - .process_int_status = mwifiex_process_int_status, - .host_to_card = mwifiex_pcie_host_to_card, - .wakeup = mwifiex_pm_wakeup_card, - .wakeup_complete = mwifiex_pm_wakeup_card_complete, - - /* PCIE specific */ - .cmdrsp_complete = mwifiex_pcie_cmdrsp_complete, - .event_complete = mwifiex_pcie_event_complete, - .update_mp_end_port = NULL, - .cleanup_mpa_buf = NULL, - .init_fw_port = mwifiex_pcie_init_fw_port, - .clean_pcie_ring = mwifiex_clean_pcie_ring_buf, -}; - -/* - * This function initializes the PCIE driver module. - * - * This initiates the semaphore and registers the device with - * PCIE bus. - */ -static int mwifiex_pcie_init_module(void) -{ - int ret; - - pr_debug("Marvell PCIe Driver\n"); - - sema_init(&add_remove_card_sem, 1); - - /* Clear the flag in case user removes the card. */ - user_rmmod = 0; - - ret = pci_register_driver(&mwifiex_pcie); - if (ret) - pr_err("Driver register failed!\n"); - else - pr_debug("info: Driver registered successfully!\n"); - - return ret; -} - -/* - * This function cleans up the PCIE driver. - * - * The following major steps are followed for cleanup - - * - Resume the device if its suspended - * - Disconnect the device if connected - * - Shutdown the firmware - * - Unregister the device from PCIE bus. - */ -static void mwifiex_pcie_cleanup_module(void) -{ - if (!down_interruptible(&add_remove_card_sem)) - up(&add_remove_card_sem); - - /* Set the flag as user is removing this module. */ - user_rmmod = 1; - - pci_unregister_driver(&mwifiex_pcie); -} - -module_init(mwifiex_pcie_init_module); -module_exit(mwifiex_pcie_cleanup_module); - -MODULE_AUTHOR("Marvell International Ltd."); -MODULE_DESCRIPTION("Marvell WiFi-Ex PCI-Express Driver version " PCIE_VERSION); -MODULE_VERSION(PCIE_VERSION); -MODULE_LICENSE("GPL v2"); -MODULE_FIRMWARE(PCIE8766_DEFAULT_FW_NAME); -MODULE_FIRMWARE(PCIE8897_DEFAULT_FW_NAME); diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h deleted file mode 100644 index d322ab8604ea..000000000000 --- a/drivers/net/wireless/mwifiex/pcie.h +++ /dev/null @@ -1,320 +0,0 @@ -/* @file mwifiex_pcie.h - * - * @brief This file contains definitions for PCI-E interface. - * driver. - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef _MWIFIEX_PCIE_H -#define _MWIFIEX_PCIE_H - -#include -#include -#include - -#include "main.h" - -#define PCIE8766_DEFAULT_FW_NAME "mrvl/pcie8766_uapsta.bin" -#define PCIE8897_DEFAULT_FW_NAME "mrvl/pcie8897_uapsta.bin" - -#define PCIE_VENDOR_ID_MARVELL (0x11ab) -#define PCIE_DEVICE_ID_MARVELL_88W8766P (0x2b30) -#define PCIE_DEVICE_ID_MARVELL_88W8897 (0x2b38) - -/* Constants for Buffer Descriptor (BD) rings */ -#define MWIFIEX_MAX_TXRX_BD 0x20 -#define MWIFIEX_TXBD_MASK 0x3F -#define MWIFIEX_RXBD_MASK 0x3F - -#define MWIFIEX_MAX_EVT_BD 0x04 -#define MWIFIEX_EVTBD_MASK 0x07 - -/* PCIE INTERNAL REGISTERS */ -#define PCIE_SCRATCH_0_REG 0xC10 -#define PCIE_SCRATCH_1_REG 0xC14 -#define PCIE_CPU_INT_EVENT 0xC18 -#define PCIE_CPU_INT_STATUS 0xC1C -#define PCIE_HOST_INT_STATUS 0xC30 -#define PCIE_HOST_INT_MASK 0xC34 -#define PCIE_HOST_INT_STATUS_MASK 0xC3C -#define PCIE_SCRATCH_2_REG 0xC40 -#define PCIE_SCRATCH_3_REG 0xC44 -#define PCIE_SCRATCH_4_REG 0xCD0 -#define PCIE_SCRATCH_5_REG 0xCD4 -#define PCIE_SCRATCH_6_REG 0xCD8 -#define PCIE_SCRATCH_7_REG 0xCDC -#define PCIE_SCRATCH_8_REG 0xCE0 -#define PCIE_SCRATCH_9_REG 0xCE4 -#define PCIE_SCRATCH_10_REG 0xCE8 -#define PCIE_SCRATCH_11_REG 0xCEC -#define PCIE_SCRATCH_12_REG 0xCF0 -#define PCIE_RD_DATA_PTR_Q0_Q1 0xC08C -#define PCIE_WR_DATA_PTR_Q0_Q1 0xC05C - -#define CPU_INTR_DNLD_RDY BIT(0) -#define CPU_INTR_DOOR_BELL BIT(1) -#define CPU_INTR_SLEEP_CFM_DONE BIT(2) -#define CPU_INTR_RESET BIT(3) - -#define HOST_INTR_DNLD_DONE BIT(0) -#define HOST_INTR_UPLD_RDY BIT(1) -#define HOST_INTR_CMD_DONE BIT(2) -#define HOST_INTR_EVENT_RDY BIT(3) -#define HOST_INTR_MASK (HOST_INTR_DNLD_DONE | \ - HOST_INTR_UPLD_RDY | \ - HOST_INTR_CMD_DONE | \ - HOST_INTR_EVENT_RDY) - -#define MWIFIEX_BD_FLAG_ROLLOVER_IND BIT(7) -#define MWIFIEX_BD_FLAG_FIRST_DESC BIT(0) -#define MWIFIEX_BD_FLAG_LAST_DESC BIT(1) -#define MWIFIEX_BD_FLAG_SOP BIT(0) -#define MWIFIEX_BD_FLAG_EOP BIT(1) -#define MWIFIEX_BD_FLAG_XS_SOP BIT(2) -#define MWIFIEX_BD_FLAG_XS_EOP BIT(3) -#define MWIFIEX_BD_FLAG_EVT_ROLLOVER_IND BIT(7) -#define MWIFIEX_BD_FLAG_RX_ROLLOVER_IND BIT(10) -#define MWIFIEX_BD_FLAG_TX_START_PTR BIT(16) -#define MWIFIEX_BD_FLAG_TX_ROLLOVER_IND BIT(26) - -/* Max retry number of command write */ -#define MAX_WRITE_IOMEM_RETRY 2 -/* Define PCIE block size for firmware download */ -#define MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD 256 -/* FW awake cookie after FW ready */ -#define FW_AWAKE_COOKIE (0xAA55AA55) - -struct mwifiex_pcie_card_reg { - u16 cmd_addr_lo; - u16 cmd_addr_hi; - u16 fw_status; - u16 cmd_size; - u16 cmdrsp_addr_lo; - u16 cmdrsp_addr_hi; - u16 tx_rdptr; - u16 tx_wrptr; - u16 rx_rdptr; - u16 rx_wrptr; - u16 evt_rdptr; - u16 evt_wrptr; - u16 drv_rdy; - u16 tx_start_ptr; - u32 tx_mask; - u32 tx_wrap_mask; - u32 rx_mask; - u32 rx_wrap_mask; - u32 tx_rollover_ind; - u32 rx_rollover_ind; - u32 evt_rollover_ind; - u8 ring_flag_sop; - u8 ring_flag_eop; - u8 ring_flag_xs_sop; - u8 ring_flag_xs_eop; - u32 ring_tx_start_ptr; - u8 pfu_enabled; - u8 sleep_cookie; -}; - -static const struct mwifiex_pcie_card_reg mwifiex_reg_8766 = { - .cmd_addr_lo = PCIE_SCRATCH_0_REG, - .cmd_addr_hi = PCIE_SCRATCH_1_REG, - .cmd_size = PCIE_SCRATCH_2_REG, - .fw_status = PCIE_SCRATCH_3_REG, - .cmdrsp_addr_lo = PCIE_SCRATCH_4_REG, - .cmdrsp_addr_hi = PCIE_SCRATCH_5_REG, - .tx_rdptr = PCIE_SCRATCH_6_REG, - .tx_wrptr = PCIE_SCRATCH_7_REG, - .rx_rdptr = PCIE_SCRATCH_8_REG, - .rx_wrptr = PCIE_SCRATCH_9_REG, - .evt_rdptr = PCIE_SCRATCH_10_REG, - .evt_wrptr = PCIE_SCRATCH_11_REG, - .drv_rdy = PCIE_SCRATCH_12_REG, - .tx_start_ptr = 0, - .tx_mask = MWIFIEX_TXBD_MASK, - .tx_wrap_mask = 0, - .rx_mask = MWIFIEX_RXBD_MASK, - .rx_wrap_mask = 0, - .tx_rollover_ind = MWIFIEX_BD_FLAG_ROLLOVER_IND, - .rx_rollover_ind = MWIFIEX_BD_FLAG_ROLLOVER_IND, - .evt_rollover_ind = MWIFIEX_BD_FLAG_ROLLOVER_IND, - .ring_flag_sop = 0, - .ring_flag_eop = 0, - .ring_flag_xs_sop = 0, - .ring_flag_xs_eop = 0, - .ring_tx_start_ptr = 0, - .pfu_enabled = 0, - .sleep_cookie = 1, -}; - -static const struct mwifiex_pcie_card_reg mwifiex_reg_8897 = { - .cmd_addr_lo = PCIE_SCRATCH_0_REG, - .cmd_addr_hi = PCIE_SCRATCH_1_REG, - .cmd_size = PCIE_SCRATCH_2_REG, - .fw_status = PCIE_SCRATCH_3_REG, - .cmdrsp_addr_lo = PCIE_SCRATCH_4_REG, - .cmdrsp_addr_hi = PCIE_SCRATCH_5_REG, - .tx_rdptr = PCIE_RD_DATA_PTR_Q0_Q1, - .tx_wrptr = PCIE_WR_DATA_PTR_Q0_Q1, - .rx_rdptr = PCIE_WR_DATA_PTR_Q0_Q1, - .rx_wrptr = PCIE_RD_DATA_PTR_Q0_Q1, - .evt_rdptr = PCIE_SCRATCH_10_REG, - .evt_wrptr = PCIE_SCRATCH_11_REG, - .drv_rdy = PCIE_SCRATCH_12_REG, - .tx_start_ptr = 16, - .tx_mask = 0x03FF0000, - .tx_wrap_mask = 0x07FF0000, - .rx_mask = 0x000003FF, - .rx_wrap_mask = 0x000007FF, - .tx_rollover_ind = MWIFIEX_BD_FLAG_TX_ROLLOVER_IND, - .rx_rollover_ind = MWIFIEX_BD_FLAG_RX_ROLLOVER_IND, - .evt_rollover_ind = MWIFIEX_BD_FLAG_EVT_ROLLOVER_IND, - .ring_flag_sop = MWIFIEX_BD_FLAG_SOP, - .ring_flag_eop = MWIFIEX_BD_FLAG_EOP, - .ring_flag_xs_sop = MWIFIEX_BD_FLAG_XS_SOP, - .ring_flag_xs_eop = MWIFIEX_BD_FLAG_XS_EOP, - .ring_tx_start_ptr = MWIFIEX_BD_FLAG_TX_START_PTR, - .pfu_enabled = 1, - .sleep_cookie = 0, -}; - -struct mwifiex_pcie_device { - const char *firmware; - const struct mwifiex_pcie_card_reg *reg; - u16 blksz_fw_dl; -}; - -static const struct mwifiex_pcie_device mwifiex_pcie8766 = { - .firmware = PCIE8766_DEFAULT_FW_NAME, - .reg = &mwifiex_reg_8766, - .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, -}; - -static const struct mwifiex_pcie_device mwifiex_pcie8897 = { - .firmware = PCIE8897_DEFAULT_FW_NAME, - .reg = &mwifiex_reg_8897, - .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, -}; - -struct mwifiex_evt_buf_desc { - u64 paddr; - u16 len; - u16 flags; -} __packed; - -struct mwifiex_pcie_buf_desc { - u64 paddr; - u16 len; - u16 flags; -} __packed; - -struct mwifiex_pfu_buf_desc { - u16 flags; - u16 offset; - u16 frag_len; - u16 len; - u64 paddr; - u32 reserved; -} __packed; - -struct pcie_service_card { - struct pci_dev *dev; - struct mwifiex_adapter *adapter; - struct mwifiex_pcie_device pcie; - - u8 txbd_flush; - u32 txbd_wrptr; - u32 txbd_rdptr; - u32 txbd_ring_size; - u8 *txbd_ring_vbase; - dma_addr_t txbd_ring_pbase; - void *txbd_ring[MWIFIEX_MAX_TXRX_BD]; - struct sk_buff *tx_buf_list[MWIFIEX_MAX_TXRX_BD]; - - u32 rxbd_wrptr; - u32 rxbd_rdptr; - u32 rxbd_ring_size; - u8 *rxbd_ring_vbase; - dma_addr_t rxbd_ring_pbase; - void *rxbd_ring[MWIFIEX_MAX_TXRX_BD]; - struct sk_buff *rx_buf_list[MWIFIEX_MAX_TXRX_BD]; - - u32 evtbd_wrptr; - u32 evtbd_rdptr; - u32 evtbd_ring_size; - u8 *evtbd_ring_vbase; - dma_addr_t evtbd_ring_pbase; - void *evtbd_ring[MWIFIEX_MAX_EVT_BD]; - struct sk_buff *evt_buf_list[MWIFIEX_MAX_EVT_BD]; - - struct sk_buff *cmd_buf; - struct sk_buff *cmdrsp_buf; - u8 *sleep_cookie_vbase; - dma_addr_t sleep_cookie_pbase; - void __iomem *pci_mmap; - void __iomem *pci_mmap1; -}; - -static inline int -mwifiex_pcie_txbd_empty(struct pcie_service_card *card, u32 rdptr) -{ - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - switch (card->dev->device) { - case PCIE_DEVICE_ID_MARVELL_88W8766P: - if (((card->txbd_wrptr & reg->tx_mask) == - (rdptr & reg->tx_mask)) && - ((card->txbd_wrptr & reg->tx_rollover_ind) != - (rdptr & reg->tx_rollover_ind))) - return 1; - break; - case PCIE_DEVICE_ID_MARVELL_88W8897: - if (((card->txbd_wrptr & reg->tx_mask) == - (rdptr & reg->tx_mask)) && - ((card->txbd_wrptr & reg->tx_rollover_ind) == - (rdptr & reg->tx_rollover_ind))) - return 1; - break; - } - - return 0; -} - -static inline int -mwifiex_pcie_txbd_not_full(struct pcie_service_card *card) -{ - const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; - - switch (card->dev->device) { - case PCIE_DEVICE_ID_MARVELL_88W8766P: - if (((card->txbd_wrptr & reg->tx_mask) != - (card->txbd_rdptr & reg->tx_mask)) || - ((card->txbd_wrptr & reg->tx_rollover_ind) != - (card->txbd_rdptr & reg->tx_rollover_ind))) - return 1; - break; - case PCIE_DEVICE_ID_MARVELL_88W8897: - if (((card->txbd_wrptr & reg->tx_mask) != - (card->txbd_rdptr & reg->tx_mask)) || - ((card->txbd_wrptr & reg->tx_rollover_ind) == - (card->txbd_rdptr & reg->tx_rollover_ind))) - return 1; - break; - } - - return 0; -} -#endif /* _MWIFIEX_PCIE_H */ diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c deleted file mode 100644 index 9cf5d8f07df8..000000000000 --- a/drivers/net/wireless/mwifiex/scan.c +++ /dev/null @@ -1,2071 +0,0 @@ -/* - * Marvell Wireless LAN device driver: scan ioctl and command handling - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "11n.h" -#include "cfg80211.h" - -/* The maximum number of channels the firmware can scan per command */ -#define MWIFIEX_MAX_CHANNELS_PER_SPECIFIC_SCAN 14 - -#define MWIFIEX_DEF_CHANNELS_PER_SCAN_CMD 4 -#define MWIFIEX_LIMIT_1_CHANNEL_PER_SCAN_CMD 15 -#define MWIFIEX_LIMIT_2_CHANNELS_PER_SCAN_CMD 27 -#define MWIFIEX_LIMIT_3_CHANNELS_PER_SCAN_CMD 35 - -/* Memory needed to store a max sized Channel List TLV for a firmware scan */ -#define CHAN_TLV_MAX_SIZE (sizeof(struct mwifiex_ie_types_header) \ - + (MWIFIEX_MAX_CHANNELS_PER_SPECIFIC_SCAN \ - *sizeof(struct mwifiex_chan_scan_param_set))) - -/* Memory needed to store supported rate */ -#define RATE_TLV_MAX_SIZE (sizeof(struct mwifiex_ie_types_rates_param_set) \ - + HOSTCMD_SUPPORTED_RATES) - -/* Memory needed to store a max number/size WildCard SSID TLV for a firmware - scan */ -#define WILDCARD_SSID_TLV_MAX_SIZE \ - (MWIFIEX_MAX_SSID_LIST_LENGTH * \ - (sizeof(struct mwifiex_ie_types_wildcard_ssid_params) \ - + IEEE80211_MAX_SSID_LEN)) - -/* Maximum memory needed for a mwifiex_scan_cmd_config with all TLVs at max */ -#define MAX_SCAN_CFG_ALLOC (sizeof(struct mwifiex_scan_cmd_config) \ - + sizeof(struct mwifiex_ie_types_num_probes) \ - + sizeof(struct mwifiex_ie_types_htcap) \ - + CHAN_TLV_MAX_SIZE \ - + RATE_TLV_MAX_SIZE \ - + WILDCARD_SSID_TLV_MAX_SIZE) - - -union mwifiex_scan_cmd_config_tlv { - /* Scan configuration (variable length) */ - struct mwifiex_scan_cmd_config config; - /* Max allocated block */ - u8 config_alloc_buf[MAX_SCAN_CFG_ALLOC]; -}; - -enum cipher_suite { - CIPHER_SUITE_TKIP, - CIPHER_SUITE_CCMP, - CIPHER_SUITE_MAX -}; -static u8 mwifiex_wpa_oui[CIPHER_SUITE_MAX][4] = { - { 0x00, 0x50, 0xf2, 0x02 }, /* TKIP */ - { 0x00, 0x50, 0xf2, 0x04 }, /* AES */ -}; -static u8 mwifiex_rsn_oui[CIPHER_SUITE_MAX][4] = { - { 0x00, 0x0f, 0xac, 0x02 }, /* TKIP */ - { 0x00, 0x0f, 0xac, 0x04 }, /* AES */ -}; - -/* - * This function parses a given IE for a given OUI. - * - * This is used to parse a WPA/RSN IE to find if it has - * a given oui in PTK. - */ -static u8 -mwifiex_search_oui_in_ie(struct ie_body *iebody, u8 *oui) -{ - u8 count; - - count = iebody->ptk_cnt[0]; - - /* There could be multiple OUIs for PTK hence - 1) Take the length. - 2) Check all the OUIs for AES. - 3) If one of them is AES then pass success. */ - while (count) { - if (!memcmp(iebody->ptk_body, oui, sizeof(iebody->ptk_body))) - return MWIFIEX_OUI_PRESENT; - - --count; - if (count) - iebody = (struct ie_body *) ((u8 *) iebody + - sizeof(iebody->ptk_body)); - } - - pr_debug("info: %s: OUI is not found in PTK\n", __func__); - return MWIFIEX_OUI_NOT_PRESENT; -} - -/* - * This function checks if a given OUI is present in a RSN IE. - * - * The function first checks if a RSN IE is present or not in the - * BSS descriptor. It tries to locate the OUI only if such an IE is - * present. - */ -static u8 -mwifiex_is_rsn_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher) -{ - u8 *oui; - struct ie_body *iebody; - u8 ret = MWIFIEX_OUI_NOT_PRESENT; - - if (((bss_desc->bcn_rsn_ie) && ((*(bss_desc->bcn_rsn_ie)). - ieee_hdr.element_id == WLAN_EID_RSN))) { - iebody = (struct ie_body *) - (((u8 *) bss_desc->bcn_rsn_ie->data) + - RSN_GTK_OUI_OFFSET); - oui = &mwifiex_rsn_oui[cipher][0]; - ret = mwifiex_search_oui_in_ie(iebody, oui); - if (ret) - return ret; - } - return ret; -} - -/* - * This function checks if a given OUI is present in a WPA IE. - * - * The function first checks if a WPA IE is present or not in the - * BSS descriptor. It tries to locate the OUI only if such an IE is - * present. - */ -static u8 -mwifiex_is_wpa_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher) -{ - u8 *oui; - struct ie_body *iebody; - u8 ret = MWIFIEX_OUI_NOT_PRESENT; - - if (((bss_desc->bcn_wpa_ie) && - ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id == - WLAN_EID_VENDOR_SPECIFIC))) { - iebody = (struct ie_body *) bss_desc->bcn_wpa_ie->data; - oui = &mwifiex_wpa_oui[cipher][0]; - ret = mwifiex_search_oui_in_ie(iebody, oui); - if (ret) - return ret; - } - return ret; -} - -/* - * This function compares two SSIDs and checks if they match. - */ -s32 -mwifiex_ssid_cmp(struct cfg80211_ssid *ssid1, struct cfg80211_ssid *ssid2) -{ - if (!ssid1 || !ssid2 || (ssid1->ssid_len != ssid2->ssid_len)) - return -1; - return memcmp(ssid1->ssid, ssid2->ssid, ssid1->ssid_len); -} - -/* - * This function checks if wapi is enabled in driver and scanned network is - * compatible with it. - */ -static bool -mwifiex_is_bss_wapi(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc) -{ - if (priv->sec_info.wapi_enabled && - (bss_desc->bcn_wapi_ie && - ((*(bss_desc->bcn_wapi_ie)).ieee_hdr.element_id == - WLAN_EID_BSS_AC_ACCESS_DELAY))) { - return true; - } - return false; -} - -/* - * This function checks if driver is configured with no security mode and - * scanned network is compatible with it. - */ -static bool -mwifiex_is_bss_no_sec(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc) -{ - if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled && - !priv->sec_info.wpa2_enabled && ((!bss_desc->bcn_wpa_ie) || - ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id != - WLAN_EID_VENDOR_SPECIFIC)) && - ((!bss_desc->bcn_rsn_ie) || - ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != - WLAN_EID_RSN)) && - !priv->sec_info.encryption_mode && !bss_desc->privacy) { - return true; - } - return false; -} - -/* - * This function checks if static WEP is enabled in driver and scanned network - * is compatible with it. - */ -static bool -mwifiex_is_bss_static_wep(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc) -{ - if (priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled && - !priv->sec_info.wpa2_enabled && bss_desc->privacy) { - return true; - } - return false; -} - -/* - * This function checks if wpa is enabled in driver and scanned network is - * compatible with it. - */ -static bool -mwifiex_is_bss_wpa(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc) -{ - if (!priv->sec_info.wep_enabled && priv->sec_info.wpa_enabled && - !priv->sec_info.wpa2_enabled && ((bss_desc->bcn_wpa_ie) && - ((*(bss_desc->bcn_wpa_ie)). - vend_hdr.element_id == WLAN_EID_VENDOR_SPECIFIC)) - /* - * Privacy bit may NOT be set in some APs like - * LinkSys WRT54G && bss_desc->privacy - */ - ) { - dev_dbg(priv->adapter->dev, "info: %s: WPA:" - " wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " - "EncMode=%#x privacy=%#x\n", __func__, - (bss_desc->bcn_wpa_ie) ? - (*(bss_desc->bcn_wpa_ie)). - vend_hdr.element_id : 0, - (bss_desc->bcn_rsn_ie) ? - (*(bss_desc->bcn_rsn_ie)). - ieee_hdr.element_id : 0, - (priv->sec_info.wep_enabled) ? "e" : "d", - (priv->sec_info.wpa_enabled) ? "e" : "d", - (priv->sec_info.wpa2_enabled) ? "e" : "d", - priv->sec_info.encryption_mode, - bss_desc->privacy); - return true; - } - return false; -} - -/* - * This function checks if wpa2 is enabled in driver and scanned network is - * compatible with it. - */ -static bool -mwifiex_is_bss_wpa2(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc) -{ - if (!priv->sec_info.wep_enabled && - !priv->sec_info.wpa_enabled && - priv->sec_info.wpa2_enabled && - ((bss_desc->bcn_rsn_ie) && - ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id == WLAN_EID_RSN))) { - /* - * Privacy bit may NOT be set in some APs like - * LinkSys WRT54G && bss_desc->privacy - */ - dev_dbg(priv->adapter->dev, "info: %s: WPA2: " - " wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " - "EncMode=%#x privacy=%#x\n", __func__, - (bss_desc->bcn_wpa_ie) ? - (*(bss_desc->bcn_wpa_ie)). - vend_hdr.element_id : 0, - (bss_desc->bcn_rsn_ie) ? - (*(bss_desc->bcn_rsn_ie)). - ieee_hdr.element_id : 0, - (priv->sec_info.wep_enabled) ? "e" : "d", - (priv->sec_info.wpa_enabled) ? "e" : "d", - (priv->sec_info.wpa2_enabled) ? "e" : "d", - priv->sec_info.encryption_mode, - bss_desc->privacy); - return true; - } - return false; -} - -/* - * This function checks if adhoc AES is enabled in driver and scanned network is - * compatible with it. - */ -static bool -mwifiex_is_bss_adhoc_aes(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc) -{ - if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled && - !priv->sec_info.wpa2_enabled && - ((!bss_desc->bcn_wpa_ie) || - ((*(bss_desc->bcn_wpa_ie)). - vend_hdr.element_id != WLAN_EID_VENDOR_SPECIFIC)) && - ((!bss_desc->bcn_rsn_ie) || - ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != WLAN_EID_RSN)) && - !priv->sec_info.encryption_mode && bss_desc->privacy) { - return true; - } - return false; -} - -/* - * This function checks if dynamic WEP is enabled in driver and scanned network - * is compatible with it. - */ -static bool -mwifiex_is_bss_dynamic_wep(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc) -{ - if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled && - !priv->sec_info.wpa2_enabled && - ((!bss_desc->bcn_wpa_ie) || - ((*(bss_desc->bcn_wpa_ie)). - vend_hdr.element_id != WLAN_EID_VENDOR_SPECIFIC)) && - ((!bss_desc->bcn_rsn_ie) || - ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != WLAN_EID_RSN)) && - priv->sec_info.encryption_mode && bss_desc->privacy) { - dev_dbg(priv->adapter->dev, "info: %s: dynamic " - "WEP: wpa_ie=%#x wpa2_ie=%#x " - "EncMode=%#x privacy=%#x\n", - __func__, - (bss_desc->bcn_wpa_ie) ? - (*(bss_desc->bcn_wpa_ie)). - vend_hdr.element_id : 0, - (bss_desc->bcn_rsn_ie) ? - (*(bss_desc->bcn_rsn_ie)). - ieee_hdr.element_id : 0, - priv->sec_info.encryption_mode, - bss_desc->privacy); - return true; - } - return false; -} - -/* - * This function checks if a scanned network is compatible with the driver - * settings. - * - * WEP WPA WPA2 ad-hoc encrypt Network - * enabled enabled enabled AES mode Privacy WPA WPA2 Compatible - * 0 0 0 0 NONE 0 0 0 yes No security - * 0 1 0 0 x 1x 1 x yes WPA (disable - * HT if no AES) - * 0 0 1 0 x 1x x 1 yes WPA2 (disable - * HT if no AES) - * 0 0 0 1 NONE 1 0 0 yes Ad-hoc AES - * 1 0 0 0 NONE 1 0 0 yes Static WEP - * (disable HT) - * 0 0 0 0 !=NONE 1 0 0 yes Dynamic WEP - * - * Compatibility is not matched while roaming, except for mode. - */ -static s32 -mwifiex_is_network_compatible(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc, u32 mode) -{ - struct mwifiex_adapter *adapter = priv->adapter; - - bss_desc->disable_11n = false; - - /* Don't check for compatibility if roaming */ - if (priv->media_connected && - (priv->bss_mode == NL80211_IFTYPE_STATION) && - (bss_desc->bss_mode == NL80211_IFTYPE_STATION)) - return 0; - - if (priv->wps.session_enable) { - dev_dbg(adapter->dev, - "info: return success directly in WPS period\n"); - return 0; - } - - if (mwifiex_is_bss_wapi(priv, bss_desc)) { - dev_dbg(adapter->dev, "info: return success for WAPI AP\n"); - return 0; - } - - if (bss_desc->bss_mode == mode) { - if (mwifiex_is_bss_no_sec(priv, bss_desc)) { - /* No security */ - return 0; - } else if (mwifiex_is_bss_static_wep(priv, bss_desc)) { - /* Static WEP enabled */ - dev_dbg(adapter->dev, "info: Disable 11n in WEP mode.\n"); - bss_desc->disable_11n = true; - return 0; - } else if (mwifiex_is_bss_wpa(priv, bss_desc)) { - /* WPA enabled */ - if (((priv->adapter->config_bands & BAND_GN || - priv->adapter->config_bands & BAND_AN) && - bss_desc->bcn_ht_cap) && - !mwifiex_is_wpa_oui_present(bss_desc, - CIPHER_SUITE_CCMP)) { - - if (mwifiex_is_wpa_oui_present - (bss_desc, CIPHER_SUITE_TKIP)) { - dev_dbg(adapter->dev, - "info: Disable 11n if AES " - "is not supported by AP\n"); - bss_desc->disable_11n = true; - } else { - return -1; - } - } - return 0; - } else if (mwifiex_is_bss_wpa2(priv, bss_desc)) { - /* WPA2 enabled */ - if (((priv->adapter->config_bands & BAND_GN || - priv->adapter->config_bands & BAND_AN) && - bss_desc->bcn_ht_cap) && - !mwifiex_is_rsn_oui_present(bss_desc, - CIPHER_SUITE_CCMP)) { - - if (mwifiex_is_rsn_oui_present - (bss_desc, CIPHER_SUITE_TKIP)) { - dev_dbg(adapter->dev, - "info: Disable 11n if AES " - "is not supported by AP\n"); - bss_desc->disable_11n = true; - } else { - return -1; - } - } - return 0; - } else if (mwifiex_is_bss_adhoc_aes(priv, bss_desc)) { - /* Ad-hoc AES enabled */ - return 0; - } else if (mwifiex_is_bss_dynamic_wep(priv, bss_desc)) { - /* Dynamic WEP enabled */ - return 0; - } - - /* Security doesn't match */ - dev_dbg(adapter->dev, - "info: %s: failed: wpa_ie=%#x wpa2_ie=%#x WEP=%s " - "WPA=%s WPA2=%s EncMode=%#x privacy=%#x\n", __func__, - (bss_desc->bcn_wpa_ie) ? - (*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id : 0, - (bss_desc->bcn_rsn_ie) ? - (*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id : 0, - (priv->sec_info.wep_enabled) ? "e" : "d", - (priv->sec_info.wpa_enabled) ? "e" : "d", - (priv->sec_info.wpa2_enabled) ? "e" : "d", - priv->sec_info.encryption_mode, bss_desc->privacy); - return -1; - } - - /* Mode doesn't match */ - return -1; -} - -/* - * This function creates a channel list for the driver to scan, based - * on region/band information. - * - * This routine is used for any scan that is not provided with a - * specific channel list to scan. - */ -static int -mwifiex_scan_create_channel_list(struct mwifiex_private *priv, - const struct mwifiex_user_scan_cfg - *user_scan_in, - struct mwifiex_chan_scan_param_set - *scan_chan_list, - u8 filtered_scan) -{ - enum ieee80211_band band; - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch; - struct mwifiex_adapter *adapter = priv->adapter; - int chan_idx = 0, i; - - for (band = 0; (band < IEEE80211_NUM_BANDS) ; band++) { - - if (!priv->wdev->wiphy->bands[band]) - continue; - - sband = priv->wdev->wiphy->bands[band]; - - for (i = 0; (i < sband->n_channels) ; i++) { - ch = &sband->channels[i]; - if (ch->flags & IEEE80211_CHAN_DISABLED) - continue; - scan_chan_list[chan_idx].radio_type = band; - - if (user_scan_in && - user_scan_in->chan_list[0].scan_time) - scan_chan_list[chan_idx].max_scan_time = - cpu_to_le16((u16) user_scan_in-> - chan_list[0].scan_time); - else if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - scan_chan_list[chan_idx].max_scan_time = - cpu_to_le16(adapter->passive_scan_time); - else - scan_chan_list[chan_idx].max_scan_time = - cpu_to_le16(adapter->active_scan_time); - - if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - scan_chan_list[chan_idx].chan_scan_mode_bitmap - |= MWIFIEX_PASSIVE_SCAN; - else - scan_chan_list[chan_idx].chan_scan_mode_bitmap - &= ~MWIFIEX_PASSIVE_SCAN; - scan_chan_list[chan_idx].chan_number = - (u32) ch->hw_value; - if (filtered_scan) { - scan_chan_list[chan_idx].max_scan_time = - cpu_to_le16(adapter->specific_scan_time); - scan_chan_list[chan_idx].chan_scan_mode_bitmap - |= MWIFIEX_DISABLE_CHAN_FILT; - } - chan_idx++; - } - - } - return chan_idx; -} - -/* - * This function constructs and sends multiple scan config commands to - * the firmware. - * - * Previous routines in the code flow have created a scan command configuration - * with any requested TLVs. This function splits the channel TLV into maximum - * channels supported per scan lists and sends the portion of the channel TLV, - * along with the other TLVs, to the firmware. - */ -static int -mwifiex_scan_channel_list(struct mwifiex_private *priv, - u32 max_chan_per_scan, u8 filtered_scan, - struct mwifiex_scan_cmd_config *scan_cfg_out, - struct mwifiex_ie_types_chan_list_param_set - *chan_tlv_out, - struct mwifiex_chan_scan_param_set *scan_chan_list) -{ - int ret = 0; - struct mwifiex_chan_scan_param_set *tmp_chan_list; - struct mwifiex_chan_scan_param_set *start_chan; - - u32 tlv_idx; - u32 total_scan_time; - u32 done_early; - - if (!scan_cfg_out || !chan_tlv_out || !scan_chan_list) { - dev_dbg(priv->adapter->dev, - "info: Scan: Null detect: %p, %p, %p\n", - scan_cfg_out, chan_tlv_out, scan_chan_list); - return -1; - } - - chan_tlv_out->header.type = cpu_to_le16(TLV_TYPE_CHANLIST); - - /* Set the temp channel struct pointer to the start of the desired - list */ - tmp_chan_list = scan_chan_list; - - /* Loop through the desired channel list, sending a new firmware scan - commands for each max_chan_per_scan channels (or for 1,6,11 - individually if configured accordingly) */ - while (tmp_chan_list->chan_number) { - - tlv_idx = 0; - total_scan_time = 0; - chan_tlv_out->header.len = 0; - start_chan = tmp_chan_list; - done_early = false; - - /* - * Construct the Channel TLV for the scan command. Continue to - * insert channel TLVs until: - * - the tlv_idx hits the maximum configured per scan command - * - the next channel to insert is 0 (end of desired channel - * list) - * - done_early is set (controlling individual scanning of - * 1,6,11) - */ - while (tlv_idx < max_chan_per_scan && - tmp_chan_list->chan_number && !done_early) { - - dev_dbg(priv->adapter->dev, - "info: Scan: Chan(%3d), Radio(%d)," - " Mode(%d, %d), Dur(%d)\n", - tmp_chan_list->chan_number, - tmp_chan_list->radio_type, - tmp_chan_list->chan_scan_mode_bitmap - & MWIFIEX_PASSIVE_SCAN, - (tmp_chan_list->chan_scan_mode_bitmap - & MWIFIEX_DISABLE_CHAN_FILT) >> 1, - le16_to_cpu(tmp_chan_list->max_scan_time)); - - /* Copy the current channel TLV to the command being - prepared */ - memcpy(chan_tlv_out->chan_scan_param + tlv_idx, - tmp_chan_list, - sizeof(chan_tlv_out->chan_scan_param)); - - /* Increment the TLV header length by the size - appended */ - le16_add_cpu(&chan_tlv_out->header.len, - sizeof(chan_tlv_out->chan_scan_param)); - - /* - * The tlv buffer length is set to the number of bytes - * of the between the channel tlv pointer and the start - * of the tlv buffer. This compensates for any TLVs - * that were appended before the channel list. - */ - scan_cfg_out->tlv_buf_len = (u32) ((u8 *) chan_tlv_out - - scan_cfg_out->tlv_buf); - - /* Add the size of the channel tlv header and the data - length */ - scan_cfg_out->tlv_buf_len += - (sizeof(chan_tlv_out->header) - + le16_to_cpu(chan_tlv_out->header.len)); - - /* Increment the index to the channel tlv we are - constructing */ - tlv_idx++; - - /* Count the total scan time per command */ - total_scan_time += - le16_to_cpu(tmp_chan_list->max_scan_time); - - done_early = false; - - /* Stop the loop if the *current* channel is in the - 1,6,11 set and we are not filtering on a BSSID - or SSID. */ - if (!filtered_scan && - (tmp_chan_list->chan_number == 1 || - tmp_chan_list->chan_number == 6 || - tmp_chan_list->chan_number == 11)) - done_early = true; - - /* Increment the tmp pointer to the next channel to - be scanned */ - tmp_chan_list++; - - /* Stop the loop if the *next* channel is in the 1,6,11 - set. This will cause it to be the only channel - scanned on the next interation */ - if (!filtered_scan && - (tmp_chan_list->chan_number == 1 || - tmp_chan_list->chan_number == 6 || - tmp_chan_list->chan_number == 11)) - done_early = true; - } - - /* The total scan time should be less than scan command timeout - value */ - if (total_scan_time > MWIFIEX_MAX_TOTAL_SCAN_TIME) { - dev_err(priv->adapter->dev, "total scan time %dms" - " is over limit (%dms), scan skipped\n", - total_scan_time, MWIFIEX_MAX_TOTAL_SCAN_TIME); - ret = -1; - break; - } - - priv->adapter->scan_channels = start_chan; - - /* Send the scan command to the firmware with the specified - cfg */ - ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11_SCAN, - HostCmd_ACT_GEN_SET, 0, - scan_cfg_out); - if (ret) - break; - } - - if (ret) - return -1; - - return 0; -} - -/* - * This function constructs a scan command configuration structure to use - * in scan commands. - * - * Application layer or other functions can invoke network scanning - * with a scan configuration supplied in a user scan configuration structure. - * This structure is used as the basis of one or many scan command configuration - * commands that are sent to the command processing module and eventually to the - * firmware. - * - * This function creates a scan command configuration structure based on the - * following user supplied parameters (if present): - * - SSID filter - * - BSSID filter - * - Number of Probes to be sent - * - Channel list - * - * If the SSID or BSSID filter is not present, the filter is disabled/cleared. - * If the number of probes is not set, adapter default setting is used. - */ -static void -mwifiex_config_scan(struct mwifiex_private *priv, - const struct mwifiex_user_scan_cfg *user_scan_in, - struct mwifiex_scan_cmd_config *scan_cfg_out, - struct mwifiex_ie_types_chan_list_param_set **chan_list_out, - struct mwifiex_chan_scan_param_set *scan_chan_list, - u8 *max_chan_per_scan, u8 *filtered_scan, - u8 *scan_current_only) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct mwifiex_ie_types_num_probes *num_probes_tlv; - struct mwifiex_ie_types_wildcard_ssid_params *wildcard_ssid_tlv; - struct mwifiex_ie_types_rates_param_set *rates_tlv; - u8 *tlv_pos; - u32 num_probes; - u32 ssid_len; - u32 chan_idx; - u32 chan_num; - u32 scan_type; - u16 scan_dur; - u8 channel; - u8 radio_type; - int i; - u8 ssid_filter; - u8 rates[MWIFIEX_SUPPORTED_RATES]; - u32 rates_size; - struct mwifiex_ie_types_htcap *ht_cap; - - /* The tlv_buf_len is calculated for each scan command. The TLVs added - in this routine will be preserved since the routine that sends the - command will append channelTLVs at *chan_list_out. The difference - between the *chan_list_out and the tlv_buf start will be used to - calculate the size of anything we add in this routine. */ - scan_cfg_out->tlv_buf_len = 0; - - /* Running tlv pointer. Assigned to chan_list_out at end of function - so later routines know where channels can be added to the command - buf */ - tlv_pos = scan_cfg_out->tlv_buf; - - /* Initialize the scan as un-filtered; the flag is later set to TRUE - below if a SSID or BSSID filter is sent in the command */ - *filtered_scan = false; - - /* Initialize the scan as not being only on the current channel. If - the channel list is customized, only contains one channel, and is - the active channel, this is set true and data flow is not halted. */ - *scan_current_only = false; - - if (user_scan_in) { - - /* Default the ssid_filter flag to TRUE, set false under - certain wildcard conditions and qualified by the existence - of an SSID list before marking the scan as filtered */ - ssid_filter = true; - - /* Set the BSS type scan filter, use Adapter setting if - unset */ - scan_cfg_out->bss_mode = - (user_scan_in->bss_mode ? (u8) user_scan_in-> - bss_mode : (u8) adapter->scan_mode); - - /* Set the number of probes to send, use Adapter setting - if unset */ - num_probes = - (user_scan_in->num_probes ? user_scan_in-> - num_probes : adapter->scan_probes); - - /* - * Set the BSSID filter to the incoming configuration, - * if non-zero. If not set, it will remain disabled - * (all zeros). - */ - memcpy(scan_cfg_out->specific_bssid, - user_scan_in->specific_bssid, - sizeof(scan_cfg_out->specific_bssid)); - - for (i = 0; i < user_scan_in->num_ssids; i++) { - ssid_len = user_scan_in->ssid_list[i].ssid_len; - - wildcard_ssid_tlv = - (struct mwifiex_ie_types_wildcard_ssid_params *) - tlv_pos; - wildcard_ssid_tlv->header.type = - cpu_to_le16(TLV_TYPE_WILDCARDSSID); - wildcard_ssid_tlv->header.len = cpu_to_le16( - (u16) (ssid_len + sizeof(wildcard_ssid_tlv-> - max_ssid_length))); - - /* - * max_ssid_length = 0 tells firmware to perform - * specific scan for the SSID filled, whereas - * max_ssid_length = IEEE80211_MAX_SSID_LEN is for - * wildcard scan. - */ - if (ssid_len) - wildcard_ssid_tlv->max_ssid_length = 0; - else - wildcard_ssid_tlv->max_ssid_length = - IEEE80211_MAX_SSID_LEN; - - memcpy(wildcard_ssid_tlv->ssid, - user_scan_in->ssid_list[i].ssid, ssid_len); - - tlv_pos += (sizeof(wildcard_ssid_tlv->header) - + le16_to_cpu(wildcard_ssid_tlv->header.len)); - - dev_dbg(adapter->dev, "info: scan: ssid[%d]: %s, %d\n", - i, wildcard_ssid_tlv->ssid, - wildcard_ssid_tlv->max_ssid_length); - - /* Empty wildcard ssid with a maxlen will match many or - potentially all SSIDs (maxlen == 32), therefore do - not treat the scan as - filtered. */ - if (!ssid_len && wildcard_ssid_tlv->max_ssid_length) - ssid_filter = false; - } - - /* - * The default number of channels sent in the command is low to - * ensure the response buffer from the firmware does not - * truncate scan results. That is not an issue with an SSID - * or BSSID filter applied to the scan results in the firmware. - */ - if ((i && ssid_filter) || - !is_zero_ether_addr(scan_cfg_out->specific_bssid)) - *filtered_scan = true; - } else { - scan_cfg_out->bss_mode = (u8) adapter->scan_mode; - num_probes = adapter->scan_probes; - } - - /* - * If a specific BSSID or SSID is used, the number of channels in the - * scan command will be increased to the absolute maximum. - */ - if (*filtered_scan) - *max_chan_per_scan = MWIFIEX_MAX_CHANNELS_PER_SPECIFIC_SCAN; - else - *max_chan_per_scan = MWIFIEX_DEF_CHANNELS_PER_SCAN_CMD; - - /* If the input config or adapter has the number of Probes set, - add tlv */ - if (num_probes) { - - dev_dbg(adapter->dev, "info: scan: num_probes = %d\n", - num_probes); - - num_probes_tlv = (struct mwifiex_ie_types_num_probes *) tlv_pos; - num_probes_tlv->header.type = cpu_to_le16(TLV_TYPE_NUMPROBES); - num_probes_tlv->header.len = - cpu_to_le16(sizeof(num_probes_tlv->num_probes)); - num_probes_tlv->num_probes = cpu_to_le16((u16) num_probes); - - tlv_pos += sizeof(num_probes_tlv->header) + - le16_to_cpu(num_probes_tlv->header.len); - - } - - /* Append rates tlv */ - memset(rates, 0, sizeof(rates)); - - rates_size = mwifiex_get_supported_rates(priv, rates); - - rates_tlv = (struct mwifiex_ie_types_rates_param_set *) tlv_pos; - rates_tlv->header.type = cpu_to_le16(WLAN_EID_SUPP_RATES); - rates_tlv->header.len = cpu_to_le16((u16) rates_size); - memcpy(rates_tlv->rates, rates, rates_size); - tlv_pos += sizeof(rates_tlv->header) + rates_size; - - dev_dbg(adapter->dev, "info: SCAN_CMD: Rates size = %d\n", rates_size); - - if (ISSUPP_11NENABLED(priv->adapter->fw_cap_info) && - (priv->adapter->config_bands & BAND_GN || - priv->adapter->config_bands & BAND_AN)) { - ht_cap = (struct mwifiex_ie_types_htcap *) tlv_pos; - memset(ht_cap, 0, sizeof(struct mwifiex_ie_types_htcap)); - ht_cap->header.type = cpu_to_le16(WLAN_EID_HT_CAPABILITY); - ht_cap->header.len = - cpu_to_le16(sizeof(struct ieee80211_ht_cap)); - radio_type = - mwifiex_band_to_radio_type(priv->adapter->config_bands); - mwifiex_fill_cap_info(priv, radio_type, ht_cap); - tlv_pos += sizeof(struct mwifiex_ie_types_htcap); - } - - /* Append vendor specific IE TLV */ - mwifiex_cmd_append_vsie_tlv(priv, MWIFIEX_VSIE_MASK_SCAN, &tlv_pos); - - /* - * Set the output for the channel TLV to the address in the tlv buffer - * past any TLVs that were added in this function (SSID, num_probes). - * Channel TLVs will be added past this for each scan command, - * preserving the TLVs that were previously added. - */ - *chan_list_out = - (struct mwifiex_ie_types_chan_list_param_set *) tlv_pos; - - if (user_scan_in && user_scan_in->chan_list[0].chan_number) { - - dev_dbg(adapter->dev, "info: Scan: Using supplied channel list\n"); - - for (chan_idx = 0; - chan_idx < MWIFIEX_USER_SCAN_CHAN_MAX && - user_scan_in->chan_list[chan_idx].chan_number; - chan_idx++) { - - channel = user_scan_in->chan_list[chan_idx].chan_number; - (scan_chan_list + chan_idx)->chan_number = channel; - - radio_type = - user_scan_in->chan_list[chan_idx].radio_type; - (scan_chan_list + chan_idx)->radio_type = radio_type; - - scan_type = user_scan_in->chan_list[chan_idx].scan_type; - - if (scan_type == MWIFIEX_SCAN_TYPE_PASSIVE) - (scan_chan_list + - chan_idx)->chan_scan_mode_bitmap - |= MWIFIEX_PASSIVE_SCAN; - else - (scan_chan_list + - chan_idx)->chan_scan_mode_bitmap - &= ~MWIFIEX_PASSIVE_SCAN; - - if (*filtered_scan) - (scan_chan_list + - chan_idx)->chan_scan_mode_bitmap - |= MWIFIEX_DISABLE_CHAN_FILT; - - if (user_scan_in->chan_list[chan_idx].scan_time) { - scan_dur = (u16) user_scan_in-> - chan_list[chan_idx].scan_time; - } else { - if (scan_type == MWIFIEX_SCAN_TYPE_PASSIVE) - scan_dur = adapter->passive_scan_time; - else if (*filtered_scan) - scan_dur = adapter->specific_scan_time; - else - scan_dur = adapter->active_scan_time; - } - - (scan_chan_list + chan_idx)->min_scan_time = - cpu_to_le16(scan_dur); - (scan_chan_list + chan_idx)->max_scan_time = - cpu_to_le16(scan_dur); - } - - /* Check if we are only scanning the current channel */ - if ((chan_idx == 1) && - (user_scan_in->chan_list[0].chan_number == - priv->curr_bss_params.bss_descriptor.channel)) { - *scan_current_only = true; - dev_dbg(adapter->dev, - "info: Scan: Scanning current channel only\n"); - } - chan_num = chan_idx; - } else { - dev_dbg(adapter->dev, - "info: Scan: Creating full region channel list\n"); - chan_num = mwifiex_scan_create_channel_list(priv, user_scan_in, - scan_chan_list, - *filtered_scan); - } - - /* - * In associated state we will reduce the number of channels scanned per - * scan command to avoid any traffic delay/loss. This number is decided - * based on total number of channels to be scanned due to constraints - * of command buffers. - */ - if (priv->media_connected) { - if (chan_num < MWIFIEX_LIMIT_1_CHANNEL_PER_SCAN_CMD) - *max_chan_per_scan = 1; - else if (chan_num < MWIFIEX_LIMIT_2_CHANNELS_PER_SCAN_CMD) - *max_chan_per_scan = 2; - else if (chan_num < MWIFIEX_LIMIT_3_CHANNELS_PER_SCAN_CMD) - *max_chan_per_scan = 3; - else - *max_chan_per_scan = 4; - } -} - -/* - * This function inspects the scan response buffer for pointers to - * expected TLVs. - * - * TLVs can be included at the end of the scan response BSS information. - * - * Data in the buffer is parsed pointers to TLVs that can potentially - * be passed back in the response. - */ -static void -mwifiex_ret_802_11_scan_get_tlv_ptrs(struct mwifiex_adapter *adapter, - struct mwifiex_ie_types_data *tlv, - u32 tlv_buf_size, u32 req_tlv_type, - struct mwifiex_ie_types_data **tlv_data) -{ - struct mwifiex_ie_types_data *current_tlv; - u32 tlv_buf_left; - u32 tlv_type; - u32 tlv_len; - - current_tlv = tlv; - tlv_buf_left = tlv_buf_size; - *tlv_data = NULL; - - dev_dbg(adapter->dev, "info: SCAN_RESP: tlv_buf_size = %d\n", - tlv_buf_size); - - while (tlv_buf_left >= sizeof(struct mwifiex_ie_types_header)) { - - tlv_type = le16_to_cpu(current_tlv->header.type); - tlv_len = le16_to_cpu(current_tlv->header.len); - - if (sizeof(tlv->header) + tlv_len > tlv_buf_left) { - dev_err(adapter->dev, "SCAN_RESP: TLV buffer corrupt\n"); - break; - } - - if (req_tlv_type == tlv_type) { - switch (tlv_type) { - case TLV_TYPE_TSFTIMESTAMP: - dev_dbg(adapter->dev, "info: SCAN_RESP: TSF " - "timestamp TLV, len = %d\n", tlv_len); - *tlv_data = current_tlv; - break; - case TLV_TYPE_CHANNELBANDLIST: - dev_dbg(adapter->dev, "info: SCAN_RESP: channel" - " band list TLV, len = %d\n", tlv_len); - *tlv_data = current_tlv; - break; - default: - dev_err(adapter->dev, - "SCAN_RESP: unhandled TLV = %d\n", - tlv_type); - /* Give up, this seems corrupted */ - return; - } - } - - if (*tlv_data) - break; - - - tlv_buf_left -= (sizeof(tlv->header) + tlv_len); - current_tlv = - (struct mwifiex_ie_types_data *) (current_tlv->data + - tlv_len); - - } /* while */ -} - -/* - * This function parses provided beacon buffer and updates - * respective fields in bss descriptor structure. - */ -int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter, - struct mwifiex_bssdescriptor *bss_entry) -{ - int ret = 0; - u8 element_id; - struct ieee_types_fh_param_set *fh_param_set; - struct ieee_types_ds_param_set *ds_param_set; - struct ieee_types_cf_param_set *cf_param_set; - struct ieee_types_ibss_param_set *ibss_param_set; - u8 *current_ptr; - u8 *rate; - u8 element_len; - u16 total_ie_len; - u8 bytes_to_copy; - u8 rate_size; - u8 found_data_rate_ie; - u32 bytes_left; - struct ieee_types_vendor_specific *vendor_ie; - const u8 wpa_oui[4] = { 0x00, 0x50, 0xf2, 0x01 }; - const u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 }; - - found_data_rate_ie = false; - rate_size = 0; - current_ptr = bss_entry->beacon_buf; - bytes_left = bss_entry->beacon_buf_size; - - /* Process variable IE */ - while (bytes_left >= 2) { - element_id = *current_ptr; - element_len = *(current_ptr + 1); - total_ie_len = element_len + sizeof(struct ieee_types_header); - - if (bytes_left < total_ie_len) { - dev_err(adapter->dev, "err: InterpretIE: in processing" - " IE, bytes left < IE length\n"); - return -1; - } - switch (element_id) { - case WLAN_EID_SSID: - bss_entry->ssid.ssid_len = element_len; - memcpy(bss_entry->ssid.ssid, (current_ptr + 2), - element_len); - dev_dbg(adapter->dev, - "info: InterpretIE: ssid: %-32s\n", - bss_entry->ssid.ssid); - break; - - case WLAN_EID_SUPP_RATES: - memcpy(bss_entry->data_rates, current_ptr + 2, - element_len); - memcpy(bss_entry->supported_rates, current_ptr + 2, - element_len); - rate_size = element_len; - found_data_rate_ie = true; - break; - - case WLAN_EID_FH_PARAMS: - fh_param_set = - (struct ieee_types_fh_param_set *) current_ptr; - memcpy(&bss_entry->phy_param_set.fh_param_set, - fh_param_set, - sizeof(struct ieee_types_fh_param_set)); - break; - - case WLAN_EID_DS_PARAMS: - ds_param_set = - (struct ieee_types_ds_param_set *) current_ptr; - - bss_entry->channel = ds_param_set->current_chan; - - memcpy(&bss_entry->phy_param_set.ds_param_set, - ds_param_set, - sizeof(struct ieee_types_ds_param_set)); - break; - - case WLAN_EID_CF_PARAMS: - cf_param_set = - (struct ieee_types_cf_param_set *) current_ptr; - memcpy(&bss_entry->ss_param_set.cf_param_set, - cf_param_set, - sizeof(struct ieee_types_cf_param_set)); - break; - - case WLAN_EID_IBSS_PARAMS: - ibss_param_set = - (struct ieee_types_ibss_param_set *) - current_ptr; - memcpy(&bss_entry->ss_param_set.ibss_param_set, - ibss_param_set, - sizeof(struct ieee_types_ibss_param_set)); - break; - - case WLAN_EID_ERP_INFO: - bss_entry->erp_flags = *(current_ptr + 2); - break; - - case WLAN_EID_EXT_SUPP_RATES: - /* - * Only process extended supported rate - * if data rate is already found. - * Data rate IE should come before - * extended supported rate IE - */ - if (found_data_rate_ie) { - if ((element_len + rate_size) > - MWIFIEX_SUPPORTED_RATES) - bytes_to_copy = - (MWIFIEX_SUPPORTED_RATES - - rate_size); - else - bytes_to_copy = element_len; - - rate = (u8 *) bss_entry->data_rates; - rate += rate_size; - memcpy(rate, current_ptr + 2, bytes_to_copy); - - rate = (u8 *) bss_entry->supported_rates; - rate += rate_size; - memcpy(rate, current_ptr + 2, bytes_to_copy); - } - break; - - case WLAN_EID_VENDOR_SPECIFIC: - vendor_ie = (struct ieee_types_vendor_specific *) - current_ptr; - - if (!memcmp - (vendor_ie->vend_hdr.oui, wpa_oui, - sizeof(wpa_oui))) { - bss_entry->bcn_wpa_ie = - (struct ieee_types_vendor_specific *) - current_ptr; - bss_entry->wpa_offset = (u16) - (current_ptr - bss_entry->beacon_buf); - } else if (!memcmp(vendor_ie->vend_hdr.oui, wmm_oui, - sizeof(wmm_oui))) { - if (total_ie_len == - sizeof(struct ieee_types_wmm_parameter) || - total_ie_len == - sizeof(struct ieee_types_wmm_info)) - /* - * Only accept and copy the WMM IE if - * it matches the size expected for the - * WMM Info IE or the WMM Parameter IE. - */ - memcpy((u8 *) &bss_entry->wmm_ie, - current_ptr, total_ie_len); - } - break; - case WLAN_EID_RSN: - bss_entry->bcn_rsn_ie = - (struct ieee_types_generic *) current_ptr; - bss_entry->rsn_offset = (u16) (current_ptr - - bss_entry->beacon_buf); - break; - case WLAN_EID_BSS_AC_ACCESS_DELAY: - bss_entry->bcn_wapi_ie = - (struct ieee_types_generic *) current_ptr; - bss_entry->wapi_offset = (u16) (current_ptr - - bss_entry->beacon_buf); - break; - case WLAN_EID_HT_CAPABILITY: - bss_entry->bcn_ht_cap = (struct ieee80211_ht_cap *) - (current_ptr + - sizeof(struct ieee_types_header)); - bss_entry->ht_cap_offset = (u16) (current_ptr + - sizeof(struct ieee_types_header) - - bss_entry->beacon_buf); - break; - case WLAN_EID_HT_OPERATION: - bss_entry->bcn_ht_oper = - (struct ieee80211_ht_operation *)(current_ptr + - sizeof(struct ieee_types_header)); - bss_entry->ht_info_offset = (u16) (current_ptr + - sizeof(struct ieee_types_header) - - bss_entry->beacon_buf); - break; - case WLAN_EID_VHT_CAPABILITY: - bss_entry->disable_11ac = false; - bss_entry->bcn_vht_cap = - (void *)(current_ptr + - sizeof(struct ieee_types_header)); - bss_entry->vht_cap_offset = - (u16)((u8 *)bss_entry->bcn_vht_cap - - bss_entry->beacon_buf); - break; - case WLAN_EID_VHT_OPERATION: - bss_entry->bcn_vht_oper = - (void *)(current_ptr + - sizeof(struct ieee_types_header)); - bss_entry->vht_info_offset = - (u16)((u8 *)bss_entry->bcn_vht_oper - - bss_entry->beacon_buf); - break; - case WLAN_EID_BSS_COEX_2040: - bss_entry->bcn_bss_co_2040 = current_ptr + - sizeof(struct ieee_types_header); - bss_entry->bss_co_2040_offset = (u16) (current_ptr + - sizeof(struct ieee_types_header) - - bss_entry->beacon_buf); - break; - case WLAN_EID_EXT_CAPABILITY: - bss_entry->bcn_ext_cap = current_ptr + - sizeof(struct ieee_types_header); - bss_entry->ext_cap_offset = (u16) (current_ptr + - sizeof(struct ieee_types_header) - - bss_entry->beacon_buf); - break; - case WLAN_EID_OPMODE_NOTIF: - bss_entry->oper_mode = - (void *)(current_ptr + - sizeof(struct ieee_types_header)); - bss_entry->oper_mode_offset = - (u16)((u8 *)bss_entry->oper_mode - - bss_entry->beacon_buf); - break; - default: - break; - } - - current_ptr += element_len + 2; - - /* Need to account for IE ID and IE Len */ - bytes_left -= (element_len + 2); - - } /* while (bytes_left > 2) */ - return ret; -} - -/* - * This function converts radio type scan parameter to a band configuration - * to be used in join command. - */ -static u8 -mwifiex_radio_type_to_band(u8 radio_type) -{ - switch (radio_type) { - case HostCmd_SCAN_RADIO_TYPE_A: - return BAND_A; - case HostCmd_SCAN_RADIO_TYPE_BG: - default: - return BAND_G; - } -} - -/* - * This is an internal function used to start a scan based on an input - * configuration. - * - * This uses the input user scan configuration information when provided in - * order to send the appropriate scan commands to firmware to populate or - * update the internal driver scan table. - */ -int mwifiex_scan_networks(struct mwifiex_private *priv, - const struct mwifiex_user_scan_cfg *user_scan_in) -{ - int ret; - struct mwifiex_adapter *adapter = priv->adapter; - struct cmd_ctrl_node *cmd_node; - union mwifiex_scan_cmd_config_tlv *scan_cfg_out; - struct mwifiex_ie_types_chan_list_param_set *chan_list_out; - struct mwifiex_chan_scan_param_set *scan_chan_list; - u8 filtered_scan; - u8 scan_current_chan_only; - u8 max_chan_per_scan; - unsigned long flags; - - if (adapter->scan_processing) { - dev_err(adapter->dev, "cmd: Scan already in process...\n"); - return -EBUSY; - } - - if (priv->scan_block) { - dev_err(adapter->dev, - "cmd: Scan is blocked during association...\n"); - return -EBUSY; - } - - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); - adapter->scan_processing = true; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); - - scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv), - GFP_KERNEL); - if (!scan_cfg_out) { - ret = -ENOMEM; - goto done; - } - - scan_chan_list = kcalloc(MWIFIEX_USER_SCAN_CHAN_MAX, - sizeof(struct mwifiex_chan_scan_param_set), - GFP_KERNEL); - if (!scan_chan_list) { - kfree(scan_cfg_out); - ret = -ENOMEM; - goto done; - } - - mwifiex_config_scan(priv, user_scan_in, &scan_cfg_out->config, - &chan_list_out, scan_chan_list, &max_chan_per_scan, - &filtered_scan, &scan_current_chan_only); - - ret = mwifiex_scan_channel_list(priv, max_chan_per_scan, filtered_scan, - &scan_cfg_out->config, chan_list_out, - scan_chan_list); - - /* Get scan command from scan_pending_q and put to cmd_pending_q */ - if (!ret) { - spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); - if (!list_empty(&adapter->scan_pending_q)) { - cmd_node = list_first_entry(&adapter->scan_pending_q, - struct cmd_ctrl_node, list); - list_del(&cmd_node->list); - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, - flags); - mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, - true); - queue_work(adapter->workqueue, &adapter->main_work); - - /* Perform internal scan synchronously */ - if (!priv->scan_request) { - dev_dbg(adapter->dev, "wait internal scan\n"); - mwifiex_wait_queue_complete(adapter, cmd_node); - } - } else { - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, - flags); - } - } - - kfree(scan_cfg_out); - kfree(scan_chan_list); -done: - if (ret) { - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); - adapter->scan_processing = false; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); - } - return ret; -} - -/* - * This function prepares a scan command to be sent to the firmware. - * - * This uses the scan command configuration sent to the command processing - * module in command preparation stage to configure a scan command structure - * to send to firmware. - * - * The fixed fields specifying the BSS type and BSSID filters as well as a - * variable number/length of TLVs are sent in the command to firmware. - * - * Preparation also includes - - * - Setting command ID, and proper size - * - Ensuring correct endian-ness - */ -int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd, - struct mwifiex_scan_cmd_config *scan_cfg) -{ - struct host_cmd_ds_802_11_scan *scan_cmd = &cmd->params.scan; - - /* Set fixed field variables in scan command */ - scan_cmd->bss_mode = scan_cfg->bss_mode; - memcpy(scan_cmd->bssid, scan_cfg->specific_bssid, - sizeof(scan_cmd->bssid)); - memcpy(scan_cmd->tlv_buffer, scan_cfg->tlv_buf, scan_cfg->tlv_buf_len); - - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_SCAN); - - /* Size is equal to the sizeof(fixed portions) + the TLV len + header */ - cmd->size = cpu_to_le16((u16) (sizeof(scan_cmd->bss_mode) - + sizeof(scan_cmd->bssid) - + scan_cfg->tlv_buf_len + S_DS_GEN)); - - return 0; -} - -/* - * This function checks compatibility of requested network with current - * driver settings. - */ -int mwifiex_check_network_compatibility(struct mwifiex_private *priv, - struct mwifiex_bssdescriptor *bss_desc) -{ - int ret = -1; - - if (!bss_desc) - return -1; - - if ((mwifiex_get_cfp(priv, (u8) bss_desc->bss_band, - (u16) bss_desc->channel, 0))) { - switch (priv->bss_mode) { - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_ADHOC: - ret = mwifiex_is_network_compatible(priv, bss_desc, - priv->bss_mode); - if (ret) - dev_err(priv->adapter->dev, - "Incompatible network settings\n"); - break; - default: - ret = 0; - } - } - - return ret; -} - -static int mwifiex_update_curr_bss_params(struct mwifiex_private *priv, - struct cfg80211_bss *bss) -{ - struct mwifiex_bssdescriptor *bss_desc; - int ret; - unsigned long flags; - - /* Allocate and fill new bss descriptor */ - bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor), GFP_KERNEL); - if (!bss_desc) - return -ENOMEM; - - ret = mwifiex_fill_new_bss_desc(priv, bss, bss_desc); - if (ret) - goto done; - - ret = mwifiex_check_network_compatibility(priv, bss_desc); - if (ret) - goto done; - - spin_lock_irqsave(&priv->curr_bcn_buf_lock, flags); - /* Make a copy of current BSSID descriptor */ - memcpy(&priv->curr_bss_params.bss_descriptor, bss_desc, - sizeof(priv->curr_bss_params.bss_descriptor)); - - /* The contents of beacon_ie will be copied to its own buffer - * in mwifiex_save_curr_bcn() - */ - mwifiex_save_curr_bcn(priv); - spin_unlock_irqrestore(&priv->curr_bcn_buf_lock, flags); - -done: - /* beacon_ie buffer was allocated in function - * mwifiex_fill_new_bss_desc(). Free it now. - */ - kfree(bss_desc->beacon_buf); - kfree(bss_desc); - return 0; -} - -/* - * This function handles the command response of scan. - * - * The response buffer for the scan command has the following - * memory layout: - * - * .-------------------------------------------------------------. - * | Header (4 * sizeof(t_u16)): Standard command response hdr | - * .-------------------------------------------------------------. - * | BufSize (t_u16) : sizeof the BSS Description data | - * .-------------------------------------------------------------. - * | NumOfSet (t_u8) : Number of BSS Descs returned | - * .-------------------------------------------------------------. - * | BSSDescription data (variable, size given in BufSize) | - * .-------------------------------------------------------------. - * | TLV data (variable, size calculated using Header->Size, | - * | BufSize and sizeof the fixed fields above) | - * .-------------------------------------------------------------. - */ -int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - int ret = 0; - struct mwifiex_adapter *adapter = priv->adapter; - struct cmd_ctrl_node *cmd_node; - struct host_cmd_ds_802_11_scan_rsp *scan_rsp; - struct mwifiex_ie_types_data *tlv_data; - struct mwifiex_ie_types_tsf_timestamp *tsf_tlv; - u8 *bss_info; - u32 scan_resp_size; - u32 bytes_left; - u32 idx; - u32 tlv_buf_size; - struct mwifiex_chan_freq_power *cfp; - struct mwifiex_ie_types_chan_band_list_param_set *chan_band_tlv; - struct chan_band_param_set *chan_band; - u8 is_bgscan_resp; - unsigned long flags; - struct cfg80211_bss *bss; - - is_bgscan_resp = (le16_to_cpu(resp->command) - == HostCmd_CMD_802_11_BG_SCAN_QUERY); - if (is_bgscan_resp) - scan_rsp = &resp->params.bg_scan_query_resp.scan_resp; - else - scan_rsp = &resp->params.scan_resp; - - - if (scan_rsp->number_of_sets > MWIFIEX_MAX_AP) { - dev_err(adapter->dev, "SCAN_RESP: too many AP returned (%d)\n", - scan_rsp->number_of_sets); - ret = -1; - goto check_next_scan; - } - - bytes_left = le16_to_cpu(scan_rsp->bss_descript_size); - dev_dbg(adapter->dev, "info: SCAN_RESP: bss_descript_size %d\n", - bytes_left); - - scan_resp_size = le16_to_cpu(resp->size); - - dev_dbg(adapter->dev, - "info: SCAN_RESP: returned %d APs before parsing\n", - scan_rsp->number_of_sets); - - bss_info = scan_rsp->bss_desc_and_tlv_buffer; - - /* - * The size of the TLV buffer is equal to the entire command response - * size (scan_resp_size) minus the fixed fields (sizeof()'s), the - * BSS Descriptions (bss_descript_size as bytesLef) and the command - * response header (S_DS_GEN) - */ - tlv_buf_size = scan_resp_size - (bytes_left - + sizeof(scan_rsp->bss_descript_size) - + sizeof(scan_rsp->number_of_sets) - + S_DS_GEN); - - tlv_data = (struct mwifiex_ie_types_data *) (scan_rsp-> - bss_desc_and_tlv_buffer + - bytes_left); - - /* Search the TLV buffer space in the scan response for any valid - TLVs */ - mwifiex_ret_802_11_scan_get_tlv_ptrs(adapter, tlv_data, tlv_buf_size, - TLV_TYPE_TSFTIMESTAMP, - (struct mwifiex_ie_types_data **) - &tsf_tlv); - - /* Search the TLV buffer space in the scan response for any valid - TLVs */ - mwifiex_ret_802_11_scan_get_tlv_ptrs(adapter, tlv_data, tlv_buf_size, - TLV_TYPE_CHANNELBANDLIST, - (struct mwifiex_ie_types_data **) - &chan_band_tlv); - - for (idx = 0; idx < scan_rsp->number_of_sets && bytes_left; idx++) { - u8 bssid[ETH_ALEN]; - s32 rssi; - const u8 *ie_buf; - size_t ie_len; - u16 channel = 0; - u64 fw_tsf = 0; - u16 beacon_size = 0; - u32 curr_bcn_bytes; - u32 freq; - u16 beacon_period; - u16 cap_info_bitmap; - u8 *current_ptr; - u64 timestamp; - struct mwifiex_bcn_param *bcn_param; - struct mwifiex_bss_priv *bss_priv; - - if (bytes_left >= sizeof(beacon_size)) { - /* Extract & convert beacon size from command buffer */ - memcpy(&beacon_size, bss_info, sizeof(beacon_size)); - bytes_left -= sizeof(beacon_size); - bss_info += sizeof(beacon_size); - } - - if (!beacon_size || beacon_size > bytes_left) { - bss_info += bytes_left; - bytes_left = 0; - ret = -1; - goto check_next_scan; - } - - /* Initialize the current working beacon pointer for this BSS - * iteration */ - current_ptr = bss_info; - - /* Advance the return beacon pointer past the current beacon */ - bss_info += beacon_size; - bytes_left -= beacon_size; - - curr_bcn_bytes = beacon_size; - - /* - * First 5 fields are bssid, RSSI, time stamp, beacon interval, - * and capability information - */ - if (curr_bcn_bytes < sizeof(struct mwifiex_bcn_param)) { - dev_err(adapter->dev, - "InterpretIE: not enough bytes left\n"); - continue; - } - bcn_param = (struct mwifiex_bcn_param *)current_ptr; - current_ptr += sizeof(*bcn_param); - curr_bcn_bytes -= sizeof(*bcn_param); - - memcpy(bssid, bcn_param->bssid, ETH_ALEN); - - rssi = (s32) bcn_param->rssi; - rssi = (-rssi) * 100; /* Convert dBm to mBm */ - dev_dbg(adapter->dev, "info: InterpretIE: RSSI=%d\n", rssi); - - timestamp = le64_to_cpu(bcn_param->timestamp); - beacon_period = le16_to_cpu(bcn_param->beacon_period); - - cap_info_bitmap = le16_to_cpu(bcn_param->cap_info_bitmap); - dev_dbg(adapter->dev, "info: InterpretIE: capabilities=0x%X\n", - cap_info_bitmap); - - /* Rest of the current buffer are IE's */ - ie_buf = current_ptr; - ie_len = curr_bcn_bytes; - dev_dbg(adapter->dev, - "info: InterpretIE: IELength for this AP = %d\n", - curr_bcn_bytes); - - while (curr_bcn_bytes >= sizeof(struct ieee_types_header)) { - u8 element_id, element_len; - - element_id = *current_ptr; - element_len = *(current_ptr + 1); - if (curr_bcn_bytes < element_len + - sizeof(struct ieee_types_header)) { - dev_err(priv->adapter->dev, - "%s: bytes left < IE length\n", - __func__); - goto check_next_scan; - } - if (element_id == WLAN_EID_DS_PARAMS) { - channel = *(current_ptr + sizeof(struct ieee_types_header)); - break; - } - - current_ptr += element_len + - sizeof(struct ieee_types_header); - curr_bcn_bytes -= element_len + - sizeof(struct ieee_types_header); - } - - /* - * If the TSF TLV was appended to the scan results, save this - * entry's TSF value in the fw_tsf field. It is the firmware's - * TSF value at the time the beacon or probe response was - * received. - */ - if (tsf_tlv) - memcpy(&fw_tsf, &tsf_tlv->tsf_data[idx * TSF_DATA_SIZE], - sizeof(fw_tsf)); - - if (channel) { - struct ieee80211_channel *chan; - u8 band; - - band = BAND_G; - if (chan_band_tlv) { - chan_band = - &chan_band_tlv->chan_band_param[idx]; - band = mwifiex_radio_type_to_band( - chan_band->radio_type - & (BIT(0) | BIT(1))); - } - - cfp = mwifiex_get_cfp(priv, band, channel, 0); - - freq = cfp ? cfp->freq : 0; - - chan = ieee80211_get_channel(priv->wdev->wiphy, freq); - - if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { - bss = cfg80211_inform_bss(priv->wdev->wiphy, - chan, bssid, timestamp, - cap_info_bitmap, beacon_period, - ie_buf, ie_len, rssi, GFP_KERNEL); - bss_priv = (struct mwifiex_bss_priv *)bss->priv; - bss_priv->band = band; - bss_priv->fw_tsf = fw_tsf; - if (priv->media_connected && - !memcmp(bssid, - priv->curr_bss_params.bss_descriptor - .mac_address, ETH_ALEN)) - mwifiex_update_curr_bss_params(priv, - bss); - cfg80211_put_bss(priv->wdev->wiphy, bss); - } - } else { - dev_dbg(adapter->dev, "missing BSS channel IE\n"); - } - } - -check_next_scan: - spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); - if (list_empty(&adapter->scan_pending_q)) { - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); - adapter->scan_processing = false; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); - - /* Need to indicate IOCTL complete */ - if (adapter->curr_cmd->wait_q_enabled) { - adapter->cmd_wait_q.status = 0; - if (!priv->scan_request) { - dev_dbg(adapter->dev, - "complete internal scan\n"); - mwifiex_complete_cmd(adapter, - adapter->curr_cmd); - } - } - if (priv->report_scan_result) - priv->report_scan_result = false; - - if (priv->user_scan_cfg) { - if (priv->scan_request) { - dev_dbg(priv->adapter->dev, - "info: notifying scan done\n"); - cfg80211_scan_done(priv->scan_request, 0); - priv->scan_request = NULL; - } else { - dev_dbg(priv->adapter->dev, - "info: scan already aborted\n"); - } - - kfree(priv->user_scan_cfg); - priv->user_scan_cfg = NULL; - } - } else { - if (priv->user_scan_cfg && !priv->scan_request) { - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, - flags); - adapter->scan_delay_cnt = MWIFIEX_MAX_SCAN_DELAY_CNT; - mod_timer(&priv->scan_delay_timer, jiffies); - dev_dbg(priv->adapter->dev, - "info: %s: triggerring scan abort\n", __func__); - } else if (!mwifiex_wmm_lists_empty(adapter) && - (priv->scan_request && (priv->scan_request->flags & - NL80211_SCAN_FLAG_LOW_PRIORITY))) { - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, - flags); - adapter->scan_delay_cnt = 1; - mod_timer(&priv->scan_delay_timer, jiffies + - msecs_to_jiffies(MWIFIEX_SCAN_DELAY_MSEC)); - dev_dbg(priv->adapter->dev, - "info: %s: deferring scan\n", __func__); - } else { - /* Get scan command from scan_pending_q and put to - cmd_pending_q */ - cmd_node = list_first_entry(&adapter->scan_pending_q, - struct cmd_ctrl_node, list); - list_del(&cmd_node->list); - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, - flags); - mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, - true); - } - } - - return ret; -} - -/* - * This function prepares command for background scan query. - * - * Preparation includes - - * - Setting command ID and proper size - * - Setting background scan flush parameter - * - Ensuring correct endian-ness - */ -int mwifiex_cmd_802_11_bg_scan_query(struct host_cmd_ds_command *cmd) -{ - struct host_cmd_ds_802_11_bg_scan_query *bg_query = - &cmd->params.bg_scan_query; - - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_BG_SCAN_QUERY); - cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_bg_scan_query) - + S_DS_GEN); - - bg_query->flush = 1; - - return 0; -} - -/* - * This function inserts scan command node to the scan pending queue. - */ -void -mwifiex_queue_scan_cmd(struct mwifiex_private *priv, - struct cmd_ctrl_node *cmd_node) -{ - struct mwifiex_adapter *adapter = priv->adapter; - unsigned long flags; - - cmd_node->wait_q_enabled = true; - cmd_node->condition = &adapter->scan_wait_q_woken; - spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); - list_add_tail(&cmd_node->list, &adapter->scan_pending_q); - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); -} - -/* - * This function sends a scan command for all available channels to the - * firmware, filtered on a specific SSID. - */ -static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv, - struct cfg80211_ssid *req_ssid) -{ - struct mwifiex_adapter *adapter = priv->adapter; - int ret; - struct mwifiex_user_scan_cfg *scan_cfg; - - if (adapter->scan_processing) { - dev_err(adapter->dev, "cmd: Scan already in process...\n"); - return -EBUSY; - } - - if (priv->scan_block) { - dev_err(adapter->dev, - "cmd: Scan is blocked during association...\n"); - return -EBUSY; - } - - scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL); - if (!scan_cfg) - return -ENOMEM; - - scan_cfg->ssid_list = req_ssid; - scan_cfg->num_ssids = 1; - - ret = mwifiex_scan_networks(priv, scan_cfg); - - kfree(scan_cfg); - return ret; -} - -/* - * Sends IOCTL request to start a scan. - * - * This function allocates the IOCTL request buffer, fills it - * with requisite parameters and calls the IOCTL handler. - * - * Scan command can be issued for both normal scan and specific SSID - * scan, depending upon whether an SSID is provided or not. - */ -int mwifiex_request_scan(struct mwifiex_private *priv, - struct cfg80211_ssid *req_ssid) -{ - int ret; - - if (down_interruptible(&priv->async_sem)) { - dev_err(priv->adapter->dev, "%s: acquire semaphore\n", - __func__); - return -1; - } - - priv->adapter->scan_wait_q_woken = false; - - if (req_ssid && req_ssid->ssid_len != 0) - /* Specific SSID scan */ - ret = mwifiex_scan_specific_ssid(priv, req_ssid); - else - /* Normal scan */ - ret = mwifiex_scan_networks(priv, NULL); - - up(&priv->async_sem); - - return ret; -} - -/* - * This function appends the vendor specific IE TLV to a buffer. - */ -int -mwifiex_cmd_append_vsie_tlv(struct mwifiex_private *priv, - u16 vsie_mask, u8 **buffer) -{ - int id, ret_len = 0; - struct mwifiex_ie_types_vendor_param_set *vs_param_set; - - if (!buffer) - return 0; - if (!(*buffer)) - return 0; - - /* - * Traverse through the saved vendor specific IE array and append - * the selected(scan/assoc/adhoc) IE as TLV to the command - */ - for (id = 0; id < MWIFIEX_MAX_VSIE_NUM; id++) { - if (priv->vs_ie[id].mask & vsie_mask) { - vs_param_set = - (struct mwifiex_ie_types_vendor_param_set *) - *buffer; - vs_param_set->header.type = - cpu_to_le16(TLV_TYPE_PASSTHROUGH); - vs_param_set->header.len = - cpu_to_le16((((u16) priv->vs_ie[id].ie[1]) - & 0x00FF) + 2); - memcpy(vs_param_set->ie, priv->vs_ie[id].ie, - le16_to_cpu(vs_param_set->header.len)); - *buffer += le16_to_cpu(vs_param_set->header.len) + - sizeof(struct mwifiex_ie_types_header); - ret_len += le16_to_cpu(vs_param_set->header.len) + - sizeof(struct mwifiex_ie_types_header); - } - } - return ret_len; -} - -/* - * This function saves a beacon buffer of the current BSS descriptor. - * - * The current beacon buffer is saved so that it can be restored in the - * following cases that makes the beacon buffer not to contain the current - * ssid's beacon buffer. - * - The current ssid was not found somehow in the last scan. - * - The current ssid was the last entry of the scan table and overloaded. - */ -void -mwifiex_save_curr_bcn(struct mwifiex_private *priv) -{ - struct mwifiex_bssdescriptor *curr_bss = - &priv->curr_bss_params.bss_descriptor; - - if (!curr_bss->beacon_buf_size) - return; - - /* allocate beacon buffer at 1st time; or if it's size has changed */ - if (!priv->curr_bcn_buf || - priv->curr_bcn_size != curr_bss->beacon_buf_size) { - priv->curr_bcn_size = curr_bss->beacon_buf_size; - - kfree(priv->curr_bcn_buf); - priv->curr_bcn_buf = kmalloc(curr_bss->beacon_buf_size, - GFP_ATOMIC); - if (!priv->curr_bcn_buf) - return; - } - - memcpy(priv->curr_bcn_buf, curr_bss->beacon_buf, - curr_bss->beacon_buf_size); - dev_dbg(priv->adapter->dev, "info: current beacon saved %d\n", - priv->curr_bcn_size); - - curr_bss->beacon_buf = priv->curr_bcn_buf; - - /* adjust the pointers in the current BSS descriptor */ - if (curr_bss->bcn_wpa_ie) - curr_bss->bcn_wpa_ie = - (struct ieee_types_vendor_specific *) - (curr_bss->beacon_buf + - curr_bss->wpa_offset); - - if (curr_bss->bcn_rsn_ie) - curr_bss->bcn_rsn_ie = (struct ieee_types_generic *) - (curr_bss->beacon_buf + - curr_bss->rsn_offset); - - if (curr_bss->bcn_ht_cap) - curr_bss->bcn_ht_cap = (struct ieee80211_ht_cap *) - (curr_bss->beacon_buf + - curr_bss->ht_cap_offset); - - if (curr_bss->bcn_ht_oper) - curr_bss->bcn_ht_oper = (struct ieee80211_ht_operation *) - (curr_bss->beacon_buf + - curr_bss->ht_info_offset); - - if (curr_bss->bcn_vht_cap) - curr_bss->bcn_ht_cap = (void *)(curr_bss->beacon_buf + - curr_bss->vht_cap_offset); - - if (curr_bss->bcn_vht_oper) - curr_bss->bcn_ht_oper = (void *)(curr_bss->beacon_buf + - curr_bss->vht_info_offset); - - if (curr_bss->bcn_bss_co_2040) - curr_bss->bcn_bss_co_2040 = - (curr_bss->beacon_buf + curr_bss->bss_co_2040_offset); - - if (curr_bss->bcn_ext_cap) - curr_bss->bcn_ext_cap = curr_bss->beacon_buf + - curr_bss->ext_cap_offset; - - if (curr_bss->oper_mode) - curr_bss->oper_mode = (void *)(curr_bss->beacon_buf + - curr_bss->oper_mode_offset); -} - -/* - * This function frees the current BSS descriptor beacon buffer. - */ -void -mwifiex_free_curr_bcn(struct mwifiex_private *priv) -{ - kfree(priv->curr_bcn_buf); - priv->curr_bcn_buf = NULL; -} diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c deleted file mode 100644 index 047a6f348d3d..000000000000 --- a/drivers/net/wireless/mwifiex/sdio.c +++ /dev/null @@ -1,1836 +0,0 @@ -/* - * Marvell Wireless LAN device driver: SDIO specific handling - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" -#include "11n.h" -#include "sdio.h" - - -#define SDIO_VERSION "1.0" - -/* The mwifiex_sdio_remove() callback function is called when - * user removes this module from kernel space or ejects - * the card from the slot. The driver handles these 2 cases - * differently. - * If the user is removing the module, the few commands (FUNC_SHUTDOWN, - * HS_CANCEL etc.) are sent to the firmware. - * If the card is removed, there is no need to send these command. - * - * The variable 'user_rmmod' is used to distinguish these two - * scenarios. This flag is initialized as FALSE in case the card - * is removed, and will be set to TRUE for module removal when - * module_exit function is called. - */ -static u8 user_rmmod; - -static struct mwifiex_if_ops sdio_ops; - -static struct semaphore add_remove_card_sem; - -static int mwifiex_sdio_resume(struct device *dev); - -/* - * SDIO probe. - * - * This function probes an mwifiex device and registers it. It allocates - * the card structure, enables SDIO function number and initiates the - * device registration and initialization procedure by adding a logical - * interface. - */ -static int -mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) -{ - int ret; - struct sdio_mmc_card *card = NULL; - - pr_debug("info: vendor=0x%4.04X device=0x%4.04X class=%d function=%d\n", - func->vendor, func->device, func->class, func->num); - - card = kzalloc(sizeof(struct sdio_mmc_card), GFP_KERNEL); - if (!card) - return -ENOMEM; - - card->func = func; - - func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; - - sdio_claim_host(func); - ret = sdio_enable_func(func); - sdio_release_host(func); - - if (ret) { - pr_err("%s: failed to enable function\n", __func__); - kfree(card); - return -EIO; - } - - if (mwifiex_add_card(card, &add_remove_card_sem, &sdio_ops, - MWIFIEX_SDIO)) { - pr_err("%s: add card failed\n", __func__); - kfree(card); - sdio_claim_host(func); - ret = sdio_disable_func(func); - sdio_release_host(func); - ret = -1; - } - - return ret; -} - -/* - * SDIO remove. - * - * This function removes the interface and frees up the card structure. - */ -static void -mwifiex_sdio_remove(struct sdio_func *func) -{ - struct sdio_mmc_card *card; - struct mwifiex_adapter *adapter; - struct mwifiex_private *priv; - int i; - - pr_debug("info: SDIO func num=%d\n", func->num); - - card = sdio_get_drvdata(func); - if (!card) - return; - - adapter = card->adapter; - if (!adapter || !adapter->priv_num) - return; - - /* In case driver is removed when asynchronous FW load is in progress */ - wait_for_completion(&adapter->fw_load); - - if (user_rmmod) { - if (adapter->is_suspended) - mwifiex_sdio_resume(adapter->dev); - - for (i = 0; i < adapter->priv_num; i++) - if ((GET_BSS_ROLE(adapter->priv[i]) == - MWIFIEX_BSS_ROLE_STA) && - adapter->priv[i]->media_connected) - mwifiex_deauthenticate(adapter->priv[i], NULL); - - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - mwifiex_disable_auto_ds(priv); - mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN); - } - - mwifiex_remove_card(card->adapter, &add_remove_card_sem); - kfree(card); -} - -/* - * SDIO suspend. - * - * Kernel needs to suspend all functions separately. Therefore all - * registered functions must have drivers with suspend and resume - * methods. Failing that the kernel simply removes the whole card. - * - * If already not suspended, this function allocates and sends a host - * sleep activate request to the firmware and turns off the traffic. - */ -static int mwifiex_sdio_suspend(struct device *dev) -{ - struct sdio_func *func = dev_to_sdio_func(dev); - struct sdio_mmc_card *card; - struct mwifiex_adapter *adapter; - mmc_pm_flag_t pm_flag = 0; - int ret = 0; - - if (func) { - pm_flag = sdio_get_host_pm_caps(func); - pr_debug("cmd: %s: suspend: PM flag = 0x%x\n", - sdio_func_id(func), pm_flag); - if (!(pm_flag & MMC_PM_KEEP_POWER)) { - pr_err("%s: cannot remain alive while host is" - " suspended\n", sdio_func_id(func)); - return -ENOSYS; - } - - card = sdio_get_drvdata(func); - if (!card || !card->adapter) { - pr_err("suspend: invalid card or adapter\n"); - return 0; - } - } else { - pr_err("suspend: sdio_func is not specified\n"); - return 0; - } - - adapter = card->adapter; - - /* Enable the Host Sleep */ - if (!mwifiex_enable_hs(adapter)) { - dev_err(adapter->dev, "cmd: failed to suspend\n"); - return -EFAULT; - } - - dev_dbg(adapter->dev, "cmd: suspend with MMC_PM_KEEP_POWER\n"); - ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); - - /* Indicate device suspended */ - adapter->is_suspended = true; - - return ret; -} - -/* - * SDIO resume. - * - * Kernel needs to suspend all functions separately. Therefore all - * registered functions must have drivers with suspend and resume - * methods. Failing that the kernel simply removes the whole card. - * - * If already not resumed, this function turns on the traffic and - * sends a host sleep cancel request to the firmware. - */ -static int mwifiex_sdio_resume(struct device *dev) -{ - struct sdio_func *func = dev_to_sdio_func(dev); - struct sdio_mmc_card *card; - struct mwifiex_adapter *adapter; - mmc_pm_flag_t pm_flag = 0; - - if (func) { - pm_flag = sdio_get_host_pm_caps(func); - card = sdio_get_drvdata(func); - if (!card || !card->adapter) { - pr_err("resume: invalid card or adapter\n"); - return 0; - } - } else { - pr_err("resume: sdio_func is not specified\n"); - return 0; - } - - adapter = card->adapter; - - if (!adapter->is_suspended) { - dev_warn(adapter->dev, "device already resumed\n"); - return 0; - } - - adapter->is_suspended = false; - - /* Disable Host Sleep */ - mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA), - MWIFIEX_ASYNC_CMD); - - return 0; -} - -/* Device ID for SD8786 */ -#define SDIO_DEVICE_ID_MARVELL_8786 (0x9116) -/* Device ID for SD8787 */ -#define SDIO_DEVICE_ID_MARVELL_8787 (0x9119) -/* Device ID for SD8797 */ -#define SDIO_DEVICE_ID_MARVELL_8797 (0x9129) - -/* WLAN IDs */ -static const struct sdio_device_id mwifiex_ids[] = { - {SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, SDIO_DEVICE_ID_MARVELL_8786)}, - {SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, SDIO_DEVICE_ID_MARVELL_8787)}, - {SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, SDIO_DEVICE_ID_MARVELL_8797)}, - {}, -}; - -MODULE_DEVICE_TABLE(sdio, mwifiex_ids); - -static const struct dev_pm_ops mwifiex_sdio_pm_ops = { - .suspend = mwifiex_sdio_suspend, - .resume = mwifiex_sdio_resume, -}; - -static struct sdio_driver mwifiex_sdio = { - .name = "mwifiex_sdio", - .id_table = mwifiex_ids, - .probe = mwifiex_sdio_probe, - .remove = mwifiex_sdio_remove, - .drv = { - .owner = THIS_MODULE, - .pm = &mwifiex_sdio_pm_ops, - } -}; - -/* - * This function writes data into SDIO card register. - */ -static int -mwifiex_write_reg(struct mwifiex_adapter *adapter, u32 reg, u32 data) -{ - struct sdio_mmc_card *card = adapter->card; - int ret = -1; - - sdio_claim_host(card->func); - sdio_writeb(card->func, (u8) data, reg, &ret); - sdio_release_host(card->func); - - return ret; -} - -/* - * This function reads data from SDIO card register. - */ -static int -mwifiex_read_reg(struct mwifiex_adapter *adapter, u32 reg, u32 *data) -{ - struct sdio_mmc_card *card = adapter->card; - int ret = -1; - u8 val; - - sdio_claim_host(card->func); - val = sdio_readb(card->func, reg, &ret); - sdio_release_host(card->func); - - *data = val; - - return ret; -} - -/* - * This function writes multiple data into SDIO card memory. - * - * This does not work in suspended mode. - */ -static int -mwifiex_write_data_sync(struct mwifiex_adapter *adapter, - u8 *buffer, u32 pkt_len, u32 port) -{ - struct sdio_mmc_card *card = adapter->card; - int ret; - u8 blk_mode = - (port & MWIFIEX_SDIO_BYTE_MODE_MASK) ? BYTE_MODE : BLOCK_MODE; - u32 blk_size = (blk_mode == BLOCK_MODE) ? MWIFIEX_SDIO_BLOCK_SIZE : 1; - u32 blk_cnt = - (blk_mode == - BLOCK_MODE) ? (pkt_len / - MWIFIEX_SDIO_BLOCK_SIZE) : pkt_len; - u32 ioport = (port & MWIFIEX_SDIO_IO_PORT_MASK); - - if (adapter->is_suspended) { - dev_err(adapter->dev, - "%s: not allowed while suspended\n", __func__); - return -1; - } - - sdio_claim_host(card->func); - - ret = sdio_writesb(card->func, ioport, buffer, blk_cnt * blk_size); - - sdio_release_host(card->func); - - return ret; -} - -/* - * This function reads multiple data from SDIO card memory. - */ -static int mwifiex_read_data_sync(struct mwifiex_adapter *adapter, u8 *buffer, - u32 len, u32 port, u8 claim) -{ - struct sdio_mmc_card *card = adapter->card; - int ret; - u8 blk_mode = (port & MWIFIEX_SDIO_BYTE_MODE_MASK) ? BYTE_MODE - : BLOCK_MODE; - u32 blk_size = (blk_mode == BLOCK_MODE) ? MWIFIEX_SDIO_BLOCK_SIZE : 1; - u32 blk_cnt = (blk_mode == BLOCK_MODE) ? (len / MWIFIEX_SDIO_BLOCK_SIZE) - : len; - u32 ioport = (port & MWIFIEX_SDIO_IO_PORT_MASK); - - if (claim) - sdio_claim_host(card->func); - - ret = sdio_readsb(card->func, buffer, ioport, blk_cnt * blk_size); - - if (claim) - sdio_release_host(card->func); - - return ret; -} - -/* - * This function wakes up the card. - * - * A host power up command is written to the card configuration - * register to wake up the card. - */ -static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter) -{ - dev_dbg(adapter->dev, "event: wakeup device...\n"); - - return mwifiex_write_reg(adapter, CONFIGURATION_REG, HOST_POWER_UP); -} - -/* - * This function is called after the card has woken up. - * - * The card configuration register is reset. - */ -static int mwifiex_pm_wakeup_card_complete(struct mwifiex_adapter *adapter) -{ - dev_dbg(adapter->dev, "cmd: wakeup device completed\n"); - - return mwifiex_write_reg(adapter, CONFIGURATION_REG, 0); -} - -/* - * This function initializes the IO ports. - * - * The following operations are performed - - * - Read the IO ports (0, 1 and 2) - * - Set host interrupt Reset-To-Read to clear - * - Set auto re-enable interrupt - */ -static int mwifiex_init_sdio_ioport(struct mwifiex_adapter *adapter) -{ - u32 reg; - - adapter->ioport = 0; - - /* Read the IO port */ - if (!mwifiex_read_reg(adapter, IO_PORT_0_REG, ®)) - adapter->ioport |= (reg & 0xff); - else - return -1; - - if (!mwifiex_read_reg(adapter, IO_PORT_1_REG, ®)) - adapter->ioport |= ((reg & 0xff) << 8); - else - return -1; - - if (!mwifiex_read_reg(adapter, IO_PORT_2_REG, ®)) - adapter->ioport |= ((reg & 0xff) << 16); - else - return -1; - - pr_debug("info: SDIO FUNC1 IO port: %#x\n", adapter->ioport); - - /* Set Host interrupt reset to read to clear */ - if (!mwifiex_read_reg(adapter, HOST_INT_RSR_REG, ®)) - mwifiex_write_reg(adapter, HOST_INT_RSR_REG, - reg | SDIO_INT_MASK); - else - return -1; - - /* Dnld/Upld ready set to auto reset */ - if (!mwifiex_read_reg(adapter, CARD_MISC_CFG_REG, ®)) - mwifiex_write_reg(adapter, CARD_MISC_CFG_REG, - reg | AUTO_RE_ENABLE_INT); - else - return -1; - - return 0; -} - -/* - * This function sends data to the card. - */ -static int mwifiex_write_data_to_card(struct mwifiex_adapter *adapter, - u8 *payload, u32 pkt_len, u32 port) -{ - u32 i = 0; - int ret; - - do { - ret = mwifiex_write_data_sync(adapter, payload, pkt_len, port); - if (ret) { - i++; - dev_err(adapter->dev, "host_to_card, write iomem" - " (%d) failed: %d\n", i, ret); - if (mwifiex_write_reg(adapter, CONFIGURATION_REG, 0x04)) - dev_err(adapter->dev, "write CFG reg failed\n"); - - ret = -1; - if (i > MAX_WRITE_IOMEM_RETRY) - return ret; - } - } while (ret == -1); - - return ret; -} - -/* - * This function gets the read port. - * - * If control port bit is set in MP read bitmap, the control port - * is returned, otherwise the current read port is returned and - * the value is increased (provided it does not reach the maximum - * limit, in which case it is reset to 1) - */ -static int mwifiex_get_rd_port(struct mwifiex_adapter *adapter, u8 *port) -{ - struct sdio_mmc_card *card = adapter->card; - u16 rd_bitmap = card->mp_rd_bitmap; - - dev_dbg(adapter->dev, "data: mp_rd_bitmap=0x%04x\n", rd_bitmap); - - if (!(rd_bitmap & (CTRL_PORT_MASK | DATA_PORT_MASK))) - return -1; - - if (card->mp_rd_bitmap & CTRL_PORT_MASK) { - card->mp_rd_bitmap &= (u16) (~CTRL_PORT_MASK); - *port = CTRL_PORT; - dev_dbg(adapter->dev, "data: port=%d mp_rd_bitmap=0x%04x\n", - *port, card->mp_rd_bitmap); - } else { - if (card->mp_rd_bitmap & (1 << card->curr_rd_port)) { - card->mp_rd_bitmap &= (u16) - (~(1 << card->curr_rd_port)); - *port = card->curr_rd_port; - - if (++card->curr_rd_port == MAX_PORT) - card->curr_rd_port = 1; - } else { - return -1; - } - - dev_dbg(adapter->dev, - "data: port=%d mp_rd_bitmap=0x%04x -> 0x%04x\n", - *port, rd_bitmap, card->mp_rd_bitmap); - } - return 0; -} - -/* - * This function gets the write port for data. - * - * The current write port is returned if available and the value is - * increased (provided it does not reach the maximum limit, in which - * case it is reset to 1) - */ -static int mwifiex_get_wr_port_data(struct mwifiex_adapter *adapter, u8 *port) -{ - struct sdio_mmc_card *card = adapter->card; - u16 wr_bitmap = card->mp_wr_bitmap; - - dev_dbg(adapter->dev, "data: mp_wr_bitmap=0x%04x\n", wr_bitmap); - - if (!(wr_bitmap & card->mp_data_port_mask)) - return -1; - - if (card->mp_wr_bitmap & (1 << card->curr_wr_port)) { - card->mp_wr_bitmap &= (u16) (~(1 << card->curr_wr_port)); - *port = card->curr_wr_port; - if (++card->curr_wr_port == card->mp_end_port) - card->curr_wr_port = 1; - } else { - adapter->data_sent = true; - return -EBUSY; - } - - if (*port == CTRL_PORT) { - dev_err(adapter->dev, "invalid data port=%d cur port=%d" - " mp_wr_bitmap=0x%04x -> 0x%04x\n", - *port, card->curr_wr_port, wr_bitmap, - card->mp_wr_bitmap); - return -1; - } - - dev_dbg(adapter->dev, "data: port=%d mp_wr_bitmap=0x%04x -> 0x%04x\n", - *port, wr_bitmap, card->mp_wr_bitmap); - - return 0; -} - -/* - * This function polls the card status. - */ -static int -mwifiex_sdio_poll_card_status(struct mwifiex_adapter *adapter, u8 bits) -{ - u32 tries; - u32 cs; - - for (tries = 0; tries < MAX_POLL_TRIES; tries++) { - if (mwifiex_read_reg(adapter, CARD_STATUS_REG, &cs)) - break; - else if ((cs & bits) == bits) - return 0; - - usleep_range(10, 20); - } - - dev_err(adapter->dev, "poll card status failed, tries = %d\n", tries); - - return -1; -} - -/* - * This function reads the firmware status. - */ -static int -mwifiex_sdio_read_fw_status(struct mwifiex_adapter *adapter, u16 *dat) -{ - u32 fws0, fws1; - - if (mwifiex_read_reg(adapter, CARD_FW_STATUS0_REG, &fws0)) - return -1; - - if (mwifiex_read_reg(adapter, CARD_FW_STATUS1_REG, &fws1)) - return -1; - - *dat = (u16) ((fws1 << 8) | fws0); - - return 0; -} - -/* - * This function disables the host interrupt. - * - * The host interrupt mask is read, the disable bit is reset and - * written back to the card host interrupt mask register. - */ -static int mwifiex_sdio_disable_host_int(struct mwifiex_adapter *adapter) -{ - u32 host_int_mask; - - /* Read back the host_int_mask register */ - if (mwifiex_read_reg(adapter, HOST_INT_MASK_REG, &host_int_mask)) - return -1; - - /* Update with the mask and write back to the register */ - host_int_mask &= ~HOST_INT_DISABLE; - - if (mwifiex_write_reg(adapter, HOST_INT_MASK_REG, host_int_mask)) { - dev_err(adapter->dev, "disable host interrupt failed\n"); - return -1; - } - - return 0; -} - -/* - * This function enables the host interrupt. - * - * The host interrupt enable mask is written to the card - * host interrupt mask register. - */ -static int mwifiex_sdio_enable_host_int(struct mwifiex_adapter *adapter) -{ - /* Simply write the mask to the register */ - if (mwifiex_write_reg(adapter, HOST_INT_MASK_REG, HOST_INT_ENABLE)) { - dev_err(adapter->dev, "enable host interrupt failed\n"); - return -1; - } - return 0; -} - -/* - * This function sends a data buffer to the card. - */ -static int mwifiex_sdio_card_to_host(struct mwifiex_adapter *adapter, - u32 *type, u8 *buffer, - u32 npayload, u32 ioport) -{ - int ret; - u32 nb; - - if (!buffer) { - dev_err(adapter->dev, "%s: buffer is NULL\n", __func__); - return -1; - } - - ret = mwifiex_read_data_sync(adapter, buffer, npayload, ioport, 1); - - if (ret) { - dev_err(adapter->dev, "%s: read iomem failed: %d\n", __func__, - ret); - return -1; - } - - nb = le16_to_cpu(*(__le16 *) (buffer)); - if (nb > npayload) { - dev_err(adapter->dev, "%s: invalid packet, nb=%d npayload=%d\n", - __func__, nb, npayload); - return -1; - } - - *type = le16_to_cpu(*(__le16 *) (buffer + 2)); - - return ret; -} - -/* - * This function downloads the firmware to the card. - * - * Firmware is downloaded to the card in blocks. Every block download - * is tested for CRC errors, and retried a number of times before - * returning failure. - */ -static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, - struct mwifiex_fw_image *fw) -{ - int ret; - u8 *firmware = fw->fw_buf; - u32 firmware_len = fw->fw_len; - u32 offset = 0; - u32 base0, base1; - u8 *fwbuf; - u16 len = 0; - u32 txlen, tx_blocks = 0, tries; - u32 i = 0; - - if (!firmware_len) { - dev_err(adapter->dev, - "firmware image not found! Terminating download\n"); - return -1; - } - - dev_dbg(adapter->dev, "info: downloading FW image (%d bytes)\n", - firmware_len); - - /* Assume that the allocated buffer is 8-byte aligned */ - fwbuf = kzalloc(MWIFIEX_UPLD_SIZE, GFP_KERNEL); - if (!fwbuf) - return -ENOMEM; - - /* Perform firmware data transfer */ - do { - /* The host polls for the DN_LD_CARD_RDY and CARD_IO_READY - bits */ - ret = mwifiex_sdio_poll_card_status(adapter, CARD_IO_READY | - DN_LD_CARD_RDY); - if (ret) { - dev_err(adapter->dev, "FW download with helper:" - " poll status timeout @ %d\n", offset); - goto done; - } - - /* More data? */ - if (offset >= firmware_len) - break; - - for (tries = 0; tries < MAX_POLL_TRIES; tries++) { - ret = mwifiex_read_reg(adapter, HOST_F1_RD_BASE_0, - &base0); - if (ret) { - dev_err(adapter->dev, - "dev BASE0 register read failed: " - "base0=%#04X(%d). Terminating dnld\n", - base0, base0); - goto done; - } - ret = mwifiex_read_reg(adapter, HOST_F1_RD_BASE_1, - &base1); - if (ret) { - dev_err(adapter->dev, - "dev BASE1 register read failed: " - "base1=%#04X(%d). Terminating dnld\n", - base1, base1); - goto done; - } - len = (u16) (((base1 & 0xff) << 8) | (base0 & 0xff)); - - if (len) - break; - - usleep_range(10, 20); - } - - if (!len) { - break; - } else if (len > MWIFIEX_UPLD_SIZE) { - dev_err(adapter->dev, - "FW dnld failed @ %d, invalid length %d\n", - offset, len); - ret = -1; - goto done; - } - - txlen = len; - - if (len & BIT(0)) { - i++; - if (i > MAX_WRITE_IOMEM_RETRY) { - dev_err(adapter->dev, - "FW dnld failed @ %d, over max retry\n", - offset); - ret = -1; - goto done; - } - dev_err(adapter->dev, "CRC indicated by the helper:" - " len = 0x%04X, txlen = %d\n", len, txlen); - len &= ~BIT(0); - /* Setting this to 0 to resend from same offset */ - txlen = 0; - } else { - i = 0; - - /* Set blocksize to transfer - checking for last - block */ - if (firmware_len - offset < txlen) - txlen = firmware_len - offset; - - tx_blocks = (txlen + MWIFIEX_SDIO_BLOCK_SIZE - 1) - / MWIFIEX_SDIO_BLOCK_SIZE; - - /* Copy payload to buffer */ - memmove(fwbuf, &firmware[offset], txlen); - } - - ret = mwifiex_write_data_sync(adapter, fwbuf, tx_blocks * - MWIFIEX_SDIO_BLOCK_SIZE, - adapter->ioport); - if (ret) { - dev_err(adapter->dev, - "FW download, write iomem (%d) failed @ %d\n", - i, offset); - if (mwifiex_write_reg(adapter, CONFIGURATION_REG, 0x04)) - dev_err(adapter->dev, "write CFG reg failed\n"); - - ret = -1; - goto done; - } - - offset += txlen; - } while (true); - - dev_dbg(adapter->dev, "info: FW download over, size %d bytes\n", - offset); - - ret = 0; -done: - kfree(fwbuf); - return ret; -} - -/* - * This function checks the firmware status in card. - * - * The winner interface is also determined by this function. - */ -static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter, - u32 poll_num) -{ - int ret = 0; - u16 firmware_stat; - u32 tries; - u32 winner_status; - - /* Wait for firmware initialization event */ - for (tries = 0; tries < poll_num; tries++) { - ret = mwifiex_sdio_read_fw_status(adapter, &firmware_stat); - if (ret) - continue; - if (firmware_stat == FIRMWARE_READY_SDIO) { - ret = 0; - break; - } else { - mdelay(100); - ret = -1; - } - } - - if (ret) { - if (mwifiex_read_reg - (adapter, CARD_FW_STATUS0_REG, &winner_status)) - winner_status = 0; - - if (winner_status) - adapter->winner = 0; - else - adapter->winner = 1; - } - return ret; -} - -/* - * This function reads the interrupt status from card. - */ -static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter) -{ - struct sdio_mmc_card *card = adapter->card; - u32 sdio_ireg; - unsigned long flags; - - if (mwifiex_read_data_sync(adapter, card->mp_regs, MAX_MP_REGS, - REG_PORT | MWIFIEX_SDIO_BYTE_MODE_MASK, - 0)) { - dev_err(adapter->dev, "read mp_regs failed\n"); - return; - } - - sdio_ireg = card->mp_regs[HOST_INTSTATUS_REG]; - if (sdio_ireg) { - /* - * DN_LD_HOST_INT_STATUS and/or UP_LD_HOST_INT_STATUS - * Clear the interrupt status register - */ - dev_dbg(adapter->dev, "int: sdio_ireg = %#x\n", sdio_ireg); - spin_lock_irqsave(&adapter->int_lock, flags); - adapter->int_status |= sdio_ireg; - spin_unlock_irqrestore(&adapter->int_lock, flags); - } -} - -/* - * SDIO interrupt handler. - * - * This function reads the interrupt status from firmware and handles - * the interrupt in current thread (ksdioirqd) right away. - */ -static void -mwifiex_sdio_interrupt(struct sdio_func *func) -{ - struct mwifiex_adapter *adapter; - struct sdio_mmc_card *card; - - card = sdio_get_drvdata(func); - if (!card || !card->adapter) { - pr_debug("int: func=%p card=%p adapter=%p\n", - func, card, card ? card->adapter : NULL); - return; - } - adapter = card->adapter; - - if (adapter->surprise_removed) - return; - - if (!adapter->pps_uapsd_mode && adapter->ps_state == PS_STATE_SLEEP) - adapter->ps_state = PS_STATE_AWAKE; - - mwifiex_interrupt_status(adapter); - mwifiex_main_process(adapter); -} - -/* - * This function decodes a received packet. - * - * Based on the type, the packet is treated as either a data, or - * a command response, or an event, and the correct handler - * function is invoked. - */ -static int mwifiex_decode_rx_packet(struct mwifiex_adapter *adapter, - struct sk_buff *skb, u32 upld_typ) -{ - u8 *cmd_buf; - __le16 *curr_ptr = (__le16 *)skb->data; - u16 pkt_len = le16_to_cpu(*curr_ptr); - - skb_trim(skb, pkt_len); - skb_pull(skb, INTF_HEADER_LEN); - - switch (upld_typ) { - case MWIFIEX_TYPE_DATA: - dev_dbg(adapter->dev, "info: --- Rx: Data packet ---\n"); - mwifiex_handle_rx_packet(adapter, skb); - break; - - case MWIFIEX_TYPE_CMD: - dev_dbg(adapter->dev, "info: --- Rx: Cmd Response ---\n"); - /* take care of curr_cmd = NULL case */ - if (!adapter->curr_cmd) { - cmd_buf = adapter->upld_buf; - - if (adapter->ps_state == PS_STATE_SLEEP_CFM) - mwifiex_process_sleep_confirm_resp(adapter, - skb->data, - skb->len); - - memcpy(cmd_buf, skb->data, - min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, - skb->len)); - - dev_kfree_skb_any(skb); - } else { - adapter->cmd_resp_received = true; - adapter->curr_cmd->resp_skb = skb; - } - break; - - case MWIFIEX_TYPE_EVENT: - dev_dbg(adapter->dev, "info: --- Rx: Event ---\n"); - adapter->event_cause = *(u32 *) skb->data; - - if ((skb->len > 0) && (skb->len < MAX_EVENT_SIZE)) - memcpy(adapter->event_body, - skb->data + MWIFIEX_EVENT_HEADER_LEN, - skb->len); - - /* event cause has been saved to adapter->event_cause */ - adapter->event_received = true; - adapter->event_skb = skb; - - break; - - default: - dev_err(adapter->dev, "unknown upload type %#x\n", upld_typ); - dev_kfree_skb_any(skb); - break; - } - - return 0; -} - -/* - * This function transfers received packets from card to driver, performing - * aggregation if required. - * - * For data received on control port, or if aggregation is disabled, the - * received buffers are uploaded as separate packets. However, if aggregation - * is enabled and required, the buffers are copied onto an aggregation buffer, - * provided there is space left, processed and finally uploaded. - */ -static int mwifiex_sdio_card_to_host_mp_aggr(struct mwifiex_adapter *adapter, - struct sk_buff *skb, u8 port) -{ - struct sdio_mmc_card *card = adapter->card; - s32 f_do_rx_aggr = 0; - s32 f_do_rx_cur = 0; - s32 f_aggr_cur = 0; - struct sk_buff *skb_deaggr; - u32 pind; - u32 pkt_len, pkt_type = 0; - u8 *curr_ptr; - u32 rx_len = skb->len; - - if (port == CTRL_PORT) { - /* Read the command Resp without aggr */ - dev_dbg(adapter->dev, "info: %s: no aggregation for cmd " - "response\n", __func__); - - f_do_rx_cur = 1; - goto rx_curr_single; - } - - if (!card->mpa_rx.enabled) { - dev_dbg(adapter->dev, "info: %s: rx aggregation disabled\n", - __func__); - - f_do_rx_cur = 1; - goto rx_curr_single; - } - - if (card->mp_rd_bitmap & (~((u16) CTRL_PORT_MASK))) { - /* Some more data RX pending */ - dev_dbg(adapter->dev, "info: %s: not last packet\n", __func__); - - if (MP_RX_AGGR_IN_PROGRESS(card)) { - if (MP_RX_AGGR_BUF_HAS_ROOM(card, skb->len)) { - f_aggr_cur = 1; - } else { - /* No room in Aggr buf, do rx aggr now */ - f_do_rx_aggr = 1; - f_do_rx_cur = 1; - } - } else { - /* Rx aggr not in progress */ - f_aggr_cur = 1; - } - - } else { - /* No more data RX pending */ - dev_dbg(adapter->dev, "info: %s: last packet\n", __func__); - - if (MP_RX_AGGR_IN_PROGRESS(card)) { - f_do_rx_aggr = 1; - if (MP_RX_AGGR_BUF_HAS_ROOM(card, skb->len)) - f_aggr_cur = 1; - else - /* No room in Aggr buf, do rx aggr now */ - f_do_rx_cur = 1; - } else { - f_do_rx_cur = 1; - } - } - - if (f_aggr_cur) { - dev_dbg(adapter->dev, "info: current packet aggregation\n"); - /* Curr pkt can be aggregated */ - MP_RX_AGGR_SETUP(card, skb, port); - - if (MP_RX_AGGR_PKT_LIMIT_REACHED(card) || - MP_RX_AGGR_PORT_LIMIT_REACHED(card)) { - dev_dbg(adapter->dev, "info: %s: aggregated packet " - "limit reached\n", __func__); - /* No more pkts allowed in Aggr buf, rx it */ - f_do_rx_aggr = 1; - } - } - - if (f_do_rx_aggr) { - /* do aggr RX now */ - dev_dbg(adapter->dev, "info: do_rx_aggr: num of packets: %d\n", - card->mpa_rx.pkt_cnt); - - if (mwifiex_read_data_sync(adapter, card->mpa_rx.buf, - card->mpa_rx.buf_len, - (adapter->ioport | 0x1000 | - (card->mpa_rx.ports << 4)) + - card->mpa_rx.start_port, 1)) - goto error; - - curr_ptr = card->mpa_rx.buf; - - for (pind = 0; pind < card->mpa_rx.pkt_cnt; pind++) { - - /* get curr PKT len & type */ - pkt_len = *(u16 *) &curr_ptr[0]; - pkt_type = *(u16 *) &curr_ptr[2]; - - /* copy pkt to deaggr buf */ - skb_deaggr = card->mpa_rx.skb_arr[pind]; - - if ((pkt_type == MWIFIEX_TYPE_DATA) && (pkt_len <= - card->mpa_rx.len_arr[pind])) { - - memcpy(skb_deaggr->data, curr_ptr, pkt_len); - - skb_trim(skb_deaggr, pkt_len); - - /* Process de-aggr packet */ - mwifiex_decode_rx_packet(adapter, skb_deaggr, - pkt_type); - } else { - dev_err(adapter->dev, "wrong aggr pkt:" - " type=%d len=%d max_len=%d\n", - pkt_type, pkt_len, - card->mpa_rx.len_arr[pind]); - dev_kfree_skb_any(skb_deaggr); - } - curr_ptr += card->mpa_rx.len_arr[pind]; - } - MP_RX_AGGR_BUF_RESET(card); - } - -rx_curr_single: - if (f_do_rx_cur) { - dev_dbg(adapter->dev, "info: RX: port: %d, rx_len: %d\n", - port, rx_len); - - if (mwifiex_sdio_card_to_host(adapter, &pkt_type, - skb->data, skb->len, - adapter->ioport + port)) - goto error; - - mwifiex_decode_rx_packet(adapter, skb, pkt_type); - } - - return 0; - -error: - if (MP_RX_AGGR_IN_PROGRESS(card)) { - /* Multiport-aggregation transfer failed - cleanup */ - for (pind = 0; pind < card->mpa_rx.pkt_cnt; pind++) { - /* copy pkt to deaggr buf */ - skb_deaggr = card->mpa_rx.skb_arr[pind]; - dev_kfree_skb_any(skb_deaggr); - } - MP_RX_AGGR_BUF_RESET(card); - } - - if (f_do_rx_cur) - /* Single transfer pending. Free curr buff also */ - dev_kfree_skb_any(skb); - - return -1; -} - -/* - * This function checks the current interrupt status. - * - * The following interrupts are checked and handled by this function - - * - Data sent - * - Command sent - * - Packets received - * - * Since the firmware does not generate download ready interrupt if the - * port updated is command port only, command sent interrupt checking - * should be done manually, and for every SDIO interrupt. - * - * In case of Rx packets received, the packets are uploaded from card to - * host and processed accordingly. - */ -static int mwifiex_process_int_status(struct mwifiex_adapter *adapter) -{ - struct sdio_mmc_card *card = adapter->card; - int ret = 0; - u8 sdio_ireg; - struct sk_buff *skb; - u8 port = CTRL_PORT; - u32 len_reg_l, len_reg_u; - u32 rx_blocks; - u16 rx_len; - unsigned long flags; - - spin_lock_irqsave(&adapter->int_lock, flags); - sdio_ireg = adapter->int_status; - adapter->int_status = 0; - spin_unlock_irqrestore(&adapter->int_lock, flags); - - if (!sdio_ireg) - return ret; - - if (sdio_ireg & DN_LD_HOST_INT_STATUS) { - card->mp_wr_bitmap = ((u16) card->mp_regs[WR_BITMAP_U]) << 8; - card->mp_wr_bitmap |= (u16) card->mp_regs[WR_BITMAP_L]; - dev_dbg(adapter->dev, "int: DNLD: wr_bitmap=0x%04x\n", - card->mp_wr_bitmap); - if (adapter->data_sent && - (card->mp_wr_bitmap & card->mp_data_port_mask)) { - dev_dbg(adapter->dev, - "info: <--- Tx DONE Interrupt --->\n"); - adapter->data_sent = false; - } - } - - /* As firmware will not generate download ready interrupt if the port - updated is command port only, cmd_sent should be done for any SDIO - interrupt. */ - if (adapter->cmd_sent) { - /* Check if firmware has attach buffer at command port and - update just that in wr_bit_map. */ - card->mp_wr_bitmap |= - (u16) card->mp_regs[WR_BITMAP_L] & CTRL_PORT_MASK; - if (card->mp_wr_bitmap & CTRL_PORT_MASK) - adapter->cmd_sent = false; - } - - dev_dbg(adapter->dev, "info: cmd_sent=%d data_sent=%d\n", - adapter->cmd_sent, adapter->data_sent); - if (sdio_ireg & UP_LD_HOST_INT_STATUS) { - card->mp_rd_bitmap = ((u16) card->mp_regs[RD_BITMAP_U]) << 8; - card->mp_rd_bitmap |= (u16) card->mp_regs[RD_BITMAP_L]; - dev_dbg(adapter->dev, "int: UPLD: rd_bitmap=0x%04x\n", - card->mp_rd_bitmap); - - while (true) { - ret = mwifiex_get_rd_port(adapter, &port); - if (ret) { - dev_dbg(adapter->dev, - "info: no more rd_port available\n"); - break; - } - len_reg_l = RD_LEN_P0_L + (port << 1); - len_reg_u = RD_LEN_P0_U + (port << 1); - rx_len = ((u16) card->mp_regs[len_reg_u]) << 8; - rx_len |= (u16) card->mp_regs[len_reg_l]; - dev_dbg(adapter->dev, "info: RX: port=%d rx_len=%u\n", - port, rx_len); - rx_blocks = - (rx_len + MWIFIEX_SDIO_BLOCK_SIZE - - 1) / MWIFIEX_SDIO_BLOCK_SIZE; - if (rx_len <= INTF_HEADER_LEN || - (rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE) > - MWIFIEX_RX_DATA_BUF_SIZE) { - dev_err(adapter->dev, "invalid rx_len=%d\n", - rx_len); - return -1; - } - rx_len = (u16) (rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE); - - skb = dev_alloc_skb(rx_len); - - if (!skb) { - dev_err(adapter->dev, "%s: failed to alloc skb", - __func__); - return -1; - } - - skb_put(skb, rx_len); - - dev_dbg(adapter->dev, "info: rx_len = %d skb->len = %d\n", - rx_len, skb->len); - - if (mwifiex_sdio_card_to_host_mp_aggr(adapter, skb, - port)) { - u32 cr = 0; - - dev_err(adapter->dev, "card_to_host_mpa failed:" - " int status=%#x\n", sdio_ireg); - if (mwifiex_read_reg(adapter, - CONFIGURATION_REG, &cr)) - dev_err(adapter->dev, - "read CFG reg failed\n"); - - dev_dbg(adapter->dev, - "info: CFG reg val = %d\n", cr); - if (mwifiex_write_reg(adapter, - CONFIGURATION_REG, - (cr | 0x04))) - dev_err(adapter->dev, - "write CFG reg failed\n"); - - dev_dbg(adapter->dev, "info: write success\n"); - if (mwifiex_read_reg(adapter, - CONFIGURATION_REG, &cr)) - dev_err(adapter->dev, - "read CFG reg failed\n"); - - dev_dbg(adapter->dev, - "info: CFG reg val =%x\n", cr); - return -1; - } - } - } - - return 0; -} - -/* - * This function aggregates transmission buffers in driver and downloads - * the aggregated packet to card. - * - * The individual packets are aggregated by copying into an aggregation - * buffer and then downloaded to the card. Previous unsent packets in the - * aggregation buffer are pre-copied first before new packets are added. - * Aggregation is done till there is space left in the aggregation buffer, - * or till new packets are available. - * - * The function will only download the packet to the card when aggregation - * stops, otherwise it will just aggregate the packet in aggregation buffer - * and return. - */ -static int mwifiex_host_to_card_mp_aggr(struct mwifiex_adapter *adapter, - u8 *payload, u32 pkt_len, u8 port, - u32 next_pkt_len) -{ - struct sdio_mmc_card *card = adapter->card; - int ret = 0; - s32 f_send_aggr_buf = 0; - s32 f_send_cur_buf = 0; - s32 f_precopy_cur_buf = 0; - s32 f_postcopy_cur_buf = 0; - - if ((!card->mpa_tx.enabled) || (port == CTRL_PORT)) { - dev_dbg(adapter->dev, "info: %s: tx aggregation disabled\n", - __func__); - - f_send_cur_buf = 1; - goto tx_curr_single; - } - - if (next_pkt_len) { - /* More pkt in TX queue */ - dev_dbg(adapter->dev, "info: %s: more packets in queue.\n", - __func__); - - if (MP_TX_AGGR_IN_PROGRESS(card)) { - if (!MP_TX_AGGR_PORT_LIMIT_REACHED(card) && - MP_TX_AGGR_BUF_HAS_ROOM(card, pkt_len)) { - f_precopy_cur_buf = 1; - - if (!(card->mp_wr_bitmap & - (1 << card->curr_wr_port)) || - !MP_TX_AGGR_BUF_HAS_ROOM( - card, pkt_len + next_pkt_len)) - f_send_aggr_buf = 1; - } else { - /* No room in Aggr buf, send it */ - f_send_aggr_buf = 1; - - if (MP_TX_AGGR_PORT_LIMIT_REACHED(card) || - !(card->mp_wr_bitmap & - (1 << card->curr_wr_port))) - f_send_cur_buf = 1; - else - f_postcopy_cur_buf = 1; - } - } else { - if (MP_TX_AGGR_BUF_HAS_ROOM(card, pkt_len) && - (card->mp_wr_bitmap & (1 << card->curr_wr_port))) - f_precopy_cur_buf = 1; - else - f_send_cur_buf = 1; - } - } else { - /* Last pkt in TX queue */ - dev_dbg(adapter->dev, "info: %s: Last packet in Tx Queue.\n", - __func__); - - if (MP_TX_AGGR_IN_PROGRESS(card)) { - /* some packs in Aggr buf already */ - f_send_aggr_buf = 1; - - if (MP_TX_AGGR_BUF_HAS_ROOM(card, pkt_len)) - f_precopy_cur_buf = 1; - else - /* No room in Aggr buf, send it */ - f_send_cur_buf = 1; - } else { - f_send_cur_buf = 1; - } - } - - if (f_precopy_cur_buf) { - dev_dbg(adapter->dev, "data: %s: precopy current buffer\n", - __func__); - MP_TX_AGGR_BUF_PUT(card, payload, pkt_len, port); - - if (MP_TX_AGGR_PKT_LIMIT_REACHED(card) || - MP_TX_AGGR_PORT_LIMIT_REACHED(card)) - /* No more pkts allowed in Aggr buf, send it */ - f_send_aggr_buf = 1; - } - - if (f_send_aggr_buf) { - dev_dbg(adapter->dev, "data: %s: send aggr buffer: %d %d\n", - __func__, - card->mpa_tx.start_port, card->mpa_tx.ports); - ret = mwifiex_write_data_to_card(adapter, card->mpa_tx.buf, - card->mpa_tx.buf_len, - (adapter->ioport | 0x1000 | - (card->mpa_tx.ports << 4)) + - card->mpa_tx.start_port); - - MP_TX_AGGR_BUF_RESET(card); - } - -tx_curr_single: - if (f_send_cur_buf) { - dev_dbg(adapter->dev, "data: %s: send current buffer %d\n", - __func__, port); - ret = mwifiex_write_data_to_card(adapter, payload, pkt_len, - adapter->ioport + port); - } - - if (f_postcopy_cur_buf) { - dev_dbg(adapter->dev, "data: %s: postcopy current buffer\n", - __func__); - MP_TX_AGGR_BUF_PUT(card, payload, pkt_len, port); - } - - return ret; -} - -/* - * This function downloads data from driver to card. - * - * Both commands and data packets are transferred to the card by this - * function. - * - * This function adds the SDIO specific header to the front of the buffer - * before transferring. The header contains the length of the packet and - * the type. The firmware handles the packets based upon this set type. - */ -static int mwifiex_sdio_host_to_card(struct mwifiex_adapter *adapter, - u8 type, struct sk_buff *skb, - struct mwifiex_tx_param *tx_param) -{ - struct sdio_mmc_card *card = adapter->card; - int ret; - u32 buf_block_len; - u32 blk_size; - u8 port = CTRL_PORT; - u8 *payload = (u8 *)skb->data; - u32 pkt_len = skb->len; - - /* Allocate buffer and copy payload */ - blk_size = MWIFIEX_SDIO_BLOCK_SIZE; - buf_block_len = (pkt_len + blk_size - 1) / blk_size; - *(__le16 *)&payload[0] = cpu_to_le16((u16)pkt_len); - *(__le16 *)&payload[2] = cpu_to_le16(type); - - /* - * This is SDIO specific header - * u16 length, - * u16 type (MWIFIEX_TYPE_DATA = 0, MWIFIEX_TYPE_CMD = 1, - * MWIFIEX_TYPE_EVENT = 3) - */ - if (type == MWIFIEX_TYPE_DATA) { - ret = mwifiex_get_wr_port_data(adapter, &port); - if (ret) { - dev_err(adapter->dev, "%s: no wr_port available\n", - __func__); - return ret; - } - } else { - adapter->cmd_sent = true; - /* Type must be MWIFIEX_TYPE_CMD */ - - if (pkt_len <= INTF_HEADER_LEN || - pkt_len > MWIFIEX_UPLD_SIZE) - dev_err(adapter->dev, "%s: payload=%p, nb=%d\n", - __func__, payload, pkt_len); - } - - /* Transfer data to card */ - pkt_len = buf_block_len * blk_size; - - if (tx_param) - ret = mwifiex_host_to_card_mp_aggr(adapter, payload, pkt_len, - port, tx_param->next_pkt_len - ); - else - ret = mwifiex_host_to_card_mp_aggr(adapter, payload, pkt_len, - port, 0); - - if (ret) { - if (type == MWIFIEX_TYPE_CMD) - adapter->cmd_sent = false; - if (type == MWIFIEX_TYPE_DATA) - adapter->data_sent = false; - } else { - if (type == MWIFIEX_TYPE_DATA) { - if (!(card->mp_wr_bitmap & (1 << card->curr_wr_port))) - adapter->data_sent = true; - else - adapter->data_sent = false; - } - } - - return ret; -} - -/* - * This function allocates the MPA Tx and Rx buffers. - */ -static int mwifiex_alloc_sdio_mpa_buffers(struct mwifiex_adapter *adapter, - u32 mpa_tx_buf_size, u32 mpa_rx_buf_size) -{ - struct sdio_mmc_card *card = adapter->card; - int ret = 0; - - card->mpa_tx.buf = kzalloc(mpa_tx_buf_size, GFP_KERNEL); - if (!card->mpa_tx.buf) { - ret = -1; - goto error; - } - - card->mpa_tx.buf_size = mpa_tx_buf_size; - - card->mpa_rx.buf = kzalloc(mpa_rx_buf_size, GFP_KERNEL); - if (!card->mpa_rx.buf) { - ret = -1; - goto error; - } - - card->mpa_rx.buf_size = mpa_rx_buf_size; - -error: - if (ret) { - kfree(card->mpa_tx.buf); - kfree(card->mpa_rx.buf); - } - - return ret; -} - -/* - * This function unregisters the SDIO device. - * - * The SDIO IRQ is released, the function is disabled and driver - * data is set to null. - */ -static void -mwifiex_unregister_dev(struct mwifiex_adapter *adapter) -{ - struct sdio_mmc_card *card = adapter->card; - - if (adapter->card) { - /* Release the SDIO IRQ */ - sdio_claim_host(card->func); - sdio_release_irq(card->func); - sdio_disable_func(card->func); - sdio_release_host(card->func); - sdio_set_drvdata(card->func, NULL); - } -} - -/* - * This function registers the SDIO device. - * - * SDIO IRQ is claimed, block size is set and driver data is initialized. - */ -static int mwifiex_register_dev(struct mwifiex_adapter *adapter) -{ - int ret = 0; - struct sdio_mmc_card *card = adapter->card; - struct sdio_func *func = card->func; - - /* save adapter pointer in card */ - card->adapter = adapter; - - sdio_claim_host(func); - - /* Request the SDIO IRQ */ - ret = sdio_claim_irq(func, mwifiex_sdio_interrupt); - if (ret) { - pr_err("claim irq failed: ret=%d\n", ret); - goto disable_func; - } - - /* Set block size */ - ret = sdio_set_block_size(card->func, MWIFIEX_SDIO_BLOCK_SIZE); - if (ret) { - pr_err("cannot set SDIO block size\n"); - ret = -1; - goto release_irq; - } - - sdio_release_host(func); - sdio_set_drvdata(func, card); - - adapter->dev = &func->dev; - - switch (func->device) { - case SDIO_DEVICE_ID_MARVELL_8786: - strcpy(adapter->fw_name, SD8786_DEFAULT_FW_NAME); - break; - case SDIO_DEVICE_ID_MARVELL_8797: - strcpy(adapter->fw_name, SD8797_DEFAULT_FW_NAME); - break; - case SDIO_DEVICE_ID_MARVELL_8787: - default: - strcpy(adapter->fw_name, SD8787_DEFAULT_FW_NAME); - break; - } - - return 0; - -release_irq: - sdio_release_irq(func); -disable_func: - sdio_disable_func(func); - sdio_release_host(func); - adapter->card = NULL; - - return -1; -} - -/* - * This function initializes the SDIO driver. - * - * The following initializations steps are followed - - * - Read the Host interrupt status register to acknowledge - * the first interrupt got from bootloader - * - Disable host interrupt mask register - * - Get SDIO port - * - Initialize SDIO variables in card - * - Allocate MP registers - * - Allocate MPA Tx and Rx buffers - */ -static int mwifiex_init_sdio(struct mwifiex_adapter *adapter) -{ - struct sdio_mmc_card *card = adapter->card; - int ret; - u32 sdio_ireg; - - /* - * Read the HOST_INT_STATUS_REG for ACK the first interrupt got - * from the bootloader. If we don't do this we get a interrupt - * as soon as we register the irq. - */ - mwifiex_read_reg(adapter, HOST_INTSTATUS_REG, &sdio_ireg); - - /* Disable host interrupt mask register for SDIO */ - mwifiex_sdio_disable_host_int(adapter); - - /* Get SDIO ioport */ - mwifiex_init_sdio_ioport(adapter); - - /* Initialize SDIO variables in card */ - card->mp_rd_bitmap = 0; - card->mp_wr_bitmap = 0; - card->curr_rd_port = 1; - card->curr_wr_port = 1; - - card->mp_data_port_mask = DATA_PORT_MASK; - - card->mpa_tx.buf_len = 0; - card->mpa_tx.pkt_cnt = 0; - card->mpa_tx.start_port = 0; - - card->mpa_tx.enabled = 1; - card->mpa_tx.pkt_aggr_limit = SDIO_MP_AGGR_DEF_PKT_LIMIT; - - card->mpa_rx.buf_len = 0; - card->mpa_rx.pkt_cnt = 0; - card->mpa_rx.start_port = 0; - - card->mpa_rx.enabled = 1; - card->mpa_rx.pkt_aggr_limit = SDIO_MP_AGGR_DEF_PKT_LIMIT; - - /* Allocate buffers for SDIO MP-A */ - card->mp_regs = kzalloc(MAX_MP_REGS, GFP_KERNEL); - if (!card->mp_regs) - return -ENOMEM; - - ret = mwifiex_alloc_sdio_mpa_buffers(adapter, - SDIO_MP_TX_AGGR_DEF_BUF_SIZE, - SDIO_MP_RX_AGGR_DEF_BUF_SIZE); - if (ret) { - dev_err(adapter->dev, "failed to alloc sdio mp-a buffers\n"); - kfree(card->mp_regs); - return -1; - } - - return ret; -} - -/* - * This function resets the MPA Tx and Rx buffers. - */ -static void mwifiex_cleanup_mpa_buf(struct mwifiex_adapter *adapter) -{ - struct sdio_mmc_card *card = adapter->card; - - MP_TX_AGGR_BUF_RESET(card); - MP_RX_AGGR_BUF_RESET(card); -} - -/* - * This function cleans up the allocated card buffers. - * - * The following are freed by this function - - * - MP registers - * - MPA Tx buffer - * - MPA Rx buffer - */ -static void mwifiex_cleanup_sdio(struct mwifiex_adapter *adapter) -{ - struct sdio_mmc_card *card = adapter->card; - - kfree(card->mp_regs); - kfree(card->mpa_tx.buf); - kfree(card->mpa_rx.buf); -} - -/* - * This function updates the MP end port in card. - */ -static void -mwifiex_update_mp_end_port(struct mwifiex_adapter *adapter, u16 port) -{ - struct sdio_mmc_card *card = adapter->card; - int i; - - card->mp_end_port = port; - - card->mp_data_port_mask = DATA_PORT_MASK; - - for (i = 1; i <= MAX_PORT - card->mp_end_port; i++) - card->mp_data_port_mask &= ~(1 << (MAX_PORT - i)); - - card->curr_wr_port = 1; - - dev_dbg(adapter->dev, "cmd: mp_end_port %d, data port mask 0x%x\n", - port, card->mp_data_port_mask); -} - -static struct mmc_host *reset_host; -static void sdio_card_reset_worker(struct work_struct *work) -{ - struct mmc_host *target = reset_host; - - /* The actual reset operation must be run outside of driver thread. - * This is because mmc_remove_host() will cause the device to be - * instantly destroyed, and the driver then needs to end its thread, - * leading to a deadlock. - * - * We run it in a totally independent workqueue. - */ - - pr_err("Resetting card...\n"); - mmc_remove_host(target); - /* 20ms delay is based on experiment with sdhci controller */ - mdelay(20); - mmc_add_host(target); -} -static DECLARE_WORK(card_reset_work, sdio_card_reset_worker); - -/* This function resets the card */ -static void mwifiex_sdio_card_reset(struct mwifiex_adapter *adapter) -{ - struct sdio_mmc_card *card = adapter->card; - - reset_host = card->func->card->host; - schedule_work(&card_reset_work); -} - -static struct mwifiex_if_ops sdio_ops = { - .init_if = mwifiex_init_sdio, - .cleanup_if = mwifiex_cleanup_sdio, - .check_fw_status = mwifiex_check_fw_status, - .prog_fw = mwifiex_prog_fw_w_helper, - .register_dev = mwifiex_register_dev, - .unregister_dev = mwifiex_unregister_dev, - .enable_int = mwifiex_sdio_enable_host_int, - .process_int_status = mwifiex_process_int_status, - .host_to_card = mwifiex_sdio_host_to_card, - .wakeup = mwifiex_pm_wakeup_card, - .wakeup_complete = mwifiex_pm_wakeup_card_complete, - - /* SDIO specific */ - .update_mp_end_port = mwifiex_update_mp_end_port, - .cleanup_mpa_buf = mwifiex_cleanup_mpa_buf, - .cmdrsp_complete = mwifiex_sdio_cmdrsp_complete, - .event_complete = mwifiex_sdio_event_complete, - .card_reset = mwifiex_sdio_card_reset, -}; - -/* - * This function initializes the SDIO driver. - * - * This initiates the semaphore and registers the device with - * SDIO bus. - */ -static int -mwifiex_sdio_init_module(void) -{ - sema_init(&add_remove_card_sem, 1); - - /* Clear the flag in case user removes the card. */ - user_rmmod = 0; - - return sdio_register_driver(&mwifiex_sdio); -} - -/* - * This function cleans up the SDIO driver. - * - * The following major steps are followed for cleanup - - * - Resume the device if its suspended - * - Disconnect the device if connected - * - Shutdown the firmware - * - Unregister the device from SDIO bus. - */ -static void -mwifiex_sdio_cleanup_module(void) -{ - if (!down_interruptible(&add_remove_card_sem)) - up(&add_remove_card_sem); - - /* Set the flag as user is removing this module. */ - user_rmmod = 1; - - cancel_work_sync(&card_reset_work); - sdio_unregister_driver(&mwifiex_sdio); -} - -module_init(mwifiex_sdio_init_module); -module_exit(mwifiex_sdio_cleanup_module); - -MODULE_AUTHOR("Marvell International Ltd."); -MODULE_DESCRIPTION("Marvell WiFi-Ex SDIO Driver version " SDIO_VERSION); -MODULE_VERSION(SDIO_VERSION); -MODULE_LICENSE("GPL v2"); -MODULE_FIRMWARE(SD8786_DEFAULT_FW_NAME); -MODULE_FIRMWARE(SD8787_DEFAULT_FW_NAME); -MODULE_FIRMWARE(SD8797_DEFAULT_FW_NAME); diff --git a/drivers/net/wireless/mwifiex/sdio.h b/drivers/net/wireless/mwifiex/sdio.h deleted file mode 100644 index 8cc5468654b4..000000000000 --- a/drivers/net/wireless/mwifiex/sdio.h +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Marvell Wireless LAN device driver: SDIO specific definitions - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef _MWIFIEX_SDIO_H -#define _MWIFIEX_SDIO_H - - -#include -#include -#include -#include -#include - -#include "main.h" - -#define SD8786_DEFAULT_FW_NAME "mrvl/sd8786_uapsta.bin" -#define SD8787_DEFAULT_FW_NAME "mrvl/sd8787_uapsta.bin" -#define SD8797_DEFAULT_FW_NAME "mrvl/sd8797_uapsta.bin" - -#define BLOCK_MODE 1 -#define BYTE_MODE 0 - -#define REG_PORT 0 -#define RD_BITMAP_L 0x04 -#define RD_BITMAP_U 0x05 -#define WR_BITMAP_L 0x06 -#define WR_BITMAP_U 0x07 -#define RD_LEN_P0_L 0x08 -#define RD_LEN_P0_U 0x09 - -#define MWIFIEX_SDIO_IO_PORT_MASK 0xfffff - -#define MWIFIEX_SDIO_BYTE_MODE_MASK 0x80000000 - -#define CTRL_PORT 0 -#define CTRL_PORT_MASK 0x0001 -#define DATA_PORT_MASK 0xfffe - -#define MAX_MP_REGS 64 -#define MAX_PORT 16 - -#define SDIO_MP_AGGR_DEF_PKT_LIMIT 8 - -#define SDIO_MP_TX_AGGR_DEF_BUF_SIZE (8192) /* 8K */ - -/* Multi port RX aggregation buffer size */ -#define SDIO_MP_RX_AGGR_DEF_BUF_SIZE (16384) /* 16K */ - -/* Misc. Config Register : Auto Re-enable interrupts */ -#define AUTO_RE_ENABLE_INT BIT(4) - -/* Host Control Registers */ -/* Host Control Registers : I/O port 0 */ -#define IO_PORT_0_REG 0x78 -/* Host Control Registers : I/O port 1 */ -#define IO_PORT_1_REG 0x79 -/* Host Control Registers : I/O port 2 */ -#define IO_PORT_2_REG 0x7A - -/* Host Control Registers : Configuration */ -#define CONFIGURATION_REG 0x00 -/* Host Control Registers : Host without Command 53 finish host*/ -#define HOST_TO_CARD_EVENT (0x1U << 3) -/* Host Control Registers : Host without Command 53 finish host */ -#define HOST_WO_CMD53_FINISH_HOST (0x1U << 2) -/* Host Control Registers : Host power up */ -#define HOST_POWER_UP (0x1U << 1) -/* Host Control Registers : Host power down */ -#define HOST_POWER_DOWN (0x1U << 0) - -/* Host Control Registers : Host interrupt mask */ -#define HOST_INT_MASK_REG 0x02 -/* Host Control Registers : Upload host interrupt mask */ -#define UP_LD_HOST_INT_MASK (0x1U) -/* Host Control Registers : Download host interrupt mask */ -#define DN_LD_HOST_INT_MASK (0x2U) -/* Enable Host interrupt mask */ -#define HOST_INT_ENABLE (UP_LD_HOST_INT_MASK | DN_LD_HOST_INT_MASK) -/* Disable Host interrupt mask */ -#define HOST_INT_DISABLE 0xff - -/* Host Control Registers : Host interrupt status */ -#define HOST_INTSTATUS_REG 0x03 -/* Host Control Registers : Upload host interrupt status */ -#define UP_LD_HOST_INT_STATUS (0x1U) -/* Host Control Registers : Download host interrupt status */ -#define DN_LD_HOST_INT_STATUS (0x2U) - -/* Host Control Registers : Host interrupt RSR */ -#define HOST_INT_RSR_REG 0x01 -/* Host Control Registers : Upload host interrupt RSR */ -#define UP_LD_HOST_INT_RSR (0x1U) -#define SDIO_INT_MASK 0x3F - -/* Host Control Registers : Host interrupt status */ -#define HOST_INT_STATUS_REG 0x28 -/* Host Control Registers : Upload CRC error */ -#define UP_LD_CRC_ERR (0x1U << 2) -/* Host Control Registers : Upload restart */ -#define UP_LD_RESTART (0x1U << 1) -/* Host Control Registers : Download restart */ -#define DN_LD_RESTART (0x1U << 0) - -/* Card Control Registers : Card status register */ -#define CARD_STATUS_REG 0x30 -/* Card Control Registers : Card I/O ready */ -#define CARD_IO_READY (0x1U << 3) -/* Card Control Registers : CIS card ready */ -#define CIS_CARD_RDY (0x1U << 2) -/* Card Control Registers : Upload card ready */ -#define UP_LD_CARD_RDY (0x1U << 1) -/* Card Control Registers : Download card ready */ -#define DN_LD_CARD_RDY (0x1U << 0) - -/* Card Control Registers : Host interrupt mask register */ -#define HOST_INTERRUPT_MASK_REG 0x34 -/* Card Control Registers : Host power interrupt mask */ -#define HOST_POWER_INT_MASK (0x1U << 3) -/* Card Control Registers : Abort card interrupt mask */ -#define ABORT_CARD_INT_MASK (0x1U << 2) -/* Card Control Registers : Upload card interrupt mask */ -#define UP_LD_CARD_INT_MASK (0x1U << 1) -/* Card Control Registers : Download card interrupt mask */ -#define DN_LD_CARD_INT_MASK (0x1U << 0) - -/* Card Control Registers : Card interrupt status register */ -#define CARD_INTERRUPT_STATUS_REG 0x38 -/* Card Control Registers : Power up interrupt */ -#define POWER_UP_INT (0x1U << 4) -/* Card Control Registers : Power down interrupt */ -#define POWER_DOWN_INT (0x1U << 3) - -/* Card Control Registers : Card interrupt RSR register */ -#define CARD_INTERRUPT_RSR_REG 0x3c -/* Card Control Registers : Power up RSR */ -#define POWER_UP_RSR (0x1U << 4) -/* Card Control Registers : Power down RSR */ -#define POWER_DOWN_RSR (0x1U << 3) - -/* Card Control Registers : Miscellaneous Configuration Register */ -#define CARD_MISC_CFG_REG 0x6C - -/* Host F1 read base 0 */ -#define HOST_F1_RD_BASE_0 0x0040 -/* Host F1 read base 1 */ -#define HOST_F1_RD_BASE_1 0x0041 -/* Host F1 card ready */ -#define HOST_F1_CARD_RDY 0x0020 - -/* Firmware status 0 register */ -#define CARD_FW_STATUS0_REG 0x60 -/* Firmware status 1 register */ -#define CARD_FW_STATUS1_REG 0x61 -/* Rx length register */ -#define CARD_RX_LEN_REG 0x62 -/* Rx unit register */ -#define CARD_RX_UNIT_REG 0x63 - -/* Max retry number of CMD53 write */ -#define MAX_WRITE_IOMEM_RETRY 2 - -/* SDIO Tx aggregation in progress ? */ -#define MP_TX_AGGR_IN_PROGRESS(a) (a->mpa_tx.pkt_cnt > 0) - -/* SDIO Tx aggregation buffer room for next packet ? */ -#define MP_TX_AGGR_BUF_HAS_ROOM(a, len) ((a->mpa_tx.buf_len+len) \ - <= a->mpa_tx.buf_size) - -/* Copy current packet (SDIO Tx aggregation buffer) to SDIO buffer */ -#define MP_TX_AGGR_BUF_PUT(a, payload, pkt_len, port) do { \ - memmove(&a->mpa_tx.buf[a->mpa_tx.buf_len], \ - payload, pkt_len); \ - a->mpa_tx.buf_len += pkt_len; \ - if (!a->mpa_tx.pkt_cnt) \ - a->mpa_tx.start_port = port; \ - if (a->mpa_tx.start_port <= port) \ - a->mpa_tx.ports |= (1<<(a->mpa_tx.pkt_cnt)); \ - else \ - a->mpa_tx.ports |= (1<<(a->mpa_tx.pkt_cnt+1+(MAX_PORT - \ - a->mp_end_port))); \ - a->mpa_tx.pkt_cnt++; \ -} while (0) - -/* SDIO Tx aggregation limit ? */ -#define MP_TX_AGGR_PKT_LIMIT_REACHED(a) \ - (a->mpa_tx.pkt_cnt == a->mpa_tx.pkt_aggr_limit) - -/* SDIO Tx aggregation port limit ? */ -#define MP_TX_AGGR_PORT_LIMIT_REACHED(a) ((a->curr_wr_port < \ - a->mpa_tx.start_port) && (((MAX_PORT - \ - a->mpa_tx.start_port) + a->curr_wr_port) >= \ - SDIO_MP_AGGR_DEF_PKT_LIMIT)) - -/* Reset SDIO Tx aggregation buffer parameters */ -#define MP_TX_AGGR_BUF_RESET(a) do { \ - a->mpa_tx.pkt_cnt = 0; \ - a->mpa_tx.buf_len = 0; \ - a->mpa_tx.ports = 0; \ - a->mpa_tx.start_port = 0; \ -} while (0) - -/* SDIO Rx aggregation limit ? */ -#define MP_RX_AGGR_PKT_LIMIT_REACHED(a) \ - (a->mpa_rx.pkt_cnt == a->mpa_rx.pkt_aggr_limit) - -/* SDIO Tx aggregation port limit ? */ -#define MP_RX_AGGR_PORT_LIMIT_REACHED(a) ((a->curr_rd_port < \ - a->mpa_rx.start_port) && (((MAX_PORT - \ - a->mpa_rx.start_port) + a->curr_rd_port) >= \ - SDIO_MP_AGGR_DEF_PKT_LIMIT)) - -/* SDIO Rx aggregation in progress ? */ -#define MP_RX_AGGR_IN_PROGRESS(a) (a->mpa_rx.pkt_cnt > 0) - -/* SDIO Rx aggregation buffer room for next packet ? */ -#define MP_RX_AGGR_BUF_HAS_ROOM(a, rx_len) \ - ((a->mpa_rx.buf_len+rx_len) <= a->mpa_rx.buf_size) - -/* Prepare to copy current packet from card to SDIO Rx aggregation buffer */ -#define MP_RX_AGGR_SETUP(a, skb, port) do { \ - a->mpa_rx.buf_len += skb->len; \ - if (!a->mpa_rx.pkt_cnt) \ - a->mpa_rx.start_port = port; \ - if (a->mpa_rx.start_port <= port) \ - a->mpa_rx.ports |= (1<<(a->mpa_rx.pkt_cnt)); \ - else \ - a->mpa_rx.ports |= (1<<(a->mpa_rx.pkt_cnt+1)); \ - a->mpa_rx.skb_arr[a->mpa_rx.pkt_cnt] = skb; \ - a->mpa_rx.len_arr[a->mpa_rx.pkt_cnt] = skb->len; \ - a->mpa_rx.pkt_cnt++; \ -} while (0) - -/* Reset SDIO Rx aggregation buffer parameters */ -#define MP_RX_AGGR_BUF_RESET(a) do { \ - a->mpa_rx.pkt_cnt = 0; \ - a->mpa_rx.buf_len = 0; \ - a->mpa_rx.ports = 0; \ - a->mpa_rx.start_port = 0; \ -} while (0) - - -/* data structure for SDIO MPA TX */ -struct mwifiex_sdio_mpa_tx { - /* multiport tx aggregation buffer pointer */ - u8 *buf; - u32 buf_len; - u32 pkt_cnt; - u16 ports; - u16 start_port; - u8 enabled; - u32 buf_size; - u32 pkt_aggr_limit; -}; - -struct mwifiex_sdio_mpa_rx { - u8 *buf; - u32 buf_len; - u32 pkt_cnt; - u16 ports; - u16 start_port; - - struct sk_buff *skb_arr[SDIO_MP_AGGR_DEF_PKT_LIMIT]; - u32 len_arr[SDIO_MP_AGGR_DEF_PKT_LIMIT]; - - u8 enabled; - u32 buf_size; - u32 pkt_aggr_limit; -}; - -int mwifiex_bus_register(void); -void mwifiex_bus_unregister(void); - -struct sdio_mmc_card { - struct sdio_func *func; - struct mwifiex_adapter *adapter; - - u16 mp_rd_bitmap; - u16 mp_wr_bitmap; - - u16 mp_end_port; - u16 mp_data_port_mask; - - u8 curr_rd_port; - u8 curr_wr_port; - - u8 *mp_regs; - - struct mwifiex_sdio_mpa_tx mpa_tx; - struct mwifiex_sdio_mpa_rx mpa_rx; -}; - -/* - * .cmdrsp_complete handler - */ -static inline int mwifiex_sdio_cmdrsp_complete(struct mwifiex_adapter *adapter, - struct sk_buff *skb) -{ - dev_kfree_skb_any(skb); - return 0; -} - -/* - * .event_complete handler - */ -static inline int mwifiex_sdio_event_complete(struct mwifiex_adapter *adapter, - struct sk_buff *skb) -{ - dev_kfree_skb_any(skb); - return 0; -} - -#endif /* _MWIFIEX_SDIO_H */ diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c deleted file mode 100644 index b193e25977d2..000000000000 --- a/drivers/net/wireless/mwifiex/sta_cmd.c +++ /dev/null @@ -1,1507 +0,0 @@ -/* - * Marvell Wireless LAN device driver: station command handling - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" -#include "11n.h" -#include "11ac.h" - -/* - * This function prepares command to set/get RSSI information. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting data/beacon average factors - * - Resetting SNR/NF/RSSI values in private structure - * - Ensuring correct endian-ness - */ -static int -mwifiex_cmd_802_11_rssi_info(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, u16 cmd_action) -{ - cmd->command = cpu_to_le16(HostCmd_CMD_RSSI_INFO); - cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_rssi_info) + - S_DS_GEN); - cmd->params.rssi_info.action = cpu_to_le16(cmd_action); - cmd->params.rssi_info.ndata = cpu_to_le16(priv->data_avg_factor); - cmd->params.rssi_info.nbcn = cpu_to_le16(priv->bcn_avg_factor); - - /* Reset SNR/NF/RSSI values in private structure */ - priv->data_rssi_last = 0; - priv->data_nf_last = 0; - priv->data_rssi_avg = 0; - priv->data_nf_avg = 0; - priv->bcn_rssi_last = 0; - priv->bcn_nf_last = 0; - priv->bcn_rssi_avg = 0; - priv->bcn_nf_avg = 0; - - return 0; -} - -/* - * This function prepares command to set MAC control. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Ensuring correct endian-ness - */ -static int mwifiex_cmd_mac_control(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - u16 cmd_action, u16 *action) -{ - struct host_cmd_ds_mac_control *mac_ctrl = &cmd->params.mac_ctrl; - - if (cmd_action != HostCmd_ACT_GEN_SET) { - dev_err(priv->adapter->dev, - "mac_control: only support set cmd\n"); - return -1; - } - - cmd->command = cpu_to_le16(HostCmd_CMD_MAC_CONTROL); - cmd->size = - cpu_to_le16(sizeof(struct host_cmd_ds_mac_control) + S_DS_GEN); - mac_ctrl->action = cpu_to_le16(*action); - - return 0; -} - -/* - * This function prepares command to set/get SNMP MIB. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting SNMP MIB OID number and value - * (as required) - * - Ensuring correct endian-ness - * - * The following SNMP MIB OIDs are supported - - * - FRAG_THRESH_I : Fragmentation threshold - * - RTS_THRESH_I : RTS threshold - * - SHORT_RETRY_LIM_I : Short retry limit - * - DOT11D_I : 11d support - */ -static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - u16 cmd_action, u32 cmd_oid, - u16 *ul_temp) -{ - struct host_cmd_ds_802_11_snmp_mib *snmp_mib = &cmd->params.smib; - - dev_dbg(priv->adapter->dev, "cmd: SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid); - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_SNMP_MIB); - cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_snmp_mib) - - 1 + S_DS_GEN); - - snmp_mib->oid = cpu_to_le16((u16)cmd_oid); - if (cmd_action == HostCmd_ACT_GEN_GET) { - snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_GET); - snmp_mib->buf_size = cpu_to_le16(MAX_SNMP_BUF_SIZE); - le16_add_cpu(&cmd->size, MAX_SNMP_BUF_SIZE); - } else if (cmd_action == HostCmd_ACT_GEN_SET) { - snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_SET); - snmp_mib->buf_size = cpu_to_le16(sizeof(u16)); - *((__le16 *) (snmp_mib->value)) = cpu_to_le16(*ul_temp); - le16_add_cpu(&cmd->size, sizeof(u16)); - } - - dev_dbg(priv->adapter->dev, - "cmd: SNMP_CMD: Action=0x%x, OID=0x%x, OIDSize=0x%x," - " Value=0x%x\n", - cmd_action, cmd_oid, le16_to_cpu(snmp_mib->buf_size), - le16_to_cpu(*(__le16 *) snmp_mib->value)); - return 0; -} - -/* - * This function prepares command to get log. - * - * Preparation includes - - * - Setting command ID and proper size - * - Ensuring correct endian-ness - */ -static int -mwifiex_cmd_802_11_get_log(struct host_cmd_ds_command *cmd) -{ - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_GET_LOG); - cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_get_log) + - S_DS_GEN); - return 0; -} - -/* - * This function prepares command to set/get Tx data rate configuration. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting configuration index, rate scope and rate drop pattern - * parameters (as required) - * - Ensuring correct endian-ness - */ -static int mwifiex_cmd_tx_rate_cfg(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - u16 cmd_action, u16 *pbitmap_rates) -{ - struct host_cmd_ds_tx_rate_cfg *rate_cfg = &cmd->params.tx_rate_cfg; - struct mwifiex_rate_scope *rate_scope; - struct mwifiex_rate_drop_pattern *rate_drop; - u32 i; - - cmd->command = cpu_to_le16(HostCmd_CMD_TX_RATE_CFG); - - rate_cfg->action = cpu_to_le16(cmd_action); - rate_cfg->cfg_index = 0; - - rate_scope = (struct mwifiex_rate_scope *) ((u8 *) rate_cfg + - sizeof(struct host_cmd_ds_tx_rate_cfg)); - rate_scope->type = cpu_to_le16(TLV_TYPE_RATE_SCOPE); - rate_scope->length = cpu_to_le16 - (sizeof(*rate_scope) - sizeof(struct mwifiex_ie_types_header)); - if (pbitmap_rates != NULL) { - rate_scope->hr_dsss_rate_bitmap = cpu_to_le16(pbitmap_rates[0]); - rate_scope->ofdm_rate_bitmap = cpu_to_le16(pbitmap_rates[1]); - for (i = 0; - i < sizeof(rate_scope->ht_mcs_rate_bitmap) / sizeof(u16); - i++) - rate_scope->ht_mcs_rate_bitmap[i] = - cpu_to_le16(pbitmap_rates[2 + i]); - } else { - rate_scope->hr_dsss_rate_bitmap = - cpu_to_le16(priv->bitmap_rates[0]); - rate_scope->ofdm_rate_bitmap = - cpu_to_le16(priv->bitmap_rates[1]); - for (i = 0; - i < sizeof(rate_scope->ht_mcs_rate_bitmap) / sizeof(u16); - i++) - rate_scope->ht_mcs_rate_bitmap[i] = - cpu_to_le16(priv->bitmap_rates[2 + i]); - } - - rate_drop = (struct mwifiex_rate_drop_pattern *) ((u8 *) rate_scope + - sizeof(struct mwifiex_rate_scope)); - rate_drop->type = cpu_to_le16(TLV_TYPE_RATE_DROP_CONTROL); - rate_drop->length = cpu_to_le16(sizeof(rate_drop->rate_drop_mode)); - rate_drop->rate_drop_mode = 0; - - cmd->size = - cpu_to_le16(S_DS_GEN + sizeof(struct host_cmd_ds_tx_rate_cfg) + - sizeof(struct mwifiex_rate_scope) + - sizeof(struct mwifiex_rate_drop_pattern)); - - return 0; -} - -/* - * This function prepares command to set/get Tx power configuration. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting Tx power mode, power group TLV - * (as required) - * - Ensuring correct endian-ness - */ -static int mwifiex_cmd_tx_power_cfg(struct host_cmd_ds_command *cmd, - u16 cmd_action, - struct host_cmd_ds_txpwr_cfg *txp) -{ - struct mwifiex_types_power_group *pg_tlv; - struct host_cmd_ds_txpwr_cfg *cmd_txp_cfg = &cmd->params.txp_cfg; - - cmd->command = cpu_to_le16(HostCmd_CMD_TXPWR_CFG); - cmd->size = - cpu_to_le16(S_DS_GEN + sizeof(struct host_cmd_ds_txpwr_cfg)); - switch (cmd_action) { - case HostCmd_ACT_GEN_SET: - if (txp->mode) { - pg_tlv = (struct mwifiex_types_power_group - *) ((unsigned long) txp + - sizeof(struct host_cmd_ds_txpwr_cfg)); - memmove(cmd_txp_cfg, txp, - sizeof(struct host_cmd_ds_txpwr_cfg) + - sizeof(struct mwifiex_types_power_group) + - pg_tlv->length); - - pg_tlv = (struct mwifiex_types_power_group *) ((u8 *) - cmd_txp_cfg + - sizeof(struct host_cmd_ds_txpwr_cfg)); - cmd->size = cpu_to_le16(le16_to_cpu(cmd->size) + - sizeof(struct mwifiex_types_power_group) + - pg_tlv->length); - } else { - memmove(cmd_txp_cfg, txp, sizeof(*txp)); - } - cmd_txp_cfg->action = cpu_to_le16(cmd_action); - break; - case HostCmd_ACT_GEN_GET: - cmd_txp_cfg->action = cpu_to_le16(cmd_action); - break; - } - - return 0; -} - -/* - * This function prepares command to get RF Tx power. - */ -static int mwifiex_cmd_rf_tx_power(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - u16 cmd_action, void *data_buf) -{ - struct host_cmd_ds_rf_tx_pwr *txp = &cmd->params.txp; - - cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_rf_tx_pwr) - + S_DS_GEN); - cmd->command = cpu_to_le16(HostCmd_CMD_RF_TX_PWR); - txp->action = cpu_to_le16(cmd_action); - - return 0; -} - -/* - * This function prepares command to set rf antenna. - */ -static int mwifiex_cmd_rf_antenna(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - u16 cmd_action, - struct mwifiex_ds_ant_cfg *ant_cfg) -{ - struct host_cmd_ds_rf_ant_mimo *ant_mimo = &cmd->params.ant_mimo; - struct host_cmd_ds_rf_ant_siso *ant_siso = &cmd->params.ant_siso; - - cmd->command = cpu_to_le16(HostCmd_CMD_RF_ANTENNA); - - if (cmd_action != HostCmd_ACT_GEN_SET) - return 0; - - if (priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2) { - cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_rf_ant_mimo) + - S_DS_GEN); - ant_mimo->action_tx = cpu_to_le16(HostCmd_ACT_SET_TX); - ant_mimo->tx_ant_mode = cpu_to_le16((u16)ant_cfg->tx_ant); - ant_mimo->action_rx = cpu_to_le16(HostCmd_ACT_SET_RX); - ant_mimo->rx_ant_mode = cpu_to_le16((u16)ant_cfg->rx_ant); - } else { - cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_rf_ant_siso) + - S_DS_GEN); - ant_siso->action = cpu_to_le16(HostCmd_ACT_SET_BOTH); - ant_siso->ant_mode = cpu_to_le16((u16)ant_cfg->tx_ant); - } - - return 0; -} - -/* - * This function prepares command to set Host Sleep configuration. - * - * Preparation includes - - * - Setting command ID and proper size - * - Setting Host Sleep action, conditions, ARP filters - * (as required) - * - Ensuring correct endian-ness - */ -static int -mwifiex_cmd_802_11_hs_cfg(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - u16 cmd_action, - struct mwifiex_hs_config_param *hscfg_param) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct host_cmd_ds_802_11_hs_cfg_enh *hs_cfg = &cmd->params.opt_hs_cfg; - u16 hs_activate = false; - - if (!hscfg_param) - /* New Activate command */ - hs_activate = true; - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH); - - if (!hs_activate && - (hscfg_param->conditions != cpu_to_le32(HS_CFG_CANCEL)) && - ((adapter->arp_filter_size > 0) && - (adapter->arp_filter_size <= ARP_FILTER_MAX_BUF_SIZE))) { - dev_dbg(adapter->dev, - "cmd: Attach %d bytes ArpFilter to HSCfg cmd\n", - adapter->arp_filter_size); - memcpy(((u8 *) hs_cfg) + - sizeof(struct host_cmd_ds_802_11_hs_cfg_enh), - adapter->arp_filter, adapter->arp_filter_size); - cmd->size = cpu_to_le16 - (adapter->arp_filter_size + - sizeof(struct host_cmd_ds_802_11_hs_cfg_enh) - + S_DS_GEN); - } else { - cmd->size = cpu_to_le16(S_DS_GEN + sizeof(struct - host_cmd_ds_802_11_hs_cfg_enh)); - } - if (hs_activate) { - hs_cfg->action = cpu_to_le16(HS_ACTIVATE); - hs_cfg->params.hs_activate.resp_ctrl = RESP_NEEDED; - } else { - hs_cfg->action = cpu_to_le16(HS_CONFIGURE); - hs_cfg->params.hs_config.conditions = hscfg_param->conditions; - hs_cfg->params.hs_config.gpio = hscfg_param->gpio; - hs_cfg->params.hs_config.gap = hscfg_param->gap; - dev_dbg(adapter->dev, - "cmd: HS_CFG_CMD: condition:0x%x gpio:0x%x gap:0x%x\n", - hs_cfg->params.hs_config.conditions, - hs_cfg->params.hs_config.gpio, - hs_cfg->params.hs_config.gap); - } - - return 0; -} - -/* - * This function prepares command to set/get MAC address. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting MAC address (for SET only) - * - Ensuring correct endian-ness - */ -static int mwifiex_cmd_802_11_mac_address(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - u16 cmd_action) -{ - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_MAC_ADDRESS); - cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_mac_address) + - S_DS_GEN); - cmd->result = 0; - - cmd->params.mac_addr.action = cpu_to_le16(cmd_action); - - if (cmd_action == HostCmd_ACT_GEN_SET) - memcpy(cmd->params.mac_addr.mac_addr, priv->curr_addr, - ETH_ALEN); - return 0; -} - -/* - * This function prepares command to set MAC multicast address. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting MAC multicast address - * - Ensuring correct endian-ness - */ -static int -mwifiex_cmd_mac_multicast_adr(struct host_cmd_ds_command *cmd, - u16 cmd_action, - struct mwifiex_multicast_list *mcast_list) -{ - struct host_cmd_ds_mac_multicast_adr *mcast_addr = &cmd->params.mc_addr; - - cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_mac_multicast_adr) + - S_DS_GEN); - cmd->command = cpu_to_le16(HostCmd_CMD_MAC_MULTICAST_ADR); - - mcast_addr->action = cpu_to_le16(cmd_action); - mcast_addr->num_of_adrs = - cpu_to_le16((u16) mcast_list->num_multicast_addr); - memcpy(mcast_addr->mac_list, mcast_list->mac_list, - mcast_list->num_multicast_addr * ETH_ALEN); - - return 0; -} - -/* - * This function prepares command to deauthenticate. - * - * Preparation includes - - * - Setting command ID and proper size - * - Setting AP MAC address and reason code - * - Ensuring correct endian-ness - */ -static int mwifiex_cmd_802_11_deauthenticate(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - u8 *mac) -{ - struct host_cmd_ds_802_11_deauthenticate *deauth = &cmd->params.deauth; - - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_DEAUTHENTICATE); - cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_deauthenticate) - + S_DS_GEN); - - /* Set AP MAC address */ - memcpy(deauth->mac_addr, mac, ETH_ALEN); - - dev_dbg(priv->adapter->dev, "cmd: Deauth: %pM\n", deauth->mac_addr); - - deauth->reason_code = cpu_to_le16(WLAN_REASON_DEAUTH_LEAVING); - - return 0; -} - -/* - * This function prepares command to stop Ad-Hoc network. - * - * Preparation includes - - * - Setting command ID and proper size - * - Ensuring correct endian-ness - */ -static int mwifiex_cmd_802_11_ad_hoc_stop(struct host_cmd_ds_command *cmd) -{ - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_AD_HOC_STOP); - cmd->size = cpu_to_le16(S_DS_GEN); - return 0; -} - -/* - * This function sets WEP key(s) to key parameter TLV(s). - * - * Multi-key parameter TLVs are supported, so we can send multiple - * WEP keys in a single buffer. - */ -static int -mwifiex_set_keyparamset_wep(struct mwifiex_private *priv, - struct mwifiex_ie_type_key_param_set *key_param_set, - u16 *key_param_len) -{ - int cur_key_param_len; - u8 i; - - /* Multi-key_param_set TLV is supported */ - for (i = 0; i < NUM_WEP_KEYS; i++) { - if ((priv->wep_key[i].key_length == WLAN_KEY_LEN_WEP40) || - (priv->wep_key[i].key_length == WLAN_KEY_LEN_WEP104)) { - key_param_set->type = - cpu_to_le16(TLV_TYPE_KEY_MATERIAL); -/* Key_param_set WEP fixed length */ -#define KEYPARAMSET_WEP_FIXED_LEN 8 - key_param_set->length = cpu_to_le16((u16) - (priv->wep_key[i]. - key_length + - KEYPARAMSET_WEP_FIXED_LEN)); - key_param_set->key_type_id = - cpu_to_le16(KEY_TYPE_ID_WEP); - key_param_set->key_info = - cpu_to_le16(KEY_ENABLED | KEY_UNICAST | - KEY_MCAST); - key_param_set->key_len = - cpu_to_le16(priv->wep_key[i].key_length); - /* Set WEP key index */ - key_param_set->key[0] = i; - /* Set default Tx key flag */ - if (i == - (priv-> - wep_key_curr_index & HostCmd_WEP_KEY_INDEX_MASK)) - key_param_set->key[1] = 1; - else - key_param_set->key[1] = 0; - memmove(&key_param_set->key[2], - priv->wep_key[i].key_material, - priv->wep_key[i].key_length); - - cur_key_param_len = priv->wep_key[i].key_length + - KEYPARAMSET_WEP_FIXED_LEN + - sizeof(struct mwifiex_ie_types_header); - *key_param_len += (u16) cur_key_param_len; - key_param_set = - (struct mwifiex_ie_type_key_param_set *) - ((u8 *)key_param_set + - cur_key_param_len); - } else if (!priv->wep_key[i].key_length) { - continue; - } else { - dev_err(priv->adapter->dev, - "key%d Length = %d is incorrect\n", - (i + 1), priv->wep_key[i].key_length); - return -1; - } - } - - return 0; -} - -/* - * This function prepares command to set/get/reset network key(s). - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting WEP keys, WAPI keys or WPA keys along with required - * encryption (TKIP, AES) (as required) - * - Ensuring correct endian-ness - */ -static int -mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - u16 cmd_action, u32 cmd_oid, - struct mwifiex_ds_encrypt_key *enc_key) -{ - struct host_cmd_ds_802_11_key_material *key_material = - &cmd->params.key_material; - struct host_cmd_tlv_mac_addr *tlv_mac; - u16 key_param_len = 0, cmd_size; - int ret = 0; - - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_KEY_MATERIAL); - key_material->action = cpu_to_le16(cmd_action); - - if (cmd_action == HostCmd_ACT_GEN_GET) { - cmd->size = - cpu_to_le16(sizeof(key_material->action) + S_DS_GEN); - return ret; - } - - if (!enc_key) { - memset(&key_material->key_param_set, 0, - (NUM_WEP_KEYS * - sizeof(struct mwifiex_ie_type_key_param_set))); - ret = mwifiex_set_keyparamset_wep(priv, - &key_material->key_param_set, - &key_param_len); - cmd->size = cpu_to_le16(key_param_len + - sizeof(key_material->action) + S_DS_GEN); - return ret; - } else - memset(&key_material->key_param_set, 0, - sizeof(struct mwifiex_ie_type_key_param_set)); - if (enc_key->is_wapi_key) { - dev_dbg(priv->adapter->dev, "info: Set WAPI Key\n"); - key_material->key_param_set.key_type_id = - cpu_to_le16(KEY_TYPE_ID_WAPI); - if (cmd_oid == KEY_INFO_ENABLED) - key_material->key_param_set.key_info = - cpu_to_le16(KEY_ENABLED); - else - key_material->key_param_set.key_info = - cpu_to_le16(!KEY_ENABLED); - - key_material->key_param_set.key[0] = enc_key->key_index; - if (!priv->sec_info.wapi_key_on) - key_material->key_param_set.key[1] = 1; - else - /* set 0 when re-key */ - key_material->key_param_set.key[1] = 0; - - if (!is_broadcast_ether_addr(enc_key->mac_addr)) { - /* WAPI pairwise key: unicast */ - key_material->key_param_set.key_info |= - cpu_to_le16(KEY_UNICAST); - } else { /* WAPI group key: multicast */ - key_material->key_param_set.key_info |= - cpu_to_le16(KEY_MCAST); - priv->sec_info.wapi_key_on = true; - } - - key_material->key_param_set.type = - cpu_to_le16(TLV_TYPE_KEY_MATERIAL); - key_material->key_param_set.key_len = - cpu_to_le16(WAPI_KEY_LEN); - memcpy(&key_material->key_param_set.key[2], - enc_key->key_material, enc_key->key_len); - memcpy(&key_material->key_param_set.key[2 + enc_key->key_len], - enc_key->pn, PN_LEN); - key_material->key_param_set.length = - cpu_to_le16(WAPI_KEY_LEN + KEYPARAMSET_FIXED_LEN); - - key_param_len = (WAPI_KEY_LEN + KEYPARAMSET_FIXED_LEN) + - sizeof(struct mwifiex_ie_types_header); - cmd->size = cpu_to_le16(sizeof(key_material->action) - + S_DS_GEN + key_param_len); - return ret; - } - if (enc_key->key_len == WLAN_KEY_LEN_CCMP) { - if (enc_key->is_igtk_key) { - dev_dbg(priv->adapter->dev, "cmd: CMAC_AES\n"); - key_material->key_param_set.key_type_id = - cpu_to_le16(KEY_TYPE_ID_AES_CMAC); - if (cmd_oid == KEY_INFO_ENABLED) - key_material->key_param_set.key_info = - cpu_to_le16(KEY_ENABLED); - else - key_material->key_param_set.key_info = - cpu_to_le16(!KEY_ENABLED); - - key_material->key_param_set.key_info |= - cpu_to_le16(KEY_IGTK); - } else { - dev_dbg(priv->adapter->dev, "cmd: WPA_AES\n"); - key_material->key_param_set.key_type_id = - cpu_to_le16(KEY_TYPE_ID_AES); - if (cmd_oid == KEY_INFO_ENABLED) - key_material->key_param_set.key_info = - cpu_to_le16(KEY_ENABLED); - else - key_material->key_param_set.key_info = - cpu_to_le16(!KEY_ENABLED); - - if (enc_key->key_index & MWIFIEX_KEY_INDEX_UNICAST) - /* AES pairwise key: unicast */ - key_material->key_param_set.key_info |= - cpu_to_le16(KEY_UNICAST); - else /* AES group key: multicast */ - key_material->key_param_set.key_info |= - cpu_to_le16(KEY_MCAST); - } - } else if (enc_key->key_len == WLAN_KEY_LEN_TKIP) { - dev_dbg(priv->adapter->dev, "cmd: WPA_TKIP\n"); - key_material->key_param_set.key_type_id = - cpu_to_le16(KEY_TYPE_ID_TKIP); - key_material->key_param_set.key_info = - cpu_to_le16(KEY_ENABLED); - - if (enc_key->key_index & MWIFIEX_KEY_INDEX_UNICAST) - /* TKIP pairwise key: unicast */ - key_material->key_param_set.key_info |= - cpu_to_le16(KEY_UNICAST); - else /* TKIP group key: multicast */ - key_material->key_param_set.key_info |= - cpu_to_le16(KEY_MCAST); - } - - if (key_material->key_param_set.key_type_id) { - key_material->key_param_set.type = - cpu_to_le16(TLV_TYPE_KEY_MATERIAL); - key_material->key_param_set.key_len = - cpu_to_le16((u16) enc_key->key_len); - memcpy(key_material->key_param_set.key, enc_key->key_material, - enc_key->key_len); - key_material->key_param_set.length = - cpu_to_le16((u16) enc_key->key_len + - KEYPARAMSET_FIXED_LEN); - - key_param_len = (u16)(enc_key->key_len + KEYPARAMSET_FIXED_LEN) - + sizeof(struct mwifiex_ie_types_header); - - if (le16_to_cpu(key_material->key_param_set.key_type_id) == - KEY_TYPE_ID_AES_CMAC) { - struct mwifiex_cmac_param *param = - (void *)key_material->key_param_set.key; - - memcpy(param->ipn, enc_key->pn, IGTK_PN_LEN); - memcpy(param->key, enc_key->key_material, - WLAN_KEY_LEN_AES_CMAC); - - key_param_len = sizeof(struct mwifiex_cmac_param); - key_material->key_param_set.key_len = - cpu_to_le16(key_param_len); - key_param_len += KEYPARAMSET_FIXED_LEN; - key_material->key_param_set.length = - cpu_to_le16(key_param_len); - key_param_len += sizeof(struct mwifiex_ie_types_header); - } - - cmd->size = cpu_to_le16(sizeof(key_material->action) + S_DS_GEN - + key_param_len); - - if (priv->bss_type == MWIFIEX_BSS_TYPE_UAP) { - tlv_mac = (void *)((u8 *)&key_material->key_param_set + - key_param_len); - tlv_mac->tlv.type = cpu_to_le16(TLV_TYPE_STA_MAC_ADDR); - tlv_mac->tlv.len = cpu_to_le16(ETH_ALEN); - memcpy(tlv_mac->mac_addr, enc_key->mac_addr, ETH_ALEN); - cmd_size = key_param_len + S_DS_GEN + - sizeof(key_material->action) + - sizeof(struct host_cmd_tlv_mac_addr); - } else { - cmd_size = key_param_len + S_DS_GEN + - sizeof(key_material->action); - } - cmd->size = cpu_to_le16(cmd_size); - } - - return ret; -} - -/* - * This function prepares command to set/get 11d domain information. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting domain information fields (for SET only) - * - Ensuring correct endian-ness - */ -static int mwifiex_cmd_802_11d_domain_info(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - u16 cmd_action) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct host_cmd_ds_802_11d_domain_info *domain_info = - &cmd->params.domain_info; - struct mwifiex_ietypes_domain_param_set *domain = - &domain_info->domain; - u8 no_of_triplet = adapter->domain_reg.no_of_triplet; - - dev_dbg(adapter->dev, "info: 11D: no_of_triplet=0x%x\n", no_of_triplet); - - cmd->command = cpu_to_le16(HostCmd_CMD_802_11D_DOMAIN_INFO); - domain_info->action = cpu_to_le16(cmd_action); - if (cmd_action == HostCmd_ACT_GEN_GET) { - cmd->size = cpu_to_le16(sizeof(domain_info->action) + S_DS_GEN); - return 0; - } - - /* Set domain info fields */ - domain->header.type = cpu_to_le16(WLAN_EID_COUNTRY); - memcpy(domain->country_code, adapter->domain_reg.country_code, - sizeof(domain->country_code)); - - domain->header.len = - cpu_to_le16((no_of_triplet * - sizeof(struct ieee80211_country_ie_triplet)) - + sizeof(domain->country_code)); - - if (no_of_triplet) { - memcpy(domain->triplet, adapter->domain_reg.triplet, - no_of_triplet * sizeof(struct - ieee80211_country_ie_triplet)); - - cmd->size = cpu_to_le16(sizeof(domain_info->action) + - le16_to_cpu(domain->header.len) + - sizeof(struct mwifiex_ie_types_header) - + S_DS_GEN); - } else { - cmd->size = cpu_to_le16(sizeof(domain_info->action) + S_DS_GEN); - } - - return 0; -} - -/* - * This function prepares command to set/get IBSS coalescing status. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting status to enable or disable (for SET only) - * - Ensuring correct endian-ness - */ -static int mwifiex_cmd_ibss_coalescing_status(struct host_cmd_ds_command *cmd, - u16 cmd_action, u16 *enable) -{ - struct host_cmd_ds_802_11_ibss_status *ibss_coal = - &(cmd->params.ibss_coalescing); - - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_IBSS_COALESCING_STATUS); - cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_ibss_status) + - S_DS_GEN); - cmd->result = 0; - ibss_coal->action = cpu_to_le16(cmd_action); - - switch (cmd_action) { - case HostCmd_ACT_GEN_SET: - if (enable) - ibss_coal->enable = cpu_to_le16(*enable); - else - ibss_coal->enable = 0; - break; - - /* In other case.. Nothing to do */ - case HostCmd_ACT_GEN_GET: - default: - break; - } - - return 0; -} - -/* - * This function prepares command to set/get register value. - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting register offset (for both GET and SET) and - * register value (for SET only) - * - Ensuring correct endian-ness - * - * The following type of registers can be accessed with this function - - * - MAC register - * - BBP register - * - RF register - * - PMIC register - * - CAU register - * - EEPROM - */ -static int mwifiex_cmd_reg_access(struct host_cmd_ds_command *cmd, - u16 cmd_action, void *data_buf) -{ - struct mwifiex_ds_reg_rw *reg_rw = data_buf; - - switch (le16_to_cpu(cmd->command)) { - case HostCmd_CMD_MAC_REG_ACCESS: - { - struct host_cmd_ds_mac_reg_access *mac_reg; - - cmd->size = cpu_to_le16(sizeof(*mac_reg) + S_DS_GEN); - mac_reg = &cmd->params.mac_reg; - mac_reg->action = cpu_to_le16(cmd_action); - mac_reg->offset = - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); - mac_reg->value = reg_rw->value; - break; - } - case HostCmd_CMD_BBP_REG_ACCESS: - { - struct host_cmd_ds_bbp_reg_access *bbp_reg; - - cmd->size = cpu_to_le16(sizeof(*bbp_reg) + S_DS_GEN); - bbp_reg = &cmd->params.bbp_reg; - bbp_reg->action = cpu_to_le16(cmd_action); - bbp_reg->offset = - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); - bbp_reg->value = (u8) le32_to_cpu(reg_rw->value); - break; - } - case HostCmd_CMD_RF_REG_ACCESS: - { - struct host_cmd_ds_rf_reg_access *rf_reg; - - cmd->size = cpu_to_le16(sizeof(*rf_reg) + S_DS_GEN); - rf_reg = &cmd->params.rf_reg; - rf_reg->action = cpu_to_le16(cmd_action); - rf_reg->offset = cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); - rf_reg->value = (u8) le32_to_cpu(reg_rw->value); - break; - } - case HostCmd_CMD_PMIC_REG_ACCESS: - { - struct host_cmd_ds_pmic_reg_access *pmic_reg; - - cmd->size = cpu_to_le16(sizeof(*pmic_reg) + S_DS_GEN); - pmic_reg = &cmd->params.pmic_reg; - pmic_reg->action = cpu_to_le16(cmd_action); - pmic_reg->offset = - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); - pmic_reg->value = (u8) le32_to_cpu(reg_rw->value); - break; - } - case HostCmd_CMD_CAU_REG_ACCESS: - { - struct host_cmd_ds_rf_reg_access *cau_reg; - - cmd->size = cpu_to_le16(sizeof(*cau_reg) + S_DS_GEN); - cau_reg = &cmd->params.rf_reg; - cau_reg->action = cpu_to_le16(cmd_action); - cau_reg->offset = - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); - cau_reg->value = (u8) le32_to_cpu(reg_rw->value); - break; - } - case HostCmd_CMD_802_11_EEPROM_ACCESS: - { - struct mwifiex_ds_read_eeprom *rd_eeprom = data_buf; - struct host_cmd_ds_802_11_eeprom_access *cmd_eeprom = - &cmd->params.eeprom; - - cmd->size = cpu_to_le16(sizeof(*cmd_eeprom) + S_DS_GEN); - cmd_eeprom->action = cpu_to_le16(cmd_action); - cmd_eeprom->offset = rd_eeprom->offset; - cmd_eeprom->byte_count = rd_eeprom->byte_count; - cmd_eeprom->value = 0; - break; - } - default: - return -1; - } - - return 0; -} - -/* - * This function prepares command to set PCI-Express - * host buffer configuration - * - * Preparation includes - - * - Setting command ID, action and proper size - * - Setting host buffer configuration - * - Ensuring correct endian-ness - */ -static int -mwifiex_cmd_pcie_host_spec(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, u16 action) -{ - struct host_cmd_ds_pcie_details *host_spec = - &cmd->params.pcie_host_spec; - struct pcie_service_card *card = priv->adapter->card; - - cmd->command = cpu_to_le16(HostCmd_CMD_PCIE_DESC_DETAILS); - cmd->size = cpu_to_le16(sizeof(struct - host_cmd_ds_pcie_details) + S_DS_GEN); - cmd->result = 0; - - memset(host_spec, 0, sizeof(struct host_cmd_ds_pcie_details)); - - if (action != HostCmd_ACT_GEN_SET) - return 0; - - /* Send the ring base addresses and count to firmware */ - host_spec->txbd_addr_lo = (u32)(card->txbd_ring_pbase); - host_spec->txbd_addr_hi = (u32)(((u64)card->txbd_ring_pbase)>>32); - host_spec->txbd_count = MWIFIEX_MAX_TXRX_BD; - host_spec->rxbd_addr_lo = (u32)(card->rxbd_ring_pbase); - host_spec->rxbd_addr_hi = (u32)(((u64)card->rxbd_ring_pbase)>>32); - host_spec->rxbd_count = MWIFIEX_MAX_TXRX_BD; - host_spec->evtbd_addr_lo = (u32)(card->evtbd_ring_pbase); - host_spec->evtbd_addr_hi = (u32)(((u64)card->evtbd_ring_pbase)>>32); - host_spec->evtbd_count = MWIFIEX_MAX_EVT_BD; - if (card->sleep_cookie_vbase) { - host_spec->sleep_cookie_addr_lo = - (u32)(card->sleep_cookie_pbase); - host_spec->sleep_cookie_addr_hi = - (u32)(((u64)(card->sleep_cookie_pbase)) >> 32); - dev_dbg(priv->adapter->dev, "sleep_cook_lo phy addr: 0x%x\n", - host_spec->sleep_cookie_addr_lo); - } - - return 0; -} - -/* - * This function prepares command for event subscription, configuration - * and query. Events can be subscribed or unsubscribed. Current subscribed - * events can be queried. Also, current subscribed events are reported in - * every FW response. - */ -static int -mwifiex_cmd_802_11_subsc_evt(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - struct mwifiex_ds_misc_subsc_evt *subsc_evt_cfg) -{ - struct host_cmd_ds_802_11_subsc_evt *subsc_evt = &cmd->params.subsc_evt; - struct mwifiex_ie_types_rssi_threshold *rssi_tlv; - u16 event_bitmap; - u8 *pos; - - cmd->command = cpu_to_le16(HostCmd_CMD_802_11_SUBSCRIBE_EVENT); - cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_subsc_evt) + - S_DS_GEN); - - subsc_evt->action = cpu_to_le16(subsc_evt_cfg->action); - dev_dbg(priv->adapter->dev, "cmd: action: %d\n", subsc_evt_cfg->action); - - /*For query requests, no configuration TLV structures are to be added.*/ - if (subsc_evt_cfg->action == HostCmd_ACT_GEN_GET) - return 0; - - subsc_evt->events = cpu_to_le16(subsc_evt_cfg->events); - - event_bitmap = subsc_evt_cfg->events; - dev_dbg(priv->adapter->dev, "cmd: event bitmap : %16x\n", - event_bitmap); - - if (((subsc_evt_cfg->action == HostCmd_ACT_BITWISE_CLR) || - (subsc_evt_cfg->action == HostCmd_ACT_BITWISE_SET)) && - (event_bitmap == 0)) { - dev_dbg(priv->adapter->dev, "Error: No event specified " - "for bitwise action type\n"); - return -EINVAL; - } - - /* - * Append TLV structures for each of the specified events for - * subscribing or re-configuring. This is not required for - * bitwise unsubscribing request. - */ - if (subsc_evt_cfg->action == HostCmd_ACT_BITWISE_CLR) - return 0; - - pos = ((u8 *)subsc_evt) + - sizeof(struct host_cmd_ds_802_11_subsc_evt); - - if (event_bitmap & BITMASK_BCN_RSSI_LOW) { - rssi_tlv = (struct mwifiex_ie_types_rssi_threshold *) pos; - - rssi_tlv->header.type = cpu_to_le16(TLV_TYPE_RSSI_LOW); - rssi_tlv->header.len = - cpu_to_le16(sizeof(struct mwifiex_ie_types_rssi_threshold) - - sizeof(struct mwifiex_ie_types_header)); - rssi_tlv->abs_value = subsc_evt_cfg->bcn_l_rssi_cfg.abs_value; - rssi_tlv->evt_freq = subsc_evt_cfg->bcn_l_rssi_cfg.evt_freq; - - dev_dbg(priv->adapter->dev, "Cfg Beacon Low Rssi event, " - "RSSI:-%d dBm, Freq:%d\n", - subsc_evt_cfg->bcn_l_rssi_cfg.abs_value, - subsc_evt_cfg->bcn_l_rssi_cfg.evt_freq); - - pos += sizeof(struct mwifiex_ie_types_rssi_threshold); - le16_add_cpu(&cmd->size, - sizeof(struct mwifiex_ie_types_rssi_threshold)); - } - - if (event_bitmap & BITMASK_BCN_RSSI_HIGH) { - rssi_tlv = (struct mwifiex_ie_types_rssi_threshold *) pos; - - rssi_tlv->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH); - rssi_tlv->header.len = - cpu_to_le16(sizeof(struct mwifiex_ie_types_rssi_threshold) - - sizeof(struct mwifiex_ie_types_header)); - rssi_tlv->abs_value = subsc_evt_cfg->bcn_h_rssi_cfg.abs_value; - rssi_tlv->evt_freq = subsc_evt_cfg->bcn_h_rssi_cfg.evt_freq; - - dev_dbg(priv->adapter->dev, "Cfg Beacon High Rssi event, " - "RSSI:-%d dBm, Freq:%d\n", - subsc_evt_cfg->bcn_h_rssi_cfg.abs_value, - subsc_evt_cfg->bcn_h_rssi_cfg.evt_freq); - - pos += sizeof(struct mwifiex_ie_types_rssi_threshold); - le16_add_cpu(&cmd->size, - sizeof(struct mwifiex_ie_types_rssi_threshold)); - } - - return 0; -} - -static int -mwifiex_cmd_append_rpn_expression(struct mwifiex_private *priv, - struct mwifiex_mef_entry *mef_entry, - u8 **buffer) -{ - struct mwifiex_mef_filter *filter = mef_entry->filter; - int i, byte_len; - u8 *stack_ptr = *buffer; - - for (i = 0; i < MWIFIEX_MAX_FILTERS; i++) { - filter = &mef_entry->filter[i]; - if (!filter->filt_type) - break; - *(__le32 *)stack_ptr = cpu_to_le32((u32)filter->repeat); - stack_ptr += 4; - *stack_ptr = TYPE_DNUM; - stack_ptr += 1; - - byte_len = filter->byte_seq[MAX_BYTESEQ]; - memcpy(stack_ptr, filter->byte_seq, byte_len); - stack_ptr += byte_len; - *stack_ptr = byte_len; - stack_ptr += 1; - *stack_ptr = TYPE_BYTESEQ; - stack_ptr += 1; - - *(__le32 *)stack_ptr = cpu_to_le32((u32)filter->offset); - stack_ptr += 4; - *stack_ptr = TYPE_DNUM; - stack_ptr += 1; - - *stack_ptr = filter->filt_type; - stack_ptr += 1; - - if (filter->filt_action) { - *stack_ptr = filter->filt_action; - stack_ptr += 1; - } - - if (stack_ptr - *buffer > STACK_NBYTES) - return -1; - } - - *buffer = stack_ptr; - return 0; -} - -static int -mwifiex_cmd_mef_cfg(struct mwifiex_private *priv, - struct host_cmd_ds_command *cmd, - struct mwifiex_ds_mef_cfg *mef) -{ - struct host_cmd_ds_mef_cfg *mef_cfg = &cmd->params.mef_cfg; - u8 *pos = (u8 *)mef_cfg; - - cmd->command = cpu_to_le16(HostCmd_CMD_MEF_CFG); - - mef_cfg->criteria = cpu_to_le32(mef->criteria); - mef_cfg->num_entries = cpu_to_le16(mef->num_entries); - pos += sizeof(*mef_cfg); - mef_cfg->mef_entry->mode = mef->mef_entry->mode; - mef_cfg->mef_entry->action = mef->mef_entry->action; - pos += sizeof(*(mef_cfg->mef_entry)); - - if (mwifiex_cmd_append_rpn_expression(priv, mef->mef_entry, &pos)) - return -1; - - mef_cfg->mef_entry->exprsize = - cpu_to_le16(pos - mef_cfg->mef_entry->expr); - cmd->size = cpu_to_le16((u16) (pos - (u8 *)mef_cfg) + S_DS_GEN); - - return 0; -} - -/* - * This function prepares the commands before sending them to the firmware. - * - * This is a generic function which calls specific command preparation - * routines based upon the command number. - */ -int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no, - u16 cmd_action, u32 cmd_oid, - void *data_buf, void *cmd_buf) -{ - struct host_cmd_ds_command *cmd_ptr = cmd_buf; - int ret = 0; - - /* Prepare command */ - switch (cmd_no) { - case HostCmd_CMD_GET_HW_SPEC: - ret = mwifiex_cmd_get_hw_spec(priv, cmd_ptr); - break; - case HostCmd_CMD_MAC_CONTROL: - ret = mwifiex_cmd_mac_control(priv, cmd_ptr, cmd_action, - data_buf); - break; - case HostCmd_CMD_802_11_MAC_ADDRESS: - ret = mwifiex_cmd_802_11_mac_address(priv, cmd_ptr, - cmd_action); - break; - case HostCmd_CMD_MAC_MULTICAST_ADR: - ret = mwifiex_cmd_mac_multicast_adr(cmd_ptr, cmd_action, - data_buf); - break; - case HostCmd_CMD_TX_RATE_CFG: - ret = mwifiex_cmd_tx_rate_cfg(priv, cmd_ptr, cmd_action, - data_buf); - break; - case HostCmd_CMD_TXPWR_CFG: - ret = mwifiex_cmd_tx_power_cfg(cmd_ptr, cmd_action, - data_buf); - break; - case HostCmd_CMD_RF_TX_PWR: - ret = mwifiex_cmd_rf_tx_power(priv, cmd_ptr, cmd_action, - data_buf); - break; - case HostCmd_CMD_RF_ANTENNA: - ret = mwifiex_cmd_rf_antenna(priv, cmd_ptr, cmd_action, - data_buf); - break; - case HostCmd_CMD_802_11_PS_MODE_ENH: - ret = mwifiex_cmd_enh_power_mode(priv, cmd_ptr, cmd_action, - (uint16_t)cmd_oid, data_buf); - break; - case HostCmd_CMD_802_11_HS_CFG_ENH: - ret = mwifiex_cmd_802_11_hs_cfg(priv, cmd_ptr, cmd_action, - (struct mwifiex_hs_config_param *) data_buf); - break; - case HostCmd_CMD_802_11_SCAN: - ret = mwifiex_cmd_802_11_scan(cmd_ptr, data_buf); - break; - case HostCmd_CMD_802_11_BG_SCAN_QUERY: - ret = mwifiex_cmd_802_11_bg_scan_query(cmd_ptr); - break; - case HostCmd_CMD_802_11_ASSOCIATE: - ret = mwifiex_cmd_802_11_associate(priv, cmd_ptr, data_buf); - break; - case HostCmd_CMD_802_11_DEAUTHENTICATE: - ret = mwifiex_cmd_802_11_deauthenticate(priv, cmd_ptr, - data_buf); - break; - case HostCmd_CMD_802_11_AD_HOC_START: - ret = mwifiex_cmd_802_11_ad_hoc_start(priv, cmd_ptr, - data_buf); - break; - case HostCmd_CMD_802_11_GET_LOG: - ret = mwifiex_cmd_802_11_get_log(cmd_ptr); - break; - case HostCmd_CMD_802_11_AD_HOC_JOIN: - ret = mwifiex_cmd_802_11_ad_hoc_join(priv, cmd_ptr, - data_buf); - break; - case HostCmd_CMD_802_11_AD_HOC_STOP: - ret = mwifiex_cmd_802_11_ad_hoc_stop(cmd_ptr); - break; - case HostCmd_CMD_RSSI_INFO: - ret = mwifiex_cmd_802_11_rssi_info(priv, cmd_ptr, cmd_action); - break; - case HostCmd_CMD_802_11_SNMP_MIB: - ret = mwifiex_cmd_802_11_snmp_mib(priv, cmd_ptr, cmd_action, - cmd_oid, data_buf); - break; - case HostCmd_CMD_802_11_TX_RATE_QUERY: - cmd_ptr->command = - cpu_to_le16(HostCmd_CMD_802_11_TX_RATE_QUERY); - cmd_ptr->size = - cpu_to_le16(sizeof(struct host_cmd_ds_tx_rate_query) + - S_DS_GEN); - priv->tx_rate = 0; - ret = 0; - break; - case HostCmd_CMD_VERSION_EXT: - cmd_ptr->command = cpu_to_le16(cmd_no); - cmd_ptr->params.verext.version_str_sel = - (u8) (*((u32 *) data_buf)); - memcpy(&cmd_ptr->params, data_buf, - sizeof(struct host_cmd_ds_version_ext)); - cmd_ptr->size = - cpu_to_le16(sizeof(struct host_cmd_ds_version_ext) + - S_DS_GEN); - ret = 0; - break; - case HostCmd_CMD_MGMT_FRAME_REG: - cmd_ptr->command = cpu_to_le16(cmd_no); - cmd_ptr->params.reg_mask.action = cpu_to_le16(cmd_action); - cmd_ptr->params.reg_mask.mask = cpu_to_le32(*(u32 *)data_buf); - cmd_ptr->size = - cpu_to_le16(sizeof(struct host_cmd_ds_mgmt_frame_reg) + - S_DS_GEN); - ret = 0; - break; - case HostCmd_CMD_REMAIN_ON_CHAN: - cmd_ptr->command = cpu_to_le16(cmd_no); - memcpy(&cmd_ptr->params, data_buf, - sizeof(struct host_cmd_ds_remain_on_chan)); - cmd_ptr->size = - cpu_to_le16(sizeof(struct host_cmd_ds_remain_on_chan) + - S_DS_GEN); - break; - case HostCmd_CMD_11AC_CFG: - ret = mwifiex_cmd_11ac_cfg(priv, cmd_ptr, cmd_action, data_buf); - break; - case HostCmd_CMD_P2P_MODE_CFG: - cmd_ptr->command = cpu_to_le16(cmd_no); - cmd_ptr->params.mode_cfg.action = cpu_to_le16(cmd_action); - cmd_ptr->params.mode_cfg.mode = cpu_to_le16(*(u16 *)data_buf); - cmd_ptr->size = - cpu_to_le16(sizeof(struct host_cmd_ds_p2p_mode_cfg) + - S_DS_GEN); - break; - case HostCmd_CMD_FUNC_INIT: - if (priv->adapter->hw_status == MWIFIEX_HW_STATUS_RESET) - priv->adapter->hw_status = MWIFIEX_HW_STATUS_READY; - cmd_ptr->command = cpu_to_le16(cmd_no); - cmd_ptr->size = cpu_to_le16(S_DS_GEN); - break; - case HostCmd_CMD_FUNC_SHUTDOWN: - priv->adapter->hw_status = MWIFIEX_HW_STATUS_RESET; - cmd_ptr->command = cpu_to_le16(cmd_no); - cmd_ptr->size = cpu_to_le16(S_DS_GEN); - break; - case HostCmd_CMD_11N_ADDBA_REQ: - ret = mwifiex_cmd_11n_addba_req(cmd_ptr, data_buf); - break; - case HostCmd_CMD_11N_DELBA: - ret = mwifiex_cmd_11n_delba(cmd_ptr, data_buf); - break; - case HostCmd_CMD_11N_ADDBA_RSP: - ret = mwifiex_cmd_11n_addba_rsp_gen(priv, cmd_ptr, data_buf); - break; - case HostCmd_CMD_802_11_KEY_MATERIAL: - ret = mwifiex_cmd_802_11_key_material(priv, cmd_ptr, - cmd_action, cmd_oid, - data_buf); - break; - case HostCmd_CMD_802_11D_DOMAIN_INFO: - ret = mwifiex_cmd_802_11d_domain_info(priv, cmd_ptr, - cmd_action); - break; - case HostCmd_CMD_RECONFIGURE_TX_BUFF: - ret = mwifiex_cmd_recfg_tx_buf(priv, cmd_ptr, cmd_action, - data_buf); - break; - case HostCmd_CMD_AMSDU_AGGR_CTRL: - ret = mwifiex_cmd_amsdu_aggr_ctrl(cmd_ptr, cmd_action, - data_buf); - break; - case HostCmd_CMD_11N_CFG: - ret = mwifiex_cmd_11n_cfg(priv, cmd_ptr, cmd_action, data_buf); - break; - case HostCmd_CMD_WMM_GET_STATUS: - dev_dbg(priv->adapter->dev, - "cmd: WMM: WMM_GET_STATUS cmd sent\n"); - cmd_ptr->command = cpu_to_le16(HostCmd_CMD_WMM_GET_STATUS); - cmd_ptr->size = - cpu_to_le16(sizeof(struct host_cmd_ds_wmm_get_status) + - S_DS_GEN); - ret = 0; - break; - case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS: - ret = mwifiex_cmd_ibss_coalescing_status(cmd_ptr, cmd_action, - data_buf); - break; - case HostCmd_CMD_MAC_REG_ACCESS: - case HostCmd_CMD_BBP_REG_ACCESS: - case HostCmd_CMD_RF_REG_ACCESS: - case HostCmd_CMD_PMIC_REG_ACCESS: - case HostCmd_CMD_CAU_REG_ACCESS: - case HostCmd_CMD_802_11_EEPROM_ACCESS: - ret = mwifiex_cmd_reg_access(cmd_ptr, cmd_action, data_buf); - break; - case HostCmd_CMD_SET_BSS_MODE: - cmd_ptr->command = cpu_to_le16(cmd_no); - if (priv->bss_mode == NL80211_IFTYPE_ADHOC) - cmd_ptr->params.bss_mode.con_type = - CONNECTION_TYPE_ADHOC; - else if (priv->bss_mode == NL80211_IFTYPE_STATION) - cmd_ptr->params.bss_mode.con_type = - CONNECTION_TYPE_INFRA; - else if (priv->bss_mode == NL80211_IFTYPE_AP) - cmd_ptr->params.bss_mode.con_type = CONNECTION_TYPE_AP; - cmd_ptr->size = cpu_to_le16(sizeof(struct - host_cmd_ds_set_bss_mode) + S_DS_GEN); - ret = 0; - break; - case HostCmd_CMD_PCIE_DESC_DETAILS: - ret = mwifiex_cmd_pcie_host_spec(priv, cmd_ptr, cmd_action); - break; - case HostCmd_CMD_802_11_SUBSCRIBE_EVENT: - ret = mwifiex_cmd_802_11_subsc_evt(priv, cmd_ptr, data_buf); - break; - case HostCmd_CMD_MEF_CFG: - ret = mwifiex_cmd_mef_cfg(priv, cmd_ptr, data_buf); - break; - default: - dev_err(priv->adapter->dev, - "PREP_CMD: unknown cmd- %#x\n", cmd_no); - ret = -1; - break; - } - return ret; -} - -/* - * This function issues commands to initialize firmware. - * - * This is called after firmware download to bring the card to - * working state. - * - * The following commands are issued sequentially - - * - Set PCI-Express host buffer configuration (PCIE only) - * - Function init (for first interface only) - * - Read MAC address (for first interface only) - * - Reconfigure Tx buffer size (for first interface only) - * - Enable auto deep sleep (for first interface only) - * - Get Tx rate - * - Get Tx power - * - Set IBSS coalescing status - * - Set AMSDU aggregation control - * - Set 11d control - * - Set MAC control (this must be the last command to initialize firmware) - */ -int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta) -{ - int ret; - u16 enable = true; - struct mwifiex_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl; - struct mwifiex_ds_auto_ds auto_ds; - enum state_11d_t state_11d; - struct mwifiex_ds_11n_tx_cfg tx_cfg; - - if (first_sta) { - if (priv->adapter->iface_type == MWIFIEX_PCIE) { - ret = mwifiex_send_cmd_sync(priv, - HostCmd_CMD_PCIE_DESC_DETAILS, - HostCmd_ACT_GEN_SET, 0, NULL); - if (ret) - return -1; - } - - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_FUNC_INIT, - HostCmd_ACT_GEN_SET, 0, NULL); - if (ret) - return -1; - /* Read MAC address from HW */ - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_GET_HW_SPEC, - HostCmd_ACT_GEN_GET, 0, NULL); - if (ret) - return -1; - - /* Reconfigure tx buf size */ - ret = mwifiex_send_cmd_sync(priv, - HostCmd_CMD_RECONFIGURE_TX_BUFF, - HostCmd_ACT_GEN_SET, 0, - &priv->adapter->tx_buf_size); - if (ret) - return -1; - - if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) { - /* Enable IEEE PS by default */ - priv->adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP; - ret = mwifiex_send_cmd_sync( - priv, HostCmd_CMD_802_11_PS_MODE_ENH, - EN_AUTO_PS, BITMAP_STA_PS, NULL); - if (ret) - return -1; - } - } - - /* get tx rate */ - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_TX_RATE_CFG, - HostCmd_ACT_GEN_GET, 0, NULL); - if (ret) - return -1; - priv->data_rate = 0; - - /* get tx power */ - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_RF_TX_PWR, - HostCmd_ACT_GEN_GET, 0, NULL); - if (ret) - return -1; - - if (priv->bss_type == MWIFIEX_BSS_TYPE_STA) { - /* set ibss coalescing_status */ - ret = mwifiex_send_cmd_sync( - priv, HostCmd_CMD_802_11_IBSS_COALESCING_STATUS, - HostCmd_ACT_GEN_SET, 0, &enable); - if (ret) - return -1; - } - - memset(&amsdu_aggr_ctrl, 0, sizeof(amsdu_aggr_ctrl)); - amsdu_aggr_ctrl.enable = true; - /* Send request to firmware */ - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_AMSDU_AGGR_CTRL, - HostCmd_ACT_GEN_SET, 0, - &amsdu_aggr_ctrl); - if (ret) - return -1; - /* MAC Control must be the last command in init_fw */ - /* set MAC Control */ - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_MAC_CONTROL, - HostCmd_ACT_GEN_SET, 0, - &priv->curr_pkt_filter); - if (ret) - return -1; - - if (first_sta && priv->adapter->iface_type != MWIFIEX_USB && - priv->bss_type != MWIFIEX_BSS_TYPE_UAP) { - /* Enable auto deep sleep */ - auto_ds.auto_ds = DEEP_SLEEP_ON; - auto_ds.idle_time = DEEP_SLEEP_IDLE_TIME; - ret = mwifiex_send_cmd_sync(priv, - HostCmd_CMD_802_11_PS_MODE_ENH, - EN_AUTO_PS, BITMAP_AUTO_DS, - &auto_ds); - if (ret) - return -1; - } - - if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) { - /* Send cmd to FW to enable/disable 11D function */ - state_11d = ENABLE_11D; - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB, - HostCmd_ACT_GEN_SET, DOT11D_I, - &state_11d); - if (ret) - dev_err(priv->adapter->dev, - "11D: failed to enable 11D\n"); - } - - /* set last_init_cmd before sending the command */ - priv->adapter->last_init_cmd = HostCmd_CMD_11N_CFG; - - /* Send cmd to FW to configure 11n specific configuration - * (Short GI, Channel BW, Green field support etc.) for transmit - */ - tx_cfg.tx_htcap = MWIFIEX_FW_DEF_HTTXCFG; - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_11N_CFG, - HostCmd_ACT_GEN_SET, 0, &tx_cfg); - - ret = -EINPROGRESS; - - return ret; -} diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c deleted file mode 100644 index 9f990e14966e..000000000000 --- a/drivers/net/wireless/mwifiex/sta_cmdresp.c +++ /dev/null @@ -1,990 +0,0 @@ -/* - * Marvell Wireless LAN device driver: station command response handling - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" -#include "11n.h" -#include "11ac.h" - - -/* - * This function handles the command response error case. - * - * For scan response error, the function cancels all the pending - * scan commands and generates an event to inform the applications - * of the scan completion. - * - * For Power Save command failure, we do not retry enter PS - * command in case of Ad-hoc mode. - * - * For all other response errors, the current command buffer is freed - * and returned to the free command queue. - */ -static void -mwifiex_process_cmdresp_error(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct cmd_ctrl_node *cmd_node = NULL, *tmp_node; - struct mwifiex_adapter *adapter = priv->adapter; - struct host_cmd_ds_802_11_ps_mode_enh *pm; - unsigned long flags; - - dev_err(adapter->dev, "CMD_RESP: cmd %#x error, result=%#x\n", - resp->command, resp->result); - - if (adapter->curr_cmd->wait_q_enabled) - adapter->cmd_wait_q.status = -1; - - switch (le16_to_cpu(resp->command)) { - case HostCmd_CMD_802_11_PS_MODE_ENH: - pm = &resp->params.psmode_enh; - dev_err(adapter->dev, - "PS_MODE_ENH cmd failed: result=0x%x action=0x%X\n", - resp->result, le16_to_cpu(pm->action)); - /* We do not re-try enter-ps command in ad-hoc mode. */ - if (le16_to_cpu(pm->action) == EN_AUTO_PS && - (le16_to_cpu(pm->params.ps_bitmap) & BITMAP_STA_PS) && - priv->bss_mode == NL80211_IFTYPE_ADHOC) - adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; - - break; - case HostCmd_CMD_802_11_SCAN: - /* Cancel all pending scan command */ - spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); - list_for_each_entry_safe(cmd_node, tmp_node, - &adapter->scan_pending_q, list) { - list_del(&cmd_node->list); - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, - flags); - mwifiex_insert_cmd_to_free_q(adapter, cmd_node); - spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); - } - spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags); - - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); - adapter->scan_processing = false; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); - if (priv->report_scan_result) - priv->report_scan_result = false; - break; - - case HostCmd_CMD_MAC_CONTROL: - break; - - default: - break; - } - /* Handling errors here */ - mwifiex_recycle_cmd_node(adapter, adapter->curr_cmd); - - spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags); - adapter->curr_cmd = NULL; - spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); -} - -/* - * This function handles the command response of get RSSI info. - * - * Handling includes changing the header fields into CPU format - * and saving the following parameters in driver - - * - Last data and beacon RSSI value - * - Average data and beacon RSSI value - * - Last data and beacon NF value - * - Average data and beacon NF value - * - * The parameters are send to the application as well, along with - * calculated SNR values. - */ -static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp = - &resp->params.rssi_info_rsp; - struct mwifiex_ds_misc_subsc_evt *subsc_evt = - &priv->async_subsc_evt_storage; - - priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last); - priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last); - - priv->data_rssi_avg = le16_to_cpu(rssi_info_rsp->data_rssi_avg); - priv->data_nf_avg = le16_to_cpu(rssi_info_rsp->data_nf_avg); - - priv->bcn_rssi_last = le16_to_cpu(rssi_info_rsp->bcn_rssi_last); - priv->bcn_nf_last = le16_to_cpu(rssi_info_rsp->bcn_nf_last); - - priv->bcn_rssi_avg = le16_to_cpu(rssi_info_rsp->bcn_rssi_avg); - priv->bcn_nf_avg = le16_to_cpu(rssi_info_rsp->bcn_nf_avg); - - if (priv->subsc_evt_rssi_state == EVENT_HANDLED) - return 0; - - memset(subsc_evt, 0x00, sizeof(struct mwifiex_ds_misc_subsc_evt)); - - /* Resubscribe low and high rssi events with new thresholds */ - subsc_evt->events = BITMASK_BCN_RSSI_LOW | BITMASK_BCN_RSSI_HIGH; - subsc_evt->action = HostCmd_ACT_BITWISE_SET; - if (priv->subsc_evt_rssi_state == RSSI_LOW_RECVD) { - subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg - - priv->cqm_rssi_hyst); - subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold); - } else if (priv->subsc_evt_rssi_state == RSSI_HIGH_RECVD) { - subsc_evt->bcn_l_rssi_cfg.abs_value = abs(priv->cqm_rssi_thold); - subsc_evt->bcn_h_rssi_cfg.abs_value = abs(priv->bcn_rssi_avg + - priv->cqm_rssi_hyst); - } - subsc_evt->bcn_l_rssi_cfg.evt_freq = 1; - subsc_evt->bcn_h_rssi_cfg.evt_freq = 1; - - priv->subsc_evt_rssi_state = EVENT_HANDLED; - - mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11_SUBSCRIBE_EVENT, - 0, 0, subsc_evt); - - return 0; -} - -/* - * This function handles the command response of set/get SNMP - * MIB parameters. - * - * Handling includes changing the header fields into CPU format - * and saving the parameter in driver. - * - * The following parameters are supported - - * - Fragmentation threshold - * - RTS threshold - * - Short retry limit - */ -static int mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp, - u32 *data_buf) -{ - struct host_cmd_ds_802_11_snmp_mib *smib = &resp->params.smib; - u16 oid = le16_to_cpu(smib->oid); - u16 query_type = le16_to_cpu(smib->query_type); - u32 ul_temp; - - dev_dbg(priv->adapter->dev, "info: SNMP_RESP: oid value = %#x," - " query_type = %#x, buf size = %#x\n", - oid, query_type, le16_to_cpu(smib->buf_size)); - if (query_type == HostCmd_ACT_GEN_GET) { - ul_temp = le16_to_cpu(*((__le16 *) (smib->value))); - if (data_buf) - *data_buf = ul_temp; - switch (oid) { - case FRAG_THRESH_I: - dev_dbg(priv->adapter->dev, - "info: SNMP_RESP: FragThsd =%u\n", ul_temp); - break; - case RTS_THRESH_I: - dev_dbg(priv->adapter->dev, - "info: SNMP_RESP: RTSThsd =%u\n", ul_temp); - break; - case SHORT_RETRY_LIM_I: - dev_dbg(priv->adapter->dev, - "info: SNMP_RESP: TxRetryCount=%u\n", ul_temp); - break; - case DTIM_PERIOD_I: - dev_dbg(priv->adapter->dev, - "info: SNMP_RESP: DTIM period=%u\n", ul_temp); - default: - break; - } - } - - return 0; -} - -/* - * This function handles the command response of get log request - * - * Handling includes changing the header fields into CPU format - * and sending the received parameters to application. - */ -static int mwifiex_ret_get_log(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp, - struct mwifiex_ds_get_stats *stats) -{ - struct host_cmd_ds_802_11_get_log *get_log = - &resp->params.get_log; - - if (stats) { - stats->mcast_tx_frame = le32_to_cpu(get_log->mcast_tx_frame); - stats->failed = le32_to_cpu(get_log->failed); - stats->retry = le32_to_cpu(get_log->retry); - stats->multi_retry = le32_to_cpu(get_log->multi_retry); - stats->frame_dup = le32_to_cpu(get_log->frame_dup); - stats->rts_success = le32_to_cpu(get_log->rts_success); - stats->rts_failure = le32_to_cpu(get_log->rts_failure); - stats->ack_failure = le32_to_cpu(get_log->ack_failure); - stats->rx_frag = le32_to_cpu(get_log->rx_frag); - stats->mcast_rx_frame = le32_to_cpu(get_log->mcast_rx_frame); - stats->fcs_error = le32_to_cpu(get_log->fcs_error); - stats->tx_frame = le32_to_cpu(get_log->tx_frame); - stats->wep_icv_error[0] = - le32_to_cpu(get_log->wep_icv_err_cnt[0]); - stats->wep_icv_error[1] = - le32_to_cpu(get_log->wep_icv_err_cnt[1]); - stats->wep_icv_error[2] = - le32_to_cpu(get_log->wep_icv_err_cnt[2]); - stats->wep_icv_error[3] = - le32_to_cpu(get_log->wep_icv_err_cnt[3]); - } - - return 0; -} - -/* - * This function handles the command response of set/get Tx rate - * configurations. - * - * Handling includes changing the header fields into CPU format - * and saving the following parameters in driver - - * - DSSS rate bitmap - * - OFDM rate bitmap - * - HT MCS rate bitmaps - * - * Based on the new rate bitmaps, the function re-evaluates if - * auto data rate has been activated. If not, it sends another - * query to the firmware to get the current Tx data rate. - */ -static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg; - struct mwifiex_rate_scope *rate_scope; - struct mwifiex_ie_types_header *head; - u16 tlv, tlv_buf_len; - u8 *tlv_buf; - u32 i; - - tlv_buf = ((u8 *)rate_cfg) + - sizeof(struct host_cmd_ds_tx_rate_cfg); - tlv_buf_len = *(u16 *) (tlv_buf + sizeof(u16)); - - while (tlv_buf && tlv_buf_len > 0) { - tlv = (*tlv_buf); - tlv = tlv | (*(tlv_buf + 1) << 8); - - switch (tlv) { - case TLV_TYPE_RATE_SCOPE: - rate_scope = (struct mwifiex_rate_scope *) tlv_buf; - priv->bitmap_rates[0] = - le16_to_cpu(rate_scope->hr_dsss_rate_bitmap); - priv->bitmap_rates[1] = - le16_to_cpu(rate_scope->ofdm_rate_bitmap); - for (i = 0; - i < - sizeof(rate_scope->ht_mcs_rate_bitmap) / - sizeof(u16); i++) - priv->bitmap_rates[2 + i] = - le16_to_cpu(rate_scope-> - ht_mcs_rate_bitmap[i]); - break; - /* Add RATE_DROP tlv here */ - } - - head = (struct mwifiex_ie_types_header *) tlv_buf; - tlv_buf += le16_to_cpu(head->len) + sizeof(*head); - tlv_buf_len -= le16_to_cpu(head->len); - } - - priv->is_data_rate_auto = mwifiex_is_rate_auto(priv); - - if (priv->is_data_rate_auto) - priv->data_rate = 0; - else - return mwifiex_send_cmd_async(priv, - HostCmd_CMD_802_11_TX_RATE_QUERY, - HostCmd_ACT_GEN_GET, 0, NULL); - - return 0; -} - -/* - * This function handles the command response of get Tx power level. - * - * Handling includes saving the maximum and minimum Tx power levels - * in driver, as well as sending the values to user. - */ -static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf) -{ - int length, max_power = -1, min_power = -1; - struct mwifiex_types_power_group *pg_tlv_hdr; - struct mwifiex_power_group *pg; - - if (!data_buf) - return -1; - - pg_tlv_hdr = (struct mwifiex_types_power_group *) - ((u8 *) data_buf + sizeof(struct host_cmd_ds_txpwr_cfg)); - pg = (struct mwifiex_power_group *) - ((u8 *) pg_tlv_hdr + sizeof(struct mwifiex_types_power_group)); - length = pg_tlv_hdr->length; - if (length > 0) { - max_power = pg->power_max; - min_power = pg->power_min; - length -= sizeof(struct mwifiex_power_group); - } - while (length) { - pg++; - if (max_power < pg->power_max) - max_power = pg->power_max; - - if (min_power > pg->power_min) - min_power = pg->power_min; - - length -= sizeof(struct mwifiex_power_group); - } - if (pg_tlv_hdr->length > 0) { - priv->min_tx_power_level = (u8) min_power; - priv->max_tx_power_level = (u8) max_power; - } - - return 0; -} - -/* - * This function handles the command response of set/get Tx power - * configurations. - * - * Handling includes changing the header fields into CPU format - * and saving the current Tx power level in driver. - */ -static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct host_cmd_ds_txpwr_cfg *txp_cfg = &resp->params.txp_cfg; - struct mwifiex_types_power_group *pg_tlv_hdr; - struct mwifiex_power_group *pg; - u16 action = le16_to_cpu(txp_cfg->action); - - switch (action) { - case HostCmd_ACT_GEN_GET: - pg_tlv_hdr = (struct mwifiex_types_power_group *) - ((u8 *) txp_cfg + - sizeof(struct host_cmd_ds_txpwr_cfg)); - - pg = (struct mwifiex_power_group *) - ((u8 *) pg_tlv_hdr + - sizeof(struct mwifiex_types_power_group)); - - if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) - mwifiex_get_power_level(priv, txp_cfg); - - priv->tx_power_level = (u16) pg->power_min; - break; - - case HostCmd_ACT_GEN_SET: - if (!le32_to_cpu(txp_cfg->mode)) - break; - - pg_tlv_hdr = (struct mwifiex_types_power_group *) - ((u8 *) txp_cfg + - sizeof(struct host_cmd_ds_txpwr_cfg)); - - pg = (struct mwifiex_power_group *) - ((u8 *) pg_tlv_hdr + - sizeof(struct mwifiex_types_power_group)); - - if (pg->power_max == pg->power_min) - priv->tx_power_level = (u16) pg->power_min; - break; - default: - dev_err(adapter->dev, "CMD_RESP: unknown cmd action %d\n", - action); - return 0; - } - dev_dbg(adapter->dev, - "info: Current TxPower Level = %d, Max Power=%d, Min Power=%d\n", - priv->tx_power_level, priv->max_tx_power_level, - priv->min_tx_power_level); - - return 0; -} - -/* - * This function handles the command response of get RF Tx power. - */ -static int mwifiex_ret_rf_tx_power(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct host_cmd_ds_rf_tx_pwr *txp = &resp->params.txp; - u16 action = le16_to_cpu(txp->action); - - priv->tx_power_level = le16_to_cpu(txp->cur_level); - - if (action == HostCmd_ACT_GEN_GET) { - priv->max_tx_power_level = txp->max_power; - priv->min_tx_power_level = txp->min_power; - } - - dev_dbg(priv->adapter->dev, - "Current TxPower Level=%d, Max Power=%d, Min Power=%d\n", - priv->tx_power_level, priv->max_tx_power_level, - priv->min_tx_power_level); - - return 0; -} - -/* - * This function handles the command response of set rf antenna - */ -static int mwifiex_ret_rf_antenna(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct host_cmd_ds_rf_ant_mimo *ant_mimo = &resp->params.ant_mimo; - struct host_cmd_ds_rf_ant_siso *ant_siso = &resp->params.ant_siso; - struct mwifiex_adapter *adapter = priv->adapter; - - if (adapter->hw_dev_mcs_support == HT_STREAM_2X2) - dev_dbg(adapter->dev, - "RF_ANT_RESP: Tx action = 0x%x, Tx Mode = 0x%04x" - " Rx action = 0x%x, Rx Mode = 0x%04x\n", - le16_to_cpu(ant_mimo->action_tx), - le16_to_cpu(ant_mimo->tx_ant_mode), - le16_to_cpu(ant_mimo->action_rx), - le16_to_cpu(ant_mimo->rx_ant_mode)); - else - dev_dbg(adapter->dev, - "RF_ANT_RESP: action = 0x%x, Mode = 0x%04x\n", - le16_to_cpu(ant_siso->action), - le16_to_cpu(ant_siso->ant_mode)); - - return 0; -} - -/* - * This function handles the command response of set/get MAC address. - * - * Handling includes saving the MAC address in driver. - */ -static int mwifiex_ret_802_11_mac_address(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct host_cmd_ds_802_11_mac_address *cmd_mac_addr = - &resp->params.mac_addr; - - memcpy(priv->curr_addr, cmd_mac_addr->mac_addr, ETH_ALEN); - - dev_dbg(priv->adapter->dev, - "info: set mac address: %pM\n", priv->curr_addr); - - return 0; -} - -/* - * This function handles the command response of set/get MAC multicast - * address. - */ -static int mwifiex_ret_mac_multicast_adr(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - return 0; -} - -/* - * This function handles the command response of get Tx rate query. - * - * Handling includes changing the header fields into CPU format - * and saving the Tx rate and HT information parameters in driver. - * - * Both rate configuration and current data rate can be retrieved - * with this request. - */ -static int mwifiex_ret_802_11_tx_rate_query(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - priv->tx_rate = resp->params.tx_rate.tx_rate; - priv->tx_htinfo = resp->params.tx_rate.ht_info; - if (!priv->is_data_rate_auto) - priv->data_rate = - mwifiex_index_to_data_rate(priv, priv->tx_rate, - priv->tx_htinfo); - - return 0; -} - -/* - * This function handles the command response of a deauthenticate - * command. - * - * If the deauthenticated MAC matches the current BSS MAC, the connection - * state is reset. - */ -static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct mwifiex_adapter *adapter = priv->adapter; - - adapter->dbg.num_cmd_deauth++; - if (!memcmp(resp->params.deauth.mac_addr, - &priv->curr_bss_params.bss_descriptor.mac_address, - sizeof(resp->params.deauth.mac_addr))) - mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING); - - return 0; -} - -/* - * This function handles the command response of ad-hoc stop. - * - * The function resets the connection state in driver. - */ -static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING); - return 0; -} - -/* - * This function handles the command response of set/get key material. - * - * Handling includes updating the driver parameters to reflect the - * changes. - */ -static int mwifiex_ret_802_11_key_material(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct host_cmd_ds_802_11_key_material *key = - &resp->params.key_material; - - if (le16_to_cpu(key->action) == HostCmd_ACT_GEN_SET) { - if ((le16_to_cpu(key->key_param_set.key_info) & KEY_MCAST)) { - dev_dbg(priv->adapter->dev, "info: key: GTK is set\n"); - priv->wpa_is_gtk_set = true; - priv->scan_block = false; - } - } - - memset(priv->aes_key.key_param_set.key, 0, - sizeof(key->key_param_set.key)); - priv->aes_key.key_param_set.key_len = key->key_param_set.key_len; - memcpy(priv->aes_key.key_param_set.key, key->key_param_set.key, - le16_to_cpu(priv->aes_key.key_param_set.key_len)); - - return 0; -} - -/* - * This function handles the command response of get 11d domain information. - */ -static int mwifiex_ret_802_11d_domain_info(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct host_cmd_ds_802_11d_domain_info_rsp *domain_info = - &resp->params.domain_info_resp; - struct mwifiex_ietypes_domain_param_set *domain = &domain_info->domain; - u16 action = le16_to_cpu(domain_info->action); - u8 no_of_triplet; - - no_of_triplet = (u8) ((le16_to_cpu(domain->header.len) - - IEEE80211_COUNTRY_STRING_LEN) - / sizeof(struct ieee80211_country_ie_triplet)); - - dev_dbg(priv->adapter->dev, - "info: 11D Domain Info Resp: no_of_triplet=%d\n", - no_of_triplet); - - if (no_of_triplet > MWIFIEX_MAX_TRIPLET_802_11D) { - dev_warn(priv->adapter->dev, - "11D: invalid number of triplets %d returned\n", - no_of_triplet); - return -1; - } - - switch (action) { - case HostCmd_ACT_GEN_SET: /* Proc Set Action */ - break; - case HostCmd_ACT_GEN_GET: - break; - default: - dev_err(priv->adapter->dev, - "11D: invalid action:%d\n", domain_info->action); - return -1; - } - - return 0; -} - -/* - * This function handles the command response of get extended version. - * - * Handling includes forming the extended version string and sending it - * to application. - */ -static int mwifiex_ret_ver_ext(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp, - struct host_cmd_ds_version_ext *version_ext) -{ - struct host_cmd_ds_version_ext *ver_ext = &resp->params.verext; - - if (version_ext) { - version_ext->version_str_sel = ver_ext->version_str_sel; - memcpy(version_ext->version_str, ver_ext->version_str, - sizeof(char) * 128); - memcpy(priv->version_str, ver_ext->version_str, 128); - } - return 0; -} - -/* - * This function handles the command response of remain on channel. - */ -static int -mwifiex_ret_remain_on_chan(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp, - struct host_cmd_ds_remain_on_chan *roc_cfg) -{ - struct host_cmd_ds_remain_on_chan *resp_cfg = &resp->params.roc_cfg; - - if (roc_cfg) - memcpy(roc_cfg, resp_cfg, sizeof(*roc_cfg)); - - return 0; -} - -/* - * This function handles the command response of P2P mode cfg. - */ -static int -mwifiex_ret_p2p_mode_cfg(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp, - void *data_buf) -{ - struct host_cmd_ds_p2p_mode_cfg *mode_cfg = &resp->params.mode_cfg; - - if (data_buf) - *((u16 *)data_buf) = le16_to_cpu(mode_cfg->mode); - - return 0; -} - -/* - * This function handles the command response of register access. - * - * The register value and offset are returned to the user. For EEPROM - * access, the byte count is also returned. - */ -static int mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp, - void *data_buf) -{ - struct mwifiex_ds_reg_rw *reg_rw; - struct mwifiex_ds_read_eeprom *eeprom; - union reg { - struct host_cmd_ds_mac_reg_access *mac; - struct host_cmd_ds_bbp_reg_access *bbp; - struct host_cmd_ds_rf_reg_access *rf; - struct host_cmd_ds_pmic_reg_access *pmic; - struct host_cmd_ds_802_11_eeprom_access *eeprom; - } r; - - if (!data_buf) - return 0; - - reg_rw = data_buf; - eeprom = data_buf; - switch (type) { - case HostCmd_CMD_MAC_REG_ACCESS: - r.mac = &resp->params.mac_reg; - reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.mac->offset)); - reg_rw->value = r.mac->value; - break; - case HostCmd_CMD_BBP_REG_ACCESS: - r.bbp = &resp->params.bbp_reg; - reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.bbp->offset)); - reg_rw->value = cpu_to_le32((u32) r.bbp->value); - break; - - case HostCmd_CMD_RF_REG_ACCESS: - r.rf = &resp->params.rf_reg; - reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset)); - reg_rw->value = cpu_to_le32((u32) r.bbp->value); - break; - case HostCmd_CMD_PMIC_REG_ACCESS: - r.pmic = &resp->params.pmic_reg; - reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.pmic->offset)); - reg_rw->value = cpu_to_le32((u32) r.pmic->value); - break; - case HostCmd_CMD_CAU_REG_ACCESS: - r.rf = &resp->params.rf_reg; - reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset)); - reg_rw->value = cpu_to_le32((u32) r.rf->value); - break; - case HostCmd_CMD_802_11_EEPROM_ACCESS: - r.eeprom = &resp->params.eeprom; - pr_debug("info: EEPROM read len=%x\n", r.eeprom->byte_count); - if (le16_to_cpu(eeprom->byte_count) < - le16_to_cpu(r.eeprom->byte_count)) { - eeprom->byte_count = cpu_to_le16(0); - pr_debug("info: EEPROM read length is too big\n"); - return -1; - } - eeprom->offset = r.eeprom->offset; - eeprom->byte_count = r.eeprom->byte_count; - if (le16_to_cpu(eeprom->byte_count) > 0) - memcpy(&eeprom->value, &r.eeprom->value, - le16_to_cpu(r.eeprom->byte_count)); - - break; - default: - return -1; - } - return 0; -} - -/* - * This function handles the command response of get IBSS coalescing status. - * - * If the received BSSID is different than the current one, the current BSSID, - * beacon interval, ATIM window and ERP information are updated, along with - * changing the ad-hoc state accordingly. - */ -static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct host_cmd_ds_802_11_ibss_status *ibss_coal_resp = - &(resp->params.ibss_coalescing); - - if (le16_to_cpu(ibss_coal_resp->action) == HostCmd_ACT_GEN_SET) - return 0; - - dev_dbg(priv->adapter->dev, - "info: new BSSID %pM\n", ibss_coal_resp->bssid); - - /* If rsp has NULL BSSID, Just return..... No Action */ - if (is_zero_ether_addr(ibss_coal_resp->bssid)) { - dev_warn(priv->adapter->dev, "new BSSID is NULL\n"); - return 0; - } - - /* If BSSID is diff, modify current BSS parameters */ - if (memcmp(priv->curr_bss_params.bss_descriptor.mac_address, - ibss_coal_resp->bssid, ETH_ALEN)) { - /* BSSID */ - memcpy(priv->curr_bss_params.bss_descriptor.mac_address, - ibss_coal_resp->bssid, ETH_ALEN); - - /* Beacon Interval */ - priv->curr_bss_params.bss_descriptor.beacon_period - = le16_to_cpu(ibss_coal_resp->beacon_interval); - - /* ERP Information */ - priv->curr_bss_params.bss_descriptor.erp_flags = - (u8) le16_to_cpu(ibss_coal_resp->use_g_rate_protect); - - priv->adhoc_state = ADHOC_COALESCED; - } - - return 0; -} - -/* - * This function handles the command response for subscribe event command. - */ -static int mwifiex_ret_subsc_evt(struct mwifiex_private *priv, - struct host_cmd_ds_command *resp) -{ - struct host_cmd_ds_802_11_subsc_evt *cmd_sub_event = - &resp->params.subsc_evt; - - /* For every subscribe event command (Get/Set/Clear), FW reports the - * current set of subscribed events*/ - dev_dbg(priv->adapter->dev, "Bitmap of currently subscribed events: %16x\n", - le16_to_cpu(cmd_sub_event->events)); - - return 0; -} - -/* - * This function handles the command responses. - * - * This is a generic function, which calls command specific - * response handlers based on the command ID. - */ -int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no, - struct host_cmd_ds_command *resp) -{ - int ret = 0; - struct mwifiex_adapter *adapter = priv->adapter; - void *data_buf = adapter->curr_cmd->data_buf; - - /* If the command is not successful, cleanup and return failure */ - if (resp->result != HostCmd_RESULT_OK) { - mwifiex_process_cmdresp_error(priv, resp); - return -1; - } - /* Command successful, handle response */ - switch (cmdresp_no) { - case HostCmd_CMD_GET_HW_SPEC: - ret = mwifiex_ret_get_hw_spec(priv, resp); - break; - case HostCmd_CMD_MAC_CONTROL: - break; - case HostCmd_CMD_802_11_MAC_ADDRESS: - ret = mwifiex_ret_802_11_mac_address(priv, resp); - break; - case HostCmd_CMD_MAC_MULTICAST_ADR: - ret = mwifiex_ret_mac_multicast_adr(priv, resp); - break; - case HostCmd_CMD_TX_RATE_CFG: - ret = mwifiex_ret_tx_rate_cfg(priv, resp); - break; - case HostCmd_CMD_802_11_SCAN: - ret = mwifiex_ret_802_11_scan(priv, resp); - adapter->curr_cmd->wait_q_enabled = false; - break; - case HostCmd_CMD_802_11_BG_SCAN_QUERY: - ret = mwifiex_ret_802_11_scan(priv, resp); - dev_dbg(adapter->dev, - "info: CMD_RESP: BG_SCAN result is ready!\n"); - break; - case HostCmd_CMD_TXPWR_CFG: - ret = mwifiex_ret_tx_power_cfg(priv, resp); - break; - case HostCmd_CMD_RF_TX_PWR: - ret = mwifiex_ret_rf_tx_power(priv, resp); - break; - case HostCmd_CMD_RF_ANTENNA: - ret = mwifiex_ret_rf_antenna(priv, resp); - break; - case HostCmd_CMD_802_11_PS_MODE_ENH: - ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf); - break; - case HostCmd_CMD_802_11_HS_CFG_ENH: - ret = mwifiex_ret_802_11_hs_cfg(priv, resp); - break; - case HostCmd_CMD_802_11_ASSOCIATE: - ret = mwifiex_ret_802_11_associate(priv, resp); - break; - case HostCmd_CMD_802_11_DEAUTHENTICATE: - ret = mwifiex_ret_802_11_deauthenticate(priv, resp); - break; - case HostCmd_CMD_802_11_AD_HOC_START: - case HostCmd_CMD_802_11_AD_HOC_JOIN: - ret = mwifiex_ret_802_11_ad_hoc(priv, resp); - break; - case HostCmd_CMD_802_11_AD_HOC_STOP: - ret = mwifiex_ret_802_11_ad_hoc_stop(priv, resp); - break; - case HostCmd_CMD_802_11_GET_LOG: - ret = mwifiex_ret_get_log(priv, resp, data_buf); - break; - case HostCmd_CMD_RSSI_INFO: - ret = mwifiex_ret_802_11_rssi_info(priv, resp); - break; - case HostCmd_CMD_802_11_SNMP_MIB: - ret = mwifiex_ret_802_11_snmp_mib(priv, resp, data_buf); - break; - case HostCmd_CMD_802_11_TX_RATE_QUERY: - ret = mwifiex_ret_802_11_tx_rate_query(priv, resp); - break; - case HostCmd_CMD_VERSION_EXT: - ret = mwifiex_ret_ver_ext(priv, resp, data_buf); - break; - case HostCmd_CMD_REMAIN_ON_CHAN: - ret = mwifiex_ret_remain_on_chan(priv, resp, data_buf); - break; - case HostCmd_CMD_11AC_CFG: - break; - case HostCmd_CMD_P2P_MODE_CFG: - ret = mwifiex_ret_p2p_mode_cfg(priv, resp, data_buf); - break; - case HostCmd_CMD_MGMT_FRAME_REG: - case HostCmd_CMD_FUNC_INIT: - case HostCmd_CMD_FUNC_SHUTDOWN: - break; - case HostCmd_CMD_802_11_KEY_MATERIAL: - ret = mwifiex_ret_802_11_key_material(priv, resp); - break; - case HostCmd_CMD_802_11D_DOMAIN_INFO: - ret = mwifiex_ret_802_11d_domain_info(priv, resp); - break; - case HostCmd_CMD_11N_ADDBA_REQ: - ret = mwifiex_ret_11n_addba_req(priv, resp); - break; - case HostCmd_CMD_11N_DELBA: - ret = mwifiex_ret_11n_delba(priv, resp); - break; - case HostCmd_CMD_11N_ADDBA_RSP: - ret = mwifiex_ret_11n_addba_resp(priv, resp); - break; - case HostCmd_CMD_RECONFIGURE_TX_BUFF: - adapter->tx_buf_size = (u16) le16_to_cpu(resp->params. - tx_buf.buff_size); - adapter->tx_buf_size = (adapter->tx_buf_size - / MWIFIEX_SDIO_BLOCK_SIZE) - * MWIFIEX_SDIO_BLOCK_SIZE; - adapter->curr_tx_buf_size = adapter->tx_buf_size; - dev_dbg(adapter->dev, "cmd: curr_tx_buf_size=%d\n", - adapter->curr_tx_buf_size); - - if (adapter->if_ops.update_mp_end_port) - adapter->if_ops.update_mp_end_port(adapter, - le16_to_cpu(resp->params.tx_buf.mp_end_port)); - break; - case HostCmd_CMD_AMSDU_AGGR_CTRL: - break; - case HostCmd_CMD_WMM_GET_STATUS: - ret = mwifiex_ret_wmm_get_status(priv, resp); - break; - case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS: - ret = mwifiex_ret_ibss_coalescing_status(priv, resp); - break; - case HostCmd_CMD_MAC_REG_ACCESS: - case HostCmd_CMD_BBP_REG_ACCESS: - case HostCmd_CMD_RF_REG_ACCESS: - case HostCmd_CMD_PMIC_REG_ACCESS: - case HostCmd_CMD_CAU_REG_ACCESS: - case HostCmd_CMD_802_11_EEPROM_ACCESS: - ret = mwifiex_ret_reg_access(cmdresp_no, resp, data_buf); - break; - case HostCmd_CMD_SET_BSS_MODE: - break; - case HostCmd_CMD_11N_CFG: - break; - case HostCmd_CMD_PCIE_DESC_DETAILS: - break; - case HostCmd_CMD_802_11_SUBSCRIBE_EVENT: - ret = mwifiex_ret_subsc_evt(priv, resp); - break; - case HostCmd_CMD_UAP_SYS_CONFIG: - break; - case HostCmd_CMD_UAP_BSS_START: - priv->bss_started = 1; - break; - case HostCmd_CMD_UAP_BSS_STOP: - priv->bss_started = 0; - break; - case HostCmd_CMD_MEF_CFG: - break; - default: - dev_err(adapter->dev, "CMD_RESP: unknown cmd response %#x\n", - resp->command); - break; - } - - return ret; -} diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c deleted file mode 100644 index 41aafc7454ed..000000000000 --- a/drivers/net/wireless/mwifiex/sta_event.c +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Marvell Wireless LAN device driver: station event handling - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" -#include "11n.h" - -/* - * This function resets the connection state. - * - * The function is invoked after receiving a disconnect event from firmware, - * and performs the following actions - - * - Set media status to disconnected - * - Clean up Tx and Rx packets - * - Resets SNR/NF/RSSI value in driver - * - Resets security configurations in driver - * - Enables auto data rate - * - Saves the previous SSID and BSSID so that they can - * be used for re-association, if required - * - Erases current SSID and BSSID information - * - Sends a disconnect event to upper layers/applications. - */ -void -mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code) -{ - struct mwifiex_adapter *adapter = priv->adapter; - - if (!priv->media_connected) - return; - - dev_dbg(adapter->dev, "info: handles disconnect event\n"); - - priv->media_connected = false; - - priv->scan_block = false; - - /* Free Tx and Rx packets, report disconnect to upper layer */ - mwifiex_clean_txrx(priv); - - /* Reset SNR/NF/RSSI values */ - priv->data_rssi_last = 0; - priv->data_nf_last = 0; - priv->data_rssi_avg = 0; - priv->data_nf_avg = 0; - priv->bcn_rssi_last = 0; - priv->bcn_nf_last = 0; - priv->bcn_rssi_avg = 0; - priv->bcn_nf_avg = 0; - priv->rxpd_rate = 0; - priv->rxpd_htinfo = 0; - priv->sec_info.wpa_enabled = false; - priv->sec_info.wpa2_enabled = false; - priv->wpa_ie_len = 0; - - priv->sec_info.wapi_enabled = false; - priv->wapi_ie_len = 0; - priv->sec_info.wapi_key_on = false; - - priv->sec_info.encryption_mode = 0; - - /* Enable auto data rate */ - priv->is_data_rate_auto = true; - priv->data_rate = 0; - - if (priv->bss_mode == NL80211_IFTYPE_ADHOC) { - priv->adhoc_state = ADHOC_IDLE; - priv->adhoc_is_link_sensed = false; - } - - /* - * Memorize the previous SSID and BSSID so - * it could be used for re-assoc - */ - - dev_dbg(adapter->dev, "info: previous SSID=%s, SSID len=%u\n", - priv->prev_ssid.ssid, priv->prev_ssid.ssid_len); - - dev_dbg(adapter->dev, "info: current SSID=%s, SSID len=%u\n", - priv->curr_bss_params.bss_descriptor.ssid.ssid, - priv->curr_bss_params.bss_descriptor.ssid.ssid_len); - - memcpy(&priv->prev_ssid, - &priv->curr_bss_params.bss_descriptor.ssid, - sizeof(struct cfg80211_ssid)); - - memcpy(priv->prev_bssid, - priv->curr_bss_params.bss_descriptor.mac_address, ETH_ALEN); - - /* Need to erase the current SSID and BSSID info */ - memset(&priv->curr_bss_params, 0x00, sizeof(priv->curr_bss_params)); - - adapter->tx_lock_flag = false; - adapter->pps_uapsd_mode = false; - - if (adapter->num_cmd_timeout && adapter->curr_cmd) - return; - priv->media_connected = false; - dev_dbg(adapter->dev, - "info: successfully disconnected from %pM: reason code %d\n", - priv->cfg_bssid, reason_code); - if (priv->bss_mode == NL80211_IFTYPE_STATION) { - cfg80211_disconnected(priv->netdev, reason_code, NULL, 0, - GFP_KERNEL); - } - memset(priv->cfg_bssid, 0, ETH_ALEN); - - mwifiex_stop_net_dev_queue(priv->netdev, adapter); - if (netif_carrier_ok(priv->netdev)) - netif_carrier_off(priv->netdev); -} - -/* - * This function handles events generated by firmware. - * - * This is a generic function and handles all events. - * - * Event specific routines are called by this function based - * upon the generated event cause. - * - * For the following events, the function just forwards them to upper - * layers, optionally recording the change - - * - EVENT_LINK_SENSED - * - EVENT_MIC_ERR_UNICAST - * - EVENT_MIC_ERR_MULTICAST - * - EVENT_PORT_RELEASE - * - EVENT_RSSI_LOW - * - EVENT_SNR_LOW - * - EVENT_MAX_FAIL - * - EVENT_RSSI_HIGH - * - EVENT_SNR_HIGH - * - EVENT_DATA_RSSI_LOW - * - EVENT_DATA_SNR_LOW - * - EVENT_DATA_RSSI_HIGH - * - EVENT_DATA_SNR_HIGH - * - EVENT_LINK_QUALITY - * - EVENT_PRE_BEACON_LOST - * - EVENT_IBSS_COALESCED - * - EVENT_WEP_ICV_ERR - * - EVENT_BW_CHANGE - * - EVENT_HOSTWAKE_STAIE - * - * For the following events, no action is taken - - * - EVENT_MIB_CHANGED - * - EVENT_INIT_DONE - * - EVENT_DUMMY_HOST_WAKEUP_SIGNAL - * - * Rest of the supported events requires driver handling - - * - EVENT_DEAUTHENTICATED - * - EVENT_DISASSOCIATED - * - EVENT_LINK_LOST - * - EVENT_PS_SLEEP - * - EVENT_PS_AWAKE - * - EVENT_DEEP_SLEEP_AWAKE - * - EVENT_HS_ACT_REQ - * - EVENT_ADHOC_BCN_LOST - * - EVENT_BG_SCAN_REPORT - * - EVENT_WMM_STATUS_CHANGE - * - EVENT_ADDBA - * - EVENT_DELBA - * - EVENT_BA_STREAM_TIEMOUT - * - EVENT_AMSDU_AGGR_CTRL - */ -int mwifiex_process_sta_event(struct mwifiex_private *priv) -{ - struct mwifiex_adapter *adapter = priv->adapter; - int ret = 0; - u32 eventcause = adapter->event_cause; - u16 ctrl, reason_code; - - switch (eventcause) { - case EVENT_DUMMY_HOST_WAKEUP_SIGNAL: - dev_err(adapter->dev, - "invalid EVENT: DUMMY_HOST_WAKEUP_SIGNAL, ignore it\n"); - break; - case EVENT_LINK_SENSED: - dev_dbg(adapter->dev, "event: LINK_SENSED\n"); - if (!netif_carrier_ok(priv->netdev)) - netif_carrier_on(priv->netdev); - mwifiex_wake_up_net_dev_queue(priv->netdev, adapter); - break; - - case EVENT_DEAUTHENTICATED: - dev_dbg(adapter->dev, "event: Deauthenticated\n"); - adapter->dbg.num_event_deauth++; - if (priv->media_connected) { - reason_code = - le16_to_cpu(*(__le16 *)adapter->event_body); - mwifiex_reset_connect_state(priv, reason_code); - } - break; - - case EVENT_DISASSOCIATED: - dev_dbg(adapter->dev, "event: Disassociated\n"); - adapter->dbg.num_event_disassoc++; - if (priv->media_connected) { - reason_code = - le16_to_cpu(*(__le16 *)adapter->event_body); - mwifiex_reset_connect_state(priv, reason_code); - } - break; - - case EVENT_LINK_LOST: - dev_dbg(adapter->dev, "event: Link lost\n"); - adapter->dbg.num_event_link_lost++; - if (priv->media_connected) { - reason_code = - le16_to_cpu(*(__le16 *)adapter->event_body); - mwifiex_reset_connect_state(priv, reason_code); - } - break; - - case EVENT_PS_SLEEP: - dev_dbg(adapter->dev, "info: EVENT: SLEEP\n"); - - adapter->ps_state = PS_STATE_PRE_SLEEP; - - mwifiex_check_ps_cond(adapter); - break; - - case EVENT_PS_AWAKE: - dev_dbg(adapter->dev, "info: EVENT: AWAKE\n"); - if (!adapter->pps_uapsd_mode && - priv->media_connected && adapter->sleep_period.period) { - adapter->pps_uapsd_mode = true; - dev_dbg(adapter->dev, - "event: PPS/UAPSD mode activated\n"); - } - adapter->tx_lock_flag = false; - if (adapter->pps_uapsd_mode && adapter->gen_null_pkt) { - if (mwifiex_check_last_packet_indication(priv)) { - if (adapter->data_sent) { - adapter->ps_state = PS_STATE_AWAKE; - adapter->pm_wakeup_card_req = false; - adapter->pm_wakeup_fw_try = false; - break; - } - if (!mwifiex_send_null_packet - (priv, - MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET | - MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET)) - adapter->ps_state = - PS_STATE_SLEEP; - return 0; - } - } - adapter->ps_state = PS_STATE_AWAKE; - adapter->pm_wakeup_card_req = false; - adapter->pm_wakeup_fw_try = false; - - break; - - case EVENT_DEEP_SLEEP_AWAKE: - adapter->if_ops.wakeup_complete(adapter); - dev_dbg(adapter->dev, "event: DS_AWAKE\n"); - if (adapter->is_deep_sleep) - adapter->is_deep_sleep = false; - break; - - case EVENT_HS_ACT_REQ: - dev_dbg(adapter->dev, "event: HS_ACT_REQ\n"); - ret = mwifiex_send_cmd_async(priv, - HostCmd_CMD_802_11_HS_CFG_ENH, - 0, 0, NULL); - break; - - case EVENT_MIC_ERR_UNICAST: - dev_dbg(adapter->dev, "event: UNICAST MIC ERROR\n"); - cfg80211_michael_mic_failure(priv->netdev, priv->cfg_bssid, - NL80211_KEYTYPE_PAIRWISE, - -1, NULL, GFP_KERNEL); - break; - - case EVENT_MIC_ERR_MULTICAST: - dev_dbg(adapter->dev, "event: MULTICAST MIC ERROR\n"); - cfg80211_michael_mic_failure(priv->netdev, priv->cfg_bssid, - NL80211_KEYTYPE_GROUP, - -1, NULL, GFP_KERNEL); - break; - case EVENT_MIB_CHANGED: - case EVENT_INIT_DONE: - break; - - case EVENT_ADHOC_BCN_LOST: - dev_dbg(adapter->dev, "event: ADHOC_BCN_LOST\n"); - priv->adhoc_is_link_sensed = false; - mwifiex_clean_txrx(priv); - mwifiex_stop_net_dev_queue(priv->netdev, adapter); - if (netif_carrier_ok(priv->netdev)) - netif_carrier_off(priv->netdev); - break; - - case EVENT_BG_SCAN_REPORT: - dev_dbg(adapter->dev, "event: BGS_REPORT\n"); - ret = mwifiex_send_cmd_async(priv, - HostCmd_CMD_802_11_BG_SCAN_QUERY, - HostCmd_ACT_GEN_GET, 0, NULL); - break; - - case EVENT_PORT_RELEASE: - dev_dbg(adapter->dev, "event: PORT RELEASE\n"); - break; - - case EVENT_WMM_STATUS_CHANGE: - dev_dbg(adapter->dev, "event: WMM status changed\n"); - ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_WMM_GET_STATUS, - 0, 0, NULL); - break; - - case EVENT_RSSI_LOW: - cfg80211_cqm_rssi_notify(priv->netdev, - NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, - GFP_KERNEL); - mwifiex_send_cmd_async(priv, HostCmd_CMD_RSSI_INFO, - HostCmd_ACT_GEN_GET, 0, NULL); - priv->subsc_evt_rssi_state = RSSI_LOW_RECVD; - dev_dbg(adapter->dev, "event: Beacon RSSI_LOW\n"); - break; - case EVENT_SNR_LOW: - dev_dbg(adapter->dev, "event: Beacon SNR_LOW\n"); - break; - case EVENT_MAX_FAIL: - dev_dbg(adapter->dev, "event: MAX_FAIL\n"); - break; - case EVENT_RSSI_HIGH: - cfg80211_cqm_rssi_notify(priv->netdev, - NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, - GFP_KERNEL); - mwifiex_send_cmd_async(priv, HostCmd_CMD_RSSI_INFO, - HostCmd_ACT_GEN_GET, 0, NULL); - priv->subsc_evt_rssi_state = RSSI_HIGH_RECVD; - dev_dbg(adapter->dev, "event: Beacon RSSI_HIGH\n"); - break; - case EVENT_SNR_HIGH: - dev_dbg(adapter->dev, "event: Beacon SNR_HIGH\n"); - break; - case EVENT_DATA_RSSI_LOW: - dev_dbg(adapter->dev, "event: Data RSSI_LOW\n"); - break; - case EVENT_DATA_SNR_LOW: - dev_dbg(adapter->dev, "event: Data SNR_LOW\n"); - break; - case EVENT_DATA_RSSI_HIGH: - dev_dbg(adapter->dev, "event: Data RSSI_HIGH\n"); - break; - case EVENT_DATA_SNR_HIGH: - dev_dbg(adapter->dev, "event: Data SNR_HIGH\n"); - break; - case EVENT_LINK_QUALITY: - dev_dbg(adapter->dev, "event: Link Quality\n"); - break; - case EVENT_PRE_BEACON_LOST: - dev_dbg(adapter->dev, "event: Pre-Beacon Lost\n"); - break; - case EVENT_IBSS_COALESCED: - dev_dbg(adapter->dev, "event: IBSS_COALESCED\n"); - ret = mwifiex_send_cmd_async(priv, - HostCmd_CMD_802_11_IBSS_COALESCING_STATUS, - HostCmd_ACT_GEN_GET, 0, NULL); - break; - case EVENT_ADDBA: - dev_dbg(adapter->dev, "event: ADDBA Request\n"); - mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_ADDBA_RSP, - HostCmd_ACT_GEN_SET, 0, - adapter->event_body); - break; - case EVENT_DELBA: - dev_dbg(adapter->dev, "event: DELBA Request\n"); - mwifiex_11n_delete_ba_stream(priv, adapter->event_body); - break; - case EVENT_BA_STREAM_TIEMOUT: - dev_dbg(adapter->dev, "event: BA Stream timeout\n"); - mwifiex_11n_ba_stream_timeout(priv, - (struct host_cmd_ds_11n_batimeout - *) - adapter->event_body); - break; - case EVENT_AMSDU_AGGR_CTRL: - ctrl = le16_to_cpu(*(__le16 *)adapter->event_body); - dev_dbg(adapter->dev, "event: AMSDU_AGGR_CTRL %d\n", ctrl); - - adapter->tx_buf_size = - min_t(u16, adapter->curr_tx_buf_size, ctrl); - dev_dbg(adapter->dev, "event: tx_buf_size %d\n", - adapter->tx_buf_size); - break; - - case EVENT_WEP_ICV_ERR: - dev_dbg(adapter->dev, "event: WEP ICV error\n"); - break; - - case EVENT_BW_CHANGE: - dev_dbg(adapter->dev, "event: BW Change\n"); - break; - - case EVENT_HOSTWAKE_STAIE: - dev_dbg(adapter->dev, "event: HOSTWAKE_STAIE %d\n", eventcause); - break; - - case EVENT_REMAIN_ON_CHAN_EXPIRED: - dev_dbg(adapter->dev, "event: Remain on channel expired\n"); - cfg80211_remain_on_channel_expired(priv->wdev, - priv->roc_cfg.cookie, - &priv->roc_cfg.chan, - GFP_ATOMIC); - - memset(&priv->roc_cfg, 0x00, sizeof(struct mwifiex_roc_cfg)); - - break; - - default: - dev_dbg(adapter->dev, "event: unknown event id: %#x\n", - eventcause); - break; - } - - return ret; -} diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c deleted file mode 100644 index 0a9f59c5ab5a..000000000000 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ /dev/null @@ -1,1376 +0,0 @@ -/* - * Marvell Wireless LAN device driver: functions for station ioctl - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" -#include "11n.h" -#include "cfg80211.h" - -static int disconnect_on_suspend = 1; -module_param(disconnect_on_suspend, int, 0644); - -/* - * Copies the multicast address list from device to driver. - * - * This function does not validate the destination memory for - * size, and the calling function must ensure enough memory is - * available. - */ -int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, - struct net_device *dev) -{ - int i = 0; - struct netdev_hw_addr *ha; - - netdev_for_each_mc_addr(ha, dev) - memcpy(&mlist->mac_list[i++], ha->addr, ETH_ALEN); - - return i; -} - -/* - * Wait queue completion handler. - * - * This function waits on a cmd wait queue. It also cancels the pending - * request after waking up, in case of errors. - */ -int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter, - struct cmd_ctrl_node *cmd_queued) -{ - int status; - - /* Wait for completion */ - status = wait_event_interruptible(adapter->cmd_wait_q.wait, - *(cmd_queued->condition)); - if (status) { - dev_err(adapter->dev, "cmd_wait_q terminated: %d\n", status); - return status; - } - - status = adapter->cmd_wait_q.status; - adapter->cmd_wait_q.status = 0; - - return status; -} - -/* - * This function prepares the correct firmware command and - * issues it to set the multicast list. - * - * This function can be used to enable promiscuous mode, or enable all - * multicast packets, or to enable selective multicast. - */ -int mwifiex_request_set_multicast_list(struct mwifiex_private *priv, - struct mwifiex_multicast_list *mcast_list) -{ - int ret = 0; - u16 old_pkt_filter; - - old_pkt_filter = priv->curr_pkt_filter; - - if (mcast_list->mode == MWIFIEX_PROMISC_MODE) { - dev_dbg(priv->adapter->dev, "info: Enable Promiscuous mode\n"); - priv->curr_pkt_filter |= HostCmd_ACT_MAC_PROMISCUOUS_ENABLE; - priv->curr_pkt_filter &= - ~HostCmd_ACT_MAC_ALL_MULTICAST_ENABLE; - } else { - /* Multicast */ - priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_PROMISCUOUS_ENABLE; - if (mcast_list->mode == MWIFIEX_ALL_MULTI_MODE) { - dev_dbg(priv->adapter->dev, - "info: Enabling All Multicast!\n"); - priv->curr_pkt_filter |= - HostCmd_ACT_MAC_ALL_MULTICAST_ENABLE; - } else { - priv->curr_pkt_filter &= - ~HostCmd_ACT_MAC_ALL_MULTICAST_ENABLE; - dev_dbg(priv->adapter->dev, - "info: Set multicast list=%d\n", - mcast_list->num_multicast_addr); - /* Send multicast addresses to firmware */ - ret = mwifiex_send_cmd_async(priv, - HostCmd_CMD_MAC_MULTICAST_ADR, - HostCmd_ACT_GEN_SET, 0, - mcast_list); - } - } - dev_dbg(priv->adapter->dev, - "info: old_pkt_filter=%#x, curr_pkt_filter=%#x\n", - old_pkt_filter, priv->curr_pkt_filter); - if (old_pkt_filter != priv->curr_pkt_filter) { - ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL, - HostCmd_ACT_GEN_SET, - 0, &priv->curr_pkt_filter); - } - - return ret; -} - -/* - * This function fills bss descriptor structure using provided - * information. - * beacon_ie buffer is allocated in this function. It is caller's - * responsibility to free the memory. - */ -int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, - struct cfg80211_bss *bss, - struct mwifiex_bssdescriptor *bss_desc) -{ - u8 *beacon_ie; - size_t beacon_ie_len; - struct mwifiex_bss_priv *bss_priv = (void *)bss->priv; - const struct cfg80211_bss_ies *ies; - - rcu_read_lock(); - ies = rcu_dereference(bss->ies); - beacon_ie = kmemdup(ies->data, ies->len, GFP_ATOMIC); - beacon_ie_len = ies->len; - bss_desc->timestamp = ies->tsf; - rcu_read_unlock(); - - if (!beacon_ie) { - dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n"); - return -ENOMEM; - } - - memcpy(bss_desc->mac_address, bss->bssid, ETH_ALEN); - bss_desc->rssi = bss->signal; - /* The caller of this function will free beacon_ie */ - bss_desc->beacon_buf = beacon_ie; - bss_desc->beacon_buf_size = beacon_ie_len; - bss_desc->beacon_period = bss->beacon_interval; - bss_desc->cap_info_bitmap = bss->capability; - bss_desc->bss_band = bss_priv->band; - bss_desc->fw_tsf = bss_priv->fw_tsf; - if (bss_desc->cap_info_bitmap & WLAN_CAPABILITY_PRIVACY) { - dev_dbg(priv->adapter->dev, "info: InterpretIE: AP WEP enabled\n"); - bss_desc->privacy = MWIFIEX_802_11_PRIV_FILTER_8021X_WEP; - } else { - bss_desc->privacy = MWIFIEX_802_11_PRIV_FILTER_ACCEPT_ALL; - } - if (bss_desc->cap_info_bitmap & WLAN_CAPABILITY_IBSS) - bss_desc->bss_mode = NL80211_IFTYPE_ADHOC; - else - bss_desc->bss_mode = NL80211_IFTYPE_STATION; - - /* Disable 11ac by default. Enable it only where there - * exist VHT_CAP IE in AP beacon - */ - bss_desc->disable_11ac = true; - - return mwifiex_update_bss_desc_with_ie(priv->adapter, bss_desc); -} - -static int mwifiex_process_country_ie(struct mwifiex_private *priv, - struct cfg80211_bss *bss) -{ - const u8 *country_ie; - u8 country_ie_len; - struct mwifiex_802_11d_domain_reg *domain_info = - &priv->adapter->domain_reg; - - rcu_read_lock(); - country_ie = ieee80211_bss_get_ie(bss, WLAN_EID_COUNTRY); - if (!country_ie) { - rcu_read_unlock(); - return 0; - } - - country_ie_len = country_ie[1]; - if (country_ie_len < IEEE80211_COUNTRY_IE_MIN_LEN) { - rcu_read_unlock(); - return 0; - } - - domain_info->country_code[0] = country_ie[2]; - domain_info->country_code[1] = country_ie[3]; - domain_info->country_code[2] = ' '; - - country_ie_len -= IEEE80211_COUNTRY_STRING_LEN; - - domain_info->no_of_triplet = - country_ie_len / sizeof(struct ieee80211_country_ie_triplet); - - memcpy((u8 *)domain_info->triplet, - &country_ie[2] + IEEE80211_COUNTRY_STRING_LEN, country_ie_len); - - rcu_read_unlock(); - - if (mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11D_DOMAIN_INFO, - HostCmd_ACT_GEN_SET, 0, NULL)) { - wiphy_err(priv->adapter->wiphy, - "11D: setting domain info in FW\n"); - return -1; - } - - return 0; -} - -/* - * In Ad-Hoc mode, the IBSS is created if not found in scan list. - * In both Ad-Hoc and infra mode, an deauthentication is performed - * first. - */ -int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, - struct cfg80211_ssid *req_ssid) -{ - int ret; - struct mwifiex_adapter *adapter = priv->adapter; - struct mwifiex_bssdescriptor *bss_desc = NULL; - - priv->scan_block = false; - - if (bss) { - mwifiex_process_country_ie(priv, bss); - - /* Allocate and fill new bss descriptor */ - bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor), - GFP_KERNEL); - if (!bss_desc) - return -ENOMEM; - - ret = mwifiex_fill_new_bss_desc(priv, bss, bss_desc); - if (ret) - goto done; - } - - if (priv->bss_mode == NL80211_IFTYPE_STATION) { - /* Infra mode */ - ret = mwifiex_deauthenticate(priv, NULL); - if (ret) - goto done; - - if (bss_desc) { - u8 config_bands = 0; - - if (mwifiex_band_to_radio_type((u8) bss_desc->bss_band) - == HostCmd_SCAN_RADIO_TYPE_BG) - config_bands = BAND_B | BAND_G | BAND_GN | - BAND_GAC; - else - config_bands = BAND_A | BAND_AN | BAND_AAC; - - if (!((config_bands | adapter->fw_bands) & - ~adapter->fw_bands)) - adapter->config_bands = config_bands; - } - - ret = mwifiex_check_network_compatibility(priv, bss_desc); - if (ret) - goto done; - - dev_dbg(adapter->dev, "info: SSID found in scan list ... " - "associating...\n"); - - mwifiex_stop_net_dev_queue(priv->netdev, adapter); - if (netif_carrier_ok(priv->netdev)) - netif_carrier_off(priv->netdev); - - /* Clear any past association response stored for - * application retrieval */ - priv->assoc_rsp_size = 0; - ret = mwifiex_associate(priv, bss_desc); - - /* If auth type is auto and association fails using open mode, - * try to connect using shared mode */ - if (ret == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG && - priv->sec_info.is_authtype_auto && - priv->sec_info.wep_enabled) { - priv->sec_info.authentication_mode = - NL80211_AUTHTYPE_SHARED_KEY; - ret = mwifiex_associate(priv, bss_desc); - } - - if (bss) - cfg80211_put_bss(priv->adapter->wiphy, bss); - } else { - /* Adhoc mode */ - /* If the requested SSID matches current SSID, return */ - if (bss_desc && bss_desc->ssid.ssid_len && - (!mwifiex_ssid_cmp(&priv->curr_bss_params.bss_descriptor. - ssid, &bss_desc->ssid))) { - ret = 0; - goto done; - } - - /* Exit Adhoc mode first */ - dev_dbg(adapter->dev, "info: Sending Adhoc Stop\n"); - ret = mwifiex_deauthenticate(priv, NULL); - if (ret) - goto done; - - priv->adhoc_is_link_sensed = false; - - ret = mwifiex_check_network_compatibility(priv, bss_desc); - - mwifiex_stop_net_dev_queue(priv->netdev, adapter); - if (netif_carrier_ok(priv->netdev)) - netif_carrier_off(priv->netdev); - - if (!ret) { - dev_dbg(adapter->dev, "info: network found in scan" - " list. Joining...\n"); - ret = mwifiex_adhoc_join(priv, bss_desc); - if (bss) - cfg80211_put_bss(priv->adapter->wiphy, bss); - } else { - dev_dbg(adapter->dev, "info: Network not found in " - "the list, creating adhoc with ssid = %s\n", - req_ssid->ssid); - ret = mwifiex_adhoc_start(priv, req_ssid); - } - } - -done: - /* beacon_ie buffer was allocated in function - * mwifiex_fill_new_bss_desc(). Free it now. - */ - if (bss_desc) - kfree(bss_desc->beacon_buf); - kfree(bss_desc); - return ret; -} - -/* - * IOCTL request handler to set host sleep configuration. - * - * This function prepares the correct firmware command and - * issues it. - */ -static int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action, - int cmd_type, struct mwifiex_ds_hs_cfg *hs_cfg) - -{ - struct mwifiex_adapter *adapter = priv->adapter; - int status = 0; - u32 prev_cond = 0; - - if (!hs_cfg) - return -ENOMEM; - - switch (action) { - case HostCmd_ACT_GEN_SET: - if (adapter->pps_uapsd_mode) { - dev_dbg(adapter->dev, "info: Host Sleep IOCTL" - " is blocked in UAPSD/PPS mode\n"); - status = -1; - break; - } - if (hs_cfg->is_invoke_hostcmd) { - if (hs_cfg->conditions == HS_CFG_CANCEL) { - if (!adapter->is_hs_configured) - /* Already cancelled */ - break; - /* Save previous condition */ - prev_cond = le32_to_cpu(adapter->hs_cfg - .conditions); - adapter->hs_cfg.conditions = - cpu_to_le32(hs_cfg->conditions); - } else if (hs_cfg->conditions) { - adapter->hs_cfg.conditions = - cpu_to_le32(hs_cfg->conditions); - adapter->hs_cfg.gpio = (u8)hs_cfg->gpio; - if (hs_cfg->gap) - adapter->hs_cfg.gap = (u8)hs_cfg->gap; - } else if (adapter->hs_cfg.conditions == - cpu_to_le32(HS_CFG_CANCEL)) { - /* Return failure if no parameters for HS - enable */ - status = -1; - break; - } - if (cmd_type == MWIFIEX_SYNC_CMD) - status = mwifiex_send_cmd_sync(priv, - HostCmd_CMD_802_11_HS_CFG_ENH, - HostCmd_ACT_GEN_SET, 0, - &adapter->hs_cfg); - else - status = mwifiex_send_cmd_async(priv, - HostCmd_CMD_802_11_HS_CFG_ENH, - HostCmd_ACT_GEN_SET, 0, - &adapter->hs_cfg); - if (hs_cfg->conditions == HS_CFG_CANCEL) - /* Restore previous condition */ - adapter->hs_cfg.conditions = - cpu_to_le32(prev_cond); - } else { - adapter->hs_cfg.conditions = - cpu_to_le32(hs_cfg->conditions); - adapter->hs_cfg.gpio = (u8)hs_cfg->gpio; - adapter->hs_cfg.gap = (u8)hs_cfg->gap; - } - break; - case HostCmd_ACT_GEN_GET: - hs_cfg->conditions = le32_to_cpu(adapter->hs_cfg.conditions); - hs_cfg->gpio = adapter->hs_cfg.gpio; - hs_cfg->gap = adapter->hs_cfg.gap; - break; - default: - status = -1; - break; - } - - return status; -} - -/* - * Sends IOCTL request to cancel the existing Host Sleep configuration. - * - * This function allocates the IOCTL request buffer, fills it - * with requisite parameters and calls the IOCTL handler. - */ -int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type) -{ - struct mwifiex_ds_hs_cfg hscfg; - - hscfg.conditions = HS_CFG_CANCEL; - hscfg.is_invoke_hostcmd = true; - - return mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_SET, - cmd_type, &hscfg); -} -EXPORT_SYMBOL_GPL(mwifiex_cancel_hs); - -/* - * Sends IOCTL request to cancel the existing Host Sleep configuration. - * - * This function allocates the IOCTL request buffer, fills it - * with requisite parameters and calls the IOCTL handler. - */ -int mwifiex_enable_hs(struct mwifiex_adapter *adapter) -{ - struct mwifiex_ds_hs_cfg hscfg; - struct mwifiex_private *priv; - int i; - - if (disconnect_on_suspend) { - for (i = 0; i < adapter->priv_num; i++) { - priv = adapter->priv[i]; - if (priv) - mwifiex_deauthenticate(priv, NULL); - } - } - - if (adapter->hs_activated) { - dev_dbg(adapter->dev, "cmd: HS Already activated\n"); - return true; - } - - adapter->hs_activate_wait_q_woken = false; - - memset(&hscfg, 0, sizeof(struct mwifiex_ds_hs_cfg)); - hscfg.is_invoke_hostcmd = true; - - if (mwifiex_set_hs_params(mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_STA), - HostCmd_ACT_GEN_SET, MWIFIEX_SYNC_CMD, - &hscfg)) { - dev_err(adapter->dev, "IOCTL request HS enable failed\n"); - return false; - } - - if (wait_event_interruptible(adapter->hs_activate_wait_q, - adapter->hs_activate_wait_q_woken)) { - dev_err(adapter->dev, "hs_activate_wait_q terminated\n"); - return false; - } - - return true; -} -EXPORT_SYMBOL_GPL(mwifiex_enable_hs); - -/* - * IOCTL request handler to get BSS information. - * - * This function collates the information from different driver structures - * to send to the user. - */ -int mwifiex_get_bss_info(struct mwifiex_private *priv, - struct mwifiex_bss_info *info) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct mwifiex_bssdescriptor *bss_desc; - - if (!info) - return -1; - - bss_desc = &priv->curr_bss_params.bss_descriptor; - - info->bss_mode = priv->bss_mode; - - memcpy(&info->ssid, &bss_desc->ssid, sizeof(struct cfg80211_ssid)); - - memcpy(&info->bssid, &bss_desc->mac_address, ETH_ALEN); - - info->bss_chan = bss_desc->channel; - - memcpy(info->country_code, adapter->country_code, - IEEE80211_COUNTRY_STRING_LEN); - - info->media_connected = priv->media_connected; - - info->max_power_level = priv->max_tx_power_level; - info->min_power_level = priv->min_tx_power_level; - - info->adhoc_state = priv->adhoc_state; - - info->bcn_nf_last = priv->bcn_nf_last; - - if (priv->sec_info.wep_enabled) - info->wep_status = true; - else - info->wep_status = false; - - info->is_hs_configured = adapter->is_hs_configured; - info->is_deep_sleep = adapter->is_deep_sleep; - - return 0; -} - -/* - * The function disables auto deep sleep mode. - */ -int mwifiex_disable_auto_ds(struct mwifiex_private *priv) -{ - struct mwifiex_ds_auto_ds auto_ds; - - auto_ds.auto_ds = DEEP_SLEEP_OFF; - - return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_PS_MODE_ENH, - DIS_AUTO_PS, BITMAP_AUTO_DS, &auto_ds); -} -EXPORT_SYMBOL_GPL(mwifiex_disable_auto_ds); - -/* - * Sends IOCTL request to get the data rate. - * - * This function allocates the IOCTL request buffer, fills it - * with requisite parameters and calls the IOCTL handler. - */ -int mwifiex_drv_get_data_rate(struct mwifiex_private *priv, u32 *rate) -{ - int ret; - - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_TX_RATE_QUERY, - HostCmd_ACT_GEN_GET, 0, NULL); - - if (!ret) { - if (priv->is_data_rate_auto) - *rate = mwifiex_index_to_data_rate(priv, priv->tx_rate, - priv->tx_htinfo); - else - *rate = priv->data_rate; - } - - return ret; -} - -/* - * IOCTL request handler to set tx power configuration. - * - * This function prepares the correct firmware command and - * issues it. - * - * For non-auto power mode, all the following power groups are set - - * - Modulation class HR/DSSS - * - Modulation class OFDM - * - Modulation class HTBW20 - * - Modulation class HTBW40 - */ -int mwifiex_set_tx_power(struct mwifiex_private *priv, - struct mwifiex_power_cfg *power_cfg) -{ - int ret; - struct host_cmd_ds_txpwr_cfg *txp_cfg; - struct mwifiex_types_power_group *pg_tlv; - struct mwifiex_power_group *pg; - u8 *buf; - u16 dbm = 0; - - if (!power_cfg->is_power_auto) { - dbm = (u16) power_cfg->power_level; - if ((dbm < priv->min_tx_power_level) || - (dbm > priv->max_tx_power_level)) { - dev_err(priv->adapter->dev, "txpower value %d dBm" - " is out of range (%d dBm-%d dBm)\n", - dbm, priv->min_tx_power_level, - priv->max_tx_power_level); - return -1; - } - } - buf = kzalloc(MWIFIEX_SIZE_OF_CMD_BUFFER, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - txp_cfg = (struct host_cmd_ds_txpwr_cfg *) buf; - txp_cfg->action = cpu_to_le16(HostCmd_ACT_GEN_SET); - if (!power_cfg->is_power_auto) { - txp_cfg->mode = cpu_to_le32(1); - pg_tlv = (struct mwifiex_types_power_group *) - (buf + sizeof(struct host_cmd_ds_txpwr_cfg)); - pg_tlv->type = TLV_TYPE_POWER_GROUP; - pg_tlv->length = 4 * sizeof(struct mwifiex_power_group); - pg = (struct mwifiex_power_group *) - (buf + sizeof(struct host_cmd_ds_txpwr_cfg) - + sizeof(struct mwifiex_types_power_group)); - /* Power group for modulation class HR/DSSS */ - pg->first_rate_code = 0x00; - pg->last_rate_code = 0x03; - pg->modulation_class = MOD_CLASS_HR_DSSS; - pg->power_step = 0; - pg->power_min = (s8) dbm; - pg->power_max = (s8) dbm; - pg++; - /* Power group for modulation class OFDM */ - pg->first_rate_code = 0x00; - pg->last_rate_code = 0x07; - pg->modulation_class = MOD_CLASS_OFDM; - pg->power_step = 0; - pg->power_min = (s8) dbm; - pg->power_max = (s8) dbm; - pg++; - /* Power group for modulation class HTBW20 */ - pg->first_rate_code = 0x00; - pg->last_rate_code = 0x20; - pg->modulation_class = MOD_CLASS_HT; - pg->power_step = 0; - pg->power_min = (s8) dbm; - pg->power_max = (s8) dbm; - pg->ht_bandwidth = HT_BW_20; - pg++; - /* Power group for modulation class HTBW40 */ - pg->first_rate_code = 0x00; - pg->last_rate_code = 0x20; - pg->modulation_class = MOD_CLASS_HT; - pg->power_step = 0; - pg->power_min = (s8) dbm; - pg->power_max = (s8) dbm; - pg->ht_bandwidth = HT_BW_40; - } - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_TXPWR_CFG, - HostCmd_ACT_GEN_SET, 0, buf); - - kfree(buf); - return ret; -} - -/* - * IOCTL request handler to get power save mode. - * - * This function prepares the correct firmware command and - * issues it. - */ -int mwifiex_drv_set_power(struct mwifiex_private *priv, u32 *ps_mode) -{ - int ret; - struct mwifiex_adapter *adapter = priv->adapter; - u16 sub_cmd; - - if (*ps_mode) - adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP; - else - adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; - sub_cmd = (*ps_mode) ? EN_AUTO_PS : DIS_AUTO_PS; - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_PS_MODE_ENH, - sub_cmd, BITMAP_STA_PS, NULL); - if ((!ret) && (sub_cmd == DIS_AUTO_PS)) - ret = mwifiex_send_cmd_async(priv, - HostCmd_CMD_802_11_PS_MODE_ENH, - GET_PS, 0, NULL); - - return ret; -} - -/* - * IOCTL request handler to set/reset WPA IE. - * - * The supplied WPA IE is treated as a opaque buffer. Only the first field - * is checked to determine WPA version. If buffer length is zero, the existing - * WPA IE is reset. - */ -static int mwifiex_set_wpa_ie_helper(struct mwifiex_private *priv, - u8 *ie_data_ptr, u16 ie_len) -{ - if (ie_len) { - if (ie_len > sizeof(priv->wpa_ie)) { - dev_err(priv->adapter->dev, - "failed to copy WPA IE, too big\n"); - return -1; - } - memcpy(priv->wpa_ie, ie_data_ptr, ie_len); - priv->wpa_ie_len = (u8) ie_len; - dev_dbg(priv->adapter->dev, "cmd: Set Wpa_ie_len=%d IE=%#x\n", - priv->wpa_ie_len, priv->wpa_ie[0]); - - if (priv->wpa_ie[0] == WLAN_EID_VENDOR_SPECIFIC) { - priv->sec_info.wpa_enabled = true; - } else if (priv->wpa_ie[0] == WLAN_EID_RSN) { - priv->sec_info.wpa2_enabled = true; - } else { - priv->sec_info.wpa_enabled = false; - priv->sec_info.wpa2_enabled = false; - } - } else { - memset(priv->wpa_ie, 0, sizeof(priv->wpa_ie)); - priv->wpa_ie_len = 0; - dev_dbg(priv->adapter->dev, "info: reset wpa_ie_len=%d IE=%#x\n", - priv->wpa_ie_len, priv->wpa_ie[0]); - priv->sec_info.wpa_enabled = false; - priv->sec_info.wpa2_enabled = false; - } - - return 0; -} - -/* - * IOCTL request handler to set/reset WAPI IE. - * - * The supplied WAPI IE is treated as a opaque buffer. Only the first field - * is checked to internally enable WAPI. If buffer length is zero, the existing - * WAPI IE is reset. - */ -static int mwifiex_set_wapi_ie(struct mwifiex_private *priv, - u8 *ie_data_ptr, u16 ie_len) -{ - if (ie_len) { - if (ie_len > sizeof(priv->wapi_ie)) { - dev_dbg(priv->adapter->dev, - "info: failed to copy WAPI IE, too big\n"); - return -1; - } - memcpy(priv->wapi_ie, ie_data_ptr, ie_len); - priv->wapi_ie_len = ie_len; - dev_dbg(priv->adapter->dev, "cmd: Set wapi_ie_len=%d IE=%#x\n", - priv->wapi_ie_len, priv->wapi_ie[0]); - - if (priv->wapi_ie[0] == WLAN_EID_BSS_AC_ACCESS_DELAY) - priv->sec_info.wapi_enabled = true; - } else { - memset(priv->wapi_ie, 0, sizeof(priv->wapi_ie)); - priv->wapi_ie_len = ie_len; - dev_dbg(priv->adapter->dev, - "info: Reset wapi_ie_len=%d IE=%#x\n", - priv->wapi_ie_len, priv->wapi_ie[0]); - priv->sec_info.wapi_enabled = false; - } - return 0; -} - -/* - * IOCTL request handler to set/reset WPS IE. - * - * The supplied WPS IE is treated as a opaque buffer. Only the first field - * is checked to internally enable WPS. If buffer length is zero, the existing - * WPS IE is reset. - */ -static int mwifiex_set_wps_ie(struct mwifiex_private *priv, - u8 *ie_data_ptr, u16 ie_len) -{ - if (ie_len) { - priv->wps_ie = kzalloc(MWIFIEX_MAX_VSIE_LEN, GFP_KERNEL); - if (!priv->wps_ie) - return -ENOMEM; - if (ie_len > sizeof(priv->wps_ie)) { - dev_dbg(priv->adapter->dev, - "info: failed to copy WPS IE, too big\n"); - kfree(priv->wps_ie); - return -1; - } - memcpy(priv->wps_ie, ie_data_ptr, ie_len); - priv->wps_ie_len = ie_len; - dev_dbg(priv->adapter->dev, "cmd: Set wps_ie_len=%d IE=%#x\n", - priv->wps_ie_len, priv->wps_ie[0]); - } else { - kfree(priv->wps_ie); - priv->wps_ie_len = ie_len; - dev_dbg(priv->adapter->dev, - "info: Reset wps_ie_len=%d\n", priv->wps_ie_len); - } - return 0; -} - -/* - * IOCTL request handler to set WAPI key. - * - * This function prepares the correct firmware command and - * issues it. - */ -static int mwifiex_sec_ioctl_set_wapi_key(struct mwifiex_private *priv, - struct mwifiex_ds_encrypt_key *encrypt_key) -{ - - return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_KEY_MATERIAL, - HostCmd_ACT_GEN_SET, KEY_INFO_ENABLED, - encrypt_key); -} - -/* - * IOCTL request handler to set WEP network key. - * - * This function prepares the correct firmware command and - * issues it, after validation checks. - */ -static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private *priv, - struct mwifiex_ds_encrypt_key *encrypt_key) -{ - int ret; - struct mwifiex_wep_key *wep_key; - int index; - - if (priv->wep_key_curr_index >= NUM_WEP_KEYS) - priv->wep_key_curr_index = 0; - wep_key = &priv->wep_key[priv->wep_key_curr_index]; - index = encrypt_key->key_index; - if (encrypt_key->key_disable) { - priv->sec_info.wep_enabled = 0; - } else if (!encrypt_key->key_len) { - /* Copy the required key as the current key */ - wep_key = &priv->wep_key[index]; - if (!wep_key->key_length) { - dev_err(priv->adapter->dev, - "key not set, so cannot enable it\n"); - return -1; - } - priv->wep_key_curr_index = (u16) index; - priv->sec_info.wep_enabled = 1; - } else { - wep_key = &priv->wep_key[index]; - memset(wep_key, 0, sizeof(struct mwifiex_wep_key)); - /* Copy the key in the driver */ - memcpy(wep_key->key_material, - encrypt_key->key_material, - encrypt_key->key_len); - wep_key->key_index = index; - wep_key->key_length = encrypt_key->key_len; - priv->sec_info.wep_enabled = 1; - } - if (wep_key->key_length) { - /* Send request to firmware */ - ret = mwifiex_send_cmd_async(priv, - HostCmd_CMD_802_11_KEY_MATERIAL, - HostCmd_ACT_GEN_SET, 0, NULL); - if (ret) - return ret; - } - if (priv->sec_info.wep_enabled) - priv->curr_pkt_filter |= HostCmd_ACT_MAC_WEP_ENABLE; - else - priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_WEP_ENABLE; - - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_MAC_CONTROL, - HostCmd_ACT_GEN_SET, 0, - &priv->curr_pkt_filter); - - return ret; -} - -/* - * IOCTL request handler to set WPA key. - * - * This function prepares the correct firmware command and - * issues it, after validation checks. - * - * Current driver only supports key length of up to 32 bytes. - * - * This function can also be used to disable a currently set key. - */ -static int mwifiex_sec_ioctl_set_wpa_key(struct mwifiex_private *priv, - struct mwifiex_ds_encrypt_key *encrypt_key) -{ - int ret; - u8 remove_key = false; - struct host_cmd_ds_802_11_key_material *ibss_key; - - /* Current driver only supports key length of up to 32 bytes */ - if (encrypt_key->key_len > WLAN_MAX_KEY_LEN) { - dev_err(priv->adapter->dev, "key length too long\n"); - return -1; - } - - if (priv->bss_mode == NL80211_IFTYPE_ADHOC) { - /* - * IBSS/WPA-None uses only one key (Group) for both receiving - * and sending unicast and multicast packets. - */ - /* Send the key as PTK to firmware */ - encrypt_key->key_index = MWIFIEX_KEY_INDEX_UNICAST; - ret = mwifiex_send_cmd_async(priv, - HostCmd_CMD_802_11_KEY_MATERIAL, - HostCmd_ACT_GEN_SET, - KEY_INFO_ENABLED, encrypt_key); - if (ret) - return ret; - - ibss_key = &priv->aes_key; - memset(ibss_key, 0, - sizeof(struct host_cmd_ds_802_11_key_material)); - /* Copy the key in the driver */ - memcpy(ibss_key->key_param_set.key, encrypt_key->key_material, - encrypt_key->key_len); - memcpy(&ibss_key->key_param_set.key_len, &encrypt_key->key_len, - sizeof(ibss_key->key_param_set.key_len)); - ibss_key->key_param_set.key_type_id - = cpu_to_le16(KEY_TYPE_ID_TKIP); - ibss_key->key_param_set.key_info = cpu_to_le16(KEY_ENABLED); - - /* Send the key as GTK to firmware */ - encrypt_key->key_index = ~MWIFIEX_KEY_INDEX_UNICAST; - } - - if (!encrypt_key->key_index) - encrypt_key->key_index = MWIFIEX_KEY_INDEX_UNICAST; - - if (remove_key) - ret = mwifiex_send_cmd_sync(priv, - HostCmd_CMD_802_11_KEY_MATERIAL, - HostCmd_ACT_GEN_SET, - !KEY_INFO_ENABLED, encrypt_key); - else - ret = mwifiex_send_cmd_sync(priv, - HostCmd_CMD_802_11_KEY_MATERIAL, - HostCmd_ACT_GEN_SET, - KEY_INFO_ENABLED, encrypt_key); - - return ret; -} - -/* - * IOCTL request handler to set/get network keys. - * - * This is a generic key handling function which supports WEP, WPA - * and WAPI. - */ -static int -mwifiex_sec_ioctl_encrypt_key(struct mwifiex_private *priv, - struct mwifiex_ds_encrypt_key *encrypt_key) -{ - int status; - - if (encrypt_key->is_wapi_key) - status = mwifiex_sec_ioctl_set_wapi_key(priv, encrypt_key); - else if (encrypt_key->key_len > WLAN_KEY_LEN_WEP104) - status = mwifiex_sec_ioctl_set_wpa_key(priv, encrypt_key); - else - status = mwifiex_sec_ioctl_set_wep_key(priv, encrypt_key); - return status; -} - -/* - * This function returns the driver version. - */ -int -mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter, char *version, - int max_len) -{ - union { - u32 l; - u8 c[4]; - } ver; - char fw_ver[32]; - - ver.l = adapter->fw_release_number; - sprintf(fw_ver, "%u.%u.%u.p%u", ver.c[2], ver.c[1], ver.c[0], ver.c[3]); - - snprintf(version, max_len, driver_version, fw_ver); - - dev_dbg(adapter->dev, "info: MWIFIEX VERSION: %s\n", version); - - return 0; -} - -/* - * Sends IOCTL request to set encoding parameters. - * - * This function allocates the IOCTL request buffer, fills it - * with requisite parameters and calls the IOCTL handler. - */ -int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp, - const u8 *key, int key_len, u8 key_index, - const u8 *mac_addr, int disable) -{ - struct mwifiex_ds_encrypt_key encrypt_key; - - memset(&encrypt_key, 0, sizeof(struct mwifiex_ds_encrypt_key)); - encrypt_key.key_len = key_len; - - if (kp && kp->cipher == WLAN_CIPHER_SUITE_AES_CMAC) - encrypt_key.is_igtk_key = true; - - if (!disable) { - encrypt_key.key_index = key_index; - if (key_len) - memcpy(encrypt_key.key_material, key, key_len); - if (mac_addr) - memcpy(encrypt_key.mac_addr, mac_addr, ETH_ALEN); - if (kp && kp->seq && kp->seq_len) - memcpy(encrypt_key.pn, kp->seq, kp->seq_len); - } else { - encrypt_key.key_disable = true; - if (mac_addr) - memcpy(encrypt_key.mac_addr, mac_addr, ETH_ALEN); - } - - return mwifiex_sec_ioctl_encrypt_key(priv, &encrypt_key); -} - -/* - * Sends IOCTL request to get extended version. - * - * This function allocates the IOCTL request buffer, fills it - * with requisite parameters and calls the IOCTL handler. - */ -int -mwifiex_get_ver_ext(struct mwifiex_private *priv) -{ - struct mwifiex_ver_ext ver_ext; - - memset(&ver_ext, 0, sizeof(struct host_cmd_ds_version_ext)); - if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_VERSION_EXT, - HostCmd_ACT_GEN_GET, 0, &ver_ext)) - return -1; - - return 0; -} - -int -mwifiex_remain_on_chan_cfg(struct mwifiex_private *priv, u16 action, - struct ieee80211_channel *chan, - unsigned int duration) -{ - struct host_cmd_ds_remain_on_chan roc_cfg; - u8 sc; - - memset(&roc_cfg, 0, sizeof(roc_cfg)); - roc_cfg.action = cpu_to_le16(action); - if (action == HostCmd_ACT_GEN_SET) { - roc_cfg.band_cfg = chan->band; - sc = mwifiex_chan_type_to_sec_chan_offset(NL80211_CHAN_NO_HT); - roc_cfg.band_cfg |= (sc << 2); - - roc_cfg.channel = - ieee80211_frequency_to_channel(chan->center_freq); - roc_cfg.duration = cpu_to_le32(duration); - } - if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_REMAIN_ON_CHAN, - action, 0, &roc_cfg)) { - dev_err(priv->adapter->dev, "failed to remain on channel\n"); - return -1; - } - - return roc_cfg.status; -} - -int -mwifiex_set_bss_role(struct mwifiex_private *priv, u8 bss_role) -{ - if (GET_BSS_ROLE(priv) == bss_role) { - dev_dbg(priv->adapter->dev, - "info: already in the desired role.\n"); - return 0; - } - - mwifiex_free_priv(priv); - mwifiex_init_priv(priv); - - priv->bss_role = bss_role; - switch (bss_role) { - case MWIFIEX_BSS_ROLE_UAP: - priv->bss_mode = NL80211_IFTYPE_AP; - break; - case MWIFIEX_BSS_ROLE_STA: - case MWIFIEX_BSS_ROLE_ANY: - default: - priv->bss_mode = NL80211_IFTYPE_STATION; - break; - } - - mwifiex_send_cmd_sync(priv, HostCmd_CMD_SET_BSS_MODE, - HostCmd_ACT_GEN_SET, 0, NULL); - - return mwifiex_sta_init_cmd(priv, false); -} - -/* - * Sends IOCTL request to get statistics information. - * - * This function allocates the IOCTL request buffer, fills it - * with requisite parameters and calls the IOCTL handler. - */ -int -mwifiex_get_stats_info(struct mwifiex_private *priv, - struct mwifiex_ds_get_stats *log) -{ - return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_GET_LOG, - HostCmd_ACT_GEN_GET, 0, log); -} - -/* - * IOCTL request handler to read/write register. - * - * This function prepares the correct firmware command and - * issues it. - * - * Access to the following registers are supported - - * - MAC - * - BBP - * - RF - * - PMIC - * - CAU - */ -static int mwifiex_reg_mem_ioctl_reg_rw(struct mwifiex_private *priv, - struct mwifiex_ds_reg_rw *reg_rw, - u16 action) -{ - u16 cmd_no; - - switch (le32_to_cpu(reg_rw->type)) { - case MWIFIEX_REG_MAC: - cmd_no = HostCmd_CMD_MAC_REG_ACCESS; - break; - case MWIFIEX_REG_BBP: - cmd_no = HostCmd_CMD_BBP_REG_ACCESS; - break; - case MWIFIEX_REG_RF: - cmd_no = HostCmd_CMD_RF_REG_ACCESS; - break; - case MWIFIEX_REG_PMIC: - cmd_no = HostCmd_CMD_PMIC_REG_ACCESS; - break; - case MWIFIEX_REG_CAU: - cmd_no = HostCmd_CMD_CAU_REG_ACCESS; - break; - default: - return -1; - } - - return mwifiex_send_cmd_sync(priv, cmd_no, action, 0, reg_rw); - -} - -/* - * Sends IOCTL request to write to a register. - * - * This function allocates the IOCTL request buffer, fills it - * with requisite parameters and calls the IOCTL handler. - */ -int -mwifiex_reg_write(struct mwifiex_private *priv, u32 reg_type, - u32 reg_offset, u32 reg_value) -{ - struct mwifiex_ds_reg_rw reg_rw; - - reg_rw.type = cpu_to_le32(reg_type); - reg_rw.offset = cpu_to_le32(reg_offset); - reg_rw.value = cpu_to_le32(reg_value); - - return mwifiex_reg_mem_ioctl_reg_rw(priv, ®_rw, HostCmd_ACT_GEN_SET); -} - -/* - * Sends IOCTL request to read from a register. - * - * This function allocates the IOCTL request buffer, fills it - * with requisite parameters and calls the IOCTL handler. - */ -int -mwifiex_reg_read(struct mwifiex_private *priv, u32 reg_type, - u32 reg_offset, u32 *value) -{ - int ret; - struct mwifiex_ds_reg_rw reg_rw; - - reg_rw.type = cpu_to_le32(reg_type); - reg_rw.offset = cpu_to_le32(reg_offset); - ret = mwifiex_reg_mem_ioctl_reg_rw(priv, ®_rw, HostCmd_ACT_GEN_GET); - - if (ret) - goto done; - - *value = le32_to_cpu(reg_rw.value); - -done: - return ret; -} - -/* - * Sends IOCTL request to read from EEPROM. - * - * This function allocates the IOCTL request buffer, fills it - * with requisite parameters and calls the IOCTL handler. - */ -int -mwifiex_eeprom_read(struct mwifiex_private *priv, u16 offset, u16 bytes, - u8 *value) -{ - int ret; - struct mwifiex_ds_read_eeprom rd_eeprom; - - rd_eeprom.offset = cpu_to_le16((u16) offset); - rd_eeprom.byte_count = cpu_to_le16((u16) bytes); - - /* Send request to firmware */ - ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_EEPROM_ACCESS, - HostCmd_ACT_GEN_GET, 0, &rd_eeprom); - - if (!ret) - memcpy(value, rd_eeprom.value, MAX_EEPROM_DATA); - return ret; -} - -/* - * This function sets a generic IE. In addition to generic IE, it can - * also handle WPA, WPA2 and WAPI IEs. - */ -static int -mwifiex_set_gen_ie_helper(struct mwifiex_private *priv, u8 *ie_data_ptr, - u16 ie_len) -{ - int ret = 0; - struct ieee_types_vendor_header *pvendor_ie; - const u8 wpa_oui[] = { 0x00, 0x50, 0xf2, 0x01 }; - const u8 wps_oui[] = { 0x00, 0x50, 0xf2, 0x04 }; - - /* If the passed length is zero, reset the buffer */ - if (!ie_len) { - priv->gen_ie_buf_len = 0; - priv->wps.session_enable = false; - - return 0; - } else if (!ie_data_ptr) { - return -1; - } - pvendor_ie = (struct ieee_types_vendor_header *) ie_data_ptr; - /* Test to see if it is a WPA IE, if not, then it is a gen IE */ - if (((pvendor_ie->element_id == WLAN_EID_VENDOR_SPECIFIC) && - (!memcmp(pvendor_ie->oui, wpa_oui, sizeof(wpa_oui)))) || - (pvendor_ie->element_id == WLAN_EID_RSN)) { - - /* IE is a WPA/WPA2 IE so call set_wpa function */ - ret = mwifiex_set_wpa_ie_helper(priv, ie_data_ptr, ie_len); - priv->wps.session_enable = false; - - return ret; - } else if (pvendor_ie->element_id == WLAN_EID_BSS_AC_ACCESS_DELAY) { - /* IE is a WAPI IE so call set_wapi function */ - ret = mwifiex_set_wapi_ie(priv, ie_data_ptr, ie_len); - - return ret; - } - /* - * Verify that the passed length is not larger than the - * available space remaining in the buffer - */ - if (ie_len < (sizeof(priv->gen_ie_buf) - priv->gen_ie_buf_len)) { - - /* Test to see if it is a WPS IE, if so, enable - * wps session flag - */ - pvendor_ie = (struct ieee_types_vendor_header *) ie_data_ptr; - if ((pvendor_ie->element_id == WLAN_EID_VENDOR_SPECIFIC) && - (!memcmp(pvendor_ie->oui, wps_oui, sizeof(wps_oui)))) { - priv->wps.session_enable = true; - dev_dbg(priv->adapter->dev, - "info: WPS Session Enabled.\n"); - ret = mwifiex_set_wps_ie(priv, ie_data_ptr, ie_len); - } - - /* Append the passed data to the end of the - genIeBuffer */ - memcpy(priv->gen_ie_buf + priv->gen_ie_buf_len, ie_data_ptr, - ie_len); - /* Increment the stored buffer length by the - size passed */ - priv->gen_ie_buf_len += ie_len; - } else { - /* Passed data does not fit in the remaining - buffer space */ - ret = -1; - } - - /* Return 0, or -1 for error case */ - return ret; -} - -/* - * IOCTL request handler to set/get generic IE. - * - * In addition to various generic IEs, this function can also be - * used to set the ARP filter. - */ -static int mwifiex_misc_ioctl_gen_ie(struct mwifiex_private *priv, - struct mwifiex_ds_misc_gen_ie *gen_ie, - u16 action) -{ - struct mwifiex_adapter *adapter = priv->adapter; - - switch (gen_ie->type) { - case MWIFIEX_IE_TYPE_GEN_IE: - if (action == HostCmd_ACT_GEN_GET) { - gen_ie->len = priv->wpa_ie_len; - memcpy(gen_ie->ie_data, priv->wpa_ie, gen_ie->len); - } else { - mwifiex_set_gen_ie_helper(priv, gen_ie->ie_data, - (u16) gen_ie->len); - } - break; - case MWIFIEX_IE_TYPE_ARP_FILTER: - memset(adapter->arp_filter, 0, sizeof(adapter->arp_filter)); - if (gen_ie->len > ARP_FILTER_MAX_BUF_SIZE) { - adapter->arp_filter_size = 0; - dev_err(adapter->dev, "invalid ARP filter size\n"); - return -1; - } else { - memcpy(adapter->arp_filter, gen_ie->ie_data, - gen_ie->len); - adapter->arp_filter_size = gen_ie->len; - } - break; - default: - dev_err(adapter->dev, "invalid IE type\n"); - return -1; - } - return 0; -} - -/* - * Sends IOCTL request to set a generic IE. - * - * This function allocates the IOCTL request buffer, fills it - * with requisite parameters and calls the IOCTL handler. - */ -int -mwifiex_set_gen_ie(struct mwifiex_private *priv, u8 *ie, int ie_len) -{ - struct mwifiex_ds_misc_gen_ie gen_ie; - - if (ie_len > IEEE_MAX_IE_SIZE) - return -EFAULT; - - gen_ie.type = MWIFIEX_IE_TYPE_GEN_IE; - gen_ie.len = ie_len; - memcpy(gen_ie.ie_data, ie, ie_len); - if (mwifiex_misc_ioctl_gen_ie(priv, &gen_ie, HostCmd_ACT_GEN_SET)) - return -EFAULT; - - return 0; -} diff --git a/drivers/net/wireless/mwifiex/sta_rx.c b/drivers/net/wireless/mwifiex/sta_rx.c deleted file mode 100644 index b5c109504393..000000000000 --- a/drivers/net/wireless/mwifiex/sta_rx.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Marvell Wireless LAN device driver: station RX data handling - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "11n_aggr.h" -#include "11n_rxreorder.h" - -/* - * This function processes the received packet and forwards it - * to kernel/upper layer. - * - * This function parses through the received packet and determines - * if it is a debug packet or normal packet. - * - * For non-debug packets, the function chops off unnecessary leading - * header bytes, reconstructs the packet as an ethernet frame or - * 802.2/llc/snap frame as required, and sends it to kernel/upper layer. - * - * The completion callback is called after processing in complete. - */ -int mwifiex_process_rx_packet(struct mwifiex_private *priv, - struct sk_buff *skb) -{ - int ret; - struct rx_packet_hdr *rx_pkt_hdr; - struct rxpd *local_rx_pd; - int hdr_chop; - struct ethhdr *eth_hdr; - u8 rfc1042_eth_hdr[ETH_ALEN] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; - - local_rx_pd = (struct rxpd *) (skb->data); - - rx_pkt_hdr = (void *)local_rx_pd + - le16_to_cpu(local_rx_pd->rx_pkt_offset); - - if (!memcmp(&rx_pkt_hdr->rfc1042_hdr, - rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr))) { - /* - * Replace the 803 header and rfc1042 header (llc/snap) with an - * EthernetII header, keep the src/dst and snap_type - * (ethertype). - * The firmware only passes up SNAP frames converting - * all RX Data from 802.11 to 802.2/LLC/SNAP frames. - * To create the Ethernet II, just move the src, dst address - * right before the snap_type. - */ - eth_hdr = (struct ethhdr *) - ((u8 *) &rx_pkt_hdr->eth803_hdr - + sizeof(rx_pkt_hdr->eth803_hdr) + - sizeof(rx_pkt_hdr->rfc1042_hdr) - - sizeof(rx_pkt_hdr->eth803_hdr.h_dest) - - sizeof(rx_pkt_hdr->eth803_hdr.h_source) - - sizeof(rx_pkt_hdr->rfc1042_hdr.snap_type)); - - memcpy(eth_hdr->h_source, rx_pkt_hdr->eth803_hdr.h_source, - sizeof(eth_hdr->h_source)); - memcpy(eth_hdr->h_dest, rx_pkt_hdr->eth803_hdr.h_dest, - sizeof(eth_hdr->h_dest)); - - /* Chop off the rxpd + the excess memory from the 802.2/llc/snap - header that was removed. */ - hdr_chop = (u8 *) eth_hdr - (u8 *) local_rx_pd; - } else { - /* Chop off the rxpd */ - hdr_chop = (u8 *) &rx_pkt_hdr->eth803_hdr - - (u8 *) local_rx_pd; - } - - /* Chop off the leading header bytes so the it points to the start of - either the reconstructed EthII frame or the 802.2/llc/snap frame */ - skb_pull(skb, hdr_chop); - - priv->rxpd_rate = local_rx_pd->rx_rate; - - priv->rxpd_htinfo = local_rx_pd->ht_info; - - ret = mwifiex_recv_packet(priv, skb); - if (ret == -1) - dev_err(priv->adapter->dev, "recv packet failed\n"); - - return ret; -} - -/* - * This function processes the received buffer. - * - * The function looks into the RxPD and performs sanity tests on the - * received buffer to ensure its a valid packet, before processing it - * further. If the packet is determined to be aggregated, it is - * de-aggregated accordingly. Non-unicast packets are sent directly to - * the kernel/upper layers. Unicast packets are handed over to the - * Rx reordering routine if 11n is enabled. - * - * The completion callback is called after processing in complete. - */ -int mwifiex_process_sta_rx_packet(struct mwifiex_private *priv, - struct sk_buff *skb) -{ - struct mwifiex_adapter *adapter = priv->adapter; - int ret = 0; - struct rxpd *local_rx_pd; - struct rx_packet_hdr *rx_pkt_hdr; - u8 ta[ETH_ALEN]; - u16 rx_pkt_type, rx_pkt_offset, rx_pkt_length, seq_num; - - local_rx_pd = (struct rxpd *) (skb->data); - rx_pkt_type = le16_to_cpu(local_rx_pd->rx_pkt_type); - rx_pkt_offset = le16_to_cpu(local_rx_pd->rx_pkt_offset); - rx_pkt_length = le16_to_cpu(local_rx_pd->rx_pkt_length); - seq_num = le16_to_cpu(local_rx_pd->seq_num); - - rx_pkt_hdr = (void *)local_rx_pd + rx_pkt_offset; - - if ((rx_pkt_offset + rx_pkt_length) > (u16) skb->len) { - dev_err(adapter->dev, - "wrong rx packet: len=%d, rx_pkt_offset=%d, rx_pkt_length=%d\n", - skb->len, rx_pkt_offset, rx_pkt_length); - priv->stats.rx_dropped++; - - if (adapter->if_ops.data_complete) - adapter->if_ops.data_complete(adapter, skb); - else - dev_kfree_skb_any(skb); - - return ret; - } - - if (rx_pkt_type == PKT_TYPE_AMSDU) { - struct sk_buff_head list; - struct sk_buff *rx_skb; - - __skb_queue_head_init(&list); - - skb_pull(skb, rx_pkt_offset); - skb_trim(skb, rx_pkt_length); - - ieee80211_amsdu_to_8023s(skb, &list, priv->curr_addr, - priv->wdev->iftype, 0, false); - - while (!skb_queue_empty(&list)) { - rx_skb = __skb_dequeue(&list); - ret = mwifiex_recv_packet(priv, rx_skb); - if (ret == -1) - dev_err(adapter->dev, "Rx of A-MSDU failed"); - } - return 0; - } else if (rx_pkt_type == PKT_TYPE_MGMT) { - ret = mwifiex_process_mgmt_packet(priv, skb); - if (ret) - dev_err(adapter->dev, "Rx of mgmt packet failed"); - dev_kfree_skb_any(skb); - return ret; - } - - /* - * If the packet is not an unicast packet then send the packet - * directly to os. Don't pass thru rx reordering - */ - if (!IS_11N_ENABLED(priv) || - memcmp(priv->curr_addr, rx_pkt_hdr->eth803_hdr.h_dest, ETH_ALEN)) { - mwifiex_process_rx_packet(priv, skb); - return ret; - } - - if (mwifiex_queuing_ra_based(priv)) { - memcpy(ta, rx_pkt_hdr->eth803_hdr.h_source, ETH_ALEN); - } else { - if (rx_pkt_type != PKT_TYPE_BAR) - priv->rx_seq[local_rx_pd->priority] = seq_num; - memcpy(ta, priv->curr_bss_params.bss_descriptor.mac_address, - ETH_ALEN); - } - - /* Reorder and send to OS */ - ret = mwifiex_11n_rx_reorder_pkt(priv, seq_num, local_rx_pd->priority, - ta, (u8) rx_pkt_type, skb); - - if (ret || (rx_pkt_type == PKT_TYPE_BAR)) { - if (adapter->if_ops.data_complete) - adapter->if_ops.data_complete(adapter, skb); - else - dev_kfree_skb_any(skb); - } - - if (ret) - priv->stats.rx_dropped++; - - return ret; -} diff --git a/drivers/net/wireless/mwifiex/sta_tx.c b/drivers/net/wireless/mwifiex/sta_tx.c deleted file mode 100644 index 7b581af24f5f..000000000000 --- a/drivers/net/wireless/mwifiex/sta_tx.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Marvell Wireless LAN device driver: station TX data handling - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" - -/* - * This function fills the TxPD for tx packets. - * - * The Tx buffer received by this function should already have the - * header space allocated for TxPD. - * - * This function inserts the TxPD in between interface header and actual - * data and adjusts the buffer pointers accordingly. - * - * The following TxPD fields are set by this function, as required - - * - BSS number - * - Tx packet length and offset - * - Priority - * - Packet delay - * - Priority specific Tx control - * - Flags - */ -void *mwifiex_process_sta_txpd(struct mwifiex_private *priv, - struct sk_buff *skb) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct txpd *local_tx_pd; - struct mwifiex_txinfo *tx_info = MWIFIEX_SKB_TXCB(skb); - u8 pad; - u16 pkt_type, pkt_offset; - - if (!skb->len) { - dev_err(adapter->dev, "Tx: bad packet length: %d\n", skb->len); - tx_info->status_code = -1; - return skb->data; - } - - pkt_type = mwifiex_is_skb_mgmt_frame(skb) ? PKT_TYPE_MGMT : 0; - - /* If skb->data is not aligned; add padding */ - pad = (4 - (((void *)skb->data - NULL) & 0x3)) % 4; - - BUG_ON(skb_headroom(skb) < (sizeof(*local_tx_pd) + INTF_HEADER_LEN - + pad)); - skb_push(skb, sizeof(*local_tx_pd) + pad); - - local_tx_pd = (struct txpd *) skb->data; - memset(local_tx_pd, 0, sizeof(struct txpd)); - local_tx_pd->bss_num = priv->bss_num; - local_tx_pd->bss_type = priv->bss_type; - local_tx_pd->tx_pkt_length = cpu_to_le16((u16)(skb->len - - (sizeof(struct txpd) - + pad))); - - local_tx_pd->priority = (u8) skb->priority; - local_tx_pd->pkt_delay_2ms = - mwifiex_wmm_compute_drv_pkt_delay(priv, skb); - - if (local_tx_pd->priority < - ARRAY_SIZE(priv->wmm.user_pri_pkt_tx_ctrl)) - /* - * Set the priority specific tx_control field, setting of 0 will - * cause the default value to be used later in this function - */ - local_tx_pd->tx_control = - cpu_to_le32(priv->wmm.user_pri_pkt_tx_ctrl[local_tx_pd-> - priority]); - - if (adapter->pps_uapsd_mode) { - if (mwifiex_check_last_packet_indication(priv)) { - adapter->tx_lock_flag = true; - local_tx_pd->flags = - MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET; - } - } - - /* Offset of actual data */ - pkt_offset = sizeof(struct txpd) + pad; - if (pkt_type == PKT_TYPE_MGMT) { - /* Set the packet type and add header for management frame */ - local_tx_pd->tx_pkt_type = cpu_to_le16(pkt_type); - pkt_offset += MWIFIEX_MGMT_FRAME_HEADER_SIZE; - } - - local_tx_pd->tx_pkt_offset = cpu_to_le16(pkt_offset); - - /* make space for INTF_HEADER_LEN */ - skb_push(skb, INTF_HEADER_LEN); - - if (!local_tx_pd->tx_control) - /* TxCtrl set by user or default */ - local_tx_pd->tx_control = cpu_to_le32(priv->pkt_tx_ctrl); - - return skb->data; -} - -/* - * This function tells firmware to send a NULL data packet. - * - * The function creates a NULL data packet with TxPD and sends to the - * firmware for transmission, with highest priority setting. - */ -int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct txpd *local_tx_pd; -/* sizeof(struct txpd) + Interface specific header */ -#define NULL_PACKET_HDR 64 - u32 data_len = NULL_PACKET_HDR; - struct sk_buff *skb; - int ret; - struct mwifiex_txinfo *tx_info = NULL; - - if (adapter->surprise_removed) - return -1; - - if (!priv->media_connected) - return -1; - - if (adapter->data_sent) - return -1; - - skb = dev_alloc_skb(data_len); - if (!skb) - return -1; - - tx_info = MWIFIEX_SKB_TXCB(skb); - tx_info->bss_num = priv->bss_num; - tx_info->bss_type = priv->bss_type; - skb_reserve(skb, sizeof(struct txpd) + INTF_HEADER_LEN); - skb_push(skb, sizeof(struct txpd)); - - local_tx_pd = (struct txpd *) skb->data; - local_tx_pd->tx_control = cpu_to_le32(priv->pkt_tx_ctrl); - local_tx_pd->flags = flags; - local_tx_pd->priority = WMM_HIGHEST_PRIORITY; - local_tx_pd->tx_pkt_offset = cpu_to_le16(sizeof(struct txpd)); - local_tx_pd->bss_num = priv->bss_num; - local_tx_pd->bss_type = priv->bss_type; - - if (adapter->iface_type == MWIFIEX_USB) { - ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA, - skb, NULL); - } else { - skb_push(skb, INTF_HEADER_LEN); - ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, - skb, NULL); - } - switch (ret) { - case -EBUSY: - adapter->data_sent = true; - /* Fall through FAILURE handling */ - case -1: - dev_kfree_skb_any(skb); - dev_err(adapter->dev, "%s: host_to_card failed: ret=%d\n", - __func__, ret); - adapter->dbg.num_tx_host_to_card_failure++; - break; - case 0: - dev_kfree_skb_any(skb); - dev_dbg(adapter->dev, "data: %s: host_to_card succeeded\n", - __func__); - adapter->tx_lock_flag = true; - break; - case -EINPROGRESS: - break; - default: - break; - } - - return ret; -} - -/* - * This function checks if we need to send last packet indication. - */ -u8 -mwifiex_check_last_packet_indication(struct mwifiex_private *priv) -{ - struct mwifiex_adapter *adapter = priv->adapter; - u8 ret = false; - - if (!adapter->sleep_period.period) - return ret; - if (mwifiex_wmm_lists_empty(adapter)) - ret = true; - - if (ret && !adapter->cmd_sent && !adapter->curr_cmd && - !is_command_pending(adapter)) { - adapter->delay_null_pkt = false; - ret = true; - } else { - ret = false; - adapter->delay_null_pkt = true; - } - return ret; -} diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c deleted file mode 100644 index 8f923d0d2ba6..000000000000 --- a/drivers/net/wireless/mwifiex/txrx.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Marvell Wireless LAN device driver: generic TX/RX data handling - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" - -/* - * This function processes the received buffer. - * - * Main responsibility of this function is to parse the RxPD to - * identify the correct interface this packet is headed for and - * forwarding it to the associated handling function, where the - * packet will be further processed and sent to kernel/upper layer - * if required. - */ -int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter, - struct sk_buff *skb) -{ - struct mwifiex_private *priv = - mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - struct rxpd *local_rx_pd; - struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb); - - local_rx_pd = (struct rxpd *) (skb->data); - /* Get the BSS number from rxpd, get corresponding priv */ - priv = mwifiex_get_priv_by_id(adapter, local_rx_pd->bss_num & - BSS_NUM_MASK, local_rx_pd->bss_type); - if (!priv) - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); - - if (!priv) { - dev_err(adapter->dev, "data: priv not found. Drop RX packet\n"); - dev_kfree_skb_any(skb); - return -1; - } - - rx_info->bss_num = priv->bss_num; - rx_info->bss_type = priv->bss_type; - - if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP) - return mwifiex_process_uap_rx_packet(priv, skb); - - return mwifiex_process_sta_rx_packet(priv, skb); -} -EXPORT_SYMBOL_GPL(mwifiex_handle_rx_packet); - -/* - * This function sends a packet to device. - * - * It processes the packet to add the TxPD, checks condition and - * sends the processed packet to firmware for transmission. - * - * On successful completion, the function calls the completion callback - * and logs the time. - */ -int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb, - struct mwifiex_tx_param *tx_param) -{ - int ret = -1; - struct mwifiex_adapter *adapter = priv->adapter; - u8 *head_ptr; - struct txpd *local_tx_pd = NULL; - - if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP) - head_ptr = mwifiex_process_uap_txpd(priv, skb); - else - head_ptr = mwifiex_process_sta_txpd(priv, skb); - - if (head_ptr) { - if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) - local_tx_pd = - (struct txpd *) (head_ptr + INTF_HEADER_LEN); - if (adapter->iface_type == MWIFIEX_USB) { - adapter->data_sent = true; - skb_pull(skb, INTF_HEADER_LEN); - ret = adapter->if_ops.host_to_card(adapter, - MWIFIEX_USB_EP_DATA, - skb, NULL); - } else { - ret = adapter->if_ops.host_to_card(adapter, - MWIFIEX_TYPE_DATA, - skb, tx_param); - } - } - - switch (ret) { - case -ENOSR: - dev_err(adapter->dev, "data: -ENOSR is returned\n"); - break; - case -EBUSY: - if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) && - (adapter->pps_uapsd_mode) && (adapter->tx_lock_flag)) { - priv->adapter->tx_lock_flag = false; - if (local_tx_pd) - local_tx_pd->flags = 0; - } - dev_dbg(adapter->dev, "data: -EBUSY is returned\n"); - break; - case -1: - if (adapter->iface_type != MWIFIEX_PCIE) - adapter->data_sent = false; - dev_err(adapter->dev, "mwifiex_write_data_async failed: 0x%X\n", - ret); - adapter->dbg.num_tx_host_to_card_failure++; - mwifiex_write_data_complete(adapter, skb, 0, ret); - break; - case -EINPROGRESS: - if (adapter->iface_type != MWIFIEX_PCIE) - adapter->data_sent = false; - break; - case 0: - mwifiex_write_data_complete(adapter, skb, 0, ret); - break; - default: - break; - } - - return ret; -} - -/* - * Packet send completion callback handler. - * - * It either frees the buffer directly or forwards it to another - * completion callback which checks conditions, updates statistics, - * wakes up stalled traffic queue if required, and then frees the buffer. - */ -int mwifiex_write_data_complete(struct mwifiex_adapter *adapter, - struct sk_buff *skb, int aggr, int status) -{ - struct mwifiex_private *priv; - struct mwifiex_txinfo *tx_info; - struct netdev_queue *txq; - int index; - - if (!skb) - return 0; - - tx_info = MWIFIEX_SKB_TXCB(skb); - priv = mwifiex_get_priv_by_id(adapter, tx_info->bss_num, - tx_info->bss_type); - if (!priv) - goto done; - - if (adapter->iface_type == MWIFIEX_USB) - adapter->data_sent = false; - - mwifiex_set_trans_start(priv->netdev); - if (!status) { - priv->stats.tx_packets++; - priv->stats.tx_bytes += skb->len; - if (priv->tx_timeout_cnt) - priv->tx_timeout_cnt = 0; - } else { - priv->stats.tx_errors++; - } - - if (tx_info->flags & MWIFIEX_BUF_FLAG_BRIDGED_PKT) - atomic_dec_return(&adapter->pending_bridged_pkts); - - if (aggr) - /* For skb_aggr, do not wake up tx queue */ - goto done; - - atomic_dec(&adapter->tx_pending); - - index = mwifiex_1d_to_wmm_queue[skb->priority]; - if (atomic_dec_return(&priv->wmm_tx_pending[index]) < LOW_TX_PENDING) { - txq = netdev_get_tx_queue(priv->netdev, index); - if (netif_tx_queue_stopped(txq)) { - netif_tx_wake_queue(txq); - dev_dbg(adapter->dev, "wake queue: %d\n", index); - } - } -done: - dev_kfree_skb_any(skb); - - return 0; -} -EXPORT_SYMBOL_GPL(mwifiex_write_data_complete); - diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c b/drivers/net/wireless/mwifiex/uap_cmd.c deleted file mode 100644 index b04b1db29100..000000000000 --- a/drivers/net/wireless/mwifiex/uap_cmd.c +++ /dev/null @@ -1,720 +0,0 @@ -/* - * Marvell Wireless LAN device driver: AP specific command handling - * - * Copyright (C) 2012, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "main.h" -#include "11ac.h" - -/* This function parses security related parameters from cfg80211_ap_settings - * and sets into FW understandable bss_config structure. - */ -int mwifiex_set_secure_params(struct mwifiex_private *priv, - struct mwifiex_uap_bss_param *bss_config, - struct cfg80211_ap_settings *params) { - int i; - struct mwifiex_wep_key wep_key; - - if (!params->privacy) { - bss_config->protocol = PROTOCOL_NO_SECURITY; - bss_config->key_mgmt = KEY_MGMT_NONE; - bss_config->wpa_cfg.length = 0; - priv->sec_info.wep_enabled = 0; - priv->sec_info.wpa_enabled = 0; - priv->sec_info.wpa2_enabled = 0; - - return 0; - } - - switch (params->auth_type) { - case NL80211_AUTHTYPE_OPEN_SYSTEM: - bss_config->auth_mode = WLAN_AUTH_OPEN; - break; - case NL80211_AUTHTYPE_SHARED_KEY: - bss_config->auth_mode = WLAN_AUTH_SHARED_KEY; - break; - case NL80211_AUTHTYPE_NETWORK_EAP: - bss_config->auth_mode = WLAN_AUTH_LEAP; - break; - default: - bss_config->auth_mode = MWIFIEX_AUTH_MODE_AUTO; - break; - } - - bss_config->key_mgmt_operation |= KEY_MGMT_ON_HOST; - - for (i = 0; i < params->crypto.n_akm_suites; i++) { - switch (params->crypto.akm_suites[i]) { - case WLAN_AKM_SUITE_8021X: - if (params->crypto.wpa_versions & - NL80211_WPA_VERSION_1) { - bss_config->protocol = PROTOCOL_WPA; - bss_config->key_mgmt = KEY_MGMT_EAP; - } - if (params->crypto.wpa_versions & - NL80211_WPA_VERSION_2) { - bss_config->protocol |= PROTOCOL_WPA2; - bss_config->key_mgmt = KEY_MGMT_EAP; - } - break; - case WLAN_AKM_SUITE_PSK: - if (params->crypto.wpa_versions & - NL80211_WPA_VERSION_1) { - bss_config->protocol = PROTOCOL_WPA; - bss_config->key_mgmt = KEY_MGMT_PSK; - } - if (params->crypto.wpa_versions & - NL80211_WPA_VERSION_2) { - bss_config->protocol |= PROTOCOL_WPA2; - bss_config->key_mgmt = KEY_MGMT_PSK; - } - break; - default: - break; - } - } - for (i = 0; i < params->crypto.n_ciphers_pairwise; i++) { - switch (params->crypto.ciphers_pairwise[i]) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - break; - case WLAN_CIPHER_SUITE_TKIP: - if (params->crypto.wpa_versions & NL80211_WPA_VERSION_1) - bss_config->wpa_cfg.pairwise_cipher_wpa |= - CIPHER_TKIP; - if (params->crypto.wpa_versions & NL80211_WPA_VERSION_2) - bss_config->wpa_cfg.pairwise_cipher_wpa2 |= - CIPHER_TKIP; - break; - case WLAN_CIPHER_SUITE_CCMP: - if (params->crypto.wpa_versions & NL80211_WPA_VERSION_1) - bss_config->wpa_cfg.pairwise_cipher_wpa |= - CIPHER_AES_CCMP; - if (params->crypto.wpa_versions & NL80211_WPA_VERSION_2) - bss_config->wpa_cfg.pairwise_cipher_wpa2 |= - CIPHER_AES_CCMP; - default: - break; - } - } - - switch (params->crypto.cipher_group) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - if (priv->sec_info.wep_enabled) { - bss_config->protocol = PROTOCOL_STATIC_WEP; - bss_config->key_mgmt = KEY_MGMT_NONE; - bss_config->wpa_cfg.length = 0; - - for (i = 0; i < NUM_WEP_KEYS; i++) { - wep_key = priv->wep_key[i]; - bss_config->wep_cfg[i].key_index = i; - - if (priv->wep_key_curr_index == i) - bss_config->wep_cfg[i].is_default = 1; - else - bss_config->wep_cfg[i].is_default = 0; - - bss_config->wep_cfg[i].length = - wep_key.key_length; - memcpy(&bss_config->wep_cfg[i].key, - &wep_key.key_material, - wep_key.key_length); - } - } - break; - case WLAN_CIPHER_SUITE_TKIP: - bss_config->wpa_cfg.group_cipher = CIPHER_TKIP; - break; - case WLAN_CIPHER_SUITE_CCMP: - bss_config->wpa_cfg.group_cipher = CIPHER_AES_CCMP; - break; - default: - break; - } - - return 0; -} - -/* This function updates 11n related parameters from IE and sets them into - * bss_config structure. - */ -void -mwifiex_set_ht_params(struct mwifiex_private *priv, - struct mwifiex_uap_bss_param *bss_cfg, - struct cfg80211_ap_settings *params) -{ - const u8 *ht_ie; - - if (!ISSUPP_11NENABLED(priv->adapter->fw_cap_info)) - return; - - ht_ie = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, params->beacon.tail, - params->beacon.tail_len); - if (ht_ie) { - memcpy(&bss_cfg->ht_cap, ht_ie + 2, - sizeof(struct ieee80211_ht_cap)); - priv->ap_11n_enabled = 1; - } else { - memset(&bss_cfg->ht_cap , 0, sizeof(struct ieee80211_ht_cap)); - bss_cfg->ht_cap.cap_info = cpu_to_le16(MWIFIEX_DEF_HT_CAP); - bss_cfg->ht_cap.ampdu_params_info = MWIFIEX_DEF_AMPDU; - } - - return; -} - -/* This function updates 11ac related parameters from IE - * and sets them into bss_config structure. - */ -void mwifiex_set_vht_params(struct mwifiex_private *priv, - struct mwifiex_uap_bss_param *bss_cfg, - struct cfg80211_ap_settings *params) -{ - const u8 *vht_ie; - - vht_ie = cfg80211_find_ie(WLAN_EID_VHT_CAPABILITY, params->beacon.tail, - params->beacon.tail_len); - if (vht_ie) { - memcpy(&bss_cfg->vht_cap, vht_ie + 2, - sizeof(struct ieee80211_vht_cap)); - priv->ap_11ac_enabled = 1; - } else { - priv->ap_11ac_enabled = 0; - } - - return; -} - -/* Enable VHT only when cfg80211_ap_settings has VHT IE. - * Otherwise disable VHT. - */ -void mwifiex_set_vht_width(struct mwifiex_private *priv, - enum nl80211_chan_width width, - bool ap_11ac_enable) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct mwifiex_11ac_vht_cfg vht_cfg; - - vht_cfg.band_config = VHT_CFG_5GHZ; - vht_cfg.cap_info = adapter->hw_dot_11ac_dev_cap; - - if (!ap_11ac_enable) { - vht_cfg.mcs_tx_set = DISABLE_VHT_MCS_SET; - vht_cfg.mcs_rx_set = DISABLE_VHT_MCS_SET; - } else { - vht_cfg.mcs_tx_set = DEFAULT_VHT_MCS_SET; - vht_cfg.mcs_rx_set = DEFAULT_VHT_MCS_SET; - } - - vht_cfg.misc_config = VHT_CAP_UAP_ONLY; - - if (ap_11ac_enable && width >= NL80211_CHAN_WIDTH_80) - vht_cfg.misc_config |= VHT_BW_80_160_80P80; - - mwifiex_send_cmd_sync(priv, HostCmd_CMD_11AC_CFG, - HostCmd_ACT_GEN_SET, 0, &vht_cfg); - - return; -} - -/* This function finds supported rates IE from beacon parameter and sets - * these rates into bss_config structure. - */ -void -mwifiex_set_uap_rates(struct mwifiex_uap_bss_param *bss_cfg, - struct cfg80211_ap_settings *params) -{ - struct ieee_types_header *rate_ie; - int var_offset = offsetof(struct ieee80211_mgmt, u.beacon.variable); - const u8 *var_pos = params->beacon.head + var_offset; - int len = params->beacon.head_len - var_offset; - u8 rate_len = 0; - - rate_ie = (void *)cfg80211_find_ie(WLAN_EID_SUPP_RATES, var_pos, len); - if (rate_ie) { - memcpy(bss_cfg->rates, rate_ie + 1, rate_ie->len); - rate_len = rate_ie->len; - } - - rate_ie = (void *)cfg80211_find_ie(WLAN_EID_EXT_SUPP_RATES, - params->beacon.tail, - params->beacon.tail_len); - if (rate_ie) - memcpy(bss_cfg->rates + rate_len, rate_ie + 1, rate_ie->len); - - return; -} - -/* This function initializes some of mwifiex_uap_bss_param variables. - * This helps FW in ignoring invalid values. These values may or may not - * be get updated to valid ones at later stage. - */ -void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config) -{ - config->bcast_ssid_ctl = 0x7F; - config->radio_ctl = 0x7F; - config->dtim_period = 0x7F; - config->beacon_period = 0x7FFF; - config->auth_mode = 0x7F; - config->rts_threshold = 0x7FFF; - config->frag_threshold = 0x7FFF; - config->retry_limit = 0x7F; - config->qos_info = 0xFF; -} - -/* This function parses BSS related parameters from structure - * and prepares TLVs specific to WPA/WPA2 security. - * These TLVs are appended to command buffer. - */ -static void -mwifiex_uap_bss_wpa(u8 **tlv_buf, void *cmd_buf, u16 *param_size) -{ - struct host_cmd_tlv_pwk_cipher *pwk_cipher; - struct host_cmd_tlv_gwk_cipher *gwk_cipher; - struct host_cmd_tlv_passphrase *passphrase; - struct host_cmd_tlv_akmp *tlv_akmp; - struct mwifiex_uap_bss_param *bss_cfg = cmd_buf; - u16 cmd_size = *param_size; - u8 *tlv = *tlv_buf; - - tlv_akmp = (struct host_cmd_tlv_akmp *)tlv; - tlv_akmp->tlv.type = cpu_to_le16(TLV_TYPE_UAP_AKMP); - tlv_akmp->tlv.len = cpu_to_le16(sizeof(struct host_cmd_tlv_akmp) - - sizeof(struct host_cmd_tlv)); - tlv_akmp->key_mgmt_operation = cpu_to_le16(bss_cfg->key_mgmt_operation); - tlv_akmp->key_mgmt = cpu_to_le16(bss_cfg->key_mgmt); - cmd_size += sizeof(struct host_cmd_tlv_akmp); - tlv += sizeof(struct host_cmd_tlv_akmp); - - if (bss_cfg->wpa_cfg.pairwise_cipher_wpa & VALID_CIPHER_BITMAP) { - pwk_cipher = (struct host_cmd_tlv_pwk_cipher *)tlv; - pwk_cipher->tlv.type = cpu_to_le16(TLV_TYPE_PWK_CIPHER); - pwk_cipher->tlv.len = - cpu_to_le16(sizeof(struct host_cmd_tlv_pwk_cipher) - - sizeof(struct host_cmd_tlv)); - pwk_cipher->proto = cpu_to_le16(PROTOCOL_WPA); - pwk_cipher->cipher = bss_cfg->wpa_cfg.pairwise_cipher_wpa; - cmd_size += sizeof(struct host_cmd_tlv_pwk_cipher); - tlv += sizeof(struct host_cmd_tlv_pwk_cipher); - } - - if (bss_cfg->wpa_cfg.pairwise_cipher_wpa2 & VALID_CIPHER_BITMAP) { - pwk_cipher = (struct host_cmd_tlv_pwk_cipher *)tlv; - pwk_cipher->tlv.type = cpu_to_le16(TLV_TYPE_PWK_CIPHER); - pwk_cipher->tlv.len = - cpu_to_le16(sizeof(struct host_cmd_tlv_pwk_cipher) - - sizeof(struct host_cmd_tlv)); - pwk_cipher->proto = cpu_to_le16(PROTOCOL_WPA2); - pwk_cipher->cipher = bss_cfg->wpa_cfg.pairwise_cipher_wpa2; - cmd_size += sizeof(struct host_cmd_tlv_pwk_cipher); - tlv += sizeof(struct host_cmd_tlv_pwk_cipher); - } - - if (bss_cfg->wpa_cfg.group_cipher & VALID_CIPHER_BITMAP) { - gwk_cipher = (struct host_cmd_tlv_gwk_cipher *)tlv; - gwk_cipher->tlv.type = cpu_to_le16(TLV_TYPE_GWK_CIPHER); - gwk_cipher->tlv.len = - cpu_to_le16(sizeof(struct host_cmd_tlv_gwk_cipher) - - sizeof(struct host_cmd_tlv)); - gwk_cipher->cipher = bss_cfg->wpa_cfg.group_cipher; - cmd_size += sizeof(struct host_cmd_tlv_gwk_cipher); - tlv += sizeof(struct host_cmd_tlv_gwk_cipher); - } - - if (bss_cfg->wpa_cfg.length) { - passphrase = (struct host_cmd_tlv_passphrase *)tlv; - passphrase->tlv.type = cpu_to_le16(TLV_TYPE_UAP_WPA_PASSPHRASE); - passphrase->tlv.len = cpu_to_le16(bss_cfg->wpa_cfg.length); - memcpy(passphrase->passphrase, bss_cfg->wpa_cfg.passphrase, - bss_cfg->wpa_cfg.length); - cmd_size += sizeof(struct host_cmd_tlv) + - bss_cfg->wpa_cfg.length; - tlv += sizeof(struct host_cmd_tlv) + bss_cfg->wpa_cfg.length; - } - - *param_size = cmd_size; - *tlv_buf = tlv; - - return; -} - -/* This function parses WMM related parameters from cfg80211_ap_settings - * structure and updates bss_config structure. - */ -void -mwifiex_set_wmm_params(struct mwifiex_private *priv, - struct mwifiex_uap_bss_param *bss_cfg, - struct cfg80211_ap_settings *params) -{ - const u8 *vendor_ie; - struct ieee_types_header *wmm_ie; - u8 wmm_oui[] = {0x00, 0x50, 0xf2, 0x02}; - - vendor_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT, - WLAN_OUI_TYPE_MICROSOFT_WMM, - params->beacon.tail, - params->beacon.tail_len); - if (vendor_ie) { - wmm_ie = (struct ieee_types_header *)vendor_ie; - memcpy(&bss_cfg->wmm_info, wmm_ie + 1, - sizeof(bss_cfg->wmm_info)); - priv->wmm_enabled = 1; - } else { - memset(&bss_cfg->wmm_info, 0, sizeof(bss_cfg->wmm_info)); - memcpy(&bss_cfg->wmm_info.oui, wmm_oui, sizeof(wmm_oui)); - bss_cfg->wmm_info.subtype = MWIFIEX_WMM_SUBTYPE; - bss_cfg->wmm_info.version = MWIFIEX_WMM_VERSION; - priv->wmm_enabled = 0; - } - - bss_cfg->qos_info = 0x00; - return; -} -/* This function parses BSS related parameters from structure - * and prepares TLVs specific to WEP encryption. - * These TLVs are appended to command buffer. - */ -static void -mwifiex_uap_bss_wep(u8 **tlv_buf, void *cmd_buf, u16 *param_size) -{ - struct host_cmd_tlv_wep_key *wep_key; - u16 cmd_size = *param_size; - int i; - u8 *tlv = *tlv_buf; - struct mwifiex_uap_bss_param *bss_cfg = cmd_buf; - - for (i = 0; i < NUM_WEP_KEYS; i++) { - if (bss_cfg->wep_cfg[i].length && - (bss_cfg->wep_cfg[i].length == WLAN_KEY_LEN_WEP40 || - bss_cfg->wep_cfg[i].length == WLAN_KEY_LEN_WEP104)) { - wep_key = (struct host_cmd_tlv_wep_key *)tlv; - wep_key->tlv.type = cpu_to_le16(TLV_TYPE_UAP_WEP_KEY); - wep_key->tlv.len = - cpu_to_le16(bss_cfg->wep_cfg[i].length + 2); - wep_key->key_index = bss_cfg->wep_cfg[i].key_index; - wep_key->is_default = bss_cfg->wep_cfg[i].is_default; - memcpy(wep_key->key, bss_cfg->wep_cfg[i].key, - bss_cfg->wep_cfg[i].length); - cmd_size += sizeof(struct host_cmd_tlv) + 2 + - bss_cfg->wep_cfg[i].length; - tlv += sizeof(struct host_cmd_tlv) + 2 + - bss_cfg->wep_cfg[i].length; - } - } - - *param_size = cmd_size; - *tlv_buf = tlv; - - return; -} - -/* This function parses BSS related parameters from structure - * and prepares TLVs. These TLVs are appended to command buffer. -*/ -static int -mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size) -{ - struct host_cmd_tlv_dtim_period *dtim_period; - struct host_cmd_tlv_beacon_period *beacon_period; - struct host_cmd_tlv_ssid *ssid; - struct host_cmd_tlv_bcast_ssid *bcast_ssid; - struct host_cmd_tlv_channel_band *chan_band; - struct host_cmd_tlv_frag_threshold *frag_threshold; - struct host_cmd_tlv_rts_threshold *rts_threshold; - struct host_cmd_tlv_retry_limit *retry_limit; - struct host_cmd_tlv_encrypt_protocol *encrypt_protocol; - struct host_cmd_tlv_auth_type *auth_type; - struct host_cmd_tlv_rates *tlv_rates; - struct host_cmd_tlv_ageout_timer *ao_timer, *ps_ao_timer; - struct mwifiex_ie_types_htcap *htcap; - struct mwifiex_ie_types_wmmcap *wmm_cap; - struct mwifiex_uap_bss_param *bss_cfg = cmd_buf; - int i; - u16 cmd_size = *param_size; - - if (bss_cfg->ssid.ssid_len) { - ssid = (struct host_cmd_tlv_ssid *)tlv; - ssid->tlv.type = cpu_to_le16(TLV_TYPE_UAP_SSID); - ssid->tlv.len = cpu_to_le16((u16)bss_cfg->ssid.ssid_len); - memcpy(ssid->ssid, bss_cfg->ssid.ssid, bss_cfg->ssid.ssid_len); - cmd_size += sizeof(struct host_cmd_tlv) + - bss_cfg->ssid.ssid_len; - tlv += sizeof(struct host_cmd_tlv) + bss_cfg->ssid.ssid_len; - - bcast_ssid = (struct host_cmd_tlv_bcast_ssid *)tlv; - bcast_ssid->tlv.type = cpu_to_le16(TLV_TYPE_UAP_BCAST_SSID); - bcast_ssid->tlv.len = - cpu_to_le16(sizeof(bcast_ssid->bcast_ctl)); - bcast_ssid->bcast_ctl = bss_cfg->bcast_ssid_ctl; - cmd_size += sizeof(struct host_cmd_tlv_bcast_ssid); - tlv += sizeof(struct host_cmd_tlv_bcast_ssid); - } - if (bss_cfg->rates[0]) { - tlv_rates = (struct host_cmd_tlv_rates *)tlv; - tlv_rates->tlv.type = cpu_to_le16(TLV_TYPE_UAP_RATES); - - for (i = 0; i < MWIFIEX_SUPPORTED_RATES && bss_cfg->rates[i]; - i++) - tlv_rates->rates[i] = bss_cfg->rates[i]; - - tlv_rates->tlv.len = cpu_to_le16(i); - cmd_size += sizeof(struct host_cmd_tlv_rates) + i; - tlv += sizeof(struct host_cmd_tlv_rates) + i; - } - if (bss_cfg->channel && - ((bss_cfg->band_cfg == BAND_CONFIG_BG && - bss_cfg->channel <= MAX_CHANNEL_BAND_BG) || - (bss_cfg->band_cfg == BAND_CONFIG_A && - bss_cfg->channel <= MAX_CHANNEL_BAND_A))) { - chan_band = (struct host_cmd_tlv_channel_band *)tlv; - chan_band->tlv.type = cpu_to_le16(TLV_TYPE_CHANNELBANDLIST); - chan_band->tlv.len = - cpu_to_le16(sizeof(struct host_cmd_tlv_channel_band) - - sizeof(struct host_cmd_tlv)); - chan_band->band_config = bss_cfg->band_cfg; - chan_band->channel = bss_cfg->channel; - cmd_size += sizeof(struct host_cmd_tlv_channel_band); - tlv += sizeof(struct host_cmd_tlv_channel_band); - } - if (bss_cfg->beacon_period >= MIN_BEACON_PERIOD && - bss_cfg->beacon_period <= MAX_BEACON_PERIOD) { - beacon_period = (struct host_cmd_tlv_beacon_period *)tlv; - beacon_period->tlv.type = - cpu_to_le16(TLV_TYPE_UAP_BEACON_PERIOD); - beacon_period->tlv.len = - cpu_to_le16(sizeof(struct host_cmd_tlv_beacon_period) - - sizeof(struct host_cmd_tlv)); - beacon_period->period = cpu_to_le16(bss_cfg->beacon_period); - cmd_size += sizeof(struct host_cmd_tlv_beacon_period); - tlv += sizeof(struct host_cmd_tlv_beacon_period); - } - if (bss_cfg->dtim_period >= MIN_DTIM_PERIOD && - bss_cfg->dtim_period <= MAX_DTIM_PERIOD) { - dtim_period = (struct host_cmd_tlv_dtim_period *)tlv; - dtim_period->tlv.type = cpu_to_le16(TLV_TYPE_UAP_DTIM_PERIOD); - dtim_period->tlv.len = - cpu_to_le16(sizeof(struct host_cmd_tlv_dtim_period) - - sizeof(struct host_cmd_tlv)); - dtim_period->period = bss_cfg->dtim_period; - cmd_size += sizeof(struct host_cmd_tlv_dtim_period); - tlv += sizeof(struct host_cmd_tlv_dtim_period); - } - if (bss_cfg->rts_threshold <= MWIFIEX_RTS_MAX_VALUE) { - rts_threshold = (struct host_cmd_tlv_rts_threshold *)tlv; - rts_threshold->tlv.type = - cpu_to_le16(TLV_TYPE_UAP_RTS_THRESHOLD); - rts_threshold->tlv.len = - cpu_to_le16(sizeof(struct host_cmd_tlv_rts_threshold) - - sizeof(struct host_cmd_tlv)); - rts_threshold->rts_thr = cpu_to_le16(bss_cfg->rts_threshold); - cmd_size += sizeof(struct host_cmd_tlv_frag_threshold); - tlv += sizeof(struct host_cmd_tlv_frag_threshold); - } - if ((bss_cfg->frag_threshold >= MWIFIEX_FRAG_MIN_VALUE) && - (bss_cfg->frag_threshold <= MWIFIEX_FRAG_MAX_VALUE)) { - frag_threshold = (struct host_cmd_tlv_frag_threshold *)tlv; - frag_threshold->tlv.type = - cpu_to_le16(TLV_TYPE_UAP_FRAG_THRESHOLD); - frag_threshold->tlv.len = - cpu_to_le16(sizeof(struct host_cmd_tlv_frag_threshold) - - sizeof(struct host_cmd_tlv)); - frag_threshold->frag_thr = cpu_to_le16(bss_cfg->frag_threshold); - cmd_size += sizeof(struct host_cmd_tlv_frag_threshold); - tlv += sizeof(struct host_cmd_tlv_frag_threshold); - } - if (bss_cfg->retry_limit <= MWIFIEX_RETRY_LIMIT) { - retry_limit = (struct host_cmd_tlv_retry_limit *)tlv; - retry_limit->tlv.type = cpu_to_le16(TLV_TYPE_UAP_RETRY_LIMIT); - retry_limit->tlv.len = - cpu_to_le16(sizeof(struct host_cmd_tlv_retry_limit) - - sizeof(struct host_cmd_tlv)); - retry_limit->limit = (u8)bss_cfg->retry_limit; - cmd_size += sizeof(struct host_cmd_tlv_retry_limit); - tlv += sizeof(struct host_cmd_tlv_retry_limit); - } - if ((bss_cfg->protocol & PROTOCOL_WPA) || - (bss_cfg->protocol & PROTOCOL_WPA2) || - (bss_cfg->protocol & PROTOCOL_EAP)) - mwifiex_uap_bss_wpa(&tlv, cmd_buf, &cmd_size); - else - mwifiex_uap_bss_wep(&tlv, cmd_buf, &cmd_size); - - if ((bss_cfg->auth_mode <= WLAN_AUTH_SHARED_KEY) || - (bss_cfg->auth_mode == MWIFIEX_AUTH_MODE_AUTO)) { - auth_type = (struct host_cmd_tlv_auth_type *)tlv; - auth_type->tlv.type = cpu_to_le16(TLV_TYPE_AUTH_TYPE); - auth_type->tlv.len = - cpu_to_le16(sizeof(struct host_cmd_tlv_auth_type) - - sizeof(struct host_cmd_tlv)); - auth_type->auth_type = (u8)bss_cfg->auth_mode; - cmd_size += sizeof(struct host_cmd_tlv_auth_type); - tlv += sizeof(struct host_cmd_tlv_auth_type); - } - if (bss_cfg->protocol) { - encrypt_protocol = (struct host_cmd_tlv_encrypt_protocol *)tlv; - encrypt_protocol->tlv.type = - cpu_to_le16(TLV_TYPE_UAP_ENCRY_PROTOCOL); - encrypt_protocol->tlv.len = - cpu_to_le16(sizeof(struct host_cmd_tlv_encrypt_protocol) - - sizeof(struct host_cmd_tlv)); - encrypt_protocol->proto = cpu_to_le16(bss_cfg->protocol); - cmd_size += sizeof(struct host_cmd_tlv_encrypt_protocol); - tlv += sizeof(struct host_cmd_tlv_encrypt_protocol); - } - - if (bss_cfg->ht_cap.cap_info) { - htcap = (struct mwifiex_ie_types_htcap *)tlv; - htcap->header.type = cpu_to_le16(WLAN_EID_HT_CAPABILITY); - htcap->header.len = - cpu_to_le16(sizeof(struct ieee80211_ht_cap)); - htcap->ht_cap.cap_info = bss_cfg->ht_cap.cap_info; - htcap->ht_cap.ampdu_params_info = - bss_cfg->ht_cap.ampdu_params_info; - memcpy(&htcap->ht_cap.mcs, &bss_cfg->ht_cap.mcs, - sizeof(struct ieee80211_mcs_info)); - htcap->ht_cap.extended_ht_cap_info = - bss_cfg->ht_cap.extended_ht_cap_info; - htcap->ht_cap.tx_BF_cap_info = bss_cfg->ht_cap.tx_BF_cap_info; - htcap->ht_cap.antenna_selection_info = - bss_cfg->ht_cap.antenna_selection_info; - cmd_size += sizeof(struct mwifiex_ie_types_htcap); - tlv += sizeof(struct mwifiex_ie_types_htcap); - } - - if (bss_cfg->wmm_info.qos_info != 0xFF) { - wmm_cap = (struct mwifiex_ie_types_wmmcap *)tlv; - wmm_cap->header.type = cpu_to_le16(WLAN_EID_VENDOR_SPECIFIC); - wmm_cap->header.len = cpu_to_le16(sizeof(wmm_cap->wmm_info)); - memcpy(&wmm_cap->wmm_info, &bss_cfg->wmm_info, - sizeof(wmm_cap->wmm_info)); - cmd_size += sizeof(struct mwifiex_ie_types_wmmcap); - tlv += sizeof(struct mwifiex_ie_types_wmmcap); - } - - if (bss_cfg->sta_ao_timer) { - ao_timer = (struct host_cmd_tlv_ageout_timer *)tlv; - ao_timer->tlv.type = cpu_to_le16(TLV_TYPE_UAP_AO_TIMER); - ao_timer->tlv.len = cpu_to_le16(sizeof(*ao_timer) - - sizeof(struct host_cmd_tlv)); - ao_timer->sta_ao_timer = cpu_to_le32(bss_cfg->sta_ao_timer); - cmd_size += sizeof(*ao_timer); - tlv += sizeof(*ao_timer); - } - - if (bss_cfg->ps_sta_ao_timer) { - ps_ao_timer = (struct host_cmd_tlv_ageout_timer *)tlv; - ps_ao_timer->tlv.type = cpu_to_le16(TLV_TYPE_UAP_PS_AO_TIMER); - ps_ao_timer->tlv.len = cpu_to_le16(sizeof(*ps_ao_timer) - - sizeof(struct host_cmd_tlv)); - ps_ao_timer->sta_ao_timer = - cpu_to_le32(bss_cfg->ps_sta_ao_timer); - cmd_size += sizeof(*ps_ao_timer); - tlv += sizeof(*ps_ao_timer); - } - - *param_size = cmd_size; - - return 0; -} - -/* This function parses custom IEs from IE list and prepares command buffer */ -static int mwifiex_uap_custom_ie_prepare(u8 *tlv, void *cmd_buf, u16 *ie_size) -{ - struct mwifiex_ie_list *ap_ie = cmd_buf; - struct host_cmd_tlv *tlv_ie = (struct host_cmd_tlv *)tlv; - - if (!ap_ie || !ap_ie->len || !ap_ie->ie_list) - return -1; - - *ie_size += le16_to_cpu(ap_ie->len) + sizeof(struct host_cmd_tlv); - - tlv_ie->type = cpu_to_le16(TLV_TYPE_MGMT_IE); - tlv_ie->len = ap_ie->len; - tlv += sizeof(struct host_cmd_tlv); - - memcpy(tlv, ap_ie->ie_list, le16_to_cpu(ap_ie->len)); - - return 0; -} - -/* Parse AP config structure and prepare TLV based command structure - * to be sent to FW for uAP configuration - */ -static int -mwifiex_cmd_uap_sys_config(struct host_cmd_ds_command *cmd, u16 cmd_action, - u32 type, void *cmd_buf) -{ - u8 *tlv; - u16 cmd_size, param_size, ie_size; - struct host_cmd_ds_sys_config *sys_cfg; - - cmd->command = cpu_to_le16(HostCmd_CMD_UAP_SYS_CONFIG); - cmd_size = (u16)(sizeof(struct host_cmd_ds_sys_config) + S_DS_GEN); - sys_cfg = (struct host_cmd_ds_sys_config *)&cmd->params.uap_sys_config; - sys_cfg->action = cpu_to_le16(cmd_action); - tlv = sys_cfg->tlv; - - switch (type) { - case UAP_BSS_PARAMS_I: - param_size = cmd_size; - if (mwifiex_uap_bss_param_prepare(tlv, cmd_buf, ¶m_size)) - return -1; - cmd->size = cpu_to_le16(param_size); - break; - case UAP_CUSTOM_IE_I: - ie_size = cmd_size; - if (mwifiex_uap_custom_ie_prepare(tlv, cmd_buf, &ie_size)) - return -1; - cmd->size = cpu_to_le16(ie_size); - break; - default: - return -1; - } - - return 0; -} - -/* This function prepares the AP specific commands before sending them - * to the firmware. - * This is a generic function which calls specific command preparation - * routines based upon the command number. - */ -int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, u16 cmd_no, - u16 cmd_action, u32 type, - void *data_buf, void *cmd_buf) -{ - struct host_cmd_ds_command *cmd = cmd_buf; - - switch (cmd_no) { - case HostCmd_CMD_UAP_SYS_CONFIG: - if (mwifiex_cmd_uap_sys_config(cmd, cmd_action, type, data_buf)) - return -1; - break; - case HostCmd_CMD_UAP_BSS_START: - case HostCmd_CMD_UAP_BSS_STOP: - cmd->command = cpu_to_le16(cmd_no); - cmd->size = cpu_to_le16(S_DS_GEN); - break; - default: - dev_err(priv->adapter->dev, - "PREP_CMD: unknown cmd %#x\n", cmd_no); - return -1; - } - - return 0; -} diff --git a/drivers/net/wireless/mwifiex/uap_event.c b/drivers/net/wireless/mwifiex/uap_event.c deleted file mode 100644 index 21c640d3b579..000000000000 --- a/drivers/net/wireless/mwifiex/uap_event.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Marvell Wireless LAN device driver: AP event handling - * - * Copyright (C) 2012, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "main.h" -#include "11n.h" - -/* - * This function will return the pointer to station entry in station list - * table which matches specified mac address. - * This function should be called after acquiring RA list spinlock. - * NULL is returned if station entry is not found in associated STA list. - */ -struct mwifiex_sta_node * -mwifiex_get_sta_entry(struct mwifiex_private *priv, u8 *mac) -{ - struct mwifiex_sta_node *node; - - if (!mac) - return NULL; - - list_for_each_entry(node, &priv->sta_list, list) { - if (!memcmp(node->mac_addr, mac, ETH_ALEN)) - return node; - } - - return NULL; -} - -/* - * This function will add a sta_node entry to associated station list - * table with the given mac address. - * If entry exist already, existing entry is returned. - * If received mac address is NULL, NULL is returned. - */ -static struct mwifiex_sta_node * -mwifiex_add_sta_entry(struct mwifiex_private *priv, u8 *mac) -{ - struct mwifiex_sta_node *node; - unsigned long flags; - - if (!mac) - return NULL; - - spin_lock_irqsave(&priv->sta_list_spinlock, flags); - node = mwifiex_get_sta_entry(priv, mac); - if (node) - goto done; - - node = kzalloc(sizeof(struct mwifiex_sta_node), GFP_ATOMIC); - if (!node) - goto done; - - memcpy(node->mac_addr, mac, ETH_ALEN); - list_add_tail(&node->list, &priv->sta_list); - -done: - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); - return node; -} - -/* - * This function will search for HT IE in association request IEs - * and set station HT parameters accordingly. - */ -static void -mwifiex_set_sta_ht_cap(struct mwifiex_private *priv, const u8 *ies, - int ies_len, struct mwifiex_sta_node *node) -{ - const struct ieee80211_ht_cap *ht_cap; - - if (!ies) - return; - - ht_cap = (void *)cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, ies, ies_len); - if (ht_cap) { - node->is_11n_enabled = 1; - node->max_amsdu = le16_to_cpu(ht_cap->cap_info) & - IEEE80211_HT_CAP_MAX_AMSDU ? - MWIFIEX_TX_DATA_BUF_SIZE_8K : - MWIFIEX_TX_DATA_BUF_SIZE_4K; - } else { - node->is_11n_enabled = 0; - } - - return; -} - -/* - * This function will delete a station entry from station list - */ -static void mwifiex_del_sta_entry(struct mwifiex_private *priv, u8 *mac) -{ - struct mwifiex_sta_node *node, *tmp; - unsigned long flags; - - spin_lock_irqsave(&priv->sta_list_spinlock, flags); - - node = mwifiex_get_sta_entry(priv, mac); - if (node) { - list_for_each_entry_safe(node, tmp, &priv->sta_list, - list) { - list_del(&node->list); - kfree(node); - } - } - - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); - return; -} - -/* - * This function will delete all stations from associated station list. - */ -static void mwifiex_del_all_sta_list(struct mwifiex_private *priv) -{ - struct mwifiex_sta_node *node, *tmp; - unsigned long flags; - - spin_lock_irqsave(&priv->sta_list_spinlock, flags); - - list_for_each_entry_safe(node, tmp, &priv->sta_list, list) { - list_del(&node->list); - kfree(node); - } - - INIT_LIST_HEAD(&priv->sta_list); - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); - return; -} - -/* - * This function handles AP interface specific events generated by firmware. - * - * Event specific routines are called by this function based - * upon the generated event cause. - * - * - * Events supported for AP - - * - EVENT_UAP_STA_ASSOC - * - EVENT_UAP_STA_DEAUTH - * - EVENT_UAP_BSS_ACTIVE - * - EVENT_UAP_BSS_START - * - EVENT_UAP_BSS_IDLE - * - EVENT_UAP_MIC_COUNTERMEASURES: - */ -int mwifiex_process_uap_event(struct mwifiex_private *priv) -{ - struct mwifiex_adapter *adapter = priv->adapter; - int len, i; - u32 eventcause = adapter->event_cause; - struct station_info sinfo; - struct mwifiex_assoc_event *event; - struct mwifiex_sta_node *node; - u8 *deauth_mac; - struct host_cmd_ds_11n_batimeout *ba_timeout; - u16 ctrl; - - switch (eventcause) { - case EVENT_UAP_STA_ASSOC: - memset(&sinfo, 0, sizeof(sinfo)); - event = (struct mwifiex_assoc_event *) - (adapter->event_body + MWIFIEX_UAP_EVENT_EXTRA_HEADER); - if (le16_to_cpu(event->type) == TLV_TYPE_UAP_MGMT_FRAME) { - len = -1; - - if (ieee80211_is_assoc_req(event->frame_control)) - len = 0; - else if (ieee80211_is_reassoc_req(event->frame_control)) - /* There will be ETH_ALEN bytes of - * current_ap_addr before the re-assoc ies. - */ - len = ETH_ALEN; - - if (len != -1) { - sinfo.filled = STATION_INFO_ASSOC_REQ_IES; - sinfo.assoc_req_ies = &event->data[len]; - len = (u8 *)sinfo.assoc_req_ies - - (u8 *)&event->frame_control; - sinfo.assoc_req_ies_len = - le16_to_cpu(event->len) - (u16)len; - } - } - cfg80211_new_sta(priv->netdev, event->sta_addr, &sinfo, - GFP_KERNEL); - - node = mwifiex_add_sta_entry(priv, event->sta_addr); - if (!node) { - dev_warn(adapter->dev, - "could not create station entry!\n"); - return -1; - } - - if (!priv->ap_11n_enabled) - break; - - mwifiex_set_sta_ht_cap(priv, sinfo.assoc_req_ies, - sinfo.assoc_req_ies_len, node); - - for (i = 0; i < MAX_NUM_TID; i++) { - if (node->is_11n_enabled) - node->ampdu_sta[i] = - priv->aggr_prio_tbl[i].ampdu_user; - else - node->ampdu_sta[i] = BA_STREAM_NOT_ALLOWED; - } - memset(node->rx_seq, 0xff, sizeof(node->rx_seq)); - break; - case EVENT_UAP_STA_DEAUTH: - deauth_mac = adapter->event_body + - MWIFIEX_UAP_EVENT_EXTRA_HEADER; - cfg80211_del_sta(priv->netdev, deauth_mac, GFP_KERNEL); - - if (priv->ap_11n_enabled) { - mwifiex_11n_del_rx_reorder_tbl_by_ta(priv, deauth_mac); - mwifiex_del_tx_ba_stream_tbl_by_ra(priv, deauth_mac); - } - mwifiex_del_sta_entry(priv, deauth_mac); - break; - case EVENT_UAP_BSS_IDLE: - priv->media_connected = false; - if (netif_carrier_ok(priv->netdev)) - netif_carrier_off(priv->netdev); - mwifiex_stop_net_dev_queue(priv->netdev, adapter); - - mwifiex_clean_txrx(priv); - mwifiex_del_all_sta_list(priv); - break; - case EVENT_UAP_BSS_ACTIVE: - priv->media_connected = true; - if (!netif_carrier_ok(priv->netdev)) - netif_carrier_on(priv->netdev); - mwifiex_wake_up_net_dev_queue(priv->netdev, adapter); - break; - case EVENT_UAP_BSS_START: - dev_dbg(adapter->dev, "AP EVENT: event id: %#x\n", eventcause); - memcpy(priv->netdev->dev_addr, adapter->event_body + 2, - ETH_ALEN); - break; - case EVENT_UAP_MIC_COUNTERMEASURES: - /* For future development */ - dev_dbg(adapter->dev, "AP EVENT: event id: %#x\n", eventcause); - break; - case EVENT_AMSDU_AGGR_CTRL: - ctrl = le16_to_cpu(*(__le16 *)adapter->event_body); - dev_dbg(adapter->dev, "event: AMSDU_AGGR_CTRL %d\n", ctrl); - - if (priv->media_connected) { - adapter->tx_buf_size = - min_t(u16, adapter->curr_tx_buf_size, ctrl); - dev_dbg(adapter->dev, "event: tx_buf_size %d\n", - adapter->tx_buf_size); - } - break; - case EVENT_ADDBA: - dev_dbg(adapter->dev, "event: ADDBA Request\n"); - if (priv->media_connected) - mwifiex_send_cmd_async(priv, HostCmd_CMD_11N_ADDBA_RSP, - HostCmd_ACT_GEN_SET, 0, - adapter->event_body); - break; - case EVENT_DELBA: - dev_dbg(adapter->dev, "event: DELBA Request\n"); - if (priv->media_connected) - mwifiex_11n_delete_ba_stream(priv, adapter->event_body); - break; - case EVENT_BA_STREAM_TIEMOUT: - dev_dbg(adapter->dev, "event: BA Stream timeout\n"); - if (priv->media_connected) { - ba_timeout = (void *)adapter->event_body; - mwifiex_11n_ba_stream_timeout(priv, ba_timeout); - } - break; - default: - dev_dbg(adapter->dev, "event: unknown event id: %#x\n", - eventcause); - break; - } - - return 0; -} diff --git a/drivers/net/wireless/mwifiex/uap_txrx.c b/drivers/net/wireless/mwifiex/uap_txrx.c deleted file mode 100644 index 48e67247e8b1..000000000000 --- a/drivers/net/wireless/mwifiex/uap_txrx.c +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Marvell Wireless LAN device driver: AP TX and RX data handling - * - * Copyright (C) 2012, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "main.h" -#include "wmm.h" -#include "11n_aggr.h" -#include "11n_rxreorder.h" - -static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv, - struct sk_buff *skb) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct uap_rxpd *uap_rx_pd; - struct rx_packet_hdr *rx_pkt_hdr; - struct sk_buff *new_skb; - struct mwifiex_txinfo *tx_info; - int hdr_chop; - struct timeval tv; - struct ethhdr *p_ethhdr; - u8 rfc1042_eth_hdr[ETH_ALEN] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; - - uap_rx_pd = (struct uap_rxpd *)(skb->data); - rx_pkt_hdr = (void *)uap_rx_pd + le16_to_cpu(uap_rx_pd->rx_pkt_offset); - - if ((atomic_read(&adapter->pending_bridged_pkts) >= - MWIFIEX_BRIDGED_PKTS_THRESHOLD)) { - dev_err(priv->adapter->dev, - "Tx: Bridge packet limit reached. Drop packet!\n"); - kfree_skb(skb); - return; - } - - if (!memcmp(&rx_pkt_hdr->rfc1042_hdr, - rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr))) { - /* Replace the 803 header and rfc1042 header (llc/snap) with - * an Ethernet II header, keep the src/dst and snap_type - * (ethertype). - * - * The firmware only passes up SNAP frames converting all RX - * data from 802.11 to 802.2/LLC/SNAP frames. - * - * To create the Ethernet II, just move the src, dst address - * right before the snap_type. - */ - p_ethhdr = (struct ethhdr *) - ((u8 *)(&rx_pkt_hdr->eth803_hdr) - + sizeof(rx_pkt_hdr->eth803_hdr) - + sizeof(rx_pkt_hdr->rfc1042_hdr) - - sizeof(rx_pkt_hdr->eth803_hdr.h_dest) - - sizeof(rx_pkt_hdr->eth803_hdr.h_source) - - sizeof(rx_pkt_hdr->rfc1042_hdr.snap_type)); - memcpy(p_ethhdr->h_source, rx_pkt_hdr->eth803_hdr.h_source, - sizeof(p_ethhdr->h_source)); - memcpy(p_ethhdr->h_dest, rx_pkt_hdr->eth803_hdr.h_dest, - sizeof(p_ethhdr->h_dest)); - /* Chop off the rxpd + the excess memory from - * 802.2/llc/snap header that was removed. - */ - hdr_chop = (u8 *)p_ethhdr - (u8 *)uap_rx_pd; - } else { - /* Chop off the rxpd */ - hdr_chop = (u8 *)&rx_pkt_hdr->eth803_hdr - (u8 *)uap_rx_pd; - } - - /* Chop off the leading header bytes so the it points - * to the start of either the reconstructed EthII frame - * or the 802.2/llc/snap frame. - */ - skb_pull(skb, hdr_chop); - - if (skb_headroom(skb) < MWIFIEX_MIN_DATA_HEADER_LEN) { - dev_dbg(priv->adapter->dev, - "data: Tx: insufficient skb headroom %d\n", - skb_headroom(skb)); - /* Insufficient skb headroom - allocate a new skb */ - new_skb = - skb_realloc_headroom(skb, MWIFIEX_MIN_DATA_HEADER_LEN); - if (unlikely(!new_skb)) { - dev_err(priv->adapter->dev, - "Tx: cannot allocate new_skb\n"); - kfree_skb(skb); - priv->stats.tx_dropped++; - return; - } - - kfree_skb(skb); - skb = new_skb; - dev_dbg(priv->adapter->dev, "info: new skb headroom %d\n", - skb_headroom(skb)); - } - - tx_info = MWIFIEX_SKB_TXCB(skb); - tx_info->bss_num = priv->bss_num; - tx_info->bss_type = priv->bss_type; - tx_info->flags |= MWIFIEX_BUF_FLAG_BRIDGED_PKT; - - do_gettimeofday(&tv); - skb->tstamp = timeval_to_ktime(tv); - mwifiex_wmm_add_buf_txqueue(priv, skb); - atomic_inc(&adapter->tx_pending); - atomic_inc(&adapter->pending_bridged_pkts); - - if ((atomic_read(&adapter->tx_pending) >= MAX_TX_PENDING)) { - mwifiex_set_trans_start(priv->netdev); - mwifiex_stop_net_dev_queue(priv->netdev, priv->adapter); - } - return; -} - -/* - * This function contains logic for AP packet forwarding. - * - * If a packet is multicast/broadcast, it is sent to kernel/upper layer - * as well as queued back to AP TX queue so that it can be sent to other - * associated stations. - * If a packet is unicast and RA is present in associated station list, - * it is again requeued into AP TX queue. - * If a packet is unicast and RA is not in associated station list, - * packet is forwarded to kernel to handle routing logic. - */ -int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv, - struct sk_buff *skb) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct uap_rxpd *uap_rx_pd; - struct rx_packet_hdr *rx_pkt_hdr; - u8 ra[ETH_ALEN]; - struct sk_buff *skb_uap; - - uap_rx_pd = (struct uap_rxpd *)(skb->data); - rx_pkt_hdr = (void *)uap_rx_pd + le16_to_cpu(uap_rx_pd->rx_pkt_offset); - - /* don't do packet forwarding in disconnected state */ - if (!priv->media_connected) { - dev_err(adapter->dev, "drop packet in disconnected state.\n"); - dev_kfree_skb_any(skb); - return 0; - } - - memcpy(ra, rx_pkt_hdr->eth803_hdr.h_dest, ETH_ALEN); - - if (is_multicast_ether_addr(ra)) { - skb_uap = skb_copy(skb, GFP_ATOMIC); - mwifiex_uap_queue_bridged_pkt(priv, skb_uap); - } else { - if (mwifiex_get_sta_entry(priv, ra)) { - /* Requeue Intra-BSS packet */ - mwifiex_uap_queue_bridged_pkt(priv, skb); - return 0; - } - } - - /* Forward unicat/Inter-BSS packets to kernel. */ - return mwifiex_process_rx_packet(priv, skb); -} - -/* - * This function processes the packet received on AP interface. - * - * The function looks into the RxPD and performs sanity tests on the - * received buffer to ensure its a valid packet before processing it - * further. If the packet is determined to be aggregated, it is - * de-aggregated accordingly. Then skb is passed to AP packet forwarding logic. - * - * The completion callback is called after processing is complete. - */ -int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv, - struct sk_buff *skb) -{ - struct mwifiex_adapter *adapter = priv->adapter; - int ret; - struct uap_rxpd *uap_rx_pd; - struct rx_packet_hdr *rx_pkt_hdr; - u16 rx_pkt_type; - u8 ta[ETH_ALEN], pkt_type; - struct mwifiex_sta_node *node; - - uap_rx_pd = (struct uap_rxpd *)(skb->data); - rx_pkt_type = le16_to_cpu(uap_rx_pd->rx_pkt_type); - rx_pkt_hdr = (void *)uap_rx_pd + le16_to_cpu(uap_rx_pd->rx_pkt_offset); - - if ((le16_to_cpu(uap_rx_pd->rx_pkt_offset) + - le16_to_cpu(uap_rx_pd->rx_pkt_length)) > (u16) skb->len) { - dev_err(adapter->dev, - "wrong rx packet: len=%d, offset=%d, length=%d\n", - skb->len, le16_to_cpu(uap_rx_pd->rx_pkt_offset), - le16_to_cpu(uap_rx_pd->rx_pkt_length)); - priv->stats.rx_dropped++; - - if (adapter->if_ops.data_complete) - adapter->if_ops.data_complete(adapter, skb); - else - dev_kfree_skb_any(skb); - - return 0; - } - - if (le16_to_cpu(uap_rx_pd->rx_pkt_type) == PKT_TYPE_AMSDU) { - struct sk_buff_head list; - struct sk_buff *rx_skb; - - __skb_queue_head_init(&list); - skb_pull(skb, le16_to_cpu(uap_rx_pd->rx_pkt_offset)); - skb_trim(skb, le16_to_cpu(uap_rx_pd->rx_pkt_length)); - - ieee80211_amsdu_to_8023s(skb, &list, priv->curr_addr, - priv->wdev->iftype, 0, false); - - while (!skb_queue_empty(&list)) { - rx_skb = __skb_dequeue(&list); - ret = mwifiex_recv_packet(priv, rx_skb); - if (ret) - dev_err(adapter->dev, - "AP:Rx A-MSDU failed"); - } - - return 0; - } else if (rx_pkt_type == PKT_TYPE_MGMT) { - ret = mwifiex_process_mgmt_packet(priv, skb); - if (ret) - dev_err(adapter->dev, "Rx of mgmt packet failed"); - dev_kfree_skb_any(skb); - return ret; - } - - memcpy(ta, rx_pkt_hdr->eth803_hdr.h_source, ETH_ALEN); - - if (rx_pkt_type != PKT_TYPE_BAR && uap_rx_pd->priority < MAX_NUM_TID) { - node = mwifiex_get_sta_entry(priv, ta); - if (node) - node->rx_seq[uap_rx_pd->priority] = - le16_to_cpu(uap_rx_pd->seq_num); - } - - if (!priv->ap_11n_enabled || - (!mwifiex_11n_get_rx_reorder_tbl(priv, uap_rx_pd->priority, ta) && - (le16_to_cpu(uap_rx_pd->rx_pkt_type) != PKT_TYPE_AMSDU))) { - ret = mwifiex_handle_uap_rx_forward(priv, skb); - return ret; - } - - /* Reorder and send to kernel */ - pkt_type = (u8)le16_to_cpu(uap_rx_pd->rx_pkt_type); - ret = mwifiex_11n_rx_reorder_pkt(priv, le16_to_cpu(uap_rx_pd->seq_num), - uap_rx_pd->priority, ta, pkt_type, - skb); - - if (ret || (rx_pkt_type == PKT_TYPE_BAR)) { - if (adapter->if_ops.data_complete) - adapter->if_ops.data_complete(adapter, skb); - else - dev_kfree_skb_any(skb); - } - - if (ret) - priv->stats.rx_dropped++; - - return ret; -} - -/* - * This function fills the TxPD for AP tx packets. - * - * The Tx buffer received by this function should already have the - * header space allocated for TxPD. - * - * This function inserts the TxPD in between interface header and actual - * data and adjusts the buffer pointers accordingly. - * - * The following TxPD fields are set by this function, as required - - * - BSS number - * - Tx packet length and offset - * - Priority - * - Packet delay - * - Priority specific Tx control - * - Flags - */ -void *mwifiex_process_uap_txpd(struct mwifiex_private *priv, - struct sk_buff *skb) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct uap_txpd *txpd; - struct mwifiex_txinfo *tx_info = MWIFIEX_SKB_TXCB(skb); - int pad, len; - u16 pkt_type; - - if (!skb->len) { - dev_err(adapter->dev, "Tx: bad packet length: %d\n", skb->len); - tx_info->status_code = -1; - return skb->data; - } - - pkt_type = mwifiex_is_skb_mgmt_frame(skb) ? PKT_TYPE_MGMT : 0; - - /* If skb->data is not aligned, add padding */ - pad = (4 - (((void *)skb->data - NULL) & 0x3)) % 4; - - len = sizeof(*txpd) + pad; - - BUG_ON(skb_headroom(skb) < len + INTF_HEADER_LEN); - - skb_push(skb, len); - - txpd = (struct uap_txpd *)skb->data; - memset(txpd, 0, sizeof(*txpd)); - txpd->bss_num = priv->bss_num; - txpd->bss_type = priv->bss_type; - txpd->tx_pkt_length = cpu_to_le16((u16)(skb->len - len)); - - txpd->priority = (u8)skb->priority; - txpd->pkt_delay_2ms = mwifiex_wmm_compute_drv_pkt_delay(priv, skb); - - if (txpd->priority < ARRAY_SIZE(priv->wmm.user_pri_pkt_tx_ctrl)) - /* - * Set the priority specific tx_control field, setting of 0 will - * cause the default value to be used later in this function. - */ - txpd->tx_control = - cpu_to_le32(priv->wmm.user_pri_pkt_tx_ctrl[txpd->priority]); - - /* Offset of actual data */ - if (pkt_type == PKT_TYPE_MGMT) { - /* Set the packet type and add header for management frame */ - txpd->tx_pkt_type = cpu_to_le16(pkt_type); - len += MWIFIEX_MGMT_FRAME_HEADER_SIZE; - } - - txpd->tx_pkt_offset = cpu_to_le16(len); - - /* make space for INTF_HEADER_LEN */ - skb_push(skb, INTF_HEADER_LEN); - - if (!txpd->tx_control) - /* TxCtrl set by user or default */ - txpd->tx_control = cpu_to_le32(priv->pkt_tx_ctrl); - - return skb->data; -} diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c deleted file mode 100644 index b7adf3d46463..000000000000 --- a/drivers/net/wireless/mwifiex/usb.c +++ /dev/null @@ -1,1033 +0,0 @@ -/* - * Marvell Wireless LAN device driver: USB specific handling - * - * Copyright (C) 2012, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "main.h" -#include "usb.h" - -#define USB_VERSION "1.0" - -static const char usbdriver_name[] = "usb8797"; - -static u8 user_rmmod; -static struct mwifiex_if_ops usb_ops; -static struct semaphore add_remove_card_sem; - -static struct usb_device_id mwifiex_usb_table[] = { - {USB_DEVICE(USB8797_VID, USB8797_PID_1)}, - {USB_DEVICE_AND_INTERFACE_INFO(USB8797_VID, USB8797_PID_2, - USB_CLASS_VENDOR_SPEC, - USB_SUBCLASS_VENDOR_SPEC, 0xff)}, - { } /* Terminating entry */ -}; - -MODULE_DEVICE_TABLE(usb, mwifiex_usb_table); - -static int mwifiex_usb_submit_rx_urb(struct urb_context *ctx, int size); - -/* This function handles received packet. Necessary action is taken based on - * cmd/event/data. - */ -static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, - struct sk_buff *skb, u8 ep) -{ - struct device *dev = adapter->dev; - u32 recv_type; - __le32 tmp; - int ret; - - if (adapter->hs_activated) - mwifiex_process_hs_config(adapter); - - if (skb->len < INTF_HEADER_LEN) { - dev_err(dev, "%s: invalid skb->len\n", __func__); - return -1; - } - - switch (ep) { - case MWIFIEX_USB_EP_CMD_EVENT: - dev_dbg(dev, "%s: EP_CMD_EVENT\n", __func__); - skb_copy_from_linear_data(skb, &tmp, INTF_HEADER_LEN); - recv_type = le32_to_cpu(tmp); - skb_pull(skb, INTF_HEADER_LEN); - - switch (recv_type) { - case MWIFIEX_USB_TYPE_CMD: - if (skb->len > MWIFIEX_SIZE_OF_CMD_BUFFER) { - dev_err(dev, "CMD: skb->len too large\n"); - ret = -1; - goto exit_restore_skb; - } else if (!adapter->curr_cmd) { - dev_dbg(dev, "CMD: no curr_cmd\n"); - if (adapter->ps_state == PS_STATE_SLEEP_CFM) { - mwifiex_process_sleep_confirm_resp( - adapter, skb->data, - skb->len); - ret = 0; - goto exit_restore_skb; - } - ret = -1; - goto exit_restore_skb; - } - - adapter->curr_cmd->resp_skb = skb; - adapter->cmd_resp_received = true; - break; - case MWIFIEX_USB_TYPE_EVENT: - if (skb->len < sizeof(u32)) { - dev_err(dev, "EVENT: skb->len too small\n"); - ret = -1; - goto exit_restore_skb; - } - skb_copy_from_linear_data(skb, &tmp, sizeof(u32)); - adapter->event_cause = le32_to_cpu(tmp); - dev_dbg(dev, "event_cause %#x\n", adapter->event_cause); - - if (skb->len > MAX_EVENT_SIZE) { - dev_err(dev, "EVENT: event body too large\n"); - ret = -1; - goto exit_restore_skb; - } - - memcpy(adapter->event_body, skb->data + - MWIFIEX_EVENT_HEADER_LEN, skb->len); - - adapter->event_received = true; - adapter->event_skb = skb; - break; - default: - dev_err(dev, "unknown recv_type %#x\n", recv_type); - return -1; - } - break; - case MWIFIEX_USB_EP_DATA: - dev_dbg(dev, "%s: EP_DATA\n", __func__); - if (skb->len > MWIFIEX_RX_DATA_BUF_SIZE) { - dev_err(dev, "DATA: skb->len too large\n"); - return -1; - } - skb_queue_tail(&adapter->usb_rx_data_q, skb); - adapter->data_received = true; - break; - default: - dev_err(dev, "%s: unknown endport %#x\n", __func__, ep); - return -1; - } - - return -EINPROGRESS; - -exit_restore_skb: - /* The buffer will be reused for further cmds/events */ - skb_push(skb, INTF_HEADER_LEN); - - return ret; -} - -static void mwifiex_usb_rx_complete(struct urb *urb) -{ - struct urb_context *context = (struct urb_context *)urb->context; - struct mwifiex_adapter *adapter = context->adapter; - struct sk_buff *skb = context->skb; - struct usb_card_rec *card; - int recv_length = urb->actual_length; - int size, status; - - if (!adapter || !adapter->card) { - pr_err("mwifiex adapter or card structure is not valid\n"); - return; - } - - card = (struct usb_card_rec *)adapter->card; - if (card->rx_cmd_ep == context->ep) - atomic_dec(&card->rx_cmd_urb_pending); - else - atomic_dec(&card->rx_data_urb_pending); - - if (recv_length) { - if (urb->status || (adapter->surprise_removed)) { - dev_err(adapter->dev, - "URB status is failed: %d\n", urb->status); - /* Do not free skb in case of command ep */ - if (card->rx_cmd_ep != context->ep) - dev_kfree_skb_any(skb); - goto setup_for_next; - } - if (skb->len > recv_length) - skb_trim(skb, recv_length); - else - skb_put(skb, recv_length - skb->len); - - atomic_inc(&adapter->rx_pending); - status = mwifiex_usb_recv(adapter, skb, context->ep); - - dev_dbg(adapter->dev, "info: recv_length=%d, status=%d\n", - recv_length, status); - if (status == -EINPROGRESS) { - queue_work(adapter->workqueue, &adapter->main_work); - - /* urb for data_ep is re-submitted now; - * urb for cmd_ep will be re-submitted in callback - * mwifiex_usb_recv_complete - */ - if (card->rx_cmd_ep == context->ep) - return; - } else { - atomic_dec(&adapter->rx_pending); - if (status == -1) - dev_err(adapter->dev, - "received data processing failed!\n"); - - /* Do not free skb in case of command ep */ - if (card->rx_cmd_ep != context->ep) - dev_kfree_skb_any(skb); - } - } else if (urb->status) { - if (!adapter->is_suspended) { - dev_warn(adapter->dev, - "Card is removed: %d\n", urb->status); - adapter->surprise_removed = true; - } - dev_kfree_skb_any(skb); - return; - } else { - /* Do not free skb in case of command ep */ - if (card->rx_cmd_ep != context->ep) - dev_kfree_skb_any(skb); - - /* fall through setup_for_next */ - } - -setup_for_next: - if (card->rx_cmd_ep == context->ep) - size = MWIFIEX_RX_CMD_BUF_SIZE; - else - size = MWIFIEX_RX_DATA_BUF_SIZE; - - mwifiex_usb_submit_rx_urb(context, size); - - return; -} - -static void mwifiex_usb_tx_complete(struct urb *urb) -{ - struct urb_context *context = (struct urb_context *)(urb->context); - struct mwifiex_adapter *adapter = context->adapter; - struct usb_card_rec *card = adapter->card; - - dev_dbg(adapter->dev, "%s: status: %d\n", __func__, urb->status); - - if (context->ep == card->tx_cmd_ep) { - dev_dbg(adapter->dev, "%s: CMD\n", __func__); - atomic_dec(&card->tx_cmd_urb_pending); - adapter->cmd_sent = false; - } else { - dev_dbg(adapter->dev, "%s: DATA\n", __func__); - atomic_dec(&card->tx_data_urb_pending); - mwifiex_write_data_complete(adapter, context->skb, 0, - urb->status ? -1 : 0); - } - - queue_work(adapter->workqueue, &adapter->main_work); - - return; -} - -static int mwifiex_usb_submit_rx_urb(struct urb_context *ctx, int size) -{ - struct mwifiex_adapter *adapter = ctx->adapter; - struct usb_card_rec *card = (struct usb_card_rec *)adapter->card; - - if (card->rx_cmd_ep != ctx->ep) { - ctx->skb = dev_alloc_skb(size); - if (!ctx->skb) { - dev_err(adapter->dev, - "%s: dev_alloc_skb failed\n", __func__); - return -ENOMEM; - } - } - - usb_fill_bulk_urb(ctx->urb, card->udev, - usb_rcvbulkpipe(card->udev, ctx->ep), ctx->skb->data, - size, mwifiex_usb_rx_complete, (void *)ctx); - - if (card->rx_cmd_ep == ctx->ep) - atomic_inc(&card->rx_cmd_urb_pending); - else - atomic_inc(&card->rx_data_urb_pending); - - if (usb_submit_urb(ctx->urb, GFP_ATOMIC)) { - dev_err(adapter->dev, "usb_submit_urb failed\n"); - dev_kfree_skb_any(ctx->skb); - ctx->skb = NULL; - - if (card->rx_cmd_ep == ctx->ep) - atomic_dec(&card->rx_cmd_urb_pending); - else - atomic_dec(&card->rx_data_urb_pending); - - return -1; - } - - return 0; -} - -static void mwifiex_usb_free(struct usb_card_rec *card) -{ - int i; - - if (atomic_read(&card->rx_cmd_urb_pending) && card->rx_cmd.urb) - usb_kill_urb(card->rx_cmd.urb); - - usb_free_urb(card->rx_cmd.urb); - card->rx_cmd.urb = NULL; - - if (atomic_read(&card->rx_data_urb_pending)) - for (i = 0; i < MWIFIEX_RX_DATA_URB; i++) - if (card->rx_data_list[i].urb) - usb_kill_urb(card->rx_data_list[i].urb); - - for (i = 0; i < MWIFIEX_RX_DATA_URB; i++) { - usb_free_urb(card->rx_data_list[i].urb); - card->rx_data_list[i].urb = NULL; - } - - for (i = 0; i < MWIFIEX_TX_DATA_URB; i++) { - usb_free_urb(card->tx_data_list[i].urb); - card->tx_data_list[i].urb = NULL; - } - - usb_free_urb(card->tx_cmd.urb); - card->tx_cmd.urb = NULL; - - return; -} - -/* This function probes an mwifiex device and registers it. It allocates - * the card structure, initiates the device registration and initialization - * procedure by adding a logical interface. - */ -static int mwifiex_usb_probe(struct usb_interface *intf, - const struct usb_device_id *id) -{ - struct usb_device *udev = interface_to_usbdev(intf); - struct usb_host_interface *iface_desc = intf->cur_altsetting; - struct usb_endpoint_descriptor *epd; - int ret, i; - struct usb_card_rec *card; - u16 id_vendor, id_product, bcd_device, bcd_usb; - - card = kzalloc(sizeof(struct usb_card_rec), GFP_KERNEL); - if (!card) - return -ENOMEM; - - id_vendor = le16_to_cpu(udev->descriptor.idVendor); - id_product = le16_to_cpu(udev->descriptor.idProduct); - bcd_device = le16_to_cpu(udev->descriptor.bcdDevice); - bcd_usb = le16_to_cpu(udev->descriptor.bcdUSB); - pr_debug("info: VID/PID = %X/%X, Boot2 version = %X\n", - id_vendor, id_product, bcd_device); - - /* PID_1 is used for firmware downloading only */ - if (id_product == USB8797_PID_1) - card->usb_boot_state = USB8797_FW_DNLD; - else - card->usb_boot_state = USB8797_FW_READY; - - card->udev = udev; - card->intf = intf; - - pr_debug("info: bcdUSB=%#x Device Class=%#x SubClass=%#x Protocol=%#x\n", - udev->descriptor.bcdUSB, udev->descriptor.bDeviceClass, - udev->descriptor.bDeviceSubClass, - udev->descriptor.bDeviceProtocol); - - for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { - epd = &iface_desc->endpoint[i].desc; - if (usb_endpoint_dir_in(epd) && - usb_endpoint_num(epd) == MWIFIEX_USB_EP_CMD_EVENT && - usb_endpoint_xfer_bulk(epd)) { - pr_debug("info: bulk IN: max pkt size: %d, addr: %d\n", - le16_to_cpu(epd->wMaxPacketSize), - epd->bEndpointAddress); - card->rx_cmd_ep = usb_endpoint_num(epd); - atomic_set(&card->rx_cmd_urb_pending, 0); - } - if (usb_endpoint_dir_in(epd) && - usb_endpoint_num(epd) == MWIFIEX_USB_EP_DATA && - usb_endpoint_xfer_bulk(epd)) { - pr_debug("info: bulk IN: max pkt size: %d, addr: %d\n", - le16_to_cpu(epd->wMaxPacketSize), - epd->bEndpointAddress); - card->rx_data_ep = usb_endpoint_num(epd); - atomic_set(&card->rx_data_urb_pending, 0); - } - if (usb_endpoint_dir_out(epd) && - usb_endpoint_num(epd) == MWIFIEX_USB_EP_DATA && - usb_endpoint_xfer_bulk(epd)) { - pr_debug("info: bulk OUT: max pkt size: %d, addr: %d\n", - le16_to_cpu(epd->wMaxPacketSize), - epd->bEndpointAddress); - card->tx_data_ep = usb_endpoint_num(epd); - atomic_set(&card->tx_data_urb_pending, 0); - } - if (usb_endpoint_dir_out(epd) && - usb_endpoint_num(epd) == MWIFIEX_USB_EP_CMD_EVENT && - usb_endpoint_xfer_bulk(epd)) { - pr_debug("info: bulk OUT: max pkt size: %d, addr: %d\n", - le16_to_cpu(epd->wMaxPacketSize), - epd->bEndpointAddress); - card->tx_cmd_ep = usb_endpoint_num(epd); - atomic_set(&card->tx_cmd_urb_pending, 0); - card->bulk_out_maxpktsize = - le16_to_cpu(epd->wMaxPacketSize); - } - } - - usb_set_intfdata(intf, card); - - ret = mwifiex_add_card(card, &add_remove_card_sem, &usb_ops, - MWIFIEX_USB); - if (ret) { - pr_err("%s: mwifiex_add_card failed: %d\n", __func__, ret); - usb_reset_device(udev); - kfree(card); - return ret; - } - - usb_get_dev(udev); - - return 0; -} - -/* Kernel needs to suspend all functions separately. Therefore all - * registered functions must have drivers with suspend and resume - * methods. Failing that the kernel simply removes the whole card. - * - * If already not suspended, this function allocates and sends a - * 'host sleep activate' request to the firmware and turns off the traffic. - */ -static int mwifiex_usb_suspend(struct usb_interface *intf, pm_message_t message) -{ - struct usb_card_rec *card = usb_get_intfdata(intf); - struct mwifiex_adapter *adapter; - int i; - - if (!card || !card->adapter) { - pr_err("%s: card or card->adapter is NULL\n", __func__); - return 0; - } - adapter = card->adapter; - - if (unlikely(adapter->is_suspended)) - dev_warn(adapter->dev, "Device already suspended\n"); - - mwifiex_enable_hs(adapter); - - /* 'is_suspended' flag indicates device is suspended. - * It must be set here before the usb_kill_urb() calls. Reason - * is in the complete handlers, urb->status(= -ENOENT) and - * this flag is used in combination to distinguish between a - * 'suspended' state and a 'disconnect' one. - */ - adapter->is_suspended = true; - - if (atomic_read(&card->rx_cmd_urb_pending) && card->rx_cmd.urb) - usb_kill_urb(card->rx_cmd.urb); - - if (atomic_read(&card->rx_data_urb_pending)) - for (i = 0; i < MWIFIEX_RX_DATA_URB; i++) - if (card->rx_data_list[i].urb) - usb_kill_urb(card->rx_data_list[i].urb); - - for (i = 0; i < MWIFIEX_TX_DATA_URB; i++) - if (card->tx_data_list[i].urb) - usb_kill_urb(card->tx_data_list[i].urb); - - if (card->tx_cmd.urb) - usb_kill_urb(card->tx_cmd.urb); - - return 0; -} - -/* Kernel needs to suspend all functions separately. Therefore all - * registered functions must have drivers with suspend and resume - * methods. Failing that the kernel simply removes the whole card. - * - * If already not resumed, this function turns on the traffic and - * sends a 'host sleep cancel' request to the firmware. - */ -static int mwifiex_usb_resume(struct usb_interface *intf) -{ - struct usb_card_rec *card = usb_get_intfdata(intf); - struct mwifiex_adapter *adapter; - int i; - - if (!card || !card->adapter) { - pr_err("%s: card or card->adapter is NULL\n", __func__); - return 0; - } - adapter = card->adapter; - - if (unlikely(!adapter->is_suspended)) { - dev_warn(adapter->dev, "Device already resumed\n"); - return 0; - } - - /* Indicate device resumed. The netdev queue will be resumed only - * after the urbs have been re-submitted - */ - adapter->is_suspended = false; - - if (!atomic_read(&card->rx_data_urb_pending)) - for (i = 0; i < MWIFIEX_RX_DATA_URB; i++) - mwifiex_usb_submit_rx_urb(&card->rx_data_list[i], - MWIFIEX_RX_DATA_BUF_SIZE); - - if (!atomic_read(&card->rx_cmd_urb_pending)) { - card->rx_cmd.skb = dev_alloc_skb(MWIFIEX_RX_CMD_BUF_SIZE); - if (card->rx_cmd.skb) - mwifiex_usb_submit_rx_urb(&card->rx_cmd, - MWIFIEX_RX_CMD_BUF_SIZE); - } - - /* Disable Host Sleep */ - if (adapter->hs_activated) - mwifiex_cancel_hs(mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_ANY), - MWIFIEX_ASYNC_CMD); - -#ifdef CONFIG_PM - /* Resume handler may be called due to remote wakeup, - * force to exit suspend anyway - */ - usb_disable_autosuspend(card->udev); -#endif /* CONFIG_PM */ - - return 0; -} - -static void mwifiex_usb_disconnect(struct usb_interface *intf) -{ - struct usb_card_rec *card = usb_get_intfdata(intf); - struct mwifiex_adapter *adapter; - int i; - - if (!card || !card->adapter) { - pr_err("%s: card or card->adapter is NULL\n", __func__); - return; - } - - adapter = card->adapter; - if (!adapter->priv_num) - return; - - /* In case driver is removed when asynchronous FW downloading is - * in progress - */ - wait_for_completion(&adapter->fw_load); - - if (user_rmmod) { -#ifdef CONFIG_PM - if (adapter->is_suspended) - mwifiex_usb_resume(intf); -#endif - for (i = 0; i < adapter->priv_num; i++) - if ((GET_BSS_ROLE(adapter->priv[i]) == - MWIFIEX_BSS_ROLE_STA) && - adapter->priv[i]->media_connected) - mwifiex_deauthenticate(adapter->priv[i], NULL); - - mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_ANY), - MWIFIEX_FUNC_SHUTDOWN); - } - - mwifiex_usb_free(card); - - dev_dbg(adapter->dev, "%s: removing card\n", __func__); - mwifiex_remove_card(adapter, &add_remove_card_sem); - - usb_set_intfdata(intf, NULL); - usb_put_dev(interface_to_usbdev(intf)); - kfree(card); - - return; -} - -static struct usb_driver mwifiex_usb_driver = { - .name = usbdriver_name, - .probe = mwifiex_usb_probe, - .disconnect = mwifiex_usb_disconnect, - .id_table = mwifiex_usb_table, - .suspend = mwifiex_usb_suspend, - .resume = mwifiex_usb_resume, - .supports_autosuspend = 1, -}; - -static int mwifiex_usb_tx_init(struct mwifiex_adapter *adapter) -{ - struct usb_card_rec *card = (struct usb_card_rec *)adapter->card; - int i; - - card->tx_cmd.adapter = adapter; - card->tx_cmd.ep = card->tx_cmd_ep; - - card->tx_cmd.urb = usb_alloc_urb(0, GFP_KERNEL); - if (!card->tx_cmd.urb) { - dev_err(adapter->dev, "tx_cmd.urb allocation failed\n"); - return -ENOMEM; - } - - card->tx_data_ix = 0; - - for (i = 0; i < MWIFIEX_TX_DATA_URB; i++) { - card->tx_data_list[i].adapter = adapter; - card->tx_data_list[i].ep = card->tx_data_ep; - - card->tx_data_list[i].urb = usb_alloc_urb(0, GFP_KERNEL); - if (!card->tx_data_list[i].urb) { - dev_err(adapter->dev, - "tx_data_list[] urb allocation failed\n"); - return -ENOMEM; - } - } - - return 0; -} - -static int mwifiex_usb_rx_init(struct mwifiex_adapter *adapter) -{ - struct usb_card_rec *card = (struct usb_card_rec *)adapter->card; - int i; - - card->rx_cmd.adapter = adapter; - card->rx_cmd.ep = card->rx_cmd_ep; - - card->rx_cmd.urb = usb_alloc_urb(0, GFP_KERNEL); - if (!card->rx_cmd.urb) { - dev_err(adapter->dev, "rx_cmd.urb allocation failed\n"); - return -ENOMEM; - } - - card->rx_cmd.skb = dev_alloc_skb(MWIFIEX_RX_CMD_BUF_SIZE); - if (!card->rx_cmd.skb) { - dev_err(adapter->dev, "rx_cmd.skb allocation failed\n"); - return -ENOMEM; - } - - if (mwifiex_usb_submit_rx_urb(&card->rx_cmd, MWIFIEX_RX_CMD_BUF_SIZE)) - return -1; - - for (i = 0; i < MWIFIEX_RX_DATA_URB; i++) { - card->rx_data_list[i].adapter = adapter; - card->rx_data_list[i].ep = card->rx_data_ep; - - card->rx_data_list[i].urb = usb_alloc_urb(0, GFP_KERNEL); - if (!card->rx_data_list[i].urb) { - dev_err(adapter->dev, - "rx_data_list[] urb allocation failed\n"); - return -1; - } - if (mwifiex_usb_submit_rx_urb(&card->rx_data_list[i], - MWIFIEX_RX_DATA_BUF_SIZE)) - return -1; - } - - return 0; -} - -static int mwifiex_write_data_sync(struct mwifiex_adapter *adapter, u8 *pbuf, - u32 *len, u8 ep, u32 timeout) -{ - struct usb_card_rec *card = adapter->card; - int actual_length, ret; - - if (!(*len % card->bulk_out_maxpktsize)) - (*len)++; - - /* Send the data block */ - ret = usb_bulk_msg(card->udev, usb_sndbulkpipe(card->udev, ep), pbuf, - *len, &actual_length, timeout); - if (ret) { - dev_err(adapter->dev, "usb_bulk_msg for tx failed: %d\n", ret); - return ret; - } - - *len = actual_length; - - return ret; -} - -static int mwifiex_read_data_sync(struct mwifiex_adapter *adapter, u8 *pbuf, - u32 *len, u8 ep, u32 timeout) -{ - struct usb_card_rec *card = adapter->card; - int actual_length, ret; - - /* Receive the data response */ - ret = usb_bulk_msg(card->udev, usb_rcvbulkpipe(card->udev, ep), pbuf, - *len, &actual_length, timeout); - if (ret) { - dev_err(adapter->dev, "usb_bulk_msg for rx failed: %d\n", ret); - return ret; - } - - *len = actual_length; - - return ret; -} - -/* This function write a command/data packet to card. */ -static int mwifiex_usb_host_to_card(struct mwifiex_adapter *adapter, u8 ep, - struct sk_buff *skb, - struct mwifiex_tx_param *tx_param) -{ - struct usb_card_rec *card = adapter->card; - struct urb_context *context; - u8 *data = (u8 *)skb->data; - struct urb *tx_urb; - - if (adapter->is_suspended) { - dev_err(adapter->dev, - "%s: not allowed while suspended\n", __func__); - return -1; - } - - if (adapter->surprise_removed) { - dev_err(adapter->dev, "%s: device removed\n", __func__); - return -1; - } - - if (ep == card->tx_data_ep && - atomic_read(&card->tx_data_urb_pending) >= MWIFIEX_TX_DATA_URB) { - return -EBUSY; - } - - dev_dbg(adapter->dev, "%s: ep=%d\n", __func__, ep); - - if (ep == card->tx_cmd_ep) { - context = &card->tx_cmd; - } else { - if (card->tx_data_ix >= MWIFIEX_TX_DATA_URB) - card->tx_data_ix = 0; - context = &card->tx_data_list[card->tx_data_ix++]; - } - - context->adapter = adapter; - context->ep = ep; - context->skb = skb; - tx_urb = context->urb; - - usb_fill_bulk_urb(tx_urb, card->udev, usb_sndbulkpipe(card->udev, ep), - data, skb->len, mwifiex_usb_tx_complete, - (void *)context); - - tx_urb->transfer_flags |= URB_ZERO_PACKET; - - if (ep == card->tx_cmd_ep) - atomic_inc(&card->tx_cmd_urb_pending); - else - atomic_inc(&card->tx_data_urb_pending); - - if (usb_submit_urb(tx_urb, GFP_ATOMIC)) { - dev_err(adapter->dev, "%s: usb_submit_urb failed\n", __func__); - if (ep == card->tx_cmd_ep) { - atomic_dec(&card->tx_cmd_urb_pending); - } else { - atomic_dec(&card->tx_data_urb_pending); - if (card->tx_data_ix) - card->tx_data_ix--; - else - card->tx_data_ix = MWIFIEX_TX_DATA_URB; - } - - return -1; - } else { - if (ep == card->tx_data_ep && - atomic_read(&card->tx_data_urb_pending) == - MWIFIEX_TX_DATA_URB) - return -ENOSR; - } - - return -EINPROGRESS; -} - -/* This function register usb device and initialize parameter. */ -static int mwifiex_register_dev(struct mwifiex_adapter *adapter) -{ - struct usb_card_rec *card = (struct usb_card_rec *)adapter->card; - - card->adapter = adapter; - adapter->dev = &card->udev->dev; - strcpy(adapter->fw_name, USB8797_DEFAULT_FW_NAME); - - return 0; -} - -static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, - struct mwifiex_fw_image *fw) -{ - int ret = 0; - u8 *firmware = fw->fw_buf, *recv_buff; - u32 retries = USB8797_FW_MAX_RETRY, dlen; - u32 fw_seqnum = 0, tlen = 0, dnld_cmd = 0; - struct fw_data *fwdata; - struct fw_sync_header sync_fw; - u8 check_winner = 1; - - if (!firmware) { - dev_err(adapter->dev, - "No firmware image found! Terminating download\n"); - ret = -1; - goto fw_exit; - } - - /* Allocate memory for transmit */ - fwdata = kzalloc(FW_DNLD_TX_BUF_SIZE, GFP_KERNEL); - if (!fwdata) - goto fw_exit; - - /* Allocate memory for receive */ - recv_buff = kzalloc(FW_DNLD_RX_BUF_SIZE, GFP_KERNEL); - if (!recv_buff) - goto cleanup; - - do { - /* Send pseudo data to check winner status first */ - if (check_winner) { - memset(&fwdata->fw_hdr, 0, sizeof(struct fw_header)); - dlen = 0; - } else { - /* copy the header of the fw_data to get the length */ - memcpy(&fwdata->fw_hdr, &firmware[tlen], - sizeof(struct fw_header)); - - dlen = le32_to_cpu(fwdata->fw_hdr.data_len); - dnld_cmd = le32_to_cpu(fwdata->fw_hdr.dnld_cmd); - tlen += sizeof(struct fw_header); - - memcpy(fwdata->data, &firmware[tlen], dlen); - - fwdata->seq_num = cpu_to_le32(fw_seqnum); - tlen += dlen; - } - - /* If the send/receive fails or CRC occurs then retry */ - while (retries--) { - u8 *buf = (u8 *)fwdata; - u32 len = FW_DATA_XMIT_SIZE; - - /* send the firmware block */ - ret = mwifiex_write_data_sync(adapter, buf, &len, - MWIFIEX_USB_EP_CMD_EVENT, - MWIFIEX_USB_TIMEOUT); - if (ret) { - dev_err(adapter->dev, - "write_data_sync: failed: %d\n", ret); - continue; - } - - buf = recv_buff; - len = FW_DNLD_RX_BUF_SIZE; - - /* Receive the firmware block response */ - ret = mwifiex_read_data_sync(adapter, buf, &len, - MWIFIEX_USB_EP_CMD_EVENT, - MWIFIEX_USB_TIMEOUT); - if (ret) { - dev_err(adapter->dev, - "read_data_sync: failed: %d\n", ret); - continue; - } - - memcpy(&sync_fw, recv_buff, - sizeof(struct fw_sync_header)); - - /* check 1st firmware block resp for highest bit set */ - if (check_winner) { - if (le32_to_cpu(sync_fw.cmd) & 0x80000000) { - dev_warn(adapter->dev, - "USB is not the winner %#x\n", - sync_fw.cmd); - - /* returning success */ - ret = 0; - goto cleanup; - } - - dev_dbg(adapter->dev, - "USB is the winner, start to download FW\n"); - - check_winner = 0; - break; - } - - /* check the firmware block response for CRC errors */ - if (sync_fw.cmd) { - dev_err(adapter->dev, - "FW received block with CRC %#x\n", - sync_fw.cmd); - ret = -1; - continue; - } - - retries = USB8797_FW_MAX_RETRY; - break; - } - fw_seqnum++; - } while ((dnld_cmd != FW_HAS_LAST_BLOCK) && retries); - -cleanup: - dev_dbg(adapter->dev, "%s: %d bytes downloaded\n", __func__, tlen); - - kfree(recv_buff); - kfree(fwdata); - - if (retries) - ret = 0; -fw_exit: - return ret; -} - -static int mwifiex_usb_dnld_fw(struct mwifiex_adapter *adapter, - struct mwifiex_fw_image *fw) -{ - int ret; - struct usb_card_rec *card = (struct usb_card_rec *)adapter->card; - - if (card->usb_boot_state == USB8797_FW_DNLD) { - ret = mwifiex_prog_fw_w_helper(adapter, fw); - if (ret) - return -1; - - /* Boot state changes after successful firmware download */ - if (card->usb_boot_state == USB8797_FW_DNLD) - return -1; - } - - ret = mwifiex_usb_rx_init(adapter); - if (!ret) - ret = mwifiex_usb_tx_init(adapter); - - return ret; -} - -static void mwifiex_submit_rx_urb(struct mwifiex_adapter *adapter, u8 ep) -{ - struct usb_card_rec *card = (struct usb_card_rec *)adapter->card; - - skb_push(card->rx_cmd.skb, INTF_HEADER_LEN); - if ((ep == card->rx_cmd_ep) && - (!atomic_read(&card->rx_cmd_urb_pending))) - mwifiex_usb_submit_rx_urb(&card->rx_cmd, - MWIFIEX_RX_CMD_BUF_SIZE); - - return; -} - -static int mwifiex_usb_cmd_event_complete(struct mwifiex_adapter *adapter, - struct sk_buff *skb) -{ - atomic_dec(&adapter->rx_pending); - mwifiex_submit_rx_urb(adapter, MWIFIEX_USB_EP_CMD_EVENT); - - return 0; -} - -static int mwifiex_usb_data_complete(struct mwifiex_adapter *adapter, - struct sk_buff *skb) -{ - atomic_dec(&adapter->rx_pending); - dev_kfree_skb_any(skb); - - return 0; -} - -/* This function wakes up the card. */ -static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter) -{ - /* Simulation of HS_AWAKE event */ - adapter->pm_wakeup_fw_try = false; - adapter->pm_wakeup_card_req = false; - adapter->ps_state = PS_STATE_AWAKE; - - return 0; -} - -static struct mwifiex_if_ops usb_ops = { - .register_dev = mwifiex_register_dev, - .wakeup = mwifiex_pm_wakeup_card, - .wakeup_complete = mwifiex_pm_wakeup_card_complete, - - /* USB specific */ - .dnld_fw = mwifiex_usb_dnld_fw, - .cmdrsp_complete = mwifiex_usb_cmd_event_complete, - .event_complete = mwifiex_usb_cmd_event_complete, - .data_complete = mwifiex_usb_data_complete, - .host_to_card = mwifiex_usb_host_to_card, -}; - -/* This function initializes the USB driver module. - * - * This initiates the semaphore and registers the device with - * USB bus. - */ -static int mwifiex_usb_init_module(void) -{ - int ret; - - pr_debug("Marvell USB8797 Driver\n"); - - sema_init(&add_remove_card_sem, 1); - - ret = usb_register(&mwifiex_usb_driver); - if (ret) - pr_err("Driver register failed!\n"); - else - pr_debug("info: Driver registered successfully!\n"); - - return ret; -} - -/* This function cleans up the USB driver. - * - * The following major steps are followed in .disconnect for cleanup: - * - Resume the device if its suspended - * - Disconnect the device if connected - * - Shutdown the firmware - * - Unregister the device from USB bus. - */ -static void mwifiex_usb_cleanup_module(void) -{ - if (!down_interruptible(&add_remove_card_sem)) - up(&add_remove_card_sem); - - /* set the flag as user is removing this module */ - user_rmmod = 1; - - usb_deregister(&mwifiex_usb_driver); -} - -module_init(mwifiex_usb_init_module); -module_exit(mwifiex_usb_cleanup_module); - -MODULE_AUTHOR("Marvell International Ltd."); -MODULE_DESCRIPTION("Marvell WiFi-Ex USB Driver version" USB_VERSION); -MODULE_VERSION(USB_VERSION); -MODULE_LICENSE("GPL v2"); -MODULE_FIRMWARE("mrvl/usb8797_uapsta.bin"); diff --git a/drivers/net/wireless/mwifiex/usb.h b/drivers/net/wireless/mwifiex/usb.h deleted file mode 100644 index 98c4316cd1a9..000000000000 --- a/drivers/net/wireless/mwifiex/usb.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * This file contains definitions for mwifiex USB interface driver. - * - * Copyright (C) 2012, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef _MWIFIEX_USB_H -#define _MWIFIEX_USB_H - -#include - -#define USB8797_VID 0x1286 -#define USB8797_PID_1 0x2043 -#define USB8797_PID_2 0x2044 - -#define USB8797_FW_DNLD 1 -#define USB8797_FW_READY 2 -#define USB8797_FW_MAX_RETRY 3 - -#define MWIFIEX_TX_DATA_URB 6 -#define MWIFIEX_RX_DATA_URB 6 -#define MWIFIEX_USB_TIMEOUT 100 - -#define USB8797_DEFAULT_FW_NAME "mrvl/usb8797_uapsta.bin" - -#define FW_DNLD_TX_BUF_SIZE 620 -#define FW_DNLD_RX_BUF_SIZE 2048 -#define FW_HAS_LAST_BLOCK 0x00000004 - -#define FW_DATA_XMIT_SIZE \ - (sizeof(struct fw_header) + dlen + sizeof(u32)) - -struct urb_context { - struct mwifiex_adapter *adapter; - struct sk_buff *skb; - struct urb *urb; - u8 ep; -}; - -struct usb_card_rec { - struct mwifiex_adapter *adapter; - struct usb_device *udev; - struct usb_interface *intf; - u8 rx_cmd_ep; - struct urb_context rx_cmd; - atomic_t rx_cmd_urb_pending; - struct urb_context rx_data_list[MWIFIEX_RX_DATA_URB]; - u8 usb_boot_state; - u8 rx_data_ep; - atomic_t rx_data_urb_pending; - u8 tx_data_ep; - u8 tx_cmd_ep; - atomic_t tx_data_urb_pending; - atomic_t tx_cmd_urb_pending; - int bulk_out_maxpktsize; - struct urb_context tx_cmd; - int tx_data_ix; - struct urb_context tx_data_list[MWIFIEX_TX_DATA_URB]; -}; - -struct fw_header { - __le32 dnld_cmd; - __le32 base_addr; - __le32 data_len; - __le32 crc; -}; - -struct fw_sync_header { - __le32 cmd; - __le32 seq_num; -}; - -struct fw_data { - struct fw_header fw_hdr; - __le32 seq_num; - u8 data[1]; -}; - -/* This function is called after the card has woken up. */ -static inline int -mwifiex_pm_wakeup_card_complete(struct mwifiex_adapter *adapter) -{ - return 0; -} - -#endif /*_MWIFIEX_USB_H */ diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c deleted file mode 100644 index e57ac0dd3ab5..000000000000 --- a/drivers/net/wireless/mwifiex/util.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Marvell Wireless LAN device driver: utility functions - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" -#include "11n.h" - -/* - * Firmware initialization complete callback handler. - * - * This function wakes up the function waiting on the init - * wait queue for the firmware initialization to complete. - */ -int mwifiex_init_fw_complete(struct mwifiex_adapter *adapter) -{ - - adapter->init_wait_q_woken = true; - wake_up_interruptible(&adapter->init_wait_q); - return 0; -} - -/* - * Firmware shutdown complete callback handler. - * - * This function sets the hardware status to not ready and wakes up - * the function waiting on the init wait queue for the firmware - * shutdown to complete. - */ -int mwifiex_shutdown_fw_complete(struct mwifiex_adapter *adapter) -{ - adapter->hw_status = MWIFIEX_HW_STATUS_NOT_READY; - adapter->init_wait_q_woken = true; - wake_up_interruptible(&adapter->init_wait_q); - return 0; -} - -/* - * This function sends init/shutdown command - * to firmware. - */ -int mwifiex_init_shutdown_fw(struct mwifiex_private *priv, - u32 func_init_shutdown) -{ - u16 cmd; - - if (func_init_shutdown == MWIFIEX_FUNC_INIT) { - cmd = HostCmd_CMD_FUNC_INIT; - } else if (func_init_shutdown == MWIFIEX_FUNC_SHUTDOWN) { - cmd = HostCmd_CMD_FUNC_SHUTDOWN; - } else { - dev_err(priv->adapter->dev, "unsupported parameter\n"); - return -1; - } - - return mwifiex_send_cmd_sync(priv, cmd, HostCmd_ACT_GEN_SET, 0, NULL); -} -EXPORT_SYMBOL_GPL(mwifiex_init_shutdown_fw); - -/* - * IOCTL request handler to set/get debug information. - * - * This function collates/sets the information from/to different driver - * structures. - */ -int mwifiex_get_debug_info(struct mwifiex_private *priv, - struct mwifiex_debug_info *info) -{ - struct mwifiex_adapter *adapter = priv->adapter; - - if (info) { - memcpy(info->packets_out, - priv->wmm.packets_out, - sizeof(priv->wmm.packets_out)); - info->curr_tx_buf_size = (u32) adapter->curr_tx_buf_size; - info->tx_buf_size = (u32) adapter->tx_buf_size; - info->rx_tbl_num = mwifiex_get_rx_reorder_tbl(priv, - info->rx_tbl); - info->tx_tbl_num = mwifiex_get_tx_ba_stream_tbl(priv, - info->tx_tbl); - info->ps_mode = adapter->ps_mode; - info->ps_state = adapter->ps_state; - info->is_deep_sleep = adapter->is_deep_sleep; - info->pm_wakeup_card_req = adapter->pm_wakeup_card_req; - info->pm_wakeup_fw_try = adapter->pm_wakeup_fw_try; - info->is_hs_configured = adapter->is_hs_configured; - info->hs_activated = adapter->hs_activated; - info->num_cmd_host_to_card_failure - = adapter->dbg.num_cmd_host_to_card_failure; - info->num_cmd_sleep_cfm_host_to_card_failure - = adapter->dbg.num_cmd_sleep_cfm_host_to_card_failure; - info->num_tx_host_to_card_failure - = adapter->dbg.num_tx_host_to_card_failure; - info->num_event_deauth = adapter->dbg.num_event_deauth; - info->num_event_disassoc = adapter->dbg.num_event_disassoc; - info->num_event_link_lost = adapter->dbg.num_event_link_lost; - info->num_cmd_deauth = adapter->dbg.num_cmd_deauth; - info->num_cmd_assoc_success = - adapter->dbg.num_cmd_assoc_success; - info->num_cmd_assoc_failure = - adapter->dbg.num_cmd_assoc_failure; - info->num_tx_timeout = adapter->dbg.num_tx_timeout; - info->num_cmd_timeout = adapter->dbg.num_cmd_timeout; - info->timeout_cmd_id = adapter->dbg.timeout_cmd_id; - info->timeout_cmd_act = adapter->dbg.timeout_cmd_act; - memcpy(info->last_cmd_id, adapter->dbg.last_cmd_id, - sizeof(adapter->dbg.last_cmd_id)); - memcpy(info->last_cmd_act, adapter->dbg.last_cmd_act, - sizeof(adapter->dbg.last_cmd_act)); - info->last_cmd_index = adapter->dbg.last_cmd_index; - memcpy(info->last_cmd_resp_id, adapter->dbg.last_cmd_resp_id, - sizeof(adapter->dbg.last_cmd_resp_id)); - info->last_cmd_resp_index = adapter->dbg.last_cmd_resp_index; - memcpy(info->last_event, adapter->dbg.last_event, - sizeof(adapter->dbg.last_event)); - info->last_event_index = adapter->dbg.last_event_index; - info->data_sent = adapter->data_sent; - info->cmd_sent = adapter->cmd_sent; - info->cmd_resp_received = adapter->cmd_resp_received; - } - - return 0; -} - -/* - * This function processes the received management packet and send it - * to the kernel. - */ -int -mwifiex_process_mgmt_packet(struct mwifiex_private *priv, - struct sk_buff *skb) -{ - struct rxpd *rx_pd; - u16 pkt_len; - - if (!skb) - return -1; - - rx_pd = (struct rxpd *)skb->data; - - skb_pull(skb, le16_to_cpu(rx_pd->rx_pkt_offset)); - skb_pull(skb, sizeof(pkt_len)); - - pkt_len = le16_to_cpu(rx_pd->rx_pkt_length); - - /* Remove address4 */ - memmove(skb->data + sizeof(struct ieee80211_hdr_3addr), - skb->data + sizeof(struct ieee80211_hdr), - pkt_len - sizeof(struct ieee80211_hdr)); - - pkt_len -= ETH_ALEN + sizeof(pkt_len); - rx_pd->rx_pkt_length = cpu_to_le16(pkt_len); - - cfg80211_rx_mgmt(priv->wdev, priv->roc_cfg.chan.center_freq, - CAL_RSSI(rx_pd->snr, rx_pd->nf), - skb->data, pkt_len, GFP_ATOMIC); - - return 0; -} - -/* - * This function processes the received packet before sending it to the - * kernel. - * - * It extracts the SKB from the received buffer and sends it to kernel. - * In case the received buffer does not contain the data in SKB format, - * the function creates a blank SKB, fills it with the data from the - * received buffer and then sends this new SKB to the kernel. - */ -int mwifiex_recv_packet(struct mwifiex_private *priv, struct sk_buff *skb) -{ - if (!skb) - return -1; - - skb->dev = priv->netdev; - skb->protocol = eth_type_trans(skb, priv->netdev); - skb->ip_summed = CHECKSUM_NONE; - - /* This is required only in case of 11n and USB/PCIE as we alloc - * a buffer of 4K only if its 11N (to be able to receive 4K - * AMSDU packets). In case of SD we allocate buffers based - * on the size of packet and hence this is not needed. - * - * Modifying the truesize here as our allocation for each - * skb is 4K but we only receive 2K packets and this cause - * the kernel to start dropping packets in case where - * application has allocated buffer based on 2K size i.e. - * if there a 64K packet received (in IP fragments and - * application allocates 64K to receive this packet but - * this packet would almost double up because we allocate - * each 1.5K fragment in 4K and pass it up. As soon as the - * 64K limit hits kernel will start to drop rest of the - * fragments. Currently we fail the Filesndl-ht.scr script - * for UDP, hence this fix - */ - if ((priv->adapter->iface_type == MWIFIEX_USB || - priv->adapter->iface_type == MWIFIEX_PCIE) && - (skb->truesize > MWIFIEX_RX_DATA_BUF_SIZE)) - skb->truesize += (skb->len - MWIFIEX_RX_DATA_BUF_SIZE); - - priv->stats.rx_bytes += skb->len; - priv->stats.rx_packets++; - if (in_interrupt()) - netif_rx(skb); - else - netif_rx_ni(skb); - - return 0; -} - -/* - * IOCTL completion callback handler. - * - * This function is called when a pending IOCTL is completed. - * - * If work queue support is enabled, the function wakes up the - * corresponding waiting function. Otherwise, it processes the - * IOCTL response and frees the response buffer. - */ -int mwifiex_complete_cmd(struct mwifiex_adapter *adapter, - struct cmd_ctrl_node *cmd_node) -{ - dev_dbg(adapter->dev, "cmd completed: status=%d\n", - adapter->cmd_wait_q.status); - - *(cmd_node->condition) = true; - - if (adapter->cmd_wait_q.status == -ETIMEDOUT) - dev_err(adapter->dev, "cmd timeout\n"); - else - wake_up_interruptible(&adapter->cmd_wait_q.wait); - - return 0; -} diff --git a/drivers/net/wireless/mwifiex/util.h b/drivers/net/wireless/mwifiex/util.h deleted file mode 100644 index cb2d0582bd36..000000000000 --- a/drivers/net/wireless/mwifiex/util.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Marvell Wireless LAN device driver: utility functions - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef _MWIFIEX_UTIL_H_ -#define _MWIFIEX_UTIL_H_ - -static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb) -{ - return (struct mwifiex_rxinfo *)(skb->cb + sizeof(dma_addr_t)); -} - -static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb) -{ - return (struct mwifiex_txinfo *)(skb->cb + sizeof(dma_addr_t)); -} - -static inline void MWIFIEX_SKB_PACB(struct sk_buff *skb, dma_addr_t *buf_pa) -{ - memcpy(buf_pa, skb->cb, sizeof(dma_addr_t)); -} -#endif /* !_MWIFIEX_UTIL_H_ */ diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c deleted file mode 100644 index ae31e8df44d7..000000000000 --- a/drivers/net/wireless/mwifiex/wmm.c +++ /dev/null @@ -1,1265 +0,0 @@ -/* - * Marvell Wireless LAN device driver: WMM - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#include "decl.h" -#include "ioctl.h" -#include "util.h" -#include "fw.h" -#include "main.h" -#include "wmm.h" -#include "11n.h" - - -/* Maximum value FW can accept for driver delay in packet transmission */ -#define DRV_PKT_DELAY_TO_FW_MAX 512 - - -#define WMM_QUEUED_PACKET_LOWER_LIMIT 180 - -#define WMM_QUEUED_PACKET_UPPER_LIMIT 200 - -/* Offset for TOS field in the IP header */ -#define IPTOS_OFFSET 5 - -/* WMM information IE */ -static const u8 wmm_info_ie[] = { WLAN_EID_VENDOR_SPECIFIC, 0x07, - 0x00, 0x50, 0xf2, 0x02, - 0x00, 0x01, 0x00 -}; - -static const u8 wmm_aci_to_qidx_map[] = { WMM_AC_BE, - WMM_AC_BK, - WMM_AC_VI, - WMM_AC_VO -}; - -static u8 tos_to_tid[] = { - /* TID DSCP_P2 DSCP_P1 DSCP_P0 WMM_AC */ - 0x01, /* 0 1 0 AC_BK */ - 0x02, /* 0 0 0 AC_BK */ - 0x00, /* 0 0 1 AC_BE */ - 0x03, /* 0 1 1 AC_BE */ - 0x04, /* 1 0 0 AC_VI */ - 0x05, /* 1 0 1 AC_VI */ - 0x06, /* 1 1 0 AC_VO */ - 0x07 /* 1 1 1 AC_VO */ -}; - -/* - * This table inverses the tos_to_tid operation to get a priority - * which is in sequential order, and can be compared. - * Use this to compare the priority of two different TIDs. - */ -static u8 tos_to_tid_inv[] = { - 0x02, /* from tos_to_tid[2] = 0 */ - 0x00, /* from tos_to_tid[0] = 1 */ - 0x01, /* from tos_to_tid[1] = 2 */ - 0x03, - 0x04, - 0x05, - 0x06, - 0x07}; - -static u8 ac_to_tid[4][2] = { {1, 2}, {0, 3}, {4, 5}, {6, 7} }; - -/* - * This function debug prints the priority parameters for a WMM AC. - */ -static void -mwifiex_wmm_ac_debug_print(const struct ieee_types_wmm_ac_parameters *ac_param) -{ - const char *ac_str[] = { "BK", "BE", "VI", "VO" }; - - pr_debug("info: WMM AC_%s: ACI=%d, ACM=%d, Aifsn=%d, " - "EcwMin=%d, EcwMax=%d, TxopLimit=%d\n", - ac_str[wmm_aci_to_qidx_map[(ac_param->aci_aifsn_bitmap - & MWIFIEX_ACI) >> 5]], - (ac_param->aci_aifsn_bitmap & MWIFIEX_ACI) >> 5, - (ac_param->aci_aifsn_bitmap & MWIFIEX_ACM) >> 4, - ac_param->aci_aifsn_bitmap & MWIFIEX_AIFSN, - ac_param->ecw_bitmap & MWIFIEX_ECW_MIN, - (ac_param->ecw_bitmap & MWIFIEX_ECW_MAX) >> 4, - le16_to_cpu(ac_param->tx_op_limit)); -} - -/* - * This function allocates a route address list. - * - * The function also initializes the list with the provided RA. - */ -static struct mwifiex_ra_list_tbl * -mwifiex_wmm_allocate_ralist_node(struct mwifiex_adapter *adapter, u8 *ra) -{ - struct mwifiex_ra_list_tbl *ra_list; - - ra_list = kzalloc(sizeof(struct mwifiex_ra_list_tbl), GFP_ATOMIC); - if (!ra_list) - return NULL; - - INIT_LIST_HEAD(&ra_list->list); - skb_queue_head_init(&ra_list->skb_head); - - memcpy(ra_list->ra, ra, ETH_ALEN); - - ra_list->total_pkts_size = 0; - - dev_dbg(adapter->dev, "info: allocated ra_list %p\n", ra_list); - - return ra_list; -} - -/* This function returns random no between 16 and 32 to be used as threshold - * for no of packets after which BA setup is initiated. - */ -static u8 mwifiex_get_random_ba_threshold(void) -{ - u32 sec, usec; - struct timeval ba_tstamp; - u8 ba_threshold; - - /* setup ba_packet_threshold here random number between - * [BA_SETUP_PACKET_OFFSET, - * BA_SETUP_PACKET_OFFSET+BA_SETUP_MAX_PACKET_THRESHOLD-1] - */ - - do_gettimeofday(&ba_tstamp); - sec = (ba_tstamp.tv_sec & 0xFFFF) + (ba_tstamp.tv_sec >> 16); - usec = (ba_tstamp.tv_usec & 0xFFFF) + (ba_tstamp.tv_usec >> 16); - ba_threshold = (((sec << 16) + usec) % BA_SETUP_MAX_PACKET_THRESHOLD) - + BA_SETUP_PACKET_OFFSET; - - return ba_threshold; -} - -/* - * This function allocates and adds a RA list for all TIDs - * with the given RA. - */ -void -mwifiex_ralist_add(struct mwifiex_private *priv, u8 *ra) -{ - int i; - struct mwifiex_ra_list_tbl *ra_list; - struct mwifiex_adapter *adapter = priv->adapter; - struct mwifiex_sta_node *node; - unsigned long flags; - - spin_lock_irqsave(&priv->sta_list_spinlock, flags); - node = mwifiex_get_sta_entry(priv, ra); - spin_unlock_irqrestore(&priv->sta_list_spinlock, flags); - - for (i = 0; i < MAX_NUM_TID; ++i) { - ra_list = mwifiex_wmm_allocate_ralist_node(adapter, ra); - dev_dbg(adapter->dev, "info: created ra_list %p\n", ra_list); - - if (!ra_list) - break; - - ra_list->is_11n_enabled = 0; - if (!mwifiex_queuing_ra_based(priv)) { - ra_list->is_11n_enabled = IS_11N_ENABLED(priv); - } else { - ra_list->is_11n_enabled = - mwifiex_is_sta_11n_enabled(priv, node); - if (ra_list->is_11n_enabled) - ra_list->max_amsdu = node->max_amsdu; - } - - dev_dbg(adapter->dev, "data: ralist %p: is_11n_enabled=%d\n", - ra_list, ra_list->is_11n_enabled); - - if (ra_list->is_11n_enabled) { - ra_list->pkt_count = 0; - ra_list->ba_packet_thr = - mwifiex_get_random_ba_threshold(); - } - list_add_tail(&ra_list->list, - &priv->wmm.tid_tbl_ptr[i].ra_list); - } -} - -/* - * This function sets the WMM queue priorities to their default values. - */ -static void mwifiex_wmm_default_queue_priorities(struct mwifiex_private *priv) -{ - /* Default queue priorities: VO->VI->BE->BK */ - priv->wmm.queue_priority[0] = WMM_AC_VO; - priv->wmm.queue_priority[1] = WMM_AC_VI; - priv->wmm.queue_priority[2] = WMM_AC_BE; - priv->wmm.queue_priority[3] = WMM_AC_BK; -} - -/* - * This function map ACs to TIDs. - */ -static void -mwifiex_wmm_queue_priorities_tid(struct mwifiex_wmm_desc *wmm) -{ - u8 *queue_priority = wmm->queue_priority; - int i; - - for (i = 0; i < 4; ++i) { - tos_to_tid[7 - (i * 2)] = ac_to_tid[queue_priority[i]][1]; - tos_to_tid[6 - (i * 2)] = ac_to_tid[queue_priority[i]][0]; - } - - for (i = 0; i < MAX_NUM_TID; ++i) - tos_to_tid_inv[tos_to_tid[i]] = (u8)i; - - atomic_set(&wmm->highest_queued_prio, HIGH_PRIO_TID); -} - -/* - * This function initializes WMM priority queues. - */ -void -mwifiex_wmm_setup_queue_priorities(struct mwifiex_private *priv, - struct ieee_types_wmm_parameter *wmm_ie) -{ - u16 cw_min, avg_back_off, tmp[4]; - u32 i, j, num_ac; - u8 ac_idx; - - if (!wmm_ie || !priv->wmm_enabled) { - /* WMM is not enabled, just set the defaults and return */ - mwifiex_wmm_default_queue_priorities(priv); - return; - } - - dev_dbg(priv->adapter->dev, "info: WMM Parameter IE: version=%d, " - "qos_info Parameter Set Count=%d, Reserved=%#x\n", - wmm_ie->vend_hdr.version, wmm_ie->qos_info_bitmap & - IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK, - wmm_ie->reserved); - - for (num_ac = 0; num_ac < ARRAY_SIZE(wmm_ie->ac_params); num_ac++) { - u8 ecw = wmm_ie->ac_params[num_ac].ecw_bitmap; - u8 aci_aifsn = wmm_ie->ac_params[num_ac].aci_aifsn_bitmap; - cw_min = (1 << (ecw & MWIFIEX_ECW_MIN)) - 1; - avg_back_off = (cw_min >> 1) + (aci_aifsn & MWIFIEX_AIFSN); - - ac_idx = wmm_aci_to_qidx_map[(aci_aifsn & MWIFIEX_ACI) >> 5]; - priv->wmm.queue_priority[ac_idx] = ac_idx; - tmp[ac_idx] = avg_back_off; - - dev_dbg(priv->adapter->dev, - "info: WMM: CWmax=%d CWmin=%d Avg Back-off=%d\n", - (1 << ((ecw & MWIFIEX_ECW_MAX) >> 4)) - 1, - cw_min, avg_back_off); - mwifiex_wmm_ac_debug_print(&wmm_ie->ac_params[num_ac]); - } - - /* Bubble sort */ - for (i = 0; i < num_ac; i++) { - for (j = 1; j < num_ac - i; j++) { - if (tmp[j - 1] > tmp[j]) { - swap(tmp[j - 1], tmp[j]); - swap(priv->wmm.queue_priority[j - 1], - priv->wmm.queue_priority[j]); - } else if (tmp[j - 1] == tmp[j]) { - if (priv->wmm.queue_priority[j - 1] - < priv->wmm.queue_priority[j]) - swap(priv->wmm.queue_priority[j - 1], - priv->wmm.queue_priority[j]); - } - } - } - - mwifiex_wmm_queue_priorities_tid(&priv->wmm); -} - -/* - * This function evaluates whether or not an AC is to be downgraded. - * - * In case the AC is not enabled, the highest AC is returned that is - * enabled and does not require admission control. - */ -static enum mwifiex_wmm_ac_e -mwifiex_wmm_eval_downgrade_ac(struct mwifiex_private *priv, - enum mwifiex_wmm_ac_e eval_ac) -{ - int down_ac; - enum mwifiex_wmm_ac_e ret_ac; - struct mwifiex_wmm_ac_status *ac_status; - - ac_status = &priv->wmm.ac_status[eval_ac]; - - if (!ac_status->disabled) - /* Okay to use this AC, its enabled */ - return eval_ac; - - /* Setup a default return value of the lowest priority */ - ret_ac = WMM_AC_BK; - - /* - * Find the highest AC that is enabled and does not require - * admission control. The spec disallows downgrading to an AC, - * which is enabled due to a completed admission control. - * Unadmitted traffic is not to be sent on an AC with admitted - * traffic. - */ - for (down_ac = WMM_AC_BK; down_ac < eval_ac; down_ac++) { - ac_status = &priv->wmm.ac_status[down_ac]; - - if (!ac_status->disabled && !ac_status->flow_required) - /* AC is enabled and does not require admission - control */ - ret_ac = (enum mwifiex_wmm_ac_e) down_ac; - } - - return ret_ac; -} - -/* - * This function downgrades WMM priority queue. - */ -void -mwifiex_wmm_setup_ac_downgrade(struct mwifiex_private *priv) -{ - int ac_val; - - dev_dbg(priv->adapter->dev, "info: WMM: AC Priorities:" - "BK(0), BE(1), VI(2), VO(3)\n"); - - if (!priv->wmm_enabled) { - /* WMM is not enabled, default priorities */ - for (ac_val = WMM_AC_BK; ac_val <= WMM_AC_VO; ac_val++) - priv->wmm.ac_down_graded_vals[ac_val] = - (enum mwifiex_wmm_ac_e) ac_val; - } else { - for (ac_val = WMM_AC_BK; ac_val <= WMM_AC_VO; ac_val++) { - priv->wmm.ac_down_graded_vals[ac_val] - = mwifiex_wmm_eval_downgrade_ac(priv, - (enum mwifiex_wmm_ac_e) ac_val); - dev_dbg(priv->adapter->dev, - "info: WMM: AC PRIO %d maps to %d\n", - ac_val, priv->wmm.ac_down_graded_vals[ac_val]); - } - } -} - -/* - * This function converts the IP TOS field to an WMM AC - * Queue assignment. - */ -static enum mwifiex_wmm_ac_e -mwifiex_wmm_convert_tos_to_ac(struct mwifiex_adapter *adapter, u32 tos) -{ - /* Map of TOS UP values to WMM AC */ - const enum mwifiex_wmm_ac_e tos_to_ac[] = { WMM_AC_BE, - WMM_AC_BK, - WMM_AC_BK, - WMM_AC_BE, - WMM_AC_VI, - WMM_AC_VI, - WMM_AC_VO, - WMM_AC_VO - }; - - if (tos >= ARRAY_SIZE(tos_to_ac)) - return WMM_AC_BE; - - return tos_to_ac[tos]; -} - -/* - * This function evaluates a given TID and downgrades it to a lower - * TID if the WMM Parameter IE received from the AP indicates that the - * AP is disabled (due to call admission control (ACM bit). Mapping - * of TID to AC is taken care of internally. - */ -static u8 -mwifiex_wmm_downgrade_tid(struct mwifiex_private *priv, u32 tid) -{ - enum mwifiex_wmm_ac_e ac, ac_down; - u8 new_tid; - - ac = mwifiex_wmm_convert_tos_to_ac(priv->adapter, tid); - ac_down = priv->wmm.ac_down_graded_vals[ac]; - - /* Send the index to tid array, picking from the array will be - * taken care by dequeuing function - */ - new_tid = ac_to_tid[ac_down][tid % 2]; - - return new_tid; -} - -/* - * This function initializes the WMM state information and the - * WMM data path queues. - */ -void -mwifiex_wmm_init(struct mwifiex_adapter *adapter) -{ - int i, j; - struct mwifiex_private *priv; - - for (j = 0; j < adapter->priv_num; ++j) { - priv = adapter->priv[j]; - if (!priv) - continue; - - for (i = 0; i < MAX_NUM_TID; ++i) { - priv->aggr_prio_tbl[i].amsdu = tos_to_tid_inv[i]; - priv->aggr_prio_tbl[i].ampdu_ap = tos_to_tid_inv[i]; - priv->aggr_prio_tbl[i].ampdu_user = tos_to_tid_inv[i]; - } - - priv->aggr_prio_tbl[6].amsdu - = priv->aggr_prio_tbl[6].ampdu_ap - = priv->aggr_prio_tbl[6].ampdu_user - = BA_STREAM_NOT_ALLOWED; - - priv->aggr_prio_tbl[7].amsdu = priv->aggr_prio_tbl[7].ampdu_ap - = priv->aggr_prio_tbl[7].ampdu_user - = BA_STREAM_NOT_ALLOWED; - - mwifiex_set_ba_params(priv); - mwifiex_reset_11n_rx_seq_num(priv); - - atomic_set(&priv->wmm.tx_pkts_queued, 0); - atomic_set(&priv->wmm.highest_queued_prio, HIGH_PRIO_TID); - } -} - -/* - * This function checks if WMM Tx queue is empty. - */ -int -mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter) -{ - int i; - struct mwifiex_private *priv; - - for (i = 0; i < adapter->priv_num; ++i) { - priv = adapter->priv[i]; - if (priv && atomic_read(&priv->wmm.tx_pkts_queued)) - return false; - } - - return true; -} - -/* - * This function deletes all packets in an RA list node. - * - * The packet sent completion callback handler are called with - * status failure, after they are dequeued to ensure proper - * cleanup. The RA list node itself is freed at the end. - */ -static void -mwifiex_wmm_del_pkts_in_ralist_node(struct mwifiex_private *priv, - struct mwifiex_ra_list_tbl *ra_list) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct sk_buff *skb, *tmp; - - skb_queue_walk_safe(&ra_list->skb_head, skb, tmp) - mwifiex_write_data_complete(adapter, skb, 0, -1); -} - -/* - * This function deletes all packets in an RA list. - * - * Each nodes in the RA list are freed individually first, and then - * the RA list itself is freed. - */ -static void -mwifiex_wmm_del_pkts_in_ralist(struct mwifiex_private *priv, - struct list_head *ra_list_head) -{ - struct mwifiex_ra_list_tbl *ra_list; - - list_for_each_entry(ra_list, ra_list_head, list) - mwifiex_wmm_del_pkts_in_ralist_node(priv, ra_list); -} - -/* - * This function deletes all packets in all RA lists. - */ -static void mwifiex_wmm_cleanup_queues(struct mwifiex_private *priv) -{ - int i; - - for (i = 0; i < MAX_NUM_TID; i++) - mwifiex_wmm_del_pkts_in_ralist(priv, &priv->wmm.tid_tbl_ptr[i]. - ra_list); - - atomic_set(&priv->wmm.tx_pkts_queued, 0); - atomic_set(&priv->wmm.highest_queued_prio, HIGH_PRIO_TID); -} - -/* - * This function deletes all route addresses from all RA lists. - */ -static void mwifiex_wmm_delete_all_ralist(struct mwifiex_private *priv) -{ - struct mwifiex_ra_list_tbl *ra_list, *tmp_node; - int i; - - for (i = 0; i < MAX_NUM_TID; ++i) { - dev_dbg(priv->adapter->dev, - "info: ra_list: freeing buf for tid %d\n", i); - list_for_each_entry_safe(ra_list, tmp_node, - &priv->wmm.tid_tbl_ptr[i].ra_list, - list) { - list_del(&ra_list->list); - kfree(ra_list); - } - - INIT_LIST_HEAD(&priv->wmm.tid_tbl_ptr[i].ra_list); - } -} - -/* - * This function cleans up the Tx and Rx queues. - * - * Cleanup includes - - * - All packets in RA lists - * - All entries in Rx reorder table - * - All entries in Tx BA stream table - * - MPA buffer (if required) - * - All RA lists - */ -void -mwifiex_clean_txrx(struct mwifiex_private *priv) -{ - unsigned long flags; - - mwifiex_11n_cleanup_reorder_tbl(priv); - spin_lock_irqsave(&priv->wmm.ra_list_spinlock, flags); - - mwifiex_wmm_cleanup_queues(priv); - mwifiex_11n_delete_all_tx_ba_stream_tbl(priv); - - if (priv->adapter->if_ops.cleanup_mpa_buf) - priv->adapter->if_ops.cleanup_mpa_buf(priv->adapter); - - mwifiex_wmm_delete_all_ralist(priv); - memcpy(tos_to_tid, ac_to_tid, sizeof(tos_to_tid)); - - if (priv->adapter->if_ops.clean_pcie_ring) - priv->adapter->if_ops.clean_pcie_ring(priv->adapter); - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags); -} - -/* - * This function retrieves a particular RA list node, matching with the - * given TID and RA address. - */ -static struct mwifiex_ra_list_tbl * -mwifiex_wmm_get_ralist_node(struct mwifiex_private *priv, u8 tid, - u8 *ra_addr) -{ - struct mwifiex_ra_list_tbl *ra_list; - - list_for_each_entry(ra_list, &priv->wmm.tid_tbl_ptr[tid].ra_list, - list) { - if (!memcmp(ra_list->ra, ra_addr, ETH_ALEN)) - return ra_list; - } - - return NULL; -} - -/* - * This function retrieves an RA list node for a given TID and - * RA address pair. - * - * If no such node is found, a new node is added first and then - * retrieved. - */ -static struct mwifiex_ra_list_tbl * -mwifiex_wmm_get_queue_raptr(struct mwifiex_private *priv, u8 tid, u8 *ra_addr) -{ - struct mwifiex_ra_list_tbl *ra_list; - - ra_list = mwifiex_wmm_get_ralist_node(priv, tid, ra_addr); - if (ra_list) - return ra_list; - mwifiex_ralist_add(priv, ra_addr); - - return mwifiex_wmm_get_ralist_node(priv, tid, ra_addr); -} - -/* - * This function checks if a particular RA list node exists in a given TID - * table index. - */ -int -mwifiex_is_ralist_valid(struct mwifiex_private *priv, - struct mwifiex_ra_list_tbl *ra_list, int ptr_index) -{ - struct mwifiex_ra_list_tbl *rlist; - - list_for_each_entry(rlist, &priv->wmm.tid_tbl_ptr[ptr_index].ra_list, - list) { - if (rlist == ra_list) - return true; - } - - return false; -} - -/* - * This function adds a packet to WMM queue. - * - * In disconnected state the packet is immediately dropped and the - * packet send completion callback is called with status failure. - * - * Otherwise, the correct RA list node is located and the packet - * is queued at the list tail. - */ -void -mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv, - struct sk_buff *skb) -{ - struct mwifiex_adapter *adapter = priv->adapter; - u32 tid; - struct mwifiex_ra_list_tbl *ra_list; - u8 ra[ETH_ALEN], tid_down; - unsigned long flags; - - if (!priv->media_connected && !mwifiex_is_skb_mgmt_frame(skb)) { - dev_dbg(adapter->dev, "data: drop packet in disconnect\n"); - mwifiex_write_data_complete(adapter, skb, 0, -1); - return; - } - - tid = skb->priority; - - spin_lock_irqsave(&priv->wmm.ra_list_spinlock, flags); - - tid_down = mwifiex_wmm_downgrade_tid(priv, tid); - - /* In case of infra as we have already created the list during - association we just don't have to call get_queue_raptr, we will - have only 1 raptr for a tid in case of infra */ - if (!mwifiex_queuing_ra_based(priv) && - !mwifiex_is_skb_mgmt_frame(skb)) { - if (!list_empty(&priv->wmm.tid_tbl_ptr[tid_down].ra_list)) - ra_list = list_first_entry( - &priv->wmm.tid_tbl_ptr[tid_down].ra_list, - struct mwifiex_ra_list_tbl, list); - else - ra_list = NULL; - } else { - memcpy(ra, skb->data, ETH_ALEN); - if (ra[0] & 0x01 || mwifiex_is_skb_mgmt_frame(skb)) - memset(ra, 0xff, ETH_ALEN); - ra_list = mwifiex_wmm_get_queue_raptr(priv, tid_down, ra); - } - - if (!ra_list) { - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags); - mwifiex_write_data_complete(adapter, skb, 0, -1); - return; - } - - skb_queue_tail(&ra_list->skb_head, skb); - - ra_list->total_pkts_size += skb->len; - ra_list->pkt_count++; - - if (atomic_read(&priv->wmm.highest_queued_prio) < - tos_to_tid_inv[tid_down]) - atomic_set(&priv->wmm.highest_queued_prio, - tos_to_tid_inv[tid_down]); - - atomic_inc(&priv->wmm.tx_pkts_queued); - - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags); -} - -/* - * This function processes the get WMM status command response from firmware. - * - * The response may contain multiple TLVs - - * - AC Queue status TLVs - * - Current WMM Parameter IE TLV - * - Admission Control action frame TLVs - * - * This function parses the TLVs and then calls further specific functions - * to process any changes in the queue prioritize or state. - */ -int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv, - const struct host_cmd_ds_command *resp) -{ - u8 *curr = (u8 *) &resp->params.get_wmm_status; - uint16_t resp_len = le16_to_cpu(resp->size), tlv_len; - int valid = true; - - struct mwifiex_ie_types_data *tlv_hdr; - struct mwifiex_ie_types_wmm_queue_status *tlv_wmm_qstatus; - struct ieee_types_wmm_parameter *wmm_param_ie = NULL; - struct mwifiex_wmm_ac_status *ac_status; - - dev_dbg(priv->adapter->dev, "info: WMM: WMM_GET_STATUS cmdresp received: %d\n", - resp_len); - - while ((resp_len >= sizeof(tlv_hdr->header)) && valid) { - tlv_hdr = (struct mwifiex_ie_types_data *) curr; - tlv_len = le16_to_cpu(tlv_hdr->header.len); - - switch (le16_to_cpu(tlv_hdr->header.type)) { - case TLV_TYPE_WMMQSTATUS: - tlv_wmm_qstatus = - (struct mwifiex_ie_types_wmm_queue_status *) - tlv_hdr; - dev_dbg(priv->adapter->dev, - "info: CMD_RESP: WMM_GET_STATUS:" - " QSTATUS TLV: %d, %d, %d\n", - tlv_wmm_qstatus->queue_index, - tlv_wmm_qstatus->flow_required, - tlv_wmm_qstatus->disabled); - - ac_status = &priv->wmm.ac_status[tlv_wmm_qstatus-> - queue_index]; - ac_status->disabled = tlv_wmm_qstatus->disabled; - ac_status->flow_required = - tlv_wmm_qstatus->flow_required; - ac_status->flow_created = tlv_wmm_qstatus->flow_created; - break; - - case WLAN_EID_VENDOR_SPECIFIC: - /* - * Point the regular IEEE IE 2 bytes into the Marvell IE - * and setup the IEEE IE type and length byte fields - */ - - wmm_param_ie = - (struct ieee_types_wmm_parameter *) (curr + - 2); - wmm_param_ie->vend_hdr.len = (u8) tlv_len; - wmm_param_ie->vend_hdr.element_id = - WLAN_EID_VENDOR_SPECIFIC; - - dev_dbg(priv->adapter->dev, - "info: CMD_RESP: WMM_GET_STATUS:" - " WMM Parameter Set Count: %d\n", - wmm_param_ie->qos_info_bitmap & - IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK); - - memcpy((u8 *) &priv->curr_bss_params.bss_descriptor. - wmm_ie, wmm_param_ie, - wmm_param_ie->vend_hdr.len + 2); - - break; - - default: - valid = false; - break; - } - - curr += (tlv_len + sizeof(tlv_hdr->header)); - resp_len -= (tlv_len + sizeof(tlv_hdr->header)); - } - - mwifiex_wmm_setup_queue_priorities(priv, wmm_param_ie); - mwifiex_wmm_setup_ac_downgrade(priv); - - return 0; -} - -/* - * Callback handler from the command module to allow insertion of a WMM TLV. - * - * If the BSS we are associating to supports WMM, this function adds the - * required WMM Information IE to the association request command buffer in - * the form of a Marvell extended IEEE IE. - */ -u32 -mwifiex_wmm_process_association_req(struct mwifiex_private *priv, - u8 **assoc_buf, - struct ieee_types_wmm_parameter *wmm_ie, - struct ieee80211_ht_cap *ht_cap) -{ - struct mwifiex_ie_types_wmm_param_set *wmm_tlv; - u32 ret_len = 0; - - /* Null checks */ - if (!assoc_buf) - return 0; - if (!(*assoc_buf)) - return 0; - - if (!wmm_ie) - return 0; - - dev_dbg(priv->adapter->dev, - "info: WMM: process assoc req: bss->wmm_ie=%#x\n", - wmm_ie->vend_hdr.element_id); - - if ((priv->wmm_required || - (ht_cap && (priv->adapter->config_bands & BAND_GN || - priv->adapter->config_bands & BAND_AN))) && - wmm_ie->vend_hdr.element_id == WLAN_EID_VENDOR_SPECIFIC) { - wmm_tlv = (struct mwifiex_ie_types_wmm_param_set *) *assoc_buf; - wmm_tlv->header.type = cpu_to_le16((u16) wmm_info_ie[0]); - wmm_tlv->header.len = cpu_to_le16((u16) wmm_info_ie[1]); - memcpy(wmm_tlv->wmm_ie, &wmm_info_ie[2], - le16_to_cpu(wmm_tlv->header.len)); - if (wmm_ie->qos_info_bitmap & IEEE80211_WMM_IE_AP_QOSINFO_UAPSD) - memcpy((u8 *) (wmm_tlv->wmm_ie - + le16_to_cpu(wmm_tlv->header.len) - - sizeof(priv->wmm_qosinfo)), - &priv->wmm_qosinfo, sizeof(priv->wmm_qosinfo)); - - ret_len = sizeof(wmm_tlv->header) - + le16_to_cpu(wmm_tlv->header.len); - - *assoc_buf += ret_len; - } - - return ret_len; -} - -/* - * This function computes the time delay in the driver queues for a - * given packet. - * - * When the packet is received at the OS/Driver interface, the current - * time is set in the packet structure. The difference between the present - * time and that received time is computed in this function and limited - * based on pre-compiled limits in the driver. - */ -u8 -mwifiex_wmm_compute_drv_pkt_delay(struct mwifiex_private *priv, - const struct sk_buff *skb) -{ - u8 ret_val; - struct timeval out_tstamp, in_tstamp; - u32 queue_delay; - - do_gettimeofday(&out_tstamp); - in_tstamp = ktime_to_timeval(skb->tstamp); - - queue_delay = (out_tstamp.tv_sec - in_tstamp.tv_sec) * 1000; - queue_delay += (out_tstamp.tv_usec - in_tstamp.tv_usec) / 1000; - - /* - * Queue delay is passed as a uint8 in units of 2ms (ms shifted - * by 1). Min value (other than 0) is therefore 2ms, max is 510ms. - * - * Pass max value if queue_delay is beyond the uint8 range - */ - ret_val = (u8) (min(queue_delay, priv->wmm.drv_pkt_delay_max) >> 1); - - dev_dbg(priv->adapter->dev, "data: WMM: Pkt Delay: %d ms," - " %d ms sent to FW\n", queue_delay, ret_val); - - return ret_val; -} - -/* - * This function retrieves the highest priority RA list table pointer. - */ -static struct mwifiex_ra_list_tbl * -mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter, - struct mwifiex_private **priv, int *tid) -{ - struct mwifiex_private *priv_tmp; - struct mwifiex_ra_list_tbl *ptr; - struct mwifiex_tid_tbl *tid_ptr; - atomic_t *hqp; - unsigned long flags_bss, flags_ra; - int i, j; - - /* check the BSS with highest priority first */ - for (j = adapter->priv_num - 1; j >= 0; --j) { - spin_lock_irqsave(&adapter->bss_prio_tbl[j].bss_prio_lock, - flags_bss); - - /* iterate over BSS with the equal priority */ - list_for_each_entry(adapter->bss_prio_tbl[j].bss_prio_cur, - &adapter->bss_prio_tbl[j].bss_prio_head, - list) { - - priv_tmp = adapter->bss_prio_tbl[j].bss_prio_cur->priv; - - if (atomic_read(&priv_tmp->wmm.tx_pkts_queued) == 0) - continue; - - /* iterate over the WMM queues of the BSS */ - hqp = &priv_tmp->wmm.highest_queued_prio; - for (i = atomic_read(hqp); i >= LOW_PRIO_TID; --i) { - - spin_lock_irqsave(&priv_tmp->wmm. - ra_list_spinlock, flags_ra); - - tid_ptr = &(priv_tmp)->wmm. - tid_tbl_ptr[tos_to_tid[i]]; - - /* iterate over receiver addresses */ - list_for_each_entry(ptr, &tid_ptr->ra_list, - list) { - - if (!skb_queue_empty(&ptr->skb_head)) - /* holds both locks */ - goto found; - } - - spin_unlock_irqrestore(&priv_tmp->wmm. - ra_list_spinlock, - flags_ra); - } - } - - spin_unlock_irqrestore(&adapter->bss_prio_tbl[j].bss_prio_lock, - flags_bss); - } - - return NULL; - -found: - /* holds bss_prio_lock / ra_list_spinlock */ - if (atomic_read(hqp) > i) - atomic_set(hqp, i); - spin_unlock_irqrestore(&priv_tmp->wmm.ra_list_spinlock, flags_ra); - spin_unlock_irqrestore(&adapter->bss_prio_tbl[j].bss_prio_lock, - flags_bss); - - *priv = priv_tmp; - *tid = tos_to_tid[i]; - - return ptr; -} - -/* This functions rotates ra and bss lists so packets are picked round robin. - * - * After a packet is successfully transmitted, rotate the ra list, so the ra - * next to the one transmitted, will come first in the list. This way we pick - * the ra' in a round robin fashion. Same applies to bss nodes of equal - * priority. - * - * Function also increments wmm.packets_out counter. - */ -void mwifiex_rotate_priolists(struct mwifiex_private *priv, - struct mwifiex_ra_list_tbl *ra, - int tid) -{ - struct mwifiex_adapter *adapter = priv->adapter; - struct mwifiex_bss_prio_tbl *tbl = adapter->bss_prio_tbl; - struct mwifiex_tid_tbl *tid_ptr = &priv->wmm.tid_tbl_ptr[tid]; - unsigned long flags; - - spin_lock_irqsave(&tbl[priv->bss_priority].bss_prio_lock, flags); - /* - * dirty trick: we remove 'head' temporarily and reinsert it after - * curr bss node. imagine list to stay fixed while head is moved - */ - list_move(&tbl[priv->bss_priority].bss_prio_head, - &tbl[priv->bss_priority].bss_prio_cur->list); - spin_unlock_irqrestore(&tbl[priv->bss_priority].bss_prio_lock, flags); - - spin_lock_irqsave(&priv->wmm.ra_list_spinlock, flags); - if (mwifiex_is_ralist_valid(priv, ra, tid)) { - priv->wmm.packets_out[tid]++; - /* same as above */ - list_move(&tid_ptr->ra_list, &ra->list); - } - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags); -} - -/* - * This function checks if 11n aggregation is possible. - */ -static int -mwifiex_is_11n_aggragation_possible(struct mwifiex_private *priv, - struct mwifiex_ra_list_tbl *ptr, - int max_buf_size) -{ - int count = 0, total_size = 0; - struct sk_buff *skb, *tmp; - int max_amsdu_size; - - if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP && priv->ap_11n_enabled && - ptr->is_11n_enabled) - max_amsdu_size = min_t(int, ptr->max_amsdu, max_buf_size); - else - max_amsdu_size = max_buf_size; - - skb_queue_walk_safe(&ptr->skb_head, skb, tmp) { - total_size += skb->len; - if (total_size >= max_amsdu_size) - break; - if (++count >= MIN_NUM_AMSDU) - return true; - } - - return false; -} - -/* - * This function sends a single packet to firmware for transmission. - */ -static void -mwifiex_send_single_packet(struct mwifiex_private *priv, - struct mwifiex_ra_list_tbl *ptr, int ptr_index, - unsigned long ra_list_flags) - __releases(&priv->wmm.ra_list_spinlock) -{ - struct sk_buff *skb, *skb_next; - struct mwifiex_tx_param tx_param; - struct mwifiex_adapter *adapter = priv->adapter; - struct mwifiex_txinfo *tx_info; - - if (skb_queue_empty(&ptr->skb_head)) { - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, - ra_list_flags); - dev_dbg(adapter->dev, "data: nothing to send\n"); - return; - } - - skb = skb_dequeue(&ptr->skb_head); - - tx_info = MWIFIEX_SKB_TXCB(skb); - dev_dbg(adapter->dev, "data: dequeuing the packet %p %p\n", ptr, skb); - - ptr->total_pkts_size -= skb->len; - - if (!skb_queue_empty(&ptr->skb_head)) - skb_next = skb_peek(&ptr->skb_head); - else - skb_next = NULL; - - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags); - - tx_param.next_pkt_len = ((skb_next) ? skb_next->len + - sizeof(struct txpd) : 0); - - if (mwifiex_process_tx(priv, skb, &tx_param) == -EBUSY) { - /* Queue the packet back at the head */ - spin_lock_irqsave(&priv->wmm.ra_list_spinlock, ra_list_flags); - - if (!mwifiex_is_ralist_valid(priv, ptr, ptr_index)) { - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, - ra_list_flags); - mwifiex_write_data_complete(adapter, skb, 0, -1); - return; - } - - skb_queue_tail(&ptr->skb_head, skb); - - ptr->total_pkts_size += skb->len; - ptr->pkt_count++; - tx_info->flags |= MWIFIEX_BUF_FLAG_REQUEUED_PKT; - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, - ra_list_flags); - } else { - mwifiex_rotate_priolists(priv, ptr, ptr_index); - atomic_dec(&priv->wmm.tx_pkts_queued); - } -} - -/* - * This function checks if the first packet in the given RA list - * is already processed or not. - */ -static int -mwifiex_is_ptr_processed(struct mwifiex_private *priv, - struct mwifiex_ra_list_tbl *ptr) -{ - struct sk_buff *skb; - struct mwifiex_txinfo *tx_info; - - if (skb_queue_empty(&ptr->skb_head)) - return false; - - skb = skb_peek(&ptr->skb_head); - - tx_info = MWIFIEX_SKB_TXCB(skb); - if (tx_info->flags & MWIFIEX_BUF_FLAG_REQUEUED_PKT) - return true; - - return false; -} - -/* - * This function sends a single processed packet to firmware for - * transmission. - */ -static void -mwifiex_send_processed_packet(struct mwifiex_private *priv, - struct mwifiex_ra_list_tbl *ptr, int ptr_index, - unsigned long ra_list_flags) - __releases(&priv->wmm.ra_list_spinlock) -{ - struct mwifiex_tx_param tx_param; - struct mwifiex_adapter *adapter = priv->adapter; - int ret = -1; - struct sk_buff *skb, *skb_next; - struct mwifiex_txinfo *tx_info; - - if (skb_queue_empty(&ptr->skb_head)) { - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, - ra_list_flags); - return; - } - - skb = skb_dequeue(&ptr->skb_head); - - if (!skb_queue_empty(&ptr->skb_head)) - skb_next = skb_peek(&ptr->skb_head); - else - skb_next = NULL; - - tx_info = MWIFIEX_SKB_TXCB(skb); - - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags); - - if (adapter->iface_type == MWIFIEX_USB) { - adapter->data_sent = true; - ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_USB_EP_DATA, - skb, NULL); - } else { - tx_param.next_pkt_len = - ((skb_next) ? skb_next->len + - sizeof(struct txpd) : 0); - ret = adapter->if_ops.host_to_card(adapter, MWIFIEX_TYPE_DATA, - skb, &tx_param); - } - - switch (ret) { - case -EBUSY: - dev_dbg(adapter->dev, "data: -EBUSY is returned\n"); - spin_lock_irqsave(&priv->wmm.ra_list_spinlock, ra_list_flags); - - if (!mwifiex_is_ralist_valid(priv, ptr, ptr_index)) { - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, - ra_list_flags); - mwifiex_write_data_complete(adapter, skb, 0, -1); - return; - } - - skb_queue_tail(&ptr->skb_head, skb); - - tx_info->flags |= MWIFIEX_BUF_FLAG_REQUEUED_PKT; - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, - ra_list_flags); - break; - case -1: - if (adapter->iface_type != MWIFIEX_PCIE) - adapter->data_sent = false; - dev_err(adapter->dev, "host_to_card failed: %#x\n", ret); - adapter->dbg.num_tx_host_to_card_failure++; - mwifiex_write_data_complete(adapter, skb, 0, ret); - break; - case -EINPROGRESS: - if (adapter->iface_type != MWIFIEX_PCIE) - adapter->data_sent = false; - default: - break; - } - if (ret != -EBUSY) { - mwifiex_rotate_priolists(priv, ptr, ptr_index); - atomic_dec(&priv->wmm.tx_pkts_queued); - } -} - -/* - * This function dequeues a packet from the highest priority list - * and transmits it. - */ -static int -mwifiex_dequeue_tx_packet(struct mwifiex_adapter *adapter) -{ - struct mwifiex_ra_list_tbl *ptr; - struct mwifiex_private *priv = NULL; - int ptr_index = 0; - u8 ra[ETH_ALEN]; - int tid_del = 0, tid = 0; - unsigned long flags; - - ptr = mwifiex_wmm_get_highest_priolist_ptr(adapter, &priv, &ptr_index); - if (!ptr) - return -1; - - tid = mwifiex_get_tid(ptr); - - dev_dbg(adapter->dev, "data: tid=%d\n", tid); - - spin_lock_irqsave(&priv->wmm.ra_list_spinlock, flags); - if (!mwifiex_is_ralist_valid(priv, ptr, ptr_index)) { - spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags); - return -1; - } - - if (mwifiex_is_ptr_processed(priv, ptr)) { - mwifiex_send_processed_packet(priv, ptr, ptr_index, flags); - /* ra_list_spinlock has been freed in - mwifiex_send_processed_packet() */ - return 0; - } - - if (!ptr->is_11n_enabled || - mwifiex_is_ba_stream_setup(priv, ptr, tid) || - priv->wps.session_enable || - ((priv->sec_info.wpa_enabled || - priv->sec_info.wpa2_enabled) && - !priv->wpa_is_gtk_set)) { - mwifiex_send_single_packet(priv, ptr, ptr_index, flags); - /* ra_list_spinlock has been freed in - mwifiex_send_single_packet() */ - } else { - if (mwifiex_is_ampdu_allowed(priv, tid) && - ptr->pkt_count > ptr->ba_packet_thr) { - if (mwifiex_space_avail_for_new_ba_stream(adapter)) { - mwifiex_create_ba_tbl(priv, ptr->ra, tid, - BA_SETUP_INPROGRESS); - mwifiex_send_addba(priv, tid, ptr->ra); - } else if (mwifiex_find_stream_to_delete - (priv, tid, &tid_del, ra)) { - mwifiex_create_ba_tbl(priv, ptr->ra, tid, - BA_SETUP_INPROGRESS); - mwifiex_send_delba(priv, tid_del, ra, 1); - } - } - if (mwifiex_is_amsdu_allowed(priv, tid) && - mwifiex_is_11n_aggragation_possible(priv, ptr, - adapter->tx_buf_size)) - mwifiex_11n_aggregate_pkt(priv, ptr, ptr_index, flags); - /* ra_list_spinlock has been freed in - mwifiex_11n_aggregate_pkt() */ - else - mwifiex_send_single_packet(priv, ptr, ptr_index, flags); - /* ra_list_spinlock has been freed in - mwifiex_send_single_packet() */ - } - return 0; -} - -/* - * This function transmits the highest priority packet awaiting in the - * WMM Queues. - */ -void -mwifiex_wmm_process_tx(struct mwifiex_adapter *adapter) -{ - do { - /* Check if busy */ - if (adapter->data_sent || adapter->tx_lock_flag) - break; - - if (mwifiex_dequeue_tx_packet(adapter)) - break; - } while (!mwifiex_wmm_lists_empty(adapter)); -} diff --git a/drivers/net/wireless/mwifiex/wmm.h b/drivers/net/wireless/mwifiex/wmm.h deleted file mode 100644 index 644d6e0c51cc..000000000000 --- a/drivers/net/wireless/mwifiex/wmm.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Marvell Wireless LAN device driver: WMM - * - * Copyright (C) 2011, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available by writing to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the - * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef _MWIFIEX_WMM_H_ -#define _MWIFIEX_WMM_H_ - -enum ieee_types_wmm_aciaifsn_bitmasks { - MWIFIEX_AIFSN = (BIT(0) | BIT(1) | BIT(2) | BIT(3)), - MWIFIEX_ACM = BIT(4), - MWIFIEX_ACI = (BIT(5) | BIT(6)), -}; - -enum ieee_types_wmm_ecw_bitmasks { - MWIFIEX_ECW_MIN = (BIT(0) | BIT(1) | BIT(2) | BIT(3)), - MWIFIEX_ECW_MAX = (BIT(4) | BIT(5) | BIT(6) | BIT(7)), -}; - -static const u16 mwifiex_1d_to_wmm_queue[8] = { 1, 0, 0, 1, 2, 2, 3, 3 }; - -/* - * This function retrieves the TID of the given RA list. - */ -static inline int -mwifiex_get_tid(struct mwifiex_ra_list_tbl *ptr) -{ - struct sk_buff *skb; - - if (skb_queue_empty(&ptr->skb_head)) - return 0; - - skb = skb_peek(&ptr->skb_head); - - return skb->priority; -} - -/* - * This function gets the length of a list. - */ -static inline int -mwifiex_wmm_list_len(struct list_head *head) -{ - struct list_head *pos; - int count = 0; - - list_for_each(pos, head) - ++count; - - return count; -} - -/* - * This function checks if a RA list is empty or not. - */ -static inline u8 -mwifiex_wmm_is_ra_list_empty(struct list_head *ra_list_hhead) -{ - struct mwifiex_ra_list_tbl *ra_list; - int is_list_empty; - - list_for_each_entry(ra_list, ra_list_hhead, list) { - is_list_empty = skb_queue_empty(&ra_list->skb_head); - if (!is_list_empty) - return false; - } - - return true; -} - -void mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv, - struct sk_buff *skb); -void mwifiex_ralist_add(struct mwifiex_private *priv, u8 *ra); -void mwifiex_rotate_priolists(struct mwifiex_private *priv, - struct mwifiex_ra_list_tbl *ra, - int tid); - -int mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter); -void mwifiex_wmm_process_tx(struct mwifiex_adapter *adapter); -int mwifiex_is_ralist_valid(struct mwifiex_private *priv, - struct mwifiex_ra_list_tbl *ra_list, int tid); - -u8 mwifiex_wmm_compute_drv_pkt_delay(struct mwifiex_private *priv, - const struct sk_buff *skb); -void mwifiex_wmm_init(struct mwifiex_adapter *adapter); - -extern u32 mwifiex_wmm_process_association_req(struct mwifiex_private *priv, - u8 **assoc_buf, - struct ieee_types_wmm_parameter - *wmmie, - struct ieee80211_ht_cap - *htcap); - -void mwifiex_wmm_setup_queue_priorities(struct mwifiex_private *priv, - struct ieee_types_wmm_parameter - *wmm_ie); -void mwifiex_wmm_setup_ac_downgrade(struct mwifiex_private *priv); -extern int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv, - const struct host_cmd_ds_command *resp); - -#endif /* !_MWIFIEX_WMM_H_ */ diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c deleted file mode 100644 index 6820fce4016b..000000000000 --- a/drivers/net/wireless/mwl8k.c +++ /dev/null @@ -1,6161 +0,0 @@ -/* - * drivers/net/wireless/mwl8k.c - * Driver for Marvell TOPDOG 802.11 Wireless cards - * - * Copyright (C) 2008, 2009, 2010 Marvell Semiconductor Inc. - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define MWL8K_DESC "Marvell TOPDOG(R) 802.11 Wireless Network Driver" -#define MWL8K_NAME KBUILD_MODNAME -#define MWL8K_VERSION "0.13" - -/* Module parameters */ -static bool ap_mode_default; -module_param(ap_mode_default, bool, 0); -MODULE_PARM_DESC(ap_mode_default, - "Set to 1 to make ap mode the default instead of sta mode"); - -/* Register definitions */ -#define MWL8K_HIU_GEN_PTR 0x00000c10 -#define MWL8K_MODE_STA 0x0000005a -#define MWL8K_MODE_AP 0x000000a5 -#define MWL8K_HIU_INT_CODE 0x00000c14 -#define MWL8K_FWSTA_READY 0xf0f1f2f4 -#define MWL8K_FWAP_READY 0xf1f2f4a5 -#define MWL8K_INT_CODE_CMD_FINISHED 0x00000005 -#define MWL8K_HIU_SCRATCH 0x00000c40 - -/* Host->device communications */ -#define MWL8K_HIU_H2A_INTERRUPT_EVENTS 0x00000c18 -#define MWL8K_HIU_H2A_INTERRUPT_STATUS 0x00000c1c -#define MWL8K_HIU_H2A_INTERRUPT_MASK 0x00000c20 -#define MWL8K_HIU_H2A_INTERRUPT_CLEAR_SEL 0x00000c24 -#define MWL8K_HIU_H2A_INTERRUPT_STATUS_MASK 0x00000c28 -#define MWL8K_H2A_INT_DUMMY (1 << 20) -#define MWL8K_H2A_INT_RESET (1 << 15) -#define MWL8K_H2A_INT_DOORBELL (1 << 1) -#define MWL8K_H2A_INT_PPA_READY (1 << 0) - -/* Device->host communications */ -#define MWL8K_HIU_A2H_INTERRUPT_EVENTS 0x00000c2c -#define MWL8K_HIU_A2H_INTERRUPT_STATUS 0x00000c30 -#define MWL8K_HIU_A2H_INTERRUPT_MASK 0x00000c34 -#define MWL8K_HIU_A2H_INTERRUPT_CLEAR_SEL 0x00000c38 -#define MWL8K_HIU_A2H_INTERRUPT_STATUS_MASK 0x00000c3c -#define MWL8K_A2H_INT_DUMMY (1 << 20) -#define MWL8K_A2H_INT_BA_WATCHDOG (1 << 14) -#define MWL8K_A2H_INT_CHNL_SWITCHED (1 << 11) -#define MWL8K_A2H_INT_QUEUE_EMPTY (1 << 10) -#define MWL8K_A2H_INT_RADAR_DETECT (1 << 7) -#define MWL8K_A2H_INT_RADIO_ON (1 << 6) -#define MWL8K_A2H_INT_RADIO_OFF (1 << 5) -#define MWL8K_A2H_INT_MAC_EVENT (1 << 3) -#define MWL8K_A2H_INT_OPC_DONE (1 << 2) -#define MWL8K_A2H_INT_RX_READY (1 << 1) -#define MWL8K_A2H_INT_TX_DONE (1 << 0) - -/* HW micro second timer register - * located at offset 0xA600. This - * will be used to timestamp tx - * packets. - */ - -#define MWL8K_HW_TIMER_REGISTER 0x0000a600 - -#define MWL8K_A2H_EVENTS (MWL8K_A2H_INT_DUMMY | \ - MWL8K_A2H_INT_CHNL_SWITCHED | \ - MWL8K_A2H_INT_QUEUE_EMPTY | \ - MWL8K_A2H_INT_RADAR_DETECT | \ - MWL8K_A2H_INT_RADIO_ON | \ - MWL8K_A2H_INT_RADIO_OFF | \ - MWL8K_A2H_INT_MAC_EVENT | \ - MWL8K_A2H_INT_OPC_DONE | \ - MWL8K_A2H_INT_RX_READY | \ - MWL8K_A2H_INT_TX_DONE | \ - MWL8K_A2H_INT_BA_WATCHDOG) - -#define MWL8K_RX_QUEUES 1 -#define MWL8K_TX_WMM_QUEUES 4 -#define MWL8K_MAX_AMPDU_QUEUES 8 -#define MWL8K_MAX_TX_QUEUES (MWL8K_TX_WMM_QUEUES + MWL8K_MAX_AMPDU_QUEUES) -#define mwl8k_tx_queues(priv) (MWL8K_TX_WMM_QUEUES + (priv)->num_ampdu_queues) - -/* txpriorities are mapped with hw queues. - * Each hw queue has a txpriority. - */ -#define TOTAL_HW_TX_QUEUES 8 - -/* Each HW queue can have one AMPDU stream. - * But, because one of the hw queue is reserved, - * maximum AMPDU queues that can be created are - * one short of total tx queues. - */ -#define MWL8K_NUM_AMPDU_STREAMS (TOTAL_HW_TX_QUEUES - 1) - -struct rxd_ops { - int rxd_size; - void (*rxd_init)(void *rxd, dma_addr_t next_dma_addr); - void (*rxd_refill)(void *rxd, dma_addr_t addr, int len); - int (*rxd_process)(void *rxd, struct ieee80211_rx_status *status, - __le16 *qos, s8 *noise); -}; - -struct mwl8k_device_info { - char *part_name; - char *helper_image; - char *fw_image_sta; - char *fw_image_ap; - struct rxd_ops *ap_rxd_ops; - u32 fw_api_ap; -}; - -struct mwl8k_rx_queue { - int rxd_count; - - /* hw receives here */ - int head; - - /* refill descs here */ - int tail; - - void *rxd; - dma_addr_t rxd_dma; - struct { - struct sk_buff *skb; - DEFINE_DMA_UNMAP_ADDR(dma); - } *buf; -}; - -struct mwl8k_tx_queue { - /* hw transmits here */ - int head; - - /* sw appends here */ - int tail; - - unsigned int len; - struct mwl8k_tx_desc *txd; - dma_addr_t txd_dma; - struct sk_buff **skb; -}; - -enum { - AMPDU_NO_STREAM, - AMPDU_STREAM_NEW, - AMPDU_STREAM_IN_PROGRESS, - AMPDU_STREAM_ACTIVE, -}; - -struct mwl8k_ampdu_stream { - struct ieee80211_sta *sta; - u8 tid; - u8 state; - u8 idx; -}; - -struct mwl8k_priv { - struct ieee80211_hw *hw; - struct pci_dev *pdev; - int irq; - - struct mwl8k_device_info *device_info; - - void __iomem *sram; - void __iomem *regs; - - /* firmware */ - const struct firmware *fw_helper; - const struct firmware *fw_ucode; - - /* hardware/firmware parameters */ - bool ap_fw; - struct rxd_ops *rxd_ops; - struct ieee80211_supported_band band_24; - struct ieee80211_channel channels_24[14]; - struct ieee80211_rate rates_24[13]; - struct ieee80211_supported_band band_50; - struct ieee80211_channel channels_50[4]; - struct ieee80211_rate rates_50[8]; - u32 ap_macids_supported; - u32 sta_macids_supported; - - /* Ampdu stream information */ - u8 num_ampdu_queues; - spinlock_t stream_lock; - struct mwl8k_ampdu_stream ampdu[MWL8K_MAX_AMPDU_QUEUES]; - struct work_struct watchdog_ba_handle; - - /* firmware access */ - struct mutex fw_mutex; - struct task_struct *fw_mutex_owner; - struct task_struct *hw_restart_owner; - int fw_mutex_depth; - struct completion *hostcmd_wait; - - atomic_t watchdog_event_pending; - - /* lock held over TX and TX reap */ - spinlock_t tx_lock; - - /* TX quiesce completion, protected by fw_mutex and tx_lock */ - struct completion *tx_wait; - - /* List of interfaces. */ - u32 macids_used; - struct list_head vif_list; - - /* power management status cookie from firmware */ - u32 *cookie; - dma_addr_t cookie_dma; - - u16 num_mcaddrs; - u8 hw_rev; - u32 fw_rev; - u32 caps; - - /* - * Running count of TX packets in flight, to avoid - * iterating over the transmit rings each time. - */ - int pending_tx_pkts; - - struct mwl8k_rx_queue rxq[MWL8K_RX_QUEUES]; - struct mwl8k_tx_queue txq[MWL8K_MAX_TX_QUEUES]; - u32 txq_offset[MWL8K_MAX_TX_QUEUES]; - - bool radio_on; - bool radio_short_preamble; - bool sniffer_enabled; - bool wmm_enabled; - - /* XXX need to convert this to handle multiple interfaces */ - bool capture_beacon; - u8 capture_bssid[ETH_ALEN]; - struct sk_buff *beacon_skb; - - /* - * This FJ worker has to be global as it is scheduled from the - * RX handler. At this point we don't know which interface it - * belongs to until the list of bssids waiting to complete join - * is checked. - */ - struct work_struct finalize_join_worker; - - /* Tasklet to perform TX reclaim. */ - struct tasklet_struct poll_tx_task; - - /* Tasklet to perform RX. */ - struct tasklet_struct poll_rx_task; - - /* Most recently reported noise in dBm */ - s8 noise; - - /* - * preserve the queue configurations so they can be restored if/when - * the firmware image is swapped. - */ - struct ieee80211_tx_queue_params wmm_params[MWL8K_TX_WMM_QUEUES]; - - /* To perform the task of reloading the firmware */ - struct work_struct fw_reload; - bool hw_restart_in_progress; - - /* async firmware loading state */ - unsigned fw_state; - char *fw_pref; - char *fw_alt; - bool is_8764; - struct completion firmware_loading_complete; - - /* bitmap of running BSSes */ - u32 running_bsses; -}; - -#define MAX_WEP_KEY_LEN 13 -#define NUM_WEP_KEYS 4 - -/* Per interface specific private data */ -struct mwl8k_vif { - struct list_head list; - struct ieee80211_vif *vif; - - /* Firmware macid for this vif. */ - int macid; - - /* Non AMPDU sequence number assigned by driver. */ - u16 seqno; - - /* Saved WEP keys */ - struct { - u8 enabled; - u8 key[sizeof(struct ieee80211_key_conf) + MAX_WEP_KEY_LEN]; - } wep_key_conf[NUM_WEP_KEYS]; - - /* BSSID */ - u8 bssid[ETH_ALEN]; - - /* A flag to indicate is HW crypto is enabled for this bssid */ - bool is_hw_crypto_enabled; -}; -#define MWL8K_VIF(_vif) ((struct mwl8k_vif *)&((_vif)->drv_priv)) -#define IEEE80211_KEY_CONF(_u8) ((struct ieee80211_key_conf *)(_u8)) - -struct tx_traffic_info { - u32 start_time; - u32 pkts; -}; - -#define MWL8K_MAX_TID 8 -struct mwl8k_sta { - /* Index into station database. Returned by UPDATE_STADB. */ - u8 peer_id; - u8 is_ampdu_allowed; - struct tx_traffic_info tx_stats[MWL8K_MAX_TID]; -}; -#define MWL8K_STA(_sta) ((struct mwl8k_sta *)&((_sta)->drv_priv)) - -static const struct ieee80211_channel mwl8k_channels_24[] = { - { .band = IEEE80211_BAND_2GHZ, .center_freq = 2412, .hw_value = 1, }, - { .band = IEEE80211_BAND_2GHZ, .center_freq = 2417, .hw_value = 2, }, - { .band = IEEE80211_BAND_2GHZ, .center_freq = 2422, .hw_value = 3, }, - { .band = IEEE80211_BAND_2GHZ, .center_freq = 2427, .hw_value = 4, }, - { .band = IEEE80211_BAND_2GHZ, .center_freq = 2432, .hw_value = 5, }, - { .band = IEEE80211_BAND_2GHZ, .center_freq = 2437, .hw_value = 6, }, - { .band = IEEE80211_BAND_2GHZ, .center_freq = 2442, .hw_value = 7, }, - { .band = IEEE80211_BAND_2GHZ, .center_freq = 2447, .hw_value = 8, }, - { .band = IEEE80211_BAND_2GHZ, .center_freq = 2452, .hw_value = 9, }, - { .band = IEEE80211_BAND_2GHZ, .center_freq = 2457, .hw_value = 10, }, - { .band = IEEE80211_BAND_2GHZ, .center_freq = 2462, .hw_value = 11, }, - { .band = IEEE80211_BAND_2GHZ, .center_freq = 2467, .hw_value = 12, }, - { .band = IEEE80211_BAND_2GHZ, .center_freq = 2472, .hw_value = 13, }, - { .band = IEEE80211_BAND_2GHZ, .center_freq = 2484, .hw_value = 14, }, -}; - -static const struct ieee80211_rate mwl8k_rates_24[] = { - { .bitrate = 10, .hw_value = 2, }, - { .bitrate = 20, .hw_value = 4, }, - { .bitrate = 55, .hw_value = 11, }, - { .bitrate = 110, .hw_value = 22, }, - { .bitrate = 220, .hw_value = 44, }, - { .bitrate = 60, .hw_value = 12, }, - { .bitrate = 90, .hw_value = 18, }, - { .bitrate = 120, .hw_value = 24, }, - { .bitrate = 180, .hw_value = 36, }, - { .bitrate = 240, .hw_value = 48, }, - { .bitrate = 360, .hw_value = 72, }, - { .bitrate = 480, .hw_value = 96, }, - { .bitrate = 540, .hw_value = 108, }, -}; - -static const struct ieee80211_channel mwl8k_channels_50[] = { - { .band = IEEE80211_BAND_5GHZ, .center_freq = 5180, .hw_value = 36, }, - { .band = IEEE80211_BAND_5GHZ, .center_freq = 5200, .hw_value = 40, }, - { .band = IEEE80211_BAND_5GHZ, .center_freq = 5220, .hw_value = 44, }, - { .band = IEEE80211_BAND_5GHZ, .center_freq = 5240, .hw_value = 48, }, -}; - -static const struct ieee80211_rate mwl8k_rates_50[] = { - { .bitrate = 60, .hw_value = 12, }, - { .bitrate = 90, .hw_value = 18, }, - { .bitrate = 120, .hw_value = 24, }, - { .bitrate = 180, .hw_value = 36, }, - { .bitrate = 240, .hw_value = 48, }, - { .bitrate = 360, .hw_value = 72, }, - { .bitrate = 480, .hw_value = 96, }, - { .bitrate = 540, .hw_value = 108, }, -}; - -/* Set or get info from Firmware */ -#define MWL8K_CMD_GET 0x0000 -#define MWL8K_CMD_SET 0x0001 -#define MWL8K_CMD_SET_LIST 0x0002 - -/* Firmware command codes */ -#define MWL8K_CMD_CODE_DNLD 0x0001 -#define MWL8K_CMD_GET_HW_SPEC 0x0003 -#define MWL8K_CMD_SET_HW_SPEC 0x0004 -#define MWL8K_CMD_MAC_MULTICAST_ADR 0x0010 -#define MWL8K_CMD_GET_STAT 0x0014 -#define MWL8K_CMD_RADIO_CONTROL 0x001c -#define MWL8K_CMD_RF_TX_POWER 0x001e -#define MWL8K_CMD_TX_POWER 0x001f -#define MWL8K_CMD_RF_ANTENNA 0x0020 -#define MWL8K_CMD_SET_BEACON 0x0100 /* per-vif */ -#define MWL8K_CMD_SET_PRE_SCAN 0x0107 -#define MWL8K_CMD_SET_POST_SCAN 0x0108 -#define MWL8K_CMD_SET_RF_CHANNEL 0x010a -#define MWL8K_CMD_SET_AID 0x010d -#define MWL8K_CMD_SET_RATE 0x0110 -#define MWL8K_CMD_SET_FINALIZE_JOIN 0x0111 -#define MWL8K_CMD_RTS_THRESHOLD 0x0113 -#define MWL8K_CMD_SET_SLOT 0x0114 -#define MWL8K_CMD_SET_EDCA_PARAMS 0x0115 -#define MWL8K_CMD_SET_WMM_MODE 0x0123 -#define MWL8K_CMD_MIMO_CONFIG 0x0125 -#define MWL8K_CMD_USE_FIXED_RATE 0x0126 -#define MWL8K_CMD_ENABLE_SNIFFER 0x0150 -#define MWL8K_CMD_SET_MAC_ADDR 0x0202 /* per-vif */ -#define MWL8K_CMD_SET_RATEADAPT_MODE 0x0203 -#define MWL8K_CMD_GET_WATCHDOG_BITMAP 0x0205 -#define MWL8K_CMD_DEL_MAC_ADDR 0x0206 /* per-vif */ -#define MWL8K_CMD_BSS_START 0x1100 /* per-vif */ -#define MWL8K_CMD_SET_NEW_STN 0x1111 /* per-vif */ -#define MWL8K_CMD_UPDATE_ENCRYPTION 0x1122 /* per-vif */ -#define MWL8K_CMD_UPDATE_STADB 0x1123 -#define MWL8K_CMD_BASTREAM 0x1125 - -static const char *mwl8k_cmd_name(__le16 cmd, char *buf, int bufsize) -{ - u16 command = le16_to_cpu(cmd); - -#define MWL8K_CMDNAME(x) case MWL8K_CMD_##x: do {\ - snprintf(buf, bufsize, "%s", #x);\ - return buf;\ - } while (0) - switch (command & ~0x8000) { - MWL8K_CMDNAME(CODE_DNLD); - MWL8K_CMDNAME(GET_HW_SPEC); - MWL8K_CMDNAME(SET_HW_SPEC); - MWL8K_CMDNAME(MAC_MULTICAST_ADR); - MWL8K_CMDNAME(GET_STAT); - MWL8K_CMDNAME(RADIO_CONTROL); - MWL8K_CMDNAME(RF_TX_POWER); - MWL8K_CMDNAME(TX_POWER); - MWL8K_CMDNAME(RF_ANTENNA); - MWL8K_CMDNAME(SET_BEACON); - MWL8K_CMDNAME(SET_PRE_SCAN); - MWL8K_CMDNAME(SET_POST_SCAN); - MWL8K_CMDNAME(SET_RF_CHANNEL); - MWL8K_CMDNAME(SET_AID); - MWL8K_CMDNAME(SET_RATE); - MWL8K_CMDNAME(SET_FINALIZE_JOIN); - MWL8K_CMDNAME(RTS_THRESHOLD); - MWL8K_CMDNAME(SET_SLOT); - MWL8K_CMDNAME(SET_EDCA_PARAMS); - MWL8K_CMDNAME(SET_WMM_MODE); - MWL8K_CMDNAME(MIMO_CONFIG); - MWL8K_CMDNAME(USE_FIXED_RATE); - MWL8K_CMDNAME(ENABLE_SNIFFER); - MWL8K_CMDNAME(SET_MAC_ADDR); - MWL8K_CMDNAME(SET_RATEADAPT_MODE); - MWL8K_CMDNAME(BSS_START); - MWL8K_CMDNAME(SET_NEW_STN); - MWL8K_CMDNAME(UPDATE_ENCRYPTION); - MWL8K_CMDNAME(UPDATE_STADB); - MWL8K_CMDNAME(BASTREAM); - MWL8K_CMDNAME(GET_WATCHDOG_BITMAP); - default: - snprintf(buf, bufsize, "0x%x", cmd); - } -#undef MWL8K_CMDNAME - - return buf; -} - -/* Hardware and firmware reset */ -static void mwl8k_hw_reset(struct mwl8k_priv *priv) -{ - iowrite32(MWL8K_H2A_INT_RESET, - priv->regs + MWL8K_HIU_H2A_INTERRUPT_EVENTS); - iowrite32(MWL8K_H2A_INT_RESET, - priv->regs + MWL8K_HIU_H2A_INTERRUPT_EVENTS); - msleep(20); -} - -/* Release fw image */ -static void mwl8k_release_fw(const struct firmware **fw) -{ - if (*fw == NULL) - return; - release_firmware(*fw); - *fw = NULL; -} - -static void mwl8k_release_firmware(struct mwl8k_priv *priv) -{ - mwl8k_release_fw(&priv->fw_ucode); - mwl8k_release_fw(&priv->fw_helper); -} - -/* states for asynchronous f/w loading */ -static void mwl8k_fw_state_machine(const struct firmware *fw, void *context); -enum { - FW_STATE_INIT = 0, - FW_STATE_LOADING_PREF, - FW_STATE_LOADING_ALT, - FW_STATE_ERROR, -}; - -/* Request fw image */ -static int mwl8k_request_fw(struct mwl8k_priv *priv, - const char *fname, const struct firmware **fw, - bool nowait) -{ - /* release current image */ - if (*fw != NULL) - mwl8k_release_fw(fw); - - if (nowait) - return request_firmware_nowait(THIS_MODULE, 1, fname, - &priv->pdev->dev, GFP_KERNEL, - priv, mwl8k_fw_state_machine); - else - return request_firmware(fw, fname, &priv->pdev->dev); -} - -static int mwl8k_request_firmware(struct mwl8k_priv *priv, char *fw_image, - bool nowait) -{ - struct mwl8k_device_info *di = priv->device_info; - int rc; - - if (di->helper_image != NULL) { - if (nowait) - rc = mwl8k_request_fw(priv, di->helper_image, - &priv->fw_helper, true); - else - rc = mwl8k_request_fw(priv, di->helper_image, - &priv->fw_helper, false); - if (rc) - printk(KERN_ERR "%s: Error requesting helper fw %s\n", - pci_name(priv->pdev), di->helper_image); - - if (rc || nowait) - return rc; - } - - if (nowait) { - /* - * if we get here, no helper image is needed. Skip the - * FW_STATE_INIT state. - */ - priv->fw_state = FW_STATE_LOADING_PREF; - rc = mwl8k_request_fw(priv, fw_image, - &priv->fw_ucode, - true); - } else - rc = mwl8k_request_fw(priv, fw_image, - &priv->fw_ucode, false); - if (rc) { - printk(KERN_ERR "%s: Error requesting firmware file %s\n", - pci_name(priv->pdev), fw_image); - mwl8k_release_fw(&priv->fw_helper); - return rc; - } - - return 0; -} - -struct mwl8k_cmd_pkt { - __le16 code; - __le16 length; - __u8 seq_num; - __u8 macid; - __le16 result; - char payload[0]; -} __packed; - -/* - * Firmware loading. - */ -static int -mwl8k_send_fw_load_cmd(struct mwl8k_priv *priv, void *data, int length) -{ - void __iomem *regs = priv->regs; - dma_addr_t dma_addr; - int loops; - - dma_addr = pci_map_single(priv->pdev, data, length, PCI_DMA_TODEVICE); - if (pci_dma_mapping_error(priv->pdev, dma_addr)) - return -ENOMEM; - - iowrite32(dma_addr, regs + MWL8K_HIU_GEN_PTR); - iowrite32(0, regs + MWL8K_HIU_INT_CODE); - iowrite32(MWL8K_H2A_INT_DOORBELL, - regs + MWL8K_HIU_H2A_INTERRUPT_EVENTS); - iowrite32(MWL8K_H2A_INT_DUMMY, - regs + MWL8K_HIU_H2A_INTERRUPT_EVENTS); - - loops = 1000; - do { - u32 int_code; - if (priv->is_8764) { - int_code = ioread32(regs + - MWL8K_HIU_H2A_INTERRUPT_STATUS); - if (int_code == 0) - break; - } else { - int_code = ioread32(regs + MWL8K_HIU_INT_CODE); - if (int_code == MWL8K_INT_CODE_CMD_FINISHED) { - iowrite32(0, regs + MWL8K_HIU_INT_CODE); - break; - } - } - cond_resched(); - udelay(1); - } while (--loops); - - pci_unmap_single(priv->pdev, dma_addr, length, PCI_DMA_TODEVICE); - - return loops ? 0 : -ETIMEDOUT; -} - -static int mwl8k_load_fw_image(struct mwl8k_priv *priv, - const u8 *data, size_t length) -{ - struct mwl8k_cmd_pkt *cmd; - int done; - int rc = 0; - - cmd = kmalloc(sizeof(*cmd) + 256, GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->code = cpu_to_le16(MWL8K_CMD_CODE_DNLD); - cmd->seq_num = 0; - cmd->macid = 0; - cmd->result = 0; - - done = 0; - while (length) { - int block_size = length > 256 ? 256 : length; - - memcpy(cmd->payload, data + done, block_size); - cmd->length = cpu_to_le16(block_size); - - rc = mwl8k_send_fw_load_cmd(priv, cmd, - sizeof(*cmd) + block_size); - if (rc) - break; - - done += block_size; - length -= block_size; - } - - if (!rc) { - cmd->length = 0; - rc = mwl8k_send_fw_load_cmd(priv, cmd, sizeof(*cmd)); - } - - kfree(cmd); - - return rc; -} - -static int mwl8k_feed_fw_image(struct mwl8k_priv *priv, - const u8 *data, size_t length) -{ - unsigned char *buffer; - int may_continue, rc = 0; - u32 done, prev_block_size; - - buffer = kmalloc(1024, GFP_KERNEL); - if (buffer == NULL) - return -ENOMEM; - - done = 0; - prev_block_size = 0; - may_continue = 1000; - while (may_continue > 0) { - u32 block_size; - - block_size = ioread32(priv->regs + MWL8K_HIU_SCRATCH); - if (block_size & 1) { - block_size &= ~1; - may_continue--; - } else { - done += prev_block_size; - length -= prev_block_size; - } - - if (block_size > 1024 || block_size > length) { - rc = -EOVERFLOW; - break; - } - - if (length == 0) { - rc = 0; - break; - } - - if (block_size == 0) { - rc = -EPROTO; - may_continue--; - udelay(1); - continue; - } - - prev_block_size = block_size; - memcpy(buffer, data + done, block_size); - - rc = mwl8k_send_fw_load_cmd(priv, buffer, block_size); - if (rc) - break; - } - - if (!rc && length != 0) - rc = -EREMOTEIO; - - kfree(buffer); - - return rc; -} - -static int mwl8k_load_firmware(struct ieee80211_hw *hw) -{ - struct mwl8k_priv *priv = hw->priv; - const struct firmware *fw = priv->fw_ucode; - int rc; - int loops; - - if (!memcmp(fw->data, "\x01\x00\x00\x00", 4) && !priv->is_8764) { - const struct firmware *helper = priv->fw_helper; - - if (helper == NULL) { - printk(KERN_ERR "%s: helper image needed but none " - "given\n", pci_name(priv->pdev)); - return -EINVAL; - } - - rc = mwl8k_load_fw_image(priv, helper->data, helper->size); - if (rc) { - printk(KERN_ERR "%s: unable to load firmware " - "helper image\n", pci_name(priv->pdev)); - return rc; - } - msleep(20); - - rc = mwl8k_feed_fw_image(priv, fw->data, fw->size); - } else { - if (priv->is_8764) - rc = mwl8k_feed_fw_image(priv, fw->data, fw->size); - else - rc = mwl8k_load_fw_image(priv, fw->data, fw->size); - } - - if (rc) { - printk(KERN_ERR "%s: unable to load firmware image\n", - pci_name(priv->pdev)); - return rc; - } - - iowrite32(MWL8K_MODE_STA, priv->regs + MWL8K_HIU_GEN_PTR); - - loops = 500000; - do { - u32 ready_code; - - ready_code = ioread32(priv->regs + MWL8K_HIU_INT_CODE); - if (ready_code == MWL8K_FWAP_READY) { - priv->ap_fw = true; - break; - } else if (ready_code == MWL8K_FWSTA_READY) { - priv->ap_fw = false; - break; - } - - cond_resched(); - udelay(1); - } while (--loops); - - return loops ? 0 : -ETIMEDOUT; -} - - -/* DMA header used by firmware and hardware. */ -struct mwl8k_dma_data { - __le16 fwlen; - struct ieee80211_hdr wh; - char data[0]; -} __packed; - -/* Routines to add/remove DMA header from skb. */ -static inline void mwl8k_remove_dma_header(struct sk_buff *skb, __le16 qos) -{ - struct mwl8k_dma_data *tr; - int hdrlen; - - tr = (struct mwl8k_dma_data *)skb->data; - hdrlen = ieee80211_hdrlen(tr->wh.frame_control); - - if (hdrlen != sizeof(tr->wh)) { - if (ieee80211_is_data_qos(tr->wh.frame_control)) { - memmove(tr->data - hdrlen, &tr->wh, hdrlen - 2); - *((__le16 *)(tr->data - 2)) = qos; - } else { - memmove(tr->data - hdrlen, &tr->wh, hdrlen); - } - } - - if (hdrlen != sizeof(*tr)) - skb_pull(skb, sizeof(*tr) - hdrlen); -} - -#define REDUCED_TX_HEADROOM 8 - -static void -mwl8k_add_dma_header(struct mwl8k_priv *priv, struct sk_buff *skb, - int head_pad, int tail_pad) -{ - struct ieee80211_hdr *wh; - int hdrlen; - int reqd_hdrlen; - struct mwl8k_dma_data *tr; - - /* - * Add a firmware DMA header; the firmware requires that we - * present a 2-byte payload length followed by a 4-address - * header (without QoS field), followed (optionally) by any - * WEP/ExtIV header (but only filled in for CCMP). - */ - wh = (struct ieee80211_hdr *)skb->data; - - hdrlen = ieee80211_hdrlen(wh->frame_control); - - /* - * Check if skb_resize is required because of - * tx_headroom adjustment. - */ - if (priv->ap_fw && (hdrlen < (sizeof(struct ieee80211_cts) - + REDUCED_TX_HEADROOM))) { - if (pskb_expand_head(skb, REDUCED_TX_HEADROOM, 0, GFP_ATOMIC)) { - - wiphy_err(priv->hw->wiphy, - "Failed to reallocate TX buffer\n"); - return; - } - skb->truesize += REDUCED_TX_HEADROOM; - } - - reqd_hdrlen = sizeof(*tr) + head_pad; - - if (hdrlen != reqd_hdrlen) - skb_push(skb, reqd_hdrlen - hdrlen); - - if (ieee80211_is_data_qos(wh->frame_control)) - hdrlen -= IEEE80211_QOS_CTL_LEN; - - tr = (struct mwl8k_dma_data *)skb->data; - if (wh != &tr->wh) - memmove(&tr->wh, wh, hdrlen); - if (hdrlen != sizeof(tr->wh)) - memset(((void *)&tr->wh) + hdrlen, 0, sizeof(tr->wh) - hdrlen); - - /* - * Firmware length is the length of the fully formed "802.11 - * payload". That is, everything except for the 802.11 header. - * This includes all crypto material including the MIC. - */ - tr->fwlen = cpu_to_le16(skb->len - sizeof(*tr) + tail_pad); -} - -static void mwl8k_encapsulate_tx_frame(struct mwl8k_priv *priv, - struct sk_buff *skb) -{ - struct ieee80211_hdr *wh; - struct ieee80211_tx_info *tx_info; - struct ieee80211_key_conf *key_conf; - int data_pad; - int head_pad = 0; - - wh = (struct ieee80211_hdr *)skb->data; - - tx_info = IEEE80211_SKB_CB(skb); - - key_conf = NULL; - if (ieee80211_is_data(wh->frame_control)) - key_conf = tx_info->control.hw_key; - - /* - * Make sure the packet header is in the DMA header format (4-address - * without QoS), and add head & tail padding when HW crypto is enabled. - * - * We have the following trailer padding requirements: - * - WEP: 4 trailer bytes (ICV) - * - TKIP: 12 trailer bytes (8 MIC + 4 ICV) - * - CCMP: 8 trailer bytes (MIC) - */ - data_pad = 0; - if (key_conf != NULL) { - head_pad = key_conf->iv_len; - switch (key_conf->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - data_pad = 4; - break; - case WLAN_CIPHER_SUITE_TKIP: - data_pad = 12; - break; - case WLAN_CIPHER_SUITE_CCMP: - data_pad = 8; - break; - } - } - mwl8k_add_dma_header(priv, skb, head_pad, data_pad); -} - -/* - * Packet reception for 88w8366/88w8764 AP firmware. - */ -struct mwl8k_rxd_ap { - __le16 pkt_len; - __u8 sq2; - __u8 rate; - __le32 pkt_phys_addr; - __le32 next_rxd_phys_addr; - __le16 qos_control; - __le16 htsig2; - __le32 hw_rssi_info; - __le32 hw_noise_floor_info; - __u8 noise_floor; - __u8 pad0[3]; - __u8 rssi; - __u8 rx_status; - __u8 channel; - __u8 rx_ctrl; -} __packed; - -#define MWL8K_AP_RATE_INFO_MCS_FORMAT 0x80 -#define MWL8K_AP_RATE_INFO_40MHZ 0x40 -#define MWL8K_AP_RATE_INFO_RATEID(x) ((x) & 0x3f) - -#define MWL8K_AP_RX_CTRL_OWNED_BY_HOST 0x80 - -/* 8366/8764 AP rx_status bits */ -#define MWL8K_AP_RXSTAT_DECRYPT_ERR_MASK 0x80 -#define MWL8K_AP_RXSTAT_GENERAL_DECRYPT_ERR 0xFF -#define MWL8K_AP_RXSTAT_TKIP_DECRYPT_MIC_ERR 0x02 -#define MWL8K_AP_RXSTAT_WEP_DECRYPT_ICV_ERR 0x04 -#define MWL8K_AP_RXSTAT_TKIP_DECRYPT_ICV_ERR 0x08 - -static void mwl8k_rxd_ap_init(void *_rxd, dma_addr_t next_dma_addr) -{ - struct mwl8k_rxd_ap *rxd = _rxd; - - rxd->next_rxd_phys_addr = cpu_to_le32(next_dma_addr); - rxd->rx_ctrl = MWL8K_AP_RX_CTRL_OWNED_BY_HOST; -} - -static void mwl8k_rxd_ap_refill(void *_rxd, dma_addr_t addr, int len) -{ - struct mwl8k_rxd_ap *rxd = _rxd; - - rxd->pkt_len = cpu_to_le16(len); - rxd->pkt_phys_addr = cpu_to_le32(addr); - wmb(); - rxd->rx_ctrl = 0; -} - -static int -mwl8k_rxd_ap_process(void *_rxd, struct ieee80211_rx_status *status, - __le16 *qos, s8 *noise) -{ - struct mwl8k_rxd_ap *rxd = _rxd; - - if (!(rxd->rx_ctrl & MWL8K_AP_RX_CTRL_OWNED_BY_HOST)) - return -1; - rmb(); - - memset(status, 0, sizeof(*status)); - - status->signal = -rxd->rssi; - *noise = -rxd->noise_floor; - - if (rxd->rate & MWL8K_AP_RATE_INFO_MCS_FORMAT) { - status->flag |= RX_FLAG_HT; - if (rxd->rate & MWL8K_AP_RATE_INFO_40MHZ) - status->flag |= RX_FLAG_40MHZ; - status->rate_idx = MWL8K_AP_RATE_INFO_RATEID(rxd->rate); - } else { - int i; - - for (i = 0; i < ARRAY_SIZE(mwl8k_rates_24); i++) { - if (mwl8k_rates_24[i].hw_value == rxd->rate) { - status->rate_idx = i; - break; - } - } - } - - if (rxd->channel > 14) { - status->band = IEEE80211_BAND_5GHZ; - if (!(status->flag & RX_FLAG_HT)) - status->rate_idx -= 5; - } else { - status->band = IEEE80211_BAND_2GHZ; - } - status->freq = ieee80211_channel_to_frequency(rxd->channel, - status->band); - - *qos = rxd->qos_control; - - if ((rxd->rx_status != MWL8K_AP_RXSTAT_GENERAL_DECRYPT_ERR) && - (rxd->rx_status & MWL8K_AP_RXSTAT_DECRYPT_ERR_MASK) && - (rxd->rx_status & MWL8K_AP_RXSTAT_TKIP_DECRYPT_MIC_ERR)) - status->flag |= RX_FLAG_MMIC_ERROR; - - return le16_to_cpu(rxd->pkt_len); -} - -static struct rxd_ops rxd_ap_ops = { - .rxd_size = sizeof(struct mwl8k_rxd_ap), - .rxd_init = mwl8k_rxd_ap_init, - .rxd_refill = mwl8k_rxd_ap_refill, - .rxd_process = mwl8k_rxd_ap_process, -}; - -/* - * Packet reception for STA firmware. - */ -struct mwl8k_rxd_sta { - __le16 pkt_len; - __u8 link_quality; - __u8 noise_level; - __le32 pkt_phys_addr; - __le32 next_rxd_phys_addr; - __le16 qos_control; - __le16 rate_info; - __le32 pad0[4]; - __u8 rssi; - __u8 channel; - __le16 pad1; - __u8 rx_ctrl; - __u8 rx_status; - __u8 pad2[2]; -} __packed; - -#define MWL8K_STA_RATE_INFO_SHORTPRE 0x8000 -#define MWL8K_STA_RATE_INFO_ANTSELECT(x) (((x) >> 11) & 0x3) -#define MWL8K_STA_RATE_INFO_RATEID(x) (((x) >> 3) & 0x3f) -#define MWL8K_STA_RATE_INFO_40MHZ 0x0004 -#define MWL8K_STA_RATE_INFO_SHORTGI 0x0002 -#define MWL8K_STA_RATE_INFO_MCS_FORMAT 0x0001 - -#define MWL8K_STA_RX_CTRL_OWNED_BY_HOST 0x02 -#define MWL8K_STA_RX_CTRL_DECRYPT_ERROR 0x04 -/* ICV=0 or MIC=1 */ -#define MWL8K_STA_RX_CTRL_DEC_ERR_TYPE 0x08 -/* Key is uploaded only in failure case */ -#define MWL8K_STA_RX_CTRL_KEY_INDEX 0x30 - -static void mwl8k_rxd_sta_init(void *_rxd, dma_addr_t next_dma_addr) -{ - struct mwl8k_rxd_sta *rxd = _rxd; - - rxd->next_rxd_phys_addr = cpu_to_le32(next_dma_addr); - rxd->rx_ctrl = MWL8K_STA_RX_CTRL_OWNED_BY_HOST; -} - -static void mwl8k_rxd_sta_refill(void *_rxd, dma_addr_t addr, int len) -{ - struct mwl8k_rxd_sta *rxd = _rxd; - - rxd->pkt_len = cpu_to_le16(len); - rxd->pkt_phys_addr = cpu_to_le32(addr); - wmb(); - rxd->rx_ctrl = 0; -} - -static int -mwl8k_rxd_sta_process(void *_rxd, struct ieee80211_rx_status *status, - __le16 *qos, s8 *noise) -{ - struct mwl8k_rxd_sta *rxd = _rxd; - u16 rate_info; - - if (!(rxd->rx_ctrl & MWL8K_STA_RX_CTRL_OWNED_BY_HOST)) - return -1; - rmb(); - - rate_info = le16_to_cpu(rxd->rate_info); - - memset(status, 0, sizeof(*status)); - - status->signal = -rxd->rssi; - *noise = -rxd->noise_level; - status->antenna = MWL8K_STA_RATE_INFO_ANTSELECT(rate_info); - status->rate_idx = MWL8K_STA_RATE_INFO_RATEID(rate_info); - - if (rate_info & MWL8K_STA_RATE_INFO_SHORTPRE) - status->flag |= RX_FLAG_SHORTPRE; - if (rate_info & MWL8K_STA_RATE_INFO_40MHZ) - status->flag |= RX_FLAG_40MHZ; - if (rate_info & MWL8K_STA_RATE_INFO_SHORTGI) - status->flag |= RX_FLAG_SHORT_GI; - if (rate_info & MWL8K_STA_RATE_INFO_MCS_FORMAT) - status->flag |= RX_FLAG_HT; - - if (rxd->channel > 14) { - status->band = IEEE80211_BAND_5GHZ; - if (!(status->flag & RX_FLAG_HT)) - status->rate_idx -= 5; - } else { - status->band = IEEE80211_BAND_2GHZ; - } - status->freq = ieee80211_channel_to_frequency(rxd->channel, - status->band); - - *qos = rxd->qos_control; - if ((rxd->rx_ctrl & MWL8K_STA_RX_CTRL_DECRYPT_ERROR) && - (rxd->rx_ctrl & MWL8K_STA_RX_CTRL_DEC_ERR_TYPE)) - status->flag |= RX_FLAG_MMIC_ERROR; - - return le16_to_cpu(rxd->pkt_len); -} - -static struct rxd_ops rxd_sta_ops = { - .rxd_size = sizeof(struct mwl8k_rxd_sta), - .rxd_init = mwl8k_rxd_sta_init, - .rxd_refill = mwl8k_rxd_sta_refill, - .rxd_process = mwl8k_rxd_sta_process, -}; - - -#define MWL8K_RX_DESCS 256 -#define MWL8K_RX_MAXSZ 3800 - -static int mwl8k_rxq_init(struct ieee80211_hw *hw, int index) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_rx_queue *rxq = priv->rxq + index; - int size; - int i; - - rxq->rxd_count = 0; - rxq->head = 0; - rxq->tail = 0; - - size = MWL8K_RX_DESCS * priv->rxd_ops->rxd_size; - - rxq->rxd = pci_alloc_consistent(priv->pdev, size, &rxq->rxd_dma); - if (rxq->rxd == NULL) { - wiphy_err(hw->wiphy, "failed to alloc RX descriptors\n"); - return -ENOMEM; - } - memset(rxq->rxd, 0, size); - - rxq->buf = kcalloc(MWL8K_RX_DESCS, sizeof(*rxq->buf), GFP_KERNEL); - if (rxq->buf == NULL) { - pci_free_consistent(priv->pdev, size, rxq->rxd, rxq->rxd_dma); - return -ENOMEM; - } - - for (i = 0; i < MWL8K_RX_DESCS; i++) { - int desc_size; - void *rxd; - int nexti; - dma_addr_t next_dma_addr; - - desc_size = priv->rxd_ops->rxd_size; - rxd = rxq->rxd + (i * priv->rxd_ops->rxd_size); - - nexti = i + 1; - if (nexti == MWL8K_RX_DESCS) - nexti = 0; - next_dma_addr = rxq->rxd_dma + (nexti * desc_size); - - priv->rxd_ops->rxd_init(rxd, next_dma_addr); - } - - return 0; -} - -static int rxq_refill(struct ieee80211_hw *hw, int index, int limit) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_rx_queue *rxq = priv->rxq + index; - int refilled; - - refilled = 0; - while (rxq->rxd_count < MWL8K_RX_DESCS && limit--) { - struct sk_buff *skb; - dma_addr_t addr; - int rx; - void *rxd; - - skb = dev_alloc_skb(MWL8K_RX_MAXSZ); - if (skb == NULL) - break; - - addr = pci_map_single(priv->pdev, skb->data, - MWL8K_RX_MAXSZ, DMA_FROM_DEVICE); - - rxq->rxd_count++; - rx = rxq->tail++; - if (rxq->tail == MWL8K_RX_DESCS) - rxq->tail = 0; - rxq->buf[rx].skb = skb; - dma_unmap_addr_set(&rxq->buf[rx], dma, addr); - - rxd = rxq->rxd + (rx * priv->rxd_ops->rxd_size); - priv->rxd_ops->rxd_refill(rxd, addr, MWL8K_RX_MAXSZ); - - refilled++; - } - - return refilled; -} - -/* Must be called only when the card's reception is completely halted */ -static void mwl8k_rxq_deinit(struct ieee80211_hw *hw, int index) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_rx_queue *rxq = priv->rxq + index; - int i; - - if (rxq->rxd == NULL) - return; - - for (i = 0; i < MWL8K_RX_DESCS; i++) { - if (rxq->buf[i].skb != NULL) { - pci_unmap_single(priv->pdev, - dma_unmap_addr(&rxq->buf[i], dma), - MWL8K_RX_MAXSZ, PCI_DMA_FROMDEVICE); - dma_unmap_addr_set(&rxq->buf[i], dma, 0); - - kfree_skb(rxq->buf[i].skb); - rxq->buf[i].skb = NULL; - } - } - - kfree(rxq->buf); - rxq->buf = NULL; - - pci_free_consistent(priv->pdev, - MWL8K_RX_DESCS * priv->rxd_ops->rxd_size, - rxq->rxd, rxq->rxd_dma); - rxq->rxd = NULL; -} - - -/* - * Scan a list of BSSIDs to process for finalize join. - * Allows for extension to process multiple BSSIDs. - */ -static inline int -mwl8k_capture_bssid(struct mwl8k_priv *priv, struct ieee80211_hdr *wh) -{ - return priv->capture_beacon && - ieee80211_is_beacon(wh->frame_control) && - ether_addr_equal(wh->addr3, priv->capture_bssid); -} - -static inline void mwl8k_save_beacon(struct ieee80211_hw *hw, - struct sk_buff *skb) -{ - struct mwl8k_priv *priv = hw->priv; - - priv->capture_beacon = false; - memset(priv->capture_bssid, 0, ETH_ALEN); - - /* - * Use GFP_ATOMIC as rxq_process is called from - * the primary interrupt handler, memory allocation call - * must not sleep. - */ - priv->beacon_skb = skb_copy(skb, GFP_ATOMIC); - if (priv->beacon_skb != NULL) - ieee80211_queue_work(hw, &priv->finalize_join_worker); -} - -static inline struct mwl8k_vif *mwl8k_find_vif_bss(struct list_head *vif_list, - u8 *bssid) -{ - struct mwl8k_vif *mwl8k_vif; - - list_for_each_entry(mwl8k_vif, - vif_list, list) { - if (memcmp(bssid, mwl8k_vif->bssid, - ETH_ALEN) == 0) - return mwl8k_vif; - } - - return NULL; -} - -static int rxq_process(struct ieee80211_hw *hw, int index, int limit) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_vif *mwl8k_vif = NULL; - struct mwl8k_rx_queue *rxq = priv->rxq + index; - int processed; - - processed = 0; - while (rxq->rxd_count && limit--) { - struct sk_buff *skb; - void *rxd; - int pkt_len; - struct ieee80211_rx_status status; - struct ieee80211_hdr *wh; - __le16 qos; - - skb = rxq->buf[rxq->head].skb; - if (skb == NULL) - break; - - rxd = rxq->rxd + (rxq->head * priv->rxd_ops->rxd_size); - - pkt_len = priv->rxd_ops->rxd_process(rxd, &status, &qos, - &priv->noise); - if (pkt_len < 0) - break; - - rxq->buf[rxq->head].skb = NULL; - - pci_unmap_single(priv->pdev, - dma_unmap_addr(&rxq->buf[rxq->head], dma), - MWL8K_RX_MAXSZ, PCI_DMA_FROMDEVICE); - dma_unmap_addr_set(&rxq->buf[rxq->head], dma, 0); - - rxq->head++; - if (rxq->head == MWL8K_RX_DESCS) - rxq->head = 0; - - rxq->rxd_count--; - - wh = &((struct mwl8k_dma_data *)skb->data)->wh; - - /* - * Check for a pending join operation. Save a - * copy of the beacon and schedule a tasklet to - * send a FINALIZE_JOIN command to the firmware. - */ - if (mwl8k_capture_bssid(priv, (void *)skb->data)) - mwl8k_save_beacon(hw, skb); - - if (ieee80211_has_protected(wh->frame_control)) { - - /* Check if hw crypto has been enabled for - * this bss. If yes, set the status flags - * accordingly - */ - mwl8k_vif = mwl8k_find_vif_bss(&priv->vif_list, - wh->addr1); - - if (mwl8k_vif != NULL && - mwl8k_vif->is_hw_crypto_enabled) { - /* - * When MMIC ERROR is encountered - * by the firmware, payload is - * dropped and only 32 bytes of - * mwl8k Firmware header is sent - * to the host. - * - * We need to add four bytes of - * key information. In it - * MAC80211 expects keyidx set to - * 0 for triggering Counter - * Measure of MMIC failure. - */ - if (status.flag & RX_FLAG_MMIC_ERROR) { - struct mwl8k_dma_data *tr; - tr = (struct mwl8k_dma_data *)skb->data; - memset((void *)&(tr->data), 0, 4); - pkt_len += 4; - } - - if (!ieee80211_is_auth(wh->frame_control)) - status.flag |= RX_FLAG_IV_STRIPPED | - RX_FLAG_DECRYPTED | - RX_FLAG_MMIC_STRIPPED; - } - } - - skb_put(skb, pkt_len); - mwl8k_remove_dma_header(skb, qos); - memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); - ieee80211_rx_irqsafe(hw, skb); - - processed++; - } - - return processed; -} - - -/* - * Packet transmission. - */ - -#define MWL8K_TXD_STATUS_OK 0x00000001 -#define MWL8K_TXD_STATUS_OK_RETRY 0x00000002 -#define MWL8K_TXD_STATUS_OK_MORE_RETRY 0x00000004 -#define MWL8K_TXD_STATUS_MULTICAST_TX 0x00000008 -#define MWL8K_TXD_STATUS_FW_OWNED 0x80000000 - -#define MWL8K_QOS_QLEN_UNSPEC 0xff00 -#define MWL8K_QOS_ACK_POLICY_MASK 0x0060 -#define MWL8K_QOS_ACK_POLICY_NORMAL 0x0000 -#define MWL8K_QOS_ACK_POLICY_BLOCKACK 0x0060 -#define MWL8K_QOS_EOSP 0x0010 - -struct mwl8k_tx_desc { - __le32 status; - __u8 data_rate; - __u8 tx_priority; - __le16 qos_control; - __le32 pkt_phys_addr; - __le16 pkt_len; - __u8 dest_MAC_addr[ETH_ALEN]; - __le32 next_txd_phys_addr; - __le32 timestamp; - __le16 rate_info; - __u8 peer_id; - __u8 tx_frag_cnt; -} __packed; - -#define MWL8K_TX_DESCS 128 - -static int mwl8k_txq_init(struct ieee80211_hw *hw, int index) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_tx_queue *txq = priv->txq + index; - int size; - int i; - - txq->len = 0; - txq->head = 0; - txq->tail = 0; - - size = MWL8K_TX_DESCS * sizeof(struct mwl8k_tx_desc); - - txq->txd = pci_alloc_consistent(priv->pdev, size, &txq->txd_dma); - if (txq->txd == NULL) { - wiphy_err(hw->wiphy, "failed to alloc TX descriptors\n"); - return -ENOMEM; - } - memset(txq->txd, 0, size); - - txq->skb = kcalloc(MWL8K_TX_DESCS, sizeof(*txq->skb), GFP_KERNEL); - if (txq->skb == NULL) { - pci_free_consistent(priv->pdev, size, txq->txd, txq->txd_dma); - return -ENOMEM; - } - - for (i = 0; i < MWL8K_TX_DESCS; i++) { - struct mwl8k_tx_desc *tx_desc; - int nexti; - - tx_desc = txq->txd + i; - nexti = (i + 1) % MWL8K_TX_DESCS; - - tx_desc->status = 0; - tx_desc->next_txd_phys_addr = - cpu_to_le32(txq->txd_dma + nexti * sizeof(*tx_desc)); - } - - return 0; -} - -static inline void mwl8k_tx_start(struct mwl8k_priv *priv) -{ - iowrite32(MWL8K_H2A_INT_PPA_READY, - priv->regs + MWL8K_HIU_H2A_INTERRUPT_EVENTS); - iowrite32(MWL8K_H2A_INT_DUMMY, - priv->regs + MWL8K_HIU_H2A_INTERRUPT_EVENTS); - ioread32(priv->regs + MWL8K_HIU_INT_CODE); -} - -static void mwl8k_dump_tx_rings(struct ieee80211_hw *hw) -{ - struct mwl8k_priv *priv = hw->priv; - int i; - - for (i = 0; i < mwl8k_tx_queues(priv); i++) { - struct mwl8k_tx_queue *txq = priv->txq + i; - int fw_owned = 0; - int drv_owned = 0; - int unused = 0; - int desc; - - for (desc = 0; desc < MWL8K_TX_DESCS; desc++) { - struct mwl8k_tx_desc *tx_desc = txq->txd + desc; - u32 status; - - status = le32_to_cpu(tx_desc->status); - if (status & MWL8K_TXD_STATUS_FW_OWNED) - fw_owned++; - else - drv_owned++; - - if (tx_desc->pkt_len == 0) - unused++; - } - - wiphy_err(hw->wiphy, - "txq[%d] len=%d head=%d tail=%d " - "fw_owned=%d drv_owned=%d unused=%d\n", - i, - txq->len, txq->head, txq->tail, - fw_owned, drv_owned, unused); - } -} - -/* - * Must be called with priv->fw_mutex held and tx queues stopped. - */ -#define MWL8K_TX_WAIT_TIMEOUT_MS 5000 - -static int mwl8k_tx_wait_empty(struct ieee80211_hw *hw) -{ - struct mwl8k_priv *priv = hw->priv; - DECLARE_COMPLETION_ONSTACK(tx_wait); - int retry; - int rc; - - might_sleep(); - - /* Since fw restart is in progress, allow only the firmware - * commands from the restart code and block the other - * commands since they are going to fail in any case since - * the firmware has crashed - */ - if (priv->hw_restart_in_progress) { - if (priv->hw_restart_owner == current) - return 0; - else - return -EBUSY; - } - - if (atomic_read(&priv->watchdog_event_pending)) - return 0; - - /* - * The TX queues are stopped at this point, so this test - * doesn't need to take ->tx_lock. - */ - if (!priv->pending_tx_pkts) - return 0; - - retry = 0; - rc = 0; - - spin_lock_bh(&priv->tx_lock); - priv->tx_wait = &tx_wait; - while (!rc) { - int oldcount; - unsigned long timeout; - - oldcount = priv->pending_tx_pkts; - - spin_unlock_bh(&priv->tx_lock); - timeout = wait_for_completion_timeout(&tx_wait, - msecs_to_jiffies(MWL8K_TX_WAIT_TIMEOUT_MS)); - - if (atomic_read(&priv->watchdog_event_pending)) { - spin_lock_bh(&priv->tx_lock); - priv->tx_wait = NULL; - spin_unlock_bh(&priv->tx_lock); - return 0; - } - - spin_lock_bh(&priv->tx_lock); - - if (timeout) { - WARN_ON(priv->pending_tx_pkts); - if (retry) - wiphy_notice(hw->wiphy, "tx rings drained\n"); - break; - } - - if (priv->pending_tx_pkts < oldcount) { - wiphy_notice(hw->wiphy, - "waiting for tx rings to drain (%d -> %d pkts)\n", - oldcount, priv->pending_tx_pkts); - retry = 1; - continue; - } - - priv->tx_wait = NULL; - - wiphy_err(hw->wiphy, "tx rings stuck for %d ms\n", - MWL8K_TX_WAIT_TIMEOUT_MS); - mwl8k_dump_tx_rings(hw); - priv->hw_restart_in_progress = true; - ieee80211_queue_work(hw, &priv->fw_reload); - - rc = -ETIMEDOUT; - } - priv->tx_wait = NULL; - spin_unlock_bh(&priv->tx_lock); - - return rc; -} - -#define MWL8K_TXD_SUCCESS(status) \ - ((status) & (MWL8K_TXD_STATUS_OK | \ - MWL8K_TXD_STATUS_OK_RETRY | \ - MWL8K_TXD_STATUS_OK_MORE_RETRY)) - -static int mwl8k_tid_queue_mapping(u8 tid) -{ - BUG_ON(tid > 7); - - switch (tid) { - case 0: - case 3: - return IEEE80211_AC_BE; - break; - case 1: - case 2: - return IEEE80211_AC_BK; - break; - case 4: - case 5: - return IEEE80211_AC_VI; - break; - case 6: - case 7: - return IEEE80211_AC_VO; - break; - default: - return -1; - break; - } -} - -/* The firmware will fill in the rate information - * for each packet that gets queued in the hardware - * and these macros will interpret that info. - */ - -#define RI_FORMAT(a) (a & 0x0001) -#define RI_RATE_ID_MCS(a) ((a & 0x01f8) >> 3) - -static int -mwl8k_txq_reclaim(struct ieee80211_hw *hw, int index, int limit, int force) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_tx_queue *txq = priv->txq + index; - int processed; - - processed = 0; - while (txq->len > 0 && limit--) { - int tx; - struct mwl8k_tx_desc *tx_desc; - unsigned long addr; - int size; - struct sk_buff *skb; - struct ieee80211_tx_info *info; - u32 status; - struct ieee80211_sta *sta; - struct mwl8k_sta *sta_info = NULL; - u16 rate_info; - struct ieee80211_hdr *wh; - - tx = txq->head; - tx_desc = txq->txd + tx; - - status = le32_to_cpu(tx_desc->status); - - if (status & MWL8K_TXD_STATUS_FW_OWNED) { - if (!force) - break; - tx_desc->status &= - ~cpu_to_le32(MWL8K_TXD_STATUS_FW_OWNED); - } - - txq->head = (tx + 1) % MWL8K_TX_DESCS; - BUG_ON(txq->len == 0); - txq->len--; - priv->pending_tx_pkts--; - - addr = le32_to_cpu(tx_desc->pkt_phys_addr); - size = le16_to_cpu(tx_desc->pkt_len); - skb = txq->skb[tx]; - txq->skb[tx] = NULL; - - BUG_ON(skb == NULL); - pci_unmap_single(priv->pdev, addr, size, PCI_DMA_TODEVICE); - - mwl8k_remove_dma_header(skb, tx_desc->qos_control); - - wh = (struct ieee80211_hdr *) skb->data; - - /* Mark descriptor as unused */ - tx_desc->pkt_phys_addr = 0; - tx_desc->pkt_len = 0; - - info = IEEE80211_SKB_CB(skb); - if (ieee80211_is_data(wh->frame_control)) { - rcu_read_lock(); - sta = ieee80211_find_sta_by_ifaddr(hw, wh->addr1, - wh->addr2); - if (sta) { - sta_info = MWL8K_STA(sta); - BUG_ON(sta_info == NULL); - rate_info = le16_to_cpu(tx_desc->rate_info); - /* If rate is < 6.5 Mpbs for an ht station - * do not form an ampdu. If the station is a - * legacy station (format = 0), do not form an - * ampdu - */ - if (RI_RATE_ID_MCS(rate_info) < 1 || - RI_FORMAT(rate_info) == 0) { - sta_info->is_ampdu_allowed = false; - } else { - sta_info->is_ampdu_allowed = true; - } - } - rcu_read_unlock(); - } - - ieee80211_tx_info_clear_status(info); - - /* Rate control is happening in the firmware. - * Ensure no tx rate is being reported. - */ - info->status.rates[0].idx = -1; - info->status.rates[0].count = 1; - - if (MWL8K_TXD_SUCCESS(status)) - info->flags |= IEEE80211_TX_STAT_ACK; - - ieee80211_tx_status_irqsafe(hw, skb); - - processed++; - } - - return processed; -} - -/* must be called only when the card's transmit is completely halted */ -static void mwl8k_txq_deinit(struct ieee80211_hw *hw, int index) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_tx_queue *txq = priv->txq + index; - - if (txq->txd == NULL) - return; - - mwl8k_txq_reclaim(hw, index, INT_MAX, 1); - - kfree(txq->skb); - txq->skb = NULL; - - pci_free_consistent(priv->pdev, - MWL8K_TX_DESCS * sizeof(struct mwl8k_tx_desc), - txq->txd, txq->txd_dma); - txq->txd = NULL; -} - -/* caller must hold priv->stream_lock when calling the stream functions */ -static struct mwl8k_ampdu_stream * -mwl8k_add_stream(struct ieee80211_hw *hw, struct ieee80211_sta *sta, u8 tid) -{ - struct mwl8k_ampdu_stream *stream; - struct mwl8k_priv *priv = hw->priv; - int i; - - for (i = 0; i < MWL8K_NUM_AMPDU_STREAMS; i++) { - stream = &priv->ampdu[i]; - if (stream->state == AMPDU_NO_STREAM) { - stream->sta = sta; - stream->state = AMPDU_STREAM_NEW; - stream->tid = tid; - stream->idx = i; - wiphy_debug(hw->wiphy, "Added a new stream for %pM %d", - sta->addr, tid); - return stream; - } - } - return NULL; -} - -static int -mwl8k_start_stream(struct ieee80211_hw *hw, struct mwl8k_ampdu_stream *stream) -{ - int ret; - - /* if the stream has already been started, don't start it again */ - if (stream->state != AMPDU_STREAM_NEW) - return 0; - ret = ieee80211_start_tx_ba_session(stream->sta, stream->tid, 0); - if (ret) - wiphy_debug(hw->wiphy, "Failed to start stream for %pM %d: " - "%d\n", stream->sta->addr, stream->tid, ret); - else - wiphy_debug(hw->wiphy, "Started stream for %pM %d\n", - stream->sta->addr, stream->tid); - return ret; -} - -static void -mwl8k_remove_stream(struct ieee80211_hw *hw, struct mwl8k_ampdu_stream *stream) -{ - wiphy_debug(hw->wiphy, "Remove stream for %pM %d\n", stream->sta->addr, - stream->tid); - memset(stream, 0, sizeof(*stream)); -} - -static struct mwl8k_ampdu_stream * -mwl8k_lookup_stream(struct ieee80211_hw *hw, u8 *addr, u8 tid) -{ - struct mwl8k_priv *priv = hw->priv; - int i; - - for (i = 0; i < MWL8K_NUM_AMPDU_STREAMS; i++) { - struct mwl8k_ampdu_stream *stream; - stream = &priv->ampdu[i]; - if (stream->state == AMPDU_NO_STREAM) - continue; - if (!memcmp(stream->sta->addr, addr, ETH_ALEN) && - stream->tid == tid) - return stream; - } - return NULL; -} - -#define MWL8K_AMPDU_PACKET_THRESHOLD 64 -static inline bool mwl8k_ampdu_allowed(struct ieee80211_sta *sta, u8 tid) -{ - struct mwl8k_sta *sta_info = MWL8K_STA(sta); - struct tx_traffic_info *tx_stats; - - BUG_ON(tid >= MWL8K_MAX_TID); - tx_stats = &sta_info->tx_stats[tid]; - - return sta_info->is_ampdu_allowed && - tx_stats->pkts > MWL8K_AMPDU_PACKET_THRESHOLD; -} - -static inline void mwl8k_tx_count_packet(struct ieee80211_sta *sta, u8 tid) -{ - struct mwl8k_sta *sta_info = MWL8K_STA(sta); - struct tx_traffic_info *tx_stats; - - BUG_ON(tid >= MWL8K_MAX_TID); - tx_stats = &sta_info->tx_stats[tid]; - - if (tx_stats->start_time == 0) - tx_stats->start_time = jiffies; - - /* reset the packet count after each second elapses. If the number of - * packets ever exceeds the ampdu_min_traffic threshold, we will allow - * an ampdu stream to be started. - */ - if (jiffies - tx_stats->start_time > HZ) { - tx_stats->pkts = 0; - tx_stats->start_time = 0; - } else - tx_stats->pkts++; -} - -/* The hardware ampdu queues start from 5. - * txpriorities for ampdu queues are - * 5 6 7 0 1 2 3 4 ie., queue 5 is highest - * and queue 3 is lowest (queue 4 is reserved) - */ -#define BA_QUEUE 5 - -static void -mwl8k_txq_xmit(struct ieee80211_hw *hw, - int index, - struct ieee80211_sta *sta, - struct sk_buff *skb) -{ - struct mwl8k_priv *priv = hw->priv; - struct ieee80211_tx_info *tx_info; - struct mwl8k_vif *mwl8k_vif; - struct ieee80211_hdr *wh; - struct mwl8k_tx_queue *txq; - struct mwl8k_tx_desc *tx; - dma_addr_t dma; - u32 txstatus; - u8 txdatarate; - u16 qos; - int txpriority; - u8 tid = 0; - struct mwl8k_ampdu_stream *stream = NULL; - bool start_ba_session = false; - bool mgmtframe = false; - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; - bool eapol_frame = false; - - wh = (struct ieee80211_hdr *)skb->data; - if (ieee80211_is_data_qos(wh->frame_control)) - qos = le16_to_cpu(*((__le16 *)ieee80211_get_qos_ctl(wh))); - else - qos = 0; - - if (skb->protocol == cpu_to_be16(ETH_P_PAE)) - eapol_frame = true; - - if (ieee80211_is_mgmt(wh->frame_control)) - mgmtframe = true; - - if (priv->ap_fw) - mwl8k_encapsulate_tx_frame(priv, skb); - else - mwl8k_add_dma_header(priv, skb, 0, 0); - - wh = &((struct mwl8k_dma_data *)skb->data)->wh; - - tx_info = IEEE80211_SKB_CB(skb); - mwl8k_vif = MWL8K_VIF(tx_info->control.vif); - - if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { - wh->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); - wh->seq_ctrl |= cpu_to_le16(mwl8k_vif->seqno); - mwl8k_vif->seqno += 0x10; - } - - /* Setup firmware control bit fields for each frame type. */ - txstatus = 0; - txdatarate = 0; - if (ieee80211_is_mgmt(wh->frame_control) || - ieee80211_is_ctl(wh->frame_control)) { - txdatarate = 0; - qos |= MWL8K_QOS_QLEN_UNSPEC | MWL8K_QOS_EOSP; - } else if (ieee80211_is_data(wh->frame_control)) { - txdatarate = 1; - if (is_multicast_ether_addr(wh->addr1)) - txstatus |= MWL8K_TXD_STATUS_MULTICAST_TX; - - qos &= ~MWL8K_QOS_ACK_POLICY_MASK; - if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) - qos |= MWL8K_QOS_ACK_POLICY_BLOCKACK; - else - qos |= MWL8K_QOS_ACK_POLICY_NORMAL; - } - - /* Queue ADDBA request in the respective data queue. While setting up - * the ampdu stream, mac80211 queues further packets for that - * particular ra/tid pair. However, packets piled up in the hardware - * for that ra/tid pair will still go out. ADDBA request and the - * related data packets going out from different queues asynchronously - * will cause a shift in the receiver window which might result in - * ampdu packets getting dropped at the receiver after the stream has - * been setup. - */ - if (unlikely(ieee80211_is_action(wh->frame_control) && - mgmt->u.action.category == WLAN_CATEGORY_BACK && - mgmt->u.action.u.addba_req.action_code == WLAN_ACTION_ADDBA_REQ && - priv->ap_fw)) { - u16 capab = le16_to_cpu(mgmt->u.action.u.addba_req.capab); - tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2; - index = mwl8k_tid_queue_mapping(tid); - } - - txpriority = index; - - if (priv->ap_fw && sta && sta->ht_cap.ht_supported && !eapol_frame && - ieee80211_is_data_qos(wh->frame_control)) { - tid = qos & 0xf; - mwl8k_tx_count_packet(sta, tid); - spin_lock(&priv->stream_lock); - stream = mwl8k_lookup_stream(hw, sta->addr, tid); - if (stream != NULL) { - if (stream->state == AMPDU_STREAM_ACTIVE) { - WARN_ON(!(qos & MWL8K_QOS_ACK_POLICY_BLOCKACK)); - txpriority = (BA_QUEUE + stream->idx) % - TOTAL_HW_TX_QUEUES; - if (stream->idx <= 1) - index = stream->idx + - MWL8K_TX_WMM_QUEUES; - - } else if (stream->state == AMPDU_STREAM_NEW) { - /* We get here if the driver sends us packets - * after we've initiated a stream, but before - * our ampdu_action routine has been called - * with IEEE80211_AMPDU_TX_START to get the SSN - * for the ADDBA request. So this packet can - * go out with no risk of sequence number - * mismatch. No special handling is required. - */ - } else { - /* Drop packets that would go out after the - * ADDBA request was sent but before the ADDBA - * response is received. If we don't do this, - * the recipient would probably receive it - * after the ADDBA request with SSN 0. This - * will cause the recipient's BA receive window - * to shift, which would cause the subsequent - * packets in the BA stream to be discarded. - * mac80211 queues our packets for us in this - * case, so this is really just a safety check. - */ - wiphy_warn(hw->wiphy, - "Cannot send packet while ADDBA " - "dialog is underway.\n"); - spin_unlock(&priv->stream_lock); - dev_kfree_skb(skb); - return; - } - } else { - /* Defer calling mwl8k_start_stream so that the current - * skb can go out before the ADDBA request. This - * prevents sequence number mismatch at the recepient - * as described above. - */ - if (mwl8k_ampdu_allowed(sta, tid)) { - stream = mwl8k_add_stream(hw, sta, tid); - if (stream != NULL) - start_ba_session = true; - } - } - spin_unlock(&priv->stream_lock); - } else { - qos &= ~MWL8K_QOS_ACK_POLICY_MASK; - qos |= MWL8K_QOS_ACK_POLICY_NORMAL; - } - - dma = pci_map_single(priv->pdev, skb->data, - skb->len, PCI_DMA_TODEVICE); - - if (pci_dma_mapping_error(priv->pdev, dma)) { - wiphy_debug(hw->wiphy, - "failed to dma map skb, dropping TX frame.\n"); - if (start_ba_session) { - spin_lock(&priv->stream_lock); - mwl8k_remove_stream(hw, stream); - spin_unlock(&priv->stream_lock); - } - dev_kfree_skb(skb); - return; - } - - spin_lock_bh(&priv->tx_lock); - - txq = priv->txq + index; - - /* Mgmt frames that go out frequently are probe - * responses. Other mgmt frames got out relatively - * infrequently. Hence reserve 2 buffers so that - * other mgmt frames do not get dropped due to an - * already queued probe response in one of the - * reserved buffers. - */ - - if (txq->len >= MWL8K_TX_DESCS - 2) { - if (!mgmtframe || txq->len == MWL8K_TX_DESCS) { - if (start_ba_session) { - spin_lock(&priv->stream_lock); - mwl8k_remove_stream(hw, stream); - spin_unlock(&priv->stream_lock); - } - spin_unlock_bh(&priv->tx_lock); - pci_unmap_single(priv->pdev, dma, skb->len, - PCI_DMA_TODEVICE); - dev_kfree_skb(skb); - return; - } - } - - BUG_ON(txq->skb[txq->tail] != NULL); - txq->skb[txq->tail] = skb; - - tx = txq->txd + txq->tail; - tx->data_rate = txdatarate; - tx->tx_priority = txpriority; - tx->qos_control = cpu_to_le16(qos); - tx->pkt_phys_addr = cpu_to_le32(dma); - tx->pkt_len = cpu_to_le16(skb->len); - tx->rate_info = 0; - if (!priv->ap_fw && sta != NULL) - tx->peer_id = MWL8K_STA(sta)->peer_id; - else - tx->peer_id = 0; - - if (priv->ap_fw && ieee80211_is_data(wh->frame_control) && !eapol_frame) - tx->timestamp = cpu_to_le32(ioread32(priv->regs + - MWL8K_HW_TIMER_REGISTER)); - else - tx->timestamp = 0; - - wmb(); - tx->status = cpu_to_le32(MWL8K_TXD_STATUS_FW_OWNED | txstatus); - - txq->len++; - priv->pending_tx_pkts++; - - txq->tail++; - if (txq->tail == MWL8K_TX_DESCS) - txq->tail = 0; - - mwl8k_tx_start(priv); - - spin_unlock_bh(&priv->tx_lock); - - /* Initiate the ampdu session here */ - if (start_ba_session) { - spin_lock(&priv->stream_lock); - if (mwl8k_start_stream(hw, stream)) - mwl8k_remove_stream(hw, stream); - spin_unlock(&priv->stream_lock); - } -} - - -/* - * Firmware access. - * - * We have the following requirements for issuing firmware commands: - * - Some commands require that the packet transmit path is idle when - * the command is issued. (For simplicity, we'll just quiesce the - * transmit path for every command.) - * - There are certain sequences of commands that need to be issued to - * the hardware sequentially, with no other intervening commands. - * - * This leads to an implementation of a "firmware lock" as a mutex that - * can be taken recursively, and which is taken by both the low-level - * command submission function (mwl8k_post_cmd) as well as any users of - * that function that require issuing of an atomic sequence of commands, - * and quiesces the transmit path whenever it's taken. - */ -static int mwl8k_fw_lock(struct ieee80211_hw *hw) -{ - struct mwl8k_priv *priv = hw->priv; - - if (priv->fw_mutex_owner != current) { - int rc; - - mutex_lock(&priv->fw_mutex); - ieee80211_stop_queues(hw); - - rc = mwl8k_tx_wait_empty(hw); - if (rc) { - if (!priv->hw_restart_in_progress) - ieee80211_wake_queues(hw); - - mutex_unlock(&priv->fw_mutex); - - return rc; - } - - priv->fw_mutex_owner = current; - } - - priv->fw_mutex_depth++; - - return 0; -} - -static void mwl8k_fw_unlock(struct ieee80211_hw *hw) -{ - struct mwl8k_priv *priv = hw->priv; - - if (!--priv->fw_mutex_depth) { - if (!priv->hw_restart_in_progress) - ieee80211_wake_queues(hw); - - priv->fw_mutex_owner = NULL; - mutex_unlock(&priv->fw_mutex); - } -} - -static void mwl8k_enable_bsses(struct ieee80211_hw *hw, bool enable, - u32 bitmap); - -/* - * Command processing. - */ - -/* Timeout firmware commands after 10s */ -#define MWL8K_CMD_TIMEOUT_MS 10000 - -static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd) -{ - DECLARE_COMPLETION_ONSTACK(cmd_wait); - struct mwl8k_priv *priv = hw->priv; - void __iomem *regs = priv->regs; - dma_addr_t dma_addr; - unsigned int dma_size; - int rc; - unsigned long timeout = 0; - u8 buf[32]; - u32 bitmap = 0; - - wiphy_dbg(hw->wiphy, "Posting %s [%d]\n", - mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), cmd->macid); - - /* Before posting firmware commands that could change the hardware - * characteristics, make sure that all BSSes are stopped temporary. - * Enable these stopped BSSes after completion of the commands - */ - - rc = mwl8k_fw_lock(hw); - if (rc) - return rc; - - if (priv->ap_fw && priv->running_bsses) { - switch (le16_to_cpu(cmd->code)) { - case MWL8K_CMD_SET_RF_CHANNEL: - case MWL8K_CMD_RADIO_CONTROL: - case MWL8K_CMD_RF_TX_POWER: - case MWL8K_CMD_TX_POWER: - case MWL8K_CMD_RF_ANTENNA: - case MWL8K_CMD_RTS_THRESHOLD: - case MWL8K_CMD_MIMO_CONFIG: - bitmap = priv->running_bsses; - mwl8k_enable_bsses(hw, false, bitmap); - break; - } - } - - cmd->result = (__force __le16) 0xffff; - dma_size = le16_to_cpu(cmd->length); - dma_addr = pci_map_single(priv->pdev, cmd, dma_size, - PCI_DMA_BIDIRECTIONAL); - if (pci_dma_mapping_error(priv->pdev, dma_addr)) - return -ENOMEM; - - priv->hostcmd_wait = &cmd_wait; - iowrite32(dma_addr, regs + MWL8K_HIU_GEN_PTR); - iowrite32(MWL8K_H2A_INT_DOORBELL, - regs + MWL8K_HIU_H2A_INTERRUPT_EVENTS); - iowrite32(MWL8K_H2A_INT_DUMMY, - regs + MWL8K_HIU_H2A_INTERRUPT_EVENTS); - - timeout = wait_for_completion_timeout(&cmd_wait, - msecs_to_jiffies(MWL8K_CMD_TIMEOUT_MS)); - - priv->hostcmd_wait = NULL; - - - pci_unmap_single(priv->pdev, dma_addr, dma_size, - PCI_DMA_BIDIRECTIONAL); - - if (!timeout) { - wiphy_err(hw->wiphy, "Command %s timeout after %u ms\n", - mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), - MWL8K_CMD_TIMEOUT_MS); - rc = -ETIMEDOUT; - } else { - int ms; - - ms = MWL8K_CMD_TIMEOUT_MS - jiffies_to_msecs(timeout); - - rc = cmd->result ? -EINVAL : 0; - if (rc) - wiphy_err(hw->wiphy, "Command %s error 0x%x\n", - mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), - le16_to_cpu(cmd->result)); - else if (ms > 2000) - wiphy_notice(hw->wiphy, "Command %s took %d ms\n", - mwl8k_cmd_name(cmd->code, - buf, sizeof(buf)), - ms); - } - - if (bitmap) - mwl8k_enable_bsses(hw, true, bitmap); - - mwl8k_fw_unlock(hw); - - return rc; -} - -static int mwl8k_post_pervif_cmd(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct mwl8k_cmd_pkt *cmd) -{ - if (vif != NULL) - cmd->macid = MWL8K_VIF(vif)->macid; - return mwl8k_post_cmd(hw, cmd); -} - -/* - * Setup code shared between STA and AP firmware images. - */ -static void mwl8k_setup_2ghz_band(struct ieee80211_hw *hw) -{ - struct mwl8k_priv *priv = hw->priv; - - BUILD_BUG_ON(sizeof(priv->channels_24) != sizeof(mwl8k_channels_24)); - memcpy(priv->channels_24, mwl8k_channels_24, sizeof(mwl8k_channels_24)); - - BUILD_BUG_ON(sizeof(priv->rates_24) != sizeof(mwl8k_rates_24)); - memcpy(priv->rates_24, mwl8k_rates_24, sizeof(mwl8k_rates_24)); - - priv->band_24.band = IEEE80211_BAND_2GHZ; - priv->band_24.channels = priv->channels_24; - priv->band_24.n_channels = ARRAY_SIZE(mwl8k_channels_24); - priv->band_24.bitrates = priv->rates_24; - priv->band_24.n_bitrates = ARRAY_SIZE(mwl8k_rates_24); - - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band_24; -} - -static void mwl8k_setup_5ghz_band(struct ieee80211_hw *hw) -{ - struct mwl8k_priv *priv = hw->priv; - - BUILD_BUG_ON(sizeof(priv->channels_50) != sizeof(mwl8k_channels_50)); - memcpy(priv->channels_50, mwl8k_channels_50, sizeof(mwl8k_channels_50)); - - BUILD_BUG_ON(sizeof(priv->rates_50) != sizeof(mwl8k_rates_50)); - memcpy(priv->rates_50, mwl8k_rates_50, sizeof(mwl8k_rates_50)); - - priv->band_50.band = IEEE80211_BAND_5GHZ; - priv->band_50.channels = priv->channels_50; - priv->band_50.n_channels = ARRAY_SIZE(mwl8k_channels_50); - priv->band_50.bitrates = priv->rates_50; - priv->band_50.n_bitrates = ARRAY_SIZE(mwl8k_rates_50); - - hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &priv->band_50; -} - -/* - * CMD_GET_HW_SPEC (STA version). - */ -struct mwl8k_cmd_get_hw_spec_sta { - struct mwl8k_cmd_pkt header; - __u8 hw_rev; - __u8 host_interface; - __le16 num_mcaddrs; - __u8 perm_addr[ETH_ALEN]; - __le16 region_code; - __le32 fw_rev; - __le32 ps_cookie; - __le32 caps; - __u8 mcs_bitmap[16]; - __le32 rx_queue_ptr; - __le32 num_tx_queues; - __le32 tx_queue_ptrs[MWL8K_TX_WMM_QUEUES]; - __le32 caps2; - __le32 num_tx_desc_per_queue; - __le32 total_rxd; -} __packed; - -#define MWL8K_CAP_MAX_AMSDU 0x20000000 -#define MWL8K_CAP_GREENFIELD 0x08000000 -#define MWL8K_CAP_AMPDU 0x04000000 -#define MWL8K_CAP_RX_STBC 0x01000000 -#define MWL8K_CAP_TX_STBC 0x00800000 -#define MWL8K_CAP_SHORTGI_40MHZ 0x00400000 -#define MWL8K_CAP_SHORTGI_20MHZ 0x00200000 -#define MWL8K_CAP_RX_ANTENNA_MASK 0x000e0000 -#define MWL8K_CAP_TX_ANTENNA_MASK 0x0001c000 -#define MWL8K_CAP_DELAY_BA 0x00003000 -#define MWL8K_CAP_MIMO 0x00000200 -#define MWL8K_CAP_40MHZ 0x00000100 -#define MWL8K_CAP_BAND_MASK 0x00000007 -#define MWL8K_CAP_5GHZ 0x00000004 -#define MWL8K_CAP_2GHZ4 0x00000001 - -static void -mwl8k_set_ht_caps(struct ieee80211_hw *hw, - struct ieee80211_supported_band *band, u32 cap) -{ - int rx_streams; - int tx_streams; - - band->ht_cap.ht_supported = 1; - - if (cap & MWL8K_CAP_MAX_AMSDU) - band->ht_cap.cap |= IEEE80211_HT_CAP_MAX_AMSDU; - if (cap & MWL8K_CAP_GREENFIELD) - band->ht_cap.cap |= IEEE80211_HT_CAP_GRN_FLD; - if (cap & MWL8K_CAP_AMPDU) { - hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION; - band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; - band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE; - } - if (cap & MWL8K_CAP_RX_STBC) - band->ht_cap.cap |= IEEE80211_HT_CAP_RX_STBC; - if (cap & MWL8K_CAP_TX_STBC) - band->ht_cap.cap |= IEEE80211_HT_CAP_TX_STBC; - if (cap & MWL8K_CAP_SHORTGI_40MHZ) - band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40; - if (cap & MWL8K_CAP_SHORTGI_20MHZ) - band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20; - if (cap & MWL8K_CAP_DELAY_BA) - band->ht_cap.cap |= IEEE80211_HT_CAP_DELAY_BA; - if (cap & MWL8K_CAP_40MHZ) - band->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; - - rx_streams = hweight32(cap & MWL8K_CAP_RX_ANTENNA_MASK); - tx_streams = hweight32(cap & MWL8K_CAP_TX_ANTENNA_MASK); - - band->ht_cap.mcs.rx_mask[0] = 0xff; - if (rx_streams >= 2) - band->ht_cap.mcs.rx_mask[1] = 0xff; - if (rx_streams >= 3) - band->ht_cap.mcs.rx_mask[2] = 0xff; - band->ht_cap.mcs.rx_mask[4] = 0x01; - band->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; - - if (rx_streams != tx_streams) { - band->ht_cap.mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF; - band->ht_cap.mcs.tx_params |= (tx_streams - 1) << - IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT; - } -} - -static void -mwl8k_set_caps(struct ieee80211_hw *hw, u32 caps) -{ - struct mwl8k_priv *priv = hw->priv; - - if (priv->caps) - return; - - if ((caps & MWL8K_CAP_2GHZ4) || !(caps & MWL8K_CAP_BAND_MASK)) { - mwl8k_setup_2ghz_band(hw); - if (caps & MWL8K_CAP_MIMO) - mwl8k_set_ht_caps(hw, &priv->band_24, caps); - } - - if (caps & MWL8K_CAP_5GHZ) { - mwl8k_setup_5ghz_band(hw); - if (caps & MWL8K_CAP_MIMO) - mwl8k_set_ht_caps(hw, &priv->band_50, caps); - } - - priv->caps = caps; -} - -static int mwl8k_cmd_get_hw_spec_sta(struct ieee80211_hw *hw) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_cmd_get_hw_spec_sta *cmd; - int rc; - int i; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_GET_HW_SPEC); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - - memset(cmd->perm_addr, 0xff, sizeof(cmd->perm_addr)); - cmd->ps_cookie = cpu_to_le32(priv->cookie_dma); - cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rxd_dma); - cmd->num_tx_queues = cpu_to_le32(mwl8k_tx_queues(priv)); - for (i = 0; i < mwl8k_tx_queues(priv); i++) - cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[i].txd_dma); - cmd->num_tx_desc_per_queue = cpu_to_le32(MWL8K_TX_DESCS); - cmd->total_rxd = cpu_to_le32(MWL8K_RX_DESCS); - - rc = mwl8k_post_cmd(hw, &cmd->header); - - if (!rc) { - SET_IEEE80211_PERM_ADDR(hw, cmd->perm_addr); - priv->num_mcaddrs = le16_to_cpu(cmd->num_mcaddrs); - priv->fw_rev = le32_to_cpu(cmd->fw_rev); - priv->hw_rev = cmd->hw_rev; - mwl8k_set_caps(hw, le32_to_cpu(cmd->caps)); - priv->ap_macids_supported = 0x00000000; - priv->sta_macids_supported = 0x00000001; - } - - kfree(cmd); - return rc; -} - -/* - * CMD_GET_HW_SPEC (AP version). - */ -struct mwl8k_cmd_get_hw_spec_ap { - struct mwl8k_cmd_pkt header; - __u8 hw_rev; - __u8 host_interface; - __le16 num_wcb; - __le16 num_mcaddrs; - __u8 perm_addr[ETH_ALEN]; - __le16 region_code; - __le16 num_antenna; - __le32 fw_rev; - __le32 wcbbase0; - __le32 rxwrptr; - __le32 rxrdptr; - __le32 ps_cookie; - __le32 wcbbase1; - __le32 wcbbase2; - __le32 wcbbase3; - __le32 fw_api_version; - __le32 caps; - __le32 num_of_ampdu_queues; - __le32 wcbbase_ampdu[MWL8K_MAX_AMPDU_QUEUES]; -} __packed; - -static int mwl8k_cmd_get_hw_spec_ap(struct ieee80211_hw *hw) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_cmd_get_hw_spec_ap *cmd; - int rc, i; - u32 api_version; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_GET_HW_SPEC); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - - memset(cmd->perm_addr, 0xff, sizeof(cmd->perm_addr)); - cmd->ps_cookie = cpu_to_le32(priv->cookie_dma); - - rc = mwl8k_post_cmd(hw, &cmd->header); - - if (!rc) { - int off; - - api_version = le32_to_cpu(cmd->fw_api_version); - if (priv->device_info->fw_api_ap != api_version) { - printk(KERN_ERR "%s: Unsupported fw API version for %s." - " Expected %d got %d.\n", MWL8K_NAME, - priv->device_info->part_name, - priv->device_info->fw_api_ap, - api_version); - rc = -EINVAL; - goto done; - } - SET_IEEE80211_PERM_ADDR(hw, cmd->perm_addr); - priv->num_mcaddrs = le16_to_cpu(cmd->num_mcaddrs); - priv->fw_rev = le32_to_cpu(cmd->fw_rev); - priv->hw_rev = cmd->hw_rev; - mwl8k_set_caps(hw, le32_to_cpu(cmd->caps)); - priv->ap_macids_supported = 0x000000ff; - priv->sta_macids_supported = 0x00000100; - priv->num_ampdu_queues = le32_to_cpu(cmd->num_of_ampdu_queues); - if (priv->num_ampdu_queues > MWL8K_MAX_AMPDU_QUEUES) { - wiphy_warn(hw->wiphy, "fw reported %d ampdu queues" - " but we only support %d.\n", - priv->num_ampdu_queues, - MWL8K_MAX_AMPDU_QUEUES); - priv->num_ampdu_queues = MWL8K_MAX_AMPDU_QUEUES; - } - off = le32_to_cpu(cmd->rxwrptr) & 0xffff; - iowrite32(priv->rxq[0].rxd_dma, priv->sram + off); - - off = le32_to_cpu(cmd->rxrdptr) & 0xffff; - iowrite32(priv->rxq[0].rxd_dma, priv->sram + off); - - priv->txq_offset[0] = le32_to_cpu(cmd->wcbbase0) & 0xffff; - priv->txq_offset[1] = le32_to_cpu(cmd->wcbbase1) & 0xffff; - priv->txq_offset[2] = le32_to_cpu(cmd->wcbbase2) & 0xffff; - priv->txq_offset[3] = le32_to_cpu(cmd->wcbbase3) & 0xffff; - - for (i = 0; i < priv->num_ampdu_queues; i++) - priv->txq_offset[i + MWL8K_TX_WMM_QUEUES] = - le32_to_cpu(cmd->wcbbase_ampdu[i]) & 0xffff; - } - -done: - kfree(cmd); - return rc; -} - -/* - * CMD_SET_HW_SPEC. - */ -struct mwl8k_cmd_set_hw_spec { - struct mwl8k_cmd_pkt header; - __u8 hw_rev; - __u8 host_interface; - __le16 num_mcaddrs; - __u8 perm_addr[ETH_ALEN]; - __le16 region_code; - __le32 fw_rev; - __le32 ps_cookie; - __le32 caps; - __le32 rx_queue_ptr; - __le32 num_tx_queues; - __le32 tx_queue_ptrs[MWL8K_MAX_TX_QUEUES]; - __le32 flags; - __le32 num_tx_desc_per_queue; - __le32 total_rxd; -} __packed; - -/* If enabled, MWL8K_SET_HW_SPEC_FLAG_ENABLE_LIFE_TIME_EXPIRY will cause - * packets to expire 500 ms after the timestamp in the tx descriptor. That is, - * the packets that are queued for more than 500ms, will be dropped in the - * hardware. This helps minimizing the issues caused due to head-of-line - * blocking where a slow client can hog the bandwidth and affect traffic to a - * faster client. - */ -#define MWL8K_SET_HW_SPEC_FLAG_ENABLE_LIFE_TIME_EXPIRY 0x00000400 -#define MWL8K_SET_HW_SPEC_FLAG_GENERATE_CCMP_HDR 0x00000200 -#define MWL8K_SET_HW_SPEC_FLAG_HOST_DECR_MGMT 0x00000080 -#define MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_PROBERESP 0x00000020 -#define MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_BEACON 0x00000010 - -static int mwl8k_cmd_set_hw_spec(struct ieee80211_hw *hw) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_cmd_set_hw_spec *cmd; - int rc; - int i; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_HW_SPEC); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - - cmd->ps_cookie = cpu_to_le32(priv->cookie_dma); - cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rxd_dma); - cmd->num_tx_queues = cpu_to_le32(mwl8k_tx_queues(priv)); - - /* - * Mac80211 stack has Q0 as highest priority and Q3 as lowest in - * that order. Firmware has Q3 as highest priority and Q0 as lowest - * in that order. Map Q3 of mac80211 to Q0 of firmware so that the - * priority is interpreted the right way in firmware. - */ - for (i = 0; i < mwl8k_tx_queues(priv); i++) { - int j = mwl8k_tx_queues(priv) - 1 - i; - cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[j].txd_dma); - } - - cmd->flags = cpu_to_le32(MWL8K_SET_HW_SPEC_FLAG_HOST_DECR_MGMT | - MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_PROBERESP | - MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_BEACON | - MWL8K_SET_HW_SPEC_FLAG_ENABLE_LIFE_TIME_EXPIRY | - MWL8K_SET_HW_SPEC_FLAG_GENERATE_CCMP_HDR); - cmd->num_tx_desc_per_queue = cpu_to_le32(MWL8K_TX_DESCS); - cmd->total_rxd = cpu_to_le32(MWL8K_RX_DESCS); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_MAC_MULTICAST_ADR. - */ -struct mwl8k_cmd_mac_multicast_adr { - struct mwl8k_cmd_pkt header; - __le16 action; - __le16 numaddr; - __u8 addr[0][ETH_ALEN]; -}; - -#define MWL8K_ENABLE_RX_DIRECTED 0x0001 -#define MWL8K_ENABLE_RX_MULTICAST 0x0002 -#define MWL8K_ENABLE_RX_ALL_MULTICAST 0x0004 -#define MWL8K_ENABLE_RX_BROADCAST 0x0008 - -static struct mwl8k_cmd_pkt * -__mwl8k_cmd_mac_multicast_adr(struct ieee80211_hw *hw, int allmulti, - struct netdev_hw_addr_list *mc_list) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_cmd_mac_multicast_adr *cmd; - int size; - int mc_count = 0; - - if (mc_list) - mc_count = netdev_hw_addr_list_count(mc_list); - - if (allmulti || mc_count > priv->num_mcaddrs) { - allmulti = 1; - mc_count = 0; - } - - size = sizeof(*cmd) + mc_count * ETH_ALEN; - - cmd = kzalloc(size, GFP_ATOMIC); - if (cmd == NULL) - return NULL; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_MAC_MULTICAST_ADR); - cmd->header.length = cpu_to_le16(size); - cmd->action = cpu_to_le16(MWL8K_ENABLE_RX_DIRECTED | - MWL8K_ENABLE_RX_BROADCAST); - - if (allmulti) { - cmd->action |= cpu_to_le16(MWL8K_ENABLE_RX_ALL_MULTICAST); - } else if (mc_count) { - struct netdev_hw_addr *ha; - int i = 0; - - cmd->action |= cpu_to_le16(MWL8K_ENABLE_RX_MULTICAST); - cmd->numaddr = cpu_to_le16(mc_count); - netdev_hw_addr_list_for_each(ha, mc_list) { - memcpy(cmd->addr[i], ha->addr, ETH_ALEN); - } - } - - return &cmd->header; -} - -/* - * CMD_GET_STAT. - */ -struct mwl8k_cmd_get_stat { - struct mwl8k_cmd_pkt header; - __le32 stats[64]; -} __packed; - -#define MWL8K_STAT_ACK_FAILURE 9 -#define MWL8K_STAT_RTS_FAILURE 12 -#define MWL8K_STAT_FCS_ERROR 24 -#define MWL8K_STAT_RTS_SUCCESS 11 - -static int mwl8k_cmd_get_stat(struct ieee80211_hw *hw, - struct ieee80211_low_level_stats *stats) -{ - struct mwl8k_cmd_get_stat *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_GET_STAT); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - - rc = mwl8k_post_cmd(hw, &cmd->header); - if (!rc) { - stats->dot11ACKFailureCount = - le32_to_cpu(cmd->stats[MWL8K_STAT_ACK_FAILURE]); - stats->dot11RTSFailureCount = - le32_to_cpu(cmd->stats[MWL8K_STAT_RTS_FAILURE]); - stats->dot11FCSErrorCount = - le32_to_cpu(cmd->stats[MWL8K_STAT_FCS_ERROR]); - stats->dot11RTSSuccessCount = - le32_to_cpu(cmd->stats[MWL8K_STAT_RTS_SUCCESS]); - } - kfree(cmd); - - return rc; -} - -/* - * CMD_RADIO_CONTROL. - */ -struct mwl8k_cmd_radio_control { - struct mwl8k_cmd_pkt header; - __le16 action; - __le16 control; - __le16 radio_on; -} __packed; - -static int -mwl8k_cmd_radio_control(struct ieee80211_hw *hw, bool enable, bool force) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_cmd_radio_control *cmd; - int rc; - - if (enable == priv->radio_on && !force) - return 0; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_RADIO_CONTROL); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le16(MWL8K_CMD_SET); - cmd->control = cpu_to_le16(priv->radio_short_preamble ? 3 : 1); - cmd->radio_on = cpu_to_le16(enable ? 0x0001 : 0x0000); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - if (!rc) - priv->radio_on = enable; - - return rc; -} - -static int mwl8k_cmd_radio_disable(struct ieee80211_hw *hw) -{ - return mwl8k_cmd_radio_control(hw, 0, 0); -} - -static int mwl8k_cmd_radio_enable(struct ieee80211_hw *hw) -{ - return mwl8k_cmd_radio_control(hw, 1, 0); -} - -static int -mwl8k_set_radio_preamble(struct ieee80211_hw *hw, bool short_preamble) -{ - struct mwl8k_priv *priv = hw->priv; - - priv->radio_short_preamble = short_preamble; - - return mwl8k_cmd_radio_control(hw, 1, 1); -} - -/* - * CMD_RF_TX_POWER. - */ -#define MWL8K_RF_TX_POWER_LEVEL_TOTAL 8 - -struct mwl8k_cmd_rf_tx_power { - struct mwl8k_cmd_pkt header; - __le16 action; - __le16 support_level; - __le16 current_level; - __le16 reserved; - __le16 power_level_list[MWL8K_RF_TX_POWER_LEVEL_TOTAL]; -} __packed; - -static int mwl8k_cmd_rf_tx_power(struct ieee80211_hw *hw, int dBm) -{ - struct mwl8k_cmd_rf_tx_power *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_RF_TX_POWER); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le16(MWL8K_CMD_SET); - cmd->support_level = cpu_to_le16(dBm); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_TX_POWER. - */ -#define MWL8K_TX_POWER_LEVEL_TOTAL 12 - -struct mwl8k_cmd_tx_power { - struct mwl8k_cmd_pkt header; - __le16 action; - __le16 band; - __le16 channel; - __le16 bw; - __le16 sub_ch; - __le16 power_level_list[MWL8K_TX_POWER_LEVEL_TOTAL]; -} __packed; - -static int mwl8k_cmd_tx_power(struct ieee80211_hw *hw, - struct ieee80211_conf *conf, - unsigned short pwr) -{ - struct ieee80211_channel *channel = conf->chandef.chan; - enum nl80211_channel_type channel_type = - cfg80211_get_chandef_type(&conf->chandef); - struct mwl8k_cmd_tx_power *cmd; - int rc; - int i; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_TX_POWER); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le16(MWL8K_CMD_SET_LIST); - - if (channel->band == IEEE80211_BAND_2GHZ) - cmd->band = cpu_to_le16(0x1); - else if (channel->band == IEEE80211_BAND_5GHZ) - cmd->band = cpu_to_le16(0x4); - - cmd->channel = cpu_to_le16(channel->hw_value); - - if (channel_type == NL80211_CHAN_NO_HT || - channel_type == NL80211_CHAN_HT20) { - cmd->bw = cpu_to_le16(0x2); - } else { - cmd->bw = cpu_to_le16(0x4); - if (channel_type == NL80211_CHAN_HT40MINUS) - cmd->sub_ch = cpu_to_le16(0x3); - else if (channel_type == NL80211_CHAN_HT40PLUS) - cmd->sub_ch = cpu_to_le16(0x1); - } - - for (i = 0; i < MWL8K_TX_POWER_LEVEL_TOTAL; i++) - cmd->power_level_list[i] = cpu_to_le16(pwr); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_RF_ANTENNA. - */ -struct mwl8k_cmd_rf_antenna { - struct mwl8k_cmd_pkt header; - __le16 antenna; - __le16 mode; -} __packed; - -#define MWL8K_RF_ANTENNA_RX 1 -#define MWL8K_RF_ANTENNA_TX 2 - -static int -mwl8k_cmd_rf_antenna(struct ieee80211_hw *hw, int antenna, int mask) -{ - struct mwl8k_cmd_rf_antenna *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_RF_ANTENNA); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->antenna = cpu_to_le16(antenna); - cmd->mode = cpu_to_le16(mask); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_SET_BEACON. - */ -struct mwl8k_cmd_set_beacon { - struct mwl8k_cmd_pkt header; - __le16 beacon_len; - __u8 beacon[0]; -}; - -static int mwl8k_cmd_set_beacon(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u8 *beacon, int len) -{ - struct mwl8k_cmd_set_beacon *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd) + len, GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_BEACON); - cmd->header.length = cpu_to_le16(sizeof(*cmd) + len); - cmd->beacon_len = cpu_to_le16(len); - memcpy(cmd->beacon, beacon, len); - - rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_SET_PRE_SCAN. - */ -struct mwl8k_cmd_set_pre_scan { - struct mwl8k_cmd_pkt header; -} __packed; - -static int mwl8k_cmd_set_pre_scan(struct ieee80211_hw *hw) -{ - struct mwl8k_cmd_set_pre_scan *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_PRE_SCAN); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_SET_POST_SCAN. - */ -struct mwl8k_cmd_set_post_scan { - struct mwl8k_cmd_pkt header; - __le32 isibss; - __u8 bssid[ETH_ALEN]; -} __packed; - -static int -mwl8k_cmd_set_post_scan(struct ieee80211_hw *hw, const __u8 *mac) -{ - struct mwl8k_cmd_set_post_scan *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_POST_SCAN); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->isibss = 0; - memcpy(cmd->bssid, mac, ETH_ALEN); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_SET_RF_CHANNEL. - */ -struct mwl8k_cmd_set_rf_channel { - struct mwl8k_cmd_pkt header; - __le16 action; - __u8 current_channel; - __le32 channel_flags; -} __packed; - -static int mwl8k_cmd_set_rf_channel(struct ieee80211_hw *hw, - struct ieee80211_conf *conf) -{ - struct ieee80211_channel *channel = conf->chandef.chan; - enum nl80211_channel_type channel_type = - cfg80211_get_chandef_type(&conf->chandef); - struct mwl8k_cmd_set_rf_channel *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_RF_CHANNEL); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le16(MWL8K_CMD_SET); - cmd->current_channel = channel->hw_value; - - if (channel->band == IEEE80211_BAND_2GHZ) - cmd->channel_flags |= cpu_to_le32(0x00000001); - else if (channel->band == IEEE80211_BAND_5GHZ) - cmd->channel_flags |= cpu_to_le32(0x00000004); - - if (channel_type == NL80211_CHAN_NO_HT || - channel_type == NL80211_CHAN_HT20) - cmd->channel_flags |= cpu_to_le32(0x00000080); - else if (channel_type == NL80211_CHAN_HT40MINUS) - cmd->channel_flags |= cpu_to_le32(0x000001900); - else if (channel_type == NL80211_CHAN_HT40PLUS) - cmd->channel_flags |= cpu_to_le32(0x000000900); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_SET_AID. - */ -#define MWL8K_FRAME_PROT_DISABLED 0x00 -#define MWL8K_FRAME_PROT_11G 0x07 -#define MWL8K_FRAME_PROT_11N_HT_40MHZ_ONLY 0x02 -#define MWL8K_FRAME_PROT_11N_HT_ALL 0x06 - -struct mwl8k_cmd_update_set_aid { - struct mwl8k_cmd_pkt header; - __le16 aid; - - /* AP's MAC address (BSSID) */ - __u8 bssid[ETH_ALEN]; - __le16 protection_mode; - __u8 supp_rates[14]; -} __packed; - -static void legacy_rate_mask_to_array(u8 *rates, u32 mask) -{ - int i; - int j; - - /* - * Clear nonstandard rate 4. - */ - mask &= 0x1fef; - - for (i = 0, j = 0; i < 13; i++) { - if (mask & (1 << i)) - rates[j++] = mwl8k_rates_24[i].hw_value; - } -} - -static int -mwl8k_cmd_set_aid(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u32 legacy_rate_mask) -{ - struct mwl8k_cmd_update_set_aid *cmd; - u16 prot_mode; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_AID); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->aid = cpu_to_le16(vif->bss_conf.aid); - memcpy(cmd->bssid, vif->bss_conf.bssid, ETH_ALEN); - - if (vif->bss_conf.use_cts_prot) { - prot_mode = MWL8K_FRAME_PROT_11G; - } else { - switch (vif->bss_conf.ht_operation_mode & - IEEE80211_HT_OP_MODE_PROTECTION) { - case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: - prot_mode = MWL8K_FRAME_PROT_11N_HT_40MHZ_ONLY; - break; - case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: - prot_mode = MWL8K_FRAME_PROT_11N_HT_ALL; - break; - default: - prot_mode = MWL8K_FRAME_PROT_DISABLED; - break; - } - } - cmd->protection_mode = cpu_to_le16(prot_mode); - - legacy_rate_mask_to_array(cmd->supp_rates, legacy_rate_mask); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_SET_RATE. - */ -struct mwl8k_cmd_set_rate { - struct mwl8k_cmd_pkt header; - __u8 legacy_rates[14]; - - /* Bitmap for supported MCS codes. */ - __u8 mcs_set[16]; - __u8 reserved[16]; -} __packed; - -static int -mwl8k_cmd_set_rate(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - u32 legacy_rate_mask, u8 *mcs_rates) -{ - struct mwl8k_cmd_set_rate *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_RATE); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - legacy_rate_mask_to_array(cmd->legacy_rates, legacy_rate_mask); - memcpy(cmd->mcs_set, mcs_rates, 16); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_FINALIZE_JOIN. - */ -#define MWL8K_FJ_BEACON_MAXLEN 128 - -struct mwl8k_cmd_finalize_join { - struct mwl8k_cmd_pkt header; - __le32 sleep_interval; /* Number of beacon periods to sleep */ - __u8 beacon_data[MWL8K_FJ_BEACON_MAXLEN]; -} __packed; - -static int mwl8k_cmd_finalize_join(struct ieee80211_hw *hw, void *frame, - int framelen, int dtim) -{ - struct mwl8k_cmd_finalize_join *cmd; - struct ieee80211_mgmt *payload = frame; - int payload_len; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_FINALIZE_JOIN); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->sleep_interval = cpu_to_le32(dtim ? dtim : 1); - - payload_len = framelen - ieee80211_hdrlen(payload->frame_control); - if (payload_len < 0) - payload_len = 0; - else if (payload_len > MWL8K_FJ_BEACON_MAXLEN) - payload_len = MWL8K_FJ_BEACON_MAXLEN; - - memcpy(cmd->beacon_data, &payload->u.beacon, payload_len); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_SET_RTS_THRESHOLD. - */ -struct mwl8k_cmd_set_rts_threshold { - struct mwl8k_cmd_pkt header; - __le16 action; - __le16 threshold; -} __packed; - -static int -mwl8k_cmd_set_rts_threshold(struct ieee80211_hw *hw, int rts_thresh) -{ - struct mwl8k_cmd_set_rts_threshold *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_RTS_THRESHOLD); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le16(MWL8K_CMD_SET); - cmd->threshold = cpu_to_le16(rts_thresh); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_SET_SLOT. - */ -struct mwl8k_cmd_set_slot { - struct mwl8k_cmd_pkt header; - __le16 action; - __u8 short_slot; -} __packed; - -static int mwl8k_cmd_set_slot(struct ieee80211_hw *hw, bool short_slot_time) -{ - struct mwl8k_cmd_set_slot *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_SLOT); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le16(MWL8K_CMD_SET); - cmd->short_slot = short_slot_time; - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_SET_EDCA_PARAMS. - */ -struct mwl8k_cmd_set_edca_params { - struct mwl8k_cmd_pkt header; - - /* See MWL8K_SET_EDCA_XXX below */ - __le16 action; - - /* TX opportunity in units of 32 us */ - __le16 txop; - - union { - struct { - /* Log exponent of max contention period: 0...15 */ - __le32 log_cw_max; - - /* Log exponent of min contention period: 0...15 */ - __le32 log_cw_min; - - /* Adaptive interframe spacing in units of 32us */ - __u8 aifs; - - /* TX queue to configure */ - __u8 txq; - } ap; - struct { - /* Log exponent of max contention period: 0...15 */ - __u8 log_cw_max; - - /* Log exponent of min contention period: 0...15 */ - __u8 log_cw_min; - - /* Adaptive interframe spacing in units of 32us */ - __u8 aifs; - - /* TX queue to configure */ - __u8 txq; - } sta; - }; -} __packed; - -#define MWL8K_SET_EDCA_CW 0x01 -#define MWL8K_SET_EDCA_TXOP 0x02 -#define MWL8K_SET_EDCA_AIFS 0x04 - -#define MWL8K_SET_EDCA_ALL (MWL8K_SET_EDCA_CW | \ - MWL8K_SET_EDCA_TXOP | \ - MWL8K_SET_EDCA_AIFS) - -static int -mwl8k_cmd_set_edca_params(struct ieee80211_hw *hw, __u8 qnum, - __u16 cw_min, __u16 cw_max, - __u8 aifs, __u16 txop) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_cmd_set_edca_params *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_EDCA_PARAMS); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le16(MWL8K_SET_EDCA_ALL); - cmd->txop = cpu_to_le16(txop); - if (priv->ap_fw) { - cmd->ap.log_cw_max = cpu_to_le32(ilog2(cw_max + 1)); - cmd->ap.log_cw_min = cpu_to_le32(ilog2(cw_min + 1)); - cmd->ap.aifs = aifs; - cmd->ap.txq = qnum; - } else { - cmd->sta.log_cw_max = (u8)ilog2(cw_max + 1); - cmd->sta.log_cw_min = (u8)ilog2(cw_min + 1); - cmd->sta.aifs = aifs; - cmd->sta.txq = qnum; - } - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_SET_WMM_MODE. - */ -struct mwl8k_cmd_set_wmm_mode { - struct mwl8k_cmd_pkt header; - __le16 action; -} __packed; - -static int mwl8k_cmd_set_wmm_mode(struct ieee80211_hw *hw, bool enable) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_cmd_set_wmm_mode *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_WMM_MODE); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le16(!!enable); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - if (!rc) - priv->wmm_enabled = enable; - - return rc; -} - -/* - * CMD_MIMO_CONFIG. - */ -struct mwl8k_cmd_mimo_config { - struct mwl8k_cmd_pkt header; - __le32 action; - __u8 rx_antenna_map; - __u8 tx_antenna_map; -} __packed; - -static int mwl8k_cmd_mimo_config(struct ieee80211_hw *hw, __u8 rx, __u8 tx) -{ - struct mwl8k_cmd_mimo_config *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_MIMO_CONFIG); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le32((u32)MWL8K_CMD_SET); - cmd->rx_antenna_map = rx; - cmd->tx_antenna_map = tx; - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_USE_FIXED_RATE (STA version). - */ -struct mwl8k_cmd_use_fixed_rate_sta { - struct mwl8k_cmd_pkt header; - __le32 action; - __le32 allow_rate_drop; - __le32 num_rates; - struct { - __le32 is_ht_rate; - __le32 enable_retry; - __le32 rate; - __le32 retry_count; - } rate_entry[8]; - __le32 rate_type; - __le32 reserved1; - __le32 reserved2; -} __packed; - -#define MWL8K_USE_AUTO_RATE 0x0002 -#define MWL8K_UCAST_RATE 0 - -static int mwl8k_cmd_use_fixed_rate_sta(struct ieee80211_hw *hw) -{ - struct mwl8k_cmd_use_fixed_rate_sta *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_USE_FIXED_RATE); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le32(MWL8K_USE_AUTO_RATE); - cmd->rate_type = cpu_to_le32(MWL8K_UCAST_RATE); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_USE_FIXED_RATE (AP version). - */ -struct mwl8k_cmd_use_fixed_rate_ap { - struct mwl8k_cmd_pkt header; - __le32 action; - __le32 allow_rate_drop; - __le32 num_rates; - struct mwl8k_rate_entry_ap { - __le32 is_ht_rate; - __le32 enable_retry; - __le32 rate; - __le32 retry_count; - } rate_entry[4]; - u8 multicast_rate; - u8 multicast_rate_type; - u8 management_rate; -} __packed; - -static int -mwl8k_cmd_use_fixed_rate_ap(struct ieee80211_hw *hw, int mcast, int mgmt) -{ - struct mwl8k_cmd_use_fixed_rate_ap *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_USE_FIXED_RATE); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le32(MWL8K_USE_AUTO_RATE); - cmd->multicast_rate = mcast; - cmd->management_rate = mgmt; - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_ENABLE_SNIFFER. - */ -struct mwl8k_cmd_enable_sniffer { - struct mwl8k_cmd_pkt header; - __le32 action; -} __packed; - -static int mwl8k_cmd_enable_sniffer(struct ieee80211_hw *hw, bool enable) -{ - struct mwl8k_cmd_enable_sniffer *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_ENABLE_SNIFFER); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le32(!!enable); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -struct mwl8k_cmd_update_mac_addr { - struct mwl8k_cmd_pkt header; - union { - struct { - __le16 mac_type; - __u8 mac_addr[ETH_ALEN]; - } mbss; - __u8 mac_addr[ETH_ALEN]; - }; -} __packed; - -#define MWL8K_MAC_TYPE_PRIMARY_CLIENT 0 -#define MWL8K_MAC_TYPE_SECONDARY_CLIENT 1 -#define MWL8K_MAC_TYPE_PRIMARY_AP 2 -#define MWL8K_MAC_TYPE_SECONDARY_AP 3 - -static int mwl8k_cmd_update_mac_addr(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u8 *mac, bool set) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_vif *mwl8k_vif = MWL8K_VIF(vif); - struct mwl8k_cmd_update_mac_addr *cmd; - int mac_type; - int rc; - - mac_type = MWL8K_MAC_TYPE_PRIMARY_AP; - if (vif != NULL && vif->type == NL80211_IFTYPE_STATION) { - if (mwl8k_vif->macid + 1 == ffs(priv->sta_macids_supported)) - if (priv->ap_fw) - mac_type = MWL8K_MAC_TYPE_SECONDARY_CLIENT; - else - mac_type = MWL8K_MAC_TYPE_PRIMARY_CLIENT; - else - mac_type = MWL8K_MAC_TYPE_SECONDARY_CLIENT; - } else if (vif != NULL && vif->type == NL80211_IFTYPE_AP) { - if (mwl8k_vif->macid + 1 == ffs(priv->ap_macids_supported)) - mac_type = MWL8K_MAC_TYPE_PRIMARY_AP; - else - mac_type = MWL8K_MAC_TYPE_SECONDARY_AP; - } - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - if (set) - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_MAC_ADDR); - else - cmd->header.code = cpu_to_le16(MWL8K_CMD_DEL_MAC_ADDR); - - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - if (priv->ap_fw) { - cmd->mbss.mac_type = cpu_to_le16(mac_type); - memcpy(cmd->mbss.mac_addr, mac, ETH_ALEN); - } else { - memcpy(cmd->mac_addr, mac, ETH_ALEN); - } - - rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * MWL8K_CMD_SET_MAC_ADDR. - */ -static inline int mwl8k_cmd_set_mac_addr(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u8 *mac) -{ - return mwl8k_cmd_update_mac_addr(hw, vif, mac, true); -} - -/* - * MWL8K_CMD_DEL_MAC_ADDR. - */ -static inline int mwl8k_cmd_del_mac_addr(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u8 *mac) -{ - return mwl8k_cmd_update_mac_addr(hw, vif, mac, false); -} - -/* - * CMD_SET_RATEADAPT_MODE. - */ -struct mwl8k_cmd_set_rate_adapt_mode { - struct mwl8k_cmd_pkt header; - __le16 action; - __le16 mode; -} __packed; - -static int mwl8k_cmd_set_rateadapt_mode(struct ieee80211_hw *hw, __u16 mode) -{ - struct mwl8k_cmd_set_rate_adapt_mode *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_RATEADAPT_MODE); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le16(MWL8K_CMD_SET); - cmd->mode = cpu_to_le16(mode); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_GET_WATCHDOG_BITMAP. - */ -struct mwl8k_cmd_get_watchdog_bitmap { - struct mwl8k_cmd_pkt header; - u8 bitmap; -} __packed; - -static int mwl8k_cmd_get_watchdog_bitmap(struct ieee80211_hw *hw, u8 *bitmap) -{ - struct mwl8k_cmd_get_watchdog_bitmap *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_GET_WATCHDOG_BITMAP); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - - rc = mwl8k_post_cmd(hw, &cmd->header); - if (!rc) - *bitmap = cmd->bitmap; - - kfree(cmd); - - return rc; -} - -#define MWL8K_WMM_QUEUE_NUMBER 3 - -static void mwl8k_destroy_ba(struct ieee80211_hw *hw, - u8 idx); - -static void mwl8k_watchdog_ba_events(struct work_struct *work) -{ - int rc; - u8 bitmap = 0, stream_index; - struct mwl8k_ampdu_stream *streams; - struct mwl8k_priv *priv = - container_of(work, struct mwl8k_priv, watchdog_ba_handle); - struct ieee80211_hw *hw = priv->hw; - int i; - u32 status = 0; - - mwl8k_fw_lock(hw); - - rc = mwl8k_cmd_get_watchdog_bitmap(priv->hw, &bitmap); - if (rc) - goto done; - - spin_lock(&priv->stream_lock); - - /* the bitmap is the hw queue number. Map it to the ampdu queue. */ - for (i = 0; i < TOTAL_HW_TX_QUEUES; i++) { - if (bitmap & (1 << i)) { - stream_index = (i + MWL8K_WMM_QUEUE_NUMBER) % - TOTAL_HW_TX_QUEUES; - streams = &priv->ampdu[stream_index]; - if (streams->state == AMPDU_STREAM_ACTIVE) { - ieee80211_stop_tx_ba_session(streams->sta, - streams->tid); - spin_unlock(&priv->stream_lock); - mwl8k_destroy_ba(hw, stream_index); - spin_lock(&priv->stream_lock); - } - } - } - - spin_unlock(&priv->stream_lock); -done: - atomic_dec(&priv->watchdog_event_pending); - status = ioread32(priv->regs + MWL8K_HIU_A2H_INTERRUPT_STATUS_MASK); - iowrite32((status | MWL8K_A2H_INT_BA_WATCHDOG), - priv->regs + MWL8K_HIU_A2H_INTERRUPT_STATUS_MASK); - mwl8k_fw_unlock(hw); - return; -} - - -/* - * CMD_BSS_START. - */ -struct mwl8k_cmd_bss_start { - struct mwl8k_cmd_pkt header; - __le32 enable; -} __packed; - -static int mwl8k_cmd_bss_start(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, int enable) -{ - struct mwl8k_cmd_bss_start *cmd; - struct mwl8k_vif *mwl8k_vif = MWL8K_VIF(vif); - struct mwl8k_priv *priv = hw->priv; - int rc; - - if (enable && (priv->running_bsses & (1 << mwl8k_vif->macid))) - return 0; - - if (!enable && !(priv->running_bsses & (1 << mwl8k_vif->macid))) - return 0; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_BSS_START); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->enable = cpu_to_le32(enable); - - rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); - kfree(cmd); - - if (!rc) { - if (enable) - priv->running_bsses |= (1 << mwl8k_vif->macid); - else - priv->running_bsses &= ~(1 << mwl8k_vif->macid); - } - return rc; -} - -static void mwl8k_enable_bsses(struct ieee80211_hw *hw, bool enable, u32 bitmap) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_vif *mwl8k_vif, *tmp_vif; - struct ieee80211_vif *vif; - - list_for_each_entry_safe(mwl8k_vif, tmp_vif, &priv->vif_list, list) { - vif = mwl8k_vif->vif; - - if (!(bitmap & (1 << mwl8k_vif->macid))) - continue; - - if (vif->type == NL80211_IFTYPE_AP) - mwl8k_cmd_bss_start(hw, vif, enable); - } -} -/* - * CMD_BASTREAM. - */ - -/* - * UPSTREAM is tx direction - */ -#define BASTREAM_FLAG_DIRECTION_UPSTREAM 0x00 -#define BASTREAM_FLAG_IMMEDIATE_TYPE 0x01 - -enum ba_stream_action_type { - MWL8K_BA_CREATE, - MWL8K_BA_UPDATE, - MWL8K_BA_DESTROY, - MWL8K_BA_FLUSH, - MWL8K_BA_CHECK, -}; - - -struct mwl8k_create_ba_stream { - __le32 flags; - __le32 idle_thrs; - __le32 bar_thrs; - __le32 window_size; - u8 peer_mac_addr[6]; - u8 dialog_token; - u8 tid; - u8 queue_id; - u8 param_info; - __le32 ba_context; - u8 reset_seq_no_flag; - __le16 curr_seq_no; - u8 sta_src_mac_addr[6]; -} __packed; - -struct mwl8k_destroy_ba_stream { - __le32 flags; - __le32 ba_context; -} __packed; - -struct mwl8k_cmd_bastream { - struct mwl8k_cmd_pkt header; - __le32 action; - union { - struct mwl8k_create_ba_stream create_params; - struct mwl8k_destroy_ba_stream destroy_params; - }; -} __packed; - -static int -mwl8k_check_ba(struct ieee80211_hw *hw, struct mwl8k_ampdu_stream *stream, - struct ieee80211_vif *vif) -{ - struct mwl8k_cmd_bastream *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_BASTREAM); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - - cmd->action = cpu_to_le32(MWL8K_BA_CHECK); - - cmd->create_params.queue_id = stream->idx; - memcpy(&cmd->create_params.peer_mac_addr[0], stream->sta->addr, - ETH_ALEN); - cmd->create_params.tid = stream->tid; - - cmd->create_params.flags = - cpu_to_le32(BASTREAM_FLAG_IMMEDIATE_TYPE) | - cpu_to_le32(BASTREAM_FLAG_DIRECTION_UPSTREAM); - - rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); - - kfree(cmd); - - return rc; -} - -static int -mwl8k_create_ba(struct ieee80211_hw *hw, struct mwl8k_ampdu_stream *stream, - u8 buf_size, struct ieee80211_vif *vif) -{ - struct mwl8k_cmd_bastream *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - - cmd->header.code = cpu_to_le16(MWL8K_CMD_BASTREAM); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - - cmd->action = cpu_to_le32(MWL8K_BA_CREATE); - - cmd->create_params.bar_thrs = cpu_to_le32((u32)buf_size); - cmd->create_params.window_size = cpu_to_le32((u32)buf_size); - cmd->create_params.queue_id = stream->idx; - - memcpy(cmd->create_params.peer_mac_addr, stream->sta->addr, ETH_ALEN); - cmd->create_params.tid = stream->tid; - cmd->create_params.curr_seq_no = cpu_to_le16(0); - cmd->create_params.reset_seq_no_flag = 1; - - cmd->create_params.param_info = - (stream->sta->ht_cap.ampdu_factor & - IEEE80211_HT_AMPDU_PARM_FACTOR) | - ((stream->sta->ht_cap.ampdu_density << 2) & - IEEE80211_HT_AMPDU_PARM_DENSITY); - - cmd->create_params.flags = - cpu_to_le32(BASTREAM_FLAG_IMMEDIATE_TYPE | - BASTREAM_FLAG_DIRECTION_UPSTREAM); - - rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); - - wiphy_debug(hw->wiphy, "Created a BA stream for %pM : tid %d\n", - stream->sta->addr, stream->tid); - kfree(cmd); - - return rc; -} - -static void mwl8k_destroy_ba(struct ieee80211_hw *hw, - u8 idx) -{ - struct mwl8k_cmd_bastream *cmd; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_BASTREAM); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le32(MWL8K_BA_DESTROY); - - cmd->destroy_params.ba_context = cpu_to_le32(idx); - mwl8k_post_cmd(hw, &cmd->header); - - wiphy_debug(hw->wiphy, "Deleted BA stream index %d\n", idx); - - kfree(cmd); -} - -/* - * CMD_SET_NEW_STN. - */ -struct mwl8k_cmd_set_new_stn { - struct mwl8k_cmd_pkt header; - __le16 aid; - __u8 mac_addr[6]; - __le16 stn_id; - __le16 action; - __le16 rsvd; - __le32 legacy_rates; - __u8 ht_rates[4]; - __le16 cap_info; - __le16 ht_capabilities_info; - __u8 mac_ht_param_info; - __u8 rev; - __u8 control_channel; - __u8 add_channel; - __le16 op_mode; - __le16 stbc; - __u8 add_qos_info; - __u8 is_qos_sta; - __le32 fw_sta_ptr; -} __packed; - -#define MWL8K_STA_ACTION_ADD 0 -#define MWL8K_STA_ACTION_REMOVE 2 - -static int mwl8k_cmd_set_new_stn_add(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct mwl8k_cmd_set_new_stn *cmd; - u32 rates; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_NEW_STN); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->aid = cpu_to_le16(sta->aid); - memcpy(cmd->mac_addr, sta->addr, ETH_ALEN); - cmd->stn_id = cpu_to_le16(sta->aid); - cmd->action = cpu_to_le16(MWL8K_STA_ACTION_ADD); - if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) - rates = sta->supp_rates[IEEE80211_BAND_2GHZ]; - else - rates = sta->supp_rates[IEEE80211_BAND_5GHZ] << 5; - cmd->legacy_rates = cpu_to_le32(rates); - if (sta->ht_cap.ht_supported) { - cmd->ht_rates[0] = sta->ht_cap.mcs.rx_mask[0]; - cmd->ht_rates[1] = sta->ht_cap.mcs.rx_mask[1]; - cmd->ht_rates[2] = sta->ht_cap.mcs.rx_mask[2]; - cmd->ht_rates[3] = sta->ht_cap.mcs.rx_mask[3]; - cmd->ht_capabilities_info = cpu_to_le16(sta->ht_cap.cap); - cmd->mac_ht_param_info = (sta->ht_cap.ampdu_factor & 3) | - ((sta->ht_cap.ampdu_density & 7) << 2); - cmd->is_qos_sta = 1; - } - - rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); - kfree(cmd); - - return rc; -} - -static int mwl8k_cmd_set_new_stn_add_self(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct mwl8k_cmd_set_new_stn *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_NEW_STN); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - memcpy(cmd->mac_addr, vif->addr, ETH_ALEN); - - rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); - kfree(cmd); - - return rc; -} - -static int mwl8k_cmd_set_new_stn_del(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u8 *addr) -{ - struct mwl8k_cmd_set_new_stn *cmd; - struct mwl8k_priv *priv = hw->priv; - int rc, i; - u8 idx; - - spin_lock(&priv->stream_lock); - /* Destroy any active ampdu streams for this sta */ - for (i = 0; i < MWL8K_NUM_AMPDU_STREAMS; i++) { - struct mwl8k_ampdu_stream *s; - s = &priv->ampdu[i]; - if (s->state != AMPDU_NO_STREAM) { - if (memcmp(s->sta->addr, addr, ETH_ALEN) == 0) { - if (s->state == AMPDU_STREAM_ACTIVE) { - idx = s->idx; - spin_unlock(&priv->stream_lock); - mwl8k_destroy_ba(hw, idx); - spin_lock(&priv->stream_lock); - } else if (s->state == AMPDU_STREAM_NEW) { - mwl8k_remove_stream(hw, s); - } - } - } - } - - spin_unlock(&priv->stream_lock); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_NEW_STN); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - memcpy(cmd->mac_addr, addr, ETH_ALEN); - cmd->action = cpu_to_le16(MWL8K_STA_ACTION_REMOVE); - - rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); - kfree(cmd); - - return rc; -} - -/* - * CMD_UPDATE_ENCRYPTION. - */ - -#define MAX_ENCR_KEY_LENGTH 16 -#define MIC_KEY_LENGTH 8 - -struct mwl8k_cmd_update_encryption { - struct mwl8k_cmd_pkt header; - - __le32 action; - __le32 reserved; - __u8 mac_addr[6]; - __u8 encr_type; - -} __packed; - -struct mwl8k_cmd_set_key { - struct mwl8k_cmd_pkt header; - - __le32 action; - __le32 reserved; - __le16 length; - __le16 key_type_id; - __le32 key_info; - __le32 key_id; - __le16 key_len; - __u8 key_material[MAX_ENCR_KEY_LENGTH]; - __u8 tkip_tx_mic_key[MIC_KEY_LENGTH]; - __u8 tkip_rx_mic_key[MIC_KEY_LENGTH]; - __le16 tkip_rsc_low; - __le32 tkip_rsc_high; - __le16 tkip_tsc_low; - __le32 tkip_tsc_high; - __u8 mac_addr[6]; -} __packed; - -enum { - MWL8K_ENCR_ENABLE, - MWL8K_ENCR_SET_KEY, - MWL8K_ENCR_REMOVE_KEY, - MWL8K_ENCR_SET_GROUP_KEY, -}; - -#define MWL8K_UPDATE_ENCRYPTION_TYPE_WEP 0 -#define MWL8K_UPDATE_ENCRYPTION_TYPE_DISABLE 1 -#define MWL8K_UPDATE_ENCRYPTION_TYPE_TKIP 4 -#define MWL8K_UPDATE_ENCRYPTION_TYPE_MIXED 7 -#define MWL8K_UPDATE_ENCRYPTION_TYPE_AES 8 - -enum { - MWL8K_ALG_WEP, - MWL8K_ALG_TKIP, - MWL8K_ALG_CCMP, -}; - -#define MWL8K_KEY_FLAG_TXGROUPKEY 0x00000004 -#define MWL8K_KEY_FLAG_PAIRWISE 0x00000008 -#define MWL8K_KEY_FLAG_TSC_VALID 0x00000040 -#define MWL8K_KEY_FLAG_WEP_TXKEY 0x01000000 -#define MWL8K_KEY_FLAG_MICKEY_VALID 0x02000000 - -static int mwl8k_cmd_update_encryption_enable(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - u8 *addr, - u8 encr_type) -{ - struct mwl8k_cmd_update_encryption *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_UPDATE_ENCRYPTION); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le32(MWL8K_ENCR_ENABLE); - memcpy(cmd->mac_addr, addr, ETH_ALEN); - cmd->encr_type = encr_type; - - rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); - kfree(cmd); - - return rc; -} - -static int mwl8k_encryption_set_cmd_info(struct mwl8k_cmd_set_key *cmd, - u8 *addr, - struct ieee80211_key_conf *key) -{ - cmd->header.code = cpu_to_le16(MWL8K_CMD_UPDATE_ENCRYPTION); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->length = cpu_to_le16(sizeof(*cmd) - - offsetof(struct mwl8k_cmd_set_key, length)); - cmd->key_id = cpu_to_le32(key->keyidx); - cmd->key_len = cpu_to_le16(key->keylen); - memcpy(cmd->mac_addr, addr, ETH_ALEN); - - switch (key->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - cmd->key_type_id = cpu_to_le16(MWL8K_ALG_WEP); - if (key->keyidx == 0) - cmd->key_info = cpu_to_le32(MWL8K_KEY_FLAG_WEP_TXKEY); - - break; - case WLAN_CIPHER_SUITE_TKIP: - cmd->key_type_id = cpu_to_le16(MWL8K_ALG_TKIP); - cmd->key_info = (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) - ? cpu_to_le32(MWL8K_KEY_FLAG_PAIRWISE) - : cpu_to_le32(MWL8K_KEY_FLAG_TXGROUPKEY); - cmd->key_info |= cpu_to_le32(MWL8K_KEY_FLAG_MICKEY_VALID - | MWL8K_KEY_FLAG_TSC_VALID); - break; - case WLAN_CIPHER_SUITE_CCMP: - cmd->key_type_id = cpu_to_le16(MWL8K_ALG_CCMP); - cmd->key_info = (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) - ? cpu_to_le32(MWL8K_KEY_FLAG_PAIRWISE) - : cpu_to_le32(MWL8K_KEY_FLAG_TXGROUPKEY); - break; - default: - return -ENOTSUPP; - } - - return 0; -} - -static int mwl8k_cmd_encryption_set_key(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - u8 *addr, - struct ieee80211_key_conf *key) -{ - struct mwl8k_cmd_set_key *cmd; - int rc; - int keymlen; - u32 action; - u8 idx; - struct mwl8k_vif *mwl8k_vif = MWL8K_VIF(vif); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - rc = mwl8k_encryption_set_cmd_info(cmd, addr, key); - if (rc < 0) - goto done; - - idx = key->keyidx; - - if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) - action = MWL8K_ENCR_SET_KEY; - else - action = MWL8K_ENCR_SET_GROUP_KEY; - - switch (key->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - if (!mwl8k_vif->wep_key_conf[idx].enabled) { - memcpy(mwl8k_vif->wep_key_conf[idx].key, key, - sizeof(*key) + key->keylen); - mwl8k_vif->wep_key_conf[idx].enabled = 1; - } - - keymlen = key->keylen; - action = MWL8K_ENCR_SET_KEY; - break; - case WLAN_CIPHER_SUITE_TKIP: - keymlen = MAX_ENCR_KEY_LENGTH + 2 * MIC_KEY_LENGTH; - break; - case WLAN_CIPHER_SUITE_CCMP: - keymlen = key->keylen; - break; - default: - rc = -ENOTSUPP; - goto done; - } - - memcpy(cmd->key_material, key->key, keymlen); - cmd->action = cpu_to_le32(action); - - rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); -done: - kfree(cmd); - - return rc; -} - -static int mwl8k_cmd_encryption_remove_key(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - u8 *addr, - struct ieee80211_key_conf *key) -{ - struct mwl8k_cmd_set_key *cmd; - int rc; - struct mwl8k_vif *mwl8k_vif = MWL8K_VIF(vif); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - rc = mwl8k_encryption_set_cmd_info(cmd, addr, key); - if (rc < 0) - goto done; - - if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || - key->cipher == WLAN_CIPHER_SUITE_WEP104) - mwl8k_vif->wep_key_conf[key->keyidx].enabled = 0; - - cmd->action = cpu_to_le32(MWL8K_ENCR_REMOVE_KEY); - - rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header); -done: - kfree(cmd); - - return rc; -} - -static int mwl8k_set_key(struct ieee80211_hw *hw, - enum set_key_cmd cmd_param, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - int rc = 0; - u8 encr_type; - u8 *addr; - struct mwl8k_vif *mwl8k_vif = MWL8K_VIF(vif); - struct mwl8k_priv *priv = hw->priv; - - if (vif->type == NL80211_IFTYPE_STATION && !priv->ap_fw) - return -EOPNOTSUPP; - - if (sta == NULL) - addr = vif->addr; - else - addr = sta->addr; - - if (cmd_param == SET_KEY) { - rc = mwl8k_cmd_encryption_set_key(hw, vif, addr, key); - if (rc) - goto out; - - if ((key->cipher == WLAN_CIPHER_SUITE_WEP40) - || (key->cipher == WLAN_CIPHER_SUITE_WEP104)) - encr_type = MWL8K_UPDATE_ENCRYPTION_TYPE_WEP; - else - encr_type = MWL8K_UPDATE_ENCRYPTION_TYPE_MIXED; - - rc = mwl8k_cmd_update_encryption_enable(hw, vif, addr, - encr_type); - if (rc) - goto out; - - mwl8k_vif->is_hw_crypto_enabled = true; - - } else { - rc = mwl8k_cmd_encryption_remove_key(hw, vif, addr, key); - - if (rc) - goto out; - } -out: - return rc; -} - -/* - * CMD_UPDATE_STADB. - */ -struct ewc_ht_info { - __le16 control1; - __le16 control2; - __le16 control3; -} __packed; - -struct peer_capability_info { - /* Peer type - AP vs. STA. */ - __u8 peer_type; - - /* Basic 802.11 capabilities from assoc resp. */ - __le16 basic_caps; - - /* Set if peer supports 802.11n high throughput (HT). */ - __u8 ht_support; - - /* Valid if HT is supported. */ - __le16 ht_caps; - __u8 extended_ht_caps; - struct ewc_ht_info ewc_info; - - /* Legacy rate table. Intersection of our rates and peer rates. */ - __u8 legacy_rates[12]; - - /* HT rate table. Intersection of our rates and peer rates. */ - __u8 ht_rates[16]; - __u8 pad[16]; - - /* If set, interoperability mode, no proprietary extensions. */ - __u8 interop; - __u8 pad2; - __u8 station_id; - __le16 amsdu_enabled; -} __packed; - -struct mwl8k_cmd_update_stadb { - struct mwl8k_cmd_pkt header; - - /* See STADB_ACTION_TYPE */ - __le32 action; - - /* Peer MAC address */ - __u8 peer_addr[ETH_ALEN]; - - __le32 reserved; - - /* Peer info - valid during add/update. */ - struct peer_capability_info peer_info; -} __packed; - -#define MWL8K_STA_DB_MODIFY_ENTRY 1 -#define MWL8K_STA_DB_DEL_ENTRY 2 - -/* Peer Entry flags - used to define the type of the peer node */ -#define MWL8K_PEER_TYPE_ACCESSPOINT 2 - -static int mwl8k_cmd_update_stadb_add(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct mwl8k_cmd_update_stadb *cmd; - struct peer_capability_info *p; - u32 rates; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_UPDATE_STADB); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le32(MWL8K_STA_DB_MODIFY_ENTRY); - memcpy(cmd->peer_addr, sta->addr, ETH_ALEN); - - p = &cmd->peer_info; - p->peer_type = MWL8K_PEER_TYPE_ACCESSPOINT; - p->basic_caps = cpu_to_le16(vif->bss_conf.assoc_capability); - p->ht_support = sta->ht_cap.ht_supported; - p->ht_caps = cpu_to_le16(sta->ht_cap.cap); - p->extended_ht_caps = (sta->ht_cap.ampdu_factor & 3) | - ((sta->ht_cap.ampdu_density & 7) << 2); - if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) - rates = sta->supp_rates[IEEE80211_BAND_2GHZ]; - else - rates = sta->supp_rates[IEEE80211_BAND_5GHZ] << 5; - legacy_rate_mask_to_array(p->legacy_rates, rates); - memcpy(p->ht_rates, sta->ht_cap.mcs.rx_mask, 16); - p->interop = 1; - p->amsdu_enabled = 0; - - rc = mwl8k_post_cmd(hw, &cmd->header); - if (!rc) - rc = p->station_id; - kfree(cmd); - - return rc; -} - -static int mwl8k_cmd_update_stadb_del(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u8 *addr) -{ - struct mwl8k_cmd_update_stadb *cmd; - int rc; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (cmd == NULL) - return -ENOMEM; - - cmd->header.code = cpu_to_le16(MWL8K_CMD_UPDATE_STADB); - cmd->header.length = cpu_to_le16(sizeof(*cmd)); - cmd->action = cpu_to_le32(MWL8K_STA_DB_DEL_ENTRY); - memcpy(cmd->peer_addr, addr, ETH_ALEN); - - rc = mwl8k_post_cmd(hw, &cmd->header); - kfree(cmd); - - return rc; -} - - -/* - * Interrupt handling. - */ -static irqreturn_t mwl8k_interrupt(int irq, void *dev_id) -{ - struct ieee80211_hw *hw = dev_id; - struct mwl8k_priv *priv = hw->priv; - u32 status; - - status = ioread32(priv->regs + MWL8K_HIU_A2H_INTERRUPT_STATUS); - if (!status) - return IRQ_NONE; - - if (status & MWL8K_A2H_INT_TX_DONE) { - status &= ~MWL8K_A2H_INT_TX_DONE; - tasklet_schedule(&priv->poll_tx_task); - } - - if (status & MWL8K_A2H_INT_RX_READY) { - status &= ~MWL8K_A2H_INT_RX_READY; - tasklet_schedule(&priv->poll_rx_task); - } - - if (status & MWL8K_A2H_INT_BA_WATCHDOG) { - iowrite32(~MWL8K_A2H_INT_BA_WATCHDOG, - priv->regs + MWL8K_HIU_A2H_INTERRUPT_STATUS_MASK); - - atomic_inc(&priv->watchdog_event_pending); - status &= ~MWL8K_A2H_INT_BA_WATCHDOG; - ieee80211_queue_work(hw, &priv->watchdog_ba_handle); - } - - if (status) - iowrite32(~status, priv->regs + MWL8K_HIU_A2H_INTERRUPT_STATUS); - - if (status & MWL8K_A2H_INT_OPC_DONE) { - if (priv->hostcmd_wait != NULL) - complete(priv->hostcmd_wait); - } - - if (status & MWL8K_A2H_INT_QUEUE_EMPTY) { - if (!mutex_is_locked(&priv->fw_mutex) && - priv->radio_on && priv->pending_tx_pkts) - mwl8k_tx_start(priv); - } - - return IRQ_HANDLED; -} - -static void mwl8k_tx_poll(unsigned long data) -{ - struct ieee80211_hw *hw = (struct ieee80211_hw *)data; - struct mwl8k_priv *priv = hw->priv; - int limit; - int i; - - limit = 32; - - spin_lock_bh(&priv->tx_lock); - - for (i = 0; i < mwl8k_tx_queues(priv); i++) - limit -= mwl8k_txq_reclaim(hw, i, limit, 0); - - if (!priv->pending_tx_pkts && priv->tx_wait != NULL) { - complete(priv->tx_wait); - priv->tx_wait = NULL; - } - - spin_unlock_bh(&priv->tx_lock); - - if (limit) { - writel(~MWL8K_A2H_INT_TX_DONE, - priv->regs + MWL8K_HIU_A2H_INTERRUPT_STATUS); - } else { - tasklet_schedule(&priv->poll_tx_task); - } -} - -static void mwl8k_rx_poll(unsigned long data) -{ - struct ieee80211_hw *hw = (struct ieee80211_hw *)data; - struct mwl8k_priv *priv = hw->priv; - int limit; - - limit = 32; - limit -= rxq_process(hw, 0, limit); - limit -= rxq_refill(hw, 0, limit); - - if (limit) { - writel(~MWL8K_A2H_INT_RX_READY, - priv->regs + MWL8K_HIU_A2H_INTERRUPT_STATUS); - } else { - tasklet_schedule(&priv->poll_rx_task); - } -} - - -/* - * Core driver operations. - */ -static void mwl8k_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct mwl8k_priv *priv = hw->priv; - int index = skb_get_queue_mapping(skb); - - if (!priv->radio_on) { - wiphy_debug(hw->wiphy, - "dropped TX frame since radio disabled\n"); - dev_kfree_skb(skb); - return; - } - - mwl8k_txq_xmit(hw, index, control->sta, skb); -} - -static int mwl8k_start(struct ieee80211_hw *hw) -{ - struct mwl8k_priv *priv = hw->priv; - int rc; - - rc = request_irq(priv->pdev->irq, mwl8k_interrupt, - IRQF_SHARED, MWL8K_NAME, hw); - if (rc) { - priv->irq = -1; - wiphy_err(hw->wiphy, "failed to register IRQ handler\n"); - return -EIO; - } - priv->irq = priv->pdev->irq; - - /* Enable TX reclaim and RX tasklets. */ - tasklet_enable(&priv->poll_tx_task); - tasklet_enable(&priv->poll_rx_task); - - /* Enable interrupts */ - iowrite32(MWL8K_A2H_EVENTS, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK); - iowrite32(MWL8K_A2H_EVENTS, - priv->regs + MWL8K_HIU_A2H_INTERRUPT_STATUS_MASK); - - rc = mwl8k_fw_lock(hw); - if (!rc) { - rc = mwl8k_cmd_radio_enable(hw); - - if (!priv->ap_fw) { - if (!rc) - rc = mwl8k_cmd_enable_sniffer(hw, 0); - - if (!rc) - rc = mwl8k_cmd_set_pre_scan(hw); - - if (!rc) - rc = mwl8k_cmd_set_post_scan(hw, - "\x00\x00\x00\x00\x00\x00"); - } - - if (!rc) - rc = mwl8k_cmd_set_rateadapt_mode(hw, 0); - - if (!rc) - rc = mwl8k_cmd_set_wmm_mode(hw, 0); - - mwl8k_fw_unlock(hw); - } - - if (rc) { - iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK); - free_irq(priv->pdev->irq, hw); - priv->irq = -1; - tasklet_disable(&priv->poll_tx_task); - tasklet_disable(&priv->poll_rx_task); - } else { - ieee80211_wake_queues(hw); - } - - return rc; -} - -static void mwl8k_stop(struct ieee80211_hw *hw) -{ - struct mwl8k_priv *priv = hw->priv; - int i; - - if (!priv->hw_restart_in_progress) - mwl8k_cmd_radio_disable(hw); - - ieee80211_stop_queues(hw); - - /* Disable interrupts */ - iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK); - if (priv->irq != -1) { - free_irq(priv->pdev->irq, hw); - priv->irq = -1; - } - - /* Stop finalize join worker */ - cancel_work_sync(&priv->finalize_join_worker); - cancel_work_sync(&priv->watchdog_ba_handle); - if (priv->beacon_skb != NULL) - dev_kfree_skb(priv->beacon_skb); - - /* Stop TX reclaim and RX tasklets. */ - tasklet_disable(&priv->poll_tx_task); - tasklet_disable(&priv->poll_rx_task); - - /* Return all skbs to mac80211 */ - for (i = 0; i < mwl8k_tx_queues(priv); i++) - mwl8k_txq_reclaim(hw, i, INT_MAX, 1); -} - -static int mwl8k_reload_firmware(struct ieee80211_hw *hw, char *fw_image); - -static int mwl8k_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_vif *mwl8k_vif; - u32 macids_supported; - int macid, rc; - struct mwl8k_device_info *di; - - /* - * Reject interface creation if sniffer mode is active, as - * STA operation is mutually exclusive with hardware sniffer - * mode. (Sniffer mode is only used on STA firmware.) - */ - if (priv->sniffer_enabled) { - wiphy_info(hw->wiphy, - "unable to create STA interface because sniffer mode is enabled\n"); - return -EINVAL; - } - - di = priv->device_info; - switch (vif->type) { - case NL80211_IFTYPE_AP: - if (!priv->ap_fw && di->fw_image_ap) { - /* we must load the ap fw to meet this request */ - if (!list_empty(&priv->vif_list)) - return -EBUSY; - rc = mwl8k_reload_firmware(hw, di->fw_image_ap); - if (rc) - return rc; - } - macids_supported = priv->ap_macids_supported; - break; - case NL80211_IFTYPE_STATION: - if (priv->ap_fw && di->fw_image_sta) { - if (!list_empty(&priv->vif_list)) { - wiphy_warn(hw->wiphy, "AP interface is running.\n" - "Adding STA interface for WDS"); - } else { - /* we must load the sta fw to - * meet this request. - */ - rc = mwl8k_reload_firmware(hw, - di->fw_image_sta); - if (rc) - return rc; - } - } - macids_supported = priv->sta_macids_supported; - break; - default: - return -EINVAL; - } - - macid = ffs(macids_supported & ~priv->macids_used); - if (!macid--) - return -EBUSY; - - /* Setup driver private area. */ - mwl8k_vif = MWL8K_VIF(vif); - memset(mwl8k_vif, 0, sizeof(*mwl8k_vif)); - mwl8k_vif->vif = vif; - mwl8k_vif->macid = macid; - mwl8k_vif->seqno = 0; - memcpy(mwl8k_vif->bssid, vif->addr, ETH_ALEN); - mwl8k_vif->is_hw_crypto_enabled = false; - - /* Set the mac address. */ - mwl8k_cmd_set_mac_addr(hw, vif, vif->addr); - - if (vif->type == NL80211_IFTYPE_AP) - mwl8k_cmd_set_new_stn_add_self(hw, vif); - - priv->macids_used |= 1 << mwl8k_vif->macid; - list_add_tail(&mwl8k_vif->list, &priv->vif_list); - - return 0; -} - -static void mwl8k_remove_vif(struct mwl8k_priv *priv, struct mwl8k_vif *vif) -{ - /* Has ieee80211_restart_hw re-added the removed interfaces? */ - if (!priv->macids_used) - return; - - priv->macids_used &= ~(1 << vif->macid); - list_del(&vif->list); -} - -static void mwl8k_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_vif *mwl8k_vif = MWL8K_VIF(vif); - - if (vif->type == NL80211_IFTYPE_AP) - mwl8k_cmd_set_new_stn_del(hw, vif, vif->addr); - - mwl8k_cmd_del_mac_addr(hw, vif, vif->addr); - - mwl8k_remove_vif(priv, mwl8k_vif); -} - -static void mwl8k_hw_restart_work(struct work_struct *work) -{ - struct mwl8k_priv *priv = - container_of(work, struct mwl8k_priv, fw_reload); - struct ieee80211_hw *hw = priv->hw; - struct mwl8k_device_info *di; - int rc; - - /* If some command is waiting for a response, clear it */ - if (priv->hostcmd_wait != NULL) { - complete(priv->hostcmd_wait); - priv->hostcmd_wait = NULL; - } - - priv->hw_restart_owner = current; - di = priv->device_info; - mwl8k_fw_lock(hw); - - if (priv->ap_fw) - rc = mwl8k_reload_firmware(hw, di->fw_image_ap); - else - rc = mwl8k_reload_firmware(hw, di->fw_image_sta); - - if (rc) - goto fail; - - priv->hw_restart_owner = NULL; - priv->hw_restart_in_progress = false; - - /* - * This unlock will wake up the queues and - * also opens the command path for other - * commands - */ - mwl8k_fw_unlock(hw); - - ieee80211_restart_hw(hw); - - wiphy_err(hw->wiphy, "Firmware restarted successfully\n"); - - return; -fail: - mwl8k_fw_unlock(hw); - - wiphy_err(hw->wiphy, "Firmware restart failed\n"); -} - -static int mwl8k_config(struct ieee80211_hw *hw, u32 changed) -{ - struct ieee80211_conf *conf = &hw->conf; - struct mwl8k_priv *priv = hw->priv; - int rc; - - rc = mwl8k_fw_lock(hw); - if (rc) - return rc; - - if (conf->flags & IEEE80211_CONF_IDLE) - rc = mwl8k_cmd_radio_disable(hw); - else - rc = mwl8k_cmd_radio_enable(hw); - if (rc) - goto out; - - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { - rc = mwl8k_cmd_set_rf_channel(hw, conf); - if (rc) - goto out; - } - - if (conf->power_level > 18) - conf->power_level = 18; - - if (priv->ap_fw) { - - if (conf->flags & IEEE80211_CONF_CHANGE_POWER) { - rc = mwl8k_cmd_tx_power(hw, conf, conf->power_level); - if (rc) - goto out; - } - - - } else { - rc = mwl8k_cmd_rf_tx_power(hw, conf->power_level); - if (rc) - goto out; - rc = mwl8k_cmd_mimo_config(hw, 0x7, 0x7); - } - -out: - mwl8k_fw_unlock(hw); - - return rc; -} - -static void -mwl8k_bss_info_changed_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_bss_conf *info, u32 changed) -{ - struct mwl8k_priv *priv = hw->priv; - u32 ap_legacy_rates = 0; - u8 ap_mcs_rates[16]; - int rc; - - if (mwl8k_fw_lock(hw)) - return; - - /* - * No need to capture a beacon if we're no longer associated. - */ - if ((changed & BSS_CHANGED_ASSOC) && !vif->bss_conf.assoc) - priv->capture_beacon = false; - - /* - * Get the AP's legacy and MCS rates. - */ - if (vif->bss_conf.assoc) { - struct ieee80211_sta *ap; - - rcu_read_lock(); - - ap = ieee80211_find_sta(vif, vif->bss_conf.bssid); - if (ap == NULL) { - rcu_read_unlock(); - goto out; - } - - if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) { - ap_legacy_rates = ap->supp_rates[IEEE80211_BAND_2GHZ]; - } else { - ap_legacy_rates = - ap->supp_rates[IEEE80211_BAND_5GHZ] << 5; - } - memcpy(ap_mcs_rates, ap->ht_cap.mcs.rx_mask, 16); - - rcu_read_unlock(); - } - - if ((changed & BSS_CHANGED_ASSOC) && vif->bss_conf.assoc && - !priv->ap_fw) { - rc = mwl8k_cmd_set_rate(hw, vif, ap_legacy_rates, ap_mcs_rates); - if (rc) - goto out; - - rc = mwl8k_cmd_use_fixed_rate_sta(hw); - if (rc) - goto out; - } else { - if ((changed & BSS_CHANGED_ASSOC) && vif->bss_conf.assoc && - priv->ap_fw) { - int idx; - int rate; - - /* Use AP firmware specific rate command. - */ - idx = ffs(vif->bss_conf.basic_rates); - if (idx) - idx--; - - if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) - rate = mwl8k_rates_24[idx].hw_value; - else - rate = mwl8k_rates_50[idx].hw_value; - - mwl8k_cmd_use_fixed_rate_ap(hw, rate, rate); - } - } - - if (changed & BSS_CHANGED_ERP_PREAMBLE) { - rc = mwl8k_set_radio_preamble(hw, - vif->bss_conf.use_short_preamble); - if (rc) - goto out; - } - - if ((changed & BSS_CHANGED_ERP_SLOT) && !priv->ap_fw) { - rc = mwl8k_cmd_set_slot(hw, vif->bss_conf.use_short_slot); - if (rc) - goto out; - } - - if (vif->bss_conf.assoc && !priv->ap_fw && - (changed & (BSS_CHANGED_ASSOC | BSS_CHANGED_ERP_CTS_PROT | - BSS_CHANGED_HT))) { - rc = mwl8k_cmd_set_aid(hw, vif, ap_legacy_rates); - if (rc) - goto out; - } - - if (vif->bss_conf.assoc && - (changed & (BSS_CHANGED_ASSOC | BSS_CHANGED_BEACON_INT))) { - /* - * Finalize the join. Tell rx handler to process - * next beacon from our BSSID. - */ - memcpy(priv->capture_bssid, vif->bss_conf.bssid, ETH_ALEN); - priv->capture_beacon = true; - } - -out: - mwl8k_fw_unlock(hw); -} - -static void -mwl8k_bss_info_changed_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_bss_conf *info, u32 changed) -{ - int rc; - - if (mwl8k_fw_lock(hw)) - return; - - if (changed & BSS_CHANGED_ERP_PREAMBLE) { - rc = mwl8k_set_radio_preamble(hw, - vif->bss_conf.use_short_preamble); - if (rc) - goto out; - } - - if (changed & BSS_CHANGED_BASIC_RATES) { - int idx; - int rate; - - /* - * Use lowest supported basic rate for multicasts - * and management frames (such as probe responses -- - * beacons will always go out at 1 Mb/s). - */ - idx = ffs(vif->bss_conf.basic_rates); - if (idx) - idx--; - - if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) - rate = mwl8k_rates_24[idx].hw_value; - else - rate = mwl8k_rates_50[idx].hw_value; - - mwl8k_cmd_use_fixed_rate_ap(hw, rate, rate); - } - - if (changed & (BSS_CHANGED_BEACON_INT | BSS_CHANGED_BEACON)) { - struct sk_buff *skb; - - skb = ieee80211_beacon_get(hw, vif); - if (skb != NULL) { - mwl8k_cmd_set_beacon(hw, vif, skb->data, skb->len); - kfree_skb(skb); - } - } - - if (changed & BSS_CHANGED_BEACON_ENABLED) - mwl8k_cmd_bss_start(hw, vif, info->enable_beacon); - -out: - mwl8k_fw_unlock(hw); -} - -static void -mwl8k_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_bss_conf *info, u32 changed) -{ - if (vif->type == NL80211_IFTYPE_STATION) - mwl8k_bss_info_changed_sta(hw, vif, info, changed); - if (vif->type == NL80211_IFTYPE_AP) - mwl8k_bss_info_changed_ap(hw, vif, info, changed); -} - -static u64 mwl8k_prepare_multicast(struct ieee80211_hw *hw, - struct netdev_hw_addr_list *mc_list) -{ - struct mwl8k_cmd_pkt *cmd; - - /* - * Synthesize and return a command packet that programs the - * hardware multicast address filter. At this point we don't - * know whether FIF_ALLMULTI is being requested, but if it is, - * we'll end up throwing this packet away and creating a new - * one in mwl8k_configure_filter(). - */ - cmd = __mwl8k_cmd_mac_multicast_adr(hw, 0, mc_list); - - return (unsigned long)cmd; -} - -static int -mwl8k_configure_filter_sniffer(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *total_flags) -{ - struct mwl8k_priv *priv = hw->priv; - - /* - * Hardware sniffer mode is mutually exclusive with STA - * operation, so refuse to enable sniffer mode if a STA - * interface is active. - */ - if (!list_empty(&priv->vif_list)) { - if (net_ratelimit()) - wiphy_info(hw->wiphy, - "not enabling sniffer mode because STA interface is active\n"); - return 0; - } - - if (!priv->sniffer_enabled) { - if (mwl8k_cmd_enable_sniffer(hw, 1)) - return 0; - priv->sniffer_enabled = true; - } - - *total_flags &= FIF_PROMISC_IN_BSS | FIF_ALLMULTI | - FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL | - FIF_OTHER_BSS; - - return 1; -} - -static struct mwl8k_vif *mwl8k_first_vif(struct mwl8k_priv *priv) -{ - if (!list_empty(&priv->vif_list)) - return list_entry(priv->vif_list.next, struct mwl8k_vif, list); - - return NULL; -} - -static void mwl8k_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast) -{ - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_cmd_pkt *cmd = (void *)(unsigned long)multicast; - - /* - * AP firmware doesn't allow fine-grained control over - * the receive filter. - */ - if (priv->ap_fw) { - *total_flags &= FIF_ALLMULTI | FIF_BCN_PRBRESP_PROMISC; - kfree(cmd); - return; - } - - /* - * Enable hardware sniffer mode if FIF_CONTROL or - * FIF_OTHER_BSS is requested. - */ - if (*total_flags & (FIF_CONTROL | FIF_OTHER_BSS) && - mwl8k_configure_filter_sniffer(hw, changed_flags, total_flags)) { - kfree(cmd); - return; - } - - /* Clear unsupported feature flags */ - *total_flags &= FIF_ALLMULTI | FIF_BCN_PRBRESP_PROMISC; - - if (mwl8k_fw_lock(hw)) { - kfree(cmd); - return; - } - - if (priv->sniffer_enabled) { - mwl8k_cmd_enable_sniffer(hw, 0); - priv->sniffer_enabled = false; - } - - if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { - if (*total_flags & FIF_BCN_PRBRESP_PROMISC) { - /* - * Disable the BSS filter. - */ - mwl8k_cmd_set_pre_scan(hw); - } else { - struct mwl8k_vif *mwl8k_vif; - const u8 *bssid; - - /* - * Enable the BSS filter. - * - * If there is an active STA interface, use that - * interface's BSSID, otherwise use a dummy one - * (where the OUI part needs to be nonzero for - * the BSSID to be accepted by POST_SCAN). - */ - mwl8k_vif = mwl8k_first_vif(priv); - if (mwl8k_vif != NULL) - bssid = mwl8k_vif->vif->bss_conf.bssid; - else - bssid = "\x01\x00\x00\x00\x00\x00"; - - mwl8k_cmd_set_post_scan(hw, bssid); - } - } - - /* - * If FIF_ALLMULTI is being requested, throw away the command - * packet that ->prepare_multicast() built and replace it with - * a command packet that enables reception of all multicast - * packets. - */ - if (*total_flags & FIF_ALLMULTI) { - kfree(cmd); - cmd = __mwl8k_cmd_mac_multicast_adr(hw, 1, NULL); - } - - if (cmd != NULL) { - mwl8k_post_cmd(hw, cmd); - kfree(cmd); - } - - mwl8k_fw_unlock(hw); -} - -static int mwl8k_set_rts_threshold(struct ieee80211_hw *hw, u32 value) -{ - return mwl8k_cmd_set_rts_threshold(hw, value); -} - -static int mwl8k_sta_remove(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct mwl8k_priv *priv = hw->priv; - - if (priv->ap_fw) - return mwl8k_cmd_set_new_stn_del(hw, vif, sta->addr); - else - return mwl8k_cmd_update_stadb_del(hw, vif, sta->addr); -} - -static int mwl8k_sta_add(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct mwl8k_priv *priv = hw->priv; - int ret; - int i; - struct mwl8k_vif *mwl8k_vif = MWL8K_VIF(vif); - struct ieee80211_key_conf *key; - - if (!priv->ap_fw) { - ret = mwl8k_cmd_update_stadb_add(hw, vif, sta); - if (ret >= 0) { - MWL8K_STA(sta)->peer_id = ret; - if (sta->ht_cap.ht_supported) - MWL8K_STA(sta)->is_ampdu_allowed = true; - ret = 0; - } - - } else { - ret = mwl8k_cmd_set_new_stn_add(hw, vif, sta); - } - - for (i = 0; i < NUM_WEP_KEYS; i++) { - key = IEEE80211_KEY_CONF(mwl8k_vif->wep_key_conf[i].key); - if (mwl8k_vif->wep_key_conf[i].enabled) - mwl8k_set_key(hw, SET_KEY, vif, sta, key); - } - return ret; -} - -static int mwl8k_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - struct mwl8k_priv *priv = hw->priv; - int rc; - - rc = mwl8k_fw_lock(hw); - if (!rc) { - BUG_ON(queue > MWL8K_TX_WMM_QUEUES - 1); - memcpy(&priv->wmm_params[queue], params, sizeof(*params)); - - if (!priv->wmm_enabled) - rc = mwl8k_cmd_set_wmm_mode(hw, 1); - - if (!rc) { - int q = MWL8K_TX_WMM_QUEUES - 1 - queue; - rc = mwl8k_cmd_set_edca_params(hw, q, - params->cw_min, - params->cw_max, - params->aifs, - params->txop); - } - - mwl8k_fw_unlock(hw); - } - - return rc; -} - -static int mwl8k_get_stats(struct ieee80211_hw *hw, - struct ieee80211_low_level_stats *stats) -{ - return mwl8k_cmd_get_stat(hw, stats); -} - -static int mwl8k_get_survey(struct ieee80211_hw *hw, int idx, - struct survey_info *survey) -{ - struct mwl8k_priv *priv = hw->priv; - struct ieee80211_conf *conf = &hw->conf; - - if (idx != 0) - return -ENOENT; - - survey->channel = conf->chandef.chan; - survey->filled = SURVEY_INFO_NOISE_DBM; - survey->noise = priv->noise; - - return 0; -} - -#define MAX_AMPDU_ATTEMPTS 5 - -static int -mwl8k_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, u16 tid, u16 *ssn, - u8 buf_size) -{ - - int i, rc = 0; - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_ampdu_stream *stream; - u8 *addr = sta->addr, idx; - struct mwl8k_sta *sta_info = MWL8K_STA(sta); - - if (!(hw->flags & IEEE80211_HW_AMPDU_AGGREGATION)) - return -ENOTSUPP; - - spin_lock(&priv->stream_lock); - stream = mwl8k_lookup_stream(hw, addr, tid); - - switch (action) { - case IEEE80211_AMPDU_RX_START: - case IEEE80211_AMPDU_RX_STOP: - break; - case IEEE80211_AMPDU_TX_START: - /* By the time we get here the hw queues may contain outgoing - * packets for this RA/TID that are not part of this BA - * session. The hw will assign sequence numbers to these - * packets as they go out. So if we query the hw for its next - * sequence number and use that for the SSN here, it may end up - * being wrong, which will lead to sequence number mismatch at - * the recipient. To avoid this, we reset the sequence number - * to O for the first MPDU in this BA stream. - */ - *ssn = 0; - if (stream == NULL) { - /* This means that somebody outside this driver called - * ieee80211_start_tx_ba_session. This is unexpected - * because we do our own rate control. Just warn and - * move on. - */ - wiphy_warn(hw->wiphy, "Unexpected call to %s. " - "Proceeding anyway.\n", __func__); - stream = mwl8k_add_stream(hw, sta, tid); - } - if (stream == NULL) { - wiphy_debug(hw->wiphy, "no free AMPDU streams\n"); - rc = -EBUSY; - break; - } - stream->state = AMPDU_STREAM_IN_PROGRESS; - - /* Release the lock before we do the time consuming stuff */ - spin_unlock(&priv->stream_lock); - for (i = 0; i < MAX_AMPDU_ATTEMPTS; i++) { - - /* Check if link is still valid */ - if (!sta_info->is_ampdu_allowed) { - spin_lock(&priv->stream_lock); - mwl8k_remove_stream(hw, stream); - spin_unlock(&priv->stream_lock); - return -EBUSY; - } - - rc = mwl8k_check_ba(hw, stream, vif); - - /* If HW restart is in progress mwl8k_post_cmd will - * return -EBUSY. Avoid retrying mwl8k_check_ba in - * such cases - */ - if (!rc || rc == -EBUSY) - break; - /* - * HW queues take time to be flushed, give them - * sufficient time - */ - - msleep(1000); - } - spin_lock(&priv->stream_lock); - if (rc) { - wiphy_err(hw->wiphy, "Stream for tid %d busy after %d" - " attempts\n", tid, MAX_AMPDU_ATTEMPTS); - mwl8k_remove_stream(hw, stream); - rc = -EBUSY; - break; - } - ieee80211_start_tx_ba_cb_irqsafe(vif, addr, tid); - break; - case IEEE80211_AMPDU_TX_STOP_CONT: - case IEEE80211_AMPDU_TX_STOP_FLUSH: - case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: - if (stream) { - if (stream->state == AMPDU_STREAM_ACTIVE) { - idx = stream->idx; - spin_unlock(&priv->stream_lock); - mwl8k_destroy_ba(hw, idx); - spin_lock(&priv->stream_lock); - } - mwl8k_remove_stream(hw, stream); - } - ieee80211_stop_tx_ba_cb_irqsafe(vif, addr, tid); - break; - case IEEE80211_AMPDU_TX_OPERATIONAL: - BUG_ON(stream == NULL); - BUG_ON(stream->state != AMPDU_STREAM_IN_PROGRESS); - spin_unlock(&priv->stream_lock); - rc = mwl8k_create_ba(hw, stream, buf_size, vif); - spin_lock(&priv->stream_lock); - if (!rc) - stream->state = AMPDU_STREAM_ACTIVE; - else { - idx = stream->idx; - spin_unlock(&priv->stream_lock); - mwl8k_destroy_ba(hw, idx); - spin_lock(&priv->stream_lock); - wiphy_debug(hw->wiphy, - "Failed adding stream for sta %pM tid %d\n", - addr, tid); - mwl8k_remove_stream(hw, stream); - } - break; - - default: - rc = -ENOTSUPP; - } - - spin_unlock(&priv->stream_lock); - return rc; -} - -static const struct ieee80211_ops mwl8k_ops = { - .tx = mwl8k_tx, - .start = mwl8k_start, - .stop = mwl8k_stop, - .add_interface = mwl8k_add_interface, - .remove_interface = mwl8k_remove_interface, - .config = mwl8k_config, - .bss_info_changed = mwl8k_bss_info_changed, - .prepare_multicast = mwl8k_prepare_multicast, - .configure_filter = mwl8k_configure_filter, - .set_key = mwl8k_set_key, - .set_rts_threshold = mwl8k_set_rts_threshold, - .sta_add = mwl8k_sta_add, - .sta_remove = mwl8k_sta_remove, - .conf_tx = mwl8k_conf_tx, - .get_stats = mwl8k_get_stats, - .get_survey = mwl8k_get_survey, - .ampdu_action = mwl8k_ampdu_action, -}; - -static void mwl8k_finalize_join_worker(struct work_struct *work) -{ - struct mwl8k_priv *priv = - container_of(work, struct mwl8k_priv, finalize_join_worker); - struct sk_buff *skb = priv->beacon_skb; - struct ieee80211_mgmt *mgmt = (void *)skb->data; - int len = skb->len - offsetof(struct ieee80211_mgmt, u.beacon.variable); - const u8 *tim = cfg80211_find_ie(WLAN_EID_TIM, - mgmt->u.beacon.variable, len); - int dtim_period = 1; - - if (tim && tim[1] >= 2) - dtim_period = tim[3]; - - mwl8k_cmd_finalize_join(priv->hw, skb->data, skb->len, dtim_period); - - dev_kfree_skb(skb); - priv->beacon_skb = NULL; -} - -enum { - MWL8363 = 0, - MWL8687, - MWL8366, - MWL8764, -}; - -#define MWL8K_8366_AP_FW_API 3 -#define _MWL8K_8366_AP_FW(api) "mwl8k/fmimage_8366_ap-" #api ".fw" -#define MWL8K_8366_AP_FW(api) _MWL8K_8366_AP_FW(api) - -#define MWL8K_8764_AP_FW_API 1 -#define _MWL8K_8764_AP_FW(api) "mwl8k/fmimage_8764_ap-" #api ".fw" -#define MWL8K_8764_AP_FW(api) _MWL8K_8764_AP_FW(api) - -static struct mwl8k_device_info mwl8k_info_tbl[] = { - [MWL8363] = { - .part_name = "88w8363", - .helper_image = "mwl8k/helper_8363.fw", - .fw_image_sta = "mwl8k/fmimage_8363.fw", - }, - [MWL8687] = { - .part_name = "88w8687", - .helper_image = "mwl8k/helper_8687.fw", - .fw_image_sta = "mwl8k/fmimage_8687.fw", - }, - [MWL8366] = { - .part_name = "88w8366", - .helper_image = "mwl8k/helper_8366.fw", - .fw_image_sta = "mwl8k/fmimage_8366.fw", - .fw_image_ap = MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API), - .fw_api_ap = MWL8K_8366_AP_FW_API, - .ap_rxd_ops = &rxd_ap_ops, - }, - [MWL8764] = { - .part_name = "88w8764", - .fw_image_ap = MWL8K_8764_AP_FW(MWL8K_8764_AP_FW_API), - .fw_api_ap = MWL8K_8764_AP_FW_API, - .ap_rxd_ops = &rxd_ap_ops, - }, -}; - -MODULE_FIRMWARE("mwl8k/helper_8363.fw"); -MODULE_FIRMWARE("mwl8k/fmimage_8363.fw"); -MODULE_FIRMWARE("mwl8k/helper_8687.fw"); -MODULE_FIRMWARE("mwl8k/fmimage_8687.fw"); -MODULE_FIRMWARE("mwl8k/helper_8366.fw"); -MODULE_FIRMWARE("mwl8k/fmimage_8366.fw"); -MODULE_FIRMWARE(MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API)); - -static DEFINE_PCI_DEVICE_TABLE(mwl8k_pci_id_table) = { - { PCI_VDEVICE(MARVELL, 0x2a0a), .driver_data = MWL8363, }, - { PCI_VDEVICE(MARVELL, 0x2a0c), .driver_data = MWL8363, }, - { PCI_VDEVICE(MARVELL, 0x2a24), .driver_data = MWL8363, }, - { PCI_VDEVICE(MARVELL, 0x2a2b), .driver_data = MWL8687, }, - { PCI_VDEVICE(MARVELL, 0x2a30), .driver_data = MWL8687, }, - { PCI_VDEVICE(MARVELL, 0x2a40), .driver_data = MWL8366, }, - { PCI_VDEVICE(MARVELL, 0x2a41), .driver_data = MWL8366, }, - { PCI_VDEVICE(MARVELL, 0x2a42), .driver_data = MWL8366, }, - { PCI_VDEVICE(MARVELL, 0x2a43), .driver_data = MWL8366, }, - { PCI_VDEVICE(MARVELL, 0x2b36), .driver_data = MWL8764, }, - { }, -}; -MODULE_DEVICE_TABLE(pci, mwl8k_pci_id_table); - -static int mwl8k_request_alt_fw(struct mwl8k_priv *priv) -{ - int rc; - printk(KERN_ERR "%s: Error requesting preferred fw %s.\n" - "Trying alternative firmware %s\n", pci_name(priv->pdev), - priv->fw_pref, priv->fw_alt); - rc = mwl8k_request_fw(priv, priv->fw_alt, &priv->fw_ucode, true); - if (rc) { - printk(KERN_ERR "%s: Error requesting alt fw %s\n", - pci_name(priv->pdev), priv->fw_alt); - return rc; - } - return 0; -} - -static int mwl8k_firmware_load_success(struct mwl8k_priv *priv); -static void mwl8k_fw_state_machine(const struct firmware *fw, void *context) -{ - struct mwl8k_priv *priv = context; - struct mwl8k_device_info *di = priv->device_info; - int rc; - - switch (priv->fw_state) { - case FW_STATE_INIT: - if (!fw) { - printk(KERN_ERR "%s: Error requesting helper fw %s\n", - pci_name(priv->pdev), di->helper_image); - goto fail; - } - priv->fw_helper = fw; - rc = mwl8k_request_fw(priv, priv->fw_pref, &priv->fw_ucode, - true); - if (rc && priv->fw_alt) { - rc = mwl8k_request_alt_fw(priv); - if (rc) - goto fail; - priv->fw_state = FW_STATE_LOADING_ALT; - } else if (rc) - goto fail; - else - priv->fw_state = FW_STATE_LOADING_PREF; - break; - - case FW_STATE_LOADING_PREF: - if (!fw) { - if (priv->fw_alt) { - rc = mwl8k_request_alt_fw(priv); - if (rc) - goto fail; - priv->fw_state = FW_STATE_LOADING_ALT; - } else - goto fail; - } else { - priv->fw_ucode = fw; - rc = mwl8k_firmware_load_success(priv); - if (rc) - goto fail; - else - complete(&priv->firmware_loading_complete); - } - break; - - case FW_STATE_LOADING_ALT: - if (!fw) { - printk(KERN_ERR "%s: Error requesting alt fw %s\n", - pci_name(priv->pdev), di->helper_image); - goto fail; - } - priv->fw_ucode = fw; - rc = mwl8k_firmware_load_success(priv); - if (rc) - goto fail; - else - complete(&priv->firmware_loading_complete); - break; - - default: - printk(KERN_ERR "%s: Unexpected firmware loading state: %d\n", - MWL8K_NAME, priv->fw_state); - BUG_ON(1); - } - - return; - -fail: - priv->fw_state = FW_STATE_ERROR; - complete(&priv->firmware_loading_complete); - device_release_driver(&priv->pdev->dev); - mwl8k_release_firmware(priv); -} - -#define MAX_RESTART_ATTEMPTS 1 -static int mwl8k_init_firmware(struct ieee80211_hw *hw, char *fw_image, - bool nowait) -{ - struct mwl8k_priv *priv = hw->priv; - int rc; - int count = MAX_RESTART_ATTEMPTS; - -retry: - /* Reset firmware and hardware */ - mwl8k_hw_reset(priv); - - /* Ask userland hotplug daemon for the device firmware */ - rc = mwl8k_request_firmware(priv, fw_image, nowait); - if (rc) { - wiphy_err(hw->wiphy, "Firmware files not found\n"); - return rc; - } - - if (nowait) - return rc; - - /* Load firmware into hardware */ - rc = mwl8k_load_firmware(hw); - if (rc) - wiphy_err(hw->wiphy, "Cannot start firmware\n"); - - /* Reclaim memory once firmware is successfully loaded */ - mwl8k_release_firmware(priv); - - if (rc && count) { - /* FW did not start successfully; - * lets try one more time - */ - count--; - wiphy_err(hw->wiphy, "Trying to reload the firmware again\n"); - msleep(20); - goto retry; - } - - return rc; -} - -static int mwl8k_init_txqs(struct ieee80211_hw *hw) -{ - struct mwl8k_priv *priv = hw->priv; - int rc = 0; - int i; - - for (i = 0; i < mwl8k_tx_queues(priv); i++) { - rc = mwl8k_txq_init(hw, i); - if (rc) - break; - if (priv->ap_fw) - iowrite32(priv->txq[i].txd_dma, - priv->sram + priv->txq_offset[i]); - } - return rc; -} - -/* initialize hw after successfully loading a firmware image */ -static int mwl8k_probe_hw(struct ieee80211_hw *hw) -{ - struct mwl8k_priv *priv = hw->priv; - int rc = 0; - int i; - - if (priv->ap_fw) { - priv->rxd_ops = priv->device_info->ap_rxd_ops; - if (priv->rxd_ops == NULL) { - wiphy_err(hw->wiphy, - "Driver does not have AP firmware image support for this hardware\n"); - rc = -ENOENT; - goto err_stop_firmware; - } - } else { - priv->rxd_ops = &rxd_sta_ops; - } - - priv->sniffer_enabled = false; - priv->wmm_enabled = false; - priv->pending_tx_pkts = 0; - atomic_set(&priv->watchdog_event_pending, 0); - - rc = mwl8k_rxq_init(hw, 0); - if (rc) - goto err_stop_firmware; - rxq_refill(hw, 0, INT_MAX); - - /* For the sta firmware, we need to know the dma addresses of tx queues - * before sending MWL8K_CMD_GET_HW_SPEC. So we must initialize them - * prior to issuing this command. But for the AP case, we learn the - * total number of queues from the result CMD_GET_HW_SPEC, so for this - * case we must initialize the tx queues after. - */ - priv->num_ampdu_queues = 0; - if (!priv->ap_fw) { - rc = mwl8k_init_txqs(hw); - if (rc) - goto err_free_queues; - } - - iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_STATUS); - iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK); - iowrite32(MWL8K_A2H_INT_TX_DONE|MWL8K_A2H_INT_RX_READY| - MWL8K_A2H_INT_BA_WATCHDOG, - priv->regs + MWL8K_HIU_A2H_INTERRUPT_CLEAR_SEL); - iowrite32(MWL8K_A2H_INT_OPC_DONE, - priv->regs + MWL8K_HIU_A2H_INTERRUPT_STATUS_MASK); - - rc = request_irq(priv->pdev->irq, mwl8k_interrupt, - IRQF_SHARED, MWL8K_NAME, hw); - if (rc) { - wiphy_err(hw->wiphy, "failed to register IRQ handler\n"); - goto err_free_queues; - } - - /* - * When hw restart is requested, - * mac80211 will take care of clearing - * the ampdu streams, so do not clear - * the ampdu state here - */ - if (!priv->hw_restart_in_progress) - memset(priv->ampdu, 0, sizeof(priv->ampdu)); - - /* - * Temporarily enable interrupts. Initial firmware host - * commands use interrupts and avoid polling. Disable - * interrupts when done. - */ - iowrite32(MWL8K_A2H_EVENTS, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK); - - /* Get config data, mac addrs etc */ - if (priv->ap_fw) { - rc = mwl8k_cmd_get_hw_spec_ap(hw); - if (!rc) - rc = mwl8k_init_txqs(hw); - if (!rc) - rc = mwl8k_cmd_set_hw_spec(hw); - } else { - rc = mwl8k_cmd_get_hw_spec_sta(hw); - } - if (rc) { - wiphy_err(hw->wiphy, "Cannot initialise firmware\n"); - goto err_free_irq; - } - - /* Turn radio off */ - rc = mwl8k_cmd_radio_disable(hw); - if (rc) { - wiphy_err(hw->wiphy, "Cannot disable\n"); - goto err_free_irq; - } - - /* Clear MAC address */ - rc = mwl8k_cmd_set_mac_addr(hw, NULL, "\x00\x00\x00\x00\x00\x00"); - if (rc) { - wiphy_err(hw->wiphy, "Cannot clear MAC address\n"); - goto err_free_irq; - } - - /* Configure Antennas */ - rc = mwl8k_cmd_rf_antenna(hw, MWL8K_RF_ANTENNA_RX, 0x3); - if (rc) - wiphy_warn(hw->wiphy, "failed to set # of RX antennas"); - rc = mwl8k_cmd_rf_antenna(hw, MWL8K_RF_ANTENNA_TX, 0x7); - if (rc) - wiphy_warn(hw->wiphy, "failed to set # of TX antennas"); - - - /* Disable interrupts */ - iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK); - free_irq(priv->pdev->irq, hw); - - wiphy_info(hw->wiphy, "%s v%d, %pm, %s firmware %u.%u.%u.%u\n", - priv->device_info->part_name, - priv->hw_rev, hw->wiphy->perm_addr, - priv->ap_fw ? "AP" : "STA", - (priv->fw_rev >> 24) & 0xff, (priv->fw_rev >> 16) & 0xff, - (priv->fw_rev >> 8) & 0xff, priv->fw_rev & 0xff); - - return 0; - -err_free_irq: - iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK); - free_irq(priv->pdev->irq, hw); - -err_free_queues: - for (i = 0; i < mwl8k_tx_queues(priv); i++) - mwl8k_txq_deinit(hw, i); - mwl8k_rxq_deinit(hw, 0); - -err_stop_firmware: - mwl8k_hw_reset(priv); - - return rc; -} - -/* - * invoke mwl8k_reload_firmware to change the firmware image after the device - * has already been registered - */ -static int mwl8k_reload_firmware(struct ieee80211_hw *hw, char *fw_image) -{ - int i, rc = 0; - struct mwl8k_priv *priv = hw->priv; - struct mwl8k_vif *vif, *tmp_vif; - - mwl8k_stop(hw); - mwl8k_rxq_deinit(hw, 0); - - /* - * All the existing interfaces are re-added by the ieee80211_reconfig; - * which means driver should remove existing interfaces before calling - * ieee80211_restart_hw - */ - if (priv->hw_restart_in_progress) - list_for_each_entry_safe(vif, tmp_vif, &priv->vif_list, list) - mwl8k_remove_vif(priv, vif); - - for (i = 0; i < mwl8k_tx_queues(priv); i++) - mwl8k_txq_deinit(hw, i); - - rc = mwl8k_init_firmware(hw, fw_image, false); - if (rc) - goto fail; - - rc = mwl8k_probe_hw(hw); - if (rc) - goto fail; - - if (priv->hw_restart_in_progress) - return rc; - - rc = mwl8k_start(hw); - if (rc) - goto fail; - - rc = mwl8k_config(hw, ~0); - if (rc) - goto fail; - - for (i = 0; i < MWL8K_TX_WMM_QUEUES; i++) { - rc = mwl8k_conf_tx(hw, NULL, i, &priv->wmm_params[i]); - if (rc) - goto fail; - } - - return rc; - -fail: - printk(KERN_WARNING "mwl8k: Failed to reload firmware image.\n"); - return rc; -} - -static const struct ieee80211_iface_limit ap_if_limits[] = { - { .max = 8, .types = BIT(NL80211_IFTYPE_AP) }, - { .max = 1, .types = BIT(NL80211_IFTYPE_STATION) }, -}; - -static const struct ieee80211_iface_combination ap_if_comb = { - .limits = ap_if_limits, - .n_limits = ARRAY_SIZE(ap_if_limits), - .max_interfaces = 8, - .num_different_channels = 1, -}; - - -static int mwl8k_firmware_load_success(struct mwl8k_priv *priv) -{ - struct ieee80211_hw *hw = priv->hw; - int i, rc; - - rc = mwl8k_load_firmware(hw); - mwl8k_release_firmware(priv); - if (rc) { - wiphy_err(hw->wiphy, "Cannot start firmware\n"); - return rc; - } - - /* - * Extra headroom is the size of the required DMA header - * minus the size of the smallest 802.11 frame (CTS frame). - */ - hw->extra_tx_headroom = - sizeof(struct mwl8k_dma_data) - sizeof(struct ieee80211_cts); - - hw->extra_tx_headroom -= priv->ap_fw ? REDUCED_TX_HEADROOM : 0; - - hw->channel_change_time = 10; - - hw->queues = MWL8K_TX_WMM_QUEUES; - - /* Set rssi values to dBm */ - hw->flags |= IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_HAS_RATE_CONTROL; - - /* - * Ask mac80211 to not to trigger PS mode - * based on PM bit of incoming frames. - */ - if (priv->ap_fw) - hw->flags |= IEEE80211_HW_AP_LINK_PS; - - hw->vif_data_size = sizeof(struct mwl8k_vif); - hw->sta_data_size = sizeof(struct mwl8k_sta); - - priv->macids_used = 0; - INIT_LIST_HEAD(&priv->vif_list); - - /* Set default radio state and preamble */ - priv->radio_on = false; - priv->radio_short_preamble = false; - - /* Finalize join worker */ - INIT_WORK(&priv->finalize_join_worker, mwl8k_finalize_join_worker); - /* Handle watchdog ba events */ - INIT_WORK(&priv->watchdog_ba_handle, mwl8k_watchdog_ba_events); - /* To reload the firmware if it crashes */ - INIT_WORK(&priv->fw_reload, mwl8k_hw_restart_work); - - /* TX reclaim and RX tasklets. */ - tasklet_init(&priv->poll_tx_task, mwl8k_tx_poll, (unsigned long)hw); - tasklet_disable(&priv->poll_tx_task); - tasklet_init(&priv->poll_rx_task, mwl8k_rx_poll, (unsigned long)hw); - tasklet_disable(&priv->poll_rx_task); - - /* Power management cookie */ - priv->cookie = pci_alloc_consistent(priv->pdev, 4, &priv->cookie_dma); - if (priv->cookie == NULL) - return -ENOMEM; - - mutex_init(&priv->fw_mutex); - priv->fw_mutex_owner = NULL; - priv->fw_mutex_depth = 0; - priv->hostcmd_wait = NULL; - - spin_lock_init(&priv->tx_lock); - - spin_lock_init(&priv->stream_lock); - - priv->tx_wait = NULL; - - rc = mwl8k_probe_hw(hw); - if (rc) - goto err_free_cookie; - - hw->wiphy->interface_modes = 0; - - if (priv->ap_macids_supported || priv->device_info->fw_image_ap) { - hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP); - hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_STATION); - hw->wiphy->iface_combinations = &ap_if_comb; - hw->wiphy->n_iface_combinations = 1; - } - - if (priv->sta_macids_supported || priv->device_info->fw_image_sta) - hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_STATION); - - rc = ieee80211_register_hw(hw); - if (rc) { - wiphy_err(hw->wiphy, "Cannot register device\n"); - goto err_unprobe_hw; - } - - return 0; - -err_unprobe_hw: - for (i = 0; i < mwl8k_tx_queues(priv); i++) - mwl8k_txq_deinit(hw, i); - mwl8k_rxq_deinit(hw, 0); - -err_free_cookie: - if (priv->cookie != NULL) - pci_free_consistent(priv->pdev, 4, - priv->cookie, priv->cookie_dma); - - return rc; -} -static int mwl8k_probe(struct pci_dev *pdev, - const struct pci_device_id *id) -{ - static int printed_version; - struct ieee80211_hw *hw; - struct mwl8k_priv *priv; - struct mwl8k_device_info *di; - int rc; - - if (!printed_version) { - printk(KERN_INFO "%s version %s\n", MWL8K_DESC, MWL8K_VERSION); - printed_version = 1; - } - - - rc = pci_enable_device(pdev); - if (rc) { - printk(KERN_ERR "%s: Cannot enable new PCI device\n", - MWL8K_NAME); - return rc; - } - - rc = pci_request_regions(pdev, MWL8K_NAME); - if (rc) { - printk(KERN_ERR "%s: Cannot obtain PCI resources\n", - MWL8K_NAME); - goto err_disable_device; - } - - pci_set_master(pdev); - - - hw = ieee80211_alloc_hw(sizeof(*priv), &mwl8k_ops); - if (hw == NULL) { - printk(KERN_ERR "%s: ieee80211 alloc failed\n", MWL8K_NAME); - rc = -ENOMEM; - goto err_free_reg; - } - - SET_IEEE80211_DEV(hw, &pdev->dev); - pci_set_drvdata(pdev, hw); - - priv = hw->priv; - priv->hw = hw; - priv->pdev = pdev; - priv->device_info = &mwl8k_info_tbl[id->driver_data]; - - if (id->driver_data == MWL8764) - priv->is_8764 = true; - - priv->sram = pci_iomap(pdev, 0, 0x10000); - if (priv->sram == NULL) { - wiphy_err(hw->wiphy, "Cannot map device SRAM\n"); - rc = -EIO; - goto err_iounmap; - } - - /* - * If BAR0 is a 32 bit BAR, the register BAR will be BAR1. - * If BAR0 is a 64 bit BAR, the register BAR will be BAR2. - */ - priv->regs = pci_iomap(pdev, 1, 0x10000); - if (priv->regs == NULL) { - priv->regs = pci_iomap(pdev, 2, 0x10000); - if (priv->regs == NULL) { - wiphy_err(hw->wiphy, "Cannot map device registers\n"); - rc = -EIO; - goto err_iounmap; - } - } - - /* - * Choose the initial fw image depending on user input. If a second - * image is available, make it the alternative image that will be - * loaded if the first one fails. - */ - init_completion(&priv->firmware_loading_complete); - di = priv->device_info; - if (ap_mode_default && di->fw_image_ap) { - priv->fw_pref = di->fw_image_ap; - priv->fw_alt = di->fw_image_sta; - } else if (!ap_mode_default && di->fw_image_sta) { - priv->fw_pref = di->fw_image_sta; - priv->fw_alt = di->fw_image_ap; - } else if (ap_mode_default && !di->fw_image_ap && di->fw_image_sta) { - printk(KERN_WARNING "AP fw is unavailable. Using STA fw."); - priv->fw_pref = di->fw_image_sta; - } else if (!ap_mode_default && !di->fw_image_sta && di->fw_image_ap) { - printk(KERN_WARNING "STA fw is unavailable. Using AP fw."); - priv->fw_pref = di->fw_image_ap; - } - rc = mwl8k_init_firmware(hw, priv->fw_pref, true); - if (rc) - goto err_stop_firmware; - - priv->hw_restart_in_progress = false; - - priv->running_bsses = 0; - - return rc; - -err_stop_firmware: - mwl8k_hw_reset(priv); - -err_iounmap: - if (priv->regs != NULL) - pci_iounmap(pdev, priv->regs); - - if (priv->sram != NULL) - pci_iounmap(pdev, priv->sram); - - pci_set_drvdata(pdev, NULL); - ieee80211_free_hw(hw); - -err_free_reg: - pci_release_regions(pdev); - -err_disable_device: - pci_disable_device(pdev); - - return rc; -} - -static void mwl8k_remove(struct pci_dev *pdev) -{ - struct ieee80211_hw *hw = pci_get_drvdata(pdev); - struct mwl8k_priv *priv; - int i; - - if (hw == NULL) - return; - priv = hw->priv; - - wait_for_completion(&priv->firmware_loading_complete); - - if (priv->fw_state == FW_STATE_ERROR) { - mwl8k_hw_reset(priv); - goto unmap; - } - - ieee80211_stop_queues(hw); - - ieee80211_unregister_hw(hw); - - /* Remove TX reclaim and RX tasklets. */ - tasklet_kill(&priv->poll_tx_task); - tasklet_kill(&priv->poll_rx_task); - - /* Stop hardware */ - mwl8k_hw_reset(priv); - - /* Return all skbs to mac80211 */ - for (i = 0; i < mwl8k_tx_queues(priv); i++) - mwl8k_txq_reclaim(hw, i, INT_MAX, 1); - - for (i = 0; i < mwl8k_tx_queues(priv); i++) - mwl8k_txq_deinit(hw, i); - - mwl8k_rxq_deinit(hw, 0); - - pci_free_consistent(priv->pdev, 4, priv->cookie, priv->cookie_dma); - -unmap: - pci_iounmap(pdev, priv->regs); - pci_iounmap(pdev, priv->sram); - pci_set_drvdata(pdev, NULL); - ieee80211_free_hw(hw); - pci_release_regions(pdev); - pci_disable_device(pdev); -} - -static struct pci_driver mwl8k_driver = { - .name = MWL8K_NAME, - .id_table = mwl8k_pci_id_table, - .probe = mwl8k_probe, - .remove = mwl8k_remove, -}; - -module_pci_driver(mwl8k_driver); - -MODULE_DESCRIPTION(MWL8K_DESC); -MODULE_VERSION(MWL8K_VERSION); -MODULE_AUTHOR("Lennert Buytenhek "); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/orinoco/Kconfig b/drivers/net/wireless/orinoco/Kconfig deleted file mode 100644 index 60819bcf4377..000000000000 --- a/drivers/net/wireless/orinoco/Kconfig +++ /dev/null @@ -1,141 +0,0 @@ -config HERMES - tristate "Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)" - depends on (PPC_PMAC || PCI || PCMCIA) - depends on CFG80211 && CFG80211_WEXT - select WIRELESS_EXT - select WEXT_SPY - select WEXT_PRIV - select FW_LOADER - select CRYPTO - select CRYPTO_MICHAEL_MIC - ---help--- - A driver for 802.11b wireless cards based on the "Hermes" or - Intersil HFA384x (Prism 2) MAC controller. This includes the vast - majority of the PCMCIA 802.11b cards (which are nearly all rebadges) - - except for the Cisco/Aironet cards. Cards supported include the - Apple Airport (not a PCMCIA card), WavelanIEEE/Orinoco, - Cabletron/EnteraSys Roamabout, ELSA AirLancer, MELCO Buffalo, Avaya, - IBM High Rate Wireless, Farralon Syyline, Samsung MagicLAN, Netgear - MA401, LinkSys WPC-11, D-Link DWL-650, 3Com AirConnect, Intel - IPW2011, and Symbol Spectrum24 High Rate amongst others. - - This option includes the guts of the driver, but in order to - actually use a card you will also need to enable support for PCMCIA - Hermes cards, PLX9052 based PCI adaptors or the Apple Airport below. - - You will also very likely also need the Wireless Tools in order to - configure your card and that /etc/pcmcia/wireless.opts works : - - -config HERMES_PRISM - bool "Support Prism 2/2.5 chipset" - depends on HERMES - ---help--- - - Say Y to enable support for Prism 2 and 2.5 chipsets. These - chipsets are better handled by the hostap driver. This driver - would not support WPA or firmware download for Prism chipset. - - If you are not sure, say N. - -config HERMES_CACHE_FW_ON_INIT - bool "Cache Hermes firmware on driver initialisation" - depends on HERMES - default y - ---help--- - Say Y to cache any firmware required by the Hermes drivers - on startup. The firmware will remain cached until the - driver is unloaded. The cache uses 64K of RAM. - - Otherwise load the firmware from userspace as required. In - this case the driver should be unloaded and restarted - whenever the firmware is changed. - - If you are not sure, say Y. - -config APPLE_AIRPORT - tristate "Apple Airport support (built-in)" - depends on PPC_PMAC && HERMES - help - Say Y here to support the Airport 802.11b wireless Ethernet hardware - built into the Macintosh iBook and other recent PowerPC-based - Macintosh machines. This is essentially a Lucent Orinoco card with - a non-standard interface. - - This driver does not support the Airport Extreme (802.11b/g). Use - the BCM43xx driver for Airport Extreme cards. - -config PLX_HERMES - tristate "Hermes in PLX9052 based PCI adaptor support (Netgear MA301 etc.)" - depends on PCI && HERMES - help - Enable support for PCMCIA cards supported by the "Hermes" (aka - orinoco) driver when used in PLX9052 based PCI adaptors. These - adaptors are not a full PCMCIA controller but act as a more limited - PCI <-> PCMCIA bridge. Several vendors sell such adaptors so that - 802.11b PCMCIA cards can be used in desktop machines. The Netgear - MA301 is such an adaptor. - -config TMD_HERMES - tristate "Hermes in TMD7160 based PCI adaptor support" - depends on PCI && HERMES - help - Enable support for PCMCIA cards supported by the "Hermes" (aka - orinoco) driver when used in TMD7160 based PCI adaptors. These - adaptors are not a full PCMCIA controller but act as a more limited - PCI <-> PCMCIA bridge. Several vendors sell such adaptors so that - 802.11b PCMCIA cards can be used in desktop machines. - -config NORTEL_HERMES - tristate "Nortel emobility PCI adaptor support" - depends on PCI && HERMES - help - Enable support for PCMCIA cards supported by the "Hermes" (aka - orinoco) driver when used in Nortel emobility PCI adaptors. These - adaptors are not full PCMCIA controllers, but act as a more limited - PCI <-> PCMCIA bridge. - -config PCI_HERMES - tristate "Prism 2.5 PCI 802.11b adaptor support" - depends on PCI && HERMES && HERMES_PRISM - help - Enable support for PCI and mini-PCI 802.11b wireless NICs based on - the Prism 2.5 chipset. These are true PCI cards, not the 802.11b - PCMCIA cards bundled with PCI<->PCMCIA adaptors which are also - common. Some of the built-in wireless adaptors in laptops are of - this variety. - -config PCMCIA_HERMES - tristate "Hermes PCMCIA card support" - depends on PCMCIA && HERMES - ---help--- - A driver for "Hermes" chipset based PCMCIA wireless adaptors, such - as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/ - EnteraSys RoamAbout 802.11, ELSA Airlancer, Melco Buffalo and - others). It should also be usable on various Prism II based cards - such as the Linksys, D-Link and Farallon Skyline. It should also - work on Symbol cards such as the 3Com AirConnect and Ericsson WLAN. - - You will very likely need the Wireless Tools in order to - configure your card and that /etc/pcmcia/wireless.opts works: - . - -config PCMCIA_SPECTRUM - tristate "Symbol Spectrum24 Trilogy PCMCIA card support" - depends on PCMCIA && HERMES - ---help--- - - This is a driver for 802.11b cards using RAM-loadable Symbol - firmware, such as Symbol Wireless Networker LA4100, CompactFlash - cards by Socket Communications and Intel PRO/Wireless 2011B. - - This driver requires firmware download on startup. Utilities - for downloading Symbol firmware are available at - - -config ORINOCO_USB - tristate "Agere Orinoco USB support" - depends on USB && HERMES - select FW_LOADER - ---help--- - This driver is for USB versions of the Agere Orinoco card. diff --git a/drivers/net/wireless/orinoco/Makefile b/drivers/net/wireless/orinoco/Makefile deleted file mode 100644 index bfdefb85abcd..000000000000 --- a/drivers/net/wireless/orinoco/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# -# Makefile for the orinoco wireless device drivers. -# -orinoco-objs := main.o fw.o hw.o mic.o scan.o wext.o hermes_dld.o hermes.o cfg.o - -obj-$(CONFIG_HERMES) += orinoco.o -obj-$(CONFIG_PCMCIA_HERMES) += orinoco_cs.o -obj-$(CONFIG_APPLE_AIRPORT) += airport.o -obj-$(CONFIG_PLX_HERMES) += orinoco_plx.o -obj-$(CONFIG_PCI_HERMES) += orinoco_pci.o -obj-$(CONFIG_TMD_HERMES) += orinoco_tmd.o -obj-$(CONFIG_NORTEL_HERMES) += orinoco_nortel.o -obj-$(CONFIG_PCMCIA_SPECTRUM) += spectrum_cs.o -obj-$(CONFIG_ORINOCO_USB) += orinoco_usb.o - -# Orinoco should be endian clean. -ccflags-y += -D__CHECK_ENDIAN__ diff --git a/drivers/net/wireless/orinoco/airport.c b/drivers/net/wireless/orinoco/airport.c deleted file mode 100644 index 0ca8b1455cd9..000000000000 --- a/drivers/net/wireless/orinoco/airport.c +++ /dev/null @@ -1,267 +0,0 @@ -/* airport.c - * - * A driver for "Hermes" chipset based Apple Airport wireless - * card. - * - * Copyright notice & release notes in file main.c - * - * Note specific to airport stub: - * - * 0.05 : first version of the new split driver - * 0.06 : fix possible hang on powerup, add sleep support - */ - -#define DRIVER_NAME "airport" -#define PFX DRIVER_NAME ": " - -#include -#include -#include -#include -#include - -#include "orinoco.h" - -#define AIRPORT_IO_LEN (0x1000) /* one page */ - -struct airport { - struct macio_dev *mdev; - void __iomem *vaddr; - unsigned int irq; - int irq_requested; - int ndev_registered; -}; - -static int -airport_suspend(struct macio_dev *mdev, pm_message_t state) -{ - struct orinoco_private *priv = dev_get_drvdata(&mdev->ofdev.dev); - struct net_device *dev = priv->ndev; - struct airport *card = priv->card; - unsigned long flags; - int err; - - printk(KERN_DEBUG "%s: Airport entering sleep mode\n", dev->name); - - err = orinoco_lock(priv, &flags); - if (err) { - printk(KERN_ERR "%s: hw_unavailable on PBOOK_SLEEP_NOW\n", - dev->name); - return 0; - } - - orinoco_down(priv); - orinoco_unlock(priv, &flags); - - disable_irq(card->irq); - pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, - macio_get_of_node(mdev), 0, 0); - - return 0; -} - -static int -airport_resume(struct macio_dev *mdev) -{ - struct orinoco_private *priv = dev_get_drvdata(&mdev->ofdev.dev); - struct net_device *dev = priv->ndev; - struct airport *card = priv->card; - unsigned long flags; - int err; - - printk(KERN_DEBUG "%s: Airport waking up\n", dev->name); - - pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, - macio_get_of_node(mdev), 0, 1); - msleep(200); - - enable_irq(card->irq); - - priv->hw.ops->lock_irqsave(&priv->lock, &flags); - err = orinoco_up(priv); - priv->hw.ops->unlock_irqrestore(&priv->lock, &flags); - - return err; -} - -static int -airport_detach(struct macio_dev *mdev) -{ - struct orinoco_private *priv = dev_get_drvdata(&mdev->ofdev.dev); - struct airport *card = priv->card; - - if (card->ndev_registered) - orinoco_if_del(priv); - card->ndev_registered = 0; - - if (card->irq_requested) - free_irq(card->irq, priv); - card->irq_requested = 0; - - if (card->vaddr) - iounmap(card->vaddr); - card->vaddr = NULL; - - macio_release_resource(mdev, 0); - - pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, - macio_get_of_node(mdev), 0, 0); - ssleep(1); - - macio_set_drvdata(mdev, NULL); - free_orinocodev(priv); - - return 0; -} - -static int airport_hard_reset(struct orinoco_private *priv) -{ - /* It would be nice to power cycle the Airport for a real hard - * reset, but for some reason although it appears to - * re-initialize properly, it falls in a screaming heap - * shortly afterwards. */ -#if 0 - struct airport *card = priv->card; - - /* Vitally important. If we don't do this it seems we get an - * interrupt somewhere during the power cycle, since - * hw_unavailable is already set it doesn't get ACKed, we get - * into an interrupt loop and the PMU decides to turn us - * off. */ - disable_irq(card->irq); - - pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, - macio_get_of_node(card->mdev), 0, 0); - ssleep(1); - pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, - macio_get_of_node(card->mdev), 0, 1); - ssleep(1); - - enable_irq(card->irq); - ssleep(1); -#endif - - return 0; -} - -static int -airport_attach(struct macio_dev *mdev, const struct of_device_id *match) -{ - struct orinoco_private *priv; - struct airport *card; - unsigned long phys_addr; - struct hermes *hw; - - if (macio_resource_count(mdev) < 1 || macio_irq_count(mdev) < 1) { - printk(KERN_ERR PFX "Wrong interrupt/addresses in OF tree\n"); - return -ENODEV; - } - - /* Allocate space for private device-specific data */ - priv = alloc_orinocodev(sizeof(*card), &mdev->ofdev.dev, - airport_hard_reset, NULL); - if (!priv) { - printk(KERN_ERR PFX "Cannot allocate network device\n"); - return -ENODEV; - } - card = priv->card; - - hw = &priv->hw; - card->mdev = mdev; - - if (macio_request_resource(mdev, 0, DRIVER_NAME)) { - printk(KERN_ERR PFX "can't request IO resource !\n"); - free_orinocodev(priv); - return -EBUSY; - } - - macio_set_drvdata(mdev, priv); - - /* Setup interrupts & base address */ - card->irq = macio_irq(mdev, 0); - phys_addr = macio_resource_start(mdev, 0); /* Physical address */ - printk(KERN_DEBUG PFX "Physical address %lx\n", phys_addr); - card->vaddr = ioremap(phys_addr, AIRPORT_IO_LEN); - if (!card->vaddr) { - printk(KERN_ERR PFX "ioremap() failed\n"); - goto failed; - } - - hermes_struct_init(hw, card->vaddr, HERMES_16BIT_REGSPACING); - - /* Power up card */ - pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, - macio_get_of_node(mdev), 0, 1); - ssleep(1); - - /* Reset it before we get the interrupt */ - hw->ops->init(hw); - - if (request_irq(card->irq, orinoco_interrupt, 0, DRIVER_NAME, priv)) { - printk(KERN_ERR PFX "Couldn't get IRQ %d\n", card->irq); - goto failed; - } - card->irq_requested = 1; - - /* Initialise the main driver */ - if (orinoco_init(priv) != 0) { - printk(KERN_ERR PFX "orinoco_init() failed\n"); - goto failed; - } - - /* Register an interface with the stack */ - if (orinoco_if_add(priv, phys_addr, card->irq, NULL) != 0) { - printk(KERN_ERR PFX "orinoco_if_add() failed\n"); - goto failed; - } - card->ndev_registered = 1; - return 0; - failed: - airport_detach(mdev); - return -ENODEV; -} /* airport_attach */ - - -static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION - " (Benjamin Herrenschmidt )"; -MODULE_AUTHOR("Benjamin Herrenschmidt "); -MODULE_DESCRIPTION("Driver for the Apple Airport wireless card."); -MODULE_LICENSE("Dual MPL/GPL"); - -static struct of_device_id airport_match[] = { - { - .name = "radio", - }, - {}, -}; - -MODULE_DEVICE_TABLE(of, airport_match); - -static struct macio_driver airport_driver = { - .driver = { - .name = DRIVER_NAME, - .owner = THIS_MODULE, - .of_match_table = airport_match, - }, - .probe = airport_attach, - .remove = airport_detach, - .suspend = airport_suspend, - .resume = airport_resume, -}; - -static int __init -init_airport(void) -{ - printk(KERN_DEBUG "%s\n", version); - - return macio_register_driver(&airport_driver); -} - -static void __exit -exit_airport(void) -{ - macio_unregister_driver(&airport_driver); -} - -module_init(init_airport); -module_exit(exit_airport); diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c deleted file mode 100644 index d01edd2c50c5..000000000000 --- a/drivers/net/wireless/orinoco/cfg.c +++ /dev/null @@ -1,290 +0,0 @@ -/* cfg80211 support - * - * See copyright notice in main.c - */ -#include -#include -#include "hw.h" -#include "main.h" -#include "orinoco.h" - -#include "cfg.h" - -/* Supported bitrates. Must agree with hw.c */ -static struct ieee80211_rate orinoco_rates[] = { - { .bitrate = 10 }, - { .bitrate = 20 }, - { .bitrate = 55 }, - { .bitrate = 110 }, -}; - -static const void * const orinoco_wiphy_privid = &orinoco_wiphy_privid; - -/* Called after orinoco_private is allocated. */ -void orinoco_wiphy_init(struct wiphy *wiphy) -{ - struct orinoco_private *priv = wiphy_priv(wiphy); - - wiphy->privid = orinoco_wiphy_privid; - - set_wiphy_dev(wiphy, priv->dev); -} - -/* Called after firmware is initialised */ -int orinoco_wiphy_register(struct wiphy *wiphy) -{ - struct orinoco_private *priv = wiphy_priv(wiphy); - int i, channels = 0; - - if (priv->firmware_type == FIRMWARE_TYPE_AGERE) - wiphy->max_scan_ssids = 1; - else - wiphy->max_scan_ssids = 0; - - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); - - /* TODO: should we set if we only have demo ad-hoc? - * (priv->has_port3) - */ - if (priv->has_ibss) - wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); - - if (!priv->broken_monitor || force_monitor) - wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); - - priv->band.bitrates = orinoco_rates; - priv->band.n_bitrates = ARRAY_SIZE(orinoco_rates); - - /* Only support channels allowed by the card EEPROM */ - for (i = 0; i < NUM_CHANNELS; i++) { - if (priv->channel_mask & (1 << i)) { - priv->channels[i].center_freq = - ieee80211_dsss_chan_to_freq(i + 1); - channels++; - } - } - priv->band.channels = priv->channels; - priv->band.n_channels = channels; - - wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band; - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - - i = 0; - if (priv->has_wep) { - priv->cipher_suites[i] = WLAN_CIPHER_SUITE_WEP40; - i++; - - if (priv->has_big_wep) { - priv->cipher_suites[i] = WLAN_CIPHER_SUITE_WEP104; - i++; - } - } - if (priv->has_wpa) { - priv->cipher_suites[i] = WLAN_CIPHER_SUITE_TKIP; - i++; - } - wiphy->cipher_suites = priv->cipher_suites; - wiphy->n_cipher_suites = i; - - wiphy->rts_threshold = priv->rts_thresh; - if (!priv->has_mwo) - wiphy->frag_threshold = priv->frag_thresh + 1; - wiphy->retry_short = priv->short_retry_limit; - wiphy->retry_long = priv->long_retry_limit; - - return wiphy_register(wiphy); -} - -static int orinoco_change_vif(struct wiphy *wiphy, struct net_device *dev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -{ - struct orinoco_private *priv = wiphy_priv(wiphy); - int err = 0; - unsigned long lock; - - if (orinoco_lock(priv, &lock) != 0) - return -EBUSY; - - switch (type) { - case NL80211_IFTYPE_ADHOC: - if (!priv->has_ibss && !priv->has_port3) - err = -EINVAL; - break; - - case NL80211_IFTYPE_STATION: - break; - - case NL80211_IFTYPE_MONITOR: - if (priv->broken_monitor && !force_monitor) { - wiphy_warn(wiphy, - "Monitor mode support is buggy in this firmware, not enabling\n"); - err = -EINVAL; - } - break; - - default: - err = -EINVAL; - } - - if (!err) { - priv->iw_mode = type; - set_port_type(priv); - err = orinoco_commit(priv); - } - - orinoco_unlock(priv, &lock); - - return err; -} - -static int orinoco_scan(struct wiphy *wiphy, - struct cfg80211_scan_request *request) -{ - struct orinoco_private *priv = wiphy_priv(wiphy); - int err; - - if (!request) - return -EINVAL; - - if (priv->scan_request && priv->scan_request != request) - return -EBUSY; - - priv->scan_request = request; - - err = orinoco_hw_trigger_scan(priv, request->ssids); - /* On error the we aren't processing the request */ - if (err) - priv->scan_request = NULL; - - return err; -} - -static int orinoco_set_monitor_channel(struct wiphy *wiphy, - struct cfg80211_chan_def *chandef) -{ - struct orinoco_private *priv = wiphy_priv(wiphy); - int err = 0; - unsigned long flags; - int channel; - - if (!chandef->chan) - return -EINVAL; - - if (cfg80211_get_chandef_type(chandef) != NL80211_CHAN_NO_HT) - return -EINVAL; - - if (chandef->chan->band != IEEE80211_BAND_2GHZ) - return -EINVAL; - - channel = ieee80211_freq_to_dsss_chan(chandef->chan->center_freq); - - if ((channel < 1) || (channel > NUM_CHANNELS) || - !(priv->channel_mask & (1 << (channel - 1)))) - return -EINVAL; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - priv->channel = channel; - if (priv->iw_mode == NL80211_IFTYPE_MONITOR) { - /* Fast channel change - no commit if successful */ - struct hermes *hw = &priv->hw; - err = hw->ops->cmd_wait(hw, HERMES_CMD_TEST | - HERMES_TEST_SET_CHANNEL, - channel, NULL); - } - orinoco_unlock(priv, &flags); - - return err; -} - -static int orinoco_set_wiphy_params(struct wiphy *wiphy, u32 changed) -{ - struct orinoco_private *priv = wiphy_priv(wiphy); - int frag_value = -1; - int rts_value = -1; - int err = 0; - - if (changed & WIPHY_PARAM_RETRY_SHORT) { - /* Setting short retry not supported */ - err = -EINVAL; - } - - if (changed & WIPHY_PARAM_RETRY_LONG) { - /* Setting long retry not supported */ - err = -EINVAL; - } - - if (changed & WIPHY_PARAM_FRAG_THRESHOLD) { - /* Set fragmentation */ - if (priv->has_mwo) { - if (wiphy->frag_threshold < 0) - frag_value = 0; - else { - printk(KERN_WARNING "%s: Fixed fragmentation " - "is not supported on this firmware. " - "Using MWO robust instead.\n", - priv->ndev->name); - frag_value = 1; - } - } else { - if (wiphy->frag_threshold < 0) - frag_value = 2346; - else if ((wiphy->frag_threshold < 257) || - (wiphy->frag_threshold > 2347)) - err = -EINVAL; - else - /* cfg80211 value is 257-2347 (odd only) - * orinoco rid has range 256-2346 (even only) */ - frag_value = wiphy->frag_threshold & ~0x1; - } - } - - if (changed & WIPHY_PARAM_RTS_THRESHOLD) { - /* Set RTS. - * - * Prism documentation suggests default of 2432, - * and a range of 0-3000. - * - * Current implementation uses 2347 as the default and - * the upper limit. - */ - - if (wiphy->rts_threshold < 0) - rts_value = 2347; - else if (wiphy->rts_threshold > 2347) - err = -EINVAL; - else - rts_value = wiphy->rts_threshold; - } - - if (!err) { - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - if (frag_value >= 0) { - if (priv->has_mwo) - priv->mwo_robust = frag_value; - else - priv->frag_thresh = frag_value; - } - if (rts_value >= 0) - priv->rts_thresh = rts_value; - - err = orinoco_commit(priv); - - orinoco_unlock(priv, &flags); - } - - return err; -} - -const struct cfg80211_ops orinoco_cfg_ops = { - .change_virtual_intf = orinoco_change_vif, - .set_monitor_channel = orinoco_set_monitor_channel, - .scan = orinoco_scan, - .set_wiphy_params = orinoco_set_wiphy_params, -}; diff --git a/drivers/net/wireless/orinoco/cfg.h b/drivers/net/wireless/orinoco/cfg.h deleted file mode 100644 index 3ddc96a06cd7..000000000000 --- a/drivers/net/wireless/orinoco/cfg.h +++ /dev/null @@ -1,15 +0,0 @@ -/* cfg80211 support. - * - * See copyright notice in main.c - */ -#ifndef ORINOCO_CFG_H -#define ORINOCO_CFG_H - -#include - -extern const struct cfg80211_ops orinoco_cfg_ops; - -void orinoco_wiphy_init(struct wiphy *wiphy); -int orinoco_wiphy_register(struct wiphy *wiphy); - -#endif /* ORINOCO_CFG_H */ diff --git a/drivers/net/wireless/orinoco/fw.c b/drivers/net/wireless/orinoco/fw.c deleted file mode 100644 index 400a35217644..000000000000 --- a/drivers/net/wireless/orinoco/fw.c +++ /dev/null @@ -1,387 +0,0 @@ -/* Firmware file reading and download helpers - * - * See copyright notice in main.c - */ -#include -#include -#include -#include -#include - -#include "hermes.h" -#include "hermes_dld.h" -#include "orinoco.h" - -#include "fw.h" - -/* End markers (for Symbol firmware only) */ -#define TEXT_END 0x1A /* End of text header */ - -struct fw_info { - char *pri_fw; - char *sta_fw; - char *ap_fw; - u32 pda_addr; - u16 pda_size; -}; - -static const struct fw_info orinoco_fw[] = { - { NULL, "agere_sta_fw.bin", "agere_ap_fw.bin", 0x00390000, 1000 }, - { NULL, "prism_sta_fw.bin", "prism_ap_fw.bin", 0, 1024 }, - { "symbol_sp24t_prim_fw", "symbol_sp24t_sec_fw", NULL, 0x00003100, 512 } -}; -MODULE_FIRMWARE("agere_sta_fw.bin"); -MODULE_FIRMWARE("agere_ap_fw.bin"); -MODULE_FIRMWARE("prism_sta_fw.bin"); -MODULE_FIRMWARE("prism_ap_fw.bin"); -MODULE_FIRMWARE("symbol_sp24t_prim_fw"); -MODULE_FIRMWARE("symbol_sp24t_sec_fw"); - -/* Structure used to access fields in FW - * Make sure LE decoding macros are used - */ -struct orinoco_fw_header { - char hdr_vers[6]; /* ASCII string for header version */ - __le16 headersize; /* Total length of header */ - __le32 entry_point; /* NIC entry point */ - __le32 blocks; /* Number of blocks to program */ - __le32 block_offset; /* Offset of block data from eof header */ - __le32 pdr_offset; /* Offset to PDR data from eof header */ - __le32 pri_offset; /* Offset to primary plug data */ - __le32 compat_offset; /* Offset to compatibility data*/ - char signature[0]; /* FW signature length headersize-20 */ -} __packed; - -/* Check the range of various header entries. Return a pointer to a - * description of the problem, or NULL if everything checks out. */ -static const char *validate_fw(const struct orinoco_fw_header *hdr, size_t len) -{ - u16 hdrsize; - - if (len < sizeof(*hdr)) - return "image too small"; - if (memcmp(hdr->hdr_vers, "HFW", 3) != 0) - return "format not recognised"; - - hdrsize = le16_to_cpu(hdr->headersize); - if (hdrsize > len) - return "bad headersize"; - if ((hdrsize + le32_to_cpu(hdr->block_offset)) > len) - return "bad block offset"; - if ((hdrsize + le32_to_cpu(hdr->pdr_offset)) > len) - return "bad PDR offset"; - if ((hdrsize + le32_to_cpu(hdr->pri_offset)) > len) - return "bad PRI offset"; - if ((hdrsize + le32_to_cpu(hdr->compat_offset)) > len) - return "bad compat offset"; - - /* TODO: consider adding a checksum or CRC to the firmware format */ - return NULL; -} - -#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP) -static inline const struct firmware * -orinoco_cached_fw_get(struct orinoco_private *priv, bool primary) -{ - if (primary) - return priv->cached_pri_fw; - else - return priv->cached_fw; -} -#else -#define orinoco_cached_fw_get(priv, primary) (NULL) -#endif - -/* Download either STA or AP firmware into the card. */ -static int -orinoco_dl_firmware(struct orinoco_private *priv, - const struct fw_info *fw, - int ap) -{ - /* Plug Data Area (PDA) */ - __le16 *pda; - - struct hermes *hw = &priv->hw; - const struct firmware *fw_entry; - const struct orinoco_fw_header *hdr; - const unsigned char *first_block; - const void *end; - const char *firmware; - const char *fw_err; - struct device *dev = priv->dev; - int err = 0; - - pda = kzalloc(fw->pda_size, GFP_KERNEL); - if (!pda) - return -ENOMEM; - - if (ap) - firmware = fw->ap_fw; - else - firmware = fw->sta_fw; - - dev_dbg(dev, "Attempting to download firmware %s\n", firmware); - - /* Read current plug data */ - err = hw->ops->read_pda(hw, pda, fw->pda_addr, fw->pda_size); - dev_dbg(dev, "Read PDA returned %d\n", err); - if (err) - goto free; - - if (!orinoco_cached_fw_get(priv, false)) { - err = request_firmware(&fw_entry, firmware, priv->dev); - - if (err) { - dev_err(dev, "Cannot find firmware %s\n", firmware); - err = -ENOENT; - goto free; - } - } else - fw_entry = orinoco_cached_fw_get(priv, false); - - hdr = (const struct orinoco_fw_header *) fw_entry->data; - - fw_err = validate_fw(hdr, fw_entry->size); - if (fw_err) { - dev_warn(dev, "Invalid firmware image detected (%s). " - "Aborting download\n", fw_err); - err = -EINVAL; - goto abort; - } - - /* Enable aux port to allow programming */ - err = hw->ops->program_init(hw, le32_to_cpu(hdr->entry_point)); - dev_dbg(dev, "Program init returned %d\n", err); - if (err != 0) - goto abort; - - /* Program data */ - first_block = (fw_entry->data + - le16_to_cpu(hdr->headersize) + - le32_to_cpu(hdr->block_offset)); - end = fw_entry->data + fw_entry->size; - - err = hermes_program(hw, first_block, end); - dev_dbg(dev, "Program returned %d\n", err); - if (err != 0) - goto abort; - - /* Update production data */ - first_block = (fw_entry->data + - le16_to_cpu(hdr->headersize) + - le32_to_cpu(hdr->pdr_offset)); - - err = hermes_apply_pda_with_defaults(hw, first_block, end, pda, - &pda[fw->pda_size / sizeof(*pda)]); - dev_dbg(dev, "Apply PDA returned %d\n", err); - if (err) - goto abort; - - /* Tell card we've finished */ - err = hw->ops->program_end(hw); - dev_dbg(dev, "Program end returned %d\n", err); - if (err != 0) - goto abort; - - /* Check if we're running */ - dev_dbg(dev, "hermes_present returned %d\n", hermes_present(hw)); - -abort: - /* If we requested the firmware, release it. */ - if (!orinoco_cached_fw_get(priv, false)) - release_firmware(fw_entry); - -free: - kfree(pda); - return err; -} - -/* - * Process a firmware image - stop the card, load the firmware, reset - * the card and make sure it responds. For the secondary firmware take - * care of the PDA - read it and then write it on top of the firmware. - */ -static int -symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw, - const unsigned char *image, const void *end, - int secondary) -{ - struct hermes *hw = &priv->hw; - int ret = 0; - const unsigned char *ptr; - const unsigned char *first_block; - - /* Plug Data Area (PDA) */ - __le16 *pda = NULL; - - /* Binary block begins after the 0x1A marker */ - ptr = image; - while (*ptr++ != TEXT_END); - first_block = ptr; - - /* Read the PDA from EEPROM */ - if (secondary) { - pda = kzalloc(fw->pda_size, GFP_KERNEL); - if (!pda) - return -ENOMEM; - - ret = hw->ops->read_pda(hw, pda, fw->pda_addr, fw->pda_size); - if (ret) - goto free; - } - - /* Stop the firmware, so that it can be safely rewritten */ - if (priv->stop_fw) { - ret = priv->stop_fw(priv, 1); - if (ret) - goto free; - } - - /* Program the adapter with new firmware */ - ret = hermes_program(hw, first_block, end); - if (ret) - goto free; - - /* Write the PDA to the adapter */ - if (secondary) { - size_t len = hermes_blocks_length(first_block, end); - ptr = first_block + len; - ret = hermes_apply_pda(hw, ptr, end, pda, - &pda[fw->pda_size / sizeof(*pda)]); - kfree(pda); - if (ret) - return ret; - } - - /* Run the firmware */ - if (priv->stop_fw) { - ret = priv->stop_fw(priv, 0); - if (ret) - return ret; - } - - /* Reset hermes chip and make sure it responds */ - ret = hw->ops->init(hw); - - /* hermes_reset() should return 0 with the secondary firmware */ - if (secondary && ret != 0) - return -ENODEV; - - /* And this should work with any firmware */ - if (!hermes_present(hw)) - return -ENODEV; - - return 0; - -free: - kfree(pda); - return ret; -} - - -/* - * Download the firmware into the card, this also does a PCMCIA soft - * reset on the card, to make sure it's in a sane state. - */ -static int -symbol_dl_firmware(struct orinoco_private *priv, - const struct fw_info *fw) -{ - struct device *dev = priv->dev; - int ret; - const struct firmware *fw_entry; - - if (!orinoco_cached_fw_get(priv, true)) { - if (request_firmware(&fw_entry, fw->pri_fw, priv->dev) != 0) { - dev_err(dev, "Cannot find firmware: %s\n", fw->pri_fw); - return -ENOENT; - } - } else - fw_entry = orinoco_cached_fw_get(priv, true); - - /* Load primary firmware */ - ret = symbol_dl_image(priv, fw, fw_entry->data, - fw_entry->data + fw_entry->size, 0); - - if (!orinoco_cached_fw_get(priv, true)) - release_firmware(fw_entry); - if (ret) { - dev_err(dev, "Primary firmware download failed\n"); - return ret; - } - - if (!orinoco_cached_fw_get(priv, false)) { - if (request_firmware(&fw_entry, fw->sta_fw, priv->dev) != 0) { - dev_err(dev, "Cannot find firmware: %s\n", fw->sta_fw); - return -ENOENT; - } - } else - fw_entry = orinoco_cached_fw_get(priv, false); - - /* Load secondary firmware */ - ret = symbol_dl_image(priv, fw, fw_entry->data, - fw_entry->data + fw_entry->size, 1); - if (!orinoco_cached_fw_get(priv, false)) - release_firmware(fw_entry); - if (ret) - dev_err(dev, "Secondary firmware download failed\n"); - - return ret; -} - -int orinoco_download(struct orinoco_private *priv) -{ - int err = 0; - /* Reload firmware */ - switch (priv->firmware_type) { - case FIRMWARE_TYPE_AGERE: - /* case FIRMWARE_TYPE_INTERSIL: */ - err = orinoco_dl_firmware(priv, - &orinoco_fw[priv->firmware_type], 0); - break; - - case FIRMWARE_TYPE_SYMBOL: - err = symbol_dl_firmware(priv, - &orinoco_fw[priv->firmware_type]); - break; - case FIRMWARE_TYPE_INTERSIL: - break; - } - /* TODO: if we fail we probably need to reinitialise - * the driver */ - - return err; -} - -#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP) -void orinoco_cache_fw(struct orinoco_private *priv, int ap) -{ - const struct firmware *fw_entry = NULL; - const char *pri_fw; - const char *fw; - - pri_fw = orinoco_fw[priv->firmware_type].pri_fw; - if (ap) - fw = orinoco_fw[priv->firmware_type].ap_fw; - else - fw = orinoco_fw[priv->firmware_type].sta_fw; - - if (pri_fw) { - if (request_firmware(&fw_entry, pri_fw, priv->dev) == 0) - priv->cached_pri_fw = fw_entry; - } - - if (fw) { - if (request_firmware(&fw_entry, fw, priv->dev) == 0) - priv->cached_fw = fw_entry; - } -} - -void orinoco_uncache_fw(struct orinoco_private *priv) -{ - release_firmware(priv->cached_pri_fw); - release_firmware(priv->cached_fw); - priv->cached_pri_fw = NULL; - priv->cached_fw = NULL; -} -#endif diff --git a/drivers/net/wireless/orinoco/fw.h b/drivers/net/wireless/orinoco/fw.h deleted file mode 100644 index aca63e3c4b5b..000000000000 --- a/drivers/net/wireless/orinoco/fw.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Firmware file reading and download helpers - * - * See copyright notice in main.c - */ -#ifndef _ORINOCO_FW_H_ -#define _ORINOCO_FW_H_ - -/* Forward declations */ -struct orinoco_private; - -int orinoco_download(struct orinoco_private *priv); - -#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP) -void orinoco_cache_fw(struct orinoco_private *priv, int ap); -void orinoco_uncache_fw(struct orinoco_private *priv); -#else -#define orinoco_cache_fw(priv, ap) do { } while (0) -#define orinoco_uncache_fw(priv) do { } while (0) -#endif - -#endif /* _ORINOCO_FW_H_ */ diff --git a/drivers/net/wireless/orinoco/hermes.c b/drivers/net/wireless/orinoco/hermes.c deleted file mode 100644 index 75c15bc7b34c..000000000000 --- a/drivers/net/wireless/orinoco/hermes.c +++ /dev/null @@ -1,778 +0,0 @@ -/* hermes.c - * - * Driver core for the "Hermes" wireless MAC controller, as used in - * the Lucent Orinoco and Cabletron RoamAbout cards. It should also - * work on the hfa3841 and hfa3842 MAC controller chips used in the - * Prism II chipsets. - * - * This is not a complete driver, just low-level access routines for - * the MAC controller itself. - * - * Based on the prism2 driver from Absolute Value Systems' linux-wlan - * project, the Linux wvlan_cs driver, Lucent's HCF-Light - * (wvlan_hcf.c) library, and the NetBSD wireless driver (in no - * particular order). - * - * Copyright (C) 2000, David Gibson, Linuxcare Australia. - * (C) Copyright David Gibson, IBM Corp. 2001-2003. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License version 2 (the "GPL"), in - * which case the provisions of the GPL are applicable instead of the - * above. If you wish to allow the use of your version of this file - * only under the terms of the GPL and not to allow others to use your - * version of this file under the MPL, indicate your decision by - * deleting the provisions above and replace them with the notice and - * other provisions required by the GPL. If you do not delete the - * provisions above, a recipient may use your version of this file - * under either the MPL or the GPL. - */ - -#include -#include -#include -#include - -#include "hermes.h" - -/* These are maximum timeouts. Most often, card wil react much faster */ -#define CMD_BUSY_TIMEOUT (100) /* In iterations of ~1us */ -#define CMD_INIT_TIMEOUT (50000) /* in iterations of ~10us */ -#define CMD_COMPL_TIMEOUT (20000) /* in iterations of ~10us */ -#define ALLOC_COMPL_TIMEOUT (1000) /* in iterations of ~10us */ - -/* - * AUX port access. To unlock the AUX port write the access keys to the - * PARAM0-2 registers, then write HERMES_AUX_ENABLE to the HERMES_CONTROL - * register. Then read it and make sure it's HERMES_AUX_ENABLED. - */ -#define HERMES_AUX_ENABLE 0x8000 /* Enable auxiliary port access */ -#define HERMES_AUX_DISABLE 0x4000 /* Disable to auxiliary port access */ -#define HERMES_AUX_ENABLED 0xC000 /* Auxiliary port is open */ -#define HERMES_AUX_DISABLED 0x0000 /* Auxiliary port is closed */ - -#define HERMES_AUX_PW0 0xFE01 -#define HERMES_AUX_PW1 0xDC23 -#define HERMES_AUX_PW2 0xBA45 - -/* HERMES_CMD_DOWNLD */ -#define HERMES_PROGRAM_DISABLE (0x0000 | HERMES_CMD_DOWNLD) -#define HERMES_PROGRAM_ENABLE_VOLATILE (0x0100 | HERMES_CMD_DOWNLD) -#define HERMES_PROGRAM_ENABLE_NON_VOLATILE (0x0200 | HERMES_CMD_DOWNLD) -#define HERMES_PROGRAM_NON_VOLATILE (0x0300 | HERMES_CMD_DOWNLD) - -/* - * Debugging helpers - */ - -#define DMSG(stuff...) do {printk(KERN_DEBUG "hermes @ %p: " , hw->iobase); \ - printk(stuff); } while (0) - -#undef HERMES_DEBUG -#ifdef HERMES_DEBUG -#include - -#define DEBUG(lvl, stuff...) if ((lvl) <= HERMES_DEBUG) DMSG(stuff) - -#else /* ! HERMES_DEBUG */ - -#define DEBUG(lvl, stuff...) do { } while (0) - -#endif /* ! HERMES_DEBUG */ - -static const struct hermes_ops hermes_ops_local; - -/* - * Internal functions - */ - -/* Issue a command to the chip. Waiting for it to complete is the caller's - problem. - - Returns -EBUSY if the command register is busy, 0 on success. - - Callable from any context. -*/ -static int hermes_issue_cmd(struct hermes *hw, u16 cmd, u16 param0, - u16 param1, u16 param2) -{ - int k = CMD_BUSY_TIMEOUT; - u16 reg; - - /* First wait for the command register to unbusy */ - reg = hermes_read_regn(hw, CMD); - while ((reg & HERMES_CMD_BUSY) && k) { - k--; - udelay(1); - reg = hermes_read_regn(hw, CMD); - } - if (reg & HERMES_CMD_BUSY) - return -EBUSY; - - hermes_write_regn(hw, PARAM2, param2); - hermes_write_regn(hw, PARAM1, param1); - hermes_write_regn(hw, PARAM0, param0); - hermes_write_regn(hw, CMD, cmd); - - return 0; -} - -/* - * Function definitions - */ - -/* For doing cmds that wipe the magic constant in SWSUPPORT0 */ -static int hermes_doicmd_wait(struct hermes *hw, u16 cmd, - u16 parm0, u16 parm1, u16 parm2, - struct hermes_response *resp) -{ - int err = 0; - int k; - u16 status, reg; - - err = hermes_issue_cmd(hw, cmd, parm0, parm1, parm2); - if (err) - return err; - - reg = hermes_read_regn(hw, EVSTAT); - k = CMD_INIT_TIMEOUT; - while ((!(reg & HERMES_EV_CMD)) && k) { - k--; - udelay(10); - reg = hermes_read_regn(hw, EVSTAT); - } - - hermes_write_regn(hw, SWSUPPORT0, HERMES_MAGIC); - - if (!hermes_present(hw)) { - DEBUG(0, "hermes @ 0x%x: Card removed during reset.\n", - hw->iobase); - err = -ENODEV; - goto out; - } - - if (!(reg & HERMES_EV_CMD)) { - printk(KERN_ERR "hermes @ %p: " - "Timeout waiting for card to reset (reg=0x%04x)!\n", - hw->iobase, reg); - err = -ETIMEDOUT; - goto out; - } - - status = hermes_read_regn(hw, STATUS); - if (resp) { - resp->status = status; - resp->resp0 = hermes_read_regn(hw, RESP0); - resp->resp1 = hermes_read_regn(hw, RESP1); - resp->resp2 = hermes_read_regn(hw, RESP2); - } - - hermes_write_regn(hw, EVACK, HERMES_EV_CMD); - - if (status & HERMES_STATUS_RESULT) - err = -EIO; -out: - return err; -} - -void hermes_struct_init(struct hermes *hw, void __iomem *address, - int reg_spacing) -{ - hw->iobase = address; - hw->reg_spacing = reg_spacing; - hw->inten = 0x0; - hw->eeprom_pda = false; - hw->ops = &hermes_ops_local; -} -EXPORT_SYMBOL(hermes_struct_init); - -static int hermes_init(struct hermes *hw) -{ - u16 reg; - int err = 0; - int k; - - /* We don't want to be interrupted while resetting the chipset */ - hw->inten = 0x0; - hermes_write_regn(hw, INTEN, 0); - hermes_write_regn(hw, EVACK, 0xffff); - - /* Normally it's a "can't happen" for the command register to - be busy when we go to issue a command because we are - serializing all commands. However we want to have some - chance of resetting the card even if it gets into a stupid - state, so we actually wait to see if the command register - will unbusy itself here. */ - k = CMD_BUSY_TIMEOUT; - reg = hermes_read_regn(hw, CMD); - while (k && (reg & HERMES_CMD_BUSY)) { - if (reg == 0xffff) /* Special case - the card has probably been - removed, so don't wait for the timeout */ - return -ENODEV; - - k--; - udelay(1); - reg = hermes_read_regn(hw, CMD); - } - - /* No need to explicitly handle the timeout - if we've timed - out hermes_issue_cmd() will probably return -EBUSY below */ - - /* According to the documentation, EVSTAT may contain - obsolete event occurrence information. We have to acknowledge - it by writing EVACK. */ - reg = hermes_read_regn(hw, EVSTAT); - hermes_write_regn(hw, EVACK, reg); - - /* We don't use hermes_docmd_wait here, because the reset wipes - the magic constant in SWSUPPORT0 away, and it gets confused */ - err = hermes_doicmd_wait(hw, HERMES_CMD_INIT, 0, 0, 0, NULL); - - return err; -} - -/* Issue a command to the chip, and (busy!) wait for it to - * complete. - * - * Returns: - * < 0 on internal error - * 0 on success - * > 0 on error returned by the firmware - * - * Callable from any context, but locking is your problem. */ -static int hermes_docmd_wait(struct hermes *hw, u16 cmd, u16 parm0, - struct hermes_response *resp) -{ - int err; - int k; - u16 reg; - u16 status; - - err = hermes_issue_cmd(hw, cmd, parm0, 0, 0); - if (err) { - if (!hermes_present(hw)) { - if (net_ratelimit()) - printk(KERN_WARNING "hermes @ %p: " - "Card removed while issuing command " - "0x%04x.\n", hw->iobase, cmd); - err = -ENODEV; - } else - if (net_ratelimit()) - printk(KERN_ERR "hermes @ %p: " - "Error %d issuing command 0x%04x.\n", - hw->iobase, err, cmd); - goto out; - } - - reg = hermes_read_regn(hw, EVSTAT); - k = CMD_COMPL_TIMEOUT; - while ((!(reg & HERMES_EV_CMD)) && k) { - k--; - udelay(10); - reg = hermes_read_regn(hw, EVSTAT); - } - - if (!hermes_present(hw)) { - printk(KERN_WARNING "hermes @ %p: Card removed " - "while waiting for command 0x%04x completion.\n", - hw->iobase, cmd); - err = -ENODEV; - goto out; - } - - if (!(reg & HERMES_EV_CMD)) { - printk(KERN_ERR "hermes @ %p: Timeout waiting for " - "command 0x%04x completion.\n", hw->iobase, cmd); - err = -ETIMEDOUT; - goto out; - } - - status = hermes_read_regn(hw, STATUS); - if (resp) { - resp->status = status; - resp->resp0 = hermes_read_regn(hw, RESP0); - resp->resp1 = hermes_read_regn(hw, RESP1); - resp->resp2 = hermes_read_regn(hw, RESP2); - } - - hermes_write_regn(hw, EVACK, HERMES_EV_CMD); - - if (status & HERMES_STATUS_RESULT) - err = -EIO; - - out: - return err; -} - -static int hermes_allocate(struct hermes *hw, u16 size, u16 *fid) -{ - int err = 0; - int k; - u16 reg; - - if ((size < HERMES_ALLOC_LEN_MIN) || (size > HERMES_ALLOC_LEN_MAX)) - return -EINVAL; - - err = hermes_docmd_wait(hw, HERMES_CMD_ALLOC, size, NULL); - if (err) - return err; - - reg = hermes_read_regn(hw, EVSTAT); - k = ALLOC_COMPL_TIMEOUT; - while ((!(reg & HERMES_EV_ALLOC)) && k) { - k--; - udelay(10); - reg = hermes_read_regn(hw, EVSTAT); - } - - if (!hermes_present(hw)) { - printk(KERN_WARNING "hermes @ %p: " - "Card removed waiting for frame allocation.\n", - hw->iobase); - return -ENODEV; - } - - if (!(reg & HERMES_EV_ALLOC)) { - printk(KERN_ERR "hermes @ %p: " - "Timeout waiting for frame allocation\n", - hw->iobase); - return -ETIMEDOUT; - } - - *fid = hermes_read_regn(hw, ALLOCFID); - hermes_write_regn(hw, EVACK, HERMES_EV_ALLOC); - - return 0; -} - -/* Set up a BAP to read a particular chunk of data from card's internal buffer. - * - * Returns: - * < 0 on internal failure (errno) - * 0 on success - * > 0 on error - * from firmware - * - * Callable from any context */ -static int hermes_bap_seek(struct hermes *hw, int bap, u16 id, u16 offset) -{ - int sreg = bap ? HERMES_SELECT1 : HERMES_SELECT0; - int oreg = bap ? HERMES_OFFSET1 : HERMES_OFFSET0; - int k; - u16 reg; - - /* Paranoia.. */ - if ((offset > HERMES_BAP_OFFSET_MAX) || (offset % 2)) - return -EINVAL; - - k = HERMES_BAP_BUSY_TIMEOUT; - reg = hermes_read_reg(hw, oreg); - while ((reg & HERMES_OFFSET_BUSY) && k) { - k--; - udelay(1); - reg = hermes_read_reg(hw, oreg); - } - - if (reg & HERMES_OFFSET_BUSY) - return -ETIMEDOUT; - - /* Now we actually set up the transfer */ - hermes_write_reg(hw, sreg, id); - hermes_write_reg(hw, oreg, offset); - - /* Wait for the BAP to be ready */ - k = HERMES_BAP_BUSY_TIMEOUT; - reg = hermes_read_reg(hw, oreg); - while ((reg & (HERMES_OFFSET_BUSY | HERMES_OFFSET_ERR)) && k) { - k--; - udelay(1); - reg = hermes_read_reg(hw, oreg); - } - - if (reg != offset) { - printk(KERN_ERR "hermes @ %p: BAP%d offset %s: " - "reg=0x%x id=0x%x offset=0x%x\n", hw->iobase, bap, - (reg & HERMES_OFFSET_BUSY) ? "timeout" : "error", - reg, id, offset); - - if (reg & HERMES_OFFSET_BUSY) - return -ETIMEDOUT; - - return -EIO; /* error or wrong offset */ - } - - return 0; -} - -/* Read a block of data from the chip's buffer, via the - * BAP. Synchronization/serialization is the caller's problem. len - * must be even. - * - * Returns: - * < 0 on internal failure (errno) - * 0 on success - * > 0 on error from firmware - */ -static int hermes_bap_pread(struct hermes *hw, int bap, void *buf, int len, - u16 id, u16 offset) -{ - int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; - int err = 0; - - if ((len < 0) || (len % 2)) - return -EINVAL; - - err = hermes_bap_seek(hw, bap, id, offset); - if (err) - goto out; - - /* Actually do the transfer */ - hermes_read_words(hw, dreg, buf, len / 2); - - out: - return err; -} - -/* Write a block of data to the chip's buffer, via the - * BAP. Synchronization/serialization is the caller's problem. - * - * Returns: - * < 0 on internal failure (errno) - * 0 on success - * > 0 on error from firmware - */ -static int hermes_bap_pwrite(struct hermes *hw, int bap, const void *buf, - int len, u16 id, u16 offset) -{ - int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; - int err = 0; - - if (len < 0) - return -EINVAL; - - err = hermes_bap_seek(hw, bap, id, offset); - if (err) - goto out; - - /* Actually do the transfer */ - hermes_write_bytes(hw, dreg, buf, len); - - out: - return err; -} - -/* Read a Length-Type-Value record from the card. - * - * If length is NULL, we ignore the length read from the card, and - * read the entire buffer regardless. This is useful because some of - * the configuration records appear to have incorrect lengths in - * practice. - * - * Callable from user or bh context. */ -static int hermes_read_ltv(struct hermes *hw, int bap, u16 rid, - unsigned bufsize, u16 *length, void *buf) -{ - int err = 0; - int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; - u16 rlength, rtype; - unsigned nwords; - - if (bufsize % 2) - return -EINVAL; - - err = hermes_docmd_wait(hw, HERMES_CMD_ACCESS, rid, NULL); - if (err) - return err; - - err = hermes_bap_seek(hw, bap, rid, 0); - if (err) - return err; - - rlength = hermes_read_reg(hw, dreg); - - if (!rlength) - return -ENODATA; - - rtype = hermes_read_reg(hw, dreg); - - if (length) - *length = rlength; - - if (rtype != rid) - printk(KERN_WARNING "hermes @ %p: %s(): " - "rid (0x%04x) does not match type (0x%04x)\n", - hw->iobase, __func__, rid, rtype); - if (HERMES_RECLEN_TO_BYTES(rlength) > bufsize) - printk(KERN_WARNING "hermes @ %p: " - "Truncating LTV record from %d to %d bytes. " - "(rid=0x%04x, len=0x%04x)\n", hw->iobase, - HERMES_RECLEN_TO_BYTES(rlength), bufsize, rid, rlength); - - nwords = min((unsigned)rlength - 1, bufsize / 2); - hermes_read_words(hw, dreg, buf, nwords); - - return 0; -} - -static int hermes_write_ltv(struct hermes *hw, int bap, u16 rid, - u16 length, const void *value) -{ - int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; - int err = 0; - unsigned count; - - if (length == 0) - return -EINVAL; - - err = hermes_bap_seek(hw, bap, rid, 0); - if (err) - return err; - - hermes_write_reg(hw, dreg, length); - hermes_write_reg(hw, dreg, rid); - - count = length - 1; - - hermes_write_bytes(hw, dreg, value, count << 1); - - err = hermes_docmd_wait(hw, HERMES_CMD_ACCESS | HERMES_CMD_WRITE, - rid, NULL); - - return err; -} - -/*** Hermes AUX control ***/ - -static inline void -hermes_aux_setaddr(struct hermes *hw, u32 addr) -{ - hermes_write_reg(hw, HERMES_AUXPAGE, (u16) (addr >> 7)); - hermes_write_reg(hw, HERMES_AUXOFFSET, (u16) (addr & 0x7F)); -} - -static inline int -hermes_aux_control(struct hermes *hw, int enabled) -{ - int desired_state = enabled ? HERMES_AUX_ENABLED : HERMES_AUX_DISABLED; - int action = enabled ? HERMES_AUX_ENABLE : HERMES_AUX_DISABLE; - int i; - - /* Already open? */ - if (hermes_read_reg(hw, HERMES_CONTROL) == desired_state) - return 0; - - hermes_write_reg(hw, HERMES_PARAM0, HERMES_AUX_PW0); - hermes_write_reg(hw, HERMES_PARAM1, HERMES_AUX_PW1); - hermes_write_reg(hw, HERMES_PARAM2, HERMES_AUX_PW2); - hermes_write_reg(hw, HERMES_CONTROL, action); - - for (i = 0; i < 20; i++) { - udelay(10); - if (hermes_read_reg(hw, HERMES_CONTROL) == - desired_state) - return 0; - } - - return -EBUSY; -} - -/*** Hermes programming ***/ - -/* About to start programming data (Hermes I) - * offset is the entry point - * - * Spectrum_cs' Symbol fw does not require this - * wl_lkm Agere fw does - * Don't know about intersil - */ -static int hermesi_program_init(struct hermes *hw, u32 offset) -{ - int err; - - /* Disable interrupts?*/ - /*hw->inten = 0x0;*/ - /*hermes_write_regn(hw, INTEN, 0);*/ - /*hermes_set_irqmask(hw, 0);*/ - - /* Acknowledge any outstanding command */ - hermes_write_regn(hw, EVACK, 0xFFFF); - - /* Using init_cmd_wait rather than cmd_wait */ - err = hw->ops->init_cmd_wait(hw, - 0x0100 | HERMES_CMD_INIT, - 0, 0, 0, NULL); - if (err) - return err; - - err = hw->ops->init_cmd_wait(hw, - 0x0000 | HERMES_CMD_INIT, - 0, 0, 0, NULL); - if (err) - return err; - - err = hermes_aux_control(hw, 1); - pr_debug("AUX enable returned %d\n", err); - - if (err) - return err; - - pr_debug("Enabling volatile, EP 0x%08x\n", offset); - err = hw->ops->init_cmd_wait(hw, - HERMES_PROGRAM_ENABLE_VOLATILE, - offset & 0xFFFFu, - offset >> 16, - 0, - NULL); - pr_debug("PROGRAM_ENABLE returned %d\n", err); - - return err; -} - -/* Done programming data (Hermes I) - * - * Spectrum_cs' Symbol fw does not require this - * wl_lkm Agere fw does - * Don't know about intersil - */ -static int hermesi_program_end(struct hermes *hw) -{ - struct hermes_response resp; - int rc = 0; - int err; - - rc = hw->ops->cmd_wait(hw, HERMES_PROGRAM_DISABLE, 0, &resp); - - pr_debug("PROGRAM_DISABLE returned %d, " - "r0 0x%04x, r1 0x%04x, r2 0x%04x\n", - rc, resp.resp0, resp.resp1, resp.resp2); - - if ((rc == 0) && - ((resp.status & HERMES_STATUS_CMDCODE) != HERMES_CMD_DOWNLD)) - rc = -EIO; - - err = hermes_aux_control(hw, 0); - pr_debug("AUX disable returned %d\n", err); - - /* Acknowledge any outstanding command */ - hermes_write_regn(hw, EVACK, 0xFFFF); - - /* Reinitialise, ignoring return */ - (void) hw->ops->init_cmd_wait(hw, 0x0000 | HERMES_CMD_INIT, - 0, 0, 0, NULL); - - return rc ? rc : err; -} - -static int hermes_program_bytes(struct hermes *hw, const char *data, - u32 addr, u32 len) -{ - /* wl lkm splits the programming into chunks of 2000 bytes. - * This restriction appears to come from USB. The PCMCIA - * adapters can program the whole lot in one go */ - hermes_aux_setaddr(hw, addr); - hermes_write_bytes(hw, HERMES_AUXDATA, data, len); - return 0; -} - -/* Read PDA from the adapter */ -static int hermes_read_pda(struct hermes *hw, __le16 *pda, u32 pda_addr, - u16 pda_len) -{ - int ret; - u16 pda_size; - u16 data_len = pda_len; - __le16 *data = pda; - - if (hw->eeprom_pda) { - /* PDA of spectrum symbol is in eeprom */ - - /* Issue command to read EEPROM */ - ret = hw->ops->cmd_wait(hw, HERMES_CMD_READMIF, 0, NULL); - if (ret) - return ret; - } else { - /* wl_lkm does not include PDA size in the PDA area. - * We will pad the information into pda, so other routines - * don't have to be modified */ - pda[0] = cpu_to_le16(pda_len - 2); - /* Includes CFG_PROD_DATA but not itself */ - pda[1] = cpu_to_le16(0x0800); /* CFG_PROD_DATA */ - data_len = pda_len - 4; - data = pda + 2; - } - - /* Open auxiliary port */ - ret = hermes_aux_control(hw, 1); - pr_debug("AUX enable returned %d\n", ret); - if (ret) - return ret; - - /* Read PDA */ - hermes_aux_setaddr(hw, pda_addr); - hermes_read_words(hw, HERMES_AUXDATA, data, data_len / 2); - - /* Close aux port */ - ret = hermes_aux_control(hw, 0); - pr_debug("AUX disable returned %d\n", ret); - - /* Check PDA length */ - pda_size = le16_to_cpu(pda[0]); - pr_debug("Actual PDA length %d, Max allowed %d\n", - pda_size, pda_len); - if (pda_size > pda_len) - return -EINVAL; - - return 0; -} - -static void hermes_lock_irqsave(spinlock_t *lock, - unsigned long *flags) __acquires(lock) -{ - spin_lock_irqsave(lock, *flags); -} - -static void hermes_unlock_irqrestore(spinlock_t *lock, - unsigned long *flags) __releases(lock) -{ - spin_unlock_irqrestore(lock, *flags); -} - -static void hermes_lock_irq(spinlock_t *lock) __acquires(lock) -{ - spin_lock_irq(lock); -} - -static void hermes_unlock_irq(spinlock_t *lock) __releases(lock) -{ - spin_unlock_irq(lock); -} - -/* Hermes operations for local buses */ -static const struct hermes_ops hermes_ops_local = { - .init = hermes_init, - .cmd_wait = hermes_docmd_wait, - .init_cmd_wait = hermes_doicmd_wait, - .allocate = hermes_allocate, - .read_ltv = hermes_read_ltv, - .write_ltv = hermes_write_ltv, - .bap_pread = hermes_bap_pread, - .bap_pwrite = hermes_bap_pwrite, - .read_pda = hermes_read_pda, - .program_init = hermesi_program_init, - .program_end = hermesi_program_end, - .program = hermes_program_bytes, - .lock_irqsave = hermes_lock_irqsave, - .unlock_irqrestore = hermes_unlock_irqrestore, - .lock_irq = hermes_lock_irq, - .unlock_irq = hermes_unlock_irq, -}; diff --git a/drivers/net/wireless/orinoco/hermes.h b/drivers/net/wireless/orinoco/hermes.h deleted file mode 100644 index 28a42448d329..000000000000 --- a/drivers/net/wireless/orinoco/hermes.h +++ /dev/null @@ -1,520 +0,0 @@ -/* hermes.h - * - * Driver core for the "Hermes" wireless MAC controller, as used in - * the Lucent Orinoco and Cabletron RoamAbout cards. It should also - * work on the hfa3841 and hfa3842 MAC controller chips used in the - * Prism I & II chipsets. - * - * This is not a complete driver, just low-level access routines for - * the MAC controller itself. - * - * Based on the prism2 driver from Absolute Value Systems' linux-wlan - * project, the Linux wvlan_cs driver, Lucent's HCF-Light - * (wvlan_hcf.c) library, and the NetBSD wireless driver. - * - * Copyright (C) 2000, David Gibson, Linuxcare Australia. - * (C) Copyright David Gibson, IBM Corp. 2001-2003. - * - * Portions taken from hfa384x.h. - * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. - * - * This file distributed under the GPL, version 2. - */ - -#ifndef _HERMES_H -#define _HERMES_H - -/* Notes on locking: - * - * As a module of low level hardware access routines, there is no - * locking. Users of this module should ensure that they serialize - * access to the hermes structure, and to the hardware -*/ - -#include -#include - -/* - * Limits and constants - */ -#define HERMES_ALLOC_LEN_MIN (4) -#define HERMES_ALLOC_LEN_MAX (2400) -#define HERMES_LTV_LEN_MAX (34) -#define HERMES_BAP_DATALEN_MAX (4096) -#define HERMES_BAP_OFFSET_MAX (4096) -#define HERMES_PORTID_MAX (7) -#define HERMES_NUMPORTS_MAX (HERMES_PORTID_MAX + 1) -#define HERMES_PDR_LEN_MAX (260) /* in bytes, from EK */ -#define HERMES_PDA_RECS_MAX (200) /* a guess */ -#define HERMES_PDA_LEN_MAX (1024) /* in bytes, from EK */ -#define HERMES_SCANRESULT_MAX (35) -#define HERMES_CHINFORESULT_MAX (8) -#define HERMES_MAX_MULTICAST (16) -#define HERMES_MAGIC (0x7d1f) - -/* - * Hermes register offsets - */ -#define HERMES_CMD (0x00) -#define HERMES_PARAM0 (0x02) -#define HERMES_PARAM1 (0x04) -#define HERMES_PARAM2 (0x06) -#define HERMES_STATUS (0x08) -#define HERMES_RESP0 (0x0A) -#define HERMES_RESP1 (0x0C) -#define HERMES_RESP2 (0x0E) -#define HERMES_INFOFID (0x10) -#define HERMES_RXFID (0x20) -#define HERMES_ALLOCFID (0x22) -#define HERMES_TXCOMPLFID (0x24) -#define HERMES_SELECT0 (0x18) -#define HERMES_OFFSET0 (0x1C) -#define HERMES_DATA0 (0x36) -#define HERMES_SELECT1 (0x1A) -#define HERMES_OFFSET1 (0x1E) -#define HERMES_DATA1 (0x38) -#define HERMES_EVSTAT (0x30) -#define HERMES_INTEN (0x32) -#define HERMES_EVACK (0x34) -#define HERMES_CONTROL (0x14) -#define HERMES_SWSUPPORT0 (0x28) -#define HERMES_SWSUPPORT1 (0x2A) -#define HERMES_SWSUPPORT2 (0x2C) -#define HERMES_AUXPAGE (0x3A) -#define HERMES_AUXOFFSET (0x3C) -#define HERMES_AUXDATA (0x3E) - -/* - * CMD register bitmasks - */ -#define HERMES_CMD_BUSY (0x8000) -#define HERMES_CMD_AINFO (0x7f00) -#define HERMES_CMD_MACPORT (0x0700) -#define HERMES_CMD_RECL (0x0100) -#define HERMES_CMD_WRITE (0x0100) -#define HERMES_CMD_PROGMODE (0x0300) -#define HERMES_CMD_CMDCODE (0x003f) - -/* - * STATUS register bitmasks - */ -#define HERMES_STATUS_RESULT (0x7f00) -#define HERMES_STATUS_CMDCODE (0x003f) - -/* - * OFFSET register bitmasks - */ -#define HERMES_OFFSET_BUSY (0x8000) -#define HERMES_OFFSET_ERR (0x4000) -#define HERMES_OFFSET_DATAOFF (0x0ffe) - -/* - * Event register bitmasks (INTEN, EVSTAT, EVACK) - */ -#define HERMES_EV_TICK (0x8000) -#define HERMES_EV_WTERR (0x4000) -#define HERMES_EV_INFDROP (0x2000) -#define HERMES_EV_INFO (0x0080) -#define HERMES_EV_DTIM (0x0020) -#define HERMES_EV_CMD (0x0010) -#define HERMES_EV_ALLOC (0x0008) -#define HERMES_EV_TXEXC (0x0004) -#define HERMES_EV_TX (0x0002) -#define HERMES_EV_RX (0x0001) - -/* - * Command codes - */ -/*--- Controller Commands ----------------------------*/ -#define HERMES_CMD_INIT (0x0000) -#define HERMES_CMD_ENABLE (0x0001) -#define HERMES_CMD_DISABLE (0x0002) -#define HERMES_CMD_DIAG (0x0003) - -/*--- Buffer Mgmt Commands ---------------------------*/ -#define HERMES_CMD_ALLOC (0x000A) -#define HERMES_CMD_TX (0x000B) - -/*--- Regulate Commands ------------------------------*/ -#define HERMES_CMD_NOTIFY (0x0010) -#define HERMES_CMD_INQUIRE (0x0011) - -/*--- Configure Commands -----------------------------*/ -#define HERMES_CMD_ACCESS (0x0021) -#define HERMES_CMD_DOWNLD (0x0022) - -/*--- Serial I/O Commands ----------------------------*/ -#define HERMES_CMD_READMIF (0x0030) -#define HERMES_CMD_WRITEMIF (0x0031) - -/*--- Debugging Commands -----------------------------*/ -#define HERMES_CMD_TEST (0x0038) - - -/* Test command arguments */ -#define HERMES_TEST_SET_CHANNEL 0x0800 -#define HERMES_TEST_MONITOR 0x0b00 -#define HERMES_TEST_STOP 0x0f00 - -/* Authentication algorithms */ -#define HERMES_AUTH_OPEN 1 -#define HERMES_AUTH_SHARED_KEY 2 - -/* WEP settings */ -#define HERMES_WEP_PRIVACY_INVOKED 0x0001 -#define HERMES_WEP_EXCL_UNENCRYPTED 0x0002 -#define HERMES_WEP_HOST_ENCRYPT 0x0010 -#define HERMES_WEP_HOST_DECRYPT 0x0080 - -/* Symbol hostscan options */ -#define HERMES_HOSTSCAN_SYMBOL_5SEC 0x0001 -#define HERMES_HOSTSCAN_SYMBOL_ONCE 0x0002 -#define HERMES_HOSTSCAN_SYMBOL_PASSIVE 0x0040 -#define HERMES_HOSTSCAN_SYMBOL_BCAST 0x0080 - -/* - * Frame structures and constants - */ - -#define HERMES_DESCRIPTOR_OFFSET 0 -#define HERMES_802_11_OFFSET (14) -#define HERMES_802_3_OFFSET (14 + 32) -#define HERMES_802_2_OFFSET (14 + 32 + 14) -#define HERMES_TXCNTL2_OFFSET (HERMES_802_3_OFFSET - 2) - -#define HERMES_RXSTAT_ERR (0x0003) -#define HERMES_RXSTAT_BADCRC (0x0001) -#define HERMES_RXSTAT_UNDECRYPTABLE (0x0002) -#define HERMES_RXSTAT_MIC (0x0010) /* Frame contains MIC */ -#define HERMES_RXSTAT_MACPORT (0x0700) -#define HERMES_RXSTAT_PCF (0x1000) /* Frame was received in CF period */ -#define HERMES_RXSTAT_MIC_KEY_ID (0x1800) /* MIC key used */ -#define HERMES_RXSTAT_MSGTYPE (0xE000) -#define HERMES_RXSTAT_1042 (0x2000) /* RFC-1042 frame */ -#define HERMES_RXSTAT_TUNNEL (0x4000) /* bridge-tunnel encoded frame */ -#define HERMES_RXSTAT_WMP (0x6000) /* Wavelan-II Management Protocol frame */ - -/* Shift amount for key ID in RXSTAT and TXCTRL */ -#define HERMES_MIC_KEY_ID_SHIFT 11 - -struct hermes_tx_descriptor { - __le16 status; - __le16 reserved1; - __le16 reserved2; - __le32 sw_support; - u8 retry_count; - u8 tx_rate; - __le16 tx_control; -} __packed; - -#define HERMES_TXSTAT_RETRYERR (0x0001) -#define HERMES_TXSTAT_AGEDERR (0x0002) -#define HERMES_TXSTAT_DISCON (0x0004) -#define HERMES_TXSTAT_FORMERR (0x0008) - -#define HERMES_TXCTRL_TX_OK (0x0002) /* ?? interrupt on Tx complete */ -#define HERMES_TXCTRL_TX_EX (0x0004) /* ?? interrupt on Tx exception */ -#define HERMES_TXCTRL_802_11 (0x0008) /* We supply 802.11 header */ -#define HERMES_TXCTRL_MIC (0x0010) /* 802.3 + TKIP */ -#define HERMES_TXCTRL_MIC_KEY_ID (0x1800) /* MIC Key ID mask */ -#define HERMES_TXCTRL_ALT_RTRY (0x0020) - -/* Inquiry constants and data types */ - -#define HERMES_INQ_TALLIES (0xF100) -#define HERMES_INQ_SCAN (0xF101) -#define HERMES_INQ_CHANNELINFO (0xF102) -#define HERMES_INQ_HOSTSCAN (0xF103) -#define HERMES_INQ_HOSTSCAN_SYMBOL (0xF104) -#define HERMES_INQ_LINKSTATUS (0xF200) -#define HERMES_INQ_SEC_STAT_AGERE (0xF202) - -struct hermes_tallies_frame { - __le16 TxUnicastFrames; - __le16 TxMulticastFrames; - __le16 TxFragments; - __le16 TxUnicastOctets; - __le16 TxMulticastOctets; - __le16 TxDeferredTransmissions; - __le16 TxSingleRetryFrames; - __le16 TxMultipleRetryFrames; - __le16 TxRetryLimitExceeded; - __le16 TxDiscards; - __le16 RxUnicastFrames; - __le16 RxMulticastFrames; - __le16 RxFragments; - __le16 RxUnicastOctets; - __le16 RxMulticastOctets; - __le16 RxFCSErrors; - __le16 RxDiscards_NoBuffer; - __le16 TxDiscardsWrongSA; - __le16 RxWEPUndecryptable; - __le16 RxMsgInMsgFragments; - __le16 RxMsgInBadMsgFragments; - /* Those last are probably not available in very old firmwares */ - __le16 RxDiscards_WEPICVError; - __le16 RxDiscards_WEPExcluded; -} __packed; - -/* Grabbed from wlan-ng - Thanks Mark... - Jean II - * This is the result of a scan inquiry command */ -/* Structure describing info about an Access Point */ -struct prism2_scan_apinfo { - __le16 channel; /* Channel where the AP sits */ - __le16 noise; /* Noise level */ - __le16 level; /* Signal level */ - u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ - __le16 beacon_interv; /* Beacon interval */ - __le16 capabilities; /* Capabilities */ - __le16 essid_len; /* ESSID length */ - u8 essid[32]; /* ESSID of the network */ - u8 rates[10]; /* Bit rate supported */ - __le16 proberesp_rate; /* Data rate of the response frame */ - __le16 atim; /* ATIM window time, Kus (hostscan only) */ -} __packed; - -/* Same stuff for the Lucent/Agere card. - * Thanks to h1kari - Jean II */ -struct agere_scan_apinfo { - __le16 channel; /* Channel where the AP sits */ - __le16 noise; /* Noise level */ - __le16 level; /* Signal level */ - u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ - __le16 beacon_interv; /* Beacon interval */ - __le16 capabilities; /* Capabilities */ - /* bits: 0-ess, 1-ibss, 4-privacy [wep] */ - __le16 essid_len; /* ESSID length */ - u8 essid[32]; /* ESSID of the network */ -} __packed; - -/* Moustafa: Scan structure for Symbol cards */ -struct symbol_scan_apinfo { - u8 channel; /* Channel where the AP sits */ - u8 unknown1; /* 8 in 2.9x and 3.9x f/w, 0 otherwise */ - __le16 noise; /* Noise level */ - __le16 level; /* Signal level */ - u8 bssid[ETH_ALEN]; /* MAC address of the Access Point */ - __le16 beacon_interv; /* Beacon interval */ - __le16 capabilities; /* Capabilities */ - /* bits: 0-ess, 1-ibss, 4-privacy [wep] */ - __le16 essid_len; /* ESSID length */ - u8 essid[32]; /* ESSID of the network */ - __le16 rates[5]; /* Bit rate supported */ - __le16 basic_rates; /* Basic rates bitmask */ - u8 unknown2[6]; /* Always FF:FF:FF:FF:00:00 */ - u8 unknown3[8]; /* Always 0, appeared in f/w 3.91-68 */ -} __packed; - -union hermes_scan_info { - struct agere_scan_apinfo a; - struct prism2_scan_apinfo p; - struct symbol_scan_apinfo s; -}; - -/* Extended scan struct for HERMES_INQ_CHANNELINFO. - * wl_lkm calls this an ACS scan (Automatic Channel Select). - * Keep out of union hermes_scan_info because it is much bigger than - * the older scan structures. */ -struct agere_ext_scan_info { - __le16 reserved0; - - u8 noise; - u8 level; - u8 rx_flow; - u8 rate; - __le16 reserved1[2]; - - __le16 frame_control; - __le16 dur_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 bssid[ETH_ALEN]; - __le16 sequence; - u8 addr4[ETH_ALEN]; - - __le16 data_length; - - /* Next 3 fields do not get filled in. */ - u8 daddr[ETH_ALEN]; - u8 saddr[ETH_ALEN]; - __le16 len_type; - - __le64 timestamp; - __le16 beacon_interval; - __le16 capabilities; - u8 data[0]; -} __packed; - -#define HERMES_LINKSTATUS_NOT_CONNECTED (0x0000) -#define HERMES_LINKSTATUS_CONNECTED (0x0001) -#define HERMES_LINKSTATUS_DISCONNECTED (0x0002) -#define HERMES_LINKSTATUS_AP_CHANGE (0x0003) -#define HERMES_LINKSTATUS_AP_OUT_OF_RANGE (0x0004) -#define HERMES_LINKSTATUS_AP_IN_RANGE (0x0005) -#define HERMES_LINKSTATUS_ASSOC_FAILED (0x0006) - -struct hermes_linkstatus { - __le16 linkstatus; /* Link status */ -} __packed; - -struct hermes_response { - u16 status, resp0, resp1, resp2; -}; - -/* "ID" structure - used for ESSID and station nickname */ -struct hermes_idstring { - __le16 len; - __le16 val[16]; -} __packed; - -struct hermes_multicast { - u8 addr[HERMES_MAX_MULTICAST][ETH_ALEN]; -} __packed; - -/* Timeouts */ -#define HERMES_BAP_BUSY_TIMEOUT (10000) /* In iterations of ~1us */ - -struct hermes; - -/* Functions to access hardware */ -struct hermes_ops { - int (*init)(struct hermes *hw); - int (*cmd_wait)(struct hermes *hw, u16 cmd, u16 parm0, - struct hermes_response *resp); - int (*init_cmd_wait)(struct hermes *hw, u16 cmd, - u16 parm0, u16 parm1, u16 parm2, - struct hermes_response *resp); - int (*allocate)(struct hermes *hw, u16 size, u16 *fid); - int (*read_ltv)(struct hermes *hw, int bap, u16 rid, unsigned buflen, - u16 *length, void *buf); - int (*write_ltv)(struct hermes *hw, int bap, u16 rid, - u16 length, const void *value); - int (*bap_pread)(struct hermes *hw, int bap, void *buf, int len, - u16 id, u16 offset); - int (*bap_pwrite)(struct hermes *hw, int bap, const void *buf, - int len, u16 id, u16 offset); - int (*read_pda)(struct hermes *hw, __le16 *pda, - u32 pda_addr, u16 pda_len); - int (*program_init)(struct hermes *hw, u32 entry_point); - int (*program_end)(struct hermes *hw); - int (*program)(struct hermes *hw, const char *buf, - u32 addr, u32 len); - void (*lock_irqsave)(spinlock_t *lock, unsigned long *flags); - void (*unlock_irqrestore)(spinlock_t *lock, unsigned long *flags); - void (*lock_irq)(spinlock_t *lock); - void (*unlock_irq)(spinlock_t *lock); -}; - -/* Basic control structure */ -struct hermes { - void __iomem *iobase; - int reg_spacing; -#define HERMES_16BIT_REGSPACING 0 -#define HERMES_32BIT_REGSPACING 1 - u16 inten; /* Which interrupts should be enabled? */ - bool eeprom_pda; - const struct hermes_ops *ops; - void *priv; -}; - -/* Register access convenience macros */ -#define hermes_read_reg(hw, off) \ - (ioread16((hw)->iobase + ((off) << (hw)->reg_spacing))) -#define hermes_write_reg(hw, off, val) \ - (iowrite16((val), (hw)->iobase + ((off) << (hw)->reg_spacing))) -#define hermes_read_regn(hw, name) hermes_read_reg((hw), HERMES_##name) -#define hermes_write_regn(hw, name, val) \ - hermes_write_reg((hw), HERMES_##name, (val)) - -/* Function prototypes */ -void hermes_struct_init(struct hermes *hw, void __iomem *address, - int reg_spacing); - -/* Inline functions */ - -static inline int hermes_present(struct hermes *hw) -{ - return hermes_read_regn(hw, SWSUPPORT0) == HERMES_MAGIC; -} - -static inline void hermes_set_irqmask(struct hermes *hw, u16 events) -{ - hw->inten = events; - hermes_write_regn(hw, INTEN, events); -} - -static inline int hermes_enable_port(struct hermes *hw, int port) -{ - return hw->ops->cmd_wait(hw, HERMES_CMD_ENABLE | (port << 8), - 0, NULL); -} - -static inline int hermes_disable_port(struct hermes *hw, int port) -{ - return hw->ops->cmd_wait(hw, HERMES_CMD_DISABLE | (port << 8), - 0, NULL); -} - -/* Initiate an INQUIRE command (tallies or scan). The result will come as an - * information frame in __orinoco_ev_info() */ -static inline int hermes_inquire(struct hermes *hw, u16 rid) -{ - return hw->ops->cmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL); -} - -#define HERMES_BYTES_TO_RECLEN(n) ((((n) + 1) / 2) + 1) -#define HERMES_RECLEN_TO_BYTES(n) (((n) - 1) * 2) - -/* Note that for the next two, the count is in 16-bit words, not bytes */ -static inline void hermes_read_words(struct hermes *hw, int off, - void *buf, unsigned count) -{ - off = off << hw->reg_spacing; - ioread16_rep(hw->iobase + off, buf, count); -} - -static inline void hermes_write_bytes(struct hermes *hw, int off, - const char *buf, unsigned count) -{ - off = off << hw->reg_spacing; - iowrite16_rep(hw->iobase + off, buf, count >> 1); - if (unlikely(count & 1)) - iowrite8(buf[count - 1], hw->iobase + off); -} - -static inline void hermes_clear_words(struct hermes *hw, int off, - unsigned count) -{ - unsigned i; - - off = off << hw->reg_spacing; - - for (i = 0; i < count; i++) - iowrite16(0, hw->iobase + off); -} - -#define HERMES_READ_RECORD(hw, bap, rid, buf) \ - (hw->ops->read_ltv((hw), (bap), (rid), sizeof(*buf), NULL, (buf))) -#define HERMES_WRITE_RECORD(hw, bap, rid, buf) \ - (hw->ops->write_ltv((hw), (bap), (rid), \ - HERMES_BYTES_TO_RECLEN(sizeof(*buf)), (buf))) - -static inline int hermes_read_wordrec(struct hermes *hw, int bap, u16 rid, - u16 *word) -{ - __le16 rec; - int err; - - err = HERMES_READ_RECORD(hw, bap, rid, &rec); - *word = le16_to_cpu(rec); - return err; -} - -static inline int hermes_write_wordrec(struct hermes *hw, int bap, u16 rid, - u16 word) -{ - __le16 rec = cpu_to_le16(word); - return HERMES_WRITE_RECORD(hw, bap, rid, &rec); -} - -#endif /* _HERMES_H */ diff --git a/drivers/net/wireless/orinoco/hermes_dld.c b/drivers/net/wireless/orinoco/hermes_dld.c deleted file mode 100644 index 4a10b7aca043..000000000000 --- a/drivers/net/wireless/orinoco/hermes_dld.c +++ /dev/null @@ -1,477 +0,0 @@ -/* - * Hermes download helper. - * - * This helper: - * - is capable of writing to the volatile area of the hermes device - * - is currently not capable of writing to non-volatile areas - * - provide helpers to identify and update plugin data - * - is not capable of interpreting a fw image directly. That is up to - * the main card driver. - * - deals with Hermes I devices. It can probably be modified to deal - * with Hermes II devices - * - * Copyright (C) 2007, David Kilroy - * - * Plug data code slightly modified from spectrum_cs driver - * Copyright (C) 2002-2005 Pavel Roskin - * Portions based on information in wl_lkm_718 Agere driver - * COPYRIGHT (C) 2001-2004 by Agere Systems Inc. All Rights Reserved - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License version 2 (the "GPL"), in - * which case the provisions of the GPL are applicable instead of the - * above. If you wish to allow the use of your version of this file - * only under the terms of the GPL and not to allow others to use your - * version of this file under the MPL, indicate your decision by - * deleting the provisions above and replace them with the notice and - * other provisions required by the GPL. If you do not delete the - * provisions above, a recipient may use your version of this file - * under either the MPL or the GPL. - */ - -#include -#include -#include "hermes.h" -#include "hermes_dld.h" - -#define PFX "hermes_dld: " - -/* End markers used in dblocks */ -#define PDI_END 0x00000000 /* End of PDA */ -#define BLOCK_END 0xFFFFFFFF /* Last image block */ -#define TEXT_END 0x1A /* End of text header */ - -/* - * The following structures have little-endian fields denoted by - * the leading underscore. Don't access them directly - use inline - * functions defined below. - */ - -/* - * The binary image to be downloaded consists of series of data blocks. - * Each block has the following structure. - */ -struct dblock { - __le32 addr; /* adapter address where to write the block */ - __le16 len; /* length of the data only, in bytes */ - char data[0]; /* data to be written */ -} __packed; - -/* - * Plug Data References are located in the image after the last data - * block. They refer to areas in the adapter memory where the plug data - * items with matching ID should be written. - */ -struct pdr { - __le32 id; /* record ID */ - __le32 addr; /* adapter address where to write the data */ - __le32 len; /* expected length of the data, in bytes */ - char next[0]; /* next PDR starts here */ -} __packed; - -/* - * Plug Data Items are located in the EEPROM read from the adapter by - * primary firmware. They refer to the device-specific data that should - * be plugged into the secondary firmware. - */ -struct pdi { - __le16 len; /* length of ID and data, in words */ - __le16 id; /* record ID */ - char data[0]; /* plug data */ -} __packed; - -/*** FW data block access functions ***/ - -static inline u32 -dblock_addr(const struct dblock *blk) -{ - return le32_to_cpu(blk->addr); -} - -static inline u32 -dblock_len(const struct dblock *blk) -{ - return le16_to_cpu(blk->len); -} - -/*** PDR Access functions ***/ - -static inline u32 -pdr_id(const struct pdr *pdr) -{ - return le32_to_cpu(pdr->id); -} - -static inline u32 -pdr_addr(const struct pdr *pdr) -{ - return le32_to_cpu(pdr->addr); -} - -static inline u32 -pdr_len(const struct pdr *pdr) -{ - return le32_to_cpu(pdr->len); -} - -/*** PDI Access functions ***/ - -static inline u32 -pdi_id(const struct pdi *pdi) -{ - return le16_to_cpu(pdi->id); -} - -/* Return length of the data only, in bytes */ -static inline u32 -pdi_len(const struct pdi *pdi) -{ - return 2 * (le16_to_cpu(pdi->len) - 1); -} - -/*** Plug Data Functions ***/ - -/* - * Scan PDR for the record with the specified RECORD_ID. - * If it's not found, return NULL. - */ -static const struct pdr * -hermes_find_pdr(const struct pdr *first_pdr, u32 record_id, const void *end) -{ - const struct pdr *pdr = first_pdr; - - end -= sizeof(struct pdr); - - while (((void *) pdr <= end) && - (pdr_id(pdr) != PDI_END)) { - /* - * PDR area is currently not terminated by PDI_END. - * It's followed by CRC records, which have the type - * field where PDR has length. The type can be 0 or 1. - */ - if (pdr_len(pdr) < 2) - return NULL; - - /* If the record ID matches, we are done */ - if (pdr_id(pdr) == record_id) - return pdr; - - pdr = (struct pdr *) pdr->next; - } - return NULL; -} - -/* Scan production data items for a particular entry */ -static const struct pdi * -hermes_find_pdi(const struct pdi *first_pdi, u32 record_id, const void *end) -{ - const struct pdi *pdi = first_pdi; - - end -= sizeof(struct pdi); - - while (((void *) pdi <= end) && - (pdi_id(pdi) != PDI_END)) { - - /* If the record ID matches, we are done */ - if (pdi_id(pdi) == record_id) - return pdi; - - pdi = (struct pdi *) &pdi->data[pdi_len(pdi)]; - } - return NULL; -} - -/* Process one Plug Data Item - find corresponding PDR and plug it */ -static int -hermes_plug_pdi(struct hermes *hw, const struct pdr *first_pdr, - const struct pdi *pdi, const void *pdr_end) -{ - const struct pdr *pdr; - - /* Find the PDR corresponding to this PDI */ - pdr = hermes_find_pdr(first_pdr, pdi_id(pdi), pdr_end); - - /* No match is found, safe to ignore */ - if (!pdr) - return 0; - - /* Lengths of the data in PDI and PDR must match */ - if (pdi_len(pdi) != pdr_len(pdr)) - return -EINVAL; - - /* do the actual plugging */ - hw->ops->program(hw, pdi->data, pdr_addr(pdr), pdi_len(pdi)); - - return 0; -} - -/* Parse PDA and write the records into the adapter - * - * Attempt to write every records that is in the specified pda - * which also has a valid production data record for the firmware. - */ -int hermes_apply_pda(struct hermes *hw, - const char *first_pdr, - const void *pdr_end, - const __le16 *pda, - const void *pda_end) -{ - int ret; - const struct pdi *pdi; - const struct pdr *pdr; - - pdr = (const struct pdr *) first_pdr; - pda_end -= sizeof(struct pdi); - - /* Go through every PDI and plug them into the adapter */ - pdi = (const struct pdi *) (pda + 2); - while (((void *) pdi <= pda_end) && - (pdi_id(pdi) != PDI_END)) { - ret = hermes_plug_pdi(hw, pdr, pdi, pdr_end); - if (ret) - return ret; - - /* Increment to the next PDI */ - pdi = (const struct pdi *) &pdi->data[pdi_len(pdi)]; - } - return 0; -} - -/* Identify the total number of bytes in all blocks - * including the header data. - */ -size_t -hermes_blocks_length(const char *first_block, const void *end) -{ - const struct dblock *blk = (const struct dblock *) first_block; - int total_len = 0; - int len; - - end -= sizeof(*blk); - - /* Skip all blocks to locate Plug Data References - * (Spectrum CS) */ - while (((void *) blk <= end) && - (dblock_addr(blk) != BLOCK_END)) { - len = dblock_len(blk); - total_len += sizeof(*blk) + len; - blk = (struct dblock *) &blk->data[len]; - } - - return total_len; -} - -/*** Hermes programming ***/ - -/* Program the data blocks */ -int hermes_program(struct hermes *hw, const char *first_block, const void *end) -{ - const struct dblock *blk; - u32 blkaddr; - u32 blklen; - int err = 0; - - blk = (const struct dblock *) first_block; - - if ((void *) blk > (end - sizeof(*blk))) - return -EIO; - - blkaddr = dblock_addr(blk); - blklen = dblock_len(blk); - - while ((blkaddr != BLOCK_END) && - (((void *) blk + blklen) <= end)) { - pr_debug(PFX "Programming block of length %d " - "to address 0x%08x\n", blklen, blkaddr); - - err = hw->ops->program(hw, blk->data, blkaddr, blklen); - if (err) - break; - - blk = (const struct dblock *) &blk->data[blklen]; - - if ((void *) blk > (end - sizeof(*blk))) - return -EIO; - - blkaddr = dblock_addr(blk); - blklen = dblock_len(blk); - } - return err; -} - -/*** Default plugging data for Hermes I ***/ -/* Values from wl_lkm_718/hcf/dhf.c */ - -#define DEFINE_DEFAULT_PDR(pid, length, data) \ -static const struct { \ - __le16 len; \ - __le16 id; \ - u8 val[length]; \ -} __packed default_pdr_data_##pid = { \ - cpu_to_le16((sizeof(default_pdr_data_##pid)/ \ - sizeof(__le16)) - 1), \ - cpu_to_le16(pid), \ - data \ -} - -#define DEFAULT_PDR(pid) default_pdr_data_##pid - -/* HWIF Compatibility */ -DEFINE_DEFAULT_PDR(0x0005, 10, "\x00\x00\x06\x00\x01\x00\x01\x00\x01\x00"); - -/* PPPPSign */ -DEFINE_DEFAULT_PDR(0x0108, 4, "\x00\x00\x00\x00"); - -/* PPPPProf */ -DEFINE_DEFAULT_PDR(0x0109, 10, "\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00"); - -/* Antenna diversity */ -DEFINE_DEFAULT_PDR(0x0150, 2, "\x00\x3F"); - -/* Modem VCO band Set-up */ -DEFINE_DEFAULT_PDR(0x0160, 28, - "\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00"); - -/* Modem Rx Gain Table Values */ -DEFINE_DEFAULT_PDR(0x0161, 256, - "\x3F\x01\x3F\01\x3F\x01\x3F\x01" - "\x3F\x01\x3F\01\x3F\x01\x3F\x01" - "\x3F\x01\x3F\01\x3F\x01\x3F\x01" - "\x3F\x01\x3F\01\x3F\x01\x3F\x01" - "\x3F\x01\x3E\01\x3E\x01\x3D\x01" - "\x3D\x01\x3C\01\x3C\x01\x3B\x01" - "\x3B\x01\x3A\01\x3A\x01\x39\x01" - "\x39\x01\x38\01\x38\x01\x37\x01" - "\x37\x01\x36\01\x36\x01\x35\x01" - "\x35\x01\x34\01\x34\x01\x33\x01" - "\x33\x01\x32\x01\x32\x01\x31\x01" - "\x31\x01\x30\x01\x30\x01\x7B\x01" - "\x7B\x01\x7A\x01\x7A\x01\x79\x01" - "\x79\x01\x78\x01\x78\x01\x77\x01" - "\x77\x01\x76\x01\x76\x01\x75\x01" - "\x75\x01\x74\x01\x74\x01\x73\x01" - "\x73\x01\x72\x01\x72\x01\x71\x01" - "\x71\x01\x70\x01\x70\x01\x68\x01" - "\x68\x01\x67\x01\x67\x01\x66\x01" - "\x66\x01\x65\x01\x65\x01\x57\x01" - "\x57\x01\x56\x01\x56\x01\x55\x01" - "\x55\x01\x54\x01\x54\x01\x53\x01" - "\x53\x01\x52\x01\x52\x01\x51\x01" - "\x51\x01\x50\x01\x50\x01\x48\x01" - "\x48\x01\x47\x01\x47\x01\x46\x01" - "\x46\x01\x45\x01\x45\x01\x44\x01" - "\x44\x01\x43\x01\x43\x01\x42\x01" - "\x42\x01\x41\x01\x41\x01\x40\x01" - "\x40\x01\x40\x01\x40\x01\x40\x01" - "\x40\x01\x40\x01\x40\x01\x40\x01" - "\x40\x01\x40\x01\x40\x01\x40\x01" - "\x40\x01\x40\x01\x40\x01\x40\x01"); - -/* Write PDA according to certain rules. - * - * For every production data record, look for a previous setting in - * the pda, and use that. - * - * For certain records, use defaults if they are not found in pda. - */ -int hermes_apply_pda_with_defaults(struct hermes *hw, - const char *first_pdr, - const void *pdr_end, - const __le16 *pda, - const void *pda_end) -{ - const struct pdr *pdr = (const struct pdr *) first_pdr; - const struct pdi *first_pdi = (const struct pdi *) &pda[2]; - const struct pdi *pdi; - const struct pdi *default_pdi = NULL; - const struct pdi *outdoor_pdi; - int record_id; - - pdr_end -= sizeof(struct pdr); - - while (((void *) pdr <= pdr_end) && - (pdr_id(pdr) != PDI_END)) { - /* - * For spectrum_cs firmwares, - * PDR area is currently not terminated by PDI_END. - * It's followed by CRC records, which have the type - * field where PDR has length. The type can be 0 or 1. - */ - if (pdr_len(pdr) < 2) - break; - record_id = pdr_id(pdr); - - pdi = hermes_find_pdi(first_pdi, record_id, pda_end); - if (pdi) - pr_debug(PFX "Found record 0x%04x at %p\n", - record_id, pdi); - - switch (record_id) { - case 0x110: /* Modem REFDAC values */ - case 0x120: /* Modem VGDAC values */ - outdoor_pdi = hermes_find_pdi(first_pdi, record_id + 1, - pda_end); - default_pdi = NULL; - if (outdoor_pdi) { - pdi = outdoor_pdi; - pr_debug(PFX - "Using outdoor record 0x%04x at %p\n", - record_id + 1, pdi); - } - break; - case 0x5: /* HWIF Compatibility */ - default_pdi = (struct pdi *) &DEFAULT_PDR(0x0005); - break; - case 0x108: /* PPPPSign */ - default_pdi = (struct pdi *) &DEFAULT_PDR(0x0108); - break; - case 0x109: /* PPPPProf */ - default_pdi = (struct pdi *) &DEFAULT_PDR(0x0109); - break; - case 0x150: /* Antenna diversity */ - default_pdi = (struct pdi *) &DEFAULT_PDR(0x0150); - break; - case 0x160: /* Modem VCO band Set-up */ - default_pdi = (struct pdi *) &DEFAULT_PDR(0x0160); - break; - case 0x161: /* Modem Rx Gain Table Values */ - default_pdi = (struct pdi *) &DEFAULT_PDR(0x0161); - break; - default: - default_pdi = NULL; - break; - } - if (!pdi && default_pdi) { - /* Use default */ - pdi = default_pdi; - pr_debug(PFX "Using default record 0x%04x at %p\n", - record_id, pdi); - } - - if (pdi) { - /* Lengths of the data in PDI and PDR must match */ - if ((pdi_len(pdi) == pdr_len(pdr)) && - ((void *) pdi->data + pdi_len(pdi) < pda_end)) { - /* do the actual plugging */ - hw->ops->program(hw, pdi->data, pdr_addr(pdr), - pdi_len(pdi)); - } - } - - pdr++; - } - return 0; -} diff --git a/drivers/net/wireless/orinoco/hermes_dld.h b/drivers/net/wireless/orinoco/hermes_dld.h deleted file mode 100644 index b5377e232c63..000000000000 --- a/drivers/net/wireless/orinoco/hermes_dld.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2007, David Kilroy - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License version 2 (the "GPL"), in - * which case the provisions of the GPL are applicable instead of the - * above. If you wish to allow the use of your version of this file - * only under the terms of the GPL and not to allow others to use your - * version of this file under the MPL, indicate your decision by - * deleting the provisions above and replace them with the notice and - * other provisions required by the GPL. If you do not delete the - * provisions above, a recipient may use your version of this file - * under either the MPL or the GPL. - */ -#ifndef _HERMES_DLD_H -#define _HERMES_DLD_H - -#include "hermes.h" - -int hermesi_program_init(struct hermes *hw, u32 offset); -int hermesi_program_end(struct hermes *hw); -int hermes_program(struct hermes *hw, const char *first_block, const void *end); - -int hermes_read_pda(struct hermes *hw, - __le16 *pda, - u32 pda_addr, - u16 pda_len, - int use_eeprom); -int hermes_apply_pda(struct hermes *hw, - const char *first_pdr, - const void *pdr_end, - const __le16 *pda, - const void *pda_end); -int hermes_apply_pda_with_defaults(struct hermes *hw, - const char *first_pdr, - const void *pdr_end, - const __le16 *pda, - const void *pda_end); - -size_t hermes_blocks_length(const char *first_block, const void *end); - -#endif /* _HERMES_DLD_H */ diff --git a/drivers/net/wireless/orinoco/hermes_rid.h b/drivers/net/wireless/orinoco/hermes_rid.h deleted file mode 100644 index 42eb67dea1df..000000000000 --- a/drivers/net/wireless/orinoco/hermes_rid.h +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef _HERMES_RID_H -#define _HERMES_RID_H - -/* - * Configuration RIDs - */ -#define HERMES_RID_CNFPORTTYPE 0xFC00 -#define HERMES_RID_CNFOWNMACADDR 0xFC01 -#define HERMES_RID_CNFDESIREDSSID 0xFC02 -#define HERMES_RID_CNFOWNCHANNEL 0xFC03 -#define HERMES_RID_CNFOWNSSID 0xFC04 -#define HERMES_RID_CNFOWNATIMWINDOW 0xFC05 -#define HERMES_RID_CNFSYSTEMSCALE 0xFC06 -#define HERMES_RID_CNFMAXDATALEN 0xFC07 -#define HERMES_RID_CNFWDSADDRESS 0xFC08 -#define HERMES_RID_CNFPMENABLED 0xFC09 -#define HERMES_RID_CNFPMEPS 0xFC0A -#define HERMES_RID_CNFMULTICASTRECEIVE 0xFC0B -#define HERMES_RID_CNFMAXSLEEPDURATION 0xFC0C -#define HERMES_RID_CNFPMHOLDOVERDURATION 0xFC0D -#define HERMES_RID_CNFOWNNAME 0xFC0E -#define HERMES_RID_CNFOWNDTIMPERIOD 0xFC10 -#define HERMES_RID_CNFWDSADDRESS1 0xFC11 -#define HERMES_RID_CNFWDSADDRESS2 0xFC12 -#define HERMES_RID_CNFWDSADDRESS3 0xFC13 -#define HERMES_RID_CNFWDSADDRESS4 0xFC14 -#define HERMES_RID_CNFWDSADDRESS5 0xFC15 -#define HERMES_RID_CNFWDSADDRESS6 0xFC16 -#define HERMES_RID_CNFMULTICASTPMBUFFERING 0xFC17 -#define HERMES_RID_CNFWEPENABLED_AGERE 0xFC20 -#define HERMES_RID_CNFAUTHENTICATION_AGERE 0xFC21 -#define HERMES_RID_CNFMANDATORYBSSID_SYMBOL 0xFC21 -#define HERMES_RID_CNFDROPUNENCRYPTED 0xFC22 -#define HERMES_RID_CNFWEPDEFAULTKEYID 0xFC23 -#define HERMES_RID_CNFDEFAULTKEY0 0xFC24 -#define HERMES_RID_CNFDEFAULTKEY1 0xFC25 -#define HERMES_RID_CNFMWOROBUST_AGERE 0xFC25 -#define HERMES_RID_CNFDEFAULTKEY2 0xFC26 -#define HERMES_RID_CNFDEFAULTKEY3 0xFC27 -#define HERMES_RID_CNFWEPFLAGS_INTERSIL 0xFC28 -#define HERMES_RID_CNFWEPKEYMAPPINGTABLE 0xFC29 -#define HERMES_RID_CNFAUTHENTICATION 0xFC2A -#define HERMES_RID_CNFMAXASSOCSTA 0xFC2B -#define HERMES_RID_CNFKEYLENGTH_SYMBOL 0xFC2B -#define HERMES_RID_CNFTXCONTROL 0xFC2C -#define HERMES_RID_CNFROAMINGMODE 0xFC2D -#define HERMES_RID_CNFHOSTAUTHENTICATION 0xFC2E -#define HERMES_RID_CNFRCVCRCERROR 0xFC30 -#define HERMES_RID_CNFMMLIFE 0xFC31 -#define HERMES_RID_CNFALTRETRYCOUNT 0xFC32 -#define HERMES_RID_CNFBEACONINT 0xFC33 -#define HERMES_RID_CNFAPPCFINFO 0xFC34 -#define HERMES_RID_CNFSTAPCFINFO 0xFC35 -#define HERMES_RID_CNFPRIORITYQUSAGE 0xFC37 -#define HERMES_RID_CNFTIMCTRL 0xFC40 -#define HERMES_RID_CNFTHIRTY2TALLY 0xFC42 -#define HERMES_RID_CNFENHSECURITY 0xFC43 -#define HERMES_RID_CNFGROUPADDRESSES 0xFC80 -#define HERMES_RID_CNFCREATEIBSS 0xFC81 -#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD 0xFC82 -#define HERMES_RID_CNFRTSTHRESHOLD 0xFC83 -#define HERMES_RID_CNFTXRATECONTROL 0xFC84 -#define HERMES_RID_CNFPROMISCUOUSMODE 0xFC85 -#define HERMES_RID_CNFBASICRATES_SYMBOL 0xFC8A -#define HERMES_RID_CNFPREAMBLE_SYMBOL 0xFC8C -#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD0 0xFC90 -#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD1 0xFC91 -#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD2 0xFC92 -#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD3 0xFC93 -#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD4 0xFC94 -#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD5 0xFC95 -#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD6 0xFC96 -#define HERMES_RID_CNFRTSTHRESHOLD0 0xFC97 -#define HERMES_RID_CNFRTSTHRESHOLD1 0xFC98 -#define HERMES_RID_CNFRTSTHRESHOLD2 0xFC99 -#define HERMES_RID_CNFRTSTHRESHOLD3 0xFC9A -#define HERMES_RID_CNFRTSTHRESHOLD4 0xFC9B -#define HERMES_RID_CNFRTSTHRESHOLD5 0xFC9C -#define HERMES_RID_CNFRTSTHRESHOLD6 0xFC9D -#define HERMES_RID_CNFHOSTSCAN_SYMBOL 0xFCAB -#define HERMES_RID_CNFSHORTPREAMBLE 0xFCB0 -#define HERMES_RID_CNFWEPKEYS_AGERE 0xFCB0 -#define HERMES_RID_CNFEXCLUDELONGPREAMBLE 0xFCB1 -#define HERMES_RID_CNFTXKEY_AGERE 0xFCB1 -#define HERMES_RID_CNFAUTHENTICATIONRSPTO 0xFCB2 -#define HERMES_RID_CNFSCANSSID_AGERE 0xFCB2 -#define HERMES_RID_CNFBASICRATES 0xFCB3 -#define HERMES_RID_CNFSUPPORTEDRATES 0xFCB4 -#define HERMES_RID_CNFADDDEFAULTTKIPKEY_AGERE 0xFCB4 -#define HERMES_RID_CNFSETWPAAUTHMGMTSUITE_AGERE 0xFCB5 -#define HERMES_RID_CNFREMDEFAULTTKIPKEY_AGERE 0xFCB6 -#define HERMES_RID_CNFADDMAPPEDTKIPKEY_AGERE 0xFCB7 -#define HERMES_RID_CNFREMMAPPEDTKIPKEY_AGERE 0xFCB8 -#define HERMES_RID_CNFSETWPACAPABILITIES_AGERE 0xFCB9 -#define HERMES_RID_CNFCACHEDPMKADDRESS 0xFCBA -#define HERMES_RID_CNFREMOVEPMKADDRESS 0xFCBB -#define HERMES_RID_CNFSCANCHANNELS2GHZ 0xFCC2 -#define HERMES_RID_CNFDISASSOCIATE 0xFCC8 -#define HERMES_RID_CNFTICKTIME 0xFCE0 -#define HERMES_RID_CNFSCANREQUEST 0xFCE1 -#define HERMES_RID_CNFJOINREQUEST 0xFCE2 -#define HERMES_RID_CNFAUTHENTICATESTATION 0xFCE3 -#define HERMES_RID_CNFCHANNELINFOREQUEST 0xFCE4 -#define HERMES_RID_CNFHOSTSCAN 0xFCE5 - -/* - * Information RIDs - */ -#define HERMES_RID_MAXLOADTIME 0xFD00 -#define HERMES_RID_DOWNLOADBUFFER 0xFD01 -#define HERMES_RID_PRIID 0xFD02 -#define HERMES_RID_PRISUPRANGE 0xFD03 -#define HERMES_RID_CFIACTRANGES 0xFD04 -#define HERMES_RID_NICSERNUM 0xFD0A -#define HERMES_RID_NICID 0xFD0B -#define HERMES_RID_MFISUPRANGE 0xFD0C -#define HERMES_RID_CFISUPRANGE 0xFD0D -#define HERMES_RID_CHANNELLIST 0xFD10 -#define HERMES_RID_REGULATORYDOMAINS 0xFD11 -#define HERMES_RID_TEMPTYPE 0xFD12 -#define HERMES_RID_CIS 0xFD13 -#define HERMES_RID_STAID 0xFD20 -#define HERMES_RID_STASUPRANGE 0xFD21 -#define HERMES_RID_MFIACTRANGES 0xFD22 -#define HERMES_RID_CFIACTRANGES2 0xFD23 -#define HERMES_RID_SECONDARYVERSION_SYMBOL 0xFD24 -#define HERMES_RID_PORTSTATUS 0xFD40 -#define HERMES_RID_CURRENTSSID 0xFD41 -#define HERMES_RID_CURRENTBSSID 0xFD42 -#define HERMES_RID_COMMSQUALITY 0xFD43 -#define HERMES_RID_CURRENTTXRATE 0xFD44 -#define HERMES_RID_CURRENTBEACONINTERVAL 0xFD45 -#define HERMES_RID_CURRENTSCALETHRESHOLDS 0xFD46 -#define HERMES_RID_PROTOCOLRSPTIME 0xFD47 -#define HERMES_RID_SHORTRETRYLIMIT 0xFD48 -#define HERMES_RID_LONGRETRYLIMIT 0xFD49 -#define HERMES_RID_MAXTRANSMITLIFETIME 0xFD4A -#define HERMES_RID_MAXRECEIVELIFETIME 0xFD4B -#define HERMES_RID_CFPOLLABLE 0xFD4C -#define HERMES_RID_AUTHENTICATIONALGORITHMS 0xFD4D -#define HERMES_RID_PRIVACYOPTIONIMPLEMENTED 0xFD4F -#define HERMES_RID_DBMCOMMSQUALITY_INTERSIL 0xFD51 -#define HERMES_RID_CURRENTTXRATE1 0xFD80 -#define HERMES_RID_CURRENTTXRATE2 0xFD81 -#define HERMES_RID_CURRENTTXRATE3 0xFD82 -#define HERMES_RID_CURRENTTXRATE4 0xFD83 -#define HERMES_RID_CURRENTTXRATE5 0xFD84 -#define HERMES_RID_CURRENTTXRATE6 0xFD85 -#define HERMES_RID_OWNMACADDR 0xFD86 -#define HERMES_RID_SCANRESULTSTABLE 0xFD88 -#define HERMES_RID_CURRENT_COUNTRY_INFO 0xFD89 -#define HERMES_RID_CURRENT_WPA_IE 0xFD8A -#define HERMES_RID_CURRENT_TKIP_IV 0xFD8B -#define HERMES_RID_CURRENT_ASSOC_REQ_INFO 0xFD8C -#define HERMES_RID_CURRENT_ASSOC_RESP_INFO 0xFD8D -#define HERMES_RID_TXQUEUEEMPTY 0xFD91 -#define HERMES_RID_PHYTYPE 0xFDC0 -#define HERMES_RID_CURRENTCHANNEL 0xFDC1 -#define HERMES_RID_CURRENTPOWERSTATE 0xFDC2 -#define HERMES_RID_CCAMODE 0xFDC3 -#define HERMES_RID_SUPPORTEDDATARATES 0xFDC6 -#define HERMES_RID_BUILDSEQ 0xFFFE -#define HERMES_RID_FWID 0xFFFF - -#endif diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c deleted file mode 100644 index c09c8437c0b8..000000000000 --- a/drivers/net/wireless/orinoco/hw.c +++ /dev/null @@ -1,1356 +0,0 @@ -/* Encapsulate basic setting changes and retrieval on Hermes hardware - * - * See copyright notice in main.c - */ -#include -#include -#include -#include -#include -#include -#include "hermes.h" -#include "hermes_rid.h" -#include "orinoco.h" - -#include "hw.h" - -#define SYMBOL_MAX_VER_LEN (14) - -/* Symbol firmware has a bug allocating buffers larger than this */ -#define TX_NICBUF_SIZE_BUG 1585 - -/********************************************************************/ -/* Data tables */ -/********************************************************************/ - -/* This tables gives the actual meanings of the bitrate IDs returned - * by the firmware. */ -static const struct { - int bitrate; /* in 100s of kilobits */ - int automatic; - u16 agere_txratectrl; - u16 intersil_txratectrl; -} bitrate_table[] = { - {110, 1, 3, 15}, /* Entry 0 is the default */ - {10, 0, 1, 1}, - {10, 1, 1, 1}, - {20, 0, 2, 2}, - {20, 1, 6, 3}, - {55, 0, 4, 4}, - {55, 1, 7, 7}, - {110, 0, 5, 8}, -}; -#define BITRATE_TABLE_SIZE ARRAY_SIZE(bitrate_table) - -/* Firmware version encoding */ -struct comp_id { - u16 id, variant, major, minor; -} __packed; - -static inline enum fwtype determine_firmware_type(struct comp_id *nic_id) -{ - if (nic_id->id < 0x8000) - return FIRMWARE_TYPE_AGERE; - else if (nic_id->id == 0x8000 && nic_id->major == 0) - return FIRMWARE_TYPE_SYMBOL; - else - return FIRMWARE_TYPE_INTERSIL; -} - -/* Set priv->firmware type, determine firmware properties - * This function can be called before we have registerred with netdev, - * so all errors go out with dev_* rather than printk - * - * If non-NULL stores a firmware description in fw_name. - * If non-NULL stores a HW version in hw_ver - * - * These are output via generic cfg80211 ethtool support. - */ -int determine_fw_capabilities(struct orinoco_private *priv, - char *fw_name, size_t fw_name_len, - u32 *hw_ver) -{ - struct device *dev = priv->dev; - struct hermes *hw = &priv->hw; - int err; - struct comp_id nic_id, sta_id; - unsigned int firmver; - char tmp[SYMBOL_MAX_VER_LEN + 1] __attribute__((aligned(2))); - - /* Get the hardware version */ - err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_NICID, &nic_id); - if (err) { - dev_err(dev, "Cannot read hardware identity: error %d\n", - err); - return err; - } - - le16_to_cpus(&nic_id.id); - le16_to_cpus(&nic_id.variant); - le16_to_cpus(&nic_id.major); - le16_to_cpus(&nic_id.minor); - dev_info(dev, "Hardware identity %04x:%04x:%04x:%04x\n", - nic_id.id, nic_id.variant, nic_id.major, nic_id.minor); - - if (hw_ver) - *hw_ver = (((nic_id.id & 0xff) << 24) | - ((nic_id.variant & 0xff) << 16) | - ((nic_id.major & 0xff) << 8) | - (nic_id.minor & 0xff)); - - priv->firmware_type = determine_firmware_type(&nic_id); - - /* Get the firmware version */ - err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_STAID, &sta_id); - if (err) { - dev_err(dev, "Cannot read station identity: error %d\n", - err); - return err; - } - - le16_to_cpus(&sta_id.id); - le16_to_cpus(&sta_id.variant); - le16_to_cpus(&sta_id.major); - le16_to_cpus(&sta_id.minor); - dev_info(dev, "Station identity %04x:%04x:%04x:%04x\n", - sta_id.id, sta_id.variant, sta_id.major, sta_id.minor); - - switch (sta_id.id) { - case 0x15: - dev_err(dev, "Primary firmware is active\n"); - return -ENODEV; - case 0x14b: - dev_err(dev, "Tertiary firmware is active\n"); - return -ENODEV; - case 0x1f: /* Intersil, Agere, Symbol Spectrum24 */ - case 0x21: /* Symbol Spectrum24 Trilogy */ - break; - default: - dev_notice(dev, "Unknown station ID, please report\n"); - break; - } - - /* Default capabilities */ - priv->has_sensitivity = 1; - priv->has_mwo = 0; - priv->has_preamble = 0; - priv->has_port3 = 1; - priv->has_ibss = 1; - priv->has_wep = 0; - priv->has_big_wep = 0; - priv->has_alt_txcntl = 0; - priv->has_ext_scan = 0; - priv->has_wpa = 0; - priv->do_fw_download = 0; - - /* Determine capabilities from the firmware version */ - switch (priv->firmware_type) { - case FIRMWARE_TYPE_AGERE: - /* Lucent Wavelan IEEE, Lucent Orinoco, Cabletron RoamAbout, - ELSA, Melco, HP, IBM, Dell 1150, Compaq 110/210 */ - if (fw_name) - snprintf(fw_name, fw_name_len, "Lucent/Agere %d.%02d", - sta_id.major, sta_id.minor); - - firmver = ((unsigned long)sta_id.major << 16) | sta_id.minor; - - priv->has_ibss = (firmver >= 0x60006); - priv->has_wep = (firmver >= 0x40020); - priv->has_big_wep = 1; /* FIXME: this is wrong - how do we tell - Gold cards from the others? */ - priv->has_mwo = (firmver >= 0x60000); - priv->has_pm = (firmver >= 0x40020); /* Don't work in 7.52 ? */ - priv->ibss_port = 1; - priv->has_hostscan = (firmver >= 0x8000a); - priv->do_fw_download = 1; - priv->broken_monitor = (firmver >= 0x80000); - priv->has_alt_txcntl = (firmver >= 0x90000); /* All 9.x ? */ - priv->has_ext_scan = (firmver >= 0x90000); /* All 9.x ? */ - priv->has_wpa = (firmver >= 0x9002a); - /* Tested with Agere firmware : - * 1.16 ; 4.08 ; 4.52 ; 6.04 ; 6.16 ; 7.28 => Jean II - * Tested CableTron firmware : 4.32 => Anton */ - break; - case FIRMWARE_TYPE_SYMBOL: - /* Symbol , 3Com AirConnect, Intel, Ericsson WLAN */ - /* Intel MAC : 00:02:B3:* */ - /* 3Com MAC : 00:50:DA:* */ - memset(tmp, 0, sizeof(tmp)); - /* Get the Symbol firmware version */ - err = hw->ops->read_ltv(hw, USER_BAP, - HERMES_RID_SECONDARYVERSION_SYMBOL, - SYMBOL_MAX_VER_LEN, NULL, &tmp); - if (err) { - dev_warn(dev, "Error %d reading Symbol firmware info. " - "Wildly guessing capabilities...\n", err); - firmver = 0; - tmp[0] = '\0'; - } else { - /* The firmware revision is a string, the format is - * something like : "V2.20-01". - * Quick and dirty parsing... - Jean II - */ - firmver = ((tmp[1] - '0') << 16) - | ((tmp[3] - '0') << 12) - | ((tmp[4] - '0') << 8) - | ((tmp[6] - '0') << 4) - | (tmp[7] - '0'); - - tmp[SYMBOL_MAX_VER_LEN] = '\0'; - } - - if (fw_name) - snprintf(fw_name, fw_name_len, "Symbol %s", tmp); - - priv->has_ibss = (firmver >= 0x20000); - priv->has_wep = (firmver >= 0x15012); - priv->has_big_wep = (firmver >= 0x20000); - priv->has_pm = (firmver >= 0x20000 && firmver < 0x22000) || - (firmver >= 0x29000 && firmver < 0x30000) || - firmver >= 0x31000; - priv->has_preamble = (firmver >= 0x20000); - priv->ibss_port = 4; - - /* Symbol firmware is found on various cards, but - * there has been no attempt to check firmware - * download on non-spectrum_cs based cards. - * - * Given that the Agere firmware download works - * differently, we should avoid doing a firmware - * download with the Symbol algorithm on non-spectrum - * cards. - * - * For now we can identify a spectrum_cs based card - * because it has a firmware reset function. - */ - priv->do_fw_download = (priv->stop_fw != NULL); - - priv->broken_disableport = (firmver == 0x25013) || - (firmver >= 0x30000 && firmver <= 0x31000); - priv->has_hostscan = (firmver >= 0x31001) || - (firmver >= 0x29057 && firmver < 0x30000); - /* Tested with Intel firmware : 0x20015 => Jean II */ - /* Tested with 3Com firmware : 0x15012 & 0x22001 => Jean II */ - break; - case FIRMWARE_TYPE_INTERSIL: - /* D-Link, Linksys, Adtron, ZoomAir, and many others... - * Samsung, Compaq 100/200 and Proxim are slightly - * different and less well tested */ - /* D-Link MAC : 00:40:05:* */ - /* Addtron MAC : 00:90:D1:* */ - if (fw_name) - snprintf(fw_name, fw_name_len, "Intersil %d.%d.%d", - sta_id.major, sta_id.minor, sta_id.variant); - - firmver = ((unsigned long)sta_id.major << 16) | - ((unsigned long)sta_id.minor << 8) | sta_id.variant; - - priv->has_ibss = (firmver >= 0x000700); /* FIXME */ - priv->has_big_wep = priv->has_wep = (firmver >= 0x000800); - priv->has_pm = (firmver >= 0x000700); - priv->has_hostscan = (firmver >= 0x010301); - - if (firmver >= 0x000800) - priv->ibss_port = 0; - else { - dev_notice(dev, "Intersil firmware earlier than v0.8.x" - " - several features not supported\n"); - priv->ibss_port = 1; - } - break; - } - if (fw_name) - dev_info(dev, "Firmware determined as %s\n", fw_name); - -#ifndef CONFIG_HERMES_PRISM - if (priv->firmware_type == FIRMWARE_TYPE_INTERSIL) { - dev_err(dev, "Support for Prism chipset is not enabled\n"); - return -ENODEV; - } -#endif - - return 0; -} - -/* Read settings from EEPROM into our private structure. - * MAC address gets dropped into callers buffer - * Can be called before netdev registration. - */ -int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr) -{ - struct device *dev = priv->dev; - struct hermes_idstring nickbuf; - struct hermes *hw = &priv->hw; - int len; - int err; - u16 reclen; - - /* Get the MAC address */ - err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR, - ETH_ALEN, NULL, dev_addr); - if (err) { - dev_warn(dev, "Failed to read MAC address!\n"); - goto out; - } - - dev_dbg(dev, "MAC address %pM\n", dev_addr); - - /* Get the station name */ - err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME, - sizeof(nickbuf), &reclen, &nickbuf); - if (err) { - dev_err(dev, "failed to read station name\n"); - goto out; - } - if (nickbuf.len) - len = min(IW_ESSID_MAX_SIZE, (int)le16_to_cpu(nickbuf.len)); - else - len = min(IW_ESSID_MAX_SIZE, 2 * reclen); - memcpy(priv->nick, &nickbuf.val, len); - priv->nick[len] = '\0'; - - dev_dbg(dev, "Station name \"%s\"\n", priv->nick); - - /* Get allowed channels */ - err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CHANNELLIST, - &priv->channel_mask); - if (err) { - dev_err(dev, "Failed to read channel list!\n"); - goto out; - } - - /* Get initial AP density */ - err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFSYSTEMSCALE, - &priv->ap_density); - if (err || priv->ap_density < 1 || priv->ap_density > 3) - priv->has_sensitivity = 0; - - /* Get initial RTS threshold */ - err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFRTSTHRESHOLD, - &priv->rts_thresh); - if (err) { - dev_err(dev, "Failed to read RTS threshold!\n"); - goto out; - } - - /* Get initial fragmentation settings */ - if (priv->has_mwo) - err = hermes_read_wordrec(hw, USER_BAP, - HERMES_RID_CNFMWOROBUST_AGERE, - &priv->mwo_robust); - else - err = hermes_read_wordrec(hw, USER_BAP, - HERMES_RID_CNFFRAGMENTATIONTHRESHOLD, - &priv->frag_thresh); - if (err) { - dev_err(dev, "Failed to read fragmentation settings!\n"); - goto out; - } - - /* Power management setup */ - if (priv->has_pm) { - priv->pm_on = 0; - priv->pm_mcast = 1; - err = hermes_read_wordrec(hw, USER_BAP, - HERMES_RID_CNFMAXSLEEPDURATION, - &priv->pm_period); - if (err) { - dev_err(dev, "Failed to read power management " - "period!\n"); - goto out; - } - err = hermes_read_wordrec(hw, USER_BAP, - HERMES_RID_CNFPMHOLDOVERDURATION, - &priv->pm_timeout); - if (err) { - dev_err(dev, "Failed to read power management " - "timeout!\n"); - goto out; - } - } - - /* Preamble setup */ - if (priv->has_preamble) { - err = hermes_read_wordrec(hw, USER_BAP, - HERMES_RID_CNFPREAMBLE_SYMBOL, - &priv->preamble); - if (err) { - dev_err(dev, "Failed to read preamble setup\n"); - goto out; - } - } - - /* Retry settings */ - err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_SHORTRETRYLIMIT, - &priv->short_retry_limit); - if (err) { - dev_err(dev, "Failed to read short retry limit\n"); - goto out; - } - - err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_LONGRETRYLIMIT, - &priv->long_retry_limit); - if (err) { - dev_err(dev, "Failed to read long retry limit\n"); - goto out; - } - - err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_MAXTRANSMITLIFETIME, - &priv->retry_lifetime); - if (err) { - dev_err(dev, "Failed to read max retry lifetime\n"); - goto out; - } - -out: - return err; -} - -/* Can be called before netdev registration */ -int orinoco_hw_allocate_fid(struct orinoco_private *priv) -{ - struct device *dev = priv->dev; - struct hermes *hw = &priv->hw; - int err; - - err = hw->ops->allocate(hw, priv->nicbuf_size, &priv->txfid); - if (err == -EIO && priv->nicbuf_size > TX_NICBUF_SIZE_BUG) { - /* Try workaround for old Symbol firmware bug */ - priv->nicbuf_size = TX_NICBUF_SIZE_BUG; - err = hw->ops->allocate(hw, priv->nicbuf_size, &priv->txfid); - - dev_warn(dev, "Firmware ALLOC bug detected " - "(old Symbol firmware?). Work around %s\n", - err ? "failed!" : "ok."); - } - - return err; -} - -int orinoco_get_bitratemode(int bitrate, int automatic) -{ - int ratemode = -1; - int i; - - if ((bitrate != 10) && (bitrate != 20) && - (bitrate != 55) && (bitrate != 110)) - return ratemode; - - for (i = 0; i < BITRATE_TABLE_SIZE; i++) { - if ((bitrate_table[i].bitrate == bitrate) && - (bitrate_table[i].automatic == automatic)) { - ratemode = i; - break; - } - } - return ratemode; -} - -void orinoco_get_ratemode_cfg(int ratemode, int *bitrate, int *automatic) -{ - BUG_ON((ratemode < 0) || (ratemode >= BITRATE_TABLE_SIZE)); - - *bitrate = bitrate_table[ratemode].bitrate * 100000; - *automatic = bitrate_table[ratemode].automatic; -} - -int orinoco_hw_program_rids(struct orinoco_private *priv) -{ - struct net_device *dev = priv->ndev; - struct wireless_dev *wdev = netdev_priv(dev); - struct hermes *hw = &priv->hw; - int err; - struct hermes_idstring idbuf; - - /* Set the MAC address */ - err = hw->ops->write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR, - HERMES_BYTES_TO_RECLEN(ETH_ALEN), - dev->dev_addr); - if (err) { - printk(KERN_ERR "%s: Error %d setting MAC address\n", - dev->name, err); - return err; - } - - /* Set up the link mode */ - err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNFPORTTYPE, - priv->port_type); - if (err) { - printk(KERN_ERR "%s: Error %d setting port type\n", - dev->name, err); - return err; - } - /* Set the channel/frequency */ - if (priv->channel != 0 && priv->iw_mode != NL80211_IFTYPE_STATION) { - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFOWNCHANNEL, - priv->channel); - if (err) { - printk(KERN_ERR "%s: Error %d setting channel %d\n", - dev->name, err, priv->channel); - return err; - } - } - - if (priv->has_ibss) { - u16 createibss; - - if ((strlen(priv->desired_essid) == 0) && (priv->createibss)) { - printk(KERN_WARNING "%s: This firmware requires an " - "ESSID in IBSS-Ad-Hoc mode.\n", dev->name); - /* With wvlan_cs, in this case, we would crash. - * hopefully, this driver will behave better... - * Jean II */ - createibss = 0; - } else { - createibss = priv->createibss; - } - - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFCREATEIBSS, - createibss); - if (err) { - printk(KERN_ERR "%s: Error %d setting CREATEIBSS\n", - dev->name, err); - return err; - } - } - - /* Set the desired BSSID */ - err = __orinoco_hw_set_wap(priv); - if (err) { - printk(KERN_ERR "%s: Error %d setting AP address\n", - dev->name, err); - return err; - } - - /* Set the desired ESSID */ - idbuf.len = cpu_to_le16(strlen(priv->desired_essid)); - memcpy(&idbuf.val, priv->desired_essid, sizeof(idbuf.val)); - /* WinXP wants partner to configure OWNSSID even in IBSS mode. (jimc) */ - err = hw->ops->write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNSSID, - HERMES_BYTES_TO_RECLEN(strlen(priv->desired_essid) + 2), - &idbuf); - if (err) { - printk(KERN_ERR "%s: Error %d setting OWNSSID\n", - dev->name, err); - return err; - } - err = hw->ops->write_ltv(hw, USER_BAP, HERMES_RID_CNFDESIREDSSID, - HERMES_BYTES_TO_RECLEN(strlen(priv->desired_essid) + 2), - &idbuf); - if (err) { - printk(KERN_ERR "%s: Error %d setting DESIREDSSID\n", - dev->name, err); - return err; - } - - /* Set the station name */ - idbuf.len = cpu_to_le16(strlen(priv->nick)); - memcpy(&idbuf.val, priv->nick, sizeof(idbuf.val)); - err = hw->ops->write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME, - HERMES_BYTES_TO_RECLEN(strlen(priv->nick) + 2), - &idbuf); - if (err) { - printk(KERN_ERR "%s: Error %d setting nickname\n", - dev->name, err); - return err; - } - - /* Set AP density */ - if (priv->has_sensitivity) { - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFSYSTEMSCALE, - priv->ap_density); - if (err) { - printk(KERN_WARNING "%s: Error %d setting SYSTEMSCALE. " - "Disabling sensitivity control\n", - dev->name, err); - - priv->has_sensitivity = 0; - } - } - - /* Set RTS threshold */ - err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNFRTSTHRESHOLD, - priv->rts_thresh); - if (err) { - printk(KERN_ERR "%s: Error %d setting RTS threshold\n", - dev->name, err); - return err; - } - - /* Set fragmentation threshold or MWO robustness */ - if (priv->has_mwo) - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFMWOROBUST_AGERE, - priv->mwo_robust); - else - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFFRAGMENTATIONTHRESHOLD, - priv->frag_thresh); - if (err) { - printk(KERN_ERR "%s: Error %d setting fragmentation\n", - dev->name, err); - return err; - } - - /* Set bitrate */ - err = __orinoco_hw_set_bitrate(priv); - if (err) { - printk(KERN_ERR "%s: Error %d setting bitrate\n", - dev->name, err); - return err; - } - - /* Set power management */ - if (priv->has_pm) { - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFPMENABLED, - priv->pm_on); - if (err) { - printk(KERN_ERR "%s: Error %d setting up PM\n", - dev->name, err); - return err; - } - - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFMULTICASTRECEIVE, - priv->pm_mcast); - if (err) { - printk(KERN_ERR "%s: Error %d setting up PM\n", - dev->name, err); - return err; - } - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFMAXSLEEPDURATION, - priv->pm_period); - if (err) { - printk(KERN_ERR "%s: Error %d setting up PM\n", - dev->name, err); - return err; - } - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFPMHOLDOVERDURATION, - priv->pm_timeout); - if (err) { - printk(KERN_ERR "%s: Error %d setting up PM\n", - dev->name, err); - return err; - } - } - - /* Set preamble - only for Symbol so far... */ - if (priv->has_preamble) { - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFPREAMBLE_SYMBOL, - priv->preamble); - if (err) { - printk(KERN_ERR "%s: Error %d setting preamble\n", - dev->name, err); - return err; - } - } - - /* Set up encryption */ - if (priv->has_wep || priv->has_wpa) { - err = __orinoco_hw_setup_enc(priv); - if (err) { - printk(KERN_ERR "%s: Error %d activating encryption\n", - dev->name, err); - return err; - } - } - - if (priv->iw_mode == NL80211_IFTYPE_MONITOR) { - /* Enable monitor mode */ - dev->type = ARPHRD_IEEE80211; - err = hw->ops->cmd_wait(hw, HERMES_CMD_TEST | - HERMES_TEST_MONITOR, 0, NULL); - } else { - /* Disable monitor mode */ - dev->type = ARPHRD_ETHER; - err = hw->ops->cmd_wait(hw, HERMES_CMD_TEST | - HERMES_TEST_STOP, 0, NULL); - } - if (err) - return err; - - /* Reset promiscuity / multicast*/ - priv->promiscuous = 0; - priv->mc_count = 0; - - /* Record mode change */ - wdev->iftype = priv->iw_mode; - - return 0; -} - -/* Get tsc from the firmware */ -int orinoco_hw_get_tkip_iv(struct orinoco_private *priv, int key, u8 *tsc) -{ - struct hermes *hw = &priv->hw; - int err = 0; - u8 tsc_arr[4][ORINOCO_SEQ_LEN]; - - if ((key < 0) || (key >= 4)) - return -EINVAL; - - err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_TKIP_IV, - sizeof(tsc_arr), NULL, &tsc_arr); - if (!err) - memcpy(tsc, &tsc_arr[key][0], sizeof(tsc_arr[0])); - - return err; -} - -int __orinoco_hw_set_bitrate(struct orinoco_private *priv) -{ - struct hermes *hw = &priv->hw; - int ratemode = priv->bitratemode; - int err = 0; - - if (ratemode >= BITRATE_TABLE_SIZE) { - printk(KERN_ERR "%s: BUG: Invalid bitrate mode %d\n", - priv->ndev->name, ratemode); - return -EINVAL; - } - - switch (priv->firmware_type) { - case FIRMWARE_TYPE_AGERE: - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFTXRATECONTROL, - bitrate_table[ratemode].agere_txratectrl); - break; - case FIRMWARE_TYPE_INTERSIL: - case FIRMWARE_TYPE_SYMBOL: - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFTXRATECONTROL, - bitrate_table[ratemode].intersil_txratectrl); - break; - default: - BUG(); - } - - return err; -} - -int orinoco_hw_get_act_bitrate(struct orinoco_private *priv, int *bitrate) -{ - struct hermes *hw = &priv->hw; - int i; - int err = 0; - u16 val; - - err = hermes_read_wordrec(hw, USER_BAP, - HERMES_RID_CURRENTTXRATE, &val); - if (err) - return err; - - switch (priv->firmware_type) { - case FIRMWARE_TYPE_AGERE: /* Lucent style rate */ - /* Note : in Lucent firmware, the return value of - * HERMES_RID_CURRENTTXRATE is the bitrate in Mb/s, - * and therefore is totally different from the - * encoding of HERMES_RID_CNFTXRATECONTROL. - * Don't forget that 6Mb/s is really 5.5Mb/s */ - if (val == 6) - *bitrate = 5500000; - else - *bitrate = val * 1000000; - break; - case FIRMWARE_TYPE_INTERSIL: /* Intersil style rate */ - case FIRMWARE_TYPE_SYMBOL: /* Symbol style rate */ - for (i = 0; i < BITRATE_TABLE_SIZE; i++) - if (bitrate_table[i].intersil_txratectrl == val) { - *bitrate = bitrate_table[i].bitrate * 100000; - break; - } - - if (i >= BITRATE_TABLE_SIZE) { - printk(KERN_INFO "%s: Unable to determine current bitrate (0x%04hx)\n", - priv->ndev->name, val); - err = -EIO; - } - - break; - default: - BUG(); - } - - return err; -} - -/* Set fixed AP address */ -int __orinoco_hw_set_wap(struct orinoco_private *priv) -{ - int roaming_flag; - int err = 0; - struct hermes *hw = &priv->hw; - - switch (priv->firmware_type) { - case FIRMWARE_TYPE_AGERE: - /* not supported */ - break; - case FIRMWARE_TYPE_INTERSIL: - if (priv->bssid_fixed) - roaming_flag = 2; - else - roaming_flag = 1; - - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFROAMINGMODE, - roaming_flag); - break; - case FIRMWARE_TYPE_SYMBOL: - err = HERMES_WRITE_RECORD(hw, USER_BAP, - HERMES_RID_CNFMANDATORYBSSID_SYMBOL, - &priv->desired_bssid); - break; - } - return err; -} - -/* Change the WEP keys and/or the current keys. Can be called - * either from __orinoco_hw_setup_enc() or directly from - * orinoco_ioctl_setiwencode(). In the later case the association - * with the AP is not broken (if the firmware can handle it), - * which is needed for 802.1x implementations. */ -int __orinoco_hw_setup_wepkeys(struct orinoco_private *priv) -{ - struct hermes *hw = &priv->hw; - int err = 0; - int i; - - switch (priv->firmware_type) { - case FIRMWARE_TYPE_AGERE: - { - struct orinoco_key keys[ORINOCO_MAX_KEYS]; - - memset(&keys, 0, sizeof(keys)); - for (i = 0; i < ORINOCO_MAX_KEYS; i++) { - int len = min(priv->keys[i].key_len, - ORINOCO_MAX_KEY_SIZE); - memcpy(&keys[i].data, priv->keys[i].key, len); - if (len > SMALL_KEY_SIZE) - keys[i].len = cpu_to_le16(LARGE_KEY_SIZE); - else if (len > 0) - keys[i].len = cpu_to_le16(SMALL_KEY_SIZE); - else - keys[i].len = cpu_to_le16(0); - } - - err = HERMES_WRITE_RECORD(hw, USER_BAP, - HERMES_RID_CNFWEPKEYS_AGERE, - &keys); - if (err) - return err; - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFTXKEY_AGERE, - priv->tx_key); - if (err) - return err; - break; - } - case FIRMWARE_TYPE_INTERSIL: - case FIRMWARE_TYPE_SYMBOL: - { - int keylen; - - /* Force uniform key length to work around - * firmware bugs */ - keylen = priv->keys[priv->tx_key].key_len; - - if (keylen > LARGE_KEY_SIZE) { - printk(KERN_ERR "%s: BUG: Key %d has oversize length %d.\n", - priv->ndev->name, priv->tx_key, keylen); - return -E2BIG; - } else if (keylen > SMALL_KEY_SIZE) - keylen = LARGE_KEY_SIZE; - else if (keylen > 0) - keylen = SMALL_KEY_SIZE; - else - keylen = 0; - - /* Write all 4 keys */ - for (i = 0; i < ORINOCO_MAX_KEYS; i++) { - u8 key[LARGE_KEY_SIZE] = { 0 }; - - memcpy(key, priv->keys[i].key, - priv->keys[i].key_len); - - err = hw->ops->write_ltv(hw, USER_BAP, - HERMES_RID_CNFDEFAULTKEY0 + i, - HERMES_BYTES_TO_RECLEN(keylen), - key); - if (err) - return err; - } - - /* Write the index of the key used in transmission */ - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFWEPDEFAULTKEYID, - priv->tx_key); - if (err) - return err; - } - break; - } - - return 0; -} - -int __orinoco_hw_setup_enc(struct orinoco_private *priv) -{ - struct hermes *hw = &priv->hw; - int err = 0; - int master_wep_flag; - int auth_flag; - int enc_flag; - - /* Setup WEP keys */ - if (priv->encode_alg == ORINOCO_ALG_WEP) - __orinoco_hw_setup_wepkeys(priv); - - if (priv->wep_restrict) - auth_flag = HERMES_AUTH_SHARED_KEY; - else - auth_flag = HERMES_AUTH_OPEN; - - if (priv->wpa_enabled) - enc_flag = 2; - else if (priv->encode_alg == ORINOCO_ALG_WEP) - enc_flag = 1; - else - enc_flag = 0; - - switch (priv->firmware_type) { - case FIRMWARE_TYPE_AGERE: /* Agere style WEP */ - if (priv->encode_alg == ORINOCO_ALG_WEP) { - /* Enable the shared-key authentication. */ - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFAUTHENTICATION_AGERE, - auth_flag); - } - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFWEPENABLED_AGERE, - enc_flag); - if (err) - return err; - - if (priv->has_wpa) { - /* Set WPA key management */ - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFSETWPAAUTHMGMTSUITE_AGERE, - priv->key_mgmt); - if (err) - return err; - } - - break; - - case FIRMWARE_TYPE_INTERSIL: /* Intersil style WEP */ - case FIRMWARE_TYPE_SYMBOL: /* Symbol style WEP */ - if (priv->encode_alg == ORINOCO_ALG_WEP) { - if (priv->wep_restrict || - (priv->firmware_type == FIRMWARE_TYPE_SYMBOL)) - master_wep_flag = HERMES_WEP_PRIVACY_INVOKED | - HERMES_WEP_EXCL_UNENCRYPTED; - else - master_wep_flag = HERMES_WEP_PRIVACY_INVOKED; - - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFAUTHENTICATION, - auth_flag); - if (err) - return err; - } else - master_wep_flag = 0; - - if (priv->iw_mode == NL80211_IFTYPE_MONITOR) - master_wep_flag |= HERMES_WEP_HOST_DECRYPT; - - /* Master WEP setting : on/off */ - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFWEPFLAGS_INTERSIL, - master_wep_flag); - if (err) - return err; - - break; - } - - return 0; -} - -/* key must be 32 bytes, including the tx and rx MIC keys. - * rsc must be NULL or up to 8 bytes - * tsc must be NULL or up to 8 bytes - */ -int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx, - int set_tx, u8 *key, u8 *rsc, size_t rsc_len, - u8 *tsc, size_t tsc_len) -{ - struct { - __le16 idx; - u8 rsc[ORINOCO_SEQ_LEN]; - u8 key[TKIP_KEYLEN]; - u8 tx_mic[MIC_KEYLEN]; - u8 rx_mic[MIC_KEYLEN]; - u8 tsc[ORINOCO_SEQ_LEN]; - } __packed buf; - struct hermes *hw = &priv->hw; - int ret; - int err; - int k; - u16 xmitting; - - key_idx &= 0x3; - - if (set_tx) - key_idx |= 0x8000; - - buf.idx = cpu_to_le16(key_idx); - memcpy(buf.key, key, - sizeof(buf.key) + sizeof(buf.tx_mic) + sizeof(buf.rx_mic)); - - if (rsc_len > sizeof(buf.rsc)) - rsc_len = sizeof(buf.rsc); - - if (tsc_len > sizeof(buf.tsc)) - tsc_len = sizeof(buf.tsc); - - memset(buf.rsc, 0, sizeof(buf.rsc)); - memset(buf.tsc, 0, sizeof(buf.tsc)); - - if (rsc != NULL) - memcpy(buf.rsc, rsc, rsc_len); - - if (tsc != NULL) - memcpy(buf.tsc, tsc, tsc_len); - else - buf.tsc[4] = 0x10; - - /* Wait up to 100ms for tx queue to empty */ - for (k = 100; k > 0; k--) { - udelay(1000); - ret = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_TXQUEUEEMPTY, - &xmitting); - if (ret || !xmitting) - break; - } - - if (k == 0) - ret = -ETIMEDOUT; - - err = HERMES_WRITE_RECORD(hw, USER_BAP, - HERMES_RID_CNFADDDEFAULTTKIPKEY_AGERE, - &buf); - - return ret ? ret : err; -} - -int orinoco_clear_tkip_key(struct orinoco_private *priv, int key_idx) -{ - struct hermes *hw = &priv->hw; - int err; - - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFREMDEFAULTTKIPKEY_AGERE, - key_idx); - if (err) - printk(KERN_WARNING "%s: Error %d clearing TKIP key %d\n", - priv->ndev->name, err, key_idx); - return err; -} - -int __orinoco_hw_set_multicast_list(struct orinoco_private *priv, - struct net_device *dev, - int mc_count, int promisc) -{ - struct hermes *hw = &priv->hw; - int err = 0; - - if (promisc != priv->promiscuous) { - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFPROMISCUOUSMODE, - promisc); - if (err) { - printk(KERN_ERR "%s: Error %d setting PROMISCUOUSMODE to 1.\n", - priv->ndev->name, err); - } else - priv->promiscuous = promisc; - } - - /* If we're not in promiscuous mode, then we need to set the - * group address if either we want to multicast, or if we were - * multicasting and want to stop */ - if (!promisc && (mc_count || priv->mc_count)) { - struct netdev_hw_addr *ha; - struct hermes_multicast mclist; - int i = 0; - - netdev_for_each_mc_addr(ha, dev) { - if (i == mc_count) - break; - memcpy(mclist.addr[i++], ha->addr, ETH_ALEN); - } - - err = hw->ops->write_ltv(hw, USER_BAP, - HERMES_RID_CNFGROUPADDRESSES, - HERMES_BYTES_TO_RECLEN(mc_count * ETH_ALEN), - &mclist); - if (err) - printk(KERN_ERR "%s: Error %d setting multicast list.\n", - priv->ndev->name, err); - else - priv->mc_count = mc_count; - } - return err; -} - -/* Return : < 0 -> error code ; >= 0 -> length */ -int orinoco_hw_get_essid(struct orinoco_private *priv, int *active, - char buf[IW_ESSID_MAX_SIZE + 1]) -{ - struct hermes *hw = &priv->hw; - int err = 0; - struct hermes_idstring essidbuf; - char *p = (char *)(&essidbuf.val); - int len; - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - if (strlen(priv->desired_essid) > 0) { - /* We read the desired SSID from the hardware rather - than from priv->desired_essid, just in case the - firmware is allowed to change it on us. I'm not - sure about this */ - /* My guess is that the OWNSSID should always be whatever - * we set to the card, whereas CURRENT_SSID is the one that - * may change... - Jean II */ - u16 rid; - - *active = 1; - - rid = (priv->port_type == 3) ? HERMES_RID_CNFOWNSSID : - HERMES_RID_CNFDESIREDSSID; - - err = hw->ops->read_ltv(hw, USER_BAP, rid, sizeof(essidbuf), - NULL, &essidbuf); - if (err) - goto fail_unlock; - } else { - *active = 0; - - err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CURRENTSSID, - sizeof(essidbuf), NULL, &essidbuf); - if (err) - goto fail_unlock; - } - - len = le16_to_cpu(essidbuf.len); - BUG_ON(len > IW_ESSID_MAX_SIZE); - - memset(buf, 0, IW_ESSID_MAX_SIZE); - memcpy(buf, p, len); - err = len; - - fail_unlock: - orinoco_unlock(priv, &flags); - - return err; -} - -int orinoco_hw_get_freq(struct orinoco_private *priv) -{ - struct hermes *hw = &priv->hw; - int err = 0; - u16 channel; - int freq = 0; - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CURRENTCHANNEL, - &channel); - if (err) - goto out; - - /* Intersil firmware 1.3.5 returns 0 when the interface is down */ - if (channel == 0) { - err = -EBUSY; - goto out; - } - - if ((channel < 1) || (channel > NUM_CHANNELS)) { - printk(KERN_WARNING "%s: Channel out of range (%d)!\n", - priv->ndev->name, channel); - err = -EBUSY; - goto out; - - } - freq = ieee80211_dsss_chan_to_freq(channel); - - out: - orinoco_unlock(priv, &flags); - - if (err > 0) - err = -EBUSY; - return err ? err : freq; -} - -int orinoco_hw_get_bitratelist(struct orinoco_private *priv, - int *numrates, s32 *rates, int max) -{ - struct hermes *hw = &priv->hw; - struct hermes_idstring list; - unsigned char *p = (unsigned char *)&list.val; - int err = 0; - int num; - int i; - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_SUPPORTEDDATARATES, - sizeof(list), NULL, &list); - orinoco_unlock(priv, &flags); - - if (err) - return err; - - num = le16_to_cpu(list.len); - *numrates = num; - num = min(num, max); - - for (i = 0; i < num; i++) - rates[i] = (p[i] & 0x7f) * 500000; /* convert to bps */ - - return 0; -} - -int orinoco_hw_trigger_scan(struct orinoco_private *priv, - const struct cfg80211_ssid *ssid) -{ - struct net_device *dev = priv->ndev; - struct hermes *hw = &priv->hw; - unsigned long flags; - int err = 0; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - /* Scanning with port 0 disabled would fail */ - if (!netif_running(dev)) { - err = -ENETDOWN; - goto out; - } - - /* In monitor mode, the scan results are always empty. - * Probe responses are passed to the driver as received - * frames and could be processed in software. */ - if (priv->iw_mode == NL80211_IFTYPE_MONITOR) { - err = -EOPNOTSUPP; - goto out; - } - - if (priv->has_hostscan) { - switch (priv->firmware_type) { - case FIRMWARE_TYPE_SYMBOL: - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFHOSTSCAN_SYMBOL, - HERMES_HOSTSCAN_SYMBOL_ONCE | - HERMES_HOSTSCAN_SYMBOL_BCAST); - break; - case FIRMWARE_TYPE_INTERSIL: { - __le16 req[3]; - - req[0] = cpu_to_le16(0x3fff); /* All channels */ - req[1] = cpu_to_le16(0x0001); /* rate 1 Mbps */ - req[2] = 0; /* Any ESSID */ - err = HERMES_WRITE_RECORD(hw, USER_BAP, - HERMES_RID_CNFHOSTSCAN, &req); - break; - } - case FIRMWARE_TYPE_AGERE: - if (ssid->ssid_len > 0) { - struct hermes_idstring idbuf; - size_t len = ssid->ssid_len; - - idbuf.len = cpu_to_le16(len); - memcpy(idbuf.val, ssid->ssid, len); - - err = hw->ops->write_ltv(hw, USER_BAP, - HERMES_RID_CNFSCANSSID_AGERE, - HERMES_BYTES_TO_RECLEN(len + 2), - &idbuf); - } else - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFSCANSSID_AGERE, - 0); /* Any ESSID */ - if (err) - break; - - if (priv->has_ext_scan) { - err = hermes_write_wordrec(hw, USER_BAP, - HERMES_RID_CNFSCANCHANNELS2GHZ, - 0x7FFF); - if (err) - goto out; - - err = hermes_inquire(hw, - HERMES_INQ_CHANNELINFO); - } else - err = hermes_inquire(hw, HERMES_INQ_SCAN); - - break; - } - } else - err = hermes_inquire(hw, HERMES_INQ_SCAN); - - out: - orinoco_unlock(priv, &flags); - - return err; -} - -/* Disassociate from node with BSSID addr */ -int orinoco_hw_disassociate(struct orinoco_private *priv, - u8 *addr, u16 reason_code) -{ - struct hermes *hw = &priv->hw; - int err; - - struct { - u8 addr[ETH_ALEN]; - __le16 reason_code; - } __packed buf; - - /* Currently only supported by WPA enabled Agere fw */ - if (!priv->has_wpa) - return -EOPNOTSUPP; - - memcpy(buf.addr, addr, ETH_ALEN); - buf.reason_code = cpu_to_le16(reason_code); - err = HERMES_WRITE_RECORD(hw, USER_BAP, - HERMES_RID_CNFDISASSOCIATE, - &buf); - return err; -} - -int orinoco_hw_get_current_bssid(struct orinoco_private *priv, - u8 *addr) -{ - struct hermes *hw = &priv->hw; - int err; - - err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID, - ETH_ALEN, NULL, addr); - - return err; -} diff --git a/drivers/net/wireless/orinoco/hw.h b/drivers/net/wireless/orinoco/hw.h deleted file mode 100644 index 8f6831f4e328..000000000000 --- a/drivers/net/wireless/orinoco/hw.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Encapsulate basic setting changes on Hermes hardware - * - * See copyright notice in main.c - */ -#ifndef _ORINOCO_HW_H_ -#define _ORINOCO_HW_H_ - -#include -#include -#include - -/* Hardware BAPs */ -#define USER_BAP 0 -#define IRQ_BAP 1 - -/* WEP key sizes */ -#define SMALL_KEY_SIZE 5 -#define LARGE_KEY_SIZE 13 - -/* Number of supported channels */ -#define NUM_CHANNELS 14 - -/* Forward declarations */ -struct orinoco_private; - -int determine_fw_capabilities(struct orinoco_private *priv, char *fw_name, - size_t fw_name_len, u32 *hw_ver); -int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr); -int orinoco_hw_allocate_fid(struct orinoco_private *priv); -int orinoco_get_bitratemode(int bitrate, int automatic); -void orinoco_get_ratemode_cfg(int ratemode, int *bitrate, int *automatic); - -int orinoco_hw_program_rids(struct orinoco_private *priv); -int orinoco_hw_get_tkip_iv(struct orinoco_private *priv, int key, u8 *tsc); -int __orinoco_hw_set_bitrate(struct orinoco_private *priv); -int orinoco_hw_get_act_bitrate(struct orinoco_private *priv, int *bitrate); -int __orinoco_hw_set_wap(struct orinoco_private *priv); -int __orinoco_hw_setup_wepkeys(struct orinoco_private *priv); -int __orinoco_hw_setup_enc(struct orinoco_private *priv); -int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx, - int set_tx, u8 *key, u8 *rsc, size_t rsc_len, - u8 *tsc, size_t tsc_len); -int orinoco_clear_tkip_key(struct orinoco_private *priv, int key_idx); -int __orinoco_hw_set_multicast_list(struct orinoco_private *priv, - struct net_device *dev, - int mc_count, int promisc); -int orinoco_hw_get_essid(struct orinoco_private *priv, int *active, - char buf[IW_ESSID_MAX_SIZE + 1]); -int orinoco_hw_get_freq(struct orinoco_private *priv); -int orinoco_hw_get_bitratelist(struct orinoco_private *priv, - int *numrates, s32 *rates, int max); -int orinoco_hw_trigger_scan(struct orinoco_private *priv, - const struct cfg80211_ssid *ssid); -int orinoco_hw_disassociate(struct orinoco_private *priv, - u8 *addr, u16 reason_code); -int orinoco_hw_get_current_bssid(struct orinoco_private *priv, - u8 *addr); - -#endif /* _ORINOCO_HW_H_ */ diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c deleted file mode 100644 index 38ec8d19ac29..000000000000 --- a/drivers/net/wireless/orinoco/main.c +++ /dev/null @@ -1,2431 +0,0 @@ -/* main.c - (formerly known as dldwd_cs.c, orinoco_cs.c and orinoco.c) - * - * A driver for Hermes or Prism 2 chipset based PCMCIA wireless - * adaptors, with Lucent/Agere, Intersil or Symbol firmware. - * - * Current maintainers (as of 29 September 2003) are: - * Pavel Roskin - * and David Gibson - * - * (C) Copyright David Gibson, IBM Corporation 2001-2003. - * Copyright (C) 2000 David Gibson, Linuxcare Australia. - * With some help from : - * Copyright (C) 2001 Jean Tourrilhes, HP Labs - * Copyright (C) 2001 Benjamin Herrenschmidt - * - * Based on dummy_cs.c 1.27 2000/06/12 21:27:25 - * - * Portions based on wvlan_cs.c 1.0.6, Copyright Andreas Neuhaus - * http://www.stud.fh-dortmund.de/~andy/wvlan/ - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * The initial developer of the original code is David A. Hinds - * . Portions created by David - * A. Hinds are Copyright (C) 1999 David A. Hinds. All Rights - * Reserved. - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License version 2 (the "GPL"), in - * which case the provisions of the GPL are applicable instead of the - * above. If you wish to allow the use of your version of this file - * only under the terms of the GPL and not to allow others to use your - * version of this file under the MPL, indicate your decision by - * deleting the provisions above and replace them with the notice and - * other provisions required by the GPL. If you do not delete the - * provisions above, a recipient may use your version of this file - * under either the MPL or the GPL. */ - -/* - * TODO - * o Handle de-encapsulation within network layer, provide 802.11 - * headers (patch from Thomas 'Dent' Mirlacher) - * o Fix possible races in SPY handling. - * o Disconnect wireless extensions from fundamental configuration. - * o (maybe) Software WEP support (patch from Stano Meduna). - * o (maybe) Use multiple Tx buffers - driver handling queue - * rather than firmware. - */ - -/* Locking and synchronization: - * - * The basic principle is that everything is serialized through a - * single spinlock, priv->lock. The lock is used in user, bh and irq - * context, so when taken outside hardirq context it should always be - * taken with interrupts disabled. The lock protects both the - * hardware and the struct orinoco_private. - * - * Another flag, priv->hw_unavailable indicates that the hardware is - * unavailable for an extended period of time (e.g. suspended, or in - * the middle of a hard reset). This flag is protected by the - * spinlock. All code which touches the hardware should check the - * flag after taking the lock, and if it is set, give up on whatever - * they are doing and drop the lock again. The orinoco_lock() - * function handles this (it unlocks and returns -EBUSY if - * hw_unavailable is non-zero). - */ - -#define DRIVER_NAME "orinoco" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "hermes_rid.h" -#include "hermes_dld.h" -#include "hw.h" -#include "scan.h" -#include "mic.h" -#include "fw.h" -#include "wext.h" -#include "cfg.h" -#include "main.h" - -#include "orinoco.h" - -/********************************************************************/ -/* Module information */ -/********************************************************************/ - -MODULE_AUTHOR("Pavel Roskin & " - "David Gibson "); -MODULE_DESCRIPTION("Driver for Lucent Orinoco, Prism II based " - "and similar wireless cards"); -MODULE_LICENSE("Dual MPL/GPL"); - -/* Level of debugging. Used in the macros in orinoco.h */ -#ifdef ORINOCO_DEBUG -int orinoco_debug = ORINOCO_DEBUG; -EXPORT_SYMBOL(orinoco_debug); -module_param(orinoco_debug, int, 0644); -MODULE_PARM_DESC(orinoco_debug, "Debug level"); -#endif - -static bool suppress_linkstatus; /* = 0 */ -module_param(suppress_linkstatus, bool, 0644); -MODULE_PARM_DESC(suppress_linkstatus, "Don't log link status changes"); - -static int ignore_disconnect; /* = 0 */ -module_param(ignore_disconnect, int, 0644); -MODULE_PARM_DESC(ignore_disconnect, - "Don't report lost link to the network layer"); - -int force_monitor; /* = 0 */ -module_param(force_monitor, int, 0644); -MODULE_PARM_DESC(force_monitor, "Allow monitor mode for all firmware versions"); - -/********************************************************************/ -/* Internal constants */ -/********************************************************************/ - -/* 802.2 LLC/SNAP header used for Ethernet encapsulation over 802.11 */ -static const u8 encaps_hdr[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; -#define ENCAPS_OVERHEAD (sizeof(encaps_hdr) + 2) - -#define ORINOCO_MIN_MTU 256 -#define ORINOCO_MAX_MTU (IEEE80211_MAX_DATA_LEN - ENCAPS_OVERHEAD) - -#define MAX_IRQLOOPS_PER_IRQ 10 -#define MAX_IRQLOOPS_PER_JIFFY (20000 / HZ) /* Based on a guestimate of - * how many events the - * device could - * legitimately generate */ - -#define DUMMY_FID 0xFFFF - -/*#define MAX_MULTICAST(priv) (priv->firmware_type == FIRMWARE_TYPE_AGERE ? \ - HERMES_MAX_MULTICAST : 0)*/ -#define MAX_MULTICAST(priv) (HERMES_MAX_MULTICAST) - -#define ORINOCO_INTEN (HERMES_EV_RX | HERMES_EV_ALLOC \ - | HERMES_EV_TX | HERMES_EV_TXEXC \ - | HERMES_EV_WTERR | HERMES_EV_INFO \ - | HERMES_EV_INFDROP) - -/********************************************************************/ -/* Data types */ -/********************************************************************/ - -/* Beginning of the Tx descriptor, used in TxExc handling */ -struct hermes_txexc_data { - struct hermes_tx_descriptor desc; - __le16 frame_ctl; - __le16 duration_id; - u8 addr1[ETH_ALEN]; -} __packed; - -/* Rx frame header except compatibility 802.3 header */ -struct hermes_rx_descriptor { - /* Control */ - __le16 status; - __le32 time; - u8 silence; - u8 signal; - u8 rate; - u8 rxflow; - __le32 reserved; - - /* 802.11 header */ - __le16 frame_ctl; - __le16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 addr3[ETH_ALEN]; - __le16 seq_ctl; - u8 addr4[ETH_ALEN]; - - /* Data length */ - __le16 data_len; -} __packed; - -struct orinoco_rx_data { - struct hermes_rx_descriptor *desc; - struct sk_buff *skb; - struct list_head list; -}; - -struct orinoco_scan_data { - void *buf; - size_t len; - int type; - struct list_head list; -}; - -/********************************************************************/ -/* Function prototypes */ -/********************************************************************/ - -static int __orinoco_set_multicast_list(struct net_device *dev); -static int __orinoco_up(struct orinoco_private *priv); -static int __orinoco_down(struct orinoco_private *priv); -static int __orinoco_commit(struct orinoco_private *priv); - -/********************************************************************/ -/* Internal helper functions */ -/********************************************************************/ - -void set_port_type(struct orinoco_private *priv) -{ - switch (priv->iw_mode) { - case NL80211_IFTYPE_STATION: - priv->port_type = 1; - priv->createibss = 0; - break; - case NL80211_IFTYPE_ADHOC: - if (priv->prefer_port3) { - priv->port_type = 3; - priv->createibss = 0; - } else { - priv->port_type = priv->ibss_port; - priv->createibss = 1; - } - break; - case NL80211_IFTYPE_MONITOR: - priv->port_type = 3; - priv->createibss = 0; - break; - default: - printk(KERN_ERR "%s: Invalid priv->iw_mode in set_port_type()\n", - priv->ndev->name); - } -} - -/********************************************************************/ -/* Device methods */ -/********************************************************************/ - -int orinoco_open(struct net_device *dev) -{ - struct orinoco_private *priv = ndev_priv(dev); - unsigned long flags; - int err; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - err = __orinoco_up(priv); - - if (!err) - priv->open = 1; - - orinoco_unlock(priv, &flags); - - return err; -} -EXPORT_SYMBOL(orinoco_open); - -int orinoco_stop(struct net_device *dev) -{ - struct orinoco_private *priv = ndev_priv(dev); - int err = 0; - - /* We mustn't use orinoco_lock() here, because we need to be - able to close the interface even if hw_unavailable is set - (e.g. as we're released after a PC Card removal) */ - orinoco_lock_irq(priv); - - priv->open = 0; - - err = __orinoco_down(priv); - - orinoco_unlock_irq(priv); - - return err; -} -EXPORT_SYMBOL(orinoco_stop); - -struct net_device_stats *orinoco_get_stats(struct net_device *dev) -{ - struct orinoco_private *priv = ndev_priv(dev); - - return &priv->stats; -} -EXPORT_SYMBOL(orinoco_get_stats); - -void orinoco_set_multicast_list(struct net_device *dev) -{ - struct orinoco_private *priv = ndev_priv(dev); - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) { - printk(KERN_DEBUG "%s: orinoco_set_multicast_list() " - "called when hw_unavailable\n", dev->name); - return; - } - - __orinoco_set_multicast_list(dev); - orinoco_unlock(priv, &flags); -} -EXPORT_SYMBOL(orinoco_set_multicast_list); - -int orinoco_change_mtu(struct net_device *dev, int new_mtu) -{ - struct orinoco_private *priv = ndev_priv(dev); - - if ((new_mtu < ORINOCO_MIN_MTU) || (new_mtu > ORINOCO_MAX_MTU)) - return -EINVAL; - - /* MTU + encapsulation + header length */ - if ((new_mtu + ENCAPS_OVERHEAD + sizeof(struct ieee80211_hdr)) > - (priv->nicbuf_size - ETH_HLEN)) - return -EINVAL; - - dev->mtu = new_mtu; - - return 0; -} -EXPORT_SYMBOL(orinoco_change_mtu); - -/********************************************************************/ -/* Tx path */ -/********************************************************************/ - -/* Add encapsulation and MIC to the existing SKB. - * The main xmit routine will then send the whole lot to the card. - * Need 8 bytes headroom - * Need 8 bytes tailroom - * - * With encapsulated ethernet II frame - * -------- - * 803.3 header (14 bytes) - * dst[6] - * -------- src[6] - * 803.3 header (14 bytes) len[2] - * dst[6] 803.2 header (8 bytes) - * src[6] encaps[6] - * len[2] <- leave alone -> len[2] - * -------- -------- <-- 0 - * Payload Payload - * ... ... - * - * -------- -------- - * MIC (8 bytes) - * -------- - * - * returns 0 on success, -ENOMEM on error. - */ -int orinoco_process_xmit_skb(struct sk_buff *skb, - struct net_device *dev, - struct orinoco_private *priv, - int *tx_control, - u8 *mic_buf) -{ - struct orinoco_tkip_key *key; - struct ethhdr *eh; - int do_mic; - - key = (struct orinoco_tkip_key *) priv->keys[priv->tx_key].key; - - do_mic = ((priv->encode_alg == ORINOCO_ALG_TKIP) && - (key != NULL)); - - if (do_mic) - *tx_control |= (priv->tx_key << HERMES_MIC_KEY_ID_SHIFT) | - HERMES_TXCTRL_MIC; - - eh = (struct ethhdr *)skb->data; - - /* Encapsulate Ethernet-II frames */ - if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */ - struct header_struct { - struct ethhdr eth; /* 802.3 header */ - u8 encap[6]; /* 802.2 header */ - } __packed hdr; - int len = skb->len + sizeof(encaps_hdr) - (2 * ETH_ALEN); - - if (skb_headroom(skb) < ENCAPS_OVERHEAD) { - if (net_ratelimit()) - printk(KERN_ERR - "%s: Not enough headroom for 802.2 headers %d\n", - dev->name, skb_headroom(skb)); - return -ENOMEM; - } - - /* Fill in new header */ - memcpy(&hdr.eth, eh, 2 * ETH_ALEN); - hdr.eth.h_proto = htons(len); - memcpy(hdr.encap, encaps_hdr, sizeof(encaps_hdr)); - - /* Make room for the new header, and copy it in */ - eh = (struct ethhdr *) skb_push(skb, ENCAPS_OVERHEAD); - memcpy(eh, &hdr, sizeof(hdr)); - } - - /* Calculate Michael MIC */ - if (do_mic) { - size_t len = skb->len - ETH_HLEN; - u8 *mic = &mic_buf[0]; - - /* Have to write to an even address, so copy the spare - * byte across */ - if (skb->len % 2) { - *mic = skb->data[skb->len - 1]; - mic++; - } - - orinoco_mic(priv->tx_tfm_mic, key->tx_mic, - eh->h_dest, eh->h_source, 0 /* priority */, - skb->data + ETH_HLEN, - len, mic); - } - - return 0; -} -EXPORT_SYMBOL(orinoco_process_xmit_skb); - -static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct net_device_stats *stats = &priv->stats; - struct hermes *hw = &priv->hw; - int err = 0; - u16 txfid = priv->txfid; - int tx_control; - unsigned long flags; - u8 mic_buf[MICHAEL_MIC_LEN + 1]; - - if (!netif_running(dev)) { - printk(KERN_ERR "%s: Tx on stopped device!\n", - dev->name); - return NETDEV_TX_BUSY; - } - - if (netif_queue_stopped(dev)) { - printk(KERN_DEBUG "%s: Tx while transmitter busy!\n", - dev->name); - return NETDEV_TX_BUSY; - } - - if (orinoco_lock(priv, &flags) != 0) { - printk(KERN_ERR "%s: orinoco_xmit() called while hw_unavailable\n", - dev->name); - return NETDEV_TX_BUSY; - } - - if (!netif_carrier_ok(dev) || - (priv->iw_mode == NL80211_IFTYPE_MONITOR)) { - /* Oops, the firmware hasn't established a connection, - silently drop the packet (this seems to be the - safest approach). */ - goto drop; - } - - /* Check packet length */ - if (skb->len < ETH_HLEN) - goto drop; - - tx_control = HERMES_TXCTRL_TX_OK | HERMES_TXCTRL_TX_EX; - - err = orinoco_process_xmit_skb(skb, dev, priv, &tx_control, - &mic_buf[0]); - if (err) - goto drop; - - if (priv->has_alt_txcntl) { - /* WPA enabled firmwares have tx_cntl at the end of - * the 802.11 header. So write zeroed descriptor and - * 802.11 header at the same time - */ - char desc[HERMES_802_3_OFFSET]; - __le16 *txcntl = (__le16 *) &desc[HERMES_TXCNTL2_OFFSET]; - - memset(&desc, 0, sizeof(desc)); - - *txcntl = cpu_to_le16(tx_control); - err = hw->ops->bap_pwrite(hw, USER_BAP, &desc, sizeof(desc), - txfid, 0); - if (err) { - if (net_ratelimit()) - printk(KERN_ERR "%s: Error %d writing Tx " - "descriptor to BAP\n", dev->name, err); - goto busy; - } - } else { - struct hermes_tx_descriptor desc; - - memset(&desc, 0, sizeof(desc)); - - desc.tx_control = cpu_to_le16(tx_control); - err = hw->ops->bap_pwrite(hw, USER_BAP, &desc, sizeof(desc), - txfid, 0); - if (err) { - if (net_ratelimit()) - printk(KERN_ERR "%s: Error %d writing Tx " - "descriptor to BAP\n", dev->name, err); - goto busy; - } - - /* Clear the 802.11 header and data length fields - some - * firmwares (e.g. Lucent/Agere 8.xx) appear to get confused - * if this isn't done. */ - hermes_clear_words(hw, HERMES_DATA0, - HERMES_802_3_OFFSET - HERMES_802_11_OFFSET); - } - - err = hw->ops->bap_pwrite(hw, USER_BAP, skb->data, skb->len, - txfid, HERMES_802_3_OFFSET); - if (err) { - printk(KERN_ERR "%s: Error %d writing packet to BAP\n", - dev->name, err); - goto busy; - } - - if (tx_control & HERMES_TXCTRL_MIC) { - size_t offset = HERMES_802_3_OFFSET + skb->len; - size_t len = MICHAEL_MIC_LEN; - - if (offset % 2) { - offset--; - len++; - } - err = hw->ops->bap_pwrite(hw, USER_BAP, &mic_buf[0], len, - txfid, offset); - if (err) { - printk(KERN_ERR "%s: Error %d writing MIC to BAP\n", - dev->name, err); - goto busy; - } - } - - /* Finally, we actually initiate the send */ - netif_stop_queue(dev); - - err = hw->ops->cmd_wait(hw, HERMES_CMD_TX | HERMES_CMD_RECL, - txfid, NULL); - if (err) { - netif_start_queue(dev); - if (net_ratelimit()) - printk(KERN_ERR "%s: Error %d transmitting packet\n", - dev->name, err); - goto busy; - } - - stats->tx_bytes += HERMES_802_3_OFFSET + skb->len; - goto ok; - - drop: - stats->tx_errors++; - stats->tx_dropped++; - - ok: - orinoco_unlock(priv, &flags); - dev_kfree_skb(skb); - return NETDEV_TX_OK; - - busy: - if (err == -EIO) - schedule_work(&priv->reset_work); - orinoco_unlock(priv, &flags); - return NETDEV_TX_BUSY; -} - -static void __orinoco_ev_alloc(struct net_device *dev, struct hermes *hw) -{ - struct orinoco_private *priv = ndev_priv(dev); - u16 fid = hermes_read_regn(hw, ALLOCFID); - - if (fid != priv->txfid) { - if (fid != DUMMY_FID) - printk(KERN_WARNING "%s: Allocate event on unexpected fid (%04X)\n", - dev->name, fid); - return; - } - - hermes_write_regn(hw, ALLOCFID, DUMMY_FID); -} - -static void __orinoco_ev_tx(struct net_device *dev, struct hermes *hw) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct net_device_stats *stats = &priv->stats; - - stats->tx_packets++; - - netif_wake_queue(dev); - - hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID); -} - -static void __orinoco_ev_txexc(struct net_device *dev, struct hermes *hw) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct net_device_stats *stats = &priv->stats; - u16 fid = hermes_read_regn(hw, TXCOMPLFID); - u16 status; - struct hermes_txexc_data hdr; - int err = 0; - - if (fid == DUMMY_FID) - return; /* Nothing's really happened */ - - /* Read part of the frame header - we need status and addr1 */ - err = hw->ops->bap_pread(hw, IRQ_BAP, &hdr, - sizeof(struct hermes_txexc_data), - fid, 0); - - hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID); - stats->tx_errors++; - - if (err) { - printk(KERN_WARNING "%s: Unable to read descriptor on Tx error " - "(FID=%04X error %d)\n", - dev->name, fid, err); - return; - } - - DEBUG(1, "%s: Tx error, err %d (FID=%04X)\n", dev->name, - err, fid); - - /* We produce a TXDROP event only for retry or lifetime - * exceeded, because that's the only status that really mean - * that this particular node went away. - * Other errors means that *we* screwed up. - Jean II */ - status = le16_to_cpu(hdr.desc.status); - if (status & (HERMES_TXSTAT_RETRYERR | HERMES_TXSTAT_AGEDERR)) { - union iwreq_data wrqu; - - /* Copy 802.11 dest address. - * We use the 802.11 header because the frame may - * not be 802.3 or may be mangled... - * In Ad-Hoc mode, it will be the node address. - * In managed mode, it will be most likely the AP addr - * User space will figure out how to convert it to - * whatever it needs (IP address or else). - * - Jean II */ - memcpy(wrqu.addr.sa_data, hdr.addr1, ETH_ALEN); - wrqu.addr.sa_family = ARPHRD_ETHER; - - /* Send event to user space */ - wireless_send_event(dev, IWEVTXDROP, &wrqu, NULL); - } - - netif_wake_queue(dev); -} - -void orinoco_tx_timeout(struct net_device *dev) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct net_device_stats *stats = &priv->stats; - struct hermes *hw = &priv->hw; - - printk(KERN_WARNING "%s: Tx timeout! " - "ALLOCFID=%04x, TXCOMPLFID=%04x, EVSTAT=%04x\n", - dev->name, hermes_read_regn(hw, ALLOCFID), - hermes_read_regn(hw, TXCOMPLFID), hermes_read_regn(hw, EVSTAT)); - - stats->tx_errors++; - - schedule_work(&priv->reset_work); -} -EXPORT_SYMBOL(orinoco_tx_timeout); - -/********************************************************************/ -/* Rx path (data frames) */ -/********************************************************************/ - -/* Does the frame have a SNAP header indicating it should be - * de-encapsulated to Ethernet-II? */ -static inline int is_ethersnap(void *_hdr) -{ - u8 *hdr = _hdr; - - /* We de-encapsulate all packets which, a) have SNAP headers - * (i.e. SSAP=DSAP=0xaa and CTRL=0x3 in the 802.2 LLC header - * and where b) the OUI of the SNAP header is 00:00:00 or - * 00:00:f8 - we need both because different APs appear to use - * different OUIs for some reason */ - return (memcmp(hdr, &encaps_hdr, 5) == 0) - && ((hdr[5] == 0x00) || (hdr[5] == 0xf8)); -} - -static inline void orinoco_spy_gather(struct net_device *dev, u_char *mac, - int level, int noise) -{ - struct iw_quality wstats; - wstats.level = level - 0x95; - wstats.noise = noise - 0x95; - wstats.qual = (level > noise) ? (level - noise) : 0; - wstats.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; - /* Update spy records */ - wireless_spy_update(dev, mac, &wstats); -} - -static void orinoco_stat_gather(struct net_device *dev, - struct sk_buff *skb, - struct hermes_rx_descriptor *desc) -{ - struct orinoco_private *priv = ndev_priv(dev); - - /* Using spy support with lots of Rx packets, like in an - * infrastructure (AP), will really slow down everything, because - * the MAC address must be compared to each entry of the spy list. - * If the user really asks for it (set some address in the - * spy list), we do it, but he will pay the price. - * Note that to get here, you need both WIRELESS_SPY - * compiled in AND some addresses in the list !!! - */ - /* Note : gcc will optimise the whole section away if - * WIRELESS_SPY is not defined... - Jean II */ - if (SPY_NUMBER(priv)) { - orinoco_spy_gather(dev, skb_mac_header(skb) + ETH_ALEN, - desc->signal, desc->silence); - } -} - -/* - * orinoco_rx_monitor - handle received monitor frames. - * - * Arguments: - * dev network device - * rxfid received FID - * desc rx descriptor of the frame - * - * Call context: interrupt - */ -static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid, - struct hermes_rx_descriptor *desc) -{ - u32 hdrlen = 30; /* return full header by default */ - u32 datalen = 0; - u16 fc; - int err; - int len; - struct sk_buff *skb; - struct orinoco_private *priv = ndev_priv(dev); - struct net_device_stats *stats = &priv->stats; - struct hermes *hw = &priv->hw; - - len = le16_to_cpu(desc->data_len); - - /* Determine the size of the header and the data */ - fc = le16_to_cpu(desc->frame_ctl); - switch (fc & IEEE80211_FCTL_FTYPE) { - case IEEE80211_FTYPE_DATA: - if ((fc & IEEE80211_FCTL_TODS) - && (fc & IEEE80211_FCTL_FROMDS)) - hdrlen = 30; - else - hdrlen = 24; - datalen = len; - break; - case IEEE80211_FTYPE_MGMT: - hdrlen = 24; - datalen = len; - break; - case IEEE80211_FTYPE_CTL: - switch (fc & IEEE80211_FCTL_STYPE) { - case IEEE80211_STYPE_PSPOLL: - case IEEE80211_STYPE_RTS: - case IEEE80211_STYPE_CFEND: - case IEEE80211_STYPE_CFENDACK: - hdrlen = 16; - break; - case IEEE80211_STYPE_CTS: - case IEEE80211_STYPE_ACK: - hdrlen = 10; - break; - } - break; - default: - /* Unknown frame type */ - break; - } - - /* sanity check the length */ - if (datalen > IEEE80211_MAX_DATA_LEN + 12) { - printk(KERN_DEBUG "%s: oversized monitor frame, " - "data length = %d\n", dev->name, datalen); - stats->rx_length_errors++; - goto update_stats; - } - - skb = dev_alloc_skb(hdrlen + datalen); - if (!skb) { - printk(KERN_WARNING "%s: Cannot allocate skb for monitor frame\n", - dev->name); - goto update_stats; - } - - /* Copy the 802.11 header to the skb */ - memcpy(skb_put(skb, hdrlen), &(desc->frame_ctl), hdrlen); - skb_reset_mac_header(skb); - - /* If any, copy the data from the card to the skb */ - if (datalen > 0) { - err = hw->ops->bap_pread(hw, IRQ_BAP, skb_put(skb, datalen), - ALIGN(datalen, 2), rxfid, - HERMES_802_2_OFFSET); - if (err) { - printk(KERN_ERR "%s: error %d reading monitor frame\n", - dev->name, err); - goto drop; - } - } - - skb->dev = dev; - skb->ip_summed = CHECKSUM_NONE; - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = cpu_to_be16(ETH_P_802_2); - - stats->rx_packets++; - stats->rx_bytes += skb->len; - - netif_rx(skb); - return; - - drop: - dev_kfree_skb_irq(skb); - update_stats: - stats->rx_errors++; - stats->rx_dropped++; -} - -void __orinoco_ev_rx(struct net_device *dev, struct hermes *hw) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct net_device_stats *stats = &priv->stats; - struct iw_statistics *wstats = &priv->wstats; - struct sk_buff *skb = NULL; - u16 rxfid, status; - int length; - struct hermes_rx_descriptor *desc; - struct orinoco_rx_data *rx_data; - int err; - - desc = kmalloc(sizeof(*desc), GFP_ATOMIC); - if (!desc) - goto update_stats; - - rxfid = hermes_read_regn(hw, RXFID); - - err = hw->ops->bap_pread(hw, IRQ_BAP, desc, sizeof(*desc), - rxfid, 0); - if (err) { - printk(KERN_ERR "%s: error %d reading Rx descriptor. " - "Frame dropped.\n", dev->name, err); - goto update_stats; - } - - status = le16_to_cpu(desc->status); - - if (status & HERMES_RXSTAT_BADCRC) { - DEBUG(1, "%s: Bad CRC on Rx. Frame dropped.\n", - dev->name); - stats->rx_crc_errors++; - goto update_stats; - } - - /* Handle frames in monitor mode */ - if (priv->iw_mode == NL80211_IFTYPE_MONITOR) { - orinoco_rx_monitor(dev, rxfid, desc); - goto out; - } - - if (status & HERMES_RXSTAT_UNDECRYPTABLE) { - DEBUG(1, "%s: Undecryptable frame on Rx. Frame dropped.\n", - dev->name); - wstats->discard.code++; - goto update_stats; - } - - length = le16_to_cpu(desc->data_len); - - /* Sanity checks */ - if (length < 3) { /* No for even an 802.2 LLC header */ - /* At least on Symbol firmware with PCF we get quite a - lot of these legitimately - Poll frames with no - data. */ - goto out; - } - if (length > IEEE80211_MAX_DATA_LEN) { - printk(KERN_WARNING "%s: Oversized frame received (%d bytes)\n", - dev->name, length); - stats->rx_length_errors++; - goto update_stats; - } - - /* Payload size does not include Michael MIC. Increase payload - * size to read it together with the data. */ - if (status & HERMES_RXSTAT_MIC) - length += MICHAEL_MIC_LEN; - - /* We need space for the packet data itself, plus an ethernet - header, plus 2 bytes so we can align the IP header on a - 32bit boundary, plus 1 byte so we can read in odd length - packets from the card, which has an IO granularity of 16 - bits */ - skb = dev_alloc_skb(length + ETH_HLEN + 2 + 1); - if (!skb) { - printk(KERN_WARNING "%s: Can't allocate skb for Rx\n", - dev->name); - goto update_stats; - } - - /* We'll prepend the header, so reserve space for it. The worst - case is no decapsulation, when 802.3 header is prepended and - nothing is removed. 2 is for aligning the IP header. */ - skb_reserve(skb, ETH_HLEN + 2); - - err = hw->ops->bap_pread(hw, IRQ_BAP, skb_put(skb, length), - ALIGN(length, 2), rxfid, - HERMES_802_2_OFFSET); - if (err) { - printk(KERN_ERR "%s: error %d reading frame. " - "Frame dropped.\n", dev->name, err); - goto drop; - } - - /* Add desc and skb to rx queue */ - rx_data = kzalloc(sizeof(*rx_data), GFP_ATOMIC); - if (!rx_data) - goto drop; - - rx_data->desc = desc; - rx_data->skb = skb; - list_add_tail(&rx_data->list, &priv->rx_list); - tasklet_schedule(&priv->rx_tasklet); - - return; - -drop: - dev_kfree_skb_irq(skb); -update_stats: - stats->rx_errors++; - stats->rx_dropped++; -out: - kfree(desc); -} -EXPORT_SYMBOL(__orinoco_ev_rx); - -static void orinoco_rx(struct net_device *dev, - struct hermes_rx_descriptor *desc, - struct sk_buff *skb) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct net_device_stats *stats = &priv->stats; - u16 status, fc; - int length; - struct ethhdr *hdr; - - status = le16_to_cpu(desc->status); - length = le16_to_cpu(desc->data_len); - fc = le16_to_cpu(desc->frame_ctl); - - /* Calculate and check MIC */ - if (status & HERMES_RXSTAT_MIC) { - struct orinoco_tkip_key *key; - int key_id = ((status & HERMES_RXSTAT_MIC_KEY_ID) >> - HERMES_MIC_KEY_ID_SHIFT); - u8 mic[MICHAEL_MIC_LEN]; - u8 *rxmic; - u8 *src = (fc & IEEE80211_FCTL_FROMDS) ? - desc->addr3 : desc->addr2; - - /* Extract Michael MIC from payload */ - rxmic = skb->data + skb->len - MICHAEL_MIC_LEN; - - skb_trim(skb, skb->len - MICHAEL_MIC_LEN); - length -= MICHAEL_MIC_LEN; - - key = (struct orinoco_tkip_key *) priv->keys[key_id].key; - - if (!key) { - printk(KERN_WARNING "%s: Received encrypted frame from " - "%pM using key %i, but key is not installed\n", - dev->name, src, key_id); - goto drop; - } - - orinoco_mic(priv->rx_tfm_mic, key->rx_mic, desc->addr1, src, - 0, /* priority or QoS? */ - skb->data, skb->len, &mic[0]); - - if (memcmp(mic, rxmic, - MICHAEL_MIC_LEN)) { - union iwreq_data wrqu; - struct iw_michaelmicfailure wxmic; - - printk(KERN_WARNING "%s: " - "Invalid Michael MIC in data frame from %pM, " - "using key %i\n", - dev->name, src, key_id); - - /* TODO: update stats */ - - /* Notify userspace */ - memset(&wxmic, 0, sizeof(wxmic)); - wxmic.flags = key_id & IW_MICFAILURE_KEY_ID; - wxmic.flags |= (desc->addr1[0] & 1) ? - IW_MICFAILURE_GROUP : IW_MICFAILURE_PAIRWISE; - wxmic.src_addr.sa_family = ARPHRD_ETHER; - memcpy(wxmic.src_addr.sa_data, src, ETH_ALEN); - - (void) orinoco_hw_get_tkip_iv(priv, key_id, - &wxmic.tsc[0]); - - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.length = sizeof(wxmic); - wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, - (char *) &wxmic); - - goto drop; - } - } - - /* Handle decapsulation - * In most cases, the firmware tell us about SNAP frames. - * For some reason, the SNAP frames sent by LinkSys APs - * are not properly recognised by most firmwares. - * So, check ourselves */ - if (length >= ENCAPS_OVERHEAD && - (((status & HERMES_RXSTAT_MSGTYPE) == HERMES_RXSTAT_1042) || - ((status & HERMES_RXSTAT_MSGTYPE) == HERMES_RXSTAT_TUNNEL) || - is_ethersnap(skb->data))) { - /* These indicate a SNAP within 802.2 LLC within - 802.11 frame which we'll need to de-encapsulate to - the original EthernetII frame. */ - hdr = (struct ethhdr *)skb_push(skb, - ETH_HLEN - ENCAPS_OVERHEAD); - } else { - /* 802.3 frame - prepend 802.3 header as is */ - hdr = (struct ethhdr *)skb_push(skb, ETH_HLEN); - hdr->h_proto = htons(length); - } - memcpy(hdr->h_dest, desc->addr1, ETH_ALEN); - if (fc & IEEE80211_FCTL_FROMDS) - memcpy(hdr->h_source, desc->addr3, ETH_ALEN); - else - memcpy(hdr->h_source, desc->addr2, ETH_ALEN); - - skb->protocol = eth_type_trans(skb, dev); - skb->ip_summed = CHECKSUM_NONE; - if (fc & IEEE80211_FCTL_TODS) - skb->pkt_type = PACKET_OTHERHOST; - - /* Process the wireless stats if needed */ - orinoco_stat_gather(dev, skb, desc); - - /* Pass the packet to the networking stack */ - netif_rx(skb); - stats->rx_packets++; - stats->rx_bytes += length; - - return; - - drop: - dev_kfree_skb(skb); - stats->rx_errors++; - stats->rx_dropped++; -} - -static void orinoco_rx_isr_tasklet(unsigned long data) -{ - struct orinoco_private *priv = (struct orinoco_private *) data; - struct net_device *dev = priv->ndev; - struct orinoco_rx_data *rx_data, *temp; - struct hermes_rx_descriptor *desc; - struct sk_buff *skb; - unsigned long flags; - - /* orinoco_rx requires the driver lock, and we also need to - * protect priv->rx_list, so just hold the lock over the - * lot. - * - * If orinoco_lock fails, we've unplugged the card. In this - * case just abort. */ - if (orinoco_lock(priv, &flags) != 0) - return; - - /* extract desc and skb from queue */ - list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) { - desc = rx_data->desc; - skb = rx_data->skb; - list_del(&rx_data->list); - kfree(rx_data); - - orinoco_rx(dev, desc, skb); - - kfree(desc); - } - - orinoco_unlock(priv, &flags); -} - -/********************************************************************/ -/* Rx path (info frames) */ -/********************************************************************/ - -static void print_linkstatus(struct net_device *dev, u16 status) -{ - char *s; - - if (suppress_linkstatus) - return; - - switch (status) { - case HERMES_LINKSTATUS_NOT_CONNECTED: - s = "Not Connected"; - break; - case HERMES_LINKSTATUS_CONNECTED: - s = "Connected"; - break; - case HERMES_LINKSTATUS_DISCONNECTED: - s = "Disconnected"; - break; - case HERMES_LINKSTATUS_AP_CHANGE: - s = "AP Changed"; - break; - case HERMES_LINKSTATUS_AP_OUT_OF_RANGE: - s = "AP Out of Range"; - break; - case HERMES_LINKSTATUS_AP_IN_RANGE: - s = "AP In Range"; - break; - case HERMES_LINKSTATUS_ASSOC_FAILED: - s = "Association Failed"; - break; - default: - s = "UNKNOWN"; - } - - printk(KERN_DEBUG "%s: New link status: %s (%04x)\n", - dev->name, s, status); -} - -/* Search scan results for requested BSSID, join it if found */ -static void orinoco_join_ap(struct work_struct *work) -{ - struct orinoco_private *priv = - container_of(work, struct orinoco_private, join_work); - struct net_device *dev = priv->ndev; - struct hermes *hw = &priv->hw; - int err; - unsigned long flags; - struct join_req { - u8 bssid[ETH_ALEN]; - __le16 channel; - } __packed req; - const int atom_len = offsetof(struct prism2_scan_apinfo, atim); - struct prism2_scan_apinfo *atom = NULL; - int offset = 4; - int found = 0; - u8 *buf; - u16 len; - - /* Allocate buffer for scan results */ - buf = kmalloc(MAX_SCAN_LEN, GFP_KERNEL); - if (!buf) - return; - - if (orinoco_lock(priv, &flags) != 0) - goto fail_lock; - - /* Sanity checks in case user changed something in the meantime */ - if (!priv->bssid_fixed) - goto out; - - if (strlen(priv->desired_essid) == 0) - goto out; - - /* Read scan results from the firmware */ - err = hw->ops->read_ltv(hw, USER_BAP, - HERMES_RID_SCANRESULTSTABLE, - MAX_SCAN_LEN, &len, buf); - if (err) { - printk(KERN_ERR "%s: Cannot read scan results\n", - dev->name); - goto out; - } - - len = HERMES_RECLEN_TO_BYTES(len); - - /* Go through the scan results looking for the channel of the AP - * we were requested to join */ - for (; offset + atom_len <= len; offset += atom_len) { - atom = (struct prism2_scan_apinfo *) (buf + offset); - if (memcmp(&atom->bssid, priv->desired_bssid, ETH_ALEN) == 0) { - found = 1; - break; - } - } - - if (!found) { - DEBUG(1, "%s: Requested AP not found in scan results\n", - dev->name); - goto out; - } - - memcpy(req.bssid, priv->desired_bssid, ETH_ALEN); - req.channel = atom->channel; /* both are little-endian */ - err = HERMES_WRITE_RECORD(hw, USER_BAP, HERMES_RID_CNFJOINREQUEST, - &req); - if (err) - printk(KERN_ERR "%s: Error issuing join request\n", dev->name); - - out: - orinoco_unlock(priv, &flags); - - fail_lock: - kfree(buf); -} - -/* Send new BSSID to userspace */ -static void orinoco_send_bssid_wevent(struct orinoco_private *priv) -{ - struct net_device *dev = priv->ndev; - struct hermes *hw = &priv->hw; - union iwreq_data wrqu; - int err; - - err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID, - ETH_ALEN, NULL, wrqu.ap_addr.sa_data); - if (err != 0) - return; - - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - - /* Send event to user space */ - wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); -} - -static void orinoco_send_assocreqie_wevent(struct orinoco_private *priv) -{ - struct net_device *dev = priv->ndev; - struct hermes *hw = &priv->hw; - union iwreq_data wrqu; - int err; - u8 buf[88]; - u8 *ie; - - if (!priv->has_wpa) - return; - - err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_ASSOC_REQ_INFO, - sizeof(buf), NULL, &buf); - if (err != 0) - return; - - ie = orinoco_get_wpa_ie(buf, sizeof(buf)); - if (ie) { - int rem = sizeof(buf) - (ie - &buf[0]); - wrqu.data.length = ie[1] + 2; - if (wrqu.data.length > rem) - wrqu.data.length = rem; - - if (wrqu.data.length) - /* Send event to user space */ - wireless_send_event(dev, IWEVASSOCREQIE, &wrqu, ie); - } -} - -static void orinoco_send_assocrespie_wevent(struct orinoco_private *priv) -{ - struct net_device *dev = priv->ndev; - struct hermes *hw = &priv->hw; - union iwreq_data wrqu; - int err; - u8 buf[88]; /* TODO: verify max size or IW_GENERIC_IE_MAX */ - u8 *ie; - - if (!priv->has_wpa) - return; - - err = hw->ops->read_ltv(hw, USER_BAP, - HERMES_RID_CURRENT_ASSOC_RESP_INFO, - sizeof(buf), NULL, &buf); - if (err != 0) - return; - - ie = orinoco_get_wpa_ie(buf, sizeof(buf)); - if (ie) { - int rem = sizeof(buf) - (ie - &buf[0]); - wrqu.data.length = ie[1] + 2; - if (wrqu.data.length > rem) - wrqu.data.length = rem; - - if (wrqu.data.length) - /* Send event to user space */ - wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, ie); - } -} - -static void orinoco_send_wevents(struct work_struct *work) -{ - struct orinoco_private *priv = - container_of(work, struct orinoco_private, wevent_work); - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) - return; - - orinoco_send_assocreqie_wevent(priv); - orinoco_send_assocrespie_wevent(priv); - orinoco_send_bssid_wevent(priv); - - orinoco_unlock(priv, &flags); -} - -static void qbuf_scan(struct orinoco_private *priv, void *buf, - int len, int type) -{ - struct orinoco_scan_data *sd; - unsigned long flags; - - sd = kmalloc(sizeof(*sd), GFP_ATOMIC); - if (!sd) - return; - - sd->buf = buf; - sd->len = len; - sd->type = type; - - spin_lock_irqsave(&priv->scan_lock, flags); - list_add_tail(&sd->list, &priv->scan_list); - spin_unlock_irqrestore(&priv->scan_lock, flags); - - schedule_work(&priv->process_scan); -} - -static void qabort_scan(struct orinoco_private *priv) -{ - struct orinoco_scan_data *sd; - unsigned long flags; - - sd = kmalloc(sizeof(*sd), GFP_ATOMIC); - if (!sd) - return; - - sd->len = -1; /* Abort */ - - spin_lock_irqsave(&priv->scan_lock, flags); - list_add_tail(&sd->list, &priv->scan_list); - spin_unlock_irqrestore(&priv->scan_lock, flags); - - schedule_work(&priv->process_scan); -} - -static void orinoco_process_scan_results(struct work_struct *work) -{ - struct orinoco_private *priv = - container_of(work, struct orinoco_private, process_scan); - struct orinoco_scan_data *sd, *temp; - unsigned long flags; - void *buf; - int len; - int type; - - spin_lock_irqsave(&priv->scan_lock, flags); - list_for_each_entry_safe(sd, temp, &priv->scan_list, list) { - - buf = sd->buf; - len = sd->len; - type = sd->type; - - list_del(&sd->list); - spin_unlock_irqrestore(&priv->scan_lock, flags); - kfree(sd); - - if (len > 0) { - if (type == HERMES_INQ_CHANNELINFO) - orinoco_add_extscan_result(priv, buf, len); - else - orinoco_add_hostscan_results(priv, buf, len); - - kfree(buf); - } else { - /* Either abort or complete the scan */ - orinoco_scan_done(priv, (len < 0)); - } - - spin_lock_irqsave(&priv->scan_lock, flags); - } - spin_unlock_irqrestore(&priv->scan_lock, flags); -} - -void __orinoco_ev_info(struct net_device *dev, struct hermes *hw) -{ - struct orinoco_private *priv = ndev_priv(dev); - u16 infofid; - struct { - __le16 len; - __le16 type; - } __packed info; - int len, type; - int err; - - /* This is an answer to an INQUIRE command that we did earlier, - * or an information "event" generated by the card - * The controller return to us a pseudo frame containing - * the information in question - Jean II */ - infofid = hermes_read_regn(hw, INFOFID); - - /* Read the info frame header - don't try too hard */ - err = hw->ops->bap_pread(hw, IRQ_BAP, &info, sizeof(info), - infofid, 0); - if (err) { - printk(KERN_ERR "%s: error %d reading info frame. " - "Frame dropped.\n", dev->name, err); - return; - } - - len = HERMES_RECLEN_TO_BYTES(le16_to_cpu(info.len)); - type = le16_to_cpu(info.type); - - switch (type) { - case HERMES_INQ_TALLIES: { - struct hermes_tallies_frame tallies; - struct iw_statistics *wstats = &priv->wstats; - - if (len > sizeof(tallies)) { - printk(KERN_WARNING "%s: Tallies frame too long (%d bytes)\n", - dev->name, len); - len = sizeof(tallies); - } - - err = hw->ops->bap_pread(hw, IRQ_BAP, &tallies, len, - infofid, sizeof(info)); - if (err) - break; - - /* Increment our various counters */ - /* wstats->discard.nwid - no wrong BSSID stuff */ - wstats->discard.code += - le16_to_cpu(tallies.RxWEPUndecryptable); - if (len == sizeof(tallies)) - wstats->discard.code += - le16_to_cpu(tallies.RxDiscards_WEPICVError) + - le16_to_cpu(tallies.RxDiscards_WEPExcluded); - wstats->discard.misc += - le16_to_cpu(tallies.TxDiscardsWrongSA); - wstats->discard.fragment += - le16_to_cpu(tallies.RxMsgInBadMsgFragments); - wstats->discard.retries += - le16_to_cpu(tallies.TxRetryLimitExceeded); - /* wstats->miss.beacon - no match */ - } - break; - case HERMES_INQ_LINKSTATUS: { - struct hermes_linkstatus linkstatus; - u16 newstatus; - int connected; - - if (priv->iw_mode == NL80211_IFTYPE_MONITOR) - break; - - if (len != sizeof(linkstatus)) { - printk(KERN_WARNING "%s: Unexpected size for linkstatus frame (%d bytes)\n", - dev->name, len); - break; - } - - err = hw->ops->bap_pread(hw, IRQ_BAP, &linkstatus, len, - infofid, sizeof(info)); - if (err) - break; - newstatus = le16_to_cpu(linkstatus.linkstatus); - - /* Symbol firmware uses "out of range" to signal that - * the hostscan frame can be requested. */ - if (newstatus == HERMES_LINKSTATUS_AP_OUT_OF_RANGE && - priv->firmware_type == FIRMWARE_TYPE_SYMBOL && - priv->has_hostscan && priv->scan_request) { - hermes_inquire(hw, HERMES_INQ_HOSTSCAN_SYMBOL); - break; - } - - connected = (newstatus == HERMES_LINKSTATUS_CONNECTED) - || (newstatus == HERMES_LINKSTATUS_AP_CHANGE) - || (newstatus == HERMES_LINKSTATUS_AP_IN_RANGE); - - if (connected) - netif_carrier_on(dev); - else if (!ignore_disconnect) - netif_carrier_off(dev); - - if (newstatus != priv->last_linkstatus) { - priv->last_linkstatus = newstatus; - print_linkstatus(dev, newstatus); - /* The info frame contains only one word which is the - * status (see hermes.h). The status is pretty boring - * in itself, that's why we export the new BSSID... - * Jean II */ - schedule_work(&priv->wevent_work); - } - } - break; - case HERMES_INQ_SCAN: - if (!priv->scan_request && priv->bssid_fixed && - priv->firmware_type == FIRMWARE_TYPE_INTERSIL) { - schedule_work(&priv->join_work); - break; - } - /* fall through */ - case HERMES_INQ_HOSTSCAN: - case HERMES_INQ_HOSTSCAN_SYMBOL: { - /* Result of a scanning. Contains information about - * cells in the vicinity - Jean II */ - unsigned char *buf; - - /* Sanity check */ - if (len > 4096) { - printk(KERN_WARNING "%s: Scan results too large (%d bytes)\n", - dev->name, len); - qabort_scan(priv); - break; - } - - /* Allocate buffer for results */ - buf = kmalloc(len, GFP_ATOMIC); - if (buf == NULL) { - /* No memory, so can't printk()... */ - qabort_scan(priv); - break; - } - - /* Read scan data */ - err = hw->ops->bap_pread(hw, IRQ_BAP, (void *) buf, len, - infofid, sizeof(info)); - if (err) { - kfree(buf); - qabort_scan(priv); - break; - } - -#ifdef ORINOCO_DEBUG - { - int i; - printk(KERN_DEBUG "Scan result [%02X", buf[0]); - for (i = 1; i < (len * 2); i++) - printk(":%02X", buf[i]); - printk("]\n"); - } -#endif /* ORINOCO_DEBUG */ - - qbuf_scan(priv, buf, len, type); - } - break; - case HERMES_INQ_CHANNELINFO: - { - struct agere_ext_scan_info *bss; - - if (!priv->scan_request) { - printk(KERN_DEBUG "%s: Got chaninfo without scan, " - "len=%d\n", dev->name, len); - break; - } - - /* An empty result indicates that the scan is complete */ - if (len == 0) { - qbuf_scan(priv, NULL, len, type); - break; - } - - /* Sanity check */ - else if (len < (offsetof(struct agere_ext_scan_info, - data) + 2)) { - /* Drop this result now so we don't have to - * keep checking later */ - printk(KERN_WARNING - "%s: Ext scan results too short (%d bytes)\n", - dev->name, len); - break; - } - - bss = kmalloc(len, GFP_ATOMIC); - if (bss == NULL) - break; - - /* Read scan data */ - err = hw->ops->bap_pread(hw, IRQ_BAP, (void *) bss, len, - infofid, sizeof(info)); - if (err) - kfree(bss); - else - qbuf_scan(priv, bss, len, type); - - break; - } - case HERMES_INQ_SEC_STAT_AGERE: - /* Security status (Agere specific) */ - /* Ignore this frame for now */ - if (priv->firmware_type == FIRMWARE_TYPE_AGERE) - break; - /* fall through */ - default: - printk(KERN_DEBUG "%s: Unknown information frame received: " - "type 0x%04x, length %d\n", dev->name, type, len); - /* We don't actually do anything about it */ - break; - } -} -EXPORT_SYMBOL(__orinoco_ev_info); - -static void __orinoco_ev_infdrop(struct net_device *dev, struct hermes *hw) -{ - if (net_ratelimit()) - printk(KERN_DEBUG "%s: Information frame lost.\n", dev->name); -} - -/********************************************************************/ -/* Internal hardware control routines */ -/********************************************************************/ - -static int __orinoco_up(struct orinoco_private *priv) -{ - struct net_device *dev = priv->ndev; - struct hermes *hw = &priv->hw; - int err; - - netif_carrier_off(dev); /* just to make sure */ - - err = __orinoco_commit(priv); - if (err) { - printk(KERN_ERR "%s: Error %d configuring card\n", - dev->name, err); - return err; - } - - /* Fire things up again */ - hermes_set_irqmask(hw, ORINOCO_INTEN); - err = hermes_enable_port(hw, 0); - if (err) { - printk(KERN_ERR "%s: Error %d enabling MAC port\n", - dev->name, err); - return err; - } - - netif_start_queue(dev); - - return 0; -} - -static int __orinoco_down(struct orinoco_private *priv) -{ - struct net_device *dev = priv->ndev; - struct hermes *hw = &priv->hw; - int err; - - netif_stop_queue(dev); - - if (!priv->hw_unavailable) { - if (!priv->broken_disableport) { - err = hermes_disable_port(hw, 0); - if (err) { - /* Some firmwares (e.g. Intersil 1.3.x) seem - * to have problems disabling the port, oh - * well, too bad. */ - printk(KERN_WARNING "%s: Error %d disabling MAC port\n", - dev->name, err); - priv->broken_disableport = 1; - } - } - hermes_set_irqmask(hw, 0); - hermes_write_regn(hw, EVACK, 0xffff); - } - - orinoco_scan_done(priv, true); - - /* firmware will have to reassociate */ - netif_carrier_off(dev); - priv->last_linkstatus = 0xffff; - - return 0; -} - -static int orinoco_reinit_firmware(struct orinoco_private *priv) -{ - struct hermes *hw = &priv->hw; - int err; - - err = hw->ops->init(hw); - if (priv->do_fw_download && !err) { - err = orinoco_download(priv); - if (err) - priv->do_fw_download = 0; - } - if (!err) - err = orinoco_hw_allocate_fid(priv); - - return err; -} - -static int -__orinoco_set_multicast_list(struct net_device *dev) -{ - struct orinoco_private *priv = ndev_priv(dev); - int err = 0; - int promisc, mc_count; - - /* The Hermes doesn't seem to have an allmulti mode, so we go - * into promiscuous mode and let the upper levels deal. */ - if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI) || - (netdev_mc_count(dev) > MAX_MULTICAST(priv))) { - promisc = 1; - mc_count = 0; - } else { - promisc = 0; - mc_count = netdev_mc_count(dev); - } - - err = __orinoco_hw_set_multicast_list(priv, dev, mc_count, promisc); - - return err; -} - -/* This must be called from user context, without locks held - use - * schedule_work() */ -void orinoco_reset(struct work_struct *work) -{ - struct orinoco_private *priv = - container_of(work, struct orinoco_private, reset_work); - struct net_device *dev = priv->ndev; - struct hermes *hw = &priv->hw; - int err; - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) - /* When the hardware becomes available again, whatever - * detects that is responsible for re-initializing - * it. So no need for anything further */ - return; - - netif_stop_queue(dev); - - /* Shut off interrupts. Depending on what state the hardware - * is in, this might not work, but we'll try anyway */ - hermes_set_irqmask(hw, 0); - hermes_write_regn(hw, EVACK, 0xffff); - - priv->hw_unavailable++; - priv->last_linkstatus = 0xffff; /* firmware will have to reassociate */ - netif_carrier_off(dev); - - orinoco_unlock(priv, &flags); - - /* Scanning support: Notify scan cancellation */ - orinoco_scan_done(priv, true); - - if (priv->hard_reset) { - err = (*priv->hard_reset)(priv); - if (err) { - printk(KERN_ERR "%s: orinoco_reset: Error %d " - "performing hard reset\n", dev->name, err); - goto disable; - } - } - - err = orinoco_reinit_firmware(priv); - if (err) { - printk(KERN_ERR "%s: orinoco_reset: Error %d re-initializing firmware\n", - dev->name, err); - goto disable; - } - - /* This has to be called from user context */ - orinoco_lock_irq(priv); - - priv->hw_unavailable--; - - /* priv->open or priv->hw_unavailable might have changed while - * we dropped the lock */ - if (priv->open && (!priv->hw_unavailable)) { - err = __orinoco_up(priv); - if (err) { - printk(KERN_ERR "%s: orinoco_reset: Error %d reenabling card\n", - dev->name, err); - } else - dev->trans_start = jiffies; - } - - orinoco_unlock_irq(priv); - - return; - disable: - hermes_set_irqmask(hw, 0); - netif_device_detach(dev); - printk(KERN_ERR "%s: Device has been disabled!\n", dev->name); -} - -static int __orinoco_commit(struct orinoco_private *priv) -{ - struct net_device *dev = priv->ndev; - int err = 0; - - /* If we've called commit, we are reconfiguring or bringing the - * interface up. Maintaining countermeasures across this would - * be confusing, so note that we've disabled them. The port will - * be enabled later in orinoco_commit or __orinoco_up. */ - priv->tkip_cm_active = 0; - - err = orinoco_hw_program_rids(priv); - - /* FIXME: what about netif_tx_lock */ - (void) __orinoco_set_multicast_list(dev); - - return err; -} - -/* Ensures configuration changes are applied. May result in a reset. - * The caller should hold priv->lock - */ -int orinoco_commit(struct orinoco_private *priv) -{ - struct net_device *dev = priv->ndev; - struct hermes *hw = &priv->hw; - int err; - - if (priv->broken_disableport) { - schedule_work(&priv->reset_work); - return 0; - } - - err = hermes_disable_port(hw, 0); - if (err) { - printk(KERN_WARNING "%s: Unable to disable port " - "while reconfiguring card\n", dev->name); - priv->broken_disableport = 1; - goto out; - } - - err = __orinoco_commit(priv); - if (err) { - printk(KERN_WARNING "%s: Unable to reconfigure card\n", - dev->name); - goto out; - } - - err = hermes_enable_port(hw, 0); - if (err) { - printk(KERN_WARNING "%s: Unable to enable port while reconfiguring card\n", - dev->name); - goto out; - } - - out: - if (err) { - printk(KERN_WARNING "%s: Resetting instead...\n", dev->name); - schedule_work(&priv->reset_work); - err = 0; - } - return err; -} - -/********************************************************************/ -/* Interrupt handler */ -/********************************************************************/ - -static void __orinoco_ev_tick(struct net_device *dev, struct hermes *hw) -{ - printk(KERN_DEBUG "%s: TICK\n", dev->name); -} - -static void __orinoco_ev_wterr(struct net_device *dev, struct hermes *hw) -{ - /* This seems to happen a fair bit under load, but ignoring it - seems to work fine...*/ - printk(KERN_DEBUG "%s: MAC controller error (WTERR). Ignoring.\n", - dev->name); -} - -irqreturn_t orinoco_interrupt(int irq, void *dev_id) -{ - struct orinoco_private *priv = dev_id; - struct net_device *dev = priv->ndev; - struct hermes *hw = &priv->hw; - int count = MAX_IRQLOOPS_PER_IRQ; - u16 evstat, events; - /* These are used to detect a runaway interrupt situation. - * - * If we get more than MAX_IRQLOOPS_PER_JIFFY iterations in a jiffy, - * we panic and shut down the hardware - */ - /* jiffies value the last time we were called */ - static int last_irq_jiffy; /* = 0 */ - static int loops_this_jiffy; /* = 0 */ - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) { - /* If hw is unavailable - we don't know if the irq was - * for us or not */ - return IRQ_HANDLED; - } - - evstat = hermes_read_regn(hw, EVSTAT); - events = evstat & hw->inten; - if (!events) { - orinoco_unlock(priv, &flags); - return IRQ_NONE; - } - - if (jiffies != last_irq_jiffy) - loops_this_jiffy = 0; - last_irq_jiffy = jiffies; - - while (events && count--) { - if (++loops_this_jiffy > MAX_IRQLOOPS_PER_JIFFY) { - printk(KERN_WARNING "%s: IRQ handler is looping too " - "much! Resetting.\n", dev->name); - /* Disable interrupts for now */ - hermes_set_irqmask(hw, 0); - schedule_work(&priv->reset_work); - break; - } - - /* Check the card hasn't been removed */ - if (!hermes_present(hw)) { - DEBUG(0, "orinoco_interrupt(): card removed\n"); - break; - } - - if (events & HERMES_EV_TICK) - __orinoco_ev_tick(dev, hw); - if (events & HERMES_EV_WTERR) - __orinoco_ev_wterr(dev, hw); - if (events & HERMES_EV_INFDROP) - __orinoco_ev_infdrop(dev, hw); - if (events & HERMES_EV_INFO) - __orinoco_ev_info(dev, hw); - if (events & HERMES_EV_RX) - __orinoco_ev_rx(dev, hw); - if (events & HERMES_EV_TXEXC) - __orinoco_ev_txexc(dev, hw); - if (events & HERMES_EV_TX) - __orinoco_ev_tx(dev, hw); - if (events & HERMES_EV_ALLOC) - __orinoco_ev_alloc(dev, hw); - - hermes_write_regn(hw, EVACK, evstat); - - evstat = hermes_read_regn(hw, EVSTAT); - events = evstat & hw->inten; - } - - orinoco_unlock(priv, &flags); - return IRQ_HANDLED; -} -EXPORT_SYMBOL(orinoco_interrupt); - -/********************************************************************/ -/* Power management */ -/********************************************************************/ -#if defined(CONFIG_PM_SLEEP) && !defined(CONFIG_HERMES_CACHE_FW_ON_INIT) -static int orinoco_pm_notifier(struct notifier_block *notifier, - unsigned long pm_event, - void *unused) -{ - struct orinoco_private *priv = container_of(notifier, - struct orinoco_private, - pm_notifier); - - /* All we need to do is cache the firmware before suspend, and - * release it when we come out. - * - * Only need to do this if we're downloading firmware. */ - if (!priv->do_fw_download) - return NOTIFY_DONE; - - switch (pm_event) { - case PM_HIBERNATION_PREPARE: - case PM_SUSPEND_PREPARE: - orinoco_cache_fw(priv, 0); - break; - - case PM_POST_RESTORE: - /* Restore from hibernation failed. We need to clean - * up in exactly the same way, so fall through. */ - case PM_POST_HIBERNATION: - case PM_POST_SUSPEND: - orinoco_uncache_fw(priv); - break; - - case PM_RESTORE_PREPARE: - default: - break; - } - - return NOTIFY_DONE; -} - -static void orinoco_register_pm_notifier(struct orinoco_private *priv) -{ - priv->pm_notifier.notifier_call = orinoco_pm_notifier; - register_pm_notifier(&priv->pm_notifier); -} - -static void orinoco_unregister_pm_notifier(struct orinoco_private *priv) -{ - unregister_pm_notifier(&priv->pm_notifier); -} -#else /* !PM_SLEEP || HERMES_CACHE_FW_ON_INIT */ -#define orinoco_register_pm_notifier(priv) do { } while (0) -#define orinoco_unregister_pm_notifier(priv) do { } while (0) -#endif - -/********************************************************************/ -/* Initialization */ -/********************************************************************/ - -int orinoco_init(struct orinoco_private *priv) -{ - struct device *dev = priv->dev; - struct wiphy *wiphy = priv_to_wiphy(priv); - struct hermes *hw = &priv->hw; - int err = 0; - - /* No need to lock, the hw_unavailable flag is already set in - * alloc_orinocodev() */ - priv->nicbuf_size = IEEE80211_MAX_FRAME_LEN + ETH_HLEN; - - /* Initialize the firmware */ - err = hw->ops->init(hw); - if (err != 0) { - dev_err(dev, "Failed to initialize firmware (err = %d)\n", - err); - goto out; - } - - err = determine_fw_capabilities(priv, wiphy->fw_version, - sizeof(wiphy->fw_version), - &wiphy->hw_version); - if (err != 0) { - dev_err(dev, "Incompatible firmware, aborting\n"); - goto out; - } - - if (priv->do_fw_download) { -#ifdef CONFIG_HERMES_CACHE_FW_ON_INIT - orinoco_cache_fw(priv, 0); -#endif - - err = orinoco_download(priv); - if (err) - priv->do_fw_download = 0; - - /* Check firmware version again */ - err = determine_fw_capabilities(priv, wiphy->fw_version, - sizeof(wiphy->fw_version), - &wiphy->hw_version); - if (err != 0) { - dev_err(dev, "Incompatible firmware, aborting\n"); - goto out; - } - } - - if (priv->has_port3) - dev_info(dev, "Ad-hoc demo mode supported\n"); - if (priv->has_ibss) - dev_info(dev, "IEEE standard IBSS ad-hoc mode supported\n"); - if (priv->has_wep) - dev_info(dev, "WEP supported, %s-bit key\n", - priv->has_big_wep ? "104" : "40"); - if (priv->has_wpa) { - dev_info(dev, "WPA-PSK supported\n"); - if (orinoco_mic_init(priv)) { - dev_err(dev, "Failed to setup MIC crypto algorithm. " - "Disabling WPA support\n"); - priv->has_wpa = 0; - } - } - - err = orinoco_hw_read_card_settings(priv, wiphy->perm_addr); - if (err) - goto out; - - err = orinoco_hw_allocate_fid(priv); - if (err) { - dev_err(dev, "Failed to allocate NIC buffer!\n"); - goto out; - } - - /* Set up the default configuration */ - priv->iw_mode = NL80211_IFTYPE_STATION; - /* By default use IEEE/IBSS ad-hoc mode if we have it */ - priv->prefer_port3 = priv->has_port3 && (!priv->has_ibss); - set_port_type(priv); - priv->channel = 0; /* use firmware default */ - - priv->promiscuous = 0; - priv->encode_alg = ORINOCO_ALG_NONE; - priv->tx_key = 0; - priv->wpa_enabled = 0; - priv->tkip_cm_active = 0; - priv->key_mgmt = 0; - priv->wpa_ie_len = 0; - priv->wpa_ie = NULL; - - if (orinoco_wiphy_register(wiphy)) { - err = -ENODEV; - goto out; - } - - /* Make the hardware available, as long as it hasn't been - * removed elsewhere (e.g. by PCMCIA hot unplug) */ - orinoco_lock_irq(priv); - priv->hw_unavailable--; - orinoco_unlock_irq(priv); - - dev_dbg(dev, "Ready\n"); - - out: - return err; -} -EXPORT_SYMBOL(orinoco_init); - -static const struct net_device_ops orinoco_netdev_ops = { - .ndo_open = orinoco_open, - .ndo_stop = orinoco_stop, - .ndo_start_xmit = orinoco_xmit, - .ndo_set_rx_mode = orinoco_set_multicast_list, - .ndo_change_mtu = orinoco_change_mtu, - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, - .ndo_tx_timeout = orinoco_tx_timeout, - .ndo_get_stats = orinoco_get_stats, -}; - -/* Allocate private data. - * - * This driver has a number of structures associated with it - * netdev - Net device structure for each network interface - * wiphy - structure associated with wireless phy - * wireless_dev (wdev) - structure for each wireless interface - * hw - structure for hermes chip info - * card - card specific structure for use by the card driver - * (airport, orinoco_cs) - * priv - orinoco private data - * device - generic linux device structure - * - * +---------+ +---------+ - * | wiphy | | netdev | - * | +-------+ | +-------+ - * | | priv | | | wdev | - * | | +-----+ +-+-------+ - * | | | hw | - * | +-+-----+ - * | | card | - * +-+-------+ - * - * priv has a link to netdev and device - * wdev has a link to wiphy - */ -struct orinoco_private -*alloc_orinocodev(int sizeof_card, - struct device *device, - int (*hard_reset)(struct orinoco_private *), - int (*stop_fw)(struct orinoco_private *, int)) -{ - struct orinoco_private *priv; - struct wiphy *wiphy; - - /* allocate wiphy - * NOTE: We only support a single virtual interface - * but this may change when monitor mode is added - */ - wiphy = wiphy_new(&orinoco_cfg_ops, - sizeof(struct orinoco_private) + sizeof_card); - if (!wiphy) - return NULL; - - priv = wiphy_priv(wiphy); - priv->dev = device; - - if (sizeof_card) - priv->card = (void *)((unsigned long)priv - + sizeof(struct orinoco_private)); - else - priv->card = NULL; - - orinoco_wiphy_init(wiphy); - -#ifdef WIRELESS_SPY - priv->wireless_data.spy_data = &priv->spy_data; -#endif - - /* Set up default callbacks */ - priv->hard_reset = hard_reset; - priv->stop_fw = stop_fw; - - spin_lock_init(&priv->lock); - priv->open = 0; - priv->hw_unavailable = 1; /* orinoco_init() must clear this - * before anything else touches the - * hardware */ - INIT_WORK(&priv->reset_work, orinoco_reset); - INIT_WORK(&priv->join_work, orinoco_join_ap); - INIT_WORK(&priv->wevent_work, orinoco_send_wevents); - - INIT_LIST_HEAD(&priv->rx_list); - tasklet_init(&priv->rx_tasklet, orinoco_rx_isr_tasklet, - (unsigned long) priv); - - spin_lock_init(&priv->scan_lock); - INIT_LIST_HEAD(&priv->scan_list); - INIT_WORK(&priv->process_scan, orinoco_process_scan_results); - - priv->last_linkstatus = 0xffff; - -#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP) - priv->cached_pri_fw = NULL; - priv->cached_fw = NULL; -#endif - - /* Register PM notifiers */ - orinoco_register_pm_notifier(priv); - - return priv; -} -EXPORT_SYMBOL(alloc_orinocodev); - -/* We can only support a single interface. We provide a separate - * function to set it up to distinguish between hardware - * initialisation and interface setup. - * - * The base_addr and irq parameters are passed on to netdev for use - * with SIOCGIFMAP. - */ -int orinoco_if_add(struct orinoco_private *priv, - unsigned long base_addr, - unsigned int irq, - const struct net_device_ops *ops) -{ - struct wiphy *wiphy = priv_to_wiphy(priv); - struct wireless_dev *wdev; - struct net_device *dev; - int ret; - - dev = alloc_etherdev(sizeof(struct wireless_dev)); - - if (!dev) - return -ENOMEM; - - /* Initialise wireless_dev */ - wdev = netdev_priv(dev); - wdev->wiphy = wiphy; - wdev->iftype = NL80211_IFTYPE_STATION; - - /* Setup / override net_device fields */ - dev->ieee80211_ptr = wdev; - dev->watchdog_timeo = HZ; /* 1 second timeout */ - dev->wireless_handlers = &orinoco_handler_def; -#ifdef WIRELESS_SPY - dev->wireless_data = &priv->wireless_data; -#endif - /* Default to standard ops if not set */ - if (ops) - dev->netdev_ops = ops; - else - dev->netdev_ops = &orinoco_netdev_ops; - - /* we use the default eth_mac_addr for setting the MAC addr */ - - /* Reserve space in skb for the SNAP header */ - dev->needed_headroom = ENCAPS_OVERHEAD; - - netif_carrier_off(dev); - - memcpy(dev->dev_addr, wiphy->perm_addr, ETH_ALEN); - - dev->base_addr = base_addr; - dev->irq = irq; - - SET_NETDEV_DEV(dev, priv->dev); - ret = register_netdev(dev); - if (ret) - goto fail; - - priv->ndev = dev; - - /* Report what we've done */ - dev_dbg(priv->dev, "Registerred interface %s.\n", dev->name); - - return 0; - - fail: - free_netdev(dev); - return ret; -} -EXPORT_SYMBOL(orinoco_if_add); - -void orinoco_if_del(struct orinoco_private *priv) -{ - struct net_device *dev = priv->ndev; - - unregister_netdev(dev); - free_netdev(dev); -} -EXPORT_SYMBOL(orinoco_if_del); - -void free_orinocodev(struct orinoco_private *priv) -{ - struct wiphy *wiphy = priv_to_wiphy(priv); - struct orinoco_rx_data *rx_data, *temp; - struct orinoco_scan_data *sd, *sdtemp; - - wiphy_unregister(wiphy); - - /* If the tasklet is scheduled when we call tasklet_kill it - * will run one final time. However the tasklet will only - * drain priv->rx_list if the hw is still available. */ - tasklet_kill(&priv->rx_tasklet); - - /* Explicitly drain priv->rx_list */ - list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) { - list_del(&rx_data->list); - - dev_kfree_skb(rx_data->skb); - kfree(rx_data->desc); - kfree(rx_data); - } - - cancel_work_sync(&priv->process_scan); - /* Explicitly drain priv->scan_list */ - list_for_each_entry_safe(sd, sdtemp, &priv->scan_list, list) { - list_del(&sd->list); - - if ((sd->len > 0) && sd->buf) - kfree(sd->buf); - kfree(sd); - } - - orinoco_unregister_pm_notifier(priv); - orinoco_uncache_fw(priv); - - priv->wpa_ie_len = 0; - kfree(priv->wpa_ie); - orinoco_mic_free(priv); - wiphy_free(wiphy); -} -EXPORT_SYMBOL(free_orinocodev); - -int orinoco_up(struct orinoco_private *priv) -{ - struct net_device *dev = priv->ndev; - unsigned long flags; - int err; - - priv->hw.ops->lock_irqsave(&priv->lock, &flags); - - err = orinoco_reinit_firmware(priv); - if (err) { - printk(KERN_ERR "%s: Error %d re-initializing firmware\n", - dev->name, err); - goto exit; - } - - netif_device_attach(dev); - priv->hw_unavailable--; - - if (priv->open && !priv->hw_unavailable) { - err = __orinoco_up(priv); - if (err) - printk(KERN_ERR "%s: Error %d restarting card\n", - dev->name, err); - } - -exit: - priv->hw.ops->unlock_irqrestore(&priv->lock, &flags); - - return 0; -} -EXPORT_SYMBOL(orinoco_up); - -void orinoco_down(struct orinoco_private *priv) -{ - struct net_device *dev = priv->ndev; - unsigned long flags; - int err; - - priv->hw.ops->lock_irqsave(&priv->lock, &flags); - err = __orinoco_down(priv); - if (err) - printk(KERN_WARNING "%s: Error %d downing interface\n", - dev->name, err); - - netif_device_detach(dev); - priv->hw_unavailable++; - priv->hw.ops->unlock_irqrestore(&priv->lock, &flags); -} -EXPORT_SYMBOL(orinoco_down); - -/********************************************************************/ -/* Module initialization */ -/********************************************************************/ - -/* Can't be declared "const" or the whole __initdata section will - * become const */ -static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION - " (David Gibson , " - "Pavel Roskin , et al)"; - -static int __init init_orinoco(void) -{ - printk(KERN_DEBUG "%s\n", version); - return 0; -} - -static void __exit exit_orinoco(void) -{ -} - -module_init(init_orinoco); -module_exit(exit_orinoco); diff --git a/drivers/net/wireless/orinoco/main.h b/drivers/net/wireless/orinoco/main.h deleted file mode 100644 index 5a8fec26136e..000000000000 --- a/drivers/net/wireless/orinoco/main.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Exports from main to helper modules - * - * See copyright notice in main.c - */ -#ifndef _ORINOCO_MAIN_H_ -#define _ORINOCO_MAIN_H_ - -#include -#include "orinoco.h" - -/********************************************************************/ -/* Compile time configuration and compatibility stuff */ -/********************************************************************/ - -/* We do this this way to avoid ifdefs in the actual code */ -#ifdef WIRELESS_SPY -#define SPY_NUMBER(priv) (priv->spy_data.spy_number) -#else -#define SPY_NUMBER(priv) 0 -#endif /* WIRELESS_SPY */ - -/********************************************************************/ - -/* Export module parameter */ -extern int force_monitor; - -/* Forward declarations */ -struct net_device; -struct work_struct; - -void set_port_type(struct orinoco_private *priv); -int orinoco_commit(struct orinoco_private *priv); -void orinoco_reset(struct work_struct *work); - -/* Information element helpers - find a home for these... */ -#define WPA_OUI_TYPE "\x00\x50\xF2\x01" -#define WPA_SELECTOR_LEN 4 -static inline u8 *orinoco_get_wpa_ie(u8 *data, size_t len) -{ - u8 *p = data; - while ((p + 2 + WPA_SELECTOR_LEN) < (data + len)) { - if ((p[0] == WLAN_EID_VENDOR_SPECIFIC) && - (memcmp(&p[2], WPA_OUI_TYPE, WPA_SELECTOR_LEN) == 0)) - return p; - p += p[1] + 2; - } - return NULL; -} - -#endif /* _ORINOCO_MAIN_H_ */ diff --git a/drivers/net/wireless/orinoco/mic.c b/drivers/net/wireless/orinoco/mic.c deleted file mode 100644 index fce4a843e656..000000000000 --- a/drivers/net/wireless/orinoco/mic.c +++ /dev/null @@ -1,79 +0,0 @@ -/* Orinoco MIC helpers - * - * See copyright notice in main.c - */ -#include -#include -#include -#include -#include - -#include "orinoco.h" -#include "mic.h" - -/********************************************************************/ -/* Michael MIC crypto setup */ -/********************************************************************/ -int orinoco_mic_init(struct orinoco_private *priv) -{ - priv->tx_tfm_mic = crypto_alloc_hash("michael_mic", 0, 0); - if (IS_ERR(priv->tx_tfm_mic)) { - printk(KERN_DEBUG "orinoco_mic_init: could not allocate " - "crypto API michael_mic\n"); - priv->tx_tfm_mic = NULL; - return -ENOMEM; - } - - priv->rx_tfm_mic = crypto_alloc_hash("michael_mic", 0, 0); - if (IS_ERR(priv->rx_tfm_mic)) { - printk(KERN_DEBUG "orinoco_mic_init: could not allocate " - "crypto API michael_mic\n"); - priv->rx_tfm_mic = NULL; - return -ENOMEM; - } - - return 0; -} - -void orinoco_mic_free(struct orinoco_private *priv) -{ - if (priv->tx_tfm_mic) - crypto_free_hash(priv->tx_tfm_mic); - if (priv->rx_tfm_mic) - crypto_free_hash(priv->rx_tfm_mic); -} - -int orinoco_mic(struct crypto_hash *tfm_michael, u8 *key, - u8 *da, u8 *sa, u8 priority, - u8 *data, size_t data_len, u8 *mic) -{ - struct hash_desc desc; - struct scatterlist sg[2]; - u8 hdr[ETH_HLEN + 2]; /* size of header + padding */ - - if (tfm_michael == NULL) { - printk(KERN_WARNING "orinoco_mic: tfm_michael == NULL\n"); - return -1; - } - - /* Copy header into buffer. We need the padding on the end zeroed */ - memcpy(&hdr[0], da, ETH_ALEN); - memcpy(&hdr[ETH_ALEN], sa, ETH_ALEN); - hdr[ETH_ALEN * 2] = priority; - hdr[ETH_ALEN * 2 + 1] = 0; - hdr[ETH_ALEN * 2 + 2] = 0; - hdr[ETH_ALEN * 2 + 3] = 0; - - /* Use scatter gather to MIC header and data in one go */ - sg_init_table(sg, 2); - sg_set_buf(&sg[0], hdr, sizeof(hdr)); - sg_set_buf(&sg[1], data, data_len); - - if (crypto_hash_setkey(tfm_michael, key, MIC_KEYLEN)) - return -1; - - desc.tfm = tfm_michael; - desc.flags = 0; - return crypto_hash_digest(&desc, sg, data_len + sizeof(hdr), - mic); -} diff --git a/drivers/net/wireless/orinoco/mic.h b/drivers/net/wireless/orinoco/mic.h deleted file mode 100644 index 04d05bc566d6..000000000000 --- a/drivers/net/wireless/orinoco/mic.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Orinoco MIC helpers - * - * See copyright notice in main.c - */ -#ifndef _ORINOCO_MIC_H_ -#define _ORINOCO_MIC_H_ - -#include - -#define MICHAEL_MIC_LEN 8 - -/* Forward declarations */ -struct orinoco_private; -struct crypto_hash; - -int orinoco_mic_init(struct orinoco_private *priv); -void orinoco_mic_free(struct orinoco_private *priv); -int orinoco_mic(struct crypto_hash *tfm_michael, u8 *key, - u8 *da, u8 *sa, u8 priority, - u8 *data, size_t data_len, u8 *mic); - -#endif /* ORINOCO_MIC_H */ diff --git a/drivers/net/wireless/orinoco/orinoco.h b/drivers/net/wireless/orinoco/orinoco.h deleted file mode 100644 index 3bb936b9558c..000000000000 --- a/drivers/net/wireless/orinoco/orinoco.h +++ /dev/null @@ -1,256 +0,0 @@ -/* orinoco.h - * - * Common definitions to all pieces of the various orinoco - * drivers - */ - -#ifndef _ORINOCO_H -#define _ORINOCO_H - -#define DRIVER_VERSION "0.15" - -#include -#include -#include -#include -#include -#include - -#include "hermes.h" - -/* To enable debug messages */ -/*#define ORINOCO_DEBUG 3*/ - -#define WIRELESS_SPY /* enable iwspy support */ - -#define MAX_SCAN_LEN 4096 - -#define ORINOCO_SEQ_LEN 8 -#define ORINOCO_MAX_KEY_SIZE 14 -#define ORINOCO_MAX_KEYS 4 - -struct orinoco_key { - __le16 len; /* always stored as little-endian */ - char data[ORINOCO_MAX_KEY_SIZE]; -} __packed; - -#define TKIP_KEYLEN 16 -#define MIC_KEYLEN 8 - -struct orinoco_tkip_key { - u8 tkip[TKIP_KEYLEN]; - u8 tx_mic[MIC_KEYLEN]; - u8 rx_mic[MIC_KEYLEN]; -}; - -enum orinoco_alg { - ORINOCO_ALG_NONE, - ORINOCO_ALG_WEP, - ORINOCO_ALG_TKIP -}; - -enum fwtype { - FIRMWARE_TYPE_AGERE, - FIRMWARE_TYPE_INTERSIL, - FIRMWARE_TYPE_SYMBOL -}; - -struct firmware; - -struct orinoco_private { - void *card; /* Pointer to card dependent structure */ - struct device *dev; - int (*hard_reset)(struct orinoco_private *); - int (*stop_fw)(struct orinoco_private *, int); - - struct ieee80211_supported_band band; - struct ieee80211_channel channels[14]; - u32 cipher_suites[3]; - - /* Synchronisation stuff */ - spinlock_t lock; - int hw_unavailable; - struct work_struct reset_work; - - /* Interrupt tasklets */ - struct tasklet_struct rx_tasklet; - struct list_head rx_list; - - /* driver state */ - int open; - u16 last_linkstatus; - struct work_struct join_work; - struct work_struct wevent_work; - - /* Net device stuff */ - struct net_device *ndev; - struct net_device_stats stats; - struct iw_statistics wstats; - - /* Hardware control variables */ - struct hermes hw; - u16 txfid; - - /* Capabilities of the hardware/firmware */ - enum fwtype firmware_type; - int ibss_port; - int nicbuf_size; - u16 channel_mask; - - /* Boolean capabilities */ - unsigned int has_ibss:1; - unsigned int has_port3:1; - unsigned int has_wep:1; - unsigned int has_big_wep:1; - unsigned int has_mwo:1; - unsigned int has_pm:1; - unsigned int has_preamble:1; - unsigned int has_sensitivity:1; - unsigned int has_hostscan:1; - unsigned int has_alt_txcntl:1; - unsigned int has_ext_scan:1; - unsigned int has_wpa:1; - unsigned int do_fw_download:1; - unsigned int broken_disableport:1; - unsigned int broken_monitor:1; - unsigned int prefer_port3:1; - - /* Configuration paramaters */ - enum nl80211_iftype iw_mode; - enum orinoco_alg encode_alg; - u16 wep_restrict, tx_key; - struct key_params keys[ORINOCO_MAX_KEYS]; - - int bitratemode; - char nick[IW_ESSID_MAX_SIZE + 1]; - char desired_essid[IW_ESSID_MAX_SIZE + 1]; - char desired_bssid[ETH_ALEN]; - int bssid_fixed; - u16 frag_thresh, mwo_robust; - u16 channel; - u16 ap_density, rts_thresh; - u16 pm_on, pm_mcast, pm_period, pm_timeout; - u16 preamble; - u16 short_retry_limit, long_retry_limit; - u16 retry_lifetime; -#ifdef WIRELESS_SPY - struct iw_spy_data spy_data; /* iwspy support */ - struct iw_public_data wireless_data; -#endif - - /* Configuration dependent variables */ - int port_type, createibss; - int promiscuous, mc_count; - - /* Scanning support */ - struct cfg80211_scan_request *scan_request; - struct work_struct process_scan; - struct list_head scan_list; - spinlock_t scan_lock; /* protects the scan list */ - - /* WPA support */ - u8 *wpa_ie; - int wpa_ie_len; - - struct crypto_hash *rx_tfm_mic; - struct crypto_hash *tx_tfm_mic; - - unsigned int wpa_enabled:1; - unsigned int tkip_cm_active:1; - unsigned int key_mgmt:3; - -#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP) - /* Cached in memory firmware to use during ->resume. */ - const struct firmware *cached_pri_fw; - const struct firmware *cached_fw; -#endif - - struct notifier_block pm_notifier; -}; - -#ifdef ORINOCO_DEBUG -extern int orinoco_debug; -#define DEBUG(n, args...) do { \ - if (orinoco_debug > (n)) \ - printk(KERN_DEBUG args); \ -} while (0) -#else -#define DEBUG(n, args...) do { } while (0) -#endif /* ORINOCO_DEBUG */ - -/********************************************************************/ -/* Exported prototypes */ -/********************************************************************/ - -extern struct orinoco_private *alloc_orinocodev( - int sizeof_card, struct device *device, - int (*hard_reset)(struct orinoco_private *), - int (*stop_fw)(struct orinoco_private *, int)); -extern void free_orinocodev(struct orinoco_private *priv); -extern int orinoco_init(struct orinoco_private *priv); -extern int orinoco_if_add(struct orinoco_private *priv, - unsigned long base_addr, - unsigned int irq, - const struct net_device_ops *ops); -extern void orinoco_if_del(struct orinoco_private *priv); -extern int orinoco_up(struct orinoco_private *priv); -extern void orinoco_down(struct orinoco_private *priv); -extern irqreturn_t orinoco_interrupt(int irq, void *dev_id); - -extern void __orinoco_ev_info(struct net_device *dev, struct hermes *hw); -extern void __orinoco_ev_rx(struct net_device *dev, struct hermes *hw); - -int orinoco_process_xmit_skb(struct sk_buff *skb, - struct net_device *dev, - struct orinoco_private *priv, - int *tx_control, - u8 *mic); - -/* Common ndo functions exported for reuse by orinoco_usb */ -int orinoco_open(struct net_device *dev); -int orinoco_stop(struct net_device *dev); -struct net_device_stats *orinoco_get_stats(struct net_device *dev); -void orinoco_set_multicast_list(struct net_device *dev); -int orinoco_change_mtu(struct net_device *dev, int new_mtu); -void orinoco_tx_timeout(struct net_device *dev); - -/********************************************************************/ -/* Locking and synchronization functions */ -/********************************************************************/ - -static inline int orinoco_lock(struct orinoco_private *priv, - unsigned long *flags) -{ - priv->hw.ops->lock_irqsave(&priv->lock, flags); - if (priv->hw_unavailable) { - DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n", - priv->ndev); - priv->hw.ops->unlock_irqrestore(&priv->lock, flags); - return -EBUSY; - } - return 0; -} - -static inline void orinoco_unlock(struct orinoco_private *priv, - unsigned long *flags) -{ - priv->hw.ops->unlock_irqrestore(&priv->lock, flags); -} - -static inline void orinoco_lock_irq(struct orinoco_private *priv) -{ - priv->hw.ops->lock_irq(&priv->lock); -} - -static inline void orinoco_unlock_irq(struct orinoco_private *priv) -{ - priv->hw.ops->unlock_irq(&priv->lock); -} - -/*** Navigate from net_device to orinoco_private ***/ -static inline struct orinoco_private *ndev_priv(struct net_device *dev) -{ - struct wireless_dev *wdev = netdev_priv(dev); - return wdev_priv(wdev); -} -#endif /* _ORINOCO_H */ diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c deleted file mode 100644 index d21d95939316..000000000000 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ /dev/null @@ -1,341 +0,0 @@ -/* orinoco_cs.c (formerly known as dldwd_cs.c) - * - * A driver for "Hermes" chipset based PCMCIA wireless adaptors, such - * as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/ - * EnteraSys RoamAbout 802.11, ELSA Airlancer, Melco Buffalo and others). - * It should also be usable on various Prism II based cards such as the - * Linksys, D-Link and Farallon Skyline. It should also work on Symbol - * cards such as the 3Com AirConnect and Ericsson WLAN. - * - * Copyright notice & release notes in file main.c - */ - -#define DRIVER_NAME "orinoco_cs" -#define PFX DRIVER_NAME ": " - -#include -#include -#include -#include -#include -#include -#include - -#include "orinoco.h" - -/********************************************************************/ -/* Module stuff */ -/********************************************************************/ - -MODULE_AUTHOR("David Gibson "); -MODULE_DESCRIPTION("Driver for PCMCIA Lucent Orinoco," - " Prism II based and similar wireless cards"); -MODULE_LICENSE("Dual MPL/GPL"); - -/* Module parameters */ - -/* Some D-Link cards have buggy CIS. They do work at 5v properly, but - * don't have any CIS entry for it. This workaround it... */ -static int ignore_cis_vcc; /* = 0 */ -module_param(ignore_cis_vcc, int, 0); -MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket"); - -/********************************************************************/ -/* Data structures */ -/********************************************************************/ - -/* PCMCIA specific device information (goes in the card field of - * struct orinoco_private */ -struct orinoco_pccard { - struct pcmcia_device *p_dev; - - /* Used to handle hard reset */ - /* yuck, we need this hack to work around the insanity of the - * PCMCIA layer */ - unsigned long hard_reset_in_progress; -}; - - -/********************************************************************/ -/* Function prototypes */ -/********************************************************************/ - -static int orinoco_cs_config(struct pcmcia_device *link); -static void orinoco_cs_release(struct pcmcia_device *link); -static void orinoco_cs_detach(struct pcmcia_device *p_dev); - -/********************************************************************/ -/* Device methods */ -/********************************************************************/ - -static int -orinoco_cs_hard_reset(struct orinoco_private *priv) -{ - struct orinoco_pccard *card = priv->card; - struct pcmcia_device *link = card->p_dev; - int err; - - /* We need atomic ops here, because we're not holding the lock */ - set_bit(0, &card->hard_reset_in_progress); - - err = pcmcia_reset_card(link->socket); - if (err) - return err; - - msleep(100); - clear_bit(0, &card->hard_reset_in_progress); - - return 0; -} - -/********************************************************************/ -/* PCMCIA stuff */ -/********************************************************************/ - -static int -orinoco_cs_probe(struct pcmcia_device *link) -{ - struct orinoco_private *priv; - struct orinoco_pccard *card; - - priv = alloc_orinocodev(sizeof(*card), &link->dev, - orinoco_cs_hard_reset, NULL); - if (!priv) - return -ENOMEM; - card = priv->card; - - /* Link both structures together */ - card->p_dev = link; - link->priv = priv; - - return orinoco_cs_config(link); -} /* orinoco_cs_attach */ - -static void orinoco_cs_detach(struct pcmcia_device *link) -{ - struct orinoco_private *priv = link->priv; - - orinoco_if_del(priv); - - orinoco_cs_release(link); - - free_orinocodev(priv); -} /* orinoco_cs_detach */ - -static int orinoco_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) -{ - if (p_dev->config_index == 0) - return -EINVAL; - - return pcmcia_request_io(p_dev); -}; - -static int -orinoco_cs_config(struct pcmcia_device *link) -{ - struct orinoco_private *priv = link->priv; - struct hermes *hw = &priv->hw; - int ret; - void __iomem *mem; - - link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC | - CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; - if (ignore_cis_vcc) - link->config_flags &= ~CONF_AUTO_CHECK_VCC; - ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); - if (ret) { - if (!ignore_cis_vcc) - printk(KERN_ERR PFX "GetNextTuple(): No matching " - "CIS configuration. Maybe you need the " - "ignore_cis_vcc=1 parameter.\n"); - goto failed; - } - - mem = ioport_map(link->resource[0]->start, - resource_size(link->resource[0])); - if (!mem) - goto failed; - - /* We initialize the hermes structure before completing PCMCIA - * configuration just in case the interrupt handler gets - * called. */ - hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); - - ret = pcmcia_request_irq(link, orinoco_interrupt); - if (ret) - goto failed; - - ret = pcmcia_enable_device(link); - if (ret) - goto failed; - - /* Initialise the main driver */ - if (orinoco_init(priv) != 0) { - printk(KERN_ERR PFX "orinoco_init() failed\n"); - goto failed; - } - - /* Register an interface with the stack */ - if (orinoco_if_add(priv, link->resource[0]->start, - link->irq, NULL) != 0) { - printk(KERN_ERR PFX "orinoco_if_add() failed\n"); - goto failed; - } - - return 0; - - failed: - orinoco_cs_release(link); - return -ENODEV; -} /* orinoco_cs_config */ - -static void -orinoco_cs_release(struct pcmcia_device *link) -{ - struct orinoco_private *priv = link->priv; - unsigned long flags; - - /* We're committed to taking the device away now, so mark the - * hardware as unavailable */ - priv->hw.ops->lock_irqsave(&priv->lock, &flags); - priv->hw_unavailable++; - priv->hw.ops->unlock_irqrestore(&priv->lock, &flags); - - pcmcia_disable_device(link); - if (priv->hw.iobase) - ioport_unmap(priv->hw.iobase); -} /* orinoco_cs_release */ - -static int orinoco_cs_suspend(struct pcmcia_device *link) -{ - struct orinoco_private *priv = link->priv; - struct orinoco_pccard *card = priv->card; - - /* This is probably racy, but I can't think of - a better way, short of rewriting the PCMCIA - layer to not suck :-( */ - if (!test_bit(0, &card->hard_reset_in_progress)) - orinoco_down(priv); - - return 0; -} - -static int orinoco_cs_resume(struct pcmcia_device *link) -{ - struct orinoco_private *priv = link->priv; - struct orinoco_pccard *card = priv->card; - int err = 0; - - if (!test_bit(0, &card->hard_reset_in_progress)) - err = orinoco_up(priv); - - return err; -} - - -/********************************************************************/ -/* Module initialization */ -/********************************************************************/ - -static const struct pcmcia_device_id orinoco_cs_ids[] = { - PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), /* 3Com AirConnect PCI 777A */ - PCMCIA_DEVICE_MANF_CARD(0x016b, 0x0001), /* Ericsson WLAN Card C11 */ - PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a), /* Nortel Networks eMobility 802.11 Wireless Adapter */ - PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), /* AirWay 802.11 Adapter (PCMCIA) */ - PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), /* ARtem Onair */ - PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0003), /* ARtem Onair Comcard 11 */ - PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), /* Buffalo WLI-PCM-S11 */ - PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), /* ASUS SpaceLink WL-100 */ - PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), /* SpeedStream SS1021 Wireless Adapter */ - PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x3021), /* SpeedStream Wireless Adapter */ - PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), /* PLANEX RoadLannerWave GW-NS11H */ - PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), - PCMCIA_DEVICE_PROD_ID12("Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", 0x5cd01705, 0x4271660f), - PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11B_CF_CARD_25", 0x78fc06ee, 0x45a50c1e), - PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11b_PC_CARD_25", 0x78fc06ee, 0xdb9aa842), - PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169), - PCMCIA_DEVICE_PROD_ID12("BENQ", "AWL100 PCMCIA ADAPTER", 0x35dadc74, 0x01f7fedb), - PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90), - PCMCIA_DEVICE_PROD_ID12("D-Link Corporation", "D-Link DWL-650H 11Mbps WLAN Adapter", 0xef544d24, 0xcd8ea916), - PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3), - PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c), - PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless 2011 LAN PC Card", 0x816cc815, 0x07f58077), - PCMCIA_DEVICE_PROD_ID12("LeArtery", "SYNCBYAIR 11Mbps Wireless LAN PC Card", 0x7e3b326a, 0x49893e92), - PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a), - PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410), - PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3), - PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a), - PCMCIA_DEVICE_PROD_ID12("Nortel Networks", "emobility 802.11 Wireless LAN PC Card", 0x2d617ea0, 0x88cd5767), - PCMCIA_DEVICE_PROD_ID12("OTC", "Wireless AirEZY 2411-PCC WLAN Card", 0x4ac44287, 0x235a6bed), - PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9), - PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26), - PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b), - PCMCIA_DEVICE_PROD_ID12("Symbol Technologies", "LA4111 Spectrum24 Wireless LAN PC Card", 0x3f02b4d6, 0x3663cb0e), - PCMCIA_DEVICE_MANF_CARD_PROD_ID3(0x0156, 0x0002, "Version 01.01", 0xd27deb1a), /* Lucent Orinoco */ -#ifdef CONFIG_HERMES_PRISM - /* Only entries that certainly identify Prism chipset */ - PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), /* SonicWALL Long Range Wireless Card */ - PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), /* Sohoware NCP110, Philips 802.11b */ - PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0002), /* AnyPoint(TM) Wireless II PC Card */ - PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000), /* PROXIM RangeLAN-DS/LAN PC CARD */ - PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), /* Compaq WL100 11 Mbps Wireless Adapter */ - PCMCIA_DEVICE_MANF_CARD(0x01ff, 0x0008), /* Intermec MobileLAN 11Mbps 802.11b WLAN Card */ - PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */ - PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */ - PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */ - PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), /* Compaq HNW-100 11 Mbps Wireless Adapter */ - PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), /* Linksys WCF12 Wireless CompactFlash Card */ - PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), /* Airvast WN-100 */ - PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), /* Adaptec Ultra Wireless ANW-8030 */ - PCMCIA_DEVICE_MANF_CARD(0xc001, 0x0008), /* CONTEC FLEXSCAN/FX-DDS110-PCC */ - PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), /* Conceptronic CON11Cpro, EMTAC A2424i */ - PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), /* Safeway 802.11b, ZCOMAX AirRunner/XI-300 */ - PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), /* D-Link DCF660, Sandisk Connect SDWCFB-000 */ - PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0), - PCMCIA_DEVICE_PROD_ID12("ACTIONTEC", "PRISM Wireless LAN PC Card", 0x393089da, 0xa71e69d5), - PCMCIA_DEVICE_PROD_ID12("Addtron", "AWP-100 Wireless PCMCIA", 0xe6ec52ce, 0x08649af2), - PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G", 0x2decece3, 0x82067c18), - PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3), - PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card", 0x54f7c49c, 0x15a75e5b), - PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584), - PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9), - PCMCIA_DEVICE_PROD_ID12("corega_K.K.", "Wireless_LAN_PCCB-11", 0x29e33311, 0xee7a27ae), - PCMCIA_DEVICE_PROD_ID12("Digital Data Communications", "WPC-0100", 0xfdd73470, 0xe0b6f146), - PCMCIA_DEVICE_PROD_ID12("D", "Link DRC-650 11Mbps WLAN Card", 0x71b18589, 0xf144e3ac), - PCMCIA_DEVICE_PROD_ID12("D", "Link DWL-650 11Mbps WLAN Card", 0x71b18589, 0xb6f1b0ab), - PCMCIA_DEVICE_PROD_ID12(" ", "IEEE 802.11 Wireless LAN/PC Card", 0x3b6e20c8, 0xefccafe9), - PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18), - PCMCIA_DEVICE_PROD_ID12("INTERSIL", "I-GATE 11M PC Card / PC Card plus", 0x74c5e40d, 0x8304ff77), - PCMCIA_DEVICE_PROD_ID12("Intersil", "PRISM 2_5 PCMCIA ADAPTER", 0x4b801a17, 0x6345a0bf), - PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card", 0x0733cc81, 0x0c52f395), - PCMCIA_DEVICE_PROD_ID12("Microsoft", "Wireless Notebook Adapter MN-520", 0x5961bf85, 0x6eec8c01), - PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401RA Wireless PC", "Card", 0x0306467f, 0x9762e8f1), - PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401 Wireless PC", "Card", 0xa37434e9, 0x9762e8f1), - PCMCIA_DEVICE_PROD_ID12("OEM", "PRISM2 IEEE 802.11 PC-Card", 0xfea54c90, 0x48f2bdd6), - PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-CF110", 0x209f40ab, 0xd9715264), - PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-NS110", 0x209f40ab, 0x46263178), - PCMCIA_DEVICE_PROD_ID12("SMC", "SMC2532W-B EliteConnect Wireless Adapter", 0xc4f8b18b, 0x196bd757), - PCMCIA_DEVICE_PROD_ID12("SMC", "SMC2632W", 0xc4f8b18b, 0x474a1f2a), - PCMCIA_DEVICE_PROD_ID12("ZoomAir 11Mbps High", "Rate wireless Networking", 0x273fe3db, 0x32a1eaee), - PCMCIA_DEVICE_PROD_ID3("HFA3863", 0x355cb092), - PCMCIA_DEVICE_PROD_ID3("ISL37100P", 0x630d52b2), - PCMCIA_DEVICE_PROD_ID3("ISL37101P-10", 0xdd97a26b), - PCMCIA_DEVICE_PROD_ID3("ISL37300P", 0xc9049a39), - - /* This may be Agere or Intersil Firmware */ - PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), -#endif - PCMCIA_DEVICE_NULL, -}; -MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids); - -static struct pcmcia_driver orinoco_driver = { - .owner = THIS_MODULE, - .name = DRIVER_NAME, - .probe = orinoco_cs_probe, - .remove = orinoco_cs_detach, - .id_table = orinoco_cs_ids, - .suspend = orinoco_cs_suspend, - .resume = orinoco_cs_resume, -}; -module_pcmcia_driver(orinoco_driver); diff --git a/drivers/net/wireless/orinoco/orinoco_nortel.c b/drivers/net/wireless/orinoco/orinoco_nortel.c deleted file mode 100644 index d73fdf6185a2..000000000000 --- a/drivers/net/wireless/orinoco/orinoco_nortel.c +++ /dev/null @@ -1,322 +0,0 @@ -/* orinoco_nortel.c - * - * Driver for Prism II devices which would usually be driven by orinoco_cs, - * but are connected to the PCI bus by a PCI-to-PCMCIA adapter used in - * Nortel emobility, Symbol LA-4113 and Symbol LA-4123. - * - * Copyright (C) 2002 Tobias Hoffmann - * (C) 2003 Christoph Jungegger - * - * Some of this code is borrowed from orinoco_plx.c - * Copyright (C) 2001 Daniel Barlow - * Some of this code is borrowed from orinoco_pci.c - * Copyright (C) 2001 Jean Tourrilhes - * Some of this code is "inspired" by linux-wlan-ng-0.1.10, but nothing - * has been copied from it. linux-wlan-ng-0.1.10 is originally : - * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License version 2 (the "GPL"), in - * which case the provisions of the GPL are applicable instead of the - * above. If you wish to allow the use of your version of this file - * only under the terms of the GPL and not to allow others to use your - * version of this file under the MPL, indicate your decision by - * deleting the provisions above and replace them with the notice and - * other provisions required by the GPL. If you do not delete the - * provisions above, a recipient may use your version of this file - * under either the MPL or the GPL. - */ - -#define DRIVER_NAME "orinoco_nortel" -#define PFX DRIVER_NAME ": " - -#include -#include -#include -#include -#include -#include - -#include "orinoco.h" -#include "orinoco_pci.h" - -#define COR_OFFSET (0xe0) /* COR attribute offset of Prism2 PC card */ -#define COR_VALUE (COR_LEVEL_REQ | COR_FUNC_ENA) /* Enable PC card with interrupt in level trigger */ - - -/* - * Do a soft reset of the card using the Configuration Option Register - * We need this to get going... - * This is the part of the code that is strongly inspired from wlan-ng - * - * Note bis : Don't try to access HERMES_CMD during the reset phase. - * It just won't work ! - */ -static int orinoco_nortel_cor_reset(struct orinoco_private *priv) -{ - struct orinoco_pci_card *card = priv->card; - - /* Assert the reset until the card notices */ - iowrite16(8, card->bridge_io + 2); - ioread16(card->attr_io + COR_OFFSET); - iowrite16(0x80, card->attr_io + COR_OFFSET); - mdelay(1); - - /* Give time for the card to recover from this hard effort */ - iowrite16(0, card->attr_io + COR_OFFSET); - iowrite16(0, card->attr_io + COR_OFFSET); - mdelay(1); - - /* Set COR as usual */ - iowrite16(COR_VALUE, card->attr_io + COR_OFFSET); - iowrite16(COR_VALUE, card->attr_io + COR_OFFSET); - mdelay(1); - - iowrite16(0x228, card->bridge_io + 2); - - return 0; -} - -static int orinoco_nortel_hw_init(struct orinoco_pci_card *card) -{ - int i; - u32 reg; - - /* Setup bridge */ - if (ioread16(card->bridge_io) & 1) { - printk(KERN_ERR PFX "brg1 answer1 wrong\n"); - return -EBUSY; - } - iowrite16(0x118, card->bridge_io + 2); - iowrite16(0x108, card->bridge_io + 2); - mdelay(30); - iowrite16(0x8, card->bridge_io + 2); - for (i = 0; i < 30; i++) { - mdelay(30); - if (ioread16(card->bridge_io) & 0x10) - break; - } - if (i == 30) { - printk(KERN_ERR PFX "brg1 timed out\n"); - return -EBUSY; - } - if (ioread16(card->attr_io + COR_OFFSET) & 1) { - printk(KERN_ERR PFX "brg2 answer1 wrong\n"); - return -EBUSY; - } - if (ioread16(card->attr_io + COR_OFFSET + 2) & 1) { - printk(KERN_ERR PFX "brg2 answer2 wrong\n"); - return -EBUSY; - } - if (ioread16(card->attr_io + COR_OFFSET + 4) & 1) { - printk(KERN_ERR PFX "brg2 answer3 wrong\n"); - return -EBUSY; - } - - /* Set the PCMCIA COR register */ - iowrite16(COR_VALUE, card->attr_io + COR_OFFSET); - mdelay(1); - reg = ioread16(card->attr_io + COR_OFFSET); - if (reg != COR_VALUE) { - printk(KERN_ERR PFX "Error setting COR value (reg=%x)\n", - reg); - return -EBUSY; - } - - /* Set LEDs */ - iowrite16(1, card->bridge_io + 10); - return 0; -} - -static int orinoco_nortel_init_one(struct pci_dev *pdev, - const struct pci_device_id *ent) -{ - int err; - struct orinoco_private *priv; - struct orinoco_pci_card *card; - void __iomem *hermes_io, *bridge_io, *attr_io; - - err = pci_enable_device(pdev); - if (err) { - printk(KERN_ERR PFX "Cannot enable PCI device\n"); - return err; - } - - err = pci_request_regions(pdev, DRIVER_NAME); - if (err) { - printk(KERN_ERR PFX "Cannot obtain PCI resources\n"); - goto fail_resources; - } - - bridge_io = pci_iomap(pdev, 0, 0); - if (!bridge_io) { - printk(KERN_ERR PFX "Cannot map bridge registers\n"); - err = -EIO; - goto fail_map_bridge; - } - - attr_io = pci_iomap(pdev, 1, 0); - if (!attr_io) { - printk(KERN_ERR PFX "Cannot map PCMCIA attributes\n"); - err = -EIO; - goto fail_map_attr; - } - - hermes_io = pci_iomap(pdev, 2, 0); - if (!hermes_io) { - printk(KERN_ERR PFX "Cannot map chipset registers\n"); - err = -EIO; - goto fail_map_hermes; - } - - /* Allocate network device */ - priv = alloc_orinocodev(sizeof(*card), &pdev->dev, - orinoco_nortel_cor_reset, NULL); - if (!priv) { - printk(KERN_ERR PFX "Cannot allocate network device\n"); - err = -ENOMEM; - goto fail_alloc; - } - - card = priv->card; - card->bridge_io = bridge_io; - card->attr_io = attr_io; - - hermes_struct_init(&priv->hw, hermes_io, HERMES_16BIT_REGSPACING); - - err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED, - DRIVER_NAME, priv); - if (err) { - printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); - err = -EBUSY; - goto fail_irq; - } - - err = orinoco_nortel_hw_init(card); - if (err) { - printk(KERN_ERR PFX "Hardware initialization failed\n"); - goto fail; - } - - err = orinoco_nortel_cor_reset(priv); - if (err) { - printk(KERN_ERR PFX "Initial reset failed\n"); - goto fail; - } - - err = orinoco_init(priv); - if (err) { - printk(KERN_ERR PFX "orinoco_init() failed\n"); - goto fail; - } - - err = orinoco_if_add(priv, 0, 0, NULL); - if (err) { - printk(KERN_ERR PFX "orinoco_if_add() failed\n"); - goto fail; - } - - pci_set_drvdata(pdev, priv); - - return 0; - - fail: - free_irq(pdev->irq, priv); - - fail_irq: - pci_set_drvdata(pdev, NULL); - free_orinocodev(priv); - - fail_alloc: - pci_iounmap(pdev, hermes_io); - - fail_map_hermes: - pci_iounmap(pdev, attr_io); - - fail_map_attr: - pci_iounmap(pdev, bridge_io); - - fail_map_bridge: - pci_release_regions(pdev); - - fail_resources: - pci_disable_device(pdev); - - return err; -} - -static void orinoco_nortel_remove_one(struct pci_dev *pdev) -{ - struct orinoco_private *priv = pci_get_drvdata(pdev); - struct orinoco_pci_card *card = priv->card; - - /* Clear LEDs */ - iowrite16(0, card->bridge_io + 10); - - orinoco_if_del(priv); - free_irq(pdev->irq, priv); - pci_set_drvdata(pdev, NULL); - free_orinocodev(priv); - pci_iounmap(pdev, priv->hw.iobase); - pci_iounmap(pdev, card->attr_io); - pci_iounmap(pdev, card->bridge_io); - pci_release_regions(pdev); - pci_disable_device(pdev); -} - -static DEFINE_PCI_DEVICE_TABLE(orinoco_nortel_id_table) = { - /* Nortel emobility PCI */ - {0x126c, 0x8030, PCI_ANY_ID, PCI_ANY_ID,}, - /* Symbol LA-4123 PCI */ - {0x1562, 0x0001, PCI_ANY_ID, PCI_ANY_ID,}, - {0,}, -}; - -MODULE_DEVICE_TABLE(pci, orinoco_nortel_id_table); - -static struct pci_driver orinoco_nortel_driver = { - .name = DRIVER_NAME, - .id_table = orinoco_nortel_id_table, - .probe = orinoco_nortel_init_one, - .remove = orinoco_nortel_remove_one, - .suspend = orinoco_pci_suspend, - .resume = orinoco_pci_resume, -}; - -static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION - " (Tobias Hoffmann & Christoph Jungegger )"; -MODULE_AUTHOR("Christoph Jungegger "); -MODULE_DESCRIPTION("Driver for wireless LAN cards using the Nortel PCI bridge"); -MODULE_LICENSE("Dual MPL/GPL"); - -static int __init orinoco_nortel_init(void) -{ - printk(KERN_DEBUG "%s\n", version); - return pci_register_driver(&orinoco_nortel_driver); -} - -static void __exit orinoco_nortel_exit(void) -{ - pci_unregister_driver(&orinoco_nortel_driver); -} - -module_init(orinoco_nortel_init); -module_exit(orinoco_nortel_exit); - -/* - * Local variables: - * c-indent-level: 8 - * c-basic-offset: 8 - * tab-width: 8 - * End: - */ diff --git a/drivers/net/wireless/orinoco/orinoco_pci.c b/drivers/net/wireless/orinoco/orinoco_pci.c deleted file mode 100644 index 677bf14eca84..000000000000 --- a/drivers/net/wireless/orinoco/orinoco_pci.c +++ /dev/null @@ -1,265 +0,0 @@ -/* orinoco_pci.c - * - * Driver for Prism 2.5/3 devices that have a direct PCI interface - * (i.e. these are not PCMCIA cards in a PCMCIA-to-PCI bridge). - * The card contains only one PCI region, which contains all the usual - * hermes registers, as well as the COR register. - * - * Current maintainers are: - * Pavel Roskin - * and David Gibson - * - * Some of this code is borrowed from orinoco_plx.c - * Copyright (C) 2001 Daniel Barlow - * Some of this code is "inspired" by linux-wlan-ng-0.1.10, but nothing - * has been copied from it. linux-wlan-ng-0.1.10 is originally : - * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. - * This file originally written by: - * Copyright (C) 2001 Jean Tourrilhes - * And is now maintained by: - * (C) Copyright David Gibson, IBM Corp. 2002-2003. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License version 2 (the "GPL"), in - * which case the provisions of the GPL are applicable instead of the - * above. If you wish to allow the use of your version of this file - * only under the terms of the GPL and not to allow others to use your - * version of this file under the MPL, indicate your decision by - * deleting the provisions above and replace them with the notice and - * other provisions required by the GPL. If you do not delete the - * provisions above, a recipient may use your version of this file - * under either the MPL or the GPL. - */ - -#define DRIVER_NAME "orinoco_pci" -#define PFX DRIVER_NAME ": " - -#include -#include -#include -#include -#include - -#include "orinoco.h" -#include "orinoco_pci.h" - -/* Offset of the COR register of the PCI card */ -#define HERMES_PCI_COR (0x26) - -/* Bitmask to reset the card */ -#define HERMES_PCI_COR_MASK (0x0080) - -/* Magic timeouts for doing the reset. - * Those times are straight from wlan-ng, and it is claimed that they - * are necessary. Alan will kill me. Take your time and grab a coffee. */ -#define HERMES_PCI_COR_ONT (250) /* ms */ -#define HERMES_PCI_COR_OFFT (500) /* ms */ -#define HERMES_PCI_COR_BUSYT (500) /* ms */ - -/* - * Do a soft reset of the card using the Configuration Option Register - * We need this to get going... - * This is the part of the code that is strongly inspired from wlan-ng - * - * Note : This code is done with irq enabled. This mean that many - * interrupts will occur while we are there. This is why we use the - * jiffies to regulate time instead of a straight mdelay(). Usually we - * need only around 245 iteration of the loop to do 250 ms delay. - * - * Note bis : Don't try to access HERMES_CMD during the reset phase. - * It just won't work ! - */ -static int orinoco_pci_cor_reset(struct orinoco_private *priv) -{ - struct hermes *hw = &priv->hw; - unsigned long timeout; - u16 reg; - - /* Assert the reset until the card notices */ - hermes_write_regn(hw, PCI_COR, HERMES_PCI_COR_MASK); - mdelay(HERMES_PCI_COR_ONT); - - /* Give time for the card to recover from this hard effort */ - hermes_write_regn(hw, PCI_COR, 0x0000); - mdelay(HERMES_PCI_COR_OFFT); - - /* The card is ready when it's no longer busy */ - timeout = jiffies + (HERMES_PCI_COR_BUSYT * HZ / 1000); - reg = hermes_read_regn(hw, CMD); - while (time_before(jiffies, timeout) && (reg & HERMES_CMD_BUSY)) { - mdelay(1); - reg = hermes_read_regn(hw, CMD); - } - - /* Still busy? */ - if (reg & HERMES_CMD_BUSY) { - printk(KERN_ERR PFX "Busy timeout\n"); - return -ETIMEDOUT; - } - - return 0; -} - -static int orinoco_pci_init_one(struct pci_dev *pdev, - const struct pci_device_id *ent) -{ - int err; - struct orinoco_private *priv; - struct orinoco_pci_card *card; - void __iomem *hermes_io; - - err = pci_enable_device(pdev); - if (err) { - printk(KERN_ERR PFX "Cannot enable PCI device\n"); - return err; - } - - err = pci_request_regions(pdev, DRIVER_NAME); - if (err) { - printk(KERN_ERR PFX "Cannot obtain PCI resources\n"); - goto fail_resources; - } - - hermes_io = pci_iomap(pdev, 0, 0); - if (!hermes_io) { - printk(KERN_ERR PFX "Cannot remap chipset registers\n"); - err = -EIO; - goto fail_map_hermes; - } - - /* Allocate network device */ - priv = alloc_orinocodev(sizeof(*card), &pdev->dev, - orinoco_pci_cor_reset, NULL); - if (!priv) { - printk(KERN_ERR PFX "Cannot allocate network device\n"); - err = -ENOMEM; - goto fail_alloc; - } - - card = priv->card; - - hermes_struct_init(&priv->hw, hermes_io, HERMES_32BIT_REGSPACING); - - err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED, - DRIVER_NAME, priv); - if (err) { - printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); - err = -EBUSY; - goto fail_irq; - } - - err = orinoco_pci_cor_reset(priv); - if (err) { - printk(KERN_ERR PFX "Initial reset failed\n"); - goto fail; - } - - err = orinoco_init(priv); - if (err) { - printk(KERN_ERR PFX "orinoco_init() failed\n"); - goto fail; - } - - err = orinoco_if_add(priv, 0, 0, NULL); - if (err) { - printk(KERN_ERR PFX "orinoco_if_add() failed\n"); - goto fail; - } - - pci_set_drvdata(pdev, priv); - - return 0; - - fail: - free_irq(pdev->irq, priv); - - fail_irq: - pci_set_drvdata(pdev, NULL); - free_orinocodev(priv); - - fail_alloc: - pci_iounmap(pdev, hermes_io); - - fail_map_hermes: - pci_release_regions(pdev); - - fail_resources: - pci_disable_device(pdev); - - return err; -} - -static void orinoco_pci_remove_one(struct pci_dev *pdev) -{ - struct orinoco_private *priv = pci_get_drvdata(pdev); - - orinoco_if_del(priv); - free_irq(pdev->irq, priv); - pci_set_drvdata(pdev, NULL); - free_orinocodev(priv); - pci_iounmap(pdev, priv->hw.iobase); - pci_release_regions(pdev); - pci_disable_device(pdev); -} - -static DEFINE_PCI_DEVICE_TABLE(orinoco_pci_id_table) = { - /* Intersil Prism 3 */ - {0x1260, 0x3872, PCI_ANY_ID, PCI_ANY_ID,}, - /* Intersil Prism 2.5 */ - {0x1260, 0x3873, PCI_ANY_ID, PCI_ANY_ID,}, - /* Samsung MagicLAN SWL-2210P */ - {0x167d, 0xa000, PCI_ANY_ID, PCI_ANY_ID,}, - {0,}, -}; - -MODULE_DEVICE_TABLE(pci, orinoco_pci_id_table); - -static struct pci_driver orinoco_pci_driver = { - .name = DRIVER_NAME, - .id_table = orinoco_pci_id_table, - .probe = orinoco_pci_init_one, - .remove = orinoco_pci_remove_one, - .suspend = orinoco_pci_suspend, - .resume = orinoco_pci_resume, -}; - -static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION - " (Pavel Roskin ," - " David Gibson &" - " Jean Tourrilhes )"; -MODULE_AUTHOR("Pavel Roskin &" - " David Gibson "); -MODULE_DESCRIPTION("Driver for wireless LAN cards using direct PCI interface"); -MODULE_LICENSE("Dual MPL/GPL"); - -static int __init orinoco_pci_init(void) -{ - printk(KERN_DEBUG "%s\n", version); - return pci_register_driver(&orinoco_pci_driver); -} - -static void __exit orinoco_pci_exit(void) -{ - pci_unregister_driver(&orinoco_pci_driver); -} - -module_init(orinoco_pci_init); -module_exit(orinoco_pci_exit); - -/* - * Local variables: - * c-indent-level: 8 - * c-basic-offset: 8 - * tab-width: 8 - * End: - */ diff --git a/drivers/net/wireless/orinoco/orinoco_pci.h b/drivers/net/wireless/orinoco/orinoco_pci.h deleted file mode 100644 index ea7231af40a8..000000000000 --- a/drivers/net/wireless/orinoco/orinoco_pci.h +++ /dev/null @@ -1,68 +0,0 @@ -/* orinoco_pci.h - * - * Common code for all Orinoco drivers for PCI devices, including - * both native PCI and PCMCIA-to-PCI bridges. - * - * Copyright (C) 2005, Pavel Roskin. - * See main.c for license. - */ - -#ifndef _ORINOCO_PCI_H -#define _ORINOCO_PCI_H - -#include - -/* Driver specific data */ -struct orinoco_pci_card { - void __iomem *bridge_io; - void __iomem *attr_io; -}; - -#ifdef CONFIG_PM -static int orinoco_pci_suspend(struct pci_dev *pdev, pm_message_t state) -{ - struct orinoco_private *priv = pci_get_drvdata(pdev); - - orinoco_down(priv); - free_irq(pdev->irq, priv); - pci_save_state(pdev); - pci_disable_device(pdev); - pci_set_power_state(pdev, PCI_D3hot); - - return 0; -} - -static int orinoco_pci_resume(struct pci_dev *pdev) -{ - struct orinoco_private *priv = pci_get_drvdata(pdev); - struct net_device *dev = priv->ndev; - int err; - - pci_set_power_state(pdev, 0); - err = pci_enable_device(pdev); - if (err) { - printk(KERN_ERR "%s: pci_enable_device failed on resume\n", - dev->name); - return err; - } - pci_restore_state(pdev); - - err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED, - dev->name, priv); - if (err) { - printk(KERN_ERR "%s: cannot re-allocate IRQ on resume\n", - dev->name); - pci_disable_device(pdev); - return -EBUSY; - } - - err = orinoco_up(priv); - - return err; -} -#else -#define orinoco_pci_suspend NULL -#define orinoco_pci_resume NULL -#endif - -#endif /* _ORINOCO_PCI_H */ diff --git a/drivers/net/wireless/orinoco/orinoco_plx.c b/drivers/net/wireless/orinoco/orinoco_plx.c deleted file mode 100644 index 2559dbd6184b..000000000000 --- a/drivers/net/wireless/orinoco/orinoco_plx.c +++ /dev/null @@ -1,370 +0,0 @@ -/* orinoco_plx.c - * - * Driver for Prism II devices which would usually be driven by orinoco_cs, - * but are connected to the PCI bus by a PLX9052. - * - * Current maintainers are: - * Pavel Roskin - * and David Gibson - * - * (C) Copyright David Gibson, IBM Corp. 2001-2003. - * Copyright (C) 2001 Daniel Barlow - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License version 2 (the "GPL"), in - * which case the provisions of the GPL are applicable instead of the - * above. If you wish to allow the use of your version of this file - * only under the terms of the GPL and not to allow others to use your - * version of this file under the MPL, indicate your decision by - * deleting the provisions above and replace them with the notice and - * other provisions required by the GPL. If you do not delete the - * provisions above, a recipient may use your version of this file - * under either the MPL or the GPL. - * - * Here's the general details on how the PLX9052 adapter works: - * - * - Two PCI I/O address spaces, one 0x80 long which contains the - * PLX9052 registers, and one that's 0x40 long mapped to the PCMCIA - * slot I/O address space. - * - * - One PCI memory address space, mapped to the PCMCIA attribute space - * (containing the CIS). - * - * Using the later, you can read through the CIS data to make sure the - * card is compatible with the driver. Keep in mind that the PCMCIA - * spec specifies the CIS as the lower 8 bits of each word read from - * the CIS, so to read the bytes of the CIS, read every other byte - * (0,2,4,...). Passing that test, you need to enable the I/O address - * space on the PCMCIA card via the PCMCIA COR register. This is the - * first byte following the CIS. In my case (which may not have any - * relation to what's on the PRISM2 cards), COR was at offset 0x800 - * within the PCI memory space. Write 0x41 to the COR register to - * enable I/O mode and to select level triggered interrupts. To - * confirm you actually succeeded, read the COR register back and make - * sure it actually got set to 0x41, in case you have an unexpected - * card inserted. - * - * Following that, you can treat the second PCI I/O address space (the - * one that's not 0x80 in length) as the PCMCIA I/O space. - * - * Note that in the Eumitcom's source for their drivers, they register - * the interrupt as edge triggered when registering it with the - * Windows kernel. I don't recall how to register edge triggered on - * Linux (if it can be done at all). But in some experimentation, I - * don't see much operational difference between using either - * interrupt mode. Don't mess with the interrupt mode in the COR - * register though, as the PLX9052 wants level triggers with the way - * the serial EEPROM configures it on the WL11000. - * - * There's some other little quirks related to timing that I bumped - * into, but I don't recall right now. Also, there's two variants of - * the WL11000 I've seen, revision A1 and T2. These seem to differ - * slightly in the timings configured in the wait-state generator in - * the PLX9052. There have also been some comments from Eumitcom that - * cards shouldn't be hot swapped, apparently due to risk of cooking - * the PLX9052. I'm unsure why they believe this, as I can't see - * anything in the design that would really cause a problem, except - * for crashing drivers not written to expect it. And having developed - * drivers for the WL11000, I'd say it's quite tricky to write code - * that will successfully deal with a hot unplug. Very odd things - * happen on the I/O side of things. But anyway, be warned. Despite - * that, I've hot-swapped a number of times during debugging and - * driver development for various reasons (stuck WAIT# line after the - * radio card's firmware locks up). - */ - -#define DRIVER_NAME "orinoco_plx" -#define PFX DRIVER_NAME ": " - -#include -#include -#include -#include -#include -#include - -#include "orinoco.h" -#include "orinoco_pci.h" - -#define COR_OFFSET (0x3e0) /* COR attribute offset of Prism2 PC card */ -#define COR_VALUE (COR_LEVEL_REQ | COR_FUNC_ENA) /* Enable PC card with interrupt in level trigger */ -#define COR_RESET (0x80) /* reset bit in the COR register */ -#define PLX_RESET_TIME (500) /* milliseconds */ - -#define PLX_INTCSR 0x4c /* Interrupt Control & Status Register */ -#define PLX_INTCSR_INTEN (1 << 6) /* Interrupt Enable bit */ - -/* - * Do a soft reset of the card using the Configuration Option Register - */ -static int orinoco_plx_cor_reset(struct orinoco_private *priv) -{ - struct hermes *hw = &priv->hw; - struct orinoco_pci_card *card = priv->card; - unsigned long timeout; - u16 reg; - - iowrite8(COR_VALUE | COR_RESET, card->attr_io + COR_OFFSET); - mdelay(1); - - iowrite8(COR_VALUE, card->attr_io + COR_OFFSET); - mdelay(1); - - /* Just in case, wait more until the card is no longer busy */ - timeout = jiffies + (PLX_RESET_TIME * HZ / 1000); - reg = hermes_read_regn(hw, CMD); - while (time_before(jiffies, timeout) && (reg & HERMES_CMD_BUSY)) { - mdelay(1); - reg = hermes_read_regn(hw, CMD); - } - - /* Still busy? */ - if (reg & HERMES_CMD_BUSY) { - printk(KERN_ERR PFX "Busy timeout\n"); - return -ETIMEDOUT; - } - - return 0; -} - -static int orinoco_plx_hw_init(struct orinoco_pci_card *card) -{ - int i; - u32 csr_reg; - static const u8 cis_magic[] = { - 0x01, 0x03, 0x00, 0x00, 0xff, 0x17, 0x04, 0x67 - }; - - printk(KERN_DEBUG PFX "CIS: "); - for (i = 0; i < 16; i++) - printk("%02X:", ioread8(card->attr_io + (i << 1))); - printk("\n"); - - /* Verify whether a supported PC card is present */ - /* FIXME: we probably need to be smarted about this */ - for (i = 0; i < sizeof(cis_magic); i++) { - if (cis_magic[i] != ioread8(card->attr_io + (i << 1))) { - printk(KERN_ERR PFX "The CIS value of Prism2 PC " - "card is unexpected\n"); - return -ENODEV; - } - } - - /* bjoern: We need to tell the card to enable interrupts, in - case the serial eprom didn't do this already. See the - PLX9052 data book, p8-1 and 8-24 for reference. */ - csr_reg = ioread32(card->bridge_io + PLX_INTCSR); - if (!(csr_reg & PLX_INTCSR_INTEN)) { - csr_reg |= PLX_INTCSR_INTEN; - iowrite32(csr_reg, card->bridge_io + PLX_INTCSR); - csr_reg = ioread32(card->bridge_io + PLX_INTCSR); - if (!(csr_reg & PLX_INTCSR_INTEN)) { - printk(KERN_ERR PFX "Cannot enable interrupts\n"); - return -EIO; - } - } - - return 0; -} - -static int orinoco_plx_init_one(struct pci_dev *pdev, - const struct pci_device_id *ent) -{ - int err; - struct orinoco_private *priv; - struct orinoco_pci_card *card; - void __iomem *hermes_io, *attr_io, *bridge_io; - - err = pci_enable_device(pdev); - if (err) { - printk(KERN_ERR PFX "Cannot enable PCI device\n"); - return err; - } - - err = pci_request_regions(pdev, DRIVER_NAME); - if (err) { - printk(KERN_ERR PFX "Cannot obtain PCI resources\n"); - goto fail_resources; - } - - bridge_io = pci_iomap(pdev, 1, 0); - if (!bridge_io) { - printk(KERN_ERR PFX "Cannot map bridge registers\n"); - err = -EIO; - goto fail_map_bridge; - } - - attr_io = pci_iomap(pdev, 2, 0); - if (!attr_io) { - printk(KERN_ERR PFX "Cannot map PCMCIA attributes\n"); - err = -EIO; - goto fail_map_attr; - } - - hermes_io = pci_iomap(pdev, 3, 0); - if (!hermes_io) { - printk(KERN_ERR PFX "Cannot map chipset registers\n"); - err = -EIO; - goto fail_map_hermes; - } - - /* Allocate network device */ - priv = alloc_orinocodev(sizeof(*card), &pdev->dev, - orinoco_plx_cor_reset, NULL); - if (!priv) { - printk(KERN_ERR PFX "Cannot allocate network device\n"); - err = -ENOMEM; - goto fail_alloc; - } - - card = priv->card; - card->bridge_io = bridge_io; - card->attr_io = attr_io; - - hermes_struct_init(&priv->hw, hermes_io, HERMES_16BIT_REGSPACING); - - err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED, - DRIVER_NAME, priv); - if (err) { - printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); - err = -EBUSY; - goto fail_irq; - } - - err = orinoco_plx_hw_init(card); - if (err) { - printk(KERN_ERR PFX "Hardware initialization failed\n"); - goto fail; - } - - err = orinoco_plx_cor_reset(priv); - if (err) { - printk(KERN_ERR PFX "Initial reset failed\n"); - goto fail; - } - - err = orinoco_init(priv); - if (err) { - printk(KERN_ERR PFX "orinoco_init() failed\n"); - goto fail; - } - - err = orinoco_if_add(priv, 0, 0, NULL); - if (err) { - printk(KERN_ERR PFX "orinoco_if_add() failed\n"); - goto fail; - } - - pci_set_drvdata(pdev, priv); - - return 0; - - fail: - free_irq(pdev->irq, priv); - - fail_irq: - pci_set_drvdata(pdev, NULL); - free_orinocodev(priv); - - fail_alloc: - pci_iounmap(pdev, hermes_io); - - fail_map_hermes: - pci_iounmap(pdev, attr_io); - - fail_map_attr: - pci_iounmap(pdev, bridge_io); - - fail_map_bridge: - pci_release_regions(pdev); - - fail_resources: - pci_disable_device(pdev); - - return err; -} - -static void orinoco_plx_remove_one(struct pci_dev *pdev) -{ - struct orinoco_private *priv = pci_get_drvdata(pdev); - struct orinoco_pci_card *card = priv->card; - - orinoco_if_del(priv); - free_irq(pdev->irq, priv); - pci_set_drvdata(pdev, NULL); - free_orinocodev(priv); - pci_iounmap(pdev, priv->hw.iobase); - pci_iounmap(pdev, card->attr_io); - pci_iounmap(pdev, card->bridge_io); - pci_release_regions(pdev); - pci_disable_device(pdev); -} - -static DEFINE_PCI_DEVICE_TABLE(orinoco_plx_id_table) = { - {0x111a, 0x1023, PCI_ANY_ID, PCI_ANY_ID,}, /* Siemens SpeedStream SS1023 */ - {0x1385, 0x4100, PCI_ANY_ID, PCI_ANY_ID,}, /* Netgear MA301 */ - {0x15e8, 0x0130, PCI_ANY_ID, PCI_ANY_ID,}, /* Correga - does this work? */ - {0x1638, 0x1100, PCI_ANY_ID, PCI_ANY_ID,}, /* SMC EZConnect SMC2602W, - Eumitcom PCI WL11000, - Addtron AWA-100 */ - {0x16ab, 0x1100, PCI_ANY_ID, PCI_ANY_ID,}, /* Global Sun Tech GL24110P */ - {0x16ab, 0x1101, PCI_ANY_ID, PCI_ANY_ID,}, /* Reported working, but unknown */ - {0x16ab, 0x1102, PCI_ANY_ID, PCI_ANY_ID,}, /* Linksys WDT11 */ - {0x16ec, 0x3685, PCI_ANY_ID, PCI_ANY_ID,}, /* USR 2415 */ - {0xec80, 0xec00, PCI_ANY_ID, PCI_ANY_ID,}, /* Belkin F5D6000 tested by - Brendan W. McAdams */ - {0x10b7, 0x7770, PCI_ANY_ID, PCI_ANY_ID,}, /* 3Com AirConnect PCI tested by - Damien Persohn */ - {0,}, -}; - -MODULE_DEVICE_TABLE(pci, orinoco_plx_id_table); - -static struct pci_driver orinoco_plx_driver = { - .name = DRIVER_NAME, - .id_table = orinoco_plx_id_table, - .probe = orinoco_plx_init_one, - .remove = orinoco_plx_remove_one, - .suspend = orinoco_pci_suspend, - .resume = orinoco_pci_resume, -}; - -static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION - " (Pavel Roskin ," - " David Gibson ," - " Daniel Barlow )"; -MODULE_AUTHOR("Daniel Barlow "); -MODULE_DESCRIPTION("Driver for wireless LAN cards using the PLX9052 PCI bridge"); -MODULE_LICENSE("Dual MPL/GPL"); - -static int __init orinoco_plx_init(void) -{ - printk(KERN_DEBUG "%s\n", version); - return pci_register_driver(&orinoco_plx_driver); -} - -static void __exit orinoco_plx_exit(void) -{ - pci_unregister_driver(&orinoco_plx_driver); -} - -module_init(orinoco_plx_init); -module_exit(orinoco_plx_exit); - -/* - * Local variables: - * c-indent-level: 8 - * c-basic-offset: 8 - * tab-width: 8 - * End: - */ diff --git a/drivers/net/wireless/orinoco/orinoco_tmd.c b/drivers/net/wireless/orinoco/orinoco_tmd.c deleted file mode 100644 index 42afeeea2c40..000000000000 --- a/drivers/net/wireless/orinoco/orinoco_tmd.c +++ /dev/null @@ -1,248 +0,0 @@ -/* orinoco_tmd.c - * - * Driver for Prism II devices which would usually be driven by orinoco_cs, - * but are connected to the PCI bus by a TMD7160. - * - * Copyright (C) 2003 Joerg Dorchain - * based heavily upon orinoco_plx.c Copyright (C) 2001 Daniel Barlow - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License version 2 (the "GPL"), in - * which case the provisions of the GPL are applicable instead of the - * above. If you wish to allow the use of your version of this file - * only under the terms of the GPL and not to allow others to use your - * version of this file under the MPL, indicate your decision by - * deleting the provisions above and replace them with the notice and - * other provisions required by the GPL. If you do not delete the - * provisions above, a recipient may use your version of this file - * under either the MPL or the GPL. - * - * The actual driving is done by main.c, this is just resource - * allocation stuff. - * - * This driver is modeled after the orinoco_plx driver. The main - * difference is that the TMD chip has only IO port ranges and doesn't - * provide access to the PCMCIA attribute space. - * - * Pheecom sells cards with the TMD chip as "ASIC version" - */ - -#define DRIVER_NAME "orinoco_tmd" -#define PFX DRIVER_NAME ": " - -#include -#include -#include -#include -#include -#include - -#include "orinoco.h" -#include "orinoco_pci.h" - -#define COR_VALUE (COR_LEVEL_REQ | COR_FUNC_ENA) /* Enable PC card with interrupt in level trigger */ -#define COR_RESET (0x80) /* reset bit in the COR register */ -#define TMD_RESET_TIME (500) /* milliseconds */ - -/* - * Do a soft reset of the card using the Configuration Option Register - */ -static int orinoco_tmd_cor_reset(struct orinoco_private *priv) -{ - struct hermes *hw = &priv->hw; - struct orinoco_pci_card *card = priv->card; - unsigned long timeout; - u16 reg; - - iowrite8(COR_VALUE | COR_RESET, card->bridge_io); - mdelay(1); - - iowrite8(COR_VALUE, card->bridge_io); - mdelay(1); - - /* Just in case, wait more until the card is no longer busy */ - timeout = jiffies + (TMD_RESET_TIME * HZ / 1000); - reg = hermes_read_regn(hw, CMD); - while (time_before(jiffies, timeout) && (reg & HERMES_CMD_BUSY)) { - mdelay(1); - reg = hermes_read_regn(hw, CMD); - } - - /* Still busy? */ - if (reg & HERMES_CMD_BUSY) { - printk(KERN_ERR PFX "Busy timeout\n"); - return -ETIMEDOUT; - } - - return 0; -} - - -static int orinoco_tmd_init_one(struct pci_dev *pdev, - const struct pci_device_id *ent) -{ - int err; - struct orinoco_private *priv; - struct orinoco_pci_card *card; - void __iomem *hermes_io, *bridge_io; - - err = pci_enable_device(pdev); - if (err) { - printk(KERN_ERR PFX "Cannot enable PCI device\n"); - return err; - } - - err = pci_request_regions(pdev, DRIVER_NAME); - if (err) { - printk(KERN_ERR PFX "Cannot obtain PCI resources\n"); - goto fail_resources; - } - - bridge_io = pci_iomap(pdev, 1, 0); - if (!bridge_io) { - printk(KERN_ERR PFX "Cannot map bridge registers\n"); - err = -EIO; - goto fail_map_bridge; - } - - hermes_io = pci_iomap(pdev, 2, 0); - if (!hermes_io) { - printk(KERN_ERR PFX "Cannot map chipset registers\n"); - err = -EIO; - goto fail_map_hermes; - } - - /* Allocate network device */ - priv = alloc_orinocodev(sizeof(*card), &pdev->dev, - orinoco_tmd_cor_reset, NULL); - if (!priv) { - printk(KERN_ERR PFX "Cannot allocate network device\n"); - err = -ENOMEM; - goto fail_alloc; - } - - card = priv->card; - card->bridge_io = bridge_io; - - hermes_struct_init(&priv->hw, hermes_io, HERMES_16BIT_REGSPACING); - - err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED, - DRIVER_NAME, priv); - if (err) { - printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); - err = -EBUSY; - goto fail_irq; - } - - err = orinoco_tmd_cor_reset(priv); - if (err) { - printk(KERN_ERR PFX "Initial reset failed\n"); - goto fail; - } - - err = orinoco_init(priv); - if (err) { - printk(KERN_ERR PFX "orinoco_init() failed\n"); - goto fail; - } - - err = orinoco_if_add(priv, 0, 0, NULL); - if (err) { - printk(KERN_ERR PFX "orinoco_if_add() failed\n"); - goto fail; - } - - pci_set_drvdata(pdev, priv); - - return 0; - - fail: - free_irq(pdev->irq, priv); - - fail_irq: - pci_set_drvdata(pdev, NULL); - free_orinocodev(priv); - - fail_alloc: - pci_iounmap(pdev, hermes_io); - - fail_map_hermes: - pci_iounmap(pdev, bridge_io); - - fail_map_bridge: - pci_release_regions(pdev); - - fail_resources: - pci_disable_device(pdev); - - return err; -} - -static void orinoco_tmd_remove_one(struct pci_dev *pdev) -{ - struct orinoco_private *priv = pci_get_drvdata(pdev); - struct orinoco_pci_card *card = priv->card; - - orinoco_if_del(priv); - free_irq(pdev->irq, priv); - pci_set_drvdata(pdev, NULL); - free_orinocodev(priv); - pci_iounmap(pdev, priv->hw.iobase); - pci_iounmap(pdev, card->bridge_io); - pci_release_regions(pdev); - pci_disable_device(pdev); -} - -static DEFINE_PCI_DEVICE_TABLE(orinoco_tmd_id_table) = { - {0x15e8, 0x0131, PCI_ANY_ID, PCI_ANY_ID,}, /* NDC and OEMs, e.g. pheecom */ - {0,}, -}; - -MODULE_DEVICE_TABLE(pci, orinoco_tmd_id_table); - -static struct pci_driver orinoco_tmd_driver = { - .name = DRIVER_NAME, - .id_table = orinoco_tmd_id_table, - .probe = orinoco_tmd_init_one, - .remove = orinoco_tmd_remove_one, - .suspend = orinoco_pci_suspend, - .resume = orinoco_pci_resume, -}; - -static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION - " (Joerg Dorchain )"; -MODULE_AUTHOR("Joerg Dorchain "); -MODULE_DESCRIPTION("Driver for wireless LAN cards using the TMD7160 PCI bridge"); -MODULE_LICENSE("Dual MPL/GPL"); - -static int __init orinoco_tmd_init(void) -{ - printk(KERN_DEBUG "%s\n", version); - return pci_register_driver(&orinoco_tmd_driver); -} - -static void __exit orinoco_tmd_exit(void) -{ - pci_unregister_driver(&orinoco_tmd_driver); -} - -module_init(orinoco_tmd_init); -module_exit(orinoco_tmd_exit); - -/* - * Local variables: - * c-indent-level: 8 - * c-basic-offset: 8 - * tab-width: 8 - * End: - */ diff --git a/drivers/net/wireless/orinoco/orinoco_usb.c b/drivers/net/wireless/orinoco/orinoco_usb.c deleted file mode 100644 index 1f9cb55c3360..000000000000 --- a/drivers/net/wireless/orinoco/orinoco_usb.c +++ /dev/null @@ -1,1768 +0,0 @@ -/* - * USB Orinoco driver - * - * Copyright (c) 2003 Manuel Estrada Sainz - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License version 2 (the "GPL"), in - * which case the provisions of the GPL are applicable instead of the - * above. If you wish to allow the use of your version of this file - * only under the terms of the GPL and not to allow others to use your - * version of this file under the MPL, indicate your decision by - * deleting the provisions above and replace them with the notice and - * other provisions required by the GPL. If you do not delete the - * provisions above, a recipient may use your version of this file - * under either the MPL or the GPL. - * - * Queueing code based on linux-wlan-ng 0.2.1-pre5 - * - * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. - * - * The license is the same as above. - * - * Initialy based on USB Skeleton driver - 0.7 - * - * Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * NOTE: The original USB Skeleton driver is GPL, but all that code is - * gone so MPL/GPL applies. - */ - -#define DRIVER_NAME "orinoco_usb" -#define PFX DRIVER_NAME ": " - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "mic.h" -#include "orinoco.h" - -#ifndef URB_ASYNC_UNLINK -#define URB_ASYNC_UNLINK 0 -#endif - -/* 802.2 LLC/SNAP header used for Ethernet encapsulation over 802.11 */ -static const u8 encaps_hdr[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; -#define ENCAPS_OVERHEAD (sizeof(encaps_hdr) + 2) - -struct header_struct { - /* 802.3 */ - u8 dest[ETH_ALEN]; - u8 src[ETH_ALEN]; - __be16 len; - /* 802.2 */ - u8 dsap; - u8 ssap; - u8 ctrl; - /* SNAP */ - u8 oui[3]; - __be16 ethertype; -} __packed; - -struct ez_usb_fw { - u16 size; - const u8 *code; -}; - -static struct ez_usb_fw firmware = { - .size = 0, - .code = NULL, -}; - -#ifdef CONFIG_USB_DEBUG -static int debug = 1; -#else -static int debug; -#endif - -/* Debugging macros */ -#undef dbg -#define dbg(format, arg...) \ - do { if (debug) printk(KERN_DEBUG PFX "%s: " format "\n", \ - __func__ , ## arg); } while (0) -#undef err -#define err(format, arg...) \ - do { printk(KERN_ERR PFX format "\n", ## arg); } while (0) - -/* Module paramaters */ -module_param(debug, int, 0644); -MODULE_PARM_DESC(debug, "Debug enabled or not"); - -MODULE_FIRMWARE("orinoco_ezusb_fw"); - -/* - * Under some conditions, the card gets stuck and stops paying attention - * to the world (i.e. data communication stalls) until we do something to - * it. Sending an INQ_TALLIES command seems to be enough and should be - * harmless otherwise. This behaviour has been observed when using the - * driver on a systemimager client during installation. In the past a - * timer was used to send INQ_TALLIES commands when there was no other - * activity, but it was troublesome and was removed. - */ - -#define USB_COMPAQ_VENDOR_ID 0x049f /* Compaq Computer Corp. */ -#define USB_COMPAQ_WL215_ID 0x001f /* Compaq WL215 USB Adapter */ -#define USB_COMPAQ_W200_ID 0x0076 /* Compaq W200 USB Adapter */ -#define USB_HP_WL215_ID 0x0082 /* Compaq WL215 USB Adapter */ - -#define USB_MELCO_VENDOR_ID 0x0411 -#define USB_BUFFALO_L11_ID 0x0006 /* BUFFALO WLI-USB-L11 */ -#define USB_BUFFALO_L11G_WR_ID 0x000B /* BUFFALO WLI-USB-L11G-WR */ -#define USB_BUFFALO_L11G_ID 0x000D /* BUFFALO WLI-USB-L11G */ - -#define USB_LUCENT_VENDOR_ID 0x047E /* Lucent Technologies */ -#define USB_LUCENT_ORINOCO_ID 0x0300 /* Lucent/Agere Orinoco USB Client */ - -#define USB_AVAYA8_VENDOR_ID 0x0D98 -#define USB_AVAYAE_VENDOR_ID 0x0D9E -#define USB_AVAYA_WIRELESS_ID 0x0300 /* Avaya Wireless USB Card */ - -#define USB_AGERE_VENDOR_ID 0x0D4E /* Agere Systems */ -#define USB_AGERE_MODEL0801_ID 0x1000 /* Wireless USB Card Model 0801 */ -#define USB_AGERE_MODEL0802_ID 0x1001 /* Wireless USB Card Model 0802 */ -#define USB_AGERE_REBRANDED_ID 0x047A /* WLAN USB Card */ - -#define USB_ELSA_VENDOR_ID 0x05CC -#define USB_ELSA_AIRLANCER_ID 0x3100 /* ELSA AirLancer USB-11 */ - -#define USB_LEGEND_VENDOR_ID 0x0E7C -#define USB_LEGEND_JOYNET_ID 0x0300 /* Joynet WLAN USB Card */ - -#define USB_SAMSUNG_VENDOR_ID 0x04E8 -#define USB_SAMSUNG_SEW2001U1_ID 0x5002 /* Samsung SEW-2001u Card */ -#define USB_SAMSUNG_SEW2001U2_ID 0x5B11 /* Samsung SEW-2001u Card */ -#define USB_SAMSUNG_SEW2003U_ID 0x7011 /* Samsung SEW-2003U Card */ - -#define USB_IGATE_VENDOR_ID 0x0681 -#define USB_IGATE_IGATE_11M_ID 0x0012 /* I-GATE 11M USB Card */ - -#define USB_FUJITSU_VENDOR_ID 0x0BF8 -#define USB_FUJITSU_E1100_ID 0x1002 /* connect2AIR WLAN E-1100 USB */ - -#define USB_2WIRE_VENDOR_ID 0x1630 -#define USB_2WIRE_WIRELESS_ID 0xff81 /* 2Wire Wireless USB adapter */ - - -#define EZUSB_REQUEST_FW_TRANS 0xA0 -#define EZUSB_REQUEST_TRIGER 0xAA -#define EZUSB_REQUEST_TRIG_AC 0xAC -#define EZUSB_CPUCS_REG 0x7F92 - -#define EZUSB_RID_TX 0x0700 -#define EZUSB_RID_RX 0x0701 -#define EZUSB_RID_INIT1 0x0702 -#define EZUSB_RID_ACK 0x0710 -#define EZUSB_RID_READ_PDA 0x0800 -#define EZUSB_RID_PROG_INIT 0x0852 -#define EZUSB_RID_PROG_SET_ADDR 0x0853 -#define EZUSB_RID_PROG_BYTES 0x0854 -#define EZUSB_RID_PROG_END 0x0855 -#define EZUSB_RID_DOCMD 0x0860 - -/* Recognize info frames */ -#define EZUSB_IS_INFO(id) ((id >= 0xF000) && (id <= 0xF2FF)) - -#define EZUSB_MAGIC 0x0210 - -#define EZUSB_FRAME_DATA 1 -#define EZUSB_FRAME_CONTROL 2 - -#define DEF_TIMEOUT (3 * HZ) - -#define BULK_BUF_SIZE 2048 - -#define MAX_DL_SIZE (BULK_BUF_SIZE - sizeof(struct ezusb_packet)) - -#define FW_BUF_SIZE 64 -#define FW_VAR_OFFSET_PTR 0x359 -#define FW_VAR_VALUE 0 -#define FW_HOLE_START 0x100 -#define FW_HOLE_END 0x300 - -struct ezusb_packet { - __le16 magic; /* 0x0210 */ - u8 req_reply_count; - u8 ans_reply_count; - __le16 frame_type; /* 0x01 for data frames, 0x02 otherwise */ - __le16 size; /* transport size */ - __le16 crc; /* CRC up to here */ - __le16 hermes_len; - __le16 hermes_rid; - u8 data[0]; -} __packed; - -/* Table of devices that work or may work with this driver */ -static struct usb_device_id ezusb_table[] = { - {USB_DEVICE(USB_COMPAQ_VENDOR_ID, USB_COMPAQ_WL215_ID)}, - {USB_DEVICE(USB_COMPAQ_VENDOR_ID, USB_HP_WL215_ID)}, - {USB_DEVICE(USB_COMPAQ_VENDOR_ID, USB_COMPAQ_W200_ID)}, - {USB_DEVICE(USB_MELCO_VENDOR_ID, USB_BUFFALO_L11_ID)}, - {USB_DEVICE(USB_MELCO_VENDOR_ID, USB_BUFFALO_L11G_WR_ID)}, - {USB_DEVICE(USB_MELCO_VENDOR_ID, USB_BUFFALO_L11G_ID)}, - {USB_DEVICE(USB_LUCENT_VENDOR_ID, USB_LUCENT_ORINOCO_ID)}, - {USB_DEVICE(USB_AVAYA8_VENDOR_ID, USB_AVAYA_WIRELESS_ID)}, - {USB_DEVICE(USB_AVAYAE_VENDOR_ID, USB_AVAYA_WIRELESS_ID)}, - {USB_DEVICE(USB_AGERE_VENDOR_ID, USB_AGERE_MODEL0801_ID)}, - {USB_DEVICE(USB_AGERE_VENDOR_ID, USB_AGERE_MODEL0802_ID)}, - {USB_DEVICE(USB_ELSA_VENDOR_ID, USB_ELSA_AIRLANCER_ID)}, - {USB_DEVICE(USB_LEGEND_VENDOR_ID, USB_LEGEND_JOYNET_ID)}, - {USB_DEVICE_VER(USB_SAMSUNG_VENDOR_ID, USB_SAMSUNG_SEW2001U1_ID, - 0, 0)}, - {USB_DEVICE(USB_SAMSUNG_VENDOR_ID, USB_SAMSUNG_SEW2001U2_ID)}, - {USB_DEVICE(USB_SAMSUNG_VENDOR_ID, USB_SAMSUNG_SEW2003U_ID)}, - {USB_DEVICE(USB_IGATE_VENDOR_ID, USB_IGATE_IGATE_11M_ID)}, - {USB_DEVICE(USB_FUJITSU_VENDOR_ID, USB_FUJITSU_E1100_ID)}, - {USB_DEVICE(USB_2WIRE_VENDOR_ID, USB_2WIRE_WIRELESS_ID)}, - {USB_DEVICE(USB_AGERE_VENDOR_ID, USB_AGERE_REBRANDED_ID)}, - {} /* Terminating entry */ -}; - -MODULE_DEVICE_TABLE(usb, ezusb_table); - -/* Structure to hold all of our device specific stuff */ -struct ezusb_priv { - struct usb_device *udev; - struct net_device *dev; - struct mutex mtx; - spinlock_t req_lock; - struct list_head req_pending; - struct list_head req_active; - spinlock_t reply_count_lock; - u16 hermes_reg_fake[0x40]; - u8 *bap_buf; - struct urb *read_urb; - int read_pipe; - int write_pipe; - u8 reply_count; -}; - -enum ezusb_state { - EZUSB_CTX_START, - EZUSB_CTX_QUEUED, - EZUSB_CTX_REQ_SUBMITTED, - EZUSB_CTX_REQ_COMPLETE, - EZUSB_CTX_RESP_RECEIVED, - EZUSB_CTX_REQ_TIMEOUT, - EZUSB_CTX_REQ_FAILED, - EZUSB_CTX_RESP_TIMEOUT, - EZUSB_CTX_REQSUBMIT_FAIL, - EZUSB_CTX_COMPLETE, -}; - -struct request_context { - struct list_head list; - atomic_t refcount; - struct completion done; /* Signals that CTX is dead */ - int killed; - struct urb *outurb; /* OUT for req pkt */ - struct ezusb_priv *upriv; - struct ezusb_packet *buf; - int buf_length; - struct timer_list timer; /* Timeout handling */ - enum ezusb_state state; /* Current state */ - /* the RID that we will wait for */ - u16 out_rid; - u16 in_rid; -}; - - -/* Forward declarations */ -static void ezusb_ctx_complete(struct request_context *ctx); -static void ezusb_req_queue_run(struct ezusb_priv *upriv); -static void ezusb_bulk_in_callback(struct urb *urb); - -static inline u8 ezusb_reply_inc(u8 count) -{ - if (count < 0x7F) - return count + 1; - else - return 1; -} - -static void ezusb_request_context_put(struct request_context *ctx) -{ - if (!atomic_dec_and_test(&ctx->refcount)) - return; - - WARN_ON(!ctx->done.done); - BUG_ON(ctx->outurb->status == -EINPROGRESS); - BUG_ON(timer_pending(&ctx->timer)); - usb_free_urb(ctx->outurb); - kfree(ctx->buf); - kfree(ctx); -} - -static inline void ezusb_mod_timer(struct ezusb_priv *upriv, - struct timer_list *timer, - unsigned long expire) -{ - if (!upriv->udev) - return; - mod_timer(timer, expire); -} - -static void ezusb_request_timerfn(u_long _ctx) -{ - struct request_context *ctx = (void *) _ctx; - - ctx->outurb->transfer_flags |= URB_ASYNC_UNLINK; - if (usb_unlink_urb(ctx->outurb) == -EINPROGRESS) { - ctx->state = EZUSB_CTX_REQ_TIMEOUT; - } else { - ctx->state = EZUSB_CTX_RESP_TIMEOUT; - dbg("couldn't unlink"); - atomic_inc(&ctx->refcount); - ctx->killed = 1; - ezusb_ctx_complete(ctx); - ezusb_request_context_put(ctx); - } -}; - -static struct request_context *ezusb_alloc_ctx(struct ezusb_priv *upriv, - u16 out_rid, u16 in_rid) -{ - struct request_context *ctx; - - ctx = kzalloc(sizeof(*ctx), GFP_ATOMIC); - if (!ctx) - return NULL; - - ctx->buf = kmalloc(BULK_BUF_SIZE, GFP_ATOMIC); - if (!ctx->buf) { - kfree(ctx); - return NULL; - } - ctx->outurb = usb_alloc_urb(0, GFP_ATOMIC); - if (!ctx->outurb) { - kfree(ctx->buf); - kfree(ctx); - return NULL; - } - - ctx->upriv = upriv; - ctx->state = EZUSB_CTX_START; - ctx->out_rid = out_rid; - ctx->in_rid = in_rid; - - atomic_set(&ctx->refcount, 1); - init_completion(&ctx->done); - - init_timer(&ctx->timer); - ctx->timer.function = ezusb_request_timerfn; - ctx->timer.data = (u_long) ctx; - return ctx; -} - - -/* Hopefully the real complete_all will soon be exported, in the mean - * while this should work. */ -static inline void ezusb_complete_all(struct completion *comp) -{ - complete(comp); - complete(comp); - complete(comp); - complete(comp); -} - -static void ezusb_ctx_complete(struct request_context *ctx) -{ - struct ezusb_priv *upriv = ctx->upriv; - unsigned long flags; - - spin_lock_irqsave(&upriv->req_lock, flags); - - list_del_init(&ctx->list); - if (upriv->udev) { - spin_unlock_irqrestore(&upriv->req_lock, flags); - ezusb_req_queue_run(upriv); - spin_lock_irqsave(&upriv->req_lock, flags); - } - - switch (ctx->state) { - case EZUSB_CTX_COMPLETE: - case EZUSB_CTX_REQSUBMIT_FAIL: - case EZUSB_CTX_REQ_FAILED: - case EZUSB_CTX_REQ_TIMEOUT: - case EZUSB_CTX_RESP_TIMEOUT: - spin_unlock_irqrestore(&upriv->req_lock, flags); - - if ((ctx->out_rid == EZUSB_RID_TX) && upriv->dev) { - struct net_device *dev = upriv->dev; - struct orinoco_private *priv = ndev_priv(dev); - struct net_device_stats *stats = &priv->stats; - - if (ctx->state != EZUSB_CTX_COMPLETE) - stats->tx_errors++; - else - stats->tx_packets++; - - netif_wake_queue(dev); - } - ezusb_complete_all(&ctx->done); - ezusb_request_context_put(ctx); - break; - - default: - spin_unlock_irqrestore(&upriv->req_lock, flags); - if (!upriv->udev) { - /* This is normal, as all request contexts get flushed - * when the device is disconnected */ - err("Called, CTX not terminating, but device gone"); - ezusb_complete_all(&ctx->done); - ezusb_request_context_put(ctx); - break; - } - - err("Called, CTX not in terminating state."); - /* Things are really bad if this happens. Just leak - * the CTX because it may still be linked to the - * queue or the OUT urb may still be active. - * Just leaking at least prevents an Oops or Panic. - */ - break; - } -} - -/** - * ezusb_req_queue_run: - * Description: - * Note: Only one active CTX at any one time, because there's no - * other (reliable) way to match the response URB to the correct - * CTX. - **/ -static void ezusb_req_queue_run(struct ezusb_priv *upriv) -{ - unsigned long flags; - struct request_context *ctx; - int result; - - spin_lock_irqsave(&upriv->req_lock, flags); - - if (!list_empty(&upriv->req_active)) - goto unlock; - - if (list_empty(&upriv->req_pending)) - goto unlock; - - ctx = - list_entry(upriv->req_pending.next, struct request_context, - list); - - if (!ctx->upriv->udev) - goto unlock; - - /* We need to split this off to avoid a race condition */ - list_move_tail(&ctx->list, &upriv->req_active); - - if (ctx->state == EZUSB_CTX_QUEUED) { - atomic_inc(&ctx->refcount); - result = usb_submit_urb(ctx->outurb, GFP_ATOMIC); - if (result) { - ctx->state = EZUSB_CTX_REQSUBMIT_FAIL; - - spin_unlock_irqrestore(&upriv->req_lock, flags); - - err("Fatal, failed to submit command urb." - " error=%d\n", result); - - ezusb_ctx_complete(ctx); - ezusb_request_context_put(ctx); - goto done; - } - - ctx->state = EZUSB_CTX_REQ_SUBMITTED; - ezusb_mod_timer(ctx->upriv, &ctx->timer, - jiffies + DEF_TIMEOUT); - } - - unlock: - spin_unlock_irqrestore(&upriv->req_lock, flags); - - done: - return; -} - -static void ezusb_req_enqueue_run(struct ezusb_priv *upriv, - struct request_context *ctx) -{ - unsigned long flags; - - spin_lock_irqsave(&upriv->req_lock, flags); - - if (!ctx->upriv->udev) { - spin_unlock_irqrestore(&upriv->req_lock, flags); - goto done; - } - atomic_inc(&ctx->refcount); - list_add_tail(&ctx->list, &upriv->req_pending); - spin_unlock_irqrestore(&upriv->req_lock, flags); - - ctx->state = EZUSB_CTX_QUEUED; - ezusb_req_queue_run(upriv); - - done: - return; -} - -static void ezusb_request_out_callback(struct urb *urb) -{ - unsigned long flags; - enum ezusb_state state; - struct request_context *ctx = urb->context; - struct ezusb_priv *upriv = ctx->upriv; - - spin_lock_irqsave(&upriv->req_lock, flags); - - del_timer(&ctx->timer); - - if (ctx->killed) { - spin_unlock_irqrestore(&upriv->req_lock, flags); - pr_warning("interrupt called with dead ctx"); - goto out; - } - - state = ctx->state; - - if (urb->status == 0) { - switch (state) { - case EZUSB_CTX_REQ_SUBMITTED: - if (ctx->in_rid) { - ctx->state = EZUSB_CTX_REQ_COMPLETE; - /* reply URB still pending */ - ezusb_mod_timer(upriv, &ctx->timer, - jiffies + DEF_TIMEOUT); - spin_unlock_irqrestore(&upriv->req_lock, - flags); - break; - } - /* fall through */ - case EZUSB_CTX_RESP_RECEIVED: - /* IN already received before this OUT-ACK */ - ctx->state = EZUSB_CTX_COMPLETE; - spin_unlock_irqrestore(&upriv->req_lock, flags); - ezusb_ctx_complete(ctx); - break; - - default: - spin_unlock_irqrestore(&upriv->req_lock, flags); - err("Unexpected state(0x%x, %d) in OUT URB", - state, urb->status); - break; - } - } else { - /* If someone cancels the OUT URB then its status - * should be either -ECONNRESET or -ENOENT. - */ - switch (state) { - case EZUSB_CTX_REQ_SUBMITTED: - case EZUSB_CTX_RESP_RECEIVED: - ctx->state = EZUSB_CTX_REQ_FAILED; - /* fall through */ - - case EZUSB_CTX_REQ_FAILED: - case EZUSB_CTX_REQ_TIMEOUT: - spin_unlock_irqrestore(&upriv->req_lock, flags); - - ezusb_ctx_complete(ctx); - break; - - default: - spin_unlock_irqrestore(&upriv->req_lock, flags); - - err("Unexpected state(0x%x, %d) in OUT URB", - state, urb->status); - break; - } - } - out: - ezusb_request_context_put(ctx); -} - -static void ezusb_request_in_callback(struct ezusb_priv *upriv, - struct urb *urb) -{ - struct ezusb_packet *ans = urb->transfer_buffer; - struct request_context *ctx = NULL; - enum ezusb_state state; - unsigned long flags; - - /* Find the CTX on the active queue that requested this URB */ - spin_lock_irqsave(&upriv->req_lock, flags); - if (upriv->udev) { - struct list_head *item; - - list_for_each(item, &upriv->req_active) { - struct request_context *c; - int reply_count; - - c = list_entry(item, struct request_context, list); - reply_count = - ezusb_reply_inc(c->buf->req_reply_count); - if ((ans->ans_reply_count == reply_count) - && (le16_to_cpu(ans->hermes_rid) == c->in_rid)) { - ctx = c; - break; - } - dbg("Skipped (0x%x/0x%x) (%d/%d)", - le16_to_cpu(ans->hermes_rid), - c->in_rid, ans->ans_reply_count, reply_count); - } - } - - if (ctx == NULL) { - spin_unlock_irqrestore(&upriv->req_lock, flags); - err("%s: got unexpected RID: 0x%04X", __func__, - le16_to_cpu(ans->hermes_rid)); - ezusb_req_queue_run(upriv); - return; - } - - /* The data we want is in the in buffer, exchange */ - urb->transfer_buffer = ctx->buf; - ctx->buf = (void *) ans; - ctx->buf_length = urb->actual_length; - - state = ctx->state; - switch (state) { - case EZUSB_CTX_REQ_SUBMITTED: - /* We have received our response URB before - * our request has been acknowledged. Do NOT - * destroy our CTX yet, because our OUT URB - * is still alive ... - */ - ctx->state = EZUSB_CTX_RESP_RECEIVED; - spin_unlock_irqrestore(&upriv->req_lock, flags); - - /* Let the machine continue running. */ - break; - - case EZUSB_CTX_REQ_COMPLETE: - /* This is the usual path: our request - * has already been acknowledged, and - * we have now received the reply. - */ - ctx->state = EZUSB_CTX_COMPLETE; - - /* Stop the intimer */ - del_timer(&ctx->timer); - spin_unlock_irqrestore(&upriv->req_lock, flags); - - /* Call the completion handler */ - ezusb_ctx_complete(ctx); - break; - - default: - spin_unlock_irqrestore(&upriv->req_lock, flags); - - pr_warning("Matched IN URB, unexpected context state(0x%x)", - state); - /* Throw this CTX away and try submitting another */ - del_timer(&ctx->timer); - ctx->outurb->transfer_flags |= URB_ASYNC_UNLINK; - usb_unlink_urb(ctx->outurb); - ezusb_req_queue_run(upriv); - break; - } /* switch */ -} - - -static void ezusb_req_ctx_wait(struct ezusb_priv *upriv, - struct request_context *ctx) -{ - switch (ctx->state) { - case EZUSB_CTX_QUEUED: - case EZUSB_CTX_REQ_SUBMITTED: - case EZUSB_CTX_REQ_COMPLETE: - case EZUSB_CTX_RESP_RECEIVED: - if (in_softirq()) { - /* If we get called from a timer, timeout timers don't - * get the chance to run themselves. So we make sure - * that we don't sleep for ever */ - int msecs = DEF_TIMEOUT * (1000 / HZ); - while (!ctx->done.done && msecs--) - udelay(1000); - } else { - wait_event_interruptible(ctx->done.wait, - ctx->done.done); - } - break; - default: - /* Done or failed - nothing to wait for */ - break; - } -} - -static inline u16 build_crc(struct ezusb_packet *data) -{ - u16 crc = 0; - u8 *bytes = (u8 *)data; - int i; - - for (i = 0; i < 8; i++) - crc = (crc << 1) + bytes[i]; - - return crc; -} - -/** - * ezusb_fill_req: - * - * if data == NULL and length > 0 the data is assumed to be already in - * the target buffer and only the header is filled. - * - */ -static int ezusb_fill_req(struct ezusb_packet *req, u16 length, u16 rid, - const void *data, u16 frame_type, u8 reply_count) -{ - int total_size = sizeof(*req) + length; - - BUG_ON(total_size > BULK_BUF_SIZE); - - req->magic = cpu_to_le16(EZUSB_MAGIC); - req->req_reply_count = reply_count; - req->ans_reply_count = 0; - req->frame_type = cpu_to_le16(frame_type); - req->size = cpu_to_le16(length + 4); - req->crc = cpu_to_le16(build_crc(req)); - req->hermes_len = cpu_to_le16(HERMES_BYTES_TO_RECLEN(length)); - req->hermes_rid = cpu_to_le16(rid); - if (data) - memcpy(req->data, data, length); - return total_size; -} - -static int ezusb_submit_in_urb(struct ezusb_priv *upriv) -{ - int retval = 0; - void *cur_buf = upriv->read_urb->transfer_buffer; - - if (upriv->read_urb->status == -EINPROGRESS) { - dbg("urb busy, not resubmiting"); - retval = -EBUSY; - goto exit; - } - usb_fill_bulk_urb(upriv->read_urb, upriv->udev, upriv->read_pipe, - cur_buf, BULK_BUF_SIZE, - ezusb_bulk_in_callback, upriv); - upriv->read_urb->transfer_flags = 0; - retval = usb_submit_urb(upriv->read_urb, GFP_ATOMIC); - if (retval) - err("%s submit failed %d", __func__, retval); - - exit: - return retval; -} - -static inline int ezusb_8051_cpucs(struct ezusb_priv *upriv, int reset) -{ - u8 res_val = reset; /* avoid argument promotion */ - - if (!upriv->udev) { - err("%s: !upriv->udev", __func__); - return -EFAULT; - } - return usb_control_msg(upriv->udev, - usb_sndctrlpipe(upriv->udev, 0), - EZUSB_REQUEST_FW_TRANS, - USB_TYPE_VENDOR | USB_RECIP_DEVICE | - USB_DIR_OUT, EZUSB_CPUCS_REG, 0, &res_val, - sizeof(res_val), DEF_TIMEOUT); -} - -static int ezusb_firmware_download(struct ezusb_priv *upriv, - struct ez_usb_fw *fw) -{ - u8 *fw_buffer; - int retval, addr; - int variant_offset; - - fw_buffer = kmalloc(FW_BUF_SIZE, GFP_KERNEL); - if (!fw_buffer) { - printk(KERN_ERR PFX "Out of memory for firmware buffer.\n"); - return -ENOMEM; - } - /* - * This byte is 1 and should be replaced with 0. The offset is - * 0x10AD in version 0.0.6. The byte in question should follow - * the end of the code pointed to by the jump in the beginning - * of the firmware. Also, it is read by code located at 0x358. - */ - variant_offset = be16_to_cpup((__be16 *) &fw->code[FW_VAR_OFFSET_PTR]); - if (variant_offset >= fw->size) { - printk(KERN_ERR PFX "Invalid firmware variant offset: " - "0x%04x\n", variant_offset); - retval = -EINVAL; - goto fail; - } - - retval = ezusb_8051_cpucs(upriv, 1); - if (retval < 0) - goto fail; - for (addr = 0; addr < fw->size; addr += FW_BUF_SIZE) { - /* 0x100-0x300 should be left alone, it contains card - * specific data, like USB enumeration information */ - if ((addr >= FW_HOLE_START) && (addr < FW_HOLE_END)) - continue; - - memcpy(fw_buffer, &fw->code[addr], FW_BUF_SIZE); - if (variant_offset >= addr && - variant_offset < addr + FW_BUF_SIZE) { - dbg("Patching card_variant byte at 0x%04X", - variant_offset); - fw_buffer[variant_offset - addr] = FW_VAR_VALUE; - } - retval = usb_control_msg(upriv->udev, - usb_sndctrlpipe(upriv->udev, 0), - EZUSB_REQUEST_FW_TRANS, - USB_TYPE_VENDOR | USB_RECIP_DEVICE - | USB_DIR_OUT, - addr, 0x0, - fw_buffer, FW_BUF_SIZE, - DEF_TIMEOUT); - - if (retval < 0) - goto fail; - } - retval = ezusb_8051_cpucs(upriv, 0); - if (retval < 0) - goto fail; - - goto exit; - fail: - printk(KERN_ERR PFX "Firmware download failed, error %d\n", - retval); - exit: - kfree(fw_buffer); - return retval; -} - -static int ezusb_access_ltv(struct ezusb_priv *upriv, - struct request_context *ctx, - u16 length, const void *data, u16 frame_type, - void *ans_buff, unsigned ans_size, u16 *ans_length) -{ - int req_size; - int retval = 0; - enum ezusb_state state; - - BUG_ON(in_irq()); - - if (!upriv->udev) { - dbg("Device disconnected"); - return -ENODEV; - } - - if (upriv->read_urb->status != -EINPROGRESS) - err("%s: in urb not pending", __func__); - - /* protect upriv->reply_count, guarantee sequential numbers */ - spin_lock_bh(&upriv->reply_count_lock); - req_size = ezusb_fill_req(ctx->buf, length, ctx->out_rid, data, - frame_type, upriv->reply_count); - usb_fill_bulk_urb(ctx->outurb, upriv->udev, upriv->write_pipe, - ctx->buf, req_size, - ezusb_request_out_callback, ctx); - - if (ctx->in_rid) - upriv->reply_count = ezusb_reply_inc(upriv->reply_count); - - ezusb_req_enqueue_run(upriv, ctx); - - spin_unlock_bh(&upriv->reply_count_lock); - - if (ctx->in_rid) - ezusb_req_ctx_wait(upriv, ctx); - - state = ctx->state; - switch (state) { - case EZUSB_CTX_COMPLETE: - retval = ctx->outurb->status; - break; - - case EZUSB_CTX_QUEUED: - case EZUSB_CTX_REQ_SUBMITTED: - if (!ctx->in_rid) - break; - default: - err("%s: Unexpected context state %d", __func__, - state); - /* fall though */ - case EZUSB_CTX_REQ_TIMEOUT: - case EZUSB_CTX_REQ_FAILED: - case EZUSB_CTX_RESP_TIMEOUT: - case EZUSB_CTX_REQSUBMIT_FAIL: - printk(KERN_ERR PFX "Access failed, resetting (state %d," - " reply_count %d)\n", state, upriv->reply_count); - upriv->reply_count = 0; - if (state == EZUSB_CTX_REQ_TIMEOUT - || state == EZUSB_CTX_RESP_TIMEOUT) { - printk(KERN_ERR PFX "ctx timed out\n"); - retval = -ETIMEDOUT; - } else { - printk(KERN_ERR PFX "ctx failed\n"); - retval = -EFAULT; - } - goto exit; - break; - } - if (ctx->in_rid) { - struct ezusb_packet *ans = ctx->buf; - unsigned exp_len; - - if (ans->hermes_len != 0) - exp_len = le16_to_cpu(ans->hermes_len) * 2 + 12; - else - exp_len = 14; - - if (exp_len != ctx->buf_length) { - err("%s: length mismatch for RID 0x%04x: " - "expected %d, got %d", __func__, - ctx->in_rid, exp_len, ctx->buf_length); - retval = -EIO; - goto exit; - } - - if (ans_buff) - memcpy(ans_buff, ans->data, min(exp_len, ans_size)); - if (ans_length) - *ans_length = le16_to_cpu(ans->hermes_len); - } - exit: - ezusb_request_context_put(ctx); - return retval; -} - -static int ezusb_write_ltv(struct hermes *hw, int bap, u16 rid, - u16 length, const void *data) -{ - struct ezusb_priv *upriv = hw->priv; - u16 frame_type; - struct request_context *ctx; - - if (length == 0) - return -EINVAL; - - length = HERMES_RECLEN_TO_BYTES(length); - - /* On memory mapped devices HERMES_RID_CNFGROUPADDRESSES can be - * set to be empty, but the USB bridge doesn't like it */ - if (length == 0) - return 0; - - ctx = ezusb_alloc_ctx(upriv, rid, EZUSB_RID_ACK); - if (!ctx) - return -ENOMEM; - - if (rid == EZUSB_RID_TX) - frame_type = EZUSB_FRAME_DATA; - else - frame_type = EZUSB_FRAME_CONTROL; - - return ezusb_access_ltv(upriv, ctx, length, data, frame_type, - NULL, 0, NULL); -} - -static int ezusb_read_ltv(struct hermes *hw, int bap, u16 rid, - unsigned bufsize, u16 *length, void *buf) -{ - struct ezusb_priv *upriv = hw->priv; - struct request_context *ctx; - - if (bufsize % 2) - return -EINVAL; - - ctx = ezusb_alloc_ctx(upriv, rid, rid); - if (!ctx) - return -ENOMEM; - - return ezusb_access_ltv(upriv, ctx, 0, NULL, EZUSB_FRAME_CONTROL, - buf, bufsize, length); -} - -static int ezusb_doicmd_wait(struct hermes *hw, u16 cmd, u16 parm0, u16 parm1, - u16 parm2, struct hermes_response *resp) -{ - struct ezusb_priv *upriv = hw->priv; - struct request_context *ctx; - - __le16 data[4] = { - cpu_to_le16(cmd), - cpu_to_le16(parm0), - cpu_to_le16(parm1), - cpu_to_le16(parm2), - }; - dbg("0x%04X, parm0 0x%04X, parm1 0x%04X, parm2 0x%04X", - cmd, parm0, parm1, parm2); - ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_DOCMD, EZUSB_RID_ACK); - if (!ctx) - return -ENOMEM; - - return ezusb_access_ltv(upriv, ctx, sizeof(data), &data, - EZUSB_FRAME_CONTROL, NULL, 0, NULL); -} - -static int ezusb_docmd_wait(struct hermes *hw, u16 cmd, u16 parm0, - struct hermes_response *resp) -{ - struct ezusb_priv *upriv = hw->priv; - struct request_context *ctx; - - __le16 data[4] = { - cpu_to_le16(cmd), - cpu_to_le16(parm0), - 0, - 0, - }; - dbg("0x%04X, parm0 0x%04X", cmd, parm0); - ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_DOCMD, EZUSB_RID_ACK); - if (!ctx) - return -ENOMEM; - - return ezusb_access_ltv(upriv, ctx, sizeof(data), &data, - EZUSB_FRAME_CONTROL, NULL, 0, NULL); -} - -static int ezusb_bap_pread(struct hermes *hw, int bap, - void *buf, int len, u16 id, u16 offset) -{ - struct ezusb_priv *upriv = hw->priv; - struct ezusb_packet *ans = (void *) upriv->read_urb->transfer_buffer; - int actual_length = upriv->read_urb->actual_length; - - if (id == EZUSB_RID_RX) { - if ((sizeof(*ans) + offset + len) > actual_length) { - printk(KERN_ERR PFX "BAP read beyond buffer end " - "in rx frame\n"); - return -EINVAL; - } - memcpy(buf, ans->data + offset, len); - return 0; - } - - if (EZUSB_IS_INFO(id)) { - /* Include 4 bytes for length/type */ - if ((sizeof(*ans) + offset + len - 4) > actual_length) { - printk(KERN_ERR PFX "BAP read beyond buffer end " - "in info frame\n"); - return -EFAULT; - } - memcpy(buf, ans->data + offset - 4, len); - } else { - printk(KERN_ERR PFX "Unexpected fid 0x%04x\n", id); - return -EINVAL; - } - - return 0; -} - -static int ezusb_read_pda(struct hermes *hw, __le16 *pda, - u32 pda_addr, u16 pda_len) -{ - struct ezusb_priv *upriv = hw->priv; - struct request_context *ctx; - __le16 data[] = { - cpu_to_le16(pda_addr & 0xffff), - cpu_to_le16(pda_len - 4) - }; - ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_READ_PDA, EZUSB_RID_READ_PDA); - if (!ctx) - return -ENOMEM; - - /* wl_lkm does not include PDA size in the PDA area. - * We will pad the information into pda, so other routines - * don't have to be modified */ - pda[0] = cpu_to_le16(pda_len - 2); - /* Includes CFG_PROD_DATA but not itself */ - pda[1] = cpu_to_le16(0x0800); /* CFG_PROD_DATA */ - - return ezusb_access_ltv(upriv, ctx, sizeof(data), &data, - EZUSB_FRAME_CONTROL, &pda[2], pda_len - 4, - NULL); -} - -static int ezusb_program_init(struct hermes *hw, u32 entry_point) -{ - struct ezusb_priv *upriv = hw->priv; - struct request_context *ctx; - __le32 data = cpu_to_le32(entry_point); - - ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_PROG_INIT, EZUSB_RID_ACK); - if (!ctx) - return -ENOMEM; - - return ezusb_access_ltv(upriv, ctx, sizeof(data), &data, - EZUSB_FRAME_CONTROL, NULL, 0, NULL); -} - -static int ezusb_program_end(struct hermes *hw) -{ - struct ezusb_priv *upriv = hw->priv; - struct request_context *ctx; - - ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_PROG_END, EZUSB_RID_ACK); - if (!ctx) - return -ENOMEM; - - return ezusb_access_ltv(upriv, ctx, 0, NULL, - EZUSB_FRAME_CONTROL, NULL, 0, NULL); -} - -static int ezusb_program_bytes(struct hermes *hw, const char *buf, - u32 addr, u32 len) -{ - struct ezusb_priv *upriv = hw->priv; - struct request_context *ctx; - __le32 data = cpu_to_le32(addr); - int err; - - ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_PROG_SET_ADDR, EZUSB_RID_ACK); - if (!ctx) - return -ENOMEM; - - err = ezusb_access_ltv(upriv, ctx, sizeof(data), &data, - EZUSB_FRAME_CONTROL, NULL, 0, NULL); - if (err) - return err; - - ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_PROG_BYTES, EZUSB_RID_ACK); - if (!ctx) - return -ENOMEM; - - return ezusb_access_ltv(upriv, ctx, len, buf, - EZUSB_FRAME_CONTROL, NULL, 0, NULL); -} - -static int ezusb_program(struct hermes *hw, const char *buf, - u32 addr, u32 len) -{ - u32 ch_addr; - u32 ch_len; - int err = 0; - - /* We can only send 2048 bytes out of the bulk xmit at a time, - * so we have to split any programming into chunks of <2048 - * bytes. */ - - ch_len = (len < MAX_DL_SIZE) ? len : MAX_DL_SIZE; - ch_addr = addr; - - while (ch_addr < (addr + len)) { - pr_debug("Programming subblock of length %d " - "to address 0x%08x. Data @ %p\n", - ch_len, ch_addr, &buf[ch_addr - addr]); - - err = ezusb_program_bytes(hw, &buf[ch_addr - addr], - ch_addr, ch_len); - if (err) - break; - - ch_addr += ch_len; - ch_len = ((addr + len - ch_addr) < MAX_DL_SIZE) ? - (addr + len - ch_addr) : MAX_DL_SIZE; - } - - return err; -} - -static netdev_tx_t ezusb_xmit(struct sk_buff *skb, struct net_device *dev) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct net_device_stats *stats = &priv->stats; - struct ezusb_priv *upriv = priv->card; - u8 mic[MICHAEL_MIC_LEN + 1]; - int err = 0; - int tx_control; - unsigned long flags; - struct request_context *ctx; - u8 *buf; - int tx_size; - - if (!netif_running(dev)) { - printk(KERN_ERR "%s: Tx on stopped device!\n", - dev->name); - return NETDEV_TX_BUSY; - } - - if (netif_queue_stopped(dev)) { - printk(KERN_DEBUG "%s: Tx while transmitter busy!\n", - dev->name); - return NETDEV_TX_BUSY; - } - - if (orinoco_lock(priv, &flags) != 0) { - printk(KERN_ERR - "%s: ezusb_xmit() called while hw_unavailable\n", - dev->name); - return NETDEV_TX_BUSY; - } - - if (!netif_carrier_ok(dev) || - (priv->iw_mode == NL80211_IFTYPE_MONITOR)) { - /* Oops, the firmware hasn't established a connection, - silently drop the packet (this seems to be the - safest approach). */ - goto drop; - } - - /* Check packet length */ - if (skb->len < ETH_HLEN) - goto drop; - - ctx = ezusb_alloc_ctx(upriv, EZUSB_RID_TX, 0); - if (!ctx) - goto busy; - - memset(ctx->buf, 0, BULK_BUF_SIZE); - buf = ctx->buf->data; - - tx_control = 0; - - err = orinoco_process_xmit_skb(skb, dev, priv, &tx_control, - &mic[0]); - if (err) - goto drop; - - { - __le16 *tx_cntl = (__le16 *)buf; - *tx_cntl = cpu_to_le16(tx_control); - buf += sizeof(*tx_cntl); - } - - memcpy(buf, skb->data, skb->len); - buf += skb->len; - - if (tx_control & HERMES_TXCTRL_MIC) { - u8 *m = mic; - /* Mic has been offset so it can be copied to an even - * address. We're copying eveything anyway, so we - * don't need to copy that first byte. */ - if (skb->len % 2) - m++; - memcpy(buf, m, MICHAEL_MIC_LEN); - buf += MICHAEL_MIC_LEN; - } - - /* Finally, we actually initiate the send */ - netif_stop_queue(dev); - - /* The card may behave better if we send evenly sized usb transfers */ - tx_size = ALIGN(buf - ctx->buf->data, 2); - - err = ezusb_access_ltv(upriv, ctx, tx_size, NULL, - EZUSB_FRAME_DATA, NULL, 0, NULL); - - if (err) { - netif_start_queue(dev); - if (net_ratelimit()) - printk(KERN_ERR "%s: Error %d transmitting packet\n", - dev->name, err); - goto busy; - } - - dev->trans_start = jiffies; - stats->tx_bytes += skb->len; - goto ok; - - drop: - stats->tx_errors++; - stats->tx_dropped++; - - ok: - orinoco_unlock(priv, &flags); - dev_kfree_skb(skb); - return NETDEV_TX_OK; - - busy: - orinoco_unlock(priv, &flags); - return NETDEV_TX_BUSY; -} - -static int ezusb_allocate(struct hermes *hw, u16 size, u16 *fid) -{ - *fid = EZUSB_RID_TX; - return 0; -} - - -static int ezusb_hard_reset(struct orinoco_private *priv) -{ - struct ezusb_priv *upriv = priv->card; - int retval = ezusb_8051_cpucs(upriv, 1); - - if (retval < 0) { - err("Failed to reset"); - return retval; - } - - retval = ezusb_8051_cpucs(upriv, 0); - if (retval < 0) { - err("Failed to unreset"); - return retval; - } - - dbg("sending control message"); - retval = usb_control_msg(upriv->udev, - usb_sndctrlpipe(upriv->udev, 0), - EZUSB_REQUEST_TRIGER, - USB_TYPE_VENDOR | USB_RECIP_DEVICE | - USB_DIR_OUT, 0x0, 0x0, NULL, 0, - DEF_TIMEOUT); - if (retval < 0) { - err("EZUSB_REQUEST_TRIGER failed retval %d", retval); - return retval; - } -#if 0 - dbg("Sending EZUSB_REQUEST_TRIG_AC"); - retval = usb_control_msg(upriv->udev, - usb_sndctrlpipe(upriv->udev, 0), - EZUSB_REQUEST_TRIG_AC, - USB_TYPE_VENDOR | USB_RECIP_DEVICE | - USB_DIR_OUT, 0x00FA, 0x0, NULL, 0, - DEF_TIMEOUT); - if (retval < 0) { - err("EZUSB_REQUEST_TRIG_AC failed retval %d", retval); - return retval; - } -#endif - - return 0; -} - - -static int ezusb_init(struct hermes *hw) -{ - struct ezusb_priv *upriv = hw->priv; - int retval; - - BUG_ON(in_interrupt()); - BUG_ON(!upriv); - - upriv->reply_count = 0; - /* Write the MAGIC number on the simulated registers to keep - * orinoco.c happy */ - hermes_write_regn(hw, SWSUPPORT0, HERMES_MAGIC); - hermes_write_regn(hw, RXFID, EZUSB_RID_RX); - - usb_kill_urb(upriv->read_urb); - ezusb_submit_in_urb(upriv); - - retval = ezusb_write_ltv(hw, 0, EZUSB_RID_INIT1, - HERMES_BYTES_TO_RECLEN(2), "\x10\x00"); - if (retval < 0) { - printk(KERN_ERR PFX "EZUSB_RID_INIT1 error %d\n", retval); - return retval; - } - - retval = ezusb_docmd_wait(hw, HERMES_CMD_INIT, 0, NULL); - if (retval < 0) { - printk(KERN_ERR PFX "HERMES_CMD_INIT error %d\n", retval); - return retval; - } - - return 0; -} - -static void ezusb_bulk_in_callback(struct urb *urb) -{ - struct ezusb_priv *upriv = (struct ezusb_priv *) urb->context; - struct ezusb_packet *ans = urb->transfer_buffer; - u16 crc; - u16 hermes_rid; - - if (upriv->udev == NULL) { - dbg("disconnected"); - return; - } - - if (urb->status == -ETIMEDOUT) { - /* When a device gets unplugged we get this every time - * we resubmit, flooding the logs. Since we don't use - * USB timeouts, it shouldn't happen any other time*/ - pr_warning("%s: urb timed out, not resubmiting", __func__); - return; - } - if (urb->status == -ECONNABORTED) { - pr_warning("%s: connection abort, resubmiting urb", - __func__); - goto resubmit; - } - if ((urb->status == -EILSEQ) - || (urb->status == -ENOENT) - || (urb->status == -ECONNRESET)) { - dbg("status %d, not resubmiting", urb->status); - return; - } - if (urb->status) - dbg("status: %d length: %d", - urb->status, urb->actual_length); - if (urb->actual_length < sizeof(*ans)) { - err("%s: short read, ignoring", __func__); - goto resubmit; - } - crc = build_crc(ans); - if (le16_to_cpu(ans->crc) != crc) { - err("CRC error, ignoring packet"); - goto resubmit; - } - - hermes_rid = le16_to_cpu(ans->hermes_rid); - if ((hermes_rid != EZUSB_RID_RX) && !EZUSB_IS_INFO(hermes_rid)) { - ezusb_request_in_callback(upriv, urb); - } else if (upriv->dev) { - struct net_device *dev = upriv->dev; - struct orinoco_private *priv = ndev_priv(dev); - struct hermes *hw = &priv->hw; - - if (hermes_rid == EZUSB_RID_RX) { - __orinoco_ev_rx(dev, hw); - } else { - hermes_write_regn(hw, INFOFID, - le16_to_cpu(ans->hermes_rid)); - __orinoco_ev_info(dev, hw); - } - } - - resubmit: - if (upriv->udev) - ezusb_submit_in_urb(upriv); -} - -static inline void ezusb_delete(struct ezusb_priv *upriv) -{ - struct net_device *dev; - struct list_head *item; - struct list_head *tmp_item; - unsigned long flags; - - BUG_ON(in_interrupt()); - BUG_ON(!upriv); - - dev = upriv->dev; - mutex_lock(&upriv->mtx); - - upriv->udev = NULL; /* No timer will be rearmed from here */ - - usb_kill_urb(upriv->read_urb); - - spin_lock_irqsave(&upriv->req_lock, flags); - list_for_each_safe(item, tmp_item, &upriv->req_active) { - struct request_context *ctx; - int err; - - ctx = list_entry(item, struct request_context, list); - atomic_inc(&ctx->refcount); - - ctx->outurb->transfer_flags |= URB_ASYNC_UNLINK; - err = usb_unlink_urb(ctx->outurb); - - spin_unlock_irqrestore(&upriv->req_lock, flags); - if (err == -EINPROGRESS) - wait_for_completion(&ctx->done); - - del_timer_sync(&ctx->timer); - /* FIXME: there is an slight chance for the irq handler to - * be running */ - if (!list_empty(&ctx->list)) - ezusb_ctx_complete(ctx); - - ezusb_request_context_put(ctx); - spin_lock_irqsave(&upriv->req_lock, flags); - } - spin_unlock_irqrestore(&upriv->req_lock, flags); - - list_for_each_safe(item, tmp_item, &upriv->req_pending) - ezusb_ctx_complete(list_entry(item, - struct request_context, list)); - - if (upriv->read_urb && upriv->read_urb->status == -EINPROGRESS) - printk(KERN_ERR PFX "Some URB in progress\n"); - - mutex_unlock(&upriv->mtx); - - if (upriv->read_urb) { - kfree(upriv->read_urb->transfer_buffer); - usb_free_urb(upriv->read_urb); - } - kfree(upriv->bap_buf); - if (upriv->dev) { - struct orinoco_private *priv = ndev_priv(upriv->dev); - orinoco_if_del(priv); - free_orinocodev(priv); - } -} - -static void ezusb_lock_irqsave(spinlock_t *lock, - unsigned long *flags) __acquires(lock) -{ - spin_lock_bh(lock); -} - -static void ezusb_unlock_irqrestore(spinlock_t *lock, - unsigned long *flags) __releases(lock) -{ - spin_unlock_bh(lock); -} - -static void ezusb_lock_irq(spinlock_t *lock) __acquires(lock) -{ - spin_lock_bh(lock); -} - -static void ezusb_unlock_irq(spinlock_t *lock) __releases(lock) -{ - spin_unlock_bh(lock); -} - -static const struct hermes_ops ezusb_ops = { - .init = ezusb_init, - .cmd_wait = ezusb_docmd_wait, - .init_cmd_wait = ezusb_doicmd_wait, - .allocate = ezusb_allocate, - .read_ltv = ezusb_read_ltv, - .write_ltv = ezusb_write_ltv, - .bap_pread = ezusb_bap_pread, - .read_pda = ezusb_read_pda, - .program_init = ezusb_program_init, - .program_end = ezusb_program_end, - .program = ezusb_program, - .lock_irqsave = ezusb_lock_irqsave, - .unlock_irqrestore = ezusb_unlock_irqrestore, - .lock_irq = ezusb_lock_irq, - .unlock_irq = ezusb_unlock_irq, -}; - -static const struct net_device_ops ezusb_netdev_ops = { - .ndo_open = orinoco_open, - .ndo_stop = orinoco_stop, - .ndo_start_xmit = ezusb_xmit, - .ndo_set_rx_mode = orinoco_set_multicast_list, - .ndo_change_mtu = orinoco_change_mtu, - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, - .ndo_tx_timeout = orinoco_tx_timeout, - .ndo_get_stats = orinoco_get_stats, -}; - -static int ezusb_probe(struct usb_interface *interface, - const struct usb_device_id *id) -{ - struct usb_device *udev = interface_to_usbdev(interface); - struct orinoco_private *priv; - struct hermes *hw; - struct ezusb_priv *upriv = NULL; - struct usb_interface_descriptor *iface_desc; - struct usb_endpoint_descriptor *ep; - const struct firmware *fw_entry = NULL; - int retval = 0; - int i; - - priv = alloc_orinocodev(sizeof(*upriv), &udev->dev, - ezusb_hard_reset, NULL); - if (!priv) { - err("Couldn't allocate orinocodev"); - goto exit; - } - - hw = &priv->hw; - - upriv = priv->card; - - mutex_init(&upriv->mtx); - spin_lock_init(&upriv->reply_count_lock); - - spin_lock_init(&upriv->req_lock); - INIT_LIST_HEAD(&upriv->req_pending); - INIT_LIST_HEAD(&upriv->req_active); - - upriv->udev = udev; - - hw->iobase = (void __force __iomem *) &upriv->hermes_reg_fake; - hw->reg_spacing = HERMES_16BIT_REGSPACING; - hw->priv = upriv; - hw->ops = &ezusb_ops; - - /* set up the endpoint information */ - /* check out the endpoints */ - - iface_desc = &interface->altsetting[0].desc; - for (i = 0; i < iface_desc->bNumEndpoints; ++i) { - ep = &interface->altsetting[0].endpoint[i].desc; - - if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) - == USB_DIR_IN) && - ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) - == USB_ENDPOINT_XFER_BULK)) { - /* we found a bulk in endpoint */ - if (upriv->read_urb != NULL) { - pr_warning("Found a second bulk in ep, ignored"); - continue; - } - - upriv->read_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!upriv->read_urb) { - err("No free urbs available"); - goto error; - } - if (le16_to_cpu(ep->wMaxPacketSize) != 64) - pr_warning("bulk in: wMaxPacketSize!= 64"); - if (ep->bEndpointAddress != (2 | USB_DIR_IN)) - pr_warning("bulk in: bEndpointAddress: %d", - ep->bEndpointAddress); - upriv->read_pipe = usb_rcvbulkpipe(udev, - ep-> - bEndpointAddress); - upriv->read_urb->transfer_buffer = - kmalloc(BULK_BUF_SIZE, GFP_KERNEL); - if (!upriv->read_urb->transfer_buffer) { - err("Couldn't allocate IN buffer"); - goto error; - } - } - - if (((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) - == USB_DIR_OUT) && - ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) - == USB_ENDPOINT_XFER_BULK)) { - /* we found a bulk out endpoint */ - if (upriv->bap_buf != NULL) { - pr_warning("Found a second bulk out ep, ignored"); - continue; - } - - if (le16_to_cpu(ep->wMaxPacketSize) != 64) - pr_warning("bulk out: wMaxPacketSize != 64"); - if (ep->bEndpointAddress != 2) - pr_warning("bulk out: bEndpointAddress: %d", - ep->bEndpointAddress); - upriv->write_pipe = usb_sndbulkpipe(udev, - ep-> - bEndpointAddress); - upriv->bap_buf = kmalloc(BULK_BUF_SIZE, GFP_KERNEL); - if (!upriv->bap_buf) { - err("Couldn't allocate bulk_out_buffer"); - goto error; - } - } - } - if (!upriv->bap_buf || !upriv->read_urb) { - err("Didn't find the required bulk endpoints"); - goto error; - } - - if (request_firmware(&fw_entry, "orinoco_ezusb_fw", - &interface->dev) == 0) { - firmware.size = fw_entry->size; - firmware.code = fw_entry->data; - } - if (firmware.size && firmware.code) { - if (ezusb_firmware_download(upriv, &firmware)) - goto error; - } else { - err("No firmware to download"); - goto error; - } - - if (ezusb_hard_reset(priv) < 0) { - err("Cannot reset the device"); - goto error; - } - - /* If the firmware is already downloaded orinoco.c will call - * ezusb_init but if the firmware is not already there, that will make - * the kernel very unstable, so we try initializing here and quit in - * case of error */ - if (ezusb_init(hw) < 0) { - err("Couldn't initialize the device"); - err("Firmware may not be downloaded or may be wrong."); - goto error; - } - - /* Initialise the main driver */ - if (orinoco_init(priv) != 0) { - err("orinoco_init() failed\n"); - goto error; - } - - if (orinoco_if_add(priv, 0, 0, &ezusb_netdev_ops) != 0) { - upriv->dev = NULL; - err("%s: orinoco_if_add() failed", __func__); - goto error; - } - upriv->dev = priv->ndev; - - goto exit; - - error: - ezusb_delete(upriv); - if (upriv->dev) { - /* upriv->dev was 0, so ezusb_delete() didn't free it */ - free_orinocodev(priv); - } - upriv = NULL; - retval = -EFAULT; - exit: - if (fw_entry) { - firmware.code = NULL; - firmware.size = 0; - release_firmware(fw_entry); - } - usb_set_intfdata(interface, upriv); - return retval; -} - - -static void ezusb_disconnect(struct usb_interface *intf) -{ - struct ezusb_priv *upriv = usb_get_intfdata(intf); - usb_set_intfdata(intf, NULL); - ezusb_delete(upriv); - printk(KERN_INFO PFX "Disconnected\n"); -} - - -/* usb specific object needed to register this driver with the usb subsystem */ -static struct usb_driver orinoco_driver = { - .name = DRIVER_NAME, - .probe = ezusb_probe, - .disconnect = ezusb_disconnect, - .id_table = ezusb_table, - .disable_hub_initiated_lpm = 1, -}; - -module_usb_driver(orinoco_driver); - -MODULE_AUTHOR("Manuel Estrada Sainz"); -MODULE_DESCRIPTION("Driver for Orinoco wireless LAN cards using EZUSB bridge"); -MODULE_LICENSE("Dual MPL/GPL"); diff --git a/drivers/net/wireless/orinoco/scan.c b/drivers/net/wireless/orinoco/scan.c deleted file mode 100644 index e8c5714bfd11..000000000000 --- a/drivers/net/wireless/orinoco/scan.c +++ /dev/null @@ -1,248 +0,0 @@ -/* Helpers for managing scan queues - * - * See copyright notice in main.c - */ - -#include -#include -#include -#include -#include - -#include "hermes.h" -#include "orinoco.h" -#include "main.h" - -#include "scan.h" - -#define ZERO_DBM_OFFSET 0x95 -#define MAX_SIGNAL_LEVEL 0x8A -#define MIN_SIGNAL_LEVEL 0x2F - -#define SIGNAL_TO_DBM(x) \ - (clamp_t(s32, (x), MIN_SIGNAL_LEVEL, MAX_SIGNAL_LEVEL) \ - - ZERO_DBM_OFFSET) -#define SIGNAL_TO_MBM(x) (SIGNAL_TO_DBM(x) * 100) - -static int symbol_build_supp_rates(u8 *buf, const __le16 *rates) -{ - int i; - u8 rate; - - buf[0] = WLAN_EID_SUPP_RATES; - for (i = 0; i < 5; i++) { - rate = le16_to_cpu(rates[i]); - /* NULL terminated */ - if (rate == 0x0) - break; - buf[i + 2] = rate; - } - buf[1] = i; - - return i + 2; -} - -static int prism_build_supp_rates(u8 *buf, const u8 *rates) -{ - int i; - - buf[0] = WLAN_EID_SUPP_RATES; - for (i = 0; i < 8; i++) { - /* NULL terminated */ - if (rates[i] == 0x0) - break; - buf[i + 2] = rates[i]; - } - buf[1] = i; - - /* We might still have another 2 rates, which need to go in - * extended supported rates */ - if (i == 8 && rates[i] > 0) { - buf[10] = WLAN_EID_EXT_SUPP_RATES; - for (; i < 10; i++) { - /* NULL terminated */ - if (rates[i] == 0x0) - break; - buf[i + 2] = rates[i]; - } - buf[11] = i - 8; - } - - return (i < 8) ? i + 2 : i + 4; -} - -static void orinoco_add_hostscan_result(struct orinoco_private *priv, - const union hermes_scan_info *bss) -{ - struct wiphy *wiphy = priv_to_wiphy(priv); - struct ieee80211_channel *channel; - struct cfg80211_bss *cbss; - u8 *ie; - u8 ie_buf[46]; - u64 timestamp; - s32 signal; - u16 capability; - u16 beacon_interval; - int ie_len; - int freq; - int len; - - len = le16_to_cpu(bss->a.essid_len); - - /* Reconstruct SSID and bitrate IEs to pass up */ - ie_buf[0] = WLAN_EID_SSID; - ie_buf[1] = len; - memcpy(&ie_buf[2], bss->a.essid, len); - - ie = ie_buf + len + 2; - ie_len = ie_buf[1] + 2; - switch (priv->firmware_type) { - case FIRMWARE_TYPE_SYMBOL: - ie_len += symbol_build_supp_rates(ie, bss->s.rates); - break; - - case FIRMWARE_TYPE_INTERSIL: - ie_len += prism_build_supp_rates(ie, bss->p.rates); - break; - - case FIRMWARE_TYPE_AGERE: - default: - break; - } - - freq = ieee80211_dsss_chan_to_freq(le16_to_cpu(bss->a.channel)); - channel = ieee80211_get_channel(wiphy, freq); - if (!channel) { - printk(KERN_DEBUG "Invalid channel designation %04X(%04X)", - bss->a.channel, freq); - return; /* Then ignore it for now */ - } - timestamp = 0; - capability = le16_to_cpu(bss->a.capabilities); - beacon_interval = le16_to_cpu(bss->a.beacon_interv); - signal = SIGNAL_TO_MBM(le16_to_cpu(bss->a.level)); - - cbss = cfg80211_inform_bss(wiphy, channel, bss->a.bssid, timestamp, - capability, beacon_interval, ie_buf, ie_len, - signal, GFP_KERNEL); - cfg80211_put_bss(wiphy, cbss); -} - -void orinoco_add_extscan_result(struct orinoco_private *priv, - struct agere_ext_scan_info *bss, - size_t len) -{ - struct wiphy *wiphy = priv_to_wiphy(priv); - struct ieee80211_channel *channel; - struct cfg80211_bss *cbss; - const u8 *ie; - u64 timestamp; - s32 signal; - u16 capability; - u16 beacon_interval; - size_t ie_len; - int chan, freq; - - ie_len = len - sizeof(*bss); - ie = cfg80211_find_ie(WLAN_EID_DS_PARAMS, bss->data, ie_len); - chan = ie ? ie[2] : 0; - freq = ieee80211_dsss_chan_to_freq(chan); - channel = ieee80211_get_channel(wiphy, freq); - - timestamp = le64_to_cpu(bss->timestamp); - capability = le16_to_cpu(bss->capabilities); - beacon_interval = le16_to_cpu(bss->beacon_interval); - ie = bss->data; - signal = SIGNAL_TO_MBM(bss->level); - - cbss = cfg80211_inform_bss(wiphy, channel, bss->bssid, timestamp, - capability, beacon_interval, ie, ie_len, - signal, GFP_KERNEL); - cfg80211_put_bss(wiphy, cbss); -} - -void orinoco_add_hostscan_results(struct orinoco_private *priv, - unsigned char *buf, - size_t len) -{ - int offset; /* In the scan data */ - size_t atom_len; - bool abort = false; - - switch (priv->firmware_type) { - case FIRMWARE_TYPE_AGERE: - atom_len = sizeof(struct agere_scan_apinfo); - offset = 0; - break; - - case FIRMWARE_TYPE_SYMBOL: - /* Lack of documentation necessitates this hack. - * Different firmwares have 68 or 76 byte long atoms. - * We try modulo first. If the length divides by both, - * we check what would be the channel in the second - * frame for a 68-byte atom. 76-byte atoms have 0 there. - * Valid channel cannot be 0. */ - if (len % 76) - atom_len = 68; - else if (len % 68) - atom_len = 76; - else if (len >= 1292 && buf[68] == 0) - atom_len = 76; - else - atom_len = 68; - offset = 0; - break; - - case FIRMWARE_TYPE_INTERSIL: - offset = 4; - if (priv->has_hostscan) { - atom_len = le16_to_cpup((__le16 *)buf); - /* Sanity check for atom_len */ - if (atom_len < sizeof(struct prism2_scan_apinfo)) { - printk(KERN_ERR "%s: Invalid atom_len in scan " - "data: %zu\n", priv->ndev->name, - atom_len); - abort = true; - goto scan_abort; - } - } else - atom_len = offsetof(struct prism2_scan_apinfo, atim); - break; - - default: - abort = true; - goto scan_abort; - } - - /* Check that we got an whole number of atoms */ - if ((len - offset) % atom_len) { - printk(KERN_ERR "%s: Unexpected scan data length %zu, " - "atom_len %zu, offset %d\n", priv->ndev->name, len, - atom_len, offset); - abort = true; - goto scan_abort; - } - - /* Process the entries one by one */ - for (; offset + atom_len <= len; offset += atom_len) { - union hermes_scan_info *atom; - - atom = (union hermes_scan_info *) (buf + offset); - - orinoco_add_hostscan_result(priv, atom); - } - - scan_abort: - if (priv->scan_request) { - cfg80211_scan_done(priv->scan_request, abort); - priv->scan_request = NULL; - } -} - -void orinoco_scan_done(struct orinoco_private *priv, bool abort) -{ - if (priv->scan_request) { - cfg80211_scan_done(priv->scan_request, abort); - priv->scan_request = NULL; - } -} diff --git a/drivers/net/wireless/orinoco/scan.h b/drivers/net/wireless/orinoco/scan.h deleted file mode 100644 index 27281fb0a6dc..000000000000 --- a/drivers/net/wireless/orinoco/scan.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Helpers for managing scan queues - * - * See copyright notice in main.c - */ -#ifndef _ORINOCO_SCAN_H_ -#define _ORINOCO_SCAN_H_ - -/* Forward declarations */ -struct orinoco_private; -struct agere_ext_scan_info; - -/* Add scan results */ -void orinoco_add_extscan_result(struct orinoco_private *priv, - struct agere_ext_scan_info *atom, - size_t len); -void orinoco_add_hostscan_results(struct orinoco_private *dev, - unsigned char *buf, - size_t len); -void orinoco_scan_done(struct orinoco_private *priv, bool abort); - -#endif /* _ORINOCO_SCAN_H_ */ diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c deleted file mode 100644 index e2264bc12ebf..000000000000 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Driver for 802.11b cards using RAM-loadable Symbol firmware, such as - * Symbol Wireless Networker LA4137, CompactFlash cards by Socket - * Communications and Intel PRO/Wireless 2011B. - * - * The driver implements Symbol firmware download. The rest is handled - * in hermes.c and main.c. - * - * Utilities for downloading the Symbol firmware are available at - * http://sourceforge.net/projects/orinoco/ - * - * Copyright (C) 2002-2005 Pavel Roskin - * Portions based on orinoco_cs.c: - * Copyright (C) David Gibson, Linuxcare Australia - * Portions based on Spectrum24tDnld.c from original spectrum24 driver: - * Copyright (C) Symbol Technologies. - * - * See copyright notice in file main.c. - */ - -#define DRIVER_NAME "spectrum_cs" -#define PFX DRIVER_NAME ": " - -#include -#include -#include -#include -#include -#include -#include - -#include "orinoco.h" - -/********************************************************************/ -/* Module stuff */ -/********************************************************************/ - -MODULE_AUTHOR("Pavel Roskin "); -MODULE_DESCRIPTION("Driver for Symbol Spectrum24 Trilogy cards with firmware downloader"); -MODULE_LICENSE("Dual MPL/GPL"); - -/* Module parameters */ - -/* Some D-Link cards have buggy CIS. They do work at 5v properly, but - * don't have any CIS entry for it. This workaround it... */ -static int ignore_cis_vcc; /* = 0 */ -module_param(ignore_cis_vcc, int, 0); -MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket"); - -/********************************************************************/ -/* Data structures */ -/********************************************************************/ - -/* PCMCIA specific device information (goes in the card field of - * struct orinoco_private */ -struct orinoco_pccard { - struct pcmcia_device *p_dev; -}; - -/********************************************************************/ -/* Function prototypes */ -/********************************************************************/ - -static int spectrum_cs_config(struct pcmcia_device *link); -static void spectrum_cs_release(struct pcmcia_device *link); - -/* Constants for the CISREG_CCSR register */ -#define HCR_RUN 0x07 /* run firmware after reset */ -#define HCR_IDLE 0x0E /* don't run firmware after reset */ -#define HCR_MEM16 0x10 /* memory width bit, should be preserved */ - - -/* - * Reset the card using configuration registers COR and CCSR. - * If IDLE is 1, stop the firmware, so that it can be safely rewritten. - */ -static int -spectrum_reset(struct pcmcia_device *link, int idle) -{ - int ret; - u8 save_cor; - u8 ccsr; - - /* Doing it if hardware is gone is guaranteed crash */ - if (!pcmcia_dev_present(link)) - return -ENODEV; - - /* Save original COR value */ - ret = pcmcia_read_config_byte(link, CISREG_COR, &save_cor); - if (ret) - goto failed; - - /* Soft-Reset card */ - ret = pcmcia_write_config_byte(link, CISREG_COR, - (save_cor | COR_SOFT_RESET)); - if (ret) - goto failed; - udelay(1000); - - /* Read CCSR */ - ret = pcmcia_read_config_byte(link, CISREG_CCSR, &ccsr); - if (ret) - goto failed; - - /* - * Start or stop the firmware. Memory width bit should be - * preserved from the value we've just read. - */ - ccsr = (idle ? HCR_IDLE : HCR_RUN) | (ccsr & HCR_MEM16); - ret = pcmcia_write_config_byte(link, CISREG_CCSR, ccsr); - if (ret) - goto failed; - udelay(1000); - - /* Restore original COR configuration index */ - ret = pcmcia_write_config_byte(link, CISREG_COR, - (save_cor & ~COR_SOFT_RESET)); - if (ret) - goto failed; - udelay(1000); - return 0; - -failed: - return -ENODEV; -} - -/********************************************************************/ -/* Device methods */ -/********************************************************************/ - -static int -spectrum_cs_hard_reset(struct orinoco_private *priv) -{ - struct orinoco_pccard *card = priv->card; - struct pcmcia_device *link = card->p_dev; - - /* Soft reset using COR and HCR */ - spectrum_reset(link, 0); - - return 0; -} - -static int -spectrum_cs_stop_firmware(struct orinoco_private *priv, int idle) -{ - struct orinoco_pccard *card = priv->card; - struct pcmcia_device *link = card->p_dev; - - return spectrum_reset(link, idle); -} - -/********************************************************************/ -/* PCMCIA stuff */ -/********************************************************************/ - -static int -spectrum_cs_probe(struct pcmcia_device *link) -{ - struct orinoco_private *priv; - struct orinoco_pccard *card; - - priv = alloc_orinocodev(sizeof(*card), &link->dev, - spectrum_cs_hard_reset, - spectrum_cs_stop_firmware); - if (!priv) - return -ENOMEM; - card = priv->card; - - /* Link both structures together */ - card->p_dev = link; - link->priv = priv; - - return spectrum_cs_config(link); -} /* spectrum_cs_attach */ - -static void spectrum_cs_detach(struct pcmcia_device *link) -{ - struct orinoco_private *priv = link->priv; - - orinoco_if_del(priv); - - spectrum_cs_release(link); - - free_orinocodev(priv); -} /* spectrum_cs_detach */ - -static int spectrum_cs_config_check(struct pcmcia_device *p_dev, - void *priv_data) -{ - if (p_dev->config_index == 0) - return -EINVAL; - - return pcmcia_request_io(p_dev); -}; - -static int -spectrum_cs_config(struct pcmcia_device *link) -{ - struct orinoco_private *priv = link->priv; - struct hermes *hw = &priv->hw; - int ret; - void __iomem *mem; - - link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC | - CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; - if (ignore_cis_vcc) - link->config_flags &= ~CONF_AUTO_CHECK_VCC; - ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); - if (ret) { - if (!ignore_cis_vcc) - printk(KERN_ERR PFX "GetNextTuple(): No matching " - "CIS configuration. Maybe you need the " - "ignore_cis_vcc=1 parameter.\n"); - goto failed; - } - - mem = ioport_map(link->resource[0]->start, - resource_size(link->resource[0])); - if (!mem) - goto failed; - - /* We initialize the hermes structure before completing PCMCIA - * configuration just in case the interrupt handler gets - * called. */ - hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); - hw->eeprom_pda = true; - - ret = pcmcia_request_irq(link, orinoco_interrupt); - if (ret) - goto failed; - - ret = pcmcia_enable_device(link); - if (ret) - goto failed; - - /* Reset card */ - if (spectrum_cs_hard_reset(priv) != 0) - goto failed; - - /* Initialise the main driver */ - if (orinoco_init(priv) != 0) { - printk(KERN_ERR PFX "orinoco_init() failed\n"); - goto failed; - } - - /* Register an interface with the stack */ - if (orinoco_if_add(priv, link->resource[0]->start, - link->irq, NULL) != 0) { - printk(KERN_ERR PFX "orinoco_if_add() failed\n"); - goto failed; - } - - return 0; - - failed: - spectrum_cs_release(link); - return -ENODEV; -} /* spectrum_cs_config */ - -static void -spectrum_cs_release(struct pcmcia_device *link) -{ - struct orinoco_private *priv = link->priv; - unsigned long flags; - - /* We're committed to taking the device away now, so mark the - * hardware as unavailable */ - priv->hw.ops->lock_irqsave(&priv->lock, &flags); - priv->hw_unavailable++; - priv->hw.ops->unlock_irqrestore(&priv->lock, &flags); - - pcmcia_disable_device(link); - if (priv->hw.iobase) - ioport_unmap(priv->hw.iobase); -} /* spectrum_cs_release */ - - -static int -spectrum_cs_suspend(struct pcmcia_device *link) -{ - struct orinoco_private *priv = link->priv; - int err = 0; - - /* Mark the device as stopped, to block IO until later */ - orinoco_down(priv); - - return err; -} - -static int -spectrum_cs_resume(struct pcmcia_device *link) -{ - struct orinoco_private *priv = link->priv; - int err = orinoco_up(priv); - - return err; -} - - -/********************************************************************/ -/* Module initialization */ -/********************************************************************/ - -static const struct pcmcia_device_id spectrum_cs_ids[] = { - PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4137 */ - PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ - PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless LAN PC Card", 0x816cc815, 0x6fbf459a), /* 2011B, not 2011 */ - PCMCIA_DEVICE_NULL, -}; -MODULE_DEVICE_TABLE(pcmcia, spectrum_cs_ids); - -static struct pcmcia_driver orinoco_driver = { - .owner = THIS_MODULE, - .name = DRIVER_NAME, - .probe = spectrum_cs_probe, - .remove = spectrum_cs_detach, - .suspend = spectrum_cs_suspend, - .resume = spectrum_cs_resume, - .id_table = spectrum_cs_ids, -}; -module_pcmcia_driver(orinoco_driver); diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c deleted file mode 100644 index 3b5508f982e8..000000000000 --- a/drivers/net/wireless/orinoco/wext.c +++ /dev/null @@ -1,1413 +0,0 @@ -/* Wireless extensions support. - * - * See copyright notice in main.c - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "hermes.h" -#include "hermes_rid.h" -#include "orinoco.h" - -#include "hw.h" -#include "mic.h" -#include "scan.h" -#include "main.h" - -#include "wext.h" - -#define MAX_RID_LEN 1024 - -/* Helper routine to record keys - * It is called under orinoco_lock so it may not sleep */ -static int orinoco_set_key(struct orinoco_private *priv, int index, - enum orinoco_alg alg, const u8 *key, int key_len, - const u8 *seq, int seq_len) -{ - kzfree(priv->keys[index].key); - kzfree(priv->keys[index].seq); - - if (key_len) { - priv->keys[index].key = kzalloc(key_len, GFP_ATOMIC); - if (!priv->keys[index].key) - goto nomem; - } else - priv->keys[index].key = NULL; - - if (seq_len) { - priv->keys[index].seq = kzalloc(seq_len, GFP_ATOMIC); - if (!priv->keys[index].seq) - goto free_key; - } else - priv->keys[index].seq = NULL; - - priv->keys[index].key_len = key_len; - priv->keys[index].seq_len = seq_len; - - if (key_len) - memcpy(priv->keys[index].key, key, key_len); - if (seq_len) - memcpy(priv->keys[index].seq, seq, seq_len); - - switch (alg) { - case ORINOCO_ALG_TKIP: - priv->keys[index].cipher = WLAN_CIPHER_SUITE_TKIP; - break; - - case ORINOCO_ALG_WEP: - priv->keys[index].cipher = (key_len > SMALL_KEY_SIZE) ? - WLAN_CIPHER_SUITE_WEP104 : WLAN_CIPHER_SUITE_WEP40; - break; - - case ORINOCO_ALG_NONE: - default: - priv->keys[index].cipher = 0; - break; - } - - return 0; - -free_key: - kfree(priv->keys[index].key); - priv->keys[index].key = NULL; - -nomem: - priv->keys[index].key_len = 0; - priv->keys[index].seq_len = 0; - priv->keys[index].cipher = 0; - - return -ENOMEM; -} - -static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct hermes *hw = &priv->hw; - struct iw_statistics *wstats = &priv->wstats; - int err; - unsigned long flags; - - if (!netif_device_present(dev)) { - printk(KERN_WARNING "%s: get_wireless_stats() called while device not present\n", - dev->name); - return NULL; /* FIXME: Can we do better than this? */ - } - - /* If busy, return the old stats. Returning NULL may cause - * the interface to disappear from /proc/net/wireless */ - if (orinoco_lock(priv, &flags) != 0) - return wstats; - - /* We can't really wait for the tallies inquiry command to - * complete, so we just use the previous results and trigger - * a new tallies inquiry command for next time - Jean II */ - /* FIXME: Really we should wait for the inquiry to come back - - * as it is the stats we give don't make a whole lot of sense. - * Unfortunately, it's not clear how to do that within the - * wireless extensions framework: I think we're in user - * context, but a lock seems to be held by the time we get in - * here so we're not safe to sleep here. */ - hermes_inquire(hw, HERMES_INQ_TALLIES); - - if (priv->iw_mode == NL80211_IFTYPE_ADHOC) { - memset(&wstats->qual, 0, sizeof(wstats->qual)); - /* If a spy address is defined, we report stats of the - * first spy address - Jean II */ - if (SPY_NUMBER(priv)) { - wstats->qual.qual = priv->spy_data.spy_stat[0].qual; - wstats->qual.level = priv->spy_data.spy_stat[0].level; - wstats->qual.noise = priv->spy_data.spy_stat[0].noise; - wstats->qual.updated = - priv->spy_data.spy_stat[0].updated; - } - } else { - struct { - __le16 qual, signal, noise, unused; - } __packed cq; - - err = HERMES_READ_RECORD(hw, USER_BAP, - HERMES_RID_COMMSQUALITY, &cq); - - if (!err) { - wstats->qual.qual = (int)le16_to_cpu(cq.qual); - wstats->qual.level = (int)le16_to_cpu(cq.signal) - 0x95; - wstats->qual.noise = (int)le16_to_cpu(cq.noise) - 0x95; - wstats->qual.updated = - IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; - } - } - - orinoco_unlock(priv, &flags); - return wstats; -} - -/********************************************************************/ -/* Wireless extensions */ -/********************************************************************/ - -static int orinoco_ioctl_setwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - int err = -EINPROGRESS; /* Call commit handler */ - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - /* Enable automatic roaming - no sanity checks are needed */ - if (is_zero_ether_addr(ap_addr->sa_data) || - is_broadcast_ether_addr(ap_addr->sa_data)) { - priv->bssid_fixed = 0; - memset(priv->desired_bssid, 0, ETH_ALEN); - - /* "off" means keep existing connection */ - if (ap_addr->sa_data[0] == 0) { - __orinoco_hw_set_wap(priv); - err = 0; - } - goto out; - } - - if (priv->firmware_type == FIRMWARE_TYPE_AGERE) { - printk(KERN_WARNING "%s: Lucent/Agere firmware doesn't " - "support manual roaming\n", - dev->name); - err = -EOPNOTSUPP; - goto out; - } - - if (priv->iw_mode != NL80211_IFTYPE_STATION) { - printk(KERN_WARNING "%s: Manual roaming supported only in " - "managed mode\n", dev->name); - err = -EOPNOTSUPP; - goto out; - } - - /* Intersil firmware hangs without Desired ESSID */ - if (priv->firmware_type == FIRMWARE_TYPE_INTERSIL && - strlen(priv->desired_essid) == 0) { - printk(KERN_WARNING "%s: Desired ESSID must be set for " - "manual roaming\n", dev->name); - err = -EOPNOTSUPP; - goto out; - } - - /* Finally, enable manual roaming */ - priv->bssid_fixed = 1; - memcpy(priv->desired_bssid, &ap_addr->sa_data, ETH_ALEN); - - out: - orinoco_unlock(priv, &flags); - return err; -} - -static int orinoco_ioctl_getwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - - int err = 0; - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - ap_addr->sa_family = ARPHRD_ETHER; - err = orinoco_hw_get_current_bssid(priv, ap_addr->sa_data); - - orinoco_unlock(priv, &flags); - - return err; -} - -static int orinoco_ioctl_setiwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, - char *keybuf) -{ - struct orinoco_private *priv = ndev_priv(dev); - int index = (erq->flags & IW_ENCODE_INDEX) - 1; - int setindex = priv->tx_key; - enum orinoco_alg encode_alg = priv->encode_alg; - int restricted = priv->wep_restrict; - int err = -EINPROGRESS; /* Call commit handler */ - unsigned long flags; - - if (!priv->has_wep) - return -EOPNOTSUPP; - - if (erq->pointer) { - /* We actually have a key to set - check its length */ - if (erq->length > LARGE_KEY_SIZE) - return -E2BIG; - - if ((erq->length > SMALL_KEY_SIZE) && !priv->has_big_wep) - return -E2BIG; - } - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - /* Clear any TKIP key we have */ - if ((priv->has_wpa) && (priv->encode_alg == ORINOCO_ALG_TKIP)) - (void) orinoco_clear_tkip_key(priv, setindex); - - if (erq->length > 0) { - if ((index < 0) || (index >= ORINOCO_MAX_KEYS)) - index = priv->tx_key; - - /* Switch on WEP if off */ - if (encode_alg != ORINOCO_ALG_WEP) { - setindex = index; - encode_alg = ORINOCO_ALG_WEP; - } - } else { - /* Important note : if the user do "iwconfig eth0 enc off", - * we will arrive there with an index of -1. This is valid - * but need to be taken care off... Jean II */ - if ((index < 0) || (index >= ORINOCO_MAX_KEYS)) { - if ((index != -1) || (erq->flags == 0)) { - err = -EINVAL; - goto out; - } - } else { - /* Set the index : Check that the key is valid */ - if (priv->keys[index].key_len == 0) { - err = -EINVAL; - goto out; - } - setindex = index; - } - } - - if (erq->flags & IW_ENCODE_DISABLED) - encode_alg = ORINOCO_ALG_NONE; - if (erq->flags & IW_ENCODE_OPEN) - restricted = 0; - if (erq->flags & IW_ENCODE_RESTRICTED) - restricted = 1; - - if (erq->pointer && erq->length > 0) { - err = orinoco_set_key(priv, index, ORINOCO_ALG_WEP, keybuf, - erq->length, NULL, 0); - } - priv->tx_key = setindex; - - /* Try fast key change if connected and only keys are changed */ - if ((priv->encode_alg == encode_alg) && - (priv->wep_restrict == restricted) && - netif_carrier_ok(dev)) { - err = __orinoco_hw_setup_wepkeys(priv); - /* No need to commit if successful */ - goto out; - } - - priv->encode_alg = encode_alg; - priv->wep_restrict = restricted; - - out: - orinoco_unlock(priv, &flags); - - return err; -} - -static int orinoco_ioctl_getiwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, - char *keybuf) -{ - struct orinoco_private *priv = ndev_priv(dev); - int index = (erq->flags & IW_ENCODE_INDEX) - 1; - unsigned long flags; - - if (!priv->has_wep) - return -EOPNOTSUPP; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - if ((index < 0) || (index >= ORINOCO_MAX_KEYS)) - index = priv->tx_key; - - erq->flags = 0; - if (!priv->encode_alg) - erq->flags |= IW_ENCODE_DISABLED; - erq->flags |= index + 1; - - if (priv->wep_restrict) - erq->flags |= IW_ENCODE_RESTRICTED; - else - erq->flags |= IW_ENCODE_OPEN; - - erq->length = priv->keys[index].key_len; - - memcpy(keybuf, priv->keys[index].key, erq->length); - - orinoco_unlock(priv, &flags); - return 0; -} - -static int orinoco_ioctl_setessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, - char *essidbuf) -{ - struct orinoco_private *priv = ndev_priv(dev); - unsigned long flags; - - /* Note : ESSID is ignored in Ad-Hoc demo mode, but we can set it - * anyway... - Jean II */ - - /* Hum... Should not use Wireless Extension constant (may change), - * should use our own... - Jean II */ - if (erq->length > IW_ESSID_MAX_SIZE) - return -E2BIG; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - /* NULL the string (for NULL termination & ESSID = ANY) - Jean II */ - memset(priv->desired_essid, 0, sizeof(priv->desired_essid)); - - /* If not ANY, get the new ESSID */ - if (erq->flags) - memcpy(priv->desired_essid, essidbuf, erq->length); - - orinoco_unlock(priv, &flags); - - return -EINPROGRESS; /* Call commit handler */ -} - -static int orinoco_ioctl_getessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, - char *essidbuf) -{ - struct orinoco_private *priv = ndev_priv(dev); - int active; - int err = 0; - unsigned long flags; - - if (netif_running(dev)) { - err = orinoco_hw_get_essid(priv, &active, essidbuf); - if (err < 0) - return err; - erq->length = err; - } else { - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - memcpy(essidbuf, priv->desired_essid, IW_ESSID_MAX_SIZE); - erq->length = strlen(priv->desired_essid); - orinoco_unlock(priv, &flags); - } - - erq->flags = 1; - - return 0; -} - -static int orinoco_ioctl_setfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *frq, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - int chan = -1; - unsigned long flags; - int err = -EINPROGRESS; /* Call commit handler */ - - /* In infrastructure mode the AP sets the channel */ - if (priv->iw_mode == NL80211_IFTYPE_STATION) - return -EBUSY; - - if ((frq->e == 0) && (frq->m <= 1000)) { - /* Setting by channel number */ - chan = frq->m; - } else { - /* Setting by frequency */ - int denom = 1; - int i; - - /* Calculate denominator to rescale to MHz */ - for (i = 0; i < (6 - frq->e); i++) - denom *= 10; - - chan = ieee80211_freq_to_dsss_chan(frq->m / denom); - } - - if ((chan < 1) || (chan > NUM_CHANNELS) || - !(priv->channel_mask & (1 << (chan - 1)))) - return -EINVAL; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - priv->channel = chan; - if (priv->iw_mode == NL80211_IFTYPE_MONITOR) { - /* Fast channel change - no commit if successful */ - struct hermes *hw = &priv->hw; - err = hw->ops->cmd_wait(hw, HERMES_CMD_TEST | - HERMES_TEST_SET_CHANNEL, - chan, NULL); - } - orinoco_unlock(priv, &flags); - - return err; -} - -static int orinoco_ioctl_getfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *frq, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - int tmp; - - /* Locking done in there */ - tmp = orinoco_hw_get_freq(priv); - if (tmp < 0) - return tmp; - - frq->m = tmp * 100000; - frq->e = 1; - - return 0; -} - -static int orinoco_ioctl_getsens(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *srq, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct hermes *hw = &priv->hw; - u16 val; - int err; - unsigned long flags; - - if (!priv->has_sensitivity) - return -EOPNOTSUPP; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - err = hermes_read_wordrec(hw, USER_BAP, - HERMES_RID_CNFSYSTEMSCALE, &val); - orinoco_unlock(priv, &flags); - - if (err) - return err; - - srq->value = val; - srq->fixed = 0; /* auto */ - - return 0; -} - -static int orinoco_ioctl_setsens(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *srq, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - int val = srq->value; - unsigned long flags; - - if (!priv->has_sensitivity) - return -EOPNOTSUPP; - - if ((val < 1) || (val > 3)) - return -EINVAL; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - priv->ap_density = val; - orinoco_unlock(priv, &flags); - - return -EINPROGRESS; /* Call commit handler */ -} - -static int orinoco_ioctl_setrate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - int ratemode; - int bitrate; /* 100s of kilobits */ - unsigned long flags; - - /* As the user space doesn't know our highest rate, it uses -1 - * to ask us to set the highest rate. Test it using "iwconfig - * ethX rate auto" - Jean II */ - if (rrq->value == -1) - bitrate = 110; - else { - if (rrq->value % 100000) - return -EINVAL; - bitrate = rrq->value / 100000; - } - - ratemode = orinoco_get_bitratemode(bitrate, !rrq->fixed); - - if (ratemode == -1) - return -EINVAL; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - priv->bitratemode = ratemode; - orinoco_unlock(priv, &flags); - - return -EINPROGRESS; -} - -static int orinoco_ioctl_getrate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rrq, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - int err = 0; - int bitrate, automatic; - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - orinoco_get_ratemode_cfg(priv->bitratemode, &bitrate, &automatic); - - /* If the interface is running we try to find more about the - current mode */ - if (netif_running(dev)) { - int act_bitrate; - int lerr; - - /* Ignore errors if we can't get the actual bitrate */ - lerr = orinoco_hw_get_act_bitrate(priv, &act_bitrate); - if (!lerr) - bitrate = act_bitrate; - } - - orinoco_unlock(priv, &flags); - - rrq->value = bitrate; - rrq->fixed = !automatic; - rrq->disabled = 0; - - return err; -} - -static int orinoco_ioctl_setpower(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *prq, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - int err = -EINPROGRESS; /* Call commit handler */ - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - if (prq->disabled) { - priv->pm_on = 0; - } else { - switch (prq->flags & IW_POWER_MODE) { - case IW_POWER_UNICAST_R: - priv->pm_mcast = 0; - priv->pm_on = 1; - break; - case IW_POWER_ALL_R: - priv->pm_mcast = 1; - priv->pm_on = 1; - break; - case IW_POWER_ON: - /* No flags : but we may have a value - Jean II */ - break; - default: - err = -EINVAL; - goto out; - } - - if (prq->flags & IW_POWER_TIMEOUT) { - priv->pm_on = 1; - priv->pm_timeout = prq->value / 1000; - } - if (prq->flags & IW_POWER_PERIOD) { - priv->pm_on = 1; - priv->pm_period = prq->value / 1000; - } - /* It's valid to not have a value if we are just toggling - * the flags... Jean II */ - if (!priv->pm_on) { - err = -EINVAL; - goto out; - } - } - - out: - orinoco_unlock(priv, &flags); - - return err; -} - -static int orinoco_ioctl_getpower(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *prq, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct hermes *hw = &priv->hw; - int err = 0; - u16 enable, period, timeout, mcast; - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - err = hermes_read_wordrec(hw, USER_BAP, - HERMES_RID_CNFPMENABLED, &enable); - if (err) - goto out; - - err = hermes_read_wordrec(hw, USER_BAP, - HERMES_RID_CNFMAXSLEEPDURATION, &period); - if (err) - goto out; - - err = hermes_read_wordrec(hw, USER_BAP, - HERMES_RID_CNFPMHOLDOVERDURATION, &timeout); - if (err) - goto out; - - err = hermes_read_wordrec(hw, USER_BAP, - HERMES_RID_CNFMULTICASTRECEIVE, &mcast); - if (err) - goto out; - - prq->disabled = !enable; - /* Note : by default, display the period */ - if ((prq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { - prq->flags = IW_POWER_TIMEOUT; - prq->value = timeout * 1000; - } else { - prq->flags = IW_POWER_PERIOD; - prq->value = period * 1000; - } - if (mcast) - prq->flags |= IW_POWER_ALL_R; - else - prq->flags |= IW_POWER_UNICAST_R; - - out: - orinoco_unlock(priv, &flags); - - return err; -} - -static int orinoco_ioctl_set_encodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct iw_point *encoding = &wrqu->encoding; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int idx, alg = ext->alg, set_key = 1; - unsigned long flags; - int err = -EINVAL; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - /* Determine and validate the key index */ - idx = encoding->flags & IW_ENCODE_INDEX; - if (idx) { - if ((idx < 1) || (idx > 4)) - goto out; - idx--; - } else - idx = priv->tx_key; - - if (encoding->flags & IW_ENCODE_DISABLED) - alg = IW_ENCODE_ALG_NONE; - - if (priv->has_wpa && (alg != IW_ENCODE_ALG_TKIP)) { - /* Clear any TKIP TX key we had */ - (void) orinoco_clear_tkip_key(priv, priv->tx_key); - } - - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - priv->tx_key = idx; - set_key = ((alg == IW_ENCODE_ALG_TKIP) || - (ext->key_len > 0)) ? 1 : 0; - } - - if (set_key) { - /* Set the requested key first */ - switch (alg) { - case IW_ENCODE_ALG_NONE: - priv->encode_alg = ORINOCO_ALG_NONE; - err = orinoco_set_key(priv, idx, ORINOCO_ALG_NONE, - NULL, 0, NULL, 0); - break; - - case IW_ENCODE_ALG_WEP: - if (ext->key_len <= 0) - goto out; - - priv->encode_alg = ORINOCO_ALG_WEP; - err = orinoco_set_key(priv, idx, ORINOCO_ALG_WEP, - ext->key, ext->key_len, NULL, 0); - break; - - case IW_ENCODE_ALG_TKIP: - { - u8 *tkip_iv = NULL; - - if (!priv->has_wpa || - (ext->key_len > sizeof(struct orinoco_tkip_key))) - goto out; - - priv->encode_alg = ORINOCO_ALG_TKIP; - - if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) - tkip_iv = &ext->rx_seq[0]; - - err = orinoco_set_key(priv, idx, ORINOCO_ALG_TKIP, - ext->key, ext->key_len, tkip_iv, - ORINOCO_SEQ_LEN); - - err = __orinoco_hw_set_tkip_key(priv, idx, - ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY, - priv->keys[idx].key, - tkip_iv, ORINOCO_SEQ_LEN, NULL, 0); - if (err) - printk(KERN_ERR "%s: Error %d setting TKIP key" - "\n", dev->name, err); - - goto out; - } - default: - goto out; - } - } - err = -EINPROGRESS; - out: - orinoco_unlock(priv, &flags); - - return err; -} - -static int orinoco_ioctl_get_encodeext(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct iw_point *encoding = &wrqu->encoding; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int idx, max_key_len; - unsigned long flags; - int err; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - err = -EINVAL; - max_key_len = encoding->length - sizeof(*ext); - if (max_key_len < 0) - goto out; - - idx = encoding->flags & IW_ENCODE_INDEX; - if (idx) { - if ((idx < 1) || (idx > 4)) - goto out; - idx--; - } else - idx = priv->tx_key; - - encoding->flags = idx + 1; - memset(ext, 0, sizeof(*ext)); - - switch (priv->encode_alg) { - case ORINOCO_ALG_NONE: - ext->alg = IW_ENCODE_ALG_NONE; - ext->key_len = 0; - encoding->flags |= IW_ENCODE_DISABLED; - break; - case ORINOCO_ALG_WEP: - ext->alg = IW_ENCODE_ALG_WEP; - ext->key_len = min(priv->keys[idx].key_len, max_key_len); - memcpy(ext->key, priv->keys[idx].key, ext->key_len); - encoding->flags |= IW_ENCODE_ENABLED; - break; - case ORINOCO_ALG_TKIP: - ext->alg = IW_ENCODE_ALG_TKIP; - ext->key_len = min(priv->keys[idx].key_len, max_key_len); - memcpy(ext->key, priv->keys[idx].key, ext->key_len); - encoding->flags |= IW_ENCODE_ENABLED; - break; - } - - err = 0; - out: - orinoco_unlock(priv, &flags); - - return err; -} - -static int orinoco_ioctl_set_auth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct hermes *hw = &priv->hw; - struct iw_param *param = &wrqu->param; - unsigned long flags; - int ret = -EINPROGRESS; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_WPA_VERSION: - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - case IW_AUTH_PRIVACY_INVOKED: - case IW_AUTH_DROP_UNENCRYPTED: - /* - * orinoco does not use these parameters - */ - break; - - case IW_AUTH_MFP: - /* Management Frame Protection not supported. - * Only fail if set to required. - */ - if (param->value == IW_AUTH_MFP_REQUIRED) - ret = -EINVAL; - break; - - case IW_AUTH_KEY_MGMT: - /* wl_lkm implies value 2 == PSK for Hermes I - * which ties in with WEXT - * no other hints tho :( - */ - priv->key_mgmt = param->value; - break; - - case IW_AUTH_TKIP_COUNTERMEASURES: - /* When countermeasures are enabled, shut down the - * card; when disabled, re-enable the card. This must - * take effect immediately. - * - * TODO: Make sure that the EAPOL message is getting - * out before card disabled - */ - if (param->value) { - priv->tkip_cm_active = 1; - ret = hermes_disable_port(hw, 0); - } else { - priv->tkip_cm_active = 0; - ret = hermes_enable_port(hw, 0); - } - break; - - case IW_AUTH_80211_AUTH_ALG: - if (param->value & IW_AUTH_ALG_SHARED_KEY) - priv->wep_restrict = 1; - else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) - priv->wep_restrict = 0; - else - ret = -EINVAL; - break; - - case IW_AUTH_WPA_ENABLED: - if (priv->has_wpa) { - priv->wpa_enabled = param->value ? 1 : 0; - } else { - if (param->value) - ret = -EOPNOTSUPP; - /* else silently accept disable of WPA */ - priv->wpa_enabled = 0; - } - break; - - default: - ret = -EOPNOTSUPP; - } - - orinoco_unlock(priv, &flags); - return ret; -} - -static int orinoco_ioctl_get_auth(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct iw_param *param = &wrqu->param; - unsigned long flags; - int ret = 0; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_KEY_MGMT: - param->value = priv->key_mgmt; - break; - - case IW_AUTH_TKIP_COUNTERMEASURES: - param->value = priv->tkip_cm_active; - break; - - case IW_AUTH_80211_AUTH_ALG: - if (priv->wep_restrict) - param->value = IW_AUTH_ALG_SHARED_KEY; - else - param->value = IW_AUTH_ALG_OPEN_SYSTEM; - break; - - case IW_AUTH_WPA_ENABLED: - param->value = priv->wpa_enabled; - break; - - default: - ret = -EOPNOTSUPP; - } - - orinoco_unlock(priv, &flags); - return ret; -} - -static int orinoco_ioctl_set_genie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - u8 *buf; - unsigned long flags; - - /* cut off at IEEE80211_MAX_DATA_LEN */ - if ((wrqu->data.length > IEEE80211_MAX_DATA_LEN) || - (wrqu->data.length && (extra == NULL))) - return -EINVAL; - - if (wrqu->data.length) { - buf = kmemdup(extra, wrqu->data.length, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - } else - buf = NULL; - - if (orinoco_lock(priv, &flags) != 0) { - kfree(buf); - return -EBUSY; - } - - kfree(priv->wpa_ie); - priv->wpa_ie = buf; - priv->wpa_ie_len = wrqu->data.length; - - if (priv->wpa_ie) { - /* Looks like wl_lkm wants to check the auth alg, and - * somehow pass it to the firmware. - * Instead it just calls the key mgmt rid - * - we do this in set auth. - */ - } - - orinoco_unlock(priv, &flags); - return 0; -} - -static int orinoco_ioctl_get_genie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - unsigned long flags; - int err = 0; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - if ((priv->wpa_ie_len == 0) || (priv->wpa_ie == NULL)) { - wrqu->data.length = 0; - goto out; - } - - if (wrqu->data.length < priv->wpa_ie_len) { - err = -E2BIG; - goto out; - } - - wrqu->data.length = priv->wpa_ie_len; - memcpy(extra, priv->wpa_ie, priv->wpa_ie_len); - -out: - orinoco_unlock(priv, &flags); - return err; -} - -static int orinoco_ioctl_set_mlme(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct iw_mlme *mlme = (struct iw_mlme *)extra; - unsigned long flags; - int ret = 0; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - switch (mlme->cmd) { - case IW_MLME_DEAUTH: - /* silently ignore */ - break; - - case IW_MLME_DISASSOC: - - ret = orinoco_hw_disassociate(priv, mlme->addr.sa_data, - mlme->reason_code); - break; - - default: - ret = -EOPNOTSUPP; - } - - orinoco_unlock(priv, &flags); - return ret; -} - -static int orinoco_ioctl_reset(struct net_device *dev, - struct iw_request_info *info, - void *wrqu, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (info->cmd == (SIOCIWFIRSTPRIV + 0x1)) { - printk(KERN_DEBUG "%s: Forcing reset!\n", dev->name); - - /* Firmware reset */ - orinoco_reset(&priv->reset_work); - } else { - printk(KERN_DEBUG "%s: Force scheduling reset!\n", dev->name); - - schedule_work(&priv->reset_work); - } - - return 0; -} - -static int orinoco_ioctl_setibssport(struct net_device *dev, - struct iw_request_info *info, - void *wrqu, - char *extra) - -{ - struct orinoco_private *priv = ndev_priv(dev); - int val = *((int *) extra); - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - priv->ibss_port = val; - - /* Actually update the mode we are using */ - set_port_type(priv); - - orinoco_unlock(priv, &flags); - return -EINPROGRESS; /* Call commit handler */ -} - -static int orinoco_ioctl_getibssport(struct net_device *dev, - struct iw_request_info *info, - void *wrqu, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - int *val = (int *) extra; - - *val = priv->ibss_port; - return 0; -} - -static int orinoco_ioctl_setport3(struct net_device *dev, - struct iw_request_info *info, - void *wrqu, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - int val = *((int *) extra); - int err = 0; - unsigned long flags; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - switch (val) { - case 0: /* Try to do IEEE ad-hoc mode */ - if (!priv->has_ibss) { - err = -EINVAL; - break; - } - priv->prefer_port3 = 0; - - break; - - case 1: /* Try to do Lucent proprietary ad-hoc mode */ - if (!priv->has_port3) { - err = -EINVAL; - break; - } - priv->prefer_port3 = 1; - break; - - default: - err = -EINVAL; - } - - if (!err) { - /* Actually update the mode we are using */ - set_port_type(priv); - err = -EINPROGRESS; - } - - orinoco_unlock(priv, &flags); - - return err; -} - -static int orinoco_ioctl_getport3(struct net_device *dev, - struct iw_request_info *info, - void *wrqu, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - int *val = (int *) extra; - - *val = priv->prefer_port3; - return 0; -} - -static int orinoco_ioctl_setpreamble(struct net_device *dev, - struct iw_request_info *info, - void *wrqu, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - unsigned long flags; - int val; - - if (!priv->has_preamble) - return -EOPNOTSUPP; - - /* 802.11b has recently defined some short preamble. - * Basically, the Phy header has been reduced in size. - * This increase performance, especially at high rates - * (the preamble is transmitted at 1Mb/s), unfortunately - * this give compatibility troubles... - Jean II */ - val = *((int *) extra); - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - if (val) - priv->preamble = 1; - else - priv->preamble = 0; - - orinoco_unlock(priv, &flags); - - return -EINPROGRESS; /* Call commit handler */ -} - -static int orinoco_ioctl_getpreamble(struct net_device *dev, - struct iw_request_info *info, - void *wrqu, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - int *val = (int *) extra; - - if (!priv->has_preamble) - return -EOPNOTSUPP; - - *val = priv->preamble; - return 0; -} - -/* ioctl interface to hermes_read_ltv() - * To use with iwpriv, pass the RID as the token argument, e.g. - * iwpriv get_rid [0xfc00] - * At least Wireless Tools 25 is required to use iwpriv. - * For Wireless Tools 25 and 26 append "dummy" are the end. */ -static int orinoco_ioctl_getrid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - struct hermes *hw = &priv->hw; - int rid = data->flags; - u16 length; - int err; - unsigned long flags; - - /* It's a "get" function, but we don't want users to access the - * WEP key and other raw firmware data */ - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (rid < 0xfc00 || rid > 0xffff) - return -EINVAL; - - if (orinoco_lock(priv, &flags) != 0) - return -EBUSY; - - err = hw->ops->read_ltv(hw, USER_BAP, rid, MAX_RID_LEN, &length, - extra); - if (err) - goto out; - - data->length = min_t(u16, HERMES_RECLEN_TO_BYTES(length), - MAX_RID_LEN); - - out: - orinoco_unlock(priv, &flags); - return err; -} - - -/* Commit handler, called after set operations */ -static int orinoco_ioctl_commit(struct net_device *dev, - struct iw_request_info *info, - void *wrqu, - char *extra) -{ - struct orinoco_private *priv = ndev_priv(dev); - unsigned long flags; - int err = 0; - - if (!priv->open) - return 0; - - if (orinoco_lock(priv, &flags) != 0) - return err; - - err = orinoco_commit(priv); - - orinoco_unlock(priv, &flags); - return err; -} - -static const struct iw_priv_args orinoco_privtab[] = { - { SIOCIWFIRSTPRIV + 0x0, 0, 0, "force_reset" }, - { SIOCIWFIRSTPRIV + 0x1, 0, 0, "card_reset" }, - { SIOCIWFIRSTPRIV + 0x2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - 0, "set_port3" }, - { SIOCIWFIRSTPRIV + 0x3, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - "get_port3" }, - { SIOCIWFIRSTPRIV + 0x4, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - 0, "set_preamble" }, - { SIOCIWFIRSTPRIV + 0x5, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - "get_preamble" }, - { SIOCIWFIRSTPRIV + 0x6, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - 0, "set_ibssport" }, - { SIOCIWFIRSTPRIV + 0x7, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - "get_ibssport" }, - { SIOCIWFIRSTPRIV + 0x9, 0, IW_PRIV_TYPE_BYTE | MAX_RID_LEN, - "get_rid" }, -}; - - -/* - * Structures to export the Wireless Handlers - */ - -static const iw_handler orinoco_handler[] = { - IW_HANDLER(SIOCSIWCOMMIT, (iw_handler)orinoco_ioctl_commit), - IW_HANDLER(SIOCGIWNAME, (iw_handler)cfg80211_wext_giwname), - IW_HANDLER(SIOCSIWFREQ, (iw_handler)orinoco_ioctl_setfreq), - IW_HANDLER(SIOCGIWFREQ, (iw_handler)orinoco_ioctl_getfreq), - IW_HANDLER(SIOCSIWMODE, (iw_handler)cfg80211_wext_siwmode), - IW_HANDLER(SIOCGIWMODE, (iw_handler)cfg80211_wext_giwmode), - IW_HANDLER(SIOCSIWSENS, (iw_handler)orinoco_ioctl_setsens), - IW_HANDLER(SIOCGIWSENS, (iw_handler)orinoco_ioctl_getsens), - IW_HANDLER(SIOCGIWRANGE, (iw_handler)cfg80211_wext_giwrange), - IW_HANDLER(SIOCSIWSPY, iw_handler_set_spy), - IW_HANDLER(SIOCGIWSPY, iw_handler_get_spy), - IW_HANDLER(SIOCSIWTHRSPY, iw_handler_set_thrspy), - IW_HANDLER(SIOCGIWTHRSPY, iw_handler_get_thrspy), - IW_HANDLER(SIOCSIWAP, (iw_handler)orinoco_ioctl_setwap), - IW_HANDLER(SIOCGIWAP, (iw_handler)orinoco_ioctl_getwap), - IW_HANDLER(SIOCSIWSCAN, (iw_handler)cfg80211_wext_siwscan), - IW_HANDLER(SIOCGIWSCAN, (iw_handler)cfg80211_wext_giwscan), - IW_HANDLER(SIOCSIWESSID, (iw_handler)orinoco_ioctl_setessid), - IW_HANDLER(SIOCGIWESSID, (iw_handler)orinoco_ioctl_getessid), - IW_HANDLER(SIOCSIWRATE, (iw_handler)orinoco_ioctl_setrate), - IW_HANDLER(SIOCGIWRATE, (iw_handler)orinoco_ioctl_getrate), - IW_HANDLER(SIOCSIWRTS, (iw_handler)cfg80211_wext_siwrts), - IW_HANDLER(SIOCGIWRTS, (iw_handler)cfg80211_wext_giwrts), - IW_HANDLER(SIOCSIWFRAG, (iw_handler)cfg80211_wext_siwfrag), - IW_HANDLER(SIOCGIWFRAG, (iw_handler)cfg80211_wext_giwfrag), - IW_HANDLER(SIOCGIWRETRY, (iw_handler)cfg80211_wext_giwretry), - IW_HANDLER(SIOCSIWENCODE, (iw_handler)orinoco_ioctl_setiwencode), - IW_HANDLER(SIOCGIWENCODE, (iw_handler)orinoco_ioctl_getiwencode), - IW_HANDLER(SIOCSIWPOWER, (iw_handler)orinoco_ioctl_setpower), - IW_HANDLER(SIOCGIWPOWER, (iw_handler)orinoco_ioctl_getpower), - IW_HANDLER(SIOCSIWGENIE, orinoco_ioctl_set_genie), - IW_HANDLER(SIOCGIWGENIE, orinoco_ioctl_get_genie), - IW_HANDLER(SIOCSIWMLME, orinoco_ioctl_set_mlme), - IW_HANDLER(SIOCSIWAUTH, orinoco_ioctl_set_auth), - IW_HANDLER(SIOCGIWAUTH, orinoco_ioctl_get_auth), - IW_HANDLER(SIOCSIWENCODEEXT, orinoco_ioctl_set_encodeext), - IW_HANDLER(SIOCGIWENCODEEXT, orinoco_ioctl_get_encodeext), -}; - - -/* - Added typecasting since we no longer use iwreq_data -- Moustafa - */ -static const iw_handler orinoco_private_handler[] = { - [0] = (iw_handler)orinoco_ioctl_reset, - [1] = (iw_handler)orinoco_ioctl_reset, - [2] = (iw_handler)orinoco_ioctl_setport3, - [3] = (iw_handler)orinoco_ioctl_getport3, - [4] = (iw_handler)orinoco_ioctl_setpreamble, - [5] = (iw_handler)orinoco_ioctl_getpreamble, - [6] = (iw_handler)orinoco_ioctl_setibssport, - [7] = (iw_handler)orinoco_ioctl_getibssport, - [9] = (iw_handler)orinoco_ioctl_getrid, -}; - -const struct iw_handler_def orinoco_handler_def = { - .num_standard = ARRAY_SIZE(orinoco_handler), - .num_private = ARRAY_SIZE(orinoco_private_handler), - .num_private_args = ARRAY_SIZE(orinoco_privtab), - .standard = orinoco_handler, - .private = orinoco_private_handler, - .private_args = orinoco_privtab, - .get_wireless_stats = orinoco_get_wireless_stats, -}; diff --git a/drivers/net/wireless/orinoco/wext.h b/drivers/net/wireless/orinoco/wext.h deleted file mode 100644 index 1479f4e26dde..000000000000 --- a/drivers/net/wireless/orinoco/wext.h +++ /dev/null @@ -1,13 +0,0 @@ -/* Wireless extensions support. - * - * See copyright notice in main.c - */ -#ifndef _ORINOCO_WEXT_H_ -#define _ORINOCO_WEXT_H_ - -#include - -/* Structure defining all our WEXT handlers */ -extern const struct iw_handler_def orinoco_handler_def; - -#endif /* _ORINOCO_WEXT_H_ */ diff --git a/drivers/net/wireless/p54/Kconfig b/drivers/net/wireless/p54/Kconfig deleted file mode 100644 index 15ea36b51a66..000000000000 --- a/drivers/net/wireless/p54/Kconfig +++ /dev/null @@ -1,71 +0,0 @@ -config P54_COMMON - tristate "Softmac Prism54 support" - depends on MAC80211 - select FW_LOADER - select CRC_CCITT - ---help--- - This is common code for isl38xx/stlc45xx based modules. - This module does nothing by itself - the USB/PCI/SPI front-ends - also need to be enabled in order to support any devices. - - These devices require softmac firmware which can be found at - - - If you choose to build a module, it'll be called p54common. - -config P54_USB - tristate "Prism54 USB support" - depends on P54_COMMON && USB - select CRC32 - ---help--- - This driver is for USB isl38xx based wireless cards. - - These devices require softmac firmware which can be found at - - - If you choose to build a module, it'll be called p54usb. - -config P54_PCI - tristate "Prism54 PCI support" - depends on P54_COMMON && PCI - ---help--- - This driver is for PCI isl38xx based wireless cards. - This driver supports most devices that are supported by the - fullmac prism54 driver plus many devices which are not - supported by the fullmac driver/firmware. - - This driver requires softmac firmware which can be found at - - - If you choose to build a module, it'll be called p54pci. - -config P54_SPI - tristate "Prism54 SPI (stlc45xx) support" - depends on P54_COMMON && SPI_MASTER && GENERIC_HARDIRQS - ---help--- - This driver is for stlc4550 or stlc4560 based wireless chips - such as Nokia's N800/N810 Portable Internet Tablet. - - If you choose to build a module, it'll be called p54spi. - -config P54_SPI_DEFAULT_EEPROM - bool "Include fallback EEPROM blob" - depends on P54_SPI - default n - ---help--- - Unlike the PCI or USB devices, the SPI variants don't have - a dedicated EEPROM chip to store all device specific values - for calibration, country and interface settings. - - The driver will try to load the image "3826.eeprom", if the - file is put at the right place. (usually /lib/firmware.) - - Only if this request fails, this option will provide a - backup set of generic values to get the device working. - - Enabling this option adds about 4k to p54spi. - -config P54_LEDS - bool - depends on P54_COMMON && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = P54_COMMON) - default y diff --git a/drivers/net/wireless/p54/Makefile b/drivers/net/wireless/p54/Makefile deleted file mode 100644 index b542e68f1781..000000000000 --- a/drivers/net/wireless/p54/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -p54common-objs := eeprom.o fwio.o txrx.o main.o -p54common-$(CONFIG_P54_LEDS) += led.o - -obj-$(CONFIG_P54_COMMON) += p54common.o -obj-$(CONFIG_P54_USB) += p54usb.o -obj-$(CONFIG_P54_PCI) += p54pci.o -obj-$(CONFIG_P54_SPI) += p54spi.o diff --git a/drivers/net/wireless/p54/eeprom.c b/drivers/net/wireless/p54/eeprom.c deleted file mode 100644 index d43e3740e45d..000000000000 --- a/drivers/net/wireless/p54/eeprom.c +++ /dev/null @@ -1,983 +0,0 @@ -/* - * EEPROM parser code for mac80211 Prism54 drivers - * - * Copyright (c) 2006, Michael Wu - * Copyright (c) 2007-2009, Christian Lamparter - * Copyright 2008, Johannes Berg - * - * Based on: - * - the islsm (softmac prism54) driver, which is: - * Copyright 2004-2006 Jean-Baptiste Note , et al. - * - stlc45xx driver - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "p54.h" -#include "eeprom.h" -#include "lmac.h" - -static struct ieee80211_rate p54_bgrates[] = { - { .bitrate = 10, .hw_value = 0, }, - { .bitrate = 20, .hw_value = 1, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 55, .hw_value = 2, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 110, .hw_value = 3, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 60, .hw_value = 4, }, - { .bitrate = 90, .hw_value = 5, }, - { .bitrate = 120, .hw_value = 6, }, - { .bitrate = 180, .hw_value = 7, }, - { .bitrate = 240, .hw_value = 8, }, - { .bitrate = 360, .hw_value = 9, }, - { .bitrate = 480, .hw_value = 10, }, - { .bitrate = 540, .hw_value = 11, }, -}; - -static struct ieee80211_rate p54_arates[] = { - { .bitrate = 60, .hw_value = 4, }, - { .bitrate = 90, .hw_value = 5, }, - { .bitrate = 120, .hw_value = 6, }, - { .bitrate = 180, .hw_value = 7, }, - { .bitrate = 240, .hw_value = 8, }, - { .bitrate = 360, .hw_value = 9, }, - { .bitrate = 480, .hw_value = 10, }, - { .bitrate = 540, .hw_value = 11, }, -}; - -static struct p54_rssi_db_entry p54_rssi_default = { - /* - * The defaults are taken from usb-logs of the - * vendor driver. So, they should be safe to - * use in case we can't get a match from the - * rssi <-> dBm conversion database. - */ - .mul = 130, - .add = -398, -}; - -#define CHAN_HAS_CAL BIT(0) -#define CHAN_HAS_LIMIT BIT(1) -#define CHAN_HAS_CURVE BIT(2) -#define CHAN_HAS_ALL (CHAN_HAS_CAL | CHAN_HAS_LIMIT | CHAN_HAS_CURVE) - -struct p54_channel_entry { - u16 freq; - u16 data; - int index; - int max_power; - enum ieee80211_band band; -}; - -struct p54_channel_list { - struct p54_channel_entry *channels; - size_t entries; - size_t max_entries; - size_t band_channel_num[IEEE80211_NUM_BANDS]; -}; - -static int p54_get_band_from_freq(u16 freq) -{ - /* FIXME: sync these values with the 802.11 spec */ - - if ((freq >= 2412) && (freq <= 2484)) - return IEEE80211_BAND_2GHZ; - - if ((freq >= 4920) && (freq <= 5825)) - return IEEE80211_BAND_5GHZ; - - return -1; -} - -static int same_band(u16 freq, u16 freq2) -{ - return p54_get_band_from_freq(freq) == p54_get_band_from_freq(freq2); -} - -static int p54_compare_channels(const void *_a, - const void *_b) -{ - const struct p54_channel_entry *a = _a; - const struct p54_channel_entry *b = _b; - - return a->freq - b->freq; -} - -static int p54_compare_rssichan(const void *_a, - const void *_b) -{ - const struct p54_rssi_db_entry *a = _a; - const struct p54_rssi_db_entry *b = _b; - - return a->freq - b->freq; -} - -static int p54_fill_band_bitrates(struct ieee80211_hw *dev, - struct ieee80211_supported_band *band_entry, - enum ieee80211_band band) -{ - /* TODO: generate rate array dynamically */ - - switch (band) { - case IEEE80211_BAND_2GHZ: - band_entry->bitrates = p54_bgrates; - band_entry->n_bitrates = ARRAY_SIZE(p54_bgrates); - break; - case IEEE80211_BAND_5GHZ: - band_entry->bitrates = p54_arates; - band_entry->n_bitrates = ARRAY_SIZE(p54_arates); - break; - default: - return -EINVAL; - } - - return 0; -} - -static int p54_generate_band(struct ieee80211_hw *dev, - struct p54_channel_list *list, - unsigned int *chan_num, - enum ieee80211_band band) -{ - struct p54_common *priv = dev->priv; - struct ieee80211_supported_band *tmp, *old; - unsigned int i, j; - int ret = -ENOMEM; - - if ((!list->entries) || (!list->band_channel_num[band])) - return -EINVAL; - - tmp = kzalloc(sizeof(*tmp), GFP_KERNEL); - if (!tmp) - goto err_out; - - tmp->channels = kzalloc(sizeof(struct ieee80211_channel) * - list->band_channel_num[band], GFP_KERNEL); - if (!tmp->channels) - goto err_out; - - ret = p54_fill_band_bitrates(dev, tmp, band); - if (ret) - goto err_out; - - for (i = 0, j = 0; (j < list->band_channel_num[band]) && - (i < list->entries); i++) { - struct p54_channel_entry *chan = &list->channels[i]; - struct ieee80211_channel *dest = &tmp->channels[j]; - - if (chan->band != band) - continue; - - if (chan->data != CHAN_HAS_ALL) { - wiphy_err(dev->wiphy, "%s%s%s is/are missing for " - "channel:%d [%d MHz].\n", - (chan->data & CHAN_HAS_CAL ? "" : - " [iqauto calibration data]"), - (chan->data & CHAN_HAS_LIMIT ? "" : - " [output power limits]"), - (chan->data & CHAN_HAS_CURVE ? "" : - " [curve data]"), - chan->index, chan->freq); - continue; - } - - dest->band = chan->band; - dest->center_freq = chan->freq; - dest->max_power = chan->max_power; - priv->survey[*chan_num].channel = &tmp->channels[j]; - priv->survey[*chan_num].filled = SURVEY_INFO_NOISE_DBM | - SURVEY_INFO_CHANNEL_TIME | - SURVEY_INFO_CHANNEL_TIME_BUSY | - SURVEY_INFO_CHANNEL_TIME_TX; - dest->hw_value = (*chan_num); - j++; - (*chan_num)++; - } - - if (j == 0) { - wiphy_err(dev->wiphy, "Disabling totally damaged %d GHz band\n", - (band == IEEE80211_BAND_2GHZ) ? 2 : 5); - - ret = -ENODATA; - goto err_out; - } - - tmp->n_channels = j; - old = priv->band_table[band]; - priv->band_table[band] = tmp; - if (old) { - kfree(old->channels); - kfree(old); - } - - return 0; - -err_out: - if (tmp) { - kfree(tmp->channels); - kfree(tmp); - } - - return ret; -} - -static struct p54_channel_entry *p54_update_channel_param(struct p54_channel_list *list, - u16 freq, u16 data) -{ - int i; - struct p54_channel_entry *entry = NULL; - - /* - * usually all lists in the eeprom are mostly sorted. - * so it's very likely that the entry we are looking for - * is right at the end of the list - */ - for (i = list->entries; i >= 0; i--) { - if (freq == list->channels[i].freq) { - entry = &list->channels[i]; - break; - } - } - - if ((i < 0) && (list->entries < list->max_entries)) { - /* entry does not exist yet. Initialize a new one. */ - int band = p54_get_band_from_freq(freq); - - /* - * filter out frequencies which don't belong into - * any supported band. - */ - if (band >= 0) { - i = list->entries++; - list->band_channel_num[band]++; - - entry = &list->channels[i]; - entry->freq = freq; - entry->band = band; - entry->index = ieee80211_frequency_to_channel(freq); - entry->max_power = 0; - entry->data = 0; - } - } - - if (entry) - entry->data |= data; - - return entry; -} - -static int p54_get_maxpower(struct p54_common *priv, void *data) -{ - switch (priv->rxhw & PDR_SYNTH_FRONTEND_MASK) { - case PDR_SYNTH_FRONTEND_LONGBOW: { - struct pda_channel_output_limit_longbow *pda = data; - int j; - u16 rawpower = 0; - pda = data; - for (j = 0; j < ARRAY_SIZE(pda->point); j++) { - struct pda_channel_output_limit_point_longbow *point = - &pda->point[j]; - rawpower = max_t(u16, - rawpower, le16_to_cpu(point->val_qpsk)); - rawpower = max_t(u16, - rawpower, le16_to_cpu(point->val_bpsk)); - rawpower = max_t(u16, - rawpower, le16_to_cpu(point->val_16qam)); - rawpower = max_t(u16, - rawpower, le16_to_cpu(point->val_64qam)); - } - /* longbow seems to use 1/16 dBm units */ - return rawpower / 16; - } - - case PDR_SYNTH_FRONTEND_DUETTE3: - case PDR_SYNTH_FRONTEND_DUETTE2: - case PDR_SYNTH_FRONTEND_FRISBEE: - case PDR_SYNTH_FRONTEND_XBOW: { - struct pda_channel_output_limit *pda = data; - u8 rawpower = 0; - rawpower = max(rawpower, pda->val_qpsk); - rawpower = max(rawpower, pda->val_bpsk); - rawpower = max(rawpower, pda->val_16qam); - rawpower = max(rawpower, pda->val_64qam); - /* raw values are in 1/4 dBm units */ - return rawpower / 4; - } - - default: - return 20; - } -} - -static int p54_generate_channel_lists(struct ieee80211_hw *dev) -{ - struct p54_common *priv = dev->priv; - struct p54_channel_list *list; - unsigned int i, j, k, max_channel_num; - int ret = 0; - u16 freq; - - if ((priv->iq_autocal_len != priv->curve_data->entries) || - (priv->iq_autocal_len != priv->output_limit->entries)) - wiphy_err(dev->wiphy, - "Unsupported or damaged EEPROM detected. " - "You may not be able to use all channels.\n"); - - max_channel_num = max_t(unsigned int, priv->output_limit->entries, - priv->iq_autocal_len); - max_channel_num = max_t(unsigned int, max_channel_num, - priv->curve_data->entries); - - list = kzalloc(sizeof(*list), GFP_KERNEL); - if (!list) { - ret = -ENOMEM; - goto free; - } - priv->chan_num = max_channel_num; - priv->survey = kzalloc(sizeof(struct survey_info) * max_channel_num, - GFP_KERNEL); - if (!priv->survey) { - ret = -ENOMEM; - goto free; - } - - list->max_entries = max_channel_num; - list->channels = kzalloc(sizeof(struct p54_channel_entry) * - max_channel_num, GFP_KERNEL); - if (!list->channels) { - ret = -ENOMEM; - goto free; - } - - for (i = 0; i < max_channel_num; i++) { - if (i < priv->iq_autocal_len) { - freq = le16_to_cpu(priv->iq_autocal[i].freq); - p54_update_channel_param(list, freq, CHAN_HAS_CAL); - } - - if (i < priv->output_limit->entries) { - struct p54_channel_entry *tmp; - - void *data = (void *) ((unsigned long) i * - priv->output_limit->entry_size + - priv->output_limit->offset + - priv->output_limit->data); - - freq = le16_to_cpup((__le16 *) data); - tmp = p54_update_channel_param(list, freq, - CHAN_HAS_LIMIT); - if (tmp) { - tmp->max_power = p54_get_maxpower(priv, data); - } - } - - if (i < priv->curve_data->entries) { - freq = le16_to_cpup((__le16 *) (i * - priv->curve_data->entry_size + - priv->curve_data->offset + - priv->curve_data->data)); - - p54_update_channel_param(list, freq, CHAN_HAS_CURVE); - } - } - - /* sort the channel list by frequency */ - sort(list->channels, list->entries, sizeof(struct p54_channel_entry), - p54_compare_channels, NULL); - - k = 0; - for (i = 0, j = 0; i < IEEE80211_NUM_BANDS; i++) { - if (p54_generate_band(dev, list, &k, i) == 0) - j++; - } - if (j == 0) { - /* no useable band available. */ - ret = -EINVAL; - } - -free: - if (list) { - kfree(list->channels); - kfree(list); - } - if (ret) { - kfree(priv->survey); - priv->survey = NULL; - } - - return ret; -} - -static int p54_convert_rev0(struct ieee80211_hw *dev, - struct pda_pa_curve_data *curve_data) -{ - struct p54_common *priv = dev->priv; - struct p54_pa_curve_data_sample *dst; - struct pda_pa_curve_data_sample_rev0 *src; - size_t cd_len = sizeof(*curve_data) + - (curve_data->points_per_channel*sizeof(*dst) + 2) * - curve_data->channels; - unsigned int i, j; - void *source, *target; - - priv->curve_data = kmalloc(sizeof(*priv->curve_data) + cd_len, - GFP_KERNEL); - if (!priv->curve_data) - return -ENOMEM; - - priv->curve_data->entries = curve_data->channels; - priv->curve_data->entry_size = sizeof(__le16) + - sizeof(*dst) * curve_data->points_per_channel; - priv->curve_data->offset = offsetof(struct pda_pa_curve_data, data); - priv->curve_data->len = cd_len; - memcpy(priv->curve_data->data, curve_data, sizeof(*curve_data)); - source = curve_data->data; - target = ((struct pda_pa_curve_data *) priv->curve_data->data)->data; - for (i = 0; i < curve_data->channels; i++) { - __le16 *freq = source; - source += sizeof(__le16); - *((__le16 *)target) = *freq; - target += sizeof(__le16); - for (j = 0; j < curve_data->points_per_channel; j++) { - dst = target; - src = source; - - dst->rf_power = src->rf_power; - dst->pa_detector = src->pa_detector; - dst->data_64qam = src->pcv; - /* "invent" the points for the other modulations */ -#define SUB(x, y) (u8)(((x) - (y)) > (x) ? 0 : (x) - (y)) - dst->data_16qam = SUB(src->pcv, 12); - dst->data_qpsk = SUB(dst->data_16qam, 12); - dst->data_bpsk = SUB(dst->data_qpsk, 12); - dst->data_barker = SUB(dst->data_bpsk, 14); -#undef SUB - target += sizeof(*dst); - source += sizeof(*src); - } - } - - return 0; -} - -static int p54_convert_rev1(struct ieee80211_hw *dev, - struct pda_pa_curve_data *curve_data) -{ - struct p54_common *priv = dev->priv; - struct p54_pa_curve_data_sample *dst; - struct pda_pa_curve_data_sample_rev1 *src; - size_t cd_len = sizeof(*curve_data) + - (curve_data->points_per_channel*sizeof(*dst) + 2) * - curve_data->channels; - unsigned int i, j; - void *source, *target; - - priv->curve_data = kzalloc(cd_len + sizeof(*priv->curve_data), - GFP_KERNEL); - if (!priv->curve_data) - return -ENOMEM; - - priv->curve_data->entries = curve_data->channels; - priv->curve_data->entry_size = sizeof(__le16) + - sizeof(*dst) * curve_data->points_per_channel; - priv->curve_data->offset = offsetof(struct pda_pa_curve_data, data); - priv->curve_data->len = cd_len; - memcpy(priv->curve_data->data, curve_data, sizeof(*curve_data)); - source = curve_data->data; - target = ((struct pda_pa_curve_data *) priv->curve_data->data)->data; - for (i = 0; i < curve_data->channels; i++) { - __le16 *freq = source; - source += sizeof(__le16); - *((__le16 *)target) = *freq; - target += sizeof(__le16); - for (j = 0; j < curve_data->points_per_channel; j++) { - memcpy(target, source, sizeof(*src)); - - target += sizeof(*dst); - source += sizeof(*src); - } - source++; - } - - return 0; -} - -static const char *p54_rf_chips[] = { "INVALID-0", "Duette3", "Duette2", - "Frisbee", "Xbow", "Longbow", "INVALID-6", "INVALID-7" }; - -static int p54_parse_rssical(struct ieee80211_hw *dev, - u8 *data, int len, u16 type) -{ - struct p54_common *priv = dev->priv; - struct p54_rssi_db_entry *entry; - size_t db_len, entries; - int offset = 0, i; - - if (type != PDR_RSSI_LINEAR_APPROXIMATION_EXTENDED) { - entries = (type == PDR_RSSI_LINEAR_APPROXIMATION) ? 1 : 2; - if (len != sizeof(struct pda_rssi_cal_entry) * entries) { - wiphy_err(dev->wiphy, "rssical size mismatch.\n"); - goto err_data; - } - } else { - /* - * Some devices (Dell 1450 USB, Xbow 5GHz card, etc...) - * have an empty two byte header. - */ - if (*((__le16 *)&data[offset]) == cpu_to_le16(0)) - offset += 2; - - entries = (len - offset) / - sizeof(struct pda_rssi_cal_ext_entry); - - if (len < offset || - (len - offset) % sizeof(struct pda_rssi_cal_ext_entry) || - entries == 0) { - wiphy_err(dev->wiphy, "invalid rssi database.\n"); - goto err_data; - } - } - - db_len = sizeof(*entry) * entries; - priv->rssi_db = kzalloc(db_len + sizeof(*priv->rssi_db), GFP_KERNEL); - if (!priv->rssi_db) - return -ENOMEM; - - priv->rssi_db->offset = 0; - priv->rssi_db->entries = entries; - priv->rssi_db->entry_size = sizeof(*entry); - priv->rssi_db->len = db_len; - - entry = (void *)((unsigned long)priv->rssi_db->data + priv->rssi_db->offset); - if (type == PDR_RSSI_LINEAR_APPROXIMATION_EXTENDED) { - struct pda_rssi_cal_ext_entry *cal = (void *) &data[offset]; - - for (i = 0; i < entries; i++) { - entry[i].freq = le16_to_cpu(cal[i].freq); - entry[i].mul = (s16) le16_to_cpu(cal[i].mul); - entry[i].add = (s16) le16_to_cpu(cal[i].add); - } - } else { - struct pda_rssi_cal_entry *cal = (void *) &data[offset]; - - for (i = 0; i < entries; i++) { - u16 freq = 0; - switch (i) { - case IEEE80211_BAND_2GHZ: - freq = 2437; - break; - case IEEE80211_BAND_5GHZ: - freq = 5240; - break; - } - - entry[i].freq = freq; - entry[i].mul = (s16) le16_to_cpu(cal[i].mul); - entry[i].add = (s16) le16_to_cpu(cal[i].add); - } - } - - /* sort the list by channel frequency */ - sort(entry, entries, sizeof(*entry), p54_compare_rssichan, NULL); - return 0; - -err_data: - wiphy_err(dev->wiphy, - "rssi calibration data packing type:(%x) len:%d.\n", - type, len); - - print_hex_dump_bytes("rssical:", DUMP_PREFIX_NONE, data, len); - - wiphy_err(dev->wiphy, "please report this issue.\n"); - return -EINVAL; -} - -struct p54_rssi_db_entry *p54_rssi_find(struct p54_common *priv, const u16 freq) -{ - struct p54_rssi_db_entry *entry; - int i, found = -1; - - if (!priv->rssi_db) - return &p54_rssi_default; - - entry = (void *)(priv->rssi_db->data + priv->rssi_db->offset); - for (i = 0; i < priv->rssi_db->entries; i++) { - if (!same_band(freq, entry[i].freq)) - continue; - - if (found == -1) { - found = i; - continue; - } - - /* nearest match */ - if (abs(freq - entry[i].freq) < - abs(freq - entry[found].freq)) { - found = i; - continue; - } else { - break; - } - } - - return found < 0 ? &p54_rssi_default : &entry[found]; -} - -static void p54_parse_default_country(struct ieee80211_hw *dev, - void *data, int len) -{ - struct pda_country *country; - - if (len != sizeof(*country)) { - wiphy_err(dev->wiphy, - "found possible invalid default country eeprom entry. (entry size: %d)\n", - len); - - print_hex_dump_bytes("country:", DUMP_PREFIX_NONE, - data, len); - - wiphy_err(dev->wiphy, "please report this issue.\n"); - return; - } - - country = (struct pda_country *) data; - if (country->flags == PDR_COUNTRY_CERT_CODE_PSEUDO) - regulatory_hint(dev->wiphy, country->alpha2); - else { - /* TODO: - * write a shared/common function that converts - * "Regulatory domain codes" (802.11-2007 14.8.2.2) - * into ISO/IEC 3166-1 alpha2 for regulatory_hint. - */ - } -} - -static int p54_convert_output_limits(struct ieee80211_hw *dev, - u8 *data, size_t len) -{ - struct p54_common *priv = dev->priv; - - if (len < 2) - return -EINVAL; - - if (data[0] != 0) { - wiphy_err(dev->wiphy, "unknown output power db revision:%x\n", - data[0]); - return -EINVAL; - } - - if (2 + data[1] * sizeof(struct pda_channel_output_limit) > len) - return -EINVAL; - - priv->output_limit = kmalloc(data[1] * - sizeof(struct pda_channel_output_limit) + - sizeof(*priv->output_limit), GFP_KERNEL); - - if (!priv->output_limit) - return -ENOMEM; - - priv->output_limit->offset = 0; - priv->output_limit->entries = data[1]; - priv->output_limit->entry_size = - sizeof(struct pda_channel_output_limit); - priv->output_limit->len = priv->output_limit->entry_size * - priv->output_limit->entries + - priv->output_limit->offset; - - memcpy(priv->output_limit->data, &data[2], - data[1] * sizeof(struct pda_channel_output_limit)); - - return 0; -} - -static struct p54_cal_database *p54_convert_db(struct pda_custom_wrapper *src, - size_t total_len) -{ - struct p54_cal_database *dst; - size_t payload_len, entries, entry_size, offset; - - payload_len = le16_to_cpu(src->len); - entries = le16_to_cpu(src->entries); - entry_size = le16_to_cpu(src->entry_size); - offset = le16_to_cpu(src->offset); - if (((entries * entry_size + offset) != payload_len) || - (payload_len + sizeof(*src) != total_len)) - return NULL; - - dst = kmalloc(sizeof(*dst) + payload_len, GFP_KERNEL); - if (!dst) - return NULL; - - dst->entries = entries; - dst->entry_size = entry_size; - dst->offset = offset; - dst->len = payload_len; - - memcpy(dst->data, src->data, payload_len); - return dst; -} - -int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) -{ - struct p54_common *priv = dev->priv; - struct eeprom_pda_wrap *wrap; - struct pda_entry *entry; - unsigned int data_len, entry_len; - void *tmp; - int err; - u8 *end = (u8 *)eeprom + len; - u16 synth = 0; - u16 crc16 = ~0; - - wrap = (struct eeprom_pda_wrap *) eeprom; - entry = (void *)wrap->data + le16_to_cpu(wrap->len); - - /* verify that at least the entry length/code fits */ - while ((u8 *)entry <= end - sizeof(*entry)) { - entry_len = le16_to_cpu(entry->len); - data_len = ((entry_len - 1) << 1); - - /* abort if entry exceeds whole structure */ - if ((u8 *)entry + sizeof(*entry) + data_len > end) - break; - - switch (le16_to_cpu(entry->code)) { - case PDR_MAC_ADDRESS: - if (data_len != ETH_ALEN) - break; - SET_IEEE80211_PERM_ADDR(dev, entry->data); - break; - case PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS: - if (priv->output_limit) - break; - err = p54_convert_output_limits(dev, entry->data, - data_len); - if (err) - goto err; - break; - case PDR_PRISM_PA_CAL_CURVE_DATA: { - struct pda_pa_curve_data *curve_data = - (struct pda_pa_curve_data *)entry->data; - if (data_len < sizeof(*curve_data)) { - err = -EINVAL; - goto err; - } - - switch (curve_data->cal_method_rev) { - case 0: - err = p54_convert_rev0(dev, curve_data); - break; - case 1: - err = p54_convert_rev1(dev, curve_data); - break; - default: - wiphy_err(dev->wiphy, - "unknown curve data revision %d\n", - curve_data->cal_method_rev); - err = -ENODEV; - break; - } - if (err) - goto err; - } - break; - case PDR_PRISM_ZIF_TX_IQ_CALIBRATION: - priv->iq_autocal = kmemdup(entry->data, data_len, - GFP_KERNEL); - if (!priv->iq_autocal) { - err = -ENOMEM; - goto err; - } - - priv->iq_autocal_len = data_len / sizeof(struct pda_iq_autocal_entry); - break; - case PDR_DEFAULT_COUNTRY: - p54_parse_default_country(dev, entry->data, data_len); - break; - case PDR_INTERFACE_LIST: - tmp = entry->data; - while ((u8 *)tmp < entry->data + data_len) { - struct exp_if *exp_if = tmp; - if (exp_if->if_id == cpu_to_le16(IF_ID_ISL39000)) - synth = le16_to_cpu(exp_if->variant); - tmp += sizeof(*exp_if); - } - break; - case PDR_HARDWARE_PLATFORM_COMPONENT_ID: - if (data_len < 2) - break; - priv->version = *(u8 *)(entry->data + 1); - break; - case PDR_RSSI_LINEAR_APPROXIMATION: - case PDR_RSSI_LINEAR_APPROXIMATION_DUAL_BAND: - case PDR_RSSI_LINEAR_APPROXIMATION_EXTENDED: - err = p54_parse_rssical(dev, entry->data, data_len, - le16_to_cpu(entry->code)); - if (err) - goto err; - break; - case PDR_RSSI_LINEAR_APPROXIMATION_CUSTOMV2: { - struct pda_custom_wrapper *pda = (void *) entry->data; - __le16 *src; - u16 *dst; - int i; - - if (priv->rssi_db || data_len < sizeof(*pda)) - break; - - priv->rssi_db = p54_convert_db(pda, data_len); - if (!priv->rssi_db) - break; - - src = (void *) priv->rssi_db->data; - dst = (void *) priv->rssi_db->data; - - for (i = 0; i < priv->rssi_db->entries; i++) - *(dst++) = (s16) le16_to_cpu(*(src++)); - - } - break; - case PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS_CUSTOM: { - struct pda_custom_wrapper *pda = (void *) entry->data; - if (priv->output_limit || data_len < sizeof(*pda)) - break; - priv->output_limit = p54_convert_db(pda, data_len); - } - break; - case PDR_PRISM_PA_CAL_CURVE_DATA_CUSTOM: { - struct pda_custom_wrapper *pda = (void *) entry->data; - if (priv->curve_data || data_len < sizeof(*pda)) - break; - priv->curve_data = p54_convert_db(pda, data_len); - } - break; - case PDR_END: - crc16 = ~crc_ccitt(crc16, (u8 *) entry, sizeof(*entry)); - if (crc16 != le16_to_cpup((__le16 *)entry->data)) { - wiphy_err(dev->wiphy, "eeprom failed checksum " - "test!\n"); - err = -ENOMSG; - goto err; - } else { - goto good_eeprom; - } - break; - default: - break; - } - - crc16 = crc_ccitt(crc16, (u8 *)entry, (entry_len + 1) * 2); - entry = (void *)entry + (entry_len + 1) * 2; - } - - wiphy_err(dev->wiphy, "unexpected end of eeprom data.\n"); - err = -ENODATA; - goto err; - -good_eeprom: - if (!synth || !priv->iq_autocal || !priv->output_limit || - !priv->curve_data) { - wiphy_err(dev->wiphy, - "not all required entries found in eeprom!\n"); - err = -EINVAL; - goto err; - } - - priv->rxhw = synth & PDR_SYNTH_FRONTEND_MASK; - - err = p54_generate_channel_lists(dev); - if (err) - goto err; - - if (priv->rxhw == PDR_SYNTH_FRONTEND_XBOW) - p54_init_xbow_synth(priv); - if (!(synth & PDR_SYNTH_24_GHZ_DISABLED)) - dev->wiphy->bands[IEEE80211_BAND_2GHZ] = - priv->band_table[IEEE80211_BAND_2GHZ]; - if (!(synth & PDR_SYNTH_5_GHZ_DISABLED)) - dev->wiphy->bands[IEEE80211_BAND_5GHZ] = - priv->band_table[IEEE80211_BAND_5GHZ]; - if ((synth & PDR_SYNTH_RX_DIV_MASK) == PDR_SYNTH_RX_DIV_SUPPORTED) - priv->rx_diversity_mask = 3; - if ((synth & PDR_SYNTH_TX_DIV_MASK) == PDR_SYNTH_TX_DIV_SUPPORTED) - priv->tx_diversity_mask = 3; - - if (!is_valid_ether_addr(dev->wiphy->perm_addr)) { - u8 perm_addr[ETH_ALEN]; - - wiphy_warn(dev->wiphy, - "Invalid hwaddr! Using randomly generated MAC addr\n"); - eth_random_addr(perm_addr); - SET_IEEE80211_PERM_ADDR(dev, perm_addr); - } - - priv->cur_rssi = &p54_rssi_default; - - wiphy_info(dev->wiphy, "hwaddr %pM, MAC:isl38%02x RF:%s\n", - dev->wiphy->perm_addr, priv->version, - p54_rf_chips[priv->rxhw]); - - return 0; - -err: - kfree(priv->iq_autocal); - kfree(priv->output_limit); - kfree(priv->curve_data); - kfree(priv->rssi_db); - kfree(priv->survey); - priv->iq_autocal = NULL; - priv->output_limit = NULL; - priv->curve_data = NULL; - priv->rssi_db = NULL; - priv->survey = NULL; - - wiphy_err(dev->wiphy, "eeprom parse failed!\n"); - return err; -} -EXPORT_SYMBOL_GPL(p54_parse_eeprom); - -int p54_read_eeprom(struct ieee80211_hw *dev) -{ - struct p54_common *priv = dev->priv; - size_t eeprom_size = 0x2020, offset = 0, blocksize, maxblocksize; - int ret = -ENOMEM; - void *eeprom; - - maxblocksize = EEPROM_READBACK_LEN; - if (priv->fw_var >= 0x509) - maxblocksize -= 0xc; - else - maxblocksize -= 0x4; - - eeprom = kzalloc(eeprom_size, GFP_KERNEL); - if (unlikely(!eeprom)) - goto free; - - while (eeprom_size) { - blocksize = min(eeprom_size, maxblocksize); - ret = p54_download_eeprom(priv, eeprom + offset, - offset, blocksize); - if (unlikely(ret)) - goto free; - - offset += blocksize; - eeprom_size -= blocksize; - } - - ret = p54_parse_eeprom(dev, eeprom, offset); -free: - kfree(eeprom); - return ret; -} -EXPORT_SYMBOL_GPL(p54_read_eeprom); diff --git a/drivers/net/wireless/p54/eeprom.h b/drivers/net/wireless/p54/eeprom.h deleted file mode 100644 index 20ebe39a3f4e..000000000000 --- a/drivers/net/wireless/p54/eeprom.h +++ /dev/null @@ -1,245 +0,0 @@ -/* - * eeprom specific definitions for mac80211 Prism54 drivers - * - * Copyright (c) 2006, Michael Wu - * Copyright (c) 2007-2009, Christian Lamparter - * - * Based on: - * - the islsm (softmac prism54) driver, which is: - * Copyright 2004-2006 Jean-Baptiste Note , et al. - * - * - LMAC API interface header file for STLC4560 (lmac_longbow.h) - * Copyright (C) 2007 Conexant Systems, Inc. - * - * - islmvc driver - * Copyright (C) 2001 Intersil Americas Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef EEPROM_H -#define EEPROM_H - -/* PDA defines are Copyright (C) 2005 Nokia Corporation (taken from islsm_pda.h) */ - -struct pda_entry { - __le16 len; /* includes both code and data */ - __le16 code; - u8 data[0]; -} __packed; - -struct eeprom_pda_wrap { - __le32 magic; - __le16 pad; - __le16 len; - __le32 arm_opcode; - u8 data[0]; -} __packed; - -struct p54_iq_autocal_entry { - __le16 iq_param[4]; -} __packed; - -struct pda_iq_autocal_entry { - __le16 freq; - struct p54_iq_autocal_entry params; -} __packed; - -struct pda_channel_output_limit { - __le16 freq; - u8 val_bpsk; - u8 val_qpsk; - u8 val_16qam; - u8 val_64qam; - u8 rate_set_mask; - u8 rate_set_size; -} __packed; - -struct pda_channel_output_limit_point_longbow { - __le16 val_bpsk; - __le16 val_qpsk; - __le16 val_16qam; - __le16 val_64qam; -} __packed; - -struct pda_channel_output_limit_longbow { - __le16 freq; - struct pda_channel_output_limit_point_longbow point[3]; -} __packed; - -struct pda_pa_curve_data_sample_rev0 { - u8 rf_power; - u8 pa_detector; - u8 pcv; -} __packed; - -struct pda_pa_curve_data_sample_rev1 { - u8 rf_power; - u8 pa_detector; - u8 data_barker; - u8 data_bpsk; - u8 data_qpsk; - u8 data_16qam; - u8 data_64qam; -} __packed; - -struct pda_pa_curve_data { - u8 cal_method_rev; - u8 channels; - u8 points_per_channel; - u8 padding; - u8 data[0]; -} __packed; - -struct pda_rssi_cal_ext_entry { - __le16 freq; - __le16 mul; - __le16 add; -} __packed; - -struct pda_rssi_cal_entry { - __le16 mul; - __le16 add; -} __packed; - -struct pda_country { - u8 regdomain; - u8 alpha2[2]; - u8 flags; -} __packed; - -struct pda_antenna_gain { - struct { - u8 gain_5GHz; /* 0.25 dBi units */ - u8 gain_2GHz; /* 0.25 dBi units */ - } __packed antenna[0]; -} __packed; - -struct pda_custom_wrapper { - __le16 entries; - __le16 entry_size; - __le16 offset; - __le16 len; - u8 data[0]; -} __packed; - -/* - * this defines the PDR codes used to build PDAs as defined in document - * number 553155. The current implementation mirrors version 1.1 of the - * document and lists only PDRs supported by the ARM platform. - */ - -/* common and choice range (0x0000 - 0x0fff) */ -#define PDR_END 0x0000 -#define PDR_MANUFACTURING_PART_NUMBER 0x0001 -#define PDR_PDA_VERSION 0x0002 -#define PDR_NIC_SERIAL_NUMBER 0x0003 -#define PDR_NIC_RAM_SIZE 0x0005 -#define PDR_RFMODEM_SUP_RANGE 0x0006 -#define PDR_PRISM_MAC_SUP_RANGE 0x0007 -#define PDR_NIC_ID 0x0008 - -#define PDR_MAC_ADDRESS 0x0101 -#define PDR_REGULATORY_DOMAIN_LIST 0x0103 /* obsolete */ -#define PDR_ALLOWED_CHAN_SET 0x0104 -#define PDR_DEFAULT_CHAN 0x0105 -#define PDR_TEMPERATURE_TYPE 0x0107 - -#define PDR_IFR_SETTING 0x0200 -#define PDR_RFR_SETTING 0x0201 -#define PDR_3861_BASELINE_REG_SETTINGS 0x0202 -#define PDR_3861_SHADOW_REG_SETTINGS 0x0203 -#define PDR_3861_IFRF_REG_SETTINGS 0x0204 - -#define PDR_3861_CHAN_CALIB_SET_POINTS 0x0300 -#define PDR_3861_CHAN_CALIB_INTEGRATOR 0x0301 - -#define PDR_3842_PRISM_II_NIC_CONFIG 0x0400 -#define PDR_PRISM_USB_ID 0x0401 -#define PDR_PRISM_PCI_ID 0x0402 -#define PDR_PRISM_PCI_IF_CONFIG 0x0403 -#define PDR_PRISM_PCI_PM_CONFIG 0x0404 - -#define PDR_3861_MF_TEST_CHAN_SET_POINTS 0x0900 -#define PDR_3861_MF_TEST_CHAN_INTEGRATORS 0x0901 - -/* ARM range (0x1000 - 0x1fff) */ -#define PDR_COUNTRY_INFORMATION 0x1000 /* obsolete */ -#define PDR_INTERFACE_LIST 0x1001 -#define PDR_HARDWARE_PLATFORM_COMPONENT_ID 0x1002 -#define PDR_OEM_NAME 0x1003 -#define PDR_PRODUCT_NAME 0x1004 -#define PDR_UTF8_OEM_NAME 0x1005 -#define PDR_UTF8_PRODUCT_NAME 0x1006 -#define PDR_COUNTRY_LIST 0x1007 -#define PDR_DEFAULT_COUNTRY 0x1008 - -#define PDR_ANTENNA_GAIN 0x1100 - -#define PDR_PRISM_INDIGO_PA_CALIBRATION_DATA 0x1901 -#define PDR_RSSI_LINEAR_APPROXIMATION 0x1902 -#define PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS 0x1903 -#define PDR_PRISM_PA_CAL_CURVE_DATA 0x1904 -#define PDR_RSSI_LINEAR_APPROXIMATION_DUAL_BAND 0x1905 -#define PDR_PRISM_ZIF_TX_IQ_CALIBRATION 0x1906 -#define PDR_REGULATORY_POWER_LIMITS 0x1907 -#define PDR_RSSI_LINEAR_APPROXIMATION_EXTENDED 0x1908 -#define PDR_RADIATED_TRANSMISSION_CORRECTION 0x1909 -#define PDR_PRISM_TX_IQ_CALIBRATION 0x190a - -/* reserved range (0x2000 - 0x7fff) */ - -/* customer range (0x8000 - 0xffff) */ -#define PDR_BASEBAND_REGISTERS 0x8000 -#define PDR_PER_CHANNEL_BASEBAND_REGISTERS 0x8001 - -/* used by our modificated eeprom image */ -#define PDR_RSSI_LINEAR_APPROXIMATION_CUSTOM 0xDEAD -#define PDR_RSSI_LINEAR_APPROXIMATION_CUSTOMV2 0xCAFF -#define PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS_CUSTOM 0xBEEF -#define PDR_PRISM_PA_CAL_CURVE_DATA_CUSTOM 0xB05D - -/* Interface Definitions */ -#define PDR_INTERFACE_ROLE_SERVER 0x0000 -#define PDR_INTERFACE_ROLE_CLIENT 0x0001 - -/* PDR definitions for default country & country list */ -#define PDR_COUNTRY_CERT_CODE 0x80 -#define PDR_COUNTRY_CERT_CODE_REAL 0x00 -#define PDR_COUNTRY_CERT_CODE_PSEUDO 0x80 -#define PDR_COUNTRY_CERT_BAND 0x40 -#define PDR_COUNTRY_CERT_BAND_2GHZ 0x00 -#define PDR_COUNTRY_CERT_BAND_5GHZ 0x40 -#define PDR_COUNTRY_CERT_IODOOR 0x30 -#define PDR_COUNTRY_CERT_IODOOR_BOTH 0x00 -#define PDR_COUNTRY_CERT_IODOOR_INDOOR 0x20 -#define PDR_COUNTRY_CERT_IODOOR_OUTDOOR 0x30 -#define PDR_COUNTRY_CERT_INDEX 0x0f - -/* Specific LMAC FW/HW variant definitions */ -#define PDR_SYNTH_FRONTEND_MASK 0x0007 -#define PDR_SYNTH_FRONTEND_DUETTE3 0x0001 -#define PDR_SYNTH_FRONTEND_DUETTE2 0x0002 -#define PDR_SYNTH_FRONTEND_FRISBEE 0x0003 -#define PDR_SYNTH_FRONTEND_XBOW 0x0004 -#define PDR_SYNTH_FRONTEND_LONGBOW 0x0005 -#define PDR_SYNTH_IQ_CAL_MASK 0x0018 -#define PDR_SYNTH_IQ_CAL_PA_DETECTOR 0x0000 -#define PDR_SYNTH_IQ_CAL_DISABLED 0x0008 -#define PDR_SYNTH_IQ_CAL_ZIF 0x0010 -#define PDR_SYNTH_FAA_SWITCH_MASK 0x0020 -#define PDR_SYNTH_FAA_SWITCH_ENABLED 0x0020 -#define PDR_SYNTH_24_GHZ_MASK 0x0040 -#define PDR_SYNTH_24_GHZ_DISABLED 0x0040 -#define PDR_SYNTH_5_GHZ_MASK 0x0080 -#define PDR_SYNTH_5_GHZ_DISABLED 0x0080 -#define PDR_SYNTH_RX_DIV_MASK 0x0100 -#define PDR_SYNTH_RX_DIV_SUPPORTED 0x0100 -#define PDR_SYNTH_TX_DIV_MASK 0x0200 -#define PDR_SYNTH_TX_DIV_SUPPORTED 0x0200 -#define PDR_SYNTH_ASM_MASK 0x0400 -#define PDR_SYNTH_ASM_XSWON 0x0400 - -#endif /* EEPROM_H */ diff --git a/drivers/net/wireless/p54/fwio.c b/drivers/net/wireless/p54/fwio.c deleted file mode 100644 index b3879fbf5368..000000000000 --- a/drivers/net/wireless/p54/fwio.c +++ /dev/null @@ -1,763 +0,0 @@ -/* - * Firmware I/O code for mac80211 Prism54 drivers - * - * Copyright (c) 2006, Michael Wu - * Copyright (c) 2007-2009, Christian Lamparter - * Copyright 2008, Johannes Berg - * - * Based on: - * - the islsm (softmac prism54) driver, which is: - * Copyright 2004-2006 Jean-Baptiste Note , et al. - * - stlc45xx driver - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include - -#include - -#include "p54.h" -#include "eeprom.h" -#include "lmac.h" - -int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) -{ - struct p54_common *priv = dev->priv; - struct exp_if *exp_if; - struct bootrec *bootrec; - u32 *data = (u32 *)fw->data; - u32 *end_data = (u32 *)fw->data + (fw->size >> 2); - u8 *fw_version = NULL; - size_t len; - int i; - int maxlen; - - if (priv->rx_start) - return 0; - - while (data < end_data && *data) - data++; - - while (data < end_data && !*data) - data++; - - bootrec = (struct bootrec *) data; - - while (bootrec->data <= end_data && (bootrec->data + - (len = le32_to_cpu(bootrec->len))) <= end_data) { - u32 code = le32_to_cpu(bootrec->code); - switch (code) { - case BR_CODE_COMPONENT_ID: - priv->fw_interface = be32_to_cpup((__be32 *) - bootrec->data); - switch (priv->fw_interface) { - case FW_LM86: - case FW_LM20: - case FW_LM87: { - char *iftype = (char *)bootrec->data; - wiphy_info(priv->hw->wiphy, - "p54 detected a LM%c%c firmware\n", - iftype[2], iftype[3]); - break; - } - case FW_FMAC: - default: - wiphy_err(priv->hw->wiphy, - "unsupported firmware\n"); - return -ENODEV; - } - break; - case BR_CODE_COMPONENT_VERSION: - /* 24 bytes should be enough for all firmwares */ - if (strnlen((unsigned char *) bootrec->data, 24) < 24) - fw_version = (unsigned char *) bootrec->data; - break; - case BR_CODE_DESCR: { - struct bootrec_desc *desc = - (struct bootrec_desc *)bootrec->data; - priv->rx_start = le32_to_cpu(desc->rx_start); - /* FIXME add sanity checking */ - priv->rx_end = le32_to_cpu(desc->rx_end) - 0x3500; - priv->headroom = desc->headroom; - priv->tailroom = desc->tailroom; - priv->privacy_caps = desc->privacy_caps; - priv->rx_keycache_size = desc->rx_keycache_size; - if (le32_to_cpu(bootrec->len) == 11) - priv->rx_mtu = le16_to_cpu(desc->rx_mtu); - else - priv->rx_mtu = (size_t) - 0x620 - priv->tx_hdr_len; - maxlen = priv->tx_hdr_len + /* USB devices */ - sizeof(struct p54_rx_data) + - 4 + /* rx alignment */ - IEEE80211_MAX_FRAG_THRESHOLD; - if (priv->rx_mtu > maxlen && PAGE_SIZE == 4096) { - printk(KERN_INFO "p54: rx_mtu reduced from %d " - "to %d\n", priv->rx_mtu, maxlen); - priv->rx_mtu = maxlen; - } - break; - } - case BR_CODE_EXPOSED_IF: - exp_if = (struct exp_if *) bootrec->data; - for (i = 0; i < (len * sizeof(*exp_if) / 4); i++) - if (exp_if[i].if_id == cpu_to_le16(IF_ID_LMAC)) - priv->fw_var = le16_to_cpu(exp_if[i].variant); - break; - case BR_CODE_DEPENDENT_IF: - break; - case BR_CODE_END_OF_BRA: - case LEGACY_BR_CODE_END_OF_BRA: - end_data = NULL; - break; - default: - break; - } - bootrec = (struct bootrec *)&bootrec->data[len]; - } - - if (fw_version) { - wiphy_info(priv->hw->wiphy, - "FW rev %s - Softmac protocol %x.%x\n", - fw_version, priv->fw_var >> 8, priv->fw_var & 0xff); - snprintf(dev->wiphy->fw_version, sizeof(dev->wiphy->fw_version), - "%s - %x.%x", fw_version, - priv->fw_var >> 8, priv->fw_var & 0xff); - } - - if (priv->fw_var < 0x500) - wiphy_info(priv->hw->wiphy, - "you are using an obsolete firmware. " - "visit http://wireless.kernel.org/en/users/Drivers/p54 " - "and grab one for \"kernel >= 2.6.28\"!\n"); - - if (priv->fw_var >= 0x300) { - /* Firmware supports QoS, use it! */ - - if (priv->fw_var >= 0x500) { - priv->tx_stats[P54_QUEUE_AC_VO].limit = 16; - priv->tx_stats[P54_QUEUE_AC_VI].limit = 16; - priv->tx_stats[P54_QUEUE_AC_BE].limit = 16; - priv->tx_stats[P54_QUEUE_AC_BK].limit = 16; - } else { - priv->tx_stats[P54_QUEUE_AC_VO].limit = 3; - priv->tx_stats[P54_QUEUE_AC_VI].limit = 4; - priv->tx_stats[P54_QUEUE_AC_BE].limit = 3; - priv->tx_stats[P54_QUEUE_AC_BK].limit = 2; - } - priv->hw->queues = P54_QUEUE_AC_NUM; - } - - wiphy_info(priv->hw->wiphy, - "cryptographic accelerator WEP:%s, TKIP:%s, CCMP:%s\n", - (priv->privacy_caps & BR_DESC_PRIV_CAP_WEP) ? "YES" : "no", - (priv->privacy_caps & - (BR_DESC_PRIV_CAP_TKIP | BR_DESC_PRIV_CAP_MICHAEL)) - ? "YES" : "no", - (priv->privacy_caps & BR_DESC_PRIV_CAP_AESCCMP) - ? "YES" : "no"); - - if (priv->rx_keycache_size) { - /* - * NOTE: - * - * The firmware provides at most 255 (0 - 254) slots - * for keys which are then used to offload decryption. - * As a result the 255 entry (aka 0xff) can be used - * safely by the driver to mark keys that didn't fit - * into the full cache. This trick saves us from - * keeping a extra list for uploaded keys. - */ - - priv->used_rxkeys = kzalloc(BITS_TO_LONGS( - priv->rx_keycache_size), GFP_KERNEL); - - if (!priv->used_rxkeys) - return -ENOMEM; - } - - return 0; -} -EXPORT_SYMBOL_GPL(p54_parse_firmware); - -static struct sk_buff *p54_alloc_skb(struct p54_common *priv, u16 hdr_flags, - u16 payload_len, u16 type, gfp_t memflags) -{ - struct p54_hdr *hdr; - struct sk_buff *skb; - size_t frame_len = sizeof(*hdr) + payload_len; - - if (frame_len > P54_MAX_CTRL_FRAME_LEN) - return NULL; - - if (unlikely(skb_queue_len(&priv->tx_pending) > 64)) - return NULL; - - skb = __dev_alloc_skb(priv->tx_hdr_len + frame_len, memflags); - if (!skb) - return NULL; - skb_reserve(skb, priv->tx_hdr_len); - - hdr = (struct p54_hdr *) skb_put(skb, sizeof(*hdr)); - hdr->flags = cpu_to_le16(hdr_flags); - hdr->len = cpu_to_le16(payload_len); - hdr->type = cpu_to_le16(type); - hdr->tries = hdr->rts_tries = 0; - return skb; -} - -int p54_download_eeprom(struct p54_common *priv, void *buf, - u16 offset, u16 len) -{ - struct p54_eeprom_lm86 *eeprom_hdr; - struct sk_buff *skb; - size_t eeprom_hdr_size; - int ret = 0; - - if (priv->fw_var >= 0x509) - eeprom_hdr_size = sizeof(*eeprom_hdr); - else - eeprom_hdr_size = 0x4; - - skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL, eeprom_hdr_size + - len, P54_CONTROL_TYPE_EEPROM_READBACK, - GFP_KERNEL); - if (unlikely(!skb)) - return -ENOMEM; - - mutex_lock(&priv->eeprom_mutex); - priv->eeprom = buf; - eeprom_hdr = (struct p54_eeprom_lm86 *) skb_put(skb, - eeprom_hdr_size + len); - - if (priv->fw_var < 0x509) { - eeprom_hdr->v1.offset = cpu_to_le16(offset); - eeprom_hdr->v1.len = cpu_to_le16(len); - } else { - eeprom_hdr->v2.offset = cpu_to_le32(offset); - eeprom_hdr->v2.len = cpu_to_le16(len); - eeprom_hdr->v2.magic2 = 0xf; - memcpy(eeprom_hdr->v2.magic, (const char *)"LOCK", 4); - } - - p54_tx(priv, skb); - - if (!wait_for_completion_interruptible_timeout( - &priv->eeprom_comp, HZ)) { - wiphy_err(priv->hw->wiphy, "device does not respond!\n"); - ret = -EBUSY; - } - priv->eeprom = NULL; - mutex_unlock(&priv->eeprom_mutex); - return ret; -} - -int p54_update_beacon_tim(struct p54_common *priv, u16 aid, bool set) -{ - struct sk_buff *skb; - struct p54_tim *tim; - - skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*tim), - P54_CONTROL_TYPE_TIM, GFP_ATOMIC); - if (unlikely(!skb)) - return -ENOMEM; - - tim = (struct p54_tim *) skb_put(skb, sizeof(*tim)); - tim->count = 1; - tim->entry[0] = cpu_to_le16(set ? (aid | 0x8000) : aid); - p54_tx(priv, skb); - return 0; -} - -int p54_sta_unlock(struct p54_common *priv, u8 *addr) -{ - struct sk_buff *skb; - struct p54_sta_unlock *sta; - - skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*sta), - P54_CONTROL_TYPE_PSM_STA_UNLOCK, GFP_ATOMIC); - if (unlikely(!skb)) - return -ENOMEM; - - sta = (struct p54_sta_unlock *)skb_put(skb, sizeof(*sta)); - memcpy(sta->addr, addr, ETH_ALEN); - p54_tx(priv, skb); - return 0; -} - -int p54_tx_cancel(struct p54_common *priv, __le32 req_id) -{ - struct sk_buff *skb; - struct p54_txcancel *cancel; - u32 _req_id = le32_to_cpu(req_id); - - if (unlikely(_req_id < priv->rx_start || _req_id > priv->rx_end)) - return -EINVAL; - - skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*cancel), - P54_CONTROL_TYPE_TXCANCEL, GFP_ATOMIC); - if (unlikely(!skb)) - return -ENOMEM; - - cancel = (struct p54_txcancel *)skb_put(skb, sizeof(*cancel)); - cancel->req_id = req_id; - p54_tx(priv, skb); - return 0; -} - -int p54_setup_mac(struct p54_common *priv) -{ - struct sk_buff *skb; - struct p54_setup_mac *setup; - u16 mode; - - skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*setup), - P54_CONTROL_TYPE_SETUP, GFP_ATOMIC); - if (!skb) - return -ENOMEM; - - setup = (struct p54_setup_mac *) skb_put(skb, sizeof(*setup)); - if (!(priv->hw->conf.flags & IEEE80211_CONF_IDLE)) { - switch (priv->mode) { - case NL80211_IFTYPE_STATION: - mode = P54_FILTER_TYPE_STATION; - break; - case NL80211_IFTYPE_AP: - mode = P54_FILTER_TYPE_AP; - break; - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_MESH_POINT: - mode = P54_FILTER_TYPE_IBSS; - break; - case NL80211_IFTYPE_MONITOR: - mode = P54_FILTER_TYPE_PROMISCUOUS; - break; - default: - mode = P54_FILTER_TYPE_HIBERNATE; - break; - } - - /* - * "TRANSPARENT and PROMISCUOUS are mutually exclusive" - * STSW45X0C LMAC API - page 12 - */ - if (((priv->filter_flags & FIF_PROMISC_IN_BSS) || - (priv->filter_flags & FIF_OTHER_BSS)) && - (mode != P54_FILTER_TYPE_PROMISCUOUS)) - mode |= P54_FILTER_TYPE_TRANSPARENT; - } else { - mode = P54_FILTER_TYPE_HIBERNATE; - } - - setup->mac_mode = cpu_to_le16(mode); - memcpy(setup->mac_addr, priv->mac_addr, ETH_ALEN); - memcpy(setup->bssid, priv->bssid, ETH_ALEN); - setup->rx_antenna = 2 & priv->rx_diversity_mask; /* automatic */ - setup->rx_align = 0; - if (priv->fw_var < 0x500) { - setup->v1.basic_rate_mask = cpu_to_le32(priv->basic_rate_mask); - memset(setup->v1.rts_rates, 0, 8); - setup->v1.rx_addr = cpu_to_le32(priv->rx_end); - setup->v1.max_rx = cpu_to_le16(priv->rx_mtu); - setup->v1.rxhw = cpu_to_le16(priv->rxhw); - setup->v1.wakeup_timer = cpu_to_le16(priv->wakeup_timer); - setup->v1.unalloc0 = cpu_to_le16(0); - } else { - setup->v2.rx_addr = cpu_to_le32(priv->rx_end); - setup->v2.max_rx = cpu_to_le16(priv->rx_mtu); - setup->v2.rxhw = cpu_to_le16(priv->rxhw); - setup->v2.timer = cpu_to_le16(priv->wakeup_timer); - setup->v2.truncate = cpu_to_le16(48896); - setup->v2.basic_rate_mask = cpu_to_le32(priv->basic_rate_mask); - setup->v2.sbss_offset = 0; - setup->v2.mcast_window = 0; - setup->v2.rx_rssi_threshold = 0; - setup->v2.rx_ed_threshold = 0; - setup->v2.ref_clock = cpu_to_le32(644245094); - setup->v2.lpf_bandwidth = cpu_to_le16(65535); - setup->v2.osc_start_delay = cpu_to_le16(65535); - } - p54_tx(priv, skb); - priv->phy_idle = mode == P54_FILTER_TYPE_HIBERNATE; - return 0; -} - -int p54_scan(struct p54_common *priv, u16 mode, u16 dwell) -{ - struct sk_buff *skb; - struct p54_hdr *hdr; - struct p54_scan_head *head; - struct p54_iq_autocal_entry *iq_autocal; - union p54_scan_body_union *body; - struct p54_scan_tail_rate *rate; - struct pda_rssi_cal_entry *rssi; - struct p54_rssi_db_entry *rssi_data; - unsigned int i; - void *entry; - __le16 freq = cpu_to_le16(priv->hw->conf.chandef.chan->center_freq); - - skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*head) + - 2 + sizeof(*iq_autocal) + sizeof(*body) + - sizeof(*rate) + 2 * sizeof(*rssi), - P54_CONTROL_TYPE_SCAN, GFP_ATOMIC); - if (!skb) - return -ENOMEM; - - head = (struct p54_scan_head *) skb_put(skb, sizeof(*head)); - memset(head->scan_params, 0, sizeof(head->scan_params)); - head->mode = cpu_to_le16(mode); - head->dwell = cpu_to_le16(dwell); - head->freq = freq; - - if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) { - __le16 *pa_power_points = (__le16 *) skb_put(skb, 2); - *pa_power_points = cpu_to_le16(0x0c); - } - - iq_autocal = (void *) skb_put(skb, sizeof(*iq_autocal)); - for (i = 0; i < priv->iq_autocal_len; i++) { - if (priv->iq_autocal[i].freq != freq) - continue; - - memcpy(iq_autocal, &priv->iq_autocal[i].params, - sizeof(struct p54_iq_autocal_entry)); - break; - } - if (i == priv->iq_autocal_len) - goto err; - - if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) - body = (void *) skb_put(skb, sizeof(body->longbow)); - else - body = (void *) skb_put(skb, sizeof(body->normal)); - - for (i = 0; i < priv->output_limit->entries; i++) { - __le16 *entry_freq = (void *) (priv->output_limit->data + - priv->output_limit->entry_size * i); - - if (*entry_freq != freq) - continue; - - if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) { - memcpy(&body->longbow.power_limits, - (void *) entry_freq + sizeof(__le16), - priv->output_limit->entry_size); - } else { - struct pda_channel_output_limit *limits = - (void *) entry_freq; - - body->normal.val_barker = 0x38; - body->normal.val_bpsk = body->normal.dup_bpsk = - limits->val_bpsk; - body->normal.val_qpsk = body->normal.dup_qpsk = - limits->val_qpsk; - body->normal.val_16qam = body->normal.dup_16qam = - limits->val_16qam; - body->normal.val_64qam = body->normal.dup_64qam = - limits->val_64qam; - } - break; - } - if (i == priv->output_limit->entries) - goto err; - - entry = (void *)(priv->curve_data->data + priv->curve_data->offset); - for (i = 0; i < priv->curve_data->entries; i++) { - if (*((__le16 *)entry) != freq) { - entry += priv->curve_data->entry_size; - continue; - } - - if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) { - memcpy(&body->longbow.curve_data, - entry + sizeof(__le16), - priv->curve_data->entry_size); - } else { - struct p54_scan_body *chan = &body->normal; - struct pda_pa_curve_data *curve_data = - (void *) priv->curve_data->data; - - entry += sizeof(__le16); - chan->pa_points_per_curve = 8; - memset(chan->curve_data, 0, sizeof(*chan->curve_data)); - memcpy(chan->curve_data, entry, - sizeof(struct p54_pa_curve_data_sample) * - min((u8)8, curve_data->points_per_channel)); - } - break; - } - if (i == priv->curve_data->entries) - goto err; - - if ((priv->fw_var >= 0x500) && (priv->fw_var < 0x509)) { - rate = (void *) skb_put(skb, sizeof(*rate)); - rate->basic_rate_mask = cpu_to_le32(priv->basic_rate_mask); - for (i = 0; i < sizeof(rate->rts_rates); i++) - rate->rts_rates[i] = i; - } - - rssi = (struct pda_rssi_cal_entry *) skb_put(skb, sizeof(*rssi)); - rssi_data = p54_rssi_find(priv, le16_to_cpu(freq)); - rssi->mul = cpu_to_le16(rssi_data->mul); - rssi->add = cpu_to_le16(rssi_data->add); - if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) { - /* Longbow frontend needs ever more */ - rssi = (void *) skb_put(skb, sizeof(*rssi)); - rssi->mul = cpu_to_le16(rssi_data->longbow_unkn); - rssi->add = cpu_to_le16(rssi_data->longbow_unk2); - } - - if (priv->fw_var >= 0x509) { - rate = (void *) skb_put(skb, sizeof(*rate)); - rate->basic_rate_mask = cpu_to_le32(priv->basic_rate_mask); - for (i = 0; i < sizeof(rate->rts_rates); i++) - rate->rts_rates[i] = i; - } - - hdr = (struct p54_hdr *) skb->data; - hdr->len = cpu_to_le16(skb->len - sizeof(*hdr)); - - p54_tx(priv, skb); - priv->cur_rssi = rssi_data; - return 0; - -err: - wiphy_err(priv->hw->wiphy, "frequency change to channel %d failed.\n", - ieee80211_frequency_to_channel( - priv->hw->conf.chandef.chan->center_freq)); - - dev_kfree_skb_any(skb); - return -EINVAL; -} - -int p54_set_leds(struct p54_common *priv) -{ - struct sk_buff *skb; - struct p54_led *led; - - skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*led), - P54_CONTROL_TYPE_LED, GFP_ATOMIC); - if (unlikely(!skb)) - return -ENOMEM; - - led = (struct p54_led *) skb_put(skb, sizeof(*led)); - led->flags = cpu_to_le16(0x0003); - led->mask[0] = led->mask[1] = cpu_to_le16(priv->softled_state); - led->delay[0] = cpu_to_le16(1); - led->delay[1] = cpu_to_le16(0); - p54_tx(priv, skb); - return 0; -} - -int p54_set_edcf(struct p54_common *priv) -{ - struct sk_buff *skb; - struct p54_edcf *edcf; - u8 rtd; - - skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*edcf), - P54_CONTROL_TYPE_DCFINIT, GFP_ATOMIC); - if (unlikely(!skb)) - return -ENOMEM; - - edcf = (struct p54_edcf *)skb_put(skb, sizeof(*edcf)); - if (priv->use_short_slot) { - edcf->slottime = 9; - edcf->sifs = 0x10; - edcf->eofpad = 0x00; - } else { - edcf->slottime = 20; - edcf->sifs = 0x0a; - edcf->eofpad = 0x06; - } - /* - * calculate the extra round trip delay according to the - * formula from 802.11-2007 17.3.8.6. - */ - rtd = 3 * priv->coverage_class; - edcf->slottime += rtd; - edcf->round_trip_delay = cpu_to_le16(rtd); - /* (see prism54/isl_oid.h for further details) */ - edcf->frameburst = cpu_to_le16(0); - edcf->flags = 0; - memset(edcf->mapping, 0, sizeof(edcf->mapping)); - memcpy(edcf->queue, priv->qos_params, sizeof(edcf->queue)); - p54_tx(priv, skb); - return 0; -} - -int p54_set_ps(struct p54_common *priv) -{ - struct sk_buff *skb; - struct p54_psm *psm; - unsigned int i; - u16 mode; - - if (priv->hw->conf.flags & IEEE80211_CONF_PS && - !priv->powersave_override) - mode = P54_PSM | P54_PSM_BEACON_TIMEOUT | P54_PSM_DTIM | - P54_PSM_CHECKSUM | P54_PSM_MCBC; - else - mode = P54_PSM_CAM; - - skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*psm), - P54_CONTROL_TYPE_PSM, GFP_ATOMIC); - if (!skb) - return -ENOMEM; - - psm = (struct p54_psm *)skb_put(skb, sizeof(*psm)); - psm->mode = cpu_to_le16(mode); - psm->aid = cpu_to_le16(priv->aid); - for (i = 0; i < ARRAY_SIZE(psm->intervals); i++) { - psm->intervals[i].interval = - cpu_to_le16(priv->hw->conf.listen_interval); - psm->intervals[i].periods = cpu_to_le16(1); - } - - psm->beacon_rssi_skip_max = 200; - psm->rssi_delta_threshold = 0; - psm->nr = 1; - psm->exclude[0] = WLAN_EID_TIM; - - p54_tx(priv, skb); - priv->phy_ps = mode != P54_PSM_CAM; - return 0; -} - -int p54_init_xbow_synth(struct p54_common *priv) -{ - struct sk_buff *skb; - struct p54_xbow_synth *xbow; - - skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*xbow), - P54_CONTROL_TYPE_XBOW_SYNTH_CFG, GFP_KERNEL); - if (unlikely(!skb)) - return -ENOMEM; - - xbow = (struct p54_xbow_synth *)skb_put(skb, sizeof(*xbow)); - xbow->magic1 = cpu_to_le16(0x1); - xbow->magic2 = cpu_to_le16(0x2); - xbow->freq = cpu_to_le16(5390); - memset(xbow->padding, 0, sizeof(xbow->padding)); - p54_tx(priv, skb); - return 0; -} - -int p54_upload_key(struct p54_common *priv, u8 algo, int slot, u8 idx, u8 len, - u8 *addr, u8* key) -{ - struct sk_buff *skb; - struct p54_keycache *rxkey; - - skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*rxkey), - P54_CONTROL_TYPE_RX_KEYCACHE, GFP_KERNEL); - if (unlikely(!skb)) - return -ENOMEM; - - rxkey = (struct p54_keycache *)skb_put(skb, sizeof(*rxkey)); - rxkey->entry = slot; - rxkey->key_id = idx; - rxkey->key_type = algo; - if (addr) - memcpy(rxkey->mac, addr, ETH_ALEN); - else - memset(rxkey->mac, ~0, ETH_ALEN); - - switch (algo) { - case P54_CRYPTO_WEP: - case P54_CRYPTO_AESCCMP: - rxkey->key_len = min_t(u8, 16, len); - memcpy(rxkey->key, key, rxkey->key_len); - break; - - case P54_CRYPTO_TKIPMICHAEL: - rxkey->key_len = 24; - memcpy(rxkey->key, key, 16); - memcpy(&(rxkey->key[16]), &(key - [NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY]), 8); - break; - - case P54_CRYPTO_NONE: - rxkey->key_len = 0; - memset(rxkey->key, 0, sizeof(rxkey->key)); - break; - - default: - wiphy_err(priv->hw->wiphy, - "invalid cryptographic algorithm: %d\n", algo); - dev_kfree_skb(skb); - return -EINVAL; - } - - p54_tx(priv, skb); - return 0; -} - -int p54_fetch_statistics(struct p54_common *priv) -{ - struct ieee80211_tx_info *txinfo; - struct p54_tx_info *p54info; - struct sk_buff *skb; - - skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL, - sizeof(struct p54_statistics), - P54_CONTROL_TYPE_STAT_READBACK, GFP_KERNEL); - if (!skb) - return -ENOMEM; - - /* - * The statistic feedback causes some extra headaches here, if it - * is not to crash/corrupt the firmware data structures. - * - * Unlike all other Control Get OIDs we can not use helpers like - * skb_put to reserve the space for the data we're requesting. - * Instead the extra frame length -which will hold the results later- - * will only be told to the p54_assign_address, so that following - * frames won't be placed into the allegedly empty area. - */ - txinfo = IEEE80211_SKB_CB(skb); - p54info = (void *) txinfo->rate_driver_data; - p54info->extra_len = sizeof(struct p54_statistics); - - p54_tx(priv, skb); - return 0; -} - -int p54_set_groupfilter(struct p54_common *priv) -{ - struct p54_group_address_table *grp; - struct sk_buff *skb; - bool on = false; - - skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*grp), - P54_CONTROL_TYPE_GROUP_ADDRESS_TABLE, GFP_KERNEL); - if (!skb) - return -ENOMEM; - - grp = (struct p54_group_address_table *)skb_put(skb, sizeof(*grp)); - - on = !(priv->filter_flags & FIF_ALLMULTI) && - (priv->mc_maclist_num > 0 && - priv->mc_maclist_num <= MC_FILTER_ADDRESS_NUM); - - if (on) { - grp->filter_enable = cpu_to_le16(1); - grp->num_address = cpu_to_le16(priv->mc_maclist_num); - memcpy(grp->mac_list, priv->mc_maclist, sizeof(grp->mac_list)); - } else { - grp->filter_enable = cpu_to_le16(0); - grp->num_address = cpu_to_le16(0); - memset(grp->mac_list, 0, sizeof(grp->mac_list)); - } - - p54_tx(priv, skb); - return 0; -} diff --git a/drivers/net/wireless/p54/led.c b/drivers/net/wireless/p54/led.c deleted file mode 100644 index 3837e1eec5f4..000000000000 --- a/drivers/net/wireless/p54/led.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Common code for mac80211 Prism54 drivers - * - * Copyright (c) 2006, Michael Wu - * Copyright (c) 2007-2009, Christian Lamparter - * Copyright 2008, Johannes Berg - * - * Based on: - * - the islsm (softmac prism54) driver, which is: - * Copyright 2004-2006 Jean-Baptiste Note , et al. - * - stlc45xx driver - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include - -#include -#ifdef CONFIG_P54_LEDS -#include -#endif /* CONFIG_P54_LEDS */ - -#include "p54.h" -#include "lmac.h" - -static void p54_update_leds(struct work_struct *work) -{ - struct p54_common *priv = container_of(work, struct p54_common, - led_work.work); - int err, i, tmp, blink_delay = 400; - bool rerun = false; - - /* Don't toggle the LED, when the device is down. */ - if (priv->mode == NL80211_IFTYPE_UNSPECIFIED) - return ; - - for (i = 0; i < ARRAY_SIZE(priv->leds); i++) - if (priv->leds[i].toggled) { - priv->softled_state |= BIT(i); - - tmp = 70 + 200 / (priv->leds[i].toggled); - if (tmp < blink_delay) - blink_delay = tmp; - - if (priv->leds[i].led_dev.brightness == LED_OFF) - rerun = true; - - priv->leds[i].toggled = - !!priv->leds[i].led_dev.brightness; - } else - priv->softled_state &= ~BIT(i); - - err = p54_set_leds(priv); - if (err && net_ratelimit()) - wiphy_err(priv->hw->wiphy, - "failed to update LEDs (%d).\n", err); - - if (rerun) - ieee80211_queue_delayed_work(priv->hw, &priv->led_work, - msecs_to_jiffies(blink_delay)); -} - -static void p54_led_brightness_set(struct led_classdev *led_dev, - enum led_brightness brightness) -{ - struct p54_led_dev *led = container_of(led_dev, struct p54_led_dev, - led_dev); - struct ieee80211_hw *dev = led->hw_dev; - struct p54_common *priv = dev->priv; - - if (priv->mode == NL80211_IFTYPE_UNSPECIFIED) - return ; - - if ((brightness) && (led->registered)) { - led->toggled++; - ieee80211_queue_delayed_work(priv->hw, &priv->led_work, HZ/10); - } -} - -static int p54_register_led(struct p54_common *priv, - unsigned int led_index, - char *name, char *trigger) -{ - struct p54_led_dev *led = &priv->leds[led_index]; - int err; - - if (led->registered) - return -EEXIST; - - snprintf(led->name, sizeof(led->name), "p54-%s::%s", - wiphy_name(priv->hw->wiphy), name); - led->hw_dev = priv->hw; - led->index = led_index; - led->led_dev.name = led->name; - led->led_dev.default_trigger = trigger; - led->led_dev.brightness_set = p54_led_brightness_set; - - err = led_classdev_register(wiphy_dev(priv->hw->wiphy), &led->led_dev); - if (err) - wiphy_err(priv->hw->wiphy, - "Failed to register %s LED.\n", name); - else - led->registered = 1; - - return err; -} - -int p54_init_leds(struct p54_common *priv) -{ - int err; - - /* - * TODO: - * Figure out if the EEPROM contains some hints about the number - * of available/programmable LEDs of the device. - */ - - INIT_DELAYED_WORK(&priv->led_work, p54_update_leds); - - err = p54_register_led(priv, 0, "assoc", - ieee80211_get_assoc_led_name(priv->hw)); - if (err) - return err; - - err = p54_register_led(priv, 1, "tx", - ieee80211_get_tx_led_name(priv->hw)); - if (err) - return err; - - err = p54_register_led(priv, 2, "rx", - ieee80211_get_rx_led_name(priv->hw)); - if (err) - return err; - - err = p54_register_led(priv, 3, "radio", - ieee80211_get_radio_led_name(priv->hw)); - if (err) - return err; - - err = p54_set_leds(priv); - return err; -} - -void p54_unregister_leds(struct p54_common *priv) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(priv->leds); i++) { - if (priv->leds[i].registered) { - priv->leds[i].registered = false; - priv->leds[i].toggled = 0; - led_classdev_unregister(&priv->leds[i].led_dev); - } - } - - cancel_delayed_work_sync(&priv->led_work); -} diff --git a/drivers/net/wireless/p54/lmac.h b/drivers/net/wireless/p54/lmac.h deleted file mode 100644 index de1d46bf97df..000000000000 --- a/drivers/net/wireless/p54/lmac.h +++ /dev/null @@ -1,562 +0,0 @@ -/* - * LMAC Interface specific definitions for mac80211 Prism54 drivers - * - * Copyright (c) 2006, Michael Wu - * Copyright (c) 2007 - 2009, Christian Lamparter - * - * Based on: - * - the islsm (softmac prism54) driver, which is: - * Copyright 2004-2006 Jean-Baptiste Note , et al. - * - * - LMAC API interface header file for STLC4560 (lmac_longbow.h) - * Copyright (C) 2007 Conexant Systems, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef LMAC_H -#define LMAC_H - -enum p54_control_frame_types { - P54_CONTROL_TYPE_SETUP = 0, - P54_CONTROL_TYPE_SCAN, - P54_CONTROL_TYPE_TRAP, - P54_CONTROL_TYPE_DCFINIT, - P54_CONTROL_TYPE_RX_KEYCACHE, - P54_CONTROL_TYPE_TIM, - P54_CONTROL_TYPE_PSM, - P54_CONTROL_TYPE_TXCANCEL, - P54_CONTROL_TYPE_TXDONE, - P54_CONTROL_TYPE_BURST, - P54_CONTROL_TYPE_STAT_READBACK, - P54_CONTROL_TYPE_BBP, - P54_CONTROL_TYPE_EEPROM_READBACK, - P54_CONTROL_TYPE_LED, - P54_CONTROL_TYPE_GPIO, - P54_CONTROL_TYPE_TIMER, - P54_CONTROL_TYPE_MODULATION, - P54_CONTROL_TYPE_SYNTH_CONFIG, - P54_CONTROL_TYPE_DETECTOR_VALUE, - P54_CONTROL_TYPE_XBOW_SYNTH_CFG, - P54_CONTROL_TYPE_CCE_QUIET, - P54_CONTROL_TYPE_PSM_STA_UNLOCK, - P54_CONTROL_TYPE_PCS, - P54_CONTROL_TYPE_BT_BALANCER = 28, - P54_CONTROL_TYPE_GROUP_ADDRESS_TABLE = 30, - P54_CONTROL_TYPE_ARPTABLE = 31, - P54_CONTROL_TYPE_BT_OPTIONS = 35, -}; - -#define P54_HDR_FLAG_CONTROL BIT(15) -#define P54_HDR_FLAG_CONTROL_OPSET (BIT(15) + BIT(0)) -#define P54_HDR_FLAG_DATA_ALIGN BIT(14) - -#define P54_HDR_FLAG_DATA_OUT_PROMISC BIT(0) -#define P54_HDR_FLAG_DATA_OUT_TIMESTAMP BIT(1) -#define P54_HDR_FLAG_DATA_OUT_SEQNR BIT(2) -#define P54_HDR_FLAG_DATA_OUT_BIT3 BIT(3) -#define P54_HDR_FLAG_DATA_OUT_BURST BIT(4) -#define P54_HDR_FLAG_DATA_OUT_NOCANCEL BIT(5) -#define P54_HDR_FLAG_DATA_OUT_CLEARTIM BIT(6) -#define P54_HDR_FLAG_DATA_OUT_HITCHHIKE BIT(7) -#define P54_HDR_FLAG_DATA_OUT_COMPRESS BIT(8) -#define P54_HDR_FLAG_DATA_OUT_CONCAT BIT(9) -#define P54_HDR_FLAG_DATA_OUT_PCS_ACCEPT BIT(10) -#define P54_HDR_FLAG_DATA_OUT_WAITEOSP BIT(11) - -#define P54_HDR_FLAG_DATA_IN_FCS_GOOD BIT(0) -#define P54_HDR_FLAG_DATA_IN_MATCH_MAC BIT(1) -#define P54_HDR_FLAG_DATA_IN_MCBC BIT(2) -#define P54_HDR_FLAG_DATA_IN_BEACON BIT(3) -#define P54_HDR_FLAG_DATA_IN_MATCH_BSS BIT(4) -#define P54_HDR_FLAG_DATA_IN_BCAST_BSS BIT(5) -#define P54_HDR_FLAG_DATA_IN_DATA BIT(6) -#define P54_HDR_FLAG_DATA_IN_TRUNCATED BIT(7) -#define P54_HDR_FLAG_DATA_IN_BIT8 BIT(8) -#define P54_HDR_FLAG_DATA_IN_TRANSPARENT BIT(9) - -struct p54_hdr { - __le16 flags; - __le16 len; - __le32 req_id; - __le16 type; /* enum p54_control_frame_types */ - u8 rts_tries; - u8 tries; - u8 data[0]; -} __packed; - -#define GET_REQ_ID(skb) \ - (((struct p54_hdr *) ((struct sk_buff *) skb)->data)->req_id) \ - -#define FREE_AFTER_TX(skb) \ - ((((struct p54_hdr *) ((struct sk_buff *) skb)->data)-> \ - flags) == cpu_to_le16(P54_HDR_FLAG_CONTROL_OPSET)) - -#define IS_DATA_FRAME(skb) \ - (!((((struct p54_hdr *) ((struct sk_buff *) skb)->data)-> \ - flags) & cpu_to_le16(P54_HDR_FLAG_CONTROL))) - -#define GET_HW_QUEUE(skb) \ - (((struct p54_tx_data *)((struct p54_hdr *) \ - skb->data)->data)->hw_queue) - -/* - * shared interface ID definitions - * The interface ID is a unique identification of a specific interface. - * The following values are reserved: 0x0000, 0x0002, 0x0012, 0x0014, 0x0015 - */ -#define IF_ID_ISL36356A 0x0001 /* ISL36356A <-> Firmware */ -#define IF_ID_MVC 0x0003 /* MAC Virtual Coprocessor */ -#define IF_ID_DEBUG 0x0008 /* PolDebug Interface */ -#define IF_ID_PRODUCT 0x0009 -#define IF_ID_OEM 0x000a -#define IF_ID_PCI3877 0x000b /* 3877 <-> Host PCI */ -#define IF_ID_ISL37704C 0x000c /* ISL37704C <-> Fw */ -#define IF_ID_ISL39000 0x000f /* ISL39000 <-> Fw */ -#define IF_ID_ISL39300A 0x0010 /* ISL39300A <-> Fw */ -#define IF_ID_ISL37700_UAP 0x0016 /* ISL37700 uAP Fw <-> Fw */ -#define IF_ID_ISL39000_UAP 0x0017 /* ISL39000 uAP Fw <-> Fw */ -#define IF_ID_LMAC 0x001a /* Interface exposed by LMAC */ - -struct exp_if { - __le16 role; - __le16 if_id; - __le16 variant; - __le16 btm_compat; - __le16 top_compat; -} __packed; - -struct dep_if { - __le16 role; - __le16 if_id; - __le16 variant; -} __packed; - -/* driver <-> lmac definitions */ -struct p54_eeprom_lm86 { - union { - struct { - __le16 offset; - __le16 len; - u8 data[0]; - } __packed v1; - struct { - __le32 offset; - __le16 len; - u8 magic2; - u8 pad; - u8 magic[4]; - u8 data[0]; - } __packed v2; - } __packed; -} __packed; - -enum p54_rx_decrypt_status { - P54_DECRYPT_NONE = 0, - P54_DECRYPT_OK, - P54_DECRYPT_NOKEY, - P54_DECRYPT_NOMICHAEL, - P54_DECRYPT_NOCKIPMIC, - P54_DECRYPT_FAIL_WEP, - P54_DECRYPT_FAIL_TKIP, - P54_DECRYPT_FAIL_MICHAEL, - P54_DECRYPT_FAIL_CKIPKP, - P54_DECRYPT_FAIL_CKIPMIC, - P54_DECRYPT_FAIL_AESCCMP -}; - -struct p54_rx_data { - __le16 flags; - __le16 len; - __le16 freq; - u8 antenna; - u8 rate; - u8 rssi; - u8 quality; - u8 decrypt_status; - u8 rssi_raw; - __le32 tsf32; - __le32 unalloc0; - u8 align[0]; -} __packed; - -enum p54_trap_type { - P54_TRAP_SCAN = 0, - P54_TRAP_TIMER, - P54_TRAP_BEACON_TX, - P54_TRAP_FAA_RADIO_ON, - P54_TRAP_FAA_RADIO_OFF, - P54_TRAP_RADAR, - P54_TRAP_NO_BEACON, - P54_TRAP_TBTT, - P54_TRAP_SCO_ENTER, - P54_TRAP_SCO_EXIT -}; - -struct p54_trap { - __le16 event; - __le16 frequency; -} __packed; - -enum p54_frame_sent_status { - P54_TX_OK = 0, - P54_TX_FAILED, - P54_TX_PSM, - P54_TX_PSM_CANCELLED = 4 -}; - -struct p54_frame_sent { - u8 status; - u8 tries; - u8 ack_rssi; - u8 quality; - __le16 seq; - u8 antenna; - u8 padding; -} __packed; - -enum p54_tx_data_crypt { - P54_CRYPTO_NONE = 0, - P54_CRYPTO_WEP, - P54_CRYPTO_TKIP, - P54_CRYPTO_TKIPMICHAEL, - P54_CRYPTO_CCX_WEPMIC, - P54_CRYPTO_CCX_KPMIC, - P54_CRYPTO_CCX_KP, - P54_CRYPTO_AESCCMP -}; - -enum p54_tx_data_queue { - P54_QUEUE_BEACON = 0, - P54_QUEUE_FWSCAN = 1, - P54_QUEUE_MGMT = 2, - P54_QUEUE_CAB = 3, - P54_QUEUE_DATA = 4, - - P54_QUEUE_AC_NUM = 4, - P54_QUEUE_AC_VO = 4, - P54_QUEUE_AC_VI = 5, - P54_QUEUE_AC_BE = 6, - P54_QUEUE_AC_BK = 7, - - /* keep last */ - P54_QUEUE_NUM = 8, -}; - -#define IS_QOS_QUEUE(n) (n >= P54_QUEUE_DATA) - -struct p54_tx_data { - u8 rateset[8]; - u8 rts_rate_idx; - u8 crypt_offset; - u8 key_type; - u8 key_len; - u8 key[16]; - u8 hw_queue; - u8 backlog; - __le16 durations[4]; - u8 tx_antenna; - union { - struct { - u8 cts_rate; - __le16 output_power; - } __packed longbow; - struct { - u8 output_power; - u8 cts_rate; - u8 unalloc; - } __packed normal; - } __packed; - u8 unalloc2[2]; - u8 align[0]; -} __packed; - -/* unit is ms */ -#define P54_TX_FRAME_LIFETIME 2000 -#define P54_TX_TIMEOUT 4000 -#define P54_STATISTICS_UPDATE 5000 - -#define P54_FILTER_TYPE_NONE 0 -#define P54_FILTER_TYPE_STATION BIT(0) -#define P54_FILTER_TYPE_IBSS BIT(1) -#define P54_FILTER_TYPE_AP BIT(2) -#define P54_FILTER_TYPE_TRANSPARENT BIT(3) -#define P54_FILTER_TYPE_PROMISCUOUS BIT(4) -#define P54_FILTER_TYPE_HIBERNATE BIT(5) -#define P54_FILTER_TYPE_NOACK BIT(6) -#define P54_FILTER_TYPE_RX_DISABLED BIT(7) - -struct p54_setup_mac { - __le16 mac_mode; - u8 mac_addr[ETH_ALEN]; - u8 bssid[ETH_ALEN]; - u8 rx_antenna; - u8 rx_align; - union { - struct { - __le32 basic_rate_mask; - u8 rts_rates[8]; - __le32 rx_addr; - __le16 max_rx; - __le16 rxhw; - __le16 wakeup_timer; - __le16 unalloc0; - } __packed v1; - struct { - __le32 rx_addr; - __le16 max_rx; - __le16 rxhw; - __le16 timer; - __le16 truncate; - __le32 basic_rate_mask; - u8 sbss_offset; - u8 mcast_window; - u8 rx_rssi_threshold; - u8 rx_ed_threshold; - __le32 ref_clock; - __le16 lpf_bandwidth; - __le16 osc_start_delay; - } __packed v2; - } __packed; -} __packed; - -#define P54_SETUP_V1_LEN 40 -#define P54_SETUP_V2_LEN (sizeof(struct p54_setup_mac)) - -#define P54_SCAN_EXIT BIT(0) -#define P54_SCAN_TRAP BIT(1) -#define P54_SCAN_ACTIVE BIT(2) -#define P54_SCAN_FILTER BIT(3) - -struct p54_scan_head { - __le16 mode; - __le16 dwell; - u8 scan_params[20]; - __le16 freq; -} __packed; - -struct p54_pa_curve_data_sample { - u8 rf_power; - u8 pa_detector; - u8 data_barker; - u8 data_bpsk; - u8 data_qpsk; - u8 data_16qam; - u8 data_64qam; - u8 padding; -} __packed; - -struct p54_scan_body { - u8 pa_points_per_curve; - u8 val_barker; - u8 val_bpsk; - u8 val_qpsk; - u8 val_16qam; - u8 val_64qam; - struct p54_pa_curve_data_sample curve_data[8]; - u8 dup_bpsk; - u8 dup_qpsk; - u8 dup_16qam; - u8 dup_64qam; -} __packed; - -/* - * Warning: Longbow's structures are bogus. - */ -struct p54_channel_output_limit_longbow { - __le16 rf_power_points[12]; -} __packed; - -struct p54_pa_curve_data_sample_longbow { - __le16 rf_power; - __le16 pa_detector; - struct { - __le16 data[4]; - } points[3] __packed; -} __packed; - -struct p54_scan_body_longbow { - struct p54_channel_output_limit_longbow power_limits; - struct p54_pa_curve_data_sample_longbow curve_data[8]; - __le16 unkn[6]; /* maybe more power_limits or rate_mask */ -} __packed; - -union p54_scan_body_union { - struct p54_scan_body normal; - struct p54_scan_body_longbow longbow; -} __packed; - -struct p54_scan_tail_rate { - __le32 basic_rate_mask; - u8 rts_rates[8]; -} __packed; - -struct p54_led { - __le16 flags; - __le16 mask[2]; - __le16 delay[2]; -} __packed; - -struct p54_edcf { - u8 flags; - u8 slottime; - u8 sifs; - u8 eofpad; - struct p54_edcf_queue_param queue[8]; - u8 mapping[4]; - __le16 frameburst; - __le16 round_trip_delay; -} __packed; - -struct p54_statistics { - __le32 rx_success; - __le32 rx_bad_fcs; - __le32 rx_abort; - __le32 rx_abort_phy; - __le32 rts_success; - __le32 rts_fail; - __le32 tsf32; - __le32 airtime; - __le32 noise; - __le32 sample_noise[8]; - __le32 sample_cca; - __le32 sample_tx; -} __packed; - -struct p54_xbow_synth { - __le16 magic1; - __le16 magic2; - __le16 freq; - u32 padding[5]; -} __packed; - -struct p54_timer { - __le32 interval; -} __packed; - -struct p54_keycache { - u8 entry; - u8 key_id; - u8 mac[ETH_ALEN]; - u8 padding[2]; - u8 key_type; - u8 key_len; - u8 key[24]; -} __packed; - -struct p54_burst { - u8 flags; - u8 queue; - u8 backlog; - u8 pad; - __le16 durations[32]; -} __packed; - -struct p54_psm_interval { - __le16 interval; - __le16 periods; -} __packed; - -#define P54_PSM_CAM 0 -#define P54_PSM BIT(0) -#define P54_PSM_DTIM BIT(1) -#define P54_PSM_MCBC BIT(2) -#define P54_PSM_CHECKSUM BIT(3) -#define P54_PSM_SKIP_MORE_DATA BIT(4) -#define P54_PSM_BEACON_TIMEOUT BIT(5) -#define P54_PSM_HFOSLEEP BIT(6) -#define P54_PSM_AUTOSWITCH_SLEEP BIT(7) -#define P54_PSM_LPIT BIT(8) -#define P54_PSM_BF_UCAST_SKIP BIT(9) -#define P54_PSM_BF_MCAST_SKIP BIT(10) - -struct p54_psm { - __le16 mode; - __le16 aid; - struct p54_psm_interval intervals[4]; - u8 beacon_rssi_skip_max; - u8 rssi_delta_threshold; - u8 nr; - u8 exclude[1]; -} __packed; - -#define MC_FILTER_ADDRESS_NUM 4 - -struct p54_group_address_table { - __le16 filter_enable; - __le16 num_address; - u8 mac_list[MC_FILTER_ADDRESS_NUM][ETH_ALEN]; -} __packed; - -struct p54_txcancel { - __le32 req_id; -} __packed; - -struct p54_sta_unlock { - u8 addr[ETH_ALEN]; - u16 padding; -} __packed; - -#define P54_TIM_CLEAR BIT(15) -struct p54_tim { - u8 count; - u8 padding[3]; - __le16 entry[8]; -} __packed; - -struct p54_cce_quiet { - __le32 period; -} __packed; - -struct p54_bt_balancer { - __le16 prio_thresh; - __le16 acl_thresh; -} __packed; - -struct p54_arp_table { - __le16 filter_enable; - u8 ipv4_addr[4]; -} __packed; - -/* LED control */ -int p54_set_leds(struct p54_common *priv); -int p54_init_leds(struct p54_common *priv); -void p54_unregister_leds(struct p54_common *priv); - -/* xmit functions */ -void p54_tx_80211(struct ieee80211_hw *dev, - struct ieee80211_tx_control *control, - struct sk_buff *skb); -int p54_tx_cancel(struct p54_common *priv, __le32 req_id); -void p54_tx(struct p54_common *priv, struct sk_buff *skb); - -/* synth/phy configuration */ -int p54_init_xbow_synth(struct p54_common *priv); -int p54_scan(struct p54_common *priv, u16 mode, u16 dwell); - -/* MAC */ -int p54_sta_unlock(struct p54_common *priv, u8 *addr); -int p54_update_beacon_tim(struct p54_common *priv, u16 aid, bool set); -int p54_setup_mac(struct p54_common *priv); -int p54_set_ps(struct p54_common *priv); -int p54_fetch_statistics(struct p54_common *priv); -int p54_set_groupfilter(struct p54_common *priv); - -/* e/v DCF setup */ -int p54_set_edcf(struct p54_common *priv); - -/* cryptographic engine */ -int p54_upload_key(struct p54_common *priv, u8 algo, int slot, - u8 idx, u8 len, u8 *addr, u8* key); - -/* eeprom */ -int p54_download_eeprom(struct p54_common *priv, void *buf, - u16 offset, u16 len); -struct p54_rssi_db_entry *p54_rssi_find(struct p54_common *p, const u16 freq); - -/* utility */ -u8 *p54_find_ie(struct sk_buff *skb, u8 ie); - -#endif /* LMAC_H */ diff --git a/drivers/net/wireless/p54/main.c b/drivers/net/wireless/p54/main.c deleted file mode 100644 index 067e6f2fd050..000000000000 --- a/drivers/net/wireless/p54/main.c +++ /dev/null @@ -1,867 +0,0 @@ -/* - * mac80211 glue code for mac80211 Prism54 drivers - * - * Copyright (c) 2006, Michael Wu - * Copyright (c) 2007-2009, Christian Lamparter - * Copyright 2008, Johannes Berg - * - * Based on: - * - the islsm (softmac prism54) driver, which is: - * Copyright 2004-2006 Jean-Baptiste Note , et al. - * - stlc45xx driver - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include - -#include - -#include "p54.h" -#include "lmac.h" - -static bool modparam_nohwcrypt; -module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); -MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); -MODULE_AUTHOR("Michael Wu "); -MODULE_DESCRIPTION("Softmac Prism54 common code"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("prism54common"); - -static int p54_sta_add_remove(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct p54_common *priv = hw->priv; - - /* - * Notify the firmware that we don't want or we don't - * need to buffer frames for this station anymore. - */ - - p54_sta_unlock(priv, sta->addr); - - return 0; -} - -static void p54_sta_notify(struct ieee80211_hw *dev, struct ieee80211_vif *vif, - enum sta_notify_cmd notify_cmd, - struct ieee80211_sta *sta) -{ - struct p54_common *priv = dev->priv; - - switch (notify_cmd) { - case STA_NOTIFY_AWAKE: - /* update the firmware's filter table */ - p54_sta_unlock(priv, sta->addr); - break; - default: - break; - } -} - -static int p54_set_tim(struct ieee80211_hw *dev, struct ieee80211_sta *sta, - bool set) -{ - struct p54_common *priv = dev->priv; - - return p54_update_beacon_tim(priv, sta->aid, set); -} - -u8 *p54_find_ie(struct sk_buff *skb, u8 ie) -{ - struct ieee80211_mgmt *mgmt = (void *)skb->data; - u8 *pos, *end; - - if (skb->len <= sizeof(mgmt)) - return NULL; - - pos = (u8 *)mgmt->u.beacon.variable; - end = skb->data + skb->len; - while (pos < end) { - if (pos + 2 + pos[1] > end) - return NULL; - - if (pos[0] == ie) - return pos; - - pos += 2 + pos[1]; - } - return NULL; -} - -static int p54_beacon_format_ie_tim(struct sk_buff *skb) -{ - /* - * the good excuse for this mess is ... the firmware. - * The dummy TIM MUST be at the end of the beacon frame, - * because it'll be overwritten! - */ - u8 *tim; - u8 dtim_len; - u8 dtim_period; - u8 *next; - - tim = p54_find_ie(skb, WLAN_EID_TIM); - if (!tim) - return 0; - - dtim_len = tim[1]; - dtim_period = tim[3]; - next = tim + 2 + dtim_len; - - if (dtim_len < 3) - return -EINVAL; - - memmove(tim, next, skb_tail_pointer(skb) - next); - tim = skb_tail_pointer(skb) - (dtim_len + 2); - - /* add the dummy at the end */ - tim[0] = WLAN_EID_TIM; - tim[1] = 3; - tim[2] = 0; - tim[3] = dtim_period; - tim[4] = 0; - - if (dtim_len > 3) - skb_trim(skb, skb->len - (dtim_len - 3)); - - return 0; -} - -static int p54_beacon_update(struct p54_common *priv, - struct ieee80211_vif *vif) -{ - struct ieee80211_tx_control control = { }; - struct sk_buff *beacon; - int ret; - - beacon = ieee80211_beacon_get(priv->hw, vif); - if (!beacon) - return -ENOMEM; - ret = p54_beacon_format_ie_tim(beacon); - if (ret) - return ret; - - /* - * During operation, the firmware takes care of beaconing. - * The driver only needs to upload a new beacon template, once - * the template was changed by the stack or userspace. - * - * LMAC API 3.2.2 also specifies that the driver does not need - * to cancel the old beacon template by hand, instead the firmware - * will release the previous one through the feedback mechanism. - */ - p54_tx_80211(priv->hw, &control, beacon); - priv->tsf_high32 = 0; - priv->tsf_low32 = 0; - - return 0; -} - -static int p54_start(struct ieee80211_hw *dev) -{ - struct p54_common *priv = dev->priv; - int err; - - mutex_lock(&priv->conf_mutex); - err = priv->open(dev); - if (err) - goto out; - P54_SET_QUEUE(priv->qos_params[0], 0x0002, 0x0003, 0x0007, 47); - P54_SET_QUEUE(priv->qos_params[1], 0x0002, 0x0007, 0x000f, 94); - P54_SET_QUEUE(priv->qos_params[2], 0x0003, 0x000f, 0x03ff, 0); - P54_SET_QUEUE(priv->qos_params[3], 0x0007, 0x000f, 0x03ff, 0); - err = p54_set_edcf(priv); - if (err) - goto out; - - memset(priv->bssid, ~0, ETH_ALEN); - priv->mode = NL80211_IFTYPE_MONITOR; - err = p54_setup_mac(priv); - if (err) { - priv->mode = NL80211_IFTYPE_UNSPECIFIED; - goto out; - } - - ieee80211_queue_delayed_work(dev, &priv->work, 0); - - priv->softled_state = 0; - err = p54_set_leds(priv); - -out: - mutex_unlock(&priv->conf_mutex); - return err; -} - -static void p54_stop(struct ieee80211_hw *dev) -{ - struct p54_common *priv = dev->priv; - int i; - - priv->mode = NL80211_IFTYPE_UNSPECIFIED; - priv->softled_state = 0; - cancel_delayed_work_sync(&priv->work); - mutex_lock(&priv->conf_mutex); - p54_set_leds(priv); - priv->stop(dev); - skb_queue_purge(&priv->tx_pending); - skb_queue_purge(&priv->tx_queue); - for (i = 0; i < P54_QUEUE_NUM; i++) { - priv->tx_stats[i].count = 0; - priv->tx_stats[i].len = 0; - } - - priv->beacon_req_id = cpu_to_le32(0); - priv->tsf_high32 = priv->tsf_low32 = 0; - mutex_unlock(&priv->conf_mutex); -} - -static int p54_add_interface(struct ieee80211_hw *dev, - struct ieee80211_vif *vif) -{ - struct p54_common *priv = dev->priv; - int err; - - vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER; - - mutex_lock(&priv->conf_mutex); - if (priv->mode != NL80211_IFTYPE_MONITOR) { - mutex_unlock(&priv->conf_mutex); - return -EOPNOTSUPP; - } - - priv->vif = vif; - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_MESH_POINT: - priv->mode = vif->type; - break; - default: - mutex_unlock(&priv->conf_mutex); - return -EOPNOTSUPP; - } - - memcpy(priv->mac_addr, vif->addr, ETH_ALEN); - err = p54_setup_mac(priv); - mutex_unlock(&priv->conf_mutex); - return err; -} - -static void p54_remove_interface(struct ieee80211_hw *dev, - struct ieee80211_vif *vif) -{ - struct p54_common *priv = dev->priv; - - mutex_lock(&priv->conf_mutex); - priv->vif = NULL; - - /* - * LMAC API 3.2.2 states that any active beacon template must be - * canceled by the driver before attempting a mode transition. - */ - if (le32_to_cpu(priv->beacon_req_id) != 0) { - p54_tx_cancel(priv, priv->beacon_req_id); - wait_for_completion_interruptible_timeout(&priv->beacon_comp, HZ); - } - priv->mode = NL80211_IFTYPE_MONITOR; - memset(priv->mac_addr, 0, ETH_ALEN); - memset(priv->bssid, 0, ETH_ALEN); - p54_setup_mac(priv); - mutex_unlock(&priv->conf_mutex); -} - -static int p54_wait_for_stats(struct ieee80211_hw *dev) -{ - struct p54_common *priv = dev->priv; - int ret; - - priv->update_stats = true; - ret = p54_fetch_statistics(priv); - if (ret) - return ret; - - ret = wait_for_completion_interruptible_timeout(&priv->stat_comp, HZ); - if (ret == 0) - return -ETIMEDOUT; - - return 0; -} - -static void p54_reset_stats(struct p54_common *priv) -{ - struct ieee80211_channel *chan = priv->curchan; - - if (chan) { - struct survey_info *info = &priv->survey[chan->hw_value]; - - /* only reset channel statistics, don't touch .filled, etc. */ - info->channel_time = 0; - info->channel_time_busy = 0; - info->channel_time_tx = 0; - } - - priv->update_stats = true; - priv->survey_raw.active = 0; - priv->survey_raw.cca = 0; - priv->survey_raw.tx = 0; -} - -static int p54_config(struct ieee80211_hw *dev, u32 changed) -{ - int ret = 0; - struct p54_common *priv = dev->priv; - struct ieee80211_conf *conf = &dev->conf; - - mutex_lock(&priv->conf_mutex); - if (changed & IEEE80211_CONF_CHANGE_POWER) - priv->output_power = conf->power_level << 2; - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { - struct ieee80211_channel *oldchan; - WARN_ON(p54_wait_for_stats(dev)); - oldchan = priv->curchan; - priv->curchan = NULL; - ret = p54_scan(priv, P54_SCAN_EXIT, 0); - if (ret) { - priv->curchan = oldchan; - goto out; - } - /* - * TODO: Use the LM_SCAN_TRAP to determine the current - * operating channel. - */ - priv->curchan = priv->hw->conf.chandef.chan; - p54_reset_stats(priv); - WARN_ON(p54_fetch_statistics(priv)); - } - if (changed & IEEE80211_CONF_CHANGE_PS) { - WARN_ON(p54_wait_for_stats(dev)); - ret = p54_set_ps(priv); - if (ret) - goto out; - WARN_ON(p54_wait_for_stats(dev)); - } - if (changed & IEEE80211_CONF_CHANGE_IDLE) { - WARN_ON(p54_wait_for_stats(dev)); - ret = p54_setup_mac(priv); - if (ret) - goto out; - WARN_ON(p54_wait_for_stats(dev)); - } - -out: - mutex_unlock(&priv->conf_mutex); - return ret; -} - -static u64 p54_prepare_multicast(struct ieee80211_hw *dev, - struct netdev_hw_addr_list *mc_list) -{ - struct p54_common *priv = dev->priv; - struct netdev_hw_addr *ha; - int i; - - BUILD_BUG_ON(ARRAY_SIZE(priv->mc_maclist) != - ARRAY_SIZE(((struct p54_group_address_table *)NULL)->mac_list)); - /* - * The first entry is reserved for the global broadcast MAC. - * Otherwise the firmware will drop it and ARP will no longer work. - */ - i = 1; - priv->mc_maclist_num = netdev_hw_addr_list_count(mc_list) + i; - netdev_hw_addr_list_for_each(ha, mc_list) { - memcpy(&priv->mc_maclist[i], ha->addr, ETH_ALEN); - i++; - if (i >= ARRAY_SIZE(priv->mc_maclist)) - break; - } - - return 1; /* update */ -} - -static void p54_configure_filter(struct ieee80211_hw *dev, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast) -{ - struct p54_common *priv = dev->priv; - - *total_flags &= FIF_PROMISC_IN_BSS | - FIF_ALLMULTI | - FIF_OTHER_BSS; - - priv->filter_flags = *total_flags; - - if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) - p54_setup_mac(priv); - - if (changed_flags & FIF_ALLMULTI || multicast) - p54_set_groupfilter(priv); -} - -static int p54_conf_tx(struct ieee80211_hw *dev, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - struct p54_common *priv = dev->priv; - int ret; - - mutex_lock(&priv->conf_mutex); - if (queue < dev->queues) { - P54_SET_QUEUE(priv->qos_params[queue], params->aifs, - params->cw_min, params->cw_max, params->txop); - ret = p54_set_edcf(priv); - } else - ret = -EINVAL; - mutex_unlock(&priv->conf_mutex); - return ret; -} - -static void p54_work(struct work_struct *work) -{ - struct p54_common *priv = container_of(work, struct p54_common, - work.work); - - if (unlikely(priv->mode == NL80211_IFTYPE_UNSPECIFIED)) - return ; - - /* - * TODO: walk through tx_queue and do the following tasks - * 1. initiate bursts. - * 2. cancel stuck frames / reset the device if necessary. - */ - - mutex_lock(&priv->conf_mutex); - WARN_ON_ONCE(p54_fetch_statistics(priv)); - mutex_unlock(&priv->conf_mutex); -} - -static int p54_get_stats(struct ieee80211_hw *dev, - struct ieee80211_low_level_stats *stats) -{ - struct p54_common *priv = dev->priv; - - memcpy(stats, &priv->stats, sizeof(*stats)); - return 0; -} - -static void p54_bss_info_changed(struct ieee80211_hw *dev, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *info, - u32 changed) -{ - struct p54_common *priv = dev->priv; - - mutex_lock(&priv->conf_mutex); - if (changed & BSS_CHANGED_BSSID) { - memcpy(priv->bssid, info->bssid, ETH_ALEN); - p54_setup_mac(priv); - } - - if (changed & BSS_CHANGED_BEACON) { - p54_scan(priv, P54_SCAN_EXIT, 0); - p54_setup_mac(priv); - p54_beacon_update(priv, vif); - p54_set_edcf(priv); - } - - if (changed & (BSS_CHANGED_ERP_SLOT | BSS_CHANGED_BEACON)) { - priv->use_short_slot = info->use_short_slot; - p54_set_edcf(priv); - } - if (changed & BSS_CHANGED_BASIC_RATES) { - if (dev->conf.chandef.chan->band == IEEE80211_BAND_5GHZ) - priv->basic_rate_mask = (info->basic_rates << 4); - else - priv->basic_rate_mask = info->basic_rates; - p54_setup_mac(priv); - if (priv->fw_var >= 0x500) - p54_scan(priv, P54_SCAN_EXIT, 0); - } - if (changed & BSS_CHANGED_ASSOC) { - if (info->assoc) { - priv->aid = info->aid; - priv->wakeup_timer = info->beacon_int * - info->dtim_period * 5; - p54_setup_mac(priv); - } else { - priv->wakeup_timer = 500; - priv->aid = 0; - } - } - - mutex_unlock(&priv->conf_mutex); -} - -static int p54_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct p54_common *priv = dev->priv; - int slot, ret = 0; - u8 algo = 0; - u8 *addr = NULL; - - if (modparam_nohwcrypt) - return -EOPNOTSUPP; - - if (key->flags & IEEE80211_KEY_FLAG_RX_MGMT) { - /* - * Unfortunately most/all firmwares are trying to decrypt - * incoming management frames if a suitable key can be found. - * However, in doing so the data in these frames gets - * corrupted. So, we can't have firmware supported crypto - * offload in this case. - */ - return -EOPNOTSUPP; - } - - mutex_lock(&priv->conf_mutex); - if (cmd == SET_KEY) { - switch (key->cipher) { - case WLAN_CIPHER_SUITE_TKIP: - if (!(priv->privacy_caps & (BR_DESC_PRIV_CAP_MICHAEL | - BR_DESC_PRIV_CAP_TKIP))) { - ret = -EOPNOTSUPP; - goto out_unlock; - } - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - algo = P54_CRYPTO_TKIPMICHAEL; - break; - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - if (!(priv->privacy_caps & BR_DESC_PRIV_CAP_WEP)) { - ret = -EOPNOTSUPP; - goto out_unlock; - } - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - algo = P54_CRYPTO_WEP; - break; - case WLAN_CIPHER_SUITE_CCMP: - if (!(priv->privacy_caps & BR_DESC_PRIV_CAP_AESCCMP)) { - ret = -EOPNOTSUPP; - goto out_unlock; - } - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - algo = P54_CRYPTO_AESCCMP; - break; - default: - ret = -EOPNOTSUPP; - goto out_unlock; - } - slot = bitmap_find_free_region(priv->used_rxkeys, - priv->rx_keycache_size, 0); - - if (slot < 0) { - /* - * The device supports the chosen algorithm, but the - * firmware does not provide enough key slots to store - * all of them. - * But encryption offload for outgoing frames is always - * possible, so we just pretend that the upload was - * successful and do the decryption in software. - */ - - /* mark the key as invalid. */ - key->hw_key_idx = 0xff; - goto out_unlock; - } - } else { - slot = key->hw_key_idx; - - if (slot == 0xff) { - /* This key was not uploaded into the rx key cache. */ - - goto out_unlock; - } - - bitmap_release_region(priv->used_rxkeys, slot, 0); - algo = 0; - } - - if (sta) - addr = sta->addr; - - ret = p54_upload_key(priv, algo, slot, key->keyidx, - key->keylen, addr, key->key); - if (ret) { - bitmap_release_region(priv->used_rxkeys, slot, 0); - ret = -EOPNOTSUPP; - goto out_unlock; - } - - key->hw_key_idx = slot; - -out_unlock: - mutex_unlock(&priv->conf_mutex); - return ret; -} - -static int p54_get_survey(struct ieee80211_hw *dev, int idx, - struct survey_info *survey) -{ - struct p54_common *priv = dev->priv; - struct ieee80211_channel *chan; - int err, tries; - bool in_use = false; - - if (idx >= priv->chan_num) - return -ENOENT; - -#define MAX_TRIES 1 - for (tries = 0; tries < MAX_TRIES; tries++) { - chan = priv->curchan; - if (chan && chan->hw_value == idx) { - mutex_lock(&priv->conf_mutex); - err = p54_wait_for_stats(dev); - mutex_unlock(&priv->conf_mutex); - if (err) - return err; - - in_use = true; - } - - memcpy(survey, &priv->survey[idx], sizeof(*survey)); - - if (in_use) { - /* test if the reported statistics are valid. */ - if (survey->channel_time != 0) { - survey->filled |= SURVEY_INFO_IN_USE; - } else { - /* - * hw/fw has not accumulated enough sample sets. - * Wait for 100ms, this ought to be enough to - * to get at least one non-null set of channel - * usage statistics. - */ - msleep(100); - continue; - } - } - return 0; - } - return -ETIMEDOUT; -#undef MAX_TRIES -} - -static unsigned int p54_flush_count(struct p54_common *priv) -{ - unsigned int total = 0, i; - - BUILD_BUG_ON(P54_QUEUE_NUM > ARRAY_SIZE(priv->tx_stats)); - - /* - * Because the firmware has the sole control over any frames - * in the P54_QUEUE_BEACON or P54_QUEUE_SCAN queues, they - * don't really count as pending or active. - */ - for (i = P54_QUEUE_MGMT; i < P54_QUEUE_NUM; i++) - total += priv->tx_stats[i].len; - return total; -} - -static void p54_flush(struct ieee80211_hw *dev, u32 queues, bool drop) -{ - struct p54_common *priv = dev->priv; - unsigned int total, i; - - /* - * Currently, it wouldn't really matter if we wait for one second - * or 15 minutes. But once someone gets around and completes the - * TODOs [ancel stuck frames / reset device] in p54_work, it will - * suddenly make sense to wait that long. - */ - i = P54_STATISTICS_UPDATE * 2 / 20; - - /* - * In this case no locking is required because as we speak the - * queues have already been stopped and no new frames can sneak - * up from behind. - */ - while ((total = p54_flush_count(priv) && i--)) { - /* waste time */ - msleep(20); - } - - WARN(total, "tx flush timeout, unresponsive firmware"); -} - -static void p54_set_coverage_class(struct ieee80211_hw *dev, u8 coverage_class) -{ - struct p54_common *priv = dev->priv; - - mutex_lock(&priv->conf_mutex); - /* support all coverage class values as in 802.11-2007 Table 7-27 */ - priv->coverage_class = clamp_t(u8, coverage_class, 0, 31); - p54_set_edcf(priv); - mutex_unlock(&priv->conf_mutex); -} - -static const struct ieee80211_ops p54_ops = { - .tx = p54_tx_80211, - .start = p54_start, - .stop = p54_stop, - .add_interface = p54_add_interface, - .remove_interface = p54_remove_interface, - .set_tim = p54_set_tim, - .sta_notify = p54_sta_notify, - .sta_add = p54_sta_add_remove, - .sta_remove = p54_sta_add_remove, - .set_key = p54_set_key, - .config = p54_config, - .flush = p54_flush, - .bss_info_changed = p54_bss_info_changed, - .prepare_multicast = p54_prepare_multicast, - .configure_filter = p54_configure_filter, - .conf_tx = p54_conf_tx, - .get_stats = p54_get_stats, - .get_survey = p54_get_survey, - .set_coverage_class = p54_set_coverage_class, -}; - -struct ieee80211_hw *p54_init_common(size_t priv_data_len) -{ - struct ieee80211_hw *dev; - struct p54_common *priv; - - dev = ieee80211_alloc_hw(priv_data_len, &p54_ops); - if (!dev) - return NULL; - - priv = dev->priv; - priv->hw = dev; - priv->mode = NL80211_IFTYPE_UNSPECIFIED; - priv->basic_rate_mask = 0x15f; - spin_lock_init(&priv->tx_stats_lock); - skb_queue_head_init(&priv->tx_queue); - skb_queue_head_init(&priv->tx_pending); - dev->flags = IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_PS_NULLFUNC_STACK | - IEEE80211_HW_MFP_CAPABLE | - IEEE80211_HW_REPORTS_TX_ACK_STATUS; - - dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_MESH_POINT); - - dev->channel_change_time = 1000; /* TODO: find actual value */ - priv->beacon_req_id = cpu_to_le32(0); - priv->tx_stats[P54_QUEUE_BEACON].limit = 1; - priv->tx_stats[P54_QUEUE_FWSCAN].limit = 1; - priv->tx_stats[P54_QUEUE_MGMT].limit = 3; - priv->tx_stats[P54_QUEUE_CAB].limit = 3; - priv->tx_stats[P54_QUEUE_DATA].limit = 5; - dev->queues = 1; - priv->noise = -94; - /* - * We support at most 8 tries no matter which rate they're at, - * we cannot support max_rates * max_rate_tries as we set it - * here, but setting it correctly to 4/2 or so would limit us - * artificially if the RC algorithm wants just two rates, so - * let's say 4/7, we'll redistribute it at TX time, see the - * comments there. - */ - dev->max_rates = 4; - dev->max_rate_tries = 7; - dev->extra_tx_headroom = sizeof(struct p54_hdr) + 4 + - sizeof(struct p54_tx_data); - - /* - * For now, disable PS by default because it affects - * link stability significantly. - */ - dev->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; - - mutex_init(&priv->conf_mutex); - mutex_init(&priv->eeprom_mutex); - init_completion(&priv->stat_comp); - init_completion(&priv->eeprom_comp); - init_completion(&priv->beacon_comp); - INIT_DELAYED_WORK(&priv->work, p54_work); - - memset(&priv->mc_maclist[0], ~0, ETH_ALEN); - priv->curchan = NULL; - p54_reset_stats(priv); - return dev; -} -EXPORT_SYMBOL_GPL(p54_init_common); - -int p54_register_common(struct ieee80211_hw *dev, struct device *pdev) -{ - struct p54_common __maybe_unused *priv = dev->priv; - int err; - - err = ieee80211_register_hw(dev); - if (err) { - dev_err(pdev, "Cannot register device (%d).\n", err); - return err; - } - priv->registered = true; - -#ifdef CONFIG_P54_LEDS - err = p54_init_leds(priv); - if (err) { - p54_unregister_common(dev); - return err; - } -#endif /* CONFIG_P54_LEDS */ - - dev_info(pdev, "is registered as '%s'\n", wiphy_name(dev->wiphy)); - return 0; -} -EXPORT_SYMBOL_GPL(p54_register_common); - -void p54_free_common(struct ieee80211_hw *dev) -{ - struct p54_common *priv = dev->priv; - unsigned int i; - - for (i = 0; i < IEEE80211_NUM_BANDS; i++) - kfree(priv->band_table[i]); - - kfree(priv->iq_autocal); - kfree(priv->output_limit); - kfree(priv->curve_data); - kfree(priv->rssi_db); - kfree(priv->used_rxkeys); - kfree(priv->survey); - priv->iq_autocal = NULL; - priv->output_limit = NULL; - priv->curve_data = NULL; - priv->rssi_db = NULL; - priv->used_rxkeys = NULL; - priv->survey = NULL; - ieee80211_free_hw(dev); -} -EXPORT_SYMBOL_GPL(p54_free_common); - -void p54_unregister_common(struct ieee80211_hw *dev) -{ - struct p54_common *priv = dev->priv; - -#ifdef CONFIG_P54_LEDS - p54_unregister_leds(priv); -#endif /* CONFIG_P54_LEDS */ - - if (priv->registered) { - priv->registered = false; - ieee80211_unregister_hw(dev); - } - - mutex_destroy(&priv->conf_mutex); - mutex_destroy(&priv->eeprom_mutex); -} -EXPORT_SYMBOL_GPL(p54_unregister_common); diff --git a/drivers/net/wireless/p54/net2280.h b/drivers/net/wireless/p54/net2280.h deleted file mode 100644 index e3ed893b5aaf..000000000000 --- a/drivers/net/wireless/p54/net2280.h +++ /dev/null @@ -1,452 +0,0 @@ -#ifndef NET2280_H -#define NET2280_H -/* - * NetChip 2280 high/full speed USB device controller. - * Unlike many such controllers, this one talks PCI. - */ - -/* - * Copyright (C) 2002 NetChip Technology, Inc. (http://www.netchip.com) - * Copyright (C) 2003 David Brownell - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/*-------------------------------------------------------------------------*/ - -/* NET2280 MEMORY MAPPED REGISTERS - * - * The register layout came from the chip documentation, and the bit - * number definitions were extracted from chip specification. - * - * Use the shift operator ('<<') to build bit masks, with readl/writel - * to access the registers through PCI. - */ - -/* main registers, BAR0 + 0x0000 */ -struct net2280_regs { - /* offset 0x0000 */ - __le32 devinit; -#define LOCAL_CLOCK_FREQUENCY 8 -#define FORCE_PCI_RESET 7 -#define PCI_ID 6 -#define PCI_ENABLE 5 -#define FIFO_SOFT_RESET 4 -#define CFG_SOFT_RESET 3 -#define PCI_SOFT_RESET 2 -#define USB_SOFT_RESET 1 -#define M8051_RESET 0 - __le32 eectl; -#define EEPROM_ADDRESS_WIDTH 23 -#define EEPROM_CHIP_SELECT_ACTIVE 22 -#define EEPROM_PRESENT 21 -#define EEPROM_VALID 20 -#define EEPROM_BUSY 19 -#define EEPROM_CHIP_SELECT_ENABLE 18 -#define EEPROM_BYTE_READ_START 17 -#define EEPROM_BYTE_WRITE_START 16 -#define EEPROM_READ_DATA 8 -#define EEPROM_WRITE_DATA 0 - __le32 eeclkfreq; - u32 _unused0; - /* offset 0x0010 */ - - __le32 pciirqenb0; /* interrupt PCI master ... */ -#define SETUP_PACKET_INTERRUPT_ENABLE 7 -#define ENDPOINT_F_INTERRUPT_ENABLE 6 -#define ENDPOINT_E_INTERRUPT_ENABLE 5 -#define ENDPOINT_D_INTERRUPT_ENABLE 4 -#define ENDPOINT_C_INTERRUPT_ENABLE 3 -#define ENDPOINT_B_INTERRUPT_ENABLE 2 -#define ENDPOINT_A_INTERRUPT_ENABLE 1 -#define ENDPOINT_0_INTERRUPT_ENABLE 0 - __le32 pciirqenb1; -#define PCI_INTERRUPT_ENABLE 31 -#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27 -#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26 -#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25 -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20 -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19 -#define PCI_TARGET_ABORT_ASSERTED_INTERRUPT_ENABLE 18 -#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17 -#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16 -#define GPIO_INTERRUPT_ENABLE 13 -#define DMA_D_INTERRUPT_ENABLE 12 -#define DMA_C_INTERRUPT_ENABLE 11 -#define DMA_B_INTERRUPT_ENABLE 10 -#define DMA_A_INTERRUPT_ENABLE 9 -#define EEPROM_DONE_INTERRUPT_ENABLE 8 -#define VBUS_INTERRUPT_ENABLE 7 -#define CONTROL_STATUS_INTERRUPT_ENABLE 6 -#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4 -#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3 -#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2 -#define RESUME_INTERRUPT_ENABLE 1 -#define SOF_INTERRUPT_ENABLE 0 - __le32 cpu_irqenb0; /* ... or onboard 8051 */ -#define SETUP_PACKET_INTERRUPT_ENABLE 7 -#define ENDPOINT_F_INTERRUPT_ENABLE 6 -#define ENDPOINT_E_INTERRUPT_ENABLE 5 -#define ENDPOINT_D_INTERRUPT_ENABLE 4 -#define ENDPOINT_C_INTERRUPT_ENABLE 3 -#define ENDPOINT_B_INTERRUPT_ENABLE 2 -#define ENDPOINT_A_INTERRUPT_ENABLE 1 -#define ENDPOINT_0_INTERRUPT_ENABLE 0 - __le32 cpu_irqenb1; -#define CPU_INTERRUPT_ENABLE 31 -#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27 -#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26 -#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25 -#define PCI_INTA_INTERRUPT_ENABLE 24 -#define PCI_PME_INTERRUPT_ENABLE 23 -#define PCI_SERR_INTERRUPT_ENABLE 22 -#define PCI_PERR_INTERRUPT_ENABLE 21 -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20 -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19 -#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17 -#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16 -#define GPIO_INTERRUPT_ENABLE 13 -#define DMA_D_INTERRUPT_ENABLE 12 -#define DMA_C_INTERRUPT_ENABLE 11 -#define DMA_B_INTERRUPT_ENABLE 10 -#define DMA_A_INTERRUPT_ENABLE 9 -#define EEPROM_DONE_INTERRUPT_ENABLE 8 -#define VBUS_INTERRUPT_ENABLE 7 -#define CONTROL_STATUS_INTERRUPT_ENABLE 6 -#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4 -#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3 -#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2 -#define RESUME_INTERRUPT_ENABLE 1 -#define SOF_INTERRUPT_ENABLE 0 - - /* offset 0x0020 */ - u32 _unused1; - __le32 usbirqenb1; -#define USB_INTERRUPT_ENABLE 31 -#define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27 -#define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26 -#define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25 -#define PCI_INTA_INTERRUPT_ENABLE 24 -#define PCI_PME_INTERRUPT_ENABLE 23 -#define PCI_SERR_INTERRUPT_ENABLE 22 -#define PCI_PERR_INTERRUPT_ENABLE 21 -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20 -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19 -#define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17 -#define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16 -#define GPIO_INTERRUPT_ENABLE 13 -#define DMA_D_INTERRUPT_ENABLE 12 -#define DMA_C_INTERRUPT_ENABLE 11 -#define DMA_B_INTERRUPT_ENABLE 10 -#define DMA_A_INTERRUPT_ENABLE 9 -#define EEPROM_DONE_INTERRUPT_ENABLE 8 -#define VBUS_INTERRUPT_ENABLE 7 -#define CONTROL_STATUS_INTERRUPT_ENABLE 6 -#define ROOT_PORT_RESET_INTERRUPT_ENABLE 4 -#define SUSPEND_REQUEST_INTERRUPT_ENABLE 3 -#define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2 -#define RESUME_INTERRUPT_ENABLE 1 -#define SOF_INTERRUPT_ENABLE 0 - __le32 irqstat0; -#define INTA_ASSERTED 12 -#define SETUP_PACKET_INTERRUPT 7 -#define ENDPOINT_F_INTERRUPT 6 -#define ENDPOINT_E_INTERRUPT 5 -#define ENDPOINT_D_INTERRUPT 4 -#define ENDPOINT_C_INTERRUPT 3 -#define ENDPOINT_B_INTERRUPT 2 -#define ENDPOINT_A_INTERRUPT 1 -#define ENDPOINT_0_INTERRUPT 0 - __le32 irqstat1; -#define POWER_STATE_CHANGE_INTERRUPT 27 -#define PCI_ARBITER_TIMEOUT_INTERRUPT 26 -#define PCI_PARITY_ERROR_INTERRUPT 25 -#define PCI_INTA_INTERRUPT 24 -#define PCI_PME_INTERRUPT 23 -#define PCI_SERR_INTERRUPT 22 -#define PCI_PERR_INTERRUPT 21 -#define PCI_MASTER_ABORT_RECEIVED_INTERRUPT 20 -#define PCI_TARGET_ABORT_RECEIVED_INTERRUPT 19 -#define PCI_RETRY_ABORT_INTERRUPT 17 -#define PCI_MASTER_CYCLE_DONE_INTERRUPT 16 -#define GPIO_INTERRUPT 13 -#define DMA_D_INTERRUPT 12 -#define DMA_C_INTERRUPT 11 -#define DMA_B_INTERRUPT 10 -#define DMA_A_INTERRUPT 9 -#define EEPROM_DONE_INTERRUPT 8 -#define VBUS_INTERRUPT 7 -#define CONTROL_STATUS_INTERRUPT 6 -#define ROOT_PORT_RESET_INTERRUPT 4 -#define SUSPEND_REQUEST_INTERRUPT 3 -#define SUSPEND_REQUEST_CHANGE_INTERRUPT 2 -#define RESUME_INTERRUPT 1 -#define SOF_INTERRUPT 0 - /* offset 0x0030 */ - __le32 idxaddr; - __le32 idxdata; - __le32 fifoctl; -#define PCI_BASE2_RANGE 16 -#define IGNORE_FIFO_AVAILABILITY 3 -#define PCI_BASE2_SELECT 2 -#define FIFO_CONFIGURATION_SELECT 0 - u32 _unused2; - /* offset 0x0040 */ - __le32 memaddr; -#define START 28 -#define DIRECTION 27 -#define FIFO_DIAGNOSTIC_SELECT 24 -#define MEMORY_ADDRESS 0 - __le32 memdata0; - __le32 memdata1; - u32 _unused3; - /* offset 0x0050 */ - __le32 gpioctl; -#define GPIO3_LED_SELECT 12 -#define GPIO3_INTERRUPT_ENABLE 11 -#define GPIO2_INTERRUPT_ENABLE 10 -#define GPIO1_INTERRUPT_ENABLE 9 -#define GPIO0_INTERRUPT_ENABLE 8 -#define GPIO3_OUTPUT_ENABLE 7 -#define GPIO2_OUTPUT_ENABLE 6 -#define GPIO1_OUTPUT_ENABLE 5 -#define GPIO0_OUTPUT_ENABLE 4 -#define GPIO3_DATA 3 -#define GPIO2_DATA 2 -#define GPIO1_DATA 1 -#define GPIO0_DATA 0 - __le32 gpiostat; -#define GPIO3_INTERRUPT 3 -#define GPIO2_INTERRUPT 2 -#define GPIO1_INTERRUPT 1 -#define GPIO0_INTERRUPT 0 -} __packed; - -/* usb control, BAR0 + 0x0080 */ -struct net2280_usb_regs { - /* offset 0x0080 */ - __le32 stdrsp; -#define STALL_UNSUPPORTED_REQUESTS 31 -#define SET_TEST_MODE 16 -#define GET_OTHER_SPEED_CONFIGURATION 15 -#define GET_DEVICE_QUALIFIER 14 -#define SET_ADDRESS 13 -#define ENDPOINT_SET_CLEAR_HALT 12 -#define DEVICE_SET_CLEAR_DEVICE_REMOTE_WAKEUP 11 -#define GET_STRING_DESCRIPTOR_2 10 -#define GET_STRING_DESCRIPTOR_1 9 -#define GET_STRING_DESCRIPTOR_0 8 -#define GET_SET_INTERFACE 6 -#define GET_SET_CONFIGURATION 5 -#define GET_CONFIGURATION_DESCRIPTOR 4 -#define GET_DEVICE_DESCRIPTOR 3 -#define GET_ENDPOINT_STATUS 2 -#define GET_INTERFACE_STATUS 1 -#define GET_DEVICE_STATUS 0 - __le32 prodvendid; -#define PRODUCT_ID 16 -#define VENDOR_ID 0 - __le32 relnum; - __le32 usbctl; -#define SERIAL_NUMBER_INDEX 16 -#define PRODUCT_ID_STRING_ENABLE 13 -#define VENDOR_ID_STRING_ENABLE 12 -#define USB_ROOT_PORT_WAKEUP_ENABLE 11 -#define VBUS_PIN 10 -#define TIMED_DISCONNECT 9 -#define SUSPEND_IMMEDIATELY 7 -#define SELF_POWERED_USB_DEVICE 6 -#define REMOTE_WAKEUP_SUPPORT 5 -#define PME_POLARITY 4 -#define USB_DETECT_ENABLE 3 -#define PME_WAKEUP_ENABLE 2 -#define DEVICE_REMOTE_WAKEUP_ENABLE 1 -#define SELF_POWERED_STATUS 0 - /* offset 0x0090 */ - __le32 usbstat; -#define HIGH_SPEED 7 -#define FULL_SPEED 6 -#define GENERATE_RESUME 5 -#define GENERATE_DEVICE_REMOTE_WAKEUP 4 - __le32 xcvrdiag; -#define FORCE_HIGH_SPEED_MODE 31 -#define FORCE_FULL_SPEED_MODE 30 -#define USB_TEST_MODE 24 -#define LINE_STATE 16 -#define TRANSCEIVER_OPERATION_MODE 2 -#define TRANSCEIVER_SELECT 1 -#define TERMINATION_SELECT 0 - __le32 setup0123; - __le32 setup4567; - /* offset 0x0090 */ - u32 _unused0; - __le32 ouraddr; -#define FORCE_IMMEDIATE 7 -#define OUR_USB_ADDRESS 0 - __le32 ourconfig; -} __packed; - -/* pci control, BAR0 + 0x0100 */ -struct net2280_pci_regs { - /* offset 0x0100 */ - __le32 pcimstctl; -#define PCI_ARBITER_PARK_SELECT 13 -#define PCI_MULTI LEVEL_ARBITER 12 -#define PCI_RETRY_ABORT_ENABLE 11 -#define DMA_MEMORY_WRITE_AND_INVALIDATE_ENABLE 10 -#define DMA_READ_MULTIPLE_ENABLE 9 -#define DMA_READ_LINE_ENABLE 8 -#define PCI_MASTER_COMMAND_SELECT 6 -#define MEM_READ_OR_WRITE 0 -#define IO_READ_OR_WRITE 1 -#define CFG_READ_OR_WRITE 2 -#define PCI_MASTER_START 5 -#define PCI_MASTER_READ_WRITE 4 -#define PCI_MASTER_WRITE 0 -#define PCI_MASTER_READ 1 -#define PCI_MASTER_BYTE_WRITE_ENABLES 0 - __le32 pcimstaddr; - __le32 pcimstdata; - __le32 pcimststat; -#define PCI_ARBITER_CLEAR 2 -#define PCI_EXTERNAL_ARBITER 1 -#define PCI_HOST_MODE 0 -} __packed; - -/* dma control, BAR0 + 0x0180 ... array of four structs like this, - * for channels 0..3. see also struct net2280_dma: descriptor - * that can be loaded into some of these registers. - */ -struct net2280_dma_regs { /* [11.7] */ - /* offset 0x0180, 0x01a0, 0x01c0, 0x01e0, */ - __le32 dmactl; -#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25 -#define DMA_CLEAR_COUNT_ENABLE 21 -#define DESCRIPTOR_POLLING_RATE 19 -#define POLL_CONTINUOUS 0 -#define POLL_1_USEC 1 -#define POLL_100_USEC 2 -#define POLL_1_MSEC 3 -#define DMA_VALID_BIT_POLLING_ENABLE 18 -#define DMA_VALID_BIT_ENABLE 17 -#define DMA_SCATTER_GATHER_ENABLE 16 -#define DMA_OUT_AUTO_START_ENABLE 4 -#define DMA_PREEMPT_ENABLE 3 -#define DMA_FIFO_VALIDATE 2 -#define DMA_ENABLE 1 -#define DMA_ADDRESS_HOLD 0 - __le32 dmastat; -#define DMA_SCATTER_GATHER_DONE_INTERRUPT 25 -#define DMA_TRANSACTION_DONE_INTERRUPT 24 -#define DMA_ABORT 1 -#define DMA_START 0 - u32 _unused0[2]; - /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */ - __le32 dmacount; -#define VALID_BIT 31 -#define DMA_DIRECTION 30 -#define DMA_DONE_INTERRUPT_ENABLE 29 -#define END_OF_CHAIN 28 -#define DMA_BYTE_COUNT_MASK ((1<<24)-1) -#define DMA_BYTE_COUNT 0 - __le32 dmaaddr; - __le32 dmadesc; - u32 _unused1; -} __packed; - -/* dedicated endpoint registers, BAR0 + 0x0200 */ - -struct net2280_dep_regs { /* [11.8] */ - /* offset 0x0200, 0x0210, 0x220, 0x230, 0x240 */ - __le32 dep_cfg; - /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */ - __le32 dep_rsp; - u32 _unused[2]; -} __packed; - -/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs - * like this, for ep0 then the configurable endpoints A..F - * ep0 reserved for control; E and F have only 64 bytes of fifo - */ -struct net2280_ep_regs { /* [11.9] */ - /* offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 */ - __le32 ep_cfg; -#define ENDPOINT_BYTE_COUNT 16 -#define ENDPOINT_ENABLE 10 -#define ENDPOINT_TYPE 8 -#define ENDPOINT_DIRECTION 7 -#define ENDPOINT_NUMBER 0 - __le32 ep_rsp; -#define SET_NAK_OUT_PACKETS 15 -#define SET_EP_HIDE_STATUS_PHASE 14 -#define SET_EP_FORCE_CRC_ERROR 13 -#define SET_INTERRUPT_MODE 12 -#define SET_CONTROL_STATUS_PHASE_HANDSHAKE 11 -#define SET_NAK_OUT_PACKETS_MODE 10 -#define SET_ENDPOINT_TOGGLE 9 -#define SET_ENDPOINT_HALT 8 -#define CLEAR_NAK_OUT_PACKETS 7 -#define CLEAR_EP_HIDE_STATUS_PHASE 6 -#define CLEAR_EP_FORCE_CRC_ERROR 5 -#define CLEAR_INTERRUPT_MODE 4 -#define CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE 3 -#define CLEAR_NAK_OUT_PACKETS_MODE 2 -#define CLEAR_ENDPOINT_TOGGLE 1 -#define CLEAR_ENDPOINT_HALT 0 - __le32 ep_irqenb; -#define SHORT_PACKET_OUT_DONE_INTERRUPT_ENABLE 6 -#define SHORT_PACKET_TRANSFERRED_INTERRUPT_ENABLE 5 -#define DATA_PACKET_RECEIVED_INTERRUPT_ENABLE 3 -#define DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE 2 -#define DATA_OUT_PING_TOKEN_INTERRUPT_ENABLE 1 -#define DATA_IN_TOKEN_INTERRUPT_ENABLE 0 - __le32 ep_stat; -#define FIFO_VALID_COUNT 24 -#define HIGH_BANDWIDTH_OUT_TRANSACTION_PID 22 -#define TIMEOUT 21 -#define USB_STALL_SENT 20 -#define USB_IN_NAK_SENT 19 -#define USB_IN_ACK_RCVD 18 -#define USB_OUT_PING_NAK_SENT 17 -#define USB_OUT_ACK_SENT 16 -#define FIFO_OVERFLOW 13 -#define FIFO_UNDERFLOW 12 -#define FIFO_FULL 11 -#define FIFO_EMPTY 10 -#define FIFO_FLUSH 9 -#define SHORT_PACKET_OUT_DONE_INTERRUPT 6 -#define SHORT_PACKET_TRANSFERRED_INTERRUPT 5 -#define NAK_OUT_PACKETS 4 -#define DATA_PACKET_RECEIVED_INTERRUPT 3 -#define DATA_PACKET_TRANSMITTED_INTERRUPT 2 -#define DATA_OUT_PING_TOKEN_INTERRUPT 1 -#define DATA_IN_TOKEN_INTERRUPT 0 - /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */ - __le32 ep_avail; - __le32 ep_data; - u32 _unused0[2]; -} __packed; - -struct net2280_reg_write { - __le16 port; - __le32 addr; - __le32 val; -} __packed; - -struct net2280_reg_read { - __le16 port; - __le32 addr; -} __packed; -#endif /* NET2280_H */ diff --git a/drivers/net/wireless/p54/p54.h b/drivers/net/wireless/p54/p54.h deleted file mode 100644 index 40b401ed6845..000000000000 --- a/drivers/net/wireless/p54/p54.h +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Shared defines for all mac80211 Prism54 code - * - * Copyright (c) 2006, Michael Wu - * - * Based on the islsm (softmac prism54) driver, which is: - * Copyright 2004-2006 Jean-Baptiste Note , et al. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef P54_H -#define P54_H - -#ifdef CONFIG_P54_LEDS -#include -#endif /* CONFIG_P54_LEDS */ - -#define ISL38XX_DEV_FIRMWARE_ADDR 0x20000 - -#define BR_CODE_MIN 0x80000000 -#define BR_CODE_COMPONENT_ID 0x80000001 -#define BR_CODE_COMPONENT_VERSION 0x80000002 -#define BR_CODE_DEPENDENT_IF 0x80000003 -#define BR_CODE_EXPOSED_IF 0x80000004 -#define BR_CODE_DESCR 0x80000101 -#define BR_CODE_MAX 0x8FFFFFFF -#define BR_CODE_END_OF_BRA 0xFF0000FF -#define LEGACY_BR_CODE_END_OF_BRA 0xFFFFFFFF - -struct bootrec { - __le32 code; - __le32 len; - u32 data[10]; -} __packed; - -/* Interface role definitions */ -#define BR_INTERFACE_ROLE_SERVER 0x0000 -#define BR_INTERFACE_ROLE_CLIENT 0x8000 - -#define BR_DESC_PRIV_CAP_WEP BIT(0) -#define BR_DESC_PRIV_CAP_TKIP BIT(1) -#define BR_DESC_PRIV_CAP_MICHAEL BIT(2) -#define BR_DESC_PRIV_CAP_CCX_CP BIT(3) -#define BR_DESC_PRIV_CAP_CCX_MIC BIT(4) -#define BR_DESC_PRIV_CAP_AESCCMP BIT(5) - -struct bootrec_desc { - __le16 modes; - __le16 flags; - __le32 rx_start; - __le32 rx_end; - u8 headroom; - u8 tailroom; - u8 tx_queues; - u8 tx_depth; - u8 privacy_caps; - u8 rx_keycache_size; - u8 time_size; - u8 padding; - u8 rates[16]; - u8 padding2[4]; - __le16 rx_mtu; -} __packed; - -#define FW_FMAC 0x464d4143 -#define FW_LM86 0x4c4d3836 -#define FW_LM87 0x4c4d3837 -#define FW_LM20 0x4c4d3230 - -struct bootrec_comp_id { - __le32 fw_variant; -} __packed; - -struct bootrec_comp_ver { - char fw_version[24]; -} __packed; - -struct bootrec_end { - __le16 crc; - u8 padding[2]; - u8 md5[16]; -} __packed; - -/* provide 16 bytes for the transport back-end */ -#define P54_TX_INFO_DATA_SIZE 16 - -/* stored in ieee80211_tx_info's rate_driver_data */ -struct p54_tx_info { - u32 start_addr; - u32 end_addr; - union { - void *data[P54_TX_INFO_DATA_SIZE / sizeof(void *)]; - struct { - u32 extra_len; - }; - }; -}; - -#define P54_MAX_CTRL_FRAME_LEN 0x1000 - -#define P54_SET_QUEUE(queue, ai_fs, cw_min, cw_max, _txop) \ -do { \ - queue.aifs = cpu_to_le16(ai_fs); \ - queue.cwmin = cpu_to_le16(cw_min); \ - queue.cwmax = cpu_to_le16(cw_max); \ - queue.txop = cpu_to_le16(_txop); \ -} while (0) - -struct p54_edcf_queue_param { - __le16 aifs; - __le16 cwmin; - __le16 cwmax; - __le16 txop; -} __packed; - -struct p54_rssi_db_entry { - u16 freq; - s16 mul; - s16 add; - s16 longbow_unkn; - s16 longbow_unk2; -}; - -struct p54_cal_database { - size_t entries; - size_t entry_size; - size_t offset; - size_t len; - u8 data[0]; -}; - -#define EEPROM_READBACK_LEN 0x3fc - -enum fw_state { - FW_STATE_OFF, - FW_STATE_BOOTING, - FW_STATE_READY, - FW_STATE_RESET, - FW_STATE_RESETTING, -}; - -#ifdef CONFIG_P54_LEDS - -#define P54_LED_MAX_NAME_LEN 31 - -struct p54_led_dev { - struct ieee80211_hw *hw_dev; - struct led_classdev led_dev; - char name[P54_LED_MAX_NAME_LEN + 1]; - - unsigned int toggled; - unsigned int index; - unsigned int registered; -}; - -#endif /* CONFIG_P54_LEDS */ - -struct p54_tx_queue_stats { - unsigned int len; - unsigned int limit; - unsigned int count; -}; - -struct p54_common { - struct ieee80211_hw *hw; - struct ieee80211_vif *vif; - void (*tx)(struct ieee80211_hw *dev, struct sk_buff *skb); - int (*open)(struct ieee80211_hw *dev); - void (*stop)(struct ieee80211_hw *dev); - struct sk_buff_head tx_pending; - struct sk_buff_head tx_queue; - struct mutex conf_mutex; - bool registered; - - /* memory management (as seen by the firmware) */ - u32 rx_start; - u32 rx_end; - u16 rx_mtu; - u8 headroom; - u8 tailroom; - - /* firmware/hardware info */ - unsigned int tx_hdr_len; - unsigned int fw_var; - unsigned int fw_interface; - u8 version; - - /* (e)DCF / QOS state */ - bool use_short_slot; - spinlock_t tx_stats_lock; - struct p54_tx_queue_stats tx_stats[8]; - struct p54_edcf_queue_param qos_params[8]; - - /* Radio data */ - u16 rxhw; - u8 rx_diversity_mask; - u8 tx_diversity_mask; - unsigned int output_power; - struct p54_rssi_db_entry *cur_rssi; - struct ieee80211_channel *curchan; - struct survey_info *survey; - unsigned int chan_num; - struct completion stat_comp; - bool update_stats; - struct { - unsigned int timestamp; - unsigned int cached_cca; - unsigned int cached_tx; - unsigned int cached_rssi; - u64 active; - u64 cca; - u64 tx; - u64 rssi; - } survey_raw; - - int noise; - /* calibration, output power limit and rssi<->dBm conversation data */ - struct pda_iq_autocal_entry *iq_autocal; - unsigned int iq_autocal_len; - struct p54_cal_database *curve_data; - struct p54_cal_database *output_limit; - struct p54_cal_database *rssi_db; - struct ieee80211_supported_band *band_table[IEEE80211_NUM_BANDS]; - - /* BBP/MAC state */ - u8 mac_addr[ETH_ALEN]; - u8 bssid[ETH_ALEN]; - u8 mc_maclist[4][ETH_ALEN]; - u16 wakeup_timer; - unsigned int filter_flags; - int mc_maclist_num; - int mode; - u32 tsf_low32, tsf_high32; - u32 basic_rate_mask; - u16 aid; - u8 coverage_class; - bool phy_idle; - bool phy_ps; - bool powersave_override; - __le32 beacon_req_id; - struct completion beacon_comp; - - /* cryptographic engine information */ - u8 privacy_caps; - u8 rx_keycache_size; - unsigned long *used_rxkeys; - - /* LED management */ -#ifdef CONFIG_P54_LEDS - struct p54_led_dev leds[4]; - struct delayed_work led_work; -#endif /* CONFIG_P54_LEDS */ - u16 softled_state; /* bit field of glowing LEDs */ - - /* statistics */ - struct ieee80211_low_level_stats stats; - struct delayed_work work; - - /* eeprom handling */ - void *eeprom; - struct completion eeprom_comp; - struct mutex eeprom_mutex; -}; - -/* interfaces for the drivers */ -int p54_rx(struct ieee80211_hw *dev, struct sk_buff *skb); -void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb); -int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw); -int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len); -int p54_read_eeprom(struct ieee80211_hw *dev); - -struct ieee80211_hw *p54_init_common(size_t priv_data_len); -int p54_register_common(struct ieee80211_hw *dev, struct device *pdev); -void p54_free_common(struct ieee80211_hw *dev); - -void p54_unregister_common(struct ieee80211_hw *dev); - -#endif /* P54_H */ diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c deleted file mode 100644 index 57e3af8ebb4b..000000000000 --- a/drivers/net/wireless/p54/p54pci.c +++ /dev/null @@ -1,702 +0,0 @@ - -/* - * Linux device driver for PCI based Prism54 - * - * Copyright (c) 2006, Michael Wu - * Copyright (c) 2008, Christian Lamparter - * - * Based on the islsm (softmac prism54) driver, which is: - * Copyright 2004-2006 Jean-Baptiste Note , et al. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "p54.h" -#include "lmac.h" -#include "p54pci.h" - -MODULE_AUTHOR("Michael Wu "); -MODULE_DESCRIPTION("Prism54 PCI wireless driver"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("prism54pci"); -MODULE_FIRMWARE("isl3886pci"); - -static DEFINE_PCI_DEVICE_TABLE(p54p_table) = { - /* Intersil PRISM Duette/Prism GT Wireless LAN adapter */ - { PCI_DEVICE(0x1260, 0x3890) }, - /* 3COM 3CRWE154G72 Wireless LAN adapter */ - { PCI_DEVICE(0x10b7, 0x6001) }, - /* Intersil PRISM Indigo Wireless LAN adapter */ - { PCI_DEVICE(0x1260, 0x3877) }, - /* Intersil PRISM Javelin/Xbow Wireless LAN adapter */ - { PCI_DEVICE(0x1260, 0x3886) }, - /* Intersil PRISM Xbow Wireless LAN adapter (Symbol AP-300) */ - { PCI_DEVICE(0x1260, 0xffff) }, - { }, -}; - -MODULE_DEVICE_TABLE(pci, p54p_table); - -static int p54p_upload_firmware(struct ieee80211_hw *dev) -{ - struct p54p_priv *priv = dev->priv; - __le32 reg; - int err; - __le32 *data; - u32 remains, left, device_addr; - - P54P_WRITE(int_enable, cpu_to_le32(0)); - P54P_READ(int_enable); - udelay(10); - - reg = P54P_READ(ctrl_stat); - reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET); - reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RAMBOOT); - P54P_WRITE(ctrl_stat, reg); - P54P_READ(ctrl_stat); - udelay(10); - - reg |= cpu_to_le32(ISL38XX_CTRL_STAT_RESET); - P54P_WRITE(ctrl_stat, reg); - wmb(); - udelay(10); - - reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET); - P54P_WRITE(ctrl_stat, reg); - wmb(); - - /* wait for the firmware to reset properly */ - mdelay(10); - - err = p54_parse_firmware(dev, priv->firmware); - if (err) - return err; - - if (priv->common.fw_interface != FW_LM86) { - dev_err(&priv->pdev->dev, "wrong firmware, " - "please get a LM86(PCI) firmware a try again.\n"); - return -EINVAL; - } - - data = (__le32 *) priv->firmware->data; - remains = priv->firmware->size; - device_addr = ISL38XX_DEV_FIRMWARE_ADDR; - while (remains) { - u32 i = 0; - left = min((u32)0x1000, remains); - P54P_WRITE(direct_mem_base, cpu_to_le32(device_addr)); - P54P_READ(int_enable); - - device_addr += 0x1000; - while (i < left) { - P54P_WRITE(direct_mem_win[i], *data++); - i += sizeof(u32); - } - - remains -= left; - P54P_READ(int_enable); - } - - reg = P54P_READ(ctrl_stat); - reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_CLKRUN); - reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET); - reg |= cpu_to_le32(ISL38XX_CTRL_STAT_RAMBOOT); - P54P_WRITE(ctrl_stat, reg); - P54P_READ(ctrl_stat); - udelay(10); - - reg |= cpu_to_le32(ISL38XX_CTRL_STAT_RESET); - P54P_WRITE(ctrl_stat, reg); - wmb(); - udelay(10); - - reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET); - P54P_WRITE(ctrl_stat, reg); - wmb(); - udelay(10); - - /* wait for the firmware to boot properly */ - mdelay(100); - - return 0; -} - -static void p54p_refill_rx_ring(struct ieee80211_hw *dev, - int ring_index, struct p54p_desc *ring, u32 ring_limit, - struct sk_buff **rx_buf, u32 index) -{ - struct p54p_priv *priv = dev->priv; - struct p54p_ring_control *ring_control = priv->ring_control; - u32 limit, idx, i; - - idx = le32_to_cpu(ring_control->host_idx[ring_index]); - limit = idx; - limit -= index; - limit = ring_limit - limit; - - i = idx % ring_limit; - while (limit-- > 1) { - struct p54p_desc *desc = &ring[i]; - - if (!desc->host_addr) { - struct sk_buff *skb; - dma_addr_t mapping; - skb = dev_alloc_skb(priv->common.rx_mtu + 32); - if (!skb) - break; - - mapping = pci_map_single(priv->pdev, - skb_tail_pointer(skb), - priv->common.rx_mtu + 32, - PCI_DMA_FROMDEVICE); - - if (pci_dma_mapping_error(priv->pdev, mapping)) { - dev_kfree_skb_any(skb); - dev_err(&priv->pdev->dev, - "RX DMA Mapping error\n"); - break; - } - - desc->host_addr = cpu_to_le32(mapping); - desc->device_addr = 0; // FIXME: necessary? - desc->len = cpu_to_le16(priv->common.rx_mtu + 32); - desc->flags = 0; - rx_buf[i] = skb; - } - - i++; - idx++; - i %= ring_limit; - } - - wmb(); - ring_control->host_idx[ring_index] = cpu_to_le32(idx); -} - -static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index, - int ring_index, struct p54p_desc *ring, u32 ring_limit, - struct sk_buff **rx_buf) -{ - struct p54p_priv *priv = dev->priv; - struct p54p_ring_control *ring_control = priv->ring_control; - struct p54p_desc *desc; - u32 idx, i; - - i = (*index) % ring_limit; - (*index) = idx = le32_to_cpu(ring_control->device_idx[ring_index]); - idx %= ring_limit; - while (i != idx) { - u16 len; - struct sk_buff *skb; - dma_addr_t dma_addr; - desc = &ring[i]; - len = le16_to_cpu(desc->len); - skb = rx_buf[i]; - - if (!skb) { - i++; - i %= ring_limit; - continue; - } - - if (unlikely(len > priv->common.rx_mtu)) { - if (net_ratelimit()) - dev_err(&priv->pdev->dev, "rx'd frame size " - "exceeds length threshold.\n"); - - len = priv->common.rx_mtu; - } - dma_addr = le32_to_cpu(desc->host_addr); - pci_dma_sync_single_for_cpu(priv->pdev, dma_addr, - priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE); - skb_put(skb, len); - - if (p54_rx(dev, skb)) { - pci_unmap_single(priv->pdev, dma_addr, - priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE); - rx_buf[i] = NULL; - desc->host_addr = cpu_to_le32(0); - } else { - skb_trim(skb, 0); - pci_dma_sync_single_for_device(priv->pdev, dma_addr, - priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE); - desc->len = cpu_to_le16(priv->common.rx_mtu + 32); - } - - i++; - i %= ring_limit; - } - - p54p_refill_rx_ring(dev, ring_index, ring, ring_limit, rx_buf, *index); -} - -static void p54p_check_tx_ring(struct ieee80211_hw *dev, u32 *index, - int ring_index, struct p54p_desc *ring, u32 ring_limit, - struct sk_buff **tx_buf) -{ - struct p54p_priv *priv = dev->priv; - struct p54p_ring_control *ring_control = priv->ring_control; - struct p54p_desc *desc; - struct sk_buff *skb; - u32 idx, i; - - i = (*index) % ring_limit; - (*index) = idx = le32_to_cpu(ring_control->device_idx[ring_index]); - idx %= ring_limit; - - while (i != idx) { - desc = &ring[i]; - - skb = tx_buf[i]; - tx_buf[i] = NULL; - - pci_unmap_single(priv->pdev, le32_to_cpu(desc->host_addr), - le16_to_cpu(desc->len), PCI_DMA_TODEVICE); - - desc->host_addr = 0; - desc->device_addr = 0; - desc->len = 0; - desc->flags = 0; - - if (skb && FREE_AFTER_TX(skb)) - p54_free_skb(dev, skb); - - i++; - i %= ring_limit; - } -} - -static void p54p_tasklet(unsigned long dev_id) -{ - struct ieee80211_hw *dev = (struct ieee80211_hw *)dev_id; - struct p54p_priv *priv = dev->priv; - struct p54p_ring_control *ring_control = priv->ring_control; - - p54p_check_tx_ring(dev, &priv->tx_idx_mgmt, 3, ring_control->tx_mgmt, - ARRAY_SIZE(ring_control->tx_mgmt), - priv->tx_buf_mgmt); - - p54p_check_tx_ring(dev, &priv->tx_idx_data, 1, ring_control->tx_data, - ARRAY_SIZE(ring_control->tx_data), - priv->tx_buf_data); - - p54p_check_rx_ring(dev, &priv->rx_idx_mgmt, 2, ring_control->rx_mgmt, - ARRAY_SIZE(ring_control->rx_mgmt), priv->rx_buf_mgmt); - - p54p_check_rx_ring(dev, &priv->rx_idx_data, 0, ring_control->rx_data, - ARRAY_SIZE(ring_control->rx_data), priv->rx_buf_data); - - wmb(); - P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE)); -} - -static irqreturn_t p54p_interrupt(int irq, void *dev_id) -{ - struct ieee80211_hw *dev = dev_id; - struct p54p_priv *priv = dev->priv; - __le32 reg; - - reg = P54P_READ(int_ident); - if (unlikely(reg == cpu_to_le32(0xFFFFFFFF))) { - goto out; - } - P54P_WRITE(int_ack, reg); - - reg &= P54P_READ(int_enable); - - if (reg & cpu_to_le32(ISL38XX_INT_IDENT_UPDATE)) - tasklet_schedule(&priv->tasklet); - else if (reg & cpu_to_le32(ISL38XX_INT_IDENT_INIT)) - complete(&priv->boot_comp); - -out: - return reg ? IRQ_HANDLED : IRQ_NONE; -} - -static void p54p_tx(struct ieee80211_hw *dev, struct sk_buff *skb) -{ - unsigned long flags; - struct p54p_priv *priv = dev->priv; - struct p54p_ring_control *ring_control = priv->ring_control; - struct p54p_desc *desc; - dma_addr_t mapping; - u32 idx, i; - - spin_lock_irqsave(&priv->lock, flags); - idx = le32_to_cpu(ring_control->host_idx[1]); - i = idx % ARRAY_SIZE(ring_control->tx_data); - - mapping = pci_map_single(priv->pdev, skb->data, skb->len, - PCI_DMA_TODEVICE); - if (pci_dma_mapping_error(priv->pdev, mapping)) { - spin_unlock_irqrestore(&priv->lock, flags); - p54_free_skb(dev, skb); - dev_err(&priv->pdev->dev, "TX DMA mapping error\n"); - return ; - } - priv->tx_buf_data[i] = skb; - - desc = &ring_control->tx_data[i]; - desc->host_addr = cpu_to_le32(mapping); - desc->device_addr = ((struct p54_hdr *)skb->data)->req_id; - desc->len = cpu_to_le16(skb->len); - desc->flags = 0; - - wmb(); - ring_control->host_idx[1] = cpu_to_le32(idx + 1); - spin_unlock_irqrestore(&priv->lock, flags); - - P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE)); - P54P_READ(dev_int); -} - -static void p54p_stop(struct ieee80211_hw *dev) -{ - struct p54p_priv *priv = dev->priv; - struct p54p_ring_control *ring_control = priv->ring_control; - unsigned int i; - struct p54p_desc *desc; - - P54P_WRITE(int_enable, cpu_to_le32(0)); - P54P_READ(int_enable); - udelay(10); - - free_irq(priv->pdev->irq, dev); - - tasklet_kill(&priv->tasklet); - - P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET)); - - for (i = 0; i < ARRAY_SIZE(priv->rx_buf_data); i++) { - desc = &ring_control->rx_data[i]; - if (desc->host_addr) - pci_unmap_single(priv->pdev, - le32_to_cpu(desc->host_addr), - priv->common.rx_mtu + 32, - PCI_DMA_FROMDEVICE); - kfree_skb(priv->rx_buf_data[i]); - priv->rx_buf_data[i] = NULL; - } - - for (i = 0; i < ARRAY_SIZE(priv->rx_buf_mgmt); i++) { - desc = &ring_control->rx_mgmt[i]; - if (desc->host_addr) - pci_unmap_single(priv->pdev, - le32_to_cpu(desc->host_addr), - priv->common.rx_mtu + 32, - PCI_DMA_FROMDEVICE); - kfree_skb(priv->rx_buf_mgmt[i]); - priv->rx_buf_mgmt[i] = NULL; - } - - for (i = 0; i < ARRAY_SIZE(priv->tx_buf_data); i++) { - desc = &ring_control->tx_data[i]; - if (desc->host_addr) - pci_unmap_single(priv->pdev, - le32_to_cpu(desc->host_addr), - le16_to_cpu(desc->len), - PCI_DMA_TODEVICE); - - p54_free_skb(dev, priv->tx_buf_data[i]); - priv->tx_buf_data[i] = NULL; - } - - for (i = 0; i < ARRAY_SIZE(priv->tx_buf_mgmt); i++) { - desc = &ring_control->tx_mgmt[i]; - if (desc->host_addr) - pci_unmap_single(priv->pdev, - le32_to_cpu(desc->host_addr), - le16_to_cpu(desc->len), - PCI_DMA_TODEVICE); - - p54_free_skb(dev, priv->tx_buf_mgmt[i]); - priv->tx_buf_mgmt[i] = NULL; - } - - memset(ring_control, 0, sizeof(*ring_control)); -} - -static int p54p_open(struct ieee80211_hw *dev) -{ - struct p54p_priv *priv = dev->priv; - int err; - - init_completion(&priv->boot_comp); - err = request_irq(priv->pdev->irq, p54p_interrupt, - IRQF_SHARED, "p54pci", dev); - if (err) { - dev_err(&priv->pdev->dev, "failed to register IRQ handler\n"); - return err; - } - - memset(priv->ring_control, 0, sizeof(*priv->ring_control)); - err = p54p_upload_firmware(dev); - if (err) { - free_irq(priv->pdev->irq, dev); - return err; - } - priv->rx_idx_data = priv->tx_idx_data = 0; - priv->rx_idx_mgmt = priv->tx_idx_mgmt = 0; - - p54p_refill_rx_ring(dev, 0, priv->ring_control->rx_data, - ARRAY_SIZE(priv->ring_control->rx_data), priv->rx_buf_data, 0); - - p54p_refill_rx_ring(dev, 2, priv->ring_control->rx_mgmt, - ARRAY_SIZE(priv->ring_control->rx_mgmt), priv->rx_buf_mgmt, 0); - - P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma)); - P54P_READ(ring_control_base); - wmb(); - udelay(10); - - P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_INIT)); - P54P_READ(int_enable); - wmb(); - udelay(10); - - P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET)); - P54P_READ(dev_int); - - if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) { - wiphy_err(dev->wiphy, "Cannot boot firmware!\n"); - p54p_stop(dev); - return -ETIMEDOUT; - } - - P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_UPDATE)); - P54P_READ(int_enable); - wmb(); - udelay(10); - - P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE)); - P54P_READ(dev_int); - wmb(); - udelay(10); - - return 0; -} - -static void p54p_firmware_step2(const struct firmware *fw, - void *context) -{ - struct p54p_priv *priv = context; - struct ieee80211_hw *dev = priv->common.hw; - struct pci_dev *pdev = priv->pdev; - int err; - - if (!fw) { - dev_err(&pdev->dev, "Cannot find firmware (isl3886pci)\n"); - err = -ENOENT; - goto out; - } - - priv->firmware = fw; - - err = p54p_open(dev); - if (err) - goto out; - err = p54_read_eeprom(dev); - p54p_stop(dev); - if (err) - goto out; - - err = p54_register_common(dev, &pdev->dev); - if (err) - goto out; - -out: - - complete(&priv->fw_loaded); - - if (err) { - struct device *parent = pdev->dev.parent; - - if (parent) - device_lock(parent); - - /* - * This will indirectly result in a call to p54p_remove. - * Hence, we don't need to bother with freeing any - * allocated ressources at all. - */ - device_release_driver(&pdev->dev); - - if (parent) - device_unlock(parent); - } - - pci_dev_put(pdev); -} - -static int p54p_probe(struct pci_dev *pdev, - const struct pci_device_id *id) -{ - struct p54p_priv *priv; - struct ieee80211_hw *dev; - unsigned long mem_addr, mem_len; - int err; - - pci_dev_get(pdev); - err = pci_enable_device(pdev); - if (err) { - dev_err(&pdev->dev, "Cannot enable new PCI device\n"); - return err; - } - - mem_addr = pci_resource_start(pdev, 0); - mem_len = pci_resource_len(pdev, 0); - if (mem_len < sizeof(struct p54p_csr)) { - dev_err(&pdev->dev, "Too short PCI resources\n"); - err = -ENODEV; - goto err_disable_dev; - } - - err = pci_request_regions(pdev, "p54pci"); - if (err) { - dev_err(&pdev->dev, "Cannot obtain PCI resources\n"); - goto err_disable_dev; - } - - err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); - if (!err) - err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); - if (err) { - dev_err(&pdev->dev, "No suitable DMA available\n"); - goto err_free_reg; - } - - pci_set_master(pdev); - pci_try_set_mwi(pdev); - - pci_write_config_byte(pdev, 0x40, 0); - pci_write_config_byte(pdev, 0x41, 0); - - dev = p54_init_common(sizeof(*priv)); - if (!dev) { - dev_err(&pdev->dev, "ieee80211 alloc failed\n"); - err = -ENOMEM; - goto err_free_reg; - } - - priv = dev->priv; - priv->pdev = pdev; - - init_completion(&priv->fw_loaded); - SET_IEEE80211_DEV(dev, &pdev->dev); - pci_set_drvdata(pdev, dev); - - priv->map = ioremap(mem_addr, mem_len); - if (!priv->map) { - dev_err(&pdev->dev, "Cannot map device memory\n"); - err = -ENOMEM; - goto err_free_dev; - } - - priv->ring_control = pci_alloc_consistent(pdev, sizeof(*priv->ring_control), - &priv->ring_control_dma); - if (!priv->ring_control) { - dev_err(&pdev->dev, "Cannot allocate rings\n"); - err = -ENOMEM; - goto err_iounmap; - } - priv->common.open = p54p_open; - priv->common.stop = p54p_stop; - priv->common.tx = p54p_tx; - - spin_lock_init(&priv->lock); - tasklet_init(&priv->tasklet, p54p_tasklet, (unsigned long)dev); - - err = request_firmware_nowait(THIS_MODULE, 1, "isl3886pci", - &priv->pdev->dev, GFP_KERNEL, - priv, p54p_firmware_step2); - if (!err) - return 0; - - pci_free_consistent(pdev, sizeof(*priv->ring_control), - priv->ring_control, priv->ring_control_dma); - - err_iounmap: - iounmap(priv->map); - - err_free_dev: - pci_set_drvdata(pdev, NULL); - p54_free_common(dev); - - err_free_reg: - pci_release_regions(pdev); - err_disable_dev: - pci_disable_device(pdev); - pci_dev_put(pdev); - return err; -} - -static void p54p_remove(struct pci_dev *pdev) -{ - struct ieee80211_hw *dev = pci_get_drvdata(pdev); - struct p54p_priv *priv; - - if (!dev) - return; - - priv = dev->priv; - wait_for_completion(&priv->fw_loaded); - p54_unregister_common(dev); - release_firmware(priv->firmware); - pci_free_consistent(pdev, sizeof(*priv->ring_control), - priv->ring_control, priv->ring_control_dma); - iounmap(priv->map); - pci_release_regions(pdev); - pci_disable_device(pdev); - p54_free_common(dev); -} - -#ifdef CONFIG_PM_SLEEP -static int p54p_suspend(struct device *device) -{ - struct pci_dev *pdev = to_pci_dev(device); - - pci_save_state(pdev); - pci_set_power_state(pdev, PCI_D3hot); - pci_disable_device(pdev); - return 0; -} - -static int p54p_resume(struct device *device) -{ - struct pci_dev *pdev = to_pci_dev(device); - int err; - - err = pci_reenable_device(pdev); - if (err) - return err; - return pci_set_power_state(pdev, PCI_D0); -} - -static SIMPLE_DEV_PM_OPS(p54pci_pm_ops, p54p_suspend, p54p_resume); - -#define P54P_PM_OPS (&p54pci_pm_ops) -#else -#define P54P_PM_OPS (NULL) -#endif /* CONFIG_PM_SLEEP */ - -static struct pci_driver p54p_driver = { - .name = "p54pci", - .id_table = p54p_table, - .probe = p54p_probe, - .remove = p54p_remove, - .driver.pm = P54P_PM_OPS, -}; - -module_pci_driver(p54p_driver); diff --git a/drivers/net/wireless/p54/p54pci.h b/drivers/net/wireless/p54/p54pci.h deleted file mode 100644 index 68405c142f97..000000000000 --- a/drivers/net/wireless/p54/p54pci.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef P54PCI_H -#define P54PCI_H -#include - -/* - * Defines for PCI based mac80211 Prism54 driver - * - * Copyright (c) 2006, Michael Wu - * - * Based on the islsm (softmac prism54) driver, which is: - * Copyright 2004-2006 Jean-Baptiste Note , et al. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -/* Device Interrupt register bits */ -#define ISL38XX_DEV_INT_RESET 0x0001 -#define ISL38XX_DEV_INT_UPDATE 0x0002 -#define ISL38XX_DEV_INT_WAKEUP 0x0008 -#define ISL38XX_DEV_INT_SLEEP 0x0010 -#define ISL38XX_DEV_INT_ABORT 0x0020 -/* these two only used in USB */ -#define ISL38XX_DEV_INT_DATA 0x0040 -#define ISL38XX_DEV_INT_MGMT 0x0080 - -#define ISL38XX_DEV_INT_PCIUART_CTS 0x4000 -#define ISL38XX_DEV_INT_PCIUART_DR 0x8000 - -/* Interrupt Identification/Acknowledge/Enable register bits */ -#define ISL38XX_INT_IDENT_UPDATE 0x0002 -#define ISL38XX_INT_IDENT_INIT 0x0004 -#define ISL38XX_INT_IDENT_WAKEUP 0x0008 -#define ISL38XX_INT_IDENT_SLEEP 0x0010 -#define ISL38XX_INT_IDENT_PCIUART_CTS 0x4000 -#define ISL38XX_INT_IDENT_PCIUART_DR 0x8000 - -/* Control/Status register bits */ -#define ISL38XX_CTRL_STAT_SLEEPMODE 0x00000200 -#define ISL38XX_CTRL_STAT_CLKRUN 0x00800000 -#define ISL38XX_CTRL_STAT_RESET 0x10000000 -#define ISL38XX_CTRL_STAT_RAMBOOT 0x20000000 -#define ISL38XX_CTRL_STAT_STARTHALTED 0x40000000 -#define ISL38XX_CTRL_STAT_HOST_OVERRIDE 0x80000000 - -struct p54p_csr { - __le32 dev_int; - u8 unused_1[12]; - __le32 int_ident; - __le32 int_ack; - __le32 int_enable; - u8 unused_2[4]; - union { - __le32 ring_control_base; - __le32 gen_purp_com[2]; - }; - u8 unused_3[8]; - __le32 direct_mem_base; - u8 unused_4[44]; - __le32 dma_addr; - __le32 dma_len; - __le32 dma_ctrl; - u8 unused_5[12]; - __le32 ctrl_stat; - u8 unused_6[1924]; - u8 cardbus_cis[0x800]; - u8 direct_mem_win[0x1000]; -} __packed; - -/* usb backend only needs the register defines above */ -#ifndef P54USB_H -struct p54p_desc { - __le32 host_addr; - __le32 device_addr; - __le16 len; - __le16 flags; -} __packed; - -struct p54p_ring_control { - __le32 host_idx[4]; - __le32 device_idx[4]; - struct p54p_desc rx_data[8]; - struct p54p_desc tx_data[32]; - struct p54p_desc rx_mgmt[4]; - struct p54p_desc tx_mgmt[4]; -} __packed; - -#define P54P_READ(r) (__force __le32)__raw_readl(&priv->map->r) -#define P54P_WRITE(r, val) __raw_writel((__force u32)(__le32)(val), &priv->map->r) - -struct p54p_priv { - struct p54_common common; - struct pci_dev *pdev; - struct p54p_csr __iomem *map; - struct tasklet_struct tasklet; - const struct firmware *firmware; - spinlock_t lock; - struct p54p_ring_control *ring_control; - dma_addr_t ring_control_dma; - u32 rx_idx_data, tx_idx_data; - u32 rx_idx_mgmt, tx_idx_mgmt; - struct sk_buff *rx_buf_data[8]; - struct sk_buff *rx_buf_mgmt[4]; - struct sk_buff *tx_buf_data[32]; - struct sk_buff *tx_buf_mgmt[4]; - struct completion boot_comp; - struct completion fw_loaded; -}; - -#endif /* P54USB_H */ -#endif /* P54PCI_H */ diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c deleted file mode 100644 index 978e7eb26567..000000000000 --- a/drivers/net/wireless/p54/p54spi.c +++ /dev/null @@ -1,742 +0,0 @@ -/* - * Copyright (C) 2008 Christian Lamparter - * Copyright 2008 Johannes Berg - * - * This driver is a port from stlc45xx: - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "p54spi.h" -#include "p54.h" - -#include "lmac.h" - -#ifdef CONFIG_P54_SPI_DEFAULT_EEPROM -#include "p54spi_eeprom.h" -#endif /* CONFIG_P54_SPI_DEFAULT_EEPROM */ - -MODULE_FIRMWARE("3826.arm"); - -/* - * gpios should be handled in board files and provided via platform data, - * but because it's currently impossible for p54spi to have a header file - * in include/linux, let's use module paramaters for now - */ - -static int p54spi_gpio_power = 97; -module_param(p54spi_gpio_power, int, 0444); -MODULE_PARM_DESC(p54spi_gpio_power, "gpio number for power line"); - -static int p54spi_gpio_irq = 87; -module_param(p54spi_gpio_irq, int, 0444); -MODULE_PARM_DESC(p54spi_gpio_irq, "gpio number for irq line"); - -static void p54spi_spi_read(struct p54s_priv *priv, u8 address, - void *buf, size_t len) -{ - struct spi_transfer t[2]; - struct spi_message m; - __le16 addr; - - /* We first push the address */ - addr = cpu_to_le16(address << 8 | SPI_ADRS_READ_BIT_15); - - spi_message_init(&m); - memset(t, 0, sizeof(t)); - - t[0].tx_buf = &addr; - t[0].len = sizeof(addr); - spi_message_add_tail(&t[0], &m); - - t[1].rx_buf = buf; - t[1].len = len; - spi_message_add_tail(&t[1], &m); - - spi_sync(priv->spi, &m); -} - - -static void p54spi_spi_write(struct p54s_priv *priv, u8 address, - const void *buf, size_t len) -{ - struct spi_transfer t[3]; - struct spi_message m; - __le16 addr; - - /* We first push the address */ - addr = cpu_to_le16(address << 8); - - spi_message_init(&m); - memset(t, 0, sizeof(t)); - - t[0].tx_buf = &addr; - t[0].len = sizeof(addr); - spi_message_add_tail(&t[0], &m); - - t[1].tx_buf = buf; - t[1].len = len & ~1; - spi_message_add_tail(&t[1], &m); - - if (len % 2) { - __le16 last_word; - last_word = cpu_to_le16(((u8 *)buf)[len - 1]); - - t[2].tx_buf = &last_word; - t[2].len = sizeof(last_word); - spi_message_add_tail(&t[2], &m); - } - - spi_sync(priv->spi, &m); -} - -static u32 p54spi_read32(struct p54s_priv *priv, u8 addr) -{ - __le32 val; - - p54spi_spi_read(priv, addr, &val, sizeof(val)); - - return le32_to_cpu(val); -} - -static inline void p54spi_write16(struct p54s_priv *priv, u8 addr, __le16 val) -{ - p54spi_spi_write(priv, addr, &val, sizeof(val)); -} - -static inline void p54spi_write32(struct p54s_priv *priv, u8 addr, __le32 val) -{ - p54spi_spi_write(priv, addr, &val, sizeof(val)); -} - -static int p54spi_wait_bit(struct p54s_priv *priv, u16 reg, u32 bits) -{ - int i; - - for (i = 0; i < 2000; i++) { - u32 buffer = p54spi_read32(priv, reg); - if ((buffer & bits) == bits) - return 1; - } - return 0; -} - -static int p54spi_spi_write_dma(struct p54s_priv *priv, __le32 base, - const void *buf, size_t len) -{ - if (!p54spi_wait_bit(priv, SPI_ADRS_DMA_WRITE_CTRL, HOST_ALLOWED)) { - dev_err(&priv->spi->dev, "spi_write_dma not allowed " - "to DMA write.\n"); - return -EAGAIN; - } - - p54spi_write16(priv, SPI_ADRS_DMA_WRITE_CTRL, - cpu_to_le16(SPI_DMA_WRITE_CTRL_ENABLE)); - - p54spi_write16(priv, SPI_ADRS_DMA_WRITE_LEN, cpu_to_le16(len)); - p54spi_write32(priv, SPI_ADRS_DMA_WRITE_BASE, base); - p54spi_spi_write(priv, SPI_ADRS_DMA_DATA, buf, len); - return 0; -} - -static int p54spi_request_firmware(struct ieee80211_hw *dev) -{ - struct p54s_priv *priv = dev->priv; - int ret; - - /* FIXME: should driver use it's own struct device? */ - ret = request_firmware(&priv->firmware, "3826.arm", &priv->spi->dev); - - if (ret < 0) { - dev_err(&priv->spi->dev, "request_firmware() failed: %d", ret); - return ret; - } - - ret = p54_parse_firmware(dev, priv->firmware); - if (ret) { - release_firmware(priv->firmware); - return ret; - } - - return 0; -} - -static int p54spi_request_eeprom(struct ieee80211_hw *dev) -{ - struct p54s_priv *priv = dev->priv; - const struct firmware *eeprom; - int ret; - - /* - * allow users to customize their eeprom. - */ - - ret = request_firmware(&eeprom, "3826.eeprom", &priv->spi->dev); - if (ret < 0) { -#ifdef CONFIG_P54_SPI_DEFAULT_EEPROM - dev_info(&priv->spi->dev, "loading default eeprom...\n"); - ret = p54_parse_eeprom(dev, (void *) p54spi_eeprom, - sizeof(p54spi_eeprom)); -#else - dev_err(&priv->spi->dev, "Failed to request user eeprom\n"); -#endif /* CONFIG_P54_SPI_DEFAULT_EEPROM */ - } else { - dev_info(&priv->spi->dev, "loading user eeprom...\n"); - ret = p54_parse_eeprom(dev, (void *) eeprom->data, - (int)eeprom->size); - release_firmware(eeprom); - } - return ret; -} - -static int p54spi_upload_firmware(struct ieee80211_hw *dev) -{ - struct p54s_priv *priv = dev->priv; - unsigned long fw_len, _fw_len; - unsigned int offset = 0; - int err = 0; - u8 *fw; - - fw_len = priv->firmware->size; - fw = kmemdup(priv->firmware->data, fw_len, GFP_KERNEL); - if (!fw) - return -ENOMEM; - - /* stop the device */ - p54spi_write16(priv, SPI_ADRS_DEV_CTRL_STAT, cpu_to_le16( - SPI_CTRL_STAT_HOST_OVERRIDE | SPI_CTRL_STAT_HOST_RESET | - SPI_CTRL_STAT_START_HALTED)); - - msleep(TARGET_BOOT_SLEEP); - - p54spi_write16(priv, SPI_ADRS_DEV_CTRL_STAT, cpu_to_le16( - SPI_CTRL_STAT_HOST_OVERRIDE | - SPI_CTRL_STAT_START_HALTED)); - - msleep(TARGET_BOOT_SLEEP); - - while (fw_len > 0) { - _fw_len = min_t(long, fw_len, SPI_MAX_PACKET_SIZE); - - err = p54spi_spi_write_dma(priv, cpu_to_le32( - ISL38XX_DEV_FIRMWARE_ADDR + offset), - (fw + offset), _fw_len); - if (err < 0) - goto out; - - fw_len -= _fw_len; - offset += _fw_len; - } - - BUG_ON(fw_len != 0); - - /* enable host interrupts */ - p54spi_write32(priv, SPI_ADRS_HOST_INT_EN, - cpu_to_le32(SPI_HOST_INTS_DEFAULT)); - - /* boot the device */ - p54spi_write16(priv, SPI_ADRS_DEV_CTRL_STAT, cpu_to_le16( - SPI_CTRL_STAT_HOST_OVERRIDE | SPI_CTRL_STAT_HOST_RESET | - SPI_CTRL_STAT_RAM_BOOT)); - - msleep(TARGET_BOOT_SLEEP); - - p54spi_write16(priv, SPI_ADRS_DEV_CTRL_STAT, cpu_to_le16( - SPI_CTRL_STAT_HOST_OVERRIDE | SPI_CTRL_STAT_RAM_BOOT)); - msleep(TARGET_BOOT_SLEEP); - -out: - kfree(fw); - return err; -} - -static void p54spi_power_off(struct p54s_priv *priv) -{ - disable_irq(gpio_to_irq(p54spi_gpio_irq)); - gpio_set_value(p54spi_gpio_power, 0); -} - -static void p54spi_power_on(struct p54s_priv *priv) -{ - gpio_set_value(p54spi_gpio_power, 1); - enable_irq(gpio_to_irq(p54spi_gpio_irq)); - - /* - * need to wait a while before device can be accessed, the length - * is just a guess - */ - msleep(10); -} - -static inline void p54spi_int_ack(struct p54s_priv *priv, u32 val) -{ - p54spi_write32(priv, SPI_ADRS_HOST_INT_ACK, cpu_to_le32(val)); -} - -static int p54spi_wakeup(struct p54s_priv *priv) -{ - /* wake the chip */ - p54spi_write32(priv, SPI_ADRS_ARM_INTERRUPTS, - cpu_to_le32(SPI_TARGET_INT_WAKEUP)); - - /* And wait for the READY interrupt */ - if (!p54spi_wait_bit(priv, SPI_ADRS_HOST_INTERRUPTS, - SPI_HOST_INT_READY)) { - dev_err(&priv->spi->dev, "INT_READY timeout\n"); - return -EBUSY; - } - - p54spi_int_ack(priv, SPI_HOST_INT_READY); - return 0; -} - -static inline void p54spi_sleep(struct p54s_priv *priv) -{ - p54spi_write32(priv, SPI_ADRS_ARM_INTERRUPTS, - cpu_to_le32(SPI_TARGET_INT_SLEEP)); -} - -static void p54spi_int_ready(struct p54s_priv *priv) -{ - p54spi_write32(priv, SPI_ADRS_HOST_INT_EN, cpu_to_le32( - SPI_HOST_INT_UPDATE | SPI_HOST_INT_SW_UPDATE)); - - switch (priv->fw_state) { - case FW_STATE_BOOTING: - priv->fw_state = FW_STATE_READY; - complete(&priv->fw_comp); - break; - case FW_STATE_RESETTING: - priv->fw_state = FW_STATE_READY; - /* TODO: reinitialize state */ - break; - default: - break; - } -} - -static int p54spi_rx(struct p54s_priv *priv) -{ - struct sk_buff *skb; - u16 len; - u16 rx_head[2]; -#define READAHEAD_SZ (sizeof(rx_head)-sizeof(u16)) - - if (p54spi_wakeup(priv) < 0) - return -EBUSY; - - /* Read data size and first data word in one SPI transaction - * This is workaround for firmware/DMA bug, - * when first data word gets lost under high load. - */ - p54spi_spi_read(priv, SPI_ADRS_DMA_DATA, rx_head, sizeof(rx_head)); - len = rx_head[0]; - - if (len == 0) { - p54spi_sleep(priv); - dev_err(&priv->spi->dev, "rx request of zero bytes\n"); - return 0; - } - - /* Firmware may insert up to 4 padding bytes after the lmac header, - * but it does not amend the size of SPI data transfer. - * Such packets has correct data size in header, thus referencing - * past the end of allocated skb. Reserve extra 4 bytes for this case */ - skb = dev_alloc_skb(len + 4); - if (!skb) { - p54spi_sleep(priv); - dev_err(&priv->spi->dev, "could not alloc skb"); - return -ENOMEM; - } - - if (len <= READAHEAD_SZ) { - memcpy(skb_put(skb, len), rx_head + 1, len); - } else { - memcpy(skb_put(skb, READAHEAD_SZ), rx_head + 1, READAHEAD_SZ); - p54spi_spi_read(priv, SPI_ADRS_DMA_DATA, - skb_put(skb, len - READAHEAD_SZ), - len - READAHEAD_SZ); - } - p54spi_sleep(priv); - /* Put additional bytes to compensate for the possible - * alignment-caused truncation */ - skb_put(skb, 4); - - if (p54_rx(priv->hw, skb) == 0) - dev_kfree_skb(skb); - - return 0; -} - - -static irqreturn_t p54spi_interrupt(int irq, void *config) -{ - struct spi_device *spi = config; - struct p54s_priv *priv = spi_get_drvdata(spi); - - ieee80211_queue_work(priv->hw, &priv->work); - - return IRQ_HANDLED; -} - -static int p54spi_tx_frame(struct p54s_priv *priv, struct sk_buff *skb) -{ - struct p54_hdr *hdr = (struct p54_hdr *) skb->data; - int ret = 0; - - if (p54spi_wakeup(priv) < 0) - return -EBUSY; - - ret = p54spi_spi_write_dma(priv, hdr->req_id, skb->data, skb->len); - if (ret < 0) - goto out; - - if (!p54spi_wait_bit(priv, SPI_ADRS_HOST_INTERRUPTS, - SPI_HOST_INT_WR_READY)) { - dev_err(&priv->spi->dev, "WR_READY timeout\n"); - ret = -EAGAIN; - goto out; - } - - p54spi_int_ack(priv, SPI_HOST_INT_WR_READY); - - if (FREE_AFTER_TX(skb)) - p54_free_skb(priv->hw, skb); -out: - p54spi_sleep(priv); - return ret; -} - -static int p54spi_wq_tx(struct p54s_priv *priv) -{ - struct p54s_tx_info *entry; - struct sk_buff *skb; - struct ieee80211_tx_info *info; - struct p54_tx_info *minfo; - struct p54s_tx_info *dinfo; - unsigned long flags; - int ret = 0; - - spin_lock_irqsave(&priv->tx_lock, flags); - - while (!list_empty(&priv->tx_pending)) { - entry = list_entry(priv->tx_pending.next, - struct p54s_tx_info, tx_list); - - list_del_init(&entry->tx_list); - - spin_unlock_irqrestore(&priv->tx_lock, flags); - - dinfo = container_of((void *) entry, struct p54s_tx_info, - tx_list); - minfo = container_of((void *) dinfo, struct p54_tx_info, - data); - info = container_of((void *) minfo, struct ieee80211_tx_info, - rate_driver_data); - skb = container_of((void *) info, struct sk_buff, cb); - - ret = p54spi_tx_frame(priv, skb); - - if (ret < 0) { - p54_free_skb(priv->hw, skb); - return ret; - } - - spin_lock_irqsave(&priv->tx_lock, flags); - } - spin_unlock_irqrestore(&priv->tx_lock, flags); - return ret; -} - -static void p54spi_op_tx(struct ieee80211_hw *dev, struct sk_buff *skb) -{ - struct p54s_priv *priv = dev->priv; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct p54_tx_info *mi = (struct p54_tx_info *) info->rate_driver_data; - struct p54s_tx_info *di = (struct p54s_tx_info *) mi->data; - unsigned long flags; - - BUILD_BUG_ON(sizeof(*di) > sizeof((mi->data))); - - spin_lock_irqsave(&priv->tx_lock, flags); - list_add_tail(&di->tx_list, &priv->tx_pending); - spin_unlock_irqrestore(&priv->tx_lock, flags); - - ieee80211_queue_work(priv->hw, &priv->work); -} - -static void p54spi_work(struct work_struct *work) -{ - struct p54s_priv *priv = container_of(work, struct p54s_priv, work); - u32 ints; - int ret; - - mutex_lock(&priv->mutex); - - if (priv->fw_state == FW_STATE_OFF) - goto out; - - ints = p54spi_read32(priv, SPI_ADRS_HOST_INTERRUPTS); - - if (ints & SPI_HOST_INT_READY) { - p54spi_int_ready(priv); - p54spi_int_ack(priv, SPI_HOST_INT_READY); - } - - if (priv->fw_state != FW_STATE_READY) - goto out; - - if (ints & SPI_HOST_INT_UPDATE) { - p54spi_int_ack(priv, SPI_HOST_INT_UPDATE); - ret = p54spi_rx(priv); - if (ret < 0) - goto out; - } - if (ints & SPI_HOST_INT_SW_UPDATE) { - p54spi_int_ack(priv, SPI_HOST_INT_SW_UPDATE); - ret = p54spi_rx(priv); - if (ret < 0) - goto out; - } - - ret = p54spi_wq_tx(priv); -out: - mutex_unlock(&priv->mutex); -} - -static int p54spi_op_start(struct ieee80211_hw *dev) -{ - struct p54s_priv *priv = dev->priv; - unsigned long timeout; - int ret = 0; - - if (mutex_lock_interruptible(&priv->mutex)) { - ret = -EINTR; - goto out; - } - - priv->fw_state = FW_STATE_BOOTING; - - p54spi_power_on(priv); - - ret = p54spi_upload_firmware(dev); - if (ret < 0) { - p54spi_power_off(priv); - goto out_unlock; - } - - mutex_unlock(&priv->mutex); - - timeout = msecs_to_jiffies(2000); - timeout = wait_for_completion_interruptible_timeout(&priv->fw_comp, - timeout); - if (!timeout) { - dev_err(&priv->spi->dev, "firmware boot failed"); - p54spi_power_off(priv); - ret = -1; - goto out; - } - - if (mutex_lock_interruptible(&priv->mutex)) { - ret = -EINTR; - p54spi_power_off(priv); - goto out; - } - - WARN_ON(priv->fw_state != FW_STATE_READY); - -out_unlock: - mutex_unlock(&priv->mutex); - -out: - return ret; -} - -static void p54spi_op_stop(struct ieee80211_hw *dev) -{ - struct p54s_priv *priv = dev->priv; - unsigned long flags; - - mutex_lock(&priv->mutex); - WARN_ON(priv->fw_state != FW_STATE_READY); - - p54spi_power_off(priv); - spin_lock_irqsave(&priv->tx_lock, flags); - INIT_LIST_HEAD(&priv->tx_pending); - spin_unlock_irqrestore(&priv->tx_lock, flags); - - priv->fw_state = FW_STATE_OFF; - mutex_unlock(&priv->mutex); - - cancel_work_sync(&priv->work); -} - -static int p54spi_probe(struct spi_device *spi) -{ - struct p54s_priv *priv = NULL; - struct ieee80211_hw *hw; - int ret = -EINVAL; - - hw = p54_init_common(sizeof(*priv)); - if (!hw) { - dev_err(&spi->dev, "could not alloc ieee80211_hw"); - return -ENOMEM; - } - - priv = hw->priv; - priv->hw = hw; - spi_set_drvdata(spi, priv); - priv->spi = spi; - - spi->bits_per_word = 16; - spi->max_speed_hz = 24000000; - - ret = spi_setup(spi); - if (ret < 0) { - dev_err(&priv->spi->dev, "spi_setup failed"); - goto err_free; - } - - ret = gpio_request(p54spi_gpio_power, "p54spi power"); - if (ret < 0) { - dev_err(&priv->spi->dev, "power GPIO request failed: %d", ret); - goto err_free; - } - - ret = gpio_request(p54spi_gpio_irq, "p54spi irq"); - if (ret < 0) { - dev_err(&priv->spi->dev, "irq GPIO request failed: %d", ret); - goto err_free_gpio_power; - } - - gpio_direction_output(p54spi_gpio_power, 0); - gpio_direction_input(p54spi_gpio_irq); - - ret = request_irq(gpio_to_irq(p54spi_gpio_irq), - p54spi_interrupt, IRQF_DISABLED, "p54spi", - priv->spi); - if (ret < 0) { - dev_err(&priv->spi->dev, "request_irq() failed"); - goto err_free_gpio_irq; - } - - irq_set_irq_type(gpio_to_irq(p54spi_gpio_irq), IRQ_TYPE_EDGE_RISING); - - disable_irq(gpio_to_irq(p54spi_gpio_irq)); - - INIT_WORK(&priv->work, p54spi_work); - init_completion(&priv->fw_comp); - INIT_LIST_HEAD(&priv->tx_pending); - mutex_init(&priv->mutex); - spin_lock_init(&priv->tx_lock); - SET_IEEE80211_DEV(hw, &spi->dev); - priv->common.open = p54spi_op_start; - priv->common.stop = p54spi_op_stop; - priv->common.tx = p54spi_op_tx; - - ret = p54spi_request_firmware(hw); - if (ret < 0) - goto err_free_common; - - ret = p54spi_request_eeprom(hw); - if (ret) - goto err_free_common; - - ret = p54_register_common(hw, &priv->spi->dev); - if (ret) - goto err_free_common; - - return 0; - -err_free_common: - free_irq(gpio_to_irq(p54spi_gpio_irq), spi); -err_free_gpio_irq: - gpio_free(p54spi_gpio_irq); -err_free_gpio_power: - gpio_free(p54spi_gpio_power); -err_free: - p54_free_common(priv->hw); - return ret; -} - -static int p54spi_remove(struct spi_device *spi) -{ - struct p54s_priv *priv = spi_get_drvdata(spi); - - p54_unregister_common(priv->hw); - - free_irq(gpio_to_irq(p54spi_gpio_irq), spi); - - gpio_free(p54spi_gpio_power); - gpio_free(p54spi_gpio_irq); - release_firmware(priv->firmware); - - mutex_destroy(&priv->mutex); - - p54_free_common(priv->hw); - - return 0; -} - - -static struct spi_driver p54spi_driver = { - .driver = { - .name = "p54spi", - .owner = THIS_MODULE, - }, - - .probe = p54spi_probe, - .remove = p54spi_remove, -}; - -static int __init p54spi_init(void) -{ - int ret; - - ret = spi_register_driver(&p54spi_driver); - if (ret < 0) { - printk(KERN_ERR "failed to register SPI driver: %d", ret); - goto out; - } - -out: - return ret; -} - -static void __exit p54spi_exit(void) -{ - spi_unregister_driver(&p54spi_driver); -} - -module_init(p54spi_init); -module_exit(p54spi_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Christian Lamparter "); -MODULE_ALIAS("spi:cx3110x"); -MODULE_ALIAS("spi:p54spi"); -MODULE_ALIAS("spi:stlc45xx"); diff --git a/drivers/net/wireless/p54/p54spi.h b/drivers/net/wireless/p54/p54spi.h deleted file mode 100644 index dfaa62aaeb07..000000000000 --- a/drivers/net/wireless/p54/p54spi.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2008 Christian Lamparter - * - * This driver is a port from stlc45xx: - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#ifndef P54SPI_H -#define P54SPI_H - -#include -#include -#include - -#include "p54.h" - -/* Bit 15 is read/write bit; ON = READ, OFF = WRITE */ -#define SPI_ADRS_READ_BIT_15 0x8000 - -#define SPI_ADRS_ARM_INTERRUPTS 0x00 -#define SPI_ADRS_ARM_INT_EN 0x04 - -#define SPI_ADRS_HOST_INTERRUPTS 0x08 -#define SPI_ADRS_HOST_INT_EN 0x0c -#define SPI_ADRS_HOST_INT_ACK 0x10 - -#define SPI_ADRS_GEN_PURP_1 0x14 -#define SPI_ADRS_GEN_PURP_2 0x18 - -#define SPI_ADRS_DEV_CTRL_STAT 0x26 /* high word */ - -#define SPI_ADRS_DMA_DATA 0x28 - -#define SPI_ADRS_DMA_WRITE_CTRL 0x2c -#define SPI_ADRS_DMA_WRITE_LEN 0x2e -#define SPI_ADRS_DMA_WRITE_BASE 0x30 - -#define SPI_ADRS_DMA_READ_CTRL 0x34 -#define SPI_ADRS_DMA_READ_LEN 0x36 -#define SPI_ADRS_DMA_READ_BASE 0x38 - -#define SPI_CTRL_STAT_HOST_OVERRIDE 0x8000 -#define SPI_CTRL_STAT_START_HALTED 0x4000 -#define SPI_CTRL_STAT_RAM_BOOT 0x2000 -#define SPI_CTRL_STAT_HOST_RESET 0x1000 -#define SPI_CTRL_STAT_HOST_CPU_EN 0x0800 - -#define SPI_DMA_WRITE_CTRL_ENABLE 0x0001 -#define SPI_DMA_READ_CTRL_ENABLE 0x0001 -#define HOST_ALLOWED (1 << 7) - -#define SPI_TIMEOUT 100 /* msec */ - -#define SPI_MAX_TX_PACKETS 32 - -#define SPI_MAX_PACKET_SIZE 32767 - -#define SPI_TARGET_INT_WAKEUP 0x00000001 -#define SPI_TARGET_INT_SLEEP 0x00000002 -#define SPI_TARGET_INT_RDDONE 0x00000004 - -#define SPI_TARGET_INT_CTS 0x00004000 -#define SPI_TARGET_INT_DR 0x00008000 - -#define SPI_HOST_INT_READY 0x00000001 -#define SPI_HOST_INT_WR_READY 0x00000002 -#define SPI_HOST_INT_SW_UPDATE 0x00000004 -#define SPI_HOST_INT_UPDATE 0x10000000 - -/* clear to send */ -#define SPI_HOST_INT_CR 0x00004000 - -/* data ready */ -#define SPI_HOST_INT_DR 0x00008000 - -#define SPI_HOST_INTS_DEFAULT \ - (SPI_HOST_INT_READY | SPI_HOST_INT_UPDATE | SPI_HOST_INT_SW_UPDATE) - -#define TARGET_BOOT_SLEEP 50 - -struct p54s_dma_regs { - __le16 cmd; - __le16 len; - __le32 addr; -} __packed; - -struct p54s_tx_info { - struct list_head tx_list; -}; - -struct p54s_priv { - /* p54_common has to be the first entry */ - struct p54_common common; - struct ieee80211_hw *hw; - struct spi_device *spi; - - struct work_struct work; - - struct mutex mutex; - struct completion fw_comp; - - spinlock_t tx_lock; - - /* protected by tx_lock */ - struct list_head tx_pending; - - enum fw_state fw_state; - const struct firmware *firmware; -}; - -#endif /* P54SPI_H */ diff --git a/drivers/net/wireless/p54/p54spi_eeprom.h b/drivers/net/wireless/p54/p54spi_eeprom.h deleted file mode 100644 index 0b7bfb0adcf2..000000000000 --- a/drivers/net/wireless/p54/p54spi_eeprom.h +++ /dev/null @@ -1,679 +0,0 @@ -/* - * Copyright (C) 2003 Conexant Americas Inc. All Rights Reserved. - * Copyright (C) 2004, 2005, 2006 Nokia Corporation - * Copyright 2008 Johannes Berg - * Copyright 2008 Christian Lamparter - * - * based on: - * - cx3110x's pda.h from Nokia - * - cx3110-transfer.log by Johannes Berg - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#ifndef P54SPI_EEPROM_H -#define P54SPI_EEPROM_H - -static unsigned char p54spi_eeprom[] = { - -/* struct eeprom_pda_wrap */ -0x47, 0x4d, 0x55, 0xaa, /* magic */ -0x00, 0x00, /* pad */ -0x00, 0x00, /* eeprom_pda_data_wrap length */ -0x00, 0x00, 0x00, 0x00, /* arm opcode */ - -/* bogus MAC address */ -0x04, 0x00, 0x01, 0x01, /* PDR_MAC_ADDRESS */ - 0x00, 0x02, 0xee, 0xc0, 0xff, 0xee, - -/* struct bootrec_exp_if */ -0x06, 0x00, 0x01, 0x10, /* PDR_INTERFACE_LIST */ - 0x00, 0x00, /* role */ - 0x0f, 0x00, /* if_id */ - 0x85, 0x00, /* variant = Longbow RF, 2GHz */ - 0x01, 0x00, /* btm_compat */ - 0x1f, 0x00, /* top_compat */ - -0x03, 0x00, 0x02, 0x10, /* PDR_HARDWARE_PLATFORM_COMPONENT_ID */ - 0x03, 0x20, 0x00, 0x43, - -/* struct pda_country[6] */ -0x0d, 0x00, 0x07, 0x10, /* PDR_COUNTRY_LIST */ - 0x10, 0x00, 0x00, 0x00, - 0x20, 0x00, 0x00, 0x00, - 0x30, 0x00, 0x00, 0x00, - 0x31, 0x00, 0x00, 0x00, - 0x32, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, - -/* struct pda_country */ -0x03, 0x00, 0x08, 0x10, /* PDR_DEFAULT_COUNTRY */ - 0x30, 0x00, 0x00, 0x00, /* ETSI */ - -0x03, 0x00, 0x00, 0x11, /* PDR_ANTENNA_GAIN */ - 0x08, 0x08, 0x08, 0x08, - -0x0a, 0x00, 0xff, 0xca, /* PDR_RSSI_LINEAR_APPROXIMATION_CUSTOMV2 */ - 0x01, 0x00, 0x0a, 0x00, - 0x00, 0x00, 0x0a, 0x00, - 0x85, 0x09, 0x0a, 0x01, 0x72, 0xfe, 0x1a, 0x00, 0x00, 0x00, - -/* struct pda_custom_wrapper */ -0x10, 0x06, 0x5d, 0xb0, /* PDR_PRISM_PA_CAL_CURVE_DATA_CUSTOM */ - 0x0d, 0x00, 0xee, 0x00, /* 13 entries, 238 bytes per entry */ - 0x00, 0x00, 0x16, 0x0c, /* no offset, 3094 total len */ - /* 2412 MHz */ - 0x6c, 0x09, - 0x10, 0x01, 0x9a, 0x84, - 0xaa, 0x8a, 0xaa, 0x8a, 0xaa, 0x8a, 0xaa, 0x8a, - 0x3c, 0xb6, 0x3c, 0xb6, 0x3c, 0xb6, 0x3c, 0xb6, - 0x3c, 0xb6, 0x3c, 0xb6, 0x3c, 0xb6, 0x3c, 0xb6, - 0xf0, 0x00, 0x94, 0x6c, - 0x99, 0x82, 0x99, 0x82, 0x99, 0x82, 0x99, 0x82, - 0x2b, 0xae, 0x2b, 0xae, 0x2b, 0xae, 0x2b, 0xae, - 0x2b, 0xae, 0x2b, 0xae, 0x2b, 0xae, 0x2b, 0xae, - 0xd0, 0x00, 0xaa, 0x5a, - 0x88, 0x7a, 0x88, 0x7a, 0x88, 0x7a, 0x88, 0x7a, - 0x1a, 0xa6, 0x1a, 0xa6, 0x1a, 0xa6, 0x1a, 0xa6, - 0x1a, 0xa6, 0x1a, 0xa6, 0x1a, 0xa6, 0x1a, 0xa6, - 0xa0, 0x00, 0xf3, 0x47, - 0x6e, 0x6e, 0x6e, 0x6e, 0x6e, 0x6e, 0x6e, 0x6e, - 0x00, 0x9a, 0x00, 0x9a, 0x00, 0x9a, 0x00, 0x9a, - 0x00, 0x9a, 0x00, 0x9a, 0x00, 0x9a, 0x00, 0x9a, - 0x50, 0x00, 0x59, 0x36, - 0x43, 0x5a, 0x43, 0x5a, 0x43, 0x5a, 0x43, 0x5a, - 0xd5, 0x85, 0xd5, 0x85, 0xd5, 0x85, 0xd5, 0x85, - 0xd5, 0x85, 0xd5, 0x85, 0xd5, 0x85, 0xd5, 0x85, - 0x00, 0x00, 0xe4, 0x2d, - 0x18, 0x46, 0x18, 0x46, 0x18, 0x46, 0x18, 0x46, - 0xaa, 0x71, 0xaa, 0x71, 0xaa, 0x71, 0xaa, 0x71, - 0xaa, 0x71, 0xaa, 0x71, 0xaa, 0x71, 0xaa, 0x71, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, - - /* 2417 MHz */ - 0x71, 0x09, - 0x10, 0x01, 0xb9, 0x83, - 0x7d, 0x8a, 0x7d, 0x8a, 0x7d, 0x8a, 0x7d, 0x8a, - 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, - 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, - 0xf0, 0x00, 0x2e, 0x6c, - 0x68, 0x82, 0x68, 0x82, 0x68, 0x82, 0x68, 0x82, - 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, - 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, - 0xd0, 0x00, 0x8d, 0x5a, - 0x52, 0x7a, 0x52, 0x7a, 0x52, 0x7a, 0x52, 0x7a, - 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, - 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, - 0xa0, 0x00, 0x0a, 0x48, - 0x32, 0x6e, 0x32, 0x6e, 0x32, 0x6e, 0x32, 0x6e, - 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, - 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, - 0x50, 0x00, 0x7c, 0x36, - 0xfc, 0x59, 0xfc, 0x59, 0xfc, 0x59, 0xfc, 0x59, - 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, - 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, - 0x00, 0x00, 0xf5, 0x2d, - 0xc6, 0x45, 0xc6, 0x45, 0xc6, 0x45, 0xc6, 0x45, - 0x58, 0x71, 0x58, 0x71, 0x58, 0x71, 0x58, 0x71, - 0x58, 0x71, 0x58, 0x71, 0x58, 0x71, 0x58, 0x71, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, - - /* 2422 MHz */ - 0x76, 0x09, - 0x10, 0x01, 0xb9, 0x83, - 0x7d, 0x8a, 0x7d, 0x8a, 0x7d, 0x8a, 0x7d, 0x8a, - 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, - 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, - 0xf0, 0x00, 0x2e, 0x6c, - 0x68, 0x82, 0x68, 0x82, 0x68, 0x82, 0x68, 0x82, - 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, - 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, - 0xd0, 0x00, 0x8d, 0x5a, - 0x52, 0x7a, 0x52, 0x7a, 0x52, 0x7a, 0x52, 0x7a, - 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, - 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, - 0xa0, 0x00, 0x0a, 0x48, - 0x32, 0x6e, 0x32, 0x6e, 0x32, 0x6e, 0x32, 0x6e, - 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, - 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, - 0x50, 0x00, 0x7c, 0x36, - 0xfc, 0x59, 0xfc, 0x59, 0xfc, 0x59, 0xfc, 0x59, - 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, - 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, - 0x00, 0x00, 0xf5, 0x2d, - 0xc6, 0x45, 0xc6, 0x45, 0xc6, 0x45, 0xc6, 0x45, - 0x58, 0x71, 0x58, 0x71, 0x58, 0x71, 0x58, 0x71, - 0x58, 0x71, 0x58, 0x71, 0x58, 0x71, 0x58, 0x71, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, - - /* 2427 MHz */ - 0x7b, 0x09, - 0x10, 0x01, 0x48, 0x83, - 0x67, 0x8a, 0x67, 0x8a, 0x67, 0x8a, 0x67, 0x8a, - 0xf9, 0xb5, 0xf9, 0xb5, 0xf9, 0xb5, 0xf9, 0xb5, - 0xf9, 0xb5, 0xf9, 0xb5, 0xf9, 0xb5, 0xf9, 0xb5, - 0xf0, 0x00, 0xfb, 0x6b, - 0x50, 0x82, 0x50, 0x82, 0x50, 0x82, 0x50, 0x82, - 0xe2, 0xad, 0xe2, 0xad, 0xe2, 0xad, 0xe2, 0xad, - 0xe2, 0xad, 0xe2, 0xad, 0xe2, 0xad, 0xe2, 0xad, - 0xd0, 0x00, 0x7e, 0x5a, - 0x38, 0x7a, 0x38, 0x7a, 0x38, 0x7a, 0x38, 0x7a, - 0xca, 0xa5, 0xca, 0xa5, 0xca, 0xa5, 0xca, 0xa5, - 0xca, 0xa5, 0xca, 0xa5, 0xca, 0xa5, 0xca, 0xa5, - 0xa0, 0x00, 0x15, 0x48, - 0x14, 0x6e, 0x14, 0x6e, 0x14, 0x6e, 0x14, 0x6e, - 0xa6, 0x99, 0xa6, 0x99, 0xa6, 0x99, 0xa6, 0x99, - 0xa6, 0x99, 0xa6, 0x99, 0xa6, 0x99, 0xa6, 0x99, - 0x50, 0x00, 0x8e, 0x36, - 0xd9, 0x59, 0xd9, 0x59, 0xd9, 0x59, 0xd9, 0x59, - 0x6b, 0x85, 0x6b, 0x85, 0x6b, 0x85, 0x6b, 0x85, - 0x6b, 0x85, 0x6b, 0x85, 0x6b, 0x85, 0x6b, 0x85, - 0x00, 0x00, 0xfe, 0x2d, - 0x9d, 0x45, 0x9d, 0x45, 0x9d, 0x45, 0x9d, 0x45, - 0x2f, 0x71, 0x2f, 0x71, 0x2f, 0x71, 0x2f, 0x71, - 0x2f, 0x71, 0x2f, 0x71, 0x2f, 0x71, 0x2f, 0x71, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, - - /* 2432 MHz */ - 0x80, 0x09, - 0x10, 0x01, 0xd7, 0x82, - 0x51, 0x8a, 0x51, 0x8a, 0x51, 0x8a, 0x51, 0x8a, - 0xe3, 0xb5, 0xe3, 0xb5, 0xe3, 0xb5, 0xe3, 0xb5, - 0xe3, 0xb5, 0xe3, 0xb5, 0xe3, 0xb5, 0xe3, 0xb5, - 0xf0, 0x00, 0xc8, 0x6b, - 0x37, 0x82, 0x37, 0x82, 0x37, 0x82, 0x37, 0x82, - 0xc9, 0xad, 0xc9, 0xad, 0xc9, 0xad, 0xc9, 0xad, - 0xc9, 0xad, 0xc9, 0xad, 0xc9, 0xad, 0xc9, 0xad, - 0xd0, 0x00, 0x6f, 0x5a, - 0x1d, 0x7a, 0x1d, 0x7a, 0x1d, 0x7a, 0x1d, 0x7a, - 0xaf, 0xa5, 0xaf, 0xa5, 0xaf, 0xa5, 0xaf, 0xa5, - 0xaf, 0xa5, 0xaf, 0xa5, 0xaf, 0xa5, 0xaf, 0xa5, - 0xa0, 0x00, 0x20, 0x48, - 0xf6, 0x6d, 0xf6, 0x6d, 0xf6, 0x6d, 0xf6, 0x6d, - 0x88, 0x99, 0x88, 0x99, 0x88, 0x99, 0x88, 0x99, - 0x88, 0x99, 0x88, 0x99, 0x88, 0x99, 0x88, 0x99, - 0x50, 0x00, 0x9f, 0x36, - 0xb5, 0x59, 0xb5, 0x59, 0xb5, 0x59, 0xb5, 0x59, - 0x47, 0x85, 0x47, 0x85, 0x47, 0x85, 0x47, 0x85, - 0x47, 0x85, 0x47, 0x85, 0x47, 0x85, 0x47, 0x85, - 0x00, 0x00, 0x06, 0x2e, - 0x74, 0x45, 0x74, 0x45, 0x74, 0x45, 0x74, 0x45, - 0x06, 0x71, 0x06, 0x71, 0x06, 0x71, 0x06, 0x71, - 0x06, 0x71, 0x06, 0x71, 0x06, 0x71, 0x06, 0x71, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, - - /* 2437 MHz */ - 0x85, 0x09, - 0x10, 0x01, 0x67, 0x82, - 0x3a, 0x8a, 0x3a, 0x8a, 0x3a, 0x8a, 0x3a, 0x8a, - 0xcc, 0xb5, 0xcc, 0xb5, 0xcc, 0xb5, 0xcc, 0xb5, - 0xcc, 0xb5, 0xcc, 0xb5, 0xcc, 0xb5, 0xcc, 0xb5, - 0xf0, 0x00, 0x95, 0x6b, - 0x1f, 0x82, 0x1f, 0x82, 0x1f, 0x82, 0x1f, 0x82, - 0xb1, 0xad, 0xb1, 0xad, 0xb1, 0xad, 0xb1, 0xad, - 0xb1, 0xad, 0xb1, 0xad, 0xb1, 0xad, 0xb1, 0xad, - 0xd0, 0x00, 0x61, 0x5a, - 0x02, 0x7a, 0x02, 0x7a, 0x02, 0x7a, 0x02, 0x7a, - 0x94, 0xa5, 0x94, 0xa5, 0x94, 0xa5, 0x94, 0xa5, - 0x94, 0xa5, 0x94, 0xa5, 0x94, 0xa5, 0x94, 0xa5, - 0xa0, 0x00, 0x2c, 0x48, - 0xd8, 0x6d, 0xd8, 0x6d, 0xd8, 0x6d, 0xd8, 0x6d, - 0x6a, 0x99, 0x6a, 0x99, 0x6a, 0x99, 0x6a, 0x99, - 0x6a, 0x99, 0x6a, 0x99, 0x6a, 0x99, 0x6a, 0x99, - 0x50, 0x00, 0xb1, 0x36, - 0x92, 0x59, 0x92, 0x59, 0x92, 0x59, 0x92, 0x59, - 0x24, 0x85, 0x24, 0x85, 0x24, 0x85, 0x24, 0x85, - 0x24, 0x85, 0x24, 0x85, 0x24, 0x85, 0x24, 0x85, - 0x00, 0x00, 0x0f, 0x2e, - 0x4b, 0x45, 0x4b, 0x45, 0x4b, 0x45, 0x4b, 0x45, - 0xdd, 0x70, 0xdd, 0x70, 0xdd, 0x70, 0xdd, 0x70, - 0xdd, 0x70, 0xdd, 0x70, 0xdd, 0x70, 0xdd, 0x70, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, - - /* 2442 MHz */ - 0x8a, 0x09, - 0x10, 0x01, 0xf6, 0x81, - 0x24, 0x8a, 0x24, 0x8a, 0x24, 0x8a, 0x24, 0x8a, - 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, - 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, - 0xf0, 0x00, 0x62, 0x6b, - 0x06, 0x82, 0x06, 0x82, 0x06, 0x82, 0x06, 0x82, - 0x98, 0xad, 0x98, 0xad, 0x98, 0xad, 0x98, 0xad, - 0x98, 0xad, 0x98, 0xad, 0x98, 0xad, 0x98, 0xad, - 0xd0, 0x00, 0x52, 0x5a, - 0xe7, 0x79, 0xe7, 0x79, 0xe7, 0x79, 0xe7, 0x79, - 0x79, 0xa5, 0x79, 0xa5, 0x79, 0xa5, 0x79, 0xa5, - 0x79, 0xa5, 0x79, 0xa5, 0x79, 0xa5, 0x79, 0xa5, - 0xa0, 0x00, 0x37, 0x48, - 0xba, 0x6d, 0xba, 0x6d, 0xba, 0x6d, 0xba, 0x6d, - 0x4c, 0x99, 0x4c, 0x99, 0x4c, 0x99, 0x4c, 0x99, - 0x4c, 0x99, 0x4c, 0x99, 0x4c, 0x99, 0x4c, 0x99, - 0x50, 0x00, 0xc2, 0x36, - 0x6e, 0x59, 0x6e, 0x59, 0x6e, 0x59, 0x6e, 0x59, - 0x00, 0x85, 0x00, 0x85, 0x00, 0x85, 0x00, 0x85, - 0x00, 0x85, 0x00, 0x85, 0x00, 0x85, 0x00, 0x85, - 0x00, 0x00, 0x17, 0x2e, - 0x22, 0x45, 0x22, 0x45, 0x22, 0x45, 0x22, 0x45, - 0xb4, 0x70, 0xb4, 0x70, 0xb4, 0x70, 0xb4, 0x70, - 0xb4, 0x70, 0xb4, 0x70, 0xb4, 0x70, 0xb4, 0x70, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, - - /* 2447 MHz */ - 0x8f, 0x09, - 0x10, 0x01, 0x75, 0x83, - 0x61, 0x8a, 0x61, 0x8a, 0x61, 0x8a, 0x61, 0x8a, - 0xf3, 0xb5, 0xf3, 0xb5, 0xf3, 0xb5, 0xf3, 0xb5, - 0xf3, 0xb5, 0xf3, 0xb5, 0xf3, 0xb5, 0xf3, 0xb5, - 0xf0, 0x00, 0x4b, 0x6c, - 0x3f, 0x82, 0x3f, 0x82, 0x3f, 0x82, 0x3f, 0x82, - 0xd1, 0xad, 0xd1, 0xad, 0xd1, 0xad, 0xd1, 0xad, - 0xd1, 0xad, 0xd1, 0xad, 0xd1, 0xad, 0xd1, 0xad, - 0xd0, 0x00, 0xda, 0x5a, - 0x1c, 0x7a, 0x1c, 0x7a, 0x1c, 0x7a, 0x1c, 0x7a, - 0xae, 0xa5, 0xae, 0xa5, 0xae, 0xa5, 0xae, 0xa5, - 0xae, 0xa5, 0xae, 0xa5, 0xae, 0xa5, 0xae, 0xa5, - 0xa0, 0x00, 0x6d, 0x48, - 0xe9, 0x6d, 0xe9, 0x6d, 0xe9, 0x6d, 0xe9, 0x6d, - 0x7b, 0x99, 0x7b, 0x99, 0x7b, 0x99, 0x7b, 0x99, - 0x7b, 0x99, 0x7b, 0x99, 0x7b, 0x99, 0x7b, 0x99, - 0x50, 0x00, 0xc6, 0x36, - 0x92, 0x59, 0x92, 0x59, 0x92, 0x59, 0x92, 0x59, - 0x24, 0x85, 0x24, 0x85, 0x24, 0x85, 0x24, 0x85, - 0x24, 0x85, 0x24, 0x85, 0x24, 0x85, 0x24, 0x85, - 0x00, 0x00, 0x15, 0x2e, - 0x3c, 0x45, 0x3c, 0x45, 0x3c, 0x45, 0x3c, 0x45, - 0xce, 0x70, 0xce, 0x70, 0xce, 0x70, 0xce, 0x70, - 0xce, 0x70, 0xce, 0x70, 0xce, 0x70, 0xce, 0x70, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, - - /* 2452 MHz */ - 0x94, 0x09, - 0x10, 0x01, 0xf4, 0x84, - 0x9e, 0x8a, 0x9e, 0x8a, 0x9e, 0x8a, 0x9e, 0x8a, - 0x30, 0xb6, 0x30, 0xb6, 0x30, 0xb6, 0x30, 0xb6, - 0x30, 0xb6, 0x30, 0xb6, 0x30, 0xb6, 0x30, 0xb6, - 0xf0, 0x00, 0x34, 0x6d, - 0x77, 0x82, 0x77, 0x82, 0x77, 0x82, 0x77, 0x82, - 0x09, 0xae, 0x09, 0xae, 0x09, 0xae, 0x09, 0xae, - 0x09, 0xae, 0x09, 0xae, 0x09, 0xae, 0x09, 0xae, - 0xd0, 0x00, 0x62, 0x5b, - 0x50, 0x7a, 0x50, 0x7a, 0x50, 0x7a, 0x50, 0x7a, - 0xe2, 0xa5, 0xe2, 0xa5, 0xe2, 0xa5, 0xe2, 0xa5, - 0xe2, 0xa5, 0xe2, 0xa5, 0xe2, 0xa5, 0xe2, 0xa5, - 0xa0, 0x00, 0xa2, 0x48, - 0x17, 0x6e, 0x17, 0x6e, 0x17, 0x6e, 0x17, 0x6e, - 0xa9, 0x99, 0xa9, 0x99, 0xa9, 0x99, 0xa9, 0x99, - 0xa9, 0x99, 0xa9, 0x99, 0xa9, 0x99, 0xa9, 0x99, - 0x50, 0x00, 0xc9, 0x36, - 0xb7, 0x59, 0xb7, 0x59, 0xb7, 0x59, 0xb7, 0x59, - 0x49, 0x85, 0x49, 0x85, 0x49, 0x85, 0x49, 0x85, - 0x49, 0x85, 0x49, 0x85, 0x49, 0x85, 0x49, 0x85, - 0x00, 0x00, 0x12, 0x2e, - 0x57, 0x45, 0x57, 0x45, 0x57, 0x45, 0x57, 0x45, - 0xe9, 0x70, 0xe9, 0x70, 0xe9, 0x70, 0xe9, 0x70, - 0xe9, 0x70, 0xe9, 0x70, 0xe9, 0x70, 0xe9, 0x70, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, - - /* 2452 MHz */ - 0x99, 0x09, - 0x10, 0x01, 0x74, 0x86, - 0xdb, 0x8a, 0xdb, 0x8a, 0xdb, 0x8a, 0xdb, 0x8a, - 0x6d, 0xb6, 0x6d, 0xb6, 0x6d, 0xb6, 0x6d, 0xb6, - 0x6d, 0xb6, 0x6d, 0xb6, 0x6d, 0xb6, 0x6d, 0xb6, - 0xf0, 0x00, 0x1e, 0x6e, - 0xb0, 0x82, 0xb0, 0x82, 0xb0, 0x82, 0xb0, 0x82, - 0x42, 0xae, 0x42, 0xae, 0x42, 0xae, 0x42, 0xae, - 0x42, 0xae, 0x42, 0xae, 0x42, 0xae, 0x42, 0xae, - 0xd0, 0x00, 0xeb, 0x5b, - 0x85, 0x7a, 0x85, 0x7a, 0x85, 0x7a, 0x85, 0x7a, - 0x17, 0xa6, 0x17, 0xa6, 0x17, 0xa6, 0x17, 0xa6, - 0x17, 0xa6, 0x17, 0xa6, 0x17, 0xa6, 0x17, 0xa6, - 0xa0, 0x00, 0xd8, 0x48, - 0x46, 0x6e, 0x46, 0x6e, 0x46, 0x6e, 0x46, 0x6e, - 0xd8, 0x99, 0xd8, 0x99, 0xd8, 0x99, 0xd8, 0x99, - 0xd8, 0x99, 0xd8, 0x99, 0xd8, 0x99, 0xd8, 0x99, - 0x50, 0x00, 0xcd, 0x36, - 0xdb, 0x59, 0xdb, 0x59, 0xdb, 0x59, 0xdb, 0x59, - 0x6d, 0x85, 0x6d, 0x85, 0x6d, 0x85, 0x6d, 0x85, - 0x6d, 0x85, 0x6d, 0x85, 0x6d, 0x85, 0x6d, 0x85, - 0x00, 0x00, 0x10, 0x2e, - 0x71, 0x45, 0x71, 0x45, 0x71, 0x45, 0x71, 0x45, - 0x03, 0x71, 0x03, 0x71, 0x03, 0x71, 0x03, 0x71, - 0x03, 0x71, 0x03, 0x71, 0x03, 0x71, 0x03, 0x71, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, - - /* 2557 MHz */ - 0x9e, 0x09, - 0x10, 0x01, 0xf3, 0x87, - 0x17, 0x8b, 0x17, 0x8b, 0x17, 0x8b, 0x17, 0x8b, - 0xa9, 0xb6, 0xa9, 0xb6, 0xa9, 0xb6, 0xa9, 0xb6, - 0xa9, 0xb6, 0xa9, 0xb6, 0xa9, 0xb6, 0xa9, 0xb6, - 0xf0, 0x00, 0x07, 0x6f, - 0xe9, 0x82, 0xe9, 0x82, 0xe9, 0x82, 0xe9, 0x82, - 0x7b, 0xae, 0x7b, 0xae, 0x7b, 0xae, 0x7b, 0xae, - 0x7b, 0xae, 0x7b, 0xae, 0x7b, 0xae, 0x7b, 0xae, - 0xd0, 0x00, 0x73, 0x5c, - 0xba, 0x7a, 0xba, 0x7a, 0xba, 0x7a, 0xba, 0x7a, - 0x4c, 0xa6, 0x4c, 0xa6, 0x4c, 0xa6, 0x4c, 0xa6, - 0x4c, 0xa6, 0x4c, 0xa6, 0x4c, 0xa6, 0x4c, 0xa6, - 0xa0, 0x00, 0x0d, 0x49, - 0x74, 0x6e, 0x74, 0x6e, 0x74, 0x6e, 0x74, 0x6e, - 0x06, 0x9a, 0x06, 0x9a, 0x06, 0x9a, 0x06, 0x9a, - 0x06, 0x9a, 0x06, 0x9a, 0x06, 0x9a, 0x06, 0x9a, - 0x50, 0x00, 0xd1, 0x36, - 0xff, 0x59, 0xff, 0x59, 0xff, 0x59, 0xff, 0x59, - 0x91, 0x85, 0x91, 0x85, 0x91, 0x85, 0x91, 0x85, - 0x91, 0x85, 0x91, 0x85, 0x91, 0x85, 0x91, 0x85, - 0x00, 0x00, 0x0e, 0x2e, - 0x8b, 0x45, 0x8b, 0x45, 0x8b, 0x45, 0x8b, 0x45, - 0x1d, 0x71, 0x1d, 0x71, 0x1d, 0x71, 0x1d, 0x71, - 0x1d, 0x71, 0x1d, 0x71, 0x1d, 0x71, 0x1d, 0x71, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, - - /* 2562 MHz */ - 0xa3, 0x09, - 0x10, 0x01, 0x72, 0x89, - 0x54, 0x8b, 0x54, 0x8b, 0x54, 0x8b, 0x54, 0x8b, - 0xe6, 0xb6, 0xe6, 0xb6, 0xe6, 0xb6, 0xe6, 0xb6, - 0xe6, 0xb6, 0xe6, 0xb6, 0xe6, 0xb6, 0xe6, 0xb6, - 0xf0, 0x00, 0xf0, 0x6f, - 0x21, 0x83, 0x21, 0x83, 0x21, 0x83, 0x21, 0x83, - 0xb3, 0xae, 0xb3, 0xae, 0xb3, 0xae, 0xb3, 0xae, - 0xb3, 0xae, 0xb3, 0xae, 0xb3, 0xae, 0xb3, 0xae, - 0xd0, 0x00, 0xfb, 0x5c, - 0xee, 0x7a, 0xee, 0x7a, 0xee, 0x7a, 0xee, 0x7a, - 0x80, 0xa6, 0x80, 0xa6, 0x80, 0xa6, 0x80, 0xa6, - 0x80, 0xa6, 0x80, 0xa6, 0x80, 0xa6, 0x80, 0xa6, - 0xa0, 0x00, 0x43, 0x49, - 0xa3, 0x6e, 0xa3, 0x6e, 0xa3, 0x6e, 0xa3, 0x6e, - 0x35, 0x9a, 0x35, 0x9a, 0x35, 0x9a, 0x35, 0x9a, - 0x35, 0x9a, 0x35, 0x9a, 0x35, 0x9a, 0x35, 0x9a, - 0x50, 0x00, 0xd4, 0x36, - 0x24, 0x5a, 0x24, 0x5a, 0x24, 0x5a, 0x24, 0x5a, - 0xb6, 0x85, 0xb6, 0x85, 0xb6, 0x85, 0xb6, 0x85, - 0xb6, 0x85, 0xb6, 0x85, 0xb6, 0x85, 0xb6, 0x85, - 0x00, 0x00, 0x0b, 0x2e, - 0xa6, 0x45, 0xa6, 0x45, 0xa6, 0x45, 0xa6, 0x45, - 0x38, 0x71, 0x38, 0x71, 0x38, 0x71, 0x38, 0x71, - 0x38, 0x71, 0x38, 0x71, 0x38, 0x71, 0x38, 0x71, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, - - /* 2572 MHz */ - 0xa8, 0x09, - 0x10, 0x01, 0xf1, 0x8a, - 0x91, 0x8b, 0x91, 0x8b, 0x91, 0x8b, 0x91, 0x8b, - 0x23, 0xb7, 0x23, 0xb7, 0x23, 0xb7, 0x23, 0xb7, - 0x23, 0xb7, 0x23, 0xb7, 0x23, 0xb7, 0x23, 0xb7, - 0xf0, 0x00, 0xd9, 0x70, - 0x5a, 0x83, 0x5a, 0x83, 0x5a, 0x83, 0x5a, 0x83, - 0xec, 0xae, 0xec, 0xae, 0xec, 0xae, 0xec, 0xae, - 0xec, 0xae, 0xec, 0xae, 0xec, 0xae, 0xec, 0xae, - 0xd0, 0x00, 0x83, 0x5d, - 0x23, 0x7b, 0x23, 0x7b, 0x23, 0x7b, 0x23, 0x7b, - 0xb5, 0xa6, 0xb5, 0xa6, 0xb5, 0xa6, 0xb5, 0xa6, - 0xb5, 0xa6, 0xb5, 0xa6, 0xb5, 0xa6, 0xb5, 0xa6, - 0xa0, 0x00, 0x78, 0x49, - 0xd1, 0x6e, 0xd1, 0x6e, 0xd1, 0x6e, 0xd1, 0x6e, - 0x63, 0x9a, 0x63, 0x9a, 0x63, 0x9a, 0x63, 0x9a, - 0x63, 0x9a, 0x63, 0x9a, 0x63, 0x9a, 0x63, 0x9a, - 0x50, 0x00, 0xd8, 0x36, - 0x48, 0x5a, 0x48, 0x5a, 0x48, 0x5a, 0x48, 0x5a, - 0xda, 0x85, 0xda, 0x85, 0xda, 0x85, 0xda, 0x85, - 0xda, 0x85, 0xda, 0x85, 0xda, 0x85, 0xda, 0x85, - 0x00, 0x00, 0x09, 0x2e, - 0xc0, 0x45, 0xc0, 0x45, 0xc0, 0x45, 0xc0, 0x45, - 0x52, 0x71, 0x52, 0x71, 0x52, 0x71, 0x52, 0x71, - 0x52, 0x71, 0x52, 0x71, 0x52, 0x71, 0x52, 0x71, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, - -/* - * Not really sure if this is actually the power_limit database, - * it looks a bit "related" to PDR_PRISM_ZIF_TX_IQ_CALIBRATION - */ -/* struct pda_custom_wrapper */ -0xae, 0x00, 0xef, 0xbe, /* PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS_CUSTOM */ - 0x0d, 0x00, 0x1a, 0x00, /* 13 entries, 26 bytes per entry */ - 0x00, 0x00, 0x52, 0x01, /* no offset, 338 bytes total */ - - /* 2412 MHz */ - 0x6c, 0x09, - 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, - 0xe0, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0xe0, 0x00, - 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, - - /* 2417 MHz */ - 0x71, 0x09, - 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, - 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, - 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, - - /* 2422 MHz */ - 0x76, 0x09, - 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, - 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, - 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, - - /* 2427 MHz */ - 0x7b, 0x09, - 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, - 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, - 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, - - /* 2432 MHz */ - 0x80, 0x09, - 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, - 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, - 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, - - /* 2437 MHz */ - 0x85, 0x09, - 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, - 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, - 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, - - /* 2442 MHz */ - 0x8a, 0x09, - 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, - 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, - 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, - - /* 2447 MHz */ - 0x8f, 0x09, - 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, - 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, - 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, - - /* 2452 MHz */ - 0x94, 0x09, - 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, - 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, - 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, - - /* 2457 MHz */ - 0x99, 0x09, - 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, - 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, - 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, - - /* 2462 MHz */ - 0x9e, 0x09, - 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, - 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, - 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, - - /* 2467 MHz */ - 0xa3, 0x09, - 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, - 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, - 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, - - /* 2472 MHz */ - 0xa8, 0x09, - 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, - 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, - 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, - -/* struct pda_iq_autocal_entry[13] */ -0x42, 0x00, 0x06, 0x19, /* PDR_PRISM_ZIF_TX_IQ_CALIBRATION */ - /* 2412 MHz */ - 0x6c, 0x09, 0x26, 0x00, 0xf8, 0xff, 0xf7, 0xff, 0xff, 0x00, - /* 2417 MHz */ - 0x71, 0x09, 0x26, 0x00, 0xf8, 0xff, 0xf7, 0xff, 0xff, 0x00, - /* 2422 MHz */ - 0x76, 0x09, 0x26, 0x00, 0xf8, 0xff, 0xf7, 0xff, 0xff, 0x00, - /* 2427 MHz */ - 0x7b, 0x09, 0x26, 0x00, 0xf8, 0xff, 0xf7, 0xff, 0xff, 0x00, - /* 2432 MHz */ - 0x80, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00, - /* 2437 MHz */ - 0x85, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00, - /* 2442 MHz */ - 0x8a, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00, - /* 2447 MHz */ - 0x8f, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00, - /* 2452 MHz */ - 0x94, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00, - /* 2457 MHz */ - 0x99, 0x09, 0x25, 0x00, 0xf5, 0xff, 0xf9, 0xff, 0x00, 0x01, - /* 2462 MHz */ - 0x9e, 0x09, 0x25, 0x00, 0xf5, 0xff, 0xf9, 0xff, 0x00, 0x01, - /* 2467 MHz */ - 0xa3, 0x09, 0x25, 0x00, 0xf5, 0xff, 0xf9, 0xff, 0x00, 0x01, - /* 2472 MHz */ - 0xa8, 0x09, 0x25, 0x00, 0xf5, 0xff, 0xf9, 0xff, 0x00, 0x01, - -0x02, 0x00, 0x00, 0x00, /* PDR_END */ - 0xb6, 0x04, -}; - -#endif /* P54SPI_EEPROM_H */ - diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c deleted file mode 100644 index f42dc3ccd496..000000000000 --- a/drivers/net/wireless/p54/p54usb.c +++ /dev/null @@ -1,1145 +0,0 @@ - -/* - * Linux device driver for USB based Prism54 - * - * Copyright (c) 2006, Michael Wu - * - * Based on the islsm (softmac prism54) driver, which is: - * Copyright 2004-2006 Jean-Baptiste Note , et al. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "p54.h" -#include "lmac.h" -#include "p54usb.h" - -MODULE_AUTHOR("Michael Wu "); -MODULE_DESCRIPTION("Prism54 USB wireless driver"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("prism54usb"); -MODULE_FIRMWARE("isl3886usb"); -MODULE_FIRMWARE("isl3887usb"); - -/* - * Note: - * - * Always update our wiki's device list (located at: - * http://wireless.kernel.org/en/users/Drivers/p54/devices ), - * whenever you add a new device. - */ - -static struct usb_device_id p54u_table[] = { - /* Version 1 devices (pci chip + net2280) */ - {USB_DEVICE(0x0411, 0x0050)}, /* Buffalo WLI2-USB2-G54 */ - {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */ - {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */ - {USB_DEVICE(0x0675, 0x0530)}, /* DrayTek Vigor 530 */ - {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */ - {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */ - {USB_DEVICE(0x07aa, 0x001c)}, /* Corega CG-WLUSB2GT */ - {USB_DEVICE(0x083a, 0x4501)}, /* Accton 802.11g WN4501 USB */ - {USB_DEVICE(0x083a, 0x4502)}, /* Siemens Gigaset USB Adapter */ - {USB_DEVICE(0x083a, 0x5501)}, /* Phillips CPWUA054 */ - {USB_DEVICE(0x0846, 0x4200)}, /* Netgear WG121 */ - {USB_DEVICE(0x0846, 0x4210)}, /* Netgear WG121 the second ? */ - {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */ - {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ - {USB_DEVICE(0x0bf8, 0x1007)}, /* Fujitsu E-5400 USB */ - {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */ - {USB_DEVICE(0x0db0, 0x6826)}, /* MSI UB54G (MS-6826) */ - {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */ - {USB_DEVICE(0x124a, 0x4023)}, /* Shuttle PN15, Airvast WM168g, IOGear GWU513 */ - {USB_DEVICE(0x1435, 0x0210)}, /* Inventel UR054G */ - {USB_DEVICE(0x15a9, 0x0002)}, /* Gemtek WUBI-100GW 802.11g */ - {USB_DEVICE(0x1630, 0x0005)}, /* 2Wire 802.11g USB (v1) / Z-Com */ - {USB_DEVICE(0x182d, 0x096b)}, /* Sitecom WL-107 */ - {USB_DEVICE(0x1915, 0x2234)}, /* Linksys WUSB54G OEM */ - {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */ - {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */ - {USB_DEVICE(0x2001, 0x3703)}, /* DLink DWL-G122 */ - {USB_DEVICE(0x2001, 0x3762)}, /* Conceptronic C54U */ - {USB_DEVICE(0x5041, 0x2234)}, /* Linksys WUSB54G */ - {USB_DEVICE(0x5041, 0x2235)}, /* Linksys WUSB54G Portable */ - - /* Version 2 devices (3887) */ - {USB_DEVICE(0x0471, 0x1230)}, /* Philips CPWUA054/00 */ - {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ - {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ - {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ - {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */ - {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ - {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ - {USB_DEVICE(0x07aa, 0x0020)}, /* Corega WLUSB2GTST USB */ - {USB_DEVICE(0x0803, 0x4310)}, /* Zoom 4410a */ - {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ - {USB_DEVICE(0x083a, 0x4531)}, /* T-Com Sinus 154 data II */ - {USB_DEVICE(0x083a, 0xc501)}, /* Zoom Wireless-G 4410 */ - {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */ - {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */ - {USB_DEVICE(0x0915, 0x2000)}, /* Cohiba Proto board */ - {USB_DEVICE(0x0915, 0x2002)}, /* Cohiba Proto board */ - {USB_DEVICE(0x0baf, 0x0118)}, /* U.S. Robotics U5 802.11g Adapter*/ - {USB_DEVICE(0x0bf8, 0x1009)}, /* FUJITSU E-5400 USB D1700*/ - /* {USB_DEVICE(0x0cde, 0x0006)}, * Medion MD40900 already listed above, - * just noting it here for clarity */ - {USB_DEVICE(0x0cde, 0x0008)}, /* Sagem XG703A */ - {USB_DEVICE(0x0cde, 0x0015)}, /* Zcomax XG-705A */ - {USB_DEVICE(0x0d8e, 0x3762)}, /* DLink DWL-G120 Cohiba */ - {USB_DEVICE(0x124a, 0x4025)}, /* IOGear GWU513 (GW3887IK chip) */ - {USB_DEVICE(0x1260, 0xee22)}, /* SMC 2862W-G version 2 */ - {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */ - {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ - {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ - {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ - /* {USB_DEVICE(0x15a9, 0x0002)}, * Also SparkLAN WL-682 with 3887 */ - {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ - {USB_DEVICE(0x1740, 0x1000)}, /* Senao NUB-350 */ - {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ - {USB_DEVICE(0x2001, 0x3705)}, /* D-Link DWL-G120 rev C1 */ - {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */ - {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */ - {USB_DEVICE(0x413c, 0x8104)}, /* Cohiba Proto board */ - {} -}; - -MODULE_DEVICE_TABLE(usb, p54u_table); - -static const struct { - u32 intf; - enum p54u_hw_type type; - const char *fw; - char hw[20]; -} p54u_fwlist[__NUM_P54U_HWTYPES] = { - { - .type = P54U_NET2280, - .intf = FW_LM86, - .fw = "isl3886usb", - .hw = "ISL3886 + net2280", - }, - { - .type = P54U_3887, - .intf = FW_LM87, - .fw = "isl3887usb", - .hw = "ISL3887", - }, -}; - -static void p54u_rx_cb(struct urb *urb) -{ - struct sk_buff *skb = (struct sk_buff *) urb->context; - struct p54u_rx_info *info = (struct p54u_rx_info *)skb->cb; - struct ieee80211_hw *dev = info->dev; - struct p54u_priv *priv = dev->priv; - - skb_unlink(skb, &priv->rx_queue); - - if (unlikely(urb->status)) { - dev_kfree_skb_irq(skb); - return; - } - - skb_put(skb, urb->actual_length); - - if (priv->hw_type == P54U_NET2280) - skb_pull(skb, priv->common.tx_hdr_len); - if (priv->common.fw_interface == FW_LM87) { - skb_pull(skb, 4); - skb_put(skb, 4); - } - - if (p54_rx(dev, skb)) { - skb = dev_alloc_skb(priv->common.rx_mtu + 32); - if (unlikely(!skb)) { - /* TODO check rx queue length and refill *somewhere* */ - return; - } - - info = (struct p54u_rx_info *) skb->cb; - info->urb = urb; - info->dev = dev; - urb->transfer_buffer = skb_tail_pointer(skb); - urb->context = skb; - } else { - if (priv->hw_type == P54U_NET2280) - skb_push(skb, priv->common.tx_hdr_len); - if (priv->common.fw_interface == FW_LM87) { - skb_push(skb, 4); - skb_put(skb, 4); - } - skb_reset_tail_pointer(skb); - skb_trim(skb, 0); - urb->transfer_buffer = skb_tail_pointer(skb); - } - skb_queue_tail(&priv->rx_queue, skb); - usb_anchor_urb(urb, &priv->submitted); - if (usb_submit_urb(urb, GFP_ATOMIC)) { - skb_unlink(skb, &priv->rx_queue); - usb_unanchor_urb(urb); - dev_kfree_skb_irq(skb); - } -} - -static void p54u_tx_cb(struct urb *urb) -{ - struct sk_buff *skb = urb->context; - struct ieee80211_hw *dev = - usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); - - p54_free_skb(dev, skb); -} - -static void p54u_tx_dummy_cb(struct urb *urb) { } - -static void p54u_free_urbs(struct ieee80211_hw *dev) -{ - struct p54u_priv *priv = dev->priv; - usb_kill_anchored_urbs(&priv->submitted); -} - -static void p54u_stop(struct ieee80211_hw *dev) -{ - /* - * TODO: figure out how to reliably stop the 3887 and net2280 so - * the hardware is still usable next time we want to start it. - * until then, we just stop listening to the hardware.. - */ - p54u_free_urbs(dev); -} - -static int p54u_init_urbs(struct ieee80211_hw *dev) -{ - struct p54u_priv *priv = dev->priv; - struct urb *entry = NULL; - struct sk_buff *skb; - struct p54u_rx_info *info; - int ret = 0; - - while (skb_queue_len(&priv->rx_queue) < 32) { - skb = __dev_alloc_skb(priv->common.rx_mtu + 32, GFP_KERNEL); - if (!skb) { - ret = -ENOMEM; - goto err; - } - entry = usb_alloc_urb(0, GFP_KERNEL); - if (!entry) { - ret = -ENOMEM; - goto err; - } - - usb_fill_bulk_urb(entry, priv->udev, - usb_rcvbulkpipe(priv->udev, P54U_PIPE_DATA), - skb_tail_pointer(skb), - priv->common.rx_mtu + 32, p54u_rx_cb, skb); - info = (struct p54u_rx_info *) skb->cb; - info->urb = entry; - info->dev = dev; - skb_queue_tail(&priv->rx_queue, skb); - - usb_anchor_urb(entry, &priv->submitted); - ret = usb_submit_urb(entry, GFP_KERNEL); - if (ret) { - skb_unlink(skb, &priv->rx_queue); - usb_unanchor_urb(entry); - goto err; - } - usb_free_urb(entry); - entry = NULL; - } - - return 0; - - err: - usb_free_urb(entry); - kfree_skb(skb); - p54u_free_urbs(dev); - return ret; -} - -static int p54u_open(struct ieee80211_hw *dev) -{ - /* - * TODO: Because we don't know how to reliably stop the 3887 and - * the isl3886+net2280, other than brutally cut off all - * communications. We have to reinitialize the urbs on every start. - */ - return p54u_init_urbs(dev); -} - -static __le32 p54u_lm87_chksum(const __le32 *data, size_t length) -{ - u32 chk = 0; - - length >>= 2; - while (length--) { - chk ^= le32_to_cpu(*data++); - chk = (chk >> 5) ^ (chk << 3); - } - - return cpu_to_le32(chk); -} - -static void p54u_tx_lm87(struct ieee80211_hw *dev, struct sk_buff *skb) -{ - struct p54u_priv *priv = dev->priv; - struct urb *data_urb; - struct lm87_tx_hdr *hdr = (void *)skb->data - sizeof(*hdr); - - data_urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!data_urb) { - p54_free_skb(dev, skb); - return; - } - - hdr->chksum = p54u_lm87_chksum((__le32 *)skb->data, skb->len); - hdr->device_addr = ((struct p54_hdr *)skb->data)->req_id; - - usb_fill_bulk_urb(data_urb, priv->udev, - usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), - hdr, skb->len + sizeof(*hdr), FREE_AFTER_TX(skb) ? - p54u_tx_cb : p54u_tx_dummy_cb, skb); - data_urb->transfer_flags |= URB_ZERO_PACKET; - - usb_anchor_urb(data_urb, &priv->submitted); - if (usb_submit_urb(data_urb, GFP_ATOMIC)) { - usb_unanchor_urb(data_urb); - p54_free_skb(dev, skb); - } - usb_free_urb(data_urb); -} - -static void p54u_tx_net2280(struct ieee80211_hw *dev, struct sk_buff *skb) -{ - struct p54u_priv *priv = dev->priv; - struct urb *int_urb = NULL, *data_urb = NULL; - struct net2280_tx_hdr *hdr = (void *)skb->data - sizeof(*hdr); - struct net2280_reg_write *reg = NULL; - int err = -ENOMEM; - - reg = kmalloc(sizeof(*reg), GFP_ATOMIC); - if (!reg) - goto out; - - int_urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!int_urb) - goto out; - - data_urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!data_urb) - goto out; - - reg->port = cpu_to_le16(NET2280_DEV_U32); - reg->addr = cpu_to_le32(P54U_DEV_BASE); - reg->val = cpu_to_le32(ISL38XX_DEV_INT_DATA); - - memset(hdr, 0, sizeof(*hdr)); - hdr->len = cpu_to_le16(skb->len); - hdr->device_addr = ((struct p54_hdr *) skb->data)->req_id; - - usb_fill_bulk_urb(int_urb, priv->udev, - usb_sndbulkpipe(priv->udev, P54U_PIPE_DEV), reg, sizeof(*reg), - p54u_tx_dummy_cb, dev); - - /* - * URB_FREE_BUFFER triggers a code path in the USB subsystem that will - * free what is inside the transfer_buffer after the last reference to - * the int_urb is dropped. - */ - int_urb->transfer_flags |= URB_FREE_BUFFER | URB_ZERO_PACKET; - reg = NULL; - - usb_fill_bulk_urb(data_urb, priv->udev, - usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), - hdr, skb->len + sizeof(*hdr), FREE_AFTER_TX(skb) ? - p54u_tx_cb : p54u_tx_dummy_cb, skb); - data_urb->transfer_flags |= URB_ZERO_PACKET; - - usb_anchor_urb(int_urb, &priv->submitted); - err = usb_submit_urb(int_urb, GFP_ATOMIC); - if (err) { - usb_unanchor_urb(int_urb); - goto out; - } - - usb_anchor_urb(data_urb, &priv->submitted); - err = usb_submit_urb(data_urb, GFP_ATOMIC); - if (err) { - usb_unanchor_urb(data_urb); - goto out; - } -out: - usb_free_urb(int_urb); - usb_free_urb(data_urb); - - if (err) { - kfree(reg); - p54_free_skb(dev, skb); - } -} - -static int p54u_write(struct p54u_priv *priv, - struct net2280_reg_write *buf, - enum net2280_op_type type, - __le32 addr, __le32 val) -{ - unsigned int ep; - int alen; - - if (type & 0x0800) - ep = usb_sndbulkpipe(priv->udev, P54U_PIPE_DEV); - else - ep = usb_sndbulkpipe(priv->udev, P54U_PIPE_BRG); - - buf->port = cpu_to_le16(type); - buf->addr = addr; - buf->val = val; - - return usb_bulk_msg(priv->udev, ep, buf, sizeof(*buf), &alen, 1000); -} - -static int p54u_read(struct p54u_priv *priv, void *buf, - enum net2280_op_type type, - __le32 addr, __le32 *val) -{ - struct net2280_reg_read *read = buf; - __le32 *reg = buf; - unsigned int ep; - int alen, err; - - if (type & 0x0800) - ep = P54U_PIPE_DEV; - else - ep = P54U_PIPE_BRG; - - read->port = cpu_to_le16(type); - read->addr = addr; - - err = usb_bulk_msg(priv->udev, usb_sndbulkpipe(priv->udev, ep), - read, sizeof(*read), &alen, 1000); - if (err) - return err; - - err = usb_bulk_msg(priv->udev, usb_rcvbulkpipe(priv->udev, ep), - reg, sizeof(*reg), &alen, 1000); - if (err) - return err; - - *val = *reg; - return 0; -} - -static int p54u_bulk_msg(struct p54u_priv *priv, unsigned int ep, - void *data, size_t len) -{ - int alen; - return usb_bulk_msg(priv->udev, usb_sndbulkpipe(priv->udev, ep), - data, len, &alen, 2000); -} - -static int p54u_device_reset(struct ieee80211_hw *dev) -{ - struct p54u_priv *priv = dev->priv; - int ret, lock = (priv->intf->condition != USB_INTERFACE_BINDING); - - if (lock) { - ret = usb_lock_device_for_reset(priv->udev, priv->intf); - if (ret < 0) { - dev_err(&priv->udev->dev, "(p54usb) unable to lock " - "device for reset (%d)!\n", ret); - return ret; - } - } - - ret = usb_reset_device(priv->udev); - if (lock) - usb_unlock_device(priv->udev); - - if (ret) - dev_err(&priv->udev->dev, "(p54usb) unable to reset " - "device (%d)!\n", ret); - - return ret; -} - -static const char p54u_romboot_3887[] = "~~~~"; -static int p54u_firmware_reset_3887(struct ieee80211_hw *dev) -{ - struct p54u_priv *priv = dev->priv; - u8 *buf; - int ret; - - buf = kmemdup(p54u_romboot_3887, 4, GFP_KERNEL); - if (!buf) - return -ENOMEM; - ret = p54u_bulk_msg(priv, P54U_PIPE_DATA, - buf, 4); - kfree(buf); - if (ret) - dev_err(&priv->udev->dev, "(p54usb) unable to jump to " - "boot ROM (%d)!\n", ret); - - return ret; -} - -static const char p54u_firmware_upload_3887[] = "<\r"; -static int p54u_upload_firmware_3887(struct ieee80211_hw *dev) -{ - struct p54u_priv *priv = dev->priv; - int err, alen; - u8 carry = 0; - u8 *buf, *tmp; - const u8 *data; - unsigned int left, remains, block_size; - struct x2_header *hdr; - unsigned long timeout; - - err = p54u_firmware_reset_3887(dev); - if (err) - return err; - - tmp = buf = kmalloc(P54U_FW_BLOCK, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - left = block_size = min((size_t)P54U_FW_BLOCK, priv->fw->size); - strcpy(buf, p54u_firmware_upload_3887); - left -= strlen(p54u_firmware_upload_3887); - tmp += strlen(p54u_firmware_upload_3887); - - data = priv->fw->data; - remains = priv->fw->size; - - hdr = (struct x2_header *)(buf + strlen(p54u_firmware_upload_3887)); - memcpy(hdr->signature, X2_SIGNATURE, X2_SIGNATURE_SIZE); - hdr->fw_load_addr = cpu_to_le32(ISL38XX_DEV_FIRMWARE_ADDR); - hdr->fw_length = cpu_to_le32(priv->fw->size); - hdr->crc = cpu_to_le32(~crc32_le(~0, (void *)&hdr->fw_load_addr, - sizeof(u32)*2)); - left -= sizeof(*hdr); - tmp += sizeof(*hdr); - - while (remains) { - while (left--) { - if (carry) { - *tmp++ = carry; - carry = 0; - remains--; - continue; - } - switch (*data) { - case '~': - *tmp++ = '}'; - carry = '^'; - break; - case '}': - *tmp++ = '}'; - carry = ']'; - break; - default: - *tmp++ = *data; - remains--; - break; - } - data++; - } - - err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, block_size); - if (err) { - dev_err(&priv->udev->dev, "(p54usb) firmware " - "upload failed!\n"); - goto err_upload_failed; - } - - tmp = buf; - left = block_size = min((unsigned int)P54U_FW_BLOCK, remains); - } - - *((__le32 *)buf) = cpu_to_le32(~crc32_le(~0, priv->fw->data, - priv->fw->size)); - err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, sizeof(u32)); - if (err) { - dev_err(&priv->udev->dev, "(p54usb) firmware upload failed!\n"); - goto err_upload_failed; - } - timeout = jiffies + msecs_to_jiffies(1000); - while (!(err = usb_bulk_msg(priv->udev, - usb_rcvbulkpipe(priv->udev, P54U_PIPE_DATA), buf, 128, &alen, 1000))) { - if (alen > 2 && !memcmp(buf, "OK", 2)) - break; - - if (alen > 5 && !memcmp(buf, "ERROR", 5)) { - err = -EINVAL; - break; - } - - if (time_after(jiffies, timeout)) { - dev_err(&priv->udev->dev, "(p54usb) firmware boot " - "timed out!\n"); - err = -ETIMEDOUT; - break; - } - } - if (err) { - dev_err(&priv->udev->dev, "(p54usb) firmware upload failed!\n"); - goto err_upload_failed; - } - - buf[0] = 'g'; - buf[1] = '\r'; - err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, 2); - if (err) { - dev_err(&priv->udev->dev, "(p54usb) firmware boot failed!\n"); - goto err_upload_failed; - } - - timeout = jiffies + msecs_to_jiffies(1000); - while (!(err = usb_bulk_msg(priv->udev, - usb_rcvbulkpipe(priv->udev, P54U_PIPE_DATA), buf, 128, &alen, 1000))) { - if (alen > 0 && buf[0] == 'g') - break; - - if (time_after(jiffies, timeout)) { - err = -ETIMEDOUT; - break; - } - } - if (err) - goto err_upload_failed; - -err_upload_failed: - kfree(buf); - return err; -} - -static int p54u_upload_firmware_net2280(struct ieee80211_hw *dev) -{ - struct p54u_priv *priv = dev->priv; - const struct p54p_csr *devreg = (const struct p54p_csr *) P54U_DEV_BASE; - int err, alen; - void *buf; - __le32 reg; - unsigned int remains, offset; - const u8 *data; - - buf = kmalloc(512, GFP_KERNEL); - if (!buf) - return -ENOMEM; - -#define P54U_WRITE(type, addr, data) \ - do {\ - err = p54u_write(priv, buf, type,\ - cpu_to_le32((u32)(unsigned long)addr), data);\ - if (err) \ - goto fail;\ - } while (0) - -#define P54U_READ(type, addr) \ - do {\ - err = p54u_read(priv, buf, type,\ - cpu_to_le32((u32)(unsigned long)addr), ®);\ - if (err)\ - goto fail;\ - } while (0) - - /* power down net2280 bridge */ - P54U_READ(NET2280_BRG_U32, NET2280_GPIOCTL); - reg |= cpu_to_le32(P54U_BRG_POWER_DOWN); - reg &= cpu_to_le32(~P54U_BRG_POWER_UP); - P54U_WRITE(NET2280_BRG_U32, NET2280_GPIOCTL, reg); - - mdelay(100); - - /* power up bridge */ - reg |= cpu_to_le32(P54U_BRG_POWER_UP); - reg &= cpu_to_le32(~P54U_BRG_POWER_DOWN); - P54U_WRITE(NET2280_BRG_U32, NET2280_GPIOCTL, reg); - - mdelay(100); - - P54U_WRITE(NET2280_BRG_U32, NET2280_DEVINIT, - cpu_to_le32(NET2280_CLK_30Mhz | - NET2280_PCI_ENABLE | - NET2280_PCI_SOFT_RESET)); - - mdelay(20); - - P54U_WRITE(NET2280_BRG_CFG_U16, PCI_COMMAND, - cpu_to_le32(PCI_COMMAND_MEMORY | - PCI_COMMAND_MASTER)); - - P54U_WRITE(NET2280_BRG_CFG_U32, PCI_BASE_ADDRESS_0, - cpu_to_le32(NET2280_BASE)); - - P54U_READ(NET2280_BRG_CFG_U16, PCI_STATUS); - reg |= cpu_to_le32(PCI_STATUS_REC_MASTER_ABORT); - P54U_WRITE(NET2280_BRG_CFG_U16, PCI_STATUS, reg); - - // TODO: we really need this? - P54U_READ(NET2280_BRG_U32, NET2280_RELNUM); - - P54U_WRITE(NET2280_BRG_U32, NET2280_EPA_RSP, - cpu_to_le32(NET2280_CLEAR_NAK_OUT_PACKETS_MODE)); - P54U_WRITE(NET2280_BRG_U32, NET2280_EPC_RSP, - cpu_to_le32(NET2280_CLEAR_NAK_OUT_PACKETS_MODE)); - - P54U_WRITE(NET2280_BRG_CFG_U32, PCI_BASE_ADDRESS_2, - cpu_to_le32(NET2280_BASE2)); - - /* finally done setting up the bridge */ - - P54U_WRITE(NET2280_DEV_CFG_U16, 0x10000 | PCI_COMMAND, - cpu_to_le32(PCI_COMMAND_MEMORY | - PCI_COMMAND_MASTER)); - - P54U_WRITE(NET2280_DEV_CFG_U16, 0x10000 | 0x40 /* TRDY timeout */, 0); - P54U_WRITE(NET2280_DEV_CFG_U32, 0x10000 | PCI_BASE_ADDRESS_0, - cpu_to_le32(P54U_DEV_BASE)); - - P54U_WRITE(NET2280_BRG_U32, NET2280_USBIRQENB1, 0); - P54U_WRITE(NET2280_BRG_U32, NET2280_IRQSTAT1, - cpu_to_le32(NET2280_PCI_INTA_INTERRUPT)); - - /* do romboot */ - P54U_WRITE(NET2280_DEV_U32, &devreg->int_enable, 0); - - P54U_READ(NET2280_DEV_U32, &devreg->ctrl_stat); - reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET); - reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RAMBOOT); - reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_CLKRUN); - P54U_WRITE(NET2280_DEV_U32, &devreg->ctrl_stat, reg); - - mdelay(20); - - reg |= cpu_to_le32(ISL38XX_CTRL_STAT_RESET); - P54U_WRITE(NET2280_DEV_U32, &devreg->ctrl_stat, reg); - - mdelay(20); - - reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET); - P54U_WRITE(NET2280_DEV_U32, &devreg->ctrl_stat, reg); - - mdelay(100); - - P54U_READ(NET2280_DEV_U32, &devreg->int_ident); - P54U_WRITE(NET2280_DEV_U32, &devreg->int_ack, reg); - - /* finally, we can upload firmware now! */ - remains = priv->fw->size; - data = priv->fw->data; - offset = ISL38XX_DEV_FIRMWARE_ADDR; - - while (remains) { - unsigned int block_len = min(remains, (unsigned int)512); - memcpy(buf, data, block_len); - - err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, block_len); - if (err) { - dev_err(&priv->udev->dev, "(p54usb) firmware block " - "upload failed\n"); - goto fail; - } - - P54U_WRITE(NET2280_DEV_U32, &devreg->direct_mem_base, - cpu_to_le32(0xc0000f00)); - - P54U_WRITE(NET2280_DEV_U32, - 0x0020 | (unsigned long)&devreg->direct_mem_win, 0); - P54U_WRITE(NET2280_DEV_U32, - 0x0020 | (unsigned long)&devreg->direct_mem_win, - cpu_to_le32(1)); - - P54U_WRITE(NET2280_DEV_U32, - 0x0024 | (unsigned long)&devreg->direct_mem_win, - cpu_to_le32(block_len)); - P54U_WRITE(NET2280_DEV_U32, - 0x0028 | (unsigned long)&devreg->direct_mem_win, - cpu_to_le32(offset)); - - P54U_WRITE(NET2280_DEV_U32, &devreg->dma_addr, - cpu_to_le32(NET2280_EPA_FIFO_PCI_ADDR)); - P54U_WRITE(NET2280_DEV_U32, &devreg->dma_len, - cpu_to_le32(block_len >> 2)); - P54U_WRITE(NET2280_DEV_U32, &devreg->dma_ctrl, - cpu_to_le32(ISL38XX_DMA_MASTER_CONTROL_TRIGGER)); - - mdelay(10); - - P54U_READ(NET2280_DEV_U32, - 0x002C | (unsigned long)&devreg->direct_mem_win); - if (!(reg & cpu_to_le32(ISL38XX_DMA_STATUS_DONE)) || - !(reg & cpu_to_le32(ISL38XX_DMA_STATUS_READY))) { - dev_err(&priv->udev->dev, "(p54usb) firmware DMA " - "transfer failed\n"); - goto fail; - } - - P54U_WRITE(NET2280_BRG_U32, NET2280_EPA_STAT, - cpu_to_le32(NET2280_FIFO_FLUSH)); - - remains -= block_len; - data += block_len; - offset += block_len; - } - - /* do ramboot */ - P54U_READ(NET2280_DEV_U32, &devreg->ctrl_stat); - reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET); - reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_CLKRUN); - reg |= cpu_to_le32(ISL38XX_CTRL_STAT_RAMBOOT); - P54U_WRITE(NET2280_DEV_U32, &devreg->ctrl_stat, reg); - - mdelay(20); - - reg |= cpu_to_le32(ISL38XX_CTRL_STAT_RESET); - P54U_WRITE(NET2280_DEV_U32, &devreg->ctrl_stat, reg); - - reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET); - P54U_WRITE(NET2280_DEV_U32, &devreg->ctrl_stat, reg); - - mdelay(100); - - P54U_READ(NET2280_DEV_U32, &devreg->int_ident); - P54U_WRITE(NET2280_DEV_U32, &devreg->int_ack, reg); - - /* start up the firmware */ - P54U_WRITE(NET2280_DEV_U32, &devreg->int_enable, - cpu_to_le32(ISL38XX_INT_IDENT_INIT)); - - P54U_WRITE(NET2280_BRG_U32, NET2280_IRQSTAT1, - cpu_to_le32(NET2280_PCI_INTA_INTERRUPT)); - - P54U_WRITE(NET2280_BRG_U32, NET2280_USBIRQENB1, - cpu_to_le32(NET2280_PCI_INTA_INTERRUPT_ENABLE | - NET2280_USB_INTERRUPT_ENABLE)); - - P54U_WRITE(NET2280_DEV_U32, &devreg->dev_int, - cpu_to_le32(ISL38XX_DEV_INT_RESET)); - - err = usb_interrupt_msg(priv->udev, - usb_rcvbulkpipe(priv->udev, P54U_PIPE_INT), - buf, sizeof(__le32), &alen, 1000); - if (err || alen != sizeof(__le32)) - goto fail; - - P54U_READ(NET2280_DEV_U32, &devreg->int_ident); - P54U_WRITE(NET2280_DEV_U32, &devreg->int_ack, reg); - - if (!(reg & cpu_to_le32(ISL38XX_INT_IDENT_INIT))) - err = -EINVAL; - - P54U_WRITE(NET2280_BRG_U32, NET2280_USBIRQENB1, 0); - P54U_WRITE(NET2280_BRG_U32, NET2280_IRQSTAT1, - cpu_to_le32(NET2280_PCI_INTA_INTERRUPT)); - -#undef P54U_WRITE -#undef P54U_READ - -fail: - kfree(buf); - return err; -} - -static int p54_find_type(struct p54u_priv *priv) -{ - int i; - - for (i = 0; i < __NUM_P54U_HWTYPES; i++) - if (p54u_fwlist[i].type == priv->hw_type) - break; - if (i == __NUM_P54U_HWTYPES) - return -EOPNOTSUPP; - - return i; -} - -static int p54u_start_ops(struct p54u_priv *priv) -{ - struct ieee80211_hw *dev = priv->common.hw; - int ret; - - ret = p54_parse_firmware(dev, priv->fw); - if (ret) - goto err_out; - - ret = p54_find_type(priv); - if (ret < 0) - goto err_out; - - if (priv->common.fw_interface != p54u_fwlist[ret].intf) { - dev_err(&priv->udev->dev, "wrong firmware, please get " - "a firmware for \"%s\" and try again.\n", - p54u_fwlist[ret].hw); - ret = -ENODEV; - goto err_out; - } - - ret = priv->upload_fw(dev); - if (ret) - goto err_out; - - ret = p54u_open(dev); - if (ret) - goto err_out; - - ret = p54_read_eeprom(dev); - if (ret) - goto err_stop; - - p54u_stop(dev); - - ret = p54_register_common(dev, &priv->udev->dev); - if (ret) - goto err_stop; - - return 0; - -err_stop: - p54u_stop(dev); - -err_out: - /* - * p54u_disconnect will do the rest of the - * cleanup - */ - return ret; -} - -static void p54u_load_firmware_cb(const struct firmware *firmware, - void *context) -{ - struct p54u_priv *priv = context; - struct usb_device *udev = priv->udev; - int err; - - complete(&priv->fw_wait_load); - if (firmware) { - priv->fw = firmware; - err = p54u_start_ops(priv); - } else { - err = -ENOENT; - dev_err(&udev->dev, "Firmware not found.\n"); - } - - if (err) { - struct device *parent = priv->udev->dev.parent; - - dev_err(&udev->dev, "failed to initialize device (%d)\n", err); - - if (parent) - device_lock(parent); - - device_release_driver(&udev->dev); - /* - * At this point p54u_disconnect has already freed - * the "priv" context. Do not use it anymore! - */ - priv = NULL; - - if (parent) - device_unlock(parent); - } - - usb_put_dev(udev); -} - -static int p54u_load_firmware(struct ieee80211_hw *dev, - struct usb_interface *intf) -{ - struct usb_device *udev = interface_to_usbdev(intf); - struct p54u_priv *priv = dev->priv; - struct device *device = &udev->dev; - int err, i; - - BUILD_BUG_ON(ARRAY_SIZE(p54u_fwlist) != __NUM_P54U_HWTYPES); - - init_completion(&priv->fw_wait_load); - i = p54_find_type(priv); - if (i < 0) - return i; - - dev_info(&priv->udev->dev, "Loading firmware file %s\n", - p54u_fwlist[i].fw); - - usb_get_dev(udev); - err = request_firmware_nowait(THIS_MODULE, 1, p54u_fwlist[i].fw, - device, GFP_KERNEL, priv, - p54u_load_firmware_cb); - if (err) { - dev_err(&priv->udev->dev, "(p54usb) cannot load firmware %s " - "(%d)!\n", p54u_fwlist[i].fw, err); - } - - return err; -} - -static int p54u_probe(struct usb_interface *intf, - const struct usb_device_id *id) -{ - struct usb_device *udev = interface_to_usbdev(intf); - struct ieee80211_hw *dev; - struct p54u_priv *priv; - int err; - unsigned int i, recognized_pipes; - - dev = p54_init_common(sizeof(*priv)); - - if (!dev) { - dev_err(&udev->dev, "(p54usb) ieee80211 alloc failed\n"); - return -ENOMEM; - } - - priv = dev->priv; - priv->hw_type = P54U_INVALID_HW; - - SET_IEEE80211_DEV(dev, &intf->dev); - usb_set_intfdata(intf, dev); - priv->udev = udev; - priv->intf = intf; - skb_queue_head_init(&priv->rx_queue); - init_usb_anchor(&priv->submitted); - - usb_get_dev(udev); - - /* really lazy and simple way of figuring out if we're a 3887 */ - /* TODO: should just stick the identification in the device table */ - i = intf->altsetting->desc.bNumEndpoints; - recognized_pipes = 0; - while (i--) { - switch (intf->altsetting->endpoint[i].desc.bEndpointAddress) { - case P54U_PIPE_DATA: - case P54U_PIPE_MGMT: - case P54U_PIPE_BRG: - case P54U_PIPE_DEV: - case P54U_PIPE_DATA | USB_DIR_IN: - case P54U_PIPE_MGMT | USB_DIR_IN: - case P54U_PIPE_BRG | USB_DIR_IN: - case P54U_PIPE_DEV | USB_DIR_IN: - case P54U_PIPE_INT | USB_DIR_IN: - recognized_pipes++; - } - } - priv->common.open = p54u_open; - priv->common.stop = p54u_stop; - if (recognized_pipes < P54U_PIPE_NUMBER) { -#ifdef CONFIG_PM - /* ISL3887 needs a full reset on resume */ - udev->reset_resume = 1; -#endif /* CONFIG_PM */ - err = p54u_device_reset(dev); - - priv->hw_type = P54U_3887; - dev->extra_tx_headroom += sizeof(struct lm87_tx_hdr); - priv->common.tx_hdr_len = sizeof(struct lm87_tx_hdr); - priv->common.tx = p54u_tx_lm87; - priv->upload_fw = p54u_upload_firmware_3887; - } else { - priv->hw_type = P54U_NET2280; - dev->extra_tx_headroom += sizeof(struct net2280_tx_hdr); - priv->common.tx_hdr_len = sizeof(struct net2280_tx_hdr); - priv->common.tx = p54u_tx_net2280; - priv->upload_fw = p54u_upload_firmware_net2280; - } - err = p54u_load_firmware(dev, intf); - return err; -} - -static void p54u_disconnect(struct usb_interface *intf) -{ - struct ieee80211_hw *dev = usb_get_intfdata(intf); - struct p54u_priv *priv; - - if (!dev) - return; - - priv = dev->priv; - wait_for_completion(&priv->fw_wait_load); - p54_unregister_common(dev); - - usb_put_dev(interface_to_usbdev(intf)); - release_firmware(priv->fw); - p54_free_common(dev); -} - -static int p54u_pre_reset(struct usb_interface *intf) -{ - struct ieee80211_hw *dev = usb_get_intfdata(intf); - - if (!dev) - return -ENODEV; - - p54u_stop(dev); - return 0; -} - -static int p54u_resume(struct usb_interface *intf) -{ - struct ieee80211_hw *dev = usb_get_intfdata(intf); - struct p54u_priv *priv; - - if (!dev) - return -ENODEV; - - priv = dev->priv; - if (unlikely(!(priv->upload_fw && priv->fw))) - return 0; - - return priv->upload_fw(dev); -} - -static int p54u_post_reset(struct usb_interface *intf) -{ - struct ieee80211_hw *dev = usb_get_intfdata(intf); - struct p54u_priv *priv; - int err; - - err = p54u_resume(intf); - if (err) - return err; - - /* reinitialize old device state */ - priv = dev->priv; - if (priv->common.mode != NL80211_IFTYPE_UNSPECIFIED) - ieee80211_restart_hw(dev); - - return 0; -} - -#ifdef CONFIG_PM - -static int p54u_suspend(struct usb_interface *intf, pm_message_t message) -{ - return p54u_pre_reset(intf); -} - -#endif /* CONFIG_PM */ - -static struct usb_driver p54u_driver = { - .name = "p54usb", - .id_table = p54u_table, - .probe = p54u_probe, - .disconnect = p54u_disconnect, - .pre_reset = p54u_pre_reset, - .post_reset = p54u_post_reset, -#ifdef CONFIG_PM - .suspend = p54u_suspend, - .resume = p54u_resume, - .reset_resume = p54u_resume, -#endif /* CONFIG_PM */ - .soft_unbind = 1, - .disable_hub_initiated_lpm = 1, -}; - -module_usb_driver(p54u_driver); diff --git a/drivers/net/wireless/p54/p54usb.h b/drivers/net/wireless/p54/p54usb.h deleted file mode 100644 index d273be7272b9..000000000000 --- a/drivers/net/wireless/p54/p54usb.h +++ /dev/null @@ -1,151 +0,0 @@ -#ifndef P54USB_H -#define P54USB_H - -/* - * Defines for USB based mac80211 Prism54 driver - * - * Copyright (c) 2006, Michael Wu - * - * Based on the islsm (softmac prism54) driver, which is: - * Copyright 2004-2006 Jean-Baptiste Note , et al. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -/* for isl3886 register definitions used on ver 1 devices */ -#include "p54pci.h" -#include "net2280.h" - -/* pci */ -#define NET2280_BASE 0x10000000 -#define NET2280_BASE2 0x20000000 - -/* gpio */ -#define P54U_BRG_POWER_UP (1 << GPIO0_DATA) -#define P54U_BRG_POWER_DOWN (1 << GPIO1_DATA) - -/* devinit */ -#define NET2280_CLK_4Mhz (15 << LOCAL_CLOCK_FREQUENCY) -#define NET2280_CLK_30Mhz (2 << LOCAL_CLOCK_FREQUENCY) -#define NET2280_CLK_60Mhz (1 << LOCAL_CLOCK_FREQUENCY) -#define NET2280_CLK_STOP (0 << LOCAL_CLOCK_FREQUENCY) -#define NET2280_PCI_ENABLE (1 << PCI_ENABLE) -#define NET2280_PCI_SOFT_RESET (1 << PCI_SOFT_RESET) - -/* endpoints */ -#define NET2280_CLEAR_NAK_OUT_PACKETS_MODE (1 << CLEAR_NAK_OUT_PACKETS_MODE) -#define NET2280_FIFO_FLUSH (1 << FIFO_FLUSH) - -/* irq */ -#define NET2280_USB_INTERRUPT_ENABLE (1 << USB_INTERRUPT_ENABLE) -#define NET2280_PCI_INTA_INTERRUPT (1 << PCI_INTA_INTERRUPT) -#define NET2280_PCI_INTA_INTERRUPT_ENABLE (1 << PCI_INTA_INTERRUPT_ENABLE) - -/* registers */ -#define NET2280_DEVINIT 0x00 -#define NET2280_USBIRQENB1 0x24 -#define NET2280_IRQSTAT1 0x2c -#define NET2280_FIFOCTL 0x38 -#define NET2280_GPIOCTL 0x50 -#define NET2280_RELNUM 0x88 -#define NET2280_EPA_RSP 0x324 -#define NET2280_EPA_STAT 0x32c -#define NET2280_EPB_STAT 0x34c -#define NET2280_EPC_RSP 0x364 -#define NET2280_EPC_STAT 0x36c -#define NET2280_EPD_STAT 0x38c - -#define NET2280_EPA_CFG 0x320 -#define NET2280_EPB_CFG 0x340 -#define NET2280_EPC_CFG 0x360 -#define NET2280_EPD_CFG 0x380 -#define NET2280_EPE_CFG 0x3A0 -#define NET2280_EPF_CFG 0x3C0 -#define P54U_DEV_BASE 0x40000000 - -struct net2280_tx_hdr { - __le32 device_addr; - __le16 len; - __le16 follower; /* ? */ - u8 padding[8]; -} __packed; - -struct lm87_tx_hdr { - __le32 device_addr; - __le32 chksum; -} __packed; - -/* Some flags for the isl hardware registers controlling DMA inside the - * chip */ -#define ISL38XX_DMA_STATUS_DONE 0x00000001 -#define ISL38XX_DMA_STATUS_READY 0x00000002 -#define NET2280_EPA_FIFO_PCI_ADDR 0x20000000 -#define ISL38XX_DMA_MASTER_CONTROL_TRIGGER 0x00000004 - -enum net2280_op_type { - NET2280_BRG_U32 = 0x001F, - NET2280_BRG_CFG_U32 = 0x000F, - NET2280_BRG_CFG_U16 = 0x0003, - NET2280_DEV_U32 = 0x080F, - NET2280_DEV_CFG_U32 = 0x088F, - NET2280_DEV_CFG_U16 = 0x0883 -}; - -#define P54U_FW_BLOCK 2048 - -#define X2_SIGNATURE "x2 " -#define X2_SIGNATURE_SIZE 4 - -struct x2_header { - u8 signature[X2_SIGNATURE_SIZE]; - __le32 fw_load_addr; - __le32 fw_length; - __le32 crc; -} __packed; - -/* pipes 3 and 4 are not used by the driver */ -#define P54U_PIPE_NUMBER 9 - -enum p54u_pipe_addr { - P54U_PIPE_DATA = 0x01, - P54U_PIPE_MGMT = 0x02, - P54U_PIPE_3 = 0x03, - P54U_PIPE_4 = 0x04, - P54U_PIPE_BRG = 0x0d, - P54U_PIPE_DEV = 0x0e, - P54U_PIPE_INT = 0x0f -}; - -struct p54u_rx_info { - struct urb *urb; - struct ieee80211_hw *dev; -}; - -enum p54u_hw_type { - P54U_INVALID_HW, - P54U_NET2280, - P54U_3887, - - /* keep last */ - __NUM_P54U_HWTYPES, -}; - -struct p54u_priv { - struct p54_common common; - struct usb_device *udev; - struct usb_interface *intf; - int (*upload_fw)(struct ieee80211_hw *dev); - - enum p54u_hw_type hw_type; - spinlock_t lock; - struct sk_buff_head rx_queue; - struct usb_anchor submitted; - const struct firmware *fw; - - /* asynchronous firmware callback */ - struct completion fw_wait_load; -}; - -#endif /* P54USB_H */ diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c deleted file mode 100644 index f95de0d16216..000000000000 --- a/drivers/net/wireless/p54/txrx.c +++ /dev/null @@ -1,941 +0,0 @@ -/* - * Common code for mac80211 Prism54 drivers - * - * Copyright (c) 2006, Michael Wu - * Copyright (c) 2007-2009, Christian Lamparter - * Copyright 2008, Johannes Berg - * - * Based on: - * - the islsm (softmac prism54) driver, which is: - * Copyright 2004-2006 Jean-Baptiste Note , et al. - * - stlc45xx driver - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include - -#include - -#include "p54.h" -#include "lmac.h" - -#ifdef P54_MM_DEBUG -static void p54_dump_tx_queue(struct p54_common *priv) -{ - unsigned long flags; - struct ieee80211_tx_info *info; - struct p54_tx_info *range; - struct sk_buff *skb; - struct p54_hdr *hdr; - unsigned int i = 0; - u32 prev_addr; - u32 largest_hole = 0, free; - - spin_lock_irqsave(&priv->tx_queue.lock, flags); - wiphy_debug(priv->hw->wiphy, "/ --- tx queue dump (%d entries) ---\n", - skb_queue_len(&priv->tx_queue)); - - prev_addr = priv->rx_start; - skb_queue_walk(&priv->tx_queue, skb) { - info = IEEE80211_SKB_CB(skb); - range = (void *) info->rate_driver_data; - hdr = (void *) skb->data; - - free = range->start_addr - prev_addr; - wiphy_debug(priv->hw->wiphy, - "| [%02d] => [skb:%p skb_len:0x%04x " - "hdr:{flags:%02x len:%04x req_id:%04x type:%02x} " - "mem:{start:%04x end:%04x, free:%d}]\n", - i++, skb, skb->len, - le16_to_cpu(hdr->flags), le16_to_cpu(hdr->len), - le32_to_cpu(hdr->req_id), le16_to_cpu(hdr->type), - range->start_addr, range->end_addr, free); - - prev_addr = range->end_addr; - largest_hole = max(largest_hole, free); - } - free = priv->rx_end - prev_addr; - largest_hole = max(largest_hole, free); - wiphy_debug(priv->hw->wiphy, - "\\ --- [free: %d], largest free block: %d ---\n", - free, largest_hole); - spin_unlock_irqrestore(&priv->tx_queue.lock, flags); -} -#endif /* P54_MM_DEBUG */ - -/* - * So, the firmware is somewhat stupid and doesn't know what places in its - * memory incoming data should go to. By poking around in the firmware, we - * can find some unused memory to upload our packets to. However, data that we - * want the card to TX needs to stay intact until the card has told us that - * it is done with it. This function finds empty places we can upload to and - * marks allocated areas as reserved if necessary. p54_find_and_unlink_skb or - * p54_free_skb frees allocated areas. - */ -static int p54_assign_address(struct p54_common *priv, struct sk_buff *skb) -{ - struct sk_buff *entry, *target_skb = NULL; - struct ieee80211_tx_info *info; - struct p54_tx_info *range; - struct p54_hdr *data = (void *) skb->data; - unsigned long flags; - u32 last_addr = priv->rx_start; - u32 target_addr = priv->rx_start; - u16 len = priv->headroom + skb->len + priv->tailroom + 3; - - info = IEEE80211_SKB_CB(skb); - range = (void *) info->rate_driver_data; - len = (range->extra_len + len) & ~0x3; - - spin_lock_irqsave(&priv->tx_queue.lock, flags); - if (unlikely(skb_queue_len(&priv->tx_queue) == 32)) { - /* - * The tx_queue is now really full. - * - * TODO: check if the device has crashed and reset it. - */ - spin_unlock_irqrestore(&priv->tx_queue.lock, flags); - return -EBUSY; - } - - skb_queue_walk(&priv->tx_queue, entry) { - u32 hole_size; - info = IEEE80211_SKB_CB(entry); - range = (void *) info->rate_driver_data; - hole_size = range->start_addr - last_addr; - - if (!target_skb && hole_size >= len) { - target_skb = entry->prev; - hole_size -= len; - target_addr = last_addr; - break; - } - last_addr = range->end_addr; - } - if (unlikely(!target_skb)) { - if (priv->rx_end - last_addr >= len) { - target_skb = priv->tx_queue.prev; - if (!skb_queue_empty(&priv->tx_queue)) { - info = IEEE80211_SKB_CB(target_skb); - range = (void *)info->rate_driver_data; - target_addr = range->end_addr; - } - } else { - spin_unlock_irqrestore(&priv->tx_queue.lock, flags); - return -ENOSPC; - } - } - - info = IEEE80211_SKB_CB(skb); - range = (void *) info->rate_driver_data; - range->start_addr = target_addr; - range->end_addr = target_addr + len; - data->req_id = cpu_to_le32(target_addr + priv->headroom); - if (IS_DATA_FRAME(skb) && - unlikely(GET_HW_QUEUE(skb) == P54_QUEUE_BEACON)) - priv->beacon_req_id = data->req_id; - - __skb_queue_after(&priv->tx_queue, target_skb, skb); - spin_unlock_irqrestore(&priv->tx_queue.lock, flags); - return 0; -} - -static void p54_tx_pending(struct p54_common *priv) -{ - struct sk_buff *skb; - int ret; - - skb = skb_dequeue(&priv->tx_pending); - if (unlikely(!skb)) - return ; - - ret = p54_assign_address(priv, skb); - if (unlikely(ret)) - skb_queue_head(&priv->tx_pending, skb); - else - priv->tx(priv->hw, skb); -} - -static void p54_wake_queues(struct p54_common *priv) -{ - unsigned long flags; - unsigned int i; - - if (unlikely(priv->mode == NL80211_IFTYPE_UNSPECIFIED)) - return ; - - p54_tx_pending(priv); - - spin_lock_irqsave(&priv->tx_stats_lock, flags); - for (i = 0; i < priv->hw->queues; i++) { - if (priv->tx_stats[i + P54_QUEUE_DATA].len < - priv->tx_stats[i + P54_QUEUE_DATA].limit) - ieee80211_wake_queue(priv->hw, i); - } - spin_unlock_irqrestore(&priv->tx_stats_lock, flags); -} - -static int p54_tx_qos_accounting_alloc(struct p54_common *priv, - struct sk_buff *skb, - const u16 p54_queue) -{ - struct p54_tx_queue_stats *queue; - unsigned long flags; - - if (WARN_ON(p54_queue >= P54_QUEUE_NUM)) - return -EINVAL; - - queue = &priv->tx_stats[p54_queue]; - - spin_lock_irqsave(&priv->tx_stats_lock, flags); - if (unlikely(queue->len >= queue->limit && IS_QOS_QUEUE(p54_queue))) { - spin_unlock_irqrestore(&priv->tx_stats_lock, flags); - return -ENOSPC; - } - - queue->len++; - queue->count++; - - if (unlikely(queue->len == queue->limit && IS_QOS_QUEUE(p54_queue))) { - u16 ac_queue = p54_queue - P54_QUEUE_DATA; - ieee80211_stop_queue(priv->hw, ac_queue); - } - - spin_unlock_irqrestore(&priv->tx_stats_lock, flags); - return 0; -} - -static void p54_tx_qos_accounting_free(struct p54_common *priv, - struct sk_buff *skb) -{ - if (IS_DATA_FRAME(skb)) { - unsigned long flags; - - spin_lock_irqsave(&priv->tx_stats_lock, flags); - priv->tx_stats[GET_HW_QUEUE(skb)].len--; - spin_unlock_irqrestore(&priv->tx_stats_lock, flags); - - if (unlikely(GET_HW_QUEUE(skb) == P54_QUEUE_BEACON)) { - if (priv->beacon_req_id == GET_REQ_ID(skb)) { - /* this is the active beacon set anymore */ - priv->beacon_req_id = 0; - } - complete(&priv->beacon_comp); - } - } - p54_wake_queues(priv); -} - -void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb) -{ - struct p54_common *priv = dev->priv; - if (unlikely(!skb)) - return ; - - skb_unlink(skb, &priv->tx_queue); - p54_tx_qos_accounting_free(priv, skb); - ieee80211_free_txskb(dev, skb); -} -EXPORT_SYMBOL_GPL(p54_free_skb); - -static struct sk_buff *p54_find_and_unlink_skb(struct p54_common *priv, - const __le32 req_id) -{ - struct sk_buff *entry; - unsigned long flags; - - spin_lock_irqsave(&priv->tx_queue.lock, flags); - skb_queue_walk(&priv->tx_queue, entry) { - struct p54_hdr *hdr = (struct p54_hdr *) entry->data; - - if (hdr->req_id == req_id) { - __skb_unlink(entry, &priv->tx_queue); - spin_unlock_irqrestore(&priv->tx_queue.lock, flags); - p54_tx_qos_accounting_free(priv, entry); - return entry; - } - } - spin_unlock_irqrestore(&priv->tx_queue.lock, flags); - return NULL; -} - -void p54_tx(struct p54_common *priv, struct sk_buff *skb) -{ - skb_queue_tail(&priv->tx_pending, skb); - p54_tx_pending(priv); -} - -static int p54_rssi_to_dbm(struct p54_common *priv, int rssi) -{ - if (priv->rxhw != 5) { - return ((rssi * priv->cur_rssi->mul) / 64 + - priv->cur_rssi->add) / 4; - } else { - /* - * TODO: find the correct formula - */ - return rssi / 2 - 110; - } -} - -/* - * Even if the firmware is capable of dealing with incoming traffic, - * while dozing, we have to prepared in case mac80211 uses PS-POLL - * to retrieve outstanding frames from our AP. - * (see comment in net/mac80211/mlme.c @ line 1993) - */ -static void p54_pspoll_workaround(struct p54_common *priv, struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (void *) skb->data; - struct ieee80211_tim_ie *tim_ie; - u8 *tim; - u8 tim_len; - bool new_psm; - - /* only beacons have a TIM IE */ - if (!ieee80211_is_beacon(hdr->frame_control)) - return; - - if (!priv->aid) - return; - - /* only consider beacons from the associated BSSID */ - if (!ether_addr_equal(hdr->addr3, priv->bssid)) - return; - - tim = p54_find_ie(skb, WLAN_EID_TIM); - if (!tim) - return; - - tim_len = tim[1]; - tim_ie = (struct ieee80211_tim_ie *) &tim[2]; - - new_psm = ieee80211_check_tim(tim_ie, tim_len, priv->aid); - if (new_psm != priv->powersave_override) { - priv->powersave_override = new_psm; - p54_set_ps(priv); - } -} - -static int p54_rx_data(struct p54_common *priv, struct sk_buff *skb) -{ - struct p54_rx_data *hdr = (struct p54_rx_data *) skb->data; - struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); - u16 freq = le16_to_cpu(hdr->freq); - size_t header_len = sizeof(*hdr); - u32 tsf32; - u8 rate = hdr->rate & 0xf; - - /* - * If the device is in a unspecified state we have to - * ignore all data frames. Else we could end up with a - * nasty crash. - */ - if (unlikely(priv->mode == NL80211_IFTYPE_UNSPECIFIED)) - return 0; - - if (!(hdr->flags & cpu_to_le16(P54_HDR_FLAG_DATA_IN_FCS_GOOD))) - return 0; - - if (hdr->decrypt_status == P54_DECRYPT_OK) - rx_status->flag |= RX_FLAG_DECRYPTED; - if ((hdr->decrypt_status == P54_DECRYPT_FAIL_MICHAEL) || - (hdr->decrypt_status == P54_DECRYPT_FAIL_TKIP)) - rx_status->flag |= RX_FLAG_MMIC_ERROR; - - rx_status->signal = p54_rssi_to_dbm(priv, hdr->rssi); - if (hdr->rate & 0x10) - rx_status->flag |= RX_FLAG_SHORTPRE; - if (priv->hw->conf.chandef.chan->band == IEEE80211_BAND_5GHZ) - rx_status->rate_idx = (rate < 4) ? 0 : rate - 4; - else - rx_status->rate_idx = rate; - - rx_status->freq = freq; - rx_status->band = priv->hw->conf.chandef.chan->band; - rx_status->antenna = hdr->antenna; - - tsf32 = le32_to_cpu(hdr->tsf32); - if (tsf32 < priv->tsf_low32) - priv->tsf_high32++; - rx_status->mactime = ((u64)priv->tsf_high32) << 32 | tsf32; - priv->tsf_low32 = tsf32; - - /* LMAC API Page 10/29 - s_lm_data_in - clock - * "usec accurate timestamp of hardware clock - * at end of frame (before OFDM SIFS EOF padding" - */ - rx_status->flag |= RX_FLAG_MACTIME_END; - - if (hdr->flags & cpu_to_le16(P54_HDR_FLAG_DATA_ALIGN)) - header_len += hdr->align[0]; - - skb_pull(skb, header_len); - skb_trim(skb, le16_to_cpu(hdr->len)); - if (unlikely(priv->hw->conf.flags & IEEE80211_CONF_PS)) - p54_pspoll_workaround(priv, skb); - - ieee80211_rx_irqsafe(priv->hw, skb); - - ieee80211_queue_delayed_work(priv->hw, &priv->work, - msecs_to_jiffies(P54_STATISTICS_UPDATE)); - - return -1; -} - -static void p54_rx_frame_sent(struct p54_common *priv, struct sk_buff *skb) -{ - struct p54_hdr *hdr = (struct p54_hdr *) skb->data; - struct p54_frame_sent *payload = (struct p54_frame_sent *) hdr->data; - struct ieee80211_tx_info *info; - struct p54_hdr *entry_hdr; - struct p54_tx_data *entry_data; - struct sk_buff *entry; - unsigned int pad = 0, frame_len; - int count, idx; - - entry = p54_find_and_unlink_skb(priv, hdr->req_id); - if (unlikely(!entry)) - return ; - - frame_len = entry->len; - info = IEEE80211_SKB_CB(entry); - entry_hdr = (struct p54_hdr *) entry->data; - entry_data = (struct p54_tx_data *) entry_hdr->data; - priv->stats.dot11ACKFailureCount += payload->tries - 1; - - /* - * Frames in P54_QUEUE_FWSCAN and P54_QUEUE_BEACON are - * generated by the driver. Therefore tx_status is bogus - * and we don't want to confuse the mac80211 stack. - */ - if (unlikely(entry_data->hw_queue < P54_QUEUE_FWSCAN)) { - dev_kfree_skb_any(entry); - return ; - } - - /* - * Clear manually, ieee80211_tx_info_clear_status would - * clear the counts too and we need them. - */ - memset(&info->status.ack_signal, 0, - sizeof(struct ieee80211_tx_info) - - offsetof(struct ieee80211_tx_info, status.ack_signal)); - BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, - status.ack_signal) != 20); - - if (entry_hdr->flags & cpu_to_le16(P54_HDR_FLAG_DATA_ALIGN)) - pad = entry_data->align[0]; - - /* walk through the rates array and adjust the counts */ - count = payload->tries; - for (idx = 0; idx < 4; idx++) { - if (count >= info->status.rates[idx].count) { - count -= info->status.rates[idx].count; - } else if (count > 0) { - info->status.rates[idx].count = count; - count = 0; - } else { - info->status.rates[idx].idx = -1; - info->status.rates[idx].count = 0; - } - } - - if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) && - !(payload->status & P54_TX_FAILED)) - info->flags |= IEEE80211_TX_STAT_ACK; - if (payload->status & P54_TX_PSM_CANCELLED) - info->flags |= IEEE80211_TX_STAT_TX_FILTERED; - info->status.ack_signal = p54_rssi_to_dbm(priv, - (int)payload->ack_rssi); - - /* Undo all changes to the frame. */ - switch (entry_data->key_type) { - case P54_CRYPTO_TKIPMICHAEL: { - u8 *iv = (u8 *)(entry_data->align + pad + - entry_data->crypt_offset); - - /* Restore the original TKIP IV. */ - iv[2] = iv[0]; - iv[0] = iv[1]; - iv[1] = (iv[0] | 0x20) & 0x7f; /* WEPSeed - 8.3.2.2 */ - - frame_len -= 12; /* remove TKIP_MMIC + TKIP_ICV */ - break; - } - case P54_CRYPTO_AESCCMP: - frame_len -= 8; /* remove CCMP_MIC */ - break; - case P54_CRYPTO_WEP: - frame_len -= 4; /* remove WEP_ICV */ - break; - } - - skb_trim(entry, frame_len); - skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); - ieee80211_tx_status_irqsafe(priv->hw, entry); -} - -static void p54_rx_eeprom_readback(struct p54_common *priv, - struct sk_buff *skb) -{ - struct p54_hdr *hdr = (struct p54_hdr *) skb->data; - struct p54_eeprom_lm86 *eeprom = (struct p54_eeprom_lm86 *) hdr->data; - struct sk_buff *tmp; - - if (!priv->eeprom) - return ; - - if (priv->fw_var >= 0x509) { - memcpy(priv->eeprom, eeprom->v2.data, - le16_to_cpu(eeprom->v2.len)); - } else { - memcpy(priv->eeprom, eeprom->v1.data, - le16_to_cpu(eeprom->v1.len)); - } - - priv->eeprom = NULL; - tmp = p54_find_and_unlink_skb(priv, hdr->req_id); - dev_kfree_skb_any(tmp); - complete(&priv->eeprom_comp); -} - -static void p54_rx_stats(struct p54_common *priv, struct sk_buff *skb) -{ - struct p54_hdr *hdr = (struct p54_hdr *) skb->data; - struct p54_statistics *stats = (struct p54_statistics *) hdr->data; - struct sk_buff *tmp; - struct ieee80211_channel *chan; - unsigned int i, rssi, tx, cca, dtime, dtotal, dcca, dtx, drssi, unit; - u32 tsf32; - - if (unlikely(priv->mode == NL80211_IFTYPE_UNSPECIFIED)) - return ; - - tsf32 = le32_to_cpu(stats->tsf32); - if (tsf32 < priv->tsf_low32) - priv->tsf_high32++; - priv->tsf_low32 = tsf32; - - priv->stats.dot11RTSFailureCount = le32_to_cpu(stats->rts_fail); - priv->stats.dot11RTSSuccessCount = le32_to_cpu(stats->rts_success); - priv->stats.dot11FCSErrorCount = le32_to_cpu(stats->rx_bad_fcs); - - priv->noise = p54_rssi_to_dbm(priv, le32_to_cpu(stats->noise)); - - /* - * STSW450X LMAC API page 26 - 3.8 Statistics - * "The exact measurement period can be derived from the - * timestamp member". - */ - dtime = tsf32 - priv->survey_raw.timestamp; - - /* - * STSW450X LMAC API page 26 - 3.8.1 Noise histogram - * The LMAC samples RSSI, CCA and transmit state at regular - * periods (typically 8 times per 1k [as in 1024] usec). - */ - cca = le32_to_cpu(stats->sample_cca); - tx = le32_to_cpu(stats->sample_tx); - rssi = 0; - for (i = 0; i < ARRAY_SIZE(stats->sample_noise); i++) - rssi += le32_to_cpu(stats->sample_noise[i]); - - dcca = cca - priv->survey_raw.cached_cca; - drssi = rssi - priv->survey_raw.cached_rssi; - dtx = tx - priv->survey_raw.cached_tx; - dtotal = dcca + drssi + dtx; - - /* - * update statistics when more than a second is over since the - * last call, or when a update is badly needed. - */ - if (dtotal && (priv->update_stats || dtime >= USEC_PER_SEC) && - dtime >= dtotal) { - priv->survey_raw.timestamp = tsf32; - priv->update_stats = false; - unit = dtime / dtotal; - - if (dcca) { - priv->survey_raw.cca += dcca * unit; - priv->survey_raw.cached_cca = cca; - } - if (dtx) { - priv->survey_raw.tx += dtx * unit; - priv->survey_raw.cached_tx = tx; - } - if (drssi) { - priv->survey_raw.rssi += drssi * unit; - priv->survey_raw.cached_rssi = rssi; - } - - /* 1024 usec / 8 times = 128 usec / time */ - if (!(priv->phy_ps || priv->phy_idle)) - priv->survey_raw.active += dtotal * unit; - else - priv->survey_raw.active += (dcca + dtx) * unit; - } - - chan = priv->curchan; - if (chan) { - struct survey_info *survey = &priv->survey[chan->hw_value]; - survey->noise = clamp_t(s8, priv->noise, -128, 127); - survey->channel_time = priv->survey_raw.active; - survey->channel_time_tx = priv->survey_raw.tx; - survey->channel_time_busy = priv->survey_raw.tx + - priv->survey_raw.cca; - do_div(survey->channel_time, 1024); - do_div(survey->channel_time_tx, 1024); - do_div(survey->channel_time_busy, 1024); - } - - tmp = p54_find_and_unlink_skb(priv, hdr->req_id); - dev_kfree_skb_any(tmp); - complete(&priv->stat_comp); -} - -static void p54_rx_trap(struct p54_common *priv, struct sk_buff *skb) -{ - struct p54_hdr *hdr = (struct p54_hdr *) skb->data; - struct p54_trap *trap = (struct p54_trap *) hdr->data; - u16 event = le16_to_cpu(trap->event); - u16 freq = le16_to_cpu(trap->frequency); - - switch (event) { - case P54_TRAP_BEACON_TX: - break; - case P54_TRAP_RADAR: - wiphy_info(priv->hw->wiphy, "radar (freq:%d MHz)\n", freq); - break; - case P54_TRAP_NO_BEACON: - if (priv->vif) - ieee80211_beacon_loss(priv->vif); - break; - case P54_TRAP_SCAN: - break; - case P54_TRAP_TBTT: - break; - case P54_TRAP_TIMER: - break; - case P54_TRAP_FAA_RADIO_OFF: - wiphy_rfkill_set_hw_state(priv->hw->wiphy, true); - break; - case P54_TRAP_FAA_RADIO_ON: - wiphy_rfkill_set_hw_state(priv->hw->wiphy, false); - break; - default: - wiphy_info(priv->hw->wiphy, "received event:%x freq:%d\n", - event, freq); - break; - } -} - -static int p54_rx_control(struct p54_common *priv, struct sk_buff *skb) -{ - struct p54_hdr *hdr = (struct p54_hdr *) skb->data; - - switch (le16_to_cpu(hdr->type)) { - case P54_CONTROL_TYPE_TXDONE: - p54_rx_frame_sent(priv, skb); - break; - case P54_CONTROL_TYPE_TRAP: - p54_rx_trap(priv, skb); - break; - case P54_CONTROL_TYPE_BBP: - break; - case P54_CONTROL_TYPE_STAT_READBACK: - p54_rx_stats(priv, skb); - break; - case P54_CONTROL_TYPE_EEPROM_READBACK: - p54_rx_eeprom_readback(priv, skb); - break; - default: - wiphy_debug(priv->hw->wiphy, - "not handling 0x%02x type control frame\n", - le16_to_cpu(hdr->type)); - break; - } - return 0; -} - -/* returns zero if skb can be reused */ -int p54_rx(struct ieee80211_hw *dev, struct sk_buff *skb) -{ - struct p54_common *priv = dev->priv; - u16 type = le16_to_cpu(*((__le16 *)skb->data)); - - if (type & P54_HDR_FLAG_CONTROL) - return p54_rx_control(priv, skb); - else - return p54_rx_data(priv, skb); -} -EXPORT_SYMBOL_GPL(p54_rx); - -static void p54_tx_80211_header(struct p54_common *priv, struct sk_buff *skb, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - u8 *queue, u32 *extra_len, u16 *flags, u16 *aid, - bool *burst_possible) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - - if (ieee80211_is_data_qos(hdr->frame_control)) - *burst_possible = true; - else - *burst_possible = false; - - if (!(info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)) - *flags |= P54_HDR_FLAG_DATA_OUT_SEQNR; - - if (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER) - *flags |= P54_HDR_FLAG_DATA_OUT_NOCANCEL; - - if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT) - *flags |= P54_HDR_FLAG_DATA_OUT_NOCANCEL; - - *queue = skb_get_queue_mapping(skb) + P54_QUEUE_DATA; - - switch (priv->mode) { - case NL80211_IFTYPE_MONITOR: - /* - * We have to set P54_HDR_FLAG_DATA_OUT_PROMISC for - * every frame in promiscuous/monitor mode. - * see STSW45x0C LMAC API - page 12. - */ - *aid = 0; - *flags |= P54_HDR_FLAG_DATA_OUT_PROMISC; - break; - case NL80211_IFTYPE_STATION: - *aid = 1; - break; - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_MESH_POINT: - if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { - *aid = 0; - *queue = P54_QUEUE_CAB; - return; - } - - if (unlikely(ieee80211_is_mgmt(hdr->frame_control))) { - if (ieee80211_is_probe_resp(hdr->frame_control)) { - *aid = 0; - *flags |= P54_HDR_FLAG_DATA_OUT_TIMESTAMP | - P54_HDR_FLAG_DATA_OUT_NOCANCEL; - return; - } else if (ieee80211_is_beacon(hdr->frame_control)) { - *aid = 0; - - if (info->flags & IEEE80211_TX_CTL_INJECTED) { - /* - * Injecting beacons on top of a AP is - * not a good idea... nevertheless, - * it should be doable. - */ - - return; - } - - *flags |= P54_HDR_FLAG_DATA_OUT_TIMESTAMP; - *queue = P54_QUEUE_BEACON; - *extra_len = IEEE80211_MAX_TIM_LEN; - return; - } - } - - if (sta) - *aid = sta->aid; - break; - } -} - -static u8 p54_convert_algo(u32 cipher) -{ - switch (cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - return P54_CRYPTO_WEP; - case WLAN_CIPHER_SUITE_TKIP: - return P54_CRYPTO_TKIPMICHAEL; - case WLAN_CIPHER_SUITE_CCMP: - return P54_CRYPTO_AESCCMP; - default: - return 0; - } -} - -void p54_tx_80211(struct ieee80211_hw *dev, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct p54_common *priv = dev->priv; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct p54_tx_info *p54info; - struct p54_hdr *hdr; - struct p54_tx_data *txhdr; - unsigned int padding, len, extra_len = 0; - int i, j, ridx; - u16 hdr_flags = 0, aid = 0; - u8 rate, queue = 0, crypt_offset = 0; - u8 cts_rate = 0x20; - u8 rc_flags; - u8 calculated_tries[4]; - u8 nrates = 0, nremaining = 8; - bool burst_allowed = false; - - p54_tx_80211_header(priv, skb, info, control->sta, &queue, &extra_len, - &hdr_flags, &aid, &burst_allowed); - - if (p54_tx_qos_accounting_alloc(priv, skb, queue)) { - ieee80211_free_txskb(dev, skb); - return; - } - - padding = (unsigned long)(skb->data - (sizeof(*hdr) + sizeof(*txhdr))) & 3; - len = skb->len; - - if (info->control.hw_key) { - crypt_offset = ieee80211_get_hdrlen_from_skb(skb); - if (info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) { - u8 *iv = (u8 *)(skb->data + crypt_offset); - /* - * The firmware excepts that the IV has to have - * this special format - */ - iv[1] = iv[0]; - iv[0] = iv[2]; - iv[2] = 0; - } - } - - txhdr = (struct p54_tx_data *) skb_push(skb, sizeof(*txhdr) + padding); - hdr = (struct p54_hdr *) skb_push(skb, sizeof(*hdr)); - - if (padding) - hdr_flags |= P54_HDR_FLAG_DATA_ALIGN; - hdr->type = cpu_to_le16(aid); - hdr->rts_tries = info->control.rates[0].count; - - /* - * we register the rates in perfect order, and - * RTS/CTS won't happen on 5 GHz - */ - cts_rate = info->control.rts_cts_rate_idx; - - memset(&txhdr->rateset, 0, sizeof(txhdr->rateset)); - - /* see how many rates got used */ - for (i = 0; i < dev->max_rates; i++) { - if (info->control.rates[i].idx < 0) - break; - nrates++; - } - - /* limit tries to 8/nrates per rate */ - for (i = 0; i < nrates; i++) { - /* - * The magic expression here is equivalent to 8/nrates for - * all values that matter, but avoids division and jumps. - * Note that nrates can only take the values 1 through 4. - */ - calculated_tries[i] = min_t(int, ((15 >> nrates) | 1) + 1, - info->control.rates[i].count); - nremaining -= calculated_tries[i]; - } - - /* if there are tries left, distribute from back to front */ - for (i = nrates - 1; nremaining > 0 && i >= 0; i--) { - int tmp = info->control.rates[i].count - calculated_tries[i]; - - if (tmp <= 0) - continue; - /* RC requested more tries at this rate */ - - tmp = min_t(int, tmp, nremaining); - calculated_tries[i] += tmp; - nremaining -= tmp; - } - - ridx = 0; - for (i = 0; i < nrates && ridx < 8; i++) { - /* we register the rates in perfect order */ - rate = info->control.rates[i].idx; - if (info->band == IEEE80211_BAND_5GHZ) - rate += 4; - - /* store the count we actually calculated for TX status */ - info->control.rates[i].count = calculated_tries[i]; - - rc_flags = info->control.rates[i].flags; - if (rc_flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) { - rate |= 0x10; - cts_rate |= 0x10; - } - if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) { - burst_allowed = false; - rate |= 0x40; - } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { - rate |= 0x20; - burst_allowed = false; - } - for (j = 0; j < calculated_tries[i] && ridx < 8; j++) { - txhdr->rateset[ridx] = rate; - ridx++; - } - } - - if (burst_allowed) - hdr_flags |= P54_HDR_FLAG_DATA_OUT_BURST; - - /* TODO: enable bursting */ - hdr->flags = cpu_to_le16(hdr_flags); - hdr->tries = ridx; - txhdr->rts_rate_idx = 0; - if (info->control.hw_key) { - txhdr->key_type = p54_convert_algo(info->control.hw_key->cipher); - txhdr->key_len = min((u8)16, info->control.hw_key->keylen); - memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len); - if (info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) { - /* reserve space for the MIC key */ - len += 8; - memcpy(skb_put(skb, 8), &(info->control.hw_key->key - [NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY]), 8); - } - /* reserve some space for ICV */ - len += info->control.hw_key->icv_len; - memset(skb_put(skb, info->control.hw_key->icv_len), 0, - info->control.hw_key->icv_len); - } else { - txhdr->key_type = 0; - txhdr->key_len = 0; - } - txhdr->crypt_offset = crypt_offset; - txhdr->hw_queue = queue; - txhdr->backlog = priv->tx_stats[queue].len - 1; - memset(txhdr->durations, 0, sizeof(txhdr->durations)); - txhdr->tx_antenna = 2 & priv->tx_diversity_mask; - if (priv->rxhw == 5) { - txhdr->longbow.cts_rate = cts_rate; - txhdr->longbow.output_power = cpu_to_le16(priv->output_power); - } else { - txhdr->normal.output_power = priv->output_power; - txhdr->normal.cts_rate = cts_rate; - } - if (padding) - txhdr->align[0] = padding; - - hdr->len = cpu_to_le16(len); - /* modifies skb->cb and with it info, so must be last! */ - p54info = (void *) info->rate_driver_data; - p54info->extra_len = extra_len; - - p54_tx(priv, skb); -} diff --git a/drivers/net/wireless/prism54/Makefile b/drivers/net/wireless/prism54/Makefile deleted file mode 100644 index fad305c76737..000000000000 --- a/drivers/net/wireless/prism54/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $Id: Makefile.k26,v 1.7 2004/01/30 16:24:00 ajfa Exp $ - -prism54-objs := islpci_eth.o islpci_mgt.o \ - isl_38xx.o isl_ioctl.o islpci_dev.o \ - islpci_hotplug.o oid_mgt.o - -obj-$(CONFIG_PRISM54) += prism54.o - diff --git a/drivers/net/wireless/prism54/isl_38xx.c b/drivers/net/wireless/prism54/isl_38xx.c deleted file mode 100644 index 02fc67bccbd0..000000000000 --- a/drivers/net/wireless/prism54/isl_38xx.c +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (C) 2002 Intersil Americas Inc. - * Copyright (C) 2003-2004 Luis R. Rodriguez _ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include - -#include -#include - -#include "prismcompat.h" -#include "isl_38xx.h" -#include "islpci_dev.h" -#include "islpci_mgt.h" - -/****************************************************************************** - Device Interface & Control functions -******************************************************************************/ - -/** - * isl38xx_disable_interrupts - disable all interrupts - * @device: pci memory base address - * - * Instructs the device to disable all interrupt reporting by asserting - * the IRQ line. New events may still show up in the interrupt identification - * register located at offset %ISL38XX_INT_IDENT_REG. - */ -void -isl38xx_disable_interrupts(void __iomem *device) -{ - isl38xx_w32_flush(device, 0x00000000, ISL38XX_INT_EN_REG); - udelay(ISL38XX_WRITEIO_DELAY); -} - -void -isl38xx_handle_sleep_request(isl38xx_control_block *control_block, - int *powerstate, void __iomem *device_base) -{ - /* device requests to go into sleep mode - * check whether the transmit queues for data and management are empty */ - if (isl38xx_in_queue(control_block, ISL38XX_CB_TX_DATA_LQ)) - /* data tx queue not empty */ - return; - - if (isl38xx_in_queue(control_block, ISL38XX_CB_TX_MGMTQ)) - /* management tx queue not empty */ - return; - - /* check also whether received frames are pending */ - if (isl38xx_in_queue(control_block, ISL38XX_CB_RX_DATA_LQ)) - /* data rx queue not empty */ - return; - - if (isl38xx_in_queue(control_block, ISL38XX_CB_RX_MGMTQ)) - /* management rx queue not empty */ - return; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, "Device going to sleep mode\n"); -#endif - - /* all queues are empty, allow the device to go into sleep mode */ - *powerstate = ISL38XX_PSM_POWERSAVE_STATE; - - /* assert the Sleep interrupt in the Device Interrupt Register */ - isl38xx_w32_flush(device_base, ISL38XX_DEV_INT_SLEEP, - ISL38XX_DEV_INT_REG); - udelay(ISL38XX_WRITEIO_DELAY); -} - -void -isl38xx_handle_wakeup(isl38xx_control_block *control_block, - int *powerstate, void __iomem *device_base) -{ - /* device is in active state, update the powerstate flag */ - *powerstate = ISL38XX_PSM_ACTIVE_STATE; - - /* now check whether there are frames pending for the card */ - if (!isl38xx_in_queue(control_block, ISL38XX_CB_TX_DATA_LQ) - && !isl38xx_in_queue(control_block, ISL38XX_CB_TX_MGMTQ)) - return; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_ANYTHING, "Wake up handler trigger the device\n"); -#endif - - /* either data or management transmit queue has a frame pending - * trigger the device by setting the Update bit in the Device Int reg */ - isl38xx_w32_flush(device_base, ISL38XX_DEV_INT_UPDATE, - ISL38XX_DEV_INT_REG); - udelay(ISL38XX_WRITEIO_DELAY); -} - -void -isl38xx_trigger_device(int asleep, void __iomem *device_base) -{ - u32 reg; - -#if VERBOSE > SHOW_ERROR_MESSAGES - u32 counter = 0; - struct timeval current_time; - DEBUG(SHOW_FUNCTION_CALLS, "isl38xx trigger device\n"); -#endif - - /* check whether the device is in power save mode */ - if (asleep) { - /* device is in powersave, trigger the device for wakeup */ -#if VERBOSE > SHOW_ERROR_MESSAGES - do_gettimeofday(¤t_time); - DEBUG(SHOW_TRACING, "%08li.%08li Device wakeup triggered\n", - current_time.tv_sec, (long)current_time.tv_usec); - - DEBUG(SHOW_TRACING, "%08li.%08li Device register read %08x\n", - current_time.tv_sec, (long)current_time.tv_usec, - readl(device_base + ISL38XX_CTRL_STAT_REG)); -#endif - - reg = readl(device_base + ISL38XX_INT_IDENT_REG); - if (reg == 0xabadface) { -#if VERBOSE > SHOW_ERROR_MESSAGES - do_gettimeofday(¤t_time); - DEBUG(SHOW_TRACING, - "%08li.%08li Device register abadface\n", - current_time.tv_sec, (long)current_time.tv_usec); -#endif - /* read the Device Status Register until Sleepmode bit is set */ - while (reg = readl(device_base + ISL38XX_CTRL_STAT_REG), - (reg & ISL38XX_CTRL_STAT_SLEEPMODE) == 0) { - udelay(ISL38XX_WRITEIO_DELAY); -#if VERBOSE > SHOW_ERROR_MESSAGES - counter++; -#endif - } - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, - "%08li.%08li Device register read %08x\n", - current_time.tv_sec, (long)current_time.tv_usec, - readl(device_base + ISL38XX_CTRL_STAT_REG)); - do_gettimeofday(¤t_time); - DEBUG(SHOW_TRACING, - "%08li.%08li Device asleep counter %i\n", - current_time.tv_sec, (long)current_time.tv_usec, - counter); -#endif - } - /* assert the Wakeup interrupt in the Device Interrupt Register */ - isl38xx_w32_flush(device_base, ISL38XX_DEV_INT_WAKEUP, - ISL38XX_DEV_INT_REG); - -#if VERBOSE > SHOW_ERROR_MESSAGES - udelay(ISL38XX_WRITEIO_DELAY); - - /* perform another read on the Device Status Register */ - reg = readl(device_base + ISL38XX_CTRL_STAT_REG); - do_gettimeofday(¤t_time); - DEBUG(SHOW_TRACING, "%08li.%08li Device register read %08x\n", - current_time.tv_sec, (long)current_time.tv_usec, reg); -#endif - } else { - /* device is (still) awake */ -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, "Device is in active state\n"); -#endif - /* trigger the device by setting the Update bit in the Device Int reg */ - - isl38xx_w32_flush(device_base, ISL38XX_DEV_INT_UPDATE, - ISL38XX_DEV_INT_REG); - } -} - -void -isl38xx_interface_reset(void __iomem *device_base, dma_addr_t host_address) -{ -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_FUNCTION_CALLS, "isl38xx_interface_reset\n"); -#endif - - /* load the address of the control block in the device */ - isl38xx_w32_flush(device_base, host_address, ISL38XX_CTRL_BLK_BASE_REG); - udelay(ISL38XX_WRITEIO_DELAY); - - /* set the reset bit in the Device Interrupt Register */ - isl38xx_w32_flush(device_base, ISL38XX_DEV_INT_RESET, ISL38XX_DEV_INT_REG); - udelay(ISL38XX_WRITEIO_DELAY); - - /* enable the interrupt for detecting initialization */ - - /* Note: Do not enable other interrupts here. We want the - * device to have come up first 100% before allowing any other - * interrupts. */ - isl38xx_w32_flush(device_base, ISL38XX_INT_IDENT_INIT, ISL38XX_INT_EN_REG); - udelay(ISL38XX_WRITEIO_DELAY); /* allow complete full reset */ -} - -void -isl38xx_enable_common_interrupts(void __iomem *device_base) -{ - u32 reg; - - reg = ISL38XX_INT_IDENT_UPDATE | ISL38XX_INT_IDENT_SLEEP | - ISL38XX_INT_IDENT_WAKEUP; - isl38xx_w32_flush(device_base, reg, ISL38XX_INT_EN_REG); - udelay(ISL38XX_WRITEIO_DELAY); -} - -int -isl38xx_in_queue(isl38xx_control_block *cb, int queue) -{ - const s32 delta = (le32_to_cpu(cb->driver_curr_frag[queue]) - - le32_to_cpu(cb->device_curr_frag[queue])); - - /* determine the amount of fragments in the queue depending on the type - * of the queue, either transmit or receive */ - - BUG_ON(delta < 0); /* driver ptr must be ahead of device ptr */ - - switch (queue) { - /* send queues */ - case ISL38XX_CB_TX_MGMTQ: - BUG_ON(delta > ISL38XX_CB_MGMT_QSIZE); - - case ISL38XX_CB_TX_DATA_LQ: - case ISL38XX_CB_TX_DATA_HQ: - BUG_ON(delta > ISL38XX_CB_TX_QSIZE); - return delta; - - /* receive queues */ - case ISL38XX_CB_RX_MGMTQ: - BUG_ON(delta > ISL38XX_CB_MGMT_QSIZE); - return ISL38XX_CB_MGMT_QSIZE - delta; - - case ISL38XX_CB_RX_DATA_LQ: - case ISL38XX_CB_RX_DATA_HQ: - BUG_ON(delta > ISL38XX_CB_RX_QSIZE); - return ISL38XX_CB_RX_QSIZE - delta; - } - BUG(); - return 0; -} diff --git a/drivers/net/wireless/prism54/isl_38xx.h b/drivers/net/wireless/prism54/isl_38xx.h deleted file mode 100644 index 19c33d313734..000000000000 --- a/drivers/net/wireless/prism54/isl_38xx.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (C) 2002 Intersil Americas Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef _ISL_38XX_H -#define _ISL_38XX_H - -#include -#include - -#define ISL38XX_CB_RX_QSIZE 8 -#define ISL38XX_CB_TX_QSIZE 32 - -/* ISL38XX Access Point Specific definitions */ -#define ISL38XX_MAX_WDS_LINKS 8 - -/* ISL38xx Client Specific definitions */ -#define ISL38XX_PSM_ACTIVE_STATE 0 -#define ISL38XX_PSM_POWERSAVE_STATE 1 - -/* ISL38XX Host Interface Definitions */ -#define ISL38XX_PCI_MEM_SIZE 0x02000 -#define ISL38XX_MEMORY_WINDOW_SIZE 0x01000 -#define ISL38XX_DEV_FIRMWARE_ADDRES 0x20000 -#define ISL38XX_WRITEIO_DELAY 10 /* in us */ -#define ISL38XX_RESET_DELAY 50 /* in ms */ -#define ISL38XX_WAIT_CYCLE 10 /* in 10ms */ -#define ISL38XX_MAX_WAIT_CYCLES 10 - -/* PCI Memory Area */ -#define ISL38XX_HARDWARE_REG 0x0000 -#define ISL38XX_CARDBUS_CIS 0x0800 -#define ISL38XX_DIRECT_MEM_WIN 0x1000 - -/* Hardware registers */ -#define ISL38XX_DEV_INT_REG 0x0000 -#define ISL38XX_INT_IDENT_REG 0x0010 -#define ISL38XX_INT_ACK_REG 0x0014 -#define ISL38XX_INT_EN_REG 0x0018 -#define ISL38XX_GEN_PURP_COM_REG_1 0x0020 -#define ISL38XX_GEN_PURP_COM_REG_2 0x0024 -#define ISL38XX_CTRL_BLK_BASE_REG ISL38XX_GEN_PURP_COM_REG_1 -#define ISL38XX_DIR_MEM_BASE_REG 0x0030 -#define ISL38XX_CTRL_STAT_REG 0x0078 - -/* High end mobos queue up pci writes, the following - * is used to "read" from after a write to force flush */ -#define ISL38XX_PCI_POSTING_FLUSH ISL38XX_INT_EN_REG - -/** - * isl38xx_w32_flush - PCI iomem write helper - * @base: (host) memory base address of the device - * @val: 32bit value (host order) to write - * @offset: byte offset into @base to write value to - * - * This helper takes care of writing a 32bit datum to the - * specified offset into the device's pci memory space, and making sure - * the pci memory buffers get flushed by performing one harmless read - * from the %ISL38XX_PCI_POSTING_FLUSH offset. - */ -static inline void -isl38xx_w32_flush(void __iomem *base, u32 val, unsigned long offset) -{ - writel(val, base + offset); - (void) readl(base + ISL38XX_PCI_POSTING_FLUSH); -} - -/* Device Interrupt register bits */ -#define ISL38XX_DEV_INT_RESET 0x0001 -#define ISL38XX_DEV_INT_UPDATE 0x0002 -#define ISL38XX_DEV_INT_WAKEUP 0x0008 -#define ISL38XX_DEV_INT_SLEEP 0x0010 - -/* Interrupt Identification/Acknowledge/Enable register bits */ -#define ISL38XX_INT_IDENT_UPDATE 0x0002 -#define ISL38XX_INT_IDENT_INIT 0x0004 -#define ISL38XX_INT_IDENT_WAKEUP 0x0008 -#define ISL38XX_INT_IDENT_SLEEP 0x0010 -#define ISL38XX_INT_SOURCES 0x001E - -/* Control/Status register bits */ -/* Looks like there are other meaningful bits - 0x20004400 seen in normal operation, - 0x200044db at 'timeout waiting for mgmt response' -*/ -#define ISL38XX_CTRL_STAT_SLEEPMODE 0x00000200 -#define ISL38XX_CTRL_STAT_CLKRUN 0x00800000 -#define ISL38XX_CTRL_STAT_RESET 0x10000000 -#define ISL38XX_CTRL_STAT_RAMBOOT 0x20000000 -#define ISL38XX_CTRL_STAT_STARTHALTED 0x40000000 -#define ISL38XX_CTRL_STAT_HOST_OVERRIDE 0x80000000 - -/* Control Block definitions */ -#define ISL38XX_CB_RX_DATA_LQ 0 -#define ISL38XX_CB_TX_DATA_LQ 1 -#define ISL38XX_CB_RX_DATA_HQ 2 -#define ISL38XX_CB_TX_DATA_HQ 3 -#define ISL38XX_CB_RX_MGMTQ 4 -#define ISL38XX_CB_TX_MGMTQ 5 -#define ISL38XX_CB_QCOUNT 6 -#define ISL38XX_CB_MGMT_QSIZE 4 -#define ISL38XX_MIN_QTHRESHOLD 4 /* fragments */ - -/* Memory Manager definitions */ -#define MGMT_FRAME_SIZE 1500 /* >= size struct obj_bsslist */ -#define MGMT_TX_FRAME_COUNT 24 /* max 4 + spare 4 + 8 init */ -#define MGMT_RX_FRAME_COUNT 24 /* 4*4 + spare 8 */ -#define MGMT_FRAME_COUNT (MGMT_TX_FRAME_COUNT + MGMT_RX_FRAME_COUNT) -#define CONTROL_BLOCK_SIZE 1024 /* should be enough */ -#define PSM_FRAME_SIZE 1536 -#define PSM_MINIMAL_STATION_COUNT 64 -#define PSM_FRAME_COUNT PSM_MINIMAL_STATION_COUNT -#define PSM_BUFFER_SIZE PSM_FRAME_SIZE * PSM_FRAME_COUNT -#define MAX_TRAP_RX_QUEUE 4 -#define HOST_MEM_BLOCK CONTROL_BLOCK_SIZE + PSM_BUFFER_SIZE - -/* Fragment package definitions */ -#define FRAGMENT_FLAG_MF 0x0001 -#define MAX_FRAGMENT_SIZE 1536 - -/* In monitor mode frames have a header. I don't know exactly how big those - * frame can be but I've never seen any frame bigger than 1584... : - */ -#define MAX_FRAGMENT_SIZE_RX 1600 - -typedef struct { - __le32 address; /* physical address on host */ - __le16 size; /* packet size */ - __le16 flags; /* set of bit-wise flags */ -} isl38xx_fragment; - -struct isl38xx_cb { - __le32 driver_curr_frag[ISL38XX_CB_QCOUNT]; - __le32 device_curr_frag[ISL38XX_CB_QCOUNT]; - isl38xx_fragment rx_data_low[ISL38XX_CB_RX_QSIZE]; - isl38xx_fragment tx_data_low[ISL38XX_CB_TX_QSIZE]; - isl38xx_fragment rx_data_high[ISL38XX_CB_RX_QSIZE]; - isl38xx_fragment tx_data_high[ISL38XX_CB_TX_QSIZE]; - isl38xx_fragment rx_data_mgmt[ISL38XX_CB_MGMT_QSIZE]; - isl38xx_fragment tx_data_mgmt[ISL38XX_CB_MGMT_QSIZE]; -}; - -typedef struct isl38xx_cb isl38xx_control_block; - -/* determine number of entries currently in queue */ -int isl38xx_in_queue(isl38xx_control_block *cb, int queue); - -void isl38xx_disable_interrupts(void __iomem *); -void isl38xx_enable_common_interrupts(void __iomem *); - -void isl38xx_handle_sleep_request(isl38xx_control_block *, int *, - void __iomem *); -void isl38xx_handle_wakeup(isl38xx_control_block *, int *, void __iomem *); -void isl38xx_trigger_device(int, void __iomem *); -void isl38xx_interface_reset(void __iomem *, dma_addr_t); - -#endif /* _ISL_38XX_H */ diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c deleted file mode 100644 index 1c22b81e6ef3..000000000000 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ /dev/null @@ -1,2910 +0,0 @@ -/* - * Copyright (C) 2002 Intersil Americas Inc. - * (C) 2003,2004 Aurelien Alleaume - * (C) 2003 Herbert Valerio Riedel - * (C) 2003 Luis R. Rodriguez - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include -#include - -#include - -#include "prismcompat.h" -#include "isl_ioctl.h" -#include "islpci_mgt.h" -#include "isl_oid.h" /* additional types and defs for isl38xx fw */ -#include "oid_mgt.h" - -#include /* New driver API */ - -#define KEY_SIZE_WEP104 13 /* 104/128-bit WEP keys */ -#define KEY_SIZE_WEP40 5 /* 40/64-bit WEP keys */ -/* KEY_SIZE_TKIP should match isl_oid.h, struct obj_key.key[] size */ -#define KEY_SIZE_TKIP 32 /* TKIP keys */ - -static void prism54_wpa_bss_ie_add(islpci_private *priv, u8 *bssid, - u8 *wpa_ie, size_t wpa_ie_len); -static size_t prism54_wpa_bss_ie_get(islpci_private *priv, u8 *bssid, u8 *wpa_ie); -static int prism54_set_wpa(struct net_device *, struct iw_request_info *, - __u32 *, char *); - -/* In 500 kbps */ -static const unsigned char scan_rate_list[] = { 2, 4, 11, 22, - 12, 18, 24, 36, - 48, 72, 96, 108 }; - -/** - * prism54_mib_mode_helper - MIB change mode helper function - * @mib: the &struct islpci_mib object to modify - * @iw_mode: new mode (%IW_MODE_*) - * - * This is a helper function, hence it does not lock. Make sure - * caller deals with locking *if* necessary. This function sets the - * mode-dependent mib values and does the mapping of the Linux - * Wireless API modes to Device firmware modes. It also checks for - * correct valid Linux wireless modes. - */ -static int -prism54_mib_mode_helper(islpci_private *priv, u32 iw_mode) -{ - u32 config = INL_CONFIG_MANUALRUN; - u32 mode, bsstype; - - /* For now, just catch early the Repeater and Secondary modes here */ - if (iw_mode == IW_MODE_REPEAT || iw_mode == IW_MODE_SECOND) { - printk(KERN_DEBUG - "%s(): Sorry, Repeater mode and Secondary mode " - "are not yet supported by this driver.\n", __func__); - return -EINVAL; - } - - priv->iw_mode = iw_mode; - - switch (iw_mode) { - case IW_MODE_AUTO: - mode = INL_MODE_CLIENT; - bsstype = DOT11_BSSTYPE_ANY; - break; - case IW_MODE_ADHOC: - mode = INL_MODE_CLIENT; - bsstype = DOT11_BSSTYPE_IBSS; - break; - case IW_MODE_INFRA: - mode = INL_MODE_CLIENT; - bsstype = DOT11_BSSTYPE_INFRA; - break; - case IW_MODE_MASTER: - mode = INL_MODE_AP; - bsstype = DOT11_BSSTYPE_INFRA; - break; - case IW_MODE_MONITOR: - mode = INL_MODE_PROMISCUOUS; - bsstype = DOT11_BSSTYPE_ANY; - config |= INL_CONFIG_RXANNEX; - break; - default: - return -EINVAL; - } - - if (init_wds) - config |= INL_CONFIG_WDS; - mgt_set(priv, DOT11_OID_BSSTYPE, &bsstype); - mgt_set(priv, OID_INL_CONFIG, &config); - mgt_set(priv, OID_INL_MODE, &mode); - - return 0; -} - -/** - * prism54_mib_init - fill MIB cache with defaults - * - * this function initializes the struct given as @mib with defaults, - * of which many are retrieved from the global module parameter - * variables. - */ - -void -prism54_mib_init(islpci_private *priv) -{ - u32 channel, authen, wep, filter, dot1x, mlme, conformance, power, mode; - struct obj_buffer psm_buffer = { - .size = PSM_BUFFER_SIZE, - .addr = priv->device_psm_buffer - }; - - channel = CARD_DEFAULT_CHANNEL; - authen = CARD_DEFAULT_AUTHEN; - wep = CARD_DEFAULT_WEP; - filter = CARD_DEFAULT_FILTER; /* (0) Do not filter un-encrypted data */ - dot1x = CARD_DEFAULT_DOT1X; - mlme = CARD_DEFAULT_MLME_MODE; - conformance = CARD_DEFAULT_CONFORMANCE; - power = 127; - mode = CARD_DEFAULT_IW_MODE; - - mgt_set(priv, DOT11_OID_CHANNEL, &channel); - mgt_set(priv, DOT11_OID_AUTHENABLE, &authen); - mgt_set(priv, DOT11_OID_PRIVACYINVOKED, &wep); - mgt_set(priv, DOT11_OID_PSMBUFFER, &psm_buffer); - mgt_set(priv, DOT11_OID_EXUNENCRYPTED, &filter); - mgt_set(priv, DOT11_OID_DOT1XENABLE, &dot1x); - mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &mlme); - mgt_set(priv, OID_INL_DOT11D_CONFORMANCE, &conformance); - mgt_set(priv, OID_INL_OUTPUTPOWER, &power); - - /* This sets all of the mode-dependent values */ - prism54_mib_mode_helper(priv, mode); -} - -/* this will be executed outside of atomic context thanks to - * schedule_work(), thus we can as well use sleeping semaphore - * locking */ -void -prism54_update_stats(struct work_struct *work) -{ - islpci_private *priv = container_of(work, islpci_private, stats_work); - char *data; - int j; - struct obj_bss bss, *bss2; - union oid_res_t r; - - mutex_lock(&priv->stats_lock); - -/* Noise floor. - * I'm not sure if the unit is dBm. - * Note : If we are not connected, this value seems to be irrelevant. */ - - mgt_get_request(priv, DOT11_OID_NOISEFLOOR, 0, NULL, &r); - priv->local_iwstatistics.qual.noise = r.u; - -/* Get the rssi of the link. To do this we need to retrieve a bss. */ - - /* First get the MAC address of the AP we are associated with. */ - mgt_get_request(priv, DOT11_OID_BSSID, 0, NULL, &r); - data = r.ptr; - - /* copy this MAC to the bss */ - memcpy(bss.address, data, 6); - kfree(data); - - /* now ask for the corresponding bss */ - j = mgt_get_request(priv, DOT11_OID_BSSFIND, 0, (void *) &bss, &r); - bss2 = r.ptr; - /* report the rssi and use it to calculate - * link quality through a signal-noise - * ratio */ - priv->local_iwstatistics.qual.level = bss2->rssi; - priv->local_iwstatistics.qual.qual = - bss2->rssi - priv->iwstatistics.qual.noise; - - kfree(bss2); - - /* report that the stats are new */ - priv->local_iwstatistics.qual.updated = 0x7; - -/* Rx : unable to decrypt the MPDU */ - mgt_get_request(priv, DOT11_OID_PRIVRXFAILED, 0, NULL, &r); - priv->local_iwstatistics.discard.code = r.u; - -/* Tx : Max MAC retries num reached */ - mgt_get_request(priv, DOT11_OID_MPDUTXFAILED, 0, NULL, &r); - priv->local_iwstatistics.discard.retries = r.u; - - mutex_unlock(&priv->stats_lock); -} - -struct iw_statistics * -prism54_get_wireless_stats(struct net_device *ndev) -{ - islpci_private *priv = netdev_priv(ndev); - - /* If the stats are being updated return old data */ - if (mutex_trylock(&priv->stats_lock)) { - memcpy(&priv->iwstatistics, &priv->local_iwstatistics, - sizeof (struct iw_statistics)); - /* They won't be marked updated for the next time */ - priv->local_iwstatistics.qual.updated = 0; - mutex_unlock(&priv->stats_lock); - } else - priv->iwstatistics.qual.updated = 0; - - /* Update our wireless stats, but do not schedule to often - * (max 1 HZ) */ - if ((priv->stats_timestamp == 0) || - time_after(jiffies, priv->stats_timestamp + 1 * HZ)) { - schedule_work(&priv->stats_work); - priv->stats_timestamp = jiffies; - } - - return &priv->iwstatistics; -} - -static int -prism54_commit(struct net_device *ndev, struct iw_request_info *info, - char *cwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - - /* simply re-set the last set SSID, this should commit most stuff */ - - /* Commit in Monitor mode is not necessary, also setting essid - * in Monitor mode does not make sense and isn't allowed for this - * device's firmware */ - if (priv->iw_mode != IW_MODE_MONITOR) - return mgt_set_request(priv, DOT11_OID_SSID, 0, NULL); - return 0; -} - -static int -prism54_get_name(struct net_device *ndev, struct iw_request_info *info, - char *cwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - char *capabilities; - union oid_res_t r; - int rvalue; - - if (islpci_get_state(priv) < PRV_STATE_INIT) { - strncpy(cwrq, "NOT READY!", IFNAMSIZ); - return 0; - } - rvalue = mgt_get_request(priv, OID_INL_PHYCAPABILITIES, 0, NULL, &r); - - switch (r.u) { - case INL_PHYCAP_5000MHZ: - capabilities = "IEEE 802.11a/b/g"; - break; - case INL_PHYCAP_FAA: - capabilities = "IEEE 802.11b/g - FAA Support"; - break; - case INL_PHYCAP_2400MHZ: - default: - capabilities = "IEEE 802.11b/g"; /* Default */ - break; - } - strncpy(cwrq, capabilities, IFNAMSIZ); - return rvalue; -} - -static int -prism54_set_freq(struct net_device *ndev, struct iw_request_info *info, - struct iw_freq *fwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - int rvalue; - u32 c; - - if (fwrq->m < 1000) - /* we have a channel number */ - c = fwrq->m; - else - c = (fwrq->e == 1) ? channel_of_freq(fwrq->m / 100000) : 0; - - rvalue = c ? mgt_set_request(priv, DOT11_OID_CHANNEL, 0, &c) : -EINVAL; - - /* Call commit handler */ - return (rvalue ? rvalue : -EINPROGRESS); -} - -static int -prism54_get_freq(struct net_device *ndev, struct iw_request_info *info, - struct iw_freq *fwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - union oid_res_t r; - int rvalue; - - rvalue = mgt_get_request(priv, DOT11_OID_CHANNEL, 0, NULL, &r); - fwrq->i = r.u; - rvalue |= mgt_get_request(priv, DOT11_OID_FREQUENCY, 0, NULL, &r); - fwrq->m = r.u; - fwrq->e = 3; - - return rvalue; -} - -static int -prism54_set_mode(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - u32 mlmeautolevel = CARD_DEFAULT_MLME_MODE; - - /* Let's see if the user passed a valid Linux Wireless mode */ - if (*uwrq > IW_MODE_MONITOR || *uwrq < IW_MODE_AUTO) { - printk(KERN_DEBUG - "%s: %s() You passed a non-valid init_mode.\n", - priv->ndev->name, __func__); - return -EINVAL; - } - - down_write(&priv->mib_sem); - - if (prism54_mib_mode_helper(priv, *uwrq)) { - up_write(&priv->mib_sem); - return -EOPNOTSUPP; - } - - /* the ACL code needs an intermediate mlmeautolevel. The wpa stuff an - * extended one. - */ - if ((*uwrq == IW_MODE_MASTER) && (priv->acl.policy != MAC_POLICY_OPEN)) - mlmeautolevel = DOT11_MLME_INTERMEDIATE; - if (priv->wpa) - mlmeautolevel = DOT11_MLME_EXTENDED; - - mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &mlmeautolevel); - - if (mgt_commit(priv)) { - up_write(&priv->mib_sem); - return -EIO; - } - priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR) - ? priv->monitor_type : ARPHRD_ETHER; - up_write(&priv->mib_sem); - - return 0; -} - -/* Use mib cache */ -static int -prism54_get_mode(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - - BUG_ON((priv->iw_mode < IW_MODE_AUTO) || (priv->iw_mode > - IW_MODE_MONITOR)); - *uwrq = priv->iw_mode; - - return 0; -} - -/* we use DOT11_OID_EDTHRESHOLD. From what I guess the card will not try to - * emit data if (sensitivity > rssi - noise) (in dBm). - * prism54_set_sens does not seem to work. - */ - -static int -prism54_set_sens(struct net_device *ndev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - u32 sens; - - /* by default the card sets this to 20. */ - sens = vwrq->disabled ? 20 : vwrq->value; - - return mgt_set_request(priv, DOT11_OID_EDTHRESHOLD, 0, &sens); -} - -static int -prism54_get_sens(struct net_device *ndev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - union oid_res_t r; - int rvalue; - - rvalue = mgt_get_request(priv, DOT11_OID_EDTHRESHOLD, 0, NULL, &r); - - vwrq->value = r.u; - vwrq->disabled = (vwrq->value == 0); - vwrq->fixed = 1; - - return rvalue; -} - -static int -prism54_get_range(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - struct iw_range *range = (struct iw_range *) extra; - islpci_private *priv = netdev_priv(ndev); - u8 *data; - int i, m, rvalue; - struct obj_frequencies *freq; - union oid_res_t r; - - memset(range, 0, sizeof (struct iw_range)); - dwrq->length = sizeof (struct iw_range); - - /* set the wireless extension version number */ - range->we_version_source = SUPPORTED_WIRELESS_EXT; - range->we_version_compiled = WIRELESS_EXT; - - /* Now the encoding capabilities */ - range->num_encoding_sizes = 3; - /* 64(40) bits WEP */ - range->encoding_size[0] = 5; - /* 128(104) bits WEP */ - range->encoding_size[1] = 13; - /* 256 bits for WPA-PSK */ - range->encoding_size[2] = 32; - /* 4 keys are allowed */ - range->max_encoding_tokens = 4; - - /* we don't know the quality range... */ - range->max_qual.level = 0; - range->max_qual.noise = 0; - range->max_qual.qual = 0; - /* these value describe an average quality. Needs more tweaking... */ - range->avg_qual.level = -80; /* -80 dBm */ - range->avg_qual.noise = 0; /* don't know what to put here */ - range->avg_qual.qual = 0; - - range->sensitivity = 200; - - /* retry limit capabilities */ - range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME; - range->retry_flags = IW_RETRY_LIMIT; - range->r_time_flags = IW_RETRY_LIFETIME; - - /* I don't know the range. Put stupid things here */ - range->min_retry = 1; - range->max_retry = 65535; - range->min_r_time = 1024; - range->max_r_time = 65535 * 1024; - - /* txpower is supported in dBm's */ - range->txpower_capa = IW_TXPOW_DBM; - - /* Event capability (kernel + driver) */ - range->event_capa[0] = (IW_EVENT_CAPA_K_0 | - IW_EVENT_CAPA_MASK(SIOCGIWTHRSPY) | - IW_EVENT_CAPA_MASK(SIOCGIWAP)); - range->event_capa[1] = IW_EVENT_CAPA_K_1; - range->event_capa[4] = IW_EVENT_CAPA_MASK(IWEVCUSTOM); - - range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | - IW_ENC_CAPA_CIPHER_TKIP; - - if (islpci_get_state(priv) < PRV_STATE_INIT) - return 0; - - /* Request the device for the supported frequencies - * not really relevant since some devices will report the 5 GHz band - * frequencies even if they don't support them. - */ - rvalue = - mgt_get_request(priv, DOT11_OID_SUPPORTEDFREQUENCIES, 0, NULL, &r); - freq = r.ptr; - - range->num_channels = freq->nr; - range->num_frequency = freq->nr; - - m = min(IW_MAX_FREQUENCIES, (int) freq->nr); - for (i = 0; i < m; i++) { - range->freq[i].m = freq->mhz[i]; - range->freq[i].e = 6; - range->freq[i].i = channel_of_freq(freq->mhz[i]); - } - kfree(freq); - - rvalue |= mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r); - data = r.ptr; - - /* We got an array of char. It is NULL terminated. */ - i = 0; - while ((i < IW_MAX_BITRATES) && (*data != 0)) { - /* the result must be in bps. The card gives us 500Kbps */ - range->bitrate[i] = *data * 500000; - i++; - data++; - } - range->num_bitrates = i; - kfree(r.ptr); - - return rvalue; -} - -/* Set AP address*/ - -static int -prism54_set_wap(struct net_device *ndev, struct iw_request_info *info, - struct sockaddr *awrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - char bssid[6]; - int rvalue; - - if (awrq->sa_family != ARPHRD_ETHER) - return -EINVAL; - - /* prepare the structure for the set object */ - memcpy(&bssid[0], awrq->sa_data, 6); - - /* set the bssid -- does this make sense when in AP mode? */ - rvalue = mgt_set_request(priv, DOT11_OID_BSSID, 0, &bssid); - - return (rvalue ? rvalue : -EINPROGRESS); /* Call commit handler */ -} - -/* get AP address*/ - -static int -prism54_get_wap(struct net_device *ndev, struct iw_request_info *info, - struct sockaddr *awrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - union oid_res_t r; - int rvalue; - - rvalue = mgt_get_request(priv, DOT11_OID_BSSID, 0, NULL, &r); - memcpy(awrq->sa_data, r.ptr, 6); - awrq->sa_family = ARPHRD_ETHER; - kfree(r.ptr); - - return rvalue; -} - -static int -prism54_set_scan(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - /* hehe the device does this automagicaly */ - return 0; -} - -/* a little helper that will translate our data into a card independent - * format that the Wireless Tools will understand. This was inspired by - * the "Aironet driver for 4500 and 4800 series cards" (GPL) - */ - -static char * -prism54_translate_bss(struct net_device *ndev, struct iw_request_info *info, - char *current_ev, char *end_buf, struct obj_bss *bss, - char noise) -{ - struct iw_event iwe; /* Temporary buffer */ - short cap; - islpci_private *priv = netdev_priv(ndev); - u8 wpa_ie[MAX_WPA_IE_LEN]; - size_t wpa_ie_len; - - /* The first entry must be the MAC address */ - memcpy(iwe.u.ap_addr.sa_data, bss->address, 6); - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - iwe.cmd = SIOCGIWAP; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_ADDR_LEN); - - /* The following entries will be displayed in the same order we give them */ - - /* The ESSID. */ - iwe.u.data.length = bss->ssid.length; - iwe.u.data.flags = 1; - iwe.cmd = SIOCGIWESSID; - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, bss->ssid.octets); - - /* Capabilities */ -#define CAP_ESS 0x01 -#define CAP_IBSS 0x02 -#define CAP_CRYPT 0x10 - - /* Mode */ - cap = bss->capinfo; - iwe.u.mode = 0; - if (cap & CAP_ESS) - iwe.u.mode = IW_MODE_MASTER; - else if (cap & CAP_IBSS) - iwe.u.mode = IW_MODE_ADHOC; - iwe.cmd = SIOCGIWMODE; - if (iwe.u.mode) - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_UINT_LEN); - - /* Encryption capability */ - if (cap & CAP_CRYPT) - iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - else - iwe.u.data.flags = IW_ENCODE_DISABLED; - iwe.u.data.length = 0; - iwe.cmd = SIOCGIWENCODE; - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, NULL); - - /* Add frequency. (short) bss->channel is the frequency in MHz */ - iwe.u.freq.m = bss->channel; - iwe.u.freq.e = 6; - iwe.cmd = SIOCGIWFREQ; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_FREQ_LEN); - - /* Add quality statistics */ - iwe.u.qual.level = bss->rssi; - iwe.u.qual.noise = noise; - /* do a simple SNR for quality */ - iwe.u.qual.qual = bss->rssi - noise; - iwe.cmd = IWEVQUAL; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_QUAL_LEN); - - /* Add WPA/RSN Information Element, if any */ - wpa_ie_len = prism54_wpa_bss_ie_get(priv, bss->address, wpa_ie); - if (wpa_ie_len > 0) { - iwe.cmd = IWEVGENIE; - iwe.u.data.length = min(wpa_ie_len, (size_t)MAX_WPA_IE_LEN); - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, wpa_ie); - } - /* Do the bitrates */ - { - char *current_val = current_ev + iwe_stream_lcp_len(info); - int i; - int mask; - - iwe.cmd = SIOCGIWRATE; - /* Those two flags are ignored... */ - iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; - - /* Parse the bitmask */ - mask = 0x1; - for(i = 0; i < sizeof(scan_rate_list); i++) { - if(bss->rates & mask) { - iwe.u.bitrate.value = (scan_rate_list[i] * 500000); - current_val = iwe_stream_add_value( - info, current_ev, current_val, - end_buf, &iwe, IW_EV_PARAM_LEN); - } - mask <<= 1; - } - /* Check if we added any event */ - if ((current_val - current_ev) > iwe_stream_lcp_len(info)) - current_ev = current_val; - } - - return current_ev; -} - -static int -prism54_get_scan(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - int i, rvalue; - struct obj_bsslist *bsslist; - u32 noise = 0; - char *current_ev = extra; - union oid_res_t r; - - if (islpci_get_state(priv) < PRV_STATE_INIT) { - /* device is not ready, fail gently */ - dwrq->length = 0; - return 0; - } - - /* first get the noise value. We will use it to report the link quality */ - rvalue = mgt_get_request(priv, DOT11_OID_NOISEFLOOR, 0, NULL, &r); - noise = r.u; - - /* Ask the device for a list of known bss. - * The old API, using SIOCGIWAPLIST, had a hard limit of IW_MAX_AP=64. - * The new API, using SIOCGIWSCAN, is only limited by the buffer size. - * WE-14->WE-16, the buffer is limited to IW_SCAN_MAX_DATA bytes. - * Starting with WE-17, the buffer can be as big as needed. - * But the device won't repport anything if you change the value - * of IWMAX_BSS=24. */ - - rvalue |= mgt_get_request(priv, DOT11_OID_BSSLIST, 0, NULL, &r); - bsslist = r.ptr; - - /* ok now, scan the list and translate its info */ - for (i = 0; i < (int) bsslist->nr; i++) { - current_ev = prism54_translate_bss(ndev, info, current_ev, - extra + dwrq->length, - &(bsslist->bsslist[i]), - noise); - - /* Check if there is space for one more entry */ - if((extra + dwrq->length - current_ev) <= IW_EV_ADDR_LEN) { - /* Ask user space to try again with a bigger buffer */ - rvalue = -E2BIG; - break; - } - } - - kfree(bsslist); - dwrq->length = (current_ev - extra); - dwrq->flags = 0; /* todo */ - - return rvalue; -} - -static int -prism54_set_essid(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - struct obj_ssid essid; - - memset(essid.octets, 0, 33); - - /* Check if we were asked for `any' */ - if (dwrq->flags && dwrq->length) { - if (dwrq->length > 32) - return -E2BIG; - essid.length = dwrq->length; - memcpy(essid.octets, extra, dwrq->length); - } else - essid.length = 0; - - if (priv->iw_mode != IW_MODE_MONITOR) - return mgt_set_request(priv, DOT11_OID_SSID, 0, &essid); - - /* If in monitor mode, just save to mib */ - mgt_set(priv, DOT11_OID_SSID, &essid); - return 0; - -} - -static int -prism54_get_essid(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - struct obj_ssid *essid; - union oid_res_t r; - int rvalue; - - rvalue = mgt_get_request(priv, DOT11_OID_SSID, 0, NULL, &r); - essid = r.ptr; - - if (essid->length) { - dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */ - /* if it is too big, trunk it */ - dwrq->length = min((u8)IW_ESSID_MAX_SIZE, essid->length); - } else { - dwrq->flags = 0; - dwrq->length = 0; - } - essid->octets[dwrq->length] = '\0'; - memcpy(extra, essid->octets, dwrq->length); - kfree(essid); - - return rvalue; -} - -/* Provides no functionality, just completes the ioctl. In essence this is a - * just a cosmetic ioctl. - */ -static int -prism54_set_nick(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - - if (dwrq->length > IW_ESSID_MAX_SIZE) - return -E2BIG; - - down_write(&priv->mib_sem); - memset(priv->nickname, 0, sizeof (priv->nickname)); - memcpy(priv->nickname, extra, dwrq->length); - up_write(&priv->mib_sem); - - return 0; -} - -static int -prism54_get_nick(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - - dwrq->length = 0; - - down_read(&priv->mib_sem); - dwrq->length = strlen(priv->nickname); - memcpy(extra, priv->nickname, dwrq->length); - up_read(&priv->mib_sem); - - return 0; -} - -/* Set the allowed Bitrates */ - -static int -prism54_set_rate(struct net_device *ndev, - struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - - islpci_private *priv = netdev_priv(ndev); - u32 rate, profile; - char *data; - int ret, i; - union oid_res_t r; - - if (vwrq->value == -1) { - /* auto mode. No limit. */ - profile = 1; - return mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile); - } - - ret = mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r); - if (ret) { - kfree(r.ptr); - return ret; - } - - rate = (u32) (vwrq->value / 500000); - data = r.ptr; - i = 0; - - while (data[i]) { - if (rate && (data[i] == rate)) { - break; - } - if (vwrq->value == i) { - break; - } - data[i] |= 0x80; - i++; - } - - if (!data[i]) { - kfree(r.ptr); - return -EINVAL; - } - - data[i] |= 0x80; - data[i + 1] = 0; - - /* Now, check if we want a fixed or auto value */ - if (vwrq->fixed) { - data[0] = data[i]; - data[1] = 0; - } - -/* - i = 0; - printk("prism54 rate: "); - while(data[i]) { - printk("%u ", data[i]); - i++; - } - printk("0\n"); -*/ - profile = -1; - ret = mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile); - ret |= mgt_set_request(priv, DOT11_OID_EXTENDEDRATES, 0, data); - ret |= mgt_set_request(priv, DOT11_OID_RATES, 0, data); - - kfree(r.ptr); - - return ret; -} - -/* Get the current bit rate */ -static int -prism54_get_rate(struct net_device *ndev, - struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - int rvalue; - char *data; - union oid_res_t r; - - /* Get the current bit rate */ - if ((rvalue = mgt_get_request(priv, GEN_OID_LINKSTATE, 0, NULL, &r))) - return rvalue; - vwrq->value = r.u * 500000; - - /* request the device for the enabled rates */ - rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r); - if (rvalue) { - kfree(r.ptr); - return rvalue; - } - data = r.ptr; - vwrq->fixed = (data[0] != 0) && (data[1] == 0); - kfree(r.ptr); - - return 0; -} - -static int -prism54_set_rts(struct net_device *ndev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - - return mgt_set_request(priv, DOT11_OID_RTSTHRESH, 0, &vwrq->value); -} - -static int -prism54_get_rts(struct net_device *ndev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - union oid_res_t r; - int rvalue; - - /* get the rts threshold */ - rvalue = mgt_get_request(priv, DOT11_OID_RTSTHRESH, 0, NULL, &r); - vwrq->value = r.u; - - return rvalue; -} - -static int -prism54_set_frag(struct net_device *ndev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - - return mgt_set_request(priv, DOT11_OID_FRAGTHRESH, 0, &vwrq->value); -} - -static int -prism54_get_frag(struct net_device *ndev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - union oid_res_t r; - int rvalue; - - rvalue = mgt_get_request(priv, DOT11_OID_FRAGTHRESH, 0, NULL, &r); - vwrq->value = r.u; - - return rvalue; -} - -/* Here we have (min,max) = max retries for (small frames, big frames). Where - * big frame <=> bigger than the rts threshold - * small frame <=> smaller than the rts threshold - * This is not really the behavior expected by the wireless tool but it seems - * to be a common behavior in other drivers. - */ - -static int -prism54_set_retry(struct net_device *ndev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - u32 slimit = 0, llimit = 0; /* short and long limit */ - u32 lifetime = 0; - int rvalue = 0; - - if (vwrq->disabled) - /* we cannot disable this feature */ - return -EINVAL; - - if (vwrq->flags & IW_RETRY_LIMIT) { - if (vwrq->flags & IW_RETRY_SHORT) - slimit = vwrq->value; - else if (vwrq->flags & IW_RETRY_LONG) - llimit = vwrq->value; - else { - /* we are asked to set both */ - slimit = vwrq->value; - llimit = vwrq->value; - } - } - if (vwrq->flags & IW_RETRY_LIFETIME) - /* Wireless tools use us unit while the device uses 1024 us unit */ - lifetime = vwrq->value / 1024; - - /* now set what is requested */ - if (slimit) - rvalue = - mgt_set_request(priv, DOT11_OID_SHORTRETRIES, 0, &slimit); - if (llimit) - rvalue |= - mgt_set_request(priv, DOT11_OID_LONGRETRIES, 0, &llimit); - if (lifetime) - rvalue |= - mgt_set_request(priv, DOT11_OID_MAXTXLIFETIME, 0, - &lifetime); - return rvalue; -} - -static int -prism54_get_retry(struct net_device *ndev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - union oid_res_t r; - int rvalue = 0; - vwrq->disabled = 0; /* It cannot be disabled */ - - if ((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { - /* we are asked for the life time */ - rvalue = - mgt_get_request(priv, DOT11_OID_MAXTXLIFETIME, 0, NULL, &r); - vwrq->value = r.u * 1024; - vwrq->flags = IW_RETRY_LIFETIME; - } else if ((vwrq->flags & IW_RETRY_LONG)) { - /* we are asked for the long retry limit */ - rvalue |= - mgt_get_request(priv, DOT11_OID_LONGRETRIES, 0, NULL, &r); - vwrq->value = r.u; - vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; - } else { - /* default. get the short retry limit */ - rvalue |= - mgt_get_request(priv, DOT11_OID_SHORTRETRIES, 0, NULL, &r); - vwrq->value = r.u; - vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; - } - - return rvalue; -} - -static int -prism54_set_encode(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - int rvalue = 0, force = 0; - int authen = DOT11_AUTH_OS, invoke = 0, exunencrypt = 0; - union oid_res_t r; - - /* with the new API, it's impossible to get a NULL pointer. - * New version of iwconfig set the IW_ENCODE_NOKEY flag - * when no key is given, but older versions don't. */ - - if (dwrq->length > 0) { - /* we have a key to set */ - int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - int current_index; - struct obj_key key = { DOT11_PRIV_WEP, 0, "" }; - - /* get the current key index */ - rvalue = mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r); - current_index = r.u; - /* Verify that the key is not marked as invalid */ - if (!(dwrq->flags & IW_ENCODE_NOKEY)) { - if (dwrq->length > KEY_SIZE_TKIP) { - /* User-provided key data too big */ - return -EINVAL; - } - if (dwrq->length > KEY_SIZE_WEP104) { - /* WPA-PSK TKIP */ - key.type = DOT11_PRIV_TKIP; - key.length = KEY_SIZE_TKIP; - } else if (dwrq->length > KEY_SIZE_WEP40) { - /* WEP 104/128 */ - key.length = KEY_SIZE_WEP104; - } else { - /* WEP 40/64 */ - key.length = KEY_SIZE_WEP40; - } - memset(key.key, 0, sizeof (key.key)); - memcpy(key.key, extra, dwrq->length); - - if ((index < 0) || (index > 3)) - /* no index provided use the current one */ - index = current_index; - - /* now send the key to the card */ - rvalue |= - mgt_set_request(priv, DOT11_OID_DEFKEYX, index, - &key); - } - /* - * If a valid key is set, encryption should be enabled - * (user may turn it off later). - * This is also how "iwconfig ethX key on" works - */ - if ((index == current_index) && (key.length > 0)) - force = 1; - } else { - int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - if ((index >= 0) && (index <= 3)) { - /* we want to set the key index */ - rvalue |= - mgt_set_request(priv, DOT11_OID_DEFKEYID, 0, - &index); - } else { - if (!(dwrq->flags & IW_ENCODE_MODE)) { - /* we cannot do anything. Complain. */ - return -EINVAL; - } - } - } - /* now read the flags */ - if (dwrq->flags & IW_ENCODE_DISABLED) { - /* Encoding disabled, - * authen = DOT11_AUTH_OS; - * invoke = 0; - * exunencrypt = 0; */ - } - if (dwrq->flags & IW_ENCODE_OPEN) - /* Encode but accept non-encoded packets. No auth */ - invoke = 1; - if ((dwrq->flags & IW_ENCODE_RESTRICTED) || force) { - /* Refuse non-encoded packets. Auth */ - authen = DOT11_AUTH_BOTH; - invoke = 1; - exunencrypt = 1; - } - /* do the change if requested */ - if ((dwrq->flags & IW_ENCODE_MODE) || force) { - rvalue |= - mgt_set_request(priv, DOT11_OID_AUTHENABLE, 0, &authen); - rvalue |= - mgt_set_request(priv, DOT11_OID_PRIVACYINVOKED, 0, &invoke); - rvalue |= - mgt_set_request(priv, DOT11_OID_EXUNENCRYPTED, 0, - &exunencrypt); - } - return rvalue; -} - -static int -prism54_get_encode(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - struct obj_key *key; - u32 devindex, index = (dwrq->flags & IW_ENCODE_INDEX) - 1; - u32 authen = 0, invoke = 0, exunencrypt = 0; - int rvalue; - union oid_res_t r; - - /* first get the flags */ - rvalue = mgt_get_request(priv, DOT11_OID_AUTHENABLE, 0, NULL, &r); - authen = r.u; - rvalue |= mgt_get_request(priv, DOT11_OID_PRIVACYINVOKED, 0, NULL, &r); - invoke = r.u; - rvalue |= mgt_get_request(priv, DOT11_OID_EXUNENCRYPTED, 0, NULL, &r); - exunencrypt = r.u; - - if (invoke && (authen == DOT11_AUTH_BOTH) && exunencrypt) - dwrq->flags = IW_ENCODE_RESTRICTED; - else if ((authen == DOT11_AUTH_OS) && !exunencrypt) { - if (invoke) - dwrq->flags = IW_ENCODE_OPEN; - else - dwrq->flags = IW_ENCODE_DISABLED; - } else - /* The card should not work in this state */ - dwrq->flags = 0; - - /* get the current device key index */ - rvalue |= mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r); - devindex = r.u; - /* Now get the key, return it */ - if (index == -1 || index > 3) - /* no index provided, use the current one */ - index = devindex; - rvalue |= mgt_get_request(priv, DOT11_OID_DEFKEYX, index, NULL, &r); - key = r.ptr; - dwrq->length = key->length; - memcpy(extra, key->key, dwrq->length); - kfree(key); - /* return the used key index */ - dwrq->flags |= devindex + 1; - - return rvalue; -} - -static int -prism54_get_txpower(struct net_device *ndev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - union oid_res_t r; - int rvalue; - - rvalue = mgt_get_request(priv, OID_INL_OUTPUTPOWER, 0, NULL, &r); - /* intersil firmware operates in 0.25 dBm (1/4 dBm) */ - vwrq->value = (s32) r.u / 4; - vwrq->fixed = 1; - /* radio is not turned of - * btw: how is possible to turn off only the radio - */ - vwrq->disabled = 0; - - return rvalue; -} - -static int -prism54_set_txpower(struct net_device *ndev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - s32 u = vwrq->value; - - /* intersil firmware operates in 0.25 dBm (1/4) */ - u *= 4; - if (vwrq->disabled) { - /* don't know how to disable radio */ - printk(KERN_DEBUG - "%s: %s() disabling radio is not yet supported.\n", - priv->ndev->name, __func__); - return -ENOTSUPP; - } else if (vwrq->fixed) - /* currently only fixed value is supported */ - return mgt_set_request(priv, OID_INL_OUTPUTPOWER, 0, &u); - else { - printk(KERN_DEBUG - "%s: %s() auto power will be implemented later.\n", - priv->ndev->name, __func__); - return -ENOTSUPP; - } -} - -static int prism54_set_genie(struct net_device *ndev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - int alen, ret = 0; - struct obj_attachment *attach; - - if (data->length > MAX_WPA_IE_LEN || - (data->length && extra == NULL)) - return -EINVAL; - - memcpy(priv->wpa_ie, extra, data->length); - priv->wpa_ie_len = data->length; - - alen = sizeof(*attach) + priv->wpa_ie_len; - attach = kzalloc(alen, GFP_KERNEL); - if (attach == NULL) - return -ENOMEM; - -#define WLAN_FC_TYPE_MGMT 0 -#define WLAN_FC_STYPE_ASSOC_REQ 0 -#define WLAN_FC_STYPE_REASSOC_REQ 2 - - /* Note: endianness is covered by mgt_set_varlen */ - attach->type = (WLAN_FC_TYPE_MGMT << 2) | - (WLAN_FC_STYPE_ASSOC_REQ << 4); - attach->id = -1; - attach->size = priv->wpa_ie_len; - memcpy(attach->data, extra, priv->wpa_ie_len); - - ret = mgt_set_varlen(priv, DOT11_OID_ATTACHMENT, attach, - priv->wpa_ie_len); - if (ret == 0) { - attach->type = (WLAN_FC_TYPE_MGMT << 2) | - (WLAN_FC_STYPE_REASSOC_REQ << 4); - - ret = mgt_set_varlen(priv, DOT11_OID_ATTACHMENT, attach, - priv->wpa_ie_len); - if (ret == 0) - printk(KERN_DEBUG "%s: WPA IE Attachment was set\n", - ndev->name); - } - - kfree(attach); - return ret; -} - - -static int prism54_get_genie(struct net_device *ndev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - int len = priv->wpa_ie_len; - - if (len <= 0) { - data->length = 0; - return 0; - } - - if (data->length < len) - return -E2BIG; - - data->length = len; - memcpy(extra, priv->wpa_ie, len); - - return 0; -} - -static int prism54_set_auth(struct net_device *ndev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - struct iw_param *param = &wrqu->param; - u32 mlmelevel = 0, authen = 0, dot1x = 0; - u32 exunencrypt = 0, privinvoked = 0, wpa = 0; - u32 old_wpa; - int ret = 0; - union oid_res_t r; - - if (islpci_get_state(priv) < PRV_STATE_INIT) - return 0; - - /* first get the flags */ - down_write(&priv->mib_sem); - wpa = old_wpa = priv->wpa; - up_write(&priv->mib_sem); - ret = mgt_get_request(priv, DOT11_OID_AUTHENABLE, 0, NULL, &r); - authen = r.u; - ret = mgt_get_request(priv, DOT11_OID_PRIVACYINVOKED, 0, NULL, &r); - privinvoked = r.u; - ret = mgt_get_request(priv, DOT11_OID_EXUNENCRYPTED, 0, NULL, &r); - exunencrypt = r.u; - ret = mgt_get_request(priv, DOT11_OID_DOT1XENABLE, 0, NULL, &r); - dot1x = r.u; - ret = mgt_get_request(priv, DOT11_OID_MLMEAUTOLEVEL, 0, NULL, &r); - mlmelevel = r.u; - - if (ret < 0) - goto out; - - switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_KEY_MGMT: - break; - - case IW_AUTH_WPA_ENABLED: - /* Do the same thing as IW_AUTH_WPA_VERSION */ - if (param->value) { - wpa = 1; - privinvoked = 1; /* For privacy invoked */ - exunencrypt = 1; /* Filter out all unencrypted frames */ - dot1x = 0x01; /* To enable eap filter */ - mlmelevel = DOT11_MLME_EXTENDED; - authen = DOT11_AUTH_OS; /* Only WEP uses _SK and _BOTH */ - } else { - wpa = 0; - privinvoked = 0; - exunencrypt = 0; /* Do not filter un-encrypted data */ - dot1x = 0; - mlmelevel = DOT11_MLME_AUTO; - } - break; - - case IW_AUTH_WPA_VERSION: - if (param->value & IW_AUTH_WPA_VERSION_DISABLED) { - wpa = 0; - privinvoked = 0; - exunencrypt = 0; /* Do not filter un-encrypted data */ - dot1x = 0; - mlmelevel = DOT11_MLME_AUTO; - } else { - if (param->value & IW_AUTH_WPA_VERSION_WPA) - wpa = 1; - else if (param->value & IW_AUTH_WPA_VERSION_WPA2) - wpa = 2; - privinvoked = 1; /* For privacy invoked */ - exunencrypt = 1; /* Filter out all unencrypted frames */ - dot1x = 0x01; /* To enable eap filter */ - mlmelevel = DOT11_MLME_EXTENDED; - authen = DOT11_AUTH_OS; /* Only WEP uses _SK and _BOTH */ - } - break; - - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - /* dot1x should be the opposite of RX_UNENCRYPTED_EAPOL; - * turn off dot1x when allowing receipt of unencrypted EAPOL - * frames, turn on dot1x when receipt should be disallowed - */ - dot1x = param->value ? 0 : 0x01; - break; - - case IW_AUTH_PRIVACY_INVOKED: - privinvoked = param->value ? 1 : 0; - break; - - case IW_AUTH_DROP_UNENCRYPTED: - exunencrypt = param->value ? 1 : 0; - break; - - case IW_AUTH_80211_AUTH_ALG: - if (param->value & IW_AUTH_ALG_SHARED_KEY) { - /* Only WEP uses _SK and _BOTH */ - if (wpa > 0) { - ret = -EINVAL; - goto out; - } - authen = DOT11_AUTH_SK; - } else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM) { - authen = DOT11_AUTH_OS; - } else { - ret = -EINVAL; - goto out; - } - break; - - default: - return -EOPNOTSUPP; - } - - /* Set all the values */ - down_write(&priv->mib_sem); - priv->wpa = wpa; - up_write(&priv->mib_sem); - mgt_set_request(priv, DOT11_OID_AUTHENABLE, 0, &authen); - mgt_set_request(priv, DOT11_OID_PRIVACYINVOKED, 0, &privinvoked); - mgt_set_request(priv, DOT11_OID_EXUNENCRYPTED, 0, &exunencrypt); - mgt_set_request(priv, DOT11_OID_DOT1XENABLE, 0, &dot1x); - mgt_set_request(priv, DOT11_OID_MLMEAUTOLEVEL, 0, &mlmelevel); - -out: - return ret; -} - -static int prism54_get_auth(struct net_device *ndev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - struct iw_param *param = &wrqu->param; - u32 wpa = 0; - int ret = 0; - union oid_res_t r; - - if (islpci_get_state(priv) < PRV_STATE_INIT) - return 0; - - /* first get the flags */ - down_write(&priv->mib_sem); - wpa = priv->wpa; - up_write(&priv->mib_sem); - - switch (param->flags & IW_AUTH_INDEX) { - case IW_AUTH_CIPHER_PAIRWISE: - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_KEY_MGMT: - /* - * wpa_supplicant will control these internally - */ - ret = -EOPNOTSUPP; - break; - - case IW_AUTH_WPA_VERSION: - switch (wpa) { - case 1: - param->value = IW_AUTH_WPA_VERSION_WPA; - break; - case 2: - param->value = IW_AUTH_WPA_VERSION_WPA2; - break; - case 0: - default: - param->value = IW_AUTH_WPA_VERSION_DISABLED; - break; - } - break; - - case IW_AUTH_DROP_UNENCRYPTED: - ret = mgt_get_request(priv, DOT11_OID_EXUNENCRYPTED, 0, NULL, &r); - if (ret >= 0) - param->value = r.u > 0 ? 1 : 0; - break; - - case IW_AUTH_80211_AUTH_ALG: - ret = mgt_get_request(priv, DOT11_OID_AUTHENABLE, 0, NULL, &r); - if (ret >= 0) { - switch (r.u) { - case DOT11_AUTH_OS: - param->value = IW_AUTH_ALG_OPEN_SYSTEM; - break; - case DOT11_AUTH_BOTH: - case DOT11_AUTH_SK: - param->value = IW_AUTH_ALG_SHARED_KEY; - break; - case DOT11_AUTH_NONE: - default: - param->value = 0; - break; - } - } - break; - - case IW_AUTH_WPA_ENABLED: - param->value = wpa > 0 ? 1 : 0; - break; - - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - ret = mgt_get_request(priv, DOT11_OID_DOT1XENABLE, 0, NULL, &r); - if (ret >= 0) - param->value = r.u > 0 ? 1 : 0; - break; - - case IW_AUTH_PRIVACY_INVOKED: - ret = mgt_get_request(priv, DOT11_OID_PRIVACYINVOKED, 0, NULL, &r); - if (ret >= 0) - param->value = r.u > 0 ? 1 : 0; - break; - - default: - return -EOPNOTSUPP; - } - return ret; -} - -static int prism54_set_encodeext(struct net_device *ndev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - struct iw_point *encoding = &wrqu->encoding; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int idx, alg = ext->alg, set_key = 1; - union oid_res_t r; - int authen = DOT11_AUTH_OS, invoke = 0, exunencrypt = 0; - int ret = 0; - - if (islpci_get_state(priv) < PRV_STATE_INIT) - return 0; - - /* Determine and validate the key index */ - idx = (encoding->flags & IW_ENCODE_INDEX) - 1; - if (idx) { - if (idx < 0 || idx > 3) - return -EINVAL; - } else { - ret = mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r); - if (ret < 0) - goto out; - idx = r.u; - } - - if (encoding->flags & IW_ENCODE_DISABLED) - alg = IW_ENCODE_ALG_NONE; - - if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - /* Only set transmit key index here, actual - * key is set below if needed. - */ - ret = mgt_set_request(priv, DOT11_OID_DEFKEYID, 0, &idx); - set_key = ext->key_len > 0 ? 1 : 0; - } - - if (set_key) { - struct obj_key key = { DOT11_PRIV_WEP, 0, "" }; - switch (alg) { - case IW_ENCODE_ALG_NONE: - break; - case IW_ENCODE_ALG_WEP: - if (ext->key_len > KEY_SIZE_WEP104) { - ret = -EINVAL; - goto out; - } - if (ext->key_len > KEY_SIZE_WEP40) - key.length = KEY_SIZE_WEP104; - else - key.length = KEY_SIZE_WEP40; - break; - case IW_ENCODE_ALG_TKIP: - if (ext->key_len > KEY_SIZE_TKIP) { - ret = -EINVAL; - goto out; - } - key.type = DOT11_PRIV_TKIP; - key.length = KEY_SIZE_TKIP; - break; - default: - return -EINVAL; - } - - if (key.length) { - memset(key.key, 0, sizeof(key.key)); - memcpy(key.key, ext->key, ext->key_len); - ret = mgt_set_request(priv, DOT11_OID_DEFKEYX, idx, - &key); - if (ret < 0) - goto out; - } - } - - /* Read the flags */ - if (encoding->flags & IW_ENCODE_DISABLED) { - /* Encoding disabled, - * authen = DOT11_AUTH_OS; - * invoke = 0; - * exunencrypt = 0; */ - } - if (encoding->flags & IW_ENCODE_OPEN) { - /* Encode but accept non-encoded packets. No auth */ - invoke = 1; - } - if (encoding->flags & IW_ENCODE_RESTRICTED) { - /* Refuse non-encoded packets. Auth */ - authen = DOT11_AUTH_BOTH; - invoke = 1; - exunencrypt = 1; - } - - /* do the change if requested */ - if (encoding->flags & IW_ENCODE_MODE) { - ret = mgt_set_request(priv, DOT11_OID_AUTHENABLE, 0, - &authen); - ret = mgt_set_request(priv, DOT11_OID_PRIVACYINVOKED, 0, - &invoke); - ret = mgt_set_request(priv, DOT11_OID_EXUNENCRYPTED, 0, - &exunencrypt); - } - -out: - return ret; -} - - -static int prism54_get_encodeext(struct net_device *ndev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - struct iw_point *encoding = &wrqu->encoding; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int idx, max_key_len; - union oid_res_t r; - int authen = DOT11_AUTH_OS, invoke = 0, exunencrypt = 0, wpa = 0; - int ret = 0; - - if (islpci_get_state(priv) < PRV_STATE_INIT) - return 0; - - /* first get the flags */ - ret = mgt_get_request(priv, DOT11_OID_AUTHENABLE, 0, NULL, &r); - authen = r.u; - ret = mgt_get_request(priv, DOT11_OID_PRIVACYINVOKED, 0, NULL, &r); - invoke = r.u; - ret = mgt_get_request(priv, DOT11_OID_EXUNENCRYPTED, 0, NULL, &r); - exunencrypt = r.u; - if (ret < 0) - goto out; - - max_key_len = encoding->length - sizeof(*ext); - if (max_key_len < 0) - return -EINVAL; - - idx = (encoding->flags & IW_ENCODE_INDEX) - 1; - if (idx) { - if (idx < 0 || idx > 3) - return -EINVAL; - } else { - ret = mgt_get_request(priv, DOT11_OID_DEFKEYID, 0, NULL, &r); - if (ret < 0) - goto out; - idx = r.u; - } - - encoding->flags = idx + 1; - memset(ext, 0, sizeof(*ext)); - - switch (authen) { - case DOT11_AUTH_BOTH: - case DOT11_AUTH_SK: - wrqu->encoding.flags |= IW_ENCODE_RESTRICTED; - case DOT11_AUTH_OS: - default: - wrqu->encoding.flags |= IW_ENCODE_OPEN; - break; - } - - down_write(&priv->mib_sem); - wpa = priv->wpa; - up_write(&priv->mib_sem); - - if (authen == DOT11_AUTH_OS && !exunencrypt && !invoke && !wpa) { - /* No encryption */ - ext->alg = IW_ENCODE_ALG_NONE; - ext->key_len = 0; - wrqu->encoding.flags |= IW_ENCODE_DISABLED; - } else { - struct obj_key *key; - - ret = mgt_get_request(priv, DOT11_OID_DEFKEYX, idx, NULL, &r); - if (ret < 0) - goto out; - key = r.ptr; - if (max_key_len < key->length) { - ret = -E2BIG; - goto out; - } - memcpy(ext->key, key->key, key->length); - ext->key_len = key->length; - - switch (key->type) { - case DOT11_PRIV_TKIP: - ext->alg = IW_ENCODE_ALG_TKIP; - break; - default: - case DOT11_PRIV_WEP: - ext->alg = IW_ENCODE_ALG_WEP; - break; - } - wrqu->encoding.flags |= IW_ENCODE_ENABLED; - } - -out: - return ret; -} - - -static int -prism54_reset(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - islpci_reset(netdev_priv(ndev), 0); - - return 0; -} - -static int -prism54_get_oid(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - union oid_res_t r; - int rvalue; - enum oid_num_t n = dwrq->flags; - - rvalue = mgt_get_request(netdev_priv(ndev), n, 0, NULL, &r); - dwrq->length = mgt_response_to_str(n, &r, extra); - if ((isl_oid[n].flags & OID_FLAG_TYPE) != OID_TYPE_U32) - kfree(r.ptr); - return rvalue; -} - -static int -prism54_set_u32(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - u32 oid = uwrq[0], u = uwrq[1]; - - return mgt_set_request(netdev_priv(ndev), oid, 0, &u); -} - -static int -prism54_set_raw(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - u32 oid = dwrq->flags; - - return mgt_set_request(netdev_priv(ndev), oid, 0, extra); -} - -void -prism54_acl_init(struct islpci_acl *acl) -{ - mutex_init(&acl->lock); - INIT_LIST_HEAD(&acl->mac_list); - acl->size = 0; - acl->policy = MAC_POLICY_OPEN; -} - -static void -prism54_clear_mac(struct islpci_acl *acl) -{ - struct list_head *ptr, *next; - struct mac_entry *entry; - - mutex_lock(&acl->lock); - - if (acl->size == 0) { - mutex_unlock(&acl->lock); - return; - } - - for (ptr = acl->mac_list.next, next = ptr->next; - ptr != &acl->mac_list; ptr = next, next = ptr->next) { - entry = list_entry(ptr, struct mac_entry, _list); - list_del(ptr); - kfree(entry); - } - acl->size = 0; - mutex_unlock(&acl->lock); -} - -void -prism54_acl_clean(struct islpci_acl *acl) -{ - prism54_clear_mac(acl); -} - -static int -prism54_add_mac(struct net_device *ndev, struct iw_request_info *info, - struct sockaddr *awrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - struct islpci_acl *acl = &priv->acl; - struct mac_entry *entry; - struct sockaddr *addr = (struct sockaddr *) extra; - - if (addr->sa_family != ARPHRD_ETHER) - return -EOPNOTSUPP; - - entry = kmalloc(sizeof (struct mac_entry), GFP_KERNEL); - if (entry == NULL) - return -ENOMEM; - - memcpy(entry->addr, addr->sa_data, ETH_ALEN); - - if (mutex_lock_interruptible(&acl->lock)) { - kfree(entry); - return -ERESTARTSYS; - } - list_add_tail(&entry->_list, &acl->mac_list); - acl->size++; - mutex_unlock(&acl->lock); - - return 0; -} - -static int -prism54_del_mac(struct net_device *ndev, struct iw_request_info *info, - struct sockaddr *awrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - struct islpci_acl *acl = &priv->acl; - struct mac_entry *entry; - struct sockaddr *addr = (struct sockaddr *) extra; - - if (addr->sa_family != ARPHRD_ETHER) - return -EOPNOTSUPP; - - if (mutex_lock_interruptible(&acl->lock)) - return -ERESTARTSYS; - list_for_each_entry(entry, &acl->mac_list, _list) { - if (memcmp(entry->addr, addr->sa_data, ETH_ALEN) == 0) { - list_del(&entry->_list); - acl->size--; - kfree(entry); - mutex_unlock(&acl->lock); - return 0; - } - } - mutex_unlock(&acl->lock); - return -EINVAL; -} - -static int -prism54_get_mac(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - struct islpci_acl *acl = &priv->acl; - struct mac_entry *entry; - struct sockaddr *dst = (struct sockaddr *) extra; - - dwrq->length = 0; - - if (mutex_lock_interruptible(&acl->lock)) - return -ERESTARTSYS; - - list_for_each_entry(entry, &acl->mac_list, _list) { - memcpy(dst->sa_data, entry->addr, ETH_ALEN); - dst->sa_family = ARPHRD_ETHER; - dwrq->length++; - dst++; - } - mutex_unlock(&acl->lock); - return 0; -} - -/* Setting policy also clears the MAC acl, even if we don't change the default - * policy - */ - -static int -prism54_set_policy(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - struct islpci_acl *acl = &priv->acl; - u32 mlmeautolevel; - - prism54_clear_mac(acl); - - if ((*uwrq < MAC_POLICY_OPEN) || (*uwrq > MAC_POLICY_REJECT)) - return -EINVAL; - - down_write(&priv->mib_sem); - - acl->policy = *uwrq; - - /* the ACL code needs an intermediate mlmeautolevel */ - if ((priv->iw_mode == IW_MODE_MASTER) && - (acl->policy != MAC_POLICY_OPEN)) - mlmeautolevel = DOT11_MLME_INTERMEDIATE; - else - mlmeautolevel = CARD_DEFAULT_MLME_MODE; - if (priv->wpa) - mlmeautolevel = DOT11_MLME_EXTENDED; - mgt_set(priv, DOT11_OID_MLMEAUTOLEVEL, &mlmeautolevel); - /* restart the card with our new policy */ - if (mgt_commit(priv)) { - up_write(&priv->mib_sem); - return -EIO; - } - up_write(&priv->mib_sem); - - return 0; -} - -static int -prism54_get_policy(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - struct islpci_acl *acl = &priv->acl; - - *uwrq = acl->policy; - - return 0; -} - -/* Return 1 only if client should be accepted. */ - -static int -prism54_mac_accept(struct islpci_acl *acl, char *mac) -{ - struct mac_entry *entry; - int res = 0; - - if (mutex_lock_interruptible(&acl->lock)) - return -ERESTARTSYS; - - if (acl->policy == MAC_POLICY_OPEN) { - mutex_unlock(&acl->lock); - return 1; - } - - list_for_each_entry(entry, &acl->mac_list, _list) { - if (memcmp(entry->addr, mac, ETH_ALEN) == 0) { - res = 1; - break; - } - } - res = (acl->policy == MAC_POLICY_ACCEPT) ? !res : res; - mutex_unlock(&acl->lock); - - return res; -} - -static int -prism54_kick_all(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - struct obj_mlme *mlme; - int rvalue; - - mlme = kmalloc(sizeof (struct obj_mlme), GFP_KERNEL); - if (mlme == NULL) - return -ENOMEM; - - /* Tell the card to kick every client */ - mlme->id = 0; - rvalue = - mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme); - kfree(mlme); - - return rvalue; -} - -static int -prism54_kick_mac(struct net_device *ndev, struct iw_request_info *info, - struct sockaddr *awrq, char *extra) -{ - struct obj_mlme *mlme; - struct sockaddr *addr = (struct sockaddr *) extra; - int rvalue; - - if (addr->sa_family != ARPHRD_ETHER) - return -EOPNOTSUPP; - - mlme = kmalloc(sizeof (struct obj_mlme), GFP_KERNEL); - if (mlme == NULL) - return -ENOMEM; - - /* Tell the card to only kick the corresponding bastard */ - memcpy(mlme->address, addr->sa_data, ETH_ALEN); - mlme->id = -1; - rvalue = - mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme); - - kfree(mlme); - - return rvalue; -} - -/* Translate a TRAP oid into a wireless event. Called in islpci_mgt_receive. */ - -static void -format_event(islpci_private *priv, char *dest, const char *str, - const struct obj_mlme *mlme, u16 *length, int error) -{ - int n = snprintf(dest, IW_CUSTOM_MAX, - "%s %s %pM %s (%2.2X)", - str, - ((priv->iw_mode == IW_MODE_MASTER) ? "from" : "to"), - mlme->address, - (error ? (mlme->code ? " : REJECTED " : " : ACCEPTED ") - : ""), mlme->code); - BUG_ON(n > IW_CUSTOM_MAX); - *length = n; -} - -static void -send_formatted_event(islpci_private *priv, const char *str, - const struct obj_mlme *mlme, int error) -{ - union iwreq_data wrqu; - char *memptr; - - memptr = kmalloc(IW_CUSTOM_MAX, GFP_KERNEL); - if (!memptr) - return; - wrqu.data.pointer = memptr; - wrqu.data.length = 0; - format_event(priv, memptr, str, mlme, &wrqu.data.length, - error); - wireless_send_event(priv->ndev, IWEVCUSTOM, &wrqu, memptr); - kfree(memptr); -} - -static void -send_simple_event(islpci_private *priv, const char *str) -{ - union iwreq_data wrqu; - char *memptr; - int n = strlen(str); - - memptr = kmalloc(IW_CUSTOM_MAX, GFP_KERNEL); - if (!memptr) - return; - BUG_ON(n >= IW_CUSTOM_MAX); - wrqu.data.pointer = memptr; - wrqu.data.length = n; - strcpy(memptr, str); - wireless_send_event(priv->ndev, IWEVCUSTOM, &wrqu, memptr); - kfree(memptr); -} - -static void -link_changed(struct net_device *ndev, u32 bitrate) -{ - islpci_private *priv = netdev_priv(ndev); - - if (bitrate) { - netif_carrier_on(ndev); - if (priv->iw_mode == IW_MODE_INFRA) { - union iwreq_data uwrq; - prism54_get_wap(ndev, NULL, (struct sockaddr *) &uwrq, - NULL); - wireless_send_event(ndev, SIOCGIWAP, &uwrq, NULL); - } else - send_simple_event(netdev_priv(ndev), - "Link established"); - } else { - netif_carrier_off(ndev); - send_simple_event(netdev_priv(ndev), "Link lost"); - } -} - -/* Beacon/ProbeResp payload header */ -struct ieee80211_beacon_phdr { - u8 timestamp[8]; - u16 beacon_int; - u16 capab_info; -} __packed; - -#define WLAN_EID_GENERIC 0xdd -static u8 wpa_oid[4] = { 0x00, 0x50, 0xf2, 1 }; - -static void -prism54_wpa_bss_ie_add(islpci_private *priv, u8 *bssid, - u8 *wpa_ie, size_t wpa_ie_len) -{ - struct list_head *ptr; - struct islpci_bss_wpa_ie *bss = NULL; - - if (wpa_ie_len > MAX_WPA_IE_LEN) - wpa_ie_len = MAX_WPA_IE_LEN; - - mutex_lock(&priv->wpa_lock); - - /* try to use existing entry */ - list_for_each(ptr, &priv->bss_wpa_list) { - bss = list_entry(ptr, struct islpci_bss_wpa_ie, list); - if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0) { - list_move(&bss->list, &priv->bss_wpa_list); - break; - } - bss = NULL; - } - - if (bss == NULL) { - /* add a new BSS entry; if max number of entries is already - * reached, replace the least recently updated */ - if (priv->num_bss_wpa >= MAX_BSS_WPA_IE_COUNT) { - bss = list_entry(priv->bss_wpa_list.prev, - struct islpci_bss_wpa_ie, list); - list_del(&bss->list); - } else { - bss = kzalloc(sizeof (*bss), GFP_ATOMIC); - if (bss != NULL) - priv->num_bss_wpa++; - } - if (bss != NULL) { - memcpy(bss->bssid, bssid, ETH_ALEN); - list_add(&bss->list, &priv->bss_wpa_list); - } - } - - if (bss != NULL) { - memcpy(bss->wpa_ie, wpa_ie, wpa_ie_len); - bss->wpa_ie_len = wpa_ie_len; - bss->last_update = jiffies; - } else { - printk(KERN_DEBUG "Failed to add BSS WPA entry for " - "%pM\n", bssid); - } - - /* expire old entries from WPA list */ - while (priv->num_bss_wpa > 0) { - bss = list_entry(priv->bss_wpa_list.prev, - struct islpci_bss_wpa_ie, list); - if (!time_after(jiffies, bss->last_update + 60 * HZ)) - break; - - list_del(&bss->list); - priv->num_bss_wpa--; - kfree(bss); - } - - mutex_unlock(&priv->wpa_lock); -} - -static size_t -prism54_wpa_bss_ie_get(islpci_private *priv, u8 *bssid, u8 *wpa_ie) -{ - struct list_head *ptr; - struct islpci_bss_wpa_ie *bss = NULL; - size_t len = 0; - - mutex_lock(&priv->wpa_lock); - - list_for_each(ptr, &priv->bss_wpa_list) { - bss = list_entry(ptr, struct islpci_bss_wpa_ie, list); - if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0) - break; - bss = NULL; - } - if (bss) { - len = bss->wpa_ie_len; - memcpy(wpa_ie, bss->wpa_ie, len); - } - mutex_unlock(&priv->wpa_lock); - - return len; -} - -void -prism54_wpa_bss_ie_init(islpci_private *priv) -{ - INIT_LIST_HEAD(&priv->bss_wpa_list); - mutex_init(&priv->wpa_lock); -} - -void -prism54_wpa_bss_ie_clean(islpci_private *priv) -{ - struct islpci_bss_wpa_ie *bss, *n; - - list_for_each_entry_safe(bss, n, &priv->bss_wpa_list, list) { - kfree(bss); - } -} - -static void -prism54_process_bss_data(islpci_private *priv, u32 oid, u8 *addr, - u8 *payload, size_t len) -{ - struct ieee80211_beacon_phdr *hdr; - u8 *pos, *end; - - if (!priv->wpa) - return; - - hdr = (struct ieee80211_beacon_phdr *) payload; - pos = (u8 *) (hdr + 1); - end = payload + len; - while (pos < end) { - if (pos + 2 + pos[1] > end) { - printk(KERN_DEBUG "Parsing Beacon/ProbeResp failed " - "for %pM\n", addr); - return; - } - if (pos[0] == WLAN_EID_GENERIC && pos[1] >= 4 && - memcmp(pos + 2, wpa_oid, 4) == 0) { - prism54_wpa_bss_ie_add(priv, addr, pos, pos[1] + 2); - return; - } - pos += 2 + pos[1]; - } -} - -static void -handle_request(islpci_private *priv, struct obj_mlme *mlme, enum oid_num_t oid) -{ - if (((mlme->state == DOT11_STATE_AUTHING) || - (mlme->state == DOT11_STATE_ASSOCING)) - && mgt_mlme_answer(priv)) { - /* Someone is requesting auth and we must respond. Just send back - * the trap with error code set accordingly. - */ - mlme->code = prism54_mac_accept(&priv->acl, - mlme->address) ? 0 : 1; - mgt_set_request(priv, oid, 0, mlme); - } -} - -static int -prism54_process_trap_helper(islpci_private *priv, enum oid_num_t oid, - char *data) -{ - struct obj_mlme *mlme = (struct obj_mlme *) data; - struct obj_mlmeex *mlmeex = (struct obj_mlmeex *) data; - struct obj_mlmeex *confirm; - u8 wpa_ie[MAX_WPA_IE_LEN]; - int wpa_ie_len; - size_t len = 0; /* u16, better? */ - u8 *payload = NULL, *pos = NULL; - int ret; - - /* I think all trapable objects are listed here. - * Some oids have a EX version. The difference is that they are emitted - * in DOT11_MLME_EXTENDED mode (set with DOT11_OID_MLMEAUTOLEVEL) - * with more info. - * The few events already defined by the wireless tools are not really - * suited. We use the more flexible custom event facility. - */ - - if (oid >= DOT11_OID_BEACON) { - len = mlmeex->size; - payload = pos = mlmeex->data; - } - - /* I fear prism54_process_bss_data won't work with big endian data */ - if ((oid == DOT11_OID_BEACON) || (oid == DOT11_OID_PROBE)) - prism54_process_bss_data(priv, oid, mlmeex->address, - payload, len); - - mgt_le_to_cpu(isl_oid[oid].flags & OID_FLAG_TYPE, (void *) mlme); - - switch (oid) { - - case GEN_OID_LINKSTATE: - link_changed(priv->ndev, (u32) *data); - break; - - case DOT11_OID_MICFAILURE: - send_simple_event(priv, "Mic failure"); - break; - - case DOT11_OID_DEAUTHENTICATE: - send_formatted_event(priv, "DeAuthenticate request", mlme, 0); - break; - - case DOT11_OID_AUTHENTICATE: - handle_request(priv, mlme, oid); - send_formatted_event(priv, "Authenticate request", mlme, 1); - break; - - case DOT11_OID_DISASSOCIATE: - send_formatted_event(priv, "Disassociate request", mlme, 0); - break; - - case DOT11_OID_ASSOCIATE: - handle_request(priv, mlme, oid); - send_formatted_event(priv, "Associate request", mlme, 1); - break; - - case DOT11_OID_REASSOCIATE: - handle_request(priv, mlme, oid); - send_formatted_event(priv, "ReAssociate request", mlme, 1); - break; - - case DOT11_OID_BEACON: - send_formatted_event(priv, - "Received a beacon from an unknown AP", - mlme, 0); - break; - - case DOT11_OID_PROBE: - /* we received a probe from a client. */ - send_formatted_event(priv, "Received a probe from client", mlme, - 0); - break; - - /* Note : "mlme" is actually a "struct obj_mlmeex *" here, but this - * is backward compatible layout-wise with "struct obj_mlme". - */ - - case DOT11_OID_DEAUTHENTICATEEX: - send_formatted_event(priv, "DeAuthenticate request", mlme, 0); - break; - - case DOT11_OID_AUTHENTICATEEX: - handle_request(priv, mlme, oid); - send_formatted_event(priv, "Authenticate request (ex)", mlme, 1); - - if (priv->iw_mode != IW_MODE_MASTER - && mlmeex->state != DOT11_STATE_AUTHING) - break; - - confirm = kmalloc(sizeof(struct obj_mlmeex) + 6, GFP_ATOMIC); - - if (!confirm) - break; - - memcpy(&confirm->address, mlmeex->address, ETH_ALEN); - printk(KERN_DEBUG "Authenticate from: address:\t%pM\n", - mlmeex->address); - confirm->id = -1; /* or mlmeex->id ? */ - confirm->state = 0; /* not used */ - confirm->code = 0; - confirm->size = 6; - confirm->data[0] = 0x00; - confirm->data[1] = 0x00; - confirm->data[2] = 0x02; - confirm->data[3] = 0x00; - confirm->data[4] = 0x00; - confirm->data[5] = 0x00; - - ret = mgt_set_varlen(priv, DOT11_OID_ASSOCIATEEX, confirm, 6); - - kfree(confirm); - if (ret) - return ret; - break; - - case DOT11_OID_DISASSOCIATEEX: - send_formatted_event(priv, "Disassociate request (ex)", mlme, 0); - break; - - case DOT11_OID_ASSOCIATEEX: - handle_request(priv, mlme, oid); - send_formatted_event(priv, "Associate request (ex)", mlme, 1); - - if (priv->iw_mode != IW_MODE_MASTER - && mlmeex->state != DOT11_STATE_ASSOCING) - break; - - confirm = kmalloc(sizeof(struct obj_mlmeex), GFP_ATOMIC); - - if (!confirm) - break; - - memcpy(&confirm->address, mlmeex->address, ETH_ALEN); - - confirm->id = ((struct obj_mlmeex *)mlme)->id; - confirm->state = 0; /* not used */ - confirm->code = 0; - - wpa_ie_len = prism54_wpa_bss_ie_get(priv, mlmeex->address, wpa_ie); - - if (!wpa_ie_len) { - printk(KERN_DEBUG "No WPA IE found from address:\t%pM\n", - mlmeex->address); - kfree(confirm); - break; - } - - confirm->size = wpa_ie_len; - memcpy(&confirm->data, wpa_ie, wpa_ie_len); - - mgt_set_varlen(priv, oid, confirm, wpa_ie_len); - - kfree(confirm); - - break; - - case DOT11_OID_REASSOCIATEEX: - handle_request(priv, mlme, oid); - send_formatted_event(priv, "Reassociate request (ex)", mlme, 1); - - if (priv->iw_mode != IW_MODE_MASTER - && mlmeex->state != DOT11_STATE_ASSOCING) - break; - - confirm = kmalloc(sizeof(struct obj_mlmeex), GFP_ATOMIC); - - if (!confirm) - break; - - memcpy(&confirm->address, mlmeex->address, ETH_ALEN); - - confirm->id = mlmeex->id; - confirm->state = 0; /* not used */ - confirm->code = 0; - - wpa_ie_len = prism54_wpa_bss_ie_get(priv, mlmeex->address, wpa_ie); - - if (!wpa_ie_len) { - printk(KERN_DEBUG "No WPA IE found from address:\t%pM\n", - mlmeex->address); - kfree(confirm); - break; - } - - confirm->size = wpa_ie_len; - memcpy(&confirm->data, wpa_ie, wpa_ie_len); - - mgt_set_varlen(priv, oid, confirm, wpa_ie_len); - - kfree(confirm); - - break; - - default: - return -EINVAL; - } - - return 0; -} - -/* - * Process a device trap. This is called via schedule_work(), outside of - * interrupt context, no locks held. - */ -void -prism54_process_trap(struct work_struct *work) -{ - struct islpci_mgmtframe *frame = - container_of(work, struct islpci_mgmtframe, ws); - struct net_device *ndev = frame->ndev; - enum oid_num_t n = mgt_oidtonum(frame->header->oid); - - if (n != OID_NUM_LAST) - prism54_process_trap_helper(netdev_priv(ndev), n, frame->data); - islpci_mgt_release(frame); -} - -int -prism54_set_mac_address(struct net_device *ndev, void *addr) -{ - islpci_private *priv = netdev_priv(ndev); - int ret; - - if (ndev->addr_len != 6) - return -EINVAL; - ret = mgt_set_request(priv, GEN_OID_MACADDRESS, 0, - &((struct sockaddr *) addr)->sa_data); - if (!ret) - memcpy(priv->ndev->dev_addr, - &((struct sockaddr *) addr)->sa_data, 6); - - return ret; -} - -#define PRISM54_SET_WPA SIOCIWFIRSTPRIV+12 - -static int -prism54_set_wpa(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - u32 mlme, authen, dot1x, filter, wep; - - if (islpci_get_state(priv) < PRV_STATE_INIT) - return 0; - - wep = 1; /* For privacy invoked */ - filter = 1; /* Filter out all unencrypted frames */ - dot1x = 0x01; /* To enable eap filter */ - mlme = DOT11_MLME_EXTENDED; - authen = DOT11_AUTH_OS; /* Only WEP uses _SK and _BOTH */ - - down_write(&priv->mib_sem); - priv->wpa = *uwrq; - - switch (priv->wpa) { - default: - case 0: /* Clears/disables WPA and friends */ - wep = 0; - filter = 0; /* Do not filter un-encrypted data */ - dot1x = 0; - mlme = DOT11_MLME_AUTO; - printk("%s: Disabling WPA\n", ndev->name); - break; - case 2: - case 1: /* WPA */ - printk("%s: Enabling WPA\n", ndev->name); - break; - } - up_write(&priv->mib_sem); - - mgt_set_request(priv, DOT11_OID_AUTHENABLE, 0, &authen); - mgt_set_request(priv, DOT11_OID_PRIVACYINVOKED, 0, &wep); - mgt_set_request(priv, DOT11_OID_EXUNENCRYPTED, 0, &filter); - mgt_set_request(priv, DOT11_OID_DOT1XENABLE, 0, &dot1x); - mgt_set_request(priv, DOT11_OID_MLMEAUTOLEVEL, 0, &mlme); - - return 0; -} - -static int -prism54_get_wpa(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - *uwrq = priv->wpa; - return 0; -} - -static int -prism54_set_prismhdr(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - priv->monitor_type = - (*uwrq ? ARPHRD_IEEE80211_PRISM : ARPHRD_IEEE80211); - if (priv->iw_mode == IW_MODE_MONITOR) - priv->ndev->type = priv->monitor_type; - - return 0; -} - -static int -prism54_get_prismhdr(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - *uwrq = (priv->monitor_type == ARPHRD_IEEE80211_PRISM); - return 0; -} - -static int -prism54_debug_oid(struct net_device *ndev, struct iw_request_info *info, - __u32 * uwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - - priv->priv_oid = *uwrq; - printk("%s: oid 0x%08X\n", ndev->name, *uwrq); - - return 0; -} - -static int -prism54_debug_get_oid(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - struct islpci_mgmtframe *response; - int ret = -EIO; - - printk("%s: get_oid 0x%08X\n", ndev->name, priv->priv_oid); - data->length = 0; - - if (islpci_get_state(priv) >= PRV_STATE_INIT) { - ret = - islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET, - priv->priv_oid, extra, 256, - &response); - printk("%s: ret: %i\n", ndev->name, ret); - if (ret || !response - || response->header->operation == PIMFOR_OP_ERROR) { - if (response) { - islpci_mgt_release(response); - } - printk("%s: EIO\n", ndev->name); - ret = -EIO; - } - if (!ret) { - data->length = response->header->length; - memcpy(extra, response->data, data->length); - islpci_mgt_release(response); - printk("%s: len: %i\n", ndev->name, data->length); - } - } - - return ret; -} - -static int -prism54_debug_set_oid(struct net_device *ndev, struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - struct islpci_mgmtframe *response; - int ret = 0, response_op = PIMFOR_OP_ERROR; - - printk("%s: set_oid 0x%08X\tlen: %d\n", ndev->name, priv->priv_oid, - data->length); - - if (islpci_get_state(priv) >= PRV_STATE_INIT) { - ret = - islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET, - priv->priv_oid, extra, data->length, - &response); - printk("%s: ret: %i\n", ndev->name, ret); - if (ret || !response - || response->header->operation == PIMFOR_OP_ERROR) { - if (response) { - islpci_mgt_release(response); - } - printk("%s: EIO\n", ndev->name); - ret = -EIO; - } - if (!ret) { - response_op = response->header->operation; - printk("%s: response_op: %i\n", ndev->name, - response_op); - islpci_mgt_release(response); - } - } - - return (ret ? ret : -EINPROGRESS); -} - -static int -prism54_set_spy(struct net_device *ndev, - struct iw_request_info *info, - union iwreq_data *uwrq, char *extra) -{ - islpci_private *priv = netdev_priv(ndev); - u32 u; - enum oid_num_t oid = OID_INL_CONFIG; - - down_write(&priv->mib_sem); - mgt_get(priv, OID_INL_CONFIG, &u); - - if ((uwrq->data.length == 0) && (priv->spy_data.spy_number > 0)) - /* disable spy */ - u &= ~INL_CONFIG_RXANNEX; - else if ((uwrq->data.length > 0) && (priv->spy_data.spy_number == 0)) - /* enable spy */ - u |= INL_CONFIG_RXANNEX; - - mgt_set(priv, OID_INL_CONFIG, &u); - mgt_commit_list(priv, &oid, 1); - up_write(&priv->mib_sem); - - return iw_handler_set_spy(ndev, info, uwrq, extra); -} - -static const iw_handler prism54_handler[] = { - (iw_handler) prism54_commit, /* SIOCSIWCOMMIT */ - (iw_handler) prism54_get_name, /* SIOCGIWNAME */ - (iw_handler) NULL, /* SIOCSIWNWID */ - (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) prism54_set_freq, /* SIOCSIWFREQ */ - (iw_handler) prism54_get_freq, /* SIOCGIWFREQ */ - (iw_handler) prism54_set_mode, /* SIOCSIWMODE */ - (iw_handler) prism54_get_mode, /* SIOCGIWMODE */ - (iw_handler) prism54_set_sens, /* SIOCSIWSENS */ - (iw_handler) prism54_get_sens, /* SIOCGIWSENS */ - (iw_handler) NULL, /* SIOCSIWRANGE */ - (iw_handler) prism54_get_range, /* SIOCGIWRANGE */ - (iw_handler) NULL, /* SIOCSIWPRIV */ - (iw_handler) NULL, /* SIOCGIWPRIV */ - (iw_handler) NULL, /* SIOCSIWSTATS */ - (iw_handler) NULL, /* SIOCGIWSTATS */ - prism54_set_spy, /* SIOCSIWSPY */ - iw_handler_get_spy, /* SIOCGIWSPY */ - iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ - iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ - (iw_handler) prism54_set_wap, /* SIOCSIWAP */ - (iw_handler) prism54_get_wap, /* SIOCGIWAP */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* SIOCGIWAPLIST deprecated */ - (iw_handler) prism54_set_scan, /* SIOCSIWSCAN */ - (iw_handler) prism54_get_scan, /* SIOCGIWSCAN */ - (iw_handler) prism54_set_essid, /* SIOCSIWESSID */ - (iw_handler) prism54_get_essid, /* SIOCGIWESSID */ - (iw_handler) prism54_set_nick, /* SIOCSIWNICKN */ - (iw_handler) prism54_get_nick, /* SIOCGIWNICKN */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) prism54_set_rate, /* SIOCSIWRATE */ - (iw_handler) prism54_get_rate, /* SIOCGIWRATE */ - (iw_handler) prism54_set_rts, /* SIOCSIWRTS */ - (iw_handler) prism54_get_rts, /* SIOCGIWRTS */ - (iw_handler) prism54_set_frag, /* SIOCSIWFRAG */ - (iw_handler) prism54_get_frag, /* SIOCGIWFRAG */ - (iw_handler) prism54_set_txpower, /* SIOCSIWTXPOW */ - (iw_handler) prism54_get_txpower, /* SIOCGIWTXPOW */ - (iw_handler) prism54_set_retry, /* SIOCSIWRETRY */ - (iw_handler) prism54_get_retry, /* SIOCGIWRETRY */ - (iw_handler) prism54_set_encode, /* SIOCSIWENCODE */ - (iw_handler) prism54_get_encode, /* SIOCGIWENCODE */ - (iw_handler) NULL, /* SIOCSIWPOWER */ - (iw_handler) NULL, /* SIOCGIWPOWER */ - NULL, /* -- hole -- */ - NULL, /* -- hole -- */ - (iw_handler) prism54_set_genie, /* SIOCSIWGENIE */ - (iw_handler) prism54_get_genie, /* SIOCGIWGENIE */ - (iw_handler) prism54_set_auth, /* SIOCSIWAUTH */ - (iw_handler) prism54_get_auth, /* SIOCGIWAUTH */ - (iw_handler) prism54_set_encodeext, /* SIOCSIWENCODEEXT */ - (iw_handler) prism54_get_encodeext, /* SIOCGIWENCODEEXT */ - NULL, /* SIOCSIWPMKSA */ -}; - -/* The low order bit identify a SET (0) or a GET (1) ioctl. */ - -#define PRISM54_RESET SIOCIWFIRSTPRIV -#define PRISM54_GET_POLICY SIOCIWFIRSTPRIV+1 -#define PRISM54_SET_POLICY SIOCIWFIRSTPRIV+2 -#define PRISM54_GET_MAC SIOCIWFIRSTPRIV+3 -#define PRISM54_ADD_MAC SIOCIWFIRSTPRIV+4 - -#define PRISM54_DEL_MAC SIOCIWFIRSTPRIV+6 - -#define PRISM54_KICK_MAC SIOCIWFIRSTPRIV+8 - -#define PRISM54_KICK_ALL SIOCIWFIRSTPRIV+10 - -#define PRISM54_GET_WPA SIOCIWFIRSTPRIV+11 -#define PRISM54_SET_WPA SIOCIWFIRSTPRIV+12 - -#define PRISM54_DBG_OID SIOCIWFIRSTPRIV+14 -#define PRISM54_DBG_GET_OID SIOCIWFIRSTPRIV+15 -#define PRISM54_DBG_SET_OID SIOCIWFIRSTPRIV+16 - -#define PRISM54_GET_OID SIOCIWFIRSTPRIV+17 -#define PRISM54_SET_OID_U32 SIOCIWFIRSTPRIV+18 -#define PRISM54_SET_OID_STR SIOCIWFIRSTPRIV+20 -#define PRISM54_SET_OID_ADDR SIOCIWFIRSTPRIV+22 - -#define PRISM54_GET_PRISMHDR SIOCIWFIRSTPRIV+23 -#define PRISM54_SET_PRISMHDR SIOCIWFIRSTPRIV+24 - -#define IWPRIV_SET_U32(n,x) { n, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x } -#define IWPRIV_SET_SSID(n,x) { n, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x } -#define IWPRIV_SET_ADDR(n,x) { n, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "s_"x } -#define IWPRIV_GET(n,x) { n, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, "g_"x } - -#define IWPRIV_U32(n,x) IWPRIV_SET_U32(n,x), IWPRIV_GET(n,x) -#define IWPRIV_SSID(n,x) IWPRIV_SET_SSID(n,x), IWPRIV_GET(n,x) -#define IWPRIV_ADDR(n,x) IWPRIV_SET_ADDR(n,x), IWPRIV_GET(n,x) - -/* Note : limited to 128 private ioctls (wireless tools 26) */ - -static const struct iw_priv_args prism54_private_args[] = { -/*{ cmd, set_args, get_args, name } */ - {PRISM54_RESET, 0, 0, "reset"}, - {PRISM54_GET_PRISMHDR, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - "get_prismhdr"}, - {PRISM54_SET_PRISMHDR, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, - "set_prismhdr"}, - {PRISM54_GET_POLICY, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - "getPolicy"}, - {PRISM54_SET_POLICY, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, - "setPolicy"}, - {PRISM54_GET_MAC, 0, IW_PRIV_TYPE_ADDR | 64, "getMac"}, - {PRISM54_ADD_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, - "addMac"}, - {PRISM54_DEL_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, - "delMac"}, - {PRISM54_KICK_MAC, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, - "kickMac"}, - {PRISM54_KICK_ALL, 0, 0, "kickAll"}, - {PRISM54_GET_WPA, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - "get_wpa"}, - {PRISM54_SET_WPA, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, - "set_wpa"}, - {PRISM54_DBG_OID, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, - "dbg_oid"}, - {PRISM54_DBG_GET_OID, 0, IW_PRIV_TYPE_BYTE | 256, "dbg_get_oid"}, - {PRISM54_DBG_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "dbg_set_oid"}, - /* --- sub-ioctls handlers --- */ - {PRISM54_GET_OID, - 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, ""}, - {PRISM54_SET_OID_U32, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, ""}, - {PRISM54_SET_OID_STR, - IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, ""}, - {PRISM54_SET_OID_ADDR, - IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, ""}, - /* --- sub-ioctls definitions --- */ - IWPRIV_ADDR(GEN_OID_MACADDRESS, "addr"), - IWPRIV_GET(GEN_OID_LINKSTATE, "linkstate"), - IWPRIV_U32(DOT11_OID_BSSTYPE, "bsstype"), - IWPRIV_ADDR(DOT11_OID_BSSID, "bssid"), - IWPRIV_U32(DOT11_OID_STATE, "state"), - IWPRIV_U32(DOT11_OID_AID, "aid"), - - IWPRIV_SSID(DOT11_OID_SSIDOVERRIDE, "ssidoverride"), - - IWPRIV_U32(DOT11_OID_MEDIUMLIMIT, "medlimit"), - IWPRIV_U32(DOT11_OID_BEACONPERIOD, "beacon"), - IWPRIV_U32(DOT11_OID_DTIMPERIOD, "dtimperiod"), - - IWPRIV_U32(DOT11_OID_AUTHENABLE, "authenable"), - IWPRIV_U32(DOT11_OID_PRIVACYINVOKED, "privinvok"), - IWPRIV_U32(DOT11_OID_EXUNENCRYPTED, "exunencrypt"), - - IWPRIV_U32(DOT11_OID_REKEYTHRESHOLD, "rekeythresh"), - - IWPRIV_U32(DOT11_OID_MAXTXLIFETIME, "maxtxlife"), - IWPRIV_U32(DOT11_OID_MAXRXLIFETIME, "maxrxlife"), - IWPRIV_U32(DOT11_OID_ALOFT_FIXEDRATE, "fixedrate"), - IWPRIV_U32(DOT11_OID_MAXFRAMEBURST, "frameburst"), - IWPRIV_U32(DOT11_OID_PSM, "psm"), - - IWPRIV_U32(DOT11_OID_BRIDGELOCAL, "bridge"), - IWPRIV_U32(DOT11_OID_CLIENTS, "clients"), - IWPRIV_U32(DOT11_OID_CLIENTSASSOCIATED, "clientassoc"), - IWPRIV_U32(DOT11_OID_DOT1XENABLE, "dot1xenable"), - IWPRIV_U32(DOT11_OID_ANTENNARX, "rxant"), - IWPRIV_U32(DOT11_OID_ANTENNATX, "txant"), - IWPRIV_U32(DOT11_OID_ANTENNADIVERSITY, "antdivers"), - IWPRIV_U32(DOT11_OID_EDTHRESHOLD, "edthresh"), - IWPRIV_U32(DOT11_OID_PREAMBLESETTINGS, "preamble"), - IWPRIV_GET(DOT11_OID_RATES, "rates"), - IWPRIV_U32(DOT11_OID_OUTPUTPOWER, ".11outpower"), - IWPRIV_GET(DOT11_OID_SUPPORTEDRATES, "supprates"), - IWPRIV_GET(DOT11_OID_SUPPORTEDFREQUENCIES, "suppfreq"), - - IWPRIV_U32(DOT11_OID_NOISEFLOOR, "noisefloor"), - IWPRIV_GET(DOT11_OID_FREQUENCYACTIVITY, "freqactivity"), - IWPRIV_U32(DOT11_OID_NONERPPROTECTION, "nonerpprotec"), - IWPRIV_U32(DOT11_OID_PROFILES, "profile"), - IWPRIV_GET(DOT11_OID_EXTENDEDRATES, "extrates"), - IWPRIV_U32(DOT11_OID_MLMEAUTOLEVEL, "mlmelevel"), - - IWPRIV_GET(DOT11_OID_BSSS, "bsss"), - IWPRIV_GET(DOT11_OID_BSSLIST, "bsslist"), - IWPRIV_U32(OID_INL_MODE, "mode"), - IWPRIV_U32(OID_INL_CONFIG, "config"), - IWPRIV_U32(OID_INL_DOT11D_CONFORMANCE, ".11dconform"), - IWPRIV_GET(OID_INL_PHYCAPABILITIES, "phycapa"), - IWPRIV_U32(OID_INL_OUTPUTPOWER, "outpower"), -}; - -static const iw_handler prism54_private_handler[] = { - (iw_handler) prism54_reset, - (iw_handler) prism54_get_policy, - (iw_handler) prism54_set_policy, - (iw_handler) prism54_get_mac, - (iw_handler) prism54_add_mac, - (iw_handler) NULL, - (iw_handler) prism54_del_mac, - (iw_handler) NULL, - (iw_handler) prism54_kick_mac, - (iw_handler) NULL, - (iw_handler) prism54_kick_all, - (iw_handler) prism54_get_wpa, - (iw_handler) prism54_set_wpa, - (iw_handler) NULL, - (iw_handler) prism54_debug_oid, - (iw_handler) prism54_debug_get_oid, - (iw_handler) prism54_debug_set_oid, - (iw_handler) prism54_get_oid, - (iw_handler) prism54_set_u32, - (iw_handler) NULL, - (iw_handler) prism54_set_raw, - (iw_handler) NULL, - (iw_handler) prism54_set_raw, - (iw_handler) prism54_get_prismhdr, - (iw_handler) prism54_set_prismhdr, -}; - -const struct iw_handler_def prism54_handler_def = { - .num_standard = ARRAY_SIZE(prism54_handler), - .num_private = ARRAY_SIZE(prism54_private_handler), - .num_private_args = ARRAY_SIZE(prism54_private_args), - .standard = (iw_handler *) prism54_handler, - .private = (iw_handler *) prism54_private_handler, - .private_args = (struct iw_priv_args *) prism54_private_args, - .get_wireless_stats = prism54_get_wireless_stats, -}; diff --git a/drivers/net/wireless/prism54/isl_ioctl.h b/drivers/net/wireless/prism54/isl_ioctl.h deleted file mode 100644 index a34bceb6e3cd..000000000000 --- a/drivers/net/wireless/prism54/isl_ioctl.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2002 Intersil Americas Inc. - * (C) 2003 Aurelien Alleaume - * (C) 2003 Luis R. Rodriguez - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef _ISL_IOCTL_H -#define _ISL_IOCTL_H - -#include "islpci_mgt.h" -#include "islpci_dev.h" - -#include /* New driver API */ - -#define SUPPORTED_WIRELESS_EXT 19 - -void prism54_mib_init(islpci_private *); - -struct iw_statistics *prism54_get_wireless_stats(struct net_device *); -void prism54_update_stats(struct work_struct *); - -void prism54_acl_init(struct islpci_acl *); -void prism54_acl_clean(struct islpci_acl *); - -void prism54_process_trap(struct work_struct *); - -void prism54_wpa_bss_ie_init(islpci_private *priv); -void prism54_wpa_bss_ie_clean(islpci_private *priv); - -int prism54_set_mac_address(struct net_device *, void *); - -extern const struct iw_handler_def prism54_handler_def; - -#endif /* _ISL_IOCTL_H */ diff --git a/drivers/net/wireless/prism54/isl_oid.h b/drivers/net/wireless/prism54/isl_oid.h deleted file mode 100644 index 59e31258d450..000000000000 --- a/drivers/net/wireless/prism54/isl_oid.h +++ /dev/null @@ -1,505 +0,0 @@ -/* - * Copyright (C) 2003 Herbert Valerio Riedel - * Copyright (C) 2004 Luis R. Rodriguez - * Copyright (C) 2004 Aurelien Alleaume - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#if !defined(_ISL_OID_H) -#define _ISL_OID_H - -/* - * MIB related constant and structure definitions for communicating - * with the device firmware - */ - -struct obj_ssid { - u8 length; - char octets[33]; -} __packed; - -struct obj_key { - u8 type; /* dot11_priv_t */ - u8 length; - char key[32]; -} __packed; - -struct obj_mlme { - u8 address[6]; - u16 id; - u16 state; - u16 code; -} __packed; - -struct obj_mlmeex { - u8 address[6]; - u16 id; - u16 state; - u16 code; - u16 size; - u8 data[0]; -} __packed; - -struct obj_buffer { - u32 size; - u32 addr; /* 32bit bus address */ -} __packed; - -struct obj_bss { - u8 address[6]; - int:16; /* padding */ - - char state; - char reserved; - short age; - - char quality; - char rssi; - - struct obj_ssid ssid; - short channel; - char beacon_period; - char dtim_period; - short capinfo; - short rates; - short basic_rates; - int:16; /* padding */ -} __packed; - -struct obj_bsslist { - u32 nr; - struct obj_bss bsslist[0]; -} __packed; - -struct obj_frequencies { - u16 nr; - u16 mhz[0]; -} __packed; - -struct obj_attachment { - char type; - char reserved; - short id; - short size; - char data[0]; -} __packed; - -/* - * in case everything's ok, the inlined function below will be - * optimized away by the compiler... - */ -static inline void -__bug_on_wrong_struct_sizes(void) -{ - BUILD_BUG_ON(sizeof (struct obj_ssid) != 34); - BUILD_BUG_ON(sizeof (struct obj_key) != 34); - BUILD_BUG_ON(sizeof (struct obj_mlme) != 12); - BUILD_BUG_ON(sizeof (struct obj_mlmeex) != 14); - BUILD_BUG_ON(sizeof (struct obj_buffer) != 8); - BUILD_BUG_ON(sizeof (struct obj_bss) != 60); - BUILD_BUG_ON(sizeof (struct obj_bsslist) != 4); - BUILD_BUG_ON(sizeof (struct obj_frequencies) != 2); -} - -enum dot11_state_t { - DOT11_STATE_NONE = 0, - DOT11_STATE_AUTHING = 1, - DOT11_STATE_AUTH = 2, - DOT11_STATE_ASSOCING = 3, - - DOT11_STATE_ASSOC = 5, - DOT11_STATE_IBSS = 6, - DOT11_STATE_WDS = 7 -}; - -enum dot11_bsstype_t { - DOT11_BSSTYPE_NONE = 0, - DOT11_BSSTYPE_INFRA = 1, - DOT11_BSSTYPE_IBSS = 2, - DOT11_BSSTYPE_ANY = 3 -}; - -enum dot11_auth_t { - DOT11_AUTH_NONE = 0, - DOT11_AUTH_OS = 1, - DOT11_AUTH_SK = 2, - DOT11_AUTH_BOTH = 3 -}; - -enum dot11_mlme_t { - DOT11_MLME_AUTO = 0, - DOT11_MLME_INTERMEDIATE = 1, - DOT11_MLME_EXTENDED = 2 -}; - -enum dot11_priv_t { - DOT11_PRIV_WEP = 0, - DOT11_PRIV_TKIP = 1 -}; - -/* Prism "Nitro" / Frameburst / "Packet Frame Grouping" - * Value is in microseconds. Represents the # microseconds - * the firmware will take to group frames before sending out then out - * together with a CSMA contention. Without this all frames are - * sent with a CSMA contention. - * Bibliography: - * http://www.hpl.hp.com/personal/Jean_Tourrilhes/Papers/Packet.Frame.Grouping.html - */ -enum dot11_maxframeburst_t { - /* Values for DOT11_OID_MAXFRAMEBURST */ - DOT11_MAXFRAMEBURST_OFF = 0, /* Card firmware default */ - DOT11_MAXFRAMEBURST_MIXED_SAFE = 650, /* 802.11 a,b,g safe */ - DOT11_MAXFRAMEBURST_IDEAL = 1300, /* Theoretical ideal level */ - DOT11_MAXFRAMEBURST_MAX = 5000, /* Use this as max, - * Note: firmware allows for greater values. This is a - * recommended max. I'll update this as I find - * out what the real MAX is. Also note that you don't necessarily - * get better results with a greater value here. - */ -}; - -/* Support for 802.11 long and short frame preambles. - * Long preamble uses 128-bit sync field, 8-bit CRC - * Short preamble uses 56-bit sync field, 16-bit CRC - * - * 802.11a -- not sure, both optionally ? - * 802.11b supports long and optionally short - * 802.11g supports both */ -enum dot11_preamblesettings_t { - DOT11_PREAMBLESETTING_LONG = 0, - /* Allows *only* long 802.11 preambles */ - DOT11_PREAMBLESETTING_SHORT = 1, - /* Allows *only* short 802.11 preambles */ - DOT11_PREAMBLESETTING_DYNAMIC = 2 - /* AutomatiGically set */ -}; - -/* Support for 802.11 slot timing (time between packets). - * - * Long uses 802.11a slot timing (9 usec ?) - * Short uses 802.11b slot timing (20 use ?) */ -enum dot11_slotsettings_t { - DOT11_SLOTSETTINGS_LONG = 0, - /* Allows *only* long 802.11b slot timing */ - DOT11_SLOTSETTINGS_SHORT = 1, - /* Allows *only* long 802.11a slot timing */ - DOT11_SLOTSETTINGS_DYNAMIC = 2 - /* AutomatiGically set */ -}; - -/* All you need to know, ERP is "Extended Rate PHY". - * An Extended Rate PHY (ERP) STA or AP shall support three different - * preamble and header formats: - * Long preamble (refer to above) - * Short preamble (refer to above) - * OFDM preamble ( ? ) - * - * I'm assuming here Protection tells the AP - * to be careful, a STA which cannot handle the long pre-amble - * has joined. - */ -enum do11_nonerpstatus_t { - DOT11_ERPSTAT_NONEPRESENT = 0, - DOT11_ERPSTAT_USEPROTECTION = 1 -}; - -/* (ERP is "Extended Rate PHY") Way to read NONERP is NON-ERP-* - * The key here is DOT11 NON ERP NEVER protects against - * NON ERP STA's. You *don't* want this unless - * you know what you are doing. It means you will only - * get Extended Rate capabilities */ -enum dot11_nonerpprotection_t { - DOT11_NONERP_NEVER = 0, - DOT11_NONERP_ALWAYS = 1, - DOT11_NONERP_DYNAMIC = 2 -}; - -/* Preset OID configuration for 802.11 modes - * Note: DOT11_OID_CW[MIN|MAX] hold the values of the - * DCS MIN|MAX backoff used */ -enum dot11_profile_t { /* And set/allowed values */ - /* Allowed values for DOT11_OID_PROFILES */ - DOT11_PROFILE_B_ONLY = 0, - /* DOT11_OID_RATES: 1, 2, 5.5, 11Mbps - * DOT11_OID_PREAMBLESETTINGS: DOT11_PREAMBLESETTING_DYNAMIC - * DOT11_OID_CWMIN: 31 - * DOT11_OID_NONEPROTECTION: DOT11_NOERP_DYNAMIC - * DOT11_OID_SLOTSETTINGS: DOT11_SLOTSETTINGS_LONG - */ - DOT11_PROFILE_MIXED_G_WIFI = 1, - /* DOT11_OID_RATES: 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54Mbs - * DOT11_OID_PREAMBLESETTINGS: DOT11_PREAMBLESETTING_DYNAMIC - * DOT11_OID_CWMIN: 15 - * DOT11_OID_NONEPROTECTION: DOT11_NOERP_DYNAMIC - * DOT11_OID_SLOTSETTINGS: DOT11_SLOTSETTINGS_DYNAMIC - */ - DOT11_PROFILE_MIXED_LONG = 2, /* "Long range" */ - /* Same as Profile MIXED_G_WIFI */ - DOT11_PROFILE_G_ONLY = 3, - /* Same as Profile MIXED_G_WIFI */ - DOT11_PROFILE_TEST = 4, - /* Same as Profile MIXED_G_WIFI except: - * DOT11_OID_PREAMBLESETTINGS: DOT11_PREAMBLESETTING_SHORT - * DOT11_OID_NONEPROTECTION: DOT11_NOERP_NEVER - * DOT11_OID_SLOTSETTINGS: DOT11_SLOTSETTINGS_SHORT - */ - DOT11_PROFILE_B_WIFI = 5, - /* Same as Profile B_ONLY */ - DOT11_PROFILE_A_ONLY = 6, - /* Same as Profile MIXED_G_WIFI except: - * DOT11_OID_RATES: 6, 9, 12, 18, 24, 36, 48, 54Mbs - */ - DOT11_PROFILE_MIXED_SHORT = 7 - /* Same as MIXED_G_WIFI */ -}; - - -/* The dot11d conformance level configures the 802.11d conformance levels. - * The following conformance levels exist:*/ -enum oid_inl_conformance_t { - OID_INL_CONFORMANCE_NONE = 0, /* Perform active scanning */ - OID_INL_CONFORMANCE_STRICT = 1, /* Strictly adhere to 802.11d */ - OID_INL_CONFORMANCE_FLEXIBLE = 2, /* Use passed 802.11d info to - * determine channel AND/OR just make assumption that active - * channels are valid channels */ -}; - -enum oid_inl_mode_t { - INL_MODE_NONE = -1, - INL_MODE_PROMISCUOUS = 0, - INL_MODE_CLIENT = 1, - INL_MODE_AP = 2, - INL_MODE_SNIFFER = 3 -}; - -enum oid_inl_config_t { - INL_CONFIG_NOTHING = 0x00, - INL_CONFIG_MANUALRUN = 0x01, - INL_CONFIG_FRAMETRAP = 0x02, - INL_CONFIG_RXANNEX = 0x04, - INL_CONFIG_TXANNEX = 0x08, - INL_CONFIG_WDS = 0x10 -}; - -enum oid_inl_phycap_t { - INL_PHYCAP_2400MHZ = 1, - INL_PHYCAP_5000MHZ = 2, - INL_PHYCAP_FAA = 0x80000000, /* Means card supports the FAA switch */ -}; - - -enum oid_num_t { - GEN_OID_MACADDRESS = 0, - GEN_OID_LINKSTATE, - GEN_OID_WATCHDOG, - GEN_OID_MIBOP, - GEN_OID_OPTIONS, - GEN_OID_LEDCONFIG, - - /* 802.11 */ - DOT11_OID_BSSTYPE, - DOT11_OID_BSSID, - DOT11_OID_SSID, - DOT11_OID_STATE, - DOT11_OID_AID, - DOT11_OID_COUNTRYSTRING, - DOT11_OID_SSIDOVERRIDE, - - DOT11_OID_MEDIUMLIMIT, - DOT11_OID_BEACONPERIOD, - DOT11_OID_DTIMPERIOD, - DOT11_OID_ATIMWINDOW, - DOT11_OID_LISTENINTERVAL, - DOT11_OID_CFPPERIOD, - DOT11_OID_CFPDURATION, - - DOT11_OID_AUTHENABLE, - DOT11_OID_PRIVACYINVOKED, - DOT11_OID_EXUNENCRYPTED, - DOT11_OID_DEFKEYID, - DOT11_OID_DEFKEYX, /* DOT11_OID_DEFKEY1,...DOT11_OID_DEFKEY4 */ - DOT11_OID_STAKEY, - DOT11_OID_REKEYTHRESHOLD, - DOT11_OID_STASC, - - DOT11_OID_PRIVTXREJECTED, - DOT11_OID_PRIVRXPLAIN, - DOT11_OID_PRIVRXFAILED, - DOT11_OID_PRIVRXNOKEY, - - DOT11_OID_RTSTHRESH, - DOT11_OID_FRAGTHRESH, - DOT11_OID_SHORTRETRIES, - DOT11_OID_LONGRETRIES, - DOT11_OID_MAXTXLIFETIME, - DOT11_OID_MAXRXLIFETIME, - DOT11_OID_AUTHRESPTIMEOUT, - DOT11_OID_ASSOCRESPTIMEOUT, - - DOT11_OID_ALOFT_TABLE, - DOT11_OID_ALOFT_CTRL_TABLE, - DOT11_OID_ALOFT_RETREAT, - DOT11_OID_ALOFT_PROGRESS, - DOT11_OID_ALOFT_FIXEDRATE, - DOT11_OID_ALOFT_RSSIGRAPH, - DOT11_OID_ALOFT_CONFIG, - - DOT11_OID_VDCFX, - DOT11_OID_MAXFRAMEBURST, - - DOT11_OID_PSM, - DOT11_OID_CAMTIMEOUT, - DOT11_OID_RECEIVEDTIMS, - DOT11_OID_ROAMPREFERENCE, - - DOT11_OID_BRIDGELOCAL, - DOT11_OID_CLIENTS, - DOT11_OID_CLIENTSASSOCIATED, - DOT11_OID_CLIENTX, /* DOT11_OID_CLIENTX,...DOT11_OID_CLIENT2007 */ - - DOT11_OID_CLIENTFIND, - DOT11_OID_WDSLINKADD, - DOT11_OID_WDSLINKREMOVE, - DOT11_OID_EAPAUTHSTA, - DOT11_OID_EAPUNAUTHSTA, - DOT11_OID_DOT1XENABLE, - DOT11_OID_MICFAILURE, - DOT11_OID_REKEYINDICATE, - - DOT11_OID_MPDUTXSUCCESSFUL, - DOT11_OID_MPDUTXONERETRY, - DOT11_OID_MPDUTXMULTIPLERETRIES, - DOT11_OID_MPDUTXFAILED, - DOT11_OID_MPDURXSUCCESSFUL, - DOT11_OID_MPDURXDUPS, - DOT11_OID_RTSSUCCESSFUL, - DOT11_OID_RTSFAILED, - DOT11_OID_ACKFAILED, - DOT11_OID_FRAMERECEIVES, - DOT11_OID_FRAMEERRORS, - DOT11_OID_FRAMEABORTS, - DOT11_OID_FRAMEABORTSPHY, - - DOT11_OID_SLOTTIME, - DOT11_OID_CWMIN, /* MIN DCS backoff */ - DOT11_OID_CWMAX, /* MAX DCS backoff */ - DOT11_OID_ACKWINDOW, - DOT11_OID_ANTENNARX, - DOT11_OID_ANTENNATX, - DOT11_OID_ANTENNADIVERSITY, - DOT11_OID_CHANNEL, - DOT11_OID_EDTHRESHOLD, - DOT11_OID_PREAMBLESETTINGS, - DOT11_OID_RATES, - DOT11_OID_CCAMODESUPPORTED, - DOT11_OID_CCAMODE, - DOT11_OID_RSSIVECTOR, - DOT11_OID_OUTPUTPOWERTABLE, - DOT11_OID_OUTPUTPOWER, - DOT11_OID_SUPPORTEDRATES, - DOT11_OID_FREQUENCY, - DOT11_OID_SUPPORTEDFREQUENCIES, - DOT11_OID_NOISEFLOOR, - DOT11_OID_FREQUENCYACTIVITY, - DOT11_OID_IQCALIBRATIONTABLE, - DOT11_OID_NONERPPROTECTION, - DOT11_OID_SLOTSETTINGS, - DOT11_OID_NONERPTIMEOUT, - DOT11_OID_PROFILES, - DOT11_OID_EXTENDEDRATES, - - DOT11_OID_DEAUTHENTICATE, - DOT11_OID_AUTHENTICATE, - DOT11_OID_DISASSOCIATE, - DOT11_OID_ASSOCIATE, - DOT11_OID_SCAN, - DOT11_OID_BEACON, - DOT11_OID_PROBE, - DOT11_OID_DEAUTHENTICATEEX, - DOT11_OID_AUTHENTICATEEX, - DOT11_OID_DISASSOCIATEEX, - DOT11_OID_ASSOCIATEEX, - DOT11_OID_REASSOCIATE, - DOT11_OID_REASSOCIATEEX, - - DOT11_OID_NONERPSTATUS, - - DOT11_OID_STATIMEOUT, - DOT11_OID_MLMEAUTOLEVEL, - DOT11_OID_BSSTIMEOUT, - DOT11_OID_ATTACHMENT, - DOT11_OID_PSMBUFFER, - - DOT11_OID_BSSS, - DOT11_OID_BSSX, /*DOT11_OID_BSS1,...,DOT11_OID_BSS64 */ - DOT11_OID_BSSFIND, - DOT11_OID_BSSLIST, - - OID_INL_TUNNEL, - OID_INL_MEMADDR, - OID_INL_MEMORY, - OID_INL_MODE, - OID_INL_COMPONENT_NR, - OID_INL_VERSION, - OID_INL_INTERFACE_ID, - OID_INL_COMPONENT_ID, - OID_INL_CONFIG, - OID_INL_DOT11D_CONFORMANCE, - OID_INL_PHYCAPABILITIES, - OID_INL_OUTPUTPOWER, - - OID_NUM_LAST -}; - -#define OID_FLAG_CACHED 0x80 -#define OID_FLAG_TYPE 0x7f - -#define OID_TYPE_U32 0x01 -#define OID_TYPE_SSID 0x02 -#define OID_TYPE_KEY 0x03 -#define OID_TYPE_BUFFER 0x04 -#define OID_TYPE_BSS 0x05 -#define OID_TYPE_BSSLIST 0x06 -#define OID_TYPE_FREQUENCIES 0x07 -#define OID_TYPE_MLME 0x08 -#define OID_TYPE_MLMEEX 0x09 -#define OID_TYPE_ADDR 0x0A -#define OID_TYPE_RAW 0x0B -#define OID_TYPE_ATTACH 0x0C - -/* OID_TYPE_MLMEEX is special because of a variable size field when sending. - * Not yet implemented (not used in driver anyway). - */ - -struct oid_t { - enum oid_num_t oid; - short range; /* to define a range of oid */ - short size; /* max size of the associated data */ - char flags; -}; - -union oid_res_t { - void *ptr; - u32 u; -}; - -#define IWMAX_BITRATES 20 -#define IWMAX_BSS 24 -#define IWMAX_FREQ 30 -#define PRIV_STR_SIZE 1024 - -#endif /* !defined(_ISL_OID_H) */ -/* EOF */ diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c deleted file mode 100644 index d498b02f2d01..000000000000 --- a/drivers/net/wireless/prism54/islpci_dev.c +++ /dev/null @@ -1,965 +0,0 @@ -/* - * Copyright (C) 2002 Intersil Americas Inc. - * Copyright (C) 2003 Herbert Valerio Riedel - * Copyright (C) 2003 Luis R. Rodriguez - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "prismcompat.h" -#include "isl_38xx.h" -#include "isl_ioctl.h" -#include "islpci_dev.h" -#include "islpci_mgt.h" -#include "islpci_eth.h" -#include "oid_mgt.h" - -#define ISL3877_IMAGE_FILE "isl3877" -#define ISL3886_IMAGE_FILE "isl3886" -#define ISL3890_IMAGE_FILE "isl3890" -MODULE_FIRMWARE(ISL3877_IMAGE_FILE); -MODULE_FIRMWARE(ISL3886_IMAGE_FILE); -MODULE_FIRMWARE(ISL3890_IMAGE_FILE); - -static int prism54_bring_down(islpci_private *); -static int islpci_alloc_memory(islpci_private *); - -/* Temporary dummy MAC address to use until firmware is loaded. - * The idea there is that some tools (such as nameif) may query - * the MAC address before the netdev is 'open'. By using a valid - * OUI prefix, they can process the netdev properly. - * Of course, this is not the final/real MAC address. It doesn't - * matter, as you are suppose to be able to change it anytime via - * ndev->set_mac_address. Jean II */ -static const unsigned char dummy_mac[6] = { 0x00, 0x30, 0xB4, 0x00, 0x00, 0x00 }; - -static int -isl_upload_firmware(islpci_private *priv) -{ - u32 reg, rc; - void __iomem *device_base = priv->device_base; - - /* clear the RAMBoot and the Reset bit */ - reg = readl(device_base + ISL38XX_CTRL_STAT_REG); - reg &= ~ISL38XX_CTRL_STAT_RESET; - reg &= ~ISL38XX_CTRL_STAT_RAMBOOT; - writel(reg, device_base + ISL38XX_CTRL_STAT_REG); - wmb(); - udelay(ISL38XX_WRITEIO_DELAY); - - /* set the Reset bit without reading the register ! */ - reg |= ISL38XX_CTRL_STAT_RESET; - writel(reg, device_base + ISL38XX_CTRL_STAT_REG); - wmb(); - udelay(ISL38XX_WRITEIO_DELAY); - - /* clear the Reset bit */ - reg &= ~ISL38XX_CTRL_STAT_RESET; - writel(reg, device_base + ISL38XX_CTRL_STAT_REG); - wmb(); - - /* wait a while for the device to reboot */ - mdelay(50); - - { - const struct firmware *fw_entry = NULL; - long fw_len; - const u32 *fw_ptr; - - rc = request_firmware(&fw_entry, priv->firmware, PRISM_FW_PDEV); - if (rc) { - printk(KERN_ERR - "%s: request_firmware() failed for '%s'\n", - "prism54", priv->firmware); - return rc; - } - /* prepare the Direct Memory Base register */ - reg = ISL38XX_DEV_FIRMWARE_ADDRES; - - fw_ptr = (u32 *) fw_entry->data; - fw_len = fw_entry->size; - - if (fw_len % 4) { - printk(KERN_ERR - "%s: firmware '%s' size is not multiple of 32bit, aborting!\n", - "prism54", priv->firmware); - release_firmware(fw_entry); - return -EILSEQ; /* Illegal byte sequence */; - } - - while (fw_len > 0) { - long _fw_len = - (fw_len > - ISL38XX_MEMORY_WINDOW_SIZE) ? - ISL38XX_MEMORY_WINDOW_SIZE : fw_len; - u32 __iomem *dev_fw_ptr = device_base + ISL38XX_DIRECT_MEM_WIN; - - /* set the card's base address for writing the data */ - isl38xx_w32_flush(device_base, reg, - ISL38XX_DIR_MEM_BASE_REG); - wmb(); /* be paranoid */ - - /* increment the write address for next iteration */ - reg += _fw_len; - fw_len -= _fw_len; - - /* write the data to the Direct Memory Window 32bit-wise */ - /* memcpy_toio() doesn't guarantee 32bit writes :-| */ - while (_fw_len > 0) { - /* use non-swapping writel() */ - __raw_writel(*fw_ptr, dev_fw_ptr); - fw_ptr++, dev_fw_ptr++; - _fw_len -= 4; - } - - /* flush PCI posting */ - (void) readl(device_base + ISL38XX_PCI_POSTING_FLUSH); - wmb(); /* be paranoid again */ - - BUG_ON(_fw_len != 0); - } - - BUG_ON(fw_len != 0); - - /* Firmware version is at offset 40 (also for "newmac") */ - printk(KERN_DEBUG "%s: firmware version: %.8s\n", - priv->ndev->name, fw_entry->data + 40); - - release_firmware(fw_entry); - } - - /* now reset the device - * clear the Reset & ClkRun bit, set the RAMBoot bit */ - reg = readl(device_base + ISL38XX_CTRL_STAT_REG); - reg &= ~ISL38XX_CTRL_STAT_CLKRUN; - reg &= ~ISL38XX_CTRL_STAT_RESET; - reg |= ISL38XX_CTRL_STAT_RAMBOOT; - isl38xx_w32_flush(device_base, reg, ISL38XX_CTRL_STAT_REG); - wmb(); - udelay(ISL38XX_WRITEIO_DELAY); - - /* set the reset bit latches the host override and RAMBoot bits - * into the device for operation when the reset bit is reset */ - reg |= ISL38XX_CTRL_STAT_RESET; - writel(reg, device_base + ISL38XX_CTRL_STAT_REG); - /* don't do flush PCI posting here! */ - wmb(); - udelay(ISL38XX_WRITEIO_DELAY); - - /* clear the reset bit should start the whole circus */ - reg &= ~ISL38XX_CTRL_STAT_RESET; - writel(reg, device_base + ISL38XX_CTRL_STAT_REG); - /* don't do flush PCI posting here! */ - wmb(); - udelay(ISL38XX_WRITEIO_DELAY); - - return 0; -} - -/****************************************************************************** - Device Interrupt Handler -******************************************************************************/ - -irqreturn_t -islpci_interrupt(int irq, void *config) -{ - u32 reg; - islpci_private *priv = config; - struct net_device *ndev = priv->ndev; - void __iomem *device = priv->device_base; - int powerstate = ISL38XX_PSM_POWERSAVE_STATE; - - /* lock the interrupt handler */ - spin_lock(&priv->slock); - - /* received an interrupt request on a shared IRQ line - * first check whether the device is in sleep mode */ - reg = readl(device + ISL38XX_CTRL_STAT_REG); - if (reg & ISL38XX_CTRL_STAT_SLEEPMODE) - /* device is in sleep mode, IRQ was generated by someone else */ - { -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, "Assuming someone else called the IRQ\n"); -#endif - spin_unlock(&priv->slock); - return IRQ_NONE; - } - - - /* check whether there is any source of interrupt on the device */ - reg = readl(device + ISL38XX_INT_IDENT_REG); - - /* also check the contents of the Interrupt Enable Register, because this - * will filter out interrupt sources from other devices on the same irq ! */ - reg &= readl(device + ISL38XX_INT_EN_REG); - reg &= ISL38XX_INT_SOURCES; - - if (reg != 0) { - if (islpci_get_state(priv) != PRV_STATE_SLEEP) - powerstate = ISL38XX_PSM_ACTIVE_STATE; - - /* reset the request bits in the Identification register */ - isl38xx_w32_flush(device, reg, ISL38XX_INT_ACK_REG); - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_FUNCTION_CALLS, - "IRQ: Identification register 0x%p 0x%x\n", device, reg); -#endif - - /* check for each bit in the register separately */ - if (reg & ISL38XX_INT_IDENT_UPDATE) { -#if VERBOSE > SHOW_ERROR_MESSAGES - /* Queue has been updated */ - DEBUG(SHOW_TRACING, "IRQ: Update flag\n"); - - DEBUG(SHOW_QUEUE_INDEXES, - "CB drv Qs: [%i][%i][%i][%i][%i][%i]\n", - le32_to_cpu(priv->control_block-> - driver_curr_frag[0]), - le32_to_cpu(priv->control_block-> - driver_curr_frag[1]), - le32_to_cpu(priv->control_block-> - driver_curr_frag[2]), - le32_to_cpu(priv->control_block-> - driver_curr_frag[3]), - le32_to_cpu(priv->control_block-> - driver_curr_frag[4]), - le32_to_cpu(priv->control_block-> - driver_curr_frag[5]) - ); - - DEBUG(SHOW_QUEUE_INDEXES, - "CB dev Qs: [%i][%i][%i][%i][%i][%i]\n", - le32_to_cpu(priv->control_block-> - device_curr_frag[0]), - le32_to_cpu(priv->control_block-> - device_curr_frag[1]), - le32_to_cpu(priv->control_block-> - device_curr_frag[2]), - le32_to_cpu(priv->control_block-> - device_curr_frag[3]), - le32_to_cpu(priv->control_block-> - device_curr_frag[4]), - le32_to_cpu(priv->control_block-> - device_curr_frag[5]) - ); -#endif - - /* cleanup the data low transmit queue */ - islpci_eth_cleanup_transmit(priv, priv->control_block); - - /* device is in active state, update the - * powerstate flag if necessary */ - powerstate = ISL38XX_PSM_ACTIVE_STATE; - - /* check all three queues in priority order - * call the PIMFOR receive function until the - * queue is empty */ - if (isl38xx_in_queue(priv->control_block, - ISL38XX_CB_RX_MGMTQ) != 0) { -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, - "Received frame in Management Queue\n"); -#endif - islpci_mgt_receive(ndev); - - islpci_mgt_cleanup_transmit(ndev); - - /* Refill slots in receive queue */ - islpci_mgmt_rx_fill(ndev); - - /* no need to trigger the device, next - islpci_mgt_transaction does it */ - } - - while (isl38xx_in_queue(priv->control_block, - ISL38XX_CB_RX_DATA_LQ) != 0) { -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, - "Received frame in Data Low Queue\n"); -#endif - islpci_eth_receive(priv); - } - - /* check whether the data transmit queues were full */ - if (priv->data_low_tx_full) { - /* check whether the transmit is not full anymore */ - if (ISL38XX_CB_TX_QSIZE - - isl38xx_in_queue(priv->control_block, - ISL38XX_CB_TX_DATA_LQ) >= - ISL38XX_MIN_QTHRESHOLD) { - /* nope, the driver is ready for more network frames */ - netif_wake_queue(priv->ndev); - - /* reset the full flag */ - priv->data_low_tx_full = 0; - } - } - } - - if (reg & ISL38XX_INT_IDENT_INIT) { - /* Device has been initialized */ -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, - "IRQ: Init flag, device initialized\n"); -#endif - wake_up(&priv->reset_done); - } - - if (reg & ISL38XX_INT_IDENT_SLEEP) { - /* Device intends to move to powersave state */ -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, "IRQ: Sleep flag\n"); -#endif - isl38xx_handle_sleep_request(priv->control_block, - &powerstate, - priv->device_base); - } - - if (reg & ISL38XX_INT_IDENT_WAKEUP) { - /* Device has been woken up to active state */ -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, "IRQ: Wakeup flag\n"); -#endif - - isl38xx_handle_wakeup(priv->control_block, - &powerstate, priv->device_base); - } - } else { -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, "Assuming someone else called the IRQ\n"); -#endif - spin_unlock(&priv->slock); - return IRQ_NONE; - } - - /* sleep -> ready */ - if (islpci_get_state(priv) == PRV_STATE_SLEEP - && powerstate == ISL38XX_PSM_ACTIVE_STATE) - islpci_set_state(priv, PRV_STATE_READY); - - /* !sleep -> sleep */ - if (islpci_get_state(priv) != PRV_STATE_SLEEP - && powerstate == ISL38XX_PSM_POWERSAVE_STATE) - islpci_set_state(priv, PRV_STATE_SLEEP); - - /* unlock the interrupt handler */ - spin_unlock(&priv->slock); - - return IRQ_HANDLED; -} - -/****************************************************************************** - Network Interface Control & Statistical functions -******************************************************************************/ -static int -islpci_open(struct net_device *ndev) -{ - u32 rc; - islpci_private *priv = netdev_priv(ndev); - - /* reset data structures, upload firmware and reset device */ - rc = islpci_reset(priv,1); - if (rc) { - prism54_bring_down(priv); - return rc; /* Returns informative message */ - } - - netif_start_queue(ndev); - - /* Turn off carrier if in STA or Ad-hoc mode. It will be turned on - * once the firmware receives a trap of being associated - * (GEN_OID_LINKSTATE). In other modes (AP or WDS or monitor) we - * should just leave the carrier on as its expected the firmware - * won't send us a trigger. */ - if (priv->iw_mode == IW_MODE_INFRA || priv->iw_mode == IW_MODE_ADHOC) - netif_carrier_off(ndev); - else - netif_carrier_on(ndev); - - return 0; -} - -static int -islpci_close(struct net_device *ndev) -{ - islpci_private *priv = netdev_priv(ndev); - - printk(KERN_DEBUG "%s: islpci_close ()\n", ndev->name); - - netif_stop_queue(ndev); - - return prism54_bring_down(priv); -} - -static int -prism54_bring_down(islpci_private *priv) -{ - void __iomem *device_base = priv->device_base; - u32 reg; - /* we are going to shutdown the device */ - islpci_set_state(priv, PRV_STATE_PREBOOT); - - /* disable all device interrupts in case they weren't */ - isl38xx_disable_interrupts(priv->device_base); - - /* For safety reasons, we may want to ensure that no DMA transfer is - * currently in progress by emptying the TX and RX queues. */ - - /* wait until interrupts have finished executing on other CPUs */ - synchronize_irq(priv->pdev->irq); - - reg = readl(device_base + ISL38XX_CTRL_STAT_REG); - reg &= ~(ISL38XX_CTRL_STAT_RESET | ISL38XX_CTRL_STAT_RAMBOOT); - writel(reg, device_base + ISL38XX_CTRL_STAT_REG); - wmb(); - udelay(ISL38XX_WRITEIO_DELAY); - - reg |= ISL38XX_CTRL_STAT_RESET; - writel(reg, device_base + ISL38XX_CTRL_STAT_REG); - wmb(); - udelay(ISL38XX_WRITEIO_DELAY); - - /* clear the Reset bit */ - reg &= ~ISL38XX_CTRL_STAT_RESET; - writel(reg, device_base + ISL38XX_CTRL_STAT_REG); - wmb(); - - /* wait a while for the device to reset */ - schedule_timeout_uninterruptible(msecs_to_jiffies(50)); - - return 0; -} - -static int -islpci_upload_fw(islpci_private *priv) -{ - islpci_state_t old_state; - u32 rc; - - old_state = islpci_set_state(priv, PRV_STATE_BOOT); - - printk(KERN_DEBUG "%s: uploading firmware...\n", priv->ndev->name); - - rc = isl_upload_firmware(priv); - if (rc) { - /* error uploading the firmware */ - printk(KERN_ERR "%s: could not upload firmware ('%s')\n", - priv->ndev->name, priv->firmware); - - islpci_set_state(priv, old_state); - return rc; - } - - printk(KERN_DEBUG "%s: firmware upload complete\n", - priv->ndev->name); - - islpci_set_state(priv, PRV_STATE_POSTBOOT); - - return 0; -} - -static int -islpci_reset_if(islpci_private *priv) -{ - long remaining; - int result = -ETIME; - int count; - - DEFINE_WAIT(wait); - prepare_to_wait(&priv->reset_done, &wait, TASK_UNINTERRUPTIBLE); - - /* now the last step is to reset the interface */ - isl38xx_interface_reset(priv->device_base, priv->device_host_address); - islpci_set_state(priv, PRV_STATE_PREINIT); - - for(count = 0; count < 2 && result; count++) { - /* The software reset acknowledge needs about 220 msec here. - * Be conservative and wait for up to one second. */ - - remaining = schedule_timeout_uninterruptible(HZ); - - if(remaining > 0) { - result = 0; - break; - } - - /* If we're here it's because our IRQ hasn't yet gone through. - * Retry a bit more... - */ - printk(KERN_ERR "%s: no 'reset complete' IRQ seen - retrying\n", - priv->ndev->name); - } - - finish_wait(&priv->reset_done, &wait); - - if (result) { - printk(KERN_ERR "%s: interface reset failure\n", priv->ndev->name); - return result; - } - - islpci_set_state(priv, PRV_STATE_INIT); - - /* Now that the device is 100% up, let's allow - * for the other interrupts -- - * NOTE: this is not *yet* true since we've only allowed the - * INIT interrupt on the IRQ line. We can perhaps poll - * the IRQ line until we know for sure the reset went through */ - isl38xx_enable_common_interrupts(priv->device_base); - - down_write(&priv->mib_sem); - result = mgt_commit(priv); - if (result) { - printk(KERN_ERR "%s: interface reset failure\n", priv->ndev->name); - up_write(&priv->mib_sem); - return result; - } - up_write(&priv->mib_sem); - - islpci_set_state(priv, PRV_STATE_READY); - - printk(KERN_DEBUG "%s: interface reset complete\n", priv->ndev->name); - return 0; -} - -int -islpci_reset(islpci_private *priv, int reload_firmware) -{ - isl38xx_control_block *cb = /* volatile not needed */ - (isl38xx_control_block *) priv->control_block; - unsigned counter; - int rc; - - if (reload_firmware) - islpci_set_state(priv, PRV_STATE_PREBOOT); - else - islpci_set_state(priv, PRV_STATE_POSTBOOT); - - printk(KERN_DEBUG "%s: resetting device...\n", priv->ndev->name); - - /* disable all device interrupts in case they weren't */ - isl38xx_disable_interrupts(priv->device_base); - - /* flush all management queues */ - priv->index_mgmt_tx = 0; - priv->index_mgmt_rx = 0; - - /* clear the indexes in the frame pointer */ - for (counter = 0; counter < ISL38XX_CB_QCOUNT; counter++) { - cb->driver_curr_frag[counter] = cpu_to_le32(0); - cb->device_curr_frag[counter] = cpu_to_le32(0); - } - - /* reset the mgmt receive queue */ - for (counter = 0; counter < ISL38XX_CB_MGMT_QSIZE; counter++) { - isl38xx_fragment *frag = &cb->rx_data_mgmt[counter]; - frag->size = cpu_to_le16(MGMT_FRAME_SIZE); - frag->flags = 0; - frag->address = cpu_to_le32(priv->mgmt_rx[counter].pci_addr); - } - - for (counter = 0; counter < ISL38XX_CB_RX_QSIZE; counter++) { - cb->rx_data_low[counter].address = - cpu_to_le32((u32) priv->pci_map_rx_address[counter]); - } - - /* since the receive queues are filled with empty fragments, now we can - * set the corresponding indexes in the Control Block */ - priv->control_block->driver_curr_frag[ISL38XX_CB_RX_DATA_LQ] = - cpu_to_le32(ISL38XX_CB_RX_QSIZE); - priv->control_block->driver_curr_frag[ISL38XX_CB_RX_MGMTQ] = - cpu_to_le32(ISL38XX_CB_MGMT_QSIZE); - - /* reset the remaining real index registers and full flags */ - priv->free_data_rx = 0; - priv->free_data_tx = 0; - priv->data_low_tx_full = 0; - - if (reload_firmware) { /* Should we load the firmware ? */ - /* now that the data structures are cleaned up, upload - * firmware and reset interface */ - rc = islpci_upload_fw(priv); - if (rc) { - printk(KERN_ERR "%s: islpci_reset: failure\n", - priv->ndev->name); - return rc; - } - } - - /* finally reset interface */ - rc = islpci_reset_if(priv); - if (rc) - printk(KERN_ERR "prism54: Your card/socket may be faulty, or IRQ line too busy :(\n"); - return rc; -} - -/****************************************************************************** - Network device configuration functions -******************************************************************************/ -static int -islpci_alloc_memory(islpci_private *priv) -{ - int counter; - -#if VERBOSE > SHOW_ERROR_MESSAGES - printk(KERN_DEBUG "islpci_alloc_memory\n"); -#endif - - /* remap the PCI device base address to accessible */ - if (!(priv->device_base = - ioremap(pci_resource_start(priv->pdev, 0), - ISL38XX_PCI_MEM_SIZE))) { - /* error in remapping the PCI device memory address range */ - printk(KERN_ERR "PCI memory remapping failed\n"); - return -1; - } - - /* memory layout for consistent DMA region: - * - * Area 1: Control Block for the device interface - * Area 2: Power Save Mode Buffer for temporary frame storage. Be aware that - * the number of supported stations in the AP determines the minimal - * size of the buffer ! - */ - - /* perform the allocation */ - priv->driver_mem_address = pci_alloc_consistent(priv->pdev, - HOST_MEM_BLOCK, - &priv-> - device_host_address); - - if (!priv->driver_mem_address) { - /* error allocating the block of PCI memory */ - printk(KERN_ERR "%s: could not allocate DMA memory, aborting!", - "prism54"); - return -1; - } - - /* assign the Control Block to the first address of the allocated area */ - priv->control_block = - (isl38xx_control_block *) priv->driver_mem_address; - - /* set the Power Save Buffer pointer directly behind the CB */ - priv->device_psm_buffer = - priv->device_host_address + CONTROL_BLOCK_SIZE; - - /* make sure all buffer pointers are initialized */ - for (counter = 0; counter < ISL38XX_CB_QCOUNT; counter++) { - priv->control_block->driver_curr_frag[counter] = cpu_to_le32(0); - priv->control_block->device_curr_frag[counter] = cpu_to_le32(0); - } - - priv->index_mgmt_rx = 0; - memset(priv->mgmt_rx, 0, sizeof(priv->mgmt_rx)); - memset(priv->mgmt_tx, 0, sizeof(priv->mgmt_tx)); - - /* allocate rx queue for management frames */ - if (islpci_mgmt_rx_fill(priv->ndev) < 0) - goto out_free; - - /* now get the data rx skb's */ - memset(priv->data_low_rx, 0, sizeof (priv->data_low_rx)); - memset(priv->pci_map_rx_address, 0, sizeof (priv->pci_map_rx_address)); - - for (counter = 0; counter < ISL38XX_CB_RX_QSIZE; counter++) { - struct sk_buff *skb; - - /* allocate an sk_buff for received data frames storage - * each frame on receive size consists of 1 fragment - * include any required allignment operations */ - if (!(skb = dev_alloc_skb(MAX_FRAGMENT_SIZE_RX + 2))) { - /* error allocating an sk_buff structure elements */ - printk(KERN_ERR "Error allocating skb.\n"); - skb = NULL; - goto out_free; - } - skb_reserve(skb, (4 - (long) skb->data) & 0x03); - /* add the new allocated sk_buff to the buffer array */ - priv->data_low_rx[counter] = skb; - - /* map the allocated skb data area to pci */ - priv->pci_map_rx_address[counter] = - pci_map_single(priv->pdev, (void *) skb->data, - MAX_FRAGMENT_SIZE_RX + 2, - PCI_DMA_FROMDEVICE); - if (!priv->pci_map_rx_address[counter]) { - /* error mapping the buffer to device - accessible memory address */ - printk(KERN_ERR "failed to map skb DMA'able\n"); - goto out_free; - } - } - - prism54_acl_init(&priv->acl); - prism54_wpa_bss_ie_init(priv); - if (mgt_init(priv)) - goto out_free; - - return 0; - out_free: - islpci_free_memory(priv); - return -1; -} - -int -islpci_free_memory(islpci_private *priv) -{ - int counter; - - if (priv->device_base) - iounmap(priv->device_base); - priv->device_base = NULL; - - /* free consistent DMA area... */ - if (priv->driver_mem_address) - pci_free_consistent(priv->pdev, HOST_MEM_BLOCK, - priv->driver_mem_address, - priv->device_host_address); - - /* clear some dangling pointers */ - priv->driver_mem_address = NULL; - priv->device_host_address = 0; - priv->device_psm_buffer = 0; - priv->control_block = NULL; - - /* clean up mgmt rx buffers */ - for (counter = 0; counter < ISL38XX_CB_MGMT_QSIZE; counter++) { - struct islpci_membuf *buf = &priv->mgmt_rx[counter]; - if (buf->pci_addr) - pci_unmap_single(priv->pdev, buf->pci_addr, - buf->size, PCI_DMA_FROMDEVICE); - buf->pci_addr = 0; - kfree(buf->mem); - buf->size = 0; - buf->mem = NULL; - } - - /* clean up data rx buffers */ - for (counter = 0; counter < ISL38XX_CB_RX_QSIZE; counter++) { - if (priv->pci_map_rx_address[counter]) - pci_unmap_single(priv->pdev, - priv->pci_map_rx_address[counter], - MAX_FRAGMENT_SIZE_RX + 2, - PCI_DMA_FROMDEVICE); - priv->pci_map_rx_address[counter] = 0; - - if (priv->data_low_rx[counter]) - dev_kfree_skb(priv->data_low_rx[counter]); - priv->data_low_rx[counter] = NULL; - } - - /* Free the access control list and the WPA list */ - prism54_acl_clean(&priv->acl); - prism54_wpa_bss_ie_clean(priv); - mgt_clean(priv); - - return 0; -} - -#if 0 -static void -islpci_set_multicast_list(struct net_device *dev) -{ - /* put device into promisc mode and let network layer handle it */ -} -#endif - -static void islpci_ethtool_get_drvinfo(struct net_device *dev, - struct ethtool_drvinfo *info) -{ - strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); - strlcpy(info->version, DRV_VERSION, sizeof(info->version)); -} - -static const struct ethtool_ops islpci_ethtool_ops = { - .get_drvinfo = islpci_ethtool_get_drvinfo, -}; - -static const struct net_device_ops islpci_netdev_ops = { - .ndo_open = islpci_open, - .ndo_stop = islpci_close, - .ndo_start_xmit = islpci_eth_transmit, - .ndo_tx_timeout = islpci_eth_tx_timeout, - .ndo_set_mac_address = prism54_set_mac_address, - .ndo_change_mtu = eth_change_mtu, - .ndo_validate_addr = eth_validate_addr, -}; - -static struct device_type wlan_type = { - .name = "wlan", -}; - -struct net_device * -islpci_setup(struct pci_dev *pdev) -{ - islpci_private *priv; - struct net_device *ndev = alloc_etherdev(sizeof (islpci_private)); - - if (!ndev) - return ndev; - - pci_set_drvdata(pdev, ndev); - SET_NETDEV_DEV(ndev, &pdev->dev); - SET_NETDEV_DEVTYPE(ndev, &wlan_type); - - /* setup the structure members */ - ndev->base_addr = pci_resource_start(pdev, 0); - ndev->irq = pdev->irq; - - /* initialize the function pointers */ - ndev->netdev_ops = &islpci_netdev_ops; - ndev->wireless_handlers = &prism54_handler_def; - ndev->ethtool_ops = &islpci_ethtool_ops; - - /* ndev->set_multicast_list = &islpci_set_multicast_list; */ - ndev->addr_len = ETH_ALEN; - /* Get a non-zero dummy MAC address for nameif. Jean II */ - memcpy(ndev->dev_addr, dummy_mac, 6); - - ndev->watchdog_timeo = ISLPCI_TX_TIMEOUT; - - /* allocate a private device structure to the network device */ - priv = netdev_priv(ndev); - priv->ndev = ndev; - priv->pdev = pdev; - priv->monitor_type = ARPHRD_IEEE80211; - priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR) ? - priv->monitor_type : ARPHRD_ETHER; - - /* Add pointers to enable iwspy support. */ - priv->wireless_data.spy_data = &priv->spy_data; - ndev->wireless_data = &priv->wireless_data; - - /* save the start and end address of the PCI memory area */ - ndev->mem_start = (unsigned long) priv->device_base; - ndev->mem_end = ndev->mem_start + ISL38XX_PCI_MEM_SIZE; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, "PCI Memory remapped to 0x%p\n", priv->device_base); -#endif - - init_waitqueue_head(&priv->reset_done); - - /* init the queue read locks, process wait counter */ - mutex_init(&priv->mgmt_lock); - priv->mgmt_received = NULL; - init_waitqueue_head(&priv->mgmt_wqueue); - mutex_init(&priv->stats_lock); - spin_lock_init(&priv->slock); - - /* init state machine with off#1 state */ - priv->state = PRV_STATE_OFF; - priv->state_off = 1; - - /* initialize workqueue's */ - INIT_WORK(&priv->stats_work, prism54_update_stats); - priv->stats_timestamp = 0; - - INIT_WORK(&priv->reset_task, islpci_do_reset_and_wake); - priv->reset_task_pending = 0; - - /* allocate various memory areas */ - if (islpci_alloc_memory(priv)) - goto do_free_netdev; - - /* select the firmware file depending on the device id */ - switch (pdev->device) { - case 0x3877: - strcpy(priv->firmware, ISL3877_IMAGE_FILE); - break; - - case 0x3886: - strcpy(priv->firmware, ISL3886_IMAGE_FILE); - break; - - default: - strcpy(priv->firmware, ISL3890_IMAGE_FILE); - break; - } - - if (register_netdev(ndev)) { - DEBUG(SHOW_ERROR_MESSAGES, - "ERROR: register_netdev() failed\n"); - goto do_islpci_free_memory; - } - - return ndev; - - do_islpci_free_memory: - islpci_free_memory(priv); - do_free_netdev: - pci_set_drvdata(pdev, NULL); - free_netdev(ndev); - priv = NULL; - return NULL; -} - -islpci_state_t -islpci_set_state(islpci_private *priv, islpci_state_t new_state) -{ - islpci_state_t old_state; - - /* lock */ - old_state = priv->state; - - /* this means either a race condition or some serious error in - * the driver code */ - switch (new_state) { - case PRV_STATE_OFF: - priv->state_off++; - default: - priv->state = new_state; - break; - - case PRV_STATE_PREBOOT: - /* there are actually many off-states, enumerated by - * state_off */ - if (old_state == PRV_STATE_OFF) - priv->state_off--; - - /* only if hw_unavailable is zero now it means we either - * were in off#1 state, or came here from - * somewhere else */ - if (!priv->state_off) - priv->state = new_state; - break; - } -#if 0 - printk(KERN_DEBUG "%s: state transition %d -> %d (off#%d)\n", - priv->ndev->name, old_state, new_state, priv->state_off); -#endif - - /* invariants */ - BUG_ON(priv->state_off < 0); - BUG_ON(priv->state_off && (priv->state != PRV_STATE_OFF)); - BUG_ON(!priv->state_off && (priv->state == PRV_STATE_OFF)); - - /* unlock */ - return old_state; -} diff --git a/drivers/net/wireless/prism54/islpci_dev.h b/drivers/net/wireless/prism54/islpci_dev.h deleted file mode 100644 index c40403877f97..000000000000 --- a/drivers/net/wireless/prism54/islpci_dev.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (C) 2002 Intersil Americas Inc. - * Copyright (C) 2003 Herbert Valerio Riedel - * Copyright (C) 2003 Luis R. Rodriguez - * Copyright (C) 2003 Aurelien Alleaume - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef _ISLPCI_DEV_H -#define _ISLPCI_DEV_H - -#include -#include -#include -#include -#include -#include - -#include "isl_38xx.h" -#include "isl_oid.h" -#include "islpci_mgt.h" - -/* some states might not be superflous and may be removed when - design is finalized (hvr) */ -typedef enum { - PRV_STATE_OFF = 0, /* this means hw_unavailable is != 0 */ - PRV_STATE_PREBOOT, /* we are in a pre-boot state (empty RAM) */ - PRV_STATE_BOOT, /* boot state (fw upload, run fw) */ - PRV_STATE_POSTBOOT, /* after boot state, need reset now */ - PRV_STATE_PREINIT, /* pre-init state */ - PRV_STATE_INIT, /* init state (restore MIB backup to device) */ - PRV_STATE_READY, /* driver&device are in operational state */ - PRV_STATE_SLEEP /* device in sleep mode */ -} islpci_state_t; - -/* ACL using MAC address */ -struct mac_entry { - struct list_head _list; - char addr[ETH_ALEN]; -}; - -struct islpci_acl { - enum { MAC_POLICY_OPEN=0, MAC_POLICY_ACCEPT=1, MAC_POLICY_REJECT=2 } policy; - struct list_head mac_list; /* a list of mac_entry */ - int size; /* size of queue */ - struct mutex lock; /* accessed in ioctls and trap_work */ -}; - -struct islpci_membuf { - int size; /* size of memory */ - void *mem; /* address of memory as seen by CPU */ - dma_addr_t pci_addr; /* address of memory as seen by device */ -}; - -#define MAX_BSS_WPA_IE_COUNT 64 -#define MAX_WPA_IE_LEN 64 -struct islpci_bss_wpa_ie { - struct list_head list; - unsigned long last_update; - u8 bssid[ETH_ALEN]; - u8 wpa_ie[MAX_WPA_IE_LEN]; - size_t wpa_ie_len; - -}; - -typedef struct { - spinlock_t slock; /* generic spinlock; */ - - u32 priv_oid; - - /* our mib cache */ - u32 iw_mode; - struct rw_semaphore mib_sem; - void **mib; - char nickname[IW_ESSID_MAX_SIZE+1]; - - /* Take care of the wireless stats */ - struct work_struct stats_work; - struct mutex stats_lock; - /* remember when we last updated the stats */ - unsigned long stats_timestamp; - /* The first is accessed under semaphore locking. - * The second is the clean one we return to iwconfig. - */ - struct iw_statistics local_iwstatistics; - struct iw_statistics iwstatistics; - - struct iw_spy_data spy_data; /* iwspy support */ - - struct iw_public_data wireless_data; - - int monitor_type; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */ - - struct islpci_acl acl; - - /* PCI bus allocation & configuration members */ - struct pci_dev *pdev; /* PCI structure information */ - char firmware[33]; - - void __iomem *device_base; /* ioremapped device base address */ - - /* consistent DMA region */ - void *driver_mem_address; /* base DMA address */ - dma_addr_t device_host_address; /* base DMA address (bus address) */ - dma_addr_t device_psm_buffer; /* host memory for PSM buffering (bus address) */ - - /* our network_device structure */ - struct net_device *ndev; - - /* device queue interface members */ - struct isl38xx_cb *control_block; /* device control block - (== driver_mem_address!) */ - - /* Each queue has three indexes: - * free/index_mgmt/data_rx/tx (called index, see below), - * driver_curr_frag, and device_curr_frag (in the control block) - * All indexes are ever-increasing, but interpreted modulo the - * device queue size when used. - * index <= device_curr_frag <= driver_curr_frag at all times - * For rx queues, [index, device_curr_frag) contains fragments - * that the interrupt processing needs to handle (owned by driver). - * [device_curr_frag, driver_curr_frag) is the free space in the - * rx queue, waiting for data (owned by device). The driver - * increments driver_curr_frag to indicate to the device that more - * buffers are available. - * If device_curr_frag == driver_curr_frag, no more rx buffers are - * available, and the rx DMA engine of the device is halted. - * For tx queues, [index, device_curr_frag) contains fragments - * where tx is done; they need to be freed (owned by driver). - * [device_curr_frag, driver_curr_frag) contains the frames - * that are being transferred (owned by device). The driver - * increments driver_curr_frag to indicate that more tx work - * needs to be done. - */ - u32 index_mgmt_rx; /* real index mgmt rx queue */ - u32 index_mgmt_tx; /* read index mgmt tx queue */ - u32 free_data_rx; /* free pointer data rx queue */ - u32 free_data_tx; /* free pointer data tx queue */ - u32 data_low_tx_full; /* full detected flag */ - - /* frame memory buffers for the device queues */ - struct islpci_membuf mgmt_tx[ISL38XX_CB_MGMT_QSIZE]; - struct islpci_membuf mgmt_rx[ISL38XX_CB_MGMT_QSIZE]; - struct sk_buff *data_low_tx[ISL38XX_CB_TX_QSIZE]; - struct sk_buff *data_low_rx[ISL38XX_CB_RX_QSIZE]; - dma_addr_t pci_map_tx_address[ISL38XX_CB_TX_QSIZE]; - dma_addr_t pci_map_rx_address[ISL38XX_CB_RX_QSIZE]; - - /* wait for a reset interrupt */ - wait_queue_head_t reset_done; - - /* used by islpci_mgt_transaction */ - struct mutex mgmt_lock; /* serialize access to mailbox and wqueue */ - struct islpci_mgmtframe *mgmt_received; /* mbox for incoming frame */ - wait_queue_head_t mgmt_wqueue; /* waitqueue for mbox */ - - /* state machine */ - islpci_state_t state; - int state_off; /* enumeration of off-state, if 0 then - * we're not in any off-state */ - - /* WPA stuff */ - int wpa; /* WPA mode enabled */ - struct list_head bss_wpa_list; - int num_bss_wpa; - struct mutex wpa_lock; - u8 wpa_ie[MAX_WPA_IE_LEN]; - size_t wpa_ie_len; - - struct work_struct reset_task; - int reset_task_pending; -} islpci_private; - -static inline islpci_state_t -islpci_get_state(islpci_private *priv) -{ - /* lock */ - return priv->state; - /* unlock */ -} - -islpci_state_t islpci_set_state(islpci_private *priv, islpci_state_t new_state); - -#define ISLPCI_TX_TIMEOUT (2*HZ) - -irqreturn_t islpci_interrupt(int, void *); - -int prism54_post_setup(islpci_private *, int); -int islpci_reset(islpci_private *, int); - -static inline void -islpci_trigger(islpci_private *priv) -{ - isl38xx_trigger_device(islpci_get_state(priv) == PRV_STATE_SLEEP, - priv->device_base); -} - -int islpci_free_memory(islpci_private *); -struct net_device *islpci_setup(struct pci_dev *); - -#define DRV_NAME "prism54" -#define DRV_VERSION "1.2" - -#endif /* _ISLPCI_DEV_H */ diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c deleted file mode 100644 index 799e148d0370..000000000000 --- a/drivers/net/wireless/prism54/islpci_eth.c +++ /dev/null @@ -1,507 +0,0 @@ -/* - * Copyright (C) 2002 Intersil Americas Inc. - * Copyright (C) 2004 Aurelien Alleaume - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "prismcompat.h" -#include "isl_38xx.h" -#include "islpci_eth.h" -#include "islpci_mgt.h" -#include "oid_mgt.h" - -/****************************************************************************** - Network Interface functions -******************************************************************************/ -void -islpci_eth_cleanup_transmit(islpci_private *priv, - isl38xx_control_block *control_block) -{ - struct sk_buff *skb; - u32 index; - - /* compare the control block read pointer with the free pointer */ - while (priv->free_data_tx != - le32_to_cpu(control_block-> - device_curr_frag[ISL38XX_CB_TX_DATA_LQ])) { - /* read the index of the first fragment to be freed */ - index = priv->free_data_tx % ISL38XX_CB_TX_QSIZE; - - /* check for holes in the arrays caused by multi fragment frames - * searching for the last fragment of a frame */ - if (priv->pci_map_tx_address[index]) { - /* entry is the last fragment of a frame - * free the skb structure and unmap pci memory */ - skb = priv->data_low_tx[index]; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, - "cleanup skb %p skb->data %p skb->len %u truesize %u\n ", - skb, skb->data, skb->len, skb->truesize); -#endif - - pci_unmap_single(priv->pdev, - priv->pci_map_tx_address[index], - skb->len, PCI_DMA_TODEVICE); - dev_kfree_skb_irq(skb); - skb = NULL; - } - /* increment the free data low queue pointer */ - priv->free_data_tx++; - } -} - -netdev_tx_t -islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) -{ - islpci_private *priv = netdev_priv(ndev); - isl38xx_control_block *cb = priv->control_block; - u32 index; - dma_addr_t pci_map_address; - int frame_size; - isl38xx_fragment *fragment; - int offset; - struct sk_buff *newskb; - int newskb_offset; - unsigned long flags; - unsigned char wds_mac[6]; - u32 curr_frag; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_FUNCTION_CALLS, "islpci_eth_transmit\n"); -#endif - - /* lock the driver code */ - spin_lock_irqsave(&priv->slock, flags); - - /* check whether the destination queue has enough fragments for the frame */ - curr_frag = le32_to_cpu(cb->driver_curr_frag[ISL38XX_CB_TX_DATA_LQ]); - if (unlikely(curr_frag - priv->free_data_tx >= ISL38XX_CB_TX_QSIZE)) { - printk(KERN_ERR "%s: transmit device queue full when awake\n", - ndev->name); - netif_stop_queue(ndev); - - /* trigger the device */ - isl38xx_w32_flush(priv->device_base, ISL38XX_DEV_INT_UPDATE, - ISL38XX_DEV_INT_REG); - udelay(ISL38XX_WRITEIO_DELAY); - goto drop_free; - } - /* Check alignment and WDS frame formatting. The start of the packet should - * be aligned on a 4-byte boundary. If WDS is enabled add another 6 bytes - * and add WDS address information */ - if (likely(((long) skb->data & 0x03) | init_wds)) { - /* get the number of bytes to add and re-align */ - offset = (4 - (long) skb->data) & 0x03; - offset += init_wds ? 6 : 0; - - /* check whether the current skb can be used */ - if (!skb_cloned(skb) && (skb_tailroom(skb) >= offset)) { - unsigned char *src = skb->data; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, "skb offset %i wds %i\n", offset, - init_wds); -#endif - - /* align the buffer on 4-byte boundary */ - skb_reserve(skb, (4 - (long) skb->data) & 0x03); - if (init_wds) { - /* wds requires an additional address field of 6 bytes */ - skb_put(skb, 6); -#ifdef ISLPCI_ETH_DEBUG - printk("islpci_eth_transmit:wds_mac\n"); -#endif - memmove(skb->data + 6, src, skb->len); - skb_copy_to_linear_data(skb, wds_mac, 6); - } else { - memmove(skb->data, src, skb->len); - } - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, "memmove %p %p %i\n", skb->data, - src, skb->len); -#endif - } else { - newskb = - dev_alloc_skb(init_wds ? skb->len + 6 : skb->len); - if (unlikely(newskb == NULL)) { - printk(KERN_ERR "%s: Cannot allocate skb\n", - ndev->name); - goto drop_free; - } - newskb_offset = (4 - (long) newskb->data) & 0x03; - - /* Check if newskb->data is aligned */ - if (newskb_offset) - skb_reserve(newskb, newskb_offset); - - skb_put(newskb, init_wds ? skb->len + 6 : skb->len); - if (init_wds) { - skb_copy_from_linear_data(skb, - newskb->data + 6, - skb->len); - skb_copy_to_linear_data(newskb, wds_mac, 6); -#ifdef ISLPCI_ETH_DEBUG - printk("islpci_eth_transmit:wds_mac\n"); -#endif - } else - skb_copy_from_linear_data(skb, newskb->data, - skb->len); - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, "memcpy %p %p %i wds %i\n", - newskb->data, skb->data, skb->len, init_wds); -#endif - - newskb->dev = skb->dev; - dev_kfree_skb_irq(skb); - skb = newskb; - } - } - /* display the buffer contents for debugging */ -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_BUFFER_CONTENTS, "\ntx %p ", skb->data); - display_buffer((char *) skb->data, skb->len); -#endif - - /* map the skb buffer to pci memory for DMA operation */ - pci_map_address = pci_map_single(priv->pdev, - (void *) skb->data, skb->len, - PCI_DMA_TODEVICE); - if (unlikely(pci_map_address == 0)) { - printk(KERN_WARNING "%s: cannot map buffer to PCI\n", - ndev->name); - goto drop_free; - } - /* Place the fragment in the control block structure. */ - index = curr_frag % ISL38XX_CB_TX_QSIZE; - fragment = &cb->tx_data_low[index]; - - priv->pci_map_tx_address[index] = pci_map_address; - /* store the skb address for future freeing */ - priv->data_low_tx[index] = skb; - /* set the proper fragment start address and size information */ - frame_size = skb->len; - fragment->size = cpu_to_le16(frame_size); - fragment->flags = cpu_to_le16(0); /* set to 1 if more fragments */ - fragment->address = cpu_to_le32(pci_map_address); - curr_frag++; - - /* The fragment address in the control block must have been - * written before announcing the frame buffer to device. */ - wmb(); - cb->driver_curr_frag[ISL38XX_CB_TX_DATA_LQ] = cpu_to_le32(curr_frag); - - if (curr_frag - priv->free_data_tx + ISL38XX_MIN_QTHRESHOLD - > ISL38XX_CB_TX_QSIZE) { - /* stop sends from upper layers */ - netif_stop_queue(ndev); - - /* set the full flag for the transmission queue */ - priv->data_low_tx_full = 1; - } - - ndev->stats.tx_packets++; - ndev->stats.tx_bytes += skb->len; - - /* trigger the device */ - islpci_trigger(priv); - - /* unlock the driver code */ - spin_unlock_irqrestore(&priv->slock, flags); - - return NETDEV_TX_OK; - - drop_free: - ndev->stats.tx_dropped++; - spin_unlock_irqrestore(&priv->slock, flags); - dev_kfree_skb(skb); - return NETDEV_TX_OK; -} - -static inline int -islpci_monitor_rx(islpci_private *priv, struct sk_buff **skb) -{ - /* The card reports full 802.11 packets but with a 20 bytes - * header and without the FCS. But there a is a bit that - * indicates if the packet is corrupted :-) */ - struct rfmon_header *hdr = (struct rfmon_header *) (*skb)->data; - - if (hdr->flags & 0x01) - /* This one is bad. Drop it ! */ - return -1; - if (priv->ndev->type == ARPHRD_IEEE80211_PRISM) { - struct avs_80211_1_header *avs; - /* extract the relevant data from the header */ - u32 clock = le32_to_cpu(hdr->clock); - u8 rate = hdr->rate; - u16 freq = le16_to_cpu(hdr->freq); - u8 rssi = hdr->rssi; - - skb_pull(*skb, sizeof (struct rfmon_header)); - - if (skb_headroom(*skb) < sizeof (struct avs_80211_1_header)) { - struct sk_buff *newskb = skb_copy_expand(*skb, - sizeof (struct - avs_80211_1_header), - 0, GFP_ATOMIC); - if (newskb) { - dev_kfree_skb_irq(*skb); - *skb = newskb; - } else - return -1; - /* This behavior is not very subtile... */ - } - - /* make room for the new header and fill it. */ - avs = - (struct avs_80211_1_header *) skb_push(*skb, - sizeof (struct - avs_80211_1_header)); - - avs->version = cpu_to_be32(P80211CAPTURE_VERSION); - avs->length = cpu_to_be32(sizeof (struct avs_80211_1_header)); - avs->mactime = cpu_to_be64(clock); - avs->hosttime = cpu_to_be64(jiffies); - avs->phytype = cpu_to_be32(6); /*OFDM: 6 for (g), 8 for (a) */ - avs->channel = cpu_to_be32(channel_of_freq(freq)); - avs->datarate = cpu_to_be32(rate * 5); - avs->antenna = cpu_to_be32(0); /*unknown */ - avs->priority = cpu_to_be32(0); /*unknown */ - avs->ssi_type = cpu_to_be32(3); /*2: dBm, 3: raw RSSI */ - avs->ssi_signal = cpu_to_be32(rssi & 0x7f); - avs->ssi_noise = cpu_to_be32(priv->local_iwstatistics.qual.noise); /*better than 'undefined', I assume */ - avs->preamble = cpu_to_be32(0); /*unknown */ - avs->encoding = cpu_to_be32(0); /*unknown */ - } else - skb_pull(*skb, sizeof (struct rfmon_header)); - - (*skb)->protocol = htons(ETH_P_802_2); - skb_reset_mac_header(*skb); - (*skb)->pkt_type = PACKET_OTHERHOST; - - return 0; -} - -int -islpci_eth_receive(islpci_private *priv) -{ - struct net_device *ndev = priv->ndev; - isl38xx_control_block *control_block = priv->control_block; - struct sk_buff *skb; - u16 size; - u32 index, offset; - unsigned char *src; - int discard = 0; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_FUNCTION_CALLS, "islpci_eth_receive\n"); -#endif - - /* the device has written an Ethernet frame in the data area - * of the sk_buff without updating the structure, do it now */ - index = priv->free_data_rx % ISL38XX_CB_RX_QSIZE; - size = le16_to_cpu(control_block->rx_data_low[index].size); - skb = priv->data_low_rx[index]; - offset = ((unsigned long) - le32_to_cpu(control_block->rx_data_low[index].address) - - (unsigned long) skb->data) & 3; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, - "frq->addr %x skb->data %p skb->len %u offset %u truesize %u\n ", - control_block->rx_data_low[priv->free_data_rx].address, skb->data, - skb->len, offset, skb->truesize); -#endif - - /* delete the streaming DMA mapping before processing the skb */ - pci_unmap_single(priv->pdev, - priv->pci_map_rx_address[index], - MAX_FRAGMENT_SIZE_RX + 2, PCI_DMA_FROMDEVICE); - - /* update the skb structure and align the buffer */ - skb_put(skb, size); - if (offset) { - /* shift the buffer allocation offset bytes to get the right frame */ - skb_pull(skb, 2); - skb_put(skb, 2); - } -#if VERBOSE > SHOW_ERROR_MESSAGES - /* display the buffer contents for debugging */ - DEBUG(SHOW_BUFFER_CONTENTS, "\nrx %p ", skb->data); - display_buffer((char *) skb->data, skb->len); -#endif - - /* check whether WDS is enabled and whether the data frame is a WDS frame */ - - if (init_wds) { - /* WDS enabled, check for the wds address on the first 6 bytes of the buffer */ - src = skb->data + 6; - memmove(skb->data, src, skb->len - 6); - skb_trim(skb, skb->len - 6); - } -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, "Fragment size %i in skb at %p\n", size, skb); - DEBUG(SHOW_TRACING, "Skb data at %p, length %i\n", skb->data, skb->len); - - /* display the buffer contents for debugging */ - DEBUG(SHOW_BUFFER_CONTENTS, "\nrx %p ", skb->data); - display_buffer((char *) skb->data, skb->len); -#endif - /* take care of monitor mode and spy monitoring. */ - if (unlikely(priv->iw_mode == IW_MODE_MONITOR)) { - skb->dev = ndev; - discard = islpci_monitor_rx(priv, &skb); - } else { - if (unlikely(skb->data[2 * ETH_ALEN] == 0)) { - /* The packet has a rx_annex. Read it for spy monitoring, Then - * remove it, while keeping the 2 leading MAC addr. - */ - struct iw_quality wstats; - struct rx_annex_header *annex = - (struct rx_annex_header *) skb->data; - wstats.level = annex->rfmon.rssi; - /* The noise value can be a bit outdated if nobody's - * reading wireless stats... */ - wstats.noise = priv->local_iwstatistics.qual.noise; - wstats.qual = wstats.level - wstats.noise; - wstats.updated = 0x07; - /* Update spy records */ - wireless_spy_update(ndev, annex->addr2, &wstats); - - skb_copy_from_linear_data(skb, - (skb->data + - sizeof(struct rfmon_header)), - 2 * ETH_ALEN); - skb_pull(skb, sizeof (struct rfmon_header)); - } - skb->protocol = eth_type_trans(skb, ndev); - } - skb->ip_summed = CHECKSUM_NONE; - ndev->stats.rx_packets++; - ndev->stats.rx_bytes += size; - - /* deliver the skb to the network layer */ -#ifdef ISLPCI_ETH_DEBUG - printk - ("islpci_eth_receive:netif_rx %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", - skb->data[0], skb->data[1], skb->data[2], skb->data[3], - skb->data[4], skb->data[5]); -#endif - if (unlikely(discard)) { - dev_kfree_skb_irq(skb); - skb = NULL; - } else - netif_rx(skb); - - /* increment the read index for the rx data low queue */ - priv->free_data_rx++; - - /* add one or more sk_buff structures */ - while (index = - le32_to_cpu(control_block-> - driver_curr_frag[ISL38XX_CB_RX_DATA_LQ]), - index - priv->free_data_rx < ISL38XX_CB_RX_QSIZE) { - /* allocate an sk_buff for received data frames storage - * include any required allignment operations */ - skb = dev_alloc_skb(MAX_FRAGMENT_SIZE_RX + 2); - if (unlikely(skb == NULL)) { - /* error allocating an sk_buff structure elements */ - DEBUG(SHOW_ERROR_MESSAGES, "Error allocating skb\n"); - break; - } - skb_reserve(skb, (4 - (long) skb->data) & 0x03); - /* store the new skb structure pointer */ - index = index % ISL38XX_CB_RX_QSIZE; - priv->data_low_rx[index] = skb; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, - "new alloc skb %p skb->data %p skb->len %u index %u truesize %u\n ", - skb, skb->data, skb->len, index, skb->truesize); -#endif - - /* set the streaming DMA mapping for proper PCI bus operation */ - priv->pci_map_rx_address[index] = - pci_map_single(priv->pdev, (void *) skb->data, - MAX_FRAGMENT_SIZE_RX + 2, - PCI_DMA_FROMDEVICE); - if (unlikely(!priv->pci_map_rx_address[index])) { - /* error mapping the buffer to device accessible memory address */ - DEBUG(SHOW_ERROR_MESSAGES, - "Error mapping DMA address\n"); - - /* free the skbuf structure before aborting */ - dev_kfree_skb_irq(skb); - skb = NULL; - break; - } - /* update the fragment address */ - control_block->rx_data_low[index].address = - cpu_to_le32((u32)priv->pci_map_rx_address[index]); - wmb(); - - /* increment the driver read pointer */ - le32_add_cpu(&control_block-> - driver_curr_frag[ISL38XX_CB_RX_DATA_LQ], 1); - } - - /* trigger the device */ - islpci_trigger(priv); - - return 0; -} - -void -islpci_do_reset_and_wake(struct work_struct *work) -{ - islpci_private *priv = container_of(work, islpci_private, reset_task); - - islpci_reset(priv, 1); - priv->reset_task_pending = 0; - smp_wmb(); - netif_wake_queue(priv->ndev); -} - -void -islpci_eth_tx_timeout(struct net_device *ndev) -{ - islpci_private *priv = netdev_priv(ndev); - - /* increment the transmit error counter */ - ndev->stats.tx_errors++; - - if (!priv->reset_task_pending) { - printk(KERN_WARNING - "%s: tx_timeout, scheduling reset", ndev->name); - netif_stop_queue(ndev); - priv->reset_task_pending = 1; - schedule_work(&priv->reset_task); - } else { - printk(KERN_WARNING - "%s: tx_timeout, waiting for reset", ndev->name); - } -} diff --git a/drivers/net/wireless/prism54/islpci_eth.h b/drivers/net/wireless/prism54/islpci_eth.h deleted file mode 100644 index 6ca30a5b7bfb..000000000000 --- a/drivers/net/wireless/prism54/islpci_eth.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2002 Intersil Americas Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef _ISLPCI_ETH_H -#define _ISLPCI_ETH_H - -#include "isl_38xx.h" -#include "islpci_dev.h" - -struct rfmon_header { - __le16 unk0; /* = 0x0000 */ - __le16 length; /* = 0x1400 */ - __le32 clock; /* 1MHz clock */ - u8 flags; - u8 unk1; - u8 rate; - u8 unk2; - __le16 freq; - __le16 unk3; - u8 rssi; - u8 padding[3]; -} __packed; - -struct rx_annex_header { - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - struct rfmon_header rfmon; -} __packed; - -/* wlan-ng (and hopefully others) AVS header, version one. Fields in - * network byte order. */ -#define P80211CAPTURE_VERSION 0x80211001 - -struct avs_80211_1_header { - __be32 version; - __be32 length; - __be64 mactime; - __be64 hosttime; - __be32 phytype; - __be32 channel; - __be32 datarate; - __be32 antenna; - __be32 priority; - __be32 ssi_type; - __be32 ssi_signal; - __be32 ssi_noise; - __be32 preamble; - __be32 encoding; -}; - -void islpci_eth_cleanup_transmit(islpci_private *, isl38xx_control_block *); -netdev_tx_t islpci_eth_transmit(struct sk_buff *, struct net_device *); -int islpci_eth_receive(islpci_private *); -void islpci_eth_tx_timeout(struct net_device *); -void islpci_do_reset_and_wake(struct work_struct *); - -#endif /* _ISL_GEN_H */ diff --git a/drivers/net/wireless/prism54/islpci_hotplug.c b/drivers/net/wireless/prism54/islpci_hotplug.c deleted file mode 100644 index 9e68e0cb718e..000000000000 --- a/drivers/net/wireless/prism54/islpci_hotplug.c +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (C) 2002 Intersil Americas Inc. - * Copyright (C) 2003 Herbert Valerio Riedel - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include /* For __init, __exit */ -#include - -#include "prismcompat.h" -#include "islpci_dev.h" -#include "islpci_mgt.h" /* for pc_debug */ -#include "isl_oid.h" - -MODULE_AUTHOR("[Intersil] R.Bastings and W.Termorshuizen, The prism54.org Development Team "); -MODULE_DESCRIPTION("The Prism54 802.11 Wireless LAN adapter"); -MODULE_LICENSE("GPL"); - -static int init_pcitm = 0; -module_param(init_pcitm, int, 0); - -/* In this order: vendor, device, subvendor, subdevice, class, class_mask, - * driver_data - * If you have an update for this please contact prism54-devel@prism54.org - * The latest list can be found at http://wireless.kernel.org/en/users/Drivers/p54 */ -static DEFINE_PCI_DEVICE_TABLE(prism54_id_tbl) = { - /* Intersil PRISM Duette/Prism GT Wireless LAN adapter */ - { - 0x1260, 0x3890, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, 0 - }, - - /* 3COM 3CRWE154G72 Wireless LAN adapter */ - { - PCI_VDEVICE(3COM, 0x6001), 0 - }, - - /* Intersil PRISM Indigo Wireless LAN adapter */ - { - 0x1260, 0x3877, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, 0 - }, - - /* Intersil PRISM Javelin/Xbow Wireless LAN adapter */ - { - 0x1260, 0x3886, - PCI_ANY_ID, PCI_ANY_ID, - 0, 0, 0 - }, - - /* End of list */ - {0,0,0,0,0,0,0} -}; - -/* register the device with the Hotplug facilities of the kernel */ -MODULE_DEVICE_TABLE(pci, prism54_id_tbl); - -static int prism54_probe(struct pci_dev *, const struct pci_device_id *); -static void prism54_remove(struct pci_dev *); -static int prism54_suspend(struct pci_dev *, pm_message_t state); -static int prism54_resume(struct pci_dev *); - -static struct pci_driver prism54_driver = { - .name = DRV_NAME, - .id_table = prism54_id_tbl, - .probe = prism54_probe, - .remove = prism54_remove, - .suspend = prism54_suspend, - .resume = prism54_resume, -}; - -/****************************************************************************** - Module initialization functions -******************************************************************************/ - -static int -prism54_probe(struct pci_dev *pdev, const struct pci_device_id *id) -{ - struct net_device *ndev; - u8 latency_tmr; - u32 mem_addr; - islpci_private *priv; - int rvalue; - - /* Enable the pci device */ - if (pci_enable_device(pdev)) { - printk(KERN_ERR "%s: pci_enable_device() failed.\n", DRV_NAME); - return -ENODEV; - } - - /* check whether the latency timer is set correctly */ - pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency_tmr); -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, "latency timer: %x\n", latency_tmr); -#endif - if (latency_tmr < PCIDEVICE_LATENCY_TIMER_MIN) { - /* set the latency timer */ - pci_write_config_byte(pdev, PCI_LATENCY_TIMER, - PCIDEVICE_LATENCY_TIMER_VAL); - } - - /* enable PCI DMA */ - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { - printk(KERN_ERR "%s: 32-bit PCI DMA not supported", DRV_NAME); - goto do_pci_disable_device; - } - - /* 0x40 is the programmable timer to configure the response timeout (TRDY_TIMEOUT) - * 0x41 is the programmable timer to configure the retry timeout (RETRY_TIMEOUT) - * The RETRY_TIMEOUT is used to set the number of retries that the core, as a - * Master, will perform before abandoning a cycle. The default value for - * RETRY_TIMEOUT is 0x80, which far exceeds the PCI 2.1 requirement for new - * devices. A write of zero to the RETRY_TIMEOUT register disables this - * function to allow use with any non-compliant legacy devices that may - * execute more retries. - * - * Writing zero to both these two registers will disable both timeouts and - * *can* solve problems caused by devices that are slow to respond. - * Make this configurable - MSW - */ - if ( init_pcitm >= 0 ) { - pci_write_config_byte(pdev, 0x40, (u8)init_pcitm); - pci_write_config_byte(pdev, 0x41, (u8)init_pcitm); - } else { - printk(KERN_INFO "PCI TRDY/RETRY unchanged\n"); - } - - /* request the pci device I/O regions */ - rvalue = pci_request_regions(pdev, DRV_NAME); - if (rvalue) { - printk(KERN_ERR "%s: pci_request_regions failure (rc=%d)\n", - DRV_NAME, rvalue); - goto do_pci_disable_device; - } - - /* check if the memory window is indeed set */ - rvalue = pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &mem_addr); - if (rvalue || !mem_addr) { - printk(KERN_ERR "%s: PCI device memory region not configured; fix your BIOS or CardBus bridge/drivers\n", - DRV_NAME); - goto do_pci_release_regions; - } - - /* enable PCI bus-mastering */ - DEBUG(SHOW_TRACING, "%s: pci_set_master(pdev)\n", DRV_NAME); - pci_set_master(pdev); - - /* enable MWI */ - pci_try_set_mwi(pdev); - - /* setup the network device interface and its structure */ - if (!(ndev = islpci_setup(pdev))) { - /* error configuring the driver as a network device */ - printk(KERN_ERR "%s: could not configure network device\n", - DRV_NAME); - goto do_pci_clear_mwi; - } - - priv = netdev_priv(ndev); - islpci_set_state(priv, PRV_STATE_PREBOOT); /* we are attempting to boot */ - - /* card is in unknown state yet, might have some interrupts pending */ - isl38xx_disable_interrupts(priv->device_base); - - /* request for the interrupt before uploading the firmware */ - rvalue = request_irq(pdev->irq, islpci_interrupt, - IRQF_SHARED, ndev->name, priv); - - if (rvalue) { - /* error, could not hook the handler to the irq */ - printk(KERN_ERR "%s: could not install IRQ handler\n", - ndev->name); - goto do_unregister_netdev; - } - - /* firmware upload is triggered in islpci_open */ - - return 0; - - do_unregister_netdev: - unregister_netdev(ndev); - islpci_free_memory(priv); - pci_set_drvdata(pdev, NULL); - free_netdev(ndev); - priv = NULL; - do_pci_clear_mwi: - pci_clear_mwi(pdev); - do_pci_release_regions: - pci_release_regions(pdev); - do_pci_disable_device: - pci_disable_device(pdev); - return -EIO; -} - -/* set by cleanup_module */ -static volatile int __in_cleanup_module = 0; - -/* this one removes one(!!) instance only */ -static void -prism54_remove(struct pci_dev *pdev) -{ - struct net_device *ndev = pci_get_drvdata(pdev); - islpci_private *priv = ndev ? netdev_priv(ndev) : NULL; - BUG_ON(!priv); - - if (!__in_cleanup_module) { - printk(KERN_DEBUG "%s: hot unplug detected\n", ndev->name); - islpci_set_state(priv, PRV_STATE_OFF); - } - - printk(KERN_DEBUG "%s: removing device\n", ndev->name); - - unregister_netdev(ndev); - - /* free the interrupt request */ - - if (islpci_get_state(priv) != PRV_STATE_OFF) { - isl38xx_disable_interrupts(priv->device_base); - islpci_set_state(priv, PRV_STATE_OFF); - /* This bellow causes a lockup at rmmod time. It might be - * because some interrupts still linger after rmmod time, - * see bug #17 */ - /* pci_set_power_state(pdev, 3);*/ /* try to power-off */ - } - - free_irq(pdev->irq, priv); - - /* free the PCI memory and unmap the remapped page */ - islpci_free_memory(priv); - - pci_set_drvdata(pdev, NULL); - free_netdev(ndev); - priv = NULL; - - pci_clear_mwi(pdev); - - pci_release_regions(pdev); - - pci_disable_device(pdev); -} - -static int -prism54_suspend(struct pci_dev *pdev, pm_message_t state) -{ - struct net_device *ndev = pci_get_drvdata(pdev); - islpci_private *priv = ndev ? netdev_priv(ndev) : NULL; - BUG_ON(!priv); - - - pci_save_state(pdev); - - /* tell the device not to trigger interrupts for now... */ - isl38xx_disable_interrupts(priv->device_base); - - /* from now on assume the hardware was already powered down - and don't touch it anymore */ - islpci_set_state(priv, PRV_STATE_OFF); - - netif_stop_queue(ndev); - netif_device_detach(ndev); - - return 0; -} - -static int -prism54_resume(struct pci_dev *pdev) -{ - struct net_device *ndev = pci_get_drvdata(pdev); - islpci_private *priv = ndev ? netdev_priv(ndev) : NULL; - int err; - - BUG_ON(!priv); - - printk(KERN_NOTICE "%s: got resume request\n", ndev->name); - - err = pci_enable_device(pdev); - if (err) { - printk(KERN_ERR "%s: pci_enable_device failed on resume\n", - ndev->name); - return err; - } - - pci_restore_state(pdev); - - /* alright let's go into the PREBOOT state */ - islpci_reset(priv, 1); - - netif_device_attach(ndev); - netif_start_queue(ndev); - - return 0; -} - -static int __init -prism54_module_init(void) -{ - printk(KERN_INFO "Loaded %s driver, version %s\n", - DRV_NAME, DRV_VERSION); - - __bug_on_wrong_struct_sizes (); - - return pci_register_driver(&prism54_driver); -} - -/* by the time prism54_module_exit() terminates, as a postcondition - * all instances will have been destroyed by calls to - * prism54_remove() */ -static void __exit -prism54_module_exit(void) -{ - __in_cleanup_module = 1; - - pci_unregister_driver(&prism54_driver); - - printk(KERN_INFO "Unloaded %s driver\n", DRV_NAME); - - __in_cleanup_module = 0; -} - -/* register entry points */ -module_init(prism54_module_init); -module_exit(prism54_module_exit); -/* EOF */ diff --git a/drivers/net/wireless/prism54/islpci_mgt.c b/drivers/net/wireless/prism54/islpci_mgt.c deleted file mode 100644 index 9f19cceab487..000000000000 --- a/drivers/net/wireless/prism54/islpci_mgt.c +++ /dev/null @@ -1,503 +0,0 @@ -/* - * Copyright (C) 2002 Intersil Americas Inc. - * Copyright 2004 Jens Maurer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include - -#include -#include - -#include "prismcompat.h" -#include "isl_38xx.h" -#include "islpci_mgt.h" -#include "isl_oid.h" /* additional types and defs for isl38xx fw */ -#include "isl_ioctl.h" - -#include - -/****************************************************************************** - Global variable definition section -******************************************************************************/ -int pc_debug = VERBOSE; -module_param(pc_debug, int, 0); - -/****************************************************************************** - Driver general functions -******************************************************************************/ -#if VERBOSE > SHOW_ERROR_MESSAGES -void -display_buffer(char *buffer, int length) -{ - if ((pc_debug & SHOW_BUFFER_CONTENTS) == 0) - return; - - while (length > 0) { - printk("[%02x]", *buffer & 255); - length--; - buffer++; - } - - printk("\n"); -} -#endif - -/***************************************************************************** - Queue handling for management frames -******************************************************************************/ - -/* - * Helper function to create a PIMFOR management frame header. - */ -static void -pimfor_encode_header(int operation, u32 oid, u32 length, pimfor_header_t *h) -{ - h->version = PIMFOR_VERSION; - h->operation = operation; - h->device_id = PIMFOR_DEV_ID_MHLI_MIB; - h->flags = 0; - h->oid = cpu_to_be32(oid); - h->length = cpu_to_be32(length); -} - -/* - * Helper function to analyze a PIMFOR management frame header. - */ -static pimfor_header_t * -pimfor_decode_header(void *data, int len) -{ - pimfor_header_t *h = data; - - while ((void *) h < data + len) { - if (h->flags & PIMFOR_FLAG_LITTLE_ENDIAN) { - le32_to_cpus(&h->oid); - le32_to_cpus(&h->length); - } else { - be32_to_cpus(&h->oid); - be32_to_cpus(&h->length); - } - if (h->oid != OID_INL_TUNNEL) - return h; - h++; - } - return NULL; -} - -/* - * Fill the receive queue for management frames with fresh buffers. - */ -int -islpci_mgmt_rx_fill(struct net_device *ndev) -{ - islpci_private *priv = netdev_priv(ndev); - isl38xx_control_block *cb = /* volatile not needed */ - (isl38xx_control_block *) priv->control_block; - u32 curr = le32_to_cpu(cb->driver_curr_frag[ISL38XX_CB_RX_MGMTQ]); - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_FUNCTION_CALLS, "islpci_mgmt_rx_fill\n"); -#endif - - while (curr - priv->index_mgmt_rx < ISL38XX_CB_MGMT_QSIZE) { - u32 index = curr % ISL38XX_CB_MGMT_QSIZE; - struct islpci_membuf *buf = &priv->mgmt_rx[index]; - isl38xx_fragment *frag = &cb->rx_data_mgmt[index]; - - if (buf->mem == NULL) { - buf->mem = kmalloc(MGMT_FRAME_SIZE, GFP_ATOMIC); - if (!buf->mem) - return -ENOMEM; - buf->size = MGMT_FRAME_SIZE; - } - if (buf->pci_addr == 0) { - buf->pci_addr = pci_map_single(priv->pdev, buf->mem, - MGMT_FRAME_SIZE, - PCI_DMA_FROMDEVICE); - if (!buf->pci_addr) { - printk(KERN_WARNING - "Failed to make memory DMA'able.\n"); - return -ENOMEM; - } - } - - /* be safe: always reset control block information */ - frag->size = cpu_to_le16(MGMT_FRAME_SIZE); - frag->flags = 0; - frag->address = cpu_to_le32(buf->pci_addr); - curr++; - - /* The fragment address in the control block must have - * been written before announcing the frame buffer to - * device */ - wmb(); - cb->driver_curr_frag[ISL38XX_CB_RX_MGMTQ] = cpu_to_le32(curr); - } - return 0; -} - -/* - * Create and transmit a management frame using "operation" and "oid", - * with arguments data/length. - * We either return an error and free the frame, or we return 0 and - * islpci_mgt_cleanup_transmit() frees the frame in the tx-done - * interrupt. - */ -static int -islpci_mgt_transmit(struct net_device *ndev, int operation, unsigned long oid, - void *data, int length) -{ - islpci_private *priv = netdev_priv(ndev); - isl38xx_control_block *cb = - (isl38xx_control_block *) priv->control_block; - void *p; - int err = -EINVAL; - unsigned long flags; - isl38xx_fragment *frag; - struct islpci_membuf buf; - u32 curr_frag; - int index; - int frag_len = length + PIMFOR_HEADER_SIZE; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_FUNCTION_CALLS, "islpci_mgt_transmit\n"); -#endif - - if (frag_len > MGMT_FRAME_SIZE) { - printk(KERN_DEBUG "%s: mgmt frame too large %d\n", - ndev->name, frag_len); - goto error; - } - - err = -ENOMEM; - p = buf.mem = kmalloc(frag_len, GFP_KERNEL); - if (!buf.mem) - goto error; - - buf.size = frag_len; - - /* create the header directly in the fragment data area */ - pimfor_encode_header(operation, oid, length, (pimfor_header_t *) p); - p += PIMFOR_HEADER_SIZE; - - if (data) - memcpy(p, data, length); - else - memset(p, 0, length); - -#if VERBOSE > SHOW_ERROR_MESSAGES - { - pimfor_header_t *h = buf.mem; - DEBUG(SHOW_PIMFOR_FRAMES, - "PIMFOR: op %i, oid 0x%08lx, device %i, flags 0x%x length 0x%x\n", - h->operation, oid, h->device_id, h->flags, length); - - /* display the buffer contents for debugging */ - display_buffer((char *) h, sizeof (pimfor_header_t)); - display_buffer(p, length); - } -#endif - - err = -ENOMEM; - buf.pci_addr = pci_map_single(priv->pdev, buf.mem, frag_len, - PCI_DMA_TODEVICE); - if (!buf.pci_addr) { - printk(KERN_WARNING "%s: cannot map PCI memory for mgmt\n", - ndev->name); - goto error_free; - } - - /* Protect the control block modifications against interrupts. */ - spin_lock_irqsave(&priv->slock, flags); - curr_frag = le32_to_cpu(cb->driver_curr_frag[ISL38XX_CB_TX_MGMTQ]); - if (curr_frag - priv->index_mgmt_tx >= ISL38XX_CB_MGMT_QSIZE) { - printk(KERN_WARNING "%s: mgmt tx queue is still full\n", - ndev->name); - goto error_unlock; - } - - /* commit the frame to the tx device queue */ - index = curr_frag % ISL38XX_CB_MGMT_QSIZE; - priv->mgmt_tx[index] = buf; - frag = &cb->tx_data_mgmt[index]; - frag->size = cpu_to_le16(frag_len); - frag->flags = 0; /* for any other than the last fragment, set to 1 */ - frag->address = cpu_to_le32(buf.pci_addr); - - /* The fragment address in the control block must have - * been written before announcing the frame buffer to - * device */ - wmb(); - cb->driver_curr_frag[ISL38XX_CB_TX_MGMTQ] = cpu_to_le32(curr_frag + 1); - spin_unlock_irqrestore(&priv->slock, flags); - - /* trigger the device */ - islpci_trigger(priv); - return 0; - - error_unlock: - spin_unlock_irqrestore(&priv->slock, flags); - error_free: - kfree(buf.mem); - error: - return err; -} - -/* - * Receive a management frame from the device. - * This can be an arbitrary number of traps, and at most one response - * frame for a previous request sent via islpci_mgt_transmit(). - */ -int -islpci_mgt_receive(struct net_device *ndev) -{ - islpci_private *priv = netdev_priv(ndev); - isl38xx_control_block *cb = - (isl38xx_control_block *) priv->control_block; - u32 curr_frag; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_FUNCTION_CALLS, "islpci_mgt_receive\n"); -#endif - - /* Only once per interrupt, determine fragment range to - * process. This avoids an endless loop (i.e. lockup) if - * frames come in faster than we can process them. */ - curr_frag = le32_to_cpu(cb->device_curr_frag[ISL38XX_CB_RX_MGMTQ]); - barrier(); - - for (; priv->index_mgmt_rx < curr_frag; priv->index_mgmt_rx++) { - pimfor_header_t *header; - u32 index = priv->index_mgmt_rx % ISL38XX_CB_MGMT_QSIZE; - struct islpci_membuf *buf = &priv->mgmt_rx[index]; - u16 frag_len; - int size; - struct islpci_mgmtframe *frame; - - /* I have no idea (and no documentation) if flags != 0 - * is possible. Drop the frame, reuse the buffer. */ - if (le16_to_cpu(cb->rx_data_mgmt[index].flags) != 0) { - printk(KERN_WARNING "%s: unknown flags 0x%04x\n", - ndev->name, - le16_to_cpu(cb->rx_data_mgmt[index].flags)); - continue; - } - - /* The device only returns the size of the header(s) here. */ - frag_len = le16_to_cpu(cb->rx_data_mgmt[index].size); - - /* - * We appear to have no way to tell the device the - * size of a receive buffer. Thus, if this check - * triggers, we likely have kernel heap corruption. */ - if (frag_len > MGMT_FRAME_SIZE) { - printk(KERN_WARNING - "%s: Bogus packet size of %d (%#x).\n", - ndev->name, frag_len, frag_len); - frag_len = MGMT_FRAME_SIZE; - } - - /* Ensure the results of device DMA are visible to the CPU. */ - pci_dma_sync_single_for_cpu(priv->pdev, buf->pci_addr, - buf->size, PCI_DMA_FROMDEVICE); - - /* Perform endianess conversion for PIMFOR header in-place. */ - header = pimfor_decode_header(buf->mem, frag_len); - if (!header) { - printk(KERN_WARNING "%s: no PIMFOR header found\n", - ndev->name); - continue; - } - - /* The device ID from the PIMFOR packet received from - * the MVC is always 0. We forward a sensible device_id. - * Not that anyone upstream would care... */ - header->device_id = priv->ndev->ifindex; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_PIMFOR_FRAMES, - "PIMFOR: op %i, oid 0x%08x, device %i, flags 0x%x length 0x%x\n", - header->operation, header->oid, header->device_id, - header->flags, header->length); - - /* display the buffer contents for debugging */ - display_buffer((char *) header, PIMFOR_HEADER_SIZE); - display_buffer((char *) header + PIMFOR_HEADER_SIZE, - header->length); -#endif - - /* nobody sends these */ - if (header->flags & PIMFOR_FLAG_APPLIC_ORIGIN) { - printk(KERN_DEBUG - "%s: errant PIMFOR application frame\n", - ndev->name); - continue; - } - - /* Determine frame size, skipping OID_INL_TUNNEL headers. */ - size = PIMFOR_HEADER_SIZE + header->length; - frame = kmalloc(sizeof(struct islpci_mgmtframe) + size, - GFP_ATOMIC); - if (!frame) - continue; - - frame->ndev = ndev; - memcpy(&frame->buf, header, size); - frame->header = (pimfor_header_t *) frame->buf; - frame->data = frame->buf + PIMFOR_HEADER_SIZE; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_PIMFOR_FRAMES, - "frame: header: %p, data: %p, size: %d\n", - frame->header, frame->data, size); -#endif - - if (header->operation == PIMFOR_OP_TRAP) { -#if VERBOSE > SHOW_ERROR_MESSAGES - printk(KERN_DEBUG - "TRAP: oid 0x%x, device %i, flags 0x%x length %i\n", - header->oid, header->device_id, header->flags, - header->length); -#endif - - /* Create work to handle trap out of interrupt - * context. */ - INIT_WORK(&frame->ws, prism54_process_trap); - schedule_work(&frame->ws); - - } else { - /* Signal the one waiting process that a response - * has been received. */ - if ((frame = xchg(&priv->mgmt_received, frame)) != NULL) { - printk(KERN_WARNING - "%s: mgmt response not collected\n", - ndev->name); - kfree(frame); - } -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_TRACING, "Wake up Mgmt Queue\n"); -#endif - wake_up(&priv->mgmt_wqueue); - } - - } - - return 0; -} - -/* - * Cleanup the transmit queue by freeing all frames handled by the device. - */ -void -islpci_mgt_cleanup_transmit(struct net_device *ndev) -{ - islpci_private *priv = netdev_priv(ndev); - isl38xx_control_block *cb = /* volatile not needed */ - (isl38xx_control_block *) priv->control_block; - u32 curr_frag; - -#if VERBOSE > SHOW_ERROR_MESSAGES - DEBUG(SHOW_FUNCTION_CALLS, "islpci_mgt_cleanup_transmit\n"); -#endif - - /* Only once per cleanup, determine fragment range to - * process. This avoids an endless loop (i.e. lockup) if - * the device became confused, incrementing device_curr_frag - * rapidly. */ - curr_frag = le32_to_cpu(cb->device_curr_frag[ISL38XX_CB_TX_MGMTQ]); - barrier(); - - for (; priv->index_mgmt_tx < curr_frag; priv->index_mgmt_tx++) { - int index = priv->index_mgmt_tx % ISL38XX_CB_MGMT_QSIZE; - struct islpci_membuf *buf = &priv->mgmt_tx[index]; - pci_unmap_single(priv->pdev, buf->pci_addr, buf->size, - PCI_DMA_TODEVICE); - buf->pci_addr = 0; - kfree(buf->mem); - buf->mem = NULL; - buf->size = 0; - } -} - -/* - * Perform one request-response transaction to the device. - */ -int -islpci_mgt_transaction(struct net_device *ndev, - int operation, unsigned long oid, - void *senddata, int sendlen, - struct islpci_mgmtframe **recvframe) -{ - islpci_private *priv = netdev_priv(ndev); - const long wait_cycle_jiffies = msecs_to_jiffies(ISL38XX_WAIT_CYCLE * 10); - long timeout_left = ISL38XX_MAX_WAIT_CYCLES * wait_cycle_jiffies; - int err; - DEFINE_WAIT(wait); - - *recvframe = NULL; - - if (mutex_lock_interruptible(&priv->mgmt_lock)) - return -ERESTARTSYS; - - prepare_to_wait(&priv->mgmt_wqueue, &wait, TASK_UNINTERRUPTIBLE); - err = islpci_mgt_transmit(ndev, operation, oid, senddata, sendlen); - if (err) - goto out; - - err = -ETIMEDOUT; - while (timeout_left > 0) { - int timeleft; - struct islpci_mgmtframe *frame; - - timeleft = schedule_timeout_uninterruptible(wait_cycle_jiffies); - frame = xchg(&priv->mgmt_received, NULL); - if (frame) { - if (frame->header->oid == oid) { - *recvframe = frame; - err = 0; - goto out; - } else { - printk(KERN_DEBUG - "%s: expecting oid 0x%x, received 0x%x.\n", - ndev->name, (unsigned int) oid, - frame->header->oid); - kfree(frame); - frame = NULL; - } - } - if (timeleft == 0) { - printk(KERN_DEBUG - "%s: timeout waiting for mgmt response %lu, " - "triggering device\n", - ndev->name, timeout_left); - islpci_trigger(priv); - } - timeout_left += timeleft - wait_cycle_jiffies; - } - printk(KERN_WARNING "%s: timeout waiting for mgmt response\n", - ndev->name); - - /* TODO: we should reset the device here */ - out: - finish_wait(&priv->mgmt_wqueue, &wait); - mutex_unlock(&priv->mgmt_lock); - return err; -} - diff --git a/drivers/net/wireless/prism54/islpci_mgt.h b/drivers/net/wireless/prism54/islpci_mgt.h deleted file mode 100644 index 0db93db9b675..000000000000 --- a/drivers/net/wireless/prism54/islpci_mgt.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2002 Intersil Americas Inc. - * Copyright (C) 2003 Luis R. Rodriguez - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef _ISLPCI_MGT_H -#define _ISLPCI_MGT_H - -#include -#include -#include - -/* - * Function definitions - */ - -#define K_DEBUG(f, m, args...) do { if(f & m) printk(KERN_DEBUG args); } while(0) -#define DEBUG(f, args...) K_DEBUG(f, pc_debug, args) - -extern int pc_debug; -#define init_wds 0 /* help compiler optimize away dead code */ - - -/* General driver definitions */ -#define PCIDEVICE_LATENCY_TIMER_MIN 0x40 -#define PCIDEVICE_LATENCY_TIMER_VAL 0x50 - -/* Debugging verbose definitions */ -#define SHOW_NOTHING 0x00 /* overrules everything */ -#define SHOW_ANYTHING 0xFF -#define SHOW_ERROR_MESSAGES 0x01 -#define SHOW_TRAPS 0x02 -#define SHOW_FUNCTION_CALLS 0x04 -#define SHOW_TRACING 0x08 -#define SHOW_QUEUE_INDEXES 0x10 -#define SHOW_PIMFOR_FRAMES 0x20 -#define SHOW_BUFFER_CONTENTS 0x40 -#define VERBOSE 0x01 - -/* Default card definitions */ -#define CARD_DEFAULT_CHANNEL 6 -#define CARD_DEFAULT_MODE INL_MODE_CLIENT -#define CARD_DEFAULT_IW_MODE IW_MODE_INFRA -#define CARD_DEFAULT_BSSTYPE DOT11_BSSTYPE_INFRA -#define CARD_DEFAULT_CLIENT_SSID "" -#define CARD_DEFAULT_AP_SSID "default" -#define CARD_DEFAULT_KEY1 "default_key_1" -#define CARD_DEFAULT_KEY2 "default_key_2" -#define CARD_DEFAULT_KEY3 "default_key_3" -#define CARD_DEFAULT_KEY4 "default_key_4" -#define CARD_DEFAULT_WEP 0 -#define CARD_DEFAULT_FILTER 0 -#define CARD_DEFAULT_WDS 0 -#define CARD_DEFAULT_AUTHEN DOT11_AUTH_OS -#define CARD_DEFAULT_DOT1X 0 -#define CARD_DEFAULT_MLME_MODE DOT11_MLME_AUTO -#define CARD_DEFAULT_CONFORMANCE OID_INL_CONFORMANCE_NONE -#define CARD_DEFAULT_PROFILE DOT11_PROFILE_MIXED_G_WIFI -#define CARD_DEFAULT_MAXFRAMEBURST DOT11_MAXFRAMEBURST_MIXED_SAFE - -/* PIMFOR package definitions */ -#define PIMFOR_ETHERTYPE 0x8828 -#define PIMFOR_HEADER_SIZE 12 -#define PIMFOR_VERSION 1 -#define PIMFOR_OP_GET 0 -#define PIMFOR_OP_SET 1 -#define PIMFOR_OP_RESPONSE 2 -#define PIMFOR_OP_ERROR 3 -#define PIMFOR_OP_TRAP 4 -#define PIMFOR_OP_RESERVED 5 /* till 255 */ -#define PIMFOR_DEV_ID_MHLI_MIB 0 -#define PIMFOR_FLAG_APPLIC_ORIGIN 0x01 -#define PIMFOR_FLAG_LITTLE_ENDIAN 0x02 - -void display_buffer(char *, int); - -/* - * Type definition section - * - * the structure defines only the header allowing copyless - * frame handling - */ -typedef struct { - u8 version; - u8 operation; - u32 oid; - u8 device_id; - u8 flags; - u32 length; -} __packed -pimfor_header_t; - -/* A received and interrupt-processed management frame, either for - * schedule_work(prism54_process_trap) or for priv->mgmt_received, - * processed by islpci_mgt_transaction(). */ -struct islpci_mgmtframe { - struct net_device *ndev; /* pointer to network device */ - pimfor_header_t *header; /* payload header, points into buf */ - void *data; /* payload ex header, points into buf */ - struct work_struct ws; /* argument for schedule_work() */ - char buf[0]; /* fragment buffer */ -}; - -int -islpci_mgt_receive(struct net_device *ndev); - -int -islpci_mgmt_rx_fill(struct net_device *ndev); - -void -islpci_mgt_cleanup_transmit(struct net_device *ndev); - -int -islpci_mgt_transaction(struct net_device *ndev, - int operation, unsigned long oid, - void *senddata, int sendlen, - struct islpci_mgmtframe **recvframe); - -static inline void -islpci_mgt_release(struct islpci_mgmtframe *frame) -{ - kfree(frame); -} - -#endif /* _ISLPCI_MGT_H */ diff --git a/drivers/net/wireless/prism54/oid_mgt.c b/drivers/net/wireless/prism54/oid_mgt.c deleted file mode 100644 index a01606b36e03..000000000000 --- a/drivers/net/wireless/prism54/oid_mgt.c +++ /dev/null @@ -1,903 +0,0 @@ -/* - * Copyright (C) 2003,2004 Aurelien Alleaume - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include - -#include "prismcompat.h" -#include "islpci_dev.h" -#include "islpci_mgt.h" -#include "isl_oid.h" -#include "oid_mgt.h" -#include "isl_ioctl.h" - -/* to convert between channel and freq */ -static const int frequency_list_bg[] = { 2412, 2417, 2422, 2427, 2432, - 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484 -}; - -int -channel_of_freq(int f) -{ - int c = 0; - - if ((f >= 2412) && (f <= 2484)) { - while ((c < 14) && (f != frequency_list_bg[c])) - c++; - return (c >= 14) ? 0 : ++c; - } else if ((f >= (int) 5000) && (f <= (int) 6000)) { - return ( (f - 5000) / 5 ); - } else - return 0; -} - -#define OID_STRUCT(name,oid,s,t) [name] = {oid, 0, sizeof(s), t} -#define OID_STRUCT_C(name,oid,s,t) OID_STRUCT(name,oid,s,t | OID_FLAG_CACHED) -#define OID_U32(name,oid) OID_STRUCT(name,oid,u32,OID_TYPE_U32) -#define OID_U32_C(name,oid) OID_STRUCT_C(name,oid,u32,OID_TYPE_U32) -#define OID_STRUCT_MLME(name,oid) OID_STRUCT(name,oid,struct obj_mlme,OID_TYPE_MLME) -#define OID_STRUCT_MLMEEX(name,oid) OID_STRUCT(name,oid,struct obj_mlmeex,OID_TYPE_MLMEEX) - -#define OID_UNKNOWN(name,oid) OID_STRUCT(name,oid,0,0) - -struct oid_t isl_oid[] = { - OID_STRUCT(GEN_OID_MACADDRESS, 0x00000000, u8[6], OID_TYPE_ADDR), - OID_U32(GEN_OID_LINKSTATE, 0x00000001), - OID_UNKNOWN(GEN_OID_WATCHDOG, 0x00000002), - OID_UNKNOWN(GEN_OID_MIBOP, 0x00000003), - OID_UNKNOWN(GEN_OID_OPTIONS, 0x00000004), - OID_UNKNOWN(GEN_OID_LEDCONFIG, 0x00000005), - - /* 802.11 */ - OID_U32_C(DOT11_OID_BSSTYPE, 0x10000000), - OID_STRUCT_C(DOT11_OID_BSSID, 0x10000001, u8[6], OID_TYPE_RAW), - OID_STRUCT_C(DOT11_OID_SSID, 0x10000002, struct obj_ssid, - OID_TYPE_SSID), - OID_U32(DOT11_OID_STATE, 0x10000003), - OID_U32(DOT11_OID_AID, 0x10000004), - OID_STRUCT(DOT11_OID_COUNTRYSTRING, 0x10000005, u8[4], OID_TYPE_RAW), - OID_STRUCT_C(DOT11_OID_SSIDOVERRIDE, 0x10000006, struct obj_ssid, - OID_TYPE_SSID), - - OID_U32(DOT11_OID_MEDIUMLIMIT, 0x11000000), - OID_U32_C(DOT11_OID_BEACONPERIOD, 0x11000001), - OID_U32(DOT11_OID_DTIMPERIOD, 0x11000002), - OID_U32(DOT11_OID_ATIMWINDOW, 0x11000003), - OID_U32(DOT11_OID_LISTENINTERVAL, 0x11000004), - OID_U32(DOT11_OID_CFPPERIOD, 0x11000005), - OID_U32(DOT11_OID_CFPDURATION, 0x11000006), - - OID_U32_C(DOT11_OID_AUTHENABLE, 0x12000000), - OID_U32_C(DOT11_OID_PRIVACYINVOKED, 0x12000001), - OID_U32_C(DOT11_OID_EXUNENCRYPTED, 0x12000002), - OID_U32_C(DOT11_OID_DEFKEYID, 0x12000003), - [DOT11_OID_DEFKEYX] = {0x12000004, 3, sizeof (struct obj_key), - OID_FLAG_CACHED | OID_TYPE_KEY}, /* DOT11_OID_DEFKEY1,...DOT11_OID_DEFKEY4 */ - OID_UNKNOWN(DOT11_OID_STAKEY, 0x12000008), - OID_U32(DOT11_OID_REKEYTHRESHOLD, 0x12000009), - OID_UNKNOWN(DOT11_OID_STASC, 0x1200000a), - - OID_U32(DOT11_OID_PRIVTXREJECTED, 0x1a000000), - OID_U32(DOT11_OID_PRIVRXPLAIN, 0x1a000001), - OID_U32(DOT11_OID_PRIVRXFAILED, 0x1a000002), - OID_U32(DOT11_OID_PRIVRXNOKEY, 0x1a000003), - - OID_U32_C(DOT11_OID_RTSTHRESH, 0x13000000), - OID_U32_C(DOT11_OID_FRAGTHRESH, 0x13000001), - OID_U32_C(DOT11_OID_SHORTRETRIES, 0x13000002), - OID_U32_C(DOT11_OID_LONGRETRIES, 0x13000003), - OID_U32_C(DOT11_OID_MAXTXLIFETIME, 0x13000004), - OID_U32(DOT11_OID_MAXRXLIFETIME, 0x13000005), - OID_U32(DOT11_OID_AUTHRESPTIMEOUT, 0x13000006), - OID_U32(DOT11_OID_ASSOCRESPTIMEOUT, 0x13000007), - - OID_UNKNOWN(DOT11_OID_ALOFT_TABLE, 0x1d000000), - OID_UNKNOWN(DOT11_OID_ALOFT_CTRL_TABLE, 0x1d000001), - OID_UNKNOWN(DOT11_OID_ALOFT_RETREAT, 0x1d000002), - OID_UNKNOWN(DOT11_OID_ALOFT_PROGRESS, 0x1d000003), - OID_U32(DOT11_OID_ALOFT_FIXEDRATE, 0x1d000004), - OID_UNKNOWN(DOT11_OID_ALOFT_RSSIGRAPH, 0x1d000005), - OID_UNKNOWN(DOT11_OID_ALOFT_CONFIG, 0x1d000006), - - [DOT11_OID_VDCFX] = {0x1b000000, 7, 0, 0}, - OID_U32(DOT11_OID_MAXFRAMEBURST, 0x1b000008), - - OID_U32(DOT11_OID_PSM, 0x14000000), - OID_U32(DOT11_OID_CAMTIMEOUT, 0x14000001), - OID_U32(DOT11_OID_RECEIVEDTIMS, 0x14000002), - OID_U32(DOT11_OID_ROAMPREFERENCE, 0x14000003), - - OID_U32(DOT11_OID_BRIDGELOCAL, 0x15000000), - OID_U32(DOT11_OID_CLIENTS, 0x15000001), - OID_U32(DOT11_OID_CLIENTSASSOCIATED, 0x15000002), - [DOT11_OID_CLIENTX] = {0x15000003, 2006, 0, 0}, /* DOT11_OID_CLIENTX,...DOT11_OID_CLIENT2007 */ - - OID_STRUCT(DOT11_OID_CLIENTFIND, 0x150007DB, u8[6], OID_TYPE_ADDR), - OID_STRUCT(DOT11_OID_WDSLINKADD, 0x150007DC, u8[6], OID_TYPE_ADDR), - OID_STRUCT(DOT11_OID_WDSLINKREMOVE, 0x150007DD, u8[6], OID_TYPE_ADDR), - OID_STRUCT(DOT11_OID_EAPAUTHSTA, 0x150007DE, u8[6], OID_TYPE_ADDR), - OID_STRUCT(DOT11_OID_EAPUNAUTHSTA, 0x150007DF, u8[6], OID_TYPE_ADDR), - OID_U32_C(DOT11_OID_DOT1XENABLE, 0x150007E0), - OID_UNKNOWN(DOT11_OID_MICFAILURE, 0x150007E1), - OID_UNKNOWN(DOT11_OID_REKEYINDICATE, 0x150007E2), - - OID_U32(DOT11_OID_MPDUTXSUCCESSFUL, 0x16000000), - OID_U32(DOT11_OID_MPDUTXONERETRY, 0x16000001), - OID_U32(DOT11_OID_MPDUTXMULTIPLERETRIES, 0x16000002), - OID_U32(DOT11_OID_MPDUTXFAILED, 0x16000003), - OID_U32(DOT11_OID_MPDURXSUCCESSFUL, 0x16000004), - OID_U32(DOT11_OID_MPDURXDUPS, 0x16000005), - OID_U32(DOT11_OID_RTSSUCCESSFUL, 0x16000006), - OID_U32(DOT11_OID_RTSFAILED, 0x16000007), - OID_U32(DOT11_OID_ACKFAILED, 0x16000008), - OID_U32(DOT11_OID_FRAMERECEIVES, 0x16000009), - OID_U32(DOT11_OID_FRAMEERRORS, 0x1600000A), - OID_U32(DOT11_OID_FRAMEABORTS, 0x1600000B), - OID_U32(DOT11_OID_FRAMEABORTSPHY, 0x1600000C), - - OID_U32(DOT11_OID_SLOTTIME, 0x17000000), - OID_U32(DOT11_OID_CWMIN, 0x17000001), - OID_U32(DOT11_OID_CWMAX, 0x17000002), - OID_U32(DOT11_OID_ACKWINDOW, 0x17000003), - OID_U32(DOT11_OID_ANTENNARX, 0x17000004), - OID_U32(DOT11_OID_ANTENNATX, 0x17000005), - OID_U32(DOT11_OID_ANTENNADIVERSITY, 0x17000006), - OID_U32_C(DOT11_OID_CHANNEL, 0x17000007), - OID_U32_C(DOT11_OID_EDTHRESHOLD, 0x17000008), - OID_U32(DOT11_OID_PREAMBLESETTINGS, 0x17000009), - OID_STRUCT(DOT11_OID_RATES, 0x1700000A, u8[IWMAX_BITRATES + 1], - OID_TYPE_RAW), - OID_U32(DOT11_OID_CCAMODESUPPORTED, 0x1700000B), - OID_U32(DOT11_OID_CCAMODE, 0x1700000C), - OID_UNKNOWN(DOT11_OID_RSSIVECTOR, 0x1700000D), - OID_UNKNOWN(DOT11_OID_OUTPUTPOWERTABLE, 0x1700000E), - OID_U32(DOT11_OID_OUTPUTPOWER, 0x1700000F), - OID_STRUCT(DOT11_OID_SUPPORTEDRATES, 0x17000010, - u8[IWMAX_BITRATES + 1], OID_TYPE_RAW), - OID_U32_C(DOT11_OID_FREQUENCY, 0x17000011), - [DOT11_OID_SUPPORTEDFREQUENCIES] = - {0x17000012, 0, sizeof (struct obj_frequencies) - + sizeof (u16) * IWMAX_FREQ, OID_TYPE_FREQUENCIES}, - - OID_U32(DOT11_OID_NOISEFLOOR, 0x17000013), - OID_STRUCT(DOT11_OID_FREQUENCYACTIVITY, 0x17000014, u8[IWMAX_FREQ + 1], - OID_TYPE_RAW), - OID_UNKNOWN(DOT11_OID_IQCALIBRATIONTABLE, 0x17000015), - OID_U32(DOT11_OID_NONERPPROTECTION, 0x17000016), - OID_U32(DOT11_OID_SLOTSETTINGS, 0x17000017), - OID_U32(DOT11_OID_NONERPTIMEOUT, 0x17000018), - OID_U32(DOT11_OID_PROFILES, 0x17000019), - OID_STRUCT(DOT11_OID_EXTENDEDRATES, 0x17000020, - u8[IWMAX_BITRATES + 1], OID_TYPE_RAW), - - OID_STRUCT_MLME(DOT11_OID_DEAUTHENTICATE, 0x18000000), - OID_STRUCT_MLME(DOT11_OID_AUTHENTICATE, 0x18000001), - OID_STRUCT_MLME(DOT11_OID_DISASSOCIATE, 0x18000002), - OID_STRUCT_MLME(DOT11_OID_ASSOCIATE, 0x18000003), - OID_UNKNOWN(DOT11_OID_SCAN, 0x18000004), - OID_STRUCT_MLMEEX(DOT11_OID_BEACON, 0x18000005), - OID_STRUCT_MLMEEX(DOT11_OID_PROBE, 0x18000006), - OID_STRUCT_MLMEEX(DOT11_OID_DEAUTHENTICATEEX, 0x18000007), - OID_STRUCT_MLMEEX(DOT11_OID_AUTHENTICATEEX, 0x18000008), - OID_STRUCT_MLMEEX(DOT11_OID_DISASSOCIATEEX, 0x18000009), - OID_STRUCT_MLMEEX(DOT11_OID_ASSOCIATEEX, 0x1800000A), - OID_STRUCT_MLMEEX(DOT11_OID_REASSOCIATE, 0x1800000B), - OID_STRUCT_MLMEEX(DOT11_OID_REASSOCIATEEX, 0x1800000C), - - OID_U32(DOT11_OID_NONERPSTATUS, 0x1E000000), - - OID_U32(DOT11_OID_STATIMEOUT, 0x19000000), - OID_U32_C(DOT11_OID_MLMEAUTOLEVEL, 0x19000001), - OID_U32(DOT11_OID_BSSTIMEOUT, 0x19000002), - [DOT11_OID_ATTACHMENT] = {0x19000003, 0, - sizeof(struct obj_attachment), OID_TYPE_ATTACH}, - OID_STRUCT_C(DOT11_OID_PSMBUFFER, 0x19000004, struct obj_buffer, - OID_TYPE_BUFFER), - - OID_U32(DOT11_OID_BSSS, 0x1C000000), - [DOT11_OID_BSSX] = {0x1C000001, 63, sizeof (struct obj_bss), - OID_TYPE_BSS}, /*DOT11_OID_BSS1,...,DOT11_OID_BSS64 */ - OID_STRUCT(DOT11_OID_BSSFIND, 0x1C000042, struct obj_bss, OID_TYPE_BSS), - [DOT11_OID_BSSLIST] = {0x1C000043, 0, sizeof (struct - obj_bsslist) + - sizeof (struct obj_bss[IWMAX_BSS]), - OID_TYPE_BSSLIST}, - - OID_UNKNOWN(OID_INL_TUNNEL, 0xFF020000), - OID_UNKNOWN(OID_INL_MEMADDR, 0xFF020001), - OID_UNKNOWN(OID_INL_MEMORY, 0xFF020002), - OID_U32_C(OID_INL_MODE, 0xFF020003), - OID_UNKNOWN(OID_INL_COMPONENT_NR, 0xFF020004), - OID_STRUCT(OID_INL_VERSION, 0xFF020005, u8[8], OID_TYPE_RAW), - OID_UNKNOWN(OID_INL_INTERFACE_ID, 0xFF020006), - OID_UNKNOWN(OID_INL_COMPONENT_ID, 0xFF020007), - OID_U32_C(OID_INL_CONFIG, 0xFF020008), - OID_U32_C(OID_INL_DOT11D_CONFORMANCE, 0xFF02000C), - OID_U32(OID_INL_PHYCAPABILITIES, 0xFF02000D), - OID_U32_C(OID_INL_OUTPUTPOWER, 0xFF02000F), - -}; - -int -mgt_init(islpci_private *priv) -{ - int i; - - priv->mib = kcalloc(OID_NUM_LAST, sizeof (void *), GFP_KERNEL); - if (!priv->mib) - return -ENOMEM; - - /* Alloc the cache */ - for (i = 0; i < OID_NUM_LAST; i++) { - if (isl_oid[i].flags & OID_FLAG_CACHED) { - priv->mib[i] = kzalloc(isl_oid[i].size * - (isl_oid[i].range + 1), - GFP_KERNEL); - if (!priv->mib[i]) - return -ENOMEM; - } else - priv->mib[i] = NULL; - } - - init_rwsem(&priv->mib_sem); - prism54_mib_init(priv); - - return 0; -} - -void -mgt_clean(islpci_private *priv) -{ - int i; - - if (!priv->mib) - return; - for (i = 0; i < OID_NUM_LAST; i++) { - kfree(priv->mib[i]); - priv->mib[i] = NULL; - } - kfree(priv->mib); - priv->mib = NULL; -} - -void -mgt_le_to_cpu(int type, void *data) -{ - switch (type) { - case OID_TYPE_U32: - *(u32 *) data = le32_to_cpu(*(u32 *) data); - break; - case OID_TYPE_BUFFER:{ - struct obj_buffer *buff = data; - buff->size = le32_to_cpu(buff->size); - buff->addr = le32_to_cpu(buff->addr); - break; - } - case OID_TYPE_BSS:{ - struct obj_bss *bss = data; - bss->age = le16_to_cpu(bss->age); - bss->channel = le16_to_cpu(bss->channel); - bss->capinfo = le16_to_cpu(bss->capinfo); - bss->rates = le16_to_cpu(bss->rates); - bss->basic_rates = le16_to_cpu(bss->basic_rates); - break; - } - case OID_TYPE_BSSLIST:{ - struct obj_bsslist *list = data; - int i; - list->nr = le32_to_cpu(list->nr); - for (i = 0; i < list->nr; i++) - mgt_le_to_cpu(OID_TYPE_BSS, &list->bsslist[i]); - break; - } - case OID_TYPE_FREQUENCIES:{ - struct obj_frequencies *freq = data; - int i; - freq->nr = le16_to_cpu(freq->nr); - for (i = 0; i < freq->nr; i++) - freq->mhz[i] = le16_to_cpu(freq->mhz[i]); - break; - } - case OID_TYPE_MLME:{ - struct obj_mlme *mlme = data; - mlme->id = le16_to_cpu(mlme->id); - mlme->state = le16_to_cpu(mlme->state); - mlme->code = le16_to_cpu(mlme->code); - break; - } - case OID_TYPE_MLMEEX:{ - struct obj_mlmeex *mlme = data; - mlme->id = le16_to_cpu(mlme->id); - mlme->state = le16_to_cpu(mlme->state); - mlme->code = le16_to_cpu(mlme->code); - mlme->size = le16_to_cpu(mlme->size); - break; - } - case OID_TYPE_ATTACH:{ - struct obj_attachment *attach = data; - attach->id = le16_to_cpu(attach->id); - attach->size = le16_to_cpu(attach->size); - break; - } - case OID_TYPE_SSID: - case OID_TYPE_KEY: - case OID_TYPE_ADDR: - case OID_TYPE_RAW: - break; - default: - BUG(); - } -} - -static void -mgt_cpu_to_le(int type, void *data) -{ - switch (type) { - case OID_TYPE_U32: - *(u32 *) data = cpu_to_le32(*(u32 *) data); - break; - case OID_TYPE_BUFFER:{ - struct obj_buffer *buff = data; - buff->size = cpu_to_le32(buff->size); - buff->addr = cpu_to_le32(buff->addr); - break; - } - case OID_TYPE_BSS:{ - struct obj_bss *bss = data; - bss->age = cpu_to_le16(bss->age); - bss->channel = cpu_to_le16(bss->channel); - bss->capinfo = cpu_to_le16(bss->capinfo); - bss->rates = cpu_to_le16(bss->rates); - bss->basic_rates = cpu_to_le16(bss->basic_rates); - break; - } - case OID_TYPE_BSSLIST:{ - struct obj_bsslist *list = data; - int i; - list->nr = cpu_to_le32(list->nr); - for (i = 0; i < list->nr; i++) - mgt_cpu_to_le(OID_TYPE_BSS, &list->bsslist[i]); - break; - } - case OID_TYPE_FREQUENCIES:{ - struct obj_frequencies *freq = data; - int i; - freq->nr = cpu_to_le16(freq->nr); - for (i = 0; i < freq->nr; i++) - freq->mhz[i] = cpu_to_le16(freq->mhz[i]); - break; - } - case OID_TYPE_MLME:{ - struct obj_mlme *mlme = data; - mlme->id = cpu_to_le16(mlme->id); - mlme->state = cpu_to_le16(mlme->state); - mlme->code = cpu_to_le16(mlme->code); - break; - } - case OID_TYPE_MLMEEX:{ - struct obj_mlmeex *mlme = data; - mlme->id = cpu_to_le16(mlme->id); - mlme->state = cpu_to_le16(mlme->state); - mlme->code = cpu_to_le16(mlme->code); - mlme->size = cpu_to_le16(mlme->size); - break; - } - case OID_TYPE_ATTACH:{ - struct obj_attachment *attach = data; - attach->id = cpu_to_le16(attach->id); - attach->size = cpu_to_le16(attach->size); - break; - } - case OID_TYPE_SSID: - case OID_TYPE_KEY: - case OID_TYPE_ADDR: - case OID_TYPE_RAW: - break; - default: - BUG(); - } -} - -/* Note : data is modified during this function */ - -int -mgt_set_request(islpci_private *priv, enum oid_num_t n, int extra, void *data) -{ - int ret = 0; - struct islpci_mgmtframe *response = NULL; - int response_op = PIMFOR_OP_ERROR; - int dlen; - void *cache, *_data = data; - u32 oid; - - BUG_ON(OID_NUM_LAST <= n); - BUG_ON(extra > isl_oid[n].range); - - if (!priv->mib) - /* memory has been freed */ - return -1; - - dlen = isl_oid[n].size; - cache = priv->mib[n]; - cache += (cache ? extra * dlen : 0); - oid = isl_oid[n].oid + extra; - - if (_data == NULL) - /* we are requested to re-set a cached value */ - _data = cache; - else - mgt_cpu_to_le(isl_oid[n].flags & OID_FLAG_TYPE, _data); - /* If we are going to write to the cache, we don't want anyone to read - * it -> acquire write lock. - * Else we could acquire a read lock to be sure we don't bother the - * commit process (which takes a write lock). But I'm not sure if it's - * needed. - */ - if (cache) - down_write(&priv->mib_sem); - - if (islpci_get_state(priv) >= PRV_STATE_READY) { - ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET, oid, - _data, dlen, &response); - if (!ret) { - response_op = response->header->operation; - islpci_mgt_release(response); - } - if (ret || response_op == PIMFOR_OP_ERROR) - ret = -EIO; - } else if (!cache) - ret = -EIO; - - if (cache) { - if (!ret && data) - memcpy(cache, _data, dlen); - up_write(&priv->mib_sem); - } - - /* re-set given data to what it was */ - if (data) - mgt_le_to_cpu(isl_oid[n].flags & OID_FLAG_TYPE, data); - - return ret; -} - -/* None of these are cached */ -int -mgt_set_varlen(islpci_private *priv, enum oid_num_t n, void *data, int extra_len) -{ - int ret = 0; - struct islpci_mgmtframe *response; - int response_op = PIMFOR_OP_ERROR; - int dlen; - u32 oid; - - BUG_ON(OID_NUM_LAST <= n); - - dlen = isl_oid[n].size; - oid = isl_oid[n].oid; - - mgt_cpu_to_le(isl_oid[n].flags & OID_FLAG_TYPE, data); - - if (islpci_get_state(priv) >= PRV_STATE_READY) { - ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET, oid, - data, dlen + extra_len, &response); - if (!ret) { - response_op = response->header->operation; - islpci_mgt_release(response); - } - if (ret || response_op == PIMFOR_OP_ERROR) - ret = -EIO; - } else - ret = -EIO; - - /* re-set given data to what it was */ - if (data) - mgt_le_to_cpu(isl_oid[n].flags & OID_FLAG_TYPE, data); - - return ret; -} - -int -mgt_get_request(islpci_private *priv, enum oid_num_t n, int extra, void *data, - union oid_res_t *res) -{ - - int ret = -EIO; - int reslen = 0; - struct islpci_mgmtframe *response = NULL; - - int dlen; - void *cache, *_res = NULL; - u32 oid; - - BUG_ON(OID_NUM_LAST <= n); - BUG_ON(extra > isl_oid[n].range); - - res->ptr = NULL; - - if (!priv->mib) - /* memory has been freed */ - return -1; - - dlen = isl_oid[n].size; - cache = priv->mib[n]; - cache += cache ? extra * dlen : 0; - oid = isl_oid[n].oid + extra; - reslen = dlen; - - if (cache) - down_read(&priv->mib_sem); - - if (islpci_get_state(priv) >= PRV_STATE_READY) { - ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET, - oid, data, dlen, &response); - if (ret || !response || - response->header->operation == PIMFOR_OP_ERROR) { - if (response) - islpci_mgt_release(response); - ret = -EIO; - } - if (!ret) { - _res = response->data; - reslen = response->header->length; - } - } else if (cache) { - _res = cache; - ret = 0; - } - if ((isl_oid[n].flags & OID_FLAG_TYPE) == OID_TYPE_U32) - res->u = ret ? 0 : le32_to_cpu(*(u32 *) _res); - else { - res->ptr = kmalloc(reslen, GFP_KERNEL); - BUG_ON(res->ptr == NULL); - if (ret) - memset(res->ptr, 0, reslen); - else { - memcpy(res->ptr, _res, reslen); - mgt_le_to_cpu(isl_oid[n].flags & OID_FLAG_TYPE, - res->ptr); - } - } - if (cache) - up_read(&priv->mib_sem); - - if (response && !ret) - islpci_mgt_release(response); - - if (reslen > isl_oid[n].size) - printk(KERN_DEBUG - "mgt_get_request(0x%x): received data length was bigger " - "than expected (%d > %d). Memory is probably corrupted...", - oid, reslen, isl_oid[n].size); - - return ret; -} - -/* lock outside */ -int -mgt_commit_list(islpci_private *priv, enum oid_num_t *l, int n) -{ - int i, ret = 0; - struct islpci_mgmtframe *response; - - for (i = 0; i < n; i++) { - struct oid_t *t = &(isl_oid[l[i]]); - void *data = priv->mib[l[i]]; - int j = 0; - u32 oid = t->oid; - BUG_ON(data == NULL); - while (j <= t->range) { - int r = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET, - oid, data, t->size, - &response); - if (response) { - r |= (response->header->operation == PIMFOR_OP_ERROR); - islpci_mgt_release(response); - } - if (r) - printk(KERN_ERR "%s: mgt_commit_list: failure. " - "oid=%08x err=%d\n", - priv->ndev->name, oid, r); - ret |= r; - j++; - oid++; - data += t->size; - } - } - return ret; -} - -/* Lock outside */ - -void -mgt_set(islpci_private *priv, enum oid_num_t n, void *data) -{ - BUG_ON(OID_NUM_LAST <= n); - BUG_ON(priv->mib[n] == NULL); - - memcpy(priv->mib[n], data, isl_oid[n].size); - mgt_cpu_to_le(isl_oid[n].flags & OID_FLAG_TYPE, priv->mib[n]); -} - -void -mgt_get(islpci_private *priv, enum oid_num_t n, void *res) -{ - BUG_ON(OID_NUM_LAST <= n); - BUG_ON(priv->mib[n] == NULL); - BUG_ON(res == NULL); - - memcpy(res, priv->mib[n], isl_oid[n].size); - mgt_le_to_cpu(isl_oid[n].flags & OID_FLAG_TYPE, res); -} - -/* Commits the cache. Lock outside. */ - -static enum oid_num_t commit_part1[] = { - OID_INL_CONFIG, - OID_INL_MODE, - DOT11_OID_BSSTYPE, - DOT11_OID_CHANNEL, - DOT11_OID_MLMEAUTOLEVEL -}; - -static enum oid_num_t commit_part2[] = { - DOT11_OID_SSID, - DOT11_OID_PSMBUFFER, - DOT11_OID_AUTHENABLE, - DOT11_OID_PRIVACYINVOKED, - DOT11_OID_EXUNENCRYPTED, - DOT11_OID_DEFKEYX, /* MULTIPLE */ - DOT11_OID_DEFKEYID, - DOT11_OID_DOT1XENABLE, - OID_INL_DOT11D_CONFORMANCE, - /* Do not initialize this - fw < 1.0.4.3 rejects it - OID_INL_OUTPUTPOWER, - */ -}; - -/* update the MAC addr. */ -static int -mgt_update_addr(islpci_private *priv) -{ - struct islpci_mgmtframe *res; - int ret; - - ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET, - isl_oid[GEN_OID_MACADDRESS].oid, NULL, - isl_oid[GEN_OID_MACADDRESS].size, &res); - - if ((ret == 0) && res && (res->header->operation != PIMFOR_OP_ERROR)) - memcpy(priv->ndev->dev_addr, res->data, 6); - else - ret = -EIO; - if (res) - islpci_mgt_release(res); - - if (ret) - printk(KERN_ERR "%s: mgt_update_addr: failure\n", priv->ndev->name); - return ret; -} - -int -mgt_commit(islpci_private *priv) -{ - int rvalue; - enum oid_num_t u; - - if (islpci_get_state(priv) < PRV_STATE_INIT) - return 0; - - rvalue = mgt_commit_list(priv, commit_part1, ARRAY_SIZE(commit_part1)); - - if (priv->iw_mode != IW_MODE_MONITOR) - rvalue |= mgt_commit_list(priv, commit_part2, ARRAY_SIZE(commit_part2)); - - u = OID_INL_MODE; - rvalue |= mgt_commit_list(priv, &u, 1); - rvalue |= mgt_update_addr(priv); - - if (rvalue) { - /* some request have failed. The device might be in an - incoherent state. We should reset it ! */ - printk(KERN_DEBUG "%s: mgt_commit: failure\n", priv->ndev->name); - } - return rvalue; -} - -/* The following OIDs need to be "unlatched": - * - * MEDIUMLIMIT,BEACONPERIOD,DTIMPERIOD,ATIMWINDOW,LISTENINTERVAL - * FREQUENCY,EXTENDEDRATES. - * - * The way to do this is to set ESSID. Note though that they may get - * unlatch before though by setting another OID. */ -#if 0 -void -mgt_unlatch_all(islpci_private *priv) -{ - u32 u; - int rvalue = 0; - - if (islpci_get_state(priv) < PRV_STATE_INIT) - return; - - u = DOT11_OID_SSID; - rvalue = mgt_commit_list(priv, &u, 1); - /* Necessary if in MANUAL RUN mode? */ -#if 0 - u = OID_INL_MODE; - rvalue |= mgt_commit_list(priv, &u, 1); - - u = DOT11_OID_MLMEAUTOLEVEL; - rvalue |= mgt_commit_list(priv, &u, 1); - - u = OID_INL_MODE; - rvalue |= mgt_commit_list(priv, &u, 1); -#endif - - if (rvalue) - printk(KERN_DEBUG "%s: Unlatching OIDs failed\n", priv->ndev->name); -} -#endif - -/* This will tell you if you are allowed to answer a mlme(ex) request .*/ - -int -mgt_mlme_answer(islpci_private *priv) -{ - u32 mlmeautolevel; - /* Acquire a read lock because if we are in a mode change, it's - * possible to answer true, while the card is leaving master to managed - * mode. Answering to a mlme in this situation could hang the card. - */ - down_read(&priv->mib_sem); - mlmeautolevel = - le32_to_cpu(*(u32 *) priv->mib[DOT11_OID_MLMEAUTOLEVEL]); - up_read(&priv->mib_sem); - - return ((priv->iw_mode == IW_MODE_MASTER) && - (mlmeautolevel >= DOT11_MLME_INTERMEDIATE)); -} - -enum oid_num_t -mgt_oidtonum(u32 oid) -{ - int i; - - for (i = 0; i < OID_NUM_LAST; i++) - if (isl_oid[i].oid == oid) - return i; - - printk(KERN_DEBUG "looking for an unknown oid 0x%x", oid); - - return OID_NUM_LAST; -} - -int -mgt_response_to_str(enum oid_num_t n, union oid_res_t *r, char *str) -{ - switch (isl_oid[n].flags & OID_FLAG_TYPE) { - case OID_TYPE_U32: - return snprintf(str, PRIV_STR_SIZE, "%u\n", r->u); - break; - case OID_TYPE_BUFFER:{ - struct obj_buffer *buff = r->ptr; - return snprintf(str, PRIV_STR_SIZE, - "size=%u\naddr=0x%X\n", buff->size, - buff->addr); - } - break; - case OID_TYPE_BSS:{ - struct obj_bss *bss = r->ptr; - return snprintf(str, PRIV_STR_SIZE, - "age=%u\nchannel=%u\n" - "capinfo=0x%X\nrates=0x%X\n" - "basic_rates=0x%X\n", bss->age, - bss->channel, bss->capinfo, - bss->rates, bss->basic_rates); - } - break; - case OID_TYPE_BSSLIST:{ - struct obj_bsslist *list = r->ptr; - int i, k; - k = snprintf(str, PRIV_STR_SIZE, "nr=%u\n", list->nr); - for (i = 0; i < list->nr; i++) - k += snprintf(str + k, PRIV_STR_SIZE - k, - "bss[%u] :\nage=%u\nchannel=%u\n" - "capinfo=0x%X\nrates=0x%X\n" - "basic_rates=0x%X\n", - i, list->bsslist[i].age, - list->bsslist[i].channel, - list->bsslist[i].capinfo, - list->bsslist[i].rates, - list->bsslist[i].basic_rates); - return k; - } - break; - case OID_TYPE_FREQUENCIES:{ - struct obj_frequencies *freq = r->ptr; - int i, t; - printk("nr : %u\n", freq->nr); - t = snprintf(str, PRIV_STR_SIZE, "nr=%u\n", freq->nr); - for (i = 0; i < freq->nr; i++) - t += snprintf(str + t, PRIV_STR_SIZE - t, - "mhz[%u]=%u\n", i, freq->mhz[i]); - return t; - } - break; - case OID_TYPE_MLME:{ - struct obj_mlme *mlme = r->ptr; - return snprintf(str, PRIV_STR_SIZE, - "id=0x%X\nstate=0x%X\ncode=0x%X\n", - mlme->id, mlme->state, mlme->code); - } - break; - case OID_TYPE_MLMEEX:{ - struct obj_mlmeex *mlme = r->ptr; - return snprintf(str, PRIV_STR_SIZE, - "id=0x%X\nstate=0x%X\n" - "code=0x%X\nsize=0x%X\n", mlme->id, - mlme->state, mlme->code, mlme->size); - } - break; - case OID_TYPE_ATTACH:{ - struct obj_attachment *attach = r->ptr; - return snprintf(str, PRIV_STR_SIZE, - "id=%d\nsize=%d\n", - attach->id, - attach->size); - } - break; - case OID_TYPE_SSID:{ - struct obj_ssid *ssid = r->ptr; - return snprintf(str, PRIV_STR_SIZE, - "length=%u\noctets=%.*s\n", - ssid->length, ssid->length, - ssid->octets); - } - break; - case OID_TYPE_KEY:{ - struct obj_key *key = r->ptr; - int t, i; - t = snprintf(str, PRIV_STR_SIZE, - "type=0x%X\nlength=0x%X\nkey=0x", - key->type, key->length); - for (i = 0; i < key->length; i++) - t += snprintf(str + t, PRIV_STR_SIZE - t, - "%02X:", key->key[i]); - t += snprintf(str + t, PRIV_STR_SIZE - t, "\n"); - return t; - } - break; - case OID_TYPE_RAW: - case OID_TYPE_ADDR:{ - unsigned char *buff = r->ptr; - int t, i; - t = snprintf(str, PRIV_STR_SIZE, "hex data="); - for (i = 0; i < isl_oid[n].size; i++) - t += snprintf(str + t, PRIV_STR_SIZE - t, - "%02X:", buff[i]); - t += snprintf(str + t, PRIV_STR_SIZE - t, "\n"); - return t; - } - break; - default: - BUG(); - } - return 0; -} diff --git a/drivers/net/wireless/prism54/oid_mgt.h b/drivers/net/wireless/prism54/oid_mgt.h deleted file mode 100644 index 92c8a2d4acd8..000000000000 --- a/drivers/net/wireless/prism54/oid_mgt.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2003 Aurelien Alleaume - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#if !defined(_OID_MGT_H) -#define _OID_MGT_H - -#include "isl_oid.h" -#include "islpci_dev.h" - -extern struct oid_t isl_oid[]; - -int mgt_init(islpci_private *); - -void mgt_clean(islpci_private *); - -/* I don't know where to put these 2 */ -extern const int frequency_list_a[]; -int channel_of_freq(int); - -void mgt_le_to_cpu(int, void *); - -int mgt_set_request(islpci_private *, enum oid_num_t, int, void *); -int mgt_set_varlen(islpci_private *, enum oid_num_t, void *, int); - - -int mgt_get_request(islpci_private *, enum oid_num_t, int, void *, - union oid_res_t *); - -int mgt_commit_list(islpci_private *, enum oid_num_t *, int); - -void mgt_set(islpci_private *, enum oid_num_t, void *); - -void mgt_get(islpci_private *, enum oid_num_t, void *); - -int mgt_commit(islpci_private *); - -int mgt_mlme_answer(islpci_private *); - -enum oid_num_t mgt_oidtonum(u32 oid); - -int mgt_response_to_str(enum oid_num_t, union oid_res_t *, char *); - -#endif /* !defined(_OID_MGT_H) */ -/* EOF */ diff --git a/drivers/net/wireless/prism54/prismcompat.h b/drivers/net/wireless/prism54/prismcompat.h deleted file mode 100644 index aa1d1747784f..000000000000 --- a/drivers/net/wireless/prism54/prismcompat.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (C) 2004 Margit Schubert-While - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -/* - * Compatibility header file to aid support of different kernel versions - */ - -#ifdef PRISM54_COMPAT24 -#include "prismcompat24.h" -#else /* PRISM54_COMPAT24 */ - -#ifndef _PRISM_COMPAT_H -#define _PRISM_COMPAT_H - -#include -#include -#include -#include -#include - -#ifndef __iomem -#define __iomem -#endif - -#define PRISM_FW_PDEV &priv->pdev->dev - -#endif /* _PRISM_COMPAT_H */ -#endif /* PRISM54_COMPAT24 */ diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c deleted file mode 100644 index 9b557a1bb7f8..000000000000 --- a/drivers/net/wireless/ray_cs.c +++ /dev/null @@ -1,2851 +0,0 @@ -/*============================================================================= - * - * A PCMCIA client driver for the Raylink wireless LAN card. - * The starting point for this module was the skeleton.c in the - * PCMCIA 2.9.12 package written by David Hinds, dahinds@users.sourceforge.net - * - * - * Copyright (c) 1998 Corey Thomas (corey@world.std.com) - * - * This driver is free software; you can redistribute it and/or modify - * it under the terms of version 2 only of the GNU General Public License as - * published by the Free Software Foundation. - * - * It is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - * Changes: - * Arnaldo Carvalho de Melo - 08/08/2000 - * - reorganize kmallocs in ray_attach, checking all for failure - * and releasing the previous allocations if one fails - * - * Daniele Bellucci - 07/10/2003 - * - Audit copy_to_user in ioctl(SIOCGIWESSID) - * -=============================================================================*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include - -/* Warning : these stuff will slow down the driver... */ -#define WIRELESS_SPY /* Enable spying addresses */ -/* Definitions we need for spy */ -typedef struct iw_statistics iw_stats; -typedef u_char mac_addr[ETH_ALEN]; /* Hardware address */ - -#include "rayctl.h" -#include "ray_cs.h" - - -/** Prototypes based on PCMCIA skeleton driver *******************************/ -static int ray_config(struct pcmcia_device *link); -static void ray_release(struct pcmcia_device *link); -static void ray_detach(struct pcmcia_device *p_dev); - -/***** Prototypes indicated by device structure ******************************/ -static int ray_dev_close(struct net_device *dev); -static int ray_dev_config(struct net_device *dev, struct ifmap *map); -static struct net_device_stats *ray_get_stats(struct net_device *dev); -static int ray_dev_init(struct net_device *dev); - -static int ray_open(struct net_device *dev); -static netdev_tx_t ray_dev_start_xmit(struct sk_buff *skb, - struct net_device *dev); -static void set_multicast_list(struct net_device *dev); -static void ray_update_multi_list(struct net_device *dev, int all); -static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx, - unsigned char *data, int len); -static void ray_build_header(ray_dev_t *local, struct tx_msg __iomem *ptx, - UCHAR msg_type, unsigned char *data); -static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len); -static iw_stats *ray_get_wireless_stats(struct net_device *dev); -static const struct iw_handler_def ray_handler_def; - -/***** Prototypes for raylink functions **************************************/ -static void authenticate(ray_dev_t *local); -static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type); -static void authenticate_timeout(u_long); -static int get_free_ccs(ray_dev_t *local); -static int get_free_tx_ccs(ray_dev_t *local); -static void init_startup_params(ray_dev_t *local); -static int parse_addr(char *in_str, UCHAR *out); -static int ray_hw_xmit(unsigned char *data, int len, struct net_device *dev, UCHAR type); -static int ray_init(struct net_device *dev); -static int interrupt_ecf(ray_dev_t *local, int ccs); -static void ray_reset(struct net_device *dev); -static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len); -static void verify_dl_startup(u_long); - -/* Prototypes for interrpt time functions **********************************/ -static irqreturn_t ray_interrupt(int reg, void *dev_id); -static void clear_interrupt(ray_dev_t *local); -static void rx_deauthenticate(ray_dev_t *local, struct rcs __iomem *prcs, - unsigned int pkt_addr, int rx_len); -static int copy_from_rx_buff(ray_dev_t *local, UCHAR *dest, int pkt_addr, int len); -static void ray_rx(struct net_device *dev, ray_dev_t *local, struct rcs __iomem *prcs); -static void release_frag_chain(ray_dev_t *local, struct rcs __iomem *prcs); -static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs, - unsigned int pkt_addr, int rx_len); -static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, - unsigned int pkt_addr, int rx_len); -static void associate(ray_dev_t *local); - -/* Card command functions */ -static int dl_startup_params(struct net_device *dev); -static void join_net(u_long local); -static void start_net(u_long local); -/* void start_net(ray_dev_t *local); */ - -/*===========================================================================*/ -/* Parameters that can be set with 'insmod' */ - -/* ADHOC=0, Infrastructure=1 */ -static int net_type = ADHOC; - -/* Hop dwell time in Kus (1024 us units defined by 802.11) */ -static int hop_dwell = 128; - -/* Beacon period in Kus */ -static int beacon_period = 256; - -/* power save mode (0 = off, 1 = save power) */ -static int psm; - -/* String for network's Extended Service Set ID. 32 Characters max */ -static char *essid; - -/* Default to encapsulation unless translation requested */ -static bool translate = 1; - -static int country = USA; - -static int sniffer; - -static int bc; - -/* 48 bit physical card address if overriding card's real physical - * address is required. Since IEEE 802.11 addresses are 48 bits - * like ethernet, an int can't be used, so a string is used. To - * allow use of addresses starting with a decimal digit, the first - * character must be a letter and will be ignored. This letter is - * followed by up to 12 hex digits which are the address. If less - * than 12 digits are used, the address will be left filled with 0's. - * Note that bit 0 of the first byte is the broadcast bit, and evil - * things will happen if it is not 0 in a card address. - */ -static char *phy_addr = NULL; - -static unsigned int ray_mem_speed = 500; - -/* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */ -static struct pcmcia_device *this_device = NULL; - -MODULE_AUTHOR("Corey Thomas "); -MODULE_DESCRIPTION("Raylink/WebGear wireless LAN driver"); -MODULE_LICENSE("GPL"); - -module_param(net_type, int, 0); -module_param(hop_dwell, int, 0); -module_param(beacon_period, int, 0); -module_param(psm, int, 0); -module_param(essid, charp, 0); -module_param(translate, bool, 0); -module_param(country, int, 0); -module_param(sniffer, int, 0); -module_param(bc, int, 0); -module_param(phy_addr, charp, 0); -module_param(ray_mem_speed, int, 0); - -static const UCHAR b5_default_startup_parms[] = { - 0, 0, /* Adhoc station */ - 'L', 'I', 'N', 'U', 'X', 0, 0, 0, /* 32 char ESSID */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, /* Active scan, CA Mode */ - 0, 0, 0, 0, 0, 0, /* No default MAC addr */ - 0x7f, 0xff, /* Frag threshold */ - 0x00, 0x80, /* Hop time 128 Kus */ - 0x01, 0x00, /* Beacon period 256 Kus */ - 0x01, 0x07, 0xa3, /* DTIM, retries, ack timeout */ - 0x1d, 0x82, 0x4e, /* SIFS, DIFS, PIFS */ - 0x7f, 0xff, /* RTS threshold */ - 0x04, 0xe2, 0x38, 0xA4, /* scan_dwell, max_scan_dwell */ - 0x05, /* assoc resp timeout thresh */ - 0x08, 0x02, 0x08, /* adhoc, infra, super cycle max */ - 0, /* Promiscuous mode */ - 0x0c, 0x0bd, /* Unique word */ - 0x32, /* Slot time */ - 0xff, 0xff, /* roam-low snr, low snr count */ - 0x05, 0xff, /* Infra, adhoc missed bcn thresh */ - 0x01, 0x0b, 0x4f, /* USA, hop pattern, hop pat length */ -/* b4 - b5 differences start here */ - 0x00, 0x3f, /* CW max */ - 0x00, 0x0f, /* CW min */ - 0x04, 0x08, /* Noise gain, limit offset */ - 0x28, 0x28, /* det rssi, med busy offsets */ - 7, /* det sync thresh */ - 0, 2, 2, /* test mode, min, max */ - 0, /* allow broadcast SSID probe resp */ - 0, 0, /* privacy must start, can join */ - 2, 0, 0, 0, 0, 0, 0, 0 /* basic rate set */ -}; - -static const UCHAR b4_default_startup_parms[] = { - 0, 0, /* Adhoc station */ - 'L', 'I', 'N', 'U', 'X', 0, 0, 0, /* 32 char ESSID */ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, /* Active scan, CA Mode */ - 0, 0, 0, 0, 0, 0, /* No default MAC addr */ - 0x7f, 0xff, /* Frag threshold */ - 0x02, 0x00, /* Hop time */ - 0x00, 0x01, /* Beacon period */ - 0x01, 0x07, 0xa3, /* DTIM, retries, ack timeout */ - 0x1d, 0x82, 0xce, /* SIFS, DIFS, PIFS */ - 0x7f, 0xff, /* RTS threshold */ - 0xfb, 0x1e, 0xc7, 0x5c, /* scan_dwell, max_scan_dwell */ - 0x05, /* assoc resp timeout thresh */ - 0x04, 0x02, 0x4, /* adhoc, infra, super cycle max */ - 0, /* Promiscuous mode */ - 0x0c, 0x0bd, /* Unique word */ - 0x4e, /* Slot time (TBD seems wrong) */ - 0xff, 0xff, /* roam-low snr, low snr count */ - 0x05, 0xff, /* Infra, adhoc missed bcn thresh */ - 0x01, 0x0b, 0x4e, /* USA, hop pattern, hop pat length */ -/* b4 - b5 differences start here */ - 0x3f, 0x0f, /* CW max, min */ - 0x04, 0x08, /* Noise gain, limit offset */ - 0x28, 0x28, /* det rssi, med busy offsets */ - 7, /* det sync thresh */ - 0, 2, 2 /* test mode, min, max */ -}; - -/*===========================================================================*/ -static const u8 eth2_llc[] = { 0xaa, 0xaa, 3, 0, 0, 0 }; - -static const char hop_pattern_length[] = { 1, - USA_HOP_MOD, EUROPE_HOP_MOD, - JAPAN_HOP_MOD, KOREA_HOP_MOD, - SPAIN_HOP_MOD, FRANCE_HOP_MOD, - ISRAEL_HOP_MOD, AUSTRALIA_HOP_MOD, - JAPAN_TEST_HOP_MOD -}; - -static const char rcsid[] = - "Raylink/WebGear wireless LAN - Corey "; - -static const struct net_device_ops ray_netdev_ops = { - .ndo_init = ray_dev_init, - .ndo_open = ray_open, - .ndo_stop = ray_dev_close, - .ndo_start_xmit = ray_dev_start_xmit, - .ndo_set_config = ray_dev_config, - .ndo_get_stats = ray_get_stats, - .ndo_set_rx_mode = set_multicast_list, - .ndo_change_mtu = eth_change_mtu, - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, -}; - -static int ray_probe(struct pcmcia_device *p_dev) -{ - ray_dev_t *local; - struct net_device *dev; - - dev_dbg(&p_dev->dev, "ray_attach()\n"); - - /* Allocate space for private device-specific data */ - dev = alloc_etherdev(sizeof(ray_dev_t)); - if (!dev) - goto fail_alloc_dev; - - local = netdev_priv(dev); - local->finder = p_dev; - - /* The io structure describes IO port mapping. None used here */ - p_dev->resource[0]->end = 0; - p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - - /* General socket configuration */ - p_dev->config_flags |= CONF_ENABLE_IRQ; - p_dev->config_index = 1; - - p_dev->priv = dev; - - local->finder = p_dev; - local->card_status = CARD_INSERTED; - local->authentication_state = UNAUTHENTICATED; - local->num_multi = 0; - dev_dbg(&p_dev->dev, "ray_attach p_dev = %p, dev = %p, local = %p, intr = %p\n", - p_dev, dev, local, &ray_interrupt); - - /* Raylink entries in the device structure */ - dev->netdev_ops = &ray_netdev_ops; - dev->wireless_handlers = &ray_handler_def; -#ifdef WIRELESS_SPY - local->wireless_data.spy_data = &local->spy_data; - dev->wireless_data = &local->wireless_data; -#endif /* WIRELESS_SPY */ - - - dev_dbg(&p_dev->dev, "ray_cs ray_attach calling ether_setup.)\n"); - netif_stop_queue(dev); - - init_timer(&local->timer); - - this_device = p_dev; - return ray_config(p_dev); - -fail_alloc_dev: - return -ENOMEM; -} /* ray_attach */ - -static void ray_detach(struct pcmcia_device *link) -{ - struct net_device *dev; - ray_dev_t *local; - - dev_dbg(&link->dev, "ray_detach\n"); - - this_device = NULL; - dev = link->priv; - - ray_release(link); - - local = netdev_priv(dev); - del_timer(&local->timer); - - if (link->priv) { - unregister_netdev(dev); - free_netdev(dev); - } - dev_dbg(&link->dev, "ray_cs ray_detach ending\n"); -} /* ray_detach */ - -#define MAX_TUPLE_SIZE 128 -static int ray_config(struct pcmcia_device *link) -{ - int ret = 0; - int i; - struct net_device *dev = (struct net_device *)link->priv; - ray_dev_t *local = netdev_priv(dev); - - dev_dbg(&link->dev, "ray_config\n"); - - /* Determine card type and firmware version */ - printk(KERN_INFO "ray_cs Detected: %s%s%s%s\n", - link->prod_id[0] ? link->prod_id[0] : " ", - link->prod_id[1] ? link->prod_id[1] : " ", - link->prod_id[2] ? link->prod_id[2] : " ", - link->prod_id[3] ? link->prod_id[3] : " "); - - /* Now allocate an interrupt line. Note that this does not - actually assign a handler to the interrupt. - */ - ret = pcmcia_request_irq(link, ray_interrupt); - if (ret) - goto failed; - dev->irq = link->irq; - - ret = pcmcia_enable_device(link); - if (ret) - goto failed; - -/*** Set up 32k window for shared memory (transmit and control) ************/ - link->resource[2]->flags |= WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; - link->resource[2]->start = 0; - link->resource[2]->end = 0x8000; - ret = pcmcia_request_window(link, link->resource[2], ray_mem_speed); - if (ret) - goto failed; - ret = pcmcia_map_mem_page(link, link->resource[2], 0); - if (ret) - goto failed; - local->sram = ioremap(link->resource[2]->start, - resource_size(link->resource[2])); - -/*** Set up 16k window for shared memory (receive buffer) ***************/ - link->resource[3]->flags |= - WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; - link->resource[3]->start = 0; - link->resource[3]->end = 0x4000; - ret = pcmcia_request_window(link, link->resource[3], ray_mem_speed); - if (ret) - goto failed; - ret = pcmcia_map_mem_page(link, link->resource[3], 0x8000); - if (ret) - goto failed; - local->rmem = ioremap(link->resource[3]->start, - resource_size(link->resource[3])); - -/*** Set up window for attribute memory ***********************************/ - link->resource[4]->flags |= - WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT; - link->resource[4]->start = 0; - link->resource[4]->end = 0x1000; - ret = pcmcia_request_window(link, link->resource[4], ray_mem_speed); - if (ret) - goto failed; - ret = pcmcia_map_mem_page(link, link->resource[4], 0); - if (ret) - goto failed; - local->amem = ioremap(link->resource[4]->start, - resource_size(link->resource[4])); - - dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); - dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); - dev_dbg(&link->dev, "ray_config amem=%p\n", local->amem); - if (ray_init(dev) < 0) { - ray_release(link); - return -ENODEV; - } - - SET_NETDEV_DEV(dev, &link->dev); - i = register_netdev(dev); - if (i != 0) { - printk("ray_config register_netdev() failed\n"); - ray_release(link); - return i; - } - - printk(KERN_INFO "%s: RayLink, irq %d, hw_addr %pM\n", - dev->name, dev->irq, dev->dev_addr); - - return 0; - -failed: - ray_release(link); - return -ENODEV; -} /* ray_config */ - -static inline struct ccs __iomem *ccs_base(ray_dev_t *dev) -{ - return dev->sram + CCS_BASE; -} - -static inline struct rcs __iomem *rcs_base(ray_dev_t *dev) -{ - /* - * This looks nonsensical, since there is a separate - * RCS_BASE. But the difference between a "struct rcs" - * and a "struct ccs" ends up being in the _index_ off - * the base, so the base pointer is the same for both - * ccs/rcs. - */ - return dev->sram + CCS_BASE; -} - -/*===========================================================================*/ -static int ray_init(struct net_device *dev) -{ - int i; - UCHAR *p; - struct ccs __iomem *pccs; - ray_dev_t *local = netdev_priv(dev); - struct pcmcia_device *link = local->finder; - dev_dbg(&link->dev, "ray_init(0x%p)\n", dev); - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_init - device not present\n"); - return -1; - } - - local->net_type = net_type; - local->sta_type = TYPE_STA; - - /* Copy the startup results to local memory */ - memcpy_fromio(&local->startup_res, local->sram + ECF_TO_HOST_BASE, - sizeof(struct startup_res_6)); - - /* Check Power up test status and get mac address from card */ - if (local->startup_res.startup_word != 0x80) { - printk(KERN_INFO "ray_init ERROR card status = %2x\n", - local->startup_res.startup_word); - local->card_status = CARD_INIT_ERROR; - return -1; - } - - local->fw_ver = local->startup_res.firmware_version[0]; - local->fw_bld = local->startup_res.firmware_version[1]; - local->fw_var = local->startup_res.firmware_version[2]; - dev_dbg(&link->dev, "ray_init firmware version %d.%d\n", local->fw_ver, - local->fw_bld); - - local->tib_length = 0x20; - if ((local->fw_ver == 5) && (local->fw_bld >= 30)) - local->tib_length = local->startup_res.tib_length; - dev_dbg(&link->dev, "ray_init tib_length = 0x%02x\n", local->tib_length); - /* Initialize CCS's to buffer free state */ - pccs = ccs_base(local); - for (i = 0; i < NUMBER_OF_CCS; i++) { - writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); - } - init_startup_params(local); - - /* copy mac address to startup parameters */ - if (parse_addr(phy_addr, local->sparm.b4.a_mac_addr)) { - p = local->sparm.b4.a_mac_addr; - } else { - memcpy(&local->sparm.b4.a_mac_addr, - &local->startup_res.station_addr, ADDRLEN); - p = local->sparm.b4.a_mac_addr; - } - - clear_interrupt(local); /* Clear any interrupt from the card */ - local->card_status = CARD_AWAITING_PARAM; - dev_dbg(&link->dev, "ray_init ending\n"); - return 0; -} /* ray_init */ - -/*===========================================================================*/ -/* Download startup parameters to the card and command it to read them */ -static int dl_startup_params(struct net_device *dev) -{ - int ccsindex; - ray_dev_t *local = netdev_priv(dev); - struct ccs __iomem *pccs; - struct pcmcia_device *link = local->finder; - - dev_dbg(&link->dev, "dl_startup_params entered\n"); - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_cs dl_startup_params - device not present\n"); - return -1; - } - - /* Copy parameters to host to ECF area */ - if (local->fw_ver == 0x55) - memcpy_toio(local->sram + HOST_TO_ECF_BASE, &local->sparm.b4, - sizeof(struct b4_startup_params)); - else - memcpy_toio(local->sram + HOST_TO_ECF_BASE, &local->sparm.b5, - sizeof(struct b5_startup_params)); - - /* Fill in the CCS fields for the ECF */ - if ((ccsindex = get_free_ccs(local)) < 0) - return -1; - local->dl_param_ccs = ccsindex; - pccs = ccs_base(local) + ccsindex; - writeb(CCS_DOWNLOAD_STARTUP_PARAMS, &pccs->cmd); - dev_dbg(&link->dev, "dl_startup_params start ccsindex = %d\n", - local->dl_param_ccs); - /* Interrupt the firmware to process the command */ - if (interrupt_ecf(local, ccsindex)) { - printk(KERN_INFO "ray dl_startup_params failed - " - "ECF not ready for intr\n"); - local->card_status = CARD_DL_PARAM_ERROR; - writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); - return -2; - } - local->card_status = CARD_DL_PARAM; - /* Start kernel timer to wait for dl startup to complete. */ - local->timer.expires = jiffies + HZ / 2; - local->timer.data = (long)local; - local->timer.function = verify_dl_startup; - add_timer(&local->timer); - dev_dbg(&link->dev, - "ray_cs dl_startup_params started timer for verify_dl_startup\n"); - return 0; -} /* dl_startup_params */ - -/*===========================================================================*/ -static void init_startup_params(ray_dev_t *local) -{ - int i; - - if (country > JAPAN_TEST) - country = USA; - else if (country < USA) - country = USA; - /* structure for hop time and beacon period is defined here using - * New 802.11D6.1 format. Card firmware is still using old format - * until version 6. - * Before After - * a_hop_time ms byte a_hop_time ms byte - * a_hop_time 2s byte a_hop_time ls byte - * a_hop_time ls byte a_beacon_period ms byte - * a_beacon_period a_beacon_period ls byte - * - * a_hop_time = uS a_hop_time = KuS - * a_beacon_period = hops a_beacon_period = KuS - *//* 64ms = 010000 */ - if (local->fw_ver == 0x55) { - memcpy((UCHAR *) &local->sparm.b4, b4_default_startup_parms, - sizeof(struct b4_startup_params)); - /* Translate sane kus input values to old build 4/5 format */ - /* i = hop time in uS truncated to 3 bytes */ - i = (hop_dwell * 1024) & 0xffffff; - local->sparm.b4.a_hop_time[0] = (i >> 16) & 0xff; - local->sparm.b4.a_hop_time[1] = (i >> 8) & 0xff; - local->sparm.b4.a_beacon_period[0] = 0; - local->sparm.b4.a_beacon_period[1] = - ((beacon_period / hop_dwell) - 1) & 0xff; - local->sparm.b4.a_curr_country_code = country; - local->sparm.b4.a_hop_pattern_length = - hop_pattern_length[(int)country] - 1; - if (bc) { - local->sparm.b4.a_ack_timeout = 0x50; - local->sparm.b4.a_sifs = 0x3f; - } - } else { /* Version 5 uses real kus values */ - memcpy((UCHAR *) &local->sparm.b5, b5_default_startup_parms, - sizeof(struct b5_startup_params)); - - local->sparm.b5.a_hop_time[0] = (hop_dwell >> 8) & 0xff; - local->sparm.b5.a_hop_time[1] = hop_dwell & 0xff; - local->sparm.b5.a_beacon_period[0] = - (beacon_period >> 8) & 0xff; - local->sparm.b5.a_beacon_period[1] = beacon_period & 0xff; - if (psm) - local->sparm.b5.a_power_mgt_state = 1; - local->sparm.b5.a_curr_country_code = country; - local->sparm.b5.a_hop_pattern_length = - hop_pattern_length[(int)country]; - } - - local->sparm.b4.a_network_type = net_type & 0x01; - local->sparm.b4.a_acting_as_ap_status = TYPE_STA; - - if (essid != NULL) - strncpy(local->sparm.b4.a_current_ess_id, essid, ESSID_SIZE); -} /* init_startup_params */ - -/*===========================================================================*/ -static void verify_dl_startup(u_long data) -{ - ray_dev_t *local = (ray_dev_t *) data; - struct ccs __iomem *pccs = ccs_base(local) + local->dl_param_ccs; - UCHAR status; - struct pcmcia_device *link = local->finder; - - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_cs verify_dl_startup - device not present\n"); - return; - } -#if 0 - { - int i; - printk(KERN_DEBUG - "verify_dl_startup parameters sent via ccs %d:\n", - local->dl_param_ccs); - for (i = 0; i < sizeof(struct b5_startup_params); i++) { - printk(" %2x", - (unsigned int)readb(local->sram + - HOST_TO_ECF_BASE + i)); - } - printk("\n"); - } -#endif - - status = readb(&pccs->buffer_status); - if (status != CCS_BUFFER_FREE) { - printk(KERN_INFO - "Download startup params failed. Status = %d\n", - status); - local->card_status = CARD_DL_PARAM_ERROR; - return; - } - if (local->sparm.b4.a_network_type == ADHOC) - start_net((u_long) local); - else - join_net((u_long) local); -} /* end verify_dl_startup */ - -/*===========================================================================*/ -/* Command card to start a network */ -static void start_net(u_long data) -{ - ray_dev_t *local = (ray_dev_t *) data; - struct ccs __iomem *pccs; - int ccsindex; - struct pcmcia_device *link = local->finder; - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_cs start_net - device not present\n"); - return; - } - /* Fill in the CCS fields for the ECF */ - if ((ccsindex = get_free_ccs(local)) < 0) - return; - pccs = ccs_base(local) + ccsindex; - writeb(CCS_START_NETWORK, &pccs->cmd); - writeb(0, &pccs->var.start_network.update_param); - /* Interrupt the firmware to process the command */ - if (interrupt_ecf(local, ccsindex)) { - dev_dbg(&link->dev, "ray start net failed - card not ready for intr\n"); - writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); - return; - } - local->card_status = CARD_DOING_ACQ; -} /* end start_net */ - -/*===========================================================================*/ -/* Command card to join a network */ -static void join_net(u_long data) -{ - ray_dev_t *local = (ray_dev_t *) data; - - struct ccs __iomem *pccs; - int ccsindex; - struct pcmcia_device *link = local->finder; - - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_cs join_net - device not present\n"); - return; - } - /* Fill in the CCS fields for the ECF */ - if ((ccsindex = get_free_ccs(local)) < 0) - return; - pccs = ccs_base(local) + ccsindex; - writeb(CCS_JOIN_NETWORK, &pccs->cmd); - writeb(0, &pccs->var.join_network.update_param); - writeb(0, &pccs->var.join_network.net_initiated); - /* Interrupt the firmware to process the command */ - if (interrupt_ecf(local, ccsindex)) { - dev_dbg(&link->dev, "ray join net failed - card not ready for intr\n"); - writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); - return; - } - local->card_status = CARD_DOING_ACQ; -} - - -static void ray_release(struct pcmcia_device *link) -{ - struct net_device *dev = link->priv; - ray_dev_t *local = netdev_priv(dev); - - dev_dbg(&link->dev, "ray_release\n"); - - del_timer(&local->timer); - - iounmap(local->sram); - iounmap(local->rmem); - iounmap(local->amem); - pcmcia_disable_device(link); - - dev_dbg(&link->dev, "ray_release ending\n"); -} - -static int ray_suspend(struct pcmcia_device *link) -{ - struct net_device *dev = link->priv; - - if (link->open) - netif_device_detach(dev); - - return 0; -} - -static int ray_resume(struct pcmcia_device *link) -{ - struct net_device *dev = link->priv; - - if (link->open) { - ray_reset(dev); - netif_device_attach(dev); - } - - return 0; -} - -/*===========================================================================*/ -static int ray_dev_init(struct net_device *dev) -{ -#ifdef RAY_IMMEDIATE_INIT - int i; -#endif /* RAY_IMMEDIATE_INIT */ - ray_dev_t *local = netdev_priv(dev); - struct pcmcia_device *link = local->finder; - - dev_dbg(&link->dev, "ray_dev_init(dev=%p)\n", dev); - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_dev_init - device not present\n"); - return -1; - } -#ifdef RAY_IMMEDIATE_INIT - /* Download startup parameters */ - if ((i = dl_startup_params(dev)) < 0) { - printk(KERN_INFO "ray_dev_init dl_startup_params failed - " - "returns 0x%x\n", i); - return -1; - } -#else /* RAY_IMMEDIATE_INIT */ - /* Postpone the card init so that we can still configure the card, - * for example using the Wireless Extensions. The init will happen - * in ray_open() - Jean II */ - dev_dbg(&link->dev, - "ray_dev_init: postponing card init to ray_open() ; Status = %d\n", - local->card_status); -#endif /* RAY_IMMEDIATE_INIT */ - - /* copy mac and broadcast addresses to linux device */ - memcpy(dev->dev_addr, &local->sparm.b4.a_mac_addr, ADDRLEN); - memset(dev->broadcast, 0xff, ETH_ALEN); - - dev_dbg(&link->dev, "ray_dev_init ending\n"); - return 0; -} - -/*===========================================================================*/ -static int ray_dev_config(struct net_device *dev, struct ifmap *map) -{ - ray_dev_t *local = netdev_priv(dev); - struct pcmcia_device *link = local->finder; - /* Dummy routine to satisfy device structure */ - dev_dbg(&link->dev, "ray_dev_config(dev=%p,ifmap=%p)\n", dev, map); - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_dev_config - device not present\n"); - return -1; - } - - return 0; -} - -/*===========================================================================*/ -static netdev_tx_t ray_dev_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - ray_dev_t *local = netdev_priv(dev); - struct pcmcia_device *link = local->finder; - short length = skb->len; - - if (!pcmcia_dev_present(link)) { - dev_dbg(&link->dev, "ray_dev_start_xmit - device not present\n"); - dev_kfree_skb(skb); - return NETDEV_TX_OK; - } - - dev_dbg(&link->dev, "ray_dev_start_xmit(skb=%p, dev=%p)\n", skb, dev); - if (local->authentication_state == NEED_TO_AUTH) { - dev_dbg(&link->dev, "ray_cs Sending authentication request.\n"); - if (!build_auth_frame(local, local->auth_id, OPEN_AUTH_REQUEST)) { - local->authentication_state = AUTHENTICATED; - netif_stop_queue(dev); - return NETDEV_TX_BUSY; - } - } - - if (length < ETH_ZLEN) { - if (skb_padto(skb, ETH_ZLEN)) - return NETDEV_TX_OK; - length = ETH_ZLEN; - } - switch (ray_hw_xmit(skb->data, length, dev, DATA_TYPE)) { - case XMIT_NO_CCS: - case XMIT_NEED_AUTH: - netif_stop_queue(dev); - return NETDEV_TX_BUSY; - case XMIT_NO_INTR: - case XMIT_MSG_BAD: - case XMIT_OK: - default: - dev_kfree_skb(skb); - } - - return NETDEV_TX_OK; -} /* ray_dev_start_xmit */ - -/*===========================================================================*/ -static int ray_hw_xmit(unsigned char *data, int len, struct net_device *dev, - UCHAR msg_type) -{ - ray_dev_t *local = netdev_priv(dev); - struct ccs __iomem *pccs; - int ccsindex; - int offset; - struct tx_msg __iomem *ptx; /* Address of xmit buffer in PC space */ - short int addr; /* Address of xmit buffer in card space */ - - pr_debug("ray_hw_xmit(data=%p, len=%d, dev=%p)\n", data, len, dev); - if (len + TX_HEADER_LENGTH > TX_BUF_SIZE) { - printk(KERN_INFO "ray_hw_xmit packet too large: %d bytes\n", - len); - return XMIT_MSG_BAD; - } - switch (ccsindex = get_free_tx_ccs(local)) { - case ECCSBUSY: - pr_debug("ray_hw_xmit tx_ccs table busy\n"); - case ECCSFULL: - pr_debug("ray_hw_xmit No free tx ccs\n"); - case ECARDGONE: - netif_stop_queue(dev); - return XMIT_NO_CCS; - default: - break; - } - addr = TX_BUF_BASE + (ccsindex << 11); - - if (msg_type == DATA_TYPE) { - local->stats.tx_bytes += len; - local->stats.tx_packets++; - } - - ptx = local->sram + addr; - - ray_build_header(local, ptx, msg_type, data); - if (translate) { - offset = translate_frame(local, ptx, data, len); - } else { /* Encapsulate frame */ - /* TBD TIB length will move address of ptx->var */ - memcpy_toio(&ptx->var, data, len); - offset = 0; - } - - /* fill in the CCS */ - pccs = ccs_base(local) + ccsindex; - len += TX_HEADER_LENGTH + offset; - writeb(CCS_TX_REQUEST, &pccs->cmd); - writeb(addr >> 8, &pccs->var.tx_request.tx_data_ptr[0]); - writeb(local->tib_length, &pccs->var.tx_request.tx_data_ptr[1]); - writeb(len >> 8, &pccs->var.tx_request.tx_data_length[0]); - writeb(len & 0xff, &pccs->var.tx_request.tx_data_length[1]); -/* TBD still need psm_cam? */ - writeb(PSM_CAM, &pccs->var.tx_request.pow_sav_mode); - writeb(local->net_default_tx_rate, &pccs->var.tx_request.tx_rate); - writeb(0, &pccs->var.tx_request.antenna); - pr_debug("ray_hw_xmit default_tx_rate = 0x%x\n", - local->net_default_tx_rate); - - /* Interrupt the firmware to process the command */ - if (interrupt_ecf(local, ccsindex)) { - pr_debug("ray_hw_xmit failed - ECF not ready for intr\n"); -/* TBD very inefficient to copy packet to buffer, and then not - send it, but the alternative is to queue the messages and that - won't be done for a while. Maybe set tbusy until a CCS is free? -*/ - writeb(CCS_BUFFER_FREE, &pccs->buffer_status); - return XMIT_NO_INTR; - } - return XMIT_OK; -} /* end ray_hw_xmit */ - -/*===========================================================================*/ -static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx, - unsigned char *data, int len) -{ - __be16 proto = ((struct ethhdr *)data)->h_proto; - if (ntohs(proto) >= ETH_P_802_3_MIN) { /* DIX II ethernet frame */ - pr_debug("ray_cs translate_frame DIX II\n"); - /* Copy LLC header to card buffer */ - memcpy_toio(&ptx->var, eth2_llc, sizeof(eth2_llc)); - memcpy_toio(((void __iomem *)&ptx->var) + sizeof(eth2_llc), - (UCHAR *) &proto, 2); - if (proto == htons(ETH_P_AARP) || proto == htons(ETH_P_IPX)) { - /* This is the selective translation table, only 2 entries */ - writeb(0xf8, - &((struct snaphdr_t __iomem *)ptx->var)->org[3]); - } - /* Copy body of ethernet packet without ethernet header */ - memcpy_toio((void __iomem *)&ptx->var + - sizeof(struct snaphdr_t), data + ETH_HLEN, - len - ETH_HLEN); - return (int)sizeof(struct snaphdr_t) - ETH_HLEN; - } else { /* already 802 type, and proto is length */ - pr_debug("ray_cs translate_frame 802\n"); - if (proto == htons(0xffff)) { /* evil netware IPX 802.3 without LLC */ - pr_debug("ray_cs translate_frame evil IPX\n"); - memcpy_toio(&ptx->var, data + ETH_HLEN, len - ETH_HLEN); - return 0 - ETH_HLEN; - } - memcpy_toio(&ptx->var, data + ETH_HLEN, len - ETH_HLEN); - return 0 - ETH_HLEN; - } - /* TBD do other frame types */ -} /* end translate_frame */ - -/*===========================================================================*/ -static void ray_build_header(ray_dev_t *local, struct tx_msg __iomem *ptx, - UCHAR msg_type, unsigned char *data) -{ - writeb(PROTOCOL_VER | msg_type, &ptx->mac.frame_ctl_1); -/*** IEEE 802.11 Address field assignments ************* - TODS FROMDS addr_1 addr_2 addr_3 addr_4 -Adhoc 0 0 dest src (terminal) BSSID N/A -AP to Terminal 0 1 dest AP(BSSID) source N/A -Terminal to AP 1 0 AP(BSSID) src (terminal) dest N/A -AP to AP 1 1 dest AP src AP dest source -*******************************************************/ - if (local->net_type == ADHOC) { - writeb(0, &ptx->mac.frame_ctl_2); - memcpy_toio(ptx->mac.addr_1, ((struct ethhdr *)data)->h_dest, - 2 * ADDRLEN); - memcpy_toio(ptx->mac.addr_3, local->bss_id, ADDRLEN); - } else { /* infrastructure */ - - if (local->sparm.b4.a_acting_as_ap_status) { - writeb(FC2_FROM_DS, &ptx->mac.frame_ctl_2); - memcpy_toio(ptx->mac.addr_1, - ((struct ethhdr *)data)->h_dest, ADDRLEN); - memcpy_toio(ptx->mac.addr_2, local->bss_id, 6); - memcpy_toio(ptx->mac.addr_3, - ((struct ethhdr *)data)->h_source, ADDRLEN); - } else { /* Terminal */ - - writeb(FC2_TO_DS, &ptx->mac.frame_ctl_2); - memcpy_toio(ptx->mac.addr_1, local->bss_id, ADDRLEN); - memcpy_toio(ptx->mac.addr_2, - ((struct ethhdr *)data)->h_source, ADDRLEN); - memcpy_toio(ptx->mac.addr_3, - ((struct ethhdr *)data)->h_dest, ADDRLEN); - } - } -} /* end encapsulate_frame */ - -/*====================================================================*/ - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get protocol name - */ -static int ray_get_name(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - strcpy(wrqu->name, "IEEE 802.11-FH"); - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set frequency - */ -static int ray_set_freq(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - ray_dev_t *local = netdev_priv(dev); - int err = -EINPROGRESS; /* Call commit handler */ - - /* Reject if card is already initialised */ - if (local->card_status != CARD_AWAITING_PARAM) - return -EBUSY; - - /* Setting by channel number */ - if ((wrqu->freq.m > USA_HOP_MOD) || (wrqu->freq.e > 0)) - err = -EOPNOTSUPP; - else - local->sparm.b5.a_hop_pattern = wrqu->freq.m; - - return err; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get frequency - */ -static int ray_get_freq(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - ray_dev_t *local = netdev_priv(dev); - - wrqu->freq.m = local->sparm.b5.a_hop_pattern; - wrqu->freq.e = 0; - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set ESSID - */ -static int ray_set_essid(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - ray_dev_t *local = netdev_priv(dev); - - /* Reject if card is already initialised */ - if (local->card_status != CARD_AWAITING_PARAM) - return -EBUSY; - - /* Check if we asked for `any' */ - if (wrqu->essid.flags == 0) - /* Corey : can you do that ? */ - return -EOPNOTSUPP; - - /* Check the size of the string */ - if (wrqu->essid.length > IW_ESSID_MAX_SIZE) - return -E2BIG; - - /* Set the ESSID in the card */ - memset(local->sparm.b5.a_current_ess_id, 0, IW_ESSID_MAX_SIZE); - memcpy(local->sparm.b5.a_current_ess_id, extra, wrqu->essid.length); - - return -EINPROGRESS; /* Call commit handler */ -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get ESSID - */ -static int ray_get_essid(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - ray_dev_t *local = netdev_priv(dev); - UCHAR tmp[IW_ESSID_MAX_SIZE + 1]; - - /* Get the essid that was set */ - memcpy(extra, local->sparm.b5.a_current_ess_id, IW_ESSID_MAX_SIZE); - memcpy(tmp, local->sparm.b5.a_current_ess_id, IW_ESSID_MAX_SIZE); - tmp[IW_ESSID_MAX_SIZE] = '\0'; - - /* Push it out ! */ - wrqu->essid.length = strlen(tmp); - wrqu->essid.flags = 1; /* active */ - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get AP address - */ -static int ray_get_wap(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - ray_dev_t *local = netdev_priv(dev); - - memcpy(wrqu->ap_addr.sa_data, local->bss_id, ETH_ALEN); - wrqu->ap_addr.sa_family = ARPHRD_ETHER; - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set Bit-Rate - */ -static int ray_set_rate(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - ray_dev_t *local = netdev_priv(dev); - - /* Reject if card is already initialised */ - if (local->card_status != CARD_AWAITING_PARAM) - return -EBUSY; - - /* Check if rate is in range */ - if ((wrqu->bitrate.value != 1000000) && (wrqu->bitrate.value != 2000000)) - return -EINVAL; - - /* Hack for 1.5 Mb/s instead of 2 Mb/s */ - if ((local->fw_ver == 0x55) && /* Please check */ - (wrqu->bitrate.value == 2000000)) - local->net_default_tx_rate = 3; - else - local->net_default_tx_rate = wrqu->bitrate.value / 500000; - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get Bit-Rate - */ -static int ray_get_rate(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - ray_dev_t *local = netdev_priv(dev); - - if (local->net_default_tx_rate == 3) - wrqu->bitrate.value = 2000000; /* Hum... */ - else - wrqu->bitrate.value = local->net_default_tx_rate * 500000; - wrqu->bitrate.fixed = 0; /* We are in auto mode */ - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set RTS threshold - */ -static int ray_set_rts(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - ray_dev_t *local = netdev_priv(dev); - int rthr = wrqu->rts.value; - - /* Reject if card is already initialised */ - if (local->card_status != CARD_AWAITING_PARAM) - return -EBUSY; - - /* if(wrq->u.rts.fixed == 0) we should complain */ - if (wrqu->rts.disabled) - rthr = 32767; - else { - if ((rthr < 0) || (rthr > 2347)) /* What's the max packet size ??? */ - return -EINVAL; - } - local->sparm.b5.a_rts_threshold[0] = (rthr >> 8) & 0xFF; - local->sparm.b5.a_rts_threshold[1] = rthr & 0xFF; - - return -EINPROGRESS; /* Call commit handler */ -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get RTS threshold - */ -static int ray_get_rts(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - ray_dev_t *local = netdev_priv(dev); - - wrqu->rts.value = (local->sparm.b5.a_rts_threshold[0] << 8) - + local->sparm.b5.a_rts_threshold[1]; - wrqu->rts.disabled = (wrqu->rts.value == 32767); - wrqu->rts.fixed = 1; - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set Fragmentation threshold - */ -static int ray_set_frag(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - ray_dev_t *local = netdev_priv(dev); - int fthr = wrqu->frag.value; - - /* Reject if card is already initialised */ - if (local->card_status != CARD_AWAITING_PARAM) - return -EBUSY; - - /* if(wrq->u.frag.fixed == 0) should complain */ - if (wrqu->frag.disabled) - fthr = 32767; - else { - if ((fthr < 256) || (fthr > 2347)) /* To check out ! */ - return -EINVAL; - } - local->sparm.b5.a_frag_threshold[0] = (fthr >> 8) & 0xFF; - local->sparm.b5.a_frag_threshold[1] = fthr & 0xFF; - - return -EINPROGRESS; /* Call commit handler */ -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get Fragmentation threshold - */ -static int ray_get_frag(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - ray_dev_t *local = netdev_priv(dev); - - wrqu->frag.value = (local->sparm.b5.a_frag_threshold[0] << 8) - + local->sparm.b5.a_frag_threshold[1]; - wrqu->frag.disabled = (wrqu->frag.value == 32767); - wrqu->frag.fixed = 1; - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : set Mode of Operation - */ -static int ray_set_mode(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - ray_dev_t *local = netdev_priv(dev); - int err = -EINPROGRESS; /* Call commit handler */ - char card_mode = 1; - - /* Reject if card is already initialised */ - if (local->card_status != CARD_AWAITING_PARAM) - return -EBUSY; - - switch (wrqu->mode) { - case IW_MODE_ADHOC: - card_mode = 0; - /* Fall through */ - case IW_MODE_INFRA: - local->sparm.b5.a_network_type = card_mode; - break; - default: - err = -EINVAL; - } - - return err; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get Mode of Operation - */ -static int ray_get_mode(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - ray_dev_t *local = netdev_priv(dev); - - if (local->sparm.b5.a_network_type) - wrqu->mode = IW_MODE_INFRA; - else - wrqu->mode = IW_MODE_ADHOC; - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Handler : get range info - */ -static int ray_get_range(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct iw_range *range = (struct iw_range *)extra; - - memset(range, 0, sizeof(struct iw_range)); - - /* Set the length (very important for backward compatibility) */ - wrqu->data.length = sizeof(struct iw_range); - - /* Set the Wireless Extension versions */ - range->we_version_compiled = WIRELESS_EXT; - range->we_version_source = 9; - - /* Set information in the range struct */ - range->throughput = 1.1 * 1000 * 1000; /* Put the right number here */ - range->num_channels = hop_pattern_length[(int)country]; - range->num_frequency = 0; - range->max_qual.qual = 0; - range->max_qual.level = 255; /* What's the correct value ? */ - range->max_qual.noise = 255; /* Idem */ - range->num_bitrates = 2; - range->bitrate[0] = 1000000; /* 1 Mb/s */ - range->bitrate[1] = 2000000; /* 2 Mb/s */ - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Private Handler : set framing mode - */ -static int ray_set_framing(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - translate = !!*(extra); /* Set framing mode */ - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Private Handler : get framing mode - */ -static int ray_get_framing(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - *(extra) = translate; - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Wireless Private Handler : get country - */ -static int ray_get_country(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - *(extra) = country; - - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Commit handler : called after a bunch of SET operations - */ -static int ray_commit(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - return 0; -} - -/*------------------------------------------------------------------*/ -/* - * Stats handler : return Wireless Stats - */ -static iw_stats *ray_get_wireless_stats(struct net_device *dev) -{ - ray_dev_t *local = netdev_priv(dev); - struct pcmcia_device *link = local->finder; - struct status __iomem *p = local->sram + STATUS_BASE; - - local->wstats.status = local->card_status; -#ifdef WIRELESS_SPY - if ((local->spy_data.spy_number > 0) - && (local->sparm.b5.a_network_type == 0)) { - /* Get it from the first node in spy list */ - local->wstats.qual.qual = local->spy_data.spy_stat[0].qual; - local->wstats.qual.level = local->spy_data.spy_stat[0].level; - local->wstats.qual.noise = local->spy_data.spy_stat[0].noise; - local->wstats.qual.updated = - local->spy_data.spy_stat[0].updated; - } -#endif /* WIRELESS_SPY */ - - if (pcmcia_dev_present(link)) { - local->wstats.qual.noise = readb(&p->rxnoise); - local->wstats.qual.updated |= 4; - } - - return &local->wstats; -} /* end ray_get_wireless_stats */ - -/*------------------------------------------------------------------*/ -/* - * Structures to export the Wireless Handlers - */ - -static const iw_handler ray_handler[] = { - IW_HANDLER(SIOCSIWCOMMIT, ray_commit), - IW_HANDLER(SIOCGIWNAME, ray_get_name), - IW_HANDLER(SIOCSIWFREQ, ray_set_freq), - IW_HANDLER(SIOCGIWFREQ, ray_get_freq), - IW_HANDLER(SIOCSIWMODE, ray_set_mode), - IW_HANDLER(SIOCGIWMODE, ray_get_mode), - IW_HANDLER(SIOCGIWRANGE, ray_get_range), -#ifdef WIRELESS_SPY - IW_HANDLER(SIOCSIWSPY, iw_handler_set_spy), - IW_HANDLER(SIOCGIWSPY, iw_handler_get_spy), - IW_HANDLER(SIOCSIWTHRSPY, iw_handler_set_thrspy), - IW_HANDLER(SIOCGIWTHRSPY, iw_handler_get_thrspy), -#endif /* WIRELESS_SPY */ - IW_HANDLER(SIOCGIWAP, ray_get_wap), - IW_HANDLER(SIOCSIWESSID, ray_set_essid), - IW_HANDLER(SIOCGIWESSID, ray_get_essid), - IW_HANDLER(SIOCSIWRATE, ray_set_rate), - IW_HANDLER(SIOCGIWRATE, ray_get_rate), - IW_HANDLER(SIOCSIWRTS, ray_set_rts), - IW_HANDLER(SIOCGIWRTS, ray_get_rts), - IW_HANDLER(SIOCSIWFRAG, ray_set_frag), - IW_HANDLER(SIOCGIWFRAG, ray_get_frag), -}; - -#define SIOCSIPFRAMING SIOCIWFIRSTPRIV /* Set framing mode */ -#define SIOCGIPFRAMING SIOCIWFIRSTPRIV + 1 /* Get framing mode */ -#define SIOCGIPCOUNTRY SIOCIWFIRSTPRIV + 3 /* Get country code */ - -static const iw_handler ray_private_handler[] = { - [0] = ray_set_framing, - [1] = ray_get_framing, - [3] = ray_get_country, -}; - -static const struct iw_priv_args ray_private_args[] = { -/* cmd, set_args, get_args, name */ - {SIOCSIPFRAMING, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, 0, - "set_framing"}, - {SIOCGIPFRAMING, 0, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, - "get_framing"}, - {SIOCGIPCOUNTRY, 0, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 1, - "get_country"}, -}; - -static const struct iw_handler_def ray_handler_def = { - .num_standard = ARRAY_SIZE(ray_handler), - .num_private = ARRAY_SIZE(ray_private_handler), - .num_private_args = ARRAY_SIZE(ray_private_args), - .standard = ray_handler, - .private = ray_private_handler, - .private_args = ray_private_args, - .get_wireless_stats = ray_get_wireless_stats, -}; - -/*===========================================================================*/ -static int ray_open(struct net_device *dev) -{ - ray_dev_t *local = netdev_priv(dev); - struct pcmcia_device *link; - link = local->finder; - - dev_dbg(&link->dev, "ray_open('%s')\n", dev->name); - - if (link->open == 0) - local->num_multi = 0; - link->open++; - - /* If the card is not started, time to start it ! - Jean II */ - if (local->card_status == CARD_AWAITING_PARAM) { - int i; - - dev_dbg(&link->dev, "ray_open: doing init now !\n"); - - /* Download startup parameters */ - if ((i = dl_startup_params(dev)) < 0) { - printk(KERN_INFO - "ray_dev_init dl_startup_params failed - " - "returns 0x%x\n", i); - return -1; - } - } - - if (sniffer) - netif_stop_queue(dev); - else - netif_start_queue(dev); - - dev_dbg(&link->dev, "ray_open ending\n"); - return 0; -} /* end ray_open */ - -/*===========================================================================*/ -static int ray_dev_close(struct net_device *dev) -{ - ray_dev_t *local = netdev_priv(dev); - struct pcmcia_device *link; - link = local->finder; - - dev_dbg(&link->dev, "ray_dev_close('%s')\n", dev->name); - - link->open--; - netif_stop_queue(dev); - - /* In here, we should stop the hardware (stop card from beeing active) - * and set local->card_status to CARD_AWAITING_PARAM, so that while the - * card is closed we can chage its configuration. - * Probably also need a COR reset to get sane state - Jean II */ - - return 0; -} /* end ray_dev_close */ - -/*===========================================================================*/ -static void ray_reset(struct net_device *dev) -{ - pr_debug("ray_reset entered\n"); -} - -/*===========================================================================*/ -/* Cause a firmware interrupt if it is ready for one */ -/* Return nonzero if not ready */ -static int interrupt_ecf(ray_dev_t *local, int ccs) -{ - int i = 50; - struct pcmcia_device *link = local->finder; - - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_cs interrupt_ecf - device not present\n"); - return -1; - } - dev_dbg(&link->dev, "interrupt_ecf(local=%p, ccs = 0x%x\n", local, ccs); - - while (i && - (readb(local->amem + CIS_OFFSET + ECF_INTR_OFFSET) & - ECF_INTR_SET)) - i--; - if (i == 0) { - dev_dbg(&link->dev, "ray_cs interrupt_ecf card not ready for interrupt\n"); - return -1; - } - /* Fill the mailbox, then kick the card */ - writeb(ccs, local->sram + SCB_BASE); - writeb(ECF_INTR_SET, local->amem + CIS_OFFSET + ECF_INTR_OFFSET); - return 0; -} /* interrupt_ecf */ - -/*===========================================================================*/ -/* Get next free transmit CCS */ -/* Return - index of current tx ccs */ -static int get_free_tx_ccs(ray_dev_t *local) -{ - int i; - struct ccs __iomem *pccs = ccs_base(local); - struct pcmcia_device *link = local->finder; - - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_cs get_free_tx_ccs - device not present\n"); - return ECARDGONE; - } - - if (test_and_set_bit(0, &local->tx_ccs_lock)) { - dev_dbg(&link->dev, "ray_cs tx_ccs_lock busy\n"); - return ECCSBUSY; - } - - for (i = 0; i < NUMBER_OF_TX_CCS; i++) { - if (readb(&(pccs + i)->buffer_status) == CCS_BUFFER_FREE) { - writeb(CCS_BUFFER_BUSY, &(pccs + i)->buffer_status); - writeb(CCS_END_LIST, &(pccs + i)->link); - local->tx_ccs_lock = 0; - return i; - } - } - local->tx_ccs_lock = 0; - dev_dbg(&link->dev, "ray_cs ERROR no free tx CCS for raylink card\n"); - return ECCSFULL; -} /* get_free_tx_ccs */ - -/*===========================================================================*/ -/* Get next free CCS */ -/* Return - index of current ccs */ -static int get_free_ccs(ray_dev_t *local) -{ - int i; - struct ccs __iomem *pccs = ccs_base(local); - struct pcmcia_device *link = local->finder; - - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_cs get_free_ccs - device not present\n"); - return ECARDGONE; - } - if (test_and_set_bit(0, &local->ccs_lock)) { - dev_dbg(&link->dev, "ray_cs ccs_lock busy\n"); - return ECCSBUSY; - } - - for (i = NUMBER_OF_TX_CCS; i < NUMBER_OF_CCS; i++) { - if (readb(&(pccs + i)->buffer_status) == CCS_BUFFER_FREE) { - writeb(CCS_BUFFER_BUSY, &(pccs + i)->buffer_status); - writeb(CCS_END_LIST, &(pccs + i)->link); - local->ccs_lock = 0; - return i; - } - } - local->ccs_lock = 0; - dev_dbg(&link->dev, "ray_cs ERROR no free CCS for raylink card\n"); - return ECCSFULL; -} /* get_free_ccs */ - -/*===========================================================================*/ -static void authenticate_timeout(u_long data) -{ - ray_dev_t *local = (ray_dev_t *) data; - del_timer(&local->timer); - printk(KERN_INFO "ray_cs Authentication with access point failed" - " - timeout\n"); - join_net((u_long) local); -} - -/*===========================================================================*/ -static int parse_addr(char *in_str, UCHAR *out) -{ - int len; - int i, j, k; - int status; - - if (in_str == NULL) - return 0; - if ((len = strlen(in_str)) < 2) - return 0; - memset(out, 0, ADDRLEN); - - status = 1; - j = len - 1; - if (j > 12) - j = 12; - i = 5; - - while (j > 0) { - if ((k = hex_to_bin(in_str[j--])) != -1) - out[i] = k; - else - return 0; - - if (j == 0) - break; - if ((k = hex_to_bin(in_str[j--])) != -1) - out[i] += k << 4; - else - return 0; - if (!i--) - break; - } - return status; -} - -/*===========================================================================*/ -static struct net_device_stats *ray_get_stats(struct net_device *dev) -{ - ray_dev_t *local = netdev_priv(dev); - struct pcmcia_device *link = local->finder; - struct status __iomem *p = local->sram + STATUS_BASE; - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_cs net_device_stats - device not present\n"); - return &local->stats; - } - if (readb(&p->mrx_overflow_for_host)) { - local->stats.rx_over_errors += swab16(readw(&p->mrx_overflow)); - writeb(0, &p->mrx_overflow); - writeb(0, &p->mrx_overflow_for_host); - } - if (readb(&p->mrx_checksum_error_for_host)) { - local->stats.rx_crc_errors += - swab16(readw(&p->mrx_checksum_error)); - writeb(0, &p->mrx_checksum_error); - writeb(0, &p->mrx_checksum_error_for_host); - } - if (readb(&p->rx_hec_error_for_host)) { - local->stats.rx_frame_errors += swab16(readw(&p->rx_hec_error)); - writeb(0, &p->rx_hec_error); - writeb(0, &p->rx_hec_error_for_host); - } - return &local->stats; -} - -/*===========================================================================*/ -static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, - int len) -{ - ray_dev_t *local = netdev_priv(dev); - struct pcmcia_device *link = local->finder; - int ccsindex; - int i; - struct ccs __iomem *pccs; - - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_update_parm - device not present\n"); - return; - } - - if ((ccsindex = get_free_ccs(local)) < 0) { - dev_dbg(&link->dev, "ray_update_parm - No free ccs\n"); - return; - } - pccs = ccs_base(local) + ccsindex; - writeb(CCS_UPDATE_PARAMS, &pccs->cmd); - writeb(objid, &pccs->var.update_param.object_id); - writeb(1, &pccs->var.update_param.number_objects); - writeb(0, &pccs->var.update_param.failure_cause); - for (i = 0; i < len; i++) { - writeb(value[i], local->sram + HOST_TO_ECF_BASE); - } - /* Interrupt the firmware to process the command */ - if (interrupt_ecf(local, ccsindex)) { - dev_dbg(&link->dev, "ray_cs associate failed - ECF not ready for intr\n"); - writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); - } -} - -/*===========================================================================*/ -static void ray_update_multi_list(struct net_device *dev, int all) -{ - int ccsindex; - struct ccs __iomem *pccs; - ray_dev_t *local = netdev_priv(dev); - struct pcmcia_device *link = local->finder; - void __iomem *p = local->sram + HOST_TO_ECF_BASE; - - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_update_multi_list - device not present\n"); - return; - } else - dev_dbg(&link->dev, "ray_update_multi_list(%p)\n", dev); - if ((ccsindex = get_free_ccs(local)) < 0) { - dev_dbg(&link->dev, "ray_update_multi - No free ccs\n"); - return; - } - pccs = ccs_base(local) + ccsindex; - writeb(CCS_UPDATE_MULTICAST_LIST, &pccs->cmd); - - if (all) { - writeb(0xff, &pccs->var); - local->num_multi = 0xff; - } else { - struct netdev_hw_addr *ha; - int i = 0; - - /* Copy the kernel's list of MC addresses to card */ - netdev_for_each_mc_addr(ha, dev) { - memcpy_toio(p, ha->addr, ETH_ALEN); - dev_dbg(&link->dev, "ray_update_multi add addr %pm\n", - ha->addr); - p += ETH_ALEN; - i++; - } - if (i > 256 / ADDRLEN) - i = 256 / ADDRLEN; - writeb((UCHAR) i, &pccs->var); - dev_dbg(&link->dev, "ray_cs update_multi %d addresses in list\n", i); - /* Interrupt the firmware to process the command */ - local->num_multi = i; - } - if (interrupt_ecf(local, ccsindex)) { - dev_dbg(&link->dev, - "ray_cs update_multi failed - ECF not ready for intr\n"); - writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); - } -} /* end ray_update_multi_list */ - -/*===========================================================================*/ -static void set_multicast_list(struct net_device *dev) -{ - ray_dev_t *local = netdev_priv(dev); - UCHAR promisc; - - pr_debug("ray_cs set_multicast_list(%p)\n", dev); - - if (dev->flags & IFF_PROMISC) { - if (local->sparm.b5.a_promiscuous_mode == 0) { - pr_debug("ray_cs set_multicast_list promisc on\n"); - local->sparm.b5.a_promiscuous_mode = 1; - promisc = 1; - ray_update_parm(dev, OBJID_promiscuous_mode, - &promisc, sizeof(promisc)); - } - } else { - if (local->sparm.b5.a_promiscuous_mode == 1) { - pr_debug("ray_cs set_multicast_list promisc off\n"); - local->sparm.b5.a_promiscuous_mode = 0; - promisc = 0; - ray_update_parm(dev, OBJID_promiscuous_mode, - &promisc, sizeof(promisc)); - } - } - - if (dev->flags & IFF_ALLMULTI) - ray_update_multi_list(dev, 1); - else { - if (local->num_multi != netdev_mc_count(dev)) - ray_update_multi_list(dev, 0); - } -} /* end set_multicast_list */ - -/*============================================================================= - * All routines below here are run at interrupt time. -=============================================================================*/ -static irqreturn_t ray_interrupt(int irq, void *dev_id) -{ - struct net_device *dev = (struct net_device *)dev_id; - struct pcmcia_device *link; - ray_dev_t *local; - struct ccs __iomem *pccs; - struct rcs __iomem *prcs; - UCHAR rcsindex; - UCHAR tmp; - UCHAR cmd; - UCHAR status; - UCHAR memtmp[ESSID_SIZE + 1]; - - - if (dev == NULL) /* Note that we want interrupts with dev->start == 0 */ - return IRQ_NONE; - - pr_debug("ray_cs: interrupt for *dev=%p\n", dev); - - local = netdev_priv(dev); - link = local->finder; - if (!pcmcia_dev_present(link)) { - pr_debug( - "ray_cs interrupt from device not present or suspended.\n"); - return IRQ_NONE; - } - rcsindex = readb(&((struct scb __iomem *)(local->sram))->rcs_index); - - if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) { - dev_dbg(&link->dev, "ray_cs interrupt bad rcsindex = 0x%x\n", rcsindex); - clear_interrupt(local); - return IRQ_HANDLED; - } - if (rcsindex < NUMBER_OF_CCS) { /* If it's a returned CCS */ - pccs = ccs_base(local) + rcsindex; - cmd = readb(&pccs->cmd); - status = readb(&pccs->buffer_status); - switch (cmd) { - case CCS_DOWNLOAD_STARTUP_PARAMS: /* Happens in firmware someday */ - del_timer(&local->timer); - if (status == CCS_COMMAND_COMPLETE) { - dev_dbg(&link->dev, - "ray_cs interrupt download_startup_parameters OK\n"); - } else { - dev_dbg(&link->dev, - "ray_cs interrupt download_startup_parameters fail\n"); - } - break; - case CCS_UPDATE_PARAMS: - dev_dbg(&link->dev, "ray_cs interrupt update params done\n"); - if (status != CCS_COMMAND_COMPLETE) { - tmp = - readb(&pccs->var.update_param. - failure_cause); - dev_dbg(&link->dev, - "ray_cs interrupt update params failed - reason %d\n", - tmp); - } - break; - case CCS_REPORT_PARAMS: - dev_dbg(&link->dev, "ray_cs interrupt report params done\n"); - break; - case CCS_UPDATE_MULTICAST_LIST: /* Note that this CCS isn't returned */ - dev_dbg(&link->dev, - "ray_cs interrupt CCS Update Multicast List done\n"); - break; - case CCS_UPDATE_POWER_SAVINGS_MODE: - dev_dbg(&link->dev, - "ray_cs interrupt update power save mode done\n"); - break; - case CCS_START_NETWORK: - case CCS_JOIN_NETWORK: - memcpy(memtmp, local->sparm.b4.a_current_ess_id, - ESSID_SIZE); - memtmp[ESSID_SIZE] = '\0'; - - if (status == CCS_COMMAND_COMPLETE) { - if (readb - (&pccs->var.start_network.net_initiated) == - 1) { - dev_dbg(&link->dev, - "ray_cs interrupt network \"%s\" started\n", - memtmp); - } else { - dev_dbg(&link->dev, - "ray_cs interrupt network \"%s\" joined\n", - memtmp); - } - memcpy_fromio(&local->bss_id, - pccs->var.start_network.bssid, - ADDRLEN); - - if (local->fw_ver == 0x55) - local->net_default_tx_rate = 3; - else - local->net_default_tx_rate = - readb(&pccs->var.start_network. - net_default_tx_rate); - local->encryption = - readb(&pccs->var.start_network.encryption); - if (!sniffer && (local->net_type == INFRA) - && !(local->sparm.b4.a_acting_as_ap_status)) { - authenticate(local); - } - local->card_status = CARD_ACQ_COMPLETE; - } else { - local->card_status = CARD_ACQ_FAILED; - - del_timer(&local->timer); - local->timer.expires = jiffies + HZ * 5; - local->timer.data = (long)local; - if (status == CCS_START_NETWORK) { - dev_dbg(&link->dev, - "ray_cs interrupt network \"%s\" start failed\n", - memtmp); - local->timer.function = start_net; - } else { - dev_dbg(&link->dev, - "ray_cs interrupt network \"%s\" join failed\n", - memtmp); - local->timer.function = join_net; - } - add_timer(&local->timer); - } - break; - case CCS_START_ASSOCIATION: - if (status == CCS_COMMAND_COMPLETE) { - local->card_status = CARD_ASSOC_COMPLETE; - dev_dbg(&link->dev, "ray_cs association successful\n"); - } else { - dev_dbg(&link->dev, "ray_cs association failed,\n"); - local->card_status = CARD_ASSOC_FAILED; - join_net((u_long) local); - } - break; - case CCS_TX_REQUEST: - if (status == CCS_COMMAND_COMPLETE) { - dev_dbg(&link->dev, - "ray_cs interrupt tx request complete\n"); - } else { - dev_dbg(&link->dev, - "ray_cs interrupt tx request failed\n"); - } - if (!sniffer) - netif_start_queue(dev); - netif_wake_queue(dev); - break; - case CCS_TEST_MEMORY: - dev_dbg(&link->dev, "ray_cs interrupt mem test done\n"); - break; - case CCS_SHUTDOWN: - dev_dbg(&link->dev, - "ray_cs interrupt Unexpected CCS returned - Shutdown\n"); - break; - case CCS_DUMP_MEMORY: - dev_dbg(&link->dev, "ray_cs interrupt dump memory done\n"); - break; - case CCS_START_TIMER: - dev_dbg(&link->dev, - "ray_cs interrupt DING - raylink timer expired\n"); - break; - default: - dev_dbg(&link->dev, - "ray_cs interrupt Unexpected CCS 0x%x returned 0x%x\n", - rcsindex, cmd); - } - writeb(CCS_BUFFER_FREE, &pccs->buffer_status); - } else { /* It's an RCS */ - - prcs = rcs_base(local) + rcsindex; - - switch (readb(&prcs->interrupt_id)) { - case PROCESS_RX_PACKET: - ray_rx(dev, local, prcs); - break; - case REJOIN_NET_COMPLETE: - dev_dbg(&link->dev, "ray_cs interrupt rejoin net complete\n"); - local->card_status = CARD_ACQ_COMPLETE; - /* do we need to clear tx buffers CCS's? */ - if (local->sparm.b4.a_network_type == ADHOC) { - if (!sniffer) - netif_start_queue(dev); - } else { - memcpy_fromio(&local->bss_id, - prcs->var.rejoin_net_complete. - bssid, ADDRLEN); - dev_dbg(&link->dev, "ray_cs new BSSID = %pm\n", - local->bss_id); - if (!sniffer) - authenticate(local); - } - break; - case ROAMING_INITIATED: - dev_dbg(&link->dev, "ray_cs interrupt roaming initiated\n"); - netif_stop_queue(dev); - local->card_status = CARD_DOING_ACQ; - break; - case JAPAN_CALL_SIGN_RXD: - dev_dbg(&link->dev, "ray_cs interrupt japan call sign rx\n"); - break; - default: - dev_dbg(&link->dev, - "ray_cs Unexpected interrupt for RCS 0x%x cmd = 0x%x\n", - rcsindex, - (unsigned int)readb(&prcs->interrupt_id)); - break; - } - writeb(CCS_BUFFER_FREE, &prcs->buffer_status); - } - clear_interrupt(local); - return IRQ_HANDLED; -} /* ray_interrupt */ - -/*===========================================================================*/ -static void ray_rx(struct net_device *dev, ray_dev_t *local, - struct rcs __iomem *prcs) -{ - int rx_len; - unsigned int pkt_addr; - void __iomem *pmsg; - pr_debug("ray_rx process rx packet\n"); - - /* Calculate address of packet within Rx buffer */ - pkt_addr = ((readb(&prcs->var.rx_packet.rx_data_ptr[0]) << 8) - + readb(&prcs->var.rx_packet.rx_data_ptr[1])) & RX_BUFF_END; - /* Length of first packet fragment */ - rx_len = (readb(&prcs->var.rx_packet.rx_data_length[0]) << 8) - + readb(&prcs->var.rx_packet.rx_data_length[1]); - - local->last_rsl = readb(&prcs->var.rx_packet.rx_sig_lev); - pmsg = local->rmem + pkt_addr; - switch (readb(pmsg)) { - case DATA_TYPE: - pr_debug("ray_rx data type\n"); - rx_data(dev, prcs, pkt_addr, rx_len); - break; - case AUTHENTIC_TYPE: - pr_debug("ray_rx authentic type\n"); - if (sniffer) - rx_data(dev, prcs, pkt_addr, rx_len); - else - rx_authenticate(local, prcs, pkt_addr, rx_len); - break; - case DEAUTHENTIC_TYPE: - pr_debug("ray_rx deauth type\n"); - if (sniffer) - rx_data(dev, prcs, pkt_addr, rx_len); - else - rx_deauthenticate(local, prcs, pkt_addr, rx_len); - break; - case NULL_MSG_TYPE: - pr_debug("ray_cs rx NULL msg\n"); - break; - case BEACON_TYPE: - pr_debug("ray_rx beacon type\n"); - if (sniffer) - rx_data(dev, prcs, pkt_addr, rx_len); - - copy_from_rx_buff(local, (UCHAR *) &local->last_bcn, pkt_addr, - rx_len < sizeof(struct beacon_rx) ? - rx_len : sizeof(struct beacon_rx)); - - local->beacon_rxed = 1; - /* Get the statistics so the card counters never overflow */ - ray_get_stats(dev); - break; - default: - pr_debug("ray_cs unknown pkt type %2x\n", - (unsigned int)readb(pmsg)); - break; - } - -} /* end ray_rx */ - -/*===========================================================================*/ -static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, - unsigned int pkt_addr, int rx_len) -{ - struct sk_buff *skb = NULL; - struct rcs __iomem *prcslink = prcs; - ray_dev_t *local = netdev_priv(dev); - UCHAR *rx_ptr; - int total_len; - int tmp; -#ifdef WIRELESS_SPY - int siglev = local->last_rsl; - u_char linksrcaddr[ETH_ALEN]; /* Other end of the wireless link */ -#endif - - if (!sniffer) { - if (translate) { -/* TBD length needs fixing for translated header */ - if (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) || - rx_len > - (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + - FCS_LEN)) { - pr_debug( - "ray_cs invalid packet length %d received\n", - rx_len); - return; - } - } else { /* encapsulated ethernet */ - - if (rx_len < (ETH_HLEN + RX_MAC_HEADER_LENGTH) || - rx_len > - (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + - FCS_LEN)) { - pr_debug( - "ray_cs invalid packet length %d received\n", - rx_len); - return; - } - } - } - pr_debug("ray_cs rx_data packet\n"); - /* If fragmented packet, verify sizes of fragments add up */ - if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { - pr_debug("ray_cs rx'ed fragment\n"); - tmp = (readb(&prcs->var.rx_packet.totalpacketlength[0]) << 8) - + readb(&prcs->var.rx_packet.totalpacketlength[1]); - total_len = tmp; - prcslink = prcs; - do { - tmp -= - (readb(&prcslink->var.rx_packet.rx_data_length[0]) - << 8) - + readb(&prcslink->var.rx_packet.rx_data_length[1]); - if (readb(&prcslink->var.rx_packet.next_frag_rcs_index) - == 0xFF || tmp < 0) - break; - prcslink = rcs_base(local) - + readb(&prcslink->link_field); - } while (1); - - if (tmp < 0) { - pr_debug( - "ray_cs rx_data fragment lengths don't add up\n"); - local->stats.rx_dropped++; - release_frag_chain(local, prcs); - return; - } - } else { /* Single unfragmented packet */ - total_len = rx_len; - } - - skb = dev_alloc_skb(total_len + 5); - if (skb == NULL) { - pr_debug("ray_cs rx_data could not allocate skb\n"); - local->stats.rx_dropped++; - if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) - release_frag_chain(local, prcs); - return; - } - skb_reserve(skb, 2); /* Align IP on 16 byte (TBD check this) */ - - pr_debug("ray_cs rx_data total_len = %x, rx_len = %x\n", total_len, - rx_len); - -/************************/ - /* Reserve enough room for the whole damn packet. */ - rx_ptr = skb_put(skb, total_len); - /* Copy the whole packet to sk_buff */ - rx_ptr += - copy_from_rx_buff(local, rx_ptr, pkt_addr & RX_BUFF_END, rx_len); - /* Get source address */ -#ifdef WIRELESS_SPY - skb_copy_from_linear_data_offset(skb, - offsetof(struct mac_header, addr_2), - linksrcaddr, ETH_ALEN); -#endif - /* Now, deal with encapsulation/translation/sniffer */ - if (!sniffer) { - if (!translate) { - /* Encapsulated ethernet, so just lop off 802.11 MAC header */ -/* TBD reserve skb_reserve( skb, RX_MAC_HEADER_LENGTH); */ - skb_pull(skb, RX_MAC_HEADER_LENGTH); - } else { - /* Do translation */ - untranslate(local, skb, total_len); - } - } else { /* sniffer mode, so just pass whole packet */ - }; - -/************************/ - /* Now pick up the rest of the fragments if any */ - tmp = 17; - if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { - prcslink = prcs; - pr_debug("ray_cs rx_data in fragment loop\n"); - do { - prcslink = rcs_base(local) - + - readb(&prcslink->var.rx_packet.next_frag_rcs_index); - rx_len = - ((readb(&prcslink->var.rx_packet.rx_data_length[0]) - << 8) - + - readb(&prcslink->var.rx_packet.rx_data_length[1])) - & RX_BUFF_END; - pkt_addr = - ((readb(&prcslink->var.rx_packet.rx_data_ptr[0]) << - 8) - + readb(&prcslink->var.rx_packet.rx_data_ptr[1])) - & RX_BUFF_END; - - rx_ptr += - copy_from_rx_buff(local, rx_ptr, pkt_addr, rx_len); - - } while (tmp-- && - readb(&prcslink->var.rx_packet.next_frag_rcs_index) != - 0xFF); - release_frag_chain(local, prcs); - } - - skb->protocol = eth_type_trans(skb, dev); - netif_rx(skb); - local->stats.rx_packets++; - local->stats.rx_bytes += total_len; - - /* Gather signal strength per address */ -#ifdef WIRELESS_SPY - /* For the Access Point or the node having started the ad-hoc net - * note : ad-hoc work only in some specific configurations, but we - * kludge in ray_get_wireless_stats... */ - if (!memcmp(linksrcaddr, local->bss_id, ETH_ALEN)) { - /* Update statistics */ - /*local->wstats.qual.qual = none ? */ - local->wstats.qual.level = siglev; - /*local->wstats.qual.noise = none ? */ - local->wstats.qual.updated = 0x2; - } - /* Now, update the spy stuff */ - { - struct iw_quality wstats; - wstats.level = siglev; - /* wstats.noise = none ? */ - /* wstats.qual = none ? */ - wstats.updated = 0x2; - /* Update spy records */ - wireless_spy_update(dev, linksrcaddr, &wstats); - } -#endif /* WIRELESS_SPY */ -} /* end rx_data */ - -/*===========================================================================*/ -static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len) -{ - snaphdr_t *psnap = (snaphdr_t *) (skb->data + RX_MAC_HEADER_LENGTH); - struct ieee80211_hdr *pmac = (struct ieee80211_hdr *)skb->data; - __be16 type = *(__be16 *) psnap->ethertype; - int delta; - struct ethhdr *peth; - UCHAR srcaddr[ADDRLEN]; - UCHAR destaddr[ADDRLEN]; - static const UCHAR org_bridge[3] = { 0, 0, 0xf8 }; - static const UCHAR org_1042[3] = { 0, 0, 0 }; - - memcpy(destaddr, ieee80211_get_DA(pmac), ADDRLEN); - memcpy(srcaddr, ieee80211_get_SA(pmac), ADDRLEN); - -#if 0 - if { - print_hex_dump(KERN_DEBUG, "skb->data before untranslate: ", - DUMP_PREFIX_NONE, 16, 1, - skb->data, 64, true); - printk(KERN_DEBUG - "type = %08x, xsap = %02x%02x%02x, org = %02x02x02x\n", - ntohs(type), psnap->dsap, psnap->ssap, psnap->ctrl, - psnap->org[0], psnap->org[1], psnap->org[2]); - printk(KERN_DEBUG "untranslate skb->data = %p\n", skb->data); - } -#endif - - if (psnap->dsap != 0xaa || psnap->ssap != 0xaa || psnap->ctrl != 3) { - /* not a snap type so leave it alone */ - pr_debug("ray_cs untranslate NOT SNAP %02x %02x %02x\n", - psnap->dsap, psnap->ssap, psnap->ctrl); - - delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; - peth = (struct ethhdr *)(skb->data + delta); - peth->h_proto = htons(len - RX_MAC_HEADER_LENGTH); - } else { /* Its a SNAP */ - if (memcmp(psnap->org, org_bridge, 3) == 0) { - /* EtherII and nuke the LLC */ - pr_debug("ray_cs untranslate Bridge encap\n"); - delta = RX_MAC_HEADER_LENGTH - + sizeof(struct snaphdr_t) - ETH_HLEN; - peth = (struct ethhdr *)(skb->data + delta); - peth->h_proto = type; - } else if (memcmp(psnap->org, org_1042, 3) == 0) { - switch (ntohs(type)) { - case ETH_P_IPX: - case ETH_P_AARP: - pr_debug("ray_cs untranslate RFC IPX/AARP\n"); - delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; - peth = (struct ethhdr *)(skb->data + delta); - peth->h_proto = - htons(len - RX_MAC_HEADER_LENGTH); - break; - default: - pr_debug("ray_cs untranslate RFC default\n"); - delta = RX_MAC_HEADER_LENGTH + - sizeof(struct snaphdr_t) - ETH_HLEN; - peth = (struct ethhdr *)(skb->data + delta); - peth->h_proto = type; - break; - } - } else { - printk("ray_cs untranslate very confused by packet\n"); - delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; - peth = (struct ethhdr *)(skb->data + delta); - peth->h_proto = type; - } - } -/* TBD reserve skb_reserve(skb, delta); */ - skb_pull(skb, delta); - pr_debug("untranslate after skb_pull(%d), skb->data = %p\n", delta, - skb->data); - memcpy(peth->h_dest, destaddr, ADDRLEN); - memcpy(peth->h_source, srcaddr, ADDRLEN); -#if 0 - { - int i; - printk(KERN_DEBUG "skb->data after untranslate:"); - for (i = 0; i < 64; i++) - printk("%02x ", skb->data[i]); - printk("\n"); - } -#endif -} /* end untranslate */ - -/*===========================================================================*/ -/* Copy data from circular receive buffer to PC memory. - * dest = destination address in PC memory - * pkt_addr = source address in receive buffer - * len = length of packet to copy - */ -static int copy_from_rx_buff(ray_dev_t *local, UCHAR *dest, int pkt_addr, - int length) -{ - int wrap_bytes = (pkt_addr + length) - (RX_BUFF_END + 1); - if (wrap_bytes <= 0) { - memcpy_fromio(dest, local->rmem + pkt_addr, length); - } else { /* Packet wrapped in circular buffer */ - - memcpy_fromio(dest, local->rmem + pkt_addr, - length - wrap_bytes); - memcpy_fromio(dest + length - wrap_bytes, local->rmem, - wrap_bytes); - } - return length; -} - -/*===========================================================================*/ -static void release_frag_chain(ray_dev_t *local, struct rcs __iomem *prcs) -{ - struct rcs __iomem *prcslink = prcs; - int tmp = 17; - unsigned rcsindex = readb(&prcs->var.rx_packet.next_frag_rcs_index); - - while (tmp--) { - writeb(CCS_BUFFER_FREE, &prcslink->buffer_status); - if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) { - pr_debug("ray_cs interrupt bad rcsindex = 0x%x\n", - rcsindex); - break; - } - prcslink = rcs_base(local) + rcsindex; - rcsindex = readb(&prcslink->var.rx_packet.next_frag_rcs_index); - } - writeb(CCS_BUFFER_FREE, &prcslink->buffer_status); -} - -/*===========================================================================*/ -static void authenticate(ray_dev_t *local) -{ - struct pcmcia_device *link = local->finder; - dev_dbg(&link->dev, "ray_cs Starting authentication.\n"); - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_cs authenticate - device not present\n"); - return; - } - - del_timer(&local->timer); - if (build_auth_frame(local, local->bss_id, OPEN_AUTH_REQUEST)) { - local->timer.function = join_net; - } else { - local->timer.function = authenticate_timeout; - } - local->timer.expires = jiffies + HZ * 2; - local->timer.data = (long)local; - add_timer(&local->timer); - local->authentication_state = AWAITING_RESPONSE; -} /* end authenticate */ - -/*===========================================================================*/ -static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs, - unsigned int pkt_addr, int rx_len) -{ - UCHAR buff[256]; - struct ray_rx_msg *msg = (struct ray_rx_msg *) buff; - - del_timer(&local->timer); - - copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff); - /* if we are trying to get authenticated */ - if (local->sparm.b4.a_network_type == ADHOC) { - pr_debug("ray_cs rx_auth var= %02x %02x %02x %02x %02x %02x\n", - msg->var[0], msg->var[1], msg->var[2], msg->var[3], - msg->var[4], msg->var[5]); - if (msg->var[2] == 1) { - pr_debug("ray_cs Sending authentication response.\n"); - if (!build_auth_frame - (local, msg->mac.addr_2, OPEN_AUTH_RESPONSE)) { - local->authentication_state = NEED_TO_AUTH; - memcpy(local->auth_id, msg->mac.addr_2, - ADDRLEN); - } - } - } else { /* Infrastructure network */ - - if (local->authentication_state == AWAITING_RESPONSE) { - /* Verify authentication sequence #2 and success */ - if (msg->var[2] == 2) { - if ((msg->var[3] | msg->var[4]) == 0) { - pr_debug("Authentication successful\n"); - local->card_status = CARD_AUTH_COMPLETE; - associate(local); - local->authentication_state = - AUTHENTICATED; - } else { - pr_debug("Authentication refused\n"); - local->card_status = CARD_AUTH_REFUSED; - join_net((u_long) local); - local->authentication_state = - UNAUTHENTICATED; - } - } - } - } - -} /* end rx_authenticate */ - -/*===========================================================================*/ -static void associate(ray_dev_t *local) -{ - struct ccs __iomem *pccs; - struct pcmcia_device *link = local->finder; - struct net_device *dev = link->priv; - int ccsindex; - if (!(pcmcia_dev_present(link))) { - dev_dbg(&link->dev, "ray_cs associate - device not present\n"); - return; - } - /* If no tx buffers available, return */ - if ((ccsindex = get_free_ccs(local)) < 0) { -/* TBD should never be here but... what if we are? */ - dev_dbg(&link->dev, "ray_cs associate - No free ccs\n"); - return; - } - dev_dbg(&link->dev, "ray_cs Starting association with access point\n"); - pccs = ccs_base(local) + ccsindex; - /* fill in the CCS */ - writeb(CCS_START_ASSOCIATION, &pccs->cmd); - /* Interrupt the firmware to process the command */ - if (interrupt_ecf(local, ccsindex)) { - dev_dbg(&link->dev, "ray_cs associate failed - ECF not ready for intr\n"); - writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); - - del_timer(&local->timer); - local->timer.expires = jiffies + HZ * 2; - local->timer.data = (long)local; - local->timer.function = join_net; - add_timer(&local->timer); - local->card_status = CARD_ASSOC_FAILED; - return; - } - if (!sniffer) - netif_start_queue(dev); - -} /* end associate */ - -/*===========================================================================*/ -static void rx_deauthenticate(ray_dev_t *local, struct rcs __iomem *prcs, - unsigned int pkt_addr, int rx_len) -{ -/* UCHAR buff[256]; - struct ray_rx_msg *msg = (struct ray_rx_msg *) buff; -*/ - pr_debug("Deauthentication frame received\n"); - local->authentication_state = UNAUTHENTICATED; - /* Need to reauthenticate or rejoin depending on reason code */ -/* copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff); - */ -} - -/*===========================================================================*/ -static void clear_interrupt(ray_dev_t *local) -{ - writeb(0, local->amem + CIS_OFFSET + HCS_INTR_OFFSET); -} - -/*===========================================================================*/ -#ifdef CONFIG_PROC_FS -#define MAXDATA (PAGE_SIZE - 80) - -static const char *card_status[] = { - "Card inserted - uninitialized", /* 0 */ - "Card not downloaded", /* 1 */ - "Waiting for download parameters", /* 2 */ - "Card doing acquisition", /* 3 */ - "Acquisition complete", /* 4 */ - "Authentication complete", /* 5 */ - "Association complete", /* 6 */ - "???", "???", "???", "???", /* 7 8 9 10 undefined */ - "Card init error", /* 11 */ - "Download parameters error", /* 12 */ - "???", /* 13 */ - "Acquisition failed", /* 14 */ - "Authentication refused", /* 15 */ - "Association failed" /* 16 */ -}; - -static const char *nettype[] = { "Adhoc", "Infra " }; -static const char *framing[] = { "Encapsulation", "Translation" } - -; -/*===========================================================================*/ -static int ray_cs_proc_show(struct seq_file *m, void *v) -{ -/* Print current values which are not available via other means - * eg ifconfig - */ - int i; - struct pcmcia_device *link; - struct net_device *dev; - ray_dev_t *local; - UCHAR *p; - struct freq_hop_element *pfh; - UCHAR c[33]; - - link = this_device; - if (!link) - return 0; - dev = (struct net_device *)link->priv; - if (!dev) - return 0; - local = netdev_priv(dev); - if (!local) - return 0; - - seq_puts(m, "Raylink Wireless LAN driver status\n"); - seq_printf(m, "%s\n", rcsid); - /* build 4 does not report version, and field is 0x55 after memtest */ - seq_puts(m, "Firmware version = "); - if (local->fw_ver == 0x55) - seq_puts(m, "4 - Use dump_cis for more details\n"); - else - seq_printf(m, "%2d.%02d.%02d\n", - local->fw_ver, local->fw_bld, local->fw_var); - - for (i = 0; i < 32; i++) - c[i] = local->sparm.b5.a_current_ess_id[i]; - c[32] = 0; - seq_printf(m, "%s network ESSID = \"%s\"\n", - nettype[local->sparm.b5.a_network_type], c); - - p = local->bss_id; - seq_printf(m, "BSSID = %pM\n", p); - - seq_printf(m, "Country code = %d\n", - local->sparm.b5.a_curr_country_code); - - i = local->card_status; - if (i < 0) - i = 10; - if (i > 16) - i = 10; - seq_printf(m, "Card status = %s\n", card_status[i]); - - seq_printf(m, "Framing mode = %s\n", framing[translate]); - - seq_printf(m, "Last pkt signal lvl = %d\n", local->last_rsl); - - if (local->beacon_rxed) { - /* Pull some fields out of last beacon received */ - seq_printf(m, "Beacon Interval = %d Kus\n", - local->last_bcn.beacon_intvl[0] - + 256 * local->last_bcn.beacon_intvl[1]); - - p = local->last_bcn.elements; - if (p[0] == C_ESSID_ELEMENT_ID) - p += p[1] + 2; - else { - seq_printf(m, - "Parse beacon failed at essid element id = %d\n", - p[0]); - return 0; - } - - if (p[0] == C_SUPPORTED_RATES_ELEMENT_ID) { - seq_puts(m, "Supported rate codes = "); - for (i = 2; i < p[1] + 2; i++) - seq_printf(m, "0x%02x ", p[i]); - seq_putc(m, '\n'); - p += p[1] + 2; - } else { - seq_puts(m, "Parse beacon failed at rates element\n"); - return 0; - } - - if (p[0] == C_FH_PARAM_SET_ELEMENT_ID) { - pfh = (struct freq_hop_element *)p; - seq_printf(m, "Hop dwell = %d Kus\n", - pfh->dwell_time[0] + - 256 * pfh->dwell_time[1]); - seq_printf(m, "Hop set = %d\n", - pfh->hop_set); - seq_printf(m, "Hop pattern = %d\n", - pfh->hop_pattern); - seq_printf(m, "Hop index = %d\n", - pfh->hop_index); - p += p[1] + 2; - } else { - seq_puts(m, - "Parse beacon failed at FH param element\n"); - return 0; - } - } else { - seq_puts(m, "No beacons received\n"); - } - return 0; -} - -static int ray_cs_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, ray_cs_proc_show, NULL); -} - -static const struct file_operations ray_cs_proc_fops = { - .owner = THIS_MODULE, - .open = ray_cs_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; -#endif -/*===========================================================================*/ -static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type) -{ - int addr; - struct ccs __iomem *pccs; - struct tx_msg __iomem *ptx; - int ccsindex; - - /* If no tx buffers available, return */ - if ((ccsindex = get_free_tx_ccs(local)) < 0) { - pr_debug("ray_cs send authenticate - No free tx ccs\n"); - return -1; - } - - pccs = ccs_base(local) + ccsindex; - - /* Address in card space */ - addr = TX_BUF_BASE + (ccsindex << 11); - /* fill in the CCS */ - writeb(CCS_TX_REQUEST, &pccs->cmd); - writeb(addr >> 8, pccs->var.tx_request.tx_data_ptr); - writeb(0x20, pccs->var.tx_request.tx_data_ptr + 1); - writeb(TX_AUTHENTICATE_LENGTH_MSB, pccs->var.tx_request.tx_data_length); - writeb(TX_AUTHENTICATE_LENGTH_LSB, - pccs->var.tx_request.tx_data_length + 1); - writeb(0, &pccs->var.tx_request.pow_sav_mode); - - ptx = local->sram + addr; - /* fill in the mac header */ - writeb(PROTOCOL_VER | AUTHENTIC_TYPE, &ptx->mac.frame_ctl_1); - writeb(0, &ptx->mac.frame_ctl_2); - - memcpy_toio(ptx->mac.addr_1, dest, ADDRLEN); - memcpy_toio(ptx->mac.addr_2, local->sparm.b4.a_mac_addr, ADDRLEN); - memcpy_toio(ptx->mac.addr_3, local->bss_id, ADDRLEN); - - /* Fill in msg body with protocol 00 00, sequence 01 00 ,status 00 00 */ - memset_io(ptx->var, 0, 6); - writeb(auth_type & 0xff, ptx->var + 2); - - /* Interrupt the firmware to process the command */ - if (interrupt_ecf(local, ccsindex)) { - pr_debug( - "ray_cs send authentication request failed - ECF not ready for intr\n"); - writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); - return -1; - } - return 0; -} /* End build_auth_frame */ - -/*===========================================================================*/ -#ifdef CONFIG_PROC_FS -static ssize_t ray_cs_essid_proc_write(struct file *file, - const char __user *buffer, size_t count, loff_t *pos) -{ - static char proc_essid[33]; - unsigned int len = count; - - if (len > 32) - len = 32; - memset(proc_essid, 0, 33); - if (copy_from_user(proc_essid, buffer, len)) - return -EFAULT; - essid = proc_essid; - return count; -} - -static const struct file_operations ray_cs_essid_proc_fops = { - .owner = THIS_MODULE, - .write = ray_cs_essid_proc_write, - .llseek = noop_llseek, -}; - -static ssize_t int_proc_write(struct file *file, const char __user *buffer, - size_t count, loff_t *pos) -{ - static char proc_number[10]; - char *p; - int nr, len; - - if (!count) - return 0; - - if (count > 9) - return -EINVAL; - if (copy_from_user(proc_number, buffer, count)) - return -EFAULT; - p = proc_number; - nr = 0; - len = count; - do { - unsigned int c = *p - '0'; - if (c > 9) - return -EINVAL; - nr = nr * 10 + c; - p++; - } while (--len); - *(int *)PDE_DATA(file_inode(file)) = nr; - return count; -} - -static const struct file_operations int_proc_fops = { - .owner = THIS_MODULE, - .write = int_proc_write, - .llseek = noop_llseek, -}; -#endif - -static const struct pcmcia_device_id ray_ids[] = { - PCMCIA_DEVICE_MANF_CARD(0x01a6, 0x0000), - PCMCIA_DEVICE_NULL, -}; - -MODULE_DEVICE_TABLE(pcmcia, ray_ids); - -static struct pcmcia_driver ray_driver = { - .owner = THIS_MODULE, - .name = "ray_cs", - .probe = ray_probe, - .remove = ray_detach, - .id_table = ray_ids, - .suspend = ray_suspend, - .resume = ray_resume, -}; - -static int __init init_ray_cs(void) -{ - int rc; - - pr_debug("%s\n", rcsid); - rc = pcmcia_register_driver(&ray_driver); - pr_debug("raylink init_module register_pcmcia_driver returns 0x%x\n", - rc); - -#ifdef CONFIG_PROC_FS - proc_mkdir("driver/ray_cs", NULL); - - proc_create("driver/ray_cs/ray_cs", 0, NULL, &ray_cs_proc_fops); - proc_create("driver/ray_cs/essid", S_IWUSR, NULL, &ray_cs_essid_proc_fops); - proc_create_data("driver/ray_cs/net_type", S_IWUSR, NULL, &int_proc_fops, &net_type); - proc_create_data("driver/ray_cs/translate", S_IWUSR, NULL, &int_proc_fops, &translate); -#endif - if (translate != 0) - translate = 1; - return 0; -} /* init_ray_cs */ - -/*===========================================================================*/ - -static void __exit exit_ray_cs(void) -{ - pr_debug("ray_cs: cleanup_module\n"); - -#ifdef CONFIG_PROC_FS - remove_proc_entry("driver/ray_cs/ray_cs", NULL); - remove_proc_entry("driver/ray_cs/essid", NULL); - remove_proc_entry("driver/ray_cs/net_type", NULL); - remove_proc_entry("driver/ray_cs/translate", NULL); - remove_proc_entry("driver/ray_cs", NULL); -#endif - - pcmcia_unregister_driver(&ray_driver); -} /* exit_ray_cs */ - -module_init(init_ray_cs); -module_exit(exit_ray_cs); - -/*===========================================================================*/ diff --git a/drivers/net/wireless/ray_cs.h b/drivers/net/wireless/ray_cs.h deleted file mode 100644 index e79848fbcca1..000000000000 --- a/drivers/net/wireless/ray_cs.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Raytheon wireless LAN PCMCIA card driver for Linux - A PCMCIA client driver for the Raylink wireless network card - Written by Corey Thomas -*/ - -#ifndef RAYLINK_H - -struct beacon_rx { - struct mac_header mac; - UCHAR timestamp[8]; - UCHAR beacon_intvl[2]; - UCHAR capability[2]; - UCHAR elements[sizeof(struct essid_element) - + sizeof(struct rates_element) - + sizeof(struct freq_hop_element) - + sizeof(struct japan_call_sign_element) - + sizeof(struct tim_element)]; -}; - -/* Return values for get_free{,_tx}_ccs */ -#define ECCSFULL (-1) -#define ECCSBUSY (-2) -#define ECARDGONE (-3) - -typedef struct ray_dev_t { - int card_status; - int authentication_state; - void __iomem *sram; /* pointer to beginning of shared RAM */ - void __iomem *amem; /* pointer to attribute mem window */ - void __iomem *rmem; /* pointer to receive buffer window */ - struct pcmcia_device *finder; /* pointer back to struct pcmcia_device for card */ - struct timer_list timer; - unsigned long tx_ccs_lock; - unsigned long ccs_lock; - int dl_param_ccs; - union { - struct b4_startup_params b4; - struct b5_startup_params b5; - } sparm; - int timeout_flag; - UCHAR supported_rates[8]; - UCHAR japan_call_sign[12]; - struct startup_res_6 startup_res; - int num_multi; - /* Network parameters from start/join */ - UCHAR bss_id[6]; - UCHAR auth_id[6]; - UCHAR net_default_tx_rate; - UCHAR encryption; - struct net_device_stats stats; - - UCHAR net_type; - UCHAR sta_type; - UCHAR fw_ver; - UCHAR fw_bld; - UCHAR fw_var; - UCHAR ASIC_version; - UCHAR assoc_id[2]; - UCHAR tib_length; - UCHAR last_rsl; - int beacon_rxed; - struct beacon_rx last_bcn; - iw_stats wstats; /* Wireless specific stats */ -#ifdef WIRELESS_SPY - struct iw_spy_data spy_data; - struct iw_public_data wireless_data; -#endif /* WIRELESS_SPY */ - -} ray_dev_t; -/*****************************************************************************/ - -#endif /* RAYLINK_H */ diff --git a/drivers/net/wireless/rayctl.h b/drivers/net/wireless/rayctl.h deleted file mode 100644 index 3c3b98b152c3..000000000000 --- a/drivers/net/wireless/rayctl.h +++ /dev/null @@ -1,732 +0,0 @@ -#ifndef RAYLINK_H - -typedef unsigned char UCHAR; - -/****** IEEE 802.11 constants ************************************************/ -#define ADDRLEN 6 -/* Frame control 1 bit fields */ -#define PROTOCOL_VER 0x00 -#define DATA_TYPE 0x08 -#define ASSOC_REQ_TYPE 0x00 -#define ASSOC_RESP_TYPE 0x10 -#define REASSOC_REQ_TYPE 0x20 -#define REASSOC_RESP_TYPE 0x30 -#define NULL_MSG_TYPE 0x48 -#define BEACON_TYPE 0x80 -#define DISASSOC_TYPE 0xA0 -#define PSPOLL_TYPE 0xA4 -#define AUTHENTIC_TYPE 0xB0 -#define DEAUTHENTIC_TYPE 0xC0 -/* Frame control 2 bit fields */ -#define FC2_TO_DS 0x01 -#define FC2_FROM_DS 0x02 -#define FC2_MORE_FRAG 0x04 -#define FC2_RETRY 0x08 -#define FC2_PSM 0x10 -#define FC2_MORE_DATA 0x20 -#define FC2_WEP 0x40 -#define FC2_ORDER 0x80 -/*****************************************************************************/ -/* 802.11 element ID's and lengths */ -#define C_BP_CAPABILITY_ESS 0x01 -#define C_BP_CAPABILITY_IBSS 0x02 -#define C_BP_CAPABILITY_CF_POLLABLE 0x04 -#define C_BP_CAPABILITY_CF_POLL_REQUEST 0x08 -#define C_BP_CAPABILITY_PRIVACY 0x10 - -#define C_ESSID_ELEMENT_ID 0 -#define C_ESSID_ELEMENT_MAX_LENGTH 32 - -#define C_SUPPORTED_RATES_ELEMENT_ID 1 -#define C_SUPPORTED_RATES_ELEMENT_LENGTH 2 - -#define C_FH_PARAM_SET_ELEMENT_ID 2 -#define C_FH_PARAM_SET_ELEMENT_LNGTH 5 - -#define C_CF_PARAM_SET_ELEMENT_ID 4 -#define C_CF_PARAM_SET_ELEMENT_LNGTH 6 - -#define C_TIM_ELEMENT_ID 5 -#define C_TIM_BITMAP_LENGTH 251 -#define C_TIM_BMCAST_BIT 0x01 - -#define C_IBSS_ELEMENT_ID 6 -#define C_IBSS_ELEMENT_LENGTH 2 - -#define C_JAPAN_CALL_SIGN_ELEMENT_ID 51 -#define C_JAPAN_CALL_SIGN_ELEMENT_LNGTH 12 - -#define C_DISASSOC_REASON_CODE_LEN 2 -#define C_DISASSOC_REASON_CODE_DEFAULT 8 - -#define C_CRC_LEN 4 -#define C_NUM_SUPPORTED_RATES 8 -/****** IEEE 802.11 mac header for type data packets *************************/ -struct mac_header { - UCHAR frame_ctl_1; - UCHAR frame_ctl_2; - UCHAR duration_lsb; - UCHAR duration_msb; - UCHAR addr_1[ADDRLEN]; - UCHAR addr_2[ADDRLEN]; - UCHAR addr_3[ADDRLEN]; - UCHAR seq_frag_num[2]; -/* UCHAR addr_4[ADDRLEN]; *//* only present for AP to AP (TO DS and FROM DS */ -}; -/****** IEEE 802.11 frame element structures *********************************/ -struct essid_element -{ - UCHAR id; - UCHAR length; - UCHAR text[C_ESSID_ELEMENT_MAX_LENGTH]; -}; -struct rates_element -{ - UCHAR id; - UCHAR length; - UCHAR value[8]; -}; -struct freq_hop_element -{ - UCHAR id; - UCHAR length; - UCHAR dwell_time[2]; - UCHAR hop_set; - UCHAR hop_pattern; - UCHAR hop_index; -}; -struct tim_element -{ - UCHAR id; - UCHAR length; - UCHAR dtim_count; - UCHAR dtim_period; - UCHAR bitmap_control; - UCHAR tim[C_TIM_BITMAP_LENGTH]; -}; -struct ibss_element -{ - UCHAR id; - UCHAR length; - UCHAR atim_window[2]; -}; -struct japan_call_sign_element -{ - UCHAR id; - UCHAR length; - UCHAR call_sign[12]; -}; -/****** Beacon message structures ********************************************/ -/* .elements is a large lump of max size because elements are variable size */ -struct infra_beacon -{ - UCHAR timestamp[8]; - UCHAR beacon_intvl[2]; - UCHAR capability[2]; - UCHAR elements[sizeof(struct essid_element) - + sizeof(struct rates_element) - + sizeof(struct freq_hop_element) - + sizeof(struct japan_call_sign_element) - + sizeof(struct tim_element)]; -}; -struct adhoc_beacon -{ - UCHAR timestamp[8]; - UCHAR beacon_intvl[2]; - UCHAR capability[2]; - UCHAR elements[sizeof(struct essid_element) - + sizeof(struct rates_element) - + sizeof(struct freq_hop_element) - + sizeof(struct japan_call_sign_element) - + sizeof(struct ibss_element)]; -}; -/*****************************************************************************/ -/*****************************************************************************/ -/* #define C_MAC_HDR_2_WEP 0x40 */ -/* TX/RX CCS constants */ -#define TX_HEADER_LENGTH 0x1C -#define RX_MAC_HEADER_LENGTH 0x18 -#define TX_AUTHENTICATE_LENGTH (TX_HEADER_LENGTH + 6) -#define TX_AUTHENTICATE_LENGTH_MSB (TX_AUTHENTICATE_LENGTH >> 8) -#define TX_AUTHENTICATE_LENGTH_LSB (TX_AUTHENTICATE_LENGTH & 0xff) -#define TX_DEAUTHENTICATE_LENGTH (TX_HEADER_LENGTH + 2) -#define TX_DEAUTHENTICATE_LENGTH_MSB (TX_AUTHENTICATE_LENGTH >> 8) -#define TX_DEAUTHENTICATE_LENGTH_LSB (TX_AUTHENTICATE_LENGTH & 0xff) -#define FCS_LEN 4 - -#define ADHOC 0 -#define INFRA 1 - -#define TYPE_STA 0 -#define TYPE_AP 1 - -#define PASSIVE_SCAN 1 -#define ACTIVE_SCAN 1 - -#define PSM_CAM 0 - -/* Country codes */ -#define USA 1 -#define EUROPE 2 -#define JAPAN 3 -#define KOREA 4 -#define SPAIN 5 -#define FRANCE 6 -#define ISRAEL 7 -#define AUSTRALIA 8 -#define JAPAN_TEST 9 - -/* Hop pattern lengths */ -#define USA_HOP_MOD 79 -#define EUROPE_HOP_MOD 79 -#define JAPAN_HOP_MOD 23 -#define KOREA_HOP_MOD 23 -#define SPAIN_HOP_MOD 27 -#define FRANCE_HOP_MOD 35 -#define ISRAEL_HOP_MOD 35 -#define AUSTRALIA_HOP_MOD 47 -#define JAPAN_TEST_HOP_MOD 23 - -#define ESSID_SIZE 32 -/**********************************************************************/ -/* CIS Register Constants */ -#define CIS_OFFSET 0x0f00 -/* Configuration Option Register (0x0F00) */ -#define COR_OFFSET 0x00 -#define COR_SOFT_RESET 0x80 -#define COR_LEVEL_IRQ 0x40 -#define COR_CONFIG_NUM 0x01 -#define COR_DEFAULT (COR_LEVEL_IRQ | COR_CONFIG_NUM) - -/* Card Configuration and Status Register (0x0F01) */ -#define CCSR_OFFSET 0x01 -#define CCSR_HOST_INTR_PENDING 0x01 -#define CCSR_POWER_DOWN 0x04 - -/* HCS Interrupt Register (0x0F05) */ -#define HCS_INTR_OFFSET 0x05 -/* #define HCS_INTR_OFFSET 0x0A */ -#define HCS_INTR_CLEAR 0x00 - -/* ECF Interrupt Register (0x0F06) */ -#define ECF_INTR_OFFSET 0x06 -/* #define ECF_INTR_OFFSET 0x0C */ -#define ECF_INTR_SET 0x01 - -/* Authorization Register 0 (0x0F08) */ -#define AUTH_0_ON 0x57 - -/* Authorization Register 1 (0x0F09) */ -#define AUTH_1_ON 0x82 - -/* Program Mode Register (0x0F0A) */ -#define PC2PM 0x02 -#define PC2CAL 0x10 -#define PC2MLSE 0x20 - -/* PC Test Mode Register (0x0F0B) */ -#define PC_TEST_MODE 0x08 - -/* Frequency Control Word (0x0F10) */ -/* Range 0x02 - 0xA6 */ - -/* Test Mode Control 1-4 (0x0F14 - 0x0F17) */ - -/**********************************************************************/ - -/* Shared RAM Area */ -#define SCB_BASE 0x0000 -#define STATUS_BASE 0x0100 -#define HOST_TO_ECF_BASE 0x0200 -#define ECF_TO_HOST_BASE 0x0300 -#define CCS_BASE 0x0400 -#define RCS_BASE 0x0800 -#define INFRA_TIM_BASE 0x0C00 -#define SSID_LIST_BASE 0x0D00 -#define TX_BUF_BASE 0x1000 -#define RX_BUF_BASE 0x8000 - -#define NUMBER_OF_CCS 64 -#define NUMBER_OF_RCS 64 -/*#define NUMBER_OF_TX_CCS 14 */ -#define NUMBER_OF_TX_CCS 14 - -#define TX_BUF_SIZE (2048 - sizeof(struct tx_msg)) -#define RX_BUFF_END 0x3FFF -/* Values for buffer_status */ -#define CCS_BUFFER_FREE 0 -#define CCS_BUFFER_BUSY 1 -#define CCS_COMMAND_COMPLETE 2 -#define CCS_COMMAND_FAILED 3 - -/* Values for cmd */ -#define CCS_DOWNLOAD_STARTUP_PARAMS 1 -#define CCS_UPDATE_PARAMS 2 -#define CCS_REPORT_PARAMS 3 -#define CCS_UPDATE_MULTICAST_LIST 4 -#define CCS_UPDATE_POWER_SAVINGS_MODE 5 -#define CCS_START_NETWORK 6 -#define CCS_JOIN_NETWORK 7 -#define CCS_START_ASSOCIATION 8 -#define CCS_TX_REQUEST 9 -#define CCS_TEST_MEMORY 0xa -#define CCS_SHUTDOWN 0xb -#define CCS_DUMP_MEMORY 0xc -#define CCS_START_TIMER 0xe -#define CCS_LAST_CMD CCS_START_TIMER - -/* Values for link field */ -#define CCS_END_LIST 0xff - -/* values for buffer_status field */ -#define RCS_BUFFER_FREE 0 -#define RCS_BUFFER_BUSY 1 -#define RCS_COMPLETE 2 -#define RCS_FAILED 3 -#define RCS_BUFFER_RELEASE 0xFF - -/* values for interrupt_id field */ -#define PROCESS_RX_PACKET 0x80 /* */ -#define REJOIN_NET_COMPLETE 0x81 /* RCS ID: Rejoin Net Complete */ -#define ROAMING_INITIATED 0x82 /* RCS ID: Roaming Initiated */ -#define JAPAN_CALL_SIGN_RXD 0x83 /* RCS ID: New Japan Call Sign */ - -/*****************************************************************************/ -/* Memory types for dump memory command */ -#define C_MEM_PROG 0 -#define C_MEM_XDATA 1 -#define C_MEM_SFR 2 -#define C_MEM_IDATA 3 - -/*** Return values for hw_xmit **********/ -#define XMIT_OK (0) -#define XMIT_MSG_BAD (-1) -#define XMIT_NO_CCS (-2) -#define XMIT_NO_INTR (-3) -#define XMIT_NEED_AUTH (-4) - -/*** Values for card status */ -#define CARD_INSERTED (0) - -#define CARD_AWAITING_PARAM (1) -#define CARD_INIT_ERROR (11) - -#define CARD_DL_PARAM (2) -#define CARD_DL_PARAM_ERROR (12) - -#define CARD_DOING_ACQ (3) - -#define CARD_ACQ_COMPLETE (4) -#define CARD_ACQ_FAILED (14) - -#define CARD_AUTH_COMPLETE (5) -#define CARD_AUTH_REFUSED (15) - -#define CARD_ASSOC_COMPLETE (6) -#define CARD_ASSOC_FAILED (16) - -/*** Values for authentication_state ***********************************/ -#define UNAUTHENTICATED (0) -#define AWAITING_RESPONSE (1) -#define AUTHENTICATED (2) -#define NEED_TO_AUTH (3) - -/*** Values for authentication type ************************************/ -#define OPEN_AUTH_REQUEST (1) -#define OPEN_AUTH_RESPONSE (2) -#define BROADCAST_DEAUTH (0xc0) -/*** Values for timer functions ****************************************/ -#define TODO_NOTHING (0) -#define TODO_VERIFY_DL_START (-1) -#define TODO_START_NET (-2) -#define TODO_JOIN_NET (-3) -#define TODO_AUTHENTICATE_TIMEOUT (-4) -#define TODO_SEND_CCS (-5) -/***********************************************************************/ -/* Parameter passing structure for update/report parameter CCS's */ -struct object_id { - void *object_addr; - unsigned char object_length; -}; - -#define OBJID_network_type 0 -#define OBJID_acting_as_ap_status 1 -#define OBJID_current_ess_id 2 -#define OBJID_scanning_mode 3 -#define OBJID_power_mgt_state 4 -#define OBJID_mac_address 5 -#define OBJID_frag_threshold 6 -#define OBJID_hop_time 7 -#define OBJID_beacon_period 8 -#define OBJID_dtim_period 9 -#define OBJID_retry_max 10 -#define OBJID_ack_timeout 11 -#define OBJID_sifs 12 -#define OBJID_difs 13 -#define OBJID_pifs 14 -#define OBJID_rts_threshold 15 -#define OBJID_scan_dwell_time 16 -#define OBJID_max_scan_dwell_time 17 -#define OBJID_assoc_resp_timeout 18 -#define OBJID_adhoc_scan_cycle_max 19 -#define OBJID_infra_scan_cycle_max 20 -#define OBJID_infra_super_cycle_max 21 -#define OBJID_promiscuous_mode 22 -#define OBJID_unique_word 23 -#define OBJID_slot_time 24 -#define OBJID_roaming_low_snr 25 -#define OBJID_low_snr_count_thresh 26 -#define OBJID_infra_missed_bcn 27 -#define OBJID_adhoc_missed_bcn 28 -#define OBJID_curr_country_code 29 -#define OBJID_hop_pattern 30 -#define OBJID_reserved 31 -#define OBJID_cw_max_msb 32 -#define OBJID_cw_min_msb 33 -#define OBJID_noise_filter_gain 34 -#define OBJID_noise_limit_offset 35 -#define OBJID_det_rssi_thresh_offset 36 -#define OBJID_med_busy_thresh_offset 37 -#define OBJID_det_sync_thresh 38 -#define OBJID_test_mode 39 -#define OBJID_test_min_chan_num 40 -#define OBJID_test_max_chan_num 41 -#define OBJID_allow_bcast_ID_prbrsp 42 -#define OBJID_privacy_must_start 43 -#define OBJID_privacy_can_join 44 -#define OBJID_basic_rate_set 45 - -/**** Configuration/Status/Control Area ***************************/ -/* System Control Block (SCB) Area - * Located at Shared RAM offset 0 - */ -struct scb { - UCHAR ccs_index; - UCHAR rcs_index; -}; - -/****** Status area at Shared RAM offset 0x0100 ******************************/ -struct status { - UCHAR mrx_overflow_for_host; /* 0=ECF may write, 1=host may write*/ - UCHAR mrx_checksum_error_for_host; /* 0=ECF may write, 1=host may write*/ - UCHAR rx_hec_error_for_host; /* 0=ECF may write, 1=host may write*/ - UCHAR reserved1; - short mrx_overflow; /* ECF increments on rx overflow */ - short mrx_checksum_error; /* ECF increments on rx CRC error */ - short rx_hec_error; /* ECF incs on mac header CRC error */ - UCHAR rxnoise; /* Average RSL measurement */ -}; - -/****** Host-to-ECF Data Area at Shared RAM offset 0x200 *********************/ -struct host_to_ecf_area { - -}; - -/****** ECF-to-Host Data Area at Shared RAM offset 0x0300 ********************/ -struct startup_res_518 { - UCHAR startup_word; - UCHAR station_addr[ADDRLEN]; - UCHAR calc_prog_chksum; - UCHAR calc_cis_chksum; - UCHAR ecf_spare[7]; - UCHAR japan_call_sign[12]; -}; - -struct startup_res_6 { - UCHAR startup_word; - UCHAR station_addr[ADDRLEN]; - UCHAR reserved; - UCHAR supp_rates[8]; - UCHAR japan_call_sign[12]; - UCHAR calc_prog_chksum; - UCHAR calc_cis_chksum; - UCHAR firmware_version[3]; - UCHAR asic_version; - UCHAR tib_length; -}; - -struct start_join_net_params { - UCHAR net_type; - UCHAR ssid[ESSID_SIZE]; - UCHAR reserved; - UCHAR privacy_can_join; -}; - -/****** Command Control Structure area at Shared ram offset 0x0400 ***********/ -/* Structures for command specific parameters (ccs.var) */ -struct update_param_cmd { - UCHAR object_id; - UCHAR number_objects; - UCHAR failure_cause; -}; -struct report_param_cmd { - UCHAR object_id; - UCHAR number_objects; - UCHAR failure_cause; - UCHAR length; -}; -struct start_network_cmd { - UCHAR update_param; - UCHAR bssid[ADDRLEN]; - UCHAR net_initiated; - UCHAR net_default_tx_rate; - UCHAR encryption; -}; -struct join_network_cmd { - UCHAR update_param; - UCHAR bssid[ADDRLEN]; - UCHAR net_initiated; - UCHAR net_default_tx_rate; - UCHAR encryption; -}; -struct tx_requested_cmd { - - UCHAR tx_data_ptr[2]; - UCHAR tx_data_length[2]; - UCHAR host_reserved[2]; - UCHAR reserved[3]; - UCHAR tx_rate; - UCHAR pow_sav_mode; - UCHAR retries; - UCHAR antenna; -}; -struct tx_requested_cmd_4 { - - UCHAR tx_data_ptr[2]; - UCHAR tx_data_length[2]; - UCHAR dest_addr[ADDRLEN]; - UCHAR pow_sav_mode; - UCHAR retries; - UCHAR station_id; -}; -struct memory_dump_cmd { - UCHAR memory_type; - UCHAR memory_ptr[2]; - UCHAR length; -}; -struct update_association_cmd { - UCHAR status; - UCHAR aid[2]; -}; -struct start_timer_cmd { - UCHAR duration[2]; -}; - -struct ccs { - UCHAR buffer_status; /* 0 = buffer free, 1 = buffer busy */ - /* 2 = command complete, 3 = failed */ - UCHAR cmd; /* command to ECF */ - UCHAR link; /* link to next CCS, FF=end of list */ - /* command specific parameters */ - union { - char reserved[13]; - struct update_param_cmd update_param; - struct report_param_cmd report_param; - UCHAR nummulticast; - UCHAR mode; - struct start_network_cmd start_network; - struct join_network_cmd join_network; - struct tx_requested_cmd tx_request; - struct memory_dump_cmd memory_dump; - struct update_association_cmd update_assoc; - struct start_timer_cmd start_timer; - } var; -}; - -/*****************************************************************************/ -/* Transmit buffer structures */ -struct tib_structure { - UCHAR ccs_index; - UCHAR psm; - UCHAR pass_fail; - UCHAR retry_count; - UCHAR max_retries; - UCHAR frags_remaining; - UCHAR no_rb; - UCHAR rts_reqd; - UCHAR csma_tx_cntrl_2; - UCHAR sifs_tx_cntrl_2; - UCHAR tx_dma_addr_1[2]; - UCHAR tx_dma_addr_2[2]; - UCHAR var_dur_2mhz[2]; - UCHAR var_dur_1mhz[2]; - UCHAR max_dur_2mhz[2]; - UCHAR max_dur_1mhz[2]; - UCHAR hdr_len; - UCHAR max_frag_len[2]; - UCHAR var_len[2]; - UCHAR phy_hdr_4; - UCHAR mac_hdr_1; - UCHAR mac_hdr_2; - UCHAR sid[2]; -}; - -struct phy_header { - UCHAR sfd[2]; - UCHAR hdr_3; - UCHAR hdr_4; -}; -struct ray_rx_msg { - struct mac_header mac; - UCHAR var[0]; -}; - -struct tx_msg { - struct tib_structure tib; - struct phy_header phy; - struct mac_header mac; - UCHAR var[1]; -}; - -/****** ECF Receive Control Structure (RCS) Area at Shared RAM offset 0x0800 */ -/* Structures for command specific parameters (rcs.var) */ -struct rx_packet_cmd { - UCHAR rx_data_ptr[2]; - UCHAR rx_data_length[2]; - UCHAR rx_sig_lev; - UCHAR next_frag_rcs_index; - UCHAR totalpacketlength[2]; -}; -struct rejoin_net_cmplt_cmd { - UCHAR reserved; - UCHAR bssid[ADDRLEN]; -}; -struct japan_call_sign_rxd { - UCHAR rxd_call_sign[8]; - UCHAR reserved[5]; -}; - -struct rcs { - UCHAR buffer_status; - UCHAR interrupt_id; - UCHAR link_field; - /* command specific parameters */ - union { - UCHAR reserved[13]; - struct rx_packet_cmd rx_packet; - struct rejoin_net_cmplt_cmd rejoin_net_complete; - struct japan_call_sign_rxd japan_call_sign; - } var; -}; - -/****** Startup parameter structures for both versions of firmware ***********/ -struct b4_startup_params { - UCHAR a_network_type; /* C_ADHOC, C_INFRA */ - UCHAR a_acting_as_ap_status; /* C_TYPE_STA, C_TYPE_AP */ - UCHAR a_current_ess_id[ESSID_SIZE]; /* Null terminated unless 32 long */ - UCHAR a_scanning_mode; /* passive 0, active 1 */ - UCHAR a_power_mgt_state; /* CAM 0, */ - UCHAR a_mac_addr[ADDRLEN]; /* */ - UCHAR a_frag_threshold[2]; /* 512 */ - UCHAR a_hop_time[2]; /* 16k * 2**n, n=0-4 in Kus */ - UCHAR a_beacon_period[2]; /* n * a_hop_time in Kus */ - UCHAR a_dtim_period; /* in beacons */ - UCHAR a_retry_max; /* */ - UCHAR a_ack_timeout; /* */ - UCHAR a_sifs; /* */ - UCHAR a_difs; /* */ - UCHAR a_pifs; /* */ - UCHAR a_rts_threshold[2]; /* */ - UCHAR a_scan_dwell_time[2]; /* */ - UCHAR a_max_scan_dwell_time[2]; /* */ - UCHAR a_assoc_resp_timeout_thresh; /* */ - UCHAR a_adhoc_scan_cycle_max; /* */ - UCHAR a_infra_scan_cycle_max; /* */ - UCHAR a_infra_super_scan_cycle_max; /* */ - UCHAR a_promiscuous_mode; /* */ - UCHAR a_unique_word[2]; /* */ - UCHAR a_slot_time; /* */ - UCHAR a_roaming_low_snr_thresh; /* */ - UCHAR a_low_snr_count_thresh; /* */ - UCHAR a_infra_missed_bcn_thresh; /* */ - UCHAR a_adhoc_missed_bcn_thresh; /* */ - UCHAR a_curr_country_code; /* C_USA */ - UCHAR a_hop_pattern; /* */ - UCHAR a_hop_pattern_length; /* */ -/* b4 - b5 differences start here */ - UCHAR a_cw_max; /* */ - UCHAR a_cw_min; /* */ - UCHAR a_noise_filter_gain; /* */ - UCHAR a_noise_limit_offset; /* */ - UCHAR a_det_rssi_thresh_offset; /* */ - UCHAR a_med_busy_thresh_offset; /* */ - UCHAR a_det_sync_thresh; /* */ - UCHAR a_test_mode; /* */ - UCHAR a_test_min_chan_num; /* */ - UCHAR a_test_max_chan_num; /* */ - UCHAR a_rx_tx_delay; /* */ - UCHAR a_current_bss_id[ADDRLEN]; /* */ - UCHAR a_hop_set; /* */ -}; -struct b5_startup_params { - UCHAR a_network_type; /* C_ADHOC, C_INFRA */ - UCHAR a_acting_as_ap_status; /* C_TYPE_STA, C_TYPE_AP */ - UCHAR a_current_ess_id[ESSID_SIZE]; /* Null terminated unless 32 long */ - UCHAR a_scanning_mode; /* passive 0, active 1 */ - UCHAR a_power_mgt_state; /* CAM 0, */ - UCHAR a_mac_addr[ADDRLEN]; /* */ - UCHAR a_frag_threshold[2]; /* 512 */ - UCHAR a_hop_time[2]; /* 16k * 2**n, n=0-4 in Kus */ - UCHAR a_beacon_period[2]; /* n * a_hop_time in Kus */ - UCHAR a_dtim_period; /* in beacons */ - UCHAR a_retry_max; /* 4 */ - UCHAR a_ack_timeout; /* */ - UCHAR a_sifs; /* */ - UCHAR a_difs; /* */ - UCHAR a_pifs; /* */ - UCHAR a_rts_threshold[2]; /* */ - UCHAR a_scan_dwell_time[2]; /* */ - UCHAR a_max_scan_dwell_time[2]; /* */ - UCHAR a_assoc_resp_timeout_thresh; /* */ - UCHAR a_adhoc_scan_cycle_max; /* */ - UCHAR a_infra_scan_cycle_max; /* */ - UCHAR a_infra_super_scan_cycle_max; /* */ - UCHAR a_promiscuous_mode; /* */ - UCHAR a_unique_word[2]; /* */ - UCHAR a_slot_time; /* */ - UCHAR a_roaming_low_snr_thresh; /* */ - UCHAR a_low_snr_count_thresh; /* */ - UCHAR a_infra_missed_bcn_thresh; /* */ - UCHAR a_adhoc_missed_bcn_thresh; /* */ - UCHAR a_curr_country_code; /* C_USA */ - UCHAR a_hop_pattern; /* */ - UCHAR a_hop_pattern_length; /* */ -/* b4 - b5 differences start here */ - UCHAR a_cw_max[2]; /* */ - UCHAR a_cw_min[2]; /* */ - UCHAR a_noise_filter_gain; /* */ - UCHAR a_noise_limit_offset; /* */ - UCHAR a_det_rssi_thresh_offset; /* */ - UCHAR a_med_busy_thresh_offset; /* */ - UCHAR a_det_sync_thresh; /* */ - UCHAR a_test_mode; /* */ - UCHAR a_test_min_chan_num; /* */ - UCHAR a_test_max_chan_num; /* */ - UCHAR a_allow_bcast_SSID_probe_rsp; - UCHAR a_privacy_must_start; - UCHAR a_privacy_can_join; - UCHAR a_basic_rate_set[8]; -}; - -/*****************************************************************************/ -#define RAY_IOCG_PARMS (SIOCDEVPRIVATE) -#define RAY_IOCS_PARMS (SIOCDEVPRIVATE + 1) -#define RAY_DO_CMD (SIOCDEVPRIVATE + 2) - -/****** ethernet <-> 802.11 translation **************************************/ -typedef struct snaphdr_t -{ - UCHAR dsap; - UCHAR ssap; - UCHAR ctrl; - UCHAR org[3]; - UCHAR ethertype[2]; -} snaphdr_t; - -#define BRIDGE_ENCAP 0xf80000 -#define RFC1042_ENCAP 0 -#define SNAP_ID 0x0003aaaa -#define RAY_IPX_TYPE 0x8137 -#define APPLEARP_TYPE 0x80f3 -/*****************************************************************************/ -#endif /* #ifndef RAYLINK_H */ diff --git a/drivers/net/wireless/rda5990/Makefile b/drivers/net/wireless/rda5990/Makefile deleted file mode 100755 index 0b0494d04ae2..000000000000 --- a/drivers/net/wireless/rda5990/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -#obj-y += rda_gpio_i2c/ # 模拟I2C开此功能 -#obj-y += drv_fm_rda/ - -obj-y += rda_wlan/ -obj-y += rda_5990_power_ctrl/ diff --git a/drivers/net/wireless/rda5990/drv_fm_rda/Makefile b/drivers/net/wireless/rda5990/drv_fm_rda/Makefile deleted file mode 100755 index 4eaffa464f77..000000000000 --- a/drivers/net/wireless/rda5990/drv_fm_rda/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright Statement: -# -# This software/firmware and related documentation ("MediaTek Software") are -# protected under relevant copyright laws. The information contained herein -# is confidential and proprietary to MediaTek Inc. and/or its licensors. -# Without the prior written permission of MediaTek inc. and/or its licensors, -# any reproduction, modification, use or disclosure of MediaTek Software, -# and information contained herein, in whole or in part, shall be strictly prohibited. -# -# MediaTek Inc. (C) 2010. All rights reserved. -# -# BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES -# THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") -# RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON -# AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. -# NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE -# SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR -# SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH -# THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES -# THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES -# CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK -# SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR -# STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND -# CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, -# AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, -# OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO -# MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. -# -# The following software/firmware and/or related documentation ("MediaTek Software") -# have been modified by MediaTek Inc. All revisions are subject to any receiver's -# applicable license agreements with MediaTek Inc. - - -# Makefile generated by Mediatek -# rda fm support - -ifeq ($(MTK_FM_SUPPORT), yes) -ifeq ($(CUSTOM_KERNEL_FM), mt6620) - -#obj-$(CONFIG_MTK_COMBO_FM) += RDA5990_FM_drv.o -# for 模拟I2C -obj-$(CONFIG_MTK_COMBO_FM) += RDA5990_FM_drv_gpio.o - -endif -endif - - diff --git a/drivers/net/wireless/rda5990/drv_fm_rda/RDA5990_FM_drv.c b/drivers/net/wireless/rda5990/drv_fm_rda/RDA5990_FM_drv.c deleted file mode 100755 index cfd9f1b7846b..000000000000 --- a/drivers/net/wireless/rda5990/drv_fm_rda/RDA5990_FM_drv.c +++ /dev/null @@ -1,2142 +0,0 @@ -#include -#include -#include -#include // udelay() -#include // device_create() -#include -#include -#include -#include -#include /* constant of kernel version */ -#include // get_user() - -#include -#include -#include -#include -#include -#include - -// if need debug, define FMDEBUG -//#define FMDEBUG - -// if your platform is MT6515/6575, define MTK_MT6515 -#define MTK_MT6515 - -// if your platform is MT6515/6575 and MTK FM is MT6626, define MT6626 -//#define MT6626 - -#define FM_ALERT(f, s...) \ - do { \ - printk(KERN_ALERT "RDAFM " f, ## s); \ - } while(0) - -#ifdef FMDEBUG -#define FM_DEBUG(f, s...) \ - do { \ - printk("RDAFM " f, ## s); \ - } while(0) -#else -#define FM_DEBUG(f, s...) -#endif - -#define RDA599X_SCANTBL_SIZE 16 //16*uinit16_t -#define RDA599X_FM_SCAN_UP 0x0 -#define RDA599X_FM_SCAN_DOWN 0x01 - -extern int rda_fm_power_off(); -extern int rda_fm_power_on(); - -/****************************************************************************** - * CONSTANT DEFINITIONS - *****************************************************************************/ -#define RDAFM_SLAVE_ADDR (0x11 << 1) //RDA FM Chip address - -#define RDAFM_MASK_RSSI 0X7F // RSSI -#define RDAFM_DEV "RDA599x" - -//customer need customize the I2C port -#define RDAFM_I2C_PORT 0 - - -#define ID_RDA5802E 0x5804 -#define ID_RDA5802H 0x5801 -#define ID_RDA5802N 0x5808 -#define ID_RDA5820 0x5805 -#define ID_RDA5820NS 0x5820 - - -static struct proc_dir_entry *g_fm_proc = NULL; -static struct fm *g_fm_struct = NULL; -static atomic_t scan_complete_flag; - -#define FM_PROC_FILE "fm" - -/****************************************************************************** - * STRUCTURE DEFINITIONS - *****************************************************************************/ - -enum RDAFM_CHIP_TYPE { - CHIP_TYPE_RDA5802E = 0, - CHIP_TYPE_RDA5802H, - CHIP_TYPE_RDA5802N, - CHIP_TYPE_RDA5820, - CHIP_TYPE_RDA5820NS, -}; - - -typedef struct -{ - uint8_t address; - uint16_t value; -}RDA_FM_REG_T; - -typedef struct -{ - bool byPowerUp; - struct fm_tune_parm parm -}FM_TUNE_T; -static FM_TUNE_T fm_tune_data = {false, {}}; - -typedef enum -{ - FM_RECEIVER, //5800,5802,5804 - FM_TRANSMITTER, //5820 -}RDA_RADIO_WORK_E; - -typedef enum -{ - OFF, - ON, -}RDA_FM_POWER_STATE_T; - -struct fm { - uint32_t ref; - bool powerup; - uint16_t chip_id; - uint16_t device_id; - dev_t dev_t; - uint16_t min_freq; // KHz - uint16_t max_freq; // KHz - uint8_t band; // TODO - struct class *cls; - struct device *dev; - struct cdev cdev; - struct i2c_client *i2c_client; -}; - - - - -/****************************************************************************** - * FUNCTION PROTOTYPES - *****************************************************************************/ - -static int RDAFM_clear_hmute(struct i2c_client *client); -static int RDAFM_enable_hmute(struct i2c_client *client); -static int RDAFM_clear_tune(struct i2c_client *client); -static int RDAFM_enable_tune(struct i2c_client *client); -static int RDAFM_clear_seek(struct i2c_client *client); -static int RDAFM_enable_seek(struct i2c_client *client); -static int RDAFM_SetStereo(struct i2c_client *client,uint8_t b); -static int RDAFM_SetRSSI_Threshold(struct i2c_client *client,uint8_t RssiThreshold); -static int RDAFM_SetDe_Emphasis(struct i2c_client *client,uint8_t index); -static bool RDAFM_Scan(struct i2c_client *client, - uint16_t min_freq, uint16_t max_freq, - uint16_t *pFreq, //get the valid freq after scan - uint16_t *pScanTBL, - uint16_t *ScanTBLsize, - uint16_t scandir, - uint16_t space); - - -static int RDAFM_read(struct i2c_client *client, uint8_t addr, uint16_t *val); -static int RDAFM_write(struct i2c_client *client, uint8_t addr, uint16_t val); -static void RDAFM_em_test(struct i2c_client *client, uint16_t group_idx, uint16_t item_idx, uint32_t item_value); -static int fm_setup_cdev(struct fm *fm); -static int fm_ops_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); -static loff_t fm_ops_lseek(struct file *filp, loff_t off, int whence); -static int fm_ops_open(struct inode *inode, struct file *filp); -static int fm_ops_release(struct inode *inode, struct file *filp); - -static int fm_init(struct i2c_client *client); -static int fm_destroy(struct fm *fm); -static int fm_powerup(struct fm *fm, struct fm_tune_parm *parm); -static int fm_powerdown(struct fm *fm); - -static int fm_tune(struct fm *fm, struct fm_tune_parm *parm); -static int fm_seek(struct fm *fm, struct fm_seek_parm *parm); -static int fm_scan(struct fm *fm, struct fm_scan_parm *parm); -static int fm_setvol(struct fm *fm, uint32_t vol); -static int fm_getvol(struct fm *fm, uint32_t *vol); -static int fm_getrssi(struct fm *fm, uint32_t *rssi); -static int fm_proc_read(char *page, char **start, off_t off, int count, int *eof, void *data); - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) -static int fm_i2c_attach_adapter(struct i2c_adapter *adapter); -static int fm_i2c_detect(struct i2c_adapter *adapter, int addr, int kind); -static int fm_i2c_detach_client(struct i2c_client *client); -#else -static int fm_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id); -static int fm_i2c_detect(struct i2c_client *client, int kind, struct i2c_board_info *info); -static int fm_i2c_remove(struct i2c_client *client); -#endif - -/****************************************************************************** - * GLOBAL DATA - *****************************************************************************/ -/* Addresses to scan */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) -static unsigned short normal_i2c[] = {RDAFM_SLAVE_ADDR, I2C_CLIENT_END}; -static unsigned short ignore = I2C_CLIENT_END; - -static struct i2c_client_address_data RDAFM_addr_data = { - .normal_i2c = normal_i2c, - .probe = &ignore, - .ignore = &ignore, -}; -#else -static const struct i2c_device_id fm_i2c_id = {RDAFM_DEV, 0}; -static unsigned short force[] = {RDAFM_I2C_PORT, RDAFM_SLAVE_ADDR, I2C_CLIENT_END, I2C_CLIENT_END}; -static const unsigned short * const forces[] = {force, NULL}; -//static struct i2c_client_address_data addr_data = {.forces = forces}; -static struct i2c_board_info __initdata i2c_rdafm={ I2C_BOARD_INFO(RDAFM_DEV, (RDAFM_SLAVE_ADDR>>1))}; -#endif - - static struct i2c_driver RDAFM_driver = { -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) - .driver = { - .owner = THIS_MODULE, - .name = RDAFM_DEV, - }, - .attach_adapter = fm_i2c_attach_adapter, - .detach_client = fm_i2c_detach_client, -#else - .probe = fm_i2c_probe, - .remove = fm_i2c_remove, - .detect = fm_i2c_detect, - .driver.name = RDAFM_DEV, - .id_table = &fm_i2c_id, - // .address_data = &addr_data, - .address_list = (const unsigned short*) forces, -#endif - }; - -static uint16_t RDAFM_CHIP_ID = 0x5808; -static RDA_RADIO_WORK_E RDA_RADIO_WorkType = FM_RECEIVER; - - - -#if 1 -static uint16_t RDA5802N_initialization_reg[]={ - 0xC005, //02h - 0x0000, - 0x0400, - 0xC6ED, //0x86AD, //05h - 0x6000, - 0x721A, //0x42C6 - 0x0000, - 0x0000, - 0x0000, //0x0ah - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, //0x10h - 0x0019, - 0x2A11, - 0xB042, - 0x2A11, - 0xB831, //0x15h - 0xC000, - 0x2A91, - 0x9400, - 0x00A8, - 0xc400, //0x1ah - 0xF7CF, //Ìá¸ßÔ¶¶ËÔëÉùÒÖÖÆ - 0x2414, //0x2ADC, //0x1ch ÌáÉýVIO VDDÖ®¼äѹ²îÒýÆðµÄ²»Á¼ - 0x806F, - 0x4608, - 0x0086, - 0x0661, //0x20H - 0x0000, - 0x109E, - 0x23C8, - 0x0406, - 0x0E1C, //0x25H -}; -#else -static uint16_t RDA5802N_initialization_reg[]={ - 0xc401, //02h - 0x0000, - 0x0400, - 0x86ad, //05h// - 0x0000, - 0x42c6, - 0x0000, - 0x0000, - 0x0000, //0x0ah - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, //0x10h - 0x0019, - 0x2a11, - 0xa053,//0x80,0x53, - 0x3e11,//0x22,0x11, - 0xfc7d, //0x15h - 0xc000, - 0x2a91, - 0x9400, - 0x00a8, - 0xc400, //0x1ah - 0xe000, - 0x2b1d, //0x23,0x14 - 0x816a, - 0x4608, - 0x0086, - 0x0661, //0x20h - 0x0000, - 0x109e, - 0x2244, - 0x0408, //0x24 - 0x0408, //0x25 -}; -#endif - -static RDA_FM_REG_T RDA5820NS_TX_initialization_reg[]={ - {0x02, 0xE003}, - {0xFF, 100}, // if address is 0xFF, sleep value ms - {0x02, 0xE001}, - {0x19, 0x88A8}, - {0x1A, 0x4290}, - {0x68, 0x0AF0}, - {0x40, 0x0001}, - {0x41, 0x41FF}, - {0xFF, 500}, - {0x03, 0x1B90}, -}; - -static RDA_FM_REG_T RDA5820NS_RX_initialization_reg[]={ - {0x02, 0x0002}, //Soft reset - {0xFF, 100}, // wait - {0x02, 0xC001}, //Power Up - {0x05, 0x888F}, //LNAP 0x884F --LNAN - {0x06, 0x6000}, - {0x13, 0x80E1}, - {0x14, 0x2A11}, - {0x1C, 0x22DE}, - {0x21, 0x0020}, - {0x03, 0x1B90}, -}; - - - -static struct file_operations fm_ops = { - .owner = THIS_MODULE, - .unlocked_ioctl = fm_ops_ioctl, - .llseek = fm_ops_lseek, - .open = fm_ops_open, - .release = fm_ops_release, -}; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) -static DECLARE_MUTEX(fm_ops_mutex); -#else -DEFINE_SEMAPHORE(fm_ops_mutex); -#endif - -/****************************************************************************** - *****************************************************************************/ - -/****************************************************************************** - *****************************************************************************/ - - - -static int RDAFM_GetChipID(struct i2c_client *client, uint16_t *pChipID) -{ - int err; - int ret = -1; - uint16_t val = 0x0002; - - //Reset RDA FM - err = RDAFM_write(client, 0x02, val); - if(err < 0){ -#ifdef FMDEBUG - FM_DEBUG("RDAFM_GetChipID: reset FM chip failed!\n"); -#endif - ret = -1; - return ret; - } - msleep(80); - - val = 0; - err = RDAFM_read(client, 0x0C, &val); - if (err == 0) - { - if ((0x5802 == val) || (0x5803 == val)) - { - err = RDAFM_read(client, 0x0E, &val); - - if (err == 0) - *pChipID = val; - else - *pChipID = 0x5802; - -#ifdef FMDEBUG - FM_DEBUG("RDAFM_GetChipID: Chip ID = %04X\n", val); -#endif - - ret = 0; - - } - else if ((0x5805 == val) || (0x5820 == val)) - { - *pChipID = val; - ret = 0; - } - else - { -#ifdef FMDEBUG - FM_DEBUG("RDAFM_GetChipID: get chip ID failed! get value = %04X\n", val); -#endif - ret = -1; - } - - } - else - { -#ifdef FMDEBUG - FM_DEBUG("RDAFM_GetChipID: get chip ID failed!\n"); -#endif - ret = -1; - } - - return ret; -} - - -/* - * RDAFM_read - */ -static int RDAFM_read(struct i2c_client *client, uint8_t addr, uint16_t *val) -{ - int n; - char b[2] = {0}; - - // first, send addr to RDAFM - n = i2c_master_send(client, (char*)&addr, 1); - if (n < 0) - { - FM_ALERT("RDAFM_read send:0x%X err:%d\n", addr, n); - return -1; - } - - // second, receive two byte from RDAFM - n = i2c_master_recv(client, b, 2); - if (n < 0) - { - FM_ALERT("RDAFM_read recv:0x%X err:%d\n", addr, n); - return -1; - } - - *val = (uint16_t)(b[0] << 8 | b[1]); - - return 0; -} - -/* - * RDAFM_write - */ -static int RDAFM_write(struct i2c_client *client, uint8_t addr, uint16_t val) -{ - int n; - char b[3]; - - b[0] = addr; - b[1] = (char)(val >> 8); - b[2] = (char)(val & 0xFF); - - n = i2c_master_send(client, b, 3); - if (n < 0) - { - FM_ALERT("RDAFM_write send:0x%X err:%d\n", addr, n); - return -1; - } - - return 0; -} - - -static int RDAFM_clear_hmute(struct i2c_client *client) -{ - int ret = 0; - uint16_t tRegValue = 0; - - FM_DEBUG("RDAFM_clear_hmute\n"); - - ret = RDAFM_read(client, 0x02, &tRegValue); - if (ret < 0) - { - FM_ALERT("RDAFM_clear_hmute read register failed!\n"); - return -1; - } - - tRegValue |= (1 << 14); - - ret = RDAFM_write(client, 0x02, tRegValue); - - if (ret < 0) - { - FM_ALERT("RDAFM_clear_hmute write register failed!\n"); - return -1; - } - - if(fm_tune_data.byPowerUp){ - if (fm_tune(g_fm_struct, &(fm_tune_data.parm)) < 0) - { - fm_tune_data.byPowerUp = false; - memset(&fm_tune_data.parm, 0, sizeof(fm_tune_data.parm)); - return -EPERM; - } - fm_tune_data.byPowerUp = false; - memset(&fm_tune_data.parm, 0, sizeof(fm_tune_data.parm)); - } - - return 0; -} - - - -static int RDAFM_enable_hmute(struct i2c_client *client) -{ - int ret = 0; - uint16_t tRegValue = 0; - - FM_DEBUG("RDAFM_enable_hmute\n"); - - ret = RDAFM_read(client, 0x02, &tRegValue); - if (ret < 0) - { - FM_ALERT("RDAFM_enable_hmute read register failed!\n"); - return -1; - } - - tRegValue &= (~(1 << 14)); - - ret = RDAFM_write(client, 0x02, tRegValue); - - if (ret < 0) - { - FM_ALERT("RDAFM_enable_hmute write register failed!\n"); - return -1; - } - - return 0; -} - - - -static int RDAFM_clear_tune(struct i2c_client *client) -{ - //Don't need it - return 0; -} - - - -static int RDAFM_enable_tune(struct i2c_client *client) -{ - //Don't need it - return 0; -} - - - -static int RDAFM_clear_seek(struct i2c_client *client) -{ - //Don't need it - return 0; -} - - - -static int RDAFM_enable_seek(struct i2c_client *client) -{ - //Don't need it - return 0; -} - - -//b=true set stereo else set mono -static int RDAFM_SetStereo(struct i2c_client *client, uint8_t b) -{ - int ret = 0; - uint16_t tRegValue = 0; - - FM_DEBUG("RDAFM_SetStereo\n"); - - ret = RDAFM_read(client, 0x02, &tRegValue); - if (ret < 0) - { - FM_ALERT("RDAFM_SetStereo read register failed!\n"); - return -1; - } - if (b) - tRegValue &= (~(1 << 13));//set stereo - else - tRegValue |= (1 << 13); //set mono - - ret = RDAFM_write(client, 0x02, tRegValue); - - if (ret < 0) - { - FM_ALERT("RDAFM_SetStereo write register failed!\n"); - return -1; - } - - - return 0; - -} - - -static int RDAFM_SetRSSI_Threshold(struct i2c_client *client, uint8_t RssiThreshold) -{ - int ret = 0; - uint16_t tRegValue = 0; - - FM_DEBUG("RDAFM_SetRSSI_Threshold\n"); - - ret = RDAFM_read(client, 0x05, &tRegValue); - if (ret < 0) - { - FM_ALERT("RDAFM_SetRSSI_Threshold read register failed!\n"); - return -1; - } - - tRegValue &= 0x80FF;//clear valume - tRegValue |= ((RssiThreshold & 0x7f) << 8); //set valume - - ret = RDAFM_write(client, 0x05, tRegValue); - - if (ret < 0) - { - FM_ALERT("RDAFM_SetRSSI_Threshold write register failed!\n"); - return -1; - } - - - return 0; - -} - - - -static int RDAFM_SetDe_Emphasis(struct i2c_client *client, uint8_t index) -{ - int ret = 0; - uint16_t tRegValue = 0; - - FM_DEBUG("RDAFM_SetRSSI_Threshold\n"); - - ret = RDAFM_read(client, 0x04, &tRegValue); - if (ret < 0) - { - FM_ALERT("RDAFM_SetRSSI_Threshold read register failed!\n"); - return -1; - } - - if (0 == index) - { - tRegValue &= (~(1 << 11));//De_Emphasis=75us - } - else if (1 == index) - { - tRegValue |= (1 << 11);//De_Emphasis=50us - } - - - ret = RDAFM_write(client, 0x04, tRegValue); - - if (ret < 0) - { - FM_ALERT("RDAFM_SetRSSI_Threshold write register failed!\n"); - return -1; - } - - - return 0; - - -} - - -static void RDAFM_em_test(struct i2c_client *client, uint16_t group_idx, uint16_t item_idx, uint32_t item_value) -{ - FM_ALERT("RDAFM_em_test %d:%d:%d\n", group_idx, item_idx, item_value); - switch (group_idx) - { - case mono: - if(item_value == 1) - { - RDAFM_SetStereo(client, 0); //force mono - } - else - { - RDAFM_SetStereo(client, 1); //stereo - - } - - break; - case stereo: - if(item_value == 0) - { - RDAFM_SetStereo(client, 1); //stereo - } - else - { - RDAFM_SetStereo(client, 0); //force mono - } - break; - case RSSI_threshold: - item_value &= 0x7F; - RDAFM_SetRSSI_Threshold(client, item_value); - break; - case Softmute_Enable: - if (item_idx) - { - RDAFM_enable_hmute(client); - } - else - { - RDAFM_clear_hmute(client); - } - break; - case De_emphasis: - if(item_idx >= 2) //0us - { - FM_ALERT("RDAFM not support De_emphasis 0\n"); - } - else - { - RDAFM_SetDe_Emphasis(client,item_idx);//0=75us,1=50us - } - break; - - case HL_Side: - - break; - default: - FM_ALERT("RDAFM not support this setting\n"); - break; - } -} - -static bool RDAFM_Scan(struct i2c_client *client, - uint16_t min_freq, uint16_t max_freq, - uint16_t *pFreq, - uint16_t *pScanTBL, - uint16_t *ScanTBLsize, - uint16_t scandir, - uint16_t space) -{ - uint16_t tFreq, tRegValue = 0; - uint16_t tmp_scanTBLsize = *ScanTBLsize; - int ret = -1; - bool isTrueStation = false; - uint16_t oldValue = 0; - int channel = 0; - - if((!pScanTBL) || (tmp_scanTBLsize == 0)) { - return false; - } - - //clear the old value of pScanTBL - memset(pScanTBL, 0, sizeof(uint16_t)*RDA599X_SCANTBL_SIZE); - - if(tmp_scanTBLsize > RDA599X_SCANTBL_SIZE) - { - tmp_scanTBLsize = RDA599X_SCANTBL_SIZE; - } - - //scan up - if(scandir == RDA599X_FM_SCAN_UP){ // now, only support scan up - tFreq = min_freq; - }else{ //scan down - tFreq = max_freq;//max_freq compare need or not - } - - //mute FM - RDAFM_enable_hmute(client); - - //set seekth - tRegValue = 0; - RDAFM_read(client, 0x05, &tRegValue); - tRegValue &= (~(0x7f<<8)); - tRegValue |= ((0x8 & 0x7f) << 8); - RDAFM_write(client, 0x05, tRegValue); - msleep(50); - - atomic_set(&scan_complete_flag, 1); - do { - if(atomic_read(&scan_complete_flag) == 0) - break; - isTrueStation = false; - - //set channel and enable TUNE - tRegValue = 0; - RDAFM_read(client, 0x03, &tRegValue); - tRegValue &= (~(0x03ff<<6)); //clear bit[15:6] - channel = tFreq - min_freq; - tRegValue |= ((channel << 6) | (1 << 4)); //set bit[15:6] and bit[4] - ret = RDAFM_write(client, 0x03, tRegValue); - msleep(40); - - //read 0x0B and check FM_TRUE(bit[8]) - tRegValue = 0; - ret = RDAFM_read(client, 0x0B, &tRegValue); - if(!ret){ - if((tRegValue & 0x0100) == 0x0100){ - isTrueStation = true; - } - } - - //if this freq is a true station, read the channel - if(isTrueStation){ - //tRegValue = 0; - //RDAFM_read(client, 0x03, &tRegValue); - //channel = ((tRegValue>>6) & 0x03ff) - 5; - channel = channel - 5; - if((channel >= 0) && (channel != 85)){ - oldValue = *(pScanTBL+(channel/16)); - oldValue |= (1<<(channel%16)); - *(pScanTBL+(channel/16)) = oldValue; - } - } - - //increase freq - tFreq += space; - }while( tFreq <= max_freq ); - -#if defined(MTK_MT6515) && defined(MT6626) - *(pScanTBL+13) = 0xb2d4; - *(pScanTBL+14) = 0xb2d4; - *(pScanTBL+15) = 0xb2d4; -#endif - - *ScanTBLsize = tmp_scanTBLsize; - *pFreq = 0; - - //clear FM mute - RDAFM_clear_hmute(client); - - return true; -} - - -static int fm_setup_cdev(struct fm *fm) -{ - int err; - - err = alloc_chrdev_region(&fm->dev_t, 0, 1, FM_NAME); - if (err) { - FM_ALERT("alloc dev_t failed\n"); - return -1; - } - - FM_ALERT("alloc %s:%d:%d\n", FM_NAME, - MAJOR(fm->dev_t), MINOR(fm->dev_t)); - - cdev_init(&fm->cdev, &fm_ops); - - fm->cdev.owner = THIS_MODULE; - fm->cdev.ops = &fm_ops; - - err = cdev_add(&fm->cdev, fm->dev_t, 1); - if (err) { - FM_ALERT("alloc dev_t failed\n"); - return -1; - } - - fm->cls = class_create(THIS_MODULE, FM_NAME); - if (IS_ERR(fm->cls)) { - err = PTR_ERR(fm->cls); - FM_ALERT("class_create err:%d\n", err); - return err; - } - fm->dev = device_create(fm->cls, NULL, fm->dev_t, NULL, FM_NAME); - - return 0; -} - - - -static int fm_ops_ioctl(struct file *filp, - unsigned int cmd, unsigned long arg) -{ - int ret = 0; - struct fm *fm = container_of(filp->f_dentry->d_inode->i_cdev, struct fm, cdev); - - FM_DEBUG("%s cmd(%x)\n", __func__, cmd); - - switch(cmd) - { - case FM_IOCTL_POWERUP: - { - struct fm_tune_parm parm; - FM_DEBUG("FM_IOCTL_POWERUP\n"); - - // FIXME!! - // if (!capable(CAP_SYS_ADMIN)) - // return -EPERM; - - if (copy_from_user(&parm, (void*)arg, sizeof(struct fm_tune_parm))) - return -EFAULT; - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - ret = fm_powerup(fm, &parm); - up(&fm_ops_mutex); - if (copy_to_user((void*)arg, &parm, sizeof(struct fm_tune_parm))) - return -EFAULT; - // fm_low_power_wa(1); - break; - } - - case FM_IOCTL_POWERDOWN: - { - FM_DEBUG("FM_IOCTL_POWERDOWN\n"); - // FIXME!! - // if (!capable(CAP_SYS_ADMIN)) - // return -EPERM; - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - ret = fm_powerdown(fm); - up(&fm_ops_mutex); - // fm_low_power_wa(0); - break; - } - - // tune (frequency, auto Hi/Lo ON/OFF ) - case FM_IOCTL_TUNE: - { - struct fm_tune_parm parm; - FM_DEBUG("FM_IOCTL_TUNE\n"); - // FIXME! - // if (!capable(CAP_SYS_ADMIN)) - // return -EPERM; - - if (copy_from_user(&parm, (void*)arg, sizeof(struct fm_tune_parm))) - return -EFAULT; - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - ret = fm_tune(fm, &parm); - up(&fm_ops_mutex); - - if (copy_to_user((void*)arg, &parm, sizeof(struct fm_tune_parm))) - return -EFAULT; - - break; - } - - case FM_IOCTL_SEEK: - { - struct fm_seek_parm parm; - FM_DEBUG("FM_IOCTL_SEEK\n"); - - // FIXME!! - // if (!capable(CAP_SYS_ADMIN)) - // return -EPERM; - - if (copy_from_user(&parm, (void*)arg, sizeof(struct fm_seek_parm))) - return -EFAULT; - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - ret = fm_seek(fm, &parm); - up(&fm_ops_mutex); - - if (copy_to_user((void*)arg, &parm, sizeof(struct fm_seek_parm))) - return -EFAULT; - - break; - } - - case FM_IOCTL_SETVOL: - { - uint32_t vol; - FM_DEBUG("FM_IOCTL_SETVOL\n"); - - // FIXME!! - // if (!capable(CAP_SYS_ADMIN)) - // return -EPERM; - - if(copy_from_user(&vol, (void*)arg, sizeof(uint32_t))) { - FM_ALERT("copy_from_user failed\n"); - return -EFAULT; - } - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - ret = fm_setvol(fm, vol); - up(&fm_ops_mutex); - - break; - } - - case FM_IOCTL_GETVOL: - { - uint32_t vol; - FM_DEBUG("FM_IOCTL_GETVOL\n"); - - // FIXME!! - // if (!capable(CAP_SYS_ADMIN)) - // return -EPERM; - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - ret = fm_getvol(fm, &vol); - up(&fm_ops_mutex); - - if (copy_to_user((void*)arg, &vol, sizeof(uint32_t))) - return -EFAULT; - - break; - } - - case FM_IOCTL_MUTE: - { - uint32_t bmute; - FM_DEBUG("FM_IOCTL_MUTE\n"); - - // FIXME!! - // if (!capable(CAP_SYS_ADMIN)) - // return -EPERM; - if (copy_from_user(&bmute, (void*)arg, sizeof(uint32_t))) - { - FM_DEBUG("copy_from_user mute failed!\n"); - return -EFAULT; - } - - FM_DEBUG("FM_IOCTL_MUTE:%d\n", bmute); - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - - if (bmute){ - ret = RDAFM_enable_hmute(fm->i2c_client); - }else{ - ret = RDAFM_clear_hmute(fm->i2c_client); - } - - up(&fm_ops_mutex); - - break; - } - - case FM_IOCTL_GETRSSI: - { - uint32_t rssi; - FM_DEBUG("FM_IOCTL_GETRSSI\n"); - - // FIXME!! - // if (!capable(CAP_SYS_ADMIN)) - // return -EPERM; - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - - ret = fm_getrssi(fm, &rssi); - up(&fm_ops_mutex); - - if (copy_to_user((void*)arg, &rssi, sizeof(uint32_t))) - return -EFAULT; - - break; - } - - case FM_IOCTL_RW_REG: - { - struct fm_ctl_parm parm_ctl; - FM_DEBUG("FM_IOCTL_RW_REG\n"); - - // FIXME!! - // if (!capable(CAP_SYS_ADMIN)) - // return -EPERM; - - if (copy_from_user(&parm_ctl, (void*)arg, sizeof(struct fm_ctl_parm))) - return -EFAULT; - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - - if(parm_ctl.rw_flag == 0) //write - { - ret = RDAFM_write(fm->i2c_client, parm_ctl.addr, parm_ctl.val); - } - else - { - ret = RDAFM_read(fm->i2c_client, parm_ctl.addr, &parm_ctl.val); - } - - up(&fm_ops_mutex); - if ((parm_ctl.rw_flag == 0x01) && (!ret)) // Read success. - { - if (copy_to_user((void*)arg, &parm_ctl, sizeof(struct fm_ctl_parm))) - return -EFAULT; - } - break; - } - - case FM_IOCTL_GETCHIPID: - { - uint16_t chipid; - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - - RDAFM_GetChipID(fm->i2c_client, &chipid); - //chipid = fm->chip_id; - chipid = 0x6620; - FM_DEBUG("FM_IOCTL_GETCHIPID:%04x\n", chipid); - up(&fm_ops_mutex); - - if (copy_to_user((void*)arg, &chipid, sizeof(uint16_t))) - return -EFAULT; - - break; - } - - case FM_IOCTL_EM_TEST: - { - struct fm_em_parm parm_em; - FM_DEBUG("FM_IOCTL_EM_TEST\n"); - - // FIXME!! - // if (!capable(CAP_SYS_ADMIN)) - // return -EPERM; - - if (copy_from_user(&parm_em, (void*)arg, sizeof(struct fm_em_parm))) - return -EFAULT; - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - - RDAFM_em_test(fm->i2c_client, parm_em.group_idx, parm_em.item_idx, parm_em.item_value); - - up(&fm_ops_mutex); - - break; - } - case FM_IOCTL_IS_FM_POWERED_UP: - { - uint32_t powerup; - FM_DEBUG("FM_IOCTL_IS_FM_POWERED_UP"); - if (fm->powerup) { - powerup = 1; - } else { - powerup = 0; - } - if (copy_to_user((void*)arg, &powerup, sizeof(uint32_t))) - return -EFAULT; - break; - } - -#ifdef FMDEBUG - case FM_IOCTL_DUMP_REG: - { - uint16_t chipid = 0; - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - RDAFM_GetChipID(fm->i2c_client, &chipid); - up(&fm_ops_mutex); - - break; - } -#endif - - case FM_IOCTL_SCAN: - { - struct fm_scan_parm parm; - FM_DEBUG("FM_IOCTL_SCAN\n"); - if (false == fm->powerup){ - return -EFAULT; - } - if(copy_from_user(&parm, (void*)arg, sizeof(struct fm_scan_parm))){ - return -EFAULT; - } - if (down_interruptible(&fm_ops_mutex)){ - return -EFAULT; - } - fm_scan(fm, &parm); - up(&fm_ops_mutex); - - if(copy_to_user((void*)arg, &parm, sizeof(struct fm_scan_parm))){ - return -EFAULT; - } - - break; - } - - case FM_IOCTL_STOP_SCAN: - { - FM_DEBUG("FM_IOCTL_STOP_SCAN\n"); - break; - } - - default: - { - FM_DEBUG("default\n"); - break; - } - } - - return ret; -} -static loff_t fm_ops_lseek(struct file *filp, loff_t off, int whence) -{ -// struct fm *fm = filp->private_data; - - if(whence == SEEK_END){ - //fm_hwscan_stop(fm); - atomic_set(&scan_complete_flag, 0); - }else if(whence == SEEK_SET){ - //FM_EVENT_SEND(fm->rds_event, FM_RDS_DATA_READY); - } - return off; -} - -static int fm_ops_open(struct inode *inode, struct file *filp) -{ - struct fm *fm = container_of(inode->i_cdev, struct fm, cdev); - - FM_DEBUG("%s\n", __func__); - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - - // TODO: only have to set in the first time? - // YES!!!! - - fm->ref++; - - up(&fm_ops_mutex); - - filp->private_data = fm; - - // TODO: check open flags - - return 0; -} - -static int fm_ops_release(struct inode *inode, struct file *filp) -{ - int err = 0; - struct fm *fm = container_of(inode->i_cdev, struct fm, cdev); - - FM_DEBUG("%s\n", __func__); - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - fm->ref--; - if(fm->ref < 1) { - if(fm->powerup == true) { - fm_powerdown(fm); - } - } - - up(&fm_ops_mutex); - - return err; -} - -static int fm_init(struct i2c_client *client) -{ - int err; - struct fm *fm = NULL; - int ret = -1; - - - FM_DEBUG("%s()\n", __func__); - if (!(fm = kzalloc(sizeof(struct fm), GFP_KERNEL))) - { - FM_ALERT("-ENOMEM\n"); - err = -ENOMEM; - goto ERR_EXIT; - } - - fm->ref = 0; - fm->powerup = false; - atomic_set(&scan_complete_flag, 0); - - // First, read 5802NM chip ID - FM_DEBUG("%s()First, read 5802NM chip ID\n", __func__); - ret = RDAFM_GetChipID(client, &RDAFM_CHIP_ID); - FM_DEBUG("%s() 5802NM chip ID = 0x%04x\n", __func__, RDAFM_CHIP_ID); - // if failed, means use FM in 5990P_E - if(ret < 0){ - // enable the FM chip in combo - FM_DEBUG("%s() enable the FM chip in combo\n", __func__); - ret = rda_fm_power_on(); - if(ret < 0){ - err = -ENOMEM; - goto ERR_EXIT; - } - msleep(100); - ret = RDAFM_GetChipID(client, &RDAFM_CHIP_ID); - FM_DEBUG("%s() the FM in combo chip ID = 0x%04x\n", __func__, RDAFM_CHIP_ID); - if(ret < 0){ - err = -ENOMEM; - goto ERR_EXIT; - }else{ - fm->chip_id = RDAFM_CHIP_ID; - } - - // disable the FM chip for power saving - ret = rda_fm_power_off(); - if(ret < 0){ - err = -ENOMEM; - goto ERR_EXIT; - } - }else{ - fm->chip_id = RDAFM_CHIP_ID; - } - - - - if ((err = fm_setup_cdev(fm))) - { - goto ERR_EXIT; - } - - g_fm_struct = fm; - fm->i2c_client = client; - i2c_set_clientdata(client, fm); - - - /***********Add porc file system*************/ - - g_fm_proc = create_proc_entry(FM_PROC_FILE, 0444, NULL); - if (g_fm_proc == NULL) { - FM_ALERT("create_proc_entry failed\n"); - err = -ENOMEM; - goto ERR_EXIT; - } else { - g_fm_proc->read_proc = fm_proc_read; - g_fm_proc->write_proc = NULL; - //g_fm_proc->owner = THIS_MODULE; - FM_ALERT("create_proc_entry success\n"); - } - - /********************************************/ - - FM_DEBUG("fm_init is ok!\n"); - - return 0; - -ERR_EXIT: - kfree(fm); - - return err; -} - -static int fm_proc_read(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int cnt= 0; - struct fm *fm = g_fm_struct; - FM_ALERT("Enter fm_proc_read.\n"); - if(off != 0) - return 0; - if (fm != NULL && fm->powerup) { - cnt = sprintf(page, "1\n"); - } else { - cnt = sprintf(page, "0\n"); - } - *eof = 1; - FM_ALERT("Leave fm_proc_read. cnt = %d\n", cnt); - return cnt; -} - - -static int fm_destroy(struct fm *fm) -{ - int err = 0; - - FM_DEBUG("%s\n", __func__); - - device_destroy(fm->cls, fm->dev_t); - class_destroy(fm->cls); - - cdev_del(&fm->cdev); - unregister_chrdev_region(fm->dev_t, 1); - - fm_powerdown(fm); - - /***********************************/ - remove_proc_entry(FM_PROC_FILE, NULL); - - /**********************************/ - - // FIXME: any other hardware configuration ? - - // free all memory - kfree(fm); - - return err; -} - -/* - * fm_powerup - */ -static int fm_powerup(struct fm *fm, struct fm_tune_parm *parm) -{ - int i; - uint16_t tRegValue = 0x0002; - int ret = -1; - - struct i2c_client *client = fm->i2c_client; - - if (fm->powerup) - { - parm->err = FM_BADSTATUS; - return -EPERM; - } - - // if chip_id is ID_RDA5820NS, enable the FM chip in combo - if(fm->chip_id == ID_RDA5820NS){ - ret = rda_fm_power_on(); - if(ret < 0){ - return -EPERM; - } - msleep(100); - } - - - //Reset RDA FM - tRegValue = 0x0002; - RDAFM_write(client, 0x02, tRegValue); - msleep(100); - - - if (ID_RDA5802N == RDAFM_CHIP_ID){ - for (i=0; i<((sizeof(RDA5802N_initialization_reg)) / (sizeof(uint16_t))); i++) - { - ret = RDAFM_write(client, i+2, RDA5802N_initialization_reg[i]); - - if (ret < 0) - { - FM_DEBUG("fm_powerup init failed!\n"); - - parm->err = FM_FAILED; - - return -EPERM; - } - } - - }else if (ID_RDA5820NS == RDAFM_CHIP_ID){ - if(RDA_RADIO_WorkType == FM_RECEIVER){ - for (i = 0; i < ((sizeof(RDA5820NS_RX_initialization_reg)) / (sizeof(RDA_FM_REG_T))); i++) - { - if(RDA5820NS_RX_initialization_reg[i].address == 0xFF){ - msleep(RDA5820NS_RX_initialization_reg[i].value); - }else{ - ret = RDAFM_write(client, RDA5820NS_RX_initialization_reg[i].address, RDA5820NS_RX_initialization_reg[i].value); - if (ret < 0) - { - FM_DEBUG("fm_powerup init failed!\n"); - parm->err = FM_FAILED; - return -EPERM; - } - } - } - }else{ - for (i = 0; i < ((sizeof(RDA5820NS_TX_initialization_reg)) / (sizeof(RDA_FM_REG_T))); i++) - { - if(RDA5820NS_TX_initialization_reg[i].address == 0xFF){ - msleep(RDA5820NS_TX_initialization_reg[i].value); - }else{ - ret = RDAFM_write(client, RDA5820NS_TX_initialization_reg[i].address, RDA5820NS_TX_initialization_reg[i].value); - if (ret < 0) - { - FM_DEBUG("fm_powerup init failed!\n"); - parm->err = FM_FAILED; - return -EPERM; - } - } - } - } - - } - - - FM_DEBUG("pwron ok\n"); - fm->powerup = true; - - if (fm_tune(fm, parm) < 0) - { - return -EPERM; - } - fm_tune_data.byPowerUp = true; - memcpy(&fm_tune_data.parm, parm, sizeof(fm_tune_data.parm)); - - parm->err = FM_SUCCESS; - - return 0; - -} - -/* - * fm_powerdown - */ -static int fm_powerdown(struct fm *fm) -{ - uint16_t tRegValue = 0; - int ret = -1; - struct i2c_client *client = fm->i2c_client; - - RDAFM_read(client, 0x02, &tRegValue); - tRegValue &= (~(1 << 0)); - RDAFM_write(client, 0x02, tRegValue); - - if(fm->chip_id == ID_RDA5820NS){ - ret = rda_fm_power_off(); - if(ret < 0){ - return -EPERM; - } - } - - fm->powerup = false; - FM_ALERT("pwrdown ok\n"); - - return 0; -} - -/* - * fm_seek - */ -static int fm_seek(struct fm *fm, struct fm_seek_parm *parm) -{ - int ret = 0; - uint16_t val = 0; - uint8_t spaec = 1; - uint16_t tFreq = 875; - uint16_t tRegValue = 0; - uint16_t bottomOfBand = 875; - int falseStation = -1; - - - struct i2c_client *client = fm->i2c_client; - - if (!fm->powerup) - { - parm->err = FM_BADSTATUS; - return -EPERM; - } - - if (parm->space == FM_SPACE_100K) - { - spaec = 1; - val &= (~((1<<0) | (1<<1))); - } - else if (parm->space == FM_SPACE_200K) - { - spaec = 2; - val &= (~(1<<1)); - val |= (1<<0); - } - else - { - parm->err = FM_EPARM; - return -EPERM; - } - - if (parm->band == FM_BAND_UE) - { - val &= (~((1<<2) | (1<<3))); - bottomOfBand = 875; - fm->min_freq = 875; - fm->max_freq = 1080; - } - else if (parm->band == FM_BAND_JAPAN) - { - val &= (~(1<<3)); - val |= (1 << 2); - bottomOfBand = 760; - fm->min_freq = 760; - fm->max_freq = 910; - } - else if (parm->band == FM_BAND_JAPANW) { - val &= (~(1<<2)); - val |= (1 << 3); - bottomOfBand = 760; - fm->min_freq = 760; - fm->max_freq = 1080; - } - else - { - FM_ALERT("band:%d out of range\n", parm->band); - parm->err = FM_EPARM; - return -EPERM; - } - - if (parm->freq < fm->min_freq || parm->freq > fm->max_freq) { - FM_ALERT("freq:%d out of range\n", parm->freq); - parm->err = FM_EPARM; - return -EPERM; - } - - if (parm->seekth > 0x0B) { - FM_ALERT("seekth:%d out of range\n", parm->seekth); - parm->err = FM_EPARM; - return -EPERM; - } - - RDAFM_read(client, 0x05, &tRegValue); - tRegValue &= (~(0x7f<<8)); - //tRegValue |= ((parm->seekth & 0x7f) << 8); - tRegValue |= ((0x8 & 0x7f) << 8); - RDAFM_write(client, 0x05, tRegValue); - - -#ifdef FMDEBUG - if (parm->seekdir == FM_SEEK_UP) - FM_DEBUG("seek %d up\n", parm->freq); - else - FM_DEBUG("seek %d down\n", parm->freq); -#endif - - // (1) set hmute bit - RDAFM_enable_hmute(client); - - tFreq = parm->freq; - - do { - if (parm->seekdir == FM_SEEK_UP) - tFreq += spaec; - else - tFreq -= spaec; - - if (tFreq > fm->max_freq) - tFreq = fm->min_freq; - if (tFreq < fm->min_freq) - tFreq = fm->max_freq; - - val = (((tFreq - bottomOfBand+5) << 6) | (1 << 4) | (val & 0x0f)); - RDAFM_write(client, 0x03, val); - msleep(40); - ret = RDAFM_read(client, 0x0B, &tRegValue); - if (ret < 0) - { - FM_DEBUG("fm_seek: read register failed tunning freq = %4X\n", tFreq); - falseStation = -1; - } - else - { - if ((tRegValue & 0x0100) == 0x0100) - falseStation = 0; - else - falseStation = -1; - } - - if(falseStation == 0) - break; - }while(tFreq != parm->freq); - - - //clear hmute - RDAFM_clear_hmute(client); - - if (falseStation == 0) // seek successfully - { - parm->freq = tFreq; - FM_ALERT("fm_seek success, freq:%d\n", parm->freq); - parm->err = FM_SUCCESS; - - - } - else - { - FM_ALERT("fm_seek failed, invalid freq\n"); - parm->err = FM_SEEK_FAILED; - ret = -1; - } - - return ret; -} - -/* - * fm_scan - */ -static int fm_scan(struct fm *fm, struct fm_scan_parm *parm) -{ - int ret = 0; - uint16_t tRegValue = 0; - uint16_t scandir = RDA599X_FM_SCAN_UP; //scandir ËÑË÷·½Ïò - uint8_t space = 1; - struct i2c_client *client = fm->i2c_client; - - if (!fm->powerup){ - parm->err = FM_BADSTATUS; - return -EPERM; - } - - RDAFM_read(client, 0x03, &tRegValue); - - if (parm->space == FM_SPACE_100K){ - space = 1; - tRegValue &= (~((1<<0) | (1<<1))); //set 03H's bit[1:0] to 00 - }else if (parm->space == FM_SPACE_200K) { - space = 2; - tRegValue &= (~(1<<1)); //clear bit[1] - tRegValue |= (1<<0); //set bit[0] - }else{ - //default - space = 1; - tRegValue &= (~((1<<0) | (1<<1))); //set 03H's bit[1:0] to 00 - } - - if(parm->band == FM_BAND_UE){ - tRegValue &= (~((1<<2) | (1<<3))); - fm->min_freq = 875; - fm->max_freq = 1080; - }else if(parm->band == FM_BAND_JAPAN){ - tRegValue &= (~(1<<3)); - tRegValue |= (1 << 2); - fm->min_freq = 760; - fm->max_freq = 900; - }else if(parm->band == FM_BAND_JAPANW){ - tRegValue &= (~(1<<2)); - tRegValue |= (1 << 3); - fm->min_freq = 760; - fm->max_freq = 1080; - }else{ - parm->err = FM_EPARM; - return -EPERM; - } - - //set space and band - RDAFM_write(client, 0x03, tRegValue); - msleep(40); - - - if(RDAFM_Scan(client, fm->min_freq, fm->max_freq, &(parm->freq), parm->ScanTBL, &(parm->ScanTBLSize), scandir, space)){ - parm->err = FM_SUCCESS; - }else{ - parm->err = FM_SEEK_FAILED; - } - - return ret; -} - - -static int fm_setvol(struct fm *fm, uint32_t vol) -{ - int ret = 0; - uint16_t tRegValue = 0; - struct i2c_client *client = fm->i2c_client; - - if (vol > 15) - vol = 15; - - FM_DEBUG("fm_setvol:%d\n", vol); - - ret = RDAFM_read(client, 0x05, &tRegValue); - if (ret) - return -EPERM; - tRegValue &= ~(0x000f); - tRegValue |= vol; - - ret = RDAFM_write(client, 0x05, tRegValue); - if (ret) - return -EPERM; - - return 0; -} - -static int fm_getvol(struct fm *fm, uint32_t *vol) -{ - int ret = 0; - uint16_t tRegValue; - struct i2c_client *client = fm->i2c_client; - - ret = RDAFM_read(client, 0x05, &tRegValue); - if (ret) - return -EPERM; - - if (ret) - return -EPERM; - - *vol = (tRegValue & 0x000F); - - return 0; -} - -static int fm_getrssi(struct fm *fm, uint32_t *rssi) -{ - int ret = 0; - uint16_t tRegValue; - struct i2c_client *client = fm->i2c_client; - - ret = RDAFM_read(client, 0x0B, &tRegValue); - if (ret) - return -EPERM; - - - *rssi = (uint32_t)((tRegValue >> 9) & RDAFM_MASK_RSSI); - - FM_DEBUG("rssi value:%d\n", *rssi); - - return 0; -} - -/* - * fm_tune - */ -static int fm_tune(struct fm *fm, struct fm_tune_parm *parm) -{ - int ret; - uint16_t val = 0; - uint8_t space = 1; - uint16_t bottomOfBand = 875; - - struct i2c_client *client = fm->i2c_client; - - FM_DEBUG("%s\n", __func__); - - if (!fm->powerup) - { - parm->err = FM_BADSTATUS; - return -EPERM; - } - - if (parm->space == FM_SPACE_100K) - { - space = 1; - val &= (~((1<<0) | (1<<1))); - } - else if (parm->space == FM_SPACE_200K) - { - space = 2; - val |= (1<<0); - val &= (~(1<<1)); - } - else - { - parm->err = FM_EPARM; - return -EPERM; - } - - if (parm->band == FM_BAND_UE) - { - val &= (~((1<<2) | (1<<3))); - bottomOfBand = 875; - fm->min_freq = 875; - fm->max_freq = 1080; - } - else if (parm->band == FM_BAND_JAPAN) - { - val &= (~(1<<3)); - val |= (1 << 2); - bottomOfBand = 760; - fm->min_freq = 760; - fm->max_freq = 910; - } - else if (parm->band == FM_BAND_JAPANW) { - val &= (~(1<<2)); - val |= (1 << 3); - bottomOfBand = 760; - fm->min_freq = 760; - fm->max_freq = 1080; - } - else - { - FM_ALERT("band:%d out of range\n", parm->band); - parm->err = FM_EPARM; - return -EPERM; - } - - if (parm->freq < fm->min_freq || parm->freq > fm->max_freq) { - FM_ALERT("freq:%d out of range\n", parm->freq); - parm->err = FM_EPARM; - return -EPERM; - } - - FM_DEBUG("fm_tune, freq:%d\n", parm->freq); - - //RDAFM_enable_hmute(client); - - val = (((parm->freq - bottomOfBand + 5) << 6) | (1 << 4) | (val & 0x0f)); - - ret = RDAFM_write(client, 0x03, val); - if (ret < 0) - { - FM_ALERT("fm_tune write freq failed\n"); - parm->err = FM_SEEK_FAILED; - return ret; - } - msleep(40); - - return ret; -} - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) -/* - * fm_i2c_attach_adapter - */ -static int fm_i2c_attach_adapter(struct i2c_adapter *adapter) -{ - int err = 0; - - if (adapter->id == RDAFM_I2C_PORT) - { - return i2c_probe(adapter, &RDAFM_addr_data, fm_i2c_detect); - } - - return err; -} - -/* - * fm_i2c_detect - * This function is called by i2c_detect - */ -static int fm_i2c_detect(struct i2c_adapter *adapter, int addr, int kind) -{ - int err; - struct i2c_client *client = NULL; - - /* skip this since MT6516 shall support all the needed functionalities - if (!i2c_check_functionality(adapter, xxx)) - { - FM_DEBUG("i2c_check_functionality failed\n"); - return -ENOTSUPP; - } - */ - - /* initial i2c client */ - if (!(client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL))) - { - FM_ALERT("kzalloc failed\n"); - err = -ENOMEM; - goto ERR_EXIT; - } - - client->addr = addr; - client->adapter = adapter; - client->driver = &RDAFM_driver; - client->flags = 0; - strncpy(client->name, "RDA FM RADIO", I2C_NAME_SIZE); - - if ((err = fm_init(client))) - { - FM_ALERT("fm_init ERR:%d\n", err); - goto ERR_EXIT; - } - - if (err = i2c_attach_client(client)) - { - FM_ALERT("i2c_attach_client ERR:%d\n", err); - goto ERR_EXIT; - } - - return 0; - -ERR_EXIT: - kfree(client); - - return err; -} -static int fm_i2c_detach_client(struct i2c_client *client) -{ - int err = 0; - struct fm *fm = i2c_get_clientdata(client); - - FM_DEBUG("fm_i2c_detach_client\n"); - - err = i2c_detach_client(client); - if (err) - { - dev_err(&client->dev, "fm_i2c_detach_client failed\n"); - return err; - } - - fm_destroy(fm); - kfree(client); - - return err; -} -#else -static int fm_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) -{ - int err = -1; - FM_DEBUG("fm_i2c_probe\n"); - //client->timing = 50; - //client->timing = 200; - if ((err = fm_init(client))) - { - FM_ALERT("fm_init ERR:%d\n", err); - goto ERR_EXIT; - } - - return 0; - -ERR_EXIT: - return err; -} - -static int fm_i2c_detect(struct i2c_client *client, int kind, struct i2c_board_info *info) -{ - FM_DEBUG("fm_i2c_detect\n"); - strcpy(info->type, RDAFM_DEV); - return 0; -} - -static int fm_i2c_remove(struct i2c_client *client) -{ - int err = 0; - struct fm *fm = i2c_get_clientdata(client); - - FM_DEBUG("fm_i2c_remove\n"); - if(fm) - { - fm_destroy(fm); - fm = NULL; - } - - return err; -} -#endif - -int i2c_static_add_device(struct i2c_board_info *info) -{ - struct i2c_adapter *adapter; - struct i2c_client *client; - int ret; - - adapter = i2c_get_adapter(RDAFM_I2C_PORT); - if (!adapter) { - FM_DEBUG("%s: can't get i2c adapter\n", __func__); - ret = -ENODEV; - goto i2c_err; - } - - client = i2c_new_device(adapter, info); - if (!client) { - FM_DEBUG("%s: can't add i2c device at 0x%x\n", - __FUNCTION__, (unsigned int)info->addr); - ret = -ENODEV; - goto i2c_err; - } - - i2c_put_adapter(adapter); - - return 0; - -i2c_err: - return ret; -} - -static int mt_fm_probe(struct platform_device *pdev) -{ - int err = -1; - FM_ALERT("mt_fm_probe\n"); - err = i2c_static_add_device(&i2c_rdafm); - if (err < 0){ - FM_DEBUG("%s(): add i2c device error, err = %d\n", __func__, err); - return err; - } - - // Open I2C driver - err = i2c_add_driver(&RDAFM_driver); - if (err) - { - FM_ALERT("i2c err\n"); - } - - return err; -} - -static int mt_fm_remove(struct platform_device *pdev) -{ - FM_ALERT("mt_fm_remove\n"); - i2c_unregister_device(g_fm_struct->i2c_client); - i2c_del_driver(&RDAFM_driver); - - return 0; -} - - -static struct platform_driver mt_fm_dev_drv = -{ - .probe = mt_fm_probe, - .remove = mt_fm_remove, -#if 0//def CONFIG_PM //Not need now - .suspend = mt_fm_suspend, - .resume = mt_fm_resume, -#endif - .driver = { - .name = FM_NAME, - .owner = THIS_MODULE, - } -}; - -#if defined(MTK_MT6515) -static struct platform_device mt_fm_device = { - .name = FM_NAME, - .id = -1, -}; -#endif - - -/* - * mt_fm_init - */ -static int __init mt_fm_init(void) -{ - int err = 0; - - FM_DEBUG("mt_fm_init\n"); -#if defined(MTK_MT6515) - err = platform_device_register(&mt_fm_device); - if(err){ - FM_DEBUG("platform_device_register fail\n"); - return err; - }else{ - FM_DEBUG("platform_device_register success\n"); - } -#endif - err = platform_driver_register(&mt_fm_dev_drv); - if (err) - { - FM_DEBUG("platform_driver_register failed\n"); - }else{ - FM_DEBUG("platform_driver_register success\n"); - } - - return err; -} - -/* - * mt_fm_exit - */ -static void __exit mt_fm_exit(void) -{ - FM_DEBUG("mt_fm_exit\n"); - platform_driver_unregister(&mt_fm_dev_drv); -#if defined(MTK_MT6515) - platform_device_unregister(&mt_fm_device); -#endif -} - -module_init(mt_fm_init); -module_exit(mt_fm_exit); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("MediaTek FM Driver"); -MODULE_AUTHOR("William Chung "); - - diff --git a/drivers/net/wireless/rda5990/drv_fm_rda/RDA5990_FM_drv_gpio.c b/drivers/net/wireless/rda5990/drv_fm_rda/RDA5990_FM_drv_gpio.c deleted file mode 100755 index b154fbcaa5cd..000000000000 --- a/drivers/net/wireless/rda5990/drv_fm_rda/RDA5990_FM_drv_gpio.c +++ /dev/null @@ -1,1784 +0,0 @@ -#include -#include -#include -#include // udelay() -#include // device_create() -#include -#include -#include -#include -#include /* constant of kernel version */ -#include // get_user() - -#include -#include -#include -#include -#include -#include - -// if need debug, define FMDEBUG -//#define FMDEBUG - -// if your platform is MT6515/6575, define MTK_MT6515 -#define MTK_MT6515 - -// if your platform is MT6515/6575 and MTK FM is MT6626, define MT6626 -//#define MT6626 - -#define FM_ALERT(f, s...) \ - do { \ - printk(KERN_ALERT "RDAFM " f, ## s); \ - } while(0) - -#ifdef FMDEBUG -#define FM_DEBUG(f, s...) \ - do { \ - printk("RDAFM " f, ## s); \ - } while(0) -#else -#define FM_DEBUG(f, s...) -#endif - -#define RDA599X_SCANTBL_SIZE 16 //16*uinit16_t -#define RDA599X_FM_SCAN_UP 0x0 -#define RDA599X_FM_SCAN_DOWN 0x01 - -extern int rda_gpio_i2c_read_1_addr_2_data(uint8_t chipAddr, uint8_t regAddr, unsigned short *buffer); -extern int rda_gpio_i2c_write_1_addr_2_data(uint8_t chipAddr, uint8_t regAddr, unsigned short data); -extern int rda_fm_power_off(void); -extern int rda_fm_power_on(void); - -/****************************************************************************** - * CONSTANT DEFINITIONS - *****************************************************************************/ -#define RDAFM_SLAVE_ADDR 0x11 //RDA FM Chip address - -#define RDAFM_MASK_RSSI 0X7F // RSSI - - - -#define ID_RDA5802E 0x5804 -#define ID_RDA5802H 0x5801 -#define ID_RDA5802N 0x5808 -#define ID_RDA5820 0x5805 -#define ID_RDA5820NS 0x5820 - - - -static struct proc_dir_entry *g_fm_proc = NULL; -static struct fm *g_fm_struct = NULL; -static atomic_t scan_complete_flag; - -#define FM_PROC_FILE "fm" - -/****************************************************************************** - * STRUCTURE DEFINITIONS - *****************************************************************************/ - -enum RDAFM_CHIP_TYPE { - CHIP_TYPE_RDA5802E = 0, - CHIP_TYPE_RDA5802H, - CHIP_TYPE_RDA5802N, - CHIP_TYPE_RDA5820, - CHIP_TYPE_RDA5820NS, -}; - - -typedef struct -{ - uint8_t address; - uint16_t value; -}RDA_FM_REG_T; - -typedef struct -{ - bool byPowerUp; - struct fm_tune_parm parm -}FM_TUNE_T; -static FM_TUNE_T fm_tune_data = {false, {}}; - -typedef enum -{ - FM_RECEIVER, //5800,5802,5804 - FM_TRANSMITTER, //5820 -}RDA_RADIO_WORK_E; - -typedef enum -{ - OFF, - ON, -}RDA_FM_POWER_STATE_T; - -struct fm { - uint32_t ref; - bool powerup; - uint16_t chip_id; - // uint16_t device_id; - uint8_t chipAddr; - dev_t dev_t; - uint16_t min_freq; // KHz - uint16_t max_freq; // KHz - uint8_t band; // TODO - struct class *cls; - struct device *dev; - struct cdev cdev; - // struct i2c_client *i2c_client; -}; - - - - -/****************************************************************************** - * FUNCTION PROTOTYPES - *****************************************************************************/ - - -static int RDAFM_clear_hmute(uint8_t chipAddr); -static int RDAFM_enable_hmute(uint8_t chipAddr); -static bool RDAFM_Scan(uint8_t chipAddr, - uint16_t min_freq, uint16_t max_freq, - uint16_t *pFreq, //get the valid freq after scan - uint16_t *pScanTBL, - uint16_t *ScanTBLsize, - uint16_t scandir, - uint16_t space); - - -static int RDAFM_read(uint8_t chipAddr, uint8_t addr, uint16_t *val); -static int RDAFM_write(uint8_t chipAddr, uint8_t addr, uint16_t val); -static int fm_setup_cdev(struct fm *fm); -static int fm_ops_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); -static loff_t fm_ops_lseek(struct file *filp, loff_t off, int whence); -static int fm_ops_open(struct inode *inode, struct file *filp); -static int fm_ops_release(struct inode *inode, struct file *filp); - -static int fm_init(void); -static int fm_destroy(struct fm *fm); -static int fm_powerup(struct fm *fm, struct fm_tune_parm *parm); -static int fm_powerdown(struct fm *fm); - -static int fm_tune(struct fm *fm, struct fm_tune_parm *parm); -static int fm_seek(struct fm *fm, struct fm_seek_parm *parm); -static int fm_scan(struct fm *fm, struct fm_scan_parm *parm); -static int fm_setvol(struct fm *fm, uint32_t vol); -static int fm_getvol(struct fm *fm, uint32_t *vol); -static int fm_getrssi(struct fm *fm, uint32_t *rssi); -static int fm_proc_read(char *page, char **start, off_t off, int count, int *eof, void *data); - - - - - - -static uint16_t RDAFM_CHIP_ID = 0x5808; -static RDA_RADIO_WORK_E RDA_RADIO_WorkType = FM_RECEIVER; - - - -#if 1 -static uint16_t RDA5802N_initialization_reg[]={ - 0xC005, //02h - 0x0000, - 0x0400, - 0xC6ED, //0x86AD, //05h - 0x6000, - 0x721A, //0x42C6 - 0x0000, - 0x0000, - 0x0000, //0x0ah - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, //0x10h - 0x0019, - 0x2A11, - 0xB042, - 0x2A11, - 0xB831, //0x15h - 0xC000, - 0x2A91, - 0x9400, - 0x00A8, - 0xc400, //0x1ah - 0xF7CF, //Ìá¸ßÔ¶¶ËÔëÉùÒÖÖÆ - 0x2414, //0x2ADC, //0x1ch ÌáÉýVIO VDDÖ®¼äѹ²îÒýÆðµÄ²»Á¼ - 0x806F, - 0x4608, - 0x0086, - 0x0661, //0x20H - 0x0000, - 0x109E, - 0x23C8, - 0x0406, - 0x0E1C, //0x25H -}; -#else -static uint16_t RDA5802N_initialization_reg[]={ - 0xc401, //02h - 0x0000, - 0x0400, - 0x86ad, //05h// - 0x0000, - 0x42c6, - 0x0000, - 0x0000, - 0x0000, //0x0ah - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, - 0x0000, //0x10h - 0x0019, - 0x2a11, - 0xa053,//0x80,0x53, - 0x3e11,//0x22,0x11, - 0xfc7d, //0x15h - 0xc000, - 0x2a91, - 0x9400, - 0x00a8, - 0xc400, //0x1ah - 0xe000, - 0x2b1d, //0x23,0x14 - 0x816a, - 0x4608, - 0x0086, - 0x0661, //0x20h - 0x0000, - 0x109e, - 0x2244, - 0x0408, //0x24 - 0x0408, //0x25 -}; -#endif - -static RDA_FM_REG_T RDA5820NS_TX_initialization_reg[]={ - {0x02, 0xE003}, - {0xFF, 100}, // if address is 0xFF, sleep value ms - {0x02, 0xE001}, - {0x19, 0x88A8}, - {0x1A, 0x4290}, - {0x68, 0x0AF0}, - {0x40, 0x0001}, - {0x41, 0x41FF}, - {0xFF, 500}, - {0x03, 0x1B90}, -}; - -static RDA_FM_REG_T RDA5820NS_RX_initialization_reg[]={ - {0x02, 0x0002}, //Soft reset - {0xFF, 100}, // wait - {0x02, 0xC001}, //Power Up - {0x05, 0x888F}, //LNAP 0x884F --LNAN - {0x06, 0x6000}, - {0x13, 0x80E1}, - {0x14, 0x2A11}, - {0x1C, 0x22DE}, - {0x21, 0x0020}, - {0x03, 0x1B90}, -}; - - - -static struct file_operations fm_ops = { - .owner = THIS_MODULE, - .unlocked_ioctl = fm_ops_ioctl, - .llseek = fm_ops_lseek, - .open = fm_ops_open, - .release = fm_ops_release, -}; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) -static DECLARE_MUTEX(fm_ops_mutex); -#else -DEFINE_SEMAPHORE(fm_ops_mutex); -#endif - -static int RDAFM_GetChipID(uint8_t chipAddr, uint16_t *pChipID) -{ - int err; - int ret = -1; - uint16_t val = 0x0002; - - //Reset RDA FM - err = RDAFM_write(chipAddr, 0x02, val); - if(err < 0){ -#ifdef FMDEBUG - FM_DEBUG("RDAFM_GetChipID: reset FM chip failed!\n"); -#endif - ret = -1; - return ret; - } - msleep(80); - - val = 0; - err = RDAFM_read(chipAddr, 0x0C, &val); - if (err == 0) - { - if ((0x5802 == val) || (0x5803 == val)) - { - err = RDAFM_read(chipAddr, 0x0E, &val); - - if (err == 0) - *pChipID = val; - else - *pChipID = 0x5802; - -#ifdef FMDEBUG - FM_DEBUG("RDAFM_GetChipID: Chip ID = %04X\n", val); -#endif - - ret = 0; - - } - else if ((0x5805 == val) || (0x5820 == val)) - { - *pChipID = val; - ret = 0; - } - else - { -#ifdef FMDEBUG - FM_DEBUG("RDAFM_GetChipID: get chip ID failed! get value = %04X\n", val); -#endif - ret = -1; - } - - } - else - { -#ifdef FMDEBUG - FM_DEBUG("RDAFM_GetChipID: get chip ID failed!\n"); -#endif - ret = -1; - } - - return ret; -} - - -/* - * RDAFM_read - */ -static int RDAFM_read(uint8_t chipAddr, uint8_t regAddr, uint16_t *val) -{ - int ret = -1; - ret = rda_gpio_i2c_read_1_addr_2_data(chipAddr, regAddr, val); - - return ret; -} - -/* - * RDAFM_write - */ -static int RDAFM_write(uint8_t chipAddr, uint8_t regAddr, uint16_t val) -{ - int n; - - n = rda_gpio_i2c_write_1_addr_2_data(chipAddr, regAddr, val); - if (n < 0) - { - FM_ALERT("RDAFM_write send:0x%X err:%d\n", regAddr, n); - return -1; - } - - return 0; -} - - -static int RDAFM_clear_hmute(uint8_t chipAddr) -{ - int ret = 0; - uint16_t tRegValue = 0; - - FM_DEBUG("RDAFM_clear_hmute\n"); - - ret = RDAFM_read(chipAddr, 0x02, &tRegValue); - if (ret < 0) - { - FM_ALERT("RDAFM_clear_hmute read register failed!\n"); - return -1; - } - - tRegValue |= (1 << 14); - - ret = RDAFM_write(chipAddr, 0x02, tRegValue); - - if (ret < 0) - { - FM_ALERT("RDAFM_clear_hmute write register failed!\n"); - return -1; - } - - if(fm_tune_data.byPowerUp){ - if (fm_tune(g_fm_struct, &(fm_tune_data.parm)) < 0) - { - fm_tune_data.byPowerUp = false; - memset(&fm_tune_data.parm, 0, sizeof(fm_tune_data.parm)); - return -EPERM; - } - fm_tune_data.byPowerUp = false; - memset(&fm_tune_data.parm, 0, sizeof(fm_tune_data.parm)); - } - - return 0; -} - - - -static int RDAFM_enable_hmute(uint8_t chipAddr) -{ - int ret = 0; - uint16_t tRegValue = 0; - - FM_DEBUG("RDAFM_enable_hmute\n"); - - ret = RDAFM_read(chipAddr, 0x02, &tRegValue); - if (ret < 0) - { - FM_ALERT("RDAFM_enable_hmute read register failed!\n"); - return -1; - } - - tRegValue &= (~(1 << 14)); - - ret = RDAFM_write(chipAddr, 0x02, tRegValue); - - if (ret < 0) - { - FM_ALERT("RDAFM_enable_hmute write register failed!\n"); - return -1; - } - - return 0; -} - - -static bool RDAFM_Scan(uint8_t chipAddr, - uint16_t min_freq, uint16_t max_freq, - uint16_t *pFreq, - uint16_t *pScanTBL, - uint16_t *ScanTBLsize, - uint16_t scandir, - uint16_t space) -{ - uint16_t tFreq, tRegValue = 0; - uint16_t tmp_scanTBLsize = *ScanTBLsize; - int ret = -1; - bool isTrueStation = false; - uint16_t oldValue = 0; - int channel = 0; - - if((!pScanTBL) || (tmp_scanTBLsize == 0)) { - return false; - } - - //clear the old value of pScanTBL - memset(pScanTBL, 0, sizeof(uint16_t)*RDA599X_SCANTBL_SIZE); - - if(tmp_scanTBLsize > RDA599X_SCANTBL_SIZE) - { - tmp_scanTBLsize = RDA599X_SCANTBL_SIZE; - } - - //scan up - if(scandir == RDA599X_FM_SCAN_UP){ // now, only support scan up - tFreq = min_freq; - }else{ //scan down - tFreq = max_freq;//max_freq compare need or not - } - - //mute FM - RDAFM_enable_hmute(chipAddr); - - //set seekth - tRegValue = 0; - RDAFM_read(chipAddr, 0x05, &tRegValue); - tRegValue &= (~(0x7f<<8)); - tRegValue |= ((0x8 & 0x7f) << 8); - RDAFM_write(chipAddr, 0x05, tRegValue); - msleep(50); - - atomic_set(&scan_complete_flag, 1); - - do { - if(atomic_read(&scan_complete_flag) == 0) - break; - isTrueStation = false; - - //set channel and enable TUNE - tRegValue = 0; - RDAFM_read(chipAddr, 0x03, &tRegValue); - tRegValue &= (~(0x03ff<<6)); //clear bit[15:6] - channel = tFreq - min_freq; - tRegValue |= ((channel << 6) | (1 << 4)); //set bit[15:6] and bit[4] - ret = RDAFM_write(chipAddr, 0x03, tRegValue); - msleep(40); - - //read 0x0B and check FM_TRUE(bit[8]) - tRegValue = 0; - ret = RDAFM_read(chipAddr, 0x0B, &tRegValue); - if(!ret){ - if((tRegValue & 0x0100) == 0x0100){ - isTrueStation = true; - } - } - - //if this freq is a true station, read the channel - if(isTrueStation){ - //tRegValue = 0; - //RDAFM_read(chipAddr, 0x0A, &tRegValue); - //channel = ((tRegValue) & 0x03ff) - 5; - channel = channel - 5; - if((channel >= 0) && (channel != 85)){ - oldValue = *(pScanTBL+(channel/16)); - oldValue |= (1<<(channel%16)); - *(pScanTBL+(channel/16)) = oldValue; - } - } - - //increase freq - tFreq += space; - }while( tFreq <= max_freq ); - -#if defined(MTK_MT6515) && defined(MT6626) - *(pScanTBL+13) = 0xb2d4; - *(pScanTBL+14) = 0xb2d4; - *(pScanTBL+15) = 0xb2d4; -#endif - - *ScanTBLsize = tmp_scanTBLsize; - *pFreq = 0; - - //clear FM mute - RDAFM_clear_hmute(chipAddr); - - return true; -} - - -static int fm_setup_cdev(struct fm *fm) -{ - int err; - - err = alloc_chrdev_region(&fm->dev_t, 0, 1, FM_NAME); - if (err) { - FM_ALERT("alloc dev_t failed\n"); - return -1; - } - - FM_ALERT("alloc %s:%d:%d\n", FM_NAME, - MAJOR(fm->dev_t), MINOR(fm->dev_t)); - - cdev_init(&fm->cdev, &fm_ops); - - fm->cdev.owner = THIS_MODULE; - fm->cdev.ops = &fm_ops; - - err = cdev_add(&fm->cdev, fm->dev_t, 1); - if (err) { - FM_ALERT("alloc dev_t failed\n"); - return -1; - } - - fm->cls = class_create(THIS_MODULE, FM_NAME); - if (IS_ERR(fm->cls)) { - err = PTR_ERR(fm->cls); - FM_ALERT("class_create err:%d\n", err); - return err; - } - fm->dev = device_create(fm->cls, NULL, fm->dev_t, NULL, FM_NAME); - - return 0; -} - - - -static int fm_ops_ioctl(struct file *filp, - unsigned int cmd, unsigned long arg) -{ - int ret = 0; - struct fm *fm = container_of(filp->f_dentry->d_inode->i_cdev, struct fm, cdev); - - FM_DEBUG("%s cmd(%x)\n", __func__, cmd); - - switch(cmd) - { - case FM_IOCTL_POWERUP: - { - struct fm_tune_parm parm; - FM_DEBUG("FM_IOCTL_POWERUP\n"); - - if (copy_from_user(&parm, (void*)arg, sizeof(struct fm_tune_parm))) - return -EFAULT; - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - ret = fm_powerup(fm, &parm); - up(&fm_ops_mutex); - if (copy_to_user((void*)arg, &parm, sizeof(struct fm_tune_parm))) - return -EFAULT; - break; - } - - case FM_IOCTL_POWERDOWN: - { - FM_DEBUG("FM_IOCTL_POWERDOWN\n"); - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - ret = fm_powerdown(fm); - up(&fm_ops_mutex); - break; - } - - // tune (frequency, auto Hi/Lo ON/OFF ) - case FM_IOCTL_TUNE: - { - struct fm_tune_parm parm; - FM_DEBUG("FM_IOCTL_TUNE\n"); - - if (copy_from_user(&parm, (void*)arg, sizeof(struct fm_tune_parm))) - return -EFAULT; - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - ret = fm_tune(fm, &parm); - up(&fm_ops_mutex); - - if (copy_to_user((void*)arg, &parm, sizeof(struct fm_tune_parm))) - return -EFAULT; - - break; - } - - case FM_IOCTL_SEEK: - { - struct fm_seek_parm parm; - FM_DEBUG("FM_IOCTL_SEEK\n"); - - if (copy_from_user(&parm, (void*)arg, sizeof(struct fm_seek_parm))) - return -EFAULT; - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - ret = fm_seek(fm, &parm); - up(&fm_ops_mutex); - - if (copy_to_user((void*)arg, &parm, sizeof(struct fm_seek_parm))) - return -EFAULT; - - break; - } - - case FM_IOCTL_SETVOL: - { - uint32_t vol; - FM_DEBUG("FM_IOCTL_SETVOL\n"); - - if(copy_from_user(&vol, (void*)arg, sizeof(uint32_t))) { - FM_ALERT("copy_from_user failed\n"); - return -EFAULT; - } - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - ret = fm_setvol(fm, vol); - up(&fm_ops_mutex); - - break; - } - - case FM_IOCTL_GETVOL: - { - uint32_t vol; - FM_DEBUG("FM_IOCTL_GETVOL\n"); - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - ret = fm_getvol(fm, &vol); - up(&fm_ops_mutex); - - if (copy_to_user((void*)arg, &vol, sizeof(uint32_t))) - return -EFAULT; - - break; - } - - case FM_IOCTL_MUTE: - { - uint32_t bmute; - FM_DEBUG("FM_IOCTL_MUTE\n"); - - if (copy_from_user(&bmute, (void*)arg, sizeof(uint32_t))) - { - FM_DEBUG("copy_from_user mute failed!\n"); - return -EFAULT; - } - - FM_DEBUG("FM_IOCTL_MUTE:%d\n", bmute); - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - - if (bmute){ - ret = RDAFM_enable_hmute(fm->chipAddr); - }else{ - ret = RDAFM_clear_hmute(fm->chipAddr); - } - - up(&fm_ops_mutex); - - break; - } - - case FM_IOCTL_GETRSSI: - { - uint32_t rssi; - FM_DEBUG("FM_IOCTL_GETRSSI\n"); - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - - ret = fm_getrssi(fm, &rssi); - up(&fm_ops_mutex); - - if (copy_to_user((void*)arg, &rssi, sizeof(uint32_t))) - return -EFAULT; - - break; - } - - case FM_IOCTL_RW_REG: - { - struct fm_ctl_parm parm_ctl; - FM_DEBUG("FM_IOCTL_RW_REG\n"); - - if (copy_from_user(&parm_ctl, (void*)arg, sizeof(struct fm_ctl_parm))) - return -EFAULT; - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - - if(parm_ctl.rw_flag == 0) //write - { - ret = RDAFM_write(fm->chipAddr, parm_ctl.addr, parm_ctl.val); - } - else - { - ret = RDAFM_read(fm->chipAddr, parm_ctl.addr, &parm_ctl.val); - } - - up(&fm_ops_mutex); - if ((parm_ctl.rw_flag == 0x01) && (!ret)) // Read success. - { - if (copy_to_user((void*)arg, &parm_ctl, sizeof(struct fm_ctl_parm))) - return -EFAULT; - } - break; - } - - case FM_IOCTL_GETCHIPID: - { - uint16_t chipid; - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - - RDAFM_GetChipID(fm->chipAddr, &chipid); - //chipid = fm->chip_id; - chipid = 0x6620; - FM_DEBUG("FM_IOCTL_GETCHIPID:%04x\n", chipid); - up(&fm_ops_mutex); - - if (copy_to_user((void*)arg, &chipid, sizeof(uint16_t))) - return -EFAULT; - - break; - } - - case FM_IOCTL_IS_FM_POWERED_UP: - { - uint32_t powerup; - FM_DEBUG("FM_IOCTL_IS_FM_POWERED_UP"); - if (fm->powerup) { - powerup = 1; - } else { - powerup = 0; - } - if (copy_to_user((void*)arg, &powerup, sizeof(uint32_t))) - return -EFAULT; - break; - } - -#ifdef FMDEBUG - case FM_IOCTL_DUMP_REG: - { - uint16_t chipid = 0; - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - RDAFM_GetChipID(fm->chipAddr, &chipid); - up(&fm_ops_mutex); - - break; - } -#endif - - case FM_IOCTL_SCAN: - { - struct fm_scan_parm parm; - FM_DEBUG("FM_IOCTL_SCAN\n"); - if (false == fm->powerup){ - return -EFAULT; - } - if(copy_from_user(&parm, (void*)arg, sizeof(struct fm_scan_parm))){ - return -EFAULT; - } - if (down_interruptible(&fm_ops_mutex)){ - return -EFAULT; - } - fm_scan(fm, &parm); - up(&fm_ops_mutex); - - if(copy_to_user((void*)arg, &parm, sizeof(struct fm_scan_parm))){ - return -EFAULT; - } - - break; - } - - case FM_IOCTL_STOP_SCAN: - { - FM_DEBUG("FM_IOCTL_STOP_SCAN\n"); - break; - } - - case FM_IOCTL_SCAN_GETRSSI: - { - FM_DEBUG("FM_IOCTL_SCAN_GETRSSI\n"); - break; - } - - case FM_IOCTL_GETMONOSTERO: - { - FM_DEBUG("FM_IOCTL_GETMONOSTERO\n"); - break; - } - - case FM_IOCTL_SETMONOSTERO: - { - FM_DEBUG("FM_IOCTL_SETMONOSTERO\n"); - break; - } - - case FM_IOCTL_GETCURPAMD: - { - FM_DEBUG("FM_IOCTL_GETCURPAMD\n"); - break; - } - - case FM_IOCTL_EM_TEST: - { - FM_DEBUG("FM_IOCTL_EM_TEST\n"); - break; - } - - case FM_IOCTL_RDS_SUPPORT: - { - FM_DEBUG("FM_IOCTL_RDS_SUPPORT\n"); - break; - } - - case FM_IOCTL_RDS_ONOFF: - { - FM_DEBUG("FM_IOCTL_RDS_ONOFF\n"); - break; - } - - case FM_IOCTL_GETGOODBCNT: - { - FM_DEBUG("FM_IOCTL_GETGOODBCNT\n"); - break; - } - - case FM_IOCTL_GETBADBNT: - { - FM_DEBUG("FM_IOCTL_GETBADBNT\n"); - break; - } - - case FM_IOCTL_GETBLERRATIO: - { - FM_DEBUG("FM_IOCTL_GETBLERRATIO\n"); - break; - } - - case FM_IOCTL_POWERUP_TX: - { - FM_DEBUG("FM_IOCTL_POWERUP_TX\n"); - break; - } - - case FM_IOCTL_TUNE_TX: - { - FM_DEBUG("FM_IOCTL_TUNE_TX\n"); - break; - } - - case FM_IOCTL_TX_SUPPORT: - { - FM_DEBUG("FM_IOCTL_TX_SUPPORT\n"); - break; - } - - case FM_IOCTL_RDSTX_ENABLE: - { - FM_DEBUG("FM_IOCTL_RDSTX_ENABLE\n"); - break; - } - - case FM_IOCTL_RDSTX_SUPPORT: - { - FM_DEBUG("FM_IOCTL_RDSTX_SUPPORT\n"); - break; - } - - case FM_IOCTL_TX_SCAN: - { - FM_DEBUG("FM_IOCTL_TX_SCAN\n"); - break; - } - - case FM_IOCTL_RDS_TX: - { - FM_DEBUG("FM_IOCTL_RDS_TX\n"); - break; - } - - case FM_IOCTL_OVER_BT_ENABLE: - { - FM_DEBUG("FM_IOCTL_OVER_BT_ENABLE\n"); - break; - } - - case FM_IOCTL_ANA_SWITCH: - { - FM_DEBUG("FM_IOCTL_ANA_SWITCH\n"); - break; - } - - case FM_IOCTL_GETCAPARRAY: - { - FM_DEBUG("FM_IOCTL_GETCAPARRAY\n"); - break; - } - - case FM_IOCTL_GPS_RTC_DRIFT: - { - FM_DEBUG("FM_IOCTL_GPS_RTC_DRIFT\n"); - break; - } - - case FM_IOCTL_I2S_SETTING: - { - FM_DEBUG("FM_IOCTL_I2S_SETTING\n"); - break; - } - - case FM_IOCTL_RDS_GROUPCNT: - { - FM_DEBUG("FM_IOCTL_RDS_GROUPCNT\n"); - break; - } - - case FM_IOCTL_RDS_GET_LOG: - { - FM_DEBUG("FM_IOCTL_RDS_GET_LOG\n"); - break; - } - - case FM_IOCTL_GET_HW_INFO: - { - FM_DEBUG("FM_IOCTL_GET_HW_INFO\n"); - break; - } - default: - { - FM_DEBUG("default\n"); - break; - } - } - - return ret; -} -static loff_t fm_ops_lseek(struct file *filp, loff_t off, int whence) -{ -// struct fm *fm = filp->private_data; - - if(whence == SEEK_END){ - //fm_hwscan_stop(fm); - atomic_set(&scan_complete_flag, 0); - }else if(whence == SEEK_SET){ - //FM_EVENT_SEND(fm->rds_event, FM_RDS_DATA_READY); - } - return off; -} - -static int fm_ops_open(struct inode *inode, struct file *filp) -{ - struct fm *fm = container_of(inode->i_cdev, struct fm, cdev); - - FM_DEBUG("%s\n", __func__); - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - - // TODO: only have to set in the first time? - // YES!!!! - - fm->ref++; - - up(&fm_ops_mutex); - - filp->private_data = fm; - - // TODO: check open flags - - return 0; -} - -static int fm_ops_release(struct inode *inode, struct file *filp) -{ - int err = 0; - struct fm *fm = container_of(inode->i_cdev, struct fm, cdev); - - FM_DEBUG("%s\n", __func__); - - if (down_interruptible(&fm_ops_mutex)) - return -EFAULT; - fm->ref--; - if(fm->ref < 1) { - if(fm->powerup == true) { - fm_powerdown(fm); - } - } - - up(&fm_ops_mutex); - - return err; -} - -static int fm_init(void) -{ - int err; - struct fm *fm = NULL; - int ret = -1; - - - FM_DEBUG("%s()\n", __func__); - if (!(fm = kzalloc(sizeof(struct fm), GFP_KERNEL))) - { - FM_ALERT("-ENOMEM\n"); - err = -ENOMEM; - goto ERR_EXIT; - } - - fm->ref = 0; - fm->powerup = false; - fm->chipAddr = RDAFM_SLAVE_ADDR; - atomic_set(&scan_complete_flag, 0); - - // First, read 5802NM chip ID - FM_DEBUG("%s()First, read 5802NM chip ID\n", __func__); - ret = RDAFM_GetChipID(fm->chipAddr, &RDAFM_CHIP_ID); - FM_DEBUG("%s() 5802NM chip ID = 0x%04x\n", __func__, RDAFM_CHIP_ID); - // if failed, means use FM in 5990P_E - if(ret < 0){ - // enable the FM chip in combo - FM_DEBUG("%s() enable the FM chip in combo\n", __func__); - ret = rda_fm_power_on(); - if(ret < 0){ - err = -ENOMEM; - goto ERR_EXIT; - } - msleep(100); - ret = RDAFM_GetChipID(fm->chipAddr, &RDAFM_CHIP_ID); - FM_DEBUG("%s() the FM in combo chip ID = 0x%04x\n", __func__, RDAFM_CHIP_ID); - if(ret < 0){ - err = -ENOMEM; - goto ERR_EXIT; - }else{ - fm->chip_id = RDAFM_CHIP_ID; - } - - // disable the FM chip for power saving - ret = rda_fm_power_off(); - if(ret < 0){ - err = -ENOMEM; - goto ERR_EXIT; - } - }else{ - fm->chip_id = RDAFM_CHIP_ID; - } - - - - if ((err = fm_setup_cdev(fm))) - { - goto ERR_EXIT; - } - - g_fm_struct = fm; - - /***********Add porc file system*************/ - - g_fm_proc = create_proc_entry(FM_PROC_FILE, 0444, NULL); - if (g_fm_proc == NULL) { - FM_ALERT("create_proc_entry failed\n"); - err = -ENOMEM; - goto ERR_EXIT; - } else { - g_fm_proc->read_proc = fm_proc_read; - g_fm_proc->write_proc = NULL; - //g_fm_proc->owner = THIS_MODULE; - FM_ALERT("create_proc_entry success\n"); - } - - /********************************************/ - - FM_DEBUG("fm_init is ok!\n"); - - return 0; - -ERR_EXIT: - kfree(fm); - - return err; -} - -static int fm_proc_read(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int cnt= 0; - struct fm *fm = g_fm_struct; - FM_ALERT("Enter fm_proc_read.\n"); - if(off != 0) - return 0; - if (fm != NULL && fm->powerup) { - cnt = sprintf(page, "1\n"); - } else { - cnt = sprintf(page, "0\n"); - } - *eof = 1; - FM_ALERT("Leave fm_proc_read. cnt = %d\n", cnt); - return cnt; -} - - -static int fm_destroy(struct fm *fm) -{ - int err = 0; - - FM_DEBUG("%s\n", __func__); - - device_destroy(fm->cls, fm->dev_t); - class_destroy(fm->cls); - - cdev_del(&fm->cdev); - unregister_chrdev_region(fm->dev_t, 1); - - fm_powerdown(fm); - - /***********************************/ - remove_proc_entry(FM_PROC_FILE, NULL); - - /**********************************/ - - // FIXME: any other hardware configuration ? - - // free all memory - kfree(fm); - - return err; -} - -/* - * fm_powerup - */ -static int fm_powerup(struct fm *fm, struct fm_tune_parm *parm) -{ - int i; - uint16_t tRegValue = 0x0002; - int ret = -1; - - - if (fm->powerup) - { - parm->err = FM_BADSTATUS; - return -EPERM; - } - - // if chip_id is ID_RDA5820NS, enable the FM chip in combo - if(fm->chip_id == ID_RDA5820NS){ - ret = rda_fm_power_on(); - if(ret < 0){ - return -EPERM; - } - msleep(100); - } - - - //Reset RDA FM - tRegValue = 0x0002; - RDAFM_write(fm->chipAddr, 0x02, tRegValue); - msleep(100); - - - - if (ID_RDA5802N == RDAFM_CHIP_ID){ - for (i=0; i<((sizeof(RDA5802N_initialization_reg)) / (sizeof(uint16_t))); i++) - { - ret = RDAFM_write(fm->chipAddr, i+2, RDA5802N_initialization_reg[i]); - - if (ret < 0) - { - FM_DEBUG("fm_powerup init failed!\n"); - - parm->err = FM_FAILED; - - return -EPERM; - } - } - - }else if (ID_RDA5820NS == RDAFM_CHIP_ID){ - if(RDA_RADIO_WorkType == FM_RECEIVER){ - for (i = 0; i < ((sizeof(RDA5820NS_RX_initialization_reg)) / (sizeof(RDA_FM_REG_T))); i++) - { - if(RDA5820NS_RX_initialization_reg[i].address == 0xFF){ - msleep(RDA5820NS_RX_initialization_reg[i].value); - }else{ - ret = RDAFM_write(fm->chipAddr, RDA5820NS_RX_initialization_reg[i].address, RDA5820NS_RX_initialization_reg[i].value); - if (ret < 0) - { - FM_DEBUG("fm_powerup init failed!\n"); - parm->err = FM_FAILED; - return -EPERM; - } - } - } - }else{ - for (i = 0; i < ((sizeof(RDA5820NS_TX_initialization_reg)) / (sizeof(RDA_FM_REG_T))); i++) - { - if(RDA5820NS_TX_initialization_reg[i].address == 0xFF){ - msleep(RDA5820NS_TX_initialization_reg[i].value); - }else{ - ret = RDAFM_write(fm->chipAddr, RDA5820NS_TX_initialization_reg[i].address, RDA5820NS_TX_initialization_reg[i].value); - if (ret < 0) - { - FM_DEBUG("fm_powerup init failed!\n"); - parm->err = FM_FAILED; - return -EPERM; - } - } - } - } - - } - - - FM_DEBUG("pwron ok\n"); - fm->powerup = true; - - if (fm_tune(fm, parm) < 0) - { - return -EPERM; - } - fm_tune_data.byPowerUp = true; - memcpy(&fm_tune_data.parm, parm, sizeof(fm_tune_data.parm)); - - parm->err = FM_SUCCESS; - - return 0; - -} - -/* - * fm_powerdown - */ -static int fm_powerdown(struct fm *fm) -{ - uint16_t tRegValue = 0; - int ret = -1; - - RDAFM_read(fm->chipAddr, 0x02, &tRegValue); - tRegValue &= (~(1 << 0)); - RDAFM_write(fm->chipAddr, 0x02, tRegValue); - - if(fm->chip_id == ID_RDA5820NS){ - ret = rda_fm_power_off(); - if(ret < 0){ - return -EPERM; - } - } - - fm->powerup = false; - FM_ALERT("pwrdown ok\n"); - - return 0; -} - -/* - * fm_seek - */ -static int fm_seek(struct fm *fm, struct fm_seek_parm *parm) -{ - int ret = 0; - uint16_t val = 0; - uint8_t spaec = 1; - uint16_t tFreq = 875; - uint16_t tRegValue = 0; - uint16_t bottomOfBand = 875; - int falseStation = -1; - - - if (!fm->powerup) - { - parm->err = FM_BADSTATUS; - return -EPERM; - } - - if (parm->space == FM_SPACE_100K) - { - spaec = 1; - val &= (~((1<<0) | (1<<1))); - } - else if (parm->space == FM_SPACE_200K) - { - spaec = 2; - val &= (~(1<<1)); - val |= (1<<0); - } - else - { - parm->err = FM_EPARM; - return -EPERM; - } - - if (parm->band == FM_BAND_UE) - { - val &= (~((1<<2) | (1<<3))); - bottomOfBand = 875; - fm->min_freq = 875; - fm->max_freq = 1080; - } - else if (parm->band == FM_BAND_JAPAN) - { - val &= (~(1<<3)); - val |= (1 << 2); - bottomOfBand = 760; - fm->min_freq = 760; - fm->max_freq = 910; - } - else if (parm->band == FM_BAND_JAPANW) { - val &= (~(1<<2)); - val |= (1 << 3); - bottomOfBand = 760; - fm->min_freq = 760; - fm->max_freq = 1080; - } - else - { - FM_ALERT("band:%d out of range\n", parm->band); - parm->err = FM_EPARM; - return -EPERM; - } - - if (parm->freq < fm->min_freq || parm->freq > fm->max_freq) { - FM_ALERT("freq:%d out of range\n", parm->freq); - parm->err = FM_EPARM; - return -EPERM; - } - - if (parm->seekth > 0x0B) { - FM_ALERT("seekth:%d out of range\n", parm->seekth); - parm->err = FM_EPARM; - return -EPERM; - } - - RDAFM_read(fm->chipAddr, 0x05, &tRegValue); - tRegValue &= (~(0x7f<<8)); - //tRegValue |= ((parm->seekth & 0x7f) << 8); - tRegValue |= ((0x8 & 0x7f) << 8); - RDAFM_write(fm->chipAddr, 0x05, tRegValue); - - -#ifdef FMDEBUG - if (parm->seekdir == FM_SEEK_UP) - FM_DEBUG("seek %d up\n", parm->freq); - else - FM_DEBUG("seek %d down\n", parm->freq); -#endif - - // (1) set hmute bit - RDAFM_enable_hmute(fm->chipAddr); - - tFreq = parm->freq; - - do { - - if (parm->seekdir == FM_SEEK_UP) - tFreq += spaec; - else - tFreq -= spaec; - - if (tFreq > fm->max_freq) - tFreq = fm->min_freq; - if (tFreq < fm->min_freq) - tFreq = fm->max_freq; - - val = (((tFreq - bottomOfBand+5) << 6) | (1 << 4) | (val & 0x0f)); - RDAFM_write(fm->chipAddr, 0x03, val); - msleep(40); - ret = RDAFM_read(fm->chipAddr, 0x0B, &tRegValue); - if (ret < 0) - { - FM_DEBUG("fm_seek: read register failed tunning freq = %4X\n", tFreq); - falseStation = -1; - } - else - { - if ((tRegValue & 0x0100) == 0x0100) - falseStation = 0; - else - falseStation = -1; - } - - if(falseStation == 0) - break; - - }while(tFreq != parm->freq); - - - //clear hmute - RDAFM_clear_hmute(fm->chipAddr); - - if (falseStation == 0) // seek successfully - { - parm->freq = tFreq; - FM_ALERT("fm_seek success, freq:%d\n", parm->freq); - parm->err = FM_SUCCESS; - - } - else - { - FM_ALERT("fm_seek failed, invalid freq\n"); - parm->err = FM_SEEK_FAILED; - ret = -1; - } - - return ret; -} - -/* - * fm_scan - */ -static int fm_scan(struct fm *fm, struct fm_scan_parm *parm) -{ - int ret = 0; - uint16_t tRegValue = 0; - uint16_t scandir = RDA599X_FM_SCAN_UP; //scandir ËÑË÷·½Ïò - uint8_t space = 1; - - if (!fm->powerup){ - parm->err = FM_BADSTATUS; - return -EPERM; - } - - RDAFM_read(fm->chipAddr, 0x03, &tRegValue); - - if (parm->space == FM_SPACE_100K){ - space = 1; - tRegValue &= (~((1<<0) | (1<<1))); //set 03H's bit[1:0] to 00 - }else if (parm->space == FM_SPACE_200K) { - space = 2; - tRegValue &= (~(1<<1)); //clear bit[1] - tRegValue |= (1<<0); //set bit[0] - }else{ - //default - space = 1; - tRegValue &= (~((1<<0) | (1<<1))); //set 03H's bit[1:0] to 00 - } - - if(parm->band == FM_BAND_UE){ - tRegValue &= (~((1<<2) | (1<<3))); - fm->min_freq = 875; - fm->max_freq = 1080; - }else if(parm->band == FM_BAND_JAPAN){ - tRegValue &= (~(1<<3)); - tRegValue |= (1 << 2); - fm->min_freq = 760; - fm->max_freq = 900; - }else if(parm->band == FM_BAND_JAPANW){ - tRegValue &= (~(1<<2)); - tRegValue |= (1 << 3); - fm->min_freq = 760; - fm->max_freq = 1080; - }else{ - parm->err = FM_EPARM; - return -EPERM; - } - - //set space and band - RDAFM_write(fm->chipAddr, 0x03, tRegValue); - msleep(40); - - - if(RDAFM_Scan(fm->chipAddr, fm->min_freq, fm->max_freq, &(parm->freq), parm->ScanTBL, &(parm->ScanTBLSize), scandir, space)){ - parm->err = FM_SUCCESS; - }else{ - parm->err = FM_SEEK_FAILED; - } - - return ret; -} - - -static int fm_setvol(struct fm *fm, uint32_t vol) -{ - int ret = 0; - uint16_t tRegValue = 0; - - if (vol > 15) - vol = 15; - - FM_DEBUG("fm_setvol:%d\n", vol); - - ret = RDAFM_read(fm->chipAddr, 0x05, &tRegValue); - if (ret) - return -EPERM; - tRegValue &= ~(0x000f); - tRegValue |= vol; - - ret = RDAFM_write(fm->chipAddr, 0x05, tRegValue); - if (ret) - return -EPERM; - - return 0; -} - -static int fm_getvol(struct fm *fm, uint32_t *vol) -{ - int ret = 0; - uint16_t tRegValue; - - ret = RDAFM_read(fm->chipAddr, 0x05, &tRegValue); - if (ret) - return -EPERM; - - if (ret) - return -EPERM; - - *vol = (tRegValue & 0x000F); - - return 0; -} - -static int fm_getrssi(struct fm *fm, uint32_t *rssi) -{ - int ret = 0; - uint16_t tRegValue; - - ret = RDAFM_read(fm->chipAddr, 0x0B, &tRegValue); - if (ret) - return -EPERM; - - - *rssi = (uint32_t)((tRegValue >> 9) & RDAFM_MASK_RSSI); - - FM_DEBUG("rssi value:%d\n", *rssi); - - return 0; -} - -/* - * fm_tune - */ -static int fm_tune(struct fm *fm, struct fm_tune_parm *parm) -{ - int ret; - uint16_t val = 0; - uint8_t space = 1; - uint16_t bottomOfBand = 875; - - - FM_DEBUG("%s\n", __func__); - - if (!fm->powerup) - { - parm->err = FM_BADSTATUS; - return -EPERM; - } - - if (parm->space == FM_SPACE_100K) - { - space = 1; - val &= (~((1<<0) | (1<<1))); - } - else if (parm->space == FM_SPACE_200K) - { - space = 2; - val |= (1<<0); - val &= (~(1<<1)); - } - else - { - parm->err = FM_EPARM; - return -EPERM; - } - - if (parm->band == FM_BAND_UE) - { - val &= (~((1<<2) | (1<<3))); - bottomOfBand = 875; - fm->min_freq = 875; - fm->max_freq = 1080; - } - else if (parm->band == FM_BAND_JAPAN) - { - val &= (~(1<<3)); - val |= (1 << 2); - bottomOfBand = 760; - fm->min_freq = 760; - fm->max_freq = 910; - } - else if (parm->band == FM_BAND_JAPANW) { - val &= (~(1<<2)); - val |= (1 << 3); - bottomOfBand = 760; - fm->min_freq = 760; - fm->max_freq = 1080; - } - else - { - FM_ALERT("band:%d out of range\n", parm->band); - parm->err = FM_EPARM; - return -EPERM; - } - - if (parm->freq < fm->min_freq || parm->freq > fm->max_freq) { - FM_ALERT("freq:%d out of range\n", parm->freq); - parm->err = FM_EPARM; - return -EPERM; - } - - FM_DEBUG("fm_tune, freq:%d\n", parm->freq); - - - val = (((parm->freq - bottomOfBand + 5) << 6) | (1 << 4) | (val & 0x0f)); - - ret = RDAFM_write(fm->chipAddr, 0x03, val); - if (ret < 0) - { - FM_ALERT("fm_tune write freq failed\n"); - parm->err = FM_SEEK_FAILED; - return ret; - } - msleep(40); - - return ret; -} - - -static int mt_fm_probe(struct platform_device *pdev) -{ - int err = -1; - FM_DEBUG("mt_fm_probe\n"); - - if ((err = fm_init())) - { - FM_ALERT("fm_init ERR:%d\n", err); - } - - return err; -} - -static int mt_fm_remove(struct platform_device *pdev) -{ - FM_DEBUG("mt_fm_remove\n"); - - struct fm *fm = g_fm_struct; - if(fm) - { - fm_destroy(fm); - fm = NULL; - } - - return 0; -} - - -static struct platform_driver mt_fm_dev_drv = -{ - .probe = mt_fm_probe, - .remove = mt_fm_remove, - .driver = { - .name = FM_NAME, - .owner = THIS_MODULE, - } -}; - -#if defined(MTK_MT6515) -static struct platform_device mt_fm_device = { - .name = FM_NAME, - .id = -1, -}; -#endif - - -/* - * mt_fm_init - */ -static int __init mt_fm_init(void) -{ - int err = 0; - - FM_DEBUG("mt_fm_init\n"); -#if defined(MTK_MT6515) - err = platform_device_register(&mt_fm_device); - if(err){ - FM_DEBUG("platform_device_register fail\n"); - return err; - }else{ - FM_DEBUG("platform_device_register success\n"); - } -#endif - err = platform_driver_register(&mt_fm_dev_drv); - if (err) - { - FM_DEBUG("platform_driver_register failed\n"); - }else{ - FM_DEBUG("platform_driver_register success\n"); - } - - return err; -} - -/* - * mt_fm_exit - */ -static void __exit mt_fm_exit(void) -{ - FM_DEBUG("mt_fm_exit\n"); - platform_driver_unregister(&mt_fm_dev_drv); -#if defined(MTK_MT6515) - platform_device_unregister(&mt_fm_device); -#endif -} - -module_init(mt_fm_init); -module_exit(mt_fm_exit); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("MediaTek FM Driver"); -MODULE_AUTHOR("William Chung "); diff --git a/drivers/net/wireless/rda5990/rda_5990_power_ctrl/Makefile b/drivers/net/wireless/rda5990/rda_5990_power_ctrl/Makefile deleted file mode 100755 index ab2ac900edd6..000000000000 --- a/drivers/net/wireless/rda5990/rda_5990_power_ctrl/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -obj-y := rda_5990_power_ctrl.o -#for 模拟I2C -#obj-y := rda_5990_power_ctrl_by_gpio.o diff --git a/drivers/net/wireless/rda5990/rda_5990_power_ctrl/rda_5990_power_ctrl.c b/drivers/net/wireless/rda5990/rda_5990_power_ctrl/rda_5990_power_ctrl.c deleted file mode 100755 index 82e0c018e7ee..000000000000 --- a/drivers/net/wireless/rda5990/rda_5990_power_ctrl/rda_5990_power_ctrl.c +++ /dev/null @@ -1,1897 +0,0 @@ -/* ----------------------------------------------------------------------- * - * - This file created by albert RDA Inc - */ - -#include -#include -#include -#include -#include -#include /* get the user-level API */ -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define RDA5890_USE_CRYSTAL // if use share crystal should close this -#define RDA5990_USE_DCDC - -#define u32 unsigned int -#define u8 unsigned char -#define u16 unsigned short - -#define RDA_I2C_CHANNEL (0) -#define RDA_WIFI_CORE_ADDR (0x13 << 1) -#define RDA_WIFI_RF_ADDR (0x14 << 1) //correct add is 0x14 -#define RDA_BT_CORE_ADDR (0x15 << 1) -#define RDA_BT_RF_ADDR (0x16 << 1) - -#define I2C_MASTER_ACK (1<<0) -#define I2C_MASTER_RD (1<<4) -#define I2C_MASTER_STO (1<<8) -#define I2C_MASTER_WR (1<<12) -#define I2C_MASTER_STA (1<<16) - -#define RDA_WIFI_RF_I2C_DEVNAME "rda_wifi_rf_i2c" -#define RDA_WIFI_CORE_I2C_DEVNAME "rda_wifi_core_i2c" -#define RDA_BT_RF_I2C_DEVNAME "rda_bt_rf_i2c" -#define RDA_BT_CORE_I2C_DEVNAME "rda_bt_core_i2c" - -static struct mutex i2c_rw_lock; -//extern int -//i2c_register_board_info(int busnum, struct i2c_board_info const *info, -// unsigned n); - - -static unsigned short wlan_version = 0; -static struct wake_lock rda_5990_wake_lock; -static struct delayed_work rda_5990_sleep_worker; -static struct i2c_client * rda_wifi_core_client = NULL; -static struct i2c_client * rda_wifi_rf_client = NULL; -static struct i2c_client * rda_bt_core_client = NULL; -static struct i2c_client * rda_bt_rf_client = NULL; - -static const struct i2c_device_id wifi_rf_i2c_id[] = {{RDA_WIFI_RF_I2C_DEVNAME, 0}, {}}; -MODULE_DEVICE_TABLE(i2c, wifi_rf_i2c_id); - -static unsigned short wifi_rf_force[] = { RDA_I2C_CHANNEL, RDA_WIFI_RF_ADDR, I2C_CLIENT_END, I2C_CLIENT_END }; - -static struct i2c_board_info __initdata i2c_rda_wifi_rf={ I2C_BOARD_INFO(RDA_WIFI_RF_I2C_DEVNAME, (RDA_WIFI_RF_ADDR>>1))}; -static struct i2c_driver rda_wifi_rf_driver; - - - -static const struct i2c_device_id wifi_core_i2c_id[] = {{RDA_WIFI_CORE_I2C_DEVNAME, 0}, {}}; -MODULE_DEVICE_TABLE(i2c, wifi_core_i2c_id); - -static unsigned short wifi_core_force[] = { RDA_I2C_CHANNEL, RDA_WIFI_CORE_ADDR, I2C_CLIENT_END, I2C_CLIENT_END }; -static struct i2c_board_info __initdata i2c_rda_wifi_core={ I2C_BOARD_INFO(RDA_WIFI_CORE_I2C_DEVNAME, (RDA_WIFI_CORE_ADDR>>1))}; -static struct i2c_driver rda_wifi_core_driver; - - - -static const struct i2c_device_id bt_rf_i2c_id[] = {{RDA_BT_RF_I2C_DEVNAME, 0}, {}}; - -MODULE_DEVICE_TABLE(i2c, bt_rf_i2c_id); - -static unsigned short bt_rf_force[] = { RDA_I2C_CHANNEL, RDA_BT_RF_ADDR, I2C_CLIENT_END, I2C_CLIENT_END }; -static struct i2c_board_info __initdata i2c_rda_bt_rf={ I2C_BOARD_INFO(RDA_BT_RF_I2C_DEVNAME, (RDA_BT_RF_ADDR>>1))}; -static struct i2c_driver rda_bt_rf_driver; - -static const struct i2c_device_id bt_core_i2c_id[] = {{RDA_BT_CORE_I2C_DEVNAME, 0}, {}}; -MODULE_DEVICE_TABLE(i2c, bt_core_i2c_id); - -static unsigned short bt_core_force[] = { RDA_I2C_CHANNEL, RDA_BT_CORE_ADDR, I2C_CLIENT_END, I2C_CLIENT_END }; -static struct i2c_board_info __initdata i2c_rda_bt_core={ I2C_BOARD_INFO(RDA_BT_CORE_I2C_DEVNAME, (RDA_BT_CORE_ADDR>>1))}; -static struct i2c_driver rda_bt_core_driver; - - -static u8 isBigEnded = 0; -static u8 wifi_in_test_mode = 0; - -static int i2c_write_data_4_addr_4_data(struct i2c_client* client, const u32 addr, const u32 data) -{ - unsigned char ADDR[4], DATA[4]; - int ret = 0; - - if(!isBigEnded) - { - ADDR[0] = addr >> 24; - ADDR[1] = addr >> 16; - ADDR[2] = addr >> 8; - ADDR[3] = addr >> 0; - - DATA[0] = data >> 24; - DATA[1] = data >> 16; - DATA[2] = data >> 8; - DATA[3] = data >> 0; - } - else - { - memcpy(ADDR, &addr, sizeof(u32)); - memcpy(DATA, &data, sizeof(u32)); - } - - ret = i2c_master_send(client, (char*)ADDR, 4); - if (ret < 0) - { - printk(KERN_INFO "***i2c_write_data_4_addr_4_data send:0x%X err:%d\n", addr,ret); - return -1; - } - - ret = i2c_master_send(client, (char*)DATA, 4); - if (ret < 0) - { - printk(KERN_INFO "***i2c_write_data_4_addr_4_data send:0x%X err:%d\n", data,ret); - return -1; - } - - return 0; -} - - -static int i2c_read_4_addr_4_data(struct i2c_client* client, const u32 addr, u32* data) -{ - unsigned char ADDR[4], DATA[4]; - int ret = 0; - - if(!isBigEnded) - { - ADDR[0] = addr >> 24; - ADDR[1] = addr >> 16; - ADDR[2] = addr >> 8; - ADDR[3] = addr >> 0; - } - else - { - memcpy(ADDR, &addr, sizeof(u32)); - } - - ret = i2c_master_send(client, (char*)ADDR, 4); - if (ret < 0) - { - printk(KERN_INFO "***i2c_read_4_addr_4_data send:0x%X err:%d\n", addr,ret); - return -1; - } - - ret = i2c_master_recv(client, (char*)DATA, 4); - if (ret < 0) - { - printk(KERN_INFO "***i2c_read_4_addr_4_data send:0x%X err:%d\n", addr,ret); - return -1; - } - - if(!isBigEnded) - { - data[3] = DATA[0]; - data[2] = DATA[1]; - data[1] = DATA[2]; - data[0] = DATA[3]; - } - else - memcpy(data, DATA, sizeof(u32)); - - return 0; -} - - -static int i2c_write_1_addr_2_data(struct i2c_client* client, const u8 addr, const u16 data) -{ - unsigned char DATA[3]; - int ret = 0; - - if(!isBigEnded) - { - DATA[0] = addr; - DATA[1] = data >> 8; - DATA[2] = data >> 0; - } - else - { - DATA[0] = addr; - DATA[1] = data >> 0; - DATA[2] = data >> 8; - } - - ret = i2c_master_send(client, (char*)DATA, 3); - if (ret < 0) - { - printk(KERN_INFO "***i2c_write_1_addr_2_data send:0x%X err:%d bigendia: %d \n", addr,ret, isBigEnded); - return -1; - } - - return 0; -} - - -static int i2c_read_1_addr_2_data(struct i2c_client* client, const u8 addr, u16* data) -{ - unsigned char DATA[2]; - int ret = 0; - - ret = i2c_master_send(client, (char*)&addr, 1); - if (ret < 0) - { - printk(KERN_INFO "***i2c_read_1_addr_2_data send:0x%X err:%d\n", addr,ret); - return -1; - } - - ret = i2c_master_recv(client, DATA, 2); - if (ret < 0) - { - printk(KERN_INFO "***i2c_read_1_addr_2_data send:0x%X err:%d\n", addr,ret); - return -1; - } - - if(!isBigEnded) - { - *data = (DATA[0] << 8) | DATA[1]; - } - else - { - *data = (DATA[1] << 8) | DATA[0]; - } - return 0; -} - - -static int rda_wifi_rf_probe(struct i2c_client *client, const struct i2c_device_id *id) -{ - int result = 0; - - rda_wifi_rf_client = client; - return result; -} - -static int rda_wifi_rf_remove(struct i2c_client *client) -{ - return 0; -} - -static int rda_wifi_rf_detect(struct i2c_client *client, int kind, struct i2c_board_info *info) -{ - strcpy(info->type, RDA_WIFI_RF_I2C_DEVNAME); - return 0; -} - -static struct i2c_driver rda_wifi_rf_driver = { - .probe = rda_wifi_rf_probe, - .remove = rda_wifi_rf_remove, - .detect = rda_wifi_rf_detect, - .driver.name = RDA_WIFI_RF_I2C_DEVNAME, - .id_table = wifi_rf_i2c_id, -// .address_data = &rda_wifi_rf_addr_data, - //.address_list = (const unsigned short*) wifi_rf_force, -}; - -static int rda_wifi_core_detect(struct i2c_client *client, int kind, struct i2c_board_info *info) -{ - strcpy(info->type, RDA_WIFI_CORE_I2C_DEVNAME); - return 0; -} - -static int rda_wifi_core_probe(struct i2c_client *client, const struct i2c_device_id *id) -{ - int result = 0; - - rda_wifi_core_client = client; - return result; -} - -static int rda_wifi_core_remove(struct i2c_client *client) -{ - return 0; -} - -int rda_wifi_power_off(void); -static void rda_wifi_shutdown(struct i2c_client * client) -{ - printk("rda_wifi_shutdown \n"); - rda_wifi_power_off(); -} - -static struct i2c_driver rda_wifi_core_driver = -{ - .probe = rda_wifi_core_probe, - .remove = rda_wifi_core_remove, - .detect = rda_wifi_core_detect, - .shutdown = rda_wifi_shutdown, - .driver.name = RDA_WIFI_CORE_I2C_DEVNAME, - .id_table = wifi_core_i2c_id, - //.address_data = &rda_wifi_core_addr_data, - //.address_list = (const unsigned short*)wifi_core_force, -}; - -const u32 wifi_core_init_data[][2] = -{ - -}; - -u16 wifi_off_data[][2] = -{ - { 0x3F, 0x0001 }, //page up - { 0x31, 0x0B40 }, //power off wifi - { 0x3F, 0x0000 }, //page down -}; - -u16 wifi_en_data[][2] = -{ - //item:VerD_wf_on_2012_02_08 - {0x3f, 0x0001}, -#ifdef RDA5990_USE_DCDC /*houzhen update Mar 15 2012 */ - {0x23, 0x8FA1},//20111001 higher AVDD voltage to improve EVM to 0x8f21 download current -1db 0x8fA1>>0x8bA1 -#else - {0x23, 0x0FA1}, -#endif - {0x31, 0x0B40 }, //power off wifi -// {0x22, 0xD3C7},//for ver.c 20111109, txswitch - {0x24, 0x80C8},//freq_osc_in[1:0]00 0x80C8 >> 0x80CB - {0x27, 0x4925},//for ver.c20111109, txswitch - // {0x28, 0x80A1}, //BT_enable - {0x31, 0x8140},//enable wifi - {0x32, 0x0113},//set_ rdenout_ldooff_wf=0; rden4in_ldoon_wf=1 - // {0x39, 0x0004}, //uart switch to wf - {0x3F, 0x0000}, //page down -}; - - -u16 wifi_dc_cal_data[][2]= -{ - {0x3f, 0x0000}, - {0x30, 0x0248}, - {0x30, 0x0249}, - //{wait 200ms; } here -}; - -u16 wifi_dig_reset_data[][2]= -{ - {0x3F, 0x0001}, - {0x31, 0x8D40}, - {0x31, 0x8F40}, - {0x31, 0x8b40}, - {0x3F, 0x0000}, -}; - -u16 wifi_rf_init_data_verE[][2] = -{ - {0x3f, 0x0000}, - //{;;set_rf_swi},ch - {0x06, 0x0101}, - {0x07, 0x0101}, - {0x08, 0x0101}, - {0x09, 0x0101}, - {0x0A, 0x002C},//aain_0 - {0x0D, 0x0507}, - {0x0E, 0x2300}, - {0x0F, 0x5689},// - //{;;//set_RF }, - {0x10, 0x0f78},//20110824 - {0x11, 0x0602}, - {0x13, 0x0652},//adc_tuning_bit[011] - {0x14, 0x8886}, - {0x15, 0x0990}, - {0x16, 0x049f}, - {0x17, 0x0990}, - {0x18, 0x049F}, - {0x19, 0x3C01}, - {0x1C, 0x0934}, - {0x1D, 0xFF00},//for ver.D20120119for temperature 70 degree - //{0x1F, 0x01F8},//for ver.c20111109 - //{0x1F, 0x0300},//for burst tx 不锁 - {0x20, 0x06E4}, - {0x21, 0x0ACF},//for ver.c20111109,dr dac reset,dr txflt reset - {0x22, 0x24DC}, - {0x23, 0x23FF}, - {0x24, 0x00FC}, - {0x26, 0x004F},//004F >> 005f premote pa - {0x27, 0x171D},///mdll*7 - {0x28, 0x031D},///mdll*7 - {0x2A, 0x2860},//et0x2849-8.5p :yd 0x2861-7pf C1,C2=6.8p - {0x2B, 0x0800},//bbpll,or ver.c20111116 - {0x32, 0x8a08}, - {0x33, 0x1D02},//liuyanan - //{;;//agc_gain}, - {0x36, 0x02f4}, //00F8;//gain_7 - {0x37, 0x01f4}, //0074;//aain_6 - {0x38, 0x21d4}, //0014;//gain_5 - {0x39, 0x25d4}, //0414;//aain_4 - {0x3A, 0x2584}, //1804;//gain_3 - {0x3B, 0x2dc4}, //1C04;//aain_2 - {0x3C, 0x2d04}, //1C02;//gain_1 - {0x3D, 0x2c02}, //3C01;//gain_0 - {0x33, 0x1502},//liuyanan - //{;;SET_channe},_to_11 - {0x1B, 0x0001},//set_channel - {0x30, 0x024D}, - {0x29, 0xD468}, - {0x29, 0x1468}, - {0x30, 0x0249}, - {0x3f, 0x0000}, -}; - -u16 wifi_rf_init_data[][2] = -{ - {0x3f, 0x0000}, - //{;;set_rf_swi},ch - {0x06, 0x0101}, - {0x07, 0x0101}, - {0x08, 0x0101}, - {0x09, 0x0101}, - {0x0A, 0x002C},//aain_0 - {0x0D, 0x0507}, - {0x0E, 0x2300},//2012_02_20 - {0x0F, 0x5689},// - //{;;//set_RF }, - {0x10, 0x0f78},//20110824 - {0x11, 0x0602}, - {0x13, 0x0652},//adc_tuning_bit[011] - {0x14, 0x8886}, - {0x15, 0x0990}, - {0x16, 0x049f}, - {0x17, 0x0990}, - {0x18, 0x049F}, - {0x19, 0x3C01},//sdm_vbit[3:0]=1111 - {0x1C, 0x0934}, - {0x1D, 0xFF00},//for ver.D20120119for temperature 70 degree 0xCE00 >> 0xFF00 - {0x1F, 0x0300},//div2_band_48g_dr=1;div2_band_48g_reg[8:0] - {0x20, 0x06E4}, - {0x21, 0x0ACF},//for ver.c20111109,dr dac reset,dr txflt reset - {0x22, 0x24DC}, - {0x23, 0x23FF}, - {0x24, 0x00FC}, - {0x26, 0x004F},//004F >> 005f premote pa - {0x27, 0x171D},///mdll*7 - {0x28, 0x031D},///mdll*7 - {0x2A, 0x2860},//et0x2849-8.5p :yd 0x2861-7pf - {0x2B, 0x0800},//bbpll,or ver.c20111116 - {0x32, 0x8a08}, - {0x33, 0x1D02},//liuyanan - //{;;//agc_gain}, - {0x36, 0x02f4}, //00F8;//gain_7 - {0x37, 0x01f4}, //0074;//aain_6 - {0x38, 0x21d4}, //0014;//gain_5 - {0x39, 0x25d4}, //0414;//aain_4 - {0x3A, 0x2584}, //1804;//gain_3 - {0x3B, 0x2dc4}, //1C04;//aain_2 - {0x3C, 0x2d04}, //1C02;//gain_1 - {0x3D, 0x2c02}, //3C01;//gain_0 - {0x33, 0x1502},//liuyanan - //{;;SET_channe},_to_11 - {0x1B, 0x0001},//set_channel - {0x30, 0x024D}, - {0x29, 0xD468}, - {0x29, 0x1468}, - {0x30, 0x0249}, - {0x3f, 0x0000}, -}; -u16 wifi_uart_debug_data[][2] = -{ - {0x3F,0x0001}, - {0x28,0x80A1}, //BT_enable - {0x39,0x0004}, //uart switch to wf - {0x3f,0x0000}, -}; - -u16 wifi_tm_en_data[][2] = -{ - {0x3F,0x0001}, -#ifdef RDA5990_USE_DCDC /*houzhen update Mar 15 2012 */ - {0x23, 0x8FA1},//20111001 higher AVDD voltage to improve EVM to 0x8f21 download current -1db 0x8fA1>>0x8bA1 -#else - {0x23, 0x0FA1}, -#endif - {0x22,0xD3C7},//for ver.c 20111109, tx - {0x24, 0x80C8},//freq_osc_in[1:0]00 0x80C8 >> 0x80CB - {0x27,0x4925},//for ver.c20111109, txs - {0x28,0x80A1}, //BT_enable - {0x29,0x111F}, - {0x31,0x8140}, - {0x32,0x0113},//set_ rdenout_ldooff_wf - {0x39,0x0004},//uart switch to wf - {0x3f,0x0000}, -}; - -u16 wifi_tm_rf_init_data[][2] = -{ - {0x3f, 0x0000}, - //set_rf_switch - {0x06,0x0101}, - {0x07,0x0101}, - {0x08,0x0101}, - {0x09,0x0101}, - {0x0A,0x002C},//aain_0 - {0x0D, 0x0507}, - {0x0E,0x2300},//2012_02_20 - {0x0F,0x5689},// - //set_RF - {0x10,0x0f78},//20110824 - {0x11,0x0602}, - {0x13,0x0652},//adc_tuning_bit[011] - {0x14,0x8886}, - {0x15,0x0990}, - {0x16,0x049f}, - {0x17,0x0990}, - {0x18,0x049F}, - {0x19,0x3C01},//sdm_vbit[3:0]=1111 - {0x1C,0x0934}, - {0x1D,0xFF00},//for ver.D20120119for temperature 70 degree - {0x1F,0x0300},//div2_band_48g_dr=1;div2_band_48g_reg[8:0]1000000000 - {0x20,0x06E4}, - {0x21,0x0ACF},//for ver.c20111109,dr dac reset,dr txflt reset - {0x22,0x24DC}, - {0x23,0x23FF}, - {0x24,0x00FC}, - {0x26,0x004F}, - {0x27,0x171D},///mdll*7 - {0x28,0x031D},///mdll*7 - {0x2A,0x2860}, - {0x2B,0x0800},//bbpll,or ver.c20111116 - {0x32,0x8a08}, - {0x33,0x1D02},//liuyanan - //agc_gain - {0x36,0x02f4}, //00F8;//gain_7 - {0x37,0x01f4}, //0074;//aain_6 - {0x38,0x21d4}, //0014;//gain_5 - {0x39,0x25d4}, //0414;//aain_4 - {0x3A,0x2584}, //1804;//gain_3 - {0x3B,0x2dc4}, //1C04;//aain_2 - {0x3C,0x2d04}, //1C02;//gain_1 - {0x3D,0x2c02}, //3C01;//gain_0 - //DC_CAL - {0x30,0x0248}, - {0x30,0x0249}, - //wait 200ms; - {0x33,0x1502},//liuyanan - //SET_channel_to_11 - {0x1B,0x0001},//set_channel - {0x3f,0x0000}, -}; - -/*houzhen update Mar 15 2012 - should be called when power up/down bt - */ -static int rda5990_wf_setup_A2_power(int enable) -{ - int ret; - u16 temp_data=0; - printk(KERN_INFO "***rda5990_wf_setup_A2_power start! \n"); - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, 0x3f, 0x0001); - if(ret) - goto err; - - if(enable) - { - ret=i2c_read_1_addr_2_data(rda_wifi_rf_client,0x22,&temp_data); - if(ret) - goto err; - printk(KERN_INFO "***0xA2 readback value:0x%X \n", temp_data); - - temp_data |=0x0200; /*en reg4_pa bit*/ -#ifdef RDA5890_USE_CRYSTAL - temp_data &= ~(1 << 14); //disable xen_out -#endif - ret=i2c_write_1_addr_2_data(rda_wifi_rf_client,0x22,temp_data); - if(ret) - goto err; - //read wlan version - ret = i2c_read_1_addr_2_data(rda_wifi_rf_client,0x21,&temp_data); - if(ret) - goto err; - else - wlan_version = temp_data; - } - else - { - ret=i2c_read_1_addr_2_data(rda_wifi_rf_client,0x28,&temp_data); - if(ret) - goto err; - if(temp_data&0x8000) // bt is on - { - goto out; - } - else - { - ret=i2c_read_1_addr_2_data(rda_wifi_rf_client,0x22,&temp_data); - if(ret) - goto err; - temp_data&=0xfdff; - - ret=i2c_write_1_addr_2_data(rda_wifi_rf_client,0x22,temp_data); - if(ret) - goto err; - } - wlan_version = 0; - } - -out: - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, 0x3f, 0x0000); - if(ret) - goto err; - printk(KERN_INFO "***rda5990_wf_setup_A2_power succeed! \n"); - return 0; - -err: - printk(KERN_INFO "***rda5990_wf_setup_A2_power failed! \n"); - return -1; -} - - -int rda_wifi_rf_init(void) -{ - unsigned int count = 0; - int ret = 0; - - mutex_lock(&i2c_rw_lock); - if( (wlan_version&0x1f) == 7) - { - for(count = 0; count < sizeof(wifi_rf_init_data)/sizeof(wifi_rf_init_data[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, wifi_rf_init_data[count][0], wifi_rf_init_data[count][1]); - if(ret) - goto err; - } - } - else if((wlan_version&0x1f) == 4 || (wlan_version&0x1f)==5) - { - for(count = 0; count < sizeof(wifi_rf_init_data_verE)/sizeof(wifi_rf_init_data_verE[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, wifi_rf_init_data_verE[count][0], wifi_rf_init_data_verE[count][1]); - if(ret) - goto err; - } - } - else - { - printk("unknown version of this 5990 chip\n"); - goto err; - } - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_wifi_rf_init_succceed \n"); - msleep(5); //5ms delay - return 0; -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_wifi_rf_init failed! \n"); - return -1; -} - -int rda_wifi_dc_cal(void) -{ - unsigned int count = 0; - int ret = 0; - - mutex_lock(&i2c_rw_lock); - for(count = 0; count < sizeof(wifi_dc_cal_data)/sizeof(wifi_dc_cal_data[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client ,wifi_dc_cal_data[count][0], wifi_dc_cal_data[count][1]); - if(ret) - goto err; - } - - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_wifi_rf_dc_calsuccceed \n"); - msleep(50); //50ms delay - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_wifi_rf_dc_calf_failed! \n"); - return -1; -} - -int rda_wifi_en(void) -{ - unsigned int count = 0; - int ret = 0; - - mutex_lock(&i2c_rw_lock); - for(count = 0; count < sizeof(wifi_en_data)/sizeof(wifi_en_data[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, wifi_en_data[count][0], wifi_en_data[count][1]); - if(ret) - goto err; - if(wifi_en_data[count][0] == 0x31) - msleep(10); //10ms delay - } - - ret=rda5990_wf_setup_A2_power(1); //en pa_reg for wf - if(ret) - goto err; - - mutex_unlock(&i2c_rw_lock); - msleep(8); //8ms delay - - printk(KERN_INFO "***rda_wifi_en_succceed \n"); - return 0; -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_wifi_power_on failed! \n"); - return -1; -} - -int rda_wifi_debug_en(void) -{ - unsigned int count = 0; - int ret = 0; - - mutex_lock(&i2c_rw_lock); - for(count = 0; count < sizeof(wifi_uart_debug_data)/sizeof(wifi_uart_debug_data[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, wifi_uart_debug_data[count][0], wifi_uart_debug_data[count][1]); - if(ret) - goto err; - } - -err: - mutex_unlock(&i2c_rw_lock); - return ret; -} - -int rda_tm_wifi_en(void) -{ - unsigned int count = 0; - int ret = 0; - unsigned short temp_data; - - for(count = 0; count < sizeof(wifi_tm_en_data)/sizeof(wifi_tm_en_data[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, wifi_tm_en_data[count][0], wifi_tm_en_data[count][1]); - if(ret) - goto err; - } - - msleep(8); //8ms delay - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, 0x3f, 0x0001); //PAGE UP - if(ret) - goto err; - - ret = i2c_read_1_addr_2_data(rda_wifi_rf_client,0x21,&temp_data); - if(ret) - goto err; - else - wlan_version = temp_data; - - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, 0x3f, 0x0000); //PAGE DOWN - if(ret) - goto err; - - - printk(KERN_INFO "***rda_wifi_en_succceed \n"); - return 0; -err: - printk(KERN_INFO "***rda_wifi_power_on failed! \n"); - return -1; -} - -int rda_tm_wifi_rf_init(void) -{ - unsigned int count = 0; - int ret = 0; - - for(count = 0; count < sizeof(wifi_tm_rf_init_data)/sizeof(wifi_tm_rf_init_data[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, wifi_tm_rf_init_data[count][0], wifi_tm_rf_init_data[count][1]); - if(ret) - goto err; - } - - printk(KERN_INFO "***rda_wifi_rf_init_succceed \n"); - msleep(5); //5ms delay - return 0; - -err: - printk(KERN_INFO "***rda_wifi_rf_init failed! \n"); - return -1; -} -/*houzhen add 2012 04 09 - add to ensure wf dig powerup - */ - -int rda_wifi_dig_reset(void) -{ - unsigned int count = 0; - int ret = 0; - msleep(8); //8ms delay - mutex_lock(&i2c_rw_lock); - - for(count = 0; count < sizeof(wifi_dig_reset_data)/sizeof(wifi_dig_reset_data[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, wifi_dig_reset_data[count][0], wifi_dig_reset_data[count][1]); - if(ret) - goto err; - } - - mutex_unlock(&i2c_rw_lock); - msleep(8); //8ms delay - printk(KERN_INFO "***rda_wifi_dig_reset \n"); - return 0; -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_wifi_dig_reset failed! \n"); - return -1; -} - -int rda_wlan_version(void) -{ - printk("******version %x \n", wlan_version); - return wlan_version; -} - -int rda_wifi_power_off(void) -{ - unsigned int count = 0; - int ret = 0; - u16 temp=0x0000; - printk(KERN_INFO "rda_wifi_power_off \n"); - - if(!rda_wifi_rf_client) - { - printk(KERN_INFO "rda_wifi_power_off failed on:i2c client \n"); - return -1; - } - - mutex_lock(&i2c_rw_lock); - ret=rda5990_wf_setup_A2_power(0); //disable pa_reg for wf - if(ret) - goto err; - - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, 0x3f, 0x0001); //page up - if(ret) - goto err; - - ret=i2c_read_1_addr_2_data(rda_wifi_rf_client,0x28,&temp); //poll bt status - if(ret) - goto err; - - if(temp&0x8000) - { - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, 0x3f, 0x0000); //page down - if(ret) - goto err; - - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, 0x0f, 0x2223); // set antenna for bt - if(ret) - goto err; - - } - - for(count = 0; count < sizeof(wifi_off_data)/sizeof(wifi_off_data[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, wifi_off_data[count][0], wifi_off_data[count][1]); - if(ret) - goto err; - } - printk(KERN_INFO "***rda_wifi_power_off success!!! \n"); - - - - mutex_unlock(&i2c_rw_lock); - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_wifi_power_off failed! \n"); - return -1; - -} - -int rda_wifi_power_on(void) -{ - int ret; - char retry = 3; - - printk("------------------rda_wifi_power_on\n"); - if(!rda_wifi_rf_client) - { - printk(KERN_INFO "rda_wifi_power_on failed on:i2c client \n"); - return -1; - } - -_retry: - - - if(!wifi_in_test_mode) - { - ret = rda_wifi_en(); - if(ret < 0) - goto err; - - ret = rda_wifi_rf_init(); - if(ret < 0) - goto err; - - ret = rda_wifi_dc_cal(); - if(ret < 0) - goto err; - - msleep(20); //20ms delay - ret=rda_wifi_dig_reset(); //houzhen add to ensure wf power up safely - - if(ret < 0) - goto err; - msleep(20); //20ms delay - } - else - { - ret = rda_tm_wifi_en(); - if(ret < 0) - goto err; - - ret = rda_tm_wifi_rf_init(); - if(ret < 0) - goto err; - } - printk(KERN_INFO "rda_wifi_power_on_succeed!! \n"); - - return 0; - -err: - printk(KERN_INFO "rda_wifi_power_on_failed retry:%d \n", retry); - if(retry -- > 0) - { - rda_wifi_power_off(); - goto _retry; - } - - return -1; -} - -extern int rda_wifi_power_on(void); - -int rda_fm_power_on(void) -{ - int ret = 0; - u16 temp = 0; - - if(!rda_wifi_rf_client) - { - printk(KERN_INFO "rda_wifi_rf_client is NULL, rda_fm_power_on failed!\n"); - return -1; - } - - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, 0x3f, 0x0001); // page down - if(ret < 0){ - printk(KERN_INFO "%s() write address(0x%02x) with value(0x%04x) failed! \n", __func__, 0x3f, 0x0001); - return -1; - } - ret = i2c_read_1_addr_2_data(rda_wifi_rf_client, 0x22, &temp); //read 0xA2 - if(ret < 0){ - printk(KERN_INFO "%s() read from address(0x%02x) failed! \n", __func__, 0x22); - return -1; - } - temp = temp & (~(1 << 15)); //clear bit[15] - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, 0x22, temp); //write back - if(ret < 0){ - printk(KERN_INFO "%s() write address(0x%02x) with value(0x%04x) failed! \n", __func__, 0x3f, 0x0001); - return -1; - } - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, 0x3f, 0x0000); // page up - if(ret < 0){ - printk(KERN_INFO "%s() write address(0x%02x) with value(0x%04x) failed! \n", __func__, 0x3f, 0x0001); - return -1; - } - - return 0; -} - -int rda_fm_power_off(void) -{ - int ret = 0; - u16 temp = 0; - - if(!rda_wifi_rf_client) - { - printk(KERN_INFO "rda_wifi_rf_client is NULL, rda_fm_power_off failed!\n"); - return -1; - } - - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, 0x3f, 0x0001); // page down - if(ret < 0){ - printk(KERN_INFO "%s() write address(0x%02x) with value(0x%04x) failed! \n", __func__, 0x3f, 0x0001); - return -1; - } - ret = i2c_read_1_addr_2_data(rda_wifi_rf_client, 0x22, &temp); //read 0xA2 - if(ret < 0){ - printk(KERN_INFO "%s() read from address(0x%02x) failed! \n", __func__, 0x22); - return -1; - } - temp = temp | (1 << 15); //set bit[15] - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, 0x22, temp); //write back - if(ret < 0){ - printk(KERN_INFO "%s() write address(0x%02x) with value(0x%04x) failed! \n", __func__, 0x3f, 0x0001); - return -1; - } - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, 0x3f, 0x0000); // page up - if(ret < 0){ - printk(KERN_INFO "%s() write address(0x%02x) with value(0x%04x) failed! \n", __func__, 0x3f, 0x0001); - return -1; - } - - return 0; -} - -static int rda_bt_rf_probe(struct i2c_client *client, const struct i2c_device_id *id) -{ - int result = 0; - - rda_bt_rf_client = client; - return result; -} - -static int rda_bt_rf_remove(struct i2c_client *client) -{ - rda_bt_rf_client = NULL; - return 0; -} - -static int rda_bt_rf_detect(struct i2c_client *client, int kind, struct i2c_board_info *info) -{ - strcpy(info->type, RDA_BT_RF_I2C_DEVNAME); - return 0; -} - -static struct i2c_driver rda_bt_rf_driver = { - .probe = rda_bt_rf_probe, - .remove = rda_bt_rf_remove, - .detect = rda_bt_rf_detect, - .driver.name = RDA_BT_RF_I2C_DEVNAME, - .id_table = bt_rf_i2c_id, - //.address_data = &rda_bt_rf_addr_data, - //.address_list = (const unsigned short*)bt_rf_force, -}; - - -static int rda_bt_core_detect(struct i2c_client *client, int kind, struct i2c_board_info *info) -{ - strcpy(info->type, RDA_BT_CORE_I2C_DEVNAME); - return 0; -} - -static int rda_bt_core_probe(struct i2c_client *client, const struct i2c_device_id *id) -{ - int result = 0; - - rda_bt_core_client = client; - return result; -} - -static int rda_bt_core_remove(struct i2c_client *client) -{ - return 0; -} - -static struct i2c_driver rda_bt_core_driver = { - .probe = rda_bt_core_probe, - .remove = rda_bt_core_remove, - .detect = rda_bt_core_detect, - .driver.name = RDA_BT_CORE_I2C_DEVNAME, - .id_table = bt_core_i2c_id, - //.address_data = &rda_bt_core_addr_data, - //.address_list = (const unsigned short*)bt_core_force, -}; - -u16 rda_5990_bt_off_data[][2] = -{ - {0x3f, 0x0001 }, //pageup - {0x28, 0x00A1 }, //power off bt - {0x3f, 0x0000 }, //pagedown -}; - -/*houzhen update 2012 03 06*/ -u16 rda_5990_bt_en_data[][2] = -{ - {0x3f, 0x0001 }, //pageup -#ifdef RDA5990_USE_DCDC - {0x23, 0x8FA1}, // //20111001 higher AVDD voltage to improve EVM -#else - {0x23, 0x0FA1}, -#endif - {0x24, 0x80C8}, // ;//freq_osc_in[1:0]00 - {0x26, 0x47A5}, // reg_vbit_normal_bt[2:0] =111 - {0x27, 0x4925}, // //for ver.c20111109, txswitch - {0x29, 0x111F}, // // rden4in_ldoon_bt=1 - {0x32, 0x0111}, // set_ rdenout_ldooff_wf=0; - {0x39, 0x0000}, // //uart switch to bt - - {0x28, 0x80A1}, // bt en - {0x3f, 0x0000}, //pagedown -}; - - -u16 rda_5990_bt_dc_cal[][2] = -{ - {0x3f, 0x0000 }, - {0x30, 0x0129 }, - {0x30, 0x012B }, - {0x3f, 0x0000 }, -}; - - -u16 rda_5990_bt_set_rf_switch_data[][2] = -{ - {0x3f, 0x0000 }, - {0x0F, 0x2223 }, - {0x3f, 0x0000 }, -}; - - -u16 RDA5990_bt_enable_clk_data[][2] = -{ - {0x3f, 0x0000 }, - {0x30, 0x0040 }, - {0x2a, 0x285d }, - {0x3f, 0x0000 }, -}; - -u16 RDA5990_bt_dig_reset_data[][2] = -{ - {0x3f, 0x0001 }, //pageup - {0x28, 0x86A1 }, - {0x28, 0x87A1 }, - {0x28, 0x85A1 }, - {0x3f, 0x0000 }, //pagedown -}; - -/*houzhen update 2012 03 06*/ -u16 rda_5990_bt_rf_data[][2] = -{ - {0x3f, 0x0000}, //pagedown - {0x01, 0x1FFF}, - {0x06, 0x07F7}, - {0x08, 0x29E7}, - {0x09, 0x0520}, - {0x0B, 0x03DF}, - {0x0C, 0x85E8}, - {0x0F, 0x0DBC}, - {0x12, 0x07F7}, - {0x13, 0x0327}, - {0x14, 0x0CCC}, - {0x15, 0x0526}, - {0x16, 0x8918}, - {0x18, 0x8800}, - {0x19, 0x10C8}, - {0x1A, 0x9078}, - {0x1B, 0x80E2}, - {0x1C, 0x361F}, - {0x1D, 0x4363}, - {0x1E, 0x303F}, - {0x23, 0x2222}, - {0x24, 0x359D}, - {0x27, 0x0011}, - {0x28, 0x124F}, - {0x39, 0xA5FC}, - {0x3f, 0x0001}, //page 1 - {0x00, 0x043F}, - {0x01, 0x467F}, - {0x02, 0x28FF}, - {0x03, 0x67FF}, - {0x04, 0x57FF}, - {0x05, 0x7BFF}, - {0x06, 0x3FFF}, - {0x07, 0x7FFF}, - {0x18, 0xF3F5}, - {0x19, 0xF3F5}, - {0x1A, 0xE7F3}, - {0x1B, 0xF1FF}, - {0x1C, 0xFFFF}, - {0x1D, 0xFFFF}, - {0x1E, 0xFFFF}, - {0x1F, 0xFFFF}, - // {0x22, 0xD3C7}, - // {0x23, 0x8fa1}, - // {0x24, 0x80c8}, - // {0x26, 0x47A5}, - // {0x27, 0x4925}, - // {0x28, 0x85a1}, - // {0x29, 0x111f}, - // {0x32, 0x0111}, - // {0x39, 0x0000}, - {0x3f, 0x0000}, //pagedown -}; - -/*houzhen update Mar 15 2012 - should be called when power up/down bt - */ -static int rda5990_bt_setup_A2_power(int enable) -{ - int ret; - u16 temp_data=0; - - ret = i2c_write_1_addr_2_data(rda_bt_rf_client, 0x3f, 0x0001); - if(ret) - goto err; - - if(enable) - { - ret=i2c_read_1_addr_2_data(rda_bt_rf_client,0x22,&temp_data); - if(ret) - goto err; - printk(KERN_INFO "***0xA2 readback value:0x%X \n", temp_data); - - temp_data |=0x0200; /*en reg4_pa bit*/ - - ret=i2c_write_1_addr_2_data(rda_bt_rf_client,0x22,temp_data); - if(ret) - goto err; - } - else - { - ret=i2c_read_1_addr_2_data(rda_bt_rf_client,0x31,&temp_data); - if(ret) - goto err; - - if(temp_data&0x8000) // wf is on - { - goto out; - } - else - { - ret=i2c_read_1_addr_2_data(rda_bt_rf_client,0x22,&temp_data); - if(ret) - goto err; - temp_data&=0xfdff; - - ret=i2c_write_1_addr_2_data(rda_bt_rf_client,0x22,temp_data); - if(ret) - goto err; - } - - } - -out: - ret = i2c_write_1_addr_2_data(rda_bt_rf_client, 0x3f, 0x0000); - if(ret) - goto err; - return 0; - -err: - printk(KERN_INFO "***rda5990_bt_setup_A2_power failed! \n"); - return -1; -} - -int rda_bt_power_off(void); - -int rda_bt_power_on(void) -{ - unsigned int count = 0; - int ret = 0; - - printk(KERN_INFO "rda_bt_power_on \n"); - - if(!rda_bt_rf_client || !rda_bt_rf_client) - { - printk(KERN_INFO "rda_bt_power_on failed on:i2c client \n"); - return -1; - } - - mutex_lock(&i2c_rw_lock); - - for(count = 0; count < sizeof(rda_5990_bt_en_data)/sizeof(rda_5990_bt_en_data[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_bt_rf_client, rda_5990_bt_en_data[count][0], rda_5990_bt_en_data[count][1]); - if(ret) - goto err; - } - - ret=rda5990_bt_setup_A2_power(1); - if(ret) - { - printk(KERN_INFO "***rda5990_bt_setup_A2_power fail!!! \n"); - goto err; - } - - printk(KERN_INFO "***rda_bt_power_on success!!! \n"); - - mutex_unlock(&i2c_rw_lock); - /*houzhen update 2012 03 06*/ - msleep(10); //delay 10 ms after power on - - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_bt_power_on failed! \n"); - return -1; - -} - -int rda_bt_power_off(void) -{ - unsigned int count = 0; - int ret = 0; - printk(KERN_INFO "rda_bt_power_off \n"); - - if(!rda_bt_rf_client) - { - printk(KERN_INFO "rda_bt_power_off failed on:i2c client \n"); - return -1; - } - - mutex_lock(&i2c_rw_lock); - for(count = 0; count < sizeof(rda_5990_bt_off_data)/sizeof(rda_5990_bt_off_data[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_bt_rf_client ,rda_5990_bt_off_data[count][0], rda_5990_bt_off_data[count][1]); - if(ret) - goto err; - } - msleep(10); //10ms - printk(KERN_INFO "***rda_bt_power_off success!!! \n"); - - ret=rda5990_bt_setup_A2_power(0);//disable ldo_pa reg - if(ret) - goto err; - - - - mutex_unlock(&i2c_rw_lock); - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_bt_power_off failed! \n"); - return -1; - -} - - -int RDA5990_bt_rf_init(void) -{ - unsigned int count = 0; - int ret = 0; - printk(KERN_INFO "RDA5990_bt_rf_init \n"); - - if(!rda_bt_rf_client) - { - printk(KERN_INFO "RDA5990_bt_rf_init on:i2c client \n"); - return -1; - } - - mutex_lock(&i2c_rw_lock); - for(count = 0; count < sizeof(rda_5990_bt_rf_data)/sizeof(rda_5990_bt_rf_data[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_bt_rf_client, rda_5990_bt_rf_data[count][0], rda_5990_bt_rf_data[count][1]); - if(ret) - goto err; - } - - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_rf_init success!!! \n"); - msleep(5); //5ms - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_rf_init failed! \n"); - return -1; - -} - -/*houzhen add 2012 04 09 - add to ensure bt dig powerup - */ - -int RDA5990_bt_dig_reset(void) -{ - unsigned int count = 0; - int ret = 0; - - printk(KERN_INFO "RDA5990_bt_dig_reset \n"); - if(!rda_bt_rf_client) - { - printk(KERN_INFO "RDA5990_bt_dig_reset on:i2c client \n"); - return -1; - } - - mutex_lock(&i2c_rw_lock); - for(count = 0; count < sizeof(RDA5990_bt_dig_reset_data)/sizeof(RDA5990_bt_dig_reset_data[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_bt_rf_client, RDA5990_bt_dig_reset_data[count][0], RDA5990_bt_dig_reset_data[count][1]); - if(ret) - goto err; - } - - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_rf_init success!!! \n"); - msleep(5); //5ms - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_rf_init failed! \n"); - return -1; - -} - - -int RDA5990_bt_dc_cal(void) -{ - unsigned int count = 0; - int ret = 0; - printk(KERN_INFO "rda_bt_dc_cal \n"); - - if(!rda_bt_rf_client) - { - printk(KERN_INFO "rda_bt_rf_client \n"); - return -1; - } - mutex_lock(&i2c_rw_lock); - - for(count = 0; count < sizeof(rda_5990_bt_dc_cal)/sizeof(rda_5990_bt_dc_cal[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_bt_rf_client, rda_5990_bt_dc_cal[count][0], rda_5990_bt_dc_cal[count][1]); - if(ret) - goto err; - } - - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_bt_dc_cal success!!! \n"); - msleep(200); //200ms - - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_bt_dc_cal failed! \n"); - return -1; - -} - - - -/*houzhen update Mar 15 2012 - bypass RDA5990_bt_set_rf_switch when wf is already on - */ - -int RDA5990_bt_set_rf_switch(void) -{ - unsigned int count = 0; - int ret = 0; - u16 temp_data=0; - printk(KERN_INFO "RDA5990_bt_set_rf_switch \n"); - - if(!rda_bt_rf_client || !rda_wifi_rf_client) - { - printk(KERN_INFO "RDA5990_bt_set_rf_switch failed on:i2c client \n"); - return -1; - } - - mutex_lock(&i2c_rw_lock); - - ret = i2c_write_1_addr_2_data(rda_bt_rf_client, 0x3f, 0x0001); - if(ret) - goto err; - - ret=i2c_read_1_addr_2_data(rda_bt_rf_client,0x31,&temp_data); - - if(ret) - goto err; - - if(temp_data&0x8000) // if wf is already on - { - printk(KERN_INFO "wf already en, bypass RDA5990_bt_set_rf_switch function \n"); - ret = i2c_write_1_addr_2_data(rda_bt_rf_client, 0x3f, 0x0000); - if(ret) - goto err; - mutex_unlock(&i2c_rw_lock); - return 0; - } - - for(count = 0; count < sizeof(rda_5990_bt_set_rf_switch_data)/sizeof(rda_5990_bt_set_rf_switch_data[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, rda_5990_bt_set_rf_switch_data[count][0], rda_5990_bt_set_rf_switch_data[count][1]); - if(ret) - goto err; - } - - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_set_rf_switch success!!! \n"); - msleep(50); //50ms - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_set_rf_switch failed! \n"); - return -1; - -} - - -/*houzhen update Mar 15 2012 - bypass RDA5990_bt_enable_clk when wf is already on - */ - -int RDA5990_bt_enable_clk(void) -{ - unsigned int count = 0; - int ret = 0; - u16 temp_data=0; - printk(KERN_INFO "RDA5990_bt_enable_clk \n"); - - if(!rda_bt_rf_client) - { - printk(KERN_INFO "RDA5990_bt_enable_clk failed on:i2c client \n"); - return -1; - } - - mutex_lock(&i2c_rw_lock); - ret = i2c_write_1_addr_2_data(rda_bt_rf_client, 0x3f, 0x0001); - if(ret) - goto err; - - ret=i2c_read_1_addr_2_data(rda_bt_rf_client,0x31,&temp_data); - - if(ret) - goto err; - - if(temp_data&0x8000) // if wf is already on - { - printk(KERN_INFO "wf already en, bypass RDA5990_bt_enable_clk function \n"); - ret = i2c_write_1_addr_2_data(rda_bt_rf_client, 0x3f, 0x0000); - if(ret) - goto err; - mutex_unlock(&i2c_rw_lock); - return 0; - } - - - for(count = 0; count < sizeof(RDA5990_bt_enable_clk_data)/sizeof(RDA5990_bt_enable_clk_data[0]); count ++) - { - ret = i2c_write_1_addr_2_data(rda_wifi_rf_client, RDA5990_bt_enable_clk_data[count][0], RDA5990_bt_enable_clk_data[count][1]); - if(ret) - goto err; - } - - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_enable_clk success!!! \n"); - msleep(50); //50ms - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_enable_clk failed! \n"); - return -1; - -} - -//extern void mt_combo_bgf_enable_irq(void); -//extern void mt_combo_bgf_disable_irq(void); - -#define RDA_BT_IOCTL_MAGIC 'u' -#define RDA_BT_POWER_ON_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x01) -#define RD_BT_RF_INIT_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x02) -#define RD_BT_DC_CAL_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x03) -#define RD_BT_SET_RF_SWITCH_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x04) -#define RDA_BT_POWER_OFF_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x05) -#define RDA_BT_EN_CLK _IO(RDA_BT_IOCTL_MAGIC ,0x06) -#define RD_BT_DC_DIG_RESET_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x07) - -#define RDA_WIFI_POWER_ON_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x10) -#define RDA_WIFI_POWER_OFF_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x11) -#define RDA_WIFI_POWER_SET_TEST_MODE_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x12) -#define RDA_WIFI_POWER_CANCEL_TEST_MODE_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x13) -#define RDA_WIFI_DEBUG_MODE_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x14) - -extern int rk29sdk_wifi_set_carddetect(int val); -static int rda_5990_pw_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - int ret = 0; - - switch(cmd) - { - case RDA_WIFI_POWER_ON_IOCTL: - //rda_wifi_power_on(); - //rk29sdk_wifi_set_carddetect(1); - break; - - case RDA_WIFI_POWER_OFF_IOCTL: - //rk29sdk_wifi_set_carddetect(0); - //rda_wifi_power_off(); - break; - - case RDA_WIFI_POWER_SET_TEST_MODE_IOCTL: - wifi_in_test_mode = 1; - printk("****set rda wifi in test mode"); - break; - - case RDA_WIFI_POWER_CANCEL_TEST_MODE_IOCTL: - wifi_in_test_mode = 0; - printk("****set rda wifi in normal mode"); - break; - - case RDA_WIFI_DEBUG_MODE_IOCTL: - ret = rda_wifi_debug_en(); - break; - - case RDA_BT_POWER_ON_IOCTL: - { - ret = rda_bt_power_on(); - //mt_combo_bgf_enable_irq(); - } - break; - - /* should call thif function after bt_power_on*/ - case RDA_BT_EN_CLK: - ret = RDA5990_bt_enable_clk(); - break; - - case RD_BT_RF_INIT_IOCTL: - ret = RDA5990_bt_rf_init(); - break; - - case RD_BT_DC_CAL_IOCTL: - ret = RDA5990_bt_dc_cal(); - break; - - case RD_BT_DC_DIG_RESET_IOCTL: - ret = RDA5990_bt_dig_reset(); - break; - - case RD_BT_SET_RF_SWITCH_IOCTL: - ret = RDA5990_bt_set_rf_switch(); - break; - - case RDA_BT_POWER_OFF_IOCTL: - { - //mt_combo_bgf_disable_irq(); - ret = rda_bt_power_off(); - } - break; - - default: - break; - } - - printk(KERN_INFO "rda_bt_pw_ioctl cmd=0x%02x \n", cmd); - - return ret; -} -extern int rk29sdk_wifi_power(int on); -void mmc_rescan_slot(int id) -{ - rk29sdk_wifi_power(1); - rda_wifi_power_on(); - rk29sdk_wifi_set_carddetect(1); -} -EXPORT_SYMBOL(mmc_rescan_slot); - -void mmc_remove(int id) -{ - rk29sdk_wifi_set_carddetect(0); - rda_wifi_power_off(); - rk29sdk_wifi_power(0); -} -EXPORT_SYMBOL(mmc_remove); - -static int rda_5990_major; -static struct class *rda_5990_class = NULL; -static const struct file_operations rda_5990_operations = { - .owner = THIS_MODULE, - .unlocked_ioctl = rda_5990_pw_ioctl, - .release = NULL -}; - -void rda_5990_sleep_worker_task(struct work_struct *work) -{ - printk("---rda_5990_sleep_worker_task end"); - wake_unlock(&rda_5990_wake_lock); -} - -void rda_5990_set_wake_lock(void) -{ - wake_lock(&rda_5990_wake_lock); - cancel_delayed_work(&rda_5990_sleep_worker); - schedule_delayed_work(&rda_5990_sleep_worker, 6*HZ); -} - -int rda_5990_power_ctrl_init(void) -{ - int ret = 0; - printk("rda_5990_power_ctrl_init begin\n"); - - /*i2c_register_board_info(0, &i2c_rda_wifi_core, 1); - if (i2c_add_driver(&rda_wifi_core_driver)) - { - printk("rda_wifi_core_driver failed!\n"); - ret = -ENODEV; - return ret; - } - */ - - //i2c_register_board_info(0, &i2c_rda_wifi_rf, 1); - if (i2c_add_driver(&rda_wifi_rf_driver)) - { - printk("rda_wifi_rf_driver failed!\n"); - ret = -ENODEV; - return ret; - } - - /* - i2c_register_board_info(0, &i2c_rda_bt_core, 1); - if (i2c_add_driver(&rda_bt_core_driver)) - { - printk("rda_bt_core_driver failed!\n"); - ret = -ENODEV; - return ret; - } - */ - - //i2c_register_board_info(0, &i2c_rda_bt_rf, 1); - if (i2c_add_driver(&rda_bt_rf_driver)) - { - printk("rda_bt_rf_driver failed!\n"); - ret = -ENODEV; - return ret; - } - - rda_5990_major = register_chrdev(0, "rda5990_power_ctrl", &rda_5990_operations); - if(rda_5990_major < 0) - { - printk(KERN_INFO "register rdabt_power_ctrl failed!!! \n"); - return rda_5990_major; - } - - rda_5990_class = class_create(THIS_MODULE, "rda_combo"); - if(IS_ERR(rda_5990_class)) - { - unregister_chrdev(rda_5990_major, "rdabt_power_ctrl"); - return PTR_ERR(rda_5990_class); - } - - device_create(rda_5990_class, NULL, MKDEV(rda_5990_major, 0), NULL, "rdacombo"); - - { - unsigned char* temp = NULL; - unsigned short testData = 0xffee; - temp = (unsigned char *)&testData; - if(*temp == 0xee) - isBigEnded = 0; - else - isBigEnded = 1; - } - - INIT_DELAYED_WORK(&rda_5990_sleep_worker, rda_5990_sleep_worker_task); - wake_lock_init(&rda_5990_wake_lock, WAKE_LOCK_SUSPEND, "RDA_sleep_worker_wake_lock"); - - mutex_init(&i2c_rw_lock); - printk("rda_5990_power_ctrl_init end\n"); - return 0; -} - -void rda_5990_power_ctrl_exit(void) -{ - i2c_del_driver(&rda_wifi_core_driver); - i2c_del_driver(&rda_wifi_rf_driver); - i2c_del_driver(&rda_bt_core_driver); - i2c_del_driver(&rda_bt_rf_driver); - - unregister_chrdev(rda_5990_major, "rdabt_power_ctrl"); - if(rda_5990_class) - class_destroy(rda_5990_class); - - cancel_delayed_work_sync(&rda_5990_sleep_worker); - wake_lock_destroy(&rda_5990_wake_lock); -} - -unsigned char rda_5990_wifi_in_test_mode(void) -{ - return wifi_in_test_mode; -} - - -static __inline__ void cfmakeraw(struct termios *s) -{ - s->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); - s->c_oflag &= ~OPOST; - s->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - s->c_cflag &= ~(CSIZE|PARENB); - s->c_cflag |= CS8; -} - -static __inline__ int cfsetospeed(struct termios *s, speed_t speed) -{ - s->c_cflag = (s->c_cflag & ~CBAUD) | (speed & CBAUD); - return 0; -} - -static __inline__ int cfsetispeed(struct termios *s, speed_t speed) -{ - s->c_cflag = (s->c_cflag & ~CBAUD) | (speed & CBAUD); - return 0; -} - -static int rda_wifi_init_uart(char *dev) -{ - int errno; - struct termios ti; - struct serial_struct ss; - int fd; - - fd = sys_open(dev, O_RDWR | O_NOCTTY, 0); - if (fd < 0) { - printk("Can't open serial port"); - return -1; - } - - sys_ioctl(fd, TCFLSH, TCIOFLUSH); - - /* Clear the cust flag */ - if((errno = sys_ioctl(fd, TIOCGSERIAL, &ss))<0){ - printk("BAUD: error to get the serial_struct info:%s\n", errno); - goto err; - } - - if (ss.flags & ASYNC_SPD_CUST) { - printk("clear ASYNC_SPD_CUST\r\n"); - ss.flags &= ~ASYNC_SPD_CUST; - } - if((errno = sys_ioctl(fd, TIOCSSERIAL, &ss))<0){ - printk("BAUD: error to set serial_struct:%s\n", errno); - goto err; - } - - if ((errno = sys_ioctl(fd, TCGETS, (long)&ti)) < 0) { - printk("unable to get UART port setting"); - printk("Can't get port settings"); - goto err; - } - - cfmakeraw(&ti); - - ti.c_cflag |= CLOCAL; - ti.c_cflag &= ~CRTSCTS; - ti.c_lflag = 0; - ti.c_cc[VTIME] = 5; /* 0.5 sec */ - ti.c_cc[VMIN] = 0; - - /* Set initial baudrate */ - cfsetospeed(&ti, B115200); - cfsetispeed(&ti, B115200); - - if ((errno = sys_ioctl(fd, TCSETS, (long)&ti)) < 0) { - printk("unable to set UART port setting"); - printk("Can't set port settings"); - goto err; - } - - errno = sys_ioctl(fd, TCFLSH, TCIOFLUSH); - if(errno < 0) - goto err; - - return fd; - -err: - if(fd > 0) - sys_close(fd); - - return -1; -} - -EXPORT_SYMBOL(rda_wlan_version); - -EXPORT_SYMBOL(rda_wifi_init_uart); -EXPORT_SYMBOL(rda_5990_wifi_in_test_mode); - -EXPORT_SYMBOL(rda_5990_set_wake_lock); -EXPORT_SYMBOL(rda_wifi_power_off); -EXPORT_SYMBOL(rda_wifi_power_on); -EXPORT_SYMBOL(rda_fm_power_on); -EXPORT_SYMBOL(rda_fm_power_off); - -module_init(rda_5990_power_ctrl_init); -module_exit(rda_5990_power_ctrl_exit); - -MODULE_LICENSE("GPL"); - diff --git a/drivers/net/wireless/rda5990/rda_5990_power_ctrl/rda_5990_power_ctrl_by_gpio.c b/drivers/net/wireless/rda5990/rda_5990_power_ctrl/rda_5990_power_ctrl_by_gpio.c deleted file mode 100755 index 8f508c12de07..000000000000 --- a/drivers/net/wireless/rda5990/rda_5990_power_ctrl/rda_5990_power_ctrl_by_gpio.c +++ /dev/null @@ -1,1462 +0,0 @@ -/* ----------------------------------------------------------------------- * - * - This file created by albert RDA Inc - */ - -#include -#include -#include -#include -#include -#include /* get the user-level API */ -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include - -#define RDA5890_USE_CRYSTAL //if use share crystal should close this -#define RDA5990_USE_DCDC - -#define u32 unsigned int -#define u8 unsigned char -#define u16 unsigned short - -extern int rda_gpio_i2c_read_1_addr_2_data(uint8_t chipAddr, uint8_t regAddr, uint16_t *buffer); -extern int rda_gpio_i2c_write_1_addr_2_data(uint8_t chipAddr, uint8_t regAddr, uint16_t data); -extern int rda_gpio_i2c_read_4_addr_4_data(uint8_t chipAddr, uint32_t regAddr, uint32_t *buffer); -extern int rda_gpio_i2c_write_4_addr_4_data(uint8_t chipAddr, uint32_t regAddr, uint32_t data); - - -//#define RDA_I2C_CHANNEL (0) -#define RDA_WIFI_CORE_ADDR (0x13) -#define RDA_WIFI_RF_ADDR (0x14) //correct add is 0x14 -#define RDA_BT_CORE_ADDR (0x15) -#define RDA_BT_RF_ADDR (0x16) - -static struct mutex i2c_rw_lock; -static unsigned short wlan_version = 0; -static struct wake_lock rda_5990_wake_lock; -static struct delayed_work rda_5990_sleep_worker; - -static u8 isBigEnded = 0; - -static u8 wifi_in_test_mode = 0; - -const u32 wifi_core_init_data[][2] = -{ - -}; - -u16 wifi_off_data[][2] = -{ - { 0x3F, 0x0001 }, //page up - { 0x31, 0x0B40 }, //power off wifi - { 0x3F, 0x0000 }, //page down -}; - -u16 wifi_en_data[][2] = -{ - //item:VerD_wf_on_2012_02_08 - {0x3f, 0x0001}, -#ifdef RDA5990_USE_DCDC /*houzhen update Mar 15 2012 */ - {0x23, 0x8FA1},//20111001 higher AVDD voltage to improve EVM to 0x8f21 download current -1db 0x8fA1>>0x8bA1 -#else - {0x23, 0x0FA1}, -#endif - {0x31, 0x0B40 }, //power off wifi -// {0x22, 0xD3C7},//for ver.c 20111109, txswitch - {0x24, 0x80C8},//freq_osc_in[1:0]00 0x80C8 >> 0x80CB - {0x27, 0x4925},//for ver.c20111109, txswitch - // {0x28, 0x80A1}, //BT_enable - {0x31, 0x8140},//enable wifi - {0x32, 0x0113},//set_ rdenout_ldooff_wf=0; rden4in_ldoon_wf=1 - // {0x39, 0x0004}, //uart switch to wf - {0x3F, 0x0000}, //page down -}; - - -u16 wifi_dc_cal_data[][2]= -{ - {0x3f, 0x0000}, - {0x30, 0x0248}, - {0x30, 0x0249}, - //{wait 200ms; } here -}; - -u16 wifi_dig_reset_data[][2]= -{ - {0x3F, 0x0001}, - {0x31, 0x8D40}, - {0x31, 0x8F40}, - {0x31, 0x8b40}, - {0x3F, 0x0000}, -}; - -u16 wifi_rf_init_data_verE[][2] = -{ - {0x3f, 0x0000}, - //{;;set_rf_swi},ch - {0x06, 0x0101}, - {0x07, 0x0101}, - {0x08, 0x0101}, - {0x09, 0x0101}, - {0x0A, 0x002C},//aain_0 - {0x0D, 0x0507}, - {0x0E, 0x2300}, - {0x0F, 0x5689},// - //{;;//set_RF }, - {0x10, 0x0f78},//20110824 - {0x11, 0x0602}, - {0x13, 0x0652},//adc_tuning_bit[011] - {0x14, 0x8886}, - {0x15, 0x0990}, - {0x16, 0x049f}, - {0x17, 0x0990}, - {0x18, 0x049F}, - {0x19, 0x3C01}, - {0x1C, 0x0934}, - {0x1D, 0xFF00},//for ver.D20120119for temperature 70 degree - //{0x1F, 0x01F8},//for ver.E should not set - //{0x1F, 0x0300},//for ver.E should not set - {0x20, 0x06E4}, - {0x21, 0x0ACF},//for ver.c20111109,dr dac reset,dr txflt reset - {0x22, 0x24DC}, - {0x23, 0x23FF}, - {0x24, 0x00FC}, - {0x26, 0x004F},//004F >> 005f premote pa - {0x27, 0x171D},///mdll*7 - {0x28, 0x031D},///mdll*7 - {0x2A, 0x2860},//et0x2849-8.5p :yd 0x2861-7pf C1,C2=6.8p - {0x2B, 0x0800},//bbpll,or ver.c20111116 - {0x32, 0x8a08}, - {0x33, 0x1D02},//liuyanan - //{;;//agc_gain}, - {0x36, 0x02f4}, //00F8;//gain_7 - {0x37, 0x01f4}, //0074;//aain_6 - {0x38, 0x21d4}, //0014;//gain_5 - {0x39, 0x25d4}, //0414;//aain_4 - {0x3A, 0x2584}, //1804;//gain_3 - {0x3B, 0x2dc4}, //1C04;//aain_2 - {0x3C, 0x2d04}, //1C02;//gain_1 - {0x3D, 0x2c02}, //3C01;//gain_0 - {0x33, 0x1502},//liuyanan - //{;;SET_channe},_to_11 - {0x1B, 0x0001},//set_channel - {0x30, 0x024D}, - {0x29, 0xD468}, - {0x29, 0x1468}, - {0x30, 0x0249}, - {0x3f, 0x0000}, -}; - -u16 wifi_rf_init_data[][2] = -{ - {0x3f, 0x0000}, - //{;;set_rf_swi},ch - {0x06, 0x0101}, - {0x07, 0x0101}, - {0x08, 0x0101}, - {0x09, 0x0101}, - {0x0A, 0x002C},//aain_0 - {0x0D, 0x0507}, - {0x0E, 0x2300}, - {0x0F, 0x5689},// - //{;;//set_RF }, - {0x10, 0x0f78},//20110824 - {0x11, 0x0602}, - {0x13, 0x0652},//adc_tuning_bit[011] - {0x14, 0x8886}, - {0x15, 0x0990}, - {0x16, 0x049f}, - {0x17, 0x0990}, - {0x18, 0x049F}, - {0x19, 0x3C01}, - {0x1C, 0x0934}, - {0x1D, 0xFF00},//for ver.D20120119for temperature 70 degree - //{0x1F, 0x01F8},//for ver.c20111109 - {0x1F, 0x0300},//for burst tx 不锁 - {0x20, 0x06E4}, - {0x21, 0x0ACF},//for ver.c20111109,dr dac reset,dr txflt reset - {0x22, 0x24DC}, - {0x23, 0x23FF}, - {0x24, 0x00FC}, - {0x26, 0x004F},//004F >> 005f premote pa - {0x27, 0x171D},///mdll*7 - {0x28, 0x031D},///mdll*7 - {0x2A, 0x2860},//et0x2849-8.5p :yd 0x2861-7pf C1,C2=6.8p - {0x2B, 0x0800},//bbpll,or ver.c20111116 - {0x32, 0x8a08}, - {0x33, 0x1D02},//liuyanan - //{;;//agc_gain}, - {0x36, 0x02f4}, //00F8;//gain_7 - {0x37, 0x01f4}, //0074;//aain_6 - {0x38, 0x21d4}, //0014;//gain_5 - {0x39, 0x25d4}, //0414;//aain_4 - {0x3A, 0x2584}, //1804;//gain_3 - {0x3B, 0x2dc4}, //1C04;//aain_2 - {0x3C, 0x2d04}, //1C02;//gain_1 - {0x3D, 0x2c02}, //3C01;//gain_0 - {0x33, 0x1502},//liuyanan - //{;;SET_channe},_to_11 - {0x1B, 0x0001},//set_channel - {0x30, 0x024D}, - {0x29, 0xD468}, - {0x29, 0x1468}, - {0x30, 0x0249}, - {0x3f, 0x0000}, -}; - -u16 wifi_uart_debug_data[][2] = -{ - {0x3F,0x0001}, - {0x28,0x80A1}, //BT_enable - {0x39,0x0004}, //uart switch to wf - {0x3f,0x0000}, -}; - -u16 wifi_tm_en_data[][2] = -{ - {0x3F,0x0001}, -#ifdef RDA5990_USE_DCDC /*houzhen update Mar 15 2012 */ - {0x23, 0x8FA1},//20111001 higher AVDD voltage to improve EVM to 0x8f21 download current -1db 0x8fA1>>0x8bA1 -#else - {0x23, 0x0FA1}, -#endif - {0x22,0xD3C7},//for ver.c 20111109, tx - {0x24, 0x80C8},//freq_osc_in[1:0]00 0x80C8 >> 0x80CB - {0x27,0x4925},//for ver.c20111109, txs - {0x28,0x80A1}, //BT_enable - {0x29,0x111F}, - {0x31,0x8140}, - {0x32,0x0113},//set_ rdenout_ldooff_wf - {0x39,0x0004},//uart switch to wf - {0x3f,0x0000}, -}; - -u16 wifi_tm_rf_init_data[][2] = -{ - {0x3f, 0x0000}, - //set_rf_switch - {0x06,0x0101}, - {0x07,0x0101}, - {0x08,0x0101}, - {0x09,0x0101}, - {0x0A,0x002C},//aain_0 - {0x0D,0x0507}, - {0x0E,0x2300},//2012_02_20 - {0x0F,0x5689},// - //set_RF - {0x10,0x0f78},//20110824 - {0x11,0x0602}, - {0x13,0x0652},//adc_tuning_bit[011] - {0x14,0x8886}, - {0x15,0x0990}, - {0x16,0x049f}, - {0x17,0x0990}, - {0x18,0x049F}, - {0x19,0x3C01},//sdm_vbit[3:0]=1111 - {0x1C,0x0934}, - {0x1D,0xCE00},//for ver.D20120119for temperature 70 degree - {0x1F,0x0300},//div2_band_48g_dr=1;div2_band_48g_reg[8:0]1000000000 - {0x20,0x06E4}, - {0x21,0x0ACF},//for ver.c20111109,dr dac reset,dr txflt reset - {0x22,0x24DC}, - {0x23,0x23FF}, - {0x24,0x00FC}, - {0x26,0x004F}, - {0x27,0x171D},///mdll*7 - {0x28,0x031D},///mdll*7 - {0x2A,0x2860}, - {0x2B,0x0800},//bbpll,or ver.c20111116 - {0x32,0x8a08}, - {0x33,0x1D02},//liuyanan - //agc_gain - {0x36,0x02f4}, //00F8;//gain_7 - {0x37,0x01f4}, //0074;//aain_6 - {0x38,0x21d4}, //0014;//gain_5 - {0x39,0x25d4}, //0414;//aain_4 - {0x3A,0x2584}, //1804;//gain_3 - {0x3B,0x2dc4}, //1C04;//aain_2 - {0x3C,0x2d04}, //1C02;//gain_1 - {0x3D,0x2c02}, //3C01;//gain_0 - //DC_CAL - {0x30,0x0248}, - {0x30,0x0249}, - //wait 200ms; - {0x33,0x1502},//liuyanan - //SET_channel_to_11 - {0x1B,0x0001},//set_channel - {0x3f,0x0000}, -}; - -/*houzhen update Mar 15 2012 - should be called when power up/down bt - */ -static int rda5990_wf_setup_A2_power(int enable) -{ - int ret; - u16 temp_data=0; - printk("***rda5990_wf_setup_A2_power start! \n"); - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x3f, 0x0001); - if(ret) - goto err; - - if(enable) - { - ret = rda_gpio_i2c_read_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x22, &temp_data); - if(ret) - goto err; - printk("***0xA2 readback value:0x%X \n", temp_data); - - temp_data |=0x0200; /*en reg4_pa bit*/ -#ifdef RDA5890_USE_CRYSTAL - temp_data &= ~(1 << 14); //disable xen_out -#endif - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x22, temp_data); - if(ret) - goto err; - //read wlan version - ret = rda_gpio_i2c_read_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x21, &temp_data); - if(ret) - goto err; - else - wlan_version = temp_data; - } - else - { - ret = rda_gpio_i2c_read_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x28, &temp_data); - if(ret) - goto err; - if(temp_data&0x8000) // bt is on - { - goto out; - } - else - { - ret = rda_gpio_i2c_read_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x22, &temp_data); - if(ret) - goto err; - temp_data&=0xfdff; - - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x22, temp_data); - if(ret) - goto err; - } - wlan_version = 0; - } - printk("rda5990_wf_setup_A2_power, version:%d", wlan_version); - -out: - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x3f, 0x0000); - if(ret) - goto err; - printk("***rda5990_wf_setup_A2_power succeed! \n"); - return 0; - -err: - printk("***rda5990_wf_setup_A2_power failed! \n"); - return -1; -} - - -int rda_wifi_rf_init(void) -{ - unsigned int count = 0; - int ret = 0; - mutex_lock(&i2c_rw_lock); - if( (wlan_version&0x1f) == 7) - { - for(count = 0; count < sizeof(wifi_rf_init_data)/sizeof(wifi_rf_init_data[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, wifi_rf_init_data[count][0], wifi_rf_init_data[count][1]); - if(ret) - goto err; - } - } - else if((wlan_version&0x1f) == 4 || (wlan_version&0x1f)==5) - { - for(count = 0; count < sizeof(wifi_rf_init_data_verE)/sizeof(wifi_rf_init_data_verE[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, wifi_rf_init_data_verE[count][0], wifi_rf_init_data_verE[count][1]); - if(ret) - goto err; - } - } - else - { - printk("unknown version of this 5990 chip\n"); - goto err; - } - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_wifi_rf_init_succceed \n"); - msleep(5); //5ms delay - return 0; -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_wifi_rf_init failed! \n"); - return -1; -} - -int rda_wifi_dc_cal(void) -{ - unsigned int count = 0; - int ret = 0; - - mutex_lock(&i2c_rw_lock); - for(count = 0; count < sizeof(wifi_dc_cal_data)/sizeof(wifi_dc_cal_data[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, wifi_dc_cal_data[count][0], wifi_dc_cal_data[count][1]); - if(ret) - goto err; - } - - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_wifi_rf_dc_calsuccceed \n"); - msleep(50); //50ms delay - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_wifi_rf_dc_calf_failed! \n"); - return -1; -} - -int rda_wifi_en(void) -{ - unsigned int count = 0; - int ret = 0; - - mutex_lock(&i2c_rw_lock); - for(count = 0; count < sizeof(wifi_en_data)/sizeof(wifi_en_data[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, wifi_en_data[count][0], wifi_en_data[count][1]); - if(ret) - goto err; - - if(wifi_en_data[count][0] == 0x31) - msleep(12); - } - - ret=rda5990_wf_setup_A2_power(1); //en pa_reg for wf - if(ret) - goto err; - - mutex_unlock(&i2c_rw_lock); - msleep(8); //8ms delay - - printk(KERN_INFO "***rda_wifi_en_succceed \n"); - return 0; -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_wifi_power_on failed! \n"); - return -1; -} - -int rda_wifi_debug_en(void) -{ - unsigned int count = 0; - int ret = 0; - - mutex_lock(&i2c_rw_lock); - for(count = 0; count < sizeof(wifi_uart_debug_data)/sizeof(wifi_uart_debug_data[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, wifi_uart_debug_data[count][0], wifi_uart_debug_data[count][1]); - if(ret) - goto err; - } - -err: - mutex_unlock(&i2c_rw_lock); - return ret; -} - -int rda_tm_wifi_en(void) -{ - unsigned int count = 0; - int ret = 0; - unsigned short temp_data; - - for(count = 0; count < sizeof(wifi_tm_en_data)/sizeof(wifi_tm_en_data[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, wifi_tm_en_data[count][0], wifi_tm_en_data[count][1]); - if(ret) - goto err; - } - - msleep(8); //8ms delay - - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x3f, 0x0001); //PAGE UP - if(ret) - goto err; - - ret = rda_gpio_i2c_read_1_addr_2_data(RDA_WIFI_RF_ADDR,0x21,&temp_data); - if(ret) - goto err; - else - wlan_version = temp_data; - - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x3f, 0x0000); //PAGE DOWN - if(ret) - goto err; - - printk(KERN_INFO "***rda_wifi_en_succceed \n"); - return 0; -err: - printk(KERN_INFO "***rda_wifi_power_on failed! \n"); - return -1; -} - -int rda_tm_wifi_rf_init(void) -{ - unsigned int count = 0; - int ret = 0; - - for(count = 0; count < sizeof(wifi_tm_rf_init_data)/sizeof(wifi_tm_rf_init_data[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, wifi_tm_rf_init_data[count][0], wifi_tm_rf_init_data[count][1]); - if(ret) - goto err; - } - - printk(KERN_INFO "***rda_wifi_rf_init_succceed \n"); - msleep(5); //5ms delay - return 0; - -err: - printk(KERN_INFO "***rda_wifi_rf_init failed! \n"); - return -1; -} -/*houzhen add 2012 04 09 - add to ensure wf dig powerup - */ - -int rda_wifi_dig_reset(void) -{ - unsigned int count = 0; - int ret = 0; - msleep(8); //8ms delay - mutex_lock(&i2c_rw_lock); - - for(count = 0; count < sizeof(wifi_dig_reset_data)/sizeof(wifi_dig_reset_data[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, wifi_dig_reset_data[count][0], wifi_dig_reset_data[count][1]); - if(ret) - goto err; - } - - mutex_unlock(&i2c_rw_lock); - msleep(8); //8ms delay - printk(KERN_INFO "***rda_wifi_dig_reset \n"); - return 0; -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_wifi_dig_reset failed! \n"); - return -1; -} - -int rda_wlan_version(void) -{ - printk("******version %x \n", wlan_version); - return wlan_version; -} - -int rda_wifi_power_off(void) -{ - unsigned int count = 0; - int ret = 0; - u16 temp=0x0000; - printk(KERN_INFO "rda_wifi_power_off \n"); - - - mutex_lock(&i2c_rw_lock); - ret=rda5990_wf_setup_A2_power(0); //disable pa_reg for wf - if(ret) - goto err; - - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x3f, 0x0001); //page up - if(ret) - goto err; - - ret = rda_gpio_i2c_read_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x28, &temp); //poll bt status - if(ret) - goto err; - - if(temp&0x8000) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x3f, 0x0000); //page down - if(ret) - goto err; - - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x0f, 0x2223); // set antenna for bt - if(ret) - goto err; - - } - - - for(count = 0; count < sizeof(wifi_off_data)/sizeof(wifi_off_data[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, wifi_off_data[count][0], wifi_off_data[count][1]); - if(ret) - goto err; - } - printk(KERN_INFO "***rda_wifi_power_off success!!! \n"); - - - - mutex_unlock(&i2c_rw_lock); - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_wifi_power_off failed! \n"); - return -1; - -} - -int rda_wifi_power_on(void) -{ - int ret; - char retry = 3; - - -_retry: - - if(!wifi_in_test_mode) - { - ret = rda_wifi_en(); - if(ret < 0) - goto err; - - ret = rda_wifi_rf_init(); - if(ret < 0) - goto err; - - ret = rda_wifi_dc_cal(); - if(ret < 0) - goto err; - - msleep(20); //20ms delay - ret=rda_wifi_dig_reset(); //houzhen add to ensure wf power up safely - - if(ret < 0) - goto err; - msleep(20); //20ms delay - } - else - { - ret = rda_tm_wifi_en(); - if(ret < 0) - goto err; - - ret = rda_tm_wifi_rf_init(); - if(ret < 0) - goto err; - } - printk(KERN_INFO "rda_wifi_power_on_succeed!! \n"); - - return 0; - -err: - printk(KERN_INFO "rda_wifi_power_on_failed retry:%d \n", retry); - if(retry -- > 0) - { - rda_wifi_power_off(); - goto _retry; - } - - return -1; -} - -int rda_fm_power_on(void) -{ - int ret = 0; - u16 temp = 0; - - - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x3f, 0x0001); // page down - if(ret < 0){ - printk(KERN_INFO "%s() write address(0x%02x) with value(0x%04x) failed! \n", __func__, 0x3f, 0x0001); - return -1; - } - ret = rda_gpio_i2c_read_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x22, &temp); //read 0xA2 - if(ret < 0){ - printk(KERN_INFO "%s() read from address(0x%02x) failed! \n", __func__, 0x22); - return -1; - } - temp = temp & (~(1 << 15)); //clear bit[15] - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x22, temp); //write back - if(ret < 0){ - printk(KERN_INFO "%s() write address(0x%02x) with value(0x%04x) failed! \n", __func__, 0x3f, 0x0001); - return -1; - } - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x3f, 0x0000); // page up - if(ret < 0){ - printk(KERN_INFO "%s() write address(0x%02x) with value(0x%04x) failed! \n", __func__, 0x3f, 0x0001); - return -1; - } - - return 0; -} - -int rda_fm_power_off(void) -{ - int ret = 0; - u16 temp = 0; - - - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x3f, 0x0001); // page down - if(ret < 0){ - printk(KERN_INFO "%s() write address(0x%02x) with value(0x%04x) failed! \n", __func__, 0x3f, 0x0001); - return -1; - } - ret = rda_gpio_i2c_read_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x22, &temp); //read 0xA2 - if(ret < 0){ - printk(KERN_INFO "%s() read from address(0x%02x) failed! \n", __func__, 0x22); - return -1; - } - temp = temp | (1 << 15); //set bit[15] - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x22, temp); //write back - if(ret < 0){ - printk(KERN_INFO "%s() write address(0x%02x) with value(0x%04x) failed! \n", __func__, 0x3f, 0x0001); - return -1; - } - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, 0x3f, 0x0000); // page up - if(ret < 0){ - printk(KERN_INFO "%s() write address(0x%02x) with value(0x%04x) failed! \n", __func__, 0x3f, 0x0001); - return -1; - } - - return 0; -} - - -u16 rda_5990_bt_off_data[][2] = -{ - {0x3f, 0x0001 }, //pageup - {0x28, 0x00A1 }, //power off bt - {0x3f, 0x0000 }, //pagedown -}; - -/*houzhen update 2012 03 06*/ -u16 rda_5990_bt_en_data[][2] = -{ - {0x3f, 0x0001 }, //pageup -#ifdef RDA5990_USE_DCDC - {0x23, 0x8FA1}, // //20111001 higher AVDD voltage to improve EVM -#else - {0x23, 0x0FA1}, -#endif - {0x24, 0x80C8}, // ;//freq_osc_in[1:0]00 - {0x26, 0x47A5}, // reg_vbit_normal_bt[2:0] =111 - {0x27, 0x4925}, // //for ver.c20111109, txswitch - {0x29, 0x111F}, // // rden4in_ldoon_bt=1 - {0x32, 0x0111}, // set_ rdenout_ldooff_wf=0; - {0x39, 0x0000}, // //uart switch to bt - - {0x28, 0x80A1}, // bt en - {0x3f, 0x0000}, //pagedown -}; - - -u16 rda_5990_bt_dc_cal[][2] = -{ - {0x3f, 0x0000 }, - {0x30, 0x0129 }, - {0x30, 0x012B }, - {0x3f, 0x0000 }, -}; - - -u16 rda_5990_bt_set_rf_switch_data[][2] = -{ - {0x3f, 0x0000 }, - {0x0F, 0x2223 }, - {0x3f, 0x0000 }, -}; - - -u16 RDA5990_bt_enable_clk_data[][2] = -{ - {0x3f, 0x0000 }, - {0x30, 0x0040 }, - {0x2a, 0x285d }, - {0x3f, 0x0000 }, -}; - -u16 RDA5990_bt_dig_reset_data[][2] = -{ - {0x3f, 0x0001 }, //pageup - {0x28, 0x86A1 }, - {0x28, 0x87A1 }, - {0x28, 0x85A1 }, - {0x3f, 0x0000 }, //pagedown -}; - -/*houzhen update 2012 03 06*/ -u16 rda_5990_bt_rf_data[][2] = -{ - {0x3f, 0x0000}, //pagedown - {0x01, 0x1FFF}, - {0x06, 0x07F7}, - {0x08, 0x29E7}, - {0x09, 0x0520}, - {0x0B, 0x03DF}, - {0x0C, 0x85E8}, - {0x0F, 0x0DBC}, - {0x12, 0x07F7}, - {0x13, 0x0327}, - {0x14, 0x0CCC}, - {0x15, 0x0526}, - {0x16, 0x8918}, - {0x18, 0x8800}, - {0x19, 0x10C8}, - {0x1A, 0x9078}, - {0x1B, 0x80E2}, - {0x1C, 0x361F}, - {0x1D, 0x4363}, - {0x1E, 0x303F}, - {0x23, 0x2222}, - {0x24, 0x359D}, - {0x27, 0x0011}, - {0x28, 0x124F}, - {0x39, 0xA5FC}, - {0x3f, 0x0001}, //page 1 - {0x00, 0x043F}, - {0x01, 0x467F}, - {0x02, 0x28FF}, - {0x03, 0x67FF}, - {0x04, 0x57FF}, - {0x05, 0x7BFF}, - {0x06, 0x3FFF}, - {0x07, 0x7FFF}, - {0x18, 0xF3F5}, - {0x19, 0xF3F5}, - {0x1A, 0xE7F3}, - {0x1B, 0xF1FF}, - {0x1C, 0xFFFF}, - {0x1D, 0xFFFF}, - {0x1E, 0xFFFF}, - {0x1F, 0xFFFF}, - // {0x22, 0xD3C7}, - // {0x23, 0x8fa1}, - // {0x24, 0x80c8}, - // {0x26, 0x47A5}, - // {0x27, 0x4925}, - // {0x28, 0x85a1}, - // {0x29, 0x111f}, - // {0x32, 0x0111}, - // {0x39, 0x0000}, - {0x3f, 0x0000}, //pagedown -}; - -/*houzhen update Mar 15 2012 - should be called when power up/down bt - */ -static int rda5990_bt_setup_A2_power(int enable) -{ - int ret; - u16 temp_data=0; - - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_BT_RF_ADDR, 0x3f, 0x0001); - if(ret) - goto err; - - if(enable) - { - ret = rda_gpio_i2c_read_1_addr_2_data(RDA_BT_RF_ADDR, 0x22, &temp_data); - if(ret) - goto err; - printk(KERN_INFO "***0xA2 readback value:0x%X \n", temp_data); - - temp_data |=0x0200; /*en reg4_pa bit*/ - - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_BT_RF_ADDR, 0x22, temp_data); - if(ret) - goto err; - } - else - { - ret = rda_gpio_i2c_read_1_addr_2_data(RDA_BT_RF_ADDR, 0x31, &temp_data); - if(ret) - goto err; - if(temp_data&0x8000) // wf is on - { - goto out; - } - else - { - ret = rda_gpio_i2c_read_1_addr_2_data(RDA_BT_RF_ADDR, 0x22, &temp_data); - if(ret) - goto err; - temp_data&=0xfdff; - - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_BT_RF_ADDR, 0x22, temp_data); - if(ret) - goto err; - } - - } - - -out: - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_BT_RF_ADDR, 0x3f, 0x0000); - if(ret) - goto err; - return 0; - -err: - printk(KERN_INFO "***rda5990_bt_setup_A2_power failed! \n"); - return -1; -} - -int rda_bt_power_off(void); - -int rda_bt_power_on(void) -{ - unsigned int count = 0; - int ret = 0; - - printk(KERN_INFO "rda_bt_power_on \n"); - - - mutex_lock(&i2c_rw_lock); - - for(count = 0; count < sizeof(rda_5990_bt_en_data)/sizeof(rda_5990_bt_en_data[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_BT_RF_ADDR, rda_5990_bt_en_data[count][0], rda_5990_bt_en_data[count][1]); - - if(ret) - goto err; - } - - ret=rda5990_bt_setup_A2_power(1); - if(ret) - { - printk(KERN_INFO "***rda5990_bt_setup_A2_power fail!!! \n"); - goto err; - } - - printk(KERN_INFO "***rda_bt_power_on success!!! \n"); - - mutex_unlock(&i2c_rw_lock); - /*houzhen update 2012 03 06*/ - msleep(10); //delay 10 ms after power on - - - return 0; -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_bt_power_on failed! \n"); - return -1; - -} - -int rda_bt_power_off(void) -{ - unsigned int count = 0; - int ret = 0; - printk(KERN_INFO "rda_bt_power_off \n"); - - - mutex_lock(&i2c_rw_lock); - for(count = 0; count < sizeof(rda_5990_bt_off_data)/sizeof(rda_5990_bt_off_data[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_BT_RF_ADDR, rda_5990_bt_off_data[count][0], rda_5990_bt_off_data[count][1]); - if(ret) - goto err; - } - msleep(10); //10ms - printk(KERN_INFO "***rda_bt_power_off success!!! \n"); - - ret=rda5990_bt_setup_A2_power(0);//disable ldo_pa reg - if(ret) - goto err; - - - - mutex_unlock(&i2c_rw_lock); - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_bt_power_off failed! \n"); - return -1; - -} - - -int RDA5990_bt_rf_init(void) -{ - unsigned int count = 0; - int ret = 0; - printk(KERN_INFO "RDA5990_bt_rf_init \n"); - - - mutex_lock(&i2c_rw_lock); - for(count = 0; count < sizeof(rda_5990_bt_rf_data)/sizeof(rda_5990_bt_rf_data[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_BT_RF_ADDR, rda_5990_bt_rf_data[count][0], rda_5990_bt_rf_data[count][1]); - if(ret) - goto err; - } - - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_rf_init success!!! \n"); - msleep(5); //5ms - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_rf_init failed! \n"); - return -1; - -} - - - -/*houzhen add 2012 04 09 - add to ensure bt dig powerup - */ - -int RDA5990_bt_dig_reset(void) -{ - unsigned int count = 0; - int ret = 0; - - printk(KERN_INFO "RDA5990_bt_dig_reset \n"); - - mutex_lock(&i2c_rw_lock); - for(count = 0; count < sizeof(RDA5990_bt_dig_reset_data)/sizeof(RDA5990_bt_dig_reset_data[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_BT_RF_ADDR, RDA5990_bt_dig_reset_data[count][0], RDA5990_bt_dig_reset_data[count][1]); - if(ret) - goto err; - } - - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_dig_reset success!!! \n"); - msleep(5); //5ms - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_dig_reset failed! \n"); - return -1; - -} - - -int RDA5990_bt_dc_cal(void) -{ - unsigned int count = 0; - int ret = 0; - printk(KERN_INFO "rda_bt_dc_cal \n"); - - mutex_lock(&i2c_rw_lock); - - for(count = 0; count < sizeof(rda_5990_bt_dc_cal)/sizeof(rda_5990_bt_dc_cal[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_BT_RF_ADDR, rda_5990_bt_dc_cal[count][0], rda_5990_bt_dc_cal[count][1]); - if(ret) - goto err; - } - - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_bt_dc_cal success!!! \n"); - msleep(200); //200ms - - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***rda_bt_dc_cal failed! \n"); - return -1; - -} - - - -/*houzhen update Mar 15 2012 - bypass RDA5990_bt_set_rf_switch when wf is already on - */ - -int RDA5990_bt_set_rf_switch(void) -{ - unsigned int count = 0; - int ret = 0; - u16 temp_data=0; - printk(KERN_INFO "RDA5990_bt_set_rf_switch \n"); - - - mutex_lock(&i2c_rw_lock); - - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_BT_RF_ADDR, 0x3f, 0x0001); - if(ret) - goto err; - - ret = rda_gpio_i2c_read_1_addr_2_data(RDA_BT_RF_ADDR, 0x31, &temp_data); - - if(ret) - goto err; - - if(temp_data&0x8000) // if wf is already on - { - - printk(KERN_INFO "wf already en, bypass RDA5990_bt_set_rf_switch function \n"); - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_BT_RF_ADDR, 0x3f, 0x0000); - if(ret) - goto err; - mutex_unlock(&i2c_rw_lock); - return 0; - } - - for(count = 0; count < sizeof(rda_5990_bt_set_rf_switch_data)/sizeof(rda_5990_bt_set_rf_switch_data[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, rda_5990_bt_set_rf_switch_data[count][0], rda_5990_bt_set_rf_switch_data[count][1]); - if(ret) - goto err; - } - - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_set_rf_switch success!!! \n"); - msleep(50); //50ms - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_set_rf_switch failed! \n"); - return -1; - -} - - -/*houzhen update Mar 15 2012 - bypass RDA5990_bt_enable_clk when wf is already on - */ - -int RDA5990_bt_enable_clk(void) -{ - unsigned int count = 0; - int ret = 0; - u16 temp_data=0; - printk(KERN_INFO "RDA5990_bt_enable_clk \n"); - - mutex_lock(&i2c_rw_lock); - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_BT_RF_ADDR, 0x3f, 0x0001); - if(ret) - goto err; - - ret = rda_gpio_i2c_read_1_addr_2_data(RDA_BT_RF_ADDR, 0x31, &temp_data); - - if(ret) - goto err; - - if(temp_data&0x8000) // if wf is already on - { - - printk(KERN_INFO "wf already en, bypass RDA5990_bt_enable_clk function \n"); - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_BT_RF_ADDR, 0x3f, 0x0000); - if(ret) - goto err; - mutex_unlock(&i2c_rw_lock); - return 0; - } - - - for(count = 0; count < sizeof(RDA5990_bt_enable_clk_data)/sizeof(RDA5990_bt_enable_clk_data[0]); count ++) - { - ret = rda_gpio_i2c_write_1_addr_2_data(RDA_WIFI_RF_ADDR, RDA5990_bt_enable_clk_data[count][0], RDA5990_bt_enable_clk_data[count][1]); - if(ret) - goto err; - } - - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_enable_clk success!!! \n"); - msleep(50); //50ms - return 0; - -err: - mutex_unlock(&i2c_rw_lock); - printk(KERN_INFO "***RDA5990_bt_enable_clk failed! \n"); - return -1; - -} - -extern void mt_combo_bgf_enable_irq(void); -extern void mt_combo_bgf_disable_irq(void); - - -#define RDA_BT_IOCTL_MAGIC 'u' -#define RDA_BT_POWER_ON_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x01) -#define RD_BT_RF_INIT_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x02) -#define RD_BT_DC_CAL_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x03) -#define RD_BT_SET_RF_SWITCH_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x04) -#define RDA_BT_POWER_OFF_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x05) -#define RDA_BT_EN_CLK _IO(RDA_BT_IOCTL_MAGIC ,0x06) -#define RD_BT_DC_DIG_RESET_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x07) - -#define RDA_WIFI_POWER_ON_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x10) -#define RDA_WIFI_POWER_OFF_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x11) -#define RDA_WIFI_POWER_SET_TEST_MODE_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x12) -#define RDA_WIFI_POWER_CANCEL_TEST_MODE_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x13) -#define RDA_WIFI_DEBUG_MODE_IOCTL _IO(RDA_BT_IOCTL_MAGIC ,0x14) - -static int rda_5990_pw_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -{ - int ret = 0; - - switch(cmd) - { - case RDA_WIFI_POWER_ON_IOCTL: - ret = rda_wifi_power_on(); - break; - - case RDA_WIFI_POWER_OFF_IOCTL: - ret = rda_wifi_power_off(); - break; - - case RDA_WIFI_POWER_SET_TEST_MODE_IOCTL: - wifi_in_test_mode = 1; - printk("****set rda wifi in test mode"); - break; - - case RDA_WIFI_POWER_CANCEL_TEST_MODE_IOCTL: - wifi_in_test_mode = 0; - printk("****set rda wifi in normal mode"); - break; - - case RDA_WIFI_DEBUG_MODE_IOCTL: - ret = rda_wifi_debug_en(); - break; - case RDA_BT_POWER_ON_IOCTL: - { - ret = rda_bt_power_on(); - mt_combo_bgf_enable_irq(); - } - break; - - /* should call thif function after bt_power_on*/ - case RDA_BT_EN_CLK: - ret = RDA5990_bt_enable_clk(); - break; - - case RD_BT_RF_INIT_IOCTL: - ret = RDA5990_bt_rf_init(); - break; - - case RD_BT_DC_CAL_IOCTL: - ret = RDA5990_bt_dc_cal(); - break; - - case RD_BT_DC_DIG_RESET_IOCTL: - ret = RDA5990_bt_dig_reset(); - break; - - case RD_BT_SET_RF_SWITCH_IOCTL: - ret = RDA5990_bt_set_rf_switch(); - break; - - case RDA_BT_POWER_OFF_IOCTL: - { - mt_combo_bgf_disable_irq(); - ret = rda_bt_power_off(); - } - break; - - default: - break; - } - - printk(KERN_INFO "rda_bt_pw_ioctl cmd=0x%02x \n", cmd); - - return ret; -} - -static int rda_5990_major; -static struct class *rda_5990_class = NULL; -static const struct file_operations rda_5990_operations = { - .owner = THIS_MODULE, - .unlocked_ioctl = rda_5990_pw_ioctl, - .release = NULL -}; - -void rda_5990_sleep_worker_task(struct work_struct *work) -{ - printk("---rda_5990_sleep_worker_task end"); - wake_unlock(&rda_5990_wake_lock); -} - -void rda_5990_set_wake_lock(void) -{ - wake_lock(&rda_5990_wake_lock); - cancel_delayed_work(&rda_5990_sleep_worker); - schedule_delayed_work(&rda_5990_sleep_worker, 6*HZ); -} - -int rda_5990_power_ctrl_init(void) -{ - int ret = 0; - - printk("rda_5990_power_ctrl_init begin\n"); - - rda_5990_major = register_chrdev(0, "rda5990_power_ctrl", &rda_5990_operations); - if(rda_5990_major < 0) - { - printk(KERN_INFO "register rdabt_power_ctrl failed!!! \n"); - return rda_5990_major; - } - - rda_5990_class = class_create(THIS_MODULE, "rda_combo"); - if(IS_ERR(rda_5990_class)) - { - unregister_chrdev(rda_5990_major, "rdabt_power_ctrl"); - return PTR_ERR(rda_5990_class); - } - - device_create(rda_5990_class, NULL, MKDEV(rda_5990_major, 0), NULL, "rdacombo"); - - - INIT_DELAYED_WORK(&rda_5990_sleep_worker, rda_5990_sleep_worker_task); - wake_lock_init(&rda_5990_wake_lock, WAKE_LOCK_SUSPEND, "RDA_sleep_worker_wake_lock"); - - mutex_init(&i2c_rw_lock); - printk("rda_5990_power_ctrl_init end\n"); - return 0; -} - -void rda_5990_power_ctrl_exit(void) -{ - - unregister_chrdev(rda_5990_major, "rdabt_power_ctrl"); - if(rda_5990_class) - class_destroy(rda_5990_class); - - cancel_delayed_work_sync(&rda_5990_sleep_worker); - wake_lock_destroy(&rda_5990_wake_lock); -} - -unsigned char rda_5990_wifi_in_test_mode(void) -{ - return wifi_in_test_mode; -} - - -static __inline__ void cfmakeraw(struct termios *s) -{ - s->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); - s->c_oflag &= ~OPOST; - s->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - s->c_cflag &= ~(CSIZE|PARENB); - s->c_cflag |= CS8; -} - -static __inline__ int cfsetospeed(struct termios *s, speed_t speed) -{ - s->c_cflag = (s->c_cflag & ~CBAUD) | (speed & CBAUD); - return 0; -} - -static __inline__ int cfsetispeed(struct termios *s, speed_t speed) -{ - s->c_cflag = (s->c_cflag & ~CBAUD) | (speed & CBAUD); - return 0; -} - -static int rda_wifi_init_uart(char *dev) -{ - int errno; - struct termios ti; - struct serial_struct ss; - int fd; - - fd = sys_open(dev, O_RDWR | O_NOCTTY, 0); - if (fd < 0) { - printk("Can't open serial port"); - return -1; - } - - sys_ioctl(fd, TCFLSH, TCIOFLUSH); - - /* Clear the cust flag */ - if((errno = sys_ioctl(fd, TIOCGSERIAL, &ss))<0){ - printk("BAUD: error to get the serial_struct info:%s\n", errno); - goto err; - } - - if (ss.flags & ASYNC_SPD_CUST) { - printk("clear ASYNC_SPD_CUST\r\n"); - ss.flags &= ~ASYNC_SPD_CUST; - } - if((errno = sys_ioctl(fd, TIOCSSERIAL, &ss))<0){ - printk("BAUD: error to set serial_struct:%s\n", errno); - goto err; - } - - if ((errno = sys_ioctl(fd, TCGETS, (long)&ti)) < 0) { - printk("unable to get UART port setting"); - printk("Can't get port settings"); - goto err; - } - - cfmakeraw(&ti); - - ti.c_cflag |= CLOCAL; - ti.c_cflag &= ~CRTSCTS; - ti.c_lflag = 0; - ti.c_cc[VTIME] = 5; /* 0.5 sec */ - ti.c_cc[VMIN] = 0; - - /* Set initial baudrate */ - cfsetospeed(&ti, B115200); - cfsetispeed(&ti, B115200); - - if ((errno = sys_ioctl(fd, TCSETS, (long)&ti)) < 0) { - printk("unable to set UART port setting"); - printk("Can't set port settings"); - goto err; - } - - errno = sys_ioctl(fd, TCFLSH, TCIOFLUSH); - if(errno < 0) - goto err; - - return fd; - -err: - if(fd > 0) - sys_close(fd); - - return -1; -} - -EXPORT_SYMBOL(rda_wlan_version); -EXPORT_SYMBOL(rda_wifi_init_uart); -EXPORT_SYMBOL(rda_5990_wifi_in_test_mode); - -EXPORT_SYMBOL(rda_5990_set_wake_lock); -EXPORT_SYMBOL(rda_wifi_power_off); -EXPORT_SYMBOL(rda_wifi_power_on); -EXPORT_SYMBOL(rda_fm_power_on); -EXPORT_SYMBOL(rda_fm_power_off); - -module_init(rda_5990_power_ctrl_init); -module_exit(rda_5990_power_ctrl_exit); - -MODULE_LICENSE("GPL"); - diff --git a/drivers/net/wireless/rda5990/rda_gpio_i2c/Makefile b/drivers/net/wireless/rda5990/rda_gpio_i2c/Makefile deleted file mode 100755 index 9a192865bdbf..000000000000 --- a/drivers/net/wireless/rda5990/rda_gpio_i2c/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright Statement: -# -# This software/firmware and related documentation ("MediaTek Software") are -# protected under relevant copyright laws. The information contained herein -# is confidential and proprietary to MediaTek Inc. and/or its licensors. -# Without the prior written permission of MediaTek inc. and/or its licensors, -# any reproduction, modification, use or disclosure of MediaTek Software, -# and information contained herein, in whole or in part, shall be strictly prohibited. -# -# MediaTek Inc. (C) 2010. All rights reserved. -# -# BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES -# THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") -# RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON -# AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. -# NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE -# SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR -# SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH -# THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES -# THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES -# CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK -# SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR -# STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND -# CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, -# AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, -# OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO -# MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. -# -# The following software/firmware and/or related documentation ("MediaTek Software") -# have been modified by MediaTek Inc. All revisions are subject to any receiver's -# applicable license agreements with MediaTek Inc. - - -# Makefile generated by Mediatek - -obj-y += rda_gpio_i2c.o - diff --git a/drivers/net/wireless/rda5990/rda_gpio_i2c/rda_gpio_i2c.c b/drivers/net/wireless/rda5990/rda_gpio_i2c/rda_gpio_i2c.c deleted file mode 100755 index 01a4277b0290..000000000000 --- a/drivers/net/wireless/rda5990/rda_gpio_i2c/rda_gpio_i2c.c +++ /dev/null @@ -1,460 +0,0 @@ -/* - * ===================================================================================== - * - * Filename: rda_gpio_i2c.c - * - * Description: - * - * Version: 1.0 - * Created: 04/19/2012 11:24:48 PM - * Revision: none - * Compiler: gcc - * - * Author: Allen_Hu - * Organization: RDA Inc. - * - * ===================================================================================== - */ -#include -#include -#include - -#include -#include - -#define RDA5990_WIFI_32K_FLAG 0x00000001 -#define RDA5990_BT_32K_FLAG 0x00000002 -#define RDA5990_FM_32K_FLAG 0x00000004 - -//#define DELAY 10 -#define DELAY 2 -// FM -#define SCL GPIO149 -#define SDA GPIO150 -// -/* WIFI -#define SCL GPIO104 -#define SDA GPIO102 -*/ - -#define u8 unsigned char - -//Data storage mode -static u8 isBigEnded = 0; - -//The global variable -static unsigned int gpioInitialized = 0; -static unsigned int rda5990_32k_state = 0; - -#define GPIO_MODE_00 0 -#define GPIO_DIR_OUT 1 -#define GPIO_DIR_IN 0 -#define GPIO_OUT_ONE 1 -#define GPIO_OUT_ZERO 0 - -void set_SDA_output(void) -{ - mt_set_gpio_mode(SDA, GPIO_MODE_00); - mt_set_gpio_dir(SDA, GPIO_DIR_OUT); -} - -void set_SDA_input(void) -{ - mt_set_gpio_mode(SDA, GPIO_MODE_00); - mt_set_gpio_dir(SDA, GPIO_DIR_IN); -} - -void set_SCL_output(void) -{ - mt_set_gpio_mode(SCL, GPIO_MODE_00); - mt_set_gpio_dir(SCL, GPIO_DIR_OUT); -} - -void set_SDA_high(void) -{ - mt_set_gpio_out(SDA, GPIO_OUT_ONE); -} - -void set_SDA_low(void) -{ - mt_set_gpio_out(SDA, GPIO_OUT_ZERO); -} - -void set_SCL_high(void) -{ - mt_set_gpio_out(SCL, GPIO_OUT_ONE); -} - -void set_SCL_low(void) -{ - mt_set_gpio_out(SCL, GPIO_OUT_ZERO); -} - -u8 get_SDA_bit(void) -{ - return mt_get_gpio_in(SDA); -} - -void i2c_delay(unsigned short cnt) -{ - udelay(cnt); -} - -//如果32k不能出来,请修改以下配置使能。 -void enable_32k_rtc(void) -{ - printk("enable 32k rtc called\n"); - rtc_gpio_enable_32k(RTC_GPIO_USER_GPS); - //rtc_gpio_enable_32k(RTC_GPIO_USER_WIFI); - //rtc_gpio_enable_32k(RTC_GPIO_USER_BT); - //rtc_gpio_enable_32k(RTC_GPIO_USER_WIFI); - rtc_gpio_enable_32k(RTC_GPIO_USER_FM); - msleep(100); -} - -void disable_32k_rtc(void) -{ - //rtc_gpio_disable_32k(RTC_GPIO_USER_WIFI); - rtc_gpio_enable_32k(RTC_GPIO_USER_GPS); - rtc_gpio_disable_32k(RTC_GPIO_USER_FM); - msleep(50); -} - -void i2c_start(void) -{ - set_SDA_output(); - set_SCL_output(); - - set_SDA_high(); - i2c_delay(DELAY); - set_SCL_high(); - i2c_delay(DELAY); - - set_SDA_low(); - i2c_delay(DELAY); - set_SCL_low(); - i2c_delay(DELAY); -} - -void i2c_stop(void) -{ - set_SDA_output(); - set_SCL_output(); - set_SDA_low(); - i2c_delay(DELAY); - set_SCL_high(); - i2c_delay(4*DELAY); - set_SDA_high(); - i2c_delay(4*DELAY); -} - - -/* - * return value: - * 0 --- 收到ACK - * 1 --- 没收到ACK - */ -u8 i2c_send_byte(u8 send_byte) -{ - u8 rc = 0; - u8 out_mask = 0x80; - u8 value; - u8 count = 8; - - set_SDA_output(); - set_SCL_output(); - - while(count > 0) { - set_SCL_low(); - i2c_delay(DELAY); - value = ((send_byte & out_mask) ? 1 : 0); - if (value == 1) { - set_SDA_high(); - } - else { - set_SDA_low(); - } - send_byte <<= 1; - i2c_delay(DELAY); - - set_SCL_high(); - i2c_delay(DELAY); - - count--; - } - set_SCL_low(); - set_SDA_input(); - i2c_delay(4*DELAY); - set_SCL_high(); - i2c_delay(DELAY); - rc = get_SDA_bit(); - i2c_delay(DELAY); - set_SCL_low(); - - return rc; -} - -/* - * ack = 0 发送ACK - * ack = 1 不发送ACK - */ -void i2c_read_byte(u8 *buffer, u8 ack) -{ - u8 count = 0x08; - u8 data = 0x00; - u8 temp = 0; - - set_SCL_output(); - while(count > 0) { - set_SCL_low(); - i2c_delay(2*DELAY); - if(count == 8) - set_SDA_input(); - i2c_delay(DELAY); - set_SCL_high(); - i2c_delay(2*DELAY); - temp = get_SDA_bit(); - data <<= 1; - if (temp) - data |= 0x01; - - i2c_delay(DELAY); - count--; - } - - set_SCL_low(); - i2c_delay(2*DELAY); - set_SDA_output(); - i2c_delay(DELAY); - if(ack){ - set_SDA_high(); - }else{ - set_SDA_low(); - } - i2c_delay(DELAY); - set_SCL_high(); - i2c_delay(2*DELAY); - - *buffer = data; - set_SCL_low(); -} - -/* -* write data to the I2C bus by GPIO simulated of a digital device rountine. -* -* @param -* chipAddr: address of the device -* regAddr: address of register within device -* data: the data to be written -* len: the data length -* -*/ -int rda_gpio_i2c_write_1_addr_2_data(u8 chipAddr, u8 regAddr, unsigned short data) -{ - u8 acknowledge; - int ret = 0; - i2c_start(); - - acknowledge = i2c_send_byte((chipAddr << 1) | 0x00); - if(acknowledge == 1){ - // return -1; - ret = -1; - goto out; - } - - acknowledge = i2c_send_byte(regAddr); - if(acknowledge == 1){ - ret = -1; - goto out; - } - - acknowledge = i2c_send_byte(data>>8); - if(acknowledge == 1){ - ret = -1; - goto out; - } - acknowledge = i2c_send_byte(data); - ret = acknowledge; - -out: - i2c_stop(); - - //return acknowledge; - return ret; -} -/* -* read data from the I2C bus by GPIO simulated of a digital device rountine. -* -* @param -* chipAddr: address of the device -* regAddr: address of register within device -* buffer: the data to be stored -* len: the data length -* -*/ -int rda_gpio_i2c_read_1_addr_2_data(u8 chipAddr, u8 regAddr, unsigned short *buffer) -{ - u8 tempdata, acknowledge; - int ret = 0; - - i2c_start(); - acknowledge = i2c_send_byte( (chipAddr << 1) | 0x00 ); - if(acknowledge == 1){ - ret = -1; - goto out; - } - acknowledge = i2c_send_byte(regAddr); - if(acknowledge == 1){ - ret = -1; - goto out; - } - - i2c_start();//restart - acknowledge = i2c_send_byte( (chipAddr << 1) | 0x01 ); - if(acknowledge == 1){ - ret = -1; - goto out; - } - - i2c_read_byte(&tempdata, 0); - *buffer = (tempdata<<8); - i2c_read_byte(&tempdata, 1); - *buffer |= tempdata; - -out: - i2c_stop(); -// return acknowledge; - return ret; -} - -u8 rda_gpio_i2c_write_4_addr_4_data(u8 chipAddr, unsigned int regAddr, unsigned int data) -{ - u8 acknowledge; - i2c_start(); - - acknowledge = i2c_send_byte((chipAddr << 1) | 0x00); - acknowledge = i2c_send_byte(regAddr>>24); - acknowledge = i2c_send_byte(regAddr>>16); - acknowledge = i2c_send_byte(regAddr>>8); - acknowledge = i2c_send_byte(regAddr); - - acknowledge = i2c_send_byte((chipAddr << 1) | 0x00); - - acknowledge = i2c_send_byte(data>>24); - acknowledge = i2c_send_byte(data>>16); - acknowledge = i2c_send_byte(data>>8); - acknowledge = i2c_send_byte(data); - - i2c_stop(); - return acknowledge; -} - -u8 rda_gpio_i2c_read_4_addr_4_data(u8 chipAddr, unsigned int regAddr, unsigned int *buffer) -{ - u8 tempdata, acknowledge; - u8 i = 0; - - i2c_start(); - acknowledge = i2c_send_byte( (chipAddr << 1) | 0x00 ); - acknowledge = i2c_send_byte(regAddr>>24); - acknowledge = i2c_send_byte(regAddr>>16); - acknowledge = i2c_send_byte(regAddr>>8); - acknowledge = i2c_send_byte(regAddr); - - i2c_start();//restart - acknowledge = i2c_send_byte( (chipAddr << 1) | 0x01 ); - - i2c_read_byte(&tempdata, 0); - *buffer = (tempdata<<24); - i2c_read_byte(&tempdata, 0); - *buffer |= (tempdata<<16); - i2c_read_byte(&tempdata, 0); - *buffer |= (tempdata<<8); - i2c_read_byte(&tempdata, 1); - *buffer |= tempdata; - - i2c_stop(); - return acknowledge; -} - -void rda_gpio_i2c_enable_32k(unsigned int flag) -{ - if(rda5990_32k_state == 0 ) - { - enable_32k_rtc(); - } - rda5990_32k_state |= (flag&0x07); -} - -void rda_gpio_i2c_disable_32k(unsigned int flag) -{ - rda5990_32k_state &= (~flag); - if(rda5990_32k_state == 0) - disable_32k_rtc(); -} - -/* -* initializes I2C interface routine. -* -* @return value: -* 0--success; -* 1--error. -* -*/ -static int __init rda_gpio_i2c_init(void) -{ - if(gpioInitialized == 0){ - printk(KERN_INFO "RDA GPIO control for I2C Driver \n"); - - unsigned char *temp = NULL; - unsigned short testData = 0xaa55; - temp = (unsigned char *)&testData; - if(*temp == 0x55){ - isBigEnded = 0; - }else{ - isBigEnded = 1; - } - - - gpioInitialized = 1; - rda_gpio_i2c_enable_32k(RDA5990_FM_32K_FLAG); - - /* FM - unsigned short regValue = 0; - rda_gpio_i2c_read_1_addr_2_data(0x11, 0x0C, ®Value); - printk(KERN_ALERT "####[%s, %d], Addr=%02X, value=%04X\n", __func__, __LINE__, 0x0C, regValue); - */ - /*WIFI - unsigned short regValue = 0x0001; - rda_gpio_i2c_write_1_addr_2_data(0x14, 0x3f, regValue); - regValue = 0; - rda_gpio_i2c_read_1_addr_2_data(0x14, 0x3f, ®Value); - printk(KERN_ALERT "####[%s, %d], Addr=%02X, value=%04X\n", __func__, __LINE__, 0x3f, regValue); - regValue = 0; - rda_gpio_i2c_read_1_addr_2_data(0x14, 0x20, ®Value); - printk(KERN_ALERT "####[%s, %d], Addr=%02X, value=%04X\n", __func__, __LINE__, 0x20, regValue); - */ - - return 0; - }else{ - printk("RDA GPIO control for I2C has been initialized.\n"); - return 0; - } -} - -static void __exit rda_gpio_i2c_exit(void) -{ - gpioInitialized = 0; - rda_gpio_i2c_disable_32k(RDA5990_FM_32K_FLAG); -} - -EXPORT_SYMBOL(rda_gpio_i2c_read_1_addr_2_data); -EXPORT_SYMBOL(rda_gpio_i2c_write_1_addr_2_data); -EXPORT_SYMBOL(rda_gpio_i2c_enable_32k); -EXPORT_SYMBOL(rda_gpio_i2c_disable_32k); - -EXPORT_SYMBOL(rda_gpio_i2c_read_4_addr_4_data); -EXPORT_SYMBOL(rda_gpio_i2c_write_4_addr_4_data); - -module_init(rda_gpio_i2c_init); /* load the module */ -module_exit(rda_gpio_i2c_exit); /* unload the module */ diff --git a/drivers/net/wireless/rda5990/rda_wlan/Makefile b/drivers/net/wireless/rda5990/rda_wlan/Makefile deleted file mode 100755 index e8c121fbc5bc..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -obj-m := rda5890.o -rda5890-objs := \ - rda5890_if_sdio.o \ - rda5890_dev.o \ - rda5890_txrx.o \ - rda5890_wid.o \ - rda5890_wext.o \ - rda5890_debugfs.o\ - rda5890_sdio_patch.o\ - rda5890_nvram.o\ - rda5890_scan.o - -KERNEL_DIR = /home/dxj/share/rk2928/kernel - -all: - make -C $(KERNEL_DIR) M=`pwd` modules - -clean: - rm -f Module.symvers *.o modules.order *.ko wifi_launcher.mod.c - rm -rf .wifi* .tmp* wlan.mod.c \ No newline at end of file diff --git a/drivers/net/wireless/rda5990/rda_wlan/Makefile_gwl b/drivers/net/wireless/rda5990/rda_wlan/Makefile_gwl deleted file mode 100755 index 92c6886421e2..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/Makefile_gwl +++ /dev/null @@ -1,23 +0,0 @@ -MODULE_NAME = rda5890 -CONFIG_RDA5890 = m -$(MODULE_NAME)-y += \ - rda5890_if_sdio.o \ - rda5890_dev.o \ - rda5890_txrx.o \ - rda5890_wid.o \ - rda5890_wext.o \ - rda5890_debugfs.o\ - rda5890_sdio_patch.o\ - rda5890_nvram.o\ - rda5890_scan.o - -obj-$(CONFIG_RDA5890) += $(MODULE_NAME).o - -KERNEL_DIR = /home/dxj/share/rk2928/kernel - -all: - make -C $(KERNEL_DIR) M=`pwd` modules - -clean: - rm -f Module.symvers *.o modules.order *.ko wifi_launcher.mod.c - rm -rf .wifi* .tmp* wlan.mod.c \ No newline at end of file diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_debugfs.c b/drivers/net/wireless/rda5990/rda_wlan/rda5890_debugfs.c deleted file mode 100755 index 2ab7b1f0297e..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_debugfs.c +++ /dev/null @@ -1,593 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "rda5890_defs.h" -#include "rda5890_dev.h" - -static struct dentry *rda5890_dir = NULL; - -void dump_buf(char *data, size_t len) -{ - char temp_buf[64]; - size_t i, off = 0; - - memset(temp_buf, 0, 64); - for (i=0;iprivate_data = inode->i_private; - return 0; -} - -#if 0 -static ssize_t rda5890_write_file_dummy(struct file *file, const char __user *buf, - size_t count, loff_t *ppos) -{ - return -EINVAL; -} -#endif - -static ssize_t rda5890_debug_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - //struct rda5890_private *priv = file->private_data; - size_t pos = 0; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - ssize_t res; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "%s\n", __func__); - - pos += snprintf(buf+pos, PAGE_SIZE - pos, "state = %s\n", - "LWANG_TESTING"); - - res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - - free_page(addr); - return res; -} - -static ssize_t rda5890_debug_write(struct file *file, - const char __user *user_buf, size_t count, - loff_t *ppos) -{ - //struct rda5890_private *priv = file->private_data; - ssize_t ret; - int p1, p2, p3, p4; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "%s\n", __func__); - - if (copy_from_user(buf, user_buf, count)) { - ret = -EFAULT; - goto out_unlock; - } - ret = sscanf(buf, "%d %d %d %d", &p1, &p2, &p3, &p4); - if (ret != 4) { - ret = -EINVAL; - goto out_unlock; - } - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "input p1 = %d, p2 = %d, p3 = %d, p4 = %d\n", - p1, p2, p3, p4); - - ret = count; -out_unlock: - free_page(addr); - return ret; -} - -static ssize_t rda5890_debugarea_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - //struct rda5890_private *priv = file->private_data; - size_t pos = 0; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - ssize_t res; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "%s\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "get debug_area = 0x%x\n",rda5890_dbg_area); - - pos += snprintf(buf+pos, PAGE_SIZE - pos, "%x\n", - rda5890_dbg_area); - - res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - - free_page(addr); - return res; -} - -static ssize_t rda5890_debugarea_write(struct file *file, - const char __user *user_buf, size_t count, - loff_t *ppos) -{ - //struct rda5890_private *priv = file->private_data; - ssize_t ret; - int debug_area; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "%s\n", __func__); - - if (copy_from_user(buf, user_buf, count)) { - ret = -EFAULT; - goto out_unlock; - } - ret = sscanf(buf, "%x", &debug_area); - if (ret != 1) { - ret = -EINVAL; - goto out_unlock; - } - - rda5890_dbg_area = debug_area; - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "set debug_area = 0x%x\n",rda5890_dbg_area); - - ret = count; -out_unlock: - free_page(addr); - return ret; -} - -static ssize_t rda5890_debuglevel_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - //struct rda5890_private *priv = file->private_data; - size_t pos = 0; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - ssize_t res; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "%s\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "get debug_level = 0x%x\n",rda5890_dbg_level); - - pos += snprintf(buf+pos, PAGE_SIZE - pos, "%x\n", - rda5890_dbg_level); - - res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); - - free_page(addr); - return res; -} - -static ssize_t rda5890_debuglevel_write(struct file *file, - const char __user *user_buf, size_t count, - loff_t *ppos) -{ - //struct rda5890_private *priv = file->private_data; - ssize_t ret; - int debug_level; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "%s\n", __func__); - - if (copy_from_user(buf, user_buf, count)) { - ret = -EFAULT; - goto out_unlock; - } - ret = sscanf(buf, "%x", &debug_level); - if (ret != 1) { - ret = -EINVAL; - goto out_unlock; - } - - rda5890_dbg_level = debug_level; - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "set debug_level = 0x%x\n",rda5890_dbg_level); - - ret = count; -out_unlock: - free_page(addr); - return ret; -} - -static int debug_read_flag = 0; - -static ssize_t rda5890_sdio_read(struct file *file, - const char __user *user_buf, size_t count, - loff_t *ppos) -{ - //struct rda5890_private *priv = file->private_data; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - int ret; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "%s\n", __func__); - - if (copy_from_user(buf, user_buf, count)) { - ret = -EFAULT; - goto out_unlock; - } - ret = sscanf(buf, "%d", &debug_read_flag); - if (ret != 1) { - ret = -EINVAL; - goto out_unlock; - } - -out_unlock: - free_page(addr); - return count; -} - -static ssize_t rda5890_sdio_write(struct file *file, - const char __user *user_buf, size_t count, - loff_t *ppos) -{ - struct rda5890_private *priv = file->private_data; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - int iter, len, i; - int ret; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "%s\n", __func__); - - if (copy_from_user(buf, user_buf, count)) { - ret = -EFAULT; - goto out_unlock; - } - ret = sscanf(buf, "%d %d", &iter, &len); - if (ret != 2) { - ret = -EINVAL; - goto out_unlock; - } - - if (len > 1660) { - ret = -EINVAL; - goto out_unlock; - } - - for (i=0; ihw_host_to_card(priv, buf, len, DATA_REQUEST_PACKET); - - //RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - // "Host to Card done, ret = %d\n", ret); - } - -out_unlock: - free_page(addr); - return count; -} - -#define SDIO_TEST_CMD_MAGIC 0x55664433 -#define SDIO_TEST_CMD_LEN 16 - -#define SDIO_TEST_CMD_TYPE_H2C_START 1 -#define SDIO_TEST_CMD_TYPE_H2C_STOP 2 -#define SDIO_TEST_CMD_TYPE_H2C_STATUS 3 -#define SDIO_TEST_CMD_TYPE_C2H_START 4 -#define SDIO_TEST_CMD_TYPE_C2H_PILOT 5 -#define SDIO_TEST_CMD_TYPE_C2H_END 6 - -static int recv_time_start, recv_time_end; -static int send_time_start, send_time_end; - -void rda5890_sdio_test_card_to_host(char *buf, unsigned short len) -{ - int i; - int cmd, cmd_iter, cmd_len; - int time_ms; - static int recv_pattern = 0; - static int recv_tput_flag = 0; - static int recv_pkts = 0; - static int recv_bytes = 0; - - //RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - // "SDIO TEST Card to Host, len = %d\n", len); - - if (debug_read_flag) { - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "DEBUG RX, len = %d\n", len); - dump_buf(buf, len); - } - - if ((*(volatile unsigned long *)buf == SDIO_TEST_CMD_MAGIC) - && len == SDIO_TEST_CMD_LEN) { - cmd = (int)(*(volatile unsigned long *)(buf + 4)); - cmd_iter = (int)(*(volatile unsigned long *)(buf + 8)); - cmd_len = (int)(*(volatile unsigned long *)(buf + 12)); - //RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - // "SDIO TEST CMD: cmd = %d, iter = %d, len = %d\n", - // cmd, cmd_iter, cmd_len); - switch (cmd) { - case SDIO_TEST_CMD_TYPE_H2C_STATUS: - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "H2C STATUS CMD \n"); - time_ms = jiffies_to_msecs(send_time_end - send_time_start); - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "SDIO H2C STATUS: pkts = %d, bytes = %d, time = %d ms\n", - cmd_iter, cmd_len, time_ms); - break; - case SDIO_TEST_CMD_TYPE_C2H_PILOT: - //RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - // "C2H PILOT CMD \n"); - recv_pattern = 0; - recv_tput_flag = 1; - recv_pkts = 0; - recv_bytes = 0; - recv_time_start = jiffies; - break; - case SDIO_TEST_CMD_TYPE_C2H_END: - //RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - // "C2H END CMD \n"); - recv_time_end = jiffies; - recv_tput_flag = 0; - time_ms = jiffies_to_msecs(recv_time_end - recv_time_start); - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "SDIO C2H STATUS: pkts = %d, bytes = %d, time = %d ms\n", - recv_pkts, recv_bytes, time_ms); - break; - case SDIO_TEST_CMD_TYPE_H2C_START: - case SDIO_TEST_CMD_TYPE_H2C_STOP: - case SDIO_TEST_CMD_TYPE_C2H_START: - default: - RDA5890_ERRP("SDIO TEST CMD: Invalid cmd %d\n", cmd); - break; - } - return; - } - - for (i=0;ihw_host_to_card(priv, cmd, len ,SDIO_TEST_CMD_LEN); - if (ret) { - RDA5890_ERRP("START cmd send fail, ret = %d\n", ret); - } -} - -static void sdio_tput_test_write(struct rda5890_private *priv, int iter, int len) -{ - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf_1 = (char *)addr; - char *buf_2 = (char *)addr + PAGE_SIZE/2; - char cmd[SDIO_TEST_CMD_LEN]; - int i; - int ret; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "%s, iter = %d, len = %d\n", __func__, iter, len); - - for (i=0; ihw_host_to_card(priv, cmd, len,SDIO_TEST_CMD_LEN); - if (ret) { - RDA5890_ERRP("START cmd send fail, ret = %d\n", ret); - goto out; - } - - send_time_start = jiffies; - for (i=0;ihw_host_to_card(priv, buf_1, len, DATA_REQUEST_PACKET); - else - ret = priv->hw_host_to_card(priv, buf_2, len, DATA_REQUEST_PACKET); - if (ret) { - RDA5890_ERRP("packet %d send fail, ret = %d\n", i, ret); - goto out; - } - } - send_time_end = jiffies; - - (*(volatile unsigned long *)(cmd + 0)) = SDIO_TEST_CMD_MAGIC; - (*(volatile unsigned long *)(cmd + 4)) = SDIO_TEST_CMD_TYPE_H2C_STOP; - (*(volatile unsigned long *)(cmd + 8)) = iter; - (*(volatile unsigned long *)(cmd + 12)) = len; - ret = priv->hw_host_to_card(priv, cmd, len, SDIO_TEST_CMD_LEN); - if (ret) { - RDA5890_ERRP("START cmd send fail, ret = %d\n", ret); - goto out; - } - -out: - free_page(addr); -} - -static ssize_t rda5890_sdio_tput(struct file *file, - const char __user *user_buf, size_t count, - loff_t *ppos) -{ - struct rda5890_private *priv = file->private_data; - int ret; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *)addr; - int wr, iter, len; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "%s\n", __func__); - - if (copy_from_user(buf, user_buf, count)) { - ret = -EFAULT; - goto out_unlock; - } - ret = sscanf(buf, "%d %d %d", &wr, &iter, &len); - if (ret != 3) { - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "Error Input, format shall be [wr iter len]\n"); - ret = -EINVAL; - goto out_unlock; - } - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "input wr = %d, iter = %d, len = %d\n", - wr, iter, len); - - if (wr) - sdio_tput_test_write(priv, iter, len); - else - sdio_tput_test_read(priv, iter, len); - - ret = count; -out_unlock: - free_page(addr); - return ret; -} - -#define FOPS(fread, fwrite) { \ - .owner = THIS_MODULE, \ - .open = open_file_generic, \ - .read = (fread), \ - .write = (fwrite), \ -} - -struct rda5890_debugfs_files { - char *name; - int perm; - struct file_operations fops; -}; - -static struct rda5890_debugfs_files debugfs_files[] = { - { "debug", 0444, FOPS(rda5890_debug_read, rda5890_debug_write), }, - { "debugarea", 0444, FOPS(rda5890_debugarea_read, rda5890_debugarea_write), }, - { "debuglevel", 0444, FOPS(rda5890_debuglevel_read, rda5890_debuglevel_write), }, - { "sdioread", 0444, FOPS(NULL, rda5890_sdio_read), }, - { "sdiowrite", 0444, FOPS(NULL, rda5890_sdio_write), }, - { "sdiotput", 0444, FOPS(NULL, rda5890_sdio_tput), }, -}; - -void rda5890_debugfs_init(void) -{ - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s\n", __func__); - - if (!rda5890_dir) - rda5890_dir = debugfs_create_dir("rda5890", NULL); - - return; -} - -void rda5890_debugfs_remove(void) -{ - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s\n", __func__); - - if (rda5890_dir) - debugfs_remove(rda5890_dir); - - return; -} - -void rda5890_debugfs_init_one(struct rda5890_private *priv) -{ - int i; - struct rda5890_debugfs_files *files; - if (!rda5890_dir) - goto exit; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s\n", __func__); - - priv->debugfs_dir = debugfs_create_dir("rda5890_dev", rda5890_dir); - if (!priv->debugfs_dir) - goto exit; - - for (i=0; idebugfs_files[i] = debugfs_create_file(files->name, - files->perm, - priv->debugfs_dir, - priv, - &files->fops); - } - -exit: - return; -} - -void rda5890_debugfs_remove_one(struct rda5890_private *priv) -{ - int i; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s\n", __func__); - - for(i=0; idebugfs_files[i]); - debugfs_remove(priv->debugfs_dir); -} - diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_debugfs.h b/drivers/net/wireless/rda5990/rda_wlan/rda5890_debugfs.h deleted file mode 100755 index b42bc4e410c6..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_debugfs.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _RDA5890_DEBUGFS_H_ -#define _RDA5890_DEBUGFS_H_ - -void rda5890_debugfs_init(void); -void rda5890_debugfs_remove(void); - -void rda5890_debugfs_init_one(struct rda5890_private *priv); -void rda5890_debugfs_remove_one(struct rda5890_private *priv); - -/* This is for SDIO testing */ -void rda5890_sdio_test_card_to_host(char *buf, unsigned short len); - -#endif diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_defs.h b/drivers/net/wireless/rda5990/rda_wlan/rda5890_defs.h deleted file mode 100755 index ef8e114b006a..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_defs.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef _RDA5890_DEFS_H_ -#define _RDA5890_DEFS_H_ - -#include - -#define RDA5890_SDIOWIFI_VER_MAJ 0 -#define RDA5890_SDIOWIFI_VER_MIN 3 -#define RDA5890_SDIOWIFI_VER_BLD 1 - -#define WIFI_POWER_MANAGER //if need wifi sleep for power save should open this - - -#define WIFI_UNLOCK_SYSTEM -#define GET_SCAN_FROM_NETWORK_INFO - -#define USE_MAC_DYNAMIC_ONCE -//#define WIFI_TEST_MODE - -#define DEBUG - -extern int rda5890_dbg_level; -extern int rda5890_dbg_area; - -typedef enum { - RDA5890_DL_ALL = 0, - RDA5890_DL_CRIT = 1, - RDA5890_DL_TRACE = 2, - RDA5890_DL_NORM = 3, - RDA5890_DL_DEBUG = 4, - RDA5890_DL_VERB = 5, -} RDA5890_DBG_LEVEL; - -#define RDA5890_DA_MAIN (1 << 0) -#define RDA5890_DA_SDIO (1 << 1) -#define RDA5890_DA_ETHER (1 << 2) -#define RDA5890_DA_WID (1 << 3) -#define RDA5890_DA_WEXT (1 << 4) -#define RDA5890_DA_TXRX (1 << 5) -#define RDA5890_DA_PM (1 << 6) -#define RDA5890_DA_ALL 0x0000007f - -#define RDA5890_LOG "RDA5890: " -#ifndef DEBUG -#define DEBUG -#endif - -#ifdef DEBUG -#define RDA5890_DBGLA(area, lvl) \ - (((lvl)<=rda5890_dbg_level) && ((area)&rda5890_dbg_area)) -#define RDA5890_DBGLAP(area,lvl, x...) \ - do{ \ - if (((lvl)<=rda5890_dbg_level) && ((area)&rda5890_dbg_area)) \ - printk(KERN_INFO RDA5890_LOG x ); \ - }while(0) -#define RDA5890_DBGP(x...) \ - do{ \ - printk(KERN_INFO RDA5890_LOG x ); \ - }while(0) -#else -#define RDA5890_DBGLA(area, lvl) 0 -#define RDA5890_DBGLAP(area,lvl, x...) do {} while (0) -#define RDA5890_DBGP(x...) do {} while (0) -#endif - -#define RDA5890_ERRP(fmt, args...) \ - do{ \ - printk(KERN_ERR RDA5890_LOG "%s: "fmt, __func__, ## args ); \ - }while(0) - -#endif - diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_dev.c b/drivers/net/wireless/rda5990/rda_wlan/rda5890_dev.c deleted file mode 100755 index 8bea49c2a084..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_dev.c +++ /dev/null @@ -1,633 +0,0 @@ -/** - * This file contains the major functions in WLAN - * driver. It includes init, exit, open, close and main - * thread etc.. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include - - -#include "rda5890_defs.h" -#include "rda5890_dev.h" -#include "rda5890_ioctl.h" -#include "rda5890_wid.h" -#include "rda5890_wext.h" -#include "rda5890_txrx.h" -#include "rda5890_if_sdio.h" - -int rda5890_sleep_flags = RDA_SLEEP_ENABLE | RDA_SLEEP_PREASSO; - -#ifdef WIFI_UNLOCK_SYSTEM -atomic_t wake_lock_counter; -struct wake_lock sleep_worker_wake_lock; -#endif - - -int rda5890_init_pm(struct rda5890_private *priv) -{ -#ifdef WIFI_POWER_MANAGER - int ret = 0; - struct if_sdio_card *card = (struct if_sdio_card *)priv->card; - -#ifdef WIFI_TEST_MODE - if(rda_5990_wifi_in_test_mode()) - return 0; -#endif - if (rda5890_sleep_flags & RDA_SLEEP_ENABLE) - { - ret = rda5890_set_pm_mode(priv, 2); - if(ret < 0) - goto err; - } - if (rda5890_sleep_flags & RDA_SLEEP_PREASSO) - { - ret = rda5890_set_preasso_sleep(priv, 0x00800080); - if(ret < 0) - goto err; - } - - sdio_claim_host(card->func); - sdio_writeb(card->func, 1, IF_SDIO_FUN1_INT_TO_DEV, &ret); - sdio_release_host(card->func); - if (ret) { - RDA5890_ERRP("write FUN1_INT_TO_DEV reg fail\n"); - } - - atomic_inc(&priv->sleep_flag); - -err: - return ret; -#else - return 0; -#endif -} - - -int rda5890_disable_self_cts(struct rda5890_private *priv) -{ - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set rda5890_disable_self_cts 0x%02x\n", 0); - - ret = rda5890_generic_set_uchar(priv, WID_PTA_MODE, 0); - if(ret < 0) - goto err; - return 0; - -err: - return ret; -} - -int rda5890_disable_block_bt(struct rda5890_private *priv) -{ - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set rda5890_disable_block_bt 0x%02x\n", 0); - - ret = rda5890_generic_set_uchar(priv, WID_PTA_BLOCK_BT, 0); - if(ret < 0) - goto err; - - return 0; - -err: - return ret; -} - -//rda5890_set_scan_timeout has defined WID_ACTIVE_SCAN_TIME so if you call that func, not need call this -int rda5890_set_active_scan_time(struct rda5890_private *priv) -{ - int ret = 0; - ret= rda5890_generic_set_ushort(priv, WID_ACTIVE_SCAN_TIME, 200); - if(ret < 0) - goto err; - return 0; - err: - return ret; -} - -/** - * @brief This function opens the ethX or mshX interface - * - * @param dev A pointer to net_device structure - * @return 0 or -EBUSY if monitor mode active - */ -static int rda5890_dev_open(struct net_device *dev) -{ - struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - if (priv->connect_status == MAC_CONNECTED) - netif_carrier_on(dev); - else - netif_carrier_off(dev); - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); - return ret; -} - -/** - * @brief This function closes the ethX interface - * - * @param dev A pointer to net_device structure - * @return 0 - */ -static int rda5890_eth_stop(struct net_device *dev) -{ - //struct rda5890_private *priv = (struct rda5890_private *) dev->priv; - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - netif_stop_queue(dev); - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); - return 0; -} - -static void rda5890_tx_timeout(struct net_device *dev) -{ - //struct rda5890_private *priv = (struct rda5890_private *) dev->priv; - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); -} - -/** - * @brief This function returns the network statistics - * - * @param dev A pointer to struct lbs_private structure - * @return A pointer to net_device_stats structure - */ -static struct net_device_stats *rda5890_get_stats(struct net_device *dev) -{ - struct rda5890_private *priv = (struct rda5890_private *) netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); - return &priv->stats; -} - -static int rda5890_set_mac_address(struct net_device *dev, void *addr) -{ - int ret = 0; - struct rda5890_private *priv = (struct rda5890_private *) netdev_priv(dev); - struct sockaddr *phwaddr = addr; - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - ret = rda5890_set_mac_addr(priv, phwaddr->sa_data); - if (ret) { - goto done; - } - memcpy(priv->dev->dev_addr, phwaddr->sa_data, ETH_ALEN); - -done: - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); - return ret; -} - -static void rda5890_set_multicast_list(struct net_device *dev) -{ - //struct rda5890_private *priv = dev->priv; - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - //schedule_work(&priv->mcast_work); - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); -} - -/** - * @brief This function checks the conditions and sends packet to IF - * layer if everything is ok. - * - * @param priv A pointer to struct lbs_private structure - * @param skb A pointer to skb which includes TX packet - * @return 0 or -1 - */ -int rda5890_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) -{ - struct rda5890_private *priv = (struct rda5890_private*)netdev_priv(dev); -#ifdef WIFI_TEST_MODE - if(rda_5990_wifi_in_test_mode()) - return 0; -#endif //end WIFI_TEST_MODE - return rda5890_data_tx(priv, skb, dev); -} - -static int rda5890_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - int ret = 0; - struct rda5890_private *priv = netdev_priv(dev); - unsigned long value; - char in_buf[MAX_CMD_LEN + 4], out_buf[MAX_CMD_LEN + 4]; - unsigned short in_len, out_len, out_len_ret; - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s >>>, cmd = %x\n", __func__, cmd); - - switch (cmd) { - case IOCTL_RDA5890_GET_MAGIC: - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "IOCTL_RDA5890_GET_MAGIC\n"); - value = RDA5890_MAGIC; - if (copy_to_user(rq->ifr_data, &value, sizeof(value))) - ret = -EFAULT; - break; - case IOCTL_RDA5890_GET_DRIVER_VER: - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "IOCTL_RDA5890_GET_DRIVER_VER\n"); - value = RDA5890_SDIOWIFI_VER_MAJ << 16 | - RDA5890_SDIOWIFI_VER_MIN << 8 | - RDA5890_SDIOWIFI_VER_BLD; - if (copy_to_user(rq->ifr_data, &value, sizeof(value))) - ret = -EFAULT; - break; - case IOCTL_RDA5890_MAC_GET_FW_VER: - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "IOCTL_RDA5890_MAC_GET_FW_VER\n"); - ret = rda5890_get_fw_ver(priv, &value); - if (ret) - break; - if (copy_to_user(rq->ifr_data, &value, sizeof(value))) - ret = -EFAULT; - break; - case IOCTL_RDA5890_MAC_WID: - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "IOCTL_RDA5890_MAC_WID\n"); - if (copy_from_user(in_buf, rq->ifr_data, 4)) { - ret = -EFAULT; - break; - } - in_len = (unsigned short)(in_buf[0] + (in_buf[1] << 8)); - out_len = (unsigned short)(in_buf[2] + (in_buf[3] << 8)); - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - " in_len = %d, out_len = %d\n", in_len, out_len); - if (copy_from_user(in_buf, rq->ifr_data, 4 + in_len)) { - ret = -EFAULT; - break; - } - out_len_ret = MAX_CMD_LEN; - ret = rda5890_wid_request(priv, in_buf + 4, in_len, out_buf + 4, &out_len_ret); - if (ret) { - RDA5890_ERRP("rda5890_wid_request, ret = %d\n", ret); - break; - } - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - " out_len_ret = %d\n", out_len_ret); - if (out_len_ret > out_len) { - RDA5890_ERRP("No enough buf for wid response\n"); - ret = -ENOMEM; - break; - } - out_buf[2] = (char)(out_len_ret&0x00FF); - out_buf[3] = (char)((out_len_ret&0xFF00) >> 8); - if (copy_to_user(rq->ifr_data, out_buf, 4 + out_len_ret)) - ret = -EFAULT; - break; - case IOCTL_RDA5890_SET_WAPI_ASSOC_IE: - if(copy_from_user(in_buf, rq->ifr_data, 100)) { - ret = -EFAULT; - break; - } - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "IOCTL_RDA5890_SET_WAPI_ASSOC_IE is %x %x %x %x \n", - in_buf[0], in_buf[1],in_buf[2],in_buf[3]); - rda5890_generic_set_str(priv, WID_WAPI_ASSOC_IE, in_buf ,100); - break; - case IOCTL_RDA5890_GET_WAPI_ASSOC_IE: - rda5890_generic_get_str(priv, WID_WAPI_ASSOC_IE, out_buf, 100); - if (copy_to_user(rq->ifr_data, out_buf, 100)) - ret = -EFAULT; - break; - default: - RDA5890_ERRP("unknown cmd 0x%x\n", cmd); - ret = -EFAULT; - break; - } - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); - return ret; -} - -static int rda5890_init_adapter(struct rda5890_private *priv) -{ - int ret = 0; - size_t bufsize; - int i; - - mutex_init(&priv->wid_lock); -#ifdef WIFI_POWER_MANAGER - atomic_set(&priv->sleep_flag, 0); -#endif - priv->wid_pending = 0; - priv->wid_msg_id = 0; - - /* Allocate buffer to store the BSSID list */ - bufsize = RDA5890_MAX_NETWORK_NUM * sizeof(struct bss_descriptor); - priv->networks = kzalloc(bufsize, GFP_KERNEL); - if (!priv->networks) { - RDA5890_ERRP("Out of memory allocating beacons\n"); - ret = -1; - goto out; - } - - /* Initialize scan result lists */ - INIT_LIST_HEAD(&priv->network_free_list); - INIT_LIST_HEAD(&priv->network_list); - for (i = 0; i < RDA5890_MAX_NETWORK_NUM; i++) { - list_add_tail(&priv->networks[i].list, - &priv->network_free_list); - } - priv->scan_running = 0; - - /* Initialize delayed work workers and thread */ - priv->work_thread = create_singlethread_workqueue("rda5890_worker"); - INIT_DELAYED_WORK(&priv->scan_work, rda5890_scan_worker); - INIT_DELAYED_WORK(&priv->assoc_work, rda5890_assoc_worker); - INIT_DELAYED_WORK(&priv->assoc_done_work, rda5890_assoc_done_worker); - INIT_DELAYED_WORK(&priv->wlan_connect_work, rda5890_wlan_connect_worker); - - /* Initialize status */ - priv->connect_status = MAC_DISCONNECTED; - memset(&priv->curbssparams, 0, sizeof(priv->curbssparams)); - memset(&priv->wstats, 0, sizeof(priv->wstats)); - - /* Initialize sec related status */ - priv->assoc_flags = 0; - priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - memset(&priv->wep_keys, 0, sizeof(priv->wep_keys)); - memset(&priv->wpa_ie[0], 0, sizeof(priv->wpa_ie)); - priv->wpa_ie_len = 0; - priv->first_init = 1; - -out: - return ret; -} - -static void rda5890_free_adapter(struct rda5890_private *priv) -{ - cancel_delayed_work_sync(&priv->assoc_done_work); - cancel_delayed_work_sync(&priv->assoc_work); - cancel_delayed_work_sync(&priv->scan_work); - cancel_delayed_work_sync(&priv->wlan_connect_work); - destroy_workqueue(priv->work_thread); - - if(priv->networks) - kfree(priv->networks); - priv->networks = NULL; -} - -static const struct net_device_ops rda_netdev_ops = { - .ndo_open = rda5890_dev_open, - .ndo_stop = rda5890_eth_stop, - .ndo_start_xmit = rda5890_hard_start_xmit, - .ndo_set_mac_address = rda5890_set_mac_address, - .ndo_tx_timeout = rda5890_tx_timeout, - .ndo_get_stats = rda5890_get_stats, - .ndo_do_ioctl = rda5890_ioctl -}; - -/** - * @brief This function adds the card. it will probe the - * card, allocate the lbs_priv and initialize the device. - * - * @param card A pointer to card - * @return A pointer to struct lbs_private structure - */ -struct rda5890_private *rda5890_add_card(void *card) -{ - struct net_device *dev = NULL; - struct rda5890_private *priv = NULL; - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - /* Allocate an Ethernet device and register it */ - dev = alloc_netdev_mq(sizeof(struct rda5890_private), "wlan%d", ether_setup, 1); - if (!dev) { - RDA5890_ERRP("alloc_etherdev failed\n"); - goto done; - } - priv = netdev_priv(dev); - - if(rda5890_init_adapter(priv)){ - RDA5890_ERRP("rda5890_init_adapter failed\n"); - goto err_init_adapter; - } - - priv->dev = dev; - priv->card = card; - - /* Setup the OS Interface to our functions */ - dev->netdev_ops = &rda_netdev_ops; - dev->watchdog_timeo = msecs_to_jiffies(450); //450ms - - //dev->ethtool_ops = &lbs_ethtool_ops; -#ifdef WIRELESS_EXT - dev->wireless_handlers = (struct iw_handler_def *)&rda5890_wext_handler_def; -#endif - dev->flags |= IFF_BROADCAST | IFF_MULTICAST; - - goto done; - -err_init_adapter: - if(priv) - rda5890_free_adapter(priv); - if(dev) - free_netdev(dev); - priv = NULL; - -done: - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); - return priv; -} - -void rda5890_remove_card(struct rda5890_private *priv) -{ - struct net_device *dev = priv->dev; - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - dev = priv->dev; - - rda5890_free_adapter(priv); - - priv->dev = NULL; - if(dev) - free_netdev(dev); - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); -} - -int rda5890_start_card(struct rda5890_private *priv) -{ - struct net_device *dev = priv->dev; - int ret = 0; - unsigned char mac_addr[ETH_ALEN]; - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); - -#ifdef WIFI_TEST_MODE - if(!rda_5990_wifi_in_test_mode()) - { -#endif - -#ifdef USE_MAC_DYNAMIC_ONCE - if(rda5890_read_mac(mac_addr) != ETH_ALEN) - { - random_ether_addr(mac_addr); - rda5890_write_mac(mac_addr); - } - -#else - mac_addr[0] = 0x00; - mac_addr[1] = 0xc0; - mac_addr[2] = 0x52; - - mac_addr[3] = 0x00; - mac_addr[4] = 0xc0; - mac_addr[5] = 0x53; -#endif - ret = rda5890_set_mac_addr(priv, mac_addr); - if (ret) - { - goto done; - } - - ret = rda5890_get_mac_addr(priv, mac_addr); - if (ret) { - goto done; - } - memcpy(priv->dev->dev_addr, mac_addr, ETH_ALEN); - -#ifdef WIFI_TEST_MODE - } -#endif - - if (register_netdev(dev)) { - RDA5890_ERRP("register_netdev failed\n"); - goto done; - } - -#ifdef WIFI_TEST_MODE - if(!rda_5990_wifi_in_test_mode()) - { -#endif - - rda5890_set_preamble(priv, G_AUTO_PREAMBLE); - - rda5890_indicate_disconnected(priv); -#ifdef WIFI_TEST_MODE - } -#endif - - -done: - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - return ret; -} - -void rda5890_stop_card(struct rda5890_private *priv) -{ - struct net_device *dev = priv->dev; - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - rda5890_indicate_disconnected(priv); - unregister_netdev(dev); - - RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); -} - -void rda5890_shedule_timeout(int msecs) -{ - int timeout = 0, expires = 0; - expires = jiffies + msecs_to_jiffies(msecs); - timeout = msecs; - - while(timeout) - { - timeout = schedule_timeout(timeout); - - if(time_after(jiffies, expires)) - break; - } -} - -#ifdef WIFI_UNLOCK_SYSTEM - -void rda5990_wakeLock(void) -{ - if(atomic_read(&wake_lock_counter) == 0) - wake_lock(&sleep_worker_wake_lock); - atomic_inc(&wake_lock_counter); -} - -void rda5990_wakeUnlock(void) -{ - - if(atomic_read(&wake_lock_counter) == 1) - { - atomic_set(&wake_lock_counter, 0); - wake_unlock(&sleep_worker_wake_lock); - } - else if(atomic_read(&wake_lock_counter) > 0) - { - atomic_dec(&wake_lock_counter); - } - -} - -void rda5990_wakeLock_destroy(void) -{ - if(atomic_read(&wake_lock_counter) > 0) - { - atomic_set(&wake_lock_counter, 0); - wake_unlock(&sleep_worker_wake_lock); - } - - wake_lock_destroy(&sleep_worker_wake_lock); - -} - -#endif - diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_dev.h b/drivers/net/wireless/rda5990/rda_wlan/rda5890_dev.h deleted file mode 100755 index 1f3656733be8..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_dev.h +++ /dev/null @@ -1,272 +0,0 @@ -/** - * This file contains definitions and data structures specific - * to Marvell 802.11 NIC. It contains the Device Information - * structure struct lbs_private.. - */ -#ifndef _RDA5890_DEV_H_ -#define _RDA5890_DEV_H_ -#include -#include -#include -#include -#include -#include -#include "rda5890_defs.h" -//#include "hif_sdio.h" - - -#ifndef MAX_WPA_IE_LEN -#define MAX_WPA_IE_LEN 100 -#endif - -#ifndef MAX_RATES -#define MAX_RATES 14 -#endif - -#define DEV_NAME_LEN 32 - -#define RDA5890_MAX_NETWORK_NUM 32 - -/** RSSI related MACRO DEFINITIONS */ -#define RDA5890_NF_DEFAULT_SCAN_VALUE (-96) -#define PERFECT_RSSI ((u8)50) -#define WORST_RSSI ((u8)0) -#define RSSI_DIFF ((u8)(PERFECT_RSSI - WORST_RSSI)) - -/** RTS/FRAG related defines */ -#define RDA5890_RTS_MIN_VALUE 0 -#define RDA5890_RTS_MAX_VALUE 2347 -#define RDA5890_FRAG_MIN_VALUE 256 -#define RDA5890_FRAG_MAX_VALUE 2346 - -#define KEY_LEN_WPA_AES 16 -#define KEY_LEN_WPA_TKIP 32 -#define KEY_LEN_WEP_104 13 -#define KEY_LEN_WEP_40 5 - -#define BIT7 (1 << 7) -#define BIT6 (1 << 6) -#define BIT5 (1 << 5) -#define BIT4 (1 << 4) -#define BIT3 (1 << 3) -#define BIT2 (1 << 2) -#define BIT1 (1 << 1) -#define BIT0 (1 << 0) - -#define RDA_SLEEP_ENABLE BIT0 -#define RDA_SLEEP_PREASSO BIT1 - -//#define WIFI_UNIT_TEST - -/** KEY_TYPE_ID */ -enum KEY_TYPE_ID { - KEY_TYPE_ID_WEP = 0, - KEY_TYPE_ID_TKIP, - KEY_TYPE_ID_AES -}; - -enum PACKET_TYPE{ - WID_REQUEST_PACKET, - WID_REQUEST_POLLING_PACKET, - DATA_REQUEST_PACKET -}; - -/** KEY_INFO_WPA (applies to both TKIP and AES/CCMP) */ -enum KEY_INFO_WPA { - KEY_INFO_WPA_MCAST = 0x01, - KEY_INFO_WPA_UNICAST = 0x02, - KEY_INFO_WPA_ENABLED = 0x04 -}; - -/* RDA5890 defined bss descriptor, 44 bytes for each bss */ -struct rda5890_bss_descriptor { - u8 ssid[IW_ESSID_MAX_SIZE + 1]; - u8 bss_type; - u8 channel; - u8 dot11i_info; - u8 bssid[ETH_ALEN]; - u8 rssi; - u8 auth_info; - u8 rsn_cap[2]; -} __attribute__ ((packed)); - -/** - * @brief Structure used to store information for each beacon/probe response - */ -struct bss_descriptor { - struct rda5890_bss_descriptor data; - - u8 bssid[ETH_ALEN]; - - u8 ssid[IW_ESSID_MAX_SIZE + 1]; - u8 ssid_len; - - u16 capability; - u32 rssi; - u32 channel; - u16 beaconperiod; - - /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */ - u8 mode; - - /* zero-terminated array of supported data rates */ - u8 rates[MAX_RATES + 1]; - u8 wpa_ie[MAX_WPA_IE_LEN]; - size_t wpa_ie_len; - u8 rsn_ie[MAX_WPA_IE_LEN]; - size_t rsn_ie_len; - - u8 wapi_ie[100]; - size_t wapi_ie_len; //wapi valid payload length - - unsigned long last_scanned; - - - struct list_head list; -}; - -/* Generic structure to hold all key types. */ -struct enc_key { - u16 len; - u16 flags; /* KEY_INFO_* from defs.h */ - u16 type; /* KEY_TYPE_* from defs.h */ - u8 key[32]; -}; - -struct rda5890_802_11_security { - u8 WPAenabled; - u8 WPA2enabled; - u8 wep_enabled; - u8 auth_mode; - u32 key_mgmt; - u32 cipther_type; -}; - -/** Private structure for the rda5890 device */ -struct rda5890_private { - char name[DEV_NAME_LEN]; - - void *card; - struct net_device *dev; - - struct net_device_stats stats; - - /** current ssid/bssid related parameters and status */ - int connect_status; - struct rda5890_bss_descriptor curbssparams; - struct iw_statistics wstats; - - /** association flags */ - unsigned char assoc_ssid[IW_ESSID_MAX_SIZE + 1]; - unsigned char assoc_bssid[6]; - unsigned char assoc_ssid_len; -#define ASSOC_FLAG_SSID 1 -#define ASSOC_FLAG_CHANNEL 2 -#define ASSOC_FLAG_BAND 3 -#define ASSOC_FLAG_MODE 4 -#define ASSOC_FLAG_BSSID 5 -#define ASSOC_FLAG_WEP_KEYS 6 -#define ASSOC_FLAG_WEP_TX_KEYIDX 7 -#define ASSOC_FLAG_WPA_MCAST_KEY 8 -#define ASSOC_FLAG_WPA_UCAST_KEY 9 -#define ASSOC_FLAG_SECINFO 10 -#define ASSOC_FLAG_WPA_IE 11 -#define ASSOC_FLAG_ASSOC_RETRY 12 -#define ASSOC_FLAG_ASSOC_START 13 -#define ASSOC_FLAG_WLAN_CONNECTING 14 - - unsigned long assoc_flags; - unsigned char imode; - unsigned char authtype; - - /** debugfs */ - struct dentry *debugfs_dir; - struct dentry *debugfs_files[6]; - - /** for wid request and response */ - struct mutex wid_lock; - struct completion wid_done; - int wid_pending; - char *wid_rsp; - unsigned short wid_rsp_len; - char wid_msg_id; - - /** delayed worker */ - struct workqueue_struct *work_thread; - struct delayed_work scan_work; - struct delayed_work assoc_work; - struct delayed_work assoc_done_work; - struct delayed_work wlan_connect_work; - - /** Hardware access */ - int (*hw_host_to_card) (struct rda5890_private *priv, u8 *payload, u16 nb, - unsigned char packet_type); - - /** Scan results list */ - int scan_running; - struct list_head network_list; - struct list_head network_free_list; - struct bss_descriptor *networks; - - /** Encryption parameter */ - struct rda5890_802_11_security secinfo; - - /** WEP keys */ - struct enc_key wep_keys[4]; - u16 wep_tx_keyidx; - - /** WPA keys */ - struct enc_key wpa_mcast_key; - struct enc_key wpa_unicast_key; - - /** WPA Information Elements*/ - u8 wpa_ie[MAX_WPA_IE_LEN]; - u8 wpa_ie_len; - - u8 is_wapi; - /** sleep/awake flag */ -#ifdef WIFI_POWER_MANAGER - atomic_t sleep_flag; -#endif - u8 first_init; - u16 version; -}; - -extern int rda5890_sleep_flags; - -#ifdef WIFI_TEST_MODE -extern unsigned char rda_5990_wifi_in_test_mode(void); -#endif - -#ifdef WIFI_UNLOCK_SYSTEM -extern atomic_t wake_lock_counter; -extern struct wake_lock sleep_worker_wake_lock; -extern void rda5990_wakeLock(void); -extern void rda5990_wakeUnlock(void); -extern void rda5990_wakeLock_destroy(void); -#endif - -struct rda5890_private *rda5890_add_card(void *card); -void rda5890_remove_card(struct rda5890_private *priv); -int rda5890_start_card(struct rda5890_private *priv); -void rda5890_stop_card(struct rda5890_private *priv); -int rda5890_sdio_core_wake_mode(struct rda5890_private *priv); -int rda5890_sdio_core_sleep_mode(struct rda5890_private *priv); -int rda5890_sdio_core_wake_mode_polling(struct rda5890_private *priv); - -void rda5890_sdio_set_notch_by_channel(struct rda5890_private *priv, unsigned int channel); -void rda5890_rssi_up_to_200(struct rda5890_private *priv); -void rda5990_assoc_power_save(struct rda5890_private *priv); -unsigned char is_sdio_init_complete(void); -unsigned char is_sdio_patch_complete(void); -int rda5890_sdio_init(struct rda5890_private *priv); -int rda5890_init_pm(struct rda5890_private *priv); -void rda5890_shedule_timeout(int msecs); -int rda5890_read_mac(char* buf); -int rda5890_write_mac(char * buf); -int rda5890_disable_block_bt(struct rda5890_private *priv); -int rda5890_disable_self_cts(struct rda5890_private *priv); -int rda5890_set_active_scan_time(struct rda5890_private *priv); -int rda5890_set_test_mode(struct rda5890_private *priv); -int rda5890_get_fw_version_polling(struct rda5890_private *priv, unsigned int* version); -#endif diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_if_sdio.c b/drivers/net/wireless/rda5990/rda_wlan/rda5890_if_sdio.c deleted file mode 100755 index 44c780412897..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_if_sdio.c +++ /dev/null @@ -1,795 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rda5890_defs.h" -#include "rda5890_dev.h" -#include "rda5890_if_sdio.h" -#include "rda5890_wid.h" -#include "rda5890_debugfs.h" - -int rda5890_dbg_level = RDA5890_DL_CRIT; -int rda5890_dbg_area = RDA5890_DA_MAIN - | RDA5890_DA_SDIO - //| RDA5890_DA_ETHER - | RDA5890_DA_WID - | RDA5890_DA_WEXT - //| RDA5890_DA_TXRX - //| RDA5890_DA_PM - ; - -void export_msdc_clk_always_on(void) -{ - // todo... -} - -void export_msdc_clk_always_on_off(void) -{ - // todo... -} - -extern void rk29_sdio_irq_enable(int enable); -void export_wifi_eirq_enable(void) -{ - // todo... - //rk29_sdio_irq_enable(1); -} - -void export_wifi_eirq_disable(void) -{ - // todo... - //rk29_sdio_irq_enable(0); -} - -/* Module parameters */ -module_param_named(debug_level, rda5890_dbg_level, int, 0644); -module_param_named(debug_area, rda5890_dbg_area, int, 0644); -int sdio_test_flag = 0; -module_param_named(sdio_test, sdio_test_flag, int, 0644); - -#define SDIO_VENDOR_ID_RDA5890 0x5449 -#define SDIO_DEVICE_ID_RDA5890 0x0145 - -static const struct sdio_device_id if_sdio_ids[] = { - { SDIO_DEVICE(SDIO_VENDOR_ID_RDA5890, SDIO_DEVICE_ID_RDA5890) }, - { /* end: all zeroes */ }, -}; - -MODULE_DEVICE_TABLE(sdio, if_sdio_ids); - -struct if_sdio_packet { - struct if_sdio_packet *next; - unsigned char packet_type; - u16 nb; - u8 buffer[0] __attribute__((aligned(4))); -}; - -int if_sdio_card_to_host(struct if_sdio_card *card) -{ - int ret = 0; - struct rda5890_private *priv = card->priv; - u8 size_l = 0, size_h = 0; - u16 size, chunk; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - - size_l = sdio_readb(card->func, IF_SDIO_AHB2SDIO_PKTLEN_L, &ret); - if (ret) { - RDA5890_ERRP("read PKTLEN_L reg fail\n"); - goto out; - } - else - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_NORM,"read PKTLEN_L reg size_l:%d \n", size_l); - - size_h = sdio_readb(card->func, IF_SDIO_AHB2SDIO_PKTLEN_H, &ret); - if (ret) { - RDA5890_ERRP("read PKTLEN_H reg fail\n"); - goto out; - } - else - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_NORM,"read PKTLEN_H reg size_h:%d\n",size_h); - - size = (size_l | ((size_h & 0x7f) << 8)) * 4; - if (size < 4) { - RDA5890_ERRP("invalid packet size (%d bytes) from firmware\n", size); - ret = -EINVAL; - goto out; - } - - /* alignment is handled on firmside */ - //chunk = sdio_align_size(card->func, size); - chunk = size; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_NORM, - "if_sdio_card_to_host, size = %d, aligned size = %d\n", size, chunk); - - /* TODO: handle multiple packets here */ - ret = sdio_readsb(card->func, card->buffer, IF_SDIO_FUN1_FIFO_RD, chunk); - if (ret) { - RDA5890_ERRP("sdio_readsb fail, ret = %d\n", ret); - goto out; - } - -#if 1 - if(priv->version == 7) - { - sdio_writeb(card->func, 0x20 ,IF_SDIO_FUN1_INT_PEND, &ret); - if(ret) { - RDA5890_ERRP("clear SDIO Tx Complete flag failed\n"); - goto out; - } - } -#endif - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_VERB, - "if_sdio_card_to_host, read done\n"); - - if (sdio_test_flag) { - rda5890_sdio_test_card_to_host(card->buffer, chunk); - goto out; - } - - /* TODO: this chunk size need to be handled here */ - rda5890_card_to_host(priv, card->buffer, chunk); - -out: - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "if_sdio_card_to_host >>>\n"); - return ret; -} - -#ifdef WIFI_POWER_MANAGER -void if_sdio_sleep_worker(struct work_struct *work) -{ - struct if_sdio_card *card = NULL; - int ret = 0; - struct rda5890_private *priv = NULL; - - card = container_of(work, struct if_sdio_card, - sleep_work.work); - - if(card) - priv = card->priv; - else - goto out; - - if(!priv) - goto out; - - RDA5890_DBGLAP(RDA5890_DA_PM, RDA5890_DL_CRIT, "Sleep\n"); - - /* clear IF_SDIO_FUN1_INT_PEND, this allow device to sleep */ - sdio_claim_host(card->func); - sdio_writeb(card->func, IF_SDIO_HOST_TX_FLAG ,IF_SDIO_FUN1_INT_PEND, &ret); - sdio_release_host(card->func); - if (ret) - { - RDA5890_ERRP("clear IF_SDIO_HOST_TX_FLAG failed\n"); - } - atomic_inc(&card->priv->sleep_flag); - -out: - - atomic_set(&card->sleep_work_is_active, 0); -#ifdef WIFI_UNLOCK_SYSTEM - rda5990_wakeUnlock(); -#endif - return; -} - -static int if_sdio_wakeup_card(struct if_sdio_card *card) -{ - struct rda5890_private *priv = card->priv; - int ret = 0; - -#ifdef WIFI_TEST_MODE - if(rda_5990_wifi_in_test_mode()) - return 0; -#endif - sdio_claim_host(card->func); - sdio_writeb(card->func, 1, IF_SDIO_FUN1_INT_TO_DEV, &ret); - sdio_release_host(card->func); - if (ret) { - RDA5890_ERRP("write FUN1_INT_TO_DEV reg fail\n"); - goto out; - } - atomic_set(&priv->sleep_flag, 0); - - RDA5890_DBGLAP(RDA5890_DA_PM, RDA5890_DL_CRIT, "wake up \n"); - // wait 15ms, hardware need 13ms to wakeup - rda5890_shedule_timeout(8); -out: - return ret; -} - -#endif //WIFI_POWER_MANAGER - -static void if_sdio_host_to_card_worker(struct work_struct *work) -{ - struct if_sdio_card *card = NULL; - struct rda5890_private *priv = NULL; - struct if_sdio_packet *packet = NULL; - int ret; - unsigned long flags; - u16 size; - u32 retries = 500; - u8 size_l, size_h, write_status = 0; -#define SDIO_HOST_WRITE_BATCH_SIZE 512 - u16 bytes_left, offset, batch; - - card = container_of(work, struct if_sdio_card, packet_worker); - priv = card->priv; - - -#ifdef WIFI_POWER_MANAGER - if(is_sdio_init_complete()) - { - if(atomic_read(&card->sleep_work_is_active)) - { - cancel_delayed_work(&card->sleep_work); -#ifdef WIFI_UNLOCK_SYSTEM - rda5990_wakeUnlock(); -#endif - atomic_set(&card->sleep_work_is_active, 0); - } - } -#endif - - while (1) - { - retries = 500; - - spin_lock_irqsave(&card->lock, flags); - packet = card->packets; - if (packet) - card->packets = packet->next; - spin_unlock_irqrestore(&card->lock, flags); - - if (!packet) - break; - -#ifdef WIFI_POWER_MANAGER - if (atomic_read(&priv->sleep_flag)) - { - /* Deivce maybe sleep, wakeup it. */ - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_NORM, "Wakeup\n"); - ret = if_sdio_wakeup_card(card); - if (ret) - { - RDA5890_ERRP("wakeup card fail\n"); - goto out; - } - } -#endif - while(retries && is_sdio_patch_complete()) //check write flow ctrl - { - sdio_claim_host(card->func); - write_status = sdio_readb(card->func, IF_SDIO_FUN1_INT_PEND, &ret); - sdio_release_host(card->func); - if(ret) - { - RDA5890_ERRP("read IF_SDIO_FUN1_INT_PEND failed\n"); - goto release; - } - if((write_status & IF_SDIO_INT_RXCMPL) == 0) - { - //RDA5890_ERRP("**** sdio is busy retry next time \n "); - retries --; - schedule(); - } - else - { - sdio_claim_host(card->func); - sdio_writeb(card->func, IF_SDIO_INT_RXCMPL, IF_SDIO_FUN1_INT_PEND, &ret); - sdio_release_host(card->func); - if(ret) - { - RDA5890_ERRP("write IF_SDIO_FUN1_INT_PEND failed\n"); - goto release; - } - break; - } - } - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "if_sdio_host_to_card_worker, send one packet, size = %d\n", packet->nb); - /* write length */ - size = packet->nb/4; - size_l = (u8)(size & 0xff); - size_h = (u8)((size >> 8) & 0x7f); - size_h |= 0x80; - - sdio_claim_host(card->func); - sdio_writeb(card->func, size_l, IF_SDIO_SDIO2AHB_PKTLEN_L, &ret); - sdio_release_host(card->func); - if (ret) { - RDA5890_ERRP("write PKTLEN_L reg fail\n"); - goto release; - } - sdio_claim_host(card->func); - sdio_writeb(card->func, size_h, IF_SDIO_SDIO2AHB_PKTLEN_H, &ret); - sdio_release_host(card->func); - if (ret) { - RDA5890_ERRP("write PKTLEN_H reg fail\n"); - goto release; - } - - /* write data */ - bytes_left = packet->nb; - offset = 0; - while(bytes_left) - { - batch = (bytes_left < SDIO_HOST_WRITE_BATCH_SIZE)? - bytes_left:SDIO_HOST_WRITE_BATCH_SIZE; - - sdio_claim_host(card->func); - ret = sdio_writesb(card->func, IF_SDIO_FUN1_FIFO_WR, - packet->buffer + offset, batch); - sdio_release_host(card->func); - if (ret) { - RDA5890_ERRP("sdio_writesb fail, ret = %d\n", ret); - goto release; - } - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "write batch %d, offset = %d\n", batch, offset); - - offset += batch; - bytes_left -= batch; - } - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "if_sdio_host_to_card_worker, send one packet done\n"); - -release: - - kfree(packet); - packet = NULL; - } - -out: - - if(is_sdio_init_complete()) //init complete should start sleep_work - { -#ifdef WIFI_UNLOCK_SYSTEM - rda5990_wakeLock(); -#endif - -#ifdef WIFI_POWER_MANAGER -#ifdef WIFI_TEST_MODE - if(rda_5990_wifi_in_test_mode()) - return; -#endif //end WIFI_TEST_MODE - atomic_set(&card->sleep_work_is_active, 1); - queue_delayed_work(priv->work_thread, &card->sleep_work, HZ/5); // 100ms -#endif //end WIFI_POWER_MANAGER - } -} - -/*******************************************************************/ -/* RDA5890 callbacks */ -/*******************************************************************/ - -static int if_sdio_host_to_card(struct rda5890_private *priv, - u8 *buf, u16 nb, unsigned char packet_type) -{ - int ret = 0; - struct if_sdio_card *card; - struct if_sdio_packet *packet, *cur; - u16 size; - unsigned long flags; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - card = priv->card; - - if (nb > (65536 - sizeof(struct if_sdio_packet))) { - ret = -EINVAL; - goto out; - } - - //size = sdio_align_size(card->func, nb); - size = nb; - if(size%4) - { - size += (4-size%4); - } - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_NORM, - "if_sdio_host_to_card, size = %d, aligned size = %d\n", nb, size); - - packet = kzalloc(sizeof(struct if_sdio_packet) + size, - GFP_ATOMIC); - if (!packet) { - ret = -ENOMEM; - goto out; - } - - packet->next = NULL; - packet->nb = size; - packet->packet_type = packet_type; - - memcpy(packet->buffer, buf, nb); - - spin_lock_irqsave(&card->lock, flags); - - if (!card->packets) - card->packets = packet; - else { - cur = card->packets; - while (cur->next) - cur = cur->next; - cur->next = packet; - } - - spin_unlock_irqrestore(&card->lock, flags); - - queue_work(card->work_thread, &card->packet_worker); - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); - - ret = 0; - -out: - return ret; -} - -static void if_sdio_interrupt(struct sdio_func *func) -{ - int ret = 0; - struct if_sdio_card *card; - struct rda5890_private *priv; - u8 status; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - card = sdio_get_drvdata(func); - if(!card) - return; - - priv = card->priv; - - status = sdio_readb(card->func, IF_SDIO_FUN1_INT_STAT, &ret); - if (ret) - goto out; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_VERB, - "if_sdio_interrupt, status = 0x%02x\n", status); - - if (status & IF_SDIO_INT_AHB2SDIO) - if_sdio_card_to_host(card); - - if (status & IF_SDIO_INT_ERROR) - { - sdio_writeb(card->func, IF_SDIO_INT_ERROR, IF_SDIO_FUN1_INT_PEND, &ret); - if (ret) - { - RDA5890_ERRP("write FUN1_INT_STAT reg fail\n"); - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "%s, INT_ERROR\n", __func__); - } - -out: - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<< ret=%d \n", __func__, ret); - return ret; -} - - -static int if_sdio_probe(struct sdio_func *func, - const struct sdio_device_id *id) -{ - struct if_sdio_card *card = NULL; - struct rda5890_private *priv = NULL; - struct if_sdio_packet *packet = NULL; - int ret = -1; - unsigned long flags; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - //SMC_MSG("[rda_debug] sunximmc_probe, set clk.\n"); - - //mmc_set_clock(mmc, 4000000); - - - if(id->vendor != 0x5449) - { - RDA5890_ERRP("rda5890 sdio not corrent vendor:%x \n", id->vendor); - goto out; - } - - card = kzalloc(sizeof(struct if_sdio_card), GFP_KERNEL); - if (!card) { - RDA5890_ERRP("kzalloc fail\n"); - return -ENOMEM; - } - - card->func = func; - spin_lock_init(&card->lock); - atomic_set(&card->wid_complete_flag, 0); - INIT_WORK(&card->packet_worker, if_sdio_host_to_card_worker); - card->work_thread = create_singlethread_workqueue("rda5890_if_sdio_worker"); - -#ifdef WIFI_POWER_MANAGER - atomic_set(&card->sleep_work_is_active, 0); - INIT_DELAYED_WORK(&card->sleep_work, if_sdio_sleep_worker); -#endif - -#ifdef WIFI_UNLOCK_SYSTEM - atomic_set(&wake_lock_counter, 0); - wake_lock_init(&sleep_worker_wake_lock, WAKE_LOCK_SUSPEND, "RDA_sleep_worker_wake_lock"); -#endif - - sdio_claim_host(func); - ret = sdio_enable_func(func); - if (ret) { - RDA5890_ERRP("sdio_enable_func fail, ret = %d\n", ret); - goto release; - } - - ret = sdio_claim_irq(func, if_sdio_interrupt); - if (ret) { - RDA5890_ERRP("sdio_claim_irq fail, ret = %d\n", ret); - goto disable; - } - - sdio_release_host(func); - sdio_set_drvdata(func, card); - - priv = rda5890_add_card(card); - if (!priv) { - RDA5890_ERRP("rda5890_add_card fail\n"); - ret = -ENOMEM; - goto release_int; - } - rda5890_debugfs_init_one(priv); - - card->priv = priv; - priv->card = card; - priv->hw_host_to_card = if_sdio_host_to_card; - - /* - * Enable interrupts now that everything is set up - */ - sdio_claim_host(func); - sdio_writeb(func, 0x7, IF_SDIO_FUN1_INT_MASK, &ret); - sdio_release_host(func); - if (ret) { - RDA5890_ERRP("enable func interrupt fail\n"); - goto remove_card; - } -#ifdef WIFI_TEST_MODE - if(!rda_5990_wifi_in_test_mode()) - { -#endif - ret = rda5890_sdio_init(priv); - if(ret < 0) - goto remove_card; - - ret=rda5890_disable_self_cts(priv); - if(ret < 0) - goto remove_card; - - ret=rda5890_disable_block_bt(priv); - if(ret < 0) - goto remove_card; - - ret = rda5890_set_scan_timeout(priv); - if (ret) { - RDA5890_ERRP("rda5890_set_scan_timeout fail, ret = %d\n", ret); - goto remove_card; - } - - ret= rda5890_set_listen_interval(priv, 0x06); - if(ret < 0) - goto remove_card; - - ret = rda5890_set_link_loss_threshold(priv, 0x06); - if(ret < 0) - goto remove_card; - - ret = rda5890_init_pm(priv); - if(ret < 0) - goto remove_card; - -#ifdef WIFI_TEST_MODE - } - else - { - ret = rda5890_set_test_mode(priv); - if(ret < 0) - goto remove_card; - } -#endif - - if (sdio_test_flag) { - unsigned char mac_addr[6]; - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE, - "SDIO TESTING MODE\n"); - - - ret = rda5890_get_mac_addr(priv, mac_addr); - printk(KERN_INFO "Test rda5890_get_mac_addr %x:%x:%x:%x:%x:%x", mac_addr[0],mac_addr[1],mac_addr[2],mac_addr[3],mac_addr[4],mac_addr[5]); - goto done; - } - - ret = rda5890_start_card(priv); - if (ret) { - RDA5890_ERRP("rda5890_start_card fail, ret = %d\n", ret); - goto remove_card; - } - -done: - printk(KERN_INFO "RDA5890: SDIO card started\n"); - -out: - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s ret:%d <<<\n", __func__, ret); - return ret; - -release_int: - sdio_claim_host(func); - sdio_release_irq(func); -disable: - sdio_disable_func(func); -release: - sdio_release_host(func); - -remove_card: - - if (atomic_read(&card->wid_complete_flag) && priv) - { - complete(&priv->wid_done); - printk(KERN_INFO "*****RDA5890: probe send wid complete\n"); - } - flush_work(&card->packet_worker); - cancel_work_sync(&card->packet_worker); - -#ifdef WIFI_POWER_MANAGER - cancel_delayed_work(&card->sleep_work); -#endif - destroy_workqueue(card->work_thread); - - if(priv) - rda5890_remove_card(priv); - - while (card->packets) { - packet = card->packets; - card->packets = card->packets->next; - kfree(packet); - } - - kfree(card); - goto out; -} - -static void if_sdio_remove(struct sdio_func *func) -{ - struct if_sdio_card *card; - struct if_sdio_packet *packet; - unsigned char count = 20; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - printk(KERN_INFO "RDA5890: SDIO card detached\n"); - - card = sdio_get_drvdata(func); - if(!card) - return; - while(card->priv->scan_running && count--) - { - rda5890_shedule_timeout(100); - printk("remove card wait scan complete \n"); - } - -#ifdef WIFI_POWER_MANAGER - cancel_delayed_work_sync(&card->sleep_work); -#endif - cancel_work_sync(&card->packet_worker); - - if (atomic_read(&card->wid_complete_flag) && card->priv) - { - complete(&card->priv->wid_done); - printk(KERN_INFO "*****RDA5890: send wid complete\n"); - } - - netif_stop_queue(card->priv->dev); - netif_carrier_off(card->priv->dev); - rda5890_stop_card(card->priv); - rda5890_debugfs_remove_one(card->priv); - destroy_workqueue(card->work_thread); - rda5890_remove_card(card->priv); - - while (card->packets) { - packet = card->packets; - card->packets = card->packets->next; - kfree(packet); - } - - kfree(card); - -#ifdef WIFI_UNLOCK_SYSTEM - rda5990_wakeLock_destroy(); -#endif - - printk(KERN_INFO "RDA5890: SDIO card removed\n"); - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); - return; -} - -static struct sdio_driver if_sdio_driver = { - .name = "rda5890_sdio", - .id_table = if_sdio_ids, - .probe = if_sdio_probe, - .remove = if_sdio_remove, -}; - -/*******************************************************************/ -/* Module functions */ -/*******************************************************************/ -extern void mmc_rescan_slot(int id); - -static int __init if_sdio_init_module(void) -{ - int ret = 0; - - printk(KERN_INFO "\nRDA5890 SDIO WIFI Driver for st_linux \n"); - printk(KERN_INFO "Ver: %d.%d.%d\n\n", - RDA5890_SDIOWIFI_VER_MAJ, - RDA5890_SDIOWIFI_VER_MIN, - RDA5890_SDIOWIFI_VER_BLD); - - printk("@@@@@@@@@@@@@@@22222 rda5990 start\n"); - - msleep(1000); - - printk("@@@@@@@@@@@@@@ mmc_rescan_slot\n"); - mmc_rescan_slot(0); - msleep(1000); - - rda5890_debugfs_init(); - ret = sdio_register_driver(&if_sdio_driver); - - if (ret) - { - printk(KERN_INFO "\nif_sdio_init_module: register fail. \n"); - //sunximmc_rescan_card(SDIOID,0); - } - - printk(KERN_INFO "\n if_sdio_init_module: register successful. \n"); - - return ret; -} - -extern void mmc_remove(int id); -static void __exit if_sdio_exit_module(void) -{ - printk(KERN_INFO "\n if_sdio_exit_module. \n"); - mmc_remove(0); - rda5890_debugfs_remove(); - sdio_unregister_driver(&if_sdio_driver); -} - - -module_init(if_sdio_init_module); -module_exit(if_sdio_exit_module); - -MODULE_DESCRIPTION("RDA5890 SDIO WLAN Driver"); -MODULE_AUTHOR("lwang"); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_if_sdio.h b/drivers/net/wireless/rda5990/rda_wlan/rda5890_if_sdio.h deleted file mode 100755 index 6c5a7583c4da..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_if_sdio.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef _RDA5890_IF_SDIO_H -#define _RDA5890_IF_SDIO_H - -#define IF_SDIO_SDIO2AHB_PKTLEN_L 0x00 -#define IF_SDIO_SDIO2AHB_PKTLEN_H 0x01 - -#define IF_SDIO_AHB2SDIO_PKTLEN_L 0x02 -#define IF_SDIO_AHB2SDIO_PKTLEN_H 0x03 - -#define IF_SDIO_FUN1_INT_MASK 0x04 -#define IF_SDIO_FUN1_INT_PEND 0x05 -#define IF_SDIO_FUN1_INT_STAT 0x06 - -#define IF_SDIO_INT_AHB2SDIO 0x01 -#define IF_SDIO_INT_ERROR 0x04 -#define IF_SDIO_INT_SLEEP 0x10 -#define IF_SDIO_INT_AWAKE 0x20 -#define IF_SDIO_INT_RXCMPL 0x40 -#define IF_SDIO_HOST_TX_FLAG 0x80 - -#define IF_SDIO_FUN1_FIFO_WR 0x07 -#define IF_SDIO_FUN1_FIFO_RD 0x08 - -#define IF_SDIO_FUN1_INT_TO_DEV 0x09 - -struct if_sdio_card { - struct sdio_func *func; - struct rda5890_private *priv; - - u8 buffer[2048]; - - spinlock_t lock; - struct if_sdio_packet *packets; - struct work_struct packet_worker; - - struct workqueue_struct *work_thread; - atomic_t wid_complete_flag; -#ifdef WIFI_POWER_MANAGER - atomic_t sleep_work_is_active; - struct delayed_work sleep_work; -#endif -}; - -void export_msdc_clk_always_on(void); -void export_msdc_clk_always_on_off(void); -void export_wifi_eirq_enable(void); -void export_wifi_eirq_disable(void); - -#endif diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_ioctl.h b/drivers/net/wireless/rda5990/rda_wlan/rda5890_ioctl.h deleted file mode 100755 index 0dc1d4e22799..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_ioctl.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _RDA5890_IOCTL_H_ -#define _RDA5890_IOCTL_H_ - -#include "linux/sockios.h" - -#define IOCTL_RDA5890_BASE SIOCDEVPRIVATE -#define IOCTL_RDA5890_GET_MAGIC IOCTL_RDA5890_BASE -#define IOCTL_RDA5890_GET_DRIVER_VER (IOCTL_RDA5890_BASE + 1) -#define IOCTL_RDA5890_MAC_GET_FW_VER (IOCTL_RDA5890_BASE + 2) -#define IOCTL_RDA5890_MAC_WID (IOCTL_RDA5890_BASE + 3) -#define IOCTL_RDA5890_SET_WAPI_ASSOC_IE (IOCTL_RDA5890_BASE + 4) -#define IOCTL_RDA5890_GET_WAPI_ASSOC_IE (IOCTL_RDA5890_BASE + 5) - -#define RDA5890_MAGIC 0x5890face - -#endif /* _RDA5890_IOCTL_H_ */ - diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_nvram.c b/drivers/net/wireless/rda5990/rda_wlan/rda5890_nvram.c deleted file mode 100755 index fb93a2e74b75..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_nvram.c +++ /dev/null @@ -1,108 +0,0 @@ -#include -#include - -#define WIFI_NVRAM_FILE_NAME "/data/nvram/APCFG/APRDEB/RDAWIFI" - -static int nvram_read(char *filename, char *buf, ssize_t len, int offset) -{ - struct file *fd; - //ssize_t ret; - int retLen = -1; - - mm_segment_t old_fs = get_fs(); - set_fs(KERNEL_DS); - - fd = filp_open(filename, O_WRONLY|O_CREAT, 0644); - - if(IS_ERR(fd)) { - printk("[rda5890][nvram_read] : failed to open!!\n"); - return -1; - } - do{ - if ((fd->f_op == NULL) || (fd->f_op->read == NULL)) - { - printk("[rda5890][nvram_read] : file can not be read!!\n"); - break; - } - - if (fd->f_pos != offset) { - if (fd->f_op->llseek) { - if(fd->f_op->llseek(fd, offset, 0) != offset) { - printk("[rda5890][nvram_read] : failed to seek!!\n"); - break; - } - } else { - fd->f_pos = offset; - } - } - - retLen = fd->f_op->read(fd, - buf, - len, - &fd->f_pos); - - }while(false); - - filp_close(fd, NULL); - - set_fs(old_fs); - - return retLen; -} - -static int nvram_write(char *filename, char *buf, ssize_t len, int offset) -{ - struct file *fd; - int retLen = -1; - - mm_segment_t old_fs = get_fs(); - set_fs(KERNEL_DS); - - fd = filp_open(filename, O_WRONLY|O_CREAT, 0644); - - if(IS_ERR(fd)) { - printk("[rda5890][nvram_write] : failed to open!!\n"); - return -1; - } - do{ - if ((fd->f_op == NULL) || (fd->f_op->write == NULL)) - { - printk("[rda5890][nvram_write] : file can not be write!!\n"); - break; - } /* End of if */ - - if (fd->f_pos != offset) { - if (fd->f_op->llseek) { - if(fd->f_op->llseek(fd, offset, 0) != offset) { - printk("[rda5890][nvram_write] : failed to seek!!\n"); - break; - } - } else { - fd->f_pos = offset; - } - } - - retLen = fd->f_op->write(fd, - buf, - len, - &fd->f_pos); - - }while(false); - - filp_close(fd, NULL); - - set_fs(old_fs); - - return retLen; -} - -int rda5890_read_mac(char* buf) -{ - return nvram_read(WIFI_NVRAM_FILE_NAME, buf, 6, 0); -} - -int rda5890_write_mac(char * buf) -{ - return nvram_write(WIFI_NVRAM_FILE_NAME, buf, 6, 0); -} - diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_scan.c b/drivers/net/wireless/rda5990/rda_wlan/rda5890_scan.c deleted file mode 100755 index 207595cf5a96..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_scan.c +++ /dev/null @@ -1,369 +0,0 @@ -#include -#include -#include -#include -#include - - -#include "rda5890_dev.h" -#include "rda5890_defs.h" - -//#define SCAN_RESULT_DEBUG - -//added by xiongzhi for wapi -#ifndef FCS_LEN -#define FCS_LEN 4 -#endif - -/* Element ID of various Information Elements */ -typedef enum {ISSID = 0, /* Service Set Identifier */ - ISUPRATES = 1, /* Supported Rates */ - IFHPARMS = 2, /* FH parameter set */ - IDSPARMS = 3, /* DS parameter set */ - ICFPARMS = 4, /* CF parameter set */ - ITIM = 5, /* Traffic Information Map */ - IIBPARMS = 6, /* IBSS parameter set */ - ICTEXT = 16, /* Challenge Text */ - IERPINFO = 42, /* ERP Information */ - IEXSUPRATES = 50, /* Extended Supported Rates */ - IWAPI =68 -} ELEMENTID_T; - -/* Capability Information field bit assignments */ -typedef enum {ESS = 0x01, /* ESS capability */ - IBSS = 0x02, /* IBSS mode */ - POLLABLE = 0x04, /* CF Pollable */ - POLLREQ = 0x08, /* Request to be polled */ - PRIVACY = 0x10, /* WEP encryption supported */ - SHORTPREAMBLE = 0x20, /* Short Preamble is supported */ - SHORTSLOT = 0x400, /* Short Slot is supported */ - PBCC = 0x40, /* PBCC */ - CHANNELAGILITY = 0x80, /* Channel Agility */ - SPECTRUM_MGMT = 0x100, /* Spectrum Management */ - DSSS_OFDM = 0x2000 /* DSSS-OFDM */ -} CAPABILITY_T; - -/* BSS type */ -typedef enum {INFRASTRUCTURE = 1, - INDEPENDENT = 2, - ANY_BSS = 3 -} BSSTYPE_T; - -unsigned char* get_ie_elem(unsigned char* msa, ELEMENTID_T elm_id, - unsigned short rx_len,unsigned short tag_param_offset) -{ - unsigned short index = 0; - - /*************************************************************************/ - /* Beacon Frame - Frame Body */ - /* --------------------------------------------------------------------- */ - /* |Timestamp |BeaconInt |CapInfo |SSID |SupRates |DSParSet |TIM elm | */ - /* --------------------------------------------------------------------- */ - /* |8 |2 |2 |2-34 |3-10 |3 |4-256 | */ - /* --------------------------------------------------------------------- */ - /* */ - /*************************************************************************/ - - index = tag_param_offset; - - /* Search for the TIM Element Field and return if the element is found */ - while(index < (rx_len - FCS_LEN)) - { - if(msa[index] == elm_id) - { - return(&msa[index]); - } - else - { - index += (2 + msa[index + 1]); - } - } - - return(0); -} - -/* This function extracts the 'from ds' bit from the MAC header of the input */ -/* frame. */ -/* Returns the value in the LSB of the returned value. */ -unsigned char get_from_ds(unsigned char* header) -{ - return ((header[1] & 0x02) >> 1); -} - -/* This function extracts the 'to ds' bit from the MAC header of the input */ -/* frame. */ -/* Returns the value in the LSB of the returned value. */ -unsigned char get_to_ds(unsigned char* header) -{ - return (header[1] & 0x01); -} - -/* This function extracts the MAC Address in 'address1' field of the MAC */ -/* header and updates the MAC Address in the allocated 'addr' variable. */ -void get_address1(unsigned char* msa, unsigned char* addr) -{ - memcpy(addr, msa + 4, 6); -} - -/* This function extracts the MAC Address in 'address2' field of the MAC */ -/* header and updates the MAC Address in the allocated 'addr' variable. */ -void get_address2(unsigned char* msa, unsigned char* addr) -{ - memcpy(addr, msa + 10, 6); -} - -/* This function extracts the MAC Address in 'address3' field of the MAC */ -/* header and updates the MAC Address in the allocated 'addr' variable. */ -void get_address3(unsigned char* msa, unsigned char* addr) -{ - memcpy(addr, msa + 16, 6); -} - -/* This function extracts the BSSID from the incoming WLAN packet based on */ -/* the 'from ds' bit, and updates the MAC Address in the allocated 'addr' */ -/* variable. */ -void get_BSSID(unsigned char* data, unsigned char* bssid) -{ - if(get_from_ds(data) == 1) - get_address2(data, bssid); - else if(get_to_ds(data) == 1) - get_address1(data, bssid); - else - get_address3(data, bssid); -} - -extern int is_same_network(struct bss_descriptor *src, - struct bss_descriptor *dst); -extern void clear_bss_descriptor(struct bss_descriptor *bss); -void rda5890_network_information(struct rda5890_private *priv, - char *info, unsigned short info_len) -{ - union iwreq_data wrqu; - struct bss_descriptor *iter_bss; - struct bss_descriptor *safe; - struct bss_descriptor bss_desc; - struct bss_descriptor * bss = &bss_desc; - - unsigned char *pos, *end, *p; - unsigned char n_ex_rates = 0, got_basic_rates = 0, n_basic_rates = 0; - struct ieee_ie_country_info_set *pcountryinfo; - int ret; - unsigned char* msa = &info[9]; - unsigned short msa_len = info[6] | (info[7] << 8); - - if(!priv->scan_running) - goto done; - - if((msa_len - 1 + 9 ) != info_len) - { - RDA5890_ERRP("rda5890_network_information verify lengh feild failed \n"); - } - - memset(bss, 0, sizeof (struct bss_descriptor)); - bss->rssi = info[8]; - msa_len -= 1; // has rssi - - get_BSSID(msa, bss->bssid); - - end = msa + msa_len; - - //mac head - pos = msa + 24; - //time stamp - pos += 8; - //beacon - bss->beaconperiod = *(pos) | (*(pos + 1) << 8); - pos += 2 ; - //capability - bss->capability = *(pos) | (*(pos + 1) << 8); - pos += 2; - - if (bss->capability & WLAN_CAPABILITY_IBSS) - bss->mode = IW_MODE_ADHOC; - else - bss->mode = IW_MODE_INFRA; - - /* process variable IE */ - while (pos + 2 <= end) { - if (pos + pos[1] > end) { -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("process_bss: error in processing IE, " - "bytes left < IE length\n"); -#endif - break; - } - - switch (pos[0]) { - case WLAN_EID_SSID: - bss->ssid_len = min_t(int, IEEE80211_MAX_SSID_LEN, pos[1]); - memcpy(bss->ssid, pos + 2, bss->ssid_len); -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("got SSID IE: '%s', len %u %d\n", - bss->ssid, - bss->ssid_len, pos[1]); -#endif - break; - - case WLAN_EID_SUPP_RATES: - n_basic_rates = min_t(uint8_t, MAX_RATES, pos[1]); - memcpy(bss->rates, pos + 2, n_basic_rates); - got_basic_rates = 1; -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("got RATES IE\n"); -#endif - break; - - case WLAN_EID_FH_PARAMS: -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("got FH IE\n"); -#endif - break; - - case WLAN_EID_DS_PARAMS: -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("got DS IE\n"); -#endif - break; - - case WLAN_EID_CF_PARAMS: -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("got CF IE\n"); -#endif - break; - - case WLAN_EID_IBSS_PARAMS: -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("got IBSS IE\n"); -#endif - break; - - case WLAN_EID_COUNTRY: - pcountryinfo = (struct ieee_ie_country_info_set *) pos; -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("got COUNTRY IE\n"); -#endif - break; - - case WLAN_EID_EXT_SUPP_RATES: - /* only process extended supported rate if data rate is - * already found. Data rate IE should come before - * extended supported rate IE - */ -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("got RATESEX IE\n"); -#endif - if (!got_basic_rates) { -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("... but ignoring it\n"); -#endif - break; - } - - n_ex_rates = pos[1]; - if (n_basic_rates + n_ex_rates > MAX_RATES) - n_ex_rates = MAX_RATES - n_basic_rates; - - p = bss->rates + n_basic_rates; - memcpy(p, pos + 2, n_ex_rates); - break; - - case WLAN_EID_GENERIC: - if (pos[1] >= 4 && - pos[2] == 0x00 && pos[3] == 0x50 && - pos[4] == 0xf2 && pos[5] == 0x01) { - bss->wpa_ie_len = min(pos[1] + 2, MAX_WPA_IE_LEN); - memcpy(bss->wpa_ie, pos, bss->wpa_ie_len); -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("got WPA IE \n"); -#endif - } - else { -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("got generic IE: %02x:%02x:%02x:%02x, len %d\n", - pos[2], pos[3], - pos[4], pos[5], - pos[1]); -#endif - } - break; - - case WLAN_EID_RSN: -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("got RSN IE\n"); -#endif - bss->rsn_ie_len = min(pos[1] + 2, MAX_WPA_IE_LEN); - memcpy(bss->rsn_ie, pos, bss->rsn_ie_len); - break; - - case IWAPI: -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("got WAPI IE\n"); -#endif - bss->wapi_ie_len = min(pos[1] + 2, 100); - memcpy(bss->wapi_ie, pos, bss->wapi_ie_len); - break; - - default: - break; - } - - pos += pos[1] + 2; - } - - bss->last_scanned = jiffies; - - /* add scaned bss into list */ - if (1) { - struct bss_descriptor *found = NULL; - struct bss_descriptor *oldest = NULL; - - /* Try to find this bss in the scan table */ - list_for_each_entry (iter_bss, &priv->network_list, list) { - if (is_same_network(iter_bss, bss)) { - found = iter_bss; - break; - } - - if ((oldest == NULL) || - (iter_bss->last_scanned < oldest->last_scanned)) - oldest = iter_bss; - } - - if (found) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "FOUND SAME %s, update\n", found->ssid); - /* found, clear it */ - clear_bss_descriptor(found); - } else if (!list_empty(&priv->network_free_list)) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "FOUND NEW %s, add\n", bss->ssid); - /* Pull one from the free list */ - found = list_entry(priv->network_free_list.next, - struct bss_descriptor, list); - list_move_tail(&found->list, &priv->network_list); - } else if (oldest) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "FOUND NEW %s, no space, replace oldest %s\n", - bss->ssid, oldest->ssid); - /* If there are no more slots, expire the oldest */ - found = oldest; - clear_bss_descriptor(found); - list_move_tail(&found->list, &priv->network_list); - } else { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "FOUND NEW but no space to store\n"); - } - - /* Copy the locally created newbssentry to the scan table */ - memcpy(found, bss, offsetof(struct bss_descriptor, list)); - } - -done: -#ifdef SCAN_RESULT_DEBUG - RDA5890_DBGP("rda5890_network_information ret %d \n", ret); -#endif - return; -} - - - diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_sdio_patch.c b/drivers/net/wireless/rda5990/rda_wlan/rda5890_sdio_patch.c deleted file mode 100755 index f72d44fc69c7..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_sdio_patch.c +++ /dev/null @@ -1,1406 +0,0 @@ -#include "rda5890_dev.h" -#include "rda5890_wid.h" -#include "rda5890_defs.h" - -#ifdef WIFI_TEST_MODE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif - -static u8 sdio_patch_complete = 0; -static u8 sdio_init_complete = 0; - -//#define dig_access_pmu_cancel -const u32 wifi_core_patch_data_32[][2] = -{ - {0x00108000, 0xEA03DF9C}, - {0x00108004, 0xE59F101C}, - {0x00108008, 0xE3A00040}, - {0x0010800C, 0xE5C10038}, - {0x00108010, 0xE1A0F00E}, - {0x00108014, 0xEA03DF95}, - {0x00108018, 0xE59F1008}, - {0x0010801C, 0xE3A00040}, - {0x00108020, 0xE5C10038}, - {0x00108024, 0xE1A0F00E}, - {0x00108028, 0x50300000}, - {0x0010802C, 0xEB03D6F2}, - {0x00108030, 0xE1A00B84}, - {0x00108034, 0xE1B00BA0}, - {0x00108038, 0x11A00B84}, - {0x0010803C, 0x11A00BA0}, - {0x00108040, 0x12600F80}, - {0x00108044, 0x10804004}, - {0x00108048, 0xE1A00124}, - {0x0010804C, 0xE92D0011}, - {0x00108050, 0xE51F4030}, - {0x00108054, 0xE3A00020}, - {0x00108058, 0xE5C40038}, - {0x0010805C, 0xE8BD0011}, - {0x00108060, 0xE1A0F00E}, - {0x00108064, 0xEA03D3D2}, - {0x00108068, 0xE3A00001}, - {0x0010806C, 0xE1A0F00E}, - {0x00108070, 0xEA03D6CD}, - {0x00108074, 0xE3A00001}, - {0x00108078, 0xE1A0F00E}, - {0x0010807C, 0xEB03C786}, - {0x00108080, 0xE51F0060}, - {0x00108084, 0xE5D00038}, - {0x00108088, 0xE3100080}, - {0x0010808C, 0x1A000001}, - {0x00108090, 0xE3A00001}, - {0x00108094, 0xE1A0F00E}, - {0x00108098, 0xE3A00000}, - {0x0010809C, 0xE1A0F00E}, - {0x001080A0, 0xEB03EADE}, - {0x001080A4, 0xE51F0084}, - {0x001080A8, 0xE5D00038}, - {0x001080AC, 0xE3100080}, - {0x001080B0, 0x1A000001}, - {0x001080B4, 0xE3A00001}, - {0x001080B8, 0xE1A0F00E}, - {0x001080BC, 0xE3A00000}, - {0x001080C0, 0xE1A0F00E}, - {0x001080C4, 0xEB03D89D}, - {0x001080C8, 0xE51F00A8}, - {0x001080CC, 0xE3A01080}, - {0x001080D0, 0xE5C01038}, - {0x001080D4, 0xE1A0F00E}, - {0x001080D8, 0xEB03D714}, - {0x001080DC, 0xE51F10BC}, - {0x001080E0, 0xE5D10038}, - {0x001080E4, 0xE3100080}, - {0x001080E8, 0x159F001C}, - {0x001080EC, 0x059F0014}, - {0x001080F0, 0xE59F100C}, - {0x001080F4, 0xE581003C}, - {0x001080F8, 0xE51F10D8}, - {0x001080FC, 0xE1D101B4}, - {0x00108100, 0xE1A0F00E}, - {0x00108104, 0x30010000}, - {0x00108108, 0x2E00A100}, - {0x0010810C, 0x2E00A000}, - {0x00108110, 0xEB03B485}, - {0x00108114, 0x13100010}, - {0x00108118, 0x13A00002}, - {0x0010811C, 0x15C50067}, - {0x00108120, 0xE1A0F00E}, - {0x00108124, 0xEA03D804}, - {0x00108128, 0xE51F1108}, - {0x0010812C, 0xE5D10038}, - {0x00108130, 0xE2000020}, - {0x00108134, 0xE3500000}, - {0x00108138, 0x1AFFFFFB}, - {0x0010813C, 0xE3A01004}, - {0x00108140, 0xE3A00B48}, - {0x00108144, 0xE280FF45}, - {0x00108148, 0xEA0402C5}, - {0x0010814C, 0xE59F600C}, - {0x00108150, 0xE3A04000}, - {0x00108154, 0xE5C64000}, - {0x00108158, 0xE59F6004}, - {0x0010815C, 0xE59FF004}, - {0x00108160, 0x0010200B}, - {0x00108164, 0x0010121D}, - {0x00108168, 0x00007634}, - {0x0010816C, 0xEAFFFFEC}, - {0x00108170, 0xEA03E0FF}, - {0x00108174, 0x13A00000}, - {0x00108178, 0x1B000001}, - {0x0010817C, 0x15C57005}, - {0x00108180, 0xE59FF004}, - {0x00108184, 0xE51FF004}, - {0x00108188, 0x000024DC}, - {0x0010818C, 0x0000FD74}, - {0x001087B0, 0xEA0403A4}, - {0x001087B4, 0x08BD4010}, - {0x001087B8, 0x0A000002}, - {0x001087BC, 0x13A00001}, - {0x001087C0, 0x18BD4010}, - {0x001087C4, 0x1A000001}, - {0x001087C8, 0xE51FF004}, - {0x001087CC, 0x0000D470}, - {0x001087D0, 0xE51FF004}, - {0x001087D4, 0x0000D2C0}, - {0x20040004, 0x0001018C}, - {0x20040024, 0x00108000}, - {0x20040008, 0x000101BC}, - {0x20040028, 0x00108014}, - {0x2004000C, 0x00012460}, - {0x2004002C, 0x0010802C}, - {0x20040010, 0x00013118}, - {0x20040030, 0x00108064}, - {0x20040014, 0x00012538}, - {0x20040034, 0x00108070}, - {0x20040018, 0x00016260}, - {0x20040038, 0x0010807C}, - {0x2004001C, 0x0000D524}, - {0x2004003C, 0x001080A0}, - {0x20040020, 0x00011E4C}, - {0x20040040, 0x001080C4}, - {0x20040100, 0x00012484}, - {0x20040120, 0x001080D8}, - {0x20040104, 0x0001AEF8}, - {0x20040124, 0x00108110}, - {0x20040108, 0x00012110}, - {0x20040128, 0x00108124}, - {0x2004010C, 0x00007630}, - {0x2004012C, 0x00108148}, - {0x20040110, 0x00017158}, - {0x20040130, 0x0010816C}, - {0x20040114, 0x0000FD70}, - {0x20040134, 0x00108170}, - {0x20040118, 0x0000791C}, - {0x20040138, 0x001087B0}, - {0x20040000, 0x00007FFF}, - -}; - -const u32 wifi_core_patch_data_32_E[][2] = -{ - {0x00108000, 0xEA04012F}, - {0x00108004, 0x1A000001}, - {0x00108008, 0xE8BD4010}, - {0x0010800C, 0xEA000001}, - {0x00108010, 0xE51FF004}, - {0x00108014, 0x0000D4AC}, - {0x00108018, 0xE51FF004}, - {0x0010801C, 0x0000D654}, - {0x00108020, 0xEA0401F4}, - {0x00108024, 0xE59F600C}, - {0x00108028, 0xE3A04000}, - {0x0010802C, 0xE5C64000}, - {0x00108030, 0xE59F6004}, - {0x00108034, 0xE59FF004}, - {0x00108038, 0x00101CE7}, - {0x0010803C, 0x00101039}, - {0x00108040, 0x00007850}, - {0x00108044, 0xEAFFFFEC}, - {0x00108048, 0xEA03E034}, - {0x0010804C, 0x13A00000}, - {0x00108050, 0x1B000001}, - {0x00108054, 0x15C57005}, - {0x00108058, 0xE59FF004}, - {0x0010805C, 0xE51FF004}, - {0x00108060, 0x000024E0}, - {0x00108064, 0x0000FF78}, - {0x20040004, 0x00007B40}, - {0x20040024, 0x00108000}, - {0x20040008, 0x0000784C}, - {0x20040028, 0x00108020}, - {0x2004000C, 0x00017518}, - {0x2004002C, 0x00108044}, - {0x20040010, 0x0000FF74}, - {0x20040030, 0x00108048}, - {0x20040000, 0x0000000D}, - -}; - -const u8 wifi_core_patch_data_8[][2] = -{ - { 0x28, 0x1a} , - { 0x29, 0x0d}, - { 0x35, 0x1e}, - { 0x4c, 0x90}, - { 0x4d, 0x38}, - { 0x39, 0x07}, - { 0xe4, 0xf5}, - { 0x21, 0x00}, //default 0 - { 0x23, 0x10}, - { 0x48, 0x0e}, - { 0x25, 0x00}, - { 0x20, 0xa8}, - { 0x3f, 0x05}, - { 0x41, 0x37}, - { 0x42, 0x40}, - { 0x5b, 0xa9}, -}; - -//#define WF_PAT_CFG_2012_04_15 - - -/*if define FORCE_WF, wf is not allow of any activity, antenna switch is also forced to bt*/ -//#define FORCE_WF - -/*if define FORCE_WF_TX ,wf is not allow to do tx and pa is also disabled, but antenna is not forced*/ -//#define FORCE_WF_TX - -/*if define FORCE_WF_RX ,wf is not allow to do rx but antenna is not forced*/ -//#define FORCE_WF_RX - - -/*if define FORCE_WF_RX_TX wf is not allow to do any tx and rx , pa disabled , but antenna is not forced*/ -//#define FORCE_WF_RX_TX - -#define WF_PAT_CFG_2012_05_19 - -const u32 wifi_core_init_data_32[][2] = -{ -#ifdef FORCE_WF_RX_TX - {0x50000800,0xFC003E05}, - {0x50000804,0x00000000}, - {0x50000808,0xA5000013}, //no pre_active protect - {0x5000080c,0x000001C0}, - {0x50000810,0xFFCC0F01}, - {0x50000814,0x00000000}, // not grant to rx and tx - {0x50000818,0x00FF0001}, - {0x5000081C,0xFF000F00}, - {0x50000820,0x00000000}, - {0x50000824,0x0000F0FE}, - {0x50000828,0x00100F10}, - {0x50000838,0xFFFFFFFF}, - {0x5000083C,0xFFFFFFFF}, -#endif - - - -#ifdef FORCE_WF_RX - {0x50000800,0xFC003E05}, - {0x50000804,0x00000000}, - {0x50000808,0xA5000013}, //no pre_active protect - {0x5000080c,0x000001C0}, - {0x50000810,0xFFCC0F01}, - {0x50000814,0xFF000F00}, //wf not grant to rx - {0x50000818,0x00FF0001}, - {0x5000081C,0xFF000F00}, - {0x50000820,0xFF000F00}, - {0x50000824,0x0000F0FE}, - {0x50000828,0x00100F10}, - {0x50000838,0xFFFFFFFF}, - {0x5000083C,0xFFFFFFFF}, -#endif - - -#ifdef FORCE_WF_TX - {0x50000800,0xFC003E05}, - {0x50000804,0x00000000}, - {0x50000808,0xA5000013}, //no pre_active protect - {0x5000080c,0x000001C0}, - {0x50000810,0xFFCC0F01}, - {0x50000814,0x00FF0033}, //wf not grant to tx - {0x50000818,0x00FF0001}, - {0x5000081C,0xFF000F00}, - {0x50000820,0x00000000}, - {0x50000824,0x0000F0FE}, - {0x50000828,0x00100F10}, - {0x50000838,0xFFFFFFFF}, - {0x5000083C,0xFFFFFFFF}, -#endif - - -#ifdef WF_PAT_CFG_2012_05_19 - {0x50000800,0xFC003E05}, - {0x50000804,0x00000000}, - {0x50000808,0xA5000013}, //no pre_active protect - {0x5000080c,0x000001C0}, - {0x50000810,0xFFCC0F01}, - {0x50000814,0xFFFF0F03}, //0xFFFF0F33 - {0x50000818,0x00FF0001}, - {0x5000081C,0xFF000F00}, - {0x50000820,0xFF000F00}, - {0x50000824,0x0000F0FE}, - {0x50000828,0x00100F10}, - {0x50000838,0xFFFFFFFF}, - {0x5000083C,0xFFFFFFFF}, -#endif - - -#ifdef FORCE_WF - {0x50000800,0xFC003E05}, - {0x50000804,0x00000000}, - {0x50000838,0xF8003f2A}, - {0x5000083c,0x00000003}, - {0x50000808,0xfe00001b}, - {0x50000810,0x00000000}, - {0x50000814,0x00000000}, - {0x50000818,0x00000000}, - {0x5000081C,0x00000000}, - {0x50000820,0x00000000}, - {0x50000824,0xffffffff}, - {0x50000828,0x00100F10}, -#endif - -#ifdef WF_PAT_CFG_2012_04_15 /*pta config*/ - {0x50000800,0xFC003E05}, //tx_pri hi bits ctrl&mgmt package - {0x50000804,0x00000000}, //tx_pri hi bits as hi pri - {0x50000808,0xA500001B}, //sig_mode and protect time - {0x5000080c,0x000001C0}, //sigWire mode - {0x50000810,0xFFCC0F01}, //Lut bt - {0x50000814,0xFFFF0F33}, //Lut wf - {0x50000818,0x00FF0001}, //antSel0 for wl_rx - {0x5000081C,0xFF000F00}, //antSel1 for wl_tx - {0x50000820,0xFF000F00}, //antSel2 for wl_pa - //{0x50000838,0xFFFFFFFF}, //rx_pri low bits as high pri - //{0x5000083C,0xFFFFFFFF}, //rx_pri high bits as high pri -#endif - -/*end pta config*/ - { 0x00106b6c, 0x00000002 }, // scan channel 13 - { 0x30010004, 0x0000f77c }, //intn config - { 0x30010010, 0x00007dff }, //intn config - //item111:ver_b_wf_dig_2011_10_09 - { 0x30010000, 0x780369AF }, //disable tports wait 100ms; - { 0x30000010, 0x7000FFFF },//wait 500ms; - { 0x50090054, 0x00000001 },//enable update - { 0x50090200, 0x00000000 }, - { 0x50090204, 0x00000000 }, - { 0x50090208, 0x00000002 }, - { 0x5009020c, 0x00000004 }, - { 0x50090210, 0x00000006 }, - { 0x50090214, 0x00000008 }, - { 0x50090218, 0x0000000a }, - { 0x5009021c, 0x00000040 }, - { 0x50090220, 0x00000042 }, - { 0x50090224, 0x00000044 }, - { 0x50090228, 0x00000046 }, - { 0x5009022c, 0x00000048 }, - { 0x50090230, 0x0000004a }, - { 0x50090234, 0x00000080 }, - { 0x50090238, 0x00000082 }, - { 0x5009023c, 0x00000084 }, - { 0x50090240, 0x00000086 }, - { 0x50090244, 0x00000088 }, - { 0x50090248, 0x0000008a }, - { 0x5009024c, 0x000000c0 }, - { 0x50090250, 0x000000c2 }, - { 0x50090254, 0x000000c4 }, - { 0x50090258, 0x000000c6 }, - { 0x5009025c, 0x000000c8 }, - { 0x5009025c, 0x000000c8 }, - { 0x50090260, 0x000000ca }, - { 0x50090264, 0x00000100 }, - { 0x50090268, 0x00000102 }, - { 0x5009026c, 0x00000104 }, - { 0x50090270, 0x00000106 }, - { 0x50090274, 0x00000108 }, - { 0x50090278, 0x00000140 }, - { 0x5009027c, 0x00000142 },//lna =0 end - { 0x50090280, 0x00000080 }, - { 0x50090284, 0x00000082 }, - { 0x50090288, 0x00000084 }, - { 0x5009028c, 0x00000086 }, - { 0x50090290, 0x00000088 }, - { 0x50090294, 0x0000008a }, - { 0x50090298, 0x000000c0 }, - { 0x5009029c, 0x000000c2 }, - { 0x500902a0, 0x000000c4 }, - { 0x500902a4, 0x000000c6 }, - { 0x500902a8, 0x000000c8 }, - { 0x500902ac, 0x000000ca }, - { 0x500902b0, 0x00000100 }, - { 0x500902b4, 0x00000102 }, - { 0x500902b8, 0x00000104 }, - { 0x500902bc, 0x00000106 }, - { 0x500902c0, 0x00000108 }, - { 0x500902c4, 0x00000140 }, - { 0x500902c8, 0x00000142 }, - { 0x500902cc, 0x00000144 }, - { 0x500902d0, 0x00000146 }, - { 0x500902d4, 0x00000148 }, - { 0x500902d8, 0x00000180 }, - { 0x500902dc, 0x00000182 }, - { 0x500902e0, 0x00000184 }, - { 0x500902e4, 0x000001c0 }, - { 0x500902e8, 0x000001c2 }, - { 0x500902ec, 0x000001c4 }, - { 0x500902f0, 0x000001c6 }, - { 0x500902f4, 0x000001c8 }, - { 0x500902f8, 0x000001ca }, - { 0x500902fc, 0x000001cc },// lna = 01 end - { 0x50090300, 0x00000102 }, - { 0x50090304, 0x00000104 }, - { 0x50090308, 0x00000106 }, - { 0x5009030c, 0x00000108 }, - { 0x50090310, 0x00000140 }, - { 0x50090314, 0x00000142 }, - { 0x50090318, 0x00000144 }, - { 0x5009031c, 0x00000146 }, - { 0x50090320, 0x00000148 }, - { 0x50090324, 0x00000180 }, - { 0x50090328, 0x00000182 }, - { 0x5009032c, 0x00000184 }, - { 0x50090330, 0x000001c0 }, - { 0x50090334, 0x000001c2 }, - { 0x50090338, 0x000001c4 }, - { 0x5009033c, 0x000001c6 }, - { 0x50090340, 0x000001c8 }, - { 0x50090344, 0x000001c9 }, - { 0x50090348, 0x000001c9 }, - { 0x5009034c, 0x000001c9 }, - { 0x50090350, 0x000001c9 }, - { 0x50090354, 0x000001c9 }, - { 0x50090358, 0x000001c9 }, - { 0x5009035c, 0x000001c9 }, - { 0x50090360, 0x000001c9 }, - { 0x50090364, 0x000001c9 }, - { 0x50090368, 0x000001c9 }, - { 0x5009036c, 0x000001c9 }, - { 0x50090370, 0x000001c9 }, - { 0x50090374, 0x000001c9 }, - { 0x50090378, 0x000001c9 }, - { 0x5009037c, 0x000001c9 }, - { 0x50090054, 0x00000000 },//disable update - - { 0x5000050c, 0x00008000 },// for association power save - - //{ 0x50000808, 0x65000013 }, // disable prerx_priority;pta config - //{ 0x50000810, 0xFFCD0F01 }, //rx beacon priority - -}; - -const u32 wifi_core_init_data_32_E[][2] = -{ -#ifdef FORCE_WF_RX_TX - {0x50000800,0xFC003E05}, - {0x50000804,0x00000000}, - {0x50000808,0xA5000013}, //no pre_active protect - {0x5000080c,0x000001C0}, - {0x50000810,0xFFCC0F01}, - {0x50000814,0x00000000}, // not grant to rx and tx - {0x50000818,0x00FF0001}, - {0x5000081C,0xFF000F00}, - {0x50000820,0x00000000}, - {0x50000824,0x0000F0FE}, - {0x50000828,0x00100F10}, - {0x50000838,0xFFFFFFFF}, - {0x5000083C,0xFFFFFFFF}, -#endif - -#ifdef FORCE_WF_RX - {0x50000800,0xFC003E05}, - {0x50000804,0x00000000}, - {0x50000808,0xA5000013}, //no pre_active protect - {0x5000080c,0x000001C0}, - {0x50000810,0xFFCC0F01}, - {0x50000814,0xFF000F00}, //wf not grant to rx - {0x50000818,0x00FF0001}, - {0x5000081C,0xFF000F00}, - {0x50000820,0xFF000F00}, - {0x50000824,0x0000F0FE}, - {0x50000828,0x00100F10}, - {0x50000838,0xFFFFFFFF}, - {0x5000083C,0xFFFFFFFF}, -#endif - -#ifdef FORCE_WF_TX - {0x50000800,0xFC003E05}, - {0x50000804,0x00000000}, - {0x50000808,0xA5000013}, //no pre_active protect - {0x5000080c,0x000001C0}, - {0x50000810,0xFFCC0F01}, - {0x50000814,0x00FF0033}, //wf not grant to tx - {0x50000818,0x00FF0001}, - {0x5000081C,0xFF000F00}, - {0x50000820,0x00000000}, - {0x50000824,0x0000F0FE}, - {0x50000828,0x00100F10}, - {0x50000838,0xFFFFFFFF}, - {0x5000083C,0xFFFFFFFF}, -#endif - -#ifdef WF_PAT_CFG_2012_05_19 - {0x50000800,0xFC003E05}, - {0x50000804,0x00000000}, - {0x50000808,0xA5000013}, //no pre_active protect - {0x5000080c,0x000001C0}, - {0x50000810,0xFFCC0F01}, - {0x50000814,0xFFFF0F03}, //0xFFFF0F33 - {0x50000818,0x00FF0001}, - {0x5000081C,0xFF000F00}, - {0x50000820,0xFF000F00}, - {0x50000824,0x0000F0FE}, - {0x50000828,0x00100F10}, - {0x50000838,0xFFFFFFFF}, - {0x5000083C,0xFFFFFFFF}, -#endif - -#ifdef FORCE_WF - {0x50000800,0xFC003E05}, - {0x50000804,0x00000000}, - {0x50000838,0xF8003f2A}, - {0x5000083c,0x00000003}, - {0x50000808,0xfe00001b}, - {0x50000810,0x00000000}, - {0x50000814,0x00000000}, - {0x50000818,0x00000000}, - {0x5000081C,0x00000000}, - {0x50000820,0x00000000}, - {0x50000824,0xffffffff}, - {0x50000828,0x00100F10}, -#endif - -#ifdef WF_PAT_CFG_2012_04_15 /*pta config*/ - {0x50000800,0xFC003E05}, //tx_pri hi bits ctrl&mgmt package - {0x50000804,0x00000000}, //tx_pri hi bits as hi pri - {0x50000808,0xA500001B}, //sig_mode and protect time - {0x5000080c,0x000001C0}, //sigWire mode - {0x50000810,0xFFCC0F01}, //Lut bt - {0x50000814,0xFFFF0F33}, //Lut wf - {0x50000818,0x00FF0001}, //antSel0 for wl_rx - {0x5000081C,0xFF000F00}, //antSel1 for wl_tx - {0x50000820,0xFF000F00}, //antSel2 for wl_pa - //{0x50000838,0xFFFFFFFF}, //rx_pri low bits as high pri - //{0x5000083C,0xFFFFFFFF}, //rx_pri high bits as high pri -#endif - - { 0x30010004, 0x0000f77c }, //intn config - { 0x30010010, 0x00007dff }, //intn config - //item111:ver_b_wf_dig_2011_10_09 - { 0x30010000, 0x780369AF }, //disable tports wait 100ms; - { 0x30000010, 0x7000FFFF },//wait 500ms; - { 0x5000050c, 0x00008000 },// for association power save -}; - -u32 wifi_notch_data[][2] = -{ - //ch 1 - {0x001008d0, 0x50090040}, - {0x001008d4, 0x057213a2}, - {0x001008d8, 0x50090044}, - {0x001008dc, 0x10000000}, - //ch 2 - {0x00100910, 0x50090040}, - {0x00100914, 0x10000000}, - {0x00100918, 0x50090044}, - {0x0010091c, 0x10000000}, - //ch 3 - {0x00100950, 0x50090040}, - {0x00100954, 0x10000000}, - {0x00100958, 0x50090044}, - {0x0010095c, 0x10000000}, - //ch 4 - {0x00100990, 0x50090040}, - {0x00100994, 0x10000000}, - {0x00100998, 0x50090044}, - {0x0010099c, 0x10000000}, - //ch 5 - {0x001009d0, 0x50090040}, - {0x001009d4, 0x076794b4}, - {0x001009d8, 0x50090044}, - {0x001009dc, 0x10000000}, - //ch 6 - {0x00100a10, 0x50090040}, - {0x00100a14, 0x077c71de}, - {0x00100a18, 0x50090044}, - {0x00100a1c, 0x046d242e}, - //ch 7 - {0x00100a50, 0x50090040}, - {0x00100a54, 0x10000000}, - {0x00100a58, 0x50090044}, - {0x00100a5c, 0x057e7ec0}, - //ch 8 - {0x00100a90, 0x50090040}, - {0x00100a94, 0x077c7e22}, - {0x00100a98, 0x50090044}, - {0x00100a9c, 0x046d2bd2}, - //ch 9 - {0x00100ad0, 0x50090040}, - {0x00100ad4, 0x10000000}, - {0x00100ad8, 0x50090044}, - {0x00100adc, 0x10000000}, - //ch 10 - {0x00100b10, 0x50090040}, - {0x00100b14, 0x10000000}, - {0x00100b18, 0x50090044}, - {0x00100b1c, 0x10000000}, - //ch 11 - {0x00100b50, 0x50090040}, - {0x00100b54, 0x10000000}, - {0x00100b58, 0x50090044}, - {0x00100b5c, 0x10000000}, - //ch 12 - {0x00100b90, 0x50090040}, - {0x00100b94, 0x07764310}, - {0x00100b98, 0x50090044}, - {0x00100b9c, 0x10000000}, - //ch 13 - {0x00100bd0, 0x50090040}, - {0x00100bd4, 0x056794b4}, - {0x00100bd8, 0x50090044}, - {0x00100bdc, 0x10000000}, - //ch 14 - {0x00100c10, 0x50090040}, - {0x00100c14, 0x0779c279}, - {0x00100c18, 0x50090044}, - {0x00100c1c, 0x0779cd87}, -}; - -u32 wifi_notch_data_E[][2] = -{ - // For Verion E - //ch 1 - {0x001007CC, 0x50090040}, - {0x001007D0, 0x057213a2}, - {0x001007D4, 0x50090044}, - {0x001007D8, 0x10000000}, - //ch 2 - {0x001007FC, 0x50090040}, - {0x00100800, 0x10000000}, - {0x00100804, 0x50090044}, - {0x00100808, 0x10000000}, - //ch 3 - {0x0010082C, 0x50090040}, - {0x00100830, 0x10000000}, - {0x00100834, 0x50090044}, - {0x00100838, 0x10000000}, - //ch 4 - {0x0010085C, 0x50090040}, - {0x00100860, 0x10000000}, - {0x00100864, 0x50090044}, - {0x00100868, 0x10000000}, - //ch 5 - {0x0010088C, 0x50090040}, - {0x00100890, 0x076794b4}, - {0x00100894, 0x50090044}, - {0x00100898, 0x10000000}, - //ch 6 - {0x001008BC, 0x50090040}, - {0x001008C0, 0x077c71de}, - {0x001008C4, 0x50090044}, - {0x001008C8, 0x046d242e}, - //ch 7 - {0x001008EC, 0x50090040}, - {0x001008F0, 0x10000000}, - {0x001008F4, 0x50090044}, - {0x001008F8, 0x057e7140}, - //ch 8 - {0x0010091C, 0x50090040}, - {0x00100920, 0x077c7e22}, - {0x00100924, 0x50090044}, - {0x00100928, 0x046d2bd2}, - //ch 9 - {0x0010094C, 0x50090040}, - {0x00100950, 0x10000000}, - {0x00100954, 0x50090044}, - {0x00100958, 0x10000000}, - //ch 10 - {0x0010097C, 0x50090040}, - {0x00100980, 0x10000000}, - {0x00100984, 0x50090044}, - {0x00100988, 0x10000000}, - //ch 11 - {0x001009AC, 0x50090040}, - {0x001009B0, 0x10000000}, - {0x001009B4, 0x50090044}, - {0x001009B8, 0x10000000}, - //ch 12 - {0x001009DC, 0x50090040}, - {0x001009E0, 0x07764310}, - {0x001009E4, 0x50090044}, - {0x001009E8, 0x10000000}, - //ch 13 - {0x00100A0C, 0x50090040}, - {0x00100A10, 0x056794b4}, - {0x00100A14, 0x50090044}, - {0x00100A18, 0x10000000}, - //ch 14 - {0x00100A3C, 0x50090040}, - {0x00100A40, 0x0779c279}, - {0x00100A44, 0x50090044}, - {0x00100A4c, 0x0779cd87}, -}; - -//common sdio clock open -const u32 wifi_core_data_wake[][2] = -{ - {0x3001003c, 0x2e00a000}, -}; -//sleep sdio switch -const u32 wifi_core_data_sleep[][2] = -{ - {0x3001003c, 0x2e00a100}, -}; - -int rda5890_get_fw_version_polling(struct rda5890_private *priv, unsigned int* version) -{ - int ret = -1; - char wid_req[255]; - unsigned short wid_req_len = 6; - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - unsigned short wid; - char wid_msg_id = priv->wid_msg_id++; - unsigned char *ptr_payload; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - - wid_req[0] = 'Q'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - wid = WID_SYS_FW_VER; - wid_req[4] = (char)(wid&0x00FF); - wid_req[5] = (char)((wid&0xFF00) >> 8); - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "__func__ <<<\n" ); - - ret = rda5890_wid_request_polling(priv, wid_req, wid_req_len, - wid_rsp, &wid_rsp_len); - if (ret) { - goto out; - } - - ret = rda5890_check_wid_response(priv->wid_rsp, priv->wid_rsp_len, wid, wid_msg_id, - 4, &ptr_payload); - - if(!ret) - { - memcpy((unsigned char *)version, ptr_payload, 4); - } - else - *version = 0; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "__func__ version: %x >>> \n" , *version); - -out: - return ret; -} - - -int rda5890_write_sdio32_polling(struct rda5890_private *priv,const unsigned int (*data)[2], unsigned int size) -{ - int count = size, index = 0; - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - - for(index = 0; index < count/8; index ++) //each time write five init data - { - ret = rda5890_set_core_init_polling(priv, data[8*index], 8); - if(ret < 0) - goto err; - } - - if(count%8 > 0) - { - ret = rda5890_set_core_init_polling(priv, data[8*index], count%8); - if(ret < 0) - goto err; - } -err: - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s :ret=%d <<< \n", __func__, ret); - return ret; -} - -int rda5890_write_sdio32(struct rda5890_private *priv, const unsigned int (*data)[2], unsigned int size) -{ - int count = size, index = 0; - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - - for(index = 0; index < count/8; index ++) //each time write five init data - { - ret = rda5890_set_core_init(priv, data[8*index], 8); - if(ret < 0) - goto err; - } - - if(count%8 > 0) - { - ret = rda5890_set_core_init(priv, data[8*index], count%8); - if(ret < 0) - goto err; - } -err: - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s :ret=%d <<< \n", __func__, ret); - return ret; -} - -int rda5890_write_sdio8_polling(struct rda5890_private *priv, const unsigned char (*data)[2], unsigned int size) -{ - int count = size, index = 0; - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - - for(index = 0; index < count/8; index ++) //each time write five init data - { - ret = rda5890_set_core_patch_polling(priv, data[8*index], 8); - if(ret < 0) - goto err; - } - - if(count%8 > 0) - { - ret = rda5890_set_core_patch_polling(priv, data[8*index], count%8); - if(ret < 0) - goto err; - } -err: - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s :ret=%d <<< \n", __func__, ret); - return ret; -} - - -int rda5890_write_sdio8(struct rda5890_private *priv ,const unsigned char (*data)[2], unsigned int size) -{ - int count = size, index = 0; - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - - for(index = 0; index < count/8; index ++) //each time write five init data - { - ret = rda5890_set_core_patch(priv, data[8*index], 8); - if(ret < 0) - goto err; - } - - if(count%8 > 0) - { - ret = rda5890_set_core_patch(priv, data[8*index], count%8); - if(ret < 0) - goto err; - } -err: - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s :ret=%d <<< \n", __func__, ret); - return ret; -} - -int rda5890_sdio_patch_core_32(struct rda5890_private *priv) -{ - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - - if(priv->version == 7) - ret = rda5890_write_sdio32_polling(priv,wifi_core_patch_data_32, - sizeof(wifi_core_patch_data_32)/sizeof(wifi_core_patch_data_32[0])); - else if(priv->version == 4 || priv->version == 5) - ret = rda5890_write_sdio32_polling(priv,wifi_core_patch_data_32_E, - sizeof(wifi_core_patch_data_32_E)/sizeof(wifi_core_patch_data_32_E[0])); - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - return ret; -} - - -int rda5890_sdio_init_core(struct rda5890_private *priv) -{ - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - if(priv->version == 7) - ret = rda5890_write_sdio32(priv, wifi_core_init_data_32, - sizeof(wifi_core_init_data_32)/sizeof(wifi_core_init_data_32[0])); - else if(priv->version == 4 || priv->version == 5) - ret = rda5890_write_sdio32(priv, wifi_core_init_data_32_E, - sizeof(wifi_core_init_data_32_E)/sizeof(wifi_core_init_data_32_E[0])); - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - - return ret; -} - -int rda5890_sdio_init_core_polling(struct rda5890_private *priv) -{ - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - if(priv->version == 7) - ret = rda5890_write_sdio32_polling(priv, wifi_core_init_data_32, - sizeof(wifi_core_init_data_32)/sizeof(wifi_core_init_data_32[0])); - else if(priv->version == 4 || priv->version == 5) - ret = rda5890_write_sdio32_polling(priv, wifi_core_init_data_32_E, - sizeof(wifi_core_init_data_32_E)/sizeof(wifi_core_init_data_32_E[0])); - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - return ret; -} - - -int rda5890_sdio_patch_core_8(struct rda5890_private *priv) -{ - int ret = 0; - //for patch in byte mode - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - - ret = rda5890_write_sdio8(priv, wifi_core_patch_data_8, - sizeof(wifi_core_patch_data_8)/sizeof(wifi_core_patch_data_8[0])); - - //for patch in wake continue clock mode - ret = rda5890_sdio_core_wake_mode(priv); - if(ret < 0) - goto err; - -err: - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - return ret; -} - -int rda5890_sdio_patch_core_8_polling(struct rda5890_private *priv) -{ - int ret = 0; - //for patch in byte mode - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - - ret = rda5890_write_sdio8_polling(priv, wifi_core_patch_data_8, - sizeof(wifi_core_patch_data_8)/sizeof(wifi_core_patch_data_8[0])); - if(ret < 0) - goto err; - - //for patch in wake continue clock mode - ret = rda5890_sdio_core_wake_mode_polling(priv); - if(ret < 0) - goto err; - -err: - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - return ret; -} - -int rda5890_sdio_set_default_notch(struct rda5890_private *priv) -{ - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - - if(priv->version == 7) - ret = rda5890_write_sdio32(priv, wifi_notch_data, - sizeof(wifi_notch_data)/sizeof(wifi_notch_data[0])); - else if(priv->version == 4 || priv->version == 5) - ret = rda5890_write_sdio32(priv, wifi_notch_data_E, - sizeof(wifi_notch_data_E)/sizeof(wifi_notch_data_E[0])); - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - return ret; -} - -int rda5890_sdio_set_default_notch_polling(struct rda5890_private *priv) -{ - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - if(priv->version == 7) - ret = rda5890_write_sdio32_polling(priv, wifi_notch_data, - sizeof(wifi_notch_data)/sizeof(wifi_notch_data[0])); - else if(priv->version == 4 || priv->version == 5) - ret = rda5890_write_sdio32_polling(priv, wifi_notch_data_E, - sizeof(wifi_notch_data_E)/sizeof(wifi_notch_data_E[0])); - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - return ret; -} - - -// -unsigned char rssi_switch_default_data_u8[][2] = -{ - {0x25, 0x00} -}; - -void rda5890_sdio_set_notch_by_channel(struct rda5890_private *priv, unsigned int channel) -{ -#if 0 - int count = 0, index = 0; - - if(priv->version == 7) - count = sizeof(wifi_notch_data)/(sizeof(wifi_notch_data[0]) * 4); - else if(priv->version == 4 || priv->version == 5) - count = sizeof(wifi_notch_data_E)/(sizeof(wifi_notch_data_E[0]) * 4); - channel = channel % count; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - - if(channel > 1) - channel -= 1; - - if(priv->version == 7) - { - rda5890_set_core_init(priv, wifi_notch_data[4*channel], 4); - rda5890_set_core_patch(priv, rssi_switch_default_data_u8, 1); - } - else if(priv->version == 4 || priv->version == 5) - { - rda5890_set_core_init(priv, wifi_notch_data_E[4*channel], 4); - rda5890_set_core_patch(priv, rssi_switch_default_data_u8, 1); - } - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<< ch = %d \n", __func__, channel + 1); -#endif -} - -int rda5890_sdio_core_wake_mode(struct rda5890_private *priv) -{ - int ret = 0; - - ret = rda5890_write_sdio32(priv, wifi_core_data_wake, - sizeof(wifi_core_data_wake)/sizeof(wifi_core_data_wake[0])); - - return ret; -} - -int rda5890_sdio_core_wake_mode_polling(struct rda5890_private *priv) -{ - int ret = 0; - - ret = rda5890_write_sdio32_polling(priv, wifi_core_data_wake, - sizeof(wifi_core_data_wake)/sizeof(wifi_core_data_wake[0])); - return ret; -} - -int rda5890_sdio_core_sleep_mode(struct rda5890_private *priv) -{ - int ret = 0; - - ret = rda5890_write_sdio32(priv,wifi_core_data_sleep, - sizeof(wifi_core_data_sleep)/sizeof(wifi_core_data_sleep[0])); - return ret; -} - -extern void export_wifi_eirq_enable(); -int rda5890_sdio_init(struct rda5890_private *priv) -{ - int ret = 0; - unsigned long para = 0; - - sdio_init_complete = 0; - sdio_patch_complete = 0; - - printk(KERN_INFO " rda5890_sdio_init <<< \n"); - - ret = rda5890_sdio_patch_core_32(priv); - if(ret < 0) - goto err; - - printk(KERN_INFO "sdio_patch_complete wid_msg = %d \n", priv->wid_msg_id); - rda5890_shedule_timeout(10); //10ms delay - sdio_patch_complete = 1; - -#if 0 - ret = rda5890_sdio_init_core(priv); - if(ret < 0) - goto err; - - ret = rda5890_sdio_patch_core_8(priv); - if(ret < 0) - goto err; - - ret = rda5890_sdio_set_default_notch(priv); - if(ret < 0) - goto err; -#else - - ret = rda5890_sdio_init_core_polling(priv); - if(ret < 0) - goto err; - - ret = rda5890_sdio_patch_core_8_polling(priv); - if(ret < 0) - goto err; - - ret = rda5890_sdio_set_default_notch_polling(priv); - if(ret < 0) - goto err; - -#endif - export_wifi_eirq_enable(); - -#if 0 - rda5890_generic_set_ulong(priv, WID_MEMORY_ADDRESS, 0x30010008); - rda5890_generic_get_ulong(priv, WID_MEMORY_ACCESS_32BIT, ¶); - printk(KERN_INFO "rda5890_sdio_init para = %x \n", para); - para |= 0x200; - rda5890_generic_set_ulong(priv, WID_MEMORY_ACCESS_32BIT, para); - - rda5890_generic_set_ulong(priv, WID_MEMORY_ADDRESS, 0x30010010); - rda5890_generic_get_ulong(priv, WID_MEMORY_ACCESS_32BIT, ¶); - printk(KERN_INFO "rda5890_sdio_init para1 = %x \n", para); - para &= ~0x200; - rda5890_generic_set_ulong(priv, WID_MEMORY_ACCESS_32BIT, para); -#endif - - sdio_init_complete = 1; - -err: - return ret; -} - -//rssi > 200 -u32 rssi_switch_data_u32[][2] = -{ - {0x50090040, 0x10000000}, - {0x50090044, 0x10000000}, -}; - -u8 rssi_switch_data_u8[][2] = -{ - {0x25, 0x18} -}; - -void rda5890_rssi_up_to_200(struct rda5890_private *priv) -{ -#if 0 - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - rda5890_set_core_init(priv, rssi_switch_data_u32, 2); - rda5890_set_core_patch(priv, rssi_switch_data_u8, 1); - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); -#endif -} - -u32 rda5990_assoc_power_save_data32[][2] = -{ - { 0x5000050c, 0x00008000 }// for association power save -}; - -void rda5990_assoc_power_save(struct rda5890_private *priv) -{ - rda5890_set_core_init(priv, rda5990_assoc_power_save_data32, 1); -} - -unsigned char is_sdio_init_complete(void) -{ - return sdio_init_complete; -} -unsigned char is_sdio_patch_complete(void) //after patch complete need check write flow -{ - return sdio_patch_complete; -} - -#ifdef WIFI_TEST_MODE - -static unsigned int wifi_test_mode_rx_notch_32[][2] = -{ - //item:notch_filter_5 - {0x50090040,0x076794b4},//8m - {0x50090044,0x10000000}, - //item:notch_filter_6 - {0x50090040,0x077c71de},//3m - {0x50090044,0x046d242e},//7m - //item:notch_filter_7 - {0x50090040,0x077e7ec0},//2m - {0x50090044,0x077e7140},//-2m - //item:notch_filter_8 - {0x50090040,0x077c7e22},//3m - {0x50090044,0x046d2bd2},//7m - //item:notch_filter_c - {0x50090040,0x07764310},//5m - {0x50090044,0x10000000}, - //item:notch_filter_e - {0x50090040,0x0779c279},//4m - {0x50090044,0x0779cd87},//-4m - //item:disable_notch - {0x50090040,0x10000000}, - {0x50090044,0x10000000}, -}; - -static unsigned int wifi_test_mode_agc_patch32[][2] = -{ - {0x50000600,0x0000501a},//write 1a(52) to 28h hightolow - {0x50000600,0x0000520d},//write 0d(26) to 29h hightomid - {0x50000600,0x00006a1e},//35h reg coarse2 upper window from 0d to 1a for l - //;50000600H,32'h00009890;//4ch reg unlock upper threshold from 70 to 90 - {0x50000600,0x00009a38},//4dh reg unlock lower threshold from 78 to 38 - {0x50000600,0x00007207},//39h reg change vga gain ,9 -> 7 for big signal - {0x50000600,0x0001c8f5},//e4h reg change hpf coeff to f5 - {0x50000600,0x00004200},//21h reg add fine gain 0db - {0x50000600,0x00004610},//23h reg change maxgain index as agc table - {0x50000600,0x0000900e},//48h reg unlock lower threshold change from 0a to - {0x50000600,0x00004a00},//25h reg pecket dection threshold - {0x50000600,0x000040a8},//20h reg add fine itr2 98->a8 - {0x50000600,0x00007e05},//3f reg rssi window for fine itr2 0->5 - {0x50000600,0x00008237},//41 reg fine itr1 nextstate 4->3 - {0x50000600,0x00008440},//42 reg fine itr2 nextstate 0->4 settle time 0->d - {0x50000600,0x0000b6a9},//5b reg change GreatN rssi avg count from 1 to 8 -} ; - -static unsigned int rda5990_test_mode_digital32[][2] = -{ - //item111:ver_D_wf_dig_20120208 - {0x30010000,0x780369AF}, //disable tports - //wait 100ms; - {0x30000010,0x7000FFFF}, - //item:agc_table_20110921 - {0x50090054,0x00000001},//enable update - {0x50090200,0x00000000}, - {0x50090204,0x00000000}, - {0x50090208,0x00000002}, - {0x5009020c,0x00000004}, - {0x50090210,0x00000006}, - {0x50090214,0x00000008}, - {0x50090218,0x0000000a}, - {0x5009021c,0x00000040}, - {0x50090220,0x00000042}, - {0x50090224,0x00000044}, - {0x50090228,0x00000046}, - {0x5009022c,0x00000048}, - {0x50090230,0x0000004a}, - {0x50090234,0x00000080}, - {0x50090238,0x00000082}, - {0x5009023c,0x00000084}, - {0x50090240,0x00000086}, - {0x50090244,0x00000088}, - {0x50090248,0x0000008a}, - {0x5009024c,0x000000c0}, - {0x50090250,0x000000c2}, - {0x50090254,0x000000c4}, - {0x50090258,0x000000c6}, - {0x5009025c,0x000000c8}, - {0x50090260,0x000000ca}, - {0x50090264,0x00000100}, - {0x50090268,0x00000102}, - {0x5009026c,0x00000104}, - {0x50090270,0x00000106}, - {0x50090274,0x00000108}, - {0x50090278,0x00000140}, - {0x5009027c,0x00000142},//lna =0 end - {0x50090280,0x00000080}, - {0x50090284,0x00000082}, - {0x50090288,0x00000084}, - {0x5009028c,0x00000086}, - {0x50090290,0x00000088}, - {0x50090294,0x0000008a}, - {0x50090298,0x000000c0}, - {0x5009029c,0x000000c2}, - {0x500902a0,0x000000c4}, - {0x500902a4,0x000000c6}, - {0x500902a8,0x000000c8}, - {0x500902ac,0x000000ca}, - {0x500902b0,0x00000100}, - {0x500902b4,0x00000102}, - {0x500902b8,0x00000104}, - {0x500902bc,0x00000106}, - {0x500902c0,0x00000108}, - {0x500902c4,0x00000140}, - {0x500902c8,0x00000142}, - {0x500902cc,0x00000144}, - {0x500902d0,0x00000146}, - {0x500902d4,0x00000148}, - {0x500902d8,0x00000180}, - {0x500902dc,0x00000182}, - {0x500902e0,0x00000184}, - {0x500902e4,0x000001c0}, - {0x500902e8,0x000001c2}, - {0x500902ec,0x000001c4}, - {0x500902f0,0x000001c6}, - {0x500902f4,0x000001c8}, - {0x500902f8,0x000001ca}, - {0x500902fc,0x000001cc},// lna = 01 end - {0x50090300,0x00000102}, - {0x50090304,0x00000104}, - {0x50090308,0x00000106}, - {0x5009030c,0x00000108}, - {0x50090310,0x00000140}, - {0x50090314,0x00000142}, - {0x50090318,0x00000144}, - {0x5009031c,0x00000146}, - {0x50090320,0x00000148}, - {0x50090324,0x00000180}, - {0x50090328,0x00000182}, - {0x5009032c,0x00000184}, - {0x50090330,0x000001c0}, - {0x50090334,0x000001c2}, - {0x50090338,0x000001c4}, - {0x5009033c,0x000001c6}, - {0x50090340,0x000001c8}, - {0x50090344,0x000001c9}, - {0x50090348,0x000001c9}, - {0x5009034c,0x000001c9}, - {0x50090350,0x000001c9}, - {0x50090354,0x000001c9}, - {0x50090358,0x000001c9}, - {0x5009035c,0x000001c9}, - {0x50090360,0x000001c9}, - {0x50090364,0x000001c9}, - {0x50090368,0x000001c9}, - {0x5009036c,0x000001c9}, - {0x50090370,0x000001c9}, - {0x50090374,0x000001c9}, - {0x50090378,0x000001c9}, - {0x5009037c,0x000001c9}, - {0x50090054,0x00000000},//disable update - {0x50000808,0x65000013}, // disable prerx_prio - //pta config - {0x50000810,0xFFCD0F01}, //rx beacon priority -}; - -int rda5890_set_test_mode(struct rda5890_private *priv) -{ - int ret = 0; - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_CRIT, - "%s >>> \n", __func__); - - sdio_init_complete = 0; - sdio_patch_complete = 0; - ret = rda5890_sdio_patch_core_32(priv); - if(ret < 0) - goto err; - sdio_patch_complete = 1; - - ret = rda5890_write_sdio8_polling(priv, wifi_core_patch_data_8, - sizeof(wifi_core_patch_data_8)/sizeof(wifi_core_patch_data_8[0])); - if(ret < 0) - goto err; - - ret = rda5890_write_sdio32_polling(priv, rda5990_test_mode_digital32, - sizeof(rda5990_test_mode_digital32)/sizeof(rda5990_test_mode_digital32[0])); - if(ret < 0) - goto err; - - ret = rda5890_write_sdio32_polling(priv, wifi_test_mode_agc_patch32, - sizeof(wifi_test_mode_agc_patch32)/sizeof(wifi_test_mode_agc_patch32[0])); - if(ret < 0) - goto err; - - ret = rda5890_write_sdio32_polling(priv, wifi_test_mode_rx_notch_32, - sizeof(wifi_test_mode_rx_notch_32)/sizeof(wifi_test_mode_rx_notch_32[0])); - if(ret < 0) - goto err; - - - ret = rda5890_sdio_set_default_notch_polling(priv); - if(ret < 0) - goto err; - - export_wifi_eirq_enable(); - sdio_init_complete = 1; - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_CRIT, - "%s <<< \n", __func__); - return ret; - -err: - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_CRIT, "rda5890_set_test_mode err!! \n" ); - return ret; -} -#endif - - \ No newline at end of file diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_txrx.c b/drivers/net/wireless/rda5990/rda_wlan/rda5890_txrx.c deleted file mode 100755 index ad01fea20b1d..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_txrx.c +++ /dev/null @@ -1,139 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rda5890_defs.h" -#include "rda5890_dev.h" -#include "rda5890_wid.h" -#include "rda5890_wext.h" - -void rda5890_data_rx(struct rda5890_private *priv, - char *data, unsigned short data_len) -{ - struct sk_buff *skb; - char *pkt_data; - - RDA5890_DBGLAP(RDA5890_DA_TXRX, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - skb = dev_alloc_skb(data_len + NET_IP_ALIGN); - if (!skb) { - priv->stats.rx_dropped++; - return; - } - skb_reserve(skb, NET_IP_ALIGN); - pkt_data = skb_put(skb, data_len); - memcpy(pkt_data, data, data_len); - skb->dev = priv->dev; - skb->protocol = eth_type_trans(skb, priv->dev); - skb->ip_summed = CHECKSUM_NONE; - - RDA5890_DBGLAP(RDA5890_DA_TXRX, RDA5890_DL_TRACE, - "netif rx, len %d\n", skb->len); - RDA5890_DBGLAP(RDA5890_DA_TXRX, RDA5890_DL_TRACE, - "%02x %02x %02x %02x ... ... %02x %02x %02x %02x\n", - skb->data[0], skb->data[1], skb->data[2], skb->data[3], - skb->data[skb->len - 4], skb->data[skb->len - 3], - skb->data[skb->len - 2], skb->data[skb->len - 1]); - - priv->stats.rx_packets++; - priv->stats.rx_bytes += data_len; - - if (in_interrupt()) - netif_rx(skb); - else - netif_rx_ni(skb); - - RDA5890_DBGLAP(RDA5890_DA_TXRX, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); -} - - -int rda5890_host_to_card(struct rda5890_private *priv, - char *packet, unsigned short packet_len, unsigned char packet_type) -{ - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - - ret = priv->hw_host_to_card(priv, packet, packet_len, packet_type); - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - - return ret; -} - - -int rda5890_data_tx(struct rda5890_private *priv, - struct sk_buff *skb, struct net_device *dev) -{ - int ret; - char *pkt_data; - uint16_t pkt_len; - char buf[ETH_FRAME_LEN + 2]; - uint16_t data_len; - - RDA5890_DBGLAP(RDA5890_DA_TXRX, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - - ret = NETDEV_TX_OK; - - if (!skb->len || (skb->len > ETH_FRAME_LEN)) { - priv->stats.tx_dropped++; - priv->stats.tx_errors++; - goto free; - } - - pkt_data = skb->data; - pkt_len = skb->len; - - RDA5890_DBGLAP(RDA5890_DA_TXRX, RDA5890_DL_TRACE, - "netif tx len %d\n", pkt_len); - RDA5890_DBGLAP(RDA5890_DA_TXRX, RDA5890_DL_TRACE, - "%02x %02x %02x %02x ... ... %02x %02x %02x %02x\n", - skb->data[0], skb->data[1], skb->data[2], skb->data[3], - skb->data[skb->len - 4], skb->data[skb->len - 3], - skb->data[skb->len - 2], skb->data[skb->len - 1]); - - /* FIXME: we can save this memcpy by adding header inside the sdio driver */ - memcpy(buf + 2, pkt_data, pkt_len); - data_len = pkt_len + 2; - buf[0] = (char)(data_len&0xFF); - buf[1] = (char)((data_len>>8)&0x0F); - buf[1] |= 0x10; // for DataOut 0x1 - - //RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_NORM, - // "sdio tx len %d\n", data_len); - //RDA5890_DBGLAP(RDA5890_DA_ETHER, RDA5890_DL_NORM, - // "%02x %02x %02x %02x ... ... %02x %02x %02x %02x\n", - // buf[0], buf[1], buf[2], buf[3], - // buf[data_len - 4], buf[data_len - 3], - // buf[data_len - 2], buf[data_len - 1]); - - ret = rda5890_host_to_card(priv, buf, data_len, DATA_REQUEST_PACKET); - if (ret) { - RDA5890_ERRP("host_to_card send failed, ret = %d\n", ret); - goto free; - } - - priv->stats.tx_packets++; - priv->stats.tx_bytes += skb->len; - - dev->trans_start = jiffies; - - free: - /* free right away, since we do copy */ - dev_kfree_skb_any(skb); - - RDA5890_DBGLAP(RDA5890_DA_TXRX, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - return ret; -} - diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_txrx.h b/drivers/net/wireless/rda5990/rda_wlan/rda5890_txrx.h deleted file mode 100755 index 6f161b90e384..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_txrx.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _RDA5890_TXRX_H_ -#define _RDA5890_TXRX_H_ - -int rda5890_host_to_card(struct rda5890_private *priv, - char *packet, unsigned short packet_len, unsigned char packet_type); - -void rda5890_data_rx(struct rda5890_private *priv, - char *data, unsigned short data_len); -int rda5890_data_tx(struct rda5890_private *priv, - struct sk_buff *skb, struct net_device *dev); - -#endif - diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_wext.c b/drivers/net/wireless/rda5990/rda_wlan/rda5890_wext.c deleted file mode 100755 index ae06196773c3..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_wext.c +++ /dev/null @@ -1,2562 +0,0 @@ -/** - * This file contains ioctl functions - */ -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "rda5890_defs.h" -#include "rda5890_dev.h" -#include "rda5890_ioctl.h" -#include "rda5890_wid.h" -#include "rda5890_wext.h" - -#define WLAN_AUTH_OPEN 0 -#define WLAN_AUTH_SHARED_KEY 1 -#define WLAN_AUTH_FT 2 -#define WLAN_AUTH_LEAP 128 - -#define WLAN_AUTH_CHALLENGE_LEN 128 - -#define WLAN_CAPABILITY_ESS (1<<0) -#define WLAN_CAPABILITY_IBSS (1<<1) -#define WLAN_CAPABILITY_CF_POLLABLE (1<<2) -#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) -#define WLAN_CAPABILITY_PRIVACY (1<<4) -#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) -#define WLAN_CAPABILITY_PBCC (1<<6) -#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) -#define IW_AUTH_ALG_WAPI 0x08 -#define IW_ENCODE_ALG_WAPI 0x80 - -static int rda5890_get_name(struct net_device *dev, struct iw_request_info *info, - char *cwrq, char *extra) -{ - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - /* We could add support for 802.11n here as needed. Jean II */ - snprintf(cwrq, IFNAMSIZ, "IEEE 802.11b/g"); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_get_freq(struct net_device *dev, struct iw_request_info *info, - struct iw_freq *fwrq, char *extra) -{ - //struct rda5890_private *priv = netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - fwrq->m = (long)2437 * 100000; - fwrq->e = 1; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_get_wap(struct net_device *dev, struct iw_request_info *info, - struct sockaddr *awrq, char *extra) -{ - struct rda5890_private *priv = (struct rda5890_private *) netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - if (priv->connect_status == MAC_CONNECTED) { - memcpy(awrq->sa_data, priv->curbssparams.bssid, ETH_ALEN); - } else { - memset(awrq->sa_data, 0, ETH_ALEN); - } - awrq->sa_family = ARPHRD_ETHER; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_set_nick(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_get_nick(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_set_rts(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_get_rts(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - //struct rda5890_private *priv = netdev_priv(dev); - int ret = 0; - u16 val = 0; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - val = 600; - - vwrq->value = val; - vwrq->disabled = val > RDA5890_RTS_MAX_VALUE; /* min rts value is 0 */ - vwrq->fixed = 1; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return ret; -} - -static int rda5890_set_frag(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_get_frag(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - //struct rda5890_private *priv = netdev_priv(dev); - int ret = 0; - u16 val = 0; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - val = 1460; - - vwrq->value = val; - vwrq->disabled = ((val < RDA5890_FRAG_MIN_VALUE) - || (val > RDA5890_FRAG_MAX_VALUE)); - vwrq->fixed = 1; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return ret; -} - -static int rda5890_get_mode(struct net_device *dev, - struct iw_request_info *info, u32 * uwrq, char *extra) -{ - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - *uwrq = IW_MODE_INFRA; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_get_txpow(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - //struct rda5890_private *priv = netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - vwrq->value = 20; // in dbm - vwrq->fixed = 1; - vwrq->disabled = 0; - vwrq->flags = IW_TXPOW_DBM; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_set_retry(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_get_retry(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - //struct rda5890_private *priv = netdev_priv(dev); - int ret = 0; - u16 val = 0; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - vwrq->disabled = 0; - - if (vwrq->flags & IW_RETRY_LONG) { - val = 7; - - /* Subtract 1 to convert try count to retry count */ - vwrq->value = val - 1; - vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; - } else { - val = 6; - - /* Subtract 1 to convert try count to retry count */ - vwrq->value = val - 1; - vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; - } - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return ret; -} - -/** - * 802.11b/g supported bitrates (in 500Kb/s units) - */ -u8 rda5890_bg_rates[MAX_RATES] = - { 0x02, 0x04, 0x0b, 0x16, 0x0c, 0x12, 0x18, - 0x24, 0x30, 0x48, 0x60, 0x6c,0x00, 0x00 }; - -u16 rda5890_nr_chan = 11; - -/** - * @brief Get Range Info - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * @return 0 --success, otherwise fail - */ -static int rda5890_get_range(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - //struct rda5890_private *priv = netdev_priv(dev); - struct iw_range *range = (struct iw_range *)extra; - int i; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - dwrq->length = sizeof(struct iw_range); - memset(range, 0, sizeof(struct iw_range)); - - range->min_nwid = 0; - range->max_nwid = 0; - - range->num_bitrates = sizeof(rda5890_bg_rates); - for (i = 0; i < range->num_bitrates; i++) - range->bitrate[i] = rda5890_bg_rates[i] * 500000; - range->num_bitrates = i; - - range->num_frequency = 0; - - range->scan_capa = IW_SCAN_CAPA_ESSID; - - for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) - && (i < rda5890_nr_chan); i++) { - range->freq[range->num_frequency].i = (long)(i + 1); - range->freq[range->num_frequency].m = - (long)((2412 + 5 * i) * 100000); - range->freq[range->num_frequency].e = 1; - range->num_frequency++; - } - - range->num_channels = range->num_frequency; - - /* - * Set an indication of the max TCP throughput in bit/s that we can - * expect using this interface - */ - range->throughput = 5000 * 1000; - - range->min_rts = RDA5890_RTS_MIN_VALUE; - range->max_rts = RDA5890_RTS_MAX_VALUE; - range->min_frag = RDA5890_FRAG_MIN_VALUE; - range->max_frag = RDA5890_FRAG_MAX_VALUE; - - range->encoding_size[0] = 5; - range->encoding_size[1] = 13; - range->num_encoding_sizes = 2; - range->max_encoding_tokens = 4; - - /* - * Right now we support only "iwconfig ethX power on|off" - */ - range->pm_capa = IW_POWER_ON; - - /* - * Minimum version we recommend - */ - range->we_version_source = 15; - - /* - * Version we are compiled with - */ - range->we_version_compiled = WIRELESS_EXT; - - range->retry_capa = IW_RETRY_LIMIT; - range->retry_flags = IW_RETRY_LIMIT | IW_RETRY_MAX; - - range->min_retry = 0; - range->max_retry = 14; - - /* - * Set the qual, level and noise range values - */ - range->max_qual.qual = 100; - range->max_qual.level = 0; - range->max_qual.noise = 0; - range->max_qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; - - range->avg_qual.qual = 70; - /* TODO: Find real 'good' to 'bad' threshold value for RSSI */ - range->avg_qual.level = 0; - range->avg_qual.noise = 0; - range->avg_qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; - - range->sensitivity = 0; - - /* Setup the supported power level ranges */ - memset(range->txpower, 0, sizeof(range->txpower)); - range->txpower_capa = IW_TXPOW_DBM | IW_TXPOW_RANGE; - range->txpower[0] = 0; - range->txpower[1] = 20; - range->num_txpower = 2; - - range->event_capa[0] = (IW_EVENT_CAPA_K_0 | - IW_EVENT_CAPA_MASK(SIOCGIWAP) | - IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); - range->event_capa[1] = IW_EVENT_CAPA_K_1; - - range->enc_capa = IW_ENC_CAPA_WPA - | IW_ENC_CAPA_WPA2 - | IW_ENC_CAPA_CIPHER_TKIP - | IW_ENC_CAPA_CIPHER_CCMP; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_set_power(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - //struct rda5890_private *priv = netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_get_power(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - //struct rda5890_private *priv = netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - vwrq->value = 0; - vwrq->flags = 0; - vwrq->disabled = 0; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_update_bss_stats(struct rda5890_private *priv) -{ - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - memcpy(priv->curbssparams.ssid, - priv->assoc_ssid, sizeof(priv->curbssparams.ssid)); - - if(priv->scan_running == 1) - return ret; - - ret = rda5890_get_bssid(priv, priv->curbssparams.bssid); - if (ret) { - RDA5890_ERRP("rda5890_get_bssid, ret = %d\n", ret); - goto out; - } - -#if 0 - ret = rda5890_get_channel(priv, &priv->curbssparams.channel); - if (ret) { - RDA5890_ERRP("rda5890_get_channel, ret = %d\n", ret); - goto out; - } -#endif - - ret = rda5890_get_rssi(priv, &priv->curbssparams.rssi); - if (ret) { - RDA5890_ERRP("rda5890_get_rssi, ret = %d\n", ret); - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<< ch = %d rssi = %d\n", __func__, priv->curbssparams.channel, priv->curbssparams.rssi); - -out: - return ret; -} - -static struct iw_statistics *rda5890_get_wireless_stats(struct net_device *dev) -{ - struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - int stats_valid = 0; - u8 snr; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - if (priv->connect_status != MAC_CONNECTED) - goto out; - - rda5890_update_bss_stats(priv); - - priv->wstats.miss.beacon = 0; - priv->wstats.discard.retries = 0; - priv->wstats.qual.level = priv->curbssparams.rssi > 127? priv->curbssparams.rssi - 271 - :priv->curbssparams.rssi - 15; - - snr = priv->wstats.qual.level - RDA5890_NF_DEFAULT_SCAN_VALUE; - priv->wstats.qual.qual = - (100 * RSSI_DIFF * RSSI_DIFF - (PERFECT_RSSI - snr) * - (15 * (RSSI_DIFF) + 62 * (PERFECT_RSSI - snr))) / - (RSSI_DIFF * RSSI_DIFF); - if (priv->wstats.qual.qual > 100) - priv->wstats.qual.qual = 100; - priv->wstats.qual.noise = RDA5890_NF_DEFAULT_SCAN_VALUE; - priv->wstats.qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; - - stats_valid = 1; - -out: - if (!stats_valid) { - priv->wstats.miss.beacon = 0; - priv->wstats.discard.retries = 0; - priv->wstats.qual.qual = 0; - priv->wstats.qual.level = 0; - priv->wstats.qual.noise = 0; - priv->wstats.qual.updated = IW_QUAL_ALL_UPDATED; - priv->wstats.qual.updated |= IW_QUAL_NOISE_INVALID | - IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; - } - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return &priv->wstats; -} - -static int rda5890_set_freq(struct net_device *dev, struct iw_request_info *info, - struct iw_freq *fwrq, char *extra) -{ - //struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_set_rate(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - //struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_get_rate(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - //struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - vwrq->fixed = 0; - vwrq->value = 108*500000; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_set_mode(struct net_device *dev, - struct iw_request_info *info, u32 * uwrq, char *extra) -{ - //struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - - -/** - * @brief Get Encryption key - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * @return 0 --success, otherwise fail - */ -static int rda5890_get_encode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, u8 * extra) -{ - //struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -/** - * @brief Set Encryption key - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * @return 0 --success, otherwise fail - */ -static int rda5890_set_encode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - //struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -/** - * @brief Set Encryption key (internal) - * - * @param priv A pointer to private card structure - * @param key_material A pointer to key material - * @param key_length length of key material - * @param index key index to set - * @param set_tx_key Force set TX key (1 = yes, 0 = no) - * @return 0 --success, otherwise fail - */ -static int copy_wep_key(struct rda5890_private *priv, - const char *key_material, - u16 key_length, - u16 index, - int set_tx_key) -{ - int ret = 0; - struct enc_key *pkey; - - /* Paranoid validation of key index */ - if (index > 3) { - ret = -EINVAL; - goto out; - } - - /* validate max key length */ - if (key_length > KEY_LEN_WEP_104) { - ret = -EINVAL; - goto out; - } - - if (key_length == KEY_LEN_WEP_40) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "WEP40 : %02x%02x%02x%02x%02x\n", - key_material[0], key_material[1], key_material[2], - key_material[3], key_material[4]); - } - else if (key_length == KEY_LEN_WEP_104) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "WEP104 : %02x%02x%02x%02x%02x" - " %02x%02x%02x%02x%02x" - " %02x%02x%02x\n", - key_material[0], key_material[1], key_material[2], - key_material[3], key_material[4], key_material[5], - key_material[6], key_material[7], key_material[8], - key_material[9], key_material[10], key_material[11], - key_material[12]); - } - else { - RDA5890_ERRP("Error in WEP Key length %d\n", key_length); - } - - pkey = &priv->wep_keys[index]; - - if (key_length > 0) { - memset(pkey, 0, sizeof(struct enc_key)); - pkey->type = KEY_TYPE_ID_WEP; - - /* Standardize the key length */ - pkey->len = (key_length > KEY_LEN_WEP_40) ? - KEY_LEN_WEP_104 : KEY_LEN_WEP_40; - memcpy(pkey->key, key_material, key_length); - } - - if (set_tx_key) { - /* Ensure the chosen key is valid */ - if (!pkey->len) { - RDA5890_ERRP("key not set, so cannot enable it\n"); - ret = -EINVAL; - goto out; - } - priv->wep_tx_keyidx = index; - } - - priv->secinfo.wep_enabled = 1; - -out: - return ret; -} - -static int validate_key_index(u16 def_index, u16 raw_index, - u16 *out_index, u16 *is_default) -{ - if (!out_index || !is_default) - return -EINVAL; - - /* Verify index if present, otherwise use default TX key index */ - if (raw_index > 0) { - if (raw_index > 4) - return -EINVAL; - *out_index = raw_index - 1; - } else { - *out_index = def_index; - *is_default = 1; - } - return 0; -} - -static void disable_wep(struct rda5890_private *priv) -{ - int i; - - /* Set Open System auth mode */ - priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - - /* Clear WEP keys and mark WEP as disabled */ - priv->secinfo.wep_enabled = 0; - for (i = 0; i < 4; i++) - priv->wep_keys[i].len = 0; - - set_bit(ASSOC_FLAG_SECINFO, &priv->assoc_flags); - set_bit(ASSOC_FLAG_WEP_KEYS, &priv->assoc_flags); -} - -static void disable_wpa(struct rda5890_private *priv) -{ - memset(&priv->wpa_mcast_key, 0, sizeof (struct enc_key)); - priv->wpa_mcast_key.flags = KEY_INFO_WPA_MCAST; - set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &priv->assoc_flags); - - memset(&priv->wpa_unicast_key, 0, sizeof (struct enc_key)); - priv->wpa_unicast_key.flags = KEY_INFO_WPA_UNICAST; - set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &priv->assoc_flags); - - priv->secinfo.WPAenabled = 0; - priv->secinfo.WPA2enabled = 0; - priv->secinfo.cipther_type = 0; - priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - set_bit(ASSOC_FLAG_SECINFO, &priv->assoc_flags); -} - -/** - * @brief Get Extended Encryption key (WPA/802.1x and WEP) - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * @return 0 on success, otherwise failure - */ -static int rda5890_get_encodeext(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - int ret = -EINVAL; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int index, max_key_len; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - max_key_len = dwrq->length - sizeof(*ext); - if (max_key_len < 0) - goto out; - - index = dwrq->flags & IW_ENCODE_INDEX; - if (index) { - if (index < 1 || index > 4) - goto out; - index--; - } else { - index = priv->wep_tx_keyidx; - } - - if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) && - ext->alg != IW_ENCODE_ALG_WEP) { - if (index != 0) - goto out; - } - - dwrq->flags = index + 1; - memset(ext, 0, sizeof(*ext)); - - if ( !priv->secinfo.wep_enabled - && !priv->secinfo.WPAenabled - && !priv->secinfo.WPA2enabled) { - ext->alg = IW_ENCODE_ALG_NONE; - ext->key_len = 0; - dwrq->flags |= IW_ENCODE_DISABLED; - } else { - u8 *key = NULL; - - if ( priv->secinfo.wep_enabled - && !priv->secinfo.WPAenabled - && !priv->secinfo.WPA2enabled) { - /* WEP */ - ext->alg = IW_ENCODE_ALG_WEP; - ext->key_len = priv->wep_keys[index].len; - key = &priv->wep_keys[index].key[0]; - } else if ( !priv->secinfo.wep_enabled - && (priv->secinfo.WPAenabled || - priv->secinfo.WPA2enabled)) { - /* WPA */ - struct enc_key * pkey = NULL; - - if ( priv->wpa_mcast_key.len - && (priv->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED)) - pkey = &priv->wpa_mcast_key; - else if ( priv->wpa_unicast_key.len - && (priv->wpa_unicast_key.flags & KEY_INFO_WPA_ENABLED)) - pkey = &priv->wpa_unicast_key; - - if (pkey) { - if (pkey->type == KEY_TYPE_ID_AES) { - ext->alg = IW_ENCODE_ALG_CCMP; - } else { - ext->alg = IW_ENCODE_ALG_TKIP; - } - ext->key_len = pkey->len; - key = &pkey->key[0]; - } else { - ext->alg = IW_ENCODE_ALG_TKIP; - ext->key_len = 0; - } - } else { - goto out; - } - - if (ext->key_len > max_key_len) { - ret = -E2BIG; - goto out; - } - - if (ext->key_len) - memcpy(ext->key, key, ext->key_len); - else - dwrq->flags |= IW_ENCODE_NOKEY; - dwrq->flags |= IW_ENCODE_ENABLED; - } - ret = 0; - -out: - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -/** - * @brief Set Encryption key Extended (WPA/802.1x and WEP) - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * @return 0 --success, otherwise fail - */ -static int rda5890_set_encodeext(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - int ret = 0; - struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - int alg = ext->alg; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - if ((alg == IW_ENCODE_ALG_NONE) || (dwrq->flags & IW_ENCODE_DISABLED)) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "NO SEC\n"); - if(test_bit(ASSOC_FLAG_ASSOC_START ,&priv->assoc_flags)) - { - if(priv->imode != 3 && priv->imode != 5) - disable_wep (priv); - } - disable_wpa (priv); - } else if (alg == IW_ENCODE_ALG_WEP) { - u16 is_default = 0, index, set_tx_key = 0; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "WEP, flags = 0x%04x\n", dwrq->flags); - - ret = validate_key_index(priv->wep_tx_keyidx, - (dwrq->flags & IW_ENCODE_INDEX), - &index, &is_default); - if (ret) - goto out; - - /* If WEP isn't enabled, or if there is no key data but a valid - * index, or if the set-TX-key flag was passed, set the TX key. - */ - if ( !priv->secinfo.wep_enabled - || (dwrq->length == 0 && !is_default) - || (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)) - set_tx_key = 1; - - /* Copy key to driver */ - ret = copy_wep_key(priv, ext->key, ext->key_len, index, set_tx_key); - if (ret) - goto out; - - /* Set Key to Mac */ - /* Move to assoc_helper_secinfo(), wep_key need to be set after imode */ - //ret = rda5890_set_wepkey(priv, index, ext->key, ext->key_len); - //if (ret) - // goto out; - - if (dwrq->flags & IW_ENCODE_RESTRICTED) { - priv->secinfo.auth_mode = IW_AUTH_ALG_SHARED_KEY; - } else if (dwrq->flags & IW_ENCODE_OPEN) { - priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - } - - /* Mark the various WEP bits as modified */ - set_bit(ASSOC_FLAG_SECINFO, &priv->assoc_flags); - if (dwrq->length) - set_bit(ASSOC_FLAG_WEP_KEYS, &priv->assoc_flags); - if (set_tx_key) - set_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &priv->assoc_flags); - } else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) { - struct enc_key * pkey; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "TKIP or CCMP, flags = 0x%04x, alg = %d\n", dwrq->flags, alg); - - /* validate key length */ - if (((alg == IW_ENCODE_ALG_TKIP) - && (ext->key_len != KEY_LEN_WPA_TKIP)) - || ((alg == IW_ENCODE_ALG_CCMP) - && (ext->key_len != KEY_LEN_WPA_AES))) { - RDA5890_ERRP("invalid size %d for key of alg, type %d\n", - ext->key_len, alg); - ret = -EINVAL; - goto out; - } - - /* Copy key to driver */ - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - pkey = &priv->wpa_mcast_key; - set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &priv->assoc_flags); - } else { - pkey = &priv->wpa_unicast_key; - set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &priv->assoc_flags); - } - - memset(pkey, 0, sizeof (struct enc_key)); - memcpy(pkey->key, ext->key, ext->key_len); - pkey->len = ext->key_len; - if (pkey->len) - pkey->flags |= KEY_INFO_WPA_ENABLED; - - /* Do this after zeroing key structure */ - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - pkey->flags |= KEY_INFO_WPA_MCAST; - } else { - pkey->flags |= KEY_INFO_WPA_UNICAST; - } - - if (alg == IW_ENCODE_ALG_TKIP) { - pkey->type = KEY_TYPE_ID_TKIP; - if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) - && !(priv->imode & (BIT6))) { - RDA5890_ERRP("imode [0x%x] not match with cipher alg TKIP\n", - priv->imode); - } - } else if (alg == IW_ENCODE_ALG_CCMP) { - pkey->type = KEY_TYPE_ID_AES; - if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) - && !(priv->imode & (BIT5))) { - RDA5890_ERRP("imode [0x%x] not match with cipher alg CCMP\n", - priv->imode); - } - } - - /* If WPA isn't enabled yet, do that now */ - if ( priv->secinfo.WPAenabled == 0 - && priv->secinfo.WPA2enabled == 0) { - priv->secinfo.WPAenabled = 1; - priv->secinfo.WPA2enabled = 1; - set_bit(ASSOC_FLAG_SECINFO, &priv->assoc_flags); - } - - /* Set Keys to MAC*/ - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - /* Set GTK */ - /* - *Always use key_id = 1 for now - * need to toggle among 1, 2, 3 - */ - ret = rda5890_set_gtk(priv, 1, ext->tx_seq, IW_ENCODE_SEQ_MAX_SIZE, - pkey->key, pkey->len); - if (ret) - goto out; - } else { - pkey->flags |= KEY_INFO_WPA_UNICAST; - /* Set PTK */ - ret = rda5890_set_ptk(priv, pkey->key, pkey->len); - if (ret) - goto out; - } - - /* Only disable wep if necessary: can't waste time here. */ - disable_wep(priv); - } else if (alg == IW_ENCODE_ALG_WAPI) { //wapi - if(ext->key_len != 32) - goto out; - - priv->is_wapi = 1; - - /* Set Keys to MAC*/ - if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - unsigned char tmp[8]; - /* Set GTK */ - /* - * Always use key_id = 1 for now - * need to toggle among 1, 2, 3 - */ - ret = rda5890_set_gtk(priv, 1, tmp, IW_ENCODE_SEQ_MAX_SIZE, - ext->key, ext->key_len); - if (ret) - goto out; - } else { - /* Set PTK */ - ret = rda5890_set_ptk(priv, ext->key, ext->key_len); - if (ret) - goto out; - } - } - -out: - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -/** - * @brief PMKSA cache operation (WPA/802.1x and WEP) - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * @return 0 on success, otherwise failure - */ -static int rda5890_set_pmksa(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - //struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -static int rda5890_set_genie(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - if(extra[0] == 0x44) //wapi ie - { - unsigned char ie_len = extra[1] + 2; - rda5890_generic_set_str(priv, WID_WAPI_ASSOC_IE, extra ,ie_len); - goto out; - } - - if (dwrq->length > MAX_WPA_IE_LEN || - (dwrq->length && extra == NULL)) { - ret = -EINVAL; - goto out; - } - - if (dwrq->length) { - memcpy(&priv->wpa_ie[0], extra, dwrq->length); - priv->wpa_ie_len = dwrq->length; - } else { - memset(&priv->wpa_ie[0], 0, sizeof(priv->wpa_ie)); - priv->wpa_ie_len = 0; - } - -out: - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return ret; -} - -static int rda5890_get_genie(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *dwrq, - char *extra) -{ - struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - if (priv->wpa_ie_len == 0) { - dwrq->length = 0; - goto out; - } - - if (dwrq->length < priv->wpa_ie_len) { - ret = -E2BIG; - goto out; - } - - dwrq->length = priv->wpa_ie_len; - memcpy(extra, &priv->wpa_ie[0], priv->wpa_ie_len); - -out: - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return ret; -} - -static int rda5890_set_auth(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *dwrq, - char *extra) -{ - struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - int ret = 0; - int updated = 0; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "flags = 0x%04x, value = 0x%x\n", dwrq->flags, dwrq->value); - - switch (dwrq->flags & IW_AUTH_INDEX) { - case IW_AUTH_CIPHER_PAIRWISE: -#ifdef GET_SCAN_FROM_NETWORK_INFO - if (dwrq->value & (IW_AUTH_CIPHER_WEP104 | IW_AUTH_CIPHER_WEP40)) - { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "WEP Selected \n"); - priv->secinfo.wep_enabled = 1; - if(dwrq->value & IW_AUTH_CIPHER_WEP104) - priv->secinfo.cipther_type |= IW_AUTH_CIPHER_WEP104; - else if(dwrq->value & IW_AUTH_CIPHER_WEP40) - priv->secinfo.cipther_type |= IW_AUTH_CIPHER_WEP40; - } - if (dwrq->value & IW_AUTH_CIPHER_TKIP) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "IW_AUTH_CIPHER_TKIP \n"); - priv->secinfo.cipther_type |= IW_AUTH_CIPHER_TKIP; - } - if (dwrq->value & IW_AUTH_CIPHER_CCMP) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "IW_AUTH_CIPHER_CCMP \n"); - priv->secinfo.cipther_type |= IW_AUTH_CIPHER_CCMP; - } - if (dwrq->value & IW_AUTH_CIPHER_NONE) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "OPEN System \n"); - priv->secinfo.cipther_type = IW_AUTH_CIPHER_NONE; - } - break; -#endif - case IW_AUTH_TKIP_COUNTERMEASURES: - case IW_AUTH_CIPHER_GROUP: - case IW_AUTH_DROP_UNENCRYPTED: - /* - * rda5890 does not use these parameters - */ - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "DO NOT USE\n"); - break; - - case IW_AUTH_KEY_MGMT: - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "KEY_MGMT, val = %d\n", dwrq->value); - priv->secinfo.key_mgmt = dwrq->value; - updated = 1; - break; - - case IW_AUTH_WPA_VERSION: - if (dwrq->value & IW_AUTH_WPA_VERSION_DISABLED) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "WPA_VERSION, DISABLED\n"); - priv->secinfo.WPAenabled = 0; - priv->secinfo.WPA2enabled = 0; - disable_wpa (priv); - } - if (dwrq->value & IW_AUTH_WPA_VERSION_WPA) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "WPA_VERSION, WPA\n"); - priv->secinfo.WPAenabled = 1; - priv->secinfo.wep_enabled = 0; - priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - } - if (dwrq->value & IW_AUTH_WPA_VERSION_WPA2) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "WPA_VERSION, WPA2\n"); - priv->secinfo.WPA2enabled = 1; - priv->secinfo.wep_enabled = 0; - priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - } - updated = 1; - break; - - case IW_AUTH_80211_AUTH_ALG: - if (dwrq->value & IW_AUTH_ALG_SHARED_KEY || - dwrq->value & IW_AUTH_ALG_OPEN_SYSTEM) - { - if(dwrq->value & IW_AUTH_ALG_SHARED_KEY ) - { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "80211_AUTH_ALG, SHARED_KEY\n"); - priv->secinfo.auth_mode |= IW_AUTH_ALG_SHARED_KEY; - } - if(dwrq->value & IW_AUTH_ALG_OPEN_SYSTEM) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "80211_AUTH_ALG, OPEN\n"); - priv->secinfo.auth_mode |= IW_AUTH_ALG_OPEN_SYSTEM; - } - } - else if(dwrq->value & IW_AUTH_ALG_LEAP) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "80211_AUTH_ALG, LEAP\n"); - priv->secinfo.auth_mode = IW_AUTH_ALG_LEAP; - } - else if(dwrq->value & IW_AUTH_ALG_WAPI) { - priv->secinfo.auth_mode = IW_AUTH_ALG_WAPI; - } - else{ - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "80211_AUTH_ALG, unknown\n"); - ret = -EINVAL; - } - updated = 1; - break; - - case IW_AUTH_WPA_ENABLED: - if (dwrq->value) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "WPA_ENABLED, value = 0x%x\n", dwrq->value); - if (!priv->secinfo.WPAenabled && - !priv->secinfo.WPA2enabled) { - priv->secinfo.WPAenabled = 1; - priv->secinfo.WPA2enabled = 1; - priv->secinfo.wep_enabled = 0; - priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; - } - } else { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "WPA_ENABLED, value = ZERO\n"); - priv->secinfo.WPAenabled = 0; - priv->secinfo.WPA2enabled = 0; - disable_wpa (priv); - } - updated = 1; - break; - - default: - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "NOT SUPPORT\n"); - ret = -EOPNOTSUPP; - break; - } - - if (ret == 0) { - if (updated) { - set_bit(ASSOC_FLAG_SECINFO, &priv->assoc_flags); - } - } - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return ret; -} - -static int rda5890_get_auth(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *dwrq, - char *extra) -{ - struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - - switch (dwrq->flags & IW_AUTH_INDEX) { - case IW_AUTH_KEY_MGMT: - dwrq->value = priv->secinfo.key_mgmt; - break; - - case IW_AUTH_WPA_VERSION: - dwrq->value = 0; - if (priv->secinfo.WPAenabled) - dwrq->value |= IW_AUTH_WPA_VERSION_WPA; - if (priv->secinfo.WPA2enabled) - dwrq->value |= IW_AUTH_WPA_VERSION_WPA2; - if (!dwrq->value) - dwrq->value |= IW_AUTH_WPA_VERSION_DISABLED; - break; - - case IW_AUTH_80211_AUTH_ALG: - dwrq->value = priv->secinfo.auth_mode; - break; - - case IW_AUTH_WPA_ENABLED: - if (priv->secinfo.WPAenabled && priv->secinfo.WPA2enabled) - dwrq->value = 1; - break; - - default: - ret = -EOPNOTSUPP; - } - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - return ret; -} - -static int rda5890_set_txpow(struct net_device *dev, struct iw_request_info *info, - struct iw_param *vwrq, char *extra) -{ - //struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - return 0; -} - -static int rda5890_get_essid(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - - - memcpy(extra, priv->curbssparams.ssid, - strlen(priv->curbssparams.ssid)); - dwrq->length = strlen(priv->curbssparams.ssid); - extra[dwrq->length] = '\0'; - - /* - * If none, we may want to get the one that was set - */ - - dwrq->flags = 1; /* active */ - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>> \n", __func__); - return 0; -} - -void rda5890_indicate_disconnected(struct rda5890_private *priv) -{ - union iwreq_data wrqu; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_NORM, "%s <<<\n", __func__); - - memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); - - /*report disconnect to upper layer*/ - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_NORM, "%s >>>\n", __func__); -} - -void rda5890_indicate_connected(struct rda5890_private *priv) -{ - union iwreq_data wrqu; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_NORM, "%s <<<\n", __func__); - - memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_NORM, "%s >>>\n", __func__); -} - -void rda5890_assoc_done_worker(struct work_struct *work) -{ - u8 bssid[6], zero_bssid[6]; - struct rda5890_private *priv = container_of(work, struct rda5890_private, - assoc_done_work.work); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<< \n", __func__); - - memset(bssid, 0, sizeof(bssid)); - memset(zero_bssid, 0, sizeof(zero_bssid)); - rda5890_get_bssid(priv, bssid); - - if(memcmp(bssid, zero_bssid, sizeof(zero_bssid))) - { - memcpy(priv->curbssparams.bssid, bssid, sizeof(bssid)); - } - - rda5890_get_rssi(priv, &priv->curbssparams.rssi); - priv->curbssparams.rssi = priv->curbssparams.rssi > 127? - priv->curbssparams.rssi - 271: priv->curbssparams.rssi - 15; - - rda5990_assoc_power_save(priv); - clear_bit(ASSOC_FLAG_ASSOC_START, &priv->assoc_flags); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); -} - -void rda5890_wlan_connect_worker(struct work_struct *work) -{ - struct rda5890_private *priv = container_of(work, struct rda5890_private, - wlan_connect_work.work); - - rda5890_set_txrate(priv, 0); - - if(priv) - clear_bit(ASSOC_FLAG_WLAN_CONNECTING ,&priv->assoc_flags); -} - -//imode -/* BIT0: 1 -> Security ON 0 -> OFF */ -/* BIT1: 1 -> WEP40 cypher supported 0 -> Not supported */ -/* BIT2: 1 -> WEP104 cypher supported 0 -> Not supported */ -/* BIT3: 1 -> WPA mode supported 0 -> Not supported */ -/* BIT4: 1 -> WPA2 (RSN) supported 0 -> Not supported */ -/* BIT5: 1 -> AES-CCMP cphr supported 0 -> Not supported */ -/* BIT6: 1 -> TKIP cypher supported 0 -> Not supported */ -/* BIT7: 1 -> TSN supported 0 -> Not supported */ - -//authtype -/* BIT0: 1 -> OPEN SYSTEM */ -/* BIT1: 1 -> SHARED KEY */ -/* BIT3: 1 -> WPA RSN 802.1x*/ -/* BIT7: 1 -> WAPI */ -static int assoc_helper_secinfo(struct rda5890_private *priv, - struct bss_descriptor *assoc_bss) -{ - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - - /* set imode and key */ - if ( !priv->secinfo.wep_enabled - && !priv->secinfo.WPAenabled - && !priv->secinfo.WPA2enabled) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "%s, NO SEC\n", __func__); - priv->imode = 0; - } else { - u16 key_len = 0; - u16 i; - if ( priv->secinfo.wep_enabled - && !priv->secinfo.WPAenabled - && !priv->secinfo.WPA2enabled) { - /* WEP */ - key_len = priv->wep_keys[0].len; - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "%s, WEP, len = %d\n", __func__, key_len * 8); - if (key_len == KEY_LEN_WEP_40) { - priv->imode = BIT0 | BIT1; - } - else if (key_len == KEY_LEN_WEP_104) { - priv->imode = BIT0 | BIT2; - } - else { - RDA5890_ERRP("Invalide WEP Key length %d\n", key_len); - ret = -EINVAL; - goto out; - } - } else if ( !priv->secinfo.wep_enabled - && (priv->secinfo.WPAenabled || - priv->secinfo.WPA2enabled)) { - /* WPA */ - struct enc_key * pkey = NULL; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "%s, WPA cp:%x \n", __func__, priv->secinfo.cipther_type); - - if ( priv->wpa_mcast_key.len - && (priv->wpa_mcast_key.flags & KEY_INFO_WPA_ENABLED)) - pkey = &priv->wpa_mcast_key; - else if ( priv->wpa_unicast_key.len - && (priv->wpa_unicast_key.flags & KEY_INFO_WPA_ENABLED)) - pkey = &priv->wpa_unicast_key; - - //priv->imode = assoc_bss->data.dot11i_info; - priv->imode = 0; - /* turn on security */ - priv->imode |= (BIT0); - priv->imode &= ~(BIT3 | BIT4); - if (priv->secinfo.WPA2enabled) - priv->imode |= (BIT4); - else if (priv->secinfo.WPAenabled) - priv->imode |= (BIT3); - /* - * we don't know the cipher type by now - * use dot11i_info to decide - * and use CCMP if possible - */ - priv->imode &= ~(BIT5 | BIT6); -#ifdef GET_SCAN_FROM_NETWORK_INFO - if (priv->secinfo.cipther_type & IW_AUTH_CIPHER_CCMP) - priv->imode |= BIT5; - else if (priv->secinfo.cipther_type & IW_AUTH_CIPHER_TKIP) - priv->imode |= BIT6; -#else - if (assoc_bss->data.dot11i_info & (BIT5)) - priv->imode |= BIT5; - else if (assoc_bss->data.dot11i_info & (BIT6)) - priv->imode |= BIT6; -#endif - } else { - RDA5890_ERRP("WEP and WPA/WPA2 enabled simutanously\n"); - ret = -EINVAL; - goto out; - } - } - - /* set authtype */ - if (priv->secinfo.auth_mode & IW_AUTH_ALG_OPEN_SYSTEM - || priv->secinfo.auth_mode & IW_AUTH_ALG_SHARED_KEY) - { - - if (priv->secinfo.auth_mode & IW_AUTH_ALG_OPEN_SYSTEM) - { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "%s, Open Auth, KEY_MGMT = %d, AUTH_ALG mode:%x\n", __func__, priv->secinfo.key_mgmt, priv->secinfo.auth_mode); - if (priv->secinfo.key_mgmt == 0x01) { - /* for 802.1x, set auth type to 0x04 */ - priv->authtype = BIT3; - } - else - { - priv->authtype = BIT0; - } - } - else if(priv->secinfo.auth_mode & IW_AUTH_ALG_SHARED_KEY) - { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "%s, Shared-Key Auth AUTH_ALG mode:%x \n", __func__, priv->secinfo.auth_mode); - priv->authtype = BIT1; - } - } - else if (priv->secinfo.auth_mode == IW_AUTH_ALG_WAPI) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "%s, Shared-Key Auth\n", __func__); - priv->authtype = IW_AUTH_ALG_WAPI; - } - else if (priv->secinfo.auth_mode == IW_AUTH_ALG_LEAP) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "%s, LEAP Auth, not supported\n", __func__); - ret = -EINVAL; - goto out; - } - else { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "%s, Unknown Auth\n", __func__); - ret = -EINVAL; - goto out; - } - -out: - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>> \n", __func__); - return ret; -} - -static struct bss_descriptor *get_bss_desc_from_scanlist( - struct rda5890_private *priv, unsigned char *ssid) -{ - struct bss_descriptor *iter_bss; - struct bss_descriptor *ret_bss = NULL; - /* report all bss to upper layer */ - list_for_each_entry (iter_bss, &priv->network_list, list) { -#ifdef GET_SCAN_FROM_NETWORK_INFO - if (strcmp(iter_bss->ssid, ssid) == 0) { -#else - if (strcmp(iter_bss->data.ssid, ssid) == 0) { -#endif - ret_bss = iter_bss; - break; - } - } - return ret_bss; -} - -void rda5890_assoc_worker(struct work_struct *work) -{ - static char old_imode = 0xff, old_bssid[6], assoc_count = 0; - struct rda5890_private *priv = container_of(work, struct rda5890_private, - assoc_work.work); - int ret = 0; - struct bss_descriptor *assoc_bss; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - assoc_bss = get_bss_desc_from_scanlist(priv, priv->assoc_ssid); - if (assoc_bss == NULL) { - RDA5890_ERRP("****fail to find bss in the scan list\n"); - ret = -EINVAL; - goto out; - } - -#ifdef GET_SCAN_FROM_NETWORK_INFO - if(assoc_bss->rssi > 200) - { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "assoc_bss rssi =%d > 200\n", assoc_bss->rssi); - rda5890_rssi_up_to_200(priv); - } -#else - if(assoc_bss->data.rssi > 200) - { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "assoc_bss rssi =%d > 200\n", assoc_bss->data.rssi); - rda5890_rssi_up_to_200(priv); - } -#endif -#ifdef GET_SCAN_FROM_NETWORK_INFO - priv->curbssparams.channel = assoc_bss->channel; - memcpy(priv->curbssparams.bssid, assoc_bss->bssid, ETH_ALEN); - memcpy(priv->curbssparams.ssid, assoc_bss->ssid,IW_ESSID_MAX_SIZE + 1); -#else - priv->curbssparams.channel = assoc_bss->data.channel; - memcpy(priv->curbssparams.bssid, assoc_bss->data.bssid, ETH_ALEN); - memcpy(priv->curbssparams.ssid, assoc_bss->data.ssid,IW_ESSID_MAX_SIZE + 1); -#endif - ret = assoc_helper_secinfo(priv, assoc_bss); - if (ret) { - RDA5890_ERRP("assoc_helper_secinfo fail, ret = %d\n", ret); - goto out; - } - - //if the bssid is same and the association is start then break out - if((old_imode == priv->imode) && !memcmp(old_bssid, priv->assoc_bssid,6)) - { - //WEP THE Second retry should change to shared key - if((old_imode == 3 || old_imode == 5) && assoc_count%2) - { - priv->authtype = BIT1; - } - assoc_count ++; - } - else - { - //save old bssid para - old_imode = priv->imode; - memcpy(old_bssid, priv->assoc_bssid, 6); - assoc_count = 0; - } - - set_bit(ASSOC_FLAG_ASSOC_START ,&priv->assoc_flags); - set_bit(ASSOC_FLAG_ASSOC_RETRY, &priv->assoc_flags); - - if((priv->imode == 3) || (priv->imode ==5)) - { - if(assoc_count > 5) - { - clear_bit(ASSOC_FLAG_ASSOC_RETRY, &priv->assoc_flags); - clear_bit(ASSOC_FLAG_ASSOC_START ,&priv->assoc_flags); - old_imode = 0xff; - } - } - else - { - if(assoc_count) - { - clear_bit(ASSOC_FLAG_ASSOC_RETRY, &priv->assoc_flags); - clear_bit(ASSOC_FLAG_ASSOC_START ,&priv->assoc_flags); - old_imode = 0xff; - } - } - - ret = rda5890_start_join(priv); - if (ret) { - RDA5890_ERRP("rda5890_set_ssid fail, ret = %d\n", ret); - goto out; - } - - if(test_bit(ASSOC_FLAG_ASSOC_RETRY, &priv->assoc_flags)) - { - queue_delayed_work(priv->work_thread, &priv->assoc_work, 3*HZ); - } - -out: - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<< \n", __func__); -} - -static int rda5890_set_essid(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ - struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - int ret = 0; - u8 ssid[IW_ESSID_MAX_SIZE + 1]; - u8 ssid_len = 0; - int in_ssid_len = dwrq->length; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - /* Check the size of the string */ - if (in_ssid_len > IW_ESSID_MAX_SIZE) { - ret = -E2BIG; - goto out; - } - - memset(&ssid, 0, sizeof(ssid)); - - if (!dwrq->flags || !in_ssid_len) { - /* "any" SSID requested; leave SSID blank */ - } else { - /* Specific SSID requested */ - memcpy(&ssid, extra, in_ssid_len); - ssid[in_ssid_len] = '\0'; - ssid_len = in_ssid_len; - } - - if (!ssid_len) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "requested any SSID\n"); - } else { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "requested SSID len = %d ssid:%s\n", - ssid_len, ssid); - } - - if(ssid_len) - { - memcpy(&priv->assoc_ssid[0], ssid, sizeof(ssid)); - priv->assoc_ssid_len = ssid_len; - } - - if(!test_bit(ASSOC_FLAG_SSID, &priv->assoc_flags)) - goto out; - - if(!test_bit(ASSOC_FLAG_ASSOC_RETRY, &priv->assoc_flags)) - { - if(ssid_len) - { - cancel_delayed_work(&priv->assoc_work); - queue_delayed_work(priv->work_thread, &priv->assoc_work, HZ/2); - } - } - -out: - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -/** - * @brief Connect to the AP or Ad-hoc Network with specific bssid - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param awrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * @return 0 --success, otherwise fail - */ -static int rda5890_set_wap(struct net_device *dev, struct iw_request_info *info, - struct sockaddr *awrq, char *extra) -{ - unsigned char * ap_addr = NULL; - struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - ap_addr = awrq->sa_data; - if(!test_bit(ASSOC_FLAG_ASSOC_RETRY, &priv->assoc_flags) - && !is_zero_eth_addr(ap_addr)) - { - cancel_delayed_work(&priv->assoc_work); - queue_delayed_work(priv->work_thread, &priv->assoc_work, HZ/2); - set_bit(ASSOC_FLAG_SSID, &priv->assoc_flags); - memcpy(priv->assoc_bssid, ap_addr, 6); - printk("rda5890_set_wap addr is not null \n"); - } - - if(is_zero_eth_addr(ap_addr)) - { - clear_bit(ASSOC_FLAG_SSID, &priv->assoc_flags); - disable_wep( priv); - disable_wpa(priv); - } - - - RDA5890_ERRP("%s <<< \n connect mac: %2x:%2x:%2x:%2x:%2x:%2x \n", __func__, - ap_addr[0],ap_addr[1],ap_addr[2],ap_addr[3],ap_addr[4],ap_addr[5]); - - return 0; -} - -static inline char *translate_scan(struct rda5890_private *priv, - struct iw_request_info *info, - char *start, char *stop, - struct bss_descriptor *bss_desc) -{ -#ifndef GET_SCAN_FROM_NETWORK_INFO - struct iw_event iwe; /* Temporary buffer */ - u8 snr; - struct rda5890_bss_descriptor *bss = &bss_desc->data; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "translate_scan, ssid = %s\n", bss->ssid); - - /* First entry *MUST* be the BSSID */ - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, &bss->bssid, ETH_ALEN); - start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_ADDR_LEN); - - /* SSID */ - iwe.cmd = SIOCGIWESSID; - iwe.u.data.flags = 1; - iwe.u.data.length = strlen(bss->ssid); - start = iwe_stream_add_point(info, start, stop, &iwe, bss->ssid); - - /* Mode */ - iwe.cmd = SIOCGIWMODE; - //iwe.u.mode = bss->mode; - iwe.u.mode = IW_MODE_INFRA; - start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_UINT_LEN); - - /* Frequency */ - iwe.cmd = SIOCGIWFREQ; - iwe.u.freq.m = (2412 + 5 * (bss->channel - 1)) * 100000; - iwe.u.freq.e = 1; - start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_FREQ_LEN); - - /* Add quality statistics */ - iwe.cmd = IWEVQUAL; - iwe.u.qual.updated = IW_QUAL_ALL_UPDATED; - iwe.u.qual.level = bss->rssi > 127? bss->rssi - 271: bss->rssi - 15; - - snr = iwe.u.qual.level - RDA5890_NF_DEFAULT_SCAN_VALUE; - iwe.u.qual.qual = - (100 * RSSI_DIFF * RSSI_DIFF - (PERFECT_RSSI - snr) * - (15 * (RSSI_DIFF) + 62 * (PERFECT_RSSI - snr))) / - (RSSI_DIFF * RSSI_DIFF); - if (iwe.u.qual.qual > 100) - iwe.u.qual.qual = 100; - iwe.u.qual.noise = RDA5890_NF_DEFAULT_SCAN_VALUE; - start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN); - - /* Add encryption capability */ - iwe.cmd = SIOCGIWENCODE; - if (bss->dot11i_info & BIT0) { - iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - } else { - iwe.u.data.flags = IW_ENCODE_DISABLED; - } - iwe.u.data.length = 0; - start = iwe_stream_add_point(info, start, stop, &iwe, bss->ssid); - -#if 0 - current_val = start + iwe_stream_lcp_len(info); - - iwe.cmd = SIOCGIWRATE; - iwe.u.bitrate.fixed = 0; - iwe.u.bitrate.disabled = 0; - iwe.u.bitrate.value = 0; - - for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) { - /* Bit rate given in 500 kb/s units */ - iwe.u.bitrate.value = bss->rates[j] * 500000; - current_val = iwe_stream_add_value(info, start, current_val, - stop, &iwe, IW_EV_PARAM_LEN); - } - if ((bss->mode == IW_MODE_ADHOC) && priv->adhoccreate - && !lbs_ssid_cmp(priv->curbssparams.ssid, - priv->curbssparams.ssid_len, - bss->ssid, bss->ssid_len)) { - iwe.u.bitrate.value = 22 * 500000; - current_val = iwe_stream_add_value(info, start, current_val, - stop, &iwe, IW_EV_PARAM_LEN); - } - /* Check if we added any event */ - if ((current_val - start) > iwe_stream_lcp_len(info)) - start = current_val; -#endif - - memset(&iwe, 0, sizeof(iwe)); - if (bss_desc->wpa_ie_len) { - char buf[MAX_WPA_IE_LEN]; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "translate_scan, wpa_ie, len %d\n", bss_desc->wpa_ie_len); - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "%02x %02x %02x %02x ... ... %02x %02x %02x %02x\n", - bss_desc->wpa_ie[0], bss_desc->wpa_ie[1], - bss_desc->wpa_ie[2], bss_desc->wpa_ie[3], - bss_desc->wpa_ie[bss_desc->wpa_ie_len - 4], - bss_desc->wpa_ie[bss_desc->wpa_ie_len - 3], - bss_desc->wpa_ie[bss_desc->wpa_ie_len - 2], - bss_desc->wpa_ie[bss_desc->wpa_ie_len - 1]); - - memcpy(buf, bss_desc->wpa_ie, bss_desc->wpa_ie_len); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = bss_desc->wpa_ie_len; - start = iwe_stream_add_point(info, start, stop, &iwe, buf); - } - - memset(&iwe, 0, sizeof(iwe)); - if (bss_desc->rsn_ie_len) { - char buf[MAX_WPA_IE_LEN]; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "translate_scan, rsn_ie, len %d\n", bss_desc->rsn_ie_len); - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "%02x %02x %02x %02x ... ... %02x %02x %02x %02x\n", - bss_desc->rsn_ie[0], bss_desc->rsn_ie[1], - bss_desc->rsn_ie[2], bss_desc->rsn_ie[3], - bss_desc->rsn_ie[bss_desc->rsn_ie_len - 4], - bss_desc->rsn_ie[bss_desc->rsn_ie_len - 3], - bss_desc->rsn_ie[bss_desc->rsn_ie_len - 2], - bss_desc->rsn_ie[bss_desc->rsn_ie_len - 1]); - - memcpy(buf, bss_desc->rsn_ie, bss_desc->rsn_ie_len); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = bss_desc->rsn_ie_len; - start = iwe_stream_add_point(info, start, stop, &iwe, buf); - } - - return start; -#else - struct iw_event iwe; /* Temporary buffer */ - u8 snr; - struct bss_descriptor *bss = bss_desc; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "translate_scan, ssid = %s ssi=%d ssid_len=%d \n", bss->ssid, bss->rssi, bss->ssid_len); - - /* First entry *MUST* be the BSSID */ - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN); - start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_ADDR_LEN); - - /* SSID */ - iwe.cmd = SIOCGIWESSID; - iwe.u.data.flags = 1; - iwe.u.data.length = bss->ssid_len; - start = iwe_stream_add_point(info, start, stop, &iwe, bss->ssid); - - /* Mode */ - iwe.cmd = SIOCGIWMODE; - iwe.u.mode = bss->mode; - start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_UINT_LEN); - - /* Frequency */ - iwe.cmd = SIOCGIWFREQ; - iwe.u.freq.m = (2412 + 5 * (bss->channel - 1)) * 100000; - iwe.u.freq.e = 1; - start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_FREQ_LEN); - - /* Add quality statistics */ - iwe.cmd = IWEVQUAL; - iwe.u.qual.updated = IW_QUAL_ALL_UPDATED; - iwe.u.qual.level = bss->rssi > 127? bss->rssi - 271: bss->rssi - 15; - - snr = iwe.u.qual.level - RDA5890_NF_DEFAULT_SCAN_VALUE; - iwe.u.qual.qual = - (100 * RSSI_DIFF * RSSI_DIFF - (PERFECT_RSSI - snr) * - (15 * (RSSI_DIFF) + 62 * (PERFECT_RSSI - snr))) / - (RSSI_DIFF * RSSI_DIFF); - if (iwe.u.qual.qual > 100) - iwe.u.qual.qual = 100; - iwe.u.qual.noise = RDA5890_NF_DEFAULT_SCAN_VALUE; - start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN); - - /* Add encryption capability */ - iwe.cmd = SIOCGIWENCODE; - if (bss->capability & WLAN_CAPABILITY_PRIVACY) { - iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - } else { - iwe.u.data.flags = IW_ENCODE_DISABLED; - } - iwe.u.data.length = 0; - start = iwe_stream_add_point(info, start, stop, &iwe, bss->ssid); - - memset(&iwe, 0, sizeof(iwe)); - if (bss_desc->wpa_ie_len && !bss_desc->wapi_ie_len) { - char buf[MAX_WPA_IE_LEN]; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "translate_scan, wpa_ie, len %d\n", bss_desc->wpa_ie_len); - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "%02x %02x %02x %02x ... ... %02x %02x %02x %02x\n", - bss_desc->wpa_ie[0], bss_desc->wpa_ie[1], - bss_desc->wpa_ie[2], bss_desc->wpa_ie[3], - bss_desc->wpa_ie[bss_desc->wpa_ie_len - 4], - bss_desc->wpa_ie[bss_desc->wpa_ie_len - 3], - bss_desc->wpa_ie[bss_desc->wpa_ie_len - 2], - bss_desc->wpa_ie[bss_desc->wpa_ie_len - 1]); - - memcpy(buf, bss->wpa_ie, bss->wpa_ie_len); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = bss_desc->wpa_ie_len; - start = iwe_stream_add_point(info, start, stop, &iwe, buf); - } - - memset(&iwe, 0, sizeof(iwe)); - if (bss_desc->rsn_ie_len && !bss_desc->wapi_ie_len) { - char buf[MAX_WPA_IE_LEN]; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "translate_scan, rsn_ie, len %d\n", bss_desc->rsn_ie_len); - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "%02x %02x %02x %02x ... ... %02x %02x %02x %02x\n", - bss_desc->rsn_ie[0], bss_desc->rsn_ie[1], - bss_desc->rsn_ie[2], bss_desc->rsn_ie[3], - bss_desc->rsn_ie[bss_desc->rsn_ie_len - 4], - bss_desc->rsn_ie[bss_desc->rsn_ie_len - 3], - bss_desc->rsn_ie[bss_desc->rsn_ie_len - 2], - bss_desc->rsn_ie[bss_desc->rsn_ie_len - 1]); - - memcpy(buf, bss->rsn_ie, bss->rsn_ie_len); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = bss_desc->rsn_ie_len; - start = iwe_stream_add_point(info, start, stop, &iwe, buf); - } - - memset(&iwe, 0, sizeof(iwe)); - if (bss_desc->wapi_ie_len) { - char buf[100]; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "translate_scan, wapi_len %d\n", bss_desc->wapi_ie_len); - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "%02x %02x %02x %02x ... ... %02x %02x %02x %02x\n", - bss_desc->wapi_ie[0], bss_desc->wapi_ie[1], - bss_desc->wapi_ie[2], bss_desc->wapi_ie[3], - bss_desc->wapi_ie[bss_desc->wapi_ie_len - 4], - bss_desc->wapi_ie[bss_desc->wapi_ie_len - 3], - bss_desc->wapi_ie[bss_desc->wapi_ie_len - 2], - bss_desc->wapi_ie[bss_desc->wapi_ie_len - 1]); - - memcpy(buf, bss->wapi_ie, bss->wapi_ie_len); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = bss_desc->wapi_ie_len; - start = iwe_stream_add_point(info, start, stop, &iwe, buf); - } - - return start; -#endif -} - -int is_same_network(struct bss_descriptor *src, - struct bss_descriptor *dst) -{ - /* A network is only a duplicate if the channel, BSSID, and ESSID - * all match. We treat all with the same BSSID and channel - * as one network */ -#ifndef GET_SCAN_FROM_NETWORK_INFO - return ((src->data.channel == dst->data.channel) && - !compare_ether_addr(src->data.bssid, dst->data.bssid) && - !memcmp(src->data.ssid, dst->data.ssid, IW_ESSID_MAX_SIZE)); -#else - return ((src->channel == dst->channel) && - !compare_ether_addr(src->bssid, dst->bssid) && - !memcmp(src->ssid, dst->ssid, IW_ESSID_MAX_SIZE)); -#endif -} - -void clear_bss_descriptor(struct bss_descriptor *bss) -{ - /* Don't blow away ->list, just BSS data */ - memset(bss, 0, offsetof(struct bss_descriptor, list)); -} - -static void dump_bss_desc(struct rda5890_bss_descriptor *bss_desc) -{ - RDA5890_DBGP("########## dump bss ##########\n"); - RDA5890_DBGP("ssid = %s\n", bss_desc->ssid); - RDA5890_DBGP("bss_type = %d\n", bss_desc->bss_type); - RDA5890_DBGP("channel = %d\n", bss_desc->channel); - RDA5890_DBGP("dot11i_info = 0x%02x\n", bss_desc->dot11i_info); - RDA5890_DBGP("bssid = %02x:%02x:%02x:%02x:%02x:%02x\n", - bss_desc->bssid[0], bss_desc->bssid[1], bss_desc->bssid[2], - bss_desc->bssid[3], bss_desc->bssid[4], bss_desc->bssid[5]); - RDA5890_DBGP("rssi = %d\n", (char)bss_desc->rssi); - RDA5890_DBGP("auth_info = 0x%02x\n", bss_desc->auth_info); - RDA5890_DBGP("rsn_cap = 0x%04x\n", - (bss_desc->rsn_cap[1] << 8) | bss_desc->rsn_cap[0]); - RDA5890_DBGP("########## dump bss ##########\n"); -} - -/* Element Ids used in Management frames in 802.11i mode */ -typedef enum{ IRSNELEMENT = 48, /* RSN Information Element */ - IWPAELEMENT = 221 /* WPA Information Element */ -}ELEMENTID_11I_T; - -/* CIPHER set for RSN or WPA element */ -typedef enum { CIPHER_TYPE_USE_GROUP_SET = 0, - CIPHER_TYPE_WEP40 = 1, - CIPHER_TYPE_TKIP = 2, - CIPHER_TYPE_CCMP = 4, - CIPHER_TYPE_WEP104 = 5 -} CIPHER_TYPE_T; - -unsigned char oui_rsn[3] = {0x00, 0x0F, 0xAC}; -unsigned char oui_wpa[3] = {0x00, 0x50, 0xf2}; - -static void fill_rsn_wpa_ie(unsigned char *data, unsigned char ie_type, - struct rda5890_bss_descriptor *bss, size_t *len) -{ - unsigned char index = 0; - unsigned char *oui; - - if (ie_type == IRSNELEMENT) { - oui = &oui_rsn[0]; - - /* Set RSN Information Element element ID */ - data[index] = IRSNELEMENT; - index += 2; - } - else { - oui = &oui_wpa[0]; - - /* Set WPA Information Element element ID */ - data[index] = IWPAELEMENT; - index += 2; - - /* Copy OUI */ - memcpy(&data[index], oui, 3); - index += 3; - data[index++] = 0x01; - } - - /* Set the version of RSN Element to 1 */ - data[index++] = 1; - data[index++] = 0; - - /* Set Group Cipher Suite */ - memcpy(&data[index], oui, 3); - index += 3; - if ((bss->dot11i_info & BIT5) && !(bss->dot11i_info & BIT6)) { - /* only CCMP and !TKIP, use CCMP, otherwise, always TKIP */ - data[index++] = CIPHER_TYPE_CCMP; - } - else { - data[index++] = CIPHER_TYPE_TKIP; - } - - /* Set Pairwise cipher Suite */ - if ((bss->dot11i_info & BIT5) && (bss->dot11i_info & BIT6)) { - /* both CCMP and TKIP */ - data[index++] = 2; - data[index++] = 0; - - /* Check BIT7 to determine who goes first */ - if (bss->dot11i_info & BIT7) { - /* BIT7 is 1 => CCMP goes first */ - memcpy(&data[index], oui, 3); - index += 3; - data[index++] = CIPHER_TYPE_CCMP; - - memcpy(&data[index], oui, 3); - index += 3; - data[index++] = CIPHER_TYPE_TKIP; - } - else { - /* BIT7 is 0 => TKIP goes first */ - memcpy(&data[index], oui, 3); - index += 3; - data[index++] = CIPHER_TYPE_TKIP; - - memcpy(&data[index], oui, 3); - index += 3; - data[index++] = CIPHER_TYPE_CCMP; - } - } - else if ((bss->dot11i_info & BIT5) && !(bss->dot11i_info & BIT6)) { - /* CCMP and !TKIP */ - data[index++] = 1; - data[index++] = 0; - - memcpy(&data[index], oui, 3); - index += 3; - data[index++] = CIPHER_TYPE_CCMP; - } - else if (!(bss->dot11i_info & BIT5) && (bss->dot11i_info & BIT6)) { - /* !CCMP and TKIP */ - data[index++] = 1; - data[index++] = 0; - - memcpy(&data[index], oui, 3); - index += 3; - data[index++] = CIPHER_TYPE_TKIP; - } - else { - /* neither CCMP nor TKIP, use TKIP for WPA, and CCMP for RSN */ - data[index++] = 1; - data[index++] = 0; - - memcpy(&data[index], oui, 3); - index += 3; - if (ie_type == IRSNELEMENT) { - data[index++] = CIPHER_TYPE_CCMP; - } - else { - data[index++] = CIPHER_TYPE_TKIP; - } - } - - /* Set Authentication Suite */ - if ((bss->auth_info & 0x01) && (bss->auth_info & 0x02)) { - /* both 802.1X and PSK */ - data[index++] = 2; - data[index++] = 0; - - memcpy(&data[index], oui, 3); - index += 3; - data[index++] = 0x01; - - memcpy(&data[index], oui, 3); - index += 3; - data[index++] = 0x02; - } - else if ((bss->auth_info & 0x01) && !(bss->auth_info & 0x02)) { - /* 802.1X and !PSK */ - data[index++] = 1; - data[index++] = 0; - - memcpy(&data[index], oui, 3); - index += 3; - data[index++] = 0x01; - } - else if (!(bss->auth_info & 0x01) && (bss->auth_info & 0x02)) { - /* !802.1X and PSK */ - data[index++] = 1; - data[index++] = 0; - - memcpy(&data[index], oui, 3); - index += 3; - data[index++] = 0x02; - } - else { - /* neither 802.1X nor PSK, use 802.1X */ - data[index++] = 1; - data[index++] = 0; - - memcpy(&data[index], oui, 3); - index += 3; - data[index++] = 0x01; - } - - /* The RSN Capabilities, for RSN IE only */ - if (ie_type == IRSNELEMENT) { - data[index++] = bss->rsn_cap[0]; - data[index++] = bss->rsn_cap[1]; - } - - /* Set the length of the RSN Information Element */ - data[1] = (index - 2); - - /* Return the Extended Supported Rates element length */ - *len = (size_t)index; -} - -/* reconstruct wpa/rsn ie from the dot11i_info and auth_info fields */ -/* TODO: - * assuming RSN and WPA are using same cipher suite, no space to store each - * assuming grp and unicast are using same cipher suite - */ -static void reconstruct_rsn_wpa_ie(struct bss_descriptor *bss_desc) -{ - bss_desc->wpa_ie_len = 0; - bss_desc->rsn_ie_len = 0; - - if (bss_desc->data.dot11i_info & BIT0) { - if (bss_desc->data.dot11i_info & BIT3) { - /* WPA IE present */ - fill_rsn_wpa_ie(&bss_desc->wpa_ie[0], IWPAELEMENT, - &bss_desc->data, &bss_desc->wpa_ie_len); - } - - if (bss_desc->data.dot11i_info & BIT4) { - /* RSN IE present */ - fill_rsn_wpa_ie(&bss_desc->rsn_ie[0], IRSNELEMENT, - &bss_desc->data, &bss_desc->rsn_ie_len); - } - } - else { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "form_rsn_ie, NO SEC\n"); - } -} - -void rda5890_scan_worker(struct work_struct *work) -{ - struct rda5890_private *priv = container_of(work, struct rda5890_private, - scan_work.work); - int ret = 0; - struct rda5890_bss_descriptor bss_desc[RDA5890_MAX_NETWORK_NUM]; - int bss_index, bss_count; - struct bss_descriptor *iter_bss; - union iwreq_data wrqu; - unsigned char fist_send = 0; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - if(test_bit(ASSOC_FLAG_ASSOC_START, &priv->assoc_flags) - || test_bit(ASSOC_FLAG_WLAN_CONNECTING, &priv->assoc_flags)) - { - cancel_delayed_work(&priv->scan_work); - queue_delayed_work(priv->work_thread, &priv->scan_work, HZ/2); - return; - } - - priv->scan_running = 1; - -#ifdef WIFI_UNLOCK_SYSTEM - rda5990_wakeLock(); -#endif - -#ifdef GET_SCAN_FROM_NETWORK_INFO - ret = rda5890_start_scan_enable_network_info(priv); -#else - ret = rda5890_start_scan(priv); -#endif - if (ret) { - RDA5890_ERRP("rda5890_start_scan fail, ret = %d\n", ret); - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "SCANNING ...\n"); - /* TODO: delay 2 sec for now, need to be put into a worker */ - rda5890_shedule_timeout(1500); - -#ifndef GET_SCAN_FROM_NETWORK_INFO -retry: - bss_count = rda5890_get_scan_results(priv, bss_desc); - - fist_send = (bss_count >> 8) & 0xff; - bss_count &= 0xff; - if (bss_count < 0 || bss_count >= RDA5890_MAX_NETWORK_NUM) { - RDA5890_ERRP("rda5890_get_scan_results fail, ret = %d\n", bss_count); - goto out; - } - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Get Scan Result, count = %d, fist_send= %d \n", bss_count, fist_send); - - /* add scaned bss into list */ - for(bss_index = 0; bss_index < bss_count; bss_index++) { - struct bss_descriptor new; - struct bss_descriptor *found = NULL; - struct bss_descriptor *oldest = NULL; - - if (RDA5890_DBGLA(RDA5890_DA_WEXT, RDA5890_DL_TRACE)) - dump_bss_desc(&bss_desc[bss_index]); - - memcpy(&new.data, &bss_desc[bss_index], sizeof(struct rda5890_bss_descriptor)); - reconstruct_rsn_wpa_ie(&new); - new.last_scanned = jiffies; - - /* Try to find this bss in the scan table */ - list_for_each_entry (iter_bss, &priv->network_list, list) { - if (is_same_network(iter_bss, &new)) { - found = iter_bss; - break; - } - - if ((oldest == NULL) || - (iter_bss->last_scanned < oldest->last_scanned)) - oldest = iter_bss; - } - - if (found) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "FOUND SAME %s, update\n", found->data.ssid); - /* found, clear it */ - clear_bss_descriptor(found); - } else if (!list_empty(&priv->network_free_list)) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "FOUND NEW %s, add\n", new.data.ssid); - /* Pull one from the free list */ - found = list_entry(priv->network_free_list.next, - struct bss_descriptor, list); - list_move_tail(&found->list, &priv->network_list); - } else if (oldest) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "FOUND NEW %s, no space, replace oldest %s\n", - new.data.ssid, oldest->data.ssid); - /* If there are no more slots, expire the oldest */ - found = oldest; - clear_bss_descriptor(found); - list_move_tail(&found->list, &priv->network_list); - } else { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "FOUND NEW but no space to store\n"); - } - - /* Copy the locally created newbssentry to the scan table */ - memcpy(found, &new, offsetof(struct bss_descriptor, list)); - } - - if(bss_count >= 5 && !fist_send) - goto retry; - -#else - //do noting in get network info modle - -#endif - -out: - priv->scan_running = 0; - memset(&wrqu, 0, sizeof(union iwreq_data)); - wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - -#ifdef WIFI_UNLOCK_SYSTEM - rda5990_wakeUnlock(); -#endif -} - -/** - * @brief Handle Scan Network ioctl - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param vwrq A pointer to iw_param structure - * @param extra A pointer to extra data buf - * - * @return 0 --success, otherwise fail - */ -int rda5890_set_scan(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - if (priv->scan_running) - goto out; - - - cancel_delayed_work(&priv->scan_work); - queue_delayed_work(priv->work_thread, &priv->scan_work, HZ/50); - -out: - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return 0; -} - -/** - * @brief Handle Retrieve scan table ioctl - * - * @param dev A pointer to net_device structure - * @param info A pointer to iw_request_info structure - * @param dwrq A pointer to iw_point structure - * @param extra A pointer to extra data buf - * - * @return 0 --success, otherwise fail - */ -int rda5890_get_scan(struct net_device *dev, struct iw_request_info *info, - struct iw_point *dwrq, char *extra) -{ -#define SCAN_ITEM_SIZE 128 - struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - int ret = 0; - struct bss_descriptor *iter_bss; - struct bss_descriptor *safe; - char *ev = extra; - char *stop = ev + dwrq->length; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - /* iwlist should wait until the current scan is finished */ - if (priv->scan_running) { - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "Scan is Running, return AGAIN\n"); - return -EAGAIN; - } - - /* report all bss to upper layer */ - list_for_each_entry_safe (iter_bss, safe, &priv->network_list, list) { - char *next_ev; - unsigned long stale_time; - - if (stop - ev < SCAN_ITEM_SIZE) { - ret = -E2BIG; - break; - } - - /* Prune old an old scan result */ - stale_time = iter_bss->last_scanned + DEFAULT_MAX_SCAN_AGE; - if (time_after(jiffies, stale_time)) { - list_move_tail(&iter_bss->list, &priv->network_free_list); -#ifdef GET_SCAN_FROM_NETWORK_INFO - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "Prune Old Bss %s\n", iter_bss->ssid); -#else - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "Prune Old Bss %s\n", iter_bss->ssid); -#endif - clear_bss_descriptor(iter_bss); - continue; - } - - /* Translate to WE format this entry */ - next_ev = translate_scan(priv, info, ev, stop, iter_bss); -#ifdef GET_SCAN_FROM_NETWORK_INFO - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "Report BSS %s\n", iter_bss->ssid); -#else - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "Report BSS %s\n", iter_bss->data.ssid); -#endif - if (next_ev == NULL) - continue; - ev = next_ev; - } - dwrq->length = (ev - extra); - dwrq->flags = 0; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return ret; -} - -int rda5890_set_mlme(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - //struct rda5890_private *priv = (struct rda5890_private *)netdev_priv(dev); - struct iw_mlme *mlme = (struct iw_mlme *)extra; - int ret = 0; - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s >>>\n", __func__); - - switch (mlme->cmd) { - case IW_MLME_DEAUTH: - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "DEAUTH\n"); - /* silently ignore */ - break; - - case IW_MLME_DISASSOC: - { - unsigned char ssid[6]; - memset(ssid, 0, 6); - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "DISASSOC\n"); - /* silently ignore */ - rda5890_set_ssid((struct rda5890_private *)netdev_priv(dev) , ssid, 6); - } - break; - default: - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, - "Not supported cmd %d\n", mlme->cmd); - ret = -EOPNOTSUPP; - } - - RDA5890_DBGLAP(RDA5890_DA_WEXT, RDA5890_DL_TRACE, "%s <<<\n", __func__); - return ret; -} - -/* - * iwconfig settable callbacks - */ -static const iw_handler rda5890_wext_handler[] = { - (iw_handler) NULL, /* SIOCSIWCOMMIT */ - (iw_handler) rda5890_get_name, /* SIOCGIWNAME */ - (iw_handler) NULL, /* SIOCSIWNWID */ - (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) rda5890_set_freq, /* SIOCSIWFREQ */ - (iw_handler) rda5890_get_freq, /* SIOCGIWFREQ */ - (iw_handler) rda5890_set_mode, /* SIOCSIWMODE */ - (iw_handler) rda5890_get_mode, /* SIOCGIWMODE */ - (iw_handler) NULL, /* SIOCSIWSENS */ - (iw_handler) NULL, /* SIOCGIWSENS */ - (iw_handler) NULL, /* SIOCSIWRANGE */ - (iw_handler) rda5890_get_range, /* SIOCGIWRANGE */ - (iw_handler) NULL, /* SIOCSIWPRIV */ - (iw_handler) NULL, /* SIOCGIWPRIV */ - (iw_handler) NULL, /* SIOCSIWSTATS */ - (iw_handler) NULL, /* SIOCGIWSTATS */ - (iw_handler) NULL, /* SIOCSIWSPY */ - (iw_handler) NULL, /* SIOCGIWSPY */ - (iw_handler) NULL, /* SIOCSIWTHRSPY */ - (iw_handler) NULL, /* SIOCGIWTHRSPY */ - (iw_handler) rda5890_set_wap, /* SIOCSIWAP */ - (iw_handler) rda5890_get_wap, /* SIOCGIWAP */ - (iw_handler) rda5890_set_mlme, /* SIOCSIWMLME */ - (iw_handler) NULL, /* SIOCGIWAPLIST - deprecated */ - (iw_handler) rda5890_set_scan, /* SIOCSIWSCAN */ - (iw_handler) rda5890_get_scan, /* SIOCGIWSCAN */ - (iw_handler) rda5890_set_essid, /* SIOCSIWESSID */ - (iw_handler) rda5890_get_essid, /* SIOCGIWESSID */ - (iw_handler) rda5890_set_nick, /* SIOCSIWNICKN */ - (iw_handler) rda5890_get_nick, /* SIOCGIWNICKN */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) rda5890_set_rate, /* SIOCSIWRATE */ - (iw_handler) rda5890_get_rate, /* SIOCGIWRATE */ - (iw_handler) rda5890_set_rts, /* SIOCSIWRTS */ - (iw_handler) rda5890_get_rts, /* SIOCGIWRTS */ - (iw_handler) rda5890_set_frag, /* SIOCSIWFRAG */ - (iw_handler) rda5890_get_frag, /* SIOCGIWFRAG */ - (iw_handler) rda5890_set_txpow, /* SIOCSIWTXPOW */ - (iw_handler) rda5890_get_txpow, /* SIOCGIWTXPOW */ - (iw_handler) rda5890_set_retry, /* SIOCSIWRETRY */ - (iw_handler) rda5890_get_retry, /* SIOCGIWRETRY */ - (iw_handler) rda5890_set_encode, /* SIOCSIWENCODE */ - (iw_handler) rda5890_get_encode, /* SIOCGIWENCODE */ - (iw_handler) rda5890_set_power, /* SIOCSIWPOWER */ - (iw_handler) rda5890_get_power, /* SIOCGIWPOWER */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) rda5890_set_genie, /* SIOCSIWGENIE */ - (iw_handler) rda5890_get_genie, /* SIOCGIWGENIE */ - (iw_handler) rda5890_set_auth, /* SIOCSIWAUTH */ - (iw_handler) rda5890_get_auth, /* SIOCGIWAUTH */ - (iw_handler) rda5890_set_encodeext,/* SIOCSIWENCODEEXT */ - (iw_handler) rda5890_get_encodeext,/* SIOCGIWENCODEEXT */ - (iw_handler) rda5890_set_pmksa, /* SIOCSIWPMKSA */ -}; - -struct iw_handler_def rda5890_wext_handler_def = { - .num_standard = ARRAY_SIZE(rda5890_wext_handler), - .standard = (iw_handler *) rda5890_wext_handler, - .get_wireless_stats = rda5890_get_wireless_stats, -}; - diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_wext.h b/drivers/net/wireless/rda5990/rda_wlan/rda5890_wext.h deleted file mode 100755 index 35ff2f7c8780..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_wext.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file contains definition for IOCTL call. - */ -#include "rda5890_defs.h" -#ifndef _RDA5890_WEXT_H_ -#define _RDA5890_WEXT_H_ - -#ifndef DEFAULT_MAX_SCAN_AGE -#define DEFAULT_MAX_SCAN_AGE (15*HZ) -#ifdef GET_SCAN_FROM_NETWORK_INFO -#else -#define DEFAULT_MAX_SCAN_AGE (15*HZ) -#endif -#else -#undef DEFAULT_MAX_SCAN_AGE -#ifdef GET_SCAN_FROM_NETWORK_INFO -#define DEFAULT_MAX_SCAN_AGE (15*HZ) -#else -#define DEFAULT_MAX_SCAN_AGE (15*HZ) -#endif -#endif - -extern struct iw_handler_def rda5890_wext_handler_def; - -void rda5890_indicate_disconnected(struct rda5890_private *priv); -void rda5890_indicate_connected(struct rda5890_private *priv); -void rda5890_assoc_done_worker(struct work_struct *work); -void rda5890_assoc_worker(struct work_struct *work); -void rda5890_scan_worker(struct work_struct *work); -void rda5890_wlan_connect_worker(struct work_struct *work); - -static inline unsigned char is_zero_eth_addr(unsigned char * addr) -{ - return !(addr[0] | addr[1] |addr[2] |addr[3] |addr[4] |addr[5]); -} - -#endif diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_wid.c b/drivers/net/wireless/rda5990/rda_wlan/rda5890_wid.c deleted file mode 100755 index 1a1fc1d6de83..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_wid.c +++ /dev/null @@ -1,1957 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rda5890_defs.h" -#include "rda5890_dev.h" -#include "rda5890_wid.h" -#include "rda5890_wext.h" -#include "rda5890_txrx.h" -#include "rda5890_if_sdio.h" - -static unsigned char is_need_set_notch = 0; - -/* for both Query and Write */ -int rda5890_wid_request(struct rda5890_private *priv, - char *wid_req, unsigned short wid_req_len, - char *wid_rsp, unsigned short *wid_rsp_len) -{ - int ret = 0; - int timeleft = 0; - char data_buf[RDA5890_MAX_WID_LEN + 2]; - unsigned short data_len; - struct if_sdio_card * card = (struct if_sdio_card *)priv->card; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); - -#ifdef WIFI_TEST_MODE - if(rda_5990_wifi_in_test_mode()) - return 0; -#endif //end WIFI_TEST_MODE - - mutex_lock(&priv->wid_lock); - priv->wid_rsp = wid_rsp; - priv->wid_rsp_len = *wid_rsp_len; - priv->wid_pending = 1; - - data_len = wid_req_len + 2; - data_buf[0] = (char)(data_len&0xFF); - data_buf[1] = (char)((data_len>>8)&0x0F); - data_buf[1] |= 0x40; // for Request(Q/W) 0x4 - memcpy(data_buf + 2, wid_req, wid_req_len); - - init_completion(&priv->wid_done); -#ifdef WIFI_UNLOCK_SYSTEM - rda5990_wakeLock(); -#endif - ret = rda5890_host_to_card(priv, data_buf, data_len, WID_REQUEST_PACKET); - if (ret) { - RDA5890_ERRP("host_to_card send failed, ret = %d\n", ret); - priv->wid_pending = 0; - goto out; - } - - atomic_inc(&card->wid_complete_flag); - timeleft = wait_for_completion_timeout(&priv->wid_done, msecs_to_jiffies(450)); - if (timeleft == 0) { - RDA5890_ERRP("respose timeout wid :%x %x \n", wid_req[4], wid_req[5]); - priv->wid_pending = 0; - ret = -EFAULT; - goto out; - } - - *wid_rsp_len = priv->wid_rsp_len; - -out: - mutex_unlock(&priv->wid_lock); - atomic_set(&card->wid_complete_flag, 0); - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s >>> wid: %x %x \n", __func__, wid_req[4],wid_req[5]); -#ifdef WIFI_UNLOCK_SYSTEM - rda5990_wakeUnlock(); -#endif - return ret; -} - -int rda5890_wid_request_polling(struct rda5890_private *priv, - char *wid_req, unsigned short wid_req_len, - char *wid_rsp, unsigned short *wid_rsp_len) -{ - int ret = -1; - int timeleft = 0; - char data_buf[RDA5890_MAX_WID_LEN + 2]; - unsigned short data_len; - unsigned char status; - unsigned int retry = 0, count = 0; - struct if_sdio_card * card = (struct if_sdio_card*)priv->card; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - priv->wid_rsp = wid_rsp; - priv->wid_rsp_len = *wid_rsp_len; - - data_len = wid_req_len + 2; - data_buf[0] = (char)(data_len&0xFF); - data_buf[1] = (char)((data_len>>8)&0x0F); - data_buf[1] |= 0x40; // for Request(Q/W) 0x4 - memcpy(data_buf + 2, wid_req, wid_req_len); - -re_send: - - count += 1; - ret = rda5890_host_to_card(priv, data_buf, data_len, WID_REQUEST_POLLING_PACKET); - if (ret) { - RDA5890_ERRP("host_to_card send failed, ret = %d\n", ret); - goto out; - } - - rda5890_shedule_timeout(3); //3ms delay - while(retry < 20) - { - sdio_claim_host(card->func); - status = sdio_readb(card->func, IF_SDIO_FUN1_INT_STAT, &ret); - sdio_release_host(card->func); - if (ret) - goto out; - - if (status & IF_SDIO_INT_AHB2SDIO) - { - int ret = 0; - u8 size_l = 0, size_h = 0; - u16 size, chunk; - - sdio_claim_host(card->func); - size_l = sdio_readb(card->func, IF_SDIO_AHB2SDIO_PKTLEN_L, &ret); - sdio_release_host(card->func); - if (ret) { - RDA5890_ERRP("read PKTLEN_L reg fail\n"); - goto out; - } - else - RDA5890_ERRP("read PKTLEN_L reg size_l:%d \n", size_l); - - sdio_claim_host(card->func); - size_h = sdio_readb(card->func, IF_SDIO_AHB2SDIO_PKTLEN_H, &ret); - sdio_release_host(card->func); - if (ret) { - RDA5890_ERRP("read PKTLEN_H reg fail\n"); - goto out; - } - else - RDA5890_ERRP("read PKTLEN_H reg size_h:%d\n",size_h); - - size = (size_l | ((size_h & 0x7f) << 8)) * 4; - if (size < 4) { - RDA5890_ERRP("invalid packet size (%d bytes) from firmware\n", size); - ret = -EINVAL; - goto out; - } - - /* alignment is handled on firmside */ - //chunk = sdio_align_size(card->func, size); - chunk = size; - - RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_NORM, - "if_sdio_card_to_host, size = %d, aligned size = %d\n", size, chunk); - - /* TODO: handle multiple packets here */ - sdio_claim_host(card->func); - ret = sdio_readsb(card->func, card->buffer, IF_SDIO_FUN1_FIFO_RD, chunk); - sdio_release_host(card->func); - if (ret) { - RDA5890_ERRP("sdio_readsb fail, ret = %d\n", ret); - goto out; - } -#if 1 - if(priv->version == 7) - sdio_writeb(card->func, 0x20 ,IF_SDIO_FUN1_INT_PEND, &ret); -#endif - - /* TODO: this chunk size need to be handled here */ - { - unsigned char rx_type; - unsigned short rx_length; - unsigned char msg_type; - unsigned char *packet = (unsigned char *)card->buffer; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - rx_type = (unsigned char)packet[1]&0xF0; - rx_length = (unsigned short)(packet[0] + ((packet[1]&0x0f) << 8)); - - if (rx_length > chunk) { - RDA5890_ERRP("packet_len %d less than header specified length %d\n", - chunk, rx_length); - goto out; - } - - if( rx_type == 0x30 ) - { - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_NORM, - "Message Packet type =%x \n", msg_type); - msg_type = packet[2]; - - if (msg_type == 'R') - { - packet += 2; - if(priv->wid_msg_id - 1 == packet[1]) - { - ret = 0; - if(priv->wid_rsp_len > rx_length - 2) - { - priv->wid_rsp_len = rx_length - 2; - memcpy(priv->wid_rsp, packet, rx_length -2); - } - break; - } - else - RDA5890_ERRP("rda5890_wid_request_polling wid_msg_id is wrong %d %d wid=%x \n", priv->wid_msg_id -1, packet[1], (packet[4] | (packet[5] << 8))); - } - } - } - } - - rda5890_shedule_timeout(3); //3ms delay - ret = -1; - retry ++; - } - - if(ret < 0 && count <= 3) - goto re_send; -out: - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s <<< wid: %x %x retry: %d count = %d \n", __func__, wid_req[4],wid_req[5], retry, count); - - return ret; -} -void rda5890_wid_response(struct rda5890_private *priv, - char *wid_rsp, unsigned short wid_rsp_len) -{ - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - if (!priv->wid_pending) { - RDA5890_ERRP("no wid pending\n"); - return; - } - - if (wid_rsp_len > priv->wid_rsp_len) { - RDA5890_ERRP("not enough space for wid response, size = %d, buf = %d\n", - wid_rsp_len, priv->wid_rsp_len); - complete(&priv->wid_done); - return; - } - - memcpy(priv->wid_rsp, wid_rsp, wid_rsp_len); - priv->wid_rsp_len = wid_rsp_len; - priv->wid_pending = 0; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); - - complete(&priv->wid_done); -} - -void rda5890_wid_status(struct rda5890_private *priv, - char *wid_status, unsigned short wid_status_len) -{ - char mac_status; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - -#ifdef WIFI_UNLOCK_SYSTEM - rda5990_wakeLock(); -#endif - - mac_status = wid_status[7]; - if (mac_status == MAC_CONNECTED) { - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_CRIT, - "MAC CONNECTED\n"); - - priv->connect_status = MAC_CONNECTED; - netif_carrier_on(priv->dev); - netif_wake_queue(priv->dev); - rda5890_indicate_connected(priv); - - priv->first_init = 0; - cancel_delayed_work(&priv->assoc_done_work); - queue_delayed_work(priv->work_thread, &priv->assoc_done_work, 0); - - if(test_and_clear_bit(ASSOC_FLAG_ASSOC_RETRY, &priv->assoc_flags)) - { - cancel_delayed_work_sync(&priv->assoc_work); - } - - if(test_bit(ASSOC_FLAG_WLAN_CONNECTING, &priv->assoc_flags)) - cancel_delayed_work(&priv->wlan_connect_work); - - set_bit(ASSOC_FLAG_WLAN_CONNECTING, &priv->assoc_flags); - queue_delayed_work(priv->work_thread, &priv->wlan_connect_work, HZ*20); - - } - else if (mac_status == MAC_DISCONNECTED) { - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_CRIT, - "MAC DISCONNECTED\n"); - - if(priv->connect_status == MAC_CONNECTED) - is_need_set_notch = 1; - else - is_need_set_notch = 0; - - if(!test_bit(ASSOC_FLAG_ASSOC_RETRY, &priv->assoc_flags)) - { - priv->connect_status = MAC_DISCONNECTED; - netif_stop_queue(priv->dev); - netif_carrier_off(priv->dev); - if(!priv->first_init) // the first disconnect should not send to upper - rda5890_indicate_disconnected(priv); - else - priv->first_init = 0; - - if(test_bit(ASSOC_FLAG_ASSOC_START, &priv->assoc_flags)) - { - cancel_delayed_work(&priv->wlan_connect_work); - queue_delayed_work(priv->work_thread, &priv->wlan_connect_work, HZ*4); - } - - clear_bit(ASSOC_FLAG_ASSOC_START, &priv->assoc_flags); - clear_bit(ASSOC_FLAG_WLAN_CONNECTING, &priv->assoc_flags); - } - else - { - RDA5890_ERRP("********wep assoc will be retry ---------- 0x%02x\n", mac_status); - } - } - else { - RDA5890_ERRP("Invalid MAC Status 0x%02x\n", mac_status); - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); - -#ifdef WIFI_UNLOCK_SYSTEM - rda5990_wakeUnlock(); -#endif -} - -void rda5890_card_to_host(struct rda5890_private *priv, - char *packet, unsigned short packet_len) -{ - unsigned char rx_type; - unsigned short rx_length; - unsigned char msg_type; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s >>>\n", __func__); - - rx_type = (unsigned char)packet[1]&0xF0; - rx_length = (unsigned short)(packet[0] + ((packet[1]&0x0f) << 8)); - - if (rx_length > packet_len) { - RDA5890_ERRP("packet_len %d less than header specified length %d\n", - packet_len, rx_length); - goto out; - } - - if( rx_type == 0x30 ) - { - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_NORM, - "Message Packet\n"); - msg_type = packet[2]; - if(msg_type == 'I') - { - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_NORM, - "Indication Message\n"); - rda5890_wid_status(priv, packet + 2, rx_length - 2); - } - else if (msg_type == 'R') - { - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_NORM, - "WID Message\n"); - rda5890_wid_response(priv, packet + 2, rx_length - 2); - } -#ifdef GET_SCAN_FROM_NETWORK_INFO - else if(msg_type == 'N') - { - extern void rda5890_network_information(struct rda5890_private *priv, - char *info, unsigned short info_len); - rda5890_network_information(priv, packet + 2, rx_length - 2); - } -#endif - else { - //RDA5890_ERRP("Invalid Message Type '%c'\n", msg_type); - } - } - else if(rx_type == 0x20) - { - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_NORM, - "Data Packet\n"); - rda5890_data_rx(priv, packet + 2, rx_length - 2); - } - else { - RDA5890_ERRP("Invalid Packet Type 0x%02x\n", rx_type); - } - -out: - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s <<<\n", __func__); -} - -/* - * check wid response header - * if no error, return the pointer to the payload - * support only 1 wid per packet - */ -int rda5890_check_wid_response(char *wid_rsp, unsigned short wid_rsp_len, - unsigned short wid, char wid_msg_id, - char payload_len, char **ptr_payload) -{ - unsigned short rsp_len; - unsigned short rsp_wid; - unsigned char msg_len; - - if (wid_rsp[0] != 'R') { - RDA5890_ERRP("wid_rsp[0] != 'R'\n"); - goto err; - } - - if (wid_rsp[1] != wid_msg_id) { - RDA5890_ERRP("wid_msg_id not match msg_id: %d \n", wid_rsp[1]); - goto err; - } - - if (wid_rsp_len < 4) { - RDA5890_ERRP("wid_rsp_len < 4\n"); - goto err; - } - - rsp_len = wid_rsp[2] | (wid_rsp[3] << 8); - if (wid_rsp_len != rsp_len) { - RDA5890_ERRP("wid_rsp_len not match, %d != %d\n", wid_rsp_len, rsp_len); - goto err; - } - - if (wid_rsp_len < 7) { - RDA5890_ERRP("wid_rsp_len < 7\n"); - goto err; - } -#if 0 - rsp_wid = wid_rsp[4] | (wid_rsp[5] << 8); - if (wid != rsp_wid) { - RDA5890_ERRP("wid not match, 0x%04x != 0x%04x\n", wid, rsp_wid); - goto err; - } -#endif - msg_len = wid_rsp[6]; - if (wid_rsp_len != msg_len + 7) { - RDA5890_ERRP("msg_len not match, %d + 7 != %d\n", msg_len, wid_rsp_len); - goto err; - } - - if (payload_len != msg_len) { - RDA5890_ERRP("payload_len not match, %d != %d\n", msg_len, payload_len); - goto err; - } - - *ptr_payload = wid_rsp + 7; - - return 0; - -err: - RDA5890_ERRP("rda5890_check_wid_response failed wid=0x%04x wid_msg_id:%d \n" ,wid_rsp[4] | (wid_rsp[5] << 8), wid_msg_id); - return -EINVAL; -} - -/* - * check wid status response - */ -int rda5890_check_wid_status(char *wid_rsp, unsigned short wid_rsp_len, - char wid_msg_id) -{ - int ret; - unsigned short wid = WID_STATUS; - char *ptr_payload; - char status_val; - - ret = rda5890_check_wid_response(wid_rsp, wid_rsp_len, wid, wid_msg_id, - 1, &ptr_payload); - if (ret) { - RDA5890_ERRP("rda5890_check_wid_status, check_wid_response fail\n"); - return ret; - } - - status_val = ptr_payload[0]; - if (status_val != WID_STATUS_SUCCESS) { - RDA5890_ERRP("check_wid_status NOT success, status = %d\n", status_val); - return -EINVAL; - } - - return 0; -} - -int rda5890_generic_get_uchar(struct rda5890_private *priv, - unsigned short wid, unsigned char *val) -{ - int ret; - char wid_req[6]; - unsigned short wid_req_len = 6; - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - char wid_msg_id = priv->wid_msg_id++; - char *ptr_payload; - - wid_req[0] = 'Q'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - wid_req[4] = (char)(wid&0x00FF); - wid_req[5] = (char)((wid&0xFF00) >> 8); - - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_wid_request fail, ret = %d\n", ret); - goto out; - } - - ret = rda5890_check_wid_response(wid_rsp, wid_rsp_len, wid, wid_msg_id, - sizeof(unsigned char), &ptr_payload); - if (ret) { - RDA5890_ERRP("check_wid_response fail, ret = %d\n", ret); - goto out; - } - - *val = *ptr_payload; -out: - return ret; -} - -int rda5890_generic_set_uchar(struct rda5890_private *priv, - unsigned short wid, unsigned char val) -{ - int ret; - char wid_req[7 + sizeof(unsigned char)]; - unsigned short wid_req_len = 7 + 1; - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - char wid_msg_id = priv->wid_msg_id++; - - wid_req[0] = 'W'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - wid_req[4] = (char)(wid&0x00FF); - wid_req[5] = (char)((wid&0xFF00) >> 8); - - wid_req[6] = 1; - wid_req[7] = val; - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_wid_request fail, ret = %d\n", ret); - goto out; - } - - ret = rda5890_check_wid_status(wid_rsp, wid_rsp_len, wid_msg_id); - if (ret) { - RDA5890_ERRP("check_wid_status fail, ret = %d\n", ret); - goto out; - } - -out: - return ret; -} - -#if 1 -int rda5890_generic_get_ushort(struct rda5890_private *priv, - unsigned short wid, unsigned short *val) -{ - int ret; - char wid_req[6]; - unsigned short wid_req_len = 6; - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - char wid_msg_id = priv->wid_msg_id++; - char *ptr_payload; - - wid_req[0] = 'Q'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - wid_req[4] = (char)(wid&0x00FF); - wid_req[5] = (char)((wid&0xFF00) >> 8); - - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_wid_request fail, ret = %d\n", ret); - goto out; - } - - ret = rda5890_check_wid_response(wid_rsp, wid_rsp_len, wid, wid_msg_id, - sizeof(unsigned short), &ptr_payload); - if (ret) { - RDA5890_ERRP("check_wid_response fail, ret = %d\n", ret); - goto out; - } - - memcpy(val, ptr_payload, sizeof(unsigned short)); - -out: - return ret; -} - -int rda5890_generic_set_ushort(struct rda5890_private *priv, - unsigned short wid, unsigned short val) -{ - int ret; - char wid_req[7 + sizeof(unsigned short)]; - unsigned short wid_req_len = 7 + sizeof(unsigned short); - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - char wid_msg_id = priv->wid_msg_id++; - - wid_req[0] = 'W'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - wid_req[4] = (char)(wid&0x00FF); - wid_req[5] = (char)((wid&0xFF00) >> 8); - - wid_req[6] = (char)(sizeof(unsigned short)); - memcpy(wid_req + 7, &val, sizeof(unsigned short)); - - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_wid_request fail, ret = %d\n", ret); - goto out; - } - - ret = rda5890_check_wid_status(wid_rsp, wid_rsp_len, wid_msg_id); - if (ret) { - RDA5890_ERRP("check_wid_status fail, ret = %d\n", ret); - goto out; - } - -out: - return ret; -} -#endif - -int rda5890_generic_get_ulong(struct rda5890_private *priv, - unsigned short wid, unsigned long *val) -{ - int ret; - char wid_req[6]; - unsigned short wid_req_len = 6; - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - char wid_msg_id = priv->wid_msg_id++; - char *ptr_payload; - - wid_req[0] = 'Q'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - wid_req[4] = (char)(wid&0x00FF); - wid_req[5] = (char)((wid&0xFF00) >> 8); - - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_wid_request fail, ret = %d\n", ret); - goto out; - } - - ret = rda5890_check_wid_response(wid_rsp, wid_rsp_len, wid, wid_msg_id, - sizeof(unsigned long), &ptr_payload); - if (ret) { - RDA5890_ERRP("check_wid_response fail, ret = %d\n", ret); - goto out; - } - - memcpy(val, ptr_payload, sizeof(unsigned long)); - -out: - return ret; -} - -int rda5890_generic_set_ulong(struct rda5890_private *priv, - unsigned short wid, unsigned long val) -{ - int ret; - char wid_req[7 + sizeof(unsigned long)]; - unsigned short wid_req_len = 7 + sizeof(unsigned long); - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - char wid_msg_id = priv->wid_msg_id++; - - wid_req[0] = 'W'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - wid_req[4] = (char)(wid&0x00FF); - wid_req[5] = (char)((wid&0xFF00) >> 8); - - wid_req[6] = (char)(sizeof(unsigned long)); - memcpy(wid_req + 7, &val, sizeof(unsigned long)); - - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_wid_request fail, ret = %d\n", ret); - goto out; - } - - ret = rda5890_check_wid_status(wid_rsp, wid_rsp_len, wid_msg_id); - if (ret) { - RDA5890_ERRP("check_wid_status fail, ret = %d\n", ret); - goto out; - } - -out: - return ret; -} - -int rda5890_generic_get_str(struct rda5890_private *priv, - unsigned short wid, unsigned char *val, unsigned char len) -{ - int ret; - char wid_req[6]; - unsigned short wid_req_len = 6; - char wid_rsp[RDA5890_MAX_WID_LEN]; - unsigned short wid_rsp_len = RDA5890_MAX_WID_LEN; - char wid_msg_id = priv->wid_msg_id++; - char *ptr_payload; - - wid_req[0] = 'Q'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - wid_req[4] = (char)(wid&0x00FF); - wid_req[5] = (char)((wid&0xFF00) >> 8); - - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_wid_request fail, ret = %d\n", ret); - goto out; - } - - ret = rda5890_check_wid_response(wid_rsp, wid_rsp_len, wid, wid_msg_id, - (char)len, &ptr_payload); - if (ret) { - RDA5890_ERRP("check_wid_response fail, ret = %d\n", ret); - goto out; - } - - memcpy(val, ptr_payload, len); - -out: - return ret; -} - -int rda5890_generic_set_str(struct rda5890_private *priv, - unsigned short wid, unsigned char *val, unsigned char len) -{ - int ret; - char wid_req[RDA5890_MAX_WID_LEN]; - unsigned short wid_req_len = 7 + len; - char wid_rsp[RDA5890_MAX_WID_LEN]; - unsigned short wid_rsp_len = RDA5890_MAX_WID_LEN; - char wid_msg_id = priv->wid_msg_id++; - - wid_req[0] = 'W'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - wid_req[4] = (char)(wid&0x00FF); - wid_req[5] = (char)((wid&0xFF00) >> 8); - - wid_req[6] = (char)(len); - memcpy(wid_req + 7, val, len); - - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_wid_request fail, ret = %d\n", ret); - goto out; - } - - ret = rda5890_check_wid_status(wid_rsp, wid_rsp_len, wid_msg_id); - if (ret) { - RDA5890_ERRP("check_wid_status fail, ret = %d\n", ret); - goto out; - } - -out: - return ret; -} - -int rda5890_check_wid_response_unknown_len( - char *wid_rsp, unsigned short wid_rsp_len, - unsigned short wid, char wid_msg_id, - char *payload_len, char **ptr_payload) -{ - unsigned short rsp_len; - unsigned short rsp_wid; - unsigned char msg_len; - - if (wid_rsp[0] != 'R') { - RDA5890_ERRP("wid_rsp[0] != 'R'\n"); - return -EINVAL; - } - - if (wid_rsp[1] != wid_msg_id) { - RDA5890_ERRP("wid_msg_id not match\n"); - return -EINVAL; - } - - if (wid_rsp_len < 4) { - RDA5890_ERRP("wid_rsp_len < 4\n"); - return -EINVAL; - } - - rsp_len = wid_rsp[2] | (wid_rsp[3] << 8); - if (wid_rsp_len != rsp_len) { - RDA5890_ERRP("wid_rsp_len not match, %d != %d\n", wid_rsp_len, rsp_len); - return -EINVAL; - } - - if (wid_rsp_len < 7) { - RDA5890_ERRP("wid_rsp_len < 7\n"); - return -EINVAL; - } -#if 0 - rsp_wid = wid_rsp[4] | (wid_rsp[5] << 8); - if (wid != rsp_wid) { - RDA5890_ERRP("wid not match, 0x%04x != 0x%04x\n", wid, rsp_wid); - return -EINVAL; - } -#endif - msg_len = wid_rsp[6]; - if (wid_rsp_len != msg_len + 7) { - RDA5890_ERRP("msg_len not match, %d + 7 != %d\n", msg_len, wid_rsp_len); - return -EINVAL; - } - - *payload_len = msg_len; - - *ptr_payload = wid_rsp + 7; - - return 0; -err: - - RDA5890_ERRP("wid is %x wid_msg %d \n", wid_rsp[4] | (wid_rsp[5] << 8), wid_rsp[1]); - return -EINVAL; -} - -int rda5890_get_str_unknown_len(struct rda5890_private *priv, - unsigned short wid, unsigned char *val, unsigned char *len) -{ - int ret; - char wid_req[6]; - unsigned short wid_req_len = 6; - char wid_rsp[RDA5890_MAX_WID_LEN]; - unsigned short wid_rsp_len = RDA5890_MAX_WID_LEN; - char wid_msg_id = priv->wid_msg_id++; - char *ptr_payload; - - wid_req[0] = 'Q'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - wid_req[4] = (char)(wid&0x00FF); - wid_req[5] = (char)((wid&0xFF00) >> 8); - - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_wid_request fail, ret = %d\n", ret); - goto out; - } - - ret = rda5890_check_wid_response_unknown_len( - wid_rsp, wid_rsp_len, wid, wid_msg_id, (char*)len, &ptr_payload); - if (ret) { - RDA5890_ERRP("check_wid_response fail, ret = %d\n", ret); - goto out; - } - - memcpy(val, ptr_payload, *len); - -out: - return ret; -} - -extern int rda5890_sdio_set_default_notch(struct rda5890_private *priv); -int rda5890_start_scan(struct rda5890_private *priv) -{ - int ret; - char wid_req[12]; - unsigned short wid_req_len = 12; - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - unsigned short wid; - char wid_msg_id = 0; - - if(priv->connect_status != MAC_CONNECTED) - { - rda5890_sdio_set_default_notch(priv); - } - - wid_msg_id = priv->wid_msg_id++; - - wid_req[0] = 'W'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - wid = WID_SITE_SURVEY; - wid_req[4] = (char)(wid&0x00FF); - wid_req[5] = (char)((wid&0xFF00) >> 8); - - wid_req[6] = (char)(0x01); - wid_req[7] = (char)(0x01); - - wid = WID_START_SCAN_REQ; - wid_req[8] = (char)(wid&0x00FF); - wid_req[9] = (char)((wid&0xFF00) >> 8); - - wid_req[10] = (char)(0x01); - wid_req[11] = (char)(0x01); - - - wid_req_len = 12; - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_wid_request fail, ret = %d\n", ret); - goto out; - } - - ret = rda5890_check_wid_status(wid_rsp, wid_rsp_len, wid_msg_id); - if (ret) { - RDA5890_ERRP("check_wid_status fail, ret = %d\n", ret); - goto out; - } - -out: - return ret; -} - - -int rda5890_start_scan_enable_network_info(struct rda5890_private *priv) -{ - int ret; - char wid_req[12]; - unsigned short wid_req_len = 12; - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - unsigned short wid; - char wid_msg_id = 0; - - if(priv->connect_status != MAC_CONNECTED) - { - rda5890_sdio_set_default_notch(priv); - } - - wid_msg_id = priv->wid_msg_id++; - - wid_req[0] = 'W'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - wid = WID_SITE_SURVEY; - wid_req[4] = (char)(wid&0x00FF); - wid_req[5] = (char)((wid&0xFF00) >> 8); - - wid_req[6] = (char)(0x01); - wid_req[7] = (char)(0x01); - - wid = WID_START_SCAN_REQ; - wid_req[8] = (char)(wid&0x00FF); - wid_req[9] = (char)((wid&0xFF00) >> 8); - - wid_req[10] = (char)(0x01); - wid_req[11] = (char)(0x01); - - wid = WID_NETWORK_INFO_EN; - wid_req[12] = (char)(wid&0x00FF); - wid_req[13] = (char)((wid&0xFF00) >> 8); - - wid_req[14] = (char)(0x01); - wid_req[15] = (char)(0x01); // 0x01 scan network info - - wid_req_len = 16; - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_wid_request fail, ret = %d\n", ret); - goto out; - } - - ret = rda5890_check_wid_status(wid_rsp, wid_rsp_len, wid_msg_id); - if (ret) { - RDA5890_ERRP("check_wid_status fail, ret = %d\n", ret); - goto out; - } - -out: - return ret; -} - -int rda5890_start_join(struct rda5890_private *priv) -{ - int ret; - char wid_req[255]; - unsigned short wid_req_len = 0; - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - unsigned short wid; - char wid_msg_id = priv->wid_msg_id++; - unsigned short i = 0; - unsigned char * wep_key = 0, key_str_len = 0; - unsigned char key_str[26 + 1] , * key, *pWid_req; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s <<< mode:%d authtype:%d ssid:%s\n", __func__, priv->imode, priv->authtype, - priv->assoc_ssid); - - wid_req[0] = 'W'; - wid_req[1] = wid_msg_id; - - - wid = WID_802_11I_MODE; - wid_req[4] = (char)(wid&0x00FF); - wid_req[5] = (char)((wid&0xFF00) >> 8); - - wid_req[6] = 1; - wid_req[7] = priv->imode; - - wid = WID_AUTH_TYPE; - wid_req[8] = (char)(wid&0x00FF); - wid_req[9] = (char)((wid&0xFF00) >> 8); - - wid_req[10] = 1; - wid_req[11] = priv->authtype; - -#ifdef GET_SCAN_FROM_NETWORK_INFO - wid = WID_NETWORK_INFO_EN; - wid_req[12] = (char)(wid&0x00FF); - wid_req[13] = (char)((wid&0xFF00) >> 8); - - wid_req[14] = 1; - wid_req[15] = 0; - - wid = WID_CURRENT_TX_RATE; - wid_req[16] = (char)(wid&0x00FF); - wid_req[17] = (char)((wid&0xFF00) >> 8); - - wid_req[18] = 1; - wid_req[19] = 1; - - wid_req_len = 20; - pWid_req = wid_req + 20; -#else - wid_req_len = 12; - pWid_req = wid_req + 12; -#endif - wid = WID_WEP_KEY_VALUE0; - if(priv->imode == 3 || priv->imode == 7) //write wep key - { - for(i = 0 ; i < 4; i ++) - { - key = priv->wep_keys[i].key; - - if(priv->wep_keys[i].len == 0) - continue; - - if (priv->wep_keys[i].len == KEY_LEN_WEP_40) { - sprintf(key_str, "%02x%02x%02x%02x%02x\n", - key[0], key[1], key[2], key[3], key[4]); - key_str_len = 10; - key_str[key_str_len] = '\0'; - } - else if (priv->wep_keys[i].len == KEY_LEN_WEP_104) { - sprintf(key_str, "%02x%02x%02x%02x%02x" - "%02x%02x%02x%02x%02x" - "%02x%02x%02x\n", - key[0], key[1], key[2], key[3], key[4], - key[5], key[6], key[7], key[8], key[9], - key[10], key[11], key[12]); - key_str_len = 26; - key_str[key_str_len] = '\0'; - } - else - continue; - - pWid_req[0] = (char)((wid + i)&0x00FF); - pWid_req[1] = (char)(((wid + i)&0xFF00) >> 8); - - pWid_req[2] = key_str_len; - memcpy(pWid_req + 3, key_str, key_str_len); - - pWid_req += 3 + key_str_len; - wid_req_len += 3 + key_str_len; - } - } - -// ssid - wid = WID_SSID; - pWid_req[0] = (char)(wid&0x00FF); - pWid_req[1] = (char)((wid&0xFF00) >> 8); - - pWid_req[2] = priv->assoc_ssid_len; - memcpy(pWid_req + 3, priv->assoc_ssid, priv->assoc_ssid_len); - - wid_req_len += 3 + priv->assoc_ssid_len; - - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_start_join fail, ret = %d\n", ret); - goto out; - } - - ret = rda5890_check_wid_status(wid_rsp, wid_rsp_len, wid_msg_id); - if (ret) { - RDA5890_ERRP("rda5890_start_join check status fail, ret = %d\n", ret); - goto out; - } - -out: - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s >>> ret = %d req len %d mod:0x%x auth_type:0x%x \n", __func__, ret, wid_req_len, priv->imode - , priv->authtype); - return ret; -} - -int rda5890_set_txrate(struct rda5890_private *priv, unsigned char mbps) -{ - int ret; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "rda5890_set_txrate <<< \n"); - - ret = rda5890_generic_set_uchar(priv, WID_CURRENT_TX_RATE, mbps); //O FOR AUTO 1FOR 1MBPS - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "rda5890_set_txrate success >>> \n"); - -out: - return ret; -} - -int rda5890_set_core_init_polling(struct rda5890_private *priv, const unsigned int (*data)[2], unsigned char num) -{ - int ret = -1; - char wid_req[255]; - unsigned short wid_req_len = 4 + 14*num; - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - unsigned short wid; - char wid_msg_id = priv->wid_msg_id++; - char count = 0, *p_wid_req = NULL; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - - wid_req[0] = 'W'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - p_wid_req = wid_req + 4; - for(count = 0; count < num; count ++) - { - wid = WID_MEMORY_ADDRESS; - p_wid_req[0] = (char)(wid&0x00FF); - p_wid_req[1] = (char)((wid&0xFF00) >> 8); - - p_wid_req[2] = (char)4; - memcpy(p_wid_req + 3, (char*)&data[count][0], 4); - - wid = WID_MEMORY_ACCESS_32BIT; - p_wid_req[7] = (char)(wid&0x00FF); - p_wid_req[8] = (char)((wid&0xFF00) >> 8); - - p_wid_req[9] = (char)4; - memcpy(p_wid_req + 10, (char*)&data[count][1], 4); - p_wid_req += 14; - } - ret = rda5890_wid_request_polling(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_set_sdio_core_init fail, ret = %d\n", ret); - goto out; - } - -out: - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - return ret; -} - -int rda5890_set_core_init(struct rda5890_private *priv, const unsigned int (*data)[2], unsigned char num) -{ - int ret = -1; - char wid_req[255]; - unsigned short wid_req_len = 4 + 14*num; - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - unsigned short wid; - char wid_msg_id = priv->wid_msg_id++; - char count = 0, *p_wid_req = NULL; - - wid_req[0] = 'W'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - p_wid_req = wid_req + 4; - for(count = 0; count < num; count ++) - { - wid = WID_MEMORY_ADDRESS; - p_wid_req[0] = (char)(wid&0x00FF); - p_wid_req[1] = (char)((wid&0xFF00) >> 8); - - p_wid_req[2] = (char)4; - memcpy(p_wid_req + 3, (char*)&data[count][0], 4); - - wid = WID_MEMORY_ACCESS_32BIT; - p_wid_req[7] = (char)(wid&0x00FF); - p_wid_req[8] = (char)((wid&0xFF00) >> 8); - - p_wid_req[9] = (char)4; - memcpy(p_wid_req + 10, (char*)&data[count][1], 4); - p_wid_req += 14; - } - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_set_sdio_core_init fail, ret = %d\n", ret); - goto out; - } - -out: - return ret; -} - -int rda5890_set_core_patch_polling(struct rda5890_private *priv, const unsigned char (*patch)[2], unsigned char num) -{ - int ret; - char wid_req[255]; - unsigned short wid_req_len = 4 + 8*num; - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - unsigned short wid; - char wid_msg_id = priv->wid_msg_id++; - char count = 0 , *p_wid_req = NULL; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s <<< \n", __func__); - - wid_req[0] = 'W'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - p_wid_req = wid_req + 4; - for(count = 0; count < num; count ++) - { - wid = WID_PHY_ACTIVE_REG; - p_wid_req[0] = (char)(wid&0x00FF); - p_wid_req[1] = (char)((wid&0xFF00) >> 8); - - p_wid_req[2] = (char)(0x01); - p_wid_req[3] = patch[count][0]; - - wid = WID_PHY_ACTIVE_REG_VAL; - p_wid_req[4] = (char)(wid&0x00FF); - p_wid_req[5] = (char)((wid&0xFF00) >> 8); - - p_wid_req[6] = (char)(0x01); - p_wid_req[7] = patch[count][1]; - p_wid_req += 8; - } - ret = rda5890_wid_request_polling(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_set_core_patch fail, ret = %d \n", ret); - goto out; - } - -out: - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_DEBUG, - "%s >>> \n", __func__); - return ret; -} - -int rda5890_set_core_patch(struct rda5890_private *priv, const unsigned char (*patch)[2], unsigned char num) -{ - int ret; - char wid_req[255]; - unsigned short wid_req_len = 4 + 8*num; - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - unsigned short wid; - char wid_msg_id = priv->wid_msg_id++; - char count = 0 , *p_wid_req = NULL; - - wid_req[0] = 'W'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - p_wid_req = wid_req + 4; - for(count = 0; count < num; count ++) - { - wid = WID_PHY_ACTIVE_REG; - p_wid_req[0] = (char)(wid&0x00FF); - p_wid_req[1] = (char)((wid&0xFF00) >> 8); - - p_wid_req[2] = (char)(0x01); - p_wid_req[3] = patch[count][0]; - - wid = WID_PHY_ACTIVE_REG_VAL; - p_wid_req[4] = (char)(wid&0x00FF); - p_wid_req[5] = (char)((wid&0xFF00) >> 8); - - p_wid_req[6] = (char)(0x01); - p_wid_req[7] = patch[count][1]; - p_wid_req += 8; - } - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_set_core_patch fail, ret = %d \n", ret); - goto out; - } - -out: - return ret; -} - - -int rda5890_get_fw_ver(struct rda5890_private *priv, unsigned long *fw_ver) -{ - int ret; - - ret = rda5890_generic_get_ulong(priv, WID_SYS_FW_VER, fw_ver); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Get FW_VER 0x%08lx\n", *fw_ver); - -out: - return ret; -} - -int rda5890_get_mac_addr(struct rda5890_private *priv, unsigned char *mac_addr) -{ - int ret; - - ret = rda5890_generic_get_str(priv, WID_MAC_ADDR, mac_addr, ETH_ALEN); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "STA MAC Address [%02x:%02x:%02x:%02x:%02x:%02x]\n", - mac_addr[0], mac_addr[1], mac_addr[2], - mac_addr[3], mac_addr[4], mac_addr[5]); -out: - return ret; -} - -/* support only one bss per packet for now */ -int rda5890_get_scan_results(struct rda5890_private *priv, - struct rda5890_bss_descriptor *bss_desc) -{ - int ret; - int count = 0; - unsigned char len; - unsigned char buf[sizeof(struct rda5890_bss_descriptor)*RDA5890_MAX_NETWORK_NUM + 2]; - unsigned char first_send = 0; - - ret = rda5890_get_str_unknown_len(priv, WID_SITE_SURVEY_RESULTS, - buf, &len); - if (ret) { - return ret; - } - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Get Scan Result, len = %d\n", len); - - if ((len - 2) % sizeof(struct rda5890_bss_descriptor)) { - RDA5890_ERRP("Scan Result len not correct, %d\n", len); - return -EINVAL; - } - - count = (len - 2) / sizeof(struct rda5890_bss_descriptor); - - first_send = *(buf + 1); - memcpy(bss_desc, buf + 2, (len - 2)); - - return (count | first_send << 8); -} - -int rda5890_get_bssid(struct rda5890_private *priv, unsigned char *bssid) -{ - int ret; - - ret = rda5890_generic_get_str(priv, WID_BSSID, bssid, ETH_ALEN); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Get BSSID [%02x:%02x:%02x:%02x:%02x:%02x]\n", - bssid[0], bssid[1], bssid[2], - bssid[3], bssid[4], bssid[5]); -out: - return ret; -} - -int rda5890_get_channel(struct rda5890_private *priv, unsigned char *channel) -{ - int ret; - - ret = rda5890_generic_get_uchar(priv, WID_CURRENT_CHANNEL, channel); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Get Channel %d\n", *channel); - -out: - return ret; -} - -int rda5890_get_rssi(struct rda5890_private *priv, unsigned char *rssi) -{ - int ret; - - *rssi = 0; - ret = rda5890_generic_get_uchar(priv, WID_RSSI, rssi); - if (ret) { - goto out; - } - - - if(priv->connect_status == MAC_CONNECTED) - { - if(*rssi > 215) - { - rda5890_rssi_up_to_200(priv); - } - else - { - rda5890_sdio_set_notch_by_channel(priv, priv->curbssparams.channel); - } - } - else - *rssi = 0; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Get RSSI <<< %d\n", *(char*)rssi); - -out: - return ret; -} - -int rda5890_set_mac_addr(struct rda5890_private *priv, unsigned char *mac_addr) -{ - int ret; - - ret = rda5890_generic_set_str(priv, WID_MAC_ADDR, mac_addr, ETH_ALEN); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set STA MAC Address [%02x:%02x:%02x:%02x:%02x:%02x]\n", - mac_addr[0], mac_addr[1], mac_addr[2], - mac_addr[3], mac_addr[4], mac_addr[5]); -out: - return ret; -} - -int rda5890_set_preamble(struct rda5890_private *priv, unsigned char preamble) -{ - int ret; - - ret = rda5890_generic_set_uchar(priv, WID_PREAMBLE, preamble); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, "rda5890_set_preamble \n"); -out: - return ret; -} - -#ifdef GET_SCAN_FROM_NETWORK_INFO - -int rda5890_set_scan_complete(struct rda5890_private *priv) -{ - int ret; - - ret = rda5890_generic_set_uchar(priv, WID_NETWORK_INFO_EN, 0); - if (ret) { - goto out; - } - -out: - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, "rda5890_set_scan_complete ret=%d \n", ret); - return ret; -} -#endif - -int rda5890_set_ssid(struct rda5890_private *priv, - unsigned char *ssid, unsigned char ssid_len) -{ - int ret; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set SSID: %s, len = %d\n", ssid, ssid_len); - - ret = rda5890_generic_set_str(priv, WID_SSID, ssid, ssid_len); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set SSID Done\n"); - -out: - return ret; -} - -int rda5890_get_ssid(struct rda5890_private *priv, - unsigned char *ssid, unsigned char *ssid_len) -{ - int ret; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Get SSID \n"); - - ret = rda5890_get_str_unknown_len(priv, WID_SSID, ssid, ssid_len); - if(*ssid_len > 0) - ssid[*ssid_len] = '\0'; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Get SSID Done len:%d %s\n", *ssid_len, *ssid_len > 0? ssid:"NULL"); -out: - return ret; -} -int rda5890_set_bssid(struct rda5890_private *priv, unsigned char *bssid) -{ - int ret; - - ret = rda5890_generic_set_str(priv, WID_BSSID, bssid, ETH_ALEN); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set BSSID [%02x:%02x:%02x:%02x:%02x:%02x]\n", - bssid[0], bssid[1], bssid[2], - bssid[3], bssid[4], bssid[5]); -out: - return ret; -} - - -int rda5890_set_imode(struct rda5890_private *priv, unsigned char imode) -{ - int ret; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set IMode 0x%02x\n", imode); - - ret = rda5890_generic_set_uchar(priv, WID_802_11I_MODE, imode); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set IMode Done\n"); - -out: - return ret; -} - -int rda5890_set_authtype(struct rda5890_private *priv, unsigned char authtype) -{ - int ret; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set AuthType 0x%02x\n", authtype); - - ret = rda5890_generic_set_uchar(priv, WID_AUTH_TYPE, authtype); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set AuthType Done\n"); - -out: - return ret; -} - -int rda5890_set_listen_interval(struct rda5890_private *priv, unsigned char interval) -{ - int ret; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set rda5890_set_listen_interval 0x%02x\n", interval); - - ret = rda5890_generic_set_uchar(priv, WID_LISTEN_INTERVAL, interval); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set rda5890_set_listen_interval Done\n"); - -out: - return ret; -} - -int rda5890_set_link_loss_threshold(struct rda5890_private *priv, unsigned char threshold) -{ - int ret; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set rda5890_set_link_loss_threshold 0x%02x\n", threshold); - - ret = rda5890_generic_set_uchar(priv, WID_LINK_LOSS_THRESHOLD, threshold); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set rda5890_set_link_loss_threshold Done\n"); - -out: - return ret; -} - - -int rda5890_set_wepkey(struct rda5890_private *priv, - unsigned short index, unsigned char *key, unsigned char key_len) -{ - int ret; - unsigned char key_str[26 + 1]; // plus 1 for debug print - unsigned char key_str_len; - - if (key_len == KEY_LEN_WEP_40) { - sprintf(key_str, "%02x%02x%02x%02x%02x\n", - key[0], key[1], key[2], key[3], key[4]); - key_str_len = 10; - key_str[key_str_len] = '\0'; - } - else if (key_len == KEY_LEN_WEP_104) { - sprintf(key_str, "%02x%02x%02x%02x%02x" - "%02x%02x%02x%02x%02x" - "%02x%02x%02x\n", - key[0], key[1], key[2], key[3], key[4], - key[5], key[6], key[7], key[8], key[9], - key[10], key[11], key[12]); - key_str_len = 26; - key_str[key_str_len] = '\0'; - } - else { - RDA5890_ERRP("Error in WEP Key length %d\n", key_len); - ret = -EINVAL; - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set WEP KEY[%d]: %s\n", index, key_str); - - ret = rda5890_generic_set_str(priv, - (WID_WEP_KEY_VALUE0 + index), key_str, key_str_len); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set WEP KEY[%d] Done\n", index); - -out: - return ret; -} - -static void dump_key(unsigned char *key, unsigned char key_len) -{ - RDA5890_DBGP("%02x %02x %02x %02x %02x %02x %02x %02x\n", - key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7]); - RDA5890_DBGP("%02x %02x %02x %02x %02x %02x %02x %02x\n", - key[8], key[9], key[10], key[11], key[12], key[13], key[14], key[15]); - if (key_len > 16) - RDA5890_DBGP("%02x %02x %02x %02x %02x %02x %02x %02x\n", - key[16], key[17], key[18], key[19], key[20], key[21], key[22], key[23]); - if (key_len > 24) - RDA5890_DBGP("%02x %02x %02x %02x %02x %02x %02x %02x\n", - key[24], key[25], key[26], key[27], key[28], key[29], key[30], key[31]); -} - -int rda5890_set_ptk(struct rda5890_private *priv, - unsigned char *key, unsigned char key_len) -{ - int ret; - unsigned char key_str[32 + ETH_ALEN + 1]; - unsigned char key_str_len = key_len + ETH_ALEN + 1; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set PTK: len = %d\n", key_len); - if (RDA5890_DBGLA(RDA5890_DA_WID, RDA5890_DL_VERB)) - dump_key(key, key_len); - - if (priv->connect_status != MAC_CONNECTED) { - RDA5890_ERRP("Adding PTK while not connected\n"); - ret = -EINVAL; - goto out; - } - - /*----------------------------------------*/ - /* STA Addr | KeyLength | Key */ - /*----------------------------------------*/ - /* 6 | 1 | KeyLength */ - /*----------------------------------------*/ - - /*---------------------------------------------------------*/ - /* key */ - /*---------------------------------------------------------*/ - /* Temporal Key | Rx Micheal Key | Tx Micheal Key */ - /*---------------------------------------------------------*/ - /* 16 bytes | 8 bytes | 8 bytes */ - /*---------------------------------------------------------*/ - - memcpy(key_str, priv->curbssparams.bssid, ETH_ALEN); - key_str[6] = key_len; - memcpy(key_str + 7, key, 16); - - /* swap TX MIC and RX MIC, rda5890 need RX MIC to be ahead */ - if(key_len > 16) { - memcpy(key_str + 7 + 16, key + 24, 8); - memcpy(key_str + 7 + 24, key + 16, 8); - } - - if(priv->is_wapi) - ret = rda5890_generic_set_str(priv, - WID_ADD_WAPI_PTK, key_str, key_str_len); - else - ret = rda5890_generic_set_str(priv, - WID_ADD_PTK, key_str, key_str_len); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set PTK Done\n"); - -out: - return ret; -} - -int rda5890_set_gtk(struct rda5890_private *priv, unsigned char key_id, - unsigned char *key_rsc, unsigned char key_rsc_len, - unsigned char *key, unsigned char key_len) -{ - int ret; - unsigned char key_str[32 + ETH_ALEN + 8 + 2]; - unsigned char key_str_len = key_len + ETH_ALEN + 8 + 2; - - /*---------------------------------------------------------*/ - /* STA Addr | KeyRSC | KeyID | KeyLength | Key */ - /*---------------------------------------------------------*/ - /* 6 | 8 | 1 | 1 | KeyLength */ - /*---------------------------------------------------------*/ - - /*-------------------------------------*/ - /* key */ - /*-------------------------------------*/ - /* Temporal Key | Rx Micheal Key */ - /*-------------------------------------*/ - /* 16 bytes | 8 bytes */ - /*-------------------------------------*/ - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set GTK: len = %d\n", key_len); - if (RDA5890_DBGLA(RDA5890_DA_WID, RDA5890_DL_VERB)) - dump_key(key, key_len); - - if (priv->connect_status != MAC_CONNECTED) { - RDA5890_ERRP("Adding PTK while not connected\n"); - ret = -EINVAL; - goto out; - } - - memcpy(key_str, priv->curbssparams.bssid, ETH_ALEN); - memcpy(key_str + 6, key_rsc, key_rsc_len); - key_str[14] = key_id; - key_str[15] = key_len; - memcpy(key_str + 16, key, 16); - - /* swap TX MIC and RX MIC, rda5890 need RX MIC to be ahead */ - if(key_len > 16) { - //memcpy(key_str + 16 + 16, key + 16, key_len - 16); - memcpy(key_str + 16 + 16, key + 24, 8); - memcpy(key_str + 16 + 24, key + 16, 8); - } - - if(priv->is_wapi) - ret = rda5890_generic_set_str(priv, - WID_ADD_WAPI_RX_GTK, key_str, key_str_len); - else - ret = rda5890_generic_set_str(priv, - WID_ADD_RX_GTK, key_str, key_str_len); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set GTK Done\n"); - -out: - return ret; -} - -int rda5890_set_scan_timeout(struct rda5890_private *priv) -{ - int ret; - char wid_req[14]; - unsigned short wid_req_len = 19; - char wid_rsp[32]; - unsigned short wid_rsp_len = 32; - char wid_msg_id = priv->wid_msg_id++; - char *ptr_payload; - unsigned short wid = 0; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "rda5890_set_scan_timeout <<< \n"); - - wid = WID_SITE_SURVEY_SCAN_TIME; - - wid_req[0] = 'W'; - wid_req[1] = wid_msg_id; - - wid_req[2] = (char)(wid_req_len&0x00FF); - wid_req[3] = (char)((wid_req_len&0xFF00) >> 8); - - wid_req[4] = (char)(wid&0x00FF); - wid_req[5] = (char)((wid&0xFF00) >> 8); - wid_req[6] = 2; - wid_req[7] = 50; //50 ms one channel - wid_req[8] = 0; - - wid = WID_ACTIVE_SCAN_TIME; - wid_req[9] = (char)(wid&0x00FF); - wid_req[10] = (char)((wid&0xFF00) >> 8); - wid_req[11] = 2; - wid_req[12] = 50; //50 ms one channel - wid_req[13] = 0; - - wid = WID_PASSIVE_SCAN_TIME; - wid_req[14] = (char)(wid&0x00FF); - wid_req[15] = (char)((wid&0xFF00) >> 8); - wid_req[16] = 2; - wid_req[17] = 50; //50 ms one channel - wid_req[18] = 0; - - ret = rda5890_wid_request(priv, wid_req, wid_req_len, wid_rsp, &wid_rsp_len); - if (ret) { - RDA5890_ERRP("rda5890_set_scan_timeout fail, ret = %d\n", ret); - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "rda5890_set_scan_timeout >>> \n"); - -out: - return ret; -} - - -int rda5890_set_pm_mode(struct rda5890_private *priv, unsigned char pm_mode) -{ - int ret; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set PM Mode 0x%02x\n", pm_mode); - - ret = rda5890_generic_set_uchar(priv, WID_POWER_MANAGEMENT, pm_mode); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set PM Mode Done\n"); - -out: - return ret; -} - -int rda5890_set_preasso_sleep(struct rda5890_private *priv, unsigned int preasso_sleep) -{ - int ret; - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set Preasso Sleep 0x%08x\n", preasso_sleep); - - ret = rda5890_generic_set_ulong(priv, WID_PREASSO_SLEEP, preasso_sleep); - if (ret) { - goto out; - } - - RDA5890_DBGLAP(RDA5890_DA_WID, RDA5890_DL_TRACE, - "Set Preasso Sleep Done\n"); - -out: - return ret; -} - diff --git a/drivers/net/wireless/rda5990/rda_wlan/rda5890_wid.h b/drivers/net/wireless/rda5990/rda_wlan/rda5890_wid.h deleted file mode 100755 index 7cf712f4c4cb..000000000000 --- a/drivers/net/wireless/rda5990/rda_wlan/rda5890_wid.h +++ /dev/null @@ -1,288 +0,0 @@ -#ifndef _RDA5890_WID_H_ -#define _RDA5890_WID_H_ - -#define MAX_STRING_LEN 256 -#define MAX_CMD_LEN MAX_STRING_LEN -#define RDA5890_MAX_WID_LEN MAX_CMD_LEN - 2 - -#define MAC_CONNECTED 1 -#define MAC_DISCONNECTED 0 - -#define WID_STATUS_SUCCESS 1 - -typedef enum -{ - G_SHORT_PREAMBLE = 0, - G_LONG_PREAMBLE = 1, - G_AUTO_PREAMBLE = 2 -}G_PREAMBLE_T; - -/* WLAN Identifiers */ -typedef enum { - WID_NIL = -1, - WID_BSS_TYPE = 0x0000, - WID_CURRENT_TX_RATE = 0x0001, - WID_CURRENT_CHANNEL = 0x0002, - WID_PREAMBLE = 0x0003, - WID_11G_OPERATING_MODE = 0x0004, - WID_STATUS = 0x0005, - WID_11G_PROT_MECH = 0x0006, - -#ifdef MAC_HW_UNIT_TEST_MODE - WID_GOTO_SLEEP = 0x0007, -#else /* MAC_HW_UNIT_TEST_MODE */ - WID_SCAN_TYPE = 0x0007, -#endif /* MAC_HW_UNIT_TEST_MODE */ - WID_PRIVACY_INVOKED = 0x0008, - WID_KEY_ID = 0x0009, - WID_QOS_ENABLE = 0x000A, - WID_POWER_MANAGEMENT = 0x000B, - WID_802_11I_MODE = 0x000C, - WID_AUTH_TYPE = 0x000D, - WID_SITE_SURVEY = 0x000E, - WID_LISTEN_INTERVAL = 0x000F, - WID_DTIM_PERIOD = 0x0010, - WID_ACK_POLICY = 0x0011, - WID_RESET = 0x0012, - WID_PCF_MODE = 0x0013, - WID_CFP_PERIOD = 0x0014, - WID_BCAST_SSID = 0x0015, - -#ifdef MAC_HW_UNIT_TEST_MODE - WID_PHY_TEST_PATTERN = 0x0016, -#else /* MAC_HW_UNIT_TEST_MODE */ - WID_DISCONNECT = 0x0016, -#endif /* MAC_HW_UNIT_TEST_MODE */ - - WID_READ_ADDR_SDRAM = 0x0017, - WID_TX_POWER_LEVEL_11A = 0x0018, - WID_REKEY_POLICY = 0x0019, - WID_SHORT_SLOT_ALLOWED = 0x001A, - WID_PHY_ACTIVE_REG = 0x001B, - WID_PHY_ACTIVE_REG_VAL = 0x001C, - WID_TX_POWER_LEVEL_11B = 0x001D, - WID_START_SCAN_REQ = 0x001E, - WID_RSSI = 0x001F, - WID_JOIN_REQ = 0x0020, - WID_ANTENNA_SELECTION = 0x0021, - WID_USER_CONTROL_ON_TX_POWER = 0x0027, - WID_MEMORY_ACCESS_8BIT = 0x0029, - WID_UAPSD_SUPPORT_AP = 0x002A, - - WID_CURRENT_MAC_STATUS = 0x0031, - WID_AUTO_RX_SENSITIVITY = 0x0032, - WID_DATAFLOW_CONTROL = 0x0033, - WID_SCAN_FILTER = 0x0036, - WID_LINK_LOSS_THRESHOLD = 0x0037, - WID_AUTORATE_TYPE = 0x0038, - WID_CCA_THRESHOLD = 0x0039, - - WID_802_11H_DFS_MODE = 0x003B, - WID_802_11H_TPC_MODE = 0x003C, - - WID_PHY_REG_ADDR = 0x0040, - WID_PHY_REG_VAL = 0x0041, - WID_PTA_MODE = 0x0042, - WID_TRAP_TEST = 0x0043, - WID_PTA_BLOCK_BT = 0x0044, - WID_NETWORK_INFO_EN = 0x0045, - - WID_RTS_THRESHOLD = 0x1000, - WID_FRAG_THRESHOLD = 0x1001, - WID_SHORT_RETRY_LIMIT = 0x1002, - WID_LONG_RETRY_LIMIT = 0x1003, - WID_CFP_MAX_DUR = 0x1004, - WID_PHY_TEST_FRAME_LEN = 0x1005, - WID_BEACON_INTERVAL = 0x1006, - WID_MEMORY_ACCESS_16BIT = 0x1008, - - WID_RX_SENSE = 0x100B, - WID_ACTIVE_SCAN_TIME = 0x100C, - WID_PASSIVE_SCAN_TIME = 0x100D, - WID_SITE_SURVEY_SCAN_TIME = 0x100E, - WID_JOIN_TIMEOUT = 0x100F, - WID_AUTH_TIMEOUT = 0x1010, - WID_ASOC_TIMEOUT = 0x1011, - WID_11I_PROTOCOL_TIMEOUT = 0x1012, - WID_EAPOL_RESPONSE_TIMEOUT = 0x1013, - WID_CCA_BUSY_STATUS = 0x1014, - - WID_FAILED_COUNT = 0x2000, - WID_RETRY_COUNT = 0x2001, - WID_MULTIPLE_RETRY_COUNT = 0x2002, - WID_FRAME_DUPLICATE_COUNT = 0x2003, - WID_ACK_FAILURE_COUNT = 0x2004, - WID_RECEIVED_FRAGMENT_COUNT = 0x2005, - WID_MULTICAST_RECEIVED_FRAME_COUNT = 0x2006, - WID_FCS_ERROR_COUNT = 0x2007, - WID_SUCCESS_FRAME_COUNT = 0x2008, - WID_PHY_TEST_PKT_CNT = 0x2009, - WID_PHY_TEST_TXD_PKT_CNT = 0x200A, - WID_TX_FRAGMENT_COUNT = 0x200B, - WID_TX_MULTICAST_FRAME_COUNT = 0x200C, - WID_RTS_SUCCESS_COUNT = 0x200D, - WID_RTS_FAILURE_COUNT = 0x200E, - WID_WEP_UNDECRYPTABLE_COUNT = 0x200F, - WID_REKEY_PERIOD = 0x2010, - WID_REKEY_PACKET_COUNT = 0x2011, -#ifdef MAC_HW_UNIT_TEST_MODE - WID_Q_ENABLE_INFO = 0x2012, -#else /* MAC_HW_UNIT_TEST_MODE */ - WID_802_1X_SERV_ADDR = 0x2012, -#endif /* MAC_HW_UNIT_TEST_MODE */ - WID_STACK_IP_ADDR = 0x2013, - WID_STACK_NETMASK_ADDR = 0x2014, - WID_HW_RX_COUNT = 0x2015, - WID_MEMORY_ADDRESS = 0x201E, - WID_MEMORY_ACCESS_32BIT = 0x201F, - WID_RF_REG_VAL = 0x2021, - WID_FIRMWARE_INFO = 0x2023, - - WID_SYS_FW_VER = 0x2801, - WID_SYS_DBG_LVL = 0x2802, - WID_SYS_DBG_AREA = 0x2803, - WID_UT_MODE = 0x2804, - WID_UT_TX_LEN = 0x2805, - WID_PTA_CTS_FRAME_LEN = 0x2806, - WID_PREASSO_SLEEP = 0x2807, - - WID_SSID = 0x3000, - WID_FIRMWARE_VERSION = 0x3001, - WID_OPERATIONAL_RATE_SET = 0x3002, - WID_BSSID = 0x3003, - WID_WEP_KEY_VALUE0 = 0x3004, - WID_WEP_KEY_VALUE1 = 0x3005, - WID_WEP_KEY_VALUE2 = 0x3006, - WID_WEP_KEY_VALUE3 = 0x3007, - WID_802_11I_PSK = 0x3008, - WID_HCCA_ACTION_REQ = 0x3009, - WID_802_1X_KEY = 0x300A, - WID_HARDWARE_VERSION = 0x300B, - WID_MAC_ADDR = 0x300C, - WID_PHY_TEST_DEST_ADDR = 0x300D, - WID_PHY_TEST_STATS = 0x300E, - WID_PHY_VERSION = 0x300F, - WID_SUPP_USERNAME = 0x3010, - WID_SUPP_PASSWORD = 0x3011, - WID_SITE_SURVEY_RESULTS = 0x3012, - WID_RX_POWER_LEVEL = 0x3013, - - WID_ADD_WEP_KEY = 0x3019, - WID_REMOVE_WEP_KEY = 0x301A, - WID_ADD_PTK = 0x301B, - WID_ADD_RX_GTK = 0x301C, - WID_ADD_TX_GTK = 0x301D, - WID_REMOVE_KEY = 0x301E, - WID_ASSOC_REQ_INFO = 0x301F, - WID_ASSOC_RES_INFO = 0x3020, - WID_UPDATE_RF_SUPPORTED_INFO = 0x3021, - WID_COUNTRY_IE = 0x3022, - - WID_WAPI_ASSOC_IE = 0x3023, - WID_ADD_WAPI_PTK = 0x3024, - WID_ADD_WAPI_RX_GTK = 0x3025, - WID_ADD_WAPI_TX_GTK = 0x3026, - - WID_CONFIG_HCCA_ACTION_REQ = 0x4000, - WID_UAPSD_CONFIG = 0x4001, - WID_UAPSD_STATUS = 0x4002, - WID_WMM_AP_AC_PARAMS = 0x4003, - WID_WMM_STA_AC_PARAMS = 0x4004, - WID_NEWORK_INFO = 0x4005, - WID_STA_JOIN_INFO = 0x4006, - WID_CONNECTED_STA_LIST = 0x4007, - WID_HUT_STATS = 0x4082, - WID_STATISTICS = 0x4008, - WID_MEMORY_DUMP = 0x4009, - WID_LOAD_TRAP_MAP = 0x400a, - WID_AGC_DGC_TBL = 0x400b, - WID_ALL = 0x7FFE, - WID_MAX = 0xFFFF -} WID_T; - -int rda5890_wid_request(struct rda5890_private *priv, - char *wid_req, unsigned short wid_req_len, - char *wid_rsp, unsigned short *wid_rsp_len); - -void rda5890_wid_response(struct rda5890_private *priv, - char *wid_rsp, unsigned short wid_rsp_len); - -void rda5890_wid_status(struct rda5890_private *priv, - char *wid_status, unsigned short wid_status_len); - - -void rda5890_card_to_host(struct rda5890_private *priv, - char *packet, unsigned short packet_len); - -int rda5890_start_scan(struct rda5890_private *priv); -int rda5890_start_scan_enable_network_info(struct rda5890_private *priv); -int rda5890_start_join(struct rda5890_private *priv); - -int rda5890_get_fw_ver(struct rda5890_private *priv, unsigned long *fw_ver); -int rda5890_get_mac_addr(struct rda5890_private *priv, unsigned char *mac_addr); -int rda5890_get_scan_results(struct rda5890_private *priv, - struct rda5890_bss_descriptor *bss_desc); -int rda5890_get_bssid(struct rda5890_private *priv, unsigned char *bssid); -int rda5890_set_bssid(struct rda5890_private *priv, unsigned char *bssid); - -int rda5890_get_channel(struct rda5890_private *priv, unsigned char *channel); -int rda5890_get_rssi(struct rda5890_private *priv, unsigned char *rssi); - -int rda5890_set_mac_addr(struct rda5890_private *priv, unsigned char *mac_addr); -int rda5890_set_preamble(struct rda5890_private *priv, unsigned char preamble); - -int rda5890_set_ssid(struct rda5890_private *priv, - unsigned char *ssid, unsigned char ssid_len); -int rda5890_get_ssid(struct rda5890_private *priv, - unsigned char *ssid, unsigned char *ssid_len); -int rda5890_set_imode(struct rda5890_private *priv, unsigned char imode); -int rda5890_set_authtype(struct rda5890_private *priv, unsigned char authtype); -int rda5890_set_listen_interval(struct rda5890_private *priv, unsigned char interval); -int rda5890_set_link_loss_threshold(struct rda5890_private *priv, unsigned char threshold); -int rda5890_set_wepkey(struct rda5890_private *priv, - unsigned short index, unsigned char *key, unsigned char key_len); -int rda5890_set_ptk(struct rda5890_private *priv, - unsigned char *key, unsigned char key_len); -int rda5890_set_gtk(struct rda5890_private *priv, unsigned char key_id, - unsigned char *key_rsc, unsigned char key_rsc_len, - unsigned char *key, unsigned char key_len); - -int rda5890_set_pm_mode(struct rda5890_private *priv, unsigned char pm_mode); -int rda5890_set_preasso_sleep(struct rda5890_private *priv, unsigned int preasso_sleep); - -int rda5890_generic_get_str(struct rda5890_private *priv, - unsigned short wid, unsigned char *val, unsigned char len); -int rda5890_generic_set_str(struct rda5890_private *priv, - unsigned short wid, unsigned char *val, unsigned char len); - -int rda5890_generic_set_uchar(struct rda5890_private *priv, - unsigned short wid, unsigned char val); -int rda5890_generic_get_ushort(struct rda5890_private *priv, - unsigned short wid, unsigned short *val); -int rda5890_generic_set_ushort(struct rda5890_private *priv, - unsigned short wid, unsigned short val); - -int rda5890_generic_set_ulong(struct rda5890_private *priv, - unsigned short wid, unsigned long val); -int rda5890_generic_get_ulong(struct rda5890_private *priv, - unsigned short wid, unsigned long *val); - -int rda5890_set_core_init(struct rda5890_private *priv, const unsigned int (*data)[2], unsigned char num); -int rda5890_set_core_patch(struct rda5890_private *priv, const unsigned char (*patch)[2], unsigned char num); -int rda5890_set_core_init_polling(struct rda5890_private *priv, const unsigned int (*data)[2], unsigned char num); -int rda5890_set_core_patch_polling(struct rda5890_private *priv, const unsigned char (*patch)[2], unsigned char num); -int rda5890_set_scan_timeout(struct rda5890_private *priv); - -int rda5890_set_txrate(struct rda5890_private *priv, unsigned char mbps); -#ifdef GET_SCAN_FROM_NETWORK_INFO - -int rda5890_set_scan_complete(struct rda5890_private *priv); -#endif -int rda5890_wid_request_polling(struct rda5890_private *priv, - char *wid_req, unsigned short wid_req_len, - char *wid_rsp, unsigned short *wid_rsp_len); -int rda5890_check_wid_response(char *wid_rsp, unsigned short wid_rsp_len, - unsigned short wid, char wid_msg_id, - char payload_len, char **ptr_payload); -#endif - diff --git a/drivers/net/wireless/rkusbwifi/Makefile b/drivers/net/wireless/rkusbwifi/Makefile deleted file mode 100755 index d598e47b6674..000000000000 --- a/drivers/net/wireless/rkusbwifi/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -#rtl8192c packed Makefile -# (gwl) - -rk_cfg := wifi_power.o wifi_power_usb.o wifi_power_ops.o - -rkcfg-y += $(rk_cfg) - -obj-$(CONFIG_RTL8188EU) += rkcfg.o -obj-$(CONFIG_RTL8192CU) += rkcfg.o -obj-$(CONFIG_RTL8723AU) += rkcfg.o -obj-$(CONFIG_RT5370) += rkcfg.o -obj-$(CONFIG_MT7601) += rkcfg.o -.PHONY: clean - -clean: - find . -name '*.o*' -exec rm -f {} \; diff --git a/drivers/net/wireless/rkusbwifi/mt7601/Kconfig b/drivers/net/wireless/rkusbwifi/mt7601/Kconfig deleted file mode 100755 index 40f154af96a1..000000000000 --- a/drivers/net/wireless/rkusbwifi/mt7601/Kconfig +++ /dev/null @@ -1,10 +0,0 @@ -config MT7601 - tristate "Mediatek MT7601 USB WiFi Support" - select WIRELESS_EXT - select WEXT_PRIV - select IEEE80211 - select CFG80211 - select NL80211_TESTMODE - ---help--- - Help message of MT7601 - diff --git a/drivers/net/wireless/rkusbwifi/rt5370/Kconfig b/drivers/net/wireless/rkusbwifi/rt5370/Kconfig deleted file mode 100755 index 83220bd99477..000000000000 --- a/drivers/net/wireless/rkusbwifi/rt5370/Kconfig +++ /dev/null @@ -1,8 +0,0 @@ -config RT5370 - tristate "Mediatek RT5370 USB WiFi Support" - select WIRELESS_EXT - select WEXT_PRIV - select IEEE80211 - ---help--- - Help message of RT5370 - diff --git a/drivers/net/wireless/rkusbwifi/rtl8188eu/Kconfig b/drivers/net/wireless/rkusbwifi/rtl8188eu/Kconfig deleted file mode 100755 index 2451fe0fd9f3..000000000000 --- a/drivers/net/wireless/rkusbwifi/rtl8188eu/Kconfig +++ /dev/null @@ -1,8 +0,0 @@ -config RTL8188EU - tristate "Realtek 8188EU USB WiFi Support" - select WIRELESS_EXT - select WEXT_PRIV - select IEEE80211 - ---help--- - Help message of RTL8188EU & RTL8189ES - diff --git a/drivers/net/wireless/rkusbwifi/rtl8192cu/Kconfig b/drivers/net/wireless/rkusbwifi/rtl8192cu/Kconfig deleted file mode 100755 index a0bbb8da70e4..000000000000 --- a/drivers/net/wireless/rkusbwifi/rtl8192cu/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -config RTL8192CU - tristate "Realtek 8192CU USB WiFi Support" - depends on USB - select WIRELESS_EXT - select WEXT_PRIV - select IEEE80211 - ---help--- - Help message of RTL8192CU - diff --git a/drivers/net/wireless/rkusbwifi/rtl8723au/Kconfig b/drivers/net/wireless/rkusbwifi/rtl8723au/Kconfig deleted file mode 100755 index 969e76e0d5c5..000000000000 --- a/drivers/net/wireless/rkusbwifi/rtl8723au/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -config RTL8723AU - tristate "Realtek 8723AU USB WiFi Support" - depends on USB - select WIRELESS_EXT - select WEXT_PRIV - select IEEE80211 - ---help--- - Help message of RTL8723AU - diff --git a/drivers/net/wireless/rkusbwifi/wifi_power.c b/drivers/net/wireless/rkusbwifi/wifi_power.c deleted file mode 100755 index a0dd91b7ad5a..000000000000 --- a/drivers/net/wireless/rkusbwifi/wifi_power.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * Yongle Lai @ Rockchip - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include -#include -#include -#include "wifi_power.h" - - -/* - * rtw_channel_plan : The initialization parameter of wifi channel, - * Allow number is "0" "2" and "5". - * 0 => 11 ( channel 1 ~ 11 is SCAN_ACTIVE ) - * 2 => 13 ( channel 1 ~ 13 is SCAN_ACTIVE ) - * 5 => 14 ( channel 1 ~ 14 is SCAN_ACTIVE ) - * default number is "2". - */ -char init_channel_plan = 2; -EXPORT_SYMBOL(init_channel_plan); - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_NOT_USE_GPIO, 0, 0, 0, 0, 0 - - // RBOX - //POWER_USE_GPIO, POWER_GPIO_IOMUX, - //GPIO5D6_SDMMC1PWREN_NAME, GPIO5H_GPIO5D6, RK29_PIN5_PD6, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_NOT_USE_GPIO, 0, 0, 0, 0, 0 -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - POWER_NOT_USE_GPIO, 0, 0, 0, 0, 0 -}; - -/* - * 在WIFI被上电前,会调用这个函数。 - */ -void wifi_turn_on_callback(void) -{ -} - -/* - * 在WIFI被下电后,会调用这个函数。 - */ -void wifi_turn_off_callback(void) -{ -} - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(void); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/rkusbwifi/wifi_power.h b/drivers/net/wireless/rkusbwifi/wifi_power.h deleted file mode 100644 index ea21f11060ae..000000000000 --- a/drivers/net/wireless/rkusbwifi/wifi_power.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * wifi_power.h - * - * WIFI power control. - * - * Yongle Lai - */ - -#ifndef WIFI_POWER_H -#define WIFI_POWER_H - -#include - -#define DONT_SWITCH_USB 0 /* Don't switch USB automaticately. */ -#define WIFI_USE_OTG 1 /* WiFi will be connected to USB OTG. */ -#define WIFI_USE_HOST11 2 /* WiFi will be connected to USB HOST 1.1. */ - -#define WIFI_USE_IFACE WIFI_USE_HOST11 /* Select USB Controler */ -#define WIFI_GPIO_POWER_CONTROL 1 /* Enable GPIO Control Power */ - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) -#include -#include -#else -//#include -#include -#endif - -#define WIFI_CHIP_MV8686 0 -#define WIFI_CHIP_AR6002 1 -#define WIFI_CHIP_BCM4319 2 -#define WIFI_CHIP_NRX700 3 -#define WIFI_CHIP_RT3070 4 -#define WIFI_CHIP_RTL8192C 5 - -#define POWER_NOT_USE_GPIO 0 -#define POWER_USE_GPIO 1 -#define POWER_USE_EXT_GPIO 2 /* External GPIO chip is used, such as PCA9554. */ - -#define POWER_GPIO_NOT_IOMUX 0 -#define POWER_GPIO_IOMUX 1 - -#define GPIO_SWITCH_OFF 0 -#define GPIO_SWITCH_ON 1 - -struct wifi_power -{ - u16 use_gpio; /* If uses GPIO to control wifi power supply. 0 - no, 1 - yes. */ - u16 gpio_iomux; /* If the GPIO is iomux. 0 - no, 1 - yes. */ - char *iomux_name; /* IOMUX name */ - u16 iomux_value; /* IOMUX value - which function is choosen. */ - u16 gpio_id; /* GPIO number */ - u16 sensi_level; /* GPIO sensitive level. */ -}; - -int wifi_turn_on_card(int module); -int wifi_turn_off_card(void); -int wifi_reset_card(void); -void wifi_extgpio_operation(u8 id, u8 sens); - -void rockchip_wifi_shutdown(void); - -#endif /* WIFI_GPIO_POWER_CONTROL */ - -#define WIFI_NETWORK_BUSY 0 -#define WIFI_NETWORK_IDLE 1 - -int wifi_power_save_init(void); -int wifi_power_save_exit(void); -int wifi_power_save_stop(void); -int wifi_power_save_state(void); -void wifi_power_save_suspend(void); -void wifi_power_save_resume(void); -int wifi_power_save_register_callback(int (*callback)(int status)); - -void wifi_turn_on_callback(void); -void wifi_turn_off_callback(void); - -/* usb wifi */ -int wifi_activate_usb(void); -int wifi_deactivate_usb(void); -void wifi_usb_init(void); - -#endif /* WIFI_POWER_H */ - diff --git a/drivers/net/wireless/rkusbwifi/wifi_power_ops.c b/drivers/net/wireless/rkusbwifi/wifi_power_ops.c deleted file mode 100644 index 2c289e92665a..000000000000 --- a/drivers/net/wireless/rkusbwifi/wifi_power_ops.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * wifi_power.c - * - * Yongle Lai @ Rockchip Fuzhou @ 20100303. - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) -#include -#include -#else -#include -#include -#endif -#include - - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -extern struct wifi_power power_gpio; -extern struct wifi_power power_save_gpio; -extern struct wifi_power power_reset_gpio; - -extern int rk29sdk_wifi_power(int on); - -#define OS_IOMUX(name, value) rk29_mux_api_set((name), (value)); - -int wifi_gpio_operate(struct wifi_power *gpio, int flag) -{ - int sensitive; - - if (gpio->use_gpio == POWER_NOT_USE_GPIO) - return 0; - - if (gpio->gpio_iomux == POWER_GPIO_IOMUX) - { - OS_IOMUX(gpio->iomux_name, gpio->iomux_value); - } - - if (flag == GPIO_SWITCH_ON) - sensitive = gpio->sensi_level; - else - sensitive = 1 - gpio->sensi_level; - - if (gpio->use_gpio == POWER_USE_EXT_GPIO) - { - wifi_extgpio_operation(gpio->gpio_id, sensitive); - } - else - { - int ret; - - ret = gpio_request(gpio->gpio_id, NULL); - if (ret != 0) - printk("Request GPIO for WIFI POWER error!\n"); - - gpio_direction_output(gpio->gpio_id, sensitive); - gpio_set_value(gpio->gpio_id, sensitive); - - gpio_free(gpio->gpio_id); - } - - return 0; -} - -/* - * WiFi power up sequence - */ -int wifi_turn_on_rtl8192c_card(void) -{ - //wifi_gpio_operate(&power_gpio, GPIO_SWITCH_ON); - rk29sdk_wifi_power(1); - if (power_gpio.use_gpio != POWER_NOT_USE_GPIO) - msleep(1000); - - return 0; -} - -int wifi_turn_on_card(int module) -{ - wifi_turn_on_callback(); - - wifi_turn_on_rtl8192c_card(); - - return 0; -} - -int wifi_turn_off_card(void) -{ - //wifi_gpio_operate(&power_gpio, GPIO_SWITCH_OFF); - rk29sdk_wifi_power(0); - msleep(5); - - wifi_turn_off_callback(); - - return 0; -} - -void rockchip_wifi_shutdown(void) -{ - printk("rockchip_wifi_shutdown....\n"); - - wifi_turn_off_card(); -} -EXPORT_SYMBOL(rockchip_wifi_shutdown); - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/rkusbwifi/wifi_power_usb.c b/drivers/net/wireless/rkusbwifi/wifi_power_usb.c deleted file mode 100644 index 38d068e0e708..000000000000 --- a/drivers/net/wireless/rkusbwifi/wifi_power_usb.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -int wifi_change_usb_mode = 0; -int usb_wifi_status = 0; - -void wifi_usb_init(void) -{ - printk("%s\n",__FUNCTION__); - wifi_change_usb_mode = 0; - usb_wifi_status = 0; -} - -EXPORT_SYMBOL(wifi_usb_init); - -#if (WIFI_USE_IFACE == WIFI_USE_OTG) - -#define USB_NORMAL 0 -#define USB_FORCE_HOST 1 -#define USB_FORCE_DEVICE 2 - -extern int usb_force_usb_for_wifi(int mode); - -/* - * Change USB mode to HOST. - */ -int wifi_activate_usb(void) -{ - printk("%s\n",__FUNCTION__); - wifi_turn_on_card(WIFI_CHIP_RTL8192C); - - wifi_change_usb_mode = usb_force_usb_for_wifi(USB_FORCE_HOST); - msleep(1000); - - usb_wifi_status = 1; - - return 0; -} -EXPORT_SYMBOL(wifi_activate_usb); - -/* - * Change USB mode to be original. - */ -int wifi_deactivate_usb(void) -{ - printk("%s\n",__FUNCTION__); - if (wifi_change_usb_mode == 1) - { - usb_force_usb_for_wifi(USB_FORCE_DEVICE); - msleep(1000); - usb_force_usb_for_wifi(USB_NORMAL); - msleep(1000); - } - wifi_turn_off_card(); - - usb_wifi_status = 0; - - return 0; -} -EXPORT_SYMBOL(wifi_deactivate_usb); - -#elif (WIFI_USE_IFACE == WIFI_USE_HOST11) - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) -extern int usb_switch_usb_host11_for_wifi(int enabled); -#endif - -int wifi_deactivate_usb(void) -{ - printk("%s\n",__FUNCTION__); -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - usb_switch_usb_host11_for_wifi(0); - msleep(1000); -#endif - - wifi_turn_off_card(); - msleep(100); - - return 0; -} -EXPORT_SYMBOL(wifi_deactivate_usb); - -int wifi_activate_usb(void) -{ - printk("%s\n",__FUNCTION__); - wifi_turn_on_card(WIFI_CHIP_RTL8192C); - msleep(100); - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - usb_switch_usb_host11_for_wifi(1); - msleep(1000); -#endif - - return 0; -} -EXPORT_SYMBOL(wifi_activate_usb); - -#else - -int wifi_deactivate_usb(void) -{ - printk("%s\n",__FUNCTION__); - wifi_turn_off_card(); - msleep(1000); - return 0; -} -EXPORT_SYMBOL(wifi_deactivate_usb); - -int wifi_activate_usb(void) -{ - printk("%s\n",__FUNCTION__); - wifi_turn_on_card(WIFI_CHIP_RTL8192C); - msleep(1000); - return 0; -} -EXPORT_SYMBOL(wifi_activate_usb); -#endif - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/rkwifi/Kconfig b/drivers/net/wireless/rkwifi/Kconfig deleted file mode 100644 index 83d7b96f6023..000000000000 --- a/drivers/net/wireless/rkwifi/Kconfig +++ /dev/null @@ -1,23 +0,0 @@ -config RKWIFI - tristate "RK901/RK903/BCM4330/AP6XXX wireless cards support" - depends on MMC && WLAN_80211 - select WIRELESS_EXT - select WEXT_PRIV - ---help--- - This module adds support for wireless adapters based on - Broadcom 4329/30 chipset. - - This driver uses the kernel's wireless extensions subsystem. - - If you choose to build a module, it'll be called dhd. Say M if - unsure. - -config RK_CFG80211 - bool "Enable NL80211 support" - default y - depends on RKWIFI - select CFG80211 - select MAC80211 - help - Enables CFG80211 support - diff --git a/drivers/net/wireless/rkwifi/Makefile b/drivers/net/wireless/rkwifi/Makefile deleted file mode 100644 index 1cd97cd08a5e..000000000000 --- a/drivers/net/wireless/rkwifi/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -#rkwifi packed Makefile -# (gwl) - -obj-$(CONFIG_RKWIFI) += rk_wifi_config.o - -.PHONY: clean - -clean: - find . -name '*.o*' -exec rm -f {} \; diff --git a/drivers/net/wireless/rkwifi/firmware/nvram_4330.txt b/drivers/net/wireless/rkwifi/firmware/nvram_4330.txt deleted file mode 100644 index 6489f212daf8..000000000000 --- a/drivers/net/wireless/rkwifi/firmware/nvram_4330.txt +++ /dev/null @@ -1,40 +0,0 @@ -# bcm94330wlsdgb.txt -manfid=0x2d0 -prodid=0x0552 -vendid=0x14e4 -devid=0x4360 -boardtype=0x0552 -boardrev=0x11 -# this design has 2.4GHz SP3T switch -boardflags=0x00080200 -nocrc=1 -xtalfreq=37400 -boardnum=22 -macaddr=00:90:4c:c5:12:38 -ag0=255 -aa2g=1 -ccode=CN -pa0b0=0x14d0 -pa0b1=0xfd98 -pa0b2=0xff78 -rssismf2g=0xa -rssismc2g=0x3 -rssisav2g=0x7 -maxp2ga0=0x50 -sromrev=3 -il0macaddr=00:90:4c:c5:12:38 -wl0id=0x431b -cckPwrOffset=5 -ofdm2gpo=0x66666666 -mcs2gpo0=0x6666 -mcs2gpo1=0x6666 -swctrlmap_2g=0x04040404,0x02020202,0x02020404,0x10202,0x1ff -swctrlmap_5g=0x00100010,0x00280020,0x00200010,0x14202,0x2f8 -rfreg033=0x19 -rfreg033_cck=0x1f -dacrate2g=160 -txalpfbyp2g=1 -bphyscale=17 -cckPwrIdxCorr=-15 -pacalidx2g=45 -txgaintbl=1 diff --git a/drivers/net/wireless/rkwifi/firmware/nvram_RK901.txt b/drivers/net/wireless/rkwifi/firmware/nvram_RK901.txt deleted file mode 100644 index e7c9dd2b4982..000000000000 --- a/drivers/net/wireless/rkwifi/firmware/nvram_RK901.txt +++ /dev/null @@ -1,52 +0,0 @@ -# bcm943362sdgn (goldengate rev 3) board -# $Copyright (C) 2010 Broadcom Corporation$ -# $Id: bcm943362sdgn.txt 242833 2011-02-25 00:22:28Z cfraser $ -# -#---------------------------------------- -# History notes -# 1. oct 4, 2010. created. copied from 4336sdgp with the following mods -# - changed board rev, boardtype, ag0,macaddr -# -#---------------------------------------- -# -# -sromrev=3 -boardtype=0x0596 -boardrev=0x1100 - -#[NVRAM ONLY] -manfid=0x2d0 -prodid=0x492 -vendid=0x14e4 -devid=0x4343 -boardflags=0x200 -nocrc=1 -xtalfreq=26000 -boardnum=${serno} -il0macaddr=00:90:4c:07:6${maclo12} -ag0=0x0 -aa2g=3 -ccode=ww -regrev=5 -pa0b0=5456 -pa0b1=-647 -pa0b2=-160 -pa0itssit=0x20 -rssismf2g=0xa -rssismc2g=0x3 -rssisav2g=0x7 -maxp2ga0=0x46 -ofdm2gpo=0x22222222 -mcs2gpo0=0x3333 -mcs2gpo1=0x3333 -wl0id=0x431b -cckdigfilttype=20 -cckPwrOffset=6 -ofdmanalogfiltbw2g=3 -rfreg033=0x19 -rfreg033_cck=0x1f -swctrlmap_2g=0x0c050c05,0x0a030a03,0x0a030a03,0x0,0x1ff -triso2g=0 -RAW1=4a 0b ff ff 20 04 d0 02 36 43 -otpimagesize=76 - diff --git a/drivers/net/wireless/rkwifi/firmware/nvram_RK903.cal b/drivers/net/wireless/rkwifi/firmware/nvram_RK903.cal deleted file mode 100644 index f634747e1d3b..000000000000 --- a/drivers/net/wireless/rkwifi/firmware/nvram_RK903.cal +++ /dev/null @@ -1,102 +0,0 @@ -manfid=0x2d0 -prodid=0x0532 -vendid=0x14e4 -devid=0x4360 -boardtype=0x0532 -boardrev=0x40 -#boardflags: has ext 5GHz lna, use a SP3T sw share with BT -boardflags=0x10080a01 -nocrc=1 -xtalfreq=37400 -boardnum=22 -macaddr=00:90:4c:c5:12:38 -ag0=255 -aa2g=1 -aa5g=1 - -#dacrate5g=160 -ccode=ALL -# 2.4GHz PA parameters are preliminary -#pa0b0=0x1403 -#pa0b1=0xfd89 -#pa0b2=0xff47 -pa0b0=0x1491 -pa0b1=0xfd87 -pa0b2=0xff47 - - -cckPwrOffset=4 -# rssi params for 2.4GHz -rssismf2g=0xa -rssismc2g=0x3 -rssisav2g=0x7 -# rssi params for 5GHz -rssismf5g=0xa -rssismc5g=0x7 -rssisav5g=0x1 -#PA parameters for lower a-band -#pa1lob0=0x12f7 -#pa1lob1=0xfe29 -#pa1lob2=0xffd3 -pa1lob0=0x158c -pa1lob1=0xfdb9 -pa1lob2=0xffc0 - -#PA parameters for midband -#pa1b0=0x1229 -#pa1b1=0xfe96 -#pa1b2=0x49 -pa1b0=0x1864 -pa1b1=0x1B8 -pa1b2=0x2DC - -#PA parameters for high band -#pa1hib0=0x129f -#pa1hib1=0xfe5e -#pa1hib2=0x1d -pa1hib0=0x15aa -pa1hib1=0xfe16 -pa1hib2=0x4c - -sromrev=3 -# 2.4G Tx Power -maxp2ga0=76 -cck2gpo=0x4444 -ofdm2gpo=0x66666666 -mcs2gpo0=0x8888 -mcs2gpo1=0x8888 -# 5G Tx Power -maxp5ga0=80 -maxp5gla0=80 -maxp5gha0=80 -ofdm5gpo=0x00000000 -ofdm5glpo=0x00000000 -ofdm5ghpo=0x00000000 -mcs5gpo0=0x0000 -mcs5gpo1=0x0000 -mcs5glpo0=0x0000 -mcs5glpo1=0x0000 -mcs5ghpo0=0x0000 -mcs5ghpo1=0x0000 -#il0macaddr=00:90:4c:c5:12:38 -#wl0id=0x431b -# support A band ext PA -extpagain5g=2 -rfreg033=0x1f -pacalidx2g=65 -swctrlmap_2g=0x04040404,0x02020202,0x04040404,0x010202,0x1ff -swctrlmap_5g=0x50505050,0x28282020,0x20202020,0x010202,0x2f8 -xtalmode=0x20,0x4,0 -pa0itssit=0x20 -triso5g=9 -dacrate2g=160 -noise_cal_ref_2g=56 -noise_cal_po_bias_2g=-4 -#tssitime=1 -txalpfbyp2g=1 -cckdigfilttype=21 -#ofdmdigfilttype=2 - -sd_gpout=0 -sd_gpval=1 -sd_oobonly=1 diff --git a/drivers/net/wireless/rkwifi/rk_wifi_config.c b/drivers/net/wireless/rkwifi/rk_wifi_config.c deleted file mode 100644 index 1816905e01d4..000000000000 --- a/drivers/net/wireless/rkwifi/rk_wifi_config.c +++ /dev/null @@ -1,99 +0,0 @@ -/* rk_wifi_config.c - * - * RKWIFI driver version. - * - * Define the firmware and nvram path - * - * Define default Country Code - * - * gwl @ Rockchip - */ -#include -#include - -/* Set INIT_COUNTRY_CODE - * "US" ---> 11 channels, this is default setting. - * "EU" ---> 13 channels - * "JP" ---> 14 channels - */ - -int rkwifi_set_country_code(char *code) -{ - sprintf(code, "%s", "EU"); - return 0; -} - -/* - * Set Firmware Path - */ - -#define ANDROID_FW_PATH "/system/etc/firmware/" - -int rkwifi_set_firmware(char *fw, char *nvram) -{ -#ifdef CONFIG_RK903 - sprintf(fw, "%s%s", ANDROID_FW_PATH, "fw_RK903.bin"); -#ifdef CONFIG_RKWIFI_26M - sprintf(nvram, "%s%s", ANDROID_FW_PATH, "nvram_RK903_26M.cal"); -#endif -#ifdef CONFIG_RKWIFI_37_4M - sprintf(nvram, "%s%s", ANDROID_FW_PATH, "nvram_RK903.cal"); -#endif -#endif - -#ifdef CONFIG_RK901 - sprintf(fw, "%s%s", ANDROID_FW_PATH, "fw_RK901.bin"); - sprintf(nvram, "%s%s", ANDROID_FW_PATH, "nvram_RK901.txt"); -#endif - -#ifdef CONFIG_BCM4330 - sprintf(fw, "%s%s", ANDROID_FW_PATH, "fw_bcm4330.bin"); - sprintf(nvram, "%s%s", ANDROID_FW_PATH, "nvram_4330.txt"); -#endif - -#ifdef CONFIG_AP6181 - sprintf(fw, "%s%s", ANDROID_FW_PATH, "fw_RK901.bin"); - sprintf(nvram, "%s%s", ANDROID_FW_PATH, "nvram_AP6181.txt"); -#endif - -#ifdef CONFIG_AP6210 - sprintf(fw, "%s%s", ANDROID_FW_PATH, "fw_RK901.bin"); -#ifdef CONFIG_RKWIFI_26M - sprintf(nvram, "%s%s", ANDROID_FW_PATH, "nvram_AP6210.txt"); -#endif -#ifdef CONFIG_RKWIFI_24M - sprintf(nvram, "%s%s", ANDROID_FW_PATH, "nvram_AP6210_24M.txt"); -#endif -#endif - -#ifdef CONFIG_AP6476 - sprintf(fw, "%s%s", ANDROID_FW_PATH, "fw_RK901.bin"); - sprintf(nvram, "%s%s", ANDROID_FW_PATH, "nvram_AP6476.txt"); -#endif - -#ifdef CONFIG_AP6493 - sprintf(fw, "%s%s", ANDROID_FW_PATH, "fw_RK903.bin"); - sprintf(nvram, "%s%s", ANDROID_FW_PATH, "nvram_AP6493.txt"); -#endif - -#ifdef CONFIG_AP6330 - sprintf(fw, "%s%s", ANDROID_FW_PATH, "fw_RK903_ag.bin"); - sprintf(nvram, "%s%s", ANDROID_FW_PATH, "nvram_AP6330.txt"); -#endif - -#ifdef CONFIG_GB86302I - sprintf(fw, "%s%s", ANDROID_FW_PATH, "fw_RK903_ag.bin"); - sprintf(nvram, "%s%s", ANDROID_FW_PATH, "nvram_GB86302I.txt"); -#endif - return 0; -} - -extern int wifi_pcba_test; -int rkwifi_pcba_status(void) -{ - return wifi_pcba_test; -} - -EXPORT_SYMBOL(rkwifi_set_country_code); -EXPORT_SYMBOL(rkwifi_set_firmware); -EXPORT_SYMBOL(rkwifi_pcba_status); diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c deleted file mode 100644 index 8169a85c4498..000000000000 --- a/drivers/net/wireless/rndis_wlan.c +++ /dev/null @@ -1,3765 +0,0 @@ -/* - * Driver for RNDIS based wireless USB devices. - * - * Copyright (C) 2007 by Bjorge Dijkstra - * Copyright (C) 2008-2009 by Jussi Kivilinna - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Portions of this file are based on NDISwrapper project, - * Copyright (C) 2003-2005 Pontus Fuchs, Giridhar Pemmasani - * http://ndiswrapper.sourceforge.net/ - */ - -// #define DEBUG // error path messages, extra info -// #define VERBOSE // more; success messages - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -/* NOTE: All these are settings for Broadcom chipset */ -static char modparam_country[4] = "EU"; -module_param_string(country, modparam_country, 4, 0444); -MODULE_PARM_DESC(country, "Country code (ISO 3166-1 alpha-2), default: EU"); - -static int modparam_frameburst = 1; -module_param_named(frameburst, modparam_frameburst, int, 0444); -MODULE_PARM_DESC(frameburst, "enable frame bursting (default: on)"); - -static int modparam_afterburner = 0; -module_param_named(afterburner, modparam_afterburner, int, 0444); -MODULE_PARM_DESC(afterburner, - "enable afterburner aka '125 High Speed Mode' (default: off)"); - -static int modparam_power_save = 0; -module_param_named(power_save, modparam_power_save, int, 0444); -MODULE_PARM_DESC(power_save, - "set power save mode: 0=off, 1=on, 2=fast (default: off)"); - -static int modparam_power_output = 3; -module_param_named(power_output, modparam_power_output, int, 0444); -MODULE_PARM_DESC(power_output, - "set power output: 0=25%, 1=50%, 2=75%, 3=100% (default: 100%)"); - -static int modparam_roamtrigger = -70; -module_param_named(roamtrigger, modparam_roamtrigger, int, 0444); -MODULE_PARM_DESC(roamtrigger, - "set roaming dBm trigger: -80=optimize for distance, " - "-60=bandwidth (default: -70)"); - -static int modparam_roamdelta = 1; -module_param_named(roamdelta, modparam_roamdelta, int, 0444); -MODULE_PARM_DESC(roamdelta, - "set roaming tendency: 0=aggressive, 1=moderate, " - "2=conservative (default: moderate)"); - -static int modparam_workaround_interval; -module_param_named(workaround_interval, modparam_workaround_interval, - int, 0444); -MODULE_PARM_DESC(workaround_interval, - "set stall workaround interval in msecs (0=disabled) (default: 0)"); - -/* Typical noise/maximum signal level values taken from ndiswrapper iw_ndis.h */ -#define WL_NOISE -96 /* typical noise level in dBm */ -#define WL_SIGMAX -32 /* typical maximum signal level in dBm */ - - -/* Assume that Broadcom 4320 (only chipset at time of writing known to be - * based on wireless rndis) has default txpower of 13dBm. - * This value is from Linksys WUSB54GSC User Guide, Appendix F: Specifications. - * 100% : 20 mW ~ 13dBm - * 75% : 15 mW ~ 12dBm - * 50% : 10 mW ~ 10dBm - * 25% : 5 mW ~ 7dBm - */ -#define BCM4320_DEFAULT_TXPOWER_DBM_100 13 -#define BCM4320_DEFAULT_TXPOWER_DBM_75 12 -#define BCM4320_DEFAULT_TXPOWER_DBM_50 10 -#define BCM4320_DEFAULT_TXPOWER_DBM_25 7 - -/* Known device types */ -#define RNDIS_UNKNOWN 0 -#define RNDIS_BCM4320A 1 -#define RNDIS_BCM4320B 2 - - -/* NDIS data structures. Taken from wpa_supplicant driver_ndis.c - * slightly modified for datatype endianess, etc - */ -#define NDIS_802_11_LENGTH_SSID 32 -#define NDIS_802_11_LENGTH_RATES 8 -#define NDIS_802_11_LENGTH_RATES_EX 16 - -enum ndis_80211_net_type { - NDIS_80211_TYPE_FREQ_HOP, - NDIS_80211_TYPE_DIRECT_SEQ, - NDIS_80211_TYPE_OFDM_A, - NDIS_80211_TYPE_OFDM_G -}; - -enum ndis_80211_net_infra { - NDIS_80211_INFRA_ADHOC, - NDIS_80211_INFRA_INFRA, - NDIS_80211_INFRA_AUTO_UNKNOWN -}; - -enum ndis_80211_auth_mode { - NDIS_80211_AUTH_OPEN, - NDIS_80211_AUTH_SHARED, - NDIS_80211_AUTH_AUTO_SWITCH, - NDIS_80211_AUTH_WPA, - NDIS_80211_AUTH_WPA_PSK, - NDIS_80211_AUTH_WPA_NONE, - NDIS_80211_AUTH_WPA2, - NDIS_80211_AUTH_WPA2_PSK -}; - -enum ndis_80211_encr_status { - NDIS_80211_ENCR_WEP_ENABLED, - NDIS_80211_ENCR_DISABLED, - NDIS_80211_ENCR_WEP_KEY_ABSENT, - NDIS_80211_ENCR_NOT_SUPPORTED, - NDIS_80211_ENCR_TKIP_ENABLED, - NDIS_80211_ENCR_TKIP_KEY_ABSENT, - NDIS_80211_ENCR_CCMP_ENABLED, - NDIS_80211_ENCR_CCMP_KEY_ABSENT -}; - -enum ndis_80211_priv_filter { - NDIS_80211_PRIV_ACCEPT_ALL, - NDIS_80211_PRIV_8021X_WEP -}; - -enum ndis_80211_status_type { - NDIS_80211_STATUSTYPE_AUTHENTICATION, - NDIS_80211_STATUSTYPE_MEDIASTREAMMODE, - NDIS_80211_STATUSTYPE_PMKID_CANDIDATELIST, - NDIS_80211_STATUSTYPE_RADIOSTATE, -}; - -enum ndis_80211_media_stream_mode { - NDIS_80211_MEDIA_STREAM_OFF, - NDIS_80211_MEDIA_STREAM_ON -}; - -enum ndis_80211_radio_status { - NDIS_80211_RADIO_STATUS_ON, - NDIS_80211_RADIO_STATUS_HARDWARE_OFF, - NDIS_80211_RADIO_STATUS_SOFTWARE_OFF, -}; - -enum ndis_80211_addkey_bits { - NDIS_80211_ADDKEY_8021X_AUTH = cpu_to_le32(1 << 28), - NDIS_80211_ADDKEY_SET_INIT_RECV_SEQ = cpu_to_le32(1 << 29), - NDIS_80211_ADDKEY_PAIRWISE_KEY = cpu_to_le32(1 << 30), - NDIS_80211_ADDKEY_TRANSMIT_KEY = cpu_to_le32(1 << 31) -}; - -enum ndis_80211_addwep_bits { - NDIS_80211_ADDWEP_PERCLIENT_KEY = cpu_to_le32(1 << 30), - NDIS_80211_ADDWEP_TRANSMIT_KEY = cpu_to_le32(1 << 31) -}; - -enum ndis_80211_power_mode { - NDIS_80211_POWER_MODE_CAM, - NDIS_80211_POWER_MODE_MAX_PSP, - NDIS_80211_POWER_MODE_FAST_PSP, -}; - -enum ndis_80211_pmkid_cand_list_flag_bits { - NDIS_80211_PMKID_CAND_PREAUTH = cpu_to_le32(1 << 0) -}; - -struct ndis_80211_auth_request { - __le32 length; - u8 bssid[6]; - u8 padding[2]; - __le32 flags; -} __packed; - -struct ndis_80211_pmkid_candidate { - u8 bssid[6]; - u8 padding[2]; - __le32 flags; -} __packed; - -struct ndis_80211_pmkid_cand_list { - __le32 version; - __le32 num_candidates; - struct ndis_80211_pmkid_candidate candidate_list[0]; -} __packed; - -struct ndis_80211_status_indication { - __le32 status_type; - union { - __le32 media_stream_mode; - __le32 radio_status; - struct ndis_80211_auth_request auth_request[0]; - struct ndis_80211_pmkid_cand_list cand_list; - } u; -} __packed; - -struct ndis_80211_ssid { - __le32 length; - u8 essid[NDIS_802_11_LENGTH_SSID]; -} __packed; - -struct ndis_80211_conf_freq_hop { - __le32 length; - __le32 hop_pattern; - __le32 hop_set; - __le32 dwell_time; -} __packed; - -struct ndis_80211_conf { - __le32 length; - __le32 beacon_period; - __le32 atim_window; - __le32 ds_config; - struct ndis_80211_conf_freq_hop fh_config; -} __packed; - -struct ndis_80211_bssid_ex { - __le32 length; - u8 mac[6]; - u8 padding[2]; - struct ndis_80211_ssid ssid; - __le32 privacy; - __le32 rssi; - __le32 net_type; - struct ndis_80211_conf config; - __le32 net_infra; - u8 rates[NDIS_802_11_LENGTH_RATES_EX]; - __le32 ie_length; - u8 ies[0]; -} __packed; - -struct ndis_80211_bssid_list_ex { - __le32 num_items; - struct ndis_80211_bssid_ex bssid[0]; -} __packed; - -struct ndis_80211_fixed_ies { - u8 timestamp[8]; - __le16 beacon_interval; - __le16 capabilities; -} __packed; - -struct ndis_80211_wep_key { - __le32 size; - __le32 index; - __le32 length; - u8 material[32]; -} __packed; - -struct ndis_80211_key { - __le32 size; - __le32 index; - __le32 length; - u8 bssid[6]; - u8 padding[6]; - u8 rsc[8]; - u8 material[32]; -} __packed; - -struct ndis_80211_remove_key { - __le32 size; - __le32 index; - u8 bssid[6]; - u8 padding[2]; -} __packed; - -struct ndis_config_param { - __le32 name_offs; - __le32 name_length; - __le32 type; - __le32 value_offs; - __le32 value_length; -} __packed; - -struct ndis_80211_assoc_info { - __le32 length; - __le16 req_ies; - struct req_ie { - __le16 capa; - __le16 listen_interval; - u8 cur_ap_address[6]; - } req_ie; - __le32 req_ie_length; - __le32 offset_req_ies; - __le16 resp_ies; - struct resp_ie { - __le16 capa; - __le16 status_code; - __le16 assoc_id; - } resp_ie; - __le32 resp_ie_length; - __le32 offset_resp_ies; -} __packed; - -struct ndis_80211_auth_encr_pair { - __le32 auth_mode; - __le32 encr_mode; -} __packed; - -struct ndis_80211_capability { - __le32 length; - __le32 version; - __le32 num_pmkids; - __le32 num_auth_encr_pair; - struct ndis_80211_auth_encr_pair auth_encr_pair[0]; -} __packed; - -struct ndis_80211_bssid_info { - u8 bssid[6]; - u8 pmkid[16]; -} __packed; - -struct ndis_80211_pmkid { - __le32 length; - __le32 bssid_info_count; - struct ndis_80211_bssid_info bssid_info[0]; -} __packed; - -/* - * private data - */ -#define CAP_MODE_80211A 1 -#define CAP_MODE_80211B 2 -#define CAP_MODE_80211G 4 -#define CAP_MODE_MASK 7 - -#define WORK_LINK_UP (1<<0) -#define WORK_LINK_DOWN (1<<1) -#define WORK_SET_MULTICAST_LIST (1<<2) - -#define RNDIS_WLAN_ALG_NONE 0 -#define RNDIS_WLAN_ALG_WEP (1<<0) -#define RNDIS_WLAN_ALG_TKIP (1<<1) -#define RNDIS_WLAN_ALG_CCMP (1<<2) - -#define RNDIS_WLAN_NUM_KEYS 4 -#define RNDIS_WLAN_KEY_MGMT_NONE 0 -#define RNDIS_WLAN_KEY_MGMT_802_1X (1<<0) -#define RNDIS_WLAN_KEY_MGMT_PSK (1<<1) - -#define COMMAND_BUFFER_SIZE (CONTROL_BUFFER_SIZE + sizeof(struct rndis_set)) - -static const struct ieee80211_channel rndis_channels[] = { - { .center_freq = 2412 }, - { .center_freq = 2417 }, - { .center_freq = 2422 }, - { .center_freq = 2427 }, - { .center_freq = 2432 }, - { .center_freq = 2437 }, - { .center_freq = 2442 }, - { .center_freq = 2447 }, - { .center_freq = 2452 }, - { .center_freq = 2457 }, - { .center_freq = 2462 }, - { .center_freq = 2467 }, - { .center_freq = 2472 }, - { .center_freq = 2484 }, -}; - -static const struct ieee80211_rate rndis_rates[] = { - { .bitrate = 10 }, - { .bitrate = 20, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 55, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 110, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 60 }, - { .bitrate = 90 }, - { .bitrate = 120 }, - { .bitrate = 180 }, - { .bitrate = 240 }, - { .bitrate = 360 }, - { .bitrate = 480 }, - { .bitrate = 540 } -}; - -static const u32 rndis_cipher_suites[] = { - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, -}; - -struct rndis_wlan_encr_key { - int len; - u32 cipher; - u8 material[32]; - u8 bssid[ETH_ALEN]; - bool pairwise; - bool tx_key; -}; - -/* RNDIS device private data */ -struct rndis_wlan_private { - struct usbnet *usbdev; - - struct wireless_dev wdev; - - struct cfg80211_scan_request *scan_request; - - struct workqueue_struct *workqueue; - struct delayed_work dev_poller_work; - struct delayed_work scan_work; - struct work_struct work; - struct mutex command_lock; - unsigned long work_pending; - int last_qual; - s32 cqm_rssi_thold; - u32 cqm_rssi_hyst; - int last_cqm_event_rssi; - - struct ieee80211_supported_band band; - struct ieee80211_channel channels[ARRAY_SIZE(rndis_channels)]; - struct ieee80211_rate rates[ARRAY_SIZE(rndis_rates)]; - u32 cipher_suites[ARRAY_SIZE(rndis_cipher_suites)]; - - int device_type; - int caps; - int multicast_size; - - /* module parameters */ - char param_country[4]; - int param_frameburst; - int param_afterburner; - int param_power_save; - int param_power_output; - int param_roamtrigger; - int param_roamdelta; - u32 param_workaround_interval; - - /* hardware state */ - bool radio_on; - int power_mode; - int infra_mode; - bool connected; - u8 bssid[ETH_ALEN]; - u32 current_command_oid; - - /* encryption stuff */ - u8 encr_tx_key_index; - struct rndis_wlan_encr_key encr_keys[RNDIS_WLAN_NUM_KEYS]; - int wpa_version; - - u8 command_buffer[COMMAND_BUFFER_SIZE]; -}; - -/* - * cfg80211 ops - */ -static int rndis_change_virtual_intf(struct wiphy *wiphy, - struct net_device *dev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params); - -static int rndis_scan(struct wiphy *wiphy, - struct cfg80211_scan_request *request); - -static int rndis_set_wiphy_params(struct wiphy *wiphy, u32 changed); - -static int rndis_set_tx_power(struct wiphy *wiphy, - struct wireless_dev *wdev, - enum nl80211_tx_power_setting type, - int mbm); -static int rndis_get_tx_power(struct wiphy *wiphy, - struct wireless_dev *wdev, - int *dbm); - -static int rndis_connect(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_connect_params *sme); - -static int rndis_disconnect(struct wiphy *wiphy, struct net_device *dev, - u16 reason_code); - -static int rndis_join_ibss(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ibss_params *params); - -static int rndis_leave_ibss(struct wiphy *wiphy, struct net_device *dev); - -static int rndis_add_key(struct wiphy *wiphy, struct net_device *netdev, - u8 key_index, bool pairwise, const u8 *mac_addr, - struct key_params *params); - -static int rndis_del_key(struct wiphy *wiphy, struct net_device *netdev, - u8 key_index, bool pairwise, const u8 *mac_addr); - -static int rndis_set_default_key(struct wiphy *wiphy, struct net_device *netdev, - u8 key_index, bool unicast, bool multicast); - -static int rndis_get_station(struct wiphy *wiphy, struct net_device *dev, - u8 *mac, struct station_info *sinfo); - -static int rndis_dump_station(struct wiphy *wiphy, struct net_device *dev, - int idx, u8 *mac, struct station_info *sinfo); - -static int rndis_set_pmksa(struct wiphy *wiphy, struct net_device *netdev, - struct cfg80211_pmksa *pmksa); - -static int rndis_del_pmksa(struct wiphy *wiphy, struct net_device *netdev, - struct cfg80211_pmksa *pmksa); - -static int rndis_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev); - -static int rndis_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, - bool enabled, int timeout); - -static int rndis_set_cqm_rssi_config(struct wiphy *wiphy, - struct net_device *dev, - s32 rssi_thold, u32 rssi_hyst); - -static const struct cfg80211_ops rndis_config_ops = { - .change_virtual_intf = rndis_change_virtual_intf, - .scan = rndis_scan, - .set_wiphy_params = rndis_set_wiphy_params, - .set_tx_power = rndis_set_tx_power, - .get_tx_power = rndis_get_tx_power, - .connect = rndis_connect, - .disconnect = rndis_disconnect, - .join_ibss = rndis_join_ibss, - .leave_ibss = rndis_leave_ibss, - .add_key = rndis_add_key, - .del_key = rndis_del_key, - .set_default_key = rndis_set_default_key, - .get_station = rndis_get_station, - .dump_station = rndis_dump_station, - .set_pmksa = rndis_set_pmksa, - .del_pmksa = rndis_del_pmksa, - .flush_pmksa = rndis_flush_pmksa, - .set_power_mgmt = rndis_set_power_mgmt, - .set_cqm_rssi_config = rndis_set_cqm_rssi_config, -}; - -static void *rndis_wiphy_privid = &rndis_wiphy_privid; - - -static struct rndis_wlan_private *get_rndis_wlan_priv(struct usbnet *dev) -{ - return (struct rndis_wlan_private *)dev->driver_priv; -} - -static u32 get_bcm4320_power_dbm(struct rndis_wlan_private *priv) -{ - switch (priv->param_power_output) { - default: - case 3: - return BCM4320_DEFAULT_TXPOWER_DBM_100; - case 2: - return BCM4320_DEFAULT_TXPOWER_DBM_75; - case 1: - return BCM4320_DEFAULT_TXPOWER_DBM_50; - case 0: - return BCM4320_DEFAULT_TXPOWER_DBM_25; - } -} - -static bool is_wpa_key(struct rndis_wlan_private *priv, u8 idx) -{ - int cipher = priv->encr_keys[idx].cipher; - - return (cipher == WLAN_CIPHER_SUITE_CCMP || - cipher == WLAN_CIPHER_SUITE_TKIP); -} - -static int rndis_cipher_to_alg(u32 cipher) -{ - switch (cipher) { - default: - return RNDIS_WLAN_ALG_NONE; - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - return RNDIS_WLAN_ALG_WEP; - case WLAN_CIPHER_SUITE_TKIP: - return RNDIS_WLAN_ALG_TKIP; - case WLAN_CIPHER_SUITE_CCMP: - return RNDIS_WLAN_ALG_CCMP; - } -} - -static int rndis_akm_suite_to_key_mgmt(u32 akm_suite) -{ - switch (akm_suite) { - default: - return RNDIS_WLAN_KEY_MGMT_NONE; - case WLAN_AKM_SUITE_8021X: - return RNDIS_WLAN_KEY_MGMT_802_1X; - case WLAN_AKM_SUITE_PSK: - return RNDIS_WLAN_KEY_MGMT_PSK; - } -} - -#ifdef DEBUG -static const char *oid_to_string(u32 oid) -{ - switch (oid) { -#define OID_STR(oid) case oid: return(#oid) - /* from rndis_host.h */ - OID_STR(RNDIS_OID_802_3_PERMANENT_ADDRESS); - OID_STR(RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE); - OID_STR(RNDIS_OID_GEN_CURRENT_PACKET_FILTER); - OID_STR(RNDIS_OID_GEN_PHYSICAL_MEDIUM); - - /* from rndis_wlan.c */ - OID_STR(RNDIS_OID_GEN_LINK_SPEED); - OID_STR(RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER); - - OID_STR(RNDIS_OID_GEN_XMIT_OK); - OID_STR(RNDIS_OID_GEN_RCV_OK); - OID_STR(RNDIS_OID_GEN_XMIT_ERROR); - OID_STR(RNDIS_OID_GEN_RCV_ERROR); - OID_STR(RNDIS_OID_GEN_RCV_NO_BUFFER); - - OID_STR(RNDIS_OID_802_3_CURRENT_ADDRESS); - OID_STR(RNDIS_OID_802_3_MULTICAST_LIST); - OID_STR(RNDIS_OID_802_3_MAXIMUM_LIST_SIZE); - - OID_STR(RNDIS_OID_802_11_BSSID); - OID_STR(RNDIS_OID_802_11_SSID); - OID_STR(RNDIS_OID_802_11_INFRASTRUCTURE_MODE); - OID_STR(RNDIS_OID_802_11_ADD_WEP); - OID_STR(RNDIS_OID_802_11_REMOVE_WEP); - OID_STR(RNDIS_OID_802_11_DISASSOCIATE); - OID_STR(RNDIS_OID_802_11_AUTHENTICATION_MODE); - OID_STR(RNDIS_OID_802_11_PRIVACY_FILTER); - OID_STR(RNDIS_OID_802_11_BSSID_LIST_SCAN); - OID_STR(RNDIS_OID_802_11_ENCRYPTION_STATUS); - OID_STR(RNDIS_OID_802_11_ADD_KEY); - OID_STR(RNDIS_OID_802_11_REMOVE_KEY); - OID_STR(RNDIS_OID_802_11_ASSOCIATION_INFORMATION); - OID_STR(RNDIS_OID_802_11_CAPABILITY); - OID_STR(RNDIS_OID_802_11_PMKID); - OID_STR(RNDIS_OID_802_11_NETWORK_TYPES_SUPPORTED); - OID_STR(RNDIS_OID_802_11_NETWORK_TYPE_IN_USE); - OID_STR(RNDIS_OID_802_11_TX_POWER_LEVEL); - OID_STR(RNDIS_OID_802_11_RSSI); - OID_STR(RNDIS_OID_802_11_RSSI_TRIGGER); - OID_STR(RNDIS_OID_802_11_FRAGMENTATION_THRESHOLD); - OID_STR(RNDIS_OID_802_11_RTS_THRESHOLD); - OID_STR(RNDIS_OID_802_11_SUPPORTED_RATES); - OID_STR(RNDIS_OID_802_11_CONFIGURATION); - OID_STR(RNDIS_OID_802_11_POWER_MODE); - OID_STR(RNDIS_OID_802_11_BSSID_LIST); -#undef OID_STR - } - - return "?"; -} -#else -static const char *oid_to_string(u32 oid) -{ - return "?"; -} -#endif - -/* translate error code */ -static int rndis_error_status(__le32 rndis_status) -{ - int ret = -EINVAL; - switch (le32_to_cpu(rndis_status)) { - case RNDIS_STATUS_SUCCESS: - ret = 0; - break; - case RNDIS_STATUS_FAILURE: - case RNDIS_STATUS_INVALID_DATA: - ret = -EINVAL; - break; - case RNDIS_STATUS_NOT_SUPPORTED: - ret = -EOPNOTSUPP; - break; - case RNDIS_STATUS_ADAPTER_NOT_READY: - case RNDIS_STATUS_ADAPTER_NOT_OPEN: - ret = -EBUSY; - break; - } - return ret; -} - -static int rndis_query_oid(struct usbnet *dev, u32 oid, void *data, int *len) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(dev); - union { - void *buf; - struct rndis_msg_hdr *header; - struct rndis_query *get; - struct rndis_query_c *get_c; - } u; - int ret, buflen; - int resplen, respoffs, copylen; - - buflen = *len + sizeof(*u.get); - if (buflen < CONTROL_BUFFER_SIZE) - buflen = CONTROL_BUFFER_SIZE; - - if (buflen > COMMAND_BUFFER_SIZE) { - u.buf = kmalloc(buflen, GFP_KERNEL); - if (!u.buf) - return -ENOMEM; - } else { - u.buf = priv->command_buffer; - } - - mutex_lock(&priv->command_lock); - - memset(u.get, 0, sizeof *u.get); - u.get->msg_type = cpu_to_le32(RNDIS_MSG_QUERY); - u.get->msg_len = cpu_to_le32(sizeof *u.get); - u.get->oid = cpu_to_le32(oid); - - priv->current_command_oid = oid; - ret = rndis_command(dev, u.header, buflen); - priv->current_command_oid = 0; - if (ret < 0) - netdev_dbg(dev->net, "%s(%s): rndis_command() failed, %d (%08x)\n", - __func__, oid_to_string(oid), ret, - le32_to_cpu(u.get_c->status)); - - if (ret == 0) { - resplen = le32_to_cpu(u.get_c->len); - respoffs = le32_to_cpu(u.get_c->offset) + 8; - - if (respoffs > buflen) { - /* Device returned data offset outside buffer, error. */ - netdev_dbg(dev->net, "%s(%s): received invalid " - "data offset: %d > %d\n", __func__, - oid_to_string(oid), respoffs, buflen); - - ret = -EINVAL; - goto exit_unlock; - } - - if ((resplen + respoffs) > buflen) { - /* Device would have returned more data if buffer would - * have been big enough. Copy just the bits that we got. - */ - copylen = buflen - respoffs; - } else { - copylen = resplen; - } - - if (copylen > *len) - copylen = *len; - - memcpy(data, u.buf + respoffs, copylen); - - *len = resplen; - - ret = rndis_error_status(u.get_c->status); - if (ret < 0) - netdev_dbg(dev->net, "%s(%s): device returned error, 0x%08x (%d)\n", - __func__, oid_to_string(oid), - le32_to_cpu(u.get_c->status), ret); - } - -exit_unlock: - mutex_unlock(&priv->command_lock); - - if (u.buf != priv->command_buffer) - kfree(u.buf); - return ret; -} - -static int rndis_set_oid(struct usbnet *dev, u32 oid, const void *data, - int len) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(dev); - union { - void *buf; - struct rndis_msg_hdr *header; - struct rndis_set *set; - struct rndis_set_c *set_c; - } u; - int ret, buflen; - - buflen = len + sizeof(*u.set); - if (buflen < CONTROL_BUFFER_SIZE) - buflen = CONTROL_BUFFER_SIZE; - - if (buflen > COMMAND_BUFFER_SIZE) { - u.buf = kmalloc(buflen, GFP_KERNEL); - if (!u.buf) - return -ENOMEM; - } else { - u.buf = priv->command_buffer; - } - - mutex_lock(&priv->command_lock); - - memset(u.set, 0, sizeof *u.set); - u.set->msg_type = cpu_to_le32(RNDIS_MSG_SET); - u.set->msg_len = cpu_to_le32(sizeof(*u.set) + len); - u.set->oid = cpu_to_le32(oid); - u.set->len = cpu_to_le32(len); - u.set->offset = cpu_to_le32(sizeof(*u.set) - 8); - u.set->handle = cpu_to_le32(0); - memcpy(u.buf + sizeof(*u.set), data, len); - - priv->current_command_oid = oid; - ret = rndis_command(dev, u.header, buflen); - priv->current_command_oid = 0; - if (ret < 0) - netdev_dbg(dev->net, "%s(%s): rndis_command() failed, %d (%08x)\n", - __func__, oid_to_string(oid), ret, - le32_to_cpu(u.set_c->status)); - - if (ret == 0) { - ret = rndis_error_status(u.set_c->status); - - if (ret < 0) - netdev_dbg(dev->net, "%s(%s): device returned error, 0x%08x (%d)\n", - __func__, oid_to_string(oid), - le32_to_cpu(u.set_c->status), ret); - } - - mutex_unlock(&priv->command_lock); - - if (u.buf != priv->command_buffer) - kfree(u.buf); - return ret; -} - -static int rndis_reset(struct usbnet *usbdev) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - struct rndis_reset *reset; - int ret; - - mutex_lock(&priv->command_lock); - - reset = (void *)priv->command_buffer; - memset(reset, 0, sizeof(*reset)); - reset->msg_type = cpu_to_le32(RNDIS_MSG_RESET); - reset->msg_len = cpu_to_le32(sizeof(*reset)); - priv->current_command_oid = 0; - ret = rndis_command(usbdev, (void *)reset, CONTROL_BUFFER_SIZE); - - mutex_unlock(&priv->command_lock); - - if (ret < 0) - return ret; - return 0; -} - -/* - * Specs say that we can only set config parameters only soon after device - * initialization. - * value_type: 0 = u32, 2 = unicode string - */ -static int rndis_set_config_parameter(struct usbnet *dev, char *param, - int value_type, void *value) -{ - struct ndis_config_param *infobuf; - int value_len, info_len, param_len, ret, i; - __le16 *unibuf; - __le32 *dst_value; - - if (value_type == 0) - value_len = sizeof(__le32); - else if (value_type == 2) - value_len = strlen(value) * sizeof(__le16); - else - return -EINVAL; - - param_len = strlen(param) * sizeof(__le16); - info_len = sizeof(*infobuf) + param_len + value_len; - -#ifdef DEBUG - info_len += 12; -#endif - infobuf = kmalloc(info_len, GFP_KERNEL); - if (!infobuf) - return -ENOMEM; - -#ifdef DEBUG - info_len -= 12; - /* extra 12 bytes are for padding (debug output) */ - memset(infobuf, 0xCC, info_len + 12); -#endif - - if (value_type == 2) - netdev_dbg(dev->net, "setting config parameter: %s, value: %s\n", - param, (u8 *)value); - else - netdev_dbg(dev->net, "setting config parameter: %s, value: %d\n", - param, *(u32 *)value); - - infobuf->name_offs = cpu_to_le32(sizeof(*infobuf)); - infobuf->name_length = cpu_to_le32(param_len); - infobuf->type = cpu_to_le32(value_type); - infobuf->value_offs = cpu_to_le32(sizeof(*infobuf) + param_len); - infobuf->value_length = cpu_to_le32(value_len); - - /* simple string to unicode string conversion */ - unibuf = (void *)infobuf + sizeof(*infobuf); - for (i = 0; i < param_len / sizeof(__le16); i++) - unibuf[i] = cpu_to_le16(param[i]); - - if (value_type == 2) { - unibuf = (void *)infobuf + sizeof(*infobuf) + param_len; - for (i = 0; i < value_len / sizeof(__le16); i++) - unibuf[i] = cpu_to_le16(((u8 *)value)[i]); - } else { - dst_value = (void *)infobuf + sizeof(*infobuf) + param_len; - *dst_value = cpu_to_le32(*(u32 *)value); - } - -#ifdef DEBUG - netdev_dbg(dev->net, "info buffer (len: %d)\n", info_len); - for (i = 0; i < info_len; i += 12) { - u32 *tmp = (u32 *)((u8 *)infobuf + i); - netdev_dbg(dev->net, "%08X:%08X:%08X\n", - cpu_to_be32(tmp[0]), - cpu_to_be32(tmp[1]), - cpu_to_be32(tmp[2])); - } -#endif - - ret = rndis_set_oid(dev, RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER, - infobuf, info_len); - if (ret != 0) - netdev_dbg(dev->net, "setting rndis config parameter failed, %d\n", - ret); - - kfree(infobuf); - return ret; -} - -static int rndis_set_config_parameter_str(struct usbnet *dev, - char *param, char *value) -{ - return rndis_set_config_parameter(dev, param, 2, value); -} - -/* - * data conversion functions - */ -static int level_to_qual(int level) -{ - int qual = 100 * (level - WL_NOISE) / (WL_SIGMAX - WL_NOISE); - return qual >= 0 ? (qual <= 100 ? qual : 100) : 0; -} - -/* - * common functions - */ -static int set_infra_mode(struct usbnet *usbdev, int mode); -static void restore_keys(struct usbnet *usbdev); -static int rndis_check_bssid_list(struct usbnet *usbdev, u8 *match_bssid, - bool *matched); - -static int rndis_start_bssid_list_scan(struct usbnet *usbdev) -{ - __le32 tmp; - - /* Note: RNDIS_OID_802_11_BSSID_LIST_SCAN clears internal BSS list. */ - tmp = cpu_to_le32(1); - return rndis_set_oid(usbdev, RNDIS_OID_802_11_BSSID_LIST_SCAN, &tmp, - sizeof(tmp)); -} - -static int set_essid(struct usbnet *usbdev, struct ndis_80211_ssid *ssid) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - int ret; - - ret = rndis_set_oid(usbdev, RNDIS_OID_802_11_SSID, - ssid, sizeof(*ssid)); - if (ret < 0) { - netdev_warn(usbdev->net, "setting SSID failed (%08X)\n", ret); - return ret; - } - if (ret == 0) { - priv->radio_on = true; - netdev_dbg(usbdev->net, "%s(): radio_on = true\n", __func__); - } - - return ret; -} - -static int set_bssid(struct usbnet *usbdev, const u8 *bssid) -{ - int ret; - - ret = rndis_set_oid(usbdev, RNDIS_OID_802_11_BSSID, - bssid, ETH_ALEN); - if (ret < 0) { - netdev_warn(usbdev->net, "setting BSSID[%pM] failed (%08X)\n", - bssid, ret); - return ret; - } - - return ret; -} - -static int clear_bssid(struct usbnet *usbdev) -{ - static const u8 broadcast_mac[ETH_ALEN] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - }; - - return set_bssid(usbdev, broadcast_mac); -} - -static int get_bssid(struct usbnet *usbdev, u8 bssid[ETH_ALEN]) -{ - int ret, len; - - len = ETH_ALEN; - ret = rndis_query_oid(usbdev, RNDIS_OID_802_11_BSSID, - bssid, &len); - - if (ret != 0) - memset(bssid, 0, ETH_ALEN); - - return ret; -} - -static int get_association_info(struct usbnet *usbdev, - struct ndis_80211_assoc_info *info, int len) -{ - return rndis_query_oid(usbdev, - RNDIS_OID_802_11_ASSOCIATION_INFORMATION, - info, &len); -} - -static bool is_associated(struct usbnet *usbdev) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - u8 bssid[ETH_ALEN]; - int ret; - - if (!priv->radio_on) - return false; - - ret = get_bssid(usbdev, bssid); - - return (ret == 0 && !is_zero_ether_addr(bssid)); -} - -static int disassociate(struct usbnet *usbdev, bool reset_ssid) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - struct ndis_80211_ssid ssid; - int i, ret = 0; - - if (priv->radio_on) { - ret = rndis_set_oid(usbdev, - RNDIS_OID_802_11_DISASSOCIATE, - NULL, 0); - if (ret == 0) { - priv->radio_on = false; - netdev_dbg(usbdev->net, "%s(): radio_on = false\n", - __func__); - - if (reset_ssid) - msleep(100); - } - } - - /* disassociate causes radio to be turned off; if reset_ssid - * is given, set random ssid to enable radio */ - if (reset_ssid) { - /* Set device to infrastructure mode so we don't get ad-hoc - * 'media connect' indications with the random ssid. - */ - set_infra_mode(usbdev, NDIS_80211_INFRA_INFRA); - - ssid.length = cpu_to_le32(sizeof(ssid.essid)); - get_random_bytes(&ssid.essid[2], sizeof(ssid.essid)-2); - ssid.essid[0] = 0x1; - ssid.essid[1] = 0xff; - for (i = 2; i < sizeof(ssid.essid); i++) - ssid.essid[i] = 0x1 + (ssid.essid[i] * 0xfe / 0xff); - ret = set_essid(usbdev, &ssid); - } - return ret; -} - -static int set_auth_mode(struct usbnet *usbdev, u32 wpa_version, - enum nl80211_auth_type auth_type, int keymgmt) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - __le32 tmp; - int auth_mode, ret; - - netdev_dbg(usbdev->net, "%s(): wpa_version=0x%x authalg=0x%x keymgmt=0x%x\n", - __func__, wpa_version, auth_type, keymgmt); - - if (wpa_version & NL80211_WPA_VERSION_2) { - if (keymgmt & RNDIS_WLAN_KEY_MGMT_802_1X) - auth_mode = NDIS_80211_AUTH_WPA2; - else - auth_mode = NDIS_80211_AUTH_WPA2_PSK; - } else if (wpa_version & NL80211_WPA_VERSION_1) { - if (keymgmt & RNDIS_WLAN_KEY_MGMT_802_1X) - auth_mode = NDIS_80211_AUTH_WPA; - else if (keymgmt & RNDIS_WLAN_KEY_MGMT_PSK) - auth_mode = NDIS_80211_AUTH_WPA_PSK; - else - auth_mode = NDIS_80211_AUTH_WPA_NONE; - } else if (auth_type == NL80211_AUTHTYPE_SHARED_KEY) - auth_mode = NDIS_80211_AUTH_SHARED; - else if (auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) - auth_mode = NDIS_80211_AUTH_OPEN; - else if (auth_type == NL80211_AUTHTYPE_AUTOMATIC) - auth_mode = NDIS_80211_AUTH_AUTO_SWITCH; - else - return -ENOTSUPP; - - tmp = cpu_to_le32(auth_mode); - ret = rndis_set_oid(usbdev, - RNDIS_OID_802_11_AUTHENTICATION_MODE, - &tmp, sizeof(tmp)); - if (ret != 0) { - netdev_warn(usbdev->net, "setting auth mode failed (%08X)\n", - ret); - return ret; - } - - priv->wpa_version = wpa_version; - - return 0; -} - -static int set_priv_filter(struct usbnet *usbdev) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - __le32 tmp; - - netdev_dbg(usbdev->net, "%s(): wpa_version=0x%x\n", - __func__, priv->wpa_version); - - if (priv->wpa_version & NL80211_WPA_VERSION_2 || - priv->wpa_version & NL80211_WPA_VERSION_1) - tmp = cpu_to_le32(NDIS_80211_PRIV_8021X_WEP); - else - tmp = cpu_to_le32(NDIS_80211_PRIV_ACCEPT_ALL); - - return rndis_set_oid(usbdev, - RNDIS_OID_802_11_PRIVACY_FILTER, &tmp, - sizeof(tmp)); -} - -static int set_encr_mode(struct usbnet *usbdev, int pairwise, int groupwise) -{ - __le32 tmp; - int encr_mode, ret; - - netdev_dbg(usbdev->net, "%s(): cipher_pair=0x%x cipher_group=0x%x\n", - __func__, pairwise, groupwise); - - if (pairwise & RNDIS_WLAN_ALG_CCMP) - encr_mode = NDIS_80211_ENCR_CCMP_ENABLED; - else if (pairwise & RNDIS_WLAN_ALG_TKIP) - encr_mode = NDIS_80211_ENCR_TKIP_ENABLED; - else if (pairwise & RNDIS_WLAN_ALG_WEP) - encr_mode = NDIS_80211_ENCR_WEP_ENABLED; - else if (groupwise & RNDIS_WLAN_ALG_CCMP) - encr_mode = NDIS_80211_ENCR_CCMP_ENABLED; - else if (groupwise & RNDIS_WLAN_ALG_TKIP) - encr_mode = NDIS_80211_ENCR_TKIP_ENABLED; - else - encr_mode = NDIS_80211_ENCR_DISABLED; - - tmp = cpu_to_le32(encr_mode); - ret = rndis_set_oid(usbdev, - RNDIS_OID_802_11_ENCRYPTION_STATUS, &tmp, - sizeof(tmp)); - if (ret != 0) { - netdev_warn(usbdev->net, "setting encr mode failed (%08X)\n", - ret); - return ret; - } - - return 0; -} - -static int set_infra_mode(struct usbnet *usbdev, int mode) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - __le32 tmp; - int ret; - - netdev_dbg(usbdev->net, "%s(): infra_mode=0x%x\n", - __func__, priv->infra_mode); - - tmp = cpu_to_le32(mode); - ret = rndis_set_oid(usbdev, - RNDIS_OID_802_11_INFRASTRUCTURE_MODE, - &tmp, sizeof(tmp)); - if (ret != 0) { - netdev_warn(usbdev->net, "setting infra mode failed (%08X)\n", - ret); - return ret; - } - - /* NDIS drivers clear keys when infrastructure mode is - * changed. But Linux tools assume otherwise. So set the - * keys */ - restore_keys(usbdev); - - priv->infra_mode = mode; - return 0; -} - -static int set_rts_threshold(struct usbnet *usbdev, u32 rts_threshold) -{ - __le32 tmp; - - netdev_dbg(usbdev->net, "%s(): %i\n", __func__, rts_threshold); - - if (rts_threshold < 0 || rts_threshold > 2347) - rts_threshold = 2347; - - tmp = cpu_to_le32(rts_threshold); - return rndis_set_oid(usbdev, - RNDIS_OID_802_11_RTS_THRESHOLD, - &tmp, sizeof(tmp)); -} - -static int set_frag_threshold(struct usbnet *usbdev, u32 frag_threshold) -{ - __le32 tmp; - - netdev_dbg(usbdev->net, "%s(): %i\n", __func__, frag_threshold); - - if (frag_threshold < 256 || frag_threshold > 2346) - frag_threshold = 2346; - - tmp = cpu_to_le32(frag_threshold); - return rndis_set_oid(usbdev, - RNDIS_OID_802_11_FRAGMENTATION_THRESHOLD, - &tmp, sizeof(tmp)); -} - -static void set_default_iw_params(struct usbnet *usbdev) -{ - set_infra_mode(usbdev, NDIS_80211_INFRA_INFRA); - set_auth_mode(usbdev, 0, NL80211_AUTHTYPE_OPEN_SYSTEM, - RNDIS_WLAN_KEY_MGMT_NONE); - set_priv_filter(usbdev); - set_encr_mode(usbdev, RNDIS_WLAN_ALG_NONE, RNDIS_WLAN_ALG_NONE); -} - -static int deauthenticate(struct usbnet *usbdev) -{ - int ret; - - ret = disassociate(usbdev, true); - set_default_iw_params(usbdev); - return ret; -} - -static int set_channel(struct usbnet *usbdev, int channel) -{ - struct ndis_80211_conf config; - unsigned int dsconfig; - int len, ret; - - netdev_dbg(usbdev->net, "%s(%d)\n", __func__, channel); - - /* this OID is valid only when not associated */ - if (is_associated(usbdev)) - return 0; - - dsconfig = ieee80211_dsss_chan_to_freq(channel) * 1000; - - len = sizeof(config); - ret = rndis_query_oid(usbdev, - RNDIS_OID_802_11_CONFIGURATION, - &config, &len); - if (ret < 0) { - netdev_dbg(usbdev->net, "%s(): querying configuration failed\n", - __func__); - return ret; - } - - config.ds_config = cpu_to_le32(dsconfig); - ret = rndis_set_oid(usbdev, - RNDIS_OID_802_11_CONFIGURATION, - &config, sizeof(config)); - - netdev_dbg(usbdev->net, "%s(): %d -> %d\n", __func__, channel, ret); - - return ret; -} - -static struct ieee80211_channel *get_current_channel(struct usbnet *usbdev, - u32 *beacon_period) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - struct ieee80211_channel *channel; - struct ndis_80211_conf config; - int len, ret; - - /* Get channel and beacon interval */ - len = sizeof(config); - ret = rndis_query_oid(usbdev, - RNDIS_OID_802_11_CONFIGURATION, - &config, &len); - netdev_dbg(usbdev->net, "%s(): RNDIS_OID_802_11_CONFIGURATION -> %d\n", - __func__, ret); - if (ret < 0) - return NULL; - - channel = ieee80211_get_channel(priv->wdev.wiphy, - KHZ_TO_MHZ(le32_to_cpu(config.ds_config))); - if (!channel) - return NULL; - - if (beacon_period) - *beacon_period = le32_to_cpu(config.beacon_period); - return channel; -} - -/* index must be 0 - N, as per NDIS */ -static int add_wep_key(struct usbnet *usbdev, const u8 *key, int key_len, - u8 index) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - struct ndis_80211_wep_key ndis_key; - u32 cipher; - int ret; - - netdev_dbg(usbdev->net, "%s(idx: %d, len: %d)\n", - __func__, index, key_len); - - if (index >= RNDIS_WLAN_NUM_KEYS) - return -EINVAL; - - if (key_len == 5) - cipher = WLAN_CIPHER_SUITE_WEP40; - else if (key_len == 13) - cipher = WLAN_CIPHER_SUITE_WEP104; - else - return -EINVAL; - - memset(&ndis_key, 0, sizeof(ndis_key)); - - ndis_key.size = cpu_to_le32(sizeof(ndis_key)); - ndis_key.length = cpu_to_le32(key_len); - ndis_key.index = cpu_to_le32(index); - memcpy(&ndis_key.material, key, key_len); - - if (index == priv->encr_tx_key_index) { - ndis_key.index |= NDIS_80211_ADDWEP_TRANSMIT_KEY; - ret = set_encr_mode(usbdev, RNDIS_WLAN_ALG_WEP, - RNDIS_WLAN_ALG_NONE); - if (ret) - netdev_warn(usbdev->net, "encryption couldn't be enabled (%08X)\n", - ret); - } - - ret = rndis_set_oid(usbdev, - RNDIS_OID_802_11_ADD_WEP, &ndis_key, - sizeof(ndis_key)); - if (ret != 0) { - netdev_warn(usbdev->net, "adding encryption key %d failed (%08X)\n", - index + 1, ret); - return ret; - } - - priv->encr_keys[index].len = key_len; - priv->encr_keys[index].cipher = cipher; - memcpy(&priv->encr_keys[index].material, key, key_len); - memset(&priv->encr_keys[index].bssid, 0xff, ETH_ALEN); - - return 0; -} - -static int add_wpa_key(struct usbnet *usbdev, const u8 *key, int key_len, - u8 index, const u8 *addr, const u8 *rx_seq, - int seq_len, u32 cipher, __le32 flags) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - struct ndis_80211_key ndis_key; - bool is_addr_ok; - int ret; - - if (index >= RNDIS_WLAN_NUM_KEYS) { - netdev_dbg(usbdev->net, "%s(): index out of range (%i)\n", - __func__, index); - return -EINVAL; - } - if (key_len > sizeof(ndis_key.material) || key_len < 0) { - netdev_dbg(usbdev->net, "%s(): key length out of range (%i)\n", - __func__, key_len); - return -EINVAL; - } - if (flags & NDIS_80211_ADDKEY_SET_INIT_RECV_SEQ) { - if (!rx_seq || seq_len <= 0) { - netdev_dbg(usbdev->net, "%s(): recv seq flag without buffer\n", - __func__); - return -EINVAL; - } - if (rx_seq && seq_len > sizeof(ndis_key.rsc)) { - netdev_dbg(usbdev->net, "%s(): too big recv seq buffer\n", __func__); - return -EINVAL; - } - } - - is_addr_ok = addr && !is_zero_ether_addr(addr) && - !is_broadcast_ether_addr(addr); - if ((flags & NDIS_80211_ADDKEY_PAIRWISE_KEY) && !is_addr_ok) { - netdev_dbg(usbdev->net, "%s(): pairwise but bssid invalid (%pM)\n", - __func__, addr); - return -EINVAL; - } - - netdev_dbg(usbdev->net, "%s(%i): flags:%i%i%i\n", - __func__, index, - !!(flags & NDIS_80211_ADDKEY_TRANSMIT_KEY), - !!(flags & NDIS_80211_ADDKEY_PAIRWISE_KEY), - !!(flags & NDIS_80211_ADDKEY_SET_INIT_RECV_SEQ)); - - memset(&ndis_key, 0, sizeof(ndis_key)); - - ndis_key.size = cpu_to_le32(sizeof(ndis_key) - - sizeof(ndis_key.material) + key_len); - ndis_key.length = cpu_to_le32(key_len); - ndis_key.index = cpu_to_le32(index) | flags; - - if (cipher == WLAN_CIPHER_SUITE_TKIP && key_len == 32) { - /* wpa_supplicant gives us the Michael MIC RX/TX keys in - * different order than NDIS spec, so swap the order here. */ - memcpy(ndis_key.material, key, 16); - memcpy(ndis_key.material + 16, key + 24, 8); - memcpy(ndis_key.material + 24, key + 16, 8); - } else - memcpy(ndis_key.material, key, key_len); - - if (flags & NDIS_80211_ADDKEY_SET_INIT_RECV_SEQ) - memcpy(ndis_key.rsc, rx_seq, seq_len); - - if (flags & NDIS_80211_ADDKEY_PAIRWISE_KEY) { - /* pairwise key */ - memcpy(ndis_key.bssid, addr, ETH_ALEN); - } else { - /* group key */ - if (priv->infra_mode == NDIS_80211_INFRA_ADHOC) - memset(ndis_key.bssid, 0xff, ETH_ALEN); - else - get_bssid(usbdev, ndis_key.bssid); - } - - ret = rndis_set_oid(usbdev, - RNDIS_OID_802_11_ADD_KEY, &ndis_key, - le32_to_cpu(ndis_key.size)); - netdev_dbg(usbdev->net, "%s(): RNDIS_OID_802_11_ADD_KEY -> %08X\n", - __func__, ret); - if (ret != 0) - return ret; - - memset(&priv->encr_keys[index], 0, sizeof(priv->encr_keys[index])); - priv->encr_keys[index].len = key_len; - priv->encr_keys[index].cipher = cipher; - memcpy(&priv->encr_keys[index].material, key, key_len); - if (flags & NDIS_80211_ADDKEY_PAIRWISE_KEY) - memcpy(&priv->encr_keys[index].bssid, ndis_key.bssid, ETH_ALEN); - else - memset(&priv->encr_keys[index].bssid, 0xff, ETH_ALEN); - - if (flags & NDIS_80211_ADDKEY_TRANSMIT_KEY) - priv->encr_tx_key_index = index; - - return 0; -} - -static int restore_key(struct usbnet *usbdev, u8 key_idx) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - struct rndis_wlan_encr_key key; - - if (is_wpa_key(priv, key_idx)) - return 0; - - key = priv->encr_keys[key_idx]; - - netdev_dbg(usbdev->net, "%s(): %i:%i\n", __func__, key_idx, key.len); - - if (key.len == 0) - return 0; - - return add_wep_key(usbdev, key.material, key.len, key_idx); -} - -static void restore_keys(struct usbnet *usbdev) -{ - int i; - - for (i = 0; i < 4; i++) - restore_key(usbdev, i); -} - -static void clear_key(struct rndis_wlan_private *priv, u8 idx) -{ - memset(&priv->encr_keys[idx], 0, sizeof(priv->encr_keys[idx])); -} - -/* remove_key is for both wep and wpa */ -static int remove_key(struct usbnet *usbdev, u8 index, const u8 *bssid) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - struct ndis_80211_remove_key remove_key; - __le32 keyindex; - bool is_wpa; - int ret; - - if (index >= RNDIS_WLAN_NUM_KEYS) - return -ENOENT; - - if (priv->encr_keys[index].len == 0) - return 0; - - is_wpa = is_wpa_key(priv, index); - - netdev_dbg(usbdev->net, "%s(): %i:%s:%i\n", - __func__, index, is_wpa ? "wpa" : "wep", - priv->encr_keys[index].len); - - clear_key(priv, index); - - if (is_wpa) { - remove_key.size = cpu_to_le32(sizeof(remove_key)); - remove_key.index = cpu_to_le32(index); - if (bssid) { - /* pairwise key */ - if (!is_broadcast_ether_addr(bssid)) - remove_key.index |= - NDIS_80211_ADDKEY_PAIRWISE_KEY; - memcpy(remove_key.bssid, bssid, - sizeof(remove_key.bssid)); - } else - memset(remove_key.bssid, 0xff, - sizeof(remove_key.bssid)); - - ret = rndis_set_oid(usbdev, - RNDIS_OID_802_11_REMOVE_KEY, - &remove_key, sizeof(remove_key)); - if (ret != 0) - return ret; - } else { - keyindex = cpu_to_le32(index); - ret = rndis_set_oid(usbdev, - RNDIS_OID_802_11_REMOVE_WEP, - &keyindex, sizeof(keyindex)); - if (ret != 0) { - netdev_warn(usbdev->net, - "removing encryption key %d failed (%08X)\n", - index, ret); - return ret; - } - } - - /* if it is transmit key, disable encryption */ - if (index == priv->encr_tx_key_index) - set_encr_mode(usbdev, RNDIS_WLAN_ALG_NONE, RNDIS_WLAN_ALG_NONE); - - return 0; -} - -static void set_multicast_list(struct usbnet *usbdev) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - struct netdev_hw_addr *ha; - __le32 filter, basefilter; - int ret; - char *mc_addrs = NULL; - int mc_count; - - basefilter = filter = cpu_to_le32(RNDIS_PACKET_TYPE_DIRECTED | - RNDIS_PACKET_TYPE_BROADCAST); - - if (usbdev->net->flags & IFF_PROMISC) { - filter |= cpu_to_le32(RNDIS_PACKET_TYPE_PROMISCUOUS | - RNDIS_PACKET_TYPE_ALL_LOCAL); - } else if (usbdev->net->flags & IFF_ALLMULTI) { - filter |= cpu_to_le32(RNDIS_PACKET_TYPE_ALL_MULTICAST); - } - - if (filter != basefilter) - goto set_filter; - - /* - * mc_list should be accessed holding the lock, so copy addresses to - * local buffer first. - */ - netif_addr_lock_bh(usbdev->net); - mc_count = netdev_mc_count(usbdev->net); - if (mc_count > priv->multicast_size) { - filter |= cpu_to_le32(RNDIS_PACKET_TYPE_ALL_MULTICAST); - } else if (mc_count) { - int i = 0; - - mc_addrs = kmalloc_array(mc_count, ETH_ALEN, GFP_ATOMIC); - if (!mc_addrs) { - netif_addr_unlock_bh(usbdev->net); - return; - } - - netdev_for_each_mc_addr(ha, usbdev->net) - memcpy(mc_addrs + i++ * ETH_ALEN, - ha->addr, ETH_ALEN); - } - netif_addr_unlock_bh(usbdev->net); - - if (filter != basefilter) - goto set_filter; - - if (mc_count) { - ret = rndis_set_oid(usbdev, - RNDIS_OID_802_3_MULTICAST_LIST, - mc_addrs, mc_count * ETH_ALEN); - kfree(mc_addrs); - if (ret == 0) - filter |= cpu_to_le32(RNDIS_PACKET_TYPE_MULTICAST); - else - filter |= cpu_to_le32(RNDIS_PACKET_TYPE_ALL_MULTICAST); - - netdev_dbg(usbdev->net, "RNDIS_OID_802_3_MULTICAST_LIST(%d, max: %d) -> %d\n", - mc_count, priv->multicast_size, ret); - } - -set_filter: - ret = rndis_set_oid(usbdev, RNDIS_OID_GEN_CURRENT_PACKET_FILTER, &filter, - sizeof(filter)); - if (ret < 0) { - netdev_warn(usbdev->net, "couldn't set packet filter: %08x\n", - le32_to_cpu(filter)); - } - - netdev_dbg(usbdev->net, "RNDIS_OID_GEN_CURRENT_PACKET_FILTER(%08x) -> %d\n", - le32_to_cpu(filter), ret); -} - -#ifdef DEBUG -static void debug_print_pmkids(struct usbnet *usbdev, - struct ndis_80211_pmkid *pmkids, - const char *func_str) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - int i, len, count, max_pmkids, entry_len; - - max_pmkids = priv->wdev.wiphy->max_num_pmkids; - len = le32_to_cpu(pmkids->length); - count = le32_to_cpu(pmkids->bssid_info_count); - - entry_len = (count > 0) ? (len - sizeof(*pmkids)) / count : -1; - - netdev_dbg(usbdev->net, "%s(): %d PMKIDs (data len: %d, entry len: " - "%d)\n", func_str, count, len, entry_len); - - if (count > max_pmkids) - count = max_pmkids; - - for (i = 0; i < count; i++) { - u32 *tmp = (u32 *)pmkids->bssid_info[i].pmkid; - - netdev_dbg(usbdev->net, "%s(): bssid: %pM, " - "pmkid: %08X:%08X:%08X:%08X\n", - func_str, pmkids->bssid_info[i].bssid, - cpu_to_be32(tmp[0]), cpu_to_be32(tmp[1]), - cpu_to_be32(tmp[2]), cpu_to_be32(tmp[3])); - } -} -#else -static void debug_print_pmkids(struct usbnet *usbdev, - struct ndis_80211_pmkid *pmkids, - const char *func_str) -{ - return; -} -#endif - -static struct ndis_80211_pmkid *get_device_pmkids(struct usbnet *usbdev) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - struct ndis_80211_pmkid *pmkids; - int len, ret, max_pmkids; - - max_pmkids = priv->wdev.wiphy->max_num_pmkids; - len = sizeof(*pmkids) + max_pmkids * sizeof(pmkids->bssid_info[0]); - - pmkids = kzalloc(len, GFP_KERNEL); - if (!pmkids) - return ERR_PTR(-ENOMEM); - - pmkids->length = cpu_to_le32(len); - pmkids->bssid_info_count = cpu_to_le32(max_pmkids); - - ret = rndis_query_oid(usbdev, RNDIS_OID_802_11_PMKID, - pmkids, &len); - if (ret < 0) { - netdev_dbg(usbdev->net, "%s(): RNDIS_OID_802_11_PMKID(%d, %d)" - " -> %d\n", __func__, len, max_pmkids, ret); - - kfree(pmkids); - return ERR_PTR(ret); - } - - if (le32_to_cpu(pmkids->bssid_info_count) > max_pmkids) - pmkids->bssid_info_count = cpu_to_le32(max_pmkids); - - debug_print_pmkids(usbdev, pmkids, __func__); - - return pmkids; -} - -static int set_device_pmkids(struct usbnet *usbdev, - struct ndis_80211_pmkid *pmkids) -{ - int ret, len, num_pmkids; - - num_pmkids = le32_to_cpu(pmkids->bssid_info_count); - len = sizeof(*pmkids) + num_pmkids * sizeof(pmkids->bssid_info[0]); - pmkids->length = cpu_to_le32(len); - - debug_print_pmkids(usbdev, pmkids, __func__); - - ret = rndis_set_oid(usbdev, RNDIS_OID_802_11_PMKID, pmkids, - le32_to_cpu(pmkids->length)); - if (ret < 0) { - netdev_dbg(usbdev->net, "%s(): RNDIS_OID_802_11_PMKID(%d, %d) -> %d" - "\n", __func__, len, num_pmkids, ret); - } - - kfree(pmkids); - return ret; -} - -static struct ndis_80211_pmkid *remove_pmkid(struct usbnet *usbdev, - struct ndis_80211_pmkid *pmkids, - struct cfg80211_pmksa *pmksa, - int max_pmkids) -{ - int i, newlen, err; - unsigned int count; - - count = le32_to_cpu(pmkids->bssid_info_count); - - if (count > max_pmkids) - count = max_pmkids; - - for (i = 0; i < count; i++) - if (ether_addr_equal(pmkids->bssid_info[i].bssid, - pmksa->bssid)) - break; - - /* pmkid not found */ - if (i == count) { - netdev_dbg(usbdev->net, "%s(): bssid not found (%pM)\n", - __func__, pmksa->bssid); - err = -ENOENT; - goto error; - } - - for (; i + 1 < count; i++) - pmkids->bssid_info[i] = pmkids->bssid_info[i + 1]; - - count--; - newlen = sizeof(*pmkids) + count * sizeof(pmkids->bssid_info[0]); - - pmkids->length = cpu_to_le32(newlen); - pmkids->bssid_info_count = cpu_to_le32(count); - - return pmkids; -error: - kfree(pmkids); - return ERR_PTR(err); -} - -static struct ndis_80211_pmkid *update_pmkid(struct usbnet *usbdev, - struct ndis_80211_pmkid *pmkids, - struct cfg80211_pmksa *pmksa, - int max_pmkids) -{ - struct ndis_80211_pmkid *new_pmkids; - int i, err, newlen; - unsigned int count; - - count = le32_to_cpu(pmkids->bssid_info_count); - - if (count > max_pmkids) - count = max_pmkids; - - /* update with new pmkid */ - for (i = 0; i < count; i++) { - if (!ether_addr_equal(pmkids->bssid_info[i].bssid, - pmksa->bssid)) - continue; - - memcpy(pmkids->bssid_info[i].pmkid, pmksa->pmkid, - WLAN_PMKID_LEN); - - return pmkids; - } - - /* out of space, return error */ - if (i == max_pmkids) { - netdev_dbg(usbdev->net, "%s(): out of space\n", __func__); - err = -ENOSPC; - goto error; - } - - /* add new pmkid */ - newlen = sizeof(*pmkids) + (count + 1) * sizeof(pmkids->bssid_info[0]); - - new_pmkids = krealloc(pmkids, newlen, GFP_KERNEL); - if (!new_pmkids) { - err = -ENOMEM; - goto error; - } - pmkids = new_pmkids; - - pmkids->length = cpu_to_le32(newlen); - pmkids->bssid_info_count = cpu_to_le32(count + 1); - - memcpy(pmkids->bssid_info[count].bssid, pmksa->bssid, ETH_ALEN); - memcpy(pmkids->bssid_info[count].pmkid, pmksa->pmkid, WLAN_PMKID_LEN); - - return pmkids; -error: - kfree(pmkids); - return ERR_PTR(err); -} - -/* - * cfg80211 ops - */ -static int rndis_change_virtual_intf(struct wiphy *wiphy, - struct net_device *dev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - int mode; - - switch (type) { - case NL80211_IFTYPE_ADHOC: - mode = NDIS_80211_INFRA_ADHOC; - break; - case NL80211_IFTYPE_STATION: - mode = NDIS_80211_INFRA_INFRA; - break; - default: - return -EINVAL; - } - - priv->wdev.iftype = type; - - return set_infra_mode(usbdev, mode); -} - -static int rndis_set_wiphy_params(struct wiphy *wiphy, u32 changed) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - int err; - - if (changed & WIPHY_PARAM_FRAG_THRESHOLD) { - err = set_frag_threshold(usbdev, wiphy->frag_threshold); - if (err < 0) - return err; - } - - if (changed & WIPHY_PARAM_RTS_THRESHOLD) { - err = set_rts_threshold(usbdev, wiphy->rts_threshold); - if (err < 0) - return err; - } - - return 0; -} - -static int rndis_set_tx_power(struct wiphy *wiphy, - struct wireless_dev *wdev, - enum nl80211_tx_power_setting type, - int mbm) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - - netdev_dbg(usbdev->net, "%s(): type:0x%x mbm:%i\n", - __func__, type, mbm); - - if (mbm < 0 || (mbm % 100)) - return -ENOTSUPP; - - /* Device doesn't support changing txpower after initialization, only - * turn off/on radio. Support 'auto' mode and setting same dBm that is - * currently used. - */ - if (type == NL80211_TX_POWER_AUTOMATIC || - MBM_TO_DBM(mbm) == get_bcm4320_power_dbm(priv)) { - if (!priv->radio_on) - disassociate(usbdev, true); /* turn on radio */ - - return 0; - } - - return -ENOTSUPP; -} - -static int rndis_get_tx_power(struct wiphy *wiphy, - struct wireless_dev *wdev, - int *dbm) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - - *dbm = get_bcm4320_power_dbm(priv); - - netdev_dbg(usbdev->net, "%s(): dbm:%i\n", __func__, *dbm); - - return 0; -} - -#define SCAN_DELAY_JIFFIES (6 * HZ) -static int rndis_scan(struct wiphy *wiphy, - struct cfg80211_scan_request *request) -{ - struct net_device *dev = request->wdev->netdev; - struct usbnet *usbdev = netdev_priv(dev); - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - int ret; - int delay = SCAN_DELAY_JIFFIES; - - netdev_dbg(usbdev->net, "cfg80211.scan\n"); - - /* Get current bssid list from device before new scan, as new scan - * clears internal bssid list. - */ - rndis_check_bssid_list(usbdev, NULL, NULL); - - if (priv->scan_request && priv->scan_request != request) - return -EBUSY; - - priv->scan_request = request; - - ret = rndis_start_bssid_list_scan(usbdev); - if (ret == 0) { - if (priv->device_type == RNDIS_BCM4320A) - delay = HZ; - - /* Wait before retrieving scan results from device */ - queue_delayed_work(priv->workqueue, &priv->scan_work, delay); - } - - return ret; -} - -static bool rndis_bss_info_update(struct usbnet *usbdev, - struct ndis_80211_bssid_ex *bssid) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - struct ieee80211_channel *channel; - struct cfg80211_bss *bss; - s32 signal; - u64 timestamp; - u16 capability; - u16 beacon_interval; - struct ndis_80211_fixed_ies *fixed; - int ie_len, bssid_len; - u8 *ie; - - netdev_dbg(usbdev->net, " found bssid: '%.32s' [%pM], len: %d\n", - bssid->ssid.essid, bssid->mac, le32_to_cpu(bssid->length)); - - /* parse bssid structure */ - bssid_len = le32_to_cpu(bssid->length); - - if (bssid_len < sizeof(struct ndis_80211_bssid_ex) + - sizeof(struct ndis_80211_fixed_ies)) - return NULL; - - fixed = (struct ndis_80211_fixed_ies *)bssid->ies; - - ie = (void *)(bssid->ies + sizeof(struct ndis_80211_fixed_ies)); - ie_len = min(bssid_len - (int)sizeof(*bssid), - (int)le32_to_cpu(bssid->ie_length)); - ie_len -= sizeof(struct ndis_80211_fixed_ies); - if (ie_len < 0) - return NULL; - - /* extract data for cfg80211_inform_bss */ - channel = ieee80211_get_channel(priv->wdev.wiphy, - KHZ_TO_MHZ(le32_to_cpu(bssid->config.ds_config))); - if (!channel) - return NULL; - - signal = level_to_qual(le32_to_cpu(bssid->rssi)); - timestamp = le64_to_cpu(*(__le64 *)fixed->timestamp); - capability = le16_to_cpu(fixed->capabilities); - beacon_interval = le16_to_cpu(fixed->beacon_interval); - - bss = cfg80211_inform_bss(priv->wdev.wiphy, channel, bssid->mac, - timestamp, capability, beacon_interval, ie, ie_len, signal, - GFP_KERNEL); - cfg80211_put_bss(priv->wdev.wiphy, bss); - - return (bss != NULL); -} - -static struct ndis_80211_bssid_ex *next_bssid_list_item( - struct ndis_80211_bssid_ex *bssid, - int *bssid_len, void *buf, int len) -{ - void *buf_end, *bssid_end; - - buf_end = (char *)buf + len; - bssid_end = (char *)bssid + *bssid_len; - - if ((int)(buf_end - bssid_end) < sizeof(bssid->length)) { - *bssid_len = 0; - return NULL; - } else { - bssid = (void *)((char *)bssid + *bssid_len); - *bssid_len = le32_to_cpu(bssid->length); - return bssid; - } -} - -static bool check_bssid_list_item(struct ndis_80211_bssid_ex *bssid, - int bssid_len, void *buf, int len) -{ - void *buf_end, *bssid_end; - - if (!bssid || bssid_len <= 0 || bssid_len > len) - return false; - - buf_end = (char *)buf + len; - bssid_end = (char *)bssid + bssid_len; - - return (int)(buf_end - bssid_end) >= 0 && (int)(bssid_end - buf) >= 0; -} - -static int rndis_check_bssid_list(struct usbnet *usbdev, u8 *match_bssid, - bool *matched) -{ - void *buf = NULL; - struct ndis_80211_bssid_list_ex *bssid_list; - struct ndis_80211_bssid_ex *bssid; - int ret = -EINVAL, len, count, bssid_len, real_count, new_len; - - netdev_dbg(usbdev->net, "%s()\n", __func__); - - len = CONTROL_BUFFER_SIZE; -resize_buf: - buf = kzalloc(len, GFP_KERNEL); - if (!buf) { - ret = -ENOMEM; - goto out; - } - - /* BSSID-list might have got bigger last time we checked, keep - * resizing until it won't get any bigger. - */ - new_len = len; - ret = rndis_query_oid(usbdev, RNDIS_OID_802_11_BSSID_LIST, - buf, &new_len); - if (ret != 0 || new_len < sizeof(struct ndis_80211_bssid_list_ex)) - goto out; - - if (new_len > len) { - len = new_len; - kfree(buf); - goto resize_buf; - } - - len = new_len; - - bssid_list = buf; - count = le32_to_cpu(bssid_list->num_items); - real_count = 0; - netdev_dbg(usbdev->net, "%s(): buflen: %d\n", __func__, len); - - bssid_len = 0; - bssid = next_bssid_list_item(bssid_list->bssid, &bssid_len, buf, len); - - /* Device returns incorrect 'num_items'. Workaround by ignoring the - * received 'num_items' and walking through full bssid buffer instead. - */ - while (check_bssid_list_item(bssid, bssid_len, buf, len)) { - if (rndis_bss_info_update(usbdev, bssid) && match_bssid && - matched) { - if (ether_addr_equal(bssid->mac, match_bssid)) - *matched = true; - } - - real_count++; - bssid = next_bssid_list_item(bssid, &bssid_len, buf, len); - } - - netdev_dbg(usbdev->net, "%s(): num_items from device: %d, really found:" - " %d\n", __func__, count, real_count); - -out: - kfree(buf); - return ret; -} - -static void rndis_get_scan_results(struct work_struct *work) -{ - struct rndis_wlan_private *priv = - container_of(work, struct rndis_wlan_private, scan_work.work); - struct usbnet *usbdev = priv->usbdev; - int ret; - - netdev_dbg(usbdev->net, "get_scan_results\n"); - - if (!priv->scan_request) - return; - - ret = rndis_check_bssid_list(usbdev, NULL, NULL); - - cfg80211_scan_done(priv->scan_request, ret < 0); - - priv->scan_request = NULL; -} - -static int rndis_connect(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_connect_params *sme) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - struct ieee80211_channel *channel = sme->channel; - struct ndis_80211_ssid ssid; - int pairwise = RNDIS_WLAN_ALG_NONE; - int groupwise = RNDIS_WLAN_ALG_NONE; - int keymgmt = RNDIS_WLAN_KEY_MGMT_NONE; - int length, i, ret, chan = -1; - - if (channel) - chan = ieee80211_frequency_to_channel(channel->center_freq); - - groupwise = rndis_cipher_to_alg(sme->crypto.cipher_group); - for (i = 0; i < sme->crypto.n_ciphers_pairwise; i++) - pairwise |= - rndis_cipher_to_alg(sme->crypto.ciphers_pairwise[i]); - - if (sme->crypto.n_ciphers_pairwise > 0 && - pairwise == RNDIS_WLAN_ALG_NONE) { - netdev_err(usbdev->net, "Unsupported pairwise cipher\n"); - return -ENOTSUPP; - } - - for (i = 0; i < sme->crypto.n_akm_suites; i++) - keymgmt |= - rndis_akm_suite_to_key_mgmt(sme->crypto.akm_suites[i]); - - if (sme->crypto.n_akm_suites > 0 && - keymgmt == RNDIS_WLAN_KEY_MGMT_NONE) { - netdev_err(usbdev->net, "Invalid keymgmt\n"); - return -ENOTSUPP; - } - - netdev_dbg(usbdev->net, "cfg80211.connect('%.32s':[%pM]:%d:[%d,0x%x:0x%x]:[0x%x:0x%x]:0x%x)\n", - sme->ssid, sme->bssid, chan, - sme->privacy, sme->crypto.wpa_versions, sme->auth_type, - groupwise, pairwise, keymgmt); - - if (is_associated(usbdev)) - disassociate(usbdev, false); - - ret = set_infra_mode(usbdev, NDIS_80211_INFRA_INFRA); - if (ret < 0) { - netdev_dbg(usbdev->net, "connect: set_infra_mode failed, %d\n", - ret); - goto err_turn_radio_on; - } - - ret = set_auth_mode(usbdev, sme->crypto.wpa_versions, sme->auth_type, - keymgmt); - if (ret < 0) { - netdev_dbg(usbdev->net, "connect: set_auth_mode failed, %d\n", - ret); - goto err_turn_radio_on; - } - - set_priv_filter(usbdev); - - ret = set_encr_mode(usbdev, pairwise, groupwise); - if (ret < 0) { - netdev_dbg(usbdev->net, "connect: set_encr_mode failed, %d\n", - ret); - goto err_turn_radio_on; - } - - if (channel) { - ret = set_channel(usbdev, chan); - if (ret < 0) { - netdev_dbg(usbdev->net, "connect: set_channel failed, %d\n", - ret); - goto err_turn_radio_on; - } - } - - if (sme->key && ((groupwise | pairwise) & RNDIS_WLAN_ALG_WEP)) { - priv->encr_tx_key_index = sme->key_idx; - ret = add_wep_key(usbdev, sme->key, sme->key_len, sme->key_idx); - if (ret < 0) { - netdev_dbg(usbdev->net, "connect: add_wep_key failed, %d (%d, %d)\n", - ret, sme->key_len, sme->key_idx); - goto err_turn_radio_on; - } - } - - if (sme->bssid && !is_zero_ether_addr(sme->bssid) && - !is_broadcast_ether_addr(sme->bssid)) { - ret = set_bssid(usbdev, sme->bssid); - if (ret < 0) { - netdev_dbg(usbdev->net, "connect: set_bssid failed, %d\n", - ret); - goto err_turn_radio_on; - } - } else - clear_bssid(usbdev); - - length = sme->ssid_len; - if (length > NDIS_802_11_LENGTH_SSID) - length = NDIS_802_11_LENGTH_SSID; - - memset(&ssid, 0, sizeof(ssid)); - ssid.length = cpu_to_le32(length); - memcpy(ssid.essid, sme->ssid, length); - - /* Pause and purge rx queue, so we don't pass packets before - * 'media connect'-indication. - */ - usbnet_pause_rx(usbdev); - usbnet_purge_paused_rxq(usbdev); - - ret = set_essid(usbdev, &ssid); - if (ret < 0) - netdev_dbg(usbdev->net, "connect: set_essid failed, %d\n", ret); - return ret; - -err_turn_radio_on: - disassociate(usbdev, true); - - return ret; -} - -static int rndis_disconnect(struct wiphy *wiphy, struct net_device *dev, - u16 reason_code) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - - netdev_dbg(usbdev->net, "cfg80211.disconnect(%d)\n", reason_code); - - priv->connected = false; - memset(priv->bssid, 0, ETH_ALEN); - - return deauthenticate(usbdev); -} - -static int rndis_join_ibss(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ibss_params *params) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - struct ieee80211_channel *channel = params->chandef.chan; - struct ndis_80211_ssid ssid; - enum nl80211_auth_type auth_type; - int ret, alg, length, chan = -1; - - if (channel) - chan = ieee80211_frequency_to_channel(channel->center_freq); - - /* TODO: How to handle ad-hoc encryption? - * connect() has *key, join_ibss() doesn't. RNDIS requires key to be - * pre-shared for encryption (open/shared/wpa), is key set before - * join_ibss? Which auth_type to use (not in params)? What about WPA? - */ - if (params->privacy) { - auth_type = NL80211_AUTHTYPE_SHARED_KEY; - alg = RNDIS_WLAN_ALG_WEP; - } else { - auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM; - alg = RNDIS_WLAN_ALG_NONE; - } - - netdev_dbg(usbdev->net, "cfg80211.join_ibss('%.32s':[%pM]:%d:%d)\n", - params->ssid, params->bssid, chan, params->privacy); - - if (is_associated(usbdev)) - disassociate(usbdev, false); - - ret = set_infra_mode(usbdev, NDIS_80211_INFRA_ADHOC); - if (ret < 0) { - netdev_dbg(usbdev->net, "join_ibss: set_infra_mode failed, %d\n", - ret); - goto err_turn_radio_on; - } - - ret = set_auth_mode(usbdev, 0, auth_type, RNDIS_WLAN_KEY_MGMT_NONE); - if (ret < 0) { - netdev_dbg(usbdev->net, "join_ibss: set_auth_mode failed, %d\n", - ret); - goto err_turn_radio_on; - } - - set_priv_filter(usbdev); - - ret = set_encr_mode(usbdev, alg, RNDIS_WLAN_ALG_NONE); - if (ret < 0) { - netdev_dbg(usbdev->net, "join_ibss: set_encr_mode failed, %d\n", - ret); - goto err_turn_radio_on; - } - - if (channel) { - ret = set_channel(usbdev, chan); - if (ret < 0) { - netdev_dbg(usbdev->net, "join_ibss: set_channel failed, %d\n", - ret); - goto err_turn_radio_on; - } - } - - if (params->bssid && !is_zero_ether_addr(params->bssid) && - !is_broadcast_ether_addr(params->bssid)) { - ret = set_bssid(usbdev, params->bssid); - if (ret < 0) { - netdev_dbg(usbdev->net, "join_ibss: set_bssid failed, %d\n", - ret); - goto err_turn_radio_on; - } - } else - clear_bssid(usbdev); - - length = params->ssid_len; - if (length > NDIS_802_11_LENGTH_SSID) - length = NDIS_802_11_LENGTH_SSID; - - memset(&ssid, 0, sizeof(ssid)); - ssid.length = cpu_to_le32(length); - memcpy(ssid.essid, params->ssid, length); - - /* Don't need to pause rx queue for ad-hoc. */ - usbnet_purge_paused_rxq(usbdev); - usbnet_resume_rx(usbdev); - - ret = set_essid(usbdev, &ssid); - if (ret < 0) - netdev_dbg(usbdev->net, "join_ibss: set_essid failed, %d\n", - ret); - return ret; - -err_turn_radio_on: - disassociate(usbdev, true); - - return ret; -} - -static int rndis_leave_ibss(struct wiphy *wiphy, struct net_device *dev) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - - netdev_dbg(usbdev->net, "cfg80211.leave_ibss()\n"); - - priv->connected = false; - memset(priv->bssid, 0, ETH_ALEN); - - return deauthenticate(usbdev); -} - -static int rndis_add_key(struct wiphy *wiphy, struct net_device *netdev, - u8 key_index, bool pairwise, const u8 *mac_addr, - struct key_params *params) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - __le32 flags; - - netdev_dbg(usbdev->net, "%s(%i, %pM, %08x)\n", - __func__, key_index, mac_addr, params->cipher); - - switch (params->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - return add_wep_key(usbdev, params->key, params->key_len, - key_index); - case WLAN_CIPHER_SUITE_TKIP: - case WLAN_CIPHER_SUITE_CCMP: - flags = 0; - - if (params->seq && params->seq_len > 0) - flags |= NDIS_80211_ADDKEY_SET_INIT_RECV_SEQ; - if (mac_addr) - flags |= NDIS_80211_ADDKEY_PAIRWISE_KEY | - NDIS_80211_ADDKEY_TRANSMIT_KEY; - - return add_wpa_key(usbdev, params->key, params->key_len, - key_index, mac_addr, params->seq, - params->seq_len, params->cipher, flags); - default: - netdev_dbg(usbdev->net, "%s(): unsupported cipher %08x\n", - __func__, params->cipher); - return -ENOTSUPP; - } -} - -static int rndis_del_key(struct wiphy *wiphy, struct net_device *netdev, - u8 key_index, bool pairwise, const u8 *mac_addr) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - - netdev_dbg(usbdev->net, "%s(%i, %pM)\n", __func__, key_index, mac_addr); - - return remove_key(usbdev, key_index, mac_addr); -} - -static int rndis_set_default_key(struct wiphy *wiphy, struct net_device *netdev, - u8 key_index, bool unicast, bool multicast) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - struct rndis_wlan_encr_key key; - - netdev_dbg(usbdev->net, "%s(%i)\n", __func__, key_index); - - if (key_index >= RNDIS_WLAN_NUM_KEYS) - return -ENOENT; - - priv->encr_tx_key_index = key_index; - - if (is_wpa_key(priv, key_index)) - return 0; - - key = priv->encr_keys[key_index]; - - return add_wep_key(usbdev, key.material, key.len, key_index); -} - -static void rndis_fill_station_info(struct usbnet *usbdev, - struct station_info *sinfo) -{ - __le32 linkspeed, rssi; - int ret, len; - - memset(sinfo, 0, sizeof(*sinfo)); - - len = sizeof(linkspeed); - ret = rndis_query_oid(usbdev, RNDIS_OID_GEN_LINK_SPEED, &linkspeed, &len); - if (ret == 0) { - sinfo->txrate.legacy = le32_to_cpu(linkspeed) / 1000; - sinfo->filled |= STATION_INFO_TX_BITRATE; - } - - len = sizeof(rssi); - ret = rndis_query_oid(usbdev, RNDIS_OID_802_11_RSSI, - &rssi, &len); - if (ret == 0) { - sinfo->signal = level_to_qual(le32_to_cpu(rssi)); - sinfo->filled |= STATION_INFO_SIGNAL; - } -} - -static int rndis_get_station(struct wiphy *wiphy, struct net_device *dev, - u8 *mac, struct station_info *sinfo) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - - if (!ether_addr_equal(priv->bssid, mac)) - return -ENOENT; - - rndis_fill_station_info(usbdev, sinfo); - - return 0; -} - -static int rndis_dump_station(struct wiphy *wiphy, struct net_device *dev, - int idx, u8 *mac, struct station_info *sinfo) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - - if (idx != 0) - return -ENOENT; - - memcpy(mac, priv->bssid, ETH_ALEN); - - rndis_fill_station_info(usbdev, sinfo); - - return 0; -} - -static int rndis_set_pmksa(struct wiphy *wiphy, struct net_device *netdev, - struct cfg80211_pmksa *pmksa) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - struct ndis_80211_pmkid *pmkids; - u32 *tmp = (u32 *)pmksa->pmkid; - - netdev_dbg(usbdev->net, "%s(%pM, %08X:%08X:%08X:%08X)\n", __func__, - pmksa->bssid, - cpu_to_be32(tmp[0]), cpu_to_be32(tmp[1]), - cpu_to_be32(tmp[2]), cpu_to_be32(tmp[3])); - - pmkids = get_device_pmkids(usbdev); - if (IS_ERR(pmkids)) { - /* couldn't read PMKID cache from device */ - return PTR_ERR(pmkids); - } - - pmkids = update_pmkid(usbdev, pmkids, pmksa, wiphy->max_num_pmkids); - if (IS_ERR(pmkids)) { - /* not found, list full, etc */ - return PTR_ERR(pmkids); - } - - return set_device_pmkids(usbdev, pmkids); -} - -static int rndis_del_pmksa(struct wiphy *wiphy, struct net_device *netdev, - struct cfg80211_pmksa *pmksa) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - struct ndis_80211_pmkid *pmkids; - u32 *tmp = (u32 *)pmksa->pmkid; - - netdev_dbg(usbdev->net, "%s(%pM, %08X:%08X:%08X:%08X)\n", __func__, - pmksa->bssid, - cpu_to_be32(tmp[0]), cpu_to_be32(tmp[1]), - cpu_to_be32(tmp[2]), cpu_to_be32(tmp[3])); - - pmkids = get_device_pmkids(usbdev); - if (IS_ERR(pmkids)) { - /* Couldn't read PMKID cache from device */ - return PTR_ERR(pmkids); - } - - pmkids = remove_pmkid(usbdev, pmkids, pmksa, wiphy->max_num_pmkids); - if (IS_ERR(pmkids)) { - /* not found, etc */ - return PTR_ERR(pmkids); - } - - return set_device_pmkids(usbdev, pmkids); -} - -static int rndis_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - struct ndis_80211_pmkid pmkid; - - netdev_dbg(usbdev->net, "%s()\n", __func__); - - memset(&pmkid, 0, sizeof(pmkid)); - - pmkid.length = cpu_to_le32(sizeof(pmkid)); - pmkid.bssid_info_count = cpu_to_le32(0); - - return rndis_set_oid(usbdev, RNDIS_OID_802_11_PMKID, - &pmkid, sizeof(pmkid)); -} - -static int rndis_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, - bool enabled, int timeout) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - struct usbnet *usbdev = priv->usbdev; - int power_mode; - __le32 mode; - int ret; - - if (priv->device_type != RNDIS_BCM4320B) - return -ENOTSUPP; - - netdev_dbg(usbdev->net, "%s(): %s, %d\n", __func__, - enabled ? "enabled" : "disabled", - timeout); - - if (enabled) - power_mode = NDIS_80211_POWER_MODE_FAST_PSP; - else - power_mode = NDIS_80211_POWER_MODE_CAM; - - if (power_mode == priv->power_mode) - return 0; - - priv->power_mode = power_mode; - - mode = cpu_to_le32(power_mode); - ret = rndis_set_oid(usbdev, RNDIS_OID_802_11_POWER_MODE, - &mode, sizeof(mode)); - - netdev_dbg(usbdev->net, "%s(): RNDIS_OID_802_11_POWER_MODE -> %d\n", - __func__, ret); - - return ret; -} - -static int rndis_set_cqm_rssi_config(struct wiphy *wiphy, - struct net_device *dev, - s32 rssi_thold, u32 rssi_hyst) -{ - struct rndis_wlan_private *priv = wiphy_priv(wiphy); - - priv->cqm_rssi_thold = rssi_thold; - priv->cqm_rssi_hyst = rssi_hyst; - priv->last_cqm_event_rssi = 0; - - return 0; -} - -static void rndis_wlan_craft_connected_bss(struct usbnet *usbdev, u8 *bssid, - struct ndis_80211_assoc_info *info) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - struct ieee80211_channel *channel; - struct ndis_80211_ssid ssid; - struct cfg80211_bss *bss; - s32 signal; - u64 timestamp; - u16 capability; - u32 beacon_period = 0; - __le32 rssi; - u8 ie_buf[34]; - int len, ret, ie_len; - - /* Get signal quality, in case of error use rssi=0 and ignore error. */ - len = sizeof(rssi); - rssi = 0; - ret = rndis_query_oid(usbdev, RNDIS_OID_802_11_RSSI, - &rssi, &len); - signal = level_to_qual(le32_to_cpu(rssi)); - - netdev_dbg(usbdev->net, "%s(): RNDIS_OID_802_11_RSSI -> %d, " - "rssi:%d, qual: %d\n", __func__, ret, le32_to_cpu(rssi), - level_to_qual(le32_to_cpu(rssi))); - - /* Get AP capabilities */ - if (info) { - capability = le16_to_cpu(info->resp_ie.capa); - } else { - /* Set atleast ESS/IBSS capability */ - capability = (priv->infra_mode == NDIS_80211_INFRA_INFRA) ? - WLAN_CAPABILITY_ESS : WLAN_CAPABILITY_IBSS; - } - - /* Get channel and beacon interval */ - channel = get_current_channel(usbdev, &beacon_period); - if (!channel) { - netdev_warn(usbdev->net, "%s(): could not get channel.\n", - __func__); - return; - } - - /* Get SSID, in case of error, use zero length SSID and ignore error. */ - len = sizeof(ssid); - memset(&ssid, 0, sizeof(ssid)); - ret = rndis_query_oid(usbdev, RNDIS_OID_802_11_SSID, - &ssid, &len); - netdev_dbg(usbdev->net, "%s(): RNDIS_OID_802_11_SSID -> %d, len: %d, ssid: " - "'%.32s'\n", __func__, ret, - le32_to_cpu(ssid.length), ssid.essid); - - if (le32_to_cpu(ssid.length) > 32) - ssid.length = cpu_to_le32(32); - - ie_buf[0] = WLAN_EID_SSID; - ie_buf[1] = le32_to_cpu(ssid.length); - memcpy(&ie_buf[2], ssid.essid, le32_to_cpu(ssid.length)); - - ie_len = le32_to_cpu(ssid.length) + 2; - - /* no tsf */ - timestamp = 0; - - netdev_dbg(usbdev->net, "%s(): channel:%d(freq), bssid:[%pM], tsf:%d, " - "capa:%x, beacon int:%d, resp_ie(len:%d, essid:'%.32s'), " - "signal:%d\n", __func__, (channel ? channel->center_freq : -1), - bssid, (u32)timestamp, capability, beacon_period, ie_len, - ssid.essid, signal); - - bss = cfg80211_inform_bss(priv->wdev.wiphy, channel, bssid, - timestamp, capability, beacon_period, ie_buf, ie_len, - signal, GFP_KERNEL); - cfg80211_put_bss(priv->wdev.wiphy, bss); -} - -/* - * workers, indication handlers, device poller - */ -static void rndis_wlan_do_link_up_work(struct usbnet *usbdev) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - struct ndis_80211_assoc_info *info = NULL; - u8 bssid[ETH_ALEN]; - unsigned int resp_ie_len, req_ie_len; - unsigned int offset; - u8 *req_ie, *resp_ie; - int ret; - bool roamed = false; - bool match_bss; - - if (priv->infra_mode == NDIS_80211_INFRA_INFRA && priv->connected) { - /* received media connect indication while connected, either - * device reassociated with same AP or roamed to new. */ - roamed = true; - } - - req_ie_len = 0; - resp_ie_len = 0; - req_ie = NULL; - resp_ie = NULL; - - if (priv->infra_mode == NDIS_80211_INFRA_INFRA) { - info = kzalloc(CONTROL_BUFFER_SIZE, GFP_KERNEL); - if (!info) { - /* No memory? Try resume work later */ - set_bit(WORK_LINK_UP, &priv->work_pending); - queue_work(priv->workqueue, &priv->work); - return; - } - - /* Get association info IEs from device. */ - ret = get_association_info(usbdev, info, CONTROL_BUFFER_SIZE); - if (!ret) { - req_ie_len = le32_to_cpu(info->req_ie_length); - if (req_ie_len > CONTROL_BUFFER_SIZE) - req_ie_len = CONTROL_BUFFER_SIZE; - if (req_ie_len != 0) { - offset = le32_to_cpu(info->offset_req_ies); - - if (offset > CONTROL_BUFFER_SIZE) - offset = CONTROL_BUFFER_SIZE; - - req_ie = (u8 *)info + offset; - - if (offset + req_ie_len > CONTROL_BUFFER_SIZE) - req_ie_len = - CONTROL_BUFFER_SIZE - offset; - } - - resp_ie_len = le32_to_cpu(info->resp_ie_length); - if (resp_ie_len > CONTROL_BUFFER_SIZE) - resp_ie_len = CONTROL_BUFFER_SIZE; - if (resp_ie_len != 0) { - offset = le32_to_cpu(info->offset_resp_ies); - - if (offset > CONTROL_BUFFER_SIZE) - offset = CONTROL_BUFFER_SIZE; - - resp_ie = (u8 *)info + offset; - - if (offset + resp_ie_len > CONTROL_BUFFER_SIZE) - resp_ie_len = - CONTROL_BUFFER_SIZE - offset; - } - } else { - /* Since rndis_wlan_craft_connected_bss() might use info - * later and expects info to contain valid data if - * non-null, free info and set NULL here. - */ - kfree(info); - info = NULL; - } - } else if (WARN_ON(priv->infra_mode != NDIS_80211_INFRA_ADHOC)) - return; - - ret = get_bssid(usbdev, bssid); - if (ret < 0) - memset(bssid, 0, sizeof(bssid)); - - netdev_dbg(usbdev->net, "link up work: [%pM]%s\n", - bssid, roamed ? " roamed" : ""); - - /* Internal bss list in device should contain at least the currently - * connected bss and we can get it to cfg80211 with - * rndis_check_bssid_list(). - * - * NDIS spec says: "If the device is associated, but the associated - * BSSID is not in its BSSID scan list, then the driver must add an - * entry for the BSSID at the end of the data that it returns in - * response to query of RNDIS_OID_802_11_BSSID_LIST." - * - * NOTE: Seems to be true for BCM4320b variant, but not BCM4320a. - */ - match_bss = false; - rndis_check_bssid_list(usbdev, bssid, &match_bss); - - if (!is_zero_ether_addr(bssid) && !match_bss) { - /* Couldn't get bss from device, we need to manually craft bss - * for cfg80211. - */ - rndis_wlan_craft_connected_bss(usbdev, bssid, info); - } - - if (priv->infra_mode == NDIS_80211_INFRA_INFRA) { - if (!roamed) - cfg80211_connect_result(usbdev->net, bssid, req_ie, - req_ie_len, resp_ie, - resp_ie_len, 0, GFP_KERNEL); - else - cfg80211_roamed(usbdev->net, - get_current_channel(usbdev, NULL), - bssid, req_ie, req_ie_len, - resp_ie, resp_ie_len, GFP_KERNEL); - } else if (priv->infra_mode == NDIS_80211_INFRA_ADHOC) - cfg80211_ibss_joined(usbdev->net, bssid, GFP_KERNEL); - - kfree(info); - - priv->connected = true; - memcpy(priv->bssid, bssid, ETH_ALEN); - - usbnet_resume_rx(usbdev); - netif_carrier_on(usbdev->net); -} - -static void rndis_wlan_do_link_down_work(struct usbnet *usbdev) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - - if (priv->connected) { - priv->connected = false; - memset(priv->bssid, 0, ETH_ALEN); - - deauthenticate(usbdev); - - cfg80211_disconnected(usbdev->net, 0, NULL, 0, GFP_KERNEL); - } - - netif_carrier_off(usbdev->net); -} - -static void rndis_wlan_worker(struct work_struct *work) -{ - struct rndis_wlan_private *priv = - container_of(work, struct rndis_wlan_private, work); - struct usbnet *usbdev = priv->usbdev; - - if (test_and_clear_bit(WORK_LINK_UP, &priv->work_pending)) - rndis_wlan_do_link_up_work(usbdev); - - if (test_and_clear_bit(WORK_LINK_DOWN, &priv->work_pending)) - rndis_wlan_do_link_down_work(usbdev); - - if (test_and_clear_bit(WORK_SET_MULTICAST_LIST, &priv->work_pending)) - set_multicast_list(usbdev); -} - -static void rndis_wlan_set_multicast_list(struct net_device *dev) -{ - struct usbnet *usbdev = netdev_priv(dev); - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - - if (test_bit(WORK_SET_MULTICAST_LIST, &priv->work_pending)) - return; - - set_bit(WORK_SET_MULTICAST_LIST, &priv->work_pending); - queue_work(priv->workqueue, &priv->work); -} - -static void rndis_wlan_auth_indication(struct usbnet *usbdev, - struct ndis_80211_status_indication *indication, - int len) -{ - u8 *buf; - const char *type; - int flags, buflen, key_id; - bool pairwise_error, group_error; - struct ndis_80211_auth_request *auth_req; - enum nl80211_key_type key_type; - - /* must have at least one array entry */ - if (len < offsetof(struct ndis_80211_status_indication, u) + - sizeof(struct ndis_80211_auth_request)) { - netdev_info(usbdev->net, "authentication indication: too short message (%i)\n", - len); - return; - } - - buf = (void *)&indication->u.auth_request[0]; - buflen = len - offsetof(struct ndis_80211_status_indication, u); - - while (buflen >= sizeof(*auth_req)) { - auth_req = (void *)buf; - type = "unknown"; - flags = le32_to_cpu(auth_req->flags); - pairwise_error = false; - group_error = false; - - if (flags & 0x1) - type = "reauth request"; - if (flags & 0x2) - type = "key update request"; - if (flags & 0x6) { - pairwise_error = true; - type = "pairwise_error"; - } - if (flags & 0xe) { - group_error = true; - type = "group_error"; - } - - netdev_info(usbdev->net, "authentication indication: %s (0x%08x)\n", - type, le32_to_cpu(auth_req->flags)); - - if (pairwise_error) { - key_type = NL80211_KEYTYPE_PAIRWISE; - key_id = -1; - - cfg80211_michael_mic_failure(usbdev->net, - auth_req->bssid, - key_type, key_id, NULL, - GFP_KERNEL); - } - - if (group_error) { - key_type = NL80211_KEYTYPE_GROUP; - key_id = -1; - - cfg80211_michael_mic_failure(usbdev->net, - auth_req->bssid, - key_type, key_id, NULL, - GFP_KERNEL); - } - - buflen -= le32_to_cpu(auth_req->length); - buf += le32_to_cpu(auth_req->length); - } -} - -static void rndis_wlan_pmkid_cand_list_indication(struct usbnet *usbdev, - struct ndis_80211_status_indication *indication, - int len) -{ - struct ndis_80211_pmkid_cand_list *cand_list; - int list_len, expected_len, i; - - if (len < offsetof(struct ndis_80211_status_indication, u) + - sizeof(struct ndis_80211_pmkid_cand_list)) { - netdev_info(usbdev->net, "pmkid candidate list indication: too short message (%i)\n", - len); - return; - } - - list_len = le32_to_cpu(indication->u.cand_list.num_candidates) * - sizeof(struct ndis_80211_pmkid_candidate); - expected_len = sizeof(struct ndis_80211_pmkid_cand_list) + list_len + - offsetof(struct ndis_80211_status_indication, u); - - if (len < expected_len) { - netdev_info(usbdev->net, "pmkid candidate list indication: list larger than buffer (%i < %i)\n", - len, expected_len); - return; - } - - cand_list = &indication->u.cand_list; - - netdev_info(usbdev->net, "pmkid candidate list indication: version %i, candidates %i\n", - le32_to_cpu(cand_list->version), - le32_to_cpu(cand_list->num_candidates)); - - if (le32_to_cpu(cand_list->version) != 1) - return; - - for (i = 0; i < le32_to_cpu(cand_list->num_candidates); i++) { - struct ndis_80211_pmkid_candidate *cand = - &cand_list->candidate_list[i]; - bool preauth = !!(cand->flags & NDIS_80211_PMKID_CAND_PREAUTH); - - netdev_dbg(usbdev->net, "cand[%i]: flags: 0x%08x, preauth: %d, bssid: %pM\n", - i, le32_to_cpu(cand->flags), preauth, cand->bssid); - - cfg80211_pmksa_candidate_notify(usbdev->net, i, cand->bssid, - preauth, GFP_ATOMIC); - } -} - -static void rndis_wlan_media_specific_indication(struct usbnet *usbdev, - struct rndis_indicate *msg, int buflen) -{ - struct ndis_80211_status_indication *indication; - unsigned int len, offset; - - offset = offsetof(struct rndis_indicate, status) + - le32_to_cpu(msg->offset); - len = le32_to_cpu(msg->length); - - if (len < 8) { - netdev_info(usbdev->net, "media specific indication, ignore too short message (%i < 8)\n", - len); - return; - } - - if (len > buflen || offset > buflen || offset + len > buflen) { - netdev_info(usbdev->net, "media specific indication, too large to fit to buffer (%i > %i)\n", - offset + len, buflen); - return; - } - - indication = (void *)((u8 *)msg + offset); - - switch (le32_to_cpu(indication->status_type)) { - case NDIS_80211_STATUSTYPE_RADIOSTATE: - netdev_info(usbdev->net, "radio state indication: %i\n", - le32_to_cpu(indication->u.radio_status)); - return; - - case NDIS_80211_STATUSTYPE_MEDIASTREAMMODE: - netdev_info(usbdev->net, "media stream mode indication: %i\n", - le32_to_cpu(indication->u.media_stream_mode)); - return; - - case NDIS_80211_STATUSTYPE_AUTHENTICATION: - rndis_wlan_auth_indication(usbdev, indication, len); - return; - - case NDIS_80211_STATUSTYPE_PMKID_CANDIDATELIST: - rndis_wlan_pmkid_cand_list_indication(usbdev, indication, len); - return; - - default: - netdev_info(usbdev->net, "media specific indication: unknown status type 0x%08x\n", - le32_to_cpu(indication->status_type)); - } -} - -static void rndis_wlan_indication(struct usbnet *usbdev, void *ind, int buflen) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - struct rndis_indicate *msg = ind; - - switch (le32_to_cpu(msg->status)) { - case RNDIS_STATUS_MEDIA_CONNECT: - if (priv->current_command_oid == RNDIS_OID_802_11_ADD_KEY) { - /* RNDIS_OID_802_11_ADD_KEY causes sometimes extra - * "media connect" indications which confuses driver - * and userspace to think that device is - * roaming/reassociating when it isn't. - */ - netdev_dbg(usbdev->net, "ignored RNDIS_OID_802_11_ADD_KEY triggered 'media connect'\n"); - return; - } - - usbnet_pause_rx(usbdev); - - netdev_info(usbdev->net, "media connect\n"); - - /* queue work to avoid recursive calls into rndis_command */ - set_bit(WORK_LINK_UP, &priv->work_pending); - queue_work(priv->workqueue, &priv->work); - break; - - case RNDIS_STATUS_MEDIA_DISCONNECT: - netdev_info(usbdev->net, "media disconnect\n"); - - /* queue work to avoid recursive calls into rndis_command */ - set_bit(WORK_LINK_DOWN, &priv->work_pending); - queue_work(priv->workqueue, &priv->work); - break; - - case RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION: - rndis_wlan_media_specific_indication(usbdev, msg, buflen); - break; - - default: - netdev_info(usbdev->net, "indication: 0x%08x\n", - le32_to_cpu(msg->status)); - break; - } -} - -static int rndis_wlan_get_caps(struct usbnet *usbdev, struct wiphy *wiphy) -{ - struct { - __le32 num_items; - __le32 items[8]; - } networks_supported; - struct ndis_80211_capability *caps; - u8 caps_buf[sizeof(*caps) + sizeof(caps->auth_encr_pair) * 16]; - int len, retval, i, n; - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - - /* determine supported modes */ - len = sizeof(networks_supported); - retval = rndis_query_oid(usbdev, - RNDIS_OID_802_11_NETWORK_TYPES_SUPPORTED, - &networks_supported, &len); - if (retval >= 0) { - n = le32_to_cpu(networks_supported.num_items); - if (n > 8) - n = 8; - for (i = 0; i < n; i++) { - switch (le32_to_cpu(networks_supported.items[i])) { - case NDIS_80211_TYPE_FREQ_HOP: - case NDIS_80211_TYPE_DIRECT_SEQ: - priv->caps |= CAP_MODE_80211B; - break; - case NDIS_80211_TYPE_OFDM_A: - priv->caps |= CAP_MODE_80211A; - break; - case NDIS_80211_TYPE_OFDM_G: - priv->caps |= CAP_MODE_80211G; - break; - } - } - } - - /* get device 802.11 capabilities, number of PMKIDs */ - caps = (struct ndis_80211_capability *)caps_buf; - len = sizeof(caps_buf); - retval = rndis_query_oid(usbdev, - RNDIS_OID_802_11_CAPABILITY, - caps, &len); - if (retval >= 0) { - netdev_dbg(usbdev->net, "RNDIS_OID_802_11_CAPABILITY -> len %d, " - "ver %d, pmkids %d, auth-encr-pairs %d\n", - le32_to_cpu(caps->length), - le32_to_cpu(caps->version), - le32_to_cpu(caps->num_pmkids), - le32_to_cpu(caps->num_auth_encr_pair)); - wiphy->max_num_pmkids = le32_to_cpu(caps->num_pmkids); - } else - wiphy->max_num_pmkids = 0; - - return retval; -} - -static void rndis_do_cqm(struct usbnet *usbdev, s32 rssi) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - enum nl80211_cqm_rssi_threshold_event event; - int thold, hyst, last_event; - - if (priv->cqm_rssi_thold >= 0 || rssi >= 0) - return; - if (priv->infra_mode != NDIS_80211_INFRA_INFRA) - return; - - last_event = priv->last_cqm_event_rssi; - thold = priv->cqm_rssi_thold; - hyst = priv->cqm_rssi_hyst; - - if (rssi < thold && (last_event == 0 || rssi < last_event - hyst)) - event = NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW; - else if (rssi > thold && (last_event == 0 || rssi > last_event + hyst)) - event = NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH; - else - return; - - priv->last_cqm_event_rssi = rssi; - cfg80211_cqm_rssi_notify(usbdev->net, event, GFP_KERNEL); -} - -#define DEVICE_POLLER_JIFFIES (HZ) -static void rndis_device_poller(struct work_struct *work) -{ - struct rndis_wlan_private *priv = - container_of(work, struct rndis_wlan_private, - dev_poller_work.work); - struct usbnet *usbdev = priv->usbdev; - __le32 rssi, tmp; - int len, ret, j; - int update_jiffies = DEVICE_POLLER_JIFFIES; - void *buf; - - /* Only check/do workaround when connected. Calling is_associated() - * also polls device with rndis_command() and catches for media link - * indications. - */ - if (!is_associated(usbdev)) { - /* Workaround bad scanning in BCM4320a devices with active - * background scanning when not associated. - */ - if (priv->device_type == RNDIS_BCM4320A && priv->radio_on && - !priv->scan_request) { - /* Get previous scan results */ - rndis_check_bssid_list(usbdev, NULL, NULL); - - /* Initiate new scan */ - rndis_start_bssid_list_scan(usbdev); - } - - goto end; - } - - len = sizeof(rssi); - ret = rndis_query_oid(usbdev, RNDIS_OID_802_11_RSSI, - &rssi, &len); - if (ret == 0) { - priv->last_qual = level_to_qual(le32_to_cpu(rssi)); - rndis_do_cqm(usbdev, le32_to_cpu(rssi)); - } - - netdev_dbg(usbdev->net, "dev-poller: RNDIS_OID_802_11_RSSI -> %d, rssi:%d, qual: %d\n", - ret, le32_to_cpu(rssi), level_to_qual(le32_to_cpu(rssi))); - - /* Workaround transfer stalls on poor quality links. - * TODO: find right way to fix these stalls (as stalls do not happen - * with ndiswrapper/windows driver). */ - if (priv->param_workaround_interval > 0 && priv->last_qual <= 25) { - /* Decrease stats worker interval to catch stalls. - * faster. Faster than 400-500ms causes packet loss, - * Slower doesn't catch stalls fast enough. - */ - j = msecs_to_jiffies(priv->param_workaround_interval); - if (j > DEVICE_POLLER_JIFFIES) - j = DEVICE_POLLER_JIFFIES; - else if (j <= 0) - j = 1; - update_jiffies = j; - - /* Send scan OID. Use of both OIDs is required to get device - * working. - */ - tmp = cpu_to_le32(1); - rndis_set_oid(usbdev, - RNDIS_OID_802_11_BSSID_LIST_SCAN, - &tmp, sizeof(tmp)); - - len = CONTROL_BUFFER_SIZE; - buf = kmalloc(len, GFP_KERNEL); - if (!buf) - goto end; - - rndis_query_oid(usbdev, - RNDIS_OID_802_11_BSSID_LIST, - buf, &len); - kfree(buf); - } - -end: - if (update_jiffies >= HZ) - update_jiffies = round_jiffies_relative(update_jiffies); - else { - j = round_jiffies_relative(update_jiffies); - if (abs(j - update_jiffies) <= 10) - update_jiffies = j; - } - - queue_delayed_work(priv->workqueue, &priv->dev_poller_work, - update_jiffies); -} - -/* - * driver/device initialization - */ -static void rndis_copy_module_params(struct usbnet *usbdev, int device_type) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - - priv->device_type = device_type; - - priv->param_country[0] = modparam_country[0]; - priv->param_country[1] = modparam_country[1]; - priv->param_country[2] = 0; - priv->param_frameburst = modparam_frameburst; - priv->param_afterburner = modparam_afterburner; - priv->param_power_save = modparam_power_save; - priv->param_power_output = modparam_power_output; - priv->param_roamtrigger = modparam_roamtrigger; - priv->param_roamdelta = modparam_roamdelta; - - priv->param_country[0] = toupper(priv->param_country[0]); - priv->param_country[1] = toupper(priv->param_country[1]); - /* doesn't support EU as country code, use FI instead */ - if (!strcmp(priv->param_country, "EU")) - strcpy(priv->param_country, "FI"); - - if (priv->param_power_save < 0) - priv->param_power_save = 0; - else if (priv->param_power_save > 2) - priv->param_power_save = 2; - - if (priv->param_power_output < 0) - priv->param_power_output = 0; - else if (priv->param_power_output > 3) - priv->param_power_output = 3; - - if (priv->param_roamtrigger < -80) - priv->param_roamtrigger = -80; - else if (priv->param_roamtrigger > -60) - priv->param_roamtrigger = -60; - - if (priv->param_roamdelta < 0) - priv->param_roamdelta = 0; - else if (priv->param_roamdelta > 2) - priv->param_roamdelta = 2; - - if (modparam_workaround_interval < 0) - priv->param_workaround_interval = 500; - else - priv->param_workaround_interval = modparam_workaround_interval; -} - -static int unknown_early_init(struct usbnet *usbdev) -{ - /* copy module parameters for unknown so that iwconfig reports txpower - * and workaround parameter is copied to private structure correctly. - */ - rndis_copy_module_params(usbdev, RNDIS_UNKNOWN); - - /* This is unknown device, so do not try set configuration parameters. - */ - - return 0; -} - -static int bcm4320a_early_init(struct usbnet *usbdev) -{ - /* copy module parameters for bcm4320a so that iwconfig reports txpower - * and workaround parameter is copied to private structure correctly. - */ - rndis_copy_module_params(usbdev, RNDIS_BCM4320A); - - /* bcm4320a doesn't handle configuration parameters well. Try - * set any and you get partially zeroed mac and broken device. - */ - - return 0; -} - -static int bcm4320b_early_init(struct usbnet *usbdev) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - char buf[8]; - - rndis_copy_module_params(usbdev, RNDIS_BCM4320B); - - /* Early initialization settings, setting these won't have effect - * if called after generic_rndis_bind(). - */ - - rndis_set_config_parameter_str(usbdev, "Country", priv->param_country); - rndis_set_config_parameter_str(usbdev, "FrameBursting", - priv->param_frameburst ? "1" : "0"); - rndis_set_config_parameter_str(usbdev, "Afterburner", - priv->param_afterburner ? "1" : "0"); - sprintf(buf, "%d", priv->param_power_save); - rndis_set_config_parameter_str(usbdev, "PowerSaveMode", buf); - sprintf(buf, "%d", priv->param_power_output); - rndis_set_config_parameter_str(usbdev, "PwrOut", buf); - sprintf(buf, "%d", priv->param_roamtrigger); - rndis_set_config_parameter_str(usbdev, "RoamTrigger", buf); - sprintf(buf, "%d", priv->param_roamdelta); - rndis_set_config_parameter_str(usbdev, "RoamDelta", buf); - - return 0; -} - -/* same as rndis_netdev_ops but with local multicast handler */ -static const struct net_device_ops rndis_wlan_netdev_ops = { - .ndo_open = usbnet_open, - .ndo_stop = usbnet_stop, - .ndo_start_xmit = usbnet_start_xmit, - .ndo_tx_timeout = usbnet_tx_timeout, - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, - .ndo_set_rx_mode = rndis_wlan_set_multicast_list, -}; - -static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf) -{ - struct wiphy *wiphy; - struct rndis_wlan_private *priv; - int retval, len; - __le32 tmp; - - /* allocate wiphy and rndis private data - * NOTE: We only support a single virtual interface, so wiphy - * and wireless_dev are somewhat synonymous for this device. - */ - wiphy = wiphy_new(&rndis_config_ops, sizeof(struct rndis_wlan_private)); - if (!wiphy) - return -ENOMEM; - - priv = wiphy_priv(wiphy); - usbdev->net->ieee80211_ptr = &priv->wdev; - priv->wdev.wiphy = wiphy; - priv->wdev.iftype = NL80211_IFTYPE_STATION; - - /* These have to be initialized before calling generic_rndis_bind(). - * Otherwise we'll be in big trouble in rndis_wlan_early_init(). - */ - usbdev->driver_priv = priv; - priv->usbdev = usbdev; - - mutex_init(&priv->command_lock); - - /* because rndis_command() sleeps we need to use workqueue */ - priv->workqueue = create_singlethread_workqueue("rndis_wlan"); - INIT_WORK(&priv->work, rndis_wlan_worker); - INIT_DELAYED_WORK(&priv->dev_poller_work, rndis_device_poller); - INIT_DELAYED_WORK(&priv->scan_work, rndis_get_scan_results); - - /* try bind rndis_host */ - retval = generic_rndis_bind(usbdev, intf, FLAG_RNDIS_PHYM_WIRELESS); - if (retval < 0) - goto fail; - - /* generic_rndis_bind set packet filter to multicast_all+ - * promisc mode which doesn't work well for our devices (device - * picks up rssi to closest station instead of to access point). - * - * rndis_host wants to avoid all OID as much as possible - * so do promisc/multicast handling in rndis_wlan. - */ - usbdev->net->netdev_ops = &rndis_wlan_netdev_ops; - - tmp = cpu_to_le32(RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST); - retval = rndis_set_oid(usbdev, - RNDIS_OID_GEN_CURRENT_PACKET_FILTER, - &tmp, sizeof(tmp)); - - len = sizeof(tmp); - retval = rndis_query_oid(usbdev, - RNDIS_OID_802_3_MAXIMUM_LIST_SIZE, - &tmp, &len); - priv->multicast_size = le32_to_cpu(tmp); - if (retval < 0 || priv->multicast_size < 0) - priv->multicast_size = 0; - if (priv->multicast_size > 0) - usbdev->net->flags |= IFF_MULTICAST; - else - usbdev->net->flags &= ~IFF_MULTICAST; - - /* fill-out wiphy structure and register w/ cfg80211 */ - memcpy(wiphy->perm_addr, usbdev->net->dev_addr, ETH_ALEN); - wiphy->privid = rndis_wiphy_privid; - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) - | BIT(NL80211_IFTYPE_ADHOC); - wiphy->max_scan_ssids = 1; - - /* TODO: fill-out band/encr information based on priv->caps */ - rndis_wlan_get_caps(usbdev, wiphy); - - memcpy(priv->channels, rndis_channels, sizeof(rndis_channels)); - memcpy(priv->rates, rndis_rates, sizeof(rndis_rates)); - priv->band.channels = priv->channels; - priv->band.n_channels = ARRAY_SIZE(rndis_channels); - priv->band.bitrates = priv->rates; - priv->band.n_bitrates = ARRAY_SIZE(rndis_rates); - wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band; - wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC; - - memcpy(priv->cipher_suites, rndis_cipher_suites, - sizeof(rndis_cipher_suites)); - wiphy->cipher_suites = priv->cipher_suites; - wiphy->n_cipher_suites = ARRAY_SIZE(rndis_cipher_suites); - - set_wiphy_dev(wiphy, &usbdev->udev->dev); - - if (wiphy_register(wiphy)) { - retval = -ENODEV; - goto fail; - } - - set_default_iw_params(usbdev); - - priv->power_mode = -1; - - /* set default rts/frag */ - rndis_set_wiphy_params(wiphy, - WIPHY_PARAM_FRAG_THRESHOLD | WIPHY_PARAM_RTS_THRESHOLD); - - /* turn radio off on init */ - priv->radio_on = false; - disassociate(usbdev, false); - netif_carrier_off(usbdev->net); - - return 0; - -fail: - cancel_delayed_work_sync(&priv->dev_poller_work); - cancel_delayed_work_sync(&priv->scan_work); - cancel_work_sync(&priv->work); - flush_workqueue(priv->workqueue); - destroy_workqueue(priv->workqueue); - - wiphy_free(wiphy); - return retval; -} - -static void rndis_wlan_unbind(struct usbnet *usbdev, struct usb_interface *intf) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - - /* turn radio off */ - disassociate(usbdev, false); - - cancel_delayed_work_sync(&priv->dev_poller_work); - cancel_delayed_work_sync(&priv->scan_work); - cancel_work_sync(&priv->work); - flush_workqueue(priv->workqueue); - destroy_workqueue(priv->workqueue); - - rndis_unbind(usbdev, intf); - - wiphy_unregister(priv->wdev.wiphy); - wiphy_free(priv->wdev.wiphy); -} - -static int rndis_wlan_reset(struct usbnet *usbdev) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - int retval; - - netdev_dbg(usbdev->net, "%s()\n", __func__); - - retval = rndis_reset(usbdev); - if (retval) - netdev_warn(usbdev->net, "rndis_reset failed: %d\n", retval); - - /* rndis_reset cleared multicast list, so restore here. - (set_multicast_list() also turns on current packet filter) */ - set_multicast_list(usbdev); - - queue_delayed_work(priv->workqueue, &priv->dev_poller_work, - round_jiffies_relative(DEVICE_POLLER_JIFFIES)); - - return deauthenticate(usbdev); -} - -static int rndis_wlan_stop(struct usbnet *usbdev) -{ - struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); - int retval; - __le32 filter; - - netdev_dbg(usbdev->net, "%s()\n", __func__); - - retval = disassociate(usbdev, false); - - priv->work_pending = 0; - cancel_delayed_work_sync(&priv->dev_poller_work); - cancel_delayed_work_sync(&priv->scan_work); - cancel_work_sync(&priv->work); - flush_workqueue(priv->workqueue); - - if (priv->scan_request) { - cfg80211_scan_done(priv->scan_request, true); - priv->scan_request = NULL; - } - - /* Set current packet filter zero to block receiving data packets from - device. */ - filter = 0; - rndis_set_oid(usbdev, RNDIS_OID_GEN_CURRENT_PACKET_FILTER, &filter, - sizeof(filter)); - - return retval; -} - -static const struct driver_info bcm4320b_info = { - .description = "Wireless RNDIS device, BCM4320b based", - .flags = FLAG_WLAN | FLAG_FRAMING_RN | FLAG_NO_SETINT | - FLAG_AVOID_UNLINK_URBS, - .bind = rndis_wlan_bind, - .unbind = rndis_wlan_unbind, - .status = rndis_status, - .rx_fixup = rndis_rx_fixup, - .tx_fixup = rndis_tx_fixup, - .reset = rndis_wlan_reset, - .stop = rndis_wlan_stop, - .early_init = bcm4320b_early_init, - .indication = rndis_wlan_indication, -}; - -static const struct driver_info bcm4320a_info = { - .description = "Wireless RNDIS device, BCM4320a based", - .flags = FLAG_WLAN | FLAG_FRAMING_RN | FLAG_NO_SETINT | - FLAG_AVOID_UNLINK_URBS, - .bind = rndis_wlan_bind, - .unbind = rndis_wlan_unbind, - .status = rndis_status, - .rx_fixup = rndis_rx_fixup, - .tx_fixup = rndis_tx_fixup, - .reset = rndis_wlan_reset, - .stop = rndis_wlan_stop, - .early_init = bcm4320a_early_init, - .indication = rndis_wlan_indication, -}; - -static const struct driver_info rndis_wlan_info = { - .description = "Wireless RNDIS device", - .flags = FLAG_WLAN | FLAG_FRAMING_RN | FLAG_NO_SETINT | - FLAG_AVOID_UNLINK_URBS, - .bind = rndis_wlan_bind, - .unbind = rndis_wlan_unbind, - .status = rndis_status, - .rx_fixup = rndis_rx_fixup, - .tx_fixup = rndis_tx_fixup, - .reset = rndis_wlan_reset, - .stop = rndis_wlan_stop, - .early_init = unknown_early_init, - .indication = rndis_wlan_indication, -}; - -/*-------------------------------------------------------------------------*/ - -static const struct usb_device_id products [] = { -#define RNDIS_MASTER_INTERFACE \ - .bInterfaceClass = USB_CLASS_COMM, \ - .bInterfaceSubClass = 2 /* ACM */, \ - .bInterfaceProtocol = 0x0ff - -/* INF driver for these devices have DriverVer >= 4.xx.xx.xx and many custom - * parameters available. Chipset marked as 'BCM4320SKFBG' in NDISwrapper-wiki. - */ -{ - .match_flags = USB_DEVICE_ID_MATCH_INT_INFO - | USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = 0x0411, - .idProduct = 0x00bc, /* Buffalo WLI-U2-KG125S */ - RNDIS_MASTER_INTERFACE, - .driver_info = (unsigned long) &bcm4320b_info, -}, { - .match_flags = USB_DEVICE_ID_MATCH_INT_INFO - | USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = 0x0baf, - .idProduct = 0x011b, /* U.S. Robotics USR5421 */ - RNDIS_MASTER_INTERFACE, - .driver_info = (unsigned long) &bcm4320b_info, -}, { - .match_flags = USB_DEVICE_ID_MATCH_INT_INFO - | USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = 0x050d, - .idProduct = 0x011b, /* Belkin F5D7051 */ - RNDIS_MASTER_INTERFACE, - .driver_info = (unsigned long) &bcm4320b_info, -}, { - .match_flags = USB_DEVICE_ID_MATCH_INT_INFO - | USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = 0x1799, /* Belkin has two vendor ids */ - .idProduct = 0x011b, /* Belkin F5D7051 */ - RNDIS_MASTER_INTERFACE, - .driver_info = (unsigned long) &bcm4320b_info, -}, { - .match_flags = USB_DEVICE_ID_MATCH_INT_INFO - | USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = 0x13b1, - .idProduct = 0x0014, /* Linksys WUSB54GSv2 */ - RNDIS_MASTER_INTERFACE, - .driver_info = (unsigned long) &bcm4320b_info, -}, { - .match_flags = USB_DEVICE_ID_MATCH_INT_INFO - | USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = 0x13b1, - .idProduct = 0x0026, /* Linksys WUSB54GSC */ - RNDIS_MASTER_INTERFACE, - .driver_info = (unsigned long) &bcm4320b_info, -}, { - .match_flags = USB_DEVICE_ID_MATCH_INT_INFO - | USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = 0x0b05, - .idProduct = 0x1717, /* Asus WL169gE */ - RNDIS_MASTER_INTERFACE, - .driver_info = (unsigned long) &bcm4320b_info, -}, { - .match_flags = USB_DEVICE_ID_MATCH_INT_INFO - | USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = 0x0a5c, - .idProduct = 0xd11b, /* Eminent EM4045 */ - RNDIS_MASTER_INTERFACE, - .driver_info = (unsigned long) &bcm4320b_info, -}, { - .match_flags = USB_DEVICE_ID_MATCH_INT_INFO - | USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = 0x1690, - .idProduct = 0x0715, /* BT Voyager 1055 */ - RNDIS_MASTER_INTERFACE, - .driver_info = (unsigned long) &bcm4320b_info, -}, -/* These devices have DriverVer < 4.xx.xx.xx and do not have any custom - * parameters available, hardware probably contain older firmware version with - * no way of updating. Chipset marked as 'BCM4320????' in NDISwrapper-wiki. - */ -{ - .match_flags = USB_DEVICE_ID_MATCH_INT_INFO - | USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = 0x13b1, - .idProduct = 0x000e, /* Linksys WUSB54GSv1 */ - RNDIS_MASTER_INTERFACE, - .driver_info = (unsigned long) &bcm4320a_info, -}, { - .match_flags = USB_DEVICE_ID_MATCH_INT_INFO - | USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = 0x0baf, - .idProduct = 0x0111, /* U.S. Robotics USR5420 */ - RNDIS_MASTER_INTERFACE, - .driver_info = (unsigned long) &bcm4320a_info, -}, { - .match_flags = USB_DEVICE_ID_MATCH_INT_INFO - | USB_DEVICE_ID_MATCH_DEVICE, - .idVendor = 0x0411, - .idProduct = 0x004b, /* BUFFALO WLI-USB-G54 */ - RNDIS_MASTER_INTERFACE, - .driver_info = (unsigned long) &bcm4320a_info, -}, -/* Generic Wireless RNDIS devices that we don't have exact - * idVendor/idProduct/chip yet. - */ -{ - /* RNDIS is MSFT's un-official variant of CDC ACM */ - USB_INTERFACE_INFO(USB_CLASS_COMM, 2 /* ACM */, 0x0ff), - .driver_info = (unsigned long) &rndis_wlan_info, -}, { - /* "ActiveSync" is an undocumented variant of RNDIS, used in WM5 */ - USB_INTERFACE_INFO(USB_CLASS_MISC, 1, 1), - .driver_info = (unsigned long) &rndis_wlan_info, -}, - { }, // END -}; -MODULE_DEVICE_TABLE(usb, products); - -static struct usb_driver rndis_wlan_driver = { - .name = "rndis_wlan", - .id_table = products, - .probe = usbnet_probe, - .disconnect = usbnet_disconnect, - .suspend = usbnet_suspend, - .resume = usbnet_resume, - .disable_hub_initiated_lpm = 1, -}; - -module_usb_driver(rndis_wlan_driver); - -MODULE_AUTHOR("Bjorge Dijkstra"); -MODULE_AUTHOR("Jussi Kivilinna"); -MODULE_DESCRIPTION("Driver for RNDIS based USB Wireless adapters"); -MODULE_LICENSE("GPL"); - diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig deleted file mode 100644 index 9b915d3a44be..000000000000 --- a/drivers/net/wireless/rt2x00/Kconfig +++ /dev/null @@ -1,242 +0,0 @@ -menuconfig RT2X00 - tristate "Ralink driver support" - depends on MAC80211 - ---help--- - This will enable the support for the Ralink drivers, - developed in the rt2x00 project . - - These drivers make use of the mac80211 stack. - - When building one of the individual drivers, the rt2x00 library - will also be created. That library (when the driver is built as - a module) will be called rt2x00lib. - - Additionally PCI and USB libraries will also be build depending - on the types of drivers being selected, these libraries will be - called rt2x00pci and rt2x00usb. - -if RT2X00 - -config RT2400PCI - tristate "Ralink rt2400 (PCI/PCMCIA) support" - depends on PCI - select RT2X00_LIB_MMIO - select RT2X00_LIB_PCI - select EEPROM_93CX6 - ---help--- - This adds support for rt2400 wireless chipset family. - Supported chips: RT2460. - - When compiled as a module, this driver will be called rt2400pci. - -config RT2500PCI - tristate "Ralink rt2500 (PCI/PCMCIA) support" - depends on PCI - select RT2X00_LIB_MMIO - select RT2X00_LIB_PCI - select EEPROM_93CX6 - ---help--- - This adds support for rt2500 wireless chipset family. - Supported chips: RT2560. - - When compiled as a module, this driver will be called rt2500pci. - -config RT61PCI - tristate "Ralink rt2501/rt61 (PCI/PCMCIA) support" - depends on PCI - select RT2X00_LIB_PCI - select RT2X00_LIB_MMIO - select RT2X00_LIB_FIRMWARE - select RT2X00_LIB_CRYPTO - select CRC_ITU_T - select EEPROM_93CX6 - ---help--- - This adds support for rt2501 wireless chipset family. - Supported chips: RT2561, RT2561S & RT2661. - - When compiled as a module, this driver will be called rt61pci. - -config RT2800PCI - tristate "Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support" - depends on PCI || SOC_RT288X || SOC_RT305X - select RT2800_LIB - select RT2X00_LIB_MMIO - select RT2X00_LIB_PCI if PCI - select RT2X00_LIB_SOC if SOC_RT288X || SOC_RT305X - select RT2X00_LIB_FIRMWARE - select RT2X00_LIB_CRYPTO - select CRC_CCITT - select EEPROM_93CX6 - ---help--- - This adds support for rt27xx/rt28xx/rt30xx wireless chipset family. - Supported chips: RT2760, RT2790, RT2860, RT2880, RT2890, RT3052, - RT3090, RT3091 & RT3092 - - When compiled as a module, this driver will be called "rt2800pci.ko". - -if RT2800PCI - -config RT2800PCI_RT33XX - bool "rt2800pci - Include support for rt33xx devices" - default y - ---help--- - This adds support for rt33xx wireless chipset family to the - rt2800pci driver. - Supported chips: RT3390 - -config RT2800PCI_RT35XX - bool "rt2800pci - Include support for rt35xx devices (EXPERIMENTAL)" - default y - ---help--- - This adds support for rt35xx wireless chipset family to the - rt2800pci driver. - Supported chips: RT3060, RT3062, RT3562, RT3592 - - -config RT2800PCI_RT53XX - bool "rt2800pci - Include support for rt53xx devices (EXPERIMENTAL)" - default y - ---help--- - This adds support for rt53xx wireless chipset family to the - rt2800pci driver. - Supported chips: RT5390 - -config RT2800PCI_RT3290 - bool "rt2800pci - Include support for rt3290 devices (EXPERIMENTAL)" - default y - ---help--- - This adds support for rt3290 wireless chipset family to the - rt2800pci driver. - Supported chips: RT3290 -endif - -config RT2500USB - tristate "Ralink rt2500 (USB) support" - depends on USB - select RT2X00_LIB_USB - select RT2X00_LIB_CRYPTO - ---help--- - This adds support for rt2500 wireless chipset family. - Supported chips: RT2571 & RT2572. - - When compiled as a module, this driver will be called rt2500usb. - -config RT73USB - tristate "Ralink rt2501/rt73 (USB) support" - depends on USB - select RT2X00_LIB_USB - select RT2X00_LIB_FIRMWARE - select RT2X00_LIB_CRYPTO - select CRC_ITU_T - ---help--- - This adds support for rt2501 wireless chipset family. - Supported chips: RT2571W, RT2573 & RT2671. - - When compiled as a module, this driver will be called rt73usb. - -config RT2800USB - tristate "Ralink rt27xx/rt28xx/rt30xx (USB) support" - depends on USB - select RT2800_LIB - select RT2X00_LIB_USB - select RT2X00_LIB_FIRMWARE - select RT2X00_LIB_CRYPTO - select CRC_CCITT - ---help--- - This adds support for rt27xx/rt28xx/rt30xx wireless chipset family. - Supported chips: RT2770, RT2870 & RT3070, RT3071 & RT3072 - - When compiled as a module, this driver will be called "rt2800usb.ko". - -if RT2800USB - -config RT2800USB_RT33XX - bool "rt2800usb - Include support for rt33xx devices" - default y - ---help--- - This adds support for rt33xx wireless chipset family to the - rt2800usb driver. - Supported chips: RT3370 - -config RT2800USB_RT35XX - bool "rt2800usb - Include support for rt35xx devices (EXPERIMENTAL)" - default y - ---help--- - This adds support for rt35xx wireless chipset family to the - rt2800usb driver. - Supported chips: RT3572 - -config RT2800USB_RT53XX - bool "rt2800usb - Include support for rt53xx devices (EXPERIMENTAL)" - ---help--- - This adds support for rt53xx wireless chipset family to the - rt2800usb driver. - Supported chips: RT5370 - -config RT2800USB_RT55XX - bool "rt2800usb - Include support for rt55xx devices (EXPERIMENTAL)" - ---help--- - This adds support for rt55xx wireless chipset family to the - rt2800usb driver. - Supported chips: RT5572 - -config RT2800USB_UNKNOWN - bool "rt2800usb - Include support for unknown (USB) devices" - default n - ---help--- - This adds support for rt2800usb devices that are known to - have a rt28xx family compatible chipset, but for which the exact - chipset is unknown. - - Support status for these devices is unknown, and enabling these - devices may or may not work. - -endif - -config RT2800_LIB - tristate - -config RT2X00_LIB_MMIO - tristate - -config RT2X00_LIB_PCI - tristate - select RT2X00_LIB - -config RT2X00_LIB_SOC - tristate - select RT2X00_LIB - -config RT2X00_LIB_USB - tristate - select RT2X00_LIB - -config RT2X00_LIB - tristate - -config RT2X00_LIB_FIRMWARE - boolean - select FW_LOADER - -config RT2X00_LIB_CRYPTO - boolean - -config RT2X00_LIB_LEDS - boolean - default y if (RT2X00_LIB=y && LEDS_CLASS=y) || (RT2X00_LIB=m && LEDS_CLASS!=n) - -config RT2X00_LIB_DEBUGFS - bool "Ralink debugfs support" - depends on RT2X00_LIB && MAC80211_DEBUGFS - ---help--- - Enable creation of debugfs files for the rt2x00 drivers. - These debugfs files support both reading and writing of the - most important register types of the rt2x00 hardware. - -config RT2X00_DEBUG - bool "Ralink debug output" - depends on RT2X00_LIB - ---help--- - Enable debugging output for all rt2x00 modules - -endif diff --git a/drivers/net/wireless/rt2x00/Makefile b/drivers/net/wireless/rt2x00/Makefile deleted file mode 100644 index f069d8bc5b67..000000000000 --- a/drivers/net/wireless/rt2x00/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -rt2x00lib-y += rt2x00dev.o -rt2x00lib-y += rt2x00mac.o -rt2x00lib-y += rt2x00config.o -rt2x00lib-y += rt2x00queue.o -rt2x00lib-y += rt2x00link.o -rt2x00lib-$(CONFIG_RT2X00_LIB_DEBUGFS) += rt2x00debug.o -rt2x00lib-$(CONFIG_RT2X00_LIB_CRYPTO) += rt2x00crypto.o -rt2x00lib-$(CONFIG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o -rt2x00lib-$(CONFIG_RT2X00_LIB_LEDS) += rt2x00leds.o - -obj-$(CONFIG_RT2X00_LIB) += rt2x00lib.o -obj-$(CONFIG_RT2X00_LIB_MMIO) += rt2x00mmio.o -obj-$(CONFIG_RT2X00_LIB_PCI) += rt2x00pci.o -obj-$(CONFIG_RT2X00_LIB_SOC) += rt2x00soc.o -obj-$(CONFIG_RT2X00_LIB_USB) += rt2x00usb.o -obj-$(CONFIG_RT2800_LIB) += rt2800lib.o -obj-$(CONFIG_RT2400PCI) += rt2400pci.o -obj-$(CONFIG_RT2500PCI) += rt2500pci.o -obj-$(CONFIG_RT61PCI) += rt61pci.o -obj-$(CONFIG_RT2800PCI) += rt2800pci.o -obj-$(CONFIG_RT2500USB) += rt2500usb.o -obj-$(CONFIG_RT73USB) += rt73usb.o -obj-$(CONFIG_RT2800USB) += rt2800usb.o diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c deleted file mode 100644 index a3a2dcd27a1e..000000000000 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ /dev/null @@ -1,1847 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2400pci - Abstract: rt2400pci device specific routines. - Supported chipsets: RT2460. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2x00mmio.h" -#include "rt2x00pci.h" -#include "rt2400pci.h" - -/* - * Register access. - * All access to the CSR registers will go through the methods - * rt2x00mmio_register_read and rt2x00mmio_register_write. - * BBP and RF register require indirect register access, - * and use the CSR registers BBPCSR and RFCSR to achieve this. - * These indirect registers work with busy bits, - * and we will try maximal REGISTER_BUSY_COUNT times to access - * the register while taking a REGISTER_BUSY_DELAY us delay - * between each attempt. When the busy bit is still set at that time, - * the access attempt is considered to have failed, - * and we will print an error. - */ -#define WAIT_FOR_BBP(__dev, __reg) \ - rt2x00mmio_regbusy_read((__dev), BBPCSR, BBPCSR_BUSY, (__reg)) -#define WAIT_FOR_RF(__dev, __reg) \ - rt2x00mmio_regbusy_read((__dev), RFCSR, RFCSR_BUSY, (__reg)) - -static void rt2400pci_bbp_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, const u8 value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the BBP becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_BBP(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, BBPCSR_VALUE, value); - rt2x00_set_field32(®, BBPCSR_REGNUM, word); - rt2x00_set_field32(®, BBPCSR_BUSY, 1); - rt2x00_set_field32(®, BBPCSR_WRITE_CONTROL, 1); - - rt2x00mmio_register_write(rt2x00dev, BBPCSR, reg); - } - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt2400pci_bbp_read(struct rt2x00_dev *rt2x00dev, - const unsigned int word, u8 *value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the BBP becomes available, afterwards we - * can safely write the read request into the register. - * After the data has been written, we wait until hardware - * returns the correct value, if at any time the register - * doesn't become available in time, reg will be 0xffffffff - * which means we return 0xff to the caller. - */ - if (WAIT_FOR_BBP(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, BBPCSR_REGNUM, word); - rt2x00_set_field32(®, BBPCSR_BUSY, 1); - rt2x00_set_field32(®, BBPCSR_WRITE_CONTROL, 0); - - rt2x00mmio_register_write(rt2x00dev, BBPCSR, reg); - - WAIT_FOR_BBP(rt2x00dev, ®); - } - - *value = rt2x00_get_field32(reg, BBPCSR_VALUE); - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt2400pci_rf_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, const u32 value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the RF becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_RF(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, RFCSR_VALUE, value); - rt2x00_set_field32(®, RFCSR_NUMBER_OF_BITS, 20); - rt2x00_set_field32(®, RFCSR_IF_SELECT, 0); - rt2x00_set_field32(®, RFCSR_BUSY, 1); - - rt2x00mmio_register_write(rt2x00dev, RFCSR, reg); - rt2x00_rf_write(rt2x00dev, word, value); - } - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt2400pci_eepromregister_read(struct eeprom_93cx6 *eeprom) -{ - struct rt2x00_dev *rt2x00dev = eeprom->data; - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, CSR21, ®); - - eeprom->reg_data_in = !!rt2x00_get_field32(reg, CSR21_EEPROM_DATA_IN); - eeprom->reg_data_out = !!rt2x00_get_field32(reg, CSR21_EEPROM_DATA_OUT); - eeprom->reg_data_clock = - !!rt2x00_get_field32(reg, CSR21_EEPROM_DATA_CLOCK); - eeprom->reg_chip_select = - !!rt2x00_get_field32(reg, CSR21_EEPROM_CHIP_SELECT); -} - -static void rt2400pci_eepromregister_write(struct eeprom_93cx6 *eeprom) -{ - struct rt2x00_dev *rt2x00dev = eeprom->data; - u32 reg = 0; - - rt2x00_set_field32(®, CSR21_EEPROM_DATA_IN, !!eeprom->reg_data_in); - rt2x00_set_field32(®, CSR21_EEPROM_DATA_OUT, !!eeprom->reg_data_out); - rt2x00_set_field32(®, CSR21_EEPROM_DATA_CLOCK, - !!eeprom->reg_data_clock); - rt2x00_set_field32(®, CSR21_EEPROM_CHIP_SELECT, - !!eeprom->reg_chip_select); - - rt2x00mmio_register_write(rt2x00dev, CSR21, reg); -} - -#ifdef CONFIG_RT2X00_LIB_DEBUGFS -static const struct rt2x00debug rt2400pci_rt2x00debug = { - .owner = THIS_MODULE, - .csr = { - .read = rt2x00mmio_register_read, - .write = rt2x00mmio_register_write, - .flags = RT2X00DEBUGFS_OFFSET, - .word_base = CSR_REG_BASE, - .word_size = sizeof(u32), - .word_count = CSR_REG_SIZE / sizeof(u32), - }, - .eeprom = { - .read = rt2x00_eeprom_read, - .write = rt2x00_eeprom_write, - .word_base = EEPROM_BASE, - .word_size = sizeof(u16), - .word_count = EEPROM_SIZE / sizeof(u16), - }, - .bbp = { - .read = rt2400pci_bbp_read, - .write = rt2400pci_bbp_write, - .word_base = BBP_BASE, - .word_size = sizeof(u8), - .word_count = BBP_SIZE / sizeof(u8), - }, - .rf = { - .read = rt2x00_rf_read, - .write = rt2400pci_rf_write, - .word_base = RF_BASE, - .word_size = sizeof(u32), - .word_count = RF_SIZE / sizeof(u32), - }, -}; -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ - -static int rt2400pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, GPIOCSR, ®); - return rt2x00_get_field32(reg, GPIOCSR_VAL0); -} - -#ifdef CONFIG_RT2X00_LIB_LEDS -static void rt2400pci_brightness_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct rt2x00_led *led = - container_of(led_cdev, struct rt2x00_led, led_dev); - unsigned int enabled = brightness != LED_OFF; - u32 reg; - - rt2x00mmio_register_read(led->rt2x00dev, LEDCSR, ®); - - if (led->type == LED_TYPE_RADIO || led->type == LED_TYPE_ASSOC) - rt2x00_set_field32(®, LEDCSR_LINK, enabled); - else if (led->type == LED_TYPE_ACTIVITY) - rt2x00_set_field32(®, LEDCSR_ACTIVITY, enabled); - - rt2x00mmio_register_write(led->rt2x00dev, LEDCSR, reg); -} - -static int rt2400pci_blink_set(struct led_classdev *led_cdev, - unsigned long *delay_on, - unsigned long *delay_off) -{ - struct rt2x00_led *led = - container_of(led_cdev, struct rt2x00_led, led_dev); - u32 reg; - - rt2x00mmio_register_read(led->rt2x00dev, LEDCSR, ®); - rt2x00_set_field32(®, LEDCSR_ON_PERIOD, *delay_on); - rt2x00_set_field32(®, LEDCSR_OFF_PERIOD, *delay_off); - rt2x00mmio_register_write(led->rt2x00dev, LEDCSR, reg); - - return 0; -} - -static void rt2400pci_init_led(struct rt2x00_dev *rt2x00dev, - struct rt2x00_led *led, - enum led_type type) -{ - led->rt2x00dev = rt2x00dev; - led->type = type; - led->led_dev.brightness_set = rt2400pci_brightness_set; - led->led_dev.blink_set = rt2400pci_blink_set; - led->flags = LED_INITIALIZED; -} -#endif /* CONFIG_RT2X00_LIB_LEDS */ - -/* - * Configuration handlers. - */ -static void rt2400pci_config_filter(struct rt2x00_dev *rt2x00dev, - const unsigned int filter_flags) -{ - u32 reg; - - /* - * Start configuration steps. - * Note that the version error will always be dropped - * since there is no filter for it at this time. - */ - rt2x00mmio_register_read(rt2x00dev, RXCSR0, ®); - rt2x00_set_field32(®, RXCSR0_DROP_CRC, - !(filter_flags & FIF_FCSFAIL)); - rt2x00_set_field32(®, RXCSR0_DROP_PHYSICAL, - !(filter_flags & FIF_PLCPFAIL)); - rt2x00_set_field32(®, RXCSR0_DROP_CONTROL, - !(filter_flags & FIF_CONTROL)); - rt2x00_set_field32(®, RXCSR0_DROP_NOT_TO_ME, - !(filter_flags & FIF_PROMISC_IN_BSS)); - rt2x00_set_field32(®, RXCSR0_DROP_TODS, - !(filter_flags & FIF_PROMISC_IN_BSS) && - !rt2x00dev->intf_ap_count); - rt2x00_set_field32(®, RXCSR0_DROP_VERSION_ERROR, 1); - rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg); -} - -static void rt2400pci_config_intf(struct rt2x00_dev *rt2x00dev, - struct rt2x00_intf *intf, - struct rt2x00intf_conf *conf, - const unsigned int flags) -{ - unsigned int bcn_preload; - u32 reg; - - if (flags & CONFIG_UPDATE_TYPE) { - /* - * Enable beacon config - */ - bcn_preload = PREAMBLE + GET_DURATION(IEEE80211_HEADER, 20); - rt2x00mmio_register_read(rt2x00dev, BCNCSR1, ®); - rt2x00_set_field32(®, BCNCSR1_PRELOAD, bcn_preload); - rt2x00mmio_register_write(rt2x00dev, BCNCSR1, reg); - - /* - * Enable synchronisation. - */ - rt2x00mmio_register_read(rt2x00dev, CSR14, ®); - rt2x00_set_field32(®, CSR14_TSF_SYNC, conf->sync); - rt2x00mmio_register_write(rt2x00dev, CSR14, reg); - } - - if (flags & CONFIG_UPDATE_MAC) - rt2x00mmio_register_multiwrite(rt2x00dev, CSR3, - conf->mac, sizeof(conf->mac)); - - if (flags & CONFIG_UPDATE_BSSID) - rt2x00mmio_register_multiwrite(rt2x00dev, CSR5, - conf->bssid, - sizeof(conf->bssid)); -} - -static void rt2400pci_config_erp(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_erp *erp, - u32 changed) -{ - int preamble_mask; - u32 reg; - - /* - * When short preamble is enabled, we should set bit 0x08 - */ - if (changed & BSS_CHANGED_ERP_PREAMBLE) { - preamble_mask = erp->short_preamble << 3; - - rt2x00mmio_register_read(rt2x00dev, TXCSR1, ®); - rt2x00_set_field32(®, TXCSR1_ACK_TIMEOUT, 0x1ff); - rt2x00_set_field32(®, TXCSR1_ACK_CONSUME_TIME, 0x13a); - rt2x00_set_field32(®, TXCSR1_TSF_OFFSET, IEEE80211_HEADER); - rt2x00_set_field32(®, TXCSR1_AUTORESPONDER, 1); - rt2x00mmio_register_write(rt2x00dev, TXCSR1, reg); - - rt2x00mmio_register_read(rt2x00dev, ARCSR2, ®); - rt2x00_set_field32(®, ARCSR2_SIGNAL, 0x00); - rt2x00_set_field32(®, ARCSR2_SERVICE, 0x04); - rt2x00_set_field32(®, ARCSR2_LENGTH, - GET_DURATION(ACK_SIZE, 10)); - rt2x00mmio_register_write(rt2x00dev, ARCSR2, reg); - - rt2x00mmio_register_read(rt2x00dev, ARCSR3, ®); - rt2x00_set_field32(®, ARCSR3_SIGNAL, 0x01 | preamble_mask); - rt2x00_set_field32(®, ARCSR3_SERVICE, 0x04); - rt2x00_set_field32(®, ARCSR2_LENGTH, - GET_DURATION(ACK_SIZE, 20)); - rt2x00mmio_register_write(rt2x00dev, ARCSR3, reg); - - rt2x00mmio_register_read(rt2x00dev, ARCSR4, ®); - rt2x00_set_field32(®, ARCSR4_SIGNAL, 0x02 | preamble_mask); - rt2x00_set_field32(®, ARCSR4_SERVICE, 0x04); - rt2x00_set_field32(®, ARCSR2_LENGTH, - GET_DURATION(ACK_SIZE, 55)); - rt2x00mmio_register_write(rt2x00dev, ARCSR4, reg); - - rt2x00mmio_register_read(rt2x00dev, ARCSR5, ®); - rt2x00_set_field32(®, ARCSR5_SIGNAL, 0x03 | preamble_mask); - rt2x00_set_field32(®, ARCSR5_SERVICE, 0x84); - rt2x00_set_field32(®, ARCSR2_LENGTH, - GET_DURATION(ACK_SIZE, 110)); - rt2x00mmio_register_write(rt2x00dev, ARCSR5, reg); - } - - if (changed & BSS_CHANGED_BASIC_RATES) - rt2x00mmio_register_write(rt2x00dev, ARCSR1, erp->basic_rates); - - if (changed & BSS_CHANGED_ERP_SLOT) { - rt2x00mmio_register_read(rt2x00dev, CSR11, ®); - rt2x00_set_field32(®, CSR11_SLOT_TIME, erp->slot_time); - rt2x00mmio_register_write(rt2x00dev, CSR11, reg); - - rt2x00mmio_register_read(rt2x00dev, CSR18, ®); - rt2x00_set_field32(®, CSR18_SIFS, erp->sifs); - rt2x00_set_field32(®, CSR18_PIFS, erp->pifs); - rt2x00mmio_register_write(rt2x00dev, CSR18, reg); - - rt2x00mmio_register_read(rt2x00dev, CSR19, ®); - rt2x00_set_field32(®, CSR19_DIFS, erp->difs); - rt2x00_set_field32(®, CSR19_EIFS, erp->eifs); - rt2x00mmio_register_write(rt2x00dev, CSR19, reg); - } - - if (changed & BSS_CHANGED_BEACON_INT) { - rt2x00mmio_register_read(rt2x00dev, CSR12, ®); - rt2x00_set_field32(®, CSR12_BEACON_INTERVAL, - erp->beacon_int * 16); - rt2x00_set_field32(®, CSR12_CFP_MAX_DURATION, - erp->beacon_int * 16); - rt2x00mmio_register_write(rt2x00dev, CSR12, reg); - } -} - -static void rt2400pci_config_ant(struct rt2x00_dev *rt2x00dev, - struct antenna_setup *ant) -{ - u8 r1; - u8 r4; - - /* - * We should never come here because rt2x00lib is supposed - * to catch this and send us the correct antenna explicitely. - */ - BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY || - ant->tx == ANTENNA_SW_DIVERSITY); - - rt2400pci_bbp_read(rt2x00dev, 4, &r4); - rt2400pci_bbp_read(rt2x00dev, 1, &r1); - - /* - * Configure the TX antenna. - */ - switch (ant->tx) { - case ANTENNA_HW_DIVERSITY: - rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 1); - break; - case ANTENNA_A: - rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 0); - break; - case ANTENNA_B: - default: - rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 2); - break; - } - - /* - * Configure the RX antenna. - */ - switch (ant->rx) { - case ANTENNA_HW_DIVERSITY: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); - break; - case ANTENNA_A: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 0); - break; - case ANTENNA_B: - default: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); - break; - } - - rt2400pci_bbp_write(rt2x00dev, 4, r4); - rt2400pci_bbp_write(rt2x00dev, 1, r1); -} - -static void rt2400pci_config_channel(struct rt2x00_dev *rt2x00dev, - struct rf_channel *rf) -{ - /* - * Switch on tuning bits. - */ - rt2x00_set_field32(&rf->rf1, RF1_TUNER, 1); - rt2x00_set_field32(&rf->rf3, RF3_TUNER, 1); - - rt2400pci_rf_write(rt2x00dev, 1, rf->rf1); - rt2400pci_rf_write(rt2x00dev, 2, rf->rf2); - rt2400pci_rf_write(rt2x00dev, 3, rf->rf3); - - /* - * RF2420 chipset don't need any additional actions. - */ - if (rt2x00_rf(rt2x00dev, RF2420)) - return; - - /* - * For the RT2421 chipsets we need to write an invalid - * reference clock rate to activate auto_tune. - * After that we set the value back to the correct channel. - */ - rt2400pci_rf_write(rt2x00dev, 1, rf->rf1); - rt2400pci_rf_write(rt2x00dev, 2, 0x000c2a32); - rt2400pci_rf_write(rt2x00dev, 3, rf->rf3); - - msleep(1); - - rt2400pci_rf_write(rt2x00dev, 1, rf->rf1); - rt2400pci_rf_write(rt2x00dev, 2, rf->rf2); - rt2400pci_rf_write(rt2x00dev, 3, rf->rf3); - - msleep(1); - - /* - * Switch off tuning bits. - */ - rt2x00_set_field32(&rf->rf1, RF1_TUNER, 0); - rt2x00_set_field32(&rf->rf3, RF3_TUNER, 0); - - rt2400pci_rf_write(rt2x00dev, 1, rf->rf1); - rt2400pci_rf_write(rt2x00dev, 3, rf->rf3); - - /* - * Clear false CRC during channel switch. - */ - rt2x00mmio_register_read(rt2x00dev, CNT0, &rf->rf1); -} - -static void rt2400pci_config_txpower(struct rt2x00_dev *rt2x00dev, int txpower) -{ - rt2400pci_bbp_write(rt2x00dev, 3, TXPOWER_TO_DEV(txpower)); -} - -static void rt2400pci_config_retry_limit(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf) -{ - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, CSR11, ®); - rt2x00_set_field32(®, CSR11_LONG_RETRY, - libconf->conf->long_frame_max_tx_count); - rt2x00_set_field32(®, CSR11_SHORT_RETRY, - libconf->conf->short_frame_max_tx_count); - rt2x00mmio_register_write(rt2x00dev, CSR11, reg); -} - -static void rt2400pci_config_ps(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf) -{ - enum dev_state state = - (libconf->conf->flags & IEEE80211_CONF_PS) ? - STATE_SLEEP : STATE_AWAKE; - u32 reg; - - if (state == STATE_SLEEP) { - rt2x00mmio_register_read(rt2x00dev, CSR20, ®); - rt2x00_set_field32(®, CSR20_DELAY_AFTER_TBCN, - (rt2x00dev->beacon_int - 20) * 16); - rt2x00_set_field32(®, CSR20_TBCN_BEFORE_WAKEUP, - libconf->conf->listen_interval - 1); - - /* We must first disable autowake before it can be enabled */ - rt2x00_set_field32(®, CSR20_AUTOWAKE, 0); - rt2x00mmio_register_write(rt2x00dev, CSR20, reg); - - rt2x00_set_field32(®, CSR20_AUTOWAKE, 1); - rt2x00mmio_register_write(rt2x00dev, CSR20, reg); - } else { - rt2x00mmio_register_read(rt2x00dev, CSR20, ®); - rt2x00_set_field32(®, CSR20_AUTOWAKE, 0); - rt2x00mmio_register_write(rt2x00dev, CSR20, reg); - } - - rt2x00dev->ops->lib->set_device_state(rt2x00dev, state); -} - -static void rt2400pci_config(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf, - const unsigned int flags) -{ - if (flags & IEEE80211_CONF_CHANGE_CHANNEL) - rt2400pci_config_channel(rt2x00dev, &libconf->rf); - if (flags & IEEE80211_CONF_CHANGE_POWER) - rt2400pci_config_txpower(rt2x00dev, - libconf->conf->power_level); - if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS) - rt2400pci_config_retry_limit(rt2x00dev, libconf); - if (flags & IEEE80211_CONF_CHANGE_PS) - rt2400pci_config_ps(rt2x00dev, libconf); -} - -static void rt2400pci_config_cw(struct rt2x00_dev *rt2x00dev, - const int cw_min, const int cw_max) -{ - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, CSR11, ®); - rt2x00_set_field32(®, CSR11_CWMIN, cw_min); - rt2x00_set_field32(®, CSR11_CWMAX, cw_max); - rt2x00mmio_register_write(rt2x00dev, CSR11, reg); -} - -/* - * Link tuning - */ -static void rt2400pci_link_stats(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual) -{ - u32 reg; - u8 bbp; - - /* - * Update FCS error count from register. - */ - rt2x00mmio_register_read(rt2x00dev, CNT0, ®); - qual->rx_failed = rt2x00_get_field32(reg, CNT0_FCS_ERROR); - - /* - * Update False CCA count from register. - */ - rt2400pci_bbp_read(rt2x00dev, 39, &bbp); - qual->false_cca = bbp; -} - -static inline void rt2400pci_set_vgc(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual, u8 vgc_level) -{ - if (qual->vgc_level_reg != vgc_level) { - rt2400pci_bbp_write(rt2x00dev, 13, vgc_level); - qual->vgc_level = vgc_level; - qual->vgc_level_reg = vgc_level; - } -} - -static void rt2400pci_reset_tuner(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual) -{ - rt2400pci_set_vgc(rt2x00dev, qual, 0x08); -} - -static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual, const u32 count) -{ - /* - * The link tuner should not run longer then 60 seconds, - * and should run once every 2 seconds. - */ - if (count > 60 || !(count & 1)) - return; - - /* - * Base r13 link tuning on the false cca count. - */ - if ((qual->false_cca > 512) && (qual->vgc_level < 0x20)) - rt2400pci_set_vgc(rt2x00dev, qual, ++qual->vgc_level); - else if ((qual->false_cca < 100) && (qual->vgc_level > 0x08)) - rt2400pci_set_vgc(rt2x00dev, qual, --qual->vgc_level); -} - -/* - * Queue handlers. - */ -static void rt2400pci_start_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_RX: - rt2x00mmio_register_read(rt2x00dev, RXCSR0, ®); - rt2x00_set_field32(®, RXCSR0_DISABLE_RX, 0); - rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg); - break; - case QID_BEACON: - rt2x00mmio_register_read(rt2x00dev, CSR14, ®); - rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); - rt2x00_set_field32(®, CSR14_TBCN, 1); - rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); - rt2x00mmio_register_write(rt2x00dev, CSR14, reg); - break; - default: - break; - } -} - -static void rt2400pci_kick_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_AC_VO: - rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®); - rt2x00_set_field32(®, TXCSR0_KICK_PRIO, 1); - rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg); - break; - case QID_AC_VI: - rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®); - rt2x00_set_field32(®, TXCSR0_KICK_TX, 1); - rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg); - break; - case QID_ATIM: - rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®); - rt2x00_set_field32(®, TXCSR0_KICK_ATIM, 1); - rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg); - break; - default: - break; - } -} - -static void rt2400pci_stop_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_AC_VO: - case QID_AC_VI: - case QID_ATIM: - rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®); - rt2x00_set_field32(®, TXCSR0_ABORT, 1); - rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg); - break; - case QID_RX: - rt2x00mmio_register_read(rt2x00dev, RXCSR0, ®); - rt2x00_set_field32(®, RXCSR0_DISABLE_RX, 1); - rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg); - break; - case QID_BEACON: - rt2x00mmio_register_read(rt2x00dev, CSR14, ®); - rt2x00_set_field32(®, CSR14_TSF_COUNT, 0); - rt2x00_set_field32(®, CSR14_TBCN, 0); - rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); - rt2x00mmio_register_write(rt2x00dev, CSR14, reg); - - /* - * Wait for possibly running tbtt tasklets. - */ - tasklet_kill(&rt2x00dev->tbtt_tasklet); - break; - default: - break; - } -} - -/* - * Initialization functions. - */ -static bool rt2400pci_get_entry_state(struct queue_entry *entry) -{ - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - u32 word; - - if (entry->queue->qid == QID_RX) { - rt2x00_desc_read(entry_priv->desc, 0, &word); - - return rt2x00_get_field32(word, RXD_W0_OWNER_NIC); - } else { - rt2x00_desc_read(entry_priv->desc, 0, &word); - - return (rt2x00_get_field32(word, TXD_W0_OWNER_NIC) || - rt2x00_get_field32(word, TXD_W0_VALID)); - } -} - -static void rt2400pci_clear_entry(struct queue_entry *entry) -{ - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - u32 word; - - if (entry->queue->qid == QID_RX) { - rt2x00_desc_read(entry_priv->desc, 2, &word); - rt2x00_set_field32(&word, RXD_W2_BUFFER_LENGTH, entry->skb->len); - rt2x00_desc_write(entry_priv->desc, 2, word); - - rt2x00_desc_read(entry_priv->desc, 1, &word); - rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); - rt2x00_desc_write(entry_priv->desc, 1, word); - - rt2x00_desc_read(entry_priv->desc, 0, &word); - rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1); - rt2x00_desc_write(entry_priv->desc, 0, word); - } else { - rt2x00_desc_read(entry_priv->desc, 0, &word); - rt2x00_set_field32(&word, TXD_W0_VALID, 0); - rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); - rt2x00_desc_write(entry_priv->desc, 0, word); - } -} - -static int rt2400pci_init_queues(struct rt2x00_dev *rt2x00dev) -{ - struct queue_entry_priv_mmio *entry_priv; - u32 reg; - - /* - * Initialize registers. - */ - rt2x00mmio_register_read(rt2x00dev, TXCSR2, ®); - rt2x00_set_field32(®, TXCSR2_TXD_SIZE, rt2x00dev->tx[0].desc_size); - rt2x00_set_field32(®, TXCSR2_NUM_TXD, rt2x00dev->tx[1].limit); - rt2x00_set_field32(®, TXCSR2_NUM_ATIM, rt2x00dev->atim->limit); - rt2x00_set_field32(®, TXCSR2_NUM_PRIO, rt2x00dev->tx[0].limit); - rt2x00mmio_register_write(rt2x00dev, TXCSR2, reg); - - entry_priv = rt2x00dev->tx[1].entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, TXCSR3, ®); - rt2x00_set_field32(®, TXCSR3_TX_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, TXCSR3, reg); - - entry_priv = rt2x00dev->tx[0].entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, TXCSR5, ®); - rt2x00_set_field32(®, TXCSR5_PRIO_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, TXCSR5, reg); - - entry_priv = rt2x00dev->atim->entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, TXCSR4, ®); - rt2x00_set_field32(®, TXCSR4_ATIM_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, TXCSR4, reg); - - entry_priv = rt2x00dev->bcn->entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, TXCSR6, ®); - rt2x00_set_field32(®, TXCSR6_BEACON_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, TXCSR6, reg); - - rt2x00mmio_register_read(rt2x00dev, RXCSR1, ®); - rt2x00_set_field32(®, RXCSR1_RXD_SIZE, rt2x00dev->rx->desc_size); - rt2x00_set_field32(®, RXCSR1_NUM_RXD, rt2x00dev->rx->limit); - rt2x00mmio_register_write(rt2x00dev, RXCSR1, reg); - - entry_priv = rt2x00dev->rx->entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, RXCSR2, ®); - rt2x00_set_field32(®, RXCSR2_RX_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, RXCSR2, reg); - - return 0; -} - -static int rt2400pci_init_registers(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - rt2x00mmio_register_write(rt2x00dev, PSCSR0, 0x00020002); - rt2x00mmio_register_write(rt2x00dev, PSCSR1, 0x00000002); - rt2x00mmio_register_write(rt2x00dev, PSCSR2, 0x00023f20); - rt2x00mmio_register_write(rt2x00dev, PSCSR3, 0x00000002); - - rt2x00mmio_register_read(rt2x00dev, TIMECSR, ®); - rt2x00_set_field32(®, TIMECSR_US_COUNT, 33); - rt2x00_set_field32(®, TIMECSR_US_64_COUNT, 63); - rt2x00_set_field32(®, TIMECSR_BEACON_EXPECT, 0); - rt2x00mmio_register_write(rt2x00dev, TIMECSR, reg); - - rt2x00mmio_register_read(rt2x00dev, CSR9, ®); - rt2x00_set_field32(®, CSR9_MAX_FRAME_UNIT, - (rt2x00dev->rx->data_size / 128)); - rt2x00mmio_register_write(rt2x00dev, CSR9, reg); - - rt2x00mmio_register_read(rt2x00dev, CSR14, ®); - rt2x00_set_field32(®, CSR14_TSF_COUNT, 0); - rt2x00_set_field32(®, CSR14_TSF_SYNC, 0); - rt2x00_set_field32(®, CSR14_TBCN, 0); - rt2x00_set_field32(®, CSR14_TCFP, 0); - rt2x00_set_field32(®, CSR14_TATIMW, 0); - rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); - rt2x00_set_field32(®, CSR14_CFP_COUNT_PRELOAD, 0); - rt2x00_set_field32(®, CSR14_TBCM_PRELOAD, 0); - rt2x00mmio_register_write(rt2x00dev, CSR14, reg); - - rt2x00mmio_register_write(rt2x00dev, CNT3, 0x3f080000); - - rt2x00mmio_register_read(rt2x00dev, ARCSR0, ®); - rt2x00_set_field32(®, ARCSR0_AR_BBP_DATA0, 133); - rt2x00_set_field32(®, ARCSR0_AR_BBP_ID0, 134); - rt2x00_set_field32(®, ARCSR0_AR_BBP_DATA1, 136); - rt2x00_set_field32(®, ARCSR0_AR_BBP_ID1, 135); - rt2x00mmio_register_write(rt2x00dev, ARCSR0, reg); - - rt2x00mmio_register_read(rt2x00dev, RXCSR3, ®); - rt2x00_set_field32(®, RXCSR3_BBP_ID0, 3); /* Tx power.*/ - rt2x00_set_field32(®, RXCSR3_BBP_ID0_VALID, 1); - rt2x00_set_field32(®, RXCSR3_BBP_ID1, 32); /* Signal */ - rt2x00_set_field32(®, RXCSR3_BBP_ID1_VALID, 1); - rt2x00_set_field32(®, RXCSR3_BBP_ID2, 36); /* Rssi */ - rt2x00_set_field32(®, RXCSR3_BBP_ID2_VALID, 1); - rt2x00mmio_register_write(rt2x00dev, RXCSR3, reg); - - rt2x00mmio_register_write(rt2x00dev, PWRCSR0, 0x3f3b3100); - - if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE)) - return -EBUSY; - - rt2x00mmio_register_write(rt2x00dev, MACCSR0, 0x00217223); - rt2x00mmio_register_write(rt2x00dev, MACCSR1, 0x00235518); - - rt2x00mmio_register_read(rt2x00dev, MACCSR2, ®); - rt2x00_set_field32(®, MACCSR2_DELAY, 64); - rt2x00mmio_register_write(rt2x00dev, MACCSR2, reg); - - rt2x00mmio_register_read(rt2x00dev, RALINKCSR, ®); - rt2x00_set_field32(®, RALINKCSR_AR_BBP_DATA0, 17); - rt2x00_set_field32(®, RALINKCSR_AR_BBP_ID0, 154); - rt2x00_set_field32(®, RALINKCSR_AR_BBP_DATA1, 0); - rt2x00_set_field32(®, RALINKCSR_AR_BBP_ID1, 154); - rt2x00mmio_register_write(rt2x00dev, RALINKCSR, reg); - - rt2x00mmio_register_read(rt2x00dev, CSR1, ®); - rt2x00_set_field32(®, CSR1_SOFT_RESET, 1); - rt2x00_set_field32(®, CSR1_BBP_RESET, 0); - rt2x00_set_field32(®, CSR1_HOST_READY, 0); - rt2x00mmio_register_write(rt2x00dev, CSR1, reg); - - rt2x00mmio_register_read(rt2x00dev, CSR1, ®); - rt2x00_set_field32(®, CSR1_SOFT_RESET, 0); - rt2x00_set_field32(®, CSR1_HOST_READY, 1); - rt2x00mmio_register_write(rt2x00dev, CSR1, reg); - - /* - * We must clear the FCS and FIFO error count. - * These registers are cleared on read, - * so we may pass a useless variable to store the value. - */ - rt2x00mmio_register_read(rt2x00dev, CNT0, ®); - rt2x00mmio_register_read(rt2x00dev, CNT4, ®); - - return 0; -} - -static int rt2400pci_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u8 value; - - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2400pci_bbp_read(rt2x00dev, 0, &value); - if ((value != 0xff) && (value != 0x00)) - return 0; - udelay(REGISTER_BUSY_DELAY); - } - - rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n"); - return -EACCES; -} - -static int rt2400pci_init_bbp(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u16 eeprom; - u8 reg_id; - u8 value; - - if (unlikely(rt2400pci_wait_bbp_ready(rt2x00dev))) - return -EACCES; - - rt2400pci_bbp_write(rt2x00dev, 1, 0x00); - rt2400pci_bbp_write(rt2x00dev, 3, 0x27); - rt2400pci_bbp_write(rt2x00dev, 4, 0x08); - rt2400pci_bbp_write(rt2x00dev, 10, 0x0f); - rt2400pci_bbp_write(rt2x00dev, 15, 0x72); - rt2400pci_bbp_write(rt2x00dev, 16, 0x74); - rt2400pci_bbp_write(rt2x00dev, 17, 0x20); - rt2400pci_bbp_write(rt2x00dev, 18, 0x72); - rt2400pci_bbp_write(rt2x00dev, 19, 0x0b); - rt2400pci_bbp_write(rt2x00dev, 20, 0x00); - rt2400pci_bbp_write(rt2x00dev, 28, 0x11); - rt2400pci_bbp_write(rt2x00dev, 29, 0x04); - rt2400pci_bbp_write(rt2x00dev, 30, 0x21); - rt2400pci_bbp_write(rt2x00dev, 31, 0x00); - - for (i = 0; i < EEPROM_BBP_SIZE; i++) { - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBP_START + i, &eeprom); - - if (eeprom != 0xffff && eeprom != 0x0000) { - reg_id = rt2x00_get_field16(eeprom, EEPROM_BBP_REG_ID); - value = rt2x00_get_field16(eeprom, EEPROM_BBP_VALUE); - rt2400pci_bbp_write(rt2x00dev, reg_id, value); - } - } - - return 0; -} - -/* - * Device state switch handlers. - */ -static void rt2400pci_toggle_irq(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - int mask = (state == STATE_RADIO_IRQ_OFF); - u32 reg; - unsigned long flags; - - /* - * When interrupts are being enabled, the interrupt registers - * should clear the register to assure a clean state. - */ - if (state == STATE_RADIO_IRQ_ON) { - rt2x00mmio_register_read(rt2x00dev, CSR7, ®); - rt2x00mmio_register_write(rt2x00dev, CSR7, reg); - } - - /* - * Only toggle the interrupts bits we are going to use. - * Non-checked interrupt bits are disabled by default. - */ - spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags); - - rt2x00mmio_register_read(rt2x00dev, CSR8, ®); - rt2x00_set_field32(®, CSR8_TBCN_EXPIRE, mask); - rt2x00_set_field32(®, CSR8_TXDONE_TXRING, mask); - rt2x00_set_field32(®, CSR8_TXDONE_ATIMRING, mask); - rt2x00_set_field32(®, CSR8_TXDONE_PRIORING, mask); - rt2x00_set_field32(®, CSR8_RXDONE, mask); - rt2x00mmio_register_write(rt2x00dev, CSR8, reg); - - spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags); - - if (state == STATE_RADIO_IRQ_OFF) { - /* - * Ensure that all tasklets are finished before - * disabling the interrupts. - */ - tasklet_kill(&rt2x00dev->txstatus_tasklet); - tasklet_kill(&rt2x00dev->rxdone_tasklet); - tasklet_kill(&rt2x00dev->tbtt_tasklet); - } -} - -static int rt2400pci_enable_radio(struct rt2x00_dev *rt2x00dev) -{ - /* - * Initialize all registers. - */ - if (unlikely(rt2400pci_init_queues(rt2x00dev) || - rt2400pci_init_registers(rt2x00dev) || - rt2400pci_init_bbp(rt2x00dev))) - return -EIO; - - return 0; -} - -static void rt2400pci_disable_radio(struct rt2x00_dev *rt2x00dev) -{ - /* - * Disable power - */ - rt2x00mmio_register_write(rt2x00dev, PWRCSR0, 0); -} - -static int rt2400pci_set_state(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - u32 reg, reg2; - unsigned int i; - char put_to_sleep; - char bbp_state; - char rf_state; - - put_to_sleep = (state != STATE_AWAKE); - - rt2x00mmio_register_read(rt2x00dev, PWRCSR1, ®); - rt2x00_set_field32(®, PWRCSR1_SET_STATE, 1); - rt2x00_set_field32(®, PWRCSR1_BBP_DESIRE_STATE, state); - rt2x00_set_field32(®, PWRCSR1_RF_DESIRE_STATE, state); - rt2x00_set_field32(®, PWRCSR1_PUT_TO_SLEEP, put_to_sleep); - rt2x00mmio_register_write(rt2x00dev, PWRCSR1, reg); - - /* - * Device is not guaranteed to be in the requested state yet. - * We must wait until the register indicates that the - * device has entered the correct state. - */ - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2x00mmio_register_read(rt2x00dev, PWRCSR1, ®2); - bbp_state = rt2x00_get_field32(reg2, PWRCSR1_BBP_CURR_STATE); - rf_state = rt2x00_get_field32(reg2, PWRCSR1_RF_CURR_STATE); - if (bbp_state == state && rf_state == state) - return 0; - rt2x00mmio_register_write(rt2x00dev, PWRCSR1, reg); - msleep(10); - } - - return -EBUSY; -} - -static int rt2400pci_set_device_state(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - int retval = 0; - - switch (state) { - case STATE_RADIO_ON: - retval = rt2400pci_enable_radio(rt2x00dev); - break; - case STATE_RADIO_OFF: - rt2400pci_disable_radio(rt2x00dev); - break; - case STATE_RADIO_IRQ_ON: - case STATE_RADIO_IRQ_OFF: - rt2400pci_toggle_irq(rt2x00dev, state); - break; - case STATE_DEEP_SLEEP: - case STATE_SLEEP: - case STATE_STANDBY: - case STATE_AWAKE: - retval = rt2400pci_set_state(rt2x00dev, state); - break; - default: - retval = -ENOTSUPP; - break; - } - - if (unlikely(retval)) - rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", - state, retval); - - return retval; -} - -/* - * TX descriptor initialization - */ -static void rt2400pci_write_tx_desc(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - __le32 *txd = entry_priv->desc; - u32 word; - - /* - * Start writing the descriptor words. - */ - rt2x00_desc_read(txd, 1, &word); - rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); - rt2x00_desc_write(txd, 1, word); - - rt2x00_desc_read(txd, 2, &word); - rt2x00_set_field32(&word, TXD_W2_BUFFER_LENGTH, txdesc->length); - rt2x00_set_field32(&word, TXD_W2_DATABYTE_COUNT, txdesc->length); - rt2x00_desc_write(txd, 2, word); - - rt2x00_desc_read(txd, 3, &word); - rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL, txdesc->u.plcp.signal); - rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL_REGNUM, 5); - rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL_BUSY, 1); - rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE, txdesc->u.plcp.service); - rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE_REGNUM, 6); - rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE_BUSY, 1); - rt2x00_desc_write(txd, 3, word); - - rt2x00_desc_read(txd, 4, &word); - rt2x00_set_field32(&word, TXD_W4_PLCP_LENGTH_LOW, - txdesc->u.plcp.length_low); - rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_LOW_REGNUM, 8); - rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_LOW_BUSY, 1); - rt2x00_set_field32(&word, TXD_W4_PLCP_LENGTH_HIGH, - txdesc->u.plcp.length_high); - rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_HIGH_REGNUM, 7); - rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_HIGH_BUSY, 1); - rt2x00_desc_write(txd, 4, word); - - /* - * Writing TXD word 0 must the last to prevent a race condition with - * the device, whereby the device may take hold of the TXD before we - * finished updating it. - */ - rt2x00_desc_read(txd, 0, &word); - rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 1); - rt2x00_set_field32(&word, TXD_W0_VALID, 1); - rt2x00_set_field32(&word, TXD_W0_MORE_FRAG, - test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_ACK, - test_bit(ENTRY_TXD_ACK, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_TIMESTAMP, - test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_RTS, - test_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->u.plcp.ifs); - rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, - test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags)); - rt2x00_desc_write(txd, 0, word); - - /* - * Register descriptor details in skb frame descriptor. - */ - skbdesc->desc = txd; - skbdesc->desc_len = TXD_DESC_SIZE; -} - -/* - * TX data initialization - */ -static void rt2400pci_write_beacon(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - u32 reg; - - /* - * Disable beaconing while we are reloading the beacon data, - * otherwise we might be sending out invalid data. - */ - rt2x00mmio_register_read(rt2x00dev, CSR14, ®); - rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); - rt2x00mmio_register_write(rt2x00dev, CSR14, reg); - - if (rt2x00queue_map_txskb(entry)) { - rt2x00_err(rt2x00dev, "Fail to map beacon, aborting\n"); - goto out; - } - /* - * Enable beaconing again. - */ - rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); - /* - * Write the TX descriptor for the beacon. - */ - rt2400pci_write_tx_desc(entry, txdesc); - - /* - * Dump beacon to userspace through debugfs. - */ - rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb); -out: - /* - * Enable beaconing again. - */ - rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); - rt2x00mmio_register_write(rt2x00dev, CSR14, reg); -} - -/* - * RX control handlers - */ -static void rt2400pci_fill_rxdone(struct queue_entry *entry, - struct rxdone_entry_desc *rxdesc) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - u32 word0; - u32 word2; - u32 word3; - u32 word4; - u64 tsf; - u32 rx_low; - u32 rx_high; - - rt2x00_desc_read(entry_priv->desc, 0, &word0); - rt2x00_desc_read(entry_priv->desc, 2, &word2); - rt2x00_desc_read(entry_priv->desc, 3, &word3); - rt2x00_desc_read(entry_priv->desc, 4, &word4); - - if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) - rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; - if (rt2x00_get_field32(word0, RXD_W0_PHYSICAL_ERROR)) - rxdesc->flags |= RX_FLAG_FAILED_PLCP_CRC; - - /* - * We only get the lower 32bits from the timestamp, - * to get the full 64bits we must complement it with - * the timestamp from get_tsf(). - * Note that when a wraparound of the lower 32bits - * has occurred between the frame arrival and the get_tsf() - * call, we must decrease the higher 32bits with 1 to get - * to correct value. - */ - tsf = rt2x00dev->ops->hw->get_tsf(rt2x00dev->hw, NULL); - rx_low = rt2x00_get_field32(word4, RXD_W4_RX_END_TIME); - rx_high = upper_32_bits(tsf); - - if ((u32)tsf <= rx_low) - rx_high--; - - /* - * Obtain the status about this packet. - * The signal is the PLCP value, and needs to be stripped - * of the preamble bit (0x08). - */ - rxdesc->timestamp = ((u64)rx_high << 32) | rx_low; - rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL) & ~0x08; - rxdesc->rssi = rt2x00_get_field32(word3, RXD_W3_RSSI) - - entry->queue->rt2x00dev->rssi_offset; - rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); - - rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP; - if (rt2x00_get_field32(word0, RXD_W0_MY_BSS)) - rxdesc->dev_flags |= RXDONE_MY_BSS; -} - -/* - * Interrupt functions. - */ -static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev, - const enum data_queue_qid queue_idx) -{ - struct data_queue *queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx); - struct queue_entry_priv_mmio *entry_priv; - struct queue_entry *entry; - struct txdone_entry_desc txdesc; - u32 word; - - while (!rt2x00queue_empty(queue)) { - entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); - entry_priv = entry->priv_data; - rt2x00_desc_read(entry_priv->desc, 0, &word); - - if (rt2x00_get_field32(word, TXD_W0_OWNER_NIC) || - !rt2x00_get_field32(word, TXD_W0_VALID)) - break; - - /* - * Obtain the status about this packet. - */ - txdesc.flags = 0; - switch (rt2x00_get_field32(word, TXD_W0_RESULT)) { - case 0: /* Success */ - case 1: /* Success with retry */ - __set_bit(TXDONE_SUCCESS, &txdesc.flags); - break; - case 2: /* Failure, excessive retries */ - __set_bit(TXDONE_EXCESSIVE_RETRY, &txdesc.flags); - /* Don't break, this is a failed frame! */ - default: /* Failure */ - __set_bit(TXDONE_FAILURE, &txdesc.flags); - } - txdesc.retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT); - - rt2x00lib_txdone(entry, &txdesc); - } -} - -static inline void rt2400pci_enable_interrupt(struct rt2x00_dev *rt2x00dev, - struct rt2x00_field32 irq_field) -{ - u32 reg; - - /* - * Enable a single interrupt. The interrupt mask register - * access needs locking. - */ - spin_lock_irq(&rt2x00dev->irqmask_lock); - - rt2x00mmio_register_read(rt2x00dev, CSR8, ®); - rt2x00_set_field32(®, irq_field, 0); - rt2x00mmio_register_write(rt2x00dev, CSR8, reg); - - spin_unlock_irq(&rt2x00dev->irqmask_lock); -} - -static void rt2400pci_txstatus_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - u32 reg; - - /* - * Handle all tx queues. - */ - rt2400pci_txdone(rt2x00dev, QID_ATIM); - rt2400pci_txdone(rt2x00dev, QID_AC_VO); - rt2400pci_txdone(rt2x00dev, QID_AC_VI); - - /* - * Enable all TXDONE interrupts again. - */ - if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) { - spin_lock_irq(&rt2x00dev->irqmask_lock); - - rt2x00mmio_register_read(rt2x00dev, CSR8, ®); - rt2x00_set_field32(®, CSR8_TXDONE_TXRING, 0); - rt2x00_set_field32(®, CSR8_TXDONE_ATIMRING, 0); - rt2x00_set_field32(®, CSR8_TXDONE_PRIORING, 0); - rt2x00mmio_register_write(rt2x00dev, CSR8, reg); - - spin_unlock_irq(&rt2x00dev->irqmask_lock); - } -} - -static void rt2400pci_tbtt_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - rt2x00lib_beacondone(rt2x00dev); - if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt2400pci_enable_interrupt(rt2x00dev, CSR8_TBCN_EXPIRE); -} - -static void rt2400pci_rxdone_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - if (rt2x00mmio_rxdone(rt2x00dev)) - tasklet_schedule(&rt2x00dev->rxdone_tasklet); - else if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt2400pci_enable_interrupt(rt2x00dev, CSR8_RXDONE); -} - -static irqreturn_t rt2400pci_interrupt(int irq, void *dev_instance) -{ - struct rt2x00_dev *rt2x00dev = dev_instance; - u32 reg, mask; - - /* - * Get the interrupt sources & saved to local variable. - * Write register value back to clear pending interrupts. - */ - rt2x00mmio_register_read(rt2x00dev, CSR7, ®); - rt2x00mmio_register_write(rt2x00dev, CSR7, reg); - - if (!reg) - return IRQ_NONE; - - if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - return IRQ_HANDLED; - - mask = reg; - - /* - * Schedule tasklets for interrupt handling. - */ - if (rt2x00_get_field32(reg, CSR7_TBCN_EXPIRE)) - tasklet_hi_schedule(&rt2x00dev->tbtt_tasklet); - - if (rt2x00_get_field32(reg, CSR7_RXDONE)) - tasklet_schedule(&rt2x00dev->rxdone_tasklet); - - if (rt2x00_get_field32(reg, CSR7_TXDONE_ATIMRING) || - rt2x00_get_field32(reg, CSR7_TXDONE_PRIORING) || - rt2x00_get_field32(reg, CSR7_TXDONE_TXRING)) { - tasklet_schedule(&rt2x00dev->txstatus_tasklet); - /* - * Mask out all txdone interrupts. - */ - rt2x00_set_field32(&mask, CSR8_TXDONE_TXRING, 1); - rt2x00_set_field32(&mask, CSR8_TXDONE_ATIMRING, 1); - rt2x00_set_field32(&mask, CSR8_TXDONE_PRIORING, 1); - } - - /* - * Disable all interrupts for which a tasklet was scheduled right now, - * the tasklet will reenable the appropriate interrupts. - */ - spin_lock(&rt2x00dev->irqmask_lock); - - rt2x00mmio_register_read(rt2x00dev, CSR8, ®); - reg |= mask; - rt2x00mmio_register_write(rt2x00dev, CSR8, reg); - - spin_unlock(&rt2x00dev->irqmask_lock); - - - - return IRQ_HANDLED; -} - -/* - * Device probe functions. - */ -static int rt2400pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) -{ - struct eeprom_93cx6 eeprom; - u32 reg; - u16 word; - u8 *mac; - - rt2x00mmio_register_read(rt2x00dev, CSR21, ®); - - eeprom.data = rt2x00dev; - eeprom.register_read = rt2400pci_eepromregister_read; - eeprom.register_write = rt2400pci_eepromregister_write; - eeprom.width = rt2x00_get_field32(reg, CSR21_TYPE_93C46) ? - PCI_EEPROM_WIDTH_93C46 : PCI_EEPROM_WIDTH_93C66; - eeprom.reg_data_in = 0; - eeprom.reg_data_out = 0; - eeprom.reg_data_clock = 0; - eeprom.reg_chip_select = 0; - - eeprom_93cx6_multiread(&eeprom, EEPROM_BASE, rt2x00dev->eeprom, - EEPROM_SIZE / sizeof(u16)); - - /* - * Start validation of the data that has been read. - */ - mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0); - if (!is_valid_ether_addr(mac)) { - eth_random_addr(mac); - rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word); - if (word == 0xffff) { - rt2x00_err(rt2x00dev, "Invalid EEPROM data detected\n"); - return -EINVAL; - } - - return 0; -} - -static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - u16 value; - u16 eeprom; - - /* - * Read EEPROM word for configuration. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); - - /* - * Identify RF chipset. - */ - value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); - rt2x00mmio_register_read(rt2x00dev, CSR0, ®); - rt2x00_set_chip(rt2x00dev, RT2460, value, - rt2x00_get_field32(reg, CSR0_REVISION)); - - if (!rt2x00_rf(rt2x00dev, RF2420) && !rt2x00_rf(rt2x00dev, RF2421)) { - rt2x00_err(rt2x00dev, "Invalid RF chipset detected\n"); - return -ENODEV; - } - - /* - * Identify default antenna configuration. - */ - rt2x00dev->default_ant.tx = - rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TX_DEFAULT); - rt2x00dev->default_ant.rx = - rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_DEFAULT); - - /* - * When the eeprom indicates SW_DIVERSITY use HW_DIVERSITY instead. - * I am not 100% sure about this, but the legacy drivers do not - * indicate antenna swapping in software is required when - * diversity is enabled. - */ - if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY) - rt2x00dev->default_ant.tx = ANTENNA_HW_DIVERSITY; - if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY) - rt2x00dev->default_ant.rx = ANTENNA_HW_DIVERSITY; - - /* - * Store led mode, for correct led behaviour. - */ -#ifdef CONFIG_RT2X00_LIB_LEDS - value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE); - - rt2400pci_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO); - if (value == LED_MODE_TXRX_ACTIVITY || - value == LED_MODE_DEFAULT || - value == LED_MODE_ASUS) - rt2400pci_init_led(rt2x00dev, &rt2x00dev->led_qual, - LED_TYPE_ACTIVITY); -#endif /* CONFIG_RT2X00_LIB_LEDS */ - - /* - * Detect if this device has an hardware controlled radio. - */ - if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) - __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); - - /* - * Check if the BBP tuning should be enabled. - */ - if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_AGCVGC_TUNING)) - __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags); - - return 0; -} - -/* - * RF value list for RF2420 & RF2421 - * Supports: 2.4 GHz - */ -static const struct rf_channel rf_vals_b[] = { - { 1, 0x00022058, 0x000c1fda, 0x00000101, 0 }, - { 2, 0x00022058, 0x000c1fee, 0x00000101, 0 }, - { 3, 0x00022058, 0x000c2002, 0x00000101, 0 }, - { 4, 0x00022058, 0x000c2016, 0x00000101, 0 }, - { 5, 0x00022058, 0x000c202a, 0x00000101, 0 }, - { 6, 0x00022058, 0x000c203e, 0x00000101, 0 }, - { 7, 0x00022058, 0x000c2052, 0x00000101, 0 }, - { 8, 0x00022058, 0x000c2066, 0x00000101, 0 }, - { 9, 0x00022058, 0x000c207a, 0x00000101, 0 }, - { 10, 0x00022058, 0x000c208e, 0x00000101, 0 }, - { 11, 0x00022058, 0x000c20a2, 0x00000101, 0 }, - { 12, 0x00022058, 0x000c20b6, 0x00000101, 0 }, - { 13, 0x00022058, 0x000c20ca, 0x00000101, 0 }, - { 14, 0x00022058, 0x000c20fa, 0x00000101, 0 }, -}; - -static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) -{ - struct hw_mode_spec *spec = &rt2x00dev->spec; - struct channel_info *info; - char *tx_power; - unsigned int i; - - /* - * Initialize all hw fields. - */ - rt2x00dev->hw->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_PS_NULLFUNC_STACK; - - SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); - SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, - rt2x00_eeprom_addr(rt2x00dev, - EEPROM_MAC_ADDR_0)); - - /* - * Initialize hw_mode information. - */ - spec->supported_bands = SUPPORT_BAND_2GHZ; - spec->supported_rates = SUPPORT_RATE_CCK; - - spec->num_channels = ARRAY_SIZE(rf_vals_b); - spec->channels = rf_vals_b; - - /* - * Create channel information array - */ - info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); - if (!info) - return -ENOMEM; - - spec->channels_info = info; - - tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); - for (i = 0; i < 14; i++) { - info[i].max_power = TXPOWER_FROM_DEV(MAX_TXPOWER); - info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); - } - - return 0; -} - -static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev) -{ - int retval; - u32 reg; - - /* - * Allocate eeprom data. - */ - retval = rt2400pci_validate_eeprom(rt2x00dev); - if (retval) - return retval; - - retval = rt2400pci_init_eeprom(rt2x00dev); - if (retval) - return retval; - - /* - * Enable rfkill polling by setting GPIO direction of the - * rfkill switch GPIO pin correctly. - */ - rt2x00mmio_register_read(rt2x00dev, GPIOCSR, ®); - rt2x00_set_field32(®, GPIOCSR_DIR0, 1); - rt2x00mmio_register_write(rt2x00dev, GPIOCSR, reg); - - /* - * Initialize hw specifications. - */ - retval = rt2400pci_probe_hw_mode(rt2x00dev); - if (retval) - return retval; - - /* - * This device requires the atim queue and DMA-mapped skbs. - */ - __set_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags); - __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags); - __set_bit(REQUIRE_SW_SEQNO, &rt2x00dev->cap_flags); - - /* - * Set the rssi offset. - */ - rt2x00dev->rssi_offset = DEFAULT_RSSI_OFFSET; - - return 0; -} - -/* - * IEEE80211 stack callback functions. - */ -static int rt2400pci_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - - /* - * We don't support variating cw_min and cw_max variables - * per queue. So by default we only configure the TX queue, - * and ignore all other configurations. - */ - if (queue != 0) - return -EINVAL; - - if (rt2x00mac_conf_tx(hw, vif, queue, params)) - return -EINVAL; - - /* - * Write configuration to register. - */ - rt2400pci_config_cw(rt2x00dev, - rt2x00dev->tx->cw_min, rt2x00dev->tx->cw_max); - - return 0; -} - -static u64 rt2400pci_get_tsf(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - u64 tsf; - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, CSR17, ®); - tsf = (u64) rt2x00_get_field32(reg, CSR17_HIGH_TSFTIMER) << 32; - rt2x00mmio_register_read(rt2x00dev, CSR16, ®); - tsf |= rt2x00_get_field32(reg, CSR16_LOW_TSFTIMER); - - return tsf; -} - -static int rt2400pci_tx_last_beacon(struct ieee80211_hw *hw) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, CSR15, ®); - return rt2x00_get_field32(reg, CSR15_BEACON_SENT); -} - -static const struct ieee80211_ops rt2400pci_mac80211_ops = { - .tx = rt2x00mac_tx, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, - .remove_interface = rt2x00mac_remove_interface, - .config = rt2x00mac_config, - .configure_filter = rt2x00mac_configure_filter, - .sw_scan_start = rt2x00mac_sw_scan_start, - .sw_scan_complete = rt2x00mac_sw_scan_complete, - .get_stats = rt2x00mac_get_stats, - .bss_info_changed = rt2x00mac_bss_info_changed, - .conf_tx = rt2400pci_conf_tx, - .get_tsf = rt2400pci_get_tsf, - .tx_last_beacon = rt2400pci_tx_last_beacon, - .rfkill_poll = rt2x00mac_rfkill_poll, - .flush = rt2x00mac_flush, - .set_antenna = rt2x00mac_set_antenna, - .get_antenna = rt2x00mac_get_antenna, - .get_ringparam = rt2x00mac_get_ringparam, - .tx_frames_pending = rt2x00mac_tx_frames_pending, -}; - -static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = { - .irq_handler = rt2400pci_interrupt, - .txstatus_tasklet = rt2400pci_txstatus_tasklet, - .tbtt_tasklet = rt2400pci_tbtt_tasklet, - .rxdone_tasklet = rt2400pci_rxdone_tasklet, - .probe_hw = rt2400pci_probe_hw, - .initialize = rt2x00mmio_initialize, - .uninitialize = rt2x00mmio_uninitialize, - .get_entry_state = rt2400pci_get_entry_state, - .clear_entry = rt2400pci_clear_entry, - .set_device_state = rt2400pci_set_device_state, - .rfkill_poll = rt2400pci_rfkill_poll, - .link_stats = rt2400pci_link_stats, - .reset_tuner = rt2400pci_reset_tuner, - .link_tuner = rt2400pci_link_tuner, - .start_queue = rt2400pci_start_queue, - .kick_queue = rt2400pci_kick_queue, - .stop_queue = rt2400pci_stop_queue, - .flush_queue = rt2x00mmio_flush_queue, - .write_tx_desc = rt2400pci_write_tx_desc, - .write_beacon = rt2400pci_write_beacon, - .fill_rxdone = rt2400pci_fill_rxdone, - .config_filter = rt2400pci_config_filter, - .config_intf = rt2400pci_config_intf, - .config_erp = rt2400pci_config_erp, - .config_ant = rt2400pci_config_ant, - .config = rt2400pci_config, -}; - -static const struct data_queue_desc rt2400pci_queue_rx = { - .entry_num = 24, - .data_size = DATA_FRAME_SIZE, - .desc_size = RXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_mmio), -}; - -static const struct data_queue_desc rt2400pci_queue_tx = { - .entry_num = 24, - .data_size = DATA_FRAME_SIZE, - .desc_size = TXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_mmio), -}; - -static const struct data_queue_desc rt2400pci_queue_bcn = { - .entry_num = 1, - .data_size = MGMT_FRAME_SIZE, - .desc_size = TXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_mmio), -}; - -static const struct data_queue_desc rt2400pci_queue_atim = { - .entry_num = 8, - .data_size = DATA_FRAME_SIZE, - .desc_size = TXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_mmio), -}; - -static const struct rt2x00_ops rt2400pci_ops = { - .name = KBUILD_MODNAME, - .max_ap_intf = 1, - .eeprom_size = EEPROM_SIZE, - .rf_size = RF_SIZE, - .tx_queues = NUM_TX_QUEUES, - .extra_tx_headroom = 0, - .rx = &rt2400pci_queue_rx, - .tx = &rt2400pci_queue_tx, - .bcn = &rt2400pci_queue_bcn, - .atim = &rt2400pci_queue_atim, - .lib = &rt2400pci_rt2x00_ops, - .hw = &rt2400pci_mac80211_ops, -#ifdef CONFIG_RT2X00_LIB_DEBUGFS - .debugfs = &rt2400pci_rt2x00debug, -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -}; - -/* - * RT2400pci module information. - */ -static DEFINE_PCI_DEVICE_TABLE(rt2400pci_device_table) = { - { PCI_DEVICE(0x1814, 0x0101) }, - { 0, } -}; - - -MODULE_AUTHOR(DRV_PROJECT); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION("Ralink RT2400 PCI & PCMCIA Wireless LAN driver."); -MODULE_SUPPORTED_DEVICE("Ralink RT2460 PCI & PCMCIA chipset based cards"); -MODULE_DEVICE_TABLE(pci, rt2400pci_device_table); -MODULE_LICENSE("GPL"); - -static int rt2400pci_probe(struct pci_dev *pci_dev, - const struct pci_device_id *id) -{ - return rt2x00pci_probe(pci_dev, &rt2400pci_ops); -} - -static struct pci_driver rt2400pci_driver = { - .name = KBUILD_MODNAME, - .id_table = rt2400pci_device_table, - .probe = rt2400pci_probe, - .remove = rt2x00pci_remove, - .suspend = rt2x00pci_suspend, - .resume = rt2x00pci_resume, -}; - -module_pci_driver(rt2400pci_driver); diff --git a/drivers/net/wireless/rt2x00/rt2400pci.h b/drivers/net/wireless/rt2x00/rt2400pci.h deleted file mode 100644 index e4b07f0aa3cc..000000000000 --- a/drivers/net/wireless/rt2x00/rt2400pci.h +++ /dev/null @@ -1,963 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2400pci - Abstract: Data structures and registers for the rt2400pci module. - Supported chipsets: RT2460. - */ - -#ifndef RT2400PCI_H -#define RT2400PCI_H - -/* - * RF chip defines. - */ -#define RF2420 0x0000 -#define RF2421 0x0001 - -/* - * Signal information. - * Default offset is required for RSSI <-> dBm conversion. - */ -#define DEFAULT_RSSI_OFFSET 100 - -/* - * Register layout information. - */ -#define CSR_REG_BASE 0x0000 -#define CSR_REG_SIZE 0x014c -#define EEPROM_BASE 0x0000 -#define EEPROM_SIZE 0x0100 -#define BBP_BASE 0x0000 -#define BBP_SIZE 0x0020 -#define RF_BASE 0x0004 -#define RF_SIZE 0x000c - -/* - * Number of TX queues. - */ -#define NUM_TX_QUEUES 2 - -/* - * Control/Status Registers(CSR). - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * CSR0: ASIC revision number. - */ -#define CSR0 0x0000 -#define CSR0_REVISION FIELD32(0x0000ffff) - -/* - * CSR1: System control register. - * SOFT_RESET: Software reset, 1: reset, 0: normal. - * BBP_RESET: Hardware reset, 1: reset, 0, release. - * HOST_READY: Host ready after initialization. - */ -#define CSR1 0x0004 -#define CSR1_SOFT_RESET FIELD32(0x00000001) -#define CSR1_BBP_RESET FIELD32(0x00000002) -#define CSR1_HOST_READY FIELD32(0x00000004) - -/* - * CSR2: System admin status register (invalid). - */ -#define CSR2 0x0008 - -/* - * CSR3: STA MAC address register 0. - */ -#define CSR3 0x000c -#define CSR3_BYTE0 FIELD32(0x000000ff) -#define CSR3_BYTE1 FIELD32(0x0000ff00) -#define CSR3_BYTE2 FIELD32(0x00ff0000) -#define CSR3_BYTE3 FIELD32(0xff000000) - -/* - * CSR4: STA MAC address register 1. - */ -#define CSR4 0x0010 -#define CSR4_BYTE4 FIELD32(0x000000ff) -#define CSR4_BYTE5 FIELD32(0x0000ff00) - -/* - * CSR5: BSSID register 0. - */ -#define CSR5 0x0014 -#define CSR5_BYTE0 FIELD32(0x000000ff) -#define CSR5_BYTE1 FIELD32(0x0000ff00) -#define CSR5_BYTE2 FIELD32(0x00ff0000) -#define CSR5_BYTE3 FIELD32(0xff000000) - -/* - * CSR6: BSSID register 1. - */ -#define CSR6 0x0018 -#define CSR6_BYTE4 FIELD32(0x000000ff) -#define CSR6_BYTE5 FIELD32(0x0000ff00) - -/* - * CSR7: Interrupt source register. - * Write 1 to clear interrupt. - * TBCN_EXPIRE: Beacon timer expired interrupt. - * TWAKE_EXPIRE: Wakeup timer expired interrupt. - * TATIMW_EXPIRE: Timer of atim window expired interrupt. - * TXDONE_TXRING: Tx ring transmit done interrupt. - * TXDONE_ATIMRING: Atim ring transmit done interrupt. - * TXDONE_PRIORING: Priority ring transmit done interrupt. - * RXDONE: Receive done interrupt. - */ -#define CSR7 0x001c -#define CSR7_TBCN_EXPIRE FIELD32(0x00000001) -#define CSR7_TWAKE_EXPIRE FIELD32(0x00000002) -#define CSR7_TATIMW_EXPIRE FIELD32(0x00000004) -#define CSR7_TXDONE_TXRING FIELD32(0x00000008) -#define CSR7_TXDONE_ATIMRING FIELD32(0x00000010) -#define CSR7_TXDONE_PRIORING FIELD32(0x00000020) -#define CSR7_RXDONE FIELD32(0x00000040) - -/* - * CSR8: Interrupt mask register. - * Write 1 to mask interrupt. - * TBCN_EXPIRE: Beacon timer expired interrupt. - * TWAKE_EXPIRE: Wakeup timer expired interrupt. - * TATIMW_EXPIRE: Timer of atim window expired interrupt. - * TXDONE_TXRING: Tx ring transmit done interrupt. - * TXDONE_ATIMRING: Atim ring transmit done interrupt. - * TXDONE_PRIORING: Priority ring transmit done interrupt. - * RXDONE: Receive done interrupt. - */ -#define CSR8 0x0020 -#define CSR8_TBCN_EXPIRE FIELD32(0x00000001) -#define CSR8_TWAKE_EXPIRE FIELD32(0x00000002) -#define CSR8_TATIMW_EXPIRE FIELD32(0x00000004) -#define CSR8_TXDONE_TXRING FIELD32(0x00000008) -#define CSR8_TXDONE_ATIMRING FIELD32(0x00000010) -#define CSR8_TXDONE_PRIORING FIELD32(0x00000020) -#define CSR8_RXDONE FIELD32(0x00000040) - -/* - * CSR9: Maximum frame length register. - * MAX_FRAME_UNIT: Maximum frame length in 128b unit, default: 12. - */ -#define CSR9 0x0024 -#define CSR9_MAX_FRAME_UNIT FIELD32(0x00000f80) - -/* - * CSR11: Back-off control register. - * CWMIN: CWmin. Default cwmin is 31 (2^5 - 1). - * CWMAX: CWmax. Default cwmax is 1023 (2^10 - 1). - * SLOT_TIME: Slot time, default is 20us for 802.11b. - * LONG_RETRY: Long retry count. - * SHORT_RETRY: Short retry count. - */ -#define CSR11 0x002c -#define CSR11_CWMIN FIELD32(0x0000000f) -#define CSR11_CWMAX FIELD32(0x000000f0) -#define CSR11_SLOT_TIME FIELD32(0x00001f00) -#define CSR11_LONG_RETRY FIELD32(0x00ff0000) -#define CSR11_SHORT_RETRY FIELD32(0xff000000) - -/* - * CSR12: Synchronization configuration register 0. - * All units in 1/16 TU. - * BEACON_INTERVAL: Beacon interval, default is 100 TU. - * CFPMAX_DURATION: Cfp maximum duration, default is 100 TU. - */ -#define CSR12 0x0030 -#define CSR12_BEACON_INTERVAL FIELD32(0x0000ffff) -#define CSR12_CFP_MAX_DURATION FIELD32(0xffff0000) - -/* - * CSR13: Synchronization configuration register 1. - * All units in 1/16 TU. - * ATIMW_DURATION: Atim window duration. - * CFP_PERIOD: Cfp period, default is 0 TU. - */ -#define CSR13 0x0034 -#define CSR13_ATIMW_DURATION FIELD32(0x0000ffff) -#define CSR13_CFP_PERIOD FIELD32(0x00ff0000) - -/* - * CSR14: Synchronization control register. - * TSF_COUNT: Enable tsf auto counting. - * TSF_SYNC: Tsf sync, 0: disable, 1: infra, 2: ad-hoc/master mode. - * TBCN: Enable tbcn with reload value. - * TCFP: Enable tcfp & cfp / cp switching. - * TATIMW: Enable tatimw & atim window switching. - * BEACON_GEN: Enable beacon generator. - * CFP_COUNT_PRELOAD: Cfp count preload value. - * TBCM_PRELOAD: Tbcn preload value in units of 64us. - */ -#define CSR14 0x0038 -#define CSR14_TSF_COUNT FIELD32(0x00000001) -#define CSR14_TSF_SYNC FIELD32(0x00000006) -#define CSR14_TBCN FIELD32(0x00000008) -#define CSR14_TCFP FIELD32(0x00000010) -#define CSR14_TATIMW FIELD32(0x00000020) -#define CSR14_BEACON_GEN FIELD32(0x00000040) -#define CSR14_CFP_COUNT_PRELOAD FIELD32(0x0000ff00) -#define CSR14_TBCM_PRELOAD FIELD32(0xffff0000) - -/* - * CSR15: Synchronization status register. - * CFP: ASIC is in contention-free period. - * ATIMW: ASIC is in ATIM window. - * BEACON_SENT: Beacon is send. - */ -#define CSR15 0x003c -#define CSR15_CFP FIELD32(0x00000001) -#define CSR15_ATIMW FIELD32(0x00000002) -#define CSR15_BEACON_SENT FIELD32(0x00000004) - -/* - * CSR16: TSF timer register 0. - */ -#define CSR16 0x0040 -#define CSR16_LOW_TSFTIMER FIELD32(0xffffffff) - -/* - * CSR17: TSF timer register 1. - */ -#define CSR17 0x0044 -#define CSR17_HIGH_TSFTIMER FIELD32(0xffffffff) - -/* - * CSR18: IFS timer register 0. - * SIFS: Sifs, default is 10 us. - * PIFS: Pifs, default is 30 us. - */ -#define CSR18 0x0048 -#define CSR18_SIFS FIELD32(0x0000ffff) -#define CSR18_PIFS FIELD32(0xffff0000) - -/* - * CSR19: IFS timer register 1. - * DIFS: Difs, default is 50 us. - * EIFS: Eifs, default is 364 us. - */ -#define CSR19 0x004c -#define CSR19_DIFS FIELD32(0x0000ffff) -#define CSR19_EIFS FIELD32(0xffff0000) - -/* - * CSR20: Wakeup timer register. - * DELAY_AFTER_TBCN: Delay after tbcn expired in units of 1/16 TU. - * TBCN_BEFORE_WAKEUP: Number of beacon before wakeup. - * AUTOWAKE: Enable auto wakeup / sleep mechanism. - */ -#define CSR20 0x0050 -#define CSR20_DELAY_AFTER_TBCN FIELD32(0x0000ffff) -#define CSR20_TBCN_BEFORE_WAKEUP FIELD32(0x00ff0000) -#define CSR20_AUTOWAKE FIELD32(0x01000000) - -/* - * CSR21: EEPROM control register. - * RELOAD: Write 1 to reload eeprom content. - * TYPE_93C46: 1: 93c46, 0:93c66. - */ -#define CSR21 0x0054 -#define CSR21_RELOAD FIELD32(0x00000001) -#define CSR21_EEPROM_DATA_CLOCK FIELD32(0x00000002) -#define CSR21_EEPROM_CHIP_SELECT FIELD32(0x00000004) -#define CSR21_EEPROM_DATA_IN FIELD32(0x00000008) -#define CSR21_EEPROM_DATA_OUT FIELD32(0x00000010) -#define CSR21_TYPE_93C46 FIELD32(0x00000020) - -/* - * CSR22: CFP control register. - * CFP_DURATION_REMAIN: Cfp duration remain, in units of TU. - * RELOAD_CFP_DURATION: Write 1 to reload cfp duration remain. - */ -#define CSR22 0x0058 -#define CSR22_CFP_DURATION_REMAIN FIELD32(0x0000ffff) -#define CSR22_RELOAD_CFP_DURATION FIELD32(0x00010000) - -/* - * Transmit related CSRs. - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * TXCSR0: TX Control Register. - * KICK_TX: Kick tx ring. - * KICK_ATIM: Kick atim ring. - * KICK_PRIO: Kick priority ring. - * ABORT: Abort all transmit related ring operation. - */ -#define TXCSR0 0x0060 -#define TXCSR0_KICK_TX FIELD32(0x00000001) -#define TXCSR0_KICK_ATIM FIELD32(0x00000002) -#define TXCSR0_KICK_PRIO FIELD32(0x00000004) -#define TXCSR0_ABORT FIELD32(0x00000008) - -/* - * TXCSR1: TX Configuration Register. - * ACK_TIMEOUT: Ack timeout, default = sifs + 2*slottime + acktime @ 1mbps. - * ACK_CONSUME_TIME: Ack consume time, default = sifs + acktime @ 1mbps. - * TSF_OFFSET: Insert tsf offset. - * AUTORESPONDER: Enable auto responder which include ack & cts. - */ -#define TXCSR1 0x0064 -#define TXCSR1_ACK_TIMEOUT FIELD32(0x000001ff) -#define TXCSR1_ACK_CONSUME_TIME FIELD32(0x0003fe00) -#define TXCSR1_TSF_OFFSET FIELD32(0x00fc0000) -#define TXCSR1_AUTORESPONDER FIELD32(0x01000000) - -/* - * TXCSR2: Tx descriptor configuration register. - * TXD_SIZE: Tx descriptor size, default is 48. - * NUM_TXD: Number of tx entries in ring. - * NUM_ATIM: Number of atim entries in ring. - * NUM_PRIO: Number of priority entries in ring. - */ -#define TXCSR2 0x0068 -#define TXCSR2_TXD_SIZE FIELD32(0x000000ff) -#define TXCSR2_NUM_TXD FIELD32(0x0000ff00) -#define TXCSR2_NUM_ATIM FIELD32(0x00ff0000) -#define TXCSR2_NUM_PRIO FIELD32(0xff000000) - -/* - * TXCSR3: TX Ring Base address register. - */ -#define TXCSR3 0x006c -#define TXCSR3_TX_RING_REGISTER FIELD32(0xffffffff) - -/* - * TXCSR4: TX Atim Ring Base address register. - */ -#define TXCSR4 0x0070 -#define TXCSR4_ATIM_RING_REGISTER FIELD32(0xffffffff) - -/* - * TXCSR5: TX Prio Ring Base address register. - */ -#define TXCSR5 0x0074 -#define TXCSR5_PRIO_RING_REGISTER FIELD32(0xffffffff) - -/* - * TXCSR6: Beacon Base address register. - */ -#define TXCSR6 0x0078 -#define TXCSR6_BEACON_RING_REGISTER FIELD32(0xffffffff) - -/* - * TXCSR7: Auto responder control register. - * AR_POWERMANAGEMENT: Auto responder power management bit. - */ -#define TXCSR7 0x007c -#define TXCSR7_AR_POWERMANAGEMENT FIELD32(0x00000001) - -/* - * Receive related CSRs. - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * RXCSR0: RX Control Register. - * DISABLE_RX: Disable rx engine. - * DROP_CRC: Drop crc error. - * DROP_PHYSICAL: Drop physical error. - * DROP_CONTROL: Drop control frame. - * DROP_NOT_TO_ME: Drop not to me unicast frame. - * DROP_TODS: Drop frame tods bit is true. - * DROP_VERSION_ERROR: Drop version error frame. - * PASS_CRC: Pass all packets with crc attached. - */ -#define RXCSR0 0x0080 -#define RXCSR0_DISABLE_RX FIELD32(0x00000001) -#define RXCSR0_DROP_CRC FIELD32(0x00000002) -#define RXCSR0_DROP_PHYSICAL FIELD32(0x00000004) -#define RXCSR0_DROP_CONTROL FIELD32(0x00000008) -#define RXCSR0_DROP_NOT_TO_ME FIELD32(0x00000010) -#define RXCSR0_DROP_TODS FIELD32(0x00000020) -#define RXCSR0_DROP_VERSION_ERROR FIELD32(0x00000040) -#define RXCSR0_PASS_CRC FIELD32(0x00000080) - -/* - * RXCSR1: RX descriptor configuration register. - * RXD_SIZE: Rx descriptor size, default is 32b. - * NUM_RXD: Number of rx entries in ring. - */ -#define RXCSR1 0x0084 -#define RXCSR1_RXD_SIZE FIELD32(0x000000ff) -#define RXCSR1_NUM_RXD FIELD32(0x0000ff00) - -/* - * RXCSR2: RX Ring base address register. - */ -#define RXCSR2 0x0088 -#define RXCSR2_RX_RING_REGISTER FIELD32(0xffffffff) - -/* - * RXCSR3: BBP ID register for Rx operation. - * BBP_ID#: BBP register # id. - * BBP_ID#_VALID: BBP register # id is valid or not. - */ -#define RXCSR3 0x0090 -#define RXCSR3_BBP_ID0 FIELD32(0x0000007f) -#define RXCSR3_BBP_ID0_VALID FIELD32(0x00000080) -#define RXCSR3_BBP_ID1 FIELD32(0x00007f00) -#define RXCSR3_BBP_ID1_VALID FIELD32(0x00008000) -#define RXCSR3_BBP_ID2 FIELD32(0x007f0000) -#define RXCSR3_BBP_ID2_VALID FIELD32(0x00800000) -#define RXCSR3_BBP_ID3 FIELD32(0x7f000000) -#define RXCSR3_BBP_ID3_VALID FIELD32(0x80000000) - -/* - * RXCSR4: BBP ID register for Rx operation. - * BBP_ID#: BBP register # id. - * BBP_ID#_VALID: BBP register # id is valid or not. - */ -#define RXCSR4 0x0094 -#define RXCSR4_BBP_ID4 FIELD32(0x0000007f) -#define RXCSR4_BBP_ID4_VALID FIELD32(0x00000080) -#define RXCSR4_BBP_ID5 FIELD32(0x00007f00) -#define RXCSR4_BBP_ID5_VALID FIELD32(0x00008000) - -/* - * ARCSR0: Auto Responder PLCP config register 0. - * ARCSR0_AR_BBP_DATA#: Auto responder BBP register # data. - * ARCSR0_AR_BBP_ID#: Auto responder BBP register # Id. - */ -#define ARCSR0 0x0098 -#define ARCSR0_AR_BBP_DATA0 FIELD32(0x000000ff) -#define ARCSR0_AR_BBP_ID0 FIELD32(0x0000ff00) -#define ARCSR0_AR_BBP_DATA1 FIELD32(0x00ff0000) -#define ARCSR0_AR_BBP_ID1 FIELD32(0xff000000) - -/* - * ARCSR1: Auto Responder PLCP config register 1. - * ARCSR0_AR_BBP_DATA#: Auto responder BBP register # data. - * ARCSR0_AR_BBP_ID#: Auto responder BBP register # Id. - */ -#define ARCSR1 0x009c -#define ARCSR1_AR_BBP_DATA2 FIELD32(0x000000ff) -#define ARCSR1_AR_BBP_ID2 FIELD32(0x0000ff00) -#define ARCSR1_AR_BBP_DATA3 FIELD32(0x00ff0000) -#define ARCSR1_AR_BBP_ID3 FIELD32(0xff000000) - -/* - * Miscellaneous Registers. - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * PCICSR: PCI control register. - * BIG_ENDIAN: 1: big endian, 0: little endian. - * RX_TRESHOLD: Rx threshold in dw to start pci access - * 0: 16dw (default), 1: 8dw, 2: 4dw, 3: 32dw. - * TX_TRESHOLD: Tx threshold in dw to start pci access - * 0: 0dw (default), 1: 1dw, 2: 4dw, 3: forward. - * BURST_LENTH: Pci burst length 0: 4dw (default, 1: 8dw, 2: 16dw, 3:32dw. - * ENABLE_CLK: Enable clk_run, pci clock can't going down to non-operational. - */ -#define PCICSR 0x008c -#define PCICSR_BIG_ENDIAN FIELD32(0x00000001) -#define PCICSR_RX_TRESHOLD FIELD32(0x00000006) -#define PCICSR_TX_TRESHOLD FIELD32(0x00000018) -#define PCICSR_BURST_LENTH FIELD32(0x00000060) -#define PCICSR_ENABLE_CLK FIELD32(0x00000080) - -/* - * CNT0: FCS error count. - * FCS_ERROR: FCS error count, cleared when read. - */ -#define CNT0 0x00a0 -#define CNT0_FCS_ERROR FIELD32(0x0000ffff) - -/* - * Statistic Register. - * CNT1: PLCP error count. - * CNT2: Long error count. - * CNT3: CCA false alarm count. - * CNT4: Rx FIFO overflow count. - * CNT5: Tx FIFO underrun count. - */ -#define TIMECSR2 0x00a8 -#define CNT1 0x00ac -#define CNT2 0x00b0 -#define TIMECSR3 0x00b4 -#define CNT3 0x00b8 -#define CNT4 0x00bc -#define CNT5 0x00c0 - -/* - * Baseband Control Register. - */ - -/* - * PWRCSR0: Power mode configuration register. - */ -#define PWRCSR0 0x00c4 - -/* - * Power state transition time registers. - */ -#define PSCSR0 0x00c8 -#define PSCSR1 0x00cc -#define PSCSR2 0x00d0 -#define PSCSR3 0x00d4 - -/* - * PWRCSR1: Manual power control / status register. - * Allowed state: 0 deep_sleep, 1: sleep, 2: standby, 3: awake. - * SET_STATE: Set state. Write 1 to trigger, self cleared. - * BBP_DESIRE_STATE: BBP desired state. - * RF_DESIRE_STATE: RF desired state. - * BBP_CURR_STATE: BBP current state. - * RF_CURR_STATE: RF current state. - * PUT_TO_SLEEP: Put to sleep. Write 1 to trigger, self cleared. - */ -#define PWRCSR1 0x00d8 -#define PWRCSR1_SET_STATE FIELD32(0x00000001) -#define PWRCSR1_BBP_DESIRE_STATE FIELD32(0x00000006) -#define PWRCSR1_RF_DESIRE_STATE FIELD32(0x00000018) -#define PWRCSR1_BBP_CURR_STATE FIELD32(0x00000060) -#define PWRCSR1_RF_CURR_STATE FIELD32(0x00000180) -#define PWRCSR1_PUT_TO_SLEEP FIELD32(0x00000200) - -/* - * TIMECSR: Timer control register. - * US_COUNT: 1 us timer count in units of clock cycles. - * US_64_COUNT: 64 us timer count in units of 1 us timer. - * BEACON_EXPECT: Beacon expect window. - */ -#define TIMECSR 0x00dc -#define TIMECSR_US_COUNT FIELD32(0x000000ff) -#define TIMECSR_US_64_COUNT FIELD32(0x0000ff00) -#define TIMECSR_BEACON_EXPECT FIELD32(0x00070000) - -/* - * MACCSR0: MAC configuration register 0. - */ -#define MACCSR0 0x00e0 - -/* - * MACCSR1: MAC configuration register 1. - * KICK_RX: Kick one-shot rx in one-shot rx mode. - * ONESHOT_RXMODE: Enable one-shot rx mode for debugging. - * BBPRX_RESET_MODE: Ralink bbp rx reset mode. - * AUTO_TXBBP: Auto tx logic access bbp control register. - * AUTO_RXBBP: Auto rx logic access bbp control register. - * LOOPBACK: Loopback mode. 0: normal, 1: internal, 2: external, 3:rsvd. - * INTERSIL_IF: Intersil if calibration pin. - */ -#define MACCSR1 0x00e4 -#define MACCSR1_KICK_RX FIELD32(0x00000001) -#define MACCSR1_ONESHOT_RXMODE FIELD32(0x00000002) -#define MACCSR1_BBPRX_RESET_MODE FIELD32(0x00000004) -#define MACCSR1_AUTO_TXBBP FIELD32(0x00000008) -#define MACCSR1_AUTO_RXBBP FIELD32(0x00000010) -#define MACCSR1_LOOPBACK FIELD32(0x00000060) -#define MACCSR1_INTERSIL_IF FIELD32(0x00000080) - -/* - * RALINKCSR: Ralink Rx auto-reset BBCR. - * AR_BBP_DATA#: Auto reset BBP register # data. - * AR_BBP_ID#: Auto reset BBP register # id. - */ -#define RALINKCSR 0x00e8 -#define RALINKCSR_AR_BBP_DATA0 FIELD32(0x000000ff) -#define RALINKCSR_AR_BBP_ID0 FIELD32(0x0000ff00) -#define RALINKCSR_AR_BBP_DATA1 FIELD32(0x00ff0000) -#define RALINKCSR_AR_BBP_ID1 FIELD32(0xff000000) - -/* - * BCNCSR: Beacon interval control register. - * CHANGE: Write one to change beacon interval. - * DELTATIME: The delta time value. - * NUM_BEACON: Number of beacon according to mode. - * MODE: Please refer to asic specs. - * PLUS: Plus or minus delta time value. - */ -#define BCNCSR 0x00ec -#define BCNCSR_CHANGE FIELD32(0x00000001) -#define BCNCSR_DELTATIME FIELD32(0x0000001e) -#define BCNCSR_NUM_BEACON FIELD32(0x00001fe0) -#define BCNCSR_MODE FIELD32(0x00006000) -#define BCNCSR_PLUS FIELD32(0x00008000) - -/* - * BBP / RF / IF Control Register. - */ - -/* - * BBPCSR: BBP serial control register. - * VALUE: Register value to program into BBP. - * REGNUM: Selected BBP register. - * BUSY: 1: asic is busy execute BBP programming. - * WRITE_CONTROL: 1: write BBP, 0: read BBP. - */ -#define BBPCSR 0x00f0 -#define BBPCSR_VALUE FIELD32(0x000000ff) -#define BBPCSR_REGNUM FIELD32(0x00007f00) -#define BBPCSR_BUSY FIELD32(0x00008000) -#define BBPCSR_WRITE_CONTROL FIELD32(0x00010000) - -/* - * RFCSR: RF serial control register. - * VALUE: Register value + id to program into rf/if. - * NUMBER_OF_BITS: Number of bits used in value (i:20, rfmd:22). - * IF_SELECT: Chip to program: 0: rf, 1: if. - * PLL_LD: Rf pll_ld status. - * BUSY: 1: asic is busy execute rf programming. - */ -#define RFCSR 0x00f4 -#define RFCSR_VALUE FIELD32(0x00ffffff) -#define RFCSR_NUMBER_OF_BITS FIELD32(0x1f000000) -#define RFCSR_IF_SELECT FIELD32(0x20000000) -#define RFCSR_PLL_LD FIELD32(0x40000000) -#define RFCSR_BUSY FIELD32(0x80000000) - -/* - * LEDCSR: LED control register. - * ON_PERIOD: On period, default 70ms. - * OFF_PERIOD: Off period, default 30ms. - * LINK: 0: linkoff, 1: linkup. - * ACTIVITY: 0: idle, 1: active. - */ -#define LEDCSR 0x00f8 -#define LEDCSR_ON_PERIOD FIELD32(0x000000ff) -#define LEDCSR_OFF_PERIOD FIELD32(0x0000ff00) -#define LEDCSR_LINK FIELD32(0x00010000) -#define LEDCSR_ACTIVITY FIELD32(0x00020000) - -/* - * ASIC pointer information. - * RXPTR: Current RX ring address. - * TXPTR: Current Tx ring address. - * PRIPTR: Current Priority ring address. - * ATIMPTR: Current ATIM ring address. - */ -#define RXPTR 0x0100 -#define TXPTR 0x0104 -#define PRIPTR 0x0108 -#define ATIMPTR 0x010c - -/* - * GPIO and others. - */ - -/* - * GPIOCSR: GPIO control register. - * GPIOCSR_VALx: Actual GPIO pin x value - * GPIOCSR_DIRx: GPIO direction: 0 = output; 1 = input - */ -#define GPIOCSR 0x0120 -#define GPIOCSR_VAL0 FIELD32(0x00000001) -#define GPIOCSR_VAL1 FIELD32(0x00000002) -#define GPIOCSR_VAL2 FIELD32(0x00000004) -#define GPIOCSR_VAL3 FIELD32(0x00000008) -#define GPIOCSR_VAL4 FIELD32(0x00000010) -#define GPIOCSR_VAL5 FIELD32(0x00000020) -#define GPIOCSR_VAL6 FIELD32(0x00000040) -#define GPIOCSR_VAL7 FIELD32(0x00000080) -#define GPIOCSR_DIR0 FIELD32(0x00000100) -#define GPIOCSR_DIR1 FIELD32(0x00000200) -#define GPIOCSR_DIR2 FIELD32(0x00000400) -#define GPIOCSR_DIR3 FIELD32(0x00000800) -#define GPIOCSR_DIR4 FIELD32(0x00001000) -#define GPIOCSR_DIR5 FIELD32(0x00002000) -#define GPIOCSR_DIR6 FIELD32(0x00004000) -#define GPIOCSR_DIR7 FIELD32(0x00008000) - -/* - * BBPPCSR: BBP Pin control register. - */ -#define BBPPCSR 0x0124 - -/* - * BCNCSR1: Tx BEACON offset time control register. - * PRELOAD: Beacon timer offset in units of usec. - */ -#define BCNCSR1 0x0130 -#define BCNCSR1_PRELOAD FIELD32(0x0000ffff) - -/* - * MACCSR2: TX_PE to RX_PE turn-around time control register - * DELAY: RX_PE low width, in units of pci clock cycle. - */ -#define MACCSR2 0x0134 -#define MACCSR2_DELAY FIELD32(0x000000ff) - -/* - * ARCSR2: 1 Mbps ACK/CTS PLCP. - */ -#define ARCSR2 0x013c -#define ARCSR2_SIGNAL FIELD32(0x000000ff) -#define ARCSR2_SERVICE FIELD32(0x0000ff00) -#define ARCSR2_LENGTH_LOW FIELD32(0x00ff0000) -#define ARCSR2_LENGTH FIELD32(0xffff0000) - -/* - * ARCSR3: 2 Mbps ACK/CTS PLCP. - */ -#define ARCSR3 0x0140 -#define ARCSR3_SIGNAL FIELD32(0x000000ff) -#define ARCSR3_SERVICE FIELD32(0x0000ff00) -#define ARCSR3_LENGTH FIELD32(0xffff0000) - -/* - * ARCSR4: 5.5 Mbps ACK/CTS PLCP. - */ -#define ARCSR4 0x0144 -#define ARCSR4_SIGNAL FIELD32(0x000000ff) -#define ARCSR4_SERVICE FIELD32(0x0000ff00) -#define ARCSR4_LENGTH FIELD32(0xffff0000) - -/* - * ARCSR5: 11 Mbps ACK/CTS PLCP. - */ -#define ARCSR5 0x0148 -#define ARCSR5_SIGNAL FIELD32(0x000000ff) -#define ARCSR5_SERVICE FIELD32(0x0000ff00) -#define ARCSR5_LENGTH FIELD32(0xffff0000) - -/* - * BBP registers. - * The wordsize of the BBP is 8 bits. - */ - -/* - * R1: TX antenna control - */ -#define BBP_R1_TX_ANTENNA FIELD8(0x03) - -/* - * R4: RX antenna control - */ -#define BBP_R4_RX_ANTENNA FIELD8(0x06) - -/* - * RF registers - */ - -/* - * RF 1 - */ -#define RF1_TUNER FIELD32(0x00020000) - -/* - * RF 3 - */ -#define RF3_TUNER FIELD32(0x00000100) -#define RF3_TXPOWER FIELD32(0x00003e00) - -/* - * EEPROM content. - * The wordsize of the EEPROM is 16 bits. - */ - -/* - * HW MAC address. - */ -#define EEPROM_MAC_ADDR_0 0x0002 -#define EEPROM_MAC_ADDR_BYTE0 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE1 FIELD16(0xff00) -#define EEPROM_MAC_ADDR1 0x0003 -#define EEPROM_MAC_ADDR_BYTE2 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE3 FIELD16(0xff00) -#define EEPROM_MAC_ADDR_2 0x0004 -#define EEPROM_MAC_ADDR_BYTE4 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE5 FIELD16(0xff00) - -/* - * EEPROM antenna. - * ANTENNA_NUM: Number of antenna's. - * TX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B. - * RX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B. - * RF_TYPE: Rf_type of this adapter. - * LED_MODE: 0: default, 1: TX/RX activity,2: Single (ignore link), 3: rsvd. - * RX_AGCVGC: 0: disable, 1:enable BBP R13 tuning. - * HARDWARE_RADIO: 1: Hardware controlled radio. Read GPIO0. - */ -#define EEPROM_ANTENNA 0x0b -#define EEPROM_ANTENNA_NUM FIELD16(0x0003) -#define EEPROM_ANTENNA_TX_DEFAULT FIELD16(0x000c) -#define EEPROM_ANTENNA_RX_DEFAULT FIELD16(0x0030) -#define EEPROM_ANTENNA_RF_TYPE FIELD16(0x0040) -#define EEPROM_ANTENNA_LED_MODE FIELD16(0x0180) -#define EEPROM_ANTENNA_RX_AGCVGC_TUNING FIELD16(0x0200) -#define EEPROM_ANTENNA_HARDWARE_RADIO FIELD16(0x0400) - -/* - * EEPROM BBP. - */ -#define EEPROM_BBP_START 0x0c -#define EEPROM_BBP_SIZE 7 -#define EEPROM_BBP_VALUE FIELD16(0x00ff) -#define EEPROM_BBP_REG_ID FIELD16(0xff00) - -/* - * EEPROM TXPOWER - */ -#define EEPROM_TXPOWER_START 0x13 -#define EEPROM_TXPOWER_SIZE 7 -#define EEPROM_TXPOWER_1 FIELD16(0x00ff) -#define EEPROM_TXPOWER_2 FIELD16(0xff00) - -/* - * DMA descriptor defines. - */ -#define TXD_DESC_SIZE (8 * sizeof(__le32)) -#define RXD_DESC_SIZE (8 * sizeof(__le32)) - -/* - * TX descriptor format for TX, PRIO, ATIM and Beacon Ring. - */ - -/* - * Word0 - */ -#define TXD_W0_OWNER_NIC FIELD32(0x00000001) -#define TXD_W0_VALID FIELD32(0x00000002) -#define TXD_W0_RESULT FIELD32(0x0000001c) -#define TXD_W0_RETRY_COUNT FIELD32(0x000000e0) -#define TXD_W0_MORE_FRAG FIELD32(0x00000100) -#define TXD_W0_ACK FIELD32(0x00000200) -#define TXD_W0_TIMESTAMP FIELD32(0x00000400) -#define TXD_W0_RTS FIELD32(0x00000800) -#define TXD_W0_IFS FIELD32(0x00006000) -#define TXD_W0_RETRY_MODE FIELD32(0x00008000) -#define TXD_W0_AGC FIELD32(0x00ff0000) -#define TXD_W0_R2 FIELD32(0xff000000) - -/* - * Word1 - */ -#define TXD_W1_BUFFER_ADDRESS FIELD32(0xffffffff) - -/* - * Word2 - */ -#define TXD_W2_BUFFER_LENGTH FIELD32(0x0000ffff) -#define TXD_W2_DATABYTE_COUNT FIELD32(0xffff0000) - -/* - * Word3 & 4: PLCP information - * The PLCP values should be treated as if they were BBP values. - */ -#define TXD_W3_PLCP_SIGNAL FIELD32(0x000000ff) -#define TXD_W3_PLCP_SIGNAL_REGNUM FIELD32(0x00007f00) -#define TXD_W3_PLCP_SIGNAL_BUSY FIELD32(0x00008000) -#define TXD_W3_PLCP_SERVICE FIELD32(0x00ff0000) -#define TXD_W3_PLCP_SERVICE_REGNUM FIELD32(0x7f000000) -#define TXD_W3_PLCP_SERVICE_BUSY FIELD32(0x80000000) - -#define TXD_W4_PLCP_LENGTH_LOW FIELD32(0x000000ff) -#define TXD_W3_PLCP_LENGTH_LOW_REGNUM FIELD32(0x00007f00) -#define TXD_W3_PLCP_LENGTH_LOW_BUSY FIELD32(0x00008000) -#define TXD_W4_PLCP_LENGTH_HIGH FIELD32(0x00ff0000) -#define TXD_W3_PLCP_LENGTH_HIGH_REGNUM FIELD32(0x7f000000) -#define TXD_W3_PLCP_LENGTH_HIGH_BUSY FIELD32(0x80000000) - -/* - * Word5 - */ -#define TXD_W5_BBCR4 FIELD32(0x0000ffff) -#define TXD_W5_AGC_REG FIELD32(0x007f0000) -#define TXD_W5_AGC_REG_VALID FIELD32(0x00800000) -#define TXD_W5_XXX_REG FIELD32(0x7f000000) -#define TXD_W5_XXX_REG_VALID FIELD32(0x80000000) - -/* - * Word6 - */ -#define TXD_W6_SK_BUFF FIELD32(0xffffffff) - -/* - * Word7 - */ -#define TXD_W7_RESERVED FIELD32(0xffffffff) - -/* - * RX descriptor format for RX Ring. - */ - -/* - * Word0 - */ -#define RXD_W0_OWNER_NIC FIELD32(0x00000001) -#define RXD_W0_UNICAST_TO_ME FIELD32(0x00000002) -#define RXD_W0_MULTICAST FIELD32(0x00000004) -#define RXD_W0_BROADCAST FIELD32(0x00000008) -#define RXD_W0_MY_BSS FIELD32(0x00000010) -#define RXD_W0_CRC_ERROR FIELD32(0x00000020) -#define RXD_W0_PHYSICAL_ERROR FIELD32(0x00000080) -#define RXD_W0_DATABYTE_COUNT FIELD32(0xffff0000) - -/* - * Word1 - */ -#define RXD_W1_BUFFER_ADDRESS FIELD32(0xffffffff) - -/* - * Word2 - */ -#define RXD_W2_BUFFER_LENGTH FIELD32(0x0000ffff) -#define RXD_W2_BBR0 FIELD32(0x00ff0000) -#define RXD_W2_SIGNAL FIELD32(0xff000000) - -/* - * Word3 - */ -#define RXD_W3_RSSI FIELD32(0x000000ff) -#define RXD_W3_BBR3 FIELD32(0x0000ff00) -#define RXD_W3_BBR4 FIELD32(0x00ff0000) -#define RXD_W3_BBR5 FIELD32(0xff000000) - -/* - * Word4 - */ -#define RXD_W4_RX_END_TIME FIELD32(0xffffffff) - -/* - * Word5 & 6 & 7: Reserved - */ -#define RXD_W5_RESERVED FIELD32(0xffffffff) -#define RXD_W6_RESERVED FIELD32(0xffffffff) -#define RXD_W7_RESERVED FIELD32(0xffffffff) - -/* - * Macros for converting txpower from EEPROM to mac80211 value - * and from mac80211 value to register value. - * NOTE: Logics in rt2400pci for txpower are reversed - * compared to the other rt2x00 drivers. A higher txpower - * value means that the txpower must be lowered. This is - * important when converting the value coming from the - * mac80211 stack to the rt2400 acceptable value. - */ -#define MIN_TXPOWER 31 -#define MAX_TXPOWER 62 -#define DEFAULT_TXPOWER 39 - -#define __CLAMP_TX(__txpower) \ - clamp_t(char, (__txpower), MIN_TXPOWER, MAX_TXPOWER) - -#define TXPOWER_FROM_DEV(__txpower) \ - ((__CLAMP_TX(__txpower) - MAX_TXPOWER) + MIN_TXPOWER) - -#define TXPOWER_TO_DEV(__txpower) \ - (MAX_TXPOWER - (__CLAMP_TX(__txpower) - MIN_TXPOWER)) - -#endif /* RT2400PCI_H */ diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c deleted file mode 100644 index 77e45b223d15..000000000000 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ /dev/null @@ -1,2135 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2500pci - Abstract: rt2500pci device specific routines. - Supported chipsets: RT2560. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2x00mmio.h" -#include "rt2x00pci.h" -#include "rt2500pci.h" - -/* - * Register access. - * All access to the CSR registers will go through the methods - * rt2x00mmio_register_read and rt2x00mmio_register_write. - * BBP and RF register require indirect register access, - * and use the CSR registers BBPCSR and RFCSR to achieve this. - * These indirect registers work with busy bits, - * and we will try maximal REGISTER_BUSY_COUNT times to access - * the register while taking a REGISTER_BUSY_DELAY us delay - * between each attampt. When the busy bit is still set at that time, - * the access attempt is considered to have failed, - * and we will print an error. - */ -#define WAIT_FOR_BBP(__dev, __reg) \ - rt2x00mmio_regbusy_read((__dev), BBPCSR, BBPCSR_BUSY, (__reg)) -#define WAIT_FOR_RF(__dev, __reg) \ - rt2x00mmio_regbusy_read((__dev), RFCSR, RFCSR_BUSY, (__reg)) - -static void rt2500pci_bbp_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, const u8 value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the BBP becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_BBP(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, BBPCSR_VALUE, value); - rt2x00_set_field32(®, BBPCSR_REGNUM, word); - rt2x00_set_field32(®, BBPCSR_BUSY, 1); - rt2x00_set_field32(®, BBPCSR_WRITE_CONTROL, 1); - - rt2x00mmio_register_write(rt2x00dev, BBPCSR, reg); - } - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt2500pci_bbp_read(struct rt2x00_dev *rt2x00dev, - const unsigned int word, u8 *value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the BBP becomes available, afterwards we - * can safely write the read request into the register. - * After the data has been written, we wait until hardware - * returns the correct value, if at any time the register - * doesn't become available in time, reg will be 0xffffffff - * which means we return 0xff to the caller. - */ - if (WAIT_FOR_BBP(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, BBPCSR_REGNUM, word); - rt2x00_set_field32(®, BBPCSR_BUSY, 1); - rt2x00_set_field32(®, BBPCSR_WRITE_CONTROL, 0); - - rt2x00mmio_register_write(rt2x00dev, BBPCSR, reg); - - WAIT_FOR_BBP(rt2x00dev, ®); - } - - *value = rt2x00_get_field32(reg, BBPCSR_VALUE); - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt2500pci_rf_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, const u32 value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the RF becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_RF(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, RFCSR_VALUE, value); - rt2x00_set_field32(®, RFCSR_NUMBER_OF_BITS, 20); - rt2x00_set_field32(®, RFCSR_IF_SELECT, 0); - rt2x00_set_field32(®, RFCSR_BUSY, 1); - - rt2x00mmio_register_write(rt2x00dev, RFCSR, reg); - rt2x00_rf_write(rt2x00dev, word, value); - } - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt2500pci_eepromregister_read(struct eeprom_93cx6 *eeprom) -{ - struct rt2x00_dev *rt2x00dev = eeprom->data; - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, CSR21, ®); - - eeprom->reg_data_in = !!rt2x00_get_field32(reg, CSR21_EEPROM_DATA_IN); - eeprom->reg_data_out = !!rt2x00_get_field32(reg, CSR21_EEPROM_DATA_OUT); - eeprom->reg_data_clock = - !!rt2x00_get_field32(reg, CSR21_EEPROM_DATA_CLOCK); - eeprom->reg_chip_select = - !!rt2x00_get_field32(reg, CSR21_EEPROM_CHIP_SELECT); -} - -static void rt2500pci_eepromregister_write(struct eeprom_93cx6 *eeprom) -{ - struct rt2x00_dev *rt2x00dev = eeprom->data; - u32 reg = 0; - - rt2x00_set_field32(®, CSR21_EEPROM_DATA_IN, !!eeprom->reg_data_in); - rt2x00_set_field32(®, CSR21_EEPROM_DATA_OUT, !!eeprom->reg_data_out); - rt2x00_set_field32(®, CSR21_EEPROM_DATA_CLOCK, - !!eeprom->reg_data_clock); - rt2x00_set_field32(®, CSR21_EEPROM_CHIP_SELECT, - !!eeprom->reg_chip_select); - - rt2x00mmio_register_write(rt2x00dev, CSR21, reg); -} - -#ifdef CONFIG_RT2X00_LIB_DEBUGFS -static const struct rt2x00debug rt2500pci_rt2x00debug = { - .owner = THIS_MODULE, - .csr = { - .read = rt2x00mmio_register_read, - .write = rt2x00mmio_register_write, - .flags = RT2X00DEBUGFS_OFFSET, - .word_base = CSR_REG_BASE, - .word_size = sizeof(u32), - .word_count = CSR_REG_SIZE / sizeof(u32), - }, - .eeprom = { - .read = rt2x00_eeprom_read, - .write = rt2x00_eeprom_write, - .word_base = EEPROM_BASE, - .word_size = sizeof(u16), - .word_count = EEPROM_SIZE / sizeof(u16), - }, - .bbp = { - .read = rt2500pci_bbp_read, - .write = rt2500pci_bbp_write, - .word_base = BBP_BASE, - .word_size = sizeof(u8), - .word_count = BBP_SIZE / sizeof(u8), - }, - .rf = { - .read = rt2x00_rf_read, - .write = rt2500pci_rf_write, - .word_base = RF_BASE, - .word_size = sizeof(u32), - .word_count = RF_SIZE / sizeof(u32), - }, -}; -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ - -static int rt2500pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, GPIOCSR, ®); - return rt2x00_get_field32(reg, GPIOCSR_VAL0); -} - -#ifdef CONFIG_RT2X00_LIB_LEDS -static void rt2500pci_brightness_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct rt2x00_led *led = - container_of(led_cdev, struct rt2x00_led, led_dev); - unsigned int enabled = brightness != LED_OFF; - u32 reg; - - rt2x00mmio_register_read(led->rt2x00dev, LEDCSR, ®); - - if (led->type == LED_TYPE_RADIO || led->type == LED_TYPE_ASSOC) - rt2x00_set_field32(®, LEDCSR_LINK, enabled); - else if (led->type == LED_TYPE_ACTIVITY) - rt2x00_set_field32(®, LEDCSR_ACTIVITY, enabled); - - rt2x00mmio_register_write(led->rt2x00dev, LEDCSR, reg); -} - -static int rt2500pci_blink_set(struct led_classdev *led_cdev, - unsigned long *delay_on, - unsigned long *delay_off) -{ - struct rt2x00_led *led = - container_of(led_cdev, struct rt2x00_led, led_dev); - u32 reg; - - rt2x00mmio_register_read(led->rt2x00dev, LEDCSR, ®); - rt2x00_set_field32(®, LEDCSR_ON_PERIOD, *delay_on); - rt2x00_set_field32(®, LEDCSR_OFF_PERIOD, *delay_off); - rt2x00mmio_register_write(led->rt2x00dev, LEDCSR, reg); - - return 0; -} - -static void rt2500pci_init_led(struct rt2x00_dev *rt2x00dev, - struct rt2x00_led *led, - enum led_type type) -{ - led->rt2x00dev = rt2x00dev; - led->type = type; - led->led_dev.brightness_set = rt2500pci_brightness_set; - led->led_dev.blink_set = rt2500pci_blink_set; - led->flags = LED_INITIALIZED; -} -#endif /* CONFIG_RT2X00_LIB_LEDS */ - -/* - * Configuration handlers. - */ -static void rt2500pci_config_filter(struct rt2x00_dev *rt2x00dev, - const unsigned int filter_flags) -{ - u32 reg; - - /* - * Start configuration steps. - * Note that the version error will always be dropped - * and broadcast frames will always be accepted since - * there is no filter for it at this time. - */ - rt2x00mmio_register_read(rt2x00dev, RXCSR0, ®); - rt2x00_set_field32(®, RXCSR0_DROP_CRC, - !(filter_flags & FIF_FCSFAIL)); - rt2x00_set_field32(®, RXCSR0_DROP_PHYSICAL, - !(filter_flags & FIF_PLCPFAIL)); - rt2x00_set_field32(®, RXCSR0_DROP_CONTROL, - !(filter_flags & FIF_CONTROL)); - rt2x00_set_field32(®, RXCSR0_DROP_NOT_TO_ME, - !(filter_flags & FIF_PROMISC_IN_BSS)); - rt2x00_set_field32(®, RXCSR0_DROP_TODS, - !(filter_flags & FIF_PROMISC_IN_BSS) && - !rt2x00dev->intf_ap_count); - rt2x00_set_field32(®, RXCSR0_DROP_VERSION_ERROR, 1); - rt2x00_set_field32(®, RXCSR0_DROP_MCAST, - !(filter_flags & FIF_ALLMULTI)); - rt2x00_set_field32(®, RXCSR0_DROP_BCAST, 0); - rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg); -} - -static void rt2500pci_config_intf(struct rt2x00_dev *rt2x00dev, - struct rt2x00_intf *intf, - struct rt2x00intf_conf *conf, - const unsigned int flags) -{ - struct data_queue *queue = rt2x00dev->bcn; - unsigned int bcn_preload; - u32 reg; - - if (flags & CONFIG_UPDATE_TYPE) { - /* - * Enable beacon config - */ - bcn_preload = PREAMBLE + GET_DURATION(IEEE80211_HEADER, 20); - rt2x00mmio_register_read(rt2x00dev, BCNCSR1, ®); - rt2x00_set_field32(®, BCNCSR1_PRELOAD, bcn_preload); - rt2x00_set_field32(®, BCNCSR1_BEACON_CWMIN, queue->cw_min); - rt2x00mmio_register_write(rt2x00dev, BCNCSR1, reg); - - /* - * Enable synchronisation. - */ - rt2x00mmio_register_read(rt2x00dev, CSR14, ®); - rt2x00_set_field32(®, CSR14_TSF_SYNC, conf->sync); - rt2x00mmio_register_write(rt2x00dev, CSR14, reg); - } - - if (flags & CONFIG_UPDATE_MAC) - rt2x00mmio_register_multiwrite(rt2x00dev, CSR3, - conf->mac, sizeof(conf->mac)); - - if (flags & CONFIG_UPDATE_BSSID) - rt2x00mmio_register_multiwrite(rt2x00dev, CSR5, - conf->bssid, sizeof(conf->bssid)); -} - -static void rt2500pci_config_erp(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_erp *erp, - u32 changed) -{ - int preamble_mask; - u32 reg; - - /* - * When short preamble is enabled, we should set bit 0x08 - */ - if (changed & BSS_CHANGED_ERP_PREAMBLE) { - preamble_mask = erp->short_preamble << 3; - - rt2x00mmio_register_read(rt2x00dev, TXCSR1, ®); - rt2x00_set_field32(®, TXCSR1_ACK_TIMEOUT, 0x162); - rt2x00_set_field32(®, TXCSR1_ACK_CONSUME_TIME, 0xa2); - rt2x00_set_field32(®, TXCSR1_TSF_OFFSET, IEEE80211_HEADER); - rt2x00_set_field32(®, TXCSR1_AUTORESPONDER, 1); - rt2x00mmio_register_write(rt2x00dev, TXCSR1, reg); - - rt2x00mmio_register_read(rt2x00dev, ARCSR2, ®); - rt2x00_set_field32(®, ARCSR2_SIGNAL, 0x00); - rt2x00_set_field32(®, ARCSR2_SERVICE, 0x04); - rt2x00_set_field32(®, ARCSR2_LENGTH, - GET_DURATION(ACK_SIZE, 10)); - rt2x00mmio_register_write(rt2x00dev, ARCSR2, reg); - - rt2x00mmio_register_read(rt2x00dev, ARCSR3, ®); - rt2x00_set_field32(®, ARCSR3_SIGNAL, 0x01 | preamble_mask); - rt2x00_set_field32(®, ARCSR3_SERVICE, 0x04); - rt2x00_set_field32(®, ARCSR2_LENGTH, - GET_DURATION(ACK_SIZE, 20)); - rt2x00mmio_register_write(rt2x00dev, ARCSR3, reg); - - rt2x00mmio_register_read(rt2x00dev, ARCSR4, ®); - rt2x00_set_field32(®, ARCSR4_SIGNAL, 0x02 | preamble_mask); - rt2x00_set_field32(®, ARCSR4_SERVICE, 0x04); - rt2x00_set_field32(®, ARCSR2_LENGTH, - GET_DURATION(ACK_SIZE, 55)); - rt2x00mmio_register_write(rt2x00dev, ARCSR4, reg); - - rt2x00mmio_register_read(rt2x00dev, ARCSR5, ®); - rt2x00_set_field32(®, ARCSR5_SIGNAL, 0x03 | preamble_mask); - rt2x00_set_field32(®, ARCSR5_SERVICE, 0x84); - rt2x00_set_field32(®, ARCSR2_LENGTH, - GET_DURATION(ACK_SIZE, 110)); - rt2x00mmio_register_write(rt2x00dev, ARCSR5, reg); - } - - if (changed & BSS_CHANGED_BASIC_RATES) - rt2x00mmio_register_write(rt2x00dev, ARCSR1, erp->basic_rates); - - if (changed & BSS_CHANGED_ERP_SLOT) { - rt2x00mmio_register_read(rt2x00dev, CSR11, ®); - rt2x00_set_field32(®, CSR11_SLOT_TIME, erp->slot_time); - rt2x00mmio_register_write(rt2x00dev, CSR11, reg); - - rt2x00mmio_register_read(rt2x00dev, CSR18, ®); - rt2x00_set_field32(®, CSR18_SIFS, erp->sifs); - rt2x00_set_field32(®, CSR18_PIFS, erp->pifs); - rt2x00mmio_register_write(rt2x00dev, CSR18, reg); - - rt2x00mmio_register_read(rt2x00dev, CSR19, ®); - rt2x00_set_field32(®, CSR19_DIFS, erp->difs); - rt2x00_set_field32(®, CSR19_EIFS, erp->eifs); - rt2x00mmio_register_write(rt2x00dev, CSR19, reg); - } - - if (changed & BSS_CHANGED_BEACON_INT) { - rt2x00mmio_register_read(rt2x00dev, CSR12, ®); - rt2x00_set_field32(®, CSR12_BEACON_INTERVAL, - erp->beacon_int * 16); - rt2x00_set_field32(®, CSR12_CFP_MAX_DURATION, - erp->beacon_int * 16); - rt2x00mmio_register_write(rt2x00dev, CSR12, reg); - } - -} - -static void rt2500pci_config_ant(struct rt2x00_dev *rt2x00dev, - struct antenna_setup *ant) -{ - u32 reg; - u8 r14; - u8 r2; - - /* - * We should never come here because rt2x00lib is supposed - * to catch this and send us the correct antenna explicitely. - */ - BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY || - ant->tx == ANTENNA_SW_DIVERSITY); - - rt2x00mmio_register_read(rt2x00dev, BBPCSR1, ®); - rt2500pci_bbp_read(rt2x00dev, 14, &r14); - rt2500pci_bbp_read(rt2x00dev, 2, &r2); - - /* - * Configure the TX antenna. - */ - switch (ant->tx) { - case ANTENNA_A: - rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 0); - rt2x00_set_field32(®, BBPCSR1_CCK, 0); - rt2x00_set_field32(®, BBPCSR1_OFDM, 0); - break; - case ANTENNA_B: - default: - rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2); - rt2x00_set_field32(®, BBPCSR1_CCK, 2); - rt2x00_set_field32(®, BBPCSR1_OFDM, 2); - break; - } - - /* - * Configure the RX antenna. - */ - switch (ant->rx) { - case ANTENNA_A: - rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 0); - break; - case ANTENNA_B: - default: - rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2); - break; - } - - /* - * RT2525E and RT5222 need to flip TX I/Q - */ - if (rt2x00_rf(rt2x00dev, RF2525E) || rt2x00_rf(rt2x00dev, RF5222)) { - rt2x00_set_field8(&r2, BBP_R2_TX_IQ_FLIP, 1); - rt2x00_set_field32(®, BBPCSR1_CCK_FLIP, 1); - rt2x00_set_field32(®, BBPCSR1_OFDM_FLIP, 1); - - /* - * RT2525E does not need RX I/Q Flip. - */ - if (rt2x00_rf(rt2x00dev, RF2525E)) - rt2x00_set_field8(&r14, BBP_R14_RX_IQ_FLIP, 0); - } else { - rt2x00_set_field32(®, BBPCSR1_CCK_FLIP, 0); - rt2x00_set_field32(®, BBPCSR1_OFDM_FLIP, 0); - } - - rt2x00mmio_register_write(rt2x00dev, BBPCSR1, reg); - rt2500pci_bbp_write(rt2x00dev, 14, r14); - rt2500pci_bbp_write(rt2x00dev, 2, r2); -} - -static void rt2500pci_config_channel(struct rt2x00_dev *rt2x00dev, - struct rf_channel *rf, const int txpower) -{ - u8 r70; - - /* - * Set TXpower. - */ - rt2x00_set_field32(&rf->rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower)); - - /* - * Switch on tuning bits. - * For RT2523 devices we do not need to update the R1 register. - */ - if (!rt2x00_rf(rt2x00dev, RF2523)) - rt2x00_set_field32(&rf->rf1, RF1_TUNER, 1); - rt2x00_set_field32(&rf->rf3, RF3_TUNER, 1); - - /* - * For RT2525 we should first set the channel to half band higher. - */ - if (rt2x00_rf(rt2x00dev, RF2525)) { - static const u32 vals[] = { - 0x00080cbe, 0x00080d02, 0x00080d06, 0x00080d0a, - 0x00080d0e, 0x00080d12, 0x00080d16, 0x00080d1a, - 0x00080d1e, 0x00080d22, 0x00080d26, 0x00080d2a, - 0x00080d2e, 0x00080d3a - }; - - rt2500pci_rf_write(rt2x00dev, 1, rf->rf1); - rt2500pci_rf_write(rt2x00dev, 2, vals[rf->channel - 1]); - rt2500pci_rf_write(rt2x00dev, 3, rf->rf3); - if (rf->rf4) - rt2500pci_rf_write(rt2x00dev, 4, rf->rf4); - } - - rt2500pci_rf_write(rt2x00dev, 1, rf->rf1); - rt2500pci_rf_write(rt2x00dev, 2, rf->rf2); - rt2500pci_rf_write(rt2x00dev, 3, rf->rf3); - if (rf->rf4) - rt2500pci_rf_write(rt2x00dev, 4, rf->rf4); - - /* - * Channel 14 requires the Japan filter bit to be set. - */ - r70 = 0x46; - rt2x00_set_field8(&r70, BBP_R70_JAPAN_FILTER, rf->channel == 14); - rt2500pci_bbp_write(rt2x00dev, 70, r70); - - msleep(1); - - /* - * Switch off tuning bits. - * For RT2523 devices we do not need to update the R1 register. - */ - if (!rt2x00_rf(rt2x00dev, RF2523)) { - rt2x00_set_field32(&rf->rf1, RF1_TUNER, 0); - rt2500pci_rf_write(rt2x00dev, 1, rf->rf1); - } - - rt2x00_set_field32(&rf->rf3, RF3_TUNER, 0); - rt2500pci_rf_write(rt2x00dev, 3, rf->rf3); - - /* - * Clear false CRC during channel switch. - */ - rt2x00mmio_register_read(rt2x00dev, CNT0, &rf->rf1); -} - -static void rt2500pci_config_txpower(struct rt2x00_dev *rt2x00dev, - const int txpower) -{ - u32 rf3; - - rt2x00_rf_read(rt2x00dev, 3, &rf3); - rt2x00_set_field32(&rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower)); - rt2500pci_rf_write(rt2x00dev, 3, rf3); -} - -static void rt2500pci_config_retry_limit(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf) -{ - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, CSR11, ®); - rt2x00_set_field32(®, CSR11_LONG_RETRY, - libconf->conf->long_frame_max_tx_count); - rt2x00_set_field32(®, CSR11_SHORT_RETRY, - libconf->conf->short_frame_max_tx_count); - rt2x00mmio_register_write(rt2x00dev, CSR11, reg); -} - -static void rt2500pci_config_ps(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf) -{ - enum dev_state state = - (libconf->conf->flags & IEEE80211_CONF_PS) ? - STATE_SLEEP : STATE_AWAKE; - u32 reg; - - if (state == STATE_SLEEP) { - rt2x00mmio_register_read(rt2x00dev, CSR20, ®); - rt2x00_set_field32(®, CSR20_DELAY_AFTER_TBCN, - (rt2x00dev->beacon_int - 20) * 16); - rt2x00_set_field32(®, CSR20_TBCN_BEFORE_WAKEUP, - libconf->conf->listen_interval - 1); - - /* We must first disable autowake before it can be enabled */ - rt2x00_set_field32(®, CSR20_AUTOWAKE, 0); - rt2x00mmio_register_write(rt2x00dev, CSR20, reg); - - rt2x00_set_field32(®, CSR20_AUTOWAKE, 1); - rt2x00mmio_register_write(rt2x00dev, CSR20, reg); - } else { - rt2x00mmio_register_read(rt2x00dev, CSR20, ®); - rt2x00_set_field32(®, CSR20_AUTOWAKE, 0); - rt2x00mmio_register_write(rt2x00dev, CSR20, reg); - } - - rt2x00dev->ops->lib->set_device_state(rt2x00dev, state); -} - -static void rt2500pci_config(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf, - const unsigned int flags) -{ - if (flags & IEEE80211_CONF_CHANGE_CHANNEL) - rt2500pci_config_channel(rt2x00dev, &libconf->rf, - libconf->conf->power_level); - if ((flags & IEEE80211_CONF_CHANGE_POWER) && - !(flags & IEEE80211_CONF_CHANGE_CHANNEL)) - rt2500pci_config_txpower(rt2x00dev, - libconf->conf->power_level); - if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS) - rt2500pci_config_retry_limit(rt2x00dev, libconf); - if (flags & IEEE80211_CONF_CHANGE_PS) - rt2500pci_config_ps(rt2x00dev, libconf); -} - -/* - * Link tuning - */ -static void rt2500pci_link_stats(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual) -{ - u32 reg; - - /* - * Update FCS error count from register. - */ - rt2x00mmio_register_read(rt2x00dev, CNT0, ®); - qual->rx_failed = rt2x00_get_field32(reg, CNT0_FCS_ERROR); - - /* - * Update False CCA count from register. - */ - rt2x00mmio_register_read(rt2x00dev, CNT3, ®); - qual->false_cca = rt2x00_get_field32(reg, CNT3_FALSE_CCA); -} - -static inline void rt2500pci_set_vgc(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual, u8 vgc_level) -{ - if (qual->vgc_level_reg != vgc_level) { - rt2500pci_bbp_write(rt2x00dev, 17, vgc_level); - qual->vgc_level = vgc_level; - qual->vgc_level_reg = vgc_level; - } -} - -static void rt2500pci_reset_tuner(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual) -{ - rt2500pci_set_vgc(rt2x00dev, qual, 0x48); -} - -static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual, const u32 count) -{ - /* - * To prevent collisions with MAC ASIC on chipsets - * up to version C the link tuning should halt after 20 - * seconds while being associated. - */ - if (rt2x00_rev(rt2x00dev) < RT2560_VERSION_D && - rt2x00dev->intf_associated && count > 20) - return; - - /* - * Chipset versions C and lower should directly continue - * to the dynamic CCA tuning. Chipset version D and higher - * should go straight to dynamic CCA tuning when they - * are not associated. - */ - if (rt2x00_rev(rt2x00dev) < RT2560_VERSION_D || - !rt2x00dev->intf_associated) - goto dynamic_cca_tune; - - /* - * A too low RSSI will cause too much false CCA which will - * then corrupt the R17 tuning. To remidy this the tuning should - * be stopped (While making sure the R17 value will not exceed limits) - */ - if (qual->rssi < -80 && count > 20) { - if (qual->vgc_level_reg >= 0x41) - rt2500pci_set_vgc(rt2x00dev, qual, qual->vgc_level); - return; - } - - /* - * Special big-R17 for short distance - */ - if (qual->rssi >= -58) { - rt2500pci_set_vgc(rt2x00dev, qual, 0x50); - return; - } - - /* - * Special mid-R17 for middle distance - */ - if (qual->rssi >= -74) { - rt2500pci_set_vgc(rt2x00dev, qual, 0x41); - return; - } - - /* - * Leave short or middle distance condition, restore r17 - * to the dynamic tuning range. - */ - if (qual->vgc_level_reg >= 0x41) { - rt2500pci_set_vgc(rt2x00dev, qual, qual->vgc_level); - return; - } - -dynamic_cca_tune: - - /* - * R17 is inside the dynamic tuning range, - * start tuning the link based on the false cca counter. - */ - if (qual->false_cca > 512 && qual->vgc_level_reg < 0x40) - rt2500pci_set_vgc(rt2x00dev, qual, ++qual->vgc_level_reg); - else if (qual->false_cca < 100 && qual->vgc_level_reg > 0x32) - rt2500pci_set_vgc(rt2x00dev, qual, --qual->vgc_level_reg); -} - -/* - * Queue handlers. - */ -static void rt2500pci_start_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_RX: - rt2x00mmio_register_read(rt2x00dev, RXCSR0, ®); - rt2x00_set_field32(®, RXCSR0_DISABLE_RX, 0); - rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg); - break; - case QID_BEACON: - rt2x00mmio_register_read(rt2x00dev, CSR14, ®); - rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); - rt2x00_set_field32(®, CSR14_TBCN, 1); - rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); - rt2x00mmio_register_write(rt2x00dev, CSR14, reg); - break; - default: - break; - } -} - -static void rt2500pci_kick_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_AC_VO: - rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®); - rt2x00_set_field32(®, TXCSR0_KICK_PRIO, 1); - rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg); - break; - case QID_AC_VI: - rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®); - rt2x00_set_field32(®, TXCSR0_KICK_TX, 1); - rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg); - break; - case QID_ATIM: - rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®); - rt2x00_set_field32(®, TXCSR0_KICK_ATIM, 1); - rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg); - break; - default: - break; - } -} - -static void rt2500pci_stop_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_AC_VO: - case QID_AC_VI: - case QID_ATIM: - rt2x00mmio_register_read(rt2x00dev, TXCSR0, ®); - rt2x00_set_field32(®, TXCSR0_ABORT, 1); - rt2x00mmio_register_write(rt2x00dev, TXCSR0, reg); - break; - case QID_RX: - rt2x00mmio_register_read(rt2x00dev, RXCSR0, ®); - rt2x00_set_field32(®, RXCSR0_DISABLE_RX, 1); - rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg); - break; - case QID_BEACON: - rt2x00mmio_register_read(rt2x00dev, CSR14, ®); - rt2x00_set_field32(®, CSR14_TSF_COUNT, 0); - rt2x00_set_field32(®, CSR14_TBCN, 0); - rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); - rt2x00mmio_register_write(rt2x00dev, CSR14, reg); - - /* - * Wait for possibly running tbtt tasklets. - */ - tasklet_kill(&rt2x00dev->tbtt_tasklet); - break; - default: - break; - } -} - -/* - * Initialization functions. - */ -static bool rt2500pci_get_entry_state(struct queue_entry *entry) -{ - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - u32 word; - - if (entry->queue->qid == QID_RX) { - rt2x00_desc_read(entry_priv->desc, 0, &word); - - return rt2x00_get_field32(word, RXD_W0_OWNER_NIC); - } else { - rt2x00_desc_read(entry_priv->desc, 0, &word); - - return (rt2x00_get_field32(word, TXD_W0_OWNER_NIC) || - rt2x00_get_field32(word, TXD_W0_VALID)); - } -} - -static void rt2500pci_clear_entry(struct queue_entry *entry) -{ - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - u32 word; - - if (entry->queue->qid == QID_RX) { - rt2x00_desc_read(entry_priv->desc, 1, &word); - rt2x00_set_field32(&word, RXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); - rt2x00_desc_write(entry_priv->desc, 1, word); - - rt2x00_desc_read(entry_priv->desc, 0, &word); - rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1); - rt2x00_desc_write(entry_priv->desc, 0, word); - } else { - rt2x00_desc_read(entry_priv->desc, 0, &word); - rt2x00_set_field32(&word, TXD_W0_VALID, 0); - rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); - rt2x00_desc_write(entry_priv->desc, 0, word); - } -} - -static int rt2500pci_init_queues(struct rt2x00_dev *rt2x00dev) -{ - struct queue_entry_priv_mmio *entry_priv; - u32 reg; - - /* - * Initialize registers. - */ - rt2x00mmio_register_read(rt2x00dev, TXCSR2, ®); - rt2x00_set_field32(®, TXCSR2_TXD_SIZE, rt2x00dev->tx[0].desc_size); - rt2x00_set_field32(®, TXCSR2_NUM_TXD, rt2x00dev->tx[1].limit); - rt2x00_set_field32(®, TXCSR2_NUM_ATIM, rt2x00dev->atim->limit); - rt2x00_set_field32(®, TXCSR2_NUM_PRIO, rt2x00dev->tx[0].limit); - rt2x00mmio_register_write(rt2x00dev, TXCSR2, reg); - - entry_priv = rt2x00dev->tx[1].entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, TXCSR3, ®); - rt2x00_set_field32(®, TXCSR3_TX_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, TXCSR3, reg); - - entry_priv = rt2x00dev->tx[0].entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, TXCSR5, ®); - rt2x00_set_field32(®, TXCSR5_PRIO_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, TXCSR5, reg); - - entry_priv = rt2x00dev->atim->entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, TXCSR4, ®); - rt2x00_set_field32(®, TXCSR4_ATIM_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, TXCSR4, reg); - - entry_priv = rt2x00dev->bcn->entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, TXCSR6, ®); - rt2x00_set_field32(®, TXCSR6_BEACON_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, TXCSR6, reg); - - rt2x00mmio_register_read(rt2x00dev, RXCSR1, ®); - rt2x00_set_field32(®, RXCSR1_RXD_SIZE, rt2x00dev->rx->desc_size); - rt2x00_set_field32(®, RXCSR1_NUM_RXD, rt2x00dev->rx->limit); - rt2x00mmio_register_write(rt2x00dev, RXCSR1, reg); - - entry_priv = rt2x00dev->rx->entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, RXCSR2, ®); - rt2x00_set_field32(®, RXCSR2_RX_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, RXCSR2, reg); - - return 0; -} - -static int rt2500pci_init_registers(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - rt2x00mmio_register_write(rt2x00dev, PSCSR0, 0x00020002); - rt2x00mmio_register_write(rt2x00dev, PSCSR1, 0x00000002); - rt2x00mmio_register_write(rt2x00dev, PSCSR2, 0x00020002); - rt2x00mmio_register_write(rt2x00dev, PSCSR3, 0x00000002); - - rt2x00mmio_register_read(rt2x00dev, TIMECSR, ®); - rt2x00_set_field32(®, TIMECSR_US_COUNT, 33); - rt2x00_set_field32(®, TIMECSR_US_64_COUNT, 63); - rt2x00_set_field32(®, TIMECSR_BEACON_EXPECT, 0); - rt2x00mmio_register_write(rt2x00dev, TIMECSR, reg); - - rt2x00mmio_register_read(rt2x00dev, CSR9, ®); - rt2x00_set_field32(®, CSR9_MAX_FRAME_UNIT, - rt2x00dev->rx->data_size / 128); - rt2x00mmio_register_write(rt2x00dev, CSR9, reg); - - /* - * Always use CWmin and CWmax set in descriptor. - */ - rt2x00mmio_register_read(rt2x00dev, CSR11, ®); - rt2x00_set_field32(®, CSR11_CW_SELECT, 0); - rt2x00mmio_register_write(rt2x00dev, CSR11, reg); - - rt2x00mmio_register_read(rt2x00dev, CSR14, ®); - rt2x00_set_field32(®, CSR14_TSF_COUNT, 0); - rt2x00_set_field32(®, CSR14_TSF_SYNC, 0); - rt2x00_set_field32(®, CSR14_TBCN, 0); - rt2x00_set_field32(®, CSR14_TCFP, 0); - rt2x00_set_field32(®, CSR14_TATIMW, 0); - rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); - rt2x00_set_field32(®, CSR14_CFP_COUNT_PRELOAD, 0); - rt2x00_set_field32(®, CSR14_TBCM_PRELOAD, 0); - rt2x00mmio_register_write(rt2x00dev, CSR14, reg); - - rt2x00mmio_register_write(rt2x00dev, CNT3, 0); - - rt2x00mmio_register_read(rt2x00dev, TXCSR8, ®); - rt2x00_set_field32(®, TXCSR8_BBP_ID0, 10); - rt2x00_set_field32(®, TXCSR8_BBP_ID0_VALID, 1); - rt2x00_set_field32(®, TXCSR8_BBP_ID1, 11); - rt2x00_set_field32(®, TXCSR8_BBP_ID1_VALID, 1); - rt2x00_set_field32(®, TXCSR8_BBP_ID2, 13); - rt2x00_set_field32(®, TXCSR8_BBP_ID2_VALID, 1); - rt2x00_set_field32(®, TXCSR8_BBP_ID3, 12); - rt2x00_set_field32(®, TXCSR8_BBP_ID3_VALID, 1); - rt2x00mmio_register_write(rt2x00dev, TXCSR8, reg); - - rt2x00mmio_register_read(rt2x00dev, ARTCSR0, ®); - rt2x00_set_field32(®, ARTCSR0_ACK_CTS_1MBS, 112); - rt2x00_set_field32(®, ARTCSR0_ACK_CTS_2MBS, 56); - rt2x00_set_field32(®, ARTCSR0_ACK_CTS_5_5MBS, 20); - rt2x00_set_field32(®, ARTCSR0_ACK_CTS_11MBS, 10); - rt2x00mmio_register_write(rt2x00dev, ARTCSR0, reg); - - rt2x00mmio_register_read(rt2x00dev, ARTCSR1, ®); - rt2x00_set_field32(®, ARTCSR1_ACK_CTS_6MBS, 45); - rt2x00_set_field32(®, ARTCSR1_ACK_CTS_9MBS, 37); - rt2x00_set_field32(®, ARTCSR1_ACK_CTS_12MBS, 33); - rt2x00_set_field32(®, ARTCSR1_ACK_CTS_18MBS, 29); - rt2x00mmio_register_write(rt2x00dev, ARTCSR1, reg); - - rt2x00mmio_register_read(rt2x00dev, ARTCSR2, ®); - rt2x00_set_field32(®, ARTCSR2_ACK_CTS_24MBS, 29); - rt2x00_set_field32(®, ARTCSR2_ACK_CTS_36MBS, 25); - rt2x00_set_field32(®, ARTCSR2_ACK_CTS_48MBS, 25); - rt2x00_set_field32(®, ARTCSR2_ACK_CTS_54MBS, 25); - rt2x00mmio_register_write(rt2x00dev, ARTCSR2, reg); - - rt2x00mmio_register_read(rt2x00dev, RXCSR3, ®); - rt2x00_set_field32(®, RXCSR3_BBP_ID0, 47); /* CCK Signal */ - rt2x00_set_field32(®, RXCSR3_BBP_ID0_VALID, 1); - rt2x00_set_field32(®, RXCSR3_BBP_ID1, 51); /* Rssi */ - rt2x00_set_field32(®, RXCSR3_BBP_ID1_VALID, 1); - rt2x00_set_field32(®, RXCSR3_BBP_ID2, 42); /* OFDM Rate */ - rt2x00_set_field32(®, RXCSR3_BBP_ID2_VALID, 1); - rt2x00_set_field32(®, RXCSR3_BBP_ID3, 51); /* RSSI */ - rt2x00_set_field32(®, RXCSR3_BBP_ID3_VALID, 1); - rt2x00mmio_register_write(rt2x00dev, RXCSR3, reg); - - rt2x00mmio_register_read(rt2x00dev, PCICSR, ®); - rt2x00_set_field32(®, PCICSR_BIG_ENDIAN, 0); - rt2x00_set_field32(®, PCICSR_RX_TRESHOLD, 0); - rt2x00_set_field32(®, PCICSR_TX_TRESHOLD, 3); - rt2x00_set_field32(®, PCICSR_BURST_LENTH, 1); - rt2x00_set_field32(®, PCICSR_ENABLE_CLK, 1); - rt2x00_set_field32(®, PCICSR_READ_MULTIPLE, 1); - rt2x00_set_field32(®, PCICSR_WRITE_INVALID, 1); - rt2x00mmio_register_write(rt2x00dev, PCICSR, reg); - - rt2x00mmio_register_write(rt2x00dev, PWRCSR0, 0x3f3b3100); - - rt2x00mmio_register_write(rt2x00dev, GPIOCSR, 0x0000ff00); - rt2x00mmio_register_write(rt2x00dev, TESTCSR, 0x000000f0); - - if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE)) - return -EBUSY; - - rt2x00mmio_register_write(rt2x00dev, MACCSR0, 0x00213223); - rt2x00mmio_register_write(rt2x00dev, MACCSR1, 0x00235518); - - rt2x00mmio_register_read(rt2x00dev, MACCSR2, ®); - rt2x00_set_field32(®, MACCSR2_DELAY, 64); - rt2x00mmio_register_write(rt2x00dev, MACCSR2, reg); - - rt2x00mmio_register_read(rt2x00dev, RALINKCSR, ®); - rt2x00_set_field32(®, RALINKCSR_AR_BBP_DATA0, 17); - rt2x00_set_field32(®, RALINKCSR_AR_BBP_ID0, 26); - rt2x00_set_field32(®, RALINKCSR_AR_BBP_VALID0, 1); - rt2x00_set_field32(®, RALINKCSR_AR_BBP_DATA1, 0); - rt2x00_set_field32(®, RALINKCSR_AR_BBP_ID1, 26); - rt2x00_set_field32(®, RALINKCSR_AR_BBP_VALID1, 1); - rt2x00mmio_register_write(rt2x00dev, RALINKCSR, reg); - - rt2x00mmio_register_write(rt2x00dev, BBPCSR1, 0x82188200); - - rt2x00mmio_register_write(rt2x00dev, TXACKCSR0, 0x00000020); - - rt2x00mmio_register_read(rt2x00dev, CSR1, ®); - rt2x00_set_field32(®, CSR1_SOFT_RESET, 1); - rt2x00_set_field32(®, CSR1_BBP_RESET, 0); - rt2x00_set_field32(®, CSR1_HOST_READY, 0); - rt2x00mmio_register_write(rt2x00dev, CSR1, reg); - - rt2x00mmio_register_read(rt2x00dev, CSR1, ®); - rt2x00_set_field32(®, CSR1_SOFT_RESET, 0); - rt2x00_set_field32(®, CSR1_HOST_READY, 1); - rt2x00mmio_register_write(rt2x00dev, CSR1, reg); - - /* - * We must clear the FCS and FIFO error count. - * These registers are cleared on read, - * so we may pass a useless variable to store the value. - */ - rt2x00mmio_register_read(rt2x00dev, CNT0, ®); - rt2x00mmio_register_read(rt2x00dev, CNT4, ®); - - return 0; -} - -static int rt2500pci_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u8 value; - - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2500pci_bbp_read(rt2x00dev, 0, &value); - if ((value != 0xff) && (value != 0x00)) - return 0; - udelay(REGISTER_BUSY_DELAY); - } - - rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n"); - return -EACCES; -} - -static int rt2500pci_init_bbp(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u16 eeprom; - u8 reg_id; - u8 value; - - if (unlikely(rt2500pci_wait_bbp_ready(rt2x00dev))) - return -EACCES; - - rt2500pci_bbp_write(rt2x00dev, 3, 0x02); - rt2500pci_bbp_write(rt2x00dev, 4, 0x19); - rt2500pci_bbp_write(rt2x00dev, 14, 0x1c); - rt2500pci_bbp_write(rt2x00dev, 15, 0x30); - rt2500pci_bbp_write(rt2x00dev, 16, 0xac); - rt2500pci_bbp_write(rt2x00dev, 18, 0x18); - rt2500pci_bbp_write(rt2x00dev, 19, 0xff); - rt2500pci_bbp_write(rt2x00dev, 20, 0x1e); - rt2500pci_bbp_write(rt2x00dev, 21, 0x08); - rt2500pci_bbp_write(rt2x00dev, 22, 0x08); - rt2500pci_bbp_write(rt2x00dev, 23, 0x08); - rt2500pci_bbp_write(rt2x00dev, 24, 0x70); - rt2500pci_bbp_write(rt2x00dev, 25, 0x40); - rt2500pci_bbp_write(rt2x00dev, 26, 0x08); - rt2500pci_bbp_write(rt2x00dev, 27, 0x23); - rt2500pci_bbp_write(rt2x00dev, 30, 0x10); - rt2500pci_bbp_write(rt2x00dev, 31, 0x2b); - rt2500pci_bbp_write(rt2x00dev, 32, 0xb9); - rt2500pci_bbp_write(rt2x00dev, 34, 0x12); - rt2500pci_bbp_write(rt2x00dev, 35, 0x50); - rt2500pci_bbp_write(rt2x00dev, 39, 0xc4); - rt2500pci_bbp_write(rt2x00dev, 40, 0x02); - rt2500pci_bbp_write(rt2x00dev, 41, 0x60); - rt2500pci_bbp_write(rt2x00dev, 53, 0x10); - rt2500pci_bbp_write(rt2x00dev, 54, 0x18); - rt2500pci_bbp_write(rt2x00dev, 56, 0x08); - rt2500pci_bbp_write(rt2x00dev, 57, 0x10); - rt2500pci_bbp_write(rt2x00dev, 58, 0x08); - rt2500pci_bbp_write(rt2x00dev, 61, 0x6d); - rt2500pci_bbp_write(rt2x00dev, 62, 0x10); - - for (i = 0; i < EEPROM_BBP_SIZE; i++) { - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBP_START + i, &eeprom); - - if (eeprom != 0xffff && eeprom != 0x0000) { - reg_id = rt2x00_get_field16(eeprom, EEPROM_BBP_REG_ID); - value = rt2x00_get_field16(eeprom, EEPROM_BBP_VALUE); - rt2500pci_bbp_write(rt2x00dev, reg_id, value); - } - } - - return 0; -} - -/* - * Device state switch handlers. - */ -static void rt2500pci_toggle_irq(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - int mask = (state == STATE_RADIO_IRQ_OFF); - u32 reg; - unsigned long flags; - - /* - * When interrupts are being enabled, the interrupt registers - * should clear the register to assure a clean state. - */ - if (state == STATE_RADIO_IRQ_ON) { - rt2x00mmio_register_read(rt2x00dev, CSR7, ®); - rt2x00mmio_register_write(rt2x00dev, CSR7, reg); - } - - /* - * Only toggle the interrupts bits we are going to use. - * Non-checked interrupt bits are disabled by default. - */ - spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags); - - rt2x00mmio_register_read(rt2x00dev, CSR8, ®); - rt2x00_set_field32(®, CSR8_TBCN_EXPIRE, mask); - rt2x00_set_field32(®, CSR8_TXDONE_TXRING, mask); - rt2x00_set_field32(®, CSR8_TXDONE_ATIMRING, mask); - rt2x00_set_field32(®, CSR8_TXDONE_PRIORING, mask); - rt2x00_set_field32(®, CSR8_RXDONE, mask); - rt2x00mmio_register_write(rt2x00dev, CSR8, reg); - - spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags); - - if (state == STATE_RADIO_IRQ_OFF) { - /* - * Ensure that all tasklets are finished. - */ - tasklet_kill(&rt2x00dev->txstatus_tasklet); - tasklet_kill(&rt2x00dev->rxdone_tasklet); - tasklet_kill(&rt2x00dev->tbtt_tasklet); - } -} - -static int rt2500pci_enable_radio(struct rt2x00_dev *rt2x00dev) -{ - /* - * Initialize all registers. - */ - if (unlikely(rt2500pci_init_queues(rt2x00dev) || - rt2500pci_init_registers(rt2x00dev) || - rt2500pci_init_bbp(rt2x00dev))) - return -EIO; - - return 0; -} - -static void rt2500pci_disable_radio(struct rt2x00_dev *rt2x00dev) -{ - /* - * Disable power - */ - rt2x00mmio_register_write(rt2x00dev, PWRCSR0, 0); -} - -static int rt2500pci_set_state(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - u32 reg, reg2; - unsigned int i; - char put_to_sleep; - char bbp_state; - char rf_state; - - put_to_sleep = (state != STATE_AWAKE); - - rt2x00mmio_register_read(rt2x00dev, PWRCSR1, ®); - rt2x00_set_field32(®, PWRCSR1_SET_STATE, 1); - rt2x00_set_field32(®, PWRCSR1_BBP_DESIRE_STATE, state); - rt2x00_set_field32(®, PWRCSR1_RF_DESIRE_STATE, state); - rt2x00_set_field32(®, PWRCSR1_PUT_TO_SLEEP, put_to_sleep); - rt2x00mmio_register_write(rt2x00dev, PWRCSR1, reg); - - /* - * Device is not guaranteed to be in the requested state yet. - * We must wait until the register indicates that the - * device has entered the correct state. - */ - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2x00mmio_register_read(rt2x00dev, PWRCSR1, ®2); - bbp_state = rt2x00_get_field32(reg2, PWRCSR1_BBP_CURR_STATE); - rf_state = rt2x00_get_field32(reg2, PWRCSR1_RF_CURR_STATE); - if (bbp_state == state && rf_state == state) - return 0; - rt2x00mmio_register_write(rt2x00dev, PWRCSR1, reg); - msleep(10); - } - - return -EBUSY; -} - -static int rt2500pci_set_device_state(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - int retval = 0; - - switch (state) { - case STATE_RADIO_ON: - retval = rt2500pci_enable_radio(rt2x00dev); - break; - case STATE_RADIO_OFF: - rt2500pci_disable_radio(rt2x00dev); - break; - case STATE_RADIO_IRQ_ON: - case STATE_RADIO_IRQ_OFF: - rt2500pci_toggle_irq(rt2x00dev, state); - break; - case STATE_DEEP_SLEEP: - case STATE_SLEEP: - case STATE_STANDBY: - case STATE_AWAKE: - retval = rt2500pci_set_state(rt2x00dev, state); - break; - default: - retval = -ENOTSUPP; - break; - } - - if (unlikely(retval)) - rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", - state, retval); - - return retval; -} - -/* - * TX descriptor initialization - */ -static void rt2500pci_write_tx_desc(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - __le32 *txd = entry_priv->desc; - u32 word; - - /* - * Start writing the descriptor words. - */ - rt2x00_desc_read(txd, 1, &word); - rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma); - rt2x00_desc_write(txd, 1, word); - - rt2x00_desc_read(txd, 2, &word); - rt2x00_set_field32(&word, TXD_W2_IV_OFFSET, IEEE80211_HEADER); - rt2x00_set_field32(&word, TXD_W2_AIFS, entry->queue->aifs); - rt2x00_set_field32(&word, TXD_W2_CWMIN, entry->queue->cw_min); - rt2x00_set_field32(&word, TXD_W2_CWMAX, entry->queue->cw_max); - rt2x00_desc_write(txd, 2, word); - - rt2x00_desc_read(txd, 3, &word); - rt2x00_set_field32(&word, TXD_W3_PLCP_SIGNAL, txdesc->u.plcp.signal); - rt2x00_set_field32(&word, TXD_W3_PLCP_SERVICE, txdesc->u.plcp.service); - rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_LOW, - txdesc->u.plcp.length_low); - rt2x00_set_field32(&word, TXD_W3_PLCP_LENGTH_HIGH, - txdesc->u.plcp.length_high); - rt2x00_desc_write(txd, 3, word); - - rt2x00_desc_read(txd, 10, &word); - rt2x00_set_field32(&word, TXD_W10_RTS, - test_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags)); - rt2x00_desc_write(txd, 10, word); - - /* - * Writing TXD word 0 must the last to prevent a race condition with - * the device, whereby the device may take hold of the TXD before we - * finished updating it. - */ - rt2x00_desc_read(txd, 0, &word); - rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 1); - rt2x00_set_field32(&word, TXD_W0_VALID, 1); - rt2x00_set_field32(&word, TXD_W0_MORE_FRAG, - test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_ACK, - test_bit(ENTRY_TXD_ACK, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_TIMESTAMP, - test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_OFDM, - (txdesc->rate_mode == RATE_MODE_OFDM)); - rt2x00_set_field32(&word, TXD_W0_CIPHER_OWNER, 1); - rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->u.plcp.ifs); - rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, - test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, txdesc->length); - rt2x00_set_field32(&word, TXD_W0_CIPHER_ALG, CIPHER_NONE); - rt2x00_desc_write(txd, 0, word); - - /* - * Register descriptor details in skb frame descriptor. - */ - skbdesc->desc = txd; - skbdesc->desc_len = TXD_DESC_SIZE; -} - -/* - * TX data initialization - */ -static void rt2500pci_write_beacon(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - u32 reg; - - /* - * Disable beaconing while we are reloading the beacon data, - * otherwise we might be sending out invalid data. - */ - rt2x00mmio_register_read(rt2x00dev, CSR14, ®); - rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); - rt2x00mmio_register_write(rt2x00dev, CSR14, reg); - - if (rt2x00queue_map_txskb(entry)) { - rt2x00_err(rt2x00dev, "Fail to map beacon, aborting\n"); - goto out; - } - - /* - * Write the TX descriptor for the beacon. - */ - rt2500pci_write_tx_desc(entry, txdesc); - - /* - * Dump beacon to userspace through debugfs. - */ - rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb); -out: - /* - * Enable beaconing again. - */ - rt2x00_set_field32(®, CSR14_BEACON_GEN, 1); - rt2x00mmio_register_write(rt2x00dev, CSR14, reg); -} - -/* - * RX control handlers - */ -static void rt2500pci_fill_rxdone(struct queue_entry *entry, - struct rxdone_entry_desc *rxdesc) -{ - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - u32 word0; - u32 word2; - - rt2x00_desc_read(entry_priv->desc, 0, &word0); - rt2x00_desc_read(entry_priv->desc, 2, &word2); - - if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) - rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; - if (rt2x00_get_field32(word0, RXD_W0_PHYSICAL_ERROR)) - rxdesc->flags |= RX_FLAG_FAILED_PLCP_CRC; - - /* - * Obtain the status about this packet. - * When frame was received with an OFDM bitrate, - * the signal is the PLCP value. If it was received with - * a CCK bitrate the signal is the rate in 100kbit/s. - */ - rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL); - rxdesc->rssi = rt2x00_get_field32(word2, RXD_W2_RSSI) - - entry->queue->rt2x00dev->rssi_offset; - rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); - - if (rt2x00_get_field32(word0, RXD_W0_OFDM)) - rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP; - else - rxdesc->dev_flags |= RXDONE_SIGNAL_BITRATE; - if (rt2x00_get_field32(word0, RXD_W0_MY_BSS)) - rxdesc->dev_flags |= RXDONE_MY_BSS; -} - -/* - * Interrupt functions. - */ -static void rt2500pci_txdone(struct rt2x00_dev *rt2x00dev, - const enum data_queue_qid queue_idx) -{ - struct data_queue *queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx); - struct queue_entry_priv_mmio *entry_priv; - struct queue_entry *entry; - struct txdone_entry_desc txdesc; - u32 word; - - while (!rt2x00queue_empty(queue)) { - entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); - entry_priv = entry->priv_data; - rt2x00_desc_read(entry_priv->desc, 0, &word); - - if (rt2x00_get_field32(word, TXD_W0_OWNER_NIC) || - !rt2x00_get_field32(word, TXD_W0_VALID)) - break; - - /* - * Obtain the status about this packet. - */ - txdesc.flags = 0; - switch (rt2x00_get_field32(word, TXD_W0_RESULT)) { - case 0: /* Success */ - case 1: /* Success with retry */ - __set_bit(TXDONE_SUCCESS, &txdesc.flags); - break; - case 2: /* Failure, excessive retries */ - __set_bit(TXDONE_EXCESSIVE_RETRY, &txdesc.flags); - /* Don't break, this is a failed frame! */ - default: /* Failure */ - __set_bit(TXDONE_FAILURE, &txdesc.flags); - } - txdesc.retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT); - - rt2x00lib_txdone(entry, &txdesc); - } -} - -static inline void rt2500pci_enable_interrupt(struct rt2x00_dev *rt2x00dev, - struct rt2x00_field32 irq_field) -{ - u32 reg; - - /* - * Enable a single interrupt. The interrupt mask register - * access needs locking. - */ - spin_lock_irq(&rt2x00dev->irqmask_lock); - - rt2x00mmio_register_read(rt2x00dev, CSR8, ®); - rt2x00_set_field32(®, irq_field, 0); - rt2x00mmio_register_write(rt2x00dev, CSR8, reg); - - spin_unlock_irq(&rt2x00dev->irqmask_lock); -} - -static void rt2500pci_txstatus_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - u32 reg; - - /* - * Handle all tx queues. - */ - rt2500pci_txdone(rt2x00dev, QID_ATIM); - rt2500pci_txdone(rt2x00dev, QID_AC_VO); - rt2500pci_txdone(rt2x00dev, QID_AC_VI); - - /* - * Enable all TXDONE interrupts again. - */ - if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) { - spin_lock_irq(&rt2x00dev->irqmask_lock); - - rt2x00mmio_register_read(rt2x00dev, CSR8, ®); - rt2x00_set_field32(®, CSR8_TXDONE_TXRING, 0); - rt2x00_set_field32(®, CSR8_TXDONE_ATIMRING, 0); - rt2x00_set_field32(®, CSR8_TXDONE_PRIORING, 0); - rt2x00mmio_register_write(rt2x00dev, CSR8, reg); - - spin_unlock_irq(&rt2x00dev->irqmask_lock); - } -} - -static void rt2500pci_tbtt_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - rt2x00lib_beacondone(rt2x00dev); - if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt2500pci_enable_interrupt(rt2x00dev, CSR8_TBCN_EXPIRE); -} - -static void rt2500pci_rxdone_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - if (rt2x00mmio_rxdone(rt2x00dev)) - tasklet_schedule(&rt2x00dev->rxdone_tasklet); - else if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt2500pci_enable_interrupt(rt2x00dev, CSR8_RXDONE); -} - -static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance) -{ - struct rt2x00_dev *rt2x00dev = dev_instance; - u32 reg, mask; - - /* - * Get the interrupt sources & saved to local variable. - * Write register value back to clear pending interrupts. - */ - rt2x00mmio_register_read(rt2x00dev, CSR7, ®); - rt2x00mmio_register_write(rt2x00dev, CSR7, reg); - - if (!reg) - return IRQ_NONE; - - if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - return IRQ_HANDLED; - - mask = reg; - - /* - * Schedule tasklets for interrupt handling. - */ - if (rt2x00_get_field32(reg, CSR7_TBCN_EXPIRE)) - tasklet_hi_schedule(&rt2x00dev->tbtt_tasklet); - - if (rt2x00_get_field32(reg, CSR7_RXDONE)) - tasklet_schedule(&rt2x00dev->rxdone_tasklet); - - if (rt2x00_get_field32(reg, CSR7_TXDONE_ATIMRING) || - rt2x00_get_field32(reg, CSR7_TXDONE_PRIORING) || - rt2x00_get_field32(reg, CSR7_TXDONE_TXRING)) { - tasklet_schedule(&rt2x00dev->txstatus_tasklet); - /* - * Mask out all txdone interrupts. - */ - rt2x00_set_field32(&mask, CSR8_TXDONE_TXRING, 1); - rt2x00_set_field32(&mask, CSR8_TXDONE_ATIMRING, 1); - rt2x00_set_field32(&mask, CSR8_TXDONE_PRIORING, 1); - } - - /* - * Disable all interrupts for which a tasklet was scheduled right now, - * the tasklet will reenable the appropriate interrupts. - */ - spin_lock(&rt2x00dev->irqmask_lock); - - rt2x00mmio_register_read(rt2x00dev, CSR8, ®); - reg |= mask; - rt2x00mmio_register_write(rt2x00dev, CSR8, reg); - - spin_unlock(&rt2x00dev->irqmask_lock); - - return IRQ_HANDLED; -} - -/* - * Device probe functions. - */ -static int rt2500pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) -{ - struct eeprom_93cx6 eeprom; - u32 reg; - u16 word; - u8 *mac; - - rt2x00mmio_register_read(rt2x00dev, CSR21, ®); - - eeprom.data = rt2x00dev; - eeprom.register_read = rt2500pci_eepromregister_read; - eeprom.register_write = rt2500pci_eepromregister_write; - eeprom.width = rt2x00_get_field32(reg, CSR21_TYPE_93C46) ? - PCI_EEPROM_WIDTH_93C46 : PCI_EEPROM_WIDTH_93C66; - eeprom.reg_data_in = 0; - eeprom.reg_data_out = 0; - eeprom.reg_data_clock = 0; - eeprom.reg_chip_select = 0; - - eeprom_93cx6_multiread(&eeprom, EEPROM_BASE, rt2x00dev->eeprom, - EEPROM_SIZE / sizeof(u16)); - - /* - * Start validation of the data that has been read. - */ - mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0); - if (!is_valid_ether_addr(mac)) { - eth_random_addr(mac); - rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_ANTENNA_NUM, 2); - rt2x00_set_field16(&word, EEPROM_ANTENNA_TX_DEFAULT, - ANTENNA_SW_DIVERSITY); - rt2x00_set_field16(&word, EEPROM_ANTENNA_RX_DEFAULT, - ANTENNA_SW_DIVERSITY); - rt2x00_set_field16(&word, EEPROM_ANTENNA_LED_MODE, - LED_MODE_DEFAULT); - rt2x00_set_field16(&word, EEPROM_ANTENNA_DYN_TXAGC, 0); - rt2x00_set_field16(&word, EEPROM_ANTENNA_HARDWARE_RADIO, 0); - rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2522); - rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); - rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0); - rt2x00_set_field16(&word, EEPROM_NIC_DYN_BBP_TUNE, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CCK_TX_POWER, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word); - rt2x00_eeprom_dbg(rt2x00dev, "NIC: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_CALIBRATE_OFFSET, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_CALIBRATE_OFFSET_RSSI, - DEFAULT_RSSI_OFFSET); - rt2x00_eeprom_write(rt2x00dev, EEPROM_CALIBRATE_OFFSET, word); - rt2x00_eeprom_dbg(rt2x00dev, "Calibrate offset: 0x%04x\n", - word); - } - - return 0; -} - -static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - u16 value; - u16 eeprom; - - /* - * Read EEPROM word for configuration. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); - - /* - * Identify RF chipset. - */ - value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); - rt2x00mmio_register_read(rt2x00dev, CSR0, ®); - rt2x00_set_chip(rt2x00dev, RT2560, value, - rt2x00_get_field32(reg, CSR0_REVISION)); - - if (!rt2x00_rf(rt2x00dev, RF2522) && - !rt2x00_rf(rt2x00dev, RF2523) && - !rt2x00_rf(rt2x00dev, RF2524) && - !rt2x00_rf(rt2x00dev, RF2525) && - !rt2x00_rf(rt2x00dev, RF2525E) && - !rt2x00_rf(rt2x00dev, RF5222)) { - rt2x00_err(rt2x00dev, "Invalid RF chipset detected\n"); - return -ENODEV; - } - - /* - * Identify default antenna configuration. - */ - rt2x00dev->default_ant.tx = - rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TX_DEFAULT); - rt2x00dev->default_ant.rx = - rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_DEFAULT); - - /* - * Store led mode, for correct led behaviour. - */ -#ifdef CONFIG_RT2X00_LIB_LEDS - value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE); - - rt2500pci_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO); - if (value == LED_MODE_TXRX_ACTIVITY || - value == LED_MODE_DEFAULT || - value == LED_MODE_ASUS) - rt2500pci_init_led(rt2x00dev, &rt2x00dev->led_qual, - LED_TYPE_ACTIVITY); -#endif /* CONFIG_RT2X00_LIB_LEDS */ - - /* - * Detect if this device has an hardware controlled radio. - */ - if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) - __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); - - /* - * Check if the BBP tuning should be enabled. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); - if (!rt2x00_get_field16(eeprom, EEPROM_NIC_DYN_BBP_TUNE)) - __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags); - - /* - * Read the RSSI <-> dBm offset information. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_CALIBRATE_OFFSET, &eeprom); - rt2x00dev->rssi_offset = - rt2x00_get_field16(eeprom, EEPROM_CALIBRATE_OFFSET_RSSI); - - return 0; -} - -/* - * RF value list for RF2522 - * Supports: 2.4 GHz - */ -static const struct rf_channel rf_vals_bg_2522[] = { - { 1, 0x00002050, 0x000c1fda, 0x00000101, 0 }, - { 2, 0x00002050, 0x000c1fee, 0x00000101, 0 }, - { 3, 0x00002050, 0x000c2002, 0x00000101, 0 }, - { 4, 0x00002050, 0x000c2016, 0x00000101, 0 }, - { 5, 0x00002050, 0x000c202a, 0x00000101, 0 }, - { 6, 0x00002050, 0x000c203e, 0x00000101, 0 }, - { 7, 0x00002050, 0x000c2052, 0x00000101, 0 }, - { 8, 0x00002050, 0x000c2066, 0x00000101, 0 }, - { 9, 0x00002050, 0x000c207a, 0x00000101, 0 }, - { 10, 0x00002050, 0x000c208e, 0x00000101, 0 }, - { 11, 0x00002050, 0x000c20a2, 0x00000101, 0 }, - { 12, 0x00002050, 0x000c20b6, 0x00000101, 0 }, - { 13, 0x00002050, 0x000c20ca, 0x00000101, 0 }, - { 14, 0x00002050, 0x000c20fa, 0x00000101, 0 }, -}; - -/* - * RF value list for RF2523 - * Supports: 2.4 GHz - */ -static const struct rf_channel rf_vals_bg_2523[] = { - { 1, 0x00022010, 0x00000c9e, 0x000e0111, 0x00000a1b }, - { 2, 0x00022010, 0x00000ca2, 0x000e0111, 0x00000a1b }, - { 3, 0x00022010, 0x00000ca6, 0x000e0111, 0x00000a1b }, - { 4, 0x00022010, 0x00000caa, 0x000e0111, 0x00000a1b }, - { 5, 0x00022010, 0x00000cae, 0x000e0111, 0x00000a1b }, - { 6, 0x00022010, 0x00000cb2, 0x000e0111, 0x00000a1b }, - { 7, 0x00022010, 0x00000cb6, 0x000e0111, 0x00000a1b }, - { 8, 0x00022010, 0x00000cba, 0x000e0111, 0x00000a1b }, - { 9, 0x00022010, 0x00000cbe, 0x000e0111, 0x00000a1b }, - { 10, 0x00022010, 0x00000d02, 0x000e0111, 0x00000a1b }, - { 11, 0x00022010, 0x00000d06, 0x000e0111, 0x00000a1b }, - { 12, 0x00022010, 0x00000d0a, 0x000e0111, 0x00000a1b }, - { 13, 0x00022010, 0x00000d0e, 0x000e0111, 0x00000a1b }, - { 14, 0x00022010, 0x00000d1a, 0x000e0111, 0x00000a03 }, -}; - -/* - * RF value list for RF2524 - * Supports: 2.4 GHz - */ -static const struct rf_channel rf_vals_bg_2524[] = { - { 1, 0x00032020, 0x00000c9e, 0x00000101, 0x00000a1b }, - { 2, 0x00032020, 0x00000ca2, 0x00000101, 0x00000a1b }, - { 3, 0x00032020, 0x00000ca6, 0x00000101, 0x00000a1b }, - { 4, 0x00032020, 0x00000caa, 0x00000101, 0x00000a1b }, - { 5, 0x00032020, 0x00000cae, 0x00000101, 0x00000a1b }, - { 6, 0x00032020, 0x00000cb2, 0x00000101, 0x00000a1b }, - { 7, 0x00032020, 0x00000cb6, 0x00000101, 0x00000a1b }, - { 8, 0x00032020, 0x00000cba, 0x00000101, 0x00000a1b }, - { 9, 0x00032020, 0x00000cbe, 0x00000101, 0x00000a1b }, - { 10, 0x00032020, 0x00000d02, 0x00000101, 0x00000a1b }, - { 11, 0x00032020, 0x00000d06, 0x00000101, 0x00000a1b }, - { 12, 0x00032020, 0x00000d0a, 0x00000101, 0x00000a1b }, - { 13, 0x00032020, 0x00000d0e, 0x00000101, 0x00000a1b }, - { 14, 0x00032020, 0x00000d1a, 0x00000101, 0x00000a03 }, -}; - -/* - * RF value list for RF2525 - * Supports: 2.4 GHz - */ -static const struct rf_channel rf_vals_bg_2525[] = { - { 1, 0x00022020, 0x00080c9e, 0x00060111, 0x00000a1b }, - { 2, 0x00022020, 0x00080ca2, 0x00060111, 0x00000a1b }, - { 3, 0x00022020, 0x00080ca6, 0x00060111, 0x00000a1b }, - { 4, 0x00022020, 0x00080caa, 0x00060111, 0x00000a1b }, - { 5, 0x00022020, 0x00080cae, 0x00060111, 0x00000a1b }, - { 6, 0x00022020, 0x00080cb2, 0x00060111, 0x00000a1b }, - { 7, 0x00022020, 0x00080cb6, 0x00060111, 0x00000a1b }, - { 8, 0x00022020, 0x00080cba, 0x00060111, 0x00000a1b }, - { 9, 0x00022020, 0x00080cbe, 0x00060111, 0x00000a1b }, - { 10, 0x00022020, 0x00080d02, 0x00060111, 0x00000a1b }, - { 11, 0x00022020, 0x00080d06, 0x00060111, 0x00000a1b }, - { 12, 0x00022020, 0x00080d0a, 0x00060111, 0x00000a1b }, - { 13, 0x00022020, 0x00080d0e, 0x00060111, 0x00000a1b }, - { 14, 0x00022020, 0x00080d1a, 0x00060111, 0x00000a03 }, -}; - -/* - * RF value list for RF2525e - * Supports: 2.4 GHz - */ -static const struct rf_channel rf_vals_bg_2525e[] = { - { 1, 0x00022020, 0x00081136, 0x00060111, 0x00000a0b }, - { 2, 0x00022020, 0x0008113a, 0x00060111, 0x00000a0b }, - { 3, 0x00022020, 0x0008113e, 0x00060111, 0x00000a0b }, - { 4, 0x00022020, 0x00081182, 0x00060111, 0x00000a0b }, - { 5, 0x00022020, 0x00081186, 0x00060111, 0x00000a0b }, - { 6, 0x00022020, 0x0008118a, 0x00060111, 0x00000a0b }, - { 7, 0x00022020, 0x0008118e, 0x00060111, 0x00000a0b }, - { 8, 0x00022020, 0x00081192, 0x00060111, 0x00000a0b }, - { 9, 0x00022020, 0x00081196, 0x00060111, 0x00000a0b }, - { 10, 0x00022020, 0x0008119a, 0x00060111, 0x00000a0b }, - { 11, 0x00022020, 0x0008119e, 0x00060111, 0x00000a0b }, - { 12, 0x00022020, 0x000811a2, 0x00060111, 0x00000a0b }, - { 13, 0x00022020, 0x000811a6, 0x00060111, 0x00000a0b }, - { 14, 0x00022020, 0x000811ae, 0x00060111, 0x00000a1b }, -}; - -/* - * RF value list for RF5222 - * Supports: 2.4 GHz & 5.2 GHz - */ -static const struct rf_channel rf_vals_5222[] = { - { 1, 0x00022020, 0x00001136, 0x00000101, 0x00000a0b }, - { 2, 0x00022020, 0x0000113a, 0x00000101, 0x00000a0b }, - { 3, 0x00022020, 0x0000113e, 0x00000101, 0x00000a0b }, - { 4, 0x00022020, 0x00001182, 0x00000101, 0x00000a0b }, - { 5, 0x00022020, 0x00001186, 0x00000101, 0x00000a0b }, - { 6, 0x00022020, 0x0000118a, 0x00000101, 0x00000a0b }, - { 7, 0x00022020, 0x0000118e, 0x00000101, 0x00000a0b }, - { 8, 0x00022020, 0x00001192, 0x00000101, 0x00000a0b }, - { 9, 0x00022020, 0x00001196, 0x00000101, 0x00000a0b }, - { 10, 0x00022020, 0x0000119a, 0x00000101, 0x00000a0b }, - { 11, 0x00022020, 0x0000119e, 0x00000101, 0x00000a0b }, - { 12, 0x00022020, 0x000011a2, 0x00000101, 0x00000a0b }, - { 13, 0x00022020, 0x000011a6, 0x00000101, 0x00000a0b }, - { 14, 0x00022020, 0x000011ae, 0x00000101, 0x00000a1b }, - - /* 802.11 UNI / HyperLan 2 */ - { 36, 0x00022010, 0x00018896, 0x00000101, 0x00000a1f }, - { 40, 0x00022010, 0x0001889a, 0x00000101, 0x00000a1f }, - { 44, 0x00022010, 0x0001889e, 0x00000101, 0x00000a1f }, - { 48, 0x00022010, 0x000188a2, 0x00000101, 0x00000a1f }, - { 52, 0x00022010, 0x000188a6, 0x00000101, 0x00000a1f }, - { 66, 0x00022010, 0x000188aa, 0x00000101, 0x00000a1f }, - { 60, 0x00022010, 0x000188ae, 0x00000101, 0x00000a1f }, - { 64, 0x00022010, 0x000188b2, 0x00000101, 0x00000a1f }, - - /* 802.11 HyperLan 2 */ - { 100, 0x00022010, 0x00008802, 0x00000101, 0x00000a0f }, - { 104, 0x00022010, 0x00008806, 0x00000101, 0x00000a0f }, - { 108, 0x00022010, 0x0000880a, 0x00000101, 0x00000a0f }, - { 112, 0x00022010, 0x0000880e, 0x00000101, 0x00000a0f }, - { 116, 0x00022010, 0x00008812, 0x00000101, 0x00000a0f }, - { 120, 0x00022010, 0x00008816, 0x00000101, 0x00000a0f }, - { 124, 0x00022010, 0x0000881a, 0x00000101, 0x00000a0f }, - { 128, 0x00022010, 0x0000881e, 0x00000101, 0x00000a0f }, - { 132, 0x00022010, 0x00008822, 0x00000101, 0x00000a0f }, - { 136, 0x00022010, 0x00008826, 0x00000101, 0x00000a0f }, - - /* 802.11 UNII */ - { 140, 0x00022010, 0x0000882a, 0x00000101, 0x00000a0f }, - { 149, 0x00022020, 0x000090a6, 0x00000101, 0x00000a07 }, - { 153, 0x00022020, 0x000090ae, 0x00000101, 0x00000a07 }, - { 157, 0x00022020, 0x000090b6, 0x00000101, 0x00000a07 }, - { 161, 0x00022020, 0x000090be, 0x00000101, 0x00000a07 }, -}; - -static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) -{ - struct hw_mode_spec *spec = &rt2x00dev->spec; - struct channel_info *info; - char *tx_power; - unsigned int i; - - /* - * Initialize all hw fields. - */ - rt2x00dev->hw->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_PS_NULLFUNC_STACK; - - SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); - SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, - rt2x00_eeprom_addr(rt2x00dev, - EEPROM_MAC_ADDR_0)); - - /* - * Initialize hw_mode information. - */ - spec->supported_bands = SUPPORT_BAND_2GHZ; - spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; - - if (rt2x00_rf(rt2x00dev, RF2522)) { - spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522); - spec->channels = rf_vals_bg_2522; - } else if (rt2x00_rf(rt2x00dev, RF2523)) { - spec->num_channels = ARRAY_SIZE(rf_vals_bg_2523); - spec->channels = rf_vals_bg_2523; - } else if (rt2x00_rf(rt2x00dev, RF2524)) { - spec->num_channels = ARRAY_SIZE(rf_vals_bg_2524); - spec->channels = rf_vals_bg_2524; - } else if (rt2x00_rf(rt2x00dev, RF2525)) { - spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525); - spec->channels = rf_vals_bg_2525; - } else if (rt2x00_rf(rt2x00dev, RF2525E)) { - spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525e); - spec->channels = rf_vals_bg_2525e; - } else if (rt2x00_rf(rt2x00dev, RF5222)) { - spec->supported_bands |= SUPPORT_BAND_5GHZ; - spec->num_channels = ARRAY_SIZE(rf_vals_5222); - spec->channels = rf_vals_5222; - } - - /* - * Create channel information array - */ - info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); - if (!info) - return -ENOMEM; - - spec->channels_info = info; - - tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); - for (i = 0; i < 14; i++) { - info[i].max_power = MAX_TXPOWER; - info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); - } - - if (spec->num_channels > 14) { - for (i = 14; i < spec->num_channels; i++) { - info[i].max_power = MAX_TXPOWER; - info[i].default_power1 = DEFAULT_TXPOWER; - } - } - - return 0; -} - -static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev) -{ - int retval; - u32 reg; - - /* - * Allocate eeprom data. - */ - retval = rt2500pci_validate_eeprom(rt2x00dev); - if (retval) - return retval; - - retval = rt2500pci_init_eeprom(rt2x00dev); - if (retval) - return retval; - - /* - * Enable rfkill polling by setting GPIO direction of the - * rfkill switch GPIO pin correctly. - */ - rt2x00mmio_register_read(rt2x00dev, GPIOCSR, ®); - rt2x00_set_field32(®, GPIOCSR_DIR0, 1); - rt2x00mmio_register_write(rt2x00dev, GPIOCSR, reg); - - /* - * Initialize hw specifications. - */ - retval = rt2500pci_probe_hw_mode(rt2x00dev); - if (retval) - return retval; - - /* - * This device requires the atim queue and DMA-mapped skbs. - */ - __set_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags); - __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags); - __set_bit(REQUIRE_SW_SEQNO, &rt2x00dev->cap_flags); - - /* - * Set the rssi offset. - */ - rt2x00dev->rssi_offset = DEFAULT_RSSI_OFFSET; - - return 0; -} - -/* - * IEEE80211 stack callback functions. - */ -static u64 rt2500pci_get_tsf(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - u64 tsf; - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, CSR17, ®); - tsf = (u64) rt2x00_get_field32(reg, CSR17_HIGH_TSFTIMER) << 32; - rt2x00mmio_register_read(rt2x00dev, CSR16, ®); - tsf |= rt2x00_get_field32(reg, CSR16_LOW_TSFTIMER); - - return tsf; -} - -static int rt2500pci_tx_last_beacon(struct ieee80211_hw *hw) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, CSR15, ®); - return rt2x00_get_field32(reg, CSR15_BEACON_SENT); -} - -static const struct ieee80211_ops rt2500pci_mac80211_ops = { - .tx = rt2x00mac_tx, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, - .remove_interface = rt2x00mac_remove_interface, - .config = rt2x00mac_config, - .configure_filter = rt2x00mac_configure_filter, - .sw_scan_start = rt2x00mac_sw_scan_start, - .sw_scan_complete = rt2x00mac_sw_scan_complete, - .get_stats = rt2x00mac_get_stats, - .bss_info_changed = rt2x00mac_bss_info_changed, - .conf_tx = rt2x00mac_conf_tx, - .get_tsf = rt2500pci_get_tsf, - .tx_last_beacon = rt2500pci_tx_last_beacon, - .rfkill_poll = rt2x00mac_rfkill_poll, - .flush = rt2x00mac_flush, - .set_antenna = rt2x00mac_set_antenna, - .get_antenna = rt2x00mac_get_antenna, - .get_ringparam = rt2x00mac_get_ringparam, - .tx_frames_pending = rt2x00mac_tx_frames_pending, -}; - -static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = { - .irq_handler = rt2500pci_interrupt, - .txstatus_tasklet = rt2500pci_txstatus_tasklet, - .tbtt_tasklet = rt2500pci_tbtt_tasklet, - .rxdone_tasklet = rt2500pci_rxdone_tasklet, - .probe_hw = rt2500pci_probe_hw, - .initialize = rt2x00mmio_initialize, - .uninitialize = rt2x00mmio_uninitialize, - .get_entry_state = rt2500pci_get_entry_state, - .clear_entry = rt2500pci_clear_entry, - .set_device_state = rt2500pci_set_device_state, - .rfkill_poll = rt2500pci_rfkill_poll, - .link_stats = rt2500pci_link_stats, - .reset_tuner = rt2500pci_reset_tuner, - .link_tuner = rt2500pci_link_tuner, - .start_queue = rt2500pci_start_queue, - .kick_queue = rt2500pci_kick_queue, - .stop_queue = rt2500pci_stop_queue, - .flush_queue = rt2x00mmio_flush_queue, - .write_tx_desc = rt2500pci_write_tx_desc, - .write_beacon = rt2500pci_write_beacon, - .fill_rxdone = rt2500pci_fill_rxdone, - .config_filter = rt2500pci_config_filter, - .config_intf = rt2500pci_config_intf, - .config_erp = rt2500pci_config_erp, - .config_ant = rt2500pci_config_ant, - .config = rt2500pci_config, -}; - -static const struct data_queue_desc rt2500pci_queue_rx = { - .entry_num = 32, - .data_size = DATA_FRAME_SIZE, - .desc_size = RXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_mmio), -}; - -static const struct data_queue_desc rt2500pci_queue_tx = { - .entry_num = 32, - .data_size = DATA_FRAME_SIZE, - .desc_size = TXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_mmio), -}; - -static const struct data_queue_desc rt2500pci_queue_bcn = { - .entry_num = 1, - .data_size = MGMT_FRAME_SIZE, - .desc_size = TXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_mmio), -}; - -static const struct data_queue_desc rt2500pci_queue_atim = { - .entry_num = 8, - .data_size = DATA_FRAME_SIZE, - .desc_size = TXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_mmio), -}; - -static const struct rt2x00_ops rt2500pci_ops = { - .name = KBUILD_MODNAME, - .max_ap_intf = 1, - .eeprom_size = EEPROM_SIZE, - .rf_size = RF_SIZE, - .tx_queues = NUM_TX_QUEUES, - .extra_tx_headroom = 0, - .rx = &rt2500pci_queue_rx, - .tx = &rt2500pci_queue_tx, - .bcn = &rt2500pci_queue_bcn, - .atim = &rt2500pci_queue_atim, - .lib = &rt2500pci_rt2x00_ops, - .hw = &rt2500pci_mac80211_ops, -#ifdef CONFIG_RT2X00_LIB_DEBUGFS - .debugfs = &rt2500pci_rt2x00debug, -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -}; - -/* - * RT2500pci module information. - */ -static DEFINE_PCI_DEVICE_TABLE(rt2500pci_device_table) = { - { PCI_DEVICE(0x1814, 0x0201) }, - { 0, } -}; - -MODULE_AUTHOR(DRV_PROJECT); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION("Ralink RT2500 PCI & PCMCIA Wireless LAN driver."); -MODULE_SUPPORTED_DEVICE("Ralink RT2560 PCI & PCMCIA chipset based cards"); -MODULE_DEVICE_TABLE(pci, rt2500pci_device_table); -MODULE_LICENSE("GPL"); - -static int rt2500pci_probe(struct pci_dev *pci_dev, - const struct pci_device_id *id) -{ - return rt2x00pci_probe(pci_dev, &rt2500pci_ops); -} - -static struct pci_driver rt2500pci_driver = { - .name = KBUILD_MODNAME, - .id_table = rt2500pci_device_table, - .probe = rt2500pci_probe, - .remove = rt2x00pci_remove, - .suspend = rt2x00pci_suspend, - .resume = rt2x00pci_resume, -}; - -module_pci_driver(rt2500pci_driver); diff --git a/drivers/net/wireless/rt2x00/rt2500pci.h b/drivers/net/wireless/rt2x00/rt2500pci.h deleted file mode 100644 index 9c10068e4987..000000000000 --- a/drivers/net/wireless/rt2x00/rt2500pci.h +++ /dev/null @@ -1,1237 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2500pci - Abstract: Data structures and registers for the rt2500pci module. - Supported chipsets: RT2560. - */ - -#ifndef RT2500PCI_H -#define RT2500PCI_H - -/* - * RF chip defines. - */ -#define RF2522 0x0000 -#define RF2523 0x0001 -#define RF2524 0x0002 -#define RF2525 0x0003 -#define RF2525E 0x0004 -#define RF5222 0x0010 - -/* - * RT2560 version - */ -#define RT2560_VERSION_B 2 -#define RT2560_VERSION_C 3 -#define RT2560_VERSION_D 4 - -/* - * Signal information. - * Default offset is required for RSSI <-> dBm conversion. - */ -#define DEFAULT_RSSI_OFFSET 121 - -/* - * Register layout information. - */ -#define CSR_REG_BASE 0x0000 -#define CSR_REG_SIZE 0x0174 -#define EEPROM_BASE 0x0000 -#define EEPROM_SIZE 0x0200 -#define BBP_BASE 0x0000 -#define BBP_SIZE 0x0040 -#define RF_BASE 0x0004 -#define RF_SIZE 0x0010 - -/* - * Number of TX queues. - */ -#define NUM_TX_QUEUES 2 - -/* - * Control/Status Registers(CSR). - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * CSR0: ASIC revision number. - */ -#define CSR0 0x0000 -#define CSR0_REVISION FIELD32(0x0000ffff) - -/* - * CSR1: System control register. - * SOFT_RESET: Software reset, 1: reset, 0: normal. - * BBP_RESET: Hardware reset, 1: reset, 0, release. - * HOST_READY: Host ready after initialization. - */ -#define CSR1 0x0004 -#define CSR1_SOFT_RESET FIELD32(0x00000001) -#define CSR1_BBP_RESET FIELD32(0x00000002) -#define CSR1_HOST_READY FIELD32(0x00000004) - -/* - * CSR2: System admin status register (invalid). - */ -#define CSR2 0x0008 - -/* - * CSR3: STA MAC address register 0. - */ -#define CSR3 0x000c -#define CSR3_BYTE0 FIELD32(0x000000ff) -#define CSR3_BYTE1 FIELD32(0x0000ff00) -#define CSR3_BYTE2 FIELD32(0x00ff0000) -#define CSR3_BYTE3 FIELD32(0xff000000) - -/* - * CSR4: STA MAC address register 1. - */ -#define CSR4 0x0010 -#define CSR4_BYTE4 FIELD32(0x000000ff) -#define CSR4_BYTE5 FIELD32(0x0000ff00) - -/* - * CSR5: BSSID register 0. - */ -#define CSR5 0x0014 -#define CSR5_BYTE0 FIELD32(0x000000ff) -#define CSR5_BYTE1 FIELD32(0x0000ff00) -#define CSR5_BYTE2 FIELD32(0x00ff0000) -#define CSR5_BYTE3 FIELD32(0xff000000) - -/* - * CSR6: BSSID register 1. - */ -#define CSR6 0x0018 -#define CSR6_BYTE4 FIELD32(0x000000ff) -#define CSR6_BYTE5 FIELD32(0x0000ff00) - -/* - * CSR7: Interrupt source register. - * Write 1 to clear. - * TBCN_EXPIRE: Beacon timer expired interrupt. - * TWAKE_EXPIRE: Wakeup timer expired interrupt. - * TATIMW_EXPIRE: Timer of atim window expired interrupt. - * TXDONE_TXRING: Tx ring transmit done interrupt. - * TXDONE_ATIMRING: Atim ring transmit done interrupt. - * TXDONE_PRIORING: Priority ring transmit done interrupt. - * RXDONE: Receive done interrupt. - * DECRYPTION_DONE: Decryption done interrupt. - * ENCRYPTION_DONE: Encryption done interrupt. - * UART1_TX_TRESHOLD: UART1 TX reaches threshold. - * UART1_RX_TRESHOLD: UART1 RX reaches threshold. - * UART1_IDLE_TRESHOLD: UART1 IDLE over threshold. - * UART1_TX_BUFF_ERROR: UART1 TX buffer error. - * UART1_RX_BUFF_ERROR: UART1 RX buffer error. - * UART2_TX_TRESHOLD: UART2 TX reaches threshold. - * UART2_RX_TRESHOLD: UART2 RX reaches threshold. - * UART2_IDLE_TRESHOLD: UART2 IDLE over threshold. - * UART2_TX_BUFF_ERROR: UART2 TX buffer error. - * UART2_RX_BUFF_ERROR: UART2 RX buffer error. - * TIMER_CSR3_EXPIRE: TIMECSR3 timer expired (802.1H quiet period). - - */ -#define CSR7 0x001c -#define CSR7_TBCN_EXPIRE FIELD32(0x00000001) -#define CSR7_TWAKE_EXPIRE FIELD32(0x00000002) -#define CSR7_TATIMW_EXPIRE FIELD32(0x00000004) -#define CSR7_TXDONE_TXRING FIELD32(0x00000008) -#define CSR7_TXDONE_ATIMRING FIELD32(0x00000010) -#define CSR7_TXDONE_PRIORING FIELD32(0x00000020) -#define CSR7_RXDONE FIELD32(0x00000040) -#define CSR7_DECRYPTION_DONE FIELD32(0x00000080) -#define CSR7_ENCRYPTION_DONE FIELD32(0x00000100) -#define CSR7_UART1_TX_TRESHOLD FIELD32(0x00000200) -#define CSR7_UART1_RX_TRESHOLD FIELD32(0x00000400) -#define CSR7_UART1_IDLE_TRESHOLD FIELD32(0x00000800) -#define CSR7_UART1_TX_BUFF_ERROR FIELD32(0x00001000) -#define CSR7_UART1_RX_BUFF_ERROR FIELD32(0x00002000) -#define CSR7_UART2_TX_TRESHOLD FIELD32(0x00004000) -#define CSR7_UART2_RX_TRESHOLD FIELD32(0x00008000) -#define CSR7_UART2_IDLE_TRESHOLD FIELD32(0x00010000) -#define CSR7_UART2_TX_BUFF_ERROR FIELD32(0x00020000) -#define CSR7_UART2_RX_BUFF_ERROR FIELD32(0x00040000) -#define CSR7_TIMER_CSR3_EXPIRE FIELD32(0x00080000) - -/* - * CSR8: Interrupt mask register. - * Write 1 to mask interrupt. - * TBCN_EXPIRE: Beacon timer expired interrupt. - * TWAKE_EXPIRE: Wakeup timer expired interrupt. - * TATIMW_EXPIRE: Timer of atim window expired interrupt. - * TXDONE_TXRING: Tx ring transmit done interrupt. - * TXDONE_ATIMRING: Atim ring transmit done interrupt. - * TXDONE_PRIORING: Priority ring transmit done interrupt. - * RXDONE: Receive done interrupt. - * DECRYPTION_DONE: Decryption done interrupt. - * ENCRYPTION_DONE: Encryption done interrupt. - * UART1_TX_TRESHOLD: UART1 TX reaches threshold. - * UART1_RX_TRESHOLD: UART1 RX reaches threshold. - * UART1_IDLE_TRESHOLD: UART1 IDLE over threshold. - * UART1_TX_BUFF_ERROR: UART1 TX buffer error. - * UART1_RX_BUFF_ERROR: UART1 RX buffer error. - * UART2_TX_TRESHOLD: UART2 TX reaches threshold. - * UART2_RX_TRESHOLD: UART2 RX reaches threshold. - * UART2_IDLE_TRESHOLD: UART2 IDLE over threshold. - * UART2_TX_BUFF_ERROR: UART2 TX buffer error. - * UART2_RX_BUFF_ERROR: UART2 RX buffer error. - * TIMER_CSR3_EXPIRE: TIMECSR3 timer expired (802.1H quiet period). - */ -#define CSR8 0x0020 -#define CSR8_TBCN_EXPIRE FIELD32(0x00000001) -#define CSR8_TWAKE_EXPIRE FIELD32(0x00000002) -#define CSR8_TATIMW_EXPIRE FIELD32(0x00000004) -#define CSR8_TXDONE_TXRING FIELD32(0x00000008) -#define CSR8_TXDONE_ATIMRING FIELD32(0x00000010) -#define CSR8_TXDONE_PRIORING FIELD32(0x00000020) -#define CSR8_RXDONE FIELD32(0x00000040) -#define CSR8_DECRYPTION_DONE FIELD32(0x00000080) -#define CSR8_ENCRYPTION_DONE FIELD32(0x00000100) -#define CSR8_UART1_TX_TRESHOLD FIELD32(0x00000200) -#define CSR8_UART1_RX_TRESHOLD FIELD32(0x00000400) -#define CSR8_UART1_IDLE_TRESHOLD FIELD32(0x00000800) -#define CSR8_UART1_TX_BUFF_ERROR FIELD32(0x00001000) -#define CSR8_UART1_RX_BUFF_ERROR FIELD32(0x00002000) -#define CSR8_UART2_TX_TRESHOLD FIELD32(0x00004000) -#define CSR8_UART2_RX_TRESHOLD FIELD32(0x00008000) -#define CSR8_UART2_IDLE_TRESHOLD FIELD32(0x00010000) -#define CSR8_UART2_TX_BUFF_ERROR FIELD32(0x00020000) -#define CSR8_UART2_RX_BUFF_ERROR FIELD32(0x00040000) -#define CSR8_TIMER_CSR3_EXPIRE FIELD32(0x00080000) - -/* - * CSR9: Maximum frame length register. - * MAX_FRAME_UNIT: Maximum frame length in 128b unit, default: 12. - */ -#define CSR9 0x0024 -#define CSR9_MAX_FRAME_UNIT FIELD32(0x00000f80) - -/* - * SECCSR0: WEP control register. - * KICK_DECRYPT: Kick decryption engine, self-clear. - * ONE_SHOT: 0: ring mode, 1: One shot only mode. - * DESC_ADDRESS: Descriptor physical address of frame. - */ -#define SECCSR0 0x0028 -#define SECCSR0_KICK_DECRYPT FIELD32(0x00000001) -#define SECCSR0_ONE_SHOT FIELD32(0x00000002) -#define SECCSR0_DESC_ADDRESS FIELD32(0xfffffffc) - -/* - * CSR11: Back-off control register. - * CWMIN: CWmin. Default cwmin is 31 (2^5 - 1). - * CWMAX: CWmax. Default cwmax is 1023 (2^10 - 1). - * SLOT_TIME: Slot time, default is 20us for 802.11b - * CW_SELECT: CWmin/CWmax selection, 1: Register, 0: TXD. - * LONG_RETRY: Long retry count. - * SHORT_RETRY: Short retry count. - */ -#define CSR11 0x002c -#define CSR11_CWMIN FIELD32(0x0000000f) -#define CSR11_CWMAX FIELD32(0x000000f0) -#define CSR11_SLOT_TIME FIELD32(0x00001f00) -#define CSR11_CW_SELECT FIELD32(0x00002000) -#define CSR11_LONG_RETRY FIELD32(0x00ff0000) -#define CSR11_SHORT_RETRY FIELD32(0xff000000) - -/* - * CSR12: Synchronization configuration register 0. - * All units in 1/16 TU. - * BEACON_INTERVAL: Beacon interval, default is 100 TU. - * CFP_MAX_DURATION: Cfp maximum duration, default is 100 TU. - */ -#define CSR12 0x0030 -#define CSR12_BEACON_INTERVAL FIELD32(0x0000ffff) -#define CSR12_CFP_MAX_DURATION FIELD32(0xffff0000) - -/* - * CSR13: Synchronization configuration register 1. - * All units in 1/16 TU. - * ATIMW_DURATION: Atim window duration. - * CFP_PERIOD: Cfp period, default is 0 TU. - */ -#define CSR13 0x0034 -#define CSR13_ATIMW_DURATION FIELD32(0x0000ffff) -#define CSR13_CFP_PERIOD FIELD32(0x00ff0000) - -/* - * CSR14: Synchronization control register. - * TSF_COUNT: Enable tsf auto counting. - * TSF_SYNC: Tsf sync, 0: disable, 1: infra, 2: ad-hoc/master mode. - * TBCN: Enable tbcn with reload value. - * TCFP: Enable tcfp & cfp / cp switching. - * TATIMW: Enable tatimw & atim window switching. - * BEACON_GEN: Enable beacon generator. - * CFP_COUNT_PRELOAD: Cfp count preload value. - * TBCM_PRELOAD: Tbcn preload value in units of 64us. - */ -#define CSR14 0x0038 -#define CSR14_TSF_COUNT FIELD32(0x00000001) -#define CSR14_TSF_SYNC FIELD32(0x00000006) -#define CSR14_TBCN FIELD32(0x00000008) -#define CSR14_TCFP FIELD32(0x00000010) -#define CSR14_TATIMW FIELD32(0x00000020) -#define CSR14_BEACON_GEN FIELD32(0x00000040) -#define CSR14_CFP_COUNT_PRELOAD FIELD32(0x0000ff00) -#define CSR14_TBCM_PRELOAD FIELD32(0xffff0000) - -/* - * CSR15: Synchronization status register. - * CFP: ASIC is in contention-free period. - * ATIMW: ASIC is in ATIM window. - * BEACON_SENT: Beacon is send. - */ -#define CSR15 0x003c -#define CSR15_CFP FIELD32(0x00000001) -#define CSR15_ATIMW FIELD32(0x00000002) -#define CSR15_BEACON_SENT FIELD32(0x00000004) - -/* - * CSR16: TSF timer register 0. - */ -#define CSR16 0x0040 -#define CSR16_LOW_TSFTIMER FIELD32(0xffffffff) - -/* - * CSR17: TSF timer register 1. - */ -#define CSR17 0x0044 -#define CSR17_HIGH_TSFTIMER FIELD32(0xffffffff) - -/* - * CSR18: IFS timer register 0. - * SIFS: Sifs, default is 10 us. - * PIFS: Pifs, default is 30 us. - */ -#define CSR18 0x0048 -#define CSR18_SIFS FIELD32(0x000001ff) -#define CSR18_PIFS FIELD32(0x001f0000) - -/* - * CSR19: IFS timer register 1. - * DIFS: Difs, default is 50 us. - * EIFS: Eifs, default is 364 us. - */ -#define CSR19 0x004c -#define CSR19_DIFS FIELD32(0x0000ffff) -#define CSR19_EIFS FIELD32(0xffff0000) - -/* - * CSR20: Wakeup timer register. - * DELAY_AFTER_TBCN: Delay after tbcn expired in units of 1/16 TU. - * TBCN_BEFORE_WAKEUP: Number of beacon before wakeup. - * AUTOWAKE: Enable auto wakeup / sleep mechanism. - */ -#define CSR20 0x0050 -#define CSR20_DELAY_AFTER_TBCN FIELD32(0x0000ffff) -#define CSR20_TBCN_BEFORE_WAKEUP FIELD32(0x00ff0000) -#define CSR20_AUTOWAKE FIELD32(0x01000000) - -/* - * CSR21: EEPROM control register. - * RELOAD: Write 1 to reload eeprom content. - * TYPE_93C46: 1: 93c46, 0:93c66. - */ -#define CSR21 0x0054 -#define CSR21_RELOAD FIELD32(0x00000001) -#define CSR21_EEPROM_DATA_CLOCK FIELD32(0x00000002) -#define CSR21_EEPROM_CHIP_SELECT FIELD32(0x00000004) -#define CSR21_EEPROM_DATA_IN FIELD32(0x00000008) -#define CSR21_EEPROM_DATA_OUT FIELD32(0x00000010) -#define CSR21_TYPE_93C46 FIELD32(0x00000020) - -/* - * CSR22: CFP control register. - * CFP_DURATION_REMAIN: Cfp duration remain, in units of TU. - * RELOAD_CFP_DURATION: Write 1 to reload cfp duration remain. - */ -#define CSR22 0x0058 -#define CSR22_CFP_DURATION_REMAIN FIELD32(0x0000ffff) -#define CSR22_RELOAD_CFP_DURATION FIELD32(0x00010000) - -/* - * Transmit related CSRs. - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * TXCSR0: TX Control Register. - * KICK_TX: Kick tx ring. - * KICK_ATIM: Kick atim ring. - * KICK_PRIO: Kick priority ring. - * ABORT: Abort all transmit related ring operation. - */ -#define TXCSR0 0x0060 -#define TXCSR0_KICK_TX FIELD32(0x00000001) -#define TXCSR0_KICK_ATIM FIELD32(0x00000002) -#define TXCSR0_KICK_PRIO FIELD32(0x00000004) -#define TXCSR0_ABORT FIELD32(0x00000008) - -/* - * TXCSR1: TX Configuration Register. - * ACK_TIMEOUT: Ack timeout, default = sifs + 2*slottime + acktime @ 1mbps. - * ACK_CONSUME_TIME: Ack consume time, default = sifs + acktime @ 1mbps. - * TSF_OFFSET: Insert tsf offset. - * AUTORESPONDER: Enable auto responder which include ack & cts. - */ -#define TXCSR1 0x0064 -#define TXCSR1_ACK_TIMEOUT FIELD32(0x000001ff) -#define TXCSR1_ACK_CONSUME_TIME FIELD32(0x0003fe00) -#define TXCSR1_TSF_OFFSET FIELD32(0x00fc0000) -#define TXCSR1_AUTORESPONDER FIELD32(0x01000000) - -/* - * TXCSR2: Tx descriptor configuration register. - * TXD_SIZE: Tx descriptor size, default is 48. - * NUM_TXD: Number of tx entries in ring. - * NUM_ATIM: Number of atim entries in ring. - * NUM_PRIO: Number of priority entries in ring. - */ -#define TXCSR2 0x0068 -#define TXCSR2_TXD_SIZE FIELD32(0x000000ff) -#define TXCSR2_NUM_TXD FIELD32(0x0000ff00) -#define TXCSR2_NUM_ATIM FIELD32(0x00ff0000) -#define TXCSR2_NUM_PRIO FIELD32(0xff000000) - -/* - * TXCSR3: TX Ring Base address register. - */ -#define TXCSR3 0x006c -#define TXCSR3_TX_RING_REGISTER FIELD32(0xffffffff) - -/* - * TXCSR4: TX Atim Ring Base address register. - */ -#define TXCSR4 0x0070 -#define TXCSR4_ATIM_RING_REGISTER FIELD32(0xffffffff) - -/* - * TXCSR5: TX Prio Ring Base address register. - */ -#define TXCSR5 0x0074 -#define TXCSR5_PRIO_RING_REGISTER FIELD32(0xffffffff) - -/* - * TXCSR6: Beacon Base address register. - */ -#define TXCSR6 0x0078 -#define TXCSR6_BEACON_RING_REGISTER FIELD32(0xffffffff) - -/* - * TXCSR7: Auto responder control register. - * AR_POWERMANAGEMENT: Auto responder power management bit. - */ -#define TXCSR7 0x007c -#define TXCSR7_AR_POWERMANAGEMENT FIELD32(0x00000001) - -/* - * TXCSR8: CCK Tx BBP register. - */ -#define TXCSR8 0x0098 -#define TXCSR8_BBP_ID0 FIELD32(0x0000007f) -#define TXCSR8_BBP_ID0_VALID FIELD32(0x00000080) -#define TXCSR8_BBP_ID1 FIELD32(0x00007f00) -#define TXCSR8_BBP_ID1_VALID FIELD32(0x00008000) -#define TXCSR8_BBP_ID2 FIELD32(0x007f0000) -#define TXCSR8_BBP_ID2_VALID FIELD32(0x00800000) -#define TXCSR8_BBP_ID3 FIELD32(0x7f000000) -#define TXCSR8_BBP_ID3_VALID FIELD32(0x80000000) - -/* - * TXCSR9: OFDM TX BBP registers - * OFDM_SIGNAL: BBP rate field address for OFDM. - * OFDM_SERVICE: BBP service field address for OFDM. - * OFDM_LENGTH_LOW: BBP length low byte address for OFDM. - * OFDM_LENGTH_HIGH: BBP length high byte address for OFDM. - */ -#define TXCSR9 0x0094 -#define TXCSR9_OFDM_RATE FIELD32(0x000000ff) -#define TXCSR9_OFDM_SERVICE FIELD32(0x0000ff00) -#define TXCSR9_OFDM_LENGTH_LOW FIELD32(0x00ff0000) -#define TXCSR9_OFDM_LENGTH_HIGH FIELD32(0xff000000) - -/* - * Receive related CSRs. - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * RXCSR0: RX Control Register. - * DISABLE_RX: Disable rx engine. - * DROP_CRC: Drop crc error. - * DROP_PHYSICAL: Drop physical error. - * DROP_CONTROL: Drop control frame. - * DROP_NOT_TO_ME: Drop not to me unicast frame. - * DROP_TODS: Drop frame tods bit is true. - * DROP_VERSION_ERROR: Drop version error frame. - * PASS_CRC: Pass all packets with crc attached. - * PASS_CRC: Pass all packets with crc attached. - * PASS_PLCP: Pass all packets with 4 bytes PLCP attached. - * DROP_MCAST: Drop multicast frames. - * DROP_BCAST: Drop broadcast frames. - * ENABLE_QOS: Accept QOS data frame and parse QOS field. - */ -#define RXCSR0 0x0080 -#define RXCSR0_DISABLE_RX FIELD32(0x00000001) -#define RXCSR0_DROP_CRC FIELD32(0x00000002) -#define RXCSR0_DROP_PHYSICAL FIELD32(0x00000004) -#define RXCSR0_DROP_CONTROL FIELD32(0x00000008) -#define RXCSR0_DROP_NOT_TO_ME FIELD32(0x00000010) -#define RXCSR0_DROP_TODS FIELD32(0x00000020) -#define RXCSR0_DROP_VERSION_ERROR FIELD32(0x00000040) -#define RXCSR0_PASS_CRC FIELD32(0x00000080) -#define RXCSR0_PASS_PLCP FIELD32(0x00000100) -#define RXCSR0_DROP_MCAST FIELD32(0x00000200) -#define RXCSR0_DROP_BCAST FIELD32(0x00000400) -#define RXCSR0_ENABLE_QOS FIELD32(0x00000800) - -/* - * RXCSR1: RX descriptor configuration register. - * RXD_SIZE: Rx descriptor size, default is 32b. - * NUM_RXD: Number of rx entries in ring. - */ -#define RXCSR1 0x0084 -#define RXCSR1_RXD_SIZE FIELD32(0x000000ff) -#define RXCSR1_NUM_RXD FIELD32(0x0000ff00) - -/* - * RXCSR2: RX Ring base address register. - */ -#define RXCSR2 0x0088 -#define RXCSR2_RX_RING_REGISTER FIELD32(0xffffffff) - -/* - * RXCSR3: BBP ID register for Rx operation. - * BBP_ID#: BBP register # id. - * BBP_ID#_VALID: BBP register # id is valid or not. - */ -#define RXCSR3 0x0090 -#define RXCSR3_BBP_ID0 FIELD32(0x0000007f) -#define RXCSR3_BBP_ID0_VALID FIELD32(0x00000080) -#define RXCSR3_BBP_ID1 FIELD32(0x00007f00) -#define RXCSR3_BBP_ID1_VALID FIELD32(0x00008000) -#define RXCSR3_BBP_ID2 FIELD32(0x007f0000) -#define RXCSR3_BBP_ID2_VALID FIELD32(0x00800000) -#define RXCSR3_BBP_ID3 FIELD32(0x7f000000) -#define RXCSR3_BBP_ID3_VALID FIELD32(0x80000000) - -/* - * ARCSR1: Auto Responder PLCP config register 1. - * AR_BBP_DATA#: Auto responder BBP register # data. - * AR_BBP_ID#: Auto responder BBP register # Id. - */ -#define ARCSR1 0x009c -#define ARCSR1_AR_BBP_DATA2 FIELD32(0x000000ff) -#define ARCSR1_AR_BBP_ID2 FIELD32(0x0000ff00) -#define ARCSR1_AR_BBP_DATA3 FIELD32(0x00ff0000) -#define ARCSR1_AR_BBP_ID3 FIELD32(0xff000000) - -/* - * Miscellaneous Registers. - * Some values are set in TU, whereas 1 TU == 1024 us. - - */ - -/* - * PCICSR: PCI control register. - * BIG_ENDIAN: 1: big endian, 0: little endian. - * RX_TRESHOLD: Rx threshold in dw to start pci access - * 0: 16dw (default), 1: 8dw, 2: 4dw, 3: 32dw. - * TX_TRESHOLD: Tx threshold in dw to start pci access - * 0: 0dw (default), 1: 1dw, 2: 4dw, 3: forward. - * BURST_LENTH: Pci burst length 0: 4dw (default, 1: 8dw, 2: 16dw, 3:32dw. - * ENABLE_CLK: Enable clk_run, pci clock can't going down to non-operational. - * READ_MULTIPLE: Enable memory read multiple. - * WRITE_INVALID: Enable memory write & invalid. - */ -#define PCICSR 0x008c -#define PCICSR_BIG_ENDIAN FIELD32(0x00000001) -#define PCICSR_RX_TRESHOLD FIELD32(0x00000006) -#define PCICSR_TX_TRESHOLD FIELD32(0x00000018) -#define PCICSR_BURST_LENTH FIELD32(0x00000060) -#define PCICSR_ENABLE_CLK FIELD32(0x00000080) -#define PCICSR_READ_MULTIPLE FIELD32(0x00000100) -#define PCICSR_WRITE_INVALID FIELD32(0x00000200) - -/* - * CNT0: FCS error count. - * FCS_ERROR: FCS error count, cleared when read. - */ -#define CNT0 0x00a0 -#define CNT0_FCS_ERROR FIELD32(0x0000ffff) - -/* - * Statistic Register. - * CNT1: PLCP error count. - * CNT2: Long error count. - */ -#define TIMECSR2 0x00a8 -#define CNT1 0x00ac -#define CNT2 0x00b0 -#define TIMECSR3 0x00b4 - -/* - * CNT3: CCA false alarm count. - */ -#define CNT3 0x00b8 -#define CNT3_FALSE_CCA FIELD32(0x0000ffff) - -/* - * Statistic Register. - * CNT4: Rx FIFO overflow count. - * CNT5: Tx FIFO underrun count. - */ -#define CNT4 0x00bc -#define CNT5 0x00c0 - -/* - * Baseband Control Register. - */ - -/* - * PWRCSR0: Power mode configuration register. - */ -#define PWRCSR0 0x00c4 - -/* - * Power state transition time registers. - */ -#define PSCSR0 0x00c8 -#define PSCSR1 0x00cc -#define PSCSR2 0x00d0 -#define PSCSR3 0x00d4 - -/* - * PWRCSR1: Manual power control / status register. - * Allowed state: 0 deep_sleep, 1: sleep, 2: standby, 3: awake. - * SET_STATE: Set state. Write 1 to trigger, self cleared. - * BBP_DESIRE_STATE: BBP desired state. - * RF_DESIRE_STATE: RF desired state. - * BBP_CURR_STATE: BBP current state. - * RF_CURR_STATE: RF current state. - * PUT_TO_SLEEP: Put to sleep. Write 1 to trigger, self cleared. - */ -#define PWRCSR1 0x00d8 -#define PWRCSR1_SET_STATE FIELD32(0x00000001) -#define PWRCSR1_BBP_DESIRE_STATE FIELD32(0x00000006) -#define PWRCSR1_RF_DESIRE_STATE FIELD32(0x00000018) -#define PWRCSR1_BBP_CURR_STATE FIELD32(0x00000060) -#define PWRCSR1_RF_CURR_STATE FIELD32(0x00000180) -#define PWRCSR1_PUT_TO_SLEEP FIELD32(0x00000200) - -/* - * TIMECSR: Timer control register. - * US_COUNT: 1 us timer count in units of clock cycles. - * US_64_COUNT: 64 us timer count in units of 1 us timer. - * BEACON_EXPECT: Beacon expect window. - */ -#define TIMECSR 0x00dc -#define TIMECSR_US_COUNT FIELD32(0x000000ff) -#define TIMECSR_US_64_COUNT FIELD32(0x0000ff00) -#define TIMECSR_BEACON_EXPECT FIELD32(0x00070000) - -/* - * MACCSR0: MAC configuration register 0. - */ -#define MACCSR0 0x00e0 - -/* - * MACCSR1: MAC configuration register 1. - * KICK_RX: Kick one-shot rx in one-shot rx mode. - * ONESHOT_RXMODE: Enable one-shot rx mode for debugging. - * BBPRX_RESET_MODE: Ralink bbp rx reset mode. - * AUTO_TXBBP: Auto tx logic access bbp control register. - * AUTO_RXBBP: Auto rx logic access bbp control register. - * LOOPBACK: Loopback mode. 0: normal, 1: internal, 2: external, 3:rsvd. - * INTERSIL_IF: Intersil if calibration pin. - */ -#define MACCSR1 0x00e4 -#define MACCSR1_KICK_RX FIELD32(0x00000001) -#define MACCSR1_ONESHOT_RXMODE FIELD32(0x00000002) -#define MACCSR1_BBPRX_RESET_MODE FIELD32(0x00000004) -#define MACCSR1_AUTO_TXBBP FIELD32(0x00000008) -#define MACCSR1_AUTO_RXBBP FIELD32(0x00000010) -#define MACCSR1_LOOPBACK FIELD32(0x00000060) -#define MACCSR1_INTERSIL_IF FIELD32(0x00000080) - -/* - * RALINKCSR: Ralink Rx auto-reset BBCR. - * AR_BBP_DATA#: Auto reset BBP register # data. - * AR_BBP_ID#: Auto reset BBP register # id. - */ -#define RALINKCSR 0x00e8 -#define RALINKCSR_AR_BBP_DATA0 FIELD32(0x000000ff) -#define RALINKCSR_AR_BBP_ID0 FIELD32(0x00007f00) -#define RALINKCSR_AR_BBP_VALID0 FIELD32(0x00008000) -#define RALINKCSR_AR_BBP_DATA1 FIELD32(0x00ff0000) -#define RALINKCSR_AR_BBP_ID1 FIELD32(0x7f000000) -#define RALINKCSR_AR_BBP_VALID1 FIELD32(0x80000000) - -/* - * BCNCSR: Beacon interval control register. - * CHANGE: Write one to change beacon interval. - * DELTATIME: The delta time value. - * NUM_BEACON: Number of beacon according to mode. - * MODE: Please refer to asic specs. - * PLUS: Plus or minus delta time value. - */ -#define BCNCSR 0x00ec -#define BCNCSR_CHANGE FIELD32(0x00000001) -#define BCNCSR_DELTATIME FIELD32(0x0000001e) -#define BCNCSR_NUM_BEACON FIELD32(0x00001fe0) -#define BCNCSR_MODE FIELD32(0x00006000) -#define BCNCSR_PLUS FIELD32(0x00008000) - -/* - * BBP / RF / IF Control Register. - */ - -/* - * BBPCSR: BBP serial control register. - * VALUE: Register value to program into BBP. - * REGNUM: Selected BBP register. - * BUSY: 1: asic is busy execute BBP programming. - * WRITE_CONTROL: 1: write BBP, 0: read BBP. - */ -#define BBPCSR 0x00f0 -#define BBPCSR_VALUE FIELD32(0x000000ff) -#define BBPCSR_REGNUM FIELD32(0x00007f00) -#define BBPCSR_BUSY FIELD32(0x00008000) -#define BBPCSR_WRITE_CONTROL FIELD32(0x00010000) - -/* - * RFCSR: RF serial control register. - * VALUE: Register value + id to program into rf/if. - * NUMBER_OF_BITS: Number of bits used in value (i:20, rfmd:22). - * IF_SELECT: Chip to program: 0: rf, 1: if. - * PLL_LD: Rf pll_ld status. - * BUSY: 1: asic is busy execute rf programming. - */ -#define RFCSR 0x00f4 -#define RFCSR_VALUE FIELD32(0x00ffffff) -#define RFCSR_NUMBER_OF_BITS FIELD32(0x1f000000) -#define RFCSR_IF_SELECT FIELD32(0x20000000) -#define RFCSR_PLL_LD FIELD32(0x40000000) -#define RFCSR_BUSY FIELD32(0x80000000) - -/* - * LEDCSR: LED control register. - * ON_PERIOD: On period, default 70ms. - * OFF_PERIOD: Off period, default 30ms. - * LINK: 0: linkoff, 1: linkup. - * ACTIVITY: 0: idle, 1: active. - * LINK_POLARITY: 0: active low, 1: active high. - * ACTIVITY_POLARITY: 0: active low, 1: active high. - * LED_DEFAULT: LED state for "enable" 0: ON, 1: OFF. - */ -#define LEDCSR 0x00f8 -#define LEDCSR_ON_PERIOD FIELD32(0x000000ff) -#define LEDCSR_OFF_PERIOD FIELD32(0x0000ff00) -#define LEDCSR_LINK FIELD32(0x00010000) -#define LEDCSR_ACTIVITY FIELD32(0x00020000) -#define LEDCSR_LINK_POLARITY FIELD32(0x00040000) -#define LEDCSR_ACTIVITY_POLARITY FIELD32(0x00080000) -#define LEDCSR_LED_DEFAULT FIELD32(0x00100000) - -/* - * SECCSR3: AES control register. - */ -#define SECCSR3 0x00fc - -/* - * ASIC pointer information. - * RXPTR: Current RX ring address. - * TXPTR: Current Tx ring address. - * PRIPTR: Current Priority ring address. - * ATIMPTR: Current ATIM ring address. - */ -#define RXPTR 0x0100 -#define TXPTR 0x0104 -#define PRIPTR 0x0108 -#define ATIMPTR 0x010c - -/* - * TXACKCSR0: TX ACK timeout. - */ -#define TXACKCSR0 0x0110 - -/* - * ACK timeout count registers. - * ACKCNT0: TX ACK timeout count. - * ACKCNT1: RX ACK timeout count. - */ -#define ACKCNT0 0x0114 -#define ACKCNT1 0x0118 - -/* - * GPIO and others. - */ - -/* - * GPIOCSR: GPIO control register. - * GPIOCSR_VALx: GPIO value - * GPIOCSR_DIRx: GPIO direction: 0 = output; 1 = input - */ -#define GPIOCSR 0x0120 -#define GPIOCSR_VAL0 FIELD32(0x00000001) -#define GPIOCSR_VAL1 FIELD32(0x00000002) -#define GPIOCSR_VAL2 FIELD32(0x00000004) -#define GPIOCSR_VAL3 FIELD32(0x00000008) -#define GPIOCSR_VAL4 FIELD32(0x00000010) -#define GPIOCSR_VAL5 FIELD32(0x00000020) -#define GPIOCSR_VAL6 FIELD32(0x00000040) -#define GPIOCSR_VAL7 FIELD32(0x00000080) -#define GPIOCSR_DIR0 FIELD32(0x00000100) -#define GPIOCSR_DIR1 FIELD32(0x00000200) -#define GPIOCSR_DIR2 FIELD32(0x00000400) -#define GPIOCSR_DIR3 FIELD32(0x00000800) -#define GPIOCSR_DIR4 FIELD32(0x00001000) -#define GPIOCSR_DIR5 FIELD32(0x00002000) -#define GPIOCSR_DIR6 FIELD32(0x00004000) -#define GPIOCSR_DIR7 FIELD32(0x00008000) - -/* - * FIFO pointer registers. - * FIFOCSR0: TX FIFO pointer. - * FIFOCSR1: RX FIFO pointer. - */ -#define FIFOCSR0 0x0128 -#define FIFOCSR1 0x012c - -/* - * BCNCSR1: Tx BEACON offset time control register. - * PRELOAD: Beacon timer offset in units of usec. - * BEACON_CWMIN: 2^CwMin. - */ -#define BCNCSR1 0x0130 -#define BCNCSR1_PRELOAD FIELD32(0x0000ffff) -#define BCNCSR1_BEACON_CWMIN FIELD32(0x000f0000) - -/* - * MACCSR2: TX_PE to RX_PE turn-around time control register - * DELAY: RX_PE low width, in units of pci clock cycle. - */ -#define MACCSR2 0x0134 -#define MACCSR2_DELAY FIELD32(0x000000ff) - -/* - * TESTCSR: TEST mode selection register. - */ -#define TESTCSR 0x0138 - -/* - * ARCSR2: 1 Mbps ACK/CTS PLCP. - */ -#define ARCSR2 0x013c -#define ARCSR2_SIGNAL FIELD32(0x000000ff) -#define ARCSR2_SERVICE FIELD32(0x0000ff00) -#define ARCSR2_LENGTH FIELD32(0xffff0000) - -/* - * ARCSR3: 2 Mbps ACK/CTS PLCP. - */ -#define ARCSR3 0x0140 -#define ARCSR3_SIGNAL FIELD32(0x000000ff) -#define ARCSR3_SERVICE FIELD32(0x0000ff00) -#define ARCSR3_LENGTH FIELD32(0xffff0000) - -/* - * ARCSR4: 5.5 Mbps ACK/CTS PLCP. - */ -#define ARCSR4 0x0144 -#define ARCSR4_SIGNAL FIELD32(0x000000ff) -#define ARCSR4_SERVICE FIELD32(0x0000ff00) -#define ARCSR4_LENGTH FIELD32(0xffff0000) - -/* - * ARCSR5: 11 Mbps ACK/CTS PLCP. - */ -#define ARCSR5 0x0148 -#define ARCSR5_SIGNAL FIELD32(0x000000ff) -#define ARCSR5_SERVICE FIELD32(0x0000ff00) -#define ARCSR5_LENGTH FIELD32(0xffff0000) - -/* - * ARTCSR0: CCK ACK/CTS payload consumed time for 1/2/5.5/11 mbps. - */ -#define ARTCSR0 0x014c -#define ARTCSR0_ACK_CTS_11MBS FIELD32(0x000000ff) -#define ARTCSR0_ACK_CTS_5_5MBS FIELD32(0x0000ff00) -#define ARTCSR0_ACK_CTS_2MBS FIELD32(0x00ff0000) -#define ARTCSR0_ACK_CTS_1MBS FIELD32(0xff000000) - - -/* - * ARTCSR1: OFDM ACK/CTS payload consumed time for 6/9/12/18 mbps. - */ -#define ARTCSR1 0x0150 -#define ARTCSR1_ACK_CTS_6MBS FIELD32(0x000000ff) -#define ARTCSR1_ACK_CTS_9MBS FIELD32(0x0000ff00) -#define ARTCSR1_ACK_CTS_12MBS FIELD32(0x00ff0000) -#define ARTCSR1_ACK_CTS_18MBS FIELD32(0xff000000) - -/* - * ARTCSR2: OFDM ACK/CTS payload consumed time for 24/36/48/54 mbps. - */ -#define ARTCSR2 0x0154 -#define ARTCSR2_ACK_CTS_24MBS FIELD32(0x000000ff) -#define ARTCSR2_ACK_CTS_36MBS FIELD32(0x0000ff00) -#define ARTCSR2_ACK_CTS_48MBS FIELD32(0x00ff0000) -#define ARTCSR2_ACK_CTS_54MBS FIELD32(0xff000000) - -/* - * SECCSR1: WEP control register. - * KICK_ENCRYPT: Kick encryption engine, self-clear. - * ONE_SHOT: 0: ring mode, 1: One shot only mode. - * DESC_ADDRESS: Descriptor physical address of frame. - */ -#define SECCSR1 0x0158 -#define SECCSR1_KICK_ENCRYPT FIELD32(0x00000001) -#define SECCSR1_ONE_SHOT FIELD32(0x00000002) -#define SECCSR1_DESC_ADDRESS FIELD32(0xfffffffc) - -/* - * BBPCSR1: BBP TX configuration. - */ -#define BBPCSR1 0x015c -#define BBPCSR1_CCK FIELD32(0x00000003) -#define BBPCSR1_CCK_FLIP FIELD32(0x00000004) -#define BBPCSR1_OFDM FIELD32(0x00030000) -#define BBPCSR1_OFDM_FLIP FIELD32(0x00040000) - -/* - * Dual band configuration registers. - * DBANDCSR0: Dual band configuration register 0. - * DBANDCSR1: Dual band configuration register 1. - */ -#define DBANDCSR0 0x0160 -#define DBANDCSR1 0x0164 - -/* - * BBPPCSR: BBP Pin control register. - */ -#define BBPPCSR 0x0168 - -/* - * MAC special debug mode selection registers. - * DBGSEL0: MAC special debug mode selection register 0. - * DBGSEL1: MAC special debug mode selection register 1. - */ -#define DBGSEL0 0x016c -#define DBGSEL1 0x0170 - -/* - * BISTCSR: BBP BIST register. - */ -#define BISTCSR 0x0174 - -/* - * Multicast filter registers. - * MCAST0: Multicast filter register 0. - * MCAST1: Multicast filter register 1. - */ -#define MCAST0 0x0178 -#define MCAST1 0x017c - -/* - * UART registers. - * UARTCSR0: UART1 TX register. - * UARTCSR1: UART1 RX register. - * UARTCSR3: UART1 frame control register. - * UARTCSR4: UART1 buffer control register. - * UART2CSR0: UART2 TX register. - * UART2CSR1: UART2 RX register. - * UART2CSR3: UART2 frame control register. - * UART2CSR4: UART2 buffer control register. - */ -#define UARTCSR0 0x0180 -#define UARTCSR1 0x0184 -#define UARTCSR3 0x0188 -#define UARTCSR4 0x018c -#define UART2CSR0 0x0190 -#define UART2CSR1 0x0194 -#define UART2CSR3 0x0198 -#define UART2CSR4 0x019c - -/* - * BBP registers. - * The wordsize of the BBP is 8 bits. - */ - -/* - * R2: TX antenna control - */ -#define BBP_R2_TX_ANTENNA FIELD8(0x03) -#define BBP_R2_TX_IQ_FLIP FIELD8(0x04) - -/* - * R14: RX antenna control - */ -#define BBP_R14_RX_ANTENNA FIELD8(0x03) -#define BBP_R14_RX_IQ_FLIP FIELD8(0x04) - -/* - * BBP_R70 - */ -#define BBP_R70_JAPAN_FILTER FIELD8(0x08) - -/* - * RF registers - */ - -/* - * RF 1 - */ -#define RF1_TUNER FIELD32(0x00020000) - -/* - * RF 3 - */ -#define RF3_TUNER FIELD32(0x00000100) -#define RF3_TXPOWER FIELD32(0x00003e00) - -/* - * EEPROM content. - * The wordsize of the EEPROM is 16 bits. - */ - -/* - * HW MAC address. - */ -#define EEPROM_MAC_ADDR_0 0x0002 -#define EEPROM_MAC_ADDR_BYTE0 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE1 FIELD16(0xff00) -#define EEPROM_MAC_ADDR1 0x0003 -#define EEPROM_MAC_ADDR_BYTE2 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE3 FIELD16(0xff00) -#define EEPROM_MAC_ADDR_2 0x0004 -#define EEPROM_MAC_ADDR_BYTE4 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE5 FIELD16(0xff00) - -/* - * EEPROM antenna. - * ANTENNA_NUM: Number of antenna's. - * TX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B. - * RX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B. - * LED_MODE: 0: default, 1: TX/RX activity,2: Single (ignore link), 3: rsvd. - * DYN_TXAGC: Dynamic TX AGC control. - * HARDWARE_RADIO: 1: Hardware controlled radio. Read GPIO0. - * RF_TYPE: Rf_type of this adapter. - */ -#define EEPROM_ANTENNA 0x10 -#define EEPROM_ANTENNA_NUM FIELD16(0x0003) -#define EEPROM_ANTENNA_TX_DEFAULT FIELD16(0x000c) -#define EEPROM_ANTENNA_RX_DEFAULT FIELD16(0x0030) -#define EEPROM_ANTENNA_LED_MODE FIELD16(0x01c0) -#define EEPROM_ANTENNA_DYN_TXAGC FIELD16(0x0200) -#define EEPROM_ANTENNA_HARDWARE_RADIO FIELD16(0x0400) -#define EEPROM_ANTENNA_RF_TYPE FIELD16(0xf800) - -/* - * EEPROM NIC config. - * CARDBUS_ACCEL: 0: enable, 1: disable. - * DYN_BBP_TUNE: 0: enable, 1: disable. - * CCK_TX_POWER: CCK TX power compensation. - */ -#define EEPROM_NIC 0x11 -#define EEPROM_NIC_CARDBUS_ACCEL FIELD16(0x0001) -#define EEPROM_NIC_DYN_BBP_TUNE FIELD16(0x0002) -#define EEPROM_NIC_CCK_TX_POWER FIELD16(0x000c) - -/* - * EEPROM geography. - * GEO: Default geography setting for device. - */ -#define EEPROM_GEOGRAPHY 0x12 -#define EEPROM_GEOGRAPHY_GEO FIELD16(0x0f00) - -/* - * EEPROM BBP. - */ -#define EEPROM_BBP_START 0x13 -#define EEPROM_BBP_SIZE 16 -#define EEPROM_BBP_VALUE FIELD16(0x00ff) -#define EEPROM_BBP_REG_ID FIELD16(0xff00) - -/* - * EEPROM TXPOWER - */ -#define EEPROM_TXPOWER_START 0x23 -#define EEPROM_TXPOWER_SIZE 7 -#define EEPROM_TXPOWER_1 FIELD16(0x00ff) -#define EEPROM_TXPOWER_2 FIELD16(0xff00) - -/* - * RSSI <-> dBm offset calibration - */ -#define EEPROM_CALIBRATE_OFFSET 0x3e -#define EEPROM_CALIBRATE_OFFSET_RSSI FIELD16(0x00ff) - -/* - * DMA descriptor defines. - */ -#define TXD_DESC_SIZE (11 * sizeof(__le32)) -#define RXD_DESC_SIZE (11 * sizeof(__le32)) - -/* - * TX descriptor format for TX, PRIO, ATIM and Beacon Ring. - */ - -/* - * Word0 - */ -#define TXD_W0_OWNER_NIC FIELD32(0x00000001) -#define TXD_W0_VALID FIELD32(0x00000002) -#define TXD_W0_RESULT FIELD32(0x0000001c) -#define TXD_W0_RETRY_COUNT FIELD32(0x000000e0) -#define TXD_W0_MORE_FRAG FIELD32(0x00000100) -#define TXD_W0_ACK FIELD32(0x00000200) -#define TXD_W0_TIMESTAMP FIELD32(0x00000400) -#define TXD_W0_OFDM FIELD32(0x00000800) -#define TXD_W0_CIPHER_OWNER FIELD32(0x00001000) -#define TXD_W0_IFS FIELD32(0x00006000) -#define TXD_W0_RETRY_MODE FIELD32(0x00008000) -#define TXD_W0_DATABYTE_COUNT FIELD32(0x0fff0000) -#define TXD_W0_CIPHER_ALG FIELD32(0xe0000000) - -/* - * Word1 - */ -#define TXD_W1_BUFFER_ADDRESS FIELD32(0xffffffff) - -/* - * Word2 - */ -#define TXD_W2_IV_OFFSET FIELD32(0x0000003f) -#define TXD_W2_AIFS FIELD32(0x000000c0) -#define TXD_W2_CWMIN FIELD32(0x00000f00) -#define TXD_W2_CWMAX FIELD32(0x0000f000) - -/* - * Word3: PLCP information - */ -#define TXD_W3_PLCP_SIGNAL FIELD32(0x000000ff) -#define TXD_W3_PLCP_SERVICE FIELD32(0x0000ff00) -#define TXD_W3_PLCP_LENGTH_LOW FIELD32(0x00ff0000) -#define TXD_W3_PLCP_LENGTH_HIGH FIELD32(0xff000000) - -/* - * Word4 - */ -#define TXD_W4_IV FIELD32(0xffffffff) - -/* - * Word5 - */ -#define TXD_W5_EIV FIELD32(0xffffffff) - -/* - * Word6-9: Key - */ -#define TXD_W6_KEY FIELD32(0xffffffff) -#define TXD_W7_KEY FIELD32(0xffffffff) -#define TXD_W8_KEY FIELD32(0xffffffff) -#define TXD_W9_KEY FIELD32(0xffffffff) - -/* - * Word10 - */ -#define TXD_W10_RTS FIELD32(0x00000001) -#define TXD_W10_TX_RATE FIELD32(0x000000fe) - -/* - * RX descriptor format for RX Ring. - */ - -/* - * Word0 - */ -#define RXD_W0_OWNER_NIC FIELD32(0x00000001) -#define RXD_W0_UNICAST_TO_ME FIELD32(0x00000002) -#define RXD_W0_MULTICAST FIELD32(0x00000004) -#define RXD_W0_BROADCAST FIELD32(0x00000008) -#define RXD_W0_MY_BSS FIELD32(0x00000010) -#define RXD_W0_CRC_ERROR FIELD32(0x00000020) -#define RXD_W0_OFDM FIELD32(0x00000040) -#define RXD_W0_PHYSICAL_ERROR FIELD32(0x00000080) -#define RXD_W0_CIPHER_OWNER FIELD32(0x00000100) -#define RXD_W0_ICV_ERROR FIELD32(0x00000200) -#define RXD_W0_IV_OFFSET FIELD32(0x0000fc00) -#define RXD_W0_DATABYTE_COUNT FIELD32(0x0fff0000) -#define RXD_W0_CIPHER_ALG FIELD32(0xe0000000) - -/* - * Word1 - */ -#define RXD_W1_BUFFER_ADDRESS FIELD32(0xffffffff) - -/* - * Word2 - */ -#define RXD_W2_SIGNAL FIELD32(0x000000ff) -#define RXD_W2_RSSI FIELD32(0x0000ff00) -#define RXD_W2_TA FIELD32(0xffff0000) - -/* - * Word3 - */ -#define RXD_W3_TA FIELD32(0xffffffff) - -/* - * Word4 - */ -#define RXD_W4_IV FIELD32(0xffffffff) - -/* - * Word5 - */ -#define RXD_W5_EIV FIELD32(0xffffffff) - -/* - * Word6-9: Key - */ -#define RXD_W6_KEY FIELD32(0xffffffff) -#define RXD_W7_KEY FIELD32(0xffffffff) -#define RXD_W8_KEY FIELD32(0xffffffff) -#define RXD_W9_KEY FIELD32(0xffffffff) - -/* - * Word10 - */ -#define RXD_W10_DROP FIELD32(0x00000001) - -/* - * Macros for converting txpower from EEPROM to mac80211 value - * and from mac80211 value to register value. - */ -#define MIN_TXPOWER 0 -#define MAX_TXPOWER 31 -#define DEFAULT_TXPOWER 24 - -#define TXPOWER_FROM_DEV(__txpower) \ - (((u8)(__txpower)) > MAX_TXPOWER) ? DEFAULT_TXPOWER : (__txpower) - -#define TXPOWER_TO_DEV(__txpower) \ - clamp_t(char, __txpower, MIN_TXPOWER, MAX_TXPOWER) - -#endif /* RT2500PCI_H */ diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c deleted file mode 100644 index a7f7b365eff4..000000000000 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ /dev/null @@ -1,1996 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2500usb - Abstract: rt2500usb device specific routines. - Supported chipsets: RT2570. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2x00usb.h" -#include "rt2500usb.h" - -/* - * Allow hardware encryption to be disabled. - */ -static bool modparam_nohwcrypt; -module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); -MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); - -/* - * Register access. - * All access to the CSR registers will go through the methods - * rt2500usb_register_read and rt2500usb_register_write. - * BBP and RF register require indirect register access, - * and use the CSR registers BBPCSR and RFCSR to achieve this. - * These indirect registers work with busy bits, - * and we will try maximal REGISTER_BUSY_COUNT times to access - * the register while taking a REGISTER_BUSY_DELAY us delay - * between each attampt. When the busy bit is still set at that time, - * the access attempt is considered to have failed, - * and we will print an error. - * If the csr_mutex is already held then the _lock variants must - * be used instead. - */ -static inline void rt2500usb_register_read(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u16 *value) -{ - __le16 reg; - rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_READ, - USB_VENDOR_REQUEST_IN, offset, - ®, sizeof(reg), REGISTER_TIMEOUT); - *value = le16_to_cpu(reg); -} - -static inline void rt2500usb_register_read_lock(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u16 *value) -{ - __le16 reg; - rt2x00usb_vendor_req_buff_lock(rt2x00dev, USB_MULTI_READ, - USB_VENDOR_REQUEST_IN, offset, - ®, sizeof(reg), REGISTER_TIMEOUT); - *value = le16_to_cpu(reg); -} - -static inline void rt2500usb_register_multiread(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - void *value, const u16 length) -{ - rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_READ, - USB_VENDOR_REQUEST_IN, offset, - value, length, - REGISTER_TIMEOUT16(length)); -} - -static inline void rt2500usb_register_write(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u16 value) -{ - __le16 reg = cpu_to_le16(value); - rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_WRITE, - USB_VENDOR_REQUEST_OUT, offset, - ®, sizeof(reg), REGISTER_TIMEOUT); -} - -static inline void rt2500usb_register_write_lock(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u16 value) -{ - __le16 reg = cpu_to_le16(value); - rt2x00usb_vendor_req_buff_lock(rt2x00dev, USB_MULTI_WRITE, - USB_VENDOR_REQUEST_OUT, offset, - ®, sizeof(reg), REGISTER_TIMEOUT); -} - -static inline void rt2500usb_register_multiwrite(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - void *value, const u16 length) -{ - rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_WRITE, - USB_VENDOR_REQUEST_OUT, offset, - value, length, - REGISTER_TIMEOUT16(length)); -} - -static int rt2500usb_regbusy_read(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - struct rt2x00_field16 field, - u16 *reg) -{ - unsigned int i; - - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2500usb_register_read_lock(rt2x00dev, offset, reg); - if (!rt2x00_get_field16(*reg, field)) - return 1; - udelay(REGISTER_BUSY_DELAY); - } - - rt2x00_err(rt2x00dev, "Indirect register access failed: offset=0x%.08x, value=0x%.08x\n", - offset, *reg); - *reg = ~0; - - return 0; -} - -#define WAIT_FOR_BBP(__dev, __reg) \ - rt2500usb_regbusy_read((__dev), PHY_CSR8, PHY_CSR8_BUSY, (__reg)) -#define WAIT_FOR_RF(__dev, __reg) \ - rt2500usb_regbusy_read((__dev), PHY_CSR10, PHY_CSR10_RF_BUSY, (__reg)) - -static void rt2500usb_bbp_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, const u8 value) -{ - u16 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the BBP becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_BBP(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field16(®, PHY_CSR7_DATA, value); - rt2x00_set_field16(®, PHY_CSR7_REG_ID, word); - rt2x00_set_field16(®, PHY_CSR7_READ_CONTROL, 0); - - rt2500usb_register_write_lock(rt2x00dev, PHY_CSR7, reg); - } - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt2500usb_bbp_read(struct rt2x00_dev *rt2x00dev, - const unsigned int word, u8 *value) -{ - u16 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the BBP becomes available, afterwards we - * can safely write the read request into the register. - * After the data has been written, we wait until hardware - * returns the correct value, if at any time the register - * doesn't become available in time, reg will be 0xffffffff - * which means we return 0xff to the caller. - */ - if (WAIT_FOR_BBP(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field16(®, PHY_CSR7_REG_ID, word); - rt2x00_set_field16(®, PHY_CSR7_READ_CONTROL, 1); - - rt2500usb_register_write_lock(rt2x00dev, PHY_CSR7, reg); - - if (WAIT_FOR_BBP(rt2x00dev, ®)) - rt2500usb_register_read_lock(rt2x00dev, PHY_CSR7, ®); - } - - *value = rt2x00_get_field16(reg, PHY_CSR7_DATA); - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt2500usb_rf_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, const u32 value) -{ - u16 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the RF becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_RF(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field16(®, PHY_CSR9_RF_VALUE, value); - rt2500usb_register_write_lock(rt2x00dev, PHY_CSR9, reg); - - reg = 0; - rt2x00_set_field16(®, PHY_CSR10_RF_VALUE, value >> 16); - rt2x00_set_field16(®, PHY_CSR10_RF_NUMBER_OF_BITS, 20); - rt2x00_set_field16(®, PHY_CSR10_RF_IF_SELECT, 0); - rt2x00_set_field16(®, PHY_CSR10_RF_BUSY, 1); - - rt2500usb_register_write_lock(rt2x00dev, PHY_CSR10, reg); - rt2x00_rf_write(rt2x00dev, word, value); - } - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -#ifdef CONFIG_RT2X00_LIB_DEBUGFS -static void _rt2500usb_register_read(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u32 *value) -{ - rt2500usb_register_read(rt2x00dev, offset, (u16 *)value); -} - -static void _rt2500usb_register_write(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u32 value) -{ - rt2500usb_register_write(rt2x00dev, offset, value); -} - -static const struct rt2x00debug rt2500usb_rt2x00debug = { - .owner = THIS_MODULE, - .csr = { - .read = _rt2500usb_register_read, - .write = _rt2500usb_register_write, - .flags = RT2X00DEBUGFS_OFFSET, - .word_base = CSR_REG_BASE, - .word_size = sizeof(u16), - .word_count = CSR_REG_SIZE / sizeof(u16), - }, - .eeprom = { - .read = rt2x00_eeprom_read, - .write = rt2x00_eeprom_write, - .word_base = EEPROM_BASE, - .word_size = sizeof(u16), - .word_count = EEPROM_SIZE / sizeof(u16), - }, - .bbp = { - .read = rt2500usb_bbp_read, - .write = rt2500usb_bbp_write, - .word_base = BBP_BASE, - .word_size = sizeof(u8), - .word_count = BBP_SIZE / sizeof(u8), - }, - .rf = { - .read = rt2x00_rf_read, - .write = rt2500usb_rf_write, - .word_base = RF_BASE, - .word_size = sizeof(u32), - .word_count = RF_SIZE / sizeof(u32), - }, -}; -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ - -static int rt2500usb_rfkill_poll(struct rt2x00_dev *rt2x00dev) -{ - u16 reg; - - rt2500usb_register_read(rt2x00dev, MAC_CSR19, ®); - return rt2x00_get_field16(reg, MAC_CSR19_VAL7); -} - -#ifdef CONFIG_RT2X00_LIB_LEDS -static void rt2500usb_brightness_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct rt2x00_led *led = - container_of(led_cdev, struct rt2x00_led, led_dev); - unsigned int enabled = brightness != LED_OFF; - u16 reg; - - rt2500usb_register_read(led->rt2x00dev, MAC_CSR20, ®); - - if (led->type == LED_TYPE_RADIO || led->type == LED_TYPE_ASSOC) - rt2x00_set_field16(®, MAC_CSR20_LINK, enabled); - else if (led->type == LED_TYPE_ACTIVITY) - rt2x00_set_field16(®, MAC_CSR20_ACTIVITY, enabled); - - rt2500usb_register_write(led->rt2x00dev, MAC_CSR20, reg); -} - -static int rt2500usb_blink_set(struct led_classdev *led_cdev, - unsigned long *delay_on, - unsigned long *delay_off) -{ - struct rt2x00_led *led = - container_of(led_cdev, struct rt2x00_led, led_dev); - u16 reg; - - rt2500usb_register_read(led->rt2x00dev, MAC_CSR21, ®); - rt2x00_set_field16(®, MAC_CSR21_ON_PERIOD, *delay_on); - rt2x00_set_field16(®, MAC_CSR21_OFF_PERIOD, *delay_off); - rt2500usb_register_write(led->rt2x00dev, MAC_CSR21, reg); - - return 0; -} - -static void rt2500usb_init_led(struct rt2x00_dev *rt2x00dev, - struct rt2x00_led *led, - enum led_type type) -{ - led->rt2x00dev = rt2x00dev; - led->type = type; - led->led_dev.brightness_set = rt2500usb_brightness_set; - led->led_dev.blink_set = rt2500usb_blink_set; - led->flags = LED_INITIALIZED; -} -#endif /* CONFIG_RT2X00_LIB_LEDS */ - -/* - * Configuration handlers. - */ - -/* - * rt2500usb does not differentiate between shared and pairwise - * keys, so we should use the same function for both key types. - */ -static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_crypto *crypto, - struct ieee80211_key_conf *key) -{ - u32 mask; - u16 reg; - enum cipher curr_cipher; - - if (crypto->cmd == SET_KEY) { - /* - * Disallow to set WEP key other than with index 0, - * it is known that not work at least on some hardware. - * SW crypto will be used in that case. - */ - if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 || - key->cipher == WLAN_CIPHER_SUITE_WEP104) && - key->keyidx != 0) - return -EOPNOTSUPP; - - /* - * Pairwise key will always be entry 0, but this - * could collide with a shared key on the same - * position... - */ - mask = TXRX_CSR0_KEY_ID.bit_mask; - - rt2500usb_register_read(rt2x00dev, TXRX_CSR0, ®); - curr_cipher = rt2x00_get_field16(reg, TXRX_CSR0_ALGORITHM); - reg &= mask; - - if (reg && reg == mask) - return -ENOSPC; - - reg = rt2x00_get_field16(reg, TXRX_CSR0_KEY_ID); - - key->hw_key_idx += reg ? ffz(reg) : 0; - /* - * Hardware requires that all keys use the same cipher - * (e.g. TKIP-only, AES-only, but not TKIP+AES). - * If this is not the first key, compare the cipher with the - * first one and fall back to SW crypto if not the same. - */ - if (key->hw_key_idx > 0 && crypto->cipher != curr_cipher) - return -EOPNOTSUPP; - - rt2500usb_register_multiwrite(rt2x00dev, KEY_ENTRY(key->hw_key_idx), - crypto->key, sizeof(crypto->key)); - - /* - * The driver does not support the IV/EIV generation - * in hardware. However it demands the data to be provided - * both separately as well as inside the frame. - * We already provided the CONFIG_CRYPTO_COPY_IV to rt2x00lib - * to ensure rt2x00lib will not strip the data from the - * frame after the copy, now we must tell mac80211 - * to generate the IV/EIV data. - */ - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; - } - - /* - * TXRX_CSR0_KEY_ID contains only single-bit fields to indicate - * a particular key is valid. - */ - rt2500usb_register_read(rt2x00dev, TXRX_CSR0, ®); - rt2x00_set_field16(®, TXRX_CSR0_ALGORITHM, crypto->cipher); - rt2x00_set_field16(®, TXRX_CSR0_IV_OFFSET, IEEE80211_HEADER); - - mask = rt2x00_get_field16(reg, TXRX_CSR0_KEY_ID); - if (crypto->cmd == SET_KEY) - mask |= 1 << key->hw_key_idx; - else if (crypto->cmd == DISABLE_KEY) - mask &= ~(1 << key->hw_key_idx); - rt2x00_set_field16(®, TXRX_CSR0_KEY_ID, mask); - rt2500usb_register_write(rt2x00dev, TXRX_CSR0, reg); - - return 0; -} - -static void rt2500usb_config_filter(struct rt2x00_dev *rt2x00dev, - const unsigned int filter_flags) -{ - u16 reg; - - /* - * Start configuration steps. - * Note that the version error will always be dropped - * and broadcast frames will always be accepted since - * there is no filter for it at this time. - */ - rt2500usb_register_read(rt2x00dev, TXRX_CSR2, ®); - rt2x00_set_field16(®, TXRX_CSR2_DROP_CRC, - !(filter_flags & FIF_FCSFAIL)); - rt2x00_set_field16(®, TXRX_CSR2_DROP_PHYSICAL, - !(filter_flags & FIF_PLCPFAIL)); - rt2x00_set_field16(®, TXRX_CSR2_DROP_CONTROL, - !(filter_flags & FIF_CONTROL)); - rt2x00_set_field16(®, TXRX_CSR2_DROP_NOT_TO_ME, - !(filter_flags & FIF_PROMISC_IN_BSS)); - rt2x00_set_field16(®, TXRX_CSR2_DROP_TODS, - !(filter_flags & FIF_PROMISC_IN_BSS) && - !rt2x00dev->intf_ap_count); - rt2x00_set_field16(®, TXRX_CSR2_DROP_VERSION_ERROR, 1); - rt2x00_set_field16(®, TXRX_CSR2_DROP_MULTICAST, - !(filter_flags & FIF_ALLMULTI)); - rt2x00_set_field16(®, TXRX_CSR2_DROP_BROADCAST, 0); - rt2500usb_register_write(rt2x00dev, TXRX_CSR2, reg); -} - -static void rt2500usb_config_intf(struct rt2x00_dev *rt2x00dev, - struct rt2x00_intf *intf, - struct rt2x00intf_conf *conf, - const unsigned int flags) -{ - unsigned int bcn_preload; - u16 reg; - - if (flags & CONFIG_UPDATE_TYPE) { - /* - * Enable beacon config - */ - bcn_preload = PREAMBLE + GET_DURATION(IEEE80211_HEADER, 20); - rt2500usb_register_read(rt2x00dev, TXRX_CSR20, ®); - rt2x00_set_field16(®, TXRX_CSR20_OFFSET, bcn_preload >> 6); - rt2x00_set_field16(®, TXRX_CSR20_BCN_EXPECT_WINDOW, - 2 * (conf->type != NL80211_IFTYPE_STATION)); - rt2500usb_register_write(rt2x00dev, TXRX_CSR20, reg); - - /* - * Enable synchronisation. - */ - rt2500usb_register_read(rt2x00dev, TXRX_CSR18, ®); - rt2x00_set_field16(®, TXRX_CSR18_OFFSET, 0); - rt2500usb_register_write(rt2x00dev, TXRX_CSR18, reg); - - rt2500usb_register_read(rt2x00dev, TXRX_CSR19, ®); - rt2x00_set_field16(®, TXRX_CSR19_TSF_SYNC, conf->sync); - rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); - } - - if (flags & CONFIG_UPDATE_MAC) - rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, conf->mac, - (3 * sizeof(__le16))); - - if (flags & CONFIG_UPDATE_BSSID) - rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR5, conf->bssid, - (3 * sizeof(__le16))); -} - -static void rt2500usb_config_erp(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_erp *erp, - u32 changed) -{ - u16 reg; - - if (changed & BSS_CHANGED_ERP_PREAMBLE) { - rt2500usb_register_read(rt2x00dev, TXRX_CSR10, ®); - rt2x00_set_field16(®, TXRX_CSR10_AUTORESPOND_PREAMBLE, - !!erp->short_preamble); - rt2500usb_register_write(rt2x00dev, TXRX_CSR10, reg); - } - - if (changed & BSS_CHANGED_BASIC_RATES) - rt2500usb_register_write(rt2x00dev, TXRX_CSR11, - erp->basic_rates); - - if (changed & BSS_CHANGED_BEACON_INT) { - rt2500usb_register_read(rt2x00dev, TXRX_CSR18, ®); - rt2x00_set_field16(®, TXRX_CSR18_INTERVAL, - erp->beacon_int * 4); - rt2500usb_register_write(rt2x00dev, TXRX_CSR18, reg); - } - - if (changed & BSS_CHANGED_ERP_SLOT) { - rt2500usb_register_write(rt2x00dev, MAC_CSR10, erp->slot_time); - rt2500usb_register_write(rt2x00dev, MAC_CSR11, erp->sifs); - rt2500usb_register_write(rt2x00dev, MAC_CSR12, erp->eifs); - } -} - -static void rt2500usb_config_ant(struct rt2x00_dev *rt2x00dev, - struct antenna_setup *ant) -{ - u8 r2; - u8 r14; - u16 csr5; - u16 csr6; - - /* - * We should never come here because rt2x00lib is supposed - * to catch this and send us the correct antenna explicitely. - */ - BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY || - ant->tx == ANTENNA_SW_DIVERSITY); - - rt2500usb_bbp_read(rt2x00dev, 2, &r2); - rt2500usb_bbp_read(rt2x00dev, 14, &r14); - rt2500usb_register_read(rt2x00dev, PHY_CSR5, &csr5); - rt2500usb_register_read(rt2x00dev, PHY_CSR6, &csr6); - - /* - * Configure the TX antenna. - */ - switch (ant->tx) { - case ANTENNA_HW_DIVERSITY: - rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 1); - rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 1); - rt2x00_set_field16(&csr6, PHY_CSR6_OFDM, 1); - break; - case ANTENNA_A: - rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 0); - rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 0); - rt2x00_set_field16(&csr6, PHY_CSR6_OFDM, 0); - break; - case ANTENNA_B: - default: - rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2); - rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 2); - rt2x00_set_field16(&csr6, PHY_CSR6_OFDM, 2); - break; - } - - /* - * Configure the RX antenna. - */ - switch (ant->rx) { - case ANTENNA_HW_DIVERSITY: - rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 1); - break; - case ANTENNA_A: - rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 0); - break; - case ANTENNA_B: - default: - rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2); - break; - } - - /* - * RT2525E and RT5222 need to flip TX I/Q - */ - if (rt2x00_rf(rt2x00dev, RF2525E) || rt2x00_rf(rt2x00dev, RF5222)) { - rt2x00_set_field8(&r2, BBP_R2_TX_IQ_FLIP, 1); - rt2x00_set_field16(&csr5, PHY_CSR5_CCK_FLIP, 1); - rt2x00_set_field16(&csr6, PHY_CSR6_OFDM_FLIP, 1); - - /* - * RT2525E does not need RX I/Q Flip. - */ - if (rt2x00_rf(rt2x00dev, RF2525E)) - rt2x00_set_field8(&r14, BBP_R14_RX_IQ_FLIP, 0); - } else { - rt2x00_set_field16(&csr5, PHY_CSR5_CCK_FLIP, 0); - rt2x00_set_field16(&csr6, PHY_CSR6_OFDM_FLIP, 0); - } - - rt2500usb_bbp_write(rt2x00dev, 2, r2); - rt2500usb_bbp_write(rt2x00dev, 14, r14); - rt2500usb_register_write(rt2x00dev, PHY_CSR5, csr5); - rt2500usb_register_write(rt2x00dev, PHY_CSR6, csr6); -} - -static void rt2500usb_config_channel(struct rt2x00_dev *rt2x00dev, - struct rf_channel *rf, const int txpower) -{ - /* - * Set TXpower. - */ - rt2x00_set_field32(&rf->rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower)); - - /* - * For RT2525E we should first set the channel to half band higher. - */ - if (rt2x00_rf(rt2x00dev, RF2525E)) { - static const u32 vals[] = { - 0x000008aa, 0x000008ae, 0x000008ae, 0x000008b2, - 0x000008b2, 0x000008b6, 0x000008b6, 0x000008ba, - 0x000008ba, 0x000008be, 0x000008b7, 0x00000902, - 0x00000902, 0x00000906 - }; - - rt2500usb_rf_write(rt2x00dev, 2, vals[rf->channel - 1]); - if (rf->rf4) - rt2500usb_rf_write(rt2x00dev, 4, rf->rf4); - } - - rt2500usb_rf_write(rt2x00dev, 1, rf->rf1); - rt2500usb_rf_write(rt2x00dev, 2, rf->rf2); - rt2500usb_rf_write(rt2x00dev, 3, rf->rf3); - if (rf->rf4) - rt2500usb_rf_write(rt2x00dev, 4, rf->rf4); -} - -static void rt2500usb_config_txpower(struct rt2x00_dev *rt2x00dev, - const int txpower) -{ - u32 rf3; - - rt2x00_rf_read(rt2x00dev, 3, &rf3); - rt2x00_set_field32(&rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower)); - rt2500usb_rf_write(rt2x00dev, 3, rf3); -} - -static void rt2500usb_config_ps(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf) -{ - enum dev_state state = - (libconf->conf->flags & IEEE80211_CONF_PS) ? - STATE_SLEEP : STATE_AWAKE; - u16 reg; - - if (state == STATE_SLEEP) { - rt2500usb_register_read(rt2x00dev, MAC_CSR18, ®); - rt2x00_set_field16(®, MAC_CSR18_DELAY_AFTER_BEACON, - rt2x00dev->beacon_int - 20); - rt2x00_set_field16(®, MAC_CSR18_BEACONS_BEFORE_WAKEUP, - libconf->conf->listen_interval - 1); - - /* We must first disable autowake before it can be enabled */ - rt2x00_set_field16(®, MAC_CSR18_AUTO_WAKE, 0); - rt2500usb_register_write(rt2x00dev, MAC_CSR18, reg); - - rt2x00_set_field16(®, MAC_CSR18_AUTO_WAKE, 1); - rt2500usb_register_write(rt2x00dev, MAC_CSR18, reg); - } else { - rt2500usb_register_read(rt2x00dev, MAC_CSR18, ®); - rt2x00_set_field16(®, MAC_CSR18_AUTO_WAKE, 0); - rt2500usb_register_write(rt2x00dev, MAC_CSR18, reg); - } - - rt2x00dev->ops->lib->set_device_state(rt2x00dev, state); -} - -static void rt2500usb_config(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf, - const unsigned int flags) -{ - if (flags & IEEE80211_CONF_CHANGE_CHANNEL) - rt2500usb_config_channel(rt2x00dev, &libconf->rf, - libconf->conf->power_level); - if ((flags & IEEE80211_CONF_CHANGE_POWER) && - !(flags & IEEE80211_CONF_CHANGE_CHANNEL)) - rt2500usb_config_txpower(rt2x00dev, - libconf->conf->power_level); - if (flags & IEEE80211_CONF_CHANGE_PS) - rt2500usb_config_ps(rt2x00dev, libconf); -} - -/* - * Link tuning - */ -static void rt2500usb_link_stats(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual) -{ - u16 reg; - - /* - * Update FCS error count from register. - */ - rt2500usb_register_read(rt2x00dev, STA_CSR0, ®); - qual->rx_failed = rt2x00_get_field16(reg, STA_CSR0_FCS_ERROR); - - /* - * Update False CCA count from register. - */ - rt2500usb_register_read(rt2x00dev, STA_CSR3, ®); - qual->false_cca = rt2x00_get_field16(reg, STA_CSR3_FALSE_CCA_ERROR); -} - -static void rt2500usb_reset_tuner(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual) -{ - u16 eeprom; - u16 value; - - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R24, &eeprom); - value = rt2x00_get_field16(eeprom, EEPROM_BBPTUNE_R24_LOW); - rt2500usb_bbp_write(rt2x00dev, 24, value); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R25, &eeprom); - value = rt2x00_get_field16(eeprom, EEPROM_BBPTUNE_R25_LOW); - rt2500usb_bbp_write(rt2x00dev, 25, value); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R61, &eeprom); - value = rt2x00_get_field16(eeprom, EEPROM_BBPTUNE_R61_LOW); - rt2500usb_bbp_write(rt2x00dev, 61, value); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_VGC, &eeprom); - value = rt2x00_get_field16(eeprom, EEPROM_BBPTUNE_VGCUPPER); - rt2500usb_bbp_write(rt2x00dev, 17, value); - - qual->vgc_level = value; -} - -/* - * Queue handlers. - */ -static void rt2500usb_start_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u16 reg; - - switch (queue->qid) { - case QID_RX: - rt2500usb_register_read(rt2x00dev, TXRX_CSR2, ®); - rt2x00_set_field16(®, TXRX_CSR2_DISABLE_RX, 0); - rt2500usb_register_write(rt2x00dev, TXRX_CSR2, reg); - break; - case QID_BEACON: - rt2500usb_register_read(rt2x00dev, TXRX_CSR19, ®); - rt2x00_set_field16(®, TXRX_CSR19_TSF_COUNT, 1); - rt2x00_set_field16(®, TXRX_CSR19_TBCN, 1); - rt2x00_set_field16(®, TXRX_CSR19_BEACON_GEN, 1); - rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); - break; - default: - break; - } -} - -static void rt2500usb_stop_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u16 reg; - - switch (queue->qid) { - case QID_RX: - rt2500usb_register_read(rt2x00dev, TXRX_CSR2, ®); - rt2x00_set_field16(®, TXRX_CSR2_DISABLE_RX, 1); - rt2500usb_register_write(rt2x00dev, TXRX_CSR2, reg); - break; - case QID_BEACON: - rt2500usb_register_read(rt2x00dev, TXRX_CSR19, ®); - rt2x00_set_field16(®, TXRX_CSR19_TSF_COUNT, 0); - rt2x00_set_field16(®, TXRX_CSR19_TBCN, 0); - rt2x00_set_field16(®, TXRX_CSR19_BEACON_GEN, 0); - rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); - break; - default: - break; - } -} - -/* - * Initialization functions. - */ -static int rt2500usb_init_registers(struct rt2x00_dev *rt2x00dev) -{ - u16 reg; - - rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0x0001, - USB_MODE_TEST, REGISTER_TIMEOUT); - rt2x00usb_vendor_request_sw(rt2x00dev, USB_SINGLE_WRITE, 0x0308, - 0x00f0, REGISTER_TIMEOUT); - - rt2500usb_register_read(rt2x00dev, TXRX_CSR2, ®); - rt2x00_set_field16(®, TXRX_CSR2_DISABLE_RX, 1); - rt2500usb_register_write(rt2x00dev, TXRX_CSR2, reg); - - rt2500usb_register_write(rt2x00dev, MAC_CSR13, 0x1111); - rt2500usb_register_write(rt2x00dev, MAC_CSR14, 0x1e11); - - rt2500usb_register_read(rt2x00dev, MAC_CSR1, ®); - rt2x00_set_field16(®, MAC_CSR1_SOFT_RESET, 1); - rt2x00_set_field16(®, MAC_CSR1_BBP_RESET, 1); - rt2x00_set_field16(®, MAC_CSR1_HOST_READY, 0); - rt2500usb_register_write(rt2x00dev, MAC_CSR1, reg); - - rt2500usb_register_read(rt2x00dev, MAC_CSR1, ®); - rt2x00_set_field16(®, MAC_CSR1_SOFT_RESET, 0); - rt2x00_set_field16(®, MAC_CSR1_BBP_RESET, 0); - rt2x00_set_field16(®, MAC_CSR1_HOST_READY, 0); - rt2500usb_register_write(rt2x00dev, MAC_CSR1, reg); - - rt2500usb_register_read(rt2x00dev, TXRX_CSR5, ®); - rt2x00_set_field16(®, TXRX_CSR5_BBP_ID0, 13); - rt2x00_set_field16(®, TXRX_CSR5_BBP_ID0_VALID, 1); - rt2x00_set_field16(®, TXRX_CSR5_BBP_ID1, 12); - rt2x00_set_field16(®, TXRX_CSR5_BBP_ID1_VALID, 1); - rt2500usb_register_write(rt2x00dev, TXRX_CSR5, reg); - - rt2500usb_register_read(rt2x00dev, TXRX_CSR6, ®); - rt2x00_set_field16(®, TXRX_CSR6_BBP_ID0, 10); - rt2x00_set_field16(®, TXRX_CSR6_BBP_ID0_VALID, 1); - rt2x00_set_field16(®, TXRX_CSR6_BBP_ID1, 11); - rt2x00_set_field16(®, TXRX_CSR6_BBP_ID1_VALID, 1); - rt2500usb_register_write(rt2x00dev, TXRX_CSR6, reg); - - rt2500usb_register_read(rt2x00dev, TXRX_CSR7, ®); - rt2x00_set_field16(®, TXRX_CSR7_BBP_ID0, 7); - rt2x00_set_field16(®, TXRX_CSR7_BBP_ID0_VALID, 1); - rt2x00_set_field16(®, TXRX_CSR7_BBP_ID1, 6); - rt2x00_set_field16(®, TXRX_CSR7_BBP_ID1_VALID, 1); - rt2500usb_register_write(rt2x00dev, TXRX_CSR7, reg); - - rt2500usb_register_read(rt2x00dev, TXRX_CSR8, ®); - rt2x00_set_field16(®, TXRX_CSR8_BBP_ID0, 5); - rt2x00_set_field16(®, TXRX_CSR8_BBP_ID0_VALID, 1); - rt2x00_set_field16(®, TXRX_CSR8_BBP_ID1, 0); - rt2x00_set_field16(®, TXRX_CSR8_BBP_ID1_VALID, 0); - rt2500usb_register_write(rt2x00dev, TXRX_CSR8, reg); - - rt2500usb_register_read(rt2x00dev, TXRX_CSR19, ®); - rt2x00_set_field16(®, TXRX_CSR19_TSF_COUNT, 0); - rt2x00_set_field16(®, TXRX_CSR19_TSF_SYNC, 0); - rt2x00_set_field16(®, TXRX_CSR19_TBCN, 0); - rt2x00_set_field16(®, TXRX_CSR19_BEACON_GEN, 0); - rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); - - rt2500usb_register_write(rt2x00dev, TXRX_CSR21, 0xe78f); - rt2500usb_register_write(rt2x00dev, MAC_CSR9, 0xff1d); - - if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE)) - return -EBUSY; - - rt2500usb_register_read(rt2x00dev, MAC_CSR1, ®); - rt2x00_set_field16(®, MAC_CSR1_SOFT_RESET, 0); - rt2x00_set_field16(®, MAC_CSR1_BBP_RESET, 0); - rt2x00_set_field16(®, MAC_CSR1_HOST_READY, 1); - rt2500usb_register_write(rt2x00dev, MAC_CSR1, reg); - - if (rt2x00_rev(rt2x00dev) >= RT2570_VERSION_C) { - rt2500usb_register_read(rt2x00dev, PHY_CSR2, ®); - rt2x00_set_field16(®, PHY_CSR2_LNA, 0); - } else { - reg = 0; - rt2x00_set_field16(®, PHY_CSR2_LNA, 1); - rt2x00_set_field16(®, PHY_CSR2_LNA_MODE, 3); - } - rt2500usb_register_write(rt2x00dev, PHY_CSR2, reg); - - rt2500usb_register_write(rt2x00dev, MAC_CSR11, 0x0002); - rt2500usb_register_write(rt2x00dev, MAC_CSR22, 0x0053); - rt2500usb_register_write(rt2x00dev, MAC_CSR15, 0x01ee); - rt2500usb_register_write(rt2x00dev, MAC_CSR16, 0x0000); - - rt2500usb_register_read(rt2x00dev, MAC_CSR8, ®); - rt2x00_set_field16(®, MAC_CSR8_MAX_FRAME_UNIT, - rt2x00dev->rx->data_size); - rt2500usb_register_write(rt2x00dev, MAC_CSR8, reg); - - rt2500usb_register_read(rt2x00dev, TXRX_CSR0, ®); - rt2x00_set_field16(®, TXRX_CSR0_ALGORITHM, CIPHER_NONE); - rt2x00_set_field16(®, TXRX_CSR0_IV_OFFSET, IEEE80211_HEADER); - rt2x00_set_field16(®, TXRX_CSR0_KEY_ID, 0); - rt2500usb_register_write(rt2x00dev, TXRX_CSR0, reg); - - rt2500usb_register_read(rt2x00dev, MAC_CSR18, ®); - rt2x00_set_field16(®, MAC_CSR18_DELAY_AFTER_BEACON, 90); - rt2500usb_register_write(rt2x00dev, MAC_CSR18, reg); - - rt2500usb_register_read(rt2x00dev, PHY_CSR4, ®); - rt2x00_set_field16(®, PHY_CSR4_LOW_RF_LE, 1); - rt2500usb_register_write(rt2x00dev, PHY_CSR4, reg); - - rt2500usb_register_read(rt2x00dev, TXRX_CSR1, ®); - rt2x00_set_field16(®, TXRX_CSR1_AUTO_SEQUENCE, 1); - rt2500usb_register_write(rt2x00dev, TXRX_CSR1, reg); - - return 0; -} - -static int rt2500usb_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u8 value; - - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2500usb_bbp_read(rt2x00dev, 0, &value); - if ((value != 0xff) && (value != 0x00)) - return 0; - udelay(REGISTER_BUSY_DELAY); - } - - rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n"); - return -EACCES; -} - -static int rt2500usb_init_bbp(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u16 eeprom; - u8 value; - u8 reg_id; - - if (unlikely(rt2500usb_wait_bbp_ready(rt2x00dev))) - return -EACCES; - - rt2500usb_bbp_write(rt2x00dev, 3, 0x02); - rt2500usb_bbp_write(rt2x00dev, 4, 0x19); - rt2500usb_bbp_write(rt2x00dev, 14, 0x1c); - rt2500usb_bbp_write(rt2x00dev, 15, 0x30); - rt2500usb_bbp_write(rt2x00dev, 16, 0xac); - rt2500usb_bbp_write(rt2x00dev, 18, 0x18); - rt2500usb_bbp_write(rt2x00dev, 19, 0xff); - rt2500usb_bbp_write(rt2x00dev, 20, 0x1e); - rt2500usb_bbp_write(rt2x00dev, 21, 0x08); - rt2500usb_bbp_write(rt2x00dev, 22, 0x08); - rt2500usb_bbp_write(rt2x00dev, 23, 0x08); - rt2500usb_bbp_write(rt2x00dev, 24, 0x80); - rt2500usb_bbp_write(rt2x00dev, 25, 0x50); - rt2500usb_bbp_write(rt2x00dev, 26, 0x08); - rt2500usb_bbp_write(rt2x00dev, 27, 0x23); - rt2500usb_bbp_write(rt2x00dev, 30, 0x10); - rt2500usb_bbp_write(rt2x00dev, 31, 0x2b); - rt2500usb_bbp_write(rt2x00dev, 32, 0xb9); - rt2500usb_bbp_write(rt2x00dev, 34, 0x12); - rt2500usb_bbp_write(rt2x00dev, 35, 0x50); - rt2500usb_bbp_write(rt2x00dev, 39, 0xc4); - rt2500usb_bbp_write(rt2x00dev, 40, 0x02); - rt2500usb_bbp_write(rt2x00dev, 41, 0x60); - rt2500usb_bbp_write(rt2x00dev, 53, 0x10); - rt2500usb_bbp_write(rt2x00dev, 54, 0x18); - rt2500usb_bbp_write(rt2x00dev, 56, 0x08); - rt2500usb_bbp_write(rt2x00dev, 57, 0x10); - rt2500usb_bbp_write(rt2x00dev, 58, 0x08); - rt2500usb_bbp_write(rt2x00dev, 61, 0x60); - rt2500usb_bbp_write(rt2x00dev, 62, 0x10); - rt2500usb_bbp_write(rt2x00dev, 75, 0xff); - - for (i = 0; i < EEPROM_BBP_SIZE; i++) { - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBP_START + i, &eeprom); - - if (eeprom != 0xffff && eeprom != 0x0000) { - reg_id = rt2x00_get_field16(eeprom, EEPROM_BBP_REG_ID); - value = rt2x00_get_field16(eeprom, EEPROM_BBP_VALUE); - rt2500usb_bbp_write(rt2x00dev, reg_id, value); - } - } - - return 0; -} - -/* - * Device state switch handlers. - */ -static int rt2500usb_enable_radio(struct rt2x00_dev *rt2x00dev) -{ - /* - * Initialize all registers. - */ - if (unlikely(rt2500usb_init_registers(rt2x00dev) || - rt2500usb_init_bbp(rt2x00dev))) - return -EIO; - - return 0; -} - -static void rt2500usb_disable_radio(struct rt2x00_dev *rt2x00dev) -{ - rt2500usb_register_write(rt2x00dev, MAC_CSR13, 0x2121); - rt2500usb_register_write(rt2x00dev, MAC_CSR14, 0x2121); - - /* - * Disable synchronisation. - */ - rt2500usb_register_write(rt2x00dev, TXRX_CSR19, 0); - - rt2x00usb_disable_radio(rt2x00dev); -} - -static int rt2500usb_set_state(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - u16 reg; - u16 reg2; - unsigned int i; - char put_to_sleep; - char bbp_state; - char rf_state; - - put_to_sleep = (state != STATE_AWAKE); - - reg = 0; - rt2x00_set_field16(®, MAC_CSR17_BBP_DESIRE_STATE, state); - rt2x00_set_field16(®, MAC_CSR17_RF_DESIRE_STATE, state); - rt2x00_set_field16(®, MAC_CSR17_PUT_TO_SLEEP, put_to_sleep); - rt2500usb_register_write(rt2x00dev, MAC_CSR17, reg); - rt2x00_set_field16(®, MAC_CSR17_SET_STATE, 1); - rt2500usb_register_write(rt2x00dev, MAC_CSR17, reg); - - /* - * Device is not guaranteed to be in the requested state yet. - * We must wait until the register indicates that the - * device has entered the correct state. - */ - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2500usb_register_read(rt2x00dev, MAC_CSR17, ®2); - bbp_state = rt2x00_get_field16(reg2, MAC_CSR17_BBP_CURR_STATE); - rf_state = rt2x00_get_field16(reg2, MAC_CSR17_RF_CURR_STATE); - if (bbp_state == state && rf_state == state) - return 0; - rt2500usb_register_write(rt2x00dev, MAC_CSR17, reg); - msleep(30); - } - - return -EBUSY; -} - -static int rt2500usb_set_device_state(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - int retval = 0; - - switch (state) { - case STATE_RADIO_ON: - retval = rt2500usb_enable_radio(rt2x00dev); - break; - case STATE_RADIO_OFF: - rt2500usb_disable_radio(rt2x00dev); - break; - case STATE_RADIO_IRQ_ON: - case STATE_RADIO_IRQ_OFF: - /* No support, but no error either */ - break; - case STATE_DEEP_SLEEP: - case STATE_SLEEP: - case STATE_STANDBY: - case STATE_AWAKE: - retval = rt2500usb_set_state(rt2x00dev, state); - break; - default: - retval = -ENOTSUPP; - break; - } - - if (unlikely(retval)) - rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", - state, retval); - - return retval; -} - -/* - * TX descriptor initialization - */ -static void rt2500usb_write_tx_desc(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - __le32 *txd = (__le32 *) entry->skb->data; - u32 word; - - /* - * Start writing the descriptor words. - */ - rt2x00_desc_read(txd, 0, &word); - rt2x00_set_field32(&word, TXD_W0_RETRY_LIMIT, txdesc->retry_limit); - rt2x00_set_field32(&word, TXD_W0_MORE_FRAG, - test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_ACK, - test_bit(ENTRY_TXD_ACK, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_TIMESTAMP, - test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_OFDM, - (txdesc->rate_mode == RATE_MODE_OFDM)); - rt2x00_set_field32(&word, TXD_W0_NEW_SEQ, - test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->u.plcp.ifs); - rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, txdesc->length); - rt2x00_set_field32(&word, TXD_W0_CIPHER, !!txdesc->cipher); - rt2x00_set_field32(&word, TXD_W0_KEY_ID, txdesc->key_idx); - rt2x00_desc_write(txd, 0, word); - - rt2x00_desc_read(txd, 1, &word); - rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, txdesc->iv_offset); - rt2x00_set_field32(&word, TXD_W1_AIFS, entry->queue->aifs); - rt2x00_set_field32(&word, TXD_W1_CWMIN, entry->queue->cw_min); - rt2x00_set_field32(&word, TXD_W1_CWMAX, entry->queue->cw_max); - rt2x00_desc_write(txd, 1, word); - - rt2x00_desc_read(txd, 2, &word); - rt2x00_set_field32(&word, TXD_W2_PLCP_SIGNAL, txdesc->u.plcp.signal); - rt2x00_set_field32(&word, TXD_W2_PLCP_SERVICE, txdesc->u.plcp.service); - rt2x00_set_field32(&word, TXD_W2_PLCP_LENGTH_LOW, - txdesc->u.plcp.length_low); - rt2x00_set_field32(&word, TXD_W2_PLCP_LENGTH_HIGH, - txdesc->u.plcp.length_high); - rt2x00_desc_write(txd, 2, word); - - if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags)) { - _rt2x00_desc_write(txd, 3, skbdesc->iv[0]); - _rt2x00_desc_write(txd, 4, skbdesc->iv[1]); - } - - /* - * Register descriptor details in skb frame descriptor. - */ - skbdesc->flags |= SKBDESC_DESC_IN_SKB; - skbdesc->desc = txd; - skbdesc->desc_len = TXD_DESC_SIZE; -} - -/* - * TX data initialization - */ -static void rt2500usb_beacondone(struct urb *urb); - -static void rt2500usb_write_beacon(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); - struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data; - int pipe = usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint); - int length; - u16 reg, reg0; - - /* - * Disable beaconing while we are reloading the beacon data, - * otherwise we might be sending out invalid data. - */ - rt2500usb_register_read(rt2x00dev, TXRX_CSR19, ®); - rt2x00_set_field16(®, TXRX_CSR19_BEACON_GEN, 0); - rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); - - /* - * Add space for the descriptor in front of the skb. - */ - skb_push(entry->skb, TXD_DESC_SIZE); - memset(entry->skb->data, 0, TXD_DESC_SIZE); - - /* - * Write the TX descriptor for the beacon. - */ - rt2500usb_write_tx_desc(entry, txdesc); - - /* - * Dump beacon to userspace through debugfs. - */ - rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb); - - /* - * USB devices cannot blindly pass the skb->len as the - * length of the data to usb_fill_bulk_urb. Pass the skb - * to the driver to determine what the length should be. - */ - length = rt2x00dev->ops->lib->get_tx_data_len(entry); - - usb_fill_bulk_urb(bcn_priv->urb, usb_dev, pipe, - entry->skb->data, length, rt2500usb_beacondone, - entry); - - /* - * Second we need to create the guardian byte. - * We only need a single byte, so lets recycle - * the 'flags' field we are not using for beacons. - */ - bcn_priv->guardian_data = 0; - usb_fill_bulk_urb(bcn_priv->guardian_urb, usb_dev, pipe, - &bcn_priv->guardian_data, 1, rt2500usb_beacondone, - entry); - - /* - * Send out the guardian byte. - */ - usb_submit_urb(bcn_priv->guardian_urb, GFP_ATOMIC); - - /* - * Enable beaconing again. - */ - rt2x00_set_field16(®, TXRX_CSR19_TSF_COUNT, 1); - rt2x00_set_field16(®, TXRX_CSR19_TBCN, 1); - reg0 = reg; - rt2x00_set_field16(®, TXRX_CSR19_BEACON_GEN, 1); - /* - * Beacon generation will fail initially. - * To prevent this we need to change the TXRX_CSR19 - * register several times (reg0 is the same as reg - * except for TXRX_CSR19_BEACON_GEN, which is 0 in reg0 - * and 1 in reg). - */ - rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); - rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0); - rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); - rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg0); - rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg); -} - -static int rt2500usb_get_tx_data_len(struct queue_entry *entry) -{ - int length; - - /* - * The length _must_ be a multiple of 2, - * but it must _not_ be a multiple of the USB packet size. - */ - length = roundup(entry->skb->len, 2); - length += (2 * !(length % entry->queue->usb_maxpacket)); - - return length; -} - -/* - * RX control handlers - */ -static void rt2500usb_fill_rxdone(struct queue_entry *entry, - struct rxdone_entry_desc *rxdesc) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct queue_entry_priv_usb *entry_priv = entry->priv_data; - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - __le32 *rxd = - (__le32 *)(entry->skb->data + - (entry_priv->urb->actual_length - - entry->queue->desc_size)); - u32 word0; - u32 word1; - - /* - * Copy descriptor to the skbdesc->desc buffer, making it safe from moving of - * frame data in rt2x00usb. - */ - memcpy(skbdesc->desc, rxd, skbdesc->desc_len); - rxd = (__le32 *)skbdesc->desc; - - /* - * It is now safe to read the descriptor on all architectures. - */ - rt2x00_desc_read(rxd, 0, &word0); - rt2x00_desc_read(rxd, 1, &word1); - - if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) - rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; - if (rt2x00_get_field32(word0, RXD_W0_PHYSICAL_ERROR)) - rxdesc->flags |= RX_FLAG_FAILED_PLCP_CRC; - - rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER); - if (rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR)) - rxdesc->cipher_status = RX_CRYPTO_FAIL_KEY; - - if (rxdesc->cipher != CIPHER_NONE) { - _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]); - _rt2x00_desc_read(rxd, 3, &rxdesc->iv[1]); - rxdesc->dev_flags |= RXDONE_CRYPTO_IV; - - /* ICV is located at the end of frame */ - - rxdesc->flags |= RX_FLAG_MMIC_STRIPPED; - if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) - rxdesc->flags |= RX_FLAG_DECRYPTED; - else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) - rxdesc->flags |= RX_FLAG_MMIC_ERROR; - } - - /* - * Obtain the status about this packet. - * When frame was received with an OFDM bitrate, - * the signal is the PLCP value. If it was received with - * a CCK bitrate the signal is the rate in 100kbit/s. - */ - rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL); - rxdesc->rssi = - rt2x00_get_field32(word1, RXD_W1_RSSI) - rt2x00dev->rssi_offset; - rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); - - if (rt2x00_get_field32(word0, RXD_W0_OFDM)) - rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP; - else - rxdesc->dev_flags |= RXDONE_SIGNAL_BITRATE; - if (rt2x00_get_field32(word0, RXD_W0_MY_BSS)) - rxdesc->dev_flags |= RXDONE_MY_BSS; - - /* - * Adjust the skb memory window to the frame boundaries. - */ - skb_trim(entry->skb, rxdesc->size); -} - -/* - * Interrupt functions. - */ -static void rt2500usb_beacondone(struct urb *urb) -{ - struct queue_entry *entry = (struct queue_entry *)urb->context; - struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data; - - if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &entry->queue->rt2x00dev->flags)) - return; - - /* - * Check if this was the guardian beacon, - * if that was the case we need to send the real beacon now. - * Otherwise we should free the sk_buffer, the device - * should be doing the rest of the work now. - */ - if (bcn_priv->guardian_urb == urb) { - usb_submit_urb(bcn_priv->urb, GFP_ATOMIC); - } else if (bcn_priv->urb == urb) { - dev_kfree_skb(entry->skb); - entry->skb = NULL; - } -} - -/* - * Device probe functions. - */ -static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) -{ - u16 word; - u8 *mac; - u8 bbp; - - rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE); - - /* - * Start validation of the data that has been read. - */ - mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0); - if (!is_valid_ether_addr(mac)) { - eth_random_addr(mac); - rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_ANTENNA_NUM, 2); - rt2x00_set_field16(&word, EEPROM_ANTENNA_TX_DEFAULT, - ANTENNA_SW_DIVERSITY); - rt2x00_set_field16(&word, EEPROM_ANTENNA_RX_DEFAULT, - ANTENNA_SW_DIVERSITY); - rt2x00_set_field16(&word, EEPROM_ANTENNA_LED_MODE, - LED_MODE_DEFAULT); - rt2x00_set_field16(&word, EEPROM_ANTENNA_DYN_TXAGC, 0); - rt2x00_set_field16(&word, EEPROM_ANTENNA_HARDWARE_RADIO, 0); - rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF2522); - rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); - rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0); - rt2x00_set_field16(&word, EEPROM_NIC_DYN_BBP_TUNE, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CCK_TX_POWER, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word); - rt2x00_eeprom_dbg(rt2x00dev, "NIC: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_CALIBRATE_OFFSET, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_CALIBRATE_OFFSET_RSSI, - DEFAULT_RSSI_OFFSET); - rt2x00_eeprom_write(rt2x00dev, EEPROM_CALIBRATE_OFFSET, word); - rt2x00_eeprom_dbg(rt2x00dev, "Calibrate offset: 0x%04x\n", - word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_BBPTUNE_THRESHOLD, 45); - rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE, word); - rt2x00_eeprom_dbg(rt2x00dev, "BBPtune: 0x%04x\n", word); - } - - /* - * Switch lower vgc bound to current BBP R17 value, - * lower the value a bit for better quality. - */ - rt2500usb_bbp_read(rt2x00dev, 17, &bbp); - bbp -= 6; - - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_VGC, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCUPPER, 0x40); - rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCLOWER, bbp); - rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_VGC, word); - rt2x00_eeprom_dbg(rt2x00dev, "BBPtune vgc: 0x%04x\n", word); - } else { - rt2x00_set_field16(&word, EEPROM_BBPTUNE_VGCLOWER, bbp); - rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_VGC, word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R17, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_BBPTUNE_R17_LOW, 0x48); - rt2x00_set_field16(&word, EEPROM_BBPTUNE_R17_HIGH, 0x41); - rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_R17, word); - rt2x00_eeprom_dbg(rt2x00dev, "BBPtune r17: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R24, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_BBPTUNE_R24_LOW, 0x40); - rt2x00_set_field16(&word, EEPROM_BBPTUNE_R24_HIGH, 0x80); - rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_R24, word); - rt2x00_eeprom_dbg(rt2x00dev, "BBPtune r24: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R25, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_BBPTUNE_R25_LOW, 0x40); - rt2x00_set_field16(&word, EEPROM_BBPTUNE_R25_HIGH, 0x50); - rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_R25, word); - rt2x00_eeprom_dbg(rt2x00dev, "BBPtune r25: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_R61, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_BBPTUNE_R61_LOW, 0x60); - rt2x00_set_field16(&word, EEPROM_BBPTUNE_R61_HIGH, 0x6d); - rt2x00_eeprom_write(rt2x00dev, EEPROM_BBPTUNE_R61, word); - rt2x00_eeprom_dbg(rt2x00dev, "BBPtune r61: 0x%04x\n", word); - } - - return 0; -} - -static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev) -{ - u16 reg; - u16 value; - u16 eeprom; - - /* - * Read EEPROM word for configuration. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); - - /* - * Identify RF chipset. - */ - value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); - rt2500usb_register_read(rt2x00dev, MAC_CSR0, ®); - rt2x00_set_chip(rt2x00dev, RT2570, value, reg); - - if (((reg & 0xfff0) != 0) || ((reg & 0x0000000f) == 0)) { - rt2x00_err(rt2x00dev, "Invalid RT chipset detected\n"); - return -ENODEV; - } - - if (!rt2x00_rf(rt2x00dev, RF2522) && - !rt2x00_rf(rt2x00dev, RF2523) && - !rt2x00_rf(rt2x00dev, RF2524) && - !rt2x00_rf(rt2x00dev, RF2525) && - !rt2x00_rf(rt2x00dev, RF2525E) && - !rt2x00_rf(rt2x00dev, RF5222)) { - rt2x00_err(rt2x00dev, "Invalid RF chipset detected\n"); - return -ENODEV; - } - - /* - * Identify default antenna configuration. - */ - rt2x00dev->default_ant.tx = - rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TX_DEFAULT); - rt2x00dev->default_ant.rx = - rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_DEFAULT); - - /* - * When the eeprom indicates SW_DIVERSITY use HW_DIVERSITY instead. - * I am not 100% sure about this, but the legacy drivers do not - * indicate antenna swapping in software is required when - * diversity is enabled. - */ - if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY) - rt2x00dev->default_ant.tx = ANTENNA_HW_DIVERSITY; - if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY) - rt2x00dev->default_ant.rx = ANTENNA_HW_DIVERSITY; - - /* - * Store led mode, for correct led behaviour. - */ -#ifdef CONFIG_RT2X00_LIB_LEDS - value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE); - - rt2500usb_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO); - if (value == LED_MODE_TXRX_ACTIVITY || - value == LED_MODE_DEFAULT || - value == LED_MODE_ASUS) - rt2500usb_init_led(rt2x00dev, &rt2x00dev->led_qual, - LED_TYPE_ACTIVITY); -#endif /* CONFIG_RT2X00_LIB_LEDS */ - - /* - * Detect if this device has an hardware controlled radio. - */ - if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) - __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); - - /* - * Read the RSSI <-> dBm offset information. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_CALIBRATE_OFFSET, &eeprom); - rt2x00dev->rssi_offset = - rt2x00_get_field16(eeprom, EEPROM_CALIBRATE_OFFSET_RSSI); - - return 0; -} - -/* - * RF value list for RF2522 - * Supports: 2.4 GHz - */ -static const struct rf_channel rf_vals_bg_2522[] = { - { 1, 0x00002050, 0x000c1fda, 0x00000101, 0 }, - { 2, 0x00002050, 0x000c1fee, 0x00000101, 0 }, - { 3, 0x00002050, 0x000c2002, 0x00000101, 0 }, - { 4, 0x00002050, 0x000c2016, 0x00000101, 0 }, - { 5, 0x00002050, 0x000c202a, 0x00000101, 0 }, - { 6, 0x00002050, 0x000c203e, 0x00000101, 0 }, - { 7, 0x00002050, 0x000c2052, 0x00000101, 0 }, - { 8, 0x00002050, 0x000c2066, 0x00000101, 0 }, - { 9, 0x00002050, 0x000c207a, 0x00000101, 0 }, - { 10, 0x00002050, 0x000c208e, 0x00000101, 0 }, - { 11, 0x00002050, 0x000c20a2, 0x00000101, 0 }, - { 12, 0x00002050, 0x000c20b6, 0x00000101, 0 }, - { 13, 0x00002050, 0x000c20ca, 0x00000101, 0 }, - { 14, 0x00002050, 0x000c20fa, 0x00000101, 0 }, -}; - -/* - * RF value list for RF2523 - * Supports: 2.4 GHz - */ -static const struct rf_channel rf_vals_bg_2523[] = { - { 1, 0x00022010, 0x00000c9e, 0x000e0111, 0x00000a1b }, - { 2, 0x00022010, 0x00000ca2, 0x000e0111, 0x00000a1b }, - { 3, 0x00022010, 0x00000ca6, 0x000e0111, 0x00000a1b }, - { 4, 0x00022010, 0x00000caa, 0x000e0111, 0x00000a1b }, - { 5, 0x00022010, 0x00000cae, 0x000e0111, 0x00000a1b }, - { 6, 0x00022010, 0x00000cb2, 0x000e0111, 0x00000a1b }, - { 7, 0x00022010, 0x00000cb6, 0x000e0111, 0x00000a1b }, - { 8, 0x00022010, 0x00000cba, 0x000e0111, 0x00000a1b }, - { 9, 0x00022010, 0x00000cbe, 0x000e0111, 0x00000a1b }, - { 10, 0x00022010, 0x00000d02, 0x000e0111, 0x00000a1b }, - { 11, 0x00022010, 0x00000d06, 0x000e0111, 0x00000a1b }, - { 12, 0x00022010, 0x00000d0a, 0x000e0111, 0x00000a1b }, - { 13, 0x00022010, 0x00000d0e, 0x000e0111, 0x00000a1b }, - { 14, 0x00022010, 0x00000d1a, 0x000e0111, 0x00000a03 }, -}; - -/* - * RF value list for RF2524 - * Supports: 2.4 GHz - */ -static const struct rf_channel rf_vals_bg_2524[] = { - { 1, 0x00032020, 0x00000c9e, 0x00000101, 0x00000a1b }, - { 2, 0x00032020, 0x00000ca2, 0x00000101, 0x00000a1b }, - { 3, 0x00032020, 0x00000ca6, 0x00000101, 0x00000a1b }, - { 4, 0x00032020, 0x00000caa, 0x00000101, 0x00000a1b }, - { 5, 0x00032020, 0x00000cae, 0x00000101, 0x00000a1b }, - { 6, 0x00032020, 0x00000cb2, 0x00000101, 0x00000a1b }, - { 7, 0x00032020, 0x00000cb6, 0x00000101, 0x00000a1b }, - { 8, 0x00032020, 0x00000cba, 0x00000101, 0x00000a1b }, - { 9, 0x00032020, 0x00000cbe, 0x00000101, 0x00000a1b }, - { 10, 0x00032020, 0x00000d02, 0x00000101, 0x00000a1b }, - { 11, 0x00032020, 0x00000d06, 0x00000101, 0x00000a1b }, - { 12, 0x00032020, 0x00000d0a, 0x00000101, 0x00000a1b }, - { 13, 0x00032020, 0x00000d0e, 0x00000101, 0x00000a1b }, - { 14, 0x00032020, 0x00000d1a, 0x00000101, 0x00000a03 }, -}; - -/* - * RF value list for RF2525 - * Supports: 2.4 GHz - */ -static const struct rf_channel rf_vals_bg_2525[] = { - { 1, 0x00022020, 0x00080c9e, 0x00060111, 0x00000a1b }, - { 2, 0x00022020, 0x00080ca2, 0x00060111, 0x00000a1b }, - { 3, 0x00022020, 0x00080ca6, 0x00060111, 0x00000a1b }, - { 4, 0x00022020, 0x00080caa, 0x00060111, 0x00000a1b }, - { 5, 0x00022020, 0x00080cae, 0x00060111, 0x00000a1b }, - { 6, 0x00022020, 0x00080cb2, 0x00060111, 0x00000a1b }, - { 7, 0x00022020, 0x00080cb6, 0x00060111, 0x00000a1b }, - { 8, 0x00022020, 0x00080cba, 0x00060111, 0x00000a1b }, - { 9, 0x00022020, 0x00080cbe, 0x00060111, 0x00000a1b }, - { 10, 0x00022020, 0x00080d02, 0x00060111, 0x00000a1b }, - { 11, 0x00022020, 0x00080d06, 0x00060111, 0x00000a1b }, - { 12, 0x00022020, 0x00080d0a, 0x00060111, 0x00000a1b }, - { 13, 0x00022020, 0x00080d0e, 0x00060111, 0x00000a1b }, - { 14, 0x00022020, 0x00080d1a, 0x00060111, 0x00000a03 }, -}; - -/* - * RF value list for RF2525e - * Supports: 2.4 GHz - */ -static const struct rf_channel rf_vals_bg_2525e[] = { - { 1, 0x00022010, 0x0000089a, 0x00060111, 0x00000e1b }, - { 2, 0x00022010, 0x0000089e, 0x00060111, 0x00000e07 }, - { 3, 0x00022010, 0x0000089e, 0x00060111, 0x00000e1b }, - { 4, 0x00022010, 0x000008a2, 0x00060111, 0x00000e07 }, - { 5, 0x00022010, 0x000008a2, 0x00060111, 0x00000e1b }, - { 6, 0x00022010, 0x000008a6, 0x00060111, 0x00000e07 }, - { 7, 0x00022010, 0x000008a6, 0x00060111, 0x00000e1b }, - { 8, 0x00022010, 0x000008aa, 0x00060111, 0x00000e07 }, - { 9, 0x00022010, 0x000008aa, 0x00060111, 0x00000e1b }, - { 10, 0x00022010, 0x000008ae, 0x00060111, 0x00000e07 }, - { 11, 0x00022010, 0x000008ae, 0x00060111, 0x00000e1b }, - { 12, 0x00022010, 0x000008b2, 0x00060111, 0x00000e07 }, - { 13, 0x00022010, 0x000008b2, 0x00060111, 0x00000e1b }, - { 14, 0x00022010, 0x000008b6, 0x00060111, 0x00000e23 }, -}; - -/* - * RF value list for RF5222 - * Supports: 2.4 GHz & 5.2 GHz - */ -static const struct rf_channel rf_vals_5222[] = { - { 1, 0x00022020, 0x00001136, 0x00000101, 0x00000a0b }, - { 2, 0x00022020, 0x0000113a, 0x00000101, 0x00000a0b }, - { 3, 0x00022020, 0x0000113e, 0x00000101, 0x00000a0b }, - { 4, 0x00022020, 0x00001182, 0x00000101, 0x00000a0b }, - { 5, 0x00022020, 0x00001186, 0x00000101, 0x00000a0b }, - { 6, 0x00022020, 0x0000118a, 0x00000101, 0x00000a0b }, - { 7, 0x00022020, 0x0000118e, 0x00000101, 0x00000a0b }, - { 8, 0x00022020, 0x00001192, 0x00000101, 0x00000a0b }, - { 9, 0x00022020, 0x00001196, 0x00000101, 0x00000a0b }, - { 10, 0x00022020, 0x0000119a, 0x00000101, 0x00000a0b }, - { 11, 0x00022020, 0x0000119e, 0x00000101, 0x00000a0b }, - { 12, 0x00022020, 0x000011a2, 0x00000101, 0x00000a0b }, - { 13, 0x00022020, 0x000011a6, 0x00000101, 0x00000a0b }, - { 14, 0x00022020, 0x000011ae, 0x00000101, 0x00000a1b }, - - /* 802.11 UNI / HyperLan 2 */ - { 36, 0x00022010, 0x00018896, 0x00000101, 0x00000a1f }, - { 40, 0x00022010, 0x0001889a, 0x00000101, 0x00000a1f }, - { 44, 0x00022010, 0x0001889e, 0x00000101, 0x00000a1f }, - { 48, 0x00022010, 0x000188a2, 0x00000101, 0x00000a1f }, - { 52, 0x00022010, 0x000188a6, 0x00000101, 0x00000a1f }, - { 66, 0x00022010, 0x000188aa, 0x00000101, 0x00000a1f }, - { 60, 0x00022010, 0x000188ae, 0x00000101, 0x00000a1f }, - { 64, 0x00022010, 0x000188b2, 0x00000101, 0x00000a1f }, - - /* 802.11 HyperLan 2 */ - { 100, 0x00022010, 0x00008802, 0x00000101, 0x00000a0f }, - { 104, 0x00022010, 0x00008806, 0x00000101, 0x00000a0f }, - { 108, 0x00022010, 0x0000880a, 0x00000101, 0x00000a0f }, - { 112, 0x00022010, 0x0000880e, 0x00000101, 0x00000a0f }, - { 116, 0x00022010, 0x00008812, 0x00000101, 0x00000a0f }, - { 120, 0x00022010, 0x00008816, 0x00000101, 0x00000a0f }, - { 124, 0x00022010, 0x0000881a, 0x00000101, 0x00000a0f }, - { 128, 0x00022010, 0x0000881e, 0x00000101, 0x00000a0f }, - { 132, 0x00022010, 0x00008822, 0x00000101, 0x00000a0f }, - { 136, 0x00022010, 0x00008826, 0x00000101, 0x00000a0f }, - - /* 802.11 UNII */ - { 140, 0x00022010, 0x0000882a, 0x00000101, 0x00000a0f }, - { 149, 0x00022020, 0x000090a6, 0x00000101, 0x00000a07 }, - { 153, 0x00022020, 0x000090ae, 0x00000101, 0x00000a07 }, - { 157, 0x00022020, 0x000090b6, 0x00000101, 0x00000a07 }, - { 161, 0x00022020, 0x000090be, 0x00000101, 0x00000a07 }, -}; - -static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) -{ - struct hw_mode_spec *spec = &rt2x00dev->spec; - struct channel_info *info; - char *tx_power; - unsigned int i; - - /* - * Initialize all hw fields. - * - * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING unless we are - * capable of sending the buffered frames out after the DTIM - * transmission using rt2x00lib_beacondone. This will send out - * multicast and broadcast traffic immediately instead of buffering it - * infinitly and thus dropping it after some time. - */ - rt2x00dev->hw->flags = - IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_PS_NULLFUNC_STACK; - - SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); - SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, - rt2x00_eeprom_addr(rt2x00dev, - EEPROM_MAC_ADDR_0)); - - /* - * Initialize hw_mode information. - */ - spec->supported_bands = SUPPORT_BAND_2GHZ; - spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; - - if (rt2x00_rf(rt2x00dev, RF2522)) { - spec->num_channels = ARRAY_SIZE(rf_vals_bg_2522); - spec->channels = rf_vals_bg_2522; - } else if (rt2x00_rf(rt2x00dev, RF2523)) { - spec->num_channels = ARRAY_SIZE(rf_vals_bg_2523); - spec->channels = rf_vals_bg_2523; - } else if (rt2x00_rf(rt2x00dev, RF2524)) { - spec->num_channels = ARRAY_SIZE(rf_vals_bg_2524); - spec->channels = rf_vals_bg_2524; - } else if (rt2x00_rf(rt2x00dev, RF2525)) { - spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525); - spec->channels = rf_vals_bg_2525; - } else if (rt2x00_rf(rt2x00dev, RF2525E)) { - spec->num_channels = ARRAY_SIZE(rf_vals_bg_2525e); - spec->channels = rf_vals_bg_2525e; - } else if (rt2x00_rf(rt2x00dev, RF5222)) { - spec->supported_bands |= SUPPORT_BAND_5GHZ; - spec->num_channels = ARRAY_SIZE(rf_vals_5222); - spec->channels = rf_vals_5222; - } - - /* - * Create channel information array - */ - info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); - if (!info) - return -ENOMEM; - - spec->channels_info = info; - - tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); - for (i = 0; i < 14; i++) { - info[i].max_power = MAX_TXPOWER; - info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); - } - - if (spec->num_channels > 14) { - for (i = 14; i < spec->num_channels; i++) { - info[i].max_power = MAX_TXPOWER; - info[i].default_power1 = DEFAULT_TXPOWER; - } - } - - return 0; -} - -static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev) -{ - int retval; - u16 reg; - - /* - * Allocate eeprom data. - */ - retval = rt2500usb_validate_eeprom(rt2x00dev); - if (retval) - return retval; - - retval = rt2500usb_init_eeprom(rt2x00dev); - if (retval) - return retval; - - /* - * Enable rfkill polling by setting GPIO direction of the - * rfkill switch GPIO pin correctly. - */ - rt2500usb_register_read(rt2x00dev, MAC_CSR19, ®); - rt2x00_set_field16(®, MAC_CSR19_DIR0, 0); - rt2500usb_register_write(rt2x00dev, MAC_CSR19, reg); - - /* - * Initialize hw specifications. - */ - retval = rt2500usb_probe_hw_mode(rt2x00dev); - if (retval) - return retval; - - /* - * This device requires the atim queue - */ - __set_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags); - __set_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags); - if (!modparam_nohwcrypt) { - __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags); - __set_bit(REQUIRE_COPY_IV, &rt2x00dev->cap_flags); - } - __set_bit(REQUIRE_SW_SEQNO, &rt2x00dev->cap_flags); - __set_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags); - - /* - * Set the rssi offset. - */ - rt2x00dev->rssi_offset = DEFAULT_RSSI_OFFSET; - - return 0; -} - -static const struct ieee80211_ops rt2500usb_mac80211_ops = { - .tx = rt2x00mac_tx, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, - .remove_interface = rt2x00mac_remove_interface, - .config = rt2x00mac_config, - .configure_filter = rt2x00mac_configure_filter, - .set_tim = rt2x00mac_set_tim, - .set_key = rt2x00mac_set_key, - .sw_scan_start = rt2x00mac_sw_scan_start, - .sw_scan_complete = rt2x00mac_sw_scan_complete, - .get_stats = rt2x00mac_get_stats, - .bss_info_changed = rt2x00mac_bss_info_changed, - .conf_tx = rt2x00mac_conf_tx, - .rfkill_poll = rt2x00mac_rfkill_poll, - .flush = rt2x00mac_flush, - .set_antenna = rt2x00mac_set_antenna, - .get_antenna = rt2x00mac_get_antenna, - .get_ringparam = rt2x00mac_get_ringparam, - .tx_frames_pending = rt2x00mac_tx_frames_pending, -}; - -static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = { - .probe_hw = rt2500usb_probe_hw, - .initialize = rt2x00usb_initialize, - .uninitialize = rt2x00usb_uninitialize, - .clear_entry = rt2x00usb_clear_entry, - .set_device_state = rt2500usb_set_device_state, - .rfkill_poll = rt2500usb_rfkill_poll, - .link_stats = rt2500usb_link_stats, - .reset_tuner = rt2500usb_reset_tuner, - .watchdog = rt2x00usb_watchdog, - .start_queue = rt2500usb_start_queue, - .kick_queue = rt2x00usb_kick_queue, - .stop_queue = rt2500usb_stop_queue, - .flush_queue = rt2x00usb_flush_queue, - .write_tx_desc = rt2500usb_write_tx_desc, - .write_beacon = rt2500usb_write_beacon, - .get_tx_data_len = rt2500usb_get_tx_data_len, - .fill_rxdone = rt2500usb_fill_rxdone, - .config_shared_key = rt2500usb_config_key, - .config_pairwise_key = rt2500usb_config_key, - .config_filter = rt2500usb_config_filter, - .config_intf = rt2500usb_config_intf, - .config_erp = rt2500usb_config_erp, - .config_ant = rt2500usb_config_ant, - .config = rt2500usb_config, -}; - -static const struct data_queue_desc rt2500usb_queue_rx = { - .entry_num = 32, - .data_size = DATA_FRAME_SIZE, - .desc_size = RXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_usb), -}; - -static const struct data_queue_desc rt2500usb_queue_tx = { - .entry_num = 32, - .data_size = DATA_FRAME_SIZE, - .desc_size = TXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_usb), -}; - -static const struct data_queue_desc rt2500usb_queue_bcn = { - .entry_num = 1, - .data_size = MGMT_FRAME_SIZE, - .desc_size = TXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_usb_bcn), -}; - -static const struct data_queue_desc rt2500usb_queue_atim = { - .entry_num = 8, - .data_size = DATA_FRAME_SIZE, - .desc_size = TXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_usb), -}; - -static const struct rt2x00_ops rt2500usb_ops = { - .name = KBUILD_MODNAME, - .max_ap_intf = 1, - .eeprom_size = EEPROM_SIZE, - .rf_size = RF_SIZE, - .tx_queues = NUM_TX_QUEUES, - .extra_tx_headroom = TXD_DESC_SIZE, - .rx = &rt2500usb_queue_rx, - .tx = &rt2500usb_queue_tx, - .bcn = &rt2500usb_queue_bcn, - .atim = &rt2500usb_queue_atim, - .lib = &rt2500usb_rt2x00_ops, - .hw = &rt2500usb_mac80211_ops, -#ifdef CONFIG_RT2X00_LIB_DEBUGFS - .debugfs = &rt2500usb_rt2x00debug, -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -}; - -/* - * rt2500usb module information. - */ -static struct usb_device_id rt2500usb_device_table[] = { - /* ASUS */ - { USB_DEVICE(0x0b05, 0x1706) }, - { USB_DEVICE(0x0b05, 0x1707) }, - /* Belkin */ - { USB_DEVICE(0x050d, 0x7050) }, /* FCC ID: K7SF5D7050A ver. 2.x */ - { USB_DEVICE(0x050d, 0x7051) }, - /* Cisco Systems */ - { USB_DEVICE(0x13b1, 0x000d) }, - { USB_DEVICE(0x13b1, 0x0011) }, - { USB_DEVICE(0x13b1, 0x001a) }, - /* Conceptronic */ - { USB_DEVICE(0x14b2, 0x3c02) }, - /* D-LINK */ - { USB_DEVICE(0x2001, 0x3c00) }, - /* Gigabyte */ - { USB_DEVICE(0x1044, 0x8001) }, - { USB_DEVICE(0x1044, 0x8007) }, - /* Hercules */ - { USB_DEVICE(0x06f8, 0xe000) }, - /* Melco */ - { USB_DEVICE(0x0411, 0x005e) }, - { USB_DEVICE(0x0411, 0x0066) }, - { USB_DEVICE(0x0411, 0x0067) }, - { USB_DEVICE(0x0411, 0x008b) }, - { USB_DEVICE(0x0411, 0x0097) }, - /* MSI */ - { USB_DEVICE(0x0db0, 0x6861) }, - { USB_DEVICE(0x0db0, 0x6865) }, - { USB_DEVICE(0x0db0, 0x6869) }, - /* Ralink */ - { USB_DEVICE(0x148f, 0x1706) }, - { USB_DEVICE(0x148f, 0x2570) }, - { USB_DEVICE(0x148f, 0x9020) }, - /* Sagem */ - { USB_DEVICE(0x079b, 0x004b) }, - /* Siemens */ - { USB_DEVICE(0x0681, 0x3c06) }, - /* SMC */ - { USB_DEVICE(0x0707, 0xee13) }, - /* Spairon */ - { USB_DEVICE(0x114b, 0x0110) }, - /* SURECOM */ - { USB_DEVICE(0x0769, 0x11f3) }, - /* Trust */ - { USB_DEVICE(0x0eb0, 0x9020) }, - /* VTech */ - { USB_DEVICE(0x0f88, 0x3012) }, - /* Zinwell */ - { USB_DEVICE(0x5a57, 0x0260) }, - { 0, } -}; - -MODULE_AUTHOR(DRV_PROJECT); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION("Ralink RT2500 USB Wireless LAN driver."); -MODULE_SUPPORTED_DEVICE("Ralink RT2570 USB chipset based cards"); -MODULE_DEVICE_TABLE(usb, rt2500usb_device_table); -MODULE_LICENSE("GPL"); - -static int rt2500usb_probe(struct usb_interface *usb_intf, - const struct usb_device_id *id) -{ - return rt2x00usb_probe(usb_intf, &rt2500usb_ops); -} - -static struct usb_driver rt2500usb_driver = { - .name = KBUILD_MODNAME, - .id_table = rt2500usb_device_table, - .probe = rt2500usb_probe, - .disconnect = rt2x00usb_disconnect, - .suspend = rt2x00usb_suspend, - .resume = rt2x00usb_resume, - .reset_resume = rt2x00usb_resume, - .disable_hub_initiated_lpm = 1, -}; - -module_usb_driver(rt2500usb_driver); diff --git a/drivers/net/wireless/rt2x00/rt2500usb.h b/drivers/net/wireless/rt2x00/rt2500usb.h deleted file mode 100644 index 1b91a4cef965..000000000000 --- a/drivers/net/wireless/rt2x00/rt2500usb.h +++ /dev/null @@ -1,857 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2500usb - Abstract: Data structures and registers for the rt2500usb module. - Supported chipsets: RT2570. - */ - -#ifndef RT2500USB_H -#define RT2500USB_H - -/* - * RF chip defines. - */ -#define RF2522 0x0000 -#define RF2523 0x0001 -#define RF2524 0x0002 -#define RF2525 0x0003 -#define RF2525E 0x0005 -#define RF5222 0x0010 - -/* - * RT2570 version - */ -#define RT2570_VERSION_B 2 -#define RT2570_VERSION_C 3 -#define RT2570_VERSION_D 4 - -/* - * Signal information. - * Default offset is required for RSSI <-> dBm conversion. - */ -#define DEFAULT_RSSI_OFFSET 120 - -/* - * Register layout information. - */ -#define CSR_REG_BASE 0x0400 -#define CSR_REG_SIZE 0x0100 -#define EEPROM_BASE 0x0000 -#define EEPROM_SIZE 0x006a -#define BBP_BASE 0x0000 -#define BBP_SIZE 0x0060 -#define RF_BASE 0x0004 -#define RF_SIZE 0x0010 - -/* - * Number of TX queues. - */ -#define NUM_TX_QUEUES 2 - -/* - * Control/Status Registers(CSR). - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * MAC_CSR0: ASIC revision number. - */ -#define MAC_CSR0 0x0400 - -/* - * MAC_CSR1: System control. - * SOFT_RESET: Software reset, 1: reset, 0: normal. - * BBP_RESET: Hardware reset, 1: reset, 0, release. - * HOST_READY: Host ready after initialization. - */ -#define MAC_CSR1 0x0402 -#define MAC_CSR1_SOFT_RESET FIELD16(0x00000001) -#define MAC_CSR1_BBP_RESET FIELD16(0x00000002) -#define MAC_CSR1_HOST_READY FIELD16(0x00000004) - -/* - * MAC_CSR2: STA MAC register 0. - */ -#define MAC_CSR2 0x0404 -#define MAC_CSR2_BYTE0 FIELD16(0x00ff) -#define MAC_CSR2_BYTE1 FIELD16(0xff00) - -/* - * MAC_CSR3: STA MAC register 1. - */ -#define MAC_CSR3 0x0406 -#define MAC_CSR3_BYTE2 FIELD16(0x00ff) -#define MAC_CSR3_BYTE3 FIELD16(0xff00) - -/* - * MAC_CSR4: STA MAC register 2. - */ -#define MAC_CSR4 0X0408 -#define MAC_CSR4_BYTE4 FIELD16(0x00ff) -#define MAC_CSR4_BYTE5 FIELD16(0xff00) - -/* - * MAC_CSR5: BSSID register 0. - */ -#define MAC_CSR5 0x040a -#define MAC_CSR5_BYTE0 FIELD16(0x00ff) -#define MAC_CSR5_BYTE1 FIELD16(0xff00) - -/* - * MAC_CSR6: BSSID register 1. - */ -#define MAC_CSR6 0x040c -#define MAC_CSR6_BYTE2 FIELD16(0x00ff) -#define MAC_CSR6_BYTE3 FIELD16(0xff00) - -/* - * MAC_CSR7: BSSID register 2. - */ -#define MAC_CSR7 0x040e -#define MAC_CSR7_BYTE4 FIELD16(0x00ff) -#define MAC_CSR7_BYTE5 FIELD16(0xff00) - -/* - * MAC_CSR8: Max frame length. - */ -#define MAC_CSR8 0x0410 -#define MAC_CSR8_MAX_FRAME_UNIT FIELD16(0x0fff) - -/* - * Misc MAC_CSR registers. - * MAC_CSR9: Timer control. - * MAC_CSR10: Slot time. - * MAC_CSR11: SIFS. - * MAC_CSR12: EIFS. - * MAC_CSR13: Power mode0. - * MAC_CSR14: Power mode1. - * MAC_CSR15: Power saving transition0 - * MAC_CSR16: Power saving transition1 - */ -#define MAC_CSR9 0x0412 -#define MAC_CSR10 0x0414 -#define MAC_CSR11 0x0416 -#define MAC_CSR12 0x0418 -#define MAC_CSR13 0x041a -#define MAC_CSR14 0x041c -#define MAC_CSR15 0x041e -#define MAC_CSR16 0x0420 - -/* - * MAC_CSR17: Manual power control / status register. - * Allowed state: 0 deep_sleep, 1: sleep, 2: standby, 3: awake. - * SET_STATE: Set state. Write 1 to trigger, self cleared. - * BBP_DESIRE_STATE: BBP desired state. - * RF_DESIRE_STATE: RF desired state. - * BBP_CURRENT_STATE: BBP current state. - * RF_CURRENT_STATE: RF current state. - * PUT_TO_SLEEP: Put to sleep. Write 1 to trigger, self cleared. - */ -#define MAC_CSR17 0x0422 -#define MAC_CSR17_SET_STATE FIELD16(0x0001) -#define MAC_CSR17_BBP_DESIRE_STATE FIELD16(0x0006) -#define MAC_CSR17_RF_DESIRE_STATE FIELD16(0x0018) -#define MAC_CSR17_BBP_CURR_STATE FIELD16(0x0060) -#define MAC_CSR17_RF_CURR_STATE FIELD16(0x0180) -#define MAC_CSR17_PUT_TO_SLEEP FIELD16(0x0200) - -/* - * MAC_CSR18: Wakeup timer register. - * DELAY_AFTER_BEACON: Delay after Tbcn expired in units of 1/16 TU. - * BEACONS_BEFORE_WAKEUP: Number of beacon before wakeup. - * AUTO_WAKE: Enable auto wakeup / sleep mechanism. - */ -#define MAC_CSR18 0x0424 -#define MAC_CSR18_DELAY_AFTER_BEACON FIELD16(0x00ff) -#define MAC_CSR18_BEACONS_BEFORE_WAKEUP FIELD16(0x7f00) -#define MAC_CSR18_AUTO_WAKE FIELD16(0x8000) - -/* - * MAC_CSR19: GPIO control register. - * MAC_CSR19_VALx: GPIO value - * MAC_CSR19_DIRx: GPIO direction: 0 = input; 1 = output - */ -#define MAC_CSR19 0x0426 -#define MAC_CSR19_VAL0 FIELD16(0x0001) -#define MAC_CSR19_VAL1 FIELD16(0x0002) -#define MAC_CSR19_VAL2 FIELD16(0x0004) -#define MAC_CSR19_VAL3 FIELD16(0x0008) -#define MAC_CSR19_VAL4 FIELD16(0x0010) -#define MAC_CSR19_VAL5 FIELD16(0x0020) -#define MAC_CSR19_VAL6 FIELD16(0x0040) -#define MAC_CSR19_VAL7 FIELD16(0x0080) -#define MAC_CSR19_DIR0 FIELD16(0x0100) -#define MAC_CSR19_DIR1 FIELD16(0x0200) -#define MAC_CSR19_DIR2 FIELD16(0x0400) -#define MAC_CSR19_DIR3 FIELD16(0x0800) -#define MAC_CSR19_DIR4 FIELD16(0x1000) -#define MAC_CSR19_DIR5 FIELD16(0x2000) -#define MAC_CSR19_DIR6 FIELD16(0x4000) -#define MAC_CSR19_DIR7 FIELD16(0x8000) - -/* - * MAC_CSR20: LED control register. - * ACTIVITY: 0: idle, 1: active. - * LINK: 0: linkoff, 1: linkup. - * ACTIVITY_POLARITY: 0: active low, 1: active high. - */ -#define MAC_CSR20 0x0428 -#define MAC_CSR20_ACTIVITY FIELD16(0x0001) -#define MAC_CSR20_LINK FIELD16(0x0002) -#define MAC_CSR20_ACTIVITY_POLARITY FIELD16(0x0004) - -/* - * MAC_CSR21: LED control register. - * ON_PERIOD: On period, default 70ms. - * OFF_PERIOD: Off period, default 30ms. - */ -#define MAC_CSR21 0x042a -#define MAC_CSR21_ON_PERIOD FIELD16(0x00ff) -#define MAC_CSR21_OFF_PERIOD FIELD16(0xff00) - -/* - * MAC_CSR22: Collision window control register. - */ -#define MAC_CSR22 0x042c - -/* - * Transmit related CSRs. - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * TXRX_CSR0: Security control register. - */ -#define TXRX_CSR0 0x0440 -#define TXRX_CSR0_ALGORITHM FIELD16(0x0007) -#define TXRX_CSR0_IV_OFFSET FIELD16(0x01f8) -#define TXRX_CSR0_KEY_ID FIELD16(0x1e00) - -/* - * TXRX_CSR1: TX configuration. - * ACK_TIMEOUT: ACK Timeout in unit of 1-us. - * TSF_OFFSET: TSF offset in MAC header. - * AUTO_SEQUENCE: Let ASIC control frame sequence number. - */ -#define TXRX_CSR1 0x0442 -#define TXRX_CSR1_ACK_TIMEOUT FIELD16(0x00ff) -#define TXRX_CSR1_TSF_OFFSET FIELD16(0x7f00) -#define TXRX_CSR1_AUTO_SEQUENCE FIELD16(0x8000) - -/* - * TXRX_CSR2: RX control. - * DISABLE_RX: Disable rx engine. - * DROP_CRC: Drop crc error. - * DROP_PHYSICAL: Drop physical error. - * DROP_CONTROL: Drop control frame. - * DROP_NOT_TO_ME: Drop not to me unicast frame. - * DROP_TODS: Drop frame tods bit is true. - * DROP_VERSION_ERROR: Drop version error frame. - * DROP_MCAST: Drop multicast frames. - * DROP_BCAST: Drop broadcast frames. - */ -#define TXRX_CSR2 0x0444 -#define TXRX_CSR2_DISABLE_RX FIELD16(0x0001) -#define TXRX_CSR2_DROP_CRC FIELD16(0x0002) -#define TXRX_CSR2_DROP_PHYSICAL FIELD16(0x0004) -#define TXRX_CSR2_DROP_CONTROL FIELD16(0x0008) -#define TXRX_CSR2_DROP_NOT_TO_ME FIELD16(0x0010) -#define TXRX_CSR2_DROP_TODS FIELD16(0x0020) -#define TXRX_CSR2_DROP_VERSION_ERROR FIELD16(0x0040) -#define TXRX_CSR2_DROP_MULTICAST FIELD16(0x0200) -#define TXRX_CSR2_DROP_BROADCAST FIELD16(0x0400) - -/* - * RX BBP ID registers - * TXRX_CSR3: CCK RX BBP ID. - * TXRX_CSR4: OFDM RX BBP ID. - */ -#define TXRX_CSR3 0x0446 -#define TXRX_CSR4 0x0448 - -/* - * TXRX_CSR5: CCK TX BBP ID0. - */ -#define TXRX_CSR5 0x044a -#define TXRX_CSR5_BBP_ID0 FIELD16(0x007f) -#define TXRX_CSR5_BBP_ID0_VALID FIELD16(0x0080) -#define TXRX_CSR5_BBP_ID1 FIELD16(0x7f00) -#define TXRX_CSR5_BBP_ID1_VALID FIELD16(0x8000) - -/* - * TXRX_CSR6: CCK TX BBP ID1. - */ -#define TXRX_CSR6 0x044c -#define TXRX_CSR6_BBP_ID0 FIELD16(0x007f) -#define TXRX_CSR6_BBP_ID0_VALID FIELD16(0x0080) -#define TXRX_CSR6_BBP_ID1 FIELD16(0x7f00) -#define TXRX_CSR6_BBP_ID1_VALID FIELD16(0x8000) - -/* - * TXRX_CSR7: OFDM TX BBP ID0. - */ -#define TXRX_CSR7 0x044e -#define TXRX_CSR7_BBP_ID0 FIELD16(0x007f) -#define TXRX_CSR7_BBP_ID0_VALID FIELD16(0x0080) -#define TXRX_CSR7_BBP_ID1 FIELD16(0x7f00) -#define TXRX_CSR7_BBP_ID1_VALID FIELD16(0x8000) - -/* - * TXRX_CSR8: OFDM TX BBP ID1. - */ -#define TXRX_CSR8 0x0450 -#define TXRX_CSR8_BBP_ID0 FIELD16(0x007f) -#define TXRX_CSR8_BBP_ID0_VALID FIELD16(0x0080) -#define TXRX_CSR8_BBP_ID1 FIELD16(0x7f00) -#define TXRX_CSR8_BBP_ID1_VALID FIELD16(0x8000) - -/* - * TXRX_CSR9: TX ACK time-out. - */ -#define TXRX_CSR9 0x0452 - -/* - * TXRX_CSR10: Auto responder control. - */ -#define TXRX_CSR10 0x0454 -#define TXRX_CSR10_AUTORESPOND_PREAMBLE FIELD16(0x0004) - -/* - * TXRX_CSR11: Auto responder basic rate. - */ -#define TXRX_CSR11 0x0456 - -/* - * ACK/CTS time registers. - */ -#define TXRX_CSR12 0x0458 -#define TXRX_CSR13 0x045a -#define TXRX_CSR14 0x045c -#define TXRX_CSR15 0x045e -#define TXRX_CSR16 0x0460 -#define TXRX_CSR17 0x0462 - -/* - * TXRX_CSR18: Synchronization control register. - */ -#define TXRX_CSR18 0x0464 -#define TXRX_CSR18_OFFSET FIELD16(0x000f) -#define TXRX_CSR18_INTERVAL FIELD16(0xfff0) - -/* - * TXRX_CSR19: Synchronization control register. - * TSF_COUNT: Enable TSF auto counting. - * TSF_SYNC: Tsf sync, 0: disable, 1: infra, 2: ad-hoc/master mode. - * TBCN: Enable Tbcn with reload value. - * BEACON_GEN: Enable beacon generator. - */ -#define TXRX_CSR19 0x0466 -#define TXRX_CSR19_TSF_COUNT FIELD16(0x0001) -#define TXRX_CSR19_TSF_SYNC FIELD16(0x0006) -#define TXRX_CSR19_TBCN FIELD16(0x0008) -#define TXRX_CSR19_BEACON_GEN FIELD16(0x0010) - -/* - * TXRX_CSR20: Tx BEACON offset time control register. - * OFFSET: In units of usec. - * BCN_EXPECT_WINDOW: Default: 2^CWmin - */ -#define TXRX_CSR20 0x0468 -#define TXRX_CSR20_OFFSET FIELD16(0x1fff) -#define TXRX_CSR20_BCN_EXPECT_WINDOW FIELD16(0xe000) - -/* - * TXRX_CSR21 - */ -#define TXRX_CSR21 0x046a - -/* - * Encryption related CSRs. - * - */ - -/* - * SEC_CSR0: Shared key 0, word 0 - * SEC_CSR1: Shared key 0, word 1 - * SEC_CSR2: Shared key 0, word 2 - * SEC_CSR3: Shared key 0, word 3 - * SEC_CSR4: Shared key 0, word 4 - * SEC_CSR5: Shared key 0, word 5 - * SEC_CSR6: Shared key 0, word 6 - * SEC_CSR7: Shared key 0, word 7 - */ -#define SEC_CSR0 0x0480 -#define SEC_CSR1 0x0482 -#define SEC_CSR2 0x0484 -#define SEC_CSR3 0x0486 -#define SEC_CSR4 0x0488 -#define SEC_CSR5 0x048a -#define SEC_CSR6 0x048c -#define SEC_CSR7 0x048e - -/* - * SEC_CSR8: Shared key 1, word 0 - * SEC_CSR9: Shared key 1, word 1 - * SEC_CSR10: Shared key 1, word 2 - * SEC_CSR11: Shared key 1, word 3 - * SEC_CSR12: Shared key 1, word 4 - * SEC_CSR13: Shared key 1, word 5 - * SEC_CSR14: Shared key 1, word 6 - * SEC_CSR15: Shared key 1, word 7 - */ -#define SEC_CSR8 0x0490 -#define SEC_CSR9 0x0492 -#define SEC_CSR10 0x0494 -#define SEC_CSR11 0x0496 -#define SEC_CSR12 0x0498 -#define SEC_CSR13 0x049a -#define SEC_CSR14 0x049c -#define SEC_CSR15 0x049e - -/* - * SEC_CSR16: Shared key 2, word 0 - * SEC_CSR17: Shared key 2, word 1 - * SEC_CSR18: Shared key 2, word 2 - * SEC_CSR19: Shared key 2, word 3 - * SEC_CSR20: Shared key 2, word 4 - * SEC_CSR21: Shared key 2, word 5 - * SEC_CSR22: Shared key 2, word 6 - * SEC_CSR23: Shared key 2, word 7 - */ -#define SEC_CSR16 0x04a0 -#define SEC_CSR17 0x04a2 -#define SEC_CSR18 0X04A4 -#define SEC_CSR19 0x04a6 -#define SEC_CSR20 0x04a8 -#define SEC_CSR21 0x04aa -#define SEC_CSR22 0x04ac -#define SEC_CSR23 0x04ae - -/* - * SEC_CSR24: Shared key 3, word 0 - * SEC_CSR25: Shared key 3, word 1 - * SEC_CSR26: Shared key 3, word 2 - * SEC_CSR27: Shared key 3, word 3 - * SEC_CSR28: Shared key 3, word 4 - * SEC_CSR29: Shared key 3, word 5 - * SEC_CSR30: Shared key 3, word 6 - * SEC_CSR31: Shared key 3, word 7 - */ -#define SEC_CSR24 0x04b0 -#define SEC_CSR25 0x04b2 -#define SEC_CSR26 0x04b4 -#define SEC_CSR27 0x04b6 -#define SEC_CSR28 0x04b8 -#define SEC_CSR29 0x04ba -#define SEC_CSR30 0x04bc -#define SEC_CSR31 0x04be - -#define KEY_ENTRY(__idx) \ - ( SEC_CSR0 + ((__idx) * 16) ) - -/* - * PHY control registers. - */ - -/* - * PHY_CSR0: RF switching timing control. - */ -#define PHY_CSR0 0x04c0 - -/* - * PHY_CSR1: TX PA configuration. - */ -#define PHY_CSR1 0x04c2 - -/* - * MAC configuration registers. - */ - -/* - * PHY_CSR2: TX MAC configuration. - * NOTE: Both register fields are complete dummy, - * documentation and legacy drivers are unclear un - * what this register means or what fields exists. - */ -#define PHY_CSR2 0x04c4 -#define PHY_CSR2_LNA FIELD16(0x0002) -#define PHY_CSR2_LNA_MODE FIELD16(0x3000) - -/* - * PHY_CSR3: RX MAC configuration. - */ -#define PHY_CSR3 0x04c6 - -/* - * PHY_CSR4: Interface configuration. - */ -#define PHY_CSR4 0x04c8 -#define PHY_CSR4_LOW_RF_LE FIELD16(0x0001) - -/* - * BBP pre-TX registers. - * PHY_CSR5: BBP pre-TX CCK. - */ -#define PHY_CSR5 0x04ca -#define PHY_CSR5_CCK FIELD16(0x0003) -#define PHY_CSR5_CCK_FLIP FIELD16(0x0004) - -/* - * BBP pre-TX registers. - * PHY_CSR6: BBP pre-TX OFDM. - */ -#define PHY_CSR6 0x04cc -#define PHY_CSR6_OFDM FIELD16(0x0003) -#define PHY_CSR6_OFDM_FLIP FIELD16(0x0004) - -/* - * PHY_CSR7: BBP access register 0. - * BBP_DATA: BBP data. - * BBP_REG_ID: BBP register ID. - * BBP_READ_CONTROL: 0: write, 1: read. - */ -#define PHY_CSR7 0x04ce -#define PHY_CSR7_DATA FIELD16(0x00ff) -#define PHY_CSR7_REG_ID FIELD16(0x7f00) -#define PHY_CSR7_READ_CONTROL FIELD16(0x8000) - -/* - * PHY_CSR8: BBP access register 1. - * BBP_BUSY: ASIC is busy execute BBP programming. - */ -#define PHY_CSR8 0x04d0 -#define PHY_CSR8_BUSY FIELD16(0x0001) - -/* - * PHY_CSR9: RF access register. - * RF_VALUE: Register value + id to program into rf/if. - */ -#define PHY_CSR9 0x04d2 -#define PHY_CSR9_RF_VALUE FIELD16(0xffff) - -/* - * PHY_CSR10: RF access register. - * RF_VALUE: Register value + id to program into rf/if. - * RF_NUMBER_OF_BITS: Number of bits used in value (i:20, rfmd:22). - * RF_IF_SELECT: Chip to program: 0: rf, 1: if. - * RF_PLL_LD: Rf pll_ld status. - * RF_BUSY: 1: asic is busy execute rf programming. - */ -#define PHY_CSR10 0x04d4 -#define PHY_CSR10_RF_VALUE FIELD16(0x00ff) -#define PHY_CSR10_RF_NUMBER_OF_BITS FIELD16(0x1f00) -#define PHY_CSR10_RF_IF_SELECT FIELD16(0x2000) -#define PHY_CSR10_RF_PLL_LD FIELD16(0x4000) -#define PHY_CSR10_RF_BUSY FIELD16(0x8000) - -/* - * STA_CSR0: FCS error count. - * FCS_ERROR: FCS error count, cleared when read. - */ -#define STA_CSR0 0x04e0 -#define STA_CSR0_FCS_ERROR FIELD16(0xffff) - -/* - * STA_CSR1: PLCP error count. - */ -#define STA_CSR1 0x04e2 - -/* - * STA_CSR2: LONG error count. - */ -#define STA_CSR2 0x04e4 - -/* - * STA_CSR3: CCA false alarm. - * FALSE_CCA_ERROR: False CCA error count, cleared when read. - */ -#define STA_CSR3 0x04e6 -#define STA_CSR3_FALSE_CCA_ERROR FIELD16(0xffff) - -/* - * STA_CSR4: RX FIFO overflow. - */ -#define STA_CSR4 0x04e8 - -/* - * STA_CSR5: Beacon sent counter. - */ -#define STA_CSR5 0x04ea - -/* - * Statistics registers - */ -#define STA_CSR6 0x04ec -#define STA_CSR7 0x04ee -#define STA_CSR8 0x04f0 -#define STA_CSR9 0x04f2 -#define STA_CSR10 0x04f4 - -/* - * BBP registers. - * The wordsize of the BBP is 8 bits. - */ - -/* - * R2: TX antenna control - */ -#define BBP_R2_TX_ANTENNA FIELD8(0x03) -#define BBP_R2_TX_IQ_FLIP FIELD8(0x04) - -/* - * R14: RX antenna control - */ -#define BBP_R14_RX_ANTENNA FIELD8(0x03) -#define BBP_R14_RX_IQ_FLIP FIELD8(0x04) - -/* - * RF registers. - */ - -/* - * RF 1 - */ -#define RF1_TUNER FIELD32(0x00020000) - -/* - * RF 3 - */ -#define RF3_TUNER FIELD32(0x00000100) -#define RF3_TXPOWER FIELD32(0x00003e00) - -/* - * EEPROM contents. - */ - -/* - * HW MAC address. - */ -#define EEPROM_MAC_ADDR_0 0x0002 -#define EEPROM_MAC_ADDR_BYTE0 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE1 FIELD16(0xff00) -#define EEPROM_MAC_ADDR1 0x0003 -#define EEPROM_MAC_ADDR_BYTE2 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE3 FIELD16(0xff00) -#define EEPROM_MAC_ADDR_2 0x0004 -#define EEPROM_MAC_ADDR_BYTE4 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE5 FIELD16(0xff00) - -/* - * EEPROM antenna. - * ANTENNA_NUM: Number of antenna's. - * TX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B. - * RX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B. - * LED_MODE: 0: default, 1: TX/RX activity, 2: Single (ignore link), 3: rsvd. - * DYN_TXAGC: Dynamic TX AGC control. - * HARDWARE_RADIO: 1: Hardware controlled radio. Read GPIO0. - * RF_TYPE: Rf_type of this adapter. - */ -#define EEPROM_ANTENNA 0x000b -#define EEPROM_ANTENNA_NUM FIELD16(0x0003) -#define EEPROM_ANTENNA_TX_DEFAULT FIELD16(0x000c) -#define EEPROM_ANTENNA_RX_DEFAULT FIELD16(0x0030) -#define EEPROM_ANTENNA_LED_MODE FIELD16(0x01c0) -#define EEPROM_ANTENNA_DYN_TXAGC FIELD16(0x0200) -#define EEPROM_ANTENNA_HARDWARE_RADIO FIELD16(0x0400) -#define EEPROM_ANTENNA_RF_TYPE FIELD16(0xf800) - -/* - * EEPROM NIC config. - * CARDBUS_ACCEL: 0: enable, 1: disable. - * DYN_BBP_TUNE: 0: enable, 1: disable. - * CCK_TX_POWER: CCK TX power compensation. - */ -#define EEPROM_NIC 0x000c -#define EEPROM_NIC_CARDBUS_ACCEL FIELD16(0x0001) -#define EEPROM_NIC_DYN_BBP_TUNE FIELD16(0x0002) -#define EEPROM_NIC_CCK_TX_POWER FIELD16(0x000c) - -/* - * EEPROM geography. - * GEO: Default geography setting for device. - */ -#define EEPROM_GEOGRAPHY 0x000d -#define EEPROM_GEOGRAPHY_GEO FIELD16(0x0f00) - -/* - * EEPROM BBP. - */ -#define EEPROM_BBP_START 0x000e -#define EEPROM_BBP_SIZE 16 -#define EEPROM_BBP_VALUE FIELD16(0x00ff) -#define EEPROM_BBP_REG_ID FIELD16(0xff00) - -/* - * EEPROM TXPOWER - */ -#define EEPROM_TXPOWER_START 0x001e -#define EEPROM_TXPOWER_SIZE 7 -#define EEPROM_TXPOWER_1 FIELD16(0x00ff) -#define EEPROM_TXPOWER_2 FIELD16(0xff00) - -/* - * EEPROM Tuning threshold - */ -#define EEPROM_BBPTUNE 0x0030 -#define EEPROM_BBPTUNE_THRESHOLD FIELD16(0x00ff) - -/* - * EEPROM BBP R24 Tuning. - */ -#define EEPROM_BBPTUNE_R24 0x0031 -#define EEPROM_BBPTUNE_R24_LOW FIELD16(0x00ff) -#define EEPROM_BBPTUNE_R24_HIGH FIELD16(0xff00) - -/* - * EEPROM BBP R25 Tuning. - */ -#define EEPROM_BBPTUNE_R25 0x0032 -#define EEPROM_BBPTUNE_R25_LOW FIELD16(0x00ff) -#define EEPROM_BBPTUNE_R25_HIGH FIELD16(0xff00) - -/* - * EEPROM BBP R24 Tuning. - */ -#define EEPROM_BBPTUNE_R61 0x0033 -#define EEPROM_BBPTUNE_R61_LOW FIELD16(0x00ff) -#define EEPROM_BBPTUNE_R61_HIGH FIELD16(0xff00) - -/* - * EEPROM BBP VGC Tuning. - */ -#define EEPROM_BBPTUNE_VGC 0x0034 -#define EEPROM_BBPTUNE_VGCUPPER FIELD16(0x00ff) -#define EEPROM_BBPTUNE_VGCLOWER FIELD16(0xff00) - -/* - * EEPROM BBP R17 Tuning. - */ -#define EEPROM_BBPTUNE_R17 0x0035 -#define EEPROM_BBPTUNE_R17_LOW FIELD16(0x00ff) -#define EEPROM_BBPTUNE_R17_HIGH FIELD16(0xff00) - -/* - * RSSI <-> dBm offset calibration - */ -#define EEPROM_CALIBRATE_OFFSET 0x0036 -#define EEPROM_CALIBRATE_OFFSET_RSSI FIELD16(0x00ff) - -/* - * DMA descriptor defines. - */ -#define TXD_DESC_SIZE ( 5 * sizeof(__le32) ) -#define RXD_DESC_SIZE ( 4 * sizeof(__le32) ) - -/* - * TX descriptor format for TX, PRIO, ATIM and Beacon Ring. - */ - -/* - * Word0 - */ -#define TXD_W0_PACKET_ID FIELD32(0x0000000f) -#define TXD_W0_RETRY_LIMIT FIELD32(0x000000f0) -#define TXD_W0_MORE_FRAG FIELD32(0x00000100) -#define TXD_W0_ACK FIELD32(0x00000200) -#define TXD_W0_TIMESTAMP FIELD32(0x00000400) -#define TXD_W0_OFDM FIELD32(0x00000800) -#define TXD_W0_NEW_SEQ FIELD32(0x00001000) -#define TXD_W0_IFS FIELD32(0x00006000) -#define TXD_W0_DATABYTE_COUNT FIELD32(0x0fff0000) -#define TXD_W0_CIPHER FIELD32(0x20000000) -#define TXD_W0_KEY_ID FIELD32(0xc0000000) - -/* - * Word1 - */ -#define TXD_W1_IV_OFFSET FIELD32(0x0000003f) -#define TXD_W1_AIFS FIELD32(0x000000c0) -#define TXD_W1_CWMIN FIELD32(0x00000f00) -#define TXD_W1_CWMAX FIELD32(0x0000f000) - -/* - * Word2: PLCP information - */ -#define TXD_W2_PLCP_SIGNAL FIELD32(0x000000ff) -#define TXD_W2_PLCP_SERVICE FIELD32(0x0000ff00) -#define TXD_W2_PLCP_LENGTH_LOW FIELD32(0x00ff0000) -#define TXD_W2_PLCP_LENGTH_HIGH FIELD32(0xff000000) - -/* - * Word3 - */ -#define TXD_W3_IV FIELD32(0xffffffff) - -/* - * Word4 - */ -#define TXD_W4_EIV FIELD32(0xffffffff) - -/* - * RX descriptor format for RX Ring. - */ - -/* - * Word0 - */ -#define RXD_W0_UNICAST_TO_ME FIELD32(0x00000002) -#define RXD_W0_MULTICAST FIELD32(0x00000004) -#define RXD_W0_BROADCAST FIELD32(0x00000008) -#define RXD_W0_MY_BSS FIELD32(0x00000010) -#define RXD_W0_CRC_ERROR FIELD32(0x00000020) -#define RXD_W0_OFDM FIELD32(0x00000040) -#define RXD_W0_PHYSICAL_ERROR FIELD32(0x00000080) -#define RXD_W0_CIPHER FIELD32(0x00000100) -#define RXD_W0_CIPHER_ERROR FIELD32(0x00000200) -#define RXD_W0_DATABYTE_COUNT FIELD32(0x0fff0000) - -/* - * Word1 - */ -#define RXD_W1_RSSI FIELD32(0x000000ff) -#define RXD_W1_SIGNAL FIELD32(0x0000ff00) - -/* - * Word2 - */ -#define RXD_W2_IV FIELD32(0xffffffff) - -/* - * Word3 - */ -#define RXD_W3_EIV FIELD32(0xffffffff) - -/* - * Macros for converting txpower from EEPROM to mac80211 value - * and from mac80211 value to register value. - */ -#define MIN_TXPOWER 0 -#define MAX_TXPOWER 31 -#define DEFAULT_TXPOWER 24 - -#define TXPOWER_FROM_DEV(__txpower) \ - (((u8)(__txpower)) > MAX_TXPOWER) ? DEFAULT_TXPOWER : (__txpower) - -#define TXPOWER_TO_DEV(__txpower) \ - clamp_t(char, __txpower, MIN_TXPOWER, MAX_TXPOWER) - -#endif /* RT2500USB_H */ diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h deleted file mode 100644 index a7630d5ec892..000000000000 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ /dev/null @@ -1,2787 +0,0 @@ -/* - Copyright (C) 2004 - 2010 Ivo van Doorn - Copyright (C) 2010 Willow Garage - Copyright (C) 2009 Alban Browaeys - Copyright (C) 2009 Felix Fietkau - Copyright (C) 2009 Luis Correia - Copyright (C) 2009 Mattias Nissler - Copyright (C) 2009 Mark Asselstine - Copyright (C) 2009 Xose Vazquez Perez - Copyright (C) 2009 Bart Zolnierkiewicz - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2800 - Abstract: Data structures and registers for the rt2800 modules. - Supported chipsets: RT2800E, RT2800ED & RT2800U. - */ - -#ifndef RT2800_H -#define RT2800_H - -/* - * RF chip defines. - * - * RF2820 2.4G 2T3R - * RF2850 2.4G/5G 2T3R - * RF2720 2.4G 1T2R - * RF2750 2.4G/5G 1T2R - * RF3020 2.4G 1T1R - * RF2020 2.4G B/G - * RF3021 2.4G 1T2R - * RF3022 2.4G 2T2R - * RF3052 2.4G/5G 2T2R - * RF2853 2.4G/5G 3T3R - * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390) - * RF3322 2.4G 2T2R(RT3352/RT3371/RT3372/RT3391/RT3392) - * RF3053 2.4G/5G 3T3R(RT3883/RT3563/RT3573/RT3593/RT3662) - * RF5592 2.4G/5G 2T2R - * RF5360 2.4G 1T1R - * RF5370 2.4G 1T1R - * RF5390 2.4G 1T1R - */ -#define RF2820 0x0001 -#define RF2850 0x0002 -#define RF2720 0x0003 -#define RF2750 0x0004 -#define RF3020 0x0005 -#define RF2020 0x0006 -#define RF3021 0x0007 -#define RF3022 0x0008 -#define RF3052 0x0009 -#define RF2853 0x000a -#define RF3320 0x000b -#define RF3322 0x000c -#define RF3053 0x000d -#define RF5592 0x000f -#define RF3290 0x3290 -#define RF5360 0x5360 -#define RF5370 0x5370 -#define RF5372 0x5372 -#define RF5390 0x5390 -#define RF5392 0x5392 - -/* - * Chipset revisions. - */ -#define REV_RT2860C 0x0100 -#define REV_RT2860D 0x0101 -#define REV_RT2872E 0x0200 -#define REV_RT3070E 0x0200 -#define REV_RT3070F 0x0201 -#define REV_RT3071E 0x0211 -#define REV_RT3090E 0x0211 -#define REV_RT3390E 0x0211 -#define REV_RT5390F 0x0502 -#define REV_RT5390R 0x1502 -#define REV_RT5592C 0x0221 - -#define DEFAULT_RSSI_OFFSET 120 - -/* - * Register layout information. - */ -#define CSR_REG_BASE 0x1000 -#define CSR_REG_SIZE 0x0800 -#define EEPROM_BASE 0x0000 -#define EEPROM_SIZE 0x0110 -#define BBP_BASE 0x0000 -#define BBP_SIZE 0x00ff -#define RF_BASE 0x0004 -#define RF_SIZE 0x0010 -#define RFCSR_BASE 0x0000 -#define RFCSR_SIZE 0x0040 - -/* - * Number of TX queues. - */ -#define NUM_TX_QUEUES 4 - -/* - * Registers. - */ - - -/* - * MAC_CSR0_3290: MAC_CSR0 for RT3290 to identity MAC version number. - */ -#define MAC_CSR0_3290 0x0000 - -/* - * E2PROM_CSR: PCI EEPROM control register. - * RELOAD: Write 1 to reload eeprom content. - * TYPE: 0: 93c46, 1:93c66. - * LOAD_STATUS: 1:loading, 0:done. - */ -#define E2PROM_CSR 0x0004 -#define E2PROM_CSR_DATA_CLOCK FIELD32(0x00000001) -#define E2PROM_CSR_CHIP_SELECT FIELD32(0x00000002) -#define E2PROM_CSR_DATA_IN FIELD32(0x00000004) -#define E2PROM_CSR_DATA_OUT FIELD32(0x00000008) -#define E2PROM_CSR_TYPE FIELD32(0x00000030) -#define E2PROM_CSR_LOAD_STATUS FIELD32(0x00000040) -#define E2PROM_CSR_RELOAD FIELD32(0x00000080) - -/* - * CMB_CTRL_CFG - */ -#define CMB_CTRL 0x0020 -#define AUX_OPT_BIT0 FIELD32(0x00000001) -#define AUX_OPT_BIT1 FIELD32(0x00000002) -#define AUX_OPT_BIT2 FIELD32(0x00000004) -#define AUX_OPT_BIT3 FIELD32(0x00000008) -#define AUX_OPT_BIT4 FIELD32(0x00000010) -#define AUX_OPT_BIT5 FIELD32(0x00000020) -#define AUX_OPT_BIT6 FIELD32(0x00000040) -#define AUX_OPT_BIT7 FIELD32(0x00000080) -#define AUX_OPT_BIT8 FIELD32(0x00000100) -#define AUX_OPT_BIT9 FIELD32(0x00000200) -#define AUX_OPT_BIT10 FIELD32(0x00000400) -#define AUX_OPT_BIT11 FIELD32(0x00000800) -#define AUX_OPT_BIT12 FIELD32(0x00001000) -#define AUX_OPT_BIT13 FIELD32(0x00002000) -#define AUX_OPT_BIT14 FIELD32(0x00004000) -#define AUX_OPT_BIT15 FIELD32(0x00008000) -#define LDO25_LEVEL FIELD32(0x00030000) -#define LDO25_LARGEA FIELD32(0x00040000) -#define LDO25_FRC_ON FIELD32(0x00080000) -#define CMB_RSV FIELD32(0x00300000) -#define XTAL_RDY FIELD32(0x00400000) -#define PLL_LD FIELD32(0x00800000) -#define LDO_CORE_LEVEL FIELD32(0x0F000000) -#define LDO_BGSEL FIELD32(0x30000000) -#define LDO3_EN FIELD32(0x40000000) -#define LDO0_EN FIELD32(0x80000000) - -/* - * EFUSE_CSR_3290: RT3290 EEPROM - */ -#define EFUSE_CTRL_3290 0x0024 - -/* - * EFUSE_DATA3 of 3290 - */ -#define EFUSE_DATA3_3290 0x0028 - -/* - * EFUSE_DATA2 of 3290 - */ -#define EFUSE_DATA2_3290 0x002c - -/* - * EFUSE_DATA1 of 3290 - */ -#define EFUSE_DATA1_3290 0x0030 - -/* - * EFUSE_DATA0 of 3290 - */ -#define EFUSE_DATA0_3290 0x0034 - -/* - * OSC_CTRL_CFG - * Ring oscillator configuration - */ -#define OSC_CTRL 0x0038 -#define OSC_REF_CYCLE FIELD32(0x00001fff) -#define OSC_RSV FIELD32(0x0000e000) -#define OSC_CAL_CNT FIELD32(0x0fff0000) -#define OSC_CAL_ACK FIELD32(0x10000000) -#define OSC_CLK_32K_VLD FIELD32(0x20000000) -#define OSC_CAL_REQ FIELD32(0x40000000) -#define OSC_ROSC_EN FIELD32(0x80000000) - -/* - * COEX_CFG_0 - */ -#define COEX_CFG0 0x0040 -#define COEX_CFG_ANT FIELD32(0xff000000) -/* - * COEX_CFG_1 - */ -#define COEX_CFG1 0x0044 - -/* - * COEX_CFG_2 - */ -#define COEX_CFG2 0x0048 -#define BT_COEX_CFG1 FIELD32(0xff000000) -#define BT_COEX_CFG0 FIELD32(0x00ff0000) -#define WL_COEX_CFG1 FIELD32(0x0000ff00) -#define WL_COEX_CFG0 FIELD32(0x000000ff) -/* - * PLL_CTRL_CFG - * PLL configuration register - */ -#define PLL_CTRL 0x0050 -#define PLL_RESERVED_INPUT1 FIELD32(0x000000ff) -#define PLL_RESERVED_INPUT2 FIELD32(0x0000ff00) -#define PLL_CONTROL FIELD32(0x00070000) -#define PLL_LPF_R1 FIELD32(0x00080000) -#define PLL_LPF_C1_CTRL FIELD32(0x00300000) -#define PLL_LPF_C2_CTRL FIELD32(0x00c00000) -#define PLL_CP_CURRENT_CTRL FIELD32(0x03000000) -#define PLL_PFD_DELAY_CTRL FIELD32(0x0c000000) -#define PLL_LOCK_CTRL FIELD32(0x70000000) -#define PLL_VBGBK_EN FIELD32(0x80000000) - - -/* - * WLAN_CTRL_CFG - * RT3290 wlan configuration - */ -#define WLAN_FUN_CTRL 0x0080 -#define WLAN_EN FIELD32(0x00000001) -#define WLAN_CLK_EN FIELD32(0x00000002) -#define WLAN_RSV1 FIELD32(0x00000004) -#define WLAN_RESET FIELD32(0x00000008) -#define PCIE_APP0_CLK_REQ FIELD32(0x00000010) -#define FRC_WL_ANT_SET FIELD32(0x00000020) -#define INV_TR_SW0 FIELD32(0x00000040) -#define WLAN_GPIO_IN_BIT0 FIELD32(0x00000100) -#define WLAN_GPIO_IN_BIT1 FIELD32(0x00000200) -#define WLAN_GPIO_IN_BIT2 FIELD32(0x00000400) -#define WLAN_GPIO_IN_BIT3 FIELD32(0x00000800) -#define WLAN_GPIO_IN_BIT4 FIELD32(0x00001000) -#define WLAN_GPIO_IN_BIT5 FIELD32(0x00002000) -#define WLAN_GPIO_IN_BIT6 FIELD32(0x00004000) -#define WLAN_GPIO_IN_BIT7 FIELD32(0x00008000) -#define WLAN_GPIO_IN_BIT_ALL FIELD32(0x0000ff00) -#define WLAN_GPIO_OUT_BIT0 FIELD32(0x00010000) -#define WLAN_GPIO_OUT_BIT1 FIELD32(0x00020000) -#define WLAN_GPIO_OUT_BIT2 FIELD32(0x00040000) -#define WLAN_GPIO_OUT_BIT3 FIELD32(0x00050000) -#define WLAN_GPIO_OUT_BIT4 FIELD32(0x00100000) -#define WLAN_GPIO_OUT_BIT5 FIELD32(0x00200000) -#define WLAN_GPIO_OUT_BIT6 FIELD32(0x00400000) -#define WLAN_GPIO_OUT_BIT7 FIELD32(0x00800000) -#define WLAN_GPIO_OUT_BIT_ALL FIELD32(0x00ff0000) -#define WLAN_GPIO_OUT_OE_BIT0 FIELD32(0x01000000) -#define WLAN_GPIO_OUT_OE_BIT1 FIELD32(0x02000000) -#define WLAN_GPIO_OUT_OE_BIT2 FIELD32(0x04000000) -#define WLAN_GPIO_OUT_OE_BIT3 FIELD32(0x08000000) -#define WLAN_GPIO_OUT_OE_BIT4 FIELD32(0x10000000) -#define WLAN_GPIO_OUT_OE_BIT5 FIELD32(0x20000000) -#define WLAN_GPIO_OUT_OE_BIT6 FIELD32(0x40000000) -#define WLAN_GPIO_OUT_OE_BIT7 FIELD32(0x80000000) -#define WLAN_GPIO_OUT_OE_BIT_ALL FIELD32(0xff000000) - -/* - * AUX_CTRL: Aux/PCI-E related configuration - */ -#define AUX_CTRL 0x10c -#define AUX_CTRL_WAKE_PCIE_EN FIELD32(0x00000002) -#define AUX_CTRL_FORCE_PCIE_CLK FIELD32(0x00000400) - -/* - * OPT_14: Unknown register used by rt3xxx devices. - */ -#define OPT_14_CSR 0x0114 -#define OPT_14_CSR_BIT0 FIELD32(0x00000001) - -/* - * INT_SOURCE_CSR: Interrupt source register. - * Write one to clear corresponding bit. - * TX_FIFO_STATUS: FIFO Statistics is full, sw should read TX_STA_FIFO - */ -#define INT_SOURCE_CSR 0x0200 -#define INT_SOURCE_CSR_RXDELAYINT FIELD32(0x00000001) -#define INT_SOURCE_CSR_TXDELAYINT FIELD32(0x00000002) -#define INT_SOURCE_CSR_RX_DONE FIELD32(0x00000004) -#define INT_SOURCE_CSR_AC0_DMA_DONE FIELD32(0x00000008) -#define INT_SOURCE_CSR_AC1_DMA_DONE FIELD32(0x00000010) -#define INT_SOURCE_CSR_AC2_DMA_DONE FIELD32(0x00000020) -#define INT_SOURCE_CSR_AC3_DMA_DONE FIELD32(0x00000040) -#define INT_SOURCE_CSR_HCCA_DMA_DONE FIELD32(0x00000080) -#define INT_SOURCE_CSR_MGMT_DMA_DONE FIELD32(0x00000100) -#define INT_SOURCE_CSR_MCU_COMMAND FIELD32(0x00000200) -#define INT_SOURCE_CSR_RXTX_COHERENT FIELD32(0x00000400) -#define INT_SOURCE_CSR_TBTT FIELD32(0x00000800) -#define INT_SOURCE_CSR_PRE_TBTT FIELD32(0x00001000) -#define INT_SOURCE_CSR_TX_FIFO_STATUS FIELD32(0x00002000) -#define INT_SOURCE_CSR_AUTO_WAKEUP FIELD32(0x00004000) -#define INT_SOURCE_CSR_GPTIMER FIELD32(0x00008000) -#define INT_SOURCE_CSR_RX_COHERENT FIELD32(0x00010000) -#define INT_SOURCE_CSR_TX_COHERENT FIELD32(0x00020000) - -/* - * INT_MASK_CSR: Interrupt MASK register. 1: the interrupt is mask OFF. - */ -#define INT_MASK_CSR 0x0204 -#define INT_MASK_CSR_RXDELAYINT FIELD32(0x00000001) -#define INT_MASK_CSR_TXDELAYINT FIELD32(0x00000002) -#define INT_MASK_CSR_RX_DONE FIELD32(0x00000004) -#define INT_MASK_CSR_AC0_DMA_DONE FIELD32(0x00000008) -#define INT_MASK_CSR_AC1_DMA_DONE FIELD32(0x00000010) -#define INT_MASK_CSR_AC2_DMA_DONE FIELD32(0x00000020) -#define INT_MASK_CSR_AC3_DMA_DONE FIELD32(0x00000040) -#define INT_MASK_CSR_HCCA_DMA_DONE FIELD32(0x00000080) -#define INT_MASK_CSR_MGMT_DMA_DONE FIELD32(0x00000100) -#define INT_MASK_CSR_MCU_COMMAND FIELD32(0x00000200) -#define INT_MASK_CSR_RXTX_COHERENT FIELD32(0x00000400) -#define INT_MASK_CSR_TBTT FIELD32(0x00000800) -#define INT_MASK_CSR_PRE_TBTT FIELD32(0x00001000) -#define INT_MASK_CSR_TX_FIFO_STATUS FIELD32(0x00002000) -#define INT_MASK_CSR_AUTO_WAKEUP FIELD32(0x00004000) -#define INT_MASK_CSR_GPTIMER FIELD32(0x00008000) -#define INT_MASK_CSR_RX_COHERENT FIELD32(0x00010000) -#define INT_MASK_CSR_TX_COHERENT FIELD32(0x00020000) - -/* - * WPDMA_GLO_CFG - */ -#define WPDMA_GLO_CFG 0x0208 -#define WPDMA_GLO_CFG_ENABLE_TX_DMA FIELD32(0x00000001) -#define WPDMA_GLO_CFG_TX_DMA_BUSY FIELD32(0x00000002) -#define WPDMA_GLO_CFG_ENABLE_RX_DMA FIELD32(0x00000004) -#define WPDMA_GLO_CFG_RX_DMA_BUSY FIELD32(0x00000008) -#define WPDMA_GLO_CFG_WP_DMA_BURST_SIZE FIELD32(0x00000030) -#define WPDMA_GLO_CFG_TX_WRITEBACK_DONE FIELD32(0x00000040) -#define WPDMA_GLO_CFG_BIG_ENDIAN FIELD32(0x00000080) -#define WPDMA_GLO_CFG_RX_HDR_SCATTER FIELD32(0x0000ff00) -#define WPDMA_GLO_CFG_HDR_SEG_LEN FIELD32(0xffff0000) - -/* - * WPDMA_RST_IDX - */ -#define WPDMA_RST_IDX 0x020c -#define WPDMA_RST_IDX_DTX_IDX0 FIELD32(0x00000001) -#define WPDMA_RST_IDX_DTX_IDX1 FIELD32(0x00000002) -#define WPDMA_RST_IDX_DTX_IDX2 FIELD32(0x00000004) -#define WPDMA_RST_IDX_DTX_IDX3 FIELD32(0x00000008) -#define WPDMA_RST_IDX_DTX_IDX4 FIELD32(0x00000010) -#define WPDMA_RST_IDX_DTX_IDX5 FIELD32(0x00000020) -#define WPDMA_RST_IDX_DRX_IDX0 FIELD32(0x00010000) - -/* - * DELAY_INT_CFG - */ -#define DELAY_INT_CFG 0x0210 -#define DELAY_INT_CFG_RXMAX_PTIME FIELD32(0x000000ff) -#define DELAY_INT_CFG_RXMAX_PINT FIELD32(0x00007f00) -#define DELAY_INT_CFG_RXDLY_INT_EN FIELD32(0x00008000) -#define DELAY_INT_CFG_TXMAX_PTIME FIELD32(0x00ff0000) -#define DELAY_INT_CFG_TXMAX_PINT FIELD32(0x7f000000) -#define DELAY_INT_CFG_TXDLY_INT_EN FIELD32(0x80000000) - -/* - * WMM_AIFSN_CFG: Aifsn for each EDCA AC - * AIFSN0: AC_VO - * AIFSN1: AC_VI - * AIFSN2: AC_BE - * AIFSN3: AC_BK - */ -#define WMM_AIFSN_CFG 0x0214 -#define WMM_AIFSN_CFG_AIFSN0 FIELD32(0x0000000f) -#define WMM_AIFSN_CFG_AIFSN1 FIELD32(0x000000f0) -#define WMM_AIFSN_CFG_AIFSN2 FIELD32(0x00000f00) -#define WMM_AIFSN_CFG_AIFSN3 FIELD32(0x0000f000) - -/* - * WMM_CWMIN_CSR: CWmin for each EDCA AC - * CWMIN0: AC_VO - * CWMIN1: AC_VI - * CWMIN2: AC_BE - * CWMIN3: AC_BK - */ -#define WMM_CWMIN_CFG 0x0218 -#define WMM_CWMIN_CFG_CWMIN0 FIELD32(0x0000000f) -#define WMM_CWMIN_CFG_CWMIN1 FIELD32(0x000000f0) -#define WMM_CWMIN_CFG_CWMIN2 FIELD32(0x00000f00) -#define WMM_CWMIN_CFG_CWMIN3 FIELD32(0x0000f000) - -/* - * WMM_CWMAX_CSR: CWmax for each EDCA AC - * CWMAX0: AC_VO - * CWMAX1: AC_VI - * CWMAX2: AC_BE - * CWMAX3: AC_BK - */ -#define WMM_CWMAX_CFG 0x021c -#define WMM_CWMAX_CFG_CWMAX0 FIELD32(0x0000000f) -#define WMM_CWMAX_CFG_CWMAX1 FIELD32(0x000000f0) -#define WMM_CWMAX_CFG_CWMAX2 FIELD32(0x00000f00) -#define WMM_CWMAX_CFG_CWMAX3 FIELD32(0x0000f000) - -/* - * AC_TXOP0: AC_VO/AC_VI TXOP register - * AC0TXOP: AC_VO in unit of 32us - * AC1TXOP: AC_VI in unit of 32us - */ -#define WMM_TXOP0_CFG 0x0220 -#define WMM_TXOP0_CFG_AC0TXOP FIELD32(0x0000ffff) -#define WMM_TXOP0_CFG_AC1TXOP FIELD32(0xffff0000) - -/* - * AC_TXOP1: AC_BE/AC_BK TXOP register - * AC2TXOP: AC_BE in unit of 32us - * AC3TXOP: AC_BK in unit of 32us - */ -#define WMM_TXOP1_CFG 0x0224 -#define WMM_TXOP1_CFG_AC2TXOP FIELD32(0x0000ffff) -#define WMM_TXOP1_CFG_AC3TXOP FIELD32(0xffff0000) - -/* - * GPIO_CTRL: - * GPIO_CTRL_VALx: GPIO value - * GPIO_CTRL_DIRx: GPIO direction: 0 = output; 1 = input - */ -#define GPIO_CTRL 0x0228 -#define GPIO_CTRL_VAL0 FIELD32(0x00000001) -#define GPIO_CTRL_VAL1 FIELD32(0x00000002) -#define GPIO_CTRL_VAL2 FIELD32(0x00000004) -#define GPIO_CTRL_VAL3 FIELD32(0x00000008) -#define GPIO_CTRL_VAL4 FIELD32(0x00000010) -#define GPIO_CTRL_VAL5 FIELD32(0x00000020) -#define GPIO_CTRL_VAL6 FIELD32(0x00000040) -#define GPIO_CTRL_VAL7 FIELD32(0x00000080) -#define GPIO_CTRL_DIR0 FIELD32(0x00000100) -#define GPIO_CTRL_DIR1 FIELD32(0x00000200) -#define GPIO_CTRL_DIR2 FIELD32(0x00000400) -#define GPIO_CTRL_DIR3 FIELD32(0x00000800) -#define GPIO_CTRL_DIR4 FIELD32(0x00001000) -#define GPIO_CTRL_DIR5 FIELD32(0x00002000) -#define GPIO_CTRL_DIR6 FIELD32(0x00004000) -#define GPIO_CTRL_DIR7 FIELD32(0x00008000) -#define GPIO_CTRL_VAL8 FIELD32(0x00010000) -#define GPIO_CTRL_VAL9 FIELD32(0x00020000) -#define GPIO_CTRL_VAL10 FIELD32(0x00040000) -#define GPIO_CTRL_DIR8 FIELD32(0x01000000) -#define GPIO_CTRL_DIR9 FIELD32(0x02000000) -#define GPIO_CTRL_DIR10 FIELD32(0x04000000) - -/* - * MCU_CMD_CFG - */ -#define MCU_CMD_CFG 0x022c - -/* - * AC_VO register offsets - */ -#define TX_BASE_PTR0 0x0230 -#define TX_MAX_CNT0 0x0234 -#define TX_CTX_IDX0 0x0238 -#define TX_DTX_IDX0 0x023c - -/* - * AC_VI register offsets - */ -#define TX_BASE_PTR1 0x0240 -#define TX_MAX_CNT1 0x0244 -#define TX_CTX_IDX1 0x0248 -#define TX_DTX_IDX1 0x024c - -/* - * AC_BE register offsets - */ -#define TX_BASE_PTR2 0x0250 -#define TX_MAX_CNT2 0x0254 -#define TX_CTX_IDX2 0x0258 -#define TX_DTX_IDX2 0x025c - -/* - * AC_BK register offsets - */ -#define TX_BASE_PTR3 0x0260 -#define TX_MAX_CNT3 0x0264 -#define TX_CTX_IDX3 0x0268 -#define TX_DTX_IDX3 0x026c - -/* - * HCCA register offsets - */ -#define TX_BASE_PTR4 0x0270 -#define TX_MAX_CNT4 0x0274 -#define TX_CTX_IDX4 0x0278 -#define TX_DTX_IDX4 0x027c - -/* - * MGMT register offsets - */ -#define TX_BASE_PTR5 0x0280 -#define TX_MAX_CNT5 0x0284 -#define TX_CTX_IDX5 0x0288 -#define TX_DTX_IDX5 0x028c - -/* - * RX register offsets - */ -#define RX_BASE_PTR 0x0290 -#define RX_MAX_CNT 0x0294 -#define RX_CRX_IDX 0x0298 -#define RX_DRX_IDX 0x029c - -/* - * USB_DMA_CFG - * RX_BULK_AGG_TIMEOUT: Rx Bulk Aggregation TimeOut in unit of 33ns. - * RX_BULK_AGG_LIMIT: Rx Bulk Aggregation Limit in unit of 256 bytes. - * PHY_CLEAR: phy watch dog enable. - * TX_CLEAR: Clear USB DMA TX path. - * TXOP_HALT: Halt TXOP count down when TX buffer is full. - * RX_BULK_AGG_EN: Enable Rx Bulk Aggregation. - * RX_BULK_EN: Enable USB DMA Rx. - * TX_BULK_EN: Enable USB DMA Tx. - * EP_OUT_VALID: OUT endpoint data valid. - * RX_BUSY: USB DMA RX FSM busy. - * TX_BUSY: USB DMA TX FSM busy. - */ -#define USB_DMA_CFG 0x02a0 -#define USB_DMA_CFG_RX_BULK_AGG_TIMEOUT FIELD32(0x000000ff) -#define USB_DMA_CFG_RX_BULK_AGG_LIMIT FIELD32(0x0000ff00) -#define USB_DMA_CFG_PHY_CLEAR FIELD32(0x00010000) -#define USB_DMA_CFG_TX_CLEAR FIELD32(0x00080000) -#define USB_DMA_CFG_TXOP_HALT FIELD32(0x00100000) -#define USB_DMA_CFG_RX_BULK_AGG_EN FIELD32(0x00200000) -#define USB_DMA_CFG_RX_BULK_EN FIELD32(0x00400000) -#define USB_DMA_CFG_TX_BULK_EN FIELD32(0x00800000) -#define USB_DMA_CFG_EP_OUT_VALID FIELD32(0x3f000000) -#define USB_DMA_CFG_RX_BUSY FIELD32(0x40000000) -#define USB_DMA_CFG_TX_BUSY FIELD32(0x80000000) - -/* - * US_CYC_CNT - * BT_MODE_EN: Bluetooth mode enable - * CLOCK CYCLE: Clock cycle count in 1us. - * PCI:0x21, PCIE:0x7d, USB:0x1e - */ -#define US_CYC_CNT 0x02a4 -#define US_CYC_CNT_BT_MODE_EN FIELD32(0x00000100) -#define US_CYC_CNT_CLOCK_CYCLE FIELD32(0x000000ff) - -/* - * PBF_SYS_CTRL - * HOST_RAM_WRITE: enable Host program ram write selection - */ -#define PBF_SYS_CTRL 0x0400 -#define PBF_SYS_CTRL_READY FIELD32(0x00000080) -#define PBF_SYS_CTRL_HOST_RAM_WRITE FIELD32(0x00010000) - -/* - * HOST-MCU shared memory - */ -#define HOST_CMD_CSR 0x0404 -#define HOST_CMD_CSR_HOST_COMMAND FIELD32(0x000000ff) - -/* - * PBF registers - * Most are for debug. Driver doesn't touch PBF register. - */ -#define PBF_CFG 0x0408 -#define PBF_MAX_PCNT 0x040c -#define PBF_CTRL 0x0410 -#define PBF_INT_STA 0x0414 -#define PBF_INT_ENA 0x0418 - -/* - * BCN_OFFSET0: - */ -#define BCN_OFFSET0 0x042c -#define BCN_OFFSET0_BCN0 FIELD32(0x000000ff) -#define BCN_OFFSET0_BCN1 FIELD32(0x0000ff00) -#define BCN_OFFSET0_BCN2 FIELD32(0x00ff0000) -#define BCN_OFFSET0_BCN3 FIELD32(0xff000000) - -/* - * BCN_OFFSET1: - */ -#define BCN_OFFSET1 0x0430 -#define BCN_OFFSET1_BCN4 FIELD32(0x000000ff) -#define BCN_OFFSET1_BCN5 FIELD32(0x0000ff00) -#define BCN_OFFSET1_BCN6 FIELD32(0x00ff0000) -#define BCN_OFFSET1_BCN7 FIELD32(0xff000000) - -/* - * TXRXQ_PCNT: PBF register - * PCNT_TX0Q: Page count for TX hardware queue 0 - * PCNT_TX1Q: Page count for TX hardware queue 1 - * PCNT_TX2Q: Page count for TX hardware queue 2 - * PCNT_RX0Q: Page count for RX hardware queue - */ -#define TXRXQ_PCNT 0x0438 -#define TXRXQ_PCNT_TX0Q FIELD32(0x000000ff) -#define TXRXQ_PCNT_TX1Q FIELD32(0x0000ff00) -#define TXRXQ_PCNT_TX2Q FIELD32(0x00ff0000) -#define TXRXQ_PCNT_RX0Q FIELD32(0xff000000) - -/* - * PBF register - * Debug. Driver doesn't touch PBF register. - */ -#define PBF_DBG 0x043c - -/* - * RF registers - */ -#define RF_CSR_CFG 0x0500 -#define RF_CSR_CFG_DATA FIELD32(0x000000ff) -#define RF_CSR_CFG_REGNUM FIELD32(0x00003f00) -#define RF_CSR_CFG_WRITE FIELD32(0x00010000) -#define RF_CSR_CFG_BUSY FIELD32(0x00020000) - -/* - * EFUSE_CSR: RT30x0 EEPROM - */ -#define EFUSE_CTRL 0x0580 -#define EFUSE_CTRL_ADDRESS_IN FIELD32(0x03fe0000) -#define EFUSE_CTRL_MODE FIELD32(0x000000c0) -#define EFUSE_CTRL_KICK FIELD32(0x40000000) -#define EFUSE_CTRL_PRESENT FIELD32(0x80000000) - -/* - * EFUSE_DATA0 - */ -#define EFUSE_DATA0 0x0590 - -/* - * EFUSE_DATA1 - */ -#define EFUSE_DATA1 0x0594 - -/* - * EFUSE_DATA2 - */ -#define EFUSE_DATA2 0x0598 - -/* - * EFUSE_DATA3 - */ -#define EFUSE_DATA3 0x059c - -/* - * LDO_CFG0 - */ -#define LDO_CFG0 0x05d4 -#define LDO_CFG0_DELAY3 FIELD32(0x000000ff) -#define LDO_CFG0_DELAY2 FIELD32(0x0000ff00) -#define LDO_CFG0_DELAY1 FIELD32(0x00ff0000) -#define LDO_CFG0_BGSEL FIELD32(0x03000000) -#define LDO_CFG0_LDO_CORE_VLEVEL FIELD32(0x1c000000) -#define LD0_CFG0_LDO25_LEVEL FIELD32(0x60000000) -#define LDO_CFG0_LDO25_LARGEA FIELD32(0x80000000) - -/* - * GPIO_SWITCH - */ -#define GPIO_SWITCH 0x05dc -#define GPIO_SWITCH_0 FIELD32(0x00000001) -#define GPIO_SWITCH_1 FIELD32(0x00000002) -#define GPIO_SWITCH_2 FIELD32(0x00000004) -#define GPIO_SWITCH_3 FIELD32(0x00000008) -#define GPIO_SWITCH_4 FIELD32(0x00000010) -#define GPIO_SWITCH_5 FIELD32(0x00000020) -#define GPIO_SWITCH_6 FIELD32(0x00000040) -#define GPIO_SWITCH_7 FIELD32(0x00000080) - -/* - * FIXME: where the DEBUG_INDEX name come from? - */ -#define MAC_DEBUG_INDEX 0x05e8 -#define MAC_DEBUG_INDEX_XTAL FIELD32(0x80000000) - -/* - * MAC Control/Status Registers(CSR). - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * MAC_CSR0: ASIC revision number. - * ASIC_REV: 0 - * ASIC_VER: 2860 or 2870 - */ -#define MAC_CSR0 0x1000 -#define MAC_CSR0_REVISION FIELD32(0x0000ffff) -#define MAC_CSR0_CHIPSET FIELD32(0xffff0000) - -/* - * MAC_SYS_CTRL: - */ -#define MAC_SYS_CTRL 0x1004 -#define MAC_SYS_CTRL_RESET_CSR FIELD32(0x00000001) -#define MAC_SYS_CTRL_RESET_BBP FIELD32(0x00000002) -#define MAC_SYS_CTRL_ENABLE_TX FIELD32(0x00000004) -#define MAC_SYS_CTRL_ENABLE_RX FIELD32(0x00000008) -#define MAC_SYS_CTRL_CONTINUOUS_TX FIELD32(0x00000010) -#define MAC_SYS_CTRL_LOOPBACK FIELD32(0x00000020) -#define MAC_SYS_CTRL_WLAN_HALT FIELD32(0x00000040) -#define MAC_SYS_CTRL_RX_TIMESTAMP FIELD32(0x00000080) - -/* - * MAC_ADDR_DW0: STA MAC register 0 - */ -#define MAC_ADDR_DW0 0x1008 -#define MAC_ADDR_DW0_BYTE0 FIELD32(0x000000ff) -#define MAC_ADDR_DW0_BYTE1 FIELD32(0x0000ff00) -#define MAC_ADDR_DW0_BYTE2 FIELD32(0x00ff0000) -#define MAC_ADDR_DW0_BYTE3 FIELD32(0xff000000) - -/* - * MAC_ADDR_DW1: STA MAC register 1 - * UNICAST_TO_ME_MASK: - * Used to mask off bits from byte 5 of the MAC address - * to determine the UNICAST_TO_ME bit for RX frames. - * The full mask is complemented by BSS_ID_MASK: - * MASK = BSS_ID_MASK & UNICAST_TO_ME_MASK - */ -#define MAC_ADDR_DW1 0x100c -#define MAC_ADDR_DW1_BYTE4 FIELD32(0x000000ff) -#define MAC_ADDR_DW1_BYTE5 FIELD32(0x0000ff00) -#define MAC_ADDR_DW1_UNICAST_TO_ME_MASK FIELD32(0x00ff0000) - -/* - * MAC_BSSID_DW0: BSSID register 0 - */ -#define MAC_BSSID_DW0 0x1010 -#define MAC_BSSID_DW0_BYTE0 FIELD32(0x000000ff) -#define MAC_BSSID_DW0_BYTE1 FIELD32(0x0000ff00) -#define MAC_BSSID_DW0_BYTE2 FIELD32(0x00ff0000) -#define MAC_BSSID_DW0_BYTE3 FIELD32(0xff000000) - -/* - * MAC_BSSID_DW1: BSSID register 1 - * BSS_ID_MASK: - * 0: 1-BSSID mode (BSS index = 0) - * 1: 2-BSSID mode (BSS index: Byte5, bit 0) - * 2: 4-BSSID mode (BSS index: byte5, bit 0 - 1) - * 3: 8-BSSID mode (BSS index: byte5, bit 0 - 2) - * This mask is used to mask off bits 0, 1 and 2 of byte 5 of the - * BSSID. This will make sure that those bits will be ignored - * when determining the MY_BSS of RX frames. - */ -#define MAC_BSSID_DW1 0x1014 -#define MAC_BSSID_DW1_BYTE4 FIELD32(0x000000ff) -#define MAC_BSSID_DW1_BYTE5 FIELD32(0x0000ff00) -#define MAC_BSSID_DW1_BSS_ID_MASK FIELD32(0x00030000) -#define MAC_BSSID_DW1_BSS_BCN_NUM FIELD32(0x001c0000) - -/* - * MAX_LEN_CFG: Maximum frame length register. - * MAX_MPDU: rt2860b max 16k bytes - * MAX_PSDU: Maximum PSDU length - * (power factor) 0:2^13, 1:2^14, 2:2^15, 3:2^16 - */ -#define MAX_LEN_CFG 0x1018 -#define MAX_LEN_CFG_MAX_MPDU FIELD32(0x00000fff) -#define MAX_LEN_CFG_MAX_PSDU FIELD32(0x00003000) -#define MAX_LEN_CFG_MIN_PSDU FIELD32(0x0000c000) -#define MAX_LEN_CFG_MIN_MPDU FIELD32(0x000f0000) - -/* - * BBP_CSR_CFG: BBP serial control register - * VALUE: Register value to program into BBP - * REG_NUM: Selected BBP register - * READ_CONTROL: 0 write BBP, 1 read BBP - * BUSY: ASIC is busy executing BBP commands - * BBP_PAR_DUR: 0 4 MAC clocks, 1 8 MAC clocks - * BBP_RW_MODE: 0 serial, 1 parallel - */ -#define BBP_CSR_CFG 0x101c -#define BBP_CSR_CFG_VALUE FIELD32(0x000000ff) -#define BBP_CSR_CFG_REGNUM FIELD32(0x0000ff00) -#define BBP_CSR_CFG_READ_CONTROL FIELD32(0x00010000) -#define BBP_CSR_CFG_BUSY FIELD32(0x00020000) -#define BBP_CSR_CFG_BBP_PAR_DUR FIELD32(0x00040000) -#define BBP_CSR_CFG_BBP_RW_MODE FIELD32(0x00080000) - -/* - * RF_CSR_CFG0: RF control register - * REGID_AND_VALUE: Register value to program into RF - * BITWIDTH: Selected RF register - * STANDBYMODE: 0 high when standby, 1 low when standby - * SEL: 0 RF_LE0 activate, 1 RF_LE1 activate - * BUSY: ASIC is busy executing RF commands - */ -#define RF_CSR_CFG0 0x1020 -#define RF_CSR_CFG0_REGID_AND_VALUE FIELD32(0x00ffffff) -#define RF_CSR_CFG0_BITWIDTH FIELD32(0x1f000000) -#define RF_CSR_CFG0_REG_VALUE_BW FIELD32(0x1fffffff) -#define RF_CSR_CFG0_STANDBYMODE FIELD32(0x20000000) -#define RF_CSR_CFG0_SEL FIELD32(0x40000000) -#define RF_CSR_CFG0_BUSY FIELD32(0x80000000) - -/* - * RF_CSR_CFG1: RF control register - * REGID_AND_VALUE: Register value to program into RF - * RFGAP: Gap between BB_CONTROL_RF and RF_LE - * 0: 3 system clock cycle (37.5usec) - * 1: 5 system clock cycle (62.5usec) - */ -#define RF_CSR_CFG1 0x1024 -#define RF_CSR_CFG1_REGID_AND_VALUE FIELD32(0x00ffffff) -#define RF_CSR_CFG1_RFGAP FIELD32(0x1f000000) - -/* - * RF_CSR_CFG2: RF control register - * VALUE: Register value to program into RF - */ -#define RF_CSR_CFG2 0x1028 -#define RF_CSR_CFG2_VALUE FIELD32(0x00ffffff) - -/* - * LED_CFG: LED control - * ON_PERIOD: LED active time (ms) during TX (only used for LED mode 1) - * OFF_PERIOD: LED inactive time (ms) during TX (only used for LED mode 1) - * SLOW_BLINK_PERIOD: LED blink interval in seconds (only used for LED mode 2) - * color LED's: - * 0: off - * 1: blinking upon TX2 - * 2: periodic slow blinking - * 3: always on - * LED polarity: - * 0: active low - * 1: active high - */ -#define LED_CFG 0x102c -#define LED_CFG_ON_PERIOD FIELD32(0x000000ff) -#define LED_CFG_OFF_PERIOD FIELD32(0x0000ff00) -#define LED_CFG_SLOW_BLINK_PERIOD FIELD32(0x003f0000) -#define LED_CFG_R_LED_MODE FIELD32(0x03000000) -#define LED_CFG_G_LED_MODE FIELD32(0x0c000000) -#define LED_CFG_Y_LED_MODE FIELD32(0x30000000) -#define LED_CFG_LED_POLAR FIELD32(0x40000000) - -/* - * AMPDU_BA_WINSIZE: Force BlockAck window size - * FORCE_WINSIZE_ENABLE: - * 0: Disable forcing of BlockAck window size - * 1: Enable forcing of BlockAck window size, overwrites values BlockAck - * window size values in the TXWI - * FORCE_WINSIZE: BlockAck window size - */ -#define AMPDU_BA_WINSIZE 0x1040 -#define AMPDU_BA_WINSIZE_FORCE_WINSIZE_ENABLE FIELD32(0x00000020) -#define AMPDU_BA_WINSIZE_FORCE_WINSIZE FIELD32(0x0000001f) - -/* - * XIFS_TIME_CFG: MAC timing - * CCKM_SIFS_TIME: unit 1us. Applied after CCK RX/TX - * OFDM_SIFS_TIME: unit 1us. Applied after OFDM RX/TX - * OFDM_XIFS_TIME: unit 1us. Applied after OFDM RX - * when MAC doesn't reference BBP signal BBRXEND - * EIFS: unit 1us - * BB_RXEND_ENABLE: reference RXEND signal to begin XIFS defer - * - */ -#define XIFS_TIME_CFG 0x1100 -#define XIFS_TIME_CFG_CCKM_SIFS_TIME FIELD32(0x000000ff) -#define XIFS_TIME_CFG_OFDM_SIFS_TIME FIELD32(0x0000ff00) -#define XIFS_TIME_CFG_OFDM_XIFS_TIME FIELD32(0x000f0000) -#define XIFS_TIME_CFG_EIFS FIELD32(0x1ff00000) -#define XIFS_TIME_CFG_BB_RXEND_ENABLE FIELD32(0x20000000) - -/* - * BKOFF_SLOT_CFG: - */ -#define BKOFF_SLOT_CFG 0x1104 -#define BKOFF_SLOT_CFG_SLOT_TIME FIELD32(0x000000ff) -#define BKOFF_SLOT_CFG_CC_DELAY_TIME FIELD32(0x0000ff00) - -/* - * NAV_TIME_CFG: - */ -#define NAV_TIME_CFG 0x1108 -#define NAV_TIME_CFG_SIFS FIELD32(0x000000ff) -#define NAV_TIME_CFG_SLOT_TIME FIELD32(0x0000ff00) -#define NAV_TIME_CFG_EIFS FIELD32(0x01ff0000) -#define NAV_TIME_ZERO_SIFS FIELD32(0x02000000) - -/* - * CH_TIME_CFG: count as channel busy - * EIFS_BUSY: Count EIFS as channel busy - * NAV_BUSY: Count NAS as channel busy - * RX_BUSY: Count RX as channel busy - * TX_BUSY: Count TX as channel busy - * TMR_EN: Enable channel statistics timer - */ -#define CH_TIME_CFG 0x110c -#define CH_TIME_CFG_EIFS_BUSY FIELD32(0x00000010) -#define CH_TIME_CFG_NAV_BUSY FIELD32(0x00000008) -#define CH_TIME_CFG_RX_BUSY FIELD32(0x00000004) -#define CH_TIME_CFG_TX_BUSY FIELD32(0x00000002) -#define CH_TIME_CFG_TMR_EN FIELD32(0x00000001) - -/* - * PBF_LIFE_TIMER: TX/RX MPDU timestamp timer (free run) Unit: 1us - */ -#define PBF_LIFE_TIMER 0x1110 - -/* - * BCN_TIME_CFG: - * BEACON_INTERVAL: in unit of 1/16 TU - * TSF_TICKING: Enable TSF auto counting - * TSF_SYNC: Enable TSF sync, 00: disable, 01: infra mode, 10: ad-hoc mode - * BEACON_GEN: Enable beacon generator - */ -#define BCN_TIME_CFG 0x1114 -#define BCN_TIME_CFG_BEACON_INTERVAL FIELD32(0x0000ffff) -#define BCN_TIME_CFG_TSF_TICKING FIELD32(0x00010000) -#define BCN_TIME_CFG_TSF_SYNC FIELD32(0x00060000) -#define BCN_TIME_CFG_TBTT_ENABLE FIELD32(0x00080000) -#define BCN_TIME_CFG_BEACON_GEN FIELD32(0x00100000) -#define BCN_TIME_CFG_TX_TIME_COMPENSATE FIELD32(0xf0000000) - -/* - * TBTT_SYNC_CFG: - * BCN_AIFSN: Beacon AIFSN after TBTT interrupt in slots - * BCN_CWMIN: Beacon CWMin after TBTT interrupt in slots - */ -#define TBTT_SYNC_CFG 0x1118 -#define TBTT_SYNC_CFG_TBTT_ADJUST FIELD32(0x000000ff) -#define TBTT_SYNC_CFG_BCN_EXP_WIN FIELD32(0x0000ff00) -#define TBTT_SYNC_CFG_BCN_AIFSN FIELD32(0x000f0000) -#define TBTT_SYNC_CFG_BCN_CWMIN FIELD32(0x00f00000) - -/* - * TSF_TIMER_DW0: Local lsb TSF timer, read-only - */ -#define TSF_TIMER_DW0 0x111c -#define TSF_TIMER_DW0_LOW_WORD FIELD32(0xffffffff) - -/* - * TSF_TIMER_DW1: Local msb TSF timer, read-only - */ -#define TSF_TIMER_DW1 0x1120 -#define TSF_TIMER_DW1_HIGH_WORD FIELD32(0xffffffff) - -/* - * TBTT_TIMER: TImer remains till next TBTT, read-only - */ -#define TBTT_TIMER 0x1124 - -/* - * INT_TIMER_CFG: timer configuration - * PRE_TBTT_TIMER: leadtime to tbtt for pretbtt interrupt in units of 1/16 TU - * GP_TIMER: period of general purpose timer in units of 1/16 TU - */ -#define INT_TIMER_CFG 0x1128 -#define INT_TIMER_CFG_PRE_TBTT_TIMER FIELD32(0x0000ffff) -#define INT_TIMER_CFG_GP_TIMER FIELD32(0xffff0000) - -/* - * INT_TIMER_EN: GP-timer and pre-tbtt Int enable - */ -#define INT_TIMER_EN 0x112c -#define INT_TIMER_EN_PRE_TBTT_TIMER FIELD32(0x00000001) -#define INT_TIMER_EN_GP_TIMER FIELD32(0x00000002) - -/* - * CH_IDLE_STA: channel idle time (in us) - */ -#define CH_IDLE_STA 0x1130 - -/* - * CH_BUSY_STA: channel busy time on primary channel (in us) - */ -#define CH_BUSY_STA 0x1134 - -/* - * CH_BUSY_STA_SEC: channel busy time on secondary channel in HT40 mode (in us) - */ -#define CH_BUSY_STA_SEC 0x1138 - -/* - * MAC_STATUS_CFG: - * BBP_RF_BUSY: When set to 0, BBP and RF are stable. - * if 1 or higher one of the 2 registers is busy. - */ -#define MAC_STATUS_CFG 0x1200 -#define MAC_STATUS_CFG_BBP_RF_BUSY FIELD32(0x00000003) - -/* - * PWR_PIN_CFG: - */ -#define PWR_PIN_CFG 0x1204 - -/* - * AUTOWAKEUP_CFG: Manual power control / status register - * TBCN_BEFORE_WAKE: ForceWake has high privilege than PutToSleep when both set - * AUTOWAKE: 0:sleep, 1:awake - */ -#define AUTOWAKEUP_CFG 0x1208 -#define AUTOWAKEUP_CFG_AUTO_LEAD_TIME FIELD32(0x000000ff) -#define AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE FIELD32(0x00007f00) -#define AUTOWAKEUP_CFG_AUTOWAKE FIELD32(0x00008000) - -/* - * EDCA_AC0_CFG: - */ -#define EDCA_AC0_CFG 0x1300 -#define EDCA_AC0_CFG_TX_OP FIELD32(0x000000ff) -#define EDCA_AC0_CFG_AIFSN FIELD32(0x00000f00) -#define EDCA_AC0_CFG_CWMIN FIELD32(0x0000f000) -#define EDCA_AC0_CFG_CWMAX FIELD32(0x000f0000) - -/* - * EDCA_AC1_CFG: - */ -#define EDCA_AC1_CFG 0x1304 -#define EDCA_AC1_CFG_TX_OP FIELD32(0x000000ff) -#define EDCA_AC1_CFG_AIFSN FIELD32(0x00000f00) -#define EDCA_AC1_CFG_CWMIN FIELD32(0x0000f000) -#define EDCA_AC1_CFG_CWMAX FIELD32(0x000f0000) - -/* - * EDCA_AC2_CFG: - */ -#define EDCA_AC2_CFG 0x1308 -#define EDCA_AC2_CFG_TX_OP FIELD32(0x000000ff) -#define EDCA_AC2_CFG_AIFSN FIELD32(0x00000f00) -#define EDCA_AC2_CFG_CWMIN FIELD32(0x0000f000) -#define EDCA_AC2_CFG_CWMAX FIELD32(0x000f0000) - -/* - * EDCA_AC3_CFG: - */ -#define EDCA_AC3_CFG 0x130c -#define EDCA_AC3_CFG_TX_OP FIELD32(0x000000ff) -#define EDCA_AC3_CFG_AIFSN FIELD32(0x00000f00) -#define EDCA_AC3_CFG_CWMIN FIELD32(0x0000f000) -#define EDCA_AC3_CFG_CWMAX FIELD32(0x000f0000) - -/* - * EDCA_TID_AC_MAP: - */ -#define EDCA_TID_AC_MAP 0x1310 - -/* - * TX_PWR_CFG: - */ -#define TX_PWR_CFG_RATE0 FIELD32(0x0000000f) -#define TX_PWR_CFG_RATE1 FIELD32(0x000000f0) -#define TX_PWR_CFG_RATE2 FIELD32(0x00000f00) -#define TX_PWR_CFG_RATE3 FIELD32(0x0000f000) -#define TX_PWR_CFG_RATE4 FIELD32(0x000f0000) -#define TX_PWR_CFG_RATE5 FIELD32(0x00f00000) -#define TX_PWR_CFG_RATE6 FIELD32(0x0f000000) -#define TX_PWR_CFG_RATE7 FIELD32(0xf0000000) - -/* - * TX_PWR_CFG_0: - */ -#define TX_PWR_CFG_0 0x1314 -#define TX_PWR_CFG_0_1MBS FIELD32(0x0000000f) -#define TX_PWR_CFG_0_2MBS FIELD32(0x000000f0) -#define TX_PWR_CFG_0_55MBS FIELD32(0x00000f00) -#define TX_PWR_CFG_0_11MBS FIELD32(0x0000f000) -#define TX_PWR_CFG_0_6MBS FIELD32(0x000f0000) -#define TX_PWR_CFG_0_9MBS FIELD32(0x00f00000) -#define TX_PWR_CFG_0_12MBS FIELD32(0x0f000000) -#define TX_PWR_CFG_0_18MBS FIELD32(0xf0000000) - -/* - * TX_PWR_CFG_1: - */ -#define TX_PWR_CFG_1 0x1318 -#define TX_PWR_CFG_1_24MBS FIELD32(0x0000000f) -#define TX_PWR_CFG_1_36MBS FIELD32(0x000000f0) -#define TX_PWR_CFG_1_48MBS FIELD32(0x00000f00) -#define TX_PWR_CFG_1_54MBS FIELD32(0x0000f000) -#define TX_PWR_CFG_1_MCS0 FIELD32(0x000f0000) -#define TX_PWR_CFG_1_MCS1 FIELD32(0x00f00000) -#define TX_PWR_CFG_1_MCS2 FIELD32(0x0f000000) -#define TX_PWR_CFG_1_MCS3 FIELD32(0xf0000000) - -/* - * TX_PWR_CFG_2: - */ -#define TX_PWR_CFG_2 0x131c -#define TX_PWR_CFG_2_MCS4 FIELD32(0x0000000f) -#define TX_PWR_CFG_2_MCS5 FIELD32(0x000000f0) -#define TX_PWR_CFG_2_MCS6 FIELD32(0x00000f00) -#define TX_PWR_CFG_2_MCS7 FIELD32(0x0000f000) -#define TX_PWR_CFG_2_MCS8 FIELD32(0x000f0000) -#define TX_PWR_CFG_2_MCS9 FIELD32(0x00f00000) -#define TX_PWR_CFG_2_MCS10 FIELD32(0x0f000000) -#define TX_PWR_CFG_2_MCS11 FIELD32(0xf0000000) - -/* - * TX_PWR_CFG_3: - */ -#define TX_PWR_CFG_3 0x1320 -#define TX_PWR_CFG_3_MCS12 FIELD32(0x0000000f) -#define TX_PWR_CFG_3_MCS13 FIELD32(0x000000f0) -#define TX_PWR_CFG_3_MCS14 FIELD32(0x00000f00) -#define TX_PWR_CFG_3_MCS15 FIELD32(0x0000f000) -#define TX_PWR_CFG_3_UKNOWN1 FIELD32(0x000f0000) -#define TX_PWR_CFG_3_UKNOWN2 FIELD32(0x00f00000) -#define TX_PWR_CFG_3_UKNOWN3 FIELD32(0x0f000000) -#define TX_PWR_CFG_3_UKNOWN4 FIELD32(0xf0000000) - -/* - * TX_PWR_CFG_4: - */ -#define TX_PWR_CFG_4 0x1324 -#define TX_PWR_CFG_4_UKNOWN5 FIELD32(0x0000000f) -#define TX_PWR_CFG_4_UKNOWN6 FIELD32(0x000000f0) -#define TX_PWR_CFG_4_UKNOWN7 FIELD32(0x00000f00) -#define TX_PWR_CFG_4_UKNOWN8 FIELD32(0x0000f000) - -/* - * TX_PIN_CFG: - */ -#define TX_PIN_CFG 0x1328 -#define TX_PIN_CFG_PA_PE_DISABLE 0xfcfffff0 -#define TX_PIN_CFG_PA_PE_A0_EN FIELD32(0x00000001) -#define TX_PIN_CFG_PA_PE_G0_EN FIELD32(0x00000002) -#define TX_PIN_CFG_PA_PE_A1_EN FIELD32(0x00000004) -#define TX_PIN_CFG_PA_PE_G1_EN FIELD32(0x00000008) -#define TX_PIN_CFG_PA_PE_A0_POL FIELD32(0x00000010) -#define TX_PIN_CFG_PA_PE_G0_POL FIELD32(0x00000020) -#define TX_PIN_CFG_PA_PE_A1_POL FIELD32(0x00000040) -#define TX_PIN_CFG_PA_PE_G1_POL FIELD32(0x00000080) -#define TX_PIN_CFG_LNA_PE_A0_EN FIELD32(0x00000100) -#define TX_PIN_CFG_LNA_PE_G0_EN FIELD32(0x00000200) -#define TX_PIN_CFG_LNA_PE_A1_EN FIELD32(0x00000400) -#define TX_PIN_CFG_LNA_PE_G1_EN FIELD32(0x00000800) -#define TX_PIN_CFG_LNA_PE_A0_POL FIELD32(0x00001000) -#define TX_PIN_CFG_LNA_PE_G0_POL FIELD32(0x00002000) -#define TX_PIN_CFG_LNA_PE_A1_POL FIELD32(0x00004000) -#define TX_PIN_CFG_LNA_PE_G1_POL FIELD32(0x00008000) -#define TX_PIN_CFG_RFTR_EN FIELD32(0x00010000) -#define TX_PIN_CFG_RFTR_POL FIELD32(0x00020000) -#define TX_PIN_CFG_TRSW_EN FIELD32(0x00040000) -#define TX_PIN_CFG_TRSW_POL FIELD32(0x00080000) -#define TX_PIN_CFG_PA_PE_A2_EN FIELD32(0x01000000) -#define TX_PIN_CFG_PA_PE_G2_EN FIELD32(0x02000000) -#define TX_PIN_CFG_PA_PE_A2_POL FIELD32(0x04000000) -#define TX_PIN_CFG_PA_PE_G2_POL FIELD32(0x08000000) -#define TX_PIN_CFG_LNA_PE_A2_EN FIELD32(0x10000000) -#define TX_PIN_CFG_LNA_PE_G2_EN FIELD32(0x20000000) -#define TX_PIN_CFG_LNA_PE_A2_POL FIELD32(0x40000000) -#define TX_PIN_CFG_LNA_PE_G2_POL FIELD32(0x80000000) - -/* - * TX_BAND_CFG: 0x1 use upper 20MHz, 0x0 use lower 20MHz - */ -#define TX_BAND_CFG 0x132c -#define TX_BAND_CFG_HT40_MINUS FIELD32(0x00000001) -#define TX_BAND_CFG_A FIELD32(0x00000002) -#define TX_BAND_CFG_BG FIELD32(0x00000004) - -/* - * TX_SW_CFG0: - */ -#define TX_SW_CFG0 0x1330 - -/* - * TX_SW_CFG1: - */ -#define TX_SW_CFG1 0x1334 - -/* - * TX_SW_CFG2: - */ -#define TX_SW_CFG2 0x1338 - -/* - * TXOP_THRES_CFG: - */ -#define TXOP_THRES_CFG 0x133c - -/* - * TXOP_CTRL_CFG: - * TIMEOUT_TRUN_EN: Enable/Disable TXOP timeout truncation - * AC_TRUN_EN: Enable/Disable truncation for AC change - * TXRATEGRP_TRUN_EN: Enable/Disable truncation for TX rate group change - * USER_MODE_TRUN_EN: Enable/Disable truncation for user TXOP mode - * MIMO_PS_TRUN_EN: Enable/Disable truncation for MIMO PS RTS/CTS - * RESERVED_TRUN_EN: Reserved - * LSIG_TXOP_EN: Enable/Disable L-SIG TXOP protection - * EXT_CCA_EN: Enable/Disable extension channel CCA reference (Defer 40Mhz - * transmissions if extension CCA is clear). - * EXT_CCA_DLY: Extension CCA signal delay time (unit: us) - * EXT_CWMIN: CwMin for extension channel backoff - * 0: Disabled - * - */ -#define TXOP_CTRL_CFG 0x1340 -#define TXOP_CTRL_CFG_TIMEOUT_TRUN_EN FIELD32(0x00000001) -#define TXOP_CTRL_CFG_AC_TRUN_EN FIELD32(0x00000002) -#define TXOP_CTRL_CFG_TXRATEGRP_TRUN_EN FIELD32(0x00000004) -#define TXOP_CTRL_CFG_USER_MODE_TRUN_EN FIELD32(0x00000008) -#define TXOP_CTRL_CFG_MIMO_PS_TRUN_EN FIELD32(0x00000010) -#define TXOP_CTRL_CFG_RESERVED_TRUN_EN FIELD32(0x00000020) -#define TXOP_CTRL_CFG_LSIG_TXOP_EN FIELD32(0x00000040) -#define TXOP_CTRL_CFG_EXT_CCA_EN FIELD32(0x00000080) -#define TXOP_CTRL_CFG_EXT_CCA_DLY FIELD32(0x0000ff00) -#define TXOP_CTRL_CFG_EXT_CWMIN FIELD32(0x000f0000) - -/* - * TX_RTS_CFG: - * RTS_THRES: unit:byte - * RTS_FBK_EN: enable rts rate fallback - */ -#define TX_RTS_CFG 0x1344 -#define TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT FIELD32(0x000000ff) -#define TX_RTS_CFG_RTS_THRES FIELD32(0x00ffff00) -#define TX_RTS_CFG_RTS_FBK_EN FIELD32(0x01000000) - -/* - * TX_TIMEOUT_CFG: - * MPDU_LIFETIME: expiration time = 2^(9+MPDU LIFE TIME) us - * RX_ACK_TIMEOUT: unit:slot. Used for TX procedure - * TX_OP_TIMEOUT: TXOP timeout value for TXOP truncation. - * it is recommended that: - * (SLOT_TIME) > (TX_OP_TIMEOUT) > (RX_ACK_TIMEOUT) - */ -#define TX_TIMEOUT_CFG 0x1348 -#define TX_TIMEOUT_CFG_MPDU_LIFETIME FIELD32(0x000000f0) -#define TX_TIMEOUT_CFG_RX_ACK_TIMEOUT FIELD32(0x0000ff00) -#define TX_TIMEOUT_CFG_TX_OP_TIMEOUT FIELD32(0x00ff0000) - -/* - * TX_RTY_CFG: - * SHORT_RTY_LIMIT: short retry limit - * LONG_RTY_LIMIT: long retry limit - * LONG_RTY_THRE: Long retry threshoold - * NON_AGG_RTY_MODE: Non-Aggregate MPDU retry mode - * 0:expired by retry limit, 1: expired by mpdu life timer - * AGG_RTY_MODE: Aggregate MPDU retry mode - * 0:expired by retry limit, 1: expired by mpdu life timer - * TX_AUTO_FB_ENABLE: Tx retry PHY rate auto fallback enable - */ -#define TX_RTY_CFG 0x134c -#define TX_RTY_CFG_SHORT_RTY_LIMIT FIELD32(0x000000ff) -#define TX_RTY_CFG_LONG_RTY_LIMIT FIELD32(0x0000ff00) -#define TX_RTY_CFG_LONG_RTY_THRE FIELD32(0x0fff0000) -#define TX_RTY_CFG_NON_AGG_RTY_MODE FIELD32(0x10000000) -#define TX_RTY_CFG_AGG_RTY_MODE FIELD32(0x20000000) -#define TX_RTY_CFG_TX_AUTO_FB_ENABLE FIELD32(0x40000000) - -/* - * TX_LINK_CFG: - * REMOTE_MFB_LIFETIME: remote MFB life time. unit: 32us - * MFB_ENABLE: TX apply remote MFB 1:enable - * REMOTE_UMFS_ENABLE: remote unsolicit MFB enable - * 0: not apply remote remote unsolicit (MFS=7) - * TX_MRQ_EN: MCS request TX enable - * TX_RDG_EN: RDG TX enable - * TX_CF_ACK_EN: Piggyback CF-ACK enable - * REMOTE_MFB: remote MCS feedback - * REMOTE_MFS: remote MCS feedback sequence number - */ -#define TX_LINK_CFG 0x1350 -#define TX_LINK_CFG_REMOTE_MFB_LIFETIME FIELD32(0x000000ff) -#define TX_LINK_CFG_MFB_ENABLE FIELD32(0x00000100) -#define TX_LINK_CFG_REMOTE_UMFS_ENABLE FIELD32(0x00000200) -#define TX_LINK_CFG_TX_MRQ_EN FIELD32(0x00000400) -#define TX_LINK_CFG_TX_RDG_EN FIELD32(0x00000800) -#define TX_LINK_CFG_TX_CF_ACK_EN FIELD32(0x00001000) -#define TX_LINK_CFG_REMOTE_MFB FIELD32(0x00ff0000) -#define TX_LINK_CFG_REMOTE_MFS FIELD32(0xff000000) - -/* - * HT_FBK_CFG0: - */ -#define HT_FBK_CFG0 0x1354 -#define HT_FBK_CFG0_HTMCS0FBK FIELD32(0x0000000f) -#define HT_FBK_CFG0_HTMCS1FBK FIELD32(0x000000f0) -#define HT_FBK_CFG0_HTMCS2FBK FIELD32(0x00000f00) -#define HT_FBK_CFG0_HTMCS3FBK FIELD32(0x0000f000) -#define HT_FBK_CFG0_HTMCS4FBK FIELD32(0x000f0000) -#define HT_FBK_CFG0_HTMCS5FBK FIELD32(0x00f00000) -#define HT_FBK_CFG0_HTMCS6FBK FIELD32(0x0f000000) -#define HT_FBK_CFG0_HTMCS7FBK FIELD32(0xf0000000) - -/* - * HT_FBK_CFG1: - */ -#define HT_FBK_CFG1 0x1358 -#define HT_FBK_CFG1_HTMCS8FBK FIELD32(0x0000000f) -#define HT_FBK_CFG1_HTMCS9FBK FIELD32(0x000000f0) -#define HT_FBK_CFG1_HTMCS10FBK FIELD32(0x00000f00) -#define HT_FBK_CFG1_HTMCS11FBK FIELD32(0x0000f000) -#define HT_FBK_CFG1_HTMCS12FBK FIELD32(0x000f0000) -#define HT_FBK_CFG1_HTMCS13FBK FIELD32(0x00f00000) -#define HT_FBK_CFG1_HTMCS14FBK FIELD32(0x0f000000) -#define HT_FBK_CFG1_HTMCS15FBK FIELD32(0xf0000000) - -/* - * LG_FBK_CFG0: - */ -#define LG_FBK_CFG0 0x135c -#define LG_FBK_CFG0_OFDMMCS0FBK FIELD32(0x0000000f) -#define LG_FBK_CFG0_OFDMMCS1FBK FIELD32(0x000000f0) -#define LG_FBK_CFG0_OFDMMCS2FBK FIELD32(0x00000f00) -#define LG_FBK_CFG0_OFDMMCS3FBK FIELD32(0x0000f000) -#define LG_FBK_CFG0_OFDMMCS4FBK FIELD32(0x000f0000) -#define LG_FBK_CFG0_OFDMMCS5FBK FIELD32(0x00f00000) -#define LG_FBK_CFG0_OFDMMCS6FBK FIELD32(0x0f000000) -#define LG_FBK_CFG0_OFDMMCS7FBK FIELD32(0xf0000000) - -/* - * LG_FBK_CFG1: - */ -#define LG_FBK_CFG1 0x1360 -#define LG_FBK_CFG0_CCKMCS0FBK FIELD32(0x0000000f) -#define LG_FBK_CFG0_CCKMCS1FBK FIELD32(0x000000f0) -#define LG_FBK_CFG0_CCKMCS2FBK FIELD32(0x00000f00) -#define LG_FBK_CFG0_CCKMCS3FBK FIELD32(0x0000f000) - -/* - * CCK_PROT_CFG: CCK Protection - * PROTECT_RATE: Protection control frame rate for CCK TX(RTS/CTS/CFEnd) - * PROTECT_CTRL: Protection control frame type for CCK TX - * 0:none, 1:RTS/CTS, 2:CTS-to-self - * PROTECT_NAV_SHORT: TXOP protection type for CCK TX with short NAV - * PROTECT_NAV_LONG: TXOP protection type for CCK TX with long NAV - * TX_OP_ALLOW_CCK: CCK TXOP allowance, 0:disallow - * TX_OP_ALLOW_OFDM: CCK TXOP allowance, 0:disallow - * TX_OP_ALLOW_MM20: CCK TXOP allowance, 0:disallow - * TX_OP_ALLOW_MM40: CCK TXOP allowance, 0:disallow - * TX_OP_ALLOW_GF20: CCK TXOP allowance, 0:disallow - * TX_OP_ALLOW_GF40: CCK TXOP allowance, 0:disallow - * RTS_TH_EN: RTS threshold enable on CCK TX - */ -#define CCK_PROT_CFG 0x1364 -#define CCK_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff) -#define CCK_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000) -#define CCK_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000) -#define CCK_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000) -#define CCK_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000) -#define CCK_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000) -#define CCK_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000) -#define CCK_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000) -#define CCK_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000) -#define CCK_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000) -#define CCK_PROT_CFG_RTS_TH_EN FIELD32(0x04000000) - -/* - * OFDM_PROT_CFG: OFDM Protection - */ -#define OFDM_PROT_CFG 0x1368 -#define OFDM_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff) -#define OFDM_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000) -#define OFDM_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000) -#define OFDM_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000) -#define OFDM_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000) -#define OFDM_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000) -#define OFDM_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000) -#define OFDM_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000) -#define OFDM_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000) -#define OFDM_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000) -#define OFDM_PROT_CFG_RTS_TH_EN FIELD32(0x04000000) - -/* - * MM20_PROT_CFG: MM20 Protection - */ -#define MM20_PROT_CFG 0x136c -#define MM20_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff) -#define MM20_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000) -#define MM20_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000) -#define MM20_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000) -#define MM20_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000) -#define MM20_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000) -#define MM20_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000) -#define MM20_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000) -#define MM20_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000) -#define MM20_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000) -#define MM20_PROT_CFG_RTS_TH_EN FIELD32(0x04000000) - -/* - * MM40_PROT_CFG: MM40 Protection - */ -#define MM40_PROT_CFG 0x1370 -#define MM40_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff) -#define MM40_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000) -#define MM40_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000) -#define MM40_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000) -#define MM40_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000) -#define MM40_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000) -#define MM40_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000) -#define MM40_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000) -#define MM40_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000) -#define MM40_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000) -#define MM40_PROT_CFG_RTS_TH_EN FIELD32(0x04000000) - -/* - * GF20_PROT_CFG: GF20 Protection - */ -#define GF20_PROT_CFG 0x1374 -#define GF20_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff) -#define GF20_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000) -#define GF20_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000) -#define GF20_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000) -#define GF20_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000) -#define GF20_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000) -#define GF20_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000) -#define GF20_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000) -#define GF20_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000) -#define GF20_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000) -#define GF20_PROT_CFG_RTS_TH_EN FIELD32(0x04000000) - -/* - * GF40_PROT_CFG: GF40 Protection - */ -#define GF40_PROT_CFG 0x1378 -#define GF40_PROT_CFG_PROTECT_RATE FIELD32(0x0000ffff) -#define GF40_PROT_CFG_PROTECT_CTRL FIELD32(0x00030000) -#define GF40_PROT_CFG_PROTECT_NAV_SHORT FIELD32(0x00040000) -#define GF40_PROT_CFG_PROTECT_NAV_LONG FIELD32(0x00080000) -#define GF40_PROT_CFG_TX_OP_ALLOW_CCK FIELD32(0x00100000) -#define GF40_PROT_CFG_TX_OP_ALLOW_OFDM FIELD32(0x00200000) -#define GF40_PROT_CFG_TX_OP_ALLOW_MM20 FIELD32(0x00400000) -#define GF40_PROT_CFG_TX_OP_ALLOW_MM40 FIELD32(0x00800000) -#define GF40_PROT_CFG_TX_OP_ALLOW_GF20 FIELD32(0x01000000) -#define GF40_PROT_CFG_TX_OP_ALLOW_GF40 FIELD32(0x02000000) -#define GF40_PROT_CFG_RTS_TH_EN FIELD32(0x04000000) - -/* - * EXP_CTS_TIME: - */ -#define EXP_CTS_TIME 0x137c - -/* - * EXP_ACK_TIME: - */ -#define EXP_ACK_TIME 0x1380 - -/* - * RX_FILTER_CFG: RX configuration register. - */ -#define RX_FILTER_CFG 0x1400 -#define RX_FILTER_CFG_DROP_CRC_ERROR FIELD32(0x00000001) -#define RX_FILTER_CFG_DROP_PHY_ERROR FIELD32(0x00000002) -#define RX_FILTER_CFG_DROP_NOT_TO_ME FIELD32(0x00000004) -#define RX_FILTER_CFG_DROP_NOT_MY_BSSD FIELD32(0x00000008) -#define RX_FILTER_CFG_DROP_VER_ERROR FIELD32(0x00000010) -#define RX_FILTER_CFG_DROP_MULTICAST FIELD32(0x00000020) -#define RX_FILTER_CFG_DROP_BROADCAST FIELD32(0x00000040) -#define RX_FILTER_CFG_DROP_DUPLICATE FIELD32(0x00000080) -#define RX_FILTER_CFG_DROP_CF_END_ACK FIELD32(0x00000100) -#define RX_FILTER_CFG_DROP_CF_END FIELD32(0x00000200) -#define RX_FILTER_CFG_DROP_ACK FIELD32(0x00000400) -#define RX_FILTER_CFG_DROP_CTS FIELD32(0x00000800) -#define RX_FILTER_CFG_DROP_RTS FIELD32(0x00001000) -#define RX_FILTER_CFG_DROP_PSPOLL FIELD32(0x00002000) -#define RX_FILTER_CFG_DROP_BA FIELD32(0x00004000) -#define RX_FILTER_CFG_DROP_BAR FIELD32(0x00008000) -#define RX_FILTER_CFG_DROP_CNTL FIELD32(0x00010000) - -/* - * AUTO_RSP_CFG: - * AUTORESPONDER: 0: disable, 1: enable - * BAC_ACK_POLICY: 0:long, 1:short preamble - * CTS_40_MMODE: Response CTS 40MHz duplicate mode - * CTS_40_MREF: Response CTS 40MHz duplicate mode - * AR_PREAMBLE: Auto responder preamble 0:long, 1:short preamble - * DUAL_CTS_EN: Power bit value in control frame - * ACK_CTS_PSM_BIT:Power bit value in control frame - */ -#define AUTO_RSP_CFG 0x1404 -#define AUTO_RSP_CFG_AUTORESPONDER FIELD32(0x00000001) -#define AUTO_RSP_CFG_BAC_ACK_POLICY FIELD32(0x00000002) -#define AUTO_RSP_CFG_CTS_40_MMODE FIELD32(0x00000004) -#define AUTO_RSP_CFG_CTS_40_MREF FIELD32(0x00000008) -#define AUTO_RSP_CFG_AR_PREAMBLE FIELD32(0x00000010) -#define AUTO_RSP_CFG_DUAL_CTS_EN FIELD32(0x00000040) -#define AUTO_RSP_CFG_ACK_CTS_PSM_BIT FIELD32(0x00000080) - -/* - * LEGACY_BASIC_RATE: - */ -#define LEGACY_BASIC_RATE 0x1408 - -/* - * HT_BASIC_RATE: - */ -#define HT_BASIC_RATE 0x140c - -/* - * HT_CTRL_CFG: - */ -#define HT_CTRL_CFG 0x1410 - -/* - * SIFS_COST_CFG: - */ -#define SIFS_COST_CFG 0x1414 - -/* - * RX_PARSER_CFG: - * Set NAV for all received frames - */ -#define RX_PARSER_CFG 0x1418 - -/* - * TX_SEC_CNT0: - */ -#define TX_SEC_CNT0 0x1500 - -/* - * RX_SEC_CNT0: - */ -#define RX_SEC_CNT0 0x1504 - -/* - * CCMP_FC_MUTE: - */ -#define CCMP_FC_MUTE 0x1508 - -/* - * TXOP_HLDR_ADDR0: - */ -#define TXOP_HLDR_ADDR0 0x1600 - -/* - * TXOP_HLDR_ADDR1: - */ -#define TXOP_HLDR_ADDR1 0x1604 - -/* - * TXOP_HLDR_ET: - */ -#define TXOP_HLDR_ET 0x1608 - -/* - * QOS_CFPOLL_RA_DW0: - */ -#define QOS_CFPOLL_RA_DW0 0x160c - -/* - * QOS_CFPOLL_RA_DW1: - */ -#define QOS_CFPOLL_RA_DW1 0x1610 - -/* - * QOS_CFPOLL_QC: - */ -#define QOS_CFPOLL_QC 0x1614 - -/* - * RX_STA_CNT0: RX PLCP error count & RX CRC error count - */ -#define RX_STA_CNT0 0x1700 -#define RX_STA_CNT0_CRC_ERR FIELD32(0x0000ffff) -#define RX_STA_CNT0_PHY_ERR FIELD32(0xffff0000) - -/* - * RX_STA_CNT1: RX False CCA count & RX LONG frame count - */ -#define RX_STA_CNT1 0x1704 -#define RX_STA_CNT1_FALSE_CCA FIELD32(0x0000ffff) -#define RX_STA_CNT1_PLCP_ERR FIELD32(0xffff0000) - -/* - * RX_STA_CNT2: - */ -#define RX_STA_CNT2 0x1708 -#define RX_STA_CNT2_RX_DUPLI_COUNT FIELD32(0x0000ffff) -#define RX_STA_CNT2_RX_FIFO_OVERFLOW FIELD32(0xffff0000) - -/* - * TX_STA_CNT0: TX Beacon count - */ -#define TX_STA_CNT0 0x170c -#define TX_STA_CNT0_TX_FAIL_COUNT FIELD32(0x0000ffff) -#define TX_STA_CNT0_TX_BEACON_COUNT FIELD32(0xffff0000) - -/* - * TX_STA_CNT1: TX tx count - */ -#define TX_STA_CNT1 0x1710 -#define TX_STA_CNT1_TX_SUCCESS FIELD32(0x0000ffff) -#define TX_STA_CNT1_TX_RETRANSMIT FIELD32(0xffff0000) - -/* - * TX_STA_CNT2: TX tx count - */ -#define TX_STA_CNT2 0x1714 -#define TX_STA_CNT2_TX_ZERO_LEN_COUNT FIELD32(0x0000ffff) -#define TX_STA_CNT2_TX_UNDER_FLOW_COUNT FIELD32(0xffff0000) - -/* - * TX_STA_FIFO: TX Result for specific PID status fifo register. - * - * This register is implemented as FIFO with 16 entries in the HW. Each - * register read fetches the next tx result. If the FIFO is full because - * it wasn't read fast enough after the according interrupt (TX_FIFO_STATUS) - * triggered, the hw seems to simply drop further tx results. - * - * VALID: 1: this tx result is valid - * 0: no valid tx result -> driver should stop reading - * PID_TYPE: The PID latched from the PID field in the TXWI, can be used - * to match a frame with its tx result (even though the PID is - * only 4 bits wide). - * PID_QUEUE: Part of PID_TYPE, this is the queue index number (0-3) - * PID_ENTRY: Part of PID_TYPE, this is the queue entry index number (1-3) - * This identification number is calculated by ((idx % 3) + 1). - * TX_SUCCESS: Indicates tx success (1) or failure (0) - * TX_AGGRE: Indicates if the frame was part of an aggregate (1) or not (0) - * TX_ACK_REQUIRED: Indicates if the frame needed to get ack'ed (1) or not (0) - * WCID: The wireless client ID. - * MCS: The tx rate used during the last transmission of this frame, be it - * successful or not. - * PHYMODE: The phymode used for the transmission. - */ -#define TX_STA_FIFO 0x1718 -#define TX_STA_FIFO_VALID FIELD32(0x00000001) -#define TX_STA_FIFO_PID_TYPE FIELD32(0x0000001e) -#define TX_STA_FIFO_PID_QUEUE FIELD32(0x00000006) -#define TX_STA_FIFO_PID_ENTRY FIELD32(0x00000018) -#define TX_STA_FIFO_TX_SUCCESS FIELD32(0x00000020) -#define TX_STA_FIFO_TX_AGGRE FIELD32(0x00000040) -#define TX_STA_FIFO_TX_ACK_REQUIRED FIELD32(0x00000080) -#define TX_STA_FIFO_WCID FIELD32(0x0000ff00) -#define TX_STA_FIFO_SUCCESS_RATE FIELD32(0xffff0000) -#define TX_STA_FIFO_MCS FIELD32(0x007f0000) -#define TX_STA_FIFO_PHYMODE FIELD32(0xc0000000) - -/* - * TX_AGG_CNT: Debug counter - */ -#define TX_AGG_CNT 0x171c -#define TX_AGG_CNT_NON_AGG_TX_COUNT FIELD32(0x0000ffff) -#define TX_AGG_CNT_AGG_TX_COUNT FIELD32(0xffff0000) - -/* - * TX_AGG_CNT0: - */ -#define TX_AGG_CNT0 0x1720 -#define TX_AGG_CNT0_AGG_SIZE_1_COUNT FIELD32(0x0000ffff) -#define TX_AGG_CNT0_AGG_SIZE_2_COUNT FIELD32(0xffff0000) - -/* - * TX_AGG_CNT1: - */ -#define TX_AGG_CNT1 0x1724 -#define TX_AGG_CNT1_AGG_SIZE_3_COUNT FIELD32(0x0000ffff) -#define TX_AGG_CNT1_AGG_SIZE_4_COUNT FIELD32(0xffff0000) - -/* - * TX_AGG_CNT2: - */ -#define TX_AGG_CNT2 0x1728 -#define TX_AGG_CNT2_AGG_SIZE_5_COUNT FIELD32(0x0000ffff) -#define TX_AGG_CNT2_AGG_SIZE_6_COUNT FIELD32(0xffff0000) - -/* - * TX_AGG_CNT3: - */ -#define TX_AGG_CNT3 0x172c -#define TX_AGG_CNT3_AGG_SIZE_7_COUNT FIELD32(0x0000ffff) -#define TX_AGG_CNT3_AGG_SIZE_8_COUNT FIELD32(0xffff0000) - -/* - * TX_AGG_CNT4: - */ -#define TX_AGG_CNT4 0x1730 -#define TX_AGG_CNT4_AGG_SIZE_9_COUNT FIELD32(0x0000ffff) -#define TX_AGG_CNT4_AGG_SIZE_10_COUNT FIELD32(0xffff0000) - -/* - * TX_AGG_CNT5: - */ -#define TX_AGG_CNT5 0x1734 -#define TX_AGG_CNT5_AGG_SIZE_11_COUNT FIELD32(0x0000ffff) -#define TX_AGG_CNT5_AGG_SIZE_12_COUNT FIELD32(0xffff0000) - -/* - * TX_AGG_CNT6: - */ -#define TX_AGG_CNT6 0x1738 -#define TX_AGG_CNT6_AGG_SIZE_13_COUNT FIELD32(0x0000ffff) -#define TX_AGG_CNT6_AGG_SIZE_14_COUNT FIELD32(0xffff0000) - -/* - * TX_AGG_CNT7: - */ -#define TX_AGG_CNT7 0x173c -#define TX_AGG_CNT7_AGG_SIZE_15_COUNT FIELD32(0x0000ffff) -#define TX_AGG_CNT7_AGG_SIZE_16_COUNT FIELD32(0xffff0000) - -/* - * MPDU_DENSITY_CNT: - * TX_ZERO_DEL: TX zero length delimiter count - * RX_ZERO_DEL: RX zero length delimiter count - */ -#define MPDU_DENSITY_CNT 0x1740 -#define MPDU_DENSITY_CNT_TX_ZERO_DEL FIELD32(0x0000ffff) -#define MPDU_DENSITY_CNT_RX_ZERO_DEL FIELD32(0xffff0000) - -/* - * Security key table memory. - * - * The pairwise key table shares some memory with the beacon frame - * buffers 6 and 7. That basically means that when beacon 6 & 7 - * are used we should only use the reduced pairwise key table which - * has a maximum of 222 entries. - * - * --------------------------------------------- - * |0x4000 | Pairwise Key | Reduced Pairwise | - * | | Table | Key Table | - * | | Size: 256 * 32 | Size: 222 * 32 | - * |0x5BC0 | |------------------- - * | | | Beacon 6 | - * |0x5DC0 | |------------------- - * | | | Beacon 7 | - * |0x5FC0 | |------------------- - * |0x5FFF | | - * -------------------------- - * - * MAC_WCID_BASE: 8-bytes (use only 6 bytes) * 256 entry - * PAIRWISE_KEY_TABLE_BASE: 32-byte * 256 entry - * MAC_IVEIV_TABLE_BASE: 8-byte * 256-entry - * MAC_WCID_ATTRIBUTE_BASE: 4-byte * 256-entry - * SHARED_KEY_TABLE_BASE: 32-byte * 16-entry - * SHARED_KEY_MODE_BASE: 4-byte * 16-entry - */ -#define MAC_WCID_BASE 0x1800 -#define PAIRWISE_KEY_TABLE_BASE 0x4000 -#define MAC_IVEIV_TABLE_BASE 0x6000 -#define MAC_WCID_ATTRIBUTE_BASE 0x6800 -#define SHARED_KEY_TABLE_BASE 0x6c00 -#define SHARED_KEY_MODE_BASE 0x7000 - -#define MAC_WCID_ENTRY(__idx) \ - (MAC_WCID_BASE + ((__idx) * sizeof(struct mac_wcid_entry))) -#define PAIRWISE_KEY_ENTRY(__idx) \ - (PAIRWISE_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry))) -#define MAC_IVEIV_ENTRY(__idx) \ - (MAC_IVEIV_TABLE_BASE + ((__idx) * sizeof(struct mac_iveiv_entry))) -#define MAC_WCID_ATTR_ENTRY(__idx) \ - (MAC_WCID_ATTRIBUTE_BASE + ((__idx) * sizeof(u32))) -#define SHARED_KEY_ENTRY(__idx) \ - (SHARED_KEY_TABLE_BASE + ((__idx) * sizeof(struct hw_key_entry))) -#define SHARED_KEY_MODE_ENTRY(__idx) \ - (SHARED_KEY_MODE_BASE + ((__idx) * sizeof(u32))) - -struct mac_wcid_entry { - u8 mac[6]; - u8 reserved[2]; -} __packed; - -struct hw_key_entry { - u8 key[16]; - u8 tx_mic[8]; - u8 rx_mic[8]; -} __packed; - -struct mac_iveiv_entry { - u8 iv[8]; -} __packed; - -/* - * MAC_WCID_ATTRIBUTE: - */ -#define MAC_WCID_ATTRIBUTE_KEYTAB FIELD32(0x00000001) -#define MAC_WCID_ATTRIBUTE_CIPHER FIELD32(0x0000000e) -#define MAC_WCID_ATTRIBUTE_BSS_IDX FIELD32(0x00000070) -#define MAC_WCID_ATTRIBUTE_RX_WIUDF FIELD32(0x00000380) -#define MAC_WCID_ATTRIBUTE_CIPHER_EXT FIELD32(0x00000400) -#define MAC_WCID_ATTRIBUTE_BSS_IDX_EXT FIELD32(0x00000800) -#define MAC_WCID_ATTRIBUTE_WAPI_MCBC FIELD32(0x00008000) -#define MAC_WCID_ATTRIBUTE_WAPI_KEY_IDX FIELD32(0xff000000) - -/* - * SHARED_KEY_MODE: - */ -#define SHARED_KEY_MODE_BSS0_KEY0 FIELD32(0x00000007) -#define SHARED_KEY_MODE_BSS0_KEY1 FIELD32(0x00000070) -#define SHARED_KEY_MODE_BSS0_KEY2 FIELD32(0x00000700) -#define SHARED_KEY_MODE_BSS0_KEY3 FIELD32(0x00007000) -#define SHARED_KEY_MODE_BSS1_KEY0 FIELD32(0x00070000) -#define SHARED_KEY_MODE_BSS1_KEY1 FIELD32(0x00700000) -#define SHARED_KEY_MODE_BSS1_KEY2 FIELD32(0x07000000) -#define SHARED_KEY_MODE_BSS1_KEY3 FIELD32(0x70000000) - -/* - * HOST-MCU communication - */ - -/* - * H2M_MAILBOX_CSR: Host-to-MCU Mailbox. - * CMD_TOKEN: Command id, 0xff disable status reporting. - */ -#define H2M_MAILBOX_CSR 0x7010 -#define H2M_MAILBOX_CSR_ARG0 FIELD32(0x000000ff) -#define H2M_MAILBOX_CSR_ARG1 FIELD32(0x0000ff00) -#define H2M_MAILBOX_CSR_CMD_TOKEN FIELD32(0x00ff0000) -#define H2M_MAILBOX_CSR_OWNER FIELD32(0xff000000) - -/* - * H2M_MAILBOX_CID: - * Free slots contain 0xff. MCU will store command's token to lowest free slot. - * If all slots are occupied status will be dropped. - */ -#define H2M_MAILBOX_CID 0x7014 -#define H2M_MAILBOX_CID_CMD0 FIELD32(0x000000ff) -#define H2M_MAILBOX_CID_CMD1 FIELD32(0x0000ff00) -#define H2M_MAILBOX_CID_CMD2 FIELD32(0x00ff0000) -#define H2M_MAILBOX_CID_CMD3 FIELD32(0xff000000) - -/* - * H2M_MAILBOX_STATUS: - * Command status will be saved to same slot as command id. - */ -#define H2M_MAILBOX_STATUS 0x701c - -/* - * H2M_INT_SRC: - */ -#define H2M_INT_SRC 0x7024 - -/* - * H2M_BBP_AGENT: - */ -#define H2M_BBP_AGENT 0x7028 - -/* - * MCU_LEDCS: LED control for MCU Mailbox. - */ -#define MCU_LEDCS_LED_MODE FIELD8(0x1f) -#define MCU_LEDCS_POLARITY FIELD8(0x01) - -/* - * HW_CS_CTS_BASE: - * Carrier-sense CTS frame base address. - * It's where mac stores carrier-sense frame for carrier-sense function. - */ -#define HW_CS_CTS_BASE 0x7700 - -/* - * HW_DFS_CTS_BASE: - * DFS CTS frame base address. It's where mac stores CTS frame for DFS. - */ -#define HW_DFS_CTS_BASE 0x7780 - -/* - * TXRX control registers - base address 0x3000 - */ - -/* - * TXRX_CSR1: - * rt2860b UNKNOWN reg use R/O Reg Addr 0x77d0 first.. - */ -#define TXRX_CSR1 0x77d0 - -/* - * HW_DEBUG_SETTING_BASE: - * since NULL frame won't be that long (256 byte) - * We steal 16 tail bytes to save debugging settings - */ -#define HW_DEBUG_SETTING_BASE 0x77f0 -#define HW_DEBUG_SETTING_BASE2 0x7770 - -/* - * HW_BEACON_BASE - * In order to support maximum 8 MBSS and its maximum length - * is 512 bytes for each beacon - * Three section discontinue memory segments will be used. - * 1. The original region for BCN 0~3 - * 2. Extract memory from FCE table for BCN 4~5 - * 3. Extract memory from Pair-wise key table for BCN 6~7 - * It occupied those memory of wcid 238~253 for BCN 6 - * and wcid 222~237 for BCN 7 (see Security key table memory - * for more info). - * - * IMPORTANT NOTE: Not sure why legacy driver does this, - * but HW_BEACON_BASE7 is 0x0200 bytes below HW_BEACON_BASE6. - */ -#define HW_BEACON_BASE0 0x7800 -#define HW_BEACON_BASE1 0x7a00 -#define HW_BEACON_BASE2 0x7c00 -#define HW_BEACON_BASE3 0x7e00 -#define HW_BEACON_BASE4 0x7200 -#define HW_BEACON_BASE5 0x7400 -#define HW_BEACON_BASE6 0x5dc0 -#define HW_BEACON_BASE7 0x5bc0 - -#define HW_BEACON_OFFSET(__index) \ - (((__index) < 4) ? (HW_BEACON_BASE0 + (__index * 0x0200)) : \ - (((__index) < 6) ? (HW_BEACON_BASE4 + ((__index - 4) * 0x0200)) : \ - (HW_BEACON_BASE6 - ((__index - 6) * 0x0200)))) - -/* - * BBP registers. - * The wordsize of the BBP is 8 bits. - */ - -/* - * BBP 1: TX Antenna & Power Control - * POWER_CTRL: - * 0 - normal, - * 1 - drop tx power by 6dBm, - * 2 - drop tx power by 12dBm, - * 3 - increase tx power by 6dBm - */ -#define BBP1_TX_POWER_CTRL FIELD8(0x07) -#define BBP1_TX_ANTENNA FIELD8(0x18) - -/* - * BBP 3: RX Antenna - */ -#define BBP3_RX_ADC FIELD8(0x03) -#define BBP3_RX_ANTENNA FIELD8(0x18) -#define BBP3_HT40_MINUS FIELD8(0x20) -#define BBP3_ADC_MODE_SWITCH FIELD8(0x40) -#define BBP3_ADC_INIT_MODE FIELD8(0x80) - -/* - * BBP 4: Bandwidth - */ -#define BBP4_TX_BF FIELD8(0x01) -#define BBP4_BANDWIDTH FIELD8(0x18) -#define BBP4_MAC_IF_CTRL FIELD8(0x40) - -/* BBP27 */ -#define BBP27_RX_CHAIN_SEL FIELD8(0x60) - -/* - * BBP 47: Bandwidth - */ -#define BBP47_TSSI_REPORT_SEL FIELD8(0x03) -#define BBP47_TSSI_UPDATE_REQ FIELD8(0x04) -#define BBP47_TSSI_TSSI_MODE FIELD8(0x18) -#define BBP47_TSSI_ADC6 FIELD8(0x80) - -/* - * BBP 49 - */ -#define BBP49_UPDATE_FLAG FIELD8(0x01) - -/* - * BBP 105: - * - bit0: detect SIG on primary channel only (on 40MHz bandwidth) - * - bit1: FEQ (Feed Forward Compensation) for independend streams - * - bit2: MLD (Maximum Likehood Detection) for 2 streams (reserved on single - * stream) - * - bit4: channel estimation updates based on remodulation of - * L-SIG and HT-SIG symbols - */ -#define BBP105_DETECT_SIG_ON_PRIMARY FIELD8(0x01) -#define BBP105_FEQ FIELD8(0x02) -#define BBP105_MLD FIELD8(0x04) -#define BBP105_SIG_REMODULATION FIELD8(0x08) - -/* - * BBP 109 - */ -#define BBP109_TX0_POWER FIELD8(0x0f) -#define BBP109_TX1_POWER FIELD8(0xf0) - -/* - * BBP 138: Unknown - */ -#define BBP138_RX_ADC1 FIELD8(0x02) -#define BBP138_RX_ADC2 FIELD8(0x04) -#define BBP138_TX_DAC1 FIELD8(0x20) -#define BBP138_TX_DAC2 FIELD8(0x40) - -/* - * BBP 152: Rx Ant - */ -#define BBP152_RX_DEFAULT_ANT FIELD8(0x80) - -/* - * BBP 254: unknown - */ -#define BBP254_BIT7 FIELD8(0x80) - -/* - * RFCSR registers - * The wordsize of the RFCSR is 8 bits. - */ - -/* - * RFCSR 1: - */ -#define RFCSR1_RF_BLOCK_EN FIELD8(0x01) -#define RFCSR1_PLL_PD FIELD8(0x02) -#define RFCSR1_RX0_PD FIELD8(0x04) -#define RFCSR1_TX0_PD FIELD8(0x08) -#define RFCSR1_RX1_PD FIELD8(0x10) -#define RFCSR1_TX1_PD FIELD8(0x20) -#define RFCSR1_RX2_PD FIELD8(0x40) -#define RFCSR1_TX2_PD FIELD8(0x80) - -/* - * RFCSR 2: - */ -#define RFCSR2_RESCAL_EN FIELD8(0x80) - -/* - * RFCSR 3: - */ -#define RFCSR3_K FIELD8(0x0f) -/* Bits [7-4] for RF3320 (RT3370/RT3390), on other chipsets reserved */ -#define RFCSR3_PA1_BIAS_CCK FIELD8(0x70) -#define RFCSR3_PA2_CASCODE_BIAS_CCKK FIELD8(0x80) -/* Bits for RF3290/RF5360/RF5370/RF5372/RF5390/RF5392 */ -#define RFCSR3_VCOCAL_EN FIELD8(0x80) - -/* - * FRCSR 5: - */ -#define RFCSR5_R1 FIELD8(0x0c) - -/* - * RFCSR 6: - */ -#define RFCSR6_R1 FIELD8(0x03) -#define RFCSR6_R2 FIELD8(0x40) -#define RFCSR6_TXDIV FIELD8(0x0c) - -/* - * RFCSR 7: - */ -#define RFCSR7_RF_TUNING FIELD8(0x01) -#define RFCSR7_BIT1 FIELD8(0x02) -#define RFCSR7_BIT2 FIELD8(0x04) -#define RFCSR7_BIT3 FIELD8(0x08) -#define RFCSR7_BIT4 FIELD8(0x10) -#define RFCSR7_BIT5 FIELD8(0x20) -#define RFCSR7_BITS67 FIELD8(0xc0) - -/* - * RFCSR 9: - */ -#define RFCSR9_K FIELD8(0x0f) -#define RFCSR9_N FIELD8(0x10) -#define RFCSR9_UNKNOWN FIELD8(0x60) -#define RFCSR9_MOD FIELD8(0x80) - -/* - * RFCSR 11: - */ -#define RFCSR11_R FIELD8(0x03) -#define RFCSR11_MOD FIELD8(0xc0) - -/* - * RFCSR 12: - */ -#define RFCSR12_TX_POWER FIELD8(0x1f) -#define RFCSR12_DR0 FIELD8(0xe0) - -/* - * RFCSR 13: - */ -#define RFCSR13_TX_POWER FIELD8(0x1f) -#define RFCSR13_DR0 FIELD8(0xe0) - -/* - * RFCSR 15: - */ -#define RFCSR15_TX_LO2_EN FIELD8(0x08) - -/* - * RFCSR 16: - */ -#define RFCSR16_TXMIXER_GAIN FIELD8(0x07) - -/* - * RFCSR 17: - */ -#define RFCSR17_TXMIXER_GAIN FIELD8(0x07) -#define RFCSR17_TX_LO1_EN FIELD8(0x08) -#define RFCSR17_R FIELD8(0x20) -#define RFCSR17_CODE FIELD8(0x7f) - -/* - * RFCSR 20: - */ -#define RFCSR20_RX_LO1_EN FIELD8(0x08) - -/* - * RFCSR 21: - */ -#define RFCSR21_RX_LO2_EN FIELD8(0x08) - -/* - * RFCSR 22: - */ -#define RFCSR22_BASEBAND_LOOPBACK FIELD8(0x01) - -/* - * RFCSR 23: - */ -#define RFCSR23_FREQ_OFFSET FIELD8(0x7f) - -/* - * RFCSR 24: - */ -#define RFCSR24_TX_AGC_FC FIELD8(0x1f) -#define RFCSR24_TX_H20M FIELD8(0x20) -#define RFCSR24_TX_CALIB FIELD8(0x7f) - -/* - * RFCSR 27: - */ -#define RFCSR27_R1 FIELD8(0x03) -#define RFCSR27_R2 FIELD8(0x04) -#define RFCSR27_R3 FIELD8(0x30) -#define RFCSR27_R4 FIELD8(0x40) - -/* - * RFCSR 29: - */ -#define RFCSR29_ADC6_TEST FIELD8(0x01) -#define RFCSR29_ADC6_INT_TEST FIELD8(0x02) -#define RFCSR29_RSSI_RESET FIELD8(0x04) -#define RFCSR29_RSSI_ON FIELD8(0x08) -#define RFCSR29_RSSI_RIP_CTRL FIELD8(0x30) -#define RFCSR29_RSSI_GAIN FIELD8(0xc0) - -/* - * RFCSR 30: - */ -#define RFCSR30_TX_H20M FIELD8(0x02) -#define RFCSR30_RX_H20M FIELD8(0x04) -#define RFCSR30_RX_VCM FIELD8(0x18) -#define RFCSR30_RF_CALIBRATION FIELD8(0x80) - -/* - * RFCSR 31: - */ -#define RFCSR31_RX_AGC_FC FIELD8(0x1f) -#define RFCSR31_RX_H20M FIELD8(0x20) -#define RFCSR31_RX_CALIB FIELD8(0x7f) - -/* - * RFCSR 38: - */ -#define RFCSR38_RX_LO1_EN FIELD8(0x20) - -/* - * RFCSR 39: - */ -#define RFCSR39_RX_LO2_EN FIELD8(0x80) - -/* - * RFCSR 49: - */ -#define RFCSR49_TX FIELD8(0x3f) -#define RFCSR49_EP FIELD8(0xc0) - -/* - * RFCSR 50: - */ -#define RFCSR50_TX FIELD8(0x3f) -#define RFCSR50_EP FIELD8(0xc0) - -/* - * RF registers - */ - -/* - * RF 2 - */ -#define RF2_ANTENNA_RX2 FIELD32(0x00000040) -#define RF2_ANTENNA_TX1 FIELD32(0x00004000) -#define RF2_ANTENNA_RX1 FIELD32(0x00020000) - -/* - * RF 3 - */ -#define RF3_TXPOWER_G FIELD32(0x00003e00) -#define RF3_TXPOWER_A_7DBM_BOOST FIELD32(0x00000200) -#define RF3_TXPOWER_A FIELD32(0x00003c00) - -/* - * RF 4 - */ -#define RF4_TXPOWER_G FIELD32(0x000007c0) -#define RF4_TXPOWER_A_7DBM_BOOST FIELD32(0x00000040) -#define RF4_TXPOWER_A FIELD32(0x00000780) -#define RF4_FREQ_OFFSET FIELD32(0x001f8000) -#define RF4_HT40 FIELD32(0x00200000) - -/* - * EEPROM content. - * The wordsize of the EEPROM is 16 bits. - */ - -/* - * Chip ID - */ -#define EEPROM_CHIP_ID 0x0000 - -/* - * EEPROM Version - */ -#define EEPROM_VERSION 0x0001 -#define EEPROM_VERSION_FAE FIELD16(0x00ff) -#define EEPROM_VERSION_VERSION FIELD16(0xff00) - -/* - * HW MAC address. - */ -#define EEPROM_MAC_ADDR_0 0x0002 -#define EEPROM_MAC_ADDR_BYTE0 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE1 FIELD16(0xff00) -#define EEPROM_MAC_ADDR_1 0x0003 -#define EEPROM_MAC_ADDR_BYTE2 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE3 FIELD16(0xff00) -#define EEPROM_MAC_ADDR_2 0x0004 -#define EEPROM_MAC_ADDR_BYTE4 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE5 FIELD16(0xff00) - -/* - * EEPROM NIC Configuration 0 - * RXPATH: 1: 1R, 2: 2R, 3: 3R - * TXPATH: 1: 1T, 2: 2T, 3: 3T - * RF_TYPE: RFIC type - */ -#define EEPROM_NIC_CONF0 0x001a -#define EEPROM_NIC_CONF0_RXPATH FIELD16(0x000f) -#define EEPROM_NIC_CONF0_TXPATH FIELD16(0x00f0) -#define EEPROM_NIC_CONF0_RF_TYPE FIELD16(0x0f00) - -/* - * EEPROM NIC Configuration 1 - * HW_RADIO: 0: disable, 1: enable - * EXTERNAL_TX_ALC: 0: disable, 1: enable - * EXTERNAL_LNA_2G: 0: disable, 1: enable - * EXTERNAL_LNA_5G: 0: disable, 1: enable - * CARDBUS_ACCEL: 0: enable, 1: disable - * BW40M_SB_2G: 0: disable, 1: enable - * BW40M_SB_5G: 0: disable, 1: enable - * WPS_PBC: 0: disable, 1: enable - * BW40M_2G: 0: enable, 1: disable - * BW40M_5G: 0: enable, 1: disable - * BROADBAND_EXT_LNA: 0: disable, 1: enable - * ANT_DIVERSITY: 00: Disable, 01: Diversity, - * 10: Main antenna, 11: Aux antenna - * INTERNAL_TX_ALC: 0: disable, 1: enable - * BT_COEXIST: 0: disable, 1: enable - * DAC_TEST: 0: disable, 1: enable - */ -#define EEPROM_NIC_CONF1 0x001b -#define EEPROM_NIC_CONF1_HW_RADIO FIELD16(0x0001) -#define EEPROM_NIC_CONF1_EXTERNAL_TX_ALC FIELD16(0x0002) -#define EEPROM_NIC_CONF1_EXTERNAL_LNA_2G FIELD16(0x0004) -#define EEPROM_NIC_CONF1_EXTERNAL_LNA_5G FIELD16(0x0008) -#define EEPROM_NIC_CONF1_CARDBUS_ACCEL FIELD16(0x0010) -#define EEPROM_NIC_CONF1_BW40M_SB_2G FIELD16(0x0020) -#define EEPROM_NIC_CONF1_BW40M_SB_5G FIELD16(0x0040) -#define EEPROM_NIC_CONF1_WPS_PBC FIELD16(0x0080) -#define EEPROM_NIC_CONF1_BW40M_2G FIELD16(0x0100) -#define EEPROM_NIC_CONF1_BW40M_5G FIELD16(0x0200) -#define EEPROM_NIC_CONF1_BROADBAND_EXT_LNA FIELD16(0x400) -#define EEPROM_NIC_CONF1_ANT_DIVERSITY FIELD16(0x1800) -#define EEPROM_NIC_CONF1_INTERNAL_TX_ALC FIELD16(0x2000) -#define EEPROM_NIC_CONF1_BT_COEXIST FIELD16(0x4000) -#define EEPROM_NIC_CONF1_DAC_TEST FIELD16(0x8000) - -/* - * EEPROM frequency - */ -#define EEPROM_FREQ 0x001d -#define EEPROM_FREQ_OFFSET FIELD16(0x00ff) -#define EEPROM_FREQ_LED_MODE FIELD16(0x7f00) -#define EEPROM_FREQ_LED_POLARITY FIELD16(0x1000) - -/* - * EEPROM LED - * POLARITY_RDY_G: Polarity RDY_G setting. - * POLARITY_RDY_A: Polarity RDY_A setting. - * POLARITY_ACT: Polarity ACT setting. - * POLARITY_GPIO_0: Polarity GPIO0 setting. - * POLARITY_GPIO_1: Polarity GPIO1 setting. - * POLARITY_GPIO_2: Polarity GPIO2 setting. - * POLARITY_GPIO_3: Polarity GPIO3 setting. - * POLARITY_GPIO_4: Polarity GPIO4 setting. - * LED_MODE: Led mode. - */ -#define EEPROM_LED_AG_CONF 0x001e -#define EEPROM_LED_ACT_CONF 0x001f -#define EEPROM_LED_POLARITY 0x0020 -#define EEPROM_LED_POLARITY_RDY_BG FIELD16(0x0001) -#define EEPROM_LED_POLARITY_RDY_A FIELD16(0x0002) -#define EEPROM_LED_POLARITY_ACT FIELD16(0x0004) -#define EEPROM_LED_POLARITY_GPIO_0 FIELD16(0x0008) -#define EEPROM_LED_POLARITY_GPIO_1 FIELD16(0x0010) -#define EEPROM_LED_POLARITY_GPIO_2 FIELD16(0x0020) -#define EEPROM_LED_POLARITY_GPIO_3 FIELD16(0x0040) -#define EEPROM_LED_POLARITY_GPIO_4 FIELD16(0x0080) -#define EEPROM_LED_LED_MODE FIELD16(0x1f00) - -/* - * EEPROM NIC Configuration 2 - * RX_STREAM: 0: Reserved, 1: 1 Stream, 2: 2 Stream - * TX_STREAM: 0: Reserved, 1: 1 Stream, 2: 2 Stream - * CRYSTAL: 00: Reserved, 01: One crystal, 10: Two crystal, 11: Reserved - */ -#define EEPROM_NIC_CONF2 0x0021 -#define EEPROM_NIC_CONF2_RX_STREAM FIELD16(0x000f) -#define EEPROM_NIC_CONF2_TX_STREAM FIELD16(0x00f0) -#define EEPROM_NIC_CONF2_CRYSTAL FIELD16(0x0600) - -/* - * EEPROM LNA - */ -#define EEPROM_LNA 0x0022 -#define EEPROM_LNA_BG FIELD16(0x00ff) -#define EEPROM_LNA_A0 FIELD16(0xff00) - -/* - * EEPROM RSSI BG offset - */ -#define EEPROM_RSSI_BG 0x0023 -#define EEPROM_RSSI_BG_OFFSET0 FIELD16(0x00ff) -#define EEPROM_RSSI_BG_OFFSET1 FIELD16(0xff00) - -/* - * EEPROM RSSI BG2 offset - */ -#define EEPROM_RSSI_BG2 0x0024 -#define EEPROM_RSSI_BG2_OFFSET2 FIELD16(0x00ff) -#define EEPROM_RSSI_BG2_LNA_A1 FIELD16(0xff00) - -/* - * EEPROM TXMIXER GAIN BG offset (note overlaps with EEPROM RSSI BG2). - */ -#define EEPROM_TXMIXER_GAIN_BG 0x0024 -#define EEPROM_TXMIXER_GAIN_BG_VAL FIELD16(0x0007) - -/* - * EEPROM RSSI A offset - */ -#define EEPROM_RSSI_A 0x0025 -#define EEPROM_RSSI_A_OFFSET0 FIELD16(0x00ff) -#define EEPROM_RSSI_A_OFFSET1 FIELD16(0xff00) - -/* - * EEPROM RSSI A2 offset - */ -#define EEPROM_RSSI_A2 0x0026 -#define EEPROM_RSSI_A2_OFFSET2 FIELD16(0x00ff) -#define EEPROM_RSSI_A2_LNA_A2 FIELD16(0xff00) - -/* - * EEPROM TXMIXER GAIN A offset (note overlaps with EEPROM RSSI A2). - */ -#define EEPROM_TXMIXER_GAIN_A 0x0026 -#define EEPROM_TXMIXER_GAIN_A_VAL FIELD16(0x0007) - -/* - * EEPROM EIRP Maximum TX power values(unit: dbm) - */ -#define EEPROM_EIRP_MAX_TX_POWER 0x0027 -#define EEPROM_EIRP_MAX_TX_POWER_2GHZ FIELD16(0x00ff) -#define EEPROM_EIRP_MAX_TX_POWER_5GHZ FIELD16(0xff00) - -/* - * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power. - * This is delta in 40MHZ. - * VALUE: Tx Power dalta value, MAX=4(unit: dbm) - * TYPE: 1: Plus the delta value, 0: minus the delta value - * ENABLE: enable tx power compensation for 40BW - */ -#define EEPROM_TXPOWER_DELTA 0x0028 -#define EEPROM_TXPOWER_DELTA_VALUE_2G FIELD16(0x003f) -#define EEPROM_TXPOWER_DELTA_TYPE_2G FIELD16(0x0040) -#define EEPROM_TXPOWER_DELTA_ENABLE_2G FIELD16(0x0080) -#define EEPROM_TXPOWER_DELTA_VALUE_5G FIELD16(0x3f00) -#define EEPROM_TXPOWER_DELTA_TYPE_5G FIELD16(0x4000) -#define EEPROM_TXPOWER_DELTA_ENABLE_5G FIELD16(0x8000) - -/* - * EEPROM TXPOWER 802.11BG - */ -#define EEPROM_TXPOWER_BG1 0x0029 -#define EEPROM_TXPOWER_BG2 0x0030 -#define EEPROM_TXPOWER_BG_SIZE 7 -#define EEPROM_TXPOWER_BG_1 FIELD16(0x00ff) -#define EEPROM_TXPOWER_BG_2 FIELD16(0xff00) - -/* - * EEPROM temperature compensation boundaries 802.11BG - * MINUS4: If the actual TSSI is below this boundary, tx power needs to be - * reduced by (agc_step * -4) - * MINUS3: If the actual TSSI is below this boundary, tx power needs to be - * reduced by (agc_step * -3) - */ -#define EEPROM_TSSI_BOUND_BG1 0x0037 -#define EEPROM_TSSI_BOUND_BG1_MINUS4 FIELD16(0x00ff) -#define EEPROM_TSSI_BOUND_BG1_MINUS3 FIELD16(0xff00) - -/* - * EEPROM temperature compensation boundaries 802.11BG - * MINUS2: If the actual TSSI is below this boundary, tx power needs to be - * reduced by (agc_step * -2) - * MINUS1: If the actual TSSI is below this boundary, tx power needs to be - * reduced by (agc_step * -1) - */ -#define EEPROM_TSSI_BOUND_BG2 0x0038 -#define EEPROM_TSSI_BOUND_BG2_MINUS2 FIELD16(0x00ff) -#define EEPROM_TSSI_BOUND_BG2_MINUS1 FIELD16(0xff00) - -/* - * EEPROM temperature compensation boundaries 802.11BG - * REF: Reference TSSI value, no tx power changes needed - * PLUS1: If the actual TSSI is above this boundary, tx power needs to be - * increased by (agc_step * 1) - */ -#define EEPROM_TSSI_BOUND_BG3 0x0039 -#define EEPROM_TSSI_BOUND_BG3_REF FIELD16(0x00ff) -#define EEPROM_TSSI_BOUND_BG3_PLUS1 FIELD16(0xff00) - -/* - * EEPROM temperature compensation boundaries 802.11BG - * PLUS2: If the actual TSSI is above this boundary, tx power needs to be - * increased by (agc_step * 2) - * PLUS3: If the actual TSSI is above this boundary, tx power needs to be - * increased by (agc_step * 3) - */ -#define EEPROM_TSSI_BOUND_BG4 0x003a -#define EEPROM_TSSI_BOUND_BG4_PLUS2 FIELD16(0x00ff) -#define EEPROM_TSSI_BOUND_BG4_PLUS3 FIELD16(0xff00) - -/* - * EEPROM temperature compensation boundaries 802.11BG - * PLUS4: If the actual TSSI is above this boundary, tx power needs to be - * increased by (agc_step * 4) - * AGC_STEP: Temperature compensation step. - */ -#define EEPROM_TSSI_BOUND_BG5 0x003b -#define EEPROM_TSSI_BOUND_BG5_PLUS4 FIELD16(0x00ff) -#define EEPROM_TSSI_BOUND_BG5_AGC_STEP FIELD16(0xff00) - -/* - * EEPROM TXPOWER 802.11A - */ -#define EEPROM_TXPOWER_A1 0x003c -#define EEPROM_TXPOWER_A2 0x0053 -#define EEPROM_TXPOWER_A_SIZE 6 -#define EEPROM_TXPOWER_A_1 FIELD16(0x00ff) -#define EEPROM_TXPOWER_A_2 FIELD16(0xff00) - -/* - * EEPROM temperature compensation boundaries 802.11A - * MINUS4: If the actual TSSI is below this boundary, tx power needs to be - * reduced by (agc_step * -4) - * MINUS3: If the actual TSSI is below this boundary, tx power needs to be - * reduced by (agc_step * -3) - */ -#define EEPROM_TSSI_BOUND_A1 0x006a -#define EEPROM_TSSI_BOUND_A1_MINUS4 FIELD16(0x00ff) -#define EEPROM_TSSI_BOUND_A1_MINUS3 FIELD16(0xff00) - -/* - * EEPROM temperature compensation boundaries 802.11A - * MINUS2: If the actual TSSI is below this boundary, tx power needs to be - * reduced by (agc_step * -2) - * MINUS1: If the actual TSSI is below this boundary, tx power needs to be - * reduced by (agc_step * -1) - */ -#define EEPROM_TSSI_BOUND_A2 0x006b -#define EEPROM_TSSI_BOUND_A2_MINUS2 FIELD16(0x00ff) -#define EEPROM_TSSI_BOUND_A2_MINUS1 FIELD16(0xff00) - -/* - * EEPROM temperature compensation boundaries 802.11A - * REF: Reference TSSI value, no tx power changes needed - * PLUS1: If the actual TSSI is above this boundary, tx power needs to be - * increased by (agc_step * 1) - */ -#define EEPROM_TSSI_BOUND_A3 0x006c -#define EEPROM_TSSI_BOUND_A3_REF FIELD16(0x00ff) -#define EEPROM_TSSI_BOUND_A3_PLUS1 FIELD16(0xff00) - -/* - * EEPROM temperature compensation boundaries 802.11A - * PLUS2: If the actual TSSI is above this boundary, tx power needs to be - * increased by (agc_step * 2) - * PLUS3: If the actual TSSI is above this boundary, tx power needs to be - * increased by (agc_step * 3) - */ -#define EEPROM_TSSI_BOUND_A4 0x006d -#define EEPROM_TSSI_BOUND_A4_PLUS2 FIELD16(0x00ff) -#define EEPROM_TSSI_BOUND_A4_PLUS3 FIELD16(0xff00) - -/* - * EEPROM temperature compensation boundaries 802.11A - * PLUS4: If the actual TSSI is above this boundary, tx power needs to be - * increased by (agc_step * 4) - * AGC_STEP: Temperature compensation step. - */ -#define EEPROM_TSSI_BOUND_A5 0x006e -#define EEPROM_TSSI_BOUND_A5_PLUS4 FIELD16(0x00ff) -#define EEPROM_TSSI_BOUND_A5_AGC_STEP FIELD16(0xff00) - -/* - * EEPROM TXPOWER by rate: tx power per tx rate for HT20 mode - */ -#define EEPROM_TXPOWER_BYRATE 0x006f -#define EEPROM_TXPOWER_BYRATE_SIZE 9 - -#define EEPROM_TXPOWER_BYRATE_RATE0 FIELD16(0x000f) -#define EEPROM_TXPOWER_BYRATE_RATE1 FIELD16(0x00f0) -#define EEPROM_TXPOWER_BYRATE_RATE2 FIELD16(0x0f00) -#define EEPROM_TXPOWER_BYRATE_RATE3 FIELD16(0xf000) - -/* - * EEPROM BBP. - */ -#define EEPROM_BBP_START 0x0078 -#define EEPROM_BBP_SIZE 16 -#define EEPROM_BBP_VALUE FIELD16(0x00ff) -#define EEPROM_BBP_REG_ID FIELD16(0xff00) - -/* - * EEPROM IQ Calibration, unlike other entries those are byte addresses. - */ - -#define EEPROM_IQ_GAIN_CAL_TX0_2G 0x130 -#define EEPROM_IQ_PHASE_CAL_TX0_2G 0x131 -#define EEPROM_IQ_GROUPDELAY_CAL_TX0_2G 0x132 -#define EEPROM_IQ_GAIN_CAL_TX1_2G 0x133 -#define EEPROM_IQ_PHASE_CAL_TX1_2G 0x134 -#define EEPROM_IQ_GROUPDELAY_CAL_TX1_2G 0x135 -#define EEPROM_IQ_GAIN_CAL_RX0_2G 0x136 -#define EEPROM_IQ_PHASE_CAL_RX0_2G 0x137 -#define EEPROM_IQ_GROUPDELAY_CAL_RX0_2G 0x138 -#define EEPROM_IQ_GAIN_CAL_RX1_2G 0x139 -#define EEPROM_IQ_PHASE_CAL_RX1_2G 0x13A -#define EEPROM_IQ_GROUPDELAY_CAL_RX1_2G 0x13B -#define EEPROM_RF_IQ_COMPENSATION_CONTROL 0x13C -#define EEPROM_RF_IQ_IMBALANCE_COMPENSATION_CONTROL 0x13D -#define EEPROM_IQ_GAIN_CAL_TX0_CH36_TO_CH64_5G 0x144 -#define EEPROM_IQ_PHASE_CAL_TX0_CH36_TO_CH64_5G 0x145 -#define EEPROM_IQ_GAIN_CAL_TX0_CH100_TO_CH138_5G 0X146 -#define EEPROM_IQ_PHASE_CAL_TX0_CH100_TO_CH138_5G 0x147 -#define EEPROM_IQ_GAIN_CAL_TX0_CH140_TO_CH165_5G 0x148 -#define EEPROM_IQ_PHASE_CAL_TX0_CH140_TO_CH165_5G 0x149 -#define EEPROM_IQ_GAIN_CAL_TX1_CH36_TO_CH64_5G 0x14A -#define EEPROM_IQ_PHASE_CAL_TX1_CH36_TO_CH64_5G 0x14B -#define EEPROM_IQ_GAIN_CAL_TX1_CH100_TO_CH138_5G 0X14C -#define EEPROM_IQ_PHASE_CAL_TX1_CH100_TO_CH138_5G 0x14D -#define EEPROM_IQ_GAIN_CAL_TX1_CH140_TO_CH165_5G 0x14E -#define EEPROM_IQ_PHASE_CAL_TX1_CH140_TO_CH165_5G 0x14F -#define EEPROM_IQ_GROUPDELAY_CAL_TX0_CH36_TO_CH64_5G 0x150 -#define EEPROM_IQ_GROUPDELAY_CAL_TX1_CH36_TO_CH64_5G 0x151 -#define EEPROM_IQ_GROUPDELAY_CAL_TX0_CH100_TO_CH138_5G 0x152 -#define EEPROM_IQ_GROUPDELAY_CAL_TX1_CH100_TO_CH138_5G 0x153 -#define EEPROM_IQ_GROUPDELAY_CAL_TX0_CH140_TO_CH165_5G 0x154 -#define EEPROM_IQ_GROUPDELAY_CAL_TX1_CH140_TO_CH165_5G 0x155 -#define EEPROM_IQ_GAIN_CAL_RX0_CH36_TO_CH64_5G 0x156 -#define EEPROM_IQ_PHASE_CAL_RX0_CH36_TO_CH64_5G 0x157 -#define EEPROM_IQ_GAIN_CAL_RX0_CH100_TO_CH138_5G 0X158 -#define EEPROM_IQ_PHASE_CAL_RX0_CH100_TO_CH138_5G 0x159 -#define EEPROM_IQ_GAIN_CAL_RX0_CH140_TO_CH165_5G 0x15A -#define EEPROM_IQ_PHASE_CAL_RX0_CH140_TO_CH165_5G 0x15B -#define EEPROM_IQ_GAIN_CAL_RX1_CH36_TO_CH64_5G 0x15C -#define EEPROM_IQ_PHASE_CAL_RX1_CH36_TO_CH64_5G 0x15D -#define EEPROM_IQ_GAIN_CAL_RX1_CH100_TO_CH138_5G 0X15E -#define EEPROM_IQ_PHASE_CAL_RX1_CH100_TO_CH138_5G 0x15F -#define EEPROM_IQ_GAIN_CAL_RX1_CH140_TO_CH165_5G 0x160 -#define EEPROM_IQ_PHASE_CAL_RX1_CH140_TO_CH165_5G 0x161 -#define EEPROM_IQ_GROUPDELAY_CAL_RX0_CH36_TO_CH64_5G 0x162 -#define EEPROM_IQ_GROUPDELAY_CAL_RX1_CH36_TO_CH64_5G 0x163 -#define EEPROM_IQ_GROUPDELAY_CAL_RX0_CH100_TO_CH138_5G 0x164 -#define EEPROM_IQ_GROUPDELAY_CAL_RX1_CH100_TO_CH138_5G 0x165 -#define EEPROM_IQ_GROUPDELAY_CAL_RX0_CH140_TO_CH165_5G 0x166 -#define EEPROM_IQ_GROUPDELAY_CAL_RX1_CH140_TO_CH165_5G 0x167 - -/* - * MCU mailbox commands. - * MCU_SLEEP - go to power-save mode. - * arg1: 1: save as much power as possible, 0: save less power. - * status: 1: success, 2: already asleep, - * 3: maybe MAC is busy so can't finish this task. - * MCU_RADIO_OFF - * arg0: 0: do power-saving, NOT turn off radio. - */ -#define MCU_SLEEP 0x30 -#define MCU_WAKEUP 0x31 -#define MCU_RADIO_OFF 0x35 -#define MCU_CURRENT 0x36 -#define MCU_LED 0x50 -#define MCU_LED_STRENGTH 0x51 -#define MCU_LED_AG_CONF 0x52 -#define MCU_LED_ACT_CONF 0x53 -#define MCU_LED_LED_POLARITY 0x54 -#define MCU_RADAR 0x60 -#define MCU_BOOT_SIGNAL 0x72 -#define MCU_ANT_SELECT 0X73 -#define MCU_BBP_SIGNAL 0x80 -#define MCU_POWER_SAVE 0x83 -#define MCU_BAND_SELECT 0x91 - -/* - * MCU mailbox tokens - */ -#define TOKEN_SLEEP 1 -#define TOKEN_RADIO_OFF 2 -#define TOKEN_WAKEUP 3 - - -/* - * DMA descriptor defines. - */ -#define TXWI_DESC_SIZE (4 * sizeof(__le32)) -#define RXWI_DESC_SIZE (4 * sizeof(__le32)) - -#define TXWI_DESC_SIZE_5592 (5 * sizeof(__le32)) -#define RXWI_DESC_SIZE_5592 (6 * sizeof(__le32)) -/* - * TX WI structure - */ - -/* - * Word0 - * FRAG: 1 To inform TKIP engine this is a fragment. - * MIMO_PS: The remote peer is in dynamic MIMO-PS mode - * TX_OP: 0:HT TXOP rule , 1:PIFS TX ,2:Backoff, 3:sifs - * BW: Channel bandwidth 0:20MHz, 1:40 MHz (for legacy rates this will - * duplicate the frame to both channels). - * STBC: 1: STBC support MCS =0-7, 2,3 : RESERVED - * AMPDU: 1: this frame is eligible for AMPDU aggregation, the hw will - * aggregate consecutive frames with the same RA and QoS TID. If - * a frame A with the same RA and QoS TID but AMPDU=0 is queued - * directly after a frame B with AMPDU=1, frame A might still - * get aggregated into the AMPDU started by frame B. So, setting - * AMPDU to 0 does _not_ necessarily mean the frame is sent as - * MPDU, it can still end up in an AMPDU if the previous frame - * was tagged as AMPDU. - */ -#define TXWI_W0_FRAG FIELD32(0x00000001) -#define TXWI_W0_MIMO_PS FIELD32(0x00000002) -#define TXWI_W0_CF_ACK FIELD32(0x00000004) -#define TXWI_W0_TS FIELD32(0x00000008) -#define TXWI_W0_AMPDU FIELD32(0x00000010) -#define TXWI_W0_MPDU_DENSITY FIELD32(0x000000e0) -#define TXWI_W0_TX_OP FIELD32(0x00000300) -#define TXWI_W0_MCS FIELD32(0x007f0000) -#define TXWI_W0_BW FIELD32(0x00800000) -#define TXWI_W0_SHORT_GI FIELD32(0x01000000) -#define TXWI_W0_STBC FIELD32(0x06000000) -#define TXWI_W0_IFS FIELD32(0x08000000) -#define TXWI_W0_PHYMODE FIELD32(0xc0000000) - -/* - * Word1 - * ACK: 0: No Ack needed, 1: Ack needed - * NSEQ: 0: Don't assign hw sequence number, 1: Assign hw sequence number - * BW_WIN_SIZE: BA windows size of the recipient - * WIRELESS_CLI_ID: Client ID for WCID table access - * MPDU_TOTAL_BYTE_COUNT: Length of 802.11 frame - * PACKETID: Will be latched into the TX_STA_FIFO register once the according - * frame was processed. If multiple frames are aggregated together - * (AMPDU==1) the reported tx status will always contain the packet - * id of the first frame. 0: Don't report tx status for this frame. - * PACKETID_QUEUE: Part of PACKETID, This is the queue index (0-3) - * PACKETID_ENTRY: Part of PACKETID, THis is the queue entry index (1-3) - * This identification number is calculated by ((idx % 3) + 1). - * The (+1) is required to prevent PACKETID to become 0. - */ -#define TXWI_W1_ACK FIELD32(0x00000001) -#define TXWI_W1_NSEQ FIELD32(0x00000002) -#define TXWI_W1_BW_WIN_SIZE FIELD32(0x000000fc) -#define TXWI_W1_WIRELESS_CLI_ID FIELD32(0x0000ff00) -#define TXWI_W1_MPDU_TOTAL_BYTE_COUNT FIELD32(0x0fff0000) -#define TXWI_W1_PACKETID FIELD32(0xf0000000) -#define TXWI_W1_PACKETID_QUEUE FIELD32(0x30000000) -#define TXWI_W1_PACKETID_ENTRY FIELD32(0xc0000000) - -/* - * Word2 - */ -#define TXWI_W2_IV FIELD32(0xffffffff) - -/* - * Word3 - */ -#define TXWI_W3_EIV FIELD32(0xffffffff) - -/* - * RX WI structure - */ - -/* - * Word0 - */ -#define RXWI_W0_WIRELESS_CLI_ID FIELD32(0x000000ff) -#define RXWI_W0_KEY_INDEX FIELD32(0x00000300) -#define RXWI_W0_BSSID FIELD32(0x00001c00) -#define RXWI_W0_UDF FIELD32(0x0000e000) -#define RXWI_W0_MPDU_TOTAL_BYTE_COUNT FIELD32(0x0fff0000) -#define RXWI_W0_TID FIELD32(0xf0000000) - -/* - * Word1 - */ -#define RXWI_W1_FRAG FIELD32(0x0000000f) -#define RXWI_W1_SEQUENCE FIELD32(0x0000fff0) -#define RXWI_W1_MCS FIELD32(0x007f0000) -#define RXWI_W1_BW FIELD32(0x00800000) -#define RXWI_W1_SHORT_GI FIELD32(0x01000000) -#define RXWI_W1_STBC FIELD32(0x06000000) -#define RXWI_W1_PHYMODE FIELD32(0xc0000000) - -/* - * Word2 - */ -#define RXWI_W2_RSSI0 FIELD32(0x000000ff) -#define RXWI_W2_RSSI1 FIELD32(0x0000ff00) -#define RXWI_W2_RSSI2 FIELD32(0x00ff0000) - -/* - * Word3 - */ -#define RXWI_W3_SNR0 FIELD32(0x000000ff) -#define RXWI_W3_SNR1 FIELD32(0x0000ff00) - -/* - * Macros for converting txpower from EEPROM to mac80211 value - * and from mac80211 value to register value. - */ -#define MIN_G_TXPOWER 0 -#define MIN_A_TXPOWER -7 -#define MAX_G_TXPOWER 31 -#define MAX_A_TXPOWER 15 -#define DEFAULT_TXPOWER 5 - -#define TXPOWER_G_FROM_DEV(__txpower) \ - ((__txpower) > MAX_G_TXPOWER) ? DEFAULT_TXPOWER : (__txpower) - -#define TXPOWER_G_TO_DEV(__txpower) \ - clamp_t(char, __txpower, MIN_G_TXPOWER, MAX_G_TXPOWER) - -#define TXPOWER_A_FROM_DEV(__txpower) \ - ((__txpower) > MAX_A_TXPOWER) ? DEFAULT_TXPOWER : (__txpower) - -#define TXPOWER_A_TO_DEV(__txpower) \ - clamp_t(char, __txpower, MIN_A_TXPOWER, MAX_A_TXPOWER) - -/* - * Board's maximun TX power limitation - */ -#define EIRP_MAX_TX_POWER_LIMIT 0x50 - -/* - * Number of TBTT intervals after which we have to adjust - * the hw beacon timer. - */ -#define BCN_TBTT_OFFSET 64 - -/* - * RT2800 driver data structure - */ -struct rt2800_drv_data { - u8 calibration_bw20; - u8 calibration_bw40; - u8 bbp25; - u8 bbp26; - u8 txmixer_gain_24g; - u8 txmixer_gain_5g; - unsigned int tbtt_tick; -}; - -#endif /* RT2800_H */ diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c deleted file mode 100644 index 12652d204f7e..000000000000 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ /dev/null @@ -1,6429 +0,0 @@ -/* - Copyright (C) 2010 Willow Garage - Copyright (C) 2010 Ivo van Doorn - Copyright (C) 2009 Bartlomiej Zolnierkiewicz - Copyright (C) 2009 Gertjan van Wingerde - - Based on the original rt2800pci.c and rt2800usb.c. - Copyright (C) 2009 Alban Browaeys - Copyright (C) 2009 Felix Fietkau - Copyright (C) 2009 Luis Correia - Copyright (C) 2009 Mattias Nissler - Copyright (C) 2009 Mark Asselstine - Copyright (C) 2009 Xose Vazquez Perez - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2800lib - Abstract: rt2800 generic device routines. - */ - -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2800lib.h" -#include "rt2800.h" - -/* - * Register access. - * All access to the CSR registers will go through the methods - * rt2800_register_read and rt2800_register_write. - * BBP and RF register require indirect register access, - * and use the CSR registers BBPCSR and RFCSR to achieve this. - * These indirect registers work with busy bits, - * and we will try maximal REGISTER_BUSY_COUNT times to access - * the register while taking a REGISTER_BUSY_DELAY us delay - * between each attampt. When the busy bit is still set at that time, - * the access attempt is considered to have failed, - * and we will print an error. - * The _lock versions must be used if you already hold the csr_mutex - */ -#define WAIT_FOR_BBP(__dev, __reg) \ - rt2800_regbusy_read((__dev), BBP_CSR_CFG, BBP_CSR_CFG_BUSY, (__reg)) -#define WAIT_FOR_RFCSR(__dev, __reg) \ - rt2800_regbusy_read((__dev), RF_CSR_CFG, RF_CSR_CFG_BUSY, (__reg)) -#define WAIT_FOR_RF(__dev, __reg) \ - rt2800_regbusy_read((__dev), RF_CSR_CFG0, RF_CSR_CFG0_BUSY, (__reg)) -#define WAIT_FOR_MCU(__dev, __reg) \ - rt2800_regbusy_read((__dev), H2M_MAILBOX_CSR, \ - H2M_MAILBOX_CSR_OWNER, (__reg)) - -static inline bool rt2800_is_305x_soc(struct rt2x00_dev *rt2x00dev) -{ - /* check for rt2872 on SoC */ - if (!rt2x00_is_soc(rt2x00dev) || - !rt2x00_rt(rt2x00dev, RT2872)) - return false; - - /* we know for sure that these rf chipsets are used on rt305x boards */ - if (rt2x00_rf(rt2x00dev, RF3020) || - rt2x00_rf(rt2x00dev, RF3021) || - rt2x00_rf(rt2x00dev, RF3022)) - return true; - - rt2x00_warn(rt2x00dev, "Unknown RF chipset on rt305x\n"); - return false; -} - -static void rt2800_bbp_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, const u8 value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the BBP becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_BBP(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, BBP_CSR_CFG_VALUE, value); - rt2x00_set_field32(®, BBP_CSR_CFG_REGNUM, word); - rt2x00_set_field32(®, BBP_CSR_CFG_BUSY, 1); - rt2x00_set_field32(®, BBP_CSR_CFG_READ_CONTROL, 0); - rt2x00_set_field32(®, BBP_CSR_CFG_BBP_RW_MODE, 1); - - rt2800_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg); - } - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt2800_bbp_read(struct rt2x00_dev *rt2x00dev, - const unsigned int word, u8 *value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the BBP becomes available, afterwards we - * can safely write the read request into the register. - * After the data has been written, we wait until hardware - * returns the correct value, if at any time the register - * doesn't become available in time, reg will be 0xffffffff - * which means we return 0xff to the caller. - */ - if (WAIT_FOR_BBP(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, BBP_CSR_CFG_REGNUM, word); - rt2x00_set_field32(®, BBP_CSR_CFG_BUSY, 1); - rt2x00_set_field32(®, BBP_CSR_CFG_READ_CONTROL, 1); - rt2x00_set_field32(®, BBP_CSR_CFG_BBP_RW_MODE, 1); - - rt2800_register_write_lock(rt2x00dev, BBP_CSR_CFG, reg); - - WAIT_FOR_BBP(rt2x00dev, ®); - } - - *value = rt2x00_get_field32(reg, BBP_CSR_CFG_VALUE); - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt2800_rfcsr_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, const u8 value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the RFCSR becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_RFCSR(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, RF_CSR_CFG_DATA, value); - rt2x00_set_field32(®, RF_CSR_CFG_REGNUM, word); - rt2x00_set_field32(®, RF_CSR_CFG_WRITE, 1); - rt2x00_set_field32(®, RF_CSR_CFG_BUSY, 1); - - rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg); - } - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt2800_rfcsr_read(struct rt2x00_dev *rt2x00dev, - const unsigned int word, u8 *value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the RFCSR becomes available, afterwards we - * can safely write the read request into the register. - * After the data has been written, we wait until hardware - * returns the correct value, if at any time the register - * doesn't become available in time, reg will be 0xffffffff - * which means we return 0xff to the caller. - */ - if (WAIT_FOR_RFCSR(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, RF_CSR_CFG_REGNUM, word); - rt2x00_set_field32(®, RF_CSR_CFG_WRITE, 0); - rt2x00_set_field32(®, RF_CSR_CFG_BUSY, 1); - - rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg); - - WAIT_FOR_RFCSR(rt2x00dev, ®); - } - - *value = rt2x00_get_field32(reg, RF_CSR_CFG_DATA); - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt2800_rf_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, const u32 value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the RF becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_RF(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, RF_CSR_CFG0_REG_VALUE_BW, value); - rt2x00_set_field32(®, RF_CSR_CFG0_STANDBYMODE, 0); - rt2x00_set_field32(®, RF_CSR_CFG0_SEL, 0); - rt2x00_set_field32(®, RF_CSR_CFG0_BUSY, 1); - - rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG0, reg); - rt2x00_rf_write(rt2x00dev, word, value); - } - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - int i, count; - - rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®); - if (rt2x00_get_field32(reg, WLAN_EN)) - return 0; - - rt2x00_set_field32(®, WLAN_GPIO_OUT_OE_BIT_ALL, 0xff); - rt2x00_set_field32(®, FRC_WL_ANT_SET, 1); - rt2x00_set_field32(®, WLAN_CLK_EN, 0); - rt2x00_set_field32(®, WLAN_EN, 1); - rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); - - udelay(REGISTER_BUSY_DELAY); - - count = 0; - do { - /* - * Check PLL_LD & XTAL_RDY. - */ - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2800_register_read(rt2x00dev, CMB_CTRL, ®); - if (rt2x00_get_field32(reg, PLL_LD) && - rt2x00_get_field32(reg, XTAL_RDY)) - break; - udelay(REGISTER_BUSY_DELAY); - } - - if (i >= REGISTER_BUSY_COUNT) { - - if (count >= 10) - return -EIO; - - rt2800_register_write(rt2x00dev, 0x58, 0x018); - udelay(REGISTER_BUSY_DELAY); - rt2800_register_write(rt2x00dev, 0x58, 0x418); - udelay(REGISTER_BUSY_DELAY); - rt2800_register_write(rt2x00dev, 0x58, 0x618); - udelay(REGISTER_BUSY_DELAY); - count++; - } else { - count = 0; - } - - rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®); - rt2x00_set_field32(®, PCIE_APP0_CLK_REQ, 0); - rt2x00_set_field32(®, WLAN_CLK_EN, 1); - rt2x00_set_field32(®, WLAN_RESET, 1); - rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); - udelay(10); - rt2x00_set_field32(®, WLAN_RESET, 0); - rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); - udelay(10); - rt2800_register_write(rt2x00dev, INT_SOURCE_CSR, 0x7fffffff); - } while (count != 0); - - return 0; -} - -void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, - const u8 command, const u8 token, - const u8 arg0, const u8 arg1) -{ - u32 reg; - - /* - * SOC devices don't support MCU requests. - */ - if (rt2x00_is_soc(rt2x00dev)) - return; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the MCU becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_MCU(rt2x00dev, ®)) { - rt2x00_set_field32(®, H2M_MAILBOX_CSR_OWNER, 1); - rt2x00_set_field32(®, H2M_MAILBOX_CSR_CMD_TOKEN, token); - rt2x00_set_field32(®, H2M_MAILBOX_CSR_ARG0, arg0); - rt2x00_set_field32(®, H2M_MAILBOX_CSR_ARG1, arg1); - rt2800_register_write_lock(rt2x00dev, H2M_MAILBOX_CSR, reg); - - reg = 0; - rt2x00_set_field32(®, HOST_CMD_CSR_HOST_COMMAND, command); - rt2800_register_write_lock(rt2x00dev, HOST_CMD_CSR, reg); - } - - mutex_unlock(&rt2x00dev->csr_mutex); -} -EXPORT_SYMBOL_GPL(rt2800_mcu_request); - -int rt2800_wait_csr_ready(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i = 0; - u32 reg; - - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2800_register_read(rt2x00dev, MAC_CSR0, ®); - if (reg && reg != ~0) - return 0; - msleep(1); - } - - rt2x00_err(rt2x00dev, "Unstable hardware\n"); - return -EBUSY; -} -EXPORT_SYMBOL_GPL(rt2800_wait_csr_ready); - -int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u32 reg; - - /* - * Some devices are really slow to respond here. Wait a whole second - * before timing out. - */ - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); - if (!rt2x00_get_field32(reg, WPDMA_GLO_CFG_TX_DMA_BUSY) && - !rt2x00_get_field32(reg, WPDMA_GLO_CFG_RX_DMA_BUSY)) - return 0; - - msleep(10); - } - - rt2x00_err(rt2x00dev, "WPDMA TX/RX busy [0x%08x]\n", reg); - return -EACCES; -} -EXPORT_SYMBOL_GPL(rt2800_wait_wpdma_ready); - -void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); - rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0); - rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_DMA_BUSY, 0); - rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0); - rt2x00_set_field32(®, WPDMA_GLO_CFG_RX_DMA_BUSY, 0); - rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1); - rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); -} -EXPORT_SYMBOL_GPL(rt2800_disable_wpdma); - -static bool rt2800_check_firmware_crc(const u8 *data, const size_t len) -{ - u16 fw_crc; - u16 crc; - - /* - * The last 2 bytes in the firmware array are the crc checksum itself, - * this means that we should never pass those 2 bytes to the crc - * algorithm. - */ - fw_crc = (data[len - 2] << 8 | data[len - 1]); - - /* - * Use the crc ccitt algorithm. - * This will return the same value as the legacy driver which - * used bit ordering reversion on the both the firmware bytes - * before input input as well as on the final output. - * Obviously using crc ccitt directly is much more efficient. - */ - crc = crc_ccitt(~0, data, len - 2); - - /* - * There is a small difference between the crc-itu-t + bitrev and - * the crc-ccitt crc calculation. In the latter method the 2 bytes - * will be swapped, use swab16 to convert the crc to the correct - * value. - */ - crc = swab16(crc); - - return fw_crc == crc; -} - -int rt2800_check_firmware(struct rt2x00_dev *rt2x00dev, - const u8 *data, const size_t len) -{ - size_t offset = 0; - size_t fw_len; - bool multiple; - - /* - * PCI(e) & SOC devices require firmware with a length - * of 8kb. USB devices require firmware files with a length - * of 4kb. Certain USB chipsets however require different firmware, - * which Ralink only provides attached to the original firmware - * file. Thus for USB devices, firmware files have a length - * which is a multiple of 4kb. The firmware for rt3290 chip also - * have a length which is a multiple of 4kb. - */ - if (rt2x00_is_usb(rt2x00dev) || rt2x00_rt(rt2x00dev, RT3290)) - fw_len = 4096; - else - fw_len = 8192; - - multiple = true; - /* - * Validate the firmware length - */ - if (len != fw_len && (!multiple || (len % fw_len) != 0)) - return FW_BAD_LENGTH; - - /* - * Check if the chipset requires one of the upper parts - * of the firmware. - */ - if (rt2x00_is_usb(rt2x00dev) && - !rt2x00_rt(rt2x00dev, RT2860) && - !rt2x00_rt(rt2x00dev, RT2872) && - !rt2x00_rt(rt2x00dev, RT3070) && - ((len / fw_len) == 1)) - return FW_BAD_VERSION; - - /* - * 8kb firmware files must be checked as if it were - * 2 separate firmware files. - */ - while (offset < len) { - if (!rt2800_check_firmware_crc(data + offset, fw_len)) - return FW_BAD_CRC; - - offset += fw_len; - } - - return FW_OK; -} -EXPORT_SYMBOL_GPL(rt2800_check_firmware); - -int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev, - const u8 *data, const size_t len) -{ - unsigned int i; - u32 reg; - int retval; - - if (rt2x00_rt(rt2x00dev, RT3290)) { - retval = rt2800_enable_wlan_rt3290(rt2x00dev); - if (retval) - return -EBUSY; - } - - /* - * If driver doesn't wake up firmware here, - * rt2800_load_firmware will hang forever when interface is up again. - */ - rt2800_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0x00000000); - - /* - * Wait for stable hardware. - */ - if (rt2800_wait_csr_ready(rt2x00dev)) - return -EBUSY; - - if (rt2x00_is_pci(rt2x00dev)) { - if (rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT3572) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) { - rt2800_register_read(rt2x00dev, AUX_CTRL, ®); - rt2x00_set_field32(®, AUX_CTRL_FORCE_PCIE_CLK, 1); - rt2x00_set_field32(®, AUX_CTRL_WAKE_PCIE_EN, 1); - rt2800_register_write(rt2x00dev, AUX_CTRL, reg); - } - rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000002); - } - - rt2800_disable_wpdma(rt2x00dev); - - /* - * Write firmware to the device. - */ - rt2800_drv_write_firmware(rt2x00dev, data, len); - - /* - * Wait for device to stabilize. - */ - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2800_register_read(rt2x00dev, PBF_SYS_CTRL, ®); - if (rt2x00_get_field32(reg, PBF_SYS_CTRL_READY)) - break; - msleep(1); - } - - if (i == REGISTER_BUSY_COUNT) { - rt2x00_err(rt2x00dev, "PBF system register not ready\n"); - return -EBUSY; - } - - /* - * Disable DMA, will be reenabled later when enabling - * the radio. - */ - rt2800_disable_wpdma(rt2x00dev); - - /* - * Initialize firmware. - */ - rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); - rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); - if (rt2x00_is_usb(rt2x00dev)) { - rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0); - rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); - } - msleep(1); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2800_load_firmware); - -void rt2800_write_tx_data(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - __le32 *txwi = rt2800_drv_get_txwi(entry); - u32 word; - int i; - - /* - * Initialize TX Info descriptor - */ - rt2x00_desc_read(txwi, 0, &word); - rt2x00_set_field32(&word, TXWI_W0_FRAG, - test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); - rt2x00_set_field32(&word, TXWI_W0_MIMO_PS, - test_bit(ENTRY_TXD_HT_MIMO_PS, &txdesc->flags)); - rt2x00_set_field32(&word, TXWI_W0_CF_ACK, 0); - rt2x00_set_field32(&word, TXWI_W0_TS, - test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); - rt2x00_set_field32(&word, TXWI_W0_AMPDU, - test_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags)); - rt2x00_set_field32(&word, TXWI_W0_MPDU_DENSITY, - txdesc->u.ht.mpdu_density); - rt2x00_set_field32(&word, TXWI_W0_TX_OP, txdesc->u.ht.txop); - rt2x00_set_field32(&word, TXWI_W0_MCS, txdesc->u.ht.mcs); - rt2x00_set_field32(&word, TXWI_W0_BW, - test_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags)); - rt2x00_set_field32(&word, TXWI_W0_SHORT_GI, - test_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags)); - rt2x00_set_field32(&word, TXWI_W0_STBC, txdesc->u.ht.stbc); - rt2x00_set_field32(&word, TXWI_W0_PHYMODE, txdesc->rate_mode); - rt2x00_desc_write(txwi, 0, word); - - rt2x00_desc_read(txwi, 1, &word); - rt2x00_set_field32(&word, TXWI_W1_ACK, - test_bit(ENTRY_TXD_ACK, &txdesc->flags)); - rt2x00_set_field32(&word, TXWI_W1_NSEQ, - test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); - rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->u.ht.ba_size); - rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID, - test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ? - txdesc->key_idx : txdesc->u.ht.wcid); - rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT, - txdesc->length); - rt2x00_set_field32(&word, TXWI_W1_PACKETID_QUEUE, entry->queue->qid); - rt2x00_set_field32(&word, TXWI_W1_PACKETID_ENTRY, (entry->entry_idx % 3) + 1); - rt2x00_desc_write(txwi, 1, word); - - /* - * Always write 0 to IV/EIV fields (word 2 and 3), hardware will insert - * the IV from the IVEIV register when TXD_W3_WIV is set to 0. - * When TXD_W3_WIV is set to 1 it will use the IV data - * from the descriptor. The TXWI_W1_WIRELESS_CLI_ID indicates which - * crypto entry in the registers should be used to encrypt the frame. - * - * Nulify all remaining words as well, we don't know how to program them. - */ - for (i = 2; i < entry->queue->winfo_size / sizeof(__le32); i++) - _rt2x00_desc_write(txwi, i, 0); -} -EXPORT_SYMBOL_GPL(rt2800_write_tx_data); - -static int rt2800_agc_to_rssi(struct rt2x00_dev *rt2x00dev, u32 rxwi_w2) -{ - s8 rssi0 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI0); - s8 rssi1 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI1); - s8 rssi2 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI2); - u16 eeprom; - u8 offset0; - u8 offset1; - u8 offset2; - - if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) { - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &eeprom); - offset0 = rt2x00_get_field16(eeprom, EEPROM_RSSI_BG_OFFSET0); - offset1 = rt2x00_get_field16(eeprom, EEPROM_RSSI_BG_OFFSET1); - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &eeprom); - offset2 = rt2x00_get_field16(eeprom, EEPROM_RSSI_BG2_OFFSET2); - } else { - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &eeprom); - offset0 = rt2x00_get_field16(eeprom, EEPROM_RSSI_A_OFFSET0); - offset1 = rt2x00_get_field16(eeprom, EEPROM_RSSI_A_OFFSET1); - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &eeprom); - offset2 = rt2x00_get_field16(eeprom, EEPROM_RSSI_A2_OFFSET2); - } - - /* - * Convert the value from the descriptor into the RSSI value - * If the value in the descriptor is 0, it is considered invalid - * and the default (extremely low) rssi value is assumed - */ - rssi0 = (rssi0) ? (-12 - offset0 - rt2x00dev->lna_gain - rssi0) : -128; - rssi1 = (rssi1) ? (-12 - offset1 - rt2x00dev->lna_gain - rssi1) : -128; - rssi2 = (rssi2) ? (-12 - offset2 - rt2x00dev->lna_gain - rssi2) : -128; - - /* - * mac80211 only accepts a single RSSI value. Calculating the - * average doesn't deliver a fair answer either since -60:-60 would - * be considered equally good as -50:-70 while the second is the one - * which gives less energy... - */ - rssi0 = max(rssi0, rssi1); - return (int)max(rssi0, rssi2); -} - -void rt2800_process_rxwi(struct queue_entry *entry, - struct rxdone_entry_desc *rxdesc) -{ - __le32 *rxwi = (__le32 *) entry->skb->data; - u32 word; - - rt2x00_desc_read(rxwi, 0, &word); - - rxdesc->cipher = rt2x00_get_field32(word, RXWI_W0_UDF); - rxdesc->size = rt2x00_get_field32(word, RXWI_W0_MPDU_TOTAL_BYTE_COUNT); - - rt2x00_desc_read(rxwi, 1, &word); - - if (rt2x00_get_field32(word, RXWI_W1_SHORT_GI)) - rxdesc->flags |= RX_FLAG_SHORT_GI; - - if (rt2x00_get_field32(word, RXWI_W1_BW)) - rxdesc->flags |= RX_FLAG_40MHZ; - - /* - * Detect RX rate, always use MCS as signal type. - */ - rxdesc->dev_flags |= RXDONE_SIGNAL_MCS; - rxdesc->signal = rt2x00_get_field32(word, RXWI_W1_MCS); - rxdesc->rate_mode = rt2x00_get_field32(word, RXWI_W1_PHYMODE); - - /* - * Mask of 0x8 bit to remove the short preamble flag. - */ - if (rxdesc->rate_mode == RATE_MODE_CCK) - rxdesc->signal &= ~0x8; - - rt2x00_desc_read(rxwi, 2, &word); - - /* - * Convert descriptor AGC value to RSSI value. - */ - rxdesc->rssi = rt2800_agc_to_rssi(entry->queue->rt2x00dev, word); - /* - * Remove RXWI descriptor from start of the buffer. - */ - skb_pull(entry->skb, entry->queue->winfo_size); -} -EXPORT_SYMBOL_GPL(rt2800_process_rxwi); - -void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - struct txdone_entry_desc txdesc; - u32 word; - u16 mcs, real_mcs; - int aggr, ampdu; - - /* - * Obtain the status about this packet. - */ - txdesc.flags = 0; - rt2x00_desc_read(txwi, 0, &word); - - mcs = rt2x00_get_field32(word, TXWI_W0_MCS); - ampdu = rt2x00_get_field32(word, TXWI_W0_AMPDU); - - real_mcs = rt2x00_get_field32(status, TX_STA_FIFO_MCS); - aggr = rt2x00_get_field32(status, TX_STA_FIFO_TX_AGGRE); - - /* - * If a frame was meant to be sent as a single non-aggregated MPDU - * but ended up in an aggregate the used tx rate doesn't correlate - * with the one specified in the TXWI as the whole aggregate is sent - * with the same rate. - * - * For example: two frames are sent to rt2x00, the first one sets - * AMPDU=1 and requests MCS7 whereas the second frame sets AMDPU=0 - * and requests MCS15. If the hw aggregates both frames into one - * AMDPU the tx status for both frames will contain MCS7 although - * the frame was sent successfully. - * - * Hence, replace the requested rate with the real tx rate to not - * confuse the rate control algortihm by providing clearly wrong - * data. - */ - if (unlikely(aggr == 1 && ampdu == 0 && real_mcs != mcs)) { - skbdesc->tx_rate_idx = real_mcs; - mcs = real_mcs; - } - - if (aggr == 1 || ampdu == 1) - __set_bit(TXDONE_AMPDU, &txdesc.flags); - - /* - * Ralink has a retry mechanism using a global fallback - * table. We setup this fallback table to try the immediate - * lower rate for all rates. In the TX_STA_FIFO, the MCS field - * always contains the MCS used for the last transmission, be - * it successful or not. - */ - if (rt2x00_get_field32(status, TX_STA_FIFO_TX_SUCCESS)) { - /* - * Transmission succeeded. The number of retries is - * mcs - real_mcs - */ - __set_bit(TXDONE_SUCCESS, &txdesc.flags); - txdesc.retry = ((mcs > real_mcs) ? mcs - real_mcs : 0); - } else { - /* - * Transmission failed. The number of retries is - * always 7 in this case (for a total number of 8 - * frames sent). - */ - __set_bit(TXDONE_FAILURE, &txdesc.flags); - txdesc.retry = rt2x00dev->long_retry; - } - - /* - * the frame was retried at least once - * -> hw used fallback rates - */ - if (txdesc.retry) - __set_bit(TXDONE_FALLBACK, &txdesc.flags); - - rt2x00lib_txdone(entry, &txdesc); -} -EXPORT_SYMBOL_GPL(rt2800_txdone_entry); - -void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - unsigned int beacon_base; - unsigned int padding_len; - u32 orig_reg, reg; - const int txwi_desc_size = entry->queue->winfo_size; - - /* - * Disable beaconing while we are reloading the beacon data, - * otherwise we might be sending out invalid data. - */ - rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); - orig_reg = reg; - rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0); - rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); - - /* - * Add space for the TXWI in front of the skb. - */ - memset(skb_push(entry->skb, txwi_desc_size), 0, txwi_desc_size); - - /* - * Register descriptor details in skb frame descriptor. - */ - skbdesc->flags |= SKBDESC_DESC_IN_SKB; - skbdesc->desc = entry->skb->data; - skbdesc->desc_len = txwi_desc_size; - - /* - * Add the TXWI for the beacon to the skb. - */ - rt2800_write_tx_data(entry, txdesc); - - /* - * Dump beacon to userspace through debugfs. - */ - rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb); - - /* - * Write entire beacon with TXWI and padding to register. - */ - padding_len = roundup(entry->skb->len, 4) - entry->skb->len; - if (padding_len && skb_pad(entry->skb, padding_len)) { - rt2x00_err(rt2x00dev, "Failure padding beacon, aborting\n"); - /* skb freed by skb_pad() on failure */ - entry->skb = NULL; - rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg); - return; - } - - beacon_base = HW_BEACON_OFFSET(entry->entry_idx); - rt2800_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data, - entry->skb->len + padding_len); - - /* - * Enable beaconing again. - */ - rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); - rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); - - /* - * Clean up beacon skb. - */ - dev_kfree_skb_any(entry->skb); - entry->skb = NULL; -} -EXPORT_SYMBOL_GPL(rt2800_write_beacon); - -static inline void rt2800_clear_beacon_register(struct rt2x00_dev *rt2x00dev, - unsigned int beacon_base) -{ - int i; - const int txwi_desc_size = rt2x00dev->ops->bcn->winfo_size; - - /* - * For the Beacon base registers we only need to clear - * the whole TXWI which (when set to 0) will invalidate - * the entire beacon. - */ - for (i = 0; i < txwi_desc_size; i += sizeof(__le32)) - rt2800_register_write(rt2x00dev, beacon_base + i, 0); -} - -void rt2800_clear_beacon(struct queue_entry *entry) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - u32 reg; - - /* - * Disable beaconing while we are reloading the beacon data, - * otherwise we might be sending out invalid data. - */ - rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); - rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0); - rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); - - /* - * Clear beacon. - */ - rt2800_clear_beacon_register(rt2x00dev, - HW_BEACON_OFFSET(entry->entry_idx)); - - /* - * Enabled beaconing again. - */ - rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); - rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); -} -EXPORT_SYMBOL_GPL(rt2800_clear_beacon); - -#ifdef CONFIG_RT2X00_LIB_DEBUGFS -const struct rt2x00debug rt2800_rt2x00debug = { - .owner = THIS_MODULE, - .csr = { - .read = rt2800_register_read, - .write = rt2800_register_write, - .flags = RT2X00DEBUGFS_OFFSET, - .word_base = CSR_REG_BASE, - .word_size = sizeof(u32), - .word_count = CSR_REG_SIZE / sizeof(u32), - }, - .eeprom = { - .read = rt2x00_eeprom_read, - .write = rt2x00_eeprom_write, - .word_base = EEPROM_BASE, - .word_size = sizeof(u16), - .word_count = EEPROM_SIZE / sizeof(u16), - }, - .bbp = { - .read = rt2800_bbp_read, - .write = rt2800_bbp_write, - .word_base = BBP_BASE, - .word_size = sizeof(u8), - .word_count = BBP_SIZE / sizeof(u8), - }, - .rf = { - .read = rt2x00_rf_read, - .write = rt2800_rf_write, - .word_base = RF_BASE, - .word_size = sizeof(u32), - .word_count = RF_SIZE / sizeof(u32), - }, - .rfcsr = { - .read = rt2800_rfcsr_read, - .write = rt2800_rfcsr_write, - .word_base = RFCSR_BASE, - .word_size = sizeof(u8), - .word_count = RFCSR_SIZE / sizeof(u8), - }, -}; -EXPORT_SYMBOL_GPL(rt2800_rt2x00debug); -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ - -int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - if (rt2x00_rt(rt2x00dev, RT3290)) { - rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®); - return rt2x00_get_field32(reg, WLAN_GPIO_IN_BIT0); - } else { - rt2800_register_read(rt2x00dev, GPIO_CTRL, ®); - return rt2x00_get_field32(reg, GPIO_CTRL_VAL2); - } -} -EXPORT_SYMBOL_GPL(rt2800_rfkill_poll); - -#ifdef CONFIG_RT2X00_LIB_LEDS -static void rt2800_brightness_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct rt2x00_led *led = - container_of(led_cdev, struct rt2x00_led, led_dev); - unsigned int enabled = brightness != LED_OFF; - unsigned int bg_mode = - (enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_2GHZ); - unsigned int polarity = - rt2x00_get_field16(led->rt2x00dev->led_mcu_reg, - EEPROM_FREQ_LED_POLARITY); - unsigned int ledmode = - rt2x00_get_field16(led->rt2x00dev->led_mcu_reg, - EEPROM_FREQ_LED_MODE); - u32 reg; - - /* Check for SoC (SOC devices don't support MCU requests) */ - if (rt2x00_is_soc(led->rt2x00dev)) { - rt2800_register_read(led->rt2x00dev, LED_CFG, ®); - - /* Set LED Polarity */ - rt2x00_set_field32(®, LED_CFG_LED_POLAR, polarity); - - /* Set LED Mode */ - if (led->type == LED_TYPE_RADIO) { - rt2x00_set_field32(®, LED_CFG_G_LED_MODE, - enabled ? 3 : 0); - } else if (led->type == LED_TYPE_ASSOC) { - rt2x00_set_field32(®, LED_CFG_Y_LED_MODE, - enabled ? 3 : 0); - } else if (led->type == LED_TYPE_QUALITY) { - rt2x00_set_field32(®, LED_CFG_R_LED_MODE, - enabled ? 3 : 0); - } - - rt2800_register_write(led->rt2x00dev, LED_CFG, reg); - - } else { - if (led->type == LED_TYPE_RADIO) { - rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode, - enabled ? 0x20 : 0); - } else if (led->type == LED_TYPE_ASSOC) { - rt2800_mcu_request(led->rt2x00dev, MCU_LED, 0xff, ledmode, - enabled ? (bg_mode ? 0x60 : 0xa0) : 0x20); - } else if (led->type == LED_TYPE_QUALITY) { - /* - * The brightness is divided into 6 levels (0 - 5), - * The specs tell us the following levels: - * 0, 1 ,3, 7, 15, 31 - * to determine the level in a simple way we can simply - * work with bitshifting: - * (1 << level) - 1 - */ - rt2800_mcu_request(led->rt2x00dev, MCU_LED_STRENGTH, 0xff, - (1 << brightness / (LED_FULL / 6)) - 1, - polarity); - } - } -} - -static void rt2800_init_led(struct rt2x00_dev *rt2x00dev, - struct rt2x00_led *led, enum led_type type) -{ - led->rt2x00dev = rt2x00dev; - led->type = type; - led->led_dev.brightness_set = rt2800_brightness_set; - led->flags = LED_INITIALIZED; -} -#endif /* CONFIG_RT2X00_LIB_LEDS */ - -/* - * Configuration handlers. - */ -static void rt2800_config_wcid(struct rt2x00_dev *rt2x00dev, - const u8 *address, - int wcid) -{ - struct mac_wcid_entry wcid_entry; - u32 offset; - - offset = MAC_WCID_ENTRY(wcid); - - memset(&wcid_entry, 0xff, sizeof(wcid_entry)); - if (address) - memcpy(wcid_entry.mac, address, ETH_ALEN); - - rt2800_register_multiwrite(rt2x00dev, offset, - &wcid_entry, sizeof(wcid_entry)); -} - -static void rt2800_delete_wcid_attr(struct rt2x00_dev *rt2x00dev, int wcid) -{ - u32 offset; - offset = MAC_WCID_ATTR_ENTRY(wcid); - rt2800_register_write(rt2x00dev, offset, 0); -} - -static void rt2800_config_wcid_attr_bssidx(struct rt2x00_dev *rt2x00dev, - int wcid, u32 bssidx) -{ - u32 offset = MAC_WCID_ATTR_ENTRY(wcid); - u32 reg; - - /* - * The BSS Idx numbers is split in a main value of 3 bits, - * and a extended field for adding one additional bit to the value. - */ - rt2800_register_read(rt2x00dev, offset, ®); - rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_BSS_IDX, (bssidx & 0x7)); - rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_BSS_IDX_EXT, - (bssidx & 0x8) >> 3); - rt2800_register_write(rt2x00dev, offset, reg); -} - -static void rt2800_config_wcid_attr_cipher(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_crypto *crypto, - struct ieee80211_key_conf *key) -{ - struct mac_iveiv_entry iveiv_entry; - u32 offset; - u32 reg; - - offset = MAC_WCID_ATTR_ENTRY(key->hw_key_idx); - - if (crypto->cmd == SET_KEY) { - rt2800_register_read(rt2x00dev, offset, ®); - rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_KEYTAB, - !!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)); - /* - * Both the cipher as the BSS Idx numbers are split in a main - * value of 3 bits, and a extended field for adding one additional - * bit to the value. - */ - rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_CIPHER, - (crypto->cipher & 0x7)); - rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_CIPHER_EXT, - (crypto->cipher & 0x8) >> 3); - rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_RX_WIUDF, crypto->cipher); - rt2800_register_write(rt2x00dev, offset, reg); - } else { - /* Delete the cipher without touching the bssidx */ - rt2800_register_read(rt2x00dev, offset, ®); - rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_KEYTAB, 0); - rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_CIPHER, 0); - rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_CIPHER_EXT, 0); - rt2x00_set_field32(®, MAC_WCID_ATTRIBUTE_RX_WIUDF, 0); - rt2800_register_write(rt2x00dev, offset, reg); - } - - offset = MAC_IVEIV_ENTRY(key->hw_key_idx); - - memset(&iveiv_entry, 0, sizeof(iveiv_entry)); - if ((crypto->cipher == CIPHER_TKIP) || - (crypto->cipher == CIPHER_TKIP_NO_MIC) || - (crypto->cipher == CIPHER_AES)) - iveiv_entry.iv[3] |= 0x20; - iveiv_entry.iv[3] |= key->keyidx << 6; - rt2800_register_multiwrite(rt2x00dev, offset, - &iveiv_entry, sizeof(iveiv_entry)); -} - -int rt2800_config_shared_key(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_crypto *crypto, - struct ieee80211_key_conf *key) -{ - struct hw_key_entry key_entry; - struct rt2x00_field32 field; - u32 offset; - u32 reg; - - if (crypto->cmd == SET_KEY) { - key->hw_key_idx = (4 * crypto->bssidx) + key->keyidx; - - memcpy(key_entry.key, crypto->key, - sizeof(key_entry.key)); - memcpy(key_entry.tx_mic, crypto->tx_mic, - sizeof(key_entry.tx_mic)); - memcpy(key_entry.rx_mic, crypto->rx_mic, - sizeof(key_entry.rx_mic)); - - offset = SHARED_KEY_ENTRY(key->hw_key_idx); - rt2800_register_multiwrite(rt2x00dev, offset, - &key_entry, sizeof(key_entry)); - } - - /* - * The cipher types are stored over multiple registers - * starting with SHARED_KEY_MODE_BASE each word will have - * 32 bits and contains the cipher types for 2 bssidx each. - * Using the correct defines correctly will cause overhead, - * so just calculate the correct offset. - */ - field.bit_offset = 4 * (key->hw_key_idx % 8); - field.bit_mask = 0x7 << field.bit_offset; - - offset = SHARED_KEY_MODE_ENTRY(key->hw_key_idx / 8); - - rt2800_register_read(rt2x00dev, offset, ®); - rt2x00_set_field32(®, field, - (crypto->cmd == SET_KEY) * crypto->cipher); - rt2800_register_write(rt2x00dev, offset, reg); - - /* - * Update WCID information - */ - rt2800_config_wcid(rt2x00dev, crypto->address, key->hw_key_idx); - rt2800_config_wcid_attr_bssidx(rt2x00dev, key->hw_key_idx, - crypto->bssidx); - rt2800_config_wcid_attr_cipher(rt2x00dev, crypto, key); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2800_config_shared_key); - -static inline int rt2800_find_wcid(struct rt2x00_dev *rt2x00dev) -{ - struct mac_wcid_entry wcid_entry; - int idx; - u32 offset; - - /* - * Search for the first free WCID entry and return the corresponding - * index. - * - * Make sure the WCID starts _after_ the last possible shared key - * entry (>32). - * - * Since parts of the pairwise key table might be shared with - * the beacon frame buffers 6 & 7 we should only write into the - * first 222 entries. - */ - for (idx = 33; idx <= 222; idx++) { - offset = MAC_WCID_ENTRY(idx); - rt2800_register_multiread(rt2x00dev, offset, &wcid_entry, - sizeof(wcid_entry)); - if (is_broadcast_ether_addr(wcid_entry.mac)) - return idx; - } - - /* - * Use -1 to indicate that we don't have any more space in the WCID - * table. - */ - return -1; -} - -int rt2800_config_pairwise_key(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_crypto *crypto, - struct ieee80211_key_conf *key) -{ - struct hw_key_entry key_entry; - u32 offset; - - if (crypto->cmd == SET_KEY) { - /* - * Allow key configuration only for STAs that are - * known by the hw. - */ - if (crypto->wcid < 0) - return -ENOSPC; - key->hw_key_idx = crypto->wcid; - - memcpy(key_entry.key, crypto->key, - sizeof(key_entry.key)); - memcpy(key_entry.tx_mic, crypto->tx_mic, - sizeof(key_entry.tx_mic)); - memcpy(key_entry.rx_mic, crypto->rx_mic, - sizeof(key_entry.rx_mic)); - - offset = PAIRWISE_KEY_ENTRY(key->hw_key_idx); - rt2800_register_multiwrite(rt2x00dev, offset, - &key_entry, sizeof(key_entry)); - } - - /* - * Update WCID information - */ - rt2800_config_wcid_attr_cipher(rt2x00dev, crypto, key); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2800_config_pairwise_key); - -int rt2800_sta_add(struct rt2x00_dev *rt2x00dev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - int wcid; - struct rt2x00_sta *sta_priv = sta_to_rt2x00_sta(sta); - - /* - * Find next free WCID. - */ - wcid = rt2800_find_wcid(rt2x00dev); - - /* - * Store selected wcid even if it is invalid so that we can - * later decide if the STA is uploaded into the hw. - */ - sta_priv->wcid = wcid; - - /* - * No space left in the device, however, we can still communicate - * with the STA -> No error. - */ - if (wcid < 0) - return 0; - - /* - * Clean up WCID attributes and write STA address to the device. - */ - rt2800_delete_wcid_attr(rt2x00dev, wcid); - rt2800_config_wcid(rt2x00dev, sta->addr, wcid); - rt2800_config_wcid_attr_bssidx(rt2x00dev, wcid, - rt2x00lib_get_bssidx(rt2x00dev, vif)); - return 0; -} -EXPORT_SYMBOL_GPL(rt2800_sta_add); - -int rt2800_sta_remove(struct rt2x00_dev *rt2x00dev, int wcid) -{ - /* - * Remove WCID entry, no need to clean the attributes as they will - * get renewed when the WCID is reused. - */ - rt2800_config_wcid(rt2x00dev, NULL, wcid); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2800_sta_remove); - -void rt2800_config_filter(struct rt2x00_dev *rt2x00dev, - const unsigned int filter_flags) -{ - u32 reg; - - /* - * Start configuration steps. - * Note that the version error will always be dropped - * and broadcast frames will always be accepted since - * there is no filter for it at this time. - */ - rt2800_register_read(rt2x00dev, RX_FILTER_CFG, ®); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_CRC_ERROR, - !(filter_flags & FIF_FCSFAIL)); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_PHY_ERROR, - !(filter_flags & FIF_PLCPFAIL)); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_NOT_TO_ME, - !(filter_flags & FIF_PROMISC_IN_BSS)); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_VER_ERROR, 1); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_MULTICAST, - !(filter_flags & FIF_ALLMULTI)); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_BROADCAST, 0); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_DUPLICATE, 1); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_CF_END_ACK, - !(filter_flags & FIF_CONTROL)); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_CF_END, - !(filter_flags & FIF_CONTROL)); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_ACK, - !(filter_flags & FIF_CONTROL)); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_CTS, - !(filter_flags & FIF_CONTROL)); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_RTS, - !(filter_flags & FIF_CONTROL)); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_PSPOLL, - !(filter_flags & FIF_PSPOLL)); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_BA, 0); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_BAR, - !(filter_flags & FIF_CONTROL)); - rt2x00_set_field32(®, RX_FILTER_CFG_DROP_CNTL, - !(filter_flags & FIF_CONTROL)); - rt2800_register_write(rt2x00dev, RX_FILTER_CFG, reg); -} -EXPORT_SYMBOL_GPL(rt2800_config_filter); - -void rt2800_config_intf(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf, - struct rt2x00intf_conf *conf, const unsigned int flags) -{ - u32 reg; - bool update_bssid = false; - - if (flags & CONFIG_UPDATE_TYPE) { - /* - * Enable synchronisation. - */ - rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); - rt2x00_set_field32(®, BCN_TIME_CFG_TSF_SYNC, conf->sync); - rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); - - if (conf->sync == TSF_SYNC_AP_NONE) { - /* - * Tune beacon queue transmit parameters for AP mode - */ - rt2800_register_read(rt2x00dev, TBTT_SYNC_CFG, ®); - rt2x00_set_field32(®, TBTT_SYNC_CFG_BCN_CWMIN, 0); - rt2x00_set_field32(®, TBTT_SYNC_CFG_BCN_AIFSN, 1); - rt2x00_set_field32(®, TBTT_SYNC_CFG_BCN_EXP_WIN, 32); - rt2x00_set_field32(®, TBTT_SYNC_CFG_TBTT_ADJUST, 0); - rt2800_register_write(rt2x00dev, TBTT_SYNC_CFG, reg); - } else { - rt2800_register_read(rt2x00dev, TBTT_SYNC_CFG, ®); - rt2x00_set_field32(®, TBTT_SYNC_CFG_BCN_CWMIN, 4); - rt2x00_set_field32(®, TBTT_SYNC_CFG_BCN_AIFSN, 2); - rt2x00_set_field32(®, TBTT_SYNC_CFG_BCN_EXP_WIN, 32); - rt2x00_set_field32(®, TBTT_SYNC_CFG_TBTT_ADJUST, 16); - rt2800_register_write(rt2x00dev, TBTT_SYNC_CFG, reg); - } - } - - if (flags & CONFIG_UPDATE_MAC) { - if (flags & CONFIG_UPDATE_TYPE && - conf->sync == TSF_SYNC_AP_NONE) { - /* - * The BSSID register has to be set to our own mac - * address in AP mode. - */ - memcpy(conf->bssid, conf->mac, sizeof(conf->mac)); - update_bssid = true; - } - - if (!is_zero_ether_addr((const u8 *)conf->mac)) { - reg = le32_to_cpu(conf->mac[1]); - rt2x00_set_field32(®, MAC_ADDR_DW1_UNICAST_TO_ME_MASK, 0xff); - conf->mac[1] = cpu_to_le32(reg); - } - - rt2800_register_multiwrite(rt2x00dev, MAC_ADDR_DW0, - conf->mac, sizeof(conf->mac)); - } - - if ((flags & CONFIG_UPDATE_BSSID) || update_bssid) { - if (!is_zero_ether_addr((const u8 *)conf->bssid)) { - reg = le32_to_cpu(conf->bssid[1]); - rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_ID_MASK, 3); - rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_BCN_NUM, 7); - conf->bssid[1] = cpu_to_le32(reg); - } - - rt2800_register_multiwrite(rt2x00dev, MAC_BSSID_DW0, - conf->bssid, sizeof(conf->bssid)); - } -} -EXPORT_SYMBOL_GPL(rt2800_config_intf); - -static void rt2800_config_ht_opmode(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_erp *erp) -{ - bool any_sta_nongf = !!(erp->ht_opmode & - IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); - u8 protection = erp->ht_opmode & IEEE80211_HT_OP_MODE_PROTECTION; - u8 mm20_mode, mm40_mode, gf20_mode, gf40_mode; - u16 mm20_rate, mm40_rate, gf20_rate, gf40_rate; - u32 reg; - - /* default protection rate for HT20: OFDM 24M */ - mm20_rate = gf20_rate = 0x4004; - - /* default protection rate for HT40: duplicate OFDM 24M */ - mm40_rate = gf40_rate = 0x4084; - - switch (protection) { - case IEEE80211_HT_OP_MODE_PROTECTION_NONE: - /* - * All STAs in this BSS are HT20/40 but there might be - * STAs not supporting greenfield mode. - * => Disable protection for HT transmissions. - */ - mm20_mode = mm40_mode = gf20_mode = gf40_mode = 0; - - break; - case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: - /* - * All STAs in this BSS are HT20 or HT20/40 but there - * might be STAs not supporting greenfield mode. - * => Protect all HT40 transmissions. - */ - mm20_mode = gf20_mode = 0; - mm40_mode = gf40_mode = 2; - - break; - case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER: - /* - * Nonmember protection: - * According to 802.11n we _should_ protect all - * HT transmissions (but we don't have to). - * - * But if cts_protection is enabled we _shall_ protect - * all HT transmissions using a CCK rate. - * - * And if any station is non GF we _shall_ protect - * GF transmissions. - * - * We decide to protect everything - * -> fall through to mixed mode. - */ - case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: - /* - * Legacy STAs are present - * => Protect all HT transmissions. - */ - mm20_mode = mm40_mode = gf20_mode = gf40_mode = 2; - - /* - * If erp protection is needed we have to protect HT - * transmissions with CCK 11M long preamble. - */ - if (erp->cts_protection) { - /* don't duplicate RTS/CTS in CCK mode */ - mm20_rate = mm40_rate = 0x0003; - gf20_rate = gf40_rate = 0x0003; - } - break; - } - - /* check for STAs not supporting greenfield mode */ - if (any_sta_nongf) - gf20_mode = gf40_mode = 2; - - /* Update HT protection config */ - rt2800_register_read(rt2x00dev, MM20_PROT_CFG, ®); - rt2x00_set_field32(®, MM20_PROT_CFG_PROTECT_RATE, mm20_rate); - rt2x00_set_field32(®, MM20_PROT_CFG_PROTECT_CTRL, mm20_mode); - rt2800_register_write(rt2x00dev, MM20_PROT_CFG, reg); - - rt2800_register_read(rt2x00dev, MM40_PROT_CFG, ®); - rt2x00_set_field32(®, MM40_PROT_CFG_PROTECT_RATE, mm40_rate); - rt2x00_set_field32(®, MM40_PROT_CFG_PROTECT_CTRL, mm40_mode); - rt2800_register_write(rt2x00dev, MM40_PROT_CFG, reg); - - rt2800_register_read(rt2x00dev, GF20_PROT_CFG, ®); - rt2x00_set_field32(®, GF20_PROT_CFG_PROTECT_RATE, gf20_rate); - rt2x00_set_field32(®, GF20_PROT_CFG_PROTECT_CTRL, gf20_mode); - rt2800_register_write(rt2x00dev, GF20_PROT_CFG, reg); - - rt2800_register_read(rt2x00dev, GF40_PROT_CFG, ®); - rt2x00_set_field32(®, GF40_PROT_CFG_PROTECT_RATE, gf40_rate); - rt2x00_set_field32(®, GF40_PROT_CFG_PROTECT_CTRL, gf40_mode); - rt2800_register_write(rt2x00dev, GF40_PROT_CFG, reg); -} - -void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp, - u32 changed) -{ - u32 reg; - - if (changed & BSS_CHANGED_ERP_PREAMBLE) { - rt2800_register_read(rt2x00dev, AUTO_RSP_CFG, ®); - rt2x00_set_field32(®, AUTO_RSP_CFG_BAC_ACK_POLICY, - !!erp->short_preamble); - rt2x00_set_field32(®, AUTO_RSP_CFG_AR_PREAMBLE, - !!erp->short_preamble); - rt2800_register_write(rt2x00dev, AUTO_RSP_CFG, reg); - } - - if (changed & BSS_CHANGED_ERP_CTS_PROT) { - rt2800_register_read(rt2x00dev, OFDM_PROT_CFG, ®); - rt2x00_set_field32(®, OFDM_PROT_CFG_PROTECT_CTRL, - erp->cts_protection ? 2 : 0); - rt2800_register_write(rt2x00dev, OFDM_PROT_CFG, reg); - } - - if (changed & BSS_CHANGED_BASIC_RATES) { - rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, - erp->basic_rates); - rt2800_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003); - } - - if (changed & BSS_CHANGED_ERP_SLOT) { - rt2800_register_read(rt2x00dev, BKOFF_SLOT_CFG, ®); - rt2x00_set_field32(®, BKOFF_SLOT_CFG_SLOT_TIME, - erp->slot_time); - rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg); - - rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, ®); - rt2x00_set_field32(®, XIFS_TIME_CFG_EIFS, erp->eifs); - rt2800_register_write(rt2x00dev, XIFS_TIME_CFG, reg); - } - - if (changed & BSS_CHANGED_BEACON_INT) { - rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); - rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_INTERVAL, - erp->beacon_int * 16); - rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); - } - - if (changed & BSS_CHANGED_HT) - rt2800_config_ht_opmode(rt2x00dev, erp); -} -EXPORT_SYMBOL_GPL(rt2800_config_erp); - -static void rt2800_config_3572bt_ant(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - u16 eeprom; - u8 led_ctrl, led_g_mode, led_r_mode; - - rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®); - if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { - rt2x00_set_field32(®, GPIO_SWITCH_0, 1); - rt2x00_set_field32(®, GPIO_SWITCH_1, 1); - } else { - rt2x00_set_field32(®, GPIO_SWITCH_0, 0); - rt2x00_set_field32(®, GPIO_SWITCH_1, 0); - } - rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); - - rt2800_register_read(rt2x00dev, LED_CFG, ®); - led_g_mode = rt2x00_get_field32(reg, LED_CFG_LED_POLAR) ? 3 : 0; - led_r_mode = rt2x00_get_field32(reg, LED_CFG_LED_POLAR) ? 0 : 3; - if (led_g_mode != rt2x00_get_field32(reg, LED_CFG_G_LED_MODE) || - led_r_mode != rt2x00_get_field32(reg, LED_CFG_R_LED_MODE)) { - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom); - led_ctrl = rt2x00_get_field16(eeprom, EEPROM_FREQ_LED_MODE); - if (led_ctrl == 0 || led_ctrl > 0x40) { - rt2x00_set_field32(®, LED_CFG_G_LED_MODE, led_g_mode); - rt2x00_set_field32(®, LED_CFG_R_LED_MODE, led_r_mode); - rt2800_register_write(rt2x00dev, LED_CFG, reg); - } else { - rt2800_mcu_request(rt2x00dev, MCU_BAND_SELECT, 0xff, - (led_g_mode << 2) | led_r_mode, 1); - } - } -} - -static void rt2800_set_ant_diversity(struct rt2x00_dev *rt2x00dev, - enum antenna ant) -{ - u32 reg; - u8 eesk_pin = (ant == ANTENNA_A) ? 1 : 0; - u8 gpio_bit3 = (ant == ANTENNA_A) ? 0 : 1; - - if (rt2x00_is_pci(rt2x00dev)) { - rt2800_register_read(rt2x00dev, E2PROM_CSR, ®); - rt2x00_set_field32(®, E2PROM_CSR_DATA_CLOCK, eesk_pin); - rt2800_register_write(rt2x00dev, E2PROM_CSR, reg); - } else if (rt2x00_is_usb(rt2x00dev)) - rt2800_mcu_request(rt2x00dev, MCU_ANT_SELECT, 0xff, - eesk_pin, 0); - - rt2800_register_read(rt2x00dev, GPIO_CTRL, ®); - rt2x00_set_field32(®, GPIO_CTRL_DIR3, 0); - rt2x00_set_field32(®, GPIO_CTRL_VAL3, gpio_bit3); - rt2800_register_write(rt2x00dev, GPIO_CTRL, reg); -} - -void rt2800_config_ant(struct rt2x00_dev *rt2x00dev, struct antenna_setup *ant) -{ - u8 r1; - u8 r3; - u16 eeprom; - - rt2800_bbp_read(rt2x00dev, 1, &r1); - rt2800_bbp_read(rt2x00dev, 3, &r3); - - if (rt2x00_rt(rt2x00dev, RT3572) && - test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags)) - rt2800_config_3572bt_ant(rt2x00dev); - - /* - * Configure the TX antenna. - */ - switch (ant->tx_chain_num) { - case 1: - rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 0); - break; - case 2: - if (rt2x00_rt(rt2x00dev, RT3572) && - test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags)) - rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 1); - else - rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 2); - break; - case 3: - rt2x00_set_field8(&r1, BBP1_TX_ANTENNA, 0); - break; - } - - /* - * Configure the RX antenna. - */ - switch (ant->rx_chain_num) { - case 1: - if (rt2x00_rt(rt2x00dev, RT3070) || - rt2x00_rt(rt2x00dev, RT3090) || - rt2x00_rt(rt2x00dev, RT3352) || - rt2x00_rt(rt2x00dev, RT3390)) { - rt2x00_eeprom_read(rt2x00dev, - EEPROM_NIC_CONF1, &eeprom); - if (rt2x00_get_field16(eeprom, - EEPROM_NIC_CONF1_ANT_DIVERSITY)) - rt2800_set_ant_diversity(rt2x00dev, - rt2x00dev->default_ant.rx); - } - rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 0); - break; - case 2: - if (rt2x00_rt(rt2x00dev, RT3572) && - test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags)) { - rt2x00_set_field8(&r3, BBP3_RX_ADC, 1); - rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, - rt2x00dev->curr_band == IEEE80211_BAND_5GHZ); - rt2800_set_ant_diversity(rt2x00dev, ANTENNA_B); - } else { - rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 1); - } - break; - case 3: - rt2x00_set_field8(&r3, BBP3_RX_ANTENNA, 2); - break; - } - - rt2800_bbp_write(rt2x00dev, 3, r3); - rt2800_bbp_write(rt2x00dev, 1, r1); -} -EXPORT_SYMBOL_GPL(rt2800_config_ant); - -static void rt2800_config_lna_gain(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf) -{ - u16 eeprom; - short lna_gain; - - if (libconf->rf.channel <= 14) { - rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom); - lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_BG); - } else if (libconf->rf.channel <= 64) { - rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom); - lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0); - } else if (libconf->rf.channel <= 128) { - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &eeprom); - lna_gain = rt2x00_get_field16(eeprom, EEPROM_RSSI_BG2_LNA_A1); - } else { - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &eeprom); - lna_gain = rt2x00_get_field16(eeprom, EEPROM_RSSI_A2_LNA_A2); - } - - rt2x00dev->lna_gain = lna_gain; -} - -static void rt2800_config_channel_rf2xxx(struct rt2x00_dev *rt2x00dev, - struct ieee80211_conf *conf, - struct rf_channel *rf, - struct channel_info *info) -{ - rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset); - - if (rt2x00dev->default_ant.tx_chain_num == 1) - rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_TX1, 1); - - if (rt2x00dev->default_ant.rx_chain_num == 1) { - rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX1, 1); - rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX2, 1); - } else if (rt2x00dev->default_ant.rx_chain_num == 2) - rt2x00_set_field32(&rf->rf2, RF2_ANTENNA_RX2, 1); - - if (rf->channel > 14) { - /* - * When TX power is below 0, we should increase it by 7 to - * make it a positive value (Minimum value is -7). - * However this means that values between 0 and 7 have - * double meaning, and we should set a 7DBm boost flag. - */ - rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A_7DBM_BOOST, - (info->default_power1 >= 0)); - - if (info->default_power1 < 0) - info->default_power1 += 7; - - rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A, info->default_power1); - - rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A_7DBM_BOOST, - (info->default_power2 >= 0)); - - if (info->default_power2 < 0) - info->default_power2 += 7; - - rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A, info->default_power2); - } else { - rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_G, info->default_power1); - rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_G, info->default_power2); - } - - rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf)); - - rt2800_rf_write(rt2x00dev, 1, rf->rf1); - rt2800_rf_write(rt2x00dev, 2, rf->rf2); - rt2800_rf_write(rt2x00dev, 3, rf->rf3 & ~0x00000004); - rt2800_rf_write(rt2x00dev, 4, rf->rf4); - - udelay(200); - - rt2800_rf_write(rt2x00dev, 1, rf->rf1); - rt2800_rf_write(rt2x00dev, 2, rf->rf2); - rt2800_rf_write(rt2x00dev, 3, rf->rf3 | 0x00000004); - rt2800_rf_write(rt2x00dev, 4, rf->rf4); - - udelay(200); - - rt2800_rf_write(rt2x00dev, 1, rf->rf1); - rt2800_rf_write(rt2x00dev, 2, rf->rf2); - rt2800_rf_write(rt2x00dev, 3, rf->rf3 & ~0x00000004); - rt2800_rf_write(rt2x00dev, 4, rf->rf4); -} - -static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev, - struct ieee80211_conf *conf, - struct rf_channel *rf, - struct channel_info *info) -{ - struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; - u8 rfcsr, calib_tx, calib_rx; - - rt2800_rfcsr_write(rt2x00dev, 2, rf->rf1); - - rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR3_K, rf->rf3); - rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR6_R1, rf->rf2); - rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 12, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, info->default_power1); - rt2800_rfcsr_write(rt2x00dev, 12, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 13, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, info->default_power2); - rt2800_rfcsr_write(rt2x00dev, 13, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0); - rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, - rt2x00dev->default_ant.rx_chain_num <= 1); - rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, - rt2x00dev->default_ant.rx_chain_num <= 2); - rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0); - rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, - rt2x00dev->default_ant.tx_chain_num <= 1); - rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, - rt2x00dev->default_ant.tx_chain_num <= 2); - rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1); - rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); - msleep(1); - rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0); - rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 23, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset); - rt2800_rfcsr_write(rt2x00dev, 23, rfcsr); - - if (rt2x00_rt(rt2x00dev, RT3390)) { - calib_tx = conf_is_ht40(conf) ? 0x68 : 0x4f; - calib_rx = conf_is_ht40(conf) ? 0x6f : 0x4f; - } else { - if (conf_is_ht40(conf)) { - calib_tx = drv_data->calibration_bw40; - calib_rx = drv_data->calibration_bw40; - } else { - calib_tx = drv_data->calibration_bw20; - calib_rx = drv_data->calibration_bw20; - } - } - - rt2800_rfcsr_read(rt2x00dev, 24, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR24_TX_CALIB, calib_tx); - rt2800_rfcsr_write(rt2x00dev, 24, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 31, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR31_RX_CALIB, calib_rx); - rt2800_rfcsr_write(rt2x00dev, 31, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 7, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1); - rt2800_rfcsr_write(rt2x00dev, 7, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 1); - rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); - msleep(1); - rt2x00_set_field8(&rfcsr, RFCSR30_RF_CALIBRATION, 0); - rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); -} - -static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev, - struct ieee80211_conf *conf, - struct rf_channel *rf, - struct channel_info *info) -{ - struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; - u8 rfcsr; - u32 reg; - - if (rf->channel <= 14) { - rt2800_bbp_write(rt2x00dev, 25, drv_data->bbp25); - rt2800_bbp_write(rt2x00dev, 26, drv_data->bbp26); - } else { - rt2800_bbp_write(rt2x00dev, 25, 0x09); - rt2800_bbp_write(rt2x00dev, 26, 0xff); - } - - rt2800_rfcsr_write(rt2x00dev, 2, rf->rf1); - rt2800_rfcsr_write(rt2x00dev, 3, rf->rf3); - - rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR6_R1, rf->rf2); - if (rf->channel <= 14) - rt2x00_set_field8(&rfcsr, RFCSR6_TXDIV, 2); - else - rt2x00_set_field8(&rfcsr, RFCSR6_TXDIV, 1); - rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 5, &rfcsr); - if (rf->channel <= 14) - rt2x00_set_field8(&rfcsr, RFCSR5_R1, 1); - else - rt2x00_set_field8(&rfcsr, RFCSR5_R1, 2); - rt2800_rfcsr_write(rt2x00dev, 5, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 12, &rfcsr); - if (rf->channel <= 14) { - rt2x00_set_field8(&rfcsr, RFCSR12_DR0, 3); - rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, - info->default_power1); - } else { - rt2x00_set_field8(&rfcsr, RFCSR12_DR0, 7); - rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, - (info->default_power1 & 0x3) | - ((info->default_power1 & 0xC) << 1)); - } - rt2800_rfcsr_write(rt2x00dev, 12, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 13, &rfcsr); - if (rf->channel <= 14) { - rt2x00_set_field8(&rfcsr, RFCSR13_DR0, 3); - rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, - info->default_power2); - } else { - rt2x00_set_field8(&rfcsr, RFCSR13_DR0, 7); - rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, - (info->default_power2 & 0x3) | - ((info->default_power2 & 0xC) << 1)); - } - rt2800_rfcsr_write(rt2x00dev, 13, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0); - rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0); - rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 0); - rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 0); - rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0); - rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 0); - if (test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags)) { - if (rf->channel <= 14) { - rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 1); - rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 1); - } - rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 1); - rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 1); - } else { - switch (rt2x00dev->default_ant.tx_chain_num) { - case 1: - rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1); - case 2: - rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 1); - break; - } - - switch (rt2x00dev->default_ant.rx_chain_num) { - case 1: - rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1); - case 2: - rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 1); - break; - } - } - rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 23, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR23_FREQ_OFFSET, rt2x00dev->freq_offset); - rt2800_rfcsr_write(rt2x00dev, 23, rfcsr); - - if (conf_is_ht40(conf)) { - rt2800_rfcsr_write(rt2x00dev, 24, drv_data->calibration_bw40); - rt2800_rfcsr_write(rt2x00dev, 31, drv_data->calibration_bw40); - } else { - rt2800_rfcsr_write(rt2x00dev, 24, drv_data->calibration_bw20); - rt2800_rfcsr_write(rt2x00dev, 31, drv_data->calibration_bw20); - } - - if (rf->channel <= 14) { - rt2800_rfcsr_write(rt2x00dev, 7, 0xd8); - rt2800_rfcsr_write(rt2x00dev, 9, 0xc3); - rt2800_rfcsr_write(rt2x00dev, 10, 0xf1); - rt2800_rfcsr_write(rt2x00dev, 11, 0xb9); - rt2800_rfcsr_write(rt2x00dev, 15, 0x53); - rfcsr = 0x4c; - rt2x00_set_field8(&rfcsr, RFCSR16_TXMIXER_GAIN, - drv_data->txmixer_gain_24g); - rt2800_rfcsr_write(rt2x00dev, 16, rfcsr); - rt2800_rfcsr_write(rt2x00dev, 17, 0x23); - rt2800_rfcsr_write(rt2x00dev, 19, 0x93); - rt2800_rfcsr_write(rt2x00dev, 20, 0xb3); - rt2800_rfcsr_write(rt2x00dev, 25, 0x15); - rt2800_rfcsr_write(rt2x00dev, 26, 0x85); - rt2800_rfcsr_write(rt2x00dev, 27, 0x00); - rt2800_rfcsr_write(rt2x00dev, 29, 0x9b); - } else { - rt2800_rfcsr_read(rt2x00dev, 7, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR7_BIT2, 1); - rt2x00_set_field8(&rfcsr, RFCSR7_BIT3, 0); - rt2x00_set_field8(&rfcsr, RFCSR7_BIT4, 1); - rt2x00_set_field8(&rfcsr, RFCSR7_BITS67, 0); - rt2800_rfcsr_write(rt2x00dev, 7, rfcsr); - rt2800_rfcsr_write(rt2x00dev, 9, 0xc0); - rt2800_rfcsr_write(rt2x00dev, 10, 0xf1); - rt2800_rfcsr_write(rt2x00dev, 11, 0x00); - rt2800_rfcsr_write(rt2x00dev, 15, 0x43); - rfcsr = 0x7a; - rt2x00_set_field8(&rfcsr, RFCSR16_TXMIXER_GAIN, - drv_data->txmixer_gain_5g); - rt2800_rfcsr_write(rt2x00dev, 16, rfcsr); - rt2800_rfcsr_write(rt2x00dev, 17, 0x23); - if (rf->channel <= 64) { - rt2800_rfcsr_write(rt2x00dev, 19, 0xb7); - rt2800_rfcsr_write(rt2x00dev, 20, 0xf6); - rt2800_rfcsr_write(rt2x00dev, 25, 0x3d); - } else if (rf->channel <= 128) { - rt2800_rfcsr_write(rt2x00dev, 19, 0x74); - rt2800_rfcsr_write(rt2x00dev, 20, 0xf4); - rt2800_rfcsr_write(rt2x00dev, 25, 0x01); - } else { - rt2800_rfcsr_write(rt2x00dev, 19, 0x72); - rt2800_rfcsr_write(rt2x00dev, 20, 0xf3); - rt2800_rfcsr_write(rt2x00dev, 25, 0x01); - } - rt2800_rfcsr_write(rt2x00dev, 26, 0x87); - rt2800_rfcsr_write(rt2x00dev, 27, 0x01); - rt2800_rfcsr_write(rt2x00dev, 29, 0x9f); - } - - rt2800_register_read(rt2x00dev, GPIO_CTRL, ®); - rt2x00_set_field32(®, GPIO_CTRL_DIR7, 0); - if (rf->channel <= 14) - rt2x00_set_field32(®, GPIO_CTRL_VAL7, 1); - else - rt2x00_set_field32(®, GPIO_CTRL_VAL7, 0); - rt2800_register_write(rt2x00dev, GPIO_CTRL, reg); - - rt2800_rfcsr_read(rt2x00dev, 7, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1); - rt2800_rfcsr_write(rt2x00dev, 7, rfcsr); -} - -#define POWER_BOUND 0x27 -#define POWER_BOUND_5G 0x2b -#define FREQ_OFFSET_BOUND 0x5f - -static void rt2800_adjust_freq_offset(struct rt2x00_dev *rt2x00dev) -{ - u8 rfcsr; - - rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); - if (rt2x00dev->freq_offset > FREQ_OFFSET_BOUND) - rt2x00_set_field8(&rfcsr, RFCSR17_CODE, FREQ_OFFSET_BOUND); - else - rt2x00_set_field8(&rfcsr, RFCSR17_CODE, rt2x00dev->freq_offset); - rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); -} - -static void rt2800_config_channel_rf3290(struct rt2x00_dev *rt2x00dev, - struct ieee80211_conf *conf, - struct rf_channel *rf, - struct channel_info *info) -{ - u8 rfcsr; - - rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); - rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3); - rt2800_rfcsr_read(rt2x00dev, 11, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR11_R, rf->rf2); - rt2800_rfcsr_write(rt2x00dev, 11, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 49, &rfcsr); - if (info->default_power1 > POWER_BOUND) - rt2x00_set_field8(&rfcsr, RFCSR49_TX, POWER_BOUND); - else - rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1); - rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); - - rt2800_adjust_freq_offset(rt2x00dev); - - if (rf->channel <= 14) { - if (rf->channel == 6) - rt2800_bbp_write(rt2x00dev, 68, 0x0c); - else - rt2800_bbp_write(rt2x00dev, 68, 0x0b); - - if (rf->channel >= 1 && rf->channel <= 6) - rt2800_bbp_write(rt2x00dev, 59, 0x0f); - else if (rf->channel >= 7 && rf->channel <= 11) - rt2800_bbp_write(rt2x00dev, 59, 0x0e); - else if (rf->channel >= 12 && rf->channel <= 14) - rt2800_bbp_write(rt2x00dev, 59, 0x0d); - } -} - -static void rt2800_config_channel_rf3322(struct rt2x00_dev *rt2x00dev, - struct ieee80211_conf *conf, - struct rf_channel *rf, - struct channel_info *info) -{ - u8 rfcsr; - - rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); - rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3); - - rt2800_rfcsr_write(rt2x00dev, 11, 0x42); - rt2800_rfcsr_write(rt2x00dev, 12, 0x1c); - rt2800_rfcsr_write(rt2x00dev, 13, 0x00); - - if (info->default_power1 > POWER_BOUND) - rt2800_rfcsr_write(rt2x00dev, 47, POWER_BOUND); - else - rt2800_rfcsr_write(rt2x00dev, 47, info->default_power1); - - if (info->default_power2 > POWER_BOUND) - rt2800_rfcsr_write(rt2x00dev, 48, POWER_BOUND); - else - rt2800_rfcsr_write(rt2x00dev, 48, info->default_power2); - - rt2800_adjust_freq_offset(rt2x00dev); - - rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 1); - rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 1); - - if ( rt2x00dev->default_ant.tx_chain_num == 2 ) - rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1); - else - rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 0); - - if ( rt2x00dev->default_ant.rx_chain_num == 2 ) - rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1); - else - rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 0); - - rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0); - rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 0); - - rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); - - rt2800_rfcsr_write(rt2x00dev, 31, 80); -} - -static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev, - struct ieee80211_conf *conf, - struct rf_channel *rf, - struct channel_info *info) -{ - u8 rfcsr; - - rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1); - rt2800_rfcsr_write(rt2x00dev, 9, rf->rf3); - rt2800_rfcsr_read(rt2x00dev, 11, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR11_R, rf->rf2); - rt2800_rfcsr_write(rt2x00dev, 11, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 49, &rfcsr); - if (info->default_power1 > POWER_BOUND) - rt2x00_set_field8(&rfcsr, RFCSR49_TX, POWER_BOUND); - else - rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1); - rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); - - if (rt2x00_rt(rt2x00dev, RT5392)) { - rt2800_rfcsr_read(rt2x00dev, 50, &rfcsr); - if (info->default_power1 > POWER_BOUND) - rt2x00_set_field8(&rfcsr, RFCSR50_TX, POWER_BOUND); - else - rt2x00_set_field8(&rfcsr, RFCSR50_TX, - info->default_power2); - rt2800_rfcsr_write(rt2x00dev, 50, rfcsr); - } - - rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr); - if (rt2x00_rt(rt2x00dev, RT5392)) { - rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1); - rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1); - } - rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1); - rt2x00_set_field8(&rfcsr, RFCSR1_PLL_PD, 1); - rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 1); - rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 1); - rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); - - rt2800_adjust_freq_offset(rt2x00dev); - - if (rf->channel <= 14) { - int idx = rf->channel-1; - - if (test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags)) { - if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) { - /* r55/r59 value array of channel 1~14 */ - static const char r55_bt_rev[] = {0x83, 0x83, - 0x83, 0x73, 0x73, 0x63, 0x53, 0x53, - 0x53, 0x43, 0x43, 0x43, 0x43, 0x43}; - static const char r59_bt_rev[] = {0x0e, 0x0e, - 0x0e, 0x0e, 0x0e, 0x0b, 0x0a, 0x09, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07}; - - rt2800_rfcsr_write(rt2x00dev, 55, - r55_bt_rev[idx]); - rt2800_rfcsr_write(rt2x00dev, 59, - r59_bt_rev[idx]); - } else { - static const char r59_bt[] = {0x8b, 0x8b, 0x8b, - 0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x89, - 0x88, 0x88, 0x86, 0x85, 0x84}; - - rt2800_rfcsr_write(rt2x00dev, 59, r59_bt[idx]); - } - } else { - if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) { - static const char r55_nonbt_rev[] = {0x23, 0x23, - 0x23, 0x23, 0x13, 0x13, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}; - static const char r59_nonbt_rev[] = {0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x06, 0x05, 0x04, 0x04}; - - rt2800_rfcsr_write(rt2x00dev, 55, - r55_nonbt_rev[idx]); - rt2800_rfcsr_write(rt2x00dev, 59, - r59_nonbt_rev[idx]); - } else if (rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) { - static const char r59_non_bt[] = {0x8f, 0x8f, - 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8d, - 0x8a, 0x88, 0x88, 0x87, 0x87, 0x86}; - - rt2800_rfcsr_write(rt2x00dev, 59, - r59_non_bt[idx]); - } - } - } -} - -static void rt2800_config_channel_rf55xx(struct rt2x00_dev *rt2x00dev, - struct ieee80211_conf *conf, - struct rf_channel *rf, - struct channel_info *info) -{ - u8 rfcsr, ep_reg; - u32 reg; - int power_bound; - - /* TODO */ - const bool is_11b = false; - const bool is_type_ep = false; - - rt2800_register_read(rt2x00dev, LDO_CFG0, ®); - rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, - (rf->channel > 14 || conf_is_ht40(conf)) ? 5 : 0); - rt2800_register_write(rt2x00dev, LDO_CFG0, reg); - - /* Order of values on rf_channel entry: N, K, mod, R */ - rt2800_rfcsr_write(rt2x00dev, 8, rf->rf1 & 0xff); - - rt2800_rfcsr_read(rt2x00dev, 9, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR9_K, rf->rf2 & 0xf); - rt2x00_set_field8(&rfcsr, RFCSR9_N, (rf->rf1 & 0x100) >> 8); - rt2x00_set_field8(&rfcsr, RFCSR9_MOD, ((rf->rf3 - 8) & 0x4) >> 2); - rt2800_rfcsr_write(rt2x00dev, 9, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 11, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR11_R, rf->rf4 - 1); - rt2x00_set_field8(&rfcsr, RFCSR11_MOD, (rf->rf3 - 8) & 0x3); - rt2800_rfcsr_write(rt2x00dev, 11, rfcsr); - - if (rf->channel <= 14) { - rt2800_rfcsr_write(rt2x00dev, 10, 0x90); - /* FIXME: RF11 owerwrite ? */ - rt2800_rfcsr_write(rt2x00dev, 11, 0x4A); - rt2800_rfcsr_write(rt2x00dev, 12, 0x52); - rt2800_rfcsr_write(rt2x00dev, 13, 0x42); - rt2800_rfcsr_write(rt2x00dev, 22, 0x40); - rt2800_rfcsr_write(rt2x00dev, 24, 0x4A); - rt2800_rfcsr_write(rt2x00dev, 25, 0x80); - rt2800_rfcsr_write(rt2x00dev, 27, 0x42); - rt2800_rfcsr_write(rt2x00dev, 36, 0x80); - rt2800_rfcsr_write(rt2x00dev, 37, 0x08); - rt2800_rfcsr_write(rt2x00dev, 38, 0x89); - rt2800_rfcsr_write(rt2x00dev, 39, 0x1B); - rt2800_rfcsr_write(rt2x00dev, 40, 0x0D); - rt2800_rfcsr_write(rt2x00dev, 41, 0x9B); - rt2800_rfcsr_write(rt2x00dev, 42, 0xD5); - rt2800_rfcsr_write(rt2x00dev, 43, 0x72); - rt2800_rfcsr_write(rt2x00dev, 44, 0x0E); - rt2800_rfcsr_write(rt2x00dev, 45, 0xA2); - rt2800_rfcsr_write(rt2x00dev, 46, 0x6B); - rt2800_rfcsr_write(rt2x00dev, 48, 0x10); - rt2800_rfcsr_write(rt2x00dev, 51, 0x3E); - rt2800_rfcsr_write(rt2x00dev, 52, 0x48); - rt2800_rfcsr_write(rt2x00dev, 54, 0x38); - rt2800_rfcsr_write(rt2x00dev, 56, 0xA1); - rt2800_rfcsr_write(rt2x00dev, 57, 0x00); - rt2800_rfcsr_write(rt2x00dev, 58, 0x39); - rt2800_rfcsr_write(rt2x00dev, 60, 0x45); - rt2800_rfcsr_write(rt2x00dev, 61, 0x91); - rt2800_rfcsr_write(rt2x00dev, 62, 0x39); - - /* TODO RF27 <- tssi */ - - rfcsr = rf->channel <= 10 ? 0x07 : 0x06; - rt2800_rfcsr_write(rt2x00dev, 23, rfcsr); - rt2800_rfcsr_write(rt2x00dev, 59, rfcsr); - - if (is_11b) { - /* CCK */ - rt2800_rfcsr_write(rt2x00dev, 31, 0xF8); - rt2800_rfcsr_write(rt2x00dev, 32, 0xC0); - if (is_type_ep) - rt2800_rfcsr_write(rt2x00dev, 55, 0x06); - else - rt2800_rfcsr_write(rt2x00dev, 55, 0x47); - } else { - /* OFDM */ - if (is_type_ep) - rt2800_rfcsr_write(rt2x00dev, 55, 0x03); - else - rt2800_rfcsr_write(rt2x00dev, 55, 0x43); - } - - power_bound = POWER_BOUND; - ep_reg = 0x2; - } else { - rt2800_rfcsr_write(rt2x00dev, 10, 0x97); - /* FIMXE: RF11 overwrite */ - rt2800_rfcsr_write(rt2x00dev, 11, 0x40); - rt2800_rfcsr_write(rt2x00dev, 25, 0xBF); - rt2800_rfcsr_write(rt2x00dev, 27, 0x42); - rt2800_rfcsr_write(rt2x00dev, 36, 0x00); - rt2800_rfcsr_write(rt2x00dev, 37, 0x04); - rt2800_rfcsr_write(rt2x00dev, 38, 0x85); - rt2800_rfcsr_write(rt2x00dev, 40, 0x42); - rt2800_rfcsr_write(rt2x00dev, 41, 0xBB); - rt2800_rfcsr_write(rt2x00dev, 42, 0xD7); - rt2800_rfcsr_write(rt2x00dev, 45, 0x41); - rt2800_rfcsr_write(rt2x00dev, 48, 0x00); - rt2800_rfcsr_write(rt2x00dev, 57, 0x77); - rt2800_rfcsr_write(rt2x00dev, 60, 0x05); - rt2800_rfcsr_write(rt2x00dev, 61, 0x01); - - /* TODO RF27 <- tssi */ - - if (rf->channel >= 36 && rf->channel <= 64) { - - rt2800_rfcsr_write(rt2x00dev, 12, 0x2E); - rt2800_rfcsr_write(rt2x00dev, 13, 0x22); - rt2800_rfcsr_write(rt2x00dev, 22, 0x60); - rt2800_rfcsr_write(rt2x00dev, 23, 0x7F); - if (rf->channel <= 50) - rt2800_rfcsr_write(rt2x00dev, 24, 0x09); - else if (rf->channel >= 52) - rt2800_rfcsr_write(rt2x00dev, 24, 0x07); - rt2800_rfcsr_write(rt2x00dev, 39, 0x1C); - rt2800_rfcsr_write(rt2x00dev, 43, 0x5B); - rt2800_rfcsr_write(rt2x00dev, 44, 0X40); - rt2800_rfcsr_write(rt2x00dev, 46, 0X00); - rt2800_rfcsr_write(rt2x00dev, 51, 0xFE); - rt2800_rfcsr_write(rt2x00dev, 52, 0x0C); - rt2800_rfcsr_write(rt2x00dev, 54, 0xF8); - if (rf->channel <= 50) { - rt2800_rfcsr_write(rt2x00dev, 55, 0x06), - rt2800_rfcsr_write(rt2x00dev, 56, 0xD3); - } else if (rf->channel >= 52) { - rt2800_rfcsr_write(rt2x00dev, 55, 0x04); - rt2800_rfcsr_write(rt2x00dev, 56, 0xBB); - } - - rt2800_rfcsr_write(rt2x00dev, 58, 0x15); - rt2800_rfcsr_write(rt2x00dev, 59, 0x7F); - rt2800_rfcsr_write(rt2x00dev, 62, 0x15); - - } else if (rf->channel >= 100 && rf->channel <= 165) { - - rt2800_rfcsr_write(rt2x00dev, 12, 0x0E); - rt2800_rfcsr_write(rt2x00dev, 13, 0x42); - rt2800_rfcsr_write(rt2x00dev, 22, 0x40); - if (rf->channel <= 153) { - rt2800_rfcsr_write(rt2x00dev, 23, 0x3C); - rt2800_rfcsr_write(rt2x00dev, 24, 0x06); - } else if (rf->channel >= 155) { - rt2800_rfcsr_write(rt2x00dev, 23, 0x38); - rt2800_rfcsr_write(rt2x00dev, 24, 0x05); - } - if (rf->channel <= 138) { - rt2800_rfcsr_write(rt2x00dev, 39, 0x1A); - rt2800_rfcsr_write(rt2x00dev, 43, 0x3B); - rt2800_rfcsr_write(rt2x00dev, 44, 0x20); - rt2800_rfcsr_write(rt2x00dev, 46, 0x18); - } else if (rf->channel >= 140) { - rt2800_rfcsr_write(rt2x00dev, 39, 0x18); - rt2800_rfcsr_write(rt2x00dev, 43, 0x1B); - rt2800_rfcsr_write(rt2x00dev, 44, 0x10); - rt2800_rfcsr_write(rt2x00dev, 46, 0X08); - } - if (rf->channel <= 124) - rt2800_rfcsr_write(rt2x00dev, 51, 0xFC); - else if (rf->channel >= 126) - rt2800_rfcsr_write(rt2x00dev, 51, 0xEC); - if (rf->channel <= 138) - rt2800_rfcsr_write(rt2x00dev, 52, 0x06); - else if (rf->channel >= 140) - rt2800_rfcsr_write(rt2x00dev, 52, 0x06); - rt2800_rfcsr_write(rt2x00dev, 54, 0xEB); - if (rf->channel <= 138) - rt2800_rfcsr_write(rt2x00dev, 55, 0x01); - else if (rf->channel >= 140) - rt2800_rfcsr_write(rt2x00dev, 55, 0x00); - if (rf->channel <= 128) - rt2800_rfcsr_write(rt2x00dev, 56, 0xBB); - else if (rf->channel >= 130) - rt2800_rfcsr_write(rt2x00dev, 56, 0xAB); - if (rf->channel <= 116) - rt2800_rfcsr_write(rt2x00dev, 58, 0x1D); - else if (rf->channel >= 118) - rt2800_rfcsr_write(rt2x00dev, 58, 0x15); - if (rf->channel <= 138) - rt2800_rfcsr_write(rt2x00dev, 59, 0x3F); - else if (rf->channel >= 140) - rt2800_rfcsr_write(rt2x00dev, 59, 0x7C); - if (rf->channel <= 116) - rt2800_rfcsr_write(rt2x00dev, 62, 0x1D); - else if (rf->channel >= 118) - rt2800_rfcsr_write(rt2x00dev, 62, 0x15); - } - - power_bound = POWER_BOUND_5G; - ep_reg = 0x3; - } - - rt2800_rfcsr_read(rt2x00dev, 49, &rfcsr); - if (info->default_power1 > power_bound) - rt2x00_set_field8(&rfcsr, RFCSR49_TX, power_bound); - else - rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1); - if (is_type_ep) - rt2x00_set_field8(&rfcsr, RFCSR49_EP, ep_reg); - rt2800_rfcsr_write(rt2x00dev, 49, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 50, &rfcsr); - if (info->default_power2 > power_bound) - rt2x00_set_field8(&rfcsr, RFCSR50_TX, power_bound); - else - rt2x00_set_field8(&rfcsr, RFCSR50_TX, info->default_power2); - if (is_type_ep) - rt2x00_set_field8(&rfcsr, RFCSR50_EP, ep_reg); - rt2800_rfcsr_write(rt2x00dev, 50, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1); - rt2x00_set_field8(&rfcsr, RFCSR1_PLL_PD, 1); - - rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, - rt2x00dev->default_ant.tx_chain_num >= 1); - rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, - rt2x00dev->default_ant.tx_chain_num == 2); - rt2x00_set_field8(&rfcsr, RFCSR1_TX2_PD, 0); - - rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, - rt2x00dev->default_ant.rx_chain_num >= 1); - rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, - rt2x00dev->default_ant.rx_chain_num == 2); - rt2x00_set_field8(&rfcsr, RFCSR1_RX2_PD, 0); - - rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); - rt2800_rfcsr_write(rt2x00dev, 6, 0xe4); - - if (conf_is_ht40(conf)) - rt2800_rfcsr_write(rt2x00dev, 30, 0x16); - else - rt2800_rfcsr_write(rt2x00dev, 30, 0x10); - - if (!is_11b) { - rt2800_rfcsr_write(rt2x00dev, 31, 0x80); - rt2800_rfcsr_write(rt2x00dev, 32, 0x80); - } - - /* TODO proper frequency adjustment */ - rt2800_adjust_freq_offset(rt2x00dev); - - /* TODO merge with others */ - rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1); - rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); - - /* BBP settings */ - rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); - - rt2800_bbp_write(rt2x00dev, 79, (rf->channel <= 14) ? 0x1C : 0x18); - rt2800_bbp_write(rt2x00dev, 80, (rf->channel <= 14) ? 0x0E : 0x08); - rt2800_bbp_write(rt2x00dev, 81, (rf->channel <= 14) ? 0x3A : 0x38); - rt2800_bbp_write(rt2x00dev, 82, (rf->channel <= 14) ? 0x62 : 0x92); - - /* GLRT band configuration */ - rt2800_bbp_write(rt2x00dev, 195, 128); - rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0xE0 : 0xF0); - rt2800_bbp_write(rt2x00dev, 195, 129); - rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x1F : 0x1E); - rt2800_bbp_write(rt2x00dev, 195, 130); - rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x38 : 0x28); - rt2800_bbp_write(rt2x00dev, 195, 131); - rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x32 : 0x20); - rt2800_bbp_write(rt2x00dev, 195, 133); - rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x28 : 0x7F); - rt2800_bbp_write(rt2x00dev, 195, 124); - rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F); -} - -static void rt2800_bbp_write_with_rx_chain(struct rt2x00_dev *rt2x00dev, - const unsigned int word, - const u8 value) -{ - u8 chain, reg; - - for (chain = 0; chain < rt2x00dev->default_ant.rx_chain_num; chain++) { - rt2800_bbp_read(rt2x00dev, 27, ®); - rt2x00_set_field8(®, BBP27_RX_CHAIN_SEL, chain); - rt2800_bbp_write(rt2x00dev, 27, reg); - - rt2800_bbp_write(rt2x00dev, word, value); - } -} - -static void rt2800_iq_calibrate(struct rt2x00_dev *rt2x00dev, int channel) -{ - u8 cal; - - /* TX0 IQ Gain */ - rt2800_bbp_write(rt2x00dev, 158, 0x2c); - if (channel <= 14) - cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_GAIN_CAL_TX0_2G); - else if (channel >= 36 && channel <= 64) - cal = rt2x00_eeprom_byte(rt2x00dev, - EEPROM_IQ_GAIN_CAL_TX0_CH36_TO_CH64_5G); - else if (channel >= 100 && channel <= 138) - cal = rt2x00_eeprom_byte(rt2x00dev, - EEPROM_IQ_GAIN_CAL_TX0_CH100_TO_CH138_5G); - else if (channel >= 140 && channel <= 165) - cal = rt2x00_eeprom_byte(rt2x00dev, - EEPROM_IQ_GAIN_CAL_TX0_CH140_TO_CH165_5G); - else - cal = 0; - rt2800_bbp_write(rt2x00dev, 159, cal); - - /* TX0 IQ Phase */ - rt2800_bbp_write(rt2x00dev, 158, 0x2d); - if (channel <= 14) - cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_PHASE_CAL_TX0_2G); - else if (channel >= 36 && channel <= 64) - cal = rt2x00_eeprom_byte(rt2x00dev, - EEPROM_IQ_PHASE_CAL_TX0_CH36_TO_CH64_5G); - else if (channel >= 100 && channel <= 138) - cal = rt2x00_eeprom_byte(rt2x00dev, - EEPROM_IQ_PHASE_CAL_TX0_CH100_TO_CH138_5G); - else if (channel >= 140 && channel <= 165) - cal = rt2x00_eeprom_byte(rt2x00dev, - EEPROM_IQ_PHASE_CAL_TX0_CH140_TO_CH165_5G); - else - cal = 0; - rt2800_bbp_write(rt2x00dev, 159, cal); - - /* TX1 IQ Gain */ - rt2800_bbp_write(rt2x00dev, 158, 0x4a); - if (channel <= 14) - cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_GAIN_CAL_TX1_2G); - else if (channel >= 36 && channel <= 64) - cal = rt2x00_eeprom_byte(rt2x00dev, - EEPROM_IQ_GAIN_CAL_TX1_CH36_TO_CH64_5G); - else if (channel >= 100 && channel <= 138) - cal = rt2x00_eeprom_byte(rt2x00dev, - EEPROM_IQ_GAIN_CAL_TX1_CH100_TO_CH138_5G); - else if (channel >= 140 && channel <= 165) - cal = rt2x00_eeprom_byte(rt2x00dev, - EEPROM_IQ_GAIN_CAL_TX1_CH140_TO_CH165_5G); - else - cal = 0; - rt2800_bbp_write(rt2x00dev, 159, cal); - - /* TX1 IQ Phase */ - rt2800_bbp_write(rt2x00dev, 158, 0x4b); - if (channel <= 14) - cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_IQ_PHASE_CAL_TX1_2G); - else if (channel >= 36 && channel <= 64) - cal = rt2x00_eeprom_byte(rt2x00dev, - EEPROM_IQ_PHASE_CAL_TX1_CH36_TO_CH64_5G); - else if (channel >= 100 && channel <= 138) - cal = rt2x00_eeprom_byte(rt2x00dev, - EEPROM_IQ_PHASE_CAL_TX1_CH100_TO_CH138_5G); - else if (channel >= 140 && channel <= 165) - cal = rt2x00_eeprom_byte(rt2x00dev, - EEPROM_IQ_PHASE_CAL_TX1_CH140_TO_CH165_5G); - else - cal = 0; - rt2800_bbp_write(rt2x00dev, 159, cal); - - /* FIXME: possible RX0, RX1 callibration ? */ - - /* RF IQ compensation control */ - rt2800_bbp_write(rt2x00dev, 158, 0x04); - cal = rt2x00_eeprom_byte(rt2x00dev, EEPROM_RF_IQ_COMPENSATION_CONTROL); - rt2800_bbp_write(rt2x00dev, 159, cal != 0xff ? cal : 0); - - /* RF IQ imbalance compensation control */ - rt2800_bbp_write(rt2x00dev, 158, 0x03); - cal = rt2x00_eeprom_byte(rt2x00dev, - EEPROM_RF_IQ_IMBALANCE_COMPENSATION_CONTROL); - rt2800_bbp_write(rt2x00dev, 159, cal != 0xff ? cal : 0); -} - -static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, - struct ieee80211_conf *conf, - struct rf_channel *rf, - struct channel_info *info) -{ - u32 reg; - unsigned int tx_pin; - u8 bbp, rfcsr; - - if (rf->channel <= 14) { - info->default_power1 = TXPOWER_G_TO_DEV(info->default_power1); - info->default_power2 = TXPOWER_G_TO_DEV(info->default_power2); - } else { - info->default_power1 = TXPOWER_A_TO_DEV(info->default_power1); - info->default_power2 = TXPOWER_A_TO_DEV(info->default_power2); - } - - switch (rt2x00dev->chip.rf) { - case RF2020: - case RF3020: - case RF3021: - case RF3022: - case RF3320: - rt2800_config_channel_rf3xxx(rt2x00dev, conf, rf, info); - break; - case RF3052: - rt2800_config_channel_rf3052(rt2x00dev, conf, rf, info); - break; - case RF3290: - rt2800_config_channel_rf3290(rt2x00dev, conf, rf, info); - break; - case RF3322: - rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info); - break; - case RF5360: - case RF5370: - case RF5372: - case RF5390: - case RF5392: - rt2800_config_channel_rf53xx(rt2x00dev, conf, rf, info); - break; - case RF5592: - rt2800_config_channel_rf55xx(rt2x00dev, conf, rf, info); - break; - default: - rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info); - } - - if (rt2x00_rf(rt2x00dev, RF3290) || - rt2x00_rf(rt2x00dev, RF3322) || - rt2x00_rf(rt2x00dev, RF5360) || - rt2x00_rf(rt2x00dev, RF5370) || - rt2x00_rf(rt2x00dev, RF5372) || - rt2x00_rf(rt2x00dev, RF5390) || - rt2x00_rf(rt2x00dev, RF5392)) { - rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR30_TX_H20M, 0); - rt2x00_set_field8(&rfcsr, RFCSR30_RX_H20M, 0); - rt2800_rfcsr_write(rt2x00dev, 30, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1); - rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); - } - - /* - * Change BBP settings - */ - if (rt2x00_rt(rt2x00dev, RT3352)) { - rt2800_bbp_write(rt2x00dev, 27, 0x0); - rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 27, 0x20); - rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain); - } else { - rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 86, 0); - } - - if (rf->channel <= 14) { - if (!rt2x00_rt(rt2x00dev, RT5390) && - !rt2x00_rt(rt2x00dev, RT5392)) { - if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, - &rt2x00dev->cap_flags)) { - rt2800_bbp_write(rt2x00dev, 82, 0x62); - rt2800_bbp_write(rt2x00dev, 75, 0x46); - } else { - rt2800_bbp_write(rt2x00dev, 82, 0x84); - rt2800_bbp_write(rt2x00dev, 75, 0x50); - } - } - } else { - if (rt2x00_rt(rt2x00dev, RT3572)) - rt2800_bbp_write(rt2x00dev, 82, 0x94); - else - rt2800_bbp_write(rt2x00dev, 82, 0xf2); - - if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags)) - rt2800_bbp_write(rt2x00dev, 75, 0x46); - else - rt2800_bbp_write(rt2x00dev, 75, 0x50); - } - - rt2800_register_read(rt2x00dev, TX_BAND_CFG, ®); - rt2x00_set_field32(®, TX_BAND_CFG_HT40_MINUS, conf_is_ht40_minus(conf)); - rt2x00_set_field32(®, TX_BAND_CFG_A, rf->channel > 14); - rt2x00_set_field32(®, TX_BAND_CFG_BG, rf->channel <= 14); - rt2800_register_write(rt2x00dev, TX_BAND_CFG, reg); - - if (rt2x00_rt(rt2x00dev, RT3572)) - rt2800_rfcsr_write(rt2x00dev, 8, 0); - - tx_pin = 0; - - /* Turn on unused PA or LNA when not using 1T or 1R */ - if (rt2x00dev->default_ant.tx_chain_num == 2) { - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN, - rf->channel > 14); - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, - rf->channel <= 14); - } - - /* Turn on unused PA or LNA when not using 1T or 1R */ - if (rt2x00dev->default_ant.rx_chain_num == 2) { - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A1_EN, 1); - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G1_EN, 1); - } - - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_A0_EN, 1); - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_LNA_PE_G0_EN, 1); - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1); - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1); - if (test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags)) - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1); - else - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, - rf->channel <= 14); - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, rf->channel > 14); - - rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); - - if (rt2x00_rt(rt2x00dev, RT3572)) - rt2800_rfcsr_write(rt2x00dev, 8, 0x80); - - if (rt2x00_rt(rt2x00dev, RT5592)) { - rt2800_bbp_write(rt2x00dev, 195, 141); - rt2800_bbp_write(rt2x00dev, 196, conf_is_ht40(conf) ? 0x10 : 0x1a); - - /* AGC init */ - reg = (rf->channel <= 14 ? 0x1c : 0x24) + 2 * rt2x00dev->lna_gain; - rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); - - rt2800_iq_calibrate(rt2x00dev, rf->channel); - } - - rt2800_bbp_read(rt2x00dev, 4, &bbp); - rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * conf_is_ht40(conf)); - rt2800_bbp_write(rt2x00dev, 4, bbp); - - rt2800_bbp_read(rt2x00dev, 3, &bbp); - rt2x00_set_field8(&bbp, BBP3_HT40_MINUS, conf_is_ht40_minus(conf)); - rt2800_bbp_write(rt2x00dev, 3, bbp); - - if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C)) { - if (conf_is_ht40(conf)) { - rt2800_bbp_write(rt2x00dev, 69, 0x1a); - rt2800_bbp_write(rt2x00dev, 70, 0x0a); - rt2800_bbp_write(rt2x00dev, 73, 0x16); - } else { - rt2800_bbp_write(rt2x00dev, 69, 0x16); - rt2800_bbp_write(rt2x00dev, 70, 0x08); - rt2800_bbp_write(rt2x00dev, 73, 0x11); - } - } - - msleep(1); - - /* - * Clear channel statistic counters - */ - rt2800_register_read(rt2x00dev, CH_IDLE_STA, ®); - rt2800_register_read(rt2x00dev, CH_BUSY_STA, ®); - rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC, ®); - - /* - * Clear update flag - */ - if (rt2x00_rt(rt2x00dev, RT3352)) { - rt2800_bbp_read(rt2x00dev, 49, &bbp); - rt2x00_set_field8(&bbp, BBP49_UPDATE_FLAG, 0); - rt2800_bbp_write(rt2x00dev, 49, bbp); - } -} - -static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev) -{ - u8 tssi_bounds[9]; - u8 current_tssi; - u16 eeprom; - u8 step; - int i; - - /* - * First check if temperature compensation is supported. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); - if (!rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_TX_ALC)) - return 0; - - /* - * Read TSSI boundaries for temperature compensation from - * the EEPROM. - * - * Array idx 0 1 2 3 4 5 6 7 8 - * Matching Delta value -4 -3 -2 -1 0 +1 +2 +3 +4 - * Example TSSI bounds 0xF0 0xD0 0xB5 0xA0 0x88 0x45 0x25 0x15 0x00 - */ - if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) { - rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG1, &eeprom); - tssi_bounds[0] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_BG1_MINUS4); - tssi_bounds[1] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_BG1_MINUS3); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG2, &eeprom); - tssi_bounds[2] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_BG2_MINUS2); - tssi_bounds[3] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_BG2_MINUS1); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG3, &eeprom); - tssi_bounds[4] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_BG3_REF); - tssi_bounds[5] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_BG3_PLUS1); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG4, &eeprom); - tssi_bounds[6] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_BG4_PLUS2); - tssi_bounds[7] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_BG4_PLUS3); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_BG5, &eeprom); - tssi_bounds[8] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_BG5_PLUS4); - - step = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_BG5_AGC_STEP); - } else { - rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A1, &eeprom); - tssi_bounds[0] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_A1_MINUS4); - tssi_bounds[1] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_A1_MINUS3); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A2, &eeprom); - tssi_bounds[2] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_A2_MINUS2); - tssi_bounds[3] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_A2_MINUS1); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A3, &eeprom); - tssi_bounds[4] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_A3_REF); - tssi_bounds[5] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_A3_PLUS1); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A4, &eeprom); - tssi_bounds[6] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_A4_PLUS2); - tssi_bounds[7] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_A4_PLUS3); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_TSSI_BOUND_A5, &eeprom); - tssi_bounds[8] = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_A5_PLUS4); - - step = rt2x00_get_field16(eeprom, - EEPROM_TSSI_BOUND_A5_AGC_STEP); - } - - /* - * Check if temperature compensation is supported. - */ - if (tssi_bounds[4] == 0xff || step == 0xff) - return 0; - - /* - * Read current TSSI (BBP 49). - */ - rt2800_bbp_read(rt2x00dev, 49, ¤t_tssi); - - /* - * Compare TSSI value (BBP49) with the compensation boundaries - * from the EEPROM and increase or decrease tx power. - */ - for (i = 0; i <= 3; i++) { - if (current_tssi > tssi_bounds[i]) - break; - } - - if (i == 4) { - for (i = 8; i >= 5; i--) { - if (current_tssi < tssi_bounds[i]) - break; - } - } - - return (i - 4) * step; -} - -static int rt2800_get_txpower_bw_comp(struct rt2x00_dev *rt2x00dev, - enum ieee80211_band band) -{ - u16 eeprom; - u8 comp_en; - u8 comp_type; - int comp_value = 0; - - rt2x00_eeprom_read(rt2x00dev, EEPROM_TXPOWER_DELTA, &eeprom); - - /* - * HT40 compensation not required. - */ - if (eeprom == 0xffff || - !test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) - return 0; - - if (band == IEEE80211_BAND_2GHZ) { - comp_en = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_DELTA_ENABLE_2G); - if (comp_en) { - comp_type = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_DELTA_TYPE_2G); - comp_value = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_DELTA_VALUE_2G); - if (!comp_type) - comp_value = -comp_value; - } - } else { - comp_en = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_DELTA_ENABLE_5G); - if (comp_en) { - comp_type = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_DELTA_TYPE_5G); - comp_value = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_DELTA_VALUE_5G); - if (!comp_type) - comp_value = -comp_value; - } - } - - return comp_value; -} - -static int rt2800_get_txpower_reg_delta(struct rt2x00_dev *rt2x00dev, - int power_level, int max_power) -{ - int delta; - - if (test_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags)) - return 0; - - /* - * XXX: We don't know the maximum transmit power of our hardware since - * the EEPROM doesn't expose it. We only know that we are calibrated - * to 100% tx power. - * - * Hence, we assume the regulatory limit that cfg80211 calulated for - * the current channel is our maximum and if we are requested to lower - * the value we just reduce our tx power accordingly. - */ - delta = power_level - max_power; - return min(delta, 0); -} - -static u8 rt2800_compensate_txpower(struct rt2x00_dev *rt2x00dev, int is_rate_b, - enum ieee80211_band band, int power_level, - u8 txpower, int delta) -{ - u16 eeprom; - u8 criterion; - u8 eirp_txpower; - u8 eirp_txpower_criterion; - u8 reg_limit; - - if (test_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags)) { - /* - * Check if eirp txpower exceed txpower_limit. - * We use OFDM 6M as criterion and its eirp txpower - * is stored at EEPROM_EIRP_MAX_TX_POWER. - * .11b data rate need add additional 4dbm - * when calculating eirp txpower. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_TXPOWER_BYRATE + 1, - &eeprom); - criterion = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_BYRATE_RATE0); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_EIRP_MAX_TX_POWER, - &eeprom); - - if (band == IEEE80211_BAND_2GHZ) - eirp_txpower_criterion = rt2x00_get_field16(eeprom, - EEPROM_EIRP_MAX_TX_POWER_2GHZ); - else - eirp_txpower_criterion = rt2x00_get_field16(eeprom, - EEPROM_EIRP_MAX_TX_POWER_5GHZ); - - eirp_txpower = eirp_txpower_criterion + (txpower - criterion) + - (is_rate_b ? 4 : 0) + delta; - - reg_limit = (eirp_txpower > power_level) ? - (eirp_txpower - power_level) : 0; - } else - reg_limit = 0; - - txpower = max(0, txpower + delta - reg_limit); - return min_t(u8, txpower, 0xc); -} - -/* - * We configure transmit power using MAC TX_PWR_CFG_{0,...,N} registers and - * BBP R1 register. TX_PWR_CFG_X allow to configure per rate TX power values, - * 4 bits for each rate (tune from 0 to 15 dBm). BBP_R1 controls transmit power - * for all rates, but allow to set only 4 discrete values: -12, -6, 0 and 6 dBm. - * Reference per rate transmit power values are located in the EEPROM at - * EEPROM_TXPOWER_BYRATE offset. We adjust them and BBP R1 settings according to - * current conditions (i.e. band, bandwidth, temperature, user settings). - */ -static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, - struct ieee80211_channel *chan, - int power_level) -{ - u8 txpower, r1; - u16 eeprom; - u32 reg, offset; - int i, is_rate_b, delta, power_ctrl; - enum ieee80211_band band = chan->band; - - /* - * Calculate HT40 compensation. For 40MHz we need to add or subtract - * value read from EEPROM (different for 2GHz and for 5GHz). - */ - delta = rt2800_get_txpower_bw_comp(rt2x00dev, band); - - /* - * Calculate temperature compensation. Depends on measurement of current - * TSSI (Transmitter Signal Strength Indication) we know TX power (due - * to temperature or maybe other factors) is smaller or bigger than - * expected. We adjust it, based on TSSI reference and boundaries values - * provided in EEPROM. - */ - delta += rt2800_get_gain_calibration_delta(rt2x00dev); - - /* - * Decrease power according to user settings, on devices with unknown - * maximum tx power. For other devices we take user power_level into - * consideration on rt2800_compensate_txpower(). - */ - delta += rt2800_get_txpower_reg_delta(rt2x00dev, power_level, - chan->max_power); - - /* - * BBP_R1 controls TX power for all rates, it allow to set the following - * gains -12, -6, 0, +6 dBm by setting values 2, 1, 0, 3 respectively. - * - * TODO: we do not use +6 dBm option to do not increase power beyond - * regulatory limit, however this could be utilized for devices with - * CAPABILITY_POWER_LIMIT. - * - * TODO: add different temperature compensation code for RT3290 & RT5390 - * to allow to use BBP_R1 for those chips. - */ - if (!rt2x00_rt(rt2x00dev, RT3290) && - !rt2x00_rt(rt2x00dev, RT5390)) { - rt2800_bbp_read(rt2x00dev, 1, &r1); - if (delta <= -12) { - power_ctrl = 2; - delta += 12; - } else if (delta <= -6) { - power_ctrl = 1; - delta += 6; - } else { - power_ctrl = 0; - } - rt2x00_set_field8(&r1, BBP1_TX_POWER_CTRL, power_ctrl); - rt2800_bbp_write(rt2x00dev, 1, r1); - } - - offset = TX_PWR_CFG_0; - - for (i = 0; i < EEPROM_TXPOWER_BYRATE_SIZE; i += 2) { - /* just to be safe */ - if (offset > TX_PWR_CFG_4) - break; - - rt2800_register_read(rt2x00dev, offset, ®); - - /* read the next four txpower values */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_TXPOWER_BYRATE + i, - &eeprom); - - is_rate_b = i ? 0 : 1; - /* - * TX_PWR_CFG_0: 1MBS, TX_PWR_CFG_1: 24MBS, - * TX_PWR_CFG_2: MCS4, TX_PWR_CFG_3: MCS12, - * TX_PWR_CFG_4: unknown - */ - txpower = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_BYRATE_RATE0); - txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, - power_level, txpower, delta); - rt2x00_set_field32(®, TX_PWR_CFG_RATE0, txpower); - - /* - * TX_PWR_CFG_0: 2MBS, TX_PWR_CFG_1: 36MBS, - * TX_PWR_CFG_2: MCS5, TX_PWR_CFG_3: MCS13, - * TX_PWR_CFG_4: unknown - */ - txpower = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_BYRATE_RATE1); - txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, - power_level, txpower, delta); - rt2x00_set_field32(®, TX_PWR_CFG_RATE1, txpower); - - /* - * TX_PWR_CFG_0: 5.5MBS, TX_PWR_CFG_1: 48MBS, - * TX_PWR_CFG_2: MCS6, TX_PWR_CFG_3: MCS14, - * TX_PWR_CFG_4: unknown - */ - txpower = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_BYRATE_RATE2); - txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, - power_level, txpower, delta); - rt2x00_set_field32(®, TX_PWR_CFG_RATE2, txpower); - - /* - * TX_PWR_CFG_0: 11MBS, TX_PWR_CFG_1: 54MBS, - * TX_PWR_CFG_2: MCS7, TX_PWR_CFG_3: MCS15, - * TX_PWR_CFG_4: unknown - */ - txpower = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_BYRATE_RATE3); - txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, - power_level, txpower, delta); - rt2x00_set_field32(®, TX_PWR_CFG_RATE3, txpower); - - /* read the next four txpower values */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_TXPOWER_BYRATE + i + 1, - &eeprom); - - is_rate_b = 0; - /* - * TX_PWR_CFG_0: 6MBS, TX_PWR_CFG_1: MCS0, - * TX_PWR_CFG_2: MCS8, TX_PWR_CFG_3: unknown, - * TX_PWR_CFG_4: unknown - */ - txpower = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_BYRATE_RATE0); - txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, - power_level, txpower, delta); - rt2x00_set_field32(®, TX_PWR_CFG_RATE4, txpower); - - /* - * TX_PWR_CFG_0: 9MBS, TX_PWR_CFG_1: MCS1, - * TX_PWR_CFG_2: MCS9, TX_PWR_CFG_3: unknown, - * TX_PWR_CFG_4: unknown - */ - txpower = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_BYRATE_RATE1); - txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, - power_level, txpower, delta); - rt2x00_set_field32(®, TX_PWR_CFG_RATE5, txpower); - - /* - * TX_PWR_CFG_0: 12MBS, TX_PWR_CFG_1: MCS2, - * TX_PWR_CFG_2: MCS10, TX_PWR_CFG_3: unknown, - * TX_PWR_CFG_4: unknown - */ - txpower = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_BYRATE_RATE2); - txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, - power_level, txpower, delta); - rt2x00_set_field32(®, TX_PWR_CFG_RATE6, txpower); - - /* - * TX_PWR_CFG_0: 18MBS, TX_PWR_CFG_1: MCS3, - * TX_PWR_CFG_2: MCS11, TX_PWR_CFG_3: unknown, - * TX_PWR_CFG_4: unknown - */ - txpower = rt2x00_get_field16(eeprom, - EEPROM_TXPOWER_BYRATE_RATE3); - txpower = rt2800_compensate_txpower(rt2x00dev, is_rate_b, band, - power_level, txpower, delta); - rt2x00_set_field32(®, TX_PWR_CFG_RATE7, txpower); - - rt2800_register_write(rt2x00dev, offset, reg); - - /* next TX_PWR_CFG register */ - offset += 4; - } -} - -void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev) -{ - rt2800_config_txpower(rt2x00dev, rt2x00dev->hw->conf.chandef.chan, - rt2x00dev->tx_power); -} -EXPORT_SYMBOL_GPL(rt2800_gain_calibration); - -void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev) -{ - u32 tx_pin; - u8 rfcsr; - - /* - * A voltage-controlled oscillator(VCO) is an electronic oscillator - * designed to be controlled in oscillation frequency by a voltage - * input. Maybe the temperature will affect the frequency of - * oscillation to be shifted. The VCO calibration will be called - * periodically to adjust the frequency to be precision. - */ - - rt2800_register_read(rt2x00dev, TX_PIN_CFG, &tx_pin); - tx_pin &= TX_PIN_CFG_PA_PE_DISABLE; - rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); - - switch (rt2x00dev->chip.rf) { - case RF2020: - case RF3020: - case RF3021: - case RF3022: - case RF3320: - case RF3052: - rt2800_rfcsr_read(rt2x00dev, 7, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR7_RF_TUNING, 1); - rt2800_rfcsr_write(rt2x00dev, 7, rfcsr); - break; - case RF3290: - case RF5360: - case RF5370: - case RF5372: - case RF5390: - case RF5392: - rt2800_rfcsr_read(rt2x00dev, 3, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1); - rt2800_rfcsr_write(rt2x00dev, 3, rfcsr); - break; - default: - return; - } - - mdelay(1); - - rt2800_register_read(rt2x00dev, TX_PIN_CFG, &tx_pin); - if (rt2x00dev->rf_channel <= 14) { - switch (rt2x00dev->default_ant.tx_chain_num) { - case 3: - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G2_EN, 1); - /* fall through */ - case 2: - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G1_EN, 1); - /* fall through */ - case 1: - default: - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_G0_EN, 1); - break; - } - } else { - switch (rt2x00dev->default_ant.tx_chain_num) { - case 3: - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A2_EN, 1); - /* fall through */ - case 2: - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A1_EN, 1); - /* fall through */ - case 1: - default: - rt2x00_set_field32(&tx_pin, TX_PIN_CFG_PA_PE_A0_EN, 1); - break; - } - } - rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin); - -} -EXPORT_SYMBOL_GPL(rt2800_vco_calibration); - -static void rt2800_config_retry_limit(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf) -{ - u32 reg; - - rt2800_register_read(rt2x00dev, TX_RTY_CFG, ®); - rt2x00_set_field32(®, TX_RTY_CFG_SHORT_RTY_LIMIT, - libconf->conf->short_frame_max_tx_count); - rt2x00_set_field32(®, TX_RTY_CFG_LONG_RTY_LIMIT, - libconf->conf->long_frame_max_tx_count); - rt2800_register_write(rt2x00dev, TX_RTY_CFG, reg); -} - -static void rt2800_config_ps(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf) -{ - enum dev_state state = - (libconf->conf->flags & IEEE80211_CONF_PS) ? - STATE_SLEEP : STATE_AWAKE; - u32 reg; - - if (state == STATE_SLEEP) { - rt2800_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0); - - rt2800_register_read(rt2x00dev, AUTOWAKEUP_CFG, ®); - rt2x00_set_field32(®, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 5); - rt2x00_set_field32(®, AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE, - libconf->conf->listen_interval - 1); - rt2x00_set_field32(®, AUTOWAKEUP_CFG_AUTOWAKE, 1); - rt2800_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg); - - rt2x00dev->ops->lib->set_device_state(rt2x00dev, state); - } else { - rt2800_register_read(rt2x00dev, AUTOWAKEUP_CFG, ®); - rt2x00_set_field32(®, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 0); - rt2x00_set_field32(®, AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE, 0); - rt2x00_set_field32(®, AUTOWAKEUP_CFG_AUTOWAKE, 0); - rt2800_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg); - - rt2x00dev->ops->lib->set_device_state(rt2x00dev, state); - } -} - -void rt2800_config(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf, - const unsigned int flags) -{ - /* Always recalculate LNA gain before changing configuration */ - rt2800_config_lna_gain(rt2x00dev, libconf); - - if (flags & IEEE80211_CONF_CHANGE_CHANNEL) { - rt2800_config_channel(rt2x00dev, libconf->conf, - &libconf->rf, &libconf->channel); - rt2800_config_txpower(rt2x00dev, libconf->conf->chandef.chan, - libconf->conf->power_level); - } - if (flags & IEEE80211_CONF_CHANGE_POWER) - rt2800_config_txpower(rt2x00dev, libconf->conf->chandef.chan, - libconf->conf->power_level); - if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS) - rt2800_config_retry_limit(rt2x00dev, libconf); - if (flags & IEEE80211_CONF_CHANGE_PS) - rt2800_config_ps(rt2x00dev, libconf); -} -EXPORT_SYMBOL_GPL(rt2800_config); - -/* - * Link tuning - */ -void rt2800_link_stats(struct rt2x00_dev *rt2x00dev, struct link_qual *qual) -{ - u32 reg; - - /* - * Update FCS error count from register. - */ - rt2800_register_read(rt2x00dev, RX_STA_CNT0, ®); - qual->rx_failed = rt2x00_get_field32(reg, RX_STA_CNT0_CRC_ERR); -} -EXPORT_SYMBOL_GPL(rt2800_link_stats); - -static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev) -{ - u8 vgc; - - if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) { - if (rt2x00_rt(rt2x00dev, RT3070) || - rt2x00_rt(rt2x00dev, RT3071) || - rt2x00_rt(rt2x00dev, RT3090) || - rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT3390) || - rt2x00_rt(rt2x00dev, RT3572) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392) || - rt2x00_rt(rt2x00dev, RT5592)) - vgc = 0x1c + (2 * rt2x00dev->lna_gain); - else - vgc = 0x2e + rt2x00dev->lna_gain; - } else { /* 5GHZ band */ - if (rt2x00_rt(rt2x00dev, RT3572)) - vgc = 0x22 + (rt2x00dev->lna_gain * 5) / 3; - else if (rt2x00_rt(rt2x00dev, RT5592)) - vgc = 0x24 + (2 * rt2x00dev->lna_gain); - else { - if (!test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) - vgc = 0x32 + (rt2x00dev->lna_gain * 5) / 3; - else - vgc = 0x3a + (rt2x00dev->lna_gain * 5) / 3; - } - } - - return vgc; -} - -static inline void rt2800_set_vgc(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual, u8 vgc_level) -{ - if (qual->vgc_level != vgc_level) { - if (rt2x00_rt(rt2x00dev, RT5592)) { - rt2800_bbp_write(rt2x00dev, 83, qual->rssi > -65 ? 0x4a : 0x7a); - rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, vgc_level); - } else - rt2800_bbp_write(rt2x00dev, 66, vgc_level); - qual->vgc_level = vgc_level; - qual->vgc_level_reg = vgc_level; - } -} - -void rt2800_reset_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual) -{ - rt2800_set_vgc(rt2x00dev, qual, rt2800_get_default_vgc(rt2x00dev)); -} -EXPORT_SYMBOL_GPL(rt2800_reset_tuner); - -void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual, - const u32 count) -{ - u8 vgc; - - if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C)) - return; - /* - * When RSSI is better then -80 increase VGC level with 0x10, except - * for rt5592 chip. - */ - - vgc = rt2800_get_default_vgc(rt2x00dev); - - if (rt2x00_rt(rt2x00dev, RT5592)) { - if (qual->rssi > -65) - vgc += 0x20; - } else { - if (qual->rssi > -80) - vgc += 0x10; - } - - rt2800_set_vgc(rt2x00dev, qual, vgc); -} -EXPORT_SYMBOL_GPL(rt2800_link_tuner); - -/* - * Initialization functions. - */ -static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - u16 eeprom; - unsigned int i; - int ret; - - rt2800_disable_wpdma(rt2x00dev); - - ret = rt2800_drv_init_registers(rt2x00dev); - if (ret) - return ret; - - rt2800_register_read(rt2x00dev, BCN_OFFSET0, ®); - rt2x00_set_field32(®, BCN_OFFSET0_BCN0, 0xe0); /* 0x3800 */ - rt2x00_set_field32(®, BCN_OFFSET0_BCN1, 0xe8); /* 0x3a00 */ - rt2x00_set_field32(®, BCN_OFFSET0_BCN2, 0xf0); /* 0x3c00 */ - rt2x00_set_field32(®, BCN_OFFSET0_BCN3, 0xf8); /* 0x3e00 */ - rt2800_register_write(rt2x00dev, BCN_OFFSET0, reg); - - rt2800_register_read(rt2x00dev, BCN_OFFSET1, ®); - rt2x00_set_field32(®, BCN_OFFSET1_BCN4, 0xc8); /* 0x3200 */ - rt2x00_set_field32(®, BCN_OFFSET1_BCN5, 0xd0); /* 0x3400 */ - rt2x00_set_field32(®, BCN_OFFSET1_BCN6, 0x77); /* 0x1dc0 */ - rt2x00_set_field32(®, BCN_OFFSET1_BCN7, 0x6f); /* 0x1bc0 */ - rt2800_register_write(rt2x00dev, BCN_OFFSET1, reg); - - rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f); - rt2800_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003); - - rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000); - - rt2800_register_read(rt2x00dev, BCN_TIME_CFG, ®); - rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_INTERVAL, 1600); - rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 0); - rt2x00_set_field32(®, BCN_TIME_CFG_TSF_SYNC, 0); - rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 0); - rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0); - rt2x00_set_field32(®, BCN_TIME_CFG_TX_TIME_COMPENSATE, 0); - rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg); - - rt2800_config_filter(rt2x00dev, FIF_ALLMULTI); - - rt2800_register_read(rt2x00dev, BKOFF_SLOT_CFG, ®); - rt2x00_set_field32(®, BKOFF_SLOT_CFG_SLOT_TIME, 9); - rt2x00_set_field32(®, BKOFF_SLOT_CFG_CC_DELAY_TIME, 2); - rt2800_register_write(rt2x00dev, BKOFF_SLOT_CFG, reg); - - if (rt2x00_rt(rt2x00dev, RT3290)) { - rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, ®); - if (rt2x00_get_field32(reg, WLAN_EN) == 1) { - rt2x00_set_field32(®, PCIE_APP0_CLK_REQ, 1); - rt2800_register_write(rt2x00dev, WLAN_FUN_CTRL, reg); - } - - rt2800_register_read(rt2x00dev, CMB_CTRL, ®); - if (!(rt2x00_get_field32(reg, LDO0_EN) == 1)) { - rt2x00_set_field32(®, LDO0_EN, 1); - rt2x00_set_field32(®, LDO_BGSEL, 3); - rt2800_register_write(rt2x00dev, CMB_CTRL, reg); - } - - rt2800_register_read(rt2x00dev, OSC_CTRL, ®); - rt2x00_set_field32(®, OSC_ROSC_EN, 1); - rt2x00_set_field32(®, OSC_CAL_REQ, 1); - rt2x00_set_field32(®, OSC_REF_CYCLE, 0x27); - rt2800_register_write(rt2x00dev, OSC_CTRL, reg); - - rt2800_register_read(rt2x00dev, COEX_CFG0, ®); - rt2x00_set_field32(®, COEX_CFG_ANT, 0x5e); - rt2800_register_write(rt2x00dev, COEX_CFG0, reg); - - rt2800_register_read(rt2x00dev, COEX_CFG2, ®); - rt2x00_set_field32(®, BT_COEX_CFG1, 0x00); - rt2x00_set_field32(®, BT_COEX_CFG0, 0x17); - rt2x00_set_field32(®, WL_COEX_CFG1, 0x93); - rt2x00_set_field32(®, WL_COEX_CFG0, 0x7f); - rt2800_register_write(rt2x00dev, COEX_CFG2, reg); - - rt2800_register_read(rt2x00dev, PLL_CTRL, ®); - rt2x00_set_field32(®, PLL_CONTROL, 1); - rt2800_register_write(rt2x00dev, PLL_CTRL, reg); - } - - if (rt2x00_rt(rt2x00dev, RT3071) || - rt2x00_rt(rt2x00dev, RT3090) || - rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT3390)) { - - if (rt2x00_rt(rt2x00dev, RT3290)) - rt2800_register_write(rt2x00dev, TX_SW_CFG0, - 0x00000404); - else - rt2800_register_write(rt2x00dev, TX_SW_CFG0, - 0x00000400); - - rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); - if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || - rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || - rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) { - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_DAC_TEST)) - rt2800_register_write(rt2x00dev, TX_SW_CFG2, - 0x0000002c); - else - rt2800_register_write(rt2x00dev, TX_SW_CFG2, - 0x0000000f); - } else { - rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); - } - } else if (rt2x00_rt(rt2x00dev, RT3070)) { - rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); - - if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) { - rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); - rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x0000002c); - } else { - rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); - rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); - } - } else if (rt2800_is_305x_soc(rt2x00dev)) { - rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); - rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00000000); - rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000030); - } else if (rt2x00_rt(rt2x00dev, RT3352)) { - rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000402); - rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); - rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); - } else if (rt2x00_rt(rt2x00dev, RT3572)) { - rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000400); - rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); - } else if (rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392) || - rt2x00_rt(rt2x00dev, RT5592)) { - rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); - rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); - rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); - } else { - rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000); - rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); - } - - rt2800_register_read(rt2x00dev, TX_LINK_CFG, ®); - rt2x00_set_field32(®, TX_LINK_CFG_REMOTE_MFB_LIFETIME, 32); - rt2x00_set_field32(®, TX_LINK_CFG_MFB_ENABLE, 0); - rt2x00_set_field32(®, TX_LINK_CFG_REMOTE_UMFS_ENABLE, 0); - rt2x00_set_field32(®, TX_LINK_CFG_TX_MRQ_EN, 0); - rt2x00_set_field32(®, TX_LINK_CFG_TX_RDG_EN, 0); - rt2x00_set_field32(®, TX_LINK_CFG_TX_CF_ACK_EN, 1); - rt2x00_set_field32(®, TX_LINK_CFG_REMOTE_MFB, 0); - rt2x00_set_field32(®, TX_LINK_CFG_REMOTE_MFS, 0); - rt2800_register_write(rt2x00dev, TX_LINK_CFG, reg); - - rt2800_register_read(rt2x00dev, TX_TIMEOUT_CFG, ®); - rt2x00_set_field32(®, TX_TIMEOUT_CFG_MPDU_LIFETIME, 9); - rt2x00_set_field32(®, TX_TIMEOUT_CFG_RX_ACK_TIMEOUT, 32); - rt2x00_set_field32(®, TX_TIMEOUT_CFG_TX_OP_TIMEOUT, 10); - rt2800_register_write(rt2x00dev, TX_TIMEOUT_CFG, reg); - - rt2800_register_read(rt2x00dev, MAX_LEN_CFG, ®); - rt2x00_set_field32(®, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE); - if (rt2x00_rt_rev_gte(rt2x00dev, RT2872, REV_RT2872E) || - rt2x00_rt(rt2x00dev, RT2883) || - rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070E)) - rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 2); - else - rt2x00_set_field32(®, MAX_LEN_CFG_MAX_PSDU, 1); - rt2x00_set_field32(®, MAX_LEN_CFG_MIN_PSDU, 0); - rt2x00_set_field32(®, MAX_LEN_CFG_MIN_MPDU, 0); - rt2800_register_write(rt2x00dev, MAX_LEN_CFG, reg); - - rt2800_register_read(rt2x00dev, LED_CFG, ®); - rt2x00_set_field32(®, LED_CFG_ON_PERIOD, 70); - rt2x00_set_field32(®, LED_CFG_OFF_PERIOD, 30); - rt2x00_set_field32(®, LED_CFG_SLOW_BLINK_PERIOD, 3); - rt2x00_set_field32(®, LED_CFG_R_LED_MODE, 3); - rt2x00_set_field32(®, LED_CFG_G_LED_MODE, 3); - rt2x00_set_field32(®, LED_CFG_Y_LED_MODE, 3); - rt2x00_set_field32(®, LED_CFG_LED_POLAR, 1); - rt2800_register_write(rt2x00dev, LED_CFG, reg); - - rt2800_register_write(rt2x00dev, PBF_MAX_PCNT, 0x1f3fbf9f); - - rt2800_register_read(rt2x00dev, TX_RTY_CFG, ®); - rt2x00_set_field32(®, TX_RTY_CFG_SHORT_RTY_LIMIT, 15); - rt2x00_set_field32(®, TX_RTY_CFG_LONG_RTY_LIMIT, 31); - rt2x00_set_field32(®, TX_RTY_CFG_LONG_RTY_THRE, 2000); - rt2x00_set_field32(®, TX_RTY_CFG_NON_AGG_RTY_MODE, 0); - rt2x00_set_field32(®, TX_RTY_CFG_AGG_RTY_MODE, 0); - rt2x00_set_field32(®, TX_RTY_CFG_TX_AUTO_FB_ENABLE, 1); - rt2800_register_write(rt2x00dev, TX_RTY_CFG, reg); - - rt2800_register_read(rt2x00dev, AUTO_RSP_CFG, ®); - rt2x00_set_field32(®, AUTO_RSP_CFG_AUTORESPONDER, 1); - rt2x00_set_field32(®, AUTO_RSP_CFG_BAC_ACK_POLICY, 1); - rt2x00_set_field32(®, AUTO_RSP_CFG_CTS_40_MMODE, 0); - rt2x00_set_field32(®, AUTO_RSP_CFG_CTS_40_MREF, 0); - rt2x00_set_field32(®, AUTO_RSP_CFG_AR_PREAMBLE, 1); - rt2x00_set_field32(®, AUTO_RSP_CFG_DUAL_CTS_EN, 0); - rt2x00_set_field32(®, AUTO_RSP_CFG_ACK_CTS_PSM_BIT, 0); - rt2800_register_write(rt2x00dev, AUTO_RSP_CFG, reg); - - rt2800_register_read(rt2x00dev, CCK_PROT_CFG, ®); - rt2x00_set_field32(®, CCK_PROT_CFG_PROTECT_RATE, 3); - rt2x00_set_field32(®, CCK_PROT_CFG_PROTECT_CTRL, 0); - rt2x00_set_field32(®, CCK_PROT_CFG_PROTECT_NAV_SHORT, 1); - rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_CCK, 1); - rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_OFDM, 1); - rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_MM20, 1); - rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_MM40, 0); - rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_GF20, 1); - rt2x00_set_field32(®, CCK_PROT_CFG_TX_OP_ALLOW_GF40, 0); - rt2x00_set_field32(®, CCK_PROT_CFG_RTS_TH_EN, 1); - rt2800_register_write(rt2x00dev, CCK_PROT_CFG, reg); - - rt2800_register_read(rt2x00dev, OFDM_PROT_CFG, ®); - rt2x00_set_field32(®, OFDM_PROT_CFG_PROTECT_RATE, 3); - rt2x00_set_field32(®, OFDM_PROT_CFG_PROTECT_CTRL, 0); - rt2x00_set_field32(®, OFDM_PROT_CFG_PROTECT_NAV_SHORT, 1); - rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_CCK, 1); - rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_OFDM, 1); - rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_MM20, 1); - rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_MM40, 0); - rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_GF20, 1); - rt2x00_set_field32(®, OFDM_PROT_CFG_TX_OP_ALLOW_GF40, 0); - rt2x00_set_field32(®, OFDM_PROT_CFG_RTS_TH_EN, 1); - rt2800_register_write(rt2x00dev, OFDM_PROT_CFG, reg); - - rt2800_register_read(rt2x00dev, MM20_PROT_CFG, ®); - rt2x00_set_field32(®, MM20_PROT_CFG_PROTECT_RATE, 0x4004); - rt2x00_set_field32(®, MM20_PROT_CFG_PROTECT_CTRL, 0); - rt2x00_set_field32(®, MM20_PROT_CFG_PROTECT_NAV_SHORT, 1); - rt2x00_set_field32(®, MM20_PROT_CFG_TX_OP_ALLOW_CCK, 1); - rt2x00_set_field32(®, MM20_PROT_CFG_TX_OP_ALLOW_OFDM, 1); - rt2x00_set_field32(®, MM20_PROT_CFG_TX_OP_ALLOW_MM20, 1); - rt2x00_set_field32(®, MM20_PROT_CFG_TX_OP_ALLOW_MM40, 0); - rt2x00_set_field32(®, MM20_PROT_CFG_TX_OP_ALLOW_GF20, 1); - rt2x00_set_field32(®, MM20_PROT_CFG_TX_OP_ALLOW_GF40, 0); - rt2x00_set_field32(®, MM20_PROT_CFG_RTS_TH_EN, 0); - rt2800_register_write(rt2x00dev, MM20_PROT_CFG, reg); - - rt2800_register_read(rt2x00dev, MM40_PROT_CFG, ®); - rt2x00_set_field32(®, MM40_PROT_CFG_PROTECT_RATE, 0x4084); - rt2x00_set_field32(®, MM40_PROT_CFG_PROTECT_CTRL, 0); - rt2x00_set_field32(®, MM40_PROT_CFG_PROTECT_NAV_SHORT, 1); - rt2x00_set_field32(®, MM40_PROT_CFG_TX_OP_ALLOW_CCK, 1); - rt2x00_set_field32(®, MM40_PROT_CFG_TX_OP_ALLOW_OFDM, 1); - rt2x00_set_field32(®, MM40_PROT_CFG_TX_OP_ALLOW_MM20, 1); - rt2x00_set_field32(®, MM40_PROT_CFG_TX_OP_ALLOW_MM40, 1); - rt2x00_set_field32(®, MM40_PROT_CFG_TX_OP_ALLOW_GF20, 1); - rt2x00_set_field32(®, MM40_PROT_CFG_TX_OP_ALLOW_GF40, 1); - rt2x00_set_field32(®, MM40_PROT_CFG_RTS_TH_EN, 0); - rt2800_register_write(rt2x00dev, MM40_PROT_CFG, reg); - - rt2800_register_read(rt2x00dev, GF20_PROT_CFG, ®); - rt2x00_set_field32(®, GF20_PROT_CFG_PROTECT_RATE, 0x4004); - rt2x00_set_field32(®, GF20_PROT_CFG_PROTECT_CTRL, 0); - rt2x00_set_field32(®, GF20_PROT_CFG_PROTECT_NAV_SHORT, 1); - rt2x00_set_field32(®, GF20_PROT_CFG_TX_OP_ALLOW_CCK, 1); - rt2x00_set_field32(®, GF20_PROT_CFG_TX_OP_ALLOW_OFDM, 1); - rt2x00_set_field32(®, GF20_PROT_CFG_TX_OP_ALLOW_MM20, 1); - rt2x00_set_field32(®, GF20_PROT_CFG_TX_OP_ALLOW_MM40, 0); - rt2x00_set_field32(®, GF20_PROT_CFG_TX_OP_ALLOW_GF20, 1); - rt2x00_set_field32(®, GF20_PROT_CFG_TX_OP_ALLOW_GF40, 0); - rt2x00_set_field32(®, GF20_PROT_CFG_RTS_TH_EN, 0); - rt2800_register_write(rt2x00dev, GF20_PROT_CFG, reg); - - rt2800_register_read(rt2x00dev, GF40_PROT_CFG, ®); - rt2x00_set_field32(®, GF40_PROT_CFG_PROTECT_RATE, 0x4084); - rt2x00_set_field32(®, GF40_PROT_CFG_PROTECT_CTRL, 0); - rt2x00_set_field32(®, GF40_PROT_CFG_PROTECT_NAV_SHORT, 1); - rt2x00_set_field32(®, GF40_PROT_CFG_TX_OP_ALLOW_CCK, 1); - rt2x00_set_field32(®, GF40_PROT_CFG_TX_OP_ALLOW_OFDM, 1); - rt2x00_set_field32(®, GF40_PROT_CFG_TX_OP_ALLOW_MM20, 1); - rt2x00_set_field32(®, GF40_PROT_CFG_TX_OP_ALLOW_MM40, 1); - rt2x00_set_field32(®, GF40_PROT_CFG_TX_OP_ALLOW_GF20, 1); - rt2x00_set_field32(®, GF40_PROT_CFG_TX_OP_ALLOW_GF40, 1); - rt2x00_set_field32(®, GF40_PROT_CFG_RTS_TH_EN, 0); - rt2800_register_write(rt2x00dev, GF40_PROT_CFG, reg); - - if (rt2x00_is_usb(rt2x00dev)) { - rt2800_register_write(rt2x00dev, PBF_CFG, 0xf40006); - - rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); - rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0); - rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_DMA_BUSY, 0); - rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0); - rt2x00_set_field32(®, WPDMA_GLO_CFG_RX_DMA_BUSY, 0); - rt2x00_set_field32(®, WPDMA_GLO_CFG_WP_DMA_BURST_SIZE, 3); - rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 0); - rt2x00_set_field32(®, WPDMA_GLO_CFG_BIG_ENDIAN, 0); - rt2x00_set_field32(®, WPDMA_GLO_CFG_RX_HDR_SCATTER, 0); - rt2x00_set_field32(®, WPDMA_GLO_CFG_HDR_SEG_LEN, 0); - rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); - } - - /* - * The legacy driver also sets TXOP_CTRL_CFG_RESERVED_TRUN_EN to 1 - * although it is reserved. - */ - rt2800_register_read(rt2x00dev, TXOP_CTRL_CFG, ®); - rt2x00_set_field32(®, TXOP_CTRL_CFG_TIMEOUT_TRUN_EN, 1); - rt2x00_set_field32(®, TXOP_CTRL_CFG_AC_TRUN_EN, 1); - rt2x00_set_field32(®, TXOP_CTRL_CFG_TXRATEGRP_TRUN_EN, 1); - rt2x00_set_field32(®, TXOP_CTRL_CFG_USER_MODE_TRUN_EN, 1); - rt2x00_set_field32(®, TXOP_CTRL_CFG_MIMO_PS_TRUN_EN, 1); - rt2x00_set_field32(®, TXOP_CTRL_CFG_RESERVED_TRUN_EN, 1); - rt2x00_set_field32(®, TXOP_CTRL_CFG_LSIG_TXOP_EN, 0); - rt2x00_set_field32(®, TXOP_CTRL_CFG_EXT_CCA_EN, 0); - rt2x00_set_field32(®, TXOP_CTRL_CFG_EXT_CCA_DLY, 88); - rt2x00_set_field32(®, TXOP_CTRL_CFG_EXT_CWMIN, 0); - rt2800_register_write(rt2x00dev, TXOP_CTRL_CFG, reg); - - reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002; - rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg); - - rt2800_register_read(rt2x00dev, TX_RTS_CFG, ®); - rt2x00_set_field32(®, TX_RTS_CFG_AUTO_RTS_RETRY_LIMIT, 32); - rt2x00_set_field32(®, TX_RTS_CFG_RTS_THRES, - IEEE80211_MAX_RTS_THRESHOLD); - rt2x00_set_field32(®, TX_RTS_CFG_RTS_FBK_EN, 0); - rt2800_register_write(rt2x00dev, TX_RTS_CFG, reg); - - rt2800_register_write(rt2x00dev, EXP_ACK_TIME, 0x002400ca); - - /* - * Usually the CCK SIFS time should be set to 10 and the OFDM SIFS - * time should be set to 16. However, the original Ralink driver uses - * 16 for both and indeed using a value of 10 for CCK SIFS results in - * connection problems with 11g + CTS protection. Hence, use the same - * defaults as the Ralink driver: 16 for both, CCK and OFDM SIFS. - */ - rt2800_register_read(rt2x00dev, XIFS_TIME_CFG, ®); - rt2x00_set_field32(®, XIFS_TIME_CFG_CCKM_SIFS_TIME, 16); - rt2x00_set_field32(®, XIFS_TIME_CFG_OFDM_SIFS_TIME, 16); - rt2x00_set_field32(®, XIFS_TIME_CFG_OFDM_XIFS_TIME, 4); - rt2x00_set_field32(®, XIFS_TIME_CFG_EIFS, 314); - rt2x00_set_field32(®, XIFS_TIME_CFG_BB_RXEND_ENABLE, 1); - rt2800_register_write(rt2x00dev, XIFS_TIME_CFG, reg); - - rt2800_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); - - /* - * ASIC will keep garbage value after boot, clear encryption keys. - */ - for (i = 0; i < 4; i++) - rt2800_register_write(rt2x00dev, - SHARED_KEY_MODE_ENTRY(i), 0); - - for (i = 0; i < 256; i++) { - rt2800_config_wcid(rt2x00dev, NULL, i); - rt2800_delete_wcid_attr(rt2x00dev, i); - rt2800_register_write(rt2x00dev, MAC_IVEIV_ENTRY(i), 0); - } - - /* - * Clear all beacons - */ - rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE0); - rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE1); - rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE2); - rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE3); - rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE4); - rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE5); - rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE6); - rt2800_clear_beacon_register(rt2x00dev, HW_BEACON_BASE7); - - if (rt2x00_is_usb(rt2x00dev)) { - rt2800_register_read(rt2x00dev, US_CYC_CNT, ®); - rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, 30); - rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); - } else if (rt2x00_is_pcie(rt2x00dev)) { - rt2800_register_read(rt2x00dev, US_CYC_CNT, ®); - rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, 125); - rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); - } - - rt2800_register_read(rt2x00dev, HT_FBK_CFG0, ®); - rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS0FBK, 0); - rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS1FBK, 0); - rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS2FBK, 1); - rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS3FBK, 2); - rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS4FBK, 3); - rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS5FBK, 4); - rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS6FBK, 5); - rt2x00_set_field32(®, HT_FBK_CFG0_HTMCS7FBK, 6); - rt2800_register_write(rt2x00dev, HT_FBK_CFG0, reg); - - rt2800_register_read(rt2x00dev, HT_FBK_CFG1, ®); - rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS8FBK, 8); - rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS9FBK, 8); - rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS10FBK, 9); - rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS11FBK, 10); - rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS12FBK, 11); - rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS13FBK, 12); - rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS14FBK, 13); - rt2x00_set_field32(®, HT_FBK_CFG1_HTMCS15FBK, 14); - rt2800_register_write(rt2x00dev, HT_FBK_CFG1, reg); - - rt2800_register_read(rt2x00dev, LG_FBK_CFG0, ®); - rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS0FBK, 8); - rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS1FBK, 8); - rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS2FBK, 9); - rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS3FBK, 10); - rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS4FBK, 11); - rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS5FBK, 12); - rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS6FBK, 13); - rt2x00_set_field32(®, LG_FBK_CFG0_OFDMMCS7FBK, 14); - rt2800_register_write(rt2x00dev, LG_FBK_CFG0, reg); - - rt2800_register_read(rt2x00dev, LG_FBK_CFG1, ®); - rt2x00_set_field32(®, LG_FBK_CFG0_CCKMCS0FBK, 0); - rt2x00_set_field32(®, LG_FBK_CFG0_CCKMCS1FBK, 0); - rt2x00_set_field32(®, LG_FBK_CFG0_CCKMCS2FBK, 1); - rt2x00_set_field32(®, LG_FBK_CFG0_CCKMCS3FBK, 2); - rt2800_register_write(rt2x00dev, LG_FBK_CFG1, reg); - - /* - * Do not force the BA window size, we use the TXWI to set it - */ - rt2800_register_read(rt2x00dev, AMPDU_BA_WINSIZE, ®); - rt2x00_set_field32(®, AMPDU_BA_WINSIZE_FORCE_WINSIZE_ENABLE, 0); - rt2x00_set_field32(®, AMPDU_BA_WINSIZE_FORCE_WINSIZE, 0); - rt2800_register_write(rt2x00dev, AMPDU_BA_WINSIZE, reg); - - /* - * We must clear the error counters. - * These registers are cleared on read, - * so we may pass a useless variable to store the value. - */ - rt2800_register_read(rt2x00dev, RX_STA_CNT0, ®); - rt2800_register_read(rt2x00dev, RX_STA_CNT1, ®); - rt2800_register_read(rt2x00dev, RX_STA_CNT2, ®); - rt2800_register_read(rt2x00dev, TX_STA_CNT0, ®); - rt2800_register_read(rt2x00dev, TX_STA_CNT1, ®); - rt2800_register_read(rt2x00dev, TX_STA_CNT2, ®); - - /* - * Setup leadtime for pre tbtt interrupt to 6ms - */ - rt2800_register_read(rt2x00dev, INT_TIMER_CFG, ®); - rt2x00_set_field32(®, INT_TIMER_CFG_PRE_TBTT_TIMER, 6 << 4); - rt2800_register_write(rt2x00dev, INT_TIMER_CFG, reg); - - /* - * Set up channel statistics timer - */ - rt2800_register_read(rt2x00dev, CH_TIME_CFG, ®); - rt2x00_set_field32(®, CH_TIME_CFG_EIFS_BUSY, 1); - rt2x00_set_field32(®, CH_TIME_CFG_NAV_BUSY, 1); - rt2x00_set_field32(®, CH_TIME_CFG_RX_BUSY, 1); - rt2x00_set_field32(®, CH_TIME_CFG_TX_BUSY, 1); - rt2x00_set_field32(®, CH_TIME_CFG_TMR_EN, 1); - rt2800_register_write(rt2x00dev, CH_TIME_CFG, reg); - - return 0; -} - -static int rt2800_wait_bbp_rf_ready(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u32 reg; - - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2800_register_read(rt2x00dev, MAC_STATUS_CFG, ®); - if (!rt2x00_get_field32(reg, MAC_STATUS_CFG_BBP_RF_BUSY)) - return 0; - - udelay(REGISTER_BUSY_DELAY); - } - - rt2x00_err(rt2x00dev, "BBP/RF register access failed, aborting\n"); - return -EACCES; -} - -static int rt2800_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u8 value; - - /* - * BBP was enabled after firmware was loaded, - * but we need to reactivate it now. - */ - rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); - rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); - msleep(1); - - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2800_bbp_read(rt2x00dev, 0, &value); - if ((value != 0xff) && (value != 0x00)) - return 0; - udelay(REGISTER_BUSY_DELAY); - } - - rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n"); - return -EACCES; -} - -static void rt2800_bbp4_mac_if_ctrl(struct rt2x00_dev *rt2x00dev) -{ - u8 value; - - rt2800_bbp_read(rt2x00dev, 4, &value); - rt2x00_set_field8(&value, BBP4_MAC_IF_CTRL, 1); - rt2800_bbp_write(rt2x00dev, 4, value); -} - -static void rt2800_init_freq_calibration(struct rt2x00_dev *rt2x00dev) -{ - rt2800_bbp_write(rt2x00dev, 142, 1); - rt2800_bbp_write(rt2x00dev, 143, 57); -} - -static void rt2800_init_bbp_5592_glrt(struct rt2x00_dev *rt2x00dev) -{ - const u8 glrt_table[] = { - 0xE0, 0x1F, 0X38, 0x32, 0x08, 0x28, 0x19, 0x0A, 0xFF, 0x00, /* 128 ~ 137 */ - 0x16, 0x10, 0x10, 0x0B, 0x36, 0x2C, 0x26, 0x24, 0x42, 0x36, /* 138 ~ 147 */ - 0x30, 0x2D, 0x4C, 0x46, 0x3D, 0x40, 0x3E, 0x42, 0x3D, 0x40, /* 148 ~ 157 */ - 0X3C, 0x34, 0x2C, 0x2F, 0x3C, 0x35, 0x2E, 0x2A, 0x49, 0x41, /* 158 ~ 167 */ - 0x36, 0x31, 0x30, 0x30, 0x0E, 0x0D, 0x28, 0x21, 0x1C, 0x16, /* 168 ~ 177 */ - 0x50, 0x4A, 0x43, 0x40, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, /* 178 ~ 187 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 188 ~ 197 */ - 0x00, 0x00, 0x7D, 0x14, 0x32, 0x2C, 0x36, 0x4C, 0x43, 0x2C, /* 198 ~ 207 */ - 0x2E, 0x36, 0x30, 0x6E, /* 208 ~ 211 */ - }; - int i; - - for (i = 0; i < ARRAY_SIZE(glrt_table); i++) { - rt2800_bbp_write(rt2x00dev, 195, 128 + i); - rt2800_bbp_write(rt2x00dev, 196, glrt_table[i]); - } -}; - -static void rt2800_init_bbp_early(struct rt2x00_dev *rt2x00dev) -{ - rt2800_bbp_write(rt2x00dev, 65, 0x2C); - rt2800_bbp_write(rt2x00dev, 66, 0x38); - rt2800_bbp_write(rt2x00dev, 68, 0x0B); - rt2800_bbp_write(rt2x00dev, 69, 0x12); - rt2800_bbp_write(rt2x00dev, 70, 0x0a); - rt2800_bbp_write(rt2x00dev, 73, 0x10); - rt2800_bbp_write(rt2x00dev, 81, 0x37); - rt2800_bbp_write(rt2x00dev, 82, 0x62); - rt2800_bbp_write(rt2x00dev, 83, 0x6A); - rt2800_bbp_write(rt2x00dev, 84, 0x99); - rt2800_bbp_write(rt2x00dev, 86, 0x00); - rt2800_bbp_write(rt2x00dev, 91, 0x04); - rt2800_bbp_write(rt2x00dev, 92, 0x00); - rt2800_bbp_write(rt2x00dev, 103, 0x00); - rt2800_bbp_write(rt2x00dev, 105, 0x05); - rt2800_bbp_write(rt2x00dev, 106, 0x35); -} - -static void rt2800_init_bbp_5592(struct rt2x00_dev *rt2x00dev) -{ - int ant, div_mode; - u16 eeprom; - u8 value; - - rt2800_init_bbp_early(rt2x00dev); - - rt2800_bbp_read(rt2x00dev, 105, &value); - rt2x00_set_field8(&value, BBP105_MLD, - rt2x00dev->default_ant.rx_chain_num == 2); - rt2800_bbp_write(rt2x00dev, 105, value); - - rt2800_bbp4_mac_if_ctrl(rt2x00dev); - - rt2800_bbp_write(rt2x00dev, 20, 0x06); - rt2800_bbp_write(rt2x00dev, 31, 0x08); - rt2800_bbp_write(rt2x00dev, 65, 0x2C); - rt2800_bbp_write(rt2x00dev, 68, 0xDD); - rt2800_bbp_write(rt2x00dev, 69, 0x1A); - rt2800_bbp_write(rt2x00dev, 70, 0x05); - rt2800_bbp_write(rt2x00dev, 73, 0x13); - rt2800_bbp_write(rt2x00dev, 74, 0x0F); - rt2800_bbp_write(rt2x00dev, 75, 0x4F); - rt2800_bbp_write(rt2x00dev, 76, 0x28); - rt2800_bbp_write(rt2x00dev, 77, 0x59); - rt2800_bbp_write(rt2x00dev, 84, 0x9A); - rt2800_bbp_write(rt2x00dev, 86, 0x38); - rt2800_bbp_write(rt2x00dev, 88, 0x90); - rt2800_bbp_write(rt2x00dev, 91, 0x04); - rt2800_bbp_write(rt2x00dev, 92, 0x02); - rt2800_bbp_write(rt2x00dev, 95, 0x9a); - rt2800_bbp_write(rt2x00dev, 98, 0x12); - rt2800_bbp_write(rt2x00dev, 103, 0xC0); - rt2800_bbp_write(rt2x00dev, 104, 0x92); - /* FIXME BBP105 owerwrite */ - rt2800_bbp_write(rt2x00dev, 105, 0x3C); - rt2800_bbp_write(rt2x00dev, 106, 0x35); - rt2800_bbp_write(rt2x00dev, 128, 0x12); - rt2800_bbp_write(rt2x00dev, 134, 0xD0); - rt2800_bbp_write(rt2x00dev, 135, 0xF6); - rt2800_bbp_write(rt2x00dev, 137, 0x0F); - - /* Initialize GLRT (Generalized Likehood Radio Test) */ - rt2800_init_bbp_5592_glrt(rt2x00dev); - - rt2800_bbp4_mac_if_ctrl(rt2x00dev); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); - div_mode = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_ANT_DIVERSITY); - ant = (div_mode == 3) ? 1 : 0; - rt2800_bbp_read(rt2x00dev, 152, &value); - if (ant == 0) { - /* Main antenna */ - rt2x00_set_field8(&value, BBP152_RX_DEFAULT_ANT, 1); - } else { - /* Auxiliary antenna */ - rt2x00_set_field8(&value, BBP152_RX_DEFAULT_ANT, 0); - } - rt2800_bbp_write(rt2x00dev, 152, value); - - if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C)) { - rt2800_bbp_read(rt2x00dev, 254, &value); - rt2x00_set_field8(&value, BBP254_BIT7, 1); - rt2800_bbp_write(rt2x00dev, 254, value); - } - - rt2800_init_freq_calibration(rt2x00dev); - - rt2800_bbp_write(rt2x00dev, 84, 0x19); - if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C)) - rt2800_bbp_write(rt2x00dev, 103, 0xc0); -} - -static int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u16 eeprom; - u8 reg_id; - u8 value; - - if (rt2x00_rt(rt2x00dev, RT5592)) { - rt2800_init_bbp_5592(rt2x00dev); - return 0; - } - - if (rt2x00_rt(rt2x00dev, RT3352)) { - rt2800_bbp_write(rt2x00dev, 3, 0x00); - rt2800_bbp_write(rt2x00dev, 4, 0x50); - } - - if (rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) - rt2800_bbp4_mac_if_ctrl(rt2x00dev); - - if (rt2800_is_305x_soc(rt2x00dev) || - rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT3352) || - rt2x00_rt(rt2x00dev, RT3572) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) - rt2800_bbp_write(rt2x00dev, 31, 0x08); - - if (rt2x00_rt(rt2x00dev, RT3352)) - rt2800_bbp_write(rt2x00dev, 47, 0x48); - - rt2800_bbp_write(rt2x00dev, 65, 0x2c); - rt2800_bbp_write(rt2x00dev, 66, 0x38); - - if (rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT3352) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) - rt2800_bbp_write(rt2x00dev, 68, 0x0b); - - if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860C)) { - rt2800_bbp_write(rt2x00dev, 69, 0x16); - rt2800_bbp_write(rt2x00dev, 73, 0x12); - } else if (rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT3352) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) { - rt2800_bbp_write(rt2x00dev, 69, 0x12); - rt2800_bbp_write(rt2x00dev, 73, 0x13); - rt2800_bbp_write(rt2x00dev, 75, 0x46); - rt2800_bbp_write(rt2x00dev, 76, 0x28); - - if (rt2x00_rt(rt2x00dev, RT3290)) - rt2800_bbp_write(rt2x00dev, 77, 0x58); - else - rt2800_bbp_write(rt2x00dev, 77, 0x59); - } else { - rt2800_bbp_write(rt2x00dev, 69, 0x12); - rt2800_bbp_write(rt2x00dev, 73, 0x10); - } - - rt2800_bbp_write(rt2x00dev, 70, 0x0a); - - if (rt2x00_rt(rt2x00dev, RT3070) || - rt2x00_rt(rt2x00dev, RT3071) || - rt2x00_rt(rt2x00dev, RT3090) || - rt2x00_rt(rt2x00dev, RT3390) || - rt2x00_rt(rt2x00dev, RT3572) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) { - rt2800_bbp_write(rt2x00dev, 79, 0x13); - rt2800_bbp_write(rt2x00dev, 80, 0x05); - rt2800_bbp_write(rt2x00dev, 81, 0x33); - } else if (rt2800_is_305x_soc(rt2x00dev)) { - rt2800_bbp_write(rt2x00dev, 78, 0x0e); - rt2800_bbp_write(rt2x00dev, 80, 0x08); - } else if (rt2x00_rt(rt2x00dev, RT3290)) { - rt2800_bbp_write(rt2x00dev, 74, 0x0b); - rt2800_bbp_write(rt2x00dev, 79, 0x18); - rt2800_bbp_write(rt2x00dev, 80, 0x09); - rt2800_bbp_write(rt2x00dev, 81, 0x33); - } else if (rt2x00_rt(rt2x00dev, RT3352)) { - rt2800_bbp_write(rt2x00dev, 78, 0x0e); - rt2800_bbp_write(rt2x00dev, 80, 0x08); - rt2800_bbp_write(rt2x00dev, 81, 0x37); - } else { - rt2800_bbp_write(rt2x00dev, 81, 0x37); - } - - rt2800_bbp_write(rt2x00dev, 82, 0x62); - if (rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) - rt2800_bbp_write(rt2x00dev, 83, 0x7a); - else - rt2800_bbp_write(rt2x00dev, 83, 0x6a); - - if (rt2x00_rt_rev(rt2x00dev, RT2860, REV_RT2860D)) - rt2800_bbp_write(rt2x00dev, 84, 0x19); - else if (rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) - rt2800_bbp_write(rt2x00dev, 84, 0x9a); - else - rt2800_bbp_write(rt2x00dev, 84, 0x99); - - if (rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT3352) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) - rt2800_bbp_write(rt2x00dev, 86, 0x38); - else - rt2800_bbp_write(rt2x00dev, 86, 0x00); - - if (rt2x00_rt(rt2x00dev, RT3352) || - rt2x00_rt(rt2x00dev, RT5392)) - rt2800_bbp_write(rt2x00dev, 88, 0x90); - - rt2800_bbp_write(rt2x00dev, 91, 0x04); - - if (rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT3352) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) - rt2800_bbp_write(rt2x00dev, 92, 0x02); - else - rt2800_bbp_write(rt2x00dev, 92, 0x00); - - if (rt2x00_rt(rt2x00dev, RT5392)) { - rt2800_bbp_write(rt2x00dev, 95, 0x9a); - rt2800_bbp_write(rt2x00dev, 98, 0x12); - } - - if (rt2x00_rt_rev_gte(rt2x00dev, RT3070, REV_RT3070F) || - rt2x00_rt_rev_gte(rt2x00dev, RT3071, REV_RT3071E) || - rt2x00_rt_rev_gte(rt2x00dev, RT3090, REV_RT3090E) || - rt2x00_rt_rev_gte(rt2x00dev, RT3390, REV_RT3390E) || - rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT3352) || - rt2x00_rt(rt2x00dev, RT3572) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392) || - rt2800_is_305x_soc(rt2x00dev)) - rt2800_bbp_write(rt2x00dev, 103, 0xc0); - else - rt2800_bbp_write(rt2x00dev, 103, 0x00); - - if (rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT3352) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) - rt2800_bbp_write(rt2x00dev, 104, 0x92); - - if (rt2800_is_305x_soc(rt2x00dev)) - rt2800_bbp_write(rt2x00dev, 105, 0x01); - else if (rt2x00_rt(rt2x00dev, RT3290)) - rt2800_bbp_write(rt2x00dev, 105, 0x1c); - else if (rt2x00_rt(rt2x00dev, RT3352)) - rt2800_bbp_write(rt2x00dev, 105, 0x34); - else if (rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) - rt2800_bbp_write(rt2x00dev, 105, 0x3c); - else - rt2800_bbp_write(rt2x00dev, 105, 0x05); - - if (rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT5390)) - rt2800_bbp_write(rt2x00dev, 106, 0x03); - else if (rt2x00_rt(rt2x00dev, RT3352)) - rt2800_bbp_write(rt2x00dev, 106, 0x05); - else if (rt2x00_rt(rt2x00dev, RT5392)) - rt2800_bbp_write(rt2x00dev, 106, 0x12); - else - rt2800_bbp_write(rt2x00dev, 106, 0x35); - - if (rt2x00_rt(rt2x00dev, RT3352)) - rt2800_bbp_write(rt2x00dev, 120, 0x50); - - if (rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) - rt2800_bbp_write(rt2x00dev, 128, 0x12); - - if (rt2x00_rt(rt2x00dev, RT5392)) { - rt2800_bbp_write(rt2x00dev, 134, 0xd0); - rt2800_bbp_write(rt2x00dev, 135, 0xf6); - } - - if (rt2x00_rt(rt2x00dev, RT3352)) - rt2800_bbp_write(rt2x00dev, 137, 0x0f); - - if (rt2x00_rt(rt2x00dev, RT3071) || - rt2x00_rt(rt2x00dev, RT3090) || - rt2x00_rt(rt2x00dev, RT3390) || - rt2x00_rt(rt2x00dev, RT3572) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) { - rt2800_bbp_read(rt2x00dev, 138, &value); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1) - value |= 0x20; - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1) - value &= ~0x02; - - rt2800_bbp_write(rt2x00dev, 138, value); - } - - if (rt2x00_rt(rt2x00dev, RT3290)) { - rt2800_bbp_write(rt2x00dev, 67, 0x24); - rt2800_bbp_write(rt2x00dev, 143, 0x04); - rt2800_bbp_write(rt2x00dev, 142, 0x99); - rt2800_bbp_write(rt2x00dev, 150, 0x30); - rt2800_bbp_write(rt2x00dev, 151, 0x2e); - rt2800_bbp_write(rt2x00dev, 152, 0x20); - rt2800_bbp_write(rt2x00dev, 153, 0x34); - rt2800_bbp_write(rt2x00dev, 154, 0x40); - rt2800_bbp_write(rt2x00dev, 155, 0x3b); - rt2800_bbp_write(rt2x00dev, 253, 0x04); - - rt2800_bbp_read(rt2x00dev, 47, &value); - rt2x00_set_field8(&value, BBP47_TSSI_ADC6, 1); - rt2800_bbp_write(rt2x00dev, 47, value); - - /* Use 5-bit ADC for Acquisition and 8-bit ADC for data */ - rt2800_bbp_read(rt2x00dev, 3, &value); - rt2x00_set_field8(&value, BBP3_ADC_MODE_SWITCH, 1); - rt2x00_set_field8(&value, BBP3_ADC_INIT_MODE, 1); - rt2800_bbp_write(rt2x00dev, 3, value); - } - - if (rt2x00_rt(rt2x00dev, RT3352)) { - rt2800_bbp_write(rt2x00dev, 163, 0xbd); - /* Set ITxBF timeout to 0x9c40=1000msec */ - rt2800_bbp_write(rt2x00dev, 179, 0x02); - rt2800_bbp_write(rt2x00dev, 180, 0x00); - rt2800_bbp_write(rt2x00dev, 182, 0x40); - rt2800_bbp_write(rt2x00dev, 180, 0x01); - rt2800_bbp_write(rt2x00dev, 182, 0x9c); - rt2800_bbp_write(rt2x00dev, 179, 0x00); - /* Reprogram the inband interface to put right values in RXWI */ - rt2800_bbp_write(rt2x00dev, 142, 0x04); - rt2800_bbp_write(rt2x00dev, 143, 0x3b); - rt2800_bbp_write(rt2x00dev, 142, 0x06); - rt2800_bbp_write(rt2x00dev, 143, 0xa0); - rt2800_bbp_write(rt2x00dev, 142, 0x07); - rt2800_bbp_write(rt2x00dev, 143, 0xa1); - rt2800_bbp_write(rt2x00dev, 142, 0x08); - rt2800_bbp_write(rt2x00dev, 143, 0xa2); - - rt2800_bbp_write(rt2x00dev, 148, 0xc8); - } - - if (rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) { - int ant, div_mode; - - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); - div_mode = rt2x00_get_field16(eeprom, - EEPROM_NIC_CONF1_ANT_DIVERSITY); - ant = (div_mode == 3) ? 1 : 0; - - /* check if this is a Bluetooth combo card */ - if (test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags)) { - u32 reg; - - rt2800_register_read(rt2x00dev, GPIO_CTRL, ®); - rt2x00_set_field32(®, GPIO_CTRL_DIR3, 0); - rt2x00_set_field32(®, GPIO_CTRL_DIR6, 0); - rt2x00_set_field32(®, GPIO_CTRL_VAL3, 0); - rt2x00_set_field32(®, GPIO_CTRL_VAL6, 0); - if (ant == 0) - rt2x00_set_field32(®, GPIO_CTRL_VAL3, 1); - else if (ant == 1) - rt2x00_set_field32(®, GPIO_CTRL_VAL6, 1); - rt2800_register_write(rt2x00dev, GPIO_CTRL, reg); - } - - /* This chip has hardware antenna diversity*/ - if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390R)) { - rt2800_bbp_write(rt2x00dev, 150, 0); /* Disable Antenna Software OFDM */ - rt2800_bbp_write(rt2x00dev, 151, 0); /* Disable Antenna Software CCK */ - rt2800_bbp_write(rt2x00dev, 154, 0); /* Clear previously selected antenna */ - } - - rt2800_bbp_read(rt2x00dev, 152, &value); - if (ant == 0) - rt2x00_set_field8(&value, BBP152_RX_DEFAULT_ANT, 1); - else - rt2x00_set_field8(&value, BBP152_RX_DEFAULT_ANT, 0); - rt2800_bbp_write(rt2x00dev, 152, value); - - rt2800_init_freq_calibration(rt2x00dev); - } - - for (i = 0; i < EEPROM_BBP_SIZE; i++) { - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBP_START + i, &eeprom); - - if (eeprom != 0xffff && eeprom != 0x0000) { - reg_id = rt2x00_get_field16(eeprom, EEPROM_BBP_REG_ID); - value = rt2x00_get_field16(eeprom, EEPROM_BBP_VALUE); - rt2800_bbp_write(rt2x00dev, reg_id, value); - } - } - - return 0; -} - -static void rt2800_led_open_drain_enable(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - rt2800_register_read(rt2x00dev, OPT_14_CSR, ®); - rt2x00_set_field32(®, OPT_14_CSR_BIT0, 1); - rt2800_register_write(rt2x00dev, OPT_14_CSR, reg); -} - -static u8 rt2800_init_rx_filter(struct rt2x00_dev *rt2x00dev, bool bw40, - u8 filter_target) -{ - unsigned int i; - u8 bbp; - u8 rfcsr; - u8 passband; - u8 stopband; - u8 overtuned = 0; - u8 rfcsr24 = (bw40) ? 0x27 : 0x07; - - rt2800_rfcsr_write(rt2x00dev, 24, rfcsr24); - - rt2800_bbp_read(rt2x00dev, 4, &bbp); - rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 2 * bw40); - rt2800_bbp_write(rt2x00dev, 4, bbp); - - rt2800_rfcsr_read(rt2x00dev, 31, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR31_RX_H20M, bw40); - rt2800_rfcsr_write(rt2x00dev, 31, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 22, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 1); - rt2800_rfcsr_write(rt2x00dev, 22, rfcsr); - - /* - * Set power & frequency of passband test tone - */ - rt2800_bbp_write(rt2x00dev, 24, 0); - - for (i = 0; i < 100; i++) { - rt2800_bbp_write(rt2x00dev, 25, 0x90); - msleep(1); - - rt2800_bbp_read(rt2x00dev, 55, &passband); - if (passband) - break; - } - - /* - * Set power & frequency of stopband test tone - */ - rt2800_bbp_write(rt2x00dev, 24, 0x06); - - for (i = 0; i < 100; i++) { - rt2800_bbp_write(rt2x00dev, 25, 0x90); - msleep(1); - - rt2800_bbp_read(rt2x00dev, 55, &stopband); - - if ((passband - stopband) <= filter_target) { - rfcsr24++; - overtuned += ((passband - stopband) == filter_target); - } else - break; - - rt2800_rfcsr_write(rt2x00dev, 24, rfcsr24); - } - - rfcsr24 -= !!overtuned; - - rt2800_rfcsr_write(rt2x00dev, 24, rfcsr24); - return rfcsr24; -} - -static void rt2800_rf_init_calibration(struct rt2x00_dev *rt2x00dev, - const unsigned int rf_reg) -{ - u8 rfcsr; - - rt2800_rfcsr_read(rt2x00dev, rf_reg, &rfcsr); - rt2x00_set_field8(&rfcsr, FIELD8(0x80), 1); - rt2800_rfcsr_write(rt2x00dev, rf_reg, rfcsr); - msleep(1); - rt2x00_set_field8(&rfcsr, FIELD8(0x80), 0); - rt2800_rfcsr_write(rt2x00dev, rf_reg, rfcsr); -} - -static void rt2800_rx_filter_calibration(struct rt2x00_dev *rt2x00dev) -{ - struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; - u8 filter_tgt_bw20; - u8 filter_tgt_bw40; - u8 rfcsr, bbp; - - /* - * TODO: sync filter_tgt values with vendor driver - */ - if (rt2x00_rt(rt2x00dev, RT3070)) { - filter_tgt_bw20 = 0x16; - filter_tgt_bw40 = 0x19; - } else { - filter_tgt_bw20 = 0x13; - filter_tgt_bw40 = 0x15; - } - - drv_data->calibration_bw20 = - rt2800_init_rx_filter(rt2x00dev, false, filter_tgt_bw20); - drv_data->calibration_bw40 = - rt2800_init_rx_filter(rt2x00dev, true, filter_tgt_bw40); - - /* - * Save BBP 25 & 26 values for later use in channel switching (for 3052) - */ - rt2800_bbp_read(rt2x00dev, 25, &drv_data->bbp25); - rt2800_bbp_read(rt2x00dev, 26, &drv_data->bbp26); - - /* - * Set back to initial state - */ - rt2800_bbp_write(rt2x00dev, 24, 0); - - rt2800_rfcsr_read(rt2x00dev, 22, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR22_BASEBAND_LOOPBACK, 0); - rt2800_rfcsr_write(rt2x00dev, 22, rfcsr); - - /* - * Set BBP back to BW20 - */ - rt2800_bbp_read(rt2x00dev, 4, &bbp); - rt2x00_set_field8(&bbp, BBP4_BANDWIDTH, 0); - rt2800_bbp_write(rt2x00dev, 4, bbp); -} - -static void rt2800_normal_mode_setup_3xxx(struct rt2x00_dev *rt2x00dev) -{ - struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; - u8 min_gain, rfcsr, bbp; - u16 eeprom; - - rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr); - - rt2x00_set_field8(&rfcsr, RFCSR17_TX_LO1_EN, 0); - if (rt2x00_rt(rt2x00dev, RT3070) || - rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || - rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E) || - rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) { - if (!test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags)) - rt2x00_set_field8(&rfcsr, RFCSR17_R, 1); - } - - min_gain = rt2x00_rt(rt2x00dev, RT3070) ? 1 : 2; - if (drv_data->txmixer_gain_24g >= min_gain) { - rt2x00_set_field8(&rfcsr, RFCSR17_TXMIXER_GAIN, - drv_data->txmixer_gain_24g); - } - - rt2800_rfcsr_write(rt2x00dev, 17, rfcsr); - - if (rt2x00_rt(rt2x00dev, RT3090)) { - /* Turn off unused DAC1 and ADC1 to reduce power consumption */ - rt2800_bbp_read(rt2x00dev, 138, &bbp); - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1) - rt2x00_set_field8(&bbp, BBP138_RX_ADC1, 0); - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1) - rt2x00_set_field8(&bbp, BBP138_TX_DAC1, 1); - rt2800_bbp_write(rt2x00dev, 138, bbp); - } - - if (rt2x00_rt(rt2x00dev, RT3070)) { - rt2800_rfcsr_read(rt2x00dev, 27, &rfcsr); - if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) - rt2x00_set_field8(&rfcsr, RFCSR27_R1, 3); - else - rt2x00_set_field8(&rfcsr, RFCSR27_R1, 0); - rt2x00_set_field8(&rfcsr, RFCSR27_R2, 0); - rt2x00_set_field8(&rfcsr, RFCSR27_R3, 0); - rt2x00_set_field8(&rfcsr, RFCSR27_R4, 0); - rt2800_rfcsr_write(rt2x00dev, 27, rfcsr); - } else if (rt2x00_rt(rt2x00dev, RT3071) || - rt2x00_rt(rt2x00dev, RT3090) || - rt2x00_rt(rt2x00dev, RT3390)) { - rt2800_rfcsr_read(rt2x00dev, 1, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR1_RF_BLOCK_EN, 1); - rt2x00_set_field8(&rfcsr, RFCSR1_RX0_PD, 0); - rt2x00_set_field8(&rfcsr, RFCSR1_TX0_PD, 0); - rt2x00_set_field8(&rfcsr, RFCSR1_RX1_PD, 1); - rt2x00_set_field8(&rfcsr, RFCSR1_TX1_PD, 1); - rt2800_rfcsr_write(rt2x00dev, 1, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 15, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR15_TX_LO2_EN, 0); - rt2800_rfcsr_write(rt2x00dev, 15, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 20, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR20_RX_LO1_EN, 0); - rt2800_rfcsr_write(rt2x00dev, 20, rfcsr); - - rt2800_rfcsr_read(rt2x00dev, 21, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR21_RX_LO2_EN, 0); - rt2800_rfcsr_write(rt2x00dev, 21, rfcsr); - } -} - -static void rt2800_normal_mode_setup_5xxx(struct rt2x00_dev *rt2x00dev) -{ - u8 reg; - u16 eeprom; - - /* Turn off unused DAC1 and ADC1 to reduce power consumption */ - rt2800_bbp_read(rt2x00dev, 138, ®); - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) == 1) - rt2x00_set_field8(®, BBP138_RX_ADC1, 0); - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) == 1) - rt2x00_set_field8(®, BBP138_TX_DAC1, 1); - rt2800_bbp_write(rt2x00dev, 138, reg); - - rt2800_rfcsr_read(rt2x00dev, 38, ®); - rt2x00_set_field8(®, RFCSR38_RX_LO1_EN, 0); - rt2800_rfcsr_write(rt2x00dev, 38, reg); - - rt2800_rfcsr_read(rt2x00dev, 39, ®); - rt2x00_set_field8(®, RFCSR39_RX_LO2_EN, 0); - rt2800_rfcsr_write(rt2x00dev, 39, reg); - - rt2800_bbp4_mac_if_ctrl(rt2x00dev); - - rt2800_rfcsr_read(rt2x00dev, 30, ®); - rt2x00_set_field8(®, RFCSR30_RX_VCM, 2); - rt2800_rfcsr_write(rt2x00dev, 30, reg); -} - -static void rt2800_init_rfcsr_305x_soc(struct rt2x00_dev *rt2x00dev) -{ - rt2800_rf_init_calibration(rt2x00dev, 30); - - rt2800_rfcsr_write(rt2x00dev, 0, 0x50); - rt2800_rfcsr_write(rt2x00dev, 1, 0x01); - rt2800_rfcsr_write(rt2x00dev, 2, 0xf7); - rt2800_rfcsr_write(rt2x00dev, 3, 0x75); - rt2800_rfcsr_write(rt2x00dev, 4, 0x40); - rt2800_rfcsr_write(rt2x00dev, 5, 0x03); - rt2800_rfcsr_write(rt2x00dev, 6, 0x02); - rt2800_rfcsr_write(rt2x00dev, 7, 0x50); - rt2800_rfcsr_write(rt2x00dev, 8, 0x39); - rt2800_rfcsr_write(rt2x00dev, 9, 0x0f); - rt2800_rfcsr_write(rt2x00dev, 10, 0x60); - rt2800_rfcsr_write(rt2x00dev, 11, 0x21); - rt2800_rfcsr_write(rt2x00dev, 12, 0x75); - rt2800_rfcsr_write(rt2x00dev, 13, 0x75); - rt2800_rfcsr_write(rt2x00dev, 14, 0x90); - rt2800_rfcsr_write(rt2x00dev, 15, 0x58); - rt2800_rfcsr_write(rt2x00dev, 16, 0xb3); - rt2800_rfcsr_write(rt2x00dev, 17, 0x92); - rt2800_rfcsr_write(rt2x00dev, 18, 0x2c); - rt2800_rfcsr_write(rt2x00dev, 19, 0x02); - rt2800_rfcsr_write(rt2x00dev, 20, 0xba); - rt2800_rfcsr_write(rt2x00dev, 21, 0xdb); - rt2800_rfcsr_write(rt2x00dev, 22, 0x00); - rt2800_rfcsr_write(rt2x00dev, 23, 0x31); - rt2800_rfcsr_write(rt2x00dev, 24, 0x08); - rt2800_rfcsr_write(rt2x00dev, 25, 0x01); - rt2800_rfcsr_write(rt2x00dev, 26, 0x25); - rt2800_rfcsr_write(rt2x00dev, 27, 0x23); - rt2800_rfcsr_write(rt2x00dev, 28, 0x13); - rt2800_rfcsr_write(rt2x00dev, 29, 0x83); - rt2800_rfcsr_write(rt2x00dev, 30, 0x00); - rt2800_rfcsr_write(rt2x00dev, 31, 0x00); -} - -static void rt2800_init_rfcsr_30xx(struct rt2x00_dev *rt2x00dev) -{ - u8 rfcsr; - u16 eeprom; - u32 reg; - - /* XXX vendor driver do this only for 3070 */ - rt2800_rf_init_calibration(rt2x00dev, 30); - - rt2800_rfcsr_write(rt2x00dev, 4, 0x40); - rt2800_rfcsr_write(rt2x00dev, 5, 0x03); - rt2800_rfcsr_write(rt2x00dev, 6, 0x02); - rt2800_rfcsr_write(rt2x00dev, 7, 0x60); - rt2800_rfcsr_write(rt2x00dev, 9, 0x0f); - rt2800_rfcsr_write(rt2x00dev, 10, 0x41); - rt2800_rfcsr_write(rt2x00dev, 11, 0x21); - rt2800_rfcsr_write(rt2x00dev, 12, 0x7b); - rt2800_rfcsr_write(rt2x00dev, 14, 0x90); - rt2800_rfcsr_write(rt2x00dev, 15, 0x58); - rt2800_rfcsr_write(rt2x00dev, 16, 0xb3); - rt2800_rfcsr_write(rt2x00dev, 17, 0x92); - rt2800_rfcsr_write(rt2x00dev, 18, 0x2c); - rt2800_rfcsr_write(rt2x00dev, 19, 0x02); - rt2800_rfcsr_write(rt2x00dev, 20, 0xba); - rt2800_rfcsr_write(rt2x00dev, 21, 0xdb); - rt2800_rfcsr_write(rt2x00dev, 24, 0x16); - rt2800_rfcsr_write(rt2x00dev, 25, 0x01); - rt2800_rfcsr_write(rt2x00dev, 29, 0x1f); - - if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F)) { - rt2800_register_read(rt2x00dev, LDO_CFG0, ®); - rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); - rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); - rt2800_register_write(rt2x00dev, LDO_CFG0, reg); - } else if (rt2x00_rt(rt2x00dev, RT3071) || - rt2x00_rt(rt2x00dev, RT3090)) { - rt2800_rfcsr_write(rt2x00dev, 31, 0x14); - - rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1); - rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); - - rt2800_register_read(rt2x00dev, LDO_CFG0, ®); - rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); - if (rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || - rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) { - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_DAC_TEST)) - rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); - else - rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0); - } - rt2800_register_write(rt2x00dev, LDO_CFG0, reg); - - rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®); - rt2x00_set_field32(®, GPIO_SWITCH_5, 0); - rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); - } - - rt2800_rx_filter_calibration(rt2x00dev); - - if (rt2x00_rt_rev_lt(rt2x00dev, RT3070, REV_RT3070F) || - rt2x00_rt_rev_lt(rt2x00dev, RT3071, REV_RT3071E) || - rt2x00_rt_rev_lt(rt2x00dev, RT3090, REV_RT3090E)) - rt2800_rfcsr_write(rt2x00dev, 27, 0x03); - - rt2800_led_open_drain_enable(rt2x00dev); - rt2800_normal_mode_setup_3xxx(rt2x00dev); -} - -static void rt2800_init_rfcsr_3290(struct rt2x00_dev *rt2x00dev) -{ - u8 rfcsr; - - rt2800_rf_init_calibration(rt2x00dev, 2); - - rt2800_rfcsr_write(rt2x00dev, 1, 0x0f); - rt2800_rfcsr_write(rt2x00dev, 2, 0x80); - rt2800_rfcsr_write(rt2x00dev, 3, 0x08); - rt2800_rfcsr_write(rt2x00dev, 4, 0x00); - rt2800_rfcsr_write(rt2x00dev, 6, 0xa0); - rt2800_rfcsr_write(rt2x00dev, 8, 0xf3); - rt2800_rfcsr_write(rt2x00dev, 9, 0x02); - rt2800_rfcsr_write(rt2x00dev, 10, 0x53); - rt2800_rfcsr_write(rt2x00dev, 11, 0x4a); - rt2800_rfcsr_write(rt2x00dev, 12, 0x46); - rt2800_rfcsr_write(rt2x00dev, 13, 0x9f); - rt2800_rfcsr_write(rt2x00dev, 18, 0x02); - rt2800_rfcsr_write(rt2x00dev, 22, 0x20); - rt2800_rfcsr_write(rt2x00dev, 25, 0x83); - rt2800_rfcsr_write(rt2x00dev, 26, 0x82); - rt2800_rfcsr_write(rt2x00dev, 27, 0x09); - rt2800_rfcsr_write(rt2x00dev, 29, 0x10); - rt2800_rfcsr_write(rt2x00dev, 30, 0x10); - rt2800_rfcsr_write(rt2x00dev, 31, 0x80); - rt2800_rfcsr_write(rt2x00dev, 32, 0x80); - rt2800_rfcsr_write(rt2x00dev, 33, 0x00); - rt2800_rfcsr_write(rt2x00dev, 34, 0x05); - rt2800_rfcsr_write(rt2x00dev, 35, 0x12); - rt2800_rfcsr_write(rt2x00dev, 36, 0x00); - rt2800_rfcsr_write(rt2x00dev, 38, 0x85); - rt2800_rfcsr_write(rt2x00dev, 39, 0x1b); - rt2800_rfcsr_write(rt2x00dev, 40, 0x0b); - rt2800_rfcsr_write(rt2x00dev, 41, 0xbb); - rt2800_rfcsr_write(rt2x00dev, 42, 0xd5); - rt2800_rfcsr_write(rt2x00dev, 43, 0x7b); - rt2800_rfcsr_write(rt2x00dev, 44, 0x0e); - rt2800_rfcsr_write(rt2x00dev, 45, 0xa2); - rt2800_rfcsr_write(rt2x00dev, 46, 0x73); - rt2800_rfcsr_write(rt2x00dev, 47, 0x00); - rt2800_rfcsr_write(rt2x00dev, 48, 0x10); - rt2800_rfcsr_write(rt2x00dev, 49, 0x98); - rt2800_rfcsr_write(rt2x00dev, 52, 0x38); - rt2800_rfcsr_write(rt2x00dev, 53, 0x00); - rt2800_rfcsr_write(rt2x00dev, 54, 0x78); - rt2800_rfcsr_write(rt2x00dev, 55, 0x43); - rt2800_rfcsr_write(rt2x00dev, 56, 0x02); - rt2800_rfcsr_write(rt2x00dev, 57, 0x80); - rt2800_rfcsr_write(rt2x00dev, 58, 0x7f); - rt2800_rfcsr_write(rt2x00dev, 59, 0x09); - rt2800_rfcsr_write(rt2x00dev, 60, 0x45); - rt2800_rfcsr_write(rt2x00dev, 61, 0xc1); - - rt2800_rfcsr_read(rt2x00dev, 29, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR29_RSSI_GAIN, 3); - rt2800_rfcsr_write(rt2x00dev, 29, rfcsr); - - rt2800_led_open_drain_enable(rt2x00dev); - rt2800_normal_mode_setup_3xxx(rt2x00dev); -} - -static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev) -{ - rt2800_rf_init_calibration(rt2x00dev, 30); - - rt2800_rfcsr_write(rt2x00dev, 0, 0xf0); - rt2800_rfcsr_write(rt2x00dev, 1, 0x23); - rt2800_rfcsr_write(rt2x00dev, 2, 0x50); - rt2800_rfcsr_write(rt2x00dev, 3, 0x18); - rt2800_rfcsr_write(rt2x00dev, 4, 0x00); - rt2800_rfcsr_write(rt2x00dev, 5, 0x00); - rt2800_rfcsr_write(rt2x00dev, 6, 0x33); - rt2800_rfcsr_write(rt2x00dev, 7, 0x00); - rt2800_rfcsr_write(rt2x00dev, 8, 0xf1); - rt2800_rfcsr_write(rt2x00dev, 9, 0x02); - rt2800_rfcsr_write(rt2x00dev, 10, 0xd2); - rt2800_rfcsr_write(rt2x00dev, 11, 0x42); - rt2800_rfcsr_write(rt2x00dev, 12, 0x1c); - rt2800_rfcsr_write(rt2x00dev, 13, 0x00); - rt2800_rfcsr_write(rt2x00dev, 14, 0x5a); - rt2800_rfcsr_write(rt2x00dev, 15, 0x00); - rt2800_rfcsr_write(rt2x00dev, 16, 0x01); - rt2800_rfcsr_write(rt2x00dev, 18, 0x45); - rt2800_rfcsr_write(rt2x00dev, 19, 0x02); - rt2800_rfcsr_write(rt2x00dev, 20, 0x00); - rt2800_rfcsr_write(rt2x00dev, 21, 0x00); - rt2800_rfcsr_write(rt2x00dev, 22, 0x00); - rt2800_rfcsr_write(rt2x00dev, 23, 0x00); - rt2800_rfcsr_write(rt2x00dev, 24, 0x00); - rt2800_rfcsr_write(rt2x00dev, 25, 0x80); - rt2800_rfcsr_write(rt2x00dev, 26, 0x00); - rt2800_rfcsr_write(rt2x00dev, 27, 0x03); - rt2800_rfcsr_write(rt2x00dev, 28, 0x03); - rt2800_rfcsr_write(rt2x00dev, 29, 0x00); - rt2800_rfcsr_write(rt2x00dev, 30, 0x10); - rt2800_rfcsr_write(rt2x00dev, 31, 0x80); - rt2800_rfcsr_write(rt2x00dev, 32, 0x80); - rt2800_rfcsr_write(rt2x00dev, 33, 0x00); - rt2800_rfcsr_write(rt2x00dev, 34, 0x01); - rt2800_rfcsr_write(rt2x00dev, 35, 0x03); - rt2800_rfcsr_write(rt2x00dev, 36, 0xbd); - rt2800_rfcsr_write(rt2x00dev, 37, 0x3c); - rt2800_rfcsr_write(rt2x00dev, 38, 0x5f); - rt2800_rfcsr_write(rt2x00dev, 39, 0xc5); - rt2800_rfcsr_write(rt2x00dev, 40, 0x33); - rt2800_rfcsr_write(rt2x00dev, 41, 0x5b); - rt2800_rfcsr_write(rt2x00dev, 42, 0x5b); - rt2800_rfcsr_write(rt2x00dev, 43, 0xdb); - rt2800_rfcsr_write(rt2x00dev, 44, 0xdb); - rt2800_rfcsr_write(rt2x00dev, 45, 0xdb); - rt2800_rfcsr_write(rt2x00dev, 46, 0xdd); - rt2800_rfcsr_write(rt2x00dev, 47, 0x0d); - rt2800_rfcsr_write(rt2x00dev, 48, 0x14); - rt2800_rfcsr_write(rt2x00dev, 49, 0x00); - rt2800_rfcsr_write(rt2x00dev, 50, 0x2d); - rt2800_rfcsr_write(rt2x00dev, 51, 0x7f); - rt2800_rfcsr_write(rt2x00dev, 52, 0x00); - rt2800_rfcsr_write(rt2x00dev, 53, 0x52); - rt2800_rfcsr_write(rt2x00dev, 54, 0x1b); - rt2800_rfcsr_write(rt2x00dev, 55, 0x7f); - rt2800_rfcsr_write(rt2x00dev, 56, 0x00); - rt2800_rfcsr_write(rt2x00dev, 57, 0x52); - rt2800_rfcsr_write(rt2x00dev, 58, 0x1b); - rt2800_rfcsr_write(rt2x00dev, 59, 0x00); - rt2800_rfcsr_write(rt2x00dev, 60, 0x00); - rt2800_rfcsr_write(rt2x00dev, 61, 0x00); - rt2800_rfcsr_write(rt2x00dev, 62, 0x00); - rt2800_rfcsr_write(rt2x00dev, 63, 0x00); - - rt2800_rx_filter_calibration(rt2x00dev); - rt2800_led_open_drain_enable(rt2x00dev); - rt2800_normal_mode_setup_3xxx(rt2x00dev); -} - -static void rt2800_init_rfcsr_3390(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - rt2800_rf_init_calibration(rt2x00dev, 30); - - rt2800_rfcsr_write(rt2x00dev, 0, 0xa0); - rt2800_rfcsr_write(rt2x00dev, 1, 0xe1); - rt2800_rfcsr_write(rt2x00dev, 2, 0xf1); - rt2800_rfcsr_write(rt2x00dev, 3, 0x62); - rt2800_rfcsr_write(rt2x00dev, 4, 0x40); - rt2800_rfcsr_write(rt2x00dev, 5, 0x8b); - rt2800_rfcsr_write(rt2x00dev, 6, 0x42); - rt2800_rfcsr_write(rt2x00dev, 7, 0x34); - rt2800_rfcsr_write(rt2x00dev, 8, 0x00); - rt2800_rfcsr_write(rt2x00dev, 9, 0xc0); - rt2800_rfcsr_write(rt2x00dev, 10, 0x61); - rt2800_rfcsr_write(rt2x00dev, 11, 0x21); - rt2800_rfcsr_write(rt2x00dev, 12, 0x3b); - rt2800_rfcsr_write(rt2x00dev, 13, 0xe0); - rt2800_rfcsr_write(rt2x00dev, 14, 0x90); - rt2800_rfcsr_write(rt2x00dev, 15, 0x53); - rt2800_rfcsr_write(rt2x00dev, 16, 0xe0); - rt2800_rfcsr_write(rt2x00dev, 17, 0x94); - rt2800_rfcsr_write(rt2x00dev, 18, 0x5c); - rt2800_rfcsr_write(rt2x00dev, 19, 0x4a); - rt2800_rfcsr_write(rt2x00dev, 20, 0xb2); - rt2800_rfcsr_write(rt2x00dev, 21, 0xf6); - rt2800_rfcsr_write(rt2x00dev, 22, 0x00); - rt2800_rfcsr_write(rt2x00dev, 23, 0x14); - rt2800_rfcsr_write(rt2x00dev, 24, 0x08); - rt2800_rfcsr_write(rt2x00dev, 25, 0x3d); - rt2800_rfcsr_write(rt2x00dev, 26, 0x85); - rt2800_rfcsr_write(rt2x00dev, 27, 0x00); - rt2800_rfcsr_write(rt2x00dev, 28, 0x41); - rt2800_rfcsr_write(rt2x00dev, 29, 0x8f); - rt2800_rfcsr_write(rt2x00dev, 30, 0x20); - rt2800_rfcsr_write(rt2x00dev, 31, 0x0f); - - rt2800_register_read(rt2x00dev, GPIO_SWITCH, ®); - rt2x00_set_field32(®, GPIO_SWITCH_5, 0); - rt2800_register_write(rt2x00dev, GPIO_SWITCH, reg); - - rt2800_rx_filter_calibration(rt2x00dev); - - if (rt2x00_rt_rev_lt(rt2x00dev, RT3390, REV_RT3390E)) - rt2800_rfcsr_write(rt2x00dev, 27, 0x03); - - rt2800_led_open_drain_enable(rt2x00dev); - rt2800_normal_mode_setup_3xxx(rt2x00dev); -} - -static void rt2800_init_rfcsr_3572(struct rt2x00_dev *rt2x00dev) -{ - u8 rfcsr; - u32 reg; - - rt2800_rf_init_calibration(rt2x00dev, 30); - - rt2800_rfcsr_write(rt2x00dev, 0, 0x70); - rt2800_rfcsr_write(rt2x00dev, 1, 0x81); - rt2800_rfcsr_write(rt2x00dev, 2, 0xf1); - rt2800_rfcsr_write(rt2x00dev, 3, 0x02); - rt2800_rfcsr_write(rt2x00dev, 4, 0x4c); - rt2800_rfcsr_write(rt2x00dev, 5, 0x05); - rt2800_rfcsr_write(rt2x00dev, 6, 0x4a); - rt2800_rfcsr_write(rt2x00dev, 7, 0xd8); - rt2800_rfcsr_write(rt2x00dev, 9, 0xc3); - rt2800_rfcsr_write(rt2x00dev, 10, 0xf1); - rt2800_rfcsr_write(rt2x00dev, 11, 0xb9); - rt2800_rfcsr_write(rt2x00dev, 12, 0x70); - rt2800_rfcsr_write(rt2x00dev, 13, 0x65); - rt2800_rfcsr_write(rt2x00dev, 14, 0xa0); - rt2800_rfcsr_write(rt2x00dev, 15, 0x53); - rt2800_rfcsr_write(rt2x00dev, 16, 0x4c); - rt2800_rfcsr_write(rt2x00dev, 17, 0x23); - rt2800_rfcsr_write(rt2x00dev, 18, 0xac); - rt2800_rfcsr_write(rt2x00dev, 19, 0x93); - rt2800_rfcsr_write(rt2x00dev, 20, 0xb3); - rt2800_rfcsr_write(rt2x00dev, 21, 0xd0); - rt2800_rfcsr_write(rt2x00dev, 22, 0x00); - rt2800_rfcsr_write(rt2x00dev, 23, 0x3c); - rt2800_rfcsr_write(rt2x00dev, 24, 0x16); - rt2800_rfcsr_write(rt2x00dev, 25, 0x15); - rt2800_rfcsr_write(rt2x00dev, 26, 0x85); - rt2800_rfcsr_write(rt2x00dev, 27, 0x00); - rt2800_rfcsr_write(rt2x00dev, 28, 0x00); - rt2800_rfcsr_write(rt2x00dev, 29, 0x9b); - rt2800_rfcsr_write(rt2x00dev, 30, 0x09); - rt2800_rfcsr_write(rt2x00dev, 31, 0x10); - - rt2800_rfcsr_read(rt2x00dev, 6, &rfcsr); - rt2x00_set_field8(&rfcsr, RFCSR6_R2, 1); - rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); - - rt2800_register_read(rt2x00dev, LDO_CFG0, ®); - rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 3); - rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); - rt2800_register_write(rt2x00dev, LDO_CFG0, reg); - msleep(1); - rt2800_register_read(rt2x00dev, LDO_CFG0, ®); - rt2x00_set_field32(®, LDO_CFG0_LDO_CORE_VLEVEL, 0); - rt2x00_set_field32(®, LDO_CFG0_BGSEL, 1); - rt2800_register_write(rt2x00dev, LDO_CFG0, reg); - - rt2800_rx_filter_calibration(rt2x00dev); - rt2800_led_open_drain_enable(rt2x00dev); - rt2800_normal_mode_setup_3xxx(rt2x00dev); -} - -static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev) -{ - rt2800_rf_init_calibration(rt2x00dev, 2); - - rt2800_rfcsr_write(rt2x00dev, 1, 0x0f); - rt2800_rfcsr_write(rt2x00dev, 2, 0x80); - rt2800_rfcsr_write(rt2x00dev, 3, 0x88); - rt2800_rfcsr_write(rt2x00dev, 5, 0x10); - if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) - rt2800_rfcsr_write(rt2x00dev, 6, 0xe0); - else - rt2800_rfcsr_write(rt2x00dev, 6, 0xa0); - rt2800_rfcsr_write(rt2x00dev, 7, 0x00); - rt2800_rfcsr_write(rt2x00dev, 10, 0x53); - rt2800_rfcsr_write(rt2x00dev, 11, 0x4a); - rt2800_rfcsr_write(rt2x00dev, 12, 0xc6); - rt2800_rfcsr_write(rt2x00dev, 13, 0x9f); - rt2800_rfcsr_write(rt2x00dev, 14, 0x00); - rt2800_rfcsr_write(rt2x00dev, 15, 0x00); - rt2800_rfcsr_write(rt2x00dev, 16, 0x00); - rt2800_rfcsr_write(rt2x00dev, 18, 0x03); - rt2800_rfcsr_write(rt2x00dev, 19, 0x00); - - rt2800_rfcsr_write(rt2x00dev, 20, 0x00); - rt2800_rfcsr_write(rt2x00dev, 21, 0x00); - rt2800_rfcsr_write(rt2x00dev, 22, 0x20); - rt2800_rfcsr_write(rt2x00dev, 23, 0x00); - rt2800_rfcsr_write(rt2x00dev, 24, 0x00); - if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) - rt2800_rfcsr_write(rt2x00dev, 25, 0x80); - else - rt2800_rfcsr_write(rt2x00dev, 25, 0xc0); - rt2800_rfcsr_write(rt2x00dev, 26, 0x00); - rt2800_rfcsr_write(rt2x00dev, 27, 0x09); - rt2800_rfcsr_write(rt2x00dev, 28, 0x00); - rt2800_rfcsr_write(rt2x00dev, 29, 0x10); - - rt2800_rfcsr_write(rt2x00dev, 30, 0x00); - rt2800_rfcsr_write(rt2x00dev, 31, 0x80); - rt2800_rfcsr_write(rt2x00dev, 32, 0x80); - rt2800_rfcsr_write(rt2x00dev, 33, 0x00); - rt2800_rfcsr_write(rt2x00dev, 34, 0x07); - rt2800_rfcsr_write(rt2x00dev, 35, 0x12); - rt2800_rfcsr_write(rt2x00dev, 36, 0x00); - rt2800_rfcsr_write(rt2x00dev, 37, 0x08); - rt2800_rfcsr_write(rt2x00dev, 38, 0x85); - rt2800_rfcsr_write(rt2x00dev, 39, 0x1b); - - if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) - rt2800_rfcsr_write(rt2x00dev, 40, 0x0b); - else - rt2800_rfcsr_write(rt2x00dev, 40, 0x4b); - rt2800_rfcsr_write(rt2x00dev, 41, 0xbb); - rt2800_rfcsr_write(rt2x00dev, 42, 0xd2); - rt2800_rfcsr_write(rt2x00dev, 43, 0x9a); - rt2800_rfcsr_write(rt2x00dev, 44, 0x0e); - rt2800_rfcsr_write(rt2x00dev, 45, 0xa2); - if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) - rt2800_rfcsr_write(rt2x00dev, 46, 0x73); - else - rt2800_rfcsr_write(rt2x00dev, 46, 0x7b); - rt2800_rfcsr_write(rt2x00dev, 47, 0x00); - rt2800_rfcsr_write(rt2x00dev, 48, 0x10); - rt2800_rfcsr_write(rt2x00dev, 49, 0x94); - - rt2800_rfcsr_write(rt2x00dev, 52, 0x38); - if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) - rt2800_rfcsr_write(rt2x00dev, 53, 0x00); - else - rt2800_rfcsr_write(rt2x00dev, 53, 0x84); - rt2800_rfcsr_write(rt2x00dev, 54, 0x78); - rt2800_rfcsr_write(rt2x00dev, 55, 0x44); - rt2800_rfcsr_write(rt2x00dev, 56, 0x22); - rt2800_rfcsr_write(rt2x00dev, 57, 0x80); - rt2800_rfcsr_write(rt2x00dev, 58, 0x7f); - rt2800_rfcsr_write(rt2x00dev, 59, 0x63); - - rt2800_rfcsr_write(rt2x00dev, 60, 0x45); - if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) - rt2800_rfcsr_write(rt2x00dev, 61, 0xd1); - else - rt2800_rfcsr_write(rt2x00dev, 61, 0xdd); - rt2800_rfcsr_write(rt2x00dev, 62, 0x00); - rt2800_rfcsr_write(rt2x00dev, 63, 0x00); - - rt2800_normal_mode_setup_5xxx(rt2x00dev); - - rt2800_led_open_drain_enable(rt2x00dev); -} - -static void rt2800_init_rfcsr_5392(struct rt2x00_dev *rt2x00dev) -{ - rt2800_rf_init_calibration(rt2x00dev, 2); - - rt2800_rfcsr_write(rt2x00dev, 1, 0x17); - rt2800_rfcsr_write(rt2x00dev, 2, 0x80); - rt2800_rfcsr_write(rt2x00dev, 3, 0x88); - rt2800_rfcsr_write(rt2x00dev, 5, 0x10); - rt2800_rfcsr_write(rt2x00dev, 6, 0xe0); - rt2800_rfcsr_write(rt2x00dev, 7, 0x00); - rt2800_rfcsr_write(rt2x00dev, 10, 0x53); - rt2800_rfcsr_write(rt2x00dev, 11, 0x4a); - rt2800_rfcsr_write(rt2x00dev, 12, 0x46); - rt2800_rfcsr_write(rt2x00dev, 13, 0x9f); - rt2800_rfcsr_write(rt2x00dev, 14, 0x00); - rt2800_rfcsr_write(rt2x00dev, 15, 0x00); - rt2800_rfcsr_write(rt2x00dev, 16, 0x00); - rt2800_rfcsr_write(rt2x00dev, 18, 0x03); - rt2800_rfcsr_write(rt2x00dev, 19, 0x4d); - rt2800_rfcsr_write(rt2x00dev, 20, 0x00); - rt2800_rfcsr_write(rt2x00dev, 21, 0x8d); - rt2800_rfcsr_write(rt2x00dev, 22, 0x20); - rt2800_rfcsr_write(rt2x00dev, 23, 0x0b); - rt2800_rfcsr_write(rt2x00dev, 24, 0x44); - rt2800_rfcsr_write(rt2x00dev, 25, 0x80); - rt2800_rfcsr_write(rt2x00dev, 26, 0x82); - rt2800_rfcsr_write(rt2x00dev, 27, 0x09); - rt2800_rfcsr_write(rt2x00dev, 28, 0x00); - rt2800_rfcsr_write(rt2x00dev, 29, 0x10); - rt2800_rfcsr_write(rt2x00dev, 30, 0x10); - rt2800_rfcsr_write(rt2x00dev, 31, 0x80); - rt2800_rfcsr_write(rt2x00dev, 32, 0x20); - rt2800_rfcsr_write(rt2x00dev, 33, 0xC0); - rt2800_rfcsr_write(rt2x00dev, 34, 0x07); - rt2800_rfcsr_write(rt2x00dev, 35, 0x12); - rt2800_rfcsr_write(rt2x00dev, 36, 0x00); - rt2800_rfcsr_write(rt2x00dev, 37, 0x08); - rt2800_rfcsr_write(rt2x00dev, 38, 0x89); - rt2800_rfcsr_write(rt2x00dev, 39, 0x1b); - rt2800_rfcsr_write(rt2x00dev, 40, 0x0f); - rt2800_rfcsr_write(rt2x00dev, 41, 0xbb); - rt2800_rfcsr_write(rt2x00dev, 42, 0xd5); - rt2800_rfcsr_write(rt2x00dev, 43, 0x9b); - rt2800_rfcsr_write(rt2x00dev, 44, 0x0e); - rt2800_rfcsr_write(rt2x00dev, 45, 0xa2); - rt2800_rfcsr_write(rt2x00dev, 46, 0x73); - rt2800_rfcsr_write(rt2x00dev, 47, 0x0c); - rt2800_rfcsr_write(rt2x00dev, 48, 0x10); - rt2800_rfcsr_write(rt2x00dev, 49, 0x94); - rt2800_rfcsr_write(rt2x00dev, 50, 0x94); - rt2800_rfcsr_write(rt2x00dev, 51, 0x3a); - rt2800_rfcsr_write(rt2x00dev, 52, 0x48); - rt2800_rfcsr_write(rt2x00dev, 53, 0x44); - rt2800_rfcsr_write(rt2x00dev, 54, 0x38); - rt2800_rfcsr_write(rt2x00dev, 55, 0x43); - rt2800_rfcsr_write(rt2x00dev, 56, 0xa1); - rt2800_rfcsr_write(rt2x00dev, 57, 0x00); - rt2800_rfcsr_write(rt2x00dev, 58, 0x39); - rt2800_rfcsr_write(rt2x00dev, 59, 0x07); - rt2800_rfcsr_write(rt2x00dev, 60, 0x45); - rt2800_rfcsr_write(rt2x00dev, 61, 0x91); - rt2800_rfcsr_write(rt2x00dev, 62, 0x39); - rt2800_rfcsr_write(rt2x00dev, 63, 0x07); - - rt2800_normal_mode_setup_5xxx(rt2x00dev); - - rt2800_led_open_drain_enable(rt2x00dev); -} - -static void rt2800_init_rfcsr_5592(struct rt2x00_dev *rt2x00dev) -{ - rt2800_rf_init_calibration(rt2x00dev, 30); - - rt2800_rfcsr_write(rt2x00dev, 1, 0x3F); - rt2800_rfcsr_write(rt2x00dev, 3, 0x08); - rt2800_rfcsr_write(rt2x00dev, 3, 0x08); - rt2800_rfcsr_write(rt2x00dev, 5, 0x10); - rt2800_rfcsr_write(rt2x00dev, 6, 0xE4); - rt2800_rfcsr_write(rt2x00dev, 7, 0x00); - rt2800_rfcsr_write(rt2x00dev, 14, 0x00); - rt2800_rfcsr_write(rt2x00dev, 15, 0x00); - rt2800_rfcsr_write(rt2x00dev, 16, 0x00); - rt2800_rfcsr_write(rt2x00dev, 18, 0x03); - rt2800_rfcsr_write(rt2x00dev, 19, 0x4D); - rt2800_rfcsr_write(rt2x00dev, 20, 0x10); - rt2800_rfcsr_write(rt2x00dev, 21, 0x8D); - rt2800_rfcsr_write(rt2x00dev, 26, 0x82); - rt2800_rfcsr_write(rt2x00dev, 28, 0x00); - rt2800_rfcsr_write(rt2x00dev, 29, 0x10); - rt2800_rfcsr_write(rt2x00dev, 33, 0xC0); - rt2800_rfcsr_write(rt2x00dev, 34, 0x07); - rt2800_rfcsr_write(rt2x00dev, 35, 0x12); - rt2800_rfcsr_write(rt2x00dev, 47, 0x0C); - rt2800_rfcsr_write(rt2x00dev, 53, 0x22); - rt2800_rfcsr_write(rt2x00dev, 63, 0x07); - - rt2800_rfcsr_write(rt2x00dev, 2, 0x80); - msleep(1); - - rt2800_adjust_freq_offset(rt2x00dev); - - /* Enable DC filter */ - if (rt2x00_rt_rev_gte(rt2x00dev, RT5592, REV_RT5592C)) - rt2800_bbp_write(rt2x00dev, 103, 0xc0); - - rt2800_normal_mode_setup_5xxx(rt2x00dev); - - if (rt2x00_rt_rev_lt(rt2x00dev, RT5592, REV_RT5592C)) - rt2800_rfcsr_write(rt2x00dev, 27, 0x03); - - rt2800_led_open_drain_enable(rt2x00dev); -} - -static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev) -{ - if (rt2800_is_305x_soc(rt2x00dev)) { - rt2800_init_rfcsr_305x_soc(rt2x00dev); - return; - } - - switch (rt2x00dev->chip.rt) { - case RT3070: - case RT3071: - case RT3090: - rt2800_init_rfcsr_30xx(rt2x00dev); - break; - case RT3290: - rt2800_init_rfcsr_3290(rt2x00dev); - break; - case RT3352: - rt2800_init_rfcsr_3352(rt2x00dev); - break; - case RT3390: - rt2800_init_rfcsr_3390(rt2x00dev); - break; - case RT3572: - rt2800_init_rfcsr_3572(rt2x00dev); - break; - case RT5390: - rt2800_init_rfcsr_5390(rt2x00dev); - break; - case RT5392: - rt2800_init_rfcsr_5392(rt2x00dev); - break; - case RT5592: - rt2800_init_rfcsr_5592(rt2x00dev); - break; - } -} - -int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - u16 word; - - /* - * Initialize all registers. - */ - if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev) || - rt2800_init_registers(rt2x00dev))) - return -EIO; - - if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev))) - return -EIO; - - /* - * Send signal to firmware during boot time. - */ - rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0); - rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); - if (rt2x00_is_usb(rt2x00dev)) - rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0); - rt2800_mcu_request(rt2x00dev, MCU_BOOT_SIGNAL, 0, 0, 0); - msleep(1); - - if (unlikely(rt2800_wait_bbp_ready(rt2x00dev))) - return -EIO; - - rt2800_init_bbp(rt2x00dev); - rt2800_init_rfcsr(rt2x00dev); - - if (rt2x00_is_usb(rt2x00dev) && - (rt2x00_rt(rt2x00dev, RT3070) || - rt2x00_rt(rt2x00dev, RT3071) || - rt2x00_rt(rt2x00dev, RT3572))) { - udelay(200); - rt2800_mcu_request(rt2x00dev, MCU_CURRENT, 0, 0, 0); - udelay(10); - } - - /* - * Enable RX. - */ - rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); - rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 1); - rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 0); - rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); - - udelay(50); - - rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, ®); - rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_TX_DMA, 1); - rt2x00_set_field32(®, WPDMA_GLO_CFG_ENABLE_RX_DMA, 1); - rt2x00_set_field32(®, WPDMA_GLO_CFG_WP_DMA_BURST_SIZE, 2); - rt2x00_set_field32(®, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1); - rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg); - - rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); - rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 1); - rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 1); - rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); - - /* - * Initialize LED control - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_LED_AG_CONF, &word); - rt2800_mcu_request(rt2x00dev, MCU_LED_AG_CONF, 0xff, - word & 0xff, (word >> 8) & 0xff); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_LED_ACT_CONF, &word); - rt2800_mcu_request(rt2x00dev, MCU_LED_ACT_CONF, 0xff, - word & 0xff, (word >> 8) & 0xff); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_LED_POLARITY, &word); - rt2800_mcu_request(rt2x00dev, MCU_LED_LED_POLARITY, 0xff, - word & 0xff, (word >> 8) & 0xff); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2800_enable_radio); - -void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - rt2800_disable_wpdma(rt2x00dev); - - /* Wait for DMA, ignore error */ - rt2800_wait_wpdma_ready(rt2x00dev); - - rt2800_register_read(rt2x00dev, MAC_SYS_CTRL, ®); - rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_TX, 0); - rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 0); - rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg); -} -EXPORT_SYMBOL_GPL(rt2800_disable_radio); - -int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - u16 efuse_ctrl_reg; - - if (rt2x00_rt(rt2x00dev, RT3290)) - efuse_ctrl_reg = EFUSE_CTRL_3290; - else - efuse_ctrl_reg = EFUSE_CTRL; - - rt2800_register_read(rt2x00dev, efuse_ctrl_reg, ®); - return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT); -} -EXPORT_SYMBOL_GPL(rt2800_efuse_detect); - -static void rt2800_efuse_read(struct rt2x00_dev *rt2x00dev, unsigned int i) -{ - u32 reg; - u16 efuse_ctrl_reg; - u16 efuse_data0_reg; - u16 efuse_data1_reg; - u16 efuse_data2_reg; - u16 efuse_data3_reg; - - if (rt2x00_rt(rt2x00dev, RT3290)) { - efuse_ctrl_reg = EFUSE_CTRL_3290; - efuse_data0_reg = EFUSE_DATA0_3290; - efuse_data1_reg = EFUSE_DATA1_3290; - efuse_data2_reg = EFUSE_DATA2_3290; - efuse_data3_reg = EFUSE_DATA3_3290; - } else { - efuse_ctrl_reg = EFUSE_CTRL; - efuse_data0_reg = EFUSE_DATA0; - efuse_data1_reg = EFUSE_DATA1; - efuse_data2_reg = EFUSE_DATA2; - efuse_data3_reg = EFUSE_DATA3; - } - mutex_lock(&rt2x00dev->csr_mutex); - - rt2800_register_read_lock(rt2x00dev, efuse_ctrl_reg, ®); - rt2x00_set_field32(®, EFUSE_CTRL_ADDRESS_IN, i); - rt2x00_set_field32(®, EFUSE_CTRL_MODE, 0); - rt2x00_set_field32(®, EFUSE_CTRL_KICK, 1); - rt2800_register_write_lock(rt2x00dev, efuse_ctrl_reg, reg); - - /* Wait until the EEPROM has been loaded */ - rt2800_regbusy_read(rt2x00dev, efuse_ctrl_reg, EFUSE_CTRL_KICK, ®); - /* Apparently the data is read from end to start */ - rt2800_register_read_lock(rt2x00dev, efuse_data3_reg, ®); - /* The returned value is in CPU order, but eeprom is le */ - *(u32 *)&rt2x00dev->eeprom[i] = cpu_to_le32(reg); - rt2800_register_read_lock(rt2x00dev, efuse_data2_reg, ®); - *(u32 *)&rt2x00dev->eeprom[i + 2] = cpu_to_le32(reg); - rt2800_register_read_lock(rt2x00dev, efuse_data1_reg, ®); - *(u32 *)&rt2x00dev->eeprom[i + 4] = cpu_to_le32(reg); - rt2800_register_read_lock(rt2x00dev, efuse_data0_reg, ®); - *(u32 *)&rt2x00dev->eeprom[i + 6] = cpu_to_le32(reg); - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -int rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - - for (i = 0; i < EEPROM_SIZE / sizeof(u16); i += 8) - rt2800_efuse_read(rt2x00dev, i); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2800_read_eeprom_efuse); - -static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev) -{ - struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; - u16 word; - u8 *mac; - u8 default_lna_gain; - int retval; - - /* - * Read the EEPROM. - */ - retval = rt2800_read_eeprom(rt2x00dev); - if (retval) - return retval; - - /* - * Start validation of the data that has been read. - */ - mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0); - if (!is_valid_ether_addr(mac)) { - eth_random_addr(mac); - rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RXPATH, 2); - rt2x00_set_field16(&word, EEPROM_NIC_CONF0_TXPATH, 1); - rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF2820); - rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word); - rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word); - } else if (rt2x00_rt(rt2x00dev, RT2860) || - rt2x00_rt(rt2x00dev, RT2872)) { - /* - * There is a max of 2 RX streams for RT28x0 series - */ - if (rt2x00_get_field16(word, EEPROM_NIC_CONF0_RXPATH) > 2) - rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RXPATH, 2); - rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_HW_RADIO, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_EXTERNAL_TX_ALC, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_EXTERNAL_LNA_2G, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_EXTERNAL_LNA_5G, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_CARDBUS_ACCEL, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_BW40M_SB_2G, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_BW40M_SB_5G, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_WPS_PBC, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_BW40M_2G, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_BW40M_5G, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_BROADBAND_EXT_LNA, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_ANT_DIVERSITY, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_INTERNAL_TX_ALC, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_BT_COEXIST, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CONF1_DAC_TEST, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF1, word); - rt2x00_eeprom_dbg(rt2x00dev, "NIC: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &word); - if ((word & 0x00ff) == 0x00ff) { - rt2x00_set_field16(&word, EEPROM_FREQ_OFFSET, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word); - rt2x00_eeprom_dbg(rt2x00dev, "Freq: 0x%04x\n", word); - } - if ((word & 0xff00) == 0xff00) { - rt2x00_set_field16(&word, EEPROM_FREQ_LED_MODE, - LED_MODE_TXRX_ACTIVITY); - rt2x00_set_field16(&word, EEPROM_FREQ_LED_POLARITY, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word); - rt2x00_eeprom_write(rt2x00dev, EEPROM_LED_AG_CONF, 0x5555); - rt2x00_eeprom_write(rt2x00dev, EEPROM_LED_ACT_CONF, 0x2221); - rt2x00_eeprom_write(rt2x00dev, EEPROM_LED_POLARITY, 0xa9f8); - rt2x00_eeprom_dbg(rt2x00dev, "Led Mode: 0x%04x\n", word); - } - - /* - * During the LNA validation we are going to use - * lna0 as correct value. Note that EEPROM_LNA - * is never validated. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_LNA, &word); - default_lna_gain = rt2x00_get_field16(word, EEPROM_LNA_A0); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG, &word); - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET0)) > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET0, 0); - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG_OFFSET1)) > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_BG_OFFSET1, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG, word); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &word); - if ((word & 0x00ff) != 0x00ff) { - drv_data->txmixer_gain_24g = - rt2x00_get_field16(word, EEPROM_TXMIXER_GAIN_BG_VAL); - } else { - drv_data->txmixer_gain_24g = 0; - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word); - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0); - if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 || - rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff) - rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1, - default_lna_gain); - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_BG2, word); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_A, &word); - if ((word & 0x00ff) != 0x00ff) { - drv_data->txmixer_gain_5g = - rt2x00_get_field16(word, EEPROM_TXMIXER_GAIN_A_VAL); - } else { - drv_data->txmixer_gain_5g = 0; - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A, &word); - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET0)) > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET0, 0); - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A_OFFSET1)) > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_A_OFFSET1, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A, word); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word); - if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0); - if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 || - rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff) - rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2, - default_lna_gain); - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word); - - return 0; -} - -static int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev) -{ - u16 value; - u16 eeprom; - u16 rf; - - /* - * Read EEPROM word for configuration. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); - - /* - * Identify RF chipset by EEPROM value - * RT28xx/RT30xx: defined in "EEPROM_NIC_CONF0_RF_TYPE" field - * RT53xx: defined in "EEPROM_CHIP_ID" field - */ - if (rt2x00_rt(rt2x00dev, RT3290) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392)) - rt2x00_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf); - else - rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE); - - switch (rf) { - case RF2820: - case RF2850: - case RF2720: - case RF2750: - case RF3020: - case RF2020: - case RF3021: - case RF3022: - case RF3052: - case RF3290: - case RF3320: - case RF3322: - case RF5360: - case RF5370: - case RF5372: - case RF5390: - case RF5392: - case RF5592: - break; - default: - rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n", - rf); - return -ENODEV; - } - - rt2x00_set_rf(rt2x00dev, rf); - - /* - * Identify default antenna configuration. - */ - rt2x00dev->default_ant.tx_chain_num = - rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH); - rt2x00dev->default_ant.rx_chain_num = - rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH); - - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1, &eeprom); - - if (rt2x00_rt(rt2x00dev, RT3070) || - rt2x00_rt(rt2x00dev, RT3090) || - rt2x00_rt(rt2x00dev, RT3352) || - rt2x00_rt(rt2x00dev, RT3390)) { - value = rt2x00_get_field16(eeprom, - EEPROM_NIC_CONF1_ANT_DIVERSITY); - switch (value) { - case 0: - case 1: - case 2: - rt2x00dev->default_ant.tx = ANTENNA_A; - rt2x00dev->default_ant.rx = ANTENNA_A; - break; - case 3: - rt2x00dev->default_ant.tx = ANTENNA_A; - rt2x00dev->default_ant.rx = ANTENNA_B; - break; - } - } else { - rt2x00dev->default_ant.tx = ANTENNA_A; - rt2x00dev->default_ant.rx = ANTENNA_A; - } - - if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390R)) { - rt2x00dev->default_ant.tx = ANTENNA_HW_DIVERSITY; /* Unused */ - rt2x00dev->default_ant.rx = ANTENNA_HW_DIVERSITY; /* Unused */ - } - - /* - * Determine external LNA informations. - */ - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_5G)) - __set_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags); - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_EXTERNAL_LNA_2G)) - __set_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags); - - /* - * Detect if this device has an hardware controlled radio. - */ - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_HW_RADIO)) - __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); - - /* - * Detect if this device has Bluetooth co-existence. - */ - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_BT_COEXIST)) - __set_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags); - - /* - * Read frequency offset and RF programming sequence. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom); - rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET); - - /* - * Store led settings, for correct led behaviour. - */ -#ifdef CONFIG_RT2X00_LIB_LEDS - rt2800_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO); - rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC); - rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY); - - rt2x00dev->led_mcu_reg = eeprom; -#endif /* CONFIG_RT2X00_LIB_LEDS */ - - /* - * Check if support EIRP tx power limit feature. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_EIRP_MAX_TX_POWER, &eeprom); - - if (rt2x00_get_field16(eeprom, EEPROM_EIRP_MAX_TX_POWER_2GHZ) < - EIRP_MAX_TX_POWER_LIMIT) - __set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags); - - return 0; -} - -/* - * RF value list for rt28xx - * Supports: 2.4 GHz (all) & 5.2 GHz (RF2850 & RF2750) - */ -static const struct rf_channel rf_vals[] = { - { 1, 0x18402ecc, 0x184c0786, 0x1816b455, 0x1800510b }, - { 2, 0x18402ecc, 0x184c0786, 0x18168a55, 0x1800519f }, - { 3, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800518b }, - { 4, 0x18402ecc, 0x184c078a, 0x18168a55, 0x1800519f }, - { 5, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800518b }, - { 6, 0x18402ecc, 0x184c078e, 0x18168a55, 0x1800519f }, - { 7, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800518b }, - { 8, 0x18402ecc, 0x184c0792, 0x18168a55, 0x1800519f }, - { 9, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800518b }, - { 10, 0x18402ecc, 0x184c0796, 0x18168a55, 0x1800519f }, - { 11, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800518b }, - { 12, 0x18402ecc, 0x184c079a, 0x18168a55, 0x1800519f }, - { 13, 0x18402ecc, 0x184c079e, 0x18168a55, 0x1800518b }, - { 14, 0x18402ecc, 0x184c07a2, 0x18168a55, 0x18005193 }, - - /* 802.11 UNI / HyperLan 2 */ - { 36, 0x18402ecc, 0x184c099a, 0x18158a55, 0x180ed1a3 }, - { 38, 0x18402ecc, 0x184c099e, 0x18158a55, 0x180ed193 }, - { 40, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed183 }, - { 44, 0x18402ec8, 0x184c0682, 0x18158a55, 0x180ed1a3 }, - { 46, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed18b }, - { 48, 0x18402ec8, 0x184c0686, 0x18158a55, 0x180ed19b }, - { 52, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed193 }, - { 54, 0x18402ec8, 0x184c068a, 0x18158a55, 0x180ed1a3 }, - { 56, 0x18402ec8, 0x184c068e, 0x18158a55, 0x180ed18b }, - { 60, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed183 }, - { 62, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed193 }, - { 64, 0x18402ec8, 0x184c0692, 0x18158a55, 0x180ed1a3 }, - - /* 802.11 HyperLan 2 */ - { 100, 0x18402ec8, 0x184c06b2, 0x18178a55, 0x180ed783 }, - { 102, 0x18402ec8, 0x184c06b2, 0x18578a55, 0x180ed793 }, - { 104, 0x18402ec8, 0x185c06b2, 0x18578a55, 0x180ed1a3 }, - { 108, 0x18402ecc, 0x185c0a32, 0x18578a55, 0x180ed193 }, - { 110, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed183 }, - { 112, 0x18402ecc, 0x184c0a36, 0x18178a55, 0x180ed19b }, - { 116, 0x18402ecc, 0x184c0a3a, 0x18178a55, 0x180ed1a3 }, - { 118, 0x18402ecc, 0x184c0a3e, 0x18178a55, 0x180ed193 }, - { 120, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed183 }, - { 124, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed193 }, - { 126, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed15b }, - { 128, 0x18402ec4, 0x184c0382, 0x18178a55, 0x180ed1a3 }, - { 132, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed18b }, - { 134, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed193 }, - { 136, 0x18402ec4, 0x184c0386, 0x18178a55, 0x180ed19b }, - { 140, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed183 }, - - /* 802.11 UNII */ - { 149, 0x18402ec4, 0x184c038a, 0x18178a55, 0x180ed1a7 }, - { 151, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed187 }, - { 153, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed18f }, - { 157, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed19f }, - { 159, 0x18402ec4, 0x184c038e, 0x18178a55, 0x180ed1a7 }, - { 161, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed187 }, - { 165, 0x18402ec4, 0x184c0392, 0x18178a55, 0x180ed197 }, - { 167, 0x18402ec4, 0x184c03d2, 0x18179855, 0x1815531f }, - { 169, 0x18402ec4, 0x184c03d2, 0x18179855, 0x18155327 }, - { 171, 0x18402ec4, 0x184c03d6, 0x18179855, 0x18155307 }, - { 173, 0x18402ec4, 0x184c03d6, 0x18179855, 0x1815530f }, - - /* 802.11 Japan */ - { 184, 0x15002ccc, 0x1500491e, 0x1509be55, 0x150c0a0b }, - { 188, 0x15002ccc, 0x15004922, 0x1509be55, 0x150c0a13 }, - { 192, 0x15002ccc, 0x15004926, 0x1509be55, 0x150c0a1b }, - { 196, 0x15002ccc, 0x1500492a, 0x1509be55, 0x150c0a23 }, - { 208, 0x15002ccc, 0x1500493a, 0x1509be55, 0x150c0a13 }, - { 212, 0x15002ccc, 0x1500493e, 0x1509be55, 0x150c0a1b }, - { 216, 0x15002ccc, 0x15004982, 0x1509be55, 0x150c0a23 }, -}; - -/* - * RF value list for rt3xxx - * Supports: 2.4 GHz (all) & 5.2 GHz (RF3052) - */ -static const struct rf_channel rf_vals_3x[] = { - {1, 241, 2, 2 }, - {2, 241, 2, 7 }, - {3, 242, 2, 2 }, - {4, 242, 2, 7 }, - {5, 243, 2, 2 }, - {6, 243, 2, 7 }, - {7, 244, 2, 2 }, - {8, 244, 2, 7 }, - {9, 245, 2, 2 }, - {10, 245, 2, 7 }, - {11, 246, 2, 2 }, - {12, 246, 2, 7 }, - {13, 247, 2, 2 }, - {14, 248, 2, 4 }, - - /* 802.11 UNI / HyperLan 2 */ - {36, 0x56, 0, 4}, - {38, 0x56, 0, 6}, - {40, 0x56, 0, 8}, - {44, 0x57, 0, 0}, - {46, 0x57, 0, 2}, - {48, 0x57, 0, 4}, - {52, 0x57, 0, 8}, - {54, 0x57, 0, 10}, - {56, 0x58, 0, 0}, - {60, 0x58, 0, 4}, - {62, 0x58, 0, 6}, - {64, 0x58, 0, 8}, - - /* 802.11 HyperLan 2 */ - {100, 0x5b, 0, 8}, - {102, 0x5b, 0, 10}, - {104, 0x5c, 0, 0}, - {108, 0x5c, 0, 4}, - {110, 0x5c, 0, 6}, - {112, 0x5c, 0, 8}, - {116, 0x5d, 0, 0}, - {118, 0x5d, 0, 2}, - {120, 0x5d, 0, 4}, - {124, 0x5d, 0, 8}, - {126, 0x5d, 0, 10}, - {128, 0x5e, 0, 0}, - {132, 0x5e, 0, 4}, - {134, 0x5e, 0, 6}, - {136, 0x5e, 0, 8}, - {140, 0x5f, 0, 0}, - - /* 802.11 UNII */ - {149, 0x5f, 0, 9}, - {151, 0x5f, 0, 11}, - {153, 0x60, 0, 1}, - {157, 0x60, 0, 5}, - {159, 0x60, 0, 7}, - {161, 0x60, 0, 9}, - {165, 0x61, 0, 1}, - {167, 0x61, 0, 3}, - {169, 0x61, 0, 5}, - {171, 0x61, 0, 7}, - {173, 0x61, 0, 9}, -}; - -static const struct rf_channel rf_vals_5592_xtal20[] = { - /* Channel, N, K, mod, R */ - {1, 482, 4, 10, 3}, - {2, 483, 4, 10, 3}, - {3, 484, 4, 10, 3}, - {4, 485, 4, 10, 3}, - {5, 486, 4, 10, 3}, - {6, 487, 4, 10, 3}, - {7, 488, 4, 10, 3}, - {8, 489, 4, 10, 3}, - {9, 490, 4, 10, 3}, - {10, 491, 4, 10, 3}, - {11, 492, 4, 10, 3}, - {12, 493, 4, 10, 3}, - {13, 494, 4, 10, 3}, - {14, 496, 8, 10, 3}, - {36, 172, 8, 12, 1}, - {38, 173, 0, 12, 1}, - {40, 173, 4, 12, 1}, - {42, 173, 8, 12, 1}, - {44, 174, 0, 12, 1}, - {46, 174, 4, 12, 1}, - {48, 174, 8, 12, 1}, - {50, 175, 0, 12, 1}, - {52, 175, 4, 12, 1}, - {54, 175, 8, 12, 1}, - {56, 176, 0, 12, 1}, - {58, 176, 4, 12, 1}, - {60, 176, 8, 12, 1}, - {62, 177, 0, 12, 1}, - {64, 177, 4, 12, 1}, - {100, 183, 4, 12, 1}, - {102, 183, 8, 12, 1}, - {104, 184, 0, 12, 1}, - {106, 184, 4, 12, 1}, - {108, 184, 8, 12, 1}, - {110, 185, 0, 12, 1}, - {112, 185, 4, 12, 1}, - {114, 185, 8, 12, 1}, - {116, 186, 0, 12, 1}, - {118, 186, 4, 12, 1}, - {120, 186, 8, 12, 1}, - {122, 187, 0, 12, 1}, - {124, 187, 4, 12, 1}, - {126, 187, 8, 12, 1}, - {128, 188, 0, 12, 1}, - {130, 188, 4, 12, 1}, - {132, 188, 8, 12, 1}, - {134, 189, 0, 12, 1}, - {136, 189, 4, 12, 1}, - {138, 189, 8, 12, 1}, - {140, 190, 0, 12, 1}, - {149, 191, 6, 12, 1}, - {151, 191, 10, 12, 1}, - {153, 192, 2, 12, 1}, - {155, 192, 6, 12, 1}, - {157, 192, 10, 12, 1}, - {159, 193, 2, 12, 1}, - {161, 193, 6, 12, 1}, - {165, 194, 2, 12, 1}, - {184, 164, 0, 12, 1}, - {188, 164, 4, 12, 1}, - {192, 165, 8, 12, 1}, - {196, 166, 0, 12, 1}, -}; - -static const struct rf_channel rf_vals_5592_xtal40[] = { - /* Channel, N, K, mod, R */ - {1, 241, 2, 10, 3}, - {2, 241, 7, 10, 3}, - {3, 242, 2, 10, 3}, - {4, 242, 7, 10, 3}, - {5, 243, 2, 10, 3}, - {6, 243, 7, 10, 3}, - {7, 244, 2, 10, 3}, - {8, 244, 7, 10, 3}, - {9, 245, 2, 10, 3}, - {10, 245, 7, 10, 3}, - {11, 246, 2, 10, 3}, - {12, 246, 7, 10, 3}, - {13, 247, 2, 10, 3}, - {14, 248, 4, 10, 3}, - {36, 86, 4, 12, 1}, - {38, 86, 6, 12, 1}, - {40, 86, 8, 12, 1}, - {42, 86, 10, 12, 1}, - {44, 87, 0, 12, 1}, - {46, 87, 2, 12, 1}, - {48, 87, 4, 12, 1}, - {50, 87, 6, 12, 1}, - {52, 87, 8, 12, 1}, - {54, 87, 10, 12, 1}, - {56, 88, 0, 12, 1}, - {58, 88, 2, 12, 1}, - {60, 88, 4, 12, 1}, - {62, 88, 6, 12, 1}, - {64, 88, 8, 12, 1}, - {100, 91, 8, 12, 1}, - {102, 91, 10, 12, 1}, - {104, 92, 0, 12, 1}, - {106, 92, 2, 12, 1}, - {108, 92, 4, 12, 1}, - {110, 92, 6, 12, 1}, - {112, 92, 8, 12, 1}, - {114, 92, 10, 12, 1}, - {116, 93, 0, 12, 1}, - {118, 93, 2, 12, 1}, - {120, 93, 4, 12, 1}, - {122, 93, 6, 12, 1}, - {124, 93, 8, 12, 1}, - {126, 93, 10, 12, 1}, - {128, 94, 0, 12, 1}, - {130, 94, 2, 12, 1}, - {132, 94, 4, 12, 1}, - {134, 94, 6, 12, 1}, - {136, 94, 8, 12, 1}, - {138, 94, 10, 12, 1}, - {140, 95, 0, 12, 1}, - {149, 95, 9, 12, 1}, - {151, 95, 11, 12, 1}, - {153, 96, 1, 12, 1}, - {155, 96, 3, 12, 1}, - {157, 96, 5, 12, 1}, - {159, 96, 7, 12, 1}, - {161, 96, 9, 12, 1}, - {165, 97, 1, 12, 1}, - {184, 82, 0, 12, 1}, - {188, 82, 4, 12, 1}, - {192, 82, 8, 12, 1}, - {196, 83, 0, 12, 1}, -}; - -static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) -{ - struct hw_mode_spec *spec = &rt2x00dev->spec; - struct channel_info *info; - char *default_power1; - char *default_power2; - unsigned int i; - u16 eeprom; - u32 reg; - - /* - * Disable powersaving as default on PCI devices. - */ - if (rt2x00_is_pci(rt2x00dev) || rt2x00_is_soc(rt2x00dev)) - rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; - - /* - * Initialize all hw fields. - */ - rt2x00dev->hw->flags = - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_PS_NULLFUNC_STACK | - IEEE80211_HW_AMPDU_AGGREGATION | - IEEE80211_HW_REPORTS_TX_ACK_STATUS | - IEEE80211_HW_SUPPORTS_HT_CCK_RATES; - - /* - * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices - * unless we are capable of sending the buffered frames out after the - * DTIM transmission using rt2x00lib_beacondone. This will send out - * multicast and broadcast traffic immediately instead of buffering it - * infinitly and thus dropping it after some time. - */ - if (!rt2x00_is_usb(rt2x00dev)) - rt2x00dev->hw->flags |= - IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING; - - SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); - SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, - rt2x00_eeprom_addr(rt2x00dev, - EEPROM_MAC_ADDR_0)); - - /* - * As rt2800 has a global fallback table we cannot specify - * more then one tx rate per frame but since the hw will - * try several rates (based on the fallback table) we should - * initialize max_report_rates to the maximum number of rates - * we are going to try. Otherwise mac80211 will truncate our - * reported tx rates and the rc algortihm will end up with - * incorrect data. - */ - rt2x00dev->hw->max_rates = 1; - rt2x00dev->hw->max_report_rates = 7; - rt2x00dev->hw->max_rate_tries = 1; - - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0, &eeprom); - - /* - * Initialize hw_mode information. - */ - spec->supported_bands = SUPPORT_BAND_2GHZ; - spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; - - if (rt2x00_rf(rt2x00dev, RF2820) || - rt2x00_rf(rt2x00dev, RF2720)) { - spec->num_channels = 14; - spec->channels = rf_vals; - } else if (rt2x00_rf(rt2x00dev, RF2850) || - rt2x00_rf(rt2x00dev, RF2750)) { - spec->supported_bands |= SUPPORT_BAND_5GHZ; - spec->num_channels = ARRAY_SIZE(rf_vals); - spec->channels = rf_vals; - } else if (rt2x00_rf(rt2x00dev, RF3020) || - rt2x00_rf(rt2x00dev, RF2020) || - rt2x00_rf(rt2x00dev, RF3021) || - rt2x00_rf(rt2x00dev, RF3022) || - rt2x00_rf(rt2x00dev, RF3290) || - rt2x00_rf(rt2x00dev, RF3320) || - rt2x00_rf(rt2x00dev, RF3322) || - rt2x00_rf(rt2x00dev, RF5360) || - rt2x00_rf(rt2x00dev, RF5370) || - rt2x00_rf(rt2x00dev, RF5372) || - rt2x00_rf(rt2x00dev, RF5390) || - rt2x00_rf(rt2x00dev, RF5392)) { - spec->num_channels = 14; - spec->channels = rf_vals_3x; - } else if (rt2x00_rf(rt2x00dev, RF3052)) { - spec->supported_bands |= SUPPORT_BAND_5GHZ; - spec->num_channels = ARRAY_SIZE(rf_vals_3x); - spec->channels = rf_vals_3x; - } else if (rt2x00_rf(rt2x00dev, RF5592)) { - spec->supported_bands |= SUPPORT_BAND_5GHZ; - - rt2800_register_read(rt2x00dev, MAC_DEBUG_INDEX, ®); - if (rt2x00_get_field32(reg, MAC_DEBUG_INDEX_XTAL)) { - spec->num_channels = ARRAY_SIZE(rf_vals_5592_xtal40); - spec->channels = rf_vals_5592_xtal40; - } else { - spec->num_channels = ARRAY_SIZE(rf_vals_5592_xtal20); - spec->channels = rf_vals_5592_xtal20; - } - } - - if (WARN_ON_ONCE(!spec->channels)) - return -ENODEV; - - /* - * Initialize HT information. - */ - if (!rt2x00_rf(rt2x00dev, RF2020)) - spec->ht.ht_supported = true; - else - spec->ht.ht_supported = false; - - spec->ht.cap = - IEEE80211_HT_CAP_SUP_WIDTH_20_40 | - IEEE80211_HT_CAP_GRN_FLD | - IEEE80211_HT_CAP_SGI_20 | - IEEE80211_HT_CAP_SGI_40; - - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) >= 2) - spec->ht.cap |= IEEE80211_HT_CAP_TX_STBC; - - spec->ht.cap |= - rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH) << - IEEE80211_HT_CAP_RX_STBC_SHIFT; - - spec->ht.ampdu_factor = 3; - spec->ht.ampdu_density = 4; - spec->ht.mcs.tx_params = - IEEE80211_HT_MCS_TX_DEFINED | - IEEE80211_HT_MCS_TX_RX_DIFF | - ((rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_TXPATH) - 1) << - IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT); - - switch (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RXPATH)) { - case 3: - spec->ht.mcs.rx_mask[2] = 0xff; - case 2: - spec->ht.mcs.rx_mask[1] = 0xff; - case 1: - spec->ht.mcs.rx_mask[0] = 0xff; - spec->ht.mcs.rx_mask[4] = 0x1; /* MCS32 */ - break; - } - - /* - * Create channel information array - */ - info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); - if (!info) - return -ENOMEM; - - spec->channels_info = info; - - default_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1); - default_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2); - - for (i = 0; i < 14; i++) { - info[i].default_power1 = default_power1[i]; - info[i].default_power2 = default_power2[i]; - } - - if (spec->num_channels > 14) { - default_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1); - default_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2); - - for (i = 14; i < spec->num_channels; i++) { - info[i].default_power1 = default_power1[i - 14]; - info[i].default_power2 = default_power2[i - 14]; - } - } - - switch (rt2x00dev->chip.rf) { - case RF2020: - case RF3020: - case RF3021: - case RF3022: - case RF3320: - case RF3052: - case RF3290: - case RF5360: - case RF5370: - case RF5372: - case RF5390: - case RF5392: - __set_bit(CAPABILITY_VCO_RECALIBRATION, &rt2x00dev->cap_flags); - break; - } - - return 0; -} - -static int rt2800_probe_rt(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - u32 rt; - u32 rev; - - if (rt2x00_rt(rt2x00dev, RT3290)) - rt2800_register_read(rt2x00dev, MAC_CSR0_3290, ®); - else - rt2800_register_read(rt2x00dev, MAC_CSR0, ®); - - rt = rt2x00_get_field32(reg, MAC_CSR0_CHIPSET); - rev = rt2x00_get_field32(reg, MAC_CSR0_REVISION); - - switch (rt) { - case RT2860: - case RT2872: - case RT2883: - case RT3070: - case RT3071: - case RT3090: - case RT3290: - case RT3352: - case RT3390: - case RT3572: - case RT5390: - case RT5392: - case RT5592: - break; - default: - rt2x00_err(rt2x00dev, "Invalid RT chipset 0x%04x, rev %04x detected\n", - rt, rev); - return -ENODEV; - } - - rt2x00_set_rt(rt2x00dev, rt, rev); - - return 0; -} - -int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev) -{ - int retval; - u32 reg; - - retval = rt2800_probe_rt(rt2x00dev); - if (retval) - return retval; - - /* - * Allocate eeprom data. - */ - retval = rt2800_validate_eeprom(rt2x00dev); - if (retval) - return retval; - - retval = rt2800_init_eeprom(rt2x00dev); - if (retval) - return retval; - - /* - * Enable rfkill polling by setting GPIO direction of the - * rfkill switch GPIO pin correctly. - */ - rt2800_register_read(rt2x00dev, GPIO_CTRL, ®); - rt2x00_set_field32(®, GPIO_CTRL_DIR2, 1); - rt2800_register_write(rt2x00dev, GPIO_CTRL, reg); - - /* - * Initialize hw specifications. - */ - retval = rt2800_probe_hw_mode(rt2x00dev); - if (retval) - return retval; - - /* - * Set device capabilities. - */ - __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags); - __set_bit(CAPABILITY_CONTROL_FILTER_PSPOLL, &rt2x00dev->cap_flags); - if (!rt2x00_is_usb(rt2x00dev)) - __set_bit(CAPABILITY_PRE_TBTT_INTERRUPT, &rt2x00dev->cap_flags); - - /* - * Set device requirements. - */ - if (!rt2x00_is_soc(rt2x00dev)) - __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags); - __set_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags); - __set_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags); - if (!rt2800_hwcrypt_disabled(rt2x00dev)) - __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags); - __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags); - __set_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags); - if (rt2x00_is_usb(rt2x00dev)) - __set_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags); - else { - __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags); - __set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags); - } - - /* - * Set the rssi offset. - */ - rt2x00dev->rssi_offset = DEFAULT_RSSI_OFFSET; - - return 0; -} -EXPORT_SYMBOL_GPL(rt2800_probe_hw); - -/* - * IEEE80211 stack callback functions. - */ -void rt2800_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx, u32 *iv32, - u16 *iv16) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct mac_iveiv_entry iveiv_entry; - u32 offset; - - offset = MAC_IVEIV_ENTRY(hw_key_idx); - rt2800_register_multiread(rt2x00dev, offset, - &iveiv_entry, sizeof(iveiv_entry)); - - memcpy(iv16, &iveiv_entry.iv[0], sizeof(*iv16)); - memcpy(iv32, &iveiv_entry.iv[4], sizeof(*iv32)); -} -EXPORT_SYMBOL_GPL(rt2800_get_tkip_seq); - -int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - u32 reg; - bool enabled = (value < IEEE80211_MAX_RTS_THRESHOLD); - - rt2800_register_read(rt2x00dev, TX_RTS_CFG, ®); - rt2x00_set_field32(®, TX_RTS_CFG_RTS_THRES, value); - rt2800_register_write(rt2x00dev, TX_RTS_CFG, reg); - - rt2800_register_read(rt2x00dev, CCK_PROT_CFG, ®); - rt2x00_set_field32(®, CCK_PROT_CFG_RTS_TH_EN, enabled); - rt2800_register_write(rt2x00dev, CCK_PROT_CFG, reg); - - rt2800_register_read(rt2x00dev, OFDM_PROT_CFG, ®); - rt2x00_set_field32(®, OFDM_PROT_CFG_RTS_TH_EN, enabled); - rt2800_register_write(rt2x00dev, OFDM_PROT_CFG, reg); - - rt2800_register_read(rt2x00dev, MM20_PROT_CFG, ®); - rt2x00_set_field32(®, MM20_PROT_CFG_RTS_TH_EN, enabled); - rt2800_register_write(rt2x00dev, MM20_PROT_CFG, reg); - - rt2800_register_read(rt2x00dev, MM40_PROT_CFG, ®); - rt2x00_set_field32(®, MM40_PROT_CFG_RTS_TH_EN, enabled); - rt2800_register_write(rt2x00dev, MM40_PROT_CFG, reg); - - rt2800_register_read(rt2x00dev, GF20_PROT_CFG, ®); - rt2x00_set_field32(®, GF20_PROT_CFG_RTS_TH_EN, enabled); - rt2800_register_write(rt2x00dev, GF20_PROT_CFG, reg); - - rt2800_register_read(rt2x00dev, GF40_PROT_CFG, ®); - rt2x00_set_field32(®, GF40_PROT_CFG_RTS_TH_EN, enabled); - rt2800_register_write(rt2x00dev, GF40_PROT_CFG, reg); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2800_set_rts_threshold); - -int rt2800_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue_idx, - const struct ieee80211_tx_queue_params *params) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct data_queue *queue; - struct rt2x00_field32 field; - int retval; - u32 reg; - u32 offset; - - /* - * First pass the configuration through rt2x00lib, that will - * update the queue settings and validate the input. After that - * we are free to update the registers based on the value - * in the queue parameter. - */ - retval = rt2x00mac_conf_tx(hw, vif, queue_idx, params); - if (retval) - return retval; - - /* - * We only need to perform additional register initialization - * for WMM queues/ - */ - if (queue_idx >= 4) - return 0; - - queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx); - - /* Update WMM TXOP register */ - offset = WMM_TXOP0_CFG + (sizeof(u32) * (!!(queue_idx & 2))); - field.bit_offset = (queue_idx & 1) * 16; - field.bit_mask = 0xffff << field.bit_offset; - - rt2800_register_read(rt2x00dev, offset, ®); - rt2x00_set_field32(®, field, queue->txop); - rt2800_register_write(rt2x00dev, offset, reg); - - /* Update WMM registers */ - field.bit_offset = queue_idx * 4; - field.bit_mask = 0xf << field.bit_offset; - - rt2800_register_read(rt2x00dev, WMM_AIFSN_CFG, ®); - rt2x00_set_field32(®, field, queue->aifs); - rt2800_register_write(rt2x00dev, WMM_AIFSN_CFG, reg); - - rt2800_register_read(rt2x00dev, WMM_CWMIN_CFG, ®); - rt2x00_set_field32(®, field, queue->cw_min); - rt2800_register_write(rt2x00dev, WMM_CWMIN_CFG, reg); - - rt2800_register_read(rt2x00dev, WMM_CWMAX_CFG, ®); - rt2x00_set_field32(®, field, queue->cw_max); - rt2800_register_write(rt2x00dev, WMM_CWMAX_CFG, reg); - - /* Update EDCA registers */ - offset = EDCA_AC0_CFG + (sizeof(u32) * queue_idx); - - rt2800_register_read(rt2x00dev, offset, ®); - rt2x00_set_field32(®, EDCA_AC0_CFG_TX_OP, queue->txop); - rt2x00_set_field32(®, EDCA_AC0_CFG_AIFSN, queue->aifs); - rt2x00_set_field32(®, EDCA_AC0_CFG_CWMIN, queue->cw_min); - rt2x00_set_field32(®, EDCA_AC0_CFG_CWMAX, queue->cw_max); - rt2800_register_write(rt2x00dev, offset, reg); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2800_conf_tx); - -u64 rt2800_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - u64 tsf; - u32 reg; - - rt2800_register_read(rt2x00dev, TSF_TIMER_DW1, ®); - tsf = (u64) rt2x00_get_field32(reg, TSF_TIMER_DW1_HIGH_WORD) << 32; - rt2800_register_read(rt2x00dev, TSF_TIMER_DW0, ®); - tsf |= rt2x00_get_field32(reg, TSF_TIMER_DW0_LOW_WORD); - - return tsf; -} -EXPORT_SYMBOL_GPL(rt2800_get_tsf); - -int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, u16 tid, u16 *ssn, - u8 buf_size) -{ - struct rt2x00_sta *sta_priv = (struct rt2x00_sta *)sta->drv_priv; - int ret = 0; - - /* - * Don't allow aggregation for stations the hardware isn't aware - * of because tx status reports for frames to an unknown station - * always contain wcid=255 and thus we can't distinguish between - * multiple stations which leads to unwanted situations when the - * hw reorders frames due to aggregation. - */ - if (sta_priv->wcid < 0) - return 1; - - switch (action) { - case IEEE80211_AMPDU_RX_START: - case IEEE80211_AMPDU_RX_STOP: - /* - * The hw itself takes care of setting up BlockAck mechanisms. - * So, we only have to allow mac80211 to nagotiate a BlockAck - * agreement. Once that is done, the hw will BlockAck incoming - * AMPDUs without further setup. - */ - break; - case IEEE80211_AMPDU_TX_START: - ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); - break; - case IEEE80211_AMPDU_TX_STOP_CONT: - case IEEE80211_AMPDU_TX_STOP_FLUSH: - case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: - ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); - break; - case IEEE80211_AMPDU_TX_OPERATIONAL: - break; - default: - rt2x00_warn((struct rt2x00_dev *)hw->priv, - "Unknown AMPDU action\n"); - } - - return ret; -} -EXPORT_SYMBOL_GPL(rt2800_ampdu_action); - -int rt2800_get_survey(struct ieee80211_hw *hw, int idx, - struct survey_info *survey) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct ieee80211_conf *conf = &hw->conf; - u32 idle, busy, busy_ext; - - if (idx != 0) - return -ENOENT; - - survey->channel = conf->chandef.chan; - - rt2800_register_read(rt2x00dev, CH_IDLE_STA, &idle); - rt2800_register_read(rt2x00dev, CH_BUSY_STA, &busy); - rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC, &busy_ext); - - if (idle || busy) { - survey->filled = SURVEY_INFO_CHANNEL_TIME | - SURVEY_INFO_CHANNEL_TIME_BUSY | - SURVEY_INFO_CHANNEL_TIME_EXT_BUSY; - - survey->channel_time = (idle + busy) / 1000; - survey->channel_time_busy = busy / 1000; - survey->channel_time_ext_busy = busy_ext / 1000; - } - - if (!(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) - survey->filled |= SURVEY_INFO_IN_USE; - - return 0; - -} -EXPORT_SYMBOL_GPL(rt2800_get_survey); - -MODULE_AUTHOR(DRV_PROJECT ", Bartlomiej Zolnierkiewicz"); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION("Ralink RT2800 library"); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h deleted file mode 100644 index 6ec739466db4..000000000000 --- a/drivers/net/wireless/rt2x00/rt2800lib.h +++ /dev/null @@ -1,229 +0,0 @@ -/* - Copyright (C) 2010 Willow Garage - Copyright (C) 2010 Ivo van Doorn - Copyright (C) 2009 Bartlomiej Zolnierkiewicz - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef RT2800LIB_H -#define RT2800LIB_H - -struct rt2800_ops { - void (*register_read)(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, u32 *value); - void (*register_read_lock)(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, u32 *value); - void (*register_write)(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, u32 value); - void (*register_write_lock)(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, u32 value); - - void (*register_multiread)(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - void *value, const u32 length); - void (*register_multiwrite)(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - const void *value, const u32 length); - - int (*regbusy_read)(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - const struct rt2x00_field32 field, u32 *reg); - - int (*read_eeprom)(struct rt2x00_dev *rt2x00dev); - bool (*hwcrypt_disabled)(struct rt2x00_dev *rt2x00dev); - - int (*drv_write_firmware)(struct rt2x00_dev *rt2x00dev, - const u8 *data, const size_t len); - int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev); - __le32 *(*drv_get_txwi)(struct queue_entry *entry); -}; - -static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u32 *value) -{ - const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; - - rt2800ops->register_read(rt2x00dev, offset, value); -} - -static inline void rt2800_register_read_lock(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u32 *value) -{ - const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; - - rt2800ops->register_read_lock(rt2x00dev, offset, value); -} - -static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u32 value) -{ - const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; - - rt2800ops->register_write(rt2x00dev, offset, value); -} - -static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u32 value) -{ - const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; - - rt2800ops->register_write_lock(rt2x00dev, offset, value); -} - -static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - void *value, const u32 length) -{ - const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; - - rt2800ops->register_multiread(rt2x00dev, offset, value, length); -} - -static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - const void *value, - const u32 length) -{ - const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; - - rt2800ops->register_multiwrite(rt2x00dev, offset, value, length); -} - -static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - const struct rt2x00_field32 field, - u32 *reg) -{ - const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; - - return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg); -} - -static inline int rt2800_read_eeprom(struct rt2x00_dev *rt2x00dev) -{ - const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; - - return rt2800ops->read_eeprom(rt2x00dev); -} - -static inline bool rt2800_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev) -{ - const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; - - return rt2800ops->hwcrypt_disabled(rt2x00dev); -} - -static inline int rt2800_drv_write_firmware(struct rt2x00_dev *rt2x00dev, - const u8 *data, const size_t len) -{ - const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; - - return rt2800ops->drv_write_firmware(rt2x00dev, data, len); -} - -static inline int rt2800_drv_init_registers(struct rt2x00_dev *rt2x00dev) -{ - const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv; - - return rt2800ops->drv_init_registers(rt2x00dev); -} - -static inline __le32 *rt2800_drv_get_txwi(struct queue_entry *entry) -{ - const struct rt2800_ops *rt2800ops = entry->queue->rt2x00dev->ops->drv; - - return rt2800ops->drv_get_txwi(entry); -} - -void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, - const u8 command, const u8 token, - const u8 arg0, const u8 arg1); - -int rt2800_wait_csr_ready(struct rt2x00_dev *rt2x00dev); -int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev); - -int rt2800_check_firmware(struct rt2x00_dev *rt2x00dev, - const u8 *data, const size_t len); -int rt2800_load_firmware(struct rt2x00_dev *rt2x00dev, - const u8 *data, const size_t len); - -void rt2800_write_tx_data(struct queue_entry *entry, - struct txentry_desc *txdesc); -void rt2800_process_rxwi(struct queue_entry *entry, struct rxdone_entry_desc *txdesc); - -void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32* txwi); - -void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc); -void rt2800_clear_beacon(struct queue_entry *entry); - -extern const struct rt2x00debug rt2800_rt2x00debug; - -int rt2800_rfkill_poll(struct rt2x00_dev *rt2x00dev); -int rt2800_config_shared_key(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_crypto *crypto, - struct ieee80211_key_conf *key); -int rt2800_config_pairwise_key(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_crypto *crypto, - struct ieee80211_key_conf *key); -int rt2800_sta_add(struct rt2x00_dev *rt2x00dev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); -int rt2800_sta_remove(struct rt2x00_dev *rt2x00dev, int wcid); -void rt2800_config_filter(struct rt2x00_dev *rt2x00dev, - const unsigned int filter_flags); -void rt2800_config_intf(struct rt2x00_dev *rt2x00dev, struct rt2x00_intf *intf, - struct rt2x00intf_conf *conf, const unsigned int flags); -void rt2800_config_erp(struct rt2x00_dev *rt2x00dev, struct rt2x00lib_erp *erp, - u32 changed); -void rt2800_config_ant(struct rt2x00_dev *rt2x00dev, struct antenna_setup *ant); -void rt2800_config(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf, - const unsigned int flags); -void rt2800_link_stats(struct rt2x00_dev *rt2x00dev, struct link_qual *qual); -void rt2800_reset_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual); -void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual, - const u32 count); -void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev); -void rt2800_vco_calibration(struct rt2x00_dev *rt2x00dev); - -int rt2800_enable_radio(struct rt2x00_dev *rt2x00dev); -void rt2800_disable_radio(struct rt2x00_dev *rt2x00dev); - -int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev); -int rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev); - -int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev); - -void rt2800_get_tkip_seq(struct ieee80211_hw *hw, u8 hw_key_idx, u32 *iv32, - u16 *iv16); -int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value); -int rt2800_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue_idx, - const struct ieee80211_tx_queue_params *params); -u64 rt2800_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif); -int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, u16 tid, u16 *ssn, - u8 buf_size); -int rt2800_get_survey(struct ieee80211_hw *hw, int idx, - struct survey_info *survey); -void rt2800_disable_wpdma(struct rt2x00_dev *rt2x00dev); - -#endif /* RT2800LIB_H */ diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c deleted file mode 100644 index 6f4a861af336..000000000000 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ /dev/null @@ -1,1361 +0,0 @@ -/* - Copyright (C) 2009 - 2010 Ivo van Doorn - Copyright (C) 2009 Alban Browaeys - Copyright (C) 2009 Felix Fietkau - Copyright (C) 2009 Luis Correia - Copyright (C) 2009 Mattias Nissler - Copyright (C) 2009 Mark Asselstine - Copyright (C) 2009 Xose Vazquez Perez - Copyright (C) 2009 Bart Zolnierkiewicz - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2800pci - Abstract: rt2800pci device specific routines. - Supported chipsets: RT2800E & RT2800ED. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2x00mmio.h" -#include "rt2x00pci.h" -#include "rt2x00soc.h" -#include "rt2800lib.h" -#include "rt2800.h" -#include "rt2800pci.h" - -/* - * Allow hardware encryption to be disabled. - */ -static bool modparam_nohwcrypt = false; -module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); -MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); - -static bool rt2800pci_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev) -{ - return modparam_nohwcrypt; -} - -static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token) -{ - unsigned int i; - u32 reg; - - /* - * SOC devices don't support MCU requests. - */ - if (rt2x00_is_soc(rt2x00dev)) - return; - - for (i = 0; i < 200; i++) { - rt2x00mmio_register_read(rt2x00dev, H2M_MAILBOX_CID, ®); - - if ((rt2x00_get_field32(reg, H2M_MAILBOX_CID_CMD0) == token) || - (rt2x00_get_field32(reg, H2M_MAILBOX_CID_CMD1) == token) || - (rt2x00_get_field32(reg, H2M_MAILBOX_CID_CMD2) == token) || - (rt2x00_get_field32(reg, H2M_MAILBOX_CID_CMD3) == token)) - break; - - udelay(REGISTER_BUSY_DELAY); - } - - if (i == 200) - rt2x00_err(rt2x00dev, "MCU request failed, no response from hardware\n"); - - rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); - rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); -} - -#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) -static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) -{ - void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); - - if (!base_addr) - return -ENOMEM; - - memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE); - - iounmap(base_addr); - return 0; -} -#else -static inline int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) -{ - return -ENOMEM; -} -#endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */ - -#ifdef CONFIG_PCI -static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom) -{ - struct rt2x00_dev *rt2x00dev = eeprom->data; - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, E2PROM_CSR, ®); - - eeprom->reg_data_in = !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_IN); - eeprom->reg_data_out = !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_OUT); - eeprom->reg_data_clock = - !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_CLOCK); - eeprom->reg_chip_select = - !!rt2x00_get_field32(reg, E2PROM_CSR_CHIP_SELECT); -} - -static void rt2800pci_eepromregister_write(struct eeprom_93cx6 *eeprom) -{ - struct rt2x00_dev *rt2x00dev = eeprom->data; - u32 reg = 0; - - rt2x00_set_field32(®, E2PROM_CSR_DATA_IN, !!eeprom->reg_data_in); - rt2x00_set_field32(®, E2PROM_CSR_DATA_OUT, !!eeprom->reg_data_out); - rt2x00_set_field32(®, E2PROM_CSR_DATA_CLOCK, - !!eeprom->reg_data_clock); - rt2x00_set_field32(®, E2PROM_CSR_CHIP_SELECT, - !!eeprom->reg_chip_select); - - rt2x00mmio_register_write(rt2x00dev, E2PROM_CSR, reg); -} - -static int rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev) -{ - struct eeprom_93cx6 eeprom; - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, E2PROM_CSR, ®); - - eeprom.data = rt2x00dev; - eeprom.register_read = rt2800pci_eepromregister_read; - eeprom.register_write = rt2800pci_eepromregister_write; - switch (rt2x00_get_field32(reg, E2PROM_CSR_TYPE)) - { - case 0: - eeprom.width = PCI_EEPROM_WIDTH_93C46; - break; - case 1: - eeprom.width = PCI_EEPROM_WIDTH_93C66; - break; - default: - eeprom.width = PCI_EEPROM_WIDTH_93C86; - break; - } - eeprom.reg_data_in = 0; - eeprom.reg_data_out = 0; - eeprom.reg_data_clock = 0; - eeprom.reg_chip_select = 0; - - eeprom_93cx6_multiread(&eeprom, EEPROM_BASE, rt2x00dev->eeprom, - EEPROM_SIZE / sizeof(u16)); - - return 0; -} - -static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev) -{ - return rt2800_efuse_detect(rt2x00dev); -} - -static inline int rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) -{ - return rt2800_read_eeprom_efuse(rt2x00dev); -} -#else -static inline int rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev) -{ - return -EOPNOTSUPP; -} - -static inline int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev) -{ - return 0; -} - -static inline int rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) -{ - return -EOPNOTSUPP; -} -#endif /* CONFIG_PCI */ - -/* - * Queue handlers. - */ -static void rt2800pci_start_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_RX: - rt2x00mmio_register_read(rt2x00dev, MAC_SYS_CTRL, ®); - rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 1); - rt2x00mmio_register_write(rt2x00dev, MAC_SYS_CTRL, reg); - break; - case QID_BEACON: - rt2x00mmio_register_read(rt2x00dev, BCN_TIME_CFG, ®); - rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); - rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); - rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); - rt2x00mmio_register_write(rt2x00dev, BCN_TIME_CFG, reg); - - rt2x00mmio_register_read(rt2x00dev, INT_TIMER_EN, ®); - rt2x00_set_field32(®, INT_TIMER_EN_PRE_TBTT_TIMER, 1); - rt2x00mmio_register_write(rt2x00dev, INT_TIMER_EN, reg); - break; - default: - break; - } -} - -static void rt2800pci_kick_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - struct queue_entry *entry; - - switch (queue->qid) { - case QID_AC_VO: - case QID_AC_VI: - case QID_AC_BE: - case QID_AC_BK: - entry = rt2x00queue_get_entry(queue, Q_INDEX); - rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX(queue->qid), - entry->entry_idx); - break; - case QID_MGMT: - entry = rt2x00queue_get_entry(queue, Q_INDEX); - rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX(5), - entry->entry_idx); - break; - default: - break; - } -} - -static void rt2800pci_stop_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_RX: - rt2x00mmio_register_read(rt2x00dev, MAC_SYS_CTRL, ®); - rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 0); - rt2x00mmio_register_write(rt2x00dev, MAC_SYS_CTRL, reg); - break; - case QID_BEACON: - rt2x00mmio_register_read(rt2x00dev, BCN_TIME_CFG, ®); - rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 0); - rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 0); - rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0); - rt2x00mmio_register_write(rt2x00dev, BCN_TIME_CFG, reg); - - rt2x00mmio_register_read(rt2x00dev, INT_TIMER_EN, ®); - rt2x00_set_field32(®, INT_TIMER_EN_PRE_TBTT_TIMER, 0); - rt2x00mmio_register_write(rt2x00dev, INT_TIMER_EN, reg); - - /* - * Wait for current invocation to finish. The tasklet - * won't be scheduled anymore afterwards since we disabled - * the TBTT and PRE TBTT timer. - */ - tasklet_kill(&rt2x00dev->tbtt_tasklet); - tasklet_kill(&rt2x00dev->pretbtt_tasklet); - - break; - default: - break; - } -} - -/* - * Firmware functions - */ -static char *rt2800pci_get_firmware_name(struct rt2x00_dev *rt2x00dev) -{ - /* - * Chip rt3290 use specific 4KB firmware named rt3290.bin. - */ - if (rt2x00_rt(rt2x00dev, RT3290)) - return FIRMWARE_RT3290; - else - return FIRMWARE_RT2860; -} - -static int rt2800pci_write_firmware(struct rt2x00_dev *rt2x00dev, - const u8 *data, const size_t len) -{ - u32 reg; - - /* - * enable Host program ram write selection - */ - reg = 0; - rt2x00_set_field32(®, PBF_SYS_CTRL_HOST_RAM_WRITE, 1); - rt2x00mmio_register_write(rt2x00dev, PBF_SYS_CTRL, reg); - - /* - * Write firmware to device. - */ - rt2x00mmio_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, - data, len); - - rt2x00mmio_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000); - rt2x00mmio_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00001); - - rt2x00mmio_register_write(rt2x00dev, H2M_BBP_AGENT, 0); - rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); - - return 0; -} - -/* - * Initialization functions. - */ -static bool rt2800pci_get_entry_state(struct queue_entry *entry) -{ - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - u32 word; - - if (entry->queue->qid == QID_RX) { - rt2x00_desc_read(entry_priv->desc, 1, &word); - - return (!rt2x00_get_field32(word, RXD_W1_DMA_DONE)); - } else { - rt2x00_desc_read(entry_priv->desc, 1, &word); - - return (!rt2x00_get_field32(word, TXD_W1_DMA_DONE)); - } -} - -static void rt2800pci_clear_entry(struct queue_entry *entry) -{ - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - u32 word; - - if (entry->queue->qid == QID_RX) { - rt2x00_desc_read(entry_priv->desc, 0, &word); - rt2x00_set_field32(&word, RXD_W0_SDP0, skbdesc->skb_dma); - rt2x00_desc_write(entry_priv->desc, 0, word); - - rt2x00_desc_read(entry_priv->desc, 1, &word); - rt2x00_set_field32(&word, RXD_W1_DMA_DONE, 0); - rt2x00_desc_write(entry_priv->desc, 1, word); - - /* - * Set RX IDX in register to inform hardware that we have - * handled this entry and it is available for reuse again. - */ - rt2x00mmio_register_write(rt2x00dev, RX_CRX_IDX, - entry->entry_idx); - } else { - rt2x00_desc_read(entry_priv->desc, 1, &word); - rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 1); - rt2x00_desc_write(entry_priv->desc, 1, word); - } -} - -static int rt2800pci_init_queues(struct rt2x00_dev *rt2x00dev) -{ - struct queue_entry_priv_mmio *entry_priv; - - /* - * Initialize registers. - */ - entry_priv = rt2x00dev->tx[0].entries[0].priv_data; - rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR0, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT0, - rt2x00dev->tx[0].limit); - rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX0, 0); - rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX0, 0); - - entry_priv = rt2x00dev->tx[1].entries[0].priv_data; - rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR1, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT1, - rt2x00dev->tx[1].limit); - rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX1, 0); - rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX1, 0); - - entry_priv = rt2x00dev->tx[2].entries[0].priv_data; - rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR2, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT2, - rt2x00dev->tx[2].limit); - rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX2, 0); - rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX2, 0); - - entry_priv = rt2x00dev->tx[3].entries[0].priv_data; - rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR3, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT3, - rt2x00dev->tx[3].limit); - rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX3, 0); - rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX3, 0); - - rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR4, 0); - rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT4, 0); - rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX4, 0); - rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX4, 0); - - rt2x00mmio_register_write(rt2x00dev, TX_BASE_PTR5, 0); - rt2x00mmio_register_write(rt2x00dev, TX_MAX_CNT5, 0); - rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX5, 0); - rt2x00mmio_register_write(rt2x00dev, TX_DTX_IDX5, 0); - - entry_priv = rt2x00dev->rx->entries[0].priv_data; - rt2x00mmio_register_write(rt2x00dev, RX_BASE_PTR, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, RX_MAX_CNT, - rt2x00dev->rx[0].limit); - rt2x00mmio_register_write(rt2x00dev, RX_CRX_IDX, - rt2x00dev->rx[0].limit - 1); - rt2x00mmio_register_write(rt2x00dev, RX_DRX_IDX, 0); - - rt2800_disable_wpdma(rt2x00dev); - - rt2x00mmio_register_write(rt2x00dev, DELAY_INT_CFG, 0); - - return 0; -} - -/* - * Device state switch handlers. - */ -static void rt2800pci_toggle_irq(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - u32 reg; - unsigned long flags; - - /* - * When interrupts are being enabled, the interrupt registers - * should clear the register to assure a clean state. - */ - if (state == STATE_RADIO_IRQ_ON) { - rt2x00mmio_register_read(rt2x00dev, INT_SOURCE_CSR, ®); - rt2x00mmio_register_write(rt2x00dev, INT_SOURCE_CSR, reg); - } - - spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags); - reg = 0; - if (state == STATE_RADIO_IRQ_ON) { - rt2x00_set_field32(®, INT_MASK_CSR_RX_DONE, 1); - rt2x00_set_field32(®, INT_MASK_CSR_TBTT, 1); - rt2x00_set_field32(®, INT_MASK_CSR_PRE_TBTT, 1); - rt2x00_set_field32(®, INT_MASK_CSR_TX_FIFO_STATUS, 1); - rt2x00_set_field32(®, INT_MASK_CSR_AUTO_WAKEUP, 1); - } - rt2x00mmio_register_write(rt2x00dev, INT_MASK_CSR, reg); - spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags); - - if (state == STATE_RADIO_IRQ_OFF) { - /* - * Wait for possibly running tasklets to finish. - */ - tasklet_kill(&rt2x00dev->txstatus_tasklet); - tasklet_kill(&rt2x00dev->rxdone_tasklet); - tasklet_kill(&rt2x00dev->autowake_tasklet); - tasklet_kill(&rt2x00dev->tbtt_tasklet); - tasklet_kill(&rt2x00dev->pretbtt_tasklet); - } -} - -static int rt2800pci_init_registers(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - /* - * Reset DMA indexes - */ - rt2x00mmio_register_read(rt2x00dev, WPDMA_RST_IDX, ®); - rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX0, 1); - rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX1, 1); - rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX2, 1); - rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX3, 1); - rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX4, 1); - rt2x00_set_field32(®, WPDMA_RST_IDX_DTX_IDX5, 1); - rt2x00_set_field32(®, WPDMA_RST_IDX_DRX_IDX0, 1); - rt2x00mmio_register_write(rt2x00dev, WPDMA_RST_IDX, reg); - - rt2x00mmio_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e1f); - rt2x00mmio_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00); - - if (rt2x00_is_pcie(rt2x00dev) && - (rt2x00_rt(rt2x00dev, RT3572) || - rt2x00_rt(rt2x00dev, RT5390) || - rt2x00_rt(rt2x00dev, RT5392))) { - rt2x00mmio_register_read(rt2x00dev, AUX_CTRL, ®); - rt2x00_set_field32(®, AUX_CTRL_FORCE_PCIE_CLK, 1); - rt2x00_set_field32(®, AUX_CTRL_WAKE_PCIE_EN, 1); - rt2x00mmio_register_write(rt2x00dev, AUX_CTRL, reg); - } - - rt2x00mmio_register_write(rt2x00dev, PWR_PIN_CFG, 0x00000003); - - reg = 0; - rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_CSR, 1); - rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_BBP, 1); - rt2x00mmio_register_write(rt2x00dev, MAC_SYS_CTRL, reg); - - rt2x00mmio_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000); - - return 0; -} - -static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev) -{ - int retval; - - /* Wait for DMA, ignore error until we initialize queues. */ - rt2800_wait_wpdma_ready(rt2x00dev); - - if (unlikely(rt2800pci_init_queues(rt2x00dev))) - return -EIO; - - retval = rt2800_enable_radio(rt2x00dev); - if (retval) - return retval; - - /* After resume MCU_BOOT_SIGNAL will trash these. */ - rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); - rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); - - rt2800_mcu_request(rt2x00dev, MCU_SLEEP, TOKEN_RADIO_OFF, 0xff, 0x02); - rt2800pci_mcu_status(rt2x00dev, TOKEN_RADIO_OFF); - - rt2800_mcu_request(rt2x00dev, MCU_WAKEUP, TOKEN_WAKEUP, 0, 0); - rt2800pci_mcu_status(rt2x00dev, TOKEN_WAKEUP); - - return retval; -} - -static void rt2800pci_disable_radio(struct rt2x00_dev *rt2x00dev) -{ - if (rt2x00_is_soc(rt2x00dev)) { - rt2800_disable_radio(rt2x00dev); - rt2x00mmio_register_write(rt2x00dev, PWR_PIN_CFG, 0); - rt2x00mmio_register_write(rt2x00dev, TX_PIN_CFG, 0); - } -} - -static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - if (state == STATE_AWAKE) { - rt2800_mcu_request(rt2x00dev, MCU_WAKEUP, TOKEN_WAKEUP, - 0, 0x02); - rt2800pci_mcu_status(rt2x00dev, TOKEN_WAKEUP); - } else if (state == STATE_SLEEP) { - rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_STATUS, - 0xffffffff); - rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CID, - 0xffffffff); - rt2800_mcu_request(rt2x00dev, MCU_SLEEP, TOKEN_SLEEP, - 0xff, 0x01); - } - - return 0; -} - -static int rt2800pci_set_device_state(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - int retval = 0; - - switch (state) { - case STATE_RADIO_ON: - retval = rt2800pci_enable_radio(rt2x00dev); - break; - case STATE_RADIO_OFF: - /* - * After the radio has been disabled, the device should - * be put to sleep for powersaving. - */ - rt2800pci_disable_radio(rt2x00dev); - rt2800pci_set_state(rt2x00dev, STATE_SLEEP); - break; - case STATE_RADIO_IRQ_ON: - case STATE_RADIO_IRQ_OFF: - rt2800pci_toggle_irq(rt2x00dev, state); - break; - case STATE_DEEP_SLEEP: - case STATE_SLEEP: - case STATE_STANDBY: - case STATE_AWAKE: - retval = rt2800pci_set_state(rt2x00dev, state); - break; - default: - retval = -ENOTSUPP; - break; - } - - if (unlikely(retval)) - rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", - state, retval); - - return retval; -} - -/* - * TX descriptor initialization - */ -static __le32 *rt2800pci_get_txwi(struct queue_entry *entry) -{ - return (__le32 *) entry->skb->data; -} - -static void rt2800pci_write_tx_desc(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - __le32 *txd = entry_priv->desc; - u32 word; - - /* - * The buffers pointed by SD_PTR0/SD_LEN0 and SD_PTR1/SD_LEN1 - * must contains a TXWI structure + 802.11 header + padding + 802.11 - * data. We choose to have SD_PTR0/SD_LEN0 only contains TXWI and - * SD_PTR1/SD_LEN1 contains 802.11 header + padding + 802.11 - * data. It means that LAST_SEC0 is always 0. - */ - - /* - * Initialize TX descriptor - */ - word = 0; - rt2x00_set_field32(&word, TXD_W0_SD_PTR0, skbdesc->skb_dma); - rt2x00_desc_write(txd, 0, word); - - word = 0; - rt2x00_set_field32(&word, TXD_W1_SD_LEN1, entry->skb->len); - rt2x00_set_field32(&word, TXD_W1_LAST_SEC1, - !test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W1_BURST, - test_bit(ENTRY_TXD_BURST, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W1_SD_LEN0, TXWI_DESC_SIZE); - rt2x00_set_field32(&word, TXD_W1_LAST_SEC0, 0); - rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 0); - rt2x00_desc_write(txd, 1, word); - - word = 0; - rt2x00_set_field32(&word, TXD_W2_SD_PTR1, - skbdesc->skb_dma + TXWI_DESC_SIZE); - rt2x00_desc_write(txd, 2, word); - - word = 0; - rt2x00_set_field32(&word, TXD_W3_WIV, - !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W3_QSEL, 2); - rt2x00_desc_write(txd, 3, word); - - /* - * Register descriptor details in skb frame descriptor. - */ - skbdesc->desc = txd; - skbdesc->desc_len = TXD_DESC_SIZE; -} - -/* - * RX control handlers - */ -static void rt2800pci_fill_rxdone(struct queue_entry *entry, - struct rxdone_entry_desc *rxdesc) -{ - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - __le32 *rxd = entry_priv->desc; - u32 word; - - rt2x00_desc_read(rxd, 3, &word); - - if (rt2x00_get_field32(word, RXD_W3_CRC_ERROR)) - rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; - - /* - * Unfortunately we don't know the cipher type used during - * decryption. This prevents us from correct providing - * correct statistics through debugfs. - */ - rxdesc->cipher_status = rt2x00_get_field32(word, RXD_W3_CIPHER_ERROR); - - if (rt2x00_get_field32(word, RXD_W3_DECRYPTED)) { - /* - * Hardware has stripped IV/EIV data from 802.11 frame during - * decryption. Unfortunately the descriptor doesn't contain - * any fields with the EIV/IV data either, so they can't - * be restored by rt2x00lib. - */ - rxdesc->flags |= RX_FLAG_IV_STRIPPED; - - /* - * The hardware has already checked the Michael Mic and has - * stripped it from the frame. Signal this to mac80211. - */ - rxdesc->flags |= RX_FLAG_MMIC_STRIPPED; - - if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) - rxdesc->flags |= RX_FLAG_DECRYPTED; - else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) - rxdesc->flags |= RX_FLAG_MMIC_ERROR; - } - - if (rt2x00_get_field32(word, RXD_W3_MY_BSS)) - rxdesc->dev_flags |= RXDONE_MY_BSS; - - if (rt2x00_get_field32(word, RXD_W3_L2PAD)) - rxdesc->dev_flags |= RXDONE_L2PAD; - - /* - * Process the RXWI structure that is at the start of the buffer. - */ - rt2800_process_rxwi(entry, rxdesc); -} - -/* - * Interrupt functions. - */ -static void rt2800pci_wakeup(struct rt2x00_dev *rt2x00dev) -{ - struct ieee80211_conf conf = { .flags = 0 }; - struct rt2x00lib_conf libconf = { .conf = &conf }; - - rt2800_config(rt2x00dev, &libconf, IEEE80211_CONF_CHANGE_PS); -} - -static bool rt2800pci_txdone_entry_check(struct queue_entry *entry, u32 status) -{ - __le32 *txwi; - u32 word; - int wcid, tx_wcid; - - wcid = rt2x00_get_field32(status, TX_STA_FIFO_WCID); - - txwi = rt2800_drv_get_txwi(entry); - rt2x00_desc_read(txwi, 1, &word); - tx_wcid = rt2x00_get_field32(word, TXWI_W1_WIRELESS_CLI_ID); - - return (tx_wcid == wcid); -} - -static bool rt2800pci_txdone_find_entry(struct queue_entry *entry, void *data) -{ - u32 status = *(u32 *)data; - - /* - * rt2800pci hardware might reorder frames when exchanging traffic - * with multiple BA enabled STAs. - * - * For example, a tx queue - * [ STA1 | STA2 | STA1 | STA2 ] - * can result in tx status reports - * [ STA1 | STA1 | STA2 | STA2 ] - * when the hw decides to aggregate the frames for STA1 into one AMPDU. - * - * To mitigate this effect, associate the tx status to the first frame - * in the tx queue with a matching wcid. - */ - if (rt2800pci_txdone_entry_check(entry, status) && - !test_bit(ENTRY_DATA_STATUS_SET, &entry->flags)) { - /* - * Got a matching frame, associate the tx status with - * the frame - */ - entry->status = status; - set_bit(ENTRY_DATA_STATUS_SET, &entry->flags); - return true; - } - - /* Check the next frame */ - return false; -} - -static bool rt2800pci_txdone_match_first(struct queue_entry *entry, void *data) -{ - u32 status = *(u32 *)data; - - /* - * Find the first frame without tx status and assign this status to it - * regardless if it matches or not. - */ - if (!test_bit(ENTRY_DATA_STATUS_SET, &entry->flags)) { - /* - * Got a matching frame, associate the tx status with - * the frame - */ - entry->status = status; - set_bit(ENTRY_DATA_STATUS_SET, &entry->flags); - return true; - } - - /* Check the next frame */ - return false; -} -static bool rt2800pci_txdone_release_entries(struct queue_entry *entry, - void *data) -{ - if (test_bit(ENTRY_DATA_STATUS_SET, &entry->flags)) { - rt2800_txdone_entry(entry, entry->status, - rt2800pci_get_txwi(entry)); - return false; - } - - /* No more frames to release */ - return true; -} - -static bool rt2800pci_txdone(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - u32 status; - u8 qid; - int max_tx_done = 16; - - while (kfifo_get(&rt2x00dev->txstatus_fifo, &status)) { - qid = rt2x00_get_field32(status, TX_STA_FIFO_PID_QUEUE); - if (unlikely(qid >= QID_RX)) { - /* - * Unknown queue, this shouldn't happen. Just drop - * this tx status. - */ - rt2x00_warn(rt2x00dev, "Got TX status report with unexpected pid %u, dropping\n", - qid); - break; - } - - queue = rt2x00queue_get_tx_queue(rt2x00dev, qid); - if (unlikely(queue == NULL)) { - /* - * The queue is NULL, this shouldn't happen. Stop - * processing here and drop the tx status - */ - rt2x00_warn(rt2x00dev, "Got TX status for an unavailable queue %u, dropping\n", - qid); - break; - } - - if (unlikely(rt2x00queue_empty(queue))) { - /* - * The queue is empty. Stop processing here - * and drop the tx status. - */ - rt2x00_warn(rt2x00dev, "Got TX status for an empty queue %u, dropping\n", - qid); - break; - } - - /* - * Let's associate this tx status with the first - * matching frame. - */ - if (!rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, - Q_INDEX, &status, - rt2800pci_txdone_find_entry)) { - /* - * We cannot match the tx status to any frame, so just - * use the first one. - */ - if (!rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, - Q_INDEX, &status, - rt2800pci_txdone_match_first)) { - rt2x00_warn(rt2x00dev, "No frame found for TX status on queue %u, dropping\n", - qid); - break; - } - } - - /* - * Release all frames with a valid tx status. - */ - rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, - Q_INDEX, NULL, - rt2800pci_txdone_release_entries); - - if (--max_tx_done == 0) - break; - } - - return !max_tx_done; -} - -static inline void rt2800pci_enable_interrupt(struct rt2x00_dev *rt2x00dev, - struct rt2x00_field32 irq_field) -{ - u32 reg; - - /* - * Enable a single interrupt. The interrupt mask register - * access needs locking. - */ - spin_lock_irq(&rt2x00dev->irqmask_lock); - rt2x00mmio_register_read(rt2x00dev, INT_MASK_CSR, ®); - rt2x00_set_field32(®, irq_field, 1); - rt2x00mmio_register_write(rt2x00dev, INT_MASK_CSR, reg); - spin_unlock_irq(&rt2x00dev->irqmask_lock); -} - -static void rt2800pci_txstatus_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - if (rt2800pci_txdone(rt2x00dev)) - tasklet_schedule(&rt2x00dev->txstatus_tasklet); - - /* - * No need to enable the tx status interrupt here as we always - * leave it enabled to minimize the possibility of a tx status - * register overflow. See comment in interrupt handler. - */ -} - -static void rt2800pci_pretbtt_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - rt2x00lib_pretbtt(rt2x00dev); - if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt2800pci_enable_interrupt(rt2x00dev, INT_MASK_CSR_PRE_TBTT); -} - -static void rt2800pci_tbtt_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - struct rt2800_drv_data *drv_data = rt2x00dev->drv_data; - u32 reg; - - rt2x00lib_beacondone(rt2x00dev); - - if (rt2x00dev->intf_ap_count) { - /* - * The rt2800pci hardware tbtt timer is off by 1us per tbtt - * causing beacon skew and as a result causing problems with - * some powersaving clients over time. Shorten the beacon - * interval every 64 beacons by 64us to mitigate this effect. - */ - if (drv_data->tbtt_tick == (BCN_TBTT_OFFSET - 2)) { - rt2x00mmio_register_read(rt2x00dev, BCN_TIME_CFG, ®); - rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_INTERVAL, - (rt2x00dev->beacon_int * 16) - 1); - rt2x00mmio_register_write(rt2x00dev, BCN_TIME_CFG, reg); - } else if (drv_data->tbtt_tick == (BCN_TBTT_OFFSET - 1)) { - rt2x00mmio_register_read(rt2x00dev, BCN_TIME_CFG, ®); - rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_INTERVAL, - (rt2x00dev->beacon_int * 16)); - rt2x00mmio_register_write(rt2x00dev, BCN_TIME_CFG, reg); - } - drv_data->tbtt_tick++; - drv_data->tbtt_tick %= BCN_TBTT_OFFSET; - } - - if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt2800pci_enable_interrupt(rt2x00dev, INT_MASK_CSR_TBTT); -} - -static void rt2800pci_rxdone_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - if (rt2x00mmio_rxdone(rt2x00dev)) - tasklet_schedule(&rt2x00dev->rxdone_tasklet); - else if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt2800pci_enable_interrupt(rt2x00dev, INT_MASK_CSR_RX_DONE); -} - -static void rt2800pci_autowake_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - rt2800pci_wakeup(rt2x00dev); - if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt2800pci_enable_interrupt(rt2x00dev, INT_MASK_CSR_AUTO_WAKEUP); -} - -static void rt2800pci_txstatus_interrupt(struct rt2x00_dev *rt2x00dev) -{ - u32 status; - int i; - - /* - * The TX_FIFO_STATUS interrupt needs special care. We should - * read TX_STA_FIFO but we should do it immediately as otherwise - * the register can overflow and we would lose status reports. - * - * Hence, read the TX_STA_FIFO register and copy all tx status - * reports into a kernel FIFO which is handled in the txstatus - * tasklet. We use a tasklet to process the tx status reports - * because we can schedule the tasklet multiple times (when the - * interrupt fires again during tx status processing). - * - * Furthermore we don't disable the TX_FIFO_STATUS - * interrupt here but leave it enabled so that the TX_STA_FIFO - * can also be read while the tx status tasklet gets executed. - * - * Since we have only one producer and one consumer we don't - * need to lock the kfifo. - */ - for (i = 0; i < rt2x00dev->ops->tx->entry_num; i++) { - rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO, &status); - - if (!rt2x00_get_field32(status, TX_STA_FIFO_VALID)) - break; - - if (!kfifo_put(&rt2x00dev->txstatus_fifo, &status)) { - rt2x00_warn(rt2x00dev, "TX status FIFO overrun, drop tx status report\n"); - break; - } - } - - /* Schedule the tasklet for processing the tx status. */ - tasklet_schedule(&rt2x00dev->txstatus_tasklet); -} - -static irqreturn_t rt2800pci_interrupt(int irq, void *dev_instance) -{ - struct rt2x00_dev *rt2x00dev = dev_instance; - u32 reg, mask; - - /* Read status and ACK all interrupts */ - rt2x00mmio_register_read(rt2x00dev, INT_SOURCE_CSR, ®); - rt2x00mmio_register_write(rt2x00dev, INT_SOURCE_CSR, reg); - - if (!reg) - return IRQ_NONE; - - if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - return IRQ_HANDLED; - - /* - * Since INT_MASK_CSR and INT_SOURCE_CSR use the same bits - * for interrupts and interrupt masks we can just use the value of - * INT_SOURCE_CSR to create the interrupt mask. - */ - mask = ~reg; - - if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TX_FIFO_STATUS)) { - rt2800pci_txstatus_interrupt(rt2x00dev); - /* - * Never disable the TX_FIFO_STATUS interrupt. - */ - rt2x00_set_field32(&mask, INT_MASK_CSR_TX_FIFO_STATUS, 1); - } - - if (rt2x00_get_field32(reg, INT_SOURCE_CSR_PRE_TBTT)) - tasklet_hi_schedule(&rt2x00dev->pretbtt_tasklet); - - if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TBTT)) - tasklet_hi_schedule(&rt2x00dev->tbtt_tasklet); - - if (rt2x00_get_field32(reg, INT_SOURCE_CSR_RX_DONE)) - tasklet_schedule(&rt2x00dev->rxdone_tasklet); - - if (rt2x00_get_field32(reg, INT_SOURCE_CSR_AUTO_WAKEUP)) - tasklet_schedule(&rt2x00dev->autowake_tasklet); - - /* - * Disable all interrupts for which a tasklet was scheduled right now, - * the tasklet will reenable the appropriate interrupts. - */ - spin_lock(&rt2x00dev->irqmask_lock); - rt2x00mmio_register_read(rt2x00dev, INT_MASK_CSR, ®); - reg &= mask; - rt2x00mmio_register_write(rt2x00dev, INT_MASK_CSR, reg); - spin_unlock(&rt2x00dev->irqmask_lock); - - return IRQ_HANDLED; -} - -/* - * Device probe functions. - */ -static int rt2800pci_read_eeprom(struct rt2x00_dev *rt2x00dev) -{ - int retval; - - if (rt2x00_is_soc(rt2x00dev)) - retval = rt2800pci_read_eeprom_soc(rt2x00dev); - else if (rt2800pci_efuse_detect(rt2x00dev)) - retval = rt2800pci_read_eeprom_efuse(rt2x00dev); - else - retval = rt2800pci_read_eeprom_pci(rt2x00dev); - - return retval; -} - -static const struct ieee80211_ops rt2800pci_mac80211_ops = { - .tx = rt2x00mac_tx, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, - .remove_interface = rt2x00mac_remove_interface, - .config = rt2x00mac_config, - .configure_filter = rt2x00mac_configure_filter, - .set_key = rt2x00mac_set_key, - .sw_scan_start = rt2x00mac_sw_scan_start, - .sw_scan_complete = rt2x00mac_sw_scan_complete, - .get_stats = rt2x00mac_get_stats, - .get_tkip_seq = rt2800_get_tkip_seq, - .set_rts_threshold = rt2800_set_rts_threshold, - .sta_add = rt2x00mac_sta_add, - .sta_remove = rt2x00mac_sta_remove, - .bss_info_changed = rt2x00mac_bss_info_changed, - .conf_tx = rt2800_conf_tx, - .get_tsf = rt2800_get_tsf, - .rfkill_poll = rt2x00mac_rfkill_poll, - .ampdu_action = rt2800_ampdu_action, - .flush = rt2x00mac_flush, - .get_survey = rt2800_get_survey, - .get_ringparam = rt2x00mac_get_ringparam, - .tx_frames_pending = rt2x00mac_tx_frames_pending, -}; - -static const struct rt2800_ops rt2800pci_rt2800_ops = { - .register_read = rt2x00mmio_register_read, - .register_read_lock = rt2x00mmio_register_read, /* same for PCI */ - .register_write = rt2x00mmio_register_write, - .register_write_lock = rt2x00mmio_register_write, /* same for PCI */ - .register_multiread = rt2x00mmio_register_multiread, - .register_multiwrite = rt2x00mmio_register_multiwrite, - .regbusy_read = rt2x00mmio_regbusy_read, - .read_eeprom = rt2800pci_read_eeprom, - .hwcrypt_disabled = rt2800pci_hwcrypt_disabled, - .drv_write_firmware = rt2800pci_write_firmware, - .drv_init_registers = rt2800pci_init_registers, - .drv_get_txwi = rt2800pci_get_txwi, -}; - -static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = { - .irq_handler = rt2800pci_interrupt, - .txstatus_tasklet = rt2800pci_txstatus_tasklet, - .pretbtt_tasklet = rt2800pci_pretbtt_tasklet, - .tbtt_tasklet = rt2800pci_tbtt_tasklet, - .rxdone_tasklet = rt2800pci_rxdone_tasklet, - .autowake_tasklet = rt2800pci_autowake_tasklet, - .probe_hw = rt2800_probe_hw, - .get_firmware_name = rt2800pci_get_firmware_name, - .check_firmware = rt2800_check_firmware, - .load_firmware = rt2800_load_firmware, - .initialize = rt2x00mmio_initialize, - .uninitialize = rt2x00mmio_uninitialize, - .get_entry_state = rt2800pci_get_entry_state, - .clear_entry = rt2800pci_clear_entry, - .set_device_state = rt2800pci_set_device_state, - .rfkill_poll = rt2800_rfkill_poll, - .link_stats = rt2800_link_stats, - .reset_tuner = rt2800_reset_tuner, - .link_tuner = rt2800_link_tuner, - .gain_calibration = rt2800_gain_calibration, - .vco_calibration = rt2800_vco_calibration, - .start_queue = rt2800pci_start_queue, - .kick_queue = rt2800pci_kick_queue, - .stop_queue = rt2800pci_stop_queue, - .flush_queue = rt2x00mmio_flush_queue, - .write_tx_desc = rt2800pci_write_tx_desc, - .write_tx_data = rt2800_write_tx_data, - .write_beacon = rt2800_write_beacon, - .clear_beacon = rt2800_clear_beacon, - .fill_rxdone = rt2800pci_fill_rxdone, - .config_shared_key = rt2800_config_shared_key, - .config_pairwise_key = rt2800_config_pairwise_key, - .config_filter = rt2800_config_filter, - .config_intf = rt2800_config_intf, - .config_erp = rt2800_config_erp, - .config_ant = rt2800_config_ant, - .config = rt2800_config, - .sta_add = rt2800_sta_add, - .sta_remove = rt2800_sta_remove, -}; - -static const struct data_queue_desc rt2800pci_queue_rx = { - .entry_num = 128, - .data_size = AGGREGATION_SIZE, - .desc_size = RXD_DESC_SIZE, - .winfo_size = RXWI_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_mmio), -}; - -static const struct data_queue_desc rt2800pci_queue_tx = { - .entry_num = 64, - .data_size = AGGREGATION_SIZE, - .desc_size = TXD_DESC_SIZE, - .winfo_size = TXWI_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_mmio), -}; - -static const struct data_queue_desc rt2800pci_queue_bcn = { - .entry_num = 8, - .data_size = 0, /* No DMA required for beacons */ - .desc_size = TXD_DESC_SIZE, - .winfo_size = TXWI_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_mmio), -}; - -static const struct rt2x00_ops rt2800pci_ops = { - .name = KBUILD_MODNAME, - .drv_data_size = sizeof(struct rt2800_drv_data), - .max_ap_intf = 8, - .eeprom_size = EEPROM_SIZE, - .rf_size = RF_SIZE, - .tx_queues = NUM_TX_QUEUES, - .extra_tx_headroom = TXWI_DESC_SIZE, - .rx = &rt2800pci_queue_rx, - .tx = &rt2800pci_queue_tx, - .bcn = &rt2800pci_queue_bcn, - .lib = &rt2800pci_rt2x00_ops, - .drv = &rt2800pci_rt2800_ops, - .hw = &rt2800pci_mac80211_ops, -#ifdef CONFIG_RT2X00_LIB_DEBUGFS - .debugfs = &rt2800_rt2x00debug, -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -}; - -/* - * RT2800pci module information. - */ -#ifdef CONFIG_PCI -static DEFINE_PCI_DEVICE_TABLE(rt2800pci_device_table) = { - { PCI_DEVICE(0x1814, 0x0601) }, - { PCI_DEVICE(0x1814, 0x0681) }, - { PCI_DEVICE(0x1814, 0x0701) }, - { PCI_DEVICE(0x1814, 0x0781) }, - { PCI_DEVICE(0x1814, 0x3090) }, - { PCI_DEVICE(0x1814, 0x3091) }, - { PCI_DEVICE(0x1814, 0x3092) }, - { PCI_DEVICE(0x1432, 0x7708) }, - { PCI_DEVICE(0x1432, 0x7727) }, - { PCI_DEVICE(0x1432, 0x7728) }, - { PCI_DEVICE(0x1432, 0x7738) }, - { PCI_DEVICE(0x1432, 0x7748) }, - { PCI_DEVICE(0x1432, 0x7758) }, - { PCI_DEVICE(0x1432, 0x7768) }, - { PCI_DEVICE(0x1462, 0x891a) }, - { PCI_DEVICE(0x1a3b, 0x1059) }, -#ifdef CONFIG_RT2800PCI_RT3290 - { PCI_DEVICE(0x1814, 0x3290) }, -#endif -#ifdef CONFIG_RT2800PCI_RT33XX - { PCI_DEVICE(0x1814, 0x3390) }, -#endif -#ifdef CONFIG_RT2800PCI_RT35XX - { PCI_DEVICE(0x1432, 0x7711) }, - { PCI_DEVICE(0x1432, 0x7722) }, - { PCI_DEVICE(0x1814, 0x3060) }, - { PCI_DEVICE(0x1814, 0x3062) }, - { PCI_DEVICE(0x1814, 0x3562) }, - { PCI_DEVICE(0x1814, 0x3592) }, - { PCI_DEVICE(0x1814, 0x3593) }, - { PCI_DEVICE(0x1814, 0x359f) }, -#endif -#ifdef CONFIG_RT2800PCI_RT53XX - { PCI_DEVICE(0x1814, 0x5360) }, - { PCI_DEVICE(0x1814, 0x5362) }, - { PCI_DEVICE(0x1814, 0x5390) }, - { PCI_DEVICE(0x1814, 0x5392) }, - { PCI_DEVICE(0x1814, 0x539a) }, - { PCI_DEVICE(0x1814, 0x539b) }, - { PCI_DEVICE(0x1814, 0x539f) }, -#endif - { 0, } -}; -#endif /* CONFIG_PCI */ - -MODULE_AUTHOR(DRV_PROJECT); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION("Ralink RT2800 PCI & PCMCIA Wireless LAN driver."); -MODULE_SUPPORTED_DEVICE("Ralink RT2860 PCI & PCMCIA chipset based cards"); -#ifdef CONFIG_PCI -MODULE_FIRMWARE(FIRMWARE_RT2860); -MODULE_DEVICE_TABLE(pci, rt2800pci_device_table); -#endif /* CONFIG_PCI */ -MODULE_LICENSE("GPL"); - -#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) -static int rt2800soc_probe(struct platform_device *pdev) -{ - return rt2x00soc_probe(pdev, &rt2800pci_ops); -} - -static struct platform_driver rt2800soc_driver = { - .driver = { - .name = "rt2800_wmac", - .owner = THIS_MODULE, - .mod_name = KBUILD_MODNAME, - }, - .probe = rt2800soc_probe, - .remove = rt2x00soc_remove, - .suspend = rt2x00soc_suspend, - .resume = rt2x00soc_resume, -}; -#endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */ - -#ifdef CONFIG_PCI -static int rt2800pci_probe(struct pci_dev *pci_dev, - const struct pci_device_id *id) -{ - return rt2x00pci_probe(pci_dev, &rt2800pci_ops); -} - -static struct pci_driver rt2800pci_driver = { - .name = KBUILD_MODNAME, - .id_table = rt2800pci_device_table, - .probe = rt2800pci_probe, - .remove = rt2x00pci_remove, - .suspend = rt2x00pci_suspend, - .resume = rt2x00pci_resume, -}; -#endif /* CONFIG_PCI */ - -static int __init rt2800pci_init(void) -{ - int ret = 0; - -#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) - ret = platform_driver_register(&rt2800soc_driver); - if (ret) - return ret; -#endif -#ifdef CONFIG_PCI - ret = pci_register_driver(&rt2800pci_driver); - if (ret) { -#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) - platform_driver_unregister(&rt2800soc_driver); -#endif - return ret; - } -#endif - - return ret; -} - -static void __exit rt2800pci_exit(void) -{ -#ifdef CONFIG_PCI - pci_unregister_driver(&rt2800pci_driver); -#endif -#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) - platform_driver_unregister(&rt2800soc_driver); -#endif -} - -module_init(rt2800pci_init); -module_exit(rt2800pci_exit); diff --git a/drivers/net/wireless/rt2x00/rt2800pci.h b/drivers/net/wireless/rt2x00/rt2800pci.h deleted file mode 100644 index ab22a087c50d..000000000000 --- a/drivers/net/wireless/rt2x00/rt2800pci.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - Copyright (C) 2009 Ivo van Doorn - Copyright (C) 2009 Alban Browaeys - Copyright (C) 2009 Felix Fietkau - Copyright (C) 2009 Luis Correia - Copyright (C) 2009 Mattias Nissler - Copyright (C) 2009 Mark Asselstine - Copyright (C) 2009 Xose Vazquez Perez - Copyright (C) 2009 Bart Zolnierkiewicz - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2800pci - Abstract: Data structures and registers for the rt2800pci module. - Supported chipsets: RT2800E & RT2800ED. - */ - -#ifndef RT2800PCI_H -#define RT2800PCI_H - -/* - * Queue register offset macros - */ -#define TX_QUEUE_REG_OFFSET 0x10 -#define TX_BASE_PTR(__x) (TX_BASE_PTR0 + ((__x) * TX_QUEUE_REG_OFFSET)) -#define TX_MAX_CNT(__x) (TX_MAX_CNT0 + ((__x) * TX_QUEUE_REG_OFFSET)) -#define TX_CTX_IDX(__x) (TX_CTX_IDX0 + ((__x) * TX_QUEUE_REG_OFFSET)) -#define TX_DTX_IDX(__x) (TX_DTX_IDX0 + ((__x) * TX_QUEUE_REG_OFFSET)) - -/* - * 8051 firmware image. - */ -#define FIRMWARE_RT2860 "rt2860.bin" -#define FIRMWARE_RT3290 "rt3290.bin" -#define FIRMWARE_IMAGE_BASE 0x2000 - -/* - * DMA descriptor defines. - */ -#define TXD_DESC_SIZE (4 * sizeof(__le32)) -#define RXD_DESC_SIZE (4 * sizeof(__le32)) - -/* - * TX descriptor format for TX, PRIO and Beacon Ring. - */ - -/* - * Word0 - */ -#define TXD_W0_SD_PTR0 FIELD32(0xffffffff) - -/* - * Word1 - */ -#define TXD_W1_SD_LEN1 FIELD32(0x00003fff) -#define TXD_W1_LAST_SEC1 FIELD32(0x00004000) -#define TXD_W1_BURST FIELD32(0x00008000) -#define TXD_W1_SD_LEN0 FIELD32(0x3fff0000) -#define TXD_W1_LAST_SEC0 FIELD32(0x40000000) -#define TXD_W1_DMA_DONE FIELD32(0x80000000) - -/* - * Word2 - */ -#define TXD_W2_SD_PTR1 FIELD32(0xffffffff) - -/* - * Word3 - * WIV: Wireless Info Valid. 1: Driver filled WI, 0: DMA needs to copy WI - * QSEL: Select on-chip FIFO ID for 2nd-stage output scheduler. - * 0:MGMT, 1:HCCA 2:EDCA - */ -#define TXD_W3_WIV FIELD32(0x01000000) -#define TXD_W3_QSEL FIELD32(0x06000000) -#define TXD_W3_TCO FIELD32(0x20000000) -#define TXD_W3_UCO FIELD32(0x40000000) -#define TXD_W3_ICO FIELD32(0x80000000) - -/* - * RX descriptor format for RX Ring. - */ - -/* - * Word0 - */ -#define RXD_W0_SDP0 FIELD32(0xffffffff) - -/* - * Word1 - */ -#define RXD_W1_SDL1 FIELD32(0x00003fff) -#define RXD_W1_SDL0 FIELD32(0x3fff0000) -#define RXD_W1_LS0 FIELD32(0x40000000) -#define RXD_W1_DMA_DONE FIELD32(0x80000000) - -/* - * Word2 - */ -#define RXD_W2_SDP1 FIELD32(0xffffffff) - -/* - * Word3 - * AMSDU: RX with 802.3 header, not 802.11 header. - * DECRYPTED: This frame is being decrypted. - */ -#define RXD_W3_BA FIELD32(0x00000001) -#define RXD_W3_DATA FIELD32(0x00000002) -#define RXD_W3_NULLDATA FIELD32(0x00000004) -#define RXD_W3_FRAG FIELD32(0x00000008) -#define RXD_W3_UNICAST_TO_ME FIELD32(0x00000010) -#define RXD_W3_MULTICAST FIELD32(0x00000020) -#define RXD_W3_BROADCAST FIELD32(0x00000040) -#define RXD_W3_MY_BSS FIELD32(0x00000080) -#define RXD_W3_CRC_ERROR FIELD32(0x00000100) -#define RXD_W3_CIPHER_ERROR FIELD32(0x00000600) -#define RXD_W3_AMSDU FIELD32(0x00000800) -#define RXD_W3_HTC FIELD32(0x00001000) -#define RXD_W3_RSSI FIELD32(0x00002000) -#define RXD_W3_L2PAD FIELD32(0x00004000) -#define RXD_W3_AMPDU FIELD32(0x00008000) -#define RXD_W3_DECRYPTED FIELD32(0x00010000) -#define RXD_W3_PLCP_SIGNAL FIELD32(0x00020000) -#define RXD_W3_PLCP_RSSI FIELD32(0x00040000) - -#endif /* RT2800PCI_H */ diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c deleted file mode 100644 index 9ef0711a5cc1..000000000000 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ /dev/null @@ -1,1385 +0,0 @@ -/* - Copyright (C) 2010 Willow Garage - Copyright (C) 2009 - 2010 Ivo van Doorn - Copyright (C) 2009 Mattias Nissler - Copyright (C) 2009 Felix Fietkau - Copyright (C) 2009 Xose Vazquez Perez - Copyright (C) 2009 Axel Kollhofer - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2800usb - Abstract: rt2800usb device specific routines. - Supported chipsets: RT2800U. - */ - -#include -#include -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2x00usb.h" -#include "rt2800lib.h" -#include "rt2800.h" -#include "rt2800usb.h" - -/* - * Allow hardware encryption to be disabled. - */ -static bool modparam_nohwcrypt; -module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); -MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); - -static bool rt2800usb_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev) -{ - return modparam_nohwcrypt; -} - -/* - * Queue handlers. - */ -static void rt2800usb_start_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_RX: - rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL, ®); - rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 1); - rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg); - break; - case QID_BEACON: - rt2x00usb_register_read(rt2x00dev, BCN_TIME_CFG, ®); - rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 1); - rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 1); - rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 1); - rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg); - break; - default: - break; - } -} - -static void rt2800usb_stop_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_RX: - rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL, ®); - rt2x00_set_field32(®, MAC_SYS_CTRL_ENABLE_RX, 0); - rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg); - break; - case QID_BEACON: - rt2x00usb_register_read(rt2x00dev, BCN_TIME_CFG, ®); - rt2x00_set_field32(®, BCN_TIME_CFG_TSF_TICKING, 0); - rt2x00_set_field32(®, BCN_TIME_CFG_TBTT_ENABLE, 0); - rt2x00_set_field32(®, BCN_TIME_CFG_BEACON_GEN, 0); - rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg); - break; - default: - break; - } -} - -/* - * test if there is an entry in any TX queue for which DMA is done - * but the TX status has not been returned yet - */ -static bool rt2800usb_txstatus_pending(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - - tx_queue_for_each(rt2x00dev, queue) { - if (rt2x00queue_get_entry(queue, Q_INDEX_DMA_DONE) != - rt2x00queue_get_entry(queue, Q_INDEX_DONE)) - return true; - } - return false; -} - -static inline bool rt2800usb_entry_txstatus_timeout(struct queue_entry *entry) -{ - bool tout; - - if (!test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) - return false; - - tout = time_after(jiffies, entry->last_action + msecs_to_jiffies(100)); - if (unlikely(tout)) - rt2x00_warn(entry->queue->rt2x00dev, - "TX status timeout for entry %d in queue %d\n", - entry->entry_idx, entry->queue->qid); - return tout; - -} - -static bool rt2800usb_txstatus_timeout(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - struct queue_entry *entry; - - tx_queue_for_each(rt2x00dev, queue) { - entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); - if (rt2800usb_entry_txstatus_timeout(entry)) - return true; - } - return false; -} - -#define TXSTATUS_READ_INTERVAL 1000000 - -static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev, - int urb_status, u32 tx_status) -{ - bool valid; - - if (urb_status) { - rt2x00_warn(rt2x00dev, "TX status read failed %d\n", - urb_status); - - goto stop_reading; - } - - valid = rt2x00_get_field32(tx_status, TX_STA_FIFO_VALID); - if (valid) { - if (!kfifo_put(&rt2x00dev->txstatus_fifo, &tx_status)) - rt2x00_warn(rt2x00dev, "TX status FIFO overrun\n"); - - queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); - - /* Reschedule urb to read TX status again instantly */ - return true; - } - - /* Check if there is any entry that timedout waiting on TX status */ - if (rt2800usb_txstatus_timeout(rt2x00dev)) - queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); - - if (rt2800usb_txstatus_pending(rt2x00dev)) { - /* Read register after 1 ms */ - hrtimer_start(&rt2x00dev->txstatus_timer, - ktime_set(0, TXSTATUS_READ_INTERVAL), - HRTIMER_MODE_REL); - return false; - } - -stop_reading: - clear_bit(TX_STATUS_READING, &rt2x00dev->flags); - /* - * There is small race window above, between txstatus pending check and - * clear_bit someone could do rt2x00usb_interrupt_txdone, so recheck - * here again if status reading is needed. - */ - if (rt2800usb_txstatus_pending(rt2x00dev) && - !test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags)) - return true; - else - return false; -} - -static void rt2800usb_async_read_tx_status(struct rt2x00_dev *rt2x00dev) -{ - - if (test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags)) - return; - - /* Read TX_STA_FIFO register after 2 ms */ - hrtimer_start(&rt2x00dev->txstatus_timer, - ktime_set(0, 2*TXSTATUS_READ_INTERVAL), - HRTIMER_MODE_REL); -} - -static void rt2800usb_tx_dma_done(struct queue_entry *entry) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - - rt2800usb_async_read_tx_status(rt2x00dev); -} - -static enum hrtimer_restart rt2800usb_tx_sta_fifo_timeout(struct hrtimer *timer) -{ - struct rt2x00_dev *rt2x00dev = - container_of(timer, struct rt2x00_dev, txstatus_timer); - - rt2x00usb_register_read_async(rt2x00dev, TX_STA_FIFO, - rt2800usb_tx_sta_fifo_read_completed); - - return HRTIMER_NORESTART; -} - -/* - * Firmware functions - */ -static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) -{ - return FIRMWARE_RT2870; -} - -static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev, - const u8 *data, const size_t len) -{ - int status; - u32 offset; - u32 length; - - /* - * Check which section of the firmware we need. - */ - if (rt2x00_rt(rt2x00dev, RT2860) || - rt2x00_rt(rt2x00dev, RT2872) || - rt2x00_rt(rt2x00dev, RT3070)) { - offset = 0; - length = 4096; - } else { - offset = 4096; - length = 4096; - } - - /* - * Write firmware to device. - */ - rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, - data + offset, length); - - rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); - rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); - - /* - * Send firmware request to device to load firmware, - * we need to specify a long timeout time. - */ - status = rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, - 0, USB_MODE_FIRMWARE, - REGISTER_TIMEOUT_FIRMWARE); - if (status < 0) { - rt2x00_err(rt2x00dev, "Failed to write Firmware to device\n"); - return status; - } - - msleep(10); - rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); - - return 0; -} - -/* - * Device state switch handlers. - */ -static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - /* - * Wait until BBP and RF are ready. - */ - if (rt2800_wait_csr_ready(rt2x00dev)) - return -EBUSY; - - rt2x00usb_register_read(rt2x00dev, PBF_SYS_CTRL, ®); - rt2x00usb_register_write(rt2x00dev, PBF_SYS_CTRL, reg & ~0x00002000); - - reg = 0; - rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_CSR, 1); - rt2x00_set_field32(®, MAC_SYS_CTRL_RESET_BBP, 1); - rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg); - - rt2x00usb_register_write(rt2x00dev, USB_DMA_CFG, 0x00000000); - - rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0, - USB_MODE_RESET, REGISTER_TIMEOUT); - - rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000); - - return 0; -} - -static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev))) - return -EIO; - - rt2x00usb_register_read(rt2x00dev, USB_DMA_CFG, ®); - rt2x00_set_field32(®, USB_DMA_CFG_PHY_CLEAR, 0); - rt2x00_set_field32(®, USB_DMA_CFG_RX_BULK_AGG_EN, 0); - rt2x00_set_field32(®, USB_DMA_CFG_RX_BULK_AGG_TIMEOUT, 128); - /* - * Total room for RX frames in kilobytes, PBF might still exceed - * this limit so reduce the number to prevent errors. - */ - rt2x00_set_field32(®, USB_DMA_CFG_RX_BULK_AGG_LIMIT, - ((rt2x00dev->ops->rx->entry_num * DATA_FRAME_SIZE) - / 1024) - 3); - rt2x00_set_field32(®, USB_DMA_CFG_RX_BULK_EN, 1); - rt2x00_set_field32(®, USB_DMA_CFG_TX_BULK_EN, 1); - rt2x00usb_register_write(rt2x00dev, USB_DMA_CFG, reg); - - return rt2800_enable_radio(rt2x00dev); -} - -static void rt2800usb_disable_radio(struct rt2x00_dev *rt2x00dev) -{ - rt2800_disable_radio(rt2x00dev); - rt2x00usb_disable_radio(rt2x00dev); -} - -static int rt2800usb_set_state(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - if (state == STATE_AWAKE) - rt2800_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 2); - else - rt2800_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0xff, 2); - - return 0; -} - -static int rt2800usb_set_device_state(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - int retval = 0; - - switch (state) { - case STATE_RADIO_ON: - /* - * Before the radio can be enabled, the device first has - * to be woken up. After that it needs a bit of time - * to be fully awake and then the radio can be enabled. - */ - rt2800usb_set_state(rt2x00dev, STATE_AWAKE); - msleep(1); - retval = rt2800usb_enable_radio(rt2x00dev); - break; - case STATE_RADIO_OFF: - /* - * After the radio has been disabled, the device should - * be put to sleep for powersaving. - */ - rt2800usb_disable_radio(rt2x00dev); - rt2800usb_set_state(rt2x00dev, STATE_SLEEP); - break; - case STATE_RADIO_IRQ_ON: - case STATE_RADIO_IRQ_OFF: - /* No support, but no error either */ - break; - case STATE_DEEP_SLEEP: - case STATE_SLEEP: - case STATE_STANDBY: - case STATE_AWAKE: - retval = rt2800usb_set_state(rt2x00dev, state); - break; - default: - retval = -ENOTSUPP; - break; - } - - if (unlikely(retval)) - rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", - state, retval); - - return retval; -} - -/* - * Watchdog handlers - */ -static void rt2800usb_watchdog(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u32 reg; - - rt2x00usb_register_read(rt2x00dev, TXRXQ_PCNT, ®); - if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q)) { - rt2x00_warn(rt2x00dev, "TX HW queue 0 timed out, invoke forced kick\n"); - - rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40012); - - for (i = 0; i < 10; i++) { - udelay(10); - if (!rt2x00_get_field32(reg, TXRXQ_PCNT_TX0Q)) - break; - } - - rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40006); - } - - rt2x00usb_register_read(rt2x00dev, TXRXQ_PCNT, ®); - if (rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q)) { - rt2x00_warn(rt2x00dev, "TX HW queue 1 timed out, invoke forced kick\n"); - - rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf4000a); - - for (i = 0; i < 10; i++) { - udelay(10); - if (!rt2x00_get_field32(reg, TXRXQ_PCNT_TX1Q)) - break; - } - - rt2x00usb_register_write(rt2x00dev, PBF_CFG, 0xf40006); - } - - rt2x00usb_watchdog(rt2x00dev); -} - -/* - * TX descriptor initialization - */ -static __le32 *rt2800usb_get_txwi(struct queue_entry *entry) -{ - if (entry->queue->qid == QID_BEACON) - return (__le32 *) (entry->skb->data); - else - return (__le32 *) (entry->skb->data + TXINFO_DESC_SIZE); -} - -static void rt2800usb_write_tx_desc(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - __le32 *txi = (__le32 *) entry->skb->data; - u32 word; - - /* - * Initialize TXINFO descriptor - */ - rt2x00_desc_read(txi, 0, &word); - - /* - * The size of TXINFO_W0_USB_DMA_TX_PKT_LEN is - * TXWI + 802.11 header + L2 pad + payload + pad, - * so need to decrease size of TXINFO. - */ - rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_PKT_LEN, - roundup(entry->skb->len, 4) - TXINFO_DESC_SIZE); - rt2x00_set_field32(&word, TXINFO_W0_WIV, - !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags)); - rt2x00_set_field32(&word, TXINFO_W0_QSEL, 2); - rt2x00_set_field32(&word, TXINFO_W0_SW_USE_LAST_ROUND, 0); - rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_NEXT_VALID, 0); - rt2x00_set_field32(&word, TXINFO_W0_USB_DMA_TX_BURST, - test_bit(ENTRY_TXD_BURST, &txdesc->flags)); - rt2x00_desc_write(txi, 0, word); - - /* - * Register descriptor details in skb frame descriptor. - */ - skbdesc->flags |= SKBDESC_DESC_IN_SKB; - skbdesc->desc = txi; - skbdesc->desc_len = TXINFO_DESC_SIZE + entry->queue->winfo_size; -} - -/* - * TX data initialization - */ -static int rt2800usb_get_tx_data_len(struct queue_entry *entry) -{ - /* - * pad(1~3 bytes) is needed after each 802.11 payload. - * USB end pad(4 bytes) is needed at each USB bulk out packet end. - * TX frame format is : - * | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end pad | - * |<------------- tx_pkt_len ------------->| - */ - - return roundup(entry->skb->len, 4) + 4; -} - -/* - * TX control handlers - */ -static enum txdone_entry_desc_flags -rt2800usb_txdone_entry_check(struct queue_entry *entry, u32 reg) -{ - __le32 *txwi; - u32 word; - int wcid, ack, pid; - int tx_wcid, tx_ack, tx_pid, is_agg; - - /* - * This frames has returned with an IO error, - * so the status report is not intended for this - * frame. - */ - if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags)) - return TXDONE_FAILURE; - - wcid = rt2x00_get_field32(reg, TX_STA_FIFO_WCID); - ack = rt2x00_get_field32(reg, TX_STA_FIFO_TX_ACK_REQUIRED); - pid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_TYPE); - is_agg = rt2x00_get_field32(reg, TX_STA_FIFO_TX_AGGRE); - - /* - * Validate if this TX status report is intended for - * this entry by comparing the WCID/ACK/PID fields. - */ - txwi = rt2800usb_get_txwi(entry); - - rt2x00_desc_read(txwi, 1, &word); - tx_wcid = rt2x00_get_field32(word, TXWI_W1_WIRELESS_CLI_ID); - tx_ack = rt2x00_get_field32(word, TXWI_W1_ACK); - tx_pid = rt2x00_get_field32(word, TXWI_W1_PACKETID); - - if (wcid != tx_wcid || ack != tx_ack || (!is_agg && pid != tx_pid)) { - rt2x00_dbg(entry->queue->rt2x00dev, - "TX status report missed for queue %d entry %d\n", - entry->queue->qid, entry->entry_idx); - return TXDONE_UNKNOWN; - } - - return TXDONE_SUCCESS; -} - -static void rt2800usb_txdone(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - struct queue_entry *entry; - u32 reg; - u8 qid; - enum txdone_entry_desc_flags done_status; - - while (kfifo_get(&rt2x00dev->txstatus_fifo, ®)) { - /* - * TX_STA_FIFO_PID_QUEUE is a 2-bit field, thus qid is - * guaranteed to be one of the TX QIDs . - */ - qid = rt2x00_get_field32(reg, TX_STA_FIFO_PID_QUEUE); - queue = rt2x00queue_get_tx_queue(rt2x00dev, qid); - - if (unlikely(rt2x00queue_empty(queue))) { - rt2x00_warn(rt2x00dev, "Got TX status for an empty queue %u, dropping\n", - qid); - break; - } - - entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); - - if (unlikely(test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || - !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))) { - rt2x00_warn(rt2x00dev, "Data pending for entry %u in queue %u\n", - entry->entry_idx, qid); - break; - } - - done_status = rt2800usb_txdone_entry_check(entry, reg); - if (likely(done_status == TXDONE_SUCCESS)) - rt2800_txdone_entry(entry, reg, rt2800usb_get_txwi(entry)); - else - rt2x00lib_txdone_noinfo(entry, done_status); - } -} - -static void rt2800usb_txdone_nostatus(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - struct queue_entry *entry; - - /* - * Process any trailing TX status reports for IO failures, - * we loop until we find the first non-IO error entry. This - * can either be a frame which is free, is being uploaded, - * or has completed the upload but didn't have an entry - * in the TX_STAT_FIFO register yet. - */ - tx_queue_for_each(rt2x00dev, queue) { - while (!rt2x00queue_empty(queue)) { - entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); - - if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || - !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) - break; - - if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags)) - rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE); - else if (rt2800usb_entry_txstatus_timeout(entry)) - rt2x00lib_txdone_noinfo(entry, TXDONE_UNKNOWN); - else - break; - } - } -} - -static void rt2800usb_work_txdone(struct work_struct *work) -{ - struct rt2x00_dev *rt2x00dev = - container_of(work, struct rt2x00_dev, txdone_work); - - while (!kfifo_is_empty(&rt2x00dev->txstatus_fifo) || - rt2800usb_txstatus_timeout(rt2x00dev)) { - - rt2800usb_txdone(rt2x00dev); - - rt2800usb_txdone_nostatus(rt2x00dev); - - /* - * The hw may delay sending the packet after DMA complete - * if the medium is busy, thus the TX_STA_FIFO entry is - * also delayed -> use a timer to retrieve it. - */ - if (rt2800usb_txstatus_pending(rt2x00dev)) - rt2800usb_async_read_tx_status(rt2x00dev); - } -} - -/* - * RX control handlers - */ -static void rt2800usb_fill_rxdone(struct queue_entry *entry, - struct rxdone_entry_desc *rxdesc) -{ - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - __le32 *rxi = (__le32 *)entry->skb->data; - __le32 *rxd; - u32 word; - int rx_pkt_len; - - /* - * Copy descriptor to the skbdesc->desc buffer, making it safe from - * moving of frame data in rt2x00usb. - */ - memcpy(skbdesc->desc, rxi, skbdesc->desc_len); - - /* - * RX frame format is : - * | RXINFO | RXWI | header | L2 pad | payload | pad | RXD | USB pad | - * |<------------ rx_pkt_len -------------->| - */ - rt2x00_desc_read(rxi, 0, &word); - rx_pkt_len = rt2x00_get_field32(word, RXINFO_W0_USB_DMA_RX_PKT_LEN); - - /* - * Remove the RXINFO structure from the sbk. - */ - skb_pull(entry->skb, RXINFO_DESC_SIZE); - - /* - * Check for rx_pkt_len validity. Return if invalid, leaving - * rxdesc->size zeroed out by the upper level. - */ - if (unlikely(rx_pkt_len == 0 || - rx_pkt_len > entry->queue->data_size)) { - rt2x00_err(entry->queue->rt2x00dev, - "Bad frame size %d, forcing to 0\n", rx_pkt_len); - return; - } - - rxd = (__le32 *)(entry->skb->data + rx_pkt_len); - - /* - * It is now safe to read the descriptor on all architectures. - */ - rt2x00_desc_read(rxd, 0, &word); - - if (rt2x00_get_field32(word, RXD_W0_CRC_ERROR)) - rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; - - rxdesc->cipher_status = rt2x00_get_field32(word, RXD_W0_CIPHER_ERROR); - - if (rt2x00_get_field32(word, RXD_W0_DECRYPTED)) { - /* - * Hardware has stripped IV/EIV data from 802.11 frame during - * decryption. Unfortunately the descriptor doesn't contain - * any fields with the EIV/IV data either, so they can't - * be restored by rt2x00lib. - */ - rxdesc->flags |= RX_FLAG_IV_STRIPPED; - - /* - * The hardware has already checked the Michael Mic and has - * stripped it from the frame. Signal this to mac80211. - */ - rxdesc->flags |= RX_FLAG_MMIC_STRIPPED; - - if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) - rxdesc->flags |= RX_FLAG_DECRYPTED; - else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) - rxdesc->flags |= RX_FLAG_MMIC_ERROR; - } - - if (rt2x00_get_field32(word, RXD_W0_MY_BSS)) - rxdesc->dev_flags |= RXDONE_MY_BSS; - - if (rt2x00_get_field32(word, RXD_W0_L2PAD)) - rxdesc->dev_flags |= RXDONE_L2PAD; - - /* - * Remove RXD descriptor from end of buffer. - */ - skb_trim(entry->skb, rx_pkt_len); - - /* - * Process the RXWI structure. - */ - rt2800_process_rxwi(entry, rxdesc); -} - -/* - * Device probe functions. - */ -static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) -{ - int retval; - - if (rt2800_efuse_detect(rt2x00dev)) - retval = rt2800_read_eeprom_efuse(rt2x00dev); - else - retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, - EEPROM_SIZE); - - return retval; -} - -static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev) -{ - int retval; - - retval = rt2800_probe_hw(rt2x00dev); - if (retval) - return retval; - - /* - * Set txstatus timer function. - */ - rt2x00dev->txstatus_timer.function = rt2800usb_tx_sta_fifo_timeout; - - /* - * Overwrite TX done handler - */ - PREPARE_WORK(&rt2x00dev->txdone_work, rt2800usb_work_txdone); - - return 0; -} - -static const struct ieee80211_ops rt2800usb_mac80211_ops = { - .tx = rt2x00mac_tx, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, - .remove_interface = rt2x00mac_remove_interface, - .config = rt2x00mac_config, - .configure_filter = rt2x00mac_configure_filter, - .set_tim = rt2x00mac_set_tim, - .set_key = rt2x00mac_set_key, - .sw_scan_start = rt2x00mac_sw_scan_start, - .sw_scan_complete = rt2x00mac_sw_scan_complete, - .get_stats = rt2x00mac_get_stats, - .get_tkip_seq = rt2800_get_tkip_seq, - .set_rts_threshold = rt2800_set_rts_threshold, - .sta_add = rt2x00mac_sta_add, - .sta_remove = rt2x00mac_sta_remove, - .bss_info_changed = rt2x00mac_bss_info_changed, - .conf_tx = rt2800_conf_tx, - .get_tsf = rt2800_get_tsf, - .rfkill_poll = rt2x00mac_rfkill_poll, - .ampdu_action = rt2800_ampdu_action, - .flush = rt2x00mac_flush, - .get_survey = rt2800_get_survey, - .get_ringparam = rt2x00mac_get_ringparam, - .tx_frames_pending = rt2x00mac_tx_frames_pending, -}; - -static const struct rt2800_ops rt2800usb_rt2800_ops = { - .register_read = rt2x00usb_register_read, - .register_read_lock = rt2x00usb_register_read_lock, - .register_write = rt2x00usb_register_write, - .register_write_lock = rt2x00usb_register_write_lock, - .register_multiread = rt2x00usb_register_multiread, - .register_multiwrite = rt2x00usb_register_multiwrite, - .regbusy_read = rt2x00usb_regbusy_read, - .read_eeprom = rt2800usb_read_eeprom, - .hwcrypt_disabled = rt2800usb_hwcrypt_disabled, - .drv_write_firmware = rt2800usb_write_firmware, - .drv_init_registers = rt2800usb_init_registers, - .drv_get_txwi = rt2800usb_get_txwi, -}; - -static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { - .probe_hw = rt2800usb_probe_hw, - .get_firmware_name = rt2800usb_get_firmware_name, - .check_firmware = rt2800_check_firmware, - .load_firmware = rt2800_load_firmware, - .initialize = rt2x00usb_initialize, - .uninitialize = rt2x00usb_uninitialize, - .clear_entry = rt2x00usb_clear_entry, - .set_device_state = rt2800usb_set_device_state, - .rfkill_poll = rt2800_rfkill_poll, - .link_stats = rt2800_link_stats, - .reset_tuner = rt2800_reset_tuner, - .link_tuner = rt2800_link_tuner, - .gain_calibration = rt2800_gain_calibration, - .vco_calibration = rt2800_vco_calibration, - .watchdog = rt2800usb_watchdog, - .start_queue = rt2800usb_start_queue, - .kick_queue = rt2x00usb_kick_queue, - .stop_queue = rt2800usb_stop_queue, - .flush_queue = rt2x00usb_flush_queue, - .tx_dma_done = rt2800usb_tx_dma_done, - .write_tx_desc = rt2800usb_write_tx_desc, - .write_tx_data = rt2800_write_tx_data, - .write_beacon = rt2800_write_beacon, - .clear_beacon = rt2800_clear_beacon, - .get_tx_data_len = rt2800usb_get_tx_data_len, - .fill_rxdone = rt2800usb_fill_rxdone, - .config_shared_key = rt2800_config_shared_key, - .config_pairwise_key = rt2800_config_pairwise_key, - .config_filter = rt2800_config_filter, - .config_intf = rt2800_config_intf, - .config_erp = rt2800_config_erp, - .config_ant = rt2800_config_ant, - .config = rt2800_config, - .sta_add = rt2800_sta_add, - .sta_remove = rt2800_sta_remove, -}; - -static const struct data_queue_desc rt2800usb_queue_rx = { - .entry_num = 128, - .data_size = AGGREGATION_SIZE, - .desc_size = RXINFO_DESC_SIZE, - .winfo_size = RXWI_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_usb), -}; - -static const struct data_queue_desc rt2800usb_queue_tx = { - .entry_num = 16, - .data_size = AGGREGATION_SIZE, - .desc_size = TXINFO_DESC_SIZE, - .winfo_size = TXWI_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_usb), -}; - -static const struct data_queue_desc rt2800usb_queue_bcn = { - .entry_num = 8, - .data_size = MGMT_FRAME_SIZE, - .desc_size = TXINFO_DESC_SIZE, - .winfo_size = TXWI_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_usb), -}; - -static const struct rt2x00_ops rt2800usb_ops = { - .name = KBUILD_MODNAME, - .drv_data_size = sizeof(struct rt2800_drv_data), - .max_ap_intf = 8, - .eeprom_size = EEPROM_SIZE, - .rf_size = RF_SIZE, - .tx_queues = NUM_TX_QUEUES, - .extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE, - .rx = &rt2800usb_queue_rx, - .tx = &rt2800usb_queue_tx, - .bcn = &rt2800usb_queue_bcn, - .lib = &rt2800usb_rt2x00_ops, - .drv = &rt2800usb_rt2800_ops, - .hw = &rt2800usb_mac80211_ops, -#ifdef CONFIG_RT2X00_LIB_DEBUGFS - .debugfs = &rt2800_rt2x00debug, -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -}; - -static const struct data_queue_desc rt2800usb_queue_rx_5592 = { - .entry_num = 128, - .data_size = AGGREGATION_SIZE, - .desc_size = RXINFO_DESC_SIZE, - .winfo_size = RXWI_DESC_SIZE_5592, - .priv_size = sizeof(struct queue_entry_priv_usb), -}; - -static const struct data_queue_desc rt2800usb_queue_tx_5592 = { - .entry_num = 16, - .data_size = AGGREGATION_SIZE, - .desc_size = TXINFO_DESC_SIZE, - .winfo_size = TXWI_DESC_SIZE_5592, - .priv_size = sizeof(struct queue_entry_priv_usb), -}; - -static const struct data_queue_desc rt2800usb_queue_bcn_5592 = { - .entry_num = 8, - .data_size = MGMT_FRAME_SIZE, - .desc_size = TXINFO_DESC_SIZE, - .winfo_size = TXWI_DESC_SIZE_5592, - .priv_size = sizeof(struct queue_entry_priv_usb), -}; - - -static const struct rt2x00_ops rt2800usb_ops_5592 = { - .name = KBUILD_MODNAME, - .drv_data_size = sizeof(struct rt2800_drv_data), - .max_ap_intf = 8, - .eeprom_size = EEPROM_SIZE, - .rf_size = RF_SIZE, - .tx_queues = NUM_TX_QUEUES, - .extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE_5592, - .rx = &rt2800usb_queue_rx_5592, - .tx = &rt2800usb_queue_tx_5592, - .bcn = &rt2800usb_queue_bcn_5592, - .lib = &rt2800usb_rt2x00_ops, - .drv = &rt2800usb_rt2800_ops, - .hw = &rt2800usb_mac80211_ops, -#ifdef CONFIG_RT2X00_LIB_DEBUGFS - .debugfs = &rt2800_rt2x00debug, -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -}; - -/* - * rt2800usb module information. - */ -static struct usb_device_id rt2800usb_device_table[] = { - /* Abocom */ - { USB_DEVICE(0x07b8, 0x2870) }, - { USB_DEVICE(0x07b8, 0x2770) }, - { USB_DEVICE(0x07b8, 0x3070) }, - { USB_DEVICE(0x07b8, 0x3071) }, - { USB_DEVICE(0x07b8, 0x3072) }, - { USB_DEVICE(0x1482, 0x3c09) }, - /* AirTies */ - { USB_DEVICE(0x1eda, 0x2012) }, - { USB_DEVICE(0x1eda, 0x2210) }, - { USB_DEVICE(0x1eda, 0x2310) }, - /* Allwin */ - { USB_DEVICE(0x8516, 0x2070) }, - { USB_DEVICE(0x8516, 0x2770) }, - { USB_DEVICE(0x8516, 0x2870) }, - { USB_DEVICE(0x8516, 0x3070) }, - { USB_DEVICE(0x8516, 0x3071) }, - { USB_DEVICE(0x8516, 0x3072) }, - /* Alpha Networks */ - { USB_DEVICE(0x14b2, 0x3c06) }, - { USB_DEVICE(0x14b2, 0x3c07) }, - { USB_DEVICE(0x14b2, 0x3c09) }, - { USB_DEVICE(0x14b2, 0x3c12) }, - { USB_DEVICE(0x14b2, 0x3c23) }, - { USB_DEVICE(0x14b2, 0x3c25) }, - { USB_DEVICE(0x14b2, 0x3c27) }, - { USB_DEVICE(0x14b2, 0x3c28) }, - { USB_DEVICE(0x14b2, 0x3c2c) }, - /* Amit */ - { USB_DEVICE(0x15c5, 0x0008) }, - /* Askey */ - { USB_DEVICE(0x1690, 0x0740) }, - /* ASUS */ - { USB_DEVICE(0x0b05, 0x1731) }, - { USB_DEVICE(0x0b05, 0x1732) }, - { USB_DEVICE(0x0b05, 0x1742) }, - { USB_DEVICE(0x0b05, 0x1784) }, - { USB_DEVICE(0x1761, 0x0b05) }, - /* AzureWave */ - { USB_DEVICE(0x13d3, 0x3247) }, - { USB_DEVICE(0x13d3, 0x3273) }, - { USB_DEVICE(0x13d3, 0x3305) }, - { USB_DEVICE(0x13d3, 0x3307) }, - { USB_DEVICE(0x13d3, 0x3321) }, - /* Belkin */ - { USB_DEVICE(0x050d, 0x8053) }, - { USB_DEVICE(0x050d, 0x805c) }, - { USB_DEVICE(0x050d, 0x815c) }, - { USB_DEVICE(0x050d, 0x825a) }, - { USB_DEVICE(0x050d, 0x825b) }, - { USB_DEVICE(0x050d, 0x935a) }, - { USB_DEVICE(0x050d, 0x935b) }, - /* Buffalo */ - { USB_DEVICE(0x0411, 0x00e8) }, - { USB_DEVICE(0x0411, 0x0158) }, - { USB_DEVICE(0x0411, 0x015d) }, - { USB_DEVICE(0x0411, 0x016f) }, - { USB_DEVICE(0x0411, 0x01a2) }, - { USB_DEVICE(0x0411, 0x01ee) }, - /* Corega */ - { USB_DEVICE(0x07aa, 0x002f) }, - { USB_DEVICE(0x07aa, 0x003c) }, - { USB_DEVICE(0x07aa, 0x003f) }, - { USB_DEVICE(0x18c5, 0x0012) }, - /* D-Link */ - { USB_DEVICE(0x07d1, 0x3c09) }, - { USB_DEVICE(0x07d1, 0x3c0a) }, - { USB_DEVICE(0x07d1, 0x3c0d) }, - { USB_DEVICE(0x07d1, 0x3c0e) }, - { USB_DEVICE(0x07d1, 0x3c0f) }, - { USB_DEVICE(0x07d1, 0x3c11) }, - { USB_DEVICE(0x07d1, 0x3c13) }, - { USB_DEVICE(0x07d1, 0x3c15) }, - { USB_DEVICE(0x07d1, 0x3c16) }, - { USB_DEVICE(0x07d1, 0x3c17) }, - { USB_DEVICE(0x2001, 0x3c1b) }, - /* Draytek */ - { USB_DEVICE(0x07fa, 0x7712) }, - /* DVICO */ - { USB_DEVICE(0x0fe9, 0xb307) }, - /* Edimax */ - { USB_DEVICE(0x7392, 0x4085) }, - { USB_DEVICE(0x7392, 0x7711) }, - { USB_DEVICE(0x7392, 0x7717) }, - { USB_DEVICE(0x7392, 0x7718) }, - { USB_DEVICE(0x7392, 0x7722) }, - /* Encore */ - { USB_DEVICE(0x203d, 0x1480) }, - { USB_DEVICE(0x203d, 0x14a9) }, - /* EnGenius */ - { USB_DEVICE(0x1740, 0x9701) }, - { USB_DEVICE(0x1740, 0x9702) }, - { USB_DEVICE(0x1740, 0x9703) }, - { USB_DEVICE(0x1740, 0x9705) }, - { USB_DEVICE(0x1740, 0x9706) }, - { USB_DEVICE(0x1740, 0x9707) }, - { USB_DEVICE(0x1740, 0x9708) }, - { USB_DEVICE(0x1740, 0x9709) }, - /* Gemtek */ - { USB_DEVICE(0x15a9, 0x0012) }, - /* Gigabyte */ - { USB_DEVICE(0x1044, 0x800b) }, - { USB_DEVICE(0x1044, 0x800d) }, - /* Hawking */ - { USB_DEVICE(0x0e66, 0x0001) }, - { USB_DEVICE(0x0e66, 0x0003) }, - { USB_DEVICE(0x0e66, 0x0009) }, - { USB_DEVICE(0x0e66, 0x000b) }, - { USB_DEVICE(0x0e66, 0x0013) }, - { USB_DEVICE(0x0e66, 0x0017) }, - { USB_DEVICE(0x0e66, 0x0018) }, - /* I-O DATA */ - { USB_DEVICE(0x04bb, 0x0945) }, - { USB_DEVICE(0x04bb, 0x0947) }, - { USB_DEVICE(0x04bb, 0x0948) }, - /* Linksys */ - { USB_DEVICE(0x13b1, 0x0031) }, - { USB_DEVICE(0x1737, 0x0070) }, - { USB_DEVICE(0x1737, 0x0071) }, - { USB_DEVICE(0x1737, 0x0077) }, - { USB_DEVICE(0x1737, 0x0078) }, - /* Logitec */ - { USB_DEVICE(0x0789, 0x0162) }, - { USB_DEVICE(0x0789, 0x0163) }, - { USB_DEVICE(0x0789, 0x0164) }, - { USB_DEVICE(0x0789, 0x0166) }, - /* Motorola */ - { USB_DEVICE(0x100d, 0x9031) }, - /* MSI */ - { USB_DEVICE(0x0db0, 0x3820) }, - { USB_DEVICE(0x0db0, 0x3821) }, - { USB_DEVICE(0x0db0, 0x3822) }, - { USB_DEVICE(0x0db0, 0x3870) }, - { USB_DEVICE(0x0db0, 0x3871) }, - { USB_DEVICE(0x0db0, 0x6899) }, - { USB_DEVICE(0x0db0, 0x821a) }, - { USB_DEVICE(0x0db0, 0x822a) }, - { USB_DEVICE(0x0db0, 0x822b) }, - { USB_DEVICE(0x0db0, 0x822c) }, - { USB_DEVICE(0x0db0, 0x870a) }, - { USB_DEVICE(0x0db0, 0x871a) }, - { USB_DEVICE(0x0db0, 0x871b) }, - { USB_DEVICE(0x0db0, 0x871c) }, - { USB_DEVICE(0x0db0, 0x899a) }, - /* Ovislink */ - { USB_DEVICE(0x1b75, 0x3071) }, - { USB_DEVICE(0x1b75, 0x3072) }, - /* Para */ - { USB_DEVICE(0x20b8, 0x8888) }, - /* Pegatron */ - { USB_DEVICE(0x1d4d, 0x0002) }, - { USB_DEVICE(0x1d4d, 0x000c) }, - { USB_DEVICE(0x1d4d, 0x000e) }, - { USB_DEVICE(0x1d4d, 0x0011) }, - /* Philips */ - { USB_DEVICE(0x0471, 0x200f) }, - /* Planex */ - { USB_DEVICE(0x2019, 0x5201) }, - { USB_DEVICE(0x2019, 0xab25) }, - { USB_DEVICE(0x2019, 0xed06) }, - /* Quanta */ - { USB_DEVICE(0x1a32, 0x0304) }, - /* Ralink */ - { USB_DEVICE(0x148f, 0x2070) }, - { USB_DEVICE(0x148f, 0x2770) }, - { USB_DEVICE(0x148f, 0x2870) }, - { USB_DEVICE(0x148f, 0x3070) }, - { USB_DEVICE(0x148f, 0x3071) }, - { USB_DEVICE(0x148f, 0x3072) }, - /* Samsung */ - { USB_DEVICE(0x04e8, 0x2018) }, - /* Siemens */ - { USB_DEVICE(0x129b, 0x1828) }, - /* Sitecom */ - { USB_DEVICE(0x0df6, 0x0017) }, - { USB_DEVICE(0x0df6, 0x002b) }, - { USB_DEVICE(0x0df6, 0x002c) }, - { USB_DEVICE(0x0df6, 0x002d) }, - { USB_DEVICE(0x0df6, 0x0039) }, - { USB_DEVICE(0x0df6, 0x003b) }, - { USB_DEVICE(0x0df6, 0x003d) }, - { USB_DEVICE(0x0df6, 0x003e) }, - { USB_DEVICE(0x0df6, 0x003f) }, - { USB_DEVICE(0x0df6, 0x0040) }, - { USB_DEVICE(0x0df6, 0x0042) }, - { USB_DEVICE(0x0df6, 0x0047) }, - { USB_DEVICE(0x0df6, 0x0048) }, - { USB_DEVICE(0x0df6, 0x0051) }, - { USB_DEVICE(0x0df6, 0x005f) }, - { USB_DEVICE(0x0df6, 0x0060) }, - /* SMC */ - { USB_DEVICE(0x083a, 0x6618) }, - { USB_DEVICE(0x083a, 0x7511) }, - { USB_DEVICE(0x083a, 0x7512) }, - { USB_DEVICE(0x083a, 0x7522) }, - { USB_DEVICE(0x083a, 0x8522) }, - { USB_DEVICE(0x083a, 0xa618) }, - { USB_DEVICE(0x083a, 0xa701) }, - { USB_DEVICE(0x083a, 0xa702) }, - { USB_DEVICE(0x083a, 0xa703) }, - { USB_DEVICE(0x083a, 0xb522) }, - /* Sparklan */ - { USB_DEVICE(0x15a9, 0x0006) }, - /* Sweex */ - { USB_DEVICE(0x177f, 0x0153) }, - { USB_DEVICE(0x177f, 0x0164) }, - { USB_DEVICE(0x177f, 0x0302) }, - { USB_DEVICE(0x177f, 0x0313) }, - { USB_DEVICE(0x177f, 0x0323) }, - { USB_DEVICE(0x177f, 0x0324) }, - /* U-Media */ - { USB_DEVICE(0x157e, 0x300e) }, - { USB_DEVICE(0x157e, 0x3013) }, - /* ZCOM */ - { USB_DEVICE(0x0cde, 0x0022) }, - { USB_DEVICE(0x0cde, 0x0025) }, - /* Zinwell */ - { USB_DEVICE(0x5a57, 0x0280) }, - { USB_DEVICE(0x5a57, 0x0282) }, - { USB_DEVICE(0x5a57, 0x0283) }, - { USB_DEVICE(0x5a57, 0x5257) }, - /* Zyxel */ - { USB_DEVICE(0x0586, 0x3416) }, - { USB_DEVICE(0x0586, 0x3418) }, - { USB_DEVICE(0x0586, 0x341a) }, - { USB_DEVICE(0x0586, 0x341e) }, - { USB_DEVICE(0x0586, 0x343e) }, -#ifdef CONFIG_RT2800USB_RT33XX - /* Belkin */ - { USB_DEVICE(0x050d, 0x945b) }, - /* D-Link */ - { USB_DEVICE(0x2001, 0x3c17) }, - /* Panasonic */ - { USB_DEVICE(0x083a, 0xb511) }, - /* Philips */ - { USB_DEVICE(0x0471, 0x20dd) }, - /* Ralink */ - { USB_DEVICE(0x148f, 0x3370) }, - { USB_DEVICE(0x148f, 0x8070) }, - /* Sitecom */ - { USB_DEVICE(0x0df6, 0x0050) }, - /* Sweex */ - { USB_DEVICE(0x177f, 0x0163) }, - { USB_DEVICE(0x177f, 0x0165) }, -#endif -#ifdef CONFIG_RT2800USB_RT35XX - /* Allwin */ - { USB_DEVICE(0x8516, 0x3572) }, - /* Askey */ - { USB_DEVICE(0x1690, 0x0744) }, - { USB_DEVICE(0x1690, 0x0761) }, - { USB_DEVICE(0x1690, 0x0764) }, - /* ASUS */ - { USB_DEVICE(0x0b05, 0x179d) }, - /* Cisco */ - { USB_DEVICE(0x167b, 0x4001) }, - /* EnGenius */ - { USB_DEVICE(0x1740, 0x9801) }, - /* I-O DATA */ - { USB_DEVICE(0x04bb, 0x0944) }, - /* Linksys */ - { USB_DEVICE(0x13b1, 0x002f) }, - { USB_DEVICE(0x1737, 0x0079) }, - /* Ralink */ - { USB_DEVICE(0x148f, 0x3572) }, - /* Sitecom */ - { USB_DEVICE(0x0df6, 0x0041) }, - { USB_DEVICE(0x0df6, 0x0062) }, - { USB_DEVICE(0x0df6, 0x0065) }, - { USB_DEVICE(0x0df6, 0x0066) }, - { USB_DEVICE(0x0df6, 0x0068) }, - /* Toshiba */ - { USB_DEVICE(0x0930, 0x0a07) }, - /* Zinwell */ - { USB_DEVICE(0x5a57, 0x0284) }, -#endif -#ifdef CONFIG_RT2800USB_RT53XX - /* Arcadyan */ - { USB_DEVICE(0x043e, 0x7a12) }, - { USB_DEVICE(0x043e, 0x7a32) }, - /* Azurewave */ - { USB_DEVICE(0x13d3, 0x3329) }, - { USB_DEVICE(0x13d3, 0x3365) }, - /* D-Link */ - { USB_DEVICE(0x2001, 0x3c15) }, - { USB_DEVICE(0x2001, 0x3c19) }, - { USB_DEVICE(0x2001, 0x3c1c) }, - { USB_DEVICE(0x2001, 0x3c1d) }, - { USB_DEVICE(0x2001, 0x3c1e) }, - /* LG innotek */ - { USB_DEVICE(0x043e, 0x7a22) }, - { USB_DEVICE(0x043e, 0x7a42) }, - /* Panasonic */ - { USB_DEVICE(0x04da, 0x1801) }, - { USB_DEVICE(0x04da, 0x1800) }, - { USB_DEVICE(0x04da, 0x23f6) }, - /* Philips */ - { USB_DEVICE(0x0471, 0x2104) }, - { USB_DEVICE(0x0471, 0x2126) }, - { USB_DEVICE(0x0471, 0x2180) }, - { USB_DEVICE(0x0471, 0x2181) }, - { USB_DEVICE(0x0471, 0x2182) }, - /* Ralink */ - { USB_DEVICE(0x148f, 0x5370) }, - { USB_DEVICE(0x148f, 0x5372) }, -#endif -#ifdef CONFIG_RT2800USB_RT55XX - /* Arcadyan */ - { USB_DEVICE(0x043e, 0x7a32), .driver_info = 5592 }, - /* AVM GmbH */ - { USB_DEVICE(0x057c, 0x8501), .driver_info = 5592 }, - /* D-Link DWA-160-B2 */ - { USB_DEVICE(0x2001, 0x3c1a), .driver_info = 5592 }, - /* Proware */ - { USB_DEVICE(0x043e, 0x7a13), .driver_info = 5592 }, - /* Ralink */ - { USB_DEVICE(0x148f, 0x5572), .driver_info = 5592 }, -#endif -#ifdef CONFIG_RT2800USB_UNKNOWN - /* - * Unclear what kind of devices these are (they aren't supported by the - * vendor linux driver). - */ - /* Abocom */ - { USB_DEVICE(0x07b8, 0x3073) }, - { USB_DEVICE(0x07b8, 0x3074) }, - /* Alpha Networks */ - { USB_DEVICE(0x14b2, 0x3c08) }, - { USB_DEVICE(0x14b2, 0x3c11) }, - /* Amigo */ - { USB_DEVICE(0x0e0b, 0x9031) }, - { USB_DEVICE(0x0e0b, 0x9041) }, - /* ASUS */ - { USB_DEVICE(0x0b05, 0x166a) }, - { USB_DEVICE(0x0b05, 0x1760) }, - { USB_DEVICE(0x0b05, 0x1761) }, - { USB_DEVICE(0x0b05, 0x1790) }, - { USB_DEVICE(0x0b05, 0x17a7) }, - /* AzureWave */ - { USB_DEVICE(0x13d3, 0x3262) }, - { USB_DEVICE(0x13d3, 0x3284) }, - { USB_DEVICE(0x13d3, 0x3322) }, - { USB_DEVICE(0x13d3, 0x3340) }, - { USB_DEVICE(0x13d3, 0x3399) }, - { USB_DEVICE(0x13d3, 0x3400) }, - { USB_DEVICE(0x13d3, 0x3401) }, - /* Belkin */ - { USB_DEVICE(0x050d, 0x1003) }, - /* Buffalo */ - { USB_DEVICE(0x0411, 0x012e) }, - { USB_DEVICE(0x0411, 0x0148) }, - { USB_DEVICE(0x0411, 0x0150) }, - /* Corega */ - { USB_DEVICE(0x07aa, 0x0041) }, - { USB_DEVICE(0x07aa, 0x0042) }, - { USB_DEVICE(0x18c5, 0x0008) }, - /* D-Link */ - { USB_DEVICE(0x07d1, 0x3c0b) }, - /* Encore */ - { USB_DEVICE(0x203d, 0x14a1) }, - /* EnGenius */ - { USB_DEVICE(0x1740, 0x0600) }, - { USB_DEVICE(0x1740, 0x0602) }, - /* Gemtek */ - { USB_DEVICE(0x15a9, 0x0010) }, - /* Gigabyte */ - { USB_DEVICE(0x1044, 0x800c) }, - /* Hercules */ - { USB_DEVICE(0x06f8, 0xe036) }, - /* Huawei */ - { USB_DEVICE(0x148f, 0xf101) }, - /* I-O DATA */ - { USB_DEVICE(0x04bb, 0x094b) }, - /* LevelOne */ - { USB_DEVICE(0x1740, 0x0605) }, - { USB_DEVICE(0x1740, 0x0615) }, - /* Logitec */ - { USB_DEVICE(0x0789, 0x0168) }, - { USB_DEVICE(0x0789, 0x0169) }, - /* Motorola */ - { USB_DEVICE(0x100d, 0x9032) }, - /* Pegatron */ - { USB_DEVICE(0x05a6, 0x0101) }, - { USB_DEVICE(0x1d4d, 0x0010) }, - /* Planex */ - { USB_DEVICE(0x2019, 0xab24) }, - /* Qcom */ - { USB_DEVICE(0x18e8, 0x6259) }, - /* RadioShack */ - { USB_DEVICE(0x08b9, 0x1197) }, - /* Sitecom */ - { USB_DEVICE(0x0df6, 0x003c) }, - { USB_DEVICE(0x0df6, 0x004a) }, - { USB_DEVICE(0x0df6, 0x004d) }, - { USB_DEVICE(0x0df6, 0x0053) }, - { USB_DEVICE(0x0df6, 0x0069) }, - { USB_DEVICE(0x0df6, 0x006f) }, - /* SMC */ - { USB_DEVICE(0x083a, 0xa512) }, - { USB_DEVICE(0x083a, 0xc522) }, - { USB_DEVICE(0x083a, 0xd522) }, - { USB_DEVICE(0x083a, 0xf511) }, - /* Sweex */ - { USB_DEVICE(0x177f, 0x0254) }, - /* TP-LINK */ - { USB_DEVICE(0xf201, 0x5370) }, -#endif - { 0, } -}; - -MODULE_AUTHOR(DRV_PROJECT); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION("Ralink RT2800 USB Wireless LAN driver."); -MODULE_SUPPORTED_DEVICE("Ralink RT2870 USB chipset based cards"); -MODULE_DEVICE_TABLE(usb, rt2800usb_device_table); -MODULE_FIRMWARE(FIRMWARE_RT2870); -MODULE_LICENSE("GPL"); - -static int rt2800usb_probe(struct usb_interface *usb_intf, - const struct usb_device_id *id) -{ - if (id->driver_info == 5592) - return rt2x00usb_probe(usb_intf, &rt2800usb_ops_5592); - - return rt2x00usb_probe(usb_intf, &rt2800usb_ops); -} - -static struct usb_driver rt2800usb_driver = { - .name = KBUILD_MODNAME, - .id_table = rt2800usb_device_table, - .probe = rt2800usb_probe, - .disconnect = rt2x00usb_disconnect, - .suspend = rt2x00usb_suspend, - .resume = rt2x00usb_resume, - .reset_resume = rt2x00usb_resume, - .disable_hub_initiated_lpm = 1, -}; - -module_usb_driver(rt2800usb_driver); diff --git a/drivers/net/wireless/rt2x00/rt2800usb.h b/drivers/net/wireless/rt2x00/rt2800usb.h deleted file mode 100644 index 671ea3592610..000000000000 --- a/drivers/net/wireless/rt2x00/rt2800usb.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - Copyright (C) 2009 Ivo van Doorn - Copyright (C) 2009 Mattias Nissler - Copyright (C) 2009 Felix Fietkau - Copyright (C) 2009 Xose Vazquez Perez - Copyright (C) 2009 Axel Kollhofer - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2800usb - Abstract: Data structures and registers for the rt2800usb module. - Supported chipsets: RT2800U. - */ - -#ifndef RT2800USB_H -#define RT2800USB_H - -/* - * 8051 firmware image. - */ -#define FIRMWARE_RT2870 "rt2870.bin" -#define FIRMWARE_IMAGE_BASE 0x3000 - -/* - * DMA descriptor defines. - */ -#define TXINFO_DESC_SIZE (1 * sizeof(__le32)) -#define RXINFO_DESC_SIZE (1 * sizeof(__le32)) - -/* - * TX Info structure - */ - -/* - * Word0 - * WIV: Wireless Info Valid. 1: Driver filled WI, 0: DMA needs to copy WI - * QSEL: Select on-chip FIFO ID for 2nd-stage output scheduler. - * 0:MGMT, 1:HCCA 2:EDCA - * USB_DMA_NEXT_VALID: Used ONLY in USB bulk Aggregation, NextValid - * DMA_TX_BURST: used ONLY in USB bulk Aggregation. - * Force USB DMA transmit frame from current selected endpoint - */ -#define TXINFO_W0_USB_DMA_TX_PKT_LEN FIELD32(0x0000ffff) -#define TXINFO_W0_WIV FIELD32(0x01000000) -#define TXINFO_W0_QSEL FIELD32(0x06000000) -#define TXINFO_W0_SW_USE_LAST_ROUND FIELD32(0x08000000) -#define TXINFO_W0_USB_DMA_NEXT_VALID FIELD32(0x40000000) -#define TXINFO_W0_USB_DMA_TX_BURST FIELD32(0x80000000) - -/* - * RX Info structure - */ - -/* - * Word 0 - */ - -#define RXINFO_W0_USB_DMA_RX_PKT_LEN FIELD32(0x0000ffff) - -/* - * RX descriptor format for RX Ring. - */ - -/* - * Word0 - * UNICAST_TO_ME: This RX frame is unicast to me. - * MULTICAST: This is a multicast frame. - * BROADCAST: This is a broadcast frame. - * MY_BSS: this frame belongs to the same BSSID. - * CRC_ERROR: CRC error. - * CIPHER_ERROR: 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid. - * AMSDU: rx with 802.3 header, not 802.11 header. - */ - -#define RXD_W0_BA FIELD32(0x00000001) -#define RXD_W0_DATA FIELD32(0x00000002) -#define RXD_W0_NULLDATA FIELD32(0x00000004) -#define RXD_W0_FRAG FIELD32(0x00000008) -#define RXD_W0_UNICAST_TO_ME FIELD32(0x00000010) -#define RXD_W0_MULTICAST FIELD32(0x00000020) -#define RXD_W0_BROADCAST FIELD32(0x00000040) -#define RXD_W0_MY_BSS FIELD32(0x00000080) -#define RXD_W0_CRC_ERROR FIELD32(0x00000100) -#define RXD_W0_CIPHER_ERROR FIELD32(0x00000600) -#define RXD_W0_AMSDU FIELD32(0x00000800) -#define RXD_W0_HTC FIELD32(0x00001000) -#define RXD_W0_RSSI FIELD32(0x00002000) -#define RXD_W0_L2PAD FIELD32(0x00004000) -#define RXD_W0_AMPDU FIELD32(0x00008000) -#define RXD_W0_DECRYPTED FIELD32(0x00010000) -#define RXD_W0_PLCP_RSSI FIELD32(0x00020000) -#define RXD_W0_CIPHER_ALG FIELD32(0x00040000) -#define RXD_W0_LAST_AMSDU FIELD32(0x00080000) -#define RXD_W0_PLCP_SIGNAL FIELD32(0xfff00000) - -#endif /* RT2800USB_H */ diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h deleted file mode 100644 index 7510723a8c37..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ /dev/null @@ -1,1393 +0,0 @@ -/* - Copyright (C) 2010 Willow Garage - Copyright (C) 2004 - 2010 Ivo van Doorn - Copyright (C) 2004 - 2009 Gertjan van Wingerde - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00 - Abstract: rt2x00 global information. - */ - -#ifndef RT2X00_H -#define RT2X00_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "rt2x00debug.h" -#include "rt2x00dump.h" -#include "rt2x00leds.h" -#include "rt2x00reg.h" -#include "rt2x00queue.h" - -/* - * Module information. - */ -#define DRV_VERSION "2.3.0" -#define DRV_PROJECT "http://rt2x00.serialmonkey.com" - -/* Debug definitions. - * Debug output has to be enabled during compile time. - */ -#ifdef CONFIG_RT2X00_DEBUG -#define DEBUG -#endif /* CONFIG_RT2X00_DEBUG */ - -/* Utility printing macros - * rt2x00_probe_err is for messages when rt2x00_dev is uninitialized - */ -#define rt2x00_probe_err(fmt, ...) \ - printk(KERN_ERR KBUILD_MODNAME ": %s: Error - " fmt, \ - __func__, ##__VA_ARGS__) -#define rt2x00_err(dev, fmt, ...) \ - wiphy_err((dev)->hw->wiphy, "%s: Error - " fmt, \ - __func__, ##__VA_ARGS__) -#define rt2x00_warn(dev, fmt, ...) \ - wiphy_warn((dev)->hw->wiphy, "%s: Warning - " fmt, \ - __func__, ##__VA_ARGS__) -#define rt2x00_info(dev, fmt, ...) \ - wiphy_info((dev)->hw->wiphy, "%s: Info - " fmt, \ - __func__, ##__VA_ARGS__) - -/* Various debug levels */ -#define rt2x00_dbg(dev, fmt, ...) \ - wiphy_dbg((dev)->hw->wiphy, "%s: Debug - " fmt, \ - __func__, ##__VA_ARGS__) -#define rt2x00_eeprom_dbg(dev, fmt, ...) \ - wiphy_dbg((dev)->hw->wiphy, "%s: EEPROM recovery - " fmt, \ - __func__, ##__VA_ARGS__) - -/* - * Duration calculations - * The rate variable passed is: 100kbs. - * To convert from bytes to bits we multiply size with 8, - * then the size is multiplied with 10 to make the - * real rate -> rate argument correction. - */ -#define GET_DURATION(__size, __rate) (((__size) * 8 * 10) / (__rate)) -#define GET_DURATION_RES(__size, __rate)(((__size) * 8 * 10) % (__rate)) - -/* - * Determine the number of L2 padding bytes required between the header and - * the payload. - */ -#define L2PAD_SIZE(__hdrlen) (-(__hdrlen) & 3) - -/* - * Determine the alignment requirement, - * to make sure the 802.11 payload is padded to a 4-byte boundrary - * we must determine the address of the payload and calculate the - * amount of bytes needed to move the data. - */ -#define ALIGN_SIZE(__skb, __header) \ - ( ((unsigned long)((__skb)->data + (__header))) & 3 ) - -/* - * Constants for extra TX headroom for alignment purposes. - */ -#define RT2X00_ALIGN_SIZE 4 /* Only whole frame needs alignment */ -#define RT2X00_L2PAD_SIZE 8 /* Both header & payload need alignment */ - -/* - * Standard timing and size defines. - * These values should follow the ieee80211 specifications. - */ -#define ACK_SIZE 14 -#define IEEE80211_HEADER 24 -#define PLCP 48 -#define BEACON 100 -#define PREAMBLE 144 -#define SHORT_PREAMBLE 72 -#define SLOT_TIME 20 -#define SHORT_SLOT_TIME 9 -#define SIFS 10 -#define PIFS ( SIFS + SLOT_TIME ) -#define SHORT_PIFS ( SIFS + SHORT_SLOT_TIME ) -#define DIFS ( PIFS + SLOT_TIME ) -#define SHORT_DIFS ( SHORT_PIFS + SHORT_SLOT_TIME ) -#define EIFS ( SIFS + DIFS + \ - GET_DURATION(IEEE80211_HEADER + ACK_SIZE, 10) ) -#define SHORT_EIFS ( SIFS + SHORT_DIFS + \ - GET_DURATION(IEEE80211_HEADER + ACK_SIZE, 10) ) - -/* - * Structure for average calculation - * The avg field contains the actual average value, - * but avg_weight is internally used during calculations - * to prevent rounding errors. - */ -struct avg_val { - int avg; - int avg_weight; -}; - -enum rt2x00_chip_intf { - RT2X00_CHIP_INTF_PCI, - RT2X00_CHIP_INTF_PCIE, - RT2X00_CHIP_INTF_USB, - RT2X00_CHIP_INTF_SOC, -}; - -/* - * Chipset identification - * The chipset on the device is composed of a RT and RF chip. - * The chipset combination is important for determining device capabilities. - */ -struct rt2x00_chip { - u16 rt; -#define RT2460 0x2460 -#define RT2560 0x2560 -#define RT2570 0x2570 -#define RT2661 0x2661 -#define RT2573 0x2573 -#define RT2860 0x2860 /* 2.4GHz */ -#define RT2872 0x2872 /* WSOC */ -#define RT2883 0x2883 /* WSOC */ -#define RT3070 0x3070 -#define RT3071 0x3071 -#define RT3090 0x3090 /* 2.4GHz PCIe */ -#define RT3290 0x3290 -#define RT3352 0x3352 /* WSOC */ -#define RT3390 0x3390 -#define RT3572 0x3572 -#define RT3593 0x3593 -#define RT3883 0x3883 /* WSOC */ -#define RT5390 0x5390 /* 2.4GHz */ -#define RT5392 0x5392 /* 2.4GHz */ -#define RT5592 0x5592 - - u16 rf; - u16 rev; - - enum rt2x00_chip_intf intf; -}; - -/* - * RF register values that belong to a particular channel. - */ -struct rf_channel { - int channel; - u32 rf1; - u32 rf2; - u32 rf3; - u32 rf4; -}; - -/* - * Channel information structure - */ -struct channel_info { - unsigned int flags; -#define GEOGRAPHY_ALLOWED 0x00000001 - - short max_power; - short default_power1; - short default_power2; -}; - -/* - * Antenna setup values. - */ -struct antenna_setup { - enum antenna rx; - enum antenna tx; - u8 rx_chain_num; - u8 tx_chain_num; -}; - -/* - * Quality statistics about the currently active link. - */ -struct link_qual { - /* - * Statistics required for Link tuning by driver - * The rssi value is provided by rt2x00lib during the - * link_tuner() callback function. - * The false_cca field is filled during the link_stats() - * callback function and could be used during the - * link_tuner() callback function. - */ - int rssi; - int false_cca; - - /* - * VGC levels - * Hardware driver will tune the VGC level during each call - * to the link_tuner() callback function. This vgc_level is - * is determined based on the link quality statistics like - * average RSSI and the false CCA count. - * - * In some cases the drivers need to differentiate between - * the currently "desired" VGC level and the level configured - * in the hardware. The latter is important to reduce the - * number of BBP register reads to reduce register access - * overhead. For this reason we store both values here. - */ - u8 vgc_level; - u8 vgc_level_reg; - - /* - * Statistics required for Signal quality calculation. - * These fields might be changed during the link_stats() - * callback function. - */ - int rx_success; - int rx_failed; - int tx_success; - int tx_failed; -}; - -/* - * Antenna settings about the currently active link. - */ -struct link_ant { - /* - * Antenna flags - */ - unsigned int flags; -#define ANTENNA_RX_DIVERSITY 0x00000001 -#define ANTENNA_TX_DIVERSITY 0x00000002 -#define ANTENNA_MODE_SAMPLE 0x00000004 - - /* - * Currently active TX/RX antenna setup. - * When software diversity is used, this will indicate - * which antenna is actually used at this time. - */ - struct antenna_setup active; - - /* - * RSSI history information for the antenna. - * Used to determine when to switch antenna - * when using software diversity. - */ - int rssi_history; - - /* - * Current RSSI average of the currently active antenna. - * Similar to the avg_rssi in the link_qual structure - * this value is updated by using the walking average. - */ - struct avg_val rssi_ant; -}; - -/* - * To optimize the quality of the link we need to store - * the quality of received frames and periodically - * optimize the link. - */ -struct link { - /* - * Link tuner counter - * The number of times the link has been tuned - * since the radio has been switched on. - */ - u32 count; - - /* - * Quality measurement values. - */ - struct link_qual qual; - - /* - * TX/RX antenna setup. - */ - struct link_ant ant; - - /* - * Currently active average RSSI value - */ - struct avg_val avg_rssi; - - /* - * Work structure for scheduling periodic link tuning. - */ - struct delayed_work work; - - /* - * Work structure for scheduling periodic watchdog monitoring. - * This work must be scheduled on the kernel workqueue, while - * all other work structures must be queued on the mac80211 - * workqueue. This guarantees that the watchdog can schedule - * other work structures and wait for their completion in order - * to bring the device/driver back into the desired state. - */ - struct delayed_work watchdog_work; - - /* - * Work structure for scheduling periodic AGC adjustments. - */ - struct delayed_work agc_work; - - /* - * Work structure for scheduling periodic VCO calibration. - */ - struct delayed_work vco_work; -}; - -enum rt2x00_delayed_flags { - DELAYED_UPDATE_BEACON, -}; - -/* - * Interface structure - * Per interface configuration details, this structure - * is allocated as the private data for ieee80211_vif. - */ -struct rt2x00_intf { - /* - * beacon->skb must be protected with the mutex. - */ - struct mutex beacon_skb_mutex; - - /* - * Entry in the beacon queue which belongs to - * this interface. Each interface has its own - * dedicated beacon entry. - */ - struct queue_entry *beacon; - bool enable_beacon; - - /* - * Actions that needed rescheduling. - */ - unsigned long delayed_flags; - - /* - * Software sequence counter, this is only required - * for hardware which doesn't support hardware - * sequence counting. - */ - atomic_t seqno; -}; - -static inline struct rt2x00_intf* vif_to_intf(struct ieee80211_vif *vif) -{ - return (struct rt2x00_intf *)vif->drv_priv; -} - -/** - * struct hw_mode_spec: Hardware specifications structure - * - * Details about the supported modes, rates and channels - * of a particular chipset. This is used by rt2x00lib - * to build the ieee80211_hw_mode array for mac80211. - * - * @supported_bands: Bitmask contained the supported bands (2.4GHz, 5.2GHz). - * @supported_rates: Rate types which are supported (CCK, OFDM). - * @num_channels: Number of supported channels. This is used as array size - * for @tx_power_a, @tx_power_bg and @channels. - * @channels: Device/chipset specific channel values (See &struct rf_channel). - * @channels_info: Additional information for channels (See &struct channel_info). - * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap). - */ -struct hw_mode_spec { - unsigned int supported_bands; -#define SUPPORT_BAND_2GHZ 0x00000001 -#define SUPPORT_BAND_5GHZ 0x00000002 - - unsigned int supported_rates; -#define SUPPORT_RATE_CCK 0x00000001 -#define SUPPORT_RATE_OFDM 0x00000002 - - unsigned int num_channels; - const struct rf_channel *channels; - const struct channel_info *channels_info; - - struct ieee80211_sta_ht_cap ht; -}; - -/* - * Configuration structure wrapper around the - * mac80211 configuration structure. - * When mac80211 configures the driver, rt2x00lib - * can precalculate values which are equal for all - * rt2x00 drivers. Those values can be stored in here. - */ -struct rt2x00lib_conf { - struct ieee80211_conf *conf; - - struct rf_channel rf; - struct channel_info channel; -}; - -/* - * Configuration structure for erp settings. - */ -struct rt2x00lib_erp { - int short_preamble; - int cts_protection; - - u32 basic_rates; - - int slot_time; - - short sifs; - short pifs; - short difs; - short eifs; - - u16 beacon_int; - u16 ht_opmode; -}; - -/* - * Configuration structure for hardware encryption. - */ -struct rt2x00lib_crypto { - enum cipher cipher; - - enum set_key_cmd cmd; - const u8 *address; - - u32 bssidx; - - u8 key[16]; - u8 tx_mic[8]; - u8 rx_mic[8]; - - int wcid; -}; - -/* - * Configuration structure wrapper around the - * rt2x00 interface configuration handler. - */ -struct rt2x00intf_conf { - /* - * Interface type - */ - enum nl80211_iftype type; - - /* - * TSF sync value, this is dependent on the operation type. - */ - enum tsf_sync sync; - - /* - * The MAC and BSSID addresses are simple array of bytes, - * these arrays are little endian, so when sending the addresses - * to the drivers, copy the it into a endian-signed variable. - * - * Note that all devices (except rt2500usb) have 32 bits - * register word sizes. This means that whatever variable we - * pass _must_ be a multiple of 32 bits. Otherwise the device - * might not accept what we are sending to it. - * This will also make it easier for the driver to write - * the data to the device. - */ - __le32 mac[2]; - __le32 bssid[2]; -}; - -/* - * Private structure for storing STA details - * wcid: Wireless Client ID - */ -struct rt2x00_sta { - int wcid; -}; - -static inline struct rt2x00_sta* sta_to_rt2x00_sta(struct ieee80211_sta *sta) -{ - return (struct rt2x00_sta *)sta->drv_priv; -} - -/* - * rt2x00lib callback functions. - */ -struct rt2x00lib_ops { - /* - * Interrupt handlers. - */ - irq_handler_t irq_handler; - - /* - * TX status tasklet handler. - */ - void (*txstatus_tasklet) (unsigned long data); - void (*pretbtt_tasklet) (unsigned long data); - void (*tbtt_tasklet) (unsigned long data); - void (*rxdone_tasklet) (unsigned long data); - void (*autowake_tasklet) (unsigned long data); - - /* - * Device init handlers. - */ - int (*probe_hw) (struct rt2x00_dev *rt2x00dev); - char *(*get_firmware_name) (struct rt2x00_dev *rt2x00dev); - int (*check_firmware) (struct rt2x00_dev *rt2x00dev, - const u8 *data, const size_t len); - int (*load_firmware) (struct rt2x00_dev *rt2x00dev, - const u8 *data, const size_t len); - - /* - * Device initialization/deinitialization handlers. - */ - int (*initialize) (struct rt2x00_dev *rt2x00dev); - void (*uninitialize) (struct rt2x00_dev *rt2x00dev); - - /* - * queue initialization handlers - */ - bool (*get_entry_state) (struct queue_entry *entry); - void (*clear_entry) (struct queue_entry *entry); - - /* - * Radio control handlers. - */ - int (*set_device_state) (struct rt2x00_dev *rt2x00dev, - enum dev_state state); - int (*rfkill_poll) (struct rt2x00_dev *rt2x00dev); - void (*link_stats) (struct rt2x00_dev *rt2x00dev, - struct link_qual *qual); - void (*reset_tuner) (struct rt2x00_dev *rt2x00dev, - struct link_qual *qual); - void (*link_tuner) (struct rt2x00_dev *rt2x00dev, - struct link_qual *qual, const u32 count); - void (*gain_calibration) (struct rt2x00_dev *rt2x00dev); - void (*vco_calibration) (struct rt2x00_dev *rt2x00dev); - - /* - * Data queue handlers. - */ - void (*watchdog) (struct rt2x00_dev *rt2x00dev); - void (*start_queue) (struct data_queue *queue); - void (*kick_queue) (struct data_queue *queue); - void (*stop_queue) (struct data_queue *queue); - void (*flush_queue) (struct data_queue *queue, bool drop); - void (*tx_dma_done) (struct queue_entry *entry); - - /* - * TX control handlers - */ - void (*write_tx_desc) (struct queue_entry *entry, - struct txentry_desc *txdesc); - void (*write_tx_data) (struct queue_entry *entry, - struct txentry_desc *txdesc); - void (*write_beacon) (struct queue_entry *entry, - struct txentry_desc *txdesc); - void (*clear_beacon) (struct queue_entry *entry); - int (*get_tx_data_len) (struct queue_entry *entry); - - /* - * RX control handlers - */ - void (*fill_rxdone) (struct queue_entry *entry, - struct rxdone_entry_desc *rxdesc); - - /* - * Configuration handlers. - */ - int (*config_shared_key) (struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_crypto *crypto, - struct ieee80211_key_conf *key); - int (*config_pairwise_key) (struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_crypto *crypto, - struct ieee80211_key_conf *key); - void (*config_filter) (struct rt2x00_dev *rt2x00dev, - const unsigned int filter_flags); - void (*config_intf) (struct rt2x00_dev *rt2x00dev, - struct rt2x00_intf *intf, - struct rt2x00intf_conf *conf, - const unsigned int flags); -#define CONFIG_UPDATE_TYPE ( 1 << 1 ) -#define CONFIG_UPDATE_MAC ( 1 << 2 ) -#define CONFIG_UPDATE_BSSID ( 1 << 3 ) - - void (*config_erp) (struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_erp *erp, - u32 changed); - void (*config_ant) (struct rt2x00_dev *rt2x00dev, - struct antenna_setup *ant); - void (*config) (struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf, - const unsigned int changed_flags); - int (*sta_add) (struct rt2x00_dev *rt2x00dev, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta); - int (*sta_remove) (struct rt2x00_dev *rt2x00dev, - int wcid); -}; - -/* - * rt2x00 driver callback operation structure. - */ -struct rt2x00_ops { - const char *name; - const unsigned int drv_data_size; - const unsigned int max_ap_intf; - const unsigned int eeprom_size; - const unsigned int rf_size; - const unsigned int tx_queues; - const unsigned int extra_tx_headroom; - const struct data_queue_desc *rx; - const struct data_queue_desc *tx; - const struct data_queue_desc *bcn; - const struct data_queue_desc *atim; - const struct rt2x00lib_ops *lib; - const void *drv; - const struct ieee80211_ops *hw; -#ifdef CONFIG_RT2X00_LIB_DEBUGFS - const struct rt2x00debug *debugfs; -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -}; - -/* - * rt2x00 state flags - */ -enum rt2x00_state_flags { - /* - * Device flags - */ - DEVICE_STATE_PRESENT, - DEVICE_STATE_REGISTERED_HW, - DEVICE_STATE_INITIALIZED, - DEVICE_STATE_STARTED, - DEVICE_STATE_ENABLED_RADIO, - DEVICE_STATE_SCANNING, - - /* - * Driver configuration - */ - CONFIG_CHANNEL_HT40, - CONFIG_POWERSAVING, - CONFIG_HT_DISABLED, - CONFIG_QOS_DISABLED, - - /* - * Mark we currently are sequentially reading TX_STA_FIFO register - * FIXME: this is for only rt2800usb, should go to private data - */ - TX_STATUS_READING, -}; - -/* - * rt2x00 capability flags - */ -enum rt2x00_capability_flags { - /* - * Requirements - */ - REQUIRE_FIRMWARE, - REQUIRE_BEACON_GUARD, - REQUIRE_ATIM_QUEUE, - REQUIRE_DMA, - REQUIRE_COPY_IV, - REQUIRE_L2PAD, - REQUIRE_TXSTATUS_FIFO, - REQUIRE_TASKLET_CONTEXT, - REQUIRE_SW_SEQNO, - REQUIRE_HT_TX_DESC, - REQUIRE_PS_AUTOWAKE, - - /* - * Capabilities - */ - CAPABILITY_HW_BUTTON, - CAPABILITY_HW_CRYPTO, - CAPABILITY_POWER_LIMIT, - CAPABILITY_CONTROL_FILTERS, - CAPABILITY_CONTROL_FILTER_PSPOLL, - CAPABILITY_PRE_TBTT_INTERRUPT, - CAPABILITY_LINK_TUNING, - CAPABILITY_FRAME_TYPE, - CAPABILITY_RF_SEQUENCE, - CAPABILITY_EXTERNAL_LNA_A, - CAPABILITY_EXTERNAL_LNA_BG, - CAPABILITY_DOUBLE_ANTENNA, - CAPABILITY_BT_COEXIST, - CAPABILITY_VCO_RECALIBRATION, -}; - -/* - * Interface combinations - */ -enum { - IF_COMB_AP = 0, - NUM_IF_COMB, -}; - -/* - * rt2x00 device structure. - */ -struct rt2x00_dev { - /* - * Device structure. - * The structure stored in here depends on the - * system bus (PCI or USB). - * When accessing this variable, the rt2x00dev_{pci,usb} - * macros should be used for correct typecasting. - */ - struct device *dev; - - /* - * Callback functions. - */ - const struct rt2x00_ops *ops; - - /* - * Driver data. - */ - void *drv_data; - - /* - * IEEE80211 control structure. - */ - struct ieee80211_hw *hw; - struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; - enum ieee80211_band curr_band; - int curr_freq; - - /* - * If enabled, the debugfs interface structures - * required for deregistration of debugfs. - */ -#ifdef CONFIG_RT2X00_LIB_DEBUGFS - struct rt2x00debug_intf *debugfs_intf; -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ - - /* - * LED structure for changing the LED status - * by mac8011 or the kernel. - */ -#ifdef CONFIG_RT2X00_LIB_LEDS - struct rt2x00_led led_radio; - struct rt2x00_led led_assoc; - struct rt2x00_led led_qual; - u16 led_mcu_reg; -#endif /* CONFIG_RT2X00_LIB_LEDS */ - - /* - * Device state flags. - * In these flags the current status is stored. - * Access to these flags should occur atomically. - */ - unsigned long flags; - - /* - * Device capabiltiy flags. - * In these flags the device/driver capabilities are stored. - * Access to these flags should occur non-atomically. - */ - unsigned long cap_flags; - - /* - * Device information, Bus IRQ and name (PCI, SoC) - */ - int irq; - const char *name; - - /* - * Chipset identification. - */ - struct rt2x00_chip chip; - - /* - * hw capability specifications. - */ - struct hw_mode_spec spec; - - /* - * This is the default TX/RX antenna setup as indicated - * by the device's EEPROM. - */ - struct antenna_setup default_ant; - - /* - * Register pointers - * csr.base: CSR base register address. (PCI) - * csr.cache: CSR cache for usb_control_msg. (USB) - */ - union csr { - void __iomem *base; - void *cache; - } csr; - - /* - * Mutex to protect register accesses. - * For PCI and USB devices it protects against concurrent indirect - * register access (BBP, RF, MCU) since accessing those - * registers require multiple calls to the CSR registers. - * For USB devices it also protects the csr_cache since that - * field is used for normal CSR access and it cannot support - * multiple callers simultaneously. - */ - struct mutex csr_mutex; - - /* - * Current packet filter configuration for the device. - * This contains all currently active FIF_* flags send - * to us by mac80211 during configure_filter(). - */ - unsigned int packet_filter; - - /* - * Interface details: - * - Open ap interface count. - * - Open sta interface count. - * - Association count. - * - Beaconing enabled count. - */ - unsigned int intf_ap_count; - unsigned int intf_sta_count; - unsigned int intf_associated; - unsigned int intf_beaconing; - - /* - * Interface combinations - */ - struct ieee80211_iface_limit if_limits_ap; - struct ieee80211_iface_combination if_combinations[NUM_IF_COMB]; - - /* - * Link quality - */ - struct link link; - - /* - * EEPROM data. - */ - __le16 *eeprom; - - /* - * Active RF register values. - * These are stored here so we don't need - * to read the rf registers and can directly - * use this value instead. - * This field should be accessed by using - * rt2x00_rf_read() and rt2x00_rf_write(). - */ - u32 *rf; - - /* - * LNA gain - */ - short lna_gain; - - /* - * Current TX power value. - */ - u16 tx_power; - - /* - * Current retry values. - */ - u8 short_retry; - u8 long_retry; - - /* - * Rssi <-> Dbm offset - */ - u8 rssi_offset; - - /* - * Frequency offset. - */ - u8 freq_offset; - - /* - * Association id. - */ - u16 aid; - - /* - * Beacon interval. - */ - u16 beacon_int; - - /** - * Timestamp of last received beacon - */ - unsigned long last_beacon; - - /* - * Low level statistics which will have - * to be kept up to date while device is running. - */ - struct ieee80211_low_level_stats low_level_stats; - - /** - * Work queue for all work which should not be placed - * on the mac80211 workqueue (because of dependencies - * between various work structures). - */ - struct workqueue_struct *workqueue; - - /* - * Scheduled work. - * NOTE: intf_work will use ieee80211_iterate_active_interfaces() - * which means it cannot be placed on the hw->workqueue - * due to RTNL locking requirements. - */ - struct work_struct intf_work; - - /** - * Scheduled work for TX/RX done handling (USB devices) - */ - struct work_struct rxdone_work; - struct work_struct txdone_work; - - /* - * Powersaving work - */ - struct delayed_work autowakeup_work; - struct work_struct sleep_work; - - /* - * Data queue arrays for RX, TX, Beacon and ATIM. - */ - unsigned int data_queues; - struct data_queue *rx; - struct data_queue *tx; - struct data_queue *bcn; - struct data_queue *atim; - - /* - * Firmware image. - */ - const struct firmware *fw; - - /* - * FIFO for storing tx status reports between isr and tasklet. - */ - DECLARE_KFIFO_PTR(txstatus_fifo, u32); - - /* - * Timer to ensure tx status reports are read (rt2800usb). - */ - struct hrtimer txstatus_timer; - - /* - * Tasklet for processing tx status reports (rt2800pci). - */ - struct tasklet_struct txstatus_tasklet; - struct tasklet_struct pretbtt_tasklet; - struct tasklet_struct tbtt_tasklet; - struct tasklet_struct rxdone_tasklet; - struct tasklet_struct autowake_tasklet; - - /* - * Used for VCO periodic calibration. - */ - int rf_channel; - - /* - * Protect the interrupt mask register. - */ - spinlock_t irqmask_lock; - - /* - * List of BlockAckReq TX entries that need driver BlockAck processing. - */ - struct list_head bar_list; - spinlock_t bar_list_lock; -}; - -struct rt2x00_bar_list_entry { - struct list_head list; - struct rcu_head head; - - struct queue_entry *entry; - int block_acked; - - /* Relevant parts of the IEEE80211 BAR header */ - __u8 ra[6]; - __u8 ta[6]; - __le16 control; - __le16 start_seq_num; -}; - -/* - * Register defines. - * Some registers require multiple attempts before success, - * in those cases REGISTER_BUSY_COUNT attempts should be - * taken with a REGISTER_BUSY_DELAY interval. - */ -#define REGISTER_BUSY_COUNT 100 -#define REGISTER_BUSY_DELAY 100 - -/* - * Generic RF access. - * The RF is being accessed by word index. - */ -static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev, - const unsigned int word, u32 *data) -{ - BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32)); - *data = rt2x00dev->rf[word - 1]; -} - -static inline void rt2x00_rf_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, u32 data) -{ - BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32)); - rt2x00dev->rf[word - 1] = data; -} - -/* - * Generic EEPROM access. The EEPROM is being accessed by word or byte index. - */ -static inline void *rt2x00_eeprom_addr(struct rt2x00_dev *rt2x00dev, - const unsigned int word) -{ - return (void *)&rt2x00dev->eeprom[word]; -} - -static inline void rt2x00_eeprom_read(struct rt2x00_dev *rt2x00dev, - const unsigned int word, u16 *data) -{ - *data = le16_to_cpu(rt2x00dev->eeprom[word]); -} - -static inline void rt2x00_eeprom_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, u16 data) -{ - rt2x00dev->eeprom[word] = cpu_to_le16(data); -} - -static inline u8 rt2x00_eeprom_byte(struct rt2x00_dev *rt2x00dev, - const unsigned int byte) -{ - return *(((u8 *)rt2x00dev->eeprom) + byte); -} - -/* - * Chipset handlers - */ -static inline void rt2x00_set_chip(struct rt2x00_dev *rt2x00dev, - const u16 rt, const u16 rf, const u16 rev) -{ - rt2x00dev->chip.rt = rt; - rt2x00dev->chip.rf = rf; - rt2x00dev->chip.rev = rev; - - rt2x00_info(rt2x00dev, "Chipset detected - rt: %04x, rf: %04x, rev: %04x\n", - rt2x00dev->chip.rt, rt2x00dev->chip.rf, - rt2x00dev->chip.rev); -} - -static inline void rt2x00_set_rt(struct rt2x00_dev *rt2x00dev, - const u16 rt, const u16 rev) -{ - rt2x00dev->chip.rt = rt; - rt2x00dev->chip.rev = rev; - - rt2x00_info(rt2x00dev, "RT chipset %04x, rev %04x detected\n", - rt2x00dev->chip.rt, rt2x00dev->chip.rev); -} - -static inline void rt2x00_set_rf(struct rt2x00_dev *rt2x00dev, const u16 rf) -{ - rt2x00dev->chip.rf = rf; - - rt2x00_info(rt2x00dev, "RF chipset %04x detected\n", - rt2x00dev->chip.rf); -} - -static inline bool rt2x00_rt(struct rt2x00_dev *rt2x00dev, const u16 rt) -{ - return (rt2x00dev->chip.rt == rt); -} - -static inline bool rt2x00_rf(struct rt2x00_dev *rt2x00dev, const u16 rf) -{ - return (rt2x00dev->chip.rf == rf); -} - -static inline u16 rt2x00_rev(struct rt2x00_dev *rt2x00dev) -{ - return rt2x00dev->chip.rev; -} - -static inline bool rt2x00_rt_rev(struct rt2x00_dev *rt2x00dev, - const u16 rt, const u16 rev) -{ - return (rt2x00_rt(rt2x00dev, rt) && rt2x00_rev(rt2x00dev) == rev); -} - -static inline bool rt2x00_rt_rev_lt(struct rt2x00_dev *rt2x00dev, - const u16 rt, const u16 rev) -{ - return (rt2x00_rt(rt2x00dev, rt) && rt2x00_rev(rt2x00dev) < rev); -} - -static inline bool rt2x00_rt_rev_gte(struct rt2x00_dev *rt2x00dev, - const u16 rt, const u16 rev) -{ - return (rt2x00_rt(rt2x00dev, rt) && rt2x00_rev(rt2x00dev) >= rev); -} - -static inline void rt2x00_set_chip_intf(struct rt2x00_dev *rt2x00dev, - enum rt2x00_chip_intf intf) -{ - rt2x00dev->chip.intf = intf; -} - -static inline bool rt2x00_intf(struct rt2x00_dev *rt2x00dev, - enum rt2x00_chip_intf intf) -{ - return (rt2x00dev->chip.intf == intf); -} - -static inline bool rt2x00_is_pci(struct rt2x00_dev *rt2x00dev) -{ - return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI) || - rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE); -} - -static inline bool rt2x00_is_pcie(struct rt2x00_dev *rt2x00dev) -{ - return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE); -} - -static inline bool rt2x00_is_usb(struct rt2x00_dev *rt2x00dev) -{ - return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_USB); -} - -static inline bool rt2x00_is_soc(struct rt2x00_dev *rt2x00dev) -{ - return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC); -} - -/** - * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes. - * @entry: Pointer to &struct queue_entry - * - * Returns -ENOMEM if mapping fail, 0 otherwise. - */ -int rt2x00queue_map_txskb(struct queue_entry *entry); - -/** - * rt2x00queue_unmap_skb - Unmap a skb from DMA. - * @entry: Pointer to &struct queue_entry - */ -void rt2x00queue_unmap_skb(struct queue_entry *entry); - -/** - * rt2x00queue_get_tx_queue - Convert tx queue index to queue pointer - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * @queue: rt2x00 queue index (see &enum data_queue_qid). - * - * Returns NULL for non tx queues. - */ -static inline struct data_queue * -rt2x00queue_get_tx_queue(struct rt2x00_dev *rt2x00dev, - const enum data_queue_qid queue) -{ - if (queue < rt2x00dev->ops->tx_queues && rt2x00dev->tx) - return &rt2x00dev->tx[queue]; - - if (queue == QID_ATIM) - return rt2x00dev->atim; - - return NULL; -} - -/** - * rt2x00queue_get_entry - Get queue entry where the given index points to. - * @queue: Pointer to &struct data_queue from where we obtain the entry. - * @index: Index identifier for obtaining the correct index. - */ -struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue, - enum queue_index index); - -/** - * rt2x00queue_pause_queue - Pause a data queue - * @queue: Pointer to &struct data_queue. - * - * This function will pause the data queue locally, preventing - * new frames to be added to the queue (while the hardware is - * still allowed to run). - */ -void rt2x00queue_pause_queue(struct data_queue *queue); - -/** - * rt2x00queue_unpause_queue - unpause a data queue - * @queue: Pointer to &struct data_queue. - * - * This function will unpause the data queue locally, allowing - * new frames to be added to the queue again. - */ -void rt2x00queue_unpause_queue(struct data_queue *queue); - -/** - * rt2x00queue_start_queue - Start a data queue - * @queue: Pointer to &struct data_queue. - * - * This function will start handling all pending frames in the queue. - */ -void rt2x00queue_start_queue(struct data_queue *queue); - -/** - * rt2x00queue_stop_queue - Halt a data queue - * @queue: Pointer to &struct data_queue. - * - * This function will stop all pending frames in the queue. - */ -void rt2x00queue_stop_queue(struct data_queue *queue); - -/** - * rt2x00queue_flush_queue - Flush a data queue - * @queue: Pointer to &struct data_queue. - * @drop: True to drop all pending frames. - * - * This function will flush the queue. After this call - * the queue is guaranteed to be empty. - */ -void rt2x00queue_flush_queue(struct data_queue *queue, bool drop); - -/** - * rt2x00queue_start_queues - Start all data queues - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * - * This function will loop through all available queues to start them - */ -void rt2x00queue_start_queues(struct rt2x00_dev *rt2x00dev); - -/** - * rt2x00queue_stop_queues - Halt all data queues - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * - * This function will loop through all available queues to stop - * any pending frames. - */ -void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev); - -/** - * rt2x00queue_flush_queues - Flush all data queues - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * @drop: True to drop all pending frames. - * - * This function will loop through all available queues to flush - * any pending frames. - */ -void rt2x00queue_flush_queues(struct rt2x00_dev *rt2x00dev, bool drop); - -/* - * Debugfs handlers. - */ -/** - * rt2x00debug_dump_frame - Dump a frame to userspace through debugfs. - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * @type: The type of frame that is being dumped. - * @skb: The skb containing the frame to be dumped. - */ -#ifdef CONFIG_RT2X00_LIB_DEBUGFS -void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, - enum rt2x00_dump_type type, struct sk_buff *skb); -#else -static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, - enum rt2x00_dump_type type, - struct sk_buff *skb) -{ -} -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ - -/* - * Utility functions. - */ -u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev, - struct ieee80211_vif *vif); - -/* - * Interrupt context handlers. - */ -void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev); -void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev); -void rt2x00lib_dmastart(struct queue_entry *entry); -void rt2x00lib_dmadone(struct queue_entry *entry); -void rt2x00lib_txdone(struct queue_entry *entry, - struct txdone_entry_desc *txdesc); -void rt2x00lib_txdone_noinfo(struct queue_entry *entry, u32 status); -void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp); - -/* - * mac80211 handlers. - */ -void rt2x00mac_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb); -int rt2x00mac_start(struct ieee80211_hw *hw); -void rt2x00mac_stop(struct ieee80211_hw *hw); -int rt2x00mac_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif); -void rt2x00mac_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif); -int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed); -void rt2x00mac_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast); -int rt2x00mac_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, - bool set); -#ifdef CONFIG_RT2X00_LIB_CRYPTO -int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key); -#else -#define rt2x00mac_set_key NULL -#endif /* CONFIG_RT2X00_LIB_CRYPTO */ -int rt2x00mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); -int rt2x00mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); -void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw); -void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw); -int rt2x00mac_get_stats(struct ieee80211_hw *hw, - struct ieee80211_low_level_stats *stats); -void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changes); -int rt2x00mac_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params); -void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw); -void rt2x00mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop); -int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); -int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); -void rt2x00mac_get_ringparam(struct ieee80211_hw *hw, - u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); -bool rt2x00mac_tx_frames_pending(struct ieee80211_hw *hw); - -/* - * Driver allocation handlers. - */ -int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev); -void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev); -#ifdef CONFIG_PM -int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state); -int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev); -#endif /* CONFIG_PM */ - -#endif /* RT2X00_H */ diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c deleted file mode 100644 index 8cb43f8f3efc..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00config.c +++ /dev/null @@ -1,287 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00lib - Abstract: rt2x00 generic configuration routines. - */ - -#include -#include - -#include "rt2x00.h" -#include "rt2x00lib.h" - -void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev, - struct rt2x00_intf *intf, - enum nl80211_iftype type, - const u8 *mac, const u8 *bssid) -{ - struct rt2x00intf_conf conf; - unsigned int flags = 0; - - conf.type = type; - - switch (type) { - case NL80211_IFTYPE_ADHOC: - conf.sync = TSF_SYNC_ADHOC; - break; - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_MESH_POINT: - case NL80211_IFTYPE_WDS: - conf.sync = TSF_SYNC_AP_NONE; - break; - case NL80211_IFTYPE_STATION: - conf.sync = TSF_SYNC_INFRA; - break; - default: - conf.sync = TSF_SYNC_NONE; - break; - } - - /* - * Note that when NULL is passed as address we will send - * 00:00:00:00:00 to the device to clear the address. - * This will prevent the device being confused when it wants - * to ACK frames or considers itself associated. - */ - memset(conf.mac, 0, sizeof(conf.mac)); - if (mac) - memcpy(conf.mac, mac, ETH_ALEN); - - memset(conf.bssid, 0, sizeof(conf.bssid)); - if (bssid) - memcpy(conf.bssid, bssid, ETH_ALEN); - - flags |= CONFIG_UPDATE_TYPE; - if (mac || (!rt2x00dev->intf_ap_count && !rt2x00dev->intf_sta_count)) - flags |= CONFIG_UPDATE_MAC; - if (bssid || (!rt2x00dev->intf_ap_count && !rt2x00dev->intf_sta_count)) - flags |= CONFIG_UPDATE_BSSID; - - rt2x00dev->ops->lib->config_intf(rt2x00dev, intf, &conf, flags); -} - -void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev, - struct rt2x00_intf *intf, - struct ieee80211_bss_conf *bss_conf, - u32 changed) -{ - struct rt2x00lib_erp erp; - - memset(&erp, 0, sizeof(erp)); - - erp.short_preamble = bss_conf->use_short_preamble; - erp.cts_protection = bss_conf->use_cts_prot; - - erp.slot_time = bss_conf->use_short_slot ? SHORT_SLOT_TIME : SLOT_TIME; - erp.sifs = SIFS; - erp.pifs = bss_conf->use_short_slot ? SHORT_PIFS : PIFS; - erp.difs = bss_conf->use_short_slot ? SHORT_DIFS : DIFS; - erp.eifs = bss_conf->use_short_slot ? SHORT_EIFS : EIFS; - - erp.basic_rates = bss_conf->basic_rates; - erp.beacon_int = bss_conf->beacon_int; - - /* Update the AID, this is needed for dynamic PS support */ - rt2x00dev->aid = bss_conf->assoc ? bss_conf->aid : 0; - rt2x00dev->last_beacon = bss_conf->sync_tsf; - - /* Update global beacon interval time, this is needed for PS support */ - rt2x00dev->beacon_int = bss_conf->beacon_int; - - if (changed & BSS_CHANGED_HT) - erp.ht_opmode = bss_conf->ht_operation_mode; - - rt2x00dev->ops->lib->config_erp(rt2x00dev, &erp, changed); -} - -void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, - struct antenna_setup config) -{ - struct link_ant *ant = &rt2x00dev->link.ant; - struct antenna_setup *def = &rt2x00dev->default_ant; - struct antenna_setup *active = &rt2x00dev->link.ant.active; - - /* - * When the caller tries to send the SW diversity, - * we must update the ANTENNA_RX_DIVERSITY flag to - * enable the antenna diversity in the link tuner. - * - * Secondly, we must guarentee we never send the - * software antenna diversity command to the driver. - */ - if (!(ant->flags & ANTENNA_RX_DIVERSITY)) { - if (config.rx == ANTENNA_SW_DIVERSITY) { - ant->flags |= ANTENNA_RX_DIVERSITY; - - if (def->rx == ANTENNA_SW_DIVERSITY) - config.rx = ANTENNA_B; - else - config.rx = def->rx; - } - } else if (config.rx == ANTENNA_SW_DIVERSITY) - config.rx = active->rx; - - if (!(ant->flags & ANTENNA_TX_DIVERSITY)) { - if (config.tx == ANTENNA_SW_DIVERSITY) { - ant->flags |= ANTENNA_TX_DIVERSITY; - - if (def->tx == ANTENNA_SW_DIVERSITY) - config.tx = ANTENNA_B; - else - config.tx = def->tx; - } - } else if (config.tx == ANTENNA_SW_DIVERSITY) - config.tx = active->tx; - - /* - * Antenna setup changes require the RX to be disabled, - * else the changes will be ignored by the device. - */ - if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt2x00queue_stop_queue(rt2x00dev->rx); - - /* - * Write new antenna setup to device and reset the link tuner. - * The latter is required since we need to recalibrate the - * noise-sensitivity ratio for the new setup. - */ - rt2x00dev->ops->lib->config_ant(rt2x00dev, &config); - - rt2x00link_reset_tuner(rt2x00dev, true); - - memcpy(active, &config, sizeof(config)); - - if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt2x00queue_start_queue(rt2x00dev->rx); -} - -static u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev, - struct ieee80211_conf *conf) -{ - struct hw_mode_spec *spec = &rt2x00dev->spec; - int center_channel; - u16 i; - - /* - * Initialize center channel to current channel. - */ - center_channel = spec->channels[conf->chandef.chan->hw_value].channel; - - /* - * Adjust center channel to HT40+ and HT40- operation. - */ - if (conf_is_ht40_plus(conf)) - center_channel += 2; - else if (conf_is_ht40_minus(conf)) - center_channel -= (center_channel == 14) ? 1 : 2; - - for (i = 0; i < spec->num_channels; i++) - if (spec->channels[i].channel == center_channel) - return i; - - WARN_ON(1); - return conf->chandef.chan->hw_value; -} - -void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, - struct ieee80211_conf *conf, - unsigned int ieee80211_flags) -{ - struct rt2x00lib_conf libconf; - u16 hw_value; - u16 autowake_timeout; - u16 beacon_int; - u16 beacon_diff; - - memset(&libconf, 0, sizeof(libconf)); - - libconf.conf = conf; - - if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL) { - if (!conf_is_ht(conf)) - set_bit(CONFIG_HT_DISABLED, &rt2x00dev->flags); - else - clear_bit(CONFIG_HT_DISABLED, &rt2x00dev->flags); - - if (conf_is_ht40(conf)) { - set_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags); - hw_value = rt2x00ht_center_channel(rt2x00dev, conf); - } else { - clear_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags); - hw_value = conf->chandef.chan->hw_value; - } - - memcpy(&libconf.rf, - &rt2x00dev->spec.channels[hw_value], - sizeof(libconf.rf)); - - memcpy(&libconf.channel, - &rt2x00dev->spec.channels_info[hw_value], - sizeof(libconf.channel)); - - /* Used for VCO periodic calibration */ - rt2x00dev->rf_channel = libconf.rf.channel; - } - - if (test_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags) && - (ieee80211_flags & IEEE80211_CONF_CHANGE_PS)) - cancel_delayed_work_sync(&rt2x00dev->autowakeup_work); - - /* - * Start configuration. - */ - rt2x00dev->ops->lib->config(rt2x00dev, &libconf, ieee80211_flags); - - /* - * Some configuration changes affect the link quality - * which means we need to reset the link tuner. - */ - if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL) - rt2x00link_reset_tuner(rt2x00dev, false); - - if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && - test_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags) && - (ieee80211_flags & IEEE80211_CONF_CHANGE_PS) && - (conf->flags & IEEE80211_CONF_PS)) { - beacon_diff = (long)jiffies - (long)rt2x00dev->last_beacon; - beacon_int = msecs_to_jiffies(rt2x00dev->beacon_int); - - if (beacon_diff > beacon_int) - beacon_diff = 0; - - autowake_timeout = (conf->max_sleep_period * beacon_int) - beacon_diff; - queue_delayed_work(rt2x00dev->workqueue, - &rt2x00dev->autowakeup_work, - autowake_timeout - 15); - } - - if (conf->flags & IEEE80211_CONF_PS) - set_bit(CONFIG_POWERSAVING, &rt2x00dev->flags); - else - clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags); - - rt2x00dev->curr_band = conf->chandef.chan->band; - rt2x00dev->curr_freq = conf->chandef.chan->center_freq; - rt2x00dev->tx_power = conf->power_level; - rt2x00dev->short_retry = conf->short_frame_max_tx_count; - rt2x00dev->long_retry = conf->long_frame_max_tx_count; -} diff --git a/drivers/net/wireless/rt2x00/rt2x00crypto.c b/drivers/net/wireless/rt2x00/rt2x00crypto.c deleted file mode 100644 index 1ca4c7ffc189..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00crypto.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00lib - Abstract: rt2x00 crypto specific routines. - */ - -#include -#include - -#include "rt2x00.h" -#include "rt2x00lib.h" - -enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key) -{ - switch (key->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - return CIPHER_WEP64; - case WLAN_CIPHER_SUITE_WEP104: - return CIPHER_WEP128; - case WLAN_CIPHER_SUITE_TKIP: - return CIPHER_TKIP; - case WLAN_CIPHER_SUITE_CCMP: - return CIPHER_AES; - default: - return CIPHER_NONE; - } -} - -void rt2x00crypto_create_tx_descriptor(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb, - struct txentry_desc *txdesc) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; - - if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags) || !hw_key) - return; - - __set_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags); - - txdesc->cipher = rt2x00crypto_key_to_cipher(hw_key); - - if (hw_key->flags & IEEE80211_KEY_FLAG_PAIRWISE) - __set_bit(ENTRY_TXD_ENCRYPT_PAIRWISE, &txdesc->flags); - - txdesc->key_idx = hw_key->hw_key_idx; - txdesc->iv_offset = txdesc->header_length; - txdesc->iv_len = hw_key->iv_len; - - if (!(hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV)) - __set_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags); - - if (!(hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) - __set_bit(ENTRY_TXD_ENCRYPT_MMIC, &txdesc->flags); -} - -unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_key_conf *key = tx_info->control.hw_key; - unsigned int overhead = 0; - - if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags) || !key) - return overhead; - - /* - * Extend frame length to include IV/EIV/ICV/MMIC, - * note that these lengths should only be added when - * mac80211 does not generate it. - */ - overhead += key->icv_len; - - if (!(key->flags & IEEE80211_KEY_FLAG_GENERATE_IV)) - overhead += key->iv_len; - - if (!(key->flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) { - if (key->cipher == WLAN_CIPHER_SUITE_TKIP) - overhead += 8; - } - - return overhead; -} - -void rt2x00crypto_tx_copy_iv(struct sk_buff *skb, struct txentry_desc *txdesc) -{ - struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); - - if (unlikely(!txdesc->iv_len)) - return; - - /* Copy IV/EIV data */ - memcpy(skbdesc->iv, skb->data + txdesc->iv_offset, txdesc->iv_len); -} - -void rt2x00crypto_tx_remove_iv(struct sk_buff *skb, struct txentry_desc *txdesc) -{ - struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); - - if (unlikely(!txdesc->iv_len)) - return; - - /* Copy IV/EIV data */ - memcpy(skbdesc->iv, skb->data + txdesc->iv_offset, txdesc->iv_len); - - /* Move ieee80211 header */ - memmove(skb->data + txdesc->iv_len, skb->data, txdesc->iv_offset); - - /* Pull buffer to correct size */ - skb_pull(skb, txdesc->iv_len); - txdesc->length -= txdesc->iv_len; - - /* IV/EIV data has officially been stripped */ - skbdesc->flags |= SKBDESC_IV_STRIPPED; -} - -void rt2x00crypto_tx_insert_iv(struct sk_buff *skb, unsigned int header_length) -{ - struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); - const unsigned int iv_len = - ((!!(skbdesc->iv[0])) * 4) + ((!!(skbdesc->iv[1])) * 4); - - if (!(skbdesc->flags & SKBDESC_IV_STRIPPED)) - return; - - skb_push(skb, iv_len); - - /* Move ieee80211 header */ - memmove(skb->data, skb->data + iv_len, header_length); - - /* Copy IV/EIV data */ - memcpy(skb->data + header_length, skbdesc->iv, iv_len); - - /* IV/EIV data has returned into the frame */ - skbdesc->flags &= ~SKBDESC_IV_STRIPPED; -} - -void rt2x00crypto_rx_insert_iv(struct sk_buff *skb, - unsigned int header_length, - struct rxdone_entry_desc *rxdesc) -{ - unsigned int payload_len = rxdesc->size - header_length; - unsigned int align = ALIGN_SIZE(skb, header_length); - unsigned int iv_len; - unsigned int icv_len; - unsigned int transfer = 0; - - /* - * WEP64/WEP128: Provides IV & ICV - * TKIP: Provides IV/EIV & ICV - * AES: Provies IV/EIV & ICV - */ - switch (rxdesc->cipher) { - case CIPHER_WEP64: - case CIPHER_WEP128: - iv_len = 4; - icv_len = 4; - break; - case CIPHER_TKIP: - iv_len = 8; - icv_len = 4; - break; - case CIPHER_AES: - iv_len = 8; - icv_len = 8; - break; - default: - /* Unsupport type */ - return; - } - - /* - * Make room for new data. There are 2 possibilities - * either the alignment is already present between - * the 802.11 header and payload. In that case we - * we have to move the header less then the iv_len - * since we can use the already available l2pad bytes - * for the iv data. - * When the alignment must be added manually we must - * move the header more then iv_len since we must - * make room for the payload move as well. - */ - if (rxdesc->dev_flags & RXDONE_L2PAD) { - skb_push(skb, iv_len - align); - skb_put(skb, icv_len); - - /* Move ieee80211 header */ - memmove(skb->data + transfer, - skb->data + transfer + (iv_len - align), - header_length); - transfer += header_length; - } else { - skb_push(skb, iv_len + align); - if (align < icv_len) - skb_put(skb, icv_len - align); - else if (align > icv_len) - skb_trim(skb, rxdesc->size + iv_len + icv_len); - - /* Move ieee80211 header */ - memmove(skb->data + transfer, - skb->data + transfer + iv_len + align, - header_length); - transfer += header_length; - } - - /* Copy IV/EIV data */ - memcpy(skb->data + transfer, rxdesc->iv, iv_len); - transfer += iv_len; - - /* - * Move payload for alignment purposes. Note that - * this is only needed when no l2 padding is present. - */ - if (!(rxdesc->dev_flags & RXDONE_L2PAD)) { - memmove(skb->data + transfer, - skb->data + transfer + align, - payload_len); - } - - /* - * NOTE: Always count the payload as transferred, - * even when alignment was set to zero. This is required - * for determining the correct offset for the ICV data. - */ - transfer += payload_len; - - /* - * Copy ICV data - * AES appends 8 bytes, we can't fill the upper - * 4 bytes, but mac80211 doesn't care about what - * we provide here anyway and strips it immediately. - */ - memcpy(skb->data + transfer, &rxdesc->icv, 4); - transfer += icv_len; - - /* IV/EIV/ICV has been inserted into frame */ - rxdesc->size = transfer; - rxdesc->flags &= ~RX_FLAG_IV_STRIPPED; -} diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c deleted file mode 100644 index fe7a7f63a9ed..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00debug.c +++ /dev/null @@ -1,802 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00lib - Abstract: rt2x00 debugfs specific routines. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2x00lib.h" -#include "rt2x00dump.h" - -#define MAX_LINE_LENGTH 64 - -struct rt2x00debug_crypto { - unsigned long success; - unsigned long icv_error; - unsigned long mic_error; - unsigned long key_error; -}; - -struct rt2x00debug_intf { - /* - * Pointer to driver structure where - * this debugfs entry belongs to. - */ - struct rt2x00_dev *rt2x00dev; - - /* - * Reference to the rt2x00debug structure - * which can be used to communicate with - * the registers. - */ - const struct rt2x00debug *debug; - - /* - * Debugfs entries for: - * - driver folder - * - driver file - * - chipset file - * - device state flags file - * - device capability flags file - * - register folder - * - csr offset/value files - * - eeprom offset/value files - * - bbp offset/value files - * - rf offset/value files - * - rfcsr offset/value files - * - queue folder - * - frame dump file - * - queue stats file - * - crypto stats file - */ - struct dentry *driver_folder; - struct dentry *driver_entry; - struct dentry *chipset_entry; - struct dentry *dev_flags; - struct dentry *cap_flags; - struct dentry *register_folder; - struct dentry *csr_off_entry; - struct dentry *csr_val_entry; - struct dentry *eeprom_off_entry; - struct dentry *eeprom_val_entry; - struct dentry *bbp_off_entry; - struct dentry *bbp_val_entry; - struct dentry *rf_off_entry; - struct dentry *rf_val_entry; - struct dentry *rfcsr_off_entry; - struct dentry *rfcsr_val_entry; - struct dentry *queue_folder; - struct dentry *queue_frame_dump_entry; - struct dentry *queue_stats_entry; - struct dentry *crypto_stats_entry; - - /* - * The frame dump file only allows a single reader, - * so we need to store the current state here. - */ - unsigned long frame_dump_flags; -#define FRAME_DUMP_FILE_OPEN 1 - - /* - * We queue each frame before dumping it to the user, - * per read command we will pass a single skb structure - * so we should be prepared to queue multiple sk buffers - * before sending it to userspace. - */ - struct sk_buff_head frame_dump_skbqueue; - wait_queue_head_t frame_dump_waitqueue; - - /* - * HW crypto statistics. - * All statistics are stored separately per cipher type. - */ - struct rt2x00debug_crypto crypto_stats[CIPHER_MAX]; - - /* - * Driver and chipset files will use a data buffer - * that has been created in advance. This will simplify - * the code since we can use the debugfs functions. - */ - struct debugfs_blob_wrapper driver_blob; - struct debugfs_blob_wrapper chipset_blob; - - /* - * Requested offset for each register type. - */ - unsigned int offset_csr; - unsigned int offset_eeprom; - unsigned int offset_bbp; - unsigned int offset_rf; - unsigned int offset_rfcsr; -}; - -void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev, - struct rxdone_entry_desc *rxdesc) -{ - struct rt2x00debug_intf *intf = rt2x00dev->debugfs_intf; - enum cipher cipher = rxdesc->cipher; - enum rx_crypto status = rxdesc->cipher_status; - - if (cipher == CIPHER_TKIP_NO_MIC) - cipher = CIPHER_TKIP; - if (cipher == CIPHER_NONE || cipher >= CIPHER_MAX) - return; - - /* Remove CIPHER_NONE index */ - cipher--; - - intf->crypto_stats[cipher].success += (status == RX_CRYPTO_SUCCESS); - intf->crypto_stats[cipher].icv_error += (status == RX_CRYPTO_FAIL_ICV); - intf->crypto_stats[cipher].mic_error += (status == RX_CRYPTO_FAIL_MIC); - intf->crypto_stats[cipher].key_error += (status == RX_CRYPTO_FAIL_KEY); -} - -void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, - enum rt2x00_dump_type type, struct sk_buff *skb) -{ - struct rt2x00debug_intf *intf = rt2x00dev->debugfs_intf; - struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb); - struct sk_buff *skbcopy; - struct rt2x00dump_hdr *dump_hdr; - struct timeval timestamp; - u32 data_len; - - if (likely(!test_bit(FRAME_DUMP_FILE_OPEN, &intf->frame_dump_flags))) - return; - - do_gettimeofday(×tamp); - - if (skb_queue_len(&intf->frame_dump_skbqueue) > 20) { - rt2x00_dbg(rt2x00dev, "txrx dump queue length exceeded\n"); - return; - } - - data_len = skb->len; - if (skbdesc->flags & SKBDESC_DESC_IN_SKB) - data_len -= skbdesc->desc_len; - - skbcopy = alloc_skb(sizeof(*dump_hdr) + skbdesc->desc_len + data_len, - GFP_ATOMIC); - if (!skbcopy) { - rt2x00_dbg(rt2x00dev, "Failed to copy skb for dump\n"); - return; - } - - dump_hdr = (struct rt2x00dump_hdr *)skb_put(skbcopy, sizeof(*dump_hdr)); - dump_hdr->version = cpu_to_le32(DUMP_HEADER_VERSION); - dump_hdr->header_length = cpu_to_le32(sizeof(*dump_hdr)); - dump_hdr->desc_length = cpu_to_le32(skbdesc->desc_len); - dump_hdr->data_length = cpu_to_le32(data_len); - dump_hdr->chip_rt = cpu_to_le16(rt2x00dev->chip.rt); - dump_hdr->chip_rf = cpu_to_le16(rt2x00dev->chip.rf); - dump_hdr->chip_rev = cpu_to_le16(rt2x00dev->chip.rev); - dump_hdr->type = cpu_to_le16(type); - dump_hdr->queue_index = skbdesc->entry->queue->qid; - dump_hdr->entry_index = skbdesc->entry->entry_idx; - dump_hdr->timestamp_sec = cpu_to_le32(timestamp.tv_sec); - dump_hdr->timestamp_usec = cpu_to_le32(timestamp.tv_usec); - - if (!(skbdesc->flags & SKBDESC_DESC_IN_SKB)) - memcpy(skb_put(skbcopy, skbdesc->desc_len), skbdesc->desc, - skbdesc->desc_len); - memcpy(skb_put(skbcopy, skb->len), skb->data, skb->len); - - skb_queue_tail(&intf->frame_dump_skbqueue, skbcopy); - wake_up_interruptible(&intf->frame_dump_waitqueue); - - /* - * Verify that the file has not been closed while we were working. - */ - if (!test_bit(FRAME_DUMP_FILE_OPEN, &intf->frame_dump_flags)) - skb_queue_purge(&intf->frame_dump_skbqueue); -} -EXPORT_SYMBOL_GPL(rt2x00debug_dump_frame); - -static int rt2x00debug_file_open(struct inode *inode, struct file *file) -{ - struct rt2x00debug_intf *intf = inode->i_private; - - file->private_data = inode->i_private; - - if (!try_module_get(intf->debug->owner)) - return -EBUSY; - - return 0; -} - -static int rt2x00debug_file_release(struct inode *inode, struct file *file) -{ - struct rt2x00debug_intf *intf = file->private_data; - - module_put(intf->debug->owner); - - return 0; -} - -static int rt2x00debug_open_queue_dump(struct inode *inode, struct file *file) -{ - struct rt2x00debug_intf *intf = inode->i_private; - int retval; - - retval = rt2x00debug_file_open(inode, file); - if (retval) - return retval; - - if (test_and_set_bit(FRAME_DUMP_FILE_OPEN, &intf->frame_dump_flags)) { - rt2x00debug_file_release(inode, file); - return -EBUSY; - } - - return 0; -} - -static int rt2x00debug_release_queue_dump(struct inode *inode, struct file *file) -{ - struct rt2x00debug_intf *intf = inode->i_private; - - skb_queue_purge(&intf->frame_dump_skbqueue); - - clear_bit(FRAME_DUMP_FILE_OPEN, &intf->frame_dump_flags); - - return rt2x00debug_file_release(inode, file); -} - -static ssize_t rt2x00debug_read_queue_dump(struct file *file, - char __user *buf, - size_t length, - loff_t *offset) -{ - struct rt2x00debug_intf *intf = file->private_data; - struct sk_buff *skb; - size_t status; - int retval; - - if (file->f_flags & O_NONBLOCK) - return -EAGAIN; - - retval = - wait_event_interruptible(intf->frame_dump_waitqueue, - (skb = - skb_dequeue(&intf->frame_dump_skbqueue))); - if (retval) - return retval; - - status = min((size_t)skb->len, length); - if (copy_to_user(buf, skb->data, status)) { - status = -EFAULT; - goto exit; - } - - *offset += status; - -exit: - kfree_skb(skb); - - return status; -} - -static unsigned int rt2x00debug_poll_queue_dump(struct file *file, - poll_table *wait) -{ - struct rt2x00debug_intf *intf = file->private_data; - - poll_wait(file, &intf->frame_dump_waitqueue, wait); - - if (!skb_queue_empty(&intf->frame_dump_skbqueue)) - return POLLOUT | POLLWRNORM; - - return 0; -} - -static const struct file_operations rt2x00debug_fop_queue_dump = { - .owner = THIS_MODULE, - .read = rt2x00debug_read_queue_dump, - .poll = rt2x00debug_poll_queue_dump, - .open = rt2x00debug_open_queue_dump, - .release = rt2x00debug_release_queue_dump, - .llseek = default_llseek, -}; - -static ssize_t rt2x00debug_read_queue_stats(struct file *file, - char __user *buf, - size_t length, - loff_t *offset) -{ - struct rt2x00debug_intf *intf = file->private_data; - struct data_queue *queue; - unsigned long irqflags; - unsigned int lines = 1 + intf->rt2x00dev->data_queues; - size_t size; - char *data; - char *temp; - - if (*offset) - return 0; - - data = kcalloc(lines, MAX_LINE_LENGTH, GFP_KERNEL); - if (!data) - return -ENOMEM; - - temp = data + - sprintf(data, "qid\tflags\t\tcount\tlimit\tlength\tindex\tdma done\tdone\n"); - - queue_for_each(intf->rt2x00dev, queue) { - spin_lock_irqsave(&queue->index_lock, irqflags); - - temp += sprintf(temp, "%d\t0x%.8x\t%d\t%d\t%d\t%d\t%d\t\t%d\n", - queue->qid, (unsigned int)queue->flags, - queue->count, queue->limit, queue->length, - queue->index[Q_INDEX], - queue->index[Q_INDEX_DMA_DONE], - queue->index[Q_INDEX_DONE]); - - spin_unlock_irqrestore(&queue->index_lock, irqflags); - } - - size = strlen(data); - size = min(size, length); - - if (copy_to_user(buf, data, size)) { - kfree(data); - return -EFAULT; - } - - kfree(data); - - *offset += size; - return size; -} - -static const struct file_operations rt2x00debug_fop_queue_stats = { - .owner = THIS_MODULE, - .read = rt2x00debug_read_queue_stats, - .open = rt2x00debug_file_open, - .release = rt2x00debug_file_release, - .llseek = default_llseek, -}; - -#ifdef CONFIG_RT2X00_LIB_CRYPTO -static ssize_t rt2x00debug_read_crypto_stats(struct file *file, - char __user *buf, - size_t length, - loff_t *offset) -{ - struct rt2x00debug_intf *intf = file->private_data; - static const char * const name[] = { "WEP64", "WEP128", "TKIP", "AES" }; - char *data; - char *temp; - size_t size; - unsigned int i; - - if (*offset) - return 0; - - data = kzalloc((1 + CIPHER_MAX) * MAX_LINE_LENGTH, GFP_KERNEL); - if (!data) - return -ENOMEM; - - temp = data; - temp += sprintf(data, "cipher\tsuccess\ticv err\tmic err\tkey err\n"); - - for (i = 0; i < CIPHER_MAX; i++) { - temp += sprintf(temp, "%s\t%lu\t%lu\t%lu\t%lu\n", name[i], - intf->crypto_stats[i].success, - intf->crypto_stats[i].icv_error, - intf->crypto_stats[i].mic_error, - intf->crypto_stats[i].key_error); - } - - size = strlen(data); - size = min(size, length); - - if (copy_to_user(buf, data, size)) { - kfree(data); - return -EFAULT; - } - - kfree(data); - - *offset += size; - return size; -} - -static const struct file_operations rt2x00debug_fop_crypto_stats = { - .owner = THIS_MODULE, - .read = rt2x00debug_read_crypto_stats, - .open = rt2x00debug_file_open, - .release = rt2x00debug_file_release, - .llseek = default_llseek, -}; -#endif - -#define RT2X00DEBUGFS_OPS_READ(__name, __format, __type) \ -static ssize_t rt2x00debug_read_##__name(struct file *file, \ - char __user *buf, \ - size_t length, \ - loff_t *offset) \ -{ \ - struct rt2x00debug_intf *intf = file->private_data; \ - const struct rt2x00debug *debug = intf->debug; \ - char line[16]; \ - size_t size; \ - unsigned int index = intf->offset_##__name; \ - __type value; \ - \ - if (*offset) \ - return 0; \ - \ - if (index >= debug->__name.word_count) \ - return -EINVAL; \ - \ - index += (debug->__name.word_base / \ - debug->__name.word_size); \ - \ - if (debug->__name.flags & RT2X00DEBUGFS_OFFSET) \ - index *= debug->__name.word_size; \ - \ - debug->__name.read(intf->rt2x00dev, index, &value); \ - \ - size = sprintf(line, __format, value); \ - \ - if (copy_to_user(buf, line, size)) \ - return -EFAULT; \ - \ - *offset += size; \ - return size; \ -} - -#define RT2X00DEBUGFS_OPS_WRITE(__name, __type) \ -static ssize_t rt2x00debug_write_##__name(struct file *file, \ - const char __user *buf,\ - size_t length, \ - loff_t *offset) \ -{ \ - struct rt2x00debug_intf *intf = file->private_data; \ - const struct rt2x00debug *debug = intf->debug; \ - char line[16]; \ - size_t size; \ - unsigned int index = intf->offset_##__name; \ - __type value; \ - \ - if (*offset) \ - return 0; \ - \ - if (index >= debug->__name.word_count) \ - return -EINVAL; \ - \ - if (length > sizeof(line)) \ - return -EINVAL; \ - \ - if (copy_from_user(line, buf, length)) \ - return -EFAULT; \ - \ - size = strlen(line); \ - value = simple_strtoul(line, NULL, 0); \ - \ - index += (debug->__name.word_base / \ - debug->__name.word_size); \ - \ - if (debug->__name.flags & RT2X00DEBUGFS_OFFSET) \ - index *= debug->__name.word_size; \ - \ - debug->__name.write(intf->rt2x00dev, index, value); \ - \ - *offset += size; \ - return size; \ -} - -#define RT2X00DEBUGFS_OPS(__name, __format, __type) \ -RT2X00DEBUGFS_OPS_READ(__name, __format, __type); \ -RT2X00DEBUGFS_OPS_WRITE(__name, __type); \ - \ -static const struct file_operations rt2x00debug_fop_##__name = {\ - .owner = THIS_MODULE, \ - .read = rt2x00debug_read_##__name, \ - .write = rt2x00debug_write_##__name, \ - .open = rt2x00debug_file_open, \ - .release = rt2x00debug_file_release, \ - .llseek = generic_file_llseek, \ -}; - -RT2X00DEBUGFS_OPS(csr, "0x%.8x\n", u32); -RT2X00DEBUGFS_OPS(eeprom, "0x%.4x\n", u16); -RT2X00DEBUGFS_OPS(bbp, "0x%.2x\n", u8); -RT2X00DEBUGFS_OPS(rf, "0x%.8x\n", u32); -RT2X00DEBUGFS_OPS(rfcsr, "0x%.2x\n", u8); - -static ssize_t rt2x00debug_read_dev_flags(struct file *file, - char __user *buf, - size_t length, - loff_t *offset) -{ - struct rt2x00debug_intf *intf = file->private_data; - char line[16]; - size_t size; - - if (*offset) - return 0; - - size = sprintf(line, "0x%.8x\n", (unsigned int)intf->rt2x00dev->flags); - - if (copy_to_user(buf, line, size)) - return -EFAULT; - - *offset += size; - return size; -} - -static const struct file_operations rt2x00debug_fop_dev_flags = { - .owner = THIS_MODULE, - .read = rt2x00debug_read_dev_flags, - .open = rt2x00debug_file_open, - .release = rt2x00debug_file_release, - .llseek = default_llseek, -}; - -static ssize_t rt2x00debug_read_cap_flags(struct file *file, - char __user *buf, - size_t length, - loff_t *offset) -{ - struct rt2x00debug_intf *intf = file->private_data; - char line[16]; - size_t size; - - if (*offset) - return 0; - - size = sprintf(line, "0x%.8x\n", (unsigned int)intf->rt2x00dev->cap_flags); - - if (copy_to_user(buf, line, size)) - return -EFAULT; - - *offset += size; - return size; -} - -static const struct file_operations rt2x00debug_fop_cap_flags = { - .owner = THIS_MODULE, - .read = rt2x00debug_read_cap_flags, - .open = rt2x00debug_file_open, - .release = rt2x00debug_file_release, - .llseek = default_llseek, -}; - -static struct dentry *rt2x00debug_create_file_driver(const char *name, - struct rt2x00debug_intf - *intf, - struct debugfs_blob_wrapper - *blob) -{ - char *data; - - data = kzalloc(3 * MAX_LINE_LENGTH, GFP_KERNEL); - if (!data) - return NULL; - - blob->data = data; - data += sprintf(data, "driver:\t%s\n", intf->rt2x00dev->ops->name); - data += sprintf(data, "version:\t%s\n", DRV_VERSION); - blob->size = strlen(blob->data); - - return debugfs_create_blob(name, S_IRUSR, intf->driver_folder, blob); -} - -static struct dentry *rt2x00debug_create_file_chipset(const char *name, - struct rt2x00debug_intf - *intf, - struct - debugfs_blob_wrapper - *blob) -{ - const struct rt2x00debug *debug = intf->debug; - char *data; - - data = kzalloc(9 * MAX_LINE_LENGTH, GFP_KERNEL); - if (!data) - return NULL; - - blob->data = data; - data += sprintf(data, "rt chip:\t%04x\n", intf->rt2x00dev->chip.rt); - data += sprintf(data, "rf chip:\t%04x\n", intf->rt2x00dev->chip.rf); - data += sprintf(data, "revision:\t%04x\n", intf->rt2x00dev->chip.rev); - data += sprintf(data, "\n"); - data += sprintf(data, "register\tbase\twords\twordsize\n"); -#define RT2X00DEBUGFS_SPRINTF_REGISTER(__name) \ -{ \ - if(debug->__name.read) \ - data += sprintf(data, __stringify(__name) \ - "\t%d\t%d\t%d\n", \ - debug->__name.word_base, \ - debug->__name.word_count, \ - debug->__name.word_size); \ -} - RT2X00DEBUGFS_SPRINTF_REGISTER(csr); - RT2X00DEBUGFS_SPRINTF_REGISTER(eeprom); - RT2X00DEBUGFS_SPRINTF_REGISTER(bbp); - RT2X00DEBUGFS_SPRINTF_REGISTER(rf); - RT2X00DEBUGFS_SPRINTF_REGISTER(rfcsr); -#undef RT2X00DEBUGFS_SPRINTF_REGISTER - - blob->size = strlen(blob->data); - - return debugfs_create_blob(name, S_IRUSR, intf->driver_folder, blob); -} - -void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) -{ - const struct rt2x00debug *debug = rt2x00dev->ops->debugfs; - struct rt2x00debug_intf *intf; - - intf = kzalloc(sizeof(struct rt2x00debug_intf), GFP_KERNEL); - if (!intf) { - rt2x00_err(rt2x00dev, "Failed to allocate debug handler\n"); - return; - } - - intf->debug = debug; - intf->rt2x00dev = rt2x00dev; - rt2x00dev->debugfs_intf = intf; - - intf->driver_folder = - debugfs_create_dir(intf->rt2x00dev->ops->name, - rt2x00dev->hw->wiphy->debugfsdir); - if (IS_ERR(intf->driver_folder) || !intf->driver_folder) - goto exit; - - intf->driver_entry = - rt2x00debug_create_file_driver("driver", intf, &intf->driver_blob); - if (IS_ERR(intf->driver_entry) || !intf->driver_entry) - goto exit; - - intf->chipset_entry = - rt2x00debug_create_file_chipset("chipset", - intf, &intf->chipset_blob); - if (IS_ERR(intf->chipset_entry) || !intf->chipset_entry) - goto exit; - - intf->dev_flags = debugfs_create_file("dev_flags", S_IRUSR, - intf->driver_folder, intf, - &rt2x00debug_fop_dev_flags); - if (IS_ERR(intf->dev_flags) || !intf->dev_flags) - goto exit; - - intf->cap_flags = debugfs_create_file("cap_flags", S_IRUSR, - intf->driver_folder, intf, - &rt2x00debug_fop_cap_flags); - if (IS_ERR(intf->cap_flags) || !intf->cap_flags) - goto exit; - - intf->register_folder = - debugfs_create_dir("register", intf->driver_folder); - if (IS_ERR(intf->register_folder) || !intf->register_folder) - goto exit; - -#define RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(__intf, __name) \ -({ \ - if(debug->__name.read) { \ - (__intf)->__name##_off_entry = \ - debugfs_create_u32(__stringify(__name) "_offset", \ - S_IRUSR | S_IWUSR, \ - (__intf)->register_folder, \ - &(__intf)->offset_##__name); \ - if (IS_ERR((__intf)->__name##_off_entry) \ - || !(__intf)->__name##_off_entry) \ - goto exit; \ - \ - (__intf)->__name##_val_entry = \ - debugfs_create_file(__stringify(__name) "_value", \ - S_IRUSR | S_IWUSR, \ - (__intf)->register_folder, \ - (__intf), &rt2x00debug_fop_##__name); \ - if (IS_ERR((__intf)->__name##_val_entry) \ - || !(__intf)->__name##_val_entry) \ - goto exit; \ - } \ -}) - - RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, csr); - RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, eeprom); - RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, bbp); - RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, rf); - RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, rfcsr); - -#undef RT2X00DEBUGFS_CREATE_REGISTER_ENTRY - - intf->queue_folder = - debugfs_create_dir("queue", intf->driver_folder); - if (IS_ERR(intf->queue_folder) || !intf->queue_folder) - goto exit; - - intf->queue_frame_dump_entry = - debugfs_create_file("dump", S_IRUSR, intf->queue_folder, - intf, &rt2x00debug_fop_queue_dump); - if (IS_ERR(intf->queue_frame_dump_entry) - || !intf->queue_frame_dump_entry) - goto exit; - - skb_queue_head_init(&intf->frame_dump_skbqueue); - init_waitqueue_head(&intf->frame_dump_waitqueue); - - intf->queue_stats_entry = - debugfs_create_file("queue", S_IRUSR, intf->queue_folder, - intf, &rt2x00debug_fop_queue_stats); - -#ifdef CONFIG_RT2X00_LIB_CRYPTO - if (test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags)) - intf->crypto_stats_entry = - debugfs_create_file("crypto", S_IRUGO, intf->queue_folder, - intf, &rt2x00debug_fop_crypto_stats); -#endif - - return; - -exit: - rt2x00debug_deregister(rt2x00dev); - rt2x00_err(rt2x00dev, "Failed to register debug handler\n"); -} - -void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev) -{ - struct rt2x00debug_intf *intf = rt2x00dev->debugfs_intf; - - if (unlikely(!intf)) - return; - - skb_queue_purge(&intf->frame_dump_skbqueue); - -#ifdef CONFIG_RT2X00_LIB_CRYPTO - debugfs_remove(intf->crypto_stats_entry); -#endif - debugfs_remove(intf->queue_stats_entry); - debugfs_remove(intf->queue_frame_dump_entry); - debugfs_remove(intf->queue_folder); - debugfs_remove(intf->rfcsr_val_entry); - debugfs_remove(intf->rfcsr_off_entry); - debugfs_remove(intf->rf_val_entry); - debugfs_remove(intf->rf_off_entry); - debugfs_remove(intf->bbp_val_entry); - debugfs_remove(intf->bbp_off_entry); - debugfs_remove(intf->eeprom_val_entry); - debugfs_remove(intf->eeprom_off_entry); - debugfs_remove(intf->csr_val_entry); - debugfs_remove(intf->csr_off_entry); - debugfs_remove(intf->register_folder); - debugfs_remove(intf->dev_flags); - debugfs_remove(intf->cap_flags); - debugfs_remove(intf->chipset_entry); - debugfs_remove(intf->driver_entry); - debugfs_remove(intf->driver_folder); - kfree(intf->chipset_blob.data); - kfree(intf->driver_blob.data); - kfree(intf); - - rt2x00dev->debugfs_intf = NULL; -} diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.h b/drivers/net/wireless/rt2x00/rt2x00debug.h deleted file mode 100644 index e11d39bdfef7..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00debug.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00debug - Abstract: Data structures for the rt2x00debug. - */ - -#ifndef RT2X00DEBUG_H -#define RT2X00DEBUG_H - -struct rt2x00_dev; - -/** - * enum rt2x00debugfs_entry_flags: Flags for debugfs registry entry - * - * @RT2X00DEBUGFS_OFFSET: rt2x00lib should pass the register offset - * as argument when using the callback function read()/write() - */ -enum rt2x00debugfs_entry_flags { - RT2X00DEBUGFS_OFFSET = (1 << 0), -}; - -#define RT2X00DEBUGFS_REGISTER_ENTRY(__name, __type) \ -struct reg##__name { \ - void (*read)(struct rt2x00_dev *rt2x00dev, \ - const unsigned int word, __type *data); \ - void (*write)(struct rt2x00_dev *rt2x00dev, \ - const unsigned int word, __type data); \ - \ - unsigned int flags; \ - \ - unsigned int word_base; \ - unsigned int word_size; \ - unsigned int word_count; \ -} __name - -struct rt2x00debug { - /* - * Reference to the modules structure. - */ - struct module *owner; - - /* - * Register access entries. - */ - RT2X00DEBUGFS_REGISTER_ENTRY(csr, u32); - RT2X00DEBUGFS_REGISTER_ENTRY(eeprom, u16); - RT2X00DEBUGFS_REGISTER_ENTRY(bbp, u8); - RT2X00DEBUGFS_REGISTER_ENTRY(rf, u32); - RT2X00DEBUGFS_REGISTER_ENTRY(rfcsr, u8); -}; - -#endif /* RT2X00DEBUG_H */ diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c deleted file mode 100644 index a2889d1cfe37..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ /dev/null @@ -1,1517 +0,0 @@ -/* - Copyright (C) 2010 Willow Garage - Copyright (C) 2004 - 2010 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00lib - Abstract: rt2x00 generic device routines. - */ - -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2x00lib.h" - -/* - * Utility functions. - */ -u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev, - struct ieee80211_vif *vif) -{ - /* - * When in STA mode, bssidx is always 0 otherwise local_address[5] - * contains the bss number, see BSS_ID_MASK comments for details. - */ - if (rt2x00dev->intf_sta_count) - return 0; - return vif->addr[5] & (rt2x00dev->ops->max_ap_intf - 1); -} -EXPORT_SYMBOL_GPL(rt2x00lib_get_bssidx); - -/* - * Radio control handlers. - */ -int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) -{ - int status; - - /* - * Don't enable the radio twice. - * And check if the hardware button has been disabled. - */ - if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - return 0; - - /* - * Initialize all data queues. - */ - rt2x00queue_init_queues(rt2x00dev); - - /* - * Enable radio. - */ - status = - rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_ON); - if (status) - return status; - - rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_IRQ_ON); - - rt2x00leds_led_radio(rt2x00dev, true); - rt2x00led_led_activity(rt2x00dev, true); - - set_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags); - - /* - * Enable queues. - */ - rt2x00queue_start_queues(rt2x00dev); - rt2x00link_start_tuner(rt2x00dev); - rt2x00link_start_agc(rt2x00dev); - if (test_bit(CAPABILITY_VCO_RECALIBRATION, &rt2x00dev->cap_flags)) - rt2x00link_start_vcocal(rt2x00dev); - - /* - * Start watchdog monitoring. - */ - rt2x00link_start_watchdog(rt2x00dev); - - return 0; -} - -void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev) -{ - if (!test_and_clear_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - return; - - /* - * Stop watchdog monitoring. - */ - rt2x00link_stop_watchdog(rt2x00dev); - - /* - * Stop all queues - */ - rt2x00link_stop_agc(rt2x00dev); - if (test_bit(CAPABILITY_VCO_RECALIBRATION, &rt2x00dev->cap_flags)) - rt2x00link_stop_vcocal(rt2x00dev); - rt2x00link_stop_tuner(rt2x00dev); - rt2x00queue_stop_queues(rt2x00dev); - rt2x00queue_flush_queues(rt2x00dev, true); - - /* - * Disable radio. - */ - rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_OFF); - rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_RADIO_IRQ_OFF); - rt2x00led_led_activity(rt2x00dev, false); - rt2x00leds_led_radio(rt2x00dev, false); -} - -static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct rt2x00_dev *rt2x00dev = data; - struct rt2x00_intf *intf = vif_to_intf(vif); - - /* - * It is possible the radio was disabled while the work had been - * scheduled. If that happens we should return here immediately, - * note that in the spinlock protected area above the delayed_flags - * have been cleared correctly. - */ - if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - return; - - if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags)) - rt2x00queue_update_beacon(rt2x00dev, vif); -} - -static void rt2x00lib_intf_scheduled(struct work_struct *work) -{ - struct rt2x00_dev *rt2x00dev = - container_of(work, struct rt2x00_dev, intf_work); - - /* - * Iterate over each interface and perform the - * requested configurations. - */ - ieee80211_iterate_active_interfaces(rt2x00dev->hw, - IEEE80211_IFACE_ITER_RESUME_ALL, - rt2x00lib_intf_scheduled_iter, - rt2x00dev); -} - -static void rt2x00lib_autowakeup(struct work_struct *work) -{ - struct rt2x00_dev *rt2x00dev = - container_of(work, struct rt2x00_dev, autowakeup_work.work); - - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - return; - - if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE)) - rt2x00_err(rt2x00dev, "Device failed to wakeup\n"); - clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags); -} - -/* - * Interrupt context handlers. - */ -static void rt2x00lib_bc_buffer_iter(void *data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct ieee80211_tx_control control = {}; - struct rt2x00_dev *rt2x00dev = data; - struct sk_buff *skb; - - /* - * Only AP mode interfaces do broad- and multicast buffering - */ - if (vif->type != NL80211_IFTYPE_AP) - return; - - /* - * Send out buffered broad- and multicast frames - */ - skb = ieee80211_get_buffered_bc(rt2x00dev->hw, vif); - while (skb) { - rt2x00mac_tx(rt2x00dev->hw, &control, skb); - skb = ieee80211_get_buffered_bc(rt2x00dev->hw, vif); - } -} - -static void rt2x00lib_beaconupdate_iter(void *data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct rt2x00_dev *rt2x00dev = data; - - if (vif->type != NL80211_IFTYPE_AP && - vif->type != NL80211_IFTYPE_ADHOC && - vif->type != NL80211_IFTYPE_MESH_POINT && - vif->type != NL80211_IFTYPE_WDS) - return; - - /* - * Update the beacon without locking. This is safe on PCI devices - * as they only update the beacon periodically here. This should - * never be called for USB devices. - */ - WARN_ON(rt2x00_is_usb(rt2x00dev)); - rt2x00queue_update_beacon_locked(rt2x00dev, vif); -} - -void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev) -{ - if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - return; - - /* send buffered bc/mc frames out for every bssid */ - ieee80211_iterate_active_interfaces_atomic( - rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - rt2x00lib_bc_buffer_iter, rt2x00dev); - /* - * Devices with pre tbtt interrupt don't need to update the beacon - * here as they will fetch the next beacon directly prior to - * transmission. - */ - if (test_bit(CAPABILITY_PRE_TBTT_INTERRUPT, &rt2x00dev->cap_flags)) - return; - - /* fetch next beacon */ - ieee80211_iterate_active_interfaces_atomic( - rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - rt2x00lib_beaconupdate_iter, rt2x00dev); -} -EXPORT_SYMBOL_GPL(rt2x00lib_beacondone); - -void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev) -{ - if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - return; - - /* fetch next beacon */ - ieee80211_iterate_active_interfaces_atomic( - rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - rt2x00lib_beaconupdate_iter, rt2x00dev); -} -EXPORT_SYMBOL_GPL(rt2x00lib_pretbtt); - -void rt2x00lib_dmastart(struct queue_entry *entry) -{ - set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); - rt2x00queue_index_inc(entry, Q_INDEX); -} -EXPORT_SYMBOL_GPL(rt2x00lib_dmastart); - -void rt2x00lib_dmadone(struct queue_entry *entry) -{ - set_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags); - clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); - rt2x00queue_index_inc(entry, Q_INDEX_DMA_DONE); -} -EXPORT_SYMBOL_GPL(rt2x00lib_dmadone); - -static inline int rt2x00lib_txdone_bar_status(struct queue_entry *entry) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct ieee80211_bar *bar = (void *) entry->skb->data; - struct rt2x00_bar_list_entry *bar_entry; - int ret; - - if (likely(!ieee80211_is_back_req(bar->frame_control))) - return 0; - - /* - * Unlike all other frames, the status report for BARs does - * not directly come from the hardware as it is incapable of - * matching a BA to a previously send BAR. The hardware will - * report all BARs as if they weren't acked at all. - * - * Instead the RX-path will scan for incoming BAs and set the - * block_acked flag if it sees one that was likely caused by - * a BAR from us. - * - * Remove remaining BARs here and return their status for - * TX done processing. - */ - ret = 0; - rcu_read_lock(); - list_for_each_entry_rcu(bar_entry, &rt2x00dev->bar_list, list) { - if (bar_entry->entry != entry) - continue; - - spin_lock_bh(&rt2x00dev->bar_list_lock); - /* Return whether this BAR was blockacked or not */ - ret = bar_entry->block_acked; - /* Remove the BAR from our checklist */ - list_del_rcu(&bar_entry->list); - spin_unlock_bh(&rt2x00dev->bar_list_lock); - kfree_rcu(bar_entry, head); - - break; - } - rcu_read_unlock(); - - return ret; -} - -void rt2x00lib_txdone(struct queue_entry *entry, - struct txdone_entry_desc *txdesc) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - unsigned int header_length, i; - u8 rate_idx, rate_flags, retry_rates; - u8 skbdesc_flags = skbdesc->flags; - bool success; - - /* - * Unmap the skb. - */ - rt2x00queue_unmap_skb(entry); - - /* - * Remove the extra tx headroom from the skb. - */ - skb_pull(entry->skb, rt2x00dev->ops->extra_tx_headroom); - - /* - * Signal that the TX descriptor is no longer in the skb. - */ - skbdesc->flags &= ~SKBDESC_DESC_IN_SKB; - - /* - * Determine the length of 802.11 header. - */ - header_length = ieee80211_get_hdrlen_from_skb(entry->skb); - - /* - * Remove L2 padding which was added during - */ - if (test_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags)) - rt2x00queue_remove_l2pad(entry->skb, header_length); - - /* - * If the IV/EIV data was stripped from the frame before it was - * passed to the hardware, we should now reinsert it again because - * mac80211 will expect the same data to be present it the - * frame as it was passed to us. - */ - if (test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags)) - rt2x00crypto_tx_insert_iv(entry->skb, header_length); - - /* - * Send frame to debugfs immediately, after this call is completed - * we are going to overwrite the skb->cb array. - */ - rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry->skb); - - /* - * Determine if the frame has been successfully transmitted and - * remove BARs from our check list while checking for their - * TX status. - */ - success = - rt2x00lib_txdone_bar_status(entry) || - test_bit(TXDONE_SUCCESS, &txdesc->flags) || - test_bit(TXDONE_UNKNOWN, &txdesc->flags); - - /* - * Update TX statistics. - */ - rt2x00dev->link.qual.tx_success += success; - rt2x00dev->link.qual.tx_failed += !success; - - rate_idx = skbdesc->tx_rate_idx; - rate_flags = skbdesc->tx_rate_flags; - retry_rates = test_bit(TXDONE_FALLBACK, &txdesc->flags) ? - (txdesc->retry + 1) : 1; - - /* - * Initialize TX status - */ - memset(&tx_info->status, 0, sizeof(tx_info->status)); - tx_info->status.ack_signal = 0; - - /* - * Frame was send with retries, hardware tried - * different rates to send out the frame, at each - * retry it lowered the rate 1 step except when the - * lowest rate was used. - */ - for (i = 0; i < retry_rates && i < IEEE80211_TX_MAX_RATES; i++) { - tx_info->status.rates[i].idx = rate_idx - i; - tx_info->status.rates[i].flags = rate_flags; - - if (rate_idx - i == 0) { - /* - * The lowest rate (index 0) was used until the - * number of max retries was reached. - */ - tx_info->status.rates[i].count = retry_rates - i; - i++; - break; - } - tx_info->status.rates[i].count = 1; - } - if (i < (IEEE80211_TX_MAX_RATES - 1)) - tx_info->status.rates[i].idx = -1; /* terminate */ - - if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) { - if (success) - tx_info->flags |= IEEE80211_TX_STAT_ACK; - else - rt2x00dev->low_level_stats.dot11ACKFailureCount++; - } - - /* - * Every single frame has it's own tx status, hence report - * every frame as ampdu of size 1. - * - * TODO: if we can find out how many frames were aggregated - * by the hw we could provide the real ampdu_len to mac80211 - * which would allow the rc algorithm to better decide on - * which rates are suitable. - */ - if (test_bit(TXDONE_AMPDU, &txdesc->flags) || - tx_info->flags & IEEE80211_TX_CTL_AMPDU) { - tx_info->flags |= IEEE80211_TX_STAT_AMPDU; - tx_info->status.ampdu_len = 1; - tx_info->status.ampdu_ack_len = success ? 1 : 0; - - if (!success) - tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; - } - - if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) { - if (success) - rt2x00dev->low_level_stats.dot11RTSSuccessCount++; - else - rt2x00dev->low_level_stats.dot11RTSFailureCount++; - } - - /* - * Only send the status report to mac80211 when it's a frame - * that originated in mac80211. If this was a extra frame coming - * through a mac80211 library call (RTS/CTS) then we should not - * send the status report back. - */ - if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) { - if (test_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags)) - ieee80211_tx_status(rt2x00dev->hw, entry->skb); - else - ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb); - } else - dev_kfree_skb_any(entry->skb); - - /* - * Make this entry available for reuse. - */ - entry->skb = NULL; - entry->flags = 0; - - rt2x00dev->ops->lib->clear_entry(entry); - - rt2x00queue_index_inc(entry, Q_INDEX_DONE); - - /* - * If the data queue was below the threshold before the txdone - * handler we must make sure the packet queue in the mac80211 stack - * is reenabled when the txdone handler has finished. This has to be - * serialized with rt2x00mac_tx(), otherwise we can wake up queue - * before it was stopped. - */ - spin_lock_bh(&entry->queue->tx_lock); - if (!rt2x00queue_threshold(entry->queue)) - rt2x00queue_unpause_queue(entry->queue); - spin_unlock_bh(&entry->queue->tx_lock); -} -EXPORT_SYMBOL_GPL(rt2x00lib_txdone); - -void rt2x00lib_txdone_noinfo(struct queue_entry *entry, u32 status) -{ - struct txdone_entry_desc txdesc; - - txdesc.flags = 0; - __set_bit(status, &txdesc.flags); - txdesc.retry = 0; - - rt2x00lib_txdone(entry, &txdesc); -} -EXPORT_SYMBOL_GPL(rt2x00lib_txdone_noinfo); - -static u8 *rt2x00lib_find_ie(u8 *data, unsigned int len, u8 ie) -{ - struct ieee80211_mgmt *mgmt = (void *)data; - u8 *pos, *end; - - pos = (u8 *)mgmt->u.beacon.variable; - end = data + len; - while (pos < end) { - if (pos + 2 + pos[1] > end) - return NULL; - - if (pos[0] == ie) - return pos; - - pos += 2 + pos[1]; - } - - return NULL; -} - -static void rt2x00lib_sleep(struct work_struct *work) -{ - struct rt2x00_dev *rt2x00dev = - container_of(work, struct rt2x00_dev, sleep_work); - - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - return; - - /* - * Check again is powersaving is enabled, to prevent races from delayed - * work execution. - */ - if (!test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags)) - rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf, - IEEE80211_CONF_CHANGE_PS); -} - -static void rt2x00lib_rxdone_check_ba(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb, - struct rxdone_entry_desc *rxdesc) -{ - struct rt2x00_bar_list_entry *entry; - struct ieee80211_bar *ba = (void *)skb->data; - - if (likely(!ieee80211_is_back(ba->frame_control))) - return; - - if (rxdesc->size < sizeof(*ba) + FCS_LEN) - return; - - rcu_read_lock(); - list_for_each_entry_rcu(entry, &rt2x00dev->bar_list, list) { - - if (ba->start_seq_num != entry->start_seq_num) - continue; - -#define TID_CHECK(a, b) ( \ - ((a) & cpu_to_le16(IEEE80211_BAR_CTRL_TID_INFO_MASK)) == \ - ((b) & cpu_to_le16(IEEE80211_BAR_CTRL_TID_INFO_MASK))) \ - - if (!TID_CHECK(ba->control, entry->control)) - continue; - -#undef TID_CHECK - - if (compare_ether_addr(ba->ra, entry->ta)) - continue; - - if (compare_ether_addr(ba->ta, entry->ra)) - continue; - - /* Mark BAR since we received the according BA */ - spin_lock_bh(&rt2x00dev->bar_list_lock); - entry->block_acked = 1; - spin_unlock_bh(&rt2x00dev->bar_list_lock); - break; - } - rcu_read_unlock(); - -} - -static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb, - struct rxdone_entry_desc *rxdesc) -{ - struct ieee80211_hdr *hdr = (void *) skb->data; - struct ieee80211_tim_ie *tim_ie; - u8 *tim; - u8 tim_len; - bool cam; - - /* If this is not a beacon, or if mac80211 has no powersaving - * configured, or if the device is already in powersaving mode - * we can exit now. */ - if (likely(!ieee80211_is_beacon(hdr->frame_control) || - !(rt2x00dev->hw->conf.flags & IEEE80211_CONF_PS))) - return; - - /* min. beacon length + FCS_LEN */ - if (skb->len <= 40 + FCS_LEN) - return; - - /* and only beacons from the associated BSSID, please */ - if (!(rxdesc->dev_flags & RXDONE_MY_BSS) || - !rt2x00dev->aid) - return; - - rt2x00dev->last_beacon = jiffies; - - tim = rt2x00lib_find_ie(skb->data, skb->len - FCS_LEN, WLAN_EID_TIM); - if (!tim) - return; - - if (tim[1] < sizeof(*tim_ie)) - return; - - tim_len = tim[1]; - tim_ie = (struct ieee80211_tim_ie *) &tim[2]; - - /* Check whenever the PHY can be turned off again. */ - - /* 1. What about buffered unicast traffic for our AID? */ - cam = ieee80211_check_tim(tim_ie, tim_len, rt2x00dev->aid); - - /* 2. Maybe the AP wants to send multicast/broadcast data? */ - cam |= (tim_ie->bitmap_ctrl & 0x01); - - if (!cam && !test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags)) - queue_work(rt2x00dev->workqueue, &rt2x00dev->sleep_work); -} - -static int rt2x00lib_rxdone_read_signal(struct rt2x00_dev *rt2x00dev, - struct rxdone_entry_desc *rxdesc) -{ - struct ieee80211_supported_band *sband; - const struct rt2x00_rate *rate; - unsigned int i; - int signal = rxdesc->signal; - int type = (rxdesc->dev_flags & RXDONE_SIGNAL_MASK); - - switch (rxdesc->rate_mode) { - case RATE_MODE_CCK: - case RATE_MODE_OFDM: - /* - * For non-HT rates the MCS value needs to contain the - * actually used rate modulation (CCK or OFDM). - */ - if (rxdesc->dev_flags & RXDONE_SIGNAL_MCS) - signal = RATE_MCS(rxdesc->rate_mode, signal); - - sband = &rt2x00dev->bands[rt2x00dev->curr_band]; - for (i = 0; i < sband->n_bitrates; i++) { - rate = rt2x00_get_rate(sband->bitrates[i].hw_value); - if (((type == RXDONE_SIGNAL_PLCP) && - (rate->plcp == signal)) || - ((type == RXDONE_SIGNAL_BITRATE) && - (rate->bitrate == signal)) || - ((type == RXDONE_SIGNAL_MCS) && - (rate->mcs == signal))) { - return i; - } - } - break; - case RATE_MODE_HT_MIX: - case RATE_MODE_HT_GREENFIELD: - if (signal >= 0 && signal <= 76) - return signal; - break; - default: - break; - } - - rt2x00_warn(rt2x00dev, "Frame received with unrecognized signal, mode=0x%.4x, signal=0x%.4x, type=%d\n", - rxdesc->rate_mode, signal, type); - return 0; -} - -void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct rxdone_entry_desc rxdesc; - struct sk_buff *skb; - struct ieee80211_rx_status *rx_status; - unsigned int header_length; - int rate_idx; - - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) || - !test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - goto submit_entry; - - if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags)) - goto submit_entry; - - /* - * Allocate a new sk_buffer. If no new buffer available, drop the - * received frame and reuse the existing buffer. - */ - skb = rt2x00queue_alloc_rxskb(entry, gfp); - if (!skb) - goto submit_entry; - - /* - * Unmap the skb. - */ - rt2x00queue_unmap_skb(entry); - - /* - * Extract the RXD details. - */ - memset(&rxdesc, 0, sizeof(rxdesc)); - rt2x00dev->ops->lib->fill_rxdone(entry, &rxdesc); - - /* - * Check for valid size in case we get corrupted descriptor from - * hardware. - */ - if (unlikely(rxdesc.size == 0 || - rxdesc.size > entry->queue->data_size)) { - rt2x00_err(rt2x00dev, "Wrong frame size %d max %d\n", - rxdesc.size, entry->queue->data_size); - dev_kfree_skb(entry->skb); - goto renew_skb; - } - - /* - * The data behind the ieee80211 header must be - * aligned on a 4 byte boundary. - */ - header_length = ieee80211_get_hdrlen_from_skb(entry->skb); - - /* - * Hardware might have stripped the IV/EIV/ICV data, - * in that case it is possible that the data was - * provided separately (through hardware descriptor) - * in which case we should reinsert the data into the frame. - */ - if ((rxdesc.dev_flags & RXDONE_CRYPTO_IV) && - (rxdesc.flags & RX_FLAG_IV_STRIPPED)) - rt2x00crypto_rx_insert_iv(entry->skb, header_length, - &rxdesc); - else if (header_length && - (rxdesc.size > header_length) && - (rxdesc.dev_flags & RXDONE_L2PAD)) - rt2x00queue_remove_l2pad(entry->skb, header_length); - - /* Trim buffer to correct size */ - skb_trim(entry->skb, rxdesc.size); - - /* - * Translate the signal to the correct bitrate index. - */ - rate_idx = rt2x00lib_rxdone_read_signal(rt2x00dev, &rxdesc); - if (rxdesc.rate_mode == RATE_MODE_HT_MIX || - rxdesc.rate_mode == RATE_MODE_HT_GREENFIELD) - rxdesc.flags |= RX_FLAG_HT; - - /* - * Check if this is a beacon, and more frames have been - * buffered while we were in powersaving mode. - */ - rt2x00lib_rxdone_check_ps(rt2x00dev, entry->skb, &rxdesc); - - /* - * Check for incoming BlockAcks to match to the BlockAckReqs - * we've send out. - */ - rt2x00lib_rxdone_check_ba(rt2x00dev, entry->skb, &rxdesc); - - /* - * Update extra components - */ - rt2x00link_update_stats(rt2x00dev, entry->skb, &rxdesc); - rt2x00debug_update_crypto(rt2x00dev, &rxdesc); - rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_RXDONE, entry->skb); - - /* - * Initialize RX status information, and send frame - * to mac80211. - */ - rx_status = IEEE80211_SKB_RXCB(entry->skb); - - /* Ensure that all fields of rx_status are initialized - * properly. The skb->cb array was used for driver - * specific informations, so rx_status might contain - * garbage. - */ - memset(rx_status, 0, sizeof(*rx_status)); - - rx_status->mactime = rxdesc.timestamp; - rx_status->band = rt2x00dev->curr_band; - rx_status->freq = rt2x00dev->curr_freq; - rx_status->rate_idx = rate_idx; - rx_status->signal = rxdesc.rssi; - rx_status->flag = rxdesc.flags; - rx_status->antenna = rt2x00dev->link.ant.active.rx; - - ieee80211_rx_ni(rt2x00dev->hw, entry->skb); - -renew_skb: - /* - * Replace the skb with the freshly allocated one. - */ - entry->skb = skb; - -submit_entry: - entry->flags = 0; - rt2x00queue_index_inc(entry, Q_INDEX_DONE); - if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && - test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt2x00dev->ops->lib->clear_entry(entry); -} -EXPORT_SYMBOL_GPL(rt2x00lib_rxdone); - -/* - * Driver initialization handlers. - */ -const struct rt2x00_rate rt2x00_supported_rates[12] = { - { - .flags = DEV_RATE_CCK, - .bitrate = 10, - .ratemask = BIT(0), - .plcp = 0x00, - .mcs = RATE_MCS(RATE_MODE_CCK, 0), - }, - { - .flags = DEV_RATE_CCK | DEV_RATE_SHORT_PREAMBLE, - .bitrate = 20, - .ratemask = BIT(1), - .plcp = 0x01, - .mcs = RATE_MCS(RATE_MODE_CCK, 1), - }, - { - .flags = DEV_RATE_CCK | DEV_RATE_SHORT_PREAMBLE, - .bitrate = 55, - .ratemask = BIT(2), - .plcp = 0x02, - .mcs = RATE_MCS(RATE_MODE_CCK, 2), - }, - { - .flags = DEV_RATE_CCK | DEV_RATE_SHORT_PREAMBLE, - .bitrate = 110, - .ratemask = BIT(3), - .plcp = 0x03, - .mcs = RATE_MCS(RATE_MODE_CCK, 3), - }, - { - .flags = DEV_RATE_OFDM, - .bitrate = 60, - .ratemask = BIT(4), - .plcp = 0x0b, - .mcs = RATE_MCS(RATE_MODE_OFDM, 0), - }, - { - .flags = DEV_RATE_OFDM, - .bitrate = 90, - .ratemask = BIT(5), - .plcp = 0x0f, - .mcs = RATE_MCS(RATE_MODE_OFDM, 1), - }, - { - .flags = DEV_RATE_OFDM, - .bitrate = 120, - .ratemask = BIT(6), - .plcp = 0x0a, - .mcs = RATE_MCS(RATE_MODE_OFDM, 2), - }, - { - .flags = DEV_RATE_OFDM, - .bitrate = 180, - .ratemask = BIT(7), - .plcp = 0x0e, - .mcs = RATE_MCS(RATE_MODE_OFDM, 3), - }, - { - .flags = DEV_RATE_OFDM, - .bitrate = 240, - .ratemask = BIT(8), - .plcp = 0x09, - .mcs = RATE_MCS(RATE_MODE_OFDM, 4), - }, - { - .flags = DEV_RATE_OFDM, - .bitrate = 360, - .ratemask = BIT(9), - .plcp = 0x0d, - .mcs = RATE_MCS(RATE_MODE_OFDM, 5), - }, - { - .flags = DEV_RATE_OFDM, - .bitrate = 480, - .ratemask = BIT(10), - .plcp = 0x08, - .mcs = RATE_MCS(RATE_MODE_OFDM, 6), - }, - { - .flags = DEV_RATE_OFDM, - .bitrate = 540, - .ratemask = BIT(11), - .plcp = 0x0c, - .mcs = RATE_MCS(RATE_MODE_OFDM, 7), - }, -}; - -static void rt2x00lib_channel(struct ieee80211_channel *entry, - const int channel, const int tx_power, - const int value) -{ - /* XXX: this assumption about the band is wrong for 802.11j */ - entry->band = channel <= 14 ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; - entry->center_freq = ieee80211_channel_to_frequency(channel, - entry->band); - entry->hw_value = value; - entry->max_power = tx_power; - entry->max_antenna_gain = 0xff; -} - -static void rt2x00lib_rate(struct ieee80211_rate *entry, - const u16 index, const struct rt2x00_rate *rate) -{ - entry->flags = 0; - entry->bitrate = rate->bitrate; - entry->hw_value = index; - entry->hw_value_short = index; - - if (rate->flags & DEV_RATE_SHORT_PREAMBLE) - entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE; -} - -static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, - struct hw_mode_spec *spec) -{ - struct ieee80211_hw *hw = rt2x00dev->hw; - struct ieee80211_channel *channels; - struct ieee80211_rate *rates; - unsigned int num_rates; - unsigned int i; - - num_rates = 0; - if (spec->supported_rates & SUPPORT_RATE_CCK) - num_rates += 4; - if (spec->supported_rates & SUPPORT_RATE_OFDM) - num_rates += 8; - - channels = kcalloc(spec->num_channels, sizeof(*channels), GFP_KERNEL); - if (!channels) - return -ENOMEM; - - rates = kcalloc(num_rates, sizeof(*rates), GFP_KERNEL); - if (!rates) - goto exit_free_channels; - - /* - * Initialize Rate list. - */ - for (i = 0; i < num_rates; i++) - rt2x00lib_rate(&rates[i], i, rt2x00_get_rate(i)); - - /* - * Initialize Channel list. - */ - for (i = 0; i < spec->num_channels; i++) { - rt2x00lib_channel(&channels[i], - spec->channels[i].channel, - spec->channels_info[i].max_power, i); - } - - /* - * Intitialize 802.11b, 802.11g - * Rates: CCK, OFDM. - * Channels: 2.4 GHz - */ - if (spec->supported_bands & SUPPORT_BAND_2GHZ) { - rt2x00dev->bands[IEEE80211_BAND_2GHZ].n_channels = 14; - rt2x00dev->bands[IEEE80211_BAND_2GHZ].n_bitrates = num_rates; - rt2x00dev->bands[IEEE80211_BAND_2GHZ].channels = channels; - rt2x00dev->bands[IEEE80211_BAND_2GHZ].bitrates = rates; - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = - &rt2x00dev->bands[IEEE80211_BAND_2GHZ]; - memcpy(&rt2x00dev->bands[IEEE80211_BAND_2GHZ].ht_cap, - &spec->ht, sizeof(spec->ht)); - } - - /* - * Intitialize 802.11a - * Rates: OFDM. - * Channels: OFDM, UNII, HiperLAN2. - */ - if (spec->supported_bands & SUPPORT_BAND_5GHZ) { - rt2x00dev->bands[IEEE80211_BAND_5GHZ].n_channels = - spec->num_channels - 14; - rt2x00dev->bands[IEEE80211_BAND_5GHZ].n_bitrates = - num_rates - 4; - rt2x00dev->bands[IEEE80211_BAND_5GHZ].channels = &channels[14]; - rt2x00dev->bands[IEEE80211_BAND_5GHZ].bitrates = &rates[4]; - hw->wiphy->bands[IEEE80211_BAND_5GHZ] = - &rt2x00dev->bands[IEEE80211_BAND_5GHZ]; - memcpy(&rt2x00dev->bands[IEEE80211_BAND_5GHZ].ht_cap, - &spec->ht, sizeof(spec->ht)); - } - - return 0; - - exit_free_channels: - kfree(channels); - rt2x00_err(rt2x00dev, "Allocation ieee80211 modes failed\n"); - return -ENOMEM; -} - -static void rt2x00lib_remove_hw(struct rt2x00_dev *rt2x00dev) -{ - if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags)) - ieee80211_unregister_hw(rt2x00dev->hw); - - if (likely(rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ])) { - kfree(rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->channels); - kfree(rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ]->bitrates); - rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = NULL; - rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL; - } - - kfree(rt2x00dev->spec.channels_info); -} - -static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) -{ - struct hw_mode_spec *spec = &rt2x00dev->spec; - int status; - - if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags)) - return 0; - - /* - * Initialize HW modes. - */ - status = rt2x00lib_probe_hw_modes(rt2x00dev, spec); - if (status) - return status; - - /* - * Initialize HW fields. - */ - rt2x00dev->hw->queues = rt2x00dev->ops->tx_queues; - - /* - * Initialize extra TX headroom required. - */ - rt2x00dev->hw->extra_tx_headroom = - max_t(unsigned int, IEEE80211_TX_STATUS_HEADROOM, - rt2x00dev->ops->extra_tx_headroom); - - /* - * Take TX headroom required for alignment into account. - */ - if (test_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags)) - rt2x00dev->hw->extra_tx_headroom += RT2X00_L2PAD_SIZE; - else if (test_bit(REQUIRE_DMA, &rt2x00dev->cap_flags)) - rt2x00dev->hw->extra_tx_headroom += RT2X00_ALIGN_SIZE; - - /* - * Tell mac80211 about the size of our private STA structure. - */ - rt2x00dev->hw->sta_data_size = sizeof(struct rt2x00_sta); - - /* - * Allocate tx status FIFO for driver use. - */ - if (test_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags)) { - /* - * Allocate the txstatus fifo. In the worst case the tx - * status fifo has to hold the tx status of all entries - * in all tx queues. Hence, calculate the kfifo size as - * tx_queues * entry_num and round up to the nearest - * power of 2. - */ - int kfifo_size = - roundup_pow_of_two(rt2x00dev->ops->tx_queues * - rt2x00dev->ops->tx->entry_num * - sizeof(u32)); - - status = kfifo_alloc(&rt2x00dev->txstatus_fifo, kfifo_size, - GFP_KERNEL); - if (status) - return status; - } - - /* - * Initialize tasklets if used by the driver. Tasklets are - * disabled until the interrupts are turned on. The driver - * has to handle that. - */ -#define RT2X00_TASKLET_INIT(taskletname) \ - if (rt2x00dev->ops->lib->taskletname) { \ - tasklet_init(&rt2x00dev->taskletname, \ - rt2x00dev->ops->lib->taskletname, \ - (unsigned long)rt2x00dev); \ - } - - RT2X00_TASKLET_INIT(txstatus_tasklet); - RT2X00_TASKLET_INIT(pretbtt_tasklet); - RT2X00_TASKLET_INIT(tbtt_tasklet); - RT2X00_TASKLET_INIT(rxdone_tasklet); - RT2X00_TASKLET_INIT(autowake_tasklet); - -#undef RT2X00_TASKLET_INIT - - /* - * Register HW. - */ - status = ieee80211_register_hw(rt2x00dev->hw); - if (status) - return status; - - set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags); - - return 0; -} - -/* - * Initialization/uninitialization handlers. - */ -static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) -{ - if (!test_and_clear_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags)) - return; - - /* - * Unregister extra components. - */ - rt2x00rfkill_unregister(rt2x00dev); - - /* - * Allow the HW to uninitialize. - */ - rt2x00dev->ops->lib->uninitialize(rt2x00dev); - - /* - * Free allocated queue entries. - */ - rt2x00queue_uninitialize(rt2x00dev); -} - -static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) -{ - int status; - - if (test_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags)) - return 0; - - /* - * Allocate all queue entries. - */ - status = rt2x00queue_initialize(rt2x00dev); - if (status) - return status; - - /* - * Initialize the device. - */ - status = rt2x00dev->ops->lib->initialize(rt2x00dev); - if (status) { - rt2x00queue_uninitialize(rt2x00dev); - return status; - } - - set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); - - return 0; -} - -int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) -{ - int retval; - - if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) - return 0; - - /* - * If this is the first interface which is added, - * we should load the firmware now. - */ - retval = rt2x00lib_load_firmware(rt2x00dev); - if (retval) - return retval; - - /* - * Initialize the device. - */ - retval = rt2x00lib_initialize(rt2x00dev); - if (retval) - return retval; - - rt2x00dev->intf_ap_count = 0; - rt2x00dev->intf_sta_count = 0; - rt2x00dev->intf_associated = 0; - - /* Enable the radio */ - retval = rt2x00lib_enable_radio(rt2x00dev); - if (retval) - return retval; - - set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags); - - return 0; -} - -void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev) -{ - if (!test_and_clear_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) - return; - - /* - * Perhaps we can add something smarter here, - * but for now just disabling the radio should do. - */ - rt2x00lib_disable_radio(rt2x00dev); - - rt2x00dev->intf_ap_count = 0; - rt2x00dev->intf_sta_count = 0; - rt2x00dev->intf_associated = 0; -} - -static inline void rt2x00lib_set_if_combinations(struct rt2x00_dev *rt2x00dev) -{ - struct ieee80211_iface_limit *if_limit; - struct ieee80211_iface_combination *if_combination; - - if (rt2x00dev->ops->max_ap_intf < 2) - return; - - /* - * Build up AP interface limits structure. - */ - if_limit = &rt2x00dev->if_limits_ap; - if_limit->max = rt2x00dev->ops->max_ap_intf; - if_limit->types = BIT(NL80211_IFTYPE_AP); -#ifdef CONFIG_MAC80211_MESH - if_limit->types |= BIT(NL80211_IFTYPE_MESH_POINT); -#endif - - /* - * Build up AP interface combinations structure. - */ - if_combination = &rt2x00dev->if_combinations[IF_COMB_AP]; - if_combination->limits = if_limit; - if_combination->n_limits = 1; - if_combination->max_interfaces = if_limit->max; - if_combination->num_different_channels = 1; - - /* - * Finally, specify the possible combinations to mac80211. - */ - rt2x00dev->hw->wiphy->iface_combinations = rt2x00dev->if_combinations; - rt2x00dev->hw->wiphy->n_iface_combinations = 1; -} - -/* - * driver allocation handlers. - */ -int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) -{ - int retval = -ENOMEM; - - /* - * Set possible interface combinations. - */ - rt2x00lib_set_if_combinations(rt2x00dev); - - /* - * Allocate the driver data memory, if necessary. - */ - if (rt2x00dev->ops->drv_data_size > 0) { - rt2x00dev->drv_data = kzalloc(rt2x00dev->ops->drv_data_size, - GFP_KERNEL); - if (!rt2x00dev->drv_data) { - retval = -ENOMEM; - goto exit; - } - } - - spin_lock_init(&rt2x00dev->irqmask_lock); - mutex_init(&rt2x00dev->csr_mutex); - INIT_LIST_HEAD(&rt2x00dev->bar_list); - spin_lock_init(&rt2x00dev->bar_list_lock); - - set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); - - /* - * Make room for rt2x00_intf inside the per-interface - * structure ieee80211_vif. - */ - rt2x00dev->hw->vif_data_size = sizeof(struct rt2x00_intf); - - /* - * rt2x00 devices can only use the last n bits of the MAC address - * for virtual interfaces. - */ - rt2x00dev->hw->wiphy->addr_mask[ETH_ALEN - 1] = - (rt2x00dev->ops->max_ap_intf - 1); - - /* - * Determine which operating modes are supported, all modes - * which require beaconing, depend on the availability of - * beacon entries. - */ - rt2x00dev->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); - if (rt2x00dev->ops->bcn->entry_num > 0) - rt2x00dev->hw->wiphy->interface_modes |= - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_AP) | -#ifdef CONFIG_MAC80211_MESH - BIT(NL80211_IFTYPE_MESH_POINT) | -#endif - BIT(NL80211_IFTYPE_WDS); - - rt2x00dev->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; - - /* - * Initialize work. - */ - rt2x00dev->workqueue = - alloc_ordered_workqueue(wiphy_name(rt2x00dev->hw->wiphy), 0); - if (!rt2x00dev->workqueue) { - retval = -ENOMEM; - goto exit; - } - - INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled); - INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup); - INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep); - - /* - * Let the driver probe the device to detect the capabilities. - */ - retval = rt2x00dev->ops->lib->probe_hw(rt2x00dev); - if (retval) { - rt2x00_err(rt2x00dev, "Failed to allocate device\n"); - goto exit; - } - - /* - * Allocate queue array. - */ - retval = rt2x00queue_allocate(rt2x00dev); - if (retval) - goto exit; - - /* - * Initialize ieee80211 structure. - */ - retval = rt2x00lib_probe_hw(rt2x00dev); - if (retval) { - rt2x00_err(rt2x00dev, "Failed to initialize hw\n"); - goto exit; - } - - /* - * Register extra components. - */ - rt2x00link_register(rt2x00dev); - rt2x00leds_register(rt2x00dev); - rt2x00debug_register(rt2x00dev); - rt2x00rfkill_register(rt2x00dev); - - return 0; - -exit: - rt2x00lib_remove_dev(rt2x00dev); - - return retval; -} -EXPORT_SYMBOL_GPL(rt2x00lib_probe_dev); - -void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) -{ - clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); - - /* - * Disable radio. - */ - rt2x00lib_disable_radio(rt2x00dev); - - /* - * Stop all work. - */ - cancel_work_sync(&rt2x00dev->intf_work); - cancel_delayed_work_sync(&rt2x00dev->autowakeup_work); - cancel_work_sync(&rt2x00dev->sleep_work); - if (rt2x00_is_usb(rt2x00dev)) { - hrtimer_cancel(&rt2x00dev->txstatus_timer); - cancel_work_sync(&rt2x00dev->rxdone_work); - cancel_work_sync(&rt2x00dev->txdone_work); - } - if (rt2x00dev->workqueue) - destroy_workqueue(rt2x00dev->workqueue); - - /* - * Free the tx status fifo. - */ - kfifo_free(&rt2x00dev->txstatus_fifo); - - /* - * Kill the tx status tasklet. - */ - tasklet_kill(&rt2x00dev->txstatus_tasklet); - tasklet_kill(&rt2x00dev->pretbtt_tasklet); - tasklet_kill(&rt2x00dev->tbtt_tasklet); - tasklet_kill(&rt2x00dev->rxdone_tasklet); - tasklet_kill(&rt2x00dev->autowake_tasklet); - - /* - * Uninitialize device. - */ - rt2x00lib_uninitialize(rt2x00dev); - - /* - * Free extra components - */ - rt2x00debug_deregister(rt2x00dev); - rt2x00leds_unregister(rt2x00dev); - - /* - * Free ieee80211_hw memory. - */ - rt2x00lib_remove_hw(rt2x00dev); - - /* - * Free firmware image. - */ - rt2x00lib_free_firmware(rt2x00dev); - - /* - * Free queue structures. - */ - rt2x00queue_free(rt2x00dev); - - /* - * Free the driver data. - */ - if (rt2x00dev->drv_data) - kfree(rt2x00dev->drv_data); -} -EXPORT_SYMBOL_GPL(rt2x00lib_remove_dev); - -/* - * Device state handlers - */ -#ifdef CONFIG_PM -int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state) -{ - rt2x00_dbg(rt2x00dev, "Going to sleep\n"); - - /* - * Prevent mac80211 from accessing driver while suspended. - */ - if (!test_and_clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - return 0; - - /* - * Cleanup as much as possible. - */ - rt2x00lib_uninitialize(rt2x00dev); - - /* - * Suspend/disable extra components. - */ - rt2x00leds_suspend(rt2x00dev); - rt2x00debug_deregister(rt2x00dev); - - /* - * Set device mode to sleep for power management, - * on some hardware this call seems to consistently fail. - * From the specifications it is hard to tell why it fails, - * and if this is a "bad thing". - * Overall it is safe to just ignore the failure and - * continue suspending. The only downside is that the - * device will not be in optimal power save mode, but with - * the radio and the other components already disabled the - * device is as good as disabled. - */ - if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_SLEEP)) - rt2x00_warn(rt2x00dev, "Device failed to enter sleep state, continue suspending\n"); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2x00lib_suspend); - -int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) -{ - rt2x00_dbg(rt2x00dev, "Waking up\n"); - - /* - * Restore/enable extra components. - */ - rt2x00debug_register(rt2x00dev); - rt2x00leds_resume(rt2x00dev); - - /* - * We are ready again to receive requests from mac80211. - */ - set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2x00lib_resume); -#endif /* CONFIG_PM */ - -/* - * rt2x00lib module information. - */ -MODULE_AUTHOR(DRV_PROJECT); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION("rt2x00 library"); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/rt2x00/rt2x00dump.h b/drivers/net/wireless/rt2x00/rt2x00dump.h deleted file mode 100644 index 063ebcce97f8..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00dump.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00dump - Abstract: - Data structures for the rt2x00debug & userspace. - - The declarations in this file can be used by both rt2x00 - and userspace and therefore should be kept together in - this file. - */ - -#ifndef RT2X00DUMP_H -#define RT2X00DUMP_H - -/** - * DOC: Introduction - * - * This header is intended to be exported to userspace, - * to make the structures and enumerations available to userspace - * applications. This means that all data types should be exportable. - * - * When rt2x00 is compiled with debugfs support enabled, - * it is possible to capture all data coming in and out of the device - * by reading the frame dump file. This file can have only a single reader. - * The following frames will be reported: - * - All incoming frames (rx) - * - All outgoing frames (tx, including beacon and atim) - * - All completed frames (txdone including atim) - * - * The data is send to the file using the following format: - * - * [rt2x00dump header][hardware descriptor][ieee802.11 frame] - * - * rt2x00dump header: The description of the dumped frame, as well as - * additional information useful for debugging. See &rt2x00dump_hdr. - * hardware descriptor: Descriptor that was used to receive or transmit - * the frame. - * ieee802.11 frame: The actual frame that was received or transmitted. - */ - -/** - * enum rt2x00_dump_type - Frame type - * - * These values are used for the @type member of &rt2x00dump_hdr. - * @DUMP_FRAME_RXDONE: This frame has been received by the hardware. - * @DUMP_FRAME_TX: This frame is queued for transmission to the hardware. - * @DUMP_FRAME_TXDONE: This frame indicates the device has handled - * the tx event which has either succeeded or failed. A frame - * with this type should also have been reported with as a - * %DUMP_FRAME_TX frame. - * @DUMP_FRAME_BEACON: This beacon frame is queued for transmission to the - * hardware. - */ -enum rt2x00_dump_type { - DUMP_FRAME_RXDONE = 1, - DUMP_FRAME_TX = 2, - DUMP_FRAME_TXDONE = 3, - DUMP_FRAME_BEACON = 4, -}; - -/** - * struct rt2x00dump_hdr - Dump frame header - * - * Each frame dumped to the debugfs file starts with this header - * attached. This header contains the description of the actual - * frame which was dumped. - * - * New fields inside the structure must be appended to the end of - * the structure. This way userspace tools compiled for earlier - * header versions can still correctly handle the frame dump - * (although they will not handle all data passed to them in the dump). - * - * @version: Header version should always be set to %DUMP_HEADER_VERSION. - * This field must be checked by userspace to determine if it can - * handle this frame. - * @header_length: The length of the &rt2x00dump_hdr structure. This is - * used for compatibility reasons so userspace can easily determine - * the location of the next field in the dump. - * @desc_length: The length of the device descriptor. - * @data_length: The length of the frame data (including the ieee802.11 header. - * @chip_rt: RT chipset - * @chip_rf: RF chipset - * @chip_rev: Chipset revision - * @type: The frame type (&rt2x00_dump_type) - * @queue_index: The index number of the data queue. - * @entry_index: The index number of the entry inside the data queue. - * @timestamp_sec: Timestamp - seconds - * @timestamp_usec: Timestamp - microseconds - */ -struct rt2x00dump_hdr { - __le32 version; -#define DUMP_HEADER_VERSION 2 - - __le32 header_length; - __le32 desc_length; - __le32 data_length; - - __le16 chip_rt; - __le16 chip_rf; - __le16 chip_rev; - - __le16 type; - __u8 queue_index; - __u8 entry_index; - - __le32 timestamp_sec; - __le32 timestamp_usec; -}; - -#endif /* RT2X00DUMP_H */ diff --git a/drivers/net/wireless/rt2x00/rt2x00firmware.c b/drivers/net/wireless/rt2x00/rt2x00firmware.c deleted file mode 100644 index 1b4254b4272d..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00firmware.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - Copyright (C) 2004 - 2009 Gertjan van Wingerde - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00lib - Abstract: rt2x00 firmware loading routines. - */ - -#include -#include - -#include "rt2x00.h" -#include "rt2x00lib.h" - -static int rt2x00lib_request_firmware(struct rt2x00_dev *rt2x00dev) -{ - struct device *device = wiphy_dev(rt2x00dev->hw->wiphy); - const struct firmware *fw; - char *fw_name; - int retval; - - /* - * Read correct firmware from harddisk. - */ - fw_name = rt2x00dev->ops->lib->get_firmware_name(rt2x00dev); - if (!fw_name) { - rt2x00_err(rt2x00dev, - "Invalid firmware filename\n" - "Please file bug report to %s\n", DRV_PROJECT); - return -EINVAL; - } - - rt2x00_info(rt2x00dev, "Loading firmware file '%s'\n", fw_name); - - retval = request_firmware(&fw, fw_name, device); - if (retval) { - rt2x00_err(rt2x00dev, "Failed to request Firmware\n"); - return retval; - } - - if (!fw || !fw->size || !fw->data) { - rt2x00_err(rt2x00dev, "Failed to read Firmware\n"); - release_firmware(fw); - return -ENOENT; - } - - rt2x00_info(rt2x00dev, "Firmware detected - version: %d.%d\n", - fw->data[fw->size - 4], fw->data[fw->size - 3]); - snprintf(rt2x00dev->hw->wiphy->fw_version, - sizeof(rt2x00dev->hw->wiphy->fw_version), "%d.%d", - fw->data[fw->size - 4], fw->data[fw->size - 3]); - - retval = rt2x00dev->ops->lib->check_firmware(rt2x00dev, fw->data, fw->size); - switch (retval) { - case FW_OK: - break; - case FW_BAD_CRC: - rt2x00_err(rt2x00dev, "Firmware checksum error\n"); - goto exit; - case FW_BAD_LENGTH: - rt2x00_err(rt2x00dev, "Invalid firmware file length (len=%zu)\n", - fw->size); - goto exit; - case FW_BAD_VERSION: - rt2x00_err(rt2x00dev, "Current firmware does not support detected chipset\n"); - goto exit; - } - - rt2x00dev->fw = fw; - - return 0; - -exit: - release_firmware(fw); - - return -ENOENT; -} - -int rt2x00lib_load_firmware(struct rt2x00_dev *rt2x00dev) -{ - int retval; - - if (!test_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags)) - return 0; - - if (!rt2x00dev->fw) { - retval = rt2x00lib_request_firmware(rt2x00dev); - if (retval) - return retval; - } - - /* - * Send firmware to the device. - */ - retval = rt2x00dev->ops->lib->load_firmware(rt2x00dev, - rt2x00dev->fw->data, - rt2x00dev->fw->size); - - /* - * When the firmware is uploaded to the hardware the LED - * association status might have been triggered, for correct - * LED handling it should now be reset. - */ - rt2x00leds_led_assoc(rt2x00dev, false); - - return retval; -} - -void rt2x00lib_free_firmware(struct rt2x00_dev *rt2x00dev) -{ - release_firmware(rt2x00dev->fw); - rt2x00dev->fw = NULL; -} diff --git a/drivers/net/wireless/rt2x00/rt2x00leds.c b/drivers/net/wireless/rt2x00/rt2x00leds.c deleted file mode 100644 index 997a6c89e66e..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00leds.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00lib - Abstract: rt2x00 led specific routines. - */ - -#include -#include - -#include "rt2x00.h" -#include "rt2x00lib.h" - -void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi) -{ - struct rt2x00_led *led = &rt2x00dev->led_qual; - unsigned int brightness; - - if ((led->type != LED_TYPE_QUALITY) || !(led->flags & LED_REGISTERED)) - return; - - /* - * Led handling requires a positive value for the rssi, - * to do that correctly we need to add the correction. - */ - rssi += rt2x00dev->rssi_offset; - - /* - * Get the rssi level, this is used to convert the rssi - * to a LED value inside the range LED_OFF - LED_FULL. - */ - if (rssi <= 30) - rssi = 0; - else if (rssi <= 39) - rssi = 1; - else if (rssi <= 49) - rssi = 2; - else if (rssi <= 53) - rssi = 3; - else if (rssi <= 63) - rssi = 4; - else - rssi = 5; - - /* - * Note that we must _not_ send LED_OFF since the driver - * is going to calculate the value and might use it in a - * division. - */ - brightness = ((LED_FULL / 6) * rssi) + 1; - if (brightness != led->led_dev.brightness) { - led->led_dev.brightness_set(&led->led_dev, brightness); - led->led_dev.brightness = brightness; - } -} - -static void rt2x00led_led_simple(struct rt2x00_led *led, bool enabled) -{ - unsigned int brightness = enabled ? LED_FULL : LED_OFF; - - if (!(led->flags & LED_REGISTERED)) - return; - - led->led_dev.brightness_set(&led->led_dev, brightness); - led->led_dev.brightness = brightness; -} - -void rt2x00led_led_activity(struct rt2x00_dev *rt2x00dev, bool enabled) -{ - if (rt2x00dev->led_qual.type == LED_TYPE_ACTIVITY) - rt2x00led_led_simple(&rt2x00dev->led_qual, enabled); -} - -void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev, bool enabled) -{ - if (rt2x00dev->led_assoc.type == LED_TYPE_ASSOC) - rt2x00led_led_simple(&rt2x00dev->led_assoc, enabled); -} - -void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, bool enabled) -{ - if (rt2x00dev->led_radio.type == LED_TYPE_RADIO) - rt2x00led_led_simple(&rt2x00dev->led_radio, enabled); -} - -static int rt2x00leds_register_led(struct rt2x00_dev *rt2x00dev, - struct rt2x00_led *led, - const char *name) -{ - struct device *device = wiphy_dev(rt2x00dev->hw->wiphy); - int retval; - - led->led_dev.name = name; - led->led_dev.brightness = LED_OFF; - - retval = led_classdev_register(device, &led->led_dev); - if (retval) { - rt2x00_err(rt2x00dev, "Failed to register led handler\n"); - return retval; - } - - led->flags |= LED_REGISTERED; - - return 0; -} - -void rt2x00leds_register(struct rt2x00_dev *rt2x00dev) -{ - char name[36]; - int retval; - unsigned long on_period; - unsigned long off_period; - const char *phy_name = wiphy_name(rt2x00dev->hw->wiphy); - - if (rt2x00dev->led_radio.flags & LED_INITIALIZED) { - snprintf(name, sizeof(name), "%s-%s::radio", - rt2x00dev->ops->name, phy_name); - - retval = rt2x00leds_register_led(rt2x00dev, - &rt2x00dev->led_radio, - name); - if (retval) - goto exit_fail; - } - - if (rt2x00dev->led_assoc.flags & LED_INITIALIZED) { - snprintf(name, sizeof(name), "%s-%s::assoc", - rt2x00dev->ops->name, phy_name); - - retval = rt2x00leds_register_led(rt2x00dev, - &rt2x00dev->led_assoc, - name); - if (retval) - goto exit_fail; - } - - if (rt2x00dev->led_qual.flags & LED_INITIALIZED) { - snprintf(name, sizeof(name), "%s-%s::quality", - rt2x00dev->ops->name, phy_name); - - retval = rt2x00leds_register_led(rt2x00dev, - &rt2x00dev->led_qual, - name); - if (retval) - goto exit_fail; - } - - /* - * Initialize blink time to default value: - * On period: 70ms - * Off period: 30ms - */ - if (rt2x00dev->led_radio.led_dev.blink_set) { - on_period = 70; - off_period = 30; - rt2x00dev->led_radio.led_dev.blink_set( - &rt2x00dev->led_radio.led_dev, &on_period, &off_period); - } - - return; - -exit_fail: - rt2x00leds_unregister(rt2x00dev); -} - -static void rt2x00leds_unregister_led(struct rt2x00_led *led) -{ - led_classdev_unregister(&led->led_dev); - - /* - * This might look weird, but when we are unregistering while - * suspended the led is already off, and since we haven't - * fully resumed yet, access to the device might not be - * possible yet. - */ - if (!(led->led_dev.flags & LED_SUSPENDED)) - led->led_dev.brightness_set(&led->led_dev, LED_OFF); - - led->flags &= ~LED_REGISTERED; -} - -void rt2x00leds_unregister(struct rt2x00_dev *rt2x00dev) -{ - if (rt2x00dev->led_qual.flags & LED_REGISTERED) - rt2x00leds_unregister_led(&rt2x00dev->led_qual); - if (rt2x00dev->led_assoc.flags & LED_REGISTERED) - rt2x00leds_unregister_led(&rt2x00dev->led_assoc); - if (rt2x00dev->led_radio.flags & LED_REGISTERED) - rt2x00leds_unregister_led(&rt2x00dev->led_radio); -} - -static inline void rt2x00leds_suspend_led(struct rt2x00_led *led) -{ - led_classdev_suspend(&led->led_dev); - - /* This shouldn't be needed, but just to be safe */ - led->led_dev.brightness_set(&led->led_dev, LED_OFF); - led->led_dev.brightness = LED_OFF; -} - -void rt2x00leds_suspend(struct rt2x00_dev *rt2x00dev) -{ - if (rt2x00dev->led_qual.flags & LED_REGISTERED) - rt2x00leds_suspend_led(&rt2x00dev->led_qual); - if (rt2x00dev->led_assoc.flags & LED_REGISTERED) - rt2x00leds_suspend_led(&rt2x00dev->led_assoc); - if (rt2x00dev->led_radio.flags & LED_REGISTERED) - rt2x00leds_suspend_led(&rt2x00dev->led_radio); -} - -static inline void rt2x00leds_resume_led(struct rt2x00_led *led) -{ - led_classdev_resume(&led->led_dev); - - /* Device might have enabled the LEDS during resume */ - led->led_dev.brightness_set(&led->led_dev, LED_OFF); - led->led_dev.brightness = LED_OFF; -} - -void rt2x00leds_resume(struct rt2x00_dev *rt2x00dev) -{ - if (rt2x00dev->led_radio.flags & LED_REGISTERED) - rt2x00leds_resume_led(&rt2x00dev->led_radio); - if (rt2x00dev->led_assoc.flags & LED_REGISTERED) - rt2x00leds_resume_led(&rt2x00dev->led_assoc); - if (rt2x00dev->led_qual.flags & LED_REGISTERED) - rt2x00leds_resume_led(&rt2x00dev->led_qual); -} diff --git a/drivers/net/wireless/rt2x00/rt2x00leds.h b/drivers/net/wireless/rt2x00/rt2x00leds.h deleted file mode 100644 index 3b46f0c3332a..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00leds.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00lib - Abstract: rt2x00 led datastructures and routines - */ - -#ifndef RT2X00LEDS_H -#define RT2X00LEDS_H - -enum led_type { - LED_TYPE_RADIO, - LED_TYPE_ASSOC, - LED_TYPE_ACTIVITY, - LED_TYPE_QUALITY, -}; - -struct rt2x00_led { - struct rt2x00_dev *rt2x00dev; - struct led_classdev led_dev; - - enum led_type type; - unsigned int flags; -#define LED_INITIALIZED ( 1 << 0 ) -#define LED_REGISTERED ( 1 << 1 ) -}; - -#endif /* RT2X00LEDS_H */ diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h deleted file mode 100644 index 7f40ab8e1bd8..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ /dev/null @@ -1,470 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - Copyright (C) 2004 - 2009 Gertjan van Wingerde - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00lib - Abstract: Data structures and definitions for the rt2x00lib module. - */ - -#ifndef RT2X00LIB_H -#define RT2X00LIB_H - -/* - * Interval defines - */ -#define WATCHDOG_INTERVAL round_jiffies_relative(HZ) -#define LINK_TUNE_INTERVAL round_jiffies_relative(HZ) -#define AGC_INTERVAL round_jiffies_relative(4 * HZ) -#define VCO_INTERVAL round_jiffies_relative(10 * HZ) /* 10 sec */ - -/* - * rt2x00_rate: Per rate device information - */ -struct rt2x00_rate { - unsigned short flags; -#define DEV_RATE_CCK 0x0001 -#define DEV_RATE_OFDM 0x0002 -#define DEV_RATE_SHORT_PREAMBLE 0x0004 - - unsigned short bitrate; /* In 100kbit/s */ - unsigned short ratemask; - - unsigned short plcp; - unsigned short mcs; -}; - -extern const struct rt2x00_rate rt2x00_supported_rates[12]; - -static inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value) -{ - return &rt2x00_supported_rates[hw_value & 0xff]; -} - -#define RATE_MCS(__mode, __mcs) \ - ((((__mode) & 0x00ff) << 8) | ((__mcs) & 0x00ff)) - -static inline int rt2x00_get_rate_mcs(const u16 mcs_value) -{ - return (mcs_value & 0x00ff); -} - -/* - * Radio control handlers. - */ -int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev); -void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev); - -/* - * Initialization handlers. - */ -int rt2x00lib_start(struct rt2x00_dev *rt2x00dev); -void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev); - -/* - * Configuration handlers. - */ -void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev, - struct rt2x00_intf *intf, - enum nl80211_iftype type, - const u8 *mac, const u8 *bssid); -void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev, - struct rt2x00_intf *intf, - struct ieee80211_bss_conf *conf, - u32 changed); -void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, - struct antenna_setup ant); -void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, - struct ieee80211_conf *conf, - const unsigned int changed_flags); - -/** - * DOC: Queue handlers - */ - -/** - * rt2x00queue_alloc_rxskb - allocate a skb for RX purposes. - * @entry: The entry for which the skb will be applicable. - */ -struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry, gfp_t gfp); - -/** - * rt2x00queue_free_skb - free a skb - * @entry: The entry for which the skb will be applicable. - */ -void rt2x00queue_free_skb(struct queue_entry *entry); - -/** - * rt2x00queue_align_frame - Align 802.11 frame to 4-byte boundary - * @skb: The skb to align - * - * Align the start of the 802.11 frame to a 4-byte boundary, this could - * mean the payload is not aligned properly though. - */ -void rt2x00queue_align_frame(struct sk_buff *skb); - -/** - * rt2x00queue_insert_l2pad - Align 802.11 header & payload to 4-byte boundary - * @skb: The skb to align - * @header_length: Length of 802.11 header - * - * Apply L2 padding to align both header and payload to 4-byte boundary - */ -void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length); - -/** - * rt2x00queue_insert_l2pad - Remove L2 padding from 802.11 frame - * @skb: The skb to align - * @header_length: Length of 802.11 header - * - * Remove L2 padding used to align both header and payload to 4-byte boundary, - * by removing the L2 padding the header will no longer be 4-byte aligned. - */ -void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length); - -/** - * rt2x00queue_write_tx_frame - Write TX frame to hardware - * @queue: Queue over which the frame should be send - * @skb: The skb to send - * @local: frame is not from mac80211 - */ -int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, - struct ieee80211_sta *sta, bool local); - -/** - * rt2x00queue_update_beacon - Send new beacon from mac80211 - * to hardware. Handles locking by itself (mutex). - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * @vif: Interface for which the beacon should be updated. - */ -int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, - struct ieee80211_vif *vif); - -/** - * rt2x00queue_update_beacon_locked - Send new beacon from mac80211 - * to hardware. Caller needs to ensure locking. - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * @vif: Interface for which the beacon should be updated. - */ -int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev, - struct ieee80211_vif *vif); - -/** - * rt2x00queue_clear_beacon - Clear beacon in hardware - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * @vif: Interface for which the beacon should be updated. - */ -int rt2x00queue_clear_beacon(struct rt2x00_dev *rt2x00dev, - struct ieee80211_vif *vif); - -/** - * rt2x00queue_index_inc - Index incrementation function - * @entry: Queue entry (&struct queue_entry) to perform the action on. - * @index: Index type (&enum queue_index) to perform the action on. - * - * This function will increase the requested index on the entry's queue, - * it will grab the appropriate locks and handle queue overflow events by - * resetting the index to the start of the queue. - */ -void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index); - -/** - * rt2x00queue_init_queues - Initialize all data queues - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * - * This function will loop through all available queues to clear all - * index numbers and set the queue entry to the correct initialization - * state. - */ -void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev); - -int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev); -void rt2x00queue_uninitialize(struct rt2x00_dev *rt2x00dev); -int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev); -void rt2x00queue_free(struct rt2x00_dev *rt2x00dev); - -/** - * rt2x00link_update_stats - Update link statistics from RX frame - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * @skb: Received frame - * @rxdesc: Received frame descriptor - * - * Update link statistics based on the information from the - * received frame descriptor. - */ -void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb, - struct rxdone_entry_desc *rxdesc); - -/** - * rt2x00link_start_tuner - Start periodic link tuner work - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * - * This start the link tuner periodic work, this work will - * be executed periodically until &rt2x00link_stop_tuner has - * been called. - */ -void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev); - -/** - * rt2x00link_stop_tuner - Stop periodic link tuner work - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * - * After this function completed the link tuner will not - * be running until &rt2x00link_start_tuner is called. - */ -void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev); - -/** - * rt2x00link_reset_tuner - Reset periodic link tuner work - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * @antenna: Should the antenna tuning also be reset - * - * The VGC limit configured in the hardware will be reset to 0 - * which forces the driver to rediscover the correct value for - * the current association. This is needed when configuration - * options have changed which could drastically change the - * SNR level or link quality (i.e. changing the antenna setting). - * - * Resetting the link tuner will also cause the periodic work counter - * to be reset. Any driver which has a fixed limit on the number - * of rounds the link tuner is supposed to work will accept the - * tuner actions again if this limit was previously reached. - * - * If @antenna is set to true a the software antenna diversity - * tuning will also be reset. - */ -void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna); - -/** - * rt2x00link_start_watchdog - Start periodic watchdog monitoring - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * - * This start the watchdog periodic work, this work will - *be executed periodically until &rt2x00link_stop_watchdog has - * been called. - */ -void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev); - -/** - * rt2x00link_stop_watchdog - Stop periodic watchdog monitoring - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * - * After this function completed the watchdog monitoring will not - * be running until &rt2x00link_start_watchdog is called. - */ -void rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev); - -/** - * rt2x00link_start_agc - Start periodic gain calibration - * @rt2x00dev: Pointer to &struct rt2x00_dev. - */ -void rt2x00link_start_agc(struct rt2x00_dev *rt2x00dev); - -/** - * rt2x00link_start_vcocal - Start periodic VCO calibration - * @rt2x00dev: Pointer to &struct rt2x00_dev. - */ -void rt2x00link_start_vcocal(struct rt2x00_dev *rt2x00dev); - -/** - * rt2x00link_stop_agc - Stop periodic gain calibration - * @rt2x00dev: Pointer to &struct rt2x00_dev. - */ -void rt2x00link_stop_agc(struct rt2x00_dev *rt2x00dev); - -/** - * rt2x00link_stop_vcocal - Stop periodic VCO calibration - * @rt2x00dev: Pointer to &struct rt2x00_dev. - */ -void rt2x00link_stop_vcocal(struct rt2x00_dev *rt2x00dev); - -/** - * rt2x00link_register - Initialize link tuning & watchdog functionality - * @rt2x00dev: Pointer to &struct rt2x00_dev. - * - * Initialize work structure and all link tuning and watchdog related - * parameters. This will not start the periodic work itself. - */ -void rt2x00link_register(struct rt2x00_dev *rt2x00dev); - -/* - * Firmware handlers. - */ -#ifdef CONFIG_RT2X00_LIB_FIRMWARE -int rt2x00lib_load_firmware(struct rt2x00_dev *rt2x00dev); -void rt2x00lib_free_firmware(struct rt2x00_dev *rt2x00dev); -#else -static inline int rt2x00lib_load_firmware(struct rt2x00_dev *rt2x00dev) -{ - return 0; -} -static inline void rt2x00lib_free_firmware(struct rt2x00_dev *rt2x00dev) -{ -} -#endif /* CONFIG_RT2X00_LIB_FIRMWARE */ - -/* - * Debugfs handlers. - */ -#ifdef CONFIG_RT2X00_LIB_DEBUGFS -void rt2x00debug_register(struct rt2x00_dev *rt2x00dev); -void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev); -void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev, - struct rxdone_entry_desc *rxdesc); -#else -static inline void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) -{ -} - -static inline void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev) -{ -} - -static inline void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev, - struct rxdone_entry_desc *rxdesc) -{ -} -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ - -/* - * Crypto handlers. - */ -#ifdef CONFIG_RT2X00_LIB_CRYPTO -enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key); -void rt2x00crypto_create_tx_descriptor(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb, - struct txentry_desc *txdesc); -unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb); -void rt2x00crypto_tx_copy_iv(struct sk_buff *skb, - struct txentry_desc *txdesc); -void rt2x00crypto_tx_remove_iv(struct sk_buff *skb, - struct txentry_desc *txdesc); -void rt2x00crypto_tx_insert_iv(struct sk_buff *skb, unsigned int header_length); -void rt2x00crypto_rx_insert_iv(struct sk_buff *skb, - unsigned int header_length, - struct rxdone_entry_desc *rxdesc); -#else -static inline enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key) -{ - return CIPHER_NONE; -} - -static inline void rt2x00crypto_create_tx_descriptor(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb, - struct txentry_desc *txdesc) -{ -} - -static inline unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb) -{ - return 0; -} - -static inline void rt2x00crypto_tx_copy_iv(struct sk_buff *skb, - struct txentry_desc *txdesc) -{ -} - -static inline void rt2x00crypto_tx_remove_iv(struct sk_buff *skb, - struct txentry_desc *txdesc) -{ -} - -static inline void rt2x00crypto_tx_insert_iv(struct sk_buff *skb, - unsigned int header_length) -{ -} - -static inline void rt2x00crypto_rx_insert_iv(struct sk_buff *skb, - unsigned int header_length, - struct rxdone_entry_desc *rxdesc) -{ -} -#endif /* CONFIG_RT2X00_LIB_CRYPTO */ - -/* - * RFkill handlers. - */ -static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) -{ - if (test_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags)) - wiphy_rfkill_start_polling(rt2x00dev->hw->wiphy); -} - -static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) -{ - if (test_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags)) - wiphy_rfkill_stop_polling(rt2x00dev->hw->wiphy); -} - -/* - * LED handlers - */ -#ifdef CONFIG_RT2X00_LIB_LEDS -void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi); -void rt2x00led_led_activity(struct rt2x00_dev *rt2x00dev, bool enabled); -void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev, bool enabled); -void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, bool enabled); -void rt2x00leds_register(struct rt2x00_dev *rt2x00dev); -void rt2x00leds_unregister(struct rt2x00_dev *rt2x00dev); -void rt2x00leds_suspend(struct rt2x00_dev *rt2x00dev); -void rt2x00leds_resume(struct rt2x00_dev *rt2x00dev); -#else -static inline void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, - int rssi) -{ -} - -static inline void rt2x00led_led_activity(struct rt2x00_dev *rt2x00dev, - bool enabled) -{ -} - -static inline void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev, - bool enabled) -{ -} - -static inline void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, - bool enabled) -{ -} - -static inline void rt2x00leds_register(struct rt2x00_dev *rt2x00dev) -{ -} - -static inline void rt2x00leds_unregister(struct rt2x00_dev *rt2x00dev) -{ -} - -static inline void rt2x00leds_suspend(struct rt2x00_dev *rt2x00dev) -{ -} - -static inline void rt2x00leds_resume(struct rt2x00_dev *rt2x00dev) -{ -} -#endif /* CONFIG_RT2X00_LIB_LEDS */ - -#endif /* RT2X00LIB_H */ diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c deleted file mode 100644 index 8368aab86f28..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00link.c +++ /dev/null @@ -1,520 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00lib - Abstract: rt2x00 generic link tuning routines. - */ - -#include -#include - -#include "rt2x00.h" -#include "rt2x00lib.h" - -/* - * When we lack RSSI information return something less then -80 to - * tell the driver to tune the device to maximum sensitivity. - */ -#define DEFAULT_RSSI -128 - -/* - * Helper struct and macro to work with moving/walking averages. - * When adding a value to the average value the following calculation - * is needed: - * - * avg_rssi = ((avg_rssi * 7) + rssi) / 8; - * - * The advantage of this approach is that we only need 1 variable - * to store the average in (No need for a count and a total). - * But more importantly, normal average values will over time - * move less and less towards newly added values this results - * that with link tuning, the device can have a very good RSSI - * for a few minutes but when the device is moved away from the AP - * the average will not decrease fast enough to compensate. - * The walking average compensates this and will move towards - * the new values correctly allowing a effective link tuning, - * the speed of the average moving towards other values depends - * on the value for the number of samples. The higher the number - * of samples, the slower the average will move. - * We use two variables to keep track of the average value to - * compensate for the rounding errors. This can be a significant - * error (>5dBm) if the factor is too low. - */ -#define AVG_SAMPLES 8 -#define AVG_FACTOR 1000 -#define MOVING_AVERAGE(__avg, __val) \ -({ \ - struct avg_val __new; \ - __new.avg_weight = \ - (__avg).avg_weight ? \ - ((((__avg).avg_weight * ((AVG_SAMPLES) - 1)) + \ - ((__val) * (AVG_FACTOR))) / \ - (AVG_SAMPLES)) : \ - ((__val) * (AVG_FACTOR)); \ - __new.avg = __new.avg_weight / (AVG_FACTOR); \ - __new; \ -}) - -static int rt2x00link_antenna_get_link_rssi(struct rt2x00_dev *rt2x00dev) -{ - struct link_ant *ant = &rt2x00dev->link.ant; - - if (ant->rssi_ant.avg && rt2x00dev->link.qual.rx_success) - return ant->rssi_ant.avg; - return DEFAULT_RSSI; -} - -static int rt2x00link_antenna_get_rssi_history(struct rt2x00_dev *rt2x00dev) -{ - struct link_ant *ant = &rt2x00dev->link.ant; - - if (ant->rssi_history) - return ant->rssi_history; - return DEFAULT_RSSI; -} - -static void rt2x00link_antenna_update_rssi_history(struct rt2x00_dev *rt2x00dev, - int rssi) -{ - struct link_ant *ant = &rt2x00dev->link.ant; - ant->rssi_history = rssi; -} - -static void rt2x00link_antenna_reset(struct rt2x00_dev *rt2x00dev) -{ - rt2x00dev->link.ant.rssi_ant.avg = 0; - rt2x00dev->link.ant.rssi_ant.avg_weight = 0; -} - -static void rt2x00lib_antenna_diversity_sample(struct rt2x00_dev *rt2x00dev) -{ - struct link_ant *ant = &rt2x00dev->link.ant; - struct antenna_setup new_ant; - int other_antenna; - - int sample_current = rt2x00link_antenna_get_link_rssi(rt2x00dev); - int sample_other = rt2x00link_antenna_get_rssi_history(rt2x00dev); - - memcpy(&new_ant, &ant->active, sizeof(new_ant)); - - /* - * We are done sampling. Now we should evaluate the results. - */ - ant->flags &= ~ANTENNA_MODE_SAMPLE; - - /* - * During the last period we have sampled the RSSI - * from both antennas. It now is time to determine - * which antenna demonstrated the best performance. - * When we are already on the antenna with the best - * performance, just create a good starting point - * for the history and we are done. - */ - if (sample_current >= sample_other) { - rt2x00link_antenna_update_rssi_history(rt2x00dev, - sample_current); - return; - } - - other_antenna = (ant->active.rx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A; - - if (ant->flags & ANTENNA_RX_DIVERSITY) - new_ant.rx = other_antenna; - - if (ant->flags & ANTENNA_TX_DIVERSITY) - new_ant.tx = other_antenna; - - rt2x00lib_config_antenna(rt2x00dev, new_ant); -} - -static void rt2x00lib_antenna_diversity_eval(struct rt2x00_dev *rt2x00dev) -{ - struct link_ant *ant = &rt2x00dev->link.ant; - struct antenna_setup new_ant; - int rssi_curr; - int rssi_old; - - memcpy(&new_ant, &ant->active, sizeof(new_ant)); - - /* - * Get current RSSI value along with the historical value, - * after that update the history with the current value. - */ - rssi_curr = rt2x00link_antenna_get_link_rssi(rt2x00dev); - rssi_old = rt2x00link_antenna_get_rssi_history(rt2x00dev); - rt2x00link_antenna_update_rssi_history(rt2x00dev, rssi_curr); - - /* - * Legacy driver indicates that we should swap antenna's - * when the difference in RSSI is greater that 5. This - * also should be done when the RSSI was actually better - * then the previous sample. - * When the difference exceeds the threshold we should - * sample the rssi from the other antenna to make a valid - * comparison between the 2 antennas. - */ - if (abs(rssi_curr - rssi_old) < 5) - return; - - ant->flags |= ANTENNA_MODE_SAMPLE; - - if (ant->flags & ANTENNA_RX_DIVERSITY) - new_ant.rx = (new_ant.rx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A; - - if (ant->flags & ANTENNA_TX_DIVERSITY) - new_ant.tx = (new_ant.tx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A; - - rt2x00lib_config_antenna(rt2x00dev, new_ant); -} - -static bool rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev) -{ - struct link_ant *ant = &rt2x00dev->link.ant; - - /* - * Determine if software diversity is enabled for - * either the TX or RX antenna (or both). - */ - if (!(ant->flags & ANTENNA_RX_DIVERSITY) && - !(ant->flags & ANTENNA_TX_DIVERSITY)) { - ant->flags = 0; - return true; - } - - /* - * If we have only sampled the data over the last period - * we should now harvest the data. Otherwise just evaluate - * the data. The latter should only be performed once - * every 2 seconds. - */ - if (ant->flags & ANTENNA_MODE_SAMPLE) { - rt2x00lib_antenna_diversity_sample(rt2x00dev); - return true; - } else if (rt2x00dev->link.count & 1) { - rt2x00lib_antenna_diversity_eval(rt2x00dev); - return true; - } - - return false; -} - -void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb, - struct rxdone_entry_desc *rxdesc) -{ - struct link *link = &rt2x00dev->link; - struct link_qual *qual = &rt2x00dev->link.qual; - struct link_ant *ant = &rt2x00dev->link.ant; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - - /* - * No need to update the stats for !=STA interfaces - */ - if (!rt2x00dev->intf_sta_count) - return; - - /* - * Frame was received successfully since non-succesfull - * frames would have been dropped by the hardware. - */ - qual->rx_success++; - - /* - * We are only interested in quality statistics from - * beacons which came from the BSS which we are - * associated with. - */ - if (!ieee80211_is_beacon(hdr->frame_control) || - !(rxdesc->dev_flags & RXDONE_MY_BSS)) - return; - - /* - * Update global RSSI - */ - link->avg_rssi = MOVING_AVERAGE(link->avg_rssi, rxdesc->rssi); - - /* - * Update antenna RSSI - */ - ant->rssi_ant = MOVING_AVERAGE(ant->rssi_ant, rxdesc->rssi); -} - -void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev) -{ - struct link *link = &rt2x00dev->link; - - /* - * Link tuning should only be performed when - * an active sta interface exists. AP interfaces - * don't need link tuning and monitor mode interfaces - * should never have to work with link tuners. - */ - if (!rt2x00dev->intf_sta_count) - return; - - /** - * While scanning, link tuning is disabled. By default - * the most sensitive settings will be used to make sure - * that all beacons and probe responses will be received - * during the scan. - */ - if (test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) - return; - - rt2x00link_reset_tuner(rt2x00dev, false); - - if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - ieee80211_queue_delayed_work(rt2x00dev->hw, - &link->work, LINK_TUNE_INTERVAL); -} - -void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev) -{ - cancel_delayed_work_sync(&rt2x00dev->link.work); -} - -void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna) -{ - struct link_qual *qual = &rt2x00dev->link.qual; - u8 vgc_level = qual->vgc_level_reg; - - if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - return; - - /* - * Reset link information. - * Both the currently active vgc level as well as - * the link tuner counter should be reset. Resetting - * the counter is important for devices where the - * device should only perform link tuning during the - * first minute after being enabled. - */ - rt2x00dev->link.count = 0; - memset(qual, 0, sizeof(*qual)); - - /* - * Restore the VGC level as stored in the registers, - * the driver can use this to determine if the register - * must be updated during reset or not. - */ - qual->vgc_level_reg = vgc_level; - - /* - * Reset the link tuner. - */ - rt2x00dev->ops->lib->reset_tuner(rt2x00dev, qual); - - if (antenna) - rt2x00link_antenna_reset(rt2x00dev); -} - -static void rt2x00link_reset_qual(struct rt2x00_dev *rt2x00dev) -{ - struct link_qual *qual = &rt2x00dev->link.qual; - - qual->rx_success = 0; - qual->rx_failed = 0; - qual->tx_success = 0; - qual->tx_failed = 0; -} - -static void rt2x00link_tuner(struct work_struct *work) -{ - struct rt2x00_dev *rt2x00dev = - container_of(work, struct rt2x00_dev, link.work.work); - struct link *link = &rt2x00dev->link; - struct link_qual *qual = &rt2x00dev->link.qual; - - /* - * When the radio is shutting down we should - * immediately cease all link tuning. - */ - if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags) || - test_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags)) - return; - - /* - * Update statistics. - */ - rt2x00dev->ops->lib->link_stats(rt2x00dev, qual); - rt2x00dev->low_level_stats.dot11FCSErrorCount += qual->rx_failed; - - /* - * Update quality RSSI for link tuning, - * when we have received some frames and we managed to - * collect the RSSI data we could use this. Otherwise we - * must fallback to the default RSSI value. - */ - if (!link->avg_rssi.avg || !qual->rx_success) - qual->rssi = DEFAULT_RSSI; - else - qual->rssi = link->avg_rssi.avg; - - /* - * Check if link tuning is supported by the hardware, some hardware - * do not support link tuning at all, while other devices can disable - * the feature from the EEPROM. - */ - if (test_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags)) - rt2x00dev->ops->lib->link_tuner(rt2x00dev, qual, link->count); - - /* - * Send a signal to the led to update the led signal strength. - */ - rt2x00leds_led_quality(rt2x00dev, qual->rssi); - - /* - * Evaluate antenna setup, make this the last step when - * rt2x00lib_antenna_diversity made changes the quality - * statistics will be reset. - */ - if (rt2x00lib_antenna_diversity(rt2x00dev)) - rt2x00link_reset_qual(rt2x00dev); - - /* - * Increase tuner counter, and reschedule the next link tuner run. - */ - link->count++; - - if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - ieee80211_queue_delayed_work(rt2x00dev->hw, - &link->work, LINK_TUNE_INTERVAL); -} - -void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev) -{ - struct link *link = &rt2x00dev->link; - - if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && - rt2x00dev->ops->lib->watchdog) - ieee80211_queue_delayed_work(rt2x00dev->hw, - &link->watchdog_work, - WATCHDOG_INTERVAL); -} - -void rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev) -{ - cancel_delayed_work_sync(&rt2x00dev->link.watchdog_work); -} - -static void rt2x00link_watchdog(struct work_struct *work) -{ - struct rt2x00_dev *rt2x00dev = - container_of(work, struct rt2x00_dev, link.watchdog_work.work); - struct link *link = &rt2x00dev->link; - - /* - * When the radio is shutting down we should - * immediately cease the watchdog monitoring. - */ - if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - return; - - rt2x00dev->ops->lib->watchdog(rt2x00dev); - - if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - ieee80211_queue_delayed_work(rt2x00dev->hw, - &link->watchdog_work, - WATCHDOG_INTERVAL); -} - -void rt2x00link_start_agc(struct rt2x00_dev *rt2x00dev) -{ - struct link *link = &rt2x00dev->link; - - if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && - rt2x00dev->ops->lib->gain_calibration) - ieee80211_queue_delayed_work(rt2x00dev->hw, - &link->agc_work, - AGC_INTERVAL); -} - -void rt2x00link_start_vcocal(struct rt2x00_dev *rt2x00dev) -{ - struct link *link = &rt2x00dev->link; - - if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && - rt2x00dev->ops->lib->vco_calibration) - ieee80211_queue_delayed_work(rt2x00dev->hw, - &link->vco_work, - VCO_INTERVAL); -} - -void rt2x00link_stop_agc(struct rt2x00_dev *rt2x00dev) -{ - cancel_delayed_work_sync(&rt2x00dev->link.agc_work); -} - -void rt2x00link_stop_vcocal(struct rt2x00_dev *rt2x00dev) -{ - cancel_delayed_work_sync(&rt2x00dev->link.vco_work); -} - -static void rt2x00link_agc(struct work_struct *work) -{ - struct rt2x00_dev *rt2x00dev = - container_of(work, struct rt2x00_dev, link.agc_work.work); - struct link *link = &rt2x00dev->link; - - /* - * When the radio is shutting down we should - * immediately cease the watchdog monitoring. - */ - if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - return; - - rt2x00dev->ops->lib->gain_calibration(rt2x00dev); - - if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - ieee80211_queue_delayed_work(rt2x00dev->hw, - &link->agc_work, - AGC_INTERVAL); -} - -static void rt2x00link_vcocal(struct work_struct *work) -{ - struct rt2x00_dev *rt2x00dev = - container_of(work, struct rt2x00_dev, link.vco_work.work); - struct link *link = &rt2x00dev->link; - - /* - * When the radio is shutting down we should - * immediately cease the VCO calibration. - */ - if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - return; - - rt2x00dev->ops->lib->vco_calibration(rt2x00dev); - - if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - ieee80211_queue_delayed_work(rt2x00dev->hw, - &link->vco_work, - VCO_INTERVAL); -} - -void rt2x00link_register(struct rt2x00_dev *rt2x00dev) -{ - INIT_DELAYED_WORK(&rt2x00dev->link.agc_work, rt2x00link_agc); - if (test_bit(CAPABILITY_VCO_RECALIBRATION, &rt2x00dev->cap_flags)) - INIT_DELAYED_WORK(&rt2x00dev->link.vco_work, rt2x00link_vcocal); - INIT_DELAYED_WORK(&rt2x00dev->link.watchdog_work, rt2x00link_watchdog); - INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00link_tuner); -} diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c deleted file mode 100644 index f8cff1f0b6b7..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ /dev/null @@ -1,858 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00mac - Abstract: rt2x00 generic mac80211 routines. - */ - -#include -#include - -#include "rt2x00.h" -#include "rt2x00lib.h" - -static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev, - struct data_queue *queue, - struct sk_buff *frag_skb) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(frag_skb); - struct ieee80211_tx_info *rts_info; - struct sk_buff *skb; - unsigned int data_length; - int retval = 0; - - if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) - data_length = sizeof(struct ieee80211_cts); - else - data_length = sizeof(struct ieee80211_rts); - - skb = dev_alloc_skb(data_length + rt2x00dev->hw->extra_tx_headroom); - if (unlikely(!skb)) { - rt2x00_warn(rt2x00dev, "Failed to create RTS/CTS frame\n"); - return -ENOMEM; - } - - skb_reserve(skb, rt2x00dev->hw->extra_tx_headroom); - skb_put(skb, data_length); - - /* - * Copy TX information over from original frame to - * RTS/CTS frame. Note that we set the no encryption flag - * since we don't want this frame to be encrypted. - * RTS frames should be acked, while CTS-to-self frames - * should not. The ready for TX flag is cleared to prevent - * it being automatically send when the descriptor is - * written to the hardware. - */ - memcpy(skb->cb, frag_skb->cb, sizeof(skb->cb)); - rts_info = IEEE80211_SKB_CB(skb); - rts_info->control.rates[0].flags &= ~IEEE80211_TX_RC_USE_RTS_CTS; - rts_info->control.rates[0].flags &= ~IEEE80211_TX_RC_USE_CTS_PROTECT; - - if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) - rts_info->flags |= IEEE80211_TX_CTL_NO_ACK; - else - rts_info->flags &= ~IEEE80211_TX_CTL_NO_ACK; - - /* Disable hardware encryption */ - rts_info->control.hw_key = NULL; - - /* - * RTS/CTS frame should use the length of the frame plus any - * encryption overhead that will be added by the hardware. - */ - data_length += rt2x00crypto_tx_overhead(rt2x00dev, skb); - - if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) - ieee80211_ctstoself_get(rt2x00dev->hw, tx_info->control.vif, - frag_skb->data, data_length, tx_info, - (struct ieee80211_cts *)(skb->data)); - else - ieee80211_rts_get(rt2x00dev->hw, tx_info->control.vif, - frag_skb->data, data_length, tx_info, - (struct ieee80211_rts *)(skb->data)); - - retval = rt2x00queue_write_tx_frame(queue, skb, NULL, true); - if (retval) { - dev_kfree_skb_any(skb); - rt2x00_warn(rt2x00dev, "Failed to send RTS/CTS frame\n"); - } - - return retval; -} - -void rt2x00mac_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - enum data_queue_qid qid = skb_get_queue_mapping(skb); - struct data_queue *queue = NULL; - - /* - * Mac80211 might be calling this function while we are trying - * to remove the device or perhaps suspending it. - * Note that we can only stop the TX queues inside the TX path - * due to possible race conditions in mac80211. - */ - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - goto exit_free_skb; - - /* - * Use the ATIM queue if appropriate and present. - */ - if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM && - test_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags)) - qid = QID_ATIM; - - queue = rt2x00queue_get_tx_queue(rt2x00dev, qid); - if (unlikely(!queue)) { - rt2x00_err(rt2x00dev, - "Attempt to send packet over invalid queue %d\n" - "Please file bug report to %s\n", qid, DRV_PROJECT); - goto exit_free_skb; - } - - /* - * If CTS/RTS is required. create and queue that frame first. - * Make sure we have at least enough entries available to send - * this CTS/RTS frame as well as the data frame. - * Note that when the driver has set the set_rts_threshold() - * callback function it doesn't need software generation of - * either RTS or CTS-to-self frame and handles everything - * inside the hardware. - */ - if (!rt2x00dev->ops->hw->set_rts_threshold && - (tx_info->control.rates[0].flags & (IEEE80211_TX_RC_USE_RTS_CTS | - IEEE80211_TX_RC_USE_CTS_PROTECT))) { - if (rt2x00queue_available(queue) <= 1) - goto exit_fail; - - if (rt2x00mac_tx_rts_cts(rt2x00dev, queue, skb)) - goto exit_fail; - } - - if (unlikely(rt2x00queue_write_tx_frame(queue, skb, control->sta, false))) - goto exit_fail; - - /* - * Pausing queue has to be serialized with rt2x00lib_txdone(). Note - * we should not use spin_lock_bh variant as bottom halve was already - * disabled before ieee80211_xmit() call. - */ - spin_lock(&queue->tx_lock); - if (rt2x00queue_threshold(queue)) - rt2x00queue_pause_queue(queue); - spin_unlock(&queue->tx_lock); - - return; - - exit_fail: - spin_lock(&queue->tx_lock); - rt2x00queue_pause_queue(queue); - spin_unlock(&queue->tx_lock); - exit_free_skb: - ieee80211_free_txskb(hw, skb); -} -EXPORT_SYMBOL_GPL(rt2x00mac_tx); - -int rt2x00mac_start(struct ieee80211_hw *hw) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - return 0; - - return rt2x00lib_start(rt2x00dev); -} -EXPORT_SYMBOL_GPL(rt2x00mac_start); - -void rt2x00mac_stop(struct ieee80211_hw *hw) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - return; - - rt2x00lib_stop(rt2x00dev); -} -EXPORT_SYMBOL_GPL(rt2x00mac_stop); - -int rt2x00mac_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct rt2x00_intf *intf = vif_to_intf(vif); - struct data_queue *queue = rt2x00dev->bcn; - struct queue_entry *entry = NULL; - unsigned int i; - - /* - * Don't allow interfaces to be added - * the device has disappeared. - */ - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) || - !test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) - return -ENODEV; - - /* - * Loop through all beacon queues to find a free - * entry. Since there are as much beacon entries - * as the maximum interfaces, this search shouldn't - * fail. - */ - for (i = 0; i < queue->limit; i++) { - entry = &queue->entries[i]; - if (!test_and_set_bit(ENTRY_BCN_ASSIGNED, &entry->flags)) - break; - } - - if (unlikely(i == queue->limit)) - return -ENOBUFS; - - /* - * We are now absolutely sure the interface can be created, - * increase interface count and start initialization. - */ - - if (vif->type == NL80211_IFTYPE_AP) - rt2x00dev->intf_ap_count++; - else - rt2x00dev->intf_sta_count++; - - mutex_init(&intf->beacon_skb_mutex); - intf->beacon = entry; - - /* - * The MAC address must be configured after the device - * has been initialized. Otherwise the device can reset - * the MAC registers. - * The BSSID address must only be configured in AP mode, - * however we should not send an empty BSSID address for - * STA interfaces at this time, since this can cause - * invalid behavior in the device. - */ - rt2x00lib_config_intf(rt2x00dev, intf, vif->type, - vif->addr, NULL); - - /* - * Some filters depend on the current working mode. We can force - * an update during the next configure_filter() run by mac80211 by - * resetting the current packet_filter state. - */ - rt2x00dev->packet_filter = 0; - - return 0; -} -EXPORT_SYMBOL_GPL(rt2x00mac_add_interface); - -void rt2x00mac_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct rt2x00_intf *intf = vif_to_intf(vif); - - /* - * Don't allow interfaces to be remove while - * either the device has disappeared or when - * no interface is present. - */ - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) || - (vif->type == NL80211_IFTYPE_AP && !rt2x00dev->intf_ap_count) || - (vif->type != NL80211_IFTYPE_AP && !rt2x00dev->intf_sta_count)) - return; - - if (vif->type == NL80211_IFTYPE_AP) - rt2x00dev->intf_ap_count--; - else - rt2x00dev->intf_sta_count--; - - /* - * Release beacon entry so it is available for - * new interfaces again. - */ - clear_bit(ENTRY_BCN_ASSIGNED, &intf->beacon->flags); - - /* - * Make sure the bssid and mac address registers - * are cleared to prevent false ACKing of frames. - */ - rt2x00lib_config_intf(rt2x00dev, intf, - NL80211_IFTYPE_UNSPECIFIED, NULL, NULL); -} -EXPORT_SYMBOL_GPL(rt2x00mac_remove_interface); - -int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct ieee80211_conf *conf = &hw->conf; - - /* - * mac80211 might be calling this function while we are trying - * to remove the device or perhaps suspending it. - */ - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - return 0; - - /* - * Some configuration parameters (e.g. channel and antenna values) can - * only be set when the radio is enabled, but do require the RX to - * be off. During this period we should keep link tuning enabled, - * if for any reason the link tuner must be reset, this will be - * handled by rt2x00lib_config(). - */ - rt2x00queue_stop_queue(rt2x00dev->rx); - - /* - * When we've just turned on the radio, we want to reprogram - * everything to ensure a consistent state - */ - rt2x00lib_config(rt2x00dev, conf, changed); - - /* - * After the radio has been enabled we need to configure - * the antenna to the default settings. rt2x00lib_config_antenna() - * should determine if any action should be taken based on - * checking if diversity has been enabled or no antenna changes - * have been made since the last configuration change. - */ - rt2x00lib_config_antenna(rt2x00dev, rt2x00dev->default_ant); - - /* Turn RX back on */ - rt2x00queue_start_queue(rt2x00dev->rx); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2x00mac_config); - -void rt2x00mac_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - - /* - * Mask off any flags we are going to ignore - * from the total_flags field. - */ - *total_flags &= - FIF_ALLMULTI | - FIF_FCSFAIL | - FIF_PLCPFAIL | - FIF_CONTROL | - FIF_PSPOLL | - FIF_OTHER_BSS | - FIF_PROMISC_IN_BSS; - - /* - * Apply some rules to the filters: - * - Some filters imply different filters to be set. - * - Some things we can't filter out at all. - * - Multicast filter seems to kill broadcast traffic so never use it. - */ - *total_flags |= FIF_ALLMULTI; - if (*total_flags & FIF_OTHER_BSS || - *total_flags & FIF_PROMISC_IN_BSS) - *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; - - /* - * If the device has a single filter for all control frames, - * FIF_CONTROL and FIF_PSPOLL flags imply each other. - * And if the device has more than one filter for control frames - * of different types, but has no a separate filter for PS Poll frames, - * FIF_CONTROL flag implies FIF_PSPOLL. - */ - if (!test_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags)) { - if (*total_flags & FIF_CONTROL || *total_flags & FIF_PSPOLL) - *total_flags |= FIF_CONTROL | FIF_PSPOLL; - } - if (!test_bit(CAPABILITY_CONTROL_FILTER_PSPOLL, &rt2x00dev->cap_flags)) { - if (*total_flags & FIF_CONTROL) - *total_flags |= FIF_PSPOLL; - } - - /* - * Check if there is any work left for us. - */ - if (rt2x00dev->packet_filter == *total_flags) - return; - rt2x00dev->packet_filter = *total_flags; - - rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags); -} -EXPORT_SYMBOL_GPL(rt2x00mac_configure_filter); - -static void rt2x00mac_set_tim_iter(void *data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct rt2x00_intf *intf = vif_to_intf(vif); - - if (vif->type != NL80211_IFTYPE_AP && - vif->type != NL80211_IFTYPE_ADHOC && - vif->type != NL80211_IFTYPE_MESH_POINT && - vif->type != NL80211_IFTYPE_WDS) - return; - - set_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags); -} - -int rt2x00mac_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, - bool set) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - - if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - return 0; - - ieee80211_iterate_active_interfaces_atomic( - rt2x00dev->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - rt2x00mac_set_tim_iter, rt2x00dev); - - /* queue work to upodate the beacon template */ - ieee80211_queue_work(rt2x00dev->hw, &rt2x00dev->intf_work); - return 0; -} -EXPORT_SYMBOL_GPL(rt2x00mac_set_tim); - -#ifdef CONFIG_RT2X00_LIB_CRYPTO -static void memcpy_tkip(struct rt2x00lib_crypto *crypto, u8 *key, u8 key_len) -{ - if (key_len > NL80211_TKIP_DATA_OFFSET_ENCR_KEY) - memcpy(crypto->key, - &key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY], - sizeof(crypto->key)); - - if (key_len > NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY) - memcpy(crypto->tx_mic, - &key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY], - sizeof(crypto->tx_mic)); - - if (key_len > NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY) - memcpy(crypto->rx_mic, - &key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY], - sizeof(crypto->rx_mic)); -} - -int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - int (*set_key) (struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_crypto *crypto, - struct ieee80211_key_conf *key); - struct rt2x00lib_crypto crypto; - static const u8 bcast_addr[ETH_ALEN] = - { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, }; - struct rt2x00_sta *sta_priv = NULL; - - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - return 0; - - if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags)) - return -EOPNOTSUPP; - - /* - * To support IBSS RSN, don't program group keys in IBSS, the - * hardware will then not attempt to decrypt the frames. - */ - if (vif->type == NL80211_IFTYPE_ADHOC && - !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) - return -EOPNOTSUPP; - - if (key->keylen > 32) - return -ENOSPC; - - memset(&crypto, 0, sizeof(crypto)); - - crypto.bssidx = rt2x00lib_get_bssidx(rt2x00dev, vif); - crypto.cipher = rt2x00crypto_key_to_cipher(key); - if (crypto.cipher == CIPHER_NONE) - return -EOPNOTSUPP; - - crypto.cmd = cmd; - - if (sta) { - crypto.address = sta->addr; - sta_priv = sta_to_rt2x00_sta(sta); - crypto.wcid = sta_priv->wcid; - } else - crypto.address = bcast_addr; - - if (crypto.cipher == CIPHER_TKIP) - memcpy_tkip(&crypto, &key->key[0], key->keylen); - else - memcpy(crypto.key, &key->key[0], key->keylen); - /* - * Each BSS has a maximum of 4 shared keys. - * Shared key index values: - * 0) BSS0 key0 - * 1) BSS0 key1 - * ... - * 4) BSS1 key0 - * ... - * 8) BSS2 key0 - * ... - * Both pairwise as shared key indeces are determined by - * driver. This is required because the hardware requires - * keys to be assigned in correct order (When key 1 is - * provided but key 0 is not, then the key is not found - * by the hardware during RX). - */ - if (cmd == SET_KEY) - key->hw_key_idx = 0; - - if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) - set_key = rt2x00dev->ops->lib->config_pairwise_key; - else - set_key = rt2x00dev->ops->lib->config_shared_key; - - if (!set_key) - return -EOPNOTSUPP; - - return set_key(rt2x00dev, &crypto, key); -} -EXPORT_SYMBOL_GPL(rt2x00mac_set_key); -#endif /* CONFIG_RT2X00_LIB_CRYPTO */ - -int rt2x00mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct rt2x00_sta *sta_priv = sta_to_rt2x00_sta(sta); - - /* - * If there's no space left in the device table store - * -1 as wcid but tell mac80211 everything went ok. - */ - if (rt2x00dev->ops->lib->sta_add(rt2x00dev, vif, sta)) - sta_priv->wcid = -1; - - return 0; -} -EXPORT_SYMBOL_GPL(rt2x00mac_sta_add); - -int rt2x00mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct rt2x00_sta *sta_priv = sta_to_rt2x00_sta(sta); - - /* - * If we never sent the STA to the device no need to clean it up. - */ - if (sta_priv->wcid < 0) - return 0; - - return rt2x00dev->ops->lib->sta_remove(rt2x00dev, sta_priv->wcid); -} -EXPORT_SYMBOL_GPL(rt2x00mac_sta_remove); - -void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - set_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags); - rt2x00link_stop_tuner(rt2x00dev); -} -EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_start); - -void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - clear_bit(DEVICE_STATE_SCANNING, &rt2x00dev->flags); - rt2x00link_start_tuner(rt2x00dev); -} -EXPORT_SYMBOL_GPL(rt2x00mac_sw_scan_complete); - -int rt2x00mac_get_stats(struct ieee80211_hw *hw, - struct ieee80211_low_level_stats *stats) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - - /* - * The dot11ACKFailureCount, dot11RTSFailureCount and - * dot11RTSSuccessCount are updated in interrupt time. - * dot11FCSErrorCount is updated in the link tuner. - */ - memcpy(stats, &rt2x00dev->low_level_stats, sizeof(*stats)); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2x00mac_get_stats); - -void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changes) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct rt2x00_intf *intf = vif_to_intf(vif); - - /* - * mac80211 might be calling this function while we are trying - * to remove the device or perhaps suspending it. - */ - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - return; - - /* - * Update the BSSID. - */ - if (changes & BSS_CHANGED_BSSID) - rt2x00lib_config_intf(rt2x00dev, intf, vif->type, NULL, - bss_conf->bssid); - - /* - * Update the beacon. This is only required on USB devices. PCI - * devices fetch beacons periodically. - */ - if (changes & BSS_CHANGED_BEACON && rt2x00_is_usb(rt2x00dev)) - rt2x00queue_update_beacon(rt2x00dev, vif); - - /* - * Start/stop beaconing. - */ - if (changes & BSS_CHANGED_BEACON_ENABLED) { - if (!bss_conf->enable_beacon && intf->enable_beacon) { - rt2x00queue_clear_beacon(rt2x00dev, vif); - rt2x00dev->intf_beaconing--; - intf->enable_beacon = false; - - if (rt2x00dev->intf_beaconing == 0) { - /* - * Last beaconing interface disabled - * -> stop beacon queue. - */ - mutex_lock(&intf->beacon_skb_mutex); - rt2x00queue_stop_queue(rt2x00dev->bcn); - mutex_unlock(&intf->beacon_skb_mutex); - } - - - } else if (bss_conf->enable_beacon && !intf->enable_beacon) { - rt2x00dev->intf_beaconing++; - intf->enable_beacon = true; - - if (rt2x00dev->intf_beaconing == 1) { - /* - * First beaconing interface enabled - * -> start beacon queue. - */ - mutex_lock(&intf->beacon_skb_mutex); - rt2x00queue_start_queue(rt2x00dev->bcn); - mutex_unlock(&intf->beacon_skb_mutex); - } - } - } - - /* - * When the association status has changed we must reset the link - * tuner counter. This is because some drivers determine if they - * should perform link tuning based on the number of seconds - * while associated or not associated. - */ - if (changes & BSS_CHANGED_ASSOC) { - rt2x00dev->link.count = 0; - - if (bss_conf->assoc) - rt2x00dev->intf_associated++; - else - rt2x00dev->intf_associated--; - - rt2x00leds_led_assoc(rt2x00dev, !!rt2x00dev->intf_associated); - - clear_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags); - } - - /* - * Check for access point which do not support 802.11e . We have to - * generate data frames sequence number in S/W for such AP, because - * of H/W bug. - */ - if (changes & BSS_CHANGED_QOS && !bss_conf->qos) - set_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags); - - /* - * When the erp information has changed, we should perform - * additional configuration steps. For all other changes we are done. - */ - if (changes & (BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_ERP_PREAMBLE | - BSS_CHANGED_ERP_SLOT | BSS_CHANGED_BASIC_RATES | - BSS_CHANGED_BEACON_INT | BSS_CHANGED_HT)) - rt2x00lib_config_erp(rt2x00dev, intf, bss_conf, changes); -} -EXPORT_SYMBOL_GPL(rt2x00mac_bss_info_changed); - -int rt2x00mac_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue_idx, - const struct ieee80211_tx_queue_params *params) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct data_queue *queue; - - queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx); - if (unlikely(!queue)) - return -EINVAL; - - /* - * The passed variables are stored as real value ((2^n)-1). - * Ralink registers require to know the bit number 'n'. - */ - if (params->cw_min > 0) - queue->cw_min = fls(params->cw_min); - else - queue->cw_min = 5; /* cw_min: 2^5 = 32. */ - - if (params->cw_max > 0) - queue->cw_max = fls(params->cw_max); - else - queue->cw_max = 10; /* cw_min: 2^10 = 1024. */ - - queue->aifs = params->aifs; - queue->txop = params->txop; - - rt2x00_dbg(rt2x00dev, - "Configured TX queue %d - CWmin: %d, CWmax: %d, Aifs: %d, TXop: %d\n", - queue_idx, queue->cw_min, queue->cw_max, queue->aifs, - queue->txop); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2x00mac_conf_tx); - -void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - bool active = !!rt2x00dev->ops->lib->rfkill_poll(rt2x00dev); - - wiphy_rfkill_set_hw_state(hw->wiphy, !active); -} -EXPORT_SYMBOL_GPL(rt2x00mac_rfkill_poll); - -void rt2x00mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct data_queue *queue; - - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - return; - - tx_queue_for_each(rt2x00dev, queue) - rt2x00queue_flush_queue(queue, drop); -} -EXPORT_SYMBOL_GPL(rt2x00mac_flush); - -int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct link_ant *ant = &rt2x00dev->link.ant; - struct antenna_setup *def = &rt2x00dev->default_ant; - struct antenna_setup setup; - - // The antenna value is not supposed to be 0, - // or exceed the maximum number of antenna's. - if (!tx_ant || (tx_ant & ~3) || !rx_ant || (rx_ant & ~3)) - return -EINVAL; - - // When the client tried to configure the antenna to or from - // diversity mode, we must reset the default antenna as well - // as that controls the diversity switch. - if (ant->flags & ANTENNA_TX_DIVERSITY && tx_ant != 3) - ant->flags &= ~ANTENNA_TX_DIVERSITY; - if (ant->flags & ANTENNA_RX_DIVERSITY && rx_ant != 3) - ant->flags &= ~ANTENNA_RX_DIVERSITY; - - // If diversity is being enabled, check if we need hardware - // or software diversity. In the latter case, reset the value, - // and make sure we update the antenna flags to have the - // link tuner pick up the diversity tuning. - if (tx_ant == 3 && def->tx == ANTENNA_SW_DIVERSITY) { - tx_ant = ANTENNA_SW_DIVERSITY; - ant->flags |= ANTENNA_TX_DIVERSITY; - } - - if (rx_ant == 3 && def->rx == ANTENNA_SW_DIVERSITY) { - rx_ant = ANTENNA_SW_DIVERSITY; - ant->flags |= ANTENNA_RX_DIVERSITY; - } - - setup.tx = tx_ant; - setup.rx = rx_ant; - - rt2x00lib_config_antenna(rt2x00dev, setup); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2x00mac_set_antenna); - -int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct link_ant *ant = &rt2x00dev->link.ant; - struct antenna_setup *active = &rt2x00dev->link.ant.active; - - // When software diversity is active, we must report this to the - // client and not the current active antenna state. - if (ant->flags & ANTENNA_TX_DIVERSITY) - *tx_ant = ANTENNA_HW_DIVERSITY; - else - *tx_ant = active->tx; - - if (ant->flags & ANTENNA_RX_DIVERSITY) - *rx_ant = ANTENNA_HW_DIVERSITY; - else - *rx_ant = active->rx; - - return 0; -} -EXPORT_SYMBOL_GPL(rt2x00mac_get_antenna); - -void rt2x00mac_get_ringparam(struct ieee80211_hw *hw, - u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct data_queue *queue; - - tx_queue_for_each(rt2x00dev, queue) { - *tx += queue->length; - *tx_max += queue->limit; - } - - *rx = rt2x00dev->rx->length; - *rx_max = rt2x00dev->rx->limit; -} -EXPORT_SYMBOL_GPL(rt2x00mac_get_ringparam); - -bool rt2x00mac_tx_frames_pending(struct ieee80211_hw *hw) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct data_queue *queue; - - tx_queue_for_each(rt2x00dev, queue) { - if (!rt2x00queue_empty(queue)) - return true; - } - - return false; -} -EXPORT_SYMBOL_GPL(rt2x00mac_tx_frames_pending); diff --git a/drivers/net/wireless/rt2x00/rt2x00mmio.c b/drivers/net/wireless/rt2x00/rt2x00mmio.c deleted file mode 100644 index 64b06c6abe58..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00mmio.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00mmio - Abstract: rt2x00 generic mmio device routines. - */ - -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2x00mmio.h" - -/* - * Register access. - */ -int rt2x00mmio_regbusy_read(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - const struct rt2x00_field32 field, - u32 *reg) -{ - unsigned int i; - - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - return 0; - - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2x00mmio_register_read(rt2x00dev, offset, reg); - if (!rt2x00_get_field32(*reg, field)) - return 1; - udelay(REGISTER_BUSY_DELAY); - } - - printk_once(KERN_ERR "%s() Indirect register access failed: " - "offset=0x%.08x, value=0x%.08x\n", __func__, offset, *reg); - *reg = ~0; - - return 0; -} -EXPORT_SYMBOL_GPL(rt2x00mmio_regbusy_read); - -bool rt2x00mmio_rxdone(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue = rt2x00dev->rx; - struct queue_entry *entry; - struct queue_entry_priv_mmio *entry_priv; - struct skb_frame_desc *skbdesc; - int max_rx = 16; - - while (--max_rx) { - entry = rt2x00queue_get_entry(queue, Q_INDEX); - entry_priv = entry->priv_data; - - if (rt2x00dev->ops->lib->get_entry_state(entry)) - break; - - /* - * Fill in desc fields of the skb descriptor - */ - skbdesc = get_skb_frame_desc(entry->skb); - skbdesc->desc = entry_priv->desc; - skbdesc->desc_len = entry->queue->desc_size; - - /* - * DMA is already done, notify rt2x00lib that - * it finished successfully. - */ - rt2x00lib_dmastart(entry); - rt2x00lib_dmadone(entry); - - /* - * Send the frame to rt2x00lib for further processing. - */ - rt2x00lib_rxdone(entry, GFP_ATOMIC); - } - - return !max_rx; -} -EXPORT_SYMBOL_GPL(rt2x00mmio_rxdone); - -void rt2x00mmio_flush_queue(struct data_queue *queue, bool drop) -{ - unsigned int i; - - for (i = 0; !rt2x00queue_empty(queue) && i < 10; i++) - msleep(10); -} -EXPORT_SYMBOL_GPL(rt2x00mmio_flush_queue); - -/* - * Device initialization handlers. - */ -static int rt2x00mmio_alloc_queue_dma(struct rt2x00_dev *rt2x00dev, - struct data_queue *queue) -{ - struct queue_entry_priv_mmio *entry_priv; - void *addr; - dma_addr_t dma; - unsigned int i; - - /* - * Allocate DMA memory for descriptor and buffer. - */ - addr = dma_alloc_coherent(rt2x00dev->dev, - queue->limit * queue->desc_size, - &dma, GFP_KERNEL); - if (!addr) - return -ENOMEM; - - memset(addr, 0, queue->limit * queue->desc_size); - - /* - * Initialize all queue entries to contain valid addresses. - */ - for (i = 0; i < queue->limit; i++) { - entry_priv = queue->entries[i].priv_data; - entry_priv->desc = addr + i * queue->desc_size; - entry_priv->desc_dma = dma + i * queue->desc_size; - } - - return 0; -} - -static void rt2x00mmio_free_queue_dma(struct rt2x00_dev *rt2x00dev, - struct data_queue *queue) -{ - struct queue_entry_priv_mmio *entry_priv = - queue->entries[0].priv_data; - - if (entry_priv->desc) - dma_free_coherent(rt2x00dev->dev, - queue->limit * queue->desc_size, - entry_priv->desc, entry_priv->desc_dma); - entry_priv->desc = NULL; -} - -int rt2x00mmio_initialize(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - int status; - - /* - * Allocate DMA - */ - queue_for_each(rt2x00dev, queue) { - status = rt2x00mmio_alloc_queue_dma(rt2x00dev, queue); - if (status) - goto exit; - } - - /* - * Register interrupt handler. - */ - status = request_irq(rt2x00dev->irq, - rt2x00dev->ops->lib->irq_handler, - IRQF_SHARED, rt2x00dev->name, rt2x00dev); - if (status) { - rt2x00_err(rt2x00dev, "IRQ %d allocation failed (error %d)\n", - rt2x00dev->irq, status); - goto exit; - } - - return 0; - -exit: - queue_for_each(rt2x00dev, queue) - rt2x00mmio_free_queue_dma(rt2x00dev, queue); - - return status; -} -EXPORT_SYMBOL_GPL(rt2x00mmio_initialize); - -void rt2x00mmio_uninitialize(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - - /* - * Free irq line. - */ - free_irq(rt2x00dev->irq, rt2x00dev); - - /* - * Free DMA - */ - queue_for_each(rt2x00dev, queue) - rt2x00mmio_free_queue_dma(rt2x00dev, queue); -} -EXPORT_SYMBOL_GPL(rt2x00mmio_uninitialize); - -/* - * rt2x00mmio module information. - */ -MODULE_AUTHOR(DRV_PROJECT); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION("rt2x00 mmio library"); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/rt2x00/rt2x00mmio.h b/drivers/net/wireless/rt2x00/rt2x00mmio.h deleted file mode 100644 index cda3dbcf7ead..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00mmio.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00mmio - Abstract: Data structures for the rt2x00mmio module. - */ - -#ifndef RT2X00MMIO_H -#define RT2X00MMIO_H - -#include - -/* - * Register access. - */ -static inline void rt2x00mmio_register_read(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u32 *value) -{ - *value = readl(rt2x00dev->csr.base + offset); -} - -static inline void rt2x00mmio_register_multiread(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - void *value, const u32 length) -{ - memcpy_fromio(value, rt2x00dev->csr.base + offset, length); -} - -static inline void rt2x00mmio_register_write(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u32 value) -{ - writel(value, rt2x00dev->csr.base + offset); -} - -static inline void rt2x00mmio_register_multiwrite(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - const void *value, - const u32 length) -{ - __iowrite32_copy(rt2x00dev->csr.base + offset, value, length >> 2); -} - -/** - * rt2x00mmio_regbusy_read - Read from register with busy check - * @rt2x00dev: Device pointer, see &struct rt2x00_dev. - * @offset: Register offset - * @field: Field to check if register is busy - * @reg: Pointer to where register contents should be stored - * - * This function will read the given register, and checks if the - * register is busy. If it is, it will sleep for a couple of - * microseconds before reading the register again. If the register - * is not read after a certain timeout, this function will return - * FALSE. - */ -int rt2x00mmio_regbusy_read(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - const struct rt2x00_field32 field, - u32 *reg); - -/** - * struct queue_entry_priv_mmio: Per entry PCI specific information - * - * @desc: Pointer to device descriptor - * @desc_dma: DMA pointer to &desc. - * @data: Pointer to device's entry memory. - * @data_dma: DMA pointer to &data. - */ -struct queue_entry_priv_mmio { - __le32 *desc; - dma_addr_t desc_dma; -}; - -/** - * rt2x00mmio_rxdone - Handle RX done events - * @rt2x00dev: Device pointer, see &struct rt2x00_dev. - * - * Returns true if there are still rx frames pending and false if all - * pending rx frames were processed. - */ -bool rt2x00mmio_rxdone(struct rt2x00_dev *rt2x00dev); - -/** - * rt2x00mmio_flush_queue - Flush data queue - * @queue: Data queue to stop - * @drop: True to drop all pending frames. - * - * This will wait for a maximum of 100ms, waiting for the queues - * to become empty. - */ -void rt2x00mmio_flush_queue(struct data_queue *queue, bool drop); - -/* - * Device initialization handlers. - */ -int rt2x00mmio_initialize(struct rt2x00_dev *rt2x00dev); -void rt2x00mmio_uninitialize(struct rt2x00_dev *rt2x00dev); - -#endif /* RT2X00MMIO_H */ diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c deleted file mode 100644 index dc49e525ae5e..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00pci - Abstract: rt2x00 generic pci device routines. - */ - -#include -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2x00pci.h" - -/* - * PCI driver handlers. - */ -static void rt2x00pci_free_reg(struct rt2x00_dev *rt2x00dev) -{ - kfree(rt2x00dev->rf); - rt2x00dev->rf = NULL; - - kfree(rt2x00dev->eeprom); - rt2x00dev->eeprom = NULL; - - if (rt2x00dev->csr.base) { - iounmap(rt2x00dev->csr.base); - rt2x00dev->csr.base = NULL; - } -} - -static int rt2x00pci_alloc_reg(struct rt2x00_dev *rt2x00dev) -{ - struct pci_dev *pci_dev = to_pci_dev(rt2x00dev->dev); - - rt2x00dev->csr.base = pci_ioremap_bar(pci_dev, 0); - if (!rt2x00dev->csr.base) - goto exit; - - rt2x00dev->eeprom = kzalloc(rt2x00dev->ops->eeprom_size, GFP_KERNEL); - if (!rt2x00dev->eeprom) - goto exit; - - rt2x00dev->rf = kzalloc(rt2x00dev->ops->rf_size, GFP_KERNEL); - if (!rt2x00dev->rf) - goto exit; - - return 0; - -exit: - rt2x00_probe_err("Failed to allocate registers\n"); - - rt2x00pci_free_reg(rt2x00dev); - - return -ENOMEM; -} - -int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops) -{ - struct ieee80211_hw *hw; - struct rt2x00_dev *rt2x00dev; - int retval; - u16 chip; - - retval = pci_enable_device(pci_dev); - if (retval) { - rt2x00_probe_err("Enable device failed\n"); - return retval; - } - - retval = pci_request_regions(pci_dev, pci_name(pci_dev)); - if (retval) { - rt2x00_probe_err("PCI request regions failed\n"); - goto exit_disable_device; - } - - pci_set_master(pci_dev); - - if (pci_set_mwi(pci_dev)) - rt2x00_probe_err("MWI not available\n"); - - if (dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(32))) { - rt2x00_probe_err("PCI DMA not supported\n"); - retval = -EIO; - goto exit_release_regions; - } - - hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw); - if (!hw) { - rt2x00_probe_err("Failed to allocate hardware\n"); - retval = -ENOMEM; - goto exit_release_regions; - } - - pci_set_drvdata(pci_dev, hw); - - rt2x00dev = hw->priv; - rt2x00dev->dev = &pci_dev->dev; - rt2x00dev->ops = ops; - rt2x00dev->hw = hw; - rt2x00dev->irq = pci_dev->irq; - rt2x00dev->name = pci_name(pci_dev); - - if (pci_is_pcie(pci_dev)) - rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE); - else - rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI); - - retval = rt2x00pci_alloc_reg(rt2x00dev); - if (retval) - goto exit_free_device; - - /* - * Because rt3290 chip use different efuse offset to read efuse data. - * So before read efuse it need to indicate it is the - * rt3290 or not. - */ - pci_read_config_word(pci_dev, PCI_DEVICE_ID, &chip); - rt2x00dev->chip.rt = chip; - - retval = rt2x00lib_probe_dev(rt2x00dev); - if (retval) - goto exit_free_reg; - - return 0; - -exit_free_reg: - rt2x00pci_free_reg(rt2x00dev); - -exit_free_device: - ieee80211_free_hw(hw); - -exit_release_regions: - pci_release_regions(pci_dev); - -exit_disable_device: - pci_disable_device(pci_dev); - - pci_set_drvdata(pci_dev, NULL); - - return retval; -} -EXPORT_SYMBOL_GPL(rt2x00pci_probe); - -void rt2x00pci_remove(struct pci_dev *pci_dev) -{ - struct ieee80211_hw *hw = pci_get_drvdata(pci_dev); - struct rt2x00_dev *rt2x00dev = hw->priv; - - /* - * Free all allocated data. - */ - rt2x00lib_remove_dev(rt2x00dev); - rt2x00pci_free_reg(rt2x00dev); - ieee80211_free_hw(hw); - - /* - * Free the PCI device data. - */ - pci_set_drvdata(pci_dev, NULL); - pci_disable_device(pci_dev); - pci_release_regions(pci_dev); -} -EXPORT_SYMBOL_GPL(rt2x00pci_remove); - -#ifdef CONFIG_PM -int rt2x00pci_suspend(struct pci_dev *pci_dev, pm_message_t state) -{ - struct ieee80211_hw *hw = pci_get_drvdata(pci_dev); - struct rt2x00_dev *rt2x00dev = hw->priv; - int retval; - - retval = rt2x00lib_suspend(rt2x00dev, state); - if (retval) - return retval; - - pci_save_state(pci_dev); - pci_disable_device(pci_dev); - return pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); -} -EXPORT_SYMBOL_GPL(rt2x00pci_suspend); - -int rt2x00pci_resume(struct pci_dev *pci_dev) -{ - struct ieee80211_hw *hw = pci_get_drvdata(pci_dev); - struct rt2x00_dev *rt2x00dev = hw->priv; - - if (pci_set_power_state(pci_dev, PCI_D0) || - pci_enable_device(pci_dev)) { - rt2x00_err(rt2x00dev, "Failed to resume device\n"); - return -EIO; - } - - pci_restore_state(pci_dev); - return rt2x00lib_resume(rt2x00dev); -} -EXPORT_SYMBOL_GPL(rt2x00pci_resume); -#endif /* CONFIG_PM */ - -/* - * rt2x00pci module information. - */ -MODULE_AUTHOR(DRV_PROJECT); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION("rt2x00 pci library"); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.h b/drivers/net/wireless/rt2x00/rt2x00pci.h deleted file mode 100644 index 60d90b20f8b9..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00pci.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00pci - Abstract: Data structures for the rt2x00pci module. - */ - -#ifndef RT2X00PCI_H -#define RT2X00PCI_H - -#include -#include - -/* - * This variable should be used with the - * pci_driver structure initialization. - */ -#define PCI_DEVICE_DATA(__ops) .driver_data = (kernel_ulong_t)(__ops) - -/* - * PCI driver handlers. - */ -int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops); -void rt2x00pci_remove(struct pci_dev *pci_dev); -#ifdef CONFIG_PM -int rt2x00pci_suspend(struct pci_dev *pci_dev, pm_message_t state); -int rt2x00pci_resume(struct pci_dev *pci_dev); -#else -#define rt2x00pci_suspend NULL -#define rt2x00pci_resume NULL -#endif /* CONFIG_PM */ - -#endif /* RT2X00PCI_H */ diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c deleted file mode 100644 index 1f17f5b64625..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ /dev/null @@ -1,1364 +0,0 @@ -/* - Copyright (C) 2010 Willow Garage - Copyright (C) 2004 - 2010 Ivo van Doorn - Copyright (C) 2004 - 2009 Gertjan van Wingerde - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00lib - Abstract: rt2x00 queue specific routines. - */ - -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2x00lib.h" - -struct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry, gfp_t gfp) -{ - struct data_queue *queue = entry->queue; - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - struct sk_buff *skb; - struct skb_frame_desc *skbdesc; - unsigned int frame_size; - unsigned int head_size = 0; - unsigned int tail_size = 0; - - /* - * The frame size includes descriptor size, because the - * hardware directly receive the frame into the skbuffer. - */ - frame_size = queue->data_size + queue->desc_size + queue->winfo_size; - - /* - * The payload should be aligned to a 4-byte boundary, - * this means we need at least 3 bytes for moving the frame - * into the correct offset. - */ - head_size = 4; - - /* - * For IV/EIV/ICV assembly we must make sure there is - * at least 8 bytes bytes available in headroom for IV/EIV - * and 8 bytes for ICV data as tailroon. - */ - if (test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags)) { - head_size += 8; - tail_size += 8; - } - - /* - * Allocate skbuffer. - */ - skb = __dev_alloc_skb(frame_size + head_size + tail_size, gfp); - if (!skb) - return NULL; - - /* - * Make sure we not have a frame with the requested bytes - * available in the head and tail. - */ - skb_reserve(skb, head_size); - skb_put(skb, frame_size); - - /* - * Populate skbdesc. - */ - skbdesc = get_skb_frame_desc(skb); - memset(skbdesc, 0, sizeof(*skbdesc)); - skbdesc->entry = entry; - - if (test_bit(REQUIRE_DMA, &rt2x00dev->cap_flags)) { - dma_addr_t skb_dma; - - skb_dma = dma_map_single(rt2x00dev->dev, skb->data, skb->len, - DMA_FROM_DEVICE); - if (unlikely(dma_mapping_error(rt2x00dev->dev, skb_dma))) { - dev_kfree_skb_any(skb); - return NULL; - } - - skbdesc->skb_dma = skb_dma; - skbdesc->flags |= SKBDESC_DMA_MAPPED_RX; - } - - return skb; -} - -int rt2x00queue_map_txskb(struct queue_entry *entry) -{ - struct device *dev = entry->queue->rt2x00dev->dev; - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - - skbdesc->skb_dma = - dma_map_single(dev, entry->skb->data, entry->skb->len, DMA_TO_DEVICE); - - if (unlikely(dma_mapping_error(dev, skbdesc->skb_dma))) - return -ENOMEM; - - skbdesc->flags |= SKBDESC_DMA_MAPPED_TX; - return 0; -} -EXPORT_SYMBOL_GPL(rt2x00queue_map_txskb); - -void rt2x00queue_unmap_skb(struct queue_entry *entry) -{ - struct device *dev = entry->queue->rt2x00dev->dev; - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - - if (skbdesc->flags & SKBDESC_DMA_MAPPED_RX) { - dma_unmap_single(dev, skbdesc->skb_dma, entry->skb->len, - DMA_FROM_DEVICE); - skbdesc->flags &= ~SKBDESC_DMA_MAPPED_RX; - } else if (skbdesc->flags & SKBDESC_DMA_MAPPED_TX) { - dma_unmap_single(dev, skbdesc->skb_dma, entry->skb->len, - DMA_TO_DEVICE); - skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX; - } -} -EXPORT_SYMBOL_GPL(rt2x00queue_unmap_skb); - -void rt2x00queue_free_skb(struct queue_entry *entry) -{ - if (!entry->skb) - return; - - rt2x00queue_unmap_skb(entry); - dev_kfree_skb_any(entry->skb); - entry->skb = NULL; -} - -void rt2x00queue_align_frame(struct sk_buff *skb) -{ - unsigned int frame_length = skb->len; - unsigned int align = ALIGN_SIZE(skb, 0); - - if (!align) - return; - - skb_push(skb, align); - memmove(skb->data, skb->data + align, frame_length); - skb_trim(skb, frame_length); -} - -void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length) -{ - unsigned int payload_length = skb->len - header_length; - unsigned int header_align = ALIGN_SIZE(skb, 0); - unsigned int payload_align = ALIGN_SIZE(skb, header_length); - unsigned int l2pad = payload_length ? L2PAD_SIZE(header_length) : 0; - - /* - * Adjust the header alignment if the payload needs to be moved more - * than the header. - */ - if (payload_align > header_align) - header_align += 4; - - /* There is nothing to do if no alignment is needed */ - if (!header_align) - return; - - /* Reserve the amount of space needed in front of the frame */ - skb_push(skb, header_align); - - /* - * Move the header. - */ - memmove(skb->data, skb->data + header_align, header_length); - - /* Move the payload, if present and if required */ - if (payload_length && payload_align) - memmove(skb->data + header_length + l2pad, - skb->data + header_length + l2pad + payload_align, - payload_length); - - /* Trim the skb to the correct size */ - skb_trim(skb, header_length + l2pad + payload_length); -} - -void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length) -{ - /* - * L2 padding is only present if the skb contains more than just the - * IEEE 802.11 header. - */ - unsigned int l2pad = (skb->len > header_length) ? - L2PAD_SIZE(header_length) : 0; - - if (!l2pad) - return; - - memmove(skb->data + l2pad, skb->data, header_length); - skb_pull(skb, l2pad); -} - -static void rt2x00queue_create_tx_descriptor_seq(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb, - struct txentry_desc *txdesc) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif); - u16 seqno; - - if (!(tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)) - return; - - __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); - - if (!test_bit(REQUIRE_SW_SEQNO, &rt2x00dev->cap_flags)) { - /* - * rt2800 has a H/W (or F/W) bug, device incorrectly increase - * seqno on retransmited data (non-QOS) frames. To workaround - * the problem let's generate seqno in software if QOS is - * disabled. - */ - if (test_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags)) - __clear_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags); - else - /* H/W will generate sequence number */ - return; - } - - /* - * The hardware is not able to insert a sequence number. Assign a - * software generated one here. - * - * This is wrong because beacons are not getting sequence - * numbers assigned properly. - * - * A secondary problem exists for drivers that cannot toggle - * sequence counting per-frame, since those will override the - * sequence counter given by mac80211. - */ - if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)) - seqno = atomic_add_return(0x10, &intf->seqno); - else - seqno = atomic_read(&intf->seqno); - - hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); - hdr->seq_ctrl |= cpu_to_le16(seqno); -} - -static void rt2x00queue_create_tx_descriptor_plcp(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb, - struct txentry_desc *txdesc, - const struct rt2x00_rate *hwrate) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0]; - unsigned int data_length; - unsigned int duration; - unsigned int residual; - - /* - * Determine with what IFS priority this frame should be send. - * Set ifs to IFS_SIFS when the this is not the first fragment, - * or this fragment came after RTS/CTS. - */ - if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)) - txdesc->u.plcp.ifs = IFS_BACKOFF; - else - txdesc->u.plcp.ifs = IFS_SIFS; - - /* Data length + CRC + Crypto overhead (IV/EIV/ICV/MIC) */ - data_length = skb->len + 4; - data_length += rt2x00crypto_tx_overhead(rt2x00dev, skb); - - /* - * PLCP setup - * Length calculation depends on OFDM/CCK rate. - */ - txdesc->u.plcp.signal = hwrate->plcp; - txdesc->u.plcp.service = 0x04; - - if (hwrate->flags & DEV_RATE_OFDM) { - txdesc->u.plcp.length_high = (data_length >> 6) & 0x3f; - txdesc->u.plcp.length_low = data_length & 0x3f; - } else { - /* - * Convert length to microseconds. - */ - residual = GET_DURATION_RES(data_length, hwrate->bitrate); - duration = GET_DURATION(data_length, hwrate->bitrate); - - if (residual != 0) { - duration++; - - /* - * Check if we need to set the Length Extension - */ - if (hwrate->bitrate == 110 && residual <= 30) - txdesc->u.plcp.service |= 0x80; - } - - txdesc->u.plcp.length_high = (duration >> 8) & 0xff; - txdesc->u.plcp.length_low = duration & 0xff; - - /* - * When preamble is enabled we should set the - * preamble bit for the signal. - */ - if (txrate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) - txdesc->u.plcp.signal |= 0x08; - } -} - -static void rt2x00queue_create_tx_descriptor_ht(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb, - struct txentry_desc *txdesc, - struct ieee80211_sta *sta, - const struct rt2x00_rate *hwrate) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0]; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct rt2x00_sta *sta_priv = NULL; - - if (sta) { - txdesc->u.ht.mpdu_density = - sta->ht_cap.ampdu_density; - - sta_priv = sta_to_rt2x00_sta(sta); - txdesc->u.ht.wcid = sta_priv->wcid; - } - - /* - * If IEEE80211_TX_RC_MCS is set txrate->idx just contains the - * mcs rate to be used - */ - if (txrate->flags & IEEE80211_TX_RC_MCS) { - txdesc->u.ht.mcs = txrate->idx; - - /* - * MIMO PS should be set to 1 for STA's using dynamic SM PS - * when using more then one tx stream (>MCS7). - */ - if (sta && txdesc->u.ht.mcs > 7 && - sta->smps_mode == IEEE80211_SMPS_DYNAMIC) - __set_bit(ENTRY_TXD_HT_MIMO_PS, &txdesc->flags); - } else { - txdesc->u.ht.mcs = rt2x00_get_rate_mcs(hwrate->mcs); - if (txrate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) - txdesc->u.ht.mcs |= 0x08; - } - - if (test_bit(CONFIG_HT_DISABLED, &rt2x00dev->flags)) { - if (!(tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)) - txdesc->u.ht.txop = TXOP_SIFS; - else - txdesc->u.ht.txop = TXOP_BACKOFF; - - /* Left zero on all other settings. */ - return; - } - - txdesc->u.ht.ba_size = 7; /* FIXME: What value is needed? */ - - /* - * Only one STBC stream is supported for now. - */ - if (tx_info->flags & IEEE80211_TX_CTL_STBC) - txdesc->u.ht.stbc = 1; - - /* - * This frame is eligible for an AMPDU, however, don't aggregate - * frames that are intended to probe a specific tx rate. - */ - if (tx_info->flags & IEEE80211_TX_CTL_AMPDU && - !(tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)) - __set_bit(ENTRY_TXD_HT_AMPDU, &txdesc->flags); - - /* - * Set 40Mhz mode if necessary (for legacy rates this will - * duplicate the frame to both channels). - */ - if (txrate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH || - txrate->flags & IEEE80211_TX_RC_DUP_DATA) - __set_bit(ENTRY_TXD_HT_BW_40, &txdesc->flags); - if (txrate->flags & IEEE80211_TX_RC_SHORT_GI) - __set_bit(ENTRY_TXD_HT_SHORT_GI, &txdesc->flags); - - /* - * Determine IFS values - * - Use TXOP_BACKOFF for management frames except beacons - * - Use TXOP_SIFS for fragment bursts - * - Use TXOP_HTTXOP for everything else - * - * Note: rt2800 devices won't use CTS protection (if used) - * for frames not transmitted with TXOP_HTTXOP - */ - if (ieee80211_is_mgmt(hdr->frame_control) && - !ieee80211_is_beacon(hdr->frame_control)) - txdesc->u.ht.txop = TXOP_BACKOFF; - else if (!(tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)) - txdesc->u.ht.txop = TXOP_SIFS; - else - txdesc->u.ht.txop = TXOP_HTTXOP; -} - -static void rt2x00queue_create_tx_descriptor(struct rt2x00_dev *rt2x00dev, - struct sk_buff *skb, - struct txentry_desc *txdesc, - struct ieee80211_sta *sta) -{ - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0]; - struct ieee80211_rate *rate; - const struct rt2x00_rate *hwrate = NULL; - - memset(txdesc, 0, sizeof(*txdesc)); - - /* - * Header and frame information. - */ - txdesc->length = skb->len; - txdesc->header_length = ieee80211_get_hdrlen_from_skb(skb); - - /* - * Check whether this frame is to be acked. - */ - if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) - __set_bit(ENTRY_TXD_ACK, &txdesc->flags); - - /* - * Check if this is a RTS/CTS frame - */ - if (ieee80211_is_rts(hdr->frame_control) || - ieee80211_is_cts(hdr->frame_control)) { - __set_bit(ENTRY_TXD_BURST, &txdesc->flags); - if (ieee80211_is_rts(hdr->frame_control)) - __set_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags); - else - __set_bit(ENTRY_TXD_CTS_FRAME, &txdesc->flags); - if (tx_info->control.rts_cts_rate_idx >= 0) - rate = - ieee80211_get_rts_cts_rate(rt2x00dev->hw, tx_info); - } - - /* - * Determine retry information. - */ - txdesc->retry_limit = tx_info->control.rates[0].count - 1; - if (txdesc->retry_limit >= rt2x00dev->long_retry) - __set_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags); - - /* - * Check if more fragments are pending - */ - if (ieee80211_has_morefrags(hdr->frame_control)) { - __set_bit(ENTRY_TXD_BURST, &txdesc->flags); - __set_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags); - } - - /* - * Check if more frames (!= fragments) are pending - */ - if (tx_info->flags & IEEE80211_TX_CTL_MORE_FRAMES) - __set_bit(ENTRY_TXD_BURST, &txdesc->flags); - - /* - * Beacons and probe responses require the tsf timestamp - * to be inserted into the frame. - */ - if (ieee80211_is_beacon(hdr->frame_control) || - ieee80211_is_probe_resp(hdr->frame_control)) - __set_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags); - - if ((tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) && - !test_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags)) - __set_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags); - - /* - * Determine rate modulation. - */ - if (txrate->flags & IEEE80211_TX_RC_GREEN_FIELD) - txdesc->rate_mode = RATE_MODE_HT_GREENFIELD; - else if (txrate->flags & IEEE80211_TX_RC_MCS) - txdesc->rate_mode = RATE_MODE_HT_MIX; - else { - rate = ieee80211_get_tx_rate(rt2x00dev->hw, tx_info); - hwrate = rt2x00_get_rate(rate->hw_value); - if (hwrate->flags & DEV_RATE_OFDM) - txdesc->rate_mode = RATE_MODE_OFDM; - else - txdesc->rate_mode = RATE_MODE_CCK; - } - - /* - * Apply TX descriptor handling by components - */ - rt2x00crypto_create_tx_descriptor(rt2x00dev, skb, txdesc); - rt2x00queue_create_tx_descriptor_seq(rt2x00dev, skb, txdesc); - - if (test_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags)) - rt2x00queue_create_tx_descriptor_ht(rt2x00dev, skb, txdesc, - sta, hwrate); - else - rt2x00queue_create_tx_descriptor_plcp(rt2x00dev, skb, txdesc, - hwrate); -} - -static int rt2x00queue_write_tx_data(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - - /* - * This should not happen, we already checked the entry - * was ours. When the hardware disagrees there has been - * a queue corruption! - */ - if (unlikely(rt2x00dev->ops->lib->get_entry_state && - rt2x00dev->ops->lib->get_entry_state(entry))) { - rt2x00_err(rt2x00dev, - "Corrupt queue %d, accessing entry which is not ours\n" - "Please file bug report to %s\n", - entry->queue->qid, DRV_PROJECT); - return -EINVAL; - } - - /* - * Add the requested extra tx headroom in front of the skb. - */ - skb_push(entry->skb, rt2x00dev->ops->extra_tx_headroom); - memset(entry->skb->data, 0, rt2x00dev->ops->extra_tx_headroom); - - /* - * Call the driver's write_tx_data function, if it exists. - */ - if (rt2x00dev->ops->lib->write_tx_data) - rt2x00dev->ops->lib->write_tx_data(entry, txdesc); - - /* - * Map the skb to DMA. - */ - if (test_bit(REQUIRE_DMA, &rt2x00dev->cap_flags) && - rt2x00queue_map_txskb(entry)) - return -ENOMEM; - - return 0; -} - -static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - struct data_queue *queue = entry->queue; - - queue->rt2x00dev->ops->lib->write_tx_desc(entry, txdesc); - - /* - * All processing on the frame has been completed, this means - * it is now ready to be dumped to userspace through debugfs. - */ - rt2x00debug_dump_frame(queue->rt2x00dev, DUMP_FRAME_TX, entry->skb); -} - -static void rt2x00queue_kick_tx_queue(struct data_queue *queue, - struct txentry_desc *txdesc) -{ - /* - * Check if we need to kick the queue, there are however a few rules - * 1) Don't kick unless this is the last in frame in a burst. - * When the burst flag is set, this frame is always followed - * by another frame which in some way are related to eachother. - * This is true for fragments, RTS or CTS-to-self frames. - * 2) Rule 1 can be broken when the available entries - * in the queue are less then a certain threshold. - */ - if (rt2x00queue_threshold(queue) || - !test_bit(ENTRY_TXD_BURST, &txdesc->flags)) - queue->rt2x00dev->ops->lib->kick_queue(queue); -} - -static void rt2x00queue_bar_check(struct queue_entry *entry) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct ieee80211_bar *bar = (void *) (entry->skb->data + - rt2x00dev->ops->extra_tx_headroom); - struct rt2x00_bar_list_entry *bar_entry; - - if (likely(!ieee80211_is_back_req(bar->frame_control))) - return; - - bar_entry = kmalloc(sizeof(*bar_entry), GFP_ATOMIC); - - /* - * If the alloc fails we still send the BAR out but just don't track - * it in our bar list. And as a result we will report it to mac80211 - * back as failed. - */ - if (!bar_entry) - return; - - bar_entry->entry = entry; - bar_entry->block_acked = 0; - - /* - * Copy the relevant parts of the 802.11 BAR into out check list - * such that we can use RCU for less-overhead in the RX path since - * sending BARs and processing the according BlockAck should be - * the exception. - */ - memcpy(bar_entry->ra, bar->ra, sizeof(bar->ra)); - memcpy(bar_entry->ta, bar->ta, sizeof(bar->ta)); - bar_entry->control = bar->control; - bar_entry->start_seq_num = bar->start_seq_num; - - /* - * Insert BAR into our BAR check list. - */ - spin_lock_bh(&rt2x00dev->bar_list_lock); - list_add_tail_rcu(&bar_entry->list, &rt2x00dev->bar_list); - spin_unlock_bh(&rt2x00dev->bar_list_lock); -} - -int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, - struct ieee80211_sta *sta, bool local) -{ - struct ieee80211_tx_info *tx_info; - struct queue_entry *entry; - struct txentry_desc txdesc; - struct skb_frame_desc *skbdesc; - u8 rate_idx, rate_flags; - int ret = 0; - - /* - * Copy all TX descriptor information into txdesc, - * after that we are free to use the skb->cb array - * for our information. - */ - rt2x00queue_create_tx_descriptor(queue->rt2x00dev, skb, &txdesc, sta); - - /* - * All information is retrieved from the skb->cb array, - * now we should claim ownership of the driver part of that - * array, preserving the bitrate index and flags. - */ - tx_info = IEEE80211_SKB_CB(skb); - rate_idx = tx_info->control.rates[0].idx; - rate_flags = tx_info->control.rates[0].flags; - skbdesc = get_skb_frame_desc(skb); - memset(skbdesc, 0, sizeof(*skbdesc)); - skbdesc->tx_rate_idx = rate_idx; - skbdesc->tx_rate_flags = rate_flags; - - if (local) - skbdesc->flags |= SKBDESC_NOT_MAC80211; - - /* - * When hardware encryption is supported, and this frame - * is to be encrypted, we should strip the IV/EIV data from - * the frame so we can provide it to the driver separately. - */ - if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc.flags) && - !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc.flags)) { - if (test_bit(REQUIRE_COPY_IV, &queue->rt2x00dev->cap_flags)) - rt2x00crypto_tx_copy_iv(skb, &txdesc); - else - rt2x00crypto_tx_remove_iv(skb, &txdesc); - } - - /* - * When DMA allocation is required we should guarantee to the - * driver that the DMA is aligned to a 4-byte boundary. - * However some drivers require L2 padding to pad the payload - * rather then the header. This could be a requirement for - * PCI and USB devices, while header alignment only is valid - * for PCI devices. - */ - if (test_bit(REQUIRE_L2PAD, &queue->rt2x00dev->cap_flags)) - rt2x00queue_insert_l2pad(skb, txdesc.header_length); - else if (test_bit(REQUIRE_DMA, &queue->rt2x00dev->cap_flags)) - rt2x00queue_align_frame(skb); - - /* - * That function must be called with bh disabled. - */ - spin_lock(&queue->tx_lock); - - if (unlikely(rt2x00queue_full(queue))) { - rt2x00_err(queue->rt2x00dev, "Dropping frame due to full tx queue %d\n", - queue->qid); - ret = -ENOBUFS; - goto out; - } - - entry = rt2x00queue_get_entry(queue, Q_INDEX); - - if (unlikely(test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, - &entry->flags))) { - rt2x00_err(queue->rt2x00dev, - "Arrived at non-free entry in the non-full queue %d\n" - "Please file bug report to %s\n", - queue->qid, DRV_PROJECT); - ret = -EINVAL; - goto out; - } - - skbdesc->entry = entry; - entry->skb = skb; - - /* - * It could be possible that the queue was corrupted and this - * call failed. Since we always return NETDEV_TX_OK to mac80211, - * this frame will simply be dropped. - */ - if (unlikely(rt2x00queue_write_tx_data(entry, &txdesc))) { - clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); - entry->skb = NULL; - ret = -EIO; - goto out; - } - - /* - * Put BlockAckReqs into our check list for driver BA processing. - */ - rt2x00queue_bar_check(entry); - - set_bit(ENTRY_DATA_PENDING, &entry->flags); - - rt2x00queue_index_inc(entry, Q_INDEX); - rt2x00queue_write_tx_descriptor(entry, &txdesc); - rt2x00queue_kick_tx_queue(queue, &txdesc); - -out: - spin_unlock(&queue->tx_lock); - return ret; -} - -int rt2x00queue_clear_beacon(struct rt2x00_dev *rt2x00dev, - struct ieee80211_vif *vif) -{ - struct rt2x00_intf *intf = vif_to_intf(vif); - - if (unlikely(!intf->beacon)) - return -ENOBUFS; - - mutex_lock(&intf->beacon_skb_mutex); - - /* - * Clean up the beacon skb. - */ - rt2x00queue_free_skb(intf->beacon); - - /* - * Clear beacon (single bssid devices don't need to clear the beacon - * since the beacon queue will get stopped anyway). - */ - if (rt2x00dev->ops->lib->clear_beacon) - rt2x00dev->ops->lib->clear_beacon(intf->beacon); - - mutex_unlock(&intf->beacon_skb_mutex); - - return 0; -} - -int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev, - struct ieee80211_vif *vif) -{ - struct rt2x00_intf *intf = vif_to_intf(vif); - struct skb_frame_desc *skbdesc; - struct txentry_desc txdesc; - - if (unlikely(!intf->beacon)) - return -ENOBUFS; - - /* - * Clean up the beacon skb. - */ - rt2x00queue_free_skb(intf->beacon); - - intf->beacon->skb = ieee80211_beacon_get(rt2x00dev->hw, vif); - if (!intf->beacon->skb) - return -ENOMEM; - - /* - * Copy all TX descriptor information into txdesc, - * after that we are free to use the skb->cb array - * for our information. - */ - rt2x00queue_create_tx_descriptor(rt2x00dev, intf->beacon->skb, &txdesc, NULL); - - /* - * Fill in skb descriptor - */ - skbdesc = get_skb_frame_desc(intf->beacon->skb); - memset(skbdesc, 0, sizeof(*skbdesc)); - skbdesc->entry = intf->beacon; - - /* - * Send beacon to hardware. - */ - rt2x00dev->ops->lib->write_beacon(intf->beacon, &txdesc); - - return 0; - -} - -int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, - struct ieee80211_vif *vif) -{ - struct rt2x00_intf *intf = vif_to_intf(vif); - int ret; - - mutex_lock(&intf->beacon_skb_mutex); - ret = rt2x00queue_update_beacon_locked(rt2x00dev, vif); - mutex_unlock(&intf->beacon_skb_mutex); - - return ret; -} - -bool rt2x00queue_for_each_entry(struct data_queue *queue, - enum queue_index start, - enum queue_index end, - void *data, - bool (*fn)(struct queue_entry *entry, - void *data)) -{ - unsigned long irqflags; - unsigned int index_start; - unsigned int index_end; - unsigned int i; - - if (unlikely(start >= Q_INDEX_MAX || end >= Q_INDEX_MAX)) { - rt2x00_err(queue->rt2x00dev, - "Entry requested from invalid index range (%d - %d)\n", - start, end); - return true; - } - - /* - * Only protect the range we are going to loop over, - * if during our loop a extra entry is set to pending - * it should not be kicked during this run, since it - * is part of another TX operation. - */ - spin_lock_irqsave(&queue->index_lock, irqflags); - index_start = queue->index[start]; - index_end = queue->index[end]; - spin_unlock_irqrestore(&queue->index_lock, irqflags); - - /* - * Start from the TX done pointer, this guarantees that we will - * send out all frames in the correct order. - */ - if (index_start < index_end) { - for (i = index_start; i < index_end; i++) { - if (fn(&queue->entries[i], data)) - return true; - } - } else { - for (i = index_start; i < queue->limit; i++) { - if (fn(&queue->entries[i], data)) - return true; - } - - for (i = 0; i < index_end; i++) { - if (fn(&queue->entries[i], data)) - return true; - } - } - - return false; -} -EXPORT_SYMBOL_GPL(rt2x00queue_for_each_entry); - -struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue, - enum queue_index index) -{ - struct queue_entry *entry; - unsigned long irqflags; - - if (unlikely(index >= Q_INDEX_MAX)) { - rt2x00_err(queue->rt2x00dev, "Entry requested from invalid index type (%d)\n", - index); - return NULL; - } - - spin_lock_irqsave(&queue->index_lock, irqflags); - - entry = &queue->entries[queue->index[index]]; - - spin_unlock_irqrestore(&queue->index_lock, irqflags); - - return entry; -} -EXPORT_SYMBOL_GPL(rt2x00queue_get_entry); - -void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index) -{ - struct data_queue *queue = entry->queue; - unsigned long irqflags; - - if (unlikely(index >= Q_INDEX_MAX)) { - rt2x00_err(queue->rt2x00dev, - "Index change on invalid index type (%d)\n", index); - return; - } - - spin_lock_irqsave(&queue->index_lock, irqflags); - - queue->index[index]++; - if (queue->index[index] >= queue->limit) - queue->index[index] = 0; - - entry->last_action = jiffies; - - if (index == Q_INDEX) { - queue->length++; - } else if (index == Q_INDEX_DONE) { - queue->length--; - queue->count++; - } - - spin_unlock_irqrestore(&queue->index_lock, irqflags); -} - -void rt2x00queue_pause_queue_nocheck(struct data_queue *queue) -{ - switch (queue->qid) { - case QID_AC_VO: - case QID_AC_VI: - case QID_AC_BE: - case QID_AC_BK: - /* - * For TX queues, we have to disable the queue - * inside mac80211. - */ - ieee80211_stop_queue(queue->rt2x00dev->hw, queue->qid); - break; - default: - break; - } -} -void rt2x00queue_pause_queue(struct data_queue *queue) -{ - if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) || - !test_bit(QUEUE_STARTED, &queue->flags) || - test_and_set_bit(QUEUE_PAUSED, &queue->flags)) - return; - - rt2x00queue_pause_queue_nocheck(queue); -} -EXPORT_SYMBOL_GPL(rt2x00queue_pause_queue); - -void rt2x00queue_unpause_queue(struct data_queue *queue) -{ - if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) || - !test_bit(QUEUE_STARTED, &queue->flags) || - !test_and_clear_bit(QUEUE_PAUSED, &queue->flags)) - return; - - switch (queue->qid) { - case QID_AC_VO: - case QID_AC_VI: - case QID_AC_BE: - case QID_AC_BK: - /* - * For TX queues, we have to enable the queue - * inside mac80211. - */ - ieee80211_wake_queue(queue->rt2x00dev->hw, queue->qid); - break; - case QID_RX: - /* - * For RX we need to kick the queue now in order to - * receive frames. - */ - queue->rt2x00dev->ops->lib->kick_queue(queue); - default: - break; - } -} -EXPORT_SYMBOL_GPL(rt2x00queue_unpause_queue); - -void rt2x00queue_start_queue(struct data_queue *queue) -{ - mutex_lock(&queue->status_lock); - - if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) || - test_and_set_bit(QUEUE_STARTED, &queue->flags)) { - mutex_unlock(&queue->status_lock); - return; - } - - set_bit(QUEUE_PAUSED, &queue->flags); - - queue->rt2x00dev->ops->lib->start_queue(queue); - - rt2x00queue_unpause_queue(queue); - - mutex_unlock(&queue->status_lock); -} -EXPORT_SYMBOL_GPL(rt2x00queue_start_queue); - -void rt2x00queue_stop_queue(struct data_queue *queue) -{ - mutex_lock(&queue->status_lock); - - if (!test_and_clear_bit(QUEUE_STARTED, &queue->flags)) { - mutex_unlock(&queue->status_lock); - return; - } - - rt2x00queue_pause_queue_nocheck(queue); - - queue->rt2x00dev->ops->lib->stop_queue(queue); - - mutex_unlock(&queue->status_lock); -} -EXPORT_SYMBOL_GPL(rt2x00queue_stop_queue); - -void rt2x00queue_flush_queue(struct data_queue *queue, bool drop) -{ - bool started; - bool tx_queue = - (queue->qid == QID_AC_VO) || - (queue->qid == QID_AC_VI) || - (queue->qid == QID_AC_BE) || - (queue->qid == QID_AC_BK); - - mutex_lock(&queue->status_lock); - - /* - * If the queue has been started, we must stop it temporarily - * to prevent any new frames to be queued on the device. If - * we are not dropping the pending frames, the queue must - * only be stopped in the software and not the hardware, - * otherwise the queue will never become empty on its own. - */ - started = test_bit(QUEUE_STARTED, &queue->flags); - if (started) { - /* - * Pause the queue - */ - rt2x00queue_pause_queue(queue); - - /* - * If we are not supposed to drop any pending - * frames, this means we must force a start (=kick) - * to the queue to make sure the hardware will - * start transmitting. - */ - if (!drop && tx_queue) - queue->rt2x00dev->ops->lib->kick_queue(queue); - } - - /* - * Check if driver supports flushing, if that is the case we can - * defer the flushing to the driver. Otherwise we must use the - * alternative which just waits for the queue to become empty. - */ - if (likely(queue->rt2x00dev->ops->lib->flush_queue)) - queue->rt2x00dev->ops->lib->flush_queue(queue, drop); - - /* - * The queue flush has failed... - */ - if (unlikely(!rt2x00queue_empty(queue))) - rt2x00_warn(queue->rt2x00dev, "Queue %d failed to flush\n", - queue->qid); - - /* - * Restore the queue to the previous status - */ - if (started) - rt2x00queue_unpause_queue(queue); - - mutex_unlock(&queue->status_lock); -} -EXPORT_SYMBOL_GPL(rt2x00queue_flush_queue); - -void rt2x00queue_start_queues(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - - /* - * rt2x00queue_start_queue will call ieee80211_wake_queue - * for each queue after is has been properly initialized. - */ - tx_queue_for_each(rt2x00dev, queue) - rt2x00queue_start_queue(queue); - - rt2x00queue_start_queue(rt2x00dev->rx); -} -EXPORT_SYMBOL_GPL(rt2x00queue_start_queues); - -void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - - /* - * rt2x00queue_stop_queue will call ieee80211_stop_queue - * as well, but we are completely shutting doing everything - * now, so it is much safer to stop all TX queues at once, - * and use rt2x00queue_stop_queue for cleaning up. - */ - ieee80211_stop_queues(rt2x00dev->hw); - - tx_queue_for_each(rt2x00dev, queue) - rt2x00queue_stop_queue(queue); - - rt2x00queue_stop_queue(rt2x00dev->rx); -} -EXPORT_SYMBOL_GPL(rt2x00queue_stop_queues); - -void rt2x00queue_flush_queues(struct rt2x00_dev *rt2x00dev, bool drop) -{ - struct data_queue *queue; - - tx_queue_for_each(rt2x00dev, queue) - rt2x00queue_flush_queue(queue, drop); - - rt2x00queue_flush_queue(rt2x00dev->rx, drop); -} -EXPORT_SYMBOL_GPL(rt2x00queue_flush_queues); - -static void rt2x00queue_reset(struct data_queue *queue) -{ - unsigned long irqflags; - unsigned int i; - - spin_lock_irqsave(&queue->index_lock, irqflags); - - queue->count = 0; - queue->length = 0; - - for (i = 0; i < Q_INDEX_MAX; i++) - queue->index[i] = 0; - - spin_unlock_irqrestore(&queue->index_lock, irqflags); -} - -void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - unsigned int i; - - queue_for_each(rt2x00dev, queue) { - rt2x00queue_reset(queue); - - for (i = 0; i < queue->limit; i++) - rt2x00dev->ops->lib->clear_entry(&queue->entries[i]); - } -} - -static int rt2x00queue_alloc_entries(struct data_queue *queue, - const struct data_queue_desc *qdesc) -{ - struct queue_entry *entries; - unsigned int entry_size; - unsigned int i; - - rt2x00queue_reset(queue); - - queue->limit = qdesc->entry_num; - queue->threshold = DIV_ROUND_UP(qdesc->entry_num, 10); - queue->data_size = qdesc->data_size; - queue->desc_size = qdesc->desc_size; - queue->winfo_size = qdesc->winfo_size; - - /* - * Allocate all queue entries. - */ - entry_size = sizeof(*entries) + qdesc->priv_size; - entries = kcalloc(queue->limit, entry_size, GFP_KERNEL); - if (!entries) - return -ENOMEM; - -#define QUEUE_ENTRY_PRIV_OFFSET(__base, __index, __limit, __esize, __psize) \ - (((char *)(__base)) + ((__limit) * (__esize)) + \ - ((__index) * (__psize))) - - for (i = 0; i < queue->limit; i++) { - entries[i].flags = 0; - entries[i].queue = queue; - entries[i].skb = NULL; - entries[i].entry_idx = i; - entries[i].priv_data = - QUEUE_ENTRY_PRIV_OFFSET(entries, i, queue->limit, - sizeof(*entries), qdesc->priv_size); - } - -#undef QUEUE_ENTRY_PRIV_OFFSET - - queue->entries = entries; - - return 0; -} - -static void rt2x00queue_free_skbs(struct data_queue *queue) -{ - unsigned int i; - - if (!queue->entries) - return; - - for (i = 0; i < queue->limit; i++) { - rt2x00queue_free_skb(&queue->entries[i]); - } -} - -static int rt2x00queue_alloc_rxskbs(struct data_queue *queue) -{ - unsigned int i; - struct sk_buff *skb; - - for (i = 0; i < queue->limit; i++) { - skb = rt2x00queue_alloc_rxskb(&queue->entries[i], GFP_KERNEL); - if (!skb) - return -ENOMEM; - queue->entries[i].skb = skb; - } - - return 0; -} - -int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - int status; - - status = rt2x00queue_alloc_entries(rt2x00dev->rx, rt2x00dev->ops->rx); - if (status) - goto exit; - - tx_queue_for_each(rt2x00dev, queue) { - status = rt2x00queue_alloc_entries(queue, rt2x00dev->ops->tx); - if (status) - goto exit; - } - - status = rt2x00queue_alloc_entries(rt2x00dev->bcn, rt2x00dev->ops->bcn); - if (status) - goto exit; - - if (test_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags)) { - status = rt2x00queue_alloc_entries(rt2x00dev->atim, - rt2x00dev->ops->atim); - if (status) - goto exit; - } - - status = rt2x00queue_alloc_rxskbs(rt2x00dev->rx); - if (status) - goto exit; - - return 0; - -exit: - rt2x00_err(rt2x00dev, "Queue entries allocation failed\n"); - - rt2x00queue_uninitialize(rt2x00dev); - - return status; -} - -void rt2x00queue_uninitialize(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - - rt2x00queue_free_skbs(rt2x00dev->rx); - - queue_for_each(rt2x00dev, queue) { - kfree(queue->entries); - queue->entries = NULL; - } -} - -static void rt2x00queue_init(struct rt2x00_dev *rt2x00dev, - struct data_queue *queue, enum data_queue_qid qid) -{ - mutex_init(&queue->status_lock); - spin_lock_init(&queue->tx_lock); - spin_lock_init(&queue->index_lock); - - queue->rt2x00dev = rt2x00dev; - queue->qid = qid; - queue->txop = 0; - queue->aifs = 2; - queue->cw_min = 5; - queue->cw_max = 10; -} - -int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - enum data_queue_qid qid; - unsigned int req_atim = - !!test_bit(REQUIRE_ATIM_QUEUE, &rt2x00dev->cap_flags); - - /* - * We need the following queues: - * RX: 1 - * TX: ops->tx_queues - * Beacon: 1 - * Atim: 1 (if required) - */ - rt2x00dev->data_queues = 2 + rt2x00dev->ops->tx_queues + req_atim; - - queue = kcalloc(rt2x00dev->data_queues, sizeof(*queue), GFP_KERNEL); - if (!queue) { - rt2x00_err(rt2x00dev, "Queue allocation failed\n"); - return -ENOMEM; - } - - /* - * Initialize pointers - */ - rt2x00dev->rx = queue; - rt2x00dev->tx = &queue[1]; - rt2x00dev->bcn = &queue[1 + rt2x00dev->ops->tx_queues]; - rt2x00dev->atim = req_atim ? &queue[2 + rt2x00dev->ops->tx_queues] : NULL; - - /* - * Initialize queue parameters. - * RX: qid = QID_RX - * TX: qid = QID_AC_VO + index - * TX: cw_min: 2^5 = 32. - * TX: cw_max: 2^10 = 1024. - * BCN: qid = QID_BEACON - * ATIM: qid = QID_ATIM - */ - rt2x00queue_init(rt2x00dev, rt2x00dev->rx, QID_RX); - - qid = QID_AC_VO; - tx_queue_for_each(rt2x00dev, queue) - rt2x00queue_init(rt2x00dev, queue, qid++); - - rt2x00queue_init(rt2x00dev, rt2x00dev->bcn, QID_BEACON); - if (req_atim) - rt2x00queue_init(rt2x00dev, rt2x00dev->atim, QID_ATIM); - - return 0; -} - -void rt2x00queue_free(struct rt2x00_dev *rt2x00dev) -{ - kfree(rt2x00dev->rx); - rt2x00dev->rx = NULL; - rt2x00dev->tx = NULL; - rt2x00dev->bcn = NULL; -} diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h deleted file mode 100644 index 4a7b34e9261b..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h +++ /dev/null @@ -1,704 +0,0 @@ -/* - Copyright (C) 2004 - 2010 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00 - Abstract: rt2x00 queue datastructures and routines - */ - -#ifndef RT2X00QUEUE_H -#define RT2X00QUEUE_H - -#include - -/** - * DOC: Entry frame size - * - * Ralink PCI devices demand the Frame size to be a multiple of 128 bytes, - * for USB devices this restriction does not apply, but the value of - * 2432 makes sense since it is big enough to contain the maximum fragment - * size according to the ieee802.11 specs. - * The aggregation size depends on support from the driver, but should - * be something around 3840 bytes. - */ -#define DATA_FRAME_SIZE 2432 -#define MGMT_FRAME_SIZE 256 -#define AGGREGATION_SIZE 3840 - -/** - * enum data_queue_qid: Queue identification - * - * @QID_AC_VO: AC VO queue - * @QID_AC_VI: AC VI queue - * @QID_AC_BE: AC BE queue - * @QID_AC_BK: AC BK queue - * @QID_HCCA: HCCA queue - * @QID_MGMT: MGMT queue (prio queue) - * @QID_RX: RX queue - * @QID_OTHER: None of the above (don't use, only present for completeness) - * @QID_BEACON: Beacon queue (value unspecified, don't send it to device) - * @QID_ATIM: Atim queue (value unspecified, don't send it to device) - */ -enum data_queue_qid { - QID_AC_VO = 0, - QID_AC_VI = 1, - QID_AC_BE = 2, - QID_AC_BK = 3, - QID_HCCA = 4, - QID_MGMT = 13, - QID_RX = 14, - QID_OTHER = 15, - QID_BEACON, - QID_ATIM, -}; - -/** - * enum skb_frame_desc_flags: Flags for &struct skb_frame_desc - * - * @SKBDESC_DMA_MAPPED_RX: &skb_dma field has been mapped for RX - * @SKBDESC_DMA_MAPPED_TX: &skb_dma field has been mapped for TX - * @SKBDESC_IV_STRIPPED: Frame contained a IV/EIV provided by - * mac80211 but was stripped for processing by the driver. - * @SKBDESC_NOT_MAC80211: Frame didn't originate from mac80211, - * don't try to pass it back. - * @SKBDESC_DESC_IN_SKB: The descriptor is at the start of the - * skb, instead of in the desc field. - */ -enum skb_frame_desc_flags { - SKBDESC_DMA_MAPPED_RX = 1 << 0, - SKBDESC_DMA_MAPPED_TX = 1 << 1, - SKBDESC_IV_STRIPPED = 1 << 2, - SKBDESC_NOT_MAC80211 = 1 << 3, - SKBDESC_DESC_IN_SKB = 1 << 4, -}; - -/** - * struct skb_frame_desc: Descriptor information for the skb buffer - * - * This structure is placed over the driver_data array, this means that - * this structure should not exceed the size of that array (40 bytes). - * - * @flags: Frame flags, see &enum skb_frame_desc_flags. - * @desc_len: Length of the frame descriptor. - * @tx_rate_idx: the index of the TX rate, used for TX status reporting - * @tx_rate_flags: the TX rate flags, used for TX status reporting - * @desc: Pointer to descriptor part of the frame. - * Note that this pointer could point to something outside - * of the scope of the skb->data pointer. - * @iv: IV/EIV data used during encryption/decryption. - * @skb_dma: (PCI-only) the DMA address associated with the sk buffer. - * @entry: The entry to which this sk buffer belongs. - */ -struct skb_frame_desc { - u8 flags; - - u8 desc_len; - u8 tx_rate_idx; - u8 tx_rate_flags; - - void *desc; - - __le32 iv[2]; - - dma_addr_t skb_dma; - - struct queue_entry *entry; -}; - -/** - * get_skb_frame_desc - Obtain the rt2x00 frame descriptor from a sk_buff. - * @skb: &struct sk_buff from where we obtain the &struct skb_frame_desc - */ -static inline struct skb_frame_desc* get_skb_frame_desc(struct sk_buff *skb) -{ - BUILD_BUG_ON(sizeof(struct skb_frame_desc) > - IEEE80211_TX_INFO_DRIVER_DATA_SIZE); - return (struct skb_frame_desc *)&IEEE80211_SKB_CB(skb)->driver_data; -} - -/** - * enum rxdone_entry_desc_flags: Flags for &struct rxdone_entry_desc - * - * @RXDONE_SIGNAL_PLCP: Signal field contains the plcp value. - * @RXDONE_SIGNAL_BITRATE: Signal field contains the bitrate value. - * @RXDONE_SIGNAL_MCS: Signal field contains the mcs value. - * @RXDONE_MY_BSS: Does this frame originate from device's BSS. - * @RXDONE_CRYPTO_IV: Driver provided IV/EIV data. - * @RXDONE_CRYPTO_ICV: Driver provided ICV data. - * @RXDONE_L2PAD: 802.11 payload has been padded to 4-byte boundary. - */ -enum rxdone_entry_desc_flags { - RXDONE_SIGNAL_PLCP = BIT(0), - RXDONE_SIGNAL_BITRATE = BIT(1), - RXDONE_SIGNAL_MCS = BIT(2), - RXDONE_MY_BSS = BIT(3), - RXDONE_CRYPTO_IV = BIT(4), - RXDONE_CRYPTO_ICV = BIT(5), - RXDONE_L2PAD = BIT(6), -}; - -/** - * RXDONE_SIGNAL_MASK - Define to mask off all &rxdone_entry_desc_flags flags - * except for the RXDONE_SIGNAL_* flags. This is useful to convert the dev_flags - * from &rxdone_entry_desc to a signal value type. - */ -#define RXDONE_SIGNAL_MASK \ - ( RXDONE_SIGNAL_PLCP | RXDONE_SIGNAL_BITRATE | RXDONE_SIGNAL_MCS ) - -/** - * struct rxdone_entry_desc: RX Entry descriptor - * - * Summary of information that has been read from the RX frame descriptor. - * - * @timestamp: RX Timestamp - * @signal: Signal of the received frame. - * @rssi: RSSI of the received frame. - * @size: Data size of the received frame. - * @flags: MAC80211 receive flags (See &enum mac80211_rx_flags). - * @dev_flags: Ralink receive flags (See &enum rxdone_entry_desc_flags). - * @rate_mode: Rate mode (See @enum rate_modulation). - * @cipher: Cipher type used during decryption. - * @cipher_status: Decryption status. - * @iv: IV/EIV data used during decryption. - * @icv: ICV data used during decryption. - */ -struct rxdone_entry_desc { - u64 timestamp; - int signal; - int rssi; - int size; - int flags; - int dev_flags; - u16 rate_mode; - u8 cipher; - u8 cipher_status; - - __le32 iv[2]; - __le32 icv; -}; - -/** - * enum txdone_entry_desc_flags: Flags for &struct txdone_entry_desc - * - * Every txdone report has to contain the basic result of the - * transmission, either &TXDONE_UNKNOWN, &TXDONE_SUCCESS or - * &TXDONE_FAILURE. The flag &TXDONE_FALLBACK can be used in - * conjunction with all of these flags but should only be set - * if retires > 0. The flag &TXDONE_EXCESSIVE_RETRY can only be used - * in conjunction with &TXDONE_FAILURE. - * - * @TXDONE_UNKNOWN: Hardware could not determine success of transmission. - * @TXDONE_SUCCESS: Frame was successfully send - * @TXDONE_FALLBACK: Hardware used fallback rates for retries - * @TXDONE_FAILURE: Frame was not successfully send - * @TXDONE_EXCESSIVE_RETRY: In addition to &TXDONE_FAILURE, the - * frame transmission failed due to excessive retries. - */ -enum txdone_entry_desc_flags { - TXDONE_UNKNOWN, - TXDONE_SUCCESS, - TXDONE_FALLBACK, - TXDONE_FAILURE, - TXDONE_EXCESSIVE_RETRY, - TXDONE_AMPDU, -}; - -/** - * struct txdone_entry_desc: TX done entry descriptor - * - * Summary of information that has been read from the TX frame descriptor - * after the device is done with transmission. - * - * @flags: TX done flags (See &enum txdone_entry_desc_flags). - * @retry: Retry count. - */ -struct txdone_entry_desc { - unsigned long flags; - int retry; -}; - -/** - * enum txentry_desc_flags: Status flags for TX entry descriptor - * - * @ENTRY_TXD_RTS_FRAME: This frame is a RTS frame. - * @ENTRY_TXD_CTS_FRAME: This frame is a CTS-to-self frame. - * @ENTRY_TXD_GENERATE_SEQ: This frame requires sequence counter. - * @ENTRY_TXD_FIRST_FRAGMENT: This is the first frame. - * @ENTRY_TXD_MORE_FRAG: This frame is followed by another fragment. - * @ENTRY_TXD_REQ_TIMESTAMP: Require timestamp to be inserted. - * @ENTRY_TXD_BURST: This frame belongs to the same burst event. - * @ENTRY_TXD_ACK: An ACK is required for this frame. - * @ENTRY_TXD_RETRY_MODE: When set, the long retry count is used. - * @ENTRY_TXD_ENCRYPT: This frame should be encrypted. - * @ENTRY_TXD_ENCRYPT_PAIRWISE: Use pairwise key table (instead of shared). - * @ENTRY_TXD_ENCRYPT_IV: Generate IV/EIV in hardware. - * @ENTRY_TXD_ENCRYPT_MMIC: Generate MIC in hardware. - * @ENTRY_TXD_HT_AMPDU: This frame is part of an AMPDU. - * @ENTRY_TXD_HT_BW_40: Use 40MHz Bandwidth. - * @ENTRY_TXD_HT_SHORT_GI: Use short GI. - * @ENTRY_TXD_HT_MIMO_PS: The receiving STA is in dynamic SM PS mode. - */ -enum txentry_desc_flags { - ENTRY_TXD_RTS_FRAME, - ENTRY_TXD_CTS_FRAME, - ENTRY_TXD_GENERATE_SEQ, - ENTRY_TXD_FIRST_FRAGMENT, - ENTRY_TXD_MORE_FRAG, - ENTRY_TXD_REQ_TIMESTAMP, - ENTRY_TXD_BURST, - ENTRY_TXD_ACK, - ENTRY_TXD_RETRY_MODE, - ENTRY_TXD_ENCRYPT, - ENTRY_TXD_ENCRYPT_PAIRWISE, - ENTRY_TXD_ENCRYPT_IV, - ENTRY_TXD_ENCRYPT_MMIC, - ENTRY_TXD_HT_AMPDU, - ENTRY_TXD_HT_BW_40, - ENTRY_TXD_HT_SHORT_GI, - ENTRY_TXD_HT_MIMO_PS, -}; - -/** - * struct txentry_desc: TX Entry descriptor - * - * Summary of information for the frame descriptor before sending a TX frame. - * - * @flags: Descriptor flags (See &enum queue_entry_flags). - * @length: Length of the entire frame. - * @header_length: Length of 802.11 header. - * @length_high: PLCP length high word. - * @length_low: PLCP length low word. - * @signal: PLCP signal. - * @service: PLCP service. - * @msc: MCS. - * @stbc: Use Space Time Block Coding (only available for MCS rates < 8). - * @ba_size: Size of the recepients RX reorder buffer - 1. - * @rate_mode: Rate mode (See @enum rate_modulation). - * @mpdu_density: MDPU density. - * @retry_limit: Max number of retries. - * @ifs: IFS value. - * @txop: IFS value for 11n capable chips. - * @cipher: Cipher type used for encryption. - * @key_idx: Key index used for encryption. - * @iv_offset: Position where IV should be inserted by hardware. - * @iv_len: Length of IV data. - */ -struct txentry_desc { - unsigned long flags; - - u16 length; - u16 header_length; - - union { - struct { - u16 length_high; - u16 length_low; - u16 signal; - u16 service; - enum ifs ifs; - } plcp; - - struct { - u16 mcs; - u8 stbc; - u8 ba_size; - u8 mpdu_density; - enum txop txop; - int wcid; - } ht; - } u; - - enum rate_modulation rate_mode; - - short retry_limit; - - enum cipher cipher; - u16 key_idx; - u16 iv_offset; - u16 iv_len; -}; - -/** - * enum queue_entry_flags: Status flags for queue entry - * - * @ENTRY_BCN_ASSIGNED: This entry has been assigned to an interface. - * As long as this bit is set, this entry may only be touched - * through the interface structure. - * @ENTRY_OWNER_DEVICE_DATA: This entry is owned by the device for data - * transfer (either TX or RX depending on the queue). The entry should - * only be touched after the device has signaled it is done with it. - * @ENTRY_DATA_PENDING: This entry contains a valid frame and is waiting - * for the signal to start sending. - * @ENTRY_DATA_IO_FAILED: Hardware indicated that an IO error occurred - * while transferring the data to the hardware. No TX status report will - * be expected from the hardware. - * @ENTRY_DATA_STATUS_PENDING: The entry has been send to the device and - * returned. It is now waiting for the status reporting before the - * entry can be reused again. - */ -enum queue_entry_flags { - ENTRY_BCN_ASSIGNED, - ENTRY_OWNER_DEVICE_DATA, - ENTRY_DATA_PENDING, - ENTRY_DATA_IO_FAILED, - ENTRY_DATA_STATUS_PENDING, - ENTRY_DATA_STATUS_SET, -}; - -/** - * struct queue_entry: Entry inside the &struct data_queue - * - * @flags: Entry flags, see &enum queue_entry_flags. - * @last_action: Timestamp of last change. - * @queue: The data queue (&struct data_queue) to which this entry belongs. - * @skb: The buffer which is currently being transmitted (for TX queue), - * or used to directly receive data in (for RX queue). - * @entry_idx: The entry index number. - * @priv_data: Private data belonging to this queue entry. The pointer - * points to data specific to a particular driver and queue type. - * @status: Device specific status - */ -struct queue_entry { - unsigned long flags; - unsigned long last_action; - - struct data_queue *queue; - - struct sk_buff *skb; - - unsigned int entry_idx; - - u32 status; - - void *priv_data; -}; - -/** - * enum queue_index: Queue index type - * - * @Q_INDEX: Index pointer to the current entry in the queue, if this entry is - * owned by the hardware then the queue is considered to be full. - * @Q_INDEX_DMA_DONE: Index pointer for the next entry which will have been - * transferred to the hardware. - * @Q_INDEX_DONE: Index pointer to the next entry which will be completed by - * the hardware and for which we need to run the txdone handler. If this - * entry is not owned by the hardware the queue is considered to be empty. - * @Q_INDEX_MAX: Keep last, used in &struct data_queue to determine the size - * of the index array. - */ -enum queue_index { - Q_INDEX, - Q_INDEX_DMA_DONE, - Q_INDEX_DONE, - Q_INDEX_MAX, -}; - -/** - * enum data_queue_flags: Status flags for data queues - * - * @QUEUE_STARTED: The queue has been started. Fox RX queues this means the - * device might be DMA'ing skbuffers. TX queues will accept skbuffers to - * be transmitted and beacon queues will start beaconing the configured - * beacons. - * @QUEUE_PAUSED: The queue has been started but is currently paused. - * When this bit is set, the queue has been stopped in mac80211, - * preventing new frames to be enqueued. However, a few frames - * might still appear shortly after the pausing... - */ -enum data_queue_flags { - QUEUE_STARTED, - QUEUE_PAUSED, -}; - -/** - * struct data_queue: Data queue - * - * @rt2x00dev: Pointer to main &struct rt2x00dev where this queue belongs to. - * @entries: Base address of the &struct queue_entry which are - * part of this queue. - * @qid: The queue identification, see &enum data_queue_qid. - * @flags: Entry flags, see &enum queue_entry_flags. - * @status_lock: The mutex for protecting the start/stop/flush - * handling on this queue. - * @tx_lock: Spinlock to serialize tx operations on this queue. - * @index_lock: Spinlock to protect index handling. Whenever @index, @index_done or - * @index_crypt needs to be changed this lock should be grabbed to prevent - * index corruption due to concurrency. - * @count: Number of frames handled in the queue. - * @limit: Maximum number of entries in the queue. - * @threshold: Minimum number of free entries before queue is kicked by force. - * @length: Number of frames in queue. - * @index: Index pointers to entry positions in the queue, - * use &enum queue_index to get a specific index field. - * @txop: maximum burst time. - * @aifs: The aifs value for outgoing frames (field ignored in RX queue). - * @cw_min: The cw min value for outgoing frames (field ignored in RX queue). - * @cw_max: The cw max value for outgoing frames (field ignored in RX queue). - * @data_size: Maximum data size for the frames in this queue. - * @desc_size: Hardware descriptor size for the data in this queue. - * @usb_endpoint: Device endpoint used for communication (USB only) - * @usb_maxpacket: Max packet size for given endpoint (USB only) - */ -struct data_queue { - struct rt2x00_dev *rt2x00dev; - struct queue_entry *entries; - - enum data_queue_qid qid; - unsigned long flags; - - struct mutex status_lock; - spinlock_t tx_lock; - spinlock_t index_lock; - - unsigned int count; - unsigned short limit; - unsigned short threshold; - unsigned short length; - unsigned short index[Q_INDEX_MAX]; - - unsigned short txop; - unsigned short aifs; - unsigned short cw_min; - unsigned short cw_max; - - unsigned short data_size; - unsigned char desc_size; - unsigned char winfo_size; - - unsigned short usb_endpoint; - unsigned short usb_maxpacket; -}; - -/** - * struct data_queue_desc: Data queue description - * - * The information in this structure is used by drivers - * to inform rt2x00lib about the creation of the data queue. - * - * @entry_num: Maximum number of entries for a queue. - * @data_size: Maximum data size for the frames in this queue. - * @desc_size: Hardware descriptor size for the data in this queue. - * @priv_size: Size of per-queue_entry private data. - */ -struct data_queue_desc { - unsigned short entry_num; - unsigned short data_size; - unsigned char desc_size; - unsigned char winfo_size; - unsigned short priv_size; -}; - -/** - * queue_end - Return pointer to the last queue (HELPER MACRO). - * @__dev: Pointer to &struct rt2x00_dev - * - * Using the base rx pointer and the maximum number of available queues, - * this macro will return the address of 1 position beyond the end of the - * queues array. - */ -#define queue_end(__dev) \ - &(__dev)->rx[(__dev)->data_queues] - -/** - * tx_queue_end - Return pointer to the last TX queue (HELPER MACRO). - * @__dev: Pointer to &struct rt2x00_dev - * - * Using the base tx pointer and the maximum number of available TX - * queues, this macro will return the address of 1 position beyond - * the end of the TX queue array. - */ -#define tx_queue_end(__dev) \ - &(__dev)->tx[(__dev)->ops->tx_queues] - -/** - * queue_next - Return pointer to next queue in list (HELPER MACRO). - * @__queue: Current queue for which we need the next queue - * - * Using the current queue address we take the address directly - * after the queue to take the next queue. Note that this macro - * should be used carefully since it does not protect against - * moving past the end of the list. (See macros &queue_end and - * &tx_queue_end for determining the end of the queue). - */ -#define queue_next(__queue) \ - &(__queue)[1] - -/** - * queue_loop - Loop through the queues within a specific range (HELPER MACRO). - * @__entry: Pointer where the current queue entry will be stored in. - * @__start: Start queue pointer. - * @__end: End queue pointer. - * - * This macro will loop through all queues between &__start and &__end. - */ -#define queue_loop(__entry, __start, __end) \ - for ((__entry) = (__start); \ - prefetch(queue_next(__entry)), (__entry) != (__end);\ - (__entry) = queue_next(__entry)) - -/** - * queue_for_each - Loop through all queues - * @__dev: Pointer to &struct rt2x00_dev - * @__entry: Pointer where the current queue entry will be stored in. - * - * This macro will loop through all available queues. - */ -#define queue_for_each(__dev, __entry) \ - queue_loop(__entry, (__dev)->rx, queue_end(__dev)) - -/** - * tx_queue_for_each - Loop through the TX queues - * @__dev: Pointer to &struct rt2x00_dev - * @__entry: Pointer where the current queue entry will be stored in. - * - * This macro will loop through all TX related queues excluding - * the Beacon and Atim queues. - */ -#define tx_queue_for_each(__dev, __entry) \ - queue_loop(__entry, (__dev)->tx, tx_queue_end(__dev)) - -/** - * txall_queue_for_each - Loop through all TX related queues - * @__dev: Pointer to &struct rt2x00_dev - * @__entry: Pointer where the current queue entry will be stored in. - * - * This macro will loop through all TX related queues including - * the Beacon and Atim queues. - */ -#define txall_queue_for_each(__dev, __entry) \ - queue_loop(__entry, (__dev)->tx, queue_end(__dev)) - -/** - * rt2x00queue_for_each_entry - Loop through all entries in the queue - * @queue: Pointer to @data_queue - * @start: &enum queue_index Pointer to start index - * @end: &enum queue_index Pointer to end index - * @data: Data to pass to the callback function - * @fn: The function to call for each &struct queue_entry - * - * This will walk through all entries in the queue, in chronological - * order. This means it will start at the current @start pointer - * and will walk through the queue until it reaches the @end pointer. - * - * If fn returns true for an entry rt2x00queue_for_each_entry will stop - * processing and return true as well. - */ -bool rt2x00queue_for_each_entry(struct data_queue *queue, - enum queue_index start, - enum queue_index end, - void *data, - bool (*fn)(struct queue_entry *entry, - void *data)); - -/** - * rt2x00queue_empty - Check if the queue is empty. - * @queue: Queue to check if empty. - */ -static inline int rt2x00queue_empty(struct data_queue *queue) -{ - return queue->length == 0; -} - -/** - * rt2x00queue_full - Check if the queue is full. - * @queue: Queue to check if full. - */ -static inline int rt2x00queue_full(struct data_queue *queue) -{ - return queue->length == queue->limit; -} - -/** - * rt2x00queue_free - Check the number of available entries in queue. - * @queue: Queue to check. - */ -static inline int rt2x00queue_available(struct data_queue *queue) -{ - return queue->limit - queue->length; -} - -/** - * rt2x00queue_threshold - Check if the queue is below threshold - * @queue: Queue to check. - */ -static inline int rt2x00queue_threshold(struct data_queue *queue) -{ - return rt2x00queue_available(queue) < queue->threshold; -} -/** - * rt2x00queue_dma_timeout - Check if a timeout occurred for DMA transfers - * @entry: Queue entry to check. - */ -static inline int rt2x00queue_dma_timeout(struct queue_entry *entry) -{ - if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) - return false; - return time_after(jiffies, entry->last_action + msecs_to_jiffies(100)); -} - -/** - * _rt2x00_desc_read - Read a word from the hardware descriptor. - * @desc: Base descriptor address - * @word: Word index from where the descriptor should be read. - * @value: Address where the descriptor value should be written into. - */ -static inline void _rt2x00_desc_read(__le32 *desc, const u8 word, __le32 *value) -{ - *value = desc[word]; -} - -/** - * rt2x00_desc_read - Read a word from the hardware descriptor, this - * function will take care of the byte ordering. - * @desc: Base descriptor address - * @word: Word index from where the descriptor should be read. - * @value: Address where the descriptor value should be written into. - */ -static inline void rt2x00_desc_read(__le32 *desc, const u8 word, u32 *value) -{ - __le32 tmp; - _rt2x00_desc_read(desc, word, &tmp); - *value = le32_to_cpu(tmp); -} - -/** - * rt2x00_desc_write - write a word to the hardware descriptor, this - * function will take care of the byte ordering. - * @desc: Base descriptor address - * @word: Word index from where the descriptor should be written. - * @value: Value that should be written into the descriptor. - */ -static inline void _rt2x00_desc_write(__le32 *desc, const u8 word, __le32 value) -{ - desc[word] = value; -} - -/** - * rt2x00_desc_write - write a word to the hardware descriptor. - * @desc: Base descriptor address - * @word: Word index from where the descriptor should be written. - * @value: Value that should be written into the descriptor. - */ -static inline void rt2x00_desc_write(__le32 *desc, const u8 word, u32 value) -{ - _rt2x00_desc_write(desc, word, cpu_to_le32(value)); -} - -#endif /* RT2X00QUEUE_H */ diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h deleted file mode 100644 index 6f867eec49cc..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00reg.h +++ /dev/null @@ -1,279 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00 - Abstract: rt2x00 generic register information. - */ - -#ifndef RT2X00REG_H -#define RT2X00REG_H - -/* - * RX crypto status - */ -enum rx_crypto { - RX_CRYPTO_SUCCESS = 0, - RX_CRYPTO_FAIL_ICV = 1, - RX_CRYPTO_FAIL_MIC = 2, - RX_CRYPTO_FAIL_KEY = 3, -}; - -/* - * Antenna values - */ -enum antenna { - ANTENNA_SW_DIVERSITY = 0, - ANTENNA_A = 1, - ANTENNA_B = 2, - ANTENNA_HW_DIVERSITY = 3, -}; - -/* - * Led mode values. - */ -enum led_mode { - LED_MODE_DEFAULT = 0, - LED_MODE_TXRX_ACTIVITY = 1, - LED_MODE_SIGNAL_STRENGTH = 2, - LED_MODE_ASUS = 3, - LED_MODE_ALPHA = 4, -}; - -/* - * TSF sync values - */ -enum tsf_sync { - TSF_SYNC_NONE = 0, - TSF_SYNC_INFRA = 1, - TSF_SYNC_ADHOC = 2, - TSF_SYNC_AP_NONE = 3, -}; - -/* - * Device states - */ -enum dev_state { - STATE_DEEP_SLEEP = 0, - STATE_SLEEP = 1, - STATE_STANDBY = 2, - STATE_AWAKE = 3, - -/* - * Additional device states, these values are - * not strict since they are not directly passed - * into the device. - */ - STATE_RADIO_ON, - STATE_RADIO_OFF, - STATE_RADIO_IRQ_ON, - STATE_RADIO_IRQ_OFF, -}; - -/* - * IFS backoff values - */ -enum ifs { - IFS_BACKOFF = 0, - IFS_SIFS = 1, - IFS_NEW_BACKOFF = 2, - IFS_NONE = 3, -}; - -/* - * IFS backoff values for HT devices - */ -enum txop { - TXOP_HTTXOP = 0, - TXOP_PIFS = 1, - TXOP_SIFS = 2, - TXOP_BACKOFF = 3, -}; - -/* - * Cipher types for hardware encryption - */ -enum cipher { - CIPHER_NONE = 0, - CIPHER_WEP64 = 1, - CIPHER_WEP128 = 2, - CIPHER_TKIP = 3, - CIPHER_AES = 4, -/* - * The following fields were added by rt61pci and rt73usb. - */ - CIPHER_CKIP64 = 5, - CIPHER_CKIP128 = 6, - CIPHER_TKIP_NO_MIC = 7, /* Don't send to device */ - -/* - * Max cipher type. - * Note that CIPHER_NONE isn't counted, and CKIP64 and CKIP128 - * are excluded due to limitations in mac80211. - */ - CIPHER_MAX = 4, -}; - -/* - * Rate modulations - */ -enum rate_modulation { - RATE_MODE_CCK = 0, - RATE_MODE_OFDM = 1, - RATE_MODE_HT_MIX = 2, - RATE_MODE_HT_GREENFIELD = 3, -}; - -/* - * Firmware validation error codes - */ -enum firmware_errors { - FW_OK, - FW_BAD_CRC, - FW_BAD_LENGTH, - FW_BAD_VERSION, -}; - -/* - * Register handlers. - * We store the position of a register field inside a field structure, - * This will simplify the process of setting and reading a certain field - * inside the register while making sure the process remains byte order safe. - */ -struct rt2x00_field8 { - u8 bit_offset; - u8 bit_mask; -}; - -struct rt2x00_field16 { - u16 bit_offset; - u16 bit_mask; -}; - -struct rt2x00_field32 { - u32 bit_offset; - u32 bit_mask; -}; - -/* - * Power of two check, this will check - * if the mask that has been given contains and contiguous set of bits. - * Note that we cannot use the is_power_of_2() function since this - * check must be done at compile-time. - */ -#define is_power_of_two(x) ( !((x) & ((x)-1)) ) -#define low_bit_mask(x) ( ((x)-1) & ~(x) ) -#define is_valid_mask(x) is_power_of_two(1LU + (x) + low_bit_mask(x)) - -/* - * Macros to find first set bit in a variable. - * These macros behave the same as the __ffs() functions but - * the most important difference that this is done during - * compile-time rather then run-time. - */ -#define compile_ffs2(__x) \ - __builtin_choose_expr(((__x) & 0x1), 0, 1) - -#define compile_ffs4(__x) \ - __builtin_choose_expr(((__x) & 0x3), \ - (compile_ffs2((__x))), \ - (compile_ffs2((__x) >> 2) + 2)) - -#define compile_ffs8(__x) \ - __builtin_choose_expr(((__x) & 0xf), \ - (compile_ffs4((__x))), \ - (compile_ffs4((__x) >> 4) + 4)) - -#define compile_ffs16(__x) \ - __builtin_choose_expr(((__x) & 0xff), \ - (compile_ffs8((__x))), \ - (compile_ffs8((__x) >> 8) + 8)) - -#define compile_ffs32(__x) \ - __builtin_choose_expr(((__x) & 0xffff), \ - (compile_ffs16((__x))), \ - (compile_ffs16((__x) >> 16) + 16)) - -/* - * This macro will check the requirements for the FIELD{8,16,32} macros - * The mask should be a constant non-zero contiguous set of bits which - * does not exceed the given typelimit. - */ -#define FIELD_CHECK(__mask, __type) \ - BUILD_BUG_ON(!(__mask) || \ - !is_valid_mask(__mask) || \ - (__mask) != (__type)(__mask)) \ - -#define FIELD8(__mask) \ -({ \ - FIELD_CHECK(__mask, u8); \ - (struct rt2x00_field8) { \ - compile_ffs8(__mask), (__mask) \ - }; \ -}) - -#define FIELD16(__mask) \ -({ \ - FIELD_CHECK(__mask, u16); \ - (struct rt2x00_field16) { \ - compile_ffs16(__mask), (__mask) \ - }; \ -}) - -#define FIELD32(__mask) \ -({ \ - FIELD_CHECK(__mask, u32); \ - (struct rt2x00_field32) { \ - compile_ffs32(__mask), (__mask) \ - }; \ -}) - -#define SET_FIELD(__reg, __type, __field, __value)\ -({ \ - typecheck(__type, __field); \ - *(__reg) &= ~((__field).bit_mask); \ - *(__reg) |= ((__value) << \ - ((__field).bit_offset)) & \ - ((__field).bit_mask); \ -}) - -#define GET_FIELD(__reg, __type, __field) \ -({ \ - typecheck(__type, __field); \ - ((__reg) & ((__field).bit_mask)) >> \ - ((__field).bit_offset); \ -}) - -#define rt2x00_set_field32(__reg, __field, __value) \ - SET_FIELD(__reg, struct rt2x00_field32, __field, __value) -#define rt2x00_get_field32(__reg, __field) \ - GET_FIELD(__reg, struct rt2x00_field32, __field) - -#define rt2x00_set_field16(__reg, __field, __value) \ - SET_FIELD(__reg, struct rt2x00_field16, __field, __value) -#define rt2x00_get_field16(__reg, __field) \ - GET_FIELD(__reg, struct rt2x00_field16, __field) - -#define rt2x00_set_field8(__reg, __field, __value) \ - SET_FIELD(__reg, struct rt2x00_field8, __field, __value) -#define rt2x00_get_field8(__reg, __field) \ - GET_FIELD(__reg, struct rt2x00_field8, __field) - -#endif /* RT2X00REG_H */ diff --git a/drivers/net/wireless/rt2x00/rt2x00soc.c b/drivers/net/wireless/rt2x00/rt2x00soc.c deleted file mode 100644 index 9271a5fce0a8..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00soc.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - Copyright (C) 2004 - 2009 Felix Fietkau - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00soc - Abstract: rt2x00 generic soc device routines. - */ - -#include -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2x00soc.h" - -static void rt2x00soc_free_reg(struct rt2x00_dev *rt2x00dev) -{ - kfree(rt2x00dev->rf); - rt2x00dev->rf = NULL; - - kfree(rt2x00dev->eeprom); - rt2x00dev->eeprom = NULL; - - iounmap(rt2x00dev->csr.base); -} - -static int rt2x00soc_alloc_reg(struct rt2x00_dev *rt2x00dev) -{ - struct platform_device *pdev = to_platform_device(rt2x00dev->dev); - struct resource *res; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; - - rt2x00dev->csr.base = ioremap(res->start, resource_size(res)); - if (!rt2x00dev->csr.base) - return -ENOMEM; - - rt2x00dev->eeprom = kzalloc(rt2x00dev->ops->eeprom_size, GFP_KERNEL); - if (!rt2x00dev->eeprom) - goto exit; - - rt2x00dev->rf = kzalloc(rt2x00dev->ops->rf_size, GFP_KERNEL); - if (!rt2x00dev->rf) - goto exit; - - return 0; - -exit: - rt2x00_probe_err("Failed to allocate registers\n"); - rt2x00soc_free_reg(rt2x00dev); - - return -ENOMEM; -} - -int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops *ops) -{ - struct ieee80211_hw *hw; - struct rt2x00_dev *rt2x00dev; - int retval; - - hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw); - if (!hw) { - rt2x00_probe_err("Failed to allocate hardware\n"); - return -ENOMEM; - } - - platform_set_drvdata(pdev, hw); - - rt2x00dev = hw->priv; - rt2x00dev->dev = &pdev->dev; - rt2x00dev->ops = ops; - rt2x00dev->hw = hw; - rt2x00dev->irq = platform_get_irq(pdev, 0); - rt2x00dev->name = pdev->dev.driver->name; - - rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC); - - retval = rt2x00soc_alloc_reg(rt2x00dev); - if (retval) - goto exit_free_device; - - retval = rt2x00lib_probe_dev(rt2x00dev); - if (retval) - goto exit_free_reg; - - return 0; - -exit_free_reg: - rt2x00soc_free_reg(rt2x00dev); - -exit_free_device: - ieee80211_free_hw(hw); - - return retval; -} -EXPORT_SYMBOL_GPL(rt2x00soc_probe); - -int rt2x00soc_remove(struct platform_device *pdev) -{ - struct ieee80211_hw *hw = platform_get_drvdata(pdev); - struct rt2x00_dev *rt2x00dev = hw->priv; - - /* - * Free all allocated data. - */ - rt2x00lib_remove_dev(rt2x00dev); - rt2x00soc_free_reg(rt2x00dev); - ieee80211_free_hw(hw); - - return 0; -} -EXPORT_SYMBOL_GPL(rt2x00soc_remove); - -#ifdef CONFIG_PM -int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state) -{ - struct ieee80211_hw *hw = platform_get_drvdata(pdev); - struct rt2x00_dev *rt2x00dev = hw->priv; - - return rt2x00lib_suspend(rt2x00dev, state); -} -EXPORT_SYMBOL_GPL(rt2x00soc_suspend); - -int rt2x00soc_resume(struct platform_device *pdev) -{ - struct ieee80211_hw *hw = platform_get_drvdata(pdev); - struct rt2x00_dev *rt2x00dev = hw->priv; - - return rt2x00lib_resume(rt2x00dev); -} -EXPORT_SYMBOL_GPL(rt2x00soc_resume); -#endif /* CONFIG_PM */ - -/* - * rt2x00soc module information. - */ -MODULE_AUTHOR(DRV_PROJECT); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION("rt2x00 soc library"); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/rt2x00/rt2x00soc.h b/drivers/net/wireless/rt2x00/rt2x00soc.h deleted file mode 100644 index 474cbfc1efc7..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00soc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00soc - Abstract: Data structures for the rt2x00soc module. - */ - -#ifndef RT2X00SOC_H -#define RT2X00SOC_H - -/* - * SoC driver handlers. - */ -int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops *ops); -int rt2x00soc_remove(struct platform_device *pdev); -#ifdef CONFIG_PM -int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state); -int rt2x00soc_resume(struct platform_device *pdev); -#else -#define rt2x00soc_suspend NULL -#define rt2x00soc_resume NULL -#endif /* CONFIG_PM */ - -#endif /* RT2X00SOC_H */ diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c deleted file mode 100644 index 88289873c0cf..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ /dev/null @@ -1,888 +0,0 @@ -/* - Copyright (C) 2010 Willow Garage - Copyright (C) 2004 - 2010 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00usb - Abstract: rt2x00 generic usb device routines. - */ - -#include -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2x00usb.h" - -/* - * Interfacing with the HW. - */ -int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev, - const u8 request, const u8 requesttype, - const u16 offset, const u16 value, - void *buffer, const u16 buffer_length, - const int timeout) -{ - struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); - int status; - unsigned int i; - unsigned int pipe = - (requesttype == USB_VENDOR_REQUEST_IN) ? - usb_rcvctrlpipe(usb_dev, 0) : usb_sndctrlpipe(usb_dev, 0); - - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - return -ENODEV; - - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - status = usb_control_msg(usb_dev, pipe, request, requesttype, - value, offset, buffer, buffer_length, - timeout); - if (status >= 0) - return 0; - - /* - * Check for errors - * -ENODEV: Device has disappeared, no point continuing. - * All other errors: Try again. - */ - else if (status == -ENODEV) { - clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); - break; - } - } - - rt2x00_err(rt2x00dev, - "Vendor Request 0x%02x failed for offset 0x%04x with error %d\n", - request, offset, status); - - return status; -} -EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request); - -int rt2x00usb_vendor_req_buff_lock(struct rt2x00_dev *rt2x00dev, - const u8 request, const u8 requesttype, - const u16 offset, void *buffer, - const u16 buffer_length, const int timeout) -{ - int status; - - BUG_ON(!mutex_is_locked(&rt2x00dev->csr_mutex)); - - /* - * Check for Cache availability. - */ - if (unlikely(!rt2x00dev->csr.cache || buffer_length > CSR_CACHE_SIZE)) { - rt2x00_err(rt2x00dev, "CSR cache not available\n"); - return -ENOMEM; - } - - if (requesttype == USB_VENDOR_REQUEST_OUT) - memcpy(rt2x00dev->csr.cache, buffer, buffer_length); - - status = rt2x00usb_vendor_request(rt2x00dev, request, requesttype, - offset, 0, rt2x00dev->csr.cache, - buffer_length, timeout); - - if (!status && requesttype == USB_VENDOR_REQUEST_IN) - memcpy(buffer, rt2x00dev->csr.cache, buffer_length); - - return status; -} -EXPORT_SYMBOL_GPL(rt2x00usb_vendor_req_buff_lock); - -int rt2x00usb_vendor_request_buff(struct rt2x00_dev *rt2x00dev, - const u8 request, const u8 requesttype, - const u16 offset, void *buffer, - const u16 buffer_length, const int timeout) -{ - int status = 0; - unsigned char *tb; - u16 off, len, bsize; - - mutex_lock(&rt2x00dev->csr_mutex); - - tb = (char *)buffer; - off = offset; - len = buffer_length; - while (len && !status) { - bsize = min_t(u16, CSR_CACHE_SIZE, len); - status = rt2x00usb_vendor_req_buff_lock(rt2x00dev, request, - requesttype, off, tb, - bsize, timeout); - - tb += bsize; - len -= bsize; - off += bsize; - } - - mutex_unlock(&rt2x00dev->csr_mutex); - - return status; -} -EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_buff); - -int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - const struct rt2x00_field32 field, - u32 *reg) -{ - unsigned int i; - - if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) - return -ENODEV; - - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2x00usb_register_read_lock(rt2x00dev, offset, reg); - if (!rt2x00_get_field32(*reg, field)) - return 1; - udelay(REGISTER_BUSY_DELAY); - } - - rt2x00_err(rt2x00dev, "Indirect register access failed: offset=0x%.08x, value=0x%.08x\n", - offset, *reg); - *reg = ~0; - - return 0; -} -EXPORT_SYMBOL_GPL(rt2x00usb_regbusy_read); - - -struct rt2x00_async_read_data { - __le32 reg; - struct usb_ctrlrequest cr; - struct rt2x00_dev *rt2x00dev; - bool (*callback)(struct rt2x00_dev *, int, u32); -}; - -static void rt2x00usb_register_read_async_cb(struct urb *urb) -{ - struct rt2x00_async_read_data *rd = urb->context; - if (rd->callback(rd->rt2x00dev, urb->status, le32_to_cpu(rd->reg))) { - if (usb_submit_urb(urb, GFP_ATOMIC) < 0) - kfree(rd); - } else - kfree(rd); -} - -void rt2x00usb_register_read_async(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - bool (*callback)(struct rt2x00_dev*, int, u32)) -{ - struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); - struct urb *urb; - struct rt2x00_async_read_data *rd; - - rd = kmalloc(sizeof(*rd), GFP_ATOMIC); - if (!rd) - return; - - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!urb) { - kfree(rd); - return; - } - - rd->rt2x00dev = rt2x00dev; - rd->callback = callback; - rd->cr.bRequestType = USB_VENDOR_REQUEST_IN; - rd->cr.bRequest = USB_MULTI_READ; - rd->cr.wValue = 0; - rd->cr.wIndex = cpu_to_le16(offset); - rd->cr.wLength = cpu_to_le16(sizeof(u32)); - - usb_fill_control_urb(urb, usb_dev, usb_rcvctrlpipe(usb_dev, 0), - (unsigned char *)(&rd->cr), &rd->reg, sizeof(rd->reg), - rt2x00usb_register_read_async_cb, rd); - if (usb_submit_urb(urb, GFP_ATOMIC) < 0) - kfree(rd); - usb_free_urb(urb); -} -EXPORT_SYMBOL_GPL(rt2x00usb_register_read_async); - -/* - * TX data handlers. - */ -static void rt2x00usb_work_txdone_entry(struct queue_entry *entry) -{ - /* - * If the transfer to hardware succeeded, it does not mean the - * frame was send out correctly. It only means the frame - * was successfully pushed to the hardware, we have no - * way to determine the transmission status right now. - * (Only indirectly by looking at the failed TX counters - * in the register). - */ - if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags)) - rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE); - else - rt2x00lib_txdone_noinfo(entry, TXDONE_UNKNOWN); -} - -static void rt2x00usb_work_txdone(struct work_struct *work) -{ - struct rt2x00_dev *rt2x00dev = - container_of(work, struct rt2x00_dev, txdone_work); - struct data_queue *queue; - struct queue_entry *entry; - - tx_queue_for_each(rt2x00dev, queue) { - while (!rt2x00queue_empty(queue)) { - entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE); - - if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || - !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) - break; - - rt2x00usb_work_txdone_entry(entry); - } - } -} - -static void rt2x00usb_interrupt_txdone(struct urb *urb) -{ - struct queue_entry *entry = (struct queue_entry *)urb->context; - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - - if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) - return; - /* - * Check if the frame was correctly uploaded - */ - if (urb->status) - set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); - /* - * Report the frame as DMA done - */ - rt2x00lib_dmadone(entry); - - if (rt2x00dev->ops->lib->tx_dma_done) - rt2x00dev->ops->lib->tx_dma_done(entry); - /* - * Schedule the delayed work for reading the TX status - * from the device. - */ - if (!test_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags) || - !kfifo_is_empty(&rt2x00dev->txstatus_fifo)) - queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); -} - -static bool rt2x00usb_kick_tx_entry(struct queue_entry *entry, void *data) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); - struct queue_entry_priv_usb *entry_priv = entry->priv_data; - u32 length; - int status; - - if (!test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags) || - test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) - return false; - - /* - * USB devices require certain padding at the end of each frame - * and urb. Those paddings are not included in skbs. Pass entry - * to the driver to determine what the overall length should be. - */ - length = rt2x00dev->ops->lib->get_tx_data_len(entry); - - status = skb_padto(entry->skb, length); - if (unlikely(status)) { - /* TODO: report something more appropriate than IO_FAILED. */ - rt2x00_warn(rt2x00dev, "TX SKB padding error, out of memory\n"); - set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); - rt2x00lib_dmadone(entry); - - return false; - } - - usb_fill_bulk_urb(entry_priv->urb, usb_dev, - usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint), - entry->skb->data, length, - rt2x00usb_interrupt_txdone, entry); - - status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC); - if (status) { - if (status == -ENODEV) - clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); - set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); - rt2x00lib_dmadone(entry); - } - - return false; -} - -/* - * RX data handlers. - */ -static void rt2x00usb_work_rxdone(struct work_struct *work) -{ - struct rt2x00_dev *rt2x00dev = - container_of(work, struct rt2x00_dev, rxdone_work); - struct queue_entry *entry; - struct skb_frame_desc *skbdesc; - u8 rxd[32]; - - while (!rt2x00queue_empty(rt2x00dev->rx)) { - entry = rt2x00queue_get_entry(rt2x00dev->rx, Q_INDEX_DONE); - - if (test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || - !test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) - break; - - /* - * Fill in desc fields of the skb descriptor - */ - skbdesc = get_skb_frame_desc(entry->skb); - skbdesc->desc = rxd; - skbdesc->desc_len = entry->queue->desc_size; - - /* - * Send the frame to rt2x00lib for further processing. - */ - rt2x00lib_rxdone(entry, GFP_KERNEL); - } -} - -static void rt2x00usb_interrupt_rxdone(struct urb *urb) -{ - struct queue_entry *entry = (struct queue_entry *)urb->context; - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - - if (!test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) - return; - - /* - * Report the frame as DMA done - */ - rt2x00lib_dmadone(entry); - - /* - * Check if the received data is simply too small - * to be actually valid, or if the urb is signaling - * a problem. - */ - if (urb->actual_length < entry->queue->desc_size || urb->status) - set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); - - /* - * Schedule the delayed work for reading the RX status - * from the device. - */ - queue_work(rt2x00dev->workqueue, &rt2x00dev->rxdone_work); -} - -static bool rt2x00usb_kick_rx_entry(struct queue_entry *entry, void *data) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); - struct queue_entry_priv_usb *entry_priv = entry->priv_data; - int status; - - if (test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || - test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) - return false; - - rt2x00lib_dmastart(entry); - - usb_fill_bulk_urb(entry_priv->urb, usb_dev, - usb_rcvbulkpipe(usb_dev, entry->queue->usb_endpoint), - entry->skb->data, entry->skb->len, - rt2x00usb_interrupt_rxdone, entry); - - status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC); - if (status) { - if (status == -ENODEV) - clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); - set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); - rt2x00lib_dmadone(entry); - } - - return false; -} - -void rt2x00usb_kick_queue(struct data_queue *queue) -{ - switch (queue->qid) { - case QID_AC_VO: - case QID_AC_VI: - case QID_AC_BE: - case QID_AC_BK: - if (!rt2x00queue_empty(queue)) - rt2x00queue_for_each_entry(queue, - Q_INDEX_DONE, - Q_INDEX, - NULL, - rt2x00usb_kick_tx_entry); - break; - case QID_RX: - if (!rt2x00queue_full(queue)) - rt2x00queue_for_each_entry(queue, - Q_INDEX, - Q_INDEX_DONE, - NULL, - rt2x00usb_kick_rx_entry); - break; - default: - break; - } -} -EXPORT_SYMBOL_GPL(rt2x00usb_kick_queue); - -static bool rt2x00usb_flush_entry(struct queue_entry *entry, void *data) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct queue_entry_priv_usb *entry_priv = entry->priv_data; - struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data; - - if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) - return false; - - usb_kill_urb(entry_priv->urb); - - /* - * Kill guardian urb (if required by driver). - */ - if ((entry->queue->qid == QID_BEACON) && - (test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags))) - usb_kill_urb(bcn_priv->guardian_urb); - - return false; -} - -void rt2x00usb_flush_queue(struct data_queue *queue, bool drop) -{ - struct work_struct *completion; - unsigned int i; - - if (drop) - rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, NULL, - rt2x00usb_flush_entry); - - /* - * Obtain the queue completion handler - */ - switch (queue->qid) { - case QID_AC_VO: - case QID_AC_VI: - case QID_AC_BE: - case QID_AC_BK: - completion = &queue->rt2x00dev->txdone_work; - break; - case QID_RX: - completion = &queue->rt2x00dev->rxdone_work; - break; - default: - return; - } - - for (i = 0; i < 10; i++) { - /* - * Check if the driver is already done, otherwise we - * have to sleep a little while to give the driver/hw - * the oppurtunity to complete interrupt process itself. - */ - if (rt2x00queue_empty(queue)) - break; - - /* - * Schedule the completion handler manually, when this - * worker function runs, it should cleanup the queue. - */ - queue_work(queue->rt2x00dev->workqueue, completion); - - /* - * Wait for a little while to give the driver - * the oppurtunity to recover itself. - */ - msleep(10); - } -} -EXPORT_SYMBOL_GPL(rt2x00usb_flush_queue); - -static void rt2x00usb_watchdog_tx_dma(struct data_queue *queue) -{ - rt2x00_warn(queue->rt2x00dev, "TX queue %d DMA timed out, invoke forced forced reset\n", - queue->qid); - - rt2x00queue_flush_queue(queue, true); -} - -static int rt2x00usb_dma_timeout(struct data_queue *queue) -{ - struct queue_entry *entry; - - entry = rt2x00queue_get_entry(queue, Q_INDEX_DMA_DONE); - return rt2x00queue_dma_timeout(entry); -} - -void rt2x00usb_watchdog(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - - tx_queue_for_each(rt2x00dev, queue) { - if (!rt2x00queue_empty(queue)) { - if (rt2x00usb_dma_timeout(queue)) - rt2x00usb_watchdog_tx_dma(queue); - } - } -} -EXPORT_SYMBOL_GPL(rt2x00usb_watchdog); - -/* - * Radio handlers - */ -void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev) -{ - rt2x00usb_vendor_request_sw(rt2x00dev, USB_RX_CONTROL, 0, 0, - REGISTER_TIMEOUT); -} -EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio); - -/* - * Device initialization handlers. - */ -void rt2x00usb_clear_entry(struct queue_entry *entry) -{ - entry->flags = 0; - - if (entry->queue->qid == QID_RX) - rt2x00usb_kick_rx_entry(entry, NULL); -} -EXPORT_SYMBOL_GPL(rt2x00usb_clear_entry); - -static void rt2x00usb_assign_endpoint(struct data_queue *queue, - struct usb_endpoint_descriptor *ep_desc) -{ - struct usb_device *usb_dev = to_usb_device_intf(queue->rt2x00dev->dev); - int pipe; - - queue->usb_endpoint = usb_endpoint_num(ep_desc); - - if (queue->qid == QID_RX) { - pipe = usb_rcvbulkpipe(usb_dev, queue->usb_endpoint); - queue->usb_maxpacket = usb_maxpacket(usb_dev, pipe, 0); - } else { - pipe = usb_sndbulkpipe(usb_dev, queue->usb_endpoint); - queue->usb_maxpacket = usb_maxpacket(usb_dev, pipe, 1); - } - - if (!queue->usb_maxpacket) - queue->usb_maxpacket = 1; -} - -static int rt2x00usb_find_endpoints(struct rt2x00_dev *rt2x00dev) -{ - struct usb_interface *intf = to_usb_interface(rt2x00dev->dev); - struct usb_host_interface *intf_desc = intf->cur_altsetting; - struct usb_endpoint_descriptor *ep_desc; - struct data_queue *queue = rt2x00dev->tx; - struct usb_endpoint_descriptor *tx_ep_desc = NULL; - unsigned int i; - - /* - * Walk through all available endpoints to search for "bulk in" - * and "bulk out" endpoints. When we find such endpoints collect - * the information we need from the descriptor and assign it - * to the queue. - */ - for (i = 0; i < intf_desc->desc.bNumEndpoints; i++) { - ep_desc = &intf_desc->endpoint[i].desc; - - if (usb_endpoint_is_bulk_in(ep_desc)) { - rt2x00usb_assign_endpoint(rt2x00dev->rx, ep_desc); - } else if (usb_endpoint_is_bulk_out(ep_desc) && - (queue != queue_end(rt2x00dev))) { - rt2x00usb_assign_endpoint(queue, ep_desc); - queue = queue_next(queue); - - tx_ep_desc = ep_desc; - } - } - - /* - * At least 1 endpoint for RX and 1 endpoint for TX must be available. - */ - if (!rt2x00dev->rx->usb_endpoint || !rt2x00dev->tx->usb_endpoint) { - rt2x00_err(rt2x00dev, "Bulk-in/Bulk-out endpoints not found\n"); - return -EPIPE; - } - - /* - * It might be possible not all queues have a dedicated endpoint. - * Loop through all TX queues and copy the endpoint information - * which we have gathered from already assigned endpoints. - */ - txall_queue_for_each(rt2x00dev, queue) { - if (!queue->usb_endpoint) - rt2x00usb_assign_endpoint(queue, tx_ep_desc); - } - - return 0; -} - -static int rt2x00usb_alloc_entries(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - struct queue_entry_priv_usb *entry_priv; - struct queue_entry_priv_usb_bcn *bcn_priv; - unsigned int i; - - for (i = 0; i < queue->limit; i++) { - entry_priv = queue->entries[i].priv_data; - entry_priv->urb = usb_alloc_urb(0, GFP_KERNEL); - if (!entry_priv->urb) - return -ENOMEM; - } - - /* - * If this is not the beacon queue or - * no guardian byte was required for the beacon, - * then we are done. - */ - if (queue->qid != QID_BEACON || - !test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags)) - return 0; - - for (i = 0; i < queue->limit; i++) { - bcn_priv = queue->entries[i].priv_data; - bcn_priv->guardian_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!bcn_priv->guardian_urb) - return -ENOMEM; - } - - return 0; -} - -static void rt2x00usb_free_entries(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - struct queue_entry_priv_usb *entry_priv; - struct queue_entry_priv_usb_bcn *bcn_priv; - unsigned int i; - - if (!queue->entries) - return; - - for (i = 0; i < queue->limit; i++) { - entry_priv = queue->entries[i].priv_data; - usb_kill_urb(entry_priv->urb); - usb_free_urb(entry_priv->urb); - } - - /* - * If this is not the beacon queue or - * no guardian byte was required for the beacon, - * then we are done. - */ - if (queue->qid != QID_BEACON || - !test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags)) - return; - - for (i = 0; i < queue->limit; i++) { - bcn_priv = queue->entries[i].priv_data; - usb_kill_urb(bcn_priv->guardian_urb); - usb_free_urb(bcn_priv->guardian_urb); - } -} - -int rt2x00usb_initialize(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - int status; - - /* - * Find endpoints for each queue - */ - status = rt2x00usb_find_endpoints(rt2x00dev); - if (status) - goto exit; - - /* - * Allocate DMA - */ - queue_for_each(rt2x00dev, queue) { - status = rt2x00usb_alloc_entries(queue); - if (status) - goto exit; - } - - return 0; - -exit: - rt2x00usb_uninitialize(rt2x00dev); - - return status; -} -EXPORT_SYMBOL_GPL(rt2x00usb_initialize); - -void rt2x00usb_uninitialize(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - - queue_for_each(rt2x00dev, queue) - rt2x00usb_free_entries(queue); -} -EXPORT_SYMBOL_GPL(rt2x00usb_uninitialize); - -/* - * USB driver handlers. - */ -static void rt2x00usb_free_reg(struct rt2x00_dev *rt2x00dev) -{ - kfree(rt2x00dev->rf); - rt2x00dev->rf = NULL; - - kfree(rt2x00dev->eeprom); - rt2x00dev->eeprom = NULL; - - kfree(rt2x00dev->csr.cache); - rt2x00dev->csr.cache = NULL; -} - -static int rt2x00usb_alloc_reg(struct rt2x00_dev *rt2x00dev) -{ - rt2x00dev->csr.cache = kzalloc(CSR_CACHE_SIZE, GFP_KERNEL); - if (!rt2x00dev->csr.cache) - goto exit; - - rt2x00dev->eeprom = kzalloc(rt2x00dev->ops->eeprom_size, GFP_KERNEL); - if (!rt2x00dev->eeprom) - goto exit; - - rt2x00dev->rf = kzalloc(rt2x00dev->ops->rf_size, GFP_KERNEL); - if (!rt2x00dev->rf) - goto exit; - - return 0; - -exit: - rt2x00_probe_err("Failed to allocate registers\n"); - - rt2x00usb_free_reg(rt2x00dev); - - return -ENOMEM; -} - -int rt2x00usb_probe(struct usb_interface *usb_intf, - const struct rt2x00_ops *ops) -{ - struct usb_device *usb_dev = interface_to_usbdev(usb_intf); - struct ieee80211_hw *hw; - struct rt2x00_dev *rt2x00dev; - int retval; - - usb_dev = usb_get_dev(usb_dev); - usb_reset_device(usb_dev); - - hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw); - if (!hw) { - rt2x00_probe_err("Failed to allocate hardware\n"); - retval = -ENOMEM; - goto exit_put_device; - } - - usb_set_intfdata(usb_intf, hw); - - rt2x00dev = hw->priv; - rt2x00dev->dev = &usb_intf->dev; - rt2x00dev->ops = ops; - rt2x00dev->hw = hw; - - rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_USB); - - INIT_WORK(&rt2x00dev->rxdone_work, rt2x00usb_work_rxdone); - INIT_WORK(&rt2x00dev->txdone_work, rt2x00usb_work_txdone); - hrtimer_init(&rt2x00dev->txstatus_timer, CLOCK_MONOTONIC, - HRTIMER_MODE_REL); - - retval = rt2x00usb_alloc_reg(rt2x00dev); - if (retval) - goto exit_free_device; - - retval = rt2x00lib_probe_dev(rt2x00dev); - if (retval) - goto exit_free_reg; - - return 0; - -exit_free_reg: - rt2x00usb_free_reg(rt2x00dev); - -exit_free_device: - ieee80211_free_hw(hw); - -exit_put_device: - usb_put_dev(usb_dev); - - usb_set_intfdata(usb_intf, NULL); - - return retval; -} -EXPORT_SYMBOL_GPL(rt2x00usb_probe); - -void rt2x00usb_disconnect(struct usb_interface *usb_intf) -{ - struct ieee80211_hw *hw = usb_get_intfdata(usb_intf); - struct rt2x00_dev *rt2x00dev = hw->priv; - - /* - * Free all allocated data. - */ - rt2x00lib_remove_dev(rt2x00dev); - rt2x00usb_free_reg(rt2x00dev); - ieee80211_free_hw(hw); - - /* - * Free the USB device data. - */ - usb_set_intfdata(usb_intf, NULL); - usb_put_dev(interface_to_usbdev(usb_intf)); -} -EXPORT_SYMBOL_GPL(rt2x00usb_disconnect); - -#ifdef CONFIG_PM -int rt2x00usb_suspend(struct usb_interface *usb_intf, pm_message_t state) -{ - struct ieee80211_hw *hw = usb_get_intfdata(usb_intf); - struct rt2x00_dev *rt2x00dev = hw->priv; - - return rt2x00lib_suspend(rt2x00dev, state); -} -EXPORT_SYMBOL_GPL(rt2x00usb_suspend); - -int rt2x00usb_resume(struct usb_interface *usb_intf) -{ - struct ieee80211_hw *hw = usb_get_intfdata(usb_intf); - struct rt2x00_dev *rt2x00dev = hw->priv; - - return rt2x00lib_resume(rt2x00dev); -} -EXPORT_SYMBOL_GPL(rt2x00usb_resume); -#endif /* CONFIG_PM */ - -/* - * rt2x00usb module information. - */ -MODULE_AUTHOR(DRV_PROJECT); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION("rt2x00 usb library"); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h deleted file mode 100644 index 323ca7b2b095..000000000000 --- a/drivers/net/wireless/rt2x00/rt2x00usb.h +++ /dev/null @@ -1,442 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt2x00usb - Abstract: Data structures for the rt2x00usb module. - */ - -#ifndef RT2X00USB_H -#define RT2X00USB_H - -#include - -#define to_usb_device_intf(d) \ -({ \ - struct usb_interface *intf = to_usb_interface(d); \ - interface_to_usbdev(intf); \ -}) - -/* - * For USB vendor requests we need to pass a timeout - * time in ms, for this we use the REGISTER_TIMEOUT, - * however when loading firmware a higher value is - * required. In that case we use the REGISTER_TIMEOUT_FIRMWARE. - */ -#define REGISTER_TIMEOUT 500 -#define REGISTER_TIMEOUT_FIRMWARE 1000 - -/** - * REGISTER_TIMEOUT16 - Determine the timeout for 16bit register access - * @__datalen: Data length - */ -#define REGISTER_TIMEOUT16(__datalen) \ - ( REGISTER_TIMEOUT * ((__datalen) / sizeof(u16)) ) - -/** - * REGISTER_TIMEOUT32 - Determine the timeout for 32bit register access - * @__datalen: Data length - */ -#define REGISTER_TIMEOUT32(__datalen) \ - ( REGISTER_TIMEOUT * ((__datalen) / sizeof(u32)) ) - -/* - * Cache size - */ -#define CSR_CACHE_SIZE 64 - -/* - * USB request types. - */ -#define USB_VENDOR_REQUEST ( USB_TYPE_VENDOR | USB_RECIP_DEVICE ) -#define USB_VENDOR_REQUEST_IN ( USB_DIR_IN | USB_VENDOR_REQUEST ) -#define USB_VENDOR_REQUEST_OUT ( USB_DIR_OUT | USB_VENDOR_REQUEST ) - -/** - * enum rt2x00usb_vendor_request: USB vendor commands. - */ -enum rt2x00usb_vendor_request { - USB_DEVICE_MODE = 1, - USB_SINGLE_WRITE = 2, - USB_SINGLE_READ = 3, - USB_MULTI_WRITE = 6, - USB_MULTI_READ = 7, - USB_EEPROM_WRITE = 8, - USB_EEPROM_READ = 9, - USB_LED_CONTROL = 10, /* RT73USB */ - USB_RX_CONTROL = 12, -}; - -/** - * enum rt2x00usb_mode_offset: Device modes offset. - */ -enum rt2x00usb_mode_offset { - USB_MODE_RESET = 1, - USB_MODE_UNPLUG = 2, - USB_MODE_FUNCTION = 3, - USB_MODE_TEST = 4, - USB_MODE_SLEEP = 7, /* RT73USB */ - USB_MODE_FIRMWARE = 8, /* RT73USB */ - USB_MODE_WAKEUP = 9, /* RT73USB */ -}; - -/** - * rt2x00usb_vendor_request - Send register command to device - * @rt2x00dev: Pointer to &struct rt2x00_dev - * @request: USB vendor command (See &enum rt2x00usb_vendor_request) - * @requesttype: Request type &USB_VENDOR_REQUEST_* - * @offset: Register offset to perform action on - * @value: Value to write to device - * @buffer: Buffer where information will be read/written to by device - * @buffer_length: Size of &buffer - * @timeout: Operation timeout - * - * This is the main function to communicate with the device, - * the &buffer argument _must_ either be NULL or point to - * a buffer allocated by kmalloc. Failure to do so can lead - * to unexpected behavior depending on the architecture. - */ -int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev, - const u8 request, const u8 requesttype, - const u16 offset, const u16 value, - void *buffer, const u16 buffer_length, - const int timeout); - -/** - * rt2x00usb_vendor_request_buff - Send register command to device (buffered) - * @rt2x00dev: Pointer to &struct rt2x00_dev - * @request: USB vendor command (See &enum rt2x00usb_vendor_request) - * @requesttype: Request type &USB_VENDOR_REQUEST_* - * @offset: Register offset to perform action on - * @buffer: Buffer where information will be read/written to by device - * @buffer_length: Size of &buffer - * @timeout: Operation timeout - * - * This function will use a previously with kmalloc allocated cache - * to communicate with the device. The contents of the buffer pointer - * will be copied to this cache when writing, or read from the cache - * when reading. - * Buffers send to &rt2x00usb_vendor_request _must_ be allocated with - * kmalloc. Hence the reason for using a previously allocated cache - * which has been allocated properly. - */ -int rt2x00usb_vendor_request_buff(struct rt2x00_dev *rt2x00dev, - const u8 request, const u8 requesttype, - const u16 offset, void *buffer, - const u16 buffer_length, const int timeout); - -/** - * rt2x00usb_vendor_request_buff - Send register command to device (buffered) - * @rt2x00dev: Pointer to &struct rt2x00_dev - * @request: USB vendor command (See &enum rt2x00usb_vendor_request) - * @requesttype: Request type &USB_VENDOR_REQUEST_* - * @offset: Register offset to perform action on - * @buffer: Buffer where information will be read/written to by device - * @buffer_length: Size of &buffer - * @timeout: Operation timeout - * - * A version of &rt2x00usb_vendor_request_buff which must be called - * if the usb_cache_mutex is already held. - */ -int rt2x00usb_vendor_req_buff_lock(struct rt2x00_dev *rt2x00dev, - const u8 request, const u8 requesttype, - const u16 offset, void *buffer, - const u16 buffer_length, const int timeout); - -/** - * rt2x00usb_vendor_request_sw - Send single register command to device - * @rt2x00dev: Pointer to &struct rt2x00_dev - * @request: USB vendor command (See &enum rt2x00usb_vendor_request) - * @offset: Register offset to perform action on - * @value: Value to write to device - * @timeout: Operation timeout - * - * Simple wrapper around rt2x00usb_vendor_request to write a single - * command to the device. Since we don't use the buffer argument we - * don't have to worry about kmalloc here. - */ -static inline int rt2x00usb_vendor_request_sw(struct rt2x00_dev *rt2x00dev, - const u8 request, - const u16 offset, - const u16 value, - const int timeout) -{ - return rt2x00usb_vendor_request(rt2x00dev, request, - USB_VENDOR_REQUEST_OUT, offset, - value, NULL, 0, timeout); -} - -/** - * rt2x00usb_eeprom_read - Read eeprom from device - * @rt2x00dev: Pointer to &struct rt2x00_dev - * @eeprom: Pointer to eeprom array to store the information in - * @length: Number of bytes to read from the eeprom - * - * Simple wrapper around rt2x00usb_vendor_request to read the eeprom - * from the device. Note that the eeprom argument _must_ be allocated using - * kmalloc for correct handling inside the kernel USB layer. - */ -static inline int rt2x00usb_eeprom_read(struct rt2x00_dev *rt2x00dev, - __le16 *eeprom, const u16 length) -{ - return rt2x00usb_vendor_request(rt2x00dev, USB_EEPROM_READ, - USB_VENDOR_REQUEST_IN, 0, 0, - eeprom, length, - REGISTER_TIMEOUT16(length)); -} - -/** - * rt2x00usb_register_read - Read 32bit register word - * @rt2x00dev: Device pointer, see &struct rt2x00_dev. - * @offset: Register offset - * @value: Pointer to where register contents should be stored - * - * This function is a simple wrapper for 32bit register access - * through rt2x00usb_vendor_request_buff(). - */ -static inline void rt2x00usb_register_read(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u32 *value) -{ - __le32 reg; - rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_READ, - USB_VENDOR_REQUEST_IN, offset, - ®, sizeof(reg), REGISTER_TIMEOUT); - *value = le32_to_cpu(reg); -} - -/** - * rt2x00usb_register_read_lock - Read 32bit register word - * @rt2x00dev: Device pointer, see &struct rt2x00_dev. - * @offset: Register offset - * @value: Pointer to where register contents should be stored - * - * This function is a simple wrapper for 32bit register access - * through rt2x00usb_vendor_req_buff_lock(). - */ -static inline void rt2x00usb_register_read_lock(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u32 *value) -{ - __le32 reg; - rt2x00usb_vendor_req_buff_lock(rt2x00dev, USB_MULTI_READ, - USB_VENDOR_REQUEST_IN, offset, - ®, sizeof(reg), REGISTER_TIMEOUT); - *value = le32_to_cpu(reg); -} - -/** - * rt2x00usb_register_multiread - Read 32bit register words - * @rt2x00dev: Device pointer, see &struct rt2x00_dev. - * @offset: Register offset - * @value: Pointer to where register contents should be stored - * @length: Length of the data - * - * This function is a simple wrapper for 32bit register access - * through rt2x00usb_vendor_request_buff(). - */ -static inline void rt2x00usb_register_multiread(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - void *value, const u32 length) -{ - rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_READ, - USB_VENDOR_REQUEST_IN, offset, - value, length, - REGISTER_TIMEOUT32(length)); -} - -/** - * rt2x00usb_register_write - Write 32bit register word - * @rt2x00dev: Device pointer, see &struct rt2x00_dev. - * @offset: Register offset - * @value: Data which should be written - * - * This function is a simple wrapper for 32bit register access - * through rt2x00usb_vendor_request_buff(). - */ -static inline void rt2x00usb_register_write(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u32 value) -{ - __le32 reg = cpu_to_le32(value); - rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_WRITE, - USB_VENDOR_REQUEST_OUT, offset, - ®, sizeof(reg), REGISTER_TIMEOUT); -} - -/** - * rt2x00usb_register_write_lock - Write 32bit register word - * @rt2x00dev: Device pointer, see &struct rt2x00_dev. - * @offset: Register offset - * @value: Data which should be written - * - * This function is a simple wrapper for 32bit register access - * through rt2x00usb_vendor_req_buff_lock(). - */ -static inline void rt2x00usb_register_write_lock(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - u32 value) -{ - __le32 reg = cpu_to_le32(value); - rt2x00usb_vendor_req_buff_lock(rt2x00dev, USB_MULTI_WRITE, - USB_VENDOR_REQUEST_OUT, offset, - ®, sizeof(reg), REGISTER_TIMEOUT); -} - -/** - * rt2x00usb_register_multiwrite - Write 32bit register words - * @rt2x00dev: Device pointer, see &struct rt2x00_dev. - * @offset: Register offset - * @value: Data which should be written - * @length: Length of the data - * - * This function is a simple wrapper for 32bit register access - * through rt2x00usb_vendor_request_buff(). - */ -static inline void rt2x00usb_register_multiwrite(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - const void *value, - const u32 length) -{ - rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_WRITE, - USB_VENDOR_REQUEST_OUT, offset, - (void *)value, length, - REGISTER_TIMEOUT32(length)); -} - -/** - * rt2x00usb_regbusy_read - Read from register with busy check - * @rt2x00dev: Device pointer, see &struct rt2x00_dev. - * @offset: Register offset - * @field: Field to check if register is busy - * @reg: Pointer to where register contents should be stored - * - * This function will read the given register, and checks if the - * register is busy. If it is, it will sleep for a couple of - * microseconds before reading the register again. If the register - * is not read after a certain timeout, this function will return - * FALSE. - */ -int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - const struct rt2x00_field32 field, - u32 *reg); - -/** - * rt2x00usb_register_read_async - Asynchronously read 32bit register word - * @rt2x00dev: Device pointer, see &struct rt2x00_dev. - * @offset: Register offset - * @callback: Functon to call when read completes. - * - * Submit a control URB to read a 32bit register. This safe to - * be called from atomic context. The callback will be called - * when the URB completes. Otherwise the function is similar - * to rt2x00usb_register_read(). - * When the callback function returns false, the memory will be cleaned up, - * when it returns true, the urb will be fired again. - */ -void rt2x00usb_register_read_async(struct rt2x00_dev *rt2x00dev, - const unsigned int offset, - bool (*callback)(struct rt2x00_dev*, int, u32)); - -/* - * Radio handlers - */ -void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev); - -/** - * struct queue_entry_priv_usb: Per entry USB specific information - * - * @urb: Urb structure used for device communication. - */ -struct queue_entry_priv_usb { - struct urb *urb; -}; - -/** - * struct queue_entry_priv_usb_bcn: Per TX entry USB specific information - * - * The first section should match &struct queue_entry_priv_usb exactly. - * rt2500usb can use this structure to send a guardian byte when working - * with beacons. - * - * @urb: Urb structure used for device communication. - * @guardian_data: Set to 0, used for sending the guardian data. - * @guardian_urb: Urb structure used to send the guardian data. - */ -struct queue_entry_priv_usb_bcn { - struct urb *urb; - - unsigned int guardian_data; - struct urb *guardian_urb; -}; - -/** - * rt2x00usb_kick_queue - Kick data queue - * @queue: Data queue to kick - * - * This will walk through all entries of the queue and push all pending - * frames to the hardware as a single burst. - */ -void rt2x00usb_kick_queue(struct data_queue *queue); - -/** - * rt2x00usb_flush_queue - Flush data queue - * @queue: Data queue to stop - * @drop: True to drop all pending frames. - * - * This will walk through all entries of the queue and will optionally - * kill all URB's which were send to the device, or at least wait until - * they have been returned from the device.. - */ -void rt2x00usb_flush_queue(struct data_queue *queue, bool drop); - -/** - * rt2x00usb_watchdog - Watchdog for USB communication - * @rt2x00dev: Pointer to &struct rt2x00_dev - * - * Check the health of the USB communication and determine - * if timeouts have occurred. If this is the case, this function - * will reset all communication to restore functionality again. - */ -void rt2x00usb_watchdog(struct rt2x00_dev *rt2x00dev); - -/* - * Device initialization handlers. - */ -void rt2x00usb_clear_entry(struct queue_entry *entry); -int rt2x00usb_initialize(struct rt2x00_dev *rt2x00dev); -void rt2x00usb_uninitialize(struct rt2x00_dev *rt2x00dev); - -/* - * USB driver handlers. - */ -int rt2x00usb_probe(struct usb_interface *usb_intf, - const struct rt2x00_ops *ops); -void rt2x00usb_disconnect(struct usb_interface *usb_intf); -#ifdef CONFIG_PM -int rt2x00usb_suspend(struct usb_interface *usb_intf, pm_message_t state); -int rt2x00usb_resume(struct usb_interface *usb_intf); -#else -#define rt2x00usb_suspend NULL -#define rt2x00usb_resume NULL -#endif /* CONFIG_PM */ - -#endif /* RT2X00USB_H */ diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c deleted file mode 100644 index 883a54c8c5bc..000000000000 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ /dev/null @@ -1,3106 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt61pci - Abstract: rt61pci device specific routines. - Supported chipsets: RT2561, RT2561s, RT2661. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2x00mmio.h" -#include "rt2x00pci.h" -#include "rt61pci.h" - -/* - * Allow hardware encryption to be disabled. - */ -static bool modparam_nohwcrypt = false; -module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); -MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); - -/* - * Register access. - * BBP and RF register require indirect register access, - * and use the CSR registers PHY_CSR3 and PHY_CSR4 to achieve this. - * These indirect registers work with busy bits, - * and we will try maximal REGISTER_BUSY_COUNT times to access - * the register while taking a REGISTER_BUSY_DELAY us delay - * between each attempt. When the busy bit is still set at that time, - * the access attempt is considered to have failed, - * and we will print an error. - */ -#define WAIT_FOR_BBP(__dev, __reg) \ - rt2x00mmio_regbusy_read((__dev), PHY_CSR3, PHY_CSR3_BUSY, (__reg)) -#define WAIT_FOR_RF(__dev, __reg) \ - rt2x00mmio_regbusy_read((__dev), PHY_CSR4, PHY_CSR4_BUSY, (__reg)) -#define WAIT_FOR_MCU(__dev, __reg) \ - rt2x00mmio_regbusy_read((__dev), H2M_MAILBOX_CSR, \ - H2M_MAILBOX_CSR_OWNER, (__reg)) - -static void rt61pci_bbp_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, const u8 value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the BBP becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_BBP(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, PHY_CSR3_VALUE, value); - rt2x00_set_field32(®, PHY_CSR3_REGNUM, word); - rt2x00_set_field32(®, PHY_CSR3_BUSY, 1); - rt2x00_set_field32(®, PHY_CSR3_READ_CONTROL, 0); - - rt2x00mmio_register_write(rt2x00dev, PHY_CSR3, reg); - } - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt61pci_bbp_read(struct rt2x00_dev *rt2x00dev, - const unsigned int word, u8 *value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the BBP becomes available, afterwards we - * can safely write the read request into the register. - * After the data has been written, we wait until hardware - * returns the correct value, if at any time the register - * doesn't become available in time, reg will be 0xffffffff - * which means we return 0xff to the caller. - */ - if (WAIT_FOR_BBP(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, PHY_CSR3_REGNUM, word); - rt2x00_set_field32(®, PHY_CSR3_BUSY, 1); - rt2x00_set_field32(®, PHY_CSR3_READ_CONTROL, 1); - - rt2x00mmio_register_write(rt2x00dev, PHY_CSR3, reg); - - WAIT_FOR_BBP(rt2x00dev, ®); - } - - *value = rt2x00_get_field32(reg, PHY_CSR3_VALUE); - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt61pci_rf_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, const u32 value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the RF becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_RF(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, PHY_CSR4_VALUE, value); - rt2x00_set_field32(®, PHY_CSR4_NUMBER_OF_BITS, 21); - rt2x00_set_field32(®, PHY_CSR4_IF_SELECT, 0); - rt2x00_set_field32(®, PHY_CSR4_BUSY, 1); - - rt2x00mmio_register_write(rt2x00dev, PHY_CSR4, reg); - rt2x00_rf_write(rt2x00dev, word, value); - } - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt61pci_mcu_request(struct rt2x00_dev *rt2x00dev, - const u8 command, const u8 token, - const u8 arg0, const u8 arg1) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the MCU becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_MCU(rt2x00dev, ®)) { - rt2x00_set_field32(®, H2M_MAILBOX_CSR_OWNER, 1); - rt2x00_set_field32(®, H2M_MAILBOX_CSR_CMD_TOKEN, token); - rt2x00_set_field32(®, H2M_MAILBOX_CSR_ARG0, arg0); - rt2x00_set_field32(®, H2M_MAILBOX_CSR_ARG1, arg1); - rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CSR, reg); - - rt2x00mmio_register_read(rt2x00dev, HOST_CMD_CSR, ®); - rt2x00_set_field32(®, HOST_CMD_CSR_HOST_COMMAND, command); - rt2x00_set_field32(®, HOST_CMD_CSR_INTERRUPT_MCU, 1); - rt2x00mmio_register_write(rt2x00dev, HOST_CMD_CSR, reg); - } - - mutex_unlock(&rt2x00dev->csr_mutex); - -} - -static void rt61pci_eepromregister_read(struct eeprom_93cx6 *eeprom) -{ - struct rt2x00_dev *rt2x00dev = eeprom->data; - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, E2PROM_CSR, ®); - - eeprom->reg_data_in = !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_IN); - eeprom->reg_data_out = !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_OUT); - eeprom->reg_data_clock = - !!rt2x00_get_field32(reg, E2PROM_CSR_DATA_CLOCK); - eeprom->reg_chip_select = - !!rt2x00_get_field32(reg, E2PROM_CSR_CHIP_SELECT); -} - -static void rt61pci_eepromregister_write(struct eeprom_93cx6 *eeprom) -{ - struct rt2x00_dev *rt2x00dev = eeprom->data; - u32 reg = 0; - - rt2x00_set_field32(®, E2PROM_CSR_DATA_IN, !!eeprom->reg_data_in); - rt2x00_set_field32(®, E2PROM_CSR_DATA_OUT, !!eeprom->reg_data_out); - rt2x00_set_field32(®, E2PROM_CSR_DATA_CLOCK, - !!eeprom->reg_data_clock); - rt2x00_set_field32(®, E2PROM_CSR_CHIP_SELECT, - !!eeprom->reg_chip_select); - - rt2x00mmio_register_write(rt2x00dev, E2PROM_CSR, reg); -} - -#ifdef CONFIG_RT2X00_LIB_DEBUGFS -static const struct rt2x00debug rt61pci_rt2x00debug = { - .owner = THIS_MODULE, - .csr = { - .read = rt2x00mmio_register_read, - .write = rt2x00mmio_register_write, - .flags = RT2X00DEBUGFS_OFFSET, - .word_base = CSR_REG_BASE, - .word_size = sizeof(u32), - .word_count = CSR_REG_SIZE / sizeof(u32), - }, - .eeprom = { - .read = rt2x00_eeprom_read, - .write = rt2x00_eeprom_write, - .word_base = EEPROM_BASE, - .word_size = sizeof(u16), - .word_count = EEPROM_SIZE / sizeof(u16), - }, - .bbp = { - .read = rt61pci_bbp_read, - .write = rt61pci_bbp_write, - .word_base = BBP_BASE, - .word_size = sizeof(u8), - .word_count = BBP_SIZE / sizeof(u8), - }, - .rf = { - .read = rt2x00_rf_read, - .write = rt61pci_rf_write, - .word_base = RF_BASE, - .word_size = sizeof(u32), - .word_count = RF_SIZE / sizeof(u32), - }, -}; -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ - -static int rt61pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, MAC_CSR13, ®); - return rt2x00_get_field32(reg, MAC_CSR13_VAL5); -} - -#ifdef CONFIG_RT2X00_LIB_LEDS -static void rt61pci_brightness_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct rt2x00_led *led = - container_of(led_cdev, struct rt2x00_led, led_dev); - unsigned int enabled = brightness != LED_OFF; - unsigned int a_mode = - (enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_5GHZ); - unsigned int bg_mode = - (enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_2GHZ); - - if (led->type == LED_TYPE_RADIO) { - rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg, - MCU_LEDCS_RADIO_STATUS, enabled); - - rt61pci_mcu_request(led->rt2x00dev, MCU_LED, 0xff, - (led->rt2x00dev->led_mcu_reg & 0xff), - ((led->rt2x00dev->led_mcu_reg >> 8))); - } else if (led->type == LED_TYPE_ASSOC) { - rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg, - MCU_LEDCS_LINK_BG_STATUS, bg_mode); - rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg, - MCU_LEDCS_LINK_A_STATUS, a_mode); - - rt61pci_mcu_request(led->rt2x00dev, MCU_LED, 0xff, - (led->rt2x00dev->led_mcu_reg & 0xff), - ((led->rt2x00dev->led_mcu_reg >> 8))); - } else if (led->type == LED_TYPE_QUALITY) { - /* - * The brightness is divided into 6 levels (0 - 5), - * this means we need to convert the brightness - * argument into the matching level within that range. - */ - rt61pci_mcu_request(led->rt2x00dev, MCU_LED_STRENGTH, 0xff, - brightness / (LED_FULL / 6), 0); - } -} - -static int rt61pci_blink_set(struct led_classdev *led_cdev, - unsigned long *delay_on, - unsigned long *delay_off) -{ - struct rt2x00_led *led = - container_of(led_cdev, struct rt2x00_led, led_dev); - u32 reg; - - rt2x00mmio_register_read(led->rt2x00dev, MAC_CSR14, ®); - rt2x00_set_field32(®, MAC_CSR14_ON_PERIOD, *delay_on); - rt2x00_set_field32(®, MAC_CSR14_OFF_PERIOD, *delay_off); - rt2x00mmio_register_write(led->rt2x00dev, MAC_CSR14, reg); - - return 0; -} - -static void rt61pci_init_led(struct rt2x00_dev *rt2x00dev, - struct rt2x00_led *led, - enum led_type type) -{ - led->rt2x00dev = rt2x00dev; - led->type = type; - led->led_dev.brightness_set = rt61pci_brightness_set; - led->led_dev.blink_set = rt61pci_blink_set; - led->flags = LED_INITIALIZED; -} -#endif /* CONFIG_RT2X00_LIB_LEDS */ - -/* - * Configuration handlers. - */ -static int rt61pci_config_shared_key(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_crypto *crypto, - struct ieee80211_key_conf *key) -{ - struct hw_key_entry key_entry; - struct rt2x00_field32 field; - u32 mask; - u32 reg; - - if (crypto->cmd == SET_KEY) { - /* - * rt2x00lib can't determine the correct free - * key_idx for shared keys. We have 1 register - * with key valid bits. The goal is simple, read - * the register, if that is full we have no slots - * left. - * Note that each BSS is allowed to have up to 4 - * shared keys, so put a mask over the allowed - * entries. - */ - mask = (0xf << crypto->bssidx); - - rt2x00mmio_register_read(rt2x00dev, SEC_CSR0, ®); - reg &= mask; - - if (reg && reg == mask) - return -ENOSPC; - - key->hw_key_idx += reg ? ffz(reg) : 0; - - /* - * Upload key to hardware - */ - memcpy(key_entry.key, crypto->key, - sizeof(key_entry.key)); - memcpy(key_entry.tx_mic, crypto->tx_mic, - sizeof(key_entry.tx_mic)); - memcpy(key_entry.rx_mic, crypto->rx_mic, - sizeof(key_entry.rx_mic)); - - reg = SHARED_KEY_ENTRY(key->hw_key_idx); - rt2x00mmio_register_multiwrite(rt2x00dev, reg, - &key_entry, sizeof(key_entry)); - - /* - * The cipher types are stored over 2 registers. - * bssidx 0 and 1 keys are stored in SEC_CSR1 and - * bssidx 1 and 2 keys are stored in SEC_CSR5. - * Using the correct defines correctly will cause overhead, - * so just calculate the correct offset. - */ - if (key->hw_key_idx < 8) { - field.bit_offset = (3 * key->hw_key_idx); - field.bit_mask = 0x7 << field.bit_offset; - - rt2x00mmio_register_read(rt2x00dev, SEC_CSR1, ®); - rt2x00_set_field32(®, field, crypto->cipher); - rt2x00mmio_register_write(rt2x00dev, SEC_CSR1, reg); - } else { - field.bit_offset = (3 * (key->hw_key_idx - 8)); - field.bit_mask = 0x7 << field.bit_offset; - - rt2x00mmio_register_read(rt2x00dev, SEC_CSR5, ®); - rt2x00_set_field32(®, field, crypto->cipher); - rt2x00mmio_register_write(rt2x00dev, SEC_CSR5, reg); - } - - /* - * The driver does not support the IV/EIV generation - * in hardware. However it doesn't support the IV/EIV - * inside the ieee80211 frame either, but requires it - * to be provided separately for the descriptor. - * rt2x00lib will cut the IV/EIV data out of all frames - * given to us by mac80211, but we must tell mac80211 - * to generate the IV/EIV data. - */ - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - } - - /* - * SEC_CSR0 contains only single-bit fields to indicate - * a particular key is valid. Because using the FIELD32() - * defines directly will cause a lot of overhead, we use - * a calculation to determine the correct bit directly. - */ - mask = 1 << key->hw_key_idx; - - rt2x00mmio_register_read(rt2x00dev, SEC_CSR0, ®); - if (crypto->cmd == SET_KEY) - reg |= mask; - else if (crypto->cmd == DISABLE_KEY) - reg &= ~mask; - rt2x00mmio_register_write(rt2x00dev, SEC_CSR0, reg); - - return 0; -} - -static int rt61pci_config_pairwise_key(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_crypto *crypto, - struct ieee80211_key_conf *key) -{ - struct hw_pairwise_ta_entry addr_entry; - struct hw_key_entry key_entry; - u32 mask; - u32 reg; - - if (crypto->cmd == SET_KEY) { - /* - * rt2x00lib can't determine the correct free - * key_idx for pairwise keys. We have 2 registers - * with key valid bits. The goal is simple: read - * the first register. If that is full, move to - * the next register. - * When both registers are full, we drop the key. - * Otherwise, we use the first invalid entry. - */ - rt2x00mmio_register_read(rt2x00dev, SEC_CSR2, ®); - if (reg && reg == ~0) { - key->hw_key_idx = 32; - rt2x00mmio_register_read(rt2x00dev, SEC_CSR3, ®); - if (reg && reg == ~0) - return -ENOSPC; - } - - key->hw_key_idx += reg ? ffz(reg) : 0; - - /* - * Upload key to hardware - */ - memcpy(key_entry.key, crypto->key, - sizeof(key_entry.key)); - memcpy(key_entry.tx_mic, crypto->tx_mic, - sizeof(key_entry.tx_mic)); - memcpy(key_entry.rx_mic, crypto->rx_mic, - sizeof(key_entry.rx_mic)); - - memset(&addr_entry, 0, sizeof(addr_entry)); - memcpy(&addr_entry, crypto->address, ETH_ALEN); - addr_entry.cipher = crypto->cipher; - - reg = PAIRWISE_KEY_ENTRY(key->hw_key_idx); - rt2x00mmio_register_multiwrite(rt2x00dev, reg, - &key_entry, sizeof(key_entry)); - - reg = PAIRWISE_TA_ENTRY(key->hw_key_idx); - rt2x00mmio_register_multiwrite(rt2x00dev, reg, - &addr_entry, sizeof(addr_entry)); - - /* - * Enable pairwise lookup table for given BSS idx. - * Without this, received frames will not be decrypted - * by the hardware. - */ - rt2x00mmio_register_read(rt2x00dev, SEC_CSR4, ®); - reg |= (1 << crypto->bssidx); - rt2x00mmio_register_write(rt2x00dev, SEC_CSR4, reg); - - /* - * The driver does not support the IV/EIV generation - * in hardware. However it doesn't support the IV/EIV - * inside the ieee80211 frame either, but requires it - * to be provided separately for the descriptor. - * rt2x00lib will cut the IV/EIV data out of all frames - * given to us by mac80211, but we must tell mac80211 - * to generate the IV/EIV data. - */ - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - } - - /* - * SEC_CSR2 and SEC_CSR3 contain only single-bit fields to indicate - * a particular key is valid. Because using the FIELD32() - * defines directly will cause a lot of overhead, we use - * a calculation to determine the correct bit directly. - */ - if (key->hw_key_idx < 32) { - mask = 1 << key->hw_key_idx; - - rt2x00mmio_register_read(rt2x00dev, SEC_CSR2, ®); - if (crypto->cmd == SET_KEY) - reg |= mask; - else if (crypto->cmd == DISABLE_KEY) - reg &= ~mask; - rt2x00mmio_register_write(rt2x00dev, SEC_CSR2, reg); - } else { - mask = 1 << (key->hw_key_idx - 32); - - rt2x00mmio_register_read(rt2x00dev, SEC_CSR3, ®); - if (crypto->cmd == SET_KEY) - reg |= mask; - else if (crypto->cmd == DISABLE_KEY) - reg &= ~mask; - rt2x00mmio_register_write(rt2x00dev, SEC_CSR3, reg); - } - - return 0; -} - -static void rt61pci_config_filter(struct rt2x00_dev *rt2x00dev, - const unsigned int filter_flags) -{ - u32 reg; - - /* - * Start configuration steps. - * Note that the version error will always be dropped - * and broadcast frames will always be accepted since - * there is no filter for it at this time. - */ - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR0, ®); - rt2x00_set_field32(®, TXRX_CSR0_DROP_CRC, - !(filter_flags & FIF_FCSFAIL)); - rt2x00_set_field32(®, TXRX_CSR0_DROP_PHYSICAL, - !(filter_flags & FIF_PLCPFAIL)); - rt2x00_set_field32(®, TXRX_CSR0_DROP_CONTROL, - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL))); - rt2x00_set_field32(®, TXRX_CSR0_DROP_NOT_TO_ME, - !(filter_flags & FIF_PROMISC_IN_BSS)); - rt2x00_set_field32(®, TXRX_CSR0_DROP_TO_DS, - !(filter_flags & FIF_PROMISC_IN_BSS) && - !rt2x00dev->intf_ap_count); - rt2x00_set_field32(®, TXRX_CSR0_DROP_VERSION_ERROR, 1); - rt2x00_set_field32(®, TXRX_CSR0_DROP_MULTICAST, - !(filter_flags & FIF_ALLMULTI)); - rt2x00_set_field32(®, TXRX_CSR0_DROP_BROADCAST, 0); - rt2x00_set_field32(®, TXRX_CSR0_DROP_ACK_CTS, - !(filter_flags & FIF_CONTROL)); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR0, reg); -} - -static void rt61pci_config_intf(struct rt2x00_dev *rt2x00dev, - struct rt2x00_intf *intf, - struct rt2x00intf_conf *conf, - const unsigned int flags) -{ - u32 reg; - - if (flags & CONFIG_UPDATE_TYPE) { - /* - * Enable synchronisation. - */ - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®); - rt2x00_set_field32(®, TXRX_CSR9_TSF_SYNC, conf->sync); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg); - } - - if (flags & CONFIG_UPDATE_MAC) { - reg = le32_to_cpu(conf->mac[1]); - rt2x00_set_field32(®, MAC_CSR3_UNICAST_TO_ME_MASK, 0xff); - conf->mac[1] = cpu_to_le32(reg); - - rt2x00mmio_register_multiwrite(rt2x00dev, MAC_CSR2, - conf->mac, sizeof(conf->mac)); - } - - if (flags & CONFIG_UPDATE_BSSID) { - reg = le32_to_cpu(conf->bssid[1]); - rt2x00_set_field32(®, MAC_CSR5_BSS_ID_MASK, 3); - conf->bssid[1] = cpu_to_le32(reg); - - rt2x00mmio_register_multiwrite(rt2x00dev, MAC_CSR4, - conf->bssid, - sizeof(conf->bssid)); - } -} - -static void rt61pci_config_erp(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_erp *erp, - u32 changed) -{ - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR0, ®); - rt2x00_set_field32(®, TXRX_CSR0_RX_ACK_TIMEOUT, 0x32); - rt2x00_set_field32(®, TXRX_CSR0_TSF_OFFSET, IEEE80211_HEADER); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR0, reg); - - if (changed & BSS_CHANGED_ERP_PREAMBLE) { - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR4, ®); - rt2x00_set_field32(®, TXRX_CSR4_AUTORESPOND_ENABLE, 1); - rt2x00_set_field32(®, TXRX_CSR4_AUTORESPOND_PREAMBLE, - !!erp->short_preamble); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR4, reg); - } - - if (changed & BSS_CHANGED_BASIC_RATES) - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR5, - erp->basic_rates); - - if (changed & BSS_CHANGED_BEACON_INT) { - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®); - rt2x00_set_field32(®, TXRX_CSR9_BEACON_INTERVAL, - erp->beacon_int * 16); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg); - } - - if (changed & BSS_CHANGED_ERP_SLOT) { - rt2x00mmio_register_read(rt2x00dev, MAC_CSR9, ®); - rt2x00_set_field32(®, MAC_CSR9_SLOT_TIME, erp->slot_time); - rt2x00mmio_register_write(rt2x00dev, MAC_CSR9, reg); - - rt2x00mmio_register_read(rt2x00dev, MAC_CSR8, ®); - rt2x00_set_field32(®, MAC_CSR8_SIFS, erp->sifs); - rt2x00_set_field32(®, MAC_CSR8_SIFS_AFTER_RX_OFDM, 3); - rt2x00_set_field32(®, MAC_CSR8_EIFS, erp->eifs); - rt2x00mmio_register_write(rt2x00dev, MAC_CSR8, reg); - } -} - -static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev, - struct antenna_setup *ant) -{ - u8 r3; - u8 r4; - u8 r77; - - rt61pci_bbp_read(rt2x00dev, 3, &r3); - rt61pci_bbp_read(rt2x00dev, 4, &r4); - rt61pci_bbp_read(rt2x00dev, 77, &r77); - - rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, rt2x00_rf(rt2x00dev, RF5325)); - - /* - * Configure the RX antenna. - */ - switch (ant->rx) { - case ANTENNA_HW_DIVERSITY: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 2); - rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, - (rt2x00dev->curr_band != IEEE80211_BAND_5GHZ)); - break; - case ANTENNA_A: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); - rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); - if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) - rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0); - else - rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); - break; - case ANTENNA_B: - default: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); - rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); - if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) - rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); - else - rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0); - break; - } - - rt61pci_bbp_write(rt2x00dev, 77, r77); - rt61pci_bbp_write(rt2x00dev, 3, r3); - rt61pci_bbp_write(rt2x00dev, 4, r4); -} - -static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev, - struct antenna_setup *ant) -{ - u8 r3; - u8 r4; - u8 r77; - - rt61pci_bbp_read(rt2x00dev, 3, &r3); - rt61pci_bbp_read(rt2x00dev, 4, &r4); - rt61pci_bbp_read(rt2x00dev, 77, &r77); - - rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, rt2x00_rf(rt2x00dev, RF2529)); - rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, - !test_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags)); - - /* - * Configure the RX antenna. - */ - switch (ant->rx) { - case ANTENNA_HW_DIVERSITY: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 2); - break; - case ANTENNA_A: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); - rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); - break; - case ANTENNA_B: - default: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); - rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0); - break; - } - - rt61pci_bbp_write(rt2x00dev, 77, r77); - rt61pci_bbp_write(rt2x00dev, 3, r3); - rt61pci_bbp_write(rt2x00dev, 4, r4); -} - -static void rt61pci_config_antenna_2529_rx(struct rt2x00_dev *rt2x00dev, - const int p1, const int p2) -{ - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, MAC_CSR13, ®); - - rt2x00_set_field32(®, MAC_CSR13_DIR4, 0); - rt2x00_set_field32(®, MAC_CSR13_VAL4, p1); - - rt2x00_set_field32(®, MAC_CSR13_DIR3, 0); - rt2x00_set_field32(®, MAC_CSR13_VAL3, !p2); - - rt2x00mmio_register_write(rt2x00dev, MAC_CSR13, reg); -} - -static void rt61pci_config_antenna_2529(struct rt2x00_dev *rt2x00dev, - struct antenna_setup *ant) -{ - u8 r3; - u8 r4; - u8 r77; - - rt61pci_bbp_read(rt2x00dev, 3, &r3); - rt61pci_bbp_read(rt2x00dev, 4, &r4); - rt61pci_bbp_read(rt2x00dev, 77, &r77); - - /* - * Configure the RX antenna. - */ - switch (ant->rx) { - case ANTENNA_A: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); - rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0); - rt61pci_config_antenna_2529_rx(rt2x00dev, 0, 0); - break; - case ANTENNA_HW_DIVERSITY: - /* - * FIXME: Antenna selection for the rf 2529 is very confusing - * in the legacy driver. Just default to antenna B until the - * legacy code can be properly translated into rt2x00 code. - */ - case ANTENNA_B: - default: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); - rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); - rt61pci_config_antenna_2529_rx(rt2x00dev, 1, 1); - break; - } - - rt61pci_bbp_write(rt2x00dev, 77, r77); - rt61pci_bbp_write(rt2x00dev, 3, r3); - rt61pci_bbp_write(rt2x00dev, 4, r4); -} - -struct antenna_sel { - u8 word; - /* - * value[0] -> non-LNA - * value[1] -> LNA - */ - u8 value[2]; -}; - -static const struct antenna_sel antenna_sel_a[] = { - { 96, { 0x58, 0x78 } }, - { 104, { 0x38, 0x48 } }, - { 75, { 0xfe, 0x80 } }, - { 86, { 0xfe, 0x80 } }, - { 88, { 0xfe, 0x80 } }, - { 35, { 0x60, 0x60 } }, - { 97, { 0x58, 0x58 } }, - { 98, { 0x58, 0x58 } }, -}; - -static const struct antenna_sel antenna_sel_bg[] = { - { 96, { 0x48, 0x68 } }, - { 104, { 0x2c, 0x3c } }, - { 75, { 0xfe, 0x80 } }, - { 86, { 0xfe, 0x80 } }, - { 88, { 0xfe, 0x80 } }, - { 35, { 0x50, 0x50 } }, - { 97, { 0x48, 0x48 } }, - { 98, { 0x48, 0x48 } }, -}; - -static void rt61pci_config_ant(struct rt2x00_dev *rt2x00dev, - struct antenna_setup *ant) -{ - const struct antenna_sel *sel; - unsigned int lna; - unsigned int i; - u32 reg; - - /* - * We should never come here because rt2x00lib is supposed - * to catch this and send us the correct antenna explicitely. - */ - BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY || - ant->tx == ANTENNA_SW_DIVERSITY); - - if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { - sel = antenna_sel_a; - lna = test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags); - } else { - sel = antenna_sel_bg; - lna = test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags); - } - - for (i = 0; i < ARRAY_SIZE(antenna_sel_a); i++) - rt61pci_bbp_write(rt2x00dev, sel[i].word, sel[i].value[lna]); - - rt2x00mmio_register_read(rt2x00dev, PHY_CSR0, ®); - - rt2x00_set_field32(®, PHY_CSR0_PA_PE_BG, - rt2x00dev->curr_band == IEEE80211_BAND_2GHZ); - rt2x00_set_field32(®, PHY_CSR0_PA_PE_A, - rt2x00dev->curr_band == IEEE80211_BAND_5GHZ); - - rt2x00mmio_register_write(rt2x00dev, PHY_CSR0, reg); - - if (rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF5325)) - rt61pci_config_antenna_5x(rt2x00dev, ant); - else if (rt2x00_rf(rt2x00dev, RF2527)) - rt61pci_config_antenna_2x(rt2x00dev, ant); - else if (rt2x00_rf(rt2x00dev, RF2529)) { - if (test_bit(CAPABILITY_DOUBLE_ANTENNA, &rt2x00dev->cap_flags)) - rt61pci_config_antenna_2x(rt2x00dev, ant); - else - rt61pci_config_antenna_2529(rt2x00dev, ant); - } -} - -static void rt61pci_config_lna_gain(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf) -{ - u16 eeprom; - short lna_gain = 0; - - if (libconf->conf->chandef.chan->band == IEEE80211_BAND_2GHZ) { - if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags)) - lna_gain += 14; - - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_BG, &eeprom); - lna_gain -= rt2x00_get_field16(eeprom, EEPROM_RSSI_OFFSET_BG_1); - } else { - if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags)) - lna_gain += 14; - - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_A, &eeprom); - lna_gain -= rt2x00_get_field16(eeprom, EEPROM_RSSI_OFFSET_A_1); - } - - rt2x00dev->lna_gain = lna_gain; -} - -static void rt61pci_config_channel(struct rt2x00_dev *rt2x00dev, - struct rf_channel *rf, const int txpower) -{ - u8 r3; - u8 r94; - u8 smart; - - rt2x00_set_field32(&rf->rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower)); - rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset); - - smart = !(rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF2527)); - - rt61pci_bbp_read(rt2x00dev, 3, &r3); - rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, smart); - rt61pci_bbp_write(rt2x00dev, 3, r3); - - r94 = 6; - if (txpower > MAX_TXPOWER && txpower <= (MAX_TXPOWER + r94)) - r94 += txpower - MAX_TXPOWER; - else if (txpower < MIN_TXPOWER && txpower >= (MIN_TXPOWER - r94)) - r94 += txpower; - rt61pci_bbp_write(rt2x00dev, 94, r94); - - rt61pci_rf_write(rt2x00dev, 1, rf->rf1); - rt61pci_rf_write(rt2x00dev, 2, rf->rf2); - rt61pci_rf_write(rt2x00dev, 3, rf->rf3 & ~0x00000004); - rt61pci_rf_write(rt2x00dev, 4, rf->rf4); - - udelay(200); - - rt61pci_rf_write(rt2x00dev, 1, rf->rf1); - rt61pci_rf_write(rt2x00dev, 2, rf->rf2); - rt61pci_rf_write(rt2x00dev, 3, rf->rf3 | 0x00000004); - rt61pci_rf_write(rt2x00dev, 4, rf->rf4); - - udelay(200); - - rt61pci_rf_write(rt2x00dev, 1, rf->rf1); - rt61pci_rf_write(rt2x00dev, 2, rf->rf2); - rt61pci_rf_write(rt2x00dev, 3, rf->rf3 & ~0x00000004); - rt61pci_rf_write(rt2x00dev, 4, rf->rf4); - - msleep(1); -} - -static void rt61pci_config_txpower(struct rt2x00_dev *rt2x00dev, - const int txpower) -{ - struct rf_channel rf; - - rt2x00_rf_read(rt2x00dev, 1, &rf.rf1); - rt2x00_rf_read(rt2x00dev, 2, &rf.rf2); - rt2x00_rf_read(rt2x00dev, 3, &rf.rf3); - rt2x00_rf_read(rt2x00dev, 4, &rf.rf4); - - rt61pci_config_channel(rt2x00dev, &rf, txpower); -} - -static void rt61pci_config_retry_limit(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf) -{ - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR4, ®); - rt2x00_set_field32(®, TXRX_CSR4_OFDM_TX_RATE_DOWN, 1); - rt2x00_set_field32(®, TXRX_CSR4_OFDM_TX_RATE_STEP, 0); - rt2x00_set_field32(®, TXRX_CSR4_OFDM_TX_FALLBACK_CCK, 0); - rt2x00_set_field32(®, TXRX_CSR4_LONG_RETRY_LIMIT, - libconf->conf->long_frame_max_tx_count); - rt2x00_set_field32(®, TXRX_CSR4_SHORT_RETRY_LIMIT, - libconf->conf->short_frame_max_tx_count); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR4, reg); -} - -static void rt61pci_config_ps(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf) -{ - enum dev_state state = - (libconf->conf->flags & IEEE80211_CONF_PS) ? - STATE_SLEEP : STATE_AWAKE; - u32 reg; - - if (state == STATE_SLEEP) { - rt2x00mmio_register_read(rt2x00dev, MAC_CSR11, ®); - rt2x00_set_field32(®, MAC_CSR11_DELAY_AFTER_TBCN, - rt2x00dev->beacon_int - 10); - rt2x00_set_field32(®, MAC_CSR11_TBCN_BEFORE_WAKEUP, - libconf->conf->listen_interval - 1); - rt2x00_set_field32(®, MAC_CSR11_WAKEUP_LATENCY, 5); - - /* We must first disable autowake before it can be enabled */ - rt2x00_set_field32(®, MAC_CSR11_AUTOWAKE, 0); - rt2x00mmio_register_write(rt2x00dev, MAC_CSR11, reg); - - rt2x00_set_field32(®, MAC_CSR11_AUTOWAKE, 1); - rt2x00mmio_register_write(rt2x00dev, MAC_CSR11, reg); - - rt2x00mmio_register_write(rt2x00dev, SOFT_RESET_CSR, - 0x00000005); - rt2x00mmio_register_write(rt2x00dev, IO_CNTL_CSR, 0x0000001c); - rt2x00mmio_register_write(rt2x00dev, PCI_USEC_CSR, 0x00000060); - - rt61pci_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0, 0); - } else { - rt2x00mmio_register_read(rt2x00dev, MAC_CSR11, ®); - rt2x00_set_field32(®, MAC_CSR11_DELAY_AFTER_TBCN, 0); - rt2x00_set_field32(®, MAC_CSR11_TBCN_BEFORE_WAKEUP, 0); - rt2x00_set_field32(®, MAC_CSR11_AUTOWAKE, 0); - rt2x00_set_field32(®, MAC_CSR11_WAKEUP_LATENCY, 0); - rt2x00mmio_register_write(rt2x00dev, MAC_CSR11, reg); - - rt2x00mmio_register_write(rt2x00dev, SOFT_RESET_CSR, - 0x00000007); - rt2x00mmio_register_write(rt2x00dev, IO_CNTL_CSR, 0x00000018); - rt2x00mmio_register_write(rt2x00dev, PCI_USEC_CSR, 0x00000020); - - rt61pci_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 0); - } -} - -static void rt61pci_config(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf, - const unsigned int flags) -{ - /* Always recalculate LNA gain before changing configuration */ - rt61pci_config_lna_gain(rt2x00dev, libconf); - - if (flags & IEEE80211_CONF_CHANGE_CHANNEL) - rt61pci_config_channel(rt2x00dev, &libconf->rf, - libconf->conf->power_level); - if ((flags & IEEE80211_CONF_CHANGE_POWER) && - !(flags & IEEE80211_CONF_CHANGE_CHANNEL)) - rt61pci_config_txpower(rt2x00dev, libconf->conf->power_level); - if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS) - rt61pci_config_retry_limit(rt2x00dev, libconf); - if (flags & IEEE80211_CONF_CHANGE_PS) - rt61pci_config_ps(rt2x00dev, libconf); -} - -/* - * Link tuning - */ -static void rt61pci_link_stats(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual) -{ - u32 reg; - - /* - * Update FCS error count from register. - */ - rt2x00mmio_register_read(rt2x00dev, STA_CSR0, ®); - qual->rx_failed = rt2x00_get_field32(reg, STA_CSR0_FCS_ERROR); - - /* - * Update False CCA count from register. - */ - rt2x00mmio_register_read(rt2x00dev, STA_CSR1, ®); - qual->false_cca = rt2x00_get_field32(reg, STA_CSR1_FALSE_CCA_ERROR); -} - -static inline void rt61pci_set_vgc(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual, u8 vgc_level) -{ - if (qual->vgc_level != vgc_level) { - rt61pci_bbp_write(rt2x00dev, 17, vgc_level); - qual->vgc_level = vgc_level; - qual->vgc_level_reg = vgc_level; - } -} - -static void rt61pci_reset_tuner(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual) -{ - rt61pci_set_vgc(rt2x00dev, qual, 0x20); -} - -static void rt61pci_link_tuner(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual, const u32 count) -{ - u8 up_bound; - u8 low_bound; - - /* - * Determine r17 bounds. - */ - if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { - low_bound = 0x28; - up_bound = 0x48; - if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags)) { - low_bound += 0x10; - up_bound += 0x10; - } - } else { - low_bound = 0x20; - up_bound = 0x40; - if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags)) { - low_bound += 0x10; - up_bound += 0x10; - } - } - - /* - * If we are not associated, we should go straight to the - * dynamic CCA tuning. - */ - if (!rt2x00dev->intf_associated) - goto dynamic_cca_tune; - - /* - * Special big-R17 for very short distance - */ - if (qual->rssi >= -35) { - rt61pci_set_vgc(rt2x00dev, qual, 0x60); - return; - } - - /* - * Special big-R17 for short distance - */ - if (qual->rssi >= -58) { - rt61pci_set_vgc(rt2x00dev, qual, up_bound); - return; - } - - /* - * Special big-R17 for middle-short distance - */ - if (qual->rssi >= -66) { - rt61pci_set_vgc(rt2x00dev, qual, low_bound + 0x10); - return; - } - - /* - * Special mid-R17 for middle distance - */ - if (qual->rssi >= -74) { - rt61pci_set_vgc(rt2x00dev, qual, low_bound + 0x08); - return; - } - - /* - * Special case: Change up_bound based on the rssi. - * Lower up_bound when rssi is weaker then -74 dBm. - */ - up_bound -= 2 * (-74 - qual->rssi); - if (low_bound > up_bound) - up_bound = low_bound; - - if (qual->vgc_level > up_bound) { - rt61pci_set_vgc(rt2x00dev, qual, up_bound); - return; - } - -dynamic_cca_tune: - - /* - * r17 does not yet exceed upper limit, continue and base - * the r17 tuning on the false CCA count. - */ - if ((qual->false_cca > 512) && (qual->vgc_level < up_bound)) - rt61pci_set_vgc(rt2x00dev, qual, ++qual->vgc_level); - else if ((qual->false_cca < 100) && (qual->vgc_level > low_bound)) - rt61pci_set_vgc(rt2x00dev, qual, --qual->vgc_level); -} - -/* - * Queue handlers. - */ -static void rt61pci_start_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_RX: - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR0, ®); - rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, 0); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR0, reg); - break; - case QID_BEACON: - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®); - rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1); - rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1); - rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg); - break; - default: - break; - } -} - -static void rt61pci_kick_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_AC_VO: - rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®); - rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC0, 1); - rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg); - break; - case QID_AC_VI: - rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®); - rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC1, 1); - rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg); - break; - case QID_AC_BE: - rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®); - rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC2, 1); - rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg); - break; - case QID_AC_BK: - rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®); - rt2x00_set_field32(®, TX_CNTL_CSR_KICK_TX_AC3, 1); - rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg); - break; - default: - break; - } -} - -static void rt61pci_stop_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_AC_VO: - rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®); - rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC0, 1); - rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg); - break; - case QID_AC_VI: - rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®); - rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC1, 1); - rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg); - break; - case QID_AC_BE: - rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®); - rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC2, 1); - rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg); - break; - case QID_AC_BK: - rt2x00mmio_register_read(rt2x00dev, TX_CNTL_CSR, ®); - rt2x00_set_field32(®, TX_CNTL_CSR_ABORT_TX_AC3, 1); - rt2x00mmio_register_write(rt2x00dev, TX_CNTL_CSR, reg); - break; - case QID_RX: - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR0, ®); - rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, 1); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR0, reg); - break; - case QID_BEACON: - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®); - rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 0); - rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 0); - rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg); - - /* - * Wait for possibly running tbtt tasklets. - */ - tasklet_kill(&rt2x00dev->tbtt_tasklet); - break; - default: - break; - } -} - -/* - * Firmware functions - */ -static char *rt61pci_get_firmware_name(struct rt2x00_dev *rt2x00dev) -{ - u16 chip; - char *fw_name; - - pci_read_config_word(to_pci_dev(rt2x00dev->dev), PCI_DEVICE_ID, &chip); - switch (chip) { - case RT2561_PCI_ID: - fw_name = FIRMWARE_RT2561; - break; - case RT2561s_PCI_ID: - fw_name = FIRMWARE_RT2561s; - break; - case RT2661_PCI_ID: - fw_name = FIRMWARE_RT2661; - break; - default: - fw_name = NULL; - break; - } - - return fw_name; -} - -static int rt61pci_check_firmware(struct rt2x00_dev *rt2x00dev, - const u8 *data, const size_t len) -{ - u16 fw_crc; - u16 crc; - - /* - * Only support 8kb firmware files. - */ - if (len != 8192) - return FW_BAD_LENGTH; - - /* - * The last 2 bytes in the firmware array are the crc checksum itself. - * This means that we should never pass those 2 bytes to the crc - * algorithm. - */ - fw_crc = (data[len - 2] << 8 | data[len - 1]); - - /* - * Use the crc itu-t algorithm. - */ - crc = crc_itu_t(0, data, len - 2); - crc = crc_itu_t_byte(crc, 0); - crc = crc_itu_t_byte(crc, 0); - - return (fw_crc == crc) ? FW_OK : FW_BAD_CRC; -} - -static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev, - const u8 *data, const size_t len) -{ - int i; - u32 reg; - - /* - * Wait for stable hardware. - */ - for (i = 0; i < 100; i++) { - rt2x00mmio_register_read(rt2x00dev, MAC_CSR0, ®); - if (reg) - break; - msleep(1); - } - - if (!reg) { - rt2x00_err(rt2x00dev, "Unstable hardware\n"); - return -EBUSY; - } - - /* - * Prepare MCU and mailbox for firmware loading. - */ - reg = 0; - rt2x00_set_field32(®, MCU_CNTL_CSR_RESET, 1); - rt2x00mmio_register_write(rt2x00dev, MCU_CNTL_CSR, reg); - rt2x00mmio_register_write(rt2x00dev, M2H_CMD_DONE_CSR, 0xffffffff); - rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); - rt2x00mmio_register_write(rt2x00dev, HOST_CMD_CSR, 0); - - /* - * Write firmware to device. - */ - reg = 0; - rt2x00_set_field32(®, MCU_CNTL_CSR_RESET, 1); - rt2x00_set_field32(®, MCU_CNTL_CSR_SELECT_BANK, 1); - rt2x00mmio_register_write(rt2x00dev, MCU_CNTL_CSR, reg); - - rt2x00mmio_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, - data, len); - - rt2x00_set_field32(®, MCU_CNTL_CSR_SELECT_BANK, 0); - rt2x00mmio_register_write(rt2x00dev, MCU_CNTL_CSR, reg); - - rt2x00_set_field32(®, MCU_CNTL_CSR_RESET, 0); - rt2x00mmio_register_write(rt2x00dev, MCU_CNTL_CSR, reg); - - for (i = 0; i < 100; i++) { - rt2x00mmio_register_read(rt2x00dev, MCU_CNTL_CSR, ®); - if (rt2x00_get_field32(reg, MCU_CNTL_CSR_READY)) - break; - msleep(1); - } - - if (i == 100) { - rt2x00_err(rt2x00dev, "MCU Control register not ready\n"); - return -EBUSY; - } - - /* - * Hardware needs another millisecond before it is ready. - */ - msleep(1); - - /* - * Reset MAC and BBP registers. - */ - reg = 0; - rt2x00_set_field32(®, MAC_CSR1_SOFT_RESET, 1); - rt2x00_set_field32(®, MAC_CSR1_BBP_RESET, 1); - rt2x00mmio_register_write(rt2x00dev, MAC_CSR1, reg); - - rt2x00mmio_register_read(rt2x00dev, MAC_CSR1, ®); - rt2x00_set_field32(®, MAC_CSR1_SOFT_RESET, 0); - rt2x00_set_field32(®, MAC_CSR1_BBP_RESET, 0); - rt2x00mmio_register_write(rt2x00dev, MAC_CSR1, reg); - - rt2x00mmio_register_read(rt2x00dev, MAC_CSR1, ®); - rt2x00_set_field32(®, MAC_CSR1_HOST_READY, 1); - rt2x00mmio_register_write(rt2x00dev, MAC_CSR1, reg); - - return 0; -} - -/* - * Initialization functions. - */ -static bool rt61pci_get_entry_state(struct queue_entry *entry) -{ - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - u32 word; - - if (entry->queue->qid == QID_RX) { - rt2x00_desc_read(entry_priv->desc, 0, &word); - - return rt2x00_get_field32(word, RXD_W0_OWNER_NIC); - } else { - rt2x00_desc_read(entry_priv->desc, 0, &word); - - return (rt2x00_get_field32(word, TXD_W0_OWNER_NIC) || - rt2x00_get_field32(word, TXD_W0_VALID)); - } -} - -static void rt61pci_clear_entry(struct queue_entry *entry) -{ - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - u32 word; - - if (entry->queue->qid == QID_RX) { - rt2x00_desc_read(entry_priv->desc, 5, &word); - rt2x00_set_field32(&word, RXD_W5_BUFFER_PHYSICAL_ADDRESS, - skbdesc->skb_dma); - rt2x00_desc_write(entry_priv->desc, 5, word); - - rt2x00_desc_read(entry_priv->desc, 0, &word); - rt2x00_set_field32(&word, RXD_W0_OWNER_NIC, 1); - rt2x00_desc_write(entry_priv->desc, 0, word); - } else { - rt2x00_desc_read(entry_priv->desc, 0, &word); - rt2x00_set_field32(&word, TXD_W0_VALID, 0); - rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 0); - rt2x00_desc_write(entry_priv->desc, 0, word); - } -} - -static int rt61pci_init_queues(struct rt2x00_dev *rt2x00dev) -{ - struct queue_entry_priv_mmio *entry_priv; - u32 reg; - - /* - * Initialize registers. - */ - rt2x00mmio_register_read(rt2x00dev, TX_RING_CSR0, ®); - rt2x00_set_field32(®, TX_RING_CSR0_AC0_RING_SIZE, - rt2x00dev->tx[0].limit); - rt2x00_set_field32(®, TX_RING_CSR0_AC1_RING_SIZE, - rt2x00dev->tx[1].limit); - rt2x00_set_field32(®, TX_RING_CSR0_AC2_RING_SIZE, - rt2x00dev->tx[2].limit); - rt2x00_set_field32(®, TX_RING_CSR0_AC3_RING_SIZE, - rt2x00dev->tx[3].limit); - rt2x00mmio_register_write(rt2x00dev, TX_RING_CSR0, reg); - - rt2x00mmio_register_read(rt2x00dev, TX_RING_CSR1, ®); - rt2x00_set_field32(®, TX_RING_CSR1_TXD_SIZE, - rt2x00dev->tx[0].desc_size / 4); - rt2x00mmio_register_write(rt2x00dev, TX_RING_CSR1, reg); - - entry_priv = rt2x00dev->tx[0].entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, AC0_BASE_CSR, ®); - rt2x00_set_field32(®, AC0_BASE_CSR_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, AC0_BASE_CSR, reg); - - entry_priv = rt2x00dev->tx[1].entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, AC1_BASE_CSR, ®); - rt2x00_set_field32(®, AC1_BASE_CSR_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, AC1_BASE_CSR, reg); - - entry_priv = rt2x00dev->tx[2].entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, AC2_BASE_CSR, ®); - rt2x00_set_field32(®, AC2_BASE_CSR_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, AC2_BASE_CSR, reg); - - entry_priv = rt2x00dev->tx[3].entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, AC3_BASE_CSR, ®); - rt2x00_set_field32(®, AC3_BASE_CSR_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, AC3_BASE_CSR, reg); - - rt2x00mmio_register_read(rt2x00dev, RX_RING_CSR, ®); - rt2x00_set_field32(®, RX_RING_CSR_RING_SIZE, rt2x00dev->rx->limit); - rt2x00_set_field32(®, RX_RING_CSR_RXD_SIZE, - rt2x00dev->rx->desc_size / 4); - rt2x00_set_field32(®, RX_RING_CSR_RXD_WRITEBACK_SIZE, 4); - rt2x00mmio_register_write(rt2x00dev, RX_RING_CSR, reg); - - entry_priv = rt2x00dev->rx->entries[0].priv_data; - rt2x00mmio_register_read(rt2x00dev, RX_BASE_CSR, ®); - rt2x00_set_field32(®, RX_BASE_CSR_RING_REGISTER, - entry_priv->desc_dma); - rt2x00mmio_register_write(rt2x00dev, RX_BASE_CSR, reg); - - rt2x00mmio_register_read(rt2x00dev, TX_DMA_DST_CSR, ®); - rt2x00_set_field32(®, TX_DMA_DST_CSR_DEST_AC0, 2); - rt2x00_set_field32(®, TX_DMA_DST_CSR_DEST_AC1, 2); - rt2x00_set_field32(®, TX_DMA_DST_CSR_DEST_AC2, 2); - rt2x00_set_field32(®, TX_DMA_DST_CSR_DEST_AC3, 2); - rt2x00mmio_register_write(rt2x00dev, TX_DMA_DST_CSR, reg); - - rt2x00mmio_register_read(rt2x00dev, LOAD_TX_RING_CSR, ®); - rt2x00_set_field32(®, LOAD_TX_RING_CSR_LOAD_TXD_AC0, 1); - rt2x00_set_field32(®, LOAD_TX_RING_CSR_LOAD_TXD_AC1, 1); - rt2x00_set_field32(®, LOAD_TX_RING_CSR_LOAD_TXD_AC2, 1); - rt2x00_set_field32(®, LOAD_TX_RING_CSR_LOAD_TXD_AC3, 1); - rt2x00mmio_register_write(rt2x00dev, LOAD_TX_RING_CSR, reg); - - rt2x00mmio_register_read(rt2x00dev, RX_CNTL_CSR, ®); - rt2x00_set_field32(®, RX_CNTL_CSR_LOAD_RXD, 1); - rt2x00mmio_register_write(rt2x00dev, RX_CNTL_CSR, reg); - - return 0; -} - -static int rt61pci_init_registers(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR0, ®); - rt2x00_set_field32(®, TXRX_CSR0_AUTO_TX_SEQ, 1); - rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, 0); - rt2x00_set_field32(®, TXRX_CSR0_TX_WITHOUT_WAITING, 0); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR0, reg); - - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR1, ®); - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID0, 47); /* CCK Signal */ - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID0_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID1, 30); /* Rssi */ - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID1_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID2, 42); /* OFDM Rate */ - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID2_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID3, 30); /* Rssi */ - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID3_VALID, 1); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR1, reg); - - /* - * CCK TXD BBP registers - */ - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR2, ®); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID0, 13); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID0_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID1, 12); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID1_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID2, 11); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID2_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID3, 10); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID3_VALID, 1); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR2, reg); - - /* - * OFDM TXD BBP registers - */ - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR3, ®); - rt2x00_set_field32(®, TXRX_CSR3_BBP_ID0, 7); - rt2x00_set_field32(®, TXRX_CSR3_BBP_ID0_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR3_BBP_ID1, 6); - rt2x00_set_field32(®, TXRX_CSR3_BBP_ID1_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR3_BBP_ID2, 5); - rt2x00_set_field32(®, TXRX_CSR3_BBP_ID2_VALID, 1); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR3, reg); - - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR7, ®); - rt2x00_set_field32(®, TXRX_CSR7_ACK_CTS_6MBS, 59); - rt2x00_set_field32(®, TXRX_CSR7_ACK_CTS_9MBS, 53); - rt2x00_set_field32(®, TXRX_CSR7_ACK_CTS_12MBS, 49); - rt2x00_set_field32(®, TXRX_CSR7_ACK_CTS_18MBS, 46); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR7, reg); - - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR8, ®); - rt2x00_set_field32(®, TXRX_CSR8_ACK_CTS_24MBS, 44); - rt2x00_set_field32(®, TXRX_CSR8_ACK_CTS_36MBS, 42); - rt2x00_set_field32(®, TXRX_CSR8_ACK_CTS_48MBS, 42); - rt2x00_set_field32(®, TXRX_CSR8_ACK_CTS_54MBS, 42); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR8, reg); - - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®); - rt2x00_set_field32(®, TXRX_CSR9_BEACON_INTERVAL, 0); - rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 0); - rt2x00_set_field32(®, TXRX_CSR9_TSF_SYNC, 0); - rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 0); - rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); - rt2x00_set_field32(®, TXRX_CSR9_TIMESTAMP_COMPENSATE, 0); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg); - - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR15, 0x0000000f); - - rt2x00mmio_register_write(rt2x00dev, MAC_CSR6, 0x00000fff); - - rt2x00mmio_register_read(rt2x00dev, MAC_CSR9, ®); - rt2x00_set_field32(®, MAC_CSR9_CW_SELECT, 0); - rt2x00mmio_register_write(rt2x00dev, MAC_CSR9, reg); - - rt2x00mmio_register_write(rt2x00dev, MAC_CSR10, 0x0000071c); - - if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE)) - return -EBUSY; - - rt2x00mmio_register_write(rt2x00dev, MAC_CSR13, 0x0000e000); - - /* - * Invalidate all Shared Keys (SEC_CSR0), - * and clear the Shared key Cipher algorithms (SEC_CSR1 & SEC_CSR5) - */ - rt2x00mmio_register_write(rt2x00dev, SEC_CSR0, 0x00000000); - rt2x00mmio_register_write(rt2x00dev, SEC_CSR1, 0x00000000); - rt2x00mmio_register_write(rt2x00dev, SEC_CSR5, 0x00000000); - - rt2x00mmio_register_write(rt2x00dev, PHY_CSR1, 0x000023b0); - rt2x00mmio_register_write(rt2x00dev, PHY_CSR5, 0x060a100c); - rt2x00mmio_register_write(rt2x00dev, PHY_CSR6, 0x00080606); - rt2x00mmio_register_write(rt2x00dev, PHY_CSR7, 0x00000a08); - - rt2x00mmio_register_write(rt2x00dev, PCI_CFG_CSR, 0x28ca4404); - - rt2x00mmio_register_write(rt2x00dev, TEST_MODE_CSR, 0x00000200); - - rt2x00mmio_register_write(rt2x00dev, M2H_CMD_DONE_CSR, 0xffffffff); - - /* - * Clear all beacons - * For the Beacon base registers we only need to clear - * the first byte since that byte contains the VALID and OWNER - * bits which (when set to 0) will invalidate the entire beacon. - */ - rt2x00mmio_register_write(rt2x00dev, HW_BEACON_BASE0, 0); - rt2x00mmio_register_write(rt2x00dev, HW_BEACON_BASE1, 0); - rt2x00mmio_register_write(rt2x00dev, HW_BEACON_BASE2, 0); - rt2x00mmio_register_write(rt2x00dev, HW_BEACON_BASE3, 0); - - /* - * We must clear the error counters. - * These registers are cleared on read, - * so we may pass a useless variable to store the value. - */ - rt2x00mmio_register_read(rt2x00dev, STA_CSR0, ®); - rt2x00mmio_register_read(rt2x00dev, STA_CSR1, ®); - rt2x00mmio_register_read(rt2x00dev, STA_CSR2, ®); - - /* - * Reset MAC and BBP registers. - */ - rt2x00mmio_register_read(rt2x00dev, MAC_CSR1, ®); - rt2x00_set_field32(®, MAC_CSR1_SOFT_RESET, 1); - rt2x00_set_field32(®, MAC_CSR1_BBP_RESET, 1); - rt2x00mmio_register_write(rt2x00dev, MAC_CSR1, reg); - - rt2x00mmio_register_read(rt2x00dev, MAC_CSR1, ®); - rt2x00_set_field32(®, MAC_CSR1_SOFT_RESET, 0); - rt2x00_set_field32(®, MAC_CSR1_BBP_RESET, 0); - rt2x00mmio_register_write(rt2x00dev, MAC_CSR1, reg); - - rt2x00mmio_register_read(rt2x00dev, MAC_CSR1, ®); - rt2x00_set_field32(®, MAC_CSR1_HOST_READY, 1); - rt2x00mmio_register_write(rt2x00dev, MAC_CSR1, reg); - - return 0; -} - -static int rt61pci_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u8 value; - - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt61pci_bbp_read(rt2x00dev, 0, &value); - if ((value != 0xff) && (value != 0x00)) - return 0; - udelay(REGISTER_BUSY_DELAY); - } - - rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n"); - return -EACCES; -} - -static int rt61pci_init_bbp(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u16 eeprom; - u8 reg_id; - u8 value; - - if (unlikely(rt61pci_wait_bbp_ready(rt2x00dev))) - return -EACCES; - - rt61pci_bbp_write(rt2x00dev, 3, 0x00); - rt61pci_bbp_write(rt2x00dev, 15, 0x30); - rt61pci_bbp_write(rt2x00dev, 21, 0xc8); - rt61pci_bbp_write(rt2x00dev, 22, 0x38); - rt61pci_bbp_write(rt2x00dev, 23, 0x06); - rt61pci_bbp_write(rt2x00dev, 24, 0xfe); - rt61pci_bbp_write(rt2x00dev, 25, 0x0a); - rt61pci_bbp_write(rt2x00dev, 26, 0x0d); - rt61pci_bbp_write(rt2x00dev, 34, 0x12); - rt61pci_bbp_write(rt2x00dev, 37, 0x07); - rt61pci_bbp_write(rt2x00dev, 39, 0xf8); - rt61pci_bbp_write(rt2x00dev, 41, 0x60); - rt61pci_bbp_write(rt2x00dev, 53, 0x10); - rt61pci_bbp_write(rt2x00dev, 54, 0x18); - rt61pci_bbp_write(rt2x00dev, 60, 0x10); - rt61pci_bbp_write(rt2x00dev, 61, 0x04); - rt61pci_bbp_write(rt2x00dev, 62, 0x04); - rt61pci_bbp_write(rt2x00dev, 75, 0xfe); - rt61pci_bbp_write(rt2x00dev, 86, 0xfe); - rt61pci_bbp_write(rt2x00dev, 88, 0xfe); - rt61pci_bbp_write(rt2x00dev, 90, 0x0f); - rt61pci_bbp_write(rt2x00dev, 99, 0x00); - rt61pci_bbp_write(rt2x00dev, 102, 0x16); - rt61pci_bbp_write(rt2x00dev, 107, 0x04); - - for (i = 0; i < EEPROM_BBP_SIZE; i++) { - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBP_START + i, &eeprom); - - if (eeprom != 0xffff && eeprom != 0x0000) { - reg_id = rt2x00_get_field16(eeprom, EEPROM_BBP_REG_ID); - value = rt2x00_get_field16(eeprom, EEPROM_BBP_VALUE); - rt61pci_bbp_write(rt2x00dev, reg_id, value); - } - } - - return 0; -} - -/* - * Device state switch handlers. - */ -static void rt61pci_toggle_irq(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - int mask = (state == STATE_RADIO_IRQ_OFF); - u32 reg; - unsigned long flags; - - /* - * When interrupts are being enabled, the interrupt registers - * should clear the register to assure a clean state. - */ - if (state == STATE_RADIO_IRQ_ON) { - rt2x00mmio_register_read(rt2x00dev, INT_SOURCE_CSR, ®); - rt2x00mmio_register_write(rt2x00dev, INT_SOURCE_CSR, reg); - - rt2x00mmio_register_read(rt2x00dev, MCU_INT_SOURCE_CSR, ®); - rt2x00mmio_register_write(rt2x00dev, MCU_INT_SOURCE_CSR, reg); - } - - /* - * Only toggle the interrupts bits we are going to use. - * Non-checked interrupt bits are disabled by default. - */ - spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags); - - rt2x00mmio_register_read(rt2x00dev, INT_MASK_CSR, ®); - rt2x00_set_field32(®, INT_MASK_CSR_TXDONE, mask); - rt2x00_set_field32(®, INT_MASK_CSR_RXDONE, mask); - rt2x00_set_field32(®, INT_MASK_CSR_BEACON_DONE, mask); - rt2x00_set_field32(®, INT_MASK_CSR_ENABLE_MITIGATION, mask); - rt2x00_set_field32(®, INT_MASK_CSR_MITIGATION_PERIOD, 0xff); - rt2x00mmio_register_write(rt2x00dev, INT_MASK_CSR, reg); - - rt2x00mmio_register_read(rt2x00dev, MCU_INT_MASK_CSR, ®); - rt2x00_set_field32(®, MCU_INT_MASK_CSR_0, mask); - rt2x00_set_field32(®, MCU_INT_MASK_CSR_1, mask); - rt2x00_set_field32(®, MCU_INT_MASK_CSR_2, mask); - rt2x00_set_field32(®, MCU_INT_MASK_CSR_3, mask); - rt2x00_set_field32(®, MCU_INT_MASK_CSR_4, mask); - rt2x00_set_field32(®, MCU_INT_MASK_CSR_5, mask); - rt2x00_set_field32(®, MCU_INT_MASK_CSR_6, mask); - rt2x00_set_field32(®, MCU_INT_MASK_CSR_7, mask); - rt2x00_set_field32(®, MCU_INT_MASK_CSR_TWAKEUP, mask); - rt2x00mmio_register_write(rt2x00dev, MCU_INT_MASK_CSR, reg); - - spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags); - - if (state == STATE_RADIO_IRQ_OFF) { - /* - * Ensure that all tasklets are finished. - */ - tasklet_kill(&rt2x00dev->txstatus_tasklet); - tasklet_kill(&rt2x00dev->rxdone_tasklet); - tasklet_kill(&rt2x00dev->autowake_tasklet); - tasklet_kill(&rt2x00dev->tbtt_tasklet); - } -} - -static int rt61pci_enable_radio(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - /* - * Initialize all registers. - */ - if (unlikely(rt61pci_init_queues(rt2x00dev) || - rt61pci_init_registers(rt2x00dev) || - rt61pci_init_bbp(rt2x00dev))) - return -EIO; - - /* - * Enable RX. - */ - rt2x00mmio_register_read(rt2x00dev, RX_CNTL_CSR, ®); - rt2x00_set_field32(®, RX_CNTL_CSR_ENABLE_RX_DMA, 1); - rt2x00mmio_register_write(rt2x00dev, RX_CNTL_CSR, reg); - - return 0; -} - -static void rt61pci_disable_radio(struct rt2x00_dev *rt2x00dev) -{ - /* - * Disable power - */ - rt2x00mmio_register_write(rt2x00dev, MAC_CSR10, 0x00001818); -} - -static int rt61pci_set_state(struct rt2x00_dev *rt2x00dev, enum dev_state state) -{ - u32 reg, reg2; - unsigned int i; - char put_to_sleep; - - put_to_sleep = (state != STATE_AWAKE); - - rt2x00mmio_register_read(rt2x00dev, MAC_CSR12, ®); - rt2x00_set_field32(®, MAC_CSR12_FORCE_WAKEUP, !put_to_sleep); - rt2x00_set_field32(®, MAC_CSR12_PUT_TO_SLEEP, put_to_sleep); - rt2x00mmio_register_write(rt2x00dev, MAC_CSR12, reg); - - /* - * Device is not guaranteed to be in the requested state yet. - * We must wait until the register indicates that the - * device has entered the correct state. - */ - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2x00mmio_register_read(rt2x00dev, MAC_CSR12, ®2); - state = rt2x00_get_field32(reg2, MAC_CSR12_BBP_CURRENT_STATE); - if (state == !put_to_sleep) - return 0; - rt2x00mmio_register_write(rt2x00dev, MAC_CSR12, reg); - msleep(10); - } - - return -EBUSY; -} - -static int rt61pci_set_device_state(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - int retval = 0; - - switch (state) { - case STATE_RADIO_ON: - retval = rt61pci_enable_radio(rt2x00dev); - break; - case STATE_RADIO_OFF: - rt61pci_disable_radio(rt2x00dev); - break; - case STATE_RADIO_IRQ_ON: - case STATE_RADIO_IRQ_OFF: - rt61pci_toggle_irq(rt2x00dev, state); - break; - case STATE_DEEP_SLEEP: - case STATE_SLEEP: - case STATE_STANDBY: - case STATE_AWAKE: - retval = rt61pci_set_state(rt2x00dev, state); - break; - default: - retval = -ENOTSUPP; - break; - } - - if (unlikely(retval)) - rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", - state, retval); - - return retval; -} - -/* - * TX descriptor initialization - */ -static void rt61pci_write_tx_desc(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - __le32 *txd = entry_priv->desc; - u32 word; - - /* - * Start writing the descriptor words. - */ - rt2x00_desc_read(txd, 1, &word); - rt2x00_set_field32(&word, TXD_W1_HOST_Q_ID, entry->queue->qid); - rt2x00_set_field32(&word, TXD_W1_AIFSN, entry->queue->aifs); - rt2x00_set_field32(&word, TXD_W1_CWMIN, entry->queue->cw_min); - rt2x00_set_field32(&word, TXD_W1_CWMAX, entry->queue->cw_max); - rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, txdesc->iv_offset); - rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE, - test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W1_BUFFER_COUNT, 1); - rt2x00_desc_write(txd, 1, word); - - rt2x00_desc_read(txd, 2, &word); - rt2x00_set_field32(&word, TXD_W2_PLCP_SIGNAL, txdesc->u.plcp.signal); - rt2x00_set_field32(&word, TXD_W2_PLCP_SERVICE, txdesc->u.plcp.service); - rt2x00_set_field32(&word, TXD_W2_PLCP_LENGTH_LOW, - txdesc->u.plcp.length_low); - rt2x00_set_field32(&word, TXD_W2_PLCP_LENGTH_HIGH, - txdesc->u.plcp.length_high); - rt2x00_desc_write(txd, 2, word); - - if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags)) { - _rt2x00_desc_write(txd, 3, skbdesc->iv[0]); - _rt2x00_desc_write(txd, 4, skbdesc->iv[1]); - } - - rt2x00_desc_read(txd, 5, &word); - rt2x00_set_field32(&word, TXD_W5_PID_TYPE, entry->queue->qid); - rt2x00_set_field32(&word, TXD_W5_PID_SUBTYPE, - skbdesc->entry->entry_idx); - rt2x00_set_field32(&word, TXD_W5_TX_POWER, - TXPOWER_TO_DEV(entry->queue->rt2x00dev->tx_power)); - rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1); - rt2x00_desc_write(txd, 5, word); - - if (entry->queue->qid != QID_BEACON) { - rt2x00_desc_read(txd, 6, &word); - rt2x00_set_field32(&word, TXD_W6_BUFFER_PHYSICAL_ADDRESS, - skbdesc->skb_dma); - rt2x00_desc_write(txd, 6, word); - - rt2x00_desc_read(txd, 11, &word); - rt2x00_set_field32(&word, TXD_W11_BUFFER_LENGTH0, - txdesc->length); - rt2x00_desc_write(txd, 11, word); - } - - /* - * Writing TXD word 0 must the last to prevent a race condition with - * the device, whereby the device may take hold of the TXD before we - * finished updating it. - */ - rt2x00_desc_read(txd, 0, &word); - rt2x00_set_field32(&word, TXD_W0_OWNER_NIC, 1); - rt2x00_set_field32(&word, TXD_W0_VALID, 1); - rt2x00_set_field32(&word, TXD_W0_MORE_FRAG, - test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_ACK, - test_bit(ENTRY_TXD_ACK, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_TIMESTAMP, - test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_OFDM, - (txdesc->rate_mode == RATE_MODE_OFDM)); - rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->u.plcp.ifs); - rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, - test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_TKIP_MIC, - test_bit(ENTRY_TXD_ENCRYPT_MMIC, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_KEY_TABLE, - test_bit(ENTRY_TXD_ENCRYPT_PAIRWISE, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_KEY_INDEX, txdesc->key_idx); - rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, txdesc->length); - rt2x00_set_field32(&word, TXD_W0_BURST, - test_bit(ENTRY_TXD_BURST, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_CIPHER_ALG, txdesc->cipher); - rt2x00_desc_write(txd, 0, word); - - /* - * Register descriptor details in skb frame descriptor. - */ - skbdesc->desc = txd; - skbdesc->desc_len = (entry->queue->qid == QID_BEACON) ? TXINFO_SIZE : - TXD_DESC_SIZE; -} - -/* - * TX data initialization - */ -static void rt61pci_write_beacon(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - unsigned int beacon_base; - unsigned int padding_len; - u32 orig_reg, reg; - - /* - * Disable beaconing while we are reloading the beacon data, - * otherwise we might be sending out invalid data. - */ - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®); - orig_reg = reg; - rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg); - - /* - * Write the TX descriptor for the beacon. - */ - rt61pci_write_tx_desc(entry, txdesc); - - /* - * Dump beacon to userspace through debugfs. - */ - rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb); - - /* - * Write entire beacon with descriptor and padding to register. - */ - padding_len = roundup(entry->skb->len, 4) - entry->skb->len; - if (padding_len && skb_pad(entry->skb, padding_len)) { - rt2x00_err(rt2x00dev, "Failure padding beacon, aborting\n"); - /* skb freed by skb_pad() on failure */ - entry->skb = NULL; - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, orig_reg); - return; - } - - beacon_base = HW_BEACON_OFFSET(entry->entry_idx); - rt2x00mmio_register_multiwrite(rt2x00dev, beacon_base, - entry_priv->desc, TXINFO_SIZE); - rt2x00mmio_register_multiwrite(rt2x00dev, beacon_base + TXINFO_SIZE, - entry->skb->data, - entry->skb->len + padding_len); - - /* - * Enable beaconing again. - * - * For Wi-Fi faily generated beacons between participating - * stations. Set TBTT phase adaptive adjustment step to 8us. - */ - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR10, 0x00001008); - - rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg); - - /* - * Clean up beacon skb. - */ - dev_kfree_skb_any(entry->skb); - entry->skb = NULL; -} - -static void rt61pci_clear_beacon(struct queue_entry *entry) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - u32 reg; - - /* - * Disable beaconing while we are reloading the beacon data, - * otherwise we might be sending out invalid data. - */ - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR9, ®); - rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg); - - /* - * Clear beacon. - */ - rt2x00mmio_register_write(rt2x00dev, - HW_BEACON_OFFSET(entry->entry_idx), 0); - - /* - * Enable beaconing again. - */ - rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); - rt2x00mmio_register_write(rt2x00dev, TXRX_CSR9, reg); -} - -/* - * RX control handlers - */ -static int rt61pci_agc_to_rssi(struct rt2x00_dev *rt2x00dev, int rxd_w1) -{ - u8 offset = rt2x00dev->lna_gain; - u8 lna; - - lna = rt2x00_get_field32(rxd_w1, RXD_W1_RSSI_LNA); - switch (lna) { - case 3: - offset += 90; - break; - case 2: - offset += 74; - break; - case 1: - offset += 64; - break; - default: - return 0; - } - - if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { - if (lna == 3 || lna == 2) - offset += 10; - } - - return rt2x00_get_field32(rxd_w1, RXD_W1_RSSI_AGC) * 2 - offset; -} - -static void rt61pci_fill_rxdone(struct queue_entry *entry, - struct rxdone_entry_desc *rxdesc) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct queue_entry_priv_mmio *entry_priv = entry->priv_data; - u32 word0; - u32 word1; - - rt2x00_desc_read(entry_priv->desc, 0, &word0); - rt2x00_desc_read(entry_priv->desc, 1, &word1); - - if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) - rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; - - rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER_ALG); - rxdesc->cipher_status = rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR); - - if (rxdesc->cipher != CIPHER_NONE) { - _rt2x00_desc_read(entry_priv->desc, 2, &rxdesc->iv[0]); - _rt2x00_desc_read(entry_priv->desc, 3, &rxdesc->iv[1]); - rxdesc->dev_flags |= RXDONE_CRYPTO_IV; - - _rt2x00_desc_read(entry_priv->desc, 4, &rxdesc->icv); - rxdesc->dev_flags |= RXDONE_CRYPTO_ICV; - - /* - * Hardware has stripped IV/EIV data from 802.11 frame during - * decryption. It has provided the data separately but rt2x00lib - * should decide if it should be reinserted. - */ - rxdesc->flags |= RX_FLAG_IV_STRIPPED; - - /* - * The hardware has already checked the Michael Mic and has - * stripped it from the frame. Signal this to mac80211. - */ - rxdesc->flags |= RX_FLAG_MMIC_STRIPPED; - - if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) - rxdesc->flags |= RX_FLAG_DECRYPTED; - else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) - rxdesc->flags |= RX_FLAG_MMIC_ERROR; - } - - /* - * Obtain the status about this packet. - * When frame was received with an OFDM bitrate, - * the signal is the PLCP value. If it was received with - * a CCK bitrate the signal is the rate in 100kbit/s. - */ - rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL); - rxdesc->rssi = rt61pci_agc_to_rssi(rt2x00dev, word1); - rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); - - if (rt2x00_get_field32(word0, RXD_W0_OFDM)) - rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP; - else - rxdesc->dev_flags |= RXDONE_SIGNAL_BITRATE; - if (rt2x00_get_field32(word0, RXD_W0_MY_BSS)) - rxdesc->dev_flags |= RXDONE_MY_BSS; -} - -/* - * Interrupt functions. - */ -static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev) -{ - struct data_queue *queue; - struct queue_entry *entry; - struct queue_entry *entry_done; - struct queue_entry_priv_mmio *entry_priv; - struct txdone_entry_desc txdesc; - u32 word; - u32 reg; - int type; - int index; - int i; - - /* - * TX_STA_FIFO is a stack of X entries, hence read TX_STA_FIFO - * at most X times and also stop processing once the TX_STA_FIFO_VALID - * flag is not set anymore. - * - * The legacy drivers use X=TX_RING_SIZE but state in a comment - * that the TX_STA_FIFO stack has a size of 16. We stick to our - * tx ring size for now. - */ - for (i = 0; i < rt2x00dev->ops->tx->entry_num; i++) { - rt2x00mmio_register_read(rt2x00dev, STA_CSR4, ®); - if (!rt2x00_get_field32(reg, STA_CSR4_VALID)) - break; - - /* - * Skip this entry when it contains an invalid - * queue identication number. - */ - type = rt2x00_get_field32(reg, STA_CSR4_PID_TYPE); - queue = rt2x00queue_get_tx_queue(rt2x00dev, type); - if (unlikely(!queue)) - continue; - - /* - * Skip this entry when it contains an invalid - * index number. - */ - index = rt2x00_get_field32(reg, STA_CSR4_PID_SUBTYPE); - if (unlikely(index >= queue->limit)) - continue; - - entry = &queue->entries[index]; - entry_priv = entry->priv_data; - rt2x00_desc_read(entry_priv->desc, 0, &word); - - if (rt2x00_get_field32(word, TXD_W0_OWNER_NIC) || - !rt2x00_get_field32(word, TXD_W0_VALID)) - return; - - entry_done = rt2x00queue_get_entry(queue, Q_INDEX_DONE); - while (entry != entry_done) { - /* Catch up. - * Just report any entries we missed as failed. - */ - rt2x00_warn(rt2x00dev, "TX status report missed for entry %d\n", - entry_done->entry_idx); - - rt2x00lib_txdone_noinfo(entry_done, TXDONE_UNKNOWN); - entry_done = rt2x00queue_get_entry(queue, Q_INDEX_DONE); - } - - /* - * Obtain the status about this packet. - */ - txdesc.flags = 0; - switch (rt2x00_get_field32(reg, STA_CSR4_TX_RESULT)) { - case 0: /* Success, maybe with retry */ - __set_bit(TXDONE_SUCCESS, &txdesc.flags); - break; - case 6: /* Failure, excessive retries */ - __set_bit(TXDONE_EXCESSIVE_RETRY, &txdesc.flags); - /* Don't break, this is a failed frame! */ - default: /* Failure */ - __set_bit(TXDONE_FAILURE, &txdesc.flags); - } - txdesc.retry = rt2x00_get_field32(reg, STA_CSR4_RETRY_COUNT); - - /* - * the frame was retried at least once - * -> hw used fallback rates - */ - if (txdesc.retry) - __set_bit(TXDONE_FALLBACK, &txdesc.flags); - - rt2x00lib_txdone(entry, &txdesc); - } -} - -static void rt61pci_wakeup(struct rt2x00_dev *rt2x00dev) -{ - struct rt2x00lib_conf libconf = { .conf = &rt2x00dev->hw->conf }; - - rt61pci_config(rt2x00dev, &libconf, IEEE80211_CONF_CHANGE_PS); -} - -static inline void rt61pci_enable_interrupt(struct rt2x00_dev *rt2x00dev, - struct rt2x00_field32 irq_field) -{ - u32 reg; - - /* - * Enable a single interrupt. The interrupt mask register - * access needs locking. - */ - spin_lock_irq(&rt2x00dev->irqmask_lock); - - rt2x00mmio_register_read(rt2x00dev, INT_MASK_CSR, ®); - rt2x00_set_field32(®, irq_field, 0); - rt2x00mmio_register_write(rt2x00dev, INT_MASK_CSR, reg); - - spin_unlock_irq(&rt2x00dev->irqmask_lock); -} - -static void rt61pci_enable_mcu_interrupt(struct rt2x00_dev *rt2x00dev, - struct rt2x00_field32 irq_field) -{ - u32 reg; - - /* - * Enable a single MCU interrupt. The interrupt mask register - * access needs locking. - */ - spin_lock_irq(&rt2x00dev->irqmask_lock); - - rt2x00mmio_register_read(rt2x00dev, MCU_INT_MASK_CSR, ®); - rt2x00_set_field32(®, irq_field, 0); - rt2x00mmio_register_write(rt2x00dev, MCU_INT_MASK_CSR, reg); - - spin_unlock_irq(&rt2x00dev->irqmask_lock); -} - -static void rt61pci_txstatus_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - rt61pci_txdone(rt2x00dev); - if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt61pci_enable_interrupt(rt2x00dev, INT_MASK_CSR_TXDONE); -} - -static void rt61pci_tbtt_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - rt2x00lib_beacondone(rt2x00dev); - if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt61pci_enable_interrupt(rt2x00dev, INT_MASK_CSR_BEACON_DONE); -} - -static void rt61pci_rxdone_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - if (rt2x00mmio_rxdone(rt2x00dev)) - tasklet_schedule(&rt2x00dev->rxdone_tasklet); - else if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt61pci_enable_interrupt(rt2x00dev, INT_MASK_CSR_RXDONE); -} - -static void rt61pci_autowake_tasklet(unsigned long data) -{ - struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; - rt61pci_wakeup(rt2x00dev); - rt2x00mmio_register_write(rt2x00dev, - M2H_CMD_DONE_CSR, 0xffffffff); - if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - rt61pci_enable_mcu_interrupt(rt2x00dev, MCU_INT_MASK_CSR_TWAKEUP); -} - -static irqreturn_t rt61pci_interrupt(int irq, void *dev_instance) -{ - struct rt2x00_dev *rt2x00dev = dev_instance; - u32 reg_mcu, mask_mcu; - u32 reg, mask; - - /* - * Get the interrupt sources & saved to local variable. - * Write register value back to clear pending interrupts. - */ - rt2x00mmio_register_read(rt2x00dev, MCU_INT_SOURCE_CSR, ®_mcu); - rt2x00mmio_register_write(rt2x00dev, MCU_INT_SOURCE_CSR, reg_mcu); - - rt2x00mmio_register_read(rt2x00dev, INT_SOURCE_CSR, ®); - rt2x00mmio_register_write(rt2x00dev, INT_SOURCE_CSR, reg); - - if (!reg && !reg_mcu) - return IRQ_NONE; - - if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) - return IRQ_HANDLED; - - /* - * Schedule tasklets for interrupt handling. - */ - if (rt2x00_get_field32(reg, INT_SOURCE_CSR_RXDONE)) - tasklet_schedule(&rt2x00dev->rxdone_tasklet); - - if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TXDONE)) - tasklet_schedule(&rt2x00dev->txstatus_tasklet); - - if (rt2x00_get_field32(reg, INT_SOURCE_CSR_BEACON_DONE)) - tasklet_hi_schedule(&rt2x00dev->tbtt_tasklet); - - if (rt2x00_get_field32(reg_mcu, MCU_INT_SOURCE_CSR_TWAKEUP)) - tasklet_schedule(&rt2x00dev->autowake_tasklet); - - /* - * Since INT_MASK_CSR and INT_SOURCE_CSR use the same bits - * for interrupts and interrupt masks we can just use the value of - * INT_SOURCE_CSR to create the interrupt mask. - */ - mask = reg; - mask_mcu = reg_mcu; - - /* - * Disable all interrupts for which a tasklet was scheduled right now, - * the tasklet will reenable the appropriate interrupts. - */ - spin_lock(&rt2x00dev->irqmask_lock); - - rt2x00mmio_register_read(rt2x00dev, INT_MASK_CSR, ®); - reg |= mask; - rt2x00mmio_register_write(rt2x00dev, INT_MASK_CSR, reg); - - rt2x00mmio_register_read(rt2x00dev, MCU_INT_MASK_CSR, ®); - reg |= mask_mcu; - rt2x00mmio_register_write(rt2x00dev, MCU_INT_MASK_CSR, reg); - - spin_unlock(&rt2x00dev->irqmask_lock); - - return IRQ_HANDLED; -} - -/* - * Device probe functions. - */ -static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) -{ - struct eeprom_93cx6 eeprom; - u32 reg; - u16 word; - u8 *mac; - s8 value; - - rt2x00mmio_register_read(rt2x00dev, E2PROM_CSR, ®); - - eeprom.data = rt2x00dev; - eeprom.register_read = rt61pci_eepromregister_read; - eeprom.register_write = rt61pci_eepromregister_write; - eeprom.width = rt2x00_get_field32(reg, E2PROM_CSR_TYPE_93C46) ? - PCI_EEPROM_WIDTH_93C46 : PCI_EEPROM_WIDTH_93C66; - eeprom.reg_data_in = 0; - eeprom.reg_data_out = 0; - eeprom.reg_data_clock = 0; - eeprom.reg_chip_select = 0; - - eeprom_93cx6_multiread(&eeprom, EEPROM_BASE, rt2x00dev->eeprom, - EEPROM_SIZE / sizeof(u16)); - - /* - * Start validation of the data that has been read. - */ - mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0); - if (!is_valid_ether_addr(mac)) { - eth_random_addr(mac); - rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_ANTENNA_NUM, 2); - rt2x00_set_field16(&word, EEPROM_ANTENNA_TX_DEFAULT, - ANTENNA_B); - rt2x00_set_field16(&word, EEPROM_ANTENNA_RX_DEFAULT, - ANTENNA_B); - rt2x00_set_field16(&word, EEPROM_ANTENNA_FRAME_TYPE, 0); - rt2x00_set_field16(&word, EEPROM_ANTENNA_DYN_TXAGC, 0); - rt2x00_set_field16(&word, EEPROM_ANTENNA_HARDWARE_RADIO, 0); - rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF5225); - rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); - rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_NIC_ENABLE_DIVERSITY, 0); - rt2x00_set_field16(&word, EEPROM_NIC_TX_DIVERSITY, 0); - rt2x00_set_field16(&word, EEPROM_NIC_RX_FIXED, 0); - rt2x00_set_field16(&word, EEPROM_NIC_TX_FIXED, 0); - rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0); - rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0); - rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word); - rt2x00_eeprom_dbg(rt2x00dev, "NIC: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_LED_LED_MODE, - LED_MODE_DEFAULT); - rt2x00_eeprom_write(rt2x00dev, EEPROM_LED, word); - rt2x00_eeprom_dbg(rt2x00dev, "Led: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_FREQ_OFFSET, 0); - rt2x00_set_field16(&word, EEPROM_FREQ_SEQ, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word); - rt2x00_eeprom_dbg(rt2x00dev, "Freq: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_BG, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_BG_1, 0); - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_BG_2, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_OFFSET_BG, word); - rt2x00_eeprom_dbg(rt2x00dev, "RSSI OFFSET BG: 0x%04x\n", word); - } else { - value = rt2x00_get_field16(word, EEPROM_RSSI_OFFSET_BG_1); - if (value < -10 || value > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_BG_1, 0); - value = rt2x00_get_field16(word, EEPROM_RSSI_OFFSET_BG_2); - if (value < -10 || value > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_BG_2, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_OFFSET_BG, word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_A, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_A_1, 0); - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_A_2, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_OFFSET_A, word); - rt2x00_eeprom_dbg(rt2x00dev, "RSSI OFFSET A: 0x%04x\n", word); - } else { - value = rt2x00_get_field16(word, EEPROM_RSSI_OFFSET_A_1); - if (value < -10 || value > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_A_1, 0); - value = rt2x00_get_field16(word, EEPROM_RSSI_OFFSET_A_2); - if (value < -10 || value > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_A_2, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_OFFSET_A, word); - } - - return 0; -} - -static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - u16 value; - u16 eeprom; - - /* - * Read EEPROM word for configuration. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); - - /* - * Identify RF chipset. - */ - value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); - rt2x00mmio_register_read(rt2x00dev, MAC_CSR0, ®); - rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET), - value, rt2x00_get_field32(reg, MAC_CSR0_REVISION)); - - if (!rt2x00_rf(rt2x00dev, RF5225) && - !rt2x00_rf(rt2x00dev, RF5325) && - !rt2x00_rf(rt2x00dev, RF2527) && - !rt2x00_rf(rt2x00dev, RF2529)) { - rt2x00_err(rt2x00dev, "Invalid RF chipset detected\n"); - return -ENODEV; - } - - /* - * Determine number of antennas. - */ - if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_NUM) == 2) - __set_bit(CAPABILITY_DOUBLE_ANTENNA, &rt2x00dev->cap_flags); - - /* - * Identify default antenna configuration. - */ - rt2x00dev->default_ant.tx = - rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TX_DEFAULT); - rt2x00dev->default_ant.rx = - rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_DEFAULT); - - /* - * Read the Frame type. - */ - if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_FRAME_TYPE)) - __set_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags); - - /* - * Detect if this device has a hardware controlled radio. - */ - if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) - __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); - - /* - * Read frequency offset and RF programming sequence. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom); - if (rt2x00_get_field16(eeprom, EEPROM_FREQ_SEQ)) - __set_bit(CAPABILITY_RF_SEQUENCE, &rt2x00dev->cap_flags); - - rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET); - - /* - * Read external LNA informations. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); - - if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_A)) - __set_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags); - if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA_BG)) - __set_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags); - - /* - * When working with a RF2529 chip without double antenna, - * the antenna settings should be gathered from the NIC - * eeprom word. - */ - if (rt2x00_rf(rt2x00dev, RF2529) && - !test_bit(CAPABILITY_DOUBLE_ANTENNA, &rt2x00dev->cap_flags)) { - rt2x00dev->default_ant.rx = - ANTENNA_A + rt2x00_get_field16(eeprom, EEPROM_NIC_RX_FIXED); - rt2x00dev->default_ant.tx = - ANTENNA_B - rt2x00_get_field16(eeprom, EEPROM_NIC_TX_FIXED); - - if (rt2x00_get_field16(eeprom, EEPROM_NIC_TX_DIVERSITY)) - rt2x00dev->default_ant.tx = ANTENNA_SW_DIVERSITY; - if (rt2x00_get_field16(eeprom, EEPROM_NIC_ENABLE_DIVERSITY)) - rt2x00dev->default_ant.rx = ANTENNA_SW_DIVERSITY; - } - - /* - * Store led settings, for correct led behaviour. - * If the eeprom value is invalid, - * switch to default led mode. - */ -#ifdef CONFIG_RT2X00_LIB_LEDS - rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &eeprom); - value = rt2x00_get_field16(eeprom, EEPROM_LED_LED_MODE); - - rt61pci_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO); - rt61pci_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC); - if (value == LED_MODE_SIGNAL_STRENGTH) - rt61pci_init_led(rt2x00dev, &rt2x00dev->led_qual, - LED_TYPE_QUALITY); - - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_LED_MODE, value); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_GPIO_0, - rt2x00_get_field16(eeprom, - EEPROM_LED_POLARITY_GPIO_0)); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_GPIO_1, - rt2x00_get_field16(eeprom, - EEPROM_LED_POLARITY_GPIO_1)); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_GPIO_2, - rt2x00_get_field16(eeprom, - EEPROM_LED_POLARITY_GPIO_2)); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_GPIO_3, - rt2x00_get_field16(eeprom, - EEPROM_LED_POLARITY_GPIO_3)); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_GPIO_4, - rt2x00_get_field16(eeprom, - EEPROM_LED_POLARITY_GPIO_4)); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_ACT, - rt2x00_get_field16(eeprom, EEPROM_LED_POLARITY_ACT)); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_READY_BG, - rt2x00_get_field16(eeprom, - EEPROM_LED_POLARITY_RDY_G)); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_READY_A, - rt2x00_get_field16(eeprom, - EEPROM_LED_POLARITY_RDY_A)); -#endif /* CONFIG_RT2X00_LIB_LEDS */ - - return 0; -} - -/* - * RF value list for RF5225 & RF5325 - * Supports: 2.4 GHz & 5.2 GHz, rf_sequence disabled - */ -static const struct rf_channel rf_vals_noseq[] = { - { 1, 0x00002ccc, 0x00004786, 0x00068455, 0x000ffa0b }, - { 2, 0x00002ccc, 0x00004786, 0x00068455, 0x000ffa1f }, - { 3, 0x00002ccc, 0x0000478a, 0x00068455, 0x000ffa0b }, - { 4, 0x00002ccc, 0x0000478a, 0x00068455, 0x000ffa1f }, - { 5, 0x00002ccc, 0x0000478e, 0x00068455, 0x000ffa0b }, - { 6, 0x00002ccc, 0x0000478e, 0x00068455, 0x000ffa1f }, - { 7, 0x00002ccc, 0x00004792, 0x00068455, 0x000ffa0b }, - { 8, 0x00002ccc, 0x00004792, 0x00068455, 0x000ffa1f }, - { 9, 0x00002ccc, 0x00004796, 0x00068455, 0x000ffa0b }, - { 10, 0x00002ccc, 0x00004796, 0x00068455, 0x000ffa1f }, - { 11, 0x00002ccc, 0x0000479a, 0x00068455, 0x000ffa0b }, - { 12, 0x00002ccc, 0x0000479a, 0x00068455, 0x000ffa1f }, - { 13, 0x00002ccc, 0x0000479e, 0x00068455, 0x000ffa0b }, - { 14, 0x00002ccc, 0x000047a2, 0x00068455, 0x000ffa13 }, - - /* 802.11 UNI / HyperLan 2 */ - { 36, 0x00002ccc, 0x0000499a, 0x0009be55, 0x000ffa23 }, - { 40, 0x00002ccc, 0x000049a2, 0x0009be55, 0x000ffa03 }, - { 44, 0x00002ccc, 0x000049a6, 0x0009be55, 0x000ffa0b }, - { 48, 0x00002ccc, 0x000049aa, 0x0009be55, 0x000ffa13 }, - { 52, 0x00002ccc, 0x000049ae, 0x0009ae55, 0x000ffa1b }, - { 56, 0x00002ccc, 0x000049b2, 0x0009ae55, 0x000ffa23 }, - { 60, 0x00002ccc, 0x000049ba, 0x0009ae55, 0x000ffa03 }, - { 64, 0x00002ccc, 0x000049be, 0x0009ae55, 0x000ffa0b }, - - /* 802.11 HyperLan 2 */ - { 100, 0x00002ccc, 0x00004a2a, 0x000bae55, 0x000ffa03 }, - { 104, 0x00002ccc, 0x00004a2e, 0x000bae55, 0x000ffa0b }, - { 108, 0x00002ccc, 0x00004a32, 0x000bae55, 0x000ffa13 }, - { 112, 0x00002ccc, 0x00004a36, 0x000bae55, 0x000ffa1b }, - { 116, 0x00002ccc, 0x00004a3a, 0x000bbe55, 0x000ffa23 }, - { 120, 0x00002ccc, 0x00004a82, 0x000bbe55, 0x000ffa03 }, - { 124, 0x00002ccc, 0x00004a86, 0x000bbe55, 0x000ffa0b }, - { 128, 0x00002ccc, 0x00004a8a, 0x000bbe55, 0x000ffa13 }, - { 132, 0x00002ccc, 0x00004a8e, 0x000bbe55, 0x000ffa1b }, - { 136, 0x00002ccc, 0x00004a92, 0x000bbe55, 0x000ffa23 }, - - /* 802.11 UNII */ - { 140, 0x00002ccc, 0x00004a9a, 0x000bbe55, 0x000ffa03 }, - { 149, 0x00002ccc, 0x00004aa2, 0x000bbe55, 0x000ffa1f }, - { 153, 0x00002ccc, 0x00004aa6, 0x000bbe55, 0x000ffa27 }, - { 157, 0x00002ccc, 0x00004aae, 0x000bbe55, 0x000ffa07 }, - { 161, 0x00002ccc, 0x00004ab2, 0x000bbe55, 0x000ffa0f }, - { 165, 0x00002ccc, 0x00004ab6, 0x000bbe55, 0x000ffa17 }, - - /* MMAC(Japan)J52 ch 34,38,42,46 */ - { 34, 0x00002ccc, 0x0000499a, 0x0009be55, 0x000ffa0b }, - { 38, 0x00002ccc, 0x0000499e, 0x0009be55, 0x000ffa13 }, - { 42, 0x00002ccc, 0x000049a2, 0x0009be55, 0x000ffa1b }, - { 46, 0x00002ccc, 0x000049a6, 0x0009be55, 0x000ffa23 }, -}; - -/* - * RF value list for RF5225 & RF5325 - * Supports: 2.4 GHz & 5.2 GHz, rf_sequence enabled - */ -static const struct rf_channel rf_vals_seq[] = { - { 1, 0x00002ccc, 0x00004786, 0x00068455, 0x000ffa0b }, - { 2, 0x00002ccc, 0x00004786, 0x00068455, 0x000ffa1f }, - { 3, 0x00002ccc, 0x0000478a, 0x00068455, 0x000ffa0b }, - { 4, 0x00002ccc, 0x0000478a, 0x00068455, 0x000ffa1f }, - { 5, 0x00002ccc, 0x0000478e, 0x00068455, 0x000ffa0b }, - { 6, 0x00002ccc, 0x0000478e, 0x00068455, 0x000ffa1f }, - { 7, 0x00002ccc, 0x00004792, 0x00068455, 0x000ffa0b }, - { 8, 0x00002ccc, 0x00004792, 0x00068455, 0x000ffa1f }, - { 9, 0x00002ccc, 0x00004796, 0x00068455, 0x000ffa0b }, - { 10, 0x00002ccc, 0x00004796, 0x00068455, 0x000ffa1f }, - { 11, 0x00002ccc, 0x0000479a, 0x00068455, 0x000ffa0b }, - { 12, 0x00002ccc, 0x0000479a, 0x00068455, 0x000ffa1f }, - { 13, 0x00002ccc, 0x0000479e, 0x00068455, 0x000ffa0b }, - { 14, 0x00002ccc, 0x000047a2, 0x00068455, 0x000ffa13 }, - - /* 802.11 UNI / HyperLan 2 */ - { 36, 0x00002cd4, 0x0004481a, 0x00098455, 0x000c0a03 }, - { 40, 0x00002cd0, 0x00044682, 0x00098455, 0x000c0a03 }, - { 44, 0x00002cd0, 0x00044686, 0x00098455, 0x000c0a1b }, - { 48, 0x00002cd0, 0x0004468e, 0x00098655, 0x000c0a0b }, - { 52, 0x00002cd0, 0x00044692, 0x00098855, 0x000c0a23 }, - { 56, 0x00002cd0, 0x0004469a, 0x00098c55, 0x000c0a13 }, - { 60, 0x00002cd0, 0x000446a2, 0x00098e55, 0x000c0a03 }, - { 64, 0x00002cd0, 0x000446a6, 0x00099255, 0x000c0a1b }, - - /* 802.11 HyperLan 2 */ - { 100, 0x00002cd4, 0x0004489a, 0x000b9855, 0x000c0a03 }, - { 104, 0x00002cd4, 0x000448a2, 0x000b9855, 0x000c0a03 }, - { 108, 0x00002cd4, 0x000448aa, 0x000b9855, 0x000c0a03 }, - { 112, 0x00002cd4, 0x000448b2, 0x000b9a55, 0x000c0a03 }, - { 116, 0x00002cd4, 0x000448ba, 0x000b9a55, 0x000c0a03 }, - { 120, 0x00002cd0, 0x00044702, 0x000b9a55, 0x000c0a03 }, - { 124, 0x00002cd0, 0x00044706, 0x000b9a55, 0x000c0a1b }, - { 128, 0x00002cd0, 0x0004470e, 0x000b9c55, 0x000c0a0b }, - { 132, 0x00002cd0, 0x00044712, 0x000b9c55, 0x000c0a23 }, - { 136, 0x00002cd0, 0x0004471a, 0x000b9e55, 0x000c0a13 }, - - /* 802.11 UNII */ - { 140, 0x00002cd0, 0x00044722, 0x000b9e55, 0x000c0a03 }, - { 149, 0x00002cd0, 0x0004472e, 0x000ba255, 0x000c0a1b }, - { 153, 0x00002cd0, 0x00044736, 0x000ba255, 0x000c0a0b }, - { 157, 0x00002cd4, 0x0004490a, 0x000ba255, 0x000c0a17 }, - { 161, 0x00002cd4, 0x00044912, 0x000ba255, 0x000c0a17 }, - { 165, 0x00002cd4, 0x0004491a, 0x000ba255, 0x000c0a17 }, - - /* MMAC(Japan)J52 ch 34,38,42,46 */ - { 34, 0x00002ccc, 0x0000499a, 0x0009be55, 0x000c0a0b }, - { 38, 0x00002ccc, 0x0000499e, 0x0009be55, 0x000c0a13 }, - { 42, 0x00002ccc, 0x000049a2, 0x0009be55, 0x000c0a1b }, - { 46, 0x00002ccc, 0x000049a6, 0x0009be55, 0x000c0a23 }, -}; - -static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) -{ - struct hw_mode_spec *spec = &rt2x00dev->spec; - struct channel_info *info; - char *tx_power; - unsigned int i; - - /* - * Disable powersaving as default. - */ - rt2x00dev->hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; - - /* - * Initialize all hw fields. - */ - rt2x00dev->hw->flags = - IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_PS_NULLFUNC_STACK; - - SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); - SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, - rt2x00_eeprom_addr(rt2x00dev, - EEPROM_MAC_ADDR_0)); - - /* - * As rt61 has a global fallback table we cannot specify - * more then one tx rate per frame but since the hw will - * try several rates (based on the fallback table) we should - * initialize max_report_rates to the maximum number of rates - * we are going to try. Otherwise mac80211 will truncate our - * reported tx rates and the rc algortihm will end up with - * incorrect data. - */ - rt2x00dev->hw->max_rates = 1; - rt2x00dev->hw->max_report_rates = 7; - rt2x00dev->hw->max_rate_tries = 1; - - /* - * Initialize hw_mode information. - */ - spec->supported_bands = SUPPORT_BAND_2GHZ; - spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; - - if (!test_bit(CAPABILITY_RF_SEQUENCE, &rt2x00dev->cap_flags)) { - spec->num_channels = 14; - spec->channels = rf_vals_noseq; - } else { - spec->num_channels = 14; - spec->channels = rf_vals_seq; - } - - if (rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF5325)) { - spec->supported_bands |= SUPPORT_BAND_5GHZ; - spec->num_channels = ARRAY_SIZE(rf_vals_seq); - } - - /* - * Create channel information array - */ - info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); - if (!info) - return -ENOMEM; - - spec->channels_info = info; - - tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); - for (i = 0; i < 14; i++) { - info[i].max_power = MAX_TXPOWER; - info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); - } - - if (spec->num_channels > 14) { - tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); - for (i = 14; i < spec->num_channels; i++) { - info[i].max_power = MAX_TXPOWER; - info[i].default_power1 = - TXPOWER_FROM_DEV(tx_power[i - 14]); - } - } - - return 0; -} - -static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev) -{ - int retval; - u32 reg; - - /* - * Disable power saving. - */ - rt2x00mmio_register_write(rt2x00dev, SOFT_RESET_CSR, 0x00000007); - - /* - * Allocate eeprom data. - */ - retval = rt61pci_validate_eeprom(rt2x00dev); - if (retval) - return retval; - - retval = rt61pci_init_eeprom(rt2x00dev); - if (retval) - return retval; - - /* - * Enable rfkill polling by setting GPIO direction of the - * rfkill switch GPIO pin correctly. - */ - rt2x00mmio_register_read(rt2x00dev, MAC_CSR13, ®); - rt2x00_set_field32(®, MAC_CSR13_DIR5, 1); - rt2x00mmio_register_write(rt2x00dev, MAC_CSR13, reg); - - /* - * Initialize hw specifications. - */ - retval = rt61pci_probe_hw_mode(rt2x00dev); - if (retval) - return retval; - - /* - * This device has multiple filters for control frames, - * but has no a separate filter for PS Poll frames. - */ - __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags); - - /* - * This device requires firmware and DMA mapped skbs. - */ - __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags); - __set_bit(REQUIRE_DMA, &rt2x00dev->cap_flags); - if (!modparam_nohwcrypt) - __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags); - __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags); - - /* - * Set the rssi offset. - */ - rt2x00dev->rssi_offset = DEFAULT_RSSI_OFFSET; - - return 0; -} - -/* - * IEEE80211 stack callback functions. - */ -static int rt61pci_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue_idx, - const struct ieee80211_tx_queue_params *params) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct data_queue *queue; - struct rt2x00_field32 field; - int retval; - u32 reg; - u32 offset; - - /* - * First pass the configuration through rt2x00lib, that will - * update the queue settings and validate the input. After that - * we are free to update the registers based on the value - * in the queue parameter. - */ - retval = rt2x00mac_conf_tx(hw, vif, queue_idx, params); - if (retval) - return retval; - - /* - * We only need to perform additional register initialization - * for WMM queues. - */ - if (queue_idx >= 4) - return 0; - - queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx); - - /* Update WMM TXOP register */ - offset = AC_TXOP_CSR0 + (sizeof(u32) * (!!(queue_idx & 2))); - field.bit_offset = (queue_idx & 1) * 16; - field.bit_mask = 0xffff << field.bit_offset; - - rt2x00mmio_register_read(rt2x00dev, offset, ®); - rt2x00_set_field32(®, field, queue->txop); - rt2x00mmio_register_write(rt2x00dev, offset, reg); - - /* Update WMM registers */ - field.bit_offset = queue_idx * 4; - field.bit_mask = 0xf << field.bit_offset; - - rt2x00mmio_register_read(rt2x00dev, AIFSN_CSR, ®); - rt2x00_set_field32(®, field, queue->aifs); - rt2x00mmio_register_write(rt2x00dev, AIFSN_CSR, reg); - - rt2x00mmio_register_read(rt2x00dev, CWMIN_CSR, ®); - rt2x00_set_field32(®, field, queue->cw_min); - rt2x00mmio_register_write(rt2x00dev, CWMIN_CSR, reg); - - rt2x00mmio_register_read(rt2x00dev, CWMAX_CSR, ®); - rt2x00_set_field32(®, field, queue->cw_max); - rt2x00mmio_register_write(rt2x00dev, CWMAX_CSR, reg); - - return 0; -} - -static u64 rt61pci_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - u64 tsf; - u32 reg; - - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR13, ®); - tsf = (u64) rt2x00_get_field32(reg, TXRX_CSR13_HIGH_TSFTIMER) << 32; - rt2x00mmio_register_read(rt2x00dev, TXRX_CSR12, ®); - tsf |= rt2x00_get_field32(reg, TXRX_CSR12_LOW_TSFTIMER); - - return tsf; -} - -static const struct ieee80211_ops rt61pci_mac80211_ops = { - .tx = rt2x00mac_tx, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, - .remove_interface = rt2x00mac_remove_interface, - .config = rt2x00mac_config, - .configure_filter = rt2x00mac_configure_filter, - .set_key = rt2x00mac_set_key, - .sw_scan_start = rt2x00mac_sw_scan_start, - .sw_scan_complete = rt2x00mac_sw_scan_complete, - .get_stats = rt2x00mac_get_stats, - .bss_info_changed = rt2x00mac_bss_info_changed, - .conf_tx = rt61pci_conf_tx, - .get_tsf = rt61pci_get_tsf, - .rfkill_poll = rt2x00mac_rfkill_poll, - .flush = rt2x00mac_flush, - .set_antenna = rt2x00mac_set_antenna, - .get_antenna = rt2x00mac_get_antenna, - .get_ringparam = rt2x00mac_get_ringparam, - .tx_frames_pending = rt2x00mac_tx_frames_pending, -}; - -static const struct rt2x00lib_ops rt61pci_rt2x00_ops = { - .irq_handler = rt61pci_interrupt, - .txstatus_tasklet = rt61pci_txstatus_tasklet, - .tbtt_tasklet = rt61pci_tbtt_tasklet, - .rxdone_tasklet = rt61pci_rxdone_tasklet, - .autowake_tasklet = rt61pci_autowake_tasklet, - .probe_hw = rt61pci_probe_hw, - .get_firmware_name = rt61pci_get_firmware_name, - .check_firmware = rt61pci_check_firmware, - .load_firmware = rt61pci_load_firmware, - .initialize = rt2x00mmio_initialize, - .uninitialize = rt2x00mmio_uninitialize, - .get_entry_state = rt61pci_get_entry_state, - .clear_entry = rt61pci_clear_entry, - .set_device_state = rt61pci_set_device_state, - .rfkill_poll = rt61pci_rfkill_poll, - .link_stats = rt61pci_link_stats, - .reset_tuner = rt61pci_reset_tuner, - .link_tuner = rt61pci_link_tuner, - .start_queue = rt61pci_start_queue, - .kick_queue = rt61pci_kick_queue, - .stop_queue = rt61pci_stop_queue, - .flush_queue = rt2x00mmio_flush_queue, - .write_tx_desc = rt61pci_write_tx_desc, - .write_beacon = rt61pci_write_beacon, - .clear_beacon = rt61pci_clear_beacon, - .fill_rxdone = rt61pci_fill_rxdone, - .config_shared_key = rt61pci_config_shared_key, - .config_pairwise_key = rt61pci_config_pairwise_key, - .config_filter = rt61pci_config_filter, - .config_intf = rt61pci_config_intf, - .config_erp = rt61pci_config_erp, - .config_ant = rt61pci_config_ant, - .config = rt61pci_config, -}; - -static const struct data_queue_desc rt61pci_queue_rx = { - .entry_num = 32, - .data_size = DATA_FRAME_SIZE, - .desc_size = RXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_mmio), -}; - -static const struct data_queue_desc rt61pci_queue_tx = { - .entry_num = 32, - .data_size = DATA_FRAME_SIZE, - .desc_size = TXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_mmio), -}; - -static const struct data_queue_desc rt61pci_queue_bcn = { - .entry_num = 4, - .data_size = 0, /* No DMA required for beacons */ - .desc_size = TXINFO_SIZE, - .priv_size = sizeof(struct queue_entry_priv_mmio), -}; - -static const struct rt2x00_ops rt61pci_ops = { - .name = KBUILD_MODNAME, - .max_ap_intf = 4, - .eeprom_size = EEPROM_SIZE, - .rf_size = RF_SIZE, - .tx_queues = NUM_TX_QUEUES, - .extra_tx_headroom = 0, - .rx = &rt61pci_queue_rx, - .tx = &rt61pci_queue_tx, - .bcn = &rt61pci_queue_bcn, - .lib = &rt61pci_rt2x00_ops, - .hw = &rt61pci_mac80211_ops, -#ifdef CONFIG_RT2X00_LIB_DEBUGFS - .debugfs = &rt61pci_rt2x00debug, -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -}; - -/* - * RT61pci module information. - */ -static DEFINE_PCI_DEVICE_TABLE(rt61pci_device_table) = { - /* RT2561s */ - { PCI_DEVICE(0x1814, 0x0301) }, - /* RT2561 v2 */ - { PCI_DEVICE(0x1814, 0x0302) }, - /* RT2661 */ - { PCI_DEVICE(0x1814, 0x0401) }, - { 0, } -}; - -MODULE_AUTHOR(DRV_PROJECT); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION("Ralink RT61 PCI & PCMCIA Wireless LAN driver."); -MODULE_SUPPORTED_DEVICE("Ralink RT2561, RT2561s & RT2661 " - "PCI & PCMCIA chipset based cards"); -MODULE_DEVICE_TABLE(pci, rt61pci_device_table); -MODULE_FIRMWARE(FIRMWARE_RT2561); -MODULE_FIRMWARE(FIRMWARE_RT2561s); -MODULE_FIRMWARE(FIRMWARE_RT2661); -MODULE_LICENSE("GPL"); - -static int rt61pci_probe(struct pci_dev *pci_dev, - const struct pci_device_id *id) -{ - return rt2x00pci_probe(pci_dev, &rt61pci_ops); -} - -static struct pci_driver rt61pci_driver = { - .name = KBUILD_MODNAME, - .id_table = rt61pci_device_table, - .probe = rt61pci_probe, - .remove = rt2x00pci_remove, - .suspend = rt2x00pci_suspend, - .resume = rt2x00pci_resume, -}; - -module_pci_driver(rt61pci_driver); diff --git a/drivers/net/wireless/rt2x00/rt61pci.h b/drivers/net/wireless/rt2x00/rt61pci.h deleted file mode 100644 index 9bc6b6044e34..000000000000 --- a/drivers/net/wireless/rt2x00/rt61pci.h +++ /dev/null @@ -1,1502 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt61pci - Abstract: Data structures and registers for the rt61pci module. - Supported chipsets: RT2561, RT2561s, RT2661. - */ - -#ifndef RT61PCI_H -#define RT61PCI_H - -/* - * RT chip PCI IDs. - */ -#define RT2561s_PCI_ID 0x0301 -#define RT2561_PCI_ID 0x0302 -#define RT2661_PCI_ID 0x0401 - -/* - * RF chip defines. - */ -#define RF5225 0x0001 -#define RF5325 0x0002 -#define RF2527 0x0003 -#define RF2529 0x0004 - -/* - * Signal information. - * Default offset is required for RSSI <-> dBm conversion. - */ -#define DEFAULT_RSSI_OFFSET 120 - -/* - * Register layout information. - */ -#define CSR_REG_BASE 0x3000 -#define CSR_REG_SIZE 0x04b0 -#define EEPROM_BASE 0x0000 -#define EEPROM_SIZE 0x0100 -#define BBP_BASE 0x0000 -#define BBP_SIZE 0x0080 -#define RF_BASE 0x0004 -#define RF_SIZE 0x0010 - -/* - * Number of TX queues. - */ -#define NUM_TX_QUEUES 4 - -/* - * PCI registers. - */ - -/* - * HOST_CMD_CSR: For HOST to interrupt embedded processor - */ -#define HOST_CMD_CSR 0x0008 -#define HOST_CMD_CSR_HOST_COMMAND FIELD32(0x0000007f) -#define HOST_CMD_CSR_INTERRUPT_MCU FIELD32(0x00000080) - -/* - * MCU_CNTL_CSR - * SELECT_BANK: Select 8051 program bank. - * RESET: Enable 8051 reset state. - * READY: Ready state for 8051. - */ -#define MCU_CNTL_CSR 0x000c -#define MCU_CNTL_CSR_SELECT_BANK FIELD32(0x00000001) -#define MCU_CNTL_CSR_RESET FIELD32(0x00000002) -#define MCU_CNTL_CSR_READY FIELD32(0x00000004) - -/* - * SOFT_RESET_CSR - * FORCE_CLOCK_ON: Host force MAC clock ON - */ -#define SOFT_RESET_CSR 0x0010 -#define SOFT_RESET_CSR_FORCE_CLOCK_ON FIELD32(0x00000002) - -/* - * MCU_INT_SOURCE_CSR: MCU interrupt source/mask register. - */ -#define MCU_INT_SOURCE_CSR 0x0014 -#define MCU_INT_SOURCE_CSR_0 FIELD32(0x00000001) -#define MCU_INT_SOURCE_CSR_1 FIELD32(0x00000002) -#define MCU_INT_SOURCE_CSR_2 FIELD32(0x00000004) -#define MCU_INT_SOURCE_CSR_3 FIELD32(0x00000008) -#define MCU_INT_SOURCE_CSR_4 FIELD32(0x00000010) -#define MCU_INT_SOURCE_CSR_5 FIELD32(0x00000020) -#define MCU_INT_SOURCE_CSR_6 FIELD32(0x00000040) -#define MCU_INT_SOURCE_CSR_7 FIELD32(0x00000080) -#define MCU_INT_SOURCE_CSR_TWAKEUP FIELD32(0x00000100) -#define MCU_INT_SOURCE_CSR_TBTT_EXPIRE FIELD32(0x00000200) - -/* - * MCU_INT_MASK_CSR: MCU interrupt source/mask register. - */ -#define MCU_INT_MASK_CSR 0x0018 -#define MCU_INT_MASK_CSR_0 FIELD32(0x00000001) -#define MCU_INT_MASK_CSR_1 FIELD32(0x00000002) -#define MCU_INT_MASK_CSR_2 FIELD32(0x00000004) -#define MCU_INT_MASK_CSR_3 FIELD32(0x00000008) -#define MCU_INT_MASK_CSR_4 FIELD32(0x00000010) -#define MCU_INT_MASK_CSR_5 FIELD32(0x00000020) -#define MCU_INT_MASK_CSR_6 FIELD32(0x00000040) -#define MCU_INT_MASK_CSR_7 FIELD32(0x00000080) -#define MCU_INT_MASK_CSR_TWAKEUP FIELD32(0x00000100) -#define MCU_INT_MASK_CSR_TBTT_EXPIRE FIELD32(0x00000200) - -/* - * PCI_USEC_CSR - */ -#define PCI_USEC_CSR 0x001c - -/* - * Security key table memory. - * 16 entries 32-byte for shared key table - * 64 entries 32-byte for pairwise key table - * 64 entries 8-byte for pairwise ta key table - */ -#define SHARED_KEY_TABLE_BASE 0x1000 -#define PAIRWISE_KEY_TABLE_BASE 0x1200 -#define PAIRWISE_TA_TABLE_BASE 0x1a00 - -#define SHARED_KEY_ENTRY(__idx) \ - ( SHARED_KEY_TABLE_BASE + \ - ((__idx) * sizeof(struct hw_key_entry)) ) -#define PAIRWISE_KEY_ENTRY(__idx) \ - ( PAIRWISE_KEY_TABLE_BASE + \ - ((__idx) * sizeof(struct hw_key_entry)) ) -#define PAIRWISE_TA_ENTRY(__idx) \ - ( PAIRWISE_TA_TABLE_BASE + \ - ((__idx) * sizeof(struct hw_pairwise_ta_entry)) ) - -struct hw_key_entry { - u8 key[16]; - u8 tx_mic[8]; - u8 rx_mic[8]; -} __packed; - -struct hw_pairwise_ta_entry { - u8 address[6]; - u8 cipher; - u8 reserved; -} __packed; - -/* - * Other on-chip shared memory space. - */ -#define HW_CIS_BASE 0x2000 -#define HW_NULL_BASE 0x2b00 - -/* - * Since NULL frame won't be that long (256 byte), - * We steal 16 tail bytes to save debugging settings. - */ -#define HW_DEBUG_SETTING_BASE 0x2bf0 - -/* - * On-chip BEACON frame space. - */ -#define HW_BEACON_BASE0 0x2c00 -#define HW_BEACON_BASE1 0x2d00 -#define HW_BEACON_BASE2 0x2e00 -#define HW_BEACON_BASE3 0x2f00 - -#define HW_BEACON_OFFSET(__index) \ - ( HW_BEACON_BASE0 + (__index * 0x0100) ) - -/* - * HOST-MCU shared memory. - */ - -/* - * H2M_MAILBOX_CSR: Host-to-MCU Mailbox. - */ -#define H2M_MAILBOX_CSR 0x2100 -#define H2M_MAILBOX_CSR_ARG0 FIELD32(0x000000ff) -#define H2M_MAILBOX_CSR_ARG1 FIELD32(0x0000ff00) -#define H2M_MAILBOX_CSR_CMD_TOKEN FIELD32(0x00ff0000) -#define H2M_MAILBOX_CSR_OWNER FIELD32(0xff000000) - -/* - * MCU_LEDCS: LED control for MCU Mailbox. - */ -#define MCU_LEDCS_LED_MODE FIELD16(0x001f) -#define MCU_LEDCS_RADIO_STATUS FIELD16(0x0020) -#define MCU_LEDCS_LINK_BG_STATUS FIELD16(0x0040) -#define MCU_LEDCS_LINK_A_STATUS FIELD16(0x0080) -#define MCU_LEDCS_POLARITY_GPIO_0 FIELD16(0x0100) -#define MCU_LEDCS_POLARITY_GPIO_1 FIELD16(0x0200) -#define MCU_LEDCS_POLARITY_GPIO_2 FIELD16(0x0400) -#define MCU_LEDCS_POLARITY_GPIO_3 FIELD16(0x0800) -#define MCU_LEDCS_POLARITY_GPIO_4 FIELD16(0x1000) -#define MCU_LEDCS_POLARITY_ACT FIELD16(0x2000) -#define MCU_LEDCS_POLARITY_READY_BG FIELD16(0x4000) -#define MCU_LEDCS_POLARITY_READY_A FIELD16(0x8000) - -/* - * M2H_CMD_DONE_CSR. - */ -#define M2H_CMD_DONE_CSR 0x2104 - -/* - * MCU_TXOP_ARRAY_BASE. - */ -#define MCU_TXOP_ARRAY_BASE 0x2110 - -/* - * MAC Control/Status Registers(CSR). - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * MAC_CSR0: ASIC revision number. - */ -#define MAC_CSR0 0x3000 -#define MAC_CSR0_REVISION FIELD32(0x0000000f) -#define MAC_CSR0_CHIPSET FIELD32(0x000ffff0) - -/* - * MAC_CSR1: System control register. - * SOFT_RESET: Software reset bit, 1: reset, 0: normal. - * BBP_RESET: Hardware reset BBP. - * HOST_READY: Host is ready after initialization, 1: ready. - */ -#define MAC_CSR1 0x3004 -#define MAC_CSR1_SOFT_RESET FIELD32(0x00000001) -#define MAC_CSR1_BBP_RESET FIELD32(0x00000002) -#define MAC_CSR1_HOST_READY FIELD32(0x00000004) - -/* - * MAC_CSR2: STA MAC register 0. - */ -#define MAC_CSR2 0x3008 -#define MAC_CSR2_BYTE0 FIELD32(0x000000ff) -#define MAC_CSR2_BYTE1 FIELD32(0x0000ff00) -#define MAC_CSR2_BYTE2 FIELD32(0x00ff0000) -#define MAC_CSR2_BYTE3 FIELD32(0xff000000) - -/* - * MAC_CSR3: STA MAC register 1. - * UNICAST_TO_ME_MASK: - * Used to mask off bits from byte 5 of the MAC address - * to determine the UNICAST_TO_ME bit for RX frames. - * The full mask is complemented by BSS_ID_MASK: - * MASK = BSS_ID_MASK & UNICAST_TO_ME_MASK - */ -#define MAC_CSR3 0x300c -#define MAC_CSR3_BYTE4 FIELD32(0x000000ff) -#define MAC_CSR3_BYTE5 FIELD32(0x0000ff00) -#define MAC_CSR3_UNICAST_TO_ME_MASK FIELD32(0x00ff0000) - -/* - * MAC_CSR4: BSSID register 0. - */ -#define MAC_CSR4 0x3010 -#define MAC_CSR4_BYTE0 FIELD32(0x000000ff) -#define MAC_CSR4_BYTE1 FIELD32(0x0000ff00) -#define MAC_CSR4_BYTE2 FIELD32(0x00ff0000) -#define MAC_CSR4_BYTE3 FIELD32(0xff000000) - -/* - * MAC_CSR5: BSSID register 1. - * BSS_ID_MASK: - * This mask is used to mask off bits 0 and 1 of byte 5 of the - * BSSID. This will make sure that those bits will be ignored - * when determining the MY_BSS of RX frames. - * 0: 1-BSSID mode (BSS index = 0) - * 1: 2-BSSID mode (BSS index: Byte5, bit 0) - * 2: 2-BSSID mode (BSS index: byte5, bit 1) - * 3: 4-BSSID mode (BSS index: byte5, bit 0 - 1) - */ -#define MAC_CSR5 0x3014 -#define MAC_CSR5_BYTE4 FIELD32(0x000000ff) -#define MAC_CSR5_BYTE5 FIELD32(0x0000ff00) -#define MAC_CSR5_BSS_ID_MASK FIELD32(0x00ff0000) - -/* - * MAC_CSR6: Maximum frame length register. - */ -#define MAC_CSR6 0x3018 -#define MAC_CSR6_MAX_FRAME_UNIT FIELD32(0x00000fff) - -/* - * MAC_CSR7: Reserved - */ -#define MAC_CSR7 0x301c - -/* - * MAC_CSR8: SIFS/EIFS register. - * All units are in US. - */ -#define MAC_CSR8 0x3020 -#define MAC_CSR8_SIFS FIELD32(0x000000ff) -#define MAC_CSR8_SIFS_AFTER_RX_OFDM FIELD32(0x0000ff00) -#define MAC_CSR8_EIFS FIELD32(0xffff0000) - -/* - * MAC_CSR9: Back-Off control register. - * SLOT_TIME: Slot time, default is 20us for 802.11BG. - * CWMIN: Bit for Cwmin. default Cwmin is 31 (2^5 - 1). - * CWMAX: Bit for Cwmax, default Cwmax is 1023 (2^10 - 1). - * CW_SELECT: 1: CWmin/Cwmax select from register, 0:select from TxD. - */ -#define MAC_CSR9 0x3024 -#define MAC_CSR9_SLOT_TIME FIELD32(0x000000ff) -#define MAC_CSR9_CWMIN FIELD32(0x00000f00) -#define MAC_CSR9_CWMAX FIELD32(0x0000f000) -#define MAC_CSR9_CW_SELECT FIELD32(0x00010000) - -/* - * MAC_CSR10: Power state configuration. - */ -#define MAC_CSR10 0x3028 - -/* - * MAC_CSR11: Power saving transition time register. - * DELAY_AFTER_TBCN: Delay after Tbcn expired in units of TU. - * TBCN_BEFORE_WAKEUP: Number of beacon before wakeup. - * WAKEUP_LATENCY: In unit of TU. - */ -#define MAC_CSR11 0x302c -#define MAC_CSR11_DELAY_AFTER_TBCN FIELD32(0x000000ff) -#define MAC_CSR11_TBCN_BEFORE_WAKEUP FIELD32(0x00007f00) -#define MAC_CSR11_AUTOWAKE FIELD32(0x00008000) -#define MAC_CSR11_WAKEUP_LATENCY FIELD32(0x000f0000) - -/* - * MAC_CSR12: Manual power control / status register (merge CSR20 & PWRCSR1). - * CURRENT_STATE: 0:sleep, 1:awake. - * FORCE_WAKEUP: This has higher priority than PUT_TO_SLEEP. - * BBP_CURRENT_STATE: 0: BBP sleep, 1: BBP awake. - */ -#define MAC_CSR12 0x3030 -#define MAC_CSR12_CURRENT_STATE FIELD32(0x00000001) -#define MAC_CSR12_PUT_TO_SLEEP FIELD32(0x00000002) -#define MAC_CSR12_FORCE_WAKEUP FIELD32(0x00000004) -#define MAC_CSR12_BBP_CURRENT_STATE FIELD32(0x00000008) - -/* - * MAC_CSR13: GPIO. - * MAC_CSR13_VALx: GPIO value - * MAC_CSR13_DIRx: GPIO direction: 0 = output; 1 = input - */ -#define MAC_CSR13 0x3034 -#define MAC_CSR13_VAL0 FIELD32(0x00000001) -#define MAC_CSR13_VAL1 FIELD32(0x00000002) -#define MAC_CSR13_VAL2 FIELD32(0x00000004) -#define MAC_CSR13_VAL3 FIELD32(0x00000008) -#define MAC_CSR13_VAL4 FIELD32(0x00000010) -#define MAC_CSR13_VAL5 FIELD32(0x00000020) -#define MAC_CSR13_DIR0 FIELD32(0x00000100) -#define MAC_CSR13_DIR1 FIELD32(0x00000200) -#define MAC_CSR13_DIR2 FIELD32(0x00000400) -#define MAC_CSR13_DIR3 FIELD32(0x00000800) -#define MAC_CSR13_DIR4 FIELD32(0x00001000) -#define MAC_CSR13_DIR5 FIELD32(0x00002000) - -/* - * MAC_CSR14: LED control register. - * ON_PERIOD: On period, default 70ms. - * OFF_PERIOD: Off period, default 30ms. - * HW_LED: HW TX activity, 1: normal OFF, 0: normal ON. - * SW_LED: s/w LED, 1: ON, 0: OFF. - * HW_LED_POLARITY: 0: active low, 1: active high. - */ -#define MAC_CSR14 0x3038 -#define MAC_CSR14_ON_PERIOD FIELD32(0x000000ff) -#define MAC_CSR14_OFF_PERIOD FIELD32(0x0000ff00) -#define MAC_CSR14_HW_LED FIELD32(0x00010000) -#define MAC_CSR14_SW_LED FIELD32(0x00020000) -#define MAC_CSR14_HW_LED_POLARITY FIELD32(0x00040000) -#define MAC_CSR14_SW_LED2 FIELD32(0x00080000) - -/* - * MAC_CSR15: NAV control. - */ -#define MAC_CSR15 0x303c - -/* - * TXRX control registers. - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * TXRX_CSR0: TX/RX configuration register. - * TSF_OFFSET: Default is 24. - * AUTO_TX_SEQ: 1: ASIC auto replace sequence nr in outgoing frame. - * DISABLE_RX: Disable Rx engine. - * DROP_CRC: Drop CRC error. - * DROP_PHYSICAL: Drop physical error. - * DROP_CONTROL: Drop control frame. - * DROP_NOT_TO_ME: Drop not to me unicast frame. - * DROP_TO_DS: Drop fram ToDs bit is true. - * DROP_VERSION_ERROR: Drop version error frame. - * DROP_MULTICAST: Drop multicast frames. - * DROP_BORADCAST: Drop broadcast frames. - * DROP_ACK_CTS: Drop received ACK and CTS. - */ -#define TXRX_CSR0 0x3040 -#define TXRX_CSR0_RX_ACK_TIMEOUT FIELD32(0x000001ff) -#define TXRX_CSR0_TSF_OFFSET FIELD32(0x00007e00) -#define TXRX_CSR0_AUTO_TX_SEQ FIELD32(0x00008000) -#define TXRX_CSR0_DISABLE_RX FIELD32(0x00010000) -#define TXRX_CSR0_DROP_CRC FIELD32(0x00020000) -#define TXRX_CSR0_DROP_PHYSICAL FIELD32(0x00040000) -#define TXRX_CSR0_DROP_CONTROL FIELD32(0x00080000) -#define TXRX_CSR0_DROP_NOT_TO_ME FIELD32(0x00100000) -#define TXRX_CSR0_DROP_TO_DS FIELD32(0x00200000) -#define TXRX_CSR0_DROP_VERSION_ERROR FIELD32(0x00400000) -#define TXRX_CSR0_DROP_MULTICAST FIELD32(0x00800000) -#define TXRX_CSR0_DROP_BROADCAST FIELD32(0x01000000) -#define TXRX_CSR0_DROP_ACK_CTS FIELD32(0x02000000) -#define TXRX_CSR0_TX_WITHOUT_WAITING FIELD32(0x04000000) - -/* - * TXRX_CSR1 - */ -#define TXRX_CSR1 0x3044 -#define TXRX_CSR1_BBP_ID0 FIELD32(0x0000007f) -#define TXRX_CSR1_BBP_ID0_VALID FIELD32(0x00000080) -#define TXRX_CSR1_BBP_ID1 FIELD32(0x00007f00) -#define TXRX_CSR1_BBP_ID1_VALID FIELD32(0x00008000) -#define TXRX_CSR1_BBP_ID2 FIELD32(0x007f0000) -#define TXRX_CSR1_BBP_ID2_VALID FIELD32(0x00800000) -#define TXRX_CSR1_BBP_ID3 FIELD32(0x7f000000) -#define TXRX_CSR1_BBP_ID3_VALID FIELD32(0x80000000) - -/* - * TXRX_CSR2 - */ -#define TXRX_CSR2 0x3048 -#define TXRX_CSR2_BBP_ID0 FIELD32(0x0000007f) -#define TXRX_CSR2_BBP_ID0_VALID FIELD32(0x00000080) -#define TXRX_CSR2_BBP_ID1 FIELD32(0x00007f00) -#define TXRX_CSR2_BBP_ID1_VALID FIELD32(0x00008000) -#define TXRX_CSR2_BBP_ID2 FIELD32(0x007f0000) -#define TXRX_CSR2_BBP_ID2_VALID FIELD32(0x00800000) -#define TXRX_CSR2_BBP_ID3 FIELD32(0x7f000000) -#define TXRX_CSR2_BBP_ID3_VALID FIELD32(0x80000000) - -/* - * TXRX_CSR3 - */ -#define TXRX_CSR3 0x304c -#define TXRX_CSR3_BBP_ID0 FIELD32(0x0000007f) -#define TXRX_CSR3_BBP_ID0_VALID FIELD32(0x00000080) -#define TXRX_CSR3_BBP_ID1 FIELD32(0x00007f00) -#define TXRX_CSR3_BBP_ID1_VALID FIELD32(0x00008000) -#define TXRX_CSR3_BBP_ID2 FIELD32(0x007f0000) -#define TXRX_CSR3_BBP_ID2_VALID FIELD32(0x00800000) -#define TXRX_CSR3_BBP_ID3 FIELD32(0x7f000000) -#define TXRX_CSR3_BBP_ID3_VALID FIELD32(0x80000000) - -/* - * TXRX_CSR4: Auto-Responder/Tx-retry register. - * AUTORESPOND_PREAMBLE: 0:long, 1:short preamble. - * OFDM_TX_RATE_DOWN: 1:enable. - * OFDM_TX_RATE_STEP: 0:1-step, 1: 2-step, 2:3-step, 3:4-step. - * OFDM_TX_FALLBACK_CCK: 0: Fallback to OFDM 6M only, 1: Fallback to CCK 1M,2M. - */ -#define TXRX_CSR4 0x3050 -#define TXRX_CSR4_TX_ACK_TIMEOUT FIELD32(0x000000ff) -#define TXRX_CSR4_CNTL_ACK_POLICY FIELD32(0x00000700) -#define TXRX_CSR4_ACK_CTS_PSM FIELD32(0x00010000) -#define TXRX_CSR4_AUTORESPOND_ENABLE FIELD32(0x00020000) -#define TXRX_CSR4_AUTORESPOND_PREAMBLE FIELD32(0x00040000) -#define TXRX_CSR4_OFDM_TX_RATE_DOWN FIELD32(0x00080000) -#define TXRX_CSR4_OFDM_TX_RATE_STEP FIELD32(0x00300000) -#define TXRX_CSR4_OFDM_TX_FALLBACK_CCK FIELD32(0x00400000) -#define TXRX_CSR4_LONG_RETRY_LIMIT FIELD32(0x0f000000) -#define TXRX_CSR4_SHORT_RETRY_LIMIT FIELD32(0xf0000000) - -/* - * TXRX_CSR5 - */ -#define TXRX_CSR5 0x3054 - -/* - * TXRX_CSR6: ACK/CTS payload consumed time - */ -#define TXRX_CSR6 0x3058 - -/* - * TXRX_CSR7: OFDM ACK/CTS payload consumed time for 6/9/12/18 mbps. - */ -#define TXRX_CSR7 0x305c -#define TXRX_CSR7_ACK_CTS_6MBS FIELD32(0x000000ff) -#define TXRX_CSR7_ACK_CTS_9MBS FIELD32(0x0000ff00) -#define TXRX_CSR7_ACK_CTS_12MBS FIELD32(0x00ff0000) -#define TXRX_CSR7_ACK_CTS_18MBS FIELD32(0xff000000) - -/* - * TXRX_CSR8: OFDM ACK/CTS payload consumed time for 24/36/48/54 mbps. - */ -#define TXRX_CSR8 0x3060 -#define TXRX_CSR8_ACK_CTS_24MBS FIELD32(0x000000ff) -#define TXRX_CSR8_ACK_CTS_36MBS FIELD32(0x0000ff00) -#define TXRX_CSR8_ACK_CTS_48MBS FIELD32(0x00ff0000) -#define TXRX_CSR8_ACK_CTS_54MBS FIELD32(0xff000000) - -/* - * TXRX_CSR9: Synchronization control register. - * BEACON_INTERVAL: In unit of 1/16 TU. - * TSF_TICKING: Enable TSF auto counting. - * TSF_SYNC: Tsf sync, 0: disable, 1: infra, 2: ad-hoc/master mode. - * BEACON_GEN: Enable beacon generator. - */ -#define TXRX_CSR9 0x3064 -#define TXRX_CSR9_BEACON_INTERVAL FIELD32(0x0000ffff) -#define TXRX_CSR9_TSF_TICKING FIELD32(0x00010000) -#define TXRX_CSR9_TSF_SYNC FIELD32(0x00060000) -#define TXRX_CSR9_TBTT_ENABLE FIELD32(0x00080000) -#define TXRX_CSR9_BEACON_GEN FIELD32(0x00100000) -#define TXRX_CSR9_TIMESTAMP_COMPENSATE FIELD32(0xff000000) - -/* - * TXRX_CSR10: BEACON alignment. - */ -#define TXRX_CSR10 0x3068 - -/* - * TXRX_CSR11: AES mask. - */ -#define TXRX_CSR11 0x306c - -/* - * TXRX_CSR12: TSF low 32. - */ -#define TXRX_CSR12 0x3070 -#define TXRX_CSR12_LOW_TSFTIMER FIELD32(0xffffffff) - -/* - * TXRX_CSR13: TSF high 32. - */ -#define TXRX_CSR13 0x3074 -#define TXRX_CSR13_HIGH_TSFTIMER FIELD32(0xffffffff) - -/* - * TXRX_CSR14: TBTT timer. - */ -#define TXRX_CSR14 0x3078 - -/* - * TXRX_CSR15: TKIP MIC priority byte "AND" mask. - */ -#define TXRX_CSR15 0x307c - -/* - * PHY control registers. - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * PHY_CSR0: RF/PS control. - */ -#define PHY_CSR0 0x3080 -#define PHY_CSR0_PA_PE_BG FIELD32(0x00010000) -#define PHY_CSR0_PA_PE_A FIELD32(0x00020000) - -/* - * PHY_CSR1 - */ -#define PHY_CSR1 0x3084 - -/* - * PHY_CSR2: Pre-TX BBP control. - */ -#define PHY_CSR2 0x3088 - -/* - * PHY_CSR3: BBP serial control register. - * VALUE: Register value to program into BBP. - * REG_NUM: Selected BBP register. - * READ_CONTROL: 0: Write BBP, 1: Read BBP. - * BUSY: 1: ASIC is busy execute BBP programming. - */ -#define PHY_CSR3 0x308c -#define PHY_CSR3_VALUE FIELD32(0x000000ff) -#define PHY_CSR3_REGNUM FIELD32(0x00007f00) -#define PHY_CSR3_READ_CONTROL FIELD32(0x00008000) -#define PHY_CSR3_BUSY FIELD32(0x00010000) - -/* - * PHY_CSR4: RF serial control register - * VALUE: Register value (include register id) serial out to RF/IF chip. - * NUMBER_OF_BITS: Number of bits used in RFRegValue (I:20, RFMD:22). - * IF_SELECT: 1: select IF to program, 0: select RF to program. - * PLL_LD: RF PLL_LD status. - * BUSY: 1: ASIC is busy execute RF programming. - */ -#define PHY_CSR4 0x3090 -#define PHY_CSR4_VALUE FIELD32(0x00ffffff) -#define PHY_CSR4_NUMBER_OF_BITS FIELD32(0x1f000000) -#define PHY_CSR4_IF_SELECT FIELD32(0x20000000) -#define PHY_CSR4_PLL_LD FIELD32(0x40000000) -#define PHY_CSR4_BUSY FIELD32(0x80000000) - -/* - * PHY_CSR5: RX to TX signal switch timing control. - */ -#define PHY_CSR5 0x3094 -#define PHY_CSR5_IQ_FLIP FIELD32(0x00000004) - -/* - * PHY_CSR6: TX to RX signal timing control. - */ -#define PHY_CSR6 0x3098 -#define PHY_CSR6_IQ_FLIP FIELD32(0x00000004) - -/* - * PHY_CSR7: TX DAC switching timing control. - */ -#define PHY_CSR7 0x309c - -/* - * Security control register. - */ - -/* - * SEC_CSR0: Shared key table control. - */ -#define SEC_CSR0 0x30a0 -#define SEC_CSR0_BSS0_KEY0_VALID FIELD32(0x00000001) -#define SEC_CSR0_BSS0_KEY1_VALID FIELD32(0x00000002) -#define SEC_CSR0_BSS0_KEY2_VALID FIELD32(0x00000004) -#define SEC_CSR0_BSS0_KEY3_VALID FIELD32(0x00000008) -#define SEC_CSR0_BSS1_KEY0_VALID FIELD32(0x00000010) -#define SEC_CSR0_BSS1_KEY1_VALID FIELD32(0x00000020) -#define SEC_CSR0_BSS1_KEY2_VALID FIELD32(0x00000040) -#define SEC_CSR0_BSS1_KEY3_VALID FIELD32(0x00000080) -#define SEC_CSR0_BSS2_KEY0_VALID FIELD32(0x00000100) -#define SEC_CSR0_BSS2_KEY1_VALID FIELD32(0x00000200) -#define SEC_CSR0_BSS2_KEY2_VALID FIELD32(0x00000400) -#define SEC_CSR0_BSS2_KEY3_VALID FIELD32(0x00000800) -#define SEC_CSR0_BSS3_KEY0_VALID FIELD32(0x00001000) -#define SEC_CSR0_BSS3_KEY1_VALID FIELD32(0x00002000) -#define SEC_CSR0_BSS3_KEY2_VALID FIELD32(0x00004000) -#define SEC_CSR0_BSS3_KEY3_VALID FIELD32(0x00008000) - -/* - * SEC_CSR1: Shared key table security mode register. - */ -#define SEC_CSR1 0x30a4 -#define SEC_CSR1_BSS0_KEY0_CIPHER_ALG FIELD32(0x00000007) -#define SEC_CSR1_BSS0_KEY1_CIPHER_ALG FIELD32(0x00000070) -#define SEC_CSR1_BSS0_KEY2_CIPHER_ALG FIELD32(0x00000700) -#define SEC_CSR1_BSS0_KEY3_CIPHER_ALG FIELD32(0x00007000) -#define SEC_CSR1_BSS1_KEY0_CIPHER_ALG FIELD32(0x00070000) -#define SEC_CSR1_BSS1_KEY1_CIPHER_ALG FIELD32(0x00700000) -#define SEC_CSR1_BSS1_KEY2_CIPHER_ALG FIELD32(0x07000000) -#define SEC_CSR1_BSS1_KEY3_CIPHER_ALG FIELD32(0x70000000) - -/* - * Pairwise key table valid bitmap registers. - * SEC_CSR2: pairwise key table valid bitmap 0. - * SEC_CSR3: pairwise key table valid bitmap 1. - */ -#define SEC_CSR2 0x30a8 -#define SEC_CSR3 0x30ac - -/* - * SEC_CSR4: Pairwise key table lookup control. - */ -#define SEC_CSR4 0x30b0 -#define SEC_CSR4_ENABLE_BSS0 FIELD32(0x00000001) -#define SEC_CSR4_ENABLE_BSS1 FIELD32(0x00000002) -#define SEC_CSR4_ENABLE_BSS2 FIELD32(0x00000004) -#define SEC_CSR4_ENABLE_BSS3 FIELD32(0x00000008) - -/* - * SEC_CSR5: shared key table security mode register. - */ -#define SEC_CSR5 0x30b4 -#define SEC_CSR5_BSS2_KEY0_CIPHER_ALG FIELD32(0x00000007) -#define SEC_CSR5_BSS2_KEY1_CIPHER_ALG FIELD32(0x00000070) -#define SEC_CSR5_BSS2_KEY2_CIPHER_ALG FIELD32(0x00000700) -#define SEC_CSR5_BSS2_KEY3_CIPHER_ALG FIELD32(0x00007000) -#define SEC_CSR5_BSS3_KEY0_CIPHER_ALG FIELD32(0x00070000) -#define SEC_CSR5_BSS3_KEY1_CIPHER_ALG FIELD32(0x00700000) -#define SEC_CSR5_BSS3_KEY2_CIPHER_ALG FIELD32(0x07000000) -#define SEC_CSR5_BSS3_KEY3_CIPHER_ALG FIELD32(0x70000000) - -/* - * STA control registers. - */ - -/* - * STA_CSR0: RX PLCP error count & RX FCS error count. - */ -#define STA_CSR0 0x30c0 -#define STA_CSR0_FCS_ERROR FIELD32(0x0000ffff) -#define STA_CSR0_PLCP_ERROR FIELD32(0xffff0000) - -/* - * STA_CSR1: RX False CCA count & RX LONG frame count. - */ -#define STA_CSR1 0x30c4 -#define STA_CSR1_PHYSICAL_ERROR FIELD32(0x0000ffff) -#define STA_CSR1_FALSE_CCA_ERROR FIELD32(0xffff0000) - -/* - * STA_CSR2: TX Beacon count and RX FIFO overflow count. - */ -#define STA_CSR2 0x30c8 -#define STA_CSR2_RX_FIFO_OVERFLOW_COUNT FIELD32(0x0000ffff) -#define STA_CSR2_RX_OVERFLOW_COUNT FIELD32(0xffff0000) - -/* - * STA_CSR3: TX Beacon count. - */ -#define STA_CSR3 0x30cc -#define STA_CSR3_TX_BEACON_COUNT FIELD32(0x0000ffff) - -/* - * STA_CSR4: TX Result status register. - * VALID: 1:This register contains a valid TX result. - */ -#define STA_CSR4 0x30d0 -#define STA_CSR4_VALID FIELD32(0x00000001) -#define STA_CSR4_TX_RESULT FIELD32(0x0000000e) -#define STA_CSR4_RETRY_COUNT FIELD32(0x000000f0) -#define STA_CSR4_PID_SUBTYPE FIELD32(0x00001f00) -#define STA_CSR4_PID_TYPE FIELD32(0x0000e000) -#define STA_CSR4_TXRATE FIELD32(0x000f0000) - -/* - * QOS control registers. - */ - -/* - * QOS_CSR0: TXOP holder MAC address register. - */ -#define QOS_CSR0 0x30e0 -#define QOS_CSR0_BYTE0 FIELD32(0x000000ff) -#define QOS_CSR0_BYTE1 FIELD32(0x0000ff00) -#define QOS_CSR0_BYTE2 FIELD32(0x00ff0000) -#define QOS_CSR0_BYTE3 FIELD32(0xff000000) - -/* - * QOS_CSR1: TXOP holder MAC address register. - */ -#define QOS_CSR1 0x30e4 -#define QOS_CSR1_BYTE4 FIELD32(0x000000ff) -#define QOS_CSR1_BYTE5 FIELD32(0x0000ff00) - -/* - * QOS_CSR2: TXOP holder timeout register. - */ -#define QOS_CSR2 0x30e8 - -/* - * RX QOS-CFPOLL MAC address register. - * QOS_CSR3: RX QOS-CFPOLL MAC address 0. - * QOS_CSR4: RX QOS-CFPOLL MAC address 1. - */ -#define QOS_CSR3 0x30ec -#define QOS_CSR4 0x30f0 - -/* - * QOS_CSR5: "QosControl" field of the RX QOS-CFPOLL. - */ -#define QOS_CSR5 0x30f4 - -/* - * Host DMA registers. - */ - -/* - * AC0_BASE_CSR: AC_VO base address. - */ -#define AC0_BASE_CSR 0x3400 -#define AC0_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) - -/* - * AC1_BASE_CSR: AC_VI base address. - */ -#define AC1_BASE_CSR 0x3404 -#define AC1_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) - -/* - * AC2_BASE_CSR: AC_BE base address. - */ -#define AC2_BASE_CSR 0x3408 -#define AC2_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) - -/* - * AC3_BASE_CSR: AC_BK base address. - */ -#define AC3_BASE_CSR 0x340c -#define AC3_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) - -/* - * MGMT_BASE_CSR: MGMT ring base address. - */ -#define MGMT_BASE_CSR 0x3410 -#define MGMT_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) - -/* - * TX_RING_CSR0: TX Ring size for AC_VO, AC_VI, AC_BE, AC_BK. - */ -#define TX_RING_CSR0 0x3418 -#define TX_RING_CSR0_AC0_RING_SIZE FIELD32(0x000000ff) -#define TX_RING_CSR0_AC1_RING_SIZE FIELD32(0x0000ff00) -#define TX_RING_CSR0_AC2_RING_SIZE FIELD32(0x00ff0000) -#define TX_RING_CSR0_AC3_RING_SIZE FIELD32(0xff000000) - -/* - * TX_RING_CSR1: TX Ring size for MGMT Ring, HCCA Ring - * TXD_SIZE: In unit of 32-bit. - */ -#define TX_RING_CSR1 0x341c -#define TX_RING_CSR1_MGMT_RING_SIZE FIELD32(0x000000ff) -#define TX_RING_CSR1_HCCA_RING_SIZE FIELD32(0x0000ff00) -#define TX_RING_CSR1_TXD_SIZE FIELD32(0x003f0000) - -/* - * AIFSN_CSR: AIFSN for each EDCA AC. - * AIFSN0: For AC_VO. - * AIFSN1: For AC_VI. - * AIFSN2: For AC_BE. - * AIFSN3: For AC_BK. - */ -#define AIFSN_CSR 0x3420 -#define AIFSN_CSR_AIFSN0 FIELD32(0x0000000f) -#define AIFSN_CSR_AIFSN1 FIELD32(0x000000f0) -#define AIFSN_CSR_AIFSN2 FIELD32(0x00000f00) -#define AIFSN_CSR_AIFSN3 FIELD32(0x0000f000) - -/* - * CWMIN_CSR: CWmin for each EDCA AC. - * CWMIN0: For AC_VO. - * CWMIN1: For AC_VI. - * CWMIN2: For AC_BE. - * CWMIN3: For AC_BK. - */ -#define CWMIN_CSR 0x3424 -#define CWMIN_CSR_CWMIN0 FIELD32(0x0000000f) -#define CWMIN_CSR_CWMIN1 FIELD32(0x000000f0) -#define CWMIN_CSR_CWMIN2 FIELD32(0x00000f00) -#define CWMIN_CSR_CWMIN3 FIELD32(0x0000f000) - -/* - * CWMAX_CSR: CWmax for each EDCA AC. - * CWMAX0: For AC_VO. - * CWMAX1: For AC_VI. - * CWMAX2: For AC_BE. - * CWMAX3: For AC_BK. - */ -#define CWMAX_CSR 0x3428 -#define CWMAX_CSR_CWMAX0 FIELD32(0x0000000f) -#define CWMAX_CSR_CWMAX1 FIELD32(0x000000f0) -#define CWMAX_CSR_CWMAX2 FIELD32(0x00000f00) -#define CWMAX_CSR_CWMAX3 FIELD32(0x0000f000) - -/* - * TX_DMA_DST_CSR: TX DMA destination - * 0: TX ring0, 1: TX ring1, 2: TX ring2 3: invalid - */ -#define TX_DMA_DST_CSR 0x342c -#define TX_DMA_DST_CSR_DEST_AC0 FIELD32(0x00000003) -#define TX_DMA_DST_CSR_DEST_AC1 FIELD32(0x0000000c) -#define TX_DMA_DST_CSR_DEST_AC2 FIELD32(0x00000030) -#define TX_DMA_DST_CSR_DEST_AC3 FIELD32(0x000000c0) -#define TX_DMA_DST_CSR_DEST_MGMT FIELD32(0x00000300) - -/* - * TX_CNTL_CSR: KICK/Abort TX. - * KICK_TX_AC0: For AC_VO. - * KICK_TX_AC1: For AC_VI. - * KICK_TX_AC2: For AC_BE. - * KICK_TX_AC3: For AC_BK. - * ABORT_TX_AC0: For AC_VO. - * ABORT_TX_AC1: For AC_VI. - * ABORT_TX_AC2: For AC_BE. - * ABORT_TX_AC3: For AC_BK. - */ -#define TX_CNTL_CSR 0x3430 -#define TX_CNTL_CSR_KICK_TX_AC0 FIELD32(0x00000001) -#define TX_CNTL_CSR_KICK_TX_AC1 FIELD32(0x00000002) -#define TX_CNTL_CSR_KICK_TX_AC2 FIELD32(0x00000004) -#define TX_CNTL_CSR_KICK_TX_AC3 FIELD32(0x00000008) -#define TX_CNTL_CSR_KICK_TX_MGMT FIELD32(0x00000010) -#define TX_CNTL_CSR_ABORT_TX_AC0 FIELD32(0x00010000) -#define TX_CNTL_CSR_ABORT_TX_AC1 FIELD32(0x00020000) -#define TX_CNTL_CSR_ABORT_TX_AC2 FIELD32(0x00040000) -#define TX_CNTL_CSR_ABORT_TX_AC3 FIELD32(0x00080000) -#define TX_CNTL_CSR_ABORT_TX_MGMT FIELD32(0x00100000) - -/* - * LOAD_TX_RING_CSR: Load RX desriptor - */ -#define LOAD_TX_RING_CSR 0x3434 -#define LOAD_TX_RING_CSR_LOAD_TXD_AC0 FIELD32(0x00000001) -#define LOAD_TX_RING_CSR_LOAD_TXD_AC1 FIELD32(0x00000002) -#define LOAD_TX_RING_CSR_LOAD_TXD_AC2 FIELD32(0x00000004) -#define LOAD_TX_RING_CSR_LOAD_TXD_AC3 FIELD32(0x00000008) -#define LOAD_TX_RING_CSR_LOAD_TXD_MGMT FIELD32(0x00000010) - -/* - * Several read-only registers, for debugging. - */ -#define AC0_TXPTR_CSR 0x3438 -#define AC1_TXPTR_CSR 0x343c -#define AC2_TXPTR_CSR 0x3440 -#define AC3_TXPTR_CSR 0x3444 -#define MGMT_TXPTR_CSR 0x3448 - -/* - * RX_BASE_CSR - */ -#define RX_BASE_CSR 0x3450 -#define RX_BASE_CSR_RING_REGISTER FIELD32(0xffffffff) - -/* - * RX_RING_CSR. - * RXD_SIZE: In unit of 32-bit. - */ -#define RX_RING_CSR 0x3454 -#define RX_RING_CSR_RING_SIZE FIELD32(0x000000ff) -#define RX_RING_CSR_RXD_SIZE FIELD32(0x00003f00) -#define RX_RING_CSR_RXD_WRITEBACK_SIZE FIELD32(0x00070000) - -/* - * RX_CNTL_CSR - */ -#define RX_CNTL_CSR 0x3458 -#define RX_CNTL_CSR_ENABLE_RX_DMA FIELD32(0x00000001) -#define RX_CNTL_CSR_LOAD_RXD FIELD32(0x00000002) - -/* - * RXPTR_CSR: Read-only, for debugging. - */ -#define RXPTR_CSR 0x345c - -/* - * PCI_CFG_CSR - */ -#define PCI_CFG_CSR 0x3460 - -/* - * BUF_FORMAT_CSR - */ -#define BUF_FORMAT_CSR 0x3464 - -/* - * INT_SOURCE_CSR: Interrupt source register. - * Write one to clear corresponding bit. - */ -#define INT_SOURCE_CSR 0x3468 -#define INT_SOURCE_CSR_TXDONE FIELD32(0x00000001) -#define INT_SOURCE_CSR_RXDONE FIELD32(0x00000002) -#define INT_SOURCE_CSR_BEACON_DONE FIELD32(0x00000004) -#define INT_SOURCE_CSR_TX_ABORT_DONE FIELD32(0x00000010) -#define INT_SOURCE_CSR_AC0_DMA_DONE FIELD32(0x00010000) -#define INT_SOURCE_CSR_AC1_DMA_DONE FIELD32(0x00020000) -#define INT_SOURCE_CSR_AC2_DMA_DONE FIELD32(0x00040000) -#define INT_SOURCE_CSR_AC3_DMA_DONE FIELD32(0x00080000) -#define INT_SOURCE_CSR_MGMT_DMA_DONE FIELD32(0x00100000) -#define INT_SOURCE_CSR_HCCA_DMA_DONE FIELD32(0x00200000) - -/* - * INT_MASK_CSR: Interrupt MASK register. 1: the interrupt is mask OFF. - * MITIGATION_PERIOD: Interrupt mitigation in unit of 32 PCI clock. - */ -#define INT_MASK_CSR 0x346c -#define INT_MASK_CSR_TXDONE FIELD32(0x00000001) -#define INT_MASK_CSR_RXDONE FIELD32(0x00000002) -#define INT_MASK_CSR_BEACON_DONE FIELD32(0x00000004) -#define INT_MASK_CSR_TX_ABORT_DONE FIELD32(0x00000010) -#define INT_MASK_CSR_ENABLE_MITIGATION FIELD32(0x00000080) -#define INT_MASK_CSR_MITIGATION_PERIOD FIELD32(0x0000ff00) -#define INT_MASK_CSR_AC0_DMA_DONE FIELD32(0x00010000) -#define INT_MASK_CSR_AC1_DMA_DONE FIELD32(0x00020000) -#define INT_MASK_CSR_AC2_DMA_DONE FIELD32(0x00040000) -#define INT_MASK_CSR_AC3_DMA_DONE FIELD32(0x00080000) -#define INT_MASK_CSR_MGMT_DMA_DONE FIELD32(0x00100000) -#define INT_MASK_CSR_HCCA_DMA_DONE FIELD32(0x00200000) - -/* - * E2PROM_CSR: EEPROM control register. - * RELOAD: Write 1 to reload eeprom content. - * TYPE_93C46: 1: 93c46, 0:93c66. - * LOAD_STATUS: 1:loading, 0:done. - */ -#define E2PROM_CSR 0x3470 -#define E2PROM_CSR_RELOAD FIELD32(0x00000001) -#define E2PROM_CSR_DATA_CLOCK FIELD32(0x00000002) -#define E2PROM_CSR_CHIP_SELECT FIELD32(0x00000004) -#define E2PROM_CSR_DATA_IN FIELD32(0x00000008) -#define E2PROM_CSR_DATA_OUT FIELD32(0x00000010) -#define E2PROM_CSR_TYPE_93C46 FIELD32(0x00000020) -#define E2PROM_CSR_LOAD_STATUS FIELD32(0x00000040) - -/* - * AC_TXOP_CSR0: AC_VO/AC_VI TXOP register. - * AC0_TX_OP: For AC_VO, in unit of 32us. - * AC1_TX_OP: For AC_VI, in unit of 32us. - */ -#define AC_TXOP_CSR0 0x3474 -#define AC_TXOP_CSR0_AC0_TX_OP FIELD32(0x0000ffff) -#define AC_TXOP_CSR0_AC1_TX_OP FIELD32(0xffff0000) - -/* - * AC_TXOP_CSR1: AC_BE/AC_BK TXOP register. - * AC2_TX_OP: For AC_BE, in unit of 32us. - * AC3_TX_OP: For AC_BK, in unit of 32us. - */ -#define AC_TXOP_CSR1 0x3478 -#define AC_TXOP_CSR1_AC2_TX_OP FIELD32(0x0000ffff) -#define AC_TXOP_CSR1_AC3_TX_OP FIELD32(0xffff0000) - -/* - * DMA_STATUS_CSR - */ -#define DMA_STATUS_CSR 0x3480 - -/* - * TEST_MODE_CSR - */ -#define TEST_MODE_CSR 0x3484 - -/* - * UART0_TX_CSR - */ -#define UART0_TX_CSR 0x3488 - -/* - * UART0_RX_CSR - */ -#define UART0_RX_CSR 0x348c - -/* - * UART0_FRAME_CSR - */ -#define UART0_FRAME_CSR 0x3490 - -/* - * UART0_BUFFER_CSR - */ -#define UART0_BUFFER_CSR 0x3494 - -/* - * IO_CNTL_CSR - * RF_PS: Set RF interface value to power save - */ -#define IO_CNTL_CSR 0x3498 -#define IO_CNTL_CSR_RF_PS FIELD32(0x00000004) - -/* - * UART_INT_SOURCE_CSR - */ -#define UART_INT_SOURCE_CSR 0x34a8 - -/* - * UART_INT_MASK_CSR - */ -#define UART_INT_MASK_CSR 0x34ac - -/* - * PBF_QUEUE_CSR - */ -#define PBF_QUEUE_CSR 0x34b0 - -/* - * Firmware DMA registers. - * Firmware DMA registers are dedicated for MCU usage - * and should not be touched by host driver. - * Therefore we skip the definition of these registers. - */ -#define FW_TX_BASE_CSR 0x34c0 -#define FW_TX_START_CSR 0x34c4 -#define FW_TX_LAST_CSR 0x34c8 -#define FW_MODE_CNTL_CSR 0x34cc -#define FW_TXPTR_CSR 0x34d0 - -/* - * 8051 firmware image. - */ -#define FIRMWARE_RT2561 "rt2561.bin" -#define FIRMWARE_RT2561s "rt2561s.bin" -#define FIRMWARE_RT2661 "rt2661.bin" -#define FIRMWARE_IMAGE_BASE 0x4000 - -/* - * BBP registers. - * The wordsize of the BBP is 8 bits. - */ - -/* - * R2 - */ -#define BBP_R2_BG_MODE FIELD8(0x20) - -/* - * R3 - */ -#define BBP_R3_SMART_MODE FIELD8(0x01) - -/* - * R4: RX antenna control - * FRAME_END: 1 - DPDT, 0 - SPDT (Only valid for 802.11G, RF2527 & RF2529) - */ - -/* - * ANTENNA_CONTROL semantics (guessed): - * 0x1: Software controlled antenna switching (fixed or SW diversity) - * 0x2: Hardware diversity. - */ -#define BBP_R4_RX_ANTENNA_CONTROL FIELD8(0x03) -#define BBP_R4_RX_FRAME_END FIELD8(0x20) - -/* - * R77 - */ -#define BBP_R77_RX_ANTENNA FIELD8(0x03) - -/* - * RF registers - */ - -/* - * RF 3 - */ -#define RF3_TXPOWER FIELD32(0x00003e00) - -/* - * RF 4 - */ -#define RF4_FREQ_OFFSET FIELD32(0x0003f000) - -/* - * EEPROM content. - * The wordsize of the EEPROM is 16 bits. - */ - -/* - * HW MAC address. - */ -#define EEPROM_MAC_ADDR_0 0x0002 -#define EEPROM_MAC_ADDR_BYTE0 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE1 FIELD16(0xff00) -#define EEPROM_MAC_ADDR1 0x0003 -#define EEPROM_MAC_ADDR_BYTE2 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE3 FIELD16(0xff00) -#define EEPROM_MAC_ADDR_2 0x0004 -#define EEPROM_MAC_ADDR_BYTE4 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE5 FIELD16(0xff00) - -/* - * EEPROM antenna. - * ANTENNA_NUM: Number of antenna's. - * TX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B. - * RX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B. - * FRAME_TYPE: 0: DPDT , 1: SPDT , noted this bit is valid for g only. - * DYN_TXAGC: Dynamic TX AGC control. - * HARDWARE_RADIO: 1: Hardware controlled radio. Read GPIO0. - * RF_TYPE: Rf_type of this adapter. - */ -#define EEPROM_ANTENNA 0x0010 -#define EEPROM_ANTENNA_NUM FIELD16(0x0003) -#define EEPROM_ANTENNA_TX_DEFAULT FIELD16(0x000c) -#define EEPROM_ANTENNA_RX_DEFAULT FIELD16(0x0030) -#define EEPROM_ANTENNA_FRAME_TYPE FIELD16(0x0040) -#define EEPROM_ANTENNA_DYN_TXAGC FIELD16(0x0200) -#define EEPROM_ANTENNA_HARDWARE_RADIO FIELD16(0x0400) -#define EEPROM_ANTENNA_RF_TYPE FIELD16(0xf800) - -/* - * EEPROM NIC config. - * ENABLE_DIVERSITY: 1:enable, 0:disable. - * EXTERNAL_LNA_BG: External LNA enable for 2.4G. - * CARDBUS_ACCEL: 0:enable, 1:disable. - * EXTERNAL_LNA_A: External LNA enable for 5G. - */ -#define EEPROM_NIC 0x0011 -#define EEPROM_NIC_ENABLE_DIVERSITY FIELD16(0x0001) -#define EEPROM_NIC_TX_DIVERSITY FIELD16(0x0002) -#define EEPROM_NIC_RX_FIXED FIELD16(0x0004) -#define EEPROM_NIC_TX_FIXED FIELD16(0x0008) -#define EEPROM_NIC_EXTERNAL_LNA_BG FIELD16(0x0010) -#define EEPROM_NIC_CARDBUS_ACCEL FIELD16(0x0020) -#define EEPROM_NIC_EXTERNAL_LNA_A FIELD16(0x0040) - -/* - * EEPROM geography. - * GEO_A: Default geographical setting for 5GHz band - * GEO: Default geographical setting. - */ -#define EEPROM_GEOGRAPHY 0x0012 -#define EEPROM_GEOGRAPHY_GEO_A FIELD16(0x00ff) -#define EEPROM_GEOGRAPHY_GEO FIELD16(0xff00) - -/* - * EEPROM BBP. - */ -#define EEPROM_BBP_START 0x0013 -#define EEPROM_BBP_SIZE 16 -#define EEPROM_BBP_VALUE FIELD16(0x00ff) -#define EEPROM_BBP_REG_ID FIELD16(0xff00) - -/* - * EEPROM TXPOWER 802.11G - */ -#define EEPROM_TXPOWER_G_START 0x0023 -#define EEPROM_TXPOWER_G_SIZE 7 -#define EEPROM_TXPOWER_G_1 FIELD16(0x00ff) -#define EEPROM_TXPOWER_G_2 FIELD16(0xff00) - -/* - * EEPROM Frequency - */ -#define EEPROM_FREQ 0x002f -#define EEPROM_FREQ_OFFSET FIELD16(0x00ff) -#define EEPROM_FREQ_SEQ_MASK FIELD16(0xff00) -#define EEPROM_FREQ_SEQ FIELD16(0x0300) - -/* - * EEPROM LED. - * POLARITY_RDY_G: Polarity RDY_G setting. - * POLARITY_RDY_A: Polarity RDY_A setting. - * POLARITY_ACT: Polarity ACT setting. - * POLARITY_GPIO_0: Polarity GPIO0 setting. - * POLARITY_GPIO_1: Polarity GPIO1 setting. - * POLARITY_GPIO_2: Polarity GPIO2 setting. - * POLARITY_GPIO_3: Polarity GPIO3 setting. - * POLARITY_GPIO_4: Polarity GPIO4 setting. - * LED_MODE: Led mode. - */ -#define EEPROM_LED 0x0030 -#define EEPROM_LED_POLARITY_RDY_G FIELD16(0x0001) -#define EEPROM_LED_POLARITY_RDY_A FIELD16(0x0002) -#define EEPROM_LED_POLARITY_ACT FIELD16(0x0004) -#define EEPROM_LED_POLARITY_GPIO_0 FIELD16(0x0008) -#define EEPROM_LED_POLARITY_GPIO_1 FIELD16(0x0010) -#define EEPROM_LED_POLARITY_GPIO_2 FIELD16(0x0020) -#define EEPROM_LED_POLARITY_GPIO_3 FIELD16(0x0040) -#define EEPROM_LED_POLARITY_GPIO_4 FIELD16(0x0080) -#define EEPROM_LED_LED_MODE FIELD16(0x1f00) - -/* - * EEPROM TXPOWER 802.11A - */ -#define EEPROM_TXPOWER_A_START 0x0031 -#define EEPROM_TXPOWER_A_SIZE 12 -#define EEPROM_TXPOWER_A_1 FIELD16(0x00ff) -#define EEPROM_TXPOWER_A_2 FIELD16(0xff00) - -/* - * EEPROM RSSI offset 802.11BG - */ -#define EEPROM_RSSI_OFFSET_BG 0x004d -#define EEPROM_RSSI_OFFSET_BG_1 FIELD16(0x00ff) -#define EEPROM_RSSI_OFFSET_BG_2 FIELD16(0xff00) - -/* - * EEPROM RSSI offset 802.11A - */ -#define EEPROM_RSSI_OFFSET_A 0x004e -#define EEPROM_RSSI_OFFSET_A_1 FIELD16(0x00ff) -#define EEPROM_RSSI_OFFSET_A_2 FIELD16(0xff00) - -/* - * MCU mailbox commands. - */ -#define MCU_SLEEP 0x30 -#define MCU_WAKEUP 0x31 -#define MCU_LED 0x50 -#define MCU_LED_STRENGTH 0x52 - -/* - * DMA descriptor defines. - */ -#define TXD_DESC_SIZE ( 16 * sizeof(__le32) ) -#define TXINFO_SIZE ( 6 * sizeof(__le32) ) -#define RXD_DESC_SIZE ( 16 * sizeof(__le32) ) - -/* - * TX descriptor format for TX, PRIO and Beacon Ring. - */ - -/* - * Word0 - * TKIP_MIC: ASIC appends TKIP MIC if TKIP is used. - * KEY_TABLE: Use per-client pairwise KEY table. - * KEY_INDEX: - * Key index (0~31) to the pairwise KEY table. - * 0~3 to shared KEY table 0 (BSS0). - * 4~7 to shared KEY table 1 (BSS1). - * 8~11 to shared KEY table 2 (BSS2). - * 12~15 to shared KEY table 3 (BSS3). - * BURST: Next frame belongs to same "burst" event. - */ -#define TXD_W0_OWNER_NIC FIELD32(0x00000001) -#define TXD_W0_VALID FIELD32(0x00000002) -#define TXD_W0_MORE_FRAG FIELD32(0x00000004) -#define TXD_W0_ACK FIELD32(0x00000008) -#define TXD_W0_TIMESTAMP FIELD32(0x00000010) -#define TXD_W0_OFDM FIELD32(0x00000020) -#define TXD_W0_IFS FIELD32(0x00000040) -#define TXD_W0_RETRY_MODE FIELD32(0x00000080) -#define TXD_W0_TKIP_MIC FIELD32(0x00000100) -#define TXD_W0_KEY_TABLE FIELD32(0x00000200) -#define TXD_W0_KEY_INDEX FIELD32(0x0000fc00) -#define TXD_W0_DATABYTE_COUNT FIELD32(0x0fff0000) -#define TXD_W0_BURST FIELD32(0x10000000) -#define TXD_W0_CIPHER_ALG FIELD32(0xe0000000) - -/* - * Word1 - * HOST_Q_ID: EDCA/HCCA queue ID. - * HW_SEQUENCE: MAC overwrites the frame sequence number. - * BUFFER_COUNT: Number of buffers in this TXD. - */ -#define TXD_W1_HOST_Q_ID FIELD32(0x0000000f) -#define TXD_W1_AIFSN FIELD32(0x000000f0) -#define TXD_W1_CWMIN FIELD32(0x00000f00) -#define TXD_W1_CWMAX FIELD32(0x0000f000) -#define TXD_W1_IV_OFFSET FIELD32(0x003f0000) -#define TXD_W1_PIGGY_BACK FIELD32(0x01000000) -#define TXD_W1_HW_SEQUENCE FIELD32(0x10000000) -#define TXD_W1_BUFFER_COUNT FIELD32(0xe0000000) - -/* - * Word2: PLCP information - */ -#define TXD_W2_PLCP_SIGNAL FIELD32(0x000000ff) -#define TXD_W2_PLCP_SERVICE FIELD32(0x0000ff00) -#define TXD_W2_PLCP_LENGTH_LOW FIELD32(0x00ff0000) -#define TXD_W2_PLCP_LENGTH_HIGH FIELD32(0xff000000) - -/* - * Word3 - */ -#define TXD_W3_IV FIELD32(0xffffffff) - -/* - * Word4 - */ -#define TXD_W4_EIV FIELD32(0xffffffff) - -/* - * Word5 - * FRAME_OFFSET: Frame start offset inside ASIC TXFIFO (after TXINFO field). - * TXD_W5_PID_SUBTYPE: Driver assigned packet ID index for txdone handler. - * TXD_W5_PID_TYPE: Driver assigned packet ID type for txdone handler. - * WAITING_DMA_DONE_INT: TXD been filled with data - * and waiting for TxDoneISR housekeeping. - */ -#define TXD_W5_FRAME_OFFSET FIELD32(0x000000ff) -#define TXD_W5_PID_SUBTYPE FIELD32(0x00001f00) -#define TXD_W5_PID_TYPE FIELD32(0x0000e000) -#define TXD_W5_TX_POWER FIELD32(0x00ff0000) -#define TXD_W5_WAITING_DMA_DONE_INT FIELD32(0x01000000) - -/* - * the above 24-byte is called TXINFO and will be DMAed to MAC block - * through TXFIFO. MAC block use this TXINFO to control the transmission - * behavior of this frame. - * The following fields are not used by MAC block. - * They are used by DMA block and HOST driver only. - * Once a frame has been DMA to ASIC, all the following fields are useless - * to ASIC. - */ - -/* - * Word6-10: Buffer physical address - */ -#define TXD_W6_BUFFER_PHYSICAL_ADDRESS FIELD32(0xffffffff) -#define TXD_W7_BUFFER_PHYSICAL_ADDRESS FIELD32(0xffffffff) -#define TXD_W8_BUFFER_PHYSICAL_ADDRESS FIELD32(0xffffffff) -#define TXD_W9_BUFFER_PHYSICAL_ADDRESS FIELD32(0xffffffff) -#define TXD_W10_BUFFER_PHYSICAL_ADDRESS FIELD32(0xffffffff) - -/* - * Word11-13: Buffer length - */ -#define TXD_W11_BUFFER_LENGTH0 FIELD32(0x00000fff) -#define TXD_W11_BUFFER_LENGTH1 FIELD32(0x0fff0000) -#define TXD_W12_BUFFER_LENGTH2 FIELD32(0x00000fff) -#define TXD_W12_BUFFER_LENGTH3 FIELD32(0x0fff0000) -#define TXD_W13_BUFFER_LENGTH4 FIELD32(0x00000fff) - -/* - * Word14 - */ -#define TXD_W14_SK_BUFFER FIELD32(0xffffffff) - -/* - * Word15 - */ -#define TXD_W15_NEXT_SK_BUFFER FIELD32(0xffffffff) - -/* - * RX descriptor format for RX Ring. - */ - -/* - * Word0 - * CIPHER_ERROR: 1:ICV error, 2:MIC error, 3:invalid key. - * KEY_INDEX: Decryption key actually used. - */ -#define RXD_W0_OWNER_NIC FIELD32(0x00000001) -#define RXD_W0_DROP FIELD32(0x00000002) -#define RXD_W0_UNICAST_TO_ME FIELD32(0x00000004) -#define RXD_W0_MULTICAST FIELD32(0x00000008) -#define RXD_W0_BROADCAST FIELD32(0x00000010) -#define RXD_W0_MY_BSS FIELD32(0x00000020) -#define RXD_W0_CRC_ERROR FIELD32(0x00000040) -#define RXD_W0_OFDM FIELD32(0x00000080) -#define RXD_W0_CIPHER_ERROR FIELD32(0x00000300) -#define RXD_W0_KEY_INDEX FIELD32(0x0000fc00) -#define RXD_W0_DATABYTE_COUNT FIELD32(0x0fff0000) -#define RXD_W0_CIPHER_ALG FIELD32(0xe0000000) - -/* - * Word1 - * SIGNAL: RX raw data rate reported by BBP. - */ -#define RXD_W1_SIGNAL FIELD32(0x000000ff) -#define RXD_W1_RSSI_AGC FIELD32(0x00001f00) -#define RXD_W1_RSSI_LNA FIELD32(0x00006000) -#define RXD_W1_FRAME_OFFSET FIELD32(0x7f000000) - -/* - * Word2 - * IV: Received IV of originally encrypted. - */ -#define RXD_W2_IV FIELD32(0xffffffff) - -/* - * Word3 - * EIV: Received EIV of originally encrypted. - */ -#define RXD_W3_EIV FIELD32(0xffffffff) - -/* - * Word4 - * ICV: Received ICV of originally encrypted. - * NOTE: This is a guess, the official definition is "reserved" - */ -#define RXD_W4_ICV FIELD32(0xffffffff) - -/* - * the above 20-byte is called RXINFO and will be DMAed to MAC RX block - * and passed to the HOST driver. - * The following fields are for DMA block and HOST usage only. - * Can't be touched by ASIC MAC block. - */ - -/* - * Word5 - */ -#define RXD_W5_BUFFER_PHYSICAL_ADDRESS FIELD32(0xffffffff) - -/* - * Word6-15: Reserved - */ -#define RXD_W6_RESERVED FIELD32(0xffffffff) -#define RXD_W7_RESERVED FIELD32(0xffffffff) -#define RXD_W8_RESERVED FIELD32(0xffffffff) -#define RXD_W9_RESERVED FIELD32(0xffffffff) -#define RXD_W10_RESERVED FIELD32(0xffffffff) -#define RXD_W11_RESERVED FIELD32(0xffffffff) -#define RXD_W12_RESERVED FIELD32(0xffffffff) -#define RXD_W13_RESERVED FIELD32(0xffffffff) -#define RXD_W14_RESERVED FIELD32(0xffffffff) -#define RXD_W15_RESERVED FIELD32(0xffffffff) - -/* - * Macros for converting txpower from EEPROM to mac80211 value - * and from mac80211 value to register value. - */ -#define MIN_TXPOWER 0 -#define MAX_TXPOWER 31 -#define DEFAULT_TXPOWER 24 - -#define TXPOWER_FROM_DEV(__txpower) \ - (((u8)(__txpower)) > MAX_TXPOWER) ? DEFAULT_TXPOWER : (__txpower) - -#define TXPOWER_TO_DEV(__txpower) \ - clamp_t(char, __txpower, MIN_TXPOWER, MAX_TXPOWER) - -#endif /* RT61PCI_H */ diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c deleted file mode 100644 index 2bbca183f94a..000000000000 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ /dev/null @@ -1,2543 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt73usb - Abstract: rt73usb device specific routines. - Supported chipsets: rt2571W & rt2671. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rt2x00.h" -#include "rt2x00usb.h" -#include "rt73usb.h" - -/* - * Allow hardware encryption to be disabled. - */ -static bool modparam_nohwcrypt; -module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); -MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); - -/* - * Register access. - * All access to the CSR registers will go through the methods - * rt2x00usb_register_read and rt2x00usb_register_write. - * BBP and RF register require indirect register access, - * and use the CSR registers BBPCSR and RFCSR to achieve this. - * These indirect registers work with busy bits, - * and we will try maximal REGISTER_BUSY_COUNT times to access - * the register while taking a REGISTER_BUSY_DELAY us delay - * between each attampt. When the busy bit is still set at that time, - * the access attempt is considered to have failed, - * and we will print an error. - * The _lock versions must be used if you already hold the csr_mutex - */ -#define WAIT_FOR_BBP(__dev, __reg) \ - rt2x00usb_regbusy_read((__dev), PHY_CSR3, PHY_CSR3_BUSY, (__reg)) -#define WAIT_FOR_RF(__dev, __reg) \ - rt2x00usb_regbusy_read((__dev), PHY_CSR4, PHY_CSR4_BUSY, (__reg)) - -static void rt73usb_bbp_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, const u8 value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the BBP becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_BBP(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, PHY_CSR3_VALUE, value); - rt2x00_set_field32(®, PHY_CSR3_REGNUM, word); - rt2x00_set_field32(®, PHY_CSR3_BUSY, 1); - rt2x00_set_field32(®, PHY_CSR3_READ_CONTROL, 0); - - rt2x00usb_register_write_lock(rt2x00dev, PHY_CSR3, reg); - } - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt73usb_bbp_read(struct rt2x00_dev *rt2x00dev, - const unsigned int word, u8 *value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the BBP becomes available, afterwards we - * can safely write the read request into the register. - * After the data has been written, we wait until hardware - * returns the correct value, if at any time the register - * doesn't become available in time, reg will be 0xffffffff - * which means we return 0xff to the caller. - */ - if (WAIT_FOR_BBP(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, PHY_CSR3_REGNUM, word); - rt2x00_set_field32(®, PHY_CSR3_BUSY, 1); - rt2x00_set_field32(®, PHY_CSR3_READ_CONTROL, 1); - - rt2x00usb_register_write_lock(rt2x00dev, PHY_CSR3, reg); - - WAIT_FOR_BBP(rt2x00dev, ®); - } - - *value = rt2x00_get_field32(reg, PHY_CSR3_VALUE); - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -static void rt73usb_rf_write(struct rt2x00_dev *rt2x00dev, - const unsigned int word, const u32 value) -{ - u32 reg; - - mutex_lock(&rt2x00dev->csr_mutex); - - /* - * Wait until the RF becomes available, afterwards we - * can safely write the new data into the register. - */ - if (WAIT_FOR_RF(rt2x00dev, ®)) { - reg = 0; - rt2x00_set_field32(®, PHY_CSR4_VALUE, value); - /* - * RF5225 and RF2527 contain 21 bits per RF register value, - * all others contain 20 bits. - */ - rt2x00_set_field32(®, PHY_CSR4_NUMBER_OF_BITS, - 20 + (rt2x00_rf(rt2x00dev, RF5225) || - rt2x00_rf(rt2x00dev, RF2527))); - rt2x00_set_field32(®, PHY_CSR4_IF_SELECT, 0); - rt2x00_set_field32(®, PHY_CSR4_BUSY, 1); - - rt2x00usb_register_write_lock(rt2x00dev, PHY_CSR4, reg); - rt2x00_rf_write(rt2x00dev, word, value); - } - - mutex_unlock(&rt2x00dev->csr_mutex); -} - -#ifdef CONFIG_RT2X00_LIB_DEBUGFS -static const struct rt2x00debug rt73usb_rt2x00debug = { - .owner = THIS_MODULE, - .csr = { - .read = rt2x00usb_register_read, - .write = rt2x00usb_register_write, - .flags = RT2X00DEBUGFS_OFFSET, - .word_base = CSR_REG_BASE, - .word_size = sizeof(u32), - .word_count = CSR_REG_SIZE / sizeof(u32), - }, - .eeprom = { - .read = rt2x00_eeprom_read, - .write = rt2x00_eeprom_write, - .word_base = EEPROM_BASE, - .word_size = sizeof(u16), - .word_count = EEPROM_SIZE / sizeof(u16), - }, - .bbp = { - .read = rt73usb_bbp_read, - .write = rt73usb_bbp_write, - .word_base = BBP_BASE, - .word_size = sizeof(u8), - .word_count = BBP_SIZE / sizeof(u8), - }, - .rf = { - .read = rt2x00_rf_read, - .write = rt73usb_rf_write, - .word_base = RF_BASE, - .word_size = sizeof(u32), - .word_count = RF_SIZE / sizeof(u32), - }, -}; -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ - -static int rt73usb_rfkill_poll(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - rt2x00usb_register_read(rt2x00dev, MAC_CSR13, ®); - return rt2x00_get_field32(reg, MAC_CSR13_VAL7); -} - -#ifdef CONFIG_RT2X00_LIB_LEDS -static void rt73usb_brightness_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct rt2x00_led *led = - container_of(led_cdev, struct rt2x00_led, led_dev); - unsigned int enabled = brightness != LED_OFF; - unsigned int a_mode = - (enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_5GHZ); - unsigned int bg_mode = - (enabled && led->rt2x00dev->curr_band == IEEE80211_BAND_2GHZ); - - if (led->type == LED_TYPE_RADIO) { - rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg, - MCU_LEDCS_RADIO_STATUS, enabled); - - rt2x00usb_vendor_request_sw(led->rt2x00dev, USB_LED_CONTROL, - 0, led->rt2x00dev->led_mcu_reg, - REGISTER_TIMEOUT); - } else if (led->type == LED_TYPE_ASSOC) { - rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg, - MCU_LEDCS_LINK_BG_STATUS, bg_mode); - rt2x00_set_field16(&led->rt2x00dev->led_mcu_reg, - MCU_LEDCS_LINK_A_STATUS, a_mode); - - rt2x00usb_vendor_request_sw(led->rt2x00dev, USB_LED_CONTROL, - 0, led->rt2x00dev->led_mcu_reg, - REGISTER_TIMEOUT); - } else if (led->type == LED_TYPE_QUALITY) { - /* - * The brightness is divided into 6 levels (0 - 5), - * this means we need to convert the brightness - * argument into the matching level within that range. - */ - rt2x00usb_vendor_request_sw(led->rt2x00dev, USB_LED_CONTROL, - brightness / (LED_FULL / 6), - led->rt2x00dev->led_mcu_reg, - REGISTER_TIMEOUT); - } -} - -static int rt73usb_blink_set(struct led_classdev *led_cdev, - unsigned long *delay_on, - unsigned long *delay_off) -{ - struct rt2x00_led *led = - container_of(led_cdev, struct rt2x00_led, led_dev); - u32 reg; - - rt2x00usb_register_read(led->rt2x00dev, MAC_CSR14, ®); - rt2x00_set_field32(®, MAC_CSR14_ON_PERIOD, *delay_on); - rt2x00_set_field32(®, MAC_CSR14_OFF_PERIOD, *delay_off); - rt2x00usb_register_write(led->rt2x00dev, MAC_CSR14, reg); - - return 0; -} - -static void rt73usb_init_led(struct rt2x00_dev *rt2x00dev, - struct rt2x00_led *led, - enum led_type type) -{ - led->rt2x00dev = rt2x00dev; - led->type = type; - led->led_dev.brightness_set = rt73usb_brightness_set; - led->led_dev.blink_set = rt73usb_blink_set; - led->flags = LED_INITIALIZED; -} -#endif /* CONFIG_RT2X00_LIB_LEDS */ - -/* - * Configuration handlers. - */ -static int rt73usb_config_shared_key(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_crypto *crypto, - struct ieee80211_key_conf *key) -{ - struct hw_key_entry key_entry; - struct rt2x00_field32 field; - u32 mask; - u32 reg; - - if (crypto->cmd == SET_KEY) { - /* - * rt2x00lib can't determine the correct free - * key_idx for shared keys. We have 1 register - * with key valid bits. The goal is simple, read - * the register, if that is full we have no slots - * left. - * Note that each BSS is allowed to have up to 4 - * shared keys, so put a mask over the allowed - * entries. - */ - mask = (0xf << crypto->bssidx); - - rt2x00usb_register_read(rt2x00dev, SEC_CSR0, ®); - reg &= mask; - - if (reg && reg == mask) - return -ENOSPC; - - key->hw_key_idx += reg ? ffz(reg) : 0; - - /* - * Upload key to hardware - */ - memcpy(key_entry.key, crypto->key, - sizeof(key_entry.key)); - memcpy(key_entry.tx_mic, crypto->tx_mic, - sizeof(key_entry.tx_mic)); - memcpy(key_entry.rx_mic, crypto->rx_mic, - sizeof(key_entry.rx_mic)); - - reg = SHARED_KEY_ENTRY(key->hw_key_idx); - rt2x00usb_register_multiwrite(rt2x00dev, reg, - &key_entry, sizeof(key_entry)); - - /* - * The cipher types are stored over 2 registers. - * bssidx 0 and 1 keys are stored in SEC_CSR1 and - * bssidx 1 and 2 keys are stored in SEC_CSR5. - * Using the correct defines correctly will cause overhead, - * so just calculate the correct offset. - */ - if (key->hw_key_idx < 8) { - field.bit_offset = (3 * key->hw_key_idx); - field.bit_mask = 0x7 << field.bit_offset; - - rt2x00usb_register_read(rt2x00dev, SEC_CSR1, ®); - rt2x00_set_field32(®, field, crypto->cipher); - rt2x00usb_register_write(rt2x00dev, SEC_CSR1, reg); - } else { - field.bit_offset = (3 * (key->hw_key_idx - 8)); - field.bit_mask = 0x7 << field.bit_offset; - - rt2x00usb_register_read(rt2x00dev, SEC_CSR5, ®); - rt2x00_set_field32(®, field, crypto->cipher); - rt2x00usb_register_write(rt2x00dev, SEC_CSR5, reg); - } - - /* - * The driver does not support the IV/EIV generation - * in hardware. However it doesn't support the IV/EIV - * inside the ieee80211 frame either, but requires it - * to be provided separately for the descriptor. - * rt2x00lib will cut the IV/EIV data out of all frames - * given to us by mac80211, but we must tell mac80211 - * to generate the IV/EIV data. - */ - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - } - - /* - * SEC_CSR0 contains only single-bit fields to indicate - * a particular key is valid. Because using the FIELD32() - * defines directly will cause a lot of overhead we use - * a calculation to determine the correct bit directly. - */ - mask = 1 << key->hw_key_idx; - - rt2x00usb_register_read(rt2x00dev, SEC_CSR0, ®); - if (crypto->cmd == SET_KEY) - reg |= mask; - else if (crypto->cmd == DISABLE_KEY) - reg &= ~mask; - rt2x00usb_register_write(rt2x00dev, SEC_CSR0, reg); - - return 0; -} - -static int rt73usb_config_pairwise_key(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_crypto *crypto, - struct ieee80211_key_conf *key) -{ - struct hw_pairwise_ta_entry addr_entry; - struct hw_key_entry key_entry; - u32 mask; - u32 reg; - - if (crypto->cmd == SET_KEY) { - /* - * rt2x00lib can't determine the correct free - * key_idx for pairwise keys. We have 2 registers - * with key valid bits. The goal is simple, read - * the first register, if that is full move to - * the next register. - * When both registers are full, we drop the key, - * otherwise we use the first invalid entry. - */ - rt2x00usb_register_read(rt2x00dev, SEC_CSR2, ®); - if (reg && reg == ~0) { - key->hw_key_idx = 32; - rt2x00usb_register_read(rt2x00dev, SEC_CSR3, ®); - if (reg && reg == ~0) - return -ENOSPC; - } - - key->hw_key_idx += reg ? ffz(reg) : 0; - - /* - * Upload key to hardware - */ - memcpy(key_entry.key, crypto->key, - sizeof(key_entry.key)); - memcpy(key_entry.tx_mic, crypto->tx_mic, - sizeof(key_entry.tx_mic)); - memcpy(key_entry.rx_mic, crypto->rx_mic, - sizeof(key_entry.rx_mic)); - - reg = PAIRWISE_KEY_ENTRY(key->hw_key_idx); - rt2x00usb_register_multiwrite(rt2x00dev, reg, - &key_entry, sizeof(key_entry)); - - /* - * Send the address and cipher type to the hardware register. - */ - memset(&addr_entry, 0, sizeof(addr_entry)); - memcpy(&addr_entry, crypto->address, ETH_ALEN); - addr_entry.cipher = crypto->cipher; - - reg = PAIRWISE_TA_ENTRY(key->hw_key_idx); - rt2x00usb_register_multiwrite(rt2x00dev, reg, - &addr_entry, sizeof(addr_entry)); - - /* - * Enable pairwise lookup table for given BSS idx, - * without this received frames will not be decrypted - * by the hardware. - */ - rt2x00usb_register_read(rt2x00dev, SEC_CSR4, ®); - reg |= (1 << crypto->bssidx); - rt2x00usb_register_write(rt2x00dev, SEC_CSR4, reg); - - /* - * The driver does not support the IV/EIV generation - * in hardware. However it doesn't support the IV/EIV - * inside the ieee80211 frame either, but requires it - * to be provided separately for the descriptor. - * rt2x00lib will cut the IV/EIV data out of all frames - * given to us by mac80211, but we must tell mac80211 - * to generate the IV/EIV data. - */ - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - } - - /* - * SEC_CSR2 and SEC_CSR3 contain only single-bit fields to indicate - * a particular key is valid. Because using the FIELD32() - * defines directly will cause a lot of overhead we use - * a calculation to determine the correct bit directly. - */ - if (key->hw_key_idx < 32) { - mask = 1 << key->hw_key_idx; - - rt2x00usb_register_read(rt2x00dev, SEC_CSR2, ®); - if (crypto->cmd == SET_KEY) - reg |= mask; - else if (crypto->cmd == DISABLE_KEY) - reg &= ~mask; - rt2x00usb_register_write(rt2x00dev, SEC_CSR2, reg); - } else { - mask = 1 << (key->hw_key_idx - 32); - - rt2x00usb_register_read(rt2x00dev, SEC_CSR3, ®); - if (crypto->cmd == SET_KEY) - reg |= mask; - else if (crypto->cmd == DISABLE_KEY) - reg &= ~mask; - rt2x00usb_register_write(rt2x00dev, SEC_CSR3, reg); - } - - return 0; -} - -static void rt73usb_config_filter(struct rt2x00_dev *rt2x00dev, - const unsigned int filter_flags) -{ - u32 reg; - - /* - * Start configuration steps. - * Note that the version error will always be dropped - * and broadcast frames will always be accepted since - * there is no filter for it at this time. - */ - rt2x00usb_register_read(rt2x00dev, TXRX_CSR0, ®); - rt2x00_set_field32(®, TXRX_CSR0_DROP_CRC, - !(filter_flags & FIF_FCSFAIL)); - rt2x00_set_field32(®, TXRX_CSR0_DROP_PHYSICAL, - !(filter_flags & FIF_PLCPFAIL)); - rt2x00_set_field32(®, TXRX_CSR0_DROP_CONTROL, - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL))); - rt2x00_set_field32(®, TXRX_CSR0_DROP_NOT_TO_ME, - !(filter_flags & FIF_PROMISC_IN_BSS)); - rt2x00_set_field32(®, TXRX_CSR0_DROP_TO_DS, - !(filter_flags & FIF_PROMISC_IN_BSS) && - !rt2x00dev->intf_ap_count); - rt2x00_set_field32(®, TXRX_CSR0_DROP_VERSION_ERROR, 1); - rt2x00_set_field32(®, TXRX_CSR0_DROP_MULTICAST, - !(filter_flags & FIF_ALLMULTI)); - rt2x00_set_field32(®, TXRX_CSR0_DROP_BROADCAST, 0); - rt2x00_set_field32(®, TXRX_CSR0_DROP_ACK_CTS, - !(filter_flags & FIF_CONTROL)); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR0, reg); -} - -static void rt73usb_config_intf(struct rt2x00_dev *rt2x00dev, - struct rt2x00_intf *intf, - struct rt2x00intf_conf *conf, - const unsigned int flags) -{ - u32 reg; - - if (flags & CONFIG_UPDATE_TYPE) { - /* - * Enable synchronisation. - */ - rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, ®); - rt2x00_set_field32(®, TXRX_CSR9_TSF_SYNC, conf->sync); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); - } - - if (flags & CONFIG_UPDATE_MAC) { - reg = le32_to_cpu(conf->mac[1]); - rt2x00_set_field32(®, MAC_CSR3_UNICAST_TO_ME_MASK, 0xff); - conf->mac[1] = cpu_to_le32(reg); - - rt2x00usb_register_multiwrite(rt2x00dev, MAC_CSR2, - conf->mac, sizeof(conf->mac)); - } - - if (flags & CONFIG_UPDATE_BSSID) { - reg = le32_to_cpu(conf->bssid[1]); - rt2x00_set_field32(®, MAC_CSR5_BSS_ID_MASK, 3); - conf->bssid[1] = cpu_to_le32(reg); - - rt2x00usb_register_multiwrite(rt2x00dev, MAC_CSR4, - conf->bssid, sizeof(conf->bssid)); - } -} - -static void rt73usb_config_erp(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_erp *erp, - u32 changed) -{ - u32 reg; - - rt2x00usb_register_read(rt2x00dev, TXRX_CSR0, ®); - rt2x00_set_field32(®, TXRX_CSR0_RX_ACK_TIMEOUT, 0x32); - rt2x00_set_field32(®, TXRX_CSR0_TSF_OFFSET, IEEE80211_HEADER); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR0, reg); - - if (changed & BSS_CHANGED_ERP_PREAMBLE) { - rt2x00usb_register_read(rt2x00dev, TXRX_CSR4, ®); - rt2x00_set_field32(®, TXRX_CSR4_AUTORESPOND_ENABLE, 1); - rt2x00_set_field32(®, TXRX_CSR4_AUTORESPOND_PREAMBLE, - !!erp->short_preamble); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR4, reg); - } - - if (changed & BSS_CHANGED_BASIC_RATES) - rt2x00usb_register_write(rt2x00dev, TXRX_CSR5, - erp->basic_rates); - - if (changed & BSS_CHANGED_BEACON_INT) { - rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, ®); - rt2x00_set_field32(®, TXRX_CSR9_BEACON_INTERVAL, - erp->beacon_int * 16); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); - } - - if (changed & BSS_CHANGED_ERP_SLOT) { - rt2x00usb_register_read(rt2x00dev, MAC_CSR9, ®); - rt2x00_set_field32(®, MAC_CSR9_SLOT_TIME, erp->slot_time); - rt2x00usb_register_write(rt2x00dev, MAC_CSR9, reg); - - rt2x00usb_register_read(rt2x00dev, MAC_CSR8, ®); - rt2x00_set_field32(®, MAC_CSR8_SIFS, erp->sifs); - rt2x00_set_field32(®, MAC_CSR8_SIFS_AFTER_RX_OFDM, 3); - rt2x00_set_field32(®, MAC_CSR8_EIFS, erp->eifs); - rt2x00usb_register_write(rt2x00dev, MAC_CSR8, reg); - } -} - -static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev, - struct antenna_setup *ant) -{ - u8 r3; - u8 r4; - u8 r77; - u8 temp; - - rt73usb_bbp_read(rt2x00dev, 3, &r3); - rt73usb_bbp_read(rt2x00dev, 4, &r4); - rt73usb_bbp_read(rt2x00dev, 77, &r77); - - rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0); - - /* - * Configure the RX antenna. - */ - switch (ant->rx) { - case ANTENNA_HW_DIVERSITY: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 2); - temp = !test_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags) - && (rt2x00dev->curr_band != IEEE80211_BAND_5GHZ); - rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, temp); - break; - case ANTENNA_A: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); - rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); - if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) - rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0); - else - rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); - break; - case ANTENNA_B: - default: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); - rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); - if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) - rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); - else - rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0); - break; - } - - rt73usb_bbp_write(rt2x00dev, 77, r77); - rt73usb_bbp_write(rt2x00dev, 3, r3); - rt73usb_bbp_write(rt2x00dev, 4, r4); -} - -static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev, - struct antenna_setup *ant) -{ - u8 r3; - u8 r4; - u8 r77; - - rt73usb_bbp_read(rt2x00dev, 3, &r3); - rt73usb_bbp_read(rt2x00dev, 4, &r4); - rt73usb_bbp_read(rt2x00dev, 77, &r77); - - rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0); - rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, - !test_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags)); - - /* - * Configure the RX antenna. - */ - switch (ant->rx) { - case ANTENNA_HW_DIVERSITY: - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 2); - break; - case ANTENNA_A: - rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); - break; - case ANTENNA_B: - default: - rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0); - rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); - break; - } - - rt73usb_bbp_write(rt2x00dev, 77, r77); - rt73usb_bbp_write(rt2x00dev, 3, r3); - rt73usb_bbp_write(rt2x00dev, 4, r4); -} - -struct antenna_sel { - u8 word; - /* - * value[0] -> non-LNA - * value[1] -> LNA - */ - u8 value[2]; -}; - -static const struct antenna_sel antenna_sel_a[] = { - { 96, { 0x58, 0x78 } }, - { 104, { 0x38, 0x48 } }, - { 75, { 0xfe, 0x80 } }, - { 86, { 0xfe, 0x80 } }, - { 88, { 0xfe, 0x80 } }, - { 35, { 0x60, 0x60 } }, - { 97, { 0x58, 0x58 } }, - { 98, { 0x58, 0x58 } }, -}; - -static const struct antenna_sel antenna_sel_bg[] = { - { 96, { 0x48, 0x68 } }, - { 104, { 0x2c, 0x3c } }, - { 75, { 0xfe, 0x80 } }, - { 86, { 0xfe, 0x80 } }, - { 88, { 0xfe, 0x80 } }, - { 35, { 0x50, 0x50 } }, - { 97, { 0x48, 0x48 } }, - { 98, { 0x48, 0x48 } }, -}; - -static void rt73usb_config_ant(struct rt2x00_dev *rt2x00dev, - struct antenna_setup *ant) -{ - const struct antenna_sel *sel; - unsigned int lna; - unsigned int i; - u32 reg; - - /* - * We should never come here because rt2x00lib is supposed - * to catch this and send us the correct antenna explicitely. - */ - BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY || - ant->tx == ANTENNA_SW_DIVERSITY); - - if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { - sel = antenna_sel_a; - lna = test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags); - } else { - sel = antenna_sel_bg; - lna = test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags); - } - - for (i = 0; i < ARRAY_SIZE(antenna_sel_a); i++) - rt73usb_bbp_write(rt2x00dev, sel[i].word, sel[i].value[lna]); - - rt2x00usb_register_read(rt2x00dev, PHY_CSR0, ®); - - rt2x00_set_field32(®, PHY_CSR0_PA_PE_BG, - (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ)); - rt2x00_set_field32(®, PHY_CSR0_PA_PE_A, - (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ)); - - rt2x00usb_register_write(rt2x00dev, PHY_CSR0, reg); - - if (rt2x00_rf(rt2x00dev, RF5226) || rt2x00_rf(rt2x00dev, RF5225)) - rt73usb_config_antenna_5x(rt2x00dev, ant); - else if (rt2x00_rf(rt2x00dev, RF2528) || rt2x00_rf(rt2x00dev, RF2527)) - rt73usb_config_antenna_2x(rt2x00dev, ant); -} - -static void rt73usb_config_lna_gain(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf) -{ - u16 eeprom; - short lna_gain = 0; - - if (libconf->conf->chandef.chan->band == IEEE80211_BAND_2GHZ) { - if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags)) - lna_gain += 14; - - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_BG, &eeprom); - lna_gain -= rt2x00_get_field16(eeprom, EEPROM_RSSI_OFFSET_BG_1); - } else { - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_A, &eeprom); - lna_gain -= rt2x00_get_field16(eeprom, EEPROM_RSSI_OFFSET_A_1); - } - - rt2x00dev->lna_gain = lna_gain; -} - -static void rt73usb_config_channel(struct rt2x00_dev *rt2x00dev, - struct rf_channel *rf, const int txpower) -{ - u8 r3; - u8 r94; - u8 smart; - - rt2x00_set_field32(&rf->rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower)); - rt2x00_set_field32(&rf->rf4, RF4_FREQ_OFFSET, rt2x00dev->freq_offset); - - smart = !(rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF2527)); - - rt73usb_bbp_read(rt2x00dev, 3, &r3); - rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, smart); - rt73usb_bbp_write(rt2x00dev, 3, r3); - - r94 = 6; - if (txpower > MAX_TXPOWER && txpower <= (MAX_TXPOWER + r94)) - r94 += txpower - MAX_TXPOWER; - else if (txpower < MIN_TXPOWER && txpower >= (MIN_TXPOWER - r94)) - r94 += txpower; - rt73usb_bbp_write(rt2x00dev, 94, r94); - - rt73usb_rf_write(rt2x00dev, 1, rf->rf1); - rt73usb_rf_write(rt2x00dev, 2, rf->rf2); - rt73usb_rf_write(rt2x00dev, 3, rf->rf3 & ~0x00000004); - rt73usb_rf_write(rt2x00dev, 4, rf->rf4); - - rt73usb_rf_write(rt2x00dev, 1, rf->rf1); - rt73usb_rf_write(rt2x00dev, 2, rf->rf2); - rt73usb_rf_write(rt2x00dev, 3, rf->rf3 | 0x00000004); - rt73usb_rf_write(rt2x00dev, 4, rf->rf4); - - rt73usb_rf_write(rt2x00dev, 1, rf->rf1); - rt73usb_rf_write(rt2x00dev, 2, rf->rf2); - rt73usb_rf_write(rt2x00dev, 3, rf->rf3 & ~0x00000004); - rt73usb_rf_write(rt2x00dev, 4, rf->rf4); - - udelay(10); -} - -static void rt73usb_config_txpower(struct rt2x00_dev *rt2x00dev, - const int txpower) -{ - struct rf_channel rf; - - rt2x00_rf_read(rt2x00dev, 1, &rf.rf1); - rt2x00_rf_read(rt2x00dev, 2, &rf.rf2); - rt2x00_rf_read(rt2x00dev, 3, &rf.rf3); - rt2x00_rf_read(rt2x00dev, 4, &rf.rf4); - - rt73usb_config_channel(rt2x00dev, &rf, txpower); -} - -static void rt73usb_config_retry_limit(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf) -{ - u32 reg; - - rt2x00usb_register_read(rt2x00dev, TXRX_CSR4, ®); - rt2x00_set_field32(®, TXRX_CSR4_OFDM_TX_RATE_DOWN, 1); - rt2x00_set_field32(®, TXRX_CSR4_OFDM_TX_RATE_STEP, 0); - rt2x00_set_field32(®, TXRX_CSR4_OFDM_TX_FALLBACK_CCK, 0); - rt2x00_set_field32(®, TXRX_CSR4_LONG_RETRY_LIMIT, - libconf->conf->long_frame_max_tx_count); - rt2x00_set_field32(®, TXRX_CSR4_SHORT_RETRY_LIMIT, - libconf->conf->short_frame_max_tx_count); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR4, reg); -} - -static void rt73usb_config_ps(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf) -{ - enum dev_state state = - (libconf->conf->flags & IEEE80211_CONF_PS) ? - STATE_SLEEP : STATE_AWAKE; - u32 reg; - - if (state == STATE_SLEEP) { - rt2x00usb_register_read(rt2x00dev, MAC_CSR11, ®); - rt2x00_set_field32(®, MAC_CSR11_DELAY_AFTER_TBCN, - rt2x00dev->beacon_int - 10); - rt2x00_set_field32(®, MAC_CSR11_TBCN_BEFORE_WAKEUP, - libconf->conf->listen_interval - 1); - rt2x00_set_field32(®, MAC_CSR11_WAKEUP_LATENCY, 5); - - /* We must first disable autowake before it can be enabled */ - rt2x00_set_field32(®, MAC_CSR11_AUTOWAKE, 0); - rt2x00usb_register_write(rt2x00dev, MAC_CSR11, reg); - - rt2x00_set_field32(®, MAC_CSR11_AUTOWAKE, 1); - rt2x00usb_register_write(rt2x00dev, MAC_CSR11, reg); - - rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0, - USB_MODE_SLEEP, REGISTER_TIMEOUT); - } else { - rt2x00usb_register_read(rt2x00dev, MAC_CSR11, ®); - rt2x00_set_field32(®, MAC_CSR11_DELAY_AFTER_TBCN, 0); - rt2x00_set_field32(®, MAC_CSR11_TBCN_BEFORE_WAKEUP, 0); - rt2x00_set_field32(®, MAC_CSR11_AUTOWAKE, 0); - rt2x00_set_field32(®, MAC_CSR11_WAKEUP_LATENCY, 0); - rt2x00usb_register_write(rt2x00dev, MAC_CSR11, reg); - - rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0, - USB_MODE_WAKEUP, REGISTER_TIMEOUT); - } -} - -static void rt73usb_config(struct rt2x00_dev *rt2x00dev, - struct rt2x00lib_conf *libconf, - const unsigned int flags) -{ - /* Always recalculate LNA gain before changing configuration */ - rt73usb_config_lna_gain(rt2x00dev, libconf); - - if (flags & IEEE80211_CONF_CHANGE_CHANNEL) - rt73usb_config_channel(rt2x00dev, &libconf->rf, - libconf->conf->power_level); - if ((flags & IEEE80211_CONF_CHANGE_POWER) && - !(flags & IEEE80211_CONF_CHANGE_CHANNEL)) - rt73usb_config_txpower(rt2x00dev, libconf->conf->power_level); - if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS) - rt73usb_config_retry_limit(rt2x00dev, libconf); - if (flags & IEEE80211_CONF_CHANGE_PS) - rt73usb_config_ps(rt2x00dev, libconf); -} - -/* - * Link tuning - */ -static void rt73usb_link_stats(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual) -{ - u32 reg; - - /* - * Update FCS error count from register. - */ - rt2x00usb_register_read(rt2x00dev, STA_CSR0, ®); - qual->rx_failed = rt2x00_get_field32(reg, STA_CSR0_FCS_ERROR); - - /* - * Update False CCA count from register. - */ - rt2x00usb_register_read(rt2x00dev, STA_CSR1, ®); - qual->false_cca = rt2x00_get_field32(reg, STA_CSR1_FALSE_CCA_ERROR); -} - -static inline void rt73usb_set_vgc(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual, u8 vgc_level) -{ - if (qual->vgc_level != vgc_level) { - rt73usb_bbp_write(rt2x00dev, 17, vgc_level); - qual->vgc_level = vgc_level; - qual->vgc_level_reg = vgc_level; - } -} - -static void rt73usb_reset_tuner(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual) -{ - rt73usb_set_vgc(rt2x00dev, qual, 0x20); -} - -static void rt73usb_link_tuner(struct rt2x00_dev *rt2x00dev, - struct link_qual *qual, const u32 count) -{ - u8 up_bound; - u8 low_bound; - - /* - * Determine r17 bounds. - */ - if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { - low_bound = 0x28; - up_bound = 0x48; - - if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags)) { - low_bound += 0x10; - up_bound += 0x10; - } - } else { - if (qual->rssi > -82) { - low_bound = 0x1c; - up_bound = 0x40; - } else if (qual->rssi > -84) { - low_bound = 0x1c; - up_bound = 0x20; - } else { - low_bound = 0x1c; - up_bound = 0x1c; - } - - if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags)) { - low_bound += 0x14; - up_bound += 0x10; - } - } - - /* - * If we are not associated, we should go straight to the - * dynamic CCA tuning. - */ - if (!rt2x00dev->intf_associated) - goto dynamic_cca_tune; - - /* - * Special big-R17 for very short distance - */ - if (qual->rssi > -35) { - rt73usb_set_vgc(rt2x00dev, qual, 0x60); - return; - } - - /* - * Special big-R17 for short distance - */ - if (qual->rssi >= -58) { - rt73usb_set_vgc(rt2x00dev, qual, up_bound); - return; - } - - /* - * Special big-R17 for middle-short distance - */ - if (qual->rssi >= -66) { - rt73usb_set_vgc(rt2x00dev, qual, low_bound + 0x10); - return; - } - - /* - * Special mid-R17 for middle distance - */ - if (qual->rssi >= -74) { - rt73usb_set_vgc(rt2x00dev, qual, low_bound + 0x08); - return; - } - - /* - * Special case: Change up_bound based on the rssi. - * Lower up_bound when rssi is weaker then -74 dBm. - */ - up_bound -= 2 * (-74 - qual->rssi); - if (low_bound > up_bound) - up_bound = low_bound; - - if (qual->vgc_level > up_bound) { - rt73usb_set_vgc(rt2x00dev, qual, up_bound); - return; - } - -dynamic_cca_tune: - - /* - * r17 does not yet exceed upper limit, continue and base - * the r17 tuning on the false CCA count. - */ - if ((qual->false_cca > 512) && (qual->vgc_level < up_bound)) - rt73usb_set_vgc(rt2x00dev, qual, - min_t(u8, qual->vgc_level + 4, up_bound)); - else if ((qual->false_cca < 100) && (qual->vgc_level > low_bound)) - rt73usb_set_vgc(rt2x00dev, qual, - max_t(u8, qual->vgc_level - 4, low_bound)); -} - -/* - * Queue handlers. - */ -static void rt73usb_start_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_RX: - rt2x00usb_register_read(rt2x00dev, TXRX_CSR0, ®); - rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, 0); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR0, reg); - break; - case QID_BEACON: - rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, ®); - rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 1); - rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 1); - rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); - break; - default: - break; - } -} - -static void rt73usb_stop_queue(struct data_queue *queue) -{ - struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; - u32 reg; - - switch (queue->qid) { - case QID_RX: - rt2x00usb_register_read(rt2x00dev, TXRX_CSR0, ®); - rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, 1); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR0, reg); - break; - case QID_BEACON: - rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, ®); - rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 0); - rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 0); - rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); - break; - default: - break; - } -} - -/* - * Firmware functions - */ -static char *rt73usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) -{ - return FIRMWARE_RT2571; -} - -static int rt73usb_check_firmware(struct rt2x00_dev *rt2x00dev, - const u8 *data, const size_t len) -{ - u16 fw_crc; - u16 crc; - - /* - * Only support 2kb firmware files. - */ - if (len != 2048) - return FW_BAD_LENGTH; - - /* - * The last 2 bytes in the firmware array are the crc checksum itself, - * this means that we should never pass those 2 bytes to the crc - * algorithm. - */ - fw_crc = (data[len - 2] << 8 | data[len - 1]); - - /* - * Use the crc itu-t algorithm. - */ - crc = crc_itu_t(0, data, len - 2); - crc = crc_itu_t_byte(crc, 0); - crc = crc_itu_t_byte(crc, 0); - - return (fw_crc == crc) ? FW_OK : FW_BAD_CRC; -} - -static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, - const u8 *data, const size_t len) -{ - unsigned int i; - int status; - u32 reg; - - /* - * Wait for stable hardware. - */ - for (i = 0; i < 100; i++) { - rt2x00usb_register_read(rt2x00dev, MAC_CSR0, ®); - if (reg) - break; - msleep(1); - } - - if (!reg) { - rt2x00_err(rt2x00dev, "Unstable hardware\n"); - return -EBUSY; - } - - /* - * Write firmware to device. - */ - rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, data, len); - - /* - * Send firmware request to device to load firmware, - * we need to specify a long timeout time. - */ - status = rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, - 0, USB_MODE_FIRMWARE, - REGISTER_TIMEOUT_FIRMWARE); - if (status < 0) { - rt2x00_err(rt2x00dev, "Failed to write Firmware to device\n"); - return status; - } - - return 0; -} - -/* - * Initialization functions. - */ -static int rt73usb_init_registers(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - - rt2x00usb_register_read(rt2x00dev, TXRX_CSR0, ®); - rt2x00_set_field32(®, TXRX_CSR0_AUTO_TX_SEQ, 1); - rt2x00_set_field32(®, TXRX_CSR0_DISABLE_RX, 0); - rt2x00_set_field32(®, TXRX_CSR0_TX_WITHOUT_WAITING, 0); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR0, reg); - - rt2x00usb_register_read(rt2x00dev, TXRX_CSR1, ®); - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID0, 47); /* CCK Signal */ - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID0_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID1, 30); /* Rssi */ - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID1_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID2, 42); /* OFDM Rate */ - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID2_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID3, 30); /* Rssi */ - rt2x00_set_field32(®, TXRX_CSR1_BBP_ID3_VALID, 1); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR1, reg); - - /* - * CCK TXD BBP registers - */ - rt2x00usb_register_read(rt2x00dev, TXRX_CSR2, ®); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID0, 13); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID0_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID1, 12); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID1_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID2, 11); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID2_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID3, 10); - rt2x00_set_field32(®, TXRX_CSR2_BBP_ID3_VALID, 1); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR2, reg); - - /* - * OFDM TXD BBP registers - */ - rt2x00usb_register_read(rt2x00dev, TXRX_CSR3, ®); - rt2x00_set_field32(®, TXRX_CSR3_BBP_ID0, 7); - rt2x00_set_field32(®, TXRX_CSR3_BBP_ID0_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR3_BBP_ID1, 6); - rt2x00_set_field32(®, TXRX_CSR3_BBP_ID1_VALID, 1); - rt2x00_set_field32(®, TXRX_CSR3_BBP_ID2, 5); - rt2x00_set_field32(®, TXRX_CSR3_BBP_ID2_VALID, 1); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR3, reg); - - rt2x00usb_register_read(rt2x00dev, TXRX_CSR7, ®); - rt2x00_set_field32(®, TXRX_CSR7_ACK_CTS_6MBS, 59); - rt2x00_set_field32(®, TXRX_CSR7_ACK_CTS_9MBS, 53); - rt2x00_set_field32(®, TXRX_CSR7_ACK_CTS_12MBS, 49); - rt2x00_set_field32(®, TXRX_CSR7_ACK_CTS_18MBS, 46); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR7, reg); - - rt2x00usb_register_read(rt2x00dev, TXRX_CSR8, ®); - rt2x00_set_field32(®, TXRX_CSR8_ACK_CTS_24MBS, 44); - rt2x00_set_field32(®, TXRX_CSR8_ACK_CTS_36MBS, 42); - rt2x00_set_field32(®, TXRX_CSR8_ACK_CTS_48MBS, 42); - rt2x00_set_field32(®, TXRX_CSR8_ACK_CTS_54MBS, 42); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR8, reg); - - rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, ®); - rt2x00_set_field32(®, TXRX_CSR9_BEACON_INTERVAL, 0); - rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 0); - rt2x00_set_field32(®, TXRX_CSR9_TSF_SYNC, 0); - rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 0); - rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); - rt2x00_set_field32(®, TXRX_CSR9_TIMESTAMP_COMPENSATE, 0); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); - - rt2x00usb_register_write(rt2x00dev, TXRX_CSR15, 0x0000000f); - - rt2x00usb_register_read(rt2x00dev, MAC_CSR6, ®); - rt2x00_set_field32(®, MAC_CSR6_MAX_FRAME_UNIT, 0xfff); - rt2x00usb_register_write(rt2x00dev, MAC_CSR6, reg); - - rt2x00usb_register_write(rt2x00dev, MAC_CSR10, 0x00000718); - - if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE)) - return -EBUSY; - - rt2x00usb_register_write(rt2x00dev, MAC_CSR13, 0x00007f00); - - /* - * Invalidate all Shared Keys (SEC_CSR0), - * and clear the Shared key Cipher algorithms (SEC_CSR1 & SEC_CSR5) - */ - rt2x00usb_register_write(rt2x00dev, SEC_CSR0, 0x00000000); - rt2x00usb_register_write(rt2x00dev, SEC_CSR1, 0x00000000); - rt2x00usb_register_write(rt2x00dev, SEC_CSR5, 0x00000000); - - reg = 0x000023b0; - if (rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF2527)) - rt2x00_set_field32(®, PHY_CSR1_RF_RPI, 1); - rt2x00usb_register_write(rt2x00dev, PHY_CSR1, reg); - - rt2x00usb_register_write(rt2x00dev, PHY_CSR5, 0x00040a06); - rt2x00usb_register_write(rt2x00dev, PHY_CSR6, 0x00080606); - rt2x00usb_register_write(rt2x00dev, PHY_CSR7, 0x00000408); - - rt2x00usb_register_read(rt2x00dev, MAC_CSR9, ®); - rt2x00_set_field32(®, MAC_CSR9_CW_SELECT, 0); - rt2x00usb_register_write(rt2x00dev, MAC_CSR9, reg); - - /* - * Clear all beacons - * For the Beacon base registers we only need to clear - * the first byte since that byte contains the VALID and OWNER - * bits which (when set to 0) will invalidate the entire beacon. - */ - rt2x00usb_register_write(rt2x00dev, HW_BEACON_BASE0, 0); - rt2x00usb_register_write(rt2x00dev, HW_BEACON_BASE1, 0); - rt2x00usb_register_write(rt2x00dev, HW_BEACON_BASE2, 0); - rt2x00usb_register_write(rt2x00dev, HW_BEACON_BASE3, 0); - - /* - * We must clear the error counters. - * These registers are cleared on read, - * so we may pass a useless variable to store the value. - */ - rt2x00usb_register_read(rt2x00dev, STA_CSR0, ®); - rt2x00usb_register_read(rt2x00dev, STA_CSR1, ®); - rt2x00usb_register_read(rt2x00dev, STA_CSR2, ®); - - /* - * Reset MAC and BBP registers. - */ - rt2x00usb_register_read(rt2x00dev, MAC_CSR1, ®); - rt2x00_set_field32(®, MAC_CSR1_SOFT_RESET, 1); - rt2x00_set_field32(®, MAC_CSR1_BBP_RESET, 1); - rt2x00usb_register_write(rt2x00dev, MAC_CSR1, reg); - - rt2x00usb_register_read(rt2x00dev, MAC_CSR1, ®); - rt2x00_set_field32(®, MAC_CSR1_SOFT_RESET, 0); - rt2x00_set_field32(®, MAC_CSR1_BBP_RESET, 0); - rt2x00usb_register_write(rt2x00dev, MAC_CSR1, reg); - - rt2x00usb_register_read(rt2x00dev, MAC_CSR1, ®); - rt2x00_set_field32(®, MAC_CSR1_HOST_READY, 1); - rt2x00usb_register_write(rt2x00dev, MAC_CSR1, reg); - - return 0; -} - -static int rt73usb_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u8 value; - - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt73usb_bbp_read(rt2x00dev, 0, &value); - if ((value != 0xff) && (value != 0x00)) - return 0; - udelay(REGISTER_BUSY_DELAY); - } - - rt2x00_err(rt2x00dev, "BBP register access failed, aborting\n"); - return -EACCES; -} - -static int rt73usb_init_bbp(struct rt2x00_dev *rt2x00dev) -{ - unsigned int i; - u16 eeprom; - u8 reg_id; - u8 value; - - if (unlikely(rt73usb_wait_bbp_ready(rt2x00dev))) - return -EACCES; - - rt73usb_bbp_write(rt2x00dev, 3, 0x80); - rt73usb_bbp_write(rt2x00dev, 15, 0x30); - rt73usb_bbp_write(rt2x00dev, 21, 0xc8); - rt73usb_bbp_write(rt2x00dev, 22, 0x38); - rt73usb_bbp_write(rt2x00dev, 23, 0x06); - rt73usb_bbp_write(rt2x00dev, 24, 0xfe); - rt73usb_bbp_write(rt2x00dev, 25, 0x0a); - rt73usb_bbp_write(rt2x00dev, 26, 0x0d); - rt73usb_bbp_write(rt2x00dev, 32, 0x0b); - rt73usb_bbp_write(rt2x00dev, 34, 0x12); - rt73usb_bbp_write(rt2x00dev, 37, 0x07); - rt73usb_bbp_write(rt2x00dev, 39, 0xf8); - rt73usb_bbp_write(rt2x00dev, 41, 0x60); - rt73usb_bbp_write(rt2x00dev, 53, 0x10); - rt73usb_bbp_write(rt2x00dev, 54, 0x18); - rt73usb_bbp_write(rt2x00dev, 60, 0x10); - rt73usb_bbp_write(rt2x00dev, 61, 0x04); - rt73usb_bbp_write(rt2x00dev, 62, 0x04); - rt73usb_bbp_write(rt2x00dev, 75, 0xfe); - rt73usb_bbp_write(rt2x00dev, 86, 0xfe); - rt73usb_bbp_write(rt2x00dev, 88, 0xfe); - rt73usb_bbp_write(rt2x00dev, 90, 0x0f); - rt73usb_bbp_write(rt2x00dev, 99, 0x00); - rt73usb_bbp_write(rt2x00dev, 102, 0x16); - rt73usb_bbp_write(rt2x00dev, 107, 0x04); - - for (i = 0; i < EEPROM_BBP_SIZE; i++) { - rt2x00_eeprom_read(rt2x00dev, EEPROM_BBP_START + i, &eeprom); - - if (eeprom != 0xffff && eeprom != 0x0000) { - reg_id = rt2x00_get_field16(eeprom, EEPROM_BBP_REG_ID); - value = rt2x00_get_field16(eeprom, EEPROM_BBP_VALUE); - rt73usb_bbp_write(rt2x00dev, reg_id, value); - } - } - - return 0; -} - -/* - * Device state switch handlers. - */ -static int rt73usb_enable_radio(struct rt2x00_dev *rt2x00dev) -{ - /* - * Initialize all registers. - */ - if (unlikely(rt73usb_init_registers(rt2x00dev) || - rt73usb_init_bbp(rt2x00dev))) - return -EIO; - - return 0; -} - -static void rt73usb_disable_radio(struct rt2x00_dev *rt2x00dev) -{ - rt2x00usb_register_write(rt2x00dev, MAC_CSR10, 0x00001818); - - /* - * Disable synchronisation. - */ - rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, 0); - - rt2x00usb_disable_radio(rt2x00dev); -} - -static int rt73usb_set_state(struct rt2x00_dev *rt2x00dev, enum dev_state state) -{ - u32 reg, reg2; - unsigned int i; - char put_to_sleep; - - put_to_sleep = (state != STATE_AWAKE); - - rt2x00usb_register_read(rt2x00dev, MAC_CSR12, ®); - rt2x00_set_field32(®, MAC_CSR12_FORCE_WAKEUP, !put_to_sleep); - rt2x00_set_field32(®, MAC_CSR12_PUT_TO_SLEEP, put_to_sleep); - rt2x00usb_register_write(rt2x00dev, MAC_CSR12, reg); - - /* - * Device is not guaranteed to be in the requested state yet. - * We must wait until the register indicates that the - * device has entered the correct state. - */ - for (i = 0; i < REGISTER_BUSY_COUNT; i++) { - rt2x00usb_register_read(rt2x00dev, MAC_CSR12, ®2); - state = rt2x00_get_field32(reg2, MAC_CSR12_BBP_CURRENT_STATE); - if (state == !put_to_sleep) - return 0; - rt2x00usb_register_write(rt2x00dev, MAC_CSR12, reg); - msleep(10); - } - - return -EBUSY; -} - -static int rt73usb_set_device_state(struct rt2x00_dev *rt2x00dev, - enum dev_state state) -{ - int retval = 0; - - switch (state) { - case STATE_RADIO_ON: - retval = rt73usb_enable_radio(rt2x00dev); - break; - case STATE_RADIO_OFF: - rt73usb_disable_radio(rt2x00dev); - break; - case STATE_RADIO_IRQ_ON: - case STATE_RADIO_IRQ_OFF: - /* No support, but no error either */ - break; - case STATE_DEEP_SLEEP: - case STATE_SLEEP: - case STATE_STANDBY: - case STATE_AWAKE: - retval = rt73usb_set_state(rt2x00dev, state); - break; - default: - retval = -ENOTSUPP; - break; - } - - if (unlikely(retval)) - rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", - state, retval); - - return retval; -} - -/* - * TX descriptor initialization - */ -static void rt73usb_write_tx_desc(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - __le32 *txd = (__le32 *) entry->skb->data; - u32 word; - - /* - * Start writing the descriptor words. - */ - rt2x00_desc_read(txd, 0, &word); - rt2x00_set_field32(&word, TXD_W0_BURST, - test_bit(ENTRY_TXD_BURST, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_VALID, 1); - rt2x00_set_field32(&word, TXD_W0_MORE_FRAG, - test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_ACK, - test_bit(ENTRY_TXD_ACK, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_TIMESTAMP, - test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_OFDM, - (txdesc->rate_mode == RATE_MODE_OFDM)); - rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->u.plcp.ifs); - rt2x00_set_field32(&word, TXD_W0_RETRY_MODE, - test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_TKIP_MIC, - test_bit(ENTRY_TXD_ENCRYPT_MMIC, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_KEY_TABLE, - test_bit(ENTRY_TXD_ENCRYPT_PAIRWISE, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_KEY_INDEX, txdesc->key_idx); - rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, txdesc->length); - rt2x00_set_field32(&word, TXD_W0_BURST2, - test_bit(ENTRY_TXD_BURST, &txdesc->flags)); - rt2x00_set_field32(&word, TXD_W0_CIPHER_ALG, txdesc->cipher); - rt2x00_desc_write(txd, 0, word); - - rt2x00_desc_read(txd, 1, &word); - rt2x00_set_field32(&word, TXD_W1_HOST_Q_ID, entry->queue->qid); - rt2x00_set_field32(&word, TXD_W1_AIFSN, entry->queue->aifs); - rt2x00_set_field32(&word, TXD_W1_CWMIN, entry->queue->cw_min); - rt2x00_set_field32(&word, TXD_W1_CWMAX, entry->queue->cw_max); - rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, txdesc->iv_offset); - rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE, - test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags)); - rt2x00_desc_write(txd, 1, word); - - rt2x00_desc_read(txd, 2, &word); - rt2x00_set_field32(&word, TXD_W2_PLCP_SIGNAL, txdesc->u.plcp.signal); - rt2x00_set_field32(&word, TXD_W2_PLCP_SERVICE, txdesc->u.plcp.service); - rt2x00_set_field32(&word, TXD_W2_PLCP_LENGTH_LOW, - txdesc->u.plcp.length_low); - rt2x00_set_field32(&word, TXD_W2_PLCP_LENGTH_HIGH, - txdesc->u.plcp.length_high); - rt2x00_desc_write(txd, 2, word); - - if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags)) { - _rt2x00_desc_write(txd, 3, skbdesc->iv[0]); - _rt2x00_desc_write(txd, 4, skbdesc->iv[1]); - } - - rt2x00_desc_read(txd, 5, &word); - rt2x00_set_field32(&word, TXD_W5_TX_POWER, - TXPOWER_TO_DEV(entry->queue->rt2x00dev->tx_power)); - rt2x00_set_field32(&word, TXD_W5_WAITING_DMA_DONE_INT, 1); - rt2x00_desc_write(txd, 5, word); - - /* - * Register descriptor details in skb frame descriptor. - */ - skbdesc->flags |= SKBDESC_DESC_IN_SKB; - skbdesc->desc = txd; - skbdesc->desc_len = TXD_DESC_SIZE; -} - -/* - * TX data initialization - */ -static void rt73usb_write_beacon(struct queue_entry *entry, - struct txentry_desc *txdesc) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - unsigned int beacon_base; - unsigned int padding_len; - u32 orig_reg, reg; - - /* - * Disable beaconing while we are reloading the beacon data, - * otherwise we might be sending out invalid data. - */ - rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, ®); - orig_reg = reg; - rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); - - /* - * Add space for the descriptor in front of the skb. - */ - skb_push(entry->skb, TXD_DESC_SIZE); - memset(entry->skb->data, 0, TXD_DESC_SIZE); - - /* - * Write the TX descriptor for the beacon. - */ - rt73usb_write_tx_desc(entry, txdesc); - - /* - * Dump beacon to userspace through debugfs. - */ - rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb); - - /* - * Write entire beacon with descriptor and padding to register. - */ - padding_len = roundup(entry->skb->len, 4) - entry->skb->len; - if (padding_len && skb_pad(entry->skb, padding_len)) { - rt2x00_err(rt2x00dev, "Failure padding beacon, aborting\n"); - /* skb freed by skb_pad() on failure */ - entry->skb = NULL; - rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, orig_reg); - return; - } - - beacon_base = HW_BEACON_OFFSET(entry->entry_idx); - rt2x00usb_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data, - entry->skb->len + padding_len); - - /* - * Enable beaconing again. - * - * For Wi-Fi faily generated beacons between participating stations. - * Set TBTT phase adaptive adjustment step to 8us (default 16us) - */ - rt2x00usb_register_write(rt2x00dev, TXRX_CSR10, 0x00001008); - - rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); - - /* - * Clean up the beacon skb. - */ - dev_kfree_skb(entry->skb); - entry->skb = NULL; -} - -static void rt73usb_clear_beacon(struct queue_entry *entry) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - unsigned int beacon_base; - u32 reg; - - /* - * Disable beaconing while we are reloading the beacon data, - * otherwise we might be sending out invalid data. - */ - rt2x00usb_register_read(rt2x00dev, TXRX_CSR9, ®); - rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); - - /* - * Clear beacon. - */ - beacon_base = HW_BEACON_OFFSET(entry->entry_idx); - rt2x00usb_register_write(rt2x00dev, beacon_base, 0); - - /* - * Enable beaconing again. - */ - rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 1); - rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg); -} - -static int rt73usb_get_tx_data_len(struct queue_entry *entry) -{ - int length; - - /* - * The length _must_ be a multiple of 4, - * but it must _not_ be a multiple of the USB packet size. - */ - length = roundup(entry->skb->len, 4); - length += (4 * !(length % entry->queue->usb_maxpacket)); - - return length; -} - -/* - * RX control handlers - */ -static int rt73usb_agc_to_rssi(struct rt2x00_dev *rt2x00dev, int rxd_w1) -{ - u8 offset = rt2x00dev->lna_gain; - u8 lna; - - lna = rt2x00_get_field32(rxd_w1, RXD_W1_RSSI_LNA); - switch (lna) { - case 3: - offset += 90; - break; - case 2: - offset += 74; - break; - case 1: - offset += 64; - break; - default: - return 0; - } - - if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { - if (test_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags)) { - if (lna == 3 || lna == 2) - offset += 10; - } else { - if (lna == 3) - offset += 6; - else if (lna == 2) - offset += 8; - } - } - - return rt2x00_get_field32(rxd_w1, RXD_W1_RSSI_AGC) * 2 - offset; -} - -static void rt73usb_fill_rxdone(struct queue_entry *entry, - struct rxdone_entry_desc *rxdesc) -{ - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); - __le32 *rxd = (__le32 *)entry->skb->data; - u32 word0; - u32 word1; - - /* - * Copy descriptor to the skbdesc->desc buffer, making it safe from moving of - * frame data in rt2x00usb. - */ - memcpy(skbdesc->desc, rxd, skbdesc->desc_len); - rxd = (__le32 *)skbdesc->desc; - - /* - * It is now safe to read the descriptor on all architectures. - */ - rt2x00_desc_read(rxd, 0, &word0); - rt2x00_desc_read(rxd, 1, &word1); - - if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) - rxdesc->flags |= RX_FLAG_FAILED_FCS_CRC; - - rxdesc->cipher = rt2x00_get_field32(word0, RXD_W0_CIPHER_ALG); - rxdesc->cipher_status = rt2x00_get_field32(word0, RXD_W0_CIPHER_ERROR); - - if (rxdesc->cipher != CIPHER_NONE) { - _rt2x00_desc_read(rxd, 2, &rxdesc->iv[0]); - _rt2x00_desc_read(rxd, 3, &rxdesc->iv[1]); - rxdesc->dev_flags |= RXDONE_CRYPTO_IV; - - _rt2x00_desc_read(rxd, 4, &rxdesc->icv); - rxdesc->dev_flags |= RXDONE_CRYPTO_ICV; - - /* - * Hardware has stripped IV/EIV data from 802.11 frame during - * decryption. It has provided the data separately but rt2x00lib - * should decide if it should be reinserted. - */ - rxdesc->flags |= RX_FLAG_IV_STRIPPED; - - /* - * The hardware has already checked the Michael Mic and has - * stripped it from the frame. Signal this to mac80211. - */ - rxdesc->flags |= RX_FLAG_MMIC_STRIPPED; - - if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) - rxdesc->flags |= RX_FLAG_DECRYPTED; - else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) - rxdesc->flags |= RX_FLAG_MMIC_ERROR; - } - - /* - * Obtain the status about this packet. - * When frame was received with an OFDM bitrate, - * the signal is the PLCP value. If it was received with - * a CCK bitrate the signal is the rate in 100kbit/s. - */ - rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL); - rxdesc->rssi = rt73usb_agc_to_rssi(rt2x00dev, word1); - rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); - - if (rt2x00_get_field32(word0, RXD_W0_OFDM)) - rxdesc->dev_flags |= RXDONE_SIGNAL_PLCP; - else - rxdesc->dev_flags |= RXDONE_SIGNAL_BITRATE; - if (rt2x00_get_field32(word0, RXD_W0_MY_BSS)) - rxdesc->dev_flags |= RXDONE_MY_BSS; - - /* - * Set skb pointers, and update frame information. - */ - skb_pull(entry->skb, entry->queue->desc_size); - skb_trim(entry->skb, rxdesc->size); -} - -/* - * Device probe functions. - */ -static int rt73usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) -{ - u16 word; - u8 *mac; - s8 value; - - rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, EEPROM_SIZE); - - /* - * Start validation of the data that has been read. - */ - mac = rt2x00_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0); - if (!is_valid_ether_addr(mac)) { - eth_random_addr(mac); - rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", mac); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_ANTENNA_NUM, 2); - rt2x00_set_field16(&word, EEPROM_ANTENNA_TX_DEFAULT, - ANTENNA_B); - rt2x00_set_field16(&word, EEPROM_ANTENNA_RX_DEFAULT, - ANTENNA_B); - rt2x00_set_field16(&word, EEPROM_ANTENNA_FRAME_TYPE, 0); - rt2x00_set_field16(&word, EEPROM_ANTENNA_DYN_TXAGC, 0); - rt2x00_set_field16(&word, EEPROM_ANTENNA_HARDWARE_RADIO, 0); - rt2x00_set_field16(&word, EEPROM_ANTENNA_RF_TYPE, RF5226); - rt2x00_eeprom_write(rt2x00dev, EEPROM_ANTENNA, word); - rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC, word); - rt2x00_eeprom_dbg(rt2x00dev, "NIC: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_LED_POLARITY_RDY_G, 0); - rt2x00_set_field16(&word, EEPROM_LED_POLARITY_RDY_A, 0); - rt2x00_set_field16(&word, EEPROM_LED_POLARITY_ACT, 0); - rt2x00_set_field16(&word, EEPROM_LED_POLARITY_GPIO_0, 0); - rt2x00_set_field16(&word, EEPROM_LED_POLARITY_GPIO_1, 0); - rt2x00_set_field16(&word, EEPROM_LED_POLARITY_GPIO_2, 0); - rt2x00_set_field16(&word, EEPROM_LED_POLARITY_GPIO_3, 0); - rt2x00_set_field16(&word, EEPROM_LED_POLARITY_GPIO_4, 0); - rt2x00_set_field16(&word, EEPROM_LED_LED_MODE, - LED_MODE_DEFAULT); - rt2x00_eeprom_write(rt2x00dev, EEPROM_LED, word); - rt2x00_eeprom_dbg(rt2x00dev, "Led: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_FREQ_OFFSET, 0); - rt2x00_set_field16(&word, EEPROM_FREQ_SEQ, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_FREQ, word); - rt2x00_eeprom_dbg(rt2x00dev, "Freq: 0x%04x\n", word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_BG, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_BG_1, 0); - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_BG_2, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_OFFSET_BG, word); - rt2x00_eeprom_dbg(rt2x00dev, "RSSI OFFSET BG: 0x%04x\n", word); - } else { - value = rt2x00_get_field16(word, EEPROM_RSSI_OFFSET_BG_1); - if (value < -10 || value > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_BG_1, 0); - value = rt2x00_get_field16(word, EEPROM_RSSI_OFFSET_BG_2); - if (value < -10 || value > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_BG_2, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_OFFSET_BG, word); - } - - rt2x00_eeprom_read(rt2x00dev, EEPROM_RSSI_OFFSET_A, &word); - if (word == 0xffff) { - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_A_1, 0); - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_A_2, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_OFFSET_A, word); - rt2x00_eeprom_dbg(rt2x00dev, "RSSI OFFSET A: 0x%04x\n", word); - } else { - value = rt2x00_get_field16(word, EEPROM_RSSI_OFFSET_A_1); - if (value < -10 || value > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_A_1, 0); - value = rt2x00_get_field16(word, EEPROM_RSSI_OFFSET_A_2); - if (value < -10 || value > 10) - rt2x00_set_field16(&word, EEPROM_RSSI_OFFSET_A_2, 0); - rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_OFFSET_A, word); - } - - return 0; -} - -static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev) -{ - u32 reg; - u16 value; - u16 eeprom; - - /* - * Read EEPROM word for configuration. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_ANTENNA, &eeprom); - - /* - * Identify RF chipset. - */ - value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RF_TYPE); - rt2x00usb_register_read(rt2x00dev, MAC_CSR0, ®); - rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET), - value, rt2x00_get_field32(reg, MAC_CSR0_REVISION)); - - if (!rt2x00_rt(rt2x00dev, RT2573) || (rt2x00_rev(rt2x00dev) == 0)) { - rt2x00_err(rt2x00dev, "Invalid RT chipset detected\n"); - return -ENODEV; - } - - if (!rt2x00_rf(rt2x00dev, RF5226) && - !rt2x00_rf(rt2x00dev, RF2528) && - !rt2x00_rf(rt2x00dev, RF5225) && - !rt2x00_rf(rt2x00dev, RF2527)) { - rt2x00_err(rt2x00dev, "Invalid RF chipset detected\n"); - return -ENODEV; - } - - /* - * Identify default antenna configuration. - */ - rt2x00dev->default_ant.tx = - rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TX_DEFAULT); - rt2x00dev->default_ant.rx = - rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_DEFAULT); - - /* - * Read the Frame type. - */ - if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_FRAME_TYPE)) - __set_bit(CAPABILITY_FRAME_TYPE, &rt2x00dev->cap_flags); - - /* - * Detect if this device has an hardware controlled radio. - */ - if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) - __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); - - /* - * Read frequency offset. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_FREQ, &eeprom); - rt2x00dev->freq_offset = rt2x00_get_field16(eeprom, EEPROM_FREQ_OFFSET); - - /* - * Read external LNA informations. - */ - rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); - - if (rt2x00_get_field16(eeprom, EEPROM_NIC_EXTERNAL_LNA)) { - __set_bit(CAPABILITY_EXTERNAL_LNA_A, &rt2x00dev->cap_flags); - __set_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags); - } - - /* - * Store led settings, for correct led behaviour. - */ -#ifdef CONFIG_RT2X00_LIB_LEDS - rt2x00_eeprom_read(rt2x00dev, EEPROM_LED, &eeprom); - - rt73usb_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO); - rt73usb_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC); - if (value == LED_MODE_SIGNAL_STRENGTH) - rt73usb_init_led(rt2x00dev, &rt2x00dev->led_qual, - LED_TYPE_QUALITY); - - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_LED_MODE, value); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_GPIO_0, - rt2x00_get_field16(eeprom, - EEPROM_LED_POLARITY_GPIO_0)); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_GPIO_1, - rt2x00_get_field16(eeprom, - EEPROM_LED_POLARITY_GPIO_1)); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_GPIO_2, - rt2x00_get_field16(eeprom, - EEPROM_LED_POLARITY_GPIO_2)); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_GPIO_3, - rt2x00_get_field16(eeprom, - EEPROM_LED_POLARITY_GPIO_3)); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_GPIO_4, - rt2x00_get_field16(eeprom, - EEPROM_LED_POLARITY_GPIO_4)); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_ACT, - rt2x00_get_field16(eeprom, EEPROM_LED_POLARITY_ACT)); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_READY_BG, - rt2x00_get_field16(eeprom, - EEPROM_LED_POLARITY_RDY_G)); - rt2x00_set_field16(&rt2x00dev->led_mcu_reg, MCU_LEDCS_POLARITY_READY_A, - rt2x00_get_field16(eeprom, - EEPROM_LED_POLARITY_RDY_A)); -#endif /* CONFIG_RT2X00_LIB_LEDS */ - - return 0; -} - -/* - * RF value list for RF2528 - * Supports: 2.4 GHz - */ -static const struct rf_channel rf_vals_bg_2528[] = { - { 1, 0x00002c0c, 0x00000786, 0x00068255, 0x000fea0b }, - { 2, 0x00002c0c, 0x00000786, 0x00068255, 0x000fea1f }, - { 3, 0x00002c0c, 0x0000078a, 0x00068255, 0x000fea0b }, - { 4, 0x00002c0c, 0x0000078a, 0x00068255, 0x000fea1f }, - { 5, 0x00002c0c, 0x0000078e, 0x00068255, 0x000fea0b }, - { 6, 0x00002c0c, 0x0000078e, 0x00068255, 0x000fea1f }, - { 7, 0x00002c0c, 0x00000792, 0x00068255, 0x000fea0b }, - { 8, 0x00002c0c, 0x00000792, 0x00068255, 0x000fea1f }, - { 9, 0x00002c0c, 0x00000796, 0x00068255, 0x000fea0b }, - { 10, 0x00002c0c, 0x00000796, 0x00068255, 0x000fea1f }, - { 11, 0x00002c0c, 0x0000079a, 0x00068255, 0x000fea0b }, - { 12, 0x00002c0c, 0x0000079a, 0x00068255, 0x000fea1f }, - { 13, 0x00002c0c, 0x0000079e, 0x00068255, 0x000fea0b }, - { 14, 0x00002c0c, 0x000007a2, 0x00068255, 0x000fea13 }, -}; - -/* - * RF value list for RF5226 - * Supports: 2.4 GHz & 5.2 GHz - */ -static const struct rf_channel rf_vals_5226[] = { - { 1, 0x00002c0c, 0x00000786, 0x00068255, 0x000fea0b }, - { 2, 0x00002c0c, 0x00000786, 0x00068255, 0x000fea1f }, - { 3, 0x00002c0c, 0x0000078a, 0x00068255, 0x000fea0b }, - { 4, 0x00002c0c, 0x0000078a, 0x00068255, 0x000fea1f }, - { 5, 0x00002c0c, 0x0000078e, 0x00068255, 0x000fea0b }, - { 6, 0x00002c0c, 0x0000078e, 0x00068255, 0x000fea1f }, - { 7, 0x00002c0c, 0x00000792, 0x00068255, 0x000fea0b }, - { 8, 0x00002c0c, 0x00000792, 0x00068255, 0x000fea1f }, - { 9, 0x00002c0c, 0x00000796, 0x00068255, 0x000fea0b }, - { 10, 0x00002c0c, 0x00000796, 0x00068255, 0x000fea1f }, - { 11, 0x00002c0c, 0x0000079a, 0x00068255, 0x000fea0b }, - { 12, 0x00002c0c, 0x0000079a, 0x00068255, 0x000fea1f }, - { 13, 0x00002c0c, 0x0000079e, 0x00068255, 0x000fea0b }, - { 14, 0x00002c0c, 0x000007a2, 0x00068255, 0x000fea13 }, - - /* 802.11 UNI / HyperLan 2 */ - { 36, 0x00002c0c, 0x0000099a, 0x00098255, 0x000fea23 }, - { 40, 0x00002c0c, 0x000009a2, 0x00098255, 0x000fea03 }, - { 44, 0x00002c0c, 0x000009a6, 0x00098255, 0x000fea0b }, - { 48, 0x00002c0c, 0x000009aa, 0x00098255, 0x000fea13 }, - { 52, 0x00002c0c, 0x000009ae, 0x00098255, 0x000fea1b }, - { 56, 0x00002c0c, 0x000009b2, 0x00098255, 0x000fea23 }, - { 60, 0x00002c0c, 0x000009ba, 0x00098255, 0x000fea03 }, - { 64, 0x00002c0c, 0x000009be, 0x00098255, 0x000fea0b }, - - /* 802.11 HyperLan 2 */ - { 100, 0x00002c0c, 0x00000a2a, 0x000b8255, 0x000fea03 }, - { 104, 0x00002c0c, 0x00000a2e, 0x000b8255, 0x000fea0b }, - { 108, 0x00002c0c, 0x00000a32, 0x000b8255, 0x000fea13 }, - { 112, 0x00002c0c, 0x00000a36, 0x000b8255, 0x000fea1b }, - { 116, 0x00002c0c, 0x00000a3a, 0x000b8255, 0x000fea23 }, - { 120, 0x00002c0c, 0x00000a82, 0x000b8255, 0x000fea03 }, - { 124, 0x00002c0c, 0x00000a86, 0x000b8255, 0x000fea0b }, - { 128, 0x00002c0c, 0x00000a8a, 0x000b8255, 0x000fea13 }, - { 132, 0x00002c0c, 0x00000a8e, 0x000b8255, 0x000fea1b }, - { 136, 0x00002c0c, 0x00000a92, 0x000b8255, 0x000fea23 }, - - /* 802.11 UNII */ - { 140, 0x00002c0c, 0x00000a9a, 0x000b8255, 0x000fea03 }, - { 149, 0x00002c0c, 0x00000aa2, 0x000b8255, 0x000fea1f }, - { 153, 0x00002c0c, 0x00000aa6, 0x000b8255, 0x000fea27 }, - { 157, 0x00002c0c, 0x00000aae, 0x000b8255, 0x000fea07 }, - { 161, 0x00002c0c, 0x00000ab2, 0x000b8255, 0x000fea0f }, - { 165, 0x00002c0c, 0x00000ab6, 0x000b8255, 0x000fea17 }, - - /* MMAC(Japan)J52 ch 34,38,42,46 */ - { 34, 0x00002c0c, 0x0008099a, 0x000da255, 0x000d3a0b }, - { 38, 0x00002c0c, 0x0008099e, 0x000da255, 0x000d3a13 }, - { 42, 0x00002c0c, 0x000809a2, 0x000da255, 0x000d3a1b }, - { 46, 0x00002c0c, 0x000809a6, 0x000da255, 0x000d3a23 }, -}; - -/* - * RF value list for RF5225 & RF2527 - * Supports: 2.4 GHz & 5.2 GHz - */ -static const struct rf_channel rf_vals_5225_2527[] = { - { 1, 0x00002ccc, 0x00004786, 0x00068455, 0x000ffa0b }, - { 2, 0x00002ccc, 0x00004786, 0x00068455, 0x000ffa1f }, - { 3, 0x00002ccc, 0x0000478a, 0x00068455, 0x000ffa0b }, - { 4, 0x00002ccc, 0x0000478a, 0x00068455, 0x000ffa1f }, - { 5, 0x00002ccc, 0x0000478e, 0x00068455, 0x000ffa0b }, - { 6, 0x00002ccc, 0x0000478e, 0x00068455, 0x000ffa1f }, - { 7, 0x00002ccc, 0x00004792, 0x00068455, 0x000ffa0b }, - { 8, 0x00002ccc, 0x00004792, 0x00068455, 0x000ffa1f }, - { 9, 0x00002ccc, 0x00004796, 0x00068455, 0x000ffa0b }, - { 10, 0x00002ccc, 0x00004796, 0x00068455, 0x000ffa1f }, - { 11, 0x00002ccc, 0x0000479a, 0x00068455, 0x000ffa0b }, - { 12, 0x00002ccc, 0x0000479a, 0x00068455, 0x000ffa1f }, - { 13, 0x00002ccc, 0x0000479e, 0x00068455, 0x000ffa0b }, - { 14, 0x00002ccc, 0x000047a2, 0x00068455, 0x000ffa13 }, - - /* 802.11 UNI / HyperLan 2 */ - { 36, 0x00002ccc, 0x0000499a, 0x0009be55, 0x000ffa23 }, - { 40, 0x00002ccc, 0x000049a2, 0x0009be55, 0x000ffa03 }, - { 44, 0x00002ccc, 0x000049a6, 0x0009be55, 0x000ffa0b }, - { 48, 0x00002ccc, 0x000049aa, 0x0009be55, 0x000ffa13 }, - { 52, 0x00002ccc, 0x000049ae, 0x0009ae55, 0x000ffa1b }, - { 56, 0x00002ccc, 0x000049b2, 0x0009ae55, 0x000ffa23 }, - { 60, 0x00002ccc, 0x000049ba, 0x0009ae55, 0x000ffa03 }, - { 64, 0x00002ccc, 0x000049be, 0x0009ae55, 0x000ffa0b }, - - /* 802.11 HyperLan 2 */ - { 100, 0x00002ccc, 0x00004a2a, 0x000bae55, 0x000ffa03 }, - { 104, 0x00002ccc, 0x00004a2e, 0x000bae55, 0x000ffa0b }, - { 108, 0x00002ccc, 0x00004a32, 0x000bae55, 0x000ffa13 }, - { 112, 0x00002ccc, 0x00004a36, 0x000bae55, 0x000ffa1b }, - { 116, 0x00002ccc, 0x00004a3a, 0x000bbe55, 0x000ffa23 }, - { 120, 0x00002ccc, 0x00004a82, 0x000bbe55, 0x000ffa03 }, - { 124, 0x00002ccc, 0x00004a86, 0x000bbe55, 0x000ffa0b }, - { 128, 0x00002ccc, 0x00004a8a, 0x000bbe55, 0x000ffa13 }, - { 132, 0x00002ccc, 0x00004a8e, 0x000bbe55, 0x000ffa1b }, - { 136, 0x00002ccc, 0x00004a92, 0x000bbe55, 0x000ffa23 }, - - /* 802.11 UNII */ - { 140, 0x00002ccc, 0x00004a9a, 0x000bbe55, 0x000ffa03 }, - { 149, 0x00002ccc, 0x00004aa2, 0x000bbe55, 0x000ffa1f }, - { 153, 0x00002ccc, 0x00004aa6, 0x000bbe55, 0x000ffa27 }, - { 157, 0x00002ccc, 0x00004aae, 0x000bbe55, 0x000ffa07 }, - { 161, 0x00002ccc, 0x00004ab2, 0x000bbe55, 0x000ffa0f }, - { 165, 0x00002ccc, 0x00004ab6, 0x000bbe55, 0x000ffa17 }, - - /* MMAC(Japan)J52 ch 34,38,42,46 */ - { 34, 0x00002ccc, 0x0000499a, 0x0009be55, 0x000ffa0b }, - { 38, 0x00002ccc, 0x0000499e, 0x0009be55, 0x000ffa13 }, - { 42, 0x00002ccc, 0x000049a2, 0x0009be55, 0x000ffa1b }, - { 46, 0x00002ccc, 0x000049a6, 0x0009be55, 0x000ffa23 }, -}; - - -static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) -{ - struct hw_mode_spec *spec = &rt2x00dev->spec; - struct channel_info *info; - char *tx_power; - unsigned int i; - - /* - * Initialize all hw fields. - * - * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING unless we are - * capable of sending the buffered frames out after the DTIM - * transmission using rt2x00lib_beacondone. This will send out - * multicast and broadcast traffic immediately instead of buffering it - * infinitly and thus dropping it after some time. - */ - rt2x00dev->hw->flags = - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_PS_NULLFUNC_STACK; - - SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev); - SET_IEEE80211_PERM_ADDR(rt2x00dev->hw, - rt2x00_eeprom_addr(rt2x00dev, - EEPROM_MAC_ADDR_0)); - - /* - * Initialize hw_mode information. - */ - spec->supported_bands = SUPPORT_BAND_2GHZ; - spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; - - if (rt2x00_rf(rt2x00dev, RF2528)) { - spec->num_channels = ARRAY_SIZE(rf_vals_bg_2528); - spec->channels = rf_vals_bg_2528; - } else if (rt2x00_rf(rt2x00dev, RF5226)) { - spec->supported_bands |= SUPPORT_BAND_5GHZ; - spec->num_channels = ARRAY_SIZE(rf_vals_5226); - spec->channels = rf_vals_5226; - } else if (rt2x00_rf(rt2x00dev, RF2527)) { - spec->num_channels = 14; - spec->channels = rf_vals_5225_2527; - } else if (rt2x00_rf(rt2x00dev, RF5225)) { - spec->supported_bands |= SUPPORT_BAND_5GHZ; - spec->num_channels = ARRAY_SIZE(rf_vals_5225_2527); - spec->channels = rf_vals_5225_2527; - } - - /* - * Create channel information array - */ - info = kcalloc(spec->num_channels, sizeof(*info), GFP_KERNEL); - if (!info) - return -ENOMEM; - - spec->channels_info = info; - - tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); - for (i = 0; i < 14; i++) { - info[i].max_power = MAX_TXPOWER; - info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); - } - - if (spec->num_channels > 14) { - tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); - for (i = 14; i < spec->num_channels; i++) { - info[i].max_power = MAX_TXPOWER; - info[i].default_power1 = - TXPOWER_FROM_DEV(tx_power[i - 14]); - } - } - - return 0; -} - -static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev) -{ - int retval; - u32 reg; - - /* - * Allocate eeprom data. - */ - retval = rt73usb_validate_eeprom(rt2x00dev); - if (retval) - return retval; - - retval = rt73usb_init_eeprom(rt2x00dev); - if (retval) - return retval; - - /* - * Enable rfkill polling by setting GPIO direction of the - * rfkill switch GPIO pin correctly. - */ - rt2x00usb_register_read(rt2x00dev, MAC_CSR13, ®); - rt2x00_set_field32(®, MAC_CSR13_DIR7, 0); - rt2x00usb_register_write(rt2x00dev, MAC_CSR13, reg); - - /* - * Initialize hw specifications. - */ - retval = rt73usb_probe_hw_mode(rt2x00dev); - if (retval) - return retval; - - /* - * This device has multiple filters for control frames, - * but has no a separate filter for PS Poll frames. - */ - __set_bit(CAPABILITY_CONTROL_FILTERS, &rt2x00dev->cap_flags); - - /* - * This device requires firmware. - */ - __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags); - if (!modparam_nohwcrypt) - __set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags); - __set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags); - __set_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags); - - /* - * Set the rssi offset. - */ - rt2x00dev->rssi_offset = DEFAULT_RSSI_OFFSET; - - return 0; -} - -/* - * IEEE80211 stack callback functions. - */ -static int rt73usb_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue_idx, - const struct ieee80211_tx_queue_params *params) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - struct data_queue *queue; - struct rt2x00_field32 field; - int retval; - u32 reg; - u32 offset; - - /* - * First pass the configuration through rt2x00lib, that will - * update the queue settings and validate the input. After that - * we are free to update the registers based on the value - * in the queue parameter. - */ - retval = rt2x00mac_conf_tx(hw, vif, queue_idx, params); - if (retval) - return retval; - - /* - * We only need to perform additional register initialization - * for WMM queues/ - */ - if (queue_idx >= 4) - return 0; - - queue = rt2x00queue_get_tx_queue(rt2x00dev, queue_idx); - - /* Update WMM TXOP register */ - offset = AC_TXOP_CSR0 + (sizeof(u32) * (!!(queue_idx & 2))); - field.bit_offset = (queue_idx & 1) * 16; - field.bit_mask = 0xffff << field.bit_offset; - - rt2x00usb_register_read(rt2x00dev, offset, ®); - rt2x00_set_field32(®, field, queue->txop); - rt2x00usb_register_write(rt2x00dev, offset, reg); - - /* Update WMM registers */ - field.bit_offset = queue_idx * 4; - field.bit_mask = 0xf << field.bit_offset; - - rt2x00usb_register_read(rt2x00dev, AIFSN_CSR, ®); - rt2x00_set_field32(®, field, queue->aifs); - rt2x00usb_register_write(rt2x00dev, AIFSN_CSR, reg); - - rt2x00usb_register_read(rt2x00dev, CWMIN_CSR, ®); - rt2x00_set_field32(®, field, queue->cw_min); - rt2x00usb_register_write(rt2x00dev, CWMIN_CSR, reg); - - rt2x00usb_register_read(rt2x00dev, CWMAX_CSR, ®); - rt2x00_set_field32(®, field, queue->cw_max); - rt2x00usb_register_write(rt2x00dev, CWMAX_CSR, reg); - - return 0; -} - -static u64 rt73usb_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct rt2x00_dev *rt2x00dev = hw->priv; - u64 tsf; - u32 reg; - - rt2x00usb_register_read(rt2x00dev, TXRX_CSR13, ®); - tsf = (u64) rt2x00_get_field32(reg, TXRX_CSR13_HIGH_TSFTIMER) << 32; - rt2x00usb_register_read(rt2x00dev, TXRX_CSR12, ®); - tsf |= rt2x00_get_field32(reg, TXRX_CSR12_LOW_TSFTIMER); - - return tsf; -} - -static const struct ieee80211_ops rt73usb_mac80211_ops = { - .tx = rt2x00mac_tx, - .start = rt2x00mac_start, - .stop = rt2x00mac_stop, - .add_interface = rt2x00mac_add_interface, - .remove_interface = rt2x00mac_remove_interface, - .config = rt2x00mac_config, - .configure_filter = rt2x00mac_configure_filter, - .set_tim = rt2x00mac_set_tim, - .set_key = rt2x00mac_set_key, - .sw_scan_start = rt2x00mac_sw_scan_start, - .sw_scan_complete = rt2x00mac_sw_scan_complete, - .get_stats = rt2x00mac_get_stats, - .bss_info_changed = rt2x00mac_bss_info_changed, - .conf_tx = rt73usb_conf_tx, - .get_tsf = rt73usb_get_tsf, - .rfkill_poll = rt2x00mac_rfkill_poll, - .flush = rt2x00mac_flush, - .set_antenna = rt2x00mac_set_antenna, - .get_antenna = rt2x00mac_get_antenna, - .get_ringparam = rt2x00mac_get_ringparam, - .tx_frames_pending = rt2x00mac_tx_frames_pending, -}; - -static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { - .probe_hw = rt73usb_probe_hw, - .get_firmware_name = rt73usb_get_firmware_name, - .check_firmware = rt73usb_check_firmware, - .load_firmware = rt73usb_load_firmware, - .initialize = rt2x00usb_initialize, - .uninitialize = rt2x00usb_uninitialize, - .clear_entry = rt2x00usb_clear_entry, - .set_device_state = rt73usb_set_device_state, - .rfkill_poll = rt73usb_rfkill_poll, - .link_stats = rt73usb_link_stats, - .reset_tuner = rt73usb_reset_tuner, - .link_tuner = rt73usb_link_tuner, - .watchdog = rt2x00usb_watchdog, - .start_queue = rt73usb_start_queue, - .kick_queue = rt2x00usb_kick_queue, - .stop_queue = rt73usb_stop_queue, - .flush_queue = rt2x00usb_flush_queue, - .write_tx_desc = rt73usb_write_tx_desc, - .write_beacon = rt73usb_write_beacon, - .clear_beacon = rt73usb_clear_beacon, - .get_tx_data_len = rt73usb_get_tx_data_len, - .fill_rxdone = rt73usb_fill_rxdone, - .config_shared_key = rt73usb_config_shared_key, - .config_pairwise_key = rt73usb_config_pairwise_key, - .config_filter = rt73usb_config_filter, - .config_intf = rt73usb_config_intf, - .config_erp = rt73usb_config_erp, - .config_ant = rt73usb_config_ant, - .config = rt73usb_config, -}; - -static const struct data_queue_desc rt73usb_queue_rx = { - .entry_num = 32, - .data_size = DATA_FRAME_SIZE, - .desc_size = RXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_usb), -}; - -static const struct data_queue_desc rt73usb_queue_tx = { - .entry_num = 32, - .data_size = DATA_FRAME_SIZE, - .desc_size = TXD_DESC_SIZE, - .priv_size = sizeof(struct queue_entry_priv_usb), -}; - -static const struct data_queue_desc rt73usb_queue_bcn = { - .entry_num = 4, - .data_size = MGMT_FRAME_SIZE, - .desc_size = TXINFO_SIZE, - .priv_size = sizeof(struct queue_entry_priv_usb), -}; - -static const struct rt2x00_ops rt73usb_ops = { - .name = KBUILD_MODNAME, - .max_ap_intf = 4, - .eeprom_size = EEPROM_SIZE, - .rf_size = RF_SIZE, - .tx_queues = NUM_TX_QUEUES, - .extra_tx_headroom = TXD_DESC_SIZE, - .rx = &rt73usb_queue_rx, - .tx = &rt73usb_queue_tx, - .bcn = &rt73usb_queue_bcn, - .lib = &rt73usb_rt2x00_ops, - .hw = &rt73usb_mac80211_ops, -#ifdef CONFIG_RT2X00_LIB_DEBUGFS - .debugfs = &rt73usb_rt2x00debug, -#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ -}; - -/* - * rt73usb module information. - */ -static struct usb_device_id rt73usb_device_table[] = { - /* AboCom */ - { USB_DEVICE(0x07b8, 0xb21b) }, - { USB_DEVICE(0x07b8, 0xb21c) }, - { USB_DEVICE(0x07b8, 0xb21d) }, - { USB_DEVICE(0x07b8, 0xb21e) }, - { USB_DEVICE(0x07b8, 0xb21f) }, - /* AL */ - { USB_DEVICE(0x14b2, 0x3c10) }, - /* Amigo */ - { USB_DEVICE(0x148f, 0x9021) }, - { USB_DEVICE(0x0eb0, 0x9021) }, - /* AMIT */ - { USB_DEVICE(0x18c5, 0x0002) }, - /* Askey */ - { USB_DEVICE(0x1690, 0x0722) }, - /* ASUS */ - { USB_DEVICE(0x0b05, 0x1723) }, - { USB_DEVICE(0x0b05, 0x1724) }, - /* Belkin */ - { USB_DEVICE(0x050d, 0x7050) }, /* FCC ID: K7SF5D7050B ver. 3.x */ - { USB_DEVICE(0x050d, 0x705a) }, - { USB_DEVICE(0x050d, 0x905b) }, - { USB_DEVICE(0x050d, 0x905c) }, - /* Billionton */ - { USB_DEVICE(0x1631, 0xc019) }, - { USB_DEVICE(0x08dd, 0x0120) }, - /* Buffalo */ - { USB_DEVICE(0x0411, 0x00d8) }, - { USB_DEVICE(0x0411, 0x00d9) }, - { USB_DEVICE(0x0411, 0x00e6) }, - { USB_DEVICE(0x0411, 0x00f4) }, - { USB_DEVICE(0x0411, 0x0116) }, - { USB_DEVICE(0x0411, 0x0119) }, - { USB_DEVICE(0x0411, 0x0137) }, - /* CEIVA */ - { USB_DEVICE(0x178d, 0x02be) }, - /* CNet */ - { USB_DEVICE(0x1371, 0x9022) }, - { USB_DEVICE(0x1371, 0x9032) }, - /* Conceptronic */ - { USB_DEVICE(0x14b2, 0x3c22) }, - /* Corega */ - { USB_DEVICE(0x07aa, 0x002e) }, - /* D-Link */ - { USB_DEVICE(0x07d1, 0x3c03) }, - { USB_DEVICE(0x07d1, 0x3c04) }, - { USB_DEVICE(0x07d1, 0x3c06) }, - { USB_DEVICE(0x07d1, 0x3c07) }, - /* Edimax */ - { USB_DEVICE(0x7392, 0x7318) }, - { USB_DEVICE(0x7392, 0x7618) }, - /* EnGenius */ - { USB_DEVICE(0x1740, 0x3701) }, - /* Gemtek */ - { USB_DEVICE(0x15a9, 0x0004) }, - /* Gigabyte */ - { USB_DEVICE(0x1044, 0x8008) }, - { USB_DEVICE(0x1044, 0x800a) }, - /* Huawei-3Com */ - { USB_DEVICE(0x1472, 0x0009) }, - /* Hercules */ - { USB_DEVICE(0x06f8, 0xe002) }, - { USB_DEVICE(0x06f8, 0xe010) }, - { USB_DEVICE(0x06f8, 0xe020) }, - /* Linksys */ - { USB_DEVICE(0x13b1, 0x0020) }, - { USB_DEVICE(0x13b1, 0x0023) }, - { USB_DEVICE(0x13b1, 0x0028) }, - /* MSI */ - { USB_DEVICE(0x0db0, 0x4600) }, - { USB_DEVICE(0x0db0, 0x6877) }, - { USB_DEVICE(0x0db0, 0x6874) }, - { USB_DEVICE(0x0db0, 0xa861) }, - { USB_DEVICE(0x0db0, 0xa874) }, - /* Ovislink */ - { USB_DEVICE(0x1b75, 0x7318) }, - /* Ralink */ - { USB_DEVICE(0x04bb, 0x093d) }, - { USB_DEVICE(0x148f, 0x2573) }, - { USB_DEVICE(0x148f, 0x2671) }, - { USB_DEVICE(0x0812, 0x3101) }, - /* Qcom */ - { USB_DEVICE(0x18e8, 0x6196) }, - { USB_DEVICE(0x18e8, 0x6229) }, - { USB_DEVICE(0x18e8, 0x6238) }, - /* Samsung */ - { USB_DEVICE(0x04e8, 0x4471) }, - /* Senao */ - { USB_DEVICE(0x1740, 0x7100) }, - /* Sitecom */ - { USB_DEVICE(0x0df6, 0x0024) }, - { USB_DEVICE(0x0df6, 0x0027) }, - { USB_DEVICE(0x0df6, 0x002f) }, - { USB_DEVICE(0x0df6, 0x90ac) }, - { USB_DEVICE(0x0df6, 0x9712) }, - /* Surecom */ - { USB_DEVICE(0x0769, 0x31f3) }, - /* Tilgin */ - { USB_DEVICE(0x6933, 0x5001) }, - /* Philips */ - { USB_DEVICE(0x0471, 0x200a) }, - /* Planex */ - { USB_DEVICE(0x2019, 0xab01) }, - { USB_DEVICE(0x2019, 0xab50) }, - /* WideTell */ - { USB_DEVICE(0x7167, 0x3840) }, - /* Zcom */ - { USB_DEVICE(0x0cde, 0x001c) }, - /* ZyXEL */ - { USB_DEVICE(0x0586, 0x3415) }, - { 0, } -}; - -MODULE_AUTHOR(DRV_PROJECT); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION("Ralink RT73 USB Wireless LAN driver."); -MODULE_SUPPORTED_DEVICE("Ralink RT2571W & RT2671 USB chipset based cards"); -MODULE_DEVICE_TABLE(usb, rt73usb_device_table); -MODULE_FIRMWARE(FIRMWARE_RT2571); -MODULE_LICENSE("GPL"); - -static int rt73usb_probe(struct usb_interface *usb_intf, - const struct usb_device_id *id) -{ - return rt2x00usb_probe(usb_intf, &rt73usb_ops); -} - -static struct usb_driver rt73usb_driver = { - .name = KBUILD_MODNAME, - .id_table = rt73usb_device_table, - .probe = rt73usb_probe, - .disconnect = rt2x00usb_disconnect, - .suspend = rt2x00usb_suspend, - .resume = rt2x00usb_resume, - .reset_resume = rt2x00usb_resume, - .disable_hub_initiated_lpm = 1, -}; - -module_usb_driver(rt73usb_driver); diff --git a/drivers/net/wireless/rt2x00/rt73usb.h b/drivers/net/wireless/rt2x00/rt73usb.h deleted file mode 100644 index 7577e0ba3877..000000000000 --- a/drivers/net/wireless/rt2x00/rt73usb.h +++ /dev/null @@ -1,1081 +0,0 @@ -/* - Copyright (C) 2004 - 2009 Ivo van Doorn - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: rt73usb - Abstract: Data structures and registers for the rt73usb module. - Supported chipsets: rt2571W & rt2671. - */ - -#ifndef RT73USB_H -#define RT73USB_H - -/* - * RF chip defines. - */ -#define RF5226 0x0001 -#define RF2528 0x0002 -#define RF5225 0x0003 -#define RF2527 0x0004 - -/* - * Signal information. - * Default offset is required for RSSI <-> dBm conversion. - */ -#define DEFAULT_RSSI_OFFSET 120 - -/* - * Register layout information. - */ -#define CSR_REG_BASE 0x3000 -#define CSR_REG_SIZE 0x04b0 -#define EEPROM_BASE 0x0000 -#define EEPROM_SIZE 0x0100 -#define BBP_BASE 0x0000 -#define BBP_SIZE 0x0080 -#define RF_BASE 0x0004 -#define RF_SIZE 0x0010 - -/* - * Number of TX queues. - */ -#define NUM_TX_QUEUES 4 - -/* - * USB registers. - */ - -/* - * MCU_LEDCS: LED control for MCU Mailbox. - */ -#define MCU_LEDCS_LED_MODE FIELD16(0x001f) -#define MCU_LEDCS_RADIO_STATUS FIELD16(0x0020) -#define MCU_LEDCS_LINK_BG_STATUS FIELD16(0x0040) -#define MCU_LEDCS_LINK_A_STATUS FIELD16(0x0080) -#define MCU_LEDCS_POLARITY_GPIO_0 FIELD16(0x0100) -#define MCU_LEDCS_POLARITY_GPIO_1 FIELD16(0x0200) -#define MCU_LEDCS_POLARITY_GPIO_2 FIELD16(0x0400) -#define MCU_LEDCS_POLARITY_GPIO_3 FIELD16(0x0800) -#define MCU_LEDCS_POLARITY_GPIO_4 FIELD16(0x1000) -#define MCU_LEDCS_POLARITY_ACT FIELD16(0x2000) -#define MCU_LEDCS_POLARITY_READY_BG FIELD16(0x4000) -#define MCU_LEDCS_POLARITY_READY_A FIELD16(0x8000) - -/* - * 8051 firmware image. - */ -#define FIRMWARE_RT2571 "rt73.bin" -#define FIRMWARE_IMAGE_BASE 0x0800 - -/* - * Security key table memory. - * 16 entries 32-byte for shared key table - * 64 entries 32-byte for pairwise key table - * 64 entries 8-byte for pairwise ta key table - */ -#define SHARED_KEY_TABLE_BASE 0x1000 -#define PAIRWISE_KEY_TABLE_BASE 0x1200 -#define PAIRWISE_TA_TABLE_BASE 0x1a00 - -#define SHARED_KEY_ENTRY(__idx) \ - ( SHARED_KEY_TABLE_BASE + \ - ((__idx) * sizeof(struct hw_key_entry)) ) -#define PAIRWISE_KEY_ENTRY(__idx) \ - ( PAIRWISE_KEY_TABLE_BASE + \ - ((__idx) * sizeof(struct hw_key_entry)) ) -#define PAIRWISE_TA_ENTRY(__idx) \ - ( PAIRWISE_TA_TABLE_BASE + \ - ((__idx) * sizeof(struct hw_pairwise_ta_entry)) ) - -struct hw_key_entry { - u8 key[16]; - u8 tx_mic[8]; - u8 rx_mic[8]; -} __packed; - -struct hw_pairwise_ta_entry { - u8 address[6]; - u8 cipher; - u8 reserved; -} __packed; - -/* - * Since NULL frame won't be that long (256 byte), - * We steal 16 tail bytes to save debugging settings. - */ -#define HW_DEBUG_SETTING_BASE 0x2bf0 - -/* - * On-chip BEACON frame space. - */ -#define HW_BEACON_BASE0 0x2400 -#define HW_BEACON_BASE1 0x2500 -#define HW_BEACON_BASE2 0x2600 -#define HW_BEACON_BASE3 0x2700 - -#define HW_BEACON_OFFSET(__index) \ - ( HW_BEACON_BASE0 + (__index * 0x0100) ) - -/* - * MAC Control/Status Registers(CSR). - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * MAC_CSR0: ASIC revision number. - */ -#define MAC_CSR0 0x3000 -#define MAC_CSR0_REVISION FIELD32(0x0000000f) -#define MAC_CSR0_CHIPSET FIELD32(0x000ffff0) - -/* - * MAC_CSR1: System control register. - * SOFT_RESET: Software reset bit, 1: reset, 0: normal. - * BBP_RESET: Hardware reset BBP. - * HOST_READY: Host is ready after initialization, 1: ready. - */ -#define MAC_CSR1 0x3004 -#define MAC_CSR1_SOFT_RESET FIELD32(0x00000001) -#define MAC_CSR1_BBP_RESET FIELD32(0x00000002) -#define MAC_CSR1_HOST_READY FIELD32(0x00000004) - -/* - * MAC_CSR2: STA MAC register 0. - */ -#define MAC_CSR2 0x3008 -#define MAC_CSR2_BYTE0 FIELD32(0x000000ff) -#define MAC_CSR2_BYTE1 FIELD32(0x0000ff00) -#define MAC_CSR2_BYTE2 FIELD32(0x00ff0000) -#define MAC_CSR2_BYTE3 FIELD32(0xff000000) - -/* - * MAC_CSR3: STA MAC register 1. - * UNICAST_TO_ME_MASK: - * Used to mask off bits from byte 5 of the MAC address - * to determine the UNICAST_TO_ME bit for RX frames. - * The full mask is complemented by BSS_ID_MASK: - * MASK = BSS_ID_MASK & UNICAST_TO_ME_MASK - */ -#define MAC_CSR3 0x300c -#define MAC_CSR3_BYTE4 FIELD32(0x000000ff) -#define MAC_CSR3_BYTE5 FIELD32(0x0000ff00) -#define MAC_CSR3_UNICAST_TO_ME_MASK FIELD32(0x00ff0000) - -/* - * MAC_CSR4: BSSID register 0. - */ -#define MAC_CSR4 0x3010 -#define MAC_CSR4_BYTE0 FIELD32(0x000000ff) -#define MAC_CSR4_BYTE1 FIELD32(0x0000ff00) -#define MAC_CSR4_BYTE2 FIELD32(0x00ff0000) -#define MAC_CSR4_BYTE3 FIELD32(0xff000000) - -/* - * MAC_CSR5: BSSID register 1. - * BSS_ID_MASK: - * This mask is used to mask off bits 0 and 1 of byte 5 of the - * BSSID. This will make sure that those bits will be ignored - * when determining the MY_BSS of RX frames. - * 0: 1-BSSID mode (BSS index = 0) - * 1: 2-BSSID mode (BSS index: Byte5, bit 0) - * 2: 2-BSSID mode (BSS index: byte5, bit 1) - * 3: 4-BSSID mode (BSS index: byte5, bit 0 - 1) - */ -#define MAC_CSR5 0x3014 -#define MAC_CSR5_BYTE4 FIELD32(0x000000ff) -#define MAC_CSR5_BYTE5 FIELD32(0x0000ff00) -#define MAC_CSR5_BSS_ID_MASK FIELD32(0x00ff0000) - -/* - * MAC_CSR6: Maximum frame length register. - */ -#define MAC_CSR6 0x3018 -#define MAC_CSR6_MAX_FRAME_UNIT FIELD32(0x00000fff) - -/* - * MAC_CSR7: Reserved - */ -#define MAC_CSR7 0x301c - -/* - * MAC_CSR8: SIFS/EIFS register. - * All units are in US. - */ -#define MAC_CSR8 0x3020 -#define MAC_CSR8_SIFS FIELD32(0x000000ff) -#define MAC_CSR8_SIFS_AFTER_RX_OFDM FIELD32(0x0000ff00) -#define MAC_CSR8_EIFS FIELD32(0xffff0000) - -/* - * MAC_CSR9: Back-Off control register. - * SLOT_TIME: Slot time, default is 20us for 802.11BG. - * CWMIN: Bit for Cwmin. default Cwmin is 31 (2^5 - 1). - * CWMAX: Bit for Cwmax, default Cwmax is 1023 (2^10 - 1). - * CW_SELECT: 1: CWmin/Cwmax select from register, 0:select from TxD. - */ -#define MAC_CSR9 0x3024 -#define MAC_CSR9_SLOT_TIME FIELD32(0x000000ff) -#define MAC_CSR9_CWMIN FIELD32(0x00000f00) -#define MAC_CSR9_CWMAX FIELD32(0x0000f000) -#define MAC_CSR9_CW_SELECT FIELD32(0x00010000) - -/* - * MAC_CSR10: Power state configuration. - */ -#define MAC_CSR10 0x3028 - -/* - * MAC_CSR11: Power saving transition time register. - * DELAY_AFTER_TBCN: Delay after Tbcn expired in units of TU. - * TBCN_BEFORE_WAKEUP: Number of beacon before wakeup. - * WAKEUP_LATENCY: In unit of TU. - */ -#define MAC_CSR11 0x302c -#define MAC_CSR11_DELAY_AFTER_TBCN FIELD32(0x000000ff) -#define MAC_CSR11_TBCN_BEFORE_WAKEUP FIELD32(0x00007f00) -#define MAC_CSR11_AUTOWAKE FIELD32(0x00008000) -#define MAC_CSR11_WAKEUP_LATENCY FIELD32(0x000f0000) - -/* - * MAC_CSR12: Manual power control / status register (merge CSR20 & PWRCSR1). - * CURRENT_STATE: 0:sleep, 1:awake. - * FORCE_WAKEUP: This has higher priority than PUT_TO_SLEEP. - * BBP_CURRENT_STATE: 0: BBP sleep, 1: BBP awake. - */ -#define MAC_CSR12 0x3030 -#define MAC_CSR12_CURRENT_STATE FIELD32(0x00000001) -#define MAC_CSR12_PUT_TO_SLEEP FIELD32(0x00000002) -#define MAC_CSR12_FORCE_WAKEUP FIELD32(0x00000004) -#define MAC_CSR12_BBP_CURRENT_STATE FIELD32(0x00000008) - -/* - * MAC_CSR13: GPIO. - * MAC_CSR13_VALx: GPIO value - * MAC_CSR13_DIRx: GPIO direction: 0 = input; 1 = output - */ -#define MAC_CSR13 0x3034 -#define MAC_CSR13_VAL0 FIELD32(0x00000001) -#define MAC_CSR13_VAL1 FIELD32(0x00000002) -#define MAC_CSR13_VAL2 FIELD32(0x00000004) -#define MAC_CSR13_VAL3 FIELD32(0x00000008) -#define MAC_CSR13_VAL4 FIELD32(0x00000010) -#define MAC_CSR13_VAL5 FIELD32(0x00000020) -#define MAC_CSR13_VAL6 FIELD32(0x00000040) -#define MAC_CSR13_VAL7 FIELD32(0x00000080) -#define MAC_CSR13_DIR0 FIELD32(0x00000100) -#define MAC_CSR13_DIR1 FIELD32(0x00000200) -#define MAC_CSR13_DIR2 FIELD32(0x00000400) -#define MAC_CSR13_DIR3 FIELD32(0x00000800) -#define MAC_CSR13_DIR4 FIELD32(0x00001000) -#define MAC_CSR13_DIR5 FIELD32(0x00002000) -#define MAC_CSR13_DIR6 FIELD32(0x00004000) -#define MAC_CSR13_DIR7 FIELD32(0x00008000) - -/* - * MAC_CSR14: LED control register. - * ON_PERIOD: On period, default 70ms. - * OFF_PERIOD: Off period, default 30ms. - * HW_LED: HW TX activity, 1: normal OFF, 0: normal ON. - * SW_LED: s/w LED, 1: ON, 0: OFF. - * HW_LED_POLARITY: 0: active low, 1: active high. - */ -#define MAC_CSR14 0x3038 -#define MAC_CSR14_ON_PERIOD FIELD32(0x000000ff) -#define MAC_CSR14_OFF_PERIOD FIELD32(0x0000ff00) -#define MAC_CSR14_HW_LED FIELD32(0x00010000) -#define MAC_CSR14_SW_LED FIELD32(0x00020000) -#define MAC_CSR14_HW_LED_POLARITY FIELD32(0x00040000) -#define MAC_CSR14_SW_LED2 FIELD32(0x00080000) - -/* - * MAC_CSR15: NAV control. - */ -#define MAC_CSR15 0x303c - -/* - * TXRX control registers. - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * TXRX_CSR0: TX/RX configuration register. - * TSF_OFFSET: Default is 24. - * AUTO_TX_SEQ: 1: ASIC auto replace sequence nr in outgoing frame. - * DISABLE_RX: Disable Rx engine. - * DROP_CRC: Drop CRC error. - * DROP_PHYSICAL: Drop physical error. - * DROP_CONTROL: Drop control frame. - * DROP_NOT_TO_ME: Drop not to me unicast frame. - * DROP_TO_DS: Drop fram ToDs bit is true. - * DROP_VERSION_ERROR: Drop version error frame. - * DROP_MULTICAST: Drop multicast frames. - * DROP_BORADCAST: Drop broadcast frames. - * DROP_ACK_CTS: Drop received ACK and CTS. - */ -#define TXRX_CSR0 0x3040 -#define TXRX_CSR0_RX_ACK_TIMEOUT FIELD32(0x000001ff) -#define TXRX_CSR0_TSF_OFFSET FIELD32(0x00007e00) -#define TXRX_CSR0_AUTO_TX_SEQ FIELD32(0x00008000) -#define TXRX_CSR0_DISABLE_RX FIELD32(0x00010000) -#define TXRX_CSR0_DROP_CRC FIELD32(0x00020000) -#define TXRX_CSR0_DROP_PHYSICAL FIELD32(0x00040000) -#define TXRX_CSR0_DROP_CONTROL FIELD32(0x00080000) -#define TXRX_CSR0_DROP_NOT_TO_ME FIELD32(0x00100000) -#define TXRX_CSR0_DROP_TO_DS FIELD32(0x00200000) -#define TXRX_CSR0_DROP_VERSION_ERROR FIELD32(0x00400000) -#define TXRX_CSR0_DROP_MULTICAST FIELD32(0x00800000) -#define TXRX_CSR0_DROP_BROADCAST FIELD32(0x01000000) -#define TXRX_CSR0_DROP_ACK_CTS FIELD32(0x02000000) -#define TXRX_CSR0_TX_WITHOUT_WAITING FIELD32(0x04000000) - -/* - * TXRX_CSR1 - */ -#define TXRX_CSR1 0x3044 -#define TXRX_CSR1_BBP_ID0 FIELD32(0x0000007f) -#define TXRX_CSR1_BBP_ID0_VALID FIELD32(0x00000080) -#define TXRX_CSR1_BBP_ID1 FIELD32(0x00007f00) -#define TXRX_CSR1_BBP_ID1_VALID FIELD32(0x00008000) -#define TXRX_CSR1_BBP_ID2 FIELD32(0x007f0000) -#define TXRX_CSR1_BBP_ID2_VALID FIELD32(0x00800000) -#define TXRX_CSR1_BBP_ID3 FIELD32(0x7f000000) -#define TXRX_CSR1_BBP_ID3_VALID FIELD32(0x80000000) - -/* - * TXRX_CSR2 - */ -#define TXRX_CSR2 0x3048 -#define TXRX_CSR2_BBP_ID0 FIELD32(0x0000007f) -#define TXRX_CSR2_BBP_ID0_VALID FIELD32(0x00000080) -#define TXRX_CSR2_BBP_ID1 FIELD32(0x00007f00) -#define TXRX_CSR2_BBP_ID1_VALID FIELD32(0x00008000) -#define TXRX_CSR2_BBP_ID2 FIELD32(0x007f0000) -#define TXRX_CSR2_BBP_ID2_VALID FIELD32(0x00800000) -#define TXRX_CSR2_BBP_ID3 FIELD32(0x7f000000) -#define TXRX_CSR2_BBP_ID3_VALID FIELD32(0x80000000) - -/* - * TXRX_CSR3 - */ -#define TXRX_CSR3 0x304c -#define TXRX_CSR3_BBP_ID0 FIELD32(0x0000007f) -#define TXRX_CSR3_BBP_ID0_VALID FIELD32(0x00000080) -#define TXRX_CSR3_BBP_ID1 FIELD32(0x00007f00) -#define TXRX_CSR3_BBP_ID1_VALID FIELD32(0x00008000) -#define TXRX_CSR3_BBP_ID2 FIELD32(0x007f0000) -#define TXRX_CSR3_BBP_ID2_VALID FIELD32(0x00800000) -#define TXRX_CSR3_BBP_ID3 FIELD32(0x7f000000) -#define TXRX_CSR3_BBP_ID3_VALID FIELD32(0x80000000) - -/* - * TXRX_CSR4: Auto-Responder/Tx-retry register. - * AUTORESPOND_PREAMBLE: 0:long, 1:short preamble. - * OFDM_TX_RATE_DOWN: 1:enable. - * OFDM_TX_RATE_STEP: 0:1-step, 1: 2-step, 2:3-step, 3:4-step. - * OFDM_TX_FALLBACK_CCK: 0: Fallback to OFDM 6M only, 1: Fallback to CCK 1M,2M. - */ -#define TXRX_CSR4 0x3050 -#define TXRX_CSR4_TX_ACK_TIMEOUT FIELD32(0x000000ff) -#define TXRX_CSR4_CNTL_ACK_POLICY FIELD32(0x00000700) -#define TXRX_CSR4_ACK_CTS_PSM FIELD32(0x00010000) -#define TXRX_CSR4_AUTORESPOND_ENABLE FIELD32(0x00020000) -#define TXRX_CSR4_AUTORESPOND_PREAMBLE FIELD32(0x00040000) -#define TXRX_CSR4_OFDM_TX_RATE_DOWN FIELD32(0x00080000) -#define TXRX_CSR4_OFDM_TX_RATE_STEP FIELD32(0x00300000) -#define TXRX_CSR4_OFDM_TX_FALLBACK_CCK FIELD32(0x00400000) -#define TXRX_CSR4_LONG_RETRY_LIMIT FIELD32(0x0f000000) -#define TXRX_CSR4_SHORT_RETRY_LIMIT FIELD32(0xf0000000) - -/* - * TXRX_CSR5 - */ -#define TXRX_CSR5 0x3054 - -/* - * TXRX_CSR6: ACK/CTS payload consumed time - */ -#define TXRX_CSR6 0x3058 - -/* - * TXRX_CSR7: OFDM ACK/CTS payload consumed time for 6/9/12/18 mbps. - */ -#define TXRX_CSR7 0x305c -#define TXRX_CSR7_ACK_CTS_6MBS FIELD32(0x000000ff) -#define TXRX_CSR7_ACK_CTS_9MBS FIELD32(0x0000ff00) -#define TXRX_CSR7_ACK_CTS_12MBS FIELD32(0x00ff0000) -#define TXRX_CSR7_ACK_CTS_18MBS FIELD32(0xff000000) - -/* - * TXRX_CSR8: OFDM ACK/CTS payload consumed time for 24/36/48/54 mbps. - */ -#define TXRX_CSR8 0x3060 -#define TXRX_CSR8_ACK_CTS_24MBS FIELD32(0x000000ff) -#define TXRX_CSR8_ACK_CTS_36MBS FIELD32(0x0000ff00) -#define TXRX_CSR8_ACK_CTS_48MBS FIELD32(0x00ff0000) -#define TXRX_CSR8_ACK_CTS_54MBS FIELD32(0xff000000) - -/* - * TXRX_CSR9: Synchronization control register. - * BEACON_INTERVAL: In unit of 1/16 TU. - * TSF_TICKING: Enable TSF auto counting. - * TSF_SYNC: Tsf sync, 0: disable, 1: infra, 2: ad-hoc/master mode. - * BEACON_GEN: Enable beacon generator. - */ -#define TXRX_CSR9 0x3064 -#define TXRX_CSR9_BEACON_INTERVAL FIELD32(0x0000ffff) -#define TXRX_CSR9_TSF_TICKING FIELD32(0x00010000) -#define TXRX_CSR9_TSF_SYNC FIELD32(0x00060000) -#define TXRX_CSR9_TBTT_ENABLE FIELD32(0x00080000) -#define TXRX_CSR9_BEACON_GEN FIELD32(0x00100000) -#define TXRX_CSR9_TIMESTAMP_COMPENSATE FIELD32(0xff000000) - -/* - * TXRX_CSR10: BEACON alignment. - */ -#define TXRX_CSR10 0x3068 - -/* - * TXRX_CSR11: AES mask. - */ -#define TXRX_CSR11 0x306c - -/* - * TXRX_CSR12: TSF low 32. - */ -#define TXRX_CSR12 0x3070 -#define TXRX_CSR12_LOW_TSFTIMER FIELD32(0xffffffff) - -/* - * TXRX_CSR13: TSF high 32. - */ -#define TXRX_CSR13 0x3074 -#define TXRX_CSR13_HIGH_TSFTIMER FIELD32(0xffffffff) - -/* - * TXRX_CSR14: TBTT timer. - */ -#define TXRX_CSR14 0x3078 - -/* - * TXRX_CSR15: TKIP MIC priority byte "AND" mask. - */ -#define TXRX_CSR15 0x307c - -/* - * PHY control registers. - * Some values are set in TU, whereas 1 TU == 1024 us. - */ - -/* - * PHY_CSR0: RF/PS control. - */ -#define PHY_CSR0 0x3080 -#define PHY_CSR0_PA_PE_BG FIELD32(0x00010000) -#define PHY_CSR0_PA_PE_A FIELD32(0x00020000) - -/* - * PHY_CSR1 - */ -#define PHY_CSR1 0x3084 -#define PHY_CSR1_RF_RPI FIELD32(0x00010000) - -/* - * PHY_CSR2: Pre-TX BBP control. - */ -#define PHY_CSR2 0x3088 - -/* - * PHY_CSR3: BBP serial control register. - * VALUE: Register value to program into BBP. - * REG_NUM: Selected BBP register. - * READ_CONTROL: 0: Write BBP, 1: Read BBP. - * BUSY: 1: ASIC is busy execute BBP programming. - */ -#define PHY_CSR3 0x308c -#define PHY_CSR3_VALUE FIELD32(0x000000ff) -#define PHY_CSR3_REGNUM FIELD32(0x00007f00) -#define PHY_CSR3_READ_CONTROL FIELD32(0x00008000) -#define PHY_CSR3_BUSY FIELD32(0x00010000) - -/* - * PHY_CSR4: RF serial control register - * VALUE: Register value (include register id) serial out to RF/IF chip. - * NUMBER_OF_BITS: Number of bits used in RFRegValue (I:20, RFMD:22). - * IF_SELECT: 1: select IF to program, 0: select RF to program. - * PLL_LD: RF PLL_LD status. - * BUSY: 1: ASIC is busy execute RF programming. - */ -#define PHY_CSR4 0x3090 -#define PHY_CSR4_VALUE FIELD32(0x00ffffff) -#define PHY_CSR4_NUMBER_OF_BITS FIELD32(0x1f000000) -#define PHY_CSR4_IF_SELECT FIELD32(0x20000000) -#define PHY_CSR4_PLL_LD FIELD32(0x40000000) -#define PHY_CSR4_BUSY FIELD32(0x80000000) - -/* - * PHY_CSR5: RX to TX signal switch timing control. - */ -#define PHY_CSR5 0x3094 -#define PHY_CSR5_IQ_FLIP FIELD32(0x00000004) - -/* - * PHY_CSR6: TX to RX signal timing control. - */ -#define PHY_CSR6 0x3098 -#define PHY_CSR6_IQ_FLIP FIELD32(0x00000004) - -/* - * PHY_CSR7: TX DAC switching timing control. - */ -#define PHY_CSR7 0x309c - -/* - * Security control register. - */ - -/* - * SEC_CSR0: Shared key table control. - */ -#define SEC_CSR0 0x30a0 -#define SEC_CSR0_BSS0_KEY0_VALID FIELD32(0x00000001) -#define SEC_CSR0_BSS0_KEY1_VALID FIELD32(0x00000002) -#define SEC_CSR0_BSS0_KEY2_VALID FIELD32(0x00000004) -#define SEC_CSR0_BSS0_KEY3_VALID FIELD32(0x00000008) -#define SEC_CSR0_BSS1_KEY0_VALID FIELD32(0x00000010) -#define SEC_CSR0_BSS1_KEY1_VALID FIELD32(0x00000020) -#define SEC_CSR0_BSS1_KEY2_VALID FIELD32(0x00000040) -#define SEC_CSR0_BSS1_KEY3_VALID FIELD32(0x00000080) -#define SEC_CSR0_BSS2_KEY0_VALID FIELD32(0x00000100) -#define SEC_CSR0_BSS2_KEY1_VALID FIELD32(0x00000200) -#define SEC_CSR0_BSS2_KEY2_VALID FIELD32(0x00000400) -#define SEC_CSR0_BSS2_KEY3_VALID FIELD32(0x00000800) -#define SEC_CSR0_BSS3_KEY0_VALID FIELD32(0x00001000) -#define SEC_CSR0_BSS3_KEY1_VALID FIELD32(0x00002000) -#define SEC_CSR0_BSS3_KEY2_VALID FIELD32(0x00004000) -#define SEC_CSR0_BSS3_KEY3_VALID FIELD32(0x00008000) - -/* - * SEC_CSR1: Shared key table security mode register. - */ -#define SEC_CSR1 0x30a4 -#define SEC_CSR1_BSS0_KEY0_CIPHER_ALG FIELD32(0x00000007) -#define SEC_CSR1_BSS0_KEY1_CIPHER_ALG FIELD32(0x00000070) -#define SEC_CSR1_BSS0_KEY2_CIPHER_ALG FIELD32(0x00000700) -#define SEC_CSR1_BSS0_KEY3_CIPHER_ALG FIELD32(0x00007000) -#define SEC_CSR1_BSS1_KEY0_CIPHER_ALG FIELD32(0x00070000) -#define SEC_CSR1_BSS1_KEY1_CIPHER_ALG FIELD32(0x00700000) -#define SEC_CSR1_BSS1_KEY2_CIPHER_ALG FIELD32(0x07000000) -#define SEC_CSR1_BSS1_KEY3_CIPHER_ALG FIELD32(0x70000000) - -/* - * Pairwise key table valid bitmap registers. - * SEC_CSR2: pairwise key table valid bitmap 0. - * SEC_CSR3: pairwise key table valid bitmap 1. - */ -#define SEC_CSR2 0x30a8 -#define SEC_CSR3 0x30ac - -/* - * SEC_CSR4: Pairwise key table lookup control. - */ -#define SEC_CSR4 0x30b0 -#define SEC_CSR4_ENABLE_BSS0 FIELD32(0x00000001) -#define SEC_CSR4_ENABLE_BSS1 FIELD32(0x00000002) -#define SEC_CSR4_ENABLE_BSS2 FIELD32(0x00000004) -#define SEC_CSR4_ENABLE_BSS3 FIELD32(0x00000008) - -/* - * SEC_CSR5: shared key table security mode register. - */ -#define SEC_CSR5 0x30b4 -#define SEC_CSR5_BSS2_KEY0_CIPHER_ALG FIELD32(0x00000007) -#define SEC_CSR5_BSS2_KEY1_CIPHER_ALG FIELD32(0x00000070) -#define SEC_CSR5_BSS2_KEY2_CIPHER_ALG FIELD32(0x00000700) -#define SEC_CSR5_BSS2_KEY3_CIPHER_ALG FIELD32(0x00007000) -#define SEC_CSR5_BSS3_KEY0_CIPHER_ALG FIELD32(0x00070000) -#define SEC_CSR5_BSS3_KEY1_CIPHER_ALG FIELD32(0x00700000) -#define SEC_CSR5_BSS3_KEY2_CIPHER_ALG FIELD32(0x07000000) -#define SEC_CSR5_BSS3_KEY3_CIPHER_ALG FIELD32(0x70000000) - -/* - * STA control registers. - */ - -/* - * STA_CSR0: RX PLCP error count & RX FCS error count. - */ -#define STA_CSR0 0x30c0 -#define STA_CSR0_FCS_ERROR FIELD32(0x0000ffff) -#define STA_CSR0_PLCP_ERROR FIELD32(0xffff0000) - -/* - * STA_CSR1: RX False CCA count & RX LONG frame count. - */ -#define STA_CSR1 0x30c4 -#define STA_CSR1_PHYSICAL_ERROR FIELD32(0x0000ffff) -#define STA_CSR1_FALSE_CCA_ERROR FIELD32(0xffff0000) - -/* - * STA_CSR2: TX Beacon count and RX FIFO overflow count. - */ -#define STA_CSR2 0x30c8 -#define STA_CSR2_RX_FIFO_OVERFLOW_COUNT FIELD32(0x0000ffff) -#define STA_CSR2_RX_OVERFLOW_COUNT FIELD32(0xffff0000) - -/* - * STA_CSR3: TX Beacon count. - */ -#define STA_CSR3 0x30cc -#define STA_CSR3_TX_BEACON_COUNT FIELD32(0x0000ffff) - -/* - * STA_CSR4: TX Retry count. - */ -#define STA_CSR4 0x30d0 -#define STA_CSR4_TX_NO_RETRY_COUNT FIELD32(0x0000ffff) -#define STA_CSR4_TX_ONE_RETRY_COUNT FIELD32(0xffff0000) - -/* - * STA_CSR5: TX Retry count. - */ -#define STA_CSR5 0x30d4 -#define STA_CSR4_TX_MULTI_RETRY_COUNT FIELD32(0x0000ffff) -#define STA_CSR4_TX_RETRY_FAIL_COUNT FIELD32(0xffff0000) - -/* - * QOS control registers. - */ - -/* - * QOS_CSR1: TXOP holder MAC address register. - */ -#define QOS_CSR1 0x30e4 -#define QOS_CSR1_BYTE4 FIELD32(0x000000ff) -#define QOS_CSR1_BYTE5 FIELD32(0x0000ff00) - -/* - * QOS_CSR2: TXOP holder timeout register. - */ -#define QOS_CSR2 0x30e8 - -/* - * RX QOS-CFPOLL MAC address register. - * QOS_CSR3: RX QOS-CFPOLL MAC address 0. - * QOS_CSR4: RX QOS-CFPOLL MAC address 1. - */ -#define QOS_CSR3 0x30ec -#define QOS_CSR4 0x30f0 - -/* - * QOS_CSR5: "QosControl" field of the RX QOS-CFPOLL. - */ -#define QOS_CSR5 0x30f4 - -/* - * WMM Scheduler Register - */ - -/* - * AIFSN_CSR: AIFSN for each EDCA AC. - * AIFSN0: For AC_VO. - * AIFSN1: For AC_VI. - * AIFSN2: For AC_BE. - * AIFSN3: For AC_BK. - */ -#define AIFSN_CSR 0x0400 -#define AIFSN_CSR_AIFSN0 FIELD32(0x0000000f) -#define AIFSN_CSR_AIFSN1 FIELD32(0x000000f0) -#define AIFSN_CSR_AIFSN2 FIELD32(0x00000f00) -#define AIFSN_CSR_AIFSN3 FIELD32(0x0000f000) - -/* - * CWMIN_CSR: CWmin for each EDCA AC. - * CWMIN0: For AC_VO. - * CWMIN1: For AC_VI. - * CWMIN2: For AC_BE. - * CWMIN3: For AC_BK. - */ -#define CWMIN_CSR 0x0404 -#define CWMIN_CSR_CWMIN0 FIELD32(0x0000000f) -#define CWMIN_CSR_CWMIN1 FIELD32(0x000000f0) -#define CWMIN_CSR_CWMIN2 FIELD32(0x00000f00) -#define CWMIN_CSR_CWMIN3 FIELD32(0x0000f000) - -/* - * CWMAX_CSR: CWmax for each EDCA AC. - * CWMAX0: For AC_VO. - * CWMAX1: For AC_VI. - * CWMAX2: For AC_BE. - * CWMAX3: For AC_BK. - */ -#define CWMAX_CSR 0x0408 -#define CWMAX_CSR_CWMAX0 FIELD32(0x0000000f) -#define CWMAX_CSR_CWMAX1 FIELD32(0x000000f0) -#define CWMAX_CSR_CWMAX2 FIELD32(0x00000f00) -#define CWMAX_CSR_CWMAX3 FIELD32(0x0000f000) - -/* - * AC_TXOP_CSR0: AC_VO/AC_VI TXOP register. - * AC0_TX_OP: For AC_VO, in unit of 32us. - * AC1_TX_OP: For AC_VI, in unit of 32us. - */ -#define AC_TXOP_CSR0 0x040c -#define AC_TXOP_CSR0_AC0_TX_OP FIELD32(0x0000ffff) -#define AC_TXOP_CSR0_AC1_TX_OP FIELD32(0xffff0000) - -/* - * AC_TXOP_CSR1: AC_BE/AC_BK TXOP register. - * AC2_TX_OP: For AC_BE, in unit of 32us. - * AC3_TX_OP: For AC_BK, in unit of 32us. - */ -#define AC_TXOP_CSR1 0x0410 -#define AC_TXOP_CSR1_AC2_TX_OP FIELD32(0x0000ffff) -#define AC_TXOP_CSR1_AC3_TX_OP FIELD32(0xffff0000) - -/* - * BBP registers. - * The wordsize of the BBP is 8 bits. - */ - -/* - * R2 - */ -#define BBP_R2_BG_MODE FIELD8(0x20) - -/* - * R3 - */ -#define BBP_R3_SMART_MODE FIELD8(0x01) - -/* - * R4: RX antenna control - * FRAME_END: 1 - DPDT, 0 - SPDT (Only valid for 802.11G, RF2527 & RF2529) - */ - -/* - * ANTENNA_CONTROL semantics (guessed): - * 0x1: Software controlled antenna switching (fixed or SW diversity) - * 0x2: Hardware diversity. - */ -#define BBP_R4_RX_ANTENNA_CONTROL FIELD8(0x03) -#define BBP_R4_RX_FRAME_END FIELD8(0x20) - -/* - * R77 - */ -#define BBP_R77_RX_ANTENNA FIELD8(0x03) - -/* - * RF registers - */ - -/* - * RF 3 - */ -#define RF3_TXPOWER FIELD32(0x00003e00) - -/* - * RF 4 - */ -#define RF4_FREQ_OFFSET FIELD32(0x0003f000) - -/* - * EEPROM content. - * The wordsize of the EEPROM is 16 bits. - */ - -/* - * HW MAC address. - */ -#define EEPROM_MAC_ADDR_0 0x0002 -#define EEPROM_MAC_ADDR_BYTE0 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE1 FIELD16(0xff00) -#define EEPROM_MAC_ADDR1 0x0003 -#define EEPROM_MAC_ADDR_BYTE2 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE3 FIELD16(0xff00) -#define EEPROM_MAC_ADDR_2 0x0004 -#define EEPROM_MAC_ADDR_BYTE4 FIELD16(0x00ff) -#define EEPROM_MAC_ADDR_BYTE5 FIELD16(0xff00) - -/* - * EEPROM antenna. - * ANTENNA_NUM: Number of antennas. - * TX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B. - * RX_DEFAULT: Default antenna 0: diversity, 1: A, 2: B. - * FRAME_TYPE: 0: DPDT , 1: SPDT , noted this bit is valid for g only. - * DYN_TXAGC: Dynamic TX AGC control. - * HARDWARE_RADIO: 1: Hardware controlled radio. Read GPIO0. - * RF_TYPE: Rf_type of this adapter. - */ -#define EEPROM_ANTENNA 0x0010 -#define EEPROM_ANTENNA_NUM FIELD16(0x0003) -#define EEPROM_ANTENNA_TX_DEFAULT FIELD16(0x000c) -#define EEPROM_ANTENNA_RX_DEFAULT FIELD16(0x0030) -#define EEPROM_ANTENNA_FRAME_TYPE FIELD16(0x0040) -#define EEPROM_ANTENNA_DYN_TXAGC FIELD16(0x0200) -#define EEPROM_ANTENNA_HARDWARE_RADIO FIELD16(0x0400) -#define EEPROM_ANTENNA_RF_TYPE FIELD16(0xf800) - -/* - * EEPROM NIC config. - * EXTERNAL_LNA: External LNA. - */ -#define EEPROM_NIC 0x0011 -#define EEPROM_NIC_EXTERNAL_LNA FIELD16(0x0010) - -/* - * EEPROM geography. - * GEO_A: Default geographical setting for 5GHz band - * GEO: Default geographical setting. - */ -#define EEPROM_GEOGRAPHY 0x0012 -#define EEPROM_GEOGRAPHY_GEO_A FIELD16(0x00ff) -#define EEPROM_GEOGRAPHY_GEO FIELD16(0xff00) - -/* - * EEPROM BBP. - */ -#define EEPROM_BBP_START 0x0013 -#define EEPROM_BBP_SIZE 16 -#define EEPROM_BBP_VALUE FIELD16(0x00ff) -#define EEPROM_BBP_REG_ID FIELD16(0xff00) - -/* - * EEPROM TXPOWER 802.11G - */ -#define EEPROM_TXPOWER_G_START 0x0023 -#define EEPROM_TXPOWER_G_SIZE 7 -#define EEPROM_TXPOWER_G_1 FIELD16(0x00ff) -#define EEPROM_TXPOWER_G_2 FIELD16(0xff00) - -/* - * EEPROM Frequency - */ -#define EEPROM_FREQ 0x002f -#define EEPROM_FREQ_OFFSET FIELD16(0x00ff) -#define EEPROM_FREQ_SEQ_MASK FIELD16(0xff00) -#define EEPROM_FREQ_SEQ FIELD16(0x0300) - -/* - * EEPROM LED. - * POLARITY_RDY_G: Polarity RDY_G setting. - * POLARITY_RDY_A: Polarity RDY_A setting. - * POLARITY_ACT: Polarity ACT setting. - * POLARITY_GPIO_0: Polarity GPIO0 setting. - * POLARITY_GPIO_1: Polarity GPIO1 setting. - * POLARITY_GPIO_2: Polarity GPIO2 setting. - * POLARITY_GPIO_3: Polarity GPIO3 setting. - * POLARITY_GPIO_4: Polarity GPIO4 setting. - * LED_MODE: Led mode. - */ -#define EEPROM_LED 0x0030 -#define EEPROM_LED_POLARITY_RDY_G FIELD16(0x0001) -#define EEPROM_LED_POLARITY_RDY_A FIELD16(0x0002) -#define EEPROM_LED_POLARITY_ACT FIELD16(0x0004) -#define EEPROM_LED_POLARITY_GPIO_0 FIELD16(0x0008) -#define EEPROM_LED_POLARITY_GPIO_1 FIELD16(0x0010) -#define EEPROM_LED_POLARITY_GPIO_2 FIELD16(0x0020) -#define EEPROM_LED_POLARITY_GPIO_3 FIELD16(0x0040) -#define EEPROM_LED_POLARITY_GPIO_4 FIELD16(0x0080) -#define EEPROM_LED_LED_MODE FIELD16(0x1f00) - -/* - * EEPROM TXPOWER 802.11A - */ -#define EEPROM_TXPOWER_A_START 0x0031 -#define EEPROM_TXPOWER_A_SIZE 12 -#define EEPROM_TXPOWER_A_1 FIELD16(0x00ff) -#define EEPROM_TXPOWER_A_2 FIELD16(0xff00) - -/* - * EEPROM RSSI offset 802.11BG - */ -#define EEPROM_RSSI_OFFSET_BG 0x004d -#define EEPROM_RSSI_OFFSET_BG_1 FIELD16(0x00ff) -#define EEPROM_RSSI_OFFSET_BG_2 FIELD16(0xff00) - -/* - * EEPROM RSSI offset 802.11A - */ -#define EEPROM_RSSI_OFFSET_A 0x004e -#define EEPROM_RSSI_OFFSET_A_1 FIELD16(0x00ff) -#define EEPROM_RSSI_OFFSET_A_2 FIELD16(0xff00) - -/* - * DMA descriptor defines. - */ -#define TXD_DESC_SIZE ( 6 * sizeof(__le32) ) -#define TXINFO_SIZE ( 6 * sizeof(__le32) ) -#define RXD_DESC_SIZE ( 6 * sizeof(__le32) ) - -/* - * TX descriptor format for TX, PRIO and Beacon Ring. - */ - -/* - * Word0 - * BURST: Next frame belongs to same "burst" event. - * TKIP_MIC: ASIC appends TKIP MIC if TKIP is used. - * KEY_TABLE: Use per-client pairwise KEY table. - * KEY_INDEX: - * Key index (0~31) to the pairwise KEY table. - * 0~3 to shared KEY table 0 (BSS0). - * 4~7 to shared KEY table 1 (BSS1). - * 8~11 to shared KEY table 2 (BSS2). - * 12~15 to shared KEY table 3 (BSS3). - * BURST2: For backward compatibility, set to same value as BURST. - */ -#define TXD_W0_BURST FIELD32(0x00000001) -#define TXD_W0_VALID FIELD32(0x00000002) -#define TXD_W0_MORE_FRAG FIELD32(0x00000004) -#define TXD_W0_ACK FIELD32(0x00000008) -#define TXD_W0_TIMESTAMP FIELD32(0x00000010) -#define TXD_W0_OFDM FIELD32(0x00000020) -#define TXD_W0_IFS FIELD32(0x00000040) -#define TXD_W0_RETRY_MODE FIELD32(0x00000080) -#define TXD_W0_TKIP_MIC FIELD32(0x00000100) -#define TXD_W0_KEY_TABLE FIELD32(0x00000200) -#define TXD_W0_KEY_INDEX FIELD32(0x0000fc00) -#define TXD_W0_DATABYTE_COUNT FIELD32(0x0fff0000) -#define TXD_W0_BURST2 FIELD32(0x10000000) -#define TXD_W0_CIPHER_ALG FIELD32(0xe0000000) - -/* - * Word1 - * HOST_Q_ID: EDCA/HCCA queue ID. - * HW_SEQUENCE: MAC overwrites the frame sequence number. - * BUFFER_COUNT: Number of buffers in this TXD. - */ -#define TXD_W1_HOST_Q_ID FIELD32(0x0000000f) -#define TXD_W1_AIFSN FIELD32(0x000000f0) -#define TXD_W1_CWMIN FIELD32(0x00000f00) -#define TXD_W1_CWMAX FIELD32(0x0000f000) -#define TXD_W1_IV_OFFSET FIELD32(0x003f0000) -#define TXD_W1_HW_SEQUENCE FIELD32(0x10000000) -#define TXD_W1_BUFFER_COUNT FIELD32(0xe0000000) - -/* - * Word2: PLCP information - */ -#define TXD_W2_PLCP_SIGNAL FIELD32(0x000000ff) -#define TXD_W2_PLCP_SERVICE FIELD32(0x0000ff00) -#define TXD_W2_PLCP_LENGTH_LOW FIELD32(0x00ff0000) -#define TXD_W2_PLCP_LENGTH_HIGH FIELD32(0xff000000) - -/* - * Word3 - */ -#define TXD_W3_IV FIELD32(0xffffffff) - -/* - * Word4 - */ -#define TXD_W4_EIV FIELD32(0xffffffff) - -/* - * Word5 - * FRAME_OFFSET: Frame start offset inside ASIC TXFIFO (after TXINFO field). - * PACKET_ID: Driver assigned packet ID to categorize TXResult in interrupt. - * WAITING_DMA_DONE_INT: TXD been filled with data - * and waiting for TxDoneISR housekeeping. - */ -#define TXD_W5_FRAME_OFFSET FIELD32(0x000000ff) -#define TXD_W5_PACKET_ID FIELD32(0x0000ff00) -#define TXD_W5_TX_POWER FIELD32(0x00ff0000) -#define TXD_W5_WAITING_DMA_DONE_INT FIELD32(0x01000000) - -/* - * RX descriptor format for RX Ring. - */ - -/* - * Word0 - * CIPHER_ERROR: 1:ICV error, 2:MIC error, 3:invalid key. - * KEY_INDEX: Decryption key actually used. - */ -#define RXD_W0_OWNER_NIC FIELD32(0x00000001) -#define RXD_W0_DROP FIELD32(0x00000002) -#define RXD_W0_UNICAST_TO_ME FIELD32(0x00000004) -#define RXD_W0_MULTICAST FIELD32(0x00000008) -#define RXD_W0_BROADCAST FIELD32(0x00000010) -#define RXD_W0_MY_BSS FIELD32(0x00000020) -#define RXD_W0_CRC_ERROR FIELD32(0x00000040) -#define RXD_W0_OFDM FIELD32(0x00000080) -#define RXD_W0_CIPHER_ERROR FIELD32(0x00000300) -#define RXD_W0_KEY_INDEX FIELD32(0x0000fc00) -#define RXD_W0_DATABYTE_COUNT FIELD32(0x0fff0000) -#define RXD_W0_CIPHER_ALG FIELD32(0xe0000000) - -/* - * WORD1 - * SIGNAL: RX raw data rate reported by BBP. - * RSSI: RSSI reported by BBP. - */ -#define RXD_W1_SIGNAL FIELD32(0x000000ff) -#define RXD_W1_RSSI_AGC FIELD32(0x00001f00) -#define RXD_W1_RSSI_LNA FIELD32(0x00006000) -#define RXD_W1_FRAME_OFFSET FIELD32(0x7f000000) - -/* - * Word2 - * IV: Received IV of originally encrypted. - */ -#define RXD_W2_IV FIELD32(0xffffffff) - -/* - * Word3 - * EIV: Received EIV of originally encrypted. - */ -#define RXD_W3_EIV FIELD32(0xffffffff) - -/* - * Word4 - * ICV: Received ICV of originally encrypted. - * NOTE: This is a guess, the official definition is "reserved" - */ -#define RXD_W4_ICV FIELD32(0xffffffff) - -/* - * the above 20-byte is called RXINFO and will be DMAed to MAC RX block - * and passed to the HOST driver. - * The following fields are for DMA block and HOST usage only. - * Can't be touched by ASIC MAC block. - */ - -/* - * Word5 - */ -#define RXD_W5_RESERVED FIELD32(0xffffffff) - -/* - * Macros for converting txpower from EEPROM to mac80211 value - * and from mac80211 value to register value. - */ -#define MIN_TXPOWER 0 -#define MAX_TXPOWER 31 -#define DEFAULT_TXPOWER 24 - -#define TXPOWER_FROM_DEV(__txpower) \ - (((u8)(__txpower)) > MAX_TXPOWER) ? DEFAULT_TXPOWER : (__txpower) - -#define TXPOWER_TO_DEV(__txpower) \ - clamp_t(char, __txpower, MIN_TXPOWER, MAX_TXPOWER) - -#endif /* RT73USB_H */ diff --git a/drivers/net/wireless/rtl818x/Kconfig b/drivers/net/wireless/rtl818x/Kconfig deleted file mode 100644 index 30332175bcd8..000000000000 --- a/drivers/net/wireless/rtl818x/Kconfig +++ /dev/null @@ -1,88 +0,0 @@ -# -# RTL818X Wireless LAN device configuration -# -config RTL8180 - tristate "Realtek 8180/8185 PCI support" - depends on MAC80211 && PCI - select EEPROM_93CX6 - ---help--- - This is a driver for RTL8180 and RTL8185 based cards. - These are PCI based chips found in cards such as: - - (RTL8185 802.11g) - A-Link WL54PC - - (RTL8180 802.11b) - Belkin F5D6020 v3 - Belkin F5D6020 v3 - Dlink DWL-610 - Dlink DWL-510 - Netgear MA521 - Level-One WPC-0101 - Acer Aspire 1357 LMi - VCTnet PC-11B1 - Ovislink AirLive WL-1120PCM - Mentor WL-PCI - Linksys WPC11 v4 - TrendNET TEW-288PI - D-Link DWL-520 Rev D - Repotec RP-WP7126 - TP-Link TL-WN250/251 - Zonet ZEW1000 - Longshine LCS-8031-R - HomeLine HLW-PCC200 - GigaFast WF721-AEX - Planet WL-3553 - Encore ENLWI-PCI1-NT - TrendNET TEW-266PC - Gigabyte GN-WLMR101 - Siemens-fujitsu Amilo D1840W - Edimax EW-7126 - PheeNet WL-11PCIR - Tonze PC-2100T - Planet WL-8303 - Dlink DWL-650 v M1 - Edimax EW-7106 - Q-Tec 770WC - Topcom Skyr@cer 4011b - Roper FreeLan 802.11b (edition 2004) - Wistron Neweb Corp CB-200B - Pentagram HorNET - QTec 775WC - TwinMOS Booming B Series - Micronet SP906BB - Sweex LC700010 - Surecom EP-9428 - Safecom SWLCR-1100 - - Thanks to Realtek for their support! - -config RTL8187 - tristate "Realtek 8187 and 8187B USB support" - depends on MAC80211 && USB - select EEPROM_93CX6 - ---help--- - This is a driver for RTL8187 and RTL8187B based cards. - These are USB based chips found in devices such as: - - Netgear WG111v2 - Level 1 WNC-0301USB - Micronet SP907GK V5 - Encore ENUWI-G2 - Trendnet TEW-424UB - ASUS P5B Deluxe/P5K Premium motherboards - Toshiba Satellite Pro series of laptops - Asus Wireless Link - Linksys WUSB54GC-EU v2 - (v1 = rt73usb; v3 is rt2070-based, - use staging/rt3070 or try rt2800usb) - - Thanks to Realtek for their support! - -# If possible, automatically enable LEDs for RTL8187. - -config RTL8187_LEDS - bool - depends on RTL8187 && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = RTL8187) - default y - diff --git a/drivers/net/wireless/rtl818x/Makefile b/drivers/net/wireless/rtl818x/Makefile deleted file mode 100644 index 997569076923..000000000000 --- a/drivers/net/wireless/rtl818x/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -obj-$(CONFIG_RTL8180) += rtl8180/ -obj-$(CONFIG_RTL8187) += rtl8187/ diff --git a/drivers/net/wireless/rtl818x/rtl8180/Makefile b/drivers/net/wireless/rtl818x/rtl8180/Makefile deleted file mode 100644 index cb4fb8596f0b..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8180/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -rtl8180-objs := dev.o rtl8225.o sa2400.o max2820.o grf5101.o - -obj-$(CONFIG_RTL8180) += rtl8180.o - -ccflags-y += -Idrivers/net/wireless/rtl818x diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c deleted file mode 100644 index 91a04e2b8ece..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8180/dev.c +++ /dev/null @@ -1,1180 +0,0 @@ - -/* - * Linux device driver for RTL8180 / RTL8185 - * - * Copyright 2007 Michael Wu - * Copyright 2007 Andrea Merello - * - * Based on the r8180 driver, which is: - * Copyright 2004-2005 Andrea Merello , et al. - * - * Thanks to Realtek for their support! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rtl8180.h" -#include "rtl8225.h" -#include "sa2400.h" -#include "max2820.h" -#include "grf5101.h" - -MODULE_AUTHOR("Michael Wu "); -MODULE_AUTHOR("Andrea Merello "); -MODULE_DESCRIPTION("RTL8180 / RTL8185 PCI wireless driver"); -MODULE_LICENSE("GPL"); - -static DEFINE_PCI_DEVICE_TABLE(rtl8180_table) = { - /* rtl8185 */ - { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8185) }, - { PCI_DEVICE(PCI_VENDOR_ID_BELKIN, 0x700f) }, - { PCI_DEVICE(PCI_VENDOR_ID_BELKIN, 0x701f) }, - - /* rtl8180 */ - { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8180) }, - { PCI_DEVICE(0x1799, 0x6001) }, - { PCI_DEVICE(0x1799, 0x6020) }, - { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x3300) }, - { PCI_DEVICE(0x1186, 0x3301) }, - { PCI_DEVICE(0x1432, 0x7106) }, - { } -}; - -MODULE_DEVICE_TABLE(pci, rtl8180_table); - -static const struct ieee80211_rate rtl818x_rates[] = { - { .bitrate = 10, .hw_value = 0, }, - { .bitrate = 20, .hw_value = 1, }, - { .bitrate = 55, .hw_value = 2, }, - { .bitrate = 110, .hw_value = 3, }, - { .bitrate = 60, .hw_value = 4, }, - { .bitrate = 90, .hw_value = 5, }, - { .bitrate = 120, .hw_value = 6, }, - { .bitrate = 180, .hw_value = 7, }, - { .bitrate = 240, .hw_value = 8, }, - { .bitrate = 360, .hw_value = 9, }, - { .bitrate = 480, .hw_value = 10, }, - { .bitrate = 540, .hw_value = 11, }, -}; - -static const struct ieee80211_channel rtl818x_channels[] = { - { .center_freq = 2412 }, - { .center_freq = 2417 }, - { .center_freq = 2422 }, - { .center_freq = 2427 }, - { .center_freq = 2432 }, - { .center_freq = 2437 }, - { .center_freq = 2442 }, - { .center_freq = 2447 }, - { .center_freq = 2452 }, - { .center_freq = 2457 }, - { .center_freq = 2462 }, - { .center_freq = 2467 }, - { .center_freq = 2472 }, - { .center_freq = 2484 }, -}; - - -void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data) -{ - struct rtl8180_priv *priv = dev->priv; - int i = 10; - u32 buf; - - buf = (data << 8) | addr; - - rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->PHY[0], buf | 0x80); - while (i--) { - rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->PHY[0], buf); - if (rtl818x_ioread8(priv, &priv->map->PHY[2]) == (data & 0xFF)) - return; - } -} - -static void rtl8180_handle_rx(struct ieee80211_hw *dev) -{ - struct rtl8180_priv *priv = dev->priv; - unsigned int count = 32; - u8 signal, agc, sq; - - while (count--) { - struct rtl8180_rx_desc *entry = &priv->rx_ring[priv->rx_idx]; - struct sk_buff *skb = priv->rx_buf[priv->rx_idx]; - u32 flags = le32_to_cpu(entry->flags); - - if (flags & RTL818X_RX_DESC_FLAG_OWN) - return; - - if (unlikely(flags & (RTL818X_RX_DESC_FLAG_DMA_FAIL | - RTL818X_RX_DESC_FLAG_FOF | - RTL818X_RX_DESC_FLAG_RX_ERR))) - goto done; - else { - u32 flags2 = le32_to_cpu(entry->flags2); - struct ieee80211_rx_status rx_status = {0}; - struct sk_buff *new_skb = dev_alloc_skb(MAX_RX_SIZE); - - if (unlikely(!new_skb)) - goto done; - - pci_unmap_single(priv->pdev, - *((dma_addr_t *)skb->cb), - MAX_RX_SIZE, PCI_DMA_FROMDEVICE); - skb_put(skb, flags & 0xFFF); - - rx_status.antenna = (flags2 >> 15) & 1; - rx_status.rate_idx = (flags >> 20) & 0xF; - agc = (flags2 >> 17) & 0x7F; - if (priv->r8185) { - if (rx_status.rate_idx > 3) - signal = 90 - clamp_t(u8, agc, 25, 90); - else - signal = 95 - clamp_t(u8, agc, 30, 95); - } else { - sq = flags2 & 0xff; - signal = priv->rf->calc_rssi(agc, sq); - } - rx_status.signal = signal; - rx_status.freq = dev->conf.chandef.chan->center_freq; - rx_status.band = dev->conf.chandef.chan->band; - rx_status.mactime = le64_to_cpu(entry->tsft); - rx_status.flag |= RX_FLAG_MACTIME_START; - if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) - rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; - - memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); - ieee80211_rx_irqsafe(dev, skb); - - skb = new_skb; - priv->rx_buf[priv->rx_idx] = skb; - *((dma_addr_t *) skb->cb) = - pci_map_single(priv->pdev, skb_tail_pointer(skb), - MAX_RX_SIZE, PCI_DMA_FROMDEVICE); - } - - done: - entry->rx_buf = cpu_to_le32(*((dma_addr_t *)skb->cb)); - entry->flags = cpu_to_le32(RTL818X_RX_DESC_FLAG_OWN | - MAX_RX_SIZE); - if (priv->rx_idx == 31) - entry->flags |= cpu_to_le32(RTL818X_RX_DESC_FLAG_EOR); - priv->rx_idx = (priv->rx_idx + 1) % 32; - } -} - -static void rtl8180_handle_tx(struct ieee80211_hw *dev, unsigned int prio) -{ - struct rtl8180_priv *priv = dev->priv; - struct rtl8180_tx_ring *ring = &priv->tx_ring[prio]; - - while (skb_queue_len(&ring->queue)) { - struct rtl8180_tx_desc *entry = &ring->desc[ring->idx]; - struct sk_buff *skb; - struct ieee80211_tx_info *info; - u32 flags = le32_to_cpu(entry->flags); - - if (flags & RTL818X_TX_DESC_FLAG_OWN) - return; - - ring->idx = (ring->idx + 1) % ring->entries; - skb = __skb_dequeue(&ring->queue); - pci_unmap_single(priv->pdev, le32_to_cpu(entry->tx_buf), - skb->len, PCI_DMA_TODEVICE); - - info = IEEE80211_SKB_CB(skb); - ieee80211_tx_info_clear_status(info); - - if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) && - (flags & RTL818X_TX_DESC_FLAG_TX_OK)) - info->flags |= IEEE80211_TX_STAT_ACK; - - info->status.rates[0].count = (flags & 0xFF) + 1; - info->status.rates[1].idx = -1; - - ieee80211_tx_status_irqsafe(dev, skb); - if (ring->entries - skb_queue_len(&ring->queue) == 2) - ieee80211_wake_queue(dev, prio); - } -} - -static irqreturn_t rtl8180_interrupt(int irq, void *dev_id) -{ - struct ieee80211_hw *dev = dev_id; - struct rtl8180_priv *priv = dev->priv; - u16 reg; - - spin_lock(&priv->lock); - reg = rtl818x_ioread16(priv, &priv->map->INT_STATUS); - if (unlikely(reg == 0xFFFF)) { - spin_unlock(&priv->lock); - return IRQ_HANDLED; - } - - rtl818x_iowrite16(priv, &priv->map->INT_STATUS, reg); - - if (reg & (RTL818X_INT_TXB_OK | RTL818X_INT_TXB_ERR)) - rtl8180_handle_tx(dev, 3); - - if (reg & (RTL818X_INT_TXH_OK | RTL818X_INT_TXH_ERR)) - rtl8180_handle_tx(dev, 2); - - if (reg & (RTL818X_INT_TXN_OK | RTL818X_INT_TXN_ERR)) - rtl8180_handle_tx(dev, 1); - - if (reg & (RTL818X_INT_TXL_OK | RTL818X_INT_TXL_ERR)) - rtl8180_handle_tx(dev, 0); - - if (reg & (RTL818X_INT_RX_OK | RTL818X_INT_RX_ERR)) - rtl8180_handle_rx(dev); - - spin_unlock(&priv->lock); - - return IRQ_HANDLED; -} - -static void rtl8180_tx(struct ieee80211_hw *dev, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - struct rtl8180_priv *priv = dev->priv; - struct rtl8180_tx_ring *ring; - struct rtl8180_tx_desc *entry; - unsigned long flags; - unsigned int idx, prio; - dma_addr_t mapping; - u32 tx_flags; - u8 rc_flags; - u16 plcp_len = 0; - __le16 rts_duration = 0; - - prio = skb_get_queue_mapping(skb); - ring = &priv->tx_ring[prio]; - - mapping = pci_map_single(priv->pdev, skb->data, - skb->len, PCI_DMA_TODEVICE); - - tx_flags = RTL818X_TX_DESC_FLAG_OWN | RTL818X_TX_DESC_FLAG_FS | - RTL818X_TX_DESC_FLAG_LS | - (ieee80211_get_tx_rate(dev, info)->hw_value << 24) | - skb->len; - - if (priv->r8185) - tx_flags |= RTL818X_TX_DESC_FLAG_DMA | - RTL818X_TX_DESC_FLAG_NO_ENC; - - rc_flags = info->control.rates[0].flags; - if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) { - tx_flags |= RTL818X_TX_DESC_FLAG_RTS; - tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; - } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { - tx_flags |= RTL818X_TX_DESC_FLAG_CTS; - tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; - } - - if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) - rts_duration = ieee80211_rts_duration(dev, priv->vif, skb->len, - info); - - if (!priv->r8185) { - unsigned int remainder; - - plcp_len = DIV_ROUND_UP(16 * (skb->len + 4), - (ieee80211_get_tx_rate(dev, info)->bitrate * 2) / 10); - remainder = (16 * (skb->len + 4)) % - ((ieee80211_get_tx_rate(dev, info)->bitrate * 2) / 10); - if (remainder <= 6) - plcp_len |= 1 << 15; - } - - spin_lock_irqsave(&priv->lock, flags); - - if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { - if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) - priv->seqno += 0x10; - hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); - hdr->seq_ctrl |= cpu_to_le16(priv->seqno); - } - - idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries; - entry = &ring->desc[idx]; - - entry->rts_duration = rts_duration; - entry->plcp_len = cpu_to_le16(plcp_len); - entry->tx_buf = cpu_to_le32(mapping); - entry->frame_len = cpu_to_le32(skb->len); - entry->flags2 = info->control.rates[1].idx >= 0 ? - ieee80211_get_alt_retry_rate(dev, info, 0)->bitrate << 4 : 0; - entry->retry_limit = info->control.rates[0].count; - entry->flags = cpu_to_le32(tx_flags); - __skb_queue_tail(&ring->queue, skb); - if (ring->entries - skb_queue_len(&ring->queue) < 2) - ieee80211_stop_queue(dev, prio); - - spin_unlock_irqrestore(&priv->lock, flags); - - rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, (1 << (prio + 4))); -} - -void rtl8180_set_anaparam(struct rtl8180_priv *priv, u32 anaparam) -{ - u8 reg; - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); - rtl818x_iowrite8(priv, &priv->map->CONFIG3, - reg | RTL818X_CONFIG3_ANAPARAM_WRITE); - rtl818x_iowrite32(priv, &priv->map->ANAPARAM, anaparam); - rtl818x_iowrite8(priv, &priv->map->CONFIG3, - reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); -} - -static int rtl8180_init_hw(struct ieee80211_hw *dev) -{ - struct rtl8180_priv *priv = dev->priv; - u16 reg; - - rtl818x_iowrite8(priv, &priv->map->CMD, 0); - rtl818x_ioread8(priv, &priv->map->CMD); - msleep(10); - - /* reset */ - rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0); - rtl818x_ioread8(priv, &priv->map->CMD); - - reg = rtl818x_ioread8(priv, &priv->map->CMD); - reg &= (1 << 1); - reg |= RTL818X_CMD_RESET; - rtl818x_iowrite8(priv, &priv->map->CMD, RTL818X_CMD_RESET); - rtl818x_ioread8(priv, &priv->map->CMD); - msleep(200); - - /* check success of reset */ - if (rtl818x_ioread8(priv, &priv->map->CMD) & RTL818X_CMD_RESET) { - wiphy_err(dev->wiphy, "reset timeout!\n"); - return -ETIMEDOUT; - } - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_LOAD); - rtl818x_ioread8(priv, &priv->map->CMD); - msleep(200); - - if (rtl818x_ioread8(priv, &priv->map->CONFIG3) & (1 << 3)) { - /* For cardbus */ - reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); - reg |= 1 << 1; - rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg); - reg = rtl818x_ioread16(priv, &priv->map->FEMR); - reg |= (1 << 15) | (1 << 14) | (1 << 4); - rtl818x_iowrite16(priv, &priv->map->FEMR, reg); - } - - rtl818x_iowrite8(priv, &priv->map->MSR, 0); - - if (!priv->r8185) - rtl8180_set_anaparam(priv, priv->anaparam); - - rtl818x_iowrite32(priv, &priv->map->RDSAR, priv->rx_ring_dma); - rtl818x_iowrite32(priv, &priv->map->TBDA, priv->tx_ring[3].dma); - rtl818x_iowrite32(priv, &priv->map->THPDA, priv->tx_ring[2].dma); - rtl818x_iowrite32(priv, &priv->map->TNPDA, priv->tx_ring[1].dma); - rtl818x_iowrite32(priv, &priv->map->TLPDA, priv->tx_ring[0].dma); - - /* TODO: necessary? specs indicate not */ - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - reg = rtl818x_ioread8(priv, &priv->map->CONFIG2); - rtl818x_iowrite8(priv, &priv->map->CONFIG2, reg & ~(1 << 3)); - if (priv->r8185) { - reg = rtl818x_ioread8(priv, &priv->map->CONFIG2); - rtl818x_iowrite8(priv, &priv->map->CONFIG2, reg | (1 << 4)); - } - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); - - /* TODO: set CONFIG5 for calibrating AGC on rtl8180 + philips radio? */ - - /* TODO: turn off hw wep on rtl8180 */ - - rtl818x_iowrite32(priv, &priv->map->INT_TIMEOUT, 0); - - if (priv->r8185) { - rtl818x_iowrite8(priv, &priv->map->WPA_CONF, 0); - rtl818x_iowrite8(priv, &priv->map->RATE_FALLBACK, 0x81); - rtl818x_iowrite8(priv, &priv->map->RESP_RATE, (8 << 4) | 0); - - rtl818x_iowrite16(priv, &priv->map->BRSR, 0x01F3); - - /* TODO: set ClkRun enable? necessary? */ - reg = rtl818x_ioread8(priv, &priv->map->GP_ENABLE); - rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, reg & ~(1 << 6)); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); - rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | (1 << 2)); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); - } else { - rtl818x_iowrite16(priv, &priv->map->BRSR, 0x1); - rtl818x_iowrite8(priv, &priv->map->SECURITY, 0); - - rtl818x_iowrite8(priv, &priv->map->PHY_DELAY, 0x6); - rtl818x_iowrite8(priv, &priv->map->CARRIER_SENSE_COUNTER, 0x4C); - } - - priv->rf->init(dev); - if (priv->r8185) - rtl818x_iowrite16(priv, &priv->map->BRSR, 0x01F3); - return 0; -} - -static int rtl8180_init_rx_ring(struct ieee80211_hw *dev) -{ - struct rtl8180_priv *priv = dev->priv; - struct rtl8180_rx_desc *entry; - int i; - - priv->rx_ring = pci_alloc_consistent(priv->pdev, - sizeof(*priv->rx_ring) * 32, - &priv->rx_ring_dma); - - if (!priv->rx_ring || (unsigned long)priv->rx_ring & 0xFF) { - wiphy_err(dev->wiphy, "Cannot allocate RX ring\n"); - return -ENOMEM; - } - - memset(priv->rx_ring, 0, sizeof(*priv->rx_ring) * 32); - priv->rx_idx = 0; - - for (i = 0; i < 32; i++) { - struct sk_buff *skb = dev_alloc_skb(MAX_RX_SIZE); - dma_addr_t *mapping; - entry = &priv->rx_ring[i]; - if (!skb) - return 0; - - priv->rx_buf[i] = skb; - mapping = (dma_addr_t *)skb->cb; - *mapping = pci_map_single(priv->pdev, skb_tail_pointer(skb), - MAX_RX_SIZE, PCI_DMA_FROMDEVICE); - entry->rx_buf = cpu_to_le32(*mapping); - entry->flags = cpu_to_le32(RTL818X_RX_DESC_FLAG_OWN | - MAX_RX_SIZE); - } - entry->flags |= cpu_to_le32(RTL818X_RX_DESC_FLAG_EOR); - return 0; -} - -static void rtl8180_free_rx_ring(struct ieee80211_hw *dev) -{ - struct rtl8180_priv *priv = dev->priv; - int i; - - for (i = 0; i < 32; i++) { - struct sk_buff *skb = priv->rx_buf[i]; - if (!skb) - continue; - - pci_unmap_single(priv->pdev, - *((dma_addr_t *)skb->cb), - MAX_RX_SIZE, PCI_DMA_FROMDEVICE); - kfree_skb(skb); - } - - pci_free_consistent(priv->pdev, sizeof(*priv->rx_ring) * 32, - priv->rx_ring, priv->rx_ring_dma); - priv->rx_ring = NULL; -} - -static int rtl8180_init_tx_ring(struct ieee80211_hw *dev, - unsigned int prio, unsigned int entries) -{ - struct rtl8180_priv *priv = dev->priv; - struct rtl8180_tx_desc *ring; - dma_addr_t dma; - int i; - - ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma); - if (!ring || (unsigned long)ring & 0xFF) { - wiphy_err(dev->wiphy, "Cannot allocate TX ring (prio = %d)\n", - prio); - return -ENOMEM; - } - - memset(ring, 0, sizeof(*ring)*entries); - priv->tx_ring[prio].desc = ring; - priv->tx_ring[prio].dma = dma; - priv->tx_ring[prio].idx = 0; - priv->tx_ring[prio].entries = entries; - skb_queue_head_init(&priv->tx_ring[prio].queue); - - for (i = 0; i < entries; i++) - ring[i].next_tx_desc = - cpu_to_le32((u32)dma + ((i + 1) % entries) * sizeof(*ring)); - - return 0; -} - -static void rtl8180_free_tx_ring(struct ieee80211_hw *dev, unsigned int prio) -{ - struct rtl8180_priv *priv = dev->priv; - struct rtl8180_tx_ring *ring = &priv->tx_ring[prio]; - - while (skb_queue_len(&ring->queue)) { - struct rtl8180_tx_desc *entry = &ring->desc[ring->idx]; - struct sk_buff *skb = __skb_dequeue(&ring->queue); - - pci_unmap_single(priv->pdev, le32_to_cpu(entry->tx_buf), - skb->len, PCI_DMA_TODEVICE); - kfree_skb(skb); - ring->idx = (ring->idx + 1) % ring->entries; - } - - pci_free_consistent(priv->pdev, sizeof(*ring->desc)*ring->entries, - ring->desc, ring->dma); - ring->desc = NULL; -} - -static int rtl8180_start(struct ieee80211_hw *dev) -{ - struct rtl8180_priv *priv = dev->priv; - int ret, i; - u32 reg; - - ret = rtl8180_init_rx_ring(dev); - if (ret) - return ret; - - for (i = 0; i < 4; i++) - if ((ret = rtl8180_init_tx_ring(dev, i, 16))) - goto err_free_rings; - - ret = rtl8180_init_hw(dev); - if (ret) - goto err_free_rings; - - rtl818x_iowrite32(priv, &priv->map->RDSAR, priv->rx_ring_dma); - rtl818x_iowrite32(priv, &priv->map->TBDA, priv->tx_ring[3].dma); - rtl818x_iowrite32(priv, &priv->map->THPDA, priv->tx_ring[2].dma); - rtl818x_iowrite32(priv, &priv->map->TNPDA, priv->tx_ring[1].dma); - rtl818x_iowrite32(priv, &priv->map->TLPDA, priv->tx_ring[0].dma); - - ret = request_irq(priv->pdev->irq, rtl8180_interrupt, - IRQF_SHARED, KBUILD_MODNAME, dev); - if (ret) { - wiphy_err(dev->wiphy, "failed to register IRQ handler\n"); - goto err_free_rings; - } - - rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF); - - rtl818x_iowrite32(priv, &priv->map->MAR[0], ~0); - rtl818x_iowrite32(priv, &priv->map->MAR[1], ~0); - - reg = RTL818X_RX_CONF_ONLYERLPKT | - RTL818X_RX_CONF_RX_AUTORESETPHY | - RTL818X_RX_CONF_MGMT | - RTL818X_RX_CONF_DATA | - (7 << 8 /* MAX RX DMA */) | - RTL818X_RX_CONF_BROADCAST | - RTL818X_RX_CONF_NICMAC; - - if (priv->r8185) - reg |= RTL818X_RX_CONF_CSDM1 | RTL818X_RX_CONF_CSDM2; - else { - reg |= (priv->rfparam & RF_PARAM_CARRIERSENSE1) - ? RTL818X_RX_CONF_CSDM1 : 0; - reg |= (priv->rfparam & RF_PARAM_CARRIERSENSE2) - ? RTL818X_RX_CONF_CSDM2 : 0; - } - - priv->rx_conf = reg; - rtl818x_iowrite32(priv, &priv->map->RX_CONF, reg); - - if (priv->r8185) { - reg = rtl818x_ioread8(priv, &priv->map->CW_CONF); - reg &= ~RTL818X_CW_CONF_PERPACKET_CW_SHIFT; - reg |= RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT; - rtl818x_iowrite8(priv, &priv->map->CW_CONF, reg); - - reg = rtl818x_ioread8(priv, &priv->map->TX_AGC_CTL); - reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT; - reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT; - reg |= RTL818X_TX_AGC_CTL_FEEDBACK_ANT; - rtl818x_iowrite8(priv, &priv->map->TX_AGC_CTL, reg); - - /* disable early TX */ - rtl818x_iowrite8(priv, (u8 __iomem *)priv->map + 0xec, 0x3f); - } - - reg = rtl818x_ioread32(priv, &priv->map->TX_CONF); - reg |= (6 << 21 /* MAX TX DMA */) | - RTL818X_TX_CONF_NO_ICV; - - if (priv->r8185) - reg &= ~RTL818X_TX_CONF_PROBE_DTS; - else - reg &= ~RTL818X_TX_CONF_HW_SEQNUM; - - /* different meaning, same value on both rtl8185 and rtl8180 */ - reg &= ~RTL818X_TX_CONF_SAT_HWPLCP; - - rtl818x_iowrite32(priv, &priv->map->TX_CONF, reg); - - reg = rtl818x_ioread8(priv, &priv->map->CMD); - reg |= RTL818X_CMD_RX_ENABLE; - reg |= RTL818X_CMD_TX_ENABLE; - rtl818x_iowrite8(priv, &priv->map->CMD, reg); - - return 0; - - err_free_rings: - rtl8180_free_rx_ring(dev); - for (i = 0; i < 4; i++) - if (priv->tx_ring[i].desc) - rtl8180_free_tx_ring(dev, i); - - return ret; -} - -static void rtl8180_stop(struct ieee80211_hw *dev) -{ - struct rtl8180_priv *priv = dev->priv; - u8 reg; - int i; - - rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0); - - reg = rtl818x_ioread8(priv, &priv->map->CMD); - reg &= ~RTL818X_CMD_TX_ENABLE; - reg &= ~RTL818X_CMD_RX_ENABLE; - rtl818x_iowrite8(priv, &priv->map->CMD, reg); - - priv->rf->stop(dev); - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - reg = rtl818x_ioread8(priv, &priv->map->CONFIG4); - rtl818x_iowrite8(priv, &priv->map->CONFIG4, reg | RTL818X_CONFIG4_VCOOFF); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); - - free_irq(priv->pdev->irq, dev); - - rtl8180_free_rx_ring(dev); - for (i = 0; i < 4; i++) - rtl8180_free_tx_ring(dev, i); -} - -static u64 rtl8180_get_tsf(struct ieee80211_hw *dev, - struct ieee80211_vif *vif) -{ - struct rtl8180_priv *priv = dev->priv; - - return rtl818x_ioread32(priv, &priv->map->TSFT[0]) | - (u64)(rtl818x_ioread32(priv, &priv->map->TSFT[1])) << 32; -} - -static void rtl8180_beacon_work(struct work_struct *work) -{ - struct rtl8180_vif *vif_priv = - container_of(work, struct rtl8180_vif, beacon_work.work); - struct ieee80211_vif *vif = - container_of((void *)vif_priv, struct ieee80211_vif, drv_priv); - struct ieee80211_hw *dev = vif_priv->dev; - struct ieee80211_mgmt *mgmt; - struct sk_buff *skb; - - /* don't overflow the tx ring */ - if (ieee80211_queue_stopped(dev, 0)) - goto resched; - - /* grab a fresh beacon */ - skb = ieee80211_beacon_get(dev, vif); - if (!skb) - goto resched; - - /* - * update beacon timestamp w/ TSF value - * TODO: make hardware update beacon timestamp - */ - mgmt = (struct ieee80211_mgmt *)skb->data; - mgmt->u.beacon.timestamp = cpu_to_le64(rtl8180_get_tsf(dev, vif)); - - /* TODO: use actual beacon queue */ - skb_set_queue_mapping(skb, 0); - - rtl8180_tx(dev, NULL, skb); - -resched: - /* - * schedule next beacon - * TODO: use hardware support for beacon timing - */ - schedule_delayed_work(&vif_priv->beacon_work, - usecs_to_jiffies(1024 * vif->bss_conf.beacon_int)); -} - -static int rtl8180_add_interface(struct ieee80211_hw *dev, - struct ieee80211_vif *vif) -{ - struct rtl8180_priv *priv = dev->priv; - struct rtl8180_vif *vif_priv; - - /* - * We only support one active interface at a time. - */ - if (priv->vif) - return -EBUSY; - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_ADHOC: - break; - default: - return -EOPNOTSUPP; - } - - priv->vif = vif; - - /* Initialize driver private area */ - vif_priv = (struct rtl8180_vif *)&vif->drv_priv; - vif_priv->dev = dev; - INIT_DELAYED_WORK(&vif_priv->beacon_work, rtl8180_beacon_work); - vif_priv->enable_beacon = false; - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->MAC[0], - le32_to_cpu(*(__le32 *)vif->addr)); - rtl818x_iowrite16(priv, (__le16 __iomem *)&priv->map->MAC[4], - le16_to_cpu(*(__le16 *)(vif->addr + 4))); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); - - return 0; -} - -static void rtl8180_remove_interface(struct ieee80211_hw *dev, - struct ieee80211_vif *vif) -{ - struct rtl8180_priv *priv = dev->priv; - priv->vif = NULL; -} - -static int rtl8180_config(struct ieee80211_hw *dev, u32 changed) -{ - struct rtl8180_priv *priv = dev->priv; - struct ieee80211_conf *conf = &dev->conf; - - priv->rf->set_chan(dev, conf); - - return 0; -} - -static void rtl8180_bss_info_changed(struct ieee80211_hw *dev, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *info, - u32 changed) -{ - struct rtl8180_priv *priv = dev->priv; - struct rtl8180_vif *vif_priv; - int i; - u8 reg; - - vif_priv = (struct rtl8180_vif *)&vif->drv_priv; - - if (changed & BSS_CHANGED_BSSID) { - for (i = 0; i < ETH_ALEN; i++) - rtl818x_iowrite8(priv, &priv->map->BSSID[i], - info->bssid[i]); - - if (is_valid_ether_addr(info->bssid)) { - if (vif->type == NL80211_IFTYPE_ADHOC) - reg = RTL818X_MSR_ADHOC; - else - reg = RTL818X_MSR_INFRA; - } else - reg = RTL818X_MSR_NO_LINK; - rtl818x_iowrite8(priv, &priv->map->MSR, reg); - } - - if (changed & BSS_CHANGED_ERP_SLOT && priv->rf->conf_erp) - priv->rf->conf_erp(dev, info); - - if (changed & BSS_CHANGED_BEACON_ENABLED) - vif_priv->enable_beacon = info->enable_beacon; - - if (changed & (BSS_CHANGED_BEACON_ENABLED | BSS_CHANGED_BEACON)) { - cancel_delayed_work_sync(&vif_priv->beacon_work); - if (vif_priv->enable_beacon) - schedule_work(&vif_priv->beacon_work.work); - } -} - -static u64 rtl8180_prepare_multicast(struct ieee80211_hw *dev, - struct netdev_hw_addr_list *mc_list) -{ - return netdev_hw_addr_list_count(mc_list); -} - -static void rtl8180_configure_filter(struct ieee80211_hw *dev, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast) -{ - struct rtl8180_priv *priv = dev->priv; - - if (changed_flags & FIF_FCSFAIL) - priv->rx_conf ^= RTL818X_RX_CONF_FCS; - if (changed_flags & FIF_CONTROL) - priv->rx_conf ^= RTL818X_RX_CONF_CTRL; - if (changed_flags & FIF_OTHER_BSS) - priv->rx_conf ^= RTL818X_RX_CONF_MONITOR; - if (*total_flags & FIF_ALLMULTI || multicast > 0) - priv->rx_conf |= RTL818X_RX_CONF_MULTICAST; - else - priv->rx_conf &= ~RTL818X_RX_CONF_MULTICAST; - - *total_flags = 0; - - if (priv->rx_conf & RTL818X_RX_CONF_FCS) - *total_flags |= FIF_FCSFAIL; - if (priv->rx_conf & RTL818X_RX_CONF_CTRL) - *total_flags |= FIF_CONTROL; - if (priv->rx_conf & RTL818X_RX_CONF_MONITOR) - *total_flags |= FIF_OTHER_BSS; - if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST) - *total_flags |= FIF_ALLMULTI; - - rtl818x_iowrite32(priv, &priv->map->RX_CONF, priv->rx_conf); -} - -static const struct ieee80211_ops rtl8180_ops = { - .tx = rtl8180_tx, - .start = rtl8180_start, - .stop = rtl8180_stop, - .add_interface = rtl8180_add_interface, - .remove_interface = rtl8180_remove_interface, - .config = rtl8180_config, - .bss_info_changed = rtl8180_bss_info_changed, - .prepare_multicast = rtl8180_prepare_multicast, - .configure_filter = rtl8180_configure_filter, - .get_tsf = rtl8180_get_tsf, -}; - -static void rtl8180_eeprom_register_read(struct eeprom_93cx6 *eeprom) -{ - struct ieee80211_hw *dev = eeprom->data; - struct rtl8180_priv *priv = dev->priv; - u8 reg = rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - - eeprom->reg_data_in = reg & RTL818X_EEPROM_CMD_WRITE; - eeprom->reg_data_out = reg & RTL818X_EEPROM_CMD_READ; - eeprom->reg_data_clock = reg & RTL818X_EEPROM_CMD_CK; - eeprom->reg_chip_select = reg & RTL818X_EEPROM_CMD_CS; -} - -static void rtl8180_eeprom_register_write(struct eeprom_93cx6 *eeprom) -{ - struct ieee80211_hw *dev = eeprom->data; - struct rtl8180_priv *priv = dev->priv; - u8 reg = 2 << 6; - - if (eeprom->reg_data_in) - reg |= RTL818X_EEPROM_CMD_WRITE; - if (eeprom->reg_data_out) - reg |= RTL818X_EEPROM_CMD_READ; - if (eeprom->reg_data_clock) - reg |= RTL818X_EEPROM_CMD_CK; - if (eeprom->reg_chip_select) - reg |= RTL818X_EEPROM_CMD_CS; - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, reg); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(10); -} - -static int rtl8180_probe(struct pci_dev *pdev, - const struct pci_device_id *id) -{ - struct ieee80211_hw *dev; - struct rtl8180_priv *priv; - unsigned long mem_addr, mem_len; - unsigned int io_addr, io_len; - int err, i; - struct eeprom_93cx6 eeprom; - const char *chip_name, *rf_name = NULL; - u32 reg; - u16 eeprom_val; - u8 mac_addr[ETH_ALEN]; - - err = pci_enable_device(pdev); - if (err) { - printk(KERN_ERR "%s (rtl8180): Cannot enable new PCI device\n", - pci_name(pdev)); - return err; - } - - err = pci_request_regions(pdev, KBUILD_MODNAME); - if (err) { - printk(KERN_ERR "%s (rtl8180): Cannot obtain PCI resources\n", - pci_name(pdev)); - return err; - } - - io_addr = pci_resource_start(pdev, 0); - io_len = pci_resource_len(pdev, 0); - mem_addr = pci_resource_start(pdev, 1); - mem_len = pci_resource_len(pdev, 1); - - if (mem_len < sizeof(struct rtl818x_csr) || - io_len < sizeof(struct rtl818x_csr)) { - printk(KERN_ERR "%s (rtl8180): Too short PCI resources\n", - pci_name(pdev)); - err = -ENOMEM; - goto err_free_reg; - } - - if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) || - (err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))) { - printk(KERN_ERR "%s (rtl8180): No suitable DMA available\n", - pci_name(pdev)); - goto err_free_reg; - } - - pci_set_master(pdev); - - dev = ieee80211_alloc_hw(sizeof(*priv), &rtl8180_ops); - if (!dev) { - printk(KERN_ERR "%s (rtl8180): ieee80211 alloc failed\n", - pci_name(pdev)); - err = -ENOMEM; - goto err_free_reg; - } - - priv = dev->priv; - priv->pdev = pdev; - - dev->max_rates = 2; - SET_IEEE80211_DEV(dev, &pdev->dev); - pci_set_drvdata(pdev, dev); - - priv->map = pci_iomap(pdev, 1, mem_len); - if (!priv->map) - priv->map = pci_iomap(pdev, 0, io_len); - - if (!priv->map) { - printk(KERN_ERR "%s (rtl8180): Cannot map device memory\n", - pci_name(pdev)); - goto err_free_dev; - } - - BUILD_BUG_ON(sizeof(priv->channels) != sizeof(rtl818x_channels)); - BUILD_BUG_ON(sizeof(priv->rates) != sizeof(rtl818x_rates)); - - memcpy(priv->channels, rtl818x_channels, sizeof(rtl818x_channels)); - memcpy(priv->rates, rtl818x_rates, sizeof(rtl818x_rates)); - - priv->band.band = IEEE80211_BAND_2GHZ; - priv->band.channels = priv->channels; - priv->band.n_channels = ARRAY_SIZE(rtl818x_channels); - priv->band.bitrates = priv->rates; - priv->band.n_bitrates = 4; - dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band; - - dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | - IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_SIGNAL_UNSPEC; - dev->vif_data_size = sizeof(struct rtl8180_vif); - dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC); - dev->queues = 1; - dev->max_signal = 65; - - reg = rtl818x_ioread32(priv, &priv->map->TX_CONF); - reg &= RTL818X_TX_CONF_HWVER_MASK; - switch (reg) { - case RTL818X_TX_CONF_R8180_ABCD: - chip_name = "RTL8180"; - break; - case RTL818X_TX_CONF_R8180_F: - chip_name = "RTL8180vF"; - break; - case RTL818X_TX_CONF_R8185_ABC: - chip_name = "RTL8185"; - break; - case RTL818X_TX_CONF_R8185_D: - chip_name = "RTL8185vD"; - break; - default: - printk(KERN_ERR "%s (rtl8180): Unknown chip! (0x%x)\n", - pci_name(pdev), reg >> 25); - goto err_iounmap; - } - - priv->r8185 = reg & RTL818X_TX_CONF_R8185_ABC; - if (priv->r8185) { - priv->band.n_bitrates = ARRAY_SIZE(rtl818x_rates); - pci_try_set_mwi(pdev); - } - - eeprom.data = dev; - eeprom.register_read = rtl8180_eeprom_register_read; - eeprom.register_write = rtl8180_eeprom_register_write; - if (rtl818x_ioread32(priv, &priv->map->RX_CONF) & (1 << 6)) - eeprom.width = PCI_EEPROM_WIDTH_93C66; - else - eeprom.width = PCI_EEPROM_WIDTH_93C46; - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_PROGRAM); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(10); - - eeprom_93cx6_read(&eeprom, 0x06, &eeprom_val); - eeprom_val &= 0xFF; - switch (eeprom_val) { - case 1: rf_name = "Intersil"; - break; - case 2: rf_name = "RFMD"; - break; - case 3: priv->rf = &sa2400_rf_ops; - break; - case 4: priv->rf = &max2820_rf_ops; - break; - case 5: priv->rf = &grf5101_rf_ops; - break; - case 9: priv->rf = rtl8180_detect_rf(dev); - break; - case 10: - rf_name = "RTL8255"; - break; - default: - printk(KERN_ERR "%s (rtl8180): Unknown RF! (0x%x)\n", - pci_name(pdev), eeprom_val); - goto err_iounmap; - } - - if (!priv->rf) { - printk(KERN_ERR "%s (rtl8180): %s RF frontend not supported!\n", - pci_name(pdev), rf_name); - goto err_iounmap; - } - - eeprom_93cx6_read(&eeprom, 0x17, &eeprom_val); - priv->csthreshold = eeprom_val >> 8; - if (!priv->r8185) { - __le32 anaparam; - eeprom_93cx6_multiread(&eeprom, 0xD, (__le16 *)&anaparam, 2); - priv->anaparam = le32_to_cpu(anaparam); - eeprom_93cx6_read(&eeprom, 0x19, &priv->rfparam); - } - - eeprom_93cx6_multiread(&eeprom, 0x7, (__le16 *)mac_addr, 3); - if (!is_valid_ether_addr(mac_addr)) { - printk(KERN_WARNING "%s (rtl8180): Invalid hwaddr! Using" - " randomly generated MAC addr\n", pci_name(pdev)); - eth_random_addr(mac_addr); - } - SET_IEEE80211_PERM_ADDR(dev, mac_addr); - - /* CCK TX power */ - for (i = 0; i < 14; i += 2) { - u16 txpwr; - eeprom_93cx6_read(&eeprom, 0x10 + (i >> 1), &txpwr); - priv->channels[i].hw_value = txpwr & 0xFF; - priv->channels[i + 1].hw_value = txpwr >> 8; - } - - /* OFDM TX power */ - if (priv->r8185) { - for (i = 0; i < 14; i += 2) { - u16 txpwr; - eeprom_93cx6_read(&eeprom, 0x20 + (i >> 1), &txpwr); - priv->channels[i].hw_value |= (txpwr & 0xFF) << 8; - priv->channels[i + 1].hw_value |= txpwr & 0xFF00; - } - } - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); - - spin_lock_init(&priv->lock); - - err = ieee80211_register_hw(dev); - if (err) { - printk(KERN_ERR "%s (rtl8180): Cannot register device\n", - pci_name(pdev)); - goto err_iounmap; - } - - wiphy_info(dev->wiphy, "hwaddr %pm, %s + %s\n", - mac_addr, chip_name, priv->rf->name); - - return 0; - - err_iounmap: - iounmap(priv->map); - - err_free_dev: - pci_set_drvdata(pdev, NULL); - ieee80211_free_hw(dev); - - err_free_reg: - pci_release_regions(pdev); - pci_disable_device(pdev); - return err; -} - -static void rtl8180_remove(struct pci_dev *pdev) -{ - struct ieee80211_hw *dev = pci_get_drvdata(pdev); - struct rtl8180_priv *priv; - - if (!dev) - return; - - ieee80211_unregister_hw(dev); - - priv = dev->priv; - - pci_iounmap(pdev, priv->map); - pci_release_regions(pdev); - pci_disable_device(pdev); - ieee80211_free_hw(dev); -} - -#ifdef CONFIG_PM -static int rtl8180_suspend(struct pci_dev *pdev, pm_message_t state) -{ - pci_save_state(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); - return 0; -} - -static int rtl8180_resume(struct pci_dev *pdev) -{ - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); - return 0; -} - -#endif /* CONFIG_PM */ - -static struct pci_driver rtl8180_driver = { - .name = KBUILD_MODNAME, - .id_table = rtl8180_table, - .probe = rtl8180_probe, - .remove = rtl8180_remove, -#ifdef CONFIG_PM - .suspend = rtl8180_suspend, - .resume = rtl8180_resume, -#endif /* CONFIG_PM */ -}; - -module_pci_driver(rtl8180_driver); diff --git a/drivers/net/wireless/rtl818x/rtl8180/grf5101.c b/drivers/net/wireless/rtl818x/rtl8180/grf5101.c deleted file mode 100644 index 077ff92cc139..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8180/grf5101.c +++ /dev/null @@ -1,191 +0,0 @@ - -/* - * Radio tuning for GCT GRF5101 on RTL8180 - * - * Copyright 2007 Andrea Merello - * - * Code from the BSD driver and the rtl8181 project have been - * very useful to understand certain things - * - * I want to thanks the Authors of such projects and the Ndiswrapper - * project Authors. - * - * A special Big Thanks also is for all people who donated me cards, - * making possible the creation of the original rtl8180 driver - * from which this code is derived! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include - -#include "rtl8180.h" -#include "grf5101.h" - -static const int grf5101_encode[] = { - 0x0, 0x8, 0x4, 0xC, - 0x2, 0xA, 0x6, 0xE, - 0x1, 0x9, 0x5, 0xD, - 0x3, 0xB, 0x7, 0xF -}; - -static void write_grf5101(struct ieee80211_hw *dev, u8 addr, u32 data) -{ - struct rtl8180_priv *priv = dev->priv; - u32 phy_config; - - phy_config = grf5101_encode[(data >> 8) & 0xF]; - phy_config |= grf5101_encode[(data >> 4) & 0xF] << 4; - phy_config |= grf5101_encode[data & 0xF] << 8; - phy_config |= grf5101_encode[(addr >> 1) & 0xF] << 12; - phy_config |= (addr & 1) << 16; - phy_config |= grf5101_encode[(data & 0xf000) >> 12] << 24; - - /* MAC will bang bits to the chip */ - phy_config |= 0x90000000; - - rtl818x_iowrite32(priv, - (__le32 __iomem *) &priv->map->RFPinsOutput, phy_config); - - msleep(3); -} - -static void grf5101_write_phy_antenna(struct ieee80211_hw *dev, short chan) -{ - struct rtl8180_priv *priv = dev->priv; - u8 ant = GRF5101_ANTENNA; - - if (priv->rfparam & RF_PARAM_ANTBDEFAULT) - ant |= BB_ANTENNA_B; - - if (chan == 14) - ant |= BB_ANTATTEN_CHAN14; - - rtl8180_write_phy(dev, 0x10, ant); -} - -static u8 grf5101_rf_calc_rssi(u8 agc, u8 sq) -{ - if (agc > 60) - return 65; - - /* TODO(?): just return agc (or agc + 5) to avoid mult / div */ - return 65 * agc / 60; -} - -static void grf5101_rf_set_channel(struct ieee80211_hw *dev, - struct ieee80211_conf *conf) -{ - struct rtl8180_priv *priv = dev->priv; - int channel = - ieee80211_frequency_to_channel(conf->chandef.chan->center_freq); - u32 txpw = priv->channels[channel - 1].hw_value & 0xFF; - u32 chan = channel - 1; - - /* set TX power */ - write_grf5101(dev, 0x15, 0x0); - write_grf5101(dev, 0x06, txpw); - write_grf5101(dev, 0x15, 0x10); - write_grf5101(dev, 0x15, 0x0); - - /* set frequency */ - write_grf5101(dev, 0x07, 0x0); - write_grf5101(dev, 0x0B, chan); - write_grf5101(dev, 0x07, 0x1000); - - grf5101_write_phy_antenna(dev, channel); -} - -static void grf5101_rf_stop(struct ieee80211_hw *dev) -{ - struct rtl8180_priv *priv = dev->priv; - u32 anaparam; - - anaparam = priv->anaparam; - anaparam &= 0x000fffff; - anaparam |= 0x3f900000; - rtl8180_set_anaparam(priv, anaparam); - - write_grf5101(dev, 0x07, 0x0); - write_grf5101(dev, 0x1f, 0x45); - write_grf5101(dev, 0x1f, 0x5); - write_grf5101(dev, 0x00, 0x8e4); -} - -static void grf5101_rf_init(struct ieee80211_hw *dev) -{ - struct rtl8180_priv *priv = dev->priv; - - rtl8180_set_anaparam(priv, priv->anaparam); - - write_grf5101(dev, 0x1f, 0x0); - write_grf5101(dev, 0x1f, 0x0); - write_grf5101(dev, 0x1f, 0x40); - write_grf5101(dev, 0x1f, 0x60); - write_grf5101(dev, 0x1f, 0x61); - write_grf5101(dev, 0x1f, 0x61); - write_grf5101(dev, 0x00, 0xae4); - write_grf5101(dev, 0x1f, 0x1); - write_grf5101(dev, 0x1f, 0x41); - write_grf5101(dev, 0x1f, 0x61); - - write_grf5101(dev, 0x01, 0x1a23); - write_grf5101(dev, 0x02, 0x4971); - write_grf5101(dev, 0x03, 0x41de); - write_grf5101(dev, 0x04, 0x2d80); - write_grf5101(dev, 0x05, 0x68ff); /* 0x61ff original value */ - write_grf5101(dev, 0x06, 0x0); - write_grf5101(dev, 0x07, 0x0); - write_grf5101(dev, 0x08, 0x7533); - write_grf5101(dev, 0x09, 0xc401); - write_grf5101(dev, 0x0a, 0x0); - write_grf5101(dev, 0x0c, 0x1c7); - write_grf5101(dev, 0x0d, 0x29d3); - write_grf5101(dev, 0x0e, 0x2e8); - write_grf5101(dev, 0x10, 0x192); - write_grf5101(dev, 0x11, 0x248); - write_grf5101(dev, 0x12, 0x0); - write_grf5101(dev, 0x13, 0x20c4); - write_grf5101(dev, 0x14, 0xf4fc); - write_grf5101(dev, 0x15, 0x0); - write_grf5101(dev, 0x16, 0x1500); - - write_grf5101(dev, 0x07, 0x1000); - - /* baseband configuration */ - rtl8180_write_phy(dev, 0, 0xa8); - rtl8180_write_phy(dev, 3, 0x0); - rtl8180_write_phy(dev, 4, 0xc0); - rtl8180_write_phy(dev, 5, 0x90); - rtl8180_write_phy(dev, 6, 0x1e); - rtl8180_write_phy(dev, 7, 0x64); - - grf5101_write_phy_antenna(dev, 1); - - rtl8180_write_phy(dev, 0x11, 0x88); - - if (rtl818x_ioread8(priv, &priv->map->CONFIG2) & - RTL818X_CONFIG2_ANTENNA_DIV) - rtl8180_write_phy(dev, 0x12, 0xc0); /* enable ant diversity */ - else - rtl8180_write_phy(dev, 0x12, 0x40); /* disable ant diversity */ - - rtl8180_write_phy(dev, 0x13, 0x90 | priv->csthreshold); - - rtl8180_write_phy(dev, 0x19, 0x0); - rtl8180_write_phy(dev, 0x1a, 0xa0); - rtl8180_write_phy(dev, 0x1b, 0x44); -} - -const struct rtl818x_rf_ops grf5101_rf_ops = { - .name = "GCT", - .init = grf5101_rf_init, - .stop = grf5101_rf_stop, - .set_chan = grf5101_rf_set_channel, - .calc_rssi = grf5101_rf_calc_rssi, -}; diff --git a/drivers/net/wireless/rtl818x/rtl8180/grf5101.h b/drivers/net/wireless/rtl818x/rtl8180/grf5101.h deleted file mode 100644 index 76647111bcff..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8180/grf5101.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef RTL8180_GRF5101_H -#define RTL8180_GRF5101_H - -/* - * Radio tuning for GCT GRF5101 on RTL8180 - * - * Copyright 2007 Andrea Merello - * - * Code from the BSD driver and the rtl8181 project have been - * very useful to understand certain things - * - * I want to thanks the Authors of such projects and the Ndiswrapper - * project Authors. - * - * A special Big Thanks also is for all people who donated me cards, - * making possible the creation of the original rtl8180 driver - * from which this code is derived! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#define GRF5101_ANTENNA 0xA3 - -extern const struct rtl818x_rf_ops grf5101_rf_ops; - -#endif /* RTL8180_GRF5101_H */ diff --git a/drivers/net/wireless/rtl818x/rtl8180/max2820.c b/drivers/net/wireless/rtl818x/rtl8180/max2820.c deleted file mode 100644 index 4715000c94dd..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8180/max2820.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Radio tuning for Maxim max2820 on RTL8180 - * - * Copyright 2007 Andrea Merello - * - * Code from the BSD driver and the rtl8181 project have been - * very useful to understand certain things - * - * I want to thanks the Authors of such projects and the Ndiswrapper - * project Authors. - * - * A special Big Thanks also is for all people who donated me cards, - * making possible the creation of the original rtl8180 driver - * from which this code is derived! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include - -#include "rtl8180.h" -#include "max2820.h" - -static const u32 max2820_chan[] = { - 12, /* CH 1 */ - 17, - 22, - 27, - 32, - 37, - 42, - 47, - 52, - 57, - 62, - 67, - 72, - 84, /* CH 14 */ -}; - -static void write_max2820(struct ieee80211_hw *dev, u8 addr, u32 data) -{ - struct rtl8180_priv *priv = dev->priv; - u32 phy_config; - - phy_config = 0x90 + (data & 0xf); - phy_config <<= 16; - phy_config += addr; - phy_config <<= 8; - phy_config += (data >> 4) & 0xff; - - rtl818x_iowrite32(priv, - (__le32 __iomem *) &priv->map->RFPinsOutput, phy_config); - - msleep(1); -} - -static void max2820_write_phy_antenna(struct ieee80211_hw *dev, short chan) -{ - struct rtl8180_priv *priv = dev->priv; - u8 ant; - - ant = MAXIM_ANTENNA; - if (priv->rfparam & RF_PARAM_ANTBDEFAULT) - ant |= BB_ANTENNA_B; - if (chan == 14) - ant |= BB_ANTATTEN_CHAN14; - - rtl8180_write_phy(dev, 0x10, ant); -} - -static u8 max2820_rf_calc_rssi(u8 agc, u8 sq) -{ - bool odd; - - odd = !!(agc & 1); - - agc >>= 1; - if (odd) - agc += 76; - else - agc += 66; - - /* TODO: change addends above to avoid mult / div below */ - return 65 * agc / 100; -} - -static void max2820_rf_set_channel(struct ieee80211_hw *dev, - struct ieee80211_conf *conf) -{ - struct rtl8180_priv *priv = dev->priv; - int channel = conf ? - ieee80211_frequency_to_channel(conf->chandef.chan->center_freq) : 1; - unsigned int chan_idx = channel - 1; - u32 txpw = priv->channels[chan_idx].hw_value & 0xFF; - u32 chan = max2820_chan[chan_idx]; - - /* While philips SA2400 drive the PA bias from - * sa2400, for MAXIM we do this directly from BB */ - rtl8180_write_phy(dev, 3, txpw); - - max2820_write_phy_antenna(dev, channel); - write_max2820(dev, 3, chan); -} - -static void max2820_rf_stop(struct ieee80211_hw *dev) -{ - rtl8180_write_phy(dev, 3, 0x8); - write_max2820(dev, 1, 0); -} - - -static void max2820_rf_init(struct ieee80211_hw *dev) -{ - struct rtl8180_priv *priv = dev->priv; - - /* MAXIM from netbsd driver */ - write_max2820(dev, 0, 0x007); /* test mode as indicated in datasheet */ - write_max2820(dev, 1, 0x01e); /* enable register */ - write_max2820(dev, 2, 0x001); /* synt register */ - - max2820_rf_set_channel(dev, NULL); - - write_max2820(dev, 4, 0x313); /* rx register */ - - /* PA is driven directly by the BB, we keep the MAXIM bias - * at the highest value in case that setting it to lower - * values may introduce some further attenuation somewhere.. - */ - write_max2820(dev, 5, 0x00f); - - /* baseband configuration */ - rtl8180_write_phy(dev, 0, 0x88); /* sys1 */ - rtl8180_write_phy(dev, 3, 0x08); /* txagc */ - rtl8180_write_phy(dev, 4, 0xf8); /* lnadet */ - rtl8180_write_phy(dev, 5, 0x90); /* ifagcinit */ - rtl8180_write_phy(dev, 6, 0x1a); /* ifagclimit */ - rtl8180_write_phy(dev, 7, 0x64); /* ifagcdet */ - - max2820_write_phy_antenna(dev, 1); - - rtl8180_write_phy(dev, 0x11, 0x88); /* trl */ - - if (rtl818x_ioread8(priv, &priv->map->CONFIG2) & - RTL818X_CONFIG2_ANTENNA_DIV) - rtl8180_write_phy(dev, 0x12, 0xc7); - else - rtl8180_write_phy(dev, 0x12, 0x47); - - rtl8180_write_phy(dev, 0x13, 0x9b); - - rtl8180_write_phy(dev, 0x19, 0x0); /* CHESTLIM */ - rtl8180_write_phy(dev, 0x1a, 0x9f); /* CHSQLIM */ - - max2820_rf_set_channel(dev, NULL); -} - -const struct rtl818x_rf_ops max2820_rf_ops = { - .name = "Maxim", - .init = max2820_rf_init, - .stop = max2820_rf_stop, - .set_chan = max2820_rf_set_channel, - .calc_rssi = max2820_rf_calc_rssi, -}; diff --git a/drivers/net/wireless/rtl818x/rtl8180/max2820.h b/drivers/net/wireless/rtl818x/rtl8180/max2820.h deleted file mode 100644 index 61cf6d1e7d57..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8180/max2820.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef RTL8180_MAX2820_H -#define RTL8180_MAX2820_H - -/* - * Radio tuning for Maxim max2820 on RTL8180 - * - * Copyright 2007 Andrea Merello - * - * Code from the BSD driver and the rtl8181 project have been - * very useful to understand certain things - * - * I want to thanks the Authors of such projects and the Ndiswrapper - * project Authors. - * - * A special Big Thanks also is for all people who donated me cards, - * making possible the creation of the original rtl8180 driver - * from which this code is derived! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#define MAXIM_ANTENNA 0xb3 - -extern const struct rtl818x_rf_ops max2820_rf_ops; - -#endif /* RTL8180_MAX2820_H */ diff --git a/drivers/net/wireless/rtl818x/rtl8180/rtl8180.h b/drivers/net/wireless/rtl818x/rtl8180/rtl8180.h deleted file mode 100644 index 30523314da43..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8180/rtl8180.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef RTL8180_H -#define RTL8180_H - -#include "rtl818x.h" - -#define MAX_RX_SIZE IEEE80211_MAX_RTS_THRESHOLD - -#define RF_PARAM_ANALOGPHY (1 << 0) -#define RF_PARAM_ANTBDEFAULT (1 << 1) -#define RF_PARAM_CARRIERSENSE1 (1 << 2) -#define RF_PARAM_CARRIERSENSE2 (1 << 3) - -#define BB_ANTATTEN_CHAN14 0x0C -#define BB_ANTENNA_B 0x40 - -#define BB_HOST_BANG (1 << 30) -#define BB_HOST_BANG_EN (1 << 2) -#define BB_HOST_BANG_CLK (1 << 1) -#define BB_HOST_BANG_DATA 1 - -#define ANAPARAM_TXDACOFF_SHIFT 27 -#define ANAPARAM_PWR0_SHIFT 28 -#define ANAPARAM_PWR0_MASK (0x07 << ANAPARAM_PWR0_SHIFT) -#define ANAPARAM_PWR1_SHIFT 20 -#define ANAPARAM_PWR1_MASK (0x7F << ANAPARAM_PWR1_SHIFT) - -struct rtl8180_tx_desc { - __le32 flags; - __le16 rts_duration; - __le16 plcp_len; - __le32 tx_buf; - __le32 frame_len; - __le32 next_tx_desc; - u8 cw; - u8 retry_limit; - u8 agc; - u8 flags2; - u32 reserved[2]; -} __packed; - -struct rtl8180_rx_desc { - __le32 flags; - __le32 flags2; - union { - __le32 rx_buf; - __le64 tsft; - }; -} __packed; - -struct rtl8180_tx_ring { - struct rtl8180_tx_desc *desc; - dma_addr_t dma; - unsigned int idx; - unsigned int entries; - struct sk_buff_head queue; -}; - -struct rtl8180_vif { - struct ieee80211_hw *dev; - - /* beaconing */ - struct delayed_work beacon_work; - bool enable_beacon; -}; - -struct rtl8180_priv { - /* common between rtl818x drivers */ - struct rtl818x_csr __iomem *map; - const struct rtl818x_rf_ops *rf; - struct ieee80211_vif *vif; - - /* rtl8180 driver specific */ - spinlock_t lock; - struct rtl8180_rx_desc *rx_ring; - dma_addr_t rx_ring_dma; - unsigned int rx_idx; - struct sk_buff *rx_buf[32]; - struct rtl8180_tx_ring tx_ring[4]; - struct ieee80211_channel channels[14]; - struct ieee80211_rate rates[12]; - struct ieee80211_supported_band band; - struct pci_dev *pdev; - u32 rx_conf; - - int r8185; - u32 anaparam; - u16 rfparam; - u8 csthreshold; - - /* sequence # */ - u16 seqno; -}; - -void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data); -void rtl8180_set_anaparam(struct rtl8180_priv *priv, u32 anaparam); - -static inline u8 rtl818x_ioread8(struct rtl8180_priv *priv, u8 __iomem *addr) -{ - return ioread8(addr); -} - -static inline u16 rtl818x_ioread16(struct rtl8180_priv *priv, __le16 __iomem *addr) -{ - return ioread16(addr); -} - -static inline u32 rtl818x_ioread32(struct rtl8180_priv *priv, __le32 __iomem *addr) -{ - return ioread32(addr); -} - -static inline void rtl818x_iowrite8(struct rtl8180_priv *priv, - u8 __iomem *addr, u8 val) -{ - iowrite8(val, addr); -} - -static inline void rtl818x_iowrite16(struct rtl8180_priv *priv, - __le16 __iomem *addr, u16 val) -{ - iowrite16(val, addr); -} - -static inline void rtl818x_iowrite32(struct rtl8180_priv *priv, - __le32 __iomem *addr, u32 val) -{ - iowrite32(val, addr); -} - -#endif /* RTL8180_H */ diff --git a/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c b/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c deleted file mode 100644 index cc2a5412c1f0..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c +++ /dev/null @@ -1,792 +0,0 @@ - -/* - * Radio tuning for RTL8225 on RTL8180 - * - * Copyright 2007 Michael Wu - * Copyright 2007 Andrea Merello - * - * Based on the r8180 driver, which is: - * Copyright 2005 Andrea Merello , et al. - * - * Thanks to Realtek for their support! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include - -#include "rtl8180.h" -#include "rtl8225.h" - -static void rtl8225_write(struct ieee80211_hw *dev, u8 addr, u16 data) -{ - struct rtl8180_priv *priv = dev->priv; - u16 reg80, reg84, reg82; - u32 bangdata; - int i; - - bangdata = (data << 4) | (addr & 0xf); - - reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput) & 0xfff3; - reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable); - - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x7); - - reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x7 | 0x400); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(10); - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2)); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(2); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(10); - - for (i = 15; i >= 0; i--) { - u16 reg = reg80; - - if (bangdata & (1 << i)) - reg |= 1; - - if (i & 1) - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg); - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg | (1 << 1)); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg | (1 << 1)); - - if (!(i & 1)) - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg); - } - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2)); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(10); - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2)); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x400); - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF); -} - -static u16 rtl8225_read(struct ieee80211_hw *dev, u8 addr) -{ - struct rtl8180_priv *priv = dev->priv; - u16 reg80, reg82, reg84, out; - int i; - - reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput); - reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable); - reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect) | 0x400; - - reg80 &= ~0xF; - - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x000F); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x000F); - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2)); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(4); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(5); - - for (i = 4; i >= 0; i--) { - u16 reg = reg80 | ((addr >> i) & 1); - - if (!(i & 1)) { - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(1); - } - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg | (1 << 1)); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(2); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg | (1 << 1)); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(2); - - if (i & 1) { - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(1); - } - } - - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x000E); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x040E); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3) | (1 << 1)); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(2); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3)); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(2); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3)); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(2); - - out = 0; - for (i = 11; i >= 0; i--) { - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3)); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(1); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3) | (1 << 1)); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(2); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3) | (1 << 1)); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(2); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3) | (1 << 1)); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(2); - - if (rtl818x_ioread16(priv, &priv->map->RFPinsInput) & (1 << 1)) - out |= 1 << i; - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3)); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(2); - } - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3) | (1 << 2)); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - udelay(2); - - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x03A0); - - return out; -} - -static const u16 rtl8225bcd_rxgain[] = { - 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409, - 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541, - 0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583, - 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644, - 0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688, - 0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745, - 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789, - 0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793, - 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d, - 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9, - 0x07aa, 0x07ab, 0x07ac, 0x07ad, 0x07b0, 0x07b1, 0x07b2, 0x07b3, - 0x07b4, 0x07b5, 0x07b8, 0x07b9, 0x07ba, 0x07bb, 0x07bb -}; - -static const u8 rtl8225_agc[] = { - 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, - 0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96, - 0x95, 0x94, 0x93, 0x92, 0x91, 0x90, 0x8f, 0x8e, - 0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86, - 0x85, 0x84, 0x83, 0x82, 0x81, 0x80, 0x3f, 0x3e, - 0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x37, 0x36, - 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2f, 0x2e, - 0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26, - 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e, - 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16, - 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, - 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, - 0x05, 0x04, 0x03, 0x02, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 -}; - -static const u8 rtl8225_gain[] = { - 0x23, 0x88, 0x7c, 0xa5, /* -82dbm */ - 0x23, 0x88, 0x7c, 0xb5, /* -82dbm */ - 0x23, 0x88, 0x7c, 0xc5, /* -82dbm */ - 0x33, 0x80, 0x79, 0xc5, /* -78dbm */ - 0x43, 0x78, 0x76, 0xc5, /* -74dbm */ - 0x53, 0x60, 0x73, 0xc5, /* -70dbm */ - 0x63, 0x58, 0x70, 0xc5, /* -66dbm */ -}; - -static const u8 rtl8225_threshold[] = { - 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd -}; - -static const u8 rtl8225_tx_gain_cck_ofdm[] = { - 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e -}; - -static const u8 rtl8225_tx_power_cck[] = { - 0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02, - 0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02, - 0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02, - 0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02, - 0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03, - 0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03 -}; - -static const u8 rtl8225_tx_power_cck_ch14[] = { - 0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00, - 0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00, - 0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00, - 0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00 -}; - -static const u8 rtl8225_tx_power_ofdm[] = { - 0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4 -}; - -static const u32 rtl8225_chan[] = { - 0x085c, 0x08dc, 0x095c, 0x09dc, 0x0a5c, 0x0adc, 0x0b5c, - 0x0bdc, 0x0c5c, 0x0cdc, 0x0d5c, 0x0ddc, 0x0e5c, 0x0f72 -}; - -static void rtl8225_rf_set_tx_power(struct ieee80211_hw *dev, int channel) -{ - struct rtl8180_priv *priv = dev->priv; - u8 cck_power, ofdm_power; - const u8 *tmp; - u32 reg; - int i; - - cck_power = priv->channels[channel - 1].hw_value & 0xFF; - ofdm_power = priv->channels[channel - 1].hw_value >> 8; - - cck_power = min(cck_power, (u8)35); - ofdm_power = min(ofdm_power, (u8)35); - - rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK, - rtl8225_tx_gain_cck_ofdm[cck_power / 6] >> 1); - - if (channel == 14) - tmp = &rtl8225_tx_power_cck_ch14[(cck_power % 6) * 8]; - else - tmp = &rtl8225_tx_power_cck[(cck_power % 6) * 8]; - - for (i = 0; i < 8; i++) - rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++); - - msleep(1); /* FIXME: optional? */ - - /* anaparam2 on */ - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); - rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | RTL818X_CONFIG3_ANAPARAM_WRITE); - rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, RTL8225_ANAPARAM2_ON); - rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); - - rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM, - rtl8225_tx_gain_cck_ofdm[ofdm_power/6] >> 1); - - tmp = &rtl8225_tx_power_ofdm[ofdm_power % 6]; - - rtl8225_write_phy_ofdm(dev, 5, *tmp); - rtl8225_write_phy_ofdm(dev, 7, *tmp); - - msleep(1); -} - -static void rtl8225_rf_init(struct ieee80211_hw *dev) -{ - struct rtl8180_priv *priv = dev->priv; - int i; - - rtl8180_set_anaparam(priv, RTL8225_ANAPARAM_ON); - - /* host_pci_init */ - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480); - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x0488); - rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - msleep(200); /* FIXME: ehh?? */ - rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0xFF & ~(1 << 6)); - - rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x000a8008); - - /* TODO: check if we need really to change BRSR to do RF config */ - rtl818x_ioread16(priv, &priv->map->BRSR); - rtl818x_iowrite16(priv, &priv->map->BRSR, 0xFFFF); - rtl818x_iowrite32(priv, &priv->map->RF_PARA, 0x00100044); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - rtl818x_iowrite8(priv, &priv->map->CONFIG3, 0x44); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); - - rtl8225_write(dev, 0x0, 0x067); - rtl8225_write(dev, 0x1, 0xFE0); - rtl8225_write(dev, 0x2, 0x44D); - rtl8225_write(dev, 0x3, 0x441); - rtl8225_write(dev, 0x4, 0x8BE); - rtl8225_write(dev, 0x5, 0xBF0); /* TODO: minipci */ - rtl8225_write(dev, 0x6, 0xAE6); - rtl8225_write(dev, 0x7, rtl8225_chan[0]); - rtl8225_write(dev, 0x8, 0x01F); - rtl8225_write(dev, 0x9, 0x334); - rtl8225_write(dev, 0xA, 0xFD4); - rtl8225_write(dev, 0xB, 0x391); - rtl8225_write(dev, 0xC, 0x050); - rtl8225_write(dev, 0xD, 0x6DB); - rtl8225_write(dev, 0xE, 0x029); - rtl8225_write(dev, 0xF, 0x914); msleep(1); - - rtl8225_write(dev, 0x2, 0xC4D); msleep(100); - - rtl8225_write(dev, 0x0, 0x127); - - for (i = 0; i < ARRAY_SIZE(rtl8225bcd_rxgain); i++) { - rtl8225_write(dev, 0x1, i + 1); - rtl8225_write(dev, 0x2, rtl8225bcd_rxgain[i]); - } - - rtl8225_write(dev, 0x0, 0x027); - rtl8225_write(dev, 0x0, 0x22F); - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF); - - for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) { - rtl8225_write_phy_ofdm(dev, 0xB, rtl8225_agc[i]); - msleep(1); - rtl8225_write_phy_ofdm(dev, 0xA, 0x80 + i); - msleep(1); - } - - msleep(1); - - rtl8225_write_phy_ofdm(dev, 0x00, 0x01); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x01, 0x02); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x02, 0x62); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x03, 0x00); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x04, 0x00); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x05, 0x00); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x06, 0x00); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x07, 0x00); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x08, 0x00); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x09, 0xfe); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x0a, 0x09); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x0b, 0x80); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x0c, 0x01); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x0e, 0xd3); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x0f, 0x38); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x10, 0x84); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x11, 0x03); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x12, 0x20); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x13, 0x20); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x14, 0x00); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x15, 0x40); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x16, 0x00); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x17, 0x40); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x18, 0xef); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x19, 0x19); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x1a, 0x20); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x1b, 0x76); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x1c, 0x04); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x1e, 0x95); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x1f, 0x75); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x20, 0x1f); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x21, 0x27); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x22, 0x16); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x24, 0x46); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x25, 0x20); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x26, 0x90); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x27, 0x88); msleep(1); - - rtl8225_write_phy_cck(dev, 0x00, 0x98); msleep(1); - rtl8225_write_phy_cck(dev, 0x03, 0x20); msleep(1); - rtl8225_write_phy_cck(dev, 0x04, 0x7e); msleep(1); - rtl8225_write_phy_cck(dev, 0x05, 0x12); msleep(1); - rtl8225_write_phy_cck(dev, 0x06, 0xfc); msleep(1); - rtl8225_write_phy_cck(dev, 0x07, 0x78); msleep(1); - rtl8225_write_phy_cck(dev, 0x08, 0x2e); msleep(1); - rtl8225_write_phy_cck(dev, 0x10, 0x93); msleep(1); - rtl8225_write_phy_cck(dev, 0x11, 0x88); msleep(1); - rtl8225_write_phy_cck(dev, 0x12, 0x47); msleep(1); - rtl8225_write_phy_cck(dev, 0x13, 0xd0); - rtl8225_write_phy_cck(dev, 0x19, 0x00); - rtl8225_write_phy_cck(dev, 0x1a, 0xa0); - rtl8225_write_phy_cck(dev, 0x1b, 0x08); - rtl8225_write_phy_cck(dev, 0x40, 0x86); - rtl8225_write_phy_cck(dev, 0x41, 0x8d); msleep(1); - rtl8225_write_phy_cck(dev, 0x42, 0x15); msleep(1); - rtl8225_write_phy_cck(dev, 0x43, 0x18); msleep(1); - rtl8225_write_phy_cck(dev, 0x44, 0x1f); msleep(1); - rtl8225_write_phy_cck(dev, 0x45, 0x1e); msleep(1); - rtl8225_write_phy_cck(dev, 0x46, 0x1a); msleep(1); - rtl8225_write_phy_cck(dev, 0x47, 0x15); msleep(1); - rtl8225_write_phy_cck(dev, 0x48, 0x10); msleep(1); - rtl8225_write_phy_cck(dev, 0x49, 0x0a); msleep(1); - rtl8225_write_phy_cck(dev, 0x4a, 0x05); msleep(1); - rtl8225_write_phy_cck(dev, 0x4b, 0x02); msleep(1); - rtl8225_write_phy_cck(dev, 0x4c, 0x05); msleep(1); - - rtl818x_iowrite8(priv, &priv->map->TESTR, 0x0D); msleep(1); - - rtl8225_rf_set_tx_power(dev, 1); - - /* RX antenna default to A */ - rtl8225_write_phy_cck(dev, 0x10, 0x9b); msleep(1); /* B: 0xDB */ - rtl8225_write_phy_ofdm(dev, 0x26, 0x90); msleep(1); /* B: 0x10 */ - - rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03); /* B: 0x00 */ - msleep(1); - rtl818x_iowrite32(priv, (__le32 __iomem *)((void __iomem *)priv->map + 0x94), 0x15c00002); - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF); - - rtl8225_write(dev, 0x0c, 0x50); - /* set OFDM initial gain */ - rtl8225_write_phy_ofdm(dev, 0x0d, rtl8225_gain[4 * 4]); - rtl8225_write_phy_ofdm(dev, 0x23, rtl8225_gain[4 * 4 + 1]); - rtl8225_write_phy_ofdm(dev, 0x1b, rtl8225_gain[4 * 4 + 2]); - rtl8225_write_phy_ofdm(dev, 0x1d, rtl8225_gain[4 * 4 + 3]); - /* set CCK threshold */ - rtl8225_write_phy_cck(dev, 0x41, rtl8225_threshold[0]); -} - -static const u8 rtl8225z2_tx_power_cck_ch14[] = { - 0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00 -}; - -static const u8 rtl8225z2_tx_power_cck_B[] = { - 0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x04 -}; - -static const u8 rtl8225z2_tx_power_cck_A[] = { - 0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04 -}; - -static const u8 rtl8225z2_tx_power_cck[] = { - 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04 -}; - -static void rtl8225z2_rf_set_tx_power(struct ieee80211_hw *dev, int channel) -{ - struct rtl8180_priv *priv = dev->priv; - u8 cck_power, ofdm_power; - const u8 *tmp; - int i; - - cck_power = priv->channels[channel - 1].hw_value & 0xFF; - ofdm_power = priv->channels[channel - 1].hw_value >> 8; - - if (channel == 14) - tmp = rtl8225z2_tx_power_cck_ch14; - else if (cck_power == 12) - tmp = rtl8225z2_tx_power_cck_B; - else if (cck_power == 13) - tmp = rtl8225z2_tx_power_cck_A; - else - tmp = rtl8225z2_tx_power_cck; - - for (i = 0; i < 8; i++) - rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++); - - cck_power = min(cck_power, (u8)35); - if (cck_power == 13 || cck_power == 14) - cck_power = 12; - if (cck_power >= 15) - cck_power -= 2; - - rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK, cck_power); - rtl818x_ioread8(priv, &priv->map->TX_GAIN_CCK); - msleep(1); - - ofdm_power = min(ofdm_power, (u8)35); - rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM, ofdm_power); - - rtl8225_write_phy_ofdm(dev, 2, 0x62); - rtl8225_write_phy_ofdm(dev, 5, 0x00); - rtl8225_write_phy_ofdm(dev, 6, 0x40); - rtl8225_write_phy_ofdm(dev, 7, 0x00); - rtl8225_write_phy_ofdm(dev, 8, 0x40); - - msleep(1); -} - -static const u16 rtl8225z2_rxgain[] = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009, - 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141, - 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183, - 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244, - 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288, - 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345, - 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389, - 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393, - 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, - 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9, - 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3, - 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb -}; - -static void rtl8225z2_rf_init(struct ieee80211_hw *dev) -{ - struct rtl8180_priv *priv = dev->priv; - int i; - - rtl8180_set_anaparam(priv, RTL8225_ANAPARAM_ON); - - /* host_pci_init */ - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480); - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x0488); - rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - msleep(200); /* FIXME: ehh?? */ - rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0xFF & ~(1 << 6)); - - rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x00088008); - - /* TODO: check if we need really to change BRSR to do RF config */ - rtl818x_ioread16(priv, &priv->map->BRSR); - rtl818x_iowrite16(priv, &priv->map->BRSR, 0xFFFF); - rtl818x_iowrite32(priv, &priv->map->RF_PARA, 0x00100044); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - rtl818x_iowrite8(priv, &priv->map->CONFIG3, 0x44); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); - - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF); - - rtl8225_write(dev, 0x0, 0x0B7); msleep(1); - rtl8225_write(dev, 0x1, 0xEE0); msleep(1); - rtl8225_write(dev, 0x2, 0x44D); msleep(1); - rtl8225_write(dev, 0x3, 0x441); msleep(1); - rtl8225_write(dev, 0x4, 0x8C3); msleep(1); - rtl8225_write(dev, 0x5, 0xC72); msleep(1); - rtl8225_write(dev, 0x6, 0x0E6); msleep(1); - rtl8225_write(dev, 0x7, 0x82A); msleep(1); - rtl8225_write(dev, 0x8, 0x03F); msleep(1); - rtl8225_write(dev, 0x9, 0x335); msleep(1); - rtl8225_write(dev, 0xa, 0x9D4); msleep(1); - rtl8225_write(dev, 0xb, 0x7BB); msleep(1); - rtl8225_write(dev, 0xc, 0x850); msleep(1); - rtl8225_write(dev, 0xd, 0xCDF); msleep(1); - rtl8225_write(dev, 0xe, 0x02B); msleep(1); - rtl8225_write(dev, 0xf, 0x114); msleep(100); - - if (!(rtl8225_read(dev, 6) & (1 << 7))) { - rtl8225_write(dev, 0x02, 0x0C4D); - msleep(200); - rtl8225_write(dev, 0x02, 0x044D); - msleep(100); - /* TODO: readd calibration failure message when the calibration - check works */ - } - - rtl8225_write(dev, 0x0, 0x1B7); - rtl8225_write(dev, 0x3, 0x002); - rtl8225_write(dev, 0x5, 0x004); - - for (i = 0; i < ARRAY_SIZE(rtl8225z2_rxgain); i++) { - rtl8225_write(dev, 0x1, i + 1); - rtl8225_write(dev, 0x2, rtl8225z2_rxgain[i]); - } - - rtl8225_write(dev, 0x0, 0x0B7); msleep(100); - rtl8225_write(dev, 0x2, 0xC4D); - - msleep(200); - rtl8225_write(dev, 0x2, 0x44D); - msleep(100); - - rtl8225_write(dev, 0x00, 0x2BF); - rtl8225_write(dev, 0xFF, 0xFFFF); - - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF); - - for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) { - rtl8225_write_phy_ofdm(dev, 0xB, rtl8225_agc[i]); - msleep(1); - rtl8225_write_phy_ofdm(dev, 0xA, 0x80 + i); - msleep(1); - } - - msleep(1); - - rtl8225_write_phy_ofdm(dev, 0x00, 0x01); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x01, 0x02); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x02, 0x62); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x03, 0x00); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x04, 0x00); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x05, 0x00); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x06, 0x40); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x07, 0x00); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x08, 0x40); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x09, 0xfe); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x0a, 0x09); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x18, 0xef); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x0b, 0x80); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x0c, 0x01); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x0d, 0x43); - rtl8225_write_phy_ofdm(dev, 0x0e, 0xd3); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x0f, 0x38); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x10, 0x84); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x11, 0x06); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x12, 0x20); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x13, 0x20); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x14, 0x00); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x15, 0x40); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x16, 0x00); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x17, 0x40); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x18, 0xef); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x19, 0x19); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x1a, 0x20); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x1b, 0x11); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x1c, 0x04); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x1d, 0xc5); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x1e, 0xb3); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x1f, 0x75); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x20, 0x1f); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x21, 0x27); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x22, 0x16); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x23, 0x80); msleep(1); /* FIXME: not needed? */ - rtl8225_write_phy_ofdm(dev, 0x24, 0x46); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x25, 0x20); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x26, 0x90); msleep(1); - rtl8225_write_phy_ofdm(dev, 0x27, 0x88); msleep(1); - - rtl8225_write_phy_cck(dev, 0x00, 0x98); msleep(1); - rtl8225_write_phy_cck(dev, 0x03, 0x20); msleep(1); - rtl8225_write_phy_cck(dev, 0x04, 0x7e); msleep(1); - rtl8225_write_phy_cck(dev, 0x05, 0x12); msleep(1); - rtl8225_write_phy_cck(dev, 0x06, 0xfc); msleep(1); - rtl8225_write_phy_cck(dev, 0x07, 0x78); msleep(1); - rtl8225_write_phy_cck(dev, 0x08, 0x2e); msleep(1); - rtl8225_write_phy_cck(dev, 0x10, 0x93); msleep(1); - rtl8225_write_phy_cck(dev, 0x11, 0x88); msleep(1); - rtl8225_write_phy_cck(dev, 0x12, 0x47); msleep(1); - rtl8225_write_phy_cck(dev, 0x13, 0xd0); - rtl8225_write_phy_cck(dev, 0x19, 0x00); - rtl8225_write_phy_cck(dev, 0x1a, 0xa0); - rtl8225_write_phy_cck(dev, 0x1b, 0x08); - rtl8225_write_phy_cck(dev, 0x40, 0x86); - rtl8225_write_phy_cck(dev, 0x41, 0x8a); msleep(1); - rtl8225_write_phy_cck(dev, 0x42, 0x15); msleep(1); - rtl8225_write_phy_cck(dev, 0x43, 0x18); msleep(1); - rtl8225_write_phy_cck(dev, 0x44, 0x36); msleep(1); - rtl8225_write_phy_cck(dev, 0x45, 0x35); msleep(1); - rtl8225_write_phy_cck(dev, 0x46, 0x2e); msleep(1); - rtl8225_write_phy_cck(dev, 0x47, 0x25); msleep(1); - rtl8225_write_phy_cck(dev, 0x48, 0x1c); msleep(1); - rtl8225_write_phy_cck(dev, 0x49, 0x12); msleep(1); - rtl8225_write_phy_cck(dev, 0x4a, 0x09); msleep(1); - rtl8225_write_phy_cck(dev, 0x4b, 0x04); msleep(1); - rtl8225_write_phy_cck(dev, 0x4c, 0x05); msleep(1); - - rtl818x_iowrite8(priv, (u8 __iomem *)((void __iomem *)priv->map + 0x5B), 0x0D); msleep(1); - - rtl8225z2_rf_set_tx_power(dev, 1); - - /* RX antenna default to A */ - rtl8225_write_phy_cck(dev, 0x10, 0x9b); msleep(1); /* B: 0xDB */ - rtl8225_write_phy_ofdm(dev, 0x26, 0x90); msleep(1); /* B: 0x10 */ - - rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03); /* B: 0x00 */ - msleep(1); - rtl818x_iowrite32(priv, (__le32 __iomem *)((void __iomem *)priv->map + 0x94), 0x15c00002); - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF); -} - -static void rtl8225_rf_stop(struct ieee80211_hw *dev) -{ - struct rtl8180_priv *priv = dev->priv; - u8 reg; - - rtl8225_write(dev, 0x4, 0x1f); msleep(1); - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); - rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | RTL818X_CONFIG3_ANAPARAM_WRITE); - rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, RTL8225_ANAPARAM2_OFF); - rtl818x_iowrite32(priv, &priv->map->ANAPARAM, RTL8225_ANAPARAM_OFF); - rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); -} - -static void rtl8225_rf_set_channel(struct ieee80211_hw *dev, - struct ieee80211_conf *conf) -{ - struct rtl8180_priv *priv = dev->priv; - int chan = - ieee80211_frequency_to_channel(conf->chandef.chan->center_freq); - - if (priv->rf->init == rtl8225_rf_init) - rtl8225_rf_set_tx_power(dev, chan); - else - rtl8225z2_rf_set_tx_power(dev, chan); - - rtl8225_write(dev, 0x7, rtl8225_chan[chan - 1]); - msleep(10); -} - -static void rtl8225_rf_conf_erp(struct ieee80211_hw *dev, - struct ieee80211_bss_conf *info) -{ - struct rtl8180_priv *priv = dev->priv; - - if (info->use_short_slot) { - rtl818x_iowrite8(priv, &priv->map->SLOT, 0x9); - rtl818x_iowrite8(priv, &priv->map->SIFS, 0x22); - rtl818x_iowrite8(priv, &priv->map->DIFS, 0x14); - rtl818x_iowrite8(priv, &priv->map->EIFS, 81); - rtl818x_iowrite8(priv, &priv->map->CW_VAL, 0x73); - } else { - rtl818x_iowrite8(priv, &priv->map->SLOT, 0x14); - rtl818x_iowrite8(priv, &priv->map->SIFS, 0x44); - rtl818x_iowrite8(priv, &priv->map->DIFS, 0x24); - rtl818x_iowrite8(priv, &priv->map->EIFS, 81); - rtl818x_iowrite8(priv, &priv->map->CW_VAL, 0xa5); - } -} - -static const struct rtl818x_rf_ops rtl8225_ops = { - .name = "rtl8225", - .init = rtl8225_rf_init, - .stop = rtl8225_rf_stop, - .set_chan = rtl8225_rf_set_channel, - .conf_erp = rtl8225_rf_conf_erp, -}; - -static const struct rtl818x_rf_ops rtl8225z2_ops = { - .name = "rtl8225z2", - .init = rtl8225z2_rf_init, - .stop = rtl8225_rf_stop, - .set_chan = rtl8225_rf_set_channel, - .conf_erp = rtl8225_rf_conf_erp, -}; - -const struct rtl818x_rf_ops * rtl8180_detect_rf(struct ieee80211_hw *dev) -{ - struct rtl8180_priv *priv = dev->priv; - u16 reg8, reg9; - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x0488); - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF); - rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - msleep(100); - - rtl8225_write(dev, 0, 0x1B7); - - reg8 = rtl8225_read(dev, 8); - reg9 = rtl8225_read(dev, 9); - - rtl8225_write(dev, 0, 0x0B7); - - if (reg8 != 0x588 || reg9 != 0x700) - return &rtl8225_ops; - - return &rtl8225z2_ops; -} diff --git a/drivers/net/wireless/rtl818x/rtl8180/rtl8225.h b/drivers/net/wireless/rtl818x/rtl8180/rtl8225.h deleted file mode 100644 index 310013a2d726..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8180/rtl8225.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef RTL8180_RTL8225_H -#define RTL8180_RTL8225_H - -#define RTL8225_ANAPARAM_ON 0xa0000b59 -#define RTL8225_ANAPARAM2_ON 0x860dec11 -#define RTL8225_ANAPARAM_OFF 0xa00beb59 -#define RTL8225_ANAPARAM2_OFF 0x840dec11 - -const struct rtl818x_rf_ops * rtl8180_detect_rf(struct ieee80211_hw *); - -static inline void rtl8225_write_phy_ofdm(struct ieee80211_hw *dev, - u8 addr, u8 data) -{ - rtl8180_write_phy(dev, addr, data); -} - -static inline void rtl8225_write_phy_cck(struct ieee80211_hw *dev, - u8 addr, u8 data) -{ - rtl8180_write_phy(dev, addr, data | 0x10000); -} - -#endif /* RTL8180_RTL8225_H */ diff --git a/drivers/net/wireless/rtl818x/rtl8180/sa2400.c b/drivers/net/wireless/rtl818x/rtl8180/sa2400.c deleted file mode 100644 index b3ec40f6bd23..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8180/sa2400.c +++ /dev/null @@ -1,229 +0,0 @@ - -/* - * Radio tuning for Philips SA2400 on RTL8180 - * - * Copyright 2007 Andrea Merello - * - * Code from the BSD driver and the rtl8181 project have been - * very useful to understand certain things - * - * I want to thanks the Authors of such projects and the Ndiswrapper - * project Authors. - * - * A special Big Thanks also is for all people who donated me cards, - * making possible the creation of the original rtl8180 driver - * from which this code is derived! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include - -#include "rtl8180.h" -#include "sa2400.h" - -static const u32 sa2400_chan[] = { - 0x00096c, /* ch1 */ - 0x080970, - 0x100974, - 0x180978, - 0x000980, - 0x080984, - 0x100988, - 0x18098c, - 0x000994, - 0x080998, - 0x10099c, - 0x1809a0, - 0x0009a8, - 0x0009b4, /* ch 14 */ -}; - -static void write_sa2400(struct ieee80211_hw *dev, u8 addr, u32 data) -{ - struct rtl8180_priv *priv = dev->priv; - u32 phy_config; - - /* MAC will bang bits to the sa2400. sw 3-wire is NOT used */ - phy_config = 0xb0000000; - - phy_config |= ((u32)(addr & 0xf)) << 24; - phy_config |= data & 0xffffff; - - rtl818x_iowrite32(priv, - (__le32 __iomem *) &priv->map->RFPinsOutput, phy_config); - - msleep(3); -} - -static void sa2400_write_phy_antenna(struct ieee80211_hw *dev, short chan) -{ - struct rtl8180_priv *priv = dev->priv; - u8 ant = SA2400_ANTENNA; - - if (priv->rfparam & RF_PARAM_ANTBDEFAULT) - ant |= BB_ANTENNA_B; - - if (chan == 14) - ant |= BB_ANTATTEN_CHAN14; - - rtl8180_write_phy(dev, 0x10, ant); - -} - -static u8 sa2400_rf_rssi_map[] = { - 0x64, 0x64, 0x63, 0x62, 0x61, 0x60, 0x5f, 0x5e, - 0x5d, 0x5c, 0x5b, 0x5a, 0x57, 0x54, 0x52, 0x50, - 0x4e, 0x4c, 0x4a, 0x48, 0x46, 0x44, 0x41, 0x3f, - 0x3c, 0x3a, 0x37, 0x36, 0x36, 0x1c, 0x1c, 0x1b, - 0x1b, 0x1a, 0x1a, 0x19, 0x19, 0x18, 0x18, 0x17, - 0x17, 0x16, 0x16, 0x15, 0x15, 0x14, 0x14, 0x13, - 0x13, 0x12, 0x12, 0x11, 0x11, 0x10, 0x10, 0x0f, - 0x0f, 0x0e, 0x0e, 0x0d, 0x0d, 0x0c, 0x0c, 0x0b, - 0x0b, 0x0a, 0x0a, 0x09, 0x09, 0x08, 0x08, 0x07, - 0x07, 0x06, 0x06, 0x05, 0x04, 0x03, 0x02, -}; - -static u8 sa2400_rf_calc_rssi(u8 agc, u8 sq) -{ - if (sq == 0x80) - return 1; - - if (sq > 78) - return 32; - - /* TODO: recalc sa2400_rf_rssi_map to avoid mult / div */ - return 65 * sa2400_rf_rssi_map[sq] / 100; -} - -static void sa2400_rf_set_channel(struct ieee80211_hw *dev, - struct ieee80211_conf *conf) -{ - struct rtl8180_priv *priv = dev->priv; - int channel = - ieee80211_frequency_to_channel(conf->chandef.chan->center_freq); - u32 txpw = priv->channels[channel - 1].hw_value & 0xFF; - u32 chan = sa2400_chan[channel - 1]; - - write_sa2400(dev, 7, txpw); - - sa2400_write_phy_antenna(dev, channel); - - write_sa2400(dev, 0, chan); - write_sa2400(dev, 1, 0xbb50); - write_sa2400(dev, 2, 0x80); - write_sa2400(dev, 3, 0); -} - -static void sa2400_rf_stop(struct ieee80211_hw *dev) -{ - write_sa2400(dev, 4, 0); -} - -static void sa2400_rf_init(struct ieee80211_hw *dev) -{ - struct rtl8180_priv *priv = dev->priv; - u32 anaparam, txconf; - u8 firdac; - int analogphy = priv->rfparam & RF_PARAM_ANALOGPHY; - - anaparam = priv->anaparam; - anaparam &= ~(1 << ANAPARAM_TXDACOFF_SHIFT); - anaparam &= ~ANAPARAM_PWR1_MASK; - anaparam &= ~ANAPARAM_PWR0_MASK; - - if (analogphy) { - anaparam |= SA2400_ANA_ANAPARAM_PWR1_ON << ANAPARAM_PWR1_SHIFT; - firdac = 0; - } else { - anaparam |= (SA2400_DIG_ANAPARAM_PWR1_ON << ANAPARAM_PWR1_SHIFT); - anaparam |= (SA2400_ANAPARAM_PWR0_ON << ANAPARAM_PWR0_SHIFT); - firdac = 1 << SA2400_REG4_FIRDAC_SHIFT; - } - - rtl8180_set_anaparam(priv, anaparam); - - write_sa2400(dev, 0, sa2400_chan[0]); - write_sa2400(dev, 1, 0xbb50); - write_sa2400(dev, 2, 0x80); - write_sa2400(dev, 3, 0); - write_sa2400(dev, 4, 0x19340 | firdac); - write_sa2400(dev, 5, 0x1dfb | (SA2400_MAX_SENS - 54) << 15); - write_sa2400(dev, 4, 0x19348 | firdac); /* calibrate VCO */ - - if (!analogphy) - write_sa2400(dev, 4, 0x1938c); /*???*/ - - write_sa2400(dev, 4, 0x19340 | firdac); - - write_sa2400(dev, 0, sa2400_chan[0]); - write_sa2400(dev, 1, 0xbb50); - write_sa2400(dev, 2, 0x80); - write_sa2400(dev, 3, 0); - write_sa2400(dev, 4, 0x19344 | firdac); /* calibrate filter */ - - /* new from rtl8180 embedded driver (rtl8181 project) */ - write_sa2400(dev, 6, 0x13ff | (1 << 23)); /* MANRX */ - write_sa2400(dev, 8, 0); /* VCO */ - - if (analogphy) { - rtl8180_set_anaparam(priv, anaparam | - (1 << ANAPARAM_TXDACOFF_SHIFT)); - - txconf = rtl818x_ioread32(priv, &priv->map->TX_CONF); - rtl818x_iowrite32(priv, &priv->map->TX_CONF, - txconf | RTL818X_TX_CONF_LOOPBACK_CONT); - - write_sa2400(dev, 4, 0x19341); /* calibrates DC */ - - /* a 5us sleep is required here, - * we rely on the 3ms delay introduced in write_sa2400 */ - write_sa2400(dev, 4, 0x19345); - - /* a 20us sleep is required here, - * we rely on the 3ms delay introduced in write_sa2400 */ - - rtl818x_iowrite32(priv, &priv->map->TX_CONF, txconf); - - rtl8180_set_anaparam(priv, anaparam); - } - /* end new code */ - - write_sa2400(dev, 4, 0x19341 | firdac); /* RTX MODE */ - - /* baseband configuration */ - rtl8180_write_phy(dev, 0, 0x98); - rtl8180_write_phy(dev, 3, 0x38); - rtl8180_write_phy(dev, 4, 0xe0); - rtl8180_write_phy(dev, 5, 0x90); - rtl8180_write_phy(dev, 6, 0x1a); - rtl8180_write_phy(dev, 7, 0x64); - - sa2400_write_phy_antenna(dev, 1); - - rtl8180_write_phy(dev, 0x11, 0x80); - - if (rtl818x_ioread8(priv, &priv->map->CONFIG2) & - RTL818X_CONFIG2_ANTENNA_DIV) - rtl8180_write_phy(dev, 0x12, 0xc7); /* enable ant diversity */ - else - rtl8180_write_phy(dev, 0x12, 0x47); /* disable ant diversity */ - - rtl8180_write_phy(dev, 0x13, 0x90 | priv->csthreshold); - - rtl8180_write_phy(dev, 0x19, 0x0); - rtl8180_write_phy(dev, 0x1a, 0xa0); -} - -const struct rtl818x_rf_ops sa2400_rf_ops = { - .name = "Philips", - .init = sa2400_rf_init, - .stop = sa2400_rf_stop, - .set_chan = sa2400_rf_set_channel, - .calc_rssi = sa2400_rf_calc_rssi, -}; diff --git a/drivers/net/wireless/rtl818x/rtl8180/sa2400.h b/drivers/net/wireless/rtl818x/rtl8180/sa2400.h deleted file mode 100644 index a4aaa0d413f1..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8180/sa2400.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef RTL8180_SA2400_H -#define RTL8180_SA2400_H - -/* - * Radio tuning for Philips SA2400 on RTL8180 - * - * Copyright 2007 Andrea Merello - * - * Code from the BSD driver and the rtl8181 project have been - * very useful to understand certain things - * - * I want to thanks the Authors of such projects and the Ndiswrapper - * project Authors. - * - * A special Big Thanks also is for all people who donated me cards, - * making possible the creation of the original rtl8180 driver - * from which this code is derived! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#define SA2400_ANTENNA 0x91 -#define SA2400_DIG_ANAPARAM_PWR1_ON 0x8 -#define SA2400_ANA_ANAPARAM_PWR1_ON 0x28 -#define SA2400_ANAPARAM_PWR0_ON 0x3 - -/* RX sensitivity in dbm */ -#define SA2400_MAX_SENS 85 - -#define SA2400_REG4_FIRDAC_SHIFT 7 - -extern const struct rtl818x_rf_ops sa2400_rf_ops; - -#endif /* RTL8180_SA2400_H */ diff --git a/drivers/net/wireless/rtl818x/rtl8187/Makefile b/drivers/net/wireless/rtl818x/rtl8187/Makefile deleted file mode 100644 index 7b6299268ecf..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8187/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -rtl8187-objs := dev.o rtl8225.o leds.o rfkill.o - -obj-$(CONFIG_RTL8187) += rtl8187.o - -ccflags-y += -Idrivers/net/wireless/rtl818x diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c deleted file mode 100644 index f49220e234b0..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c +++ /dev/null @@ -1,1671 +0,0 @@ -/* - * Linux device driver for RTL8187 - * - * Copyright 2007 Michael Wu - * Copyright 2007 Andrea Merello - * - * Based on the r8187 driver, which is: - * Copyright 2005 Andrea Merello , et al. - * - * The driver was extended to the RTL8187B in 2008 by: - * Herton Ronaldo Krzesinski - * Hin-Tak Leung - * Larry Finger - * - * Magic delays and register offsets below are taken from the original - * r8187 driver sources. Thanks to Realtek for their support! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rtl8187.h" -#include "rtl8225.h" -#ifdef CONFIG_RTL8187_LEDS -#include "leds.h" -#endif -#include "rfkill.h" - -MODULE_AUTHOR("Michael Wu "); -MODULE_AUTHOR("Andrea Merello "); -MODULE_AUTHOR("Herton Ronaldo Krzesinski "); -MODULE_AUTHOR("Hin-Tak Leung "); -MODULE_AUTHOR("Larry Finger "); -MODULE_DESCRIPTION("RTL8187/RTL8187B USB wireless driver"); -MODULE_LICENSE("GPL"); - -static struct usb_device_id rtl8187_table[] = { - /* Asus */ - {USB_DEVICE(0x0b05, 0x171d), .driver_info = DEVICE_RTL8187}, - /* Belkin */ - {USB_DEVICE(0x050d, 0x705e), .driver_info = DEVICE_RTL8187B}, - /* Realtek */ - {USB_DEVICE(0x0bda, 0x8187), .driver_info = DEVICE_RTL8187}, - {USB_DEVICE(0x0bda, 0x8189), .driver_info = DEVICE_RTL8187B}, - {USB_DEVICE(0x0bda, 0x8197), .driver_info = DEVICE_RTL8187B}, - {USB_DEVICE(0x0bda, 0x8198), .driver_info = DEVICE_RTL8187B}, - /* Surecom */ - {USB_DEVICE(0x0769, 0x11F2), .driver_info = DEVICE_RTL8187}, - /* Logitech */ - {USB_DEVICE(0x0789, 0x010C), .driver_info = DEVICE_RTL8187}, - /* Netgear */ - {USB_DEVICE(0x0846, 0x6100), .driver_info = DEVICE_RTL8187}, - {USB_DEVICE(0x0846, 0x6a00), .driver_info = DEVICE_RTL8187}, - {USB_DEVICE(0x0846, 0x4260), .driver_info = DEVICE_RTL8187B}, - /* HP */ - {USB_DEVICE(0x03f0, 0xca02), .driver_info = DEVICE_RTL8187}, - /* Sitecom */ - {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187}, - {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B}, - {USB_DEVICE(0x0df6, 0x0029), .driver_info = DEVICE_RTL8187B}, - /* Sphairon Access Systems GmbH */ - {USB_DEVICE(0x114B, 0x0150), .driver_info = DEVICE_RTL8187}, - /* Dick Smith Electronics */ - {USB_DEVICE(0x1371, 0x9401), .driver_info = DEVICE_RTL8187}, - /* Abocom */ - {USB_DEVICE(0x13d1, 0xabe6), .driver_info = DEVICE_RTL8187}, - /* Qcom */ - {USB_DEVICE(0x18E8, 0x6232), .driver_info = DEVICE_RTL8187}, - /* AirLive */ - {USB_DEVICE(0x1b75, 0x8187), .driver_info = DEVICE_RTL8187}, - /* Linksys */ - {USB_DEVICE(0x1737, 0x0073), .driver_info = DEVICE_RTL8187B}, - {} -}; - -MODULE_DEVICE_TABLE(usb, rtl8187_table); - -static const struct ieee80211_rate rtl818x_rates[] = { - { .bitrate = 10, .hw_value = 0, }, - { .bitrate = 20, .hw_value = 1, }, - { .bitrate = 55, .hw_value = 2, }, - { .bitrate = 110, .hw_value = 3, }, - { .bitrate = 60, .hw_value = 4, }, - { .bitrate = 90, .hw_value = 5, }, - { .bitrate = 120, .hw_value = 6, }, - { .bitrate = 180, .hw_value = 7, }, - { .bitrate = 240, .hw_value = 8, }, - { .bitrate = 360, .hw_value = 9, }, - { .bitrate = 480, .hw_value = 10, }, - { .bitrate = 540, .hw_value = 11, }, -}; - -static const struct ieee80211_channel rtl818x_channels[] = { - { .center_freq = 2412 }, - { .center_freq = 2417 }, - { .center_freq = 2422 }, - { .center_freq = 2427 }, - { .center_freq = 2432 }, - { .center_freq = 2437 }, - { .center_freq = 2442 }, - { .center_freq = 2447 }, - { .center_freq = 2452 }, - { .center_freq = 2457 }, - { .center_freq = 2462 }, - { .center_freq = 2467 }, - { .center_freq = 2472 }, - { .center_freq = 2484 }, -}; - -static void rtl8187_iowrite_async_cb(struct urb *urb) -{ - kfree(urb->context); -} - -static void rtl8187_iowrite_async(struct rtl8187_priv *priv, __le16 addr, - void *data, u16 len) -{ - struct usb_ctrlrequest *dr; - struct urb *urb; - struct rtl8187_async_write_data { - u8 data[4]; - struct usb_ctrlrequest dr; - } *buf; - int rc; - - buf = kmalloc(sizeof(*buf), GFP_ATOMIC); - if (!buf) - return; - - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!urb) { - kfree(buf); - return; - } - - dr = &buf->dr; - - dr->bRequestType = RTL8187_REQT_WRITE; - dr->bRequest = RTL8187_REQ_SET_REG; - dr->wValue = addr; - dr->wIndex = 0; - dr->wLength = cpu_to_le16(len); - - memcpy(buf, data, len); - - usb_fill_control_urb(urb, priv->udev, usb_sndctrlpipe(priv->udev, 0), - (unsigned char *)dr, buf, len, - rtl8187_iowrite_async_cb, buf); - usb_anchor_urb(urb, &priv->anchored); - rc = usb_submit_urb(urb, GFP_ATOMIC); - if (rc < 0) { - kfree(buf); - usb_unanchor_urb(urb); - } - usb_free_urb(urb); -} - -static inline void rtl818x_iowrite32_async(struct rtl8187_priv *priv, - __le32 *addr, u32 val) -{ - __le32 buf = cpu_to_le32(val); - - rtl8187_iowrite_async(priv, cpu_to_le16((unsigned long)addr), - &buf, sizeof(buf)); -} - -void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data) -{ - struct rtl8187_priv *priv = dev->priv; - - data <<= 8; - data |= addr | 0x80; - - rtl818x_iowrite8(priv, &priv->map->PHY[3], (data >> 24) & 0xFF); - rtl818x_iowrite8(priv, &priv->map->PHY[2], (data >> 16) & 0xFF); - rtl818x_iowrite8(priv, &priv->map->PHY[1], (data >> 8) & 0xFF); - rtl818x_iowrite8(priv, &priv->map->PHY[0], data & 0xFF); -} - -static void rtl8187_tx_cb(struct urb *urb) -{ - struct sk_buff *skb = (struct sk_buff *)urb->context; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hw *hw = info->rate_driver_data[0]; - struct rtl8187_priv *priv = hw->priv; - - skb_pull(skb, priv->is_rtl8187b ? sizeof(struct rtl8187b_tx_hdr) : - sizeof(struct rtl8187_tx_hdr)); - ieee80211_tx_info_clear_status(info); - - if (!(urb->status) && !(info->flags & IEEE80211_TX_CTL_NO_ACK)) { - if (priv->is_rtl8187b) { - skb_queue_tail(&priv->b_tx_status.queue, skb); - - /* queue is "full", discard last items */ - while (skb_queue_len(&priv->b_tx_status.queue) > 5) { - struct sk_buff *old_skb; - - dev_dbg(&priv->udev->dev, - "transmit status queue full\n"); - - old_skb = skb_dequeue(&priv->b_tx_status.queue); - ieee80211_tx_status_irqsafe(hw, old_skb); - } - return; - } else { - info->flags |= IEEE80211_TX_STAT_ACK; - } - } - if (priv->is_rtl8187b) - ieee80211_tx_status_irqsafe(hw, skb); - else { - /* Retry information for the RTI8187 is only available by - * reading a register in the device. We are in interrupt mode - * here, thus queue the skb and finish on a work queue. */ - skb_queue_tail(&priv->b_tx_status.queue, skb); - ieee80211_queue_delayed_work(hw, &priv->work, 0); - } -} - -static void rtl8187_tx(struct ieee80211_hw *dev, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct rtl8187_priv *priv = dev->priv; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *tx_hdr = (struct ieee80211_hdr *)(skb->data); - unsigned int ep; - void *buf; - struct urb *urb; - __le16 rts_dur = 0; - u32 flags; - int rc; - - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!urb) { - kfree_skb(skb); - return; - } - - flags = skb->len; - flags |= RTL818X_TX_DESC_FLAG_NO_ENC; - - flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24; - if (ieee80211_has_morefrags(tx_hdr->frame_control)) - flags |= RTL818X_TX_DESC_FLAG_MOREFRAG; - if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) { - flags |= RTL818X_TX_DESC_FLAG_RTS; - flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; - rts_dur = ieee80211_rts_duration(dev, priv->vif, - skb->len, info); - } else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { - flags |= RTL818X_TX_DESC_FLAG_CTS; - flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; - } - - if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { - if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) - priv->seqno += 0x10; - tx_hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); - tx_hdr->seq_ctrl |= cpu_to_le16(priv->seqno); - } - - if (!priv->is_rtl8187b) { - struct rtl8187_tx_hdr *hdr = - (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr)); - hdr->flags = cpu_to_le32(flags); - hdr->len = 0; - hdr->rts_duration = rts_dur; - hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8); - buf = hdr; - - ep = 2; - } else { - /* fc needs to be calculated before skb_push() */ - unsigned int epmap[4] = { 6, 7, 5, 4 }; - u16 fc = le16_to_cpu(tx_hdr->frame_control); - - struct rtl8187b_tx_hdr *hdr = - (struct rtl8187b_tx_hdr *)skb_push(skb, sizeof(*hdr)); - struct ieee80211_rate *txrate = - ieee80211_get_tx_rate(dev, info); - memset(hdr, 0, sizeof(*hdr)); - hdr->flags = cpu_to_le32(flags); - hdr->rts_duration = rts_dur; - hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8); - hdr->tx_duration = - ieee80211_generic_frame_duration(dev, priv->vif, - info->band, - skb->len, txrate); - buf = hdr; - - if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) - ep = 12; - else - ep = epmap[skb_get_queue_mapping(skb)]; - } - - info->rate_driver_data[0] = dev; - info->rate_driver_data[1] = urb; - - usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, ep), - buf, skb->len, rtl8187_tx_cb, skb); - urb->transfer_flags |= URB_ZERO_PACKET; - usb_anchor_urb(urb, &priv->anchored); - rc = usb_submit_urb(urb, GFP_ATOMIC); - if (rc < 0) { - usb_unanchor_urb(urb); - kfree_skb(skb); - } - usb_free_urb(urb); -} - -static void rtl8187_rx_cb(struct urb *urb) -{ - struct sk_buff *skb = (struct sk_buff *)urb->context; - struct rtl8187_rx_info *info = (struct rtl8187_rx_info *)skb->cb; - struct ieee80211_hw *dev = info->dev; - struct rtl8187_priv *priv = dev->priv; - struct ieee80211_rx_status rx_status = { 0 }; - int rate, signal; - u32 flags; - unsigned long f; - - spin_lock_irqsave(&priv->rx_queue.lock, f); - __skb_unlink(skb, &priv->rx_queue); - spin_unlock_irqrestore(&priv->rx_queue.lock, f); - skb_put(skb, urb->actual_length); - - if (unlikely(urb->status)) { - dev_kfree_skb_irq(skb); - return; - } - - if (!priv->is_rtl8187b) { - struct rtl8187_rx_hdr *hdr = - (typeof(hdr))(skb_tail_pointer(skb) - sizeof(*hdr)); - flags = le32_to_cpu(hdr->flags); - /* As with the RTL8187B below, the AGC is used to calculate - * signal strength. In this case, the scaling - * constants are derived from the output of p54usb. - */ - signal = -4 - ((27 * hdr->agc) >> 6); - rx_status.antenna = (hdr->signal >> 7) & 1; - rx_status.mactime = le64_to_cpu(hdr->mac_time); - } else { - struct rtl8187b_rx_hdr *hdr = - (typeof(hdr))(skb_tail_pointer(skb) - sizeof(*hdr)); - /* The Realtek datasheet for the RTL8187B shows that the RX - * header contains the following quantities: signal quality, - * RSSI, AGC, the received power in dB, and the measured SNR. - * In testing, none of these quantities show qualitative - * agreement with AP signal strength, except for the AGC, - * which is inversely proportional to the strength of the - * signal. In the following, the signal strength - * is derived from the AGC. The arbitrary scaling constants - * are chosen to make the results close to the values obtained - * for a BCM4312 using b43 as the driver. The noise is ignored - * for now. - */ - flags = le32_to_cpu(hdr->flags); - signal = 14 - hdr->agc / 2; - rx_status.antenna = (hdr->rssi >> 7) & 1; - rx_status.mactime = le64_to_cpu(hdr->mac_time); - } - - rx_status.signal = signal; - priv->signal = signal; - rate = (flags >> 20) & 0xF; - skb_trim(skb, flags & 0x0FFF); - rx_status.rate_idx = rate; - rx_status.freq = dev->conf.chandef.chan->center_freq; - rx_status.band = dev->conf.chandef.chan->band; - rx_status.flag |= RX_FLAG_MACTIME_START; - if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) - rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; - memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); - ieee80211_rx_irqsafe(dev, skb); - - skb = dev_alloc_skb(RTL8187_MAX_RX); - if (unlikely(!skb)) { - /* TODO check rx queue length and refill *somewhere* */ - return; - } - - info = (struct rtl8187_rx_info *)skb->cb; - info->urb = urb; - info->dev = dev; - urb->transfer_buffer = skb_tail_pointer(skb); - urb->context = skb; - skb_queue_tail(&priv->rx_queue, skb); - - usb_anchor_urb(urb, &priv->anchored); - if (usb_submit_urb(urb, GFP_ATOMIC)) { - usb_unanchor_urb(urb); - skb_unlink(skb, &priv->rx_queue); - dev_kfree_skb_irq(skb); - } -} - -static int rtl8187_init_urbs(struct ieee80211_hw *dev) -{ - struct rtl8187_priv *priv = dev->priv; - struct urb *entry = NULL; - struct sk_buff *skb; - struct rtl8187_rx_info *info; - int ret = 0; - - while (skb_queue_len(&priv->rx_queue) < 16) { - skb = __dev_alloc_skb(RTL8187_MAX_RX, GFP_KERNEL); - if (!skb) { - ret = -ENOMEM; - goto err; - } - entry = usb_alloc_urb(0, GFP_KERNEL); - if (!entry) { - ret = -ENOMEM; - goto err; - } - usb_fill_bulk_urb(entry, priv->udev, - usb_rcvbulkpipe(priv->udev, - priv->is_rtl8187b ? 3 : 1), - skb_tail_pointer(skb), - RTL8187_MAX_RX, rtl8187_rx_cb, skb); - info = (struct rtl8187_rx_info *)skb->cb; - info->urb = entry; - info->dev = dev; - skb_queue_tail(&priv->rx_queue, skb); - usb_anchor_urb(entry, &priv->anchored); - ret = usb_submit_urb(entry, GFP_KERNEL); - if (ret) { - skb_unlink(skb, &priv->rx_queue); - usb_unanchor_urb(entry); - goto err; - } - usb_free_urb(entry); - } - return ret; - -err: - usb_free_urb(entry); - kfree_skb(skb); - usb_kill_anchored_urbs(&priv->anchored); - return ret; -} - -static void rtl8187b_status_cb(struct urb *urb) -{ - struct ieee80211_hw *hw = (struct ieee80211_hw *)urb->context; - struct rtl8187_priv *priv = hw->priv; - u64 val; - unsigned int cmd_type; - - if (unlikely(urb->status)) - return; - - /* - * Read from status buffer: - * - * bits [30:31] = cmd type: - * - 0 indicates tx beacon interrupt - * - 1 indicates tx close descriptor - * - * In the case of tx beacon interrupt: - * [0:9] = Last Beacon CW - * [10:29] = reserved - * [30:31] = 00b - * [32:63] = Last Beacon TSF - * - * If it's tx close descriptor: - * [0:7] = Packet Retry Count - * [8:14] = RTS Retry Count - * [15] = TOK - * [16:27] = Sequence No - * [28] = LS - * [29] = FS - * [30:31] = 01b - * [32:47] = unused (reserved?) - * [48:63] = MAC Used Time - */ - val = le64_to_cpu(priv->b_tx_status.buf); - - cmd_type = (val >> 30) & 0x3; - if (cmd_type == 1) { - unsigned int pkt_rc, seq_no; - bool tok; - struct sk_buff *skb; - struct ieee80211_hdr *ieee80211hdr; - unsigned long flags; - - pkt_rc = val & 0xFF; - tok = val & (1 << 15); - seq_no = (val >> 16) & 0xFFF; - - spin_lock_irqsave(&priv->b_tx_status.queue.lock, flags); - skb_queue_reverse_walk(&priv->b_tx_status.queue, skb) { - ieee80211hdr = (struct ieee80211_hdr *)skb->data; - - /* - * While testing, it was discovered that the seq_no - * doesn't actually contains the sequence number. - * Instead of returning just the 12 bits of sequence - * number, hardware is returning entire sequence control - * (fragment number plus sequence number) in a 12 bit - * only field overflowing after some time. As a - * workaround, just consider the lower bits, and expect - * it's unlikely we wrongly ack some sent data - */ - if ((le16_to_cpu(ieee80211hdr->seq_ctrl) - & 0xFFF) == seq_no) - break; - } - if (skb != (struct sk_buff *) &priv->b_tx_status.queue) { - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - __skb_unlink(skb, &priv->b_tx_status.queue); - if (tok) - info->flags |= IEEE80211_TX_STAT_ACK; - info->status.rates[0].count = pkt_rc + 1; - - ieee80211_tx_status_irqsafe(hw, skb); - } - spin_unlock_irqrestore(&priv->b_tx_status.queue.lock, flags); - } - - usb_anchor_urb(urb, &priv->anchored); - if (usb_submit_urb(urb, GFP_ATOMIC)) - usb_unanchor_urb(urb); -} - -static int rtl8187b_init_status_urb(struct ieee80211_hw *dev) -{ - struct rtl8187_priv *priv = dev->priv; - struct urb *entry; - int ret = 0; - - entry = usb_alloc_urb(0, GFP_KERNEL); - if (!entry) - return -ENOMEM; - - usb_fill_bulk_urb(entry, priv->udev, usb_rcvbulkpipe(priv->udev, 9), - &priv->b_tx_status.buf, sizeof(priv->b_tx_status.buf), - rtl8187b_status_cb, dev); - - usb_anchor_urb(entry, &priv->anchored); - ret = usb_submit_urb(entry, GFP_KERNEL); - if (ret) - usb_unanchor_urb(entry); - usb_free_urb(entry); - - return ret; -} - -static void rtl8187_set_anaparam(struct rtl8187_priv *priv, bool rfon) -{ - u32 anaparam, anaparam2; - u8 anaparam3, reg; - - if (!priv->is_rtl8187b) { - if (rfon) { - anaparam = RTL8187_RTL8225_ANAPARAM_ON; - anaparam2 = RTL8187_RTL8225_ANAPARAM2_ON; - } else { - anaparam = RTL8187_RTL8225_ANAPARAM_OFF; - anaparam2 = RTL8187_RTL8225_ANAPARAM2_OFF; - } - } else { - if (rfon) { - anaparam = RTL8187B_RTL8225_ANAPARAM_ON; - anaparam2 = RTL8187B_RTL8225_ANAPARAM2_ON; - anaparam3 = RTL8187B_RTL8225_ANAPARAM3_ON; - } else { - anaparam = RTL8187B_RTL8225_ANAPARAM_OFF; - anaparam2 = RTL8187B_RTL8225_ANAPARAM2_OFF; - anaparam3 = RTL8187B_RTL8225_ANAPARAM3_OFF; - } - } - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, - RTL818X_EEPROM_CMD_CONFIG); - reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); - reg |= RTL818X_CONFIG3_ANAPARAM_WRITE; - rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg); - rtl818x_iowrite32(priv, &priv->map->ANAPARAM, anaparam); - rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, anaparam2); - if (priv->is_rtl8187b) - rtl818x_iowrite8(priv, &priv->map->ANAPARAM3, anaparam3); - reg &= ~RTL818X_CONFIG3_ANAPARAM_WRITE; - rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, - RTL818X_EEPROM_CMD_NORMAL); -} - -static int rtl8187_cmd_reset(struct ieee80211_hw *dev) -{ - struct rtl8187_priv *priv = dev->priv; - u8 reg; - int i; - - reg = rtl818x_ioread8(priv, &priv->map->CMD); - reg &= (1 << 1); - reg |= RTL818X_CMD_RESET; - rtl818x_iowrite8(priv, &priv->map->CMD, reg); - - i = 10; - do { - msleep(2); - if (!(rtl818x_ioread8(priv, &priv->map->CMD) & - RTL818X_CMD_RESET)) - break; - } while (--i); - - if (!i) { - wiphy_err(dev->wiphy, "Reset timeout!\n"); - return -ETIMEDOUT; - } - - /* reload registers from eeprom */ - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_LOAD); - - i = 10; - do { - msleep(4); - if (!(rtl818x_ioread8(priv, &priv->map->EEPROM_CMD) & - RTL818X_EEPROM_CMD_CONFIG)) - break; - } while (--i); - - if (!i) { - wiphy_err(dev->wiphy, "eeprom reset timeout!\n"); - return -ETIMEDOUT; - } - - return 0; -} - -static int rtl8187_init_hw(struct ieee80211_hw *dev) -{ - struct rtl8187_priv *priv = dev->priv; - u8 reg; - int res; - - /* reset */ - rtl8187_set_anaparam(priv, true); - - rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0); - - msleep(200); - rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x10); - rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x11); - rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x00); - msleep(200); - - res = rtl8187_cmd_reset(dev); - if (res) - return res; - - rtl8187_set_anaparam(priv, true); - - /* setup card */ - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0); - rtl818x_iowrite8(priv, &priv->map->GPIO0, 0); - - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, (4 << 8)); - rtl818x_iowrite8(priv, &priv->map->GPIO0, 1); - rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0); - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - - rtl818x_iowrite16(priv, (__le16 *)0xFFF4, 0xFFFF); - reg = rtl818x_ioread8(priv, &priv->map->CONFIG1); - reg &= 0x3F; - reg |= 0x80; - rtl818x_iowrite8(priv, &priv->map->CONFIG1, reg); - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); - - rtl818x_iowrite32(priv, &priv->map->INT_TIMEOUT, 0); - rtl818x_iowrite8(priv, &priv->map->WPA_CONF, 0); - rtl818x_iowrite8(priv, &priv->map->RATE_FALLBACK, 0); - - // TODO: set RESP_RATE and BRSR properly - rtl818x_iowrite8(priv, &priv->map->RESP_RATE, (8 << 4) | 0); - rtl818x_iowrite16(priv, &priv->map->BRSR, 0x01F3); - - /* host_usb_init */ - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0); - rtl818x_iowrite8(priv, &priv->map->GPIO0, 0); - reg = rtl818x_ioread8(priv, (u8 *)0xFE53); - rtl818x_iowrite8(priv, (u8 *)0xFE53, reg | (1 << 7)); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, (4 << 8)); - rtl818x_iowrite8(priv, &priv->map->GPIO0, 0x20); - rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x80); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x80); - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x80); - msleep(100); - - rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x000a8008); - rtl818x_iowrite16(priv, &priv->map->BRSR, 0xFFFF); - rtl818x_iowrite32(priv, &priv->map->RF_PARA, 0x00100044); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, - RTL818X_EEPROM_CMD_CONFIG); - rtl818x_iowrite8(priv, &priv->map->CONFIG3, 0x44); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, - RTL818X_EEPROM_CMD_NORMAL); - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FF7); - msleep(100); - - priv->rf->init(dev); - - rtl818x_iowrite16(priv, &priv->map->BRSR, 0x01F3); - reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) & ~1; - rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg | 1); - rtl818x_iowrite16(priv, (__le16 *)0xFFFE, 0x10); - rtl818x_iowrite8(priv, &priv->map->TALLY_SEL, 0x80); - rtl818x_iowrite8(priv, (u8 *)0xFFFF, 0x60); - rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg); - - return 0; -} - -static const u8 rtl8187b_reg_table[][3] = { - {0xF0, 0x32, 0}, {0xF1, 0x32, 0}, {0xF2, 0x00, 0}, {0xF3, 0x00, 0}, - {0xF4, 0x32, 0}, {0xF5, 0x43, 0}, {0xF6, 0x00, 0}, {0xF7, 0x00, 0}, - {0xF8, 0x46, 0}, {0xF9, 0xA4, 0}, {0xFA, 0x00, 0}, {0xFB, 0x00, 0}, - {0xFC, 0x96, 0}, {0xFD, 0xA4, 0}, {0xFE, 0x00, 0}, {0xFF, 0x00, 0}, - - {0x58, 0x4B, 1}, {0x59, 0x00, 1}, {0x5A, 0x4B, 1}, {0x5B, 0x00, 1}, - {0x60, 0x4B, 1}, {0x61, 0x09, 1}, {0x62, 0x4B, 1}, {0x63, 0x09, 1}, - {0xCE, 0x0F, 1}, {0xCF, 0x00, 1}, {0xF0, 0x4E, 1}, {0xF1, 0x01, 1}, - {0xF2, 0x02, 1}, {0xF3, 0x03, 1}, {0xF4, 0x04, 1}, {0xF5, 0x05, 1}, - {0xF6, 0x06, 1}, {0xF7, 0x07, 1}, {0xF8, 0x08, 1}, - - {0x4E, 0x00, 2}, {0x0C, 0x04, 2}, {0x21, 0x61, 2}, {0x22, 0x68, 2}, - {0x23, 0x6F, 2}, {0x24, 0x76, 2}, {0x25, 0x7D, 2}, {0x26, 0x84, 2}, - {0x27, 0x8D, 2}, {0x4D, 0x08, 2}, {0x50, 0x05, 2}, {0x51, 0xF5, 2}, - {0x52, 0x04, 2}, {0x53, 0xA0, 2}, {0x54, 0x1F, 2}, {0x55, 0x23, 2}, - {0x56, 0x45, 2}, {0x57, 0x67, 2}, {0x58, 0x08, 2}, {0x59, 0x08, 2}, - {0x5A, 0x08, 2}, {0x5B, 0x08, 2}, {0x60, 0x08, 2}, {0x61, 0x08, 2}, - {0x62, 0x08, 2}, {0x63, 0x08, 2}, {0x64, 0xCF, 2}, - - {0x5B, 0x40, 0}, {0x84, 0x88, 0}, {0x85, 0x24, 0}, {0x88, 0x54, 0}, - {0x8B, 0xB8, 0}, {0x8C, 0x07, 0}, {0x8D, 0x00, 0}, {0x94, 0x1B, 0}, - {0x95, 0x12, 0}, {0x96, 0x00, 0}, {0x97, 0x06, 0}, {0x9D, 0x1A, 0}, - {0x9F, 0x10, 0}, {0xB4, 0x22, 0}, {0xBE, 0x80, 0}, {0xDB, 0x00, 0}, - {0xEE, 0x00, 0}, {0x4C, 0x00, 2}, - - {0x9F, 0x00, 3}, {0x8C, 0x01, 0}, {0x8D, 0x10, 0}, {0x8E, 0x08, 0}, - {0x8F, 0x00, 0} -}; - -static int rtl8187b_init_hw(struct ieee80211_hw *dev) -{ - struct rtl8187_priv *priv = dev->priv; - int res, i; - u8 reg; - - rtl8187_set_anaparam(priv, true); - - /* Reset PLL sequence on 8187B. Realtek note: reduces power - * consumption about 30 mA */ - rtl818x_iowrite8(priv, (u8 *)0xFF61, 0x10); - reg = rtl818x_ioread8(priv, (u8 *)0xFF62); - rtl818x_iowrite8(priv, (u8 *)0xFF62, reg & ~(1 << 5)); - rtl818x_iowrite8(priv, (u8 *)0xFF62, reg | (1 << 5)); - - res = rtl8187_cmd_reset(dev); - if (res) - return res; - - rtl8187_set_anaparam(priv, true); - - /* BRSR (Basic Rate Set Register) on 8187B looks to be the same as - * RESP_RATE on 8187L in Realtek sources: each bit should be each - * one of the 12 rates, all are enabled */ - rtl818x_iowrite16(priv, (__le16 *)0xFF34, 0x0FFF); - - reg = rtl818x_ioread8(priv, &priv->map->CW_CONF); - reg |= RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT; - rtl818x_iowrite8(priv, &priv->map->CW_CONF, reg); - - /* Auto Rate Fallback Register (ARFR): 1M-54M setting */ - rtl818x_iowrite16_idx(priv, (__le16 *)0xFFE0, 0x0FFF, 1); - rtl818x_iowrite8_idx(priv, (u8 *)0xFFE2, 0x00, 1); - - rtl818x_iowrite16_idx(priv, (__le16 *)0xFFD4, 0xFFFF, 1); - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, - RTL818X_EEPROM_CMD_CONFIG); - reg = rtl818x_ioread8(priv, &priv->map->CONFIG1); - rtl818x_iowrite8(priv, &priv->map->CONFIG1, (reg & 0x3F) | 0x80); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, - RTL818X_EEPROM_CMD_NORMAL); - - rtl818x_iowrite8(priv, &priv->map->WPA_CONF, 0); - for (i = 0; i < ARRAY_SIZE(rtl8187b_reg_table); i++) { - rtl818x_iowrite8_idx(priv, - (u8 *)(uintptr_t) - (rtl8187b_reg_table[i][0] | 0xFF00), - rtl8187b_reg_table[i][1], - rtl8187b_reg_table[i][2]); - } - - rtl818x_iowrite16(priv, &priv->map->TID_AC_MAP, 0xFA50); - rtl818x_iowrite16(priv, &priv->map->INT_MIG, 0); - - rtl818x_iowrite32_idx(priv, (__le32 *)0xFFF0, 0, 1); - rtl818x_iowrite32_idx(priv, (__le32 *)0xFFF4, 0, 1); - rtl818x_iowrite8_idx(priv, (u8 *)0xFFF8, 0, 1); - - rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x00004001); - - /* RFSW_CTRL register */ - rtl818x_iowrite16_idx(priv, (__le16 *)0xFF72, 0x569A, 2); - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x2488); - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF); - msleep(100); - - priv->rf->init(dev); - - reg = RTL818X_CMD_TX_ENABLE | RTL818X_CMD_RX_ENABLE; - rtl818x_iowrite8(priv, &priv->map->CMD, reg); - rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF); - - rtl818x_iowrite8(priv, (u8 *)0xFE41, 0xF4); - rtl818x_iowrite8(priv, (u8 *)0xFE40, 0x00); - rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x00); - rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x01); - rtl818x_iowrite8(priv, (u8 *)0xFE40, 0x0F); - rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x00); - rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x01); - - reg = rtl818x_ioread8(priv, (u8 *)0xFFDB); - rtl818x_iowrite8(priv, (u8 *)0xFFDB, reg | (1 << 2)); - rtl818x_iowrite16_idx(priv, (__le16 *)0xFF72, 0x59FA, 3); - rtl818x_iowrite16_idx(priv, (__le16 *)0xFF74, 0x59D2, 3); - rtl818x_iowrite16_idx(priv, (__le16 *)0xFF76, 0x59D2, 3); - rtl818x_iowrite16_idx(priv, (__le16 *)0xFF78, 0x19FA, 3); - rtl818x_iowrite16_idx(priv, (__le16 *)0xFF7A, 0x19FA, 3); - rtl818x_iowrite16_idx(priv, (__le16 *)0xFF7C, 0x00D0, 3); - rtl818x_iowrite8(priv, (u8 *)0xFF61, 0); - rtl818x_iowrite8_idx(priv, (u8 *)0xFF80, 0x0F, 1); - rtl818x_iowrite8_idx(priv, (u8 *)0xFF83, 0x03, 1); - rtl818x_iowrite8(priv, (u8 *)0xFFDA, 0x10); - rtl818x_iowrite8_idx(priv, (u8 *)0xFF4D, 0x08, 2); - - rtl818x_iowrite32(priv, &priv->map->HSSI_PARA, 0x0600321B); - - rtl818x_iowrite16_idx(priv, (__le16 *)0xFFEC, 0x0800, 1); - - priv->slot_time = 0x9; - priv->aifsn[0] = 2; /* AIFSN[AC_VO] */ - priv->aifsn[1] = 2; /* AIFSN[AC_VI] */ - priv->aifsn[2] = 7; /* AIFSN[AC_BK] */ - priv->aifsn[3] = 3; /* AIFSN[AC_BE] */ - rtl818x_iowrite8(priv, &priv->map->ACM_CONTROL, 0); - - /* ENEDCA flag must always be set, transmit issues? */ - rtl818x_iowrite8(priv, &priv->map->MSR, RTL818X_MSR_ENEDCA); - - return 0; -} - -static void rtl8187_work(struct work_struct *work) -{ - /* The RTL8187 returns the retry count through register 0xFFFA. In - * addition, it appears to be a cumulative retry count, not the - * value for the current TX packet. When multiple TX entries are - * waiting in the queue, the retry count will be the total for all. - * The "error" may matter for purposes of rate setting, but there is - * no other choice with this hardware. - */ - struct rtl8187_priv *priv = container_of(work, struct rtl8187_priv, - work.work); - struct ieee80211_tx_info *info; - struct ieee80211_hw *dev = priv->dev; - static u16 retry; - u16 tmp; - u16 avg_retry; - int length; - - mutex_lock(&priv->conf_mutex); - tmp = rtl818x_ioread16(priv, (__le16 *)0xFFFA); - length = skb_queue_len(&priv->b_tx_status.queue); - if (unlikely(!length)) - length = 1; - if (unlikely(tmp < retry)) - tmp = retry; - avg_retry = (tmp - retry) / length; - while (skb_queue_len(&priv->b_tx_status.queue) > 0) { - struct sk_buff *old_skb; - - old_skb = skb_dequeue(&priv->b_tx_status.queue); - info = IEEE80211_SKB_CB(old_skb); - info->status.rates[0].count = avg_retry + 1; - if (info->status.rates[0].count > RETRY_COUNT) - info->flags &= ~IEEE80211_TX_STAT_ACK; - ieee80211_tx_status_irqsafe(dev, old_skb); - } - retry = tmp; - mutex_unlock(&priv->conf_mutex); -} - -static int rtl8187_start(struct ieee80211_hw *dev) -{ - struct rtl8187_priv *priv = dev->priv; - u32 reg; - int ret; - - mutex_lock(&priv->conf_mutex); - - ret = (!priv->is_rtl8187b) ? rtl8187_init_hw(dev) : - rtl8187b_init_hw(dev); - if (ret) - goto rtl8187_start_exit; - - init_usb_anchor(&priv->anchored); - priv->dev = dev; - - if (priv->is_rtl8187b) { - reg = RTL818X_RX_CONF_MGMT | - RTL818X_RX_CONF_DATA | - RTL818X_RX_CONF_BROADCAST | - RTL818X_RX_CONF_NICMAC | - RTL818X_RX_CONF_BSSID | - (7 << 13 /* RX FIFO threshold NONE */) | - (7 << 10 /* MAX RX DMA */) | - RTL818X_RX_CONF_RX_AUTORESETPHY | - RTL818X_RX_CONF_ONLYERLPKT | - RTL818X_RX_CONF_MULTICAST; - priv->rx_conf = reg; - rtl818x_iowrite32(priv, &priv->map->RX_CONF, reg); - - reg = rtl818x_ioread8(priv, &priv->map->TX_AGC_CTL); - reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT; - reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT; - reg &= ~RTL818X_TX_AGC_CTL_FEEDBACK_ANT; - rtl818x_iowrite8(priv, &priv->map->TX_AGC_CTL, reg); - - rtl818x_iowrite32(priv, &priv->map->TX_CONF, - RTL818X_TX_CONF_HW_SEQNUM | - RTL818X_TX_CONF_DISREQQSIZE | - (RETRY_COUNT << 8 /* short retry limit */) | - (RETRY_COUNT << 0 /* long retry limit */) | - (7 << 21 /* MAX TX DMA */)); - rtl8187_init_urbs(dev); - rtl8187b_init_status_urb(dev); - goto rtl8187_start_exit; - } - - rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF); - - rtl818x_iowrite32(priv, &priv->map->MAR[0], ~0); - rtl818x_iowrite32(priv, &priv->map->MAR[1], ~0); - - rtl8187_init_urbs(dev); - - reg = RTL818X_RX_CONF_ONLYERLPKT | - RTL818X_RX_CONF_RX_AUTORESETPHY | - RTL818X_RX_CONF_BSSID | - RTL818X_RX_CONF_MGMT | - RTL818X_RX_CONF_DATA | - (7 << 13 /* RX FIFO threshold NONE */) | - (7 << 10 /* MAX RX DMA */) | - RTL818X_RX_CONF_BROADCAST | - RTL818X_RX_CONF_NICMAC; - - priv->rx_conf = reg; - rtl818x_iowrite32(priv, &priv->map->RX_CONF, reg); - - reg = rtl818x_ioread8(priv, &priv->map->CW_CONF); - reg &= ~RTL818X_CW_CONF_PERPACKET_CW_SHIFT; - reg |= RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT; - rtl818x_iowrite8(priv, &priv->map->CW_CONF, reg); - - reg = rtl818x_ioread8(priv, &priv->map->TX_AGC_CTL); - reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT; - reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT; - reg &= ~RTL818X_TX_AGC_CTL_FEEDBACK_ANT; - rtl818x_iowrite8(priv, &priv->map->TX_AGC_CTL, reg); - - reg = RTL818X_TX_CONF_CW_MIN | - (7 << 21 /* MAX TX DMA */) | - RTL818X_TX_CONF_NO_ICV; - rtl818x_iowrite32(priv, &priv->map->TX_CONF, reg); - - reg = rtl818x_ioread8(priv, &priv->map->CMD); - reg |= RTL818X_CMD_TX_ENABLE; - reg |= RTL818X_CMD_RX_ENABLE; - rtl818x_iowrite8(priv, &priv->map->CMD, reg); - INIT_DELAYED_WORK(&priv->work, rtl8187_work); - -rtl8187_start_exit: - mutex_unlock(&priv->conf_mutex); - return ret; -} - -static void rtl8187_stop(struct ieee80211_hw *dev) -{ - struct rtl8187_priv *priv = dev->priv; - struct sk_buff *skb; - u32 reg; - - mutex_lock(&priv->conf_mutex); - rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0); - - reg = rtl818x_ioread8(priv, &priv->map->CMD); - reg &= ~RTL818X_CMD_TX_ENABLE; - reg &= ~RTL818X_CMD_RX_ENABLE; - rtl818x_iowrite8(priv, &priv->map->CMD, reg); - - priv->rf->stop(dev); - rtl8187_set_anaparam(priv, false); - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - reg = rtl818x_ioread8(priv, &priv->map->CONFIG4); - rtl818x_iowrite8(priv, &priv->map->CONFIG4, reg | RTL818X_CONFIG4_VCOOFF); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); - - while ((skb = skb_dequeue(&priv->b_tx_status.queue))) - dev_kfree_skb_any(skb); - - usb_kill_anchored_urbs(&priv->anchored); - mutex_unlock(&priv->conf_mutex); - - if (!priv->is_rtl8187b) - cancel_delayed_work_sync(&priv->work); -} - -static u64 rtl8187_get_tsf(struct ieee80211_hw *dev, struct ieee80211_vif *vif) -{ - struct rtl8187_priv *priv = dev->priv; - - return rtl818x_ioread32(priv, &priv->map->TSFT[0]) | - (u64)(rtl818x_ioread32(priv, &priv->map->TSFT[1])) << 32; -} - - -static void rtl8187_beacon_work(struct work_struct *work) -{ - struct rtl8187_vif *vif_priv = - container_of(work, struct rtl8187_vif, beacon_work.work); - struct ieee80211_vif *vif = - container_of((void *)vif_priv, struct ieee80211_vif, drv_priv); - struct ieee80211_hw *dev = vif_priv->dev; - struct ieee80211_mgmt *mgmt; - struct sk_buff *skb; - - /* don't overflow the tx ring */ - if (ieee80211_queue_stopped(dev, 0)) - goto resched; - - /* grab a fresh beacon */ - skb = ieee80211_beacon_get(dev, vif); - if (!skb) - goto resched; - - /* - * update beacon timestamp w/ TSF value - * TODO: make hardware update beacon timestamp - */ - mgmt = (struct ieee80211_mgmt *)skb->data; - mgmt->u.beacon.timestamp = cpu_to_le64(rtl8187_get_tsf(dev, vif)); - - /* TODO: use actual beacon queue */ - skb_set_queue_mapping(skb, 0); - - rtl8187_tx(dev, NULL, skb); - -resched: - /* - * schedule next beacon - * TODO: use hardware support for beacon timing - */ - schedule_delayed_work(&vif_priv->beacon_work, - usecs_to_jiffies(1024 * vif->bss_conf.beacon_int)); -} - - -static int rtl8187_add_interface(struct ieee80211_hw *dev, - struct ieee80211_vif *vif) -{ - struct rtl8187_priv *priv = dev->priv; - struct rtl8187_vif *vif_priv; - int i; - int ret = -EOPNOTSUPP; - - mutex_lock(&priv->conf_mutex); - if (priv->vif) - goto exit; - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_ADHOC: - break; - default: - goto exit; - } - - ret = 0; - priv->vif = vif; - - /* Initialize driver private area */ - vif_priv = (struct rtl8187_vif *)&vif->drv_priv; - vif_priv->dev = dev; - INIT_DELAYED_WORK(&vif_priv->beacon_work, rtl8187_beacon_work); - vif_priv->enable_beacon = false; - - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - for (i = 0; i < ETH_ALEN; i++) - rtl818x_iowrite8(priv, &priv->map->MAC[i], - ((u8 *)vif->addr)[i]); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); - -exit: - mutex_unlock(&priv->conf_mutex); - return ret; -} - -static void rtl8187_remove_interface(struct ieee80211_hw *dev, - struct ieee80211_vif *vif) -{ - struct rtl8187_priv *priv = dev->priv; - mutex_lock(&priv->conf_mutex); - priv->vif = NULL; - mutex_unlock(&priv->conf_mutex); -} - -static int rtl8187_config(struct ieee80211_hw *dev, u32 changed) -{ - struct rtl8187_priv *priv = dev->priv; - struct ieee80211_conf *conf = &dev->conf; - u32 reg; - - mutex_lock(&priv->conf_mutex); - reg = rtl818x_ioread32(priv, &priv->map->TX_CONF); - /* Enable TX loopback on MAC level to avoid TX during channel - * changes, as this has be seen to causes problems and the - * card will stop work until next reset - */ - rtl818x_iowrite32(priv, &priv->map->TX_CONF, - reg | RTL818X_TX_CONF_LOOPBACK_MAC); - priv->rf->set_chan(dev, conf); - msleep(10); - rtl818x_iowrite32(priv, &priv->map->TX_CONF, reg); - - rtl818x_iowrite16(priv, &priv->map->ATIM_WND, 2); - rtl818x_iowrite16(priv, &priv->map->ATIMTR_INTERVAL, 100); - rtl818x_iowrite16(priv, &priv->map->BEACON_INTERVAL, 100); - rtl818x_iowrite16(priv, &priv->map->BEACON_INTERVAL_TIME, 100); - mutex_unlock(&priv->conf_mutex); - return 0; -} - -/* - * With 8187B, AC_*_PARAM clashes with FEMR definition in struct rtl818x_csr for - * example. Thus we have to use raw values for AC_*_PARAM register addresses. - */ -static __le32 *rtl8187b_ac_addr[4] = { - (__le32 *) 0xFFF0, /* AC_VO */ - (__le32 *) 0xFFF4, /* AC_VI */ - (__le32 *) 0xFFFC, /* AC_BK */ - (__le32 *) 0xFFF8, /* AC_BE */ -}; - -#define SIFS_TIME 0xa - -static void rtl8187_conf_erp(struct rtl8187_priv *priv, bool use_short_slot, - bool use_short_preamble) -{ - if (priv->is_rtl8187b) { - u8 difs, eifs; - u16 ack_timeout; - int queue; - - if (use_short_slot) { - priv->slot_time = 0x9; - difs = 0x1c; - eifs = 0x53; - } else { - priv->slot_time = 0x14; - difs = 0x32; - eifs = 0x5b; - } - rtl818x_iowrite8(priv, &priv->map->SIFS, 0x22); - rtl818x_iowrite8(priv, &priv->map->SLOT, priv->slot_time); - rtl818x_iowrite8(priv, &priv->map->DIFS, difs); - - /* - * BRSR+1 on 8187B is in fact EIFS register - * Value in units of 4 us - */ - rtl818x_iowrite8(priv, (u8 *)&priv->map->BRSR + 1, eifs); - - /* - * For 8187B, CARRIER_SENSE_COUNTER is in fact ack timeout - * register. In units of 4 us like eifs register - * ack_timeout = ack duration + plcp + difs + preamble - */ - ack_timeout = 112 + 48 + difs; - if (use_short_preamble) - ack_timeout += 72; - else - ack_timeout += 144; - rtl818x_iowrite8(priv, &priv->map->CARRIER_SENSE_COUNTER, - DIV_ROUND_UP(ack_timeout, 4)); - - for (queue = 0; queue < 4; queue++) - rtl818x_iowrite8(priv, (u8 *) rtl8187b_ac_addr[queue], - priv->aifsn[queue] * priv->slot_time + - SIFS_TIME); - } else { - rtl818x_iowrite8(priv, &priv->map->SIFS, 0x22); - if (use_short_slot) { - rtl818x_iowrite8(priv, &priv->map->SLOT, 0x9); - rtl818x_iowrite8(priv, &priv->map->DIFS, 0x14); - rtl818x_iowrite8(priv, &priv->map->EIFS, 91 - 0x14); - } else { - rtl818x_iowrite8(priv, &priv->map->SLOT, 0x14); - rtl818x_iowrite8(priv, &priv->map->DIFS, 0x24); - rtl818x_iowrite8(priv, &priv->map->EIFS, 91 - 0x24); - } - } -} - -static void rtl8187_bss_info_changed(struct ieee80211_hw *dev, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *info, - u32 changed) -{ - struct rtl8187_priv *priv = dev->priv; - struct rtl8187_vif *vif_priv; - int i; - u8 reg; - - vif_priv = (struct rtl8187_vif *)&vif->drv_priv; - - if (changed & BSS_CHANGED_BSSID) { - mutex_lock(&priv->conf_mutex); - for (i = 0; i < ETH_ALEN; i++) - rtl818x_iowrite8(priv, &priv->map->BSSID[i], - info->bssid[i]); - - if (priv->is_rtl8187b) - reg = RTL818X_MSR_ENEDCA; - else - reg = 0; - - if (is_valid_ether_addr(info->bssid)) { - if (vif->type == NL80211_IFTYPE_ADHOC) - reg |= RTL818X_MSR_ADHOC; - else - reg |= RTL818X_MSR_INFRA; - } - else - reg |= RTL818X_MSR_NO_LINK; - - rtl818x_iowrite8(priv, &priv->map->MSR, reg); - - mutex_unlock(&priv->conf_mutex); - } - - if (changed & (BSS_CHANGED_ERP_SLOT | BSS_CHANGED_ERP_PREAMBLE)) - rtl8187_conf_erp(priv, info->use_short_slot, - info->use_short_preamble); - - if (changed & BSS_CHANGED_BEACON_ENABLED) - vif_priv->enable_beacon = info->enable_beacon; - - if (changed & (BSS_CHANGED_BEACON_ENABLED | BSS_CHANGED_BEACON)) { - cancel_delayed_work_sync(&vif_priv->beacon_work); - if (vif_priv->enable_beacon) - schedule_work(&vif_priv->beacon_work.work); - } - -} - -static u64 rtl8187_prepare_multicast(struct ieee80211_hw *dev, - struct netdev_hw_addr_list *mc_list) -{ - return netdev_hw_addr_list_count(mc_list); -} - -static void rtl8187_configure_filter(struct ieee80211_hw *dev, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast) -{ - struct rtl8187_priv *priv = dev->priv; - - if (changed_flags & FIF_FCSFAIL) - priv->rx_conf ^= RTL818X_RX_CONF_FCS; - if (changed_flags & FIF_CONTROL) - priv->rx_conf ^= RTL818X_RX_CONF_CTRL; - if (changed_flags & FIF_OTHER_BSS) - priv->rx_conf ^= RTL818X_RX_CONF_MONITOR; - if (*total_flags & FIF_ALLMULTI || multicast > 0) - priv->rx_conf |= RTL818X_RX_CONF_MULTICAST; - else - priv->rx_conf &= ~RTL818X_RX_CONF_MULTICAST; - - *total_flags = 0; - - if (priv->rx_conf & RTL818X_RX_CONF_FCS) - *total_flags |= FIF_FCSFAIL; - if (priv->rx_conf & RTL818X_RX_CONF_CTRL) - *total_flags |= FIF_CONTROL; - if (priv->rx_conf & RTL818X_RX_CONF_MONITOR) - *total_flags |= FIF_OTHER_BSS; - if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST) - *total_flags |= FIF_ALLMULTI; - - rtl818x_iowrite32_async(priv, &priv->map->RX_CONF, priv->rx_conf); -} - -static int rtl8187_conf_tx(struct ieee80211_hw *dev, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - struct rtl8187_priv *priv = dev->priv; - u8 cw_min, cw_max; - - if (queue > 3) - return -EINVAL; - - cw_min = fls(params->cw_min); - cw_max = fls(params->cw_max); - - if (priv->is_rtl8187b) { - priv->aifsn[queue] = params->aifs; - - /* - * This is the structure of AC_*_PARAM registers in 8187B: - * - TXOP limit field, bit offset = 16 - * - ECWmax, bit offset = 12 - * - ECWmin, bit offset = 8 - * - AIFS, bit offset = 0 - */ - rtl818x_iowrite32(priv, rtl8187b_ac_addr[queue], - (params->txop << 16) | (cw_max << 12) | - (cw_min << 8) | (params->aifs * - priv->slot_time + SIFS_TIME)); - } else { - if (queue != 0) - return -EINVAL; - - rtl818x_iowrite8(priv, &priv->map->CW_VAL, - cw_min | (cw_max << 4)); - } - return 0; -} - - -static const struct ieee80211_ops rtl8187_ops = { - .tx = rtl8187_tx, - .start = rtl8187_start, - .stop = rtl8187_stop, - .add_interface = rtl8187_add_interface, - .remove_interface = rtl8187_remove_interface, - .config = rtl8187_config, - .bss_info_changed = rtl8187_bss_info_changed, - .prepare_multicast = rtl8187_prepare_multicast, - .configure_filter = rtl8187_configure_filter, - .conf_tx = rtl8187_conf_tx, - .rfkill_poll = rtl8187_rfkill_poll, - .get_tsf = rtl8187_get_tsf, -}; - -static void rtl8187_eeprom_register_read(struct eeprom_93cx6 *eeprom) -{ - struct ieee80211_hw *dev = eeprom->data; - struct rtl8187_priv *priv = dev->priv; - u8 reg = rtl818x_ioread8(priv, &priv->map->EEPROM_CMD); - - eeprom->reg_data_in = reg & RTL818X_EEPROM_CMD_WRITE; - eeprom->reg_data_out = reg & RTL818X_EEPROM_CMD_READ; - eeprom->reg_data_clock = reg & RTL818X_EEPROM_CMD_CK; - eeprom->reg_chip_select = reg & RTL818X_EEPROM_CMD_CS; -} - -static void rtl8187_eeprom_register_write(struct eeprom_93cx6 *eeprom) -{ - struct ieee80211_hw *dev = eeprom->data; - struct rtl8187_priv *priv = dev->priv; - u8 reg = RTL818X_EEPROM_CMD_PROGRAM; - - if (eeprom->reg_data_in) - reg |= RTL818X_EEPROM_CMD_WRITE; - if (eeprom->reg_data_out) - reg |= RTL818X_EEPROM_CMD_READ; - if (eeprom->reg_data_clock) - reg |= RTL818X_EEPROM_CMD_CK; - if (eeprom->reg_chip_select) - reg |= RTL818X_EEPROM_CMD_CS; - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, reg); - udelay(10); -} - -static int rtl8187_probe(struct usb_interface *intf, - const struct usb_device_id *id) -{ - struct usb_device *udev = interface_to_usbdev(intf); - struct ieee80211_hw *dev; - struct rtl8187_priv *priv; - struct eeprom_93cx6 eeprom; - struct ieee80211_channel *channel; - const char *chip_name; - u16 txpwr, reg; - u16 product_id = le16_to_cpu(udev->descriptor.idProduct); - int err, i; - u8 mac_addr[ETH_ALEN]; - - dev = ieee80211_alloc_hw(sizeof(*priv), &rtl8187_ops); - if (!dev) { - printk(KERN_ERR "rtl8187: ieee80211 alloc failed\n"); - return -ENOMEM; - } - - priv = dev->priv; - priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B); - - /* allocate "DMA aware" buffer for register accesses */ - priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf), GFP_KERNEL); - if (!priv->io_dmabuf) { - err = -ENOMEM; - goto err_free_dev; - } - mutex_init(&priv->io_mutex); - - SET_IEEE80211_DEV(dev, &intf->dev); - usb_set_intfdata(intf, dev); - priv->udev = udev; - - usb_get_dev(udev); - - skb_queue_head_init(&priv->rx_queue); - - BUILD_BUG_ON(sizeof(priv->channels) != sizeof(rtl818x_channels)); - BUILD_BUG_ON(sizeof(priv->rates) != sizeof(rtl818x_rates)); - - memcpy(priv->channels, rtl818x_channels, sizeof(rtl818x_channels)); - memcpy(priv->rates, rtl818x_rates, sizeof(rtl818x_rates)); - priv->map = (struct rtl818x_csr *)0xFF00; - - priv->band.band = IEEE80211_BAND_2GHZ; - priv->band.channels = priv->channels; - priv->band.n_channels = ARRAY_SIZE(rtl818x_channels); - priv->band.bitrates = priv->rates; - priv->band.n_bitrates = ARRAY_SIZE(rtl818x_rates); - dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band; - - - dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | - IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_RX_INCLUDES_FCS; - /* Initialize rate-control variables */ - dev->max_rates = 1; - dev->max_rate_tries = RETRY_COUNT; - - eeprom.data = dev; - eeprom.register_read = rtl8187_eeprom_register_read; - eeprom.register_write = rtl8187_eeprom_register_write; - if (rtl818x_ioread32(priv, &priv->map->RX_CONF) & (1 << 6)) - eeprom.width = PCI_EEPROM_WIDTH_93C66; - else - eeprom.width = PCI_EEPROM_WIDTH_93C46; - - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - udelay(10); - - eeprom_93cx6_multiread(&eeprom, RTL8187_EEPROM_MAC_ADDR, - (__le16 __force *)mac_addr, 3); - if (!is_valid_ether_addr(mac_addr)) { - printk(KERN_WARNING "rtl8187: Invalid hwaddr! Using randomly " - "generated MAC address\n"); - eth_random_addr(mac_addr); - } - SET_IEEE80211_PERM_ADDR(dev, mac_addr); - - channel = priv->channels; - for (i = 0; i < 3; i++) { - eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_1 + i, - &txpwr); - (*channel++).hw_value = txpwr & 0xFF; - (*channel++).hw_value = txpwr >> 8; - } - for (i = 0; i < 2; i++) { - eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_4 + i, - &txpwr); - (*channel++).hw_value = txpwr & 0xFF; - (*channel++).hw_value = txpwr >> 8; - } - - eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_BASE, - &priv->txpwr_base); - - reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) & ~1; - rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg | 1); - /* 0 means asic B-cut, we should use SW 3 wire - * bit-by-bit banging for radio. 1 means we can use - * USB specific request to write radio registers */ - priv->asic_rev = rtl818x_ioread8(priv, (u8 *)0xFFFE) & 0x3; - rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); - - if (!priv->is_rtl8187b) { - u32 reg32; - reg32 = rtl818x_ioread32(priv, &priv->map->TX_CONF); - reg32 &= RTL818X_TX_CONF_HWVER_MASK; - switch (reg32) { - case RTL818X_TX_CONF_R8187vD_B: - /* Some RTL8187B devices have a USB ID of 0x8187 - * detect them here */ - chip_name = "RTL8187BvB(early)"; - priv->is_rtl8187b = 1; - priv->hw_rev = RTL8187BvB; - break; - case RTL818X_TX_CONF_R8187vD: - chip_name = "RTL8187vD"; - break; - default: - chip_name = "RTL8187vB (default)"; - } - } else { - /* - * Force USB request to write radio registers for 8187B, Realtek - * only uses it in their sources - */ - /*if (priv->asic_rev == 0) { - printk(KERN_WARNING "rtl8187: Forcing use of USB " - "requests to write to radio registers\n"); - priv->asic_rev = 1; - }*/ - switch (rtl818x_ioread8(priv, (u8 *)0xFFE1)) { - case RTL818X_R8187B_B: - chip_name = "RTL8187BvB"; - priv->hw_rev = RTL8187BvB; - break; - case RTL818X_R8187B_D: - chip_name = "RTL8187BvD"; - priv->hw_rev = RTL8187BvD; - break; - case RTL818X_R8187B_E: - chip_name = "RTL8187BvE"; - priv->hw_rev = RTL8187BvE; - break; - default: - chip_name = "RTL8187BvB (default)"; - priv->hw_rev = RTL8187BvB; - } - } - - if (!priv->is_rtl8187b) { - for (i = 0; i < 2; i++) { - eeprom_93cx6_read(&eeprom, - RTL8187_EEPROM_TXPWR_CHAN_6 + i, - &txpwr); - (*channel++).hw_value = txpwr & 0xFF; - (*channel++).hw_value = txpwr >> 8; - } - } else { - eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_6, - &txpwr); - (*channel++).hw_value = txpwr & 0xFF; - - eeprom_93cx6_read(&eeprom, 0x0A, &txpwr); - (*channel++).hw_value = txpwr & 0xFF; - - eeprom_93cx6_read(&eeprom, 0x1C, &txpwr); - (*channel++).hw_value = txpwr & 0xFF; - (*channel++).hw_value = txpwr >> 8; - } - /* Handle the differing rfkill GPIO bit in different models */ - priv->rfkill_mask = RFKILL_MASK_8187_89_97; - if (product_id == 0x8197 || product_id == 0x8198) { - eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_SELECT_GPIO, ®); - if (reg & 0xFF00) - priv->rfkill_mask = RFKILL_MASK_8198; - } - dev->vif_data_size = sizeof(struct rtl8187_vif); - dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) ; - - if ((id->driver_info == DEVICE_RTL8187) && priv->is_rtl8187b) - printk(KERN_INFO "rtl8187: inconsistency between id with OEM" - " info!\n"); - - priv->rf = rtl8187_detect_rf(dev); - dev->extra_tx_headroom = (!priv->is_rtl8187b) ? - sizeof(struct rtl8187_tx_hdr) : - sizeof(struct rtl8187b_tx_hdr); - if (!priv->is_rtl8187b) - dev->queues = 1; - else - dev->queues = 4; - - err = ieee80211_register_hw(dev); - if (err) { - printk(KERN_ERR "rtl8187: Cannot register device\n"); - goto err_free_dmabuf; - } - mutex_init(&priv->conf_mutex); - skb_queue_head_init(&priv->b_tx_status.queue); - - wiphy_info(dev->wiphy, "hwaddr %pM, %s V%d + %s, rfkill mask %d\n", - mac_addr, chip_name, priv->asic_rev, priv->rf->name, - priv->rfkill_mask); - -#ifdef CONFIG_RTL8187_LEDS - eeprom_93cx6_read(&eeprom, 0x3F, ®); - reg &= 0xFF; - rtl8187_leds_init(dev, reg); -#endif - rtl8187_rfkill_init(dev); - - return 0; - - err_free_dmabuf: - kfree(priv->io_dmabuf); - err_free_dev: - ieee80211_free_hw(dev); - usb_set_intfdata(intf, NULL); - usb_put_dev(udev); - return err; -} - -static void rtl8187_disconnect(struct usb_interface *intf) -{ - struct ieee80211_hw *dev = usb_get_intfdata(intf); - struct rtl8187_priv *priv; - - if (!dev) - return; - -#ifdef CONFIG_RTL8187_LEDS - rtl8187_leds_exit(dev); -#endif - rtl8187_rfkill_exit(dev); - ieee80211_unregister_hw(dev); - - priv = dev->priv; - usb_reset_device(priv->udev); - usb_put_dev(interface_to_usbdev(intf)); - kfree(priv->io_dmabuf); - ieee80211_free_hw(dev); -} - -static struct usb_driver rtl8187_driver = { - .name = KBUILD_MODNAME, - .id_table = rtl8187_table, - .probe = rtl8187_probe, - .disconnect = rtl8187_disconnect, - .disable_hub_initiated_lpm = 1, -}; - -module_usb_driver(rtl8187_driver); diff --git a/drivers/net/wireless/rtl818x/rtl8187/leds.c b/drivers/net/wireless/rtl818x/rtl8187/leds.c deleted file mode 100644 index c2d5b495c179..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8187/leds.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Linux LED driver for RTL8187 - * - * Copyright 2009 Larry Finger - * - * Based on the LED handling in the r8187 driver, which is: - * Copyright (c) Realtek Semiconductor Corp. All rights reserved. - * - * Thanks to Realtek for their support! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifdef CONFIG_RTL8187_LEDS - -#include -#include -#include - -#include "rtl8187.h" -#include "leds.h" - -static void led_turn_on(struct work_struct *work) -{ - /* As this routine does read/write operations on the hardware, it must - * be run from a work queue. - */ - u8 reg; - struct rtl8187_priv *priv = container_of(work, struct rtl8187_priv, - led_on.work); - struct rtl8187_led *led = &priv->led_tx; - - /* Don't change the LED, when the device is down. */ - if (!priv->vif || priv->vif->type == NL80211_IFTYPE_UNSPECIFIED) - return ; - - /* Skip if the LED is not registered. */ - if (!led->dev) - return; - mutex_lock(&priv->conf_mutex); - switch (led->ledpin) { - case LED_PIN_GPIO0: - rtl818x_iowrite8(priv, &priv->map->GPIO0, 0x01); - rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0x00); - break; - case LED_PIN_LED0: - reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) & ~(1 << 4); - rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg); - break; - case LED_PIN_LED1: - reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) & ~(1 << 5); - rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg); - break; - case LED_PIN_HW: - default: - break; - } - mutex_unlock(&priv->conf_mutex); -} - -static void led_turn_off(struct work_struct *work) -{ - /* As this routine does read/write operations on the hardware, it must - * be run from a work queue. - */ - u8 reg; - struct rtl8187_priv *priv = container_of(work, struct rtl8187_priv, - led_off.work); - struct rtl8187_led *led = &priv->led_tx; - - /* Don't change the LED, when the device is down. */ - if (!priv->vif || priv->vif->type == NL80211_IFTYPE_UNSPECIFIED) - return ; - - /* Skip if the LED is not registered. */ - if (!led->dev) - return; - mutex_lock(&priv->conf_mutex); - switch (led->ledpin) { - case LED_PIN_GPIO0: - rtl818x_iowrite8(priv, &priv->map->GPIO0, 0x01); - rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0x01); - break; - case LED_PIN_LED0: - reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) | (1 << 4); - rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg); - break; - case LED_PIN_LED1: - reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) | (1 << 5); - rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg); - break; - case LED_PIN_HW: - default: - break; - } - mutex_unlock(&priv->conf_mutex); -} - -/* Callback from the LED subsystem. */ -static void rtl8187_led_brightness_set(struct led_classdev *led_dev, - enum led_brightness brightness) -{ - struct rtl8187_led *led = container_of(led_dev, struct rtl8187_led, - led_dev); - struct ieee80211_hw *hw = led->dev; - struct rtl8187_priv *priv; - static bool radio_on; - - if (!hw) - return; - priv = hw->priv; - if (led->is_radio) { - if (brightness == LED_FULL) { - ieee80211_queue_delayed_work(hw, &priv->led_on, 0); - radio_on = true; - } else if (radio_on) { - radio_on = false; - cancel_delayed_work(&priv->led_on); - ieee80211_queue_delayed_work(hw, &priv->led_off, 0); - } - } else if (radio_on) { - if (brightness == LED_OFF) { - ieee80211_queue_delayed_work(hw, &priv->led_off, 0); - /* The LED is off for 1/20 sec - it just blinks. */ - ieee80211_queue_delayed_work(hw, &priv->led_on, - HZ / 20); - } else - ieee80211_queue_delayed_work(hw, &priv->led_on, 0); - } -} - -static int rtl8187_register_led(struct ieee80211_hw *dev, - struct rtl8187_led *led, const char *name, - const char *default_trigger, u8 ledpin, - bool is_radio) -{ - int err; - struct rtl8187_priv *priv = dev->priv; - - if (led->dev) - return -EEXIST; - if (!default_trigger) - return -EINVAL; - led->dev = dev; - led->ledpin = ledpin; - led->is_radio = is_radio; - strncpy(led->name, name, sizeof(led->name)); - - led->led_dev.name = led->name; - led->led_dev.default_trigger = default_trigger; - led->led_dev.brightness_set = rtl8187_led_brightness_set; - - err = led_classdev_register(&priv->udev->dev, &led->led_dev); - if (err) { - printk(KERN_INFO "LEDs: Failed to register %s\n", name); - led->dev = NULL; - return err; - } - return 0; -} - -static void rtl8187_unregister_led(struct rtl8187_led *led) -{ - struct ieee80211_hw *hw = led->dev; - struct rtl8187_priv *priv = hw->priv; - - led_classdev_unregister(&led->led_dev); - flush_delayed_work(&priv->led_off); - led->dev = NULL; -} - -void rtl8187_leds_init(struct ieee80211_hw *dev, u16 custid) -{ - struct rtl8187_priv *priv = dev->priv; - char name[RTL8187_LED_MAX_NAME_LEN + 1]; - u8 ledpin; - int err; - - /* According to the vendor driver, the LED operation depends on the - * customer ID encoded in the EEPROM - */ - printk(KERN_INFO "rtl8187: Customer ID is 0x%02X\n", custid); - switch (custid) { - case EEPROM_CID_RSVD0: - case EEPROM_CID_RSVD1: - case EEPROM_CID_SERCOMM_PS: - case EEPROM_CID_QMI: - case EEPROM_CID_DELL: - case EEPROM_CID_TOSHIBA: - ledpin = LED_PIN_GPIO0; - break; - case EEPROM_CID_ALPHA0: - ledpin = LED_PIN_LED0; - break; - case EEPROM_CID_HW: - ledpin = LED_PIN_HW; - break; - default: - ledpin = LED_PIN_GPIO0; - } - - INIT_DELAYED_WORK(&priv->led_on, led_turn_on); - INIT_DELAYED_WORK(&priv->led_off, led_turn_off); - - snprintf(name, sizeof(name), - "rtl8187-%s::radio", wiphy_name(dev->wiphy)); - err = rtl8187_register_led(dev, &priv->led_radio, name, - ieee80211_get_radio_led_name(dev), ledpin, true); - if (err) - return; - - snprintf(name, sizeof(name), - "rtl8187-%s::tx", wiphy_name(dev->wiphy)); - err = rtl8187_register_led(dev, &priv->led_tx, name, - ieee80211_get_tx_led_name(dev), ledpin, false); - if (err) - goto err_tx; - - snprintf(name, sizeof(name), - "rtl8187-%s::rx", wiphy_name(dev->wiphy)); - err = rtl8187_register_led(dev, &priv->led_rx, name, - ieee80211_get_rx_led_name(dev), ledpin, false); - if (!err) - return; - - /* registration of RX LED failed - unregister */ - rtl8187_unregister_led(&priv->led_tx); -err_tx: - rtl8187_unregister_led(&priv->led_radio); -} - -void rtl8187_leds_exit(struct ieee80211_hw *dev) -{ - struct rtl8187_priv *priv = dev->priv; - - rtl8187_unregister_led(&priv->led_radio); - rtl8187_unregister_led(&priv->led_rx); - rtl8187_unregister_led(&priv->led_tx); - cancel_delayed_work_sync(&priv->led_off); - cancel_delayed_work_sync(&priv->led_on); -} -#endif /* def CONFIG_RTL8187_LEDS */ - diff --git a/drivers/net/wireless/rtl818x/rtl8187/leds.h b/drivers/net/wireless/rtl818x/rtl8187/leds.h deleted file mode 100644 index d743c96d4a20..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8187/leds.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Definitions for RTL8187 leds - * - * Copyright 2009 Larry Finger - * - * Based on the LED handling in the r8187 driver, which is: - * Copyright (c) Realtek Semiconductor Corp. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef RTL8187_LED_H -#define RTL8187_LED_H - -#ifdef CONFIG_RTL8187_LEDS - -#define RTL8187_LED_MAX_NAME_LEN 21 - -#include -#include - -enum { - LED_PIN_LED0, - LED_PIN_LED1, - LED_PIN_GPIO0, - LED_PIN_HW -}; - -enum { - EEPROM_CID_RSVD0 = 0x00, - EEPROM_CID_RSVD1 = 0xFF, - EEPROM_CID_ALPHA0 = 0x01, - EEPROM_CID_SERCOMM_PS = 0x02, - EEPROM_CID_HW = 0x03, - EEPROM_CID_TOSHIBA = 0x04, - EEPROM_CID_QMI = 0x07, - EEPROM_CID_DELL = 0x08 -}; - -struct rtl8187_led { - struct ieee80211_hw *dev; - /* The LED class device */ - struct led_classdev led_dev; - /* The pin/method used to control the led */ - u8 ledpin; - /* The unique name string for this LED device. */ - char name[RTL8187_LED_MAX_NAME_LEN + 1]; - /* If the LED is radio or tx/rx */ - bool is_radio; -}; - -void rtl8187_leds_init(struct ieee80211_hw *dev, u16 code); -void rtl8187_leds_exit(struct ieee80211_hw *dev); - -#endif /* def CONFIG_RTL8187_LEDS */ - -#endif /* RTL8187_LED_H */ diff --git a/drivers/net/wireless/rtl818x/rtl8187/rfkill.c b/drivers/net/wireless/rtl818x/rtl8187/rfkill.c deleted file mode 100644 index 34116719974a..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8187/rfkill.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Linux RFKILL support for RTL8187 - * - * Copyright (c) 2009 Herton Ronaldo Krzesinski - * - * Based on the RFKILL handling in the r8187 driver, which is: - * Copyright (c) Realtek Semiconductor Corp. All rights reserved. - * - * Thanks to Realtek for their support! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include - -#include "rtl8187.h" -#include "rfkill.h" - -static bool rtl8187_is_radio_enabled(struct rtl8187_priv *priv) -{ - u8 gpio; - - gpio = rtl818x_ioread8(priv, &priv->map->GPIO0); - rtl818x_iowrite8(priv, &priv->map->GPIO0, gpio & ~priv->rfkill_mask); - gpio = rtl818x_ioread8(priv, &priv->map->GPIO1); - - return gpio & priv->rfkill_mask; -} - -void rtl8187_rfkill_init(struct ieee80211_hw *hw) -{ - struct rtl8187_priv *priv = hw->priv; - - priv->rfkill_off = rtl8187_is_radio_enabled(priv); - printk(KERN_INFO "rtl8187: wireless switch is %s\n", - priv->rfkill_off ? "on" : "off"); - wiphy_rfkill_set_hw_state(hw->wiphy, !priv->rfkill_off); - wiphy_rfkill_start_polling(hw->wiphy); -} - -void rtl8187_rfkill_poll(struct ieee80211_hw *hw) -{ - bool enabled; - struct rtl8187_priv *priv = hw->priv; - - mutex_lock(&priv->conf_mutex); - enabled = rtl8187_is_radio_enabled(priv); - if (unlikely(enabled != priv->rfkill_off)) { - priv->rfkill_off = enabled; - printk(KERN_INFO "rtl8187: wireless radio switch turned %s\n", - enabled ? "on" : "off"); - wiphy_rfkill_set_hw_state(hw->wiphy, !enabled); - } - mutex_unlock(&priv->conf_mutex); -} - -void rtl8187_rfkill_exit(struct ieee80211_hw *hw) -{ - wiphy_rfkill_stop_polling(hw->wiphy); -} diff --git a/drivers/net/wireless/rtl818x/rtl8187/rfkill.h b/drivers/net/wireless/rtl818x/rtl8187/rfkill.h deleted file mode 100644 index e12575e96d11..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8187/rfkill.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef RTL8187_RFKILL_H -#define RTL8187_RFKILL_H - -void rtl8187_rfkill_init(struct ieee80211_hw *hw); -void rtl8187_rfkill_poll(struct ieee80211_hw *hw); -void rtl8187_rfkill_exit(struct ieee80211_hw *hw); - -#endif /* RTL8187_RFKILL_H */ diff --git a/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h b/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h deleted file mode 100644 index e19a20a8e955..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Definitions for RTL8187 hardware - * - * Copyright 2007 Michael Wu - * Copyright 2007 Andrea Merello - * - * Based on the r8187 driver, which is: - * Copyright 2005 Andrea Merello , et al. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef RTL8187_H -#define RTL8187_H - -#include "rtl818x.h" -#include "leds.h" - -#define RTL8187_EEPROM_TXPWR_BASE 0x05 -#define RTL8187_EEPROM_MAC_ADDR 0x07 -#define RTL8187_EEPROM_TXPWR_CHAN_1 0x16 /* 3 channels */ -#define RTL8187_EEPROM_TXPWR_CHAN_6 0x1B /* 2 channels */ -#define RTL8187_EEPROM_TXPWR_CHAN_4 0x3D /* 2 channels */ -#define RTL8187_EEPROM_SELECT_GPIO 0x3B - -#define RTL8187_REQT_READ 0xC0 -#define RTL8187_REQT_WRITE 0x40 -#define RTL8187_REQ_GET_REG 0x05 -#define RTL8187_REQ_SET_REG 0x05 - -#define RTL8187_MAX_RX 0x9C4 - -#define RFKILL_MASK_8187_89_97 0x2 -#define RFKILL_MASK_8198 0x4 - -#define RETRY_COUNT 7 - -struct rtl8187_rx_info { - struct urb *urb; - struct ieee80211_hw *dev; -}; - -struct rtl8187_rx_hdr { - __le32 flags; - u8 noise; - u8 signal; - u8 agc; - u8 reserved; - __le64 mac_time; -} __packed; - -struct rtl8187b_rx_hdr { - __le32 flags; - __le64 mac_time; - u8 sq; - u8 rssi; - u8 agc; - u8 flags2; - __le16 snr_long2end; - s8 pwdb_g12; - u8 fot; -} __packed; - -/* {rtl8187,rtl8187b}_tx_info is in skb */ - -struct rtl8187_tx_hdr { - __le32 flags; - __le16 rts_duration; - __le16 len; - __le32 retry; -} __packed; - -struct rtl8187b_tx_hdr { - __le32 flags; - __le16 rts_duration; - __le16 len; - __le32 unused_1; - __le16 unused_2; - __le16 tx_duration; - __le32 unused_3; - __le32 retry; - __le32 unused_4[2]; -} __packed; - -enum { - DEVICE_RTL8187, - DEVICE_RTL8187B -}; - -struct rtl8187_vif { - struct ieee80211_hw *dev; - - /* beaconing */ - struct delayed_work beacon_work; - bool enable_beacon; -}; - -struct rtl8187_priv { - /* common between rtl818x drivers */ - struct rtl818x_csr *map; - const struct rtl818x_rf_ops *rf; - struct ieee80211_vif *vif; - - /* The mutex protects the TX loopback state. - * Any attempt to set channels concurrently locks the device. - */ - struct mutex conf_mutex; - - /* rtl8187 specific */ - struct ieee80211_channel channels[14]; - struct ieee80211_rate rates[12]; - struct ieee80211_supported_band band; - struct usb_device *udev; - u32 rx_conf; - struct usb_anchor anchored; - struct delayed_work work; - struct ieee80211_hw *dev; -#ifdef CONFIG_RTL8187_LEDS - struct rtl8187_led led_radio; - struct rtl8187_led led_tx; - struct rtl8187_led led_rx; - struct delayed_work led_on; - struct delayed_work led_off; -#endif - u16 txpwr_base; - u8 asic_rev; - u8 is_rtl8187b; - enum { - RTL8187BvB, - RTL8187BvD, - RTL8187BvE - } hw_rev; - struct sk_buff_head rx_queue; - u8 signal; - u8 noise; - u8 slot_time; - u8 aifsn[4]; - u8 rfkill_mask; - struct { - __le64 buf; - struct sk_buff_head queue; - } b_tx_status; /* This queue is used by both -b and non-b devices */ - struct mutex io_mutex; - union { - u8 bits8; - __le16 bits16; - __le32 bits32; - } *io_dmabuf; - bool rfkill_off; - u16 seqno; -}; - -void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data); - -static inline u8 rtl818x_ioread8_idx(struct rtl8187_priv *priv, - u8 *addr, u8 idx) -{ - u8 val; - - mutex_lock(&priv->io_mutex); - usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), - RTL8187_REQ_GET_REG, RTL8187_REQT_READ, - (unsigned long)addr, idx & 0x03, - &priv->io_dmabuf->bits8, sizeof(val), HZ / 2); - - val = priv->io_dmabuf->bits8; - mutex_unlock(&priv->io_mutex); - - return val; -} - -static inline u8 rtl818x_ioread8(struct rtl8187_priv *priv, u8 *addr) -{ - return rtl818x_ioread8_idx(priv, addr, 0); -} - -static inline u16 rtl818x_ioread16_idx(struct rtl8187_priv *priv, - __le16 *addr, u8 idx) -{ - __le16 val; - - mutex_lock(&priv->io_mutex); - usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), - RTL8187_REQ_GET_REG, RTL8187_REQT_READ, - (unsigned long)addr, idx & 0x03, - &priv->io_dmabuf->bits16, sizeof(val), HZ / 2); - - val = priv->io_dmabuf->bits16; - mutex_unlock(&priv->io_mutex); - - return le16_to_cpu(val); -} - -static inline u16 rtl818x_ioread16(struct rtl8187_priv *priv, __le16 *addr) -{ - return rtl818x_ioread16_idx(priv, addr, 0); -} - -static inline u32 rtl818x_ioread32_idx(struct rtl8187_priv *priv, - __le32 *addr, u8 idx) -{ - __le32 val; - - mutex_lock(&priv->io_mutex); - usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), - RTL8187_REQ_GET_REG, RTL8187_REQT_READ, - (unsigned long)addr, idx & 0x03, - &priv->io_dmabuf->bits32, sizeof(val), HZ / 2); - - val = priv->io_dmabuf->bits32; - mutex_unlock(&priv->io_mutex); - - return le32_to_cpu(val); -} - -static inline u32 rtl818x_ioread32(struct rtl8187_priv *priv, __le32 *addr) -{ - return rtl818x_ioread32_idx(priv, addr, 0); -} - -static inline void rtl818x_iowrite8_idx(struct rtl8187_priv *priv, - u8 *addr, u8 val, u8 idx) -{ - mutex_lock(&priv->io_mutex); - - priv->io_dmabuf->bits8 = val; - usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), - RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, - (unsigned long)addr, idx & 0x03, - &priv->io_dmabuf->bits8, sizeof(val), HZ / 2); - - mutex_unlock(&priv->io_mutex); -} - -static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, u8 *addr, u8 val) -{ - rtl818x_iowrite8_idx(priv, addr, val, 0); -} - -static inline void rtl818x_iowrite16_idx(struct rtl8187_priv *priv, - __le16 *addr, u16 val, u8 idx) -{ - mutex_lock(&priv->io_mutex); - - priv->io_dmabuf->bits16 = cpu_to_le16(val); - usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), - RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, - (unsigned long)addr, idx & 0x03, - &priv->io_dmabuf->bits16, sizeof(val), HZ / 2); - - mutex_unlock(&priv->io_mutex); -} - -static inline void rtl818x_iowrite16(struct rtl8187_priv *priv, __le16 *addr, - u16 val) -{ - rtl818x_iowrite16_idx(priv, addr, val, 0); -} - -static inline void rtl818x_iowrite32_idx(struct rtl8187_priv *priv, - __le32 *addr, u32 val, u8 idx) -{ - mutex_lock(&priv->io_mutex); - - priv->io_dmabuf->bits32 = cpu_to_le32(val); - usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), - RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, - (unsigned long)addr, idx & 0x03, - &priv->io_dmabuf->bits32, sizeof(val), HZ / 2); - - mutex_unlock(&priv->io_mutex); -} - -static inline void rtl818x_iowrite32(struct rtl8187_priv *priv, __le32 *addr, - u32 val) -{ - rtl818x_iowrite32_idx(priv, addr, val, 0); -} - -#endif /* RTL8187_H */ diff --git a/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c b/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c deleted file mode 100644 index f0bf35fedbaf..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c +++ /dev/null @@ -1,962 +0,0 @@ -/* - * Radio tuning for RTL8225 on RTL8187 - * - * Copyright 2007 Michael Wu - * Copyright 2007 Andrea Merello - * - * Based on the r8187 driver, which is: - * Copyright 2005 Andrea Merello , et al. - * - * Magic delays, register offsets, and phy value tables below are - * taken from the original r8187 driver sources. Thanks to Realtek - * for their support! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include -#include -#include - -#include "rtl8187.h" -#include "rtl8225.h" - -static void rtl8225_write_bitbang(struct ieee80211_hw *dev, u8 addr, u16 data) -{ - struct rtl8187_priv *priv = dev->priv; - u16 reg80, reg84, reg82; - u32 bangdata; - int i; - - bangdata = (data << 4) | (addr & 0xf); - - reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput) & 0xfff3; - reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable); - - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x7); - - reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x7); - udelay(10); - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2)); - udelay(2); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80); - udelay(10); - - for (i = 15; i >= 0; i--) { - u16 reg = reg80 | (bangdata & (1 << i)) >> i; - - if (i & 1) - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg); - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg | (1 << 1)); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg | (1 << 1)); - - if (!(i & 1)) - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg); - } - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2)); - udelay(10); - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2)); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84); -} - -static void rtl8225_write_8051(struct ieee80211_hw *dev, u8 addr, __le16 data) -{ - struct rtl8187_priv *priv = dev->priv; - u16 reg80, reg82, reg84; - - reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput); - reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable); - reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect); - - reg80 &= ~(0x3 << 2); - reg84 &= ~0xF; - - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x0007); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x0007); - udelay(10); - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2)); - udelay(2); - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80); - udelay(10); - - mutex_lock(&priv->io_mutex); - - priv->io_dmabuf->bits16 = data; - usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), - RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, - addr, 0x8225, &priv->io_dmabuf->bits16, sizeof(data), - HZ / 2); - - mutex_unlock(&priv->io_mutex); - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2)); - udelay(10); - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2)); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84); -} - -static void rtl8225_write(struct ieee80211_hw *dev, u8 addr, u16 data) -{ - struct rtl8187_priv *priv = dev->priv; - - if (priv->asic_rev) - rtl8225_write_8051(dev, addr, cpu_to_le16(data)); - else - rtl8225_write_bitbang(dev, addr, data); -} - -static u16 rtl8225_read(struct ieee80211_hw *dev, u8 addr) -{ - struct rtl8187_priv *priv = dev->priv; - u16 reg80, reg82, reg84, out; - int i; - - reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput); - reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable); - reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect); - - reg80 &= ~0xF; - - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x000F); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x000F); - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2)); - udelay(4); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80); - udelay(5); - - for (i = 4; i >= 0; i--) { - u16 reg = reg80 | ((addr >> i) & 1); - - if (!(i & 1)) { - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg); - udelay(1); - } - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg | (1 << 1)); - udelay(2); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg | (1 << 1)); - udelay(2); - - if (i & 1) { - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg); - udelay(1); - } - } - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3) | (1 << 1)); - udelay(2); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3)); - udelay(2); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3)); - udelay(2); - - out = 0; - for (i = 11; i >= 0; i--) { - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3)); - udelay(1); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3) | (1 << 1)); - udelay(2); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3) | (1 << 1)); - udelay(2); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3) | (1 << 1)); - udelay(2); - - if (rtl818x_ioread16(priv, &priv->map->RFPinsInput) & (1 << 1)) - out |= 1 << i; - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3)); - udelay(2); - } - - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, - reg80 | (1 << 3) | (1 << 2)); - udelay(2); - - rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82); - rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84); - rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x03A0); - - return out; -} - -static const u16 rtl8225bcd_rxgain[] = { - 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409, - 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541, - 0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583, - 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644, - 0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688, - 0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745, - 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789, - 0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793, - 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d, - 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9, - 0x07aa, 0x07ab, 0x07ac, 0x07ad, 0x07b0, 0x07b1, 0x07b2, 0x07b3, - 0x07b4, 0x07b5, 0x07b8, 0x07b9, 0x07ba, 0x07bb, 0x07bb -}; - -static const u8 rtl8225_agc[] = { - 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, - 0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96, - 0x95, 0x94, 0x93, 0x92, 0x91, 0x90, 0x8f, 0x8e, - 0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86, - 0x85, 0x84, 0x83, 0x82, 0x81, 0x80, 0x3f, 0x3e, - 0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x37, 0x36, - 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2f, 0x2e, - 0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26, - 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e, - 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16, - 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, - 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, - 0x05, 0x04, 0x03, 0x02, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 -}; - -static const u8 rtl8225_gain[] = { - 0x23, 0x88, 0x7c, 0xa5, /* -82dBm */ - 0x23, 0x88, 0x7c, 0xb5, /* -82dBm */ - 0x23, 0x88, 0x7c, 0xc5, /* -82dBm */ - 0x33, 0x80, 0x79, 0xc5, /* -78dBm */ - 0x43, 0x78, 0x76, 0xc5, /* -74dBm */ - 0x53, 0x60, 0x73, 0xc5, /* -70dBm */ - 0x63, 0x58, 0x70, 0xc5, /* -66dBm */ -}; - -static const u8 rtl8225_threshold[] = { - 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd -}; - -static const u8 rtl8225_tx_gain_cck_ofdm[] = { - 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e -}; - -static const u8 rtl8225_tx_power_cck[] = { - 0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02, - 0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02, - 0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02, - 0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02, - 0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03, - 0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03 -}; - -static const u8 rtl8225_tx_power_cck_ch14[] = { - 0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00, - 0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00, - 0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00, - 0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00 -}; - -static const u8 rtl8225_tx_power_ofdm[] = { - 0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4 -}; - -static const u32 rtl8225_chan[] = { - 0x085c, 0x08dc, 0x095c, 0x09dc, 0x0a5c, 0x0adc, 0x0b5c, - 0x0bdc, 0x0c5c, 0x0cdc, 0x0d5c, 0x0ddc, 0x0e5c, 0x0f72 -}; - -static void rtl8225_rf_set_tx_power(struct ieee80211_hw *dev, int channel) -{ - struct rtl8187_priv *priv = dev->priv; - u8 cck_power, ofdm_power; - const u8 *tmp; - u32 reg; - int i; - - cck_power = priv->channels[channel - 1].hw_value & 0xF; - ofdm_power = priv->channels[channel - 1].hw_value >> 4; - - cck_power = min(cck_power, (u8)11); - if (ofdm_power > (u8)15) - ofdm_power = 25; - else - ofdm_power += 10; - - rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK, - rtl8225_tx_gain_cck_ofdm[cck_power / 6] >> 1); - - if (channel == 14) - tmp = &rtl8225_tx_power_cck_ch14[(cck_power % 6) * 8]; - else - tmp = &rtl8225_tx_power_cck[(cck_power % 6) * 8]; - - for (i = 0; i < 8; i++) - rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++); - - msleep(1); // FIXME: optional? - - /* anaparam2 on */ - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); - rtl818x_iowrite8(priv, &priv->map->CONFIG3, - reg | RTL818X_CONFIG3_ANAPARAM_WRITE); - rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, - RTL8187_RTL8225_ANAPARAM2_ON); - rtl818x_iowrite8(priv, &priv->map->CONFIG3, - reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); - - rtl8225_write_phy_ofdm(dev, 2, 0x42); - rtl8225_write_phy_ofdm(dev, 6, 0x00); - rtl8225_write_phy_ofdm(dev, 8, 0x00); - - rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM, - rtl8225_tx_gain_cck_ofdm[ofdm_power / 6] >> 1); - - tmp = &rtl8225_tx_power_ofdm[ofdm_power % 6]; - - rtl8225_write_phy_ofdm(dev, 5, *tmp); - rtl8225_write_phy_ofdm(dev, 7, *tmp); - - msleep(1); -} - -static void rtl8225_rf_init(struct ieee80211_hw *dev) -{ - struct rtl8187_priv *priv = dev->priv; - int i; - - rtl8225_write(dev, 0x0, 0x067); - rtl8225_write(dev, 0x1, 0xFE0); - rtl8225_write(dev, 0x2, 0x44D); - rtl8225_write(dev, 0x3, 0x441); - rtl8225_write(dev, 0x4, 0x486); - rtl8225_write(dev, 0x5, 0xBC0); - rtl8225_write(dev, 0x6, 0xAE6); - rtl8225_write(dev, 0x7, 0x82A); - rtl8225_write(dev, 0x8, 0x01F); - rtl8225_write(dev, 0x9, 0x334); - rtl8225_write(dev, 0xA, 0xFD4); - rtl8225_write(dev, 0xB, 0x391); - rtl8225_write(dev, 0xC, 0x050); - rtl8225_write(dev, 0xD, 0x6DB); - rtl8225_write(dev, 0xE, 0x029); - rtl8225_write(dev, 0xF, 0x914); msleep(100); - - rtl8225_write(dev, 0x2, 0xC4D); msleep(200); - rtl8225_write(dev, 0x2, 0x44D); msleep(200); - - if (!(rtl8225_read(dev, 6) & (1 << 7))) { - rtl8225_write(dev, 0x02, 0x0c4d); - msleep(200); - rtl8225_write(dev, 0x02, 0x044d); - msleep(100); - if (!(rtl8225_read(dev, 6) & (1 << 7))) - wiphy_warn(dev->wiphy, "RF Calibration Failed! %x\n", - rtl8225_read(dev, 6)); - } - - rtl8225_write(dev, 0x0, 0x127); - - for (i = 0; i < ARRAY_SIZE(rtl8225bcd_rxgain); i++) { - rtl8225_write(dev, 0x1, i + 1); - rtl8225_write(dev, 0x2, rtl8225bcd_rxgain[i]); - } - - rtl8225_write(dev, 0x0, 0x027); - rtl8225_write(dev, 0x0, 0x22F); - - for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) { - rtl8225_write_phy_ofdm(dev, 0xB, rtl8225_agc[i]); - rtl8225_write_phy_ofdm(dev, 0xA, 0x80 + i); - } - - msleep(1); - - rtl8225_write_phy_ofdm(dev, 0x00, 0x01); - rtl8225_write_phy_ofdm(dev, 0x01, 0x02); - rtl8225_write_phy_ofdm(dev, 0x02, 0x42); - rtl8225_write_phy_ofdm(dev, 0x03, 0x00); - rtl8225_write_phy_ofdm(dev, 0x04, 0x00); - rtl8225_write_phy_ofdm(dev, 0x05, 0x00); - rtl8225_write_phy_ofdm(dev, 0x06, 0x40); - rtl8225_write_phy_ofdm(dev, 0x07, 0x00); - rtl8225_write_phy_ofdm(dev, 0x08, 0x40); - rtl8225_write_phy_ofdm(dev, 0x09, 0xfe); - rtl8225_write_phy_ofdm(dev, 0x0a, 0x09); - rtl8225_write_phy_ofdm(dev, 0x0b, 0x80); - rtl8225_write_phy_ofdm(dev, 0x0c, 0x01); - rtl8225_write_phy_ofdm(dev, 0x0e, 0xd3); - rtl8225_write_phy_ofdm(dev, 0x0f, 0x38); - rtl8225_write_phy_ofdm(dev, 0x10, 0x84); - rtl8225_write_phy_ofdm(dev, 0x11, 0x06); - rtl8225_write_phy_ofdm(dev, 0x12, 0x20); - rtl8225_write_phy_ofdm(dev, 0x13, 0x20); - rtl8225_write_phy_ofdm(dev, 0x14, 0x00); - rtl8225_write_phy_ofdm(dev, 0x15, 0x40); - rtl8225_write_phy_ofdm(dev, 0x16, 0x00); - rtl8225_write_phy_ofdm(dev, 0x17, 0x40); - rtl8225_write_phy_ofdm(dev, 0x18, 0xef); - rtl8225_write_phy_ofdm(dev, 0x19, 0x19); - rtl8225_write_phy_ofdm(dev, 0x1a, 0x20); - rtl8225_write_phy_ofdm(dev, 0x1b, 0x76); - rtl8225_write_phy_ofdm(dev, 0x1c, 0x04); - rtl8225_write_phy_ofdm(dev, 0x1e, 0x95); - rtl8225_write_phy_ofdm(dev, 0x1f, 0x75); - rtl8225_write_phy_ofdm(dev, 0x20, 0x1f); - rtl8225_write_phy_ofdm(dev, 0x21, 0x27); - rtl8225_write_phy_ofdm(dev, 0x22, 0x16); - rtl8225_write_phy_ofdm(dev, 0x24, 0x46); - rtl8225_write_phy_ofdm(dev, 0x25, 0x20); - rtl8225_write_phy_ofdm(dev, 0x26, 0x90); - rtl8225_write_phy_ofdm(dev, 0x27, 0x88); - - rtl8225_write_phy_ofdm(dev, 0x0d, rtl8225_gain[2 * 4]); - rtl8225_write_phy_ofdm(dev, 0x1b, rtl8225_gain[2 * 4 + 2]); - rtl8225_write_phy_ofdm(dev, 0x1d, rtl8225_gain[2 * 4 + 3]); - rtl8225_write_phy_ofdm(dev, 0x23, rtl8225_gain[2 * 4 + 1]); - - rtl8225_write_phy_cck(dev, 0x00, 0x98); - rtl8225_write_phy_cck(dev, 0x03, 0x20); - rtl8225_write_phy_cck(dev, 0x04, 0x7e); - rtl8225_write_phy_cck(dev, 0x05, 0x12); - rtl8225_write_phy_cck(dev, 0x06, 0xfc); - rtl8225_write_phy_cck(dev, 0x07, 0x78); - rtl8225_write_phy_cck(dev, 0x08, 0x2e); - rtl8225_write_phy_cck(dev, 0x10, 0x9b); - rtl8225_write_phy_cck(dev, 0x11, 0x88); - rtl8225_write_phy_cck(dev, 0x12, 0x47); - rtl8225_write_phy_cck(dev, 0x13, 0xd0); - rtl8225_write_phy_cck(dev, 0x19, 0x00); - rtl8225_write_phy_cck(dev, 0x1a, 0xa0); - rtl8225_write_phy_cck(dev, 0x1b, 0x08); - rtl8225_write_phy_cck(dev, 0x40, 0x86); - rtl8225_write_phy_cck(dev, 0x41, 0x8d); - rtl8225_write_phy_cck(dev, 0x42, 0x15); - rtl8225_write_phy_cck(dev, 0x43, 0x18); - rtl8225_write_phy_cck(dev, 0x44, 0x1f); - rtl8225_write_phy_cck(dev, 0x45, 0x1e); - rtl8225_write_phy_cck(dev, 0x46, 0x1a); - rtl8225_write_phy_cck(dev, 0x47, 0x15); - rtl8225_write_phy_cck(dev, 0x48, 0x10); - rtl8225_write_phy_cck(dev, 0x49, 0x0a); - rtl8225_write_phy_cck(dev, 0x4a, 0x05); - rtl8225_write_phy_cck(dev, 0x4b, 0x02); - rtl8225_write_phy_cck(dev, 0x4c, 0x05); - - rtl818x_iowrite8(priv, &priv->map->TESTR, 0x0D); - - rtl8225_rf_set_tx_power(dev, 1); - - /* RX antenna default to A */ - rtl8225_write_phy_cck(dev, 0x10, 0x9b); /* B: 0xDB */ - rtl8225_write_phy_ofdm(dev, 0x26, 0x90); /* B: 0x10 */ - - rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03); /* B: 0x00 */ - msleep(1); - rtl818x_iowrite32(priv, (__le32 *)0xFF94, 0x3dc00002); - - /* set sensitivity */ - rtl8225_write(dev, 0x0c, 0x50); - rtl8225_write_phy_ofdm(dev, 0x0d, rtl8225_gain[2 * 4]); - rtl8225_write_phy_ofdm(dev, 0x1b, rtl8225_gain[2 * 4 + 2]); - rtl8225_write_phy_ofdm(dev, 0x1d, rtl8225_gain[2 * 4 + 3]); - rtl8225_write_phy_ofdm(dev, 0x23, rtl8225_gain[2 * 4 + 1]); - rtl8225_write_phy_cck(dev, 0x41, rtl8225_threshold[2]); -} - -static const u8 rtl8225z2_agc[] = { - 0x5e, 0x5e, 0x5e, 0x5e, 0x5d, 0x5b, 0x59, 0x57, 0x55, 0x53, 0x51, 0x4f, - 0x4d, 0x4b, 0x49, 0x47, 0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x39, 0x37, - 0x35, 0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27, 0x25, 0x23, 0x21, 0x1f, - 0x1d, 0x1b, 0x19, 0x17, 0x15, 0x13, 0x11, 0x0f, 0x0d, 0x0b, 0x09, 0x07, - 0x05, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, - 0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28, - 0x28, 0x29, 0x2a, 0x2a, 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d, - 0x2d, 0x2d, 0x2d, 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x30, 0x30, - 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, - 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31 -}; -static const u8 rtl8225z2_ofdm[] = { - 0x10, 0x0d, 0x01, 0x00, 0x14, 0xfb, 0xfb, 0x60, - 0x00, 0x60, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, - 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0xa8, 0x26, - 0x32, 0x33, 0x07, 0xa5, 0x6f, 0x55, 0xc8, 0xb3, - 0x0a, 0xe1, 0x2C, 0x8a, 0x86, 0x83, 0x34, 0x0f, - 0x4f, 0x24, 0x6f, 0xc2, 0x6b, 0x40, 0x80, 0x00, - 0xc0, 0xc1, 0x58, 0xf1, 0x00, 0xe4, 0x90, 0x3e, - 0x6d, 0x3c, 0xfb, 0x07 -}; - -static const u8 rtl8225z2_tx_power_cck_ch14[] = { - 0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00, - 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00, - 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00, - 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00 -}; - -static const u8 rtl8225z2_tx_power_cck[] = { - 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04, - 0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03, - 0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03, - 0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03 -}; - -static const u8 rtl8225z2_tx_power_ofdm[] = { - 0x42, 0x00, 0x40, 0x00, 0x40 -}; - -static const u8 rtl8225z2_tx_gain_cck_ofdm[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, - 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, - 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, - 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, - 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23 -}; - -static void rtl8225z2_rf_set_tx_power(struct ieee80211_hw *dev, int channel) -{ - struct rtl8187_priv *priv = dev->priv; - u8 cck_power, ofdm_power; - const u8 *tmp; - u32 reg; - int i; - - cck_power = priv->channels[channel - 1].hw_value & 0xF; - ofdm_power = priv->channels[channel - 1].hw_value >> 4; - - cck_power = min(cck_power, (u8)15); - cck_power += priv->txpwr_base & 0xF; - cck_power = min(cck_power, (u8)35); - - if (ofdm_power > (u8)15) - ofdm_power = 25; - else - ofdm_power += 10; - ofdm_power += priv->txpwr_base >> 4; - ofdm_power = min(ofdm_power, (u8)35); - - if (channel == 14) - tmp = rtl8225z2_tx_power_cck_ch14; - else - tmp = rtl8225z2_tx_power_cck; - - for (i = 0; i < 8; i++) - rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++); - - rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK, - rtl8225z2_tx_gain_cck_ofdm[cck_power]); - msleep(1); - - /* anaparam2 on */ - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); - reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); - rtl818x_iowrite8(priv, &priv->map->CONFIG3, - reg | RTL818X_CONFIG3_ANAPARAM_WRITE); - rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, - RTL8187_RTL8225_ANAPARAM2_ON); - rtl818x_iowrite8(priv, &priv->map->CONFIG3, - reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE); - rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); - - rtl8225_write_phy_ofdm(dev, 2, 0x42); - rtl8225_write_phy_ofdm(dev, 5, 0x00); - rtl8225_write_phy_ofdm(dev, 6, 0x40); - rtl8225_write_phy_ofdm(dev, 7, 0x00); - rtl8225_write_phy_ofdm(dev, 8, 0x40); - - rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM, - rtl8225z2_tx_gain_cck_ofdm[ofdm_power]); - msleep(1); -} - -static void rtl8225z2_b_rf_set_tx_power(struct ieee80211_hw *dev, int channel) -{ - struct rtl8187_priv *priv = dev->priv; - u8 cck_power, ofdm_power; - const u8 *tmp; - int i; - - cck_power = priv->channels[channel - 1].hw_value & 0xF; - ofdm_power = priv->channels[channel - 1].hw_value >> 4; - - if (cck_power > 15) - cck_power = (priv->hw_rev == RTL8187BvB) ? 15 : 22; - else - cck_power += (priv->hw_rev == RTL8187BvB) ? 0 : 7; - cck_power += priv->txpwr_base & 0xF; - cck_power = min(cck_power, (u8)35); - - if (ofdm_power > 15) - ofdm_power = (priv->hw_rev == RTL8187BvB) ? 17 : 25; - else - ofdm_power += (priv->hw_rev == RTL8187BvB) ? 2 : 10; - ofdm_power += (priv->txpwr_base >> 4) & 0xF; - ofdm_power = min(ofdm_power, (u8)35); - - if (channel == 14) - tmp = rtl8225z2_tx_power_cck_ch14; - else - tmp = rtl8225z2_tx_power_cck; - - if (priv->hw_rev == RTL8187BvB) { - if (cck_power <= 6) - ; /* do nothing */ - else if (cck_power <= 11) - tmp += 8; - else - tmp += 16; - } else { - if (cck_power <= 5) - ; /* do nothing */ - else if (cck_power <= 11) - tmp += 8; - else if (cck_power <= 17) - tmp += 16; - else - tmp += 24; - } - - for (i = 0; i < 8; i++) - rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++); - - rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK, - rtl8225z2_tx_gain_cck_ofdm[cck_power] << 1); - msleep(1); - - rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM, - rtl8225z2_tx_gain_cck_ofdm[ofdm_power] << 1); - if (priv->hw_rev == RTL8187BvB) { - if (ofdm_power <= 11) { - rtl8225_write_phy_ofdm(dev, 0x87, 0x60); - rtl8225_write_phy_ofdm(dev, 0x89, 0x60); - } else { - rtl8225_write_phy_ofdm(dev, 0x87, 0x5c); - rtl8225_write_phy_ofdm(dev, 0x89, 0x5c); - } - } else { - if (ofdm_power <= 11) { - rtl8225_write_phy_ofdm(dev, 0x87, 0x5c); - rtl8225_write_phy_ofdm(dev, 0x89, 0x5c); - } else if (ofdm_power <= 17) { - rtl8225_write_phy_ofdm(dev, 0x87, 0x54); - rtl8225_write_phy_ofdm(dev, 0x89, 0x54); - } else { - rtl8225_write_phy_ofdm(dev, 0x87, 0x50); - rtl8225_write_phy_ofdm(dev, 0x89, 0x50); - } - } - msleep(1); -} - -static const u16 rtl8225z2_rxgain[] = { - 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409, - 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541, - 0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583, - 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644, - 0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688, - 0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745, - 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789, - 0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793, - 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d, - 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9, - 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3, - 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb -}; - -static const u8 rtl8225z2_gain_bg[] = { - 0x23, 0x15, 0xa5, /* -82-1dBm */ - 0x23, 0x15, 0xb5, /* -82-2dBm */ - 0x23, 0x15, 0xc5, /* -82-3dBm */ - 0x33, 0x15, 0xc5, /* -78dBm */ - 0x43, 0x15, 0xc5, /* -74dBm */ - 0x53, 0x15, 0xc5, /* -70dBm */ - 0x63, 0x15, 0xc5 /* -66dBm */ -}; - -static void rtl8225z2_rf_init(struct ieee80211_hw *dev) -{ - struct rtl8187_priv *priv = dev->priv; - int i; - - rtl8225_write(dev, 0x0, 0x2BF); - rtl8225_write(dev, 0x1, 0xEE0); - rtl8225_write(dev, 0x2, 0x44D); - rtl8225_write(dev, 0x3, 0x441); - rtl8225_write(dev, 0x4, 0x8C3); - rtl8225_write(dev, 0x5, 0xC72); - rtl8225_write(dev, 0x6, 0x0E6); - rtl8225_write(dev, 0x7, 0x82A); - rtl8225_write(dev, 0x8, 0x03F); - rtl8225_write(dev, 0x9, 0x335); - rtl8225_write(dev, 0xa, 0x9D4); - rtl8225_write(dev, 0xb, 0x7BB); - rtl8225_write(dev, 0xc, 0x850); - rtl8225_write(dev, 0xd, 0xCDF); - rtl8225_write(dev, 0xe, 0x02B); - rtl8225_write(dev, 0xf, 0x114); - msleep(100); - - rtl8225_write(dev, 0x0, 0x1B7); - - for (i = 0; i < ARRAY_SIZE(rtl8225z2_rxgain); i++) { - rtl8225_write(dev, 0x1, i + 1); - rtl8225_write(dev, 0x2, rtl8225z2_rxgain[i]); - } - - rtl8225_write(dev, 0x3, 0x080); - rtl8225_write(dev, 0x5, 0x004); - rtl8225_write(dev, 0x0, 0x0B7); - rtl8225_write(dev, 0x2, 0xc4D); - - msleep(200); - rtl8225_write(dev, 0x2, 0x44D); - msleep(100); - - if (!(rtl8225_read(dev, 6) & (1 << 7))) { - rtl8225_write(dev, 0x02, 0x0C4D); - msleep(200); - rtl8225_write(dev, 0x02, 0x044D); - msleep(100); - if (!(rtl8225_read(dev, 6) & (1 << 7))) - wiphy_warn(dev->wiphy, "RF Calibration Failed! %x\n", - rtl8225_read(dev, 6)); - } - - msleep(200); - - rtl8225_write(dev, 0x0, 0x2BF); - - for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) { - rtl8225_write_phy_ofdm(dev, 0xB, rtl8225_agc[i]); - rtl8225_write_phy_ofdm(dev, 0xA, 0x80 + i); - } - - msleep(1); - - rtl8225_write_phy_ofdm(dev, 0x00, 0x01); - rtl8225_write_phy_ofdm(dev, 0x01, 0x02); - rtl8225_write_phy_ofdm(dev, 0x02, 0x42); - rtl8225_write_phy_ofdm(dev, 0x03, 0x00); - rtl8225_write_phy_ofdm(dev, 0x04, 0x00); - rtl8225_write_phy_ofdm(dev, 0x05, 0x00); - rtl8225_write_phy_ofdm(dev, 0x06, 0x40); - rtl8225_write_phy_ofdm(dev, 0x07, 0x00); - rtl8225_write_phy_ofdm(dev, 0x08, 0x40); - rtl8225_write_phy_ofdm(dev, 0x09, 0xfe); - rtl8225_write_phy_ofdm(dev, 0x0a, 0x08); - rtl8225_write_phy_ofdm(dev, 0x0b, 0x80); - rtl8225_write_phy_ofdm(dev, 0x0c, 0x01); - rtl8225_write_phy_ofdm(dev, 0x0d, 0x43); - rtl8225_write_phy_ofdm(dev, 0x0e, 0xd3); - rtl8225_write_phy_ofdm(dev, 0x0f, 0x38); - rtl8225_write_phy_ofdm(dev, 0x10, 0x84); - rtl8225_write_phy_ofdm(dev, 0x11, 0x07); - rtl8225_write_phy_ofdm(dev, 0x12, 0x20); - rtl8225_write_phy_ofdm(dev, 0x13, 0x20); - rtl8225_write_phy_ofdm(dev, 0x14, 0x00); - rtl8225_write_phy_ofdm(dev, 0x15, 0x40); - rtl8225_write_phy_ofdm(dev, 0x16, 0x00); - rtl8225_write_phy_ofdm(dev, 0x17, 0x40); - rtl8225_write_phy_ofdm(dev, 0x18, 0xef); - rtl8225_write_phy_ofdm(dev, 0x19, 0x19); - rtl8225_write_phy_ofdm(dev, 0x1a, 0x20); - rtl8225_write_phy_ofdm(dev, 0x1b, 0x15); - rtl8225_write_phy_ofdm(dev, 0x1c, 0x04); - rtl8225_write_phy_ofdm(dev, 0x1d, 0xc5); - rtl8225_write_phy_ofdm(dev, 0x1e, 0x95); - rtl8225_write_phy_ofdm(dev, 0x1f, 0x75); - rtl8225_write_phy_ofdm(dev, 0x20, 0x1f); - rtl8225_write_phy_ofdm(dev, 0x21, 0x17); - rtl8225_write_phy_ofdm(dev, 0x22, 0x16); - rtl8225_write_phy_ofdm(dev, 0x23, 0x80); - rtl8225_write_phy_ofdm(dev, 0x24, 0x46); - rtl8225_write_phy_ofdm(dev, 0x25, 0x00); - rtl8225_write_phy_ofdm(dev, 0x26, 0x90); - rtl8225_write_phy_ofdm(dev, 0x27, 0x88); - - rtl8225_write_phy_ofdm(dev, 0x0b, rtl8225z2_gain_bg[4 * 3]); - rtl8225_write_phy_ofdm(dev, 0x1b, rtl8225z2_gain_bg[4 * 3 + 1]); - rtl8225_write_phy_ofdm(dev, 0x1d, rtl8225z2_gain_bg[4 * 3 + 2]); - rtl8225_write_phy_ofdm(dev, 0x21, 0x37); - - rtl8225_write_phy_cck(dev, 0x00, 0x98); - rtl8225_write_phy_cck(dev, 0x03, 0x20); - rtl8225_write_phy_cck(dev, 0x04, 0x7e); - rtl8225_write_phy_cck(dev, 0x05, 0x12); - rtl8225_write_phy_cck(dev, 0x06, 0xfc); - rtl8225_write_phy_cck(dev, 0x07, 0x78); - rtl8225_write_phy_cck(dev, 0x08, 0x2e); - rtl8225_write_phy_cck(dev, 0x10, 0x9b); - rtl8225_write_phy_cck(dev, 0x11, 0x88); - rtl8225_write_phy_cck(dev, 0x12, 0x47); - rtl8225_write_phy_cck(dev, 0x13, 0xd0); - rtl8225_write_phy_cck(dev, 0x19, 0x00); - rtl8225_write_phy_cck(dev, 0x1a, 0xa0); - rtl8225_write_phy_cck(dev, 0x1b, 0x08); - rtl8225_write_phy_cck(dev, 0x40, 0x86); - rtl8225_write_phy_cck(dev, 0x41, 0x8d); - rtl8225_write_phy_cck(dev, 0x42, 0x15); - rtl8225_write_phy_cck(dev, 0x43, 0x18); - rtl8225_write_phy_cck(dev, 0x44, 0x36); - rtl8225_write_phy_cck(dev, 0x45, 0x35); - rtl8225_write_phy_cck(dev, 0x46, 0x2e); - rtl8225_write_phy_cck(dev, 0x47, 0x25); - rtl8225_write_phy_cck(dev, 0x48, 0x1c); - rtl8225_write_phy_cck(dev, 0x49, 0x12); - rtl8225_write_phy_cck(dev, 0x4a, 0x09); - rtl8225_write_phy_cck(dev, 0x4b, 0x04); - rtl8225_write_phy_cck(dev, 0x4c, 0x05); - - rtl818x_iowrite8(priv, (u8 *)0xFF5B, 0x0D); msleep(1); - - rtl8225z2_rf_set_tx_power(dev, 1); - - /* RX antenna default to A */ - rtl8225_write_phy_cck(dev, 0x10, 0x9b); /* B: 0xDB */ - rtl8225_write_phy_ofdm(dev, 0x26, 0x90); /* B: 0x10 */ - - rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03); /* B: 0x00 */ - msleep(1); - rtl818x_iowrite32(priv, (__le32 *)0xFF94, 0x3dc00002); -} - -static void rtl8225z2_b_rf_init(struct ieee80211_hw *dev) -{ - struct rtl8187_priv *priv = dev->priv; - int i; - - rtl8225_write(dev, 0x0, 0x0B7); - rtl8225_write(dev, 0x1, 0xEE0); - rtl8225_write(dev, 0x2, 0x44D); - rtl8225_write(dev, 0x3, 0x441); - rtl8225_write(dev, 0x4, 0x8C3); - rtl8225_write(dev, 0x5, 0xC72); - rtl8225_write(dev, 0x6, 0x0E6); - rtl8225_write(dev, 0x7, 0x82A); - rtl8225_write(dev, 0x8, 0x03F); - rtl8225_write(dev, 0x9, 0x335); - rtl8225_write(dev, 0xa, 0x9D4); - rtl8225_write(dev, 0xb, 0x7BB); - rtl8225_write(dev, 0xc, 0x850); - rtl8225_write(dev, 0xd, 0xCDF); - rtl8225_write(dev, 0xe, 0x02B); - rtl8225_write(dev, 0xf, 0x114); - - rtl8225_write(dev, 0x0, 0x1B7); - - for (i = 0; i < ARRAY_SIZE(rtl8225z2_rxgain); i++) { - rtl8225_write(dev, 0x1, i + 1); - rtl8225_write(dev, 0x2, rtl8225z2_rxgain[i]); - } - - rtl8225_write(dev, 0x3, 0x080); - rtl8225_write(dev, 0x5, 0x004); - rtl8225_write(dev, 0x0, 0x0B7); - - rtl8225_write(dev, 0x2, 0xC4D); - - rtl8225_write(dev, 0x2, 0x44D); - rtl8225_write(dev, 0x0, 0x2BF); - - rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK, 0x03); - rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM, 0x07); - rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03); - - rtl8225_write_phy_ofdm(dev, 0x80, 0x12); - for (i = 0; i < ARRAY_SIZE(rtl8225z2_agc); i++) { - rtl8225_write_phy_ofdm(dev, 0xF, rtl8225z2_agc[i]); - rtl8225_write_phy_ofdm(dev, 0xE, 0x80 + i); - rtl8225_write_phy_ofdm(dev, 0xE, 0); - } - rtl8225_write_phy_ofdm(dev, 0x80, 0x10); - - for (i = 0; i < ARRAY_SIZE(rtl8225z2_ofdm); i++) - rtl8225_write_phy_ofdm(dev, i, rtl8225z2_ofdm[i]); - - rtl8225_write_phy_ofdm(dev, 0x97, 0x46); - rtl8225_write_phy_ofdm(dev, 0xa4, 0xb6); - rtl8225_write_phy_ofdm(dev, 0x85, 0xfc); - rtl8225_write_phy_cck(dev, 0xc1, 0x88); -} - -static void rtl8225_rf_stop(struct ieee80211_hw *dev) -{ - rtl8225_write(dev, 0x4, 0x1f); -} - -static void rtl8225_rf_set_channel(struct ieee80211_hw *dev, - struct ieee80211_conf *conf) -{ - struct rtl8187_priv *priv = dev->priv; - int chan = - ieee80211_frequency_to_channel(conf->chandef.chan->center_freq); - - if (priv->rf->init == rtl8225_rf_init) - rtl8225_rf_set_tx_power(dev, chan); - else if (priv->rf->init == rtl8225z2_rf_init) - rtl8225z2_rf_set_tx_power(dev, chan); - else - rtl8225z2_b_rf_set_tx_power(dev, chan); - - rtl8225_write(dev, 0x7, rtl8225_chan[chan - 1]); - msleep(10); -} - -static const struct rtl818x_rf_ops rtl8225_ops = { - .name = "rtl8225", - .init = rtl8225_rf_init, - .stop = rtl8225_rf_stop, - .set_chan = rtl8225_rf_set_channel -}; - -static const struct rtl818x_rf_ops rtl8225z2_ops = { - .name = "rtl8225z2", - .init = rtl8225z2_rf_init, - .stop = rtl8225_rf_stop, - .set_chan = rtl8225_rf_set_channel -}; - -static const struct rtl818x_rf_ops rtl8225z2_b_ops = { - .name = "rtl8225z2", - .init = rtl8225z2_b_rf_init, - .stop = rtl8225_rf_stop, - .set_chan = rtl8225_rf_set_channel -}; - -const struct rtl818x_rf_ops * rtl8187_detect_rf(struct ieee80211_hw *dev) -{ - u16 reg8, reg9; - struct rtl8187_priv *priv = dev->priv; - - if (!priv->is_rtl8187b) { - rtl8225_write(dev, 0, 0x1B7); - - reg8 = rtl8225_read(dev, 8); - reg9 = rtl8225_read(dev, 9); - - rtl8225_write(dev, 0, 0x0B7); - - if (reg8 != 0x588 || reg9 != 0x700) - return &rtl8225_ops; - - return &rtl8225z2_ops; - } else - return &rtl8225z2_b_ops; -} diff --git a/drivers/net/wireless/rtl818x/rtl8187/rtl8225.h b/drivers/net/wireless/rtl818x/rtl8187/rtl8225.h deleted file mode 100644 index 20c5b6ead0f6..000000000000 --- a/drivers/net/wireless/rtl818x/rtl8187/rtl8225.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Radio tuning definitions for RTL8225 on RTL8187 - * - * Copyright 2007 Michael Wu - * Copyright 2007 Andrea Merello - * - * Based on the r8187 driver, which is: - * Copyright 2005 Andrea Merello , et al. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef RTL8187_RTL8225_H -#define RTL8187_RTL8225_H - -#define RTL8187_RTL8225_ANAPARAM_ON 0xa0000a59 -#define RTL8187_RTL8225_ANAPARAM2_ON 0x860c7312 -#define RTL8187_RTL8225_ANAPARAM_OFF 0xa00beb59 -#define RTL8187_RTL8225_ANAPARAM2_OFF 0x840dec11 - -#define RTL8187B_RTL8225_ANAPARAM_ON 0x45090658 -#define RTL8187B_RTL8225_ANAPARAM2_ON 0x727f3f52 -#define RTL8187B_RTL8225_ANAPARAM3_ON 0x00 -#define RTL8187B_RTL8225_ANAPARAM_OFF 0x55480658 -#define RTL8187B_RTL8225_ANAPARAM2_OFF 0x72003f50 -#define RTL8187B_RTL8225_ANAPARAM3_OFF 0x00 - -const struct rtl818x_rf_ops * rtl8187_detect_rf(struct ieee80211_hw *); - -static inline void rtl8225_write_phy_ofdm(struct ieee80211_hw *dev, - u8 addr, u32 data) -{ - rtl8187_write_phy(dev, addr, data); -} - -static inline void rtl8225_write_phy_cck(struct ieee80211_hw *dev, - u8 addr, u32 data) -{ - rtl8187_write_phy(dev, addr, data | 0x10000); -} - -#endif /* RTL8187_RTL8225_H */ diff --git a/drivers/net/wireless/rtl818x/rtl818x.h b/drivers/net/wireless/rtl818x/rtl818x.h deleted file mode 100644 index 1615f63b02f6..000000000000 --- a/drivers/net/wireless/rtl818x/rtl818x.h +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Definitions for RTL818x hardware - * - * Copyright 2007 Michael Wu - * Copyright 2007 Andrea Merello - * - * Based on the r8187 driver, which is: - * Copyright 2005 Andrea Merello , et al. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef RTL818X_H -#define RTL818X_H - -struct rtl818x_csr { - u8 MAC[6]; - u8 reserved_0[2]; - __le32 MAR[2]; - u8 RX_FIFO_COUNT; - u8 reserved_1; - u8 TX_FIFO_COUNT; - u8 BQREQ; - u8 reserved_2[4]; - __le32 TSFT[2]; - __le32 TLPDA; - __le32 TNPDA; - __le32 THPDA; - __le16 BRSR; - u8 BSSID[6]; - u8 RESP_RATE; - u8 EIFS; - u8 reserved_3[1]; - u8 CMD; -#define RTL818X_CMD_TX_ENABLE (1 << 2) -#define RTL818X_CMD_RX_ENABLE (1 << 3) -#define RTL818X_CMD_RESET (1 << 4) - u8 reserved_4[4]; - __le16 INT_MASK; - __le16 INT_STATUS; -#define RTL818X_INT_RX_OK (1 << 0) -#define RTL818X_INT_RX_ERR (1 << 1) -#define RTL818X_INT_TXL_OK (1 << 2) -#define RTL818X_INT_TXL_ERR (1 << 3) -#define RTL818X_INT_RX_DU (1 << 4) -#define RTL818X_INT_RX_FO (1 << 5) -#define RTL818X_INT_TXN_OK (1 << 6) -#define RTL818X_INT_TXN_ERR (1 << 7) -#define RTL818X_INT_TXH_OK (1 << 8) -#define RTL818X_INT_TXH_ERR (1 << 9) -#define RTL818X_INT_TXB_OK (1 << 10) -#define RTL818X_INT_TXB_ERR (1 << 11) -#define RTL818X_INT_ATIM (1 << 12) -#define RTL818X_INT_BEACON (1 << 13) -#define RTL818X_INT_TIME_OUT (1 << 14) -#define RTL818X_INT_TX_FO (1 << 15) - __le32 TX_CONF; -#define RTL818X_TX_CONF_LOOPBACK_MAC (1 << 17) -#define RTL818X_TX_CONF_LOOPBACK_CONT (3 << 17) -#define RTL818X_TX_CONF_NO_ICV (1 << 19) -#define RTL818X_TX_CONF_DISCW (1 << 20) -#define RTL818X_TX_CONF_SAT_HWPLCP (1 << 24) -#define RTL818X_TX_CONF_R8180_ABCD (2 << 25) -#define RTL818X_TX_CONF_R8180_F (3 << 25) -#define RTL818X_TX_CONF_R8185_ABC (4 << 25) -#define RTL818X_TX_CONF_R8185_D (5 << 25) -#define RTL818X_TX_CONF_R8187vD (5 << 25) -#define RTL818X_TX_CONF_R8187vD_B (6 << 25) -#define RTL818X_TX_CONF_HWVER_MASK (7 << 25) -#define RTL818X_TX_CONF_DISREQQSIZE (1 << 28) -#define RTL818X_TX_CONF_PROBE_DTS (1 << 29) -#define RTL818X_TX_CONF_HW_SEQNUM (1 << 30) -#define RTL818X_TX_CONF_CW_MIN (1 << 31) - __le32 RX_CONF; -#define RTL818X_RX_CONF_MONITOR (1 << 0) -#define RTL818X_RX_CONF_NICMAC (1 << 1) -#define RTL818X_RX_CONF_MULTICAST (1 << 2) -#define RTL818X_RX_CONF_BROADCAST (1 << 3) -#define RTL818X_RX_CONF_FCS (1 << 5) -#define RTL818X_RX_CONF_DATA (1 << 18) -#define RTL818X_RX_CONF_CTRL (1 << 19) -#define RTL818X_RX_CONF_MGMT (1 << 20) -#define RTL818X_RX_CONF_ADDR3 (1 << 21) -#define RTL818X_RX_CONF_PM (1 << 22) -#define RTL818X_RX_CONF_BSSID (1 << 23) -#define RTL818X_RX_CONF_RX_AUTORESETPHY (1 << 28) -#define RTL818X_RX_CONF_CSDM1 (1 << 29) -#define RTL818X_RX_CONF_CSDM2 (1 << 30) -#define RTL818X_RX_CONF_ONLYERLPKT (1 << 31) - __le32 INT_TIMEOUT; - __le32 TBDA; - u8 EEPROM_CMD; -#define RTL818X_EEPROM_CMD_READ (1 << 0) -#define RTL818X_EEPROM_CMD_WRITE (1 << 1) -#define RTL818X_EEPROM_CMD_CK (1 << 2) -#define RTL818X_EEPROM_CMD_CS (1 << 3) -#define RTL818X_EEPROM_CMD_NORMAL (0 << 6) -#define RTL818X_EEPROM_CMD_LOAD (1 << 6) -#define RTL818X_EEPROM_CMD_PROGRAM (2 << 6) -#define RTL818X_EEPROM_CMD_CONFIG (3 << 6) - u8 CONFIG0; - u8 CONFIG1; - u8 CONFIG2; -#define RTL818X_CONFIG2_ANTENNA_DIV (1 << 6) - __le32 ANAPARAM; - u8 MSR; -#define RTL818X_MSR_NO_LINK (0 << 2) -#define RTL818X_MSR_ADHOC (1 << 2) -#define RTL818X_MSR_INFRA (2 << 2) -#define RTL818X_MSR_MASTER (3 << 2) -#define RTL818X_MSR_ENEDCA (4 << 2) - u8 CONFIG3; -#define RTL818X_CONFIG3_ANAPARAM_WRITE (1 << 6) -#define RTL818X_CONFIG3_GNT_SELECT (1 << 7) - u8 CONFIG4; -#define RTL818X_CONFIG4_POWEROFF (1 << 6) -#define RTL818X_CONFIG4_VCOOFF (1 << 7) - u8 TESTR; - u8 reserved_9[2]; - u8 PGSELECT; - u8 SECURITY; - __le32 ANAPARAM2; - u8 reserved_10[12]; - __le16 BEACON_INTERVAL; - __le16 ATIM_WND; - __le16 BEACON_INTERVAL_TIME; - __le16 ATIMTR_INTERVAL; - u8 PHY_DELAY; - u8 CARRIER_SENSE_COUNTER; - u8 reserved_11[2]; - u8 PHY[4]; - __le16 RFPinsOutput; - __le16 RFPinsEnable; - __le16 RFPinsSelect; - __le16 RFPinsInput; - __le32 RF_PARA; - __le32 RF_TIMING; - u8 GP_ENABLE; - u8 GPIO0; - u8 GPIO1; - u8 reserved_12; - __le32 HSSI_PARA; - u8 reserved_13[4]; - u8 TX_AGC_CTL; -#define RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT (1 << 0) -#define RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT (1 << 1) -#define RTL818X_TX_AGC_CTL_FEEDBACK_ANT (1 << 2) - u8 TX_GAIN_CCK; - u8 TX_GAIN_OFDM; - u8 TX_ANTENNA; - u8 reserved_14[16]; - u8 WPA_CONF; - u8 reserved_15[3]; - u8 SIFS; - u8 DIFS; - u8 SLOT; - u8 reserved_16[5]; - u8 CW_CONF; -#define RTL818X_CW_CONF_PERPACKET_CW_SHIFT (1 << 0) -#define RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT (1 << 1) - u8 CW_VAL; - u8 RATE_FALLBACK; -#define RTL818X_RATE_FALLBACK_ENABLE (1 << 7) - u8 ACM_CONTROL; - u8 reserved_17[24]; - u8 CONFIG5; - u8 TX_DMA_POLLING; - u8 reserved_18[2]; - __le16 CWR; - u8 RETRY_CTR; - u8 reserved_19[3]; - __le16 INT_MIG; -/* RTL818X_R8187B_*: magic numbers from ioregisters */ -#define RTL818X_R8187B_B 0 -#define RTL818X_R8187B_D 1 -#define RTL818X_R8187B_E 2 - __le32 RDSAR; - __le16 TID_AC_MAP; - u8 reserved_20[4]; - u8 ANAPARAM3; - u8 reserved_21[5]; - __le16 FEMR; - u8 reserved_22[4]; - __le16 TALLY_CNT; - u8 TALLY_SEL; -} __packed; - -struct rtl818x_rf_ops { - char *name; - void (*init)(struct ieee80211_hw *); - void (*stop)(struct ieee80211_hw *); - void (*set_chan)(struct ieee80211_hw *, struct ieee80211_conf *); - void (*conf_erp)(struct ieee80211_hw *, struct ieee80211_bss_conf *); - u8 (*calc_rssi)(u8 agc, u8 sq); -}; - -/** - * enum rtl818x_tx_desc_flags - Tx/Rx flags are common between RTL818X chips - * - * @RTL818X_TX_DESC_FLAG_NO_ENC: Disable hardware based encryption. - * @RTL818X_TX_DESC_FLAG_TX_OK: TX frame was ACKed. - * @RTL818X_TX_DESC_FLAG_SPLCP: Use short preamble. - * @RTL818X_TX_DESC_FLAG_MOREFRAG: More fragments follow. - * @RTL818X_TX_DESC_FLAG_CTS: Use CTS-to-self protection. - * @RTL818X_TX_DESC_FLAG_RTS: Use RTS/CTS protection. - * @RTL818X_TX_DESC_FLAG_LS: Last segment of the frame. - * @RTL818X_TX_DESC_FLAG_FS: First segment of the frame. - */ -enum rtl818x_tx_desc_flags { - RTL818X_TX_DESC_FLAG_NO_ENC = (1 << 15), - RTL818X_TX_DESC_FLAG_TX_OK = (1 << 15), - RTL818X_TX_DESC_FLAG_SPLCP = (1 << 16), - RTL818X_TX_DESC_FLAG_RX_UNDER = (1 << 16), - RTL818X_TX_DESC_FLAG_MOREFRAG = (1 << 17), - RTL818X_TX_DESC_FLAG_CTS = (1 << 18), - RTL818X_TX_DESC_FLAG_RTS = (1 << 23), - RTL818X_TX_DESC_FLAG_LS = (1 << 28), - RTL818X_TX_DESC_FLAG_FS = (1 << 29), - RTL818X_TX_DESC_FLAG_DMA = (1 << 30), - RTL818X_TX_DESC_FLAG_OWN = (1 << 31) -}; - -enum rtl818x_rx_desc_flags { - RTL818X_RX_DESC_FLAG_ICV_ERR = (1 << 12), - RTL818X_RX_DESC_FLAG_CRC32_ERR = (1 << 13), - RTL818X_RX_DESC_FLAG_PM = (1 << 14), - RTL818X_RX_DESC_FLAG_RX_ERR = (1 << 15), - RTL818X_RX_DESC_FLAG_BCAST = (1 << 16), - RTL818X_RX_DESC_FLAG_PAM = (1 << 17), - RTL818X_RX_DESC_FLAG_MCAST = (1 << 18), - RTL818X_RX_DESC_FLAG_QOS = (1 << 19), /* RTL8187(B) only */ - RTL818X_RX_DESC_FLAG_TRSW = (1 << 24), /* RTL8187(B) only */ - RTL818X_RX_DESC_FLAG_SPLCP = (1 << 25), - RTL818X_RX_DESC_FLAG_FOF = (1 << 26), - RTL818X_RX_DESC_FLAG_DMA_FAIL = (1 << 27), - RTL818X_RX_DESC_FLAG_LS = (1 << 28), - RTL818X_RX_DESC_FLAG_FS = (1 << 29), - RTL818X_RX_DESC_FLAG_EOR = (1 << 30), - RTL818X_RX_DESC_FLAG_OWN = (1 << 31) -}; - -#endif /* RTL818X_H */ diff --git a/drivers/net/wireless/rtl8723as/Kconfig b/drivers/net/wireless/rtl8723as/Kconfig deleted file mode 100755 index 43f9697fa814..000000000000 --- a/drivers/net/wireless/rtl8723as/Kconfig +++ /dev/null @@ -1,8 +0,0 @@ - config RTL8723AS - tristate "Realtek 8723AS SDIO WiFi Support" - depends on WLAN_80211 && MMC - select WIRELESS_EXT - select WEXT_PRIV - select IEEE80211 - ---help--- - Help message of RTL8723AS diff --git a/drivers/net/wireless/rtlwifi/Kconfig b/drivers/net/wireless/rtlwifi/Kconfig deleted file mode 100644 index 7253de3d8c66..000000000000 --- a/drivers/net/wireless/rtlwifi/Kconfig +++ /dev/null @@ -1,80 +0,0 @@ -config RTLWIFI - tristate "Realtek wireless card support" - depends on MAC80211 - select FW_LOADER - ---help--- - This is common code for RTL8192CE/RTL8192CU/RTL8192SE/RTL8723AE - drivers. This module does nothing by itself - the various front-end - drivers need to be enabled to support any desired devices. - - If you choose to build as a module, it'll be called rtlwifi. - -config RTLWIFI_DEBUG - bool "Debugging output for rtlwifi driver family" - depends on RTLWIFI - default y - ---help--- - To use the module option that sets the dynamic-debugging level for, - the front-end driver, this parameter must be "Y". For memory-limited - systems, choose "N". If in doubt, choose "Y". - -config RTL8192CE - tristate "Realtek RTL8192CE/RTL8188CE Wireless Network Adapter" - depends on RTLWIFI && PCI - select RTL8192C_COMMON - ---help--- - This is the driver for Realtek RTL8192CE/RTL8188CE 802.11n PCIe - wireless network adapters. - - If you choose to build it as a module, it will be called rtl8192ce - -config RTL8192SE - tristate "Realtek RTL8192SE/RTL8191SE PCIe Wireless Network Adapter" - depends on RTLWIFI && PCI - ---help--- - This is the driver for Realtek RTL8192SE/RTL8191SE 802.11n PCIe - wireless network adapters. - - If you choose to build it as a module, it will be called rtl8192se - -config RTL8192DE - tristate "Realtek RTL8192DE/RTL8188DE PCIe Wireless Network Adapter" - depends on RTLWIFI && PCI - ---help--- - This is the driver for Realtek RTL8192DE/RTL8188DE 802.11n PCIe - wireless network adapters. - - If you choose to build it as a module, it will be called rtl8192de - -config RTL8723AE - tristate "Realtek RTL8723AE PCIe Wireless Network Adapter" - depends on RTLWIFI && PCI - ---help--- - This is the driver for Realtek RTL8723AE 802.11n PCIe - wireless network adapters. - - If you choose to build it as a module, it will be called rtl8723ae - -config RTL8188EE - tristate "Realtek RTL8188EE Wireless Network Adapter" - depends on RTLWIFI && PCI - ---help--- - This is the driver for Realtek RTL8188EE 802.11n PCIe - wireless network adapters. - - If you choose to build it as a module, it will be called rtl8188ee - -config RTL8192CU - tristate "Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter" - depends on RTLWIFI && USB - select RTL8192C_COMMON - ---help--- - This is the driver for Realtek RTL8192CU/RTL8188CU 802.11n USB - wireless network adapters. - - If you choose to build it as a module, it will be called rtl8192cu - -config RTL8192C_COMMON - tristate - depends on RTL8192CE || RTL8192CU - default m diff --git a/drivers/net/wireless/rtlwifi/Makefile b/drivers/net/wireless/rtlwifi/Makefile deleted file mode 100644 index ff02b874f8d8..000000000000 --- a/drivers/net/wireless/rtlwifi/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -obj-$(CONFIG_RTLWIFI) += rtlwifi.o -rtlwifi-objs := \ - base.o \ - cam.o \ - core.o \ - debug.o \ - efuse.o \ - ps.o \ - rc.o \ - regd.o \ - stats.o - -rtl8192c_common-objs += \ - -ifneq ($(CONFIG_PCI),) -rtlwifi-objs += pci.o -endif - -ifneq ($(CONFIG_USB),) -rtlwifi-objs += usb.o -endif - -obj-$(CONFIG_RTL8192C_COMMON) += rtl8192c/ -obj-$(CONFIG_RTL8192CE) += rtl8192ce/ -obj-$(CONFIG_RTL8192CU) += rtl8192cu/ -obj-$(CONFIG_RTL8192SE) += rtl8192se/ -obj-$(CONFIG_RTL8192DE) += rtl8192de/ -obj-$(CONFIG_RTL8723AE) += rtl8723ae/ -obj-$(CONFIG_RTL8188EE) += rtl8188ee/ - -ccflags-y += -D__CHECK_ENDIAN__ diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c deleted file mode 100644 index 3698028c910d..000000000000 --- a/drivers/net/wireless/rtlwifi/base.c +++ /dev/null @@ -1,1869 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "wifi.h" -#include "rc.h" -#include "base.h" -#include "efuse.h" -#include "cam.h" -#include "ps.h" -#include "regd.h" - -#include -#include -#include - -/* - *NOTICE!!!: This file will be very big, we should - *keep it clear under following roles: - * - *This file include following parts, so, if you add new - *functions into this file, please check which part it - *should includes. or check if you should add new part - *for this file: - * - *1) mac80211 init functions - *2) tx information functions - *3) functions called by core.c - *4) wq & timer callback functions - *5) frame process functions - *6) IOT functions - *7) sysfs functions - *8) vif functions - *9) ... - */ - -/********************************************************* - * - * mac80211 init functions - * - *********************************************************/ -static struct ieee80211_channel rtl_channeltable_2g[] = { - {.center_freq = 2412, .hw_value = 1,}, - {.center_freq = 2417, .hw_value = 2,}, - {.center_freq = 2422, .hw_value = 3,}, - {.center_freq = 2427, .hw_value = 4,}, - {.center_freq = 2432, .hw_value = 5,}, - {.center_freq = 2437, .hw_value = 6,}, - {.center_freq = 2442, .hw_value = 7,}, - {.center_freq = 2447, .hw_value = 8,}, - {.center_freq = 2452, .hw_value = 9,}, - {.center_freq = 2457, .hw_value = 10,}, - {.center_freq = 2462, .hw_value = 11,}, - {.center_freq = 2467, .hw_value = 12,}, - {.center_freq = 2472, .hw_value = 13,}, - {.center_freq = 2484, .hw_value = 14,}, -}; - -static struct ieee80211_channel rtl_channeltable_5g[] = { - {.center_freq = 5180, .hw_value = 36,}, - {.center_freq = 5200, .hw_value = 40,}, - {.center_freq = 5220, .hw_value = 44,}, - {.center_freq = 5240, .hw_value = 48,}, - {.center_freq = 5260, .hw_value = 52,}, - {.center_freq = 5280, .hw_value = 56,}, - {.center_freq = 5300, .hw_value = 60,}, - {.center_freq = 5320, .hw_value = 64,}, - {.center_freq = 5500, .hw_value = 100,}, - {.center_freq = 5520, .hw_value = 104,}, - {.center_freq = 5540, .hw_value = 108,}, - {.center_freq = 5560, .hw_value = 112,}, - {.center_freq = 5580, .hw_value = 116,}, - {.center_freq = 5600, .hw_value = 120,}, - {.center_freq = 5620, .hw_value = 124,}, - {.center_freq = 5640, .hw_value = 128,}, - {.center_freq = 5660, .hw_value = 132,}, - {.center_freq = 5680, .hw_value = 136,}, - {.center_freq = 5700, .hw_value = 140,}, - {.center_freq = 5745, .hw_value = 149,}, - {.center_freq = 5765, .hw_value = 153,}, - {.center_freq = 5785, .hw_value = 157,}, - {.center_freq = 5805, .hw_value = 161,}, - {.center_freq = 5825, .hw_value = 165,}, -}; - -static struct ieee80211_rate rtl_ratetable_2g[] = { - {.bitrate = 10, .hw_value = 0x00,}, - {.bitrate = 20, .hw_value = 0x01,}, - {.bitrate = 55, .hw_value = 0x02,}, - {.bitrate = 110, .hw_value = 0x03,}, - {.bitrate = 60, .hw_value = 0x04,}, - {.bitrate = 90, .hw_value = 0x05,}, - {.bitrate = 120, .hw_value = 0x06,}, - {.bitrate = 180, .hw_value = 0x07,}, - {.bitrate = 240, .hw_value = 0x08,}, - {.bitrate = 360, .hw_value = 0x09,}, - {.bitrate = 480, .hw_value = 0x0a,}, - {.bitrate = 540, .hw_value = 0x0b,}, -}; - -static struct ieee80211_rate rtl_ratetable_5g[] = { - {.bitrate = 60, .hw_value = 0x04,}, - {.bitrate = 90, .hw_value = 0x05,}, - {.bitrate = 120, .hw_value = 0x06,}, - {.bitrate = 180, .hw_value = 0x07,}, - {.bitrate = 240, .hw_value = 0x08,}, - {.bitrate = 360, .hw_value = 0x09,}, - {.bitrate = 480, .hw_value = 0x0a,}, - {.bitrate = 540, .hw_value = 0x0b,}, -}; - -static const struct ieee80211_supported_band rtl_band_2ghz = { - .band = IEEE80211_BAND_2GHZ, - - .channels = rtl_channeltable_2g, - .n_channels = ARRAY_SIZE(rtl_channeltable_2g), - - .bitrates = rtl_ratetable_2g, - .n_bitrates = ARRAY_SIZE(rtl_ratetable_2g), - - .ht_cap = {0}, -}; - -static struct ieee80211_supported_band rtl_band_5ghz = { - .band = IEEE80211_BAND_5GHZ, - - .channels = rtl_channeltable_5g, - .n_channels = ARRAY_SIZE(rtl_channeltable_5g), - - .bitrates = rtl_ratetable_5g, - .n_bitrates = ARRAY_SIZE(rtl_ratetable_5g), - - .ht_cap = {0}, -}; - -static const u8 tid_to_ac[] = { - 2, /* IEEE80211_AC_BE */ - 3, /* IEEE80211_AC_BK */ - 3, /* IEEE80211_AC_BK */ - 2, /* IEEE80211_AC_BE */ - 1, /* IEEE80211_AC_VI */ - 1, /* IEEE80211_AC_VI */ - 0, /* IEEE80211_AC_VO */ - 0, /* IEEE80211_AC_VO */ -}; - -u8 rtl_tid_to_ac(u8 tid) -{ - return tid_to_ac[tid]; -} - -static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw, - struct ieee80211_sta_ht_cap *ht_cap) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - ht_cap->ht_supported = true; - ht_cap->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | - IEEE80211_HT_CAP_SGI_40 | - IEEE80211_HT_CAP_SGI_20 | - IEEE80211_HT_CAP_DSSSCCK40 | IEEE80211_HT_CAP_MAX_AMSDU; - - if (rtlpriv->rtlhal.disable_amsdu_8k) - ht_cap->cap &= ~IEEE80211_HT_CAP_MAX_AMSDU; - - /* - *Maximum length of AMPDU that the STA can receive. - *Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets) - */ - ht_cap->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; - - /*Minimum MPDU start spacing , */ - ht_cap->ampdu_density = IEEE80211_HT_MPDU_DENSITY_16; - - ht_cap->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; - - /*hw->wiphy->bands[IEEE80211_BAND_2GHZ] - *base on ant_num - *rx_mask: RX mask - *if rx_ant = 1 rx_mask[0]= 0xff;==>MCS0-MCS7 - *if rx_ant = 2 rx_mask[1]= 0xff;==>MCS8-MCS15 - *if rx_ant >= 3 rx_mask[2]= 0xff; - *if BW_40 rx_mask[4]= 0x01; - *highest supported RX rate - */ - if (rtlpriv->dm.supp_phymode_switch) { - - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, - "Support phy mode switch\n"); - - ht_cap->mcs.rx_mask[0] = 0xFF; - ht_cap->mcs.rx_mask[1] = 0xFF; - ht_cap->mcs.rx_mask[4] = 0x01; - - ht_cap->mcs.rx_highest = cpu_to_le16(MAX_BIT_RATE_40MHZ_MCS15); - } else { - if (get_rf_type(rtlphy) == RF_1T2R || - get_rf_type(rtlphy) == RF_2T2R) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "1T2R or 2T2R\n"); - ht_cap->mcs.rx_mask[0] = 0xFF; - ht_cap->mcs.rx_mask[1] = 0xFF; - ht_cap->mcs.rx_mask[4] = 0x01; - - ht_cap->mcs.rx_highest = - cpu_to_le16(MAX_BIT_RATE_40MHZ_MCS15); - } else if (get_rf_type(rtlphy) == RF_1T1R) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "1T1R\n"); - - ht_cap->mcs.rx_mask[0] = 0xFF; - ht_cap->mcs.rx_mask[1] = 0x00; - ht_cap->mcs.rx_mask[4] = 0x01; - - ht_cap->mcs.rx_highest = - cpu_to_le16(MAX_BIT_RATE_40MHZ_MCS7); - } - } -} - -static void _rtl_init_mac80211(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - struct rtl_mac *rtlmac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct ieee80211_supported_band *sband; - - - if (rtlhal->macphymode == SINGLEMAC_SINGLEPHY && rtlhal->bandset == - BAND_ON_BOTH) { - /* 1: 2.4 G bands */ - /* <1> use mac->bands as mem for hw->wiphy->bands */ - sband = &(rtlmac->bands[IEEE80211_BAND_2GHZ]); - - /* <2> set hw->wiphy->bands[IEEE80211_BAND_2GHZ] - * to default value(1T1R) */ - memcpy(&(rtlmac->bands[IEEE80211_BAND_2GHZ]), &rtl_band_2ghz, - sizeof(struct ieee80211_supported_band)); - - /* <3> init ht cap base on ant_num */ - _rtl_init_hw_ht_capab(hw, &sband->ht_cap); - - /* <4> set mac->sband to wiphy->sband */ - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband; - - /* 2: 5 G bands */ - /* <1> use mac->bands as mem for hw->wiphy->bands */ - sband = &(rtlmac->bands[IEEE80211_BAND_5GHZ]); - - /* <2> set hw->wiphy->bands[IEEE80211_BAND_5GHZ] - * to default value(1T1R) */ - memcpy(&(rtlmac->bands[IEEE80211_BAND_5GHZ]), &rtl_band_5ghz, - sizeof(struct ieee80211_supported_band)); - - /* <3> init ht cap base on ant_num */ - _rtl_init_hw_ht_capab(hw, &sband->ht_cap); - - /* <4> set mac->sband to wiphy->sband */ - hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband; - } else { - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - /* <1> use mac->bands as mem for hw->wiphy->bands */ - sband = &(rtlmac->bands[IEEE80211_BAND_2GHZ]); - - /* <2> set hw->wiphy->bands[IEEE80211_BAND_2GHZ] - * to default value(1T1R) */ - memcpy(&(rtlmac->bands[IEEE80211_BAND_2GHZ]), - &rtl_band_2ghz, - sizeof(struct ieee80211_supported_band)); - - /* <3> init ht cap base on ant_num */ - _rtl_init_hw_ht_capab(hw, &sband->ht_cap); - - /* <4> set mac->sband to wiphy->sband */ - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband; - } else if (rtlhal->current_bandtype == BAND_ON_5G) { - /* <1> use mac->bands as mem for hw->wiphy->bands */ - sband = &(rtlmac->bands[IEEE80211_BAND_5GHZ]); - - /* <2> set hw->wiphy->bands[IEEE80211_BAND_5GHZ] - * to default value(1T1R) */ - memcpy(&(rtlmac->bands[IEEE80211_BAND_5GHZ]), - &rtl_band_5ghz, - sizeof(struct ieee80211_supported_band)); - - /* <3> init ht cap base on ant_num */ - _rtl_init_hw_ht_capab(hw, &sband->ht_cap); - - /* <4> set mac->sband to wiphy->sband */ - hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, "Err BAND %d\n", - rtlhal->current_bandtype); - } - } - /* <5> set hw caps */ - hw->flags = IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_AMPDU_AGGREGATION | - IEEE80211_HW_CONNECTION_MONITOR | - /* IEEE80211_HW_SUPPORTS_CQM_RSSI | */ - IEEE80211_HW_CONNECTION_MONITOR | - IEEE80211_HW_MFP_CAPABLE | - IEEE80211_HW_REPORTS_TX_ACK_STATUS | 0; - - /* swlps or hwlps has been set in diff chip in init_sw_vars */ - if (rtlpriv->psc.swctrl_lps) - hw->flags |= IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_PS_NULLFUNC_STACK | - /* IEEE80211_HW_SUPPORTS_DYNAMIC_PS | */ - 0; - - hw->wiphy->interface_modes = - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_MESH_POINT) | - BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_P2P_GO); - - hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; - hw->wiphy->rts_threshold = 2347; - - hw->queues = AC_MAX; - hw->extra_tx_headroom = RTL_TX_HEADER_SIZE; - - /* TODO: Correct this value for our hw */ - /* TODO: define these hard code value */ - hw->channel_change_time = 100; - hw->max_listen_interval = 10; - hw->max_rate_tries = 4; - /* hw->max_rates = 1; */ - hw->sta_data_size = sizeof(struct rtl_sta_info); - - /* <6> mac address */ - if (is_valid_ether_addr(rtlefuse->dev_addr)) { - SET_IEEE80211_PERM_ADDR(hw, rtlefuse->dev_addr); - } else { - u8 rtlmac1[] = { 0x00, 0xe0, 0x4c, 0x81, 0x92, 0x00 }; - get_random_bytes((rtlmac1 + (ETH_ALEN - 1)), 1); - SET_IEEE80211_PERM_ADDR(hw, rtlmac1); - } - -} - -static void _rtl_init_deferred_work(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - /* <1> timer */ - setup_timer(&rtlpriv->works.watchdog_timer, - rtl_watch_dog_timer_callback, (unsigned long)hw); - setup_timer(&rtlpriv->works.dualmac_easyconcurrent_retrytimer, - rtl_easy_concurrent_retrytimer_callback, (unsigned long)hw); - - /* <2> work queue */ - rtlpriv->works.hw = hw; - rtlpriv->works.rtl_wq = alloc_workqueue(rtlpriv->cfg->name, 0, 0); - INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, - (void *)rtl_watchdog_wq_callback); - INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, - (void *)rtl_ips_nic_off_wq_callback); - INIT_DELAYED_WORK(&rtlpriv->works.ps_work, - (void *)rtl_swlps_wq_callback); - INIT_DELAYED_WORK(&rtlpriv->works.ps_rfon_wq, - (void *)rtl_swlps_rfon_wq_callback); - INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq, - (void *)rtl_fwevt_wq_callback); - -} - -void rtl_deinit_deferred_work(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - del_timer_sync(&rtlpriv->works.watchdog_timer); - - cancel_delayed_work(&rtlpriv->works.watchdog_wq); - cancel_delayed_work(&rtlpriv->works.ips_nic_off_wq); - cancel_delayed_work(&rtlpriv->works.ps_work); - cancel_delayed_work(&rtlpriv->works.ps_rfon_wq); - cancel_delayed_work(&rtlpriv->works.fwevt_wq); -} - -void rtl_init_rfkill(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - bool radio_state; - bool blocked; - u8 valid = 0; - - /*set init state to on */ - rtlpriv->rfkill.rfkill_state = true; - wiphy_rfkill_set_hw_state(hw->wiphy, 0); - - radio_state = rtlpriv->cfg->ops->radio_onoff_checking(hw, &valid); - - if (valid) { - pr_info("wireless switch is %s\n", - rtlpriv->rfkill.rfkill_state ? "on" : "off"); - - rtlpriv->rfkill.rfkill_state = radio_state; - - blocked = (rtlpriv->rfkill.rfkill_state == 1) ? 0 : 1; - wiphy_rfkill_set_hw_state(hw->wiphy, blocked); - } - - wiphy_rfkill_start_polling(hw->wiphy); -} -EXPORT_SYMBOL(rtl_init_rfkill); - -void rtl_deinit_rfkill(struct ieee80211_hw *hw) -{ - wiphy_rfkill_stop_polling(hw->wiphy); -} - -int rtl_init_core(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *rtlmac = rtl_mac(rtl_priv(hw)); - - /* <1> init mac80211 */ - _rtl_init_mac80211(hw); - rtlmac->hw = hw; - - /* <2> rate control register */ - hw->rate_control_algorithm = "rtl_rc"; - - /* - * <3> init CRDA must come after init - * mac80211 hw in _rtl_init_mac80211. - */ - if (rtl_regd_init(hw, rtl_reg_notifier)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "REGD init failed\n"); - return 1; - } - - /* <4> locks */ - mutex_init(&rtlpriv->locks.conf_mutex); - mutex_init(&rtlpriv->locks.ps_mutex); - spin_lock_init(&rtlpriv->locks.ips_lock); - spin_lock_init(&rtlpriv->locks.irq_th_lock); - spin_lock_init(&rtlpriv->locks.irq_pci_lock); - spin_lock_init(&rtlpriv->locks.tx_lock); - spin_lock_init(&rtlpriv->locks.h2c_lock); - spin_lock_init(&rtlpriv->locks.rf_ps_lock); - spin_lock_init(&rtlpriv->locks.rf_lock); - spin_lock_init(&rtlpriv->locks.waitq_lock); - spin_lock_init(&rtlpriv->locks.entry_list_lock); - spin_lock_init(&rtlpriv->locks.fw_ps_lock); - spin_lock_init(&rtlpriv->locks.cck_and_rw_pagea_lock); - spin_lock_init(&rtlpriv->locks.check_sendpkt_lock); - spin_lock_init(&rtlpriv->locks.fw_ps_lock); - spin_lock_init(&rtlpriv->locks.lps_lock); - - /* <5> init list */ - INIT_LIST_HEAD(&rtlpriv->entry_list); - - rtlmac->link_state = MAC80211_NOLINK; - - /* <6> init deferred work */ - _rtl_init_deferred_work(hw); - - return 0; -} - -void rtl_deinit_core(struct ieee80211_hw *hw) -{ -} - -void rtl_init_rx_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RCR, (u8 *) (&mac->rx_conf)); -} - -/********************************************************* - * - * tx information functions - * - *********************************************************/ -static void _rtl_qurey_shortpreamble_mode(struct ieee80211_hw *hw, - struct rtl_tcb_desc *tcb_desc, - struct ieee80211_tx_info *info) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 rate_flag = info->control.rates[0].flags; - - tcb_desc->use_shortpreamble = false; - - /* 1M can only use Long Preamble. 11B spec */ - if (tcb_desc->hw_rate == rtlpriv->cfg->maps[RTL_RC_CCK_RATE1M]) - return; - else if (rate_flag & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) - tcb_desc->use_shortpreamble = true; - - return; -} - -static void _rtl_query_shortgi(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - struct rtl_tcb_desc *tcb_desc, - struct ieee80211_tx_info *info) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u8 rate_flag = info->control.rates[0].flags; - u8 sgi_40 = 0, sgi_20 = 0, bw_40 = 0; - tcb_desc->use_shortgi = false; - - if (sta == NULL) - return; - - sgi_40 = sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40; - sgi_20 = sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20; - - if (!(sta->ht_cap.ht_supported)) - return; - - if (!sgi_40 && !sgi_20) - return; - - if (mac->opmode == NL80211_IFTYPE_STATION) - bw_40 = mac->bw_40; - else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC || - mac->opmode == NL80211_IFTYPE_MESH_POINT) - bw_40 = sta->bandwidth >= IEEE80211_STA_RX_BW_40; - - if (bw_40 && sgi_40) - tcb_desc->use_shortgi = true; - else if ((bw_40 == false) && sgi_20) - tcb_desc->use_shortgi = true; - - if (!(rate_flag & IEEE80211_TX_RC_SHORT_GI)) - tcb_desc->use_shortgi = false; -} - -static void _rtl_query_protection_mode(struct ieee80211_hw *hw, - struct rtl_tcb_desc *tcb_desc, - struct ieee80211_tx_info *info) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 rate_flag = info->control.rates[0].flags; - - /* Common Settings */ - tcb_desc->rts_stbc = false; - tcb_desc->cts_enable = false; - tcb_desc->rts_sc = 0; - tcb_desc->rts_bw = false; - tcb_desc->rts_use_shortpreamble = false; - tcb_desc->rts_use_shortgi = false; - - if (rate_flag & IEEE80211_TX_RC_USE_CTS_PROTECT) { - /* Use CTS-to-SELF in protection mode. */ - tcb_desc->rts_enable = true; - tcb_desc->cts_enable = true; - tcb_desc->rts_rate = rtlpriv->cfg->maps[RTL_RC_OFDM_RATE24M]; - } else if (rate_flag & IEEE80211_TX_RC_USE_RTS_CTS) { - /* Use RTS-CTS in protection mode. */ - tcb_desc->rts_enable = true; - tcb_desc->rts_rate = rtlpriv->cfg->maps[RTL_RC_OFDM_RATE24M]; - } -} - -static void _rtl_txrate_selectmode(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - struct rtl_tcb_desc *tcb_desc) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_sta_info *sta_entry = NULL; - u8 ratr_index = 7; - - if (sta) { - sta_entry = (struct rtl_sta_info *) sta->drv_priv; - ratr_index = sta_entry->ratr_index; - } - if (!tcb_desc->disable_ratefallback || !tcb_desc->use_driver_rate) { - if (mac->opmode == NL80211_IFTYPE_STATION) { - tcb_desc->ratr_index = 0; - } else if (mac->opmode == NL80211_IFTYPE_ADHOC || - mac->opmode == NL80211_IFTYPE_MESH_POINT) { - if (tcb_desc->multicast || tcb_desc->broadcast) { - tcb_desc->hw_rate = - rtlpriv->cfg->maps[RTL_RC_CCK_RATE2M]; - tcb_desc->use_driver_rate = 1; - tcb_desc->ratr_index = RATR_INX_WIRELESS_MC; - } else { - tcb_desc->ratr_index = ratr_index; - } - } else if (mac->opmode == NL80211_IFTYPE_AP) { - tcb_desc->ratr_index = ratr_index; - } - } - - if (rtlpriv->dm.useramask) { - tcb_desc->ratr_index = ratr_index; - /* TODO we will differentiate adhoc and station future */ - if (mac->opmode == NL80211_IFTYPE_STATION || - mac->opmode == NL80211_IFTYPE_MESH_POINT) { - tcb_desc->mac_id = 0; - - if (mac->mode == WIRELESS_MODE_N_24G) - tcb_desc->ratr_index = RATR_INX_WIRELESS_NGB; - else if (mac->mode == WIRELESS_MODE_N_5G) - tcb_desc->ratr_index = RATR_INX_WIRELESS_NG; - else if (mac->mode & WIRELESS_MODE_G) - tcb_desc->ratr_index = RATR_INX_WIRELESS_GB; - else if (mac->mode & WIRELESS_MODE_B) - tcb_desc->ratr_index = RATR_INX_WIRELESS_B; - else if (mac->mode & WIRELESS_MODE_A) - tcb_desc->ratr_index = RATR_INX_WIRELESS_G; - } else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) { - if (NULL != sta) { - if (sta->aid > 0) - tcb_desc->mac_id = sta->aid + 1; - else - tcb_desc->mac_id = 1; - } else { - tcb_desc->mac_id = 0; - } - } - } -} - -static void _rtl_query_bandwidth_mode(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - struct rtl_tcb_desc *tcb_desc) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - tcb_desc->packet_bw = false; - if (!sta) - return; - if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC || - mac->opmode == NL80211_IFTYPE_MESH_POINT) { - if (sta->bandwidth == IEEE80211_STA_RX_BW_20) - return; - } else if (mac->opmode == NL80211_IFTYPE_STATION) { - if (!mac->bw_40 || !(sta->ht_cap.ht_supported)) - return; - } - if (tcb_desc->multicast || tcb_desc->broadcast) - return; - - /*use legency rate, shall use 20MHz */ - if (tcb_desc->hw_rate <= rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M]) - return; - - tcb_desc->packet_bw = true; -} - -static u8 _rtl_get_highest_n_rate(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u8 hw_rate; - - if (get_rf_type(rtlphy) == RF_2T2R) - hw_rate = rtlpriv->cfg->maps[RTL_RC_HT_RATEMCS15]; - else - hw_rate = rtlpriv->cfg->maps[RTL_RC_HT_RATEMCS7]; - - return hw_rate; -} - -/* mac80211's rate_idx is like this: - * - * 2.4G band:rx_status->band == IEEE80211_BAND_2GHZ - * - * B/G rate: - * (rx_status->flag & RX_FLAG_HT) = 0, - * DESC92_RATE1M-->DESC92_RATE54M ==> idx is 0-->11, - * - * N rate: - * (rx_status->flag & RX_FLAG_HT) = 1, - * DESC92_RATEMCS0-->DESC92_RATEMCS15 ==> idx is 0-->15 - * - * 5G band:rx_status->band == IEEE80211_BAND_5GHZ - * A rate: - * (rx_status->flag & RX_FLAG_HT) = 0, - * DESC92_RATE6M-->DESC92_RATE54M ==> idx is 0-->7, - * - * N rate: - * (rx_status->flag & RX_FLAG_HT) = 1, - * DESC92_RATEMCS0-->DESC92_RATEMCS15 ==> idx is 0-->15 - */ -int rtlwifi_rate_mapping(struct ieee80211_hw *hw, - bool isht, u8 desc_rate, bool first_ampdu) -{ - int rate_idx; - - if (false == isht) { - if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) { - switch (desc_rate) { - case DESC92_RATE1M: - rate_idx = 0; - break; - case DESC92_RATE2M: - rate_idx = 1; - break; - case DESC92_RATE5_5M: - rate_idx = 2; - break; - case DESC92_RATE11M: - rate_idx = 3; - break; - case DESC92_RATE6M: - rate_idx = 4; - break; - case DESC92_RATE9M: - rate_idx = 5; - break; - case DESC92_RATE12M: - rate_idx = 6; - break; - case DESC92_RATE18M: - rate_idx = 7; - break; - case DESC92_RATE24M: - rate_idx = 8; - break; - case DESC92_RATE36M: - rate_idx = 9; - break; - case DESC92_RATE48M: - rate_idx = 10; - break; - case DESC92_RATE54M: - rate_idx = 11; - break; - default: - rate_idx = 0; - break; - } - } else { - switch (desc_rate) { - case DESC92_RATE6M: - rate_idx = 0; - break; - case DESC92_RATE9M: - rate_idx = 1; - break; - case DESC92_RATE12M: - rate_idx = 2; - break; - case DESC92_RATE18M: - rate_idx = 3; - break; - case DESC92_RATE24M: - rate_idx = 4; - break; - case DESC92_RATE36M: - rate_idx = 5; - break; - case DESC92_RATE48M: - rate_idx = 6; - break; - case DESC92_RATE54M: - rate_idx = 7; - break; - default: - rate_idx = 0; - break; - } - } - - } else { - - switch (desc_rate) { - case DESC92_RATEMCS0: - rate_idx = 0; - break; - case DESC92_RATEMCS1: - rate_idx = 1; - break; - case DESC92_RATEMCS2: - rate_idx = 2; - break; - case DESC92_RATEMCS3: - rate_idx = 3; - break; - case DESC92_RATEMCS4: - rate_idx = 4; - break; - case DESC92_RATEMCS5: - rate_idx = 5; - break; - case DESC92_RATEMCS6: - rate_idx = 6; - break; - case DESC92_RATEMCS7: - rate_idx = 7; - break; - case DESC92_RATEMCS8: - rate_idx = 8; - break; - case DESC92_RATEMCS9: - rate_idx = 9; - break; - case DESC92_RATEMCS10: - rate_idx = 10; - break; - case DESC92_RATEMCS11: - rate_idx = 11; - break; - case DESC92_RATEMCS12: - rate_idx = 12; - break; - case DESC92_RATEMCS13: - rate_idx = 13; - break; - case DESC92_RATEMCS14: - rate_idx = 14; - break; - case DESC92_RATEMCS15: - rate_idx = 15; - break; - default: - rate_idx = 0; - break; - } - } - return rate_idx; -} -EXPORT_SYMBOL(rtlwifi_rate_mapping); - -bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - __le16 fc = rtl_get_fc(skb); - - if (rtlpriv->dm.supp_phymode_switch && - mac->link_state < MAC80211_LINKED && - (ieee80211_is_auth(fc) || ieee80211_is_probe_req(fc))) { - if (rtlpriv->cfg->ops->chk_switch_dmdp) - rtlpriv->cfg->ops->chk_switch_dmdp(hw); - } - if (ieee80211_is_auth(fc)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, "MAC80211_LINKING\n"); - rtl_ips_nic_on(hw); - - mac->link_state = MAC80211_LINKING; - /* Dual mac */ - rtlpriv->phy.need_iqk = true; - } - - return true; -} - -void rtl_get_tcb_desc(struct ieee80211_hw *hw, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *rtlmac = rtl_mac(rtl_priv(hw)); - struct ieee80211_hdr *hdr = rtl_get_hdr(skb); - struct ieee80211_rate *txrate; - __le16 fc = hdr->frame_control; - - txrate = ieee80211_get_tx_rate(hw, info); - if (txrate) - tcb_desc->hw_rate = txrate->hw_value; - else - tcb_desc->hw_rate = 0; - - if (ieee80211_is_data(fc)) { - /* - *we set data rate INX 0 - *in rtl_rc.c if skb is special data or - *mgt which need low data rate. - */ - - /* - *So tcb_desc->hw_rate is just used for - *special data and mgt frames - */ - if (info->control.rates[0].idx == 0 || - ieee80211_is_nullfunc(fc)) { - tcb_desc->use_driver_rate = true; - tcb_desc->ratr_index = RATR_INX_WIRELESS_MC; - - tcb_desc->disable_ratefallback = 1; - } else { - /* - *because hw will nerver use hw_rate - *when tcb_desc->use_driver_rate = false - *so we never set highest N rate here, - *and N rate will all be controlled by FW - *when tcb_desc->use_driver_rate = false - */ - if (sta && (sta->ht_cap.ht_supported)) { - tcb_desc->hw_rate = _rtl_get_highest_n_rate(hw); - } else { - if (rtlmac->mode == WIRELESS_MODE_B) { - tcb_desc->hw_rate = - rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M]; - } else { - tcb_desc->hw_rate = - rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M]; - } - } - } - - if (is_multicast_ether_addr(ieee80211_get_DA(hdr))) - tcb_desc->multicast = 1; - else if (is_broadcast_ether_addr(ieee80211_get_DA(hdr))) - tcb_desc->broadcast = 1; - - _rtl_txrate_selectmode(hw, sta, tcb_desc); - _rtl_query_bandwidth_mode(hw, sta, tcb_desc); - _rtl_qurey_shortpreamble_mode(hw, tcb_desc, info); - _rtl_query_shortgi(hw, sta, tcb_desc, info); - _rtl_query_protection_mode(hw, tcb_desc, info); - } else { - tcb_desc->use_driver_rate = true; - tcb_desc->ratr_index = RATR_INX_WIRELESS_MC; - tcb_desc->disable_ratefallback = 1; - tcb_desc->mac_id = 0; - tcb_desc->packet_bw = false; - } -} -EXPORT_SYMBOL(rtl_get_tcb_desc); - -static bool addbareq_rx(struct ieee80211_hw *hw, struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct ieee80211_sta *sta = NULL; - struct ieee80211_hdr *hdr = rtl_get_hdr(skb); - struct rtl_sta_info *sta_entry = NULL; - struct ieee80211_mgmt *mgmt = (void *)skb->data; - u16 capab = 0, tid = 0; - struct rtl_tid_data *tid_data; - struct sk_buff *skb_delba = NULL; - struct ieee80211_rx_status rx_status = { 0 }; - - rcu_read_lock(); - sta = rtl_find_sta(hw, hdr->addr3); - if (sta == NULL) { - RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_EMERG, - "sta is NULL\n"); - rcu_read_unlock(); - return true; - } - - sta_entry = (struct rtl_sta_info *)sta->drv_priv; - if (!sta_entry) { - rcu_read_unlock(); - return true; - } - capab = le16_to_cpu(mgmt->u.action.u.addba_req.capab); - tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2; - tid_data = &sta_entry->tids[tid]; - if (tid_data->agg.rx_agg_state == RTL_RX_AGG_START) { - skb_delba = rtl_make_del_ba(hw, hdr->addr2, hdr->addr3, tid); - if (skb_delba) { - rx_status.freq = hw->conf.chandef.chan->center_freq; - rx_status.band = hw->conf.chandef.chan->band; - rx_status.flag |= RX_FLAG_DECRYPTED; - rx_status.flag |= RX_FLAG_MACTIME_END; - rx_status.rate_idx = 0; - rx_status.signal = 50 + 10; - memcpy(IEEE80211_SKB_RXCB(skb_delba), &rx_status, - sizeof(rx_status)); - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, - "fake del\n", skb_delba->data, - skb_delba->len); - ieee80211_rx_irqsafe(hw, skb_delba); - } - } - rcu_read_unlock(); - return false; -} - -bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct ieee80211_hdr *hdr = rtl_get_hdr(skb); - struct rtl_priv *rtlpriv = rtl_priv(hw); - __le16 fc = hdr->frame_control; - u8 *act = (u8 *)skb->data + MAC80211_3ADDR_LEN; - u8 category; - - if (!ieee80211_is_action(fc)) - return true; - - category = *act; - act++; - switch (category) { - case ACT_CAT_BA: - switch (*act) { - case ACT_ADDBAREQ: - if (mac->act_scanning) - return false; - - RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, - "%s ACT_ADDBAREQ From :%pM\n", - is_tx ? "Tx" : "Rx", hdr->addr2); - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "req\n", - skb->data, skb->len); - if (!is_tx) - if (addbareq_rx(hw, skb)) - return true; - break; - case ACT_ADDBARSP: - RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, - "%s ACT_ADDBARSP From :%pM\n", - is_tx ? "Tx" : "Rx", hdr->addr2); - break; - case ACT_DELBA: - RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, - "ACT_ADDBADEL From :%pM\n", hdr->addr2); - break; - } - break; - default: - break; - } - - return true; -} - -/*should call before software enc*/ -u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - __le16 fc = rtl_get_fc(skb); - u16 ether_type; - u8 mac_hdr_len = ieee80211_get_hdrlen_from_skb(skb); - const struct iphdr *ip; - - if (!ieee80211_is_data(fc)) - return false; - - ip = (const struct iphdr *)(skb->data + mac_hdr_len + - SNAP_SIZE + PROTOC_TYPE_SIZE); - ether_type = be16_to_cpup((__be16 *) - (skb->data + mac_hdr_len + SNAP_SIZE)); - - switch (ether_type) { - case ETH_P_IP: { - struct udphdr *udp; - u16 src; - u16 dst; - - if (ip->protocol != IPPROTO_UDP) - return false; - udp = (struct udphdr *)((u8 *)ip + (ip->ihl << 2)); - src = be16_to_cpu(udp->source); - dst = be16_to_cpu(udp->dest); - - /* If this case involves port 68 (UDP BOOTP client) connecting - * with port 67 (UDP BOOTP server), then return true so that - * the lowest speed is used. - */ - if (!((src == 68 && dst == 67) || (src == 67 && dst == 68))) - return false; - - RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, - "dhcp %s !!\n", is_tx ? "Tx" : "Rx"); - break; - } - case ETH_P_ARP: - break; - case ETH_P_PAE: - RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, - "802.1X %s EAPOL pkt!!\n", is_tx ? "Tx" : "Rx"); - break; - case ETH_P_IPV6: - /* TODO: Is this right? */ - return false; - default: - return false; - } - if (is_tx) { - rtlpriv->enter_ps = false; - schedule_work(&rtlpriv->works.lps_change_work); - ppsc->last_delaylps_stamp_jiffies = jiffies; - } - return true; -} - -/********************************************************* - * - * functions called by core.c - * - *********************************************************/ -int rtl_tx_agg_start(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u16 tid, u16 *ssn) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_tid_data *tid_data; - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_sta_info *sta_entry = NULL; - - if (sta == NULL) - return -EINVAL; - - if (unlikely(tid >= MAX_TID_COUNT)) - return -EINVAL; - - sta_entry = (struct rtl_sta_info *)sta->drv_priv; - if (!sta_entry) - return -ENXIO; - tid_data = &sta_entry->tids[tid]; - - RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, "on ra = %pM tid = %d seq:%d\n", - sta->addr, tid, tid_data->seq_number); - - *ssn = tid_data->seq_number; - tid_data->agg.agg_state = RTL_AGG_START; - - ieee80211_start_tx_ba_cb_irqsafe(mac->vif, sta->addr, tid); - - return 0; -} - -int rtl_tx_agg_stop(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u16 tid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_sta_info *sta_entry = NULL; - - if (sta == NULL) - return -EINVAL; - - if (!sta->addr) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "ra = NULL\n"); - return -EINVAL; - } - - RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, "on ra = %pM tid = %d\n", - sta->addr, tid); - - if (unlikely(tid >= MAX_TID_COUNT)) - return -EINVAL; - - sta_entry = (struct rtl_sta_info *)sta->drv_priv; - sta_entry->tids[tid].agg.agg_state = RTL_AGG_STOP; - - ieee80211_stop_tx_ba_cb_irqsafe(mac->vif, sta->addr, tid); - - return 0; -} - -int rtl_rx_agg_start(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u16 tid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_tid_data *tid_data; - struct rtl_sta_info *sta_entry = NULL; - - if (sta == NULL) - return -EINVAL; - - if (unlikely(tid >= MAX_TID_COUNT)) - return -EINVAL; - - sta_entry = (struct rtl_sta_info *)sta->drv_priv; - if (!sta_entry) - return -ENXIO; - tid_data = &sta_entry->tids[tid]; - - RT_TRACE(rtlpriv, COMP_RECV, DBG_DMESG, - "on ra = %pM tid = %d seq:%d\n", sta->addr, tid, - tid_data->seq_number); - - tid_data->agg.rx_agg_state = RTL_RX_AGG_START; - return 0; -} - -int rtl_rx_agg_stop(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u16 tid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_sta_info *sta_entry = NULL; - - if (sta == NULL) - return -EINVAL; - - if (!sta->addr) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "ra = NULL\n"); - return -EINVAL; - } - - RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, - "on ra = %pM tid = %d\n", sta->addr, tid); - - if (unlikely(tid >= MAX_TID_COUNT)) - return -EINVAL; - - sta_entry = (struct rtl_sta_info *)sta->drv_priv; - sta_entry->tids[tid].agg.rx_agg_state = RTL_RX_AGG_STOP; - - return 0; -} - -int rtl_tx_agg_oper(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u16 tid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_sta_info *sta_entry = NULL; - - if (sta == NULL) - return -EINVAL; - - if (!sta->addr) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "ra = NULL\n"); - return -EINVAL; - } - - RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, "on ra = %pM tid = %d\n", - sta->addr, tid); - - if (unlikely(tid >= MAX_TID_COUNT)) - return -EINVAL; - - sta_entry = (struct rtl_sta_info *)sta->drv_priv; - sta_entry->tids[tid].agg.agg_state = RTL_AGG_OPERATIONAL; - - return 0; -} - -/********************************************************* - * - * wq & timer callback functions - * - *********************************************************/ -/* this function is used for roaming */ -void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - - if (rtlpriv->mac80211.opmode != NL80211_IFTYPE_STATION) - return; - - if (rtlpriv->mac80211.link_state < MAC80211_LINKED) - return; - - /* check if this really is a beacon */ - if (!ieee80211_is_beacon(hdr->frame_control) && - !ieee80211_is_probe_resp(hdr->frame_control)) - return; - - /* min. beacon length + FCS_LEN */ - if (skb->len <= 40 + FCS_LEN) - return; - - /* and only beacons from the associated BSSID, please */ - if (compare_ether_addr(hdr->addr3, rtlpriv->mac80211.bssid)) - return; - - rtlpriv->link_info.bcn_rx_inperiod++; -} - -void rtl_watchdog_wq_callback(void *data) -{ - struct rtl_works *rtlworks = container_of_dwork_rtl(data, - struct rtl_works, - watchdog_wq); - struct ieee80211_hw *hw = rtlworks->hw; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - bool busytraffic = false; - bool tx_busy_traffic = false; - bool rx_busy_traffic = false; - bool higher_busytraffic = false; - bool higher_busyrxtraffic = false; - u8 idx, tid; - u32 rx_cnt_inp4eriod = 0; - u32 tx_cnt_inp4eriod = 0; - u32 aver_rx_cnt_inperiod = 0; - u32 aver_tx_cnt_inperiod = 0; - u32 aver_tidtx_inperiod[MAX_TID_COUNT] = {0}; - u32 tidtx_inp4eriod[MAX_TID_COUNT] = {0}; - - if (is_hal_stop(rtlhal)) - return; - - /* <1> Determine if action frame is allowed */ - if (mac->link_state > MAC80211_NOLINK) { - if (mac->cnt_after_linked < 20) - mac->cnt_after_linked++; - } else { - mac->cnt_after_linked = 0; - } - - /* - *<2> to check if traffic busy, if - * busytraffic we don't change channel - */ - if (mac->link_state >= MAC80211_LINKED) { - - /* (1) get aver_rx_cnt_inperiod & aver_tx_cnt_inperiod */ - for (idx = 0; idx <= 2; idx++) { - rtlpriv->link_info.num_rx_in4period[idx] = - rtlpriv->link_info.num_rx_in4period[idx + 1]; - rtlpriv->link_info.num_tx_in4period[idx] = - rtlpriv->link_info.num_tx_in4period[idx + 1]; - } - rtlpriv->link_info.num_rx_in4period[3] = - rtlpriv->link_info.num_rx_inperiod; - rtlpriv->link_info.num_tx_in4period[3] = - rtlpriv->link_info.num_tx_inperiod; - for (idx = 0; idx <= 3; idx++) { - rx_cnt_inp4eriod += - rtlpriv->link_info.num_rx_in4period[idx]; - tx_cnt_inp4eriod += - rtlpriv->link_info.num_tx_in4period[idx]; - } - aver_rx_cnt_inperiod = rx_cnt_inp4eriod / 4; - aver_tx_cnt_inperiod = tx_cnt_inp4eriod / 4; - - /* (2) check traffic busy */ - if (aver_rx_cnt_inperiod > 100 || aver_tx_cnt_inperiod > 100) { - busytraffic = true; - if (aver_rx_cnt_inperiod > aver_tx_cnt_inperiod) - rx_busy_traffic = true; - else - tx_busy_traffic = false; - } - - /* Higher Tx/Rx data. */ - if (aver_rx_cnt_inperiod > 4000 || - aver_tx_cnt_inperiod > 4000) { - higher_busytraffic = true; - - /* Extremely high Rx data. */ - if (aver_rx_cnt_inperiod > 5000) - higher_busyrxtraffic = true; - } - - /* check every tid's tx traffic */ - for (tid = 0; tid <= 7; tid++) { - for (idx = 0; idx <= 2; idx++) - rtlpriv->link_info.tidtx_in4period[tid][idx] = - rtlpriv->link_info.tidtx_in4period[tid] - [idx + 1]; - rtlpriv->link_info.tidtx_in4period[tid][3] = - rtlpriv->link_info.tidtx_inperiod[tid]; - - for (idx = 0; idx <= 3; idx++) - tidtx_inp4eriod[tid] += - rtlpriv->link_info.tidtx_in4period[tid][idx]; - aver_tidtx_inperiod[tid] = tidtx_inp4eriod[tid] / 4; - if (aver_tidtx_inperiod[tid] > 5000) - rtlpriv->link_info.higher_busytxtraffic[tid] = - true; - else - rtlpriv->link_info.higher_busytxtraffic[tid] = - false; - } - - if (((rtlpriv->link_info.num_rx_inperiod + - rtlpriv->link_info.num_tx_inperiod) > 8) || - (rtlpriv->link_info.num_rx_inperiod > 2)) - rtlpriv->enter_ps = true; - else - rtlpriv->enter_ps = false; - - /* LeisurePS only work in infra mode. */ - schedule_work(&rtlpriv->works.lps_change_work); - } - - rtlpriv->link_info.num_rx_inperiod = 0; - rtlpriv->link_info.num_tx_inperiod = 0; - for (tid = 0; tid <= 7; tid++) - rtlpriv->link_info.tidtx_inperiod[tid] = 0; - - rtlpriv->link_info.busytraffic = busytraffic; - rtlpriv->link_info.higher_busytraffic = higher_busytraffic; - rtlpriv->link_info.rx_busy_traffic = rx_busy_traffic; - rtlpriv->link_info.tx_busy_traffic = tx_busy_traffic; - rtlpriv->link_info.higher_busyrxtraffic = higher_busyrxtraffic; - - /* <3> DM */ - rtlpriv->cfg->ops->dm_watchdog(hw); - - /* <4> roaming */ - if (mac->link_state == MAC80211_LINKED && - mac->opmode == NL80211_IFTYPE_STATION) { - if ((rtlpriv->link_info.bcn_rx_inperiod + - rtlpriv->link_info.num_rx_inperiod) == 0) { - rtlpriv->link_info.roam_times++; - RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG, - "AP off for %d s\n", - (rtlpriv->link_info.roam_times * 2)); - - /* if we can't recv beacon for 6s, we should - * reconnect this AP - */ - if (rtlpriv->link_info.roam_times >= 3) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "AP off, try to reconnect now\n"); - rtlpriv->link_info.roam_times = 0; - ieee80211_connection_loss(rtlpriv->mac80211.vif); - } - } else { - rtlpriv->link_info.roam_times = 0; - } - } - rtlpriv->link_info.bcn_rx_inperiod = 0; -} - -void rtl_watch_dog_timer_callback(unsigned long data) -{ - struct ieee80211_hw *hw = (struct ieee80211_hw *)data; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - queue_delayed_work(rtlpriv->works.rtl_wq, - &rtlpriv->works.watchdog_wq, 0); - - mod_timer(&rtlpriv->works.watchdog_timer, - jiffies + MSECS(RTL_WATCH_DOG_TIME)); -} - -void rtl_fwevt_wq_callback(void *data) -{ - struct rtl_works *rtlworks = - container_of_dwork_rtl(data, struct rtl_works, fwevt_wq); - struct ieee80211_hw *hw = rtlworks->hw; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->cfg->ops->c2h_command_handle(hw); -} - -void rtl_easy_concurrent_retrytimer_callback(unsigned long data) -{ - struct ieee80211_hw *hw = (struct ieee80211_hw *)data; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_priv *buddy_priv = rtlpriv->buddy_priv; - - if (buddy_priv == NULL) - return; - - rtlpriv->cfg->ops->dualmac_easy_concurrent(hw); -} - -/********************************************************* - * - * frame process functions - * - *********************************************************/ -u8 *rtl_find_ie(u8 *data, unsigned int len, u8 ie) -{ - struct ieee80211_mgmt *mgmt = (void *)data; - u8 *pos, *end; - - pos = (u8 *)mgmt->u.beacon.variable; - end = data + len; - while (pos < end) { - if (pos + 2 + pos[1] > end) - return NULL; - - if (pos[0] == ie) - return pos; - - pos += 2 + pos[1]; - } - return NULL; -} - -/* when we use 2 rx ants we send IEEE80211_SMPS_OFF */ -/* when we use 1 rx ant we send IEEE80211_SMPS_STATIC */ -static struct sk_buff *rtl_make_smps_action(struct ieee80211_hw *hw, - enum ieee80211_smps_mode smps, u8 *da, u8 *bssid) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct sk_buff *skb; - struct ieee80211_mgmt *action_frame; - - /* 27 = header + category + action + smps mode */ - skb = dev_alloc_skb(27 + hw->extra_tx_headroom); - if (!skb) - return NULL; - - skb_reserve(skb, hw->extra_tx_headroom); - action_frame = (void *)skb_put(skb, 27); - memset(action_frame, 0, 27); - memcpy(action_frame->da, da, ETH_ALEN); - memcpy(action_frame->sa, rtlefuse->dev_addr, ETH_ALEN); - memcpy(action_frame->bssid, bssid, ETH_ALEN); - action_frame->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_ACTION); - action_frame->u.action.category = WLAN_CATEGORY_HT; - action_frame->u.action.u.ht_smps.action = WLAN_HT_ACTION_SMPS; - switch (smps) { - case IEEE80211_SMPS_AUTOMATIC:/* 0 */ - case IEEE80211_SMPS_NUM_MODES:/* 4 */ - WARN_ON(1); - case IEEE80211_SMPS_OFF:/* 1 */ /*MIMO_PS_NOLIMIT*/ - action_frame->u.action.u.ht_smps.smps_control = - WLAN_HT_SMPS_CONTROL_DISABLED;/* 0 */ - break; - case IEEE80211_SMPS_STATIC:/* 2 */ /*MIMO_PS_STATIC*/ - action_frame->u.action.u.ht_smps.smps_control = - WLAN_HT_SMPS_CONTROL_STATIC;/* 1 */ - break; - case IEEE80211_SMPS_DYNAMIC:/* 3 */ /*MIMO_PS_DYNAMIC*/ - action_frame->u.action.u.ht_smps.smps_control = - WLAN_HT_SMPS_CONTROL_DYNAMIC;/* 3 */ - break; - } - - return skb; -} - -int rtl_send_smps_action(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - enum ieee80211_smps_mode smps) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct sk_buff *skb = NULL; - struct rtl_tcb_desc tcb_desc; - u8 bssid[ETH_ALEN] = {0}; - - memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); - - if (rtlpriv->mac80211.act_scanning) - goto err_free; - - if (!sta) - goto err_free; - - if (unlikely(is_hal_stop(rtlhal) || ppsc->rfpwr_state != ERFON)) - goto err_free; - - if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status)) - goto err_free; - - if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_AP) - memcpy(bssid, rtlpriv->efuse.dev_addr, ETH_ALEN); - else - memcpy(bssid, rtlpriv->mac80211.bssid, ETH_ALEN); - - skb = rtl_make_smps_action(hw, smps, sta->addr, bssid); - /* this is a type = mgmt * stype = action frame */ - if (skb) { - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct rtl_sta_info *sta_entry = - (struct rtl_sta_info *) sta->drv_priv; - sta_entry->mimo_ps = smps; - - info->control.rates[0].idx = 0; - info->band = hw->conf.chandef.chan->band; - rtlpriv->intf_ops->adapter_tx(hw, sta, skb, &tcb_desc); - } - return 1; - -err_free: - return 0; -} -EXPORT_SYMBOL(rtl_send_smps_action); - -/* There seem to be issues in mac80211 regarding when del ba frames can be - * received. As a work around, we make a fake del_ba if we receive a ba_req; - * however, rx_agg was opened to let mac80211 release some ba related - * resources. This del_ba is for tx only. - */ -struct sk_buff *rtl_make_del_ba(struct ieee80211_hw *hw, - u8 *sa, u8 *bssid, u16 tid) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct sk_buff *skb; - struct ieee80211_mgmt *action_frame; - u16 params; - - /* 27 = header + category + action + smps mode */ - skb = dev_alloc_skb(34 + hw->extra_tx_headroom); - if (!skb) - return NULL; - - skb_reserve(skb, hw->extra_tx_headroom); - action_frame = (void *)skb_put(skb, 34); - memset(action_frame, 0, 34); - memcpy(action_frame->sa, sa, ETH_ALEN); - memcpy(action_frame->da, rtlefuse->dev_addr, ETH_ALEN); - memcpy(action_frame->bssid, bssid, ETH_ALEN); - action_frame->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_ACTION); - action_frame->u.action.category = WLAN_CATEGORY_BACK; - action_frame->u.action.u.delba.action_code = WLAN_ACTION_DELBA; - params = (u16)(1 << 11); /* bit 11 initiator */ - params |= (u16)(tid << 12); /* bit 15:12 TID number */ - - action_frame->u.action.u.delba.params = cpu_to_le16(params); - action_frame->u.action.u.delba.reason_code = - cpu_to_le16(WLAN_REASON_QSTA_TIMEOUT); - - return skb; -} - -/********************************************************* - * - * IOT functions - * - *********************************************************/ -static bool rtl_chk_vendor_ouisub(struct ieee80211_hw *hw, - struct octet_string vendor_ie) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - bool matched = false; - static u8 athcap_1[] = { 0x00, 0x03, 0x7F }; - static u8 athcap_2[] = { 0x00, 0x13, 0x74 }; - static u8 broadcap_1[] = { 0x00, 0x10, 0x18 }; - static u8 broadcap_2[] = { 0x00, 0x0a, 0xf7 }; - static u8 broadcap_3[] = { 0x00, 0x05, 0xb5 }; - static u8 racap[] = { 0x00, 0x0c, 0x43 }; - static u8 ciscocap[] = { 0x00, 0x40, 0x96 }; - static u8 marvcap[] = { 0x00, 0x50, 0x43 }; - - if (memcmp(vendor_ie.octet, athcap_1, 3) == 0 || - memcmp(vendor_ie.octet, athcap_2, 3) == 0) { - rtlpriv->mac80211.vendor = PEER_ATH; - matched = true; - } else if (memcmp(vendor_ie.octet, broadcap_1, 3) == 0 || - memcmp(vendor_ie.octet, broadcap_2, 3) == 0 || - memcmp(vendor_ie.octet, broadcap_3, 3) == 0) { - rtlpriv->mac80211.vendor = PEER_BROAD; - matched = true; - } else if (memcmp(vendor_ie.octet, racap, 3) == 0) { - rtlpriv->mac80211.vendor = PEER_RAL; - matched = true; - } else if (memcmp(vendor_ie.octet, ciscocap, 3) == 0) { - rtlpriv->mac80211.vendor = PEER_CISCO; - matched = true; - } else if (memcmp(vendor_ie.octet, marvcap, 3) == 0) { - rtlpriv->mac80211.vendor = PEER_MARV; - matched = true; - } - - return matched; -} - -static bool rtl_find_221_ie(struct ieee80211_hw *hw, u8 *data, - unsigned int len) -{ - struct ieee80211_mgmt *mgmt = (void *)data; - struct octet_string vendor_ie; - u8 *pos, *end; - - pos = (u8 *)mgmt->u.beacon.variable; - end = data + len; - while (pos < end) { - if (pos[0] == 221) { - vendor_ie.length = pos[1]; - vendor_ie.octet = &pos[2]; - if (rtl_chk_vendor_ouisub(hw, vendor_ie)) - return true; - } - - if (pos + 2 + pos[1] > end) - return false; - - pos += 2 + pos[1]; - } - return false; -} - -void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct ieee80211_hdr *hdr = (void *)data; - u32 vendor = PEER_UNKNOWN; - - static u8 ap3_1[3] = { 0x00, 0x14, 0xbf }; - static u8 ap3_2[3] = { 0x00, 0x1a, 0x70 }; - static u8 ap3_3[3] = { 0x00, 0x1d, 0x7e }; - static u8 ap4_1[3] = { 0x00, 0x90, 0xcc }; - static u8 ap4_2[3] = { 0x00, 0x0e, 0x2e }; - static u8 ap4_3[3] = { 0x00, 0x18, 0x02 }; - static u8 ap4_4[3] = { 0x00, 0x17, 0x3f }; - static u8 ap4_5[3] = { 0x00, 0x1c, 0xdf }; - static u8 ap5_1[3] = { 0x00, 0x1c, 0xf0 }; - static u8 ap5_2[3] = { 0x00, 0x21, 0x91 }; - static u8 ap5_3[3] = { 0x00, 0x24, 0x01 }; - static u8 ap5_4[3] = { 0x00, 0x15, 0xe9 }; - static u8 ap5_5[3] = { 0x00, 0x17, 0x9A }; - static u8 ap5_6[3] = { 0x00, 0x18, 0xE7 }; - static u8 ap6_1[3] = { 0x00, 0x17, 0x94 }; - static u8 ap7_1[3] = { 0x00, 0x14, 0xa4 }; - - if (mac->opmode != NL80211_IFTYPE_STATION) - return; - - if (mac->link_state == MAC80211_NOLINK) { - mac->vendor = PEER_UNKNOWN; - return; - } - - if (mac->cnt_after_linked > 2) - return; - - /* check if this really is a beacon */ - if (!ieee80211_is_beacon(hdr->frame_control)) - return; - - /* min. beacon length + FCS_LEN */ - if (len <= 40 + FCS_LEN) - return; - - /* and only beacons from the associated BSSID, please */ - if (!ether_addr_equal(hdr->addr3, rtlpriv->mac80211.bssid)) - return; - - if (rtl_find_221_ie(hw, data, len)) - vendor = mac->vendor; - - if ((memcmp(mac->bssid, ap5_1, 3) == 0) || - (memcmp(mac->bssid, ap5_2, 3) == 0) || - (memcmp(mac->bssid, ap5_3, 3) == 0) || - (memcmp(mac->bssid, ap5_4, 3) == 0) || - (memcmp(mac->bssid, ap5_5, 3) == 0) || - (memcmp(mac->bssid, ap5_6, 3) == 0) || - vendor == PEER_ATH) { - vendor = PEER_ATH; - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "=>ath find\n"); - } else if ((memcmp(mac->bssid, ap4_4, 3) == 0) || - (memcmp(mac->bssid, ap4_5, 3) == 0) || - (memcmp(mac->bssid, ap4_1, 3) == 0) || - (memcmp(mac->bssid, ap4_2, 3) == 0) || - (memcmp(mac->bssid, ap4_3, 3) == 0) || - vendor == PEER_RAL) { - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "=>ral find\n"); - vendor = PEER_RAL; - } else if (memcmp(mac->bssid, ap6_1, 3) == 0 || - vendor == PEER_CISCO) { - vendor = PEER_CISCO; - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "=>cisco find\n"); - } else if ((memcmp(mac->bssid, ap3_1, 3) == 0) || - (memcmp(mac->bssid, ap3_2, 3) == 0) || - (memcmp(mac->bssid, ap3_3, 3) == 0) || - vendor == PEER_BROAD) { - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "=>broad find\n"); - vendor = PEER_BROAD; - } else if (memcmp(mac->bssid, ap7_1, 3) == 0 || - vendor == PEER_MARV) { - vendor = PEER_MARV; - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "=>marv find\n"); - } - - mac->vendor = vendor; -} - -/********************************************************* - * - * sysfs functions - * - *********************************************************/ -static ssize_t rtl_show_debug_level(struct device *d, - struct device_attribute *attr, char *buf) -{ - struct ieee80211_hw *hw = dev_get_drvdata(d); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - return sprintf(buf, "0x%08X\n", rtlpriv->dbg.global_debuglevel); -} - -static ssize_t rtl_store_debug_level(struct device *d, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct ieee80211_hw *hw = dev_get_drvdata(d); - struct rtl_priv *rtlpriv = rtl_priv(hw); - unsigned long val; - int ret; - - ret = strict_strtoul(buf, 0, &val); - if (ret) { - printk(KERN_DEBUG "%s is not in hex or decimal form.\n", buf); - } else { - rtlpriv->dbg.global_debuglevel = val; - printk(KERN_DEBUG "debuglevel:%x\n", - rtlpriv->dbg.global_debuglevel); - } - - return strnlen(buf, count); -} - -static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO, - rtl_show_debug_level, rtl_store_debug_level); - -static struct attribute *rtl_sysfs_entries[] = { - - &dev_attr_debug_level.attr, - - NULL -}; - -/* - * "name" is folder name witch will be - * put in device directory like : - * sys/devices/pci0000:00/0000:00:1c.4/ - * 0000:06:00.0/rtl_sysfs - */ -struct attribute_group rtl_attribute_group = { - .name = "rtlsysfs", - .attrs = rtl_sysfs_entries, -}; - -MODULE_AUTHOR("lizhaoming "); -MODULE_AUTHOR("Realtek WlanFAE "); -MODULE_AUTHOR("Larry Finger "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Realtek 802.11n PCI wireless core"); - -struct rtl_global_var global_var = {}; - -static int __init rtl_core_module_init(void) -{ - if (rtl_rate_control_register()) - pr_err("Unable to register rtl_rc, use default RC !!\n"); - - /* init some global vars */ - INIT_LIST_HEAD(&global_var.glb_priv_list); - spin_lock_init(&global_var.glb_list_lock); - - return 0; -} - -static void __exit rtl_core_module_exit(void) -{ - /*RC*/ - rtl_rate_control_unregister(); -} - -module_init(rtl_core_module_init); -module_exit(rtl_core_module_exit); diff --git a/drivers/net/wireless/rtlwifi/base.h b/drivers/net/wireless/rtlwifi/base.h deleted file mode 100644 index 8576bc34b032..000000000000 --- a/drivers/net/wireless/rtlwifi/base.h +++ /dev/null @@ -1,157 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL_BASE_H__ -#define __RTL_BASE_H__ - -enum ap_peer { - PEER_UNKNOWN = 0, - PEER_RTL = 1, - PEER_RTL_92SE = 2, - PEER_BROAD = 3, - PEER_RAL = 4, - PEER_ATH = 5, - PEER_CISCO = 6, - PEER_MARV = 7, - PEER_AIRGO = 9, - PEER_MAX = 10, -} ; - -#define RTL_DUMMY_OFFSET 0 -#define RTL_DUMMY_UNIT 8 -#define RTL_TX_DUMMY_SIZE (RTL_DUMMY_OFFSET * RTL_DUMMY_UNIT) -#define RTL_TX_DESC_SIZE 32 -#define RTL_TX_HEADER_SIZE (RTL_TX_DESC_SIZE + RTL_TX_DUMMY_SIZE) - -#define HT_AMSDU_SIZE_4K 3839 -#define HT_AMSDU_SIZE_8K 7935 - -#define MAX_BIT_RATE_40MHZ_MCS15 300 /* Mbps */ -#define MAX_BIT_RATE_40MHZ_MCS7 150 /* Mbps */ - -#define RTL_RATE_COUNT_LEGACY 12 -#define RTL_CHANNEL_COUNT 14 - -#define FRAME_OFFSET_FRAME_CONTROL 0 -#define FRAME_OFFSET_DURATION 2 -#define FRAME_OFFSET_ADDRESS1 4 -#define FRAME_OFFSET_ADDRESS2 10 -#define FRAME_OFFSET_ADDRESS3 16 -#define FRAME_OFFSET_SEQUENCE 22 -#define FRAME_OFFSET_ADDRESS4 24 - -#define SET_80211_HDR_FRAME_CONTROL(_hdr, _val) \ - WRITEEF2BYTE(_hdr, _val) -#define SET_80211_HDR_TYPE_AND_SUBTYPE(_hdr, _val) \ - WRITEEF1BYTE(_hdr, _val) -#define SET_80211_HDR_PWR_MGNT(_hdr, _val) \ - SET_BITS_TO_LE_2BYTE(_hdr, 12, 1, _val) -#define SET_80211_HDR_TO_DS(_hdr, _val) \ - SET_BITS_TO_LE_2BYTE(_hdr, 8, 1, _val) - -#define SET_80211_PS_POLL_AID(_hdr, _val) \ - (*(u16 *)((u8 *)(_hdr) + 2) = _val) -#define SET_80211_PS_POLL_BSSID(_hdr, _val) \ - memcpy(((u8 *)(_hdr)) + 4, (u8 *)(_val), ETH_ALEN) -#define SET_80211_PS_POLL_TA(_hdr, _val) \ - memcpy(((u8 *)(_hdr)) + 10, (u8 *)(_val), ETH_ALEN) - -#define SET_80211_HDR_DURATION(_hdr, _val) \ - (*(u16 *)((u8 *)(_hdr) + FRAME_OFFSET_DURATION) = le16_to_cpu(_val)) -#define SET_80211_HDR_ADDRESS1(_hdr, _val) \ - CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS1, (u8 *)(_val)) -#define SET_80211_HDR_ADDRESS2(_hdr, _val) \ - CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS2, (u8 *)(_val)) -#define SET_80211_HDR_ADDRESS3(_hdr, _val) \ - CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS3, (u8 *)(_val)) -#define SET_80211_HDR_FRAGMENT_SEQUENCE(_hdr, _val) \ - WRITEEF2BYTE((u8 *)(_hdr)+FRAME_OFFSET_SEQUENCE, _val) - -#define SET_BEACON_PROBE_RSP_TIME_STAMP_LOW(__phdr, __val) \ - WRITEEF4BYTE(((u8 *)(__phdr)) + 24, __val) -#define SET_BEACON_PROBE_RSP_TIME_STAMP_HIGH(__phdr, __val) \ - WRITEEF4BYTE(((u8 *)(__phdr)) + 28, __val) -#define SET_BEACON_PROBE_RSP_BEACON_INTERVAL(__phdr, __val) \ - WRITEEF2BYTE(((u8 *)(__phdr)) + 32, __val) -#define GET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr) \ - READEF2BYTE(((u8 *)(__phdr)) + 34) -#define SET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, __val) \ - WRITEEF2BYTE(((u8 *)(__phdr)) + 34, __val) -#define MASK_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, __val) \ - SET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, \ - (GET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr) & (~(__val)))) - -int rtl_init_core(struct ieee80211_hw *hw); -void rtl_deinit_core(struct ieee80211_hw *hw); -void rtl_init_rx_config(struct ieee80211_hw *hw); -void rtl_init_rfkill(struct ieee80211_hw *hw); -void rtl_deinit_rfkill(struct ieee80211_hw *hw); - -void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb); -void rtl_watch_dog_timer_callback(unsigned long data); -void rtl_deinit_deferred_work(struct ieee80211_hw *hw); - -bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx); -u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx); - -void rtl_watch_dog_timer_callback(unsigned long data); -int rtl_tx_agg_start(struct ieee80211_hw *hw, struct ieee80211_sta *sta, - u16 tid, u16 *ssn); -int rtl_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_sta *sta, - u16 tid); -int rtl_tx_agg_oper(struct ieee80211_hw *hw, struct ieee80211_sta *sta, - u16 tid); -int rtl_rx_agg_start(struct ieee80211_hw *hw, struct ieee80211_sta *sta, - u16 tid); -int rtl_rx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_sta *sta, - u16 tid); -void rtl_watchdog_wq_callback(void *data); -void rtl_fwevt_wq_callback(void *data); - -void rtl_get_tcb_desc(struct ieee80211_hw *hw, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc); - -int rtl_send_smps_action(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - enum ieee80211_smps_mode smps); -u8 *rtl_find_ie(u8 *data, unsigned int len, u8 ie); -void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len); -u8 rtl_tid_to_ac(u8 tid); -extern struct attribute_group rtl_attribute_group; -void rtl_easy_concurrent_retrytimer_callback(unsigned long data); -extern struct rtl_global_var global_var; -int rtlwifi_rate_mapping(struct ieee80211_hw *hw, - bool isht, u8 desc_rate, bool first_ampdu); -bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb); -struct sk_buff *rtl_make_del_ba(struct ieee80211_hw *hw, - u8 *sa, u8 *bssid, u16 tid); - -#endif diff --git a/drivers/net/wireless/rtlwifi/cam.c b/drivers/net/wireless/rtlwifi/cam.c deleted file mode 100644 index 0e510f73041a..000000000000 --- a/drivers/net/wireless/rtlwifi/cam.c +++ /dev/null @@ -1,348 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include -#include "wifi.h" -#include "cam.h" - -void rtl_cam_reset_sec_info(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->sec.use_defaultkey = false; - rtlpriv->sec.pairwise_enc_algorithm = NO_ENCRYPTION; - rtlpriv->sec.group_enc_algorithm = NO_ENCRYPTION; - memset(rtlpriv->sec.key_buf, 0, KEY_BUF_SIZE * MAX_KEY_LEN); - memset(rtlpriv->sec.key_len, 0, KEY_BUF_SIZE); - rtlpriv->sec.pairwise_key = NULL; -} - -static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no, - u8 *mac_addr, u8 *key_cont_128, u16 us_config) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - u32 target_command; - u32 target_content = 0; - u8 entry_i; - - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "key_cont_128: %6phC\n", - key_cont_128); - - for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) { - target_command = entry_i + CAM_CONTENT_COUNT * entry_no; - target_command = target_command | BIT(31) | BIT(16); - - if (entry_i == 0) { - target_content = (u32) (*(mac_addr + 0)) << 16 | - (u32) (*(mac_addr + 1)) << 24 | (u32) us_config; - - rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI], - target_content); - rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], - target_command); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE %x: %x\n", - rtlpriv->cfg->maps[WCAMI], target_content); - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, - "The Key ID is %d\n", entry_no); - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE %x: %x\n", - rtlpriv->cfg->maps[RWCAM], target_command); - - } else if (entry_i == 1) { - - target_content = (u32) (*(mac_addr + 5)) << 24 | - (u32) (*(mac_addr + 4)) << 16 | - (u32) (*(mac_addr + 3)) << 8 | - (u32) (*(mac_addr + 2)); - - rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI], - target_content); - rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], - target_command); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE A4: %x\n", - target_content); - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE A0: %x\n", - target_command); - - } else { - - target_content = - (u32) (*(key_cont_128 + (entry_i * 4 - 8) + 3)) << - 24 | (u32) (*(key_cont_128 + (entry_i * 4 - 8) + 2)) - << 16 | - (u32) (*(key_cont_128 + (entry_i * 4 - 8) + 1)) << 8 - | (u32) (*(key_cont_128 + (entry_i * 4 - 8) + 0)); - - rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI], - target_content); - rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], - target_command); - udelay(100); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE A4: %x\n", - target_content); - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "WRITE A0: %x\n", - target_command); - } - } - - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "after set key, usconfig:%x\n", - us_config); -} - -u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, - u32 ul_key_id, u32 ul_entry_idx, u32 ul_enc_alg, - u32 ul_default_key, u8 *key_content) -{ - u32 us_config; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, - "EntryNo:%x, ulKeyId=%x, ulEncAlg=%x, ulUseDK=%x MacAddr %pM\n", - ul_entry_idx, ul_key_id, ul_enc_alg, - ul_default_key, mac_addr); - - if (ul_key_id == TOTAL_CAM_ENTRY) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "<=== ulKeyId exceed!\n"); - return 0; - } - - if (ul_default_key == 1) { - us_config = CFG_VALID | ((u16) (ul_enc_alg) << 2); - } else { - us_config = CFG_VALID | ((ul_enc_alg) << 2) | ul_key_id; - } - - rtl_cam_program_entry(hw, ul_entry_idx, mac_addr, - key_content, us_config); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "<===\n"); - - return 1; - -} -EXPORT_SYMBOL(rtl_cam_add_one_entry); - -int rtl_cam_delete_one_entry(struct ieee80211_hw *hw, - u8 *mac_addr, u32 ul_key_id) -{ - u32 ul_command; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "key_idx:%d\n", ul_key_id); - - ul_command = ul_key_id * CAM_CONTENT_COUNT; - ul_command = ul_command | BIT(31) | BIT(16); - - rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI], 0); - rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "rtl_cam_delete_one_entry(): WRITE A4: %x\n", 0); - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "rtl_cam_delete_one_entry(): WRITE A0: %x\n", ul_command); - - return 0; - -} -EXPORT_SYMBOL(rtl_cam_delete_one_entry); - -void rtl_cam_reset_all_entry(struct ieee80211_hw *hw) -{ - u32 ul_command; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - ul_command = BIT(31) | BIT(30); - rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command); -} -EXPORT_SYMBOL(rtl_cam_reset_all_entry); - -void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - u32 ul_command; - u32 ul_content; - u32 ul_enc_algo = rtlpriv->cfg->maps[SEC_CAM_AES]; - - switch (rtlpriv->sec.pairwise_enc_algorithm) { - case WEP40_ENCRYPTION: - ul_enc_algo = rtlpriv->cfg->maps[SEC_CAM_WEP40]; - break; - case WEP104_ENCRYPTION: - ul_enc_algo = rtlpriv->cfg->maps[SEC_CAM_WEP104]; - break; - case TKIP_ENCRYPTION: - ul_enc_algo = rtlpriv->cfg->maps[SEC_CAM_TKIP]; - break; - case AESCCMP_ENCRYPTION: - ul_enc_algo = rtlpriv->cfg->maps[SEC_CAM_AES]; - break; - default: - ul_enc_algo = rtlpriv->cfg->maps[SEC_CAM_AES]; - } - - ul_content = (uc_index & 3) | ((u16) (ul_enc_algo) << 2); - - ul_content |= BIT(15); - ul_command = CAM_CONTENT_COUNT * uc_index; - ul_command = ul_command | BIT(31) | BIT(16); - - rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI], ul_content); - rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "rtl_cam_mark_invalid(): WRITE A4: %x\n", ul_content); - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "rtl_cam_mark_invalid(): WRITE A0: %x\n", ul_command); -} -EXPORT_SYMBOL(rtl_cam_mark_invalid); - -void rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - u32 ul_command; - u32 ul_content; - u32 ul_encalgo = rtlpriv->cfg->maps[SEC_CAM_AES]; - u8 entry_i; - - switch (rtlpriv->sec.pairwise_enc_algorithm) { - case WEP40_ENCRYPTION: - ul_encalgo = rtlpriv->cfg->maps[SEC_CAM_WEP40]; - break; - case WEP104_ENCRYPTION: - ul_encalgo = rtlpriv->cfg->maps[SEC_CAM_WEP104]; - break; - case TKIP_ENCRYPTION: - ul_encalgo = rtlpriv->cfg->maps[SEC_CAM_TKIP]; - break; - case AESCCMP_ENCRYPTION: - ul_encalgo = rtlpriv->cfg->maps[SEC_CAM_AES]; - break; - default: - ul_encalgo = rtlpriv->cfg->maps[SEC_CAM_AES]; - } - - for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) { - - if (entry_i == 0) { - ul_content = - (uc_index & 0x03) | ((u16) (ul_encalgo) << 2); - ul_content |= BIT(15); - - } else { - ul_content = 0; - } - - ul_command = CAM_CONTENT_COUNT * uc_index + entry_i; - ul_command = ul_command | BIT(31) | BIT(16); - - rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI], ul_content); - rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, - "rtl_cam_empty_entry(): WRITE A4: %x\n", - ul_content); - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, - "rtl_cam_empty_entry(): WRITE A0: %x\n", - ul_command); - } - -} -EXPORT_SYMBOL(rtl_cam_empty_entry); - -u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 bitmap = (rtlpriv->sec.hwsec_cam_bitmap) >> 4; - u8 entry_idx = 0; - u8 i, *addr; - - if (NULL == sta_addr) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG, "sta_addr is NULL\n"); - return TOTAL_CAM_ENTRY; - } - /* Does STA already exist? */ - for (i = 4; i < TOTAL_CAM_ENTRY; i++) { - addr = rtlpriv->sec.hwsec_cam_sta_addr[i]; - if (memcmp(addr, sta_addr, ETH_ALEN) == 0) - return i; - } - /* Get a free CAM entry. */ - for (entry_idx = 4; entry_idx < TOTAL_CAM_ENTRY; entry_idx++) { - if ((bitmap & BIT(0)) == 0) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG, - "-----hwsec_cam_bitmap: 0x%x entry_idx=%d\n", - rtlpriv->sec.hwsec_cam_bitmap, entry_idx); - rtlpriv->sec.hwsec_cam_bitmap |= BIT(0) << entry_idx; - memcpy(rtlpriv->sec.hwsec_cam_sta_addr[entry_idx], - sta_addr, ETH_ALEN); - return entry_idx; - } - bitmap = bitmap >> 1; - } - return TOTAL_CAM_ENTRY; -} -EXPORT_SYMBOL(rtl_cam_get_free_entry); - -void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 bitmap; - u8 i, *addr; - - if (NULL == sta_addr) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG, "sta_addr is NULL\n"); - } - - if (is_zero_ether_addr(sta_addr)) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_EMERG, - "sta_addr is %pM\n", sta_addr); - return; - } - /* Does STA already exist? */ - for (i = 4; i < TOTAL_CAM_ENTRY; i++) { - addr = rtlpriv->sec.hwsec_cam_sta_addr[i]; - bitmap = (rtlpriv->sec.hwsec_cam_bitmap) >> i; - if (((bitmap & BIT(0)) == BIT(0)) && - (memcmp(addr, sta_addr, ETH_ALEN) == 0)) { - /* Remove from HW Security CAM */ - eth_zero_addr(rtlpriv->sec.hwsec_cam_sta_addr[i]); - rtlpriv->sec.hwsec_cam_bitmap &= ~(BIT(0) << i); - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, - "del CAM entry %d\n", i); - } - } - return; -} -EXPORT_SYMBOL(rtl_cam_del_entry); diff --git a/drivers/net/wireless/rtlwifi/cam.h b/drivers/net/wireless/rtlwifi/cam.h deleted file mode 100644 index 35e00086a520..000000000000 --- a/drivers/net/wireless/rtlwifi/cam.h +++ /dev/null @@ -1,56 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL_CAM_H_ -#define __RTL_CAM_H_ - -#define CAM_CONTENT_COUNT 8 - -#define CFG_DEFAULT_KEY BIT(5) -#define CFG_VALID BIT(15) - -#define PAIRWISE_KEYIDX 0 -#define CAM_PAIRWISE_KEY_POSITION 4 - -#define CAM_CONFIG_USEDK 1 -#define CAM_CONFIG_NO_USEDK 0 - -extern void rtl_cam_reset_all_entry(struct ieee80211_hw *hw); -extern u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, - u32 ul_key_id, u32 ul_entry_idx, u32 ul_enc_alg, - u32 ul_default_key, u8 *key_content); -int rtl_cam_delete_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, - u32 ul_key_id); -void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index); -void rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index); -void rtl_cam_reset_sec_info(struct ieee80211_hw *hw); -u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr); -void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr); - -#endif diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c deleted file mode 100644 index ee84844be008..000000000000 --- a/drivers/net/wireless/rtlwifi/core.c +++ /dev/null @@ -1,1332 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "wifi.h" -#include "core.h" -#include "cam.h" -#include "base.h" -#include "pci.h" -#include "ps.h" - -#include - -void rtl_fw_cb(const struct firmware *firmware, void *context) -{ - struct ieee80211_hw *hw = context; - struct rtl_priv *rtlpriv = rtl_priv(hw); - int err; - - RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD, - "Firmware callback routine entered!\n"); - complete(&rtlpriv->firmware_loading_complete); - if (!firmware) { - pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name); - rtlpriv->max_fw_size = 0; - return; - } - if (firmware->size > rtlpriv->max_fw_size) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Firmware is too big!\n"); - release_firmware(firmware); - return; - } - memcpy(rtlpriv->rtlhal.pfirmware, firmware->data, firmware->size); - rtlpriv->rtlhal.fwsize = firmware->size; - release_firmware(firmware); - - err = ieee80211_register_hw(hw); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Can't register mac80211 hw\n"); - return; - } else { - rtlpriv->mac80211.mac80211_registered = 1; - } - set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status); - - /*init rfkill */ - rtl_init_rfkill(hw); -} -EXPORT_SYMBOL(rtl_fw_cb); - -/*mutex for start & stop is must here. */ -static int rtl_op_start(struct ieee80211_hw *hw) -{ - int err; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (!is_hal_stop(rtlhal)) - return 0; - if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status)) - return 0; - mutex_lock(&rtlpriv->locks.conf_mutex); - err = rtlpriv->intf_ops->adapter_start(hw); - if (!err) - rtl_watch_dog_timer_callback((unsigned long)hw); - mutex_unlock(&rtlpriv->locks.conf_mutex); - return err; -} - -static void rtl_op_stop(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - if (is_hal_stop(rtlhal)) - return; - - /* here is must, because adhoc do stop and start, - * but stop with RFOFF may cause something wrong, - * like adhoc TP - */ - if (unlikely(ppsc->rfpwr_state == ERFOFF)) { - rtl_ips_nic_on(hw); - } - - mutex_lock(&rtlpriv->locks.conf_mutex); - - mac->link_state = MAC80211_NOLINK; - memset(mac->bssid, 0, 6); - mac->vendor = PEER_UNKNOWN; - - /*reset sec info */ - rtl_cam_reset_sec_info(hw); - - rtl_deinit_deferred_work(hw); - rtlpriv->intf_ops->adapter_stop(hw); - - mutex_unlock(&rtlpriv->locks.conf_mutex); -} - -static void rtl_op_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_tcb_desc tcb_desc; - memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); - - if (unlikely(is_hal_stop(rtlhal) || ppsc->rfpwr_state != ERFON)) - goto err_free; - - if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status)) - goto err_free; - - if (!rtlpriv->intf_ops->waitq_insert(hw, control->sta, skb)) - rtlpriv->intf_ops->adapter_tx(hw, control->sta, skb, &tcb_desc); - - return; - -err_free: - dev_kfree_skb_any(skb); -} - -static int rtl_op_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - int err = 0; - - vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER; - - if (mac->vif) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "vif has been set!! mac->vif = 0x%p\n", mac->vif); - return -EOPNOTSUPP; - } - - rtl_ips_nic_on(hw); - - mutex_lock(&rtlpriv->locks.conf_mutex); - - switch (ieee80211_vif_type_p2p(vif)) { - case NL80211_IFTYPE_P2P_CLIENT: - mac->p2p = P2P_ROLE_CLIENT; - /*fall through*/ - case NL80211_IFTYPE_STATION: - if (mac->beacon_enabled == 1) { - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "NL80211_IFTYPE_STATION\n"); - mac->beacon_enabled = 0; - rtlpriv->cfg->ops->update_interrupt_mask(hw, 0, - rtlpriv->cfg->maps - [RTL_IBSS_INT_MASKS]); - } - break; - case NL80211_IFTYPE_ADHOC: - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "NL80211_IFTYPE_ADHOC\n"); - - mac->link_state = MAC80211_LINKED; - rtlpriv->cfg->ops->set_bcn_reg(hw); - if (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G) - mac->basic_rates = 0xfff; - else - mac->basic_rates = 0xff0; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE, - (u8 *) (&mac->basic_rates)); - - break; - case NL80211_IFTYPE_P2P_GO: - mac->p2p = P2P_ROLE_GO; - /*fall through*/ - case NL80211_IFTYPE_AP: - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "NL80211_IFTYPE_AP\n"); - - mac->link_state = MAC80211_LINKED; - rtlpriv->cfg->ops->set_bcn_reg(hw); - if (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G) - mac->basic_rates = 0xfff; - else - mac->basic_rates = 0xff0; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE, - (u8 *) (&mac->basic_rates)); - break; - case NL80211_IFTYPE_MESH_POINT: - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "NL80211_IFTYPE_MESH_POINT\n"); - - mac->link_state = MAC80211_LINKED; - rtlpriv->cfg->ops->set_bcn_reg(hw); - if (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G) - mac->basic_rates = 0xfff; - else - mac->basic_rates = 0xff0; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE, - (u8 *)(&mac->basic_rates)); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "operation mode %d is not supported!\n", vif->type); - err = -EOPNOTSUPP; - goto out; - } - - if (mac->p2p) { - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "p2p role %x\n", vif->type); - mac->basic_rates = 0xff0;/*disable cck rate for p2p*/ - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE, - (u8 *)(&mac->basic_rates)); - } - mac->vif = vif; - mac->opmode = vif->type; - rtlpriv->cfg->ops->set_network_type(hw, vif->type); - memcpy(mac->mac_addr, vif->addr, ETH_ALEN); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, mac->mac_addr); - -out: - mutex_unlock(&rtlpriv->locks.conf_mutex); - return err; -} - -static void rtl_op_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - mutex_lock(&rtlpriv->locks.conf_mutex); - - /* Free beacon resources */ - if ((vif->type == NL80211_IFTYPE_AP) || - (vif->type == NL80211_IFTYPE_ADHOC) || - (vif->type == NL80211_IFTYPE_MESH_POINT)) { - if (mac->beacon_enabled == 1) { - mac->beacon_enabled = 0; - rtlpriv->cfg->ops->update_interrupt_mask(hw, 0, - rtlpriv->cfg->maps - [RTL_IBSS_INT_MASKS]); - } - } - - /* - *Note: We assume NL80211_IFTYPE_UNSPECIFIED as - *NO LINK for our hardware. - */ - mac->p2p = 0; - mac->vif = NULL; - mac->link_state = MAC80211_NOLINK; - memset(mac->bssid, 0, 6); - mac->vendor = PEER_UNKNOWN; - mac->opmode = NL80211_IFTYPE_UNSPECIFIED; - rtlpriv->cfg->ops->set_network_type(hw, mac->opmode); - mutex_unlock(&rtlpriv->locks.conf_mutex); -} - -static int rtl_op_change_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum nl80211_iftype new_type, bool p2p) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int ret; - rtl_op_remove_interface(hw, vif); - - vif->type = new_type; - vif->p2p = p2p; - ret = rtl_op_add_interface(hw, vif); - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "p2p %x\n", p2p); - return ret; -} - -static int rtl_op_config(struct ieee80211_hw *hw, u32 changed) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct ieee80211_conf *conf = &hw->conf; - - if (mac->skip_scan) - return 1; - - mutex_lock(&rtlpriv->locks.conf_mutex); - if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { /*BIT(2)*/ - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "IEEE80211_CONF_CHANGE_LISTEN_INTERVAL\n"); - } - - /*For IPS */ - if (changed & IEEE80211_CONF_CHANGE_IDLE) { - if (hw->conf.flags & IEEE80211_CONF_IDLE) - rtl_ips_nic_off(hw); - else - rtl_ips_nic_on(hw); - } else { - /* - *although rfoff may not cause by ips, but we will - *check the reason in set_rf_power_state function - */ - if (unlikely(ppsc->rfpwr_state == ERFOFF)) - rtl_ips_nic_on(hw); - } - - /*For LPS */ - if (changed & IEEE80211_CONF_CHANGE_PS) { - cancel_delayed_work(&rtlpriv->works.ps_work); - cancel_delayed_work(&rtlpriv->works.ps_rfon_wq); - if (conf->flags & IEEE80211_CONF_PS) { - rtlpriv->psc.sw_ps_enabled = true; - /* sleep here is must, or we may recv the beacon and - * cause mac80211 into wrong ps state, this will cause - * power save nullfunc send fail, and further cause - * pkt loss, So sleep must quickly but not immediatly - * because that will cause nullfunc send by mac80211 - * fail, and cause pkt loss, we have tested that 5mA - * is worked very well */ - if (!rtlpriv->psc.multi_buffered) - queue_delayed_work(rtlpriv->works.rtl_wq, - &rtlpriv->works.ps_work, - MSECS(5)); - } else { - rtl_swlps_rf_awake(hw); - rtlpriv->psc.sw_ps_enabled = false; - } - } - - if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) { - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "IEEE80211_CONF_CHANGE_RETRY_LIMITS %x\n", - hw->conf.long_frame_max_tx_count); - mac->retry_long = hw->conf.long_frame_max_tx_count; - mac->retry_short = hw->conf.long_frame_max_tx_count; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT, - (u8 *) (&hw->conf. - long_frame_max_tx_count)); - } - - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { - struct ieee80211_channel *channel = hw->conf.chandef.chan; - u8 wide_chan = (u8) channel->hw_value; - - if (mac->act_scanning) - mac->n_channels++; - - if (rtlpriv->dm.supp_phymode_switch && - mac->link_state < MAC80211_LINKED && - !mac->act_scanning) { - if (rtlpriv->cfg->ops->chk_switch_dmdp) - rtlpriv->cfg->ops->chk_switch_dmdp(hw); - } - - /* - *because we should back channel to - *current_network.chan in in scanning, - *So if set_chan == current_network.chan - *we should set it. - *because mac80211 tell us wrong bw40 - *info for cisco1253 bw20, so we modify - *it here based on UPPER & LOWER - */ - switch (cfg80211_get_chandef_type(&hw->conf.chandef)) { - case NL80211_CHAN_HT20: - case NL80211_CHAN_NO_HT: - /* SC */ - mac->cur_40_prime_sc = - PRIME_CHNL_OFFSET_DONT_CARE; - rtlphy->current_chan_bw = HT_CHANNEL_WIDTH_20; - mac->bw_40 = false; - break; - case NL80211_CHAN_HT40MINUS: - /* SC */ - mac->cur_40_prime_sc = PRIME_CHNL_OFFSET_UPPER; - rtlphy->current_chan_bw = - HT_CHANNEL_WIDTH_20_40; - mac->bw_40 = true; - - /*wide channel */ - wide_chan -= 2; - - break; - case NL80211_CHAN_HT40PLUS: - /* SC */ - mac->cur_40_prime_sc = PRIME_CHNL_OFFSET_LOWER; - rtlphy->current_chan_bw = - HT_CHANNEL_WIDTH_20_40; - mac->bw_40 = true; - - /*wide channel */ - wide_chan += 2; - - break; - default: - mac->bw_40 = false; - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - - if (wide_chan <= 0) - wide_chan = 1; - - /* In scanning, before we go offchannel we may send a ps = 1 - * null to AP, and then we may send a ps = 0 null to AP quickly, - * but first null may have caused AP to put lots of packet to - * hw tx buffer. These packets must be tx'd before we go off - * channel so we must delay more time to let AP flush these - * packets before going offchannel, or dis-association or - * delete BA will be caused by AP - */ - if (rtlpriv->mac80211.offchan_delay) { - rtlpriv->mac80211.offchan_delay = false; - mdelay(50); - } - rtlphy->current_channel = wide_chan; - - rtlpriv->cfg->ops->switch_channel(hw); - rtlpriv->cfg->ops->set_channel_access(hw); - rtlpriv->cfg->ops->set_bw_mode(hw, - cfg80211_get_chandef_type(&hw->conf.chandef)); - } - - mutex_unlock(&rtlpriv->locks.conf_mutex); - - return 0; -} - -static void rtl_op_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *new_flags, u64 multicast) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - *new_flags &= RTL_SUPPORTED_FILTERS; - if (!changed_flags) - return; - - /*TODO: we disable broadcase now, so enable here */ - if (changed_flags & FIF_ALLMULTI) { - if (*new_flags & FIF_ALLMULTI) { - mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_AM] | - rtlpriv->cfg->maps[MAC_RCR_AB]; - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "Enable receive multicast frame\n"); - } else { - mac->rx_conf &= ~(rtlpriv->cfg->maps[MAC_RCR_AM] | - rtlpriv->cfg->maps[MAC_RCR_AB]); - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "Disable receive multicast frame\n"); - } - } - - if (changed_flags & FIF_FCSFAIL) { - if (*new_flags & FIF_FCSFAIL) { - mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_ACRC32]; - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "Enable receive FCS error frame\n"); - } else { - mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_ACRC32]; - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "Disable receive FCS error frame\n"); - } - } - - /* if ssid not set to hw don't check bssid - * here just used for linked scanning, & linked - * and nolink check bssid is set in set network_type */ - if ((changed_flags & FIF_BCN_PRBRESP_PROMISC) && - (mac->link_state >= MAC80211_LINKED)) { - if (mac->opmode != NL80211_IFTYPE_AP && - mac->opmode != NL80211_IFTYPE_MESH_POINT) { - if (*new_flags & FIF_BCN_PRBRESP_PROMISC) { - rtlpriv->cfg->ops->set_chk_bssid(hw, false); - } else { - rtlpriv->cfg->ops->set_chk_bssid(hw, true); - } - } - } - - if (changed_flags & FIF_CONTROL) { - if (*new_flags & FIF_CONTROL) { - mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_ACF]; - - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "Enable receive control frame\n"); - } else { - mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_ACF]; - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "Disable receive control frame\n"); - } - } - - if (changed_flags & FIF_OTHER_BSS) { - if (*new_flags & FIF_OTHER_BSS) { - mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_AAP]; - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "Enable receive other BSS's frame\n"); - } else { - mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_AAP]; - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "Disable receive other BSS's frame\n"); - } - } -} -static int rtl_op_sta_add(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_sta_info *sta_entry; - - if (sta) { - sta_entry = (struct rtl_sta_info *) sta->drv_priv; - spin_lock_bh(&rtlpriv->locks.entry_list_lock); - list_add_tail(&sta_entry->list, &rtlpriv->entry_list); - spin_unlock_bh(&rtlpriv->locks.entry_list_lock); - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - sta_entry->wireless_mode = WIRELESS_MODE_G; - if (sta->supp_rates[0] <= 0xf) - sta_entry->wireless_mode = WIRELESS_MODE_B; - if (sta->ht_cap.ht_supported == true) - sta_entry->wireless_mode = WIRELESS_MODE_N_24G; - - if (vif->type == NL80211_IFTYPE_ADHOC) - sta_entry->wireless_mode = WIRELESS_MODE_G; - } else if (rtlhal->current_bandtype == BAND_ON_5G) { - sta_entry->wireless_mode = WIRELESS_MODE_A; - if (sta->ht_cap.ht_supported == true) - sta_entry->wireless_mode = WIRELESS_MODE_N_24G; - - if (vif->type == NL80211_IFTYPE_ADHOC) - sta_entry->wireless_mode = WIRELESS_MODE_A; - } - /*disable cck rate for p2p*/ - if (mac->p2p) - sta->supp_rates[0] &= 0xfffffff0; - - memcpy(sta_entry->mac_addr, sta->addr, ETH_ALEN); - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, - "Add sta addr is %pM\n", sta->addr); - rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0); - } - return 0; -} - -static int rtl_op_sta_remove(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_sta_info *sta_entry; - if (sta) { - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, - "Remove sta addr is %pM\n", sta->addr); - sta_entry = (struct rtl_sta_info *) sta->drv_priv; - sta_entry->wireless_mode = 0; - sta_entry->ratr_index = 0; - - spin_lock_bh(&rtlpriv->locks.entry_list_lock); - list_del(&sta_entry->list); - spin_unlock_bh(&rtlpriv->locks.entry_list_lock); - } - return 0; -} - -static int _rtl_get_hal_qnum(u16 queue) -{ - int qnum; - - switch (queue) { - case 0: - qnum = AC3_VO; - break; - case 1: - qnum = AC2_VI; - break; - case 2: - qnum = AC0_BE; - break; - case 3: - qnum = AC1_BK; - break; - default: - qnum = AC0_BE; - break; - } - return qnum; -} - -/* - *for mac80211 VO = 0, VI = 1, BE = 2, BK = 3 - *for rtl819x BE = 0, BK = 1, VI = 2, VO = 3 - */ -static int rtl_op_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *param) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - int aci; - - if (queue >= AC_MAX) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "queue number %d is incorrect!\n", queue); - return -EINVAL; - } - - aci = _rtl_get_hal_qnum(queue); - mac->ac[aci].aifs = param->aifs; - mac->ac[aci].cw_min = cpu_to_le16(param->cw_min); - mac->ac[aci].cw_max = cpu_to_le16(param->cw_max); - mac->ac[aci].tx_op = cpu_to_le16(param->txop); - memcpy(&mac->edca_param[aci], param, sizeof(*param)); - rtlpriv->cfg->ops->set_qos(hw, aci); - return 0; -} - -static void rtl_op_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, u32 changed) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct ieee80211_sta *sta = NULL; - - mutex_lock(&rtlpriv->locks.conf_mutex); - if ((vif->type == NL80211_IFTYPE_ADHOC) || - (vif->type == NL80211_IFTYPE_AP) || - (vif->type == NL80211_IFTYPE_MESH_POINT)) { - if ((changed & BSS_CHANGED_BEACON) || - (changed & BSS_CHANGED_BEACON_ENABLED && - bss_conf->enable_beacon)) { - if (mac->beacon_enabled == 0) { - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, - "BSS_CHANGED_BEACON_ENABLED\n"); - - /*start hw beacon interrupt. */ - /*rtlpriv->cfg->ops->set_bcn_reg(hw); */ - mac->beacon_enabled = 1; - rtlpriv->cfg->ops->update_interrupt_mask(hw, - rtlpriv->cfg->maps - [RTL_IBSS_INT_MASKS], - 0); - - if (rtlpriv->cfg->ops->linked_set_reg) - rtlpriv->cfg->ops->linked_set_reg(hw); - } - } - if ((changed & BSS_CHANGED_BEACON_ENABLED && - !bss_conf->enable_beacon)) { - if (mac->beacon_enabled == 1) { - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, - "ADHOC DISABLE BEACON\n"); - - mac->beacon_enabled = 0; - rtlpriv->cfg->ops->update_interrupt_mask(hw, 0, - rtlpriv->cfg->maps - [RTL_IBSS_INT_MASKS]); - } - } - if (changed & BSS_CHANGED_BEACON_INT) { - RT_TRACE(rtlpriv, COMP_BEACON, DBG_TRACE, - "BSS_CHANGED_BEACON_INT\n"); - mac->beacon_interval = bss_conf->beacon_int; - rtlpriv->cfg->ops->set_bcn_intv(hw); - } - } - - /*TODO: reference to enum ieee80211_bss_change */ - if (changed & BSS_CHANGED_ASSOC) { - if (bss_conf->assoc) { - struct ieee80211_sta *sta = NULL; - /* we should reset all sec info & cam - * before set cam after linked, we should not - * reset in disassoc, that will cause tkip->wep - * fail because some flag will be wrong */ - /* reset sec info */ - rtl_cam_reset_sec_info(hw); - /* reset cam to fix wep fail issue - * when change from wpa to wep */ - rtl_cam_reset_all_entry(hw); - - mac->link_state = MAC80211_LINKED; - mac->cnt_after_linked = 0; - mac->assoc_id = bss_conf->aid; - memcpy(mac->bssid, bss_conf->bssid, 6); - - if (rtlpriv->cfg->ops->linked_set_reg) - rtlpriv->cfg->ops->linked_set_reg(hw); - rcu_read_lock(); - sta = ieee80211_find_sta(vif, (u8 *)bss_conf->bssid); - - if (vif->type == NL80211_IFTYPE_STATION && sta) - rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0); - RT_TRACE(rtlpriv, COMP_EASY_CONCURRENT, DBG_LOUD, - "send PS STATIC frame\n"); - if (rtlpriv->dm.supp_phymode_switch) { - if (sta->ht_cap.ht_supported) - rtl_send_smps_action(hw, sta, - IEEE80211_SMPS_STATIC); - } - rcu_read_unlock(); - - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, - "BSS_CHANGED_ASSOC\n"); - } else { - if (mac->link_state == MAC80211_LINKED) { - rtlpriv->enter_ps = false; - schedule_work(&rtlpriv->works.lps_change_work); - } - - if (ppsc->p2p_ps_info.p2p_ps_mode > P2P_PS_NONE) - rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE); - mac->link_state = MAC80211_NOLINK; - memset(mac->bssid, 0, 6); - mac->vendor = PEER_UNKNOWN; - - if (rtlpriv->dm.supp_phymode_switch) { - if (rtlpriv->cfg->ops->chk_switch_dmdp) - rtlpriv->cfg->ops->chk_switch_dmdp(hw); - } - - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, - "BSS_CHANGED_UN_ASSOC\n"); - } - } - - if (changed & BSS_CHANGED_ERP_CTS_PROT) { - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, - "BSS_CHANGED_ERP_CTS_PROT\n"); - mac->use_cts_protect = bss_conf->use_cts_prot; - } - - if (changed & BSS_CHANGED_ERP_PREAMBLE) { - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, - "BSS_CHANGED_ERP_PREAMBLE use short preamble:%x\n", - bss_conf->use_short_preamble); - - mac->short_preamble = bss_conf->use_short_preamble; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ACK_PREAMBLE, - &mac->short_preamble); - } - - if (changed & BSS_CHANGED_ERP_SLOT) { - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, - "BSS_CHANGED_ERP_SLOT\n"); - - if (bss_conf->use_short_slot) - mac->slot_time = RTL_SLOT_TIME_9; - else - mac->slot_time = RTL_SLOT_TIME_20; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME, - &mac->slot_time); - } - - if (changed & BSS_CHANGED_HT) { - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, "BSS_CHANGED_HT\n"); - rcu_read_lock(); - sta = get_sta(hw, vif, bss_conf->bssid); - if (sta) { - if (sta->ht_cap.ampdu_density > - mac->current_ampdu_density) - mac->current_ampdu_density = - sta->ht_cap.ampdu_density; - if (sta->ht_cap.ampdu_factor < - mac->current_ampdu_factor) - mac->current_ampdu_factor = - sta->ht_cap.ampdu_factor; - } - rcu_read_unlock(); - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SHORTGI_DENSITY, - &mac->max_mss_density); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_AMPDU_FACTOR, - &mac->current_ampdu_factor); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_AMPDU_MIN_SPACE, - &mac->current_ampdu_density); - } - - if (changed & BSS_CHANGED_BSSID) { - u32 basic_rates; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BSSID, - (u8 *) bss_conf->bssid); - - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG, "%pM\n", - bss_conf->bssid); - - mac->vendor = PEER_UNKNOWN; - memcpy(mac->bssid, bss_conf->bssid, 6); - rtlpriv->cfg->ops->set_network_type(hw, vif->type); - - rcu_read_lock(); - sta = get_sta(hw, vif, bss_conf->bssid); - if (!sta) { - rcu_read_unlock(); - goto out; - } - - if (rtlhal->current_bandtype == BAND_ON_5G) { - mac->mode = WIRELESS_MODE_A; - } else { - if (sta->supp_rates[0] <= 0xf) - mac->mode = WIRELESS_MODE_B; - else - mac->mode = WIRELESS_MODE_G; - } - - if (sta->ht_cap.ht_supported) { - if (rtlhal->current_bandtype == BAND_ON_2_4G) - mac->mode = WIRELESS_MODE_N_24G; - else - mac->mode = WIRELESS_MODE_N_5G; - } - - /* just station need it, because ibss & ap mode will - * set in sta_add, and will be NULL here */ - if (mac->opmode == NL80211_IFTYPE_STATION) { - struct rtl_sta_info *sta_entry; - sta_entry = (struct rtl_sta_info *) sta->drv_priv; - sta_entry->wireless_mode = mac->mode; - } - - if (sta->ht_cap.ht_supported) { - mac->ht_enable = true; - - /* - * for cisco 1252 bw20 it's wrong - * if (ht_cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) { - * mac->bw_40 = true; - * } - * */ - } - - if (changed & BSS_CHANGED_BASIC_RATES) { - /* for 5G must << RATE_6M_INDEX = 4, - * because 5G have no cck rate*/ - if (rtlhal->current_bandtype == BAND_ON_5G) - basic_rates = sta->supp_rates[1] << 4; - else - basic_rates = sta->supp_rates[0]; - - mac->basic_rates = basic_rates; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE, - (u8 *) (&basic_rates)); - } - rcu_read_unlock(); - } - - /* - * For FW LPS: - * To tell firmware we have connected - * to an AP. For 92SE/CE power save v2. - */ - if (changed & BSS_CHANGED_ASSOC) { - if (bss_conf->assoc) { - if (ppsc->fwctrl_lps) { - u8 mstatus = RT_MEDIA_CONNECT; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_JOINBSSRPT, - &mstatus); - ppsc->report_linked = true; - } - } else { - if (ppsc->fwctrl_lps) { - u8 mstatus = RT_MEDIA_DISCONNECT; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_JOINBSSRPT, - &mstatus); - ppsc->report_linked = false; - } - } - if (rtlpriv->cfg->ops->bt_wifi_media_status_notify) - rtlpriv->cfg->ops->bt_wifi_media_status_notify(hw, - ppsc->report_linked); - } - -out: - mutex_unlock(&rtlpriv->locks.conf_mutex); -} - -static u64 rtl_op_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u64 tsf; - - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_CORRECT_TSF, (u8 *) (&tsf)); - return tsf; -} - -static void rtl_op_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - u64 tsf) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u8 bibss = (mac->opmode == NL80211_IFTYPE_ADHOC) ? 1 : 0; - - mac->tsf = tsf; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_CORRECT_TSF, &bibss); -} - -static void rtl_op_reset_tsf(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp = 0; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_DUAL_TSF_RST, &tmp); -} - -static void rtl_op_sta_notify(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum sta_notify_cmd cmd, - struct ieee80211_sta *sta) -{ - switch (cmd) { - case STA_NOTIFY_SLEEP: - break; - case STA_NOTIFY_AWAKE: - break; - default: - break; - } -} - -static int rtl_op_ampdu_action(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, u16 tid, u16 *ssn, - u8 buf_size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - switch (action) { - case IEEE80211_AMPDU_TX_START: - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, - "IEEE80211_AMPDU_TX_START: TID:%d\n", tid); - return rtl_tx_agg_start(hw, sta, tid, ssn); - break; - case IEEE80211_AMPDU_TX_STOP_CONT: - case IEEE80211_AMPDU_TX_STOP_FLUSH: - case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, - "IEEE80211_AMPDU_TX_STOP: TID:%d\n", tid); - return rtl_tx_agg_stop(hw, sta, tid); - case IEEE80211_AMPDU_TX_OPERATIONAL: - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, - "IEEE80211_AMPDU_TX_OPERATIONAL:TID:%d\n", tid); - rtl_tx_agg_oper(hw, sta, tid); - break; - case IEEE80211_AMPDU_RX_START: - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, - "IEEE80211_AMPDU_RX_START:TID:%d\n", tid); - return rtl_rx_agg_start(hw, sta, tid); - case IEEE80211_AMPDU_RX_STOP: - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_TRACE, - "IEEE80211_AMPDU_RX_STOP:TID:%d\n", tid); - return rtl_rx_agg_stop(hw, sta, tid); - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "IEEE80211_AMPDU_ERR!!!!:\n"); - return -EOPNOTSUPP; - } - return 0; -} - -static void rtl_op_sw_scan_start(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "\n"); - mac->act_scanning = true; - if (rtlpriv->link_info.higher_busytraffic) { - mac->skip_scan = true; - return; - } - - if (rtlpriv->dm.supp_phymode_switch) { - if (rtlpriv->cfg->ops->chk_switch_dmdp) - rtlpriv->cfg->ops->chk_switch_dmdp(hw); - } - if (mac->link_state == MAC80211_LINKED) { - rtlpriv->enter_ps = false; - schedule_work(&rtlpriv->works.lps_change_work); - mac->link_state = MAC80211_LINKED_SCANNING; - } else { - rtl_ips_nic_on(hw); - } - - /* Dual mac */ - rtlpriv->rtlhal.load_imrandiqk_setting_for2g = false; - - rtlpriv->cfg->ops->led_control(hw, LED_CTL_SITE_SURVEY); - rtlpriv->cfg->ops->scan_operation_backup(hw, SCAN_OPT_BACKUP); -} - -static void rtl_op_sw_scan_complete(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD, "\n"); - mac->act_scanning = false; - mac->skip_scan = false; - if (rtlpriv->link_info.higher_busytraffic) - return; - - /*p2p will use 1/6/11 to scan */ - if (mac->n_channels == 3) - mac->p2p_in_use = true; - else - mac->p2p_in_use = false; - mac->n_channels = 0; - /* Dual mac */ - rtlpriv->rtlhal.load_imrandiqk_setting_for2g = false; - - if (mac->link_state == MAC80211_LINKED_SCANNING) { - mac->link_state = MAC80211_LINKED; - if (mac->opmode == NL80211_IFTYPE_STATION) { - /* fix fwlps issue */ - rtlpriv->cfg->ops->set_network_type(hw, mac->opmode); - } - } - - rtlpriv->cfg->ops->scan_operation_backup(hw, SCAN_OPT_RESTORE); -} - -static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u8 key_type = NO_ENCRYPTION; - u8 key_idx; - bool group_key = false; - bool wep_only = false; - int err = 0; - u8 mac_addr[ETH_ALEN]; - u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - - if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "not open hw encryption\n"); - return -ENOSPC; /*User disabled HW-crypto */ - } - /* To support IBSS, use sw-crypto for GTK */ - if (((vif->type == NL80211_IFTYPE_ADHOC) || - (vif->type == NL80211_IFTYPE_MESH_POINT)) && - !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) - return -ENOSPC; - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "%s hardware based encryption for keyidx: %d, mac: %pM\n", - cmd == SET_KEY ? "Using" : "Disabling", key->keyidx, - sta ? sta->addr : bcast_addr); - rtlpriv->sec.being_setkey = true; - rtl_ips_nic_on(hw); - mutex_lock(&rtlpriv->locks.conf_mutex); - /* <1> get encryption alg */ - - switch (key->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - key_type = WEP40_ENCRYPTION; - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "alg:WEP40\n"); - break; - case WLAN_CIPHER_SUITE_WEP104: - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "alg:WEP104\n"); - key_type = WEP104_ENCRYPTION; - break; - case WLAN_CIPHER_SUITE_TKIP: - key_type = TKIP_ENCRYPTION; - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "alg:TKIP\n"); - break; - case WLAN_CIPHER_SUITE_CCMP: - key_type = AESCCMP_ENCRYPTION; - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "alg:CCMP\n"); - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - /*HW doesn't support CMAC encryption, use software CMAC */ - key_type = AESCMAC_ENCRYPTION; - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "alg:CMAC\n"); - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "HW don't support CMAC encryption, use software CMAC\n"); - err = -EOPNOTSUPP; - goto out_unlock; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "alg_err:%x!!!!\n", - key->cipher); - goto out_unlock; - } - if (key_type == WEP40_ENCRYPTION || - key_type == WEP104_ENCRYPTION || - mac->opmode == NL80211_IFTYPE_ADHOC) - rtlpriv->sec.use_defaultkey = true; - - /* <2> get key_idx */ - key_idx = (u8) (key->keyidx); - if (key_idx > 3) - goto out_unlock; - /* <3> if pairwise key enable_hw_sec */ - group_key = !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE); - - /* wep always be group key, but there are two conditions: - * 1) wep only: is just for wep enc, in this condition - * rtlpriv->sec.pairwise_enc_algorithm == NO_ENCRYPTION - * will be true & enable_hw_sec will be set when wep - * key setting. - * 2) wep(group) + AES(pairwise): some AP like cisco - * may use it, in this condition enable_hw_sec will not - * be set when wep key setting */ - /* we must reset sec_info after lingked before set key, - * or some flag will be wrong*/ - if (vif->type == NL80211_IFTYPE_AP || - vif->type == NL80211_IFTYPE_MESH_POINT) { - if (!group_key || key_type == WEP40_ENCRYPTION || - key_type == WEP104_ENCRYPTION) { - if (group_key) - wep_only = true; - rtlpriv->cfg->ops->enable_hw_sec(hw); - } - } else { - if ((!group_key) || (mac->opmode == NL80211_IFTYPE_ADHOC) || - rtlpriv->sec.pairwise_enc_algorithm == NO_ENCRYPTION) { - if (rtlpriv->sec.pairwise_enc_algorithm == - NO_ENCRYPTION && - (key_type == WEP40_ENCRYPTION || - key_type == WEP104_ENCRYPTION)) - wep_only = true; - rtlpriv->sec.pairwise_enc_algorithm = key_type; - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "set enable_hw_sec, key_type:%x(OPEN:0 WEP40:1 TKIP:2 AES:4 WEP104:5)\n", - key_type); - rtlpriv->cfg->ops->enable_hw_sec(hw); - } - } - /* <4> set key based on cmd */ - switch (cmd) { - case SET_KEY: - if (wep_only) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "set WEP(group/pairwise) key\n"); - /* Pairwise key with an assigned MAC address. */ - rtlpriv->sec.pairwise_enc_algorithm = key_type; - rtlpriv->sec.group_enc_algorithm = key_type; - /*set local buf about wep key. */ - memcpy(rtlpriv->sec.key_buf[key_idx], - key->key, key->keylen); - rtlpriv->sec.key_len[key_idx] = key->keylen; - eth_zero_addr(mac_addr); - } else if (group_key) { /* group key */ - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "set group key\n"); - /* group key */ - rtlpriv->sec.group_enc_algorithm = key_type; - /*set local buf about group key. */ - memcpy(rtlpriv->sec.key_buf[key_idx], - key->key, key->keylen); - rtlpriv->sec.key_len[key_idx] = key->keylen; - memcpy(mac_addr, bcast_addr, ETH_ALEN); - } else { /* pairwise key */ - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "set pairwise key\n"); - if (!sta) { - RT_ASSERT(false, - "pairwise key without mac_addr\n"); - - err = -EOPNOTSUPP; - goto out_unlock; - } - /* Pairwise key with an assigned MAC address. */ - rtlpriv->sec.pairwise_enc_algorithm = key_type; - /*set local buf about pairwise key. */ - memcpy(rtlpriv->sec.key_buf[PAIRWISE_KEYIDX], - key->key, key->keylen); - rtlpriv->sec.key_len[PAIRWISE_KEYIDX] = key->keylen; - rtlpriv->sec.pairwise_key = - rtlpriv->sec.key_buf[PAIRWISE_KEYIDX]; - memcpy(mac_addr, sta->addr, ETH_ALEN); - } - rtlpriv->cfg->ops->set_key(hw, key_idx, mac_addr, - group_key, key_type, wep_only, - false); - /* <5> tell mac80211 do something: */ - /*must use sw generate IV, or can not work !!!!. */ - key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - key->hw_key_idx = key_idx; - if (key_type == TKIP_ENCRYPTION) - key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; - /*use software CCMP encryption for management frames (MFP) */ - if (key_type == AESCCMP_ENCRYPTION) - key->flags |= IEEE80211_KEY_FLAG_SW_MGMT_TX; - break; - case DISABLE_KEY: - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "disable key delete one entry\n"); - /*set local buf about wep key. */ - if (vif->type == NL80211_IFTYPE_AP || - vif->type == NL80211_IFTYPE_MESH_POINT) { - if (sta) - rtl_cam_del_entry(hw, sta->addr); - } - memset(rtlpriv->sec.key_buf[key_idx], 0, key->keylen); - rtlpriv->sec.key_len[key_idx] = 0; - eth_zero_addr(mac_addr); - /* - *mac80211 will delete entrys one by one, - *so don't use rtl_cam_reset_all_entry - *or clear all entry here. - */ - rtl_cam_delete_one_entry(hw, mac_addr, key_idx); - - rtl_cam_reset_sec_info(hw); - - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "cmd_err:%x!!!!\n", cmd); - } -out_unlock: - mutex_unlock(&rtlpriv->locks.conf_mutex); - rtlpriv->sec.being_setkey = false; - return err; -} - -static void rtl_op_rfkill_poll(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - bool radio_state; - bool blocked; - u8 valid = 0; - - if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status)) - return; - - mutex_lock(&rtlpriv->locks.conf_mutex); - - /*if Radio On return true here */ - radio_state = rtlpriv->cfg->ops->radio_onoff_checking(hw, &valid); - - if (valid) { - if (unlikely(radio_state != rtlpriv->rfkill.rfkill_state)) { - rtlpriv->rfkill.rfkill_state = radio_state; - - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "wireless radio switch turned %s\n", - radio_state ? "on" : "off"); - - blocked = (rtlpriv->rfkill.rfkill_state == 1) ? 0 : 1; - wiphy_rfkill_set_hw_state(hw->wiphy, blocked); - } - } - - mutex_unlock(&rtlpriv->locks.conf_mutex); -} - -/* this function is called by mac80211 to flush tx buffer - * before switch channel or power save, or tx buffer packet - * maybe send after offchannel or rf sleep, this may cause - * dis-association by AP */ -static void rtl_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->intf_ops->flush) - rtlpriv->intf_ops->flush(hw, drop); -} - -const struct ieee80211_ops rtl_ops = { - .start = rtl_op_start, - .stop = rtl_op_stop, - .tx = rtl_op_tx, - .add_interface = rtl_op_add_interface, - .remove_interface = rtl_op_remove_interface, - .change_interface = rtl_op_change_interface, - .config = rtl_op_config, - .configure_filter = rtl_op_configure_filter, - .sta_add = rtl_op_sta_add, - .sta_remove = rtl_op_sta_remove, - .set_key = rtl_op_set_key, - .conf_tx = rtl_op_conf_tx, - .bss_info_changed = rtl_op_bss_info_changed, - .get_tsf = rtl_op_get_tsf, - .set_tsf = rtl_op_set_tsf, - .reset_tsf = rtl_op_reset_tsf, - .sta_notify = rtl_op_sta_notify, - .ampdu_action = rtl_op_ampdu_action, - .sw_scan_start = rtl_op_sw_scan_start, - .sw_scan_complete = rtl_op_sw_scan_complete, - .rfkill_poll = rtl_op_rfkill_poll, - .flush = rtl_op_flush, -}; diff --git a/drivers/net/wireless/rtlwifi/core.h b/drivers/net/wireless/rtlwifi/core.h deleted file mode 100644 index 2fe46a1b4f1f..000000000000 --- a/drivers/net/wireless/rtlwifi/core.h +++ /dev/null @@ -1,45 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * Tmis 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. - * - * Tmis 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 - * tmis program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * Tme full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL_CORE_H__ -#define __RTL_CORE_H__ - -#define RTL_SUPPORTED_FILTERS \ - (FIF_PROMISC_IN_BSS | \ - FIF_ALLMULTI | FIF_CONTROL | \ - FIF_OTHER_BSS | \ - FIF_FCSFAIL | \ - FIF_BCN_PRBRESP_PROMISC) - -#define RTL_SUPPORTED_CTRL_FILTER 0xFF - -extern const struct ieee80211_ops rtl_ops; -void rtl_fw_cb(const struct firmware *firmware, void *context); - -#endif diff --git a/drivers/net/wireless/rtlwifi/debug.c b/drivers/net/wireless/rtlwifi/debug.c deleted file mode 100644 index 7d52d3d7769f..000000000000 --- a/drivers/net/wireless/rtlwifi/debug.c +++ /dev/null @@ -1,53 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * Tmis 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. - * - * Tmis 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 - * tmis program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * Tme full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - *****************************************************************************/ - -#include "wifi.h" - -#include - -void rtl_dbgp_flag_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 i; - - rtlpriv->dbg.global_debugcomponents = - COMP_ERR | COMP_FW | COMP_INIT | COMP_RECV | COMP_SEND | - COMP_MLME | COMP_SCAN | COMP_INTR | COMP_LED | COMP_SEC | - COMP_BEACON | COMP_RATE | COMP_RXDESC | COMP_DIG | COMP_TXAGC | - COMP_POWER | COMP_POWER_TRACKING | COMP_BB_POWERSAVING | COMP_SWAS | - COMP_RF | COMP_TURBO | COMP_RATR | COMP_CMD | - COMP_EFUSE | COMP_QOS | COMP_MAC80211 | COMP_REGD | COMP_CHAN | - COMP_EASY_CONCURRENT | COMP_EFUSE | COMP_QOS | COMP_MAC80211 | - COMP_REGD | COMP_CHAN | COMP_BT_COEXIST; - - - for (i = 0; i < DBGP_TYPE_MAX; i++) - rtlpriv->dbg.dbgp_type[i] = 0; - - /*Init Debug flag enable condition */ -} diff --git a/drivers/net/wireless/rtlwifi/debug.h b/drivers/net/wireless/rtlwifi/debug.h deleted file mode 100644 index 6d669364e3d9..000000000000 --- a/drivers/net/wireless/rtlwifi/debug.h +++ /dev/null @@ -1,244 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * Tmis 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. - * - * Tmis 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 - * tmis program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * Tme full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - *****************************************************************************/ - -#ifndef __RTL_DEBUG_H__ -#define __RTL_DEBUG_H__ - -/*-------------------------------------------------------------- - Debug level ---------------------------------------------------------------*/ -/* - *Fatal bug. - *For example, Tx/Rx/IO locked up, - *memory access violation, - *resource allocation failed, - *unexpected HW behavior, HW BUG - *and so on. - */ -#define DBG_EMERG 0 - -/* - *Abnormal, rare, or unexpeted cases. - *For example, Packet/IO Ctl canceled, - *device suprisely unremoved and so on. - */ -#define DBG_WARNING 2 - -/* - *Normal case driver developer should - *open, we can see link status like - *assoc/AddBA/DHCP/adapter start and - *so on basic and useful infromations. - */ -#define DBG_DMESG 3 - -/* - *Normal case with useful information - *about current SW or HW state. - *For example, Tx/Rx descriptor to fill, - *Tx/Rx descriptor completed status, - *SW protocol state change, dynamic - *mechanism state change and so on. - */ -#define DBG_LOUD 4 - -/* - *Normal case with detail execution - *flow or information. - */ -#define DBG_TRACE 5 - -/*-------------------------------------------------------------- - Define the rt_trace components ---------------------------------------------------------------*/ -#define COMP_ERR BIT(0) -#define COMP_FW BIT(1) -#define COMP_INIT BIT(2) /*For init/deinit */ -#define COMP_RECV BIT(3) /*For Rx. */ -#define COMP_SEND BIT(4) /*For Tx. */ -#define COMP_MLME BIT(5) /*For MLME. */ -#define COMP_SCAN BIT(6) /*For Scan. */ -#define COMP_INTR BIT(7) /*For interrupt Related. */ -#define COMP_LED BIT(8) /*For LED. */ -#define COMP_SEC BIT(9) /*For sec. */ -#define COMP_BEACON BIT(10) /*For beacon. */ -#define COMP_RATE BIT(11) /*For rate. */ -#define COMP_RXDESC BIT(12) /*For rx desc. */ -#define COMP_DIG BIT(13) /*For DIG */ -#define COMP_TXAGC BIT(14) /*For Tx power */ -#define COMP_HIPWR BIT(15) /*For High Power Mechanism */ -#define COMP_POWER BIT(16) /*For lps/ips/aspm. */ -#define COMP_POWER_TRACKING BIT(17) /*For TX POWER TRACKING */ -#define COMP_BB_POWERSAVING BIT(18) -#define COMP_SWAS BIT(19) /*For SW Antenna Switch */ -#define COMP_RF BIT(20) /*For RF. */ -#define COMP_TURBO BIT(21) /*For EDCA TURBO. */ -#define COMP_RATR BIT(22) -#define COMP_CMD BIT(23) -#define COMP_EFUSE BIT(24) -#define COMP_QOS BIT(25) -#define COMP_MAC80211 BIT(26) -#define COMP_REGD BIT(27) -#define COMP_CHAN BIT(28) -#define COMP_USB BIT(29) -#define COMP_EASY_CONCURRENT COMP_USB /* reuse of this bit is OK */ -#define COMP_BT_COEXIST BIT(30) - -/*-------------------------------------------------------------- - Define the rt_print components ---------------------------------------------------------------*/ -/* Define EEPROM and EFUSE check module bit*/ -#define EEPROM_W BIT(0) -#define EFUSE_PG BIT(1) -#define EFUSE_READ_ALL BIT(2) - -/* Define init check for module bit*/ -#define INIT_EEPROM BIT(0) -#define INIT_TXPOWER BIT(1) -#define INIT_IQK BIT(2) -#define INIT_RF BIT(3) - -/* Define PHY-BB/RF/MAC check module bit */ -#define PHY_BBR BIT(0) -#define PHY_BBW BIT(1) -#define PHY_RFR BIT(2) -#define PHY_RFW BIT(3) -#define PHY_MACR BIT(4) -#define PHY_MACW BIT(5) -#define PHY_ALLR BIT(6) -#define PHY_ALLW BIT(7) -#define PHY_TXPWR BIT(8) -#define PHY_PWRDIFF BIT(9) - -/* Define Dynamic Mechanism check module bit --> FDM */ -#define WA_IOT BIT(0) -#define DM_PWDB BIT(1) -#define DM_MONITOR BIT(2) -#define DM_DIG BIT(3) -#define DM_EDCA_TURBO BIT(4) - -#define DM_PWDB BIT(1) - -enum dbgp_flag_e { - FQOS = 0, - FTX = 1, - FRX = 2, - FSEC = 3, - FMGNT = 4, - FMLME = 5, - FRESOURCE = 6, - FBEACON = 7, - FISR = 8, - FPHY = 9, - FMP = 10, - FEEPROM = 11, - FPWR = 12, - FDM = 13, - FDBGCtrl = 14, - FC2H = 15, - FBT = 16, - FINIT = 17, - FIOCTL = 18, - DBGP_TYPE_MAX -}; - -#ifdef CONFIG_RTLWIFI_DEBUG - -#define RT_ASSERT(_exp, fmt, ...) \ -do { \ - if (!(_exp)) { \ - printk(KERN_DEBUG KBUILD_MODNAME ":%s(): " fmt, \ - __func__, ##__VA_ARGS__); \ - } \ -} while (0) - -#define RT_TRACE(rtlpriv, comp, level, fmt, ...) \ -do { \ - if (unlikely(((comp) & rtlpriv->dbg.global_debugcomponents) && \ - ((level) <= rtlpriv->dbg.global_debuglevel))) { \ - printk(KERN_DEBUG KBUILD_MODNAME ":%s():<%lx-%x> " fmt, \ - __func__, in_interrupt(), in_atomic(), \ - ##__VA_ARGS__); \ - } \ -} while (0) - -#define RTPRINT(rtlpriv, dbgtype, dbgflag, fmt, ...) \ -do { \ - if (unlikely(rtlpriv->dbg.dbgp_type[dbgtype] & dbgflag)) { \ - printk(KERN_DEBUG KBUILD_MODNAME ": " fmt, \ - ##__VA_ARGS__); \ - } \ -} while (0) - -#define RT_PRINT_DATA(rtlpriv, _comp, _level, _titlestring, _hexdata, \ - _hexdatalen) \ -do { \ - if (unlikely(((_comp) & rtlpriv->dbg.global_debugcomponents) && \ - (_level <= rtlpriv->dbg.global_debuglevel))) { \ - printk(KERN_DEBUG "%s: In process \"%s\" (pid %i): %s\n", \ - KBUILD_MODNAME, current->comm, current->pid, \ - _titlestring); \ - print_hex_dump_bytes("", DUMP_PREFIX_NONE, \ - _hexdata, _hexdatalen); \ - } \ -} while (0) - -#else - -struct rtl_priv; - -__printf(2, 3) -static inline void RT_ASSERT(int exp, const char *fmt, ...) -{ -} - -__printf(4, 5) -static inline void RT_TRACE(struct rtl_priv *rtlpriv, - int comp, int level, - const char *fmt, ...) -{ -} - -__printf(4, 5) -static inline void RTPRINT(struct rtl_priv *rtlpriv, - int dbgtype, int dbgflag, - const char *fmt, ...) -{ -} - -static inline void RT_PRINT_DATA(struct rtl_priv *rtlpriv, - int comp, int level, - const char *titlestring, - const void *hexdata, size_t hexdatalen) -{ -} - -#endif - -void rtl_dbgp_flag_init(struct ieee80211_hw *hw); -#endif diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c deleted file mode 100644 index 9e3894178e77..000000000000 --- a/drivers/net/wireless/rtlwifi/efuse.c +++ /dev/null @@ -1,1237 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * Tmis 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. - * - * Tmis 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 - * tmis program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * Tme full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include -#include "wifi.h" -#include "efuse.h" - -static const u8 MAX_PGPKT_SIZE = 9; -static const u8 PGPKT_DATA_SIZE = 8; -static const int EFUSE_MAX_SIZE = 512; - -static const struct efuse_map RTL8712_SDIO_EFUSE_TABLE[] = { - {0, 0, 0, 2}, - {0, 1, 0, 2}, - {0, 2, 0, 2}, - {1, 0, 0, 1}, - {1, 0, 1, 1}, - {1, 1, 0, 1}, - {1, 1, 1, 3}, - {1, 3, 0, 17}, - {3, 3, 1, 48}, - {10, 0, 0, 6}, - {10, 3, 0, 1}, - {10, 3, 1, 1}, - {11, 0, 0, 28} -}; - -static void efuse_shadow_read_1byte(struct ieee80211_hw *hw, u16 offset, - u8 *value); -static void efuse_shadow_read_2byte(struct ieee80211_hw *hw, u16 offset, - u16 *value); -static void efuse_shadow_read_4byte(struct ieee80211_hw *hw, u16 offset, - u32 *value); -static void efuse_shadow_write_1byte(struct ieee80211_hw *hw, u16 offset, - u8 value); -static void efuse_shadow_write_2byte(struct ieee80211_hw *hw, u16 offset, - u16 value); -static void efuse_shadow_write_4byte(struct ieee80211_hw *hw, u16 offset, - u32 value); -static int efuse_one_byte_read(struct ieee80211_hw *hw, u16 addr, - u8 *data); -static int efuse_one_byte_write(struct ieee80211_hw *hw, u16 addr, - u8 data); -static void efuse_read_all_map(struct ieee80211_hw *hw, u8 *efuse); -static int efuse_pg_packet_read(struct ieee80211_hw *hw, u8 offset, - u8 *data); -static int efuse_pg_packet_write(struct ieee80211_hw *hw, u8 offset, - u8 word_en, u8 *data); -static void efuse_word_enable_data_read(u8 word_en, u8 *sourdata, - u8 *targetdata); -static u8 efuse_word_enable_data_write(struct ieee80211_hw *hw, - u16 efuse_addr, u8 word_en, u8 *data); -static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, - u8 pwrstate); -static u16 efuse_get_current_size(struct ieee80211_hw *hw); -static u8 efuse_calculate_word_cnts(u8 word_en); - -void efuse_initialize(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 bytetemp; - u8 temp; - - bytetemp = rtl_read_byte(rtlpriv, rtlpriv->cfg->maps[SYS_FUNC_EN] + 1); - temp = bytetemp | 0x20; - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[SYS_FUNC_EN] + 1, temp); - - bytetemp = rtl_read_byte(rtlpriv, rtlpriv->cfg->maps[SYS_ISO_CTRL] + 1); - temp = bytetemp & 0xFE; - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[SYS_ISO_CTRL] + 1, temp); - - bytetemp = rtl_read_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_TEST] + 3); - temp = bytetemp | 0x80; - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_TEST] + 3, temp); - - rtl_write_byte(rtlpriv, 0x2F8, 0x3); - - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 3, 0x72); - -} - -u8 efuse_read_1byte(struct ieee80211_hw *hw, u16 address) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 data; - u8 bytetemp; - u8 temp; - u32 k = 0; - const u32 efuse_len = - rtlpriv->cfg->maps[EFUSE_REAL_CONTENT_SIZE]; - - if (address < efuse_len) { - temp = address & 0xFF; - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 1, - temp); - bytetemp = rtl_read_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_CTRL] + 2); - temp = ((address >> 8) & 0x03) | (bytetemp & 0xFC); - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 2, - temp); - - bytetemp = rtl_read_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_CTRL] + 3); - temp = bytetemp & 0x7F; - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 3, - temp); - - bytetemp = rtl_read_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_CTRL] + 3); - while (!(bytetemp & 0x80)) { - bytetemp = rtl_read_byte(rtlpriv, - rtlpriv->cfg-> - maps[EFUSE_CTRL] + 3); - k++; - if (k == 1000) { - k = 0; - break; - } - } - data = rtl_read_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL]); - return data; - } else - return 0xFF; - -} -EXPORT_SYMBOL(efuse_read_1byte); - -void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 bytetemp; - u8 temp; - u32 k = 0; - const u32 efuse_len = - rtlpriv->cfg->maps[EFUSE_REAL_CONTENT_SIZE]; - - RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, "Addr=%x Data =%x\n", - address, value); - - if (address < efuse_len) { - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL], value); - - temp = address & 0xFF; - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 1, - temp); - bytetemp = rtl_read_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_CTRL] + 2); - - temp = ((address >> 8) & 0x03) | (bytetemp & 0xFC); - rtl_write_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_CTRL] + 2, temp); - - bytetemp = rtl_read_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_CTRL] + 3); - temp = bytetemp | 0x80; - rtl_write_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_CTRL] + 3, temp); - - bytetemp = rtl_read_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_CTRL] + 3); - - while (bytetemp & 0x80) { - bytetemp = rtl_read_byte(rtlpriv, - rtlpriv->cfg-> - maps[EFUSE_CTRL] + 3); - k++; - if (k == 100) { - k = 0; - break; - } - } - } - -} - -void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 value32; - u8 readbyte; - u16 retry; - - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 1, - (_offset & 0xff)); - readbyte = rtl_read_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 2); - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 2, - ((_offset >> 8) & 0x03) | (readbyte & 0xfc)); - - readbyte = rtl_read_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 3); - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 3, - (readbyte & 0x7f)); - - retry = 0; - value32 = rtl_read_dword(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL]); - while (!(((value32 >> 24) & 0xff) & 0x80) && (retry < 10000)) { - value32 = rtl_read_dword(rtlpriv, - rtlpriv->cfg->maps[EFUSE_CTRL]); - retry++; - } - - udelay(50); - value32 = rtl_read_dword(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL]); - - *pbuf = (u8) (value32 & 0xff); -} - -void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 *efuse_tbl; - u8 rtemp8[1]; - u16 efuse_addr = 0; - u8 offset, wren; - u8 u1temp = 0; - u16 i; - u16 j; - const u16 efuse_max_section = - rtlpriv->cfg->maps[EFUSE_MAX_SECTION_MAP]; - const u32 efuse_len = - rtlpriv->cfg->maps[EFUSE_REAL_CONTENT_SIZE]; - u16 **efuse_word; - u16 efuse_utilized = 0; - u8 efuse_usage; - - if ((_offset + _size_byte) > rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]) { - RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, - "read_efuse(): Invalid offset(%#x) with read bytes(%#x)!!\n", - _offset, _size_byte); - return; - } - - /* allocate memory for efuse_tbl and efuse_word */ - efuse_tbl = kmalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE] * - sizeof(u8), GFP_ATOMIC); - if (!efuse_tbl) - return; - efuse_word = kmalloc(EFUSE_MAX_WORD_UNIT * sizeof(u16 *), GFP_ATOMIC); - if (!efuse_word) - goto done; - for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) { - efuse_word[i] = kmalloc(efuse_max_section * sizeof(u16), - GFP_ATOMIC); - if (!efuse_word[i]) - goto done; - } - - for (i = 0; i < efuse_max_section; i++) - for (j = 0; j < EFUSE_MAX_WORD_UNIT; j++) - efuse_word[j][i] = 0xFFFF; - - read_efuse_byte(hw, efuse_addr, rtemp8); - if (*rtemp8 != 0xFF) { - efuse_utilized++; - RTPRINT(rtlpriv, FEEPROM, EFUSE_READ_ALL, - "Addr=%d\n", efuse_addr); - efuse_addr++; - } - - while ((*rtemp8 != 0xFF) && (efuse_addr < efuse_len)) { - /* Check PG header for section num. */ - if ((*rtemp8 & 0x1F) == 0x0F) {/* extended header */ - u1temp = ((*rtemp8 & 0xE0) >> 5); - read_efuse_byte(hw, efuse_addr, rtemp8); - - if ((*rtemp8 & 0x0F) == 0x0F) { - efuse_addr++; - read_efuse_byte(hw, efuse_addr, rtemp8); - - if (*rtemp8 != 0xFF && - (efuse_addr < efuse_len)) { - efuse_addr++; - } - continue; - } else { - offset = ((*rtemp8 & 0xF0) >> 1) | u1temp; - wren = (*rtemp8 & 0x0F); - efuse_addr++; - } - } else { - offset = ((*rtemp8 >> 4) & 0x0f); - wren = (*rtemp8 & 0x0f); - } - - if (offset < efuse_max_section) { - RTPRINT(rtlpriv, FEEPROM, EFUSE_READ_ALL, - "offset-%d Worden=%x\n", offset, wren); - - for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) { - if (!(wren & 0x01)) { - RTPRINT(rtlpriv, FEEPROM, - EFUSE_READ_ALL, - "Addr=%d\n", efuse_addr); - - read_efuse_byte(hw, efuse_addr, rtemp8); - efuse_addr++; - efuse_utilized++; - efuse_word[i][offset] = - (*rtemp8 & 0xff); - - if (efuse_addr >= efuse_len) - break; - - RTPRINT(rtlpriv, FEEPROM, - EFUSE_READ_ALL, - "Addr=%d\n", efuse_addr); - - read_efuse_byte(hw, efuse_addr, rtemp8); - efuse_addr++; - efuse_utilized++; - efuse_word[i][offset] |= - (((u16)*rtemp8 << 8) & 0xff00); - - if (efuse_addr >= efuse_len) - break; - } - - wren >>= 1; - } - } - - RTPRINT(rtlpriv, FEEPROM, EFUSE_READ_ALL, - "Addr=%d\n", efuse_addr); - read_efuse_byte(hw, efuse_addr, rtemp8); - if (*rtemp8 != 0xFF && (efuse_addr < efuse_len)) { - efuse_utilized++; - efuse_addr++; - } - } - - for (i = 0; i < efuse_max_section; i++) { - for (j = 0; j < EFUSE_MAX_WORD_UNIT; j++) { - efuse_tbl[(i * 8) + (j * 2)] = - (efuse_word[j][i] & 0xff); - efuse_tbl[(i * 8) + ((j * 2) + 1)] = - ((efuse_word[j][i] >> 8) & 0xff); - } - } - - for (i = 0; i < _size_byte; i++) - pbuf[i] = efuse_tbl[_offset + i]; - - rtlefuse->efuse_usedbytes = efuse_utilized; - efuse_usage = (u8) ((efuse_utilized * 100) / efuse_len); - rtlefuse->efuse_usedpercentage = efuse_usage; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_EFUSE_BYTES, - (u8 *)&efuse_utilized); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_EFUSE_USAGE, - &efuse_usage); -done: - for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) - kfree(efuse_word[i]); - kfree(efuse_word); - kfree(efuse_tbl); -} - -bool efuse_shadow_update_chk(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 section_idx, i, Base; - u16 words_need = 0, hdr_num = 0, totalbytes, efuse_used; - bool wordchanged, result = true; - - for (section_idx = 0; section_idx < 16; section_idx++) { - Base = section_idx * 8; - wordchanged = false; - - for (i = 0; i < 8; i = i + 2) { - if ((rtlefuse->efuse_map[EFUSE_INIT_MAP][Base + i] != - rtlefuse->efuse_map[EFUSE_MODIFY_MAP][Base + i]) || - (rtlefuse->efuse_map[EFUSE_INIT_MAP][Base + i + 1] != - rtlefuse->efuse_map[EFUSE_MODIFY_MAP][Base + i + - 1])) { - words_need++; - wordchanged = true; - } - } - - if (wordchanged) - hdr_num++; - } - - totalbytes = hdr_num + words_need * 2; - efuse_used = rtlefuse->efuse_usedbytes; - - if ((totalbytes + efuse_used) >= - (EFUSE_MAX_SIZE - - rtlpriv->cfg->maps[EFUSE_OOB_PROTECT_BYTES_LEN])) - result = false; - - RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, - "efuse_shadow_update_chk(): totalbytes(%#x), hdr_num(%#x), words_need(%#x), efuse_used(%d)\n", - totalbytes, hdr_num, words_need, efuse_used); - - return result; -} - -void efuse_shadow_read(struct ieee80211_hw *hw, u8 type, - u16 offset, u32 *value) -{ - if (type == 1) - efuse_shadow_read_1byte(hw, offset, (u8 *) value); - else if (type == 2) - efuse_shadow_read_2byte(hw, offset, (u16 *) value); - else if (type == 4) - efuse_shadow_read_4byte(hw, offset, value); - -} - -void efuse_shadow_write(struct ieee80211_hw *hw, u8 type, u16 offset, - u32 value) -{ - if (type == 1) - efuse_shadow_write_1byte(hw, offset, (u8) value); - else if (type == 2) - efuse_shadow_write_2byte(hw, offset, (u16) value); - else if (type == 4) - efuse_shadow_write_4byte(hw, offset, value); - -} - -bool efuse_shadow_update(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u16 i, offset, base; - u8 word_en = 0x0F; - u8 first_pg = false; - - RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, "--->\n"); - - if (!efuse_shadow_update_chk(hw)) { - efuse_read_all_map(hw, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0]); - memcpy(&rtlefuse->efuse_map[EFUSE_MODIFY_MAP][0], - &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], - rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]); - - RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, - "<---efuse out of capacity!!\n"); - return false; - } - efuse_power_switch(hw, true, true); - - for (offset = 0; offset < 16; offset++) { - - word_en = 0x0F; - base = offset * 8; - - for (i = 0; i < 8; i++) { - if (first_pg) { - - word_en &= ~(BIT(i / 2)); - - rtlefuse->efuse_map[EFUSE_INIT_MAP][base + i] = - rtlefuse->efuse_map[EFUSE_MODIFY_MAP][base + i]; - } else { - - if (rtlefuse->efuse_map[EFUSE_INIT_MAP][base + i] != - rtlefuse->efuse_map[EFUSE_MODIFY_MAP][base + i]) { - word_en &= ~(BIT(i / 2)); - - rtlefuse->efuse_map[EFUSE_INIT_MAP][base + i] = - rtlefuse->efuse_map[EFUSE_MODIFY_MAP][base + i]; - } - } - } - - if (word_en != 0x0F) { - u8 tmpdata[8]; - memcpy(tmpdata, - &rtlefuse->efuse_map[EFUSE_MODIFY_MAP][base], - 8); - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_LOUD, - "U-efuse", tmpdata, 8); - - if (!efuse_pg_packet_write(hw, (u8) offset, word_en, - tmpdata)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "PG section(%#x) fail!!\n", offset); - break; - } - } - - } - - efuse_power_switch(hw, true, false); - efuse_read_all_map(hw, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0]); - - memcpy(&rtlefuse->efuse_map[EFUSE_MODIFY_MAP][0], - &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], - rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]); - - RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, "<---\n"); - return true; -} - -void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - - if (rtlefuse->autoload_failflag) - memset(&rtlefuse->efuse_map[EFUSE_INIT_MAP][0], 0xFF, - rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]); - else - efuse_read_all_map(hw, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0]); - - memcpy(&rtlefuse->efuse_map[EFUSE_MODIFY_MAP][0], - &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], - rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]); - -} -EXPORT_SYMBOL(rtl_efuse_shadow_map_update); - -void efuse_force_write_vendor_Id(struct ieee80211_hw *hw) -{ - u8 tmpdata[8] = { 0xFF, 0xFF, 0xEC, 0x10, 0xFF, 0xFF, 0xFF, 0xFF }; - - efuse_power_switch(hw, true, true); - - efuse_pg_packet_write(hw, 1, 0xD, tmpdata); - - efuse_power_switch(hw, true, false); - -} - -void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx) -{ -} - -static void efuse_shadow_read_1byte(struct ieee80211_hw *hw, - u16 offset, u8 *value) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - *value = rtlefuse->efuse_map[EFUSE_MODIFY_MAP][offset]; -} - -static void efuse_shadow_read_2byte(struct ieee80211_hw *hw, - u16 offset, u16 *value) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - - *value = rtlefuse->efuse_map[EFUSE_MODIFY_MAP][offset]; - *value |= rtlefuse->efuse_map[EFUSE_MODIFY_MAP][offset + 1] << 8; - -} - -static void efuse_shadow_read_4byte(struct ieee80211_hw *hw, - u16 offset, u32 *value) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - - *value = rtlefuse->efuse_map[EFUSE_MODIFY_MAP][offset]; - *value |= rtlefuse->efuse_map[EFUSE_MODIFY_MAP][offset + 1] << 8; - *value |= rtlefuse->efuse_map[EFUSE_MODIFY_MAP][offset + 2] << 16; - *value |= rtlefuse->efuse_map[EFUSE_MODIFY_MAP][offset + 3] << 24; -} - -static void efuse_shadow_write_1byte(struct ieee80211_hw *hw, - u16 offset, u8 value) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - - rtlefuse->efuse_map[EFUSE_MODIFY_MAP][offset] = value; -} - -static void efuse_shadow_write_2byte(struct ieee80211_hw *hw, - u16 offset, u16 value) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - - rtlefuse->efuse_map[EFUSE_MODIFY_MAP][offset] = value & 0x00FF; - rtlefuse->efuse_map[EFUSE_MODIFY_MAP][offset + 1] = value >> 8; - -} - -static void efuse_shadow_write_4byte(struct ieee80211_hw *hw, - u16 offset, u32 value) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - - rtlefuse->efuse_map[EFUSE_MODIFY_MAP][offset] = - (u8) (value & 0x000000FF); - rtlefuse->efuse_map[EFUSE_MODIFY_MAP][offset + 1] = - (u8) ((value >> 8) & 0x0000FF); - rtlefuse->efuse_map[EFUSE_MODIFY_MAP][offset + 2] = - (u8) ((value >> 16) & 0x00FF); - rtlefuse->efuse_map[EFUSE_MODIFY_MAP][offset + 3] = - (u8) ((value >> 24) & 0xFF); - -} - -static int efuse_one_byte_read(struct ieee80211_hw *hw, u16 addr, u8 *data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmpidx = 0; - int result; - - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 1, - (u8) (addr & 0xff)); - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 2, - ((u8) ((addr >> 8) & 0x03)) | - (rtl_read_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_CTRL] + 2) & - 0xFC)); - - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 3, 0x72); - - while (!(0x80 & rtl_read_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_CTRL] + 3)) - && (tmpidx < 100)) { - tmpidx++; - } - - if (tmpidx < 100) { - *data = rtl_read_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL]); - result = true; - } else { - *data = 0xff; - result = false; - } - return result; -} - -static int efuse_one_byte_write(struct ieee80211_hw *hw, u16 addr, u8 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmpidx = 0; - - RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, "Addr = %x Data=%x\n", - addr, data); - - rtl_write_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_CTRL] + 1, (u8) (addr & 0xff)); - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 2, - (rtl_read_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_CTRL] + - 2) & 0xFC) | (u8) ((addr >> 8) & 0x03)); - - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL], data); - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL] + 3, 0xF2); - - while ((0x80 & rtl_read_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_CTRL] + 3)) - && (tmpidx < 100)) { - tmpidx++; - } - - if (tmpidx < 100) - return true; - - return false; -} - -static void efuse_read_all_map(struct ieee80211_hw *hw, u8 * efuse) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - efuse_power_switch(hw, false, true); - read_efuse(hw, 0, rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE], efuse); - efuse_power_switch(hw, false, false); -} - -static void efuse_read_data_case1(struct ieee80211_hw *hw, u16 *efuse_addr, - u8 efuse_data, u8 offset, u8 *tmpdata, - u8 *readstate) -{ - bool dataempty = true; - u8 hoffset; - u8 tmpidx; - u8 hworden; - u8 word_cnts; - - hoffset = (efuse_data >> 4) & 0x0F; - hworden = efuse_data & 0x0F; - word_cnts = efuse_calculate_word_cnts(hworden); - - if (hoffset == offset) { - for (tmpidx = 0; tmpidx < word_cnts * 2; tmpidx++) { - if (efuse_one_byte_read(hw, *efuse_addr + 1 + tmpidx, - &efuse_data)) { - tmpdata[tmpidx] = efuse_data; - if (efuse_data != 0xff) - dataempty = true; - } - } - - if (dataempty) { - *readstate = PG_STATE_DATA; - } else { - *efuse_addr = *efuse_addr + (word_cnts * 2) + 1; - *readstate = PG_STATE_HEADER; - } - - } else { - *efuse_addr = *efuse_addr + (word_cnts * 2) + 1; - *readstate = PG_STATE_HEADER; - } -} - -static int efuse_pg_packet_read(struct ieee80211_hw *hw, u8 offset, u8 *data) -{ - u8 readstate = PG_STATE_HEADER; - bool continual = true; - u8 efuse_data, word_cnts = 0; - u16 efuse_addr = 0; - u8 tmpdata[8]; - - if (data == NULL) - return false; - if (offset > 15) - return false; - - memset(data, 0xff, PGPKT_DATA_SIZE * sizeof(u8)); - memset(tmpdata, 0xff, PGPKT_DATA_SIZE * sizeof(u8)); - - while (continual && (efuse_addr < EFUSE_MAX_SIZE)) { - if (readstate & PG_STATE_HEADER) { - if (efuse_one_byte_read(hw, efuse_addr, &efuse_data) - && (efuse_data != 0xFF)) - efuse_read_data_case1(hw, &efuse_addr, - efuse_data, - offset, tmpdata, - &readstate); - else - continual = false; - } else if (readstate & PG_STATE_DATA) { - efuse_word_enable_data_read(0, tmpdata, data); - efuse_addr = efuse_addr + (word_cnts * 2) + 1; - readstate = PG_STATE_HEADER; - } - - } - - if ((data[0] == 0xff) && (data[1] == 0xff) && - (data[2] == 0xff) && (data[3] == 0xff) && - (data[4] == 0xff) && (data[5] == 0xff) && - (data[6] == 0xff) && (data[7] == 0xff)) - return false; - else - return true; - -} - -static void efuse_write_data_case1(struct ieee80211_hw *hw, u16 *efuse_addr, - u8 efuse_data, u8 offset, int *continual, - u8 *write_state, struct pgpkt_struct *target_pkt, - int *repeat_times, int *result, u8 word_en) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct pgpkt_struct tmp_pkt; - bool dataempty = true; - u8 originaldata[8 * sizeof(u8)]; - u8 badworden = 0x0F; - u8 match_word_en, tmp_word_en; - u8 tmpindex; - u8 tmp_header = efuse_data; - u8 tmp_word_cnts; - - tmp_pkt.offset = (tmp_header >> 4) & 0x0F; - tmp_pkt.word_en = tmp_header & 0x0F; - tmp_word_cnts = efuse_calculate_word_cnts(tmp_pkt.word_en); - - if (tmp_pkt.offset != target_pkt->offset) { - *efuse_addr = *efuse_addr + (tmp_word_cnts * 2) + 1; - *write_state = PG_STATE_HEADER; - } else { - for (tmpindex = 0; tmpindex < (tmp_word_cnts * 2); tmpindex++) { - u16 address = *efuse_addr + 1 + tmpindex; - if (efuse_one_byte_read(hw, address, - &efuse_data) && (efuse_data != 0xFF)) - dataempty = false; - } - - if (!dataempty) { - *efuse_addr = *efuse_addr + (tmp_word_cnts * 2) + 1; - *write_state = PG_STATE_HEADER; - } else { - match_word_en = 0x0F; - if (!((target_pkt->word_en & BIT(0)) | - (tmp_pkt.word_en & BIT(0)))) - match_word_en &= (~BIT(0)); - - if (!((target_pkt->word_en & BIT(1)) | - (tmp_pkt.word_en & BIT(1)))) - match_word_en &= (~BIT(1)); - - if (!((target_pkt->word_en & BIT(2)) | - (tmp_pkt.word_en & BIT(2)))) - match_word_en &= (~BIT(2)); - - if (!((target_pkt->word_en & BIT(3)) | - (tmp_pkt.word_en & BIT(3)))) - match_word_en &= (~BIT(3)); - - if ((match_word_en & 0x0F) != 0x0F) { - badworden = efuse_word_enable_data_write( - hw, *efuse_addr + 1, - tmp_pkt.word_en, - target_pkt->data); - - if (0x0F != (badworden & 0x0F)) { - u8 reorg_offset = offset; - u8 reorg_worden = badworden; - efuse_pg_packet_write(hw, reorg_offset, - reorg_worden, - originaldata); - } - - tmp_word_en = 0x0F; - if ((target_pkt->word_en & BIT(0)) ^ - (match_word_en & BIT(0))) - tmp_word_en &= (~BIT(0)); - - if ((target_pkt->word_en & BIT(1)) ^ - (match_word_en & BIT(1))) - tmp_word_en &= (~BIT(1)); - - if ((target_pkt->word_en & BIT(2)) ^ - (match_word_en & BIT(2))) - tmp_word_en &= (~BIT(2)); - - if ((target_pkt->word_en & BIT(3)) ^ - (match_word_en & BIT(3))) - tmp_word_en &= (~BIT(3)); - - if ((tmp_word_en & 0x0F) != 0x0F) { - *efuse_addr = efuse_get_current_size(hw); - target_pkt->offset = offset; - target_pkt->word_en = tmp_word_en; - } else { - *continual = false; - } - *write_state = PG_STATE_HEADER; - *repeat_times += 1; - if (*repeat_times > EFUSE_REPEAT_THRESHOLD_) { - *continual = false; - *result = false; - } - } else { - *efuse_addr += (2 * tmp_word_cnts) + 1; - target_pkt->offset = offset; - target_pkt->word_en = word_en; - *write_state = PG_STATE_HEADER; - } - } - } - RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, "efuse PG_STATE_HEADER-1\n"); -} - -static void efuse_write_data_case2(struct ieee80211_hw *hw, u16 *efuse_addr, - int *continual, u8 *write_state, - struct pgpkt_struct target_pkt, - int *repeat_times, int *result) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct pgpkt_struct tmp_pkt; - u8 pg_header; - u8 tmp_header; - u8 originaldata[8 * sizeof(u8)]; - u8 tmp_word_cnts; - u8 badworden = 0x0F; - - pg_header = ((target_pkt.offset << 4) & 0xf0) | target_pkt.word_en; - efuse_one_byte_write(hw, *efuse_addr, pg_header); - efuse_one_byte_read(hw, *efuse_addr, &tmp_header); - - if (tmp_header == pg_header) { - *write_state = PG_STATE_DATA; - } else if (tmp_header == 0xFF) { - *write_state = PG_STATE_HEADER; - *repeat_times += 1; - if (*repeat_times > EFUSE_REPEAT_THRESHOLD_) { - *continual = false; - *result = false; - } - } else { - tmp_pkt.offset = (tmp_header >> 4) & 0x0F; - tmp_pkt.word_en = tmp_header & 0x0F; - - tmp_word_cnts = efuse_calculate_word_cnts(tmp_pkt.word_en); - - memset(originaldata, 0xff, 8 * sizeof(u8)); - - if (efuse_pg_packet_read(hw, tmp_pkt.offset, originaldata)) { - badworden = efuse_word_enable_data_write(hw, - *efuse_addr + 1, tmp_pkt.word_en, - originaldata); - - if (0x0F != (badworden & 0x0F)) { - u8 reorg_offset = tmp_pkt.offset; - u8 reorg_worden = badworden; - efuse_pg_packet_write(hw, reorg_offset, - reorg_worden, - originaldata); - *efuse_addr = efuse_get_current_size(hw); - } else { - *efuse_addr = *efuse_addr + (tmp_word_cnts * 2) - + 1; - } - } else { - *efuse_addr = *efuse_addr + (tmp_word_cnts * 2) + 1; - } - - *write_state = PG_STATE_HEADER; - *repeat_times += 1; - if (*repeat_times > EFUSE_REPEAT_THRESHOLD_) { - *continual = false; - *result = false; - } - - RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, - "efuse PG_STATE_HEADER-2\n"); - } -} - -static int efuse_pg_packet_write(struct ieee80211_hw *hw, - u8 offset, u8 word_en, u8 *data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct pgpkt_struct target_pkt; - u8 write_state = PG_STATE_HEADER; - int continual = true, result = true; - u16 efuse_addr = 0; - u8 efuse_data; - u8 target_word_cnts = 0; - u8 badworden = 0x0F; - static int repeat_times; - - if (efuse_get_current_size(hw) >= (EFUSE_MAX_SIZE - - rtlpriv->cfg->maps[EFUSE_OOB_PROTECT_BYTES_LEN])) { - RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, - "efuse_pg_packet_write error\n"); - return false; - } - - target_pkt.offset = offset; - target_pkt.word_en = word_en; - - memset(target_pkt.data, 0xFF, 8 * sizeof(u8)); - - efuse_word_enable_data_read(word_en, data, target_pkt.data); - target_word_cnts = efuse_calculate_word_cnts(target_pkt.word_en); - - RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, "efuse Power ON\n"); - - while (continual && (efuse_addr < (EFUSE_MAX_SIZE - - rtlpriv->cfg->maps[EFUSE_OOB_PROTECT_BYTES_LEN]))) { - - if (write_state == PG_STATE_HEADER) { - badworden = 0x0F; - RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, - "efuse PG_STATE_HEADER\n"); - - if (efuse_one_byte_read(hw, efuse_addr, &efuse_data) && - (efuse_data != 0xFF)) - efuse_write_data_case1(hw, &efuse_addr, - efuse_data, offset, - &continual, - &write_state, &target_pkt, - &repeat_times, &result, - word_en); - else - efuse_write_data_case2(hw, &efuse_addr, - &continual, - &write_state, - target_pkt, - &repeat_times, - &result); - - } else if (write_state == PG_STATE_DATA) { - RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, - "efuse PG_STATE_DATA\n"); - badworden = - efuse_word_enable_data_write(hw, efuse_addr + 1, - target_pkt.word_en, - target_pkt.data); - - if ((badworden & 0x0F) == 0x0F) { - continual = false; - } else { - efuse_addr += (2 * target_word_cnts) + 1; - - target_pkt.offset = offset; - target_pkt.word_en = badworden; - target_word_cnts = - efuse_calculate_word_cnts(target_pkt. - word_en); - write_state = PG_STATE_HEADER; - repeat_times++; - if (repeat_times > EFUSE_REPEAT_THRESHOLD_) { - continual = false; - result = false; - } - RTPRINT(rtlpriv, FEEPROM, EFUSE_PG, - "efuse PG_STATE_HEADER-3\n"); - } - } - } - - if (efuse_addr >= (EFUSE_MAX_SIZE - - rtlpriv->cfg->maps[EFUSE_OOB_PROTECT_BYTES_LEN])) { - RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, - "efuse_addr(%#x) Out of size!!\n", efuse_addr); - } - - return true; -} - -static void efuse_word_enable_data_read(u8 word_en, - u8 *sourdata, 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]; - } -} - -static u8 efuse_word_enable_data_write(struct ieee80211_hw *hw, - u16 efuse_addr, u8 word_en, u8 *data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u16 tmpaddr; - u16 start_addr = efuse_addr; - u8 badworden = 0x0F; - u8 tmpdata[8]; - - memset(tmpdata, 0xff, PGPKT_DATA_SIZE); - RT_TRACE(rtlpriv, COMP_EFUSE, DBG_LOUD, "word_en = %x efuse_addr=%x\n", - word_en, efuse_addr); - - if (!(word_en & BIT(0))) { - tmpaddr = start_addr; - efuse_one_byte_write(hw, start_addr++, data[0]); - efuse_one_byte_write(hw, start_addr++, data[1]); - - efuse_one_byte_read(hw, tmpaddr, &tmpdata[0]); - efuse_one_byte_read(hw, tmpaddr + 1, &tmpdata[1]); - if ((data[0] != tmpdata[0]) || (data[1] != tmpdata[1])) - badworden &= (~BIT(0)); - } - - if (!(word_en & BIT(1))) { - tmpaddr = start_addr; - efuse_one_byte_write(hw, start_addr++, data[2]); - efuse_one_byte_write(hw, start_addr++, data[3]); - - efuse_one_byte_read(hw, tmpaddr, &tmpdata[2]); - efuse_one_byte_read(hw, tmpaddr + 1, &tmpdata[3]); - if ((data[2] != tmpdata[2]) || (data[3] != tmpdata[3])) - badworden &= (~BIT(1)); - } - - if (!(word_en & BIT(2))) { - tmpaddr = start_addr; - efuse_one_byte_write(hw, start_addr++, data[4]); - efuse_one_byte_write(hw, start_addr++, data[5]); - - efuse_one_byte_read(hw, tmpaddr, &tmpdata[4]); - efuse_one_byte_read(hw, tmpaddr + 1, &tmpdata[5]); - if ((data[4] != tmpdata[4]) || (data[5] != tmpdata[5])) - badworden &= (~BIT(2)); - } - - if (!(word_en & BIT(3))) { - tmpaddr = start_addr; - efuse_one_byte_write(hw, start_addr++, data[6]); - efuse_one_byte_write(hw, start_addr++, data[7]); - - efuse_one_byte_read(hw, tmpaddr, &tmpdata[6]); - efuse_one_byte_read(hw, tmpaddr + 1, &tmpdata[7]); - if ((data[6] != tmpdata[6]) || (data[7] != tmpdata[7])) - badworden &= (~BIT(3)); - } - - return badworden; -} - -static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 tempval; - u16 tmpV16; - - if (pwrstate && (rtlhal->hw_type != HARDWARE_TYPE_RTL8192SE)) { - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8188EE) - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_ACCESS], - 0x69); - - tmpV16 = rtl_read_word(rtlpriv, - rtlpriv->cfg->maps[SYS_ISO_CTRL]); - if (!(tmpV16 & rtlpriv->cfg->maps[EFUSE_PWC_EV12V])) { - tmpV16 |= rtlpriv->cfg->maps[EFUSE_PWC_EV12V]; - rtl_write_word(rtlpriv, - rtlpriv->cfg->maps[SYS_ISO_CTRL], - tmpV16); - } - - tmpV16 = rtl_read_word(rtlpriv, - rtlpriv->cfg->maps[SYS_FUNC_EN]); - if (!(tmpV16 & rtlpriv->cfg->maps[EFUSE_FEN_ELDR])) { - tmpV16 |= rtlpriv->cfg->maps[EFUSE_FEN_ELDR]; - rtl_write_word(rtlpriv, - rtlpriv->cfg->maps[SYS_FUNC_EN], tmpV16); - } - - tmpV16 = rtl_read_word(rtlpriv, rtlpriv->cfg->maps[SYS_CLK]); - if ((!(tmpV16 & rtlpriv->cfg->maps[EFUSE_LOADER_CLK_EN])) || - (!(tmpV16 & rtlpriv->cfg->maps[EFUSE_ANA8M]))) { - tmpV16 |= (rtlpriv->cfg->maps[EFUSE_LOADER_CLK_EN] | - rtlpriv->cfg->maps[EFUSE_ANA8M]); - rtl_write_word(rtlpriv, - rtlpriv->cfg->maps[SYS_CLK], tmpV16); - } - } - - if (pwrstate) { - if (write) { - tempval = rtl_read_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_TEST] + - 3); - - if (rtlhal->hw_type != HARDWARE_TYPE_RTL8192SE) { - tempval &= 0x0F; - tempval |= (VOLTAGE_V25 << 4); - } - - rtl_write_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_TEST] + 3, - (tempval | 0x80)); - } - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) { - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CLK], - 0x03); - } - - } else { - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8188EE) - rtl_write_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_ACCESS], 0); - - if (write) { - tempval = rtl_read_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_TEST] + - 3); - rtl_write_byte(rtlpriv, - rtlpriv->cfg->maps[EFUSE_TEST] + 3, - (tempval & 0x7F)); - } - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) { - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CLK], - 0x02); - } - - } - -} - -static u16 efuse_get_current_size(struct ieee80211_hw *hw) -{ - int continual = true; - u16 efuse_addr = 0; - u8 hworden; - u8 efuse_data, word_cnts; - - while (continual && efuse_one_byte_read(hw, efuse_addr, &efuse_data) - && (efuse_addr < EFUSE_MAX_SIZE)) { - if (efuse_data != 0xFF) { - hworden = efuse_data & 0x0F; - word_cnts = efuse_calculate_word_cnts(hworden); - efuse_addr = efuse_addr + (word_cnts * 2) + 1; - } else { - continual = false; - } - } - - return efuse_addr; -} - -static u8 efuse_calculate_word_cnts(u8 word_en) -{ - u8 word_cnts = 0; - if (!(word_en & BIT(0))) - word_cnts++; - if (!(word_en & BIT(1))) - word_cnts++; - if (!(word_en & BIT(2))) - word_cnts++; - if (!(word_en & BIT(3))) - word_cnts++; - return word_cnts; -} - diff --git a/drivers/net/wireless/rtlwifi/efuse.h b/drivers/net/wireless/rtlwifi/efuse.h deleted file mode 100644 index 395a326acfb4..000000000000 --- a/drivers/net/wireless/rtlwifi/efuse.h +++ /dev/null @@ -1,123 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL_EFUSE_H_ -#define __RTL_EFUSE_H_ - -#define EFUSE_IC_ID_OFFSET 506 - -#define EFUSE_MAP_LEN 128 -#define EFUSE_MAX_WORD_UNIT 4 - -#define EFUSE_INIT_MAP 0 -#define EFUSE_MODIFY_MAP 1 - -#define PG_STATE_HEADER 0x01 -#define PG_STATE_WORD_0 0x02 -#define PG_STATE_WORD_1 0x04 -#define PG_STATE_WORD_2 0x08 -#define PG_STATE_WORD_3 0x10 -#define PG_STATE_DATA 0x20 - -#define PG_SWBYTE_H 0x01 -#define PG_SWBYTE_L 0x02 - -#define _POWERON_DELAY_ -#define _PRE_EXECUTE_READ_CMD_ - -#define EFUSE_REPEAT_THRESHOLD_ 3 -#define EFUSE_ERROE_HANDLE 1 - -struct efuse_map { - u8 offset; - u8 word_start; - u8 byte_start; - u8 byte_cnts; -}; - -struct pgpkt_struct { - u8 offset; - u8 word_en; - u8 data[8]; -}; - -enum efuse_data_item { - EFUSE_CHIP_ID = 0, - EFUSE_LDO_SETTING, - EFUSE_CLK_SETTING, - EFUSE_SDIO_SETTING, - EFUSE_CCCR, - EFUSE_SDIO_MODE, - EFUSE_OCR, - EFUSE_F0CIS, - EFUSE_F1CIS, - EFUSE_MAC_ADDR, - EFUSE_EEPROM_VER, - EFUSE_CHAN_PLAN, - EFUSE_TXPW_TAB -}; - -enum { - VOLTAGE_V25 = 0x03, - LDOE25_SHIFT = 28, -}; - -struct efuse_priv { - u8 id[2]; - u8 ldo_setting[2]; - u8 clk_setting[2]; - u8 cccr; - u8 sdio_mode; - u8 ocr[3]; - u8 cis0[17]; - u8 cis1[48]; - u8 mac_addr[6]; - u8 eeprom_verno; - u8 channel_plan; - u8 tx_power_b[14]; - u8 tx_power_g[14]; -}; - -extern void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf); -extern void efuse_initialize(struct ieee80211_hw *hw); -extern u8 efuse_read_1byte(struct ieee80211_hw *hw, u16 address); -extern void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value); -extern void read_efuse(struct ieee80211_hw *hw, u16 _offset, - u16 _size_byte, u8 *pbuf); -extern void efuse_shadow_read(struct ieee80211_hw *hw, u8 type, - u16 offset, u32 *value); -extern void efuse_shadow_write(struct ieee80211_hw *hw, u8 type, - u16 offset, u32 value); -extern bool efuse_shadow_update(struct ieee80211_hw *hw); -extern bool efuse_shadow_update_chk(struct ieee80211_hw *hw); -extern void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw); -extern void efuse_force_write_vendor_Id(struct ieee80211_hw *hw); -extern void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx); - -#endif diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c deleted file mode 100644 index ee6a62616c72..000000000000 --- a/drivers/net/wireless/rtlwifi/pci.c +++ /dev/null @@ -1,2122 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "wifi.h" -#include "core.h" -#include "pci.h" -#include "base.h" -#include "ps.h" -#include "efuse.h" -#include -#include - -static const u16 pcibridge_vendors[PCI_BRIDGE_VENDOR_MAX] = { - PCI_VENDOR_ID_INTEL, - PCI_VENDOR_ID_ATI, - PCI_VENDOR_ID_AMD, - PCI_VENDOR_ID_SI -}; - -static const u8 ac_to_hwq[] = { - VO_QUEUE, - VI_QUEUE, - BE_QUEUE, - BK_QUEUE -}; - -static u8 _rtl_mac_to_hwqueue(struct ieee80211_hw *hw, - struct sk_buff *skb) -{ - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - __le16 fc = rtl_get_fc(skb); - u8 queue_index = skb_get_queue_mapping(skb); - - if (unlikely(ieee80211_is_beacon(fc))) - return BEACON_QUEUE; - if (ieee80211_is_mgmt(fc) || ieee80211_is_ctl(fc)) - return MGNT_QUEUE; - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) - if (ieee80211_is_nullfunc(fc)) - return HIGH_QUEUE; - - return ac_to_hwq[queue_index]; -} - -/* Update PCI dependent default settings*/ -static void _rtl_pci_update_default_setting(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u8 pcibridge_vendor = pcipriv->ndis_adapter.pcibridge_vendor; - u8 init_aspm; - - ppsc->reg_rfps_level = 0; - ppsc->support_aspm = false; - - /*Update PCI ASPM setting */ - ppsc->const_amdpci_aspm = rtlpci->const_amdpci_aspm; - switch (rtlpci->const_pci_aspm) { - case 0: - /*No ASPM */ - break; - - case 1: - /*ASPM dynamically enabled/disable. */ - ppsc->reg_rfps_level |= RT_RF_LPS_LEVEL_ASPM; - break; - - case 2: - /*ASPM with Clock Req dynamically enabled/disable. */ - ppsc->reg_rfps_level |= (RT_RF_LPS_LEVEL_ASPM | - RT_RF_OFF_LEVL_CLK_REQ); - break; - - case 3: - /* - * Always enable ASPM and Clock Req - * from initialization to halt. - * */ - ppsc->reg_rfps_level &= ~(RT_RF_LPS_LEVEL_ASPM); - ppsc->reg_rfps_level |= (RT_RF_PS_LEVEL_ALWAYS_ASPM | - RT_RF_OFF_LEVL_CLK_REQ); - break; - - case 4: - /* - * Always enable ASPM without Clock Req - * from initialization to halt. - * */ - ppsc->reg_rfps_level &= ~(RT_RF_LPS_LEVEL_ASPM | - RT_RF_OFF_LEVL_CLK_REQ); - ppsc->reg_rfps_level |= RT_RF_PS_LEVEL_ALWAYS_ASPM; - break; - } - - ppsc->reg_rfps_level |= RT_RF_OFF_LEVL_HALT_NIC; - - /*Update Radio OFF setting */ - switch (rtlpci->const_hwsw_rfoff_d3) { - case 1: - if (ppsc->reg_rfps_level & RT_RF_LPS_LEVEL_ASPM) - ppsc->reg_rfps_level |= RT_RF_OFF_LEVL_ASPM; - break; - - case 2: - if (ppsc->reg_rfps_level & RT_RF_LPS_LEVEL_ASPM) - ppsc->reg_rfps_level |= RT_RF_OFF_LEVL_ASPM; - ppsc->reg_rfps_level |= RT_RF_OFF_LEVL_HALT_NIC; - break; - - case 3: - ppsc->reg_rfps_level |= RT_RF_OFF_LEVL_PCI_D3; - break; - } - - /*Set HW definition to determine if it supports ASPM. */ - switch (rtlpci->const_support_pciaspm) { - case 0:{ - /*Not support ASPM. */ - bool support_aspm = false; - ppsc->support_aspm = support_aspm; - break; - } - case 1:{ - /*Support ASPM. */ - bool support_aspm = true; - bool support_backdoor = true; - ppsc->support_aspm = support_aspm; - - /*if (priv->oem_id == RT_CID_TOSHIBA && - !priv->ndis_adapter.amd_l1_patch) - support_backdoor = false; */ - - ppsc->support_backdoor = support_backdoor; - - break; - } - case 2: - /*ASPM value set by chipset. */ - if (pcibridge_vendor == PCI_BRIDGE_VENDOR_INTEL) { - bool support_aspm = true; - ppsc->support_aspm = support_aspm; - } - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - - /* toshiba aspm issue, toshiba will set aspm selfly - * so we should not set aspm in driver */ - pci_read_config_byte(rtlpci->pdev, 0x80, &init_aspm); - if (rtlpriv->rtlhal.hw_type == HARDWARE_TYPE_RTL8192SE && - init_aspm == 0x43) - ppsc->support_aspm = false; -} - -static bool _rtl_pci_platform_switch_device_pci_aspm( - struct ieee80211_hw *hw, - u8 value) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (rtlhal->hw_type != HARDWARE_TYPE_RTL8192SE) - value |= 0x40; - - pci_write_config_byte(rtlpci->pdev, 0x80, value); - - return false; -} - -/*When we set 0x01 to enable clk request. Set 0x0 to disable clk req.*/ -static void _rtl_pci_switch_clk_req(struct ieee80211_hw *hw, u8 value) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - pci_write_config_byte(rtlpci->pdev, 0x81, value); - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) - udelay(100); -} - -/*Disable RTL8192SE ASPM & Disable Pci Bridge ASPM*/ -static void rtl_pci_disable_aspm(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u8 pcibridge_vendor = pcipriv->ndis_adapter.pcibridge_vendor; - u8 num4bytes = pcipriv->ndis_adapter.num4bytes; - /*Retrieve original configuration settings. */ - u8 linkctrl_reg = pcipriv->ndis_adapter.linkctrl_reg; - u16 pcibridge_linkctrlreg = pcipriv->ndis_adapter. - pcibridge_linkctrlreg; - u16 aspmlevel = 0; - u8 tmp_u1b = 0; - - if (!ppsc->support_aspm) - return; - - if (pcibridge_vendor == PCI_BRIDGE_VENDOR_UNKNOWN) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, - "PCI(Bridge) UNKNOWN\n"); - - return; - } - - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_CLK_REQ) { - RT_CLEAR_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_CLK_REQ); - _rtl_pci_switch_clk_req(hw, 0x0); - } - - /*for promising device will in L0 state after an I/O. */ - pci_read_config_byte(rtlpci->pdev, 0x80, &tmp_u1b); - - /*Set corresponding value. */ - aspmlevel |= BIT(0) | BIT(1); - linkctrl_reg &= ~aspmlevel; - pcibridge_linkctrlreg &= ~(BIT(0) | BIT(1)); - - _rtl_pci_platform_switch_device_pci_aspm(hw, linkctrl_reg); - udelay(50); - - /*4 Disable Pci Bridge ASPM */ - pci_write_config_byte(rtlpci->pdev, (num4bytes << 2), - pcibridge_linkctrlreg); - - udelay(50); -} - -/* - *Enable RTL8192SE ASPM & Enable Pci Bridge ASPM for - *power saving We should follow the sequence to enable - *RTL8192SE first then enable Pci Bridge ASPM - *or the system will show bluescreen. - */ -static void rtl_pci_enable_aspm(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u8 pcibridge_vendor = pcipriv->ndis_adapter.pcibridge_vendor; - u8 num4bytes = pcipriv->ndis_adapter.num4bytes; - u16 aspmlevel; - u8 u_pcibridge_aspmsetting; - u8 u_device_aspmsetting; - - if (!ppsc->support_aspm) - return; - - if (pcibridge_vendor == PCI_BRIDGE_VENDOR_UNKNOWN) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, - "PCI(Bridge) UNKNOWN\n"); - return; - } - - /*4 Enable Pci Bridge ASPM */ - - u_pcibridge_aspmsetting = - pcipriv->ndis_adapter.pcibridge_linkctrlreg | - rtlpci->const_hostpci_aspm_setting; - - if (pcibridge_vendor == PCI_BRIDGE_VENDOR_INTEL) - u_pcibridge_aspmsetting &= ~BIT(0); - - pci_write_config_byte(rtlpci->pdev, (num4bytes << 2), - u_pcibridge_aspmsetting); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "PlatformEnableASPM(): Write reg[%x] = %x\n", - (pcipriv->ndis_adapter.pcibridge_pciehdr_offset + 0x10), - u_pcibridge_aspmsetting); - - udelay(50); - - /*Get ASPM level (with/without Clock Req) */ - aspmlevel = rtlpci->const_devicepci_aspm_setting; - u_device_aspmsetting = pcipriv->ndis_adapter.linkctrl_reg; - - /*_rtl_pci_platform_switch_device_pci_aspm(dev,*/ - /*(priv->ndis_adapter.linkctrl_reg | ASPMLevel)); */ - - u_device_aspmsetting |= aspmlevel; - - _rtl_pci_platform_switch_device_pci_aspm(hw, u_device_aspmsetting); - - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_CLK_REQ) { - _rtl_pci_switch_clk_req(hw, (ppsc->reg_rfps_level & - RT_RF_OFF_LEVL_CLK_REQ) ? 1 : 0); - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_CLK_REQ); - } - udelay(100); -} - -static bool rtl_pci_get_amd_l1_patch(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - bool status = false; - u8 offset_e0; - unsigned offset_e4; - - pci_write_config_byte(rtlpci->pdev, 0xe0, 0xa0); - - pci_read_config_byte(rtlpci->pdev, 0xe0, &offset_e0); - - if (offset_e0 == 0xA0) { - pci_read_config_dword(rtlpci->pdev, 0xe4, &offset_e4); - if (offset_e4 & BIT(23)) - status = true; - } - - return status; -} - -static bool rtl_pci_check_buddy_priv(struct ieee80211_hw *hw, - struct rtl_priv **buddy_priv) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - bool find_buddy_priv = false; - struct rtl_priv *tpriv = NULL; - struct rtl_pci_priv *tpcipriv = NULL; - - if (!list_empty(&rtlpriv->glb_var->glb_priv_list)) { - list_for_each_entry(tpriv, &rtlpriv->glb_var->glb_priv_list, - list) { - if (tpriv) { - tpcipriv = (struct rtl_pci_priv *)tpriv->priv; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "pcipriv->ndis_adapter.funcnumber %x\n", - pcipriv->ndis_adapter.funcnumber); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "tpcipriv->ndis_adapter.funcnumber %x\n", - tpcipriv->ndis_adapter.funcnumber); - - if ((pcipriv->ndis_adapter.busnumber == - tpcipriv->ndis_adapter.busnumber) && - (pcipriv->ndis_adapter.devnumber == - tpcipriv->ndis_adapter.devnumber) && - (pcipriv->ndis_adapter.funcnumber != - tpcipriv->ndis_adapter.funcnumber)) { - find_buddy_priv = true; - break; - } - } - } - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "find_buddy_priv %d\n", find_buddy_priv); - - if (find_buddy_priv) - *buddy_priv = tpriv; - - return find_buddy_priv; -} - -static void rtl_pci_get_linkcontrol_field(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(pcipriv); - u8 capabilityoffset = pcipriv->ndis_adapter.pcibridge_pciehdr_offset; - u8 linkctrl_reg; - u8 num4bbytes; - - num4bbytes = (capabilityoffset + 0x10) / 4; - - /*Read Link Control Register */ - pci_read_config_byte(rtlpci->pdev, (num4bbytes << 2), &linkctrl_reg); - - pcipriv->ndis_adapter.pcibridge_linkctrlreg = linkctrl_reg; -} - -static void rtl_pci_parse_configuration(struct pci_dev *pdev, - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - - u8 tmp; - u16 linkctrl_reg; - - /*Link Control Register */ - pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &linkctrl_reg); - pcipriv->ndis_adapter.linkctrl_reg = (u8)linkctrl_reg; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Link Control Register =%x\n", - pcipriv->ndis_adapter.linkctrl_reg); - - pci_read_config_byte(pdev, 0x98, &tmp); - tmp |= BIT(4); - pci_write_config_byte(pdev, 0x98, tmp); - - tmp = 0x17; - pci_write_config_byte(pdev, 0x70f, tmp); -} - -static void rtl_pci_init_aspm(struct ieee80211_hw *hw) -{ - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - _rtl_pci_update_default_setting(hw); - - if (ppsc->reg_rfps_level & RT_RF_PS_LEVEL_ALWAYS_ASPM) { - /*Always enable ASPM & Clock Req. */ - rtl_pci_enable_aspm(hw); - RT_SET_PS_LEVEL(ppsc, RT_RF_PS_LEVEL_ALWAYS_ASPM); - } - -} - -static void _rtl_pci_io_handler_init(struct device *dev, - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->io.dev = dev; - - rtlpriv->io.write8_async = pci_write8_async; - rtlpriv->io.write16_async = pci_write16_async; - rtlpriv->io.write32_async = pci_write32_async; - - rtlpriv->io.read8_sync = pci_read8_sync; - rtlpriv->io.read16_sync = pci_read16_sync; - rtlpriv->io.read32_sync = pci_read32_sync; - -} - -static bool _rtl_update_earlymode_info(struct ieee80211_hw *hw, - struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc, u8 tid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct sk_buff *next_skb; - u8 additionlen = FCS_LEN; - - /* here open is 4, wep/tkip is 8, aes is 12*/ - if (info->control.hw_key) - additionlen += info->control.hw_key->icv_len; - - /* The most skb num is 6 */ - tcb_desc->empkt_num = 0; - spin_lock_bh(&rtlpriv->locks.waitq_lock); - skb_queue_walk(&rtlpriv->mac80211.skb_waitq[tid], next_skb) { - struct ieee80211_tx_info *next_info; - - next_info = IEEE80211_SKB_CB(next_skb); - if (next_info->flags & IEEE80211_TX_CTL_AMPDU) { - tcb_desc->empkt_len[tcb_desc->empkt_num] = - next_skb->len + additionlen; - tcb_desc->empkt_num++; - } else { - break; - } - - if (skb_queue_is_last(&rtlpriv->mac80211.skb_waitq[tid], - next_skb)) - break; - - if (tcb_desc->empkt_num >= rtlhal->max_earlymode_num) - break; - } - spin_unlock_bh(&rtlpriv->locks.waitq_lock); - - return true; -} - -/* just for early mode now */ -static void _rtl_pci_tx_chk_waitq(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct sk_buff *skb = NULL; - struct ieee80211_tx_info *info = NULL; - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - int tid; - - if (!rtlpriv->rtlhal.earlymode_enable) - return; - - if (rtlpriv->dm.supp_phymode_switch && - (rtlpriv->easy_concurrent_ctl.switch_in_process || - (rtlpriv->buddy_priv && - rtlpriv->buddy_priv->easy_concurrent_ctl.switch_in_process))) - return; - /* we juse use em for BE/BK/VI/VO */ - for (tid = 7; tid >= 0; tid--) { - u8 hw_queue = ac_to_hwq[rtl_tid_to_ac(tid)]; - struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue]; - while (!mac->act_scanning && - rtlpriv->psc.rfpwr_state == ERFON) { - struct rtl_tcb_desc tcb_desc; - memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); - - spin_lock_bh(&rtlpriv->locks.waitq_lock); - if (!skb_queue_empty(&mac->skb_waitq[tid]) && - (ring->entries - skb_queue_len(&ring->queue) > - rtlhal->max_earlymode_num)) { - skb = skb_dequeue(&mac->skb_waitq[tid]); - } else { - spin_unlock_bh(&rtlpriv->locks.waitq_lock); - break; - } - spin_unlock_bh(&rtlpriv->locks.waitq_lock); - - /* Some macaddr can't do early mode. like - * multicast/broadcast/no_qos data */ - info = IEEE80211_SKB_CB(skb); - if (info->flags & IEEE80211_TX_CTL_AMPDU) - _rtl_update_earlymode_info(hw, skb, - &tcb_desc, tid); - - rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, &tcb_desc); - } - } -} - - -static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[prio]; - - while (skb_queue_len(&ring->queue)) { - struct rtl_tx_desc *entry = &ring->desc[ring->idx]; - struct sk_buff *skb; - struct ieee80211_tx_info *info; - __le16 fc; - u8 tid; - - u8 own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) entry, true, - HW_DESC_OWN); - - /*beacon packet will only use the first - *descriptor by defaut, and the own may not - *be cleared by the hardware - */ - if (own) - return; - ring->idx = (ring->idx + 1) % ring->entries; - - skb = __skb_dequeue(&ring->queue); - pci_unmap_single(rtlpci->pdev, - rtlpriv->cfg->ops-> - get_desc((u8 *) entry, true, - HW_DESC_TXBUFF_ADDR), - skb->len, PCI_DMA_TODEVICE); - - /* remove early mode header */ - if (rtlpriv->rtlhal.earlymode_enable) - skb_pull(skb, EM_HDR_LEN); - - RT_TRACE(rtlpriv, (COMP_INTR | COMP_SEND), DBG_TRACE, - "new ring->idx:%d, free: skb_queue_len:%d, free: seq:%x\n", - ring->idx, - skb_queue_len(&ring->queue), - *(u16 *) (skb->data + 22)); - - if (prio == TXCMD_QUEUE) { - dev_kfree_skb(skb); - goto tx_status_ok; - - } - - /* for sw LPS, just after NULL skb send out, we can - * sure AP knows we are sleeping, we should not let - * rf sleep - */ - fc = rtl_get_fc(skb); - if (ieee80211_is_nullfunc(fc)) { - if (ieee80211_has_pm(fc)) { - rtlpriv->mac80211.offchan_delay = true; - rtlpriv->psc.state_inap = true; - } else { - rtlpriv->psc.state_inap = false; - } - } - if (ieee80211_is_action(fc)) { - struct ieee80211_mgmt *action_frame = - (struct ieee80211_mgmt *)skb->data; - if (action_frame->u.action.u.ht_smps.action == - WLAN_HT_ACTION_SMPS) { - dev_kfree_skb(skb); - goto tx_status_ok; - } - } - - /* update tid tx pkt num */ - tid = rtl_get_tid(skb); - if (tid <= 7) - rtlpriv->link_info.tidtx_inperiod[tid]++; - - info = IEEE80211_SKB_CB(skb); - ieee80211_tx_info_clear_status(info); - - info->flags |= IEEE80211_TX_STAT_ACK; - /*info->status.rates[0].count = 1; */ - - ieee80211_tx_status_irqsafe(hw, skb); - - if ((ring->entries - skb_queue_len(&ring->queue)) - == 2) { - - RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD, - "more desc left, wake skb_queue@%d, ring->idx = %d, skb_queue_len = 0x%d\n", - prio, ring->idx, - skb_queue_len(&ring->queue)); - - ieee80211_wake_queue(hw, - skb_get_queue_mapping - (skb)); - } -tx_status_ok: - skb = NULL; - } - - if (((rtlpriv->link_info.num_rx_inperiod + - rtlpriv->link_info.num_tx_inperiod) > 8) || - (rtlpriv->link_info.num_rx_inperiod > 2)) { - rtlpriv->enter_ps = false; - schedule_work(&rtlpriv->works.lps_change_work); - } -} - -static void _rtl_receive_one(struct ieee80211_hw *hw, struct sk_buff *skb, - struct ieee80211_rx_status rx_status) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct ieee80211_hdr *hdr = rtl_get_hdr(skb); - __le16 fc = rtl_get_fc(skb); - bool unicast = false; - struct sk_buff *uskb = NULL; - u8 *pdata; - - - memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); - - if (is_broadcast_ether_addr(hdr->addr1)) { - ;/*TODO*/ - } else if (is_multicast_ether_addr(hdr->addr1)) { - ;/*TODO*/ - } else { - unicast = true; - rtlpriv->stats.rxbytesunicast += skb->len; - } - - rtl_is_special_data(hw, skb, false); - - if (ieee80211_is_data(fc)) { - rtlpriv->cfg->ops->led_control(hw, LED_CTL_RX); - - if (unicast) - rtlpriv->link_info.num_rx_inperiod++; - } - - /* static bcn for roaming */ - rtl_beacon_statistic(hw, skb); - rtl_p2p_info(hw, (void *)skb->data, skb->len); - - /* for sw lps */ - rtl_swlps_beacon(hw, (void *)skb->data, skb->len); - rtl_recognize_peer(hw, (void *)skb->data, skb->len); - if ((rtlpriv->mac80211.opmode == NL80211_IFTYPE_AP) && - (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G) && - (ieee80211_is_beacon(fc) || ieee80211_is_probe_resp(fc))) - return; - - if (unlikely(!rtl_action_proc(hw, skb, false))) - return; - - uskb = dev_alloc_skb(skb->len + 128); - if (!uskb) - return; /* exit if allocation failed */ - memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status, sizeof(rx_status)); - pdata = (u8 *)skb_put(uskb, skb->len); - memcpy(pdata, skb->data, skb->len); - - ieee80211_rx_irqsafe(hw, uskb); -} - -static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - int rx_queue_idx = RTL_PCI_RX_MPDU_QUEUE; - - struct ieee80211_rx_status rx_status = { 0 }; - unsigned int count = rtlpci->rxringcount; - u8 own; - u8 tmp_one; - u32 bufferaddress; - - struct rtl_stats stats = { - .signal = 0, - .noise = -98, - .rate = 0, - }; - int index = rtlpci->rx_ring[rx_queue_idx].idx; - - if (rtlpci->driver_is_goingto_unload) - return; - /*RX NORMAL PKT */ - while (count--) { - /*rx descriptor */ - struct rtl_rx_desc *pdesc = &rtlpci->rx_ring[rx_queue_idx].desc[ - index]; - /*rx pkt */ - struct sk_buff *skb = rtlpci->rx_ring[rx_queue_idx].rx_buf[ - index]; - struct sk_buff *new_skb = NULL; - - own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, - false, HW_DESC_OWN); - - /*wait data to be filled by hardware */ - if (own) - break; - - rtlpriv->cfg->ops->query_rx_desc(hw, &stats, - &rx_status, - (u8 *) pdesc, skb); - - if (stats.crc || stats.hwerror) - goto done; - - new_skb = dev_alloc_skb(rtlpci->rxbuffersize); - if (unlikely(!new_skb)) { - RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV), DBG_DMESG, - "can't alloc skb for rx\n"); - goto done; - } - kmemleak_not_leak(new_skb); - - pci_unmap_single(rtlpci->pdev, - *((dma_addr_t *) skb->cb), - rtlpci->rxbuffersize, - PCI_DMA_FROMDEVICE); - - skb_put(skb, rtlpriv->cfg->ops->get_desc((u8 *) pdesc, false, - HW_DESC_RXPKT_LEN)); - skb_reserve(skb, stats.rx_drvinfo_size + stats.rx_bufshift); - - /* - * NOTICE This can not be use for mac80211, - * this is done in mac80211 code, - * if you done here sec DHCP will fail - * skb_trim(skb, skb->len - 4); - */ - - _rtl_receive_one(hw, skb, rx_status); - - if (((rtlpriv->link_info.num_rx_inperiod + - rtlpriv->link_info.num_tx_inperiod) > 8) || - (rtlpriv->link_info.num_rx_inperiod > 2)) { - rtlpriv->enter_ps = false; - schedule_work(&rtlpriv->works.lps_change_work); - } - - dev_kfree_skb_any(skb); - skb = new_skb; - - rtlpci->rx_ring[rx_queue_idx].rx_buf[index] = skb; - *((dma_addr_t *) skb->cb) = - pci_map_single(rtlpci->pdev, skb_tail_pointer(skb), - rtlpci->rxbuffersize, - PCI_DMA_FROMDEVICE); - -done: - bufferaddress = (*((dma_addr_t *)skb->cb)); - if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress)) - return; - tmp_one = 1; - rtlpriv->cfg->ops->set_desc((u8 *) pdesc, false, - HW_DESC_RXBUFF_ADDR, - (u8 *)&bufferaddress); - rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false, - HW_DESC_RXPKT_LEN, - (u8 *)&rtlpci->rxbuffersize); - - if (index == rtlpci->rxringcount - 1) - rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false, - HW_DESC_RXERO, - &tmp_one); - - rtlpriv->cfg->ops->set_desc((u8 *)pdesc, false, HW_DESC_RXOWN, - &tmp_one); - - index = (index + 1) % rtlpci->rxringcount; - } - - rtlpci->rx_ring[rx_queue_idx].idx = index; -} - -static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id) -{ - struct ieee80211_hw *hw = dev_id; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - unsigned long flags; - u32 inta = 0; - u32 intb = 0; - irqreturn_t ret = IRQ_HANDLED; - - spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); - - /*read ISR: 4/8bytes */ - rtlpriv->cfg->ops->interrupt_recognized(hw, &inta, &intb); - - /*Shared IRQ or HW disappared */ - if (!inta || inta == 0xffff) { - ret = IRQ_NONE; - goto done; - } - - /*<1> beacon related */ - if (inta & rtlpriv->cfg->maps[RTL_IMR_TBDOK]) { - RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, - "beacon ok interrupt!\n"); - } - - if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_TBDER])) { - RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, - "beacon err interrupt!\n"); - } - - if (inta & rtlpriv->cfg->maps[RTL_IMR_BDOK]) { - RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, "beacon interrupt!\n"); - } - - if (inta & rtlpriv->cfg->maps[RTL_IMR_BCNINT]) { - RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, - "prepare beacon for interrupt!\n"); - tasklet_schedule(&rtlpriv->works.irq_prepare_bcn_tasklet); - } - - /*<3> Tx related */ - if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_TXFOVW])) - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, "IMR_TXFOVW!\n"); - - if (inta & rtlpriv->cfg->maps[RTL_IMR_MGNTDOK]) { - RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, - "Manage ok interrupt!\n"); - _rtl_pci_tx_isr(hw, MGNT_QUEUE); - } - - if (inta & rtlpriv->cfg->maps[RTL_IMR_HIGHDOK]) { - RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, - "HIGH_QUEUE ok interrupt!\n"); - _rtl_pci_tx_isr(hw, HIGH_QUEUE); - } - - if (inta & rtlpriv->cfg->maps[RTL_IMR_BKDOK]) { - rtlpriv->link_info.num_tx_inperiod++; - - RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, - "BK Tx OK interrupt!\n"); - _rtl_pci_tx_isr(hw, BK_QUEUE); - } - - if (inta & rtlpriv->cfg->maps[RTL_IMR_BEDOK]) { - rtlpriv->link_info.num_tx_inperiod++; - - RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, - "BE TX OK interrupt!\n"); - _rtl_pci_tx_isr(hw, BE_QUEUE); - } - - if (inta & rtlpriv->cfg->maps[RTL_IMR_VIDOK]) { - rtlpriv->link_info.num_tx_inperiod++; - - RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, - "VI TX OK interrupt!\n"); - _rtl_pci_tx_isr(hw, VI_QUEUE); - } - - if (inta & rtlpriv->cfg->maps[RTL_IMR_VODOK]) { - rtlpriv->link_info.num_tx_inperiod++; - - RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, - "Vo TX OK interrupt!\n"); - _rtl_pci_tx_isr(hw, VO_QUEUE); - } - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) { - if (inta & rtlpriv->cfg->maps[RTL_IMR_COMDOK]) { - rtlpriv->link_info.num_tx_inperiod++; - - RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, - "CMD TX OK interrupt!\n"); - _rtl_pci_tx_isr(hw, TXCMD_QUEUE); - } - } - - /*<2> Rx related */ - if (inta & rtlpriv->cfg->maps[RTL_IMR_ROK]) { - RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, "Rx ok interrupt!\n"); - _rtl_pci_rx_interrupt(hw); - } - - if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_RDU])) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "rx descriptor unavailable!\n"); - _rtl_pci_rx_interrupt(hw); - } - - if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_RXFOVW])) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, "rx overflow !\n"); - _rtl_pci_rx_interrupt(hw); - } - - /*fw related*/ - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8723AE) { - if (inta & rtlpriv->cfg->maps[RTL_IMR_C2HCMD]) { - RT_TRACE(rtlpriv, COMP_INTR, DBG_TRACE, - "firmware interrupt!\n"); - queue_delayed_work(rtlpriv->works.rtl_wq, - &rtlpriv->works.fwevt_wq, 0); - } - } - - if (rtlpriv->rtlhal.earlymode_enable) - tasklet_schedule(&rtlpriv->works.irq_tasklet); - -done: - spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); - return ret; -} - -static void _rtl_pci_irq_tasklet(struct ieee80211_hw *hw) -{ - _rtl_pci_tx_chk_waitq(hw); -} - -static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl8192_tx_ring *ring = NULL; - struct ieee80211_hdr *hdr = NULL; - struct ieee80211_tx_info *info = NULL; - struct sk_buff *pskb = NULL; - struct rtl_tx_desc *pdesc = NULL; - struct rtl_tcb_desc tcb_desc; - u8 temp_one = 1; - - memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); - ring = &rtlpci->tx_ring[BEACON_QUEUE]; - pskb = __skb_dequeue(&ring->queue); - if (pskb) { - struct rtl_tx_desc *entry = &ring->desc[ring->idx]; - pci_unmap_single(rtlpci->pdev, rtlpriv->cfg->ops->get_desc( - (u8 *) entry, true, HW_DESC_TXBUFF_ADDR), - pskb->len, PCI_DMA_TODEVICE); - kfree_skb(pskb); - } - - /*NB: the beacon data buffer must be 32-bit aligned. */ - pskb = ieee80211_beacon_get(hw, mac->vif); - if (pskb == NULL) - return; - hdr = rtl_get_hdr(pskb); - info = IEEE80211_SKB_CB(pskb); - pdesc = &ring->desc[0]; - rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *) pdesc, - info, NULL, pskb, BEACON_QUEUE, &tcb_desc); - - __skb_queue_tail(&ring->queue, pskb); - - rtlpriv->cfg->ops->set_desc((u8 *) pdesc, true, HW_DESC_OWN, - &temp_one); - - return; -} - -static void _rtl_pci_init_trx_var(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u8 i; - - for (i = 0; i < RTL_PCI_MAX_TX_QUEUE_COUNT; i++) - rtlpci->txringcount[i] = RT_TXDESC_NUM; - - /* - *we just alloc 2 desc for beacon queue, - *because we just need first desc in hw beacon. - */ - rtlpci->txringcount[BEACON_QUEUE] = 2; - - /* - *BE queue need more descriptor for performance - *consideration or, No more tx desc will happen, - *and may cause mac80211 mem leakage. - */ - rtlpci->txringcount[BE_QUEUE] = RT_TXDESC_NUM_BE_QUEUE; - - rtlpci->rxbuffersize = 9100; /*2048/1024; */ - rtlpci->rxringcount = RTL_PCI_MAX_RX_COUNT; /*64; */ -} - -static void _rtl_pci_init_struct(struct ieee80211_hw *hw, - struct pci_dev *pdev) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - rtlpci->up_first_time = true; - rtlpci->being_init_adapter = false; - - rtlhal->hw = hw; - rtlpci->pdev = pdev; - - /*Tx/Rx related var */ - _rtl_pci_init_trx_var(hw); - - /*IBSS*/ mac->beacon_interval = 100; - - /*AMPDU*/ - mac->min_space_cfg = 0; - mac->max_mss_density = 0; - /*set sane AMPDU defaults */ - mac->current_ampdu_density = 7; - mac->current_ampdu_factor = 3; - - /*QOS*/ - rtlpci->acm_method = eAcmWay2_SW; - - /*task */ - tasklet_init(&rtlpriv->works.irq_tasklet, - (void (*)(unsigned long))_rtl_pci_irq_tasklet, - (unsigned long)hw); - tasklet_init(&rtlpriv->works.irq_prepare_bcn_tasklet, - (void (*)(unsigned long))_rtl_pci_prepare_bcn_tasklet, - (unsigned long)hw); - INIT_WORK(&rtlpriv->works.lps_change_work, - rtl_lps_change_work_callback); -} - -static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw, - unsigned int prio, unsigned int entries) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_tx_desc *ring; - dma_addr_t dma; - u32 nextdescaddress; - int i; - - ring = pci_alloc_consistent(rtlpci->pdev, - sizeof(*ring) * entries, &dma); - - if (!ring || (unsigned long)ring & 0xFF) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Cannot allocate TX ring (prio = %d)\n", prio); - return -ENOMEM; - } - - memset(ring, 0, sizeof(*ring) * entries); - rtlpci->tx_ring[prio].desc = ring; - rtlpci->tx_ring[prio].dma = dma; - rtlpci->tx_ring[prio].idx = 0; - rtlpci->tx_ring[prio].entries = entries; - skb_queue_head_init(&rtlpci->tx_ring[prio].queue); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "queue:%d, ring_addr:%p\n", - prio, ring); - - for (i = 0; i < entries; i++) { - nextdescaddress = (u32) dma + - ((i + 1) % entries) * - sizeof(*ring); - - rtlpriv->cfg->ops->set_desc((u8 *)&(ring[i]), - true, HW_DESC_TX_NEXTDESC_ADDR, - (u8 *)&nextdescaddress); - } - - return 0; -} - -static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_rx_desc *entry = NULL; - int i, rx_queue_idx; - u8 tmp_one = 1; - - /* - *rx_queue_idx 0:RX_MPDU_QUEUE - *rx_queue_idx 1:RX_CMD_QUEUE - */ - for (rx_queue_idx = 0; rx_queue_idx < RTL_PCI_MAX_RX_QUEUE; - rx_queue_idx++) { - rtlpci->rx_ring[rx_queue_idx].desc = - pci_alloc_consistent(rtlpci->pdev, - sizeof(*rtlpci->rx_ring[rx_queue_idx]. - desc) * rtlpci->rxringcount, - &rtlpci->rx_ring[rx_queue_idx].dma); - - if (!rtlpci->rx_ring[rx_queue_idx].desc || - (unsigned long)rtlpci->rx_ring[rx_queue_idx].desc & 0xFF) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Cannot allocate RX ring\n"); - return -ENOMEM; - } - - memset(rtlpci->rx_ring[rx_queue_idx].desc, 0, - sizeof(*rtlpci->rx_ring[rx_queue_idx].desc) * - rtlpci->rxringcount); - - rtlpci->rx_ring[rx_queue_idx].idx = 0; - - /* If amsdu_8k is disabled, set buffersize to 4096. This - * change will reduce memory fragmentation. - */ - if (rtlpci->rxbuffersize > 4096 && - rtlpriv->rtlhal.disable_amsdu_8k) - rtlpci->rxbuffersize = 4096; - - for (i = 0; i < rtlpci->rxringcount; i++) { - struct sk_buff *skb = - dev_alloc_skb(rtlpci->rxbuffersize); - u32 bufferaddress; - if (!skb) - return 0; - kmemleak_not_leak(skb); - entry = &rtlpci->rx_ring[rx_queue_idx].desc[i]; - - /*skb->dev = dev; */ - - rtlpci->rx_ring[rx_queue_idx].rx_buf[i] = skb; - - /* - *just set skb->cb to mapping addr - *for pci_unmap_single use - */ - *((dma_addr_t *) skb->cb) = - pci_map_single(rtlpci->pdev, skb_tail_pointer(skb), - rtlpci->rxbuffersize, - PCI_DMA_FROMDEVICE); - - bufferaddress = (*((dma_addr_t *)skb->cb)); - if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress)) { - dev_kfree_skb_any(skb); - return 1; - } - rtlpriv->cfg->ops->set_desc((u8 *)entry, false, - HW_DESC_RXBUFF_ADDR, - (u8 *)&bufferaddress); - rtlpriv->cfg->ops->set_desc((u8 *)entry, false, - HW_DESC_RXPKT_LEN, - (u8 *)&rtlpci-> - rxbuffersize); - rtlpriv->cfg->ops->set_desc((u8 *) entry, false, - HW_DESC_RXOWN, - &tmp_one); - } - - rtlpriv->cfg->ops->set_desc((u8 *) entry, false, - HW_DESC_RXERO, &tmp_one); - } - return 0; -} - -static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw, - unsigned int prio) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[prio]; - - while (skb_queue_len(&ring->queue)) { - struct rtl_tx_desc *entry = &ring->desc[ring->idx]; - struct sk_buff *skb = __skb_dequeue(&ring->queue); - - pci_unmap_single(rtlpci->pdev, - rtlpriv->cfg-> - ops->get_desc((u8 *) entry, true, - HW_DESC_TXBUFF_ADDR), - skb->len, PCI_DMA_TODEVICE); - kfree_skb(skb); - ring->idx = (ring->idx + 1) % ring->entries; - } - - if (ring->desc) { - pci_free_consistent(rtlpci->pdev, - sizeof(*ring->desc) * ring->entries, - ring->desc, ring->dma); - ring->desc = NULL; - } -} - -static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci) -{ - int i, rx_queue_idx; - - /*rx_queue_idx 0:RX_MPDU_QUEUE */ - /*rx_queue_idx 1:RX_CMD_QUEUE */ - for (rx_queue_idx = 0; rx_queue_idx < RTL_PCI_MAX_RX_QUEUE; - rx_queue_idx++) { - for (i = 0; i < rtlpci->rxringcount; i++) { - struct sk_buff *skb = - rtlpci->rx_ring[rx_queue_idx].rx_buf[i]; - if (!skb) - continue; - - pci_unmap_single(rtlpci->pdev, - *((dma_addr_t *) skb->cb), - rtlpci->rxbuffersize, - PCI_DMA_FROMDEVICE); - kfree_skb(skb); - } - - if (rtlpci->rx_ring[rx_queue_idx].desc) { - pci_free_consistent(rtlpci->pdev, - sizeof(*rtlpci->rx_ring[rx_queue_idx]. - desc) * rtlpci->rxringcount, - rtlpci->rx_ring[rx_queue_idx].desc, - rtlpci->rx_ring[rx_queue_idx].dma); - rtlpci->rx_ring[rx_queue_idx].desc = NULL; - } - } -} - -static int _rtl_pci_init_trx_ring(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - int ret; - int i; - - ret = _rtl_pci_init_rx_ring(hw); - if (ret) - return ret; - - for (i = 0; i < RTL_PCI_MAX_TX_QUEUE_COUNT; i++) { - ret = _rtl_pci_init_tx_ring(hw, i, - rtlpci->txringcount[i]); - if (ret) - goto err_free_rings; - } - - return 0; - -err_free_rings: - _rtl_pci_free_rx_ring(rtlpci); - - for (i = 0; i < RTL_PCI_MAX_TX_QUEUE_COUNT; i++) - if (rtlpci->tx_ring[i].desc) - _rtl_pci_free_tx_ring(hw, i); - - return 1; -} - -static int _rtl_pci_deinit_trx_ring(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u32 i; - - /*free rx rings */ - _rtl_pci_free_rx_ring(rtlpci); - - /*free tx rings */ - for (i = 0; i < RTL_PCI_MAX_TX_QUEUE_COUNT; i++) - _rtl_pci_free_tx_ring(hw, i); - - return 0; -} - -int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - int i, rx_queue_idx; - unsigned long flags; - u8 tmp_one = 1; - - /*rx_queue_idx 0:RX_MPDU_QUEUE */ - /*rx_queue_idx 1:RX_CMD_QUEUE */ - for (rx_queue_idx = 0; rx_queue_idx < RTL_PCI_MAX_RX_QUEUE; - rx_queue_idx++) { - /* - *force the rx_ring[RX_MPDU_QUEUE/ - *RX_CMD_QUEUE].idx to the first one - */ - if (rtlpci->rx_ring[rx_queue_idx].desc) { - struct rtl_rx_desc *entry = NULL; - - for (i = 0; i < rtlpci->rxringcount; i++) { - entry = &rtlpci->rx_ring[rx_queue_idx].desc[i]; - rtlpriv->cfg->ops->set_desc((u8 *) entry, - false, - HW_DESC_RXOWN, - &tmp_one); - } - rtlpci->rx_ring[rx_queue_idx].idx = 0; - } - } - - /* - *after reset, release previous pending packet, - *and force the tx idx to the first one - */ - for (i = 0; i < RTL_PCI_MAX_TX_QUEUE_COUNT; i++) { - if (rtlpci->tx_ring[i].desc) { - struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[i]; - - while (skb_queue_len(&ring->queue)) { - struct rtl_tx_desc *entry; - struct sk_buff *skb; - - spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, - flags); - entry = &ring->desc[ring->idx]; - skb = __skb_dequeue(&ring->queue); - pci_unmap_single(rtlpci->pdev, - rtlpriv->cfg->ops-> - get_desc((u8 *) - entry, - true, - HW_DESC_TXBUFF_ADDR), - skb->len, PCI_DMA_TODEVICE); - ring->idx = (ring->idx + 1) % ring->entries; - spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, - flags); - kfree_skb(skb); - } - ring->idx = 0; - } - } - - return 0; -} - -static bool rtl_pci_tx_chk_waitq_insert(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_sta_info *sta_entry = NULL; - u8 tid = rtl_get_tid(skb); - __le16 fc = rtl_get_fc(skb); - - if (!sta) - return false; - sta_entry = (struct rtl_sta_info *)sta->drv_priv; - - if (!rtlpriv->rtlhal.earlymode_enable) - return false; - if (ieee80211_is_nullfunc(fc)) - return false; - if (ieee80211_is_qos_nullfunc(fc)) - return false; - if (ieee80211_is_pspoll(fc)) - return false; - if (sta_entry->tids[tid].agg.agg_state != RTL_AGG_OPERATIONAL) - return false; - if (_rtl_mac_to_hwqueue(hw, skb) > VO_QUEUE) - return false; - if (tid > 7) - return false; - - /* maybe every tid should be checked */ - if (!rtlpriv->link_info.higher_busytxtraffic[tid]) - return false; - - spin_lock_bh(&rtlpriv->locks.waitq_lock); - skb_queue_tail(&rtlpriv->mac80211.skb_waitq[tid], skb); - spin_unlock_bh(&rtlpriv->locks.waitq_lock); - - return true; -} - -static int rtl_pci_tx(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - struct sk_buff *skb, - struct rtl_tcb_desc *ptcb_desc) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_sta_info *sta_entry = NULL; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct rtl8192_tx_ring *ring; - struct rtl_tx_desc *pdesc; - u8 idx; - u8 hw_queue = _rtl_mac_to_hwqueue(hw, skb); - unsigned long flags; - struct ieee80211_hdr *hdr = rtl_get_hdr(skb); - __le16 fc = rtl_get_fc(skb); - u8 *pda_addr = hdr->addr1; - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - /*ssn */ - u8 tid = 0; - u16 seq_number = 0; - u8 own; - u8 temp_one = 1; - - if (ieee80211_is_mgmt(fc)) - rtl_tx_mgmt_proc(hw, skb); - - if (rtlpriv->psc.sw_ps_enabled) { - if (ieee80211_is_data(fc) && !ieee80211_is_nullfunc(fc) && - !ieee80211_has_pm(fc)) - hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); - } - - rtl_action_proc(hw, skb, true); - - if (is_multicast_ether_addr(pda_addr)) - rtlpriv->stats.txbytesmulticast += skb->len; - else if (is_broadcast_ether_addr(pda_addr)) - rtlpriv->stats.txbytesbroadcast += skb->len; - else - rtlpriv->stats.txbytesunicast += skb->len; - - spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); - ring = &rtlpci->tx_ring[hw_queue]; - if (hw_queue != BEACON_QUEUE) - idx = (ring->idx + skb_queue_len(&ring->queue)) % - ring->entries; - else - idx = 0; - - pdesc = &ring->desc[idx]; - own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, - true, HW_DESC_OWN); - - if ((own == 1) && (hw_queue != BEACON_QUEUE)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "No more TX desc@%d, ring->idx = %d, idx = %d, skb_queue_len = 0x%d\n", - hw_queue, ring->idx, idx, - skb_queue_len(&ring->queue)); - - spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); - return skb->len; - } - - if (ieee80211_is_data_qos(fc)) { - tid = rtl_get_tid(skb); - if (sta) { - sta_entry = (struct rtl_sta_info *)sta->drv_priv; - seq_number = (le16_to_cpu(hdr->seq_ctrl) & - IEEE80211_SCTL_SEQ) >> 4; - seq_number += 1; - - if (!ieee80211_has_morefrags(hdr->frame_control)) - sta_entry->tids[tid].seq_number = seq_number; - } - } - - if (ieee80211_is_data(fc)) - rtlpriv->cfg->ops->led_control(hw, LED_CTL_TX); - - rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *)pdesc, - info, sta, skb, hw_queue, ptcb_desc); - - __skb_queue_tail(&ring->queue, skb); - - rtlpriv->cfg->ops->set_desc((u8 *)pdesc, true, - HW_DESC_OWN, &temp_one); - - - if ((ring->entries - skb_queue_len(&ring->queue)) < 2 && - hw_queue != BEACON_QUEUE) { - - RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD, - "less desc left, stop skb_queue@%d, ring->idx = %d, idx = %d, skb_queue_len = 0x%d\n", - hw_queue, ring->idx, idx, - skb_queue_len(&ring->queue)); - - ieee80211_stop_queue(hw, skb_get_queue_mapping(skb)); - } - - spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); - - rtlpriv->cfg->ops->tx_polling(hw, hw_queue); - - return 0; -} - -static void rtl_pci_flush(struct ieee80211_hw *hw, bool drop) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 i = 0; - int queue_id; - struct rtl8192_tx_ring *ring; - - if (mac->skip_scan) - return; - - for (queue_id = RTL_PCI_MAX_TX_QUEUE_COUNT - 1; queue_id >= 0;) { - u32 queue_len; - ring = &pcipriv->dev.tx_ring[queue_id]; - queue_len = skb_queue_len(&ring->queue); - if (queue_len == 0 || queue_id == BEACON_QUEUE || - queue_id == TXCMD_QUEUE) { - queue_id--; - continue; - } else { - msleep(20); - i++; - } - - /* we just wait 1s for all queues */ - if (rtlpriv->psc.rfpwr_state == ERFOFF || - is_hal_stop(rtlhal) || i >= 200) - return; - } -} - -static void rtl_pci_deinit(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - _rtl_pci_deinit_trx_ring(hw); - - synchronize_irq(rtlpci->pdev->irq); - tasklet_kill(&rtlpriv->works.irq_tasklet); - cancel_work_sync(&rtlpriv->works.lps_change_work); - - flush_workqueue(rtlpriv->works.rtl_wq); - destroy_workqueue(rtlpriv->works.rtl_wq); - -} - -static int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int err; - - _rtl_pci_init_struct(hw, pdev); - - err = _rtl_pci_init_trx_ring(hw); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "tx ring initialization failed\n"); - return err; - } - - return 0; -} - -static int rtl_pci_start(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - int err; - - rtl_pci_reset_trx_ring(hw); - - rtlpci->driver_is_goingto_unload = false; - err = rtlpriv->cfg->ops->hw_init(hw); - if (err) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "Failed to config hardware!\n"); - return err; - } - - rtlpriv->cfg->ops->enable_interrupt(hw); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "enable_interrupt OK\n"); - - rtl_init_rx_config(hw); - - /*should be after adapter start and interrupt enable. */ - set_hal_start(rtlhal); - - RT_CLEAR_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - - rtlpci->up_first_time = false; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "OK\n"); - return 0; -} - -static void rtl_pci_stop(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - unsigned long flags; - u8 RFInProgressTimeOut = 0; - - /* - *should be before disable interrupt&adapter - *and will do it immediately. - */ - set_hal_stop(rtlhal); - - rtlpci->driver_is_goingto_unload = true; - rtlpriv->cfg->ops->disable_interrupt(hw); - cancel_work_sync(&rtlpriv->works.lps_change_work); - - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags); - while (ppsc->rfchange_inprogress) { - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flags); - if (RFInProgressTimeOut > 100) { - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags); - break; - } - mdelay(1); - RFInProgressTimeOut++; - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags); - } - ppsc->rfchange_inprogress = true; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flags); - - rtlpriv->cfg->ops->hw_disable(hw); - /* some things are not needed if firmware not available */ - if (!rtlpriv->max_fw_size) - return; - rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF); - - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags); - ppsc->rfchange_inprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flags); - - rtl_pci_enable_aspm(hw); -} - -static bool _rtl_pci_find_adapter(struct pci_dev *pdev, - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct pci_dev *bridge_pdev = pdev->bus->self; - u16 venderid; - u16 deviceid; - u8 revisionid; - u16 irqline; - u8 tmp; - - pcipriv->ndis_adapter.pcibridge_vendor = PCI_BRIDGE_VENDOR_UNKNOWN; - venderid = pdev->vendor; - deviceid = pdev->device; - pci_read_config_byte(pdev, 0x8, &revisionid); - pci_read_config_word(pdev, 0x3C, &irqline); - - /* PCI ID 0x10ec:0x8192 occurs for both RTL8192E, which uses - * r8192e_pci, and RTL8192SE, which uses this driver. If the - * revision ID is RTL_PCI_REVISION_ID_8192PCIE (0x01), then - * the correct driver is r8192e_pci, thus this routine should - * return false. - */ - if (deviceid == RTL_PCI_8192SE_DID && - revisionid == RTL_PCI_REVISION_ID_8192PCIE) - return false; - - if (deviceid == RTL_PCI_8192_DID || - deviceid == RTL_PCI_0044_DID || - deviceid == RTL_PCI_0047_DID || - deviceid == RTL_PCI_8192SE_DID || - deviceid == RTL_PCI_8174_DID || - deviceid == RTL_PCI_8173_DID || - deviceid == RTL_PCI_8172_DID || - deviceid == RTL_PCI_8171_DID) { - switch (revisionid) { - case RTL_PCI_REVISION_ID_8192PCIE: - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "8192 PCI-E is found - vid/did=%x/%x\n", - venderid, deviceid); - rtlhal->hw_type = HARDWARE_TYPE_RTL8192E; - return false; - case RTL_PCI_REVISION_ID_8192SE: - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "8192SE is found - vid/did=%x/%x\n", - venderid, deviceid); - rtlhal->hw_type = HARDWARE_TYPE_RTL8192SE; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Err: Unknown device - vid/did=%x/%x\n", - venderid, deviceid); - rtlhal->hw_type = HARDWARE_TYPE_RTL8192SE; - break; - - } - } else if (deviceid == RTL_PCI_8723AE_DID) { - rtlhal->hw_type = HARDWARE_TYPE_RTL8723AE; - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "8723AE PCI-E is found - " - "vid/did=%x/%x\n", venderid, deviceid); - } else if (deviceid == RTL_PCI_8192CET_DID || - deviceid == RTL_PCI_8192CE_DID || - deviceid == RTL_PCI_8191CE_DID || - deviceid == RTL_PCI_8188CE_DID) { - rtlhal->hw_type = HARDWARE_TYPE_RTL8192CE; - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "8192C PCI-E is found - vid/did=%x/%x\n", - venderid, deviceid); - } else if (deviceid == RTL_PCI_8192DE_DID || - deviceid == RTL_PCI_8192DE_DID2) { - rtlhal->hw_type = HARDWARE_TYPE_RTL8192DE; - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "8192D PCI-E is found - vid/did=%x/%x\n", - venderid, deviceid); - } else if (deviceid == RTL_PCI_8188EE_DID) { - rtlhal->hw_type = HARDWARE_TYPE_RTL8188EE; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Find adapter, Hardware type is 8188EE\n"); - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Err: Unknown device - vid/did=%x/%x\n", - venderid, deviceid); - - rtlhal->hw_type = RTL_DEFAULT_HARDWARE_TYPE; - } - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192DE) { - if (revisionid == 0 || revisionid == 1) { - if (revisionid == 0) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Find 92DE MAC0\n"); - rtlhal->interfaceindex = 0; - } else if (revisionid == 1) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Find 92DE MAC1\n"); - rtlhal->interfaceindex = 1; - } - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Unknown device - VendorID/DeviceID=%x/%x, Revision=%x\n", - venderid, deviceid, revisionid); - rtlhal->interfaceindex = 0; - } - } - /*find bus info */ - pcipriv->ndis_adapter.busnumber = pdev->bus->number; - pcipriv->ndis_adapter.devnumber = PCI_SLOT(pdev->devfn); - pcipriv->ndis_adapter.funcnumber = PCI_FUNC(pdev->devfn); - - /* some ARM have no bridge_pdev and will crash here - * so we should check if bridge_pdev is NULL - */ - if (bridge_pdev) { - /*find bridge info if available */ - pcipriv->ndis_adapter.pcibridge_vendorid = bridge_pdev->vendor; - for (tmp = 0; tmp < PCI_BRIDGE_VENDOR_MAX; tmp++) { - if (bridge_pdev->vendor == pcibridge_vendors[tmp]) { - pcipriv->ndis_adapter.pcibridge_vendor = tmp; - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "Pci Bridge Vendor is found index: %d\n", - tmp); - break; - } - } - } - - if (pcipriv->ndis_adapter.pcibridge_vendor != - PCI_BRIDGE_VENDOR_UNKNOWN) { - pcipriv->ndis_adapter.pcibridge_busnum = - bridge_pdev->bus->number; - pcipriv->ndis_adapter.pcibridge_devnum = - PCI_SLOT(bridge_pdev->devfn); - pcipriv->ndis_adapter.pcibridge_funcnum = - PCI_FUNC(bridge_pdev->devfn); - pcipriv->ndis_adapter.pcibridge_pciehdr_offset = - pci_pcie_cap(bridge_pdev); - pcipriv->ndis_adapter.num4bytes = - (pcipriv->ndis_adapter.pcibridge_pciehdr_offset + 0x10) / 4; - - rtl_pci_get_linkcontrol_field(hw); - - if (pcipriv->ndis_adapter.pcibridge_vendor == - PCI_BRIDGE_VENDOR_AMD) { - pcipriv->ndis_adapter.amd_l1_patch = - rtl_pci_get_amd_l1_patch(hw); - } - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "pcidev busnumber:devnumber:funcnumber:vendor:link_ctl %d:%d:%d:%x:%x\n", - pcipriv->ndis_adapter.busnumber, - pcipriv->ndis_adapter.devnumber, - pcipriv->ndis_adapter.funcnumber, - pdev->vendor, pcipriv->ndis_adapter.linkctrl_reg); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "pci_bridge busnumber:devnumber:funcnumber:vendor:pcie_cap:link_ctl_reg:amd %d:%d:%d:%x:%x:%x:%x\n", - pcipriv->ndis_adapter.pcibridge_busnum, - pcipriv->ndis_adapter.pcibridge_devnum, - pcipriv->ndis_adapter.pcibridge_funcnum, - pcibridge_vendors[pcipriv->ndis_adapter.pcibridge_vendor], - pcipriv->ndis_adapter.pcibridge_pciehdr_offset, - pcipriv->ndis_adapter.pcibridge_linkctrlreg, - pcipriv->ndis_adapter.amd_l1_patch); - - rtl_pci_parse_configuration(pdev, hw); - list_add_tail(&rtlpriv->list, &rtlpriv->glb_var->glb_priv_list); - - return true; -} - -int rtl_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *id) -{ - struct ieee80211_hw *hw = NULL; - - struct rtl_priv *rtlpriv = NULL; - struct rtl_pci_priv *pcipriv = NULL; - struct rtl_pci *rtlpci; - unsigned long pmem_start, pmem_len, pmem_flags; - int err; - - err = pci_enable_device(pdev); - if (err) { - RT_ASSERT(false, "%s : Cannot enable new PCI device\n", - pci_name(pdev)); - return err; - } - - if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { - if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { - RT_ASSERT(false, - "Unable to obtain 32bit DMA for consistent allocations\n"); - err = -ENOMEM; - goto fail1; - } - } - - pci_set_master(pdev); - - hw = ieee80211_alloc_hw(sizeof(struct rtl_pci_priv) + - sizeof(struct rtl_priv), &rtl_ops); - if (!hw) { - RT_ASSERT(false, - "%s : ieee80211 alloc failed\n", pci_name(pdev)); - err = -ENOMEM; - goto fail1; - } - - SET_IEEE80211_DEV(hw, &pdev->dev); - pci_set_drvdata(pdev, hw); - - rtlpriv = hw->priv; - rtlpriv->hw = hw; - pcipriv = (void *)rtlpriv->priv; - pcipriv->dev.pdev = pdev; - init_completion(&rtlpriv->firmware_loading_complete); - - /* init cfg & intf_ops */ - rtlpriv->rtlhal.interface = INTF_PCI; - rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_data); - rtlpriv->intf_ops = &rtl_pci_ops; - rtlpriv->glb_var = &global_var; - - /* - *init dbgp flags before all - *other functions, because we will - *use it in other funtions like - *RT_TRACE/RT_PRINT/RTL_PRINT_DATA - *you can not use these macro - *before this - */ - rtl_dbgp_flag_init(hw); - - /* MEM map */ - err = pci_request_regions(pdev, KBUILD_MODNAME); - if (err) { - RT_ASSERT(false, "Can't obtain PCI resources\n"); - goto fail1; - } - - pmem_start = pci_resource_start(pdev, rtlpriv->cfg->bar_id); - pmem_len = pci_resource_len(pdev, rtlpriv->cfg->bar_id); - pmem_flags = pci_resource_flags(pdev, rtlpriv->cfg->bar_id); - - /*shared mem start */ - rtlpriv->io.pci_mem_start = - (unsigned long)pci_iomap(pdev, - rtlpriv->cfg->bar_id, pmem_len); - if (rtlpriv->io.pci_mem_start == 0) { - RT_ASSERT(false, "Can't map PCI mem\n"); - err = -ENOMEM; - goto fail2; - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "mem mapped space: start: 0x%08lx len:%08lx flags:%08lx, after map:0x%08lx\n", - pmem_start, pmem_len, pmem_flags, - rtlpriv->io.pci_mem_start); - - /* Disable Clk Request */ - pci_write_config_byte(pdev, 0x81, 0); - /* leave D3 mode */ - pci_write_config_byte(pdev, 0x44, 0); - pci_write_config_byte(pdev, 0x04, 0x06); - pci_write_config_byte(pdev, 0x04, 0x07); - - /* find adapter */ - if (!_rtl_pci_find_adapter(pdev, hw)) { - err = -ENODEV; - goto fail3; - } - - /* Init IO handler */ - _rtl_pci_io_handler_init(&pdev->dev, hw); - - /*like read eeprom and so on */ - rtlpriv->cfg->ops->read_eeprom_info(hw); - - /*aspm */ - rtl_pci_init_aspm(hw); - - /* Init mac80211 sw */ - err = rtl_init_core(hw); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Can't allocate sw for mac80211\n"); - goto fail3; - } - - /* Init PCI sw */ - err = rtl_pci_init(hw, pdev); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Failed to init PCI\n"); - goto fail3; - } - - if (rtlpriv->cfg->ops->init_sw_vars(hw)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); - err = -ENODEV; - goto fail3; - } - - rtlpriv->cfg->ops->init_sw_leds(hw); - - err = sysfs_create_group(&pdev->dev.kobj, &rtl_attribute_group); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "failed to create sysfs device attributes\n"); - goto fail3; - } - - rtlpci = rtl_pcidev(pcipriv); - err = request_irq(rtlpci->pdev->irq, &_rtl_pci_interrupt, - IRQF_SHARED, KBUILD_MODNAME, hw); - if (err) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "%s: failed to register IRQ handler\n", - wiphy_name(hw->wiphy)); - goto fail3; - } - rtlpci->irq_alloc = 1; - - return 0; - -fail3: - rtl_deinit_core(hw); - - if (rtlpriv->io.pci_mem_start != 0) - pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start); - -fail2: - pci_release_regions(pdev); - complete(&rtlpriv->firmware_loading_complete); - -fail1: - if (hw) - ieee80211_free_hw(hw); - pci_set_drvdata(pdev, NULL); - pci_disable_device(pdev); - - return err; - -} -EXPORT_SYMBOL(rtl_pci_probe); - -void rtl_pci_disconnect(struct pci_dev *pdev) -{ - struct ieee80211_hw *hw = pci_get_drvdata(pdev); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(pcipriv); - struct rtl_mac *rtlmac = rtl_mac(rtlpriv); - - /* just in case driver is removed before firmware callback */ - wait_for_completion(&rtlpriv->firmware_loading_complete); - clear_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status); - - sysfs_remove_group(&pdev->dev.kobj, &rtl_attribute_group); - - /*ieee80211_unregister_hw will call ops_stop */ - if (rtlmac->mac80211_registered == 1) { - ieee80211_unregister_hw(hw); - rtlmac->mac80211_registered = 0; - } else { - rtl_deinit_deferred_work(hw); - rtlpriv->intf_ops->adapter_stop(hw); - } - rtlpriv->cfg->ops->disable_interrupt(hw); - - /*deinit rfkill */ - rtl_deinit_rfkill(hw); - - rtl_pci_deinit(hw); - rtl_deinit_core(hw); - rtlpriv->cfg->ops->deinit_sw_vars(hw); - - if (rtlpci->irq_alloc) { - synchronize_irq(rtlpci->pdev->irq); - free_irq(rtlpci->pdev->irq, hw); - rtlpci->irq_alloc = 0; - } - - list_del(&rtlpriv->list); - if (rtlpriv->io.pci_mem_start != 0) { - pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start); - pci_release_regions(pdev); - } - - pci_disable_device(pdev); - - rtl_pci_disable_aspm(hw); - - pci_set_drvdata(pdev, NULL); - - ieee80211_free_hw(hw); -} -EXPORT_SYMBOL(rtl_pci_disconnect); - -#ifdef CONFIG_PM_SLEEP -/*************************************** -kernel pci power state define: -PCI_D0 ((pci_power_t __force) 0) -PCI_D1 ((pci_power_t __force) 1) -PCI_D2 ((pci_power_t __force) 2) -PCI_D3hot ((pci_power_t __force) 3) -PCI_D3cold ((pci_power_t __force) 4) -PCI_UNKNOWN ((pci_power_t __force) 5) - -This function is called when system -goes into suspend state mac80211 will -call rtl_mac_stop() from the mac80211 -suspend function first, So there is -no need to call hw_disable here. -****************************************/ -int rtl_pci_suspend(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct ieee80211_hw *hw = pci_get_drvdata(pdev); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->cfg->ops->hw_suspend(hw); - rtl_deinit_rfkill(hw); - - return 0; -} -EXPORT_SYMBOL(rtl_pci_suspend); - -int rtl_pci_resume(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct ieee80211_hw *hw = pci_get_drvdata(pdev); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->cfg->ops->hw_resume(hw); - rtl_init_rfkill(hw); - return 0; -} -EXPORT_SYMBOL(rtl_pci_resume); -#endif /* CONFIG_PM_SLEEP */ - -struct rtl_intf_ops rtl_pci_ops = { - .read_efuse_byte = read_efuse_byte, - .adapter_start = rtl_pci_start, - .adapter_stop = rtl_pci_stop, - .check_buddy_priv = rtl_pci_check_buddy_priv, - .adapter_tx = rtl_pci_tx, - .flush = rtl_pci_flush, - .reset_trx_ring = rtl_pci_reset_trx_ring, - .waitq_insert = rtl_pci_tx_chk_waitq_insert, - - .disable_aspm = rtl_pci_disable_aspm, - .enable_aspm = rtl_pci_enable_aspm, -}; diff --git a/drivers/net/wireless/rtlwifi/pci.h b/drivers/net/wireless/rtlwifi/pci.h deleted file mode 100644 index d3262ec45d23..000000000000 --- a/drivers/net/wireless/rtlwifi/pci.h +++ /dev/null @@ -1,280 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL_PCI_H__ -#define __RTL_PCI_H__ - -#include -/* -1: MSDU packet queue, -2: Rx Command Queue -*/ -#define RTL_PCI_RX_MPDU_QUEUE 0 -#define RTL_PCI_RX_CMD_QUEUE 1 -#define RTL_PCI_MAX_RX_QUEUE 2 - -#define RTL_PCI_MAX_RX_COUNT 64 -#define RTL_PCI_MAX_TX_QUEUE_COUNT 9 - -#define RT_TXDESC_NUM 128 -#define RT_TXDESC_NUM_BE_QUEUE 256 - -#define BK_QUEUE 0 -#define BE_QUEUE 1 -#define VI_QUEUE 2 -#define VO_QUEUE 3 -#define BEACON_QUEUE 4 -#define TXCMD_QUEUE 5 -#define MGNT_QUEUE 6 -#define HIGH_QUEUE 7 -#define HCCA_QUEUE 8 - -#define RTL_PCI_DEVICE(vend, dev, cfg) \ - .vendor = (vend), \ - .device = (dev), \ - .subvendor = PCI_ANY_ID, \ - .subdevice = PCI_ANY_ID,\ - .driver_data = (kernel_ulong_t)&(cfg) - -#define PCI_MAX_BRIDGE_NUMBER 255 -#define PCI_MAX_DEVICES 32 -#define PCI_MAX_FUNCTION 8 - -#define PCI_CONF_ADDRESS 0x0CF8 /*PCI Configuration Space Address */ -#define PCI_CONF_DATA 0x0CFC /*PCI Configuration Space Data */ - -#define U1DONTCARE 0xFF -#define U2DONTCARE 0xFFFF -#define U4DONTCARE 0xFFFFFFFF - -#define RTL_PCI_8192_DID 0x8192 /*8192 PCI-E */ -#define RTL_PCI_8192SE_DID 0x8192 /*8192 SE */ -#define RTL_PCI_8174_DID 0x8174 /*8192 SE */ -#define RTL_PCI_8173_DID 0x8173 /*8191 SE Crab */ -#define RTL_PCI_8172_DID 0x8172 /*8191 SE RE */ -#define RTL_PCI_8171_DID 0x8171 /*8191 SE Unicron */ -#define RTL_PCI_8723AE_DID 0x8723 /*8723AE */ -#define RTL_PCI_0045_DID 0x0045 /*8190 PCI for Ceraga */ -#define RTL_PCI_0046_DID 0x0046 /*8190 Cardbus for Ceraga */ -#define RTL_PCI_0044_DID 0x0044 /*8192e PCIE for Ceraga */ -#define RTL_PCI_0047_DID 0x0047 /*8192e Express Card for Ceraga */ -#define RTL_PCI_700F_DID 0x700F -#define RTL_PCI_701F_DID 0x701F -#define RTL_PCI_DLINK_DID 0x3304 -#define RTL_PCI_8192CET_DID 0x8191 /*8192ce */ -#define RTL_PCI_8192CE_DID 0x8178 /*8192ce */ -#define RTL_PCI_8191CE_DID 0x8177 /*8192ce */ -#define RTL_PCI_8188CE_DID 0x8176 /*8192ce */ -#define RTL_PCI_8192CU_DID 0x8191 /*8192ce */ -#define RTL_PCI_8192DE_DID 0x8193 /*8192de */ -#define RTL_PCI_8192DE_DID2 0x002B /*92DE*/ -#define RTL_PCI_8188EE_DID 0x8179 /*8188ee*/ - -/*8192 support 16 pages of IO registers*/ -#define RTL_MEM_MAPPED_IO_RANGE_8190PCI 0x1000 -#define RTL_MEM_MAPPED_IO_RANGE_8192PCIE 0x4000 -#define RTL_MEM_MAPPED_IO_RANGE_8192SE 0x4000 -#define RTL_MEM_MAPPED_IO_RANGE_8192CE 0x4000 -#define RTL_MEM_MAPPED_IO_RANGE_8192DE 0x4000 - -#define RTL_PCI_REVISION_ID_8190PCI 0x00 -#define RTL_PCI_REVISION_ID_8192PCIE 0x01 -#define RTL_PCI_REVISION_ID_8192SE 0x10 -#define RTL_PCI_REVISION_ID_8192CE 0x1 -#define RTL_PCI_REVISION_ID_8192DE 0x0 - -#define RTL_DEFAULT_HARDWARE_TYPE HARDWARE_TYPE_RTL8192CE - -enum pci_bridge_vendor { - PCI_BRIDGE_VENDOR_INTEL = 0x0, /*0b'0000,0001 */ - PCI_BRIDGE_VENDOR_ATI, /*0b'0000,0010*/ - PCI_BRIDGE_VENDOR_AMD, /*0b'0000,0100*/ - PCI_BRIDGE_VENDOR_SIS, /*0b'0000,1000*/ - PCI_BRIDGE_VENDOR_UNKNOWN, /*0b'0100,0000*/ - PCI_BRIDGE_VENDOR_MAX, -}; - -struct rtl_pci_capabilities_header { - u8 capability_id; - u8 next; -}; - -struct rtl_rx_desc { - u32 dword[8]; -} __packed; - -struct rtl_tx_desc { - u32 dword[16]; -} __packed; - -struct rtl_tx_cmd_desc { - u32 dword[16]; -} __packed; - -struct rtl8192_tx_ring { - struct rtl_tx_desc *desc; - dma_addr_t dma; - unsigned int idx; - unsigned int entries; - struct sk_buff_head queue; -}; - -struct rtl8192_rx_ring { - struct rtl_rx_desc *desc; - dma_addr_t dma; - unsigned int idx; - struct sk_buff *rx_buf[RTL_PCI_MAX_RX_COUNT]; -}; - -struct rtl_pci { - struct pci_dev *pdev; - bool irq_enabled; - - bool driver_is_goingto_unload; - bool up_first_time; - bool first_init; - bool being_init_adapter; - bool init_ready; - - /*Tx */ - struct rtl8192_tx_ring tx_ring[RTL_PCI_MAX_TX_QUEUE_COUNT]; - int txringcount[RTL_PCI_MAX_TX_QUEUE_COUNT]; - u32 transmit_config; - - /*Rx */ - struct rtl8192_rx_ring rx_ring[RTL_PCI_MAX_RX_QUEUE]; - int rxringcount; - u16 rxbuffersize; - u32 receive_config; - - /*irq */ - u8 irq_alloc; - u32 irq_mask[2]; - u32 sys_irq_mask; - - /*Bcn control register setting */ - u32 reg_bcn_ctrl_val; - - /*ASPM*/ u8 const_pci_aspm; - u8 const_amdpci_aspm; - u8 const_hwsw_rfoff_d3; - u8 const_support_pciaspm; - /*pci-e bridge */ - u8 const_hostpci_aspm_setting; - /*pci-e device */ - u8 const_devicepci_aspm_setting; - /*If it supports ASPM, Offset[560h] = 0x40, - otherwise Offset[560h] = 0x00. */ - bool support_aspm; - bool support_backdoor; - - /*QOS & EDCA */ - enum acm_method acm_method; - - u16 shortretry_limit; - u16 longretry_limit; -}; - -struct mp_adapter { - u8 linkctrl_reg; - - u8 busnumber; - u8 devnumber; - u8 funcnumber; - - u8 pcibridge_busnum; - u8 pcibridge_devnum; - u8 pcibridge_funcnum; - - u8 pcibridge_vendor; - u16 pcibridge_vendorid; - u16 pcibridge_deviceid; - - u8 num4bytes; - - u8 pcibridge_pciehdr_offset; - u8 pcibridge_linkctrlreg; - - bool amd_l1_patch; -}; - -struct rtl_pci_priv { - struct rtl_pci dev; - struct mp_adapter ndis_adapter; - struct rtl_led_ctl ledctl; - struct bt_coexist_info bt_coexist; -}; - -#define rtl_pcipriv(hw) (((struct rtl_pci_priv *)(rtl_priv(hw))->priv)) -#define rtl_pcidev(pcipriv) (&((pcipriv)->dev)) - -int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw); - -extern struct rtl_intf_ops rtl_pci_ops; - -int rtl_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *id); -void rtl_pci_disconnect(struct pci_dev *pdev); -#ifdef CONFIG_PM_SLEEP -int rtl_pci_suspend(struct device *dev); -int rtl_pci_resume(struct device *dev); -#endif /* CONFIG_PM_SLEEP */ -static inline u8 pci_read8_sync(struct rtl_priv *rtlpriv, u32 addr) -{ - return readb((u8 __iomem *) rtlpriv->io.pci_mem_start + addr); -} - -static inline u16 pci_read16_sync(struct rtl_priv *rtlpriv, u32 addr) -{ - return readw((u8 __iomem *) rtlpriv->io.pci_mem_start + addr); -} - -static inline u32 pci_read32_sync(struct rtl_priv *rtlpriv, u32 addr) -{ - return readl((u8 __iomem *) rtlpriv->io.pci_mem_start + addr); -} - -static inline void pci_write8_async(struct rtl_priv *rtlpriv, u32 addr, u8 val) -{ - writeb(val, (u8 __iomem *) rtlpriv->io.pci_mem_start + addr); -} - -static inline void pci_write16_async(struct rtl_priv *rtlpriv, - u32 addr, u16 val) -{ - writew(val, (u8 __iomem *) rtlpriv->io.pci_mem_start + addr); -} - -static inline void pci_write32_async(struct rtl_priv *rtlpriv, - u32 addr, u32 val) -{ - writel(val, (u8 __iomem *) rtlpriv->io.pci_mem_start + addr); -} - -#endif diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c deleted file mode 100644 index 71e917db8338..000000000000 --- a/drivers/net/wireless/rtlwifi/ps.c +++ /dev/null @@ -1,936 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include -#include "wifi.h" -#include "base.h" -#include "ps.h" - -bool rtl_ps_enable_nic(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - /*<1> reset trx ring */ - if (rtlhal->interface == INTF_PCI) - rtlpriv->intf_ops->reset_trx_ring(hw); - - if (is_hal_stop(rtlhal)) - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Driver is already down!\n"); - - /*<2> Enable Adapter */ - if (rtlpriv->cfg->ops->hw_init(hw)) - return 1; - RT_CLEAR_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - - /*<3> Enable Interrupt */ - rtlpriv->cfg->ops->enable_interrupt(hw); - - /* */ - rtl_watch_dog_timer_callback((unsigned long)hw); - - return true; -} -EXPORT_SYMBOL(rtl_ps_enable_nic); - -bool rtl_ps_disable_nic(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - /*<1> Stop all timer */ - rtl_deinit_deferred_work(hw); - - /*<2> Disable Interrupt */ - rtlpriv->cfg->ops->disable_interrupt(hw); - tasklet_kill(&rtlpriv->works.irq_tasklet); - - /*<3> Disable Adapter */ - rtlpriv->cfg->ops->hw_disable(hw); - - return true; -} -EXPORT_SYMBOL(rtl_ps_disable_nic); - -bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, - enum rf_pwrstate state_toset, - u32 changesource) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool actionallowed = false; - - switch (state_toset) { - case ERFON: - ppsc->rfoff_reason &= (~changesource); - - if ((changesource == RF_CHANGE_BY_HW) && - (ppsc->hwradiooff)) { - ppsc->hwradiooff = false; - } - - if (!ppsc->rfoff_reason) { - ppsc->rfoff_reason = 0; - actionallowed = true; - } - - break; - - case ERFOFF: - - if ((changesource == RF_CHANGE_BY_HW) && !ppsc->hwradiooff) { - ppsc->hwradiooff = true; - } - - ppsc->rfoff_reason |= changesource; - actionallowed = true; - break; - - case ERFSLEEP: - ppsc->rfoff_reason |= changesource; - actionallowed = true; - break; - - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - - if (actionallowed) - rtlpriv->cfg->ops->set_rf_power_state(hw, state_toset); - - return actionallowed; -} -EXPORT_SYMBOL(rtl_ps_set_rf_state); - -static void _rtl_ps_inactive_ps(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - ppsc->swrf_processing = true; - - if (ppsc->inactive_pwrstate == ERFON && - rtlhal->interface == INTF_PCI) { - if ((ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM) && - RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM) && - rtlhal->interface == INTF_PCI) { - rtlpriv->intf_ops->disable_aspm(hw); - RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); - } - } - - rtl_ps_set_rf_state(hw, ppsc->inactive_pwrstate, RF_CHANGE_BY_IPS); - - if (ppsc->inactive_pwrstate == ERFOFF && - rtlhal->interface == INTF_PCI) { - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && - !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) { - rtlpriv->intf_ops->enable_aspm(hw); - RT_SET_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); - } - } - - ppsc->swrf_processing = false; -} - -void rtl_ips_nic_off_wq_callback(void *data) -{ - struct rtl_works *rtlworks = - container_of_dwork_rtl(data, struct rtl_works, ips_nic_off_wq); - struct ieee80211_hw *hw = rtlworks->hw; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - enum rf_pwrstate rtstate; - - if (mac->opmode != NL80211_IFTYPE_STATION) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "not station return\n"); - return; - } - - if (mac->p2p_in_use) - return; - - if (mac->link_state > MAC80211_NOLINK) - return; - - if (is_hal_stop(rtlhal)) - return; - - if (rtlpriv->sec.being_setkey) - return; - - if (rtlpriv->cfg->ops->bt_coex_off_before_lps) - rtlpriv->cfg->ops->bt_coex_off_before_lps(hw); - - if (ppsc->inactiveps) { - rtstate = ppsc->rfpwr_state; - - /* - *Do not enter IPS in the following conditions: - *(1) RF is already OFF or Sleep - *(2) swrf_processing (indicates the IPS is still under going) - *(3) Connectted (only disconnected can trigger IPS) - *(4) IBSS (send Beacon) - *(5) AP mode (send Beacon) - *(6) monitor mode (rcv packet) - */ - - if (rtstate == ERFON && - !ppsc->swrf_processing && - (mac->link_state == MAC80211_NOLINK) && - !mac->act_scanning) { - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "IPSEnter(): Turn off RF\n"); - - ppsc->inactive_pwrstate = ERFOFF; - ppsc->in_powersavemode = true; - - /*rtl_pci_reset_trx_ring(hw); */ - _rtl_ps_inactive_ps(hw); - } - } -} - -void rtl_ips_nic_off(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - /* - *because when link with ap, mac80211 will ask us - *to disable nic quickly after scan before linking, - *this will cause link failed, so we delay 100ms here - */ - queue_delayed_work(rtlpriv->works.rtl_wq, - &rtlpriv->works.ips_nic_off_wq, MSECS(100)); -} - -/* NOTICE: any opmode should exc nic_on, or disable without - * nic_on may something wrong, like adhoc TP - */ -void rtl_ips_nic_on(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - enum rf_pwrstate rtstate; - unsigned long flags; - - if (mac->opmode != NL80211_IFTYPE_STATION) - return; - - spin_lock_irqsave(&rtlpriv->locks.ips_lock, flags); - - if (ppsc->inactiveps) { - rtstate = ppsc->rfpwr_state; - - if (rtstate != ERFON && - !ppsc->swrf_processing && - ppsc->rfoff_reason <= RF_CHANGE_BY_IPS) { - - ppsc->inactive_pwrstate = ERFON; - ppsc->in_powersavemode = false; - - _rtl_ps_inactive_ps(hw); - } - } - - spin_unlock_irqrestore(&rtlpriv->locks.ips_lock, flags); -} - -/*for FW LPS*/ - -/* - *Determine if we can set Fw into PS mode - *in current condition.Return TRUE if it - *can enter PS mode. - */ -static bool rtl_get_fwlps_doze(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - u32 ps_timediff; - - ps_timediff = jiffies_to_msecs(jiffies - - ppsc->last_delaylps_stamp_jiffies); - - if (ps_timediff < 2000) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Delay enter Fw LPS for DHCP, ARP, or EAPOL exchanging state\n"); - return false; - } - - if (mac->link_state != MAC80211_LINKED) - return false; - - if (mac->opmode == NL80211_IFTYPE_ADHOC) - return false; - - return true; -} - -/* Change current and default preamble mode.*/ -static void rtl_lps_set_psmode(struct ieee80211_hw *hw, u8 rt_psmode) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool enter_fwlps; - - if (mac->opmode == NL80211_IFTYPE_ADHOC) - return; - - if (mac->link_state != MAC80211_LINKED) - return; - - if (ppsc->dot11_psmode == rt_psmode) - return; - - /* Update power save mode configured. */ - ppsc->dot11_psmode = rt_psmode; - - /* - * - *1. Enter PS mode - * Set RPWM to Fw to turn RF off and send H2C fw_pwrmode - * cmd to set Fw into PS mode. - *2. Leave PS mode - * Send H2C fw_pwrmode cmd to Fw to set Fw into Active - * mode and set RPWM to turn RF on. - */ - - if ((ppsc->fwctrl_lps) && ppsc->report_linked) { - if (ppsc->dot11_psmode == EACTIVE) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "FW LPS leave ps_mode:%x\n", - FW_PS_ACTIVE_MODE); - enter_fwlps = false; - ppsc->pwr_mode = FW_PS_ACTIVE_MODE; - ppsc->smart_ps = 0; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_FW_LPS_ACTION, - (u8 *)(&enter_fwlps)); - if (ppsc->p2p_ps_info.opp_ps) - rtl_p2p_ps_cmd(hw, P2P_PS_ENABLE); - - } else { - if (rtl_get_fwlps_doze(hw)) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "FW LPS enter ps_mode:%x\n", - ppsc->fwctrl_psmode); - enter_fwlps = true; - ppsc->pwr_mode = ppsc->fwctrl_psmode; - ppsc->smart_ps = 2; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_FW_LPS_ACTION, - (u8 *)(&enter_fwlps)); - - } else { - /* Reset the power save related parameters. */ - ppsc->dot11_psmode = EACTIVE; - } - } - } -} - -/*Enter the leisure power save mode.*/ -void rtl_lps_enter(struct ieee80211_hw *hw) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (!ppsc->fwctrl_lps) - return; - - if (rtlpriv->sec.being_setkey) - return; - - if (rtlpriv->link_info.busytraffic) - return; - - /*sleep after linked 10s, to let DHCP and 4-way handshake ok enough!! */ - if (mac->cnt_after_linked < 5) - return; - - if (mac->opmode == NL80211_IFTYPE_ADHOC) - return; - - if (mac->link_state != MAC80211_LINKED) - return; - - mutex_lock(&rtlpriv->locks.ps_mutex); - - /* Idle for a while if we connect to AP a while ago. */ - if (mac->cnt_after_linked >= 2) { - if (ppsc->dot11_psmode == EACTIVE) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Enter 802.11 power save mode...\n"); - - rtl_lps_set_psmode(hw, EAUTOPS); - } - } - - mutex_unlock(&rtlpriv->locks.ps_mutex); -} - -/*Leave the leisure power save mode.*/ -void rtl_lps_leave(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - mutex_lock(&rtlpriv->locks.ps_mutex); - - if (ppsc->fwctrl_lps) { - if (ppsc->dot11_psmode != EACTIVE) { - - /*FIX ME */ - rtlpriv->cfg->ops->enable_interrupt(hw); - - if (ppsc->reg_rfps_level & RT_RF_LPS_LEVEL_ASPM && - RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM) && - rtlhal->interface == INTF_PCI) { - rtlpriv->intf_ops->disable_aspm(hw); - RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); - } - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Busy Traffic,Leave 802.11 power save..\n"); - - rtl_lps_set_psmode(hw, EACTIVE); - } - } - mutex_unlock(&rtlpriv->locks.ps_mutex); -} - -/* For sw LPS*/ -void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct ieee80211_hdr *hdr = data; - struct ieee80211_tim_ie *tim_ie; - u8 *tim; - u8 tim_len; - bool u_buffed; - bool m_buffed; - - if (mac->opmode != NL80211_IFTYPE_STATION) - return; - - if (!rtlpriv->psc.swctrl_lps) - return; - - if (rtlpriv->mac80211.link_state != MAC80211_LINKED) - return; - - if (!rtlpriv->psc.sw_ps_enabled) - return; - - if (rtlpriv->psc.fwctrl_lps) - return; - - if (likely(!(hw->conf.flags & IEEE80211_CONF_PS))) - return; - - /* check if this really is a beacon */ - if (!ieee80211_is_beacon(hdr->frame_control)) - return; - - /* min. beacon length + FCS_LEN */ - if (len <= 40 + FCS_LEN) - return; - - /* and only beacons from the associated BSSID, please */ - if (!ether_addr_equal(hdr->addr3, rtlpriv->mac80211.bssid)) - return; - - rtlpriv->psc.last_beacon = jiffies; - - tim = rtl_find_ie(data, len - FCS_LEN, WLAN_EID_TIM); - if (!tim) - return; - - if (tim[1] < sizeof(*tim_ie)) - return; - - tim_len = tim[1]; - tim_ie = (struct ieee80211_tim_ie *) &tim[2]; - - if (!WARN_ON_ONCE(!hw->conf.ps_dtim_period)) - rtlpriv->psc.dtim_counter = tim_ie->dtim_count; - - /* Check whenever the PHY can be turned off again. */ - - /* 1. What about buffered unicast traffic for our AID? */ - u_buffed = ieee80211_check_tim(tim_ie, tim_len, - rtlpriv->mac80211.assoc_id); - - /* 2. Maybe the AP wants to send multicast/broadcast data? */ - m_buffed = tim_ie->bitmap_ctrl & 0x01; - rtlpriv->psc.multi_buffered = m_buffed; - - /* unicast will process by mac80211 through - * set ~IEEE80211_CONF_PS, So we just check - * multicast frames here */ - if (!m_buffed) { - /* back to low-power land. and delay is - * prevent null power save frame tx fail */ - queue_delayed_work(rtlpriv->works.rtl_wq, - &rtlpriv->works.ps_work, MSECS(5)); - } else { - RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, - "u_bufferd: %x, m_buffered: %x\n", u_buffed, m_buffed); - } -} - -void rtl_swlps_rf_awake(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - if (!rtlpriv->psc.swctrl_lps) - return; - if (mac->link_state != MAC80211_LINKED) - return; - - if (ppsc->reg_rfps_level & RT_RF_LPS_LEVEL_ASPM && - RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) { - rtlpriv->intf_ops->disable_aspm(hw); - RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); - } - - mutex_lock(&rtlpriv->locks.ps_mutex); - rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS); - mutex_unlock(&rtlpriv->locks.ps_mutex); -} - -void rtl_swlps_rfon_wq_callback(void *data) -{ - struct rtl_works *rtlworks = - container_of_dwork_rtl(data, struct rtl_works, ps_rfon_wq); - struct ieee80211_hw *hw = rtlworks->hw; - - rtl_swlps_rf_awake(hw); -} - -void rtl_swlps_rf_sleep(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - u8 sleep_intv; - - if (!rtlpriv->psc.sw_ps_enabled) - return; - - if ((rtlpriv->sec.being_setkey) || - (mac->opmode == NL80211_IFTYPE_ADHOC)) - return; - - /*sleep after linked 10s, to let DHCP and 4-way handshake ok enough!! */ - if ((mac->link_state != MAC80211_LINKED) || (mac->cnt_after_linked < 5)) - return; - - if (rtlpriv->link_info.busytraffic) - return; - - mutex_lock(&rtlpriv->locks.ps_mutex); - rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS); - mutex_unlock(&rtlpriv->locks.ps_mutex); - - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && - !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) { - rtlpriv->intf_ops->enable_aspm(hw); - RT_SET_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); - } - - /* here is power save alg, when this beacon is DTIM - * we will set sleep time to dtim_period * n; - * when this beacon is not DTIM, we will set sleep - * time to sleep_intv = rtlpriv->psc.dtim_counter or - * MAX_SW_LPS_SLEEP_INTV(default set to 5) */ - - if (rtlpriv->psc.dtim_counter == 0) { - if (hw->conf.ps_dtim_period == 1) - sleep_intv = hw->conf.ps_dtim_period * 2; - else - sleep_intv = hw->conf.ps_dtim_period; - } else { - sleep_intv = rtlpriv->psc.dtim_counter; - } - - if (sleep_intv > MAX_SW_LPS_SLEEP_INTV) - sleep_intv = MAX_SW_LPS_SLEEP_INTV; - - /* this print should always be dtim_conter = 0 & - * sleep = dtim_period, that meaons, we should - * awake before every dtim */ - RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, - "dtim_counter:%x will sleep :%d beacon_intv\n", - rtlpriv->psc.dtim_counter, sleep_intv); - - /* we tested that 40ms is enough for sw & hw sw delay */ - queue_delayed_work(rtlpriv->works.rtl_wq, &rtlpriv->works.ps_rfon_wq, - MSECS(sleep_intv * mac->vif->bss_conf.beacon_int - 40)); -} - -void rtl_lps_change_work_callback(struct work_struct *work) -{ - struct rtl_works *rtlworks = - container_of(work, struct rtl_works, lps_change_work); - struct ieee80211_hw *hw = rtlworks->hw; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->enter_ps) - rtl_lps_enter(hw); - else - rtl_lps_leave(hw); -} - -void rtl_swlps_wq_callback(void *data) -{ - struct rtl_works *rtlworks = container_of_dwork_rtl(data, - struct rtl_works, - ps_work); - struct ieee80211_hw *hw = rtlworks->hw; - struct rtl_priv *rtlpriv = rtl_priv(hw); - bool ps = false; - - ps = (hw->conf.flags & IEEE80211_CONF_PS); - - /* we can sleep after ps null send ok */ - if (rtlpriv->psc.state_inap) { - rtl_swlps_rf_sleep(hw); - - if (rtlpriv->psc.state && !ps) { - rtlpriv->psc.sleep_ms = jiffies_to_msecs(jiffies - - rtlpriv->psc.last_action); - } - - if (ps) - rtlpriv->psc.last_slept = jiffies; - - rtlpriv->psc.last_action = jiffies; - rtlpriv->psc.state = ps; - } -} - -static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data, - unsigned int len) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct ieee80211_mgmt *mgmt = (void *)data; - struct rtl_p2p_ps_info *p2pinfo = &(rtlpriv->psc.p2p_ps_info); - u8 *pos, *end, *ie; - u16 noa_len; - static u8 p2p_oui_ie_type[4] = {0x50, 0x6f, 0x9a, 0x09}; - u8 noa_num, index, i, noa_index = 0; - bool find_p2p_ie = false , find_p2p_ps_ie = false; - pos = (u8 *)mgmt->u.beacon.variable; - end = data + len; - ie = NULL; - - while (pos + 1 < end) { - if (pos + 2 + pos[1] > end) - return; - - if (pos[0] == 221 && pos[1] > 4) { - if (memcmp(&pos[2], p2p_oui_ie_type, 4) == 0) { - ie = pos + 2+4; - break; - } - } - pos += 2 + pos[1]; - } - - if (ie == NULL) - return; - find_p2p_ie = true; - /*to find noa ie*/ - while (ie + 1 < end) { - noa_len = READEF2BYTE(&ie[1]); - if (ie + 3 + ie[1] > end) - return; - - if (ie[0] == 12) { - find_p2p_ps_ie = true; - if ((noa_len - 2) % 13 != 0) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "P2P notice of absence: invalid length.%d\n", - noa_len); - return; - } else { - noa_num = (noa_len - 2) / 13; - } - noa_index = ie[3]; - if (rtlpriv->psc.p2p_ps_info.p2p_ps_mode == - P2P_PS_NONE || noa_index != p2pinfo->noa_index) { - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, - "update NOA ie.\n"); - p2pinfo->noa_index = noa_index; - p2pinfo->opp_ps = (ie[4] >> 7); - p2pinfo->ctwindow = ie[4] & 0x7F; - p2pinfo->noa_num = noa_num; - index = 5; - for (i = 0; i < noa_num; i++) { - p2pinfo->noa_count_type[i] = - READEF1BYTE(ie+index); - index += 1; - p2pinfo->noa_duration[i] = - READEF4BYTE(ie+index); - index += 4; - p2pinfo->noa_interval[i] = - READEF4BYTE(ie+index); - index += 4; - p2pinfo->noa_start_time[i] = - READEF4BYTE(ie+index); - index += 4; - } - - if (p2pinfo->opp_ps == 1) { - p2pinfo->p2p_ps_mode = P2P_PS_CTWINDOW; - /* Driver should wait LPS entering - * CTWindow - */ - if (rtlpriv->psc.fw_current_inpsmode) - rtl_p2p_ps_cmd(hw, - P2P_PS_ENABLE); - } else if (p2pinfo->noa_num > 0) { - p2pinfo->p2p_ps_mode = P2P_PS_NOA; - rtl_p2p_ps_cmd(hw, P2P_PS_ENABLE); - } else if (p2pinfo->p2p_ps_mode > P2P_PS_NONE) { - rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE); - } - } - break; - } - ie += 3 + noa_len; - } - - if (find_p2p_ie == true) { - if ((p2pinfo->p2p_ps_mode > P2P_PS_NONE) && - (find_p2p_ps_ie == false)) - rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE); - } -} - -static void rtl_p2p_action_ie(struct ieee80211_hw *hw, void *data, - unsigned int len) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct ieee80211_mgmt *mgmt = (void *)data; - struct rtl_p2p_ps_info *p2pinfo = &(rtlpriv->psc.p2p_ps_info); - u8 noa_num, index, i, noa_index = 0; - u8 *pos, *end, *ie; - u16 noa_len; - static u8 p2p_oui_ie_type[4] = {0x50, 0x6f, 0x9a, 0x09}; - - pos = (u8 *)&mgmt->u.action.category; - end = data + len; - ie = NULL; - - if (pos[0] == 0x7f) { - if (memcmp(&pos[1], p2p_oui_ie_type, 4) == 0) - ie = pos + 3+4; - } - - if (ie == NULL) - return; - - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "action frame find P2P IE.\n"); - /*to find noa ie*/ - while (ie + 1 < end) { - noa_len = READEF2BYTE(&ie[1]); - if (ie + 3 + ie[1] > end) - return; - - if (ie[0] == 12) { - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "find NOA IE.\n"); - RT_PRINT_DATA(rtlpriv, COMP_FW, DBG_LOUD, "noa ie ", - ie, noa_len); - if ((noa_len - 2) % 13 != 0) { - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, - "P2P notice of absence: invalid length.%d\n", - noa_len); - return; - } else { - noa_num = (noa_len - 2) / 13; - } - noa_index = ie[3]; - if (rtlpriv->psc.p2p_ps_info.p2p_ps_mode == - P2P_PS_NONE || noa_index != p2pinfo->noa_index) { - p2pinfo->noa_index = noa_index; - p2pinfo->opp_ps = (ie[4] >> 7); - p2pinfo->ctwindow = ie[4] & 0x7F; - p2pinfo->noa_num = noa_num; - index = 5; - for (i = 0; i < noa_num; i++) { - p2pinfo->noa_count_type[i] = - READEF1BYTE(ie+index); - index += 1; - p2pinfo->noa_duration[i] = - READEF4BYTE(ie+index); - index += 4; - p2pinfo->noa_interval[i] = - READEF4BYTE(ie+index); - index += 4; - p2pinfo->noa_start_time[i] = - READEF4BYTE(ie+index); - index += 4; - } - - if (p2pinfo->opp_ps == 1) { - p2pinfo->p2p_ps_mode = P2P_PS_CTWINDOW; - /* Driver should wait LPS entering - * CTWindow - */ - if (rtlpriv->psc.fw_current_inpsmode) - rtl_p2p_ps_cmd(hw, - P2P_PS_ENABLE); - } else if (p2pinfo->noa_num > 0) { - p2pinfo->p2p_ps_mode = P2P_PS_NOA; - rtl_p2p_ps_cmd(hw, P2P_PS_ENABLE); - } else if (p2pinfo->p2p_ps_mode > P2P_PS_NONE) { - rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE); - } - } - break; - } - ie += 3 + noa_len; - } -} - -void rtl_p2p_ps_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *rtlps = rtl_psc(rtl_priv(hw)); - struct rtl_p2p_ps_info *p2pinfo = &(rtlpriv->psc.p2p_ps_info); - - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, " p2p state %x\n", p2p_ps_state); - switch (p2p_ps_state) { - case P2P_PS_DISABLE: - p2pinfo->p2p_ps_state = p2p_ps_state; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_P2P_PS_OFFLOAD, - (u8 *)(&p2p_ps_state)); - - p2pinfo->noa_index = 0; - p2pinfo->ctwindow = 0; - p2pinfo->opp_ps = 0; - p2pinfo->noa_num = 0; - p2pinfo->p2p_ps_mode = P2P_PS_NONE; - if (rtlps->fw_current_inpsmode == true) { - if (rtlps->smart_ps == 0) { - rtlps->smart_ps = 2; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_PWRMODE, - (u8 *)(&rtlps->pwr_mode)); - } - } - break; - case P2P_PS_ENABLE: - if (p2pinfo->p2p_ps_mode > P2P_PS_NONE) { - p2pinfo->p2p_ps_state = p2p_ps_state; - - if (p2pinfo->ctwindow > 0) { - if (rtlps->smart_ps != 0) { - rtlps->smart_ps = 0; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_PWRMODE, - (u8 *)(&rtlps->pwr_mode)); - } - } - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_P2P_PS_OFFLOAD, - (u8 *)(&p2p_ps_state)); - } - break; - case P2P_PS_SCAN: - case P2P_PS_SCAN_DONE: - case P2P_PS_ALLSTASLEEP: - if (p2pinfo->p2p_ps_mode > P2P_PS_NONE) { - p2pinfo->p2p_ps_state = p2p_ps_state; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_P2P_PS_OFFLOAD, - (u8 *)(&p2p_ps_state)); - } - break; - default: - break; - } - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, - "ctwindow %x oppps %x\n", p2pinfo->ctwindow, p2pinfo->opp_ps); - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, - "count %x duration %x index %x interval %x start time %x noa num %x\n", - p2pinfo->noa_count_type[0], p2pinfo->noa_duration[0], - p2pinfo->noa_index, p2pinfo->noa_interval[0], - p2pinfo->noa_start_time[0], p2pinfo->noa_num); - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "end\n"); -} - -void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct ieee80211_hdr *hdr = (void *)data; - - if (!mac->p2p) - return; - if (mac->link_state != MAC80211_LINKED) - return; - /* min. beacon length + FCS_LEN */ - if (len <= 40 + FCS_LEN) - return; - - /* and only beacons from the associated BSSID, please */ - if (compare_ether_addr(hdr->addr3, rtlpriv->mac80211.bssid)) - return; - - /* check if this really is a beacon */ - if (!(ieee80211_is_beacon(hdr->frame_control) || - ieee80211_is_probe_resp(hdr->frame_control) || - ieee80211_is_action(hdr->frame_control))) - return; - - if (ieee80211_is_action(hdr->frame_control)) - rtl_p2p_action_ie(hw, data, len - FCS_LEN); - else - rtl_p2p_noa_ie(hw, data, len - FCS_LEN); -} diff --git a/drivers/net/wireless/rtlwifi/ps.h b/drivers/net/wireless/rtlwifi/ps.h deleted file mode 100644 index 88bd76ea88f7..000000000000 --- a/drivers/net/wireless/rtlwifi/ps.h +++ /dev/null @@ -1,54 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __REALTEK_RTL_PCI_PS_H__ -#define __REALTEK_RTL_PCI_PS_H__ - -#define MAX_SW_LPS_SLEEP_INTV 5 - -bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, - enum rf_pwrstate state_toset, u32 changesource); -bool rtl_ps_enable_nic(struct ieee80211_hw *hw); -bool rtl_ps_disable_nic(struct ieee80211_hw *hw); -void rtl_ips_nic_off(struct ieee80211_hw *hw); -void rtl_ips_nic_on(struct ieee80211_hw *hw); -void rtl_ips_nic_off_wq_callback(void *data); -void rtl_lps_enter(struct ieee80211_hw *hw); -void rtl_lps_leave(struct ieee80211_hw *hw); - -void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len); -void rtl_swlps_wq_callback(void *data); -void rtl_swlps_rfon_wq_callback(void *data); -void rtl_swlps_rf_awake(struct ieee80211_hw *hw); -void rtl_swlps_rf_sleep(struct ieee80211_hw *hw); -void rtl_p2p_ps_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); -void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len); -void rtl_lps_change_work_callback(struct work_struct *work); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rc.c b/drivers/net/wireless/rtlwifi/rc.c deleted file mode 100644 index f9f059dadb73..000000000000 --- a/drivers/net/wireless/rtlwifi/rc.c +++ /dev/null @@ -1,282 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "wifi.h" -#include "base.h" -#include "rc.h" - -/* - *Finds the highest rate index we can use - *if skb is special data like DHCP/EAPOL, we set should - *it to lowest rate CCK_1M, otherwise we set rate to - *CCK11M or OFDM_54M based on wireless mode. - */ -static u8 _rtl_rc_get_highest_rix(struct rtl_priv *rtlpriv, - struct ieee80211_sta *sta, - struct sk_buff *skb, bool not_data) -{ - struct rtl_mac *rtlmac = rtl_mac(rtlpriv); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_sta_info *sta_entry = NULL; - u8 wireless_mode = 0; - - /* - *this rate is no use for true rate, firmware - *will control rate at all it just used for - *1.show in iwconfig in B/G mode - *2.in rtl_get_tcb_desc when we check rate is - * 1M we will not use FW rate but user rate. - */ - if (rtlmac->opmode == NL80211_IFTYPE_AP || - rtlmac->opmode == NL80211_IFTYPE_ADHOC || - rtlmac->opmode == NL80211_IFTYPE_MESH_POINT) { - if (sta) { - sta_entry = (struct rtl_sta_info *) sta->drv_priv; - wireless_mode = sta_entry->wireless_mode; - } else { - return 0; - } - } else { - wireless_mode = rtlmac->mode; - } - - if (rtl_is_special_data(rtlpriv->mac80211.hw, skb, true) || - not_data) { - return 0; - } else { - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - if (wireless_mode == WIRELESS_MODE_B) { - return B_MODE_MAX_RIX; - } else if (wireless_mode == WIRELESS_MODE_G) { - return G_MODE_MAX_RIX; - } else { - if (get_rf_type(rtlphy) != RF_2T2R) - return N_MODE_MCS7_RIX; - else - return N_MODE_MCS15_RIX; - } - } else { - if (wireless_mode == WIRELESS_MODE_A) { - return A_MODE_MAX_RIX; - } else { - if (get_rf_type(rtlphy) != RF_2T2R) - return N_MODE_MCS7_RIX; - else - return N_MODE_MCS15_RIX; - } - } - } -} - -static void _rtl_rc_rate_set_series(struct rtl_priv *rtlpriv, - struct ieee80211_sta *sta, - struct ieee80211_tx_rate *rate, - struct ieee80211_tx_rate_control *txrc, - u8 tries, char rix, int rtsctsenable, - bool not_data) -{ - struct rtl_mac *mac = rtl_mac(rtlpriv); - u8 sgi_20 = 0, sgi_40 = 0; - - if (sta) { - sgi_20 = sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20; - sgi_40 = sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40; - } - rate->count = tries; - rate->idx = rix >= 0x00 ? rix : 0x00; - - if (!not_data) { - if (txrc->short_preamble) - rate->flags |= IEEE80211_TX_RC_USE_SHORT_PREAMBLE; - if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) { - if (sta && (sta->bandwidth >= IEEE80211_STA_RX_BW_40)) - rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; - } else { - if (mac->bw_40) - rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; - } - if (sgi_20 || sgi_40) - rate->flags |= IEEE80211_TX_RC_SHORT_GI; - if (sta && sta->ht_cap.ht_supported) - rate->flags |= IEEE80211_TX_RC_MCS; - } -} - -static void rtl_get_rate(void *ppriv, struct ieee80211_sta *sta, - void *priv_sta, struct ieee80211_tx_rate_control *txrc) -{ - struct rtl_priv *rtlpriv = ppriv; - struct sk_buff *skb = txrc->skb; - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_tx_rate *rates = tx_info->control.rates; - __le16 fc = rtl_get_fc(skb); - u8 try_per_rate, i, rix; - bool not_data = !ieee80211_is_data(fc); - - if (rate_control_send_low(sta, priv_sta, txrc)) - return; - - rix = _rtl_rc_get_highest_rix(rtlpriv, sta, skb, not_data); - try_per_rate = 1; - _rtl_rc_rate_set_series(rtlpriv, sta, &rates[0], txrc, - try_per_rate, rix, 1, not_data); - - if (!not_data) { - for (i = 1; i < 4; i++) - _rtl_rc_rate_set_series(rtlpriv, sta, &rates[i], - txrc, i, (rix - i), 1, - not_data); - } -} - -static bool _rtl_tx_aggr_check(struct rtl_priv *rtlpriv, - struct rtl_sta_info *sta_entry, u16 tid) -{ - struct rtl_mac *mac = rtl_mac(rtlpriv); - - if (mac->act_scanning) - return false; - - if (mac->opmode == NL80211_IFTYPE_STATION && - mac->cnt_after_linked < 3) - return false; - - if (sta_entry->tids[tid].agg.agg_state == RTL_AGG_STOP) - return true; - - return false; -} - -/*mac80211 Rate Control callbacks*/ -static void rtl_tx_status(void *ppriv, - struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta, - struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = ppriv; - struct rtl_mac *mac = rtl_mac(rtlpriv); - struct ieee80211_hdr *hdr = rtl_get_hdr(skb); - __le16 fc = rtl_get_fc(skb); - struct rtl_sta_info *sta_entry; - - if (!priv_sta || !ieee80211_is_data(fc)) - return; - - if (rtl_is_special_data(mac->hw, skb, true)) - return; - - if (is_multicast_ether_addr(ieee80211_get_DA(hdr)) - || is_broadcast_ether_addr(ieee80211_get_DA(hdr))) - return; - - if (sta) { - /* Check if aggregation has to be enabled for this tid */ - sta_entry = (struct rtl_sta_info *) sta->drv_priv; - if ((sta->ht_cap.ht_supported) && - !(skb->protocol == cpu_to_be16(ETH_P_PAE))) { - if (ieee80211_is_data_qos(fc)) { - u8 tid = rtl_get_tid(skb); - if (_rtl_tx_aggr_check(rtlpriv, sta_entry, - tid)) { - sta_entry->tids[tid].agg.agg_state = - RTL_AGG_PROGRESS; - ieee80211_start_tx_ba_session(sta, - tid, 5000); - } - } - } - } -} - -static void rtl_rate_init(void *ppriv, - struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta) -{ -} - -static void *rtl_rate_alloc(struct ieee80211_hw *hw, - struct dentry *debugfsdir) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - return rtlpriv; -} - -static void rtl_rate_free(void *rtlpriv) -{ - return; -} - -static void *rtl_rate_alloc_sta(void *ppriv, - struct ieee80211_sta *sta, gfp_t gfp) -{ - struct rtl_priv *rtlpriv = ppriv; - struct rtl_rate_priv *rate_priv; - - rate_priv = kzalloc(sizeof(struct rtl_rate_priv), gfp); - if (!rate_priv) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Unable to allocate private rc structure\n"); - return NULL; - } - - rtlpriv->rate_priv = rate_priv; - - return rate_priv; -} - -static void rtl_rate_free_sta(void *rtlpriv, - struct ieee80211_sta *sta, void *priv_sta) -{ - struct rtl_rate_priv *rate_priv = priv_sta; - kfree(rate_priv); -} - -static struct rate_control_ops rtl_rate_ops = { - .module = NULL, - .name = "rtl_rc", - .alloc = rtl_rate_alloc, - .free = rtl_rate_free, - .alloc_sta = rtl_rate_alloc_sta, - .free_sta = rtl_rate_free_sta, - .rate_init = rtl_rate_init, - .tx_status = rtl_tx_status, - .get_rate = rtl_get_rate, -}; - -int rtl_rate_control_register(void) -{ - return ieee80211_rate_control_register(&rtl_rate_ops); -} - -void rtl_rate_control_unregister(void) -{ - ieee80211_rate_control_unregister(&rtl_rate_ops); -} diff --git a/drivers/net/wireless/rtlwifi/rc.h b/drivers/net/wireless/rtlwifi/rc.h deleted file mode 100644 index 4d6176160610..000000000000 --- a/drivers/net/wireless/rtlwifi/rc.h +++ /dev/null @@ -1,47 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL_RC_H__ -#define __RTL_RC_H__ - -#define B_MODE_MAX_RIX 3 -#define G_MODE_MAX_RIX 11 -#define A_MODE_MAX_RIX 7 - -/* in mac80211 mcs0-mcs15 is idx0-idx15*/ -#define N_MODE_MCS7_RIX 7 -#define N_MODE_MCS15_RIX 15 - -struct rtl_rate_priv { - u8 ht_cap; -}; - -int rtl_rate_control_register(void); -void rtl_rate_control_unregister(void); -#endif diff --git a/drivers/net/wireless/rtlwifi/regd.c b/drivers/net/wireless/rtlwifi/regd.c deleted file mode 100644 index d7d0d4948b01..000000000000 --- a/drivers/net/wireless/rtlwifi/regd.c +++ /dev/null @@ -1,430 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "wifi.h" -#include "regd.h" - -static struct country_code_to_enum_rd allCountries[] = { - {COUNTRY_CODE_FCC, "US"}, - {COUNTRY_CODE_IC, "US"}, - {COUNTRY_CODE_ETSI, "EC"}, - {COUNTRY_CODE_SPAIN, "EC"}, - {COUNTRY_CODE_FRANCE, "EC"}, - {COUNTRY_CODE_MKK, "JP"}, - {COUNTRY_CODE_MKK1, "JP"}, - {COUNTRY_CODE_ISRAEL, "EC"}, - {COUNTRY_CODE_TELEC, "JP"}, - {COUNTRY_CODE_MIC, "JP"}, - {COUNTRY_CODE_GLOBAL_DOMAIN, "JP"}, - {COUNTRY_CODE_WORLD_WIDE_13, "EC"}, - {COUNTRY_CODE_TELEC_NETGEAR, "EC"}, -}; - -/* - *Only these channels all allow active - *scan on all world regulatory domains - */ -#define RTL819x_2GHZ_CH01_11 \ - REG_RULE(2412-10, 2462+10, 40, 0, 20, 0) - -/* - *We enable active scan on these a case - *by case basis by regulatory domain - */ -#define RTL819x_2GHZ_CH12_13 \ - REG_RULE(2467-10, 2472+10, 40, 0, 20,\ - NL80211_RRF_PASSIVE_SCAN) - -#define RTL819x_2GHZ_CH14 \ - REG_RULE(2484-10, 2484+10, 40, 0, 20, \ - NL80211_RRF_PASSIVE_SCAN | \ - NL80211_RRF_NO_OFDM) - -/* 5G chan 36 - chan 64*/ -#define RTL819x_5GHZ_5150_5350 \ - REG_RULE(5150-10, 5350+10, 40, 0, 30, \ - NL80211_RRF_PASSIVE_SCAN | \ - NL80211_RRF_NO_IBSS) - -/* 5G chan 100 - chan 165*/ -#define RTL819x_5GHZ_5470_5850 \ - REG_RULE(5470-10, 5850+10, 40, 0, 30, \ - NL80211_RRF_PASSIVE_SCAN | \ - NL80211_RRF_NO_IBSS) - -/* 5G chan 149 - chan 165*/ -#define RTL819x_5GHZ_5725_5850 \ - REG_RULE(5725-10, 5850+10, 40, 0, 30, \ - NL80211_RRF_PASSIVE_SCAN | \ - NL80211_RRF_NO_IBSS) - -#define RTL819x_5GHZ_ALL \ - (RTL819x_5GHZ_5150_5350, RTL819x_5GHZ_5470_5850) - -static const struct ieee80211_regdomain rtl_regdom_11 = { - .n_reg_rules = 1, - .alpha2 = "99", - .reg_rules = { - RTL819x_2GHZ_CH01_11, - } -}; - -static const struct ieee80211_regdomain rtl_regdom_12_13 = { - .n_reg_rules = 2, - .alpha2 = "99", - .reg_rules = { - RTL819x_2GHZ_CH01_11, - RTL819x_2GHZ_CH12_13, - } -}; - -static const struct ieee80211_regdomain rtl_regdom_no_midband = { - .n_reg_rules = 3, - .alpha2 = "99", - .reg_rules = { - RTL819x_2GHZ_CH01_11, - RTL819x_5GHZ_5150_5350, - RTL819x_5GHZ_5725_5850, - } -}; - -static const struct ieee80211_regdomain rtl_regdom_60_64 = { - .n_reg_rules = 3, - .alpha2 = "99", - .reg_rules = { - RTL819x_2GHZ_CH01_11, - RTL819x_2GHZ_CH12_13, - RTL819x_5GHZ_5725_5850, - } -}; - -static const struct ieee80211_regdomain rtl_regdom_14_60_64 = { - .n_reg_rules = 4, - .alpha2 = "99", - .reg_rules = { - RTL819x_2GHZ_CH01_11, - RTL819x_2GHZ_CH12_13, - RTL819x_2GHZ_CH14, - RTL819x_5GHZ_5725_5850, - } -}; - -static const struct ieee80211_regdomain rtl_regdom_14 = { - .n_reg_rules = 3, - .alpha2 = "99", - .reg_rules = { - RTL819x_2GHZ_CH01_11, - RTL819x_2GHZ_CH12_13, - RTL819x_2GHZ_CH14, - } -}; - -static bool _rtl_is_radar_freq(u16 center_freq) -{ - return (center_freq >= 5260 && center_freq <= 5700); -} - -static void _rtl_reg_apply_beaconing_flags(struct wiphy *wiphy, - enum nl80211_reg_initiator initiator) -{ - enum ieee80211_band band; - struct ieee80211_supported_band *sband; - const struct ieee80211_reg_rule *reg_rule; - struct ieee80211_channel *ch; - unsigned int i; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - - if (!wiphy->bands[band]) - continue; - - sband = wiphy->bands[band]; - - for (i = 0; i < sband->n_channels; i++) { - ch = &sband->channels[i]; - if (_rtl_is_radar_freq(ch->center_freq) || - (ch->flags & IEEE80211_CHAN_RADAR)) - continue; - if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) { - reg_rule = freq_reg_info(wiphy, ch->center_freq); - if (IS_ERR(reg_rule)) - continue; - - /* - *If 11d had a rule for this channel ensure - *we enable adhoc/beaconing if it allows us to - *use it. Note that we would have disabled it - *by applying our static world regdomain by - *default during init, prior to calling our - *regulatory_hint(). - */ - - if (!(reg_rule->flags & NL80211_RRF_NO_IBSS)) - ch->flags &= ~IEEE80211_CHAN_NO_IBSS; - if (!(reg_rule-> - flags & NL80211_RRF_PASSIVE_SCAN)) - ch->flags &= - ~IEEE80211_CHAN_PASSIVE_SCAN; - } else { - if (ch->beacon_found) - ch->flags &= ~(IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN); - } - } - } -} - -/* Allows active scan scan on Ch 12 and 13 */ -static void _rtl_reg_apply_active_scan_flags(struct wiphy *wiphy, - enum nl80211_reg_initiator - initiator) -{ - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch; - const struct ieee80211_reg_rule *reg_rule; - - if (!wiphy->bands[IEEE80211_BAND_2GHZ]) - return; - sband = wiphy->bands[IEEE80211_BAND_2GHZ]; - - /* - *If no country IE has been received always enable active scan - *on these channels. This is only done for specific regulatory SKUs - */ - if (initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE) { - ch = &sband->channels[11]; /* CH 12 */ - if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; - ch = &sband->channels[12]; /* CH 13 */ - if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; - return; - } - - /* - *If a country IE has been received check its rule for this - *channel first before enabling active scan. The passive scan - *would have been enforced by the initial processing of our - *custom regulatory domain. - */ - - ch = &sband->channels[11]; /* CH 12 */ - reg_rule = freq_reg_info(wiphy, ch->center_freq); - if (!IS_ERR(reg_rule)) { - if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN)) - if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; - } - - ch = &sband->channels[12]; /* CH 13 */ - reg_rule = freq_reg_info(wiphy, ch->center_freq); - if (!IS_ERR(reg_rule)) { - if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN)) - if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) - ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; - } -} - -/* - *Always apply Radar/DFS rules on - *freq range 5260 MHz - 5700 MHz - */ -static void _rtl_reg_apply_radar_flags(struct wiphy *wiphy) -{ - struct ieee80211_supported_band *sband; - struct ieee80211_channel *ch; - unsigned int i; - - if (!wiphy->bands[IEEE80211_BAND_5GHZ]) - return; - - sband = wiphy->bands[IEEE80211_BAND_5GHZ]; - - for (i = 0; i < sband->n_channels; i++) { - ch = &sband->channels[i]; - if (!_rtl_is_radar_freq(ch->center_freq)) - continue; - - /* - *We always enable radar detection/DFS on this - *frequency range. Additionally we also apply on - *this frequency range: - *- If STA mode does not yet have DFS supports disable - * active scanning - *- If adhoc mode does not support DFS yet then disable - * adhoc in the frequency. - *- If AP mode does not yet support radar detection/DFS - *do not allow AP mode - */ - if (!(ch->flags & IEEE80211_CHAN_DISABLED)) - ch->flags |= IEEE80211_CHAN_RADAR | - IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN; - } -} - -static void _rtl_reg_apply_world_flags(struct wiphy *wiphy, - enum nl80211_reg_initiator initiator, - struct rtl_regulatory *reg) -{ - _rtl_reg_apply_beaconing_flags(wiphy, initiator); - _rtl_reg_apply_active_scan_flags(wiphy, initiator); - return; -} - -static void _rtl_reg_notifier_apply(struct wiphy *wiphy, - struct regulatory_request *request, - struct rtl_regulatory *reg) -{ - /* We always apply this */ - _rtl_reg_apply_radar_flags(wiphy); - - switch (request->initiator) { - case NL80211_REGDOM_SET_BY_DRIVER: - case NL80211_REGDOM_SET_BY_CORE: - case NL80211_REGDOM_SET_BY_USER: - break; - case NL80211_REGDOM_SET_BY_COUNTRY_IE: - _rtl_reg_apply_world_flags(wiphy, request->initiator, reg); - break; - } -} - -static const struct ieee80211_regdomain *_rtl_regdomain_select( - struct rtl_regulatory *reg) -{ - switch (reg->country_code) { - case COUNTRY_CODE_FCC: - return &rtl_regdom_no_midband; - case COUNTRY_CODE_IC: - return &rtl_regdom_11; - case COUNTRY_CODE_ETSI: - case COUNTRY_CODE_TELEC_NETGEAR: - return &rtl_regdom_60_64; - case COUNTRY_CODE_SPAIN: - case COUNTRY_CODE_FRANCE: - case COUNTRY_CODE_ISRAEL: - case COUNTRY_CODE_WORLD_WIDE_13: - return &rtl_regdom_12_13; - case COUNTRY_CODE_MKK: - case COUNTRY_CODE_MKK1: - case COUNTRY_CODE_TELEC: - case COUNTRY_CODE_MIC: - return &rtl_regdom_14_60_64; - case COUNTRY_CODE_GLOBAL_DOMAIN: - return &rtl_regdom_14; - default: - return &rtl_regdom_no_midband; - } -} - -static int _rtl_regd_init_wiphy(struct rtl_regulatory *reg, - struct wiphy *wiphy, - void (*reg_notifier) (struct wiphy *wiphy, - struct regulatory_request * - request)) -{ - const struct ieee80211_regdomain *regd; - - wiphy->reg_notifier = reg_notifier; - - wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; - wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY; - wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS; - - regd = _rtl_regdomain_select(reg); - wiphy_apply_custom_regulatory(wiphy, regd); - _rtl_reg_apply_radar_flags(wiphy); - _rtl_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg); - return 0; -} - -static struct country_code_to_enum_rd *_rtl_regd_find_country(u16 countrycode) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(allCountries); i++) { - if (allCountries[i].countrycode == countrycode) - return &allCountries[i]; - } - return NULL; -} - -int rtl_regd_init(struct ieee80211_hw *hw, - void (*reg_notifier) (struct wiphy *wiphy, - struct regulatory_request *request)) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct wiphy *wiphy = hw->wiphy; - struct country_code_to_enum_rd *country = NULL; - - if (wiphy == NULL || &rtlpriv->regd == NULL) - return -EINVAL; - - /* init country_code from efuse channel plan */ - rtlpriv->regd.country_code = rtlpriv->efuse.channel_plan; - - RT_TRACE(rtlpriv, COMP_REGD, DBG_TRACE, - "rtl: EEPROM regdomain: 0x%0x\n", rtlpriv->regd.country_code); - - if (rtlpriv->regd.country_code >= COUNTRY_CODE_MAX) { - RT_TRACE(rtlpriv, COMP_REGD, DBG_DMESG, - "rtl: EEPROM indicates invalid contry code, world wide 13 should be used\n"); - - rtlpriv->regd.country_code = COUNTRY_CODE_WORLD_WIDE_13; - } - - country = _rtl_regd_find_country(rtlpriv->regd.country_code); - - if (country) { - rtlpriv->regd.alpha2[0] = country->iso_name[0]; - rtlpriv->regd.alpha2[1] = country->iso_name[1]; - } else { - rtlpriv->regd.alpha2[0] = '0'; - rtlpriv->regd.alpha2[1] = '0'; - } - - RT_TRACE(rtlpriv, COMP_REGD, DBG_TRACE, - "rtl: Country alpha2 being used: %c%c\n", - rtlpriv->regd.alpha2[0], rtlpriv->regd.alpha2[1]); - - _rtl_regd_init_wiphy(&rtlpriv->regd, wiphy, reg_notifier); - - return 0; -} - -void rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) -{ - struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(rtlpriv, COMP_REGD, DBG_LOUD, "\n"); - - _rtl_reg_notifier_apply(wiphy, request, &rtlpriv->regd); -} diff --git a/drivers/net/wireless/rtlwifi/regd.h b/drivers/net/wireless/rtlwifi/regd.h deleted file mode 100644 index 4e1f4f00e6e9..000000000000 --- a/drivers/net/wireless/rtlwifi/regd.h +++ /dev/null @@ -1,61 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL_REGD_H__ -#define __RTL_REGD_H__ - -struct country_code_to_enum_rd { - u16 countrycode; - const char *iso_name; -}; - -enum country_code_type_t { - COUNTRY_CODE_FCC = 0, - COUNTRY_CODE_IC = 1, - COUNTRY_CODE_ETSI = 2, - COUNTRY_CODE_SPAIN = 3, - COUNTRY_CODE_FRANCE = 4, - COUNTRY_CODE_MKK = 5, - COUNTRY_CODE_MKK1 = 6, - COUNTRY_CODE_ISRAEL = 7, - COUNTRY_CODE_TELEC = 8, - COUNTRY_CODE_MIC = 9, - COUNTRY_CODE_GLOBAL_DOMAIN = 10, - COUNTRY_CODE_WORLD_WIDE_13 = 11, - COUNTRY_CODE_TELEC_NETGEAR = 12, - - /*add new channel plan above this line */ - COUNTRY_CODE_MAX -}; - -int rtl_regd_init(struct ieee80211_hw *hw, - void (*reg_notifier) (struct wiphy *wiphy, - struct regulatory_request *request)); -void rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request); -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/Makefile b/drivers/net/wireless/rtlwifi/rtl8188ee/Makefile deleted file mode 100644 index 5b194e97f4b3..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -rtl8188ee-objs := \ - dm.o \ - fw.o \ - hw.o \ - led.o \ - phy.o \ - pwrseq.o \ - pwrseqcmd.o \ - rf.o \ - sw.o \ - table.o \ - trx.o - -obj-$(CONFIG_RTL8188EE) += rtl8188ee.o - -ccflags-y += -Idrivers/net/wireless/rtlwifi -D__CHECK_ENDIAN__ diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/def.h b/drivers/net/wireless/rtlwifi/rtl8188ee/def.h deleted file mode 100644 index c764fff9ebe6..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/def.h +++ /dev/null @@ -1,324 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C_DEF_H__ -#define __RTL92C_DEF_H__ - -#define HAL_RETRY_LIMIT_INFRA 48 -#define HAL_RETRY_LIMIT_AP_ADHOC 7 - -#define RESET_DELAY_8185 20 - -#define RT_IBSS_INT_MASKS (IMR_BCNINT | IMR_TBDOK | IMR_TBDER) -#define RT_AC_INT_MASKS (IMR_VIDOK | IMR_VODOK | IMR_BEDOK|IMR_BKDOK) - -#define NUM_OF_FIRMWARE_QUEUE 10 -#define NUM_OF_PAGES_IN_FW 0x100 -#define NUM_OF_PAGE_IN_FW_QUEUE_BK 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_BE 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_VI 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_VO 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_HCCA 0x0 -#define NUM_OF_PAGE_IN_FW_QUEUE_CMD 0x0 -#define NUM_OF_PAGE_IN_FW_QUEUE_MGNT 0x02 -#define NUM_OF_PAGE_IN_FW_QUEUE_HIGH 0x02 -#define NUM_OF_PAGE_IN_FW_QUEUE_BCN 0x2 -#define NUM_OF_PAGE_IN_FW_QUEUE_PUB 0xA1 - -#define NUM_OF_PAGE_IN_FW_QUEUE_BK_DTM 0x026 -#define NUM_OF_PAGE_IN_FW_QUEUE_BE_DTM 0x048 -#define NUM_OF_PAGE_IN_FW_QUEUE_VI_DTM 0x048 -#define NUM_OF_PAGE_IN_FW_QUEUE_VO_DTM 0x026 -#define NUM_OF_PAGE_IN_FW_QUEUE_PUB_DTM 0x00 - -#define MAX_LINES_HWCONFIG_TXT 1000 -#define MAX_BYTES_LINE_HWCONFIG_TXT 256 - -#define SW_THREE_WIRE 0 -#define HW_THREE_WIRE 2 - -#define BT_DEMO_BOARD 0 -#define BT_QA_BOARD 1 -#define BT_FPGA 2 - -#define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0 -#define HAL_PRIME_CHNL_OFFSET_LOWER 1 -#define HAL_PRIME_CHNL_OFFSET_UPPER 2 - -#define MAX_H2C_QUEUE_NUM 10 - -#define RX_MPDU_QUEUE 0 -#define RX_CMD_QUEUE 1 -#define RX_MAX_QUEUE 2 -#define AC2QUEUEID(_AC) (_AC) - -#define C2H_RX_CMD_HDR_LEN 8 -#define GET_C2H_CMD_CMD_LEN(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 0, 16) -#define GET_C2H_CMD_ELEMENT_ID(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 16, 8) -#define GET_C2H_CMD_CMD_SEQ(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 24, 7) -#define GET_C2H_CMD_CONTINUE(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 31, 1) -#define GET_C2H_CMD_CONTENT(__prxhdr) \ - ((u8 *)(__prxhdr) + C2H_RX_CMD_HDR_LEN) - -#define GET_C2H_CMD_FEEDBACK_ELEMENT_ID(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE((__pcmdfbhdr), 0, 8) -#define GET_C2H_CMD_FEEDBACK_CCX_LEN(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE((__pcmdfbhdr), 8, 8) -#define GET_C2H_CMD_FEEDBACK_CCX_CMD_CNT(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE((__pcmdfbhdr), 16, 16) -#define GET_C2H_CMD_FEEDBACK_CCX_MAC_ID(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 0, 5) -#define GET_C2H_CMD_FEEDBACK_CCX_VALID(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 7, 1) -#define GET_C2H_CMD_FEEDBACK_CCX_RETRY_CNT(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 8, 5) -#define GET_C2H_CMD_FEEDBACK_CCX_TOK(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 15, 1) -#define GET_C2H_CMD_FEEDBACK_CCX_QSEL(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 16, 4) -#define GET_C2H_CMD_FEEDBACK_CCX_SEQ(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 20, 12) - -#define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3) - - -/* [15:12] IC version(CUT): A-cut=0, B-cut=1, C-cut=2, D-cut=3 - * [7] Manufacturer: TSMC=0, UMC=1 - * [6:4] RF type: 1T1R=0, 1T2R=1, 2T2R=2 - * [3] Chip type: TEST=0, NORMAL=1 - * [2:0] IC type: 81xxC=0, 8723=1, 92D=2 - */ -#define CHIP_8723 BIT(0) -#define CHIP_92D BIT(1) -#define NORMAL_CHIP BIT(3) -#define RF_TYPE_1T1R (~(BIT(4)|BIT(5)|BIT(6))) -#define RF_TYPE_1T2R BIT(4) -#define RF_TYPE_2T2R BIT(5) -#define CHIP_VENDOR_UMC BIT(7) -#define B_CUT_VERSION BIT(12) -#define C_CUT_VERSION BIT(13) -#define D_CUT_VERSION ((BIT(12)|BIT(13))) -#define E_CUT_VERSION BIT(14) - - -/* MASK */ -#define IC_TYPE_MASK (BIT(0)|BIT(1)|BIT(2)) -#define CHIP_TYPE_MASK BIT(3) -#define RF_TYPE_MASK (BIT(4)|BIT(5)|BIT(6)) -#define MANUFACTUER_MASK BIT(7) -#define ROM_VERSION_MASK (BIT(11)|BIT(10)|BIT(9)|BIT(8)) -#define CUT_VERSION_MASK (BIT(15)|BIT(14)|BIT(13)|BIT(12)) - -/* Get element */ -#define GET_CVID_IC_TYPE(version) ((version) & IC_TYPE_MASK) -#define GET_CVID_CHIP_TYPE(version) ((version) & CHIP_TYPE_MASK) -#define GET_CVID_RF_TYPE(version) ((version) & RF_TYPE_MASK) -#define GET_CVID_MANUFACTUER(version) ((version) & MANUFACTUER_MASK) -#define GET_CVID_ROM_VERSION(version) ((version) & ROM_VERSION_MASK) -#define GET_CVID_CUT_VERSION(version) ((version) & CUT_VERSION_MASK) - - -#define IS_81XXC(version) \ - ((GET_CVID_IC_TYPE(version) == 0) ? true : false) -#define IS_8723_SERIES(version) \ - ((GET_CVID_IC_TYPE(version) == CHIP_8723) ? true : false) -#define IS_92D(version) \ - ((GET_CVID_IC_TYPE(version) == CHIP_92D) ? true : false) - -#define IS_NORMAL_CHIP(version) \ - ((GET_CVID_CHIP_TYPE(version)) ? true : false) -#define IS_NORMAL_CHIP92D(version) \ - ((GET_CVID_CHIP_TYPE(version)) ? true : false) - -#define IS_1T1R(version) \ - ((GET_CVID_RF_TYPE(version)) ? false : true) -#define IS_1T2R(version) \ - ((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R) ? true : false) -#define IS_2T2R(version) \ - ((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R) ? true : false) -#define IS_CHIP_VENDOR_UMC(version) \ - ((GET_CVID_MANUFACTUER(version)) ? true : false) - -#define IS_92C_SERIAL(version) \ - ((IS_81XXC(version) && IS_2T2R(version)) ? true : false) -#define IS_81xxC_VENDOR_UMC_A_CUT(version) \ - (IS_81XXC(version) ? ((IS_CHIP_VENDOR_UMC(version)) ? \ - ((GET_CVID_CUT_VERSION(version)) ? false : true) : false) : false) -#define IS_81xxC_VENDOR_UMC_B_CUT(version) \ - (IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ? \ - ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true \ - : false) : false) : false) - -enum version_8188e { - VERSION_TEST_CHIP_88E = 0x00, - VERSION_NORMAL_CHIP_88E = 0x01, - VERSION_UNKNOWN = 0xFF, -}; - -enum rx_packet_type { - NORMAL_RX, - TX_REPORT1, - TX_REPORT2, - HIS_REPORT, -}; - -enum rtl819x_loopback_e { - RTL819X_NO_LOOPBACK = 0, - RTL819X_MAC_LOOPBACK = 1, - RTL819X_DMA_LOOPBACK = 2, - RTL819X_CCK_LOOPBACK = 3, -}; - -enum rf_optype { - RF_OP_BY_SW_3WIRE = 0, - RF_OP_BY_FW, - RF_OP_MAX -}; - -enum rf_power_state { - RF_ON, - RF_OFF, - RF_SLEEP, - RF_SHUT_DOWN, -}; - -enum power_save_mode { - POWER_SAVE_MODE_ACTIVE, - POWER_SAVE_MODE_SAVE, -}; - -enum power_polocy_config { - POWERCFG_MAX_POWER_SAVINGS, - POWERCFG_GLOBAL_POWER_SAVINGS, - POWERCFG_LOCAL_POWER_SAVINGS, - POWERCFG_LENOVO, -}; - -enum interface_select_pci { - INTF_SEL1_MINICARD, - INTF_SEL0_PCIE, - INTF_SEL2_RSV, - INTF_SEL3_RSV, -}; - -enum hal_fw_c2h_cmd_id { - HAL_FW_C2H_CMD_Read_MACREG, - HAL_FW_C2H_CMD_Read_BBREG, - HAL_FW_C2H_CMD_Read_RFREG, - HAL_FW_C2H_CMD_Read_EEPROM, - HAL_FW_C2H_CMD_Read_EFUSE, - HAL_FW_C2H_CMD_Read_CAM, - HAL_FW_C2H_CMD_Get_BasicRate, - HAL_FW_C2H_CMD_Get_DataRate, - HAL_FW_C2H_CMD_Survey, - HAL_FW_C2H_CMD_SurveyDone, - HAL_FW_C2H_CMD_JoinBss, - HAL_FW_C2H_CMD_AddSTA, - HAL_FW_C2H_CMD_DelSTA, - HAL_FW_C2H_CMD_AtimDone, - HAL_FW_C2H_CMD_TX_Report, - HAL_FW_C2H_CMD_CCX_Report, - HAL_FW_C2H_CMD_DTM_Report, - HAL_FW_C2H_CMD_TX_Rate_Statistics, - HAL_FW_C2H_CMD_C2HLBK, - HAL_FW_C2H_CMD_C2HDBG, - HAL_FW_C2H_CMD_C2HFEEDBACK, - HAL_FW_C2H_CMD_MAX -}; - -enum wake_on_wlan_mode { - ewowlandisable, - ewakeonmagicpacketonly, - ewakeonpatternmatchonly, - ewakeonbothtypepacket -}; - -enum rtl_desc_qsel { - QSLT_BK = 0x2, - QSLT_BE = 0x0, - QSLT_VI = 0x5, - QSLT_VO = 0x7, - QSLT_BEACON = 0x10, - QSLT_HIGH = 0x11, - QSLT_MGNT = 0x12, - QSLT_CMD = 0x13, -}; - -enum rtl_desc92c_rate { - DESC92C_RATE1M = 0x00, - DESC92C_RATE2M = 0x01, - DESC92C_RATE5_5M = 0x02, - DESC92C_RATE11M = 0x03, - - DESC92C_RATE6M = 0x04, - DESC92C_RATE9M = 0x05, - DESC92C_RATE12M = 0x06, - DESC92C_RATE18M = 0x07, - DESC92C_RATE24M = 0x08, - DESC92C_RATE36M = 0x09, - DESC92C_RATE48M = 0x0a, - DESC92C_RATE54M = 0x0b, - - DESC92C_RATEMCS0 = 0x0c, - DESC92C_RATEMCS1 = 0x0d, - DESC92C_RATEMCS2 = 0x0e, - DESC92C_RATEMCS3 = 0x0f, - DESC92C_RATEMCS4 = 0x10, - DESC92C_RATEMCS5 = 0x11, - DESC92C_RATEMCS6 = 0x12, - DESC92C_RATEMCS7 = 0x13, - DESC92C_RATEMCS8 = 0x14, - DESC92C_RATEMCS9 = 0x15, - DESC92C_RATEMCS10 = 0x16, - DESC92C_RATEMCS11 = 0x17, - DESC92C_RATEMCS12 = 0x18, - DESC92C_RATEMCS13 = 0x19, - DESC92C_RATEMCS14 = 0x1a, - DESC92C_RATEMCS15 = 0x1b, - DESC92C_RATEMCS15_SG = 0x1c, - DESC92C_RATEMCS32 = 0x20, -}; - -struct phy_sts_cck_8192s_t { - u8 adc_pwdb_X[4]; - u8 sq_rpt; - u8 cck_agc_rpt; -}; - -struct h2c_cmd_8192c { - u8 element_id; - u32 cmd_len; - u8 *p_cmdbuffer; -}; - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/dm.c b/drivers/net/wireless/rtlwifi/rtl8188ee/dm.c deleted file mode 100644 index 21a5cf060677..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/dm.c +++ /dev/null @@ -1,1794 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../base.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "fw.h" -#include "trx.h" - -static const u32 ofdmswing_table[OFDM_TABLE_SIZE] = { - 0x7f8001fe, /* 0, +6.0dB */ - 0x788001e2, /* 1, +5.5dB */ - 0x71c001c7, /* 2, +5.0dB */ - 0x6b8001ae, /* 3, +4.5dB */ - 0x65400195, /* 4, +4.0dB */ - 0x5fc0017f, /* 5, +3.5dB */ - 0x5a400169, /* 6, +3.0dB */ - 0x55400155, /* 7, +2.5dB */ - 0x50800142, /* 8, +2.0dB */ - 0x4c000130, /* 9, +1.5dB */ - 0x47c0011f, /* 10, +1.0dB */ - 0x43c0010f, /* 11, +0.5dB */ - 0x40000100, /* 12, +0dB */ - 0x3c8000f2, /* 13, -0.5dB */ - 0x390000e4, /* 14, -1.0dB */ - 0x35c000d7, /* 15, -1.5dB */ - 0x32c000cb, /* 16, -2.0dB */ - 0x300000c0, /* 17, -2.5dB */ - 0x2d4000b5, /* 18, -3.0dB */ - 0x2ac000ab, /* 19, -3.5dB */ - 0x288000a2, /* 20, -4.0dB */ - 0x26000098, /* 21, -4.5dB */ - 0x24000090, /* 22, -5.0dB */ - 0x22000088, /* 23, -5.5dB */ - 0x20000080, /* 24, -6.0dB */ - 0x1e400079, /* 25, -6.5dB */ - 0x1c800072, /* 26, -7.0dB */ - 0x1b00006c, /* 27. -7.5dB */ - 0x19800066, /* 28, -8.0dB */ - 0x18000060, /* 29, -8.5dB */ - 0x16c0005b, /* 30, -9.0dB */ - 0x15800056, /* 31, -9.5dB */ - 0x14400051, /* 32, -10.0dB */ - 0x1300004c, /* 33, -10.5dB */ - 0x12000048, /* 34, -11.0dB */ - 0x11000044, /* 35, -11.5dB */ - 0x10000040, /* 36, -12.0dB */ - 0x0f00003c, /* 37, -12.5dB */ - 0x0e400039, /* 38, -13.0dB */ - 0x0d800036, /* 39, -13.5dB */ - 0x0cc00033, /* 40, -14.0dB */ - 0x0c000030, /* 41, -14.5dB */ - 0x0b40002d, /* 42, -15.0dB */ -}; - -static const u8 cck_tbl_ch1_13[CCK_TABLE_SIZE][8] = { - {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, /* 0, +0dB */ - {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, /* 1, -0.5dB */ - {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, /* 2, -1.0dB */ - {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, /* 3, -1.5dB */ - {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, /* 4, -2.0dB */ - {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, /* 5, -2.5dB */ - {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, /* 6, -3.0dB */ - {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, /* 7, -3.5dB */ - {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, /* 8, -4.0dB */ - {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, /* 9, -4.5dB */ - {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, /* 10, -5.0dB */ - {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, /* 11, -5.5dB */ - {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, /* 12, -6.0dB */ - {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, /* 13, -6.5dB */ - {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, /* 14, -7.0dB */ - {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, /* 15, -7.5dB */ - {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, /* 16, -8.0dB */ - {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, /* 17, -8.5dB */ - {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, /* 18, -9.0dB */ - {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, /* 19, -9.5dB */ - {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, /* 20, -10.0dB*/ - {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, /* 21, -10.5dB*/ - {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, /* 22, -11.0dB*/ - {0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, /* 23, -11.5dB*/ - {0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, /* 24, -12.0dB*/ - {0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, /* 25, -12.5dB*/ - {0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, /* 26, -13.0dB*/ - {0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, /* 27, -13.5dB*/ - {0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, /* 28, -14.0dB*/ - {0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, /* 29, -14.5dB*/ - {0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, /* 30, -15.0dB*/ - {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, /* 31, -15.5dB*/ - {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01} /* 32, -16.0dB*/ -}; - -static const u8 cck_tbl_ch14[CCK_TABLE_SIZE][8] = { - {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, /* 0, +0dB */ - {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, /* 1, -0.5dB */ - {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, /* 2, -1.0dB */ - {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, /* 3, -1.5dB */ - {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, /* 4, -2.0dB */ - {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, /* 5, -2.5dB */ - {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, /* 6, -3.0dB */ - {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, /* 7, -3.5dB */ - {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, /* 8, -4.0dB */ - {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, /* 9, -4.5dB */ - {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, /* 10, -5.0dB */ - {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 11, -5.5dB */ - {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 12, -6.0dB */ - {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, /* 13, -6.5dB */ - {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, /* 14, -7.0dB */ - {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 15, -7.5dB */ - {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 16, -8.0dB */ - {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 17, -8.5dB */ - {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 18, -9.0dB */ - {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 19, -9.5dB */ - {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 20, -10.0dB*/ - {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, /* 21, -10.5dB*/ - {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, /* 22, -11.0dB*/ - {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, /* 23, -11.5dB*/ - {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, /* 24, -12.0dB*/ - {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 25, -12.5dB*/ - {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 26, -13.0dB*/ - {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 27, -13.5dB*/ - {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 28, -14.0dB*/ - {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 29, -14.5dB*/ - {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 30, -15.0dB*/ - {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 31, -15.5dB*/ - {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00} /* 32, -16.0dB*/ -}; - -#define CAL_SWING_OFF(_off, _dir, _size, _del) \ - do { \ - for (_off = 0; _off < _size; _off++) { \ - if (_del < thermal_threshold[_dir][_off]) { \ - if (_off != 0) \ - _off--; \ - break; \ - } \ - } \ - if (_off >= _size) \ - _off = _size - 1; \ - } while (0) - -static void rtl88e_set_iqk_matrix(struct ieee80211_hw *hw, - u8 ofdm_index, u8 rfpath, - long iqk_result_x, long iqk_result_y) -{ - long ele_a = 0, ele_d, ele_c = 0, value32; - - ele_d = (ofdmswing_table[ofdm_index] & 0xFFC00000)>>22; - - if (iqk_result_x != 0) { - if ((iqk_result_x & 0x00000200) != 0) - iqk_result_x = iqk_result_x | 0xFFFFFC00; - ele_a = ((iqk_result_x * ele_d)>>8)&0x000003FF; - - if ((iqk_result_y & 0x00000200) != 0) - iqk_result_y = iqk_result_y | 0xFFFFFC00; - ele_c = ((iqk_result_y * ele_d)>>8)&0x000003FF; - - switch (rfpath) { - case RF90_PATH_A: - value32 = (ele_d << 22)|((ele_c & 0x3F)<<16) | ele_a; - rtl_set_bbreg(hw, ROFDM0_XATXIQIMBAL, MASKDWORD, - value32); - value32 = (ele_c & 0x000003C0) >> 6; - rtl_set_bbreg(hw, ROFDM0_XCTXAFE, MASKH4BITS, value32); - value32 = ((iqk_result_x * ele_d) >> 7) & 0x01; - rtl_set_bbreg(hw, ROFDM0_ECCATHRES, BIT(24), value32); - break; - case RF90_PATH_B: - value32 = (ele_d << 22)|((ele_c & 0x3F)<<16) | ele_a; - rtl_set_bbreg(hw, ROFDM0_XBTXIQIMBAL, - MASKDWORD, value32); - value32 = (ele_c & 0x000003C0) >> 6; - rtl_set_bbreg(hw, ROFDM0_XDTXAFE, MASKH4BITS, value32); - value32 = ((iqk_result_x * ele_d) >> 7) & 0x01; - rtl_set_bbreg(hw, ROFDM0_ECCATHRES, BIT(28), value32); - break; - default: - break; - } - } else { - switch (rfpath) { - case RF90_PATH_A: - rtl_set_bbreg(hw, ROFDM0_XATXIQIMBAL, MASKDWORD, - ofdmswing_table[ofdm_index]); - rtl_set_bbreg(hw, ROFDM0_XCTXAFE, MASKH4BITS, 0x00); - rtl_set_bbreg(hw, ROFDM0_ECCATHRES, BIT(24), 0x00); - break; - case RF90_PATH_B: - rtl_set_bbreg(hw, ROFDM0_XBTXIQIMBAL, MASKDWORD, - ofdmswing_table[ofdm_index]); - rtl_set_bbreg(hw, ROFDM0_XDTXAFE, MASKH4BITS, 0x00); - rtl_set_bbreg(hw, ROFDM0_ECCATHRES, BIT(28), 0x00); - break; - default: - break; - } - } -} - -void rtl88e_dm_txpower_track_adjust(struct ieee80211_hw *hw, - u8 type, u8 *pdirection, u32 *poutwrite_val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - u8 pwr_val = 0; - u8 cck_base = rtldm->swing_idx_cck_base; - u8 cck_val = rtldm->swing_idx_cck; - u8 ofdm_base = rtldm->swing_idx_ofdm_base; - u8 ofdm_val = rtlpriv->dm.swing_idx_ofdm[RF90_PATH_A]; - - if (type == 0) { - if (ofdm_val <= ofdm_base) { - *pdirection = 1; - pwr_val = ofdm_base - ofdm_val; - } else { - *pdirection = 2; - pwr_val = ofdm_val - ofdm_base; - } - } else if (type == 1) { - if (cck_val <= cck_base) { - *pdirection = 1; - pwr_val = cck_base - cck_val; - } else { - *pdirection = 2; - pwr_val = cck_val - cck_base; - } - } - - if (pwr_val >= TXPWRTRACK_MAX_IDX && (*pdirection == 1)) - pwr_val = TXPWRTRACK_MAX_IDX; - - *poutwrite_val = pwr_val | (pwr_val << 8) | (pwr_val << 16) | - (pwr_val << 24); -} - - -static void rtl88e_chk_tx_track(struct ieee80211_hw *hw, - enum pwr_track_control_method method, - u8 rfpath, u8 index) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - int jj = rtldm->swing_idx_cck; - int i; - - if (method == TXAGC) { - if (rtldm->swing_flag_ofdm == true || - rtldm->swing_flag_cck == true) { - u8 chan = rtlphy->current_channel; - rtl88e_phy_set_txpower_level(hw, chan); - rtldm->swing_flag_ofdm = false; - rtldm->swing_flag_cck = false; - } - } else if (method == BBSWING) { - if (!rtldm->cck_inch14) { - for (i = 0; i < 8; i++) - rtl_write_byte(rtlpriv, 0xa22 + i, - cck_tbl_ch1_13[jj][i]); - } else { - for (i = 0; i < 8; i++) - rtl_write_byte(rtlpriv, 0xa22 + i, - cck_tbl_ch14[jj][i]); - } - - if (rfpath == RF90_PATH_A) { - long x = rtlphy->iqk_matrix[index].value[0][0]; - long y = rtlphy->iqk_matrix[index].value[0][1]; - u8 indx = rtldm->swing_idx_ofdm[rfpath]; - rtl88e_set_iqk_matrix(hw, indx, rfpath, x, y); - } else if (rfpath == RF90_PATH_B) { - u8 indx = rtldm->swing_idx_ofdm[rfpath]; - long x = rtlphy->iqk_matrix[indx].value[0][4]; - long y = rtlphy->iqk_matrix[indx].value[0][5]; - rtl88e_set_iqk_matrix(hw, indx, rfpath, x, y); - } - } else { - return; - } -} - -static void rtl88e_dm_diginit(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_dig = &rtlpriv->dm_digtable; - - dm_dig->dig_enable_flag = true; - dm_dig->cur_igvalue = rtl_get_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f); - dm_dig->pre_igvalue = 0; - dm_dig->cursta_cstate = DIG_STA_DISCONNECT; - dm_dig->presta_cstate = DIG_STA_DISCONNECT; - dm_dig->curmultista_cstate = DIG_MULTISTA_DISCONNECT; - dm_dig->rssi_lowthresh = DM_DIG_THRESH_LOW; - dm_dig->rssi_highthresh = DM_DIG_THRESH_HIGH; - dm_dig->fa_lowthresh = DM_FALSEALARM_THRESH_LOW; - dm_dig->fa_highthresh = DM_FALSEALARM_THRESH_HIGH; - dm_dig->rx_gain_max = DM_DIG_MAX; - dm_dig->rx_gain_min = DM_DIG_MIN; - dm_dig->back_val = DM_DIG_BACKOFF_DEFAULT; - dm_dig->back_range_max = DM_DIG_BACKOFF_MAX; - dm_dig->back_range_min = DM_DIG_BACKOFF_MIN; - dm_dig->pre_cck_cca_thres = 0xff; - dm_dig->cur_cck_cca_thres = 0x83; - dm_dig->forbidden_igi = DM_DIG_MIN; - dm_dig->large_fa_hit = 0; - dm_dig->recover_cnt = 0; - dm_dig->dig_min_0 = 0x25; - dm_dig->dig_min_1 = 0x25; - dm_dig->media_connect_0 = false; - dm_dig->media_connect_1 = false; - rtlpriv->dm.dm_initialgain_enable = true; -} - -static u8 rtl88e_dm_initial_gain_min_pwdb(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_dig = &rtlpriv->dm_digtable; - long rssi_val_min = 0; - - if ((dm_dig->curmultista_cstate == DIG_MULTISTA_CONNECT) && - (dm_dig->cursta_cstate == DIG_STA_CONNECT)) { - if (rtlpriv->dm.entry_min_undec_sm_pwdb != 0) - rssi_val_min = - (rtlpriv->dm.entry_min_undec_sm_pwdb > - rtlpriv->dm.undec_sm_pwdb) ? - rtlpriv->dm.undec_sm_pwdb : - rtlpriv->dm.entry_min_undec_sm_pwdb; - else - rssi_val_min = rtlpriv->dm.undec_sm_pwdb; - } else if (dm_dig->cursta_cstate == DIG_STA_CONNECT || - dm_dig->cursta_cstate == DIG_STA_BEFORE_CONNECT) { - rssi_val_min = rtlpriv->dm.undec_sm_pwdb; - } else if (dm_dig->curmultista_cstate == - DIG_MULTISTA_CONNECT) { - rssi_val_min = rtlpriv->dm.entry_min_undec_sm_pwdb; - } - return (u8)rssi_val_min; -} - -static void rtl88e_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) -{ - u32 ret_value; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct false_alarm_statistics *alm_cnt = &(rtlpriv->falsealm_cnt); - - rtl_set_bbreg(hw, ROFDM0_LSTF, BIT(31), 1); - rtl_set_bbreg(hw, ROFDM1_LSTF, BIT(31), 1); - - ret_value = rtl_get_bbreg(hw, ROFDM0_FRAMESYNC, MASKDWORD); - alm_cnt->cnt_fast_fsync_fail = (ret_value&0xffff); - alm_cnt->cnt_sb_search_fail = ((ret_value&0xffff0000)>>16); - - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER1, MASKDWORD); - alm_cnt->cnt_ofdm_cca = (ret_value&0xffff); - alm_cnt->cnt_parity_fail = ((ret_value & 0xffff0000) >> 16); - - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER2, MASKDWORD); - alm_cnt->cnt_rate_illegal = (ret_value & 0xffff); - alm_cnt->cnt_crc8_fail = ((ret_value & 0xffff0000) >> 16); - - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER3, MASKDWORD); - alm_cnt->cnt_mcs_fail = (ret_value & 0xffff); - alm_cnt->cnt_ofdm_fail = alm_cnt->cnt_parity_fail + - alm_cnt->cnt_rate_illegal + - alm_cnt->cnt_crc8_fail + - alm_cnt->cnt_mcs_fail + - alm_cnt->cnt_fast_fsync_fail + - alm_cnt->cnt_sb_search_fail; - - ret_value = rtl_get_bbreg(hw, REG_SC_CNT, MASKDWORD); - alm_cnt->cnt_bw_lsc = (ret_value & 0xffff); - alm_cnt->cnt_bw_usc = ((ret_value & 0xffff0000) >> 16); - - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, BIT(12), 1); - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, BIT(14), 1); - - ret_value = rtl_get_bbreg(hw, RCCK0_FACOUNTERLOWER, MASKBYTE0); - alm_cnt->cnt_cck_fail = ret_value; - - ret_value = rtl_get_bbreg(hw, RCCK0_FACOUNTERUPPER, MASKBYTE3); - alm_cnt->cnt_cck_fail += (ret_value & 0xff) << 8; - - ret_value = rtl_get_bbreg(hw, RCCK0_CCA_CNT, MASKDWORD); - alm_cnt->cnt_cck_cca = ((ret_value & 0xff) << 8) | - ((ret_value&0xFF00)>>8); - - alm_cnt->cnt_all = alm_cnt->cnt_fast_fsync_fail + - alm_cnt->cnt_sb_search_fail + - alm_cnt->cnt_parity_fail + - alm_cnt->cnt_rate_illegal + - alm_cnt->cnt_crc8_fail + - alm_cnt->cnt_mcs_fail + - alm_cnt->cnt_cck_fail; - alm_cnt->cnt_cca_all = alm_cnt->cnt_ofdm_cca + alm_cnt->cnt_cck_cca; - - rtl_set_bbreg(hw, ROFDM0_TRSWISOLATION, BIT(31), 1); - rtl_set_bbreg(hw, ROFDM0_TRSWISOLATION, BIT(31), 0); - rtl_set_bbreg(hw, ROFDM1_LSTF, BIT(27), 1); - rtl_set_bbreg(hw, ROFDM1_LSTF, BIT(27), 0); - rtl_set_bbreg(hw, ROFDM0_LSTF, BIT(31), 0); - rtl_set_bbreg(hw, ROFDM1_LSTF, BIT(31), 0); - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, BIT(13)|BIT(12), 0); - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, BIT(13)|BIT(12), 2); - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, BIT(15)|BIT(14), 0); - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, BIT(15)|BIT(14), 2); - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, - "cnt_parity_fail = %d, cnt_rate_illegal = %d, " - "cnt_crc8_fail = %d, cnt_mcs_fail = %d\n", - alm_cnt->cnt_parity_fail, - alm_cnt->cnt_rate_illegal, - alm_cnt->cnt_crc8_fail, alm_cnt->cnt_mcs_fail); - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, - "cnt_ofdm_fail = %x, cnt_cck_fail = %x, cnt_all = %x\n", - alm_cnt->cnt_ofdm_fail, - alm_cnt->cnt_cck_fail, alm_cnt->cnt_all); -} - -static void rtl88e_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_dig = &rtlpriv->dm_digtable; - u8 cur_cck_cca_thresh; - - if (dm_dig->cursta_cstate == DIG_STA_CONNECT) { - dm_dig->rssi_val_min = rtl88e_dm_initial_gain_min_pwdb(hw); - if (dm_dig->rssi_val_min > 25) { - cur_cck_cca_thresh = 0xcd; - } else if ((dm_dig->rssi_val_min <= 25) && - (dm_dig->rssi_val_min > 10)) { - cur_cck_cca_thresh = 0x83; - } else { - if (rtlpriv->falsealm_cnt.cnt_cck_fail > 1000) - cur_cck_cca_thresh = 0x83; - else - cur_cck_cca_thresh = 0x40; - } - - } else { - if (rtlpriv->falsealm_cnt.cnt_cck_fail > 1000) - cur_cck_cca_thresh = 0x83; - else - cur_cck_cca_thresh = 0x40; - } - - if (dm_dig->cur_cck_cca_thres != cur_cck_cca_thresh) - rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, cur_cck_cca_thresh); - - dm_dig->cur_cck_cca_thres = cur_cck_cca_thresh; - dm_dig->pre_cck_cca_thres = dm_dig->cur_cck_cca_thres; - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, - "CCK cca thresh hold =%x\n", dm_dig->cur_cck_cca_thres); -} - -static void rtl88e_dm_dig(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_dig = &rtlpriv->dm_digtable; - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 dig_min, dig_maxofmin; - bool bfirstconnect; - u8 dm_dig_max, dm_dig_min; - u8 current_igi = dm_dig->cur_igvalue; - - if (rtlpriv->dm.dm_initialgain_enable == false) - return; - if (dm_dig->dig_enable_flag == false) - return; - if (mac->act_scanning == true) - return; - - if (mac->link_state >= MAC80211_LINKED) - dm_dig->cursta_cstate = DIG_STA_CONNECT; - else - dm_dig->cursta_cstate = DIG_STA_DISCONNECT; - if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_AP || - rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC) - dm_dig->cursta_cstate = DIG_STA_DISCONNECT; - - dm_dig_max = DM_DIG_MAX; - dm_dig_min = DM_DIG_MIN; - dig_maxofmin = DM_DIG_MAX_AP; - dig_min = dm_dig->dig_min_0; - bfirstconnect = ((mac->link_state >= MAC80211_LINKED) ? true : false) && - (dm_dig->media_connect_0 == false); - - dm_dig->rssi_val_min = - rtl88e_dm_initial_gain_min_pwdb(hw); - - if (mac->link_state >= MAC80211_LINKED) { - if ((dm_dig->rssi_val_min + 20) > dm_dig_max) - dm_dig->rx_gain_max = dm_dig_max; - else if ((dm_dig->rssi_val_min + 20) < dm_dig_min) - dm_dig->rx_gain_max = dm_dig_min; - else - dm_dig->rx_gain_max = dm_dig->rssi_val_min + 20; - - if (rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) { - dig_min = dm_dig->antdiv_rssi_max; - } else { - if (dm_dig->rssi_val_min < dm_dig_min) - dig_min = dm_dig_min; - else if (dm_dig->rssi_val_min < dig_maxofmin) - dig_min = dig_maxofmin; - else - dig_min = dm_dig->rssi_val_min; - } - } else { - dm_dig->rx_gain_max = dm_dig_max; - dig_min = dm_dig_min; - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "no link\n"); - } - - if (rtlpriv->falsealm_cnt.cnt_all > 10000) { - dm_dig->large_fa_hit++; - if (dm_dig->forbidden_igi < current_igi) { - dm_dig->forbidden_igi = current_igi; - dm_dig->large_fa_hit = 1; - } - - if (dm_dig->large_fa_hit >= 3) { - if ((dm_dig->forbidden_igi + 1) > dm_dig->rx_gain_max) - dm_dig->rx_gain_min = dm_dig->rx_gain_max; - else - dm_dig->rx_gain_min = dm_dig->forbidden_igi + 1; - dm_dig->recover_cnt = 3600; - } - } else { - if (dm_dig->recover_cnt != 0) { - dm_dig->recover_cnt--; - } else { - if (dm_dig->large_fa_hit == 0) { - if ((dm_dig->forbidden_igi - 1) < dig_min) { - dm_dig->forbidden_igi = dig_min; - dm_dig->rx_gain_min = dig_min; - } else { - dm_dig->forbidden_igi--; - dm_dig->rx_gain_min = - dm_dig->forbidden_igi + 1; - } - } else if (dm_dig->large_fa_hit == 3) { - dm_dig->large_fa_hit = 0; - } - } - } - - if (dm_dig->cursta_cstate == DIG_STA_CONNECT) { - if (bfirstconnect) { - current_igi = dm_dig->rssi_val_min; - } else { - if (rtlpriv->falsealm_cnt.cnt_all > DM_DIG_FA_TH2) - current_igi += 2; - else if (rtlpriv->falsealm_cnt.cnt_all > DM_DIG_FA_TH1) - current_igi++; - else if (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH0) - current_igi--; - } - } else { - if (rtlpriv->falsealm_cnt.cnt_all > 10000) - current_igi += 2; - else if (rtlpriv->falsealm_cnt.cnt_all > 8000) - current_igi++; - else if (rtlpriv->falsealm_cnt.cnt_all < 500) - current_igi--; - } - - if (current_igi > DM_DIG_FA_UPPER) - current_igi = DM_DIG_FA_UPPER; - else if (current_igi < DM_DIG_FA_LOWER) - current_igi = DM_DIG_FA_LOWER; - - if (rtlpriv->falsealm_cnt.cnt_all > 10000) - current_igi = DM_DIG_FA_UPPER; - - dm_dig->cur_igvalue = current_igi; - rtl88e_dm_write_dig(hw); - dm_dig->media_connect_0 = ((mac->link_state >= MAC80211_LINKED) ? - true : false); - dm_dig->dig_min_0 = dig_min; - - rtl88e_dm_cck_packet_detection_thresh(hw); -} - -static void rtl88e_dm_init_dynamic_txpower(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.dynamic_txpower_enable = false; - - rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; -} - -static void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - long undec_sm_pwdb; - - if (!rtlpriv->dm.dynamic_txpower_enable) - return; - - if (rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - return; - } - - if ((mac->link_state < MAC80211_LINKED) && - (rtlpriv->dm.entry_min_undec_sm_pwdb == 0)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, - "Not connected\n"); - - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - - rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; - return; - } - - if (mac->link_state >= MAC80211_LINKED) { - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - undec_sm_pwdb = - rtlpriv->dm.entry_min_undec_sm_pwdb; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "AP Client PWDB = 0x%lx\n", - undec_sm_pwdb); - } else { - undec_sm_pwdb = - rtlpriv->dm.undec_sm_pwdb; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "STA Default Port PWDB = 0x%lx\n", - undec_sm_pwdb); - } - } else { - undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb; - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "AP Ext Port PWDB = 0x%lx\n", undec_sm_pwdb); - } - - if (undec_sm_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_LEVEL1 (TxPwr = 0x0)\n"); - } else if ((undec_sm_pwdb < - (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) && - (undec_sm_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL1)) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_LEVEL1 (TxPwr = 0x10)\n"); - } else if (undec_sm_pwdb < (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_NORMAL\n"); - } - - if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "PHY_SetTxPowerLevel8192S() Channel = %d\n", - rtlphy->current_channel); - rtl88e_phy_set_txpower_level(hw, rtlphy->current_channel); - } - - rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl; -} - -void rtl88e_dm_write_dig(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_dig = &rtlpriv->dm_digtable; - - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "cur_igvalue = 0x%x, " - "pre_igvalue = 0x%x, back_val = %d\n", - dm_dig->cur_igvalue, dm_dig->pre_igvalue, - dm_dig->back_val); - - if (dm_dig->cur_igvalue > 0x3f) - dm_dig->cur_igvalue = 0x3f; - if (dm_dig->pre_igvalue != dm_dig->cur_igvalue) { - rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, - dm_dig->cur_igvalue); - - dm_dig->pre_igvalue = dm_dig->cur_igvalue; - } -} - -static void rtl88e_dm_pwdb_monitor(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_sta_info *drv_priv; - static u64 last_txok; - static u64 last_rx; - long tmp_entry_max_pwdb = 0, tmp_entry_min_pwdb = 0xff; - - if (rtlhal->oem_id == RT_CID_819x_HP) { - u64 cur_txok_cnt = 0; - u64 cur_rxok_cnt = 0; - cur_txok_cnt = rtlpriv->stats.txbytesunicast - last_txok; - cur_rxok_cnt = rtlpriv->stats.rxbytesunicast - last_rx; - last_txok = cur_txok_cnt; - last_rx = cur_rxok_cnt; - - if (cur_rxok_cnt > (cur_txok_cnt * 6)) - rtl_write_dword(rtlpriv, REG_ARFR0, 0x8f015); - else - rtl_write_dword(rtlpriv, REG_ARFR0, 0xff015); - } - - /* AP & ADHOC & MESH */ - spin_lock_bh(&rtlpriv->locks.entry_list_lock); - list_for_each_entry(drv_priv, &rtlpriv->entry_list, list) { - if (drv_priv->rssi_stat.undec_sm_pwdb < tmp_entry_min_pwdb) - tmp_entry_min_pwdb = drv_priv->rssi_stat.undec_sm_pwdb; - if (drv_priv->rssi_stat.undec_sm_pwdb > tmp_entry_max_pwdb) - tmp_entry_max_pwdb = drv_priv->rssi_stat.undec_sm_pwdb; - } - spin_unlock_bh(&rtlpriv->locks.entry_list_lock); - - /* If associated entry is found */ - if (tmp_entry_max_pwdb != 0) { - rtlpriv->dm.entry_max_undec_sm_pwdb = tmp_entry_max_pwdb; - RTPRINT(rtlpriv, FDM, DM_PWDB, "EntryMaxPWDB = 0x%lx(%ld)\n", - tmp_entry_max_pwdb, tmp_entry_max_pwdb); - } else { - rtlpriv->dm.entry_max_undec_sm_pwdb = 0; - } - /* If associated entry is found */ - if (tmp_entry_min_pwdb != 0xff) { - rtlpriv->dm.entry_min_undec_sm_pwdb = tmp_entry_min_pwdb; - RTPRINT(rtlpriv, FDM, DM_PWDB, "EntryMinPWDB = 0x%lx(%ld)\n", - tmp_entry_min_pwdb, tmp_entry_min_pwdb); - } else { - rtlpriv->dm.entry_min_undec_sm_pwdb = 0; - } - /* Indicate Rx signal strength to FW. */ - if (!rtlpriv->dm.useramask) - rtl_write_byte(rtlpriv, 0x4fe, rtlpriv->dm.undec_sm_pwdb); -} - -void rtl88e_dm_init_edca_turbo(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.current_turbo_edca = false; - rtlpriv->dm.is_any_nonbepkts = false; - rtlpriv->dm.is_cur_rdlstate = false; -} - -static void rtl88e_dm_check_edca_turbo(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - static u64 last_txok_cnt; - static u64 last_rxok_cnt; - static u32 last_bt_edca_ul; - static u32 last_bt_edca_dl; - u64 cur_txok_cnt = 0; - u64 cur_rxok_cnt = 0; - u32 edca_be_ul = 0x5ea42b; - u32 edca_be_dl = 0x5ea42b; - bool change_edca = false; - - if ((last_bt_edca_ul != rtlpcipriv->bt_coexist.bt_edca_ul) || - (last_bt_edca_dl != rtlpcipriv->bt_coexist.bt_edca_dl)) { - rtlpriv->dm.current_turbo_edca = false; - last_bt_edca_ul = rtlpcipriv->bt_coexist.bt_edca_ul; - last_bt_edca_dl = rtlpcipriv->bt_coexist.bt_edca_dl; - } - - if (rtlpcipriv->bt_coexist.bt_edca_ul != 0) { - edca_be_ul = rtlpcipriv->bt_coexist.bt_edca_ul; - change_edca = true; - } - - if (rtlpcipriv->bt_coexist.bt_edca_dl != 0) { - edca_be_ul = rtlpcipriv->bt_coexist.bt_edca_dl; - change_edca = true; - } - - if (mac->link_state != MAC80211_LINKED) { - rtlpriv->dm.current_turbo_edca = false; - return; - } - - if ((!mac->ht_enable) && (!rtlpcipriv->bt_coexist.bt_coexistence)) { - if (!(edca_be_ul & 0xffff0000)) - edca_be_ul |= 0x005e0000; - - if (!(edca_be_dl & 0xffff0000)) - edca_be_dl |= 0x005e0000; - } - - if ((change_edca) || ((!rtlpriv->dm.is_any_nonbepkts) && - (!rtlpriv->dm.disable_framebursting))) { - cur_txok_cnt = rtlpriv->stats.txbytesunicast - last_txok_cnt; - cur_rxok_cnt = rtlpriv->stats.rxbytesunicast - last_rxok_cnt; - - if (cur_rxok_cnt > 4 * cur_txok_cnt) { - if (!rtlpriv->dm.is_cur_rdlstate || - !rtlpriv->dm.current_turbo_edca) { - rtl_write_dword(rtlpriv, - REG_EDCA_BE_PARAM, - edca_be_dl); - rtlpriv->dm.is_cur_rdlstate = true; - } - } else { - if (rtlpriv->dm.is_cur_rdlstate || - !rtlpriv->dm.current_turbo_edca) { - rtl_write_dword(rtlpriv, - REG_EDCA_BE_PARAM, - edca_be_ul); - rtlpriv->dm.is_cur_rdlstate = false; - } - } - rtlpriv->dm.current_turbo_edca = true; - } else { - if (rtlpriv->dm.current_turbo_edca) { - u8 tmp = AC0_BE; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_AC_PARAM, - (u8 *)(&tmp)); - rtlpriv->dm.current_turbo_edca = false; - } - } - - rtlpriv->dm.is_any_nonbepkts = false; - last_txok_cnt = rtlpriv->stats.txbytesunicast; - last_rxok_cnt = rtlpriv->stats.rxbytesunicast; -} - -static void rtl88e_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw - *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 thermalvalue = 0, delta, delta_lck, delta_iqk, off; - u8 th_avg_cnt = 0; - u32 thermalvalue_avg = 0; - long ele_d, temp_cck; - char ofdm_index[2], cck_index = 0, ofdm_old[2] = {0, 0}, cck_old = 0; - int i = 0; - bool is2t = false; - - u8 ofdm_min_index = 6, rf = (is2t) ? 2 : 1; - u8 index_for_channel; - enum _dec_inc {dec, power_inc}; - - /* 0.1 the following TWO tables decide the final index of - * OFDM/CCK swing table - */ - char del_tbl_idx[2][15] = { - {0, 0, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11}, - {0, 0, -1, -2, -3, -4, -4, -4, -4, -5, -7, -8, -9, -9, -10} - }; - u8 thermal_threshold[2][15] = { - {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 27}, - {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 25, 25} - }; - - /*Initilization (7 steps in total) */ - rtlpriv->dm.txpower_trackinginit = true; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "rtl88e_dm_txpower_tracking_callback_thermalmeter\n"); - - thermalvalue = (u8) rtl_get_rfreg(hw, RF90_PATH_A, RF_T_METER, 0xfc00); - if (!thermalvalue) - return; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x\n", - thermalvalue, rtlpriv->dm.thermalvalue, - rtlefuse->eeprom_thermalmeter); - - /*1. Query OFDM Default Setting: Path A*/ - ele_d = rtl_get_bbreg(hw, ROFDM0_XATXIQIMBAL, MASKDWORD) & MASKOFDM_D; - for (i = 0; i < OFDM_TABLE_LENGTH; i++) { - if (ele_d == (ofdmswing_table[i] & MASKOFDM_D)) { - ofdm_old[0] = (u8) i; - rtldm->swing_idx_ofdm_base = (u8)i; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Initial pathA ele_d reg0x%x = 0x%lx, ofdm_index = 0x%x\n", - ROFDM0_XATXIQIMBAL, - ele_d, ofdm_old[0]); - break; - } - } - - if (is2t) { - ele_d = rtl_get_bbreg(hw, ROFDM0_XBTXIQIMBAL, - MASKDWORD) & MASKOFDM_D; - for (i = 0; i < OFDM_TABLE_LENGTH; i++) { - if (ele_d == (ofdmswing_table[i] & MASKOFDM_D)) { - ofdm_old[1] = (u8)i; - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, - DBG_LOUD, - "Initial pathB ele_d reg0x%x = 0x%lx, ofdm_index = 0x%x\n", - ROFDM0_XBTXIQIMBAL, ele_d, - ofdm_old[1]); - break; - } - } - } - /*2.Query CCK default setting From 0xa24*/ - temp_cck = rtl_get_bbreg(hw, RCCK0_TXFILTER2, MASKDWORD) & MASKCCK; - for (i = 0; i < CCK_TABLE_LENGTH; i++) { - if (rtlpriv->dm.cck_inch14) { - if (memcmp(&temp_cck, &cck_tbl_ch14[i][2], 4) == 0) { - cck_old = (u8)i; - rtldm->swing_idx_cck_base = (u8)i; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Initial reg0x%x = 0x%lx, cck_index = 0x%x, ch 14 %d\n", - RCCK0_TXFILTER2, temp_cck, cck_old, - rtlpriv->dm.cck_inch14); - break; - } - } else { - if (memcmp(&temp_cck, &cck_tbl_ch1_13[i][2], 4) == 0) { - cck_old = (u8)i; - rtldm->swing_idx_cck_base = (u8)i; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Initial reg0x%x = 0x%lx, cck_index = 0x%x, ch14 %d\n", - RCCK0_TXFILTER2, temp_cck, cck_old, - rtlpriv->dm.cck_inch14); - break; - } - } - } - - /*3 Initialize ThermalValues of RFCalibrateInfo*/ - if (!rtldm->thermalvalue) { - rtlpriv->dm.thermalvalue = rtlefuse->eeprom_thermalmeter; - rtlpriv->dm.thermalvalue_lck = thermalvalue; - rtlpriv->dm.thermalvalue_iqk = thermalvalue; - for (i = 0; i < rf; i++) - rtlpriv->dm.ofdm_index[i] = ofdm_old[i]; - rtlpriv->dm.cck_index = cck_old; - } - - /*4 Calculate average thermal meter*/ - rtldm->thermalvalue_avg[rtldm->thermalvalue_avg_index] = thermalvalue; - rtldm->thermalvalue_avg_index++; - if (rtldm->thermalvalue_avg_index == AVG_THERMAL_NUM_88E) - rtldm->thermalvalue_avg_index = 0; - - for (i = 0; i < AVG_THERMAL_NUM_88E; i++) { - if (rtldm->thermalvalue_avg[i]) { - thermalvalue_avg += rtldm->thermalvalue_avg[i]; - th_avg_cnt++; - } - } - - if (th_avg_cnt) - thermalvalue = (u8)(thermalvalue_avg / th_avg_cnt); - - /* 5 Calculate delta, delta_LCK, delta_IQK.*/ - if (rtlhal->reloadtxpowerindex) { - delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ? - (thermalvalue - rtlefuse->eeprom_thermalmeter) : - (rtlefuse->eeprom_thermalmeter - thermalvalue); - rtlhal->reloadtxpowerindex = false; - rtlpriv->dm.done_txpower = false; - } else if (rtlpriv->dm.done_txpower) { - delta = (thermalvalue > rtlpriv->dm.thermalvalue) ? - (thermalvalue - rtlpriv->dm.thermalvalue) : - (rtlpriv->dm.thermalvalue - thermalvalue); - } else { - delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ? - (thermalvalue - rtlefuse->eeprom_thermalmeter) : - (rtlefuse->eeprom_thermalmeter - thermalvalue); - } - delta_lck = (thermalvalue > rtlpriv->dm.thermalvalue_lck) ? - (thermalvalue - rtlpriv->dm.thermalvalue_lck) : - (rtlpriv->dm.thermalvalue_lck - thermalvalue); - delta_iqk = (thermalvalue > rtlpriv->dm.thermalvalue_iqk) ? - (thermalvalue - rtlpriv->dm.thermalvalue_iqk) : - (rtlpriv->dm.thermalvalue_iqk - thermalvalue); - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Readback Thermal Meter = 0x%x pre thermal meter 0x%x " - "eeprom_thermalmeter 0x%x delta 0x%x " - "delta_lck 0x%x delta_iqk 0x%x\n", - thermalvalue, rtlpriv->dm.thermalvalue, - rtlefuse->eeprom_thermalmeter, delta, delta_lck, - delta_iqk); - /* 6 If necessary, do LCK.*/ - if (delta_lck >= 8) { - rtlpriv->dm.thermalvalue_lck = thermalvalue; - rtl88e_phy_lc_calibrate(hw); - } - - /* 7 If necessary, move the index of swing table to adjust Tx power. */ - if (delta > 0 && rtlpriv->dm.txpower_track_control) { - delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ? - (thermalvalue - rtlefuse->eeprom_thermalmeter) : - (rtlefuse->eeprom_thermalmeter - thermalvalue); - - /* 7.1 Get the final CCK_index and OFDM_index for each - * swing table. - */ - if (thermalvalue > rtlefuse->eeprom_thermalmeter) { - CAL_SWING_OFF(off, power_inc, IDX_MAP, delta); - for (i = 0; i < rf; i++) - ofdm_index[i] = rtldm->ofdm_index[i] + - del_tbl_idx[power_inc][off]; - cck_index = rtldm->cck_index + - del_tbl_idx[power_inc][off]; - } else { - CAL_SWING_OFF(off, dec, IDX_MAP, delta); - for (i = 0; i < rf; i++) - ofdm_index[i] = rtldm->ofdm_index[i] + - del_tbl_idx[dec][off]; - cck_index = rtldm->cck_index + del_tbl_idx[dec][off]; - } - - /* 7.2 Handle boundary conditions of index.*/ - for (i = 0; i < rf; i++) { - if (ofdm_index[i] > OFDM_TABLE_SIZE-1) - ofdm_index[i] = OFDM_TABLE_SIZE-1; - else if (rtldm->ofdm_index[i] < ofdm_min_index) - ofdm_index[i] = ofdm_min_index; - } - - if (cck_index > CCK_TABLE_SIZE - 1) - cck_index = CCK_TABLE_SIZE - 1; - else if (cck_index < 0) - cck_index = 0; - - /*7.3Configure the Swing Table to adjust Tx Power.*/ - if (rtlpriv->dm.txpower_track_control) { - rtldm->done_txpower = true; - rtldm->swing_idx_ofdm[RF90_PATH_A] = - (u8)ofdm_index[RF90_PATH_A]; - if (is2t) - rtldm->swing_idx_ofdm[RF90_PATH_B] = - (u8)ofdm_index[RF90_PATH_B]; - rtldm->swing_idx_cck = cck_index; - if (rtldm->swing_idx_ofdm_cur != - rtldm->swing_idx_ofdm[0]) { - rtldm->swing_idx_ofdm_cur = - rtldm->swing_idx_ofdm[0]; - rtldm->swing_flag_ofdm = true; - } - - if (rtldm->swing_idx_cck != rtldm->swing_idx_cck) { - rtldm->swing_idx_cck_cur = rtldm->swing_idx_cck; - rtldm->swing_flag_cck = true; - } - - rtl88e_chk_tx_track(hw, TXAGC, 0, 0); - - if (is2t) - rtl88e_chk_tx_track(hw, BBSWING, - RF90_PATH_B, - index_for_channel); - } - } - - if (delta_iqk >= 8) { - rtlpriv->dm.thermalvalue_iqk = thermalvalue; - rtl88e_phy_iq_calibrate(hw, false); - } - - if (rtldm->txpower_track_control) - rtldm->thermalvalue = thermalvalue; - rtldm->txpowercount = 0; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "end\n"); -} - -static void rtl88e_dm_init_txpower_tracking(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.txpower_tracking = true; - rtlpriv->dm.txpower_trackinginit = false; - rtlpriv->dm.txpowercount = 0; - rtlpriv->dm.txpower_track_control = true; - - rtlpriv->dm.swing_idx_ofdm[RF90_PATH_A] = 12; - rtlpriv->dm.swing_idx_ofdm_cur = 12; - rtlpriv->dm.swing_flag_ofdm = false; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - " rtlpriv->dm.txpower_tracking = %d\n", - rtlpriv->dm.txpower_tracking); -} - -void rtl88e_dm_check_txpower_tracking(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - static u8 tm_trigger; - - if (!rtlpriv->dm.txpower_tracking) - return; - - if (!tm_trigger) { - rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER, BIT(17)|BIT(16), - 0x03); - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Trigger 88E Thermal Meter!!\n"); - tm_trigger = 1; - return; - } else { - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Schedule TxPowerTracking !!\n"); - rtl88e_dm_txpower_tracking_callback_thermalmeter(hw); - tm_trigger = 0; - } -} - -void rtl88e_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rate_adaptive *p_ra = &(rtlpriv->ra); - - p_ra->ratr_state = DM_RATR_STA_INIT; - p_ra->pre_ratr_state = DM_RATR_STA_INIT; - - if (rtlpriv->dm.dm_type == DM_TYPE_BYDRIVER) - rtlpriv->dm.useramask = true; - else - rtlpriv->dm.useramask = false; -} - -static void rtl88e_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rate_adaptive *p_ra = &(rtlpriv->ra); - struct ieee80211_sta *sta = NULL; - u32 low_rssi, hi_rssi; - - if (is_hal_stop(rtlhal)) { - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, - "driver is going to unload\n"); - return; - } - - if (!rtlpriv->dm.useramask) { - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, - "driver does not control rate adaptive mask\n"); - return; - } - - if (mac->link_state == MAC80211_LINKED && - mac->opmode == NL80211_IFTYPE_STATION) { - switch (p_ra->pre_ratr_state) { - case DM_RATR_STA_HIGH: - hi_rssi = 50; - low_rssi = 20; - break; - case DM_RATR_STA_MIDDLE: - hi_rssi = 55; - low_rssi = 20; - break; - case DM_RATR_STA_LOW: - hi_rssi = 50; - low_rssi = 25; - break; - default: - hi_rssi = 50; - low_rssi = 20; - break; - } - - if (rtlpriv->dm.undec_sm_pwdb > (long)hi_rssi) - p_ra->ratr_state = DM_RATR_STA_HIGH; - else if (rtlpriv->dm.undec_sm_pwdb > (long)low_rssi) - p_ra->ratr_state = DM_RATR_STA_MIDDLE; - else - p_ra->ratr_state = DM_RATR_STA_LOW; - - if (p_ra->pre_ratr_state != p_ra->ratr_state) { - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, - "RSSI = %ld\n", - rtlpriv->dm.undec_sm_pwdb); - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, - "RSSI_LEVEL = %d\n", p_ra->ratr_state); - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, - "PreState = %d, CurState = %d\n", - p_ra->pre_ratr_state, p_ra->ratr_state); - - rcu_read_lock(); - sta = rtl_find_sta(hw, mac->bssid); - if (sta) - rtlpriv->cfg->ops->update_rate_tbl(hw, sta, - p_ra->ratr_state); - rcu_read_unlock(); - - p_ra->pre_ratr_state = p_ra->ratr_state; - } - } -} - -static void rtl92c_dm_init_dynamic_bb_powersaving(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct ps_t *dm_pstable = &rtlpriv->dm_pstable; - - dm_pstable->pre_ccastate = CCA_MAX; - dm_pstable->cur_ccasate = CCA_MAX; - dm_pstable->pre_rfstate = RF_MAX; - dm_pstable->cur_rfstate = RF_MAX; - dm_pstable->rssi_val_min = 0; -} - -static void rtl88e_dm_update_rx_idle_ant(struct ieee80211_hw *hw, u8 ant) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct fast_ant_training *fat_tbl = &(rtldm->fat_table); - u32 def_ant, opt_ant; - - if (fat_tbl->rx_idle_ant != ant) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "need to update rx idle ant\n"); - if (ant == MAIN_ANT) { - def_ant = (fat_tbl->rx_idle_ant == CG_TRX_HW_ANTDIV) ? - MAIN_ANT_CG_TRX : MAIN_ANT_CGCS_RX; - opt_ant = (fat_tbl->rx_idle_ant == CG_TRX_HW_ANTDIV) ? - AUX_ANT_CG_TRX : AUX_ANT_CGCS_RX; - } else { - def_ant = (fat_tbl->rx_idle_ant == CG_TRX_HW_ANTDIV) ? - AUX_ANT_CG_TRX : AUX_ANT_CGCS_RX; - opt_ant = (fat_tbl->rx_idle_ant == CG_TRX_HW_ANTDIV) ? - MAIN_ANT_CG_TRX : MAIN_ANT_CGCS_RX; - } - - if (rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) { - rtl_set_bbreg(hw, DM_REG_RX_ANT_CTRL_11N, BIT(5) | - BIT(4) | BIT(3), def_ant); - rtl_set_bbreg(hw, DM_REG_RX_ANT_CTRL_11N, BIT(8) | - BIT(7) | BIT(6), opt_ant); - rtl_set_bbreg(hw, DM_REG_ANTSEL_CTRL_11N, BIT(14) | - BIT(13) | BIT(12), def_ant); - rtl_set_bbreg(hw, DM_REG_RESP_TX_11N, BIT(6) | BIT(7), - def_ant); - } else if (rtlefuse->antenna_div_type == CGCS_RX_HW_ANTDIV) { - rtl_set_bbreg(hw, DM_REG_RX_ANT_CTRL_11N, BIT(5) | - BIT(4) | BIT(3), def_ant); - rtl_set_bbreg(hw, DM_REG_RX_ANT_CTRL_11N, BIT(8) | - BIT(7) | BIT(6), opt_ant); - } - } - fat_tbl->rx_idle_ant = ant; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "RxIdleAnt %s\n", - ((ant == MAIN_ANT) ? ("MAIN_ANT") : ("AUX_ANT"))); -} - -static void rtl88e_dm_update_tx_ant(struct ieee80211_hw *hw, - u8 ant, u32 mac_id) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct fast_ant_training *fat_tbl = &(rtldm->fat_table); - u8 target_ant; - - if (ant == MAIN_ANT) - target_ant = MAIN_ANT_CG_TRX; - else - target_ant = AUX_ANT_CG_TRX; - - fat_tbl->antsel_a[mac_id] = target_ant & BIT(0); - fat_tbl->antsel_b[mac_id] = (target_ant & BIT(1)) >> 1; - fat_tbl->antsel_c[mac_id] = (target_ant & BIT(2)) >> 2; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "txfrominfo target ant %s\n", - ((ant == MAIN_ANT) ? ("MAIN_ANT") : ("AUX_ANT"))); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "antsel_tr_mux = 3'b%d%d%d\n", - fat_tbl->antsel_c[mac_id], - fat_tbl->antsel_b[mac_id], fat_tbl->antsel_a[mac_id]); -} - -static void rtl88e_dm_rx_hw_antena_div_init(struct ieee80211_hw *hw) -{ - u32 value32; - /*MAC Setting*/ - value32 = rtl_get_bbreg(hw, DM_REG_ANTSEL_PIN_11N, MASKDWORD); - rtl_set_bbreg(hw, DM_REG_ANTSEL_PIN_11N, MASKDWORD, value32 | - (BIT(23) | BIT(25))); - /*Pin Setting*/ - rtl_set_bbreg(hw, DM_REG_PIN_CTRL_11N, BIT(9) | BIT(8), 0); - rtl_set_bbreg(hw, DM_REG_RX_ANT_CTRL_11N, BIT(10), 0); - rtl_set_bbreg(hw, DM_REG_LNA_SWITCH_11N, BIT(22), 1); - rtl_set_bbreg(hw, DM_REG_LNA_SWITCH_11N, BIT(31), 1); - /*OFDM Setting*/ - rtl_set_bbreg(hw, DM_REG_ANTDIV_PARA1_11N, MASKDWORD, 0x000000a0); - /*CCK Setting*/ - rtl_set_bbreg(hw, DM_REG_BB_PWR_SAV4_11N, BIT(7), 1); - rtl_set_bbreg(hw, DM_REG_CCK_ANTDIV_PARA2_11N, BIT(4), 1); - rtl88e_dm_update_rx_idle_ant(hw, MAIN_ANT); - rtl_set_bbreg(hw, DM_REG_ANT_MAPPING1_11N, MASKLWORD, 0x0201); -} - -static void rtl88e_dm_trx_hw_antenna_div_init(struct ieee80211_hw *hw) -{ - u32 value32; - - /*MAC Setting*/ - value32 = rtl_get_bbreg(hw, DM_REG_ANTSEL_PIN_11N, MASKDWORD); - rtl_set_bbreg(hw, DM_REG_ANTSEL_PIN_11N, MASKDWORD, value32 | - (BIT(23) | BIT(25))); - /*Pin Setting*/ - rtl_set_bbreg(hw, DM_REG_PIN_CTRL_11N, BIT(9) | BIT(8), 0); - rtl_set_bbreg(hw, DM_REG_RX_ANT_CTRL_11N, BIT(10), 0); - rtl_set_bbreg(hw, DM_REG_LNA_SWITCH_11N, BIT(22), 0); - rtl_set_bbreg(hw, DM_REG_LNA_SWITCH_11N, BIT(31), 1); - /*OFDM Setting*/ - rtl_set_bbreg(hw, DM_REG_ANTDIV_PARA1_11N, MASKDWORD, 0x000000a0); - /*CCK Setting*/ - rtl_set_bbreg(hw, DM_REG_BB_PWR_SAV4_11N, BIT(7), 1); - rtl_set_bbreg(hw, DM_REG_CCK_ANTDIV_PARA2_11N, BIT(4), 1); - /*TX Setting*/ - rtl_set_bbreg(hw, DM_REG_TX_ANT_CTRL_11N, BIT(21), 0); - rtl88e_dm_update_rx_idle_ant(hw, MAIN_ANT); - rtl_set_bbreg(hw, DM_REG_ANT_MAPPING1_11N, MASKLWORD, 0x0201); -} - -static void rtl88e_dm_fast_training_init(struct ieee80211_hw *hw) -{ - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct fast_ant_training *fat_tbl = &(rtldm->fat_table); - u32 ant_combo = 2; - u32 value32, i; - - for (i = 0; i < 6; i++) { - fat_tbl->bssid[i] = 0; - fat_tbl->ant_sum[i] = 0; - fat_tbl->ant_cnt[i] = 0; - fat_tbl->ant_ave[i] = 0; - } - fat_tbl->train_idx = 0; - fat_tbl->fat_state = FAT_NORMAL_STATE; - - /*MAC Setting*/ - value32 = rtl_get_bbreg(hw, DM_REG_ANTSEL_PIN_11N, MASKDWORD); - rtl_set_bbreg(hw, DM_REG_ANTSEL_PIN_11N, MASKDWORD, value32 | (BIT(23) | - BIT(25))); - value32 = rtl_get_bbreg(hw, DM_REG_ANT_TRAIN_2, MASKDWORD); - rtl_set_bbreg(hw, DM_REG_ANT_TRAIN_2, MASKDWORD, value32 | (BIT(16) | - BIT(17))); - rtl_set_bbreg(hw, DM_REG_ANT_TRAIN_2, MASKLWORD, 0); - rtl_set_bbreg(hw, DM_REG_ANT_TRAIN_1, MASKDWORD, 0); - - /*Pin Setting*/ - rtl_set_bbreg(hw, DM_REG_PIN_CTRL_11N, BIT(9) | BIT(8), 0); - rtl_set_bbreg(hw, DM_REG_RX_ANT_CTRL_11N, BIT(10), 0); - rtl_set_bbreg(hw, DM_REG_LNA_SWITCH_11N, BIT(22), 0); - rtl_set_bbreg(hw, DM_REG_LNA_SWITCH_11N, BIT(31), 1); - - /*OFDM Setting*/ - rtl_set_bbreg(hw, DM_REG_ANTDIV_PARA1_11N, MASKDWORD, 0x000000a0); - /*antenna mapping table*/ - if (ant_combo == 2) { - rtl_set_bbreg(hw, DM_REG_ANT_MAPPING1_11N, MASKBYTE0, 1); - rtl_set_bbreg(hw, DM_REG_ANT_MAPPING1_11N, MASKBYTE1, 2); - } else if (ant_combo == 7) { - rtl_set_bbreg(hw, DM_REG_ANT_MAPPING1_11N, MASKBYTE0, 1); - rtl_set_bbreg(hw, DM_REG_ANT_MAPPING1_11N, MASKBYTE1, 2); - rtl_set_bbreg(hw, DM_REG_ANT_MAPPING1_11N, MASKBYTE2, 2); - rtl_set_bbreg(hw, DM_REG_ANT_MAPPING1_11N, MASKBYTE3, 3); - rtl_set_bbreg(hw, DM_REG_ANT_MAPPING2_11N, MASKBYTE0, 4); - rtl_set_bbreg(hw, DM_REG_ANT_MAPPING2_11N, MASKBYTE1, 5); - rtl_set_bbreg(hw, DM_REG_ANT_MAPPING2_11N, MASKBYTE2, 6); - rtl_set_bbreg(hw, DM_REG_ANT_MAPPING2_11N, MASKBYTE3, 7); - } - - /*TX Setting*/ - rtl_set_bbreg(hw, DM_REG_TX_ANT_CTRL_11N, BIT(21), 1); - rtl_set_bbreg(hw, DM_REG_RX_ANT_CTRL_11N, BIT(5) | BIT(4) | BIT(3), 0); - rtl_set_bbreg(hw, DM_REG_RX_ANT_CTRL_11N, BIT(8) | BIT(7) | BIT(6), 1); - rtl_set_bbreg(hw, DM_REG_RX_ANT_CTRL_11N, BIT(2) | BIT(1) | BIT(0), - (ant_combo - 1)); - - rtl_set_bbreg(hw, DM_REG_IGI_A_11N, BIT(7), 1); -} - -static void rtl88e_dm_antenna_div_init(struct ieee80211_hw *hw) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - - if (rtlefuse->antenna_div_type == CGCS_RX_HW_ANTDIV) - rtl88e_dm_rx_hw_antena_div_init(hw); - else if (rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) - rtl88e_dm_trx_hw_antenna_div_init(hw); - else if (rtlefuse->antenna_div_type == CG_TRX_SMART_ANTDIV) - rtl88e_dm_fast_training_init(hw); -} - -void rtl88e_dm_set_tx_ant_by_tx_info(struct ieee80211_hw *hw, - u8 *pdesc, u32 mac_id) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct fast_ant_training *fat_tbl = &(rtldm->fat_table); - - if ((rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) || - (rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV)) { - SET_TX_DESC_ANTSEL_A(pdesc, fat_tbl->antsel_a[mac_id]); - SET_TX_DESC_ANTSEL_B(pdesc, fat_tbl->antsel_b[mac_id]); - SET_TX_DESC_ANTSEL_C(pdesc, fat_tbl->antsel_c[mac_id]); - } -} - -void rtl88e_dm_ant_sel_statistics(struct ieee80211_hw *hw, - u8 antsel_tr_mux, u32 mac_id, u32 rx_pwdb_all) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct fast_ant_training *fat_tbl = &(rtldm->fat_table); - - if (rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) { - if (antsel_tr_mux == MAIN_ANT_CG_TRX) { - fat_tbl->main_ant_sum[mac_id] += rx_pwdb_all; - fat_tbl->main_ant_cnt[mac_id]++; - } else { - fat_tbl->aux_ant_sum[mac_id] += rx_pwdb_all; - fat_tbl->aux_ant_cnt[mac_id]++; - } - } else if (rtlefuse->antenna_div_type == CGCS_RX_HW_ANTDIV) { - if (antsel_tr_mux == MAIN_ANT_CGCS_RX) { - fat_tbl->main_ant_sum[mac_id] += rx_pwdb_all; - fat_tbl->main_ant_cnt[mac_id]++; - } else { - fat_tbl->aux_ant_sum[mac_id] += rx_pwdb_all; - fat_tbl->aux_ant_cnt[mac_id]++; - } - } -} - -static void rtl88e_dm_hw_ant_div(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_dig = &rtlpriv->dm_digtable; - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct rtl_sta_info *drv_priv; - struct fast_ant_training *fat_tbl = &(rtldm->fat_table); - u32 i, min_rssi = 0xff, ant_div_max_rssi = 0, max_rssi = 0; - u32 local_min_rssi, local_max_rssi; - u32 main_rssi, aux_rssi; - u8 rx_idle_ant = 0, target_ant = 7; - - i = 0; - main_rssi = (fat_tbl->main_ant_cnt[i] != 0) ? - (fat_tbl->main_ant_sum[i] / - fat_tbl->main_ant_cnt[i]) : 0; - aux_rssi = (fat_tbl->aux_ant_cnt[i] != 0) ? - (fat_tbl->aux_ant_sum[i] / fat_tbl->aux_ant_cnt[i]) : 0; - target_ant = (main_rssi == aux_rssi) ? - fat_tbl->rx_idle_ant : ((main_rssi >= aux_rssi) ? - MAIN_ANT : AUX_ANT); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "main_ant_sum %d main_ant_cnt %d\n", - fat_tbl->main_ant_sum[i], fat_tbl->main_ant_cnt[i]); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "aux_ant_sum %d aux_ant_cnt %d\n", - fat_tbl->aux_ant_sum[i], - fat_tbl->aux_ant_cnt[i]); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "main_rssi %d aux_rssi%d\n", main_rssi, aux_rssi); - local_max_rssi = (main_rssi > aux_rssi) ? main_rssi : aux_rssi; - if ((local_max_rssi > ant_div_max_rssi) && (local_max_rssi < 40)) - ant_div_max_rssi = local_max_rssi; - if (local_max_rssi > max_rssi) - max_rssi = local_max_rssi; - - if ((fat_tbl->rx_idle_ant == MAIN_ANT) && (main_rssi == 0)) - main_rssi = aux_rssi; - else if ((fat_tbl->rx_idle_ant == AUX_ANT) && (aux_rssi == 0)) - aux_rssi = main_rssi; - - local_min_rssi = (main_rssi > aux_rssi) ? aux_rssi : main_rssi; - if (local_min_rssi < min_rssi) { - min_rssi = local_min_rssi; - rx_idle_ant = target_ant; - } - if (rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) - rtl88e_dm_update_tx_ant(hw, target_ant, i); - - if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_AP || - rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC) { - spin_lock_bh(&rtlpriv->locks.entry_list_lock); - list_for_each_entry(drv_priv, &rtlpriv->entry_list, list) { - i++; - main_rssi = (fat_tbl->main_ant_cnt[i] != 0) ? - (fat_tbl->main_ant_sum[i] / - fat_tbl->main_ant_cnt[i]) : 0; - aux_rssi = (fat_tbl->aux_ant_cnt[i] != 0) ? - (fat_tbl->aux_ant_sum[i] / - fat_tbl->aux_ant_cnt[i]) : 0; - target_ant = (main_rssi == aux_rssi) ? - fat_tbl->rx_idle_ant : ((main_rssi >= - aux_rssi) ? MAIN_ANT : AUX_ANT); - - - local_max_rssi = max_t(u32, main_rssi, aux_rssi); - if ((local_max_rssi > ant_div_max_rssi) && - (local_max_rssi < 40)) - ant_div_max_rssi = local_max_rssi; - if (local_max_rssi > max_rssi) - max_rssi = local_max_rssi; - - if ((fat_tbl->rx_idle_ant == MAIN_ANT) && !main_rssi) - main_rssi = aux_rssi; - else if ((fat_tbl->rx_idle_ant == AUX_ANT) && - (aux_rssi == 0)) - aux_rssi = main_rssi; - - local_min_rssi = (main_rssi > aux_rssi) ? - aux_rssi : main_rssi; - if (local_min_rssi < min_rssi) { - min_rssi = local_min_rssi; - rx_idle_ant = target_ant; - } - if (rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) - rtl88e_dm_update_tx_ant(hw, target_ant, i); - } - spin_unlock_bh(&rtlpriv->locks.entry_list_lock); - } - - for (i = 0; i < ASSOCIATE_ENTRY_NUM; i++) { - fat_tbl->main_ant_sum[i] = 0; - fat_tbl->aux_ant_sum[i] = 0; - fat_tbl->main_ant_cnt[i] = 0; - fat_tbl->aux_ant_cnt[i] = 0; - } - - rtl88e_dm_update_rx_idle_ant(hw, rx_idle_ant); - - dm_dig->antdiv_rssi_max = ant_div_max_rssi; - dm_dig->rssi_max = max_rssi; -} - -static void rtl88e_set_next_mac_address_target(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct rtl_sta_info *drv_priv; - struct fast_ant_training *fat_tbl = &(rtldm->fat_table); - u32 value32, i, j = 0; - - if (mac->link_state >= MAC80211_LINKED) { - for (i = 0; i < ASSOCIATE_ENTRY_NUM; i++) { - if ((fat_tbl->train_idx + 1) == ASSOCIATE_ENTRY_NUM) - fat_tbl->train_idx = 0; - else - fat_tbl->train_idx++; - - if (fat_tbl->train_idx == 0) { - value32 = (mac->mac_addr[5] << 8) | - mac->mac_addr[4]; - rtl_set_bbreg(hw, DM_REG_ANT_TRAIN_2, - MASKLWORD, value32); - - value32 = (mac->mac_addr[3] << 24) | - (mac->mac_addr[2] << 16) | - (mac->mac_addr[1] << 8) | - mac->mac_addr[0]; - rtl_set_bbreg(hw, DM_REG_ANT_TRAIN_1, - MASKDWORD, value32); - break; - } - - if (rtlpriv->mac80211.opmode != - NL80211_IFTYPE_STATION) { - spin_lock_bh(&rtlpriv->locks.entry_list_lock); - list_for_each_entry(drv_priv, - &rtlpriv->entry_list, - list) { - j++; - if (j != fat_tbl->train_idx) - continue; - - value32 = (drv_priv->mac_addr[5] << 8) | - drv_priv->mac_addr[4]; - rtl_set_bbreg(hw, DM_REG_ANT_TRAIN_2, - MASKLWORD, value32); - - value32 = (drv_priv->mac_addr[3]<<24) | - (drv_priv->mac_addr[2]<<16) | - (drv_priv->mac_addr[1]<<8) | - drv_priv->mac_addr[0]; - rtl_set_bbreg(hw, DM_REG_ANT_TRAIN_1, - MASKDWORD, value32); - break; - } - spin_unlock_bh(&rtlpriv->locks.entry_list_lock); - /*find entry, break*/ - if (j == fat_tbl->train_idx) - break; - } - } - } -} - -static void rtl88e_dm_fast_ant_training(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct fast_ant_training *fat_tbl = &(rtldm->fat_table); - u32 i, max_rssi = 0; - u8 target_ant = 2; - bool bpkt_filter_match = false; - - if (fat_tbl->fat_state == FAT_TRAINING_STATE) { - for (i = 0; i < 7; i++) { - if (fat_tbl->ant_cnt[i] == 0) { - fat_tbl->ant_ave[i] = 0; - } else { - fat_tbl->ant_ave[i] = fat_tbl->ant_sum[i] / - fat_tbl->ant_cnt[i]; - bpkt_filter_match = true; - } - - if (fat_tbl->ant_ave[i] > max_rssi) { - max_rssi = fat_tbl->ant_ave[i]; - target_ant = (u8) i; - } - } - - if (bpkt_filter_match == false) { - rtl_set_bbreg(hw, DM_REG_TXAGC_A_1_MCS32_11N, - BIT(16), 0); - rtl_set_bbreg(hw, DM_REG_IGI_A_11N, BIT(7), 0); - } else { - rtl_set_bbreg(hw, DM_REG_TXAGC_A_1_MCS32_11N, - BIT(16), 0); - rtl_set_bbreg(hw, DM_REG_RX_ANT_CTRL_11N, BIT(8) | - BIT(7) | BIT(6), target_ant); - rtl_set_bbreg(hw, DM_REG_TX_ANT_CTRL_11N, BIT(21), 1); - - fat_tbl->antsel_a[fat_tbl->train_idx] = - target_ant & BIT(0); - fat_tbl->antsel_b[fat_tbl->train_idx] = - (target_ant & BIT(1)) >> 1; - fat_tbl->antsel_c[fat_tbl->train_idx] = - (target_ant & BIT(2)) >> 2; - - if (target_ant == 0) - rtl_set_bbreg(hw, DM_REG_IGI_A_11N, BIT(7), 0); - } - - for (i = 0; i < 7; i++) { - fat_tbl->ant_sum[i] = 0; - fat_tbl->ant_cnt[i] = 0; - } - - fat_tbl->fat_state = FAT_NORMAL_STATE; - return; - } - - if (fat_tbl->fat_state == FAT_NORMAL_STATE) { - rtl88e_set_next_mac_address_target(hw); - - fat_tbl->fat_state = FAT_TRAINING_STATE; - rtl_set_bbreg(hw, DM_REG_TXAGC_A_1_MCS32_11N, BIT(16), 1); - rtl_set_bbreg(hw, DM_REG_IGI_A_11N, BIT(7), 1); - - mod_timer(&rtlpriv->works.fast_antenna_training_timer, - jiffies + MSECS(RTL_WATCH_DOG_TIME)); - } -} - -void rtl88e_dm_fast_antenna_training_callback(unsigned long data) -{ - struct ieee80211_hw *hw = (struct ieee80211_hw *)data; - - rtl88e_dm_fast_ant_training(hw); -} - -static void rtl88e_dm_antenna_diversity(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct fast_ant_training *fat_tbl = &(rtldm->fat_table); - - if (mac->link_state < MAC80211_LINKED) { - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "No Link\n"); - if (fat_tbl->becomelinked == true) { - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "need to turn off HW AntDiv\n"); - rtl_set_bbreg(hw, DM_REG_IGI_A_11N, BIT(7), 0); - rtl_set_bbreg(hw, DM_REG_CCK_ANTDIV_PARA1_11N, - BIT(15), 0); - if (rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) - rtl_set_bbreg(hw, DM_REG_TX_ANT_CTRL_11N, - BIT(21), 0); - fat_tbl->becomelinked = - (mac->link_state == MAC80211_LINKED) ? true : false; - } - return; - } else { - if (fat_tbl->becomelinked == false) { - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "Need to turn on HW AntDiv\n"); - rtl_set_bbreg(hw, DM_REG_IGI_A_11N, BIT(7), 1); - rtl_set_bbreg(hw, DM_REG_CCK_ANTDIV_PARA1_11N, - BIT(15), 1); - if (rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) - rtl_set_bbreg(hw, DM_REG_TX_ANT_CTRL_11N, - BIT(21), 1); - fat_tbl->becomelinked = - (mac->link_state >= MAC80211_LINKED) ? true : false; - } - } - - if ((rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) || - (rtlefuse->antenna_div_type == CGCS_RX_HW_ANTDIV)) - rtl88e_dm_hw_ant_div(hw); - else if (rtlefuse->antenna_div_type == CG_TRX_SMART_ANTDIV) - rtl88e_dm_fast_ant_training(hw); -} - -void rtl88e_dm_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.dm_type = DM_TYPE_BYDRIVER; - rtl88e_dm_diginit(hw); - rtl88e_dm_init_dynamic_txpower(hw); - rtl88e_dm_init_edca_turbo(hw); - rtl88e_dm_init_rate_adaptive_mask(hw); - rtl88e_dm_init_txpower_tracking(hw); - rtl92c_dm_init_dynamic_bb_powersaving(hw); - rtl88e_dm_antenna_div_init(hw); -} - -void rtl88e_dm_watchdog(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool fw_current_inpsmode = false; - bool fw_ps_awake = true; - - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_FW_PSMODE_STATUS, - (u8 *)(&fw_current_inpsmode)); - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_FWLPS_RF_ON, - (u8 *)(&fw_ps_awake)); - if (ppsc->p2p_ps_info.p2p_ps_mode) - fw_ps_awake = false; - - if ((ppsc->rfpwr_state == ERFON) && - ((!fw_current_inpsmode) && fw_ps_awake) && - (!ppsc->rfchange_inprogress)) { - rtl88e_dm_pwdb_monitor(hw); - rtl88e_dm_dig(hw); - rtl88e_dm_false_alarm_counter_statistics(hw); - rtl92c_dm_dynamic_txpower(hw); - rtl88e_dm_check_txpower_tracking(hw); - rtl88e_dm_refresh_rate_adaptive_mask(hw); - rtl88e_dm_check_edca_turbo(hw); - rtl88e_dm_antenna_diversity(hw); - } -} diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/dm.h b/drivers/net/wireless/rtlwifi/rtl8188ee/dm.h deleted file mode 100644 index 0e07f72ea158..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/dm.h +++ /dev/null @@ -1,326 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL88E_DM_H__ -#define __RTL88E_DM_H__ - -#define MAIN_ANT 0 -#define AUX_ANT 1 -#define MAIN_ANT_CG_TRX 1 -#define AUX_ANT_CG_TRX 0 -#define MAIN_ANT_CGCS_RX 0 -#define AUX_ANT_CGCS_RX 1 - -/*RF REG LIST*/ -#define DM_REG_RF_MODE_11N 0x00 -#define DM_REG_RF_0B_11N 0x0B -#define DM_REG_CHNBW_11N 0x18 -#define DM_REG_T_METER_11N 0x24 -#define DM_REG_RF_25_11N 0x25 -#define DM_REG_RF_26_11N 0x26 -#define DM_REG_RF_27_11N 0x27 -#define DM_REG_RF_2B_11N 0x2B -#define DM_REG_RF_2C_11N 0x2C -#define DM_REG_RXRF_A3_11N 0x3C -#define DM_REG_T_METER_92D_11N 0x42 -#define DM_REG_T_METER_88E_11N 0x42 - -/*BB REG LIST*/ -/*PAGE 8 */ -#define DM_REG_BB_CTRL_11N 0x800 -#define DM_REG_RF_PIN_11N 0x804 -#define DM_REG_PSD_CTRL_11N 0x808 -#define DM_REG_TX_ANT_CTRL_11N 0x80C -#define DM_REG_BB_PWR_SAV5_11N 0x818 -#define DM_REG_CCK_RPT_FORMAT_11N 0x824 -#define DM_REG_RX_DEFAULT_A_11N 0x858 -#define DM_REG_RX_DEFAULT_B_11N 0x85A -#define DM_REG_BB_PWR_SAV3_11N 0x85C -#define DM_REG_ANTSEL_CTRL_11N 0x860 -#define DM_REG_RX_ANT_CTRL_11N 0x864 -#define DM_REG_PIN_CTRL_11N 0x870 -#define DM_REG_BB_PWR_SAV1_11N 0x874 -#define DM_REG_ANTSEL_PATH_11N 0x878 -#define DM_REG_BB_3WIRE_11N 0x88C -#define DM_REG_SC_CNT_11N 0x8C4 -#define DM_REG_PSD_DATA_11N 0x8B4 -/*PAGE 9*/ -#define DM_REG_ANT_MAPPING1_11N 0x914 -#define DM_REG_ANT_MAPPING2_11N 0x918 -/*PAGE A*/ -#define DM_REG_CCK_ANTDIV_PARA1_11N 0xA00 -#define DM_REG_CCK_CCA_11N 0xA0A -#define DM_REG_CCK_ANTDIV_PARA2_11N 0xA0C -#define DM_REG_CCK_ANTDIV_PARA3_11N 0xA10 -#define DM_REG_CCK_ANTDIV_PARA4_11N 0xA14 -#define DM_REG_CCK_FILTER_PARA1_11N 0xA22 -#define DM_REG_CCK_FILTER_PARA2_11N 0xA23 -#define DM_REG_CCK_FILTER_PARA3_11N 0xA24 -#define DM_REG_CCK_FILTER_PARA4_11N 0xA25 -#define DM_REG_CCK_FILTER_PARA5_11N 0xA26 -#define DM_REG_CCK_FILTER_PARA6_11N 0xA27 -#define DM_REG_CCK_FILTER_PARA7_11N 0xA28 -#define DM_REG_CCK_FILTER_PARA8_11N 0xA29 -#define DM_REG_CCK_FA_RST_11N 0xA2C -#define DM_REG_CCK_FA_MSB_11N 0xA58 -#define DM_REG_CCK_FA_LSB_11N 0xA5C -#define DM_REG_CCK_CCA_CNT_11N 0xA60 -#define DM_REG_BB_PWR_SAV4_11N 0xA74 -/*PAGE B */ -#define DM_REG_LNA_SWITCH_11N 0xB2C -#define DM_REG_PATH_SWITCH_11N 0xB30 -#define DM_REG_RSSI_CTRL_11N 0xB38 -#define DM_REG_CONFIG_ANTA_11N 0xB68 -#define DM_REG_RSSI_BT_11N 0xB9C -/*PAGE C */ -#define DM_REG_OFDM_FA_HOLDC_11N 0xC00 -#define DM_REG_RX_PATH_11N 0xC04 -#define DM_REG_TRMUX_11N 0xC08 -#define DM_REG_OFDM_FA_RSTC_11N 0xC0C -#define DM_REG_RXIQI_MATRIX_11N 0xC14 -#define DM_REG_TXIQK_MATRIX_LSB1_11N 0xC4C -#define DM_REG_IGI_A_11N 0xC50 -#define DM_REG_ANTDIV_PARA2_11N 0xC54 -#define DM_REG_IGI_B_11N 0xC58 -#define DM_REG_ANTDIV_PARA3_11N 0xC5C -#define DM_REG_BB_PWR_SAV2_11N 0xC70 -#define DM_REG_RX_OFF_11N 0xC7C -#define DM_REG_TXIQK_MATRIXA_11N 0xC80 -#define DM_REG_TXIQK_MATRIXB_11N 0xC88 -#define DM_REG_TXIQK_MATRIXA_LSB2_11N 0xC94 -#define DM_REG_TXIQK_MATRIXB_LSB2_11N 0xC9C -#define DM_REG_RXIQK_MATRIX_LSB_11N 0xCA0 -#define DM_REG_ANTDIV_PARA1_11N 0xCA4 -#define DM_REG_OFDM_FA_TYPE1_11N 0xCF0 -/*PAGE D */ -#define DM_REG_OFDM_FA_RSTD_11N 0xD00 -#define DM_REG_OFDM_FA_TYPE2_11N 0xDA0 -#define DM_REG_OFDM_FA_TYPE3_11N 0xDA4 -#define DM_REG_OFDM_FA_TYPE4_11N 0xDA8 -/*PAGE E */ -#define DM_REG_TXAGC_A_6_18_11N 0xE00 -#define DM_REG_TXAGC_A_24_54_11N 0xE04 -#define DM_REG_TXAGC_A_1_MCS32_11N 0xE08 -#define DM_REG_TXAGC_A_MCS0_3_11N 0xE10 -#define DM_REG_TXAGC_A_MCS4_7_11N 0xE14 -#define DM_REG_TXAGC_A_MCS8_11_11N 0xE18 -#define DM_REG_TXAGC_A_MCS12_15_11N 0xE1C -#define DM_REG_FPGA0_IQK_11N 0xE28 -#define DM_REG_TXIQK_TONE_A_11N 0xE30 -#define DM_REG_RXIQK_TONE_A_11N 0xE34 -#define DM_REG_TXIQK_PI_A_11N 0xE38 -#define DM_REG_RXIQK_PI_A_11N 0xE3C -#define DM_REG_TXIQK_11N 0xE40 -#define DM_REG_RXIQK_11N 0xE44 -#define DM_REG_IQK_AGC_PTS_11N 0xE48 -#define DM_REG_IQK_AGC_RSP_11N 0xE4C -#define DM_REG_BLUETOOTH_11N 0xE6C -#define DM_REG_RX_WAIT_CCA_11N 0xE70 -#define DM_REG_TX_CCK_RFON_11N 0xE74 -#define DM_REG_TX_CCK_BBON_11N 0xE78 -#define DM_REG_OFDM_RFON_11N 0xE7C -#define DM_REG_OFDM_BBON_11N 0xE80 -#define DM_REG_TX2RX_11N 0xE84 -#define DM_REG_TX2TX_11N 0xE88 -#define DM_REG_RX_CCK_11N 0xE8C -#define DM_REG_RX_OFDM_11N 0xED0 -#define DM_REG_RX_WAIT_RIFS_11N 0xED4 -#define DM_REG_RX2RX_11N 0xED8 -#define DM_REG_STANDBY_11N 0xEDC -#define DM_REG_SLEEP_11N 0xEE0 -#define DM_REG_PMPD_ANAEN_11N 0xEEC - - -/*MAC REG LIST*/ -#define DM_REG_BB_RST_11N 0x02 -#define DM_REG_ANTSEL_PIN_11N 0x4C -#define DM_REG_EARLY_MODE_11N 0x4D0 -#define DM_REG_RSSI_MONITOR_11N 0x4FE -#define DM_REG_EDCA_VO_11N 0x500 -#define DM_REG_EDCA_VI_11N 0x504 -#define DM_REG_EDCA_BE_11N 0x508 -#define DM_REG_EDCA_BK_11N 0x50C -#define DM_REG_TXPAUSE_11N 0x522 -#define DM_REG_RESP_TX_11N 0x6D8 -#define DM_REG_ANT_TRAIN_1 0x7b0 -#define DM_REG_ANT_TRAIN_2 0x7b4 - -/*DIG Related*/ -#define DM_BIT_IGI_11N 0x0000007F - -#define HAL_DM_DIG_DISABLE BIT(0) -#define HAL_DM_HIPWR_DISABLE BIT(1) - -#define OFDM_TABLE_LENGTH 43 -#define CCK_TABLE_LENGTH 33 - -#define OFDM_TABLE_SIZE 43 -#define CCK_TABLE_SIZE 33 - -#define BW_AUTO_SWITCH_HIGH_LOW 25 -#define BW_AUTO_SWITCH_LOW_HIGH 30 - -#define DM_DIG_THRESH_HIGH 40 -#define DM_DIG_THRESH_LOW 35 - -#define DM_FALSEALARM_THRESH_LOW 400 -#define DM_FALSEALARM_THRESH_HIGH 1000 - -#define DM_DIG_MAX 0x3e -#define DM_DIG_MIN 0x1e - -#define DM_DIG_MAX_AP 0x32 -#define DM_DIG_MIN_AP 0x20 - -#define DM_DIG_FA_UPPER 0x3e -#define DM_DIG_FA_LOWER 0x1e -#define DM_DIG_FA_TH0 0x200 -#define DM_DIG_FA_TH1 0x300 -#define DM_DIG_FA_TH2 0x400 - -#define DM_DIG_BACKOFF_MAX 12 -#define DM_DIG_BACKOFF_MIN -4 -#define DM_DIG_BACKOFF_DEFAULT 10 - -#define RXPATHSELECTION_SS_TH_LOW 30 -#define RXPATHSELECTION_DIFF_TH 18 - -#define DM_RATR_STA_INIT 0 -#define DM_RATR_STA_HIGH 1 -#define DM_RATR_STA_MIDDLE 2 -#define DM_RATR_STA_LOW 3 - -#define CTS2SELF_THVAL 30 -#define REGC38_TH 20 - -#define WAIOTTHVAL 25 - -#define TXHIGHPWRLEVEL_NORMAL 0 -#define TXHIGHPWRLEVEL_LEVEL1 1 -#define TXHIGHPWRLEVEL_LEVEL2 2 -#define TXHIGHPWRLEVEL_BT1 3 -#define TXHIGHPWRLEVEL_BT2 4 - -#define DM_TYPE_BYFW 0 -#define DM_TYPE_BYDRIVER 1 - -#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 -#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 -#define TXPWRTRACK_MAX_IDX 6 - -struct swat_t { - u8 failure_cnt; - u8 try_flag; - u8 stop_trying; - long pre_rssi; - long trying_threshold; - u8 cur_antenna; - u8 pre_antenna; -}; - -enum FAT_STATE { - FAT_NORMAL_STATE = 0, - FAT_TRAINING_STATE = 1, -}; - -enum tag_dynamic_init_gain_operation_type_definition { - DIG_TYPE_THRESH_HIGH = 0, - DIG_TYPE_THRESH_LOW = 1, - DIG_TYPE_BACKOFF = 2, - DIG_TYPE_RX_GAIN_MIN = 3, - DIG_TYPE_RX_GAIN_MAX = 4, - DIG_TYPE_ENABLE = 5, - DIG_TYPE_DISABLE = 6, - DIG_OP_TYPE_MAX -}; - -enum tag_cck_packet_detection_threshold_type_definition { - CCK_PD_STAGE_LOWRSSI = 0, - CCK_PD_STAGE_HIGHRSSI = 1, - CCK_FA_STAGE_LOW = 2, - CCK_FA_STAGE_HIGH = 3, - CCK_PD_STAGE_MAX = 4, -}; - -enum dm_1r_cca_e { - CCA_1R = 0, - CCA_2R = 1, - CCA_MAX = 2, -}; - -enum dm_rf_e { - RF_SAVE = 0, - RF_NORMAL = 1, - RF_MAX = 2, -}; - -enum dm_sw_ant_switch_e { - ANS_ANTENNA_B = 1, - ANS_ANTENNA_A = 2, - ANS_ANTENNA_MAX = 3, -}; - -enum dm_dig_ext_port_alg_e { - DIG_EXT_PORT_STAGE_0 = 0, - DIG_EXT_PORT_STAGE_1 = 1, - DIG_EXT_PORT_STAGE_2 = 2, - DIG_EXT_PORT_STAGE_3 = 3, - DIG_EXT_PORT_STAGE_MAX = 4, -}; - -enum dm_dig_connect_e { - DIG_STA_DISCONNECT = 0, - DIG_STA_CONNECT = 1, - DIG_STA_BEFORE_CONNECT = 2, - DIG_MULTISTA_DISCONNECT = 3, - DIG_MULTISTA_CONNECT = 4, - DIG_CONNECT_MAX -}; - -enum pwr_track_control_method { - BBSWING, - TXAGC -}; - -void rtl88e_dm_set_tx_ant_by_tx_info(struct ieee80211_hw *hw, - u8 *pdesc, u32 mac_id); -void rtl88e_dm_ant_sel_statistics(struct ieee80211_hw *hw, u8 antsel_tr_mux, - u32 mac_id, u32 rx_pwdb_all); -void rtl88e_dm_fast_antenna_training_callback(unsigned long data); -void rtl88e_dm_init(struct ieee80211_hw *hw); -void rtl88e_dm_watchdog(struct ieee80211_hw *hw); -void rtl88e_dm_write_dig(struct ieee80211_hw *hw); -void rtl88e_dm_init_edca_turbo(struct ieee80211_hw *hw); -void rtl88e_dm_check_txpower_tracking(struct ieee80211_hw *hw); -void rtl88e_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw); -void rtl88e_dm_txpower_track_adjust(struct ieee80211_hw *hw, - u8 type, u8 *pdirection, - u32 *poutwrite_val); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/fw.c b/drivers/net/wireless/rtlwifi/rtl8188ee/fw.c deleted file mode 100644 index 57e4cc5833a9..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/fw.c +++ /dev/null @@ -1,830 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../base.h" -#include "reg.h" -#include "def.h" -#include "fw.h" - -#include - -static void _rtl88e_enable_fw_download(struct ieee80211_hw *hw, bool enable) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp; - - if (enable) { - tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, tmp | 0x04); - - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL); - rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp | 0x01); - - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL + 2); - rtl_write_byte(rtlpriv, REG_MCUFWDL + 2, tmp & 0xf7); - } else { - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL); - rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp & 0xfe); - - rtl_write_byte(rtlpriv, REG_MCUFWDL + 1, 0x00); - } -} - -static void _rtl88e_fw_block_write(struct ieee80211_hw *hw, - const u8 *buffer, u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 blk_sz = sizeof(u32); - u8 *buf_ptr = (u8 *)buffer; - u32 *pu4BytePtr = (u32 *)buffer; - u32 i, offset, blk_cnt, remain; - - blk_cnt = size / blk_sz; - remain = size % blk_sz; - - for (i = 0; i < blk_cnt; i++) { - offset = i * blk_sz; - rtl_write_dword(rtlpriv, (FW_8192C_START_ADDRESS + offset), - *(pu4BytePtr + i)); - } - - if (remain) { - offset = blk_cnt * blk_sz; - buf_ptr += offset; - for (i = 0; i < remain; i++) { - rtl_write_byte(rtlpriv, (FW_8192C_START_ADDRESS + - offset + i), *(buf_ptr + i)); - } - } -} - -static void _rtl88e_fw_page_write(struct ieee80211_hw *hw, - u32 page, const u8 *buffer, u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 value8; - u8 u8page = (u8) (page & 0x07); - - value8 = (rtl_read_byte(rtlpriv, REG_MCUFWDL + 2) & 0xF8) | u8page; - - rtl_write_byte(rtlpriv, (REG_MCUFWDL + 2), value8); - _rtl88e_fw_block_write(hw, buffer, size); -} - -static void _rtl88e_fill_dummy(u8 *pfwbuf, u32 *pfwlen) -{ - u32 fwlen = *pfwlen; - u8 remain = (u8) (fwlen % 4); - - remain = (remain == 0) ? 0 : (4 - remain); - - while (remain > 0) { - pfwbuf[fwlen] = 0; - fwlen++; - remain--; - } - - *pfwlen = fwlen; -} - -static void _rtl88e_write_fw(struct ieee80211_hw *hw, - enum version_8188e version, u8 *buffer, u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 *buf_ptr = (u8 *)buffer; - u32 page_no, remain; - u32 page, offset; - - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "FW size is %d bytes,\n", size); - - _rtl88e_fill_dummy(buf_ptr, &size); - - page_no = size / FW_8192C_PAGE_SIZE; - remain = size % FW_8192C_PAGE_SIZE; - - if (page_no > 8) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Page numbers should not greater then 8\n"); - } - - for (page = 0; page < page_no; page++) { - offset = page * FW_8192C_PAGE_SIZE; - _rtl88e_fw_page_write(hw, page, (buf_ptr + offset), - FW_8192C_PAGE_SIZE); - } - - if (remain) { - offset = page_no * FW_8192C_PAGE_SIZE; - page = page_no; - _rtl88e_fw_page_write(hw, page, (buf_ptr + offset), remain); - } -} - -static int _rtl88e_fw_free_to_go(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int err = -EIO; - u32 counter = 0; - u32 value32; - - do { - value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - } while ((counter++ < FW_8192C_POLLING_TIMEOUT_COUNT) && - (!(value32 & FWDL_CHKSUM_RPT))); - - if (counter >= FW_8192C_POLLING_TIMEOUT_COUNT) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "chksum report faill ! REG_MCUFWDL:0x%08x .\n", - value32); - goto exit; - } - - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, - "Checksum report OK ! REG_MCUFWDL:0x%08x .\n", value32); - - value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - value32 |= MCUFWDL_RDY; - value32 &= ~WINTINI_RDY; - rtl_write_dword(rtlpriv, REG_MCUFWDL, value32); - - rtl88e_firmware_selfreset(hw); - counter = 0; - - do { - value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - if (value32 & WINTINI_RDY) { - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, - "Polling FW ready success!! REG_MCUFWDL:0x%08x.\n", - value32); - err = 0; - goto exit; - } - - udelay(FW_8192C_POLLING_DELAY); - - } while (counter++ < FW_8192C_POLLING_TIMEOUT_COUNT); - - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Polling FW ready fail!! REG_MCUFWDL:0x%08x .\n", value32); - -exit: - return err; -} - -int rtl88e_download_fw(struct ieee80211_hw *hw, bool buse_wake_on_wlan_fw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl92c_firmware_header *pfwheader; - u8 *pfwdata; - u32 fwsize; - int err; - enum version_8188e version = rtlhal->version; - - if (!rtlhal->pfirmware) - return 1; - - pfwheader = (struct rtl92c_firmware_header *)rtlhal->pfirmware; - pfwdata = (u8 *)rtlhal->pfirmware; - fwsize = rtlhal->fwsize; - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, - "normal Firmware SIZE %d\n", fwsize); - - if (IS_FW_HEADER_EXIST(pfwheader)) { - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, - "Firmware Version(%d), Signature(%#x), Size(%d)\n", - pfwheader->version, pfwheader->signature, - (int)sizeof(struct rtl92c_firmware_header)); - - pfwdata = pfwdata + sizeof(struct rtl92c_firmware_header); - fwsize = fwsize - sizeof(struct rtl92c_firmware_header); - } - - if (rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(7)) { - rtl_write_byte(rtlpriv, REG_MCUFWDL, 0); - rtl88e_firmware_selfreset(hw); - } - _rtl88e_enable_fw_download(hw, true); - _rtl88e_write_fw(hw, version, pfwdata, fwsize); - _rtl88e_enable_fw_download(hw, false); - - err = _rtl88e_fw_free_to_go(hw); - - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, - "Firmware is%s ready to run!\n", err ? " not" : ""); - return 0; -} - -static bool _rtl88e_check_fw_read_last_h2c(struct ieee80211_hw *hw, u8 boxnum) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 val_hmetfr; - - val_hmetfr = rtl_read_byte(rtlpriv, REG_HMETFR); - if (((val_hmetfr >> boxnum) & BIT(0)) == 0) - return true; - return false; -} - -static void _rtl88e_fill_h2c_command(struct ieee80211_hw *hw, - u8 element_id, u32 cmd_len, - u8 *cmd_b) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 boxnum; - u16 box_reg = 0, box_extreg = 0; - u8 u1b_tmp; - bool isfw_read = false; - u8 buf_index = 0; - bool write_sucess = false; - u8 wait_h2c_limit = 100; - u8 wait_writeh2c_limit = 100; - u8 boxc[4], boxext[2]; - u32 h2c_waitcounter = 0; - unsigned long flag; - u8 idx; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "come in\n"); - - while (true) { - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag); - if (rtlhal->h2c_setinprogress) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "H2C set in progress! Wait to set..element_id(%d).\n", - element_id); - - while (rtlhal->h2c_setinprogress) { - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, - flag); - h2c_waitcounter++; - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Wait 100 us (%d times)...\n", - h2c_waitcounter); - udelay(100); - - if (h2c_waitcounter > 1000) - return; - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, - flag); - } - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - } else { - rtlhal->h2c_setinprogress = true; - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - break; - } - } - - while (!write_sucess) { - wait_writeh2c_limit--; - if (wait_writeh2c_limit == 0) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Write H2C fail because no trigger for FW INT!\n"); - break; - } - - boxnum = rtlhal->last_hmeboxnum; - switch (boxnum) { - case 0: - box_reg = REG_HMEBOX_0; - box_extreg = REG_HMEBOX_EXT_0; - break; - case 1: - box_reg = REG_HMEBOX_1; - box_extreg = REG_HMEBOX_EXT_1; - break; - case 2: - box_reg = REG_HMEBOX_2; - box_extreg = REG_HMEBOX_EXT_2; - break; - case 3: - box_reg = REG_HMEBOX_3; - box_extreg = REG_HMEBOX_EXT_3; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - - isfw_read = _rtl88e_check_fw_read_last_h2c(hw, boxnum); - while (!isfw_read) { - wait_h2c_limit--; - if (wait_h2c_limit == 0) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Wating too long for FW read " - "clear HMEBox(%d)!\n", boxnum); - break; - } - - udelay(10); - - isfw_read = _rtl88e_check_fw_read_last_h2c(hw, boxnum); - u1b_tmp = rtl_read_byte(rtlpriv, 0x130); - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Wating for FW read clear HMEBox(%d)!!! " - "0x130 = %2x\n", boxnum, u1b_tmp); - } - - if (!isfw_read) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Write H2C register BOX[%d] fail!!!!! " - "Fw do not read.\n", boxnum); - break; - } - - memset(boxc, 0, sizeof(boxc)); - memset(boxext, 0, sizeof(boxext)); - boxc[0] = element_id; - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Write element_id box_reg(%4x) = %2x\n", - box_reg, element_id); - - switch (cmd_len) { - case 1: - case 2: - case 3: - /*boxc[0] &= ~(BIT(7));*/ - memcpy((u8 *)(boxc) + 1, cmd_b + buf_index, cmd_len); - - for (idx = 0; idx < 4; idx++) - rtl_write_byte(rtlpriv, box_reg+idx, boxc[idx]); - break; - case 4: - case 5: - case 6: - case 7: - /*boxc[0] |= (BIT(7));*/ - memcpy((u8 *)(boxext), cmd_b + buf_index+3, cmd_len-3); - memcpy((u8 *)(boxc) + 1, cmd_b + buf_index, 3); - - for (idx = 0; idx < 2; idx++) { - rtl_write_byte(rtlpriv, box_extreg + idx, - boxext[idx]); - } - - for (idx = 0; idx < 4; idx++) { - rtl_write_byte(rtlpriv, box_reg + idx, - boxc[idx]); - } - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - - write_sucess = true; - - rtlhal->last_hmeboxnum = boxnum + 1; - if (rtlhal->last_hmeboxnum == 4) - rtlhal->last_hmeboxnum = 0; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "pHalData->last_hmeboxnum = %d\n", - rtlhal->last_hmeboxnum); - } - - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag); - rtlhal->h2c_setinprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "go out\n"); -} - -void rtl88e_fill_h2c_cmd(struct ieee80211_hw *hw, - u8 element_id, u32 cmd_len, u8 *cmd_b) -{ - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u32 tmp_cmdbuf[2]; - - if (rtlhal->fw_ready == false) { - RT_ASSERT(false, "fail H2C cmd - Fw download fail!!!\n"); - return; - } - - memset(tmp_cmdbuf, 0, 8); - memcpy(tmp_cmdbuf, cmd_b, cmd_len); - _rtl88e_fill_h2c_command(hw, element_id, cmd_len, (u8 *)&tmp_cmdbuf); - - return; -} - -void rtl88e_firmware_selfreset(struct ieee80211_hw *hw) -{ - u8 u1b_tmp; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN+1); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN+1, (u1b_tmp & (~BIT(2)))); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN+1, (u1b_tmp | BIT(2))); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "8051Reset88E(): 8051 reset success.\n"); -} - -void rtl88e_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 u1_h2c_set_pwrmode[H2C_88E_PWEMODE_LENGTH] = { 0 }; - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - u8 power_state = 0; - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "FW LPS mode = %d\n", mode); - SET_H2CCMD_PWRMODE_PARM_MODE(u1_h2c_set_pwrmode, ((mode) ? 1 : 0)); - SET_H2CCMD_PWRMODE_PARM_RLBM(u1_h2c_set_pwrmode, 0); - SET_H2CCMD_PWRMODE_PARM_SMART_PS(u1_h2c_set_pwrmode, - (rtlpriv->mac80211.p2p) ? - ppsc->smart_ps : 1); - SET_H2CCMD_PWRMODE_PARM_AWAKE_INTERVAL(u1_h2c_set_pwrmode, - ppsc->reg_max_lps_awakeintvl); - SET_H2CCMD_PWRMODE_PARM_ALL_QUEUE_UAPSD(u1_h2c_set_pwrmode, 0); - if (mode == FW_PS_ACTIVE_MODE) - power_state |= FW_PWR_STATE_ACTIVE; - else - power_state |= FW_PWR_STATE_RF_OFF; - SET_H2CCMD_PWRMODE_PARM_PWR_STATE(u1_h2c_set_pwrmode, power_state); - - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "rtl92c_set_fw_pwrmode(): u1_h2c_set_pwrmode\n", - u1_h2c_set_pwrmode, H2C_88E_PWEMODE_LENGTH); - rtl88e_fill_h2c_cmd(hw, H2C_88E_SETPWRMODE, H2C_88E_PWEMODE_LENGTH, - u1_h2c_set_pwrmode); -} - -void rtl88e_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus) -{ - u8 u1_joinbssrpt_parm[1] = { 0 }; - - SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(u1_joinbssrpt_parm, mstatus); - - rtl88e_fill_h2c_cmd(hw, H2C_88E_JOINBSSRPT, 1, u1_joinbssrpt_parm); -} - -void rtl88e_set_fw_ap_off_load_cmd(struct ieee80211_hw *hw, - u8 ap_offload_enable) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u8 u1_apoffload_parm[H2C_88E_AP_OFFLOAD_LENGTH] = { 0 }; - - SET_H2CCMD_AP_OFFLOAD_ON(u1_apoffload_parm, ap_offload_enable); - SET_H2CCMD_AP_OFFLOAD_HIDDEN(u1_apoffload_parm, mac->hiddenssid); - SET_H2CCMD_AP_OFFLOAD_DENYANY(u1_apoffload_parm, 0); - - rtl88e_fill_h2c_cmd(hw, H2C_88E_AP_OFFLOAD, H2C_88E_AP_OFFLOAD_LENGTH, - u1_apoffload_parm); -} - -static bool _rtl88e_cmd_send_packet(struct ieee80211_hw *hw, - struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl8192_tx_ring *ring; - struct rtl_tx_desc *pdesc; - struct sk_buff *pskb = NULL; - unsigned long flags; - - ring = &rtlpci->tx_ring[BEACON_QUEUE]; - - pskb = __skb_dequeue(&ring->queue); - if (pskb) - kfree_skb(pskb); - - spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); - - pdesc = &ring->desc[0]; - - rtlpriv->cfg->ops->fill_tx_cmddesc(hw, (u8 *)pdesc, 1, 1, skb); - - __skb_queue_tail(&ring->queue, skb); - - spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); - - rtlpriv->cfg->ops->tx_polling(hw, BEACON_QUEUE); - - return true; -} - -#define BEACON_PG 0 /* ->1 */ -#define PSPOLL_PG 2 -#define NULL_PG 3 -#define PROBERSP_PG 4 /* ->5 */ - -#define TOTAL_RESERVED_PKT_LEN 768 - -static u8 reserved_page_packet[TOTAL_RESERVED_PKT_LEN] = { - /* page 0 beacon */ - 0x80, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x50, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x64, 0x00, 0x00, 0x04, 0x00, 0x0C, 0x6C, 0x69, - 0x6E, 0x6B, 0x73, 0x79, 0x73, 0x5F, 0x77, 0x6C, - 0x61, 0x6E, 0x01, 0x04, 0x82, 0x84, 0x8B, 0x96, - 0x03, 0x01, 0x01, 0x06, 0x02, 0x00, 0x00, 0x2A, - 0x01, 0x00, 0x32, 0x08, 0x24, 0x30, 0x48, 0x6C, - 0x0C, 0x12, 0x18, 0x60, 0x2D, 0x1A, 0x6C, 0x18, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3D, 0x00, 0xDD, 0x06, 0x00, 0xE0, 0x4C, 0x02, - 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 1 beacon */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 2 ps-poll */ - 0xA4, 0x10, 0x01, 0xC0, 0x00, 0x40, 0x10, 0x10, - 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 3 null */ - 0x48, 0x01, 0x00, 0x00, 0x00, 0x40, 0x10, 0x10, - 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x72, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 4 probe_resp */ - 0x50, 0x00, 0x00, 0x00, 0x00, 0x40, 0x10, 0x10, - 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, - 0x9E, 0x46, 0x15, 0x32, 0x27, 0xF2, 0x2D, 0x00, - 0x64, 0x00, 0x00, 0x04, 0x00, 0x0C, 0x6C, 0x69, - 0x6E, 0x6B, 0x73, 0x79, 0x73, 0x5F, 0x77, 0x6C, - 0x61, 0x6E, 0x01, 0x04, 0x82, 0x84, 0x8B, 0x96, - 0x03, 0x01, 0x01, 0x06, 0x02, 0x00, 0x00, 0x2A, - 0x01, 0x00, 0x32, 0x08, 0x24, 0x30, 0x48, 0x6C, - 0x0C, 0x12, 0x18, 0x60, 0x2D, 0x1A, 0x6C, 0x18, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3D, 0x00, 0xDD, 0x06, 0x00, 0xE0, 0x4C, 0x02, - 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 5 probe_resp */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct sk_buff *skb = NULL; - - u32 totalpacketlen; - u8 u1RsvdPageLoc[5] = { 0 }; - - u8 *beacon; - u8 *pspoll; - u8 *nullfunc; - u8 *probersp; - /*--------------------------------------------------------- - * (1) beacon - *--------------------------------------------------------- - */ - beacon = &reserved_page_packet[BEACON_PG * 128]; - SET_80211_HDR_ADDRESS2(beacon, mac->mac_addr); - SET_80211_HDR_ADDRESS3(beacon, mac->bssid); - - /*------------------------------------------------------- - * (2) ps-poll - *-------------------------------------------------------- - */ - pspoll = &reserved_page_packet[PSPOLL_PG * 128]; - SET_80211_PS_POLL_AID(pspoll, (mac->assoc_id | 0xc000)); - SET_80211_PS_POLL_BSSID(pspoll, mac->bssid); - SET_80211_PS_POLL_TA(pspoll, mac->mac_addr); - - SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG); - - /*-------------------------------------------------------- - * (3) null data - *--------------------------------------------------------- - */ - nullfunc = &reserved_page_packet[NULL_PG * 128]; - SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid); - SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr); - SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid); - - SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1RsvdPageLoc, NULL_PG); - - /*--------------------------------------------------------- - * (4) probe response - *---------------------------------------------------------- - */ - probersp = &reserved_page_packet[PROBERSP_PG * 128]; - SET_80211_HDR_ADDRESS1(probersp, mac->bssid); - SET_80211_HDR_ADDRESS2(probersp, mac->mac_addr); - SET_80211_HDR_ADDRESS3(probersp, mac->bssid); - - SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1RsvdPageLoc, PROBERSP_PG); - - totalpacketlen = TOTAL_RESERVED_PKT_LEN; - - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, - "rtl88e_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL\n", - &reserved_page_packet[0], totalpacketlen); - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "rtl88e_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL\n", - u1RsvdPageLoc, 3); - - skb = dev_alloc_skb(totalpacketlen); - if (!skb) - return; - kmemleak_not_leak(skb); - memcpy(skb_put(skb, totalpacketlen), - &reserved_page_packet, totalpacketlen); - - if (_rtl88e_cmd_send_packet(hw, skb)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Set RSVD page location to Fw.\n"); - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "H2C_RSVDPAGE:\n", u1RsvdPageLoc, 3); - rtl88e_fill_h2c_cmd(hw, H2C_88E_RSVDPAGE, - sizeof(u1RsvdPageLoc), u1RsvdPageLoc); - } else - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Set RSVD page location to Fw FAIL!!!!!!.\n"); -} - -/*Shoud check FW support p2p or not.*/ -static void rtl88e_set_p2p_ctw_period_cmd(struct ieee80211_hw *hw, u8 ctwindow) -{ - u8 u1_ctwindow_period[1] = {ctwindow}; - - rtl88e_fill_h2c_cmd(hw, H2C_88E_P2P_PS_CTW_CMD, 1, u1_ctwindow_period); -} - -void rtl88e_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *rtlps = rtl_psc(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_p2p_ps_info *p2pinfo = &(rtlps->p2p_ps_info); - struct p2p_ps_offload_t *p2p_ps_offload = &rtlhal->p2p_ps_offload; - u8 i; - u16 ctwindow; - u32 start_time, tsf_low; - - switch (p2p_ps_state) { - case P2P_PS_DISABLE: - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_DISABLE\n"); - memset(p2p_ps_offload, 0, sizeof(struct p2p_ps_offload_t)); - break; - case P2P_PS_ENABLE: - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_ENABLE\n"); - /* update CTWindow value. */ - if (p2pinfo->ctwindow > 0) { - p2p_ps_offload->ctwindow_en = 1; - ctwindow = p2pinfo->ctwindow; - rtl88e_set_p2p_ctw_period_cmd(hw, ctwindow); - } - /* hw only support 2 set of NoA */ - for (i = 0; i < p2pinfo->noa_num; i++) { - /* To control the register setting for which NOA*/ - rtl_write_byte(rtlpriv, 0x5cf, (i << 4)); - if (i == 0) - p2p_ps_offload->noa0_en = 1; - else - p2p_ps_offload->noa1_en = 1; - - /* config P2P NoA Descriptor Register */ - rtl_write_dword(rtlpriv, 0x5E0, - p2pinfo->noa_duration[i]); - rtl_write_dword(rtlpriv, 0x5E4, - p2pinfo->noa_interval[i]); - - /*Get Current TSF value */ - tsf_low = rtl_read_dword(rtlpriv, REG_TSFTR); - - start_time = p2pinfo->noa_start_time[i]; - if (p2pinfo->noa_count_type[i] != 1) { - while (start_time <= (tsf_low + (50 * 1024))) { - start_time += p2pinfo->noa_interval[i]; - if (p2pinfo->noa_count_type[i] != 255) - p2pinfo->noa_count_type[i]--; - } - } - rtl_write_dword(rtlpriv, 0x5E8, start_time); - rtl_write_dword(rtlpriv, 0x5EC, - p2pinfo->noa_count_type[i]); - } - - if ((p2pinfo->opp_ps == 1) || (p2pinfo->noa_num > 0)) { - /* rst p2p circuit */ - rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, BIT(4)); - - p2p_ps_offload->offload_en = 1; - - if (P2P_ROLE_GO == rtlpriv->mac80211.p2p) { - p2p_ps_offload->role = 1; - p2p_ps_offload->allstasleep = 0; - } else { - p2p_ps_offload->role = 0; - } - - p2p_ps_offload->discovery = 0; - } - break; - case P2P_PS_SCAN: - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_SCAN\n"); - p2p_ps_offload->discovery = 1; - break; - case P2P_PS_SCAN_DONE: - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_SCAN_DONE\n"); - p2p_ps_offload->discovery = 0; - p2pinfo->p2p_ps_state = P2P_PS_ENABLE; - break; - default: - break; - } - - rtl88e_fill_h2c_cmd(hw, H2C_88E_P2P_PS_OFFLOAD, 1, - (u8 *)p2p_ps_offload); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/fw.h b/drivers/net/wireless/rtlwifi/rtl8188ee/fw.h deleted file mode 100644 index 854a9875cd5f..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/fw.h +++ /dev/null @@ -1,301 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C__FW__H__ -#define __RTL92C__FW__H__ - -#define FW_8192C_SIZE 0x8000 -#define FW_8192C_START_ADDRESS 0x1000 -#define FW_8192C_END_ADDRESS 0x5FFF -#define FW_8192C_PAGE_SIZE 4096 -#define FW_8192C_POLLING_DELAY 5 -#define FW_8192C_POLLING_TIMEOUT_COUNT 3000 - -#define IS_FW_HEADER_EXIST(_pfwhdr) \ - ((_pfwhdr->signature&0xFFFF) == 0x88E1) -#define USE_OLD_WOWLAN_DEBUG_FW 0 - -#define H2C_88E_RSVDPAGE_LOC_LEN 5 -#define H2C_88E_PWEMODE_LENGTH 5 -#define H2C_88E_JOINBSSRPT_LENGTH 1 -#define H2C_88E_AP_OFFLOAD_LENGTH 3 -#define H2C_88E_WOWLAN_LENGTH 3 -#define H2C_88E_KEEP_ALIVE_CTRL_LENGTH 3 -#if (USE_OLD_WOWLAN_DEBUG_FW == 0) -#define H2C_88E_REMOTE_WAKE_CTRL_LEN 1 -#else -#define H2C_88E_REMOTE_WAKE_CTRL_LEN 3 -#endif -#define H2C_88E_AOAC_GLOBAL_INFO_LEN 2 -#define H2C_88E_AOAC_RSVDPAGE_LOC_LEN 7 - -/* Fw PS state for RPWM. - * BIT[2:0] = HW state - * BIT[3] = Protocol PS state, 1: register active state, 0: register sleep state - * BIT[4] = sub-state - */ -#define FW_PS_GO_ON BIT(0) -#define FW_PS_TX_NULL BIT(1) -#define FW_PS_RF_ON BIT(2) -#define FW_PS_REGISTER_ACTIVE BIT(3) - -#define FW_PS_DPS BIT(0) -#define FW_PS_LCLK (FW_PS_DPS) -#define FW_PS_RF_OFF BIT(1) -#define FW_PS_ALL_ON BIT(2) -#define FW_PS_ST_ACTIVE BIT(3) -#define FW_PS_ISR_ENABLE BIT(4) -#define FW_PS_IMR_ENABLE BIT(5) - - -#define FW_PS_ACK BIT(6) -#define FW_PS_TOGGLE BIT(7) - - /* 88E RPWM value*/ - /* BIT[0] = 1: 32k, 0: 40M*/ -#define FW_PS_CLOCK_OFF BIT(0) /* 32k*/ -#define FW_PS_CLOCK_ON 0 /*40M*/ - -#define FW_PS_STATE_MASK (0x0F) -#define FW_PS_STATE_HW_MASK (0x07) -/*ISR_ENABLE, IMR_ENABLE, and PS mode should be inherited.*/ -#define FW_PS_STATE_INT_MASK (0x3F) - -#define FW_PS_STATE(x) (FW_PS_STATE_MASK & (x)) -#define FW_PS_STATE_HW(x) (FW_PS_STATE_HW_MASK & (x)) -#define FW_PS_STATE_INT(x) (FW_PS_STATE_INT_MASK & (x)) -#define FW_PS_ISR_VAL(x) ((x) & 0x70) -#define FW_PS_IMR_MASK(x) ((x) & 0xDF) -#define FW_PS_KEEP_IMR(x) ((x) & 0x20) - -#define FW_PS_STATE_S0 (FW_PS_DPS) -#define FW_PS_STATE_S1 (FW_PS_LCLK) -#define FW_PS_STATE_S2 (FW_PS_RF_OFF) -#define FW_PS_STATE_S3 (FW_PS_ALL_ON) -#define FW_PS_STATE_S4 ((FW_PS_ST_ACTIVE) | (FW_PS_ALL_ON)) - -#define FW_PS_STATE_ALL_ON_88E (FW_PS_CLOCK_ON) -#define FW_PS_STATE_RF_ON_88E (FW_PS_CLOCK_ON) -#define FW_PS_STATE_RF_OFF_88E (FW_PS_CLOCK_ON) -#define FW_PS_STATE_RF_OFF_LOW_PWR_88E (FW_PS_CLOCK_OFF) - -#define FW_PS_STATE_ALL_ON_92C (FW_PS_STATE_S4) -#define FW_PS_STATE_RF_ON_92C (FW_PS_STATE_S3) -#define FW_PS_STATE_RF_OFF_92C (FW_PS_STATE_S2) -#define FW_PS_STATE_RF_OFF_LOW_PWR_92C (FW_PS_STATE_S1) - -/* For 88E H2C PwrMode Cmd ID 5.*/ -#define FW_PWR_STATE_ACTIVE ((FW_PS_RF_ON) | (FW_PS_REGISTER_ACTIVE)) -#define FW_PWR_STATE_RF_OFF 0 - -#define FW_PS_IS_ACK(x) ((x) & FW_PS_ACK) -#define FW_PS_IS_CLK_ON(x) ((x) & (FW_PS_RF_OFF | FW_PS_ALL_ON)) -#define FW_PS_IS_RF_ON(x) ((x) & (FW_PS_ALL_ON)) -#define FW_PS_IS_ACTIVE(x) ((x) & (FW_PS_ST_ACTIVE)) -#define FW_PS_IS_CPWM_INT(x) ((x) & 0x40) - -#define FW_CLR_PS_STATE(x) ((x) = ((x) & (0xF0))) - -#define IS_IN_LOW_POWER_STATE_88E(fwpsstate) \ - (FW_PS_STATE(fwpsstate) == FW_PS_CLOCK_OFF) - -#define FW_PWR_STATE_ACTIVE ((FW_PS_RF_ON) | (FW_PS_REGISTER_ACTIVE)) -#define FW_PWR_STATE_RF_OFF 0 - -struct rtl92c_firmware_header { - u16 signature; - u8 category; - u8 function; - u16 version; - u8 subversion; - u8 rsvd1; - u8 month; - u8 date; - u8 hour; - u8 minute; - u16 ramcodesize; - u16 rsvd2; - u32 svnindex; - u32 rsvd3; - u32 rsvd4; - u32 rsvd5; -}; - -enum rtl8192c_h2c_cmd { - H2C_88E_RSVDPAGE = 0, - H2C_88E_JOINBSSRPT = 1, - H2C_88E_SCAN = 2, - H2C_88E_KEEP_ALIVE_CTRL = 3, - H2C_88E_DISCONNECT_DECISION = 4, -#if (USE_OLD_WOWLAN_DEBUG_FW == 1) - H2C_88E_WO_WLAN = 5, -#endif - H2C_88E_INIT_OFFLOAD = 6, -#if (USE_OLD_WOWLAN_DEBUG_FW == 1) - H2C_88E_REMOTE_WAKE_CTRL = 7, -#endif - H2C_88E_AP_OFFLOAD = 8, - H2C_88E_BCN_RSVDPAGE = 9, - H2C_88E_PROBERSP_RSVDPAGE = 10, - - H2C_88E_SETPWRMODE = 0x20, - H2C_88E_PS_TUNING_PARA = 0x21, - H2C_88E_PS_TUNING_PARA2 = 0x22, - H2C_88E_PS_LPS_PARA = 0x23, - H2C_88E_P2P_PS_OFFLOAD = 024, - -#if (USE_OLD_WOWLAN_DEBUG_FW == 0) - H2C_88E_WO_WLAN = 0x80, - H2C_88E_REMOTE_WAKE_CTRL = 0x81, - H2C_88E_AOAC_GLOBAL_INFO = 0x82, - H2C_88E_AOAC_RSVDPAGE = 0x83, -#endif - /* Not defined in new 88E H2C CMD Format */ - H2C_88E_RA_MASK, - H2C_88E_SELECTIVE_SUSPEND_ROF_CMD, - H2C_88E_P2P_PS_MODE, - H2C_88E_PSD_RESULT, - /*Not defined CTW CMD for P2P yet*/ - H2C_88E_P2P_PS_CTW_CMD, - MAX_88E_H2CCMD -}; - -#define pagenum_128(_len) (u32)(((_len)>>7) + ((_len)&0x7F ? 1 : 0)) - -#define SET_88E_H2CCMD_WOWLAN_FUNC_ENABLE(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 0, 1, __value) -#define SET_88E_H2CCMD_WOWLAN_PATTERN_MATCH_ENABLE(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 1, 1, __value) -#define SET_88E_H2CCMD_WOWLAN_MAGIC_PKT_ENABLE(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 2, 1, __value) -#define SET_88E_H2CCMD_WOWLAN_UNICAST_PKT_ENABLE(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 3, 1, __value) -#define SET_88E_H2CCMD_WOWLAN_ALL_PKT_DROP(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 4, 1, __value) -#define SET_88E_H2CCMD_WOWLAN_GPIO_ACTIVE(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 5, 1, __value) -#define SET_88E_H2CCMD_WOWLAN_REKEY_WAKE_UP(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 6, 1, __value) -#define SET_88E_H2CCMD_WOWLAN_DISCONNECT_WAKE_UP(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 7, 1, __value) -#define SET_88E_H2CCMD_WOWLAN_GPIONUM(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+1, 0, 8, __value) -#define SET_88E_H2CCMD_WOWLAN_GPIO_DURATION(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+2, 0, 8, __value) - - -#define SET_H2CCMD_PWRMODE_PARM_MODE(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_PWRMODE_PARM_RLBM(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+1, 0, 4, __value) -#define SET_H2CCMD_PWRMODE_PARM_SMART_PS(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+1, 4, 4, __value) -#define SET_H2CCMD_PWRMODE_PARM_AWAKE_INTERVAL(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+2, 0, 8, __value) -#define SET_H2CCMD_PWRMODE_PARM_ALL_QUEUE_UAPSD(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+3, 0, 8, __value) -#define SET_H2CCMD_PWRMODE_PARM_PWR_STATE(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+4, 0, 8, __value) -#define GET_88E_H2CCMD_PWRMODE_PARM_MODE(__cmd) \ - LE_BITS_TO_1BYTE(__cmd, 0, 8) - -#define SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val) - -/* AP_OFFLOAD */ -#define SET_H2CCMD_AP_OFFLOAD_ON(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 0, 8, __value) -#define SET_H2CCMD_AP_OFFLOAD_HIDDEN(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+1, 0, 8, __value) -#define SET_H2CCMD_AP_OFFLOAD_DENYANY(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+2, 0, 8, __value) -#define SET_H2CCMD_AP_OFFLOAD_WAKEUP_EVT_RPT(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+3, 0, 8, __value) - -/* Keep Alive Control*/ -#define SET_88E_H2CCMD_KEEP_ALIVE_ENABLE(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 0, 1, __value) -#define SET_88E_H2CCMD_KEEP_ALIVE_ACCPEPT_USER_DEFINED(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 1, 1, __value) -#define SET_88E_H2CCMD_KEEP_ALIVE_PERIOD(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+1, 0, 8, __value) - -/*REMOTE_WAKE_CTRL */ -#define SET_88E_H2CCMD_REMOTE_WAKE_CTRL_EN(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 0, 1, __value) -#if (USE_OLD_WOWLAN_DEBUG_FW == 0) -#define SET_88E_H2CCMD_REMOTE_WAKE_CTRL_ARP_OFFLOAD_EN(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 1, 1, __value) -#define SET_88E_H2CCMD_REMOTE_WAKE_CTRL_NDP_OFFLOAD_EN(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 2, 1, __value) -#define SET_88E_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 3, 1, __value) -#else -#define SET_88E_H2_REM_WAKE_ENC_ALG(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+1, 0, 8, __value) -#define SET_88E_H2CCMD_REMOTE_WAKE_CTRL_GROUP_ENC_ALG(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+2, 0, 8, __value) -#endif - -/* GTK_OFFLOAD */ -#define SET_88E_H2CCMD_AOAC_GLOBAL_INFO_PAIRWISE_ENC_ALG(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE(__cmd, 0, 8, __value) -#define SET_88E_H2CCMD_AOAC_GLOBAL_INFO_GROUP_ENC_ALG(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+1, 0, 8, __value) - -/* AOAC_RSVDPAGE_LOC */ -#define SET_88E_H2CCMD_AOAC_RSVD_LOC_REM_WAKE_CTRL_INFO(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd), 0, 8, __value) -#define SET_88E_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+1, 0, 8, __value) -#define SET_88E_H2CCMD_AOAC_RSVDPAGE_LOC_NEIGHBOR_ADV(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+2, 0, 8, __value) -#define SET_88E_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_RSP(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+3, 0, 8, __value) -#define SET_88E_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_INFO(__cmd, __value) \ - SET_BITS_TO_LE_1BYTE((__cmd)+4, 0, 8, __value) - -int rtl88e_download_fw(struct ieee80211_hw *hw, - bool buse_wake_on_wlan_fw); -void rtl88e_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id, - u32 cmd_len, u8 *p_cmdbuffer); -void rtl88e_firmware_selfreset(struct ieee80211_hw *hw); -void rtl88e_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); -void rtl88e_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, - u8 mstatus); -void rtl88e_set_fw_ap_off_load_cmd(struct ieee80211_hw *hw, u8 enable); -void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished); -void rtl88e_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c deleted file mode 100644 index e06971be7df7..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c +++ /dev/null @@ -1,2531 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../efuse.h" -#include "../base.h" -#include "../regd.h" -#include "../cam.h" -#include "../ps.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "fw.h" -#include "led.h" -#include "hw.h" -#include "pwrseqcmd.h" -#include "pwrseq.h" - -#define LLT_CONFIG 5 - -static void _rtl88ee_set_bcn_ctrl_reg(struct ieee80211_hw *hw, - u8 set_bits, u8 clear_bits) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpci->reg_bcn_ctrl_val |= set_bits; - rtlpci->reg_bcn_ctrl_val &= ~clear_bits; - - rtl_write_byte(rtlpriv, REG_BCN_CTRL, (u8) rtlpci->reg_bcn_ctrl_val); -} - -static void _rtl88ee_stop_tx_beacon(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp1byte; - - tmp1byte = rtl_read_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2); - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, tmp1byte & (~BIT(6))); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0x64); - tmp1byte = rtl_read_byte(rtlpriv, REG_TBTT_PROHIBIT + 2); - tmp1byte &= ~(BIT(0)); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 2, tmp1byte); -} - -static void _rtl88ee_resume_tx_beacon(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp1byte; - - tmp1byte = rtl_read_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2); - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, tmp1byte | BIT(6)); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0xff); - tmp1byte = rtl_read_byte(rtlpriv, REG_TBTT_PROHIBIT + 2); - tmp1byte |= BIT(0); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 2, tmp1byte); -} - -static void _rtl88ee_enable_bcn_sub_func(struct ieee80211_hw *hw) -{ - _rtl88ee_set_bcn_ctrl_reg(hw, 0, BIT(1)); -} - -static void _rtl88ee_return_beacon_queue_skb(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[BEACON_QUEUE]; - - while (skb_queue_len(&ring->queue)) { - struct rtl_tx_desc *entry = &ring->desc[ring->idx]; - struct sk_buff *skb = __skb_dequeue(&ring->queue); - - pci_unmap_single(rtlpci->pdev, - rtlpriv->cfg->ops->get_desc( - (u8 *)entry, true, HW_DESC_TXBUFF_ADDR), - skb->len, PCI_DMA_TODEVICE); - kfree_skb(skb); - ring->idx = (ring->idx + 1) % ring->entries; - } -} - -static void _rtl88ee_disable_bcn_sub_func(struct ieee80211_hw *hw) -{ - _rtl88ee_set_bcn_ctrl_reg(hw, BIT(1), 0); -} - -static void _rtl88ee_set_fw_clock_on(struct ieee80211_hw *hw, - u8 rpwm_val, bool need_turn_off_ckk) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - bool support_remote_wake_up; - u32 count = 0, isr_regaddr, content; - bool schedule_timer = need_turn_off_ckk; - - rtlpriv->cfg->ops->get_hw_reg(hw, HAL_DEF_WOWLAN, - (u8 *)(&support_remote_wake_up)); - if (!rtlhal->fw_ready) - return; - if (!rtlpriv->psc.fw_current_inpsmode) - return; - - while (1) { - spin_lock_bh(&rtlpriv->locks.fw_ps_lock); - if (rtlhal->fw_clk_change_in_progress) { - while (rtlhal->fw_clk_change_in_progress) { - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - udelay(100); - if (++count > 1000) - return; - spin_lock_bh(&rtlpriv->locks.fw_ps_lock); - } - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - } else { - rtlhal->fw_clk_change_in_progress = false; - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - break; - } - } - - if (IS_IN_LOW_POWER_STATE_88E(rtlhal->fw_ps_state)) { - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_SET_RPWM, - (u8 *)(&rpwm_val)); - if (FW_PS_IS_ACK(rpwm_val)) { - isr_regaddr = REG_HISR; - content = rtl_read_dword(rtlpriv, isr_regaddr); - while (!(content & IMR_CPWM) && (count < 500)) { - udelay(50); - count++; - content = rtl_read_dword(rtlpriv, isr_regaddr); - } - - if (content & IMR_CPWM) { - rtl_write_word(rtlpriv, isr_regaddr, 0x0100); - rtlhal->fw_ps_state = FW_PS_STATE_RF_ON_88E; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Receive CPWM INT!!! Set pHalData->FwPSState = %X\n", - rtlhal->fw_ps_state); - } - } - - spin_lock_bh(&rtlpriv->locks.fw_ps_lock); - rtlhal->fw_clk_change_in_progress = false; - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - if (schedule_timer) { - mod_timer(&rtlpriv->works.fw_clockoff_timer, - jiffies + MSECS(10)); - } - } else { - spin_lock_bh(&rtlpriv->locks.fw_ps_lock); - rtlhal->fw_clk_change_in_progress = false; - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - } -} - -static void _rtl88ee_set_fw_clock_off(struct ieee80211_hw *hw, - u8 rpwm_val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl8192_tx_ring *ring; - enum rf_pwrstate rtstate; - bool schedule_timer = false; - u8 queue; - - if (!rtlhal->fw_ready) - return; - if (!rtlpriv->psc.fw_current_inpsmode) - return; - if (!rtlhal->allow_sw_to_change_hwclc) - return; - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RF_STATE, (u8 *)(&rtstate)); - if (rtstate == ERFOFF || rtlpriv->psc.inactive_pwrstate == ERFOFF) - return; - - for (queue = 0; queue < RTL_PCI_MAX_TX_QUEUE_COUNT; queue++) { - ring = &rtlpci->tx_ring[queue]; - if (skb_queue_len(&ring->queue)) { - schedule_timer = true; - break; - } - } - - if (schedule_timer) { - mod_timer(&rtlpriv->works.fw_clockoff_timer, - jiffies + MSECS(10)); - return; - } - - if (FW_PS_STATE(rtlhal->fw_ps_state) != - FW_PS_STATE_RF_OFF_LOW_PWR_88E) { - spin_lock_bh(&rtlpriv->locks.fw_ps_lock); - if (!rtlhal->fw_clk_change_in_progress) { - rtlhal->fw_clk_change_in_progress = true; - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - rtlhal->fw_ps_state = FW_PS_STATE(rpwm_val); - rtl_write_word(rtlpriv, REG_HISR, 0x0100); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SET_RPWM, - (u8 *)(&rpwm_val)); - spin_lock_bh(&rtlpriv->locks.fw_ps_lock); - rtlhal->fw_clk_change_in_progress = false; - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - } else { - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - mod_timer(&rtlpriv->works.fw_clockoff_timer, - jiffies + MSECS(10)); - } - } -} - -static void _rtl88ee_set_fw_ps_rf_on(struct ieee80211_hw *hw) -{ - u8 rpwm_val = 0; - - rpwm_val |= (FW_PS_STATE_RF_OFF_88E | FW_PS_ACK); - _rtl88ee_set_fw_clock_on(hw, rpwm_val, true); -} - -static void _rtl88ee_set_fw_ps_rf_off_low_power(struct ieee80211_hw *hw) -{ - u8 rpwm_val = 0; - - rpwm_val |= FW_PS_STATE_RF_OFF_LOW_PWR_88E; - _rtl88ee_set_fw_clock_off(hw, rpwm_val); -} - -void rtl88ee_fw_clk_off_timer_callback(unsigned long data) -{ - struct ieee80211_hw *hw = (struct ieee80211_hw *)data; - - _rtl88ee_set_fw_ps_rf_off_low_power(hw); -} - -static void _rtl88ee_fwlps_leave(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - bool fw_current_inps = false; - u8 rpwm_val = 0, fw_pwrmode = FW_PS_ACTIVE_MODE; - - if (ppsc->low_power_enable) { - rpwm_val = (FW_PS_STATE_ALL_ON_88E|FW_PS_ACK);/* RF on */ - _rtl88ee_set_fw_clock_on(hw, rpwm_val, false); - rtlhal->allow_sw_to_change_hwclc = false; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_H2C_FW_PWRMODE, - (u8 *)(&fw_pwrmode)); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_FW_PSMODE_STATUS, - (u8 *)(&fw_current_inps)); - } else { - rpwm_val = FW_PS_STATE_ALL_ON_88E; /* RF on */ - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SET_RPWM, - (u8 *)(&rpwm_val)); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_H2C_FW_PWRMODE, - (u8 *)(&fw_pwrmode)); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_FW_PSMODE_STATUS, - (u8 *)(&fw_current_inps)); - } -} - -static void _rtl88ee_fwlps_enter(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - bool fw_current_inps = true; - u8 rpwm_val; - - if (ppsc->low_power_enable) { - rpwm_val = FW_PS_STATE_RF_OFF_LOW_PWR_88E; /* RF off */ - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_FW_PSMODE_STATUS, - (u8 *)(&fw_current_inps)); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_H2C_FW_PWRMODE, - (u8 *)(&ppsc->fwctrl_psmode)); - rtlhal->allow_sw_to_change_hwclc = true; - _rtl88ee_set_fw_clock_off(hw, rpwm_val); - } else { - rpwm_val = FW_PS_STATE_RF_OFF_88E; /* RF off */ - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_FW_PSMODE_STATUS, - (u8 *)(&fw_current_inps)); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_H2C_FW_PWRMODE, - (u8 *)(&ppsc->fwctrl_psmode)); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SET_RPWM, - (u8 *)(&rpwm_val)); - } -} - -void rtl88ee_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - switch (variable) { - case HW_VAR_RCR: - *((u32 *)(val)) = rtlpci->receive_config; - break; - case HW_VAR_RF_STATE: - *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state; - break; - case HW_VAR_FWLPS_RF_ON:{ - enum rf_pwrstate rfstate; - u32 val_rcr; - - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RF_STATE, - (u8 *)(&rfstate)); - if (rfstate == ERFOFF) { - *((bool *)(val)) = true; - } else { - val_rcr = rtl_read_dword(rtlpriv, REG_RCR); - val_rcr &= 0x00070000; - if (val_rcr) - *((bool *)(val)) = false; - else - *((bool *)(val)) = true; - } - break; - } - case HW_VAR_FW_PSMODE_STATUS: - *((bool *)(val)) = ppsc->fw_current_inpsmode; - break; - case HW_VAR_CORRECT_TSF:{ - u64 tsf; - u32 *ptsf_low = (u32 *)&tsf; - u32 *ptsf_high = ((u32 *)&tsf) + 1; - - *ptsf_high = rtl_read_dword(rtlpriv, (REG_TSFTR + 4)); - *ptsf_low = rtl_read_dword(rtlpriv, REG_TSFTR); - - *((u64 *)(val)) = tsf; - break; } - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not process %x\n", variable); - break; - } -} - -void rtl88ee_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - u8 idx; - - switch (variable) { - case HW_VAR_ETHER_ADDR: - for (idx = 0; idx < ETH_ALEN; idx++) - rtl_write_byte(rtlpriv, (REG_MACID + idx), val[idx]); - break; - case HW_VAR_BASIC_RATE:{ - u16 rate_cfg = ((u16 *)val)[0]; - u8 rate_index = 0; - rate_cfg = rate_cfg & 0x15f; - rate_cfg |= 0x01; - rtl_write_byte(rtlpriv, REG_RRSR, rate_cfg & 0xff); - rtl_write_byte(rtlpriv, REG_RRSR + 1, (rate_cfg >> 8) & 0xff); - while (rate_cfg > 0x1) { - rate_cfg = (rate_cfg >> 1); - rate_index++; - } - rtl_write_byte(rtlpriv, REG_INIRTS_RATE_SEL, rate_index); - break; } - case HW_VAR_BSSID: - for (idx = 0; idx < ETH_ALEN; idx++) - rtl_write_byte(rtlpriv, (REG_BSSID + idx), val[idx]); - break; - case HW_VAR_SIFS: - rtl_write_byte(rtlpriv, REG_SIFS_CTX + 1, val[0]); - rtl_write_byte(rtlpriv, REG_SIFS_TRX + 1, val[1]); - - rtl_write_byte(rtlpriv, REG_SPEC_SIFS + 1, val[0]); - rtl_write_byte(rtlpriv, REG_MAC_SPEC_SIFS + 1, val[0]); - - if (!mac->ht_enable) - rtl_write_word(rtlpriv, REG_RESP_SIFS_OFDM, 0x0e0e); - else - rtl_write_word(rtlpriv, REG_RESP_SIFS_OFDM, - *((u16 *)val)); - break; - case HW_VAR_SLOT_TIME:{ - u8 e_aci; - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "HW_VAR_SLOT_TIME %x\n", val[0]); - - rtl_write_byte(rtlpriv, REG_SLOT, val[0]); - - for (e_aci = 0; e_aci < AC_MAX; e_aci++) { - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_AC_PARAM, - (u8 *)(&e_aci)); - } - break; } - case HW_VAR_ACK_PREAMBLE:{ - u8 reg_tmp; - u8 short_preamble = (bool) (*(u8 *)val); - reg_tmp = rtl_read_byte(rtlpriv, REG_TRXPTCL_CTL+2); - if (short_preamble) { - reg_tmp |= 0x02; - rtl_write_byte(rtlpriv, REG_TRXPTCL_CTL + 2, reg_tmp); - } else { - reg_tmp |= 0xFD; - rtl_write_byte(rtlpriv, REG_TRXPTCL_CTL + 2, reg_tmp); - } - break; } - case HW_VAR_WPA_CONFIG: - rtl_write_byte(rtlpriv, REG_SECCFG, *((u8 *)val)); - break; - case HW_VAR_AMPDU_MIN_SPACE:{ - u8 min_spacing_to_set; - u8 sec_min_space; - - min_spacing_to_set = *((u8 *)val); - if (min_spacing_to_set <= 7) { - sec_min_space = 0; - - if (min_spacing_to_set < sec_min_space) - min_spacing_to_set = sec_min_space; - - mac->min_space_cfg = ((mac->min_space_cfg & - 0xf8) | min_spacing_to_set); - - *val = min_spacing_to_set; - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_AMPDU_MIN_SPACE: %#x\n", - mac->min_space_cfg); - - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, - mac->min_space_cfg); - } - break; } - case HW_VAR_SHORTGI_DENSITY:{ - u8 density_to_set; - - density_to_set = *((u8 *)val); - mac->min_space_cfg |= (density_to_set << 3); - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_SHORTGI_DENSITY: %#x\n", - mac->min_space_cfg); - - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, - mac->min_space_cfg); - break; } - case HW_VAR_AMPDU_FACTOR:{ - u8 regtoset_normal[4] = { 0x41, 0xa8, 0x72, 0xb9 }; - u8 factor; - u8 *reg = NULL; - u8 id = 0; - - reg = regtoset_normal; - - factor = *((u8 *)val); - if (factor <= 3) { - factor = (1 << (factor + 2)); - if (factor > 0xf) - factor = 0xf; - - for (id = 0; id < 4; id++) { - if ((reg[id] & 0xf0) > (factor << 4)) - reg[id] = (reg[id] & 0x0f) | - (factor << 4); - - if ((reg[id] & 0x0f) > factor) - reg[id] = (reg[id] & 0xf0) | (factor); - - rtl_write_byte(rtlpriv, (REG_AGGLEN_LMT + id), - reg[id]); - } - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_AMPDU_FACTOR: %#x\n", factor); - } - break; } - case HW_VAR_AC_PARAM:{ - u8 e_aci = *((u8 *)val); - rtl88e_dm_init_edca_turbo(hw); - - if (rtlpci->acm_method != eAcmWay2_SW) - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ACM_CTRL, - (u8 *)(&e_aci)); - break; } - case HW_VAR_ACM_CTRL:{ - u8 e_aci = *((u8 *)val); - union aci_aifsn *p_aci_aifsn = - (union aci_aifsn *)(&(mac->ac[0].aifs)); - u8 acm = p_aci_aifsn->f.acm; - u8 acm_ctrl = rtl_read_byte(rtlpriv, REG_ACMHWCTRL); - - acm_ctrl = acm_ctrl | ((rtlpci->acm_method == 2) ? 0x0 : 0x1); - - if (acm) { - switch (e_aci) { - case AC0_BE: - acm_ctrl |= ACMHW_BEQEN; - break; - case AC2_VI: - acm_ctrl |= ACMHW_VIQEN; - break; - case AC3_VO: - acm_ctrl |= ACMHW_VOQEN; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "HW_VAR_ACM_CTRL acm set failed: eACI is %d\n", - acm); - break; - } - } else { - switch (e_aci) { - case AC0_BE: - acm_ctrl &= (~ACMHW_BEQEN); - break; - case AC2_VI: - acm_ctrl &= (~ACMHW_VIQEN); - break; - case AC3_VO: - acm_ctrl &= (~ACMHW_BEQEN); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not process\n"); - break; - } - } - - RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE, - "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", - acm_ctrl); - rtl_write_byte(rtlpriv, REG_ACMHWCTRL, acm_ctrl); - break; } - case HW_VAR_RCR: - rtl_write_dword(rtlpriv, REG_RCR, ((u32 *)(val))[0]); - rtlpci->receive_config = ((u32 *)(val))[0]; - break; - case HW_VAR_RETRY_LIMIT:{ - u8 retry_limit = ((u8 *)(val))[0]; - - rtl_write_word(rtlpriv, REG_RL, - retry_limit << RETRY_LIMIT_SHORT_SHIFT | - retry_limit << RETRY_LIMIT_LONG_SHIFT); - break; } - case HW_VAR_DUAL_TSF_RST: - rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, (BIT(0) | BIT(1))); - break; - case HW_VAR_EFUSE_BYTES: - rtlefuse->efuse_usedbytes = *((u16 *)val); - break; - case HW_VAR_EFUSE_USAGE: - rtlefuse->efuse_usedpercentage = *((u8 *)val); - break; - case HW_VAR_IO_CMD: - rtl88e_phy_set_io_cmd(hw, (*(enum io_type *)val)); - break; - case HW_VAR_SET_RPWM:{ - u8 rpwm_val; - - rpwm_val = rtl_read_byte(rtlpriv, REG_PCIE_HRPWM); - udelay(1); - - if (rpwm_val & BIT(7)) { - rtl_write_byte(rtlpriv, REG_PCIE_HRPWM, - (*(u8 *)val)); - } else { - rtl_write_byte(rtlpriv, REG_PCIE_HRPWM, - ((*(u8 *)val) | BIT(7))); - } - break; } - case HW_VAR_H2C_FW_PWRMODE: - rtl88e_set_fw_pwrmode_cmd(hw, (*(u8 *)val)); - break; - case HW_VAR_FW_PSMODE_STATUS: - ppsc->fw_current_inpsmode = *((bool *)val); - break; - case HW_VAR_RESUME_CLK_ON: - _rtl88ee_set_fw_ps_rf_on(hw); - break; - case HW_VAR_FW_LPS_ACTION:{ - bool enter_fwlps = *((bool *)val); - - if (enter_fwlps) - _rtl88ee_fwlps_enter(hw); - else - _rtl88ee_fwlps_leave(hw); - break; } - case HW_VAR_H2C_FW_JOINBSSRPT:{ - u8 mstatus = (*(u8 *)val); - u8 tmp, tmp_reg422, uval; - u8 count = 0, dlbcn_count = 0; - bool recover = false; - - if (mstatus == RT_MEDIA_CONNECT) { - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_AID, NULL); - - tmp = rtl_read_byte(rtlpriv, REG_CR + 1); - rtl_write_byte(rtlpriv, REG_CR + 1, (tmp | BIT(0))); - - _rtl88ee_set_bcn_ctrl_reg(hw, 0, BIT(3)); - _rtl88ee_set_bcn_ctrl_reg(hw, BIT(4), 0); - - tmp_reg422 = rtl_read_byte(rtlpriv, - REG_FWHW_TXQ_CTRL + 2); - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, - tmp_reg422 & (~BIT(6))); - if (tmp_reg422 & BIT(6)) - recover = true; - - do { - uval = rtl_read_byte(rtlpriv, REG_TDECTRL+2); - rtl_write_byte(rtlpriv, REG_TDECTRL+2, - (uval | BIT(0))); - _rtl88ee_return_beacon_queue_skb(hw); - - rtl88e_set_fw_rsvdpagepkt(hw, 0); - uval = rtl_read_byte(rtlpriv, REG_TDECTRL+2); - count = 0; - while (!(uval & BIT(0)) && count < 20) { - count++; - udelay(10); - uval = rtl_read_byte(rtlpriv, - REG_TDECTRL+2); - } - dlbcn_count++; - } while (!(uval & BIT(0)) && dlbcn_count < 5); - - if (uval & BIT(0)) - rtl_write_byte(rtlpriv, REG_TDECTRL+2, BIT(0)); - - _rtl88ee_set_bcn_ctrl_reg(hw, BIT(3), 0); - _rtl88ee_set_bcn_ctrl_reg(hw, 0, BIT(4)); - - if (recover) { - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, - tmp_reg422); - } - rtl_write_byte(rtlpriv, REG_CR + 1, (tmp & ~(BIT(0)))); - } - rtl88e_set_fw_joinbss_report_cmd(hw, (*(u8 *)val)); - break; } - case HW_VAR_H2C_FW_P2P_PS_OFFLOAD: - rtl88e_set_p2p_ps_offload_cmd(hw, (*(u8 *)val)); - break; - case HW_VAR_AID:{ - u16 u2btmp; - u2btmp = rtl_read_word(rtlpriv, REG_BCN_PSR_RPT); - u2btmp &= 0xC000; - rtl_write_word(rtlpriv, REG_BCN_PSR_RPT, (u2btmp | - mac->assoc_id)); - break; } - case HW_VAR_CORRECT_TSF:{ - u8 btype_ibss = ((u8 *)(val))[0]; - - if (btype_ibss == true) - _rtl88ee_stop_tx_beacon(hw); - - _rtl88ee_set_bcn_ctrl_reg(hw, 0, BIT(3)); - - rtl_write_dword(rtlpriv, REG_TSFTR, - (u32) (mac->tsf & 0xffffffff)); - rtl_write_dword(rtlpriv, REG_TSFTR + 4, - (u32) ((mac->tsf >> 32) & 0xffffffff)); - - _rtl88ee_set_bcn_ctrl_reg(hw, BIT(3), 0); - - if (btype_ibss == true) - _rtl88ee_resume_tx_beacon(hw); - break; } - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not process %x\n", variable); - break; - } -} - -static bool _rtl88ee_llt_write(struct ieee80211_hw *hw, u32 address, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - bool status = true; - long count = 0; - u32 value = _LLT_INIT_ADDR(address) | _LLT_INIT_DATA(data) | - _LLT_OP(_LLT_WRITE_ACCESS); - - rtl_write_dword(rtlpriv, REG_LLT_INIT, value); - - do { - value = rtl_read_dword(rtlpriv, REG_LLT_INIT); - if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)) - break; - - if (count > POLLING_LLT_THRESHOLD) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Failed to polling write LLT done at address %d!\n", - address); - status = false; - break; - } - } while (++count); - - return status; -} - -static bool _rtl88ee_llt_table_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - unsigned short i; - u8 txpktbuf_bndy; - u8 maxpage; - bool status; - - maxpage = 0xAF; - txpktbuf_bndy = 0xAB; - - rtl_write_byte(rtlpriv, REG_RQPN_NPQ, 0x01); - rtl_write_dword(rtlpriv, REG_RQPN, 0x80730d29); - - - rtl_write_dword(rtlpriv, REG_TRXFF_BNDY, (0x25FF0000 | txpktbuf_bndy)); - rtl_write_byte(rtlpriv, REG_TDECTRL + 1, txpktbuf_bndy); - - rtl_write_byte(rtlpriv, REG_TXPKTBUF_BCNQ_BDNY, txpktbuf_bndy); - rtl_write_byte(rtlpriv, REG_TXPKTBUF_MGQ_BDNY, txpktbuf_bndy); - - rtl_write_byte(rtlpriv, 0x45D, txpktbuf_bndy); - rtl_write_byte(rtlpriv, REG_PBP, 0x11); - rtl_write_byte(rtlpriv, REG_RX_DRVINFO_SZ, 0x4); - - for (i = 0; i < (txpktbuf_bndy - 1); i++) { - status = _rtl88ee_llt_write(hw, i, i + 1); - if (true != status) - return status; - } - - status = _rtl88ee_llt_write(hw, (txpktbuf_bndy - 1), 0xFF); - if (true != status) - return status; - - for (i = txpktbuf_bndy; i < maxpage; i++) { - status = _rtl88ee_llt_write(hw, i, (i + 1)); - if (true != status) - return status; - } - - status = _rtl88ee_llt_write(hw, maxpage, txpktbuf_bndy); - if (true != status) - return status; - - return true; -} - -static void _rtl88ee_gen_refresh_led_state(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); - - if (rtlpriv->rtlhal.up_first_time) - return; - - if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) - rtl88ee_sw_led_on(hw, pLed0); - else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT) - rtl88ee_sw_led_on(hw, pLed0); - else - rtl88ee_sw_led_off(hw, pLed0); -} - -static bool _rtl88ee_init_mac(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 bytetmp; - u16 wordtmp; - - /*Disable XTAL OUTPUT for power saving. YJ, add, 111206. */ - bytetmp = rtl_read_byte(rtlpriv, REG_XCK_OUT_CTRL) & (~BIT(0)); - rtl_write_byte(rtlpriv, REG_XCK_OUT_CTRL, bytetmp); - /*Auto Power Down to CHIP-off State*/ - bytetmp = rtl_read_byte(rtlpriv, REG_APS_FSMCO + 1) & (~BIT(7)); - rtl_write_byte(rtlpriv, REG_APS_FSMCO + 1, bytetmp); - - rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x00); - /* HW Power on sequence */ - if (!rtl88_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, - PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, - Rtl8188E_NIC_ENABLE_FLOW)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "init MAC Fail as rtl88_hal_pwrseqcmdparsing\n"); - return false; - } - - bytetmp = rtl_read_byte(rtlpriv, REG_APS_FSMCO) | BIT(4); - rtl_write_byte(rtlpriv, REG_APS_FSMCO, bytetmp); - - bytetmp = rtl_read_byte(rtlpriv, REG_PCIE_CTRL_REG+2); - rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG+2, bytetmp|BIT(2)); - - bytetmp = rtl_read_byte(rtlpriv, REG_WATCH_DOG+1); - rtl_write_byte(rtlpriv, REG_WATCH_DOG+1, bytetmp|BIT(7)); - - bytetmp = rtl_read_byte(rtlpriv, REG_AFE_XTAL_CTRL_EXT+1); - rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL_EXT+1, bytetmp|BIT(1)); - - bytetmp = rtl_read_byte(rtlpriv, REG_TX_RPT_CTRL); - rtl_write_byte(rtlpriv, REG_TX_RPT_CTRL, bytetmp|BIT(1)|BIT(0)); - rtl_write_byte(rtlpriv, REG_TX_RPT_CTRL+1, 2); - rtl_write_word(rtlpriv, REG_TX_RPT_TIME, 0xcdf0); - - /*Add for wake up online*/ - bytetmp = rtl_read_byte(rtlpriv, REG_SYS_CLKR); - - rtl_write_byte(rtlpriv, REG_SYS_CLKR, bytetmp|BIT(3)); - bytetmp = rtl_read_byte(rtlpriv, REG_GPIO_MUXCFG+1); - rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG+1, (bytetmp & (~BIT(4)))); - rtl_write_byte(rtlpriv, 0x367, 0x80); - - rtl_write_word(rtlpriv, REG_CR, 0x2ff); - rtl_write_byte(rtlpriv, REG_CR+1, 0x06); - rtl_write_byte(rtlpriv, REG_CR+2, 0x00); - - if (!rtlhal->mac_func_enable) { - if (_rtl88ee_llt_table_init(hw) == false) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "LLT table init fail\n"); - return false; - } - } - - - rtl_write_dword(rtlpriv, REG_HISR, 0xffffffff); - rtl_write_dword(rtlpriv, REG_HISRE, 0xffffffff); - - wordtmp = rtl_read_word(rtlpriv, REG_TRXDMA_CTRL); - wordtmp &= 0xf; - wordtmp |= 0xE771; - rtl_write_word(rtlpriv, REG_TRXDMA_CTRL, wordtmp); - - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); - rtl_write_word(rtlpriv, REG_RXFLTMAP2, 0xffff); - rtl_write_dword(rtlpriv, REG_TCR, rtlpci->transmit_config); - - rtl_write_dword(rtlpriv, REG_BCNQ_DESA, - ((u64) rtlpci->tx_ring[BEACON_QUEUE].dma) & - DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_MGQ_DESA, - (u64) rtlpci->tx_ring[MGNT_QUEUE].dma & - DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_VOQ_DESA, - (u64) rtlpci->tx_ring[VO_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_VIQ_DESA, - (u64) rtlpci->tx_ring[VI_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_BEQ_DESA, - (u64) rtlpci->tx_ring[BE_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_BKQ_DESA, - (u64) rtlpci->tx_ring[BK_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_HQ_DESA, - (u64) rtlpci->tx_ring[HIGH_QUEUE].dma & - DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_RX_DESA, - (u64) rtlpci->rx_ring[RX_MPDU_QUEUE].dma & - DMA_BIT_MASK(32)); - - /* if we want to support 64 bit DMA, we should set it here, - * but at the moment we do not support 64 bit DMA - */ - - rtl_write_dword(rtlpriv, REG_INT_MIG, 0); - - rtl_write_dword(rtlpriv, REG_MCUTST_1, 0x0); - rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG+1, 0);/*Enable RX DMA */ - - if (rtlhal->earlymode_enable) {/*Early mode enable*/ - bytetmp = rtl_read_byte(rtlpriv, REG_EARLY_MODE_CONTROL); - bytetmp |= 0x1f; - rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, bytetmp); - rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL+3, 0x81); - } - _rtl88ee_gen_refresh_led_state(hw); - return true; -} - -static void _rtl88ee_hw_configure(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 reg_prsr; - - reg_prsr = RATE_ALL_CCK | RATE_ALL_OFDM_AG; - - rtl_write_dword(rtlpriv, REG_RRSR, reg_prsr); - rtl_write_byte(rtlpriv, REG_HWSEQ_CTRL, 0xFF); -} - -static void _rtl88ee_enable_aspm_back_door(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - u8 tmp1byte = 0; - u32 tmp4Byte = 0, count; - - rtl_write_word(rtlpriv, 0x354, 0x8104); - rtl_write_word(rtlpriv, 0x358, 0x24); - - rtl_write_word(rtlpriv, 0x350, 0x70c); - rtl_write_byte(rtlpriv, 0x352, 0x2); - tmp1byte = rtl_read_byte(rtlpriv, 0x352); - count = 0; - while (tmp1byte && count < 20) { - udelay(10); - tmp1byte = rtl_read_byte(rtlpriv, 0x352); - count++; - } - if (0 == tmp1byte) { - tmp4Byte = rtl_read_dword(rtlpriv, 0x34c); - rtl_write_dword(rtlpriv, 0x348, tmp4Byte|BIT(31)); - rtl_write_word(rtlpriv, 0x350, 0xf70c); - rtl_write_byte(rtlpriv, 0x352, 0x1); - } - - tmp1byte = rtl_read_byte(rtlpriv, 0x352); - count = 0; - while (tmp1byte && count < 20) { - udelay(10); - tmp1byte = rtl_read_byte(rtlpriv, 0x352); - count++; - } - - rtl_write_word(rtlpriv, 0x350, 0x718); - rtl_write_byte(rtlpriv, 0x352, 0x2); - tmp1byte = rtl_read_byte(rtlpriv, 0x352); - count = 0; - while (tmp1byte && count < 20) { - udelay(10); - tmp1byte = rtl_read_byte(rtlpriv, 0x352); - count++; - } - if (ppsc->support_backdoor || (0 == tmp1byte)) { - tmp4Byte = rtl_read_dword(rtlpriv, 0x34c); - rtl_write_dword(rtlpriv, 0x348, tmp4Byte|BIT(11)|BIT(12)); - rtl_write_word(rtlpriv, 0x350, 0xf718); - rtl_write_byte(rtlpriv, 0x352, 0x1); - } - tmp1byte = rtl_read_byte(rtlpriv, 0x352); - count = 0; - while (tmp1byte && count < 20) { - udelay(10); - tmp1byte = rtl_read_byte(rtlpriv, 0x352); - count++; - } -} - -void rtl88ee_enable_hw_security_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 sec_reg_value; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n", - rtlpriv->sec.pairwise_enc_algorithm, - rtlpriv->sec.group_enc_algorithm); - - if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "not open hw encryption\n"); - return; - } - sec_reg_value = SCR_TXENCENABLE | SCR_RXDECENABLE; - - if (rtlpriv->sec.use_defaultkey) { - sec_reg_value |= SCR_TXUSEDK; - sec_reg_value |= SCR_RXUSEDK; - } - - sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK); - - rtl_write_byte(rtlpriv, REG_CR + 1, 0x02); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "The SECR-value %x\n", sec_reg_value); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value); -} - -int rtl88ee_hw_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - bool rtstatus = true; - int err = 0; - u8 tmp_u1b, u1byte; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Rtl8188EE hw init\n"); - rtlpriv->rtlhal.being_init_adapter = true; - rtlpriv->intf_ops->disable_aspm(hw); - - tmp_u1b = rtl_read_byte(rtlpriv, REG_SYS_CLKR+1); - u1byte = rtl_read_byte(rtlpriv, REG_CR); - if ((tmp_u1b & BIT(3)) && (u1byte != 0 && u1byte != 0xEA)) { - rtlhal->mac_func_enable = true; - } else { - rtlhal->mac_func_enable = false; - rtlhal->fw_ps_state = FW_PS_STATE_ALL_ON_88E; - } - - rtstatus = _rtl88ee_init_mac(hw); - if (rtstatus != true) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Init MAC failed\n"); - err = 1; - return err; - } - - err = rtl88e_download_fw(hw, false); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Failed to download FW. Init HW without FW now..\n"); - err = 1; - rtlhal->fw_ready = false; - return err; - } else { - rtlhal->fw_ready = true; - } - /*fw related variable initialize */ - rtlhal->last_hmeboxnum = 0; - rtlhal->fw_ps_state = FW_PS_STATE_ALL_ON_88E; - rtlhal->fw_clk_change_in_progress = false; - rtlhal->allow_sw_to_change_hwclc = false; - ppsc->fw_current_inpsmode = false; - - rtl88e_phy_mac_config(hw); - /* because last function modifies RCR, we update - * rcr var here, or TP will be unstable for receive_config - * is wrong, RX RCR_ACRC32 will cause TP unstable & Rx - * RCR_APP_ICV will cause mac80211 disassoc for cisco 1252 - */ - rtlpci->receive_config &= ~(RCR_ACRC32 | RCR_AICV); - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); - - rtl88e_phy_bb_config(hw); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BCCKEN, 0x1); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BOFDMEN, 0x1); - - rtlphy->rf_mode = RF_OP_BY_SW_3WIRE; - rtl88e_phy_rf_config(hw); - - rtlphy->rfreg_chnlval[0] = rtl_get_rfreg(hw, (enum radio_path)0, - RF_CHNLBW, RFREG_OFFSET_MASK); - rtlphy->rfreg_chnlval[0] = rtlphy->rfreg_chnlval[0] & 0xfff00fff; - - _rtl88ee_hw_configure(hw); - rtl_cam_reset_all_entry(hw); - rtl88ee_enable_hw_security_config(hw); - - rtlhal->mac_func_enable = true; - ppsc->rfpwr_state = ERFON; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, mac->mac_addr); - _rtl88ee_enable_aspm_back_door(hw); - rtlpriv->intf_ops->enable_aspm(hw); - - if (ppsc->rfpwr_state == ERFON) { - if ((rtlefuse->antenna_div_type == CGCS_RX_HW_ANTDIV) || - ((rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) && - (rtlhal->oem_id == RT_CID_819x_HP))) { - rtl88e_phy_set_rfpath_switch(hw, true); - rtlpriv->dm.fat_table.rx_idle_ant = MAIN_ANT; - } else { - rtl88e_phy_set_rfpath_switch(hw, false); - rtlpriv->dm.fat_table.rx_idle_ant = AUX_ANT; - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "rx idle ant %s\n", - (rtlpriv->dm.fat_table.rx_idle_ant == MAIN_ANT) ? - ("MAIN_ANT") : ("AUX_ANT")); - - if (rtlphy->iqk_initialized) { - rtl88e_phy_iq_calibrate(hw, true); - } else { - rtl88e_phy_iq_calibrate(hw, false); - rtlphy->iqk_initialized = true; - } - rtl88e_dm_check_txpower_tracking(hw); - rtl88e_phy_lc_calibrate(hw); - } - - tmp_u1b = efuse_read_1byte(hw, 0x1FA); - if (!(tmp_u1b & BIT(0))) { - rtl_set_rfreg(hw, RF90_PATH_A, 0x15, 0x0F, 0x05); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "PA BIAS path A\n"); - } - - if (!(tmp_u1b & BIT(4))) { - tmp_u1b = rtl_read_byte(rtlpriv, 0x16); - tmp_u1b &= 0x0F; - rtl_write_byte(rtlpriv, 0x16, tmp_u1b | 0x80); - udelay(10); - rtl_write_byte(rtlpriv, 0x16, tmp_u1b | 0x90); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "under 1.5V\n"); - } - rtl_write_byte(rtlpriv, REG_NAV_CTRL+2, ((30000+127)/128)); - rtl88e_dm_init(hw); - rtlpriv->rtlhal.being_init_adapter = false; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "end of Rtl8188EE hw init %x\n", - err); - return 0; -} - -static enum version_8188e _rtl88ee_read_chip_version(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - enum version_8188e version = VERSION_UNKNOWN; - u32 value32; - - value32 = rtl_read_dword(rtlpriv, REG_SYS_CFG); - if (value32 & TRP_VAUX_EN) { - version = (enum version_8188e) VERSION_TEST_CHIP_88E; - } else { - version = NORMAL_CHIP; - version = version | ((value32 & TYPE_ID) ? RF_TYPE_2T2R : 0); - version = version | ((value32 & VENDOR_ID) ? - CHIP_VENDOR_UMC : 0); - } - - rtlphy->rf_type = RF_1T1R; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Chip RF Type: %s\n", (rtlphy->rf_type == RF_2T2R) ? - "RF_2T2R" : "RF_1T1R"); - - return version; -} - -static int _rtl88ee_set_media_status(struct ieee80211_hw *hw, - enum nl80211_iftype type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 bt_msr = rtl_read_byte(rtlpriv, MSR); - enum led_ctl_mode ledaction = LED_CTL_NO_LINK; - bt_msr &= 0xfc; - - if (type == NL80211_IFTYPE_UNSPECIFIED || - type == NL80211_IFTYPE_STATION) { - _rtl88ee_stop_tx_beacon(hw); - _rtl88ee_enable_bcn_sub_func(hw); - } else if (type == NL80211_IFTYPE_ADHOC || - type == NL80211_IFTYPE_AP || - type == NL80211_IFTYPE_MESH_POINT) { - _rtl88ee_resume_tx_beacon(hw); - _rtl88ee_disable_bcn_sub_func(hw); - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Set HW_VAR_MEDIA_STATUS: No such media status(%x).\n", - type); - } - - switch (type) { - case NL80211_IFTYPE_UNSPECIFIED: - bt_msr |= MSR_NOLINK; - ledaction = LED_CTL_LINK; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to NO LINK!\n"); - break; - case NL80211_IFTYPE_ADHOC: - bt_msr |= MSR_ADHOC; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to Ad Hoc!\n"); - break; - case NL80211_IFTYPE_STATION: - bt_msr |= MSR_INFRA; - ledaction = LED_CTL_LINK; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to STA!\n"); - break; - case NL80211_IFTYPE_AP: - bt_msr |= MSR_AP; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to AP!\n"); - break; - case NL80211_IFTYPE_MESH_POINT: - bt_msr |= MSR_ADHOC; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to Mesh Point!\n"); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Network type %d not support!\n", type); - return 1; - } - - rtl_write_byte(rtlpriv, (MSR), bt_msr); - rtlpriv->cfg->ops->led_control(hw, ledaction); - if ((bt_msr & 0xfc) == MSR_AP) - rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); - else - rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); - return 0; -} - -void rtl88ee_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u32 reg_rcr = rtlpci->receive_config; - - if (rtlpriv->psc.rfpwr_state != ERFON) - return; - - if (check_bssid == true) { - reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, - (u8 *)(®_rcr)); - _rtl88ee_set_bcn_ctrl_reg(hw, 0, BIT(4)); - } else if (check_bssid == false) { - reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); - _rtl88ee_set_bcn_ctrl_reg(hw, BIT(4), 0); - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_RCR, (u8 *)(®_rcr)); - } -} - -int rtl88ee_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (_rtl88ee_set_media_status(hw, type)) - return -EOPNOTSUPP; - - if (rtlpriv->mac80211.link_state == MAC80211_LINKED) { - if (type != NL80211_IFTYPE_AP && - type != NL80211_IFTYPE_MESH_POINT) - rtl88ee_set_check_bssid(hw, true); - } else { - rtl88ee_set_check_bssid(hw, false); - } - - return 0; -} - -/* don't set REG_EDCA_BE_PARAM here because mac80211 will send pkt when scan */ -void rtl88ee_set_qos(struct ieee80211_hw *hw, int aci) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - rtl88e_dm_init_edca_turbo(hw); - switch (aci) { - case AC1_BK: - rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM, 0xa44f); - break; - case AC0_BE: - break; - case AC2_VI: - rtl_write_dword(rtlpriv, REG_EDCA_VI_PARAM, 0x5e4322); - break; - case AC3_VO: - rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, 0x2f3222); - break; - default: - RT_ASSERT(false, "invalid aci: %d !\n", aci); - break; - } -} - -void rtl88ee_enable_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF); - rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF); - rtlpci->irq_enabled = true; - /* there are some C2H CMDs have been sent before system interrupt - * is enabled, e.g., C2H, CPWM. - * So we need to clear all C2H events that FW has notified, otherwise - * FW won't schedule any commands anymore. - */ - rtl_write_byte(rtlpriv, REG_C2HEVT_CLEAR, 0); - /*enable system interrupt*/ - rtl_write_dword(rtlpriv, REG_HSIMR, rtlpci->sys_irq_mask & 0xFFFFFFFF); -} - -void rtl88ee_disable_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - rtl_write_dword(rtlpriv, REG_HIMR, IMR_DISABLED); - rtl_write_dword(rtlpriv, REG_HIMRE, IMR_DISABLED); - rtlpci->irq_enabled = false; - synchronize_irq(rtlpci->pdev->irq); -} - -static void _rtl88ee_poweroff_adapter(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 u1b_tmp; - u32 count = 0; - rtlhal->mac_func_enable = false; - rtlpriv->intf_ops->enable_aspm(hw); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "POWER OFF adapter\n"); - u1b_tmp = rtl_read_byte(rtlpriv, REG_TX_RPT_CTRL); - rtl_write_byte(rtlpriv, REG_TX_RPT_CTRL, u1b_tmp & (~BIT(1))); - - u1b_tmp = rtl_read_byte(rtlpriv, REG_RXDMA_CONTROL); - while (!(u1b_tmp & BIT(1)) && (count++ < 100)) { - udelay(10); - u1b_tmp = rtl_read_byte(rtlpriv, REG_RXDMA_CONTROL); - count++; - } - rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG+1, 0xFF); - - rtl88_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, - PWR_INTF_PCI_MSK, - Rtl8188E_NIC_LPS_ENTER_FLOW); - - rtl_write_byte(rtlpriv, REG_RF_CTRL, 0x00); - - if ((rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(7)) && rtlhal->fw_ready) - rtl88e_firmware_selfreset(hw); - - u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN+1); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, (u1b_tmp & (~BIT(2)))); - rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x00); - - u1b_tmp = rtl_read_byte(rtlpriv, REG_32K_CTRL); - rtl_write_byte(rtlpriv, REG_32K_CTRL, (u1b_tmp & (~BIT(0)))); - - rtl88_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, - PWR_INTF_PCI_MSK, Rtl8188E_NIC_DISABLE_FLOW); - - u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1); - rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp & (~BIT(3)))); - u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1); - rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp | BIT(3))); - - rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x0E); - - u1b_tmp = rtl_read_byte(rtlpriv, GPIO_IN); - rtl_write_byte(rtlpriv, GPIO_OUT, u1b_tmp); - rtl_write_byte(rtlpriv, GPIO_IO_SEL, 0x7F); - - u1b_tmp = rtl_read_byte(rtlpriv, REG_GPIO_IO_SEL); - rtl_write_byte(rtlpriv, REG_GPIO_IO_SEL, (u1b_tmp << 4) | u1b_tmp); - u1b_tmp = rtl_read_byte(rtlpriv, REG_GPIO_IO_SEL+1); - rtl_write_byte(rtlpriv, REG_GPIO_IO_SEL+1, u1b_tmp | 0x0F); - - rtl_write_dword(rtlpriv, REG_GPIO_IO_SEL_2+2, 0x00080808); -} - -void rtl88ee_card_disable(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - enum nl80211_iftype opmode; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "RTL8188ee card disable\n"); - - mac->link_state = MAC80211_NOLINK; - opmode = NL80211_IFTYPE_UNSPECIFIED; - - _rtl88ee_set_media_status(hw, opmode); - - if (rtlpriv->rtlhal.driver_is_goingto_unload || - ppsc->rfoff_reason > RF_CHANGE_BY_PS) - rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF); - - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - _rtl88ee_poweroff_adapter(hw); - - /* after power off we should do iqk again */ - rtlpriv->phy.iqk_initialized = false; -} - -void rtl88ee_interrupt_recognized(struct ieee80211_hw *hw, - u32 *p_inta, u32 *p_intb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - *p_inta = rtl_read_dword(rtlpriv, ISR) & rtlpci->irq_mask[0]; - rtl_write_dword(rtlpriv, ISR, *p_inta); - - *p_intb = rtl_read_dword(rtlpriv, REG_HISRE) & rtlpci->irq_mask[1]; - rtl_write_dword(rtlpriv, REG_HISRE, *p_intb); -} - -void rtl88ee_set_beacon_related_registers(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u16 bcn_interval, atim_window; - - bcn_interval = mac->beacon_interval; - atim_window = 2; /*FIX MERGE */ - rtl88ee_disable_interrupt(hw); - rtl_write_word(rtlpriv, REG_ATIMWND, atim_window); - rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); - rtl_write_word(rtlpriv, REG_BCNTCFG, 0x660f); - rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_CCK, 0x18); - rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_OFDM, 0x18); - rtl_write_byte(rtlpriv, 0x606, 0x30); - rtlpci->reg_bcn_ctrl_val |= BIT(3); - rtl_write_byte(rtlpriv, REG_BCN_CTRL, (u8) rtlpci->reg_bcn_ctrl_val); - /*rtl88ee_enable_interrupt(hw);*/ -} - -void rtl88ee_set_beacon_interval(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 bcn_interval = mac->beacon_interval; - - RT_TRACE(rtlpriv, COMP_BEACON, DBG_DMESG, - "beacon_interval:%d\n", bcn_interval); - /*rtl88ee_disable_interrupt(hw);*/ - rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); - /*rtl88ee_enable_interrupt(hw);*/ -} - -void rtl88ee_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, - "add_msr:%x, rm_msr:%x\n", add_msr, rm_msr); - - rtl88ee_disable_interrupt(hw); - if (add_msr) - rtlpci->irq_mask[0] |= add_msr; - if (rm_msr) - rtlpci->irq_mask[0] &= (~rm_msr); - rtl88ee_enable_interrupt(hw); -} - -static inline u8 get_chnl_group(u8 chnl) -{ - u8 group; - - group = chnl / 3; - if (chnl == 14) - group = 5; - - return group; -} - -static void set_diff0_2g(struct txpower_info_2g *pwr2g, u8 *hwinfo, u32 path, - u32 i, u32 eadr) -{ - pwr2g->bw40_diff[path][i] = 0; - if (hwinfo[eadr] == 0xFF) { - pwr2g->bw20_diff[path][i] = 0x02; - } else { - pwr2g->bw20_diff[path][i] = (hwinfo[eadr]&0xf0)>>4; - /*bit sign number to 8 bit sign number*/ - if (pwr2g->bw20_diff[path][i] & BIT(3)) - pwr2g->bw20_diff[path][i] |= 0xF0; - } - - if (hwinfo[eadr] == 0xFF) { - pwr2g->ofdm_diff[path][i] = 0x04; - } else { - pwr2g->ofdm_diff[path][i] = (hwinfo[eadr] & 0x0f); - /*bit sign number to 8 bit sign number*/ - if (pwr2g->ofdm_diff[path][i] & BIT(3)) - pwr2g->ofdm_diff[path][i] |= 0xF0; - } - pwr2g->cck_diff[path][i] = 0; -} - -static void set_diff0_5g(struct txpower_info_5g *pwr5g, u8 *hwinfo, u32 path, - u32 i, u32 eadr) -{ - pwr5g->bw40_diff[path][i] = 0; - if (hwinfo[eadr] == 0xFF) { - pwr5g->bw20_diff[path][i] = 0; - } else { - pwr5g->bw20_diff[path][i] = (hwinfo[eadr]&0xf0)>>4; - /*bit sign number to 8 bit sign number*/ - if (pwr5g->bw20_diff[path][i] & BIT(3)) - pwr5g->bw20_diff[path][i] |= 0xF0; - } - - if (hwinfo[eadr] == 0xFF) { - pwr5g->ofdm_diff[path][i] = 0x04; - } else { - pwr5g->ofdm_diff[path][i] = (hwinfo[eadr] & 0x0f); - /*bit sign number to 8 bit sign number*/ - if (pwr5g->ofdm_diff[path][i] & BIT(3)) - pwr5g->ofdm_diff[path][i] |= 0xF0; - } -} - -static void set_diff1_2g(struct txpower_info_2g *pwr2g, u8 *hwinfo, u32 path, - u32 i, u32 eadr) -{ - if (hwinfo[eadr] == 0xFF) { - pwr2g->bw40_diff[path][i] = 0xFE; - } else { - pwr2g->bw40_diff[path][i] = (hwinfo[eadr]&0xf0)>>4; - if (pwr2g->bw40_diff[path][i] & BIT(3)) - pwr2g->bw40_diff[path][i] |= 0xF0; - } - - if (hwinfo[eadr] == 0xFF) { - pwr2g->bw20_diff[path][i] = 0xFE; - } else { - pwr2g->bw20_diff[path][i] = (hwinfo[eadr]&0x0f); - if (pwr2g->bw20_diff[path][i] & BIT(3)) - pwr2g->bw20_diff[path][i] |= 0xF0; - } -} - -static void set_diff1_5g(struct txpower_info_5g *pwr5g, u8 *hwinfo, u32 path, - u32 i, u32 eadr) -{ - if (hwinfo[eadr] == 0xFF) { - pwr5g->bw40_diff[path][i] = 0xFE; - } else { - pwr5g->bw40_diff[path][i] = (hwinfo[eadr]&0xf0)>>4; - if (pwr5g->bw40_diff[path][i] & BIT(3)) - pwr5g->bw40_diff[path][i] |= 0xF0; - } - - if (hwinfo[eadr] == 0xFF) { - pwr5g->bw20_diff[path][i] = 0xFE; - } else { - pwr5g->bw20_diff[path][i] = (hwinfo[eadr] & 0x0f); - if (pwr5g->bw20_diff[path][i] & BIT(3)) - pwr5g->bw20_diff[path][i] |= 0xF0; - } -} - -static void set_diff2_2g(struct txpower_info_2g *pwr2g, u8 *hwinfo, u32 path, - u32 i, u32 eadr) -{ - if (hwinfo[eadr] == 0xFF) { - pwr2g->ofdm_diff[path][i] = 0xFE; - } else { - pwr2g->ofdm_diff[path][i] = (hwinfo[eadr]&0xf0)>>4; - if (pwr2g->ofdm_diff[path][i] & BIT(3)) - pwr2g->ofdm_diff[path][i] |= 0xF0; - } - - if (hwinfo[eadr] == 0xFF) { - pwr2g->cck_diff[path][i] = 0xFE; - } else { - pwr2g->cck_diff[path][i] = (hwinfo[eadr]&0x0f); - if (pwr2g->cck_diff[path][i] & BIT(3)) - pwr2g->cck_diff[path][i] |= 0xF0; - } -} - -static void _rtl8188e_read_power_value_fromprom(struct ieee80211_hw *hw, - struct txpower_info_2g *pwr2g, - struct txpower_info_5g *pwr5g, - bool autoload_fail, - u8 *hwinfo) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 path, eadr = EEPROM_TX_PWR_INX, i; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "hal_ReadPowerValueFromPROM88E(): PROMContent[0x%x]= 0x%x\n", - (eadr+1), hwinfo[eadr+1]); - if (0xFF == hwinfo[eadr+1]) - autoload_fail = true; - - if (autoload_fail) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "auto load fail : Use Default value!\n"); - for (path = 0; path < MAX_RF_PATH; path++) { - /* 2.4G default value */ - for (i = 0; i < MAX_CHNL_GROUP_24G; i++) { - pwr2g->index_cck_base[path][i] = 0x2D; - pwr2g->index_bw40_base[path][i] = 0x2D; - } - for (i = 0; i < MAX_TX_COUNT; i++) { - if (i == 0) { - pwr2g->bw20_diff[path][0] = 0x02; - pwr2g->ofdm_diff[path][0] = 0x04; - } else { - pwr2g->bw20_diff[path][i] = 0xFE; - pwr2g->bw40_diff[path][i] = 0xFE; - pwr2g->cck_diff[path][i] = 0xFE; - pwr2g->ofdm_diff[path][i] = 0xFE; - } - } - } - return; - } - - for (path = 0; path < MAX_RF_PATH; path++) { - /*2.4G default value*/ - for (i = 0; i < MAX_CHNL_GROUP_24G; i++) { - pwr2g->index_cck_base[path][i] = hwinfo[eadr++]; - if (pwr2g->index_cck_base[path][i] == 0xFF) - pwr2g->index_cck_base[path][i] = 0x2D; - } - for (i = 0; i < MAX_CHNL_GROUP_24G; i++) { - pwr2g->index_bw40_base[path][i] = hwinfo[eadr++]; - if (pwr2g->index_bw40_base[path][i] == 0xFF) - pwr2g->index_bw40_base[path][i] = 0x2D; - } - for (i = 0; i < MAX_TX_COUNT; i++) { - if (i == 0) { - set_diff0_2g(pwr2g, hwinfo, path, i, eadr); - eadr++; - } else { - set_diff1_2g(pwr2g, hwinfo, path, i, eadr); - eadr++; - - set_diff2_2g(pwr2g, hwinfo, path, i, eadr); - eadr++; - } - } - - /*5G default value*/ - for (i = 0; i < MAX_CHNL_GROUP_5G; i++) { - pwr5g->index_bw40_base[path][i] = hwinfo[eadr++]; - if (pwr5g->index_bw40_base[path][i] == 0xFF) - pwr5g->index_bw40_base[path][i] = 0xFE; - } - - for (i = 0; i < MAX_TX_COUNT; i++) { - if (i == 0) { - set_diff0_5g(pwr5g, hwinfo, path, i, eadr); - eadr++; - } else { - set_diff1_5g(pwr5g, hwinfo, path, i, eadr); - eadr++; - } - } - - if (hwinfo[eadr] == 0xFF) { - pwr5g->ofdm_diff[path][1] = 0xFE; - pwr5g->ofdm_diff[path][2] = 0xFE; - } else { - pwr5g->ofdm_diff[path][1] = (hwinfo[eadr] & 0xf0) >> 4; - pwr5g->ofdm_diff[path][2] = (hwinfo[eadr] & 0x0f); - } - eadr++; - - if (hwinfo[eadr] == 0xFF) - pwr5g->ofdm_diff[path][3] = 0xFE; - else - pwr5g->ofdm_diff[path][3] = (hwinfo[eadr]&0x0f); - eadr++; - - for (i = 1; i < MAX_TX_COUNT; i++) { - if (pwr5g->ofdm_diff[path][i] == 0xFF) - pwr5g->ofdm_diff[path][i] = 0xFE; - else if (pwr5g->ofdm_diff[path][i] & BIT(3)) - pwr5g->ofdm_diff[path][i] |= 0xF0; - } - } -} - -static void _rtl88ee_read_txpower_info_from_hwpg(struct ieee80211_hw *hw, - bool autoload_fail, - u8 *hwinfo) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct txpower_info_2g pwrinfo24g; - struct txpower_info_5g pwrinfo5g; - u8 rf_path, index; - u8 i; - int jj = EEPROM_RF_BOARD_OPTION_88E; - int kk = EEPROM_THERMAL_METER_88E; - - _rtl8188e_read_power_value_fromprom(hw, &pwrinfo24g, &pwrinfo5g, - autoload_fail, hwinfo); - - for (rf_path = 0; rf_path < 2; rf_path++) { - for (i = 0; i < 14; i++) { - index = get_chnl_group(i+1); - - rtlefuse->txpwrlevel_cck[rf_path][i] = - pwrinfo24g.index_cck_base[rf_path][index]; - if (i == 13) - rtlefuse->txpwrlevel_ht40_1s[rf_path][i] = - pwrinfo24g.index_bw40_base[rf_path][4]; - else - rtlefuse->txpwrlevel_ht40_1s[rf_path][i] = - pwrinfo24g.index_bw40_base[rf_path][index]; - rtlefuse->txpwr_ht20diff[rf_path][i] = - pwrinfo24g.bw20_diff[rf_path][0]; - rtlefuse->txpwr_legacyhtdiff[rf_path][i] = - pwrinfo24g.ofdm_diff[rf_path][0]; - } - - for (i = 0; i < 14; i++) { - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF(%d)-Ch(%d) [CCK / HT40_1S ] = " - "[0x%x / 0x%x ]\n", rf_path, i, - rtlefuse->txpwrlevel_cck[rf_path][i], - rtlefuse->txpwrlevel_ht40_1s[rf_path][i]); - } - } - - if (!autoload_fail) - rtlefuse->eeprom_thermalmeter = hwinfo[kk]; - else - rtlefuse->eeprom_thermalmeter = EEPROM_DEFAULT_THERMALMETER; - - if (rtlefuse->eeprom_thermalmeter == 0xff || autoload_fail) { - rtlefuse->apk_thermalmeterignore = true; - rtlefuse->eeprom_thermalmeter = EEPROM_DEFAULT_THERMALMETER; - } - - rtlefuse->thermalmeter[0] = rtlefuse->eeprom_thermalmeter; - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "thermalmeter = 0x%x\n", rtlefuse->eeprom_thermalmeter); - - if (!autoload_fail) { - rtlefuse->eeprom_regulatory = hwinfo[jj] & 0x07;/*bit0~2*/ - if (hwinfo[jj] == 0xFF) - rtlefuse->eeprom_regulatory = 0; - } else { - rtlefuse->eeprom_regulatory = 0; - } - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory); -} - -static void _rtl88ee_read_adapter_info(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_pci_priv *rppriv = rtl_pcipriv(hw); - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE]; - u16 eeprom_id; - int jj = EEPROM_RF_BOARD_OPTION_88E; - int kk = EEPROM_RF_FEATURE_OPTION_88E; - - if (rtlefuse->epromtype == EEPROM_BOOT_EFUSE) { - rtl_efuse_shadow_map_update(hw); - - memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], - HWSET_MAX_SIZE); - } else if (rtlefuse->epromtype == EEPROM_93C46) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "RTL819X Not boot from eeprom, check it !!"); - } - - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, ("MAP\n"), - hwinfo, HWSET_MAX_SIZE); - - eeprom_id = *((u16 *)&hwinfo[0]); - if (eeprom_id != RTL8188E_EEPROM_ID) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "EEPROM ID(%#x) is invalid!!\n", eeprom_id); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - } - - if (rtlefuse->autoload_failflag == true) - return; - /*VID DID SVID SDID*/ - rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID]; - rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID]; - rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID]; - rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROMId = 0x%4x\n", eeprom_id); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); - /*customer ID*/ - rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMER_ID]; - if (rtlefuse->eeprom_oemid == 0xFF) - rtlefuse->eeprom_oemid = 0; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); - /*EEPROM version*/ - rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION]; - /*mac address*/ - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; - *((u16 *)(&rtlefuse->dev_addr[i])) = usvalue; - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "dev_addr: %pM\n", rtlefuse->dev_addr); - /*channel plan */ - rtlefuse->eeprom_channelplan = *(u8 *)&hwinfo[EEPROM_CHANNELPLAN]; - /* set channel paln to world wide 13 */ - rtlefuse->channel_plan = COUNTRY_CODE_WORLD_WIDE_13; - /*tx power*/ - _rtl88ee_read_txpower_info_from_hwpg(hw, rtlefuse->autoload_failflag, - hwinfo); - rtlefuse->txpwr_fromeprom = true; - - rtl8188ee_read_bt_coexist_info_from_hwpg(hw, - rtlefuse->autoload_failflag, - hwinfo); - /*board type*/ - rtlefuse->board_type = (((*(u8 *)&hwinfo[jj]) & 0xE0) >> 5); - /*Wake on wlan*/ - rtlefuse->wowlan_enable = ((hwinfo[kk] & 0x40) >> 6); - /*parse xtal*/ - rtlefuse->crystalcap = hwinfo[EEPROM_XTAL_88E]; - if (hwinfo[EEPROM_XTAL_88E]) - rtlefuse->crystalcap = 0x20; - /*antenna diversity*/ - rtlefuse->antenna_div_cfg = (hwinfo[jj] & 0x18) >> 3; - if (hwinfo[jj] == 0xFF) - rtlefuse->antenna_div_cfg = 0; - if (rppriv->bt_coexist.eeprom_bt_coexist != 0 && - rppriv->bt_coexist.eeprom_bt_ant_num == ANT_X1) - rtlefuse->antenna_div_cfg = 0; - - rtlefuse->antenna_div_type = hwinfo[EEPROM_RF_ANTENNA_OPT_88E]; - if (rtlefuse->antenna_div_type == 0xFF) - rtlefuse->antenna_div_type = 0x01; - if (rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV || - rtlefuse->antenna_div_type == CGCS_RX_HW_ANTDIV) - rtlefuse->antenna_div_cfg = 1; - - if (rtlhal->oem_id == RT_CID_DEFAULT) { - switch (rtlefuse->eeprom_oemid) { - case EEPROM_CID_DEFAULT: - if (rtlefuse->eeprom_did == 0x8179) { - if (rtlefuse->eeprom_svid == 0x1025) { - rtlhal->oem_id = RT_CID_819x_Acer; - } else if ((rtlefuse->eeprom_svid == 0x10EC && - rtlefuse->eeprom_smid == 0x0179) || - (rtlefuse->eeprom_svid == 0x17AA && - rtlefuse->eeprom_smid == 0x0179)) { - rtlhal->oem_id = RT_CID_819x_Lenovo; - } else if (rtlefuse->eeprom_svid == 0x103c && - rtlefuse->eeprom_smid == 0x197d) { - rtlhal->oem_id = RT_CID_819x_HP; - } else { - rtlhal->oem_id = RT_CID_DEFAULT; - } - } else { - rtlhal->oem_id = RT_CID_DEFAULT; - } - break; - case EEPROM_CID_TOSHIBA: - rtlhal->oem_id = RT_CID_TOSHIBA; - break; - case EEPROM_CID_QMI: - rtlhal->oem_id = RT_CID_819x_QMI; - break; - case EEPROM_CID_WHQL: - default: - rtlhal->oem_id = RT_CID_DEFAULT; - break; - } - } -} - -static void _rtl88ee_hal_customized_behavior(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - pcipriv->ledctl.led_opendrain = true; - - switch (rtlhal->oem_id) { - case RT_CID_819x_HP: - pcipriv->ledctl.led_opendrain = true; - break; - case RT_CID_819x_Lenovo: - case RT_CID_DEFAULT: - case RT_CID_TOSHIBA: - case RT_CID_CCX: - case RT_CID_819x_Acer: - case RT_CID_WHQL: - default: - break; - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "RT Customized ID: 0x%02X\n", rtlhal->oem_id); -} - -void rtl88ee_read_eeprom_info(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 tmp_u1b; - - rtlhal->version = _rtl88ee_read_chip_version(hw); - if (get_rf_type(rtlphy) == RF_1T1R) { - rtlpriv->dm.rfpath_rxenable[0] = true; - } else { - rtlpriv->dm.rfpath_rxenable[0] = true; - rtlpriv->dm.rfpath_rxenable[1] = true; - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "VersionID = 0x%4x\n", - rtlhal->version); - tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR); - if (tmp_u1b & BIT(4)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EEPROM\n"); - rtlefuse->epromtype = EEPROM_93C46; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EFUSE\n"); - rtlefuse->epromtype = EEPROM_BOOT_EFUSE; - } - if (tmp_u1b & BIT(5)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - _rtl88ee_read_adapter_info(hw); - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Autoload ERR!!\n"); - } - _rtl88ee_hal_customized_behavior(hw); -} - -static void rtl88ee_update_hal_rate_table(struct ieee80211_hw *hw, - struct ieee80211_sta *sta) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rppriv = rtl_pcipriv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u32 ratr_value; - u8 ratr_index = 0; - u8 nmode = mac->ht_enable; - u8 mimo_ps = IEEE80211_SMPS_OFF; - u16 shortgi_rate; - u32 tmp_ratr_value; - u8 ctx40 = mac->bw_40; - u16 cap = sta->ht_cap.cap; - u8 short40 = (cap & IEEE80211_HT_CAP_SGI_40) ? 1 : 0; - u8 short20 = (cap & IEEE80211_HT_CAP_SGI_20) ? 1 : 0; - enum wireless_mode wirelessmode = mac->mode; - - if (rtlhal->current_bandtype == BAND_ON_5G) - ratr_value = sta->supp_rates[1] << 4; - else - ratr_value = sta->supp_rates[0]; - if (mac->opmode == NL80211_IFTYPE_ADHOC) - ratr_value = 0xfff; - ratr_value |= (sta->ht_cap.mcs.rx_mask[1] << 20 | - sta->ht_cap.mcs.rx_mask[0] << 12); - switch (wirelessmode) { - case WIRELESS_MODE_B: - if (ratr_value & 0x0000000c) - ratr_value &= 0x0000000d; - else - ratr_value &= 0x0000000f; - break; - case WIRELESS_MODE_G: - ratr_value &= 0x00000FF5; - break; - case WIRELESS_MODE_N_24G: - case WIRELESS_MODE_N_5G: - nmode = 1; - if (mimo_ps == IEEE80211_SMPS_STATIC) { - ratr_value &= 0x0007F005; - } else { - u32 ratr_mask; - - if (get_rf_type(rtlphy) == RF_1T2R || - get_rf_type(rtlphy) == RF_1T1R) - ratr_mask = 0x000ff005; - else - ratr_mask = 0x0f0ff005; - - ratr_value &= ratr_mask; - } - break; - default: - if (rtlphy->rf_type == RF_1T2R) - ratr_value &= 0x000ff0ff; - else - ratr_value &= 0x0f0ff0ff; - - break; - } - - if ((rppriv->bt_coexist.bt_coexistence) && - (rppriv->bt_coexist.bt_coexist_type == BT_CSR_BC4) && - (rppriv->bt_coexist.bt_cur_state) && - (rppriv->bt_coexist.bt_ant_isolation) && - ((rppriv->bt_coexist.bt_service == BT_SCO) || - (rppriv->bt_coexist.bt_service == BT_BUSY))) - ratr_value &= 0x0fffcfc0; - else - ratr_value &= 0x0FFFFFFF; - - if (nmode && ((ctx40 && short40) || - (!ctx40 && short20))) { - ratr_value |= 0x10000000; - tmp_ratr_value = (ratr_value >> 12); - - for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) { - if ((1 << shortgi_rate) & tmp_ratr_value) - break; - } - - shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) | - (shortgi_rate << 4) | (shortgi_rate); - } - - rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); - - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, - "%x\n", rtl_read_dword(rtlpriv, REG_ARFR0)); -} - -static void rtl88ee_update_hal_rate_mask(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_sta_info *sta_entry = NULL; - u32 ratr_bitmap; - u8 ratr_index; - u16 cap = sta->ht_cap.cap; - u8 ctx40 = (cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) ? 1 : 0; - u8 short40 = (cap & IEEE80211_HT_CAP_SGI_40) ? 1 : 0; - u8 short20 = (cap & IEEE80211_HT_CAP_SGI_20) ? 1 : 0; - enum wireless_mode wirelessmode = 0; - bool shortgi = false; - u8 rate_mask[5]; - u8 macid = 0; - u8 mimo_ps = IEEE80211_SMPS_OFF; - - sta_entry = (struct rtl_sta_info *)sta->drv_priv; - wirelessmode = sta_entry->wireless_mode; - if (mac->opmode == NL80211_IFTYPE_STATION || - mac->opmode == NL80211_IFTYPE_MESH_POINT) - ctx40 = mac->bw_40; - else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) - macid = sta->aid + 1; - - if (rtlhal->current_bandtype == BAND_ON_5G) - ratr_bitmap = sta->supp_rates[1] << 4; - else - ratr_bitmap = sta->supp_rates[0]; - if (mac->opmode == NL80211_IFTYPE_ADHOC) - ratr_bitmap = 0xfff; - ratr_bitmap |= (sta->ht_cap.mcs.rx_mask[1] << 20 | - sta->ht_cap.mcs.rx_mask[0] << 12); - switch (wirelessmode) { - case WIRELESS_MODE_B: - ratr_index = RATR_INX_WIRELESS_B; - if (ratr_bitmap & 0x0000000c) - ratr_bitmap &= 0x0000000d; - else - ratr_bitmap &= 0x0000000f; - break; - case WIRELESS_MODE_G: - ratr_index = RATR_INX_WIRELESS_GB; - - if (rssi == 1) - ratr_bitmap &= 0x00000f00; - else if (rssi == 2) - ratr_bitmap &= 0x00000ff0; - else - ratr_bitmap &= 0x00000ff5; - break; - case WIRELESS_MODE_A: - ratr_index = RATR_INX_WIRELESS_A; - ratr_bitmap &= 0x00000ff0; - break; - case WIRELESS_MODE_N_24G: - case WIRELESS_MODE_N_5G: - ratr_index = RATR_INX_WIRELESS_NGB; - - if (mimo_ps == IEEE80211_SMPS_STATIC) { - if (rssi == 1) - ratr_bitmap &= 0x00070000; - else if (rssi == 2) - ratr_bitmap &= 0x0007f000; - else - ratr_bitmap &= 0x0007f005; - } else { - if (rtlphy->rf_type == RF_1T2R || - rtlphy->rf_type == RF_1T1R) { - if (ctx40) { - if (rssi == 1) - ratr_bitmap &= 0x000f0000; - else if (rssi == 2) - ratr_bitmap &= 0x000ff000; - else - ratr_bitmap &= 0x000ff015; - } else { - if (rssi == 1) - ratr_bitmap &= 0x000f0000; - else if (rssi == 2) - ratr_bitmap &= 0x000ff000; - else - ratr_bitmap &= 0x000ff005; - } - } else { - if (ctx40) { - if (rssi == 1) - ratr_bitmap &= 0x0f8f0000; - else if (rssi == 2) - ratr_bitmap &= 0x0f8ff000; - else - ratr_bitmap &= 0x0f8ff015; - } else { - if (rssi == 1) - ratr_bitmap &= 0x0f8f0000; - else if (rssi == 2) - ratr_bitmap &= 0x0f8ff000; - else - ratr_bitmap &= 0x0f8ff005; - } - } - } - - if ((ctx40 && short40) || (!ctx40 && short20)) { - if (macid == 0) - shortgi = true; - else if (macid == 1) - shortgi = false; - } - break; - default: - ratr_index = RATR_INX_WIRELESS_NGB; - - if (rtlphy->rf_type == RF_1T2R) - ratr_bitmap &= 0x000ff0ff; - else - ratr_bitmap &= 0x0f0ff0ff; - break; - } - sta_entry->ratr_index = ratr_index; - - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, - "ratr_bitmap :%x\n", ratr_bitmap); - *(u32 *)&rate_mask = (ratr_bitmap & 0x0fffffff) | - (ratr_index << 28); - rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80; - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, - "Rate_index:%x, ratr_val:%x, %x:%x:%x:%x:%x\n", - ratr_index, ratr_bitmap, rate_mask[0], rate_mask[1], - rate_mask[2], rate_mask[3], rate_mask[4]); - rtl88e_fill_h2c_cmd(hw, H2C_88E_RA_MASK, 5, rate_mask); - _rtl88ee_set_bcn_ctrl_reg(hw, BIT(3), 0); -} - -void rtl88ee_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->dm.useramask) - rtl88ee_update_hal_rate_mask(hw, sta, rssi); - else - rtl88ee_update_hal_rate_table(hw, sta); -} - -void rtl88ee_update_channel_access_setting(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 sifs_timer; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME, - (u8 *)&mac->slot_time); - if (!mac->ht_enable) - sifs_timer = 0x0a0a; - else - sifs_timer = 0x0e0e; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SIFS, (u8 *)&sifs_timer); -} - -bool rtl88ee_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - enum rf_pwrstate state_toset; - u32 u4tmp; - bool actuallyset = false; - - if (rtlpriv->rtlhal.being_init_adapter) - return false; - - if (ppsc->swrf_processing) - return false; - - spin_lock(&rtlpriv->locks.rf_ps_lock); - if (ppsc->rfchange_inprogress) { - spin_unlock(&rtlpriv->locks.rf_ps_lock); - return false; - } else { - ppsc->rfchange_inprogress = true; - spin_unlock(&rtlpriv->locks.rf_ps_lock); - } - - u4tmp = rtl_read_dword(rtlpriv, REG_GPIO_OUTPUT); - state_toset = (u4tmp & BIT(31)) ? ERFON : ERFOFF; - - - if ((ppsc->hwradiooff == true) && (state_toset == ERFON)) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "GPIOChangeRF - HW Radio ON, RF ON\n"); - - state_toset = ERFON; - ppsc->hwradiooff = false; - actuallyset = true; - } else if ((ppsc->hwradiooff == false) && (state_toset == ERFOFF)) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "GPIOChangeRF - HW Radio OFF, RF OFF\n"); - - state_toset = ERFOFF; - ppsc->hwradiooff = true; - actuallyset = true; - } - - if (actuallyset) { - spin_lock(&rtlpriv->locks.rf_ps_lock); - ppsc->rfchange_inprogress = false; - spin_unlock(&rtlpriv->locks.rf_ps_lock); - } else { - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - - spin_lock(&rtlpriv->locks.rf_ps_lock); - ppsc->rfchange_inprogress = false; - spin_unlock(&rtlpriv->locks.rf_ps_lock); - } - - *valid = 1; - return !ppsc->hwradiooff; -} - -static void add_one_key(struct ieee80211_hw *hw, u8 *macaddr, - struct rtl_mac *mac, u32 key, u32 id, - u8 enc_algo, bool is_pairwise) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "add one entry\n"); - if (is_pairwise) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "set Pairwise key\n"); - - rtl_cam_add_one_entry(hw, macaddr, key, id, enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf[key]); - } else { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "set group key\n"); - - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - rtl_cam_add_one_entry(hw, rtlefuse->dev_addr, - PAIRWISE_KEYIDX, - CAM_PAIRWISE_KEY_POSITION, - enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf[id]); - } - - rtl_cam_add_one_entry(hw, macaddr, key, id, enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf[id]); - } -} - -void rtl88ee_set_key(struct ieee80211_hw *hw, u32 key, - u8 *mac_ad, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u8 *macaddr = mac_ad; - u32 id = 0; - bool is_pairwise = false; - - static u8 cam_const_addr[4][6] = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} - }; - static u8 cam_const_broad[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - }; - - if (clear_all) { - u8 idx = 0; - u8 cam_offset = 0; - u8 clear_number = 5; - - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "clear_all\n"); - - for (idx = 0; idx < clear_number; idx++) { - rtl_cam_mark_invalid(hw, cam_offset + idx); - rtl_cam_empty_entry(hw, cam_offset + idx); - - if (idx < 5) { - memset(rtlpriv->sec.key_buf[idx], 0, - MAX_KEY_LEN); - rtlpriv->sec.key_len[idx] = 0; - } - } - - } else { - switch (enc_algo) { - case WEP40_ENCRYPTION: - enc_algo = CAM_WEP40; - break; - case WEP104_ENCRYPTION: - enc_algo = CAM_WEP104; - break; - case TKIP_ENCRYPTION: - enc_algo = CAM_TKIP; - break; - case AESCCMP_ENCRYPTION: - enc_algo = CAM_AES; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - enc_algo = CAM_TKIP; - break; - } - - if (is_wepkey || rtlpriv->sec.use_defaultkey) { - macaddr = cam_const_addr[key]; - id = key; - } else { - if (is_group) { - macaddr = cam_const_broad; - id = key; - } else { - if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_MESH_POINT) { - id = rtl_cam_get_free_entry(hw, mac_ad); - if (id >= TOTAL_CAM_ENTRY) { - RT_TRACE(rtlpriv, COMP_SEC, - DBG_EMERG, - "Can not find free hw security cam entry\n"); - return; - } - } else { - id = CAM_PAIRWISE_KEY_POSITION; - } - - key = PAIRWISE_KEYIDX; - is_pairwise = true; - } - } - - if (rtlpriv->sec.key_len[key] == 0) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "delete one entry, id is %d\n", id); - if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_MESH_POINT) - rtl_cam_del_entry(hw, mac_ad); - rtl_cam_delete_one_entry(hw, mac_ad, id); - } else { - add_one_key(hw, macaddr, mac, key, id, enc_algo, - is_pairwise); - } - } -} - -static void rtl8188ee_bt_var_init(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rppriv = rtl_pcipriv(hw); - struct bt_coexist_info coexist = rppriv->bt_coexist; - - coexist.bt_coexistence = rppriv->bt_coexist.eeprom_bt_coexist; - coexist.bt_ant_num = coexist.eeprom_bt_ant_num; - coexist.bt_coexist_type = coexist.eeprom_bt_type; - - if (coexist.reg_bt_iso == 2) - coexist.bt_ant_isolation = coexist.eeprom_bt_ant_isol; - else - coexist.bt_ant_isolation = coexist.reg_bt_iso; - - coexist.bt_radio_shared_type = coexist.eeprom_bt_radio_shared; - - if (coexist.bt_coexistence) { - if (coexist.reg_bt_sco == 1) - coexist.bt_service = BT_OTHER_ACTION; - else if (coexist.reg_bt_sco == 2) - coexist.bt_service = BT_SCO; - else if (coexist.reg_bt_sco == 4) - coexist.bt_service = BT_BUSY; - else if (coexist.reg_bt_sco == 5) - coexist.bt_service = BT_OTHERBUSY; - else - coexist.bt_service = BT_IDLE; - - coexist.bt_edca_ul = 0; - coexist.bt_edca_dl = 0; - coexist.bt_rssi_state = 0xff; - } -} - -void rtl8188ee_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, - bool auto_load_fail, u8 *hwinfo) -{ - rtl8188ee_bt_var_init(hw); -} - -void rtl8188ee_bt_reg_init(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rppriv = rtl_pcipriv(hw); - - /* 0:Low, 1:High, 2:From Efuse. */ - rppriv->bt_coexist.reg_bt_iso = 2; - /* 0:Idle, 1:None-SCO, 2:SCO, 3:From Counter. */ - rppriv->bt_coexist.reg_bt_sco = 3; - /* 0:Disable BT control A-MPDU, 1:Enable BT control A-MPDU. */ - rppriv->bt_coexist.reg_bt_sco = 0; -} - -void rtl8188ee_bt_hw_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_pci_priv *rppriv = rtl_pcipriv(hw); - struct bt_coexist_info coexist = rppriv->bt_coexist; - u8 u1_tmp; - - if (coexist.bt_coexistence && - ((coexist.bt_coexist_type == BT_CSR_BC4) || - coexist.bt_coexist_type == BT_CSR_BC8)) { - if (coexist.bt_ant_isolation) - rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, 0xa0); - - u1_tmp = rtl_read_byte(rtlpriv, 0x4fd) & - BIT_OFFSET_LEN_MASK_32(0, 1); - u1_tmp = u1_tmp | ((coexist.bt_ant_isolation == 1) ? - 0 : BIT_OFFSET_LEN_MASK_32(1, 1)) | - ((coexist.bt_service == BT_SCO) ? - 0 : BIT_OFFSET_LEN_MASK_32(2, 1)); - rtl_write_byte(rtlpriv, 0x4fd, u1_tmp); - - rtl_write_dword(rtlpriv, REG_BT_COEX_TABLE+4, 0xaaaa9aaa); - rtl_write_dword(rtlpriv, REG_BT_COEX_TABLE+8, 0xffbd0040); - rtl_write_dword(rtlpriv, REG_BT_COEX_TABLE+0xc, 0x40000010); - - /* Config to 1T1R. */ - if (rtlphy->rf_type == RF_1T1R) { - u1_tmp = rtl_read_byte(rtlpriv, ROFDM0_TRXPATHENABLE); - u1_tmp &= ~(BIT_OFFSET_LEN_MASK_32(1, 1)); - rtl_write_byte(rtlpriv, ROFDM0_TRXPATHENABLE, u1_tmp); - - u1_tmp = rtl_read_byte(rtlpriv, ROFDM1_TRXPATHENABLE); - u1_tmp &= ~(BIT_OFFSET_LEN_MASK_32(1, 1)); - rtl_write_byte(rtlpriv, ROFDM1_TRXPATHENABLE, u1_tmp); - } - } -} - -void rtl88ee_suspend(struct ieee80211_hw *hw) -{ -} - -void rtl88ee_resume(struct ieee80211_hw *hw) -{ -} - -/* Turn on AAP (RCR:bit 0) for promicuous mode. */ -void rtl88ee_allow_all_destaddr(struct ieee80211_hw *hw, - bool allow_all_da, bool write_into_reg) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - if (allow_all_da) /* Set BIT0 */ - rtlpci->receive_config |= RCR_AAP; - else /* Clear BIT0 */ - rtlpci->receive_config &= ~RCR_AAP; - - if (write_into_reg) - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); - - RT_TRACE(rtlpriv, COMP_TURBO | COMP_INIT, DBG_LOUD, - "receive_config = 0x%08X, write_into_reg =%d\n", - rtlpci->receive_config, write_into_reg); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.h b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.h deleted file mode 100644 index b4460a41bd01..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.h +++ /dev/null @@ -1,68 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CE_HW_H__ -#define __RTL92CE_HW_H__ - -void rtl88ee_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); -void rtl88ee_read_eeprom_info(struct ieee80211_hw *hw); -void rtl88ee_interrupt_recognized(struct ieee80211_hw *hw, - u32 *p_inta, u32 *p_intb); -int rtl88ee_hw_init(struct ieee80211_hw *hw); -void rtl88ee_card_disable(struct ieee80211_hw *hw); -void rtl88ee_enable_interrupt(struct ieee80211_hw *hw); -void rtl88ee_disable_interrupt(struct ieee80211_hw *hw); -int rtl88ee_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type); -void rtl88ee_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); -void rtl88ee_set_qos(struct ieee80211_hw *hw, int aci); -void rtl88ee_set_beacon_related_registers(struct ieee80211_hw *hw); -void rtl88ee_set_beacon_interval(struct ieee80211_hw *hw); -void rtl88ee_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr); -void rtl88ee_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); -void rtl88ee_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level); -void rtl88ee_update_channel_access_setting(struct ieee80211_hw *hw); -bool rtl88ee_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid); -void rtl88ee_enable_hw_security_config(struct ieee80211_hw *hw); -void rtl88ee_set_key(struct ieee80211_hw *hw, u32 key_index, - u8 *p_macaddr, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all); - -void rtl8188ee_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, - bool autoload_fail, u8 *hwinfo); -void rtl8188ee_bt_reg_init(struct ieee80211_hw *hw); -void rtl8188ee_bt_hw_init(struct ieee80211_hw *hw); -void rtl88ee_suspend(struct ieee80211_hw *hw); -void rtl88ee_resume(struct ieee80211_hw *hw); -void rtl88ee_allow_all_destaddr(struct ieee80211_hw *hw, - bool allow_all_da, bool write_into_reg); -void rtl88ee_fw_clk_off_timer_callback(unsigned long data); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/led.c b/drivers/net/wireless/rtlwifi/rtl8188ee/led.c deleted file mode 100644 index c81a9cb6894c..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/led.c +++ /dev/null @@ -1,157 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "reg.h" -#include "led.h" - -static void rtl88ee_init_led(struct ieee80211_hw *hw, - struct rtl_led *pled, enum rtl_led_pin ledpin) -{ - pled->hw = hw; - pled->ledpin = ledpin; - pled->ledon = false; -} - -void rtl88ee_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - u8 ledcfg; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, - "LedAddr:%X ledpin =%d\n", REG_LEDCFG2, pled->ledpin); - - switch (pled->ledpin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); - rtl_write_byte(rtlpriv, REG_LEDCFG2, - (ledcfg & 0xf0) | BIT(5) | BIT(6)); - break; - case LED_PIN_LED1: - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG1); - rtl_write_byte(rtlpriv, REG_LEDCFG1, ledcfg & 0x10); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - pled->ledon = true; -} - -void rtl88ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - u8 ledcfg; - u8 val; - - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, - "LedAddr:%X ledpin =%d\n", REG_LEDCFG2, pled->ledpin); - - switch (pled->ledpin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); - ledcfg &= 0xf0; - val = ledcfg | BIT(3) | BIT(5) | BIT(6); - if (pcipriv->ledctl.led_opendrain == true) { - rtl_write_byte(rtlpriv, REG_LEDCFG2, val); - ledcfg = rtl_read_byte(rtlpriv, REG_MAC_PINMUX_CFG); - val = ledcfg & 0xFE; - rtl_write_byte(rtlpriv, REG_MAC_PINMUX_CFG, val); - } else { - rtl_write_byte(rtlpriv, REG_LEDCFG2, val); - } - break; - case LED_PIN_LED1: - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG1); - ledcfg &= 0x10; - rtl_write_byte(rtlpriv, REG_LEDCFG1, (ledcfg | BIT(3))); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - pled->ledon = false; -} - -void rtl88ee_init_sw_leds(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - - rtl88ee_init_led(hw, &(pcipriv->ledctl.sw_led0), LED_PIN_LED0); - rtl88ee_init_led(hw, &(pcipriv->ledctl.sw_led1), LED_PIN_LED1); -} - -static void rtl88ee_sw_led_control(struct ieee80211_hw *hw, - enum led_ctl_mode ledaction) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); - - switch (ledaction) { - case LED_CTL_POWER_ON: - case LED_CTL_LINK: - case LED_CTL_NO_LINK: - rtl88ee_sw_led_on(hw, pLed0); - break; - case LED_CTL_POWER_OFF: - rtl88ee_sw_led_off(hw, pLed0); - break; - default: - break; - } -} - -void rtl88ee_led_control(struct ieee80211_hw *hw, - enum led_ctl_mode ledaction) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - if ((ppsc->rfoff_reason > RF_CHANGE_BY_PS) && - (ledaction == LED_CTL_TX || - ledaction == LED_CTL_RX || - ledaction == LED_CTL_SITE_SURVEY || - ledaction == LED_CTL_LINK || - ledaction == LED_CTL_NO_LINK || - ledaction == LED_CTL_START_TO_LINK || - ledaction == LED_CTL_POWER_ON)) { - return; - } - RT_TRACE(rtlpriv, COMP_LED, DBG_TRACE, "ledaction %d,\n", - ledaction); - rtl88ee_sw_led_control(hw, ledaction); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/led.h b/drivers/net/wireless/rtlwifi/rtl8188ee/led.h deleted file mode 100644 index 4073f6f847b2..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/led.h +++ /dev/null @@ -1,38 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CE_LED_H__ -#define __RTL92CE_LED_H__ - -void rtl88ee_init_sw_leds(struct ieee80211_hw *hw); -void rtl88ee_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl88ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl88ee_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/phy.c b/drivers/net/wireless/rtlwifi/rtl8188ee/phy.c deleted file mode 100644 index e655c0473225..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/phy.c +++ /dev/null @@ -1,2202 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../ps.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" -#include "table.h" - -static void set_baseband_phy_config(struct ieee80211_hw *hw); -static void set_baseband_agc_config(struct ieee80211_hw *hw); -static void store_pwrindex_offset(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, - u32 data); -static bool check_cond(struct ieee80211_hw *hw, const u32 condition); - -static u32 rf_serial_read(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct bb_reg_def *phreg = &rtlphy->phyreg_def[rfpath]; - u32 newoffset; - u32 tmplong, tmplong2; - u8 rfpi_enable = 0; - u32 ret; - int jj = RF90_PATH_A; - int kk = RF90_PATH_B; - - offset &= 0xff; - newoffset = offset; - if (RT_CANNOT_IO(hw)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "return all one\n"); - return 0xFFFFFFFF; - } - tmplong = rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, MASKDWORD); - if (rfpath == jj) - tmplong2 = tmplong; - else - tmplong2 = rtl_get_bbreg(hw, phreg->rfhssi_para2, MASKDWORD); - tmplong2 = (tmplong2 & (~BLSSIREADADDRESS)) | - (newoffset << 23) | BLSSIREADEDGE; - rtl_set_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, MASKDWORD, - tmplong & (~BLSSIREADEDGE)); - mdelay(1); - rtl_set_bbreg(hw, phreg->rfhssi_para2, MASKDWORD, tmplong2); - mdelay(2); - if (rfpath == jj) - rfpi_enable = (u8) rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER1, - BIT(8)); - else if (rfpath == kk) - rfpi_enable = (u8) rtl_get_bbreg(hw, RFPGA0_XB_HSSIPARAMETER1, - BIT(8)); - if (rfpi_enable) - ret = rtl_get_bbreg(hw, phreg->rf_rbpi, BLSSIREADBACKDATA); - else - ret = rtl_get_bbreg(hw, phreg->rf_rb, BLSSIREADBACKDATA); - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFR-%d Addr[0x%x]= 0x%x\n", - rfpath, phreg->rf_rb, ret); - return ret; -} - -static void rf_serial_write(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset, - u32 data) -{ - u32 data_and_addr; - u32 newoffset; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct bb_reg_def *phreg = &rtlphy->phyreg_def[rfpath]; - - if (RT_CANNOT_IO(hw)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "stop\n"); - return; - } - offset &= 0xff; - newoffset = offset; - data_and_addr = ((newoffset << 20) | (data & 0x000fffff)) & 0x0fffffff; - rtl_set_bbreg(hw, phreg->rf3wire_offset, MASKDWORD, data_and_addr); - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFW-%d Addr[0x%x]= 0x%x\n", - rfpath, phreg->rf3wire_offset, data_and_addr); -} - -static u32 cal_bit_shift(u32 bitmask) -{ - u32 i; - - for (i = 0; i <= 31; i++) { - if (((bitmask >> i) & 0x1) == 1) - break; - } - return i; -} - -static bool config_bb_with_header(struct ieee80211_hw *hw, - u8 configtype) -{ - if (configtype == BASEBAND_CONFIG_PHY_REG) - set_baseband_phy_config(hw); - else if (configtype == BASEBAND_CONFIG_AGC_TAB) - set_baseband_agc_config(hw); - return true; -} - -static bool config_bb_with_pgheader(struct ieee80211_hw *hw, - u8 configtype) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int i; - u32 *table_pg; - u16 tbl_page_len; - u32 v1 = 0, v2 = 0; - - tbl_page_len = RTL8188EEPHY_REG_ARRAY_PGLEN; - table_pg = RTL8188EEPHY_REG_ARRAY_PG; - - if (configtype == BASEBAND_CONFIG_PHY_REG) { - for (i = 0; i < tbl_page_len; i = i + 3) { - v1 = table_pg[i]; - v2 = table_pg[i + 1]; - - if (v1 < 0xcdcdcdcd) { - if (table_pg[i] == 0xfe) - mdelay(50); - else if (table_pg[i] == 0xfd) - mdelay(5); - else if (table_pg[i] == 0xfc) - mdelay(1); - else if (table_pg[i] == 0xfb) - udelay(50); - else if (table_pg[i] == 0xfa) - udelay(5); - else if (table_pg[i] == 0xf9) - udelay(1); - - store_pwrindex_offset(hw, table_pg[i], - table_pg[i + 1], - table_pg[i + 2]); - continue; - } else { - if (!check_cond(hw, table_pg[i])) { - /*don't need the hw_body*/ - i += 2; /* skip the pair of expression*/ - v1 = table_pg[i]; - v2 = table_pg[i + 1]; - while (v2 != 0xDEAD) { - i += 3; - v1 = table_pg[i]; - v2 = table_pg[i + 1]; - } - } - } - } - } else { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "configtype != BaseBand_Config_PHY_REG\n"); - } - return true; -} - -static bool config_parafile(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *fuse = rtl_efuse(rtl_priv(hw)); - bool rtstatus; - - rtstatus = config_bb_with_header(hw, BASEBAND_CONFIG_PHY_REG); - if (rtstatus != true) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!"); - return false; - } - - if (fuse->autoload_failflag == false) { - rtlphy->pwrgroup_cnt = 0; - rtstatus = config_bb_with_pgheader(hw, BASEBAND_CONFIG_PHY_REG); - } - if (rtstatus != true) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!"); - return false; - } - rtstatus = config_bb_with_header(hw, BASEBAND_CONFIG_AGC_TAB); - if (rtstatus != true) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "AGC Table Fail\n"); - return false; - } - rtlphy->cck_high_power = (bool) (rtl_get_bbreg(hw, - RFPGA0_XA_HSSIPARAMETER2, 0x200)); - - return true; -} - -static void rtl88e_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - int jj = RF90_PATH_A; - int kk = RF90_PATH_B; - - rtlphy->phyreg_def[jj].rfintfs = RFPGA0_XAB_RFINTERFACESW; - rtlphy->phyreg_def[kk].rfintfs = RFPGA0_XAB_RFINTERFACESW; - rtlphy->phyreg_def[RF90_PATH_C].rfintfs = RFPGA0_XCD_RFINTERFACESW; - rtlphy->phyreg_def[RF90_PATH_D].rfintfs = RFPGA0_XCD_RFINTERFACESW; - - rtlphy->phyreg_def[jj].rfintfi = RFPGA0_XAB_RFINTERFACERB; - rtlphy->phyreg_def[kk].rfintfi = RFPGA0_XAB_RFINTERFACERB; - rtlphy->phyreg_def[RF90_PATH_C].rfintfi = RFPGA0_XCD_RFINTERFACERB; - rtlphy->phyreg_def[RF90_PATH_D].rfintfi = RFPGA0_XCD_RFINTERFACERB; - - rtlphy->phyreg_def[jj].rfintfo = RFPGA0_XA_RFINTERFACEOE; - rtlphy->phyreg_def[kk].rfintfo = RFPGA0_XB_RFINTERFACEOE; - - rtlphy->phyreg_def[jj].rfintfe = RFPGA0_XA_RFINTERFACEOE; - rtlphy->phyreg_def[kk].rfintfe = RFPGA0_XB_RFINTERFACEOE; - - rtlphy->phyreg_def[jj].rf3wire_offset = RFPGA0_XA_LSSIPARAMETER; - rtlphy->phyreg_def[kk].rf3wire_offset = RFPGA0_XB_LSSIPARAMETER; - - rtlphy->phyreg_def[jj].rflssi_select = rFPGA0_XAB_RFPARAMETER; - rtlphy->phyreg_def[kk].rflssi_select = rFPGA0_XAB_RFPARAMETER; - rtlphy->phyreg_def[RF90_PATH_C].rflssi_select = rFPGA0_XCD_RFPARAMETER; - rtlphy->phyreg_def[RF90_PATH_D].rflssi_select = rFPGA0_XCD_RFPARAMETER; - - rtlphy->phyreg_def[jj].rftxgain_stage = RFPGA0_TXGAINSTAGE; - rtlphy->phyreg_def[kk].rftxgain_stage = RFPGA0_TXGAINSTAGE; - rtlphy->phyreg_def[RF90_PATH_C].rftxgain_stage = RFPGA0_TXGAINSTAGE; - rtlphy->phyreg_def[RF90_PATH_D].rftxgain_stage = RFPGA0_TXGAINSTAGE; - - rtlphy->phyreg_def[jj].rfhssi_para1 = RFPGA0_XA_HSSIPARAMETER1; - rtlphy->phyreg_def[kk].rfhssi_para1 = RFPGA0_XB_HSSIPARAMETER1; - - rtlphy->phyreg_def[jj].rfhssi_para2 = RFPGA0_XA_HSSIPARAMETER2; - rtlphy->phyreg_def[kk].rfhssi_para2 = RFPGA0_XB_HSSIPARAMETER2; - - rtlphy->phyreg_def[jj].rfsw_ctrl = RFPGA0_XAB_SWITCHCONTROL; - rtlphy->phyreg_def[kk].rfsw_ctrl = RFPGA0_XAB_SWITCHCONTROL; - rtlphy->phyreg_def[RF90_PATH_C].rfsw_ctrl = RFPGA0_XCD_SWITCHCONTROL; - rtlphy->phyreg_def[RF90_PATH_D].rfsw_ctrl = RFPGA0_XCD_SWITCHCONTROL; - - rtlphy->phyreg_def[jj].rfagc_control1 = ROFDM0_XAAGCCORE1; - rtlphy->phyreg_def[kk].rfagc_control1 = ROFDM0_XBAGCCORE1; - rtlphy->phyreg_def[RF90_PATH_C].rfagc_control1 = ROFDM0_XCAGCCORE1; - rtlphy->phyreg_def[RF90_PATH_D].rfagc_control1 = ROFDM0_XDAGCCORE1; - - rtlphy->phyreg_def[jj].rfagc_control2 = ROFDM0_XAAGCCORE2; - rtlphy->phyreg_def[kk].rfagc_control2 = ROFDM0_XBAGCCORE2; - rtlphy->phyreg_def[RF90_PATH_C].rfagc_control2 = ROFDM0_XCAGCCORE2; - rtlphy->phyreg_def[RF90_PATH_D].rfagc_control2 = ROFDM0_XDAGCCORE2; - - rtlphy->phyreg_def[jj].rfrxiq_imbal = ROFDM0_XARXIQIMBAL; - rtlphy->phyreg_def[kk].rfrxiq_imbal = ROFDM0_XBRXIQIMBAL; - rtlphy->phyreg_def[RF90_PATH_C].rfrxiq_imbal = ROFDM0_XCRXIQIMBAL; - rtlphy->phyreg_def[RF90_PATH_D].rfrxiq_imbal = ROFDM0_XDRXIQIMBAL; - - rtlphy->phyreg_def[jj].rfrx_afe = ROFDM0_XARXAFE; - rtlphy->phyreg_def[kk].rfrx_afe = ROFDM0_XBRXAFE; - rtlphy->phyreg_def[RF90_PATH_C].rfrx_afe = ROFDM0_XCRXAFE; - rtlphy->phyreg_def[RF90_PATH_D].rfrx_afe = ROFDM0_XDRXAFE; - - rtlphy->phyreg_def[jj].rftxiq_imbal = ROFDM0_XATXIQIMBAL; - rtlphy->phyreg_def[kk].rftxiq_imbal = ROFDM0_XBTXIQIMBAL; - rtlphy->phyreg_def[RF90_PATH_C].rftxiq_imbal = ROFDM0_XCTXIQIMBAL; - rtlphy->phyreg_def[RF90_PATH_D].rftxiq_imbal = ROFDM0_XDTXIQIMBAL; - - rtlphy->phyreg_def[jj].rftx_afe = ROFDM0_XATXAFE; - rtlphy->phyreg_def[kk].rftx_afe = ROFDM0_XBTXAFE; - - rtlphy->phyreg_def[jj].rf_rb = RFPGA0_XA_LSSIREADBACK; - rtlphy->phyreg_def[kk].rf_rb = RFPGA0_XB_LSSIREADBACK; - - rtlphy->phyreg_def[jj].rf_rbpi = TRANSCEIVEA_HSPI_READBACK; - rtlphy->phyreg_def[kk].rf_rbpi = TRANSCEIVEB_HSPI_READBACK; -} - -static bool rtl88e_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable, - u32 cmdtableidx, u32 cmdtablesz, - enum swchnlcmd_id cmdid, - u32 para1, u32 para2, u32 msdelay) -{ - struct swchnlcmd *pcmd; - - if (cmdtable == NULL) { - RT_ASSERT(false, "cmdtable cannot be NULL.\n"); - return false; - } - - if (cmdtableidx >= cmdtablesz) - return false; - - pcmd = cmdtable + cmdtableidx; - pcmd->cmdid = cmdid; - pcmd->para1 = para1; - pcmd->para2 = para2; - pcmd->msdelay = msdelay; - return true; -} - -static bool chnl_step_by_step(struct ieee80211_hw *hw, - u8 channel, u8 *stage, u8 *step, - u32 *delay) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct swchnlcmd precommoncmd[MAX_PRECMD_CNT]; - u32 precommoncmdcnt; - struct swchnlcmd postcommoncmd[MAX_POSTCMD_CNT]; - u32 postcommoncmdcnt; - struct swchnlcmd rfdependcmd[MAX_RFDEPENDCMD_CNT]; - u32 rfdependcmdcnt; - struct swchnlcmd *currentcmd = NULL; - u8 rfpath; - u8 num_total_rfpath = rtlphy->num_total_rfpath; - - precommoncmdcnt = 0; - rtl88e_phy_set_sw_chnl_cmdarray(precommoncmd, precommoncmdcnt++, - MAX_PRECMD_CNT, - CMDID_SET_TXPOWEROWER_LEVEL, 0, 0, 0); - rtl88e_phy_set_sw_chnl_cmdarray(precommoncmd, precommoncmdcnt++, - MAX_PRECMD_CNT, CMDID_END, 0, 0, 0); - - postcommoncmdcnt = 0; - - rtl88e_phy_set_sw_chnl_cmdarray(postcommoncmd, postcommoncmdcnt++, - MAX_POSTCMD_CNT, CMDID_END, 0, 0, 0); - - rfdependcmdcnt = 0; - - RT_ASSERT((channel >= 1 && channel <= 14), - "illegal channel for Zebra: %d\n", channel); - - rtl88e_phy_set_sw_chnl_cmdarray(rfdependcmd, rfdependcmdcnt++, - MAX_RFDEPENDCMD_CNT, CMDID_RF_WRITEREG, - RF_CHNLBW, channel, 10); - - rtl88e_phy_set_sw_chnl_cmdarray(rfdependcmd, rfdependcmdcnt++, - MAX_RFDEPENDCMD_CNT, CMDID_END, 0, 0, - 0); - - do { - switch (*stage) { - case 0: - currentcmd = &precommoncmd[*step]; - break; - case 1: - currentcmd = &rfdependcmd[*step]; - break; - case 2: - currentcmd = &postcommoncmd[*step]; - break; - } - - if (currentcmd->cmdid == CMDID_END) { - if ((*stage) == 2) { - return true; - } else { - (*stage)++; - (*step) = 0; - continue; - } - } - - switch (currentcmd->cmdid) { - case CMDID_SET_TXPOWEROWER_LEVEL: - rtl88e_phy_set_txpower_level(hw, channel); - break; - case CMDID_WRITEPORT_ULONG: - rtl_write_dword(rtlpriv, currentcmd->para1, - currentcmd->para2); - break; - case CMDID_WRITEPORT_USHORT: - rtl_write_word(rtlpriv, currentcmd->para1, - (u16) currentcmd->para2); - break; - case CMDID_WRITEPORT_UCHAR: - rtl_write_byte(rtlpriv, currentcmd->para1, - (u8) currentcmd->para2); - break; - case CMDID_RF_WRITEREG: - for (rfpath = 0; rfpath < num_total_rfpath; rfpath++) { - rtlphy->rfreg_chnlval[rfpath] = - ((rtlphy->rfreg_chnlval[rfpath] & - 0xfffffc00) | currentcmd->para2); - - rtl_set_rfreg(hw, (enum radio_path)rfpath, - currentcmd->para1, - RFREG_OFFSET_MASK, - rtlphy->rfreg_chnlval[rfpath]); - } - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - - break; - } while (true); - - (*delay) = currentcmd->msdelay; - (*step)++; - return false; -} - -static long rtl88e_pwr_idx_dbm(struct ieee80211_hw *hw, - enum wireless_mode wirelessmode, - u8 txpwridx) -{ - long offset; - long pwrout_dbm; - - switch (wirelessmode) { - case WIRELESS_MODE_B: - offset = -7; - break; - case WIRELESS_MODE_G: - case WIRELESS_MODE_N_24G: - offset = -8; - break; - default: - offset = -8; - break; - } - pwrout_dbm = txpwridx / 2 + offset; - return pwrout_dbm; -} - -static void rtl88e_phy_set_io(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "--->Cmd(%#x), set_io_inprogress(%d)\n", - rtlphy->current_io_type, rtlphy->set_io_inprogress); - switch (rtlphy->current_io_type) { - case IO_CMD_RESUME_DM_BY_SCAN: - dm_digtable->cur_igvalue = rtlphy->initgain_backup.xaagccore1; - /*rtl92c_dm_write_dig(hw);*/ - rtl88e_phy_set_txpower_level(hw, rtlphy->current_channel); - rtl_set_bbreg(hw, RCCK0_CCA, 0xff0000, 0x83); - break; - case IO_CMD_PAUSE_DM_BY_SCAN: - rtlphy->initgain_backup.xaagccore1 = dm_digtable->cur_igvalue; - dm_digtable->cur_igvalue = 0x17; - rtl_set_bbreg(hw, RCCK0_CCA, 0xff0000, 0x40); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - rtlphy->set_io_inprogress = false; - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "(%#x)\n", rtlphy->current_io_type); -} - -u32 rtl88e_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 returnvalue, originalvalue, bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x)\n", regaddr, bitmask); - originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = cal_bit_shift(bitmask); - returnvalue = (originalvalue & bitmask) >> bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "BBR MASK = 0x%x Addr[0x%x]= 0x%x\n", bitmask, - regaddr, originalvalue); - - return returnvalue; -} - -void rtl88e_phy_set_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 originalvalue, bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x),data(%#x)\n", - regaddr, bitmask, data); - - if (bitmask != MASKDWORD) { - originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = cal_bit_shift(bitmask); - data = ((originalvalue & (~bitmask)) | (data << bitshift)); - } - - rtl_write_dword(rtlpriv, regaddr, data); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x)\n", - regaddr, bitmask, data); -} - -u32 rtl88e_phy_query_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, u32 bitmask) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 original_value, readback_value, bitshift; - unsigned long flags; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n", - regaddr, rfpath, bitmask); - - spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags); - - - original_value = rf_serial_read(hw, rfpath, regaddr); - bitshift = cal_bit_shift(bitmask); - readback_value = (original_value & bitmask) >> bitshift; - - spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n", - regaddr, rfpath, bitmask, original_value); - - return readback_value; -} - -void rtl88e_phy_set_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, - u32 regaddr, u32 bitmask, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 original_value, bitshift; - unsigned long flags; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", - regaddr, bitmask, data, rfpath); - - spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags); - - if (bitmask != RFREG_OFFSET_MASK) { - original_value = rf_serial_read(hw, rfpath, regaddr); - bitshift = cal_bit_shift(bitmask); - data = ((original_value & (~bitmask)) | - (data << bitshift)); - } - - rf_serial_write(hw, rfpath, regaddr, data); - - - spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", - regaddr, bitmask, data, rfpath); -} - -static bool config_mac_with_header(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - u32 arraylength; - u32 *ptrarray; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Read Rtl8188EMACPHY_Array\n"); - arraylength = RTL8188EEMAC_1T_ARRAYLEN; - ptrarray = RTL8188EEMAC_1T_ARRAY; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Img:RTL8188EEMAC_1T_ARRAY LEN %d\n", arraylength); - for (i = 0; i < arraylength; i = i + 2) - rtl_write_byte(rtlpriv, ptrarray[i], (u8) ptrarray[i + 1]); - return true; -} - -bool rtl88e_phy_mac_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - bool rtstatus = config_mac_with_header(hw); - - rtl_write_byte(rtlpriv, 0x04CA, 0x0B); - return rtstatus; -} - -bool rtl88e_phy_bb_config(struct ieee80211_hw *hw) -{ - bool rtstatus = true; - struct rtl_priv *rtlpriv = rtl_priv(hw); - u16 regval; - u8 reg_hwparafile = 1; - u32 tmp; - rtl88e_phy_init_bb_rf_register_definition(hw); - regval = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN); - rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, - regval | BIT(13) | BIT(0) | BIT(1)); - - rtl_write_byte(rtlpriv, REG_RF_CTRL, RF_EN | RF_RSTB | RF_SDMRSTB); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, - FEN_PPLL | FEN_PCIEA | FEN_DIO_PCIE | - FEN_BB_GLB_RSTN | FEN_BBRSTB); - tmp = rtl_read_dword(rtlpriv, 0x4c); - rtl_write_dword(rtlpriv, 0x4c, tmp | BIT(23)); - if (reg_hwparafile == 1) - rtstatus = config_parafile(hw); - return rtstatus; -} - -bool rtl88e_phy_rf_config(struct ieee80211_hw *hw) -{ - return rtl88e_phy_rf6052_config(hw); -} - -static bool check_cond(struct ieee80211_hw *hw, - const u32 condition) -{ - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_efuse *fuse = rtl_efuse(rtl_priv(hw)); - u32 _board = fuse->board_type; /*need efuse define*/ - u32 _interface = rtlhal->interface; - u32 _platform = 0x08;/*SupportPlatform */ - u32 cond = condition; - - if (condition == 0xCDCDCDCD) - return true; - - cond = condition & 0xFF; - if ((_board & cond) == 0 && cond != 0x1F) - return false; - - cond = condition & 0xFF00; - cond = cond >> 8; - if ((_interface & cond) == 0 && cond != 0x07) - return false; - - cond = condition & 0xFF0000; - cond = cond >> 16; - if ((_platform & cond) == 0 && cond != 0x0F) - return false; - return true; -} - -static void _rtl8188e_config_rf_reg(struct ieee80211_hw *hw, - u32 addr, u32 data, enum radio_path rfpath, - u32 regaddr) -{ - if (addr == 0xffe) { - mdelay(50); - } else if (addr == 0xfd) { - mdelay(5); - } else if (addr == 0xfc) { - mdelay(1); - } else if (addr == 0xfb) { - udelay(50); - } else if (addr == 0xfa) { - udelay(5); - } else if (addr == 0xf9) { - udelay(1); - } else { - rtl_set_rfreg(hw, rfpath, regaddr, - RFREG_OFFSET_MASK, - data); - udelay(1); - } -} - -static void rtl88_config_s(struct ieee80211_hw *hw, - u32 addr, u32 data) -{ - u32 content = 0x1000; /*RF Content: radio_a_txt*/ - u32 maskforphyset = (u32)(content & 0xE000); - - _rtl8188e_config_rf_reg(hw, addr, data, RF90_PATH_A, - addr | maskforphyset); -} - -static void _rtl8188e_config_bb_reg(struct ieee80211_hw *hw, - u32 addr, u32 data) -{ - if (addr == 0xfe) { - mdelay(50); - } else if (addr == 0xfd) { - mdelay(5); - } else if (addr == 0xfc) { - mdelay(1); - } else if (addr == 0xfb) { - udelay(50); - } else if (addr == 0xfa) { - udelay(5); - } else if (addr == 0xf9) { - udelay(1); - } else { - rtl_set_bbreg(hw, addr, MASKDWORD, data); - udelay(1); - } -} - - -#define NEXT_PAIR(v1, v2, i) \ - do { \ - i += 2; v1 = array_table[i]; \ - v2 = array_table[i + 1]; \ - } while (0) - -static void set_baseband_agc_config(struct ieee80211_hw *hw) -{ - int i; - u32 *array_table; - u16 arraylen; - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 v1 = 0, v2 = 0; - - arraylen = RTL8188EEAGCTAB_1TARRAYLEN; - array_table = RTL8188EEAGCTAB_1TARRAY; - - for (i = 0; i < arraylen; i += 2) { - v1 = array_table[i]; - v2 = array_table[i + 1]; - if (v1 < 0xCDCDCDCD) { - rtl_set_bbreg(hw, array_table[i], MASKDWORD, - array_table[i + 1]); - udelay(1); - continue; - } else {/*This line is the start line of branch.*/ - if (!check_cond(hw, array_table[i])) { - /*Discard the following (offset, data) pairs*/ - NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && v2 != 0xCDEF && - v2 != 0xCDCD && i < arraylen - 2) { - NEXT_PAIR(v1, v2, i); - } - i -= 2; /* compensate for loop's += 2*/ - } else { - /* Configure matched pairs and skip to end */ - NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && v2 != 0xCDEF && - v2 != 0xCDCD && i < arraylen - 2) { - rtl_set_bbreg(hw, array_table[i], - MASKDWORD, - array_table[i + 1]); - udelay(1); - NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < arraylen - 2) - NEXT_PAIR(v1, v2, i); - } - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "The agctab_array_table[0] is %x Rtl818EEPHY_REGArray[1] is %x\n", - array_table[i], - array_table[i + 1]); - } -} - -static void set_baseband_phy_config(struct ieee80211_hw *hw) -{ - int i; - u32 *array_table; - u16 arraylen; - u32 v1 = 0, v2 = 0; - - arraylen = RTL8188EEPHY_REG_1TARRAYLEN; - array_table = RTL8188EEPHY_REG_1TARRAY; - - for (i = 0; i < arraylen; i += 2) { - v1 = array_table[i]; - v2 = array_table[i + 1]; - if (v1 < 0xcdcdcdcd) { - _rtl8188e_config_bb_reg(hw, v1, v2); - } else {/*This line is the start line of branch.*/ - if (!check_cond(hw, array_table[i])) { - /*Discard the following (offset, data) pairs*/ - NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < arraylen - 2) - NEXT_PAIR(v1, v2, i); - i -= 2; /* prevent from for-loop += 2*/ - } else { - /* Configure matched pairs and skip to end */ - NEXT_PAIR(v1, v2, i); - while (v2 != 0xDEAD && - v2 != 0xCDEF && - v2 != 0xCDCD && i < arraylen - 2) { - _rtl8188e_config_bb_reg(hw, v1, v2); - NEXT_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < arraylen - 2) - NEXT_PAIR(v1, v2, i); - } - } - } -} - -static void store_pwrindex_offset(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, - u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - if (regaddr == RTXAGC_A_RATE18_06) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][0] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][0] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][0]); - } - if (regaddr == RTXAGC_A_RATE54_24) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][1] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][1] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][1]); - } - if (regaddr == RTXAGC_A_CCK1_MCS32) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][6] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][6] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][6]); - } - if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][7] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][7] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][7]); - } - if (regaddr == RTXAGC_A_MCS03_MCS00) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][2] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][2] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][2]); - } - if (regaddr == RTXAGC_A_MCS07_MCS04) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][3] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][3] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][3]); - } - if (regaddr == RTXAGC_A_MCS11_MCS08) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][4] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][4] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][4]); - } - if (regaddr == RTXAGC_A_MCS15_MCS12) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][5] = data; - if (get_rf_type(rtlphy) == RF_1T1R) - rtlphy->pwrgroup_cnt++; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][5] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][5]); - } - if (regaddr == RTXAGC_B_RATE18_06) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][8] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][8] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][8]); - } - if (regaddr == RTXAGC_B_RATE54_24) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][9] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][9] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][9]); - } - if (regaddr == RTXAGC_B_CCK1_55_MCS32) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][14] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][14] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][14]); - } - if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][15] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][15] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][15]); - } - if (regaddr == RTXAGC_B_MCS03_MCS00) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][10] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][10] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][10]); - } - if (regaddr == RTXAGC_B_MCS07_MCS04) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][11] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][11] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][11]); - } - if (regaddr == RTXAGC_B_MCS11_MCS08) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][12] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][12] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][12]); - } - if (regaddr == RTXAGC_B_MCS15_MCS12) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][13] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][13] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][13]); - if (get_rf_type(rtlphy) != RF_1T1R) - rtlphy->pwrgroup_cnt++; - } -} - -#define READ_NEXT_RF_PAIR(v1, v2, i) \ - do { \ - i += 2; v1 = a_table[i]; \ - v2 = a_table[i + 1]; \ - } while (0) - -bool rtl88e_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, - enum radio_path rfpath) -{ - int i; - u32 *a_table; - u16 a_len; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u32 v1 = 0, v2 = 0; - - a_len = RTL8188EE_RADIOA_1TARRAYLEN; - a_table = RTL8188EE_RADIOA_1TARRAY; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Radio_A:RTL8188EE_RADIOA_1TARRAY %d\n", a_len); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Radio No %x\n", rfpath); - switch (rfpath) { - case RF90_PATH_A: - for (i = 0; i < a_len; i = i + 2) { - v1 = a_table[i]; - v2 = a_table[i + 1]; - if (v1 < 0xcdcdcdcd) { - rtl88_config_s(hw, v1, v2); - } else {/*This line is the start line of branch.*/ - if (!check_cond(hw, a_table[i])) { - /* Discard the following (offset, data) - * pairs - */ - READ_NEXT_RF_PAIR(v1, v2, i); - while (v2 != 0xDEAD && v2 != 0xCDEF && - v2 != 0xCDCD && i < a_len - 2) - READ_NEXT_RF_PAIR(v1, v2, i); - i -= 2; /* prevent from for-loop += 2*/ - } else { - /* Configure matched pairs and skip to - * end of if-else. - */ - READ_NEXT_RF_PAIR(v1, v2, i); - while (v2 != 0xDEAD && v2 != 0xCDEF && - v2 != 0xCDCD && i < a_len - 2) { - rtl88_config_s(hw, v1, v2); - READ_NEXT_RF_PAIR(v1, v2, i); - } - - while (v2 != 0xDEAD && i < a_len - 2) - READ_NEXT_RF_PAIR(v1, v2, i); - } - } - } - - if (rtlhal->oem_id == RT_CID_819x_HP) - rtl88_config_s(hw, 0x52, 0x7E4BD); - - break; - - case RF90_PATH_B: - case RF90_PATH_C: - case RF90_PATH_D: - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - return true; -} - -void rtl88e_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - rtlphy->default_initialgain[0] = rtl_get_bbreg(hw, ROFDM0_XAAGCCORE1, - MASKBYTE0); - rtlphy->default_initialgain[1] = rtl_get_bbreg(hw, ROFDM0_XBAGCCORE1, - MASKBYTE0); - rtlphy->default_initialgain[2] = rtl_get_bbreg(hw, ROFDM0_XCAGCCORE1, - MASKBYTE0); - rtlphy->default_initialgain[3] = rtl_get_bbreg(hw, ROFDM0_XDAGCCORE1, - MASKBYTE0); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Default initial gain (c50 = 0x%x, c58 = 0x%x, c60 = 0x%x, c68 = 0x%x\n", - rtlphy->default_initialgain[0], - rtlphy->default_initialgain[1], - rtlphy->default_initialgain[2], - rtlphy->default_initialgain[3]); - - rtlphy->framesync = rtl_get_bbreg(hw, ROFDM0_RXDETECTOR3, - MASKBYTE0); - rtlphy->framesync_c34 = rtl_get_bbreg(hw, ROFDM0_RXDETECTOR2, - MASKDWORD); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Default framesync (0x%x) = 0x%x\n", - ROFDM0_RXDETECTOR3, rtlphy->framesync); -} - -void rtl88e_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u8 level; - long dbm; - - level = rtlphy->cur_cck_txpwridx; - dbm = rtl88e_pwr_idx_dbm(hw, WIRELESS_MODE_B, level); - level = rtlphy->cur_ofdm24g_txpwridx; - if (rtl88e_pwr_idx_dbm(hw, WIRELESS_MODE_G, level) > dbm) - dbm = rtl88e_pwr_idx_dbm(hw, WIRELESS_MODE_G, level); - level = rtlphy->cur_ofdm24g_txpwridx; - if (rtl88e_pwr_idx_dbm(hw, WIRELESS_MODE_N_24G, level) > dbm) - dbm = rtl88e_pwr_idx_dbm(hw, WIRELESS_MODE_N_24G, level); - *powerlevel = dbm; -} - -static void _rtl88e_get_txpower_index(struct ieee80211_hw *hw, u8 channel, - u8 *cckpower, u8 *ofdm, u8 *bw20_pwr, - u8 *bw40_pwr) -{ - struct rtl_efuse *fuse = rtl_efuse(rtl_priv(hw)); - u8 i = (channel - 1); - u8 rf_path = 0; - int jj = RF90_PATH_A; - int kk = RF90_PATH_B; - - for (rf_path = 0; rf_path < 2; rf_path++) { - if (rf_path == jj) { - cckpower[jj] = fuse->txpwrlevel_cck[jj][i]; - if (fuse->txpwr_ht20diff[jj][i] > 0x0f) /*-8~7 */ - bw20_pwr[jj] = fuse->txpwrlevel_ht40_1s[jj][i] - - (~(fuse->txpwr_ht20diff[jj][i]) + 1); - else - bw20_pwr[jj] = fuse->txpwrlevel_ht40_1s[jj][i] + - fuse->txpwr_ht20diff[jj][i]; - if (fuse->txpwr_legacyhtdiff[jj][i] > 0xf) - ofdm[jj] = fuse->txpwrlevel_ht40_1s[jj][i] - - (~(fuse->txpwr_legacyhtdiff[jj][i])+1); - else - ofdm[jj] = fuse->txpwrlevel_ht40_1s[jj][i] + - fuse->txpwr_legacyhtdiff[jj][i]; - bw40_pwr[jj] = fuse->txpwrlevel_ht40_1s[jj][i]; - - } else if (rf_path == kk) { - cckpower[kk] = fuse->txpwrlevel_cck[kk][i]; - bw20_pwr[kk] = fuse->txpwrlevel_ht40_1s[kk][i] + - fuse->txpwr_ht20diff[kk][i]; - ofdm[kk] = fuse->txpwrlevel_ht40_1s[kk][i] + - fuse->txpwr_legacyhtdiff[kk][i]; - bw40_pwr[kk] = fuse->txpwrlevel_ht40_1s[kk][i]; - } - } -} - -static void _rtl88e_ccxpower_index_check(struct ieee80211_hw *hw, - u8 channel, u8 *cckpower, - u8 *ofdm, u8 *bw20_pwr, - u8 *bw40_pwr) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - rtlphy->cur_cck_txpwridx = cckpower[0]; - rtlphy->cur_ofdm24g_txpwridx = ofdm[0]; - rtlphy->cur_bw20_txpwridx = bw20_pwr[0]; - rtlphy->cur_bw40_txpwridx = bw40_pwr[0]; -} - -void rtl88e_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel) -{ - struct rtl_efuse *fuse = rtl_efuse(rtl_priv(hw)); - u8 cckpower[MAX_TX_COUNT] = {0}, ofdm[MAX_TX_COUNT] = {0}; - u8 bw20_pwr[MAX_TX_COUNT] = {0}, bw40_pwr[MAX_TX_COUNT] = {0}; - - if (fuse->txpwr_fromeprom == false) - return; - _rtl88e_get_txpower_index(hw, channel, &cckpower[0], &ofdm[0], - &bw20_pwr[0], &bw40_pwr[0]); - _rtl88e_ccxpower_index_check(hw, channel, &cckpower[0], &ofdm[0], - &bw20_pwr[0], &bw40_pwr[0]); - rtl88e_phy_rf6052_set_cck_txpower(hw, &cckpower[0]); - rtl88e_phy_rf6052_set_ofdm_txpower(hw, &ofdm[0], &bw20_pwr[0], - &bw40_pwr[0], channel); -} - -void rtl88e_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - enum io_type iotype; - - if (!is_hal_stop(rtlhal)) { - switch (operation) { - case SCAN_OPT_BACKUP: - iotype = IO_CMD_PAUSE_DM_BY_SCAN; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_IO_CMD, - (u8 *)&iotype); - break; - case SCAN_OPT_RESTORE: - iotype = IO_CMD_RESUME_DM_BY_SCAN; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_IO_CMD, - (u8 *)&iotype); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Unknown Scan Backup operation.\n"); - break; - } - } -} - -void rtl88e_phy_set_bw_mode_callback(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u8 reg_bw_opmode; - u8 reg_prsr_rsc; - - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, - "Switch to %s bandwidth\n", - rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? - "20MHz" : "40MHz"); - - if (is_hal_stop(rtlhal)) { - rtlphy->set_bwmode_inprogress = false; - return; - } - - reg_bw_opmode = rtl_read_byte(rtlpriv, REG_BWOPMODE); - reg_prsr_rsc = rtl_read_byte(rtlpriv, REG_RRSR + 2); - - switch (rtlphy->current_chan_bw) { - case HT_CHANNEL_WIDTH_20: - reg_bw_opmode |= BW_OPMODE_20MHZ; - rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); - break; - case HT_CHANNEL_WIDTH_20_40: - reg_bw_opmode &= ~BW_OPMODE_20MHZ; - rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); - reg_prsr_rsc = - (reg_prsr_rsc & 0x90) | (mac->cur_40_prime_sc << 5); - rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_prsr_rsc); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", rtlphy->current_chan_bw); - break; - } - - switch (rtlphy->current_chan_bw) { - case HT_CHANNEL_WIDTH_20: - rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x0); - rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x0); - /* rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 1);*/ - break; - case HT_CHANNEL_WIDTH_20_40: - rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x1); - rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x1); - - rtl_set_bbreg(hw, RCCK0_SYSTEM, BCCK_SIDEBAND, - (mac->cur_40_prime_sc >> 1)); - rtl_set_bbreg(hw, ROFDM1_LSTF, 0xC00, mac->cur_40_prime_sc); - /*rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 0);*/ - - rtl_set_bbreg(hw, 0x818, (BIT(26) | BIT(27)), - (mac->cur_40_prime_sc == - HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", rtlphy->current_chan_bw); - break; - } - rtl88e_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); - rtlphy->set_bwmode_inprogress = false; - RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, "\n"); -} - -void rtl88e_phy_set_bw_mode(struct ieee80211_hw *hw, - enum nl80211_channel_type ch_type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 tmp_bw = rtlphy->current_chan_bw; - - if (rtlphy->set_bwmode_inprogress) - return; - rtlphy->set_bwmode_inprogress = true; - if ((!is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { - rtl88e_phy_set_bw_mode_callback(hw); - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "FALSE driver sleep or unload\n"); - rtlphy->set_bwmode_inprogress = false; - rtlphy->current_chan_bw = tmp_bw; - } -} - -void rtl88e_phy_sw_chnl_callback(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 delay; - - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, - "switch to channel%d\n", rtlphy->current_channel); - if (is_hal_stop(rtlhal)) - return; - do { - if (!rtlphy->sw_chnl_inprogress) - break; - if (!chnl_step_by_step(hw, rtlphy->current_channel, - &rtlphy->sw_chnl_stage, - &rtlphy->sw_chnl_step, &delay)) { - if (delay > 0) - mdelay(delay); - else - continue; - } else { - rtlphy->sw_chnl_inprogress = false; - } - break; - } while (true); - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "\n"); -} - -u8 rtl88e_phy_sw_chnl(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (rtlphy->sw_chnl_inprogress) - return 0; - if (rtlphy->set_bwmode_inprogress) - return 0; - RT_ASSERT((rtlphy->current_channel <= 14), - "WIRELESS_MODE_G but channel>14"); - rtlphy->sw_chnl_inprogress = true; - rtlphy->sw_chnl_stage = 0; - rtlphy->sw_chnl_step = 0; - if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { - rtl88e_phy_sw_chnl_callback(hw); - RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, - "sw_chnl_inprogress false schdule workitem current channel %d\n", - rtlphy->current_channel); - rtlphy->sw_chnl_inprogress = false; - } else { - RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, - "sw_chnl_inprogress false driver sleep or unload\n"); - rtlphy->sw_chnl_inprogress = false; - } - return 1; -} - -static u8 _rtl88e_phy_path_a_iqk(struct ieee80211_hw *hw, bool config_pathb) -{ - u32 reg_eac, reg_e94, reg_e9c; - u8 result = 0x00; - - rtl_set_bbreg(hw, 0xe30, MASKDWORD, 0x10008c1c); - rtl_set_bbreg(hw, 0xe34, MASKDWORD, 0x30008c1c); - rtl_set_bbreg(hw, 0xe38, MASKDWORD, 0x8214032a); - rtl_set_bbreg(hw, 0xe3c, MASKDWORD, 0x28160000); - - rtl_set_bbreg(hw, 0xe4c, MASKDWORD, 0x00462911); - rtl_set_bbreg(hw, 0xe48, MASKDWORD, 0xf9000000); - rtl_set_bbreg(hw, 0xe48, MASKDWORD, 0xf8000000); - - mdelay(IQK_DELAY_TIME); - - reg_eac = rtl_get_bbreg(hw, 0xeac, MASKDWORD); - reg_e94 = rtl_get_bbreg(hw, 0xe94, MASKDWORD); - reg_e9c = rtl_get_bbreg(hw, 0xe9c, MASKDWORD); - - if (!(reg_eac & BIT(28)) && - (((reg_e94 & 0x03FF0000) >> 16) != 0x142) && - (((reg_e9c & 0x03FF0000) >> 16) != 0x42)) - result |= 0x01; - return result; -} - -static u8 _rtl88e_phy_path_b_iqk(struct ieee80211_hw *hw) -{ - u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc; - u8 result = 0x00; - - rtl_set_bbreg(hw, 0xe60, MASKDWORD, 0x00000002); - rtl_set_bbreg(hw, 0xe60, MASKDWORD, 0x00000000); - mdelay(IQK_DELAY_TIME); - reg_eac = rtl_get_bbreg(hw, 0xeac, MASKDWORD); - reg_eb4 = rtl_get_bbreg(hw, 0xeb4, MASKDWORD); - reg_ebc = rtl_get_bbreg(hw, 0xebc, MASKDWORD); - reg_ec4 = rtl_get_bbreg(hw, 0xec4, MASKDWORD); - reg_ecc = rtl_get_bbreg(hw, 0xecc, MASKDWORD); - - if (!(reg_eac & BIT(31)) && - (((reg_eb4 & 0x03FF0000) >> 16) != 0x142) && - (((reg_ebc & 0x03FF0000) >> 16) != 0x42)) - result |= 0x01; - else - return result; - if (!(reg_eac & BIT(30)) && - (((reg_ec4 & 0x03FF0000) >> 16) != 0x132) && - (((reg_ecc & 0x03FF0000) >> 16) != 0x36)) - result |= 0x02; - return result; -} - -static u8 _rtl88e_phy_path_a_rx_iqk(struct ieee80211_hw *hw, bool config_pathb) -{ - u32 reg_eac, reg_e94, reg_e9c, reg_ea4, u32temp; - u8 result = 0x00; - int jj = RF90_PATH_A; - - /*Get TXIMR Setting*/ - /*Modify RX IQK mode table*/ - rtl_set_bbreg(hw, RFPGA0_IQK, MASKDWORD, 0x00000000); - rtl_set_rfreg(hw, jj, RF_WE_LUT, RFREG_OFFSET_MASK, 0x800a0); - rtl_set_rfreg(hw, jj, RF_RCK_OS, RFREG_OFFSET_MASK, 0x30000); - rtl_set_rfreg(hw, jj, RF_TXPA_G1, RFREG_OFFSET_MASK, 0x0000f); - rtl_set_rfreg(hw, jj, RF_TXPA_G2, RFREG_OFFSET_MASK, 0xf117b); - rtl_set_bbreg(hw, RFPGA0_IQK, MASKDWORD, 0x80800000); - - /*IQK Setting*/ - rtl_set_bbreg(hw, RTX_IQK, MASKDWORD, 0x01007c00); - rtl_set_bbreg(hw, RRX_IQK, MASKDWORD, 0x81004800); - - /*path a IQK setting*/ - rtl_set_bbreg(hw, RTX_IQK_TONE_A, MASKDWORD, 0x10008c1c); - rtl_set_bbreg(hw, RRX_IQK_TONE_A, MASKDWORD, 0x30008c1c); - rtl_set_bbreg(hw, RTX_IQK_PI_A, MASKDWORD, 0x82160804); - rtl_set_bbreg(hw, RRX_IQK_PI_A, MASKDWORD, 0x28160000); - - /*LO calibration Setting*/ - rtl_set_bbreg(hw, RIQK_AGC_RSP, MASKDWORD, 0x0046a911); - /*one shot, path A LOK & iqk*/ - rtl_set_bbreg(hw, RIQK_AGC_PTS, MASKDWORD, 0xf9000000); - rtl_set_bbreg(hw, RIQK_AGC_PTS, MASKDWORD, 0xf8000000); - - mdelay(IQK_DELAY_TIME); - - reg_eac = rtl_get_bbreg(hw, RRX_POWER_AFTER_IQK_A_2, MASKDWORD); - reg_e94 = rtl_get_bbreg(hw, RTX_POWER_BEFORE_IQK_A, MASKDWORD); - reg_e9c = rtl_get_bbreg(hw, RTX_POWER_AFTER_IQK_A, MASKDWORD); - - - if (!(reg_eac & BIT(28)) && - (((reg_e94 & 0x03FF0000) >> 16) != 0x142) && - (((reg_e9c & 0x03FF0000) >> 16) != 0x42)) - result |= 0x01; - else - return result; - - u32temp = 0x80007C00 | (reg_e94&0x3FF0000) | - ((reg_e9c&0x3FF0000) >> 16); - rtl_set_bbreg(hw, RTX_IQK, MASKDWORD, u32temp); - /*RX IQK*/ - /*Modify RX IQK mode table*/ - rtl_set_bbreg(hw, RFPGA0_IQK, MASKDWORD, 0x00000000); - rtl_set_rfreg(hw, jj, RF_WE_LUT, RFREG_OFFSET_MASK, 0x800a0); - rtl_set_rfreg(hw, jj, RF_RCK_OS, RFREG_OFFSET_MASK, 0x30000); - rtl_set_rfreg(hw, jj, RF_TXPA_G1, RFREG_OFFSET_MASK, 0x0000f); - rtl_set_rfreg(hw, jj, RF_TXPA_G2, RFREG_OFFSET_MASK, 0xf7ffa); - rtl_set_bbreg(hw, RFPGA0_IQK, MASKDWORD, 0x80800000); - - /*IQK Setting*/ - rtl_set_bbreg(hw, RRX_IQK, MASKDWORD, 0x01004800); - - /*path a IQK setting*/ - rtl_set_bbreg(hw, RTX_IQK_TONE_A, MASKDWORD, 0x30008c1c); - rtl_set_bbreg(hw, RRX_IQK_TONE_A, MASKDWORD, 0x10008c1c); - rtl_set_bbreg(hw, RTX_IQK_PI_A, MASKDWORD, 0x82160c05); - rtl_set_bbreg(hw, RRX_IQK_PI_A, MASKDWORD, 0x28160c05); - - /*LO calibration Setting*/ - rtl_set_bbreg(hw, RIQK_AGC_RSP, MASKDWORD, 0x0046a911); - /*one shot, path A LOK & iqk*/ - rtl_set_bbreg(hw, RIQK_AGC_PTS, MASKDWORD, 0xf9000000); - rtl_set_bbreg(hw, RIQK_AGC_PTS, MASKDWORD, 0xf8000000); - - mdelay(IQK_DELAY_TIME); - - reg_eac = rtl_get_bbreg(hw, RRX_POWER_AFTER_IQK_A_2, MASKDWORD); - reg_e94 = rtl_get_bbreg(hw, RTX_POWER_BEFORE_IQK_A, MASKDWORD); - reg_e9c = rtl_get_bbreg(hw, RTX_POWER_AFTER_IQK_A, MASKDWORD); - reg_ea4 = rtl_get_bbreg(hw, RRX_POWER_BEFORE_IQK_A_2, MASKDWORD); - - if (!(reg_eac & BIT(27)) && - (((reg_ea4 & 0x03FF0000) >> 16) != 0x132) && - (((reg_eac & 0x03FF0000) >> 16) != 0x36)) - result |= 0x02; - return result; -} - -static void fill_iqk(struct ieee80211_hw *hw, bool iqk_ok, long result[][8], - u8 final, bool btxonly) -{ - u32 oldval_0, x, tx0_a, reg; - long y, tx0_c; - - if (final == 0xFF) { - return; - } else if (iqk_ok) { - oldval_0 = (rtl_get_bbreg(hw, ROFDM0_XATXIQIMBAL, - MASKDWORD) >> 22) & 0x3FF; - x = result[final][0]; - if ((x & 0x00000200) != 0) - x = x | 0xFFFFFC00; - tx0_a = (x * oldval_0) >> 8; - rtl_set_bbreg(hw, ROFDM0_XATXIQIMBAL, 0x3FF, tx0_a); - rtl_set_bbreg(hw, ROFDM0_ECCATHRES, BIT(31), - ((x * oldval_0 >> 7) & 0x1)); - y = result[final][1]; - if ((y & 0x00000200) != 0) - y |= 0xFFFFFC00; - tx0_c = (y * oldval_0) >> 8; - rtl_set_bbreg(hw, ROFDM0_XCTXAFE, 0xF0000000, - ((tx0_c & 0x3C0) >> 6)); - rtl_set_bbreg(hw, ROFDM0_XATXIQIMBAL, 0x003F0000, - (tx0_c & 0x3F)); - rtl_set_bbreg(hw, ROFDM0_ECCATHRES, BIT(29), - ((y * oldval_0 >> 7) & 0x1)); - if (btxonly) - return; - reg = result[final][2]; - rtl_set_bbreg(hw, ROFDM0_XARXIQIMBAL, 0x3FF, reg); - reg = result[final][3] & 0x3F; - rtl_set_bbreg(hw, ROFDM0_XARXIQIMBAL, 0xFC00, reg); - reg = (result[final][3] >> 6) & 0xF; - rtl_set_bbreg(hw, 0xca0, 0xF0000000, reg); - } -} - -static void save_adda_reg(struct ieee80211_hw *hw, - const u32 *addareg, u32 *backup, - u32 registernum) -{ - u32 i; - - for (i = 0; i < registernum; i++) - backup[i] = rtl_get_bbreg(hw, addareg[i], MASKDWORD); -} - -static void save_mac_reg(struct ieee80211_hw *hw, const u32 *macreg, - u32 *macbackup) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - - for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++) - macbackup[i] = rtl_read_byte(rtlpriv, macreg[i]); - macbackup[i] = rtl_read_dword(rtlpriv, macreg[i]); -} - -static void reload_adda(struct ieee80211_hw *hw, const u32 *addareg, - u32 *backup, u32 reg_num) -{ - u32 i; - - for (i = 0; i < reg_num; i++) - rtl_set_bbreg(hw, addareg[i], MASKDWORD, backup[i]); -} - -static void reload_mac(struct ieee80211_hw *hw, const u32 *macreg, - u32 *macbackup) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - - for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++) - rtl_write_byte(rtlpriv, macreg[i], (u8) macbackup[i]); - rtl_write_dword(rtlpriv, macreg[i], macbackup[i]); -} - -static void _rtl88e_phy_path_adda_on(struct ieee80211_hw *hw, - const u32 *addareg, bool is_patha_on, - bool is2t) -{ - u32 pathon; - u32 i; - - pathon = is_patha_on ? 0x04db25a4 : 0x0b1b25a4; - if (false == is2t) { - pathon = 0x0bdb25a0; - rtl_set_bbreg(hw, addareg[0], MASKDWORD, 0x0b1b25a0); - } else { - rtl_set_bbreg(hw, addareg[0], MASKDWORD, pathon); - } - - for (i = 1; i < IQK_ADDA_REG_NUM; i++) - rtl_set_bbreg(hw, addareg[i], MASKDWORD, pathon); -} - -static void _rtl88e_phy_mac_setting_calibration(struct ieee80211_hw *hw, - const u32 *macreg, - u32 *macbackup) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i = 0; - - rtl_write_byte(rtlpriv, macreg[i], 0x3F); - - for (i = 1; i < (IQK_MAC_REG_NUM - 1); i++) - rtl_write_byte(rtlpriv, macreg[i], - (u8) (macbackup[i] & (~BIT(3)))); - rtl_write_byte(rtlpriv, macreg[i], (u8) (macbackup[i] & (~BIT(5)))); -} - -static void _rtl88e_phy_path_a_standby(struct ieee80211_hw *hw) -{ - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x0); - rtl_set_bbreg(hw, 0x840, MASKDWORD, 0x00010000); - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x80800000); -} - -static void _rtl88e_phy_pi_mode_switch(struct ieee80211_hw *hw, bool pi_mode) -{ - u32 mode; - - mode = pi_mode ? 0x01000100 : 0x01000000; - rtl_set_bbreg(hw, 0x820, MASKDWORD, mode); - rtl_set_bbreg(hw, 0x828, MASKDWORD, mode); -} - -static bool sim_comp(struct ieee80211_hw *hw, long result[][8], u8 c1, u8 c2) -{ - u32 i, j, diff, bitmap, bound; - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - u8 final[2] = {0xFF, 0xFF}; - bool bresult = true, is2t = IS_92C_SERIAL(rtlhal->version); - - if (is2t) - bound = 8; - else - bound = 4; - - bitmap = 0; - - for (i = 0; i < bound; i++) { - diff = (result[c1][i] > result[c2][i]) ? - (result[c1][i] - result[c2][i]) : - (result[c2][i] - result[c1][i]); - - if (diff > MAX_TOLERANCE) { - if ((i == 2 || i == 6) && !bitmap) { - if (result[c1][i] + result[c1][i + 1] == 0) - final[(i / 4)] = c2; - else if (result[c2][i] + result[c2][i + 1] == 0) - final[(i / 4)] = c1; - else - bitmap = bitmap | (1 << i); - } else { - bitmap = bitmap | (1 << i); - } - } - } - - if (bitmap == 0) { - for (i = 0; i < (bound / 4); i++) { - if (final[i] != 0xFF) { - for (j = i * 4; j < (i + 1) * 4 - 2; j++) - result[3][j] = result[final[i]][j]; - bresult = false; - } - } - return bresult; - } else if (!(bitmap & 0x0F)) { - for (i = 0; i < 4; i++) - result[3][i] = result[c1][i]; - return false; - } else if (!(bitmap & 0xF0) && is2t) { - for (i = 4; i < 8; i++) - result[3][i] = result[c1][i]; - return false; - } else { - return false; - } -} - -static void _rtl88e_phy_iq_calibrate(struct ieee80211_hw *hw, - long result[][8], u8 t, bool is2t) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 i; - u8 patha_ok, pathb_ok; - const u32 adda_reg[IQK_ADDA_REG_NUM] = { - 0x85c, 0xe6c, 0xe70, 0xe74, - 0xe78, 0xe7c, 0xe80, 0xe84, - 0xe88, 0xe8c, 0xed0, 0xed4, - 0xed8, 0xedc, 0xee0, 0xeec - }; - const u32 iqk_mac_reg[IQK_MAC_REG_NUM] = { - 0x522, 0x550, 0x551, 0x040 - }; - const u32 iqk_bb_reg[IQK_BB_REG_NUM] = { - ROFDM0_TRXPATHENABLE, ROFDM0_TRMUXPAR, RFPGA0_XCD_RFINTERFACESW, - 0xb68, 0xb6c, 0x870, 0x860, 0x864, 0x800 - }; - const u32 retrycount = 2; - - if (t == 0) { - save_adda_reg(hw, adda_reg, rtlphy->adda_backup, 16); - save_mac_reg(hw, iqk_mac_reg, rtlphy->iqk_mac_backup); - save_adda_reg(hw, iqk_bb_reg, rtlphy->iqk_bb_backup, - IQK_BB_REG_NUM); - } - _rtl88e_phy_path_adda_on(hw, adda_reg, true, is2t); - if (t == 0) { - rtlphy->rfpi_enable = (u8) rtl_get_bbreg(hw, - RFPGA0_XA_HSSIPARAMETER1, BIT(8)); - } - - if (!rtlphy->rfpi_enable) - _rtl88e_phy_pi_mode_switch(hw, true); - /*BB Setting*/ - rtl_set_bbreg(hw, 0x800, BIT(24), 0x00); - rtl_set_bbreg(hw, 0xc04, MASKDWORD, 0x03a05600); - rtl_set_bbreg(hw, 0xc08, MASKDWORD, 0x000800e4); - rtl_set_bbreg(hw, 0x874, MASKDWORD, 0x22204000); - - rtl_set_bbreg(hw, 0x870, BIT(10), 0x01); - rtl_set_bbreg(hw, 0x870, BIT(26), 0x01); - rtl_set_bbreg(hw, 0x860, BIT(10), 0x00); - rtl_set_bbreg(hw, 0x864, BIT(10), 0x00); - - if (is2t) { - rtl_set_bbreg(hw, 0x840, MASKDWORD, 0x00010000); - rtl_set_bbreg(hw, 0x844, MASKDWORD, 0x00010000); - } - _rtl88e_phy_mac_setting_calibration(hw, iqk_mac_reg, - rtlphy->iqk_mac_backup); - rtl_set_bbreg(hw, 0xb68, MASKDWORD, 0x0f600000); - if (is2t) - rtl_set_bbreg(hw, 0xb6c, MASKDWORD, 0x0f600000); - - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x80800000); - rtl_set_bbreg(hw, 0xe40, MASKDWORD, 0x01007c00); - rtl_set_bbreg(hw, 0xe44, MASKDWORD, 0x81004800); - for (i = 0; i < retrycount; i++) { - patha_ok = _rtl88e_phy_path_a_iqk(hw, is2t); - if (patha_ok == 0x01) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Path A Tx IQK Success!!\n"); - result[t][0] = (rtl_get_bbreg(hw, 0xe94, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][1] = (rtl_get_bbreg(hw, 0xe9c, MASKDWORD) & - 0x3FF0000) >> 16; - break; - } - } - - for (i = 0; i < retrycount; i++) { - patha_ok = _rtl88e_phy_path_a_rx_iqk(hw, is2t); - if (patha_ok == 0x03) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Path A Rx IQK Success!!\n"); - result[t][2] = (rtl_get_bbreg(hw, 0xea4, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][3] = (rtl_get_bbreg(hw, 0xeac, MASKDWORD) & - 0x3FF0000) >> 16; - break; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Path a RX iqk fail!!!\n"); - } - } - - if (0 == patha_ok) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Path A IQK Success!!\n"); - } - if (is2t) { - _rtl88e_phy_path_a_standby(hw); - _rtl88e_phy_path_adda_on(hw, adda_reg, false, is2t); - for (i = 0; i < retrycount; i++) { - pathb_ok = _rtl88e_phy_path_b_iqk(hw); - if (pathb_ok == 0x03) { - result[t][4] = (rtl_get_bbreg(hw, - 0xeb4, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][5] = - (rtl_get_bbreg(hw, 0xebc, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][6] = - (rtl_get_bbreg(hw, 0xec4, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][7] = - (rtl_get_bbreg(hw, 0xecc, MASKDWORD) & - 0x3FF0000) >> 16; - break; - } else if (i == (retrycount - 1) && pathb_ok == 0x01) { - result[t][4] = (rtl_get_bbreg(hw, - 0xeb4, MASKDWORD) & - 0x3FF0000) >> 16; - } - result[t][5] = (rtl_get_bbreg(hw, 0xebc, MASKDWORD) & - 0x3FF0000) >> 16; - } - } - - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0); - - if (t != 0) { - if (!rtlphy->rfpi_enable) - _rtl88e_phy_pi_mode_switch(hw, false); - reload_adda(hw, adda_reg, rtlphy->adda_backup, 16); - reload_mac(hw, iqk_mac_reg, rtlphy->iqk_mac_backup); - reload_adda(hw, iqk_bb_reg, rtlphy->iqk_bb_backup, - IQK_BB_REG_NUM); - - rtl_set_bbreg(hw, 0x840, MASKDWORD, 0x00032ed3); - if (is2t) - rtl_set_bbreg(hw, 0x844, MASKDWORD, 0x00032ed3); - rtl_set_bbreg(hw, 0xe30, MASKDWORD, 0x01008c00); - rtl_set_bbreg(hw, 0xe34, MASKDWORD, 0x01008c00); - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "88ee IQK Finish!!\n"); -} - -static void _rtl88e_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) -{ - u8 tmpreg; - u32 rf_a_mode = 0, rf_b_mode = 0, lc_cal; - struct rtl_priv *rtlpriv = rtl_priv(hw); - int jj = RF90_PATH_A; - int kk = RF90_PATH_B; - - tmpreg = rtl_read_byte(rtlpriv, 0xd03); - - if ((tmpreg & 0x70) != 0) - rtl_write_byte(rtlpriv, 0xd03, tmpreg & 0x8F); - else - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF); - - if ((tmpreg & 0x70) != 0) { - rf_a_mode = rtl_get_rfreg(hw, jj, 0x00, MASK12BITS); - - if (is2t) - rf_b_mode = rtl_get_rfreg(hw, kk, 0x00, - MASK12BITS); - - rtl_set_rfreg(hw, jj, 0x00, MASK12BITS, - (rf_a_mode & 0x8FFFF) | 0x10000); - - if (is2t) - rtl_set_rfreg(hw, kk, 0x00, MASK12BITS, - (rf_b_mode & 0x8FFFF) | 0x10000); - } - lc_cal = rtl_get_rfreg(hw, jj, 0x18, MASK12BITS); - - rtl_set_rfreg(hw, jj, 0x18, MASK12BITS, lc_cal | 0x08000); - - mdelay(100); - - if ((tmpreg & 0x70) != 0) { - rtl_write_byte(rtlpriv, 0xd03, tmpreg); - rtl_set_rfreg(hw, jj, 0x00, MASK12BITS, rf_a_mode); - - if (is2t) - rtl_set_rfreg(hw, kk, 0x00, MASK12BITS, - rf_b_mode); - } else { - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "\n"); -} - -static void rfpath_switch(struct ieee80211_hw *hw, - bool bmain, bool is2t) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_efuse *fuse = rtl_efuse(rtl_priv(hw)); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "\n"); - - if (is_hal_stop(rtlhal)) { - u8 u1btmp; - u1btmp = rtl_read_byte(rtlpriv, REG_LEDCFG0); - rtl_write_byte(rtlpriv, REG_LEDCFG0, u1btmp | BIT(7)); - rtl_set_bbreg(hw, rFPGA0_XAB_RFPARAMETER, BIT(13), 0x01); - } - if (is2t) { - if (bmain) - rtl_set_bbreg(hw, RFPGA0_XB_RFINTERFACEOE, - BIT(5) | BIT(6), 0x1); - else - rtl_set_bbreg(hw, RFPGA0_XB_RFINTERFACEOE, - BIT(5) | BIT(6), 0x2); - } else { - rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW, BIT(8) | BIT(9), 0); - rtl_set_bbreg(hw, 0x914, MASKLWORD, 0x0201); - - /* We use the RF definition of MAIN and AUX, left antenna and - * right antenna repectively. - * Default output at AUX. - */ - if (bmain) { - rtl_set_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, BIT(14) | - BIT(13) | BIT(12), 0); - rtl_set_bbreg(hw, RFPGA0_XB_RFINTERFACEOE, BIT(5) | - BIT(4) | BIT(3), 0); - if (fuse->antenna_div_type == CGCS_RX_HW_ANTDIV) - rtl_set_bbreg(hw, RCONFIG_RAM64X16, BIT(31), 0); - } else { - rtl_set_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, BIT(14) | - BIT(13) | BIT(12), 1); - rtl_set_bbreg(hw, RFPGA0_XB_RFINTERFACEOE, BIT(5) | - BIT(4) | BIT(3), 1); - if (fuse->antenna_div_type == CGCS_RX_HW_ANTDIV) - rtl_set_bbreg(hw, RCONFIG_RAM64X16, BIT(31), 1); - } - } -} - -#undef IQK_ADDA_REG_NUM -#undef IQK_DELAY_TIME - -void rtl88e_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - long result[4][8]; - u8 i, final; - bool patha_ok; - long reg_e94, reg_e9c, reg_ea4, reg_eb4, reg_ebc, reg_tmp = 0; - bool is12simular, is13simular, is23simular; - u32 iqk_bb_reg[9] = { - ROFDM0_XARXIQIMBAL, - ROFDM0_XBRXIQIMBAL, - ROFDM0_ECCATHRES, - ROFDM0_AGCRSSITABLE, - ROFDM0_XATXIQIMBAL, - ROFDM0_XBTXIQIMBAL, - ROFDM0_XCTXAFE, - ROFDM0_XDTXAFE, - ROFDM0_RXIQEXTANTA - }; - - if (recovery) { - reload_adda(hw, iqk_bb_reg, rtlphy->iqk_bb_backup, 9); - return; - } - - memset(result, 0, 32 * sizeof(long)); - final = 0xff; - patha_ok = false; - is12simular = false; - is23simular = false; - is13simular = false; - for (i = 0; i < 3; i++) { - if (get_rf_type(rtlphy) == RF_2T2R) - _rtl88e_phy_iq_calibrate(hw, result, i, true); - else - _rtl88e_phy_iq_calibrate(hw, result, i, false); - if (i == 1) { - is12simular = sim_comp(hw, result, 0, 1); - if (is12simular) { - final = 0; - break; - } - } - if (i == 2) { - is13simular = sim_comp(hw, result, 0, 2); - if (is13simular) { - final = 0; - break; - } - is23simular = sim_comp(hw, result, 1, 2); - if (is23simular) { - final = 1; - } else { - for (i = 0; i < 8; i++) - reg_tmp += result[3][i]; - - if (reg_tmp != 0) - final = 3; - else - final = 0xFF; - } - } - } - for (i = 0; i < 4; i++) { - reg_e94 = result[i][0]; - reg_e9c = result[i][1]; - reg_ea4 = result[i][2]; - reg_eb4 = result[i][4]; - reg_ebc = result[i][5]; - } - if (final != 0xff) { - reg_e94 = result[final][0]; - rtlphy->reg_e94 = reg_e94; - reg_e9c = result[final][1]; - rtlphy->reg_e9c = reg_e9c; - reg_ea4 = result[final][2]; - reg_eb4 = result[final][4]; - rtlphy->reg_eb4 = reg_eb4; - reg_ebc = result[final][5]; - rtlphy->reg_ebc = reg_ebc; - patha_ok = true; - } else { - rtlphy->reg_e94 = 0x100; - rtlphy->reg_eb4 = 0x100; - rtlphy->reg_ebc = 0x0; - rtlphy->reg_e9c = 0x0; - } - if (reg_e94 != 0) /*&&(reg_ea4 != 0) */ - fill_iqk(hw, patha_ok, result, final, (reg_ea4 == 0)); - if (final != 0xFF) { - for (i = 0; i < IQK_MATRIX_REG_NUM; i++) - rtlphy->iqk_matrix[0].value[0][i] = result[final][i]; - rtlphy->iqk_matrix[0].iqk_done = true; - } - save_adda_reg(hw, iqk_bb_reg, rtlphy->iqk_bb_backup, 9); -} - -void rtl88e_phy_lc_calibrate(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); - bool start_conttx = false, singletone = false; - u32 timeout = 2000, timecount = 0; - - if (start_conttx || singletone) - return; - - while (rtlpriv->mac80211.act_scanning && timecount < timeout) { - udelay(50); - timecount += 50; - } - - rtlphy->lck_inprogress = true; - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "LCK:Start!!! currentband %x delay %d ms\n", - rtlhal->current_bandtype, timecount); - - _rtl88e_phy_lc_calibrate(hw, false); - - rtlphy->lck_inprogress = false; -} - -void rtl88e_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain) -{ - rfpath_switch(hw, bmain, false); -} - -bool rtl88e_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - bool postprocessing = false; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "-->IO Cmd(%#x), set_io_inprogress(%d)\n", - iotype, rtlphy->set_io_inprogress); - do { - switch (iotype) { - case IO_CMD_RESUME_DM_BY_SCAN: - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "[IO CMD] Resume DM after scan.\n"); - postprocessing = true; - break; - case IO_CMD_PAUSE_DM_BY_SCAN: - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "[IO CMD] Pause DM before scan.\n"); - postprocessing = true; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - } while (false); - if (postprocessing && !rtlphy->set_io_inprogress) { - rtlphy->set_io_inprogress = true; - rtlphy->current_io_type = iotype; - } else { - return false; - } - rtl88e_phy_set_io(hw); - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, "IO Type(%#x)\n", iotype); - return true; -} - -static void rtl88ee_phy_set_rf_on(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x2b); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); - /*rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x00);*/ - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); -} - -static void _rtl88ee_phy_set_rf_sleep(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int jj = RF90_PATH_A; - - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF); - rtl_set_rfreg(hw, jj, 0x00, RFREG_OFFSET_MASK, 0x00); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x22); -} - -static bool _rtl88ee_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl8192_tx_ring *ring = NULL; - bool bresult = true; - u8 i, queue_id; - - switch (rfpwr_state) { - case ERFON:{ - if ((ppsc->rfpwr_state == ERFOFF) && - RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) { - bool rtstatus; - u32 init = 0; - do { - init++; - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "IPS Set eRf nic enable\n"); - rtstatus = rtl_ps_enable_nic(hw); - } while ((rtstatus != true) && (init < 10)); - RT_CLEAR_PS_LEVEL(ppsc, - RT_RF_OFF_LEVL_HALT_NIC); - } else { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "Set ERFON sleeped:%d ms\n", - jiffies_to_msecs(jiffies - ppsc-> - last_sleep_jiffies)); - ppsc->last_awake_jiffies = jiffies; - rtl88ee_phy_set_rf_on(hw); - } - if (mac->link_state == MAC80211_LINKED) - rtlpriv->cfg->ops->led_control(hw, LED_CTL_LINK); - else - rtlpriv->cfg->ops->led_control(hw, LED_CTL_NO_LINK); - break; } - case ERFOFF:{ - for (queue_id = 0, i = 0; - queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { - ring = &pcipriv->dev.tx_ring[queue_id]; - if (skb_queue_len(&ring->queue) == 0) { - queue_id++; - continue; - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n", - (i + 1), queue_id, - skb_queue_len(&ring->queue)); - - udelay(10); - i++; - } - if (i >= MAX_DOZE_WAITING_TIMES_9x) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "\n ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n", - MAX_DOZE_WAITING_TIMES_9x, - queue_id, - skb_queue_len(&ring->queue)); - break; - } - } - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "IPS Set eRf nic disable\n"); - rtl_ps_disable_nic(hw); - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - } else { - if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) { - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_NO_LINK); - } else { - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_POWER_OFF); - } - } - break; } - case ERFSLEEP:{ - if (ppsc->rfpwr_state == ERFOFF) - break; - for (queue_id = 0, i = 0; - queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { - ring = &pcipriv->dev.tx_ring[queue_id]; - if (skb_queue_len(&ring->queue) == 0) { - queue_id++; - continue; - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n", - (i + 1), queue_id, - skb_queue_len(&ring->queue)); - - udelay(10); - i++; - } - if (i >= MAX_DOZE_WAITING_TIMES_9x) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "\n ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n", - MAX_DOZE_WAITING_TIMES_9x, - queue_id, - skb_queue_len(&ring->queue)); - break; - } - } - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "Set ERFSLEEP awaked:%d ms\n", - jiffies_to_msecs(jiffies - ppsc->last_awake_jiffies)); - ppsc->last_sleep_jiffies = jiffies; - _rtl88ee_phy_set_rf_sleep(hw); - break; } - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - bresult = false; - break; - } - if (bresult) - ppsc->rfpwr_state = rfpwr_state; - return bresult; -} - -bool rtl88e_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state) -{ - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool bresult; - - if (rfpwr_state == ppsc->rfpwr_state) - return false; - bresult = _rtl88ee_phy_set_rf_power_state(hw, rfpwr_state); - return bresult; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/phy.h b/drivers/net/wireless/rtlwifi/rtl8188ee/phy.h deleted file mode 100644 index f1acd6d27e44..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/phy.h +++ /dev/null @@ -1,236 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C_PHY_H__ -#define __RTL92C_PHY_H__ - -/*It must always set to 4, otherwise read efuse table secquence will be wrong.*/ -#define MAX_TX_COUNT 4 - -#define MAX_PRECMD_CNT 16 -#define MAX_RFDEPENDCMD_CNT 16 -#define MAX_POSTCMD_CNT 16 - -#define MAX_DOZE_WAITING_TIMES_9x 64 - -#define RT_CANNOT_IO(hw) false -#define HIGHPOWER_RADIOA_ARRAYLEN 22 - -#define IQK_ADDA_REG_NUM 16 -#define IQK_BB_REG_NUM 9 -#define MAX_TOLERANCE 5 -#define IQK_DELAY_TIME 10 -#define IDX_MAP 15 - -#define APK_BB_REG_NUM 5 -#define APK_AFE_REG_NUM 16 -#define APK_CURVE_REG_NUM 4 -#define PATH_NUM 2 - -#define LOOP_LIMIT 5 -#define MAX_STALL_TIME 50 -#define ANTENNADIVERSITYVALUE 0x80 -#define MAX_TXPWR_IDX_NMODE_92S 63 -#define RESET_CNT_LIMIT 3 - -#define IQK_ADDA_REG_NUM 16 -#define IQK_MAC_REG_NUM 4 - -#define RF6052_MAX_PATH 2 - -#define CT_OFFSET_MAC_ADDR 0X16 - -#define CT_OFFSET_CCK_TX_PWR_IDX 0x5A -#define CT_OFFSET_HT401S_TX_PWR_IDX 0x60 -#define CT_OFFSET_HT402S_TX_PWR_IDX_DIFF 0x66 -#define CT_OFFSET_HT20_TX_PWR_IDX_DIFF 0x69 -#define CT_OFFSET_OFDM_TX_PWR_IDX_DIFF 0x6C - -#define CT_OFFSET_HT40_MAX_PWR_OFFSET 0x6F -#define CT_OFFSET_HT20_MAX_PWR_OFFSET 0x72 - -#define CT_OFFSET_CHANNEL_PLAH 0x75 -#define CT_OFFSET_THERMAL_METER 0x78 -#define CT_OFFSET_RF_OPTION 0x79 -#define CT_OFFSET_VERSION 0x7E -#define CT_OFFSET_CUSTOMER_ID 0x7F - -#define RTL92C_MAX_PATH_NUM 2 - -enum swchnlcmd_id { - CMDID_END, - CMDID_SET_TXPOWEROWER_LEVEL, - CMDID_BBREGWRITE10, - CMDID_WRITEPORT_ULONG, - CMDID_WRITEPORT_USHORT, - CMDID_WRITEPORT_UCHAR, - CMDID_RF_WRITEREG, -}; - -struct swchnlcmd { - enum swchnlcmd_id cmdid; - u32 para1; - u32 para2; - u32 msdelay; -}; - -enum hw90_block_e { - HW90_BLOCK_MAC = 0, - HW90_BLOCK_PHY0 = 1, - HW90_BLOCK_PHY1 = 2, - HW90_BLOCK_RF = 3, - HW90_BLOCK_MAXIMUM = 4, -}; - -enum baseband_config_type { - BASEBAND_CONFIG_PHY_REG = 0, - BASEBAND_CONFIG_AGC_TAB = 1, -}; - -enum ra_offset_area { - RA_OFFSET_LEGACY_OFDM1, - RA_OFFSET_LEGACY_OFDM2, - RA_OFFSET_HT_OFDM1, - RA_OFFSET_HT_OFDM2, - RA_OFFSET_HT_OFDM3, - RA_OFFSET_HT_OFDM4, - RA_OFFSET_HT_CCK, -}; - -enum antenna_path { - ANTENNA_NONE, - ANTENNA_D, - ANTENNA_C, - ANTENNA_CD, - ANTENNA_B, - ANTENNA_BD, - ANTENNA_BC, - ANTENNA_BCD, - ANTENNA_A, - ANTENNA_AD, - ANTENNA_AC, - ANTENNA_ACD, - ANTENNA_AB, - ANTENNA_ABD, - ANTENNA_ABC, - ANTENNA_ABCD -}; - -struct r_antenna_select_ofdm { - u32 r_tx_antenna:4; - u32 r_ant_l:4; - u32 r_ant_non_ht:4; - u32 r_ant_ht1:4; - u32 r_ant_ht2:4; - u32 r_ant_ht_s1:4; - u32 r_ant_non_ht_s1:4; - u32 ofdm_txsc:2; - u32 reserved:2; -}; - -struct r_antenna_select_cck { - u8 r_cckrx_enable_2:2; - u8 r_cckrx_enable:2; - u8 r_ccktx_enable:4; -}; - - -struct efuse_contents { - u8 mac_addr[ETH_ALEN]; - u8 cck_tx_power_idx[6]; - u8 ht40_1s_tx_power_idx[6]; - u8 ht40_2s_tx_power_idx_diff[3]; - u8 ht20_tx_power_idx_diff[3]; - u8 ofdm_tx_power_idx_diff[3]; - u8 ht40_max_power_offset[3]; - u8 ht20_max_power_offset[3]; - u8 channel_plan; - u8 thermal_meter; - u8 rf_option[5]; - u8 version; - u8 oem_id; - u8 regulatory; -}; - -struct tx_power_struct { - u8 cck[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht40_1s[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht40_2s[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht20_diff[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 legacy_ht_diff[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 legacy_ht_txpowerdiff; - u8 groupht20[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 groupht40[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 pwrgroup_cnt; - u32 mcs_original_offset[4][16]; -}; - -enum _ANT_DIV_TYPE { - NO_ANTDIV = 0xFF, - CG_TRX_HW_ANTDIV = 0x01, - CGCS_RX_HW_ANTDIV = 0x02, - FIXED_HW_ANTDIV = 0x03, - CG_TRX_SMART_ANTDIV = 0x04, - CGCS_RX_SW_ANTDIV = 0x05, -}; - -extern u32 rtl88e_phy_query_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask); -extern void rtl88e_phy_set_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, u32 data); -extern u32 rtl88e_phy_query_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, - u32 bitmask); -extern void rtl88e_phy_set_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, - u32 bitmask, u32 data); -extern bool rtl88e_phy_mac_config(struct ieee80211_hw *hw); -extern bool rtl88e_phy_bb_config(struct ieee80211_hw *hw); -extern bool rtl88e_phy_rf_config(struct ieee80211_hw *hw); -extern void rtl88e_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); -extern void rtl88e_phy_get_txpower_level(struct ieee80211_hw *hw, - long *powerlevel); -extern void rtl88e_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); -extern void rtl88e_phy_scan_operation_backup(struct ieee80211_hw *hw, - u8 operation); -extern void rtl88e_phy_set_bw_mode_callback(struct ieee80211_hw *hw); -extern void rtl88e_phy_set_bw_mode(struct ieee80211_hw *hw, - enum nl80211_channel_type ch_type); -extern void rtl88e_phy_sw_chnl_callback(struct ieee80211_hw *hw); -extern u8 rtl88e_phy_sw_chnl(struct ieee80211_hw *hw); -extern void rtl88e_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); -void rtl88e_phy_lc_calibrate(struct ieee80211_hw *hw); -void rtl88e_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); -bool rtl88e_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, - enum radio_path rfpath); -bool rtl88e_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); -extern bool rtl88e_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseq.c b/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseq.c deleted file mode 100644 index 6dc4e3a954f6..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseq.c +++ /dev/null @@ -1,109 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "pwrseqcmd.h" -#include "pwrseq.h" - -/* drivers should parse below arrays and do the corresponding actions */ -/*3 Power on Array*/ -struct wlan_pwr_cfg rtl8188e_power_on_flow[RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS + - RTL8188E_TRANS_END_STEPS] = { - RTL8188E_TRANS_CARDEMU_TO_ACT - RTL8188E_TRANS_END -}; - -/*3Radio off GPIO Array */ -struct wlan_pwr_cfg rtl8188e_radio_off_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS - + RTL8188E_TRANS_END_STEPS] = { - RTL8188E_TRANS_ACT_TO_CARDEMU - RTL8188E_TRANS_END -}; - -/*3Card Disable Array*/ -struct wlan_pwr_cfg rtl8188e_card_disable_flow - [RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + - RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS + - RTL8188E_TRANS_END_STEPS] = { - RTL8188E_TRANS_ACT_TO_CARDEMU - RTL8188E_TRANS_CARDEMU_TO_CARDDIS - RTL8188E_TRANS_END -}; - -/*3 Card Enable Array*/ -struct wlan_pwr_cfg rtl8188e_card_enable_flow - [RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + - RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS + - RTL8188E_TRANS_END_STEPS] = { - RTL8188E_TRANS_CARDDIS_TO_CARDEMU - RTL8188E_TRANS_CARDEMU_TO_ACT - RTL8188E_TRANS_END -}; - -/*3Suspend Array*/ -struct wlan_pwr_cfg rtl8188e_suspend_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS - + RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS - + RTL8188E_TRANS_END_STEPS] = { - RTL8188E_TRANS_ACT_TO_CARDEMU - RTL8188E_TRANS_CARDEMU_TO_SUS - RTL8188E_TRANS_END -}; - -/*3 Resume Array*/ -struct wlan_pwr_cfg rtl8188e_resume_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS - + RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS - + RTL8188E_TRANS_END_STEPS] = { - RTL8188E_TRANS_SUS_TO_CARDEMU - RTL8188E_TRANS_CARDEMU_TO_ACT - RTL8188E_TRANS_END -}; - -/*3HWPDN Array*/ -struct wlan_pwr_cfg rtl8188e_hwpdn_flow[RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS - + RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS - + RTL8188E_TRANS_END_STEPS] = { - RTL8188E_TRANS_ACT_TO_CARDEMU - RTL8188E_TRANS_CARDEMU_TO_PDN - RTL8188E_TRANS_END -}; - -/*3 Enter LPS */ -struct wlan_pwr_cfg rtl8188e_enter_lps_flow[RTL8188E_TRANS_ACT_TO_LPS_STEPS - + RTL8188E_TRANS_END_STEPS] = { - /*FW behavior*/ - RTL8188E_TRANS_ACT_TO_LPS - RTL8188E_TRANS_END -}; - -/*3 Leave LPS */ -struct wlan_pwr_cfg rtl8188e_leave_lps_flow[RTL8188E_TRANS_LPS_TO_ACT_STEPS - + RTL8188E_TRANS_END_STEPS] = { - /*FW behavior*/ - RTL8188E_TRANS_LPS_TO_ACT - RTL8188E_TRANS_END -}; diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseq.h b/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseq.h deleted file mode 100644 index 028ec6dd52b4..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseq.h +++ /dev/null @@ -1,327 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL8723E_PWRSEQ_H__ -#define __RTL8723E_PWRSEQ_H__ - -#include "pwrseqcmd.h" -/* - Check document WM-20110607-Paul-RTL8188E_Power_Architecture-R02.vsd - There are 6 HW Power States: - 0: POFF--Power Off - 1: PDN--Power Down - 2: CARDEMU--Card Emulation - 3: ACT--Active Mode - 4: LPS--Low Power State - 5: SUS--Suspend - - The transision from different states are defined below - TRANS_CARDEMU_TO_ACT - TRANS_ACT_TO_CARDEMU - TRANS_CARDEMU_TO_SUS - TRANS_SUS_TO_CARDEMU - TRANS_CARDEMU_TO_PDN - TRANS_ACT_TO_LPS - TRANS_LPS_TO_ACT - - TRANS_END - PWR SEQ Version: rtl8188e_PwrSeq_V09.h -*/ - -#define RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS 10 -#define RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS 10 -#define RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS 10 -#define RTL8188E_TRANS_SUS_TO_CARDEMU_STEPS 10 -#define RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS 10 -#define RTL8188E_TRANS_PDN_TO_CARDEMU_STEPS 10 -#define RTL8188E_TRANS_ACT_TO_LPS_STEPS 15 -#define RTL8188E_TRANS_LPS_TO_ACT_STEPS 15 -#define RTL8188E_TRANS_END_STEPS 1 - - -#define RTL8188E_TRANS_CARDEMU_TO_ACT \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value },*/\ - {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /* wait till 0x04[17] = 1 power ready*/ \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(1), BIT(1)}, \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /* 0x02[1:0] = 0 reset BB*/ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0)|BIT(1), 0}, \ - {0x0026, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*0x24[23] = 2b'01 schmit trigger */ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), BIT(7)}, \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /* 0x04[15] = 0 disable HWPDN (control by DRV)*/ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), 0}, \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*0x04[12:11] = 2b'00 disable WL suspend*/ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4)|BIT(3), 0}, \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*0x04[8] = 1 polling until return 0*/ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), BIT(0)}, \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*wait till 0x04[8] = 0*/ \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(0), 0}, \ - {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), 0}, /*LDO normal mode*/\ - {0x0074, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), BIT(4)}, /*SDIO Driving*/\ - -#define RTL8188E_TRANS_ACT_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value },*/\ - {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/\ - {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), BIT(4)}, /*LDO Sleep mode*/\ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*0x04[9] = 1 turn off MAC by HW state machine*/ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), BIT(1)}, \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(1), 0}, \ - - -#define RTL8188E_TRANS_CARDEMU_TO_SUS \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value },*/\ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \ - PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK, \ - /*0x04[12:11] = 2b'01enable WL suspend*/ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), BIT(3)}, \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, \ - /*0x04[12:11] = 2b'11enable WL suspend for PCIe*/ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), BIT(3)|BIT(4)},\ - {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \ - PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK, \ - /* 0x04[31:30] = 2b'10 enable enable bandgap mbias in suspend */\ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, BIT(7)}, \ - {0x0041, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \ - PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK, \ - /*Clear SIC_EN register 0x40[12] = 1'b0 */ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), 0}, \ - {0xfe10, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \ - PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK, \ - /*Set USB suspend enable local register 0xfe10[4]= 1 */ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), BIT(4)}, \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - /*Set SDIO suspend local register*/ \ - PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT(0), BIT(0)}, \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - /*wait power state to suspend*/ \ - PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT(1), 0}, - -#define RTL8188E_TRANS_SUS_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - /*Set SDIO suspend local register*/ \ - PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT(0), 0}, \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - /*wait power state to suspend*/ \ - PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT(1), BIT(1)}, \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*0x04[12:11] = 2b'01enable WL suspend*/ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), 0}, - -#define RTL8188E_TRANS_CARDEMU_TO_CARDDIS \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\ - {0x0026, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*0x24[23] = 2b'01 schmit trigger */ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), BIT(7)}, \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \ - PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK, \ - /*0x04[12:11] = 2b'01 enable WL suspend*/ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), BIT(3)}, \ - {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \ - PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK, \ - /* 0x04[31:30] = 2b'10 enable enable bandgap mbias in suspend */\ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0}, \ - {0x0041, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \ - PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK, \ - /*Clear SIC_EN register 0x40[12] = 1'b0 */ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), 0}, \ - {0xfe10, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, \ - /*Set USB suspend enable local register 0xfe10[4]= 1 */ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), BIT(4)}, \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - /*Set SDIO suspend local register*/ \ - PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT(0), BIT(0)}, \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - PWR_CMD_POLLING, BIT(1), 0}, /*wait power state to suspend*/ - -#define RTL8188E_TRANS_CARDDIS_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_SDIO,\ - PWR_CMD_WRITE, BIT(0), 0}, /*Set SDIO suspend local register*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_SDIO,\ - PWR_CMD_POLLING, BIT(1), BIT(1)}, /*wait power state to suspend*/\ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, \ - PWR_CMD_WRITE, BIT(3)|BIT(4), 0}, \ - /*0x04[12:11] = 2b'01enable WL suspend*/ - - -#define RTL8188E_TRANS_CARDEMU_TO_PDN \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\ - {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), 0},/* 0x04[16] = 0*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), BIT(7)},/* 0x04[15] = 1*/ - - -#define RTL8188E_TRANS_PDN_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), 0},/* 0x04[15] = 0*/ - - -#define RTL8188E_TRANS_ACT_TO_LPS \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value },*/\ - {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x7F},/*Tx Pause*/ \ - {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*zero if no pkt is tx*/\ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0}, \ - {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*Should be zero if no packet is transmitting*/ \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0}, \ - {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*Should be zero if no packet is transmitting*/ \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0}, \ - {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*Should be zero if no packet is transmitting*/ \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0}, \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*CCK and OFDM are disabled, and clock are gated*/ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), 0}, \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/\ - {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x3F},/*Reset MAC TRX*/ \ - {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*check if removed later*/ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), 0}, \ - {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*Respond TxOK to scheduler*/ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(5), BIT(5)}, \ - - -#define RTL8188E_TRANS_LPS_TO_ACT \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\ - {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_SDIO, PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/ \ - {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/ \ - {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x84}, /*PCIe RPWM*/ \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/ \ - {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*. 0x08[4] = 0 switch TSF to 40M*/ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), 0}, \ - {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*Polling 0x109[7]= 0 TSF in 40M*/ \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(7), 0}, \ - {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*. 0x29[7:6] = 2b'00 enable BB clock*/ \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(6)|BIT(7), 0}, \ - {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*. 0x101[1] = 1*/\ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), BIT(1)}, \ - {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF}, \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - /*. 0x02[1:0] = 2b'11 enable BB macro*/\ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1)|BIT(0), BIT(1)|BIT(0)}, \ - {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/ - - -#define RTL8188E_TRANS_END \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value },*/\ - {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,\ - 0, PWR_CMD_END, 0, 0} - -extern struct wlan_pwr_cfg rtl8188e_power_on_flow - [RTL8188E_TRANS_CARDEMU_TO_ACT_STEPS + - RTL8188E_TRANS_END_STEPS]; -extern struct wlan_pwr_cfg rtl8188e_radio_off_flow - [RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + - RTL8188E_TRANS_END_STEPS]; -extern struct wlan_pwr_cfg rtl8188e_card_disable_flow - [RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + - RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS + - RTL8188E_TRANS_END_STEPS]; -extern struct wlan_pwr_cfg rtl8188e_card_enable_flow - [RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + - RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS + - RTL8188E_TRANS_END_STEPS]; -extern struct wlan_pwr_cfg rtl8188e_suspend_flow - [RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + - RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS + - RTL8188E_TRANS_END_STEPS]; -extern struct wlan_pwr_cfg rtl8188e_resume_flow - [RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + - RTL8188E_TRANS_CARDEMU_TO_SUS_STEPS + - RTL8188E_TRANS_END_STEPS]; -extern struct wlan_pwr_cfg rtl8188e_hwpdn_flow - [RTL8188E_TRANS_ACT_TO_CARDEMU_STEPS + - RTL8188E_TRANS_CARDEMU_TO_PDN_STEPS + - RTL8188E_TRANS_END_STEPS]; -extern struct wlan_pwr_cfg rtl8188e_enter_lps_flow - [RTL8188E_TRANS_ACT_TO_LPS_STEPS + - RTL8188E_TRANS_END_STEPS]; -extern struct wlan_pwr_cfg rtl8188e_leave_lps_flow - [RTL8188E_TRANS_LPS_TO_ACT_STEPS + - RTL8188E_TRANS_END_STEPS]; - -/* RTL8723 Power Configuration CMDs for PCIe interface */ -#define Rtl8188E_NIC_PWR_ON_FLOW rtl8188e_power_on_flow -#define Rtl8188E_NIC_RF_OFF_FLOW rtl8188e_radio_off_flow -#define Rtl8188E_NIC_DISABLE_FLOW rtl8188e_card_disable_flow -#define Rtl8188E_NIC_ENABLE_FLOW rtl8188e_card_enable_flow -#define Rtl8188E_NIC_SUSPEND_FLOW rtl8188e_suspend_flow -#define Rtl8188E_NIC_RESUME_FLOW rtl8188e_resume_flow -#define Rtl8188E_NIC_PDN_FLOW rtl8188e_hwpdn_flow -#define Rtl8188E_NIC_LPS_ENTER_FLOW rtl8188e_enter_lps_flow -#define Rtl8188E_NIC_LPS_LEAVE_FLOW rtl8188e_leave_lps_flow - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.c b/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.c deleted file mode 100644 index a9cfa13be3a8..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.c +++ /dev/null @@ -1,140 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "pwrseq.h" - - -/* Description: - * This routine deal with the Power Configuration CMDs - * parsing for RTL8723/RTL8188E Series IC. - * Assumption: - * We should follow specific format which was released from HW SD. - * - * 2011.07.07, added by Roger. - */ - -bool rtl88_hal_pwrseqcmdparsing(struct rtl_priv *rtlpriv, u8 cut_version, - u8 fab_version, u8 interface_type, - struct wlan_pwr_cfg pwrcfgcmd[]) -{ - struct wlan_pwr_cfg cmd = {0}; - bool polling_bit = false; - u32 ary_idx = 0; - u8 val = 0; - u32 offset = 0; - u32 polling_count = 0; - u32 max_polling_cnt = 5000; - - do { - cmd = pwrcfgcmd[ary_idx]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "rtl88_hal_pwrseqcmdparsing(): offset(%#x), cut_msk(%#x), fab_msk(%#x)," - "interface_msk(%#x), base(%#x), cmd(%#x), msk(%#x), val(%#x)\n", - GET_PWR_CFG_OFFSET(cmd), - GET_PWR_CFG_CUT_MASK(cmd), - GET_PWR_CFG_FAB_MASK(cmd), - GET_PWR_CFG_INTF_MASK(cmd), - GET_PWR_CFG_BASE(cmd), - GET_PWR_CFG_CMD(cmd), - GET_PWR_CFG_MASK(cmd), - GET_PWR_CFG_VALUE(cmd)); - - if ((GET_PWR_CFG_FAB_MASK(cmd) & fab_version) && - (GET_PWR_CFG_CUT_MASK(cmd) & cut_version) && - (GET_PWR_CFG_INTF_MASK(cmd) & interface_type)) { - switch (GET_PWR_CFG_CMD(cmd)) { - case PWR_CMD_READ: - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "rtl88_hal_pwrseqcmdparsing(): PWR_CMD_READ\n"); - break; - case PWR_CMD_WRITE: { - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "rtl88_hal_pwrseqcmdparsing(): PWR_CMD_WRITE\n"); - offset = GET_PWR_CFG_OFFSET(cmd); - - /*Read the val from system register*/ - val = rtl_read_byte(rtlpriv, offset); - val &= (~(GET_PWR_CFG_MASK(cmd))); - val |= (GET_PWR_CFG_VALUE(cmd) & - GET_PWR_CFG_MASK(cmd)); - - /*Write the val back to sytem register*/ - rtl_write_byte(rtlpriv, offset, val); - } - break; - case PWR_CMD_POLLING: - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "rtl88_hal_pwrseqcmdparsing(): PWR_CMD_POLLING\n"); - polling_bit = false; - offset = GET_PWR_CFG_OFFSET(cmd); - - do { - val = rtl_read_byte(rtlpriv, offset); - - val = val & GET_PWR_CFG_MASK(cmd); - if (val == (GET_PWR_CFG_VALUE(cmd) & - GET_PWR_CFG_MASK(cmd))) - polling_bit = true; - else - udelay(10); - - if (polling_count++ > max_polling_cnt) { - RT_TRACE(rtlpriv, COMP_INIT, - DBG_LOUD, - "polling fail in pwrseqcmd\n"); - return false; - } - } while (!polling_bit); - - break; - case PWR_CMD_DELAY: - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "rtl88_hal_pwrseqcmdparsing(): PWR_CMD_DELAY\n"); - if (GET_PWR_CFG_VALUE(cmd) == PWRSEQ_DELAY_US) - udelay(GET_PWR_CFG_OFFSET(cmd)); - else - mdelay(GET_PWR_CFG_OFFSET(cmd)); - break; - case PWR_CMD_END: - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "rtl88_hal_pwrseqcmdparsing(): PWR_CMD_END\n"); - return true; - break; - default: - RT_ASSERT(false, - "rtl88_hal_pwrseqcmdparsing(): Unknown CMD!!\n"); - break; - } - } - - ary_idx++; - } while (1); - - return true; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.h b/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.h deleted file mode 100644 index d9ae280bb1a2..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.h +++ /dev/null @@ -1,97 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL8723E_PWRSEQCMD_H__ -#define __RTL8723E_PWRSEQCMD_H__ - -#include "../wifi.h" -/*---------------------------------------------*/ -/* The value of cmd: 4 bits */ -/*---------------------------------------------*/ -#define PWR_CMD_READ 0x00 -#define PWR_CMD_WRITE 0x01 -#define PWR_CMD_POLLING 0x02 -#define PWR_CMD_DELAY 0x03 -#define PWR_CMD_END 0x04 - -/* define the base address of each block */ -#define PWR_BASEADDR_MAC 0x00 -#define PWR_BASEADDR_USB 0x01 -#define PWR_BASEADDR_PCIE 0x02 -#define PWR_BASEADDR_SDIO 0x03 - -#define PWR_INTF_SDIO_MSK BIT(0) -#define PWR_INTF_USB_MSK BIT(1) -#define PWR_INTF_PCI_MSK BIT(2) -#define PWR_INTF_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3)) - -#define PWR_FAB_TSMC_MSK BIT(0) -#define PWR_FAB_UMC_MSK BIT(1) -#define PWR_FAB_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3)) - -#define PWR_CUT_TESTCHIP_MSK BIT(0) -#define PWR_CUT_A_MSK BIT(1) -#define PWR_CUT_B_MSK BIT(2) -#define PWR_CUT_C_MSK BIT(3) -#define PWR_CUT_D_MSK BIT(4) -#define PWR_CUT_E_MSK BIT(5) -#define PWR_CUT_F_MSK BIT(6) -#define PWR_CUT_G_MSK BIT(7) -#define PWR_CUT_ALL_MSK 0xFF - -enum pwrseq_delay_unit { - PWRSEQ_DELAY_US, - PWRSEQ_DELAY_MS, -}; - -struct wlan_pwr_cfg { - u16 offset; - u8 cut_msk; - u8 fab_msk:4; - u8 interface_msk:4; - u8 base:4; - u8 cmd:4; - u8 msk; - u8 value; -}; - -#define GET_PWR_CFG_OFFSET(__PWR) (__PWR.offset) -#define GET_PWR_CFG_CUT_MASK(__PWR) (__PWR.cut_msk) -#define GET_PWR_CFG_FAB_MASK(__PWR) (__PWR.fab_msk) -#define GET_PWR_CFG_INTF_MASK(__PWR) (__PWR.interface_msk) -#define GET_PWR_CFG_BASE(__PWR) (__PWR.base) -#define GET_PWR_CFG_CMD(__PWR) (__PWR.cmd) -#define GET_PWR_CFG_MASK(__PWR) (__PWR.msk) -#define GET_PWR_CFG_VALUE(__PWR) (__PWR.value) - -bool rtl88_hal_pwrseqcmdparsing(struct rtl_priv *rtlpriv, u8 cut_version, - u8 fab_version, u8 interface_type, - struct wlan_pwr_cfg pwrcfgcmd[]); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/reg.h b/drivers/net/wireless/rtlwifi/rtl8188ee/reg.h deleted file mode 100644 index d849abf7d94a..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/reg.h +++ /dev/null @@ -1,2258 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C_REG_H__ -#define __RTL92C_REG_H__ - -#define TXPKT_BUF_SELECT 0x69 -#define RXPKT_BUF_SELECT 0xA5 -#define DISABLE_TRXPKT_BUF_ACCESS 0x0 - -#define REG_SYS_ISO_CTRL 0x0000 -#define REG_SYS_FUNC_EN 0x0002 -#define REG_APS_FSMCO 0x0004 -#define REG_SYS_CLKR 0x0008 -#define REG_9346CR 0x000A -#define REG_EE_VPD 0x000C -#define REG_AFE_MISC 0x0010 -#define REG_SPS0_CTRL 0x0011 -#define REG_SPS_OCP_CFG 0x0018 -#define REG_RSV_CTRL 0x001C -#define REG_RF_CTRL 0x001F -#define REG_LDOA15_CTRL 0x0020 -#define REG_LDOV12D_CTRL 0x0021 -#define REG_LDOHCI12_CTRL 0x0022 -#define REG_LPLDO_CTRL 0x0023 -#define REG_AFE_XTAL_CTRL 0x0024 -#define REG_AFE_LDO_CTRL 0x0027 /* 1.5v for 8188EE test - * chip, 1.4v for MP chip - */ -#define REG_AFE_PLL_CTRL 0x0028 -#define REG_EFUSE_CTRL 0x0030 -#define REG_EFUSE_TEST 0x0034 -#define REG_PWR_DATA 0x0038 -#define REG_CAL_TIMER 0x003C -#define REG_ACLK_MON 0x003E -#define REG_GPIO_MUXCFG 0x0040 -#define REG_GPIO_IO_SEL 0x0042 -#define REG_MAC_PINMUX_CFG 0x0043 -#define REG_GPIO_PIN_CTRL 0x0044 -#define REG_GPIO_INTM 0x0048 -#define REG_LEDCFG0 0x004C -#define REG_LEDCFG1 0x004D -#define REG_LEDCFG2 0x004E -#define REG_LEDCFG3 0x004F -#define REG_FSIMR 0x0050 -#define REG_FSISR 0x0054 -#define REG_HSIMR 0x0058 -#define REG_HSISR 0x005c -#define REG_GPIO_PIN_CTRL_2 0x0060 -#define REG_GPIO_IO_SEL_2 0x0062 -#define REG_GPIO_OUTPUT 0x006c -#define REG_AFE_XTAL_CTRL_EXT 0x0078 -#define REG_XCK_OUT_CTRL 0x007c -#define REG_MCUFWDL 0x0080 -#define REG_WOL_EVENT 0x0081 -#define REG_MCUTSTCFG 0x0084 - - -#define REG_HIMR 0x00B0 -#define REG_HISR 0x00B4 -#define REG_HIMRE 0x00B8 -#define REG_HISRE 0x00BC - -#define REG_EFUSE_ACCESS 0x00CF - -#define REG_BIST_SCAN 0x00D0 -#define REG_BIST_RPT 0x00D4 -#define REG_BIST_ROM_RPT 0x00D8 -#define REG_USB_SIE_INTF 0x00E0 -#define REG_PCIE_MIO_INTF 0x00E4 -#define REG_PCIE_MIO_INTD 0x00E8 -#define REG_HPON_FSM 0x00EC -#define REG_SYS_CFG 0x00F0 - -#define REG_CR 0x0100 -#define REG_PBP 0x0104 -#define REG_PKT_BUFF_ACCESS_CTRL 0x0106 -#define REG_TRXDMA_CTRL 0x010C -#define REG_TRXFF_BNDY 0x0114 -#define REG_TRXFF_STATUS 0x0118 -#define REG_RXFF_PTR 0x011C - -#define REG_CPWM 0x012F -#define REG_FWIMR 0x0130 -#define REG_FWISR 0x0134 -#define REG_PKTBUF_DBG_CTRL 0x0140 -#define REG_PKTBUF_DBG_DATA_L 0x0144 -#define REG_PKTBUF_DBG_DATA_H 0x0148 -#define REG_RXPKTBUF_CTRL (REG_PKTBUF_DBG_CTRL+2) - -#define REG_TC0_CTRL 0x0150 -#define REG_TC1_CTRL 0x0154 -#define REG_TC2_CTRL 0x0158 -#define REG_TC3_CTRL 0x015C -#define REG_TC4_CTRL 0x0160 -#define REG_TCUNIT_BASE 0x0164 -#define REG_MBIST_START 0x0174 -#define REG_MBIST_DONE 0x0178 -#define REG_MBIST_FAIL 0x017C -#define REG_32K_CTRL 0x0194 -#define REG_C2HEVT_MSG_NORMAL 0x01A0 -#define REG_C2HEVT_CLEAR 0x01AF -#define REG_C2HEVT_MSG_TEST 0x01B8 -#define REG_MCUTST_1 0x01c0 -#define REG_FMETHR 0x01C8 -#define REG_HMETFR 0x01CC -#define REG_HMEBOX_0 0x01D0 -#define REG_HMEBOX_1 0x01D4 -#define REG_HMEBOX_2 0x01D8 -#define REG_HMEBOX_3 0x01DC - -#define REG_LLT_INIT 0x01E0 -#define REG_BB_ACCEESS_CTRL 0x01E8 -#define REG_BB_ACCESS_DATA 0x01EC - -#define REG_HMEBOX_EXT_0 0x01F0 -#define REG_HMEBOX_EXT_1 0x01F4 -#define REG_HMEBOX_EXT_2 0x01F8 -#define REG_HMEBOX_EXT_3 0x01FC - -#define REG_RQPN 0x0200 -#define REG_FIFOPAGE 0x0204 -#define REG_TDECTRL 0x0208 -#define REG_TXDMA_OFFSET_CHK 0x020C -#define REG_TXDMA_STATUS 0x0210 -#define REG_RQPN_NPQ 0x0214 - -#define REG_RXDMA_AGG_PG_TH 0x0280 -#define REG_FW_UPD_RDPTR 0x0284 /* FW shall update this - * register before FW * write - * RXPKT_RELEASE_POLL to 1 - */ -#define REG_RXDMA_CONTROL 0x0286 /* Control the RX DMA.*/ -#define REG_RXPKT_NUM 0x0287 /* The number of packets - * in RXPKTBUF. - */ -#define REG_PCIE_CTRL_REG 0x0300 -#define REG_INT_MIG 0x0304 -#define REG_BCNQ_DESA 0x0308 -#define REG_HQ_DESA 0x0310 -#define REG_MGQ_DESA 0x0318 -#define REG_VOQ_DESA 0x0320 -#define REG_VIQ_DESA 0x0328 -#define REG_BEQ_DESA 0x0330 -#define REG_BKQ_DESA 0x0338 -#define REG_RX_DESA 0x0340 - -#define REG_DBI 0x0348 -#define REG_MDIO 0x0354 -#define REG_DBG_SEL 0x0360 -#define REG_PCIE_HRPWM 0x0361 -#define REG_PCIE_HCPWM 0x0363 -#define REG_UART_CTRL 0x0364 -#define REG_WATCH_DOG 0x0368 -#define REG_UART_TX_DESA 0x0370 -#define REG_UART_RX_DESA 0x0378 - - -#define REG_HDAQ_DESA_NODEF 0x0000 -#define REG_CMDQ_DESA_NODEF 0x0000 - -#define REG_VOQ_INFORMATION 0x0400 -#define REG_VIQ_INFORMATION 0x0404 -#define REG_BEQ_INFORMATION 0x0408 -#define REG_BKQ_INFORMATION 0x040C -#define REG_MGQ_INFORMATION 0x0410 -#define REG_HGQ_INFORMATION 0x0414 -#define REG_BCNQ_INFORMATION 0x0418 -#define REG_TXPKT_EMPTY 0x041A - - -#define REG_CPU_MGQ_INFORMATION 0x041C -#define REG_FWHW_TXQ_CTRL 0x0420 -#define REG_HWSEQ_CTRL 0x0423 -#define REG_TXPKTBUF_BCNQ_BDNY 0x0424 -#define REG_TXPKTBUF_MGQ_BDNY 0x0425 -#define REG_MULTI_BCNQ_EN 0x0426 -#define REG_MULTI_BCNQ_OFFSET 0x0427 -#define REG_SPEC_SIFS 0x0428 -#define REG_RL 0x042A -#define REG_DARFRC 0x0430 -#define REG_RARFRC 0x0438 -#define REG_RRSR 0x0440 -#define REG_ARFR0 0x0444 -#define REG_ARFR1 0x0448 -#define REG_ARFR2 0x044C -#define REG_ARFR3 0x0450 -#define REG_AGGLEN_LMT 0x0458 -#define REG_AMPDU_MIN_SPACE 0x045C -#define REG_TXPKTBUF_WMAC_LBK_BF_HD 0x045D -#define REG_FAST_EDCA_CTRL 0x0460 -#define REG_RD_RESP_PKT_TH 0x0463 -#define REG_INIRTS_RATE_SEL 0x0480 -#define REG_INIDATA_RATE_SEL 0x0484 -#define REG_POWER_STATUS 0x04A4 -#define REG_POWER_STAGE1 0x04B4 -#define REG_POWER_STAGE2 0x04B8 -#define REG_PKT_LIFE_TIME 0x04C0 -#define REG_STBC_SETTING 0x04C4 -#define REG_PROT_MODE_CTRL 0x04C8 -#define REG_BAR_MODE_CTRL 0x04CC -#define REG_RA_TRY_RATE_AGG_LMT 0x04CF -#define REG_EARLY_MODE_CONTROL 0x04D0 -#define REG_NQOS_SEQ 0x04DC -#define REG_QOS_SEQ 0x04DE -#define REG_NEED_CPU_HANDLE 0x04E0 -#define REG_PKT_LOSE_RPT 0x04E1 -#define REG_PTCL_ERR_STATUS 0x04E2 -#define REG_TX_RPT_CTRL 0x04EC -#define REG_TX_RPT_TIME 0x04F0 -#define REG_DUMMY 0x04FC - -#define REG_EDCA_VO_PARAM 0x0500 -#define REG_EDCA_VI_PARAM 0x0504 -#define REG_EDCA_BE_PARAM 0x0508 -#define REG_EDCA_BK_PARAM 0x050C -#define REG_BCNTCFG 0x0510 -#define REG_PIFS 0x0512 -#define REG_RDG_PIFS 0x0513 -#define REG_SIFS_CTX 0x0514 -#define REG_SIFS_TRX 0x0516 -#define REG_AGGR_BREAK_TIME 0x051A -#define REG_SLOT 0x051B -#define REG_TX_PTCL_CTRL 0x0520 -#define REG_TXPAUSE 0x0522 -#define REG_DIS_TXREQ_CLR 0x0523 -#define REG_RD_CTRL 0x0524 -#define REG_TBTT_PROHIBIT 0x0540 -#define REG_RD_NAV_NXT 0x0544 -#define REG_NAV_PROT_LEN 0x0546 -#define REG_BCN_CTRL 0x0550 -#define REG_USTIME_TSF 0x0551 -#define REG_MBID_NUM 0x0552 -#define REG_DUAL_TSF_RST 0x0553 -#define REG_BCN_INTERVAL 0x0554 -#define REG_MBSSID_BCN_SPACE 0x0554 -#define REG_DRVERLYINT 0x0558 -#define REG_BCNDMATIM 0x0559 -#define REG_ATIMWND 0x055A -#define REG_BCN_MAX_ERR 0x055D -#define REG_RXTSF_OFFSET_CCK 0x055E -#define REG_RXTSF_OFFSET_OFDM 0x055F -#define REG_TSFTR 0x0560 -#define REG_INIT_TSFTR 0x0564 -#define REG_PSTIMER 0x0580 -#define REG_TIMER0 0x0584 -#define REG_TIMER1 0x0588 -#define REG_ACMHWCTRL 0x05C0 -#define REG_ACMRSTCTRL 0x05C1 -#define REG_ACMAVG 0x05C2 -#define REG_VO_ADMTIME 0x05C4 -#define REG_VI_ADMTIME 0x05C6 -#define REG_BE_ADMTIME 0x05C8 -#define REG_EDCA_RANDOM_GEN 0x05CC -#define REG_SCH_TXCMD 0x05D0 - -#define REG_APSD_CTRL 0x0600 -#define REG_BWOPMODE 0x0603 -#define REG_TCR 0x0604 -#define REG_RCR 0x0608 -#define REG_RX_PKT_LIMIT 0x060C -#define REG_RX_DLK_TIME 0x060D -#define REG_RX_DRVINFO_SZ 0x060F - -#define REG_MACID 0x0610 -#define REG_BSSID 0x0618 -#define REG_MAR 0x0620 -#define REG_MBIDCAMCFG 0x0628 - -#define REG_USTIME_EDCA 0x0638 -#define REG_MAC_SPEC_SIFS 0x063A -#define REG_RESP_SIFS_CCK 0x063C -#define REG_RESP_SIFS_OFDM 0x063E -#define REG_ACKTO 0x0640 -#define REG_CTS2TO 0x0641 -#define REG_EIFS 0x0642 - -#define REG_NAV_CTRL 0x0650 -#define REG_BACAMCMD 0x0654 -#define REG_BACAMCONTENT 0x0658 -#define REG_LBDLY 0x0660 -#define REG_FWDLY 0x0661 -#define REG_RXERR_RPT 0x0664 -#define REG_TRXPTCL_CTL 0x0668 - -#define REG_CAMCMD 0x0670 -#define REG_CAMWRITE 0x0674 -#define REG_CAMREAD 0x0678 -#define REG_CAMDBG 0x067C -#define REG_SECCFG 0x0680 - -#define REG_WOW_CTRL 0x0690 -#define REG_PSSTATUS 0x0691 -#define REG_PS_RX_INFO 0x0692 -#define REG_UAPSD_TID 0x0693 -#define REG_LPNAV_CTRL 0x0694 -#define REG_WKFMCAM_NUM 0x0698 -#define REG_WKFMCAM_RWD 0x069C -#define REG_RXFLTMAP0 0x06A0 -#define REG_RXFLTMAP1 0x06A2 -#define REG_RXFLTMAP2 0x06A4 -#define REG_BCN_PSR_RPT 0x06A8 -#define REG_CALB32K_CTRL 0x06AC -#define REG_PKT_MON_CTRL 0x06B4 -#define REG_BT_COEX_TABLE 0x06C0 -#define REG_WMAC_RESP_TXINFO 0x06D8 - -#define REG_USB_INFO 0xFE17 -#define REG_USB_SPECIAL_OPTION 0xFE55 -#define REG_USB_DMA_AGG_TO 0xFE5B -#define REG_USB_AGG_TO 0xFE5C -#define REG_USB_AGG_TH 0xFE5D - -#define REG_TEST_USB_TXQS 0xFE48 -#define REG_TEST_SIE_VID 0xFE60 -#define REG_TEST_SIE_PID 0xFE62 -#define REG_TEST_SIE_OPTIONAL 0xFE64 -#define REG_TEST_SIE_CHIRP_K 0xFE65 -#define REG_TEST_SIE_PHY 0xFE66 -#define REG_TEST_SIE_MAC_ADDR 0xFE70 -#define REG_TEST_SIE_STRING 0xFE80 - -#define REG_NORMAL_SIE_VID 0xFE60 -#define REG_NORMAL_SIE_PID 0xFE62 -#define REG_NORMAL_SIE_OPTIONAL 0xFE64 -#define REG_NORMAL_SIE_EP 0xFE65 -#define REG_NORMAL_SIE_PHY 0xFE68 -#define REG_NORMAL_SIE_MAC_ADDR 0xFE70 -#define REG_NORMAL_SIE_STRING 0xFE80 - -#define CR9346 REG_9346CR -#define MSR (REG_CR + 2) -#define ISR REG_HISR -#define TSFR REG_TSFTR - -#define MACIDR0 REG_MACID -#define MACIDR4 (REG_MACID + 4) - -#define PBP REG_PBP - -#define IDR0 MACIDR0 -#define IDR4 MACIDR4 - -#define UNUSED_REGISTER 0x1BF -#define DCAM UNUSED_REGISTER -#define PSR UNUSED_REGISTER -#define BBADDR UNUSED_REGISTER -#define PHYDATAR UNUSED_REGISTER - -#define INVALID_BBRF_VALUE 0x12345678 - -#define MAX_MSS_DENSITY_2T 0x13 -#define MAX_MSS_DENSITY_1T 0x0A - -#define CMDEEPROM_EN BIT(5) -#define CMDEEPROM_SEL BIT(4) -#define CMD9346CR_9356SEL BIT(4) -#define AUTOLOAD_EEPROM (CMDEEPROM_EN|CMDEEPROM_SEL) -#define AUTOLOAD_EFUSE CMDEEPROM_EN - -#define GPIOSEL_GPIO 0 -#define GPIOSEL_ENBT BIT(5) - -#define GPIO_IN REG_GPIO_PIN_CTRL -#define GPIO_OUT (REG_GPIO_PIN_CTRL+1) -#define GPIO_IO_SEL (REG_GPIO_PIN_CTRL+2) -#define GPIO_MOD (REG_GPIO_PIN_CTRL+3) - -/* 8723/8188E Host System Interrupt Mask Register (offset 0x58, 32 byte) */ -#define HSIMR_GPIO12_0_INT_EN BIT(0) -#define HSIMR_SPS_OCP_INT_EN BIT(5) -#define HSIMR_RON_INT_EN BIT(6) -#define HSIMR_PDN_INT_EN BIT(7) -#define HSIMR_GPIO9_INT_EN BIT(25) - - -/* 8723/8188E Host System Interrupt Status Register (offset 0x5C, 32 byte) */ -#define HSISR_GPIO12_0_INT BIT(0) -#define HSISR_SPS_OCP_INT BIT(5) -#define HSISR_RON_INT_EN BIT(6) -#define HSISR_PDNINT BIT(7) -#define HSISR_GPIO9_INT BIT(25) - -#define MSR_NOLINK 0x00 -#define MSR_ADHOC 0x01 -#define MSR_INFRA 0x02 -#define MSR_AP 0x03 - -#define RRSR_RSC_OFFSET 21 -#define RRSR_SHORT_OFFSET 23 -#define RRSR_RSC_BW_40M 0x600000 -#define RRSR_RSC_UPSUBCHNL 0x400000 -#define RRSR_RSC_LOWSUBCHNL 0x200000 -#define RRSR_SHORT 0x800000 -#define RRSR_1M BIT(0) -#define RRSR_2M BIT(1) -#define RRSR_5_5M BIT(2) -#define RRSR_11M BIT(3) -#define RRSR_6M BIT(4) -#define RRSR_9M BIT(5) -#define RRSR_12M BIT(6) -#define RRSR_18M BIT(7) -#define RRSR_24M BIT(8) -#define RRSR_36M BIT(9) -#define RRSR_48M BIT(10) -#define RRSR_54M BIT(11) -#define RRSR_MCS0 BIT(12) -#define RRSR_MCS1 BIT(13) -#define RRSR_MCS2 BIT(14) -#define RRSR_MCS3 BIT(15) -#define RRSR_MCS4 BIT(16) -#define RRSR_MCS5 BIT(17) -#define RRSR_MCS6 BIT(18) -#define RRSR_MCS7 BIT(19) -#define BRSR_ACKSHORTPMB BIT(23) - -#define RATR_1M 0x00000001 -#define RATR_2M 0x00000002 -#define RATR_55M 0x00000004 -#define RATR_11M 0x00000008 -#define RATR_6M 0x00000010 -#define RATR_9M 0x00000020 -#define RATR_12M 0x00000040 -#define RATR_18M 0x00000080 -#define RATR_24M 0x00000100 -#define RATR_36M 0x00000200 -#define RATR_48M 0x00000400 -#define RATR_54M 0x00000800 -#define RATR_MCS0 0x00001000 -#define RATR_MCS1 0x00002000 -#define RATR_MCS2 0x00004000 -#define RATR_MCS3 0x00008000 -#define RATR_MCS4 0x00010000 -#define RATR_MCS5 0x00020000 -#define RATR_MCS6 0x00040000 -#define RATR_MCS7 0x00080000 -#define RATR_MCS8 0x00100000 -#define RATR_MCS9 0x00200000 -#define RATR_MCS10 0x00400000 -#define RATR_MCS11 0x00800000 -#define RATR_MCS12 0x01000000 -#define RATR_MCS13 0x02000000 -#define RATR_MCS14 0x04000000 -#define RATR_MCS15 0x08000000 - -#define RATE_1M BIT(0) -#define RATE_2M BIT(1) -#define RATE_5_5M BIT(2) -#define RATE_11M BIT(3) -#define RATE_6M BIT(4) -#define RATE_9M BIT(5) -#define RATE_12M BIT(6) -#define RATE_18M BIT(7) -#define RATE_24M BIT(8) -#define RATE_36M BIT(9) -#define RATE_48M BIT(10) -#define RATE_54M BIT(11) -#define RATE_MCS0 BIT(12) -#define RATE_MCS1 BIT(13) -#define RATE_MCS2 BIT(14) -#define RATE_MCS3 BIT(15) -#define RATE_MCS4 BIT(16) -#define RATE_MCS5 BIT(17) -#define RATE_MCS6 BIT(18) -#define RATE_MCS7 BIT(19) -#define RATE_MCS8 BIT(20) -#define RATE_MCS9 BIT(21) -#define RATE_MCS10 BIT(22) -#define RATE_MCS11 BIT(23) -#define RATE_MCS12 BIT(24) -#define RATE_MCS13 BIT(25) -#define RATE_MCS14 BIT(26) -#define RATE_MCS15 BIT(27) - -#define RATE_ALL_CCK (RATR_1M | RATR_2M | RATR_55M | RATR_11M) -#define RATE_ALL_OFDM_AG (RATR_6M | RATR_9M | RATR_12M | RATR_18M | \ - RATR_24M | RATR_36M | RATR_48M | RATR_54M) -#define RATE_ALL_OFDM_1SS (RATR_MCS0 | RATR_MCS1 | RATR_MCS2 | \ - RATR_MCS3 | RATR_MCS4 | RATR_MCS5 | \ - RATR_MCS6 | RATR_MCS7) -#define RATE_ALL_OFDM_2SS (RATR_MCS8 | RATR_MCS9 | RATR_MCS10 | \ - RATR_MCS11 | RATR_MCS12 | RATR_MCS13 | \ - RATR_MCS14 | RATR_MCS15) - -#define BW_OPMODE_20MHZ BIT(2) -#define BW_OPMODE_5G BIT(1) -#define BW_OPMODE_11J BIT(0) - -#define CAM_VALID BIT(15) -#define CAM_NOTVALID 0x0000 -#define CAM_USEDK BIT(5) - -#define CAM_NONE 0x0 -#define CAM_WEP40 0x01 -#define CAM_TKIP 0x02 -#define CAM_AES 0x04 -#define CAM_WEP104 0x05 - -#define TOTAL_CAM_ENTRY 32 -#define HALF_CAM_ENTRY 16 - -#define CAM_WRITE BIT(16) -#define CAM_READ 0x00000000 -#define CAM_POLLINIG BIT(31) - -#define SCR_USEDK 0x01 -#define SCR_TXSEC_ENABLE 0x02 -#define SCR_RXSEC_ENABLE 0x04 - -#define WOW_PMEN BIT(0) -#define WOW_WOMEN BIT(1) -#define WOW_MAGIC BIT(2) -#define WOW_UWF BIT(3) - -/********************************************* -* 8188 IMR/ISR bits -**********************************************/ -#define IMR_DISABLED 0x0 -/* IMR DW0(0x0060-0063) Bit 0-31 */ -#define IMR_TXCCK BIT(30) /* TXRPT interrupt when CCX bit of - * the packet is set - */ -#define IMR_PSTIMEOUT BIT(29) /* Power Save Time Out Interrupt */ -#define IMR_GTINT4 BIT(28) /* When GTIMER4 expires, - * this bit is set to 1 - */ -#define IMR_GTINT3 BIT(27) /* When GTIMER3 expires, - * this bit is set to 1 - */ -#define IMR_TBDER BIT(26) /* Transmit Beacon0 Error */ -#define IMR_TBDOK BIT(25) /* Transmit Beacon0 OK */ -#define IMR_TSF_BIT32_TOGGLE BIT(24) /* TSF Timer BIT32 toggle ind int */ -#define IMR_BCNDMAINT0 BIT(20) /* Beacon DMA Interrupt 0 */ -#define IMR_BCNDOK0 BIT(16) /* Beacon Queue DMA OK0 */ -#define IMR_HSISR_IND_ON_INT BIT(15) /* HSISR Indicator (HSIMR & HSISR is - * true, this bit is set to 1) - */ -#define IMR_BCNDMAINT_E BIT(14) /* Beacon DMA Int Extension for Win7 */ -#define IMR_ATIMEND BIT(12) /* CTWidnow End or ATIM Window End */ -#define IMR_HISR1_IND_INT BIT(11) /* HISR1 Indicator (HISR1 & HIMR1 is - * true, this bit is set to 1) - */ -#define IMR_C2HCMD BIT(10) /* CPU to Host Command INT Status, - * Write 1 clear - */ -#define IMR_CPWM2 BIT(9) /* CPU power Mode exchange INT Status, - * Write 1 clear - */ -#define IMR_CPWM BIT(8) /* CPU power Mode exchange INT Status, - * Write 1 clear - */ -#define IMR_HIGHDOK BIT(7) /* High Queue DMA OK */ -#define IMR_MGNTDOK BIT(6) /* Management Queue DMA OK */ -#define IMR_BKDOK BIT(5) /* AC_BK DMA OK */ -#define IMR_BEDOK BIT(4) /* AC_BE DMA OK */ -#define IMR_VIDOK BIT(3) /* AC_VI DMA OK */ -#define IMR_VODOK BIT(2) /* AC_VO DMA OK */ -#define IMR_RDU BIT(1) /* Rx Descriptor Unavailable */ -#define IMR_ROK BIT(0) /* Receive DMA OK */ - -/* IMR DW1(0x00B4-00B7) Bit 0-31 */ -#define IMR_BCNDMAINT7 BIT(27) /* Beacon DMA Interrupt 7 */ -#define IMR_BCNDMAINT6 BIT(26) /* Beacon DMA Interrupt 6 */ -#define IMR_BCNDMAINT5 BIT(25) /* Beacon DMA Interrupt 5 */ -#define IMR_BCNDMAINT4 BIT(24) /* Beacon DMA Interrupt 4 */ -#define IMR_BCNDMAINT3 BIT(23) /* Beacon DMA Interrupt 3 */ -#define IMR_BCNDMAINT2 BIT(22) /* Beacon DMA Interrupt 2 */ -#define IMR_BCNDMAINT1 BIT(21) /* Beacon DMA Interrupt 1 */ -#define IMR_BCNDOK7 BIT(20) /* Beacon Queue DMA OK Interrup 7 */ -#define IMR_BCNDOK6 BIT(19) /* Beacon Queue DMA OK Interrup 6 */ -#define IMR_BCNDOK5 BIT(18) /* Beacon Queue DMA OK Interrup 5 */ -#define IMR_BCNDOK4 BIT(17) /* Beacon Queue DMA OK Interrup 4 */ -#define IMR_BCNDOK3 BIT(16) /* Beacon Queue DMA OK Interrup 3 */ -#define IMR_BCNDOK2 BIT(15) /* Beacon Queue DMA OK Interrup 2 */ -#define IMR_BCNDOK1 BIT(14) /* Beacon Queue DMA OK Interrup 1 */ -#define IMR_ATIMEND_E BIT(13) /* ATIM Window End Extension for Win7 */ -#define IMR_TXERR BIT(11) /* Tx Err Flag Int Status, - * write 1 clear. - */ -#define IMR_RXERR BIT(10) /* Rx Err Flag INT Status, - * Write 1 clear - */ -#define IMR_TXFOVW BIT(9) /* Transmit FIFO Overflow */ -#define IMR_RXFOVW BIT(8) /* Receive FIFO Overflow */ - - -#define HWSET_MAX_SIZE 512 -#define EFUSE_MAX_SECTION 64 -#define EFUSE_REAL_CONTENT_LEN 256 -#define EFUSE_OOB_PROTECT_BYTES 18 /* PG data exclude header, - * dummy 7 bytes frome CP - * test and reserved 1byte. - */ - -#define EEPROM_DEFAULT_TSSI 0x0 -#define EEPROM_DEFAULT_TXPOWERDIFF 0x0 -#define EEPROM_DEFAULT_CRYSTALCAP 0x5 -#define EEPROM_DEFAULT_BOARDTYPE 0x02 -#define EEPROM_DEFAULT_TXPOWER 0x1010 -#define EEPROM_DEFAULT_HT2T_TXPWR 0x10 - -#define EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF 0x3 -#define EEPROM_DEFAULT_THERMALMETER 0x18 -#define EEPROM_DEFAULT_ANTTXPOWERDIFF 0x0 -#define EEPROM_DEFAULT_TXPWDIFF_CRYSTALCAP 0x5 -#define EEPROM_DEFAULT_TXPOWERLEVEL 0x22 -#define EEPROM_DEFAULT_HT40_2SDIFF 0x0 -#define EEPROM_DEFAULT_HT20_DIFF 2 -#define EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF 0x3 -#define EEPROM_DEFAULT_HT40_PWRMAXOFFSET 0 -#define EEPROM_DEFAULT_HT20_PWRMAXOFFSET 0 - -#define RF_OPTION1 0x79 -#define RF_OPTION2 0x7A -#define RF_OPTION3 0x7B -#define RF_OPTION4 0x7C - -#define EEPROM_DEFAULT_PID 0x1234 -#define EEPROM_DEFAULT_VID 0x5678 -#define EEPROM_DEFAULT_CUSTOMERID 0xAB -#define EEPROM_DEFAULT_SUBCUSTOMERID 0xCD -#define EEPROM_DEFAULT_VERSION 0 - -#define EEPROM_CHANNEL_PLAN_FCC 0x0 -#define EEPROM_CHANNEL_PLAN_IC 0x1 -#define EEPROM_CHANNEL_PLAN_ETSI 0x2 -#define EEPROM_CHANNEL_PLAN_SPAIN 0x3 -#define EEPROM_CHANNEL_PLAN_FRANCE 0x4 -#define EEPROM_CHANNEL_PLAN_MKK 0x5 -#define EEPROM_CHANNEL_PLAN_MKK1 0x6 -#define EEPROM_CHANNEL_PLAN_ISRAEL 0x7 -#define EEPROM_CHANNEL_PLAN_TELEC 0x8 -#define EEPROM_CHANNEL_PLAN_GLOBAL_DOMAIN 0x9 -#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_13 0xA -#define EEPROM_CHANNEL_PLAN_NCC 0xB -#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80 - -#define EEPROM_CID_DEFAULT 0x0 -#define EEPROM_CID_TOSHIBA 0x4 -#define EEPROM_CID_CCX 0x10 -#define EEPROM_CID_QMI 0x0D -#define EEPROM_CID_WHQL 0xFE - -#define RTL8188E_EEPROM_ID 0x8129 - -#define EEPROM_HPON 0x02 -#define EEPROM_CLK 0x06 -#define EEPROM_TESTR 0x08 - -#define EEPROM_TXPOWERCCK 0x10 -#define EEPROM_TXPOWERHT40_1S 0x16 -#define EEPROM_TXPOWERHT20DIFF 0x1B -#define EEPROM_TXPOWER_OFDMDIFF 0x1B - -#define EEPROM_TX_PWR_INX 0x10 - -#define EEPROM_CHANNELPLAN 0xB8 -#define EEPROM_XTAL_88E 0xB9 -#define EEPROM_THERMAL_METER_88E 0xBA -#define EEPROM_IQK_LCK_88E 0xBB - -#define EEPROM_RF_BOARD_OPTION_88E 0xC1 -#define EEPROM_RF_FEATURE_OPTION_88E 0xC2 -#define EEPROM_RF_BT_SETTING_88E 0xC3 -#define EEPROM_VERSION 0xC4 -#define EEPROM_CUSTOMER_ID 0xC5 -#define EEPROM_RF_ANTENNA_OPT_88E 0xC9 - -#define EEPROM_MAC_ADDR 0xD0 -#define EEPROM_VID 0xD6 -#define EEPROM_DID 0xD8 -#define EEPROM_SVID 0xDA -#define EEPROM_SMID 0xDC - -#define STOPBECON BIT(6) -#define STOPHIGHT BIT(5) -#define STOPMGT BIT(4) -#define STOPVO BIT(3) -#define STOPVI BIT(2) -#define STOPBE BIT(1) -#define STOPBK BIT(0) - -#define RCR_APPFCS BIT(31) -#define RCR_APP_MIC BIT(30) -#define RCR_APP_ICV BIT(29) -#define RCR_APP_PHYST_RXFF BIT(28) -#define RCR_APP_BA_SSN BIT(27) -#define RCR_ENMBID BIT(24) -#define RCR_LSIGEN BIT(23) -#define RCR_MFBEN BIT(22) -#define RCR_HTC_LOC_CTRL BIT(14) -#define RCR_AMF BIT(13) -#define RCR_ACF BIT(12) -#define RCR_ADF BIT(11) -#define RCR_AICV BIT(9) -#define RCR_ACRC32 BIT(8) -#define RCR_CBSSID_BCN BIT(7) -#define RCR_CBSSID_DATA BIT(6) -#define RCR_CBSSID RCR_CBSSID_DATA -#define RCR_APWRMGT BIT(5) -#define RCR_ADD3 BIT(4) -#define RCR_AB BIT(3) -#define RCR_AM BIT(2) -#define RCR_APM BIT(1) -#define RCR_AAP BIT(0) -#define RCR_MXDMA_OFFSET 8 -#define RCR_FIFO_OFFSET 13 - -#define RSV_CTRL 0x001C -#define RD_CTRL 0x0524 - -#define REG_USB_INFO 0xFE17 -#define REG_USB_SPECIAL_OPTION 0xFE55 -#define REG_USB_DMA_AGG_TO 0xFE5B -#define REG_USB_AGG_TO 0xFE5C -#define REG_USB_AGG_TH 0xFE5D - -#define REG_USB_VID 0xFE60 -#define REG_USB_PID 0xFE62 -#define REG_USB_OPTIONAL 0xFE64 -#define REG_USB_CHIRP_K 0xFE65 -#define REG_USB_PHY 0xFE66 -#define REG_USB_MAC_ADDR 0xFE70 -#define REG_USB_HRPWM 0xFE58 -#define REG_USB_HCPWM 0xFE57 - -#define SW18_FPWM BIT(3) - -#define ISO_MD2PP BIT(0) -#define ISO_UA2USB BIT(1) -#define ISO_UD2CORE BIT(2) -#define ISO_PA2PCIE BIT(3) -#define ISO_PD2CORE BIT(4) -#define ISO_IP2MAC BIT(5) -#define ISO_DIOP BIT(6) -#define ISO_DIOE BIT(7) -#define ISO_EB2CORE BIT(8) -#define ISO_DIOR BIT(9) - -#define PWC_EV25V BIT(14) -#define PWC_EV12V BIT(15) - -#define FEN_BBRSTB BIT(0) -#define FEN_BB_GLB_RSTN BIT(1) -#define FEN_USBA BIT(2) -#define FEN_UPLL BIT(3) -#define FEN_USBD BIT(4) -#define FEN_DIO_PCIE BIT(5) -#define FEN_PCIEA BIT(6) -#define FEN_PPLL BIT(7) -#define FEN_PCIED BIT(8) -#define FEN_DIOE BIT(9) -#define FEN_CPUEN BIT(10) -#define FEN_DCORE BIT(11) -#define FEN_ELDR BIT(12) -#define FEN_DIO_RF BIT(13) -#define FEN_HWPDN BIT(14) -#define FEN_MREGEN BIT(15) - -#define PFM_LDALL BIT(0) -#define PFM_ALDN BIT(1) -#define PFM_LDKP BIT(2) -#define PFM_WOWL BIT(3) -#define ENPDN BIT(4) -#define PDN_PL BIT(5) -#define APFM_ONMAC BIT(8) -#define APFM_OFF BIT(9) -#define APFM_RSM BIT(10) -#define AFSM_HSUS BIT(11) -#define AFSM_PCIE BIT(12) -#define APDM_MAC BIT(13) -#define APDM_HOST BIT(14) -#define APDM_HPDN BIT(15) -#define RDY_MACON BIT(16) -#define SUS_HOST BIT(17) -#define ROP_ALD BIT(20) -#define ROP_PWR BIT(21) -#define ROP_SPS BIT(22) -#define SOP_MRST BIT(25) -#define SOP_FUSE BIT(26) -#define SOP_ABG BIT(27) -#define SOP_AMB BIT(28) -#define SOP_RCK BIT(29) -#define SOP_A8M BIT(30) -#define XOP_BTCK BIT(31) - -#define ANAD16V_EN BIT(0) -#define ANA8M BIT(1) -#define MACSLP BIT(4) -#define LOADER_CLK_EN BIT(5) -#define _80M_SSC_DIS BIT(7) -#define _80M_SSC_EN_HO BIT(8) -#define PHY_SSC_RSTB BIT(9) -#define SEC_CLK_EN BIT(10) -#define MAC_CLK_EN BIT(11) -#define SYS_CLK_EN BIT(12) -#define RING_CLK_EN BIT(13) - -#define BOOT_FROM_EEPROM BIT(4) -#define EEPROM_EN BIT(5) - -#define AFE_BGEN BIT(0) -#define AFE_MBEN BIT(1) -#define MAC_ID_EN BIT(7) - -#define WLOCK_ALL BIT(0) -#define WLOCK_00 BIT(1) -#define WLOCK_04 BIT(2) -#define WLOCK_08 BIT(3) -#define WLOCK_40 BIT(4) -#define R_DIS_PRST_0 BIT(5) -#define R_DIS_PRST_1 BIT(6) -#define LOCK_ALL_EN BIT(7) - -#define RF_EN BIT(0) -#define RF_RSTB BIT(1) -#define RF_SDMRSTB BIT(2) - -#define LDA15_EN BIT(0) -#define LDA15_STBY BIT(1) -#define LDA15_OBUF BIT(2) -#define LDA15_REG_VOS BIT(3) -#define _LDA15_VOADJ(x) (((x) & 0x7) << 4) - -#define LDV12_EN BIT(0) -#define LDV12_SDBY BIT(1) -#define LPLDO_HSM BIT(2) -#define LPLDO_LSM_DIS BIT(3) -#define _LDV12_VADJ(x) (((x) & 0xF) << 4) - -#define XTAL_EN BIT(0) -#define XTAL_BSEL BIT(1) -#define _XTAL_BOSC(x) (((x) & 0x3) << 2) -#define _XTAL_CADJ(x) (((x) & 0xF) << 4) -#define XTAL_GATE_USB BIT(8) -#define _XTAL_USB_DRV(x) (((x) & 0x3) << 9) -#define XTAL_GATE_AFE BIT(11) -#define _XTAL_AFE_DRV(x) (((x) & 0x3) << 12) -#define XTAL_RF_GATE BIT(14) -#define _XTAL_RF_DRV(x) (((x) & 0x3) << 15) -#define XTAL_GATE_DIG BIT(17) -#define _XTAL_DIG_DRV(x) (((x) & 0x3) << 18) -#define XTAL_BT_GATE BIT(20) -#define _XTAL_BT_DRV(x) (((x) & 0x3) << 21) -#define _XTAL_GPIO(x) (((x) & 0x7) << 23) - -#define CKDLY_AFE BIT(26) -#define CKDLY_USB BIT(27) -#define CKDLY_DIG BIT(28) -#define CKDLY_BT BIT(29) - -#define APLL_EN BIT(0) -#define APLL_320_EN BIT(1) -#define APLL_FREF_SEL BIT(2) -#define APLL_EDGE_SEL BIT(3) -#define APLL_WDOGB BIT(4) -#define APLL_LPFEN BIT(5) - -#define APLL_REF_CLK_13MHZ 0x1 -#define APLL_REF_CLK_19_2MHZ 0x2 -#define APLL_REF_CLK_20MHZ 0x3 -#define APLL_REF_CLK_25MHZ 0x4 -#define APLL_REF_CLK_26MHZ 0x5 -#define APLL_REF_CLK_38_4MHZ 0x6 -#define APLL_REF_CLK_40MHZ 0x7 - -#define APLL_320EN BIT(14) -#define APLL_80EN BIT(15) -#define APLL_1MEN BIT(24) - -#define ALD_EN BIT(18) -#define EF_PD BIT(19) -#define EF_FLAG BIT(31) - -#define EF_TRPT BIT(7) -#define LDOE25_EN BIT(31) - -#define RSM_EN BIT(0) -#define TIMER_EN BIT(4) - -#define TRSW0EN BIT(2) -#define TRSW1EN BIT(3) -#define EROM_EN BIT(4) -#define ENBT BIT(5) -#define ENUART BIT(8) -#define UART_910 BIT(9) -#define ENPMAC BIT(10) -#define SIC_SWRST BIT(11) -#define ENSIC BIT(12) -#define SIC_23 BIT(13) -#define ENHDP BIT(14) -#define SIC_LBK BIT(15) - -#define LED0PL BIT(4) -#define LED1PL BIT(12) -#define LED0DIS BIT(7) - -#define MCUFWDL_EN BIT(0) -#define MCUFWDL_RDY BIT(1) -#define FWDL_CHKSUM_RPT BIT(2) -#define MACINI_RDY BIT(3) -#define BBINI_RDY BIT(4) -#define RFINI_RDY BIT(5) -#define WINTINI_RDY BIT(6) -#define CPRST BIT(23) - -#define XCLK_VLD BIT(0) -#define ACLK_VLD BIT(1) -#define UCLK_VLD BIT(2) -#define PCLK_VLD BIT(3) -#define PCIRSTB BIT(4) -#define V15_VLD BIT(5) -#define TRP_B15V_EN BIT(7) -#define SIC_IDLE BIT(8) -#define BD_MAC2 BIT(9) -#define BD_MAC1 BIT(10) -#define IC_MACPHY_MODE BIT(11) -#define VENDOR_ID BIT(19) -#define PAD_HWPD_IDN BIT(22) -#define TRP_VAUX_EN BIT(23) -#define TRP_BT_EN BIT(24) -#define BD_PKG_SEL BIT(25) -#define BD_HCI_SEL BIT(26) -#define TYPE_ID BIT(27) - -#define CHIP_VER_RTL_MASK 0xF000 -#define CHIP_VER_RTL_SHIFT 12 - -#define REG_LBMODE (REG_CR + 3) - -#define HCI_TXDMA_EN BIT(0) -#define HCI_RXDMA_EN BIT(1) -#define TXDMA_EN BIT(2) -#define RXDMA_EN BIT(3) -#define PROTOCOL_EN BIT(4) -#define SCHEDULE_EN BIT(5) -#define MACTXEN BIT(6) -#define MACRXEN BIT(7) -#define ENSWBCN BIT(8) -#define ENSEC BIT(9) - -#define _NETTYPE(x) (((x) & 0x3) << 16) -#define MASK_NETTYPE 0x30000 -#define NT_NO_LINK 0x0 -#define NT_LINK_AD_HOC 0x1 -#define NT_LINK_AP 0x2 -#define NT_AS_AP 0x3 - -#define _LBMODE(x) (((x) & 0xF) << 24) -#define MASK_LBMODE 0xF000000 -#define LOOPBACK_NORMAL 0x0 -#define LOOPBACK_IMMEDIATELY 0xB -#define LOOPBACK_MAC_DELAY 0x3 -#define LOOPBACK_PHY 0x1 -#define LOOPBACK_DMA 0x7 - -#define GET_RX_PAGE_SIZE(value) ((value) & 0xF) -#define GET_TX_PAGE_SIZE(value) (((value) & 0xF0) >> 4) -#define _PSRX_MASK 0xF -#define _PSTX_MASK 0xF0 -#define _PSRX(x) (x) -#define _PSTX(x) ((x) << 4) - -#define PBP_64 0x0 -#define PBP_128 0x1 -#define PBP_256 0x2 -#define PBP_512 0x3 -#define PBP_1024 0x4 - -#define RXDMA_ARBBW_EN BIT(0) -#define RXSHFT_EN BIT(1) -#define RXDMA_AGG_EN BIT(2) -#define QS_VO_QUEUE BIT(8) -#define QS_VI_QUEUE BIT(9) -#define QS_BE_QUEUE BIT(10) -#define QS_BK_QUEUE BIT(11) -#define QS_MANAGER_QUEUE BIT(12) -#define QS_HIGH_QUEUE BIT(13) - -#define HQSEL_VOQ BIT(0) -#define HQSEL_VIQ BIT(1) -#define HQSEL_BEQ BIT(2) -#define HQSEL_BKQ BIT(3) -#define HQSEL_MGTQ BIT(4) -#define HQSEL_HIQ BIT(5) - -#define _TXDMA_HIQ_MAP(x) (((x)&0x3) << 14) -#define _TXDMA_MGQ_MAP(x) (((x)&0x3) << 12) -#define _TXDMA_BKQ_MAP(x) (((x)&0x3) << 10) -#define _TXDMA_BEQ_MAP(x) (((x)&0x3) << 8) -#define _TXDMA_VIQ_MAP(x) (((x)&0x3) << 6) -#define _TXDMA_VOQ_MAP(x) (((x)&0x3) << 4) - -#define QUEUE_LOW 1 -#define QUEUE_NORMAL 2 -#define QUEUE_HIGH 3 - -#define _LLT_NO_ACTIVE 0x0 -#define _LLT_WRITE_ACCESS 0x1 -#define _LLT_READ_ACCESS 0x2 - -#define _LLT_INIT_DATA(x) ((x) & 0xFF) -#define _LLT_INIT_ADDR(x) (((x) & 0xFF) << 8) -#define _LLT_OP(x) (((x) & 0x3) << 30) -#define _LLT_OP_VALUE(x) (((x) >> 30) & 0x3) - -#define BB_WRITE_READ_MASK (BIT(31) | BIT(30)) -#define BB_WRITE_EN BIT(30) -#define BB_READ_EN BIT(31) - -#define _HPQ(x) ((x) & 0xFF) -#define _LPQ(x) (((x) & 0xFF) << 8) -#define _PUBQ(x) (((x) & 0xFF) << 16) -#define _NPQ(x) ((x) & 0xFF) - -#define HPQ_PUBLIC_DIS BIT(24) -#define LPQ_PUBLIC_DIS BIT(25) -#define LD_RQPN BIT(31) - -#define BCN_VALID BIT(16) -#define BCN_HEAD(x) (((x) & 0xFF) << 8) -#define BCN_HEAD_MASK 0xFF00 - -#define BLK_DESC_NUM_SHIFT 4 -#define BLK_DESC_NUM_MASK 0xF - -#define DROP_DATA_EN BIT(9) - -#define EN_AMPDU_RTY_NEW BIT(7) - -#define _INIRTSMCS_SEL(x) ((x) & 0x3F) - -#define _SPEC_SIFS_CCK(x) ((x) & 0xFF) -#define _SPEC_SIFS_OFDM(x) (((x) & 0xFF) << 8) - -#define RATE_REG_BITMAP_ALL 0xFFFFF - -#define _RRSC_BITMAP(x) ((x) & 0xFFFFF) - -#define _RRSR_RSC(x) (((x) & 0x3) << 21) -#define RRSR_RSC_RESERVED 0x0 -#define RRSR_RSC_UPPER_SUBCHANNEL 0x1 -#define RRSR_RSC_LOWER_SUBCHANNEL 0x2 -#define RRSR_RSC_DUPLICATE_MODE 0x3 - -#define USE_SHORT_G1 BIT(20) - -#define _AGGLMT_MCS0(x) ((x) & 0xF) -#define _AGGLMT_MCS1(x) (((x) & 0xF) << 4) -#define _AGGLMT_MCS2(x) (((x) & 0xF) << 8) -#define _AGGLMT_MCS3(x) (((x) & 0xF) << 12) -#define _AGGLMT_MCS4(x) (((x) & 0xF) << 16) -#define _AGGLMT_MCS5(x) (((x) & 0xF) << 20) -#define _AGGLMT_MCS6(x) (((x) & 0xF) << 24) -#define _AGGLMT_MCS7(x) (((x) & 0xF) << 28) - -#define RETRY_LIMIT_SHORT_SHIFT 8 -#define RETRY_LIMIT_LONG_SHIFT 0 - -#define _DARF_RC1(x) ((x) & 0x1F) -#define _DARF_RC2(x) (((x) & 0x1F) << 8) -#define _DARF_RC3(x) (((x) & 0x1F) << 16) -#define _DARF_RC4(x) (((x) & 0x1F) << 24) -#define _DARF_RC5(x) ((x) & 0x1F) -#define _DARF_RC6(x) (((x) & 0x1F) << 8) -#define _DARF_RC7(x) (((x) & 0x1F) << 16) -#define _DARF_RC8(x) (((x) & 0x1F) << 24) - -#define _RARF_RC1(x) ((x) & 0x1F) -#define _RARF_RC2(x) (((x) & 0x1F) << 8) -#define _RARF_RC3(x) (((x) & 0x1F) << 16) -#define _RARF_RC4(x) (((x) & 0x1F) << 24) -#define _RARF_RC5(x) ((x) & 0x1F) -#define _RARF_RC6(x) (((x) & 0x1F) << 8) -#define _RARF_RC7(x) (((x) & 0x1F) << 16) -#define _RARF_RC8(x) (((x) & 0x1F) << 24) - -#define AC_PARAM_TXOP_LIMIT_OFFSET 16 -#define AC_PARAM_ECW_MAX_OFFSET 12 -#define AC_PARAM_ECW_MIN_OFFSET 8 -#define AC_PARAM_AIFS_OFFSET 0 - -#define _AIFS(x) (x) -#define _ECW_MAX_MIN(x) ((x) << 8) -#define _TXOP_LIMIT(x) ((x) << 16) - -#define _BCNIFS(x) ((x) & 0xFF) -#define _BCNECW(x) ((((x) & 0xF)) << 8) - -#define _LRL(x) ((x) & 0x3F) -#define _SRL(x) (((x) & 0x3F) << 8) - -#define _SIFS_CCK_CTX(x) ((x) & 0xFF) -#define _SIFS_CCK_TRX(x) (((x) & 0xFF) << 8); - -#define _SIFS_OFDM_CTX(x) ((x) & 0xFF) -#define _SIFS_OFDM_TRX(x) (((x) & 0xFF) << 8); - -#define _TBTT_PROHIBIT_HOLD(x) (((x) & 0xFF) << 8) - -#define DIS_EDCA_CNT_DWN BIT(11) - -#define EN_MBSSID BIT(1) -#define EN_TXBCN_RPT BIT(2) -#define EN_BCN_FUNCTION BIT(3) - -#define TSFTR_RST BIT(0) -#define TSFTR1_RST BIT(1) - -#define STOP_BCNQ BIT(6) - -#define DIS_TSF_UDT0_NORMAL_CHIP BIT(4) -#define DIS_TSF_UDT0_TEST_CHIP BIT(5) - -#define ACMHW_HWEN BIT(0) -#define ACMHW_BEQEN BIT(1) -#define ACMHW_VIQEN BIT(2) -#define ACMHW_VOQEN BIT(3) -#define ACMHW_BEQSTATUS BIT(4) -#define ACMHW_VIQSTATUS BIT(5) -#define ACMHW_VOQSTATUS BIT(6) - -#define APSDOFF BIT(6) -#define APSDOFF_STATUS BIT(7) - -#define BW_20MHZ BIT(2) - -#define RATE_BITMAP_ALL 0xFFFFF - -#define RATE_RRSR_CCK_ONLY_1M 0xFFFF1 - -#define TSFRST BIT(0) -#define DIS_GCLK BIT(1) -#define PAD_SEL BIT(2) -#define PWR_ST BIT(6) -#define PWRBIT_OW_EN BIT(7) -#define ACRC BIT(8) -#define CFENDFORM BIT(9) -#define ICV BIT(10) - -#define AAP BIT(0) -#define APM BIT(1) -#define AM BIT(2) -#define AB BIT(3) -#define ADD3 BIT(4) -#define APWRMGT BIT(5) -#define CBSSID BIT(6) -#define CBSSID_DATA BIT(6) -#define CBSSID_BCN BIT(7) -#define ACRC32 BIT(8) -#define AICV BIT(9) -#define ADF BIT(11) -#define ACF BIT(12) -#define AMF BIT(13) -#define HTC_LOC_CTRL BIT(14) -#define UC_DATA_EN BIT(16) -#define BM_DATA_EN BIT(17) -#define MFBEN BIT(22) -#define LSIGEN BIT(23) -#define ENMBID BIT(24) -#define APP_BASSN BIT(27) -#define APP_PHYSTS BIT(28) -#define APP_ICV BIT(29) -#define APP_MIC BIT(30) -#define APP_FCS BIT(31) - -#define _MIN_SPACE(x) ((x) & 0x7) -#define _SHORT_GI_PADDING(x) (((x) & 0x1F) << 3) - -#define RXERR_TYPE_OFDM_PPDU 0 -#define RXERR_TYPE_OFDM_FALSE_ALARM 1 -#define RXERR_TYPE_OFDM_MPDU_OK 2 -#define RXERR_TYPE_OFDM_MPDU_FAIL 3 -#define RXERR_TYPE_CCK_PPDU 4 -#define RXERR_TYPE_CCK_FALSE_ALARM 5 -#define RXERR_TYPE_CCK_MPDU_OK 6 -#define RXERR_TYPE_CCK_MPDU_FAIL 7 -#define RXERR_TYPE_HT_PPDU 8 -#define RXERR_TYPE_HT_FALSE_ALARM 9 -#define RXERR_TYPE_HT_MPDU_TOTAL 10 -#define RXERR_TYPE_HT_MPDU_OK 11 -#define RXERR_TYPE_HT_MPDU_FAIL 12 -#define RXERR_TYPE_RX_FULL_DROP 15 - -#define RXERR_COUNTER_MASK 0xFFFFF -#define RXERR_RPT_RST BIT(27) -#define _RXERR_RPT_SEL(type) ((type) << 28) - -#define SCR_TXUSEDK BIT(0) -#define SCR_RXUSEDK BIT(1) -#define SCR_TXENCENABLE BIT(2) -#define SCR_RXDECENABLE BIT(3) -#define SCR_SKBYA2 BIT(4) -#define SCR_NOSKMC BIT(5) -#define SCR_TXBCUSEDK BIT(6) -#define SCR_RXBCUSEDK BIT(7) - -#define USB_IS_HIGH_SPEED 0 -#define USB_IS_FULL_SPEED 1 -#define USB_SPEED_MASK BIT(5) - -#define USB_NORMAL_SIE_EP_MASK 0xF -#define USB_NORMAL_SIE_EP_SHIFT 4 - -#define USB_TEST_EP_MASK 0x30 -#define USB_TEST_EP_SHIFT 4 - -#define USB_AGG_EN BIT(3) - -#define MAC_ADDR_LEN 6 -#define LAST_ENTRY_OF_TX_PKT_BUFFER 175/*255 88e*/ - -#define POLLING_LLT_THRESHOLD 20 -#define POLLING_READY_TIMEOUT_COUNT 3000 - -#define MAX_MSS_DENSITY_2T 0x13 -#define MAX_MSS_DENSITY_1T 0x0A - -#define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6)) -#define EPROM_CMD_CONFIG 0x3 -#define EPROM_CMD_LOAD 1 - -#define HWSET_MAX_SIZE_92S HWSET_MAX_SIZE - -#define HAL_8192C_HW_GPIO_WPS_BIT BIT(2) - -#define RPMAC_RESET 0x100 -#define RPMAC_TXSTART 0x104 -#define RPMAC_TXLEGACYSIG 0x108 -#define RPMAC_TXHTSIG1 0x10c -#define RPMAC_TXHTSIG2 0x110 -#define RPMAC_PHYDEBUG 0x114 -#define RPMAC_TXPACKETNUM 0x118 -#define RPMAC_TXIDLE 0x11c -#define RPMAC_TXMACHEADER0 0x120 -#define RPMAC_TXMACHEADER1 0x124 -#define RPMAC_TXMACHEADER2 0x128 -#define RPMAC_TXMACHEADER3 0x12c -#define RPMAC_TXMACHEADER4 0x130 -#define RPMAC_TXMACHEADER5 0x134 -#define RPMAC_TXDADATYPE 0x138 -#define RPMAC_TXRANDOMSEED 0x13c -#define RPMAC_CCKPLCPPREAMBLE 0x140 -#define RPMAC_CCKPLCPHEADER 0x144 -#define RPMAC_CCKCRC16 0x148 -#define RPMAC_OFDMRXCRC32OK 0x170 -#define RPMAC_OFDMRXCRC32Er 0x174 -#define RPMAC_OFDMRXPARITYER 0x178 -#define RPMAC_OFDMRXCRC8ER 0x17c -#define RPMAC_CCKCRXRC16ER 0x180 -#define RPMAC_CCKCRXRC32ER 0x184 -#define RPMAC_CCKCRXRC32OK 0x188 -#define RPMAC_TXSTATUS 0x18c - -#define RFPGA0_RFMOD 0x800 - -#define RFPGA0_TXINFO 0x804 -#define RFPGA0_PSDFUNCTION 0x808 - -#define RFPGA0_TXGAINSTAGE 0x80c - -#define RFPGA0_RFTIMING1 0x810 -#define RFPGA0_RFTIMING2 0x814 - -#define RFPGA0_XA_HSSIPARAMETER1 0x820 -#define RFPGA0_XA_HSSIPARAMETER2 0x824 -#define RFPGA0_XB_HSSIPARAMETER1 0x828 -#define RFPGA0_XB_HSSIPARAMETER2 0x82c - -#define RFPGA0_XA_LSSIPARAMETER 0x840 -#define RFPGA0_XB_LSSIPARAMETER 0x844 - -#define RFPGA0_RFWAKEUPPARAMETER 0x850 -#define RFPGA0_RFSLEEPUPPARAMETER 0x854 - -#define RFPGA0_XAB_SWITCHCONTROL 0x858 -#define RFPGA0_XCD_SWITCHCONTROL 0x85c - -#define RFPGA0_XA_RFINTERFACEOE 0x860 -#define RFPGA0_XB_RFINTERFACEOE 0x864 - -#define RFPGA0_XAB_RFINTERFACESW 0x870 -#define RFPGA0_XCD_RFINTERFACESW 0x874 - -#define rFPGA0_XAB_RFPARAMETER 0x878 -#define rFPGA0_XCD_RFPARAMETER 0x87c - -#define RFPGA0_ANALOGPARAMETER1 0x880 -#define RFPGA0_ANALOGPARAMETER2 0x884 -#define RFPGA0_ANALOGPARAMETER3 0x888 -#define RFPGA0_ANALOGPARAMETER4 0x88c - -#define RFPGA0_XA_LSSIREADBACK 0x8a0 -#define RFPGA0_XB_LSSIREADBACK 0x8a4 -#define RFPGA0_XC_LSSIREADBACK 0x8a8 -#define RFPGA0_XD_LSSIREADBACK 0x8ac - -#define RFPGA0_PSDREPORT 0x8b4 -#define TRANSCEIVEA_HSPI_READBACK 0x8b8 -#define TRANSCEIVEB_HSPI_READBACK 0x8bc -#define REG_SC_CNT 0x8c4 -#define RFPGA0_XAB_RFINTERFACERB 0x8e0 -#define RFPGA0_XCD_RFINTERFACERB 0x8e4 - -#define RFPGA1_RFMOD 0x900 - -#define RFPGA1_TXBLOCK 0x904 -#define RFPGA1_DEBUGSELECT 0x908 -#define RFPGA1_TXINFO 0x90c - -#define RCCK0_SYSTEM 0xa00 - -#define RCCK0_AFESETTING 0xa04 -#define RCCK0_CCA 0xa08 - -#define RCCK0_RXAGC1 0xa0c -#define RCCK0_RXAGC2 0xa10 - -#define RCCK0_RXHP 0xa14 - -#define RCCK0_DSPPARAMETER1 0xa18 -#define RCCK0_DSPPARAMETER2 0xa1c - -#define RCCK0_TXFILTER1 0xa20 -#define RCCK0_TXFILTER2 0xa24 -#define RCCK0_DEBUGPORT 0xa28 -#define RCCK0_FALSEALARMREPORT 0xa2c -#define RCCK0_TRSSIREPORT 0xa50 -#define RCCK0_RXREPORT 0xa54 -#define RCCK0_FACOUNTERLOWER 0xa5c -#define RCCK0_FACOUNTERUPPER 0xa58 -#define RCCK0_CCA_CNT 0xa60 - - -/* PageB(0xB00) */ -#define RPDP_ANTA 0xb00 -#define RPDP_ANTA_4 0xb04 -#define RPDP_ANTA_8 0xb08 -#define RPDP_ANTA_C 0xb0c -#define RPDP_ANTA_10 0xb10 -#define RPDP_ANTA_14 0xb14 -#define RPDP_ANTA_18 0xb18 -#define RPDP_ANTA_1C 0xb1c -#define RPDP_ANTA_20 0xb20 -#define RPDP_ANTA_24 0xb24 - -#define RCONFIG_PMPD_ANTA 0xb28 -#define RCONFIG_RAM64X16 0xb2c - -#define RBNDA 0xb30 -#define RHSSIPAR 0xb34 - -#define RCONFIG_ANTA 0xb68 -#define RCONFIG_ANTB 0xb6c - -#define RPDP_ANTB 0xb70 -#define RPDP_ANTB_4 0xb74 -#define RPDP_ANTB_8 0xb78 -#define RPDP_ANTB_C 0xb7c -#define RPDP_ANTB_10 0xb80 -#define RPDP_ANTB_14 0xb84 -#define RPDP_ANTB_18 0xb88 -#define RPDP_ANTB_1C 0xb8c -#define RPDP_ANTB_20 0xb90 -#define RPDP_ANTB_24 0xb94 - -#define RCONFIG_PMPD_ANTB 0xb98 - -#define RBNDB 0xba0 - -#define RAPK 0xbd8 -#define rPm_Rx0_AntA 0xbdc -#define rPm_Rx1_AntA 0xbe0 -#define rPm_Rx2_AntA 0xbe4 -#define rPm_Rx3_AntA 0xbe8 -#define rPm_Rx0_AntB 0xbec -#define rPm_Rx1_AntB 0xbf0 -#define rPm_Rx2_AntB 0xbf4 -#define rPm_Rx3_AntB 0xbf8 - -/*Page C*/ -#define ROFDM0_LSTF 0xc00 - -#define ROFDM0_TRXPATHENABLE 0xc04 -#define ROFDM0_TRMUXPAR 0xc08 -#define ROFDM0_TRSWISOLATION 0xc0c - -#define ROFDM0_XARXAFE 0xc10 -#define ROFDM0_XARXIQIMBAL 0xc14 -#define ROFDM0_XBRXAFE 0xc18 -#define ROFDM0_XBRXIQIMBAL 0xc1c -#define ROFDM0_XCRXAFE 0xc20 -#define ROFDM0_XCRXIQIMBAL 0xc24 -#define ROFDM0_XDRXAFE 0xc28 -#define ROFDM0_XDRXIQIMBAL 0xc2c - -#define ROFDM0_RXDETECTOR1 0xc30 -#define ROFDM0_RXDETECTOR2 0xc34 -#define ROFDM0_RXDETECTOR3 0xc38 -#define ROFDM0_RXDETECTOR4 0xc3c - -#define ROFDM0_RXDSP 0xc40 -#define ROFDM0_CFOANDDAGC 0xc44 -#define ROFDM0_CCADROPTHRES 0xc48 -#define ROFDM0_ECCATHRES 0xc4c - -#define ROFDM0_XAAGCCORE1 0xc50 -#define ROFDM0_XAAGCCORE2 0xc54 -#define ROFDM0_XBAGCCORE1 0xc58 -#define ROFDM0_XBAGCCORE2 0xc5c -#define ROFDM0_XCAGCCORE1 0xc60 -#define ROFDM0_XCAGCCORE2 0xc64 -#define ROFDM0_XDAGCCORE1 0xc68 -#define ROFDM0_XDAGCCORE2 0xc6c - -#define ROFDM0_AGCPARAMETER1 0xc70 -#define ROFDM0_AGCPARAMETER2 0xc74 -#define ROFDM0_AGCRSSITABLE 0xc78 -#define ROFDM0_HTSTFAGC 0xc7c - -#define ROFDM0_XATXIQIMBAL 0xc80 -#define ROFDM0_XATXAFE 0xc84 -#define ROFDM0_XBTXIQIMBAL 0xc88 -#define ROFDM0_XBTXAFE 0xc8c -#define ROFDM0_XCTXIQIMBAL 0xc90 -#define ROFDM0_XCTXAFE 0xc94 -#define ROFDM0_XDTXIQIMBAL 0xc98 -#define ROFDM0_XDTXAFE 0xc9c - -#define ROFDM0_RXIQEXTANTA 0xca0 -#define ROFDM0_TXCOEFF1 0xca4 -#define ROFDM0_TXCOEFF2 0xca8 -#define ROFDM0_TXCOEFF3 0xcac -#define ROFDM0_TXCOEFF4 0xcb0 -#define ROFDM0_TXCOEFF5 0xcb4 -#define ROFDM0_TXCOEFF6 0xcb8 - -#define ROFDM0_RXHPPARAMETER 0xce0 -#define ROFDM0_TXPSEUDONOISEWGT 0xce4 -#define ROFDM0_FRAMESYNC 0xcf0 -#define ROFDM0_DFSREPORT 0xcf4 - - -#define ROFDM1_LSTF 0xd00 -#define ROFDM1_TRXPATHENABLE 0xd04 - -#define ROFDM1_CF0 0xd08 -#define ROFDM1_CSI1 0xd10 -#define ROFDM1_SBD 0xd14 -#define ROFDM1_CSI2 0xd18 -#define ROFDM1_CFOTRACKING 0xd2c -#define ROFDM1_TRXMESAURE1 0xd34 -#define ROFDM1_INTFDET 0xd3c -#define ROFDM1_PSEUDONOISESTATEAB 0xd50 -#define ROFDM1_PSEUDONOISESTATECD 0xd54 -#define ROFDM1_RXPSEUDONOISEWGT 0xd58 - -#define ROFDM_PHYCOUNTER1 0xda0 -#define ROFDM_PHYCOUNTER2 0xda4 -#define ROFDM_PHYCOUNTER3 0xda8 - -#define ROFDM_SHORTCFOAB 0xdac -#define ROFDM_SHORTCFOCD 0xdb0 -#define ROFDM_LONGCFOAB 0xdb4 -#define ROFDM_LONGCFOCD 0xdb8 -#define ROFDM_TAILCF0AB 0xdbc -#define ROFDM_TAILCF0CD 0xdc0 -#define ROFDM_PWMEASURE1 0xdc4 -#define ROFDM_PWMEASURE2 0xdc8 -#define ROFDM_BWREPORT 0xdcc -#define ROFDM_AGCREPORT 0xdd0 -#define ROFDM_RXSNR 0xdd4 -#define ROFDM_RXEVMCSI 0xdd8 -#define ROFDM_SIGREPORT 0xddc - -#define RTXAGC_A_RATE18_06 0xe00 -#define RTXAGC_A_RATE54_24 0xe04 -#define RTXAGC_A_CCK1_MCS32 0xe08 -#define RTXAGC_A_MCS03_MCS00 0xe10 -#define RTXAGC_A_MCS07_MCS04 0xe14 -#define RTXAGC_A_MCS11_MCS08 0xe18 -#define RTXAGC_A_MCS15_MCS12 0xe1c - -#define RTXAGC_B_RATE18_06 0x830 -#define RTXAGC_B_RATE54_24 0x834 -#define RTXAGC_B_CCK1_55_MCS32 0x838 -#define RTXAGC_B_MCS03_MCS00 0x83c -#define RTXAGC_B_MCS07_MCS04 0x848 -#define RTXAGC_B_MCS11_MCS08 0x84c -#define RTXAGC_B_MCS15_MCS12 0x868 -#define RTXAGC_B_CCK11_A_CCK2_11 0x86c - -#define RFPGA0_IQK 0xe28 -#define RTX_IQK_TONE_A 0xe30 -#define RRX_IQK_TONE_A 0xe34 -#define RTX_IQK_PI_A 0xe38 -#define RRX_IQK_PI_A 0xe3c - -#define RTX_IQK 0xe40 -#define RRX_IQK 0xe44 -#define RIQK_AGC_PTS 0xe48 -#define RIQK_AGC_RSP 0xe4c -#define RTX_IQK_TONE_B 0xe50 -#define RRX_IQK_TONE_B 0xe54 -#define RTX_IQK_PI_B 0xe58 -#define RRX_IQK_PI_B 0xe5c -#define RIQK_AGC_CONT 0xe60 - -#define RBLUE_TOOTH 0xe6c -#define RRX_WAIT_CCA 0xe70 -#define RTX_CCK_RFON 0xe74 -#define RTX_CCK_BBON 0xe78 -#define RTX_OFDM_RFON 0xe7c -#define RTX_OFDM_BBON 0xe80 -#define RTX_TO_RX 0xe84 -#define RTX_TO_TX 0xe88 -#define RRX_CCK 0xe8c - -#define RTX_POWER_BEFORE_IQK_A 0xe94 -#define RTX_POWER_AFTER_IQK_A 0xe9c - -#define RRX_POWER_BEFORE_IQK_A 0xea0 -#define RRX_POWER_BEFORE_IQK_A_2 0xea4 -#define RRX_POWER_AFTER_IQK_A 0xea8 -#define RRX_POWER_AFTER_IQK_A_2 0xeac - -#define RTX_POWER_BEFORE_IQK_B 0xeb4 -#define RTX_POWER_AFTER_IQK_B 0xebc - -#define RRX_POWER_BEFORE_IQK_B 0xec0 -#define RRX_POWER_BEFORE_IQK_B_2 0xec4 -#define RRX_POWER_AFTER_IQK_B 0xec8 -#define RRX_POWER_AFTER_IQK_B_2 0xecc - -#define RRX_OFDM 0xed0 -#define RRX_WAIT_RIFS 0xed4 -#define RRX_TO_RX 0xed8 -#define RSTANDBY 0xedc -#define RSLEEP 0xee0 -#define RPMPD_ANAEN 0xeec - -#define RZEBRA1_HSSIENABLE 0x0 -#define RZEBRA1_TRXENABLE1 0x1 -#define RZEBRA1_TRXENABLE2 0x2 -#define RZEBRA1_AGC 0x4 -#define RZEBRA1_CHARGEPUMP 0x5 -#define RZEBRA1_CHANNEL 0x7 - -#define RZEBRA1_TXGAIN 0x8 -#define RZEBRA1_TXLPF 0x9 -#define RZEBRA1_RXLPF 0xb -#define RZEBRA1_RXHPFCORNER 0xc - -#define RGLOBALCTRL 0 -#define RRTL8256_TXLPF 19 -#define RRTL8256_RXLPF 11 -#define RRTL8258_TXLPF 0x11 -#define RRTL8258_RXLPF 0x13 -#define RRTL8258_RSSILPF 0xa - -#define RF_AC 0x00 - -#define RF_IQADJ_G1 0x01 -#define RF_IQADJ_G2 0x02 -#define RF_POW_TRSW 0x05 - -#define RF_GAIN_RX 0x06 -#define RF_GAIN_TX 0x07 - -#define RF_TXM_IDAC 0x08 -#define RF_BS_IQGEN 0x0F - -#define RF_MODE1 0x10 -#define RF_MODE2 0x11 - -#define RF_RX_AGC_HP 0x12 -#define RF_TX_AGC 0x13 -#define RF_BIAS 0x14 -#define RF_IPA 0x15 -#define RF_POW_ABILITY 0x17 -#define RF_MODE_AG 0x18 -#define RRFCHANNEL 0x18 -#define RF_CHNLBW 0x18 -#define RF_TOP 0x19 - -#define RF_RX_G1 0x1A -#define RF_RX_G2 0x1B - -#define RF_RX_BB2 0x1C -#define RF_RX_BB1 0x1D - -#define RF_RCK1 0x1E -#define RF_RCK2 0x1F - -#define RF_TX_G1 0x20 -#define RF_TX_G2 0x21 -#define RF_TX_G3 0x22 - -#define RF_TX_BB1 0x23 -#define RF_T_METER 0x42 - -#define RF_SYN_G1 0x25 -#define RF_SYN_G2 0x26 -#define RF_SYN_G3 0x27 -#define RF_SYN_G4 0x28 -#define RF_SYN_G5 0x29 -#define RF_SYN_G6 0x2A -#define RF_SYN_G7 0x2B -#define RF_SYN_G8 0x2C - -#define RF_RCK_OS 0x30 -#define RF_TXPA_G1 0x31 -#define RF_TXPA_G2 0x32 -#define RF_TXPA_G3 0x33 - -#define RF_TX_BIAS_A 0x35 -#define RF_TX_BIAS_D 0x36 -#define RF_LOBF_9 0x38 -#define RF_RXRF_A3 0x3C -#define RF_TRSW 0x3F - -#define RF_TXRF_A2 0x41 -#define RF_TXPA_G4 0x46 -#define RF_TXPA_A4 0x4B - -#define RF_WE_LUT 0xEF - -#define BBBRESETB 0x100 -#define BGLOBALRESETB 0x200 -#define BOFDMTXSTART 0x4 -#define BCCKTXSTART 0x8 -#define BCRC32DEBUG 0x100 -#define BPMACLOOPBACK 0x10 -#define BTXLSIG 0xffffff -#define BOFDMTXRATE 0xf -#define BOFDMTXRESERVED 0x10 -#define BOFDMTXLENGTH 0x1ffe0 -#define BOFDMTXPARITY 0x20000 -#define BTXHTSIG1 0xffffff -#define BTXHTMCSRATE 0x7f -#define BTXHTBW 0x80 -#define BTXHTLENGTH 0xffff00 -#define BTXHTSIG2 0xffffff -#define BTXHTSMOOTHING 0x1 -#define BTXHTSOUNDING 0x2 -#define BTXHTRESERVED 0x4 -#define BTXHTAGGREATION 0x8 -#define BTXHTSTBC 0x30 -#define BTXHTADVANCECODING 0x40 -#define BTXHTSHORTGI 0x80 -#define BTXHTNUMBERHT_LTF 0x300 -#define BTXHTCRC8 0x3fc00 -#define BCOUNTERRESET 0x10000 -#define BNUMOFOFDMTX 0xffff -#define BNUMOFCCKTX 0xffff0000 -#define BTXIDLEINTERVAL 0xffff -#define BOFDMSERVICE 0xffff0000 -#define BTXMACHEADER 0xffffffff -#define BTXDATAINIT 0xff -#define BTXHTMODE 0x100 -#define BTXDATATYPE 0x30000 -#define BTXRANDOMSEED 0xffffffff -#define BCCKTXPREAMBLE 0x1 -#define BCCKTXSFD 0xffff0000 -#define BCCKTXSIG 0xff -#define BCCKTXSERVICE 0xff00 -#define BCCKLENGTHEXT 0x8000 -#define BCCKTXLENGHT 0xffff0000 -#define BCCKTXCRC16 0xffff -#define BCCKTXSTATUS 0x1 -#define BOFDMTXSTATUS 0x2 -#define IS_BB_REG_OFFSET_92S(_offset) \ - ((_offset >= 0x800) && (_offset <= 0xfff)) - -#define BRFMOD 0x1 -#define BJAPANMODE 0x2 -#define BCCKTXSC 0x30 -#define BCCKEN 0x1000000 -#define BOFDMEN 0x2000000 - -#define BOFDMRXADCPHASE 0x10000 -#define BOFDMTXDACPHASE 0x40000 -#define BXATXAGC 0x3f - -#define BXBTXAGC 0xf00 -#define BXCTXAGC 0xf000 -#define BXDTXAGC 0xf0000 - -#define BPASTART 0xf0000000 -#define BTRSTART 0x00f00000 -#define BRFSTART 0x0000f000 -#define BBBSTART 0x000000f0 -#define BBBCCKSTART 0x0000000f -#define BPAEND 0xf -#define BTREND 0x0f000000 -#define BRFEND 0x000f0000 -#define BCCAMASK 0x000000f0 -#define BR2RCCAMASK 0x00000f00 -#define BHSSI_R2TDELAY 0xf8000000 -#define BHSSI_T2RDELAY 0xf80000 -#define BCONTXHSSI 0x400 -#define BIGFROMCCK 0x200 -#define BAGCADDRESS 0x3f -#define BRXHPTX 0x7000 -#define BRXHP2RX 0x38000 -#define BRXHPCCKINI 0xc0000 -#define BAGCTXCODE 0xc00000 -#define BAGCRXCODE 0x300000 - -#define B3WIREDATALENGTH 0x800 -#define B3WIREADDREAALENGTH 0x400 - -#define B3WIRERFPOWERDOWN 0x1 -#define B5GPAPEPOLARITY 0x40000000 -#define B2GPAPEPOLARITY 0x80000000 -#define BRFSW_TXDEFAULTANT 0x3 -#define BRFSW_TXOPTIONANT 0x30 -#define BRFSW_RXDEFAULTANT 0x300 -#define BRFSW_RXOPTIONANT 0x3000 -#define BRFSI_3WIREDATA 0x1 -#define BRFSI_3WIRECLOCK 0x2 -#define BRFSI_3WIRELOAD 0x4 -#define BRFSI_3WIRERW 0x8 -#define BRFSI_3WIRE 0xf - -#define BRFSI_RFENV 0x10 - -#define BRFSI_TRSW 0x20 -#define BRFSI_TRSWB 0x40 -#define BRFSI_ANTSW 0x100 -#define BRFSI_ANTSWB 0x200 -#define BRFSI_PAPE 0x400 -#define BRFSI_PAPE5G 0x800 -#define BBANDSELECT 0x1 -#define BHTSIG2_GI 0x80 -#define BHTSIG2_SMOOTHING 0x01 -#define BHTSIG2_SOUNDING 0x02 -#define BHTSIG2_AGGREATON 0x08 -#define BHTSIG2_STBC 0x30 -#define BHTSIG2_ADVCODING 0x40 -#define BHTSIG2_NUMOFHTLTF 0x300 -#define BHTSIG2_CRC8 0x3fc -#define BHTSIG1_MCS 0x7f -#define BHTSIG1_BANDWIDTH 0x80 -#define BHTSIG1_HTLENGTH 0xffff -#define BLSIG_RATE 0xf -#define BLSIG_RESERVED 0x10 -#define BLSIG_LENGTH 0x1fffe -#define BLSIG_PARITY 0x20 -#define BCCKRXPHASE 0x4 - -#define BLSSIREADADDRESS 0x7f800000 -#define BLSSIREADEDGE 0x80000000 - -#define BLSSIREADBACKDATA 0xfffff - -#define BLSSIREADOKFLAG 0x1000 -#define BCCKSAMPLERATE 0x8 -#define BREGULATOR0STANDBY 0x1 -#define BREGULATORPLLSTANDBY 0x2 -#define BREGULATOR1STANDBY 0x4 -#define BPLLPOWERUP 0x8 -#define BDPLLPOWERUP 0x10 -#define BDA10POWERUP 0x20 -#define BAD7POWERUP 0x200 -#define BDA6POWERUP 0x2000 -#define BXTALPOWERUP 0x4000 -#define B40MDCLKPOWERUP 0x8000 -#define BDA6DEBUGMODE 0x20000 -#define BDA6SWING 0x380000 - -#define BADCLKPHASE 0x4000000 -#define B80MCLKDELAY 0x18000000 -#define BAFEWATCHDOGENABLE 0x20000000 - -#define BXTALCAP01 0xc0000000 -#define BXTALCAP23 0x3 -#define BXTALCAP92X 0x0f000000 -#define BXTALCAP 0x0f000000 - -#define BINTDIFCLKENABLE 0x400 -#define BEXTSIGCLKENABLE 0x800 -#define BBANDGAP_MBIAS_POWERUP 0x10000 -#define BAD11SH_GAIN 0xc0000 -#define BAD11NPUT_RANGE 0x700000 -#define BAD110P_CURRENT 0x3800000 -#define BLPATH_LOOPBACK 0x4000000 -#define BQPATH_LOOPBACK 0x8000000 -#define BAFE_LOOPBACK 0x10000000 -#define BDA10_SWING 0x7e0 -#define BDA10_REVERSE 0x800 -#define BDA_CLK_SOURCE 0x1000 -#define BDA7INPUT_RANGE 0x6000 -#define BDA7_GAIN 0x38000 -#define BDA7OUTPUT_CM_MODE 0x40000 -#define BDA7INPUT_CM_MODE 0x380000 -#define BDA7CURRENT 0xc00000 -#define BREGULATOR_ADJUST 0x7000000 -#define BAD11POWERUP_ATTX 0x1 -#define BDA10PS_ATTX 0x10 -#define BAD11POWERUP_ATRX 0x100 -#define BDA10PS_ATRX 0x1000 -#define BCCKRX_AGC_FORMAT 0x200 -#define BPSDFFT_SAMPLE_POINT 0xc000 -#define BPSD_AVERAGE_NUM 0x3000 -#define BIQPATH_CONTROL 0xc00 -#define BPSD_FREQ 0x3ff -#define BPSD_ANTENNA_PATH 0x30 -#define BPSD_IQ_SWITCH 0x40 -#define BPSD_RX_TRIGGER 0x400000 -#define BPSD_TX_TRIGGERCW 0x80000000 -#define BPSD_SINE_TONE_SCALE 0x7f000000 -#define BPSD_REPORT 0xffff - -#define BOFDM_TXSC 0x30000000 -#define BCCK_TXON 0x1 -#define BOFDM_TXON 0x2 -#define BDEBUG_PAGE 0xfff -#define BDEBUG_ITEM 0xff -#define BANTL 0x10 -#define BANT_NONHT 0x100 -#define BANT_HT1 0x1000 -#define BANT_HT2 0x10000 -#define BANT_HT1S1 0x100000 -#define BANT_NONHTS1 0x1000000 - -#define BCCK_BBMODE 0x3 -#define BCCK_TXPOWERSAVING 0x80 -#define BCCK_RXPOWERSAVING 0x40 - -#define BCCK_SIDEBAND 0x10 - -#define BCCK_SCRAMBLE 0x8 -#define BCCK_ANTDIVERSITY 0x8000 -#define BCCK_CARRIER_RECOVERY 0x4000 -#define BCCK_TXRATE 0x3000 -#define BCCK_DCCANCEL 0x0800 -#define BCCK_ISICANCEL 0x0400 -#define BCCK_MATCH_FILTER 0x0200 -#define BCCK_EQUALIZER 0x0100 -#define BCCK_PREAMBLE_DETECT 0x800000 -#define BCCK_FAST_FALSECCA 0x400000 -#define BCCK_CH_ESTSTART 0x300000 -#define BCCK_CCA_COUNT 0x080000 -#define BCCK_CS_LIM 0x070000 -#define BCCK_BIST_MODE 0x80000000 -#define BCCK_CCAMASK 0x40000000 -#define BCCK_TX_DAC_PHASE 0x4 -#define BCCK_RX_ADC_PHASE 0x20000000 -#define BCCKR_CP_MODE 0x0100 -#define BCCK_TXDC_OFFSET 0xf0 -#define BCCK_RXDC_OFFSET 0xf -#define BCCK_CCA_MODE 0xc000 -#define BCCK_FALSECS_LIM 0x3f00 -#define BCCK_CS_RATIO 0xc00000 -#define BCCK_CORGBIT_SEL 0x300000 -#define BCCK_PD_LIM 0x0f0000 -#define BCCK_NEWCCA 0x80000000 -#define BCCK_RXHP_OF_IG 0x8000 -#define BCCK_RXIG 0x7f00 -#define BCCK_LNA_POLARITY 0x800000 -#define BCCK_RX1ST_BAIN 0x7f0000 -#define BCCK_RF_EXTEND 0x20000000 -#define BCCK_RXAGC_SATLEVEL 0x1f000000 -#define BCCK_RXAGC_SATCOUNT 0xe0 -#define BCCKRXRFSETTLE 0x1f -#define BCCK_FIXED_RXAGC 0x8000 -#define BCCK_ANTENNA_POLARITY 0x2000 -#define BCCK_TXFILTER_TYPE 0x0c00 -#define BCCK_RXAGC_REPORTTYPE 0x0300 -#define BCCK_RXDAGC_EN 0x80000000 -#define BCCK_RXDAGC_PERIOD 0x20000000 -#define BCCK_RXDAGC_SATLEVEL 0x1f000000 -#define BCCK_TIMING_RECOVERY 0x800000 -#define BCCK_TXC0 0x3f0000 -#define BCCK_TXC1 0x3f000000 -#define BCCK_TXC2 0x3f -#define BCCK_TXC3 0x3f00 -#define BCCK_TXC4 0x3f0000 -#define BCCK_TXC5 0x3f000000 -#define BCCK_TXC6 0x3f -#define BCCK_TXC7 0x3f00 -#define BCCK_DEBUGPORT 0xff0000 -#define BCCK_DAC_DEBUG 0x0f000000 -#define BCCK_FALSEALARM_ENABLE 0x8000 -#define BCCK_FALSEALARM_READ 0x4000 -#define BCCK_TRSSI 0x7f -#define BCCK_RXAGC_REPORT 0xfe -#define BCCK_RXREPORT_ANTSEL 0x80000000 -#define BCCK_RXREPORT_MFOFF 0x40000000 -#define BCCK_RXREPORT_SQLOSS 0x20000000 -#define BCCK_RXREPORT_PKTLOSS 0x10000000 -#define BCCK_RXREPORT_LOCKEDBIT 0x08000000 -#define BCCK_RXREPORT_RATEERROR 0x04000000 -#define BCCK_RXREPORT_RXRATE 0x03000000 -#define BCCK_RXFA_COUNTER_LOWER 0xff -#define BCCK_RXFA_COUNTER_UPPER 0xff000000 -#define BCCK_RXHPAGC_START 0xe000 -#define BCCK_RXHPAGC_FINAL 0x1c00 -#define BCCK_RXFALSEALARM_ENABLE 0x8000 -#define BCCK_FACOUNTER_FREEZE 0x4000 -#define BCCK_TXPATH_SEL 0x10000000 -#define BCCK_DEFAULT_RXPATH 0xc000000 -#define BCCK_OPTION_RXPATH 0x3000000 - -#define BNUM_OFSTF 0x3 -#define BSHIFT_L 0xc0 -#define BGI_TH 0xc -#define BRXPATH_A 0x1 -#define BRXPATH_B 0x2 -#define BRXPATH_C 0x4 -#define BRXPATH_D 0x8 -#define BTXPATH_A 0x1 -#define BTXPATH_B 0x2 -#define BTXPATH_C 0x4 -#define BTXPATH_D 0x8 -#define BTRSSI_FREQ 0x200 -#define BADC_BACKOFF 0x3000 -#define BDFIR_BACKOFF 0xc000 -#define BTRSSI_LATCH_PHASE 0x10000 -#define BRX_LDC_OFFSET 0xff -#define BRX_QDC_OFFSET 0xff00 -#define BRX_DFIR_MODE 0x1800000 -#define BRX_DCNF_TYPE 0xe000000 -#define BRXIQIMB_A 0x3ff -#define BRXIQIMB_B 0xfc00 -#define BRXIQIMB_C 0x3f0000 -#define BRXIQIMB_D 0xffc00000 -#define BDC_DC_NOTCH 0x60000 -#define BRXNB_NOTCH 0x1f000000 -#define BPD_TH 0xf -#define BPD_TH_OPT2 0xc000 -#define BPWED_TH 0x700 -#define BIFMF_WIN_L 0x800 -#define BPD_OPTION 0x1000 -#define BMF_WIN_L 0xe000 -#define BBW_SEARCH_L 0x30000 -#define BWIN_ENH_L 0xc0000 -#define BBW_TH 0x700000 -#define BED_TH2 0x3800000 -#define BBW_OPTION 0x4000000 -#define BRADIO_TH 0x18000000 -#define BWINDOW_L 0xe0000000 -#define BSBD_OPTION 0x1 -#define BFRAME_TH 0x1c -#define BFS_OPTION 0x60 -#define BDC_SLOPE_CHECK 0x80 -#define BFGUARD_COUNTER_DC_L 0xe00 -#define BFRAME_WEIGHT_SHORT 0x7000 -#define BSUB_TUNE 0xe00000 -#define BFRAME_DC_LENGTH 0xe000000 -#define BSBD_START_OFFSET 0x30000000 -#define BFRAME_TH_2 0x7 -#define BFRAME_GI2_TH 0x38 -#define BGI2_SYNC_EN 0x40 -#define BSARCH_SHORT_EARLY 0x300 -#define BSARCH_SHORT_LATE 0xc00 -#define BSARCH_GI2_LATE 0x70000 -#define BCFOANTSUM 0x1 -#define BCFOACC 0x2 -#define BCFOSTARTOFFSET 0xc -#define BCFOLOOPBACK 0x70 -#define BCFOSUMWEIGHT 0x80 -#define BDAGCENABLE 0x10000 -#define BTXIQIMB_A 0x3ff -#define BTXIQIMB_B 0xfc00 -#define BTXIQIMB_C 0x3f0000 -#define BTXIQIMB_D 0xffc00000 -#define BTXIDCOFFSET 0xff -#define BTXIQDCOFFSET 0xff00 -#define BTXDFIRMODE 0x10000 -#define BTXPESUDO_NOISEON 0x4000000 -#define BTXPESUDO_NOISE_A 0xff -#define BTXPESUDO_NOISE_B 0xff00 -#define BTXPESUDO_NOISE_C 0xff0000 -#define BTXPESUDO_NOISE_D 0xff000000 -#define BCCA_DROPOPTION 0x20000 -#define BCCA_DROPTHRES 0xfff00000 -#define BEDCCA_H 0xf -#define BEDCCA_L 0xf0 -#define BLAMBDA_ED 0x300 -#define BRX_INITIALGAIN 0x7f -#define BRX_ANTDIV_EN 0x80 -#define BRX_AGC_ADDRESS_FOR_LNA 0x7f00 -#define BRX_HIGHPOWER_FLOW 0x8000 -#define BRX_AGC_FREEZE_THRES 0xc0000 -#define BRX_FREEZESTEP_AGC1 0x300000 -#define BRX_FREEZESTEP_AGC2 0xc00000 -#define BRX_FREEZESTEP_AGC3 0x3000000 -#define BRX_FREEZESTEP_AGC0 0xc000000 -#define BRXRSSI_CMP_EN 0x10000000 -#define BRXQUICK_AGCEN 0x20000000 -#define BRXAGC_FREEZE_THRES_MODE 0x40000000 -#define BRX_OVERFLOW_CHECKTYPE 0x80000000 -#define BRX_AGCSHIFT 0x7f -#define BTRSW_TRI_ONLY 0x80 -#define BPOWER_THRES 0x300 -#define BRXAGC_EN 0x1 -#define BRXAGC_TOGETHER_EN 0x2 -#define BRXAGC_MIN 0x4 -#define BRXHP_INI 0x7 -#define BRXHP_TRLNA 0x70 -#define BRXHP_RSSI 0x700 -#define BRXHP_BBP1 0x7000 -#define BRXHP_BBP2 0x70000 -#define BRXHP_BBP3 0x700000 -#define BRSSI_H 0x7f0000 -#define BRSSI_GEN 0x7f000000 -#define BRXSETTLE_TRSW 0x7 -#define BRXSETTLE_LNA 0x38 -#define BRXSETTLE_RSSI 0x1c0 -#define BRXSETTLE_BBP 0xe00 -#define BRXSETTLE_RXHP 0x7000 -#define BRXSETTLE_ANTSW_RSSI 0x38000 -#define BRXSETTLE_ANTSW 0xc0000 -#define BRXPROCESS_TIME_DAGC 0x300000 -#define BRXSETTLE_HSSI 0x400000 -#define BRXPROCESS_TIME_BBPPW 0x800000 -#define BRXANTENNA_POWER_SHIFT 0x3000000 -#define BRSSI_TABLE_SELECT 0xc000000 -#define BRXHP_FINAL 0x7000000 -#define BRXHPSETTLE_BBP 0x7 -#define BRXHTSETTLE_HSSI 0x8 -#define BRXHTSETTLE_RXHP 0x70 -#define BRXHTSETTLE_BBPPW 0x80 -#define BRXHTSETTLE_IDLE 0x300 -#define BRXHTSETTLE_RESERVED 0x1c00 -#define BRXHT_RXHP_EN 0x8000 -#define BRXAGC_FREEZE_THRES 0x30000 -#define BRXAGC_TOGETHEREN 0x40000 -#define BRXHTAGC_MIN 0x80000 -#define BRXHTAGC_EN 0x100000 -#define BRXHTDAGC_EN 0x200000 -#define BRXHT_RXHP_BBP 0x1c00000 -#define BRXHT_RXHP_FINAL 0xe0000000 -#define BRXPW_RADIO_TH 0x3 -#define BRXPW_RADIO_EN 0x4 -#define BRXMF_HOLD 0x3800 -#define BRXPD_DELAY_TH1 0x38 -#define BRXPD_DELAY_TH2 0x1c0 -#define BRXPD_DC_COUNT_MAX 0x600 -#define BRXPD_DELAY_TH 0x8000 -#define BRXPROCESS_DELAY 0xf0000 -#define BRXSEARCHRANGE_GI2_EARLY 0x700000 -#define BRXFRAME_FUARD_COUNTER_L 0x3800000 -#define BRXSGI_GUARD_L 0xc000000 -#define BRXSGI_SEARCH_L 0x30000000 -#define BRXSGI_TH 0xc0000000 -#define BDFSCNT0 0xff -#define BDFSCNT1 0xff00 -#define BDFSFLAG 0xf0000 -#define BMF_WEIGHT_SUM 0x300000 -#define BMINIDX_TH 0x7f000000 -#define BDAFORMAT 0x40000 -#define BTXCH_EMU_ENABLE 0x01000000 -#define BTRSW_ISOLATION_A 0x7f -#define BTRSW_ISOLATION_B 0x7f00 -#define BTRSW_ISOLATION_C 0x7f0000 -#define BTRSW_ISOLATION_D 0x7f000000 -#define BEXT_LNA_GAIN 0x7c00 - -#define BSTBC_EN 0x4 -#define BANTENNA_MAPPING 0x10 -#define BNSS 0x20 -#define BCFO_ANTSUM_ID 0x200 -#define BPHY_COUNTER_RESET 0x8000000 -#define BCFO_REPORT_GET 0x4000000 -#define BOFDM_CONTINUE_TX 0x10000000 -#define BOFDM_SINGLE_CARRIER 0x20000000 -#define BOFDM_SINGLE_TONE 0x40000000 -#define BHT_DETECT 0x100 -#define BCFOEN 0x10000 -#define BCFOVALUE 0xfff00000 -#define BSIGTONE_RE 0x3f -#define BSIGTONE_IM 0x7f00 -#define BCOUNTER_CCA 0xffff -#define BCOUNTER_PARITYFAIL 0xffff0000 -#define BCOUNTER_RATEILLEGAL 0xffff -#define BCOUNTER_CRC8FAIL 0xffff0000 -#define BCOUNTER_MCSNOSUPPORT 0xffff -#define BCOUNTER_FASTSYNC 0xffff -#define BSHORTCFO 0xfff -#define BSHORTCFOT_LENGTH 12 -#define BSHORTCFOF_LENGTH 11 -#define BLONGCFO 0x7ff -#define BLONGCFOT_LENGTH 11 -#define BLONGCFOF_LENGTH 11 -#define BTAILCFO 0x1fff -#define BTAILCFOT_LENGTH 13 -#define BTAILCFOF_LENGTH 12 -#define BNOISE_EN_PWDB 0xffff -#define BCC_POWER_DB 0xffff0000 -#define BMOISE_PWDB 0xffff -#define BPOWERMEAST_LENGTH 10 -#define BPOWERMEASF_LENGTH 3 -#define BRX_HT_BW 0x1 -#define BRXSC 0x6 -#define BRX_HT 0x8 -#define BNB_INTF_DET_ON 0x1 -#define BINTF_WIN_LEN_CFG 0x30 -#define BNB_INTF_TH_CFG 0x1c0 -#define BRFGAIN 0x3f -#define BTABLESEL 0x40 -#define BTRSW 0x80 -#define BRXSNR_A 0xff -#define BRXSNR_B 0xff00 -#define BRXSNR_C 0xff0000 -#define BRXSNR_D 0xff000000 -#define BSNR_EVMT_LENGTH 8 -#define BSNR_EVMF_LENGTH 1 -#define BCSI1ST 0xff -#define BCSI2ND 0xff00 -#define BRXEVM1ST 0xff0000 -#define BRXEVM2ND 0xff000000 -#define BSIGEVM 0xff -#define BPWDB 0xff00 -#define BSGIEN 0x10000 - -#define BSFACTOR_QMA1 0xf -#define BSFACTOR_QMA2 0xf0 -#define BSFACTOR_QMA3 0xf00 -#define BSFACTOR_QMA4 0xf000 -#define BSFACTOR_QMA5 0xf0000 -#define BSFACTOR_QMA6 0xf0000 -#define BSFACTOR_QMA7 0xf00000 -#define BSFACTOR_QMA8 0xf000000 -#define BSFACTOR_QMA9 0xf0000000 -#define BCSI_SCHEME 0x100000 - -#define BNOISE_LVL_TOP_SET 0x3 -#define BCHSMOOTH 0x4 -#define BCHSMOOTH_CFG1 0x38 -#define BCHSMOOTH_CFG2 0x1c0 -#define BCHSMOOTH_CFG3 0xe00 -#define BCHSMOOTH_CFG4 0x7000 -#define BMRCMODE 0x800000 -#define BTHEVMCFG 0x7000000 - -#define BLOOP_FIT_TYPE 0x1 -#define BUPD_CFO 0x40 -#define BUPD_CFO_OFFDATA 0x80 -#define BADV_UPD_CFO 0x100 -#define BADV_TIME_CTRL 0x800 -#define BUPD_CLKO 0x1000 -#define BFC 0x6000 -#define BTRACKING_MODE 0x8000 -#define BPHCMP_ENABLE 0x10000 -#define BUPD_CLKO_LTF 0x20000 -#define BCOM_CH_CFO 0x40000 -#define BCSI_ESTI_MODE 0x80000 -#define BADV_UPD_EQZ 0x100000 -#define BUCHCFG 0x7000000 -#define BUPDEQZ 0x8000000 - -#define BRX_PESUDO_NOISE_ON 0x20000000 -#define BRX_PESUDO_NOISE_A 0xff -#define BRX_PESUDO_NOISE_B 0xff00 -#define BRX_PESUDO_NOISE_C 0xff0000 -#define BRX_PESUDO_NOISE_D 0xff000000 -#define BRX_PESUDO_NOISESTATE_A 0xffff -#define BRX_PESUDO_NOISESTATE_B 0xffff0000 -#define BRX_PESUDO_NOISESTATE_C 0xffff -#define BRX_PESUDO_NOISESTATE_D 0xffff0000 - -#define BZEBRA1_HSSIENABLE 0x8 -#define BZEBRA1_TRXCONTROL 0xc00 -#define BZEBRA1_TRXGAINSETTING 0x07f -#define BZEBRA1_RXCOUNTER 0xc00 -#define BZEBRA1_TXCHANGEPUMP 0x38 -#define BZEBRA1_RXCHANGEPUMP 0x7 -#define BZEBRA1_CHANNEL_NUM 0xf80 -#define BZEBRA1_TXLPFBW 0x400 -#define BZEBRA1_RXLPFBW 0x600 - -#define BRTL8256REG_MODE_CTRL1 0x100 -#define BRTL8256REG_MODE_CTRL0 0x40 -#define BRTL8256REG_TXLPFBW 0x18 -#define BRTL8256REG_RXLPFBW 0x600 - -#define BRTL8258_TXLPFBW 0xc -#define BRTL8258_RXLPFBW 0xc00 -#define BRTL8258_RSSILPFBW 0xc0 - -#define BBYTE0 0x1 -#define BBYTE1 0x2 -#define BBYTE2 0x4 -#define BBYTE3 0x8 -#define BWORD0 0x3 -#define BWORD1 0xc -#define BWORD 0xf - -#define MASKBYTE0 0xff -#define MASKBYTE1 0xff00 -#define MASKBYTE2 0xff0000 -#define MASKBYTE3 0xff000000 -#define MASKHWORD 0xffff0000 -#define MASKLWORD 0x0000ffff -#define MASKDWORD 0xffffffff -#define MASK12BITS 0xfff -#define MASKH4BITS 0xf0000000 -#define MASKOFDM_D 0xffc00000 -#define MASKCCK 0x3f3f3f3f - -#define MASK4BITS 0x0f -#define MASK20BITS 0xfffff -#define RFREG_OFFSET_MASK 0xfffff - -#define BENABLE 0x1 -#define BDISABLE 0x0 - -#define LEFT_ANTENNA 0x0 -#define RIGHT_ANTENNA 0x1 - -#define TCHECK_TXSTATUS 500 -#define TUPDATE_RXCOUNTER 100 - -#define REG_UN_USED_REGISTER 0x01bf - -/* WOL bit information */ -#define HAL92C_WOL_PTK_UPDATE_EVENT BIT(0) -#define HAL92C_WOL_GTK_UPDATE_EVENT BIT(1) -#define HAL92C_WOL_DISASSOC_EVENT BIT(2) -#define HAL92C_WOL_DEAUTH_EVENT BIT(3) -#define HAL92C_WOL_FW_DISCONNECT_EVENT BIT(4) - -#define WOL_REASON_PTK_UPDATE BIT(0) -#define WOL_REASON_GTK_UPDATE BIT(1) -#define WOL_REASON_DISASSOC BIT(2) -#define WOL_REASON_DEAUTH BIT(3) -#define WOL_REASON_FW_DISCONNECT BIT(4) - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/rf.c b/drivers/net/wireless/rtlwifi/rtl8188ee/rf.c deleted file mode 100644 index 4faafdbab9c6..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/rf.c +++ /dev/null @@ -1,467 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" - -void rtl88e_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - switch (bandwidth) { - case HT_CHANNEL_WIDTH_20: - rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] & - 0xfffff3ff) | BIT(10) | BIT(11)); - rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK, - rtlphy->rfreg_chnlval[0]); - break; - case HT_CHANNEL_WIDTH_20_40: - rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] & - 0xfffff3ff) | BIT(10)); - rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK, - rtlphy->rfreg_chnlval[0]); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", bandwidth); - break; - } -} - -void rtl88e_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, - u8 *plevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u32 tx_agc[2] = {0, 0}, tmpval; - bool turbo_scanoff = false; - u8 idx1, idx2; - u8 *ptr; - u8 direction; - u32 pwrtrac_value; - - if (rtlefuse->eeprom_regulatory != 0) - turbo_scanoff = true; - - if (mac->act_scanning == true) { - tx_agc[RF90_PATH_A] = 0x3f3f3f3f; - tx_agc[RF90_PATH_B] = 0x3f3f3f3f; - - if (turbo_scanoff) { - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - tx_agc[idx1] = plevel[idx1] | - (plevel[idx1] << 8) | - (plevel[idx1] << 16) | - (plevel[idx1] << 24); - } - } - } else { - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - tx_agc[idx1] = plevel[idx1] | (plevel[idx1] << 8) | - (plevel[idx1] << 16) | - (plevel[idx1] << 24); - } - - if (rtlefuse->eeprom_regulatory == 0) { - tmpval = (rtlphy->mcs_offset[0][6]) + - (rtlphy->mcs_offset[0][7] << 8); - tx_agc[RF90_PATH_A] += tmpval; - - tmpval = (rtlphy->mcs_offset[0][14]) + - (rtlphy->mcs_offset[0][15] << 24); - tx_agc[RF90_PATH_B] += tmpval; - } - } - - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - ptr = (u8 *)(&(tx_agc[idx1])); - for (idx2 = 0; idx2 < 4; idx2++) { - if (*ptr > RF6052_MAX_TX_PWR) - *ptr = RF6052_MAX_TX_PWR; - ptr++; - } - } - rtl88e_dm_txpower_track_adjust(hw, 1, &direction, &pwrtrac_value); - if (direction == 1) { - tx_agc[0] += pwrtrac_value; - tx_agc[1] += pwrtrac_value; - } else if (direction == 2) { - tx_agc[0] -= pwrtrac_value; - tx_agc[1] -= pwrtrac_value; - } - tmpval = tx_agc[RF90_PATH_A] & 0xff; - rtl_set_bbreg(hw, RTXAGC_A_CCK1_MCS32, MASKBYTE1, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, - RTXAGC_A_CCK1_MCS32); - - tmpval = tx_agc[RF90_PATH_A] >> 8; - - rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, - RTXAGC_B_CCK11_A_CCK2_11); - - tmpval = tx_agc[RF90_PATH_B] >> 24; - rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, MASKBYTE0, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n", tmpval, - RTXAGC_B_CCK11_A_CCK2_11); - - tmpval = tx_agc[RF90_PATH_B] & 0x00ffffff; - rtl_set_bbreg(hw, RTXAGC_B_CCK1_55_MCS32, 0xffffff00, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n", tmpval, - RTXAGC_B_CCK1_55_MCS32); -} - -static void rtl88e_phy_get_power_base(struct ieee80211_hw *hw, - u8 *pwrlvlofdm, u8 *pwrlvlbw20, - u8 *pwrlvlbw40, u8 channel, - u32 *ofdmbase, u32 *mcsbase) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 base0, base1; - u8 i, powerlevel[2]; - - for (i = 0; i < 2; i++) { - base0 = pwrlvlofdm[i]; - - base0 = (base0 << 24) | (base0 << 16) | - (base0 << 8) | base0; - *(ofdmbase + i) = base0; - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "[OFDM power base index rf(%c) = 0x%x]\n", - ((i == 0) ? 'A' : 'B'), *(ofdmbase + i)); - } - - for (i = 0; i < 2; i++) { - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) - powerlevel[i] = pwrlvlbw20[i]; - else - powerlevel[i] = pwrlvlbw40[i]; - base1 = powerlevel[i]; - base1 = (base1 << 24) | - (base1 << 16) | (base1 << 8) | base1; - - *(mcsbase + i) = base1; - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "[MCS power base index rf(%c) = 0x%x]\n", - ((i == 0) ? 'A' : 'B'), *(mcsbase + i)); - } -} - -static void get_txpwr_by_reg(struct ieee80211_hw *hw, u8 chan, u8 index, - u32 *base0, u32 *base1, u32 *outval) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 i, chg = 0, pwr_lim[4], pwr_diff = 0, cust_pwr_dif; - u32 writeval, cust_lim, rf, tmp; - u8 ch = chan - 1; - u8 j; - - for (rf = 0; rf < 2; rf++) { - j = index + (rf ? 8 : 0); - tmp = ((index < 2) ? base0[rf] : base1[rf]); - switch (rtlefuse->eeprom_regulatory) { - case 0: - chg = 0; - - writeval = rtlphy->mcs_offset[chg][j] + tmp; - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "RTK better performance, " - "writeval(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeval); - break; - case 1: - if (rtlphy->pwrgroup_cnt == 1) { - chg = 0; - } else { - chg = chan / 3; - if (chan == 14) - chg = 5; - } - writeval = rtlphy->mcs_offset[chg][j] + tmp; - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Realtek regulatory, 20MHz, writeval(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeval); - break; - case 2: - writeval = ((index < 2) ? base0[rf] : base1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Better regulatory, writeval(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeval); - break; - case 3: - chg = 0; - - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "customer's limit, 40MHz rf(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), - rtlefuse->pwrgroup_ht40[rf][ch]); - } else { - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "customer's limit, 20MHz rf(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), - rtlefuse->pwrgroup_ht20[rf][ch]); - } - - if (index < 2) - pwr_diff = rtlefuse->txpwr_legacyhtdiff[rf][ch]; - else if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) - pwr_diff = rtlefuse->txpwr_ht20diff[rf][ch]; - - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) - cust_pwr_dif = rtlefuse->pwrgroup_ht40[rf][ch]; - else - cust_pwr_dif = rtlefuse->pwrgroup_ht20[rf][ch]; - - if (pwr_diff > cust_pwr_dif) - pwr_diff = 0; - else - pwr_diff = cust_pwr_dif - pwr_diff; - - for (i = 0; i < 4; i++) { - pwr_lim[i] = (u8)((rtlphy->mcs_offset[chg][j] & - (0x7f << (i * 8))) >> (i * 8)); - - if (pwr_lim[i] > pwr_diff) - pwr_lim[i] = pwr_diff; - } - - cust_lim = (pwr_lim[3] << 24) | (pwr_lim[2] << 16) | - (pwr_lim[1] << 8) | (pwr_lim[0]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Customer's limit rf(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), cust_lim); - - writeval = cust_lim + tmp; - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Customer, writeval rf(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeval); - break; - default: - chg = 0; - writeval = rtlphy->mcs_offset[chg][j] + tmp; - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "RTK better performance, writeval " - "rf(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeval); - break; - } - - if (rtlpriv->dm.dynamic_txhighpower_lvl == TXHIGHPWRLEVEL_BT1) - writeval = writeval - 0x06060606; - else if (rtlpriv->dm.dynamic_txhighpower_lvl == - TXHIGHPWRLEVEL_BT2) - writeval -= 0x0c0c0c0c; - *(outval + rf) = writeval; - } -} - -static void write_ofdm_pwr(struct ieee80211_hw *hw, u8 index, u32 *pvalue) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u16 regoffset_a[6] = { - RTXAGC_A_RATE18_06, RTXAGC_A_RATE54_24, - RTXAGC_A_MCS03_MCS00, RTXAGC_A_MCS07_MCS04, - RTXAGC_A_MCS11_MCS08, RTXAGC_A_MCS15_MCS12 - }; - u16 regoffset_b[6] = { - RTXAGC_B_RATE18_06, RTXAGC_B_RATE54_24, - RTXAGC_B_MCS03_MCS00, RTXAGC_B_MCS07_MCS04, - RTXAGC_B_MCS11_MCS08, RTXAGC_B_MCS15_MCS12 - }; - u8 i, rf, pwr_val[4]; - u32 writeval; - u16 regoffset; - - for (rf = 0; rf < 2; rf++) { - writeval = pvalue[rf]; - for (i = 0; i < 4; i++) { - pwr_val[i] = (u8) ((writeval & (0x7f << - (i * 8))) >> (i * 8)); - - if (pwr_val[i] > RF6052_MAX_TX_PWR) - pwr_val[i] = RF6052_MAX_TX_PWR; - } - writeval = (pwr_val[3] << 24) | (pwr_val[2] << 16) | - (pwr_val[1] << 8) | pwr_val[0]; - - if (rf == 0) - regoffset = regoffset_a[index]; - else - regoffset = regoffset_b[index]; - rtl_set_bbreg(hw, regoffset, MASKDWORD, writeval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Set 0x%x = %08x\n", regoffset, writeval); - } -} - -void rtl88e_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, - u8 *pwrlvlofdm, - u8 *pwrlvlbw20, - u8 *pwrlvlbw40, u8 chan) -{ - u32 writeval[2], base0[2], base1[2]; - u8 index; - u8 direction; - u32 pwrtrac_value; - - rtl88e_phy_get_power_base(hw, pwrlvlofdm, pwrlvlbw20, - pwrlvlbw40, chan, &base0[0], - &base1[0]); - - rtl88e_dm_txpower_track_adjust(hw, 1, &direction, &pwrtrac_value); - - for (index = 0; index < 6; index++) { - get_txpwr_by_reg(hw, chan, index, &base0[0], &base1[0], - &writeval[0]); - if (direction == 1) { - writeval[0] += pwrtrac_value; - writeval[1] += pwrtrac_value; - } else if (direction == 2) { - writeval[0] -= pwrtrac_value; - writeval[1] -= pwrtrac_value; - } - write_ofdm_pwr(hw, index, &writeval[0]); - } -} - -static bool rf6052_conf_para(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 u4val = 0; - u8 rfpath; - bool rtstatus = true; - struct bb_reg_def *pphyreg; - - for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) { - pphyreg = &rtlphy->phyreg_def[rfpath]; - - switch (rfpath) { - case RF90_PATH_A: - case RF90_PATH_C: - u4val = rtl_get_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV); - break; - case RF90_PATH_B: - case RF90_PATH_D: - u4val = rtl_get_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV << 16); - break; - } - - rtl_set_bbreg(hw, pphyreg->rfintfe, BRFSI_RFENV << 16, 0x1); - udelay(1); - - rtl_set_bbreg(hw, pphyreg->rfintfo, BRFSI_RFENV, 0x1); - udelay(1); - - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, - B3WIREADDREAALENGTH, 0x0); - udelay(1); - - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, B3WIREDATALENGTH, 0x0); - udelay(1); - - switch (rfpath) { - case RF90_PATH_A: - rtstatus = rtl88e_phy_config_rf_with_headerfile(hw, - (enum radio_path)rfpath); - break; - case RF90_PATH_B: - rtstatus = rtl88e_phy_config_rf_with_headerfile(hw, - (enum radio_path)rfpath); - break; - case RF90_PATH_C: - break; - case RF90_PATH_D: - break; - } - - switch (rfpath) { - case RF90_PATH_A: - case RF90_PATH_C: - rtl_set_bbreg(hw, pphyreg->rfintfs, BRFSI_RFENV, u4val); - break; - case RF90_PATH_B: - case RF90_PATH_D: - rtl_set_bbreg(hw, pphyreg->rfintfs, BRFSI_RFENV << 16, - u4val); - break; - } - - if (rtstatus != true) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Radio[%d] Fail!!", rfpath); - return false; - } - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "\n"); - return rtstatus; -} - -bool rtl88e_phy_rf6052_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - if (rtlphy->rf_type == RF_1T1R) - rtlphy->num_total_rfpath = 1; - else - rtlphy->num_total_rfpath = 2; - - return rf6052_conf_para(hw); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/rf.h b/drivers/net/wireless/rtlwifi/rtl8188ee/rf.h deleted file mode 100644 index a39a2a3dbcc9..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/rf.h +++ /dev/null @@ -1,46 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C_RF_H__ -#define __RTL92C_RF_H__ - -#define RF6052_MAX_TX_PWR 0x3F -#define RF6052_MAX_REG 0x3F - -void rtl88e_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, - u8 bandwidth); -void rtl88e_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel); -void rtl88e_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel_ofdm, - u8 *ppowerlevel_bw20, - u8 *ppowerlevel_bw40, u8 channel); -bool rtl88e_phy_rf6052_config(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c b/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c deleted file mode 100644 index c254693a1e6a..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c +++ /dev/null @@ -1,400 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../core.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "hw.h" -#include "sw.h" -#include "trx.h" -#include "led.h" -#include "table.h" - -#include -#include - -static void rtl88e_init_aspm_vars(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - /*close ASPM for AMD defaultly */ - rtlpci->const_amdpci_aspm = 0; - - /* ASPM PS mode. - * 0 - Disable ASPM, - * 1 - Enable ASPM without Clock Req, - * 2 - Enable ASPM with Clock Req, - * 3 - Alwyas Enable ASPM with Clock Req, - * 4 - Always Enable ASPM without Clock Req. - * set defult to RTL8192CE:3 RTL8192E:2 - */ - rtlpci->const_pci_aspm = 3; - - /*Setting for PCI-E device */ - rtlpci->const_devicepci_aspm_setting = 0x03; - - /*Setting for PCI-E bridge */ - rtlpci->const_hostpci_aspm_setting = 0x02; - - /* In Hw/Sw Radio Off situation. - * 0 - Default, - * 1 - From ASPM setting without low Mac Pwr, - * 2 - From ASPM setting with low Mac Pwr, - * 3 - Bus D3 - * set default to RTL8192CE:0 RTL8192SE:2 - */ - rtlpci->const_hwsw_rfoff_d3 = 0; - - /* This setting works for those device with - * backdoor ASPM setting such as EPHY setting. - * 0 - Not support ASPM, - * 1 - Support ASPM, - * 2 - According to chipset. - */ - rtlpci->const_support_pciaspm = 1; -} - -int rtl88e_init_sw_vars(struct ieee80211_hw *hw) -{ - int err = 0; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u8 tid; - - rtl8188ee_bt_reg_init(hw); - - rtlpriv->dm.dm_initialgain_enable = 1; - rtlpriv->dm.dm_flag = 0; - rtlpriv->dm.disable_framebursting = 0; - rtlpriv->dm.thermalvalue = 0; - rtlpci->transmit_config = CFENDFORM | BIT(15); - - /* compatible 5G band 88ce just 2.4G band & smsp */ - rtlpriv->rtlhal.current_bandtype = BAND_ON_2_4G; - rtlpriv->rtlhal.bandset = BAND_ON_2_4G; - rtlpriv->rtlhal.macphymode = SINGLEMAC_SINGLEPHY; - - rtlpci->receive_config = (RCR_APPFCS | - RCR_APP_MIC | - RCR_APP_ICV | - RCR_APP_PHYST_RXFF | - RCR_HTC_LOC_CTRL | - RCR_AMF | - RCR_ACF | - RCR_ADF | - RCR_AICV | - RCR_ACRC32 | - RCR_AB | - RCR_AM | - RCR_APM | - 0); - - rtlpci->irq_mask[0] = - (u32) (IMR_PSTIMEOUT | - IMR_HSISR_IND_ON_INT | - IMR_C2HCMD | - IMR_HIGHDOK | - IMR_MGNTDOK | - IMR_BKDOK | - IMR_BEDOK | - IMR_VIDOK | - IMR_VODOK | - IMR_RDU | - IMR_ROK | - 0); - rtlpci->irq_mask[1] = (u32) (IMR_RXFOVW | 0); - rtlpci->sys_irq_mask = (u32) (HSIMR_PDN_INT_EN | HSIMR_RON_INT_EN); - - /* for debug level */ - rtlpriv->dbg.global_debuglevel = rtlpriv->cfg->mod_params->debug; - /* for LPS & IPS */ - rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps; - rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; - rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; - if (!rtlpriv->psc.inactiveps) - pr_info("rtl8188ee: Power Save off (module option)\n"); - if (!rtlpriv->psc.fwctrl_lps) - pr_info("rtl8188ee: FW Power Save off (module option)\n"); - rtlpriv->psc.reg_fwctrl_lps = 3; - rtlpriv->psc.reg_max_lps_awakeintvl = 5; - /* for ASPM, you can close aspm through - * set const_support_pciaspm = 0 - */ - rtl88e_init_aspm_vars(hw); - - if (rtlpriv->psc.reg_fwctrl_lps == 1) - rtlpriv->psc.fwctrl_psmode = FW_PS_MIN_MODE; - else if (rtlpriv->psc.reg_fwctrl_lps == 2) - rtlpriv->psc.fwctrl_psmode = FW_PS_MAX_MODE; - else if (rtlpriv->psc.reg_fwctrl_lps == 3) - rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE; - - /* for firmware buf */ - rtlpriv->rtlhal.pfirmware = vmalloc(0x8000); - if (!rtlpriv->rtlhal.pfirmware) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Can't alloc buffer for fw.\n"); - return 1; - } - - rtlpriv->cfg->fw_name = "rtlwifi/rtl8188efw.bin"; - rtlpriv->max_fw_size = 0x8000; - pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name); - err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Failed to request firmware!\n"); - return 1; - } - - /* for early mode */ - rtlpriv->rtlhal.earlymode_enable = false; - rtlpriv->rtlhal.max_earlymode_num = 10; - for (tid = 0; tid < 8; tid++) - skb_queue_head_init(&rtlpriv->mac80211.skb_waitq[tid]); - - /*low power */ - rtlpriv->psc.low_power_enable = false; - if (rtlpriv->psc.low_power_enable) { - init_timer(&rtlpriv->works.fw_clockoff_timer); - setup_timer(&rtlpriv->works.fw_clockoff_timer, - rtl88ee_fw_clk_off_timer_callback, - (unsigned long)hw); - } - - init_timer(&rtlpriv->works.fast_antenna_training_timer); - setup_timer(&rtlpriv->works.fast_antenna_training_timer, - rtl88e_dm_fast_antenna_training_callback, - (unsigned long)hw); - return err; -} - -void rtl88e_deinit_sw_vars(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->rtlhal.pfirmware) { - vfree(rtlpriv->rtlhal.pfirmware); - rtlpriv->rtlhal.pfirmware = NULL; - } - - if (rtlpriv->psc.low_power_enable) - del_timer_sync(&rtlpriv->works.fw_clockoff_timer); - - del_timer_sync(&rtlpriv->works.fast_antenna_training_timer); -} - -static struct rtl_hal_ops rtl8188ee_hal_ops = { - .init_sw_vars = rtl88e_init_sw_vars, - .deinit_sw_vars = rtl88e_deinit_sw_vars, - .read_eeprom_info = rtl88ee_read_eeprom_info, - .interrupt_recognized = rtl88ee_interrupt_recognized,/*need check*/ - .hw_init = rtl88ee_hw_init, - .hw_disable = rtl88ee_card_disable, - .hw_suspend = rtl88ee_suspend, - .hw_resume = rtl88ee_resume, - .enable_interrupt = rtl88ee_enable_interrupt, - .disable_interrupt = rtl88ee_disable_interrupt, - .set_network_type = rtl88ee_set_network_type, - .set_chk_bssid = rtl88ee_set_check_bssid, - .set_qos = rtl88ee_set_qos, - .set_bcn_reg = rtl88ee_set_beacon_related_registers, - .set_bcn_intv = rtl88ee_set_beacon_interval, - .update_interrupt_mask = rtl88ee_update_interrupt_mask, - .get_hw_reg = rtl88ee_get_hw_reg, - .set_hw_reg = rtl88ee_set_hw_reg, - .update_rate_tbl = rtl88ee_update_hal_rate_tbl, - .fill_tx_desc = rtl88ee_tx_fill_desc, - .fill_tx_cmddesc = rtl88ee_tx_fill_cmddesc, - .query_rx_desc = rtl88ee_rx_query_desc, - .set_channel_access = rtl88ee_update_channel_access_setting, - .radio_onoff_checking = rtl88ee_gpio_radio_on_off_checking, - .set_bw_mode = rtl88e_phy_set_bw_mode, - .switch_channel = rtl88e_phy_sw_chnl, - .dm_watchdog = rtl88e_dm_watchdog, - .scan_operation_backup = rtl88e_phy_scan_operation_backup, - .set_rf_power_state = rtl88e_phy_set_rf_power_state, - .led_control = rtl88ee_led_control, - .set_desc = rtl88ee_set_desc, - .get_desc = rtl88ee_get_desc, - .tx_polling = rtl88ee_tx_polling, - .enable_hw_sec = rtl88ee_enable_hw_security_config, - .set_key = rtl88ee_set_key, - .init_sw_leds = rtl88ee_init_sw_leds, - .allow_all_destaddr = rtl88ee_allow_all_destaddr, - .get_bbreg = rtl88e_phy_query_bb_reg, - .set_bbreg = rtl88e_phy_set_bb_reg, - .get_rfreg = rtl88e_phy_query_rf_reg, - .set_rfreg = rtl88e_phy_set_rf_reg, -}; - -static struct rtl_mod_params rtl88ee_mod_params = { - .sw_crypto = false, - .inactiveps = true, - .swctrl_lps = false, - .fwctrl_lps = true, - .debug = DBG_EMERG, -}; - -static struct rtl_hal_cfg rtl88ee_hal_cfg = { - .bar_id = 2, - .write_readback = true, - .name = "rtl88e_pci", - .ops = &rtl8188ee_hal_ops, - .mod_params = &rtl88ee_mod_params, - - .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, - .maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN, - .maps[SYS_CLK] = REG_SYS_CLKR, - .maps[MAC_RCR_AM] = AM, - .maps[MAC_RCR_AB] = AB, - .maps[MAC_RCR_ACRC32] = ACRC32, - .maps[MAC_RCR_ACF] = ACF, - .maps[MAC_RCR_AAP] = AAP, - - .maps[EFUSE_ACCESS] = REG_EFUSE_ACCESS, - - .maps[EFUSE_TEST] = REG_EFUSE_TEST, - .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, - .maps[EFUSE_CLK] = 0, - .maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL, - .maps[EFUSE_PWC_EV12V] = PWC_EV12V, - .maps[EFUSE_FEN_ELDR] = FEN_ELDR, - .maps[EFUSE_LOADER_CLK_EN] = LOADER_CLK_EN, - .maps[EFUSE_ANA8M] = ANA8M, - .maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE, - .maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION, - .maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN, - .maps[EFUSE_OOB_PROTECT_BYTES_LEN] = EFUSE_OOB_PROTECT_BYTES, - - .maps[RWCAM] = REG_CAMCMD, - .maps[WCAMI] = REG_CAMWRITE, - .maps[RCAMO] = REG_CAMREAD, - .maps[CAMDBG] = REG_CAMDBG, - .maps[SECR] = REG_SECCFG, - .maps[SEC_CAM_NONE] = CAM_NONE, - .maps[SEC_CAM_WEP40] = CAM_WEP40, - .maps[SEC_CAM_TKIP] = CAM_TKIP, - .maps[SEC_CAM_AES] = CAM_AES, - .maps[SEC_CAM_WEP104] = CAM_WEP104, - - .maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6, - .maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5, - .maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4, - .maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3, - .maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2, - .maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1, -/* .maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8, */ /*need check*/ - .maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7, - .maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6, - .maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5, - .maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4, - .maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3, - .maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2, - .maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1, -/* .maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2,*/ -/* .maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1,*/ - - .maps[RTL_IMR_TXFOVW] = IMR_TXFOVW, - .maps[RTL_IMR_PSTIMEOUT] = IMR_PSTIMEOUT, - .maps[RTL_IMR_BCNINT] = IMR_BCNDMAINT0, - .maps[RTL_IMR_RXFOVW] = IMR_RXFOVW, - .maps[RTL_IMR_RDU] = IMR_RDU, - .maps[RTL_IMR_ATIMEND] = IMR_ATIMEND, - .maps[RTL_IMR_BDOK] = IMR_BCNDOK0, - .maps[RTL_IMR_MGNTDOK] = IMR_MGNTDOK, - .maps[RTL_IMR_TBDER] = IMR_TBDER, - .maps[RTL_IMR_HIGHDOK] = IMR_HIGHDOK, - .maps[RTL_IMR_TBDOK] = IMR_TBDOK, - .maps[RTL_IMR_BKDOK] = IMR_BKDOK, - .maps[RTL_IMR_BEDOK] = IMR_BEDOK, - .maps[RTL_IMR_VIDOK] = IMR_VIDOK, - .maps[RTL_IMR_VODOK] = IMR_VODOK, - .maps[RTL_IMR_ROK] = IMR_ROK, - .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNDMAINT0 | IMR_TBDOK | IMR_TBDER), - - .maps[RTL_RC_CCK_RATE1M] = DESC92C_RATE1M, - .maps[RTL_RC_CCK_RATE2M] = DESC92C_RATE2M, - .maps[RTL_RC_CCK_RATE5_5M] = DESC92C_RATE5_5M, - .maps[RTL_RC_CCK_RATE11M] = DESC92C_RATE11M, - .maps[RTL_RC_OFDM_RATE6M] = DESC92C_RATE6M, - .maps[RTL_RC_OFDM_RATE9M] = DESC92C_RATE9M, - .maps[RTL_RC_OFDM_RATE12M] = DESC92C_RATE12M, - .maps[RTL_RC_OFDM_RATE18M] = DESC92C_RATE18M, - .maps[RTL_RC_OFDM_RATE24M] = DESC92C_RATE24M, - .maps[RTL_RC_OFDM_RATE36M] = DESC92C_RATE36M, - .maps[RTL_RC_OFDM_RATE48M] = DESC92C_RATE48M, - .maps[RTL_RC_OFDM_RATE54M] = DESC92C_RATE54M, - - .maps[RTL_RC_HT_RATEMCS7] = DESC92C_RATEMCS7, - .maps[RTL_RC_HT_RATEMCS15] = DESC92C_RATEMCS15, -}; - -static DEFINE_PCI_DEVICE_TABLE(rtl88ee_pci_ids) = { - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8179, rtl88ee_hal_cfg)}, - {}, -}; - -MODULE_DEVICE_TABLE(pci, rtl88ee_pci_ids); - -MODULE_AUTHOR("zhiyuan_yang "); -MODULE_AUTHOR("Realtek WlanFAE "); -MODULE_AUTHOR("Larry Finger "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Realtek 8188E 802.11n PCI wireless"); -MODULE_FIRMWARE("rtlwifi/rtl8188efw.bin"); - -module_param_named(swenc, rtl88ee_mod_params.sw_crypto, bool, 0444); -module_param_named(debug, rtl88ee_mod_params.debug, int, 0444); -module_param_named(ips, rtl88ee_mod_params.inactiveps, bool, 0444); -module_param_named(swlps, rtl88ee_mod_params.swctrl_lps, bool, 0444); -module_param_named(fwlps, rtl88ee_mod_params.fwctrl_lps, bool, 0444); -MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); -MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); -MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); -MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); -MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); - -static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); - -static struct pci_driver rtl88ee_driver = { - .name = KBUILD_MODNAME, - .id_table = rtl88ee_pci_ids, - .probe = rtl_pci_probe, - .remove = rtl_pci_disconnect, - .driver.pm = &rtlwifi_pm_ops, -}; - -module_pci_driver(rtl88ee_driver); diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/sw.h b/drivers/net/wireless/rtlwifi/rtl8188ee/sw.h deleted file mode 100644 index 85e02b3bdff8..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/sw.h +++ /dev/null @@ -1,36 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CE_SW_H__ -#define __RTL92CE_SW_H__ - -int rtl88e_init_sw_vars(struct ieee80211_hw *hw); -void rtl88e_deinit_sw_vars(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/table.c b/drivers/net/wireless/rtlwifi/rtl8188ee/table.c deleted file mode 100644 index fad373f97b2c..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/table.c +++ /dev/null @@ -1,643 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Created on 2010/ 5/18, 1:41 - * - * Larry Finger - * - *****************************************************************************/ - -#include "table.h" - -u32 RTL8188EEPHY_REG_1TARRAY[] = { - 0x800, 0x80040000, - 0x804, 0x00000003, - 0x808, 0x0000FC00, - 0x80C, 0x0000000A, - 0x810, 0x10001331, - 0x814, 0x020C3D10, - 0x818, 0x02200385, - 0x81C, 0x00000000, - 0x820, 0x01000100, - 0x824, 0x00390204, - 0x828, 0x00000000, - 0x82C, 0x00000000, - 0x830, 0x00000000, - 0x834, 0x00000000, - 0x838, 0x00000000, - 0x83C, 0x00000000, - 0x840, 0x00010000, - 0x844, 0x00000000, - 0x848, 0x00000000, - 0x84C, 0x00000000, - 0x850, 0x00000000, - 0x854, 0x00000000, - 0x858, 0x569A11A9, - 0x85C, 0x01000014, - 0x860, 0x66F60110, - 0x864, 0x061F0649, - 0x868, 0x00000000, - 0x86C, 0x27272700, - 0x870, 0x07000760, - 0x874, 0x25004000, - 0x878, 0x00000808, - 0x87C, 0x00000000, - 0x880, 0xB0000C1C, - 0x884, 0x00000001, - 0x888, 0x00000000, - 0x88C, 0xCCC000C0, - 0x890, 0x00000800, - 0x894, 0xFFFFFFFE, - 0x898, 0x40302010, - 0x89C, 0x00706050, - 0x900, 0x00000000, - 0x904, 0x00000023, - 0x908, 0x00000000, - 0x90C, 0x81121111, - 0x910, 0x00000002, - 0x914, 0x00000201, - 0xA00, 0x00D047C8, - 0xA04, 0x80FF000C, - 0xA08, 0x8C838300, - 0xA0C, 0x2E7F120F, - 0xA10, 0x9500BB78, - 0xA14, 0x1114D028, - 0xA18, 0x00881117, - 0xA1C, 0x89140F00, - 0xA20, 0x1A1B0000, - 0xA24, 0x090E1317, - 0xA28, 0x00000204, - 0xA2C, 0x00D30000, - 0xA70, 0x101FBF00, - 0xA74, 0x00000007, - 0xA78, 0x00000900, - 0xA7C, 0x225B0606, - 0xA80, 0x218075B1, - 0xB2C, 0x80000000, - 0xC00, 0x48071D40, - 0xC04, 0x03A05611, - 0xC08, 0x000000E4, - 0xC0C, 0x6C6C6C6C, - 0xC10, 0x08800000, - 0xC14, 0x40000100, - 0xC18, 0x08800000, - 0xC1C, 0x40000100, - 0xC20, 0x00000000, - 0xC24, 0x00000000, - 0xC28, 0x00000000, - 0xC2C, 0x00000000, - 0xC30, 0x69E9AC47, - 0xC34, 0x469652AF, - 0xC38, 0x49795994, - 0xC3C, 0x0A97971C, - 0xC40, 0x1F7C403F, - 0xC44, 0x000100B7, - 0xC48, 0xEC020107, - 0xC4C, 0x007F037F, - 0xC50, 0x69553420, - 0xC54, 0x43BC0094, - 0xC58, 0x00013169, - 0xC5C, 0x00250492, - 0xC60, 0x00000000, - 0xC64, 0x7112848B, - 0xC68, 0x47C00BFF, - 0xC6C, 0x00000036, - 0xC70, 0x2C7F000D, - 0xC74, 0x020610DB, - 0xC78, 0x0000001F, - 0xC7C, 0x00B91612, - 0xC80, 0x390000E4, - 0xC84, 0x20F60000, - 0xC88, 0x40000100, - 0xC8C, 0x20200000, - 0xC90, 0x00091521, - 0xC94, 0x00000000, - 0xC98, 0x00121820, - 0xC9C, 0x00007F7F, - 0xCA0, 0x00000000, - 0xCA4, 0x000300A0, - 0xCA8, 0x00000000, - 0xCAC, 0x00000000, - 0xCB0, 0x00000000, - 0xCB4, 0x00000000, - 0xCB8, 0x00000000, - 0xCBC, 0x28000000, - 0xCC0, 0x00000000, - 0xCC4, 0x00000000, - 0xCC8, 0x00000000, - 0xCCC, 0x00000000, - 0xCD0, 0x00000000, - 0xCD4, 0x00000000, - 0xCD8, 0x64B22427, - 0xCDC, 0x00766932, - 0xCE0, 0x00222222, - 0xCE4, 0x00000000, - 0xCE8, 0x37644302, - 0xCEC, 0x2F97D40C, - 0xD00, 0x00000740, - 0xD04, 0x00020401, - 0xD08, 0x0000907F, - 0xD0C, 0x20010201, - 0xD10, 0xA0633333, - 0xD14, 0x3333BC43, - 0xD18, 0x7A8F5B6F, - 0xD2C, 0xCC979975, - 0xD30, 0x00000000, - 0xD34, 0x80608000, - 0xD38, 0x00000000, - 0xD3C, 0x00127353, - 0xD40, 0x00000000, - 0xD44, 0x00000000, - 0xD48, 0x00000000, - 0xD4C, 0x00000000, - 0xD50, 0x6437140A, - 0xD54, 0x00000000, - 0xD58, 0x00000282, - 0xD5C, 0x30032064, - 0xD60, 0x4653DE68, - 0xD64, 0x04518A3C, - 0xD68, 0x00002101, - 0xD6C, 0x2A201C16, - 0xD70, 0x1812362E, - 0xD74, 0x322C2220, - 0xD78, 0x000E3C24, - 0xE00, 0x2D2D2D2D, - 0xE04, 0x2D2D2D2D, - 0xE08, 0x0390272D, - 0xE10, 0x2D2D2D2D, - 0xE14, 0x2D2D2D2D, - 0xE18, 0x2D2D2D2D, - 0xE1C, 0x2D2D2D2D, - 0xE28, 0x00000000, - 0xE30, 0x1000DC1F, - 0xE34, 0x10008C1F, - 0xE38, 0x02140102, - 0xE3C, 0x681604C2, - 0xE40, 0x01007C00, - 0xE44, 0x01004800, - 0xE48, 0xFB000000, - 0xE4C, 0x000028D1, - 0xE50, 0x1000DC1F, - 0xE54, 0x10008C1F, - 0xE58, 0x02140102, - 0xE5C, 0x28160D05, - 0xE60, 0x00000008, - 0xE68, 0x001B25A4, - 0xE6C, 0x00C00014, - 0xE70, 0x00C00014, - 0xE74, 0x01000014, - 0xE78, 0x01000014, - 0xE7C, 0x01000014, - 0xE80, 0x01000014, - 0xE84, 0x00C00014, - 0xE88, 0x01000014, - 0xE8C, 0x00C00014, - 0xED0, 0x00C00014, - 0xED4, 0x00C00014, - 0xED8, 0x00C00014, - 0xEDC, 0x00000014, - 0xEE0, 0x00000014, - 0xEEC, 0x01C00014, - 0xF14, 0x00000003, - 0xF4C, 0x00000000, - 0xF00, 0x00000300, - -}; - -u32 RTL8188EEPHY_REG_ARRAY_PG[] = { - 0xE00, 0xFFFFFFFF, 0x06070809, - 0xE04, 0xFFFFFFFF, 0x02020405, - 0xE08, 0x0000FF00, 0x00000006, - 0x86C, 0xFFFFFF00, 0x00020400, - 0xE10, 0xFFFFFFFF, 0x08090A0B, - 0xE14, 0xFFFFFFFF, 0x01030607, - 0xE18, 0xFFFFFFFF, 0x08090A0B, - 0xE1C, 0xFFFFFFFF, 0x01030607, - 0xE00, 0xFFFFFFFF, 0x00000000, - 0xE04, 0xFFFFFFFF, 0x00000000, - 0xE08, 0x0000FF00, 0x00000000, - 0x86C, 0xFFFFFF00, 0x00000000, - 0xE10, 0xFFFFFFFF, 0x00000000, - 0xE14, 0xFFFFFFFF, 0x00000000, - 0xE18, 0xFFFFFFFF, 0x00000000, - 0xE1C, 0xFFFFFFFF, 0x00000000, - 0xE00, 0xFFFFFFFF, 0x02020202, - 0xE04, 0xFFFFFFFF, 0x00020202, - 0xE08, 0x0000FF00, 0x00000000, - 0x86C, 0xFFFFFF00, 0x00000000, - 0xE10, 0xFFFFFFFF, 0x04040404, - 0xE14, 0xFFFFFFFF, 0x00020404, - 0xE18, 0xFFFFFFFF, 0x00000000, - 0xE1C, 0xFFFFFFFF, 0x00000000, - 0xE00, 0xFFFFFFFF, 0x02020202, - 0xE04, 0xFFFFFFFF, 0x00020202, - 0xE08, 0x0000FF00, 0x00000000, - 0x86C, 0xFFFFFF00, 0x00000000, - 0xE10, 0xFFFFFFFF, 0x04040404, - 0xE14, 0xFFFFFFFF, 0x00020404, - 0xE18, 0xFFFFFFFF, 0x00000000, - 0xE1C, 0xFFFFFFFF, 0x00000000, - 0xE00, 0xFFFFFFFF, 0x00000000, - 0xE04, 0xFFFFFFFF, 0x00000000, - 0xE08, 0x0000FF00, 0x00000000, - 0x86C, 0xFFFFFF00, 0x00000000, - 0xE10, 0xFFFFFFFF, 0x00000000, - 0xE14, 0xFFFFFFFF, 0x00000000, - 0xE18, 0xFFFFFFFF, 0x00000000, - 0xE1C, 0xFFFFFFFF, 0x00000000, - 0xE00, 0xFFFFFFFF, 0x02020202, - 0xE04, 0xFFFFFFFF, 0x00020202, - 0xE08, 0x0000FF00, 0x00000000, - 0x86C, 0xFFFFFF00, 0x00000000, - 0xE10, 0xFFFFFFFF, 0x04040404, - 0xE14, 0xFFFFFFFF, 0x00020404, - 0xE18, 0xFFFFFFFF, 0x00000000, - 0xE1C, 0xFFFFFFFF, 0x00000000, - 0xE00, 0xFFFFFFFF, 0x00000000, - 0xE04, 0xFFFFFFFF, 0x00000000, - 0xE08, 0x0000FF00, 0x00000000, - 0x86C, 0xFFFFFF00, 0x00000000, - 0xE10, 0xFFFFFFFF, 0x00000000, - 0xE14, 0xFFFFFFFF, 0x00000000, - 0xE18, 0xFFFFFFFF, 0x00000000, - 0xE1C, 0xFFFFFFFF, 0x00000000, - 0xE00, 0xFFFFFFFF, 0x00000000, - 0xE04, 0xFFFFFFFF, 0x00000000, - 0xE08, 0x0000FF00, 0x00000000, - 0x86C, 0xFFFFFF00, 0x00000000, - 0xE10, 0xFFFFFFFF, 0x00000000, - 0xE14, 0xFFFFFFFF, 0x00000000, - 0xE18, 0xFFFFFFFF, 0x00000000, - 0xE1C, 0xFFFFFFFF, 0x00000000, - 0xE00, 0xFFFFFFFF, 0x00000000, - 0xE04, 0xFFFFFFFF, 0x00000000, - 0xE08, 0x0000FF00, 0x00000000, - 0x86C, 0xFFFFFF00, 0x00000000, - 0xE10, 0xFFFFFFFF, 0x00000000, - 0xE14, 0xFFFFFFFF, 0x00000000, - 0xE18, 0xFFFFFFFF, 0x00000000, - 0xE1C, 0xFFFFFFFF, 0x00000000, - 0xE00, 0xFFFFFFFF, 0x00000000, - 0xE04, 0xFFFFFFFF, 0x00000000, - 0xE08, 0x0000FF00, 0x00000000, - 0x86C, 0xFFFFFF00, 0x00000000, - 0xE10, 0xFFFFFFFF, 0x00000000, - 0xE14, 0xFFFFFFFF, 0x00000000, - 0xE18, 0xFFFFFFFF, 0x00000000, - 0xE1C, 0xFFFFFFFF, 0x00000000, - 0xE00, 0xFFFFFFFF, 0x00000000, - 0xE04, 0xFFFFFFFF, 0x00000000, - 0xE08, 0x0000FF00, 0x00000000, - 0x86C, 0xFFFFFF00, 0x00000000, - 0xE10, 0xFFFFFFFF, 0x00000000, - 0xE14, 0xFFFFFFFF, 0x00000000, - 0xE18, 0xFFFFFFFF, 0x00000000, - 0xE1C, 0xFFFFFFFF, 0x00000000, - -}; - -u32 RTL8188EE_RADIOA_1TARRAY[] = { - 0x000, 0x00030000, - 0x008, 0x00084000, - 0x018, 0x00000407, - 0x019, 0x00000012, - 0x01E, 0x00080009, - 0x01F, 0x00000880, - 0x02F, 0x0001A060, - 0x03F, 0x00000000, - 0x042, 0x000060C0, - 0x057, 0x000D0000, - 0x058, 0x000BE180, - 0x067, 0x00001552, - 0x083, 0x00000000, - 0x0B0, 0x000FF8FC, - 0x0B1, 0x00054400, - 0x0B2, 0x000CCC19, - 0x0B4, 0x00043003, - 0x0B6, 0x0004953E, - 0x0B7, 0x0001C718, - 0x0B8, 0x000060FF, - 0x0B9, 0x00080001, - 0x0BA, 0x00040000, - 0x0BB, 0x00000400, - 0x0BF, 0x000C0000, - 0x0C2, 0x00002400, - 0x0C3, 0x00000009, - 0x0C4, 0x00040C91, - 0x0C5, 0x00099999, - 0x0C6, 0x000000A3, - 0x0C7, 0x00088820, - 0x0C8, 0x00076C06, - 0x0C9, 0x00000000, - 0x0CA, 0x00080000, - 0x0DF, 0x00000180, - 0x0EF, 0x000001A0, - 0x051, 0x0006B27D, - 0x052, 0x0007E49D, - 0x053, 0x00000073, - 0x056, 0x00051FF3, - 0x035, 0x00000086, - 0x035, 0x00000186, - 0x035, 0x00000286, - 0x036, 0x00001C25, - 0x036, 0x00009C25, - 0x036, 0x00011C25, - 0x036, 0x00019C25, - 0x0B6, 0x00048538, - 0x018, 0x00000C07, - 0x05A, 0x0004BD00, - 0x019, 0x000739D0, - 0x034, 0x0000ADF3, - 0x034, 0x00009DF0, - 0x034, 0x00008DED, - 0x034, 0x00007DEA, - 0x034, 0x00006DE7, - 0x034, 0x000054EE, - 0x034, 0x000044EB, - 0x034, 0x000034E8, - 0x034, 0x0000246B, - 0x034, 0x00001468, - 0x034, 0x0000006D, - 0x000, 0x00030159, - 0x084, 0x00068200, - 0x086, 0x000000CE, - 0x087, 0x00048A00, - 0x08E, 0x00065540, - 0x08F, 0x00088000, - 0x0EF, 0x000020A0, - 0x03B, 0x000F02B0, - 0x03B, 0x000EF7B0, - 0x03B, 0x000D4FB0, - 0x03B, 0x000CF060, - 0x03B, 0x000B0090, - 0x03B, 0x000A0080, - 0x03B, 0x00090080, - 0x03B, 0x0008F780, - 0x03B, 0x000722B0, - 0x03B, 0x0006F7B0, - 0x03B, 0x00054FB0, - 0x03B, 0x0004F060, - 0x03B, 0x00030090, - 0x03B, 0x00020080, - 0x03B, 0x00010080, - 0x03B, 0x0000F780, - 0x0EF, 0x000000A0, - 0x000, 0x00010159, - 0x018, 0x0000F407, - 0xFFE, 0x00000000, - 0xFFE, 0x00000000, - 0x01F, 0x00080003, - 0xFFE, 0x00000000, - 0xFFE, 0x00000000, - 0x01E, 0x00000001, - 0x01F, 0x00080000, - 0x000, 0x00033E60, - -}; - -u32 RTL8188EEMAC_1T_ARRAY[] = { - 0x026, 0x00000041, - 0x027, 0x00000035, - 0x428, 0x0000000A, - 0x429, 0x00000010, - 0x430, 0x00000000, - 0x431, 0x00000001, - 0x432, 0x00000002, - 0x433, 0x00000004, - 0x434, 0x00000005, - 0x435, 0x00000006, - 0x436, 0x00000007, - 0x437, 0x00000008, - 0x438, 0x00000000, - 0x439, 0x00000000, - 0x43A, 0x00000001, - 0x43B, 0x00000002, - 0x43C, 0x00000004, - 0x43D, 0x00000005, - 0x43E, 0x00000006, - 0x43F, 0x00000007, - 0x440, 0x0000005D, - 0x441, 0x00000001, - 0x442, 0x00000000, - 0x444, 0x00000015, - 0x445, 0x000000F0, - 0x446, 0x0000000F, - 0x447, 0x00000000, - 0x458, 0x00000041, - 0x459, 0x000000A8, - 0x45A, 0x00000072, - 0x45B, 0x000000B9, - 0x460, 0x00000066, - 0x461, 0x00000066, - 0x480, 0x00000008, - 0x4C8, 0x000000FF, - 0x4C9, 0x00000008, - 0x4CC, 0x000000FF, - 0x4CD, 0x000000FF, - 0x4CE, 0x00000001, - 0x4D3, 0x00000001, - 0x500, 0x00000026, - 0x501, 0x000000A2, - 0x502, 0x0000002F, - 0x503, 0x00000000, - 0x504, 0x00000028, - 0x505, 0x000000A3, - 0x506, 0x0000005E, - 0x507, 0x00000000, - 0x508, 0x0000002B, - 0x509, 0x000000A4, - 0x50A, 0x0000005E, - 0x50B, 0x00000000, - 0x50C, 0x0000004F, - 0x50D, 0x000000A4, - 0x50E, 0x00000000, - 0x50F, 0x00000000, - 0x512, 0x0000001C, - 0x514, 0x0000000A, - 0x516, 0x0000000A, - 0x525, 0x0000004F, - 0x550, 0x00000010, - 0x551, 0x00000010, - 0x559, 0x00000002, - 0x55D, 0x000000FF, - 0x605, 0x00000030, - 0x608, 0x0000000E, - 0x609, 0x0000002A, - 0x620, 0x000000FF, - 0x621, 0x000000FF, - 0x622, 0x000000FF, - 0x623, 0x000000FF, - 0x624, 0x000000FF, - 0x625, 0x000000FF, - 0x626, 0x000000FF, - 0x627, 0x000000FF, - 0x652, 0x00000020, - 0x63C, 0x0000000A, - 0x63D, 0x0000000A, - 0x63E, 0x0000000E, - 0x63F, 0x0000000E, - 0x640, 0x00000040, - 0x66E, 0x00000005, - 0x700, 0x00000021, - 0x701, 0x00000043, - 0x702, 0x00000065, - 0x703, 0x00000087, - 0x708, 0x00000021, - 0x709, 0x00000043, - 0x70A, 0x00000065, - 0x70B, 0x00000087, - -}; - -u32 RTL8188EEAGCTAB_1TARRAY[] = { - 0xC78, 0xFB000001, - 0xC78, 0xFB010001, - 0xC78, 0xFB020001, - 0xC78, 0xFB030001, - 0xC78, 0xFB040001, - 0xC78, 0xFB050001, - 0xC78, 0xFA060001, - 0xC78, 0xF9070001, - 0xC78, 0xF8080001, - 0xC78, 0xF7090001, - 0xC78, 0xF60A0001, - 0xC78, 0xF50B0001, - 0xC78, 0xF40C0001, - 0xC78, 0xF30D0001, - 0xC78, 0xF20E0001, - 0xC78, 0xF10F0001, - 0xC78, 0xF0100001, - 0xC78, 0xEF110001, - 0xC78, 0xEE120001, - 0xC78, 0xED130001, - 0xC78, 0xEC140001, - 0xC78, 0xEB150001, - 0xC78, 0xEA160001, - 0xC78, 0xE9170001, - 0xC78, 0xE8180001, - 0xC78, 0xE7190001, - 0xC78, 0xE61A0001, - 0xC78, 0xE51B0001, - 0xC78, 0xE41C0001, - 0xC78, 0xE31D0001, - 0xC78, 0xE21E0001, - 0xC78, 0xE11F0001, - 0xC78, 0x8A200001, - 0xC78, 0x89210001, - 0xC78, 0x88220001, - 0xC78, 0x87230001, - 0xC78, 0x86240001, - 0xC78, 0x85250001, - 0xC78, 0x84260001, - 0xC78, 0x83270001, - 0xC78, 0x82280001, - 0xC78, 0x6B290001, - 0xC78, 0x6A2A0001, - 0xC78, 0x692B0001, - 0xC78, 0x682C0001, - 0xC78, 0x672D0001, - 0xC78, 0x662E0001, - 0xC78, 0x652F0001, - 0xC78, 0x64300001, - 0xC78, 0x63310001, - 0xC78, 0x62320001, - 0xC78, 0x61330001, - 0xC78, 0x46340001, - 0xC78, 0x45350001, - 0xC78, 0x44360001, - 0xC78, 0x43370001, - 0xC78, 0x42380001, - 0xC78, 0x41390001, - 0xC78, 0x403A0001, - 0xC78, 0x403B0001, - 0xC78, 0x403C0001, - 0xC78, 0x403D0001, - 0xC78, 0x403E0001, - 0xC78, 0x403F0001, - 0xC78, 0xFB400001, - 0xC78, 0xFB410001, - 0xC78, 0xFB420001, - 0xC78, 0xFB430001, - 0xC78, 0xFB440001, - 0xC78, 0xFB450001, - 0xC78, 0xFB460001, - 0xC78, 0xFB470001, - 0xC78, 0xFB480001, - 0xC78, 0xFA490001, - 0xC78, 0xF94A0001, - 0xC78, 0xF84B0001, - 0xC78, 0xF74C0001, - 0xC78, 0xF64D0001, - 0xC78, 0xF54E0001, - 0xC78, 0xF44F0001, - 0xC78, 0xF3500001, - 0xC78, 0xF2510001, - 0xC78, 0xF1520001, - 0xC78, 0xF0530001, - 0xC78, 0xEF540001, - 0xC78, 0xEE550001, - 0xC78, 0xED560001, - 0xC78, 0xEC570001, - 0xC78, 0xEB580001, - 0xC78, 0xEA590001, - 0xC78, 0xE95A0001, - 0xC78, 0xE85B0001, - 0xC78, 0xE75C0001, - 0xC78, 0xE65D0001, - 0xC78, 0xE55E0001, - 0xC78, 0xE45F0001, - 0xC78, 0xE3600001, - 0xC78, 0xE2610001, - 0xC78, 0xC3620001, - 0xC78, 0xC2630001, - 0xC78, 0xC1640001, - 0xC78, 0x8B650001, - 0xC78, 0x8A660001, - 0xC78, 0x89670001, - 0xC78, 0x88680001, - 0xC78, 0x87690001, - 0xC78, 0x866A0001, - 0xC78, 0x856B0001, - 0xC78, 0x846C0001, - 0xC78, 0x676D0001, - 0xC78, 0x666E0001, - 0xC78, 0x656F0001, - 0xC78, 0x64700001, - 0xC78, 0x63710001, - 0xC78, 0x62720001, - 0xC78, 0x61730001, - 0xC78, 0x60740001, - 0xC78, 0x46750001, - 0xC78, 0x45760001, - 0xC78, 0x44770001, - 0xC78, 0x43780001, - 0xC78, 0x42790001, - 0xC78, 0x417A0001, - 0xC78, 0x407B0001, - 0xC78, 0x407C0001, - 0xC78, 0x407D0001, - 0xC78, 0x407E0001, - 0xC78, 0x407F0001, -}; diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/table.h b/drivers/net/wireless/rtlwifi/rtl8188ee/table.h deleted file mode 100644 index c1218e835129..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/table.h +++ /dev/null @@ -1,47 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Created on 2010/ 5/18, 1:41 - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CE_TABLE__H_ -#define __RTL92CE_TABLE__H_ - -#include -#define RTL8188EEPHY_REG_1TARRAYLEN 382 -extern u32 RTL8188EEPHY_REG_1TARRAY[]; -#define RTL8188EEPHY_REG_ARRAY_PGLEN 264 -extern u32 RTL8188EEPHY_REG_ARRAY_PG[]; -#define RTL8188EE_RADIOA_1TARRAYLEN 190 -extern u32 RTL8188EE_RADIOA_1TARRAY[]; -#define RTL8188EEMAC_1T_ARRAYLEN 180 -extern u32 RTL8188EEMAC_1T_ARRAY[]; -#define RTL8188EEAGCTAB_1TARRAYLEN 256 -extern u32 RTL8188EEAGCTAB_1TARRAY[]; - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c deleted file mode 100644 index a8871d66d56a..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c +++ /dev/null @@ -1,817 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../base.h" -#include "../stats.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "trx.h" -#include "led.h" -#include "dm.h" - -static u8 _rtl88ee_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) -{ - __le16 fc = rtl_get_fc(skb); - - if (unlikely(ieee80211_is_beacon(fc))) - return QSLT_BEACON; - if (ieee80211_is_mgmt(fc) || ieee80211_is_ctl(fc)) - return QSLT_MGNT; - - return skb->priority; -} - -static void _rtl88ee_query_rxphystatus(struct ieee80211_hw *hw, - struct rtl_stats *pstatus, u8 *pdesc, - struct rx_fwinfo_88e *p_drvinfo, - bool bpacket_match_bssid, - bool bpacket_toself, bool packet_beacon) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtlpriv); - struct phy_sts_cck_8192s_t *cck_buf; - struct phy_status_rpt *phystrpt = (struct phy_status_rpt *)p_drvinfo; - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - char rx_pwr_all = 0, rx_pwr[4]; - u8 rf_rx_num = 0, evm, pwdb_all; - u8 i, max_spatial_stream; - u32 rssi, total_rssi = 0; - bool is_cck = pstatus->is_cck; - u8 lan_idx, vga_idx; - - /* Record it for next packet processing */ - pstatus->packet_matchbssid = bpacket_match_bssid; - pstatus->packet_toself = bpacket_toself; - pstatus->packet_beacon = packet_beacon; - pstatus->rx_mimo_sig_qual[0] = -1; - pstatus->rx_mimo_sig_qual[1] = -1; - - if (is_cck) { - u8 cck_hipwr; - u8 cck_agc_rpt; - /* CCK Driver info Structure is not the same as OFDM packet. */ - cck_buf = (struct phy_sts_cck_8192s_t *)p_drvinfo; - cck_agc_rpt = cck_buf->cck_agc_rpt; - - /* (1)Hardware does not provide RSSI for CCK - * (2)PWDB, Average PWDB cacluated by - * hardware (for rate adaptive) - */ - if (ppsc->rfpwr_state == ERFON) - cck_hipwr = rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, - BIT(9)); - else - cck_hipwr = false; - - lan_idx = ((cck_agc_rpt & 0xE0) >> 5); - vga_idx = (cck_agc_rpt & 0x1f); - switch (lan_idx) { - case 7: - if (vga_idx <= 27) - rx_pwr_all = -100 + 2 * (27 - vga_idx); - else - rx_pwr_all = -100; - break; - case 6: - rx_pwr_all = -48 + 2 * (2 - vga_idx); /*VGA_idx = 2~0*/ - break; - case 5: - rx_pwr_all = -42 + 2 * (7 - vga_idx); /*VGA_idx = 7~5*/ - break; - case 4: - rx_pwr_all = -36 + 2 * (7 - vga_idx); /*VGA_idx = 7~4*/ - break; - case 3: - rx_pwr_all = -24 + 2 * (7 - vga_idx); /*VGA_idx = 7~0*/ - break; - case 2: - if (cck_hipwr) - rx_pwr_all = -12 + 2 * (5 - vga_idx); - else - rx_pwr_all = -6 + 2 * (5 - vga_idx); - break; - case 1: - rx_pwr_all = 8 - 2 * vga_idx; - break; - case 0: - rx_pwr_all = 14 - 2 * vga_idx; - break; - default: - break; - } - rx_pwr_all += 6; - pwdb_all = rtl_query_rxpwrpercentage(rx_pwr_all); - /* CCK gain is smaller than OFDM/MCS gain, - * so we add gain diff by experiences, - * the val is 6 - */ - pwdb_all += 6; - if (pwdb_all > 100) - pwdb_all = 100; - /* modify the offset to make the same - * gain index with OFDM. - */ - if (pwdb_all > 34 && pwdb_all <= 42) - pwdb_all -= 2; - else if (pwdb_all > 26 && pwdb_all <= 34) - pwdb_all -= 6; - else if (pwdb_all > 14 && pwdb_all <= 26) - pwdb_all -= 8; - else if (pwdb_all > 4 && pwdb_all <= 14) - pwdb_all -= 4; - if (cck_hipwr == false) { - if (pwdb_all >= 80) - pwdb_all = ((pwdb_all - 80)<<1) + - ((pwdb_all - 80)>>1) + 80; - else if ((pwdb_all <= 78) && (pwdb_all >= 20)) - pwdb_all += 3; - if (pwdb_all > 100) - pwdb_all = 100; - } - - pstatus->rx_pwdb_all = pwdb_all; - pstatus->recvsignalpower = rx_pwr_all; - - /* (3) Get Signal Quality (EVM) */ - if (bpacket_match_bssid) { - u8 sq; - - if (pstatus->rx_pwdb_all > 40) { - sq = 100; - } else { - sq = cck_buf->sq_rpt; - if (sq > 64) - sq = 0; - else if (sq < 20) - sq = 100; - else - sq = ((64 - sq) * 100) / 44; - } - - pstatus->signalquality = sq; - pstatus->rx_mimo_sig_qual[0] = sq; - pstatus->rx_mimo_sig_qual[1] = -1; - } - } else { - rtlpriv->dm.rfpath_rxenable[0] = - rtlpriv->dm.rfpath_rxenable[1] = true; - - /* (1)Get RSSI for HT rate */ - for (i = RF90_PATH_A; i < RF6052_MAX_PATH; i++) { - /* we will judge RF RX path now. */ - if (rtlpriv->dm.rfpath_rxenable[i]) - rf_rx_num++; - - rx_pwr[i] = ((p_drvinfo->gain_trsw[i] & 0x3f) * 2)-110; - - /* Translate DBM to percentage. */ - rssi = rtl_query_rxpwrpercentage(rx_pwr[i]); - total_rssi += rssi; - - /* Get Rx snr value in DB */ - rtlpriv->stats.rx_snr_db[i] = p_drvinfo->rxsnr[i] / 2; - - /* Record Signal Strength for next packet */ - if (bpacket_match_bssid) - pstatus->rx_mimo_signalstrength[i] = (u8) rssi; - } - - /* (2)PWDB, Average PWDB cacluated by - * hardware (for rate adaptive) - */ - rx_pwr_all = ((p_drvinfo->pwdb_all >> 1) & 0x7f) - 110; - - pwdb_all = rtl_query_rxpwrpercentage(rx_pwr_all); - pstatus->rx_pwdb_all = pwdb_all; - pstatus->rxpower = rx_pwr_all; - pstatus->recvsignalpower = rx_pwr_all; - - /* (3)EVM of HT rate */ - if (pstatus->is_ht && pstatus->rate >= DESC92C_RATEMCS8 && - pstatus->rate <= DESC92C_RATEMCS15) - max_spatial_stream = 2; - else - max_spatial_stream = 1; - - for (i = 0; i < max_spatial_stream; i++) { - evm = rtl_evm_db_to_percentage(p_drvinfo->rxevm[i]); - - if (bpacket_match_bssid) { - /* Fill value in RFD, Get the first - * spatial stream only - */ - if (i == 0) - pstatus->signalquality = evm & 0xff; - pstatus->rx_mimo_sig_qual[i] = evm & 0xff; - } - } - } - - /* UI BSS List signal strength(in percentage), - * make it good looking, from 0~100. - */ - if (is_cck) - pstatus->signalstrength = (u8)(rtl_signal_scale_mapping(hw, - pwdb_all)); - else if (rf_rx_num != 0) - pstatus->signalstrength = (u8)(rtl_signal_scale_mapping(hw, - total_rssi /= rf_rx_num)); - /*HW antenna diversity*/ - rtldm->fat_table.antsel_rx_keep_0 = phystrpt->ant_sel; - rtldm->fat_table.antsel_rx_keep_1 = phystrpt->ant_sel_b; - rtldm->fat_table.antsel_rx_keep_2 = phystrpt->antsel_rx_keep_2; -} - -static void _rtl88ee_smart_antenna(struct ieee80211_hw *hw, - struct rtl_stats *pstatus) -{ - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 ant_mux; - struct fast_ant_training *pfat = &(rtldm->fat_table); - - if (rtlefuse->antenna_div_type == CG_TRX_SMART_ANTDIV) { - if (pfat->fat_state == FAT_TRAINING_STATE) { - if (pstatus->packet_toself) { - ant_mux = (pfat->antsel_rx_keep_2 << 2) | - (pfat->antsel_rx_keep_1 << 1) | - pfat->antsel_rx_keep_0; - pfat->ant_sum[ant_mux] += pstatus->rx_pwdb_all; - pfat->ant_cnt[ant_mux]++; - } - } - } else if ((rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) || - (rtlefuse->antenna_div_type == CGCS_RX_HW_ANTDIV)) { - if (pstatus->packet_toself || pstatus->packet_matchbssid) { - ant_mux = (pfat->antsel_rx_keep_2 << 2) | - (pfat->antsel_rx_keep_1 << 1) | - pfat->antsel_rx_keep_0; - rtl88e_dm_ant_sel_statistics(hw, ant_mux, 0, - pstatus->rx_pwdb_all); - } - } -} - -static void _rtl88ee_translate_rx_signal_stuff(struct ieee80211_hw *hw, - struct sk_buff *skb, struct rtl_stats *pstatus, - u8 *pdesc, struct rx_fwinfo_88e *p_drvinfo) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct ieee80211_hdr *hdr; - u8 *tmp_buf; - u8 *praddr; - u8 *psaddr; - __le16 fc; - u16 type, ufc; - bool match_bssid, packet_toself, packet_beacon, addr; - - tmp_buf = skb->data + pstatus->rx_drvinfo_size + pstatus->rx_bufshift; - - hdr = (struct ieee80211_hdr *)tmp_buf; - fc = hdr->frame_control; - ufc = le16_to_cpu(fc); - type = WLAN_FC_GET_TYPE(fc); - praddr = hdr->addr1; - psaddr = ieee80211_get_SA(hdr); - memcpy(pstatus->psaddr, psaddr, ETH_ALEN); - - addr = (!compare_ether_addr(mac->bssid, (ufc & IEEE80211_FCTL_TODS) ? - hdr->addr1 : (ufc & IEEE80211_FCTL_FROMDS) ? - hdr->addr2 : hdr->addr3)); - match_bssid = ((IEEE80211_FTYPE_CTL != type) && (!pstatus->hwerror) && - (!pstatus->crc) && (!pstatus->icv)) && addr; - - addr = (!compare_ether_addr(praddr, rtlefuse->dev_addr)); - packet_toself = match_bssid && addr; - - if (ieee80211_is_beacon(fc)) - packet_beacon = true; - - _rtl88ee_query_rxphystatus(hw, pstatus, pdesc, p_drvinfo, - match_bssid, packet_toself, packet_beacon); - _rtl88ee_smart_antenna(hw, pstatus); - rtl_process_phyinfo(hw, tmp_buf, pstatus); -} - -static void insert_em(struct rtl_tcb_desc *ptcb_desc, u8 *virtualaddress) -{ - u32 dwtmp = 0; - - memset(virtualaddress, 0, 8); - - SET_EARLYMODE_PKTNUM(virtualaddress, ptcb_desc->empkt_num); - if (ptcb_desc->empkt_num == 1) { - dwtmp = ptcb_desc->empkt_len[0]; - } else { - dwtmp = ptcb_desc->empkt_len[0]; - dwtmp += ((dwtmp % 4) ? (4 - dwtmp % 4) : 0) + 4; - dwtmp += ptcb_desc->empkt_len[1]; - } - SET_EARLYMODE_LEN0(virtualaddress, dwtmp); - - if (ptcb_desc->empkt_num <= 3) { - dwtmp = ptcb_desc->empkt_len[2]; - } else { - dwtmp = ptcb_desc->empkt_len[2]; - dwtmp += ((dwtmp % 4) ? (4 - dwtmp % 4) : 0) + 4; - dwtmp += ptcb_desc->empkt_len[3]; - } - SET_EARLYMODE_LEN1(virtualaddress, dwtmp); - if (ptcb_desc->empkt_num <= 5) { - dwtmp = ptcb_desc->empkt_len[4]; - } else { - dwtmp = ptcb_desc->empkt_len[4]; - dwtmp += ((dwtmp % 4) ? (4 - dwtmp % 4) : 0) + 4; - dwtmp += ptcb_desc->empkt_len[5]; - } - SET_EARLYMODE_LEN2_1(virtualaddress, dwtmp & 0xF); - SET_EARLYMODE_LEN2_2(virtualaddress, dwtmp >> 4); - if (ptcb_desc->empkt_num <= 7) { - dwtmp = ptcb_desc->empkt_len[6]; - } else { - dwtmp = ptcb_desc->empkt_len[6]; - dwtmp += ((dwtmp % 4) ? (4 - dwtmp % 4) : 0) + 4; - dwtmp += ptcb_desc->empkt_len[7]; - } - SET_EARLYMODE_LEN3(virtualaddress, dwtmp); - if (ptcb_desc->empkt_num <= 9) { - dwtmp = ptcb_desc->empkt_len[8]; - } else { - dwtmp = ptcb_desc->empkt_len[8]; - dwtmp += ((dwtmp % 4) ? (4 - dwtmp % 4) : 0) + 4; - dwtmp += ptcb_desc->empkt_len[9]; - } - SET_EARLYMODE_LEN4(virtualaddress, dwtmp); -} - -bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw, - struct rtl_stats *status, - struct ieee80211_rx_status *rx_status, - u8 *pdesc, struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rx_fwinfo_88e *p_drvinfo; - struct ieee80211_hdr *hdr; - - u32 phystatus = GET_RX_DESC_PHYST(pdesc); - status->packet_report_type = (u8)GET_RX_STATUS_DESC_RPT_SEL(pdesc); - if (status->packet_report_type == TX_REPORT2) - status->length = (u16) GET_RX_RPT2_DESC_PKT_LEN(pdesc); - else - status->length = (u16) GET_RX_DESC_PKT_LEN(pdesc); - status->rx_drvinfo_size = (u8) GET_RX_DESC_DRV_INFO_SIZE(pdesc) * - RX_DRV_INFO_SIZE_UNIT; - status->rx_bufshift = (u8) (GET_RX_DESC_SHIFT(pdesc) & 0x03); - status->icv = (u16) GET_RX_DESC_ICV(pdesc); - status->crc = (u16) GET_RX_DESC_CRC32(pdesc); - status->hwerror = (status->crc | status->icv); - status->decrypted = !GET_RX_DESC_SWDEC(pdesc); - status->rate = (u8) GET_RX_DESC_RXMCS(pdesc); - status->shortpreamble = (u16) GET_RX_DESC_SPLCP(pdesc); - status->isampdu = (bool) (GET_RX_DESC_PAGGR(pdesc) == 1); - status->isfirst_ampdu = (bool) ((GET_RX_DESC_PAGGR(pdesc) == 1) && - (GET_RX_DESC_FAGGR(pdesc) == 1)); - if (status->packet_report_type == NORMAL_RX) - status->timestamp_low = GET_RX_DESC_TSFL(pdesc); - status->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); - status->is_ht = (bool)GET_RX_DESC_RXHT(pdesc); - - status->is_cck = RTL8188_RX_HAL_IS_CCK_RATE(status->rate); - - status->macid = GET_RX_DESC_MACID(pdesc); - if (GET_RX_STATUS_DESC_MAGIC_MATCH(pdesc)) - status->wake_match = BIT(2); - else if (GET_RX_STATUS_DESC_MAGIC_MATCH(pdesc)) - status->wake_match = BIT(1); - else if (GET_RX_STATUS_DESC_UNICAST_MATCH(pdesc)) - status->wake_match = BIT(0); - else - status->wake_match = 0; - if (status->wake_match) - RT_TRACE(rtlpriv, COMP_RXDESC, DBG_LOUD, - "Get Wakeup Packet!! WakeMatch =%d\n", - status->wake_match); - rx_status->freq = hw->conf.chandef.chan->center_freq; - rx_status->band = hw->conf.chandef.chan->band; - - if (status->crc) - rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; - - if (status->rx_is40Mhzpacket) - rx_status->flag |= RX_FLAG_40MHZ; - - if (status->is_ht) - rx_status->flag |= RX_FLAG_HT; - - rx_status->flag |= RX_FLAG_MACTIME_START; - - /* hw will set status->decrypted true, if it finds the - * frame is open data frame or mgmt frame. - * So hw will not decryption robust managment frame - * for IEEE80211w but still set status->decrypted - * true, so here we should set it back to undecrypted - * for IEEE80211w frame, and mac80211 sw will help - * to decrypt it - */ - if (status->decrypted) { - hdr = (struct ieee80211_hdr *)(skb->data + - status->rx_drvinfo_size + status->rx_bufshift); - - if (!hdr) { - /* During testing, hdr was NULL */ - return false; - } - if ((ieee80211_is_robust_mgmt_frame(hdr)) && - (ieee80211_has_protected(hdr->frame_control))) - rx_status->flag &= ~RX_FLAG_DECRYPTED; - else - rx_status->flag |= RX_FLAG_DECRYPTED; - } - - /* rate_idx: index of data rate into band's - * supported rates or MCS index if HT rates - * are use (RX_FLAG_HT) - * Notice: this is diff with windows define - */ - rx_status->rate_idx = rtlwifi_rate_mapping(hw, status->is_ht, - status->rate, false); - - rx_status->mactime = status->timestamp_low; - if (phystatus == true) { - p_drvinfo = (struct rx_fwinfo_88e *)(skb->data + - status->rx_bufshift); - - _rtl88ee_translate_rx_signal_stuff(hw, skb, status, pdesc, - p_drvinfo); - } - - /*rx_status->qual = status->signal; */ - rx_status->signal = status->recvsignalpower + 10; - /*rx_status->noise = -status->noise; */ - if (status->packet_report_type == TX_REPORT2) { - status->macid_valid_entry[0] = - GET_RX_RPT2_DESC_MACID_VALID_1(pdesc); - status->macid_valid_entry[1] = - GET_RX_RPT2_DESC_MACID_VALID_2(pdesc); - } - return true; -} - -void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, - u8 hw_queue, struct rtl_tcb_desc *ptcb_desc) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - u8 *pdesc = (u8 *)pdesc_tx; - u16 seq_number; - __le16 fc = hdr->frame_control; - unsigned int buf_len = 0; - unsigned int skb_len = skb->len; - u8 fw_qsel = _rtl88ee_map_hwqueue_to_fwqueue(skb, hw_queue); - bool firstseg = ((hdr->seq_ctrl & - cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0); - bool lastseg = ((hdr->frame_control & - cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) == 0); - dma_addr_t mapping; - u8 bw_40 = 0; - u8 short_gi = 0; - - if (mac->opmode == NL80211_IFTYPE_STATION) { - bw_40 = mac->bw_40; - } else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) { - if (sta) - bw_40 = sta->ht_cap.cap & - IEEE80211_HT_CAP_SUP_WIDTH_20_40; - } - seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4; - rtl_get_tcb_desc(hw, info, sta, skb, ptcb_desc); - /* reserve 8 byte for AMPDU early mode */ - if (rtlhal->earlymode_enable) { - skb_push(skb, EM_HDR_LEN); - memset(skb->data, 0, EM_HDR_LEN); - } - buf_len = skb->len; - mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, - PCI_DMA_TODEVICE); - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } - CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_88e)); - if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) { - firstseg = true; - lastseg = true; - } - if (firstseg) { - if (rtlhal->earlymode_enable) { - SET_TX_DESC_PKT_OFFSET(pdesc, 1); - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN + - EM_HDR_LEN); - if (ptcb_desc->empkt_num) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "Insert 8 byte.pTcb->EMPktNum:%d\n", - ptcb_desc->empkt_num); - insert_em(ptcb_desc, (u8 *)(skb->data)); - } - } else { - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); - } - - ptcb_desc->use_driver_rate = true; - SET_TX_DESC_TX_RATE(pdesc, ptcb_desc->hw_rate); - if (ptcb_desc->hw_rate > DESC92C_RATEMCS0) - short_gi = (ptcb_desc->use_shortgi) ? 1 : 0; - else - short_gi = (ptcb_desc->use_shortpreamble) ? 1 : 0; - SET_TX_DESC_DATA_SHORTGI(pdesc, short_gi); - - if (info->flags & IEEE80211_TX_CTL_AMPDU) { - SET_TX_DESC_AGG_ENABLE(pdesc, 1); - SET_TX_DESC_MAX_AGG_NUM(pdesc, 0x14); - } - SET_TX_DESC_SEQ(pdesc, seq_number); - SET_TX_DESC_RTS_ENABLE(pdesc, ((ptcb_desc->rts_enable && - !ptcb_desc->cts_enable) ? 1 : 0)); - SET_TX_DESC_HW_RTS_ENABLE(pdesc, 0); - SET_TX_DESC_CTS2SELF(pdesc, ((ptcb_desc->cts_enable) ? 1 : 0)); - SET_TX_DESC_RTS_STBC(pdesc, ((ptcb_desc->rts_stbc) ? 1 : 0)); - - SET_TX_DESC_RTS_RATE(pdesc, ptcb_desc->rts_rate); - SET_TX_DESC_RTS_BW(pdesc, 0); - SET_TX_DESC_RTS_SC(pdesc, ptcb_desc->rts_sc); - SET_TX_DESC_RTS_SHORT(pdesc, - ((ptcb_desc->rts_rate <= DESC92C_RATE54M) ? - (ptcb_desc->rts_use_shortpreamble ? 1 : 0) : - (ptcb_desc->rts_use_shortgi ? 1 : 0))); - - if (ptcb_desc->btx_enable_sw_calc_duration) - SET_TX_DESC_NAV_USE_HDR(pdesc, 1); - - if (bw_40) { - if (ptcb_desc->packet_bw) { - SET_TX_DESC_DATA_BW(pdesc, 1); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, 3); - } else { - SET_TX_DESC_DATA_BW(pdesc, 0); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, - mac->cur_40_prime_sc); - } - } else { - SET_TX_DESC_DATA_BW(pdesc, 0); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, 0); - } - - SET_TX_DESC_LINIP(pdesc, 0); - SET_TX_DESC_PKT_SIZE(pdesc, (u16) skb_len); - if (sta) { - u8 ampdu_density = sta->ht_cap.ampdu_density; - SET_TX_DESC_AMPDU_DENSITY(pdesc, ampdu_density); - } - if (info->control.hw_key) { - struct ieee80211_key_conf *keyconf; - keyconf = info->control.hw_key; - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - case WLAN_CIPHER_SUITE_TKIP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x1); - break; - case WLAN_CIPHER_SUITE_CCMP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x3); - break; - default: - SET_TX_DESC_SEC_TYPE(pdesc, 0x0); - break; - } - } - - SET_TX_DESC_QUEUE_SEL(pdesc, fw_qsel); - SET_TX_DESC_DATA_RATE_FB_LIMIT(pdesc, 0x1F); - SET_TX_DESC_RTS_RATE_FB_LIMIT(pdesc, 0xF); - SET_TX_DESC_DISABLE_FB(pdesc, ptcb_desc->disable_ratefallback ? - 1 : 0); - SET_TX_DESC_USE_RATE(pdesc, ptcb_desc->use_driver_rate ? 1 : 0); - - /* Set TxRate and RTSRate in TxDesc */ - /* This prevent Tx initial rate of new-coming packets */ - /* from being overwritten by retried packet rate.*/ - if (!ptcb_desc->use_driver_rate) { - /*SET_TX_DESC_RTS_RATE(pdesc, 0x08); */ - /* SET_TX_DESC_TX_RATE(pdesc, 0x0b); */ - } - if (ieee80211_is_data_qos(fc)) { - if (mac->rdg_en) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "Enable RDG function.\n"); - SET_TX_DESC_RDG_ENABLE(pdesc, 1); - SET_TX_DESC_HTC(pdesc, 1); - } - } - } - - SET_TX_DESC_FIRST_SEG(pdesc, (firstseg ? 1 : 0)); - SET_TX_DESC_LAST_SEG(pdesc, (lastseg ? 1 : 0)); - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16) buf_len); - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping); - if (rtlpriv->dm.useramask) { - SET_TX_DESC_RATE_ID(pdesc, ptcb_desc->ratr_index); - SET_TX_DESC_MACID(pdesc, ptcb_desc->mac_id); - } else { - SET_TX_DESC_RATE_ID(pdesc, 0xC + ptcb_desc->ratr_index); - SET_TX_DESC_MACID(pdesc, ptcb_desc->ratr_index); - } - if (ieee80211_is_data_qos(fc)) - SET_TX_DESC_QOS(pdesc, 1); - - if (!ieee80211_is_data_qos(fc)) - SET_TX_DESC_HWSEQ_EN(pdesc, 1); - SET_TX_DESC_MORE_FRAG(pdesc, (lastseg ? 0 : 1)); - if (is_multicast_ether_addr(ieee80211_get_DA(hdr)) || - is_broadcast_ether_addr(ieee80211_get_DA(hdr))) - SET_TX_DESC_BMC(pdesc, 1); - - rtl88e_dm_set_tx_ant_by_tx_info(hw, pdesc, ptcb_desc->mac_id); - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "\n"); -} - -void rtl88ee_tx_fill_cmddesc(struct ieee80211_hw *hw, - u8 *pdesc, bool firstseg, - bool lastseg, struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u8 fw_queue = QSLT_BEACON; - - dma_addr_t mapping = pci_map_single(rtlpci->pdev, - skb->data, skb->len, - PCI_DMA_TODEVICE); - - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); - __le16 fc = hdr->frame_control; - - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } - CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); - - if (firstseg) - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); - - SET_TX_DESC_TX_RATE(pdesc, DESC92C_RATE1M); - - SET_TX_DESC_SEQ(pdesc, 0); - - SET_TX_DESC_LINIP(pdesc, 0); - - SET_TX_DESC_QUEUE_SEL(pdesc, fw_queue); - - SET_TX_DESC_FIRST_SEG(pdesc, 1); - SET_TX_DESC_LAST_SEG(pdesc, 1); - - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16)(skb->len)); - - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping); - - SET_TX_DESC_RATE_ID(pdesc, 7); - SET_TX_DESC_MACID(pdesc, 0); - - SET_TX_DESC_OWN(pdesc, 1); - - SET_TX_DESC_PKT_SIZE((u8 *)pdesc, (u16)(skb->len)); - - SET_TX_DESC_FIRST_SEG(pdesc, 1); - SET_TX_DESC_LAST_SEG(pdesc, 1); - - SET_TX_DESC_OFFSET(pdesc, 0x20); - - SET_TX_DESC_USE_RATE(pdesc, 1); - - if (!ieee80211_is_data_qos(fc)) - SET_TX_DESC_HWSEQ_EN(pdesc, 1); - - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, - "H2C Tx Cmd Content\n", - pdesc, TX_DESC_SIZE); -} - -void rtl88ee_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val) -{ - if (istx == true) { - switch (desc_name) { - case HW_DESC_OWN: - SET_TX_DESC_OWN(pdesc, 1); - break; - case HW_DESC_TX_NEXTDESC_ADDR: - SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *)val); - break; - default: - RT_ASSERT(false, "ERR txdesc :%d not processed\n", - desc_name); - break; - } - } else { - switch (desc_name) { - case HW_DESC_RXOWN: - SET_RX_DESC_OWN(pdesc, 1); - break; - case HW_DESC_RXBUFF_ADDR: - SET_RX_DESC_BUFF_ADDR(pdesc, *(u32 *)val); - break; - case HW_DESC_RXPKT_LEN: - SET_RX_DESC_PKT_LEN(pdesc, *(u32 *)val); - break; - case HW_DESC_RXERO: - SET_RX_DESC_EOR(pdesc, 1); - break; - default: - RT_ASSERT(false, "ERR rxdesc :%d not processed\n", - desc_name); - break; - } - } -} - -u32 rtl88ee_get_desc(u8 *pdesc, bool istx, u8 desc_name) -{ - u32 ret = 0; - - if (istx == true) { - switch (desc_name) { - case HW_DESC_OWN: - ret = GET_TX_DESC_OWN(pdesc); - break; - case HW_DESC_TXBUFF_ADDR: - ret = GET_TX_DESC_TX_BUFFER_ADDRESS(pdesc); - break; - default: - RT_ASSERT(false, "ERR txdesc :%d not processed\n", - desc_name); - break; - } - } else { - switch (desc_name) { - case HW_DESC_OWN: - ret = GET_RX_DESC_OWN(pdesc); - break; - case HW_DESC_RXPKT_LEN: - ret = GET_RX_DESC_PKT_LEN(pdesc); - break; - default: - RT_ASSERT(false, "ERR rxdesc :%d not processed\n", - desc_name); - break; - } - } - return ret; -} - -void rtl88ee_tx_polling(struct ieee80211_hw *hw, u8 hw_queue) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - if (hw_queue == BEACON_QUEUE) { - rtl_write_word(rtlpriv, REG_PCIE_CTRL_REG, BIT(4)); - } else { - rtl_write_word(rtlpriv, REG_PCIE_CTRL_REG, - BIT(0) << (hw_queue)); - } -} diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h deleted file mode 100644 index 21ca33a7c770..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.h +++ /dev/null @@ -1,795 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2013 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CE_TRX_H__ -#define __RTL92CE_TRX_H__ - -#define TX_DESC_SIZE 64 -#define TX_DESC_AGGR_SUBFRAME_SIZE 32 - -#define RX_DESC_SIZE 32 -#define RX_DRV_INFO_SIZE_UNIT 8 - -#define TX_DESC_NEXT_DESC_OFFSET 40 -#define USB_HWDESC_HEADER_LEN 32 -#define CRCLENGTH 4 - -#define SET_TX_DESC_PKT_SIZE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 0, 16, __val) -#define SET_TX_DESC_OFFSET(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 16, 8, __val) -#define SET_TX_DESC_BMC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 24, 1, __val) -#define SET_TX_DESC_HTC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 25, 1, __val) -#define SET_TX_DESC_LAST_SEG(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 26, 1, __val) -#define SET_TX_DESC_FIRST_SEG(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 27, 1, __val) -#define SET_TX_DESC_LINIP(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 28, 1, __val) -#define SET_TX_DESC_NO_ACM(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 29, 1, __val) -#define SET_TX_DESC_GF(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 30, 1, __val) -#define SET_TX_DESC_OWN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val) - -#define GET_TX_DESC_PKT_SIZE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 0, 16) -#define GET_TX_DESC_OFFSET(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 16, 8) -#define GET_TX_DESC_BMC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 24, 1) -#define GET_TX_DESC_HTC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 25, 1) -#define GET_TX_DESC_LAST_SEG(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 26, 1) -#define GET_TX_DESC_FIRST_SEG(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 27, 1) -#define GET_TX_DESC_LINIP(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 28, 1) -#define GET_TX_DESC_NO_ACM(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 29, 1) -#define GET_TX_DESC_GF(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 30, 1) -#define GET_TX_DESC_OWN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 31, 1) - -#define SET_TX_DESC_MACID(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 0, 6, __val) -#define SET_TX_DESC_QUEUE_SEL(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 8, 5, __val) -#define SET_TX_DESC_RDG_NAV_EXT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 13, 1, __val) -#define SET_TX_DESC_LSIG_TXOP_EN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 14, 1, __val) -#define SET_TX_DESC_PIFS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 15, 1, __val) -#define SET_TX_DESC_RATE_ID(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 16, 4, __val) -#define SET_TX_DESC_NAV_USE_HDR(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 20, 1, __val) -#define SET_TX_DESC_EN_DESC_ID(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 21, 1, __val) -#define SET_TX_DESC_SEC_TYPE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 22, 2, __val) -#define SET_TX_DESC_PKT_OFFSET(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 26, 5, __val) -#define SET_TX_DESC_PADDING_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 24, 8, __val) - -#define GET_TX_DESC_MACID(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 0, 5) -#define GET_TX_DESC_AGG_ENABLE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 5, 1) -#define GET_TX_DESC_AGG_BREAK(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 6, 1) -#define GET_TX_DESC_RDG_ENABLE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 7, 1) -#define GET_TX_DESC_QUEUE_SEL(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 8, 5) -#define GET_TX_DESC_RDG_NAV_EXT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 13, 1) -#define GET_TX_DESC_LSIG_TXOP_EN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 14, 1) -#define GET_TX_DESC_PIFS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 15, 1) -#define GET_TX_DESC_RATE_ID(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 16, 4) -#define GET_TX_DESC_NAV_USE_HDR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 20, 1) -#define GET_TX_DESC_EN_DESC_ID(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 21, 1) -#define GET_TX_DESC_SEC_TYPE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 22, 2) -#define GET_TX_DESC_PKT_OFFSET(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 24, 8) - -#define SET_TX_DESC_RTS_RC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 0, 6, __val) -#define SET_TX_DESC_DATA_RC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 6, 6, __val) -#define SET_TX_DESC_AGG_ENABLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 12, 1, __val) -#define SET_TX_DESC_RDG_ENABLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 13, 1, __val) -#define SET_TX_DESC_BAR_RTY_TH(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 14, 2, __val) -#define SET_TX_DESC_AGG_BREAK(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 16, 1, __val) -#define SET_TX_DESC_MORE_FRAG(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 17, 1, __val) -#define SET_TX_DESC_RAW(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 18, 1, __val) -#define SET_TX_DESC_CCX(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 19, 1, __val) -#define SET_TX_DESC_AMPDU_DENSITY(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 20, 3, __val) -#define SET_TX_DESC_BT_INT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 23, 1, __val) -#define SET_TX_DESC_ANTSEL_A(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 24, 1, __val) -#define SET_TX_DESC_ANTSEL_B(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 25, 1, __val) -#define SET_TX_DESC_TX_ANT_CCK(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 26, 2, __val) -#define SET_TX_DESC_TX_ANTL(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 28, 2, __val) -#define SET_TX_DESC_TX_ANT_HT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 30, 2, __val) - -#define GET_TX_DESC_RTS_RC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 0, 6) -#define GET_TX_DESC_DATA_RC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 6, 6) -#define GET_TX_DESC_BAR_RTY_TH(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 14, 2) -#define GET_TX_DESC_MORE_FRAG(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 17, 1) -#define GET_TX_DESC_RAW(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 18, 1) -#define GET_TX_DESC_CCX(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 19, 1) -#define GET_TX_DESC_AMPDU_DENSITY(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 20, 3) -#define GET_TX_DESC_ANTSEL_A(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 24, 1) -#define GET_TX_DESC_ANTSEL_B(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 25, 1) -#define GET_TX_DESC_TX_ANT_CCK(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 26, 2) -#define GET_TX_DESC_TX_ANTL(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 28, 2) -#define GET_TX_DESC_TX_ANT_HT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 30, 2) - -#define SET_TX_DESC_NEXT_HEAP_PAGE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 0, 8, __val) -#define SET_TX_DESC_TAIL_PAGE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 8, 8, __val) -#define SET_TX_DESC_SEQ(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 16, 12, __val) -#define SET_TX_DESC_CPU_HANDLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 28, 1, __val) -#define SET_TX_DESC_TAG1(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 29, 1, __val) -#define SET_TX_DESC_TRIGGER_INT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 30, 1, __val) -#define SET_TX_DESC_HWSEQ_EN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 31, 1, __val) - - -#define GET_TX_DESC_NEXT_HEAP_PAGE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 0, 8) -#define GET_TX_DESC_TAIL_PAGE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 8, 8) -#define GET_TX_DESC_SEQ(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 16, 12) - - -#define SET_TX_DESC_RTS_RATE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 0, 5, __val) -#define SET_TX_DESC_AP_DCFE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 5, 1, __val) -#define SET_TX_DESC_QOS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 6, 1, __val) -#define SET_TX_DESC_HWSEQ_SSN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 7, 1, __val) -#define SET_TX_DESC_USE_RATE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 8, 1, __val) -#define SET_TX_DESC_DISABLE_RTS_FB(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 9, 1, __val) -#define SET_TX_DESC_DISABLE_FB(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 10, 1, __val) -#define SET_TX_DESC_CTS2SELF(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 11, 1, __val) -#define SET_TX_DESC_RTS_ENABLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 12, 1, __val) -#define SET_TX_DESC_HW_RTS_ENABLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 13, 1, __val) -#define SET_TX_DESC_PORT_ID(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 14, 1, __val) -#define SET_TX_DESC_PWR_STATUS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 15, 3, __val) -#define SET_TX_DESC_WAIT_DCTS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 18, 1, __val) -#define SET_TX_DESC_CTS2AP_EN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 19, 1, __val) -#define SET_TX_DESC_TX_SUB_CARRIER(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 20, 2, __val) -#define SET_TX_DESC_TX_STBC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 22, 2, __val) -#define SET_TX_DESC_DATA_SHORT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 24, 1, __val) -#define SET_TX_DESC_DATA_BW(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 25, 1, __val) -#define SET_TX_DESC_RTS_SHORT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 26, 1, __val) -#define SET_TX_DESC_RTS_BW(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 27, 1, __val) -#define SET_TX_DESC_RTS_SC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 28, 2, __val) -#define SET_TX_DESC_RTS_STBC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 30, 2, __val) - -#define GET_TX_DESC_RTS_RATE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 0, 5) -#define GET_TX_DESC_AP_DCFE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 5, 1) -#define GET_TX_DESC_QOS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 6, 1) -#define GET_TX_DESC_HWSEQ_EN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 7, 1) -#define GET_TX_DESC_USE_RATE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 8, 1) -#define GET_TX_DESC_DISABLE_RTS_FB(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 9, 1) -#define GET_TX_DESC_DISABLE_FB(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 10, 1) -#define GET_TX_DESC_CTS2SELF(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 11, 1) -#define GET_TX_DESC_RTS_ENABLE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 12, 1) -#define GET_TX_DESC_HW_RTS_ENABLE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 13, 1) -#define GET_TX_DESC_PORT_ID(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 14, 1) -#define GET_TX_DESC_WAIT_DCTS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 18, 1) -#define GET_TX_DESC_CTS2AP_EN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 19, 1) -#define GET_TX_DESC_TX_SUB_CARRIER(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 20, 2) -#define GET_TX_DESC_TX_STBC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 22, 2) -#define GET_TX_DESC_DATA_SHORT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 24, 1) -#define GET_TX_DESC_DATA_BW(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 25, 1) -#define GET_TX_DESC_RTS_SHORT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 26, 1) -#define GET_TX_DESC_RTS_BW(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 27, 1) -#define GET_TX_DESC_RTS_SC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 28, 2) -#define GET_TX_DESC_RTS_STBC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 30, 2) - -#define SET_TX_DESC_TX_RATE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 0, 6, __val) -#define SET_TX_DESC_DATA_SHORTGI(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 6, 1, __val) -#define SET_TX_DESC_CCX_TAG(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 7, 1, __val) -#define SET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 8, 5, __val) -#define SET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 13, 4, __val) -#define SET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 17, 1, __val) -#define SET_TX_DESC_DATA_RETRY_LIMIT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 18, 6, __val) -#define SET_TX_DESC_USB_TXAGG_NUM(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 24, 8, __val) - -#define GET_TX_DESC_TX_RATE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 0, 6) -#define GET_TX_DESC_DATA_SHORTGI(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 6, 1) -#define GET_TX_DESC_CCX_TAG(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 7, 1) -#define GET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 8, 5) -#define GET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 13, 4) -#define GET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 17, 1) -#define GET_TX_DESC_DATA_RETRY_LIMIT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 18, 6) -#define GET_TX_DESC_USB_TXAGG_NUM(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 24, 8) - -#define SET_TX_DESC_TXAGC_A(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 0, 5, __val) -#define SET_TX_DESC_TXAGC_B(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 5, 5, __val) -#define SET_TX_DESC_USE_MAX_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 10, 1, __val) -#define SET_TX_DESC_MAX_AGG_NUM(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 11, 5, __val) -#define SET_TX_DESC_MCSG1_MAX_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 16, 4, __val) -#define SET_TX_DESC_MCSG2_MAX_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 20, 4, __val) -#define SET_TX_DESC_MCSG3_MAX_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 24, 4, __val) -#define SET_TX_DESC_MCS7_SGI_MAX_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 28, 4, __val) - -#define GET_TX_DESC_TXAGC_A(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 0, 5) -#define GET_TX_DESC_TXAGC_B(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 5, 5) -#define GET_TX_DESC_USE_MAX_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 10, 1) -#define GET_TX_DESC_MAX_AGG_NUM(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 11, 5) -#define GET_TX_DESC_MCSG1_MAX_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 16, 4) -#define GET_TX_DESC_MCSG2_MAX_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 20, 4) -#define GET_TX_DESC_MCSG3_MAX_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 24, 4) -#define GET_TX_DESC_MCS7_SGI_MAX_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 28, 4) - -#define SET_TX_DESC_TX_BUFFER_SIZE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 16, __val) -#define SET_TX_DESC_SW_OFFSET30(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 16, 8, __val) -#define SET_TX_DESC_SW_OFFSET31(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 24, 4, __val) -#define SET_TX_DESC_ANTSEL_C(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 29, 1, __val) -#define SET_TX_DESC_NULL_0(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 30, 1, __val) -#define SET_TX_DESC_NULL_1(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 30, 1, __val) - -#define GET_TX_DESC_TX_BUFFER_SIZE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+28, 0, 16) - - -#define SET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+32, 0, 32, __val) -#define SET_TX_DESC_TX_BUFFER_ADDRESS64(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+36, 0, 32, __val) - -#define GET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+32, 0, 32) -#define GET_TX_DESC_TX_BUFFER_ADDRESS64(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+36, 0, 32) - -#define SET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+40, 0, 32, __val) -#define SET_TX_DESC_NEXT_DESC_ADDRESS64(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+44, 0, 32, __val) - -#define GET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+40, 0, 32) -#define GET_TX_DESC_NEXT_DESC_ADDRESS64(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+44, 0, 32) - -#define GET_RX_DESC_PKT_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 0, 14) -#define GET_RX_DESC_CRC32(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 14, 1) -#define GET_RX_DESC_ICV(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 15, 1) -#define GET_RX_DESC_DRV_INFO_SIZE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 16, 4) -#define GET_RX_DESC_SECURITY(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 20, 3) -#define GET_RX_DESC_QOS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 23, 1) -#define GET_RX_DESC_SHIFT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 24, 2) -#define GET_RX_DESC_PHYST(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 26, 1) -#define GET_RX_DESC_SWDEC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 27, 1) -#define GET_RX_DESC_LS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 28, 1) -#define GET_RX_DESC_FS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 29, 1) -#define GET_RX_DESC_EOR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 30, 1) -#define GET_RX_DESC_OWN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 31, 1) - -#define SET_RX_DESC_PKT_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 0, 14, __val) -#define SET_RX_DESC_EOR(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 30, 1, __val) -#define SET_RX_DESC_OWN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val) - -#define GET_RX_DESC_MACID(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 0, 6) -#define GET_RX_DESC_PAGGR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 14, 1) -#define GET_RX_DESC_FAGGR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 15, 1) -#define GET_RX_DESC_A1_FIT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 16, 4) -#define GET_RX_DESC_A2_FIT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 20, 4) -#define GET_RX_DESC_PAM(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 24, 1) -#define GET_RX_DESC_PWR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 25, 1) -#define GET_RX_DESC_MD(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 26, 1) -#define GET_RX_DESC_MF(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 27, 1) -#define GET_RX_DESC_TYPE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 28, 2) -#define GET_RX_DESC_MC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 30, 1) -#define GET_RX_DESC_BC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 31, 1) -#define GET_RX_DESC_SEQ(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 0, 12) -#define GET_RX_DESC_FRAG(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 12, 4) - -#define GET_RX_DESC_RXMCS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 0, 6) -#define GET_RX_DESC_RXHT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 6, 1) -#define GET_RX_STATUS_DESC_RX_GF(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 7, 1) -#define GET_RX_DESC_SPLCP(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 8, 1) -#define GET_RX_DESC_BW(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 9, 1) -#define GET_RX_DESC_HTC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 10, 1) -#define GET_RX_STATUS_DESC_EOSP(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 11, 1) -#define GET_RX_STATUS_DESC_BSSID_FIT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 12, 2) -#define GET_RX_STATUS_DESC_RPT_SEL(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 14, 2) - -#define GET_RX_STATUS_DESC_PATTERN_MATCH(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 29, 1) -#define GET_RX_STATUS_DESC_UNICAST_MATCH(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 30, 1) -#define GET_RX_STATUS_DESC_MAGIC_MATCH(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 31, 1) - -#define GET_RX_DESC_IV1(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 0, 32) -#define GET_RX_DESC_TSFL(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 0, 32) - -#define GET_RX_DESC_BUFF_ADDR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 0, 32) -#define GET_RX_DESC_BUFF_ADDR64(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+28, 0, 32) - -#define SET_RX_DESC_BUFF_ADDR(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 0, 32, __val) -#define SET_RX_DESC_BUFF_ADDR64(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 32, __val) - -/* TX report 2 format in Rx desc*/ - -#define GET_RX_RPT2_DESC_PKT_LEN(__status) \ - LE_BITS_TO_4BYTE(__status, 0, 9) -#define GET_RX_RPT2_DESC_MACID_VALID_1(__status) \ - LE_BITS_TO_4BYTE(__status+16, 0, 32) -#define GET_RX_RPT2_DESC_MACID_VALID_2(__status) \ - LE_BITS_TO_4BYTE(__status+20, 0, 32) - -#define SET_EARLYMODE_PKTNUM(__paddr, __value) \ - SET_BITS_TO_LE_4BYTE(__paddr, 0, 4, __value) -#define SET_EARLYMODE_LEN0(__paddr, __value) \ - SET_BITS_TO_LE_4BYTE(__paddr, 4, 12, __value) -#define SET_EARLYMODE_LEN1(__paddr, __value) \ - SET_BITS_TO_LE_4BYTE(__paddr, 16, 12, __value) -#define SET_EARLYMODE_LEN2_1(__paddr, __value) \ - SET_BITS_TO_LE_4BYTE(__paddr, 28, 4, __value) -#define SET_EARLYMODE_LEN2_2(__paddr, __value) \ - SET_BITS_TO_LE_4BYTE(__paddr+4, 0, 8, __value) -#define SET_EARLYMODE_LEN3(__paddr, __value) \ - SET_BITS_TO_LE_4BYTE(__paddr+4, 8, 12, __value) -#define SET_EARLYMODE_LEN4(__paddr, __value) \ - SET_BITS_TO_LE_4BYTE(__paddr+4, 20, 12, __value) - -#define CLEAR_PCI_TX_DESC_CONTENT(__pdesc, _size) \ -do { \ - if (_size > TX_DESC_NEXT_DESC_OFFSET) \ - memset(__pdesc, 0, TX_DESC_NEXT_DESC_OFFSET); \ - else \ - memset(__pdesc, 0, _size); \ -} while (0) - -#define RTL8188_RX_HAL_IS_CCK_RATE(rxmcs)\ - (rxmcs == DESC92C_RATE1M ||\ - rxmcs == DESC92C_RATE2M ||\ - rxmcs == DESC92C_RATE5_5M ||\ - rxmcs == DESC92C_RATE11M) - -struct phy_rx_agc_info_t { - #ifdef __LITTLE_ENDIAN - u8 gain:7, trsw:1; - #else - u8 trsw:1, gain:7; - #endif -}; -struct phy_status_rpt { - struct phy_rx_agc_info_t path_agc[2]; - u8 ch_corr[2]; - u8 cck_sig_qual_ofdm_pwdb_all; - u8 cck_agc_rpt_ofdm_cfosho_a; - u8 cck_rpt_b_ofdm_cfosho_b; - u8 rsvd_1; - u8 noise_power_db_msb; - u8 path_cfotail[2]; - u8 pcts_mask[2]; - u8 stream_rxevm[2]; - u8 path_rxsnr[2]; - u8 noise_power_db_lsb; - u8 rsvd_2[3]; - u8 stream_csi[2]; - u8 stream_target_csi[2]; - u8 sig_evm; - u8 rsvd_3; -#ifdef __LITTLE_ENDIAN - u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/ - u8 sgi_en:1; - u8 rxsc:2; - u8 idle_long:1; - u8 r_ant_train_en:1; - u8 ant_sel_b:1; - u8 ant_sel:1; -#else /* _BIG_ENDIAN_ */ - u8 ant_sel:1; - u8 ant_sel_b:1; - u8 r_ant_train_en:1; - u8 idle_long:1; - u8 rxsc:2; - u8 sgi_en:1; - u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/ -#endif -} __packed; - -struct rx_fwinfo_88e { - u8 gain_trsw[4]; - u8 pwdb_all; - u8 cfosho[4]; - u8 cfotail[4]; - char rxevm[2]; - char rxsnr[4]; - u8 pdsnr[2]; - u8 csi_current[2]; - u8 csi_target[2]; - u8 sigevm; - u8 max_ex_pwr; - u8 ex_intf_flag:1; - u8 sgi_en:1; - u8 rxsc:2; - u8 reserve:4; -} __packed; - -struct tx_desc_88e { - u32 pktsize:16; - u32 offset:8; - u32 bmc:1; - u32 htc:1; - u32 lastseg:1; - u32 firstseg:1; - u32 linip:1; - u32 noacm:1; - u32 gf:1; - u32 own:1; - - u32 macid:6; - u32 rsvd0:2; - u32 queuesel:5; - u32 rd_nav_ext:1; - u32 lsig_txop_en:1; - u32 pifs:1; - u32 rateid:4; - u32 nav_usehdr:1; - u32 en_descid:1; - u32 sectype:2; - u32 pktoffset:8; - - u32 rts_rc:6; - u32 data_rc:6; - u32 agg_en:1; - u32 rdg_en:1; - u32 bar_retryht:2; - u32 agg_break:1; - u32 morefrag:1; - u32 raw:1; - u32 ccx:1; - u32 ampdudensity:3; - u32 bt_int:1; - u32 ant_sela:1; - u32 ant_selb:1; - u32 txant_cck:2; - u32 txant_l:2; - u32 txant_ht:2; - - u32 nextheadpage:8; - u32 tailpage:8; - u32 seq:12; - u32 cpu_handle:1; - u32 tag1:1; - u32 trigger_int:1; - u32 hwseq_en:1; - - u32 rtsrate:5; - u32 apdcfe:1; - u32 qos:1; - u32 hwseq_ssn:1; - u32 userrate:1; - u32 dis_rtsfb:1; - u32 dis_datafb:1; - u32 cts2self:1; - u32 rts_en:1; - u32 hwrts_en:1; - u32 portid:1; - u32 pwr_status:3; - u32 waitdcts:1; - u32 cts2ap_en:1; - u32 txsc:2; - u32 stbc:2; - u32 txshort:1; - u32 txbw:1; - u32 rtsshort:1; - u32 rtsbw:1; - u32 rtssc:2; - u32 rtsstbc:2; - - u32 txrate:6; - u32 shortgi:1; - u32 ccxt:1; - u32 txrate_fb_lmt:5; - u32 rtsrate_fb_lmt:4; - u32 retrylmt_en:1; - u32 txretrylmt:6; - u32 usb_txaggnum:8; - - u32 txagca:5; - u32 txagcb:5; - u32 usemaxlen:1; - u32 maxaggnum:5; - u32 mcsg1maxlen:4; - u32 mcsg2maxlen:4; - u32 mcsg3maxlen:4; - u32 mcs7sgimaxlen:4; - - u32 txbuffersize:16; - u32 sw_offset30:8; - u32 sw_offset31:4; - u32 rsvd1:1; - u32 antsel_c:1; - u32 null_0:1; - u32 null_1:1; - - u32 txbuffaddr; - u32 txbufferaddr64; - u32 nextdescaddress; - u32 nextdescaddress64; - - u32 reserve_pass_pcie_mm_limit[4]; -} __packed; - -struct rx_desc_88e { - u32 length:14; - u32 crc32:1; - u32 icverror:1; - u32 drv_infosize:4; - u32 security:3; - u32 qos:1; - u32 shift:2; - u32 phystatus:1; - u32 swdec:1; - u32 lastseg:1; - u32 firstseg:1; - u32 eor:1; - u32 own:1; - - u32 macid:6; - u32 tid:4; - u32 hwrsvd:5; - u32 paggr:1; - u32 faggr:1; - u32 a1_fit:4; - u32 a2_fit:4; - u32 pam:1; - u32 pwr:1; - u32 moredata:1; - u32 morefrag:1; - u32 type:2; - u32 mc:1; - u32 bc:1; - - u32 seq:12; - u32 frag:4; - u32 nextpktlen:14; - u32 nextind:1; - u32 rsvd:1; - - u32 rxmcs:6; - u32 rxht:1; - u32 amsdu:1; - u32 splcp:1; - u32 bandwidth:1; - u32 htc:1; - u32 tcpchk_rpt:1; - u32 ipcchk_rpt:1; - u32 tcpchk_valid:1; - u32 hwpcerr:1; - u32 hwpcind:1; - u32 iv0:16; - - u32 iv1; - - u32 tsfl; - - u32 bufferaddress; - u32 bufferaddress64; - -} __packed; - -void rtl88ee_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, - u8 hw_queue, struct rtl_tcb_desc *ptcb_desc); -bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw, - struct rtl_stats *status, - struct ieee80211_rx_status *rx_status, - u8 *pdesc, struct sk_buff *skb); -void rtl88ee_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val); -u32 rtl88ee_get_desc(u8 *pdesc, bool istx, u8 desc_name); -void rtl88ee_tx_polling(struct ieee80211_hw *hw, u8 hw_queue); -void rtl88ee_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, - bool b_firstseg, bool b_lastseg, - struct sk_buff *skb); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/Makefile b/drivers/net/wireless/rtlwifi/rtl8192c/Makefile deleted file mode 100644 index aee42d7ae8a2..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192c/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -rtl8192c-common-objs := \ - main.o \ - dm_common.o \ - fw_common.o \ - phy_common.o - -obj-$(CONFIG_RTL8192C_COMMON) += rtl8192c-common.o - -ccflags-y += -D__CHECK_ENDIAN__ diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c deleted file mode 100644 index d2d57a27a7c1..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c +++ /dev/null @@ -1,1701 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include -#include "dm_common.h" -#include "phy_common.h" -#include "../pci.h" -#include "../base.h" - -#define BT_RSSI_STATE_NORMAL_POWER BIT_OFFSET_LEN_MASK_32(0, 1) -#define BT_RSSI_STATE_AMDPU_OFF BIT_OFFSET_LEN_MASK_32(1, 1) -#define BT_RSSI_STATE_SPECIAL_LOW BIT_OFFSET_LEN_MASK_32(2, 1) -#define BT_RSSI_STATE_BG_EDCA_LOW BIT_OFFSET_LEN_MASK_32(3, 1) -#define BT_RSSI_STATE_TXPOWER_LOW BIT_OFFSET_LEN_MASK_32(4, 1) - -#define RTLPRIV (struct rtl_priv *) -#define GET_UNDECORATED_AVERAGE_RSSI(_priv) \ - ((RTLPRIV(_priv))->mac80211.opmode == \ - NL80211_IFTYPE_ADHOC) ? \ - ((RTLPRIV(_priv))->dm.entry_min_undec_sm_pwdb) : \ - ((RTLPRIV(_priv))->dm.undec_sm_pwdb) - -static const u32 ofdmswing_table[OFDM_TABLE_SIZE] = { - 0x7f8001fe, - 0x788001e2, - 0x71c001c7, - 0x6b8001ae, - 0x65400195, - 0x5fc0017f, - 0x5a400169, - 0x55400155, - 0x50800142, - 0x4c000130, - 0x47c0011f, - 0x43c0010f, - 0x40000100, - 0x3c8000f2, - 0x390000e4, - 0x35c000d7, - 0x32c000cb, - 0x300000c0, - 0x2d4000b5, - 0x2ac000ab, - 0x288000a2, - 0x26000098, - 0x24000090, - 0x22000088, - 0x20000080, - 0x1e400079, - 0x1c800072, - 0x1b00006c, - 0x19800066, - 0x18000060, - 0x16c0005b, - 0x15800056, - 0x14400051, - 0x1300004c, - 0x12000048, - 0x11000044, - 0x10000040, -}; - -static const u8 cckswing_table_ch1ch13[CCK_TABLE_SIZE][8] = { - {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, - {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, - {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, - {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, - {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, - {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, - {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, - {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, - {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, - {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, - {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, - {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, - {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, - {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, - {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, - {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, - {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, - {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, - {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, - {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, - {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, - {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, - {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, - {0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, - {0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, - {0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, - {0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, - {0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, - {0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, - {0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, - {0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, - {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, - {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01} -}; - -static const u8 cckswing_table_ch14[CCK_TABLE_SIZE][8] = { - {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, - {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, - {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, - {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, - {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, - {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, - {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, - {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, - {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, - {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, - {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, - {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, - {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, - {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, - {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, - {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, - {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, - {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, - {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, - {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, - {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, - {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, - {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, - {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, - {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, - {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, - {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, - {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, - {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, - {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, - {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, - {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, - {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00} -}; - -static void rtl92c_dm_diginit(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - - dm_digtable->dig_enable_flag = true; - dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; - dm_digtable->cur_igvalue = 0x20; - dm_digtable->pre_igvalue = 0x0; - dm_digtable->cursta_cstate = DIG_STA_DISCONNECT; - dm_digtable->presta_cstate = DIG_STA_DISCONNECT; - dm_digtable->curmultista_cstate = DIG_MULTISTA_DISCONNECT; - dm_digtable->rssi_lowthresh = DM_DIG_THRESH_LOW; - dm_digtable->rssi_highthresh = DM_DIG_THRESH_HIGH; - dm_digtable->fa_lowthresh = DM_FALSEALARM_THRESH_LOW; - dm_digtable->fa_highthresh = DM_FALSEALARM_THRESH_HIGH; - dm_digtable->rx_gain_max = DM_DIG_MAX; - dm_digtable->rx_gain_min = DM_DIG_MIN; - dm_digtable->back_val = DM_DIG_BACKOFF_DEFAULT; - dm_digtable->back_range_max = DM_DIG_BACKOFF_MAX; - dm_digtable->back_range_min = DM_DIG_BACKOFF_MIN; - dm_digtable->pre_cck_pd_state = CCK_PD_STAGE_MAX; - dm_digtable->cur_cck_pd_state = CCK_PD_STAGE_MAX; -} - -static u8 rtl92c_dm_initial_gain_min_pwdb(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - long rssi_val_min = 0; - - if ((dm_digtable->curmultista_cstate == DIG_MULTISTA_CONNECT) && - (dm_digtable->cursta_cstate == DIG_STA_CONNECT)) { - if (rtlpriv->dm.entry_min_undec_sm_pwdb != 0) - rssi_val_min = - (rtlpriv->dm.entry_min_undec_sm_pwdb > - rtlpriv->dm.undec_sm_pwdb) ? - rtlpriv->dm.undec_sm_pwdb : - rtlpriv->dm.entry_min_undec_sm_pwdb; - else - rssi_val_min = rtlpriv->dm.undec_sm_pwdb; - } else if (dm_digtable->cursta_cstate == DIG_STA_CONNECT || - dm_digtable->cursta_cstate == DIG_STA_BEFORE_CONNECT) { - rssi_val_min = rtlpriv->dm.undec_sm_pwdb; - } else if (dm_digtable->curmultista_cstate == DIG_MULTISTA_CONNECT) { - rssi_val_min = rtlpriv->dm.entry_min_undec_sm_pwdb; - } - - return (u8) rssi_val_min; -} - -static void rtl92c_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) -{ - u32 ret_value; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); - - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER1, MASKDWORD); - falsealm_cnt->cnt_parity_fail = ((ret_value & 0xffff0000) >> 16); - - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER2, MASKDWORD); - falsealm_cnt->cnt_rate_illegal = (ret_value & 0xffff); - falsealm_cnt->cnt_crc8_fail = ((ret_value & 0xffff0000) >> 16); - - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER3, MASKDWORD); - falsealm_cnt->cnt_mcs_fail = (ret_value & 0xffff); - falsealm_cnt->cnt_ofdm_fail = falsealm_cnt->cnt_parity_fail + - falsealm_cnt->cnt_rate_illegal + - falsealm_cnt->cnt_crc8_fail + falsealm_cnt->cnt_mcs_fail; - - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, BIT(14), 1); - ret_value = rtl_get_bbreg(hw, RCCK0_FACOUNTERLOWER, MASKBYTE0); - falsealm_cnt->cnt_cck_fail = ret_value; - - ret_value = rtl_get_bbreg(hw, RCCK0_FACOUNTERUPPER, MASKBYTE3); - falsealm_cnt->cnt_cck_fail += (ret_value & 0xff) << 8; - falsealm_cnt->cnt_all = (falsealm_cnt->cnt_parity_fail + - falsealm_cnt->cnt_rate_illegal + - falsealm_cnt->cnt_crc8_fail + - falsealm_cnt->cnt_mcs_fail + - falsealm_cnt->cnt_cck_fail); - - rtl_set_bbreg(hw, ROFDM1_LSTF, 0x08000000, 1); - rtl_set_bbreg(hw, ROFDM1_LSTF, 0x08000000, 0); - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, 0x0000c000, 0); - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, 0x0000c000, 2); - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, - "cnt_parity_fail = %d, cnt_rate_illegal = %d, cnt_crc8_fail = %d, cnt_mcs_fail = %d\n", - falsealm_cnt->cnt_parity_fail, - falsealm_cnt->cnt_rate_illegal, - falsealm_cnt->cnt_crc8_fail, falsealm_cnt->cnt_mcs_fail); - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, - "cnt_ofdm_fail = %x, cnt_cck_fail = %x, cnt_all = %x\n", - falsealm_cnt->cnt_ofdm_fail, - falsealm_cnt->cnt_cck_fail, falsealm_cnt->cnt_all); -} - -static void rtl92c_dm_ctrl_initgain_by_fa(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - u8 value_igi = dm_digtable->cur_igvalue; - - if (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH0) - value_igi--; - else if (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH1) - value_igi += 0; - else if (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH2) - value_igi++; - else if (rtlpriv->falsealm_cnt.cnt_all >= DM_DIG_FA_TH2) - value_igi += 2; - if (value_igi > DM_DIG_FA_UPPER) - value_igi = DM_DIG_FA_UPPER; - else if (value_igi < DM_DIG_FA_LOWER) - value_igi = DM_DIG_FA_LOWER; - if (rtlpriv->falsealm_cnt.cnt_all > 10000) - value_igi = 0x32; - - dm_digtable->cur_igvalue = value_igi; - rtl92c_dm_write_dig(hw); -} - -static void rtl92c_dm_ctrl_initgain_by_rssi(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *digtable = &rtlpriv->dm_digtable; - - if (rtlpriv->falsealm_cnt.cnt_all > digtable->fa_highthresh) { - if ((digtable->back_val - 2) < digtable->back_range_min) - digtable->back_val = digtable->back_range_min; - else - digtable->back_val -= 2; - } else if (rtlpriv->falsealm_cnt.cnt_all < digtable->fa_lowthresh) { - if ((digtable->back_val + 2) > digtable->back_range_max) - digtable->back_val = digtable->back_range_max; - else - digtable->back_val += 2; - } - - if ((digtable->rssi_val_min + 10 - digtable->back_val) > - digtable->rx_gain_max) - digtable->cur_igvalue = digtable->rx_gain_max; - else if ((digtable->rssi_val_min + 10 - - digtable->back_val) < digtable->rx_gain_min) - digtable->cur_igvalue = digtable->rx_gain_min; - else - digtable->cur_igvalue = digtable->rssi_val_min + 10 - - digtable->back_val; - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, - "rssi_val_min = %x back_val %x\n", - digtable->rssi_val_min, digtable->back_val); - - rtl92c_dm_write_dig(hw); -} - -static void rtl92c_dm_initial_gain_multi_sta(struct ieee80211_hw *hw) -{ - static u8 initialized; /* initialized to false */ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - long rssi_strength = rtlpriv->dm.entry_min_undec_sm_pwdb; - bool multi_sta = false; - - if (mac->opmode == NL80211_IFTYPE_ADHOC) - multi_sta = true; - - if (!multi_sta || - dm_digtable->cursta_cstate != DIG_STA_DISCONNECT) { - initialized = false; - dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; - return; - } else if (initialized == false) { - initialized = true; - dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; - dm_digtable->cur_igvalue = 0x20; - rtl92c_dm_write_dig(hw); - } - - if (dm_digtable->curmultista_cstate == DIG_MULTISTA_CONNECT) { - if ((rssi_strength < dm_digtable->rssi_lowthresh) && - (dm_digtable->dig_ext_port_stage != DIG_EXT_PORT_STAGE_1)) { - - if (dm_digtable->dig_ext_port_stage == - DIG_EXT_PORT_STAGE_2) { - dm_digtable->cur_igvalue = 0x20; - rtl92c_dm_write_dig(hw); - } - - dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_1; - } else if (rssi_strength > dm_digtable->rssi_highthresh) { - dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_2; - rtl92c_dm_ctrl_initgain_by_fa(hw); - } - } else if (dm_digtable->dig_ext_port_stage != DIG_EXT_PORT_STAGE_0) { - dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; - dm_digtable->cur_igvalue = 0x20; - rtl92c_dm_write_dig(hw); - } - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, - "curmultista_cstate = %x dig_ext_port_stage %x\n", - dm_digtable->curmultista_cstate, - dm_digtable->dig_ext_port_stage); -} - -static void rtl92c_dm_initial_gain_sta(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, - "presta_cstate = %x, cursta_cstate = %x\n", - dm_digtable->presta_cstate, dm_digtable->cursta_cstate); - - if (dm_digtable->presta_cstate == dm_digtable->cursta_cstate || - dm_digtable->cursta_cstate == DIG_STA_BEFORE_CONNECT || - dm_digtable->cursta_cstate == DIG_STA_CONNECT) { - - if (dm_digtable->cursta_cstate != DIG_STA_DISCONNECT) { - dm_digtable->rssi_val_min = - rtl92c_dm_initial_gain_min_pwdb(hw); - rtl92c_dm_ctrl_initgain_by_rssi(hw); - } - } else { - dm_digtable->rssi_val_min = 0; - dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; - dm_digtable->back_val = DM_DIG_BACKOFF_DEFAULT; - dm_digtable->cur_igvalue = 0x20; - dm_digtable->pre_igvalue = 0; - rtl92c_dm_write_dig(hw); - } -} - -static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - - if (dm_digtable->cursta_cstate == DIG_STA_CONNECT) { - dm_digtable->rssi_val_min = rtl92c_dm_initial_gain_min_pwdb(hw); - - if (dm_digtable->pre_cck_pd_state == CCK_PD_STAGE_LowRssi) { - if (dm_digtable->rssi_val_min <= 25) - dm_digtable->cur_cck_pd_state = - CCK_PD_STAGE_LowRssi; - else - dm_digtable->cur_cck_pd_state = - CCK_PD_STAGE_HighRssi; - } else { - if (dm_digtable->rssi_val_min <= 20) - dm_digtable->cur_cck_pd_state = - CCK_PD_STAGE_LowRssi; - else - dm_digtable->cur_cck_pd_state = - CCK_PD_STAGE_HighRssi; - } - } else { - dm_digtable->cur_cck_pd_state = CCK_PD_STAGE_MAX; - } - - if (dm_digtable->pre_cck_pd_state != dm_digtable->cur_cck_pd_state) { - if (dm_digtable->cur_cck_pd_state == CCK_PD_STAGE_LowRssi) { - if (rtlpriv->falsealm_cnt.cnt_cck_fail > 800) - dm_digtable->cur_cck_fa_state = - CCK_FA_STAGE_High; - else - dm_digtable->cur_cck_fa_state = CCK_FA_STAGE_Low; - - if (dm_digtable->pre_cck_fa_state != - dm_digtable->cur_cck_fa_state) { - if (dm_digtable->cur_cck_fa_state == - CCK_FA_STAGE_Low) - rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, - 0x83); - else - rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, - 0xcd); - - dm_digtable->pre_cck_fa_state = - dm_digtable->cur_cck_fa_state; - } - - rtl_set_bbreg(hw, RCCK0_SYSTEM, MASKBYTE1, 0x40); - - if (IS_92C_SERIAL(rtlhal->version)) - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, - MASKBYTE2, 0xd7); - } else { - rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, 0xcd); - rtl_set_bbreg(hw, RCCK0_SYSTEM, MASKBYTE1, 0x47); - - if (IS_92C_SERIAL(rtlhal->version)) - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, - MASKBYTE2, 0xd3); - } - dm_digtable->pre_cck_pd_state = dm_digtable->cur_cck_pd_state; - } - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "CCKPDStage=%x\n", - dm_digtable->cur_cck_pd_state); - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "is92C=%x\n", - IS_92C_SERIAL(rtlhal->version)); -} - -static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - if (mac->act_scanning) - return; - - if (mac->link_state >= MAC80211_LINKED) - dm_digtable->cursta_cstate = DIG_STA_CONNECT; - else - dm_digtable->cursta_cstate = DIG_STA_DISCONNECT; - - rtl92c_dm_initial_gain_sta(hw); - rtl92c_dm_initial_gain_multi_sta(hw); - rtl92c_dm_cck_packet_detection_thresh(hw); - - dm_digtable->presta_cstate = dm_digtable->cursta_cstate; - -} - -static void rtl92c_dm_dig(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - - if (rtlpriv->dm.dm_initialgain_enable == false) - return; - if (dm_digtable->dig_enable_flag == false) - return; - - rtl92c_dm_ctrl_initgain_by_twoport(hw); - -} - -static void rtl92c_dm_init_dynamic_txpower(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.dynamic_txpower_enable = false; - - rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; -} - -void rtl92c_dm_write_dig(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "cur_igvalue = 0x%x, pre_igvalue = 0x%x, back_val = %d\n", - dm_digtable->cur_igvalue, dm_digtable->pre_igvalue, - dm_digtable->back_val); - - dm_digtable->cur_igvalue += 2; - if (dm_digtable->cur_igvalue > 0x3f) - dm_digtable->cur_igvalue = 0x3f; - - if (dm_digtable->pre_igvalue != dm_digtable->cur_igvalue) { - rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, - dm_digtable->cur_igvalue); - rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, 0x7f, - dm_digtable->cur_igvalue); - - dm_digtable->pre_igvalue = dm_digtable->cur_igvalue; - } -} -EXPORT_SYMBOL(rtl92c_dm_write_dig); - -static void rtl92c_dm_pwdb_monitor(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - long tmpentry_max_pwdb = 0, tmpentry_min_pwdb = 0xff; - - u8 h2c_parameter[3] = { 0 }; - - return; - - if (tmpentry_max_pwdb != 0) { - rtlpriv->dm.entry_max_undec_sm_pwdb = tmpentry_max_pwdb; - } else { - rtlpriv->dm.entry_max_undec_sm_pwdb = 0; - } - - if (tmpentry_min_pwdb != 0xff) { - rtlpriv->dm.entry_min_undec_sm_pwdb = tmpentry_min_pwdb; - } else { - rtlpriv->dm.entry_min_undec_sm_pwdb = 0; - } - - h2c_parameter[2] = (u8) (rtlpriv->dm.undec_sm_pwdb & 0xFF); - h2c_parameter[0] = 0; - - rtl92c_fill_h2c_cmd(hw, H2C_RSSI_REPORT, 3, h2c_parameter); -} - -void rtl92c_dm_init_edca_turbo(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - rtlpriv->dm.current_turbo_edca = false; - rtlpriv->dm.is_any_nonbepkts = false; - rtlpriv->dm.is_cur_rdlstate = false; -} -EXPORT_SYMBOL(rtl92c_dm_init_edca_turbo); - -static void rtl92c_dm_check_edca_turbo(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - static u64 last_txok_cnt; - static u64 last_rxok_cnt; - static u32 last_bt_edca_ul; - static u32 last_bt_edca_dl; - u64 cur_txok_cnt = 0; - u64 cur_rxok_cnt = 0; - u32 edca_be_ul = 0x5ea42b; - u32 edca_be_dl = 0x5ea42b; - bool bt_change_edca = false; - - if ((last_bt_edca_ul != rtlpcipriv->bt_coexist.bt_edca_ul) || - (last_bt_edca_dl != rtlpcipriv->bt_coexist.bt_edca_dl)) { - rtlpriv->dm.current_turbo_edca = false; - last_bt_edca_ul = rtlpcipriv->bt_coexist.bt_edca_ul; - last_bt_edca_dl = rtlpcipriv->bt_coexist.bt_edca_dl; - } - - if (rtlpcipriv->bt_coexist.bt_edca_ul != 0) { - edca_be_ul = rtlpcipriv->bt_coexist.bt_edca_ul; - bt_change_edca = true; - } - - if (rtlpcipriv->bt_coexist.bt_edca_dl != 0) { - edca_be_ul = rtlpcipriv->bt_coexist.bt_edca_dl; - bt_change_edca = true; - } - - if (mac->link_state != MAC80211_LINKED) { - rtlpriv->dm.current_turbo_edca = false; - return; - } - - if ((!mac->ht_enable) && (!rtlpcipriv->bt_coexist.bt_coexistence)) { - if (!(edca_be_ul & 0xffff0000)) - edca_be_ul |= 0x005e0000; - - if (!(edca_be_dl & 0xffff0000)) - edca_be_dl |= 0x005e0000; - } - - if ((bt_change_edca) || ((!rtlpriv->dm.is_any_nonbepkts) && - (!rtlpriv->dm.disable_framebursting))) { - - cur_txok_cnt = rtlpriv->stats.txbytesunicast - last_txok_cnt; - cur_rxok_cnt = rtlpriv->stats.rxbytesunicast - last_rxok_cnt; - - if (cur_rxok_cnt > 4 * cur_txok_cnt) { - if (!rtlpriv->dm.is_cur_rdlstate || - !rtlpriv->dm.current_turbo_edca) { - rtl_write_dword(rtlpriv, - REG_EDCA_BE_PARAM, - edca_be_dl); - rtlpriv->dm.is_cur_rdlstate = true; - } - } else { - if (rtlpriv->dm.is_cur_rdlstate || - !rtlpriv->dm.current_turbo_edca) { - rtl_write_dword(rtlpriv, - REG_EDCA_BE_PARAM, - edca_be_ul); - rtlpriv->dm.is_cur_rdlstate = false; - } - } - rtlpriv->dm.current_turbo_edca = true; - } else { - if (rtlpriv->dm.current_turbo_edca) { - u8 tmp = AC0_BE; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_AC_PARAM, - &tmp); - rtlpriv->dm.current_turbo_edca = false; - } - } - - rtlpriv->dm.is_any_nonbepkts = false; - last_txok_cnt = rtlpriv->stats.txbytesunicast; - last_rxok_cnt = rtlpriv->stats.rxbytesunicast; -} - -static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw - *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 thermalvalue, delta, delta_lck, delta_iqk; - long ele_a, ele_d, temp_cck, val_x, value32; - long val_y, ele_c = 0; - u8 ofdm_index[2], ofdm_index_old[2] = {0, 0}, cck_index_old = 0; - s8 cck_index = 0; - int i; - bool is2t = IS_92C_SERIAL(rtlhal->version); - s8 txpwr_level[2] = {0, 0}; - u8 ofdm_min_index = 6, rf; - - rtlpriv->dm.txpower_trackinginit = true; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "rtl92c_dm_txpower_tracking_callback_thermalmeter\n"); - - thermalvalue = (u8) rtl_get_rfreg(hw, RF90_PATH_A, RF_T_METER, 0x1f); - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x\n", - thermalvalue, rtlpriv->dm.thermalvalue, - rtlefuse->eeprom_thermalmeter); - - rtl92c_phy_ap_calibrate(hw, (thermalvalue - - rtlefuse->eeprom_thermalmeter)); - if (is2t) - rf = 2; - else - rf = 1; - - if (thermalvalue) { - ele_d = rtl_get_bbreg(hw, ROFDM0_XATXIQIMBALANCE, - MASKDWORD) & MASKOFDM_D; - - for (i = 0; i < OFDM_TABLE_LENGTH; i++) { - if (ele_d == (ofdmswing_table[i] & MASKOFDM_D)) { - ofdm_index_old[0] = (u8) i; - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Initial pathA ele_d reg0x%x = 0x%lx, ofdm_index=0x%x\n", - ROFDM0_XATXIQIMBALANCE, - ele_d, ofdm_index_old[0]); - break; - } - } - - if (is2t) { - ele_d = rtl_get_bbreg(hw, ROFDM0_XBTXIQIMBALANCE, - MASKDWORD) & MASKOFDM_D; - - for (i = 0; i < OFDM_TABLE_LENGTH; i++) { - if (ele_d == (ofdmswing_table[i] & - MASKOFDM_D)) { - ofdm_index_old[1] = (u8) i; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, - DBG_LOUD, - "Initial pathB ele_d reg0x%x = 0x%lx, ofdm_index=0x%x\n", - ROFDM0_XBTXIQIMBALANCE, ele_d, - ofdm_index_old[1]); - break; - } - } - } - - temp_cck = - rtl_get_bbreg(hw, RCCK0_TXFILTER2, MASKDWORD) & MASKCCK; - - for (i = 0; i < CCK_TABLE_LENGTH; i++) { - if (rtlpriv->dm.cck_inch14) { - if (memcmp((void *)&temp_cck, - (void *)&cckswing_table_ch14[i][2], - 4) == 0) { - cck_index_old = (u8) i; - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, - DBG_LOUD, - "Initial reg0x%x = 0x%lx, cck_index=0x%x, ch 14 %d\n", - RCCK0_TXFILTER2, temp_cck, - cck_index_old, - rtlpriv->dm.cck_inch14); - break; - } - } else { - if (memcmp((void *)&temp_cck, - (void *) - &cckswing_table_ch1ch13[i][2], - 4) == 0) { - cck_index_old = (u8) i; - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, - DBG_LOUD, - "Initial reg0x%x = 0x%lx, cck_index=0x%x, ch14 %d\n", - RCCK0_TXFILTER2, temp_cck, - cck_index_old, - rtlpriv->dm.cck_inch14); - break; - } - } - } - - if (!rtlpriv->dm.thermalvalue) { - rtlpriv->dm.thermalvalue = - rtlefuse->eeprom_thermalmeter; - rtlpriv->dm.thermalvalue_lck = thermalvalue; - rtlpriv->dm.thermalvalue_iqk = thermalvalue; - for (i = 0; i < rf; i++) - rtlpriv->dm.ofdm_index[i] = ofdm_index_old[i]; - rtlpriv->dm.cck_index = cck_index_old; - } - - delta = (thermalvalue > rtlpriv->dm.thermalvalue) ? - (thermalvalue - rtlpriv->dm.thermalvalue) : - (rtlpriv->dm.thermalvalue - thermalvalue); - - delta_lck = (thermalvalue > rtlpriv->dm.thermalvalue_lck) ? - (thermalvalue - rtlpriv->dm.thermalvalue_lck) : - (rtlpriv->dm.thermalvalue_lck - thermalvalue); - - delta_iqk = (thermalvalue > rtlpriv->dm.thermalvalue_iqk) ? - (thermalvalue - rtlpriv->dm.thermalvalue_iqk) : - (rtlpriv->dm.thermalvalue_iqk - thermalvalue); - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x delta 0x%x delta_lck 0x%x delta_iqk 0x%x\n", - thermalvalue, rtlpriv->dm.thermalvalue, - rtlefuse->eeprom_thermalmeter, delta, delta_lck, - delta_iqk); - - if (delta_lck > 1) { - rtlpriv->dm.thermalvalue_lck = thermalvalue; - rtl92c_phy_lc_calibrate(hw); - } - - if (delta > 0 && rtlpriv->dm.txpower_track_control) { - if (thermalvalue > rtlpriv->dm.thermalvalue) { - for (i = 0; i < rf; i++) - rtlpriv->dm.ofdm_index[i] -= delta; - rtlpriv->dm.cck_index -= delta; - } else { - for (i = 0; i < rf; i++) - rtlpriv->dm.ofdm_index[i] += delta; - rtlpriv->dm.cck_index += delta; - } - - if (is2t) { - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "temp OFDM_A_index=0x%x, OFDM_B_index=0x%x, cck_index=0x%x\n", - rtlpriv->dm.ofdm_index[0], - rtlpriv->dm.ofdm_index[1], - rtlpriv->dm.cck_index); - } else { - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "temp OFDM_A_index=0x%x, cck_index=0x%x\n", - rtlpriv->dm.ofdm_index[0], - rtlpriv->dm.cck_index); - } - - if (thermalvalue > rtlefuse->eeprom_thermalmeter) { - for (i = 0; i < rf; i++) - ofdm_index[i] = - rtlpriv->dm.ofdm_index[i] - + 1; - cck_index = rtlpriv->dm.cck_index + 1; - } else { - for (i = 0; i < rf; i++) - ofdm_index[i] = - rtlpriv->dm.ofdm_index[i]; - cck_index = rtlpriv->dm.cck_index; - } - - for (i = 0; i < rf; i++) { - if (txpwr_level[i] >= 0 && - txpwr_level[i] <= 26) { - if (thermalvalue > - rtlefuse->eeprom_thermalmeter) { - if (delta < 5) - ofdm_index[i] -= 1; - - else - ofdm_index[i] -= 2; - } else if (delta > 5 && thermalvalue < - rtlefuse-> - eeprom_thermalmeter) { - ofdm_index[i] += 1; - } - } else if (txpwr_level[i] >= 27 && - txpwr_level[i] <= 32 - && thermalvalue > - rtlefuse->eeprom_thermalmeter) { - if (delta < 5) - ofdm_index[i] -= 1; - - else - ofdm_index[i] -= 2; - } else if (txpwr_level[i] >= 32 && - txpwr_level[i] <= 38 && - thermalvalue > - rtlefuse->eeprom_thermalmeter - && delta > 5) { - ofdm_index[i] -= 1; - } - } - - if (txpwr_level[i] >= 0 && txpwr_level[i] <= 26) { - if (thermalvalue > - rtlefuse->eeprom_thermalmeter) { - if (delta < 5) - cck_index -= 1; - - else - cck_index -= 2; - } else if (delta > 5 && thermalvalue < - rtlefuse->eeprom_thermalmeter) { - cck_index += 1; - } - } else if (txpwr_level[i] >= 27 && - txpwr_level[i] <= 32 && - thermalvalue > - rtlefuse->eeprom_thermalmeter) { - if (delta < 5) - cck_index -= 1; - - else - cck_index -= 2; - } else if (txpwr_level[i] >= 32 && - txpwr_level[i] <= 38 && - thermalvalue > rtlefuse->eeprom_thermalmeter - && delta > 5) { - cck_index -= 1; - } - - for (i = 0; i < rf; i++) { - if (ofdm_index[i] > OFDM_TABLE_SIZE - 1) - ofdm_index[i] = OFDM_TABLE_SIZE - 1; - - else if (ofdm_index[i] < ofdm_min_index) - ofdm_index[i] = ofdm_min_index; - } - - if (cck_index > CCK_TABLE_SIZE - 1) - cck_index = CCK_TABLE_SIZE - 1; - else if (cck_index < 0) - cck_index = 0; - - if (is2t) { - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "new OFDM_A_index=0x%x, OFDM_B_index=0x%x, cck_index=0x%x\n", - ofdm_index[0], ofdm_index[1], - cck_index); - } else { - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "new OFDM_A_index=0x%x, cck_index=0x%x\n", - ofdm_index[0], cck_index); - } - } - - if (rtlpriv->dm.txpower_track_control && delta != 0) { - ele_d = - (ofdmswing_table[ofdm_index[0]] & 0xFFC00000) >> 22; - val_x = rtlphy->reg_e94; - val_y = rtlphy->reg_e9c; - - if (val_x != 0) { - if ((val_x & 0x00000200) != 0) - val_x = val_x | 0xFFFFFC00; - ele_a = ((val_x * ele_d) >> 8) & 0x000003FF; - - if ((val_y & 0x00000200) != 0) - val_y = val_y | 0xFFFFFC00; - ele_c = ((val_y * ele_d) >> 8) & 0x000003FF; - - value32 = (ele_d << 22) | - ((ele_c & 0x3F) << 16) | ele_a; - - rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE, - MASKDWORD, value32); - - value32 = (ele_c & 0x000003C0) >> 6; - rtl_set_bbreg(hw, ROFDM0_XCTXAFE, MASKH4BITS, - value32); - - value32 = ((val_x * ele_d) >> 7) & 0x01; - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, - BIT(31), value32); - - value32 = ((val_y * ele_d) >> 7) & 0x01; - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, - BIT(29), value32); - } else { - rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE, - MASKDWORD, - ofdmswing_table[ofdm_index[0]]); - - rtl_set_bbreg(hw, ROFDM0_XCTXAFE, MASKH4BITS, - 0x00); - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, - BIT(31) | BIT(29), 0x00); - } - - if (!rtlpriv->dm.cck_inch14) { - rtl_write_byte(rtlpriv, 0xa22, - cckswing_table_ch1ch13[cck_index] - [0]); - rtl_write_byte(rtlpriv, 0xa23, - cckswing_table_ch1ch13[cck_index] - [1]); - rtl_write_byte(rtlpriv, 0xa24, - cckswing_table_ch1ch13[cck_index] - [2]); - rtl_write_byte(rtlpriv, 0xa25, - cckswing_table_ch1ch13[cck_index] - [3]); - rtl_write_byte(rtlpriv, 0xa26, - cckswing_table_ch1ch13[cck_index] - [4]); - rtl_write_byte(rtlpriv, 0xa27, - cckswing_table_ch1ch13[cck_index] - [5]); - rtl_write_byte(rtlpriv, 0xa28, - cckswing_table_ch1ch13[cck_index] - [6]); - rtl_write_byte(rtlpriv, 0xa29, - cckswing_table_ch1ch13[cck_index] - [7]); - } else { - rtl_write_byte(rtlpriv, 0xa22, - cckswing_table_ch14[cck_index] - [0]); - rtl_write_byte(rtlpriv, 0xa23, - cckswing_table_ch14[cck_index] - [1]); - rtl_write_byte(rtlpriv, 0xa24, - cckswing_table_ch14[cck_index] - [2]); - rtl_write_byte(rtlpriv, 0xa25, - cckswing_table_ch14[cck_index] - [3]); - rtl_write_byte(rtlpriv, 0xa26, - cckswing_table_ch14[cck_index] - [4]); - rtl_write_byte(rtlpriv, 0xa27, - cckswing_table_ch14[cck_index] - [5]); - rtl_write_byte(rtlpriv, 0xa28, - cckswing_table_ch14[cck_index] - [6]); - rtl_write_byte(rtlpriv, 0xa29, - cckswing_table_ch14[cck_index] - [7]); - } - - if (is2t) { - ele_d = (ofdmswing_table[ofdm_index[1]] & - 0xFFC00000) >> 22; - - val_x = rtlphy->reg_eb4; - val_y = rtlphy->reg_ebc; - - if (val_x != 0) { - if ((val_x & 0x00000200) != 0) - val_x = val_x | 0xFFFFFC00; - ele_a = ((val_x * ele_d) >> 8) & - 0x000003FF; - - if ((val_y & 0x00000200) != 0) - val_y = val_y | 0xFFFFFC00; - ele_c = ((val_y * ele_d) >> 8) & - 0x00003FF; - - value32 = (ele_d << 22) | - ((ele_c & 0x3F) << 16) | ele_a; - rtl_set_bbreg(hw, - ROFDM0_XBTXIQIMBALANCE, - MASKDWORD, value32); - - value32 = (ele_c & 0x000003C0) >> 6; - rtl_set_bbreg(hw, ROFDM0_XDTXAFE, - MASKH4BITS, value32); - - value32 = ((val_x * ele_d) >> 7) & 0x01; - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, - BIT(27), value32); - - value32 = ((val_y * ele_d) >> 7) & 0x01; - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, - BIT(25), value32); - } else { - rtl_set_bbreg(hw, - ROFDM0_XBTXIQIMBALANCE, - MASKDWORD, - ofdmswing_table[ofdm_index - [1]]); - rtl_set_bbreg(hw, ROFDM0_XDTXAFE, - MASKH4BITS, 0x00); - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, - BIT(27) | BIT(25), 0x00); - } - - } - } - - if (delta_iqk > 3) { - rtlpriv->dm.thermalvalue_iqk = thermalvalue; - rtl92c_phy_iq_calibrate(hw, false); - } - - if (rtlpriv->dm.txpower_track_control) - rtlpriv->dm.thermalvalue = thermalvalue; - } - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "<===\n"); - -} - -static void rtl92c_dm_initialize_txpower_tracking_thermalmeter( - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.txpower_tracking = true; - rtlpriv->dm.txpower_trackinginit = false; - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "pMgntInfo->txpower_tracking = %d\n", - rtlpriv->dm.txpower_tracking); -} - -static void rtl92c_dm_initialize_txpower_tracking(struct ieee80211_hw *hw) -{ - rtl92c_dm_initialize_txpower_tracking_thermalmeter(hw); -} - -static void rtl92c_dm_txpower_tracking_directcall(struct ieee80211_hw *hw) -{ - rtl92c_dm_txpower_tracking_callback_thermalmeter(hw); -} - -static void rtl92c_dm_check_txpower_tracking_thermal_meter( - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - static u8 tm_trigger; - - if (!rtlpriv->dm.txpower_tracking) - return; - - if (!tm_trigger) { - rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER, RFREG_OFFSET_MASK, - 0x60); - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Trigger 92S Thermal Meter!!\n"); - tm_trigger = 1; - return; - } else { - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Schedule TxPowerTracking direct call!!\n"); - rtl92c_dm_txpower_tracking_directcall(hw); - tm_trigger = 0; - } -} - -void rtl92c_dm_check_txpower_tracking(struct ieee80211_hw *hw) -{ - rtl92c_dm_check_txpower_tracking_thermal_meter(hw); -} -EXPORT_SYMBOL(rtl92c_dm_check_txpower_tracking); - -void rtl92c_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rate_adaptive *p_ra = &(rtlpriv->ra); - - p_ra->ratr_state = DM_RATR_STA_INIT; - p_ra->pre_ratr_state = DM_RATR_STA_INIT; - - if (rtlpriv->dm.dm_type == DM_TYPE_BYDRIVER) - rtlpriv->dm.useramask = true; - else - rtlpriv->dm.useramask = false; - -} -EXPORT_SYMBOL(rtl92c_dm_init_rate_adaptive_mask); - -static void rtl92c_dm_init_dynamic_bb_powersaving(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct ps_t *dm_pstable = &rtlpriv->dm_pstable; - - dm_pstable->pre_ccastate = CCA_MAX; - dm_pstable->cur_ccasate = CCA_MAX; - dm_pstable->pre_rfstate = RF_MAX; - dm_pstable->cur_rfstate = RF_MAX; - dm_pstable->rssi_val_min = 0; -} - -void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct ps_t *dm_pstable = &rtlpriv->dm_pstable; - static u8 initialize; - static u32 reg_874, reg_c70, reg_85c, reg_a74; - - if (initialize == 0) { - reg_874 = (rtl_get_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, - MASKDWORD) & 0x1CC000) >> 14; - - reg_c70 = (rtl_get_bbreg(hw, ROFDM0_AGCPARAMETER1, - MASKDWORD) & BIT(3)) >> 3; - - reg_85c = (rtl_get_bbreg(hw, RFPGA0_XCD_SWITCHCONTROL, - MASKDWORD) & 0xFF000000) >> 24; - - reg_a74 = (rtl_get_bbreg(hw, 0xa74, MASKDWORD) & 0xF000) >> 12; - - initialize = 1; - } - - if (!bforce_in_normal) { - if (dm_pstable->rssi_val_min != 0) { - if (dm_pstable->pre_rfstate == RF_NORMAL) { - if (dm_pstable->rssi_val_min >= 30) - dm_pstable->cur_rfstate = RF_SAVE; - else - dm_pstable->cur_rfstate = RF_NORMAL; - } else { - if (dm_pstable->rssi_val_min <= 25) - dm_pstable->cur_rfstate = RF_NORMAL; - else - dm_pstable->cur_rfstate = RF_SAVE; - } - } else { - dm_pstable->cur_rfstate = RF_MAX; - } - } else { - dm_pstable->cur_rfstate = RF_NORMAL; - } - - if (dm_pstable->pre_rfstate != dm_pstable->cur_rfstate) { - if (dm_pstable->cur_rfstate == RF_SAVE) { - rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, - 0x1C0000, 0x2); - rtl_set_bbreg(hw, ROFDM0_AGCPARAMETER1, BIT(3), 0); - rtl_set_bbreg(hw, RFPGA0_XCD_SWITCHCONTROL, - 0xFF000000, 0x63); - rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, - 0xC000, 0x2); - rtl_set_bbreg(hw, 0xa74, 0xF000, 0x3); - rtl_set_bbreg(hw, 0x818, BIT(28), 0x0); - rtl_set_bbreg(hw, 0x818, BIT(28), 0x1); - } else { - rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, - 0x1CC000, reg_874); - rtl_set_bbreg(hw, ROFDM0_AGCPARAMETER1, BIT(3), - reg_c70); - rtl_set_bbreg(hw, RFPGA0_XCD_SWITCHCONTROL, 0xFF000000, - reg_85c); - rtl_set_bbreg(hw, 0xa74, 0xF000, reg_a74); - rtl_set_bbreg(hw, 0x818, BIT(28), 0x0); - } - - dm_pstable->pre_rfstate = dm_pstable->cur_rfstate; - } -} -EXPORT_SYMBOL(rtl92c_dm_rf_saving); - -static void rtl92c_dm_dynamic_bb_powersaving(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct ps_t *dm_pstable = &rtlpriv->dm_pstable; - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (((mac->link_state == MAC80211_NOLINK)) && - (rtlpriv->dm.entry_min_undec_sm_pwdb == 0)) { - dm_pstable->rssi_val_min = 0; - RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, "Not connected to any\n"); - } - - if (mac->link_state == MAC80211_LINKED) { - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - dm_pstable->rssi_val_min = - rtlpriv->dm.entry_min_undec_sm_pwdb; - RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, - "AP Client PWDB = 0x%lx\n", - dm_pstable->rssi_val_min); - } else { - dm_pstable->rssi_val_min = rtlpriv->dm.undec_sm_pwdb; - RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, - "STA Default Port PWDB = 0x%lx\n", - dm_pstable->rssi_val_min); - } - } else { - dm_pstable->rssi_val_min = - rtlpriv->dm.entry_min_undec_sm_pwdb; - - RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, - "AP Ext Port PWDB = 0x%lx\n", - dm_pstable->rssi_val_min); - } - - if (IS_92C_SERIAL(rtlhal->version)) - ;/* rtl92c_dm_1r_cca(hw); */ - else - rtl92c_dm_rf_saving(hw, false); -} - -void rtl92c_dm_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.dm_type = DM_TYPE_BYDRIVER; - rtl92c_dm_diginit(hw); - rtl92c_dm_init_dynamic_txpower(hw); - rtl92c_dm_init_edca_turbo(hw); - rtl92c_dm_init_rate_adaptive_mask(hw); - rtl92c_dm_initialize_txpower_tracking(hw); - rtl92c_dm_init_dynamic_bb_powersaving(hw); -} -EXPORT_SYMBOL(rtl92c_dm_init); - -void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - long undec_sm_pwdb; - - if (!rtlpriv->dm.dynamic_txpower_enable) - return; - - if (rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - return; - } - - if ((mac->link_state < MAC80211_LINKED) && - (rtlpriv->dm.entry_min_undec_sm_pwdb == 0)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, - "Not connected to any\n"); - - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - - rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; - return; - } - - if (mac->link_state >= MAC80211_LINKED) { - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "AP Client PWDB = 0x%lx\n", - undec_sm_pwdb); - } else { - undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "STA Default Port PWDB = 0x%lx\n", - undec_sm_pwdb); - } - } else { - undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb; - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "AP Ext Port PWDB = 0x%lx\n", - undec_sm_pwdb); - } - - if (undec_sm_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n"); - } else if ((undec_sm_pwdb < (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) && - (undec_sm_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL1)) { - - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n"); - } else if (undec_sm_pwdb < (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_NORMAL\n"); - } - - if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "PHY_SetTxPowerLevel8192S() Channel = %d\n", - rtlphy->current_channel); - rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel); - } - - rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl; -} - -void rtl92c_dm_watchdog(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool fw_current_inpsmode = false; - bool fw_ps_awake = true; - - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_FW_PSMODE_STATUS, - (u8 *) (&fw_current_inpsmode)); - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_FWLPS_RF_ON, - (u8 *) (&fw_ps_awake)); - - if (ppsc->p2p_ps_info.p2p_ps_mode) - fw_ps_awake = false; - - if ((ppsc->rfpwr_state == ERFON) && ((!fw_current_inpsmode) && - fw_ps_awake) - && (!ppsc->rfchange_inprogress)) { - rtl92c_dm_pwdb_monitor(hw); - rtl92c_dm_dig(hw); - rtl92c_dm_false_alarm_counter_statistics(hw); - rtl92c_dm_dynamic_bb_powersaving(hw); - rtl92c_dm_dynamic_txpower(hw); - rtl92c_dm_check_txpower_tracking(hw); - /* rtl92c_dm_refresh_rate_adaptive_mask(hw); */ - rtl92c_dm_bt_coexist(hw); - rtl92c_dm_check_edca_turbo(hw); - } -} -EXPORT_SYMBOL(rtl92c_dm_watchdog); - -u8 rtl92c_bt_rssi_state_change(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - long undec_sm_pwdb; - u8 curr_bt_rssi_state = 0x00; - - if (rtlpriv->mac80211.link_state == MAC80211_LINKED) { - undec_sm_pwdb = GET_UNDECORATED_AVERAGE_RSSI(rtlpriv); - } else { - if (rtlpriv->dm.entry_min_undec_sm_pwdb == 0) - undec_sm_pwdb = 100; - else - undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb; - } - - /* Check RSSI to determine HighPower/NormalPower state for - * BT coexistence. */ - if (undec_sm_pwdb >= 67) - curr_bt_rssi_state &= (~BT_RSSI_STATE_NORMAL_POWER); - else if (undec_sm_pwdb < 62) - curr_bt_rssi_state |= BT_RSSI_STATE_NORMAL_POWER; - - /* Check RSSI to determine AMPDU setting for BT coexistence. */ - if (undec_sm_pwdb >= 40) - curr_bt_rssi_state &= (~BT_RSSI_STATE_AMDPU_OFF); - else if (undec_sm_pwdb <= 32) - curr_bt_rssi_state |= BT_RSSI_STATE_AMDPU_OFF; - - /* Marked RSSI state. It will be used to determine BT coexistence - * setting later. */ - if (undec_sm_pwdb < 35) - curr_bt_rssi_state |= BT_RSSI_STATE_SPECIAL_LOW; - else - curr_bt_rssi_state &= (~BT_RSSI_STATE_SPECIAL_LOW); - - /* Set Tx Power according to BT status. */ - if (undec_sm_pwdb >= 30) - curr_bt_rssi_state |= BT_RSSI_STATE_TXPOWER_LOW; - else if (undec_sm_pwdb < 25) - curr_bt_rssi_state &= (~BT_RSSI_STATE_TXPOWER_LOW); - - /* Check BT state related to BT_Idle in B/G mode. */ - if (undec_sm_pwdb < 15) - curr_bt_rssi_state |= BT_RSSI_STATE_BG_EDCA_LOW; - else - curr_bt_rssi_state &= (~BT_RSSI_STATE_BG_EDCA_LOW); - - if (curr_bt_rssi_state != rtlpcipriv->bt_coexist.bt_rssi_state) { - rtlpcipriv->bt_coexist.bt_rssi_state = curr_bt_rssi_state; - return true; - } else { - return false; - } -} -EXPORT_SYMBOL(rtl92c_bt_rssi_state_change); - -static bool rtl92c_bt_state_change(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - u32 polling, ratio_tx, ratio_pri; - u32 bt_tx, bt_pri; - u8 bt_state; - u8 cur_service_type; - - if (rtlpriv->mac80211.link_state < MAC80211_LINKED) - return false; - - bt_state = rtl_read_byte(rtlpriv, 0x4fd); - bt_tx = rtl_read_dword(rtlpriv, 0x488); - bt_tx = bt_tx & 0x00ffffff; - bt_pri = rtl_read_dword(rtlpriv, 0x48c); - bt_pri = bt_pri & 0x00ffffff; - polling = rtl_read_dword(rtlpriv, 0x490); - - if (bt_tx == 0xffffffff && bt_pri == 0xffffffff && - polling == 0xffffffff && bt_state == 0xff) - return false; - - bt_state &= BIT_OFFSET_LEN_MASK_32(0, 1); - if (bt_state != rtlpcipriv->bt_coexist.bt_cur_state) { - rtlpcipriv->bt_coexist.bt_cur_state = bt_state; - - if (rtlpcipriv->bt_coexist.reg_bt_sco == 3) { - rtlpcipriv->bt_coexist.bt_service = BT_IDLE; - - bt_state = bt_state | - ((rtlpcipriv->bt_coexist.bt_ant_isolation == 1) ? - 0 : BIT_OFFSET_LEN_MASK_32(1, 1)) | - BIT_OFFSET_LEN_MASK_32(2, 1); - rtl_write_byte(rtlpriv, 0x4fd, bt_state); - } - return true; - } - - ratio_tx = bt_tx * 1000 / polling; - ratio_pri = bt_pri * 1000 / polling; - rtlpcipriv->bt_coexist.ratio_tx = ratio_tx; - rtlpcipriv->bt_coexist.ratio_pri = ratio_pri; - - if (bt_state && rtlpcipriv->bt_coexist.reg_bt_sco == 3) { - - if ((ratio_tx < 30) && (ratio_pri < 30)) - cur_service_type = BT_IDLE; - else if ((ratio_pri > 110) && (ratio_pri < 250)) - cur_service_type = BT_SCO; - else if ((ratio_tx >= 200) && (ratio_pri >= 200)) - cur_service_type = BT_BUSY; - else if ((ratio_tx >= 350) && (ratio_tx < 500)) - cur_service_type = BT_OTHERBUSY; - else if (ratio_tx >= 500) - cur_service_type = BT_PAN; - else - cur_service_type = BT_OTHER_ACTION; - - if (cur_service_type != rtlpcipriv->bt_coexist.bt_service) { - rtlpcipriv->bt_coexist.bt_service = cur_service_type; - bt_state = bt_state | - ((rtlpcipriv->bt_coexist.bt_ant_isolation == 1) ? - 0 : BIT_OFFSET_LEN_MASK_32(1, 1)) | - ((rtlpcipriv->bt_coexist.bt_service != BT_IDLE) ? - 0 : BIT_OFFSET_LEN_MASK_32(2, 1)); - - /* Add interrupt migration when bt is not ini - * idle state (no traffic). */ - if (rtlpcipriv->bt_coexist.bt_service != BT_IDLE) { - rtl_write_word(rtlpriv, 0x504, 0x0ccc); - rtl_write_byte(rtlpriv, 0x506, 0x54); - rtl_write_byte(rtlpriv, 0x507, 0x54); - } else { - rtl_write_byte(rtlpriv, 0x506, 0x00); - rtl_write_byte(rtlpriv, 0x507, 0x00); - } - - rtl_write_byte(rtlpriv, 0x4fd, bt_state); - return true; - } - } - - return false; - -} - -static bool rtl92c_bt_wifi_connect_change(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - static bool media_connect; - - if (rtlpriv->mac80211.link_state < MAC80211_LINKED) { - media_connect = false; - } else { - if (!media_connect) { - media_connect = true; - return true; - } - media_connect = true; - } - - return false; -} - -static void rtl92c_bt_set_normal(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - - if (rtlpcipriv->bt_coexist.bt_service == BT_OTHERBUSY) { - rtlpcipriv->bt_coexist.bt_edca_ul = 0x5ea72b; - rtlpcipriv->bt_coexist.bt_edca_dl = 0x5ea72b; - } else if (rtlpcipriv->bt_coexist.bt_service == BT_BUSY) { - rtlpcipriv->bt_coexist.bt_edca_ul = 0x5eb82f; - rtlpcipriv->bt_coexist.bt_edca_dl = 0x5eb82f; - } else if (rtlpcipriv->bt_coexist.bt_service == BT_SCO) { - if (rtlpcipriv->bt_coexist.ratio_tx > 160) { - rtlpcipriv->bt_coexist.bt_edca_ul = 0x5ea72f; - rtlpcipriv->bt_coexist.bt_edca_dl = 0x5ea72f; - } else { - rtlpcipriv->bt_coexist.bt_edca_ul = 0x5ea32b; - rtlpcipriv->bt_coexist.bt_edca_dl = 0x5ea42b; - } - } else { - rtlpcipriv->bt_coexist.bt_edca_ul = 0; - rtlpcipriv->bt_coexist.bt_edca_dl = 0; - } - - if ((rtlpcipriv->bt_coexist.bt_service != BT_IDLE) && - (rtlpriv->mac80211.mode == WIRELESS_MODE_G || - (rtlpriv->mac80211.mode == (WIRELESS_MODE_G | WIRELESS_MODE_B))) && - (rtlpcipriv->bt_coexist.bt_rssi_state & - BT_RSSI_STATE_BG_EDCA_LOW)) { - rtlpcipriv->bt_coexist.bt_edca_ul = 0x5eb82b; - rtlpcipriv->bt_coexist.bt_edca_dl = 0x5eb82b; - } -} - -static void rtl92c_bt_ant_isolation(struct ieee80211_hw *hw, u8 tmp1byte) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - - /* Only enable HW BT coexist when BT in "Busy" state. */ - if (rtlpriv->mac80211.vendor == PEER_CISCO && - rtlpcipriv->bt_coexist.bt_service == BT_OTHER_ACTION) { - rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, 0xa0); - } else { - if ((rtlpcipriv->bt_coexist.bt_service == BT_BUSY) && - (rtlpcipriv->bt_coexist.bt_rssi_state & - BT_RSSI_STATE_NORMAL_POWER)) { - rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, 0xa0); - } else if ((rtlpcipriv->bt_coexist.bt_service == - BT_OTHER_ACTION) && (rtlpriv->mac80211.mode < - WIRELESS_MODE_N_24G) && - (rtlpcipriv->bt_coexist.bt_rssi_state & - BT_RSSI_STATE_SPECIAL_LOW)) { - rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, 0xa0); - } else if (rtlpcipriv->bt_coexist.bt_service == BT_PAN) { - rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, tmp1byte); - } else { - rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, tmp1byte); - } - } - - if (rtlpcipriv->bt_coexist.bt_service == BT_PAN) - rtl_write_dword(rtlpriv, REG_GPIO_PIN_CTRL, 0x10100); - else - rtl_write_dword(rtlpriv, REG_GPIO_PIN_CTRL, 0x0); - - if (rtlpcipriv->bt_coexist.bt_rssi_state & - BT_RSSI_STATE_NORMAL_POWER) { - rtl92c_bt_set_normal(hw); - } else { - rtlpcipriv->bt_coexist.bt_edca_ul = 0; - rtlpcipriv->bt_coexist.bt_edca_dl = 0; - } - - if (rtlpcipriv->bt_coexist.bt_service != BT_IDLE) { - rtlpriv->cfg->ops->set_rfreg(hw, - RF90_PATH_A, - 0x1e, - 0xf0, 0xf); - } else { - rtlpriv->cfg->ops->set_rfreg(hw, - RF90_PATH_A, 0x1e, 0xf0, - rtlpcipriv->bt_coexist.bt_rfreg_origin_1e); - } - - if (!rtlpriv->dm.dynamic_txpower_enable) { - if (rtlpcipriv->bt_coexist.bt_service != BT_IDLE) { - if (rtlpcipriv->bt_coexist.bt_rssi_state & - BT_RSSI_STATE_TXPOWER_LOW) { - rtlpriv->dm.dynamic_txhighpower_lvl = - TXHIGHPWRLEVEL_BT2; - } else { - rtlpriv->dm.dynamic_txhighpower_lvl = - TXHIGHPWRLEVEL_BT1; - } - } else { - rtlpriv->dm.dynamic_txhighpower_lvl = - TXHIGHPWRLEVEL_NORMAL; - } - rtl92c_phy_set_txpower_level(hw, - rtlpriv->phy.current_channel); - } -} - -static void rtl92c_check_bt_change(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 tmp1byte = 0; - - if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version) && - rtlpcipriv->bt_coexist.bt_coexistence) - tmp1byte |= BIT(5); - if (rtlpcipriv->bt_coexist.bt_cur_state) { - if (rtlpcipriv->bt_coexist.bt_ant_isolation) - rtl92c_bt_ant_isolation(hw, tmp1byte); - } else { - rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, tmp1byte); - rtlpriv->cfg->ops->set_rfreg(hw, RF90_PATH_A, 0x1e, 0xf0, - rtlpcipriv->bt_coexist.bt_rfreg_origin_1e); - - rtlpcipriv->bt_coexist.bt_edca_ul = 0; - rtlpcipriv->bt_coexist.bt_edca_dl = 0; - } -} - -void rtl92c_dm_bt_coexist(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - bool wifi_connect_change; - bool bt_state_change; - bool rssi_state_change; - - if ((rtlpcipriv->bt_coexist.bt_coexistence) && - (rtlpcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC4)) { - - wifi_connect_change = rtl92c_bt_wifi_connect_change(hw); - bt_state_change = rtl92c_bt_state_change(hw); - rssi_state_change = rtl92c_bt_rssi_state_change(hw); - - if (wifi_connect_change || bt_state_change || rssi_state_change) - rtl92c_check_bt_change(hw); - } -} -EXPORT_SYMBOL(rtl92c_dm_bt_coexist); diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h deleted file mode 100644 index 518e208c0180..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h +++ /dev/null @@ -1,171 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92COMMON_DM_H__ -#define __RTL92COMMON_DM_H__ - -#include "../wifi.h" -#include "../rtl8192ce/def.h" -#include "../rtl8192ce/reg.h" -#include "fw_common.h" - -#define HAL_DM_DIG_DISABLE BIT(0) -#define HAL_DM_HIPWR_DISABLE BIT(1) - -#define OFDM_TABLE_LENGTH 37 -#define CCK_TABLE_LENGTH 33 - -#define OFDM_TABLE_SIZE 37 -#define CCK_TABLE_SIZE 33 - -#define BW_AUTO_SWITCH_HIGH_LOW 25 -#define BW_AUTO_SWITCH_LOW_HIGH 30 - -#define DM_DIG_THRESH_HIGH 40 -#define DM_DIG_THRESH_LOW 35 - -#define DM_FALSEALARM_THRESH_LOW 400 -#define DM_FALSEALARM_THRESH_HIGH 1000 - -#define DM_DIG_MAX 0x3e -#define DM_DIG_MIN 0x1e - -#define DM_DIG_FA_UPPER 0x32 -#define DM_DIG_FA_LOWER 0x20 -#define DM_DIG_FA_TH0 0x20 -#define DM_DIG_FA_TH1 0x100 -#define DM_DIG_FA_TH2 0x200 - -#define DM_DIG_BACKOFF_MAX 12 -#define DM_DIG_BACKOFF_MIN -4 -#define DM_DIG_BACKOFF_DEFAULT 10 - -#define RXPATHSELECTION_SS_TH_lOW 30 -#define RXPATHSELECTION_DIFF_TH 18 - -#define DM_RATR_STA_INIT 0 -#define DM_RATR_STA_HIGH 1 -#define DM_RATR_STA_MIDDLE 2 -#define DM_RATR_STA_LOW 3 - -#define CTS2SELF_THVAL 30 -#define REGC38_TH 20 - -#define WAIOTTHVal 25 - -#define TXHIGHPWRLEVEL_NORMAL 0 -#define TXHIGHPWRLEVEL_LEVEL1 1 -#define TXHIGHPWRLEVEL_LEVEL2 2 -#define TXHIGHPWRLEVEL_BT1 3 -#define TXHIGHPWRLEVEL_BT2 4 - -#define DM_TYPE_BYFW 0 -#define DM_TYPE_BYDRIVER 1 - -#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 -#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 - -struct swat_t { - u8 failure_cnt; - u8 try_flag; - u8 stop_trying; - long pre_rssi; - long trying_threshold; - u8 cur_antenna; - u8 pre_antenna; -}; - -enum tag_dynamic_init_gain_operation_type_definition { - DIG_TYPE_THRESH_HIGH = 0, - DIG_TYPE_THRESH_LOW = 1, - DIG_TYPE_BACKOFF = 2, - DIG_TYPE_RX_GAIN_MIN = 3, - DIG_TYPE_RX_GAIN_MAX = 4, - DIG_TYPE_ENABLE = 5, - DIG_TYPE_DISABLE = 6, - DIG_OP_TYPE_MAX -}; - -enum tag_cck_packet_detection_threshold_type_definition { - CCK_PD_STAGE_LowRssi = 0, - CCK_PD_STAGE_HighRssi = 1, - CCK_FA_STAGE_Low = 2, - CCK_FA_STAGE_High = 3, - CCK_PD_STAGE_MAX = 4, -}; - -enum dm_1r_cca_e { - CCA_1R = 0, - CCA_2R = 1, - CCA_MAX = 2, -}; - -enum dm_rf_e { - RF_SAVE = 0, - RF_NORMAL = 1, - RF_MAX = 2, -}; - -enum dm_sw_ant_switch_e { - ANS_ANTENNA_B = 1, - ANS_ANTENNA_A = 2, - ANS_ANTENNA_MAX = 3, -}; - -enum dm_dig_ext_port_alg_e { - DIG_EXT_PORT_STAGE_0 = 0, - DIG_EXT_PORT_STAGE_1 = 1, - DIG_EXT_PORT_STAGE_2 = 2, - DIG_EXT_PORT_STAGE_3 = 3, - DIG_EXT_PORT_STAGE_MAX = 4, -}; - -enum dm_dig_connect_e { - DIG_STA_DISCONNECT = 0, - DIG_STA_CONNECT = 1, - DIG_STA_BEFORE_CONNECT = 2, - DIG_MULTISTA_DISCONNECT = 3, - DIG_MULTISTA_CONNECT = 4, - DIG_CONNECT_MAX -}; - -void rtl92c_dm_init(struct ieee80211_hw *hw); -void rtl92c_dm_watchdog(struct ieee80211_hw *hw); -void rtl92c_dm_write_dig(struct ieee80211_hw *hw); -void rtl92c_dm_init_edca_turbo(struct ieee80211_hw *hw); -void rtl92c_dm_check_txpower_tracking(struct ieee80211_hw *hw); -void rtl92c_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw); -void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal); -void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); -void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); -void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery); -void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw); -void rtl92c_dm_bt_coexist(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c deleted file mode 100644 index 04a41628ceed..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c +++ /dev/null @@ -1,907 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../base.h" -#include "../rtl8192ce/reg.h" -#include "../rtl8192ce/def.h" -#include "fw_common.h" -#include -#include - -static void _rtl92c_enable_fw_download(struct ieee80211_hw *hw, bool enable) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CU) { - u32 value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - if (enable) - value32 |= MCUFWDL_EN; - else - value32 &= ~MCUFWDL_EN; - rtl_write_dword(rtlpriv, REG_MCUFWDL, value32); - } else if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CE) { - u8 tmp; - if (enable) { - - tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, - tmp | 0x04); - - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL); - rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp | 0x01); - - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL + 2); - rtl_write_byte(rtlpriv, REG_MCUFWDL + 2, tmp & 0xf7); - } else { - - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL); - rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp & 0xfe); - - rtl_write_byte(rtlpriv, REG_MCUFWDL + 1, 0x00); - } - } -} - -static void rtl_block_fw_writeN(struct ieee80211_hw *hw, const u8 *buffer, - u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 blockSize = REALTEK_USB_VENQT_MAX_BUF_SIZE - 20; - u8 *bufferPtr = (u8 *) buffer; - u32 i, offset, blockCount, remainSize; - - blockCount = size / blockSize; - remainSize = size % blockSize; - - for (i = 0; i < blockCount; i++) { - offset = i * blockSize; - rtlpriv->io.writeN_sync(rtlpriv, - (FW_8192C_START_ADDRESS + offset), - (void *)(bufferPtr + offset), - blockSize); - } - - if (remainSize) { - offset = blockCount * blockSize; - rtlpriv->io.writeN_sync(rtlpriv, - (FW_8192C_START_ADDRESS + offset), - (void *)(bufferPtr + offset), - remainSize); - } -} - -static void _rtl92c_fw_block_write(struct ieee80211_hw *hw, - const u8 *buffer, u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 blockSize = sizeof(u32); - u8 *bufferPtr = (u8 *) buffer; - u32 *pu4BytePtr = (u32 *) buffer; - u32 i, offset, blockCount, remainSize; - u32 data; - - if (rtlpriv->io.writeN_sync) { - rtl_block_fw_writeN(hw, buffer, size); - return; - } - blockCount = size / blockSize; - remainSize = size % blockSize; - if (remainSize) { - /* the last word is < 4 bytes - pad it with zeros */ - for (i = 0; i < 4 - remainSize; i++) - *(bufferPtr + size + i) = 0; - blockCount++; - } - - for (i = 0; i < blockCount; i++) { - offset = i * blockSize; - /* for big-endian platforms, the firmware data need to be byte - * swapped as it was read as a byte string and will be written - * as 32-bit dwords and byte swapped when written - */ - data = le32_to_cpu(*(__le32 *)(pu4BytePtr + i)); - rtl_write_dword(rtlpriv, (FW_8192C_START_ADDRESS + offset), - data); - } -} - -static void _rtl92c_fw_page_write(struct ieee80211_hw *hw, - u32 page, const u8 *buffer, u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 value8; - u8 u8page = (u8) (page & 0x07); - - value8 = (rtl_read_byte(rtlpriv, REG_MCUFWDL + 2) & 0xF8) | u8page; - - rtl_write_byte(rtlpriv, (REG_MCUFWDL + 2), value8); - _rtl92c_fw_block_write(hw, buffer, size); -} - -static void _rtl92c_fill_dummy(u8 *pfwbuf, u32 *pfwlen) -{ - u32 fwlen = *pfwlen; - u8 remain = (u8) (fwlen % 4); - - remain = (remain == 0) ? 0 : (4 - remain); - - while (remain > 0) { - pfwbuf[fwlen] = 0; - fwlen++; - remain--; - } - - *pfwlen = fwlen; -} - -static void _rtl92c_write_fw(struct ieee80211_hw *hw, - enum version_8192c version, u8 *buffer, u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 *bufferPtr = buffer; - - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, "FW size is %d bytes\n", size); - - if (IS_CHIP_VER_B(version)) { - u32 pageNums, remainSize; - u32 page, offset; - - if (IS_HARDWARE_TYPE_8192CE(rtlhal)) - _rtl92c_fill_dummy(bufferPtr, &size); - - pageNums = size / FW_8192C_PAGE_SIZE; - remainSize = size % FW_8192C_PAGE_SIZE; - - if (pageNums > 4) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Page numbers should not greater then 4\n"); - } - - for (page = 0; page < pageNums; page++) { - offset = page * FW_8192C_PAGE_SIZE; - _rtl92c_fw_page_write(hw, page, (bufferPtr + offset), - FW_8192C_PAGE_SIZE); - } - - if (remainSize) { - offset = pageNums * FW_8192C_PAGE_SIZE; - page = pageNums; - _rtl92c_fw_page_write(hw, page, (bufferPtr + offset), - remainSize); - } - } else { - _rtl92c_fw_block_write(hw, buffer, size); - } -} - -static int _rtl92c_fw_free_to_go(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 counter = 0; - u32 value32; - - do { - value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - } while ((counter++ < FW_8192C_POLLING_TIMEOUT_COUNT) && - (!(value32 & FWDL_ChkSum_rpt))); - - if (counter >= FW_8192C_POLLING_TIMEOUT_COUNT) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "chksum report faill ! REG_MCUFWDL:0x%08x\n", value32); - return -EIO; - } - - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, - "Checksum report OK ! REG_MCUFWDL:0x%08x\n", value32); - - value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - value32 |= MCUFWDL_RDY; - value32 &= ~WINTINI_RDY; - rtl_write_dword(rtlpriv, REG_MCUFWDL, value32); - - counter = 0; - - do { - value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - if (value32 & WINTINI_RDY) { - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, - "Polling FW ready success!! REG_MCUFWDL:0x%08x\n", - value32); - return 0; - } - - mdelay(FW_8192C_POLLING_DELAY); - - } while (counter++ < FW_8192C_POLLING_TIMEOUT_COUNT); - - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Polling FW ready fail!! REG_MCUFWDL:0x%08x\n", value32); - return -EIO; -} - -int rtl92c_download_fw(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl92c_firmware_header *pfwheader; - u8 *pfwdata; - u32 fwsize; - enum version_8192c version = rtlhal->version; - - if (rtlpriv->max_fw_size == 0 || !rtlhal->pfirmware) - return 1; - - pfwheader = (struct rtl92c_firmware_header *)rtlhal->pfirmware; - pfwdata = rtlhal->pfirmware; - fwsize = rtlhal->fwsize; - - if (IS_FW_HEADER_EXIST(pfwheader)) { - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, - "Firmware Version(%d), Signature(%#x),Size(%d)\n", - le16_to_cpu(pfwheader->version), - le16_to_cpu(pfwheader->signature), - (uint)sizeof(struct rtl92c_firmware_header)); - - pfwdata = pfwdata + sizeof(struct rtl92c_firmware_header); - fwsize = fwsize - sizeof(struct rtl92c_firmware_header); - } - - _rtl92c_enable_fw_download(hw, true); - _rtl92c_write_fw(hw, version, pfwdata, fwsize); - _rtl92c_enable_fw_download(hw, false); - - if (_rtl92c_fw_free_to_go(hw)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Firmware is not ready to run!\n"); - } else { - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, - "Firmware is ready to run!\n"); - } - - return 0; -} -EXPORT_SYMBOL(rtl92c_download_fw); - -static bool _rtl92c_check_fw_read_last_h2c(struct ieee80211_hw *hw, u8 boxnum) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 val_hmetfr, val_mcutst_1; - bool result = false; - - val_hmetfr = rtl_read_byte(rtlpriv, REG_HMETFR); - val_mcutst_1 = rtl_read_byte(rtlpriv, (REG_MCUTST_1 + boxnum)); - - if (((val_hmetfr >> boxnum) & BIT(0)) == 0 && val_mcutst_1 == 0) - result = true; - return result; -} - -static void _rtl92c_fill_h2c_command(struct ieee80211_hw *hw, - u8 element_id, u32 cmd_len, u8 *p_cmdbuffer) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 boxnum; - u16 box_reg = 0, box_extreg = 0; - u8 u1b_tmp; - bool isfw_read = false; - bool bwrite_success = false; - u8 wait_h2c_limmit = 100; - u8 wait_writeh2c_limmit = 100; - u8 boxcontent[4], boxextcontent[2]; - u32 h2c_waitcounter = 0; - unsigned long flag; - u8 idx; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "come in\n"); - - while (true) { - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag); - if (rtlhal->h2c_setinprogress) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "H2C set in progress! Wait to set..element_id(%d)\n", - element_id); - - while (rtlhal->h2c_setinprogress) { - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, - flag); - h2c_waitcounter++; - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Wait 100 us (%d times)...\n", - h2c_waitcounter); - udelay(100); - - if (h2c_waitcounter > 1000) - return; - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, - flag); - } - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - } else { - rtlhal->h2c_setinprogress = true; - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - break; - } - } - - while (!bwrite_success) { - wait_writeh2c_limmit--; - if (wait_writeh2c_limmit == 0) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Write H2C fail because no trigger for FW INT!\n"); - break; - } - - boxnum = rtlhal->last_hmeboxnum; - switch (boxnum) { - case 0: - box_reg = REG_HMEBOX_0; - box_extreg = REG_HMEBOX_EXT_0; - break; - case 1: - box_reg = REG_HMEBOX_1; - box_extreg = REG_HMEBOX_EXT_1; - break; - case 2: - box_reg = REG_HMEBOX_2; - box_extreg = REG_HMEBOX_EXT_2; - break; - case 3: - box_reg = REG_HMEBOX_3; - box_extreg = REG_HMEBOX_EXT_3; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - - isfw_read = _rtl92c_check_fw_read_last_h2c(hw, boxnum); - while (!isfw_read) { - - wait_h2c_limmit--; - if (wait_h2c_limmit == 0) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Waiting too long for FW read clear HMEBox(%d)!\n", - boxnum); - break; - } - - udelay(10); - - isfw_read = _rtl92c_check_fw_read_last_h2c(hw, boxnum); - u1b_tmp = rtl_read_byte(rtlpriv, 0x1BF); - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Waiting for FW read clear HMEBox(%d)!!! 0x1BF = %2x\n", - boxnum, u1b_tmp); - } - - if (!isfw_read) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Write H2C register BOX[%d] fail!!!!! Fw do not read\n", - boxnum); - break; - } - - memset(boxcontent, 0, sizeof(boxcontent)); - memset(boxextcontent, 0, sizeof(boxextcontent)); - boxcontent[0] = element_id; - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Write element_id box_reg(%4x) = %2x\n", - box_reg, element_id); - - switch (cmd_len) { - case 1: - boxcontent[0] &= ~(BIT(7)); - memcpy((u8 *) (boxcontent) + 1, - p_cmdbuffer, 1); - - for (idx = 0; idx < 4; idx++) { - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - } - break; - case 2: - boxcontent[0] &= ~(BIT(7)); - memcpy((u8 *) (boxcontent) + 1, - p_cmdbuffer, 2); - - for (idx = 0; idx < 4; idx++) { - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - } - break; - case 3: - boxcontent[0] &= ~(BIT(7)); - memcpy((u8 *) (boxcontent) + 1, - p_cmdbuffer, 3); - - for (idx = 0; idx < 4; idx++) { - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - } - break; - case 4: - boxcontent[0] |= (BIT(7)); - memcpy((u8 *) (boxextcontent), - p_cmdbuffer, 2); - memcpy((u8 *) (boxcontent) + 1, - p_cmdbuffer + 2, 2); - - for (idx = 0; idx < 2; idx++) { - rtl_write_byte(rtlpriv, box_extreg + idx, - boxextcontent[idx]); - } - - for (idx = 0; idx < 4; idx++) { - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - } - break; - case 5: - boxcontent[0] |= (BIT(7)); - memcpy((u8 *) (boxextcontent), - p_cmdbuffer, 2); - memcpy((u8 *) (boxcontent) + 1, - p_cmdbuffer + 2, 3); - - for (idx = 0; idx < 2; idx++) { - rtl_write_byte(rtlpriv, box_extreg + idx, - boxextcontent[idx]); - } - - for (idx = 0; idx < 4; idx++) { - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - } - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - - bwrite_success = true; - - rtlhal->last_hmeboxnum = boxnum + 1; - if (rtlhal->last_hmeboxnum == 4) - rtlhal->last_hmeboxnum = 0; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "pHalData->last_hmeboxnum = %d\n", - rtlhal->last_hmeboxnum); - } - - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag); - rtlhal->h2c_setinprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "go out\n"); -} - -void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, - u8 element_id, u32 cmd_len, u8 *p_cmdbuffer) -{ - u32 tmp_cmdbuf[2]; - - memset(tmp_cmdbuf, 0, 8); - memcpy(tmp_cmdbuf, p_cmdbuffer, cmd_len); - _rtl92c_fill_h2c_command(hw, element_id, cmd_len, (u8 *)&tmp_cmdbuf); - - return; -} -EXPORT_SYMBOL(rtl92c_fill_h2c_cmd); - -void rtl92c_firmware_selfreset(struct ieee80211_hw *hw) -{ - u8 u1b_tmp; - u8 delay = 100; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_byte(rtlpriv, REG_HMETFR + 3, 0x20); - u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - - while (u1b_tmp & BIT(2)) { - delay--; - if (delay == 0) { - RT_ASSERT(false, "8051 reset fail\n"); - break; - } - udelay(50); - u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - } -} -EXPORT_SYMBOL(rtl92c_firmware_selfreset); - -void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 u1_h2c_set_pwrmode[3] = {0}; - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "FW LPS mode = %d\n", mode); - - SET_H2CCMD_PWRMODE_PARM_MODE(u1_h2c_set_pwrmode, mode); - SET_H2CCMD_PWRMODE_PARM_SMART_PS(u1_h2c_set_pwrmode, - (rtlpriv->mac80211.p2p) ? - ppsc->smart_ps : 1); - SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(u1_h2c_set_pwrmode, - ppsc->reg_max_lps_awakeintvl); - - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "rtl92c_set_fw_rsvdpagepkt(): u1_h2c_set_pwrmode", - u1_h2c_set_pwrmode, 3); - rtl92c_fill_h2c_cmd(hw, H2C_SETPWRMODE, 3, u1_h2c_set_pwrmode); - -} -EXPORT_SYMBOL(rtl92c_set_fw_pwrmode_cmd); - -static bool _rtl92c_cmd_send_packet(struct ieee80211_hw *hw, - struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl8192_tx_ring *ring; - struct rtl_tx_desc *pdesc; - unsigned long flags; - struct sk_buff *pskb = NULL; - - ring = &rtlpci->tx_ring[BEACON_QUEUE]; - - pskb = __skb_dequeue(&ring->queue); - kfree_skb(pskb); - - spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); - - pdesc = &ring->desc[0]; - - rtlpriv->cfg->ops->fill_tx_cmddesc(hw, (u8 *) pdesc, 1, 1, skb); - - __skb_queue_tail(&ring->queue, skb); - - spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); - - rtlpriv->cfg->ops->tx_polling(hw, BEACON_QUEUE); - - return true; -} - -#define BEACON_PG 0 /*->1*/ -#define PSPOLL_PG 2 -#define NULL_PG 3 -#define PROBERSP_PG 4 /*->5*/ - -#define TOTAL_RESERVED_PKT_LEN 768 - -static u8 reserved_page_packet[TOTAL_RESERVED_PKT_LEN] = { - /* page 0 beacon */ - 0x80, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x50, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x64, 0x00, 0x00, 0x04, 0x00, 0x0C, 0x6C, 0x69, - 0x6E, 0x6B, 0x73, 0x79, 0x73, 0x5F, 0x77, 0x6C, - 0x61, 0x6E, 0x01, 0x04, 0x82, 0x84, 0x8B, 0x96, - 0x03, 0x01, 0x01, 0x06, 0x02, 0x00, 0x00, 0x2A, - 0x01, 0x00, 0x32, 0x08, 0x24, 0x30, 0x48, 0x6C, - 0x0C, 0x12, 0x18, 0x60, 0x2D, 0x1A, 0x6C, 0x18, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3D, 0x00, 0xDD, 0x06, 0x00, 0xE0, 0x4C, 0x02, - 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 1 beacon */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 2 ps-poll */ - 0xA4, 0x10, 0x01, 0xC0, 0x00, 0x40, 0x10, 0x10, - 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 3 null */ - 0x48, 0x01, 0x00, 0x00, 0x00, 0x40, 0x10, 0x10, - 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x72, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 4 probe_resp */ - 0x50, 0x00, 0x00, 0x00, 0x00, 0x40, 0x10, 0x10, - 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, - 0x9E, 0x46, 0x15, 0x32, 0x27, 0xF2, 0x2D, 0x00, - 0x64, 0x00, 0x00, 0x04, 0x00, 0x0C, 0x6C, 0x69, - 0x6E, 0x6B, 0x73, 0x79, 0x73, 0x5F, 0x77, 0x6C, - 0x61, 0x6E, 0x01, 0x04, 0x82, 0x84, 0x8B, 0x96, - 0x03, 0x01, 0x01, 0x06, 0x02, 0x00, 0x00, 0x2A, - 0x01, 0x00, 0x32, 0x08, 0x24, 0x30, 0x48, 0x6C, - 0x0C, 0x12, 0x18, 0x60, 0x2D, 0x1A, 0x6C, 0x18, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3D, 0x00, 0xDD, 0x06, 0x00, 0xE0, 0x4C, 0x02, - 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 5 probe_resp */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct sk_buff *skb = NULL; - - u32 totalpacketlen; - bool rtstatus; - u8 u1RsvdPageLoc[3] = {0}; - bool dlok = false; - - u8 *beacon; - u8 *pspoll; - u8 *nullfunc; - u8 *probersp; - /*--------------------------------------------------------- - (1) beacon - ---------------------------------------------------------*/ - beacon = &reserved_page_packet[BEACON_PG * 128]; - SET_80211_HDR_ADDRESS2(beacon, mac->mac_addr); - SET_80211_HDR_ADDRESS3(beacon, mac->bssid); - - /*------------------------------------------------------- - (2) ps-poll - --------------------------------------------------------*/ - pspoll = &reserved_page_packet[PSPOLL_PG * 128]; - SET_80211_PS_POLL_AID(pspoll, (mac->assoc_id | 0xc000)); - SET_80211_PS_POLL_BSSID(pspoll, mac->bssid); - SET_80211_PS_POLL_TA(pspoll, mac->mac_addr); - - SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG); - - /*-------------------------------------------------------- - (3) null data - ---------------------------------------------------------*/ - nullfunc = &reserved_page_packet[NULL_PG * 128]; - SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid); - SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr); - SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid); - - SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1RsvdPageLoc, NULL_PG); - - /*--------------------------------------------------------- - (4) probe response - ----------------------------------------------------------*/ - probersp = &reserved_page_packet[PROBERSP_PG * 128]; - SET_80211_HDR_ADDRESS1(probersp, mac->bssid); - SET_80211_HDR_ADDRESS2(probersp, mac->mac_addr); - SET_80211_HDR_ADDRESS3(probersp, mac->bssid); - - SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1RsvdPageLoc, PROBERSP_PG); - - totalpacketlen = TOTAL_RESERVED_PKT_LEN; - - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, - "rtl92c_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL", - &reserved_page_packet[0], totalpacketlen); - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "rtl92c_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL", - u1RsvdPageLoc, 3); - - - skb = dev_alloc_skb(totalpacketlen); - if (!skb) - return; - kmemleak_not_leak(skb); - - memcpy((u8 *) skb_put(skb, totalpacketlen), - &reserved_page_packet, totalpacketlen); - - rtstatus = _rtl92c_cmd_send_packet(hw, skb); - - if (rtstatus) - dlok = true; - - if (dlok) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Set RSVD page location to Fw\n"); - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "H2C_RSVDPAGE", u1RsvdPageLoc, 3); - rtl92c_fill_h2c_cmd(hw, H2C_RSVDPAGE, - sizeof(u1RsvdPageLoc), u1RsvdPageLoc); - } else - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Set RSVD page location to Fw FAIL!!!!!!\n"); -} -EXPORT_SYMBOL(rtl92c_set_fw_rsvdpagepkt); - -void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus) -{ - u8 u1_joinbssrpt_parm[1] = {0}; - - SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(u1_joinbssrpt_parm, mstatus); - - rtl92c_fill_h2c_cmd(hw, H2C_JOINBSSRPT, 1, u1_joinbssrpt_parm); -} -EXPORT_SYMBOL(rtl92c_set_fw_joinbss_report_cmd); - -static void rtl92c_set_p2p_ctw_period_cmd(struct ieee80211_hw *hw, u8 ctwindow) -{ - u8 u1_ctwindow_period[1] = {ctwindow}; - - rtl92c_fill_h2c_cmd(hw, H2C_P2P_PS_CTW_CMD, 1, u1_ctwindow_period); -} - -void rtl92c_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *rtlps = rtl_psc(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_p2p_ps_info *p2pinfo = &(rtlps->p2p_ps_info); - struct p2p_ps_offload_t *p2p_ps_offload = &rtlhal->p2p_ps_offload; - u8 i; - u16 ctwindow; - u32 start_time, tsf_low; - - switch (p2p_ps_state) { - case P2P_PS_DISABLE: - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_DISABLE\n"); - memset(p2p_ps_offload, 0, sizeof(struct p2p_ps_offload_t)); - break; - case P2P_PS_ENABLE: - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_ENABLE\n"); - /* update CTWindow value. */ - if (p2pinfo->ctwindow > 0) { - p2p_ps_offload->ctwindow_en = 1; - ctwindow = p2pinfo->ctwindow; - rtl92c_set_p2p_ctw_period_cmd(hw, ctwindow); - } - /* hw only support 2 set of NoA */ - for (i = 0; i < p2pinfo->noa_num; i++) { - /* To control the register setting for which NOA*/ - rtl_write_byte(rtlpriv, 0x5cf, (i << 4)); - if (i == 0) - p2p_ps_offload->noa0_en = 1; - else - p2p_ps_offload->noa1_en = 1; - - /* config P2P NoA Descriptor Register */ - rtl_write_dword(rtlpriv, 0x5E0, - p2pinfo->noa_duration[i]); - rtl_write_dword(rtlpriv, 0x5E4, - p2pinfo->noa_interval[i]); - - /*Get Current TSF value */ - tsf_low = rtl_read_dword(rtlpriv, REG_TSFTR); - - start_time = p2pinfo->noa_start_time[i]; - if (p2pinfo->noa_count_type[i] != 1) { - while (start_time <= (tsf_low+(50*1024))) { - start_time += p2pinfo->noa_interval[i]; - if (p2pinfo->noa_count_type[i] != 255) - p2pinfo->noa_count_type[i]--; - } - } - rtl_write_dword(rtlpriv, 0x5E8, start_time); - rtl_write_dword(rtlpriv, 0x5EC, - p2pinfo->noa_count_type[i]); - } - - if ((p2pinfo->opp_ps == 1) || (p2pinfo->noa_num > 0)) { - /* rst p2p circuit */ - rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, BIT(4)); - - p2p_ps_offload->offload_en = 1; - - if (P2P_ROLE_GO == rtlpriv->mac80211.p2p) { - p2p_ps_offload->role = 1; - p2p_ps_offload->allstasleep = 0; - } else { - p2p_ps_offload->role = 0; - } - - p2p_ps_offload->discovery = 0; - } - break; - case P2P_PS_SCAN: - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_SCAN\n"); - p2p_ps_offload->discovery = 1; - break; - case P2P_PS_SCAN_DONE: - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_SCAN_DONE\n"); - p2p_ps_offload->discovery = 0; - p2pinfo->p2p_ps_state = P2P_PS_ENABLE; - break; - default: - break; - } - - rtl92c_fill_h2c_cmd(hw, H2C_P2P_PS_OFFLOAD, 1, (u8 *)p2p_ps_offload); -} -EXPORT_SYMBOL_GPL(rtl92c_set_p2p_ps_offload_cmd); diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h deleted file mode 100644 index 15b2055e6212..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h +++ /dev/null @@ -1,103 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C__FW__COMMON__H__ -#define __RTL92C__FW__COMMON__H__ - -#define FW_8192C_SIZE 0x3000 -#define FW_8192C_START_ADDRESS 0x1000 -#define FW_8192C_END_ADDRESS 0x1FFF -#define FW_8192C_PAGE_SIZE 4096 -#define FW_8192C_POLLING_DELAY 5 -#define FW_8192C_POLLING_TIMEOUT_COUNT 100 - -#define IS_FW_HEADER_EXIST(_pfwhdr) \ - ((le16_to_cpu(_pfwhdr->signature)&0xFFF0) == 0x92C0 ||\ - (le16_to_cpu(_pfwhdr->signature)&0xFFF0) == 0x88C0) - -struct rtl92c_firmware_header { - __le16 signature; - u8 category; - u8 function; - __le16 version; - u8 subversion; - u8 rsvd1; - u8 month; - u8 date; - u8 hour; - u8 minute; - __le16 ramcodeSize; - __le16 rsvd2; - __le32 svnindex; - __le32 rsvd3; - __le32 rsvd4; - __le32 rsvd5; -}; - -enum rtl8192c_h2c_cmd { - H2C_AP_OFFLOAD = 0, - H2C_SETPWRMODE = 1, - H2C_JOINBSSRPT = 2, - H2C_RSVDPAGE = 3, - H2C_RSSI_REPORT = 5, - H2C_RA_MASK = 6, - H2C_MACID_PS_MODE = 7, - H2C_P2P_PS_OFFLOAD = 8, - H2C_P2P_PS_CTW_CMD = 32, - MAX_H2CCMD -}; - -#define pagenum_128(_len) (u32)(((_len)>>7) + ((_len)&0x7F ? 1 : 0)) - -#define SET_H2CCMD_PWRMODE_PARM_MODE(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_PWRMODE_PARM_SMART_PS(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val) -#define SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val) -#define SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val) - -int rtl92c_download_fw(struct ieee80211_hw *hw); -void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id, - u32 cmd_len, u8 *p_cmdbuffer); -void rtl92c_firmware_selfreset(struct ieee80211_hw *hw); -void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); -void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished); -void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); -void usb_writeN_async(struct rtl_priv *rtlpriv, u32 addr, void *data, u16 len); -void rtl92c_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/main.c b/drivers/net/wireless/rtlwifi/rtl8192c/main.c deleted file mode 100644 index 918b1d129e77..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192c/main.c +++ /dev/null @@ -1,40 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include - - -MODULE_AUTHOR("lizhaoming "); -MODULE_AUTHOR("Realtek WlanFAE "); -MODULE_AUTHOR("Georgia "); -MODULE_AUTHOR("Ziv Huang "); -MODULE_AUTHOR("Larry Finger "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Realtek 8192C/8188C 802.11n PCI wireless"); diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c deleted file mode 100644 index 246e5352f2e1..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c +++ /dev/null @@ -1,1953 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include -#include "../wifi.h" -#include "../rtl8192ce/reg.h" -#include "../rtl8192ce/def.h" -#include "dm_common.h" -#include "phy_common.h" - -u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 returnvalue, originalvalue, bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "regaddr(%#x), bitmask(%#x)\n", - regaddr, bitmask); - originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); - returnvalue = (originalvalue & bitmask) >> bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "BBR MASK=0x%x Addr[0x%x]=0x%x\n", - bitmask, regaddr, originalvalue); - - return returnvalue; - -} -EXPORT_SYMBOL(rtl92c_phy_query_bb_reg); - -void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 originalvalue, bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x)\n", - regaddr, bitmask, data); - - if (bitmask != MASKDWORD) { - originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); - data = ((originalvalue & (~bitmask)) | (data << bitshift)); - } - - rtl_write_dword(rtlpriv, regaddr, data); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x)\n", - regaddr, bitmask, data); - -} -EXPORT_SYMBOL(rtl92c_phy_set_bb_reg); - -u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset) -{ - RT_ASSERT(false, "deprecated!\n"); - return 0; - -} -EXPORT_SYMBOL(_rtl92c_phy_fw_rf_serial_read); - -void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset, - u32 data) -{ - RT_ASSERT(false, "deprecated!\n"); -} -EXPORT_SYMBOL(_rtl92c_phy_fw_rf_serial_write); - -u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; - u32 newoffset; - u32 tmplong, tmplong2; - u8 rfpi_enable = 0; - u32 retvalue; - - offset &= 0x3f; - newoffset = offset; - if (RT_CANNOT_IO(hw)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "return all one\n"); - return 0xFFFFFFFF; - } - tmplong = rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, MASKDWORD); - if (rfpath == RF90_PATH_A) - tmplong2 = tmplong; - else - tmplong2 = rtl_get_bbreg(hw, pphyreg->rfhssi_para2, MASKDWORD); - tmplong2 = (tmplong2 & (~BLSSIREADADDRESS)) | - (newoffset << 23) | BLSSIREADEDGE; - rtl_set_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, MASKDWORD, - tmplong & (~BLSSIREADEDGE)); - mdelay(1); - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, MASKDWORD, tmplong2); - mdelay(1); - rtl_set_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, MASKDWORD, - tmplong | BLSSIREADEDGE); - mdelay(1); - if (rfpath == RF90_PATH_A) - rfpi_enable = (u8) rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER1, - BIT(8)); - else if (rfpath == RF90_PATH_B) - rfpi_enable = (u8) rtl_get_bbreg(hw, RFPGA0_XB_HSSIPARAMETER1, - BIT(8)); - if (rfpi_enable) - retvalue = rtl_get_bbreg(hw, pphyreg->rf_rbpi, - BLSSIREADBACKDATA); - else - retvalue = rtl_get_bbreg(hw, pphyreg->rf_rb, - BLSSIREADBACKDATA); - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFR-%d Addr[0x%x]=0x%x\n", - rfpath, pphyreg->rf_rb, retvalue); - return retvalue; -} -EXPORT_SYMBOL(_rtl92c_phy_rf_serial_read); - -void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset, - u32 data) -{ - u32 data_and_addr; - u32 newoffset; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; - - if (RT_CANNOT_IO(hw)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "stop\n"); - return; - } - offset &= 0x3f; - newoffset = offset; - data_and_addr = ((newoffset << 20) | (data & 0x000fffff)) & 0x0fffffff; - rtl_set_bbreg(hw, pphyreg->rf3wire_offset, MASKDWORD, data_and_addr); - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFW-%d Addr[0x%x]=0x%x\n", - rfpath, pphyreg->rf3wire_offset, data_and_addr); -} -EXPORT_SYMBOL(_rtl92c_phy_rf_serial_write); - -u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask) -{ - u32 i; - - for (i = 0; i <= 31; i++) { - if ((bitmask >> i) & 0x1) - break; - } - return i; -} -EXPORT_SYMBOL(_rtl92c_phy_calculate_bit_shift); - -static void _rtl92c_phy_bb_config_1t(struct ieee80211_hw *hw) -{ - rtl_set_bbreg(hw, RFPGA0_TXINFO, 0x3, 0x2); - rtl_set_bbreg(hw, RFPGA1_TXINFO, 0x300033, 0x200022); - rtl_set_bbreg(hw, RCCK0_AFESETTING, MASKBYTE3, 0x45); - rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, MASKBYTE0, 0x23); - rtl_set_bbreg(hw, ROFDM0_AGCPARAMETER1, 0x30, 0x1); - rtl_set_bbreg(hw, 0xe74, 0x0c000000, 0x2); - rtl_set_bbreg(hw, 0xe78, 0x0c000000, 0x2); - rtl_set_bbreg(hw, 0xe7c, 0x0c000000, 0x2); - rtl_set_bbreg(hw, 0xe80, 0x0c000000, 0x2); - rtl_set_bbreg(hw, 0xe88, 0x0c000000, 0x2); -} - -bool rtl92c_phy_rf_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - return rtlpriv->cfg->ops->phy_rf6052_config(hw); -} -EXPORT_SYMBOL(rtl92c_phy_rf_config); - -bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - bool rtstatus; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "==>\n"); - rtstatus = rtlpriv->cfg->ops->config_bb_with_headerfile(hw, - BASEBAND_CONFIG_PHY_REG); - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!\n"); - return false; - } - if (rtlphy->rf_type == RF_1T2R) { - _rtl92c_phy_bb_config_1t(hw); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Config to 1T!!\n"); - } - if (rtlefuse->autoload_failflag == false) { - rtlphy->pwrgroup_cnt = 0; - rtstatus = rtlpriv->cfg->ops->config_bb_with_pgheaderfile(hw, - BASEBAND_CONFIG_PHY_REG); - } - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!\n"); - return false; - } - rtstatus = rtlpriv->cfg->ops->config_bb_with_headerfile(hw, - BASEBAND_CONFIG_AGC_TAB); - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "AGC Table Fail\n"); - return false; - } - rtlphy->cck_high_power = (bool) (rtl_get_bbreg(hw, - RFPGA0_XA_HSSIPARAMETER2, - 0x200)); - - return true; -} -EXPORT_SYMBOL(_rtl92c_phy_bb8192c_config_parafile); - -void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, - u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - int index; - - if (regaddr == RTXAGC_A_RATE18_06) - index = 0; - else if (regaddr == RTXAGC_A_RATE54_24) - index = 1; - else if (regaddr == RTXAGC_A_CCK1_MCS32) - index = 6; - else if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00) - index = 7; - else if (regaddr == RTXAGC_A_MCS03_MCS00) - index = 2; - else if (regaddr == RTXAGC_A_MCS07_MCS04) - index = 3; - else if (regaddr == RTXAGC_A_MCS11_MCS08) - index = 4; - else if (regaddr == RTXAGC_A_MCS15_MCS12) - index = 5; - else if (regaddr == RTXAGC_B_RATE18_06) - index = 8; - else if (regaddr == RTXAGC_B_RATE54_24) - index = 9; - else if (regaddr == RTXAGC_B_CCK1_55_MCS32) - index = 14; - else if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff) - index = 15; - else if (regaddr == RTXAGC_B_MCS03_MCS00) - index = 10; - else if (regaddr == RTXAGC_B_MCS07_MCS04) - index = 11; - else if (regaddr == RTXAGC_B_MCS11_MCS08) - index = 12; - else if (regaddr == RTXAGC_B_MCS15_MCS12) - index = 13; - else - return; - - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][index] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%x\n", - rtlphy->pwrgroup_cnt, index, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][index]); - - if (index == 13) - rtlphy->pwrgroup_cnt++; -} -EXPORT_SYMBOL(_rtl92c_store_pwrIndex_diffrate_offset); - -void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - rtlphy->default_initialgain[0] = - (u8) rtl_get_bbreg(hw, ROFDM0_XAAGCCORE1, MASKBYTE0); - rtlphy->default_initialgain[1] = - (u8) rtl_get_bbreg(hw, ROFDM0_XBAGCCORE1, MASKBYTE0); - rtlphy->default_initialgain[2] = - (u8) rtl_get_bbreg(hw, ROFDM0_XCAGCCORE1, MASKBYTE0); - rtlphy->default_initialgain[3] = - (u8) rtl_get_bbreg(hw, ROFDM0_XDAGCCORE1, MASKBYTE0); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x\n", - rtlphy->default_initialgain[0], - rtlphy->default_initialgain[1], - rtlphy->default_initialgain[2], - rtlphy->default_initialgain[3]); - - rtlphy->framesync = (u8) rtl_get_bbreg(hw, - ROFDM0_RXDETECTOR3, MASKBYTE0); - rtlphy->framesync_c34 = rtl_get_bbreg(hw, - ROFDM0_RXDETECTOR2, MASKDWORD); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Default framesync (0x%x) = 0x%x\n", - ROFDM0_RXDETECTOR3, rtlphy->framesync); -} - -void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - rtlphy->phyreg_def[RF90_PATH_A].rfintfs = RFPGA0_XAB_RFINTERFACESW; - rtlphy->phyreg_def[RF90_PATH_B].rfintfs = RFPGA0_XAB_RFINTERFACESW; - rtlphy->phyreg_def[RF90_PATH_C].rfintfs = RFPGA0_XCD_RFINTERFACESW; - rtlphy->phyreg_def[RF90_PATH_D].rfintfs = RFPGA0_XCD_RFINTERFACESW; - - rtlphy->phyreg_def[RF90_PATH_A].rfintfi = RFPGA0_XAB_RFINTERFACERB; - rtlphy->phyreg_def[RF90_PATH_B].rfintfi = RFPGA0_XAB_RFINTERFACERB; - rtlphy->phyreg_def[RF90_PATH_C].rfintfi = RFPGA0_XCD_RFINTERFACERB; - rtlphy->phyreg_def[RF90_PATH_D].rfintfi = RFPGA0_XCD_RFINTERFACERB; - - rtlphy->phyreg_def[RF90_PATH_A].rfintfo = RFPGA0_XA_RFINTERFACEOE; - rtlphy->phyreg_def[RF90_PATH_B].rfintfo = RFPGA0_XB_RFINTERFACEOE; - - rtlphy->phyreg_def[RF90_PATH_A].rfintfe = RFPGA0_XA_RFINTERFACEOE; - rtlphy->phyreg_def[RF90_PATH_B].rfintfe = RFPGA0_XB_RFINTERFACEOE; - - rtlphy->phyreg_def[RF90_PATH_A].rf3wire_offset = - RFPGA0_XA_LSSIPARAMETER; - rtlphy->phyreg_def[RF90_PATH_B].rf3wire_offset = - RFPGA0_XB_LSSIPARAMETER; - - rtlphy->phyreg_def[RF90_PATH_A].rflssi_select = rFPGA0_XAB_RFPARAMETER; - rtlphy->phyreg_def[RF90_PATH_B].rflssi_select = rFPGA0_XAB_RFPARAMETER; - rtlphy->phyreg_def[RF90_PATH_C].rflssi_select = rFPGA0_XCD_RFPARAMETER; - rtlphy->phyreg_def[RF90_PATH_D].rflssi_select = rFPGA0_XCD_RFPARAMETER; - - rtlphy->phyreg_def[RF90_PATH_A].rftxgain_stage = RFPGA0_TXGAINSTAGE; - rtlphy->phyreg_def[RF90_PATH_B].rftxgain_stage = RFPGA0_TXGAINSTAGE; - rtlphy->phyreg_def[RF90_PATH_C].rftxgain_stage = RFPGA0_TXGAINSTAGE; - rtlphy->phyreg_def[RF90_PATH_D].rftxgain_stage = RFPGA0_TXGAINSTAGE; - - rtlphy->phyreg_def[RF90_PATH_A].rfhssi_para1 = RFPGA0_XA_HSSIPARAMETER1; - rtlphy->phyreg_def[RF90_PATH_B].rfhssi_para1 = RFPGA0_XB_HSSIPARAMETER1; - - rtlphy->phyreg_def[RF90_PATH_A].rfhssi_para2 = RFPGA0_XA_HSSIPARAMETER2; - rtlphy->phyreg_def[RF90_PATH_B].rfhssi_para2 = RFPGA0_XB_HSSIPARAMETER2; - - rtlphy->phyreg_def[RF90_PATH_A].rfsw_ctrl = RFPGA0_XAB_SWITCHCONTROL; - rtlphy->phyreg_def[RF90_PATH_B].rfsw_ctrl = RFPGA0_XAB_SWITCHCONTROL; - rtlphy->phyreg_def[RF90_PATH_C].rfsw_ctrl = RFPGA0_XCD_SWITCHCONTROL; - rtlphy->phyreg_def[RF90_PATH_D].rfsw_ctrl = RFPGA0_XCD_SWITCHCONTROL; - - rtlphy->phyreg_def[RF90_PATH_A].rfagc_control1 = ROFDM0_XAAGCCORE1; - rtlphy->phyreg_def[RF90_PATH_B].rfagc_control1 = ROFDM0_XBAGCCORE1; - rtlphy->phyreg_def[RF90_PATH_C].rfagc_control1 = ROFDM0_XCAGCCORE1; - rtlphy->phyreg_def[RF90_PATH_D].rfagc_control1 = ROFDM0_XDAGCCORE1; - - rtlphy->phyreg_def[RF90_PATH_A].rfagc_control2 = ROFDM0_XAAGCCORE2; - rtlphy->phyreg_def[RF90_PATH_B].rfagc_control2 = ROFDM0_XBAGCCORE2; - rtlphy->phyreg_def[RF90_PATH_C].rfagc_control2 = ROFDM0_XCAGCCORE2; - rtlphy->phyreg_def[RF90_PATH_D].rfagc_control2 = ROFDM0_XDAGCCORE2; - - rtlphy->phyreg_def[RF90_PATH_A].rfrxiq_imbal = ROFDM0_XARXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_B].rfrxiq_imbal = ROFDM0_XBRXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_C].rfrxiq_imbal = ROFDM0_XCRXIQIMBANLANCE; - rtlphy->phyreg_def[RF90_PATH_D].rfrxiq_imbal = ROFDM0_XDRXIQIMBALANCE; - - rtlphy->phyreg_def[RF90_PATH_A].rfrx_afe = ROFDM0_XARXAFE; - rtlphy->phyreg_def[RF90_PATH_B].rfrx_afe = ROFDM0_XBRXAFE; - rtlphy->phyreg_def[RF90_PATH_C].rfrx_afe = ROFDM0_XCRXAFE; - rtlphy->phyreg_def[RF90_PATH_D].rfrx_afe = ROFDM0_XDRXAFE; - - rtlphy->phyreg_def[RF90_PATH_A].rftxiq_imbal = ROFDM0_XATXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_B].rftxiq_imbal = ROFDM0_XBTXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_C].rftxiq_imbal = ROFDM0_XCTXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_D].rftxiq_imbal = ROFDM0_XDTXIQIMBALANCE; - - rtlphy->phyreg_def[RF90_PATH_A].rftx_afe = ROFDM0_XATXAFE; - rtlphy->phyreg_def[RF90_PATH_B].rftx_afe = ROFDM0_XBTXAFE; - rtlphy->phyreg_def[RF90_PATH_C].rftx_afe = ROFDM0_XCTXAFE; - rtlphy->phyreg_def[RF90_PATH_D].rftx_afe = ROFDM0_XDTXAFE; - - rtlphy->phyreg_def[RF90_PATH_A].rf_rb = RFPGA0_XA_LSSIREADBACK; - rtlphy->phyreg_def[RF90_PATH_B].rf_rb = RFPGA0_XB_LSSIREADBACK; - rtlphy->phyreg_def[RF90_PATH_C].rf_rb = RFPGA0_XC_LSSIREADBACK; - rtlphy->phyreg_def[RF90_PATH_D].rf_rb = RFPGA0_XD_LSSIREADBACK; - - rtlphy->phyreg_def[RF90_PATH_A].rf_rbpi = TRANSCEIVEA_HSPI_READBACK; - rtlphy->phyreg_def[RF90_PATH_B].rf_rbpi = TRANSCEIVEB_HSPI_READBACK; - -} -EXPORT_SYMBOL(_rtl92c_phy_init_bb_rf_register_definition); - -void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 txpwr_level; - long txpwr_dbm; - - txpwr_level = rtlphy->cur_cck_txpwridx; - txpwr_dbm = _rtl92c_phy_txpwr_idx_to_dbm(hw, - WIRELESS_MODE_B, txpwr_level); - txpwr_level = rtlphy->cur_ofdm24g_txpwridx + - rtlefuse->legacy_ht_txpowerdiff; - if (_rtl92c_phy_txpwr_idx_to_dbm(hw, - WIRELESS_MODE_G, - txpwr_level) > txpwr_dbm) - txpwr_dbm = - _rtl92c_phy_txpwr_idx_to_dbm(hw, WIRELESS_MODE_G, - txpwr_level); - txpwr_level = rtlphy->cur_ofdm24g_txpwridx; - if (_rtl92c_phy_txpwr_idx_to_dbm(hw, - WIRELESS_MODE_N_24G, - txpwr_level) > txpwr_dbm) - txpwr_dbm = - _rtl92c_phy_txpwr_idx_to_dbm(hw, WIRELESS_MODE_N_24G, - txpwr_level); - *powerlevel = txpwr_dbm; -} - -static void _rtl92c_get_txpower_index(struct ieee80211_hw *hw, u8 channel, - u8 *cckpowerlevel, u8 *ofdmpowerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 index = (channel - 1); - - cckpowerlevel[RF90_PATH_A] = - rtlefuse->txpwrlevel_cck[RF90_PATH_A][index]; - cckpowerlevel[RF90_PATH_B] = - rtlefuse->txpwrlevel_cck[RF90_PATH_B][index]; - if (get_rf_type(rtlphy) == RF_1T2R || get_rf_type(rtlphy) == RF_1T1R) { - ofdmpowerlevel[RF90_PATH_A] = - rtlefuse->txpwrlevel_ht40_1s[RF90_PATH_A][index]; - ofdmpowerlevel[RF90_PATH_B] = - rtlefuse->txpwrlevel_ht40_1s[RF90_PATH_B][index]; - } else if (get_rf_type(rtlphy) == RF_2T2R) { - ofdmpowerlevel[RF90_PATH_A] = - rtlefuse->txpwrlevel_ht40_2s[RF90_PATH_A][index]; - ofdmpowerlevel[RF90_PATH_B] = - rtlefuse->txpwrlevel_ht40_2s[RF90_PATH_B][index]; - } -} - -static void _rtl92c_ccxpower_index_check(struct ieee80211_hw *hw, - u8 channel, u8 *cckpowerlevel, - u8 *ofdmpowerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - rtlphy->cur_cck_txpwridx = cckpowerlevel[0]; - rtlphy->cur_ofdm24g_txpwridx = ofdmpowerlevel[0]; - -} - -void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtlpriv); - u8 cckpowerlevel[2], ofdmpowerlevel[2]; - - if (!rtlefuse->txpwr_fromeprom) - return; - _rtl92c_get_txpower_index(hw, channel, - &cckpowerlevel[0], &ofdmpowerlevel[0]); - _rtl92c_ccxpower_index_check(hw, - channel, &cckpowerlevel[0], - &ofdmpowerlevel[0]); - rtlpriv->cfg->ops->phy_rf6052_set_cck_txpower(hw, &cckpowerlevel[0]); - rtlpriv->cfg->ops->phy_rf6052_set_ofdm_txpower(hw, &ofdmpowerlevel[0], - channel); -} -EXPORT_SYMBOL(rtl92c_phy_set_txpower_level); - -bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, long power_indbm) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 idx; - u8 rf_path; - u8 ccktxpwridx = _rtl92c_phy_dbm_to_txpwr_Idx(hw, - WIRELESS_MODE_B, - power_indbm); - u8 ofdmtxpwridx = _rtl92c_phy_dbm_to_txpwr_Idx(hw, - WIRELESS_MODE_N_24G, - power_indbm); - if (ofdmtxpwridx - rtlefuse->legacy_ht_txpowerdiff > 0) - ofdmtxpwridx -= rtlefuse->legacy_ht_txpowerdiff; - else - ofdmtxpwridx = 0; - RT_TRACE(rtlpriv, COMP_TXAGC, DBG_TRACE, - "%lx dBm, ccktxpwridx = %d, ofdmtxpwridx = %d\n", - power_indbm, ccktxpwridx, ofdmtxpwridx); - for (idx = 0; idx < 14; idx++) { - for (rf_path = 0; rf_path < 2; rf_path++) { - rtlefuse->txpwrlevel_cck[rf_path][idx] = ccktxpwridx; - rtlefuse->txpwrlevel_ht40_1s[rf_path][idx] = - ofdmtxpwridx; - rtlefuse->txpwrlevel_ht40_2s[rf_path][idx] = - ofdmtxpwridx; - } - } - rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel); - return true; -} -EXPORT_SYMBOL(rtl92c_phy_update_txpower_dbm); - -u8 _rtl92c_phy_dbm_to_txpwr_Idx(struct ieee80211_hw *hw, - enum wireless_mode wirelessmode, - long power_indbm) -{ - u8 txpwridx; - long offset; - - switch (wirelessmode) { - case WIRELESS_MODE_B: - offset = -7; - break; - case WIRELESS_MODE_G: - case WIRELESS_MODE_N_24G: - offset = -8; - break; - default: - offset = -8; - break; - } - - if ((power_indbm - offset) > 0) - txpwridx = (u8) ((power_indbm - offset) * 2); - else - txpwridx = 0; - - if (txpwridx > MAX_TXPWR_IDX_NMODE_92S) - txpwridx = MAX_TXPWR_IDX_NMODE_92S; - - return txpwridx; -} -EXPORT_SYMBOL(_rtl92c_phy_dbm_to_txpwr_Idx); - -long _rtl92c_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw, - enum wireless_mode wirelessmode, - u8 txpwridx) -{ - long offset; - long pwrout_dbm; - - switch (wirelessmode) { - case WIRELESS_MODE_B: - offset = -7; - break; - case WIRELESS_MODE_G: - case WIRELESS_MODE_N_24G: - offset = -8; - break; - default: - offset = -8; - break; - } - pwrout_dbm = txpwridx / 2 + offset; - return pwrout_dbm; -} -EXPORT_SYMBOL(_rtl92c_phy_txpwr_idx_to_dbm); - -void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - enum io_type iotype; - - if (!is_hal_stop(rtlhal)) { - switch (operation) { - case SCAN_OPT_BACKUP: - iotype = IO_CMD_PAUSE_DM_BY_SCAN; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_IO_CMD, - (u8 *)&iotype); - - break; - case SCAN_OPT_RESTORE: - iotype = IO_CMD_RESUME_DM_BY_SCAN; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_IO_CMD, - (u8 *)&iotype); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Unknown Scan Backup operation\n"); - break; - } - } -} -EXPORT_SYMBOL(rtl92c_phy_scan_operation_backup); - -void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, - enum nl80211_channel_type ch_type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 tmp_bw = rtlphy->current_chan_bw; - - if (rtlphy->set_bwmode_inprogress) - return; - rtlphy->set_bwmode_inprogress = true; - if ((!is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { - rtlpriv->cfg->ops->phy_set_bw_mode_callback(hw); - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "FALSE driver sleep or unload\n"); - rtlphy->set_bwmode_inprogress = false; - rtlphy->current_chan_bw = tmp_bw; - } -} -EXPORT_SYMBOL(rtl92c_phy_set_bw_mode); - -void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 delay; - - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, - "switch to channel%d\n", rtlphy->current_channel); - if (is_hal_stop(rtlhal)) - return; - do { - if (!rtlphy->sw_chnl_inprogress) - break; - if (!_rtl92c_phy_sw_chnl_step_by_step - (hw, rtlphy->current_channel, &rtlphy->sw_chnl_stage, - &rtlphy->sw_chnl_step, &delay)) { - if (delay > 0) - mdelay(delay); - else - continue; - } else { - rtlphy->sw_chnl_inprogress = false; - } - break; - } while (true); - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n"); -} -EXPORT_SYMBOL(rtl92c_phy_sw_chnl_callback); - -u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (rtlphy->sw_chnl_inprogress) - return 0; - if (rtlphy->set_bwmode_inprogress) - return 0; - RT_ASSERT((rtlphy->current_channel <= 14), - "WIRELESS_MODE_G but channel>14\n"); - rtlphy->sw_chnl_inprogress = true; - rtlphy->sw_chnl_stage = 0; - rtlphy->sw_chnl_step = 0; - if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { - rtl92c_phy_sw_chnl_callback(hw); - RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, - "sw_chnl_inprogress false schedule workitem\n"); - rtlphy->sw_chnl_inprogress = false; - } else { - RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, - "sw_chnl_inprogress false driver sleep or unload\n"); - rtlphy->sw_chnl_inprogress = false; - } - return 1; -} -EXPORT_SYMBOL(rtl92c_phy_sw_chnl); - -static void _rtl92c_phy_sw_rf_setting(struct ieee80211_hw *hw, u8 channel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) { - if (channel == 6 && rtlphy->current_chan_bw == - HT_CHANNEL_WIDTH_20) - rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G1, MASKDWORD, - 0x00255); - else{ - u32 backupRF0x1A = (u32)rtl_get_rfreg(hw, RF90_PATH_A, - RF_RX_G1, RFREG_OFFSET_MASK); - rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G1, MASKDWORD, - backupRF0x1A); - } - } -} - -static bool _rtl92c_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable, - u32 cmdtableidx, u32 cmdtablesz, - enum swchnlcmd_id cmdid, - u32 para1, u32 para2, u32 msdelay) -{ - struct swchnlcmd *pcmd; - - if (cmdtable == NULL) { - RT_ASSERT(false, "cmdtable cannot be NULL\n"); - return false; - } - - if (cmdtableidx >= cmdtablesz) - return false; - - pcmd = cmdtable + cmdtableidx; - pcmd->cmdid = cmdid; - pcmd->para1 = para1; - pcmd->para2 = para2; - pcmd->msdelay = msdelay; - return true; -} - -bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, - u8 channel, u8 *stage, u8 *step, - u32 *delay) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct swchnlcmd precommoncmd[MAX_PRECMD_CNT]; - u32 precommoncmdcnt; - struct swchnlcmd postcommoncmd[MAX_POSTCMD_CNT]; - u32 postcommoncmdcnt; - struct swchnlcmd rfdependcmd[MAX_RFDEPENDCMD_CNT]; - u32 rfdependcmdcnt; - struct swchnlcmd *currentcmd = NULL; - u8 rfpath; - u8 num_total_rfpath = rtlphy->num_total_rfpath; - - precommoncmdcnt = 0; - _rtl92c_phy_set_sw_chnl_cmdarray(precommoncmd, precommoncmdcnt++, - MAX_PRECMD_CNT, - CMDID_SET_TXPOWEROWER_LEVEL, 0, 0, 0); - _rtl92c_phy_set_sw_chnl_cmdarray(precommoncmd, precommoncmdcnt++, - MAX_PRECMD_CNT, CMDID_END, 0, 0, 0); - - postcommoncmdcnt = 0; - - _rtl92c_phy_set_sw_chnl_cmdarray(postcommoncmd, postcommoncmdcnt++, - MAX_POSTCMD_CNT, CMDID_END, 0, 0, 0); - - rfdependcmdcnt = 0; - - RT_ASSERT((channel >= 1 && channel <= 14), - "invalid channel for Zebra: %d\n", channel); - - _rtl92c_phy_set_sw_chnl_cmdarray(rfdependcmd, rfdependcmdcnt++, - MAX_RFDEPENDCMD_CNT, CMDID_RF_WRITEREG, - RF_CHNLBW, channel, 10); - - _rtl92c_phy_set_sw_chnl_cmdarray(rfdependcmd, rfdependcmdcnt++, - MAX_RFDEPENDCMD_CNT, CMDID_END, 0, 0, - 0); - - do { - switch (*stage) { - case 0: - currentcmd = &precommoncmd[*step]; - break; - case 1: - currentcmd = &rfdependcmd[*step]; - break; - case 2: - currentcmd = &postcommoncmd[*step]; - break; - } - - if (currentcmd->cmdid == CMDID_END) { - if ((*stage) == 2) { - return true; - } else { - (*stage)++; - (*step) = 0; - continue; - } - } - - switch (currentcmd->cmdid) { - case CMDID_SET_TXPOWEROWER_LEVEL: - rtl92c_phy_set_txpower_level(hw, channel); - break; - case CMDID_WRITEPORT_ULONG: - rtl_write_dword(rtlpriv, currentcmd->para1, - currentcmd->para2); - break; - case CMDID_WRITEPORT_USHORT: - rtl_write_word(rtlpriv, currentcmd->para1, - (u16) currentcmd->para2); - break; - case CMDID_WRITEPORT_UCHAR: - rtl_write_byte(rtlpriv, currentcmd->para1, - (u8) currentcmd->para2); - break; - case CMDID_RF_WRITEREG: - for (rfpath = 0; rfpath < num_total_rfpath; rfpath++) { - rtlphy->rfreg_chnlval[rfpath] = - ((rtlphy->rfreg_chnlval[rfpath] & - 0xfffffc00) | currentcmd->para2); - - rtl_set_rfreg(hw, (enum radio_path)rfpath, - currentcmd->para1, - RFREG_OFFSET_MASK, - rtlphy->rfreg_chnlval[rfpath]); - _rtl92c_phy_sw_rf_setting(hw, channel); - } - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - - break; - } while (true); - - (*delay) = currentcmd->msdelay; - (*step)++; - return false; -} - -bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, u32 rfpath) -{ - return true; -} -EXPORT_SYMBOL(rtl8192_phy_check_is_legal_rfpath); - -static u8 _rtl92c_phy_path_a_iqk(struct ieee80211_hw *hw, bool config_pathb) -{ - u32 reg_eac, reg_e94, reg_e9c, reg_ea4; - u8 result = 0x00; - - rtl_set_bbreg(hw, 0xe30, MASKDWORD, 0x10008c1f); - rtl_set_bbreg(hw, 0xe34, MASKDWORD, 0x10008c1f); - rtl_set_bbreg(hw, 0xe38, MASKDWORD, 0x82140102); - rtl_set_bbreg(hw, 0xe3c, MASKDWORD, - config_pathb ? 0x28160202 : 0x28160502); - - if (config_pathb) { - rtl_set_bbreg(hw, 0xe50, MASKDWORD, 0x10008c22); - rtl_set_bbreg(hw, 0xe54, MASKDWORD, 0x10008c22); - rtl_set_bbreg(hw, 0xe58, MASKDWORD, 0x82140102); - rtl_set_bbreg(hw, 0xe5c, MASKDWORD, 0x28160202); - } - - rtl_set_bbreg(hw, 0xe4c, MASKDWORD, 0x001028d1); - rtl_set_bbreg(hw, 0xe48, MASKDWORD, 0xf9000000); - rtl_set_bbreg(hw, 0xe48, MASKDWORD, 0xf8000000); - - mdelay(IQK_DELAY_TIME); - - reg_eac = rtl_get_bbreg(hw, 0xeac, MASKDWORD); - reg_e94 = rtl_get_bbreg(hw, 0xe94, MASKDWORD); - reg_e9c = rtl_get_bbreg(hw, 0xe9c, MASKDWORD); - reg_ea4 = rtl_get_bbreg(hw, 0xea4, MASKDWORD); - - if (!(reg_eac & BIT(28)) && - (((reg_e94 & 0x03FF0000) >> 16) != 0x142) && - (((reg_e9c & 0x03FF0000) >> 16) != 0x42)) - result |= 0x01; - else - return result; - - if (!(reg_eac & BIT(27)) && - (((reg_ea4 & 0x03FF0000) >> 16) != 0x132) && - (((reg_eac & 0x03FF0000) >> 16) != 0x36)) - result |= 0x02; - return result; -} - -static u8 _rtl92c_phy_path_b_iqk(struct ieee80211_hw *hw) -{ - u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc; - u8 result = 0x00; - - rtl_set_bbreg(hw, 0xe60, MASKDWORD, 0x00000002); - rtl_set_bbreg(hw, 0xe60, MASKDWORD, 0x00000000); - mdelay(IQK_DELAY_TIME); - reg_eac = rtl_get_bbreg(hw, 0xeac, MASKDWORD); - reg_eb4 = rtl_get_bbreg(hw, 0xeb4, MASKDWORD); - reg_ebc = rtl_get_bbreg(hw, 0xebc, MASKDWORD); - reg_ec4 = rtl_get_bbreg(hw, 0xec4, MASKDWORD); - reg_ecc = rtl_get_bbreg(hw, 0xecc, MASKDWORD); - - if (!(reg_eac & BIT(31)) && - (((reg_eb4 & 0x03FF0000) >> 16) != 0x142) && - (((reg_ebc & 0x03FF0000) >> 16) != 0x42)) - result |= 0x01; - else - return result; - if (!(reg_eac & BIT(30)) && - (((reg_ec4 & 0x03FF0000) >> 16) != 0x132) && - (((reg_ecc & 0x03FF0000) >> 16) != 0x36)) - result |= 0x02; - return result; -} - -static void _rtl92c_phy_path_a_fill_iqk_matrix(struct ieee80211_hw *hw, - bool iqk_ok, long result[][8], - u8 final_candidate, bool btxonly) -{ - u32 oldval_0, x, tx0_a, reg; - long y, tx0_c; - - if (final_candidate == 0xFF) { - return; - } else if (iqk_ok) { - oldval_0 = (rtl_get_bbreg(hw, ROFDM0_XATXIQIMBALANCE, - MASKDWORD) >> 22) & 0x3FF; - x = result[final_candidate][0]; - if ((x & 0x00000200) != 0) - x = x | 0xFFFFFC00; - tx0_a = (x * oldval_0) >> 8; - rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE, 0x3FF, tx0_a); - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(31), - ((x * oldval_0 >> 7) & 0x1)); - y = result[final_candidate][1]; - if ((y & 0x00000200) != 0) - y = y | 0xFFFFFC00; - tx0_c = (y * oldval_0) >> 8; - rtl_set_bbreg(hw, ROFDM0_XCTXAFE, 0xF0000000, - ((tx0_c & 0x3C0) >> 6)); - rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE, 0x003F0000, - (tx0_c & 0x3F)); - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(29), - ((y * oldval_0 >> 7) & 0x1)); - if (btxonly) - return; - reg = result[final_candidate][2]; - rtl_set_bbreg(hw, ROFDM0_XARXIQIMBALANCE, 0x3FF, reg); - reg = result[final_candidate][3] & 0x3F; - rtl_set_bbreg(hw, ROFDM0_XARXIQIMBALANCE, 0xFC00, reg); - reg = (result[final_candidate][3] >> 6) & 0xF; - rtl_set_bbreg(hw, 0xca0, 0xF0000000, reg); - } -} - -static void _rtl92c_phy_path_b_fill_iqk_matrix(struct ieee80211_hw *hw, - bool iqk_ok, long result[][8], - u8 final_candidate, bool btxonly) -{ - u32 oldval_1, x, tx1_a, reg; - long y, tx1_c; - - if (final_candidate == 0xFF) { - return; - } else if (iqk_ok) { - oldval_1 = (rtl_get_bbreg(hw, ROFDM0_XBTXIQIMBALANCE, - MASKDWORD) >> 22) & 0x3FF; - x = result[final_candidate][4]; - if ((x & 0x00000200) != 0) - x = x | 0xFFFFFC00; - tx1_a = (x * oldval_1) >> 8; - rtl_set_bbreg(hw, ROFDM0_XBTXIQIMBALANCE, 0x3FF, tx1_a); - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(27), - ((x * oldval_1 >> 7) & 0x1)); - y = result[final_candidate][5]; - if ((y & 0x00000200) != 0) - y = y | 0xFFFFFC00; - tx1_c = (y * oldval_1) >> 8; - rtl_set_bbreg(hw, ROFDM0_XDTXAFE, 0xF0000000, - ((tx1_c & 0x3C0) >> 6)); - rtl_set_bbreg(hw, ROFDM0_XBTXIQIMBALANCE, 0x003F0000, - (tx1_c & 0x3F)); - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(25), - ((y * oldval_1 >> 7) & 0x1)); - if (btxonly) - return; - reg = result[final_candidate][6]; - rtl_set_bbreg(hw, ROFDM0_XBRXIQIMBALANCE, 0x3FF, reg); - reg = result[final_candidate][7] & 0x3F; - rtl_set_bbreg(hw, ROFDM0_XBRXIQIMBALANCE, 0xFC00, reg); - reg = (result[final_candidate][7] >> 6) & 0xF; - rtl_set_bbreg(hw, ROFDM0_AGCRSSITABLE, 0x0000F000, reg); - } -} - -static void _rtl92c_phy_save_adda_registers(struct ieee80211_hw *hw, - u32 *addareg, u32 *addabackup, - u32 registernum) -{ - u32 i; - - for (i = 0; i < registernum; i++) - addabackup[i] = rtl_get_bbreg(hw, addareg[i], MASKDWORD); -} - -static void _rtl92c_phy_save_mac_registers(struct ieee80211_hw *hw, - u32 *macreg, u32 *macbackup) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - - for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++) - macbackup[i] = rtl_read_byte(rtlpriv, macreg[i]); - macbackup[i] = rtl_read_dword(rtlpriv, macreg[i]); -} - -static void _rtl92c_phy_reload_adda_registers(struct ieee80211_hw *hw, - u32 *addareg, u32 *addabackup, - u32 regiesternum) -{ - u32 i; - - for (i = 0; i < regiesternum; i++) - rtl_set_bbreg(hw, addareg[i], MASKDWORD, addabackup[i]); -} - -static void _rtl92c_phy_reload_mac_registers(struct ieee80211_hw *hw, - u32 *macreg, u32 *macbackup) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - - for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++) - rtl_write_byte(rtlpriv, macreg[i], (u8) macbackup[i]); - rtl_write_dword(rtlpriv, macreg[i], macbackup[i]); -} - -static void _rtl92c_phy_path_adda_on(struct ieee80211_hw *hw, - u32 *addareg, bool is_patha_on, bool is2t) -{ - u32 pathOn; - u32 i; - - pathOn = is_patha_on ? 0x04db25a4 : 0x0b1b25a4; - if (false == is2t) { - pathOn = 0x0bdb25a0; - rtl_set_bbreg(hw, addareg[0], MASKDWORD, 0x0b1b25a0); - } else { - rtl_set_bbreg(hw, addareg[0], MASKDWORD, pathOn); - } - - for (i = 1; i < IQK_ADDA_REG_NUM; i++) - rtl_set_bbreg(hw, addareg[i], MASKDWORD, pathOn); -} - -static void _rtl92c_phy_mac_setting_calibration(struct ieee80211_hw *hw, - u32 *macreg, u32 *macbackup) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - - rtl_write_byte(rtlpriv, macreg[0], 0x3F); - - for (i = 1; i < (IQK_MAC_REG_NUM - 1); i++) - rtl_write_byte(rtlpriv, macreg[i], - (u8) (macbackup[i] & (~BIT(3)))); - rtl_write_byte(rtlpriv, macreg[i], (u8) (macbackup[i] & (~BIT(5)))); -} - -static void _rtl92c_phy_path_a_standby(struct ieee80211_hw *hw) -{ - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x0); - rtl_set_bbreg(hw, 0x840, MASKDWORD, 0x00010000); - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x80800000); -} - -static void _rtl92c_phy_pi_mode_switch(struct ieee80211_hw *hw, bool pi_mode) -{ - u32 mode; - - mode = pi_mode ? 0x01000100 : 0x01000000; - rtl_set_bbreg(hw, 0x820, MASKDWORD, mode); - rtl_set_bbreg(hw, 0x828, MASKDWORD, mode); -} - -static bool _rtl92c_phy_simularity_compare(struct ieee80211_hw *hw, - long result[][8], u8 c1, u8 c2) -{ - u32 i, j, diff, simularity_bitmap, bound; - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - u8 final_candidate[2] = { 0xFF, 0xFF }; - bool bresult = true, is2t = IS_92C_SERIAL(rtlhal->version); - - if (is2t) - bound = 8; - else - bound = 4; - - simularity_bitmap = 0; - - for (i = 0; i < bound; i++) { - diff = (result[c1][i] > result[c2][i]) ? - (result[c1][i] - result[c2][i]) : - (result[c2][i] - result[c1][i]); - - if (diff > MAX_TOLERANCE) { - if ((i == 2 || i == 6) && !simularity_bitmap) { - if (result[c1][i] + result[c1][i + 1] == 0) - final_candidate[(i / 4)] = c2; - else if (result[c2][i] + result[c2][i + 1] == 0) - final_candidate[(i / 4)] = c1; - else - simularity_bitmap = simularity_bitmap | - (1 << i); - } else - simularity_bitmap = - simularity_bitmap | (1 << i); - } - } - - if (simularity_bitmap == 0) { - for (i = 0; i < (bound / 4); i++) { - if (final_candidate[i] != 0xFF) { - for (j = i * 4; j < (i + 1) * 4 - 2; j++) - result[3][j] = - result[final_candidate[i]][j]; - bresult = false; - } - } - return bresult; - } else if (!(simularity_bitmap & 0x0F)) { - for (i = 0; i < 4; i++) - result[3][i] = result[c1][i]; - return false; - } else if (!(simularity_bitmap & 0xF0) && is2t) { - for (i = 4; i < 8; i++) - result[3][i] = result[c1][i]; - return false; - } else { - return false; - } - -} - -static void _rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, - long result[][8], u8 t, bool is2t) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 i; - u8 patha_ok, pathb_ok; - u32 adda_reg[IQK_ADDA_REG_NUM] = { - 0x85c, 0xe6c, 0xe70, 0xe74, - 0xe78, 0xe7c, 0xe80, 0xe84, - 0xe88, 0xe8c, 0xed0, 0xed4, - 0xed8, 0xedc, 0xee0, 0xeec - }; - - u32 iqk_mac_reg[IQK_MAC_REG_NUM] = { - 0x522, 0x550, 0x551, 0x040 - }; - - const u32 retrycount = 2; - - if (t == 0) { - /* dummy read */ - rtl_get_bbreg(hw, 0x800, MASKDWORD); - - _rtl92c_phy_save_adda_registers(hw, adda_reg, - rtlphy->adda_backup, 16); - _rtl92c_phy_save_mac_registers(hw, iqk_mac_reg, - rtlphy->iqk_mac_backup); - } - _rtl92c_phy_path_adda_on(hw, adda_reg, true, is2t); - if (t == 0) { - rtlphy->rfpi_enable = (u8) rtl_get_bbreg(hw, - RFPGA0_XA_HSSIPARAMETER1, - BIT(8)); - } - - if (!rtlphy->rfpi_enable) - _rtl92c_phy_pi_mode_switch(hw, true); - if (t == 0) { - rtlphy->reg_c04 = rtl_get_bbreg(hw, 0xc04, MASKDWORD); - rtlphy->reg_c08 = rtl_get_bbreg(hw, 0xc08, MASKDWORD); - rtlphy->reg_874 = rtl_get_bbreg(hw, 0x874, MASKDWORD); - } - rtl_set_bbreg(hw, 0xc04, MASKDWORD, 0x03a05600); - rtl_set_bbreg(hw, 0xc08, MASKDWORD, 0x000800e4); - rtl_set_bbreg(hw, 0x874, MASKDWORD, 0x22204000); - if (is2t) { - rtl_set_bbreg(hw, 0x840, MASKDWORD, 0x00010000); - rtl_set_bbreg(hw, 0x844, MASKDWORD, 0x00010000); - } - _rtl92c_phy_mac_setting_calibration(hw, iqk_mac_reg, - rtlphy->iqk_mac_backup); - rtl_set_bbreg(hw, 0xb68, MASKDWORD, 0x00080000); - if (is2t) - rtl_set_bbreg(hw, 0xb6c, MASKDWORD, 0x00080000); - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x80800000); - rtl_set_bbreg(hw, 0xe40, MASKDWORD, 0x01007c00); - rtl_set_bbreg(hw, 0xe44, MASKDWORD, 0x01004800); - for (i = 0; i < retrycount; i++) { - patha_ok = _rtl92c_phy_path_a_iqk(hw, is2t); - if (patha_ok == 0x03) { - result[t][0] = (rtl_get_bbreg(hw, 0xe94, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][1] = (rtl_get_bbreg(hw, 0xe9c, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][2] = (rtl_get_bbreg(hw, 0xea4, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][3] = (rtl_get_bbreg(hw, 0xeac, MASKDWORD) & - 0x3FF0000) >> 16; - break; - } else if (i == (retrycount - 1) && patha_ok == 0x01) - - result[t][0] = (rtl_get_bbreg(hw, 0xe94, - MASKDWORD) & 0x3FF0000) >> - 16; - result[t][1] = - (rtl_get_bbreg(hw, 0xe9c, MASKDWORD) & 0x3FF0000) >> 16; - - } - - if (is2t) { - _rtl92c_phy_path_a_standby(hw); - _rtl92c_phy_path_adda_on(hw, adda_reg, false, is2t); - for (i = 0; i < retrycount; i++) { - pathb_ok = _rtl92c_phy_path_b_iqk(hw); - if (pathb_ok == 0x03) { - result[t][4] = (rtl_get_bbreg(hw, - 0xeb4, - MASKDWORD) & - 0x3FF0000) >> 16; - result[t][5] = - (rtl_get_bbreg(hw, 0xebc, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][6] = - (rtl_get_bbreg(hw, 0xec4, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][7] = - (rtl_get_bbreg(hw, 0xecc, MASKDWORD) & - 0x3FF0000) >> 16; - break; - } else if (i == (retrycount - 1) && pathb_ok == 0x01) { - result[t][4] = (rtl_get_bbreg(hw, - 0xeb4, - MASKDWORD) & - 0x3FF0000) >> 16; - } - result[t][5] = (rtl_get_bbreg(hw, 0xebc, MASKDWORD) & - 0x3FF0000) >> 16; - } - } - rtl_set_bbreg(hw, 0xc04, MASKDWORD, rtlphy->reg_c04); - rtl_set_bbreg(hw, 0x874, MASKDWORD, rtlphy->reg_874); - rtl_set_bbreg(hw, 0xc08, MASKDWORD, rtlphy->reg_c08); - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0); - rtl_set_bbreg(hw, 0x840, MASKDWORD, 0x00032ed3); - if (is2t) - rtl_set_bbreg(hw, 0x844, MASKDWORD, 0x00032ed3); - if (t != 0) { - if (!rtlphy->rfpi_enable) - _rtl92c_phy_pi_mode_switch(hw, false); - _rtl92c_phy_reload_adda_registers(hw, adda_reg, - rtlphy->adda_backup, 16); - _rtl92c_phy_reload_mac_registers(hw, iqk_mac_reg, - rtlphy->iqk_mac_backup); - } -} - -static void _rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, - char delta, bool is2t) -{ -#if 0 /* This routine is deliberately dummied out for later fixes */ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - - u32 reg_d[PATH_NUM]; - u32 tmpreg, index, offset, path, i, pathbound = PATH_NUM, apkbound; - - u32 bb_backup[APK_BB_REG_NUM]; - u32 bb_reg[APK_BB_REG_NUM] = { - 0x904, 0xc04, 0x800, 0xc08, 0x874 - }; - u32 bb_ap_mode[APK_BB_REG_NUM] = { - 0x00000020, 0x00a05430, 0x02040000, - 0x000800e4, 0x00204000 - }; - u32 bb_normal_ap_mode[APK_BB_REG_NUM] = { - 0x00000020, 0x00a05430, 0x02040000, - 0x000800e4, 0x22204000 - }; - - u32 afe_backup[APK_AFE_REG_NUM]; - u32 afe_reg[APK_AFE_REG_NUM] = { - 0x85c, 0xe6c, 0xe70, 0xe74, 0xe78, - 0xe7c, 0xe80, 0xe84, 0xe88, 0xe8c, - 0xed0, 0xed4, 0xed8, 0xedc, 0xee0, - 0xeec - }; - - u32 mac_backup[IQK_MAC_REG_NUM]; - u32 mac_reg[IQK_MAC_REG_NUM] = { - 0x522, 0x550, 0x551, 0x040 - }; - - u32 apk_rf_init_value[PATH_NUM][APK_BB_REG_NUM] = { - {0x0852c, 0x1852c, 0x5852c, 0x1852c, 0x5852c}, - {0x2852e, 0x0852e, 0x3852e, 0x0852e, 0x0852e} - }; - - u32 apk_normal_rf_init_value[PATH_NUM][APK_BB_REG_NUM] = { - {0x0852c, 0x0a52c, 0x3a52c, 0x5a52c, 0x5a52c}, - {0x0852c, 0x0a52c, 0x5a52c, 0x5a52c, 0x5a52c} - }; - - u32 apk_rf_value_0[PATH_NUM][APK_BB_REG_NUM] = { - {0x52019, 0x52014, 0x52013, 0x5200f, 0x5208d}, - {0x5201a, 0x52019, 0x52016, 0x52033, 0x52050} - }; - - u32 apk_normal_rf_value_0[PATH_NUM][APK_BB_REG_NUM] = { - {0x52019, 0x52017, 0x52010, 0x5200d, 0x5206a}, - {0x52019, 0x52017, 0x52010, 0x5200d, 0x5206a} - }; - - u32 afe_on_off[PATH_NUM] = { - 0x04db25a4, 0x0b1b25a4 - }; - - const u32 apk_offset[PATH_NUM] = { 0xb68, 0xb6c }; - - u32 apk_normal_offset[PATH_NUM] = { 0xb28, 0xb98 }; - - u32 apk_value[PATH_NUM] = { 0x92fc0000, 0x12fc0000 }; - - u32 apk_normal_value[PATH_NUM] = { 0x92680000, 0x12680000 }; - - const char apk_delta_mapping[APK_BB_REG_NUM][13] = { - {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6}, - {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6}, - {-6, -4, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6}, - {-1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6}, - {-11, -9, -7, -5, -3, -1, 0, 0, 0, 0, 0, 0, 0} - }; - - const u32 apk_normal_setting_value_1[13] = { - 0x01017018, 0xf7ed8f84, 0x1b1a1816, 0x2522201e, 0x322e2b28, - 0x433f3a36, 0x5b544e49, 0x7b726a62, 0xa69a8f84, 0xdfcfc0b3, - 0x12680000, 0x00880000, 0x00880000 - }; - - const u32 apk_normal_setting_value_2[16] = { - 0x01c7021d, 0x01670183, 0x01000123, 0x00bf00e2, 0x008d00a3, - 0x0068007b, 0x004d0059, 0x003a0042, 0x002b0031, 0x001f0025, - 0x0017001b, 0x00110014, 0x000c000f, 0x0009000b, 0x00070008, - 0x00050006 - }; - - u32 apk_result[PATH_NUM][APK_BB_REG_NUM]; - - long bb_offset, delta_v, delta_offset; - - if (!is2t) - pathbound = 1; - - return; - - for (index = 0; index < PATH_NUM; index++) { - apk_offset[index] = apk_normal_offset[index]; - apk_value[index] = apk_normal_value[index]; - afe_on_off[index] = 0x6fdb25a4; - } - - for (index = 0; index < APK_BB_REG_NUM; index++) { - for (path = 0; path < pathbound; path++) { - apk_rf_init_value[path][index] = - apk_normal_rf_init_value[path][index]; - apk_rf_value_0[path][index] = - apk_normal_rf_value_0[path][index]; - } - bb_ap_mode[index] = bb_normal_ap_mode[index]; - - apkbound = 6; - } - - for (index = 0; index < APK_BB_REG_NUM; index++) { - if (index == 0) - continue; - bb_backup[index] = rtl_get_bbreg(hw, bb_reg[index], MASKDWORD); - } - - _rtl92c_phy_save_mac_registers(hw, mac_reg, mac_backup); - - _rtl92c_phy_save_adda_registers(hw, afe_reg, afe_backup, 16); - - for (path = 0; path < pathbound; path++) { - if (path == RF90_PATH_A) { - offset = 0xb00; - for (index = 0; index < 11; index++) { - rtl_set_bbreg(hw, offset, MASKDWORD, - apk_normal_setting_value_1 - [index]); - - offset += 0x04; - } - - rtl_set_bbreg(hw, 0xb98, MASKDWORD, 0x12680000); - - offset = 0xb68; - for (; index < 13; index++) { - rtl_set_bbreg(hw, offset, MASKDWORD, - apk_normal_setting_value_1 - [index]); - - offset += 0x04; - } - - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x40000000); - - offset = 0xb00; - for (index = 0; index < 16; index++) { - rtl_set_bbreg(hw, offset, MASKDWORD, - apk_normal_setting_value_2 - [index]); - - offset += 0x04; - } - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x00000000); - } else if (path == RF90_PATH_B) { - offset = 0xb70; - for (index = 0; index < 10; index++) { - rtl_set_bbreg(hw, offset, MASKDWORD, - apk_normal_setting_value_1 - [index]); - - offset += 0x04; - } - rtl_set_bbreg(hw, 0xb28, MASKDWORD, 0x12680000); - rtl_set_bbreg(hw, 0xb98, MASKDWORD, 0x12680000); - - offset = 0xb68; - index = 11; - for (; index < 13; index++) { - rtl_set_bbreg(hw, offset, MASKDWORD, - apk_normal_setting_value_1 - [index]); - - offset += 0x04; - } - - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x40000000); - - offset = 0xb60; - for (index = 0; index < 16; index++) { - rtl_set_bbreg(hw, offset, MASKDWORD, - apk_normal_setting_value_2 - [index]); - - offset += 0x04; - } - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x00000000); - } - - reg_d[path] = rtl_get_rfreg(hw, (enum radio_path)path, - 0xd, MASKDWORD); - - for (index = 0; index < APK_AFE_REG_NUM; index++) - rtl_set_bbreg(hw, afe_reg[index], MASKDWORD, - afe_on_off[path]); - - if (path == RF90_PATH_A) { - for (index = 0; index < APK_BB_REG_NUM; index++) { - if (index == 0) - continue; - rtl_set_bbreg(hw, bb_reg[index], MASKDWORD, - bb_ap_mode[index]); - } - } - - _rtl92c_phy_mac_setting_calibration(hw, mac_reg, mac_backup); - - if (path == 0) { - rtl_set_rfreg(hw, RF90_PATH_B, 0x0, MASKDWORD, 0x10000); - } else { - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, MASKDWORD, - 0x10000); - rtl_set_rfreg(hw, RF90_PATH_A, 0x10, MASKDWORD, - 0x1000f); - rtl_set_rfreg(hw, RF90_PATH_A, 0x11, MASKDWORD, - 0x20103); - } - - delta_offset = ((delta + 14) / 2); - if (delta_offset < 0) - delta_offset = 0; - else if (delta_offset > 12) - delta_offset = 12; - - for (index = 0; index < APK_BB_REG_NUM; index++) { - if (index != 1) - continue; - - tmpreg = apk_rf_init_value[path][index]; - - if (!rtlefuse->apk_thermalmeterignore) { - bb_offset = (tmpreg & 0xF0000) >> 16; - - if (!(tmpreg & BIT(15))) - bb_offset = -bb_offset; - - delta_v = - apk_delta_mapping[index][delta_offset]; - - bb_offset += delta_v; - - if (bb_offset < 0) { - tmpreg = tmpreg & (~BIT(15)); - bb_offset = -bb_offset; - } else { - tmpreg = tmpreg | BIT(15); - } - - tmpreg = - (tmpreg & 0xFFF0FFFF) | (bb_offset << 16); - } - - rtl_set_rfreg(hw, (enum radio_path)path, 0xc, - MASKDWORD, 0x8992e); - rtl_set_rfreg(hw, (enum radio_path)path, 0x0, - MASKDWORD, apk_rf_value_0[path][index]); - rtl_set_rfreg(hw, (enum radio_path)path, 0xd, - MASKDWORD, tmpreg); - - i = 0; - do { - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x80000000); - rtl_set_bbreg(hw, apk_offset[path], - MASKDWORD, apk_value[0]); - RTPRINT(rtlpriv, FINIT, INIT_IQK, - ("PHY_APCalibrate() offset 0x%x " - "value 0x%x\n", - apk_offset[path], - rtl_get_bbreg(hw, apk_offset[path], - MASKDWORD))); - - mdelay(3); - - rtl_set_bbreg(hw, apk_offset[path], - MASKDWORD, apk_value[1]); - RTPRINT(rtlpriv, FINIT, INIT_IQK, - ("PHY_APCalibrate() offset 0x%x " - "value 0x%x\n", - apk_offset[path], - rtl_get_bbreg(hw, apk_offset[path], - MASKDWORD))); - - mdelay(20); - - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x00000000); - - if (path == RF90_PATH_A) - tmpreg = rtl_get_bbreg(hw, 0xbd8, - 0x03E00000); - else - tmpreg = rtl_get_bbreg(hw, 0xbd8, - 0xF8000000); - - RTPRINT(rtlpriv, FINIT, INIT_IQK, - ("PHY_APCalibrate() offset " - "0xbd8[25:21] %x\n", tmpreg)); - - i++; - - } while (tmpreg > apkbound && i < 4); - - apk_result[path][index] = tmpreg; - } - } - - _rtl92c_phy_reload_mac_registers(hw, mac_reg, mac_backup); - - for (index = 0; index < APK_BB_REG_NUM; index++) { - if (index == 0) - continue; - rtl_set_bbreg(hw, bb_reg[index], MASKDWORD, bb_backup[index]); - } - - _rtl92c_phy_reload_adda_registers(hw, afe_reg, afe_backup, 16); - - for (path = 0; path < pathbound; path++) { - rtl_set_rfreg(hw, (enum radio_path)path, 0xd, - MASKDWORD, reg_d[path]); - - if (path == RF90_PATH_B) { - rtl_set_rfreg(hw, RF90_PATH_A, 0x10, MASKDWORD, - 0x1000f); - rtl_set_rfreg(hw, RF90_PATH_A, 0x11, MASKDWORD, - 0x20101); - } - - if (apk_result[path][1] > 6) - apk_result[path][1] = 6; - } - - for (path = 0; path < pathbound; path++) { - rtl_set_rfreg(hw, (enum radio_path)path, 0x3, MASKDWORD, - ((apk_result[path][1] << 15) | - (apk_result[path][1] << 10) | - (apk_result[path][1] << 5) | - apk_result[path][1])); - - if (path == RF90_PATH_A) - rtl_set_rfreg(hw, (enum radio_path)path, 0x4, MASKDWORD, - ((apk_result[path][1] << 15) | - (apk_result[path][1] << 10) | - (0x00 << 5) | 0x05)); - else - rtl_set_rfreg(hw, (enum radio_path)path, 0x4, MASKDWORD, - ((apk_result[path][1] << 15) | - (apk_result[path][1] << 10) | - (0x02 << 5) | 0x05)); - - rtl_set_rfreg(hw, (enum radio_path)path, 0xe, MASKDWORD, - ((0x08 << 15) | (0x08 << 10) | (0x08 << 5) | - 0x08)); - - } - rtlphy->b_apk_done = true; -#endif -} - -static void _rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, - bool bmain, bool is2t) -{ - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (is_hal_stop(rtlhal)) { - rtl_set_bbreg(hw, REG_LEDCFG0, BIT(23), 0x01); - rtl_set_bbreg(hw, rFPGA0_XAB_RFPARAMETER, BIT(13), 0x01); - } - if (is2t) { - if (bmain) - rtl_set_bbreg(hw, RFPGA0_XB_RFINTERFACEOE, - BIT(5) | BIT(6), 0x1); - else - rtl_set_bbreg(hw, RFPGA0_XB_RFINTERFACEOE, - BIT(5) | BIT(6), 0x2); - } else { - if (bmain) - rtl_set_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, 0x300, 0x2); - else - rtl_set_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, 0x300, 0x1); - - } - -} - -#undef IQK_ADDA_REG_NUM -#undef IQK_DELAY_TIME - -void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - long result[4][8]; - u8 i, final_candidate; - bool patha_ok, pathb_ok; - long reg_e94, reg_e9c, reg_ea4, reg_eb4, reg_ebc, reg_ec4, reg_tmp = 0; - bool is12simular, is13simular, is23simular; - bool start_conttx = false, singletone = false; - u32 iqk_bb_reg[10] = { - ROFDM0_XARXIQIMBALANCE, - ROFDM0_XBRXIQIMBALANCE, - ROFDM0_ECCATHRESHOLD, - ROFDM0_AGCRSSITABLE, - ROFDM0_XATXIQIMBALANCE, - ROFDM0_XBTXIQIMBALANCE, - ROFDM0_XCTXIQIMBALANCE, - ROFDM0_XCTXAFE, - ROFDM0_XDTXAFE, - ROFDM0_RXIQEXTANTA - }; - - if (recovery) { - _rtl92c_phy_reload_adda_registers(hw, - iqk_bb_reg, - rtlphy->iqk_bb_backup, 10); - return; - } - if (start_conttx || singletone) - return; - for (i = 0; i < 8; i++) { - result[0][i] = 0; - result[1][i] = 0; - result[2][i] = 0; - result[3][i] = 0; - } - final_candidate = 0xff; - patha_ok = false; - pathb_ok = false; - is12simular = false; - is23simular = false; - is13simular = false; - for (i = 0; i < 3; i++) { - if (IS_92C_SERIAL(rtlhal->version)) - _rtl92c_phy_iq_calibrate(hw, result, i, true); - else - _rtl92c_phy_iq_calibrate(hw, result, i, false); - if (i == 1) { - is12simular = _rtl92c_phy_simularity_compare(hw, - result, 0, - 1); - if (is12simular) { - final_candidate = 0; - break; - } - } - if (i == 2) { - is13simular = _rtl92c_phy_simularity_compare(hw, - result, 0, - 2); - if (is13simular) { - final_candidate = 0; - break; - } - is23simular = _rtl92c_phy_simularity_compare(hw, - result, 1, - 2); - if (is23simular) - final_candidate = 1; - else { - for (i = 0; i < 8; i++) - reg_tmp += result[3][i]; - - if (reg_tmp != 0) - final_candidate = 3; - else - final_candidate = 0xFF; - } - } - } - for (i = 0; i < 4; i++) { - reg_e94 = result[i][0]; - reg_e9c = result[i][1]; - reg_ea4 = result[i][2]; - reg_eb4 = result[i][4]; - reg_ebc = result[i][5]; - reg_ec4 = result[i][6]; - } - if (final_candidate != 0xff) { - rtlphy->reg_e94 = reg_e94 = result[final_candidate][0]; - rtlphy->reg_e9c = reg_e9c = result[final_candidate][1]; - reg_ea4 = result[final_candidate][2]; - rtlphy->reg_eb4 = reg_eb4 = result[final_candidate][4]; - rtlphy->reg_ebc = reg_ebc = result[final_candidate][5]; - reg_ec4 = result[final_candidate][6]; - patha_ok = pathb_ok = true; - } else { - rtlphy->reg_e94 = rtlphy->reg_eb4 = 0x100; - rtlphy->reg_e9c = rtlphy->reg_ebc = 0x0; - } - if (reg_e94 != 0) /*&&(reg_ea4 != 0) */ - _rtl92c_phy_path_a_fill_iqk_matrix(hw, patha_ok, result, - final_candidate, - (reg_ea4 == 0)); - if (IS_92C_SERIAL(rtlhal->version)) { - if (reg_eb4 != 0) /*&&(reg_ec4 != 0) */ - _rtl92c_phy_path_b_fill_iqk_matrix(hw, pathb_ok, - result, - final_candidate, - (reg_ec4 == 0)); - } - _rtl92c_phy_save_adda_registers(hw, iqk_bb_reg, - rtlphy->iqk_bb_backup, 10); -} -EXPORT_SYMBOL(rtl92c_phy_iq_calibrate); - -void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - bool start_conttx = false, singletone = false; - - if (start_conttx || singletone) - return; - if (IS_92C_SERIAL(rtlhal->version)) - rtlpriv->cfg->ops->phy_lc_calibrate(hw, true); - else - rtlpriv->cfg->ops->phy_lc_calibrate(hw, false); -} -EXPORT_SYMBOL(rtl92c_phy_lc_calibrate); - -void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (rtlphy->apk_done) - return; - if (IS_92C_SERIAL(rtlhal->version)) - _rtl92c_phy_ap_calibrate(hw, delta, true); - else - _rtl92c_phy_ap_calibrate(hw, delta, false); -} -EXPORT_SYMBOL(rtl92c_phy_ap_calibrate); - -void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain) -{ - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (IS_92C_SERIAL(rtlhal->version)) - _rtl92c_phy_set_rfpath_switch(hw, bmain, true); - else - _rtl92c_phy_set_rfpath_switch(hw, bmain, false); -} -EXPORT_SYMBOL(rtl92c_phy_set_rfpath_switch); - -bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - bool postprocessing = false; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "-->IO Cmd(%#x), set_io_inprogress(%d)\n", - iotype, rtlphy->set_io_inprogress); - do { - switch (iotype) { - case IO_CMD_RESUME_DM_BY_SCAN: - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "[IO CMD] Resume DM after scan\n"); - postprocessing = true; - break; - case IO_CMD_PAUSE_DM_BY_SCAN: - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "[IO CMD] Pause DM before scan\n"); - postprocessing = true; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - } while (false); - if (postprocessing && !rtlphy->set_io_inprogress) { - rtlphy->set_io_inprogress = true; - rtlphy->current_io_type = iotype; - } else { - return false; - } - rtl92c_phy_set_io(hw); - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, "<--IO Type(%#x)\n", iotype); - return true; -} -EXPORT_SYMBOL(rtl92c_phy_set_io_cmd); - -void rtl92c_phy_set_io(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct dig_t dm_digtable = rtlpriv->dm_digtable; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "--->Cmd(%#x), set_io_inprogress(%d)\n", - rtlphy->current_io_type, rtlphy->set_io_inprogress); - switch (rtlphy->current_io_type) { - case IO_CMD_RESUME_DM_BY_SCAN: - dm_digtable.cur_igvalue = rtlphy->initgain_backup.xaagccore1; - rtl92c_dm_write_dig(hw); - rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel); - break; - case IO_CMD_PAUSE_DM_BY_SCAN: - rtlphy->initgain_backup.xaagccore1 = dm_digtable.cur_igvalue; - dm_digtable.cur_igvalue = 0x37; - rtl92c_dm_write_dig(hw); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - rtlphy->set_io_inprogress = false; - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, "<---(%#x)\n", - rtlphy->current_io_type); -} -EXPORT_SYMBOL(rtl92c_phy_set_io); - -void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x2b); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x00); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); -} -EXPORT_SYMBOL(rtl92ce_phy_set_rf_on); - -void _rtl92c_phy_set_rf_sleep(struct ieee80211_hw *hw) -{ - u32 u4b_tmp; - u8 delay = 5; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF); - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, RFREG_OFFSET_MASK, 0x00); - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40); - u4b_tmp = rtl_get_rfreg(hw, RF90_PATH_A, 0, RFREG_OFFSET_MASK); - while (u4b_tmp != 0 && delay > 0) { - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x0); - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, RFREG_OFFSET_MASK, 0x00); - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40); - u4b_tmp = rtl_get_rfreg(hw, RF90_PATH_A, 0, RFREG_OFFSET_MASK); - delay--; - } - if (delay == 0) { - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x00); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); - RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, - "Switch RF timeout !!!\n"); - return; - } - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x22); -} -EXPORT_SYMBOL(_rtl92c_phy_set_rf_sleep); diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h deleted file mode 100644 index cec10d696492..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h +++ /dev/null @@ -1,258 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C_PHY_COMMON_H__ -#define __RTL92C_PHY_COMMON_H__ - -#define MAX_PRECMD_CNT 16 -#define MAX_RFDEPENDCMD_CNT 16 -#define MAX_POSTCMD_CNT 16 - -#define MAX_DOZE_WAITING_TIMES_9x 64 - -#define RT_CANNOT_IO(hw) false -#define HIGHPOWER_RADIOA_ARRAYLEN 22 - -#define IQK_ADDA_REG_NUM 16 -#define MAX_TOLERANCE 5 -#define IQK_DELAY_TIME 1 - -#define APK_BB_REG_NUM 5 -#define APK_AFE_REG_NUM 16 -#define APK_CURVE_REG_NUM 4 -#define PATH_NUM 2 - -#define LOOP_LIMIT 5 -#define MAX_STALL_TIME 50 -#define AntennaDiversityValue 0x80 -#define MAX_TXPWR_IDX_NMODE_92S 63 -#define Reset_Cnt_Limit 3 - -#define IQK_ADDA_REG_NUM 16 -#define IQK_MAC_REG_NUM 4 - -#define IQK_DELAY_TIME 1 -#define RF90_PATH_MAX 2 - -#define CT_OFFSET_MAC_ADDR 0X16 - -#define CT_OFFSET_CCK_TX_PWR_IDX 0x5A -#define CT_OFFSET_HT401S_TX_PWR_IDX 0x60 -#define CT_OFFSET_HT402S_TX_PWR_IDX_DIF 0x66 -#define CT_OFFSET_HT20_TX_PWR_IDX_DIFF 0x69 -#define CT_OFFSET_OFDM_TX_PWR_IDX_DIFF 0x6C - -#define CT_OFFSET_HT40_MAX_PWR_OFFSET 0x6F -#define CT_OFFSET_HT20_MAX_PWR_OFFSET 0x72 - -#define CT_OFFSET_CHANNEL_PLAH 0x75 -#define CT_OFFSET_THERMAL_METER 0x78 -#define CT_OFFSET_RF_OPTION 0x79 -#define CT_OFFSET_VERSION 0x7E -#define CT_OFFSET_CUSTOMER_ID 0x7F - -#define RTL92C_MAX_PATH_NUM 2 -#define LLT_LAST_ENTRY_OF_TX_PKT_BUFFER 255 - -enum swchnlcmd_id { - CMDID_END, - CMDID_SET_TXPOWEROWER_LEVEL, - CMDID_BBREGWRITE10, - CMDID_WRITEPORT_ULONG, - CMDID_WRITEPORT_USHORT, - CMDID_WRITEPORT_UCHAR, - CMDID_RF_WRITEREG, -}; - -struct swchnlcmd { - enum swchnlcmd_id cmdid; - u32 para1; - u32 para2; - u32 msdelay; -}; - -enum hw90_block_e { - HW90_BLOCK_MAC = 0, - HW90_BLOCK_PHY0 = 1, - HW90_BLOCK_PHY1 = 2, - HW90_BLOCK_RF = 3, - HW90_BLOCK_MAXIMUM = 4, -}; - -enum baseband_config_type { - BASEBAND_CONFIG_PHY_REG = 0, - BASEBAND_CONFIG_AGC_TAB = 1, -}; - -enum ra_offset_area { - RA_OFFSET_LEGACY_OFDM1, - RA_OFFSET_LEGACY_OFDM2, - RA_OFFSET_HT_OFDM1, - RA_OFFSET_HT_OFDM2, - RA_OFFSET_HT_OFDM3, - RA_OFFSET_HT_OFDM4, - RA_OFFSET_HT_CCK, -}; - -enum antenna_path { - ANTENNA_NONE, - ANTENNA_D, - ANTENNA_C, - ANTENNA_CD, - ANTENNA_B, - ANTENNA_BD, - ANTENNA_BC, - ANTENNA_BCD, - ANTENNA_A, - ANTENNA_AD, - ANTENNA_AC, - ANTENNA_ACD, - ANTENNA_AB, - ANTENNA_ABD, - ANTENNA_ABC, - ANTENNA_ABCD -}; - -struct r_antenna_select_ofdm { - u32 r_tx_antenna:4; - u32 r_ant_l:4; - u32 r_ant_non_ht:4; - u32 r_ant_ht1:4; - u32 r_ant_ht2:4; - u32 r_ant_ht_s1:4; - u32 r_ant_non_ht_s1:4; - u32 ofdm_txsc:2; - u32 reserved:2; -}; - -struct r_antenna_select_cck { - u8 r_cckrx_enable_2:2; - u8 r_cckrx_enable:2; - u8 r_ccktx_enable:4; -}; - -struct efuse_contents { - u8 mac_addr[ETH_ALEN]; - u8 cck_tx_power_idx[6]; - u8 ht40_1s_tx_power_idx[6]; - u8 ht40_2s_tx_power_idx_diff[3]; - u8 ht20_tx_power_idx_diff[3]; - u8 ofdm_tx_power_idx_diff[3]; - u8 ht40_max_power_offset[3]; - u8 ht20_max_power_offset[3]; - u8 channel_plan; - u8 thermal_meter; - u8 rf_option[5]; - u8 version; - u8 oem_id; - u8 regulatory; -}; - -struct tx_power_struct { - u8 cck[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht40_1s[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht40_2s[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht20_diff[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 legacy_ht_diff[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 legacy_ht_txpowerdiff; - u8 groupht20[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 groupht40[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 pwrgroup_cnt; - u32 mcs_original_offset[4][16]; -}; - -u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask); -void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, u32 data); -u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, - u32 bitmask); -bool rtl92c_phy_mac_config(struct ieee80211_hw *hw); -bool rtl92c_phy_bb_config(struct ieee80211_hw *hw); -bool rtl92c_phy_rf_config(struct ieee80211_hw *hw); -bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, - enum radio_path rfpath); -void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); -void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, - long *powerlevel); -void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); -bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, - long power_indbm); -void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw, - u8 operation); -void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, - enum nl80211_channel_type ch_type); -void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw); -u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw); -void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); -void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, - u16 beaconinterval); -void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); -void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); -void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); -bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, - enum radio_path rfpath); -bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, - u32 rfpath); -bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state); -void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw); -void rtl92c_phy_set_io(struct ieee80211_hw *hw); -void rtl92c_bb_block_on(struct ieee80211_hw *hw); -u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask); -long _rtl92c_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw, - enum wireless_mode wirelessmode, - u8 txpwridx); -u8 _rtl92c_phy_dbm_to_txpwr_Idx(struct ieee80211_hw *hw, - enum wireless_mode wirelessmode, - long power_indbm); -void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw); -void _rtl92c_phy_set_rf_sleep(struct ieee80211_hw *hw); -bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, - u8 channel, u8 *stage, u8 *step, - u32 *delay); -u8 rtl92c_bt_rssi_state_change(struct ieee80211_hw *hw); -u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset); -void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset, - u32 data); -u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset); -void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset, - u32 data); -bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw); -void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, - u32 data); -bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/Makefile b/drivers/net/wireless/rtlwifi/rtl8192ce/Makefile deleted file mode 100644 index c0cb0cfe7d37..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -rtl8192ce-objs := \ - dm.o \ - hw.o \ - led.o \ - phy.o \ - rf.o \ - sw.o \ - table.o \ - trx.o - -obj-$(CONFIG_RTL8192CE) += rtl8192ce.o - -ccflags-y += -D__CHECK_ENDIAN__ diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h deleted file mode 100644 index 3cfa1bb0f476..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h +++ /dev/null @@ -1,253 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C_DEF_H__ -#define __RTL92C_DEF_H__ - -#define HAL_RETRY_LIMIT_INFRA 48 -#define HAL_RETRY_LIMIT_AP_ADHOC 7 - -#define PHY_RSSI_SLID_WIN_MAX 100 -#define PHY_LINKQUALITY_SLID_WIN_MAX 20 -#define PHY_BEACON_RSSI_SLID_WIN_MAX 10 - -#define RESET_DELAY_8185 20 - -#define RT_IBSS_INT_MASKS (IMR_BCNINT | IMR_TBDOK | IMR_TBDER) -#define RT_AC_INT_MASKS (IMR_VIDOK | IMR_VODOK | IMR_BEDOK|IMR_BKDOK) - -#define NUM_OF_FIRMWARE_QUEUE 10 -#define NUM_OF_PAGES_IN_FW 0x100 -#define NUM_OF_PAGE_IN_FW_QUEUE_BK 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_BE 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_VI 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_VO 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_HCCA 0x0 -#define NUM_OF_PAGE_IN_FW_QUEUE_CMD 0x0 -#define NUM_OF_PAGE_IN_FW_QUEUE_MGNT 0x02 -#define NUM_OF_PAGE_IN_FW_QUEUE_HIGH 0x02 -#define NUM_OF_PAGE_IN_FW_QUEUE_BCN 0x2 -#define NUM_OF_PAGE_IN_FW_QUEUE_PUB 0xA1 - -#define NUM_OF_PAGE_IN_FW_QUEUE_BK_DTM 0x026 -#define NUM_OF_PAGE_IN_FW_QUEUE_BE_DTM 0x048 -#define NUM_OF_PAGE_IN_FW_QUEUE_VI_DTM 0x048 -#define NUM_OF_PAGE_IN_FW_QUEUE_VO_DTM 0x026 -#define NUM_OF_PAGE_IN_FW_QUEUE_PUB_DTM 0x00 - -#define MAX_LINES_HWCONFIG_TXT 1000 -#define MAX_BYTES_LINE_HWCONFIG_TXT 256 - -#define SW_THREE_WIRE 0 -#define HW_THREE_WIRE 2 - -#define BT_DEMO_BOARD 0 -#define BT_QA_BOARD 1 -#define BT_FPGA 2 - -#define RX_SMOOTH_FACTOR 20 - -#define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0 -#define HAL_PRIME_CHNL_OFFSET_LOWER 1 -#define HAL_PRIME_CHNL_OFFSET_UPPER 2 - -#define MAX_H2C_QUEUE_NUM 10 - -#define RX_MPDU_QUEUE 0 -#define RX_CMD_QUEUE 1 -#define RX_MAX_QUEUE 2 -#define AC2QUEUEID(_AC) (_AC) - -#define C2H_RX_CMD_HDR_LEN 8 -#define GET_C2H_CMD_CMD_LEN(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 0, 16) -#define GET_C2H_CMD_ELEMENT_ID(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 16, 8) -#define GET_C2H_CMD_CMD_SEQ(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 24, 7) -#define GET_C2H_CMD_CONTINUE(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 31, 1) -#define GET_C2H_CMD_CONTENT(__prxhdr) \ - ((u8 *)(__prxhdr) + C2H_RX_CMD_HDR_LEN) - -#define GET_C2H_CMD_FEEDBACK_ELEMENT_ID(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE((__pcmdfbhdr), 0, 8) -#define GET_C2H_CMD_FEEDBACK_CCX_LEN(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE((__pcmdfbhdr), 8, 8) -#define GET_C2H_CMD_FEEDBACK_CCX_CMD_CNT(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE((__pcmdfbhdr), 16, 16) -#define GET_C2H_CMD_FEEDBACK_CCX_MAC_ID(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 0, 5) -#define GET_C2H_CMD_FEEDBACK_CCX_VALID(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 7, 1) -#define GET_C2H_CMD_FEEDBACK_CCX_RETRY_CNT(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 8, 5) -#define GET_C2H_CMD_FEEDBACK_CCX_TOK(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 15, 1) -#define GET_C2H_CMD_FEEDBACK_CCX_QSEL(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 16, 4) -#define GET_C2H_CMD_FEEDBACK_CCX_SEQ(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 20, 12) - -#define CHIP_VER_B BIT(4) -#define CHIP_BONDING_IDENTIFIER(_value) (((_value) >> 22) & 0x3) -#define CHIP_BONDING_92C_1T2R 0x1 -#define RF_TYPE_1T2R BIT(1) -#define CHIP_92C_BITMASK BIT(0) -#define CHIP_UNKNOWN BIT(7) -#define CHIP_92C_1T2R 0x03 -#define CHIP_92C 0x01 -#define CHIP_88C 0x00 - -enum version_8192c { - VERSION_A_CHIP_92C = 0x01, - VERSION_A_CHIP_88C = 0x00, - VERSION_B_CHIP_92C = 0x11, - VERSION_B_CHIP_88C = 0x10, - VERSION_TEST_CHIP_88C = 0x00, - VERSION_TEST_CHIP_92C = 0x01, - VERSION_NORMAL_TSMC_CHIP_88C = 0x10, - VERSION_NORMAL_TSMC_CHIP_92C = 0x11, - VERSION_NORMAL_TSMC_CHIP_92C_1T2R = 0x13, - VERSION_NORMAL_UMC_CHIP_88C_A_CUT = 0x30, - VERSION_NORMAL_UMC_CHIP_92C_A_CUT = 0x31, - VERSION_NORMAL_UMC_CHIP_92C_1T2R_A_CUT = 0x33, - VERSION_NORMA_UMC_CHIP_8723_1T1R_A_CUT = 0x34, - VERSION_NORMA_UMC_CHIP_8723_1T1R_B_CUT = 0x3c, - VERSION_NORMAL_UMC_CHIP_88C_B_CUT = 0x70, - VERSION_NORMAL_UMC_CHIP_92C_B_CUT = 0x71, - VERSION_NORMAL_UMC_CHIP_92C_1T2R_B_CUT = 0x73, - VERSION_UNKNOWN = 0x88, -}; - -#define CUT_VERSION_MASK (BIT(6)|BIT(7)) -#define CHIP_VENDOR_UMC BIT(5) -#define CHIP_VENDOR_UMC_B_CUT BIT(6) /* Chip version for ECO */ -#define IS_VENDOR_UMC_A_CUT(version) ((IS_CHIP_VENDOR_UMC(version)) ? \ - ((GET_CVID_CUT_VERSION(version)) ? false : true) : false) -#define IS_CHIP_VER_B(version) ((version & CHIP_VER_B) ? true : false) -#define IS_VENDOR_UMC_A_CUT(version) ((IS_CHIP_VENDOR_UMC(version)) ? \ - ((GET_CVID_CUT_VERSION(version)) ? false : true) : false) -#define IS_92C_SERIAL(version) ((version & CHIP_92C_BITMASK) ? true : false) -#define IS_CHIP_VENDOR_UMC(version) \ - ((version & CHIP_VENDOR_UMC) ? true : false) -#define GET_CVID_CUT_VERSION(version) ((version) & CUT_VERSION_MASK) -#define IS_81xxC_VENDOR_UMC_B_CUT(version) \ - ((IS_CHIP_VENDOR_UMC(version)) ? \ - ((GET_CVID_CUT_VERSION(version) == CHIP_VENDOR_UMC_B_CUT) ? \ - true : false) : false) - -enum rtl819x_loopback_e { - RTL819X_NO_LOOPBACK = 0, - RTL819X_MAC_LOOPBACK = 1, - RTL819X_DMA_LOOPBACK = 2, - RTL819X_CCK_LOOPBACK = 3, -}; - -enum rf_optype { - RF_OP_BY_SW_3WIRE = 0, - RF_OP_BY_FW, - RF_OP_MAX -}; - -enum rf_power_state { - RF_ON, - RF_OFF, - RF_SLEEP, - RF_SHUT_DOWN, -}; - -enum power_save_mode { - POWER_SAVE_MODE_ACTIVE, - POWER_SAVE_MODE_SAVE, -}; - -enum power_polocy_config { - POWERCFG_MAX_POWER_SAVINGS, - POWERCFG_GLOBAL_POWER_SAVINGS, - POWERCFG_LOCAL_POWER_SAVINGS, - POWERCFG_LENOVO, -}; - -enum interface_select_pci { - INTF_SEL1_MINICARD = 0, - INTF_SEL0_PCIE = 1, - INTF_SEL2_RSV = 2, - INTF_SEL3_RSV = 3, -}; - -enum hal_fw_c2h_cmd_id { - HAL_FW_C2H_CMD_Read_MACREG = 0, - HAL_FW_C2H_CMD_Read_BBREG = 1, - HAL_FW_C2H_CMD_Read_RFREG = 2, - HAL_FW_C2H_CMD_Read_EEPROM = 3, - HAL_FW_C2H_CMD_Read_EFUSE = 4, - HAL_FW_C2H_CMD_Read_CAM = 5, - HAL_FW_C2H_CMD_Get_BasicRate = 6, - HAL_FW_C2H_CMD_Get_DataRate = 7, - HAL_FW_C2H_CMD_Survey = 8, - HAL_FW_C2H_CMD_SurveyDone = 9, - HAL_FW_C2H_CMD_JoinBss = 10, - HAL_FW_C2H_CMD_AddSTA = 11, - HAL_FW_C2H_CMD_DelSTA = 12, - HAL_FW_C2H_CMD_AtimDone = 13, - HAL_FW_C2H_CMD_TX_Report = 14, - HAL_FW_C2H_CMD_CCX_Report = 15, - HAL_FW_C2H_CMD_DTM_Report = 16, - HAL_FW_C2H_CMD_TX_Rate_Statistics = 17, - HAL_FW_C2H_CMD_C2HLBK = 18, - HAL_FW_C2H_CMD_C2HDBG = 19, - HAL_FW_C2H_CMD_C2HFEEDBACK = 20, - HAL_FW_C2H_CMD_MAX -}; - -enum rtl_desc_qsel { - QSLT_BK = 0x2, - QSLT_BE = 0x0, - QSLT_VI = 0x5, - QSLT_VO = 0x7, - QSLT_BEACON = 0x10, - QSLT_HIGH = 0x11, - QSLT_MGNT = 0x12, - QSLT_CMD = 0x13, -}; - -struct phy_sts_cck_8192s_t { - u8 adc_pwdb_X[4]; - u8 sq_rpt; - u8 cck_agc_rpt; -}; - -struct h2c_cmd_8192c { - u8 element_id; - u32 cmd_len; - u8 *p_cmdbuffer; -}; - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.c b/drivers/net/wireless/rtlwifi/rtl8192ce/dm.c deleted file mode 100644 index 74f9c083b80d..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.c +++ /dev/null @@ -1,109 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../base.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "../rtl8192c/fw_common.h" - -void rtl92ce_dm_dynamic_txpower(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - long undec_sm_pwdb; - - if (!rtlpriv->dm.dynamic_txpower_enable) - return; - - if (rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - return; - } - - if ((mac->link_state < MAC80211_LINKED) && - (rtlpriv->dm.entry_min_undec_sm_pwdb == 0)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, - "Not connected to any\n"); - - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - - rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; - return; - } - - if (mac->link_state >= MAC80211_LINKED) { - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "AP Client PWDB = 0x%lx\n", - undec_sm_pwdb); - } else { - undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "STA Default Port PWDB = 0x%lx\n", - undec_sm_pwdb); - } - } else { - undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb; - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "AP Ext Port PWDB = 0x%lx\n", - undec_sm_pwdb); - } - - if (undec_sm_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n"); - } else if ((undec_sm_pwdb < (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) && - (undec_sm_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL1)) { - - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n"); - } else if (undec_sm_pwdb < (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_NORMAL\n"); - } - - if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "PHY_SetTxPowerLevel8192S() Channel = %d\n", - rtlphy->current_channel); - rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel); - } - - rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h b/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h deleted file mode 100644 index d4a3d032c7bf..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h +++ /dev/null @@ -1,163 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C_DM_H__ -#define __RTL92C_DM_H__ - -#define HAL_DM_DIG_DISABLE BIT(0) -#define HAL_DM_HIPWR_DISABLE BIT(1) - -#define OFDM_TABLE_LENGTH 37 -#define CCK_TABLE_LENGTH 33 - -#define OFDM_TABLE_SIZE 37 -#define CCK_TABLE_SIZE 33 - -#define BW_AUTO_SWITCH_HIGH_LOW 25 -#define BW_AUTO_SWITCH_LOW_HIGH 30 - -#define DM_DIG_THRESH_HIGH 40 -#define DM_DIG_THRESH_LOW 35 - -#define DM_FALSEALARM_THRESH_LOW 400 -#define DM_FALSEALARM_THRESH_HIGH 1000 - -#define DM_DIG_MAX 0x3e -#define DM_DIG_MIN 0x1e - -#define DM_DIG_FA_UPPER 0x32 -#define DM_DIG_FA_LOWER 0x20 -#define DM_DIG_FA_TH0 0x20 -#define DM_DIG_FA_TH1 0x100 -#define DM_DIG_FA_TH2 0x200 - -#define DM_DIG_BACKOFF_MAX 12 -#define DM_DIG_BACKOFF_MIN -4 -#define DM_DIG_BACKOFF_DEFAULT 10 - -#define RXPATHSELECTION_SS_TH_lOW 30 -#define RXPATHSELECTION_DIFF_TH 18 - -#define DM_RATR_STA_INIT 0 -#define DM_RATR_STA_HIGH 1 -#define DM_RATR_STA_MIDDLE 2 -#define DM_RATR_STA_LOW 3 - -#define CTS2SELF_THVAL 30 -#define REGC38_TH 20 - -#define WAIOTTHVal 25 - -#define TXHIGHPWRLEVEL_NORMAL 0 -#define TXHIGHPWRLEVEL_LEVEL1 1 -#define TXHIGHPWRLEVEL_LEVEL2 2 -#define TXHIGHPWRLEVEL_BT1 3 -#define TXHIGHPWRLEVEL_BT2 4 - -#define DM_TYPE_BYFW 0 -#define DM_TYPE_BYDRIVER 1 - -#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 -#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 - -struct swat_t { - u8 failure_cnt; - u8 try_flag; - u8 stop_trying; - long pre_rssi; - long trying_threshold; - u8 cur_antenna; - u8 pre_antenna; -}; - -enum tag_dynamic_init_gain_operation_type_definition { - DIG_TYPE_THRESH_HIGH = 0, - DIG_TYPE_THRESH_LOW = 1, - DIG_TYPE_BACKOFF = 2, - DIG_TYPE_RX_GAIN_MIN = 3, - DIG_TYPE_RX_GAIN_MAX = 4, - DIG_TYPE_ENABLE = 5, - DIG_TYPE_DISABLE = 6, - DIG_OP_TYPE_MAX -}; - -enum tag_cck_packet_detection_threshold_type_definition { - CCK_PD_STAGE_LowRssi = 0, - CCK_PD_STAGE_HighRssi = 1, - CCK_FA_STAGE_Low = 2, - CCK_FA_STAGE_High = 3, - CCK_PD_STAGE_MAX = 4, -}; - -enum dm_1r_cca_e { - CCA_1R = 0, - CCA_2R = 1, - CCA_MAX = 2, -}; - -enum dm_rf_e { - RF_SAVE = 0, - RF_NORMAL = 1, - RF_MAX = 2, -}; - -enum dm_sw_ant_switch_e { - ANS_ANTENNA_B = 1, - ANS_ANTENNA_A = 2, - ANS_ANTENNA_MAX = 3, -}; - -enum dm_dig_ext_port_alg_e { - DIG_EXT_PORT_STAGE_0 = 0, - DIG_EXT_PORT_STAGE_1 = 1, - DIG_EXT_PORT_STAGE_2 = 2, - DIG_EXT_PORT_STAGE_3 = 3, - DIG_EXT_PORT_STAGE_MAX = 4, -}; - -enum dm_dig_connect_e { - DIG_STA_DISCONNECT = 0, - DIG_STA_CONNECT = 1, - DIG_STA_BEFORE_CONNECT = 2, - DIG_MULTISTA_DISCONNECT = 3, - DIG_MULTISTA_CONNECT = 4, - DIG_CONNECT_MAX -}; - -void rtl92c_dm_init(struct ieee80211_hw *hw); -void rtl92c_dm_watchdog(struct ieee80211_hw *hw); -void rtl92c_dm_write_dig(struct ieee80211_hw *hw); -void rtl92c_dm_init_edca_turbo(struct ieee80211_hw *hw); -void rtl92c_dm_check_txpower_tracking(struct ieee80211_hw *hw); -void rtl92c_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw); -void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal); -void rtl92c_dm_bt_coexist(struct ieee80211_hw *hw); -void rtl92ce_dm_dynamic_txpower(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c deleted file mode 100644 index a82b30a1996c..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +++ /dev/null @@ -1,2428 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../efuse.h" -#include "../base.h" -#include "../regd.h" -#include "../cam.h" -#include "../ps.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "../rtl8192c/fw_common.h" -#include "dm.h" -#include "led.h" -#include "hw.h" - -#define LLT_CONFIG 5 - -static void _rtl92ce_set_bcn_ctrl_reg(struct ieee80211_hw *hw, - u8 set_bits, u8 clear_bits) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpci->reg_bcn_ctrl_val |= set_bits; - rtlpci->reg_bcn_ctrl_val &= ~clear_bits; - - rtl_write_byte(rtlpriv, REG_BCN_CTRL, (u8) rtlpci->reg_bcn_ctrl_val); -} - -static void _rtl92ce_stop_tx_beacon(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp1byte; - - tmp1byte = rtl_read_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2); - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, tmp1byte & (~BIT(6))); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0x64); - tmp1byte = rtl_read_byte(rtlpriv, REG_TBTT_PROHIBIT + 2); - tmp1byte &= ~(BIT(0)); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 2, tmp1byte); -} - -static void _rtl92ce_resume_tx_beacon(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp1byte; - - tmp1byte = rtl_read_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2); - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, tmp1byte | BIT(6)); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0xff); - tmp1byte = rtl_read_byte(rtlpriv, REG_TBTT_PROHIBIT + 2); - tmp1byte |= BIT(0); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 2, tmp1byte); -} - -static void _rtl92ce_enable_bcn_sub_func(struct ieee80211_hw *hw) -{ - _rtl92ce_set_bcn_ctrl_reg(hw, 0, BIT(1)); -} - -static void _rtl92ce_disable_bcn_sub_func(struct ieee80211_hw *hw) -{ - _rtl92ce_set_bcn_ctrl_reg(hw, BIT(1), 0); -} - -void rtl92ce_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - switch (variable) { - case HW_VAR_RCR: - *((u32 *) (val)) = rtlpci->receive_config; - break; - case HW_VAR_RF_STATE: - *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state; - break; - case HW_VAR_FWLPS_RF_ON:{ - enum rf_pwrstate rfState; - u32 val_rcr; - - rtlpriv->cfg->ops->get_hw_reg(hw, - HW_VAR_RF_STATE, - (u8 *) (&rfState)); - if (rfState == ERFOFF) { - *((bool *) (val)) = true; - } else { - val_rcr = rtl_read_dword(rtlpriv, REG_RCR); - val_rcr &= 0x00070000; - if (val_rcr) - *((bool *) (val)) = false; - else - *((bool *) (val)) = true; - } - break; - } - case HW_VAR_FW_PSMODE_STATUS: - *((bool *) (val)) = ppsc->fw_current_inpsmode; - break; - case HW_VAR_CORRECT_TSF:{ - u64 tsf; - u32 *ptsf_low = (u32 *)&tsf; - u32 *ptsf_high = ((u32 *)&tsf) + 1; - - *ptsf_high = rtl_read_dword(rtlpriv, (REG_TSFTR + 4)); - *ptsf_low = rtl_read_dword(rtlpriv, REG_TSFTR); - - *((u64 *) (val)) = tsf; - - break; - } - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } -} - -void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - u8 idx; - - switch (variable) { - case HW_VAR_ETHER_ADDR:{ - for (idx = 0; idx < ETH_ALEN; idx++) { - rtl_write_byte(rtlpriv, (REG_MACID + idx), - val[idx]); - } - break; - } - case HW_VAR_BASIC_RATE:{ - u16 rate_cfg = ((u16 *) val)[0]; - u8 rate_index = 0; - rate_cfg &= 0x15f; - rate_cfg |= 0x01; - rtl_write_byte(rtlpriv, REG_RRSR, rate_cfg & 0xff); - rtl_write_byte(rtlpriv, REG_RRSR + 1, - (rate_cfg >> 8) & 0xff); - while (rate_cfg > 0x1) { - rate_cfg = (rate_cfg >> 1); - rate_index++; - } - rtl_write_byte(rtlpriv, REG_INIRTS_RATE_SEL, - rate_index); - break; - } - case HW_VAR_BSSID:{ - for (idx = 0; idx < ETH_ALEN; idx++) { - rtl_write_byte(rtlpriv, (REG_BSSID + idx), - val[idx]); - } - break; - } - case HW_VAR_SIFS:{ - rtl_write_byte(rtlpriv, REG_SIFS_CTX + 1, val[0]); - rtl_write_byte(rtlpriv, REG_SIFS_TRX + 1, val[1]); - - rtl_write_byte(rtlpriv, REG_SPEC_SIFS + 1, val[0]); - rtl_write_byte(rtlpriv, REG_MAC_SPEC_SIFS + 1, val[0]); - - if (!mac->ht_enable) - rtl_write_word(rtlpriv, REG_RESP_SIFS_OFDM, - 0x0e0e); - else - rtl_write_word(rtlpriv, REG_RESP_SIFS_OFDM, - *((u16 *) val)); - break; - } - case HW_VAR_SLOT_TIME:{ - u8 e_aci; - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "HW_VAR_SLOT_TIME %x\n", val[0]); - - rtl_write_byte(rtlpriv, REG_SLOT, val[0]); - - for (e_aci = 0; e_aci < AC_MAX; e_aci++) { - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_AC_PARAM, - &e_aci); - } - break; - } - case HW_VAR_ACK_PREAMBLE:{ - u8 reg_tmp; - u8 short_preamble = (bool)*val; - reg_tmp = (mac->cur_40_prime_sc) << 5; - if (short_preamble) - reg_tmp |= 0x80; - - rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_tmp); - break; - } - case HW_VAR_AMPDU_MIN_SPACE:{ - u8 min_spacing_to_set; - u8 sec_min_space; - - min_spacing_to_set = *val; - if (min_spacing_to_set <= 7) { - sec_min_space = 0; - - if (min_spacing_to_set < sec_min_space) - min_spacing_to_set = sec_min_space; - - mac->min_space_cfg = ((mac->min_space_cfg & - 0xf8) | - min_spacing_to_set); - - *val = min_spacing_to_set; - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_AMPDU_MIN_SPACE: %#x\n", - mac->min_space_cfg); - - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, - mac->min_space_cfg); - } - break; - } - case HW_VAR_SHORTGI_DENSITY:{ - u8 density_to_set; - - density_to_set = *val; - mac->min_space_cfg |= (density_to_set << 3); - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_SHORTGI_DENSITY: %#x\n", - mac->min_space_cfg); - - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, - mac->min_space_cfg); - - break; - } - case HW_VAR_AMPDU_FACTOR:{ - u8 regtoset_normal[4] = {0x41, 0xa8, 0x72, 0xb9}; - u8 regtoset_bt[4] = {0x31, 0x74, 0x42, 0x97}; - - u8 factor_toset; - u8 *p_regtoset = NULL; - u8 index = 0; - - if ((rtlpcipriv->bt_coexist.bt_coexistence) && - (rtlpcipriv->bt_coexist.bt_coexist_type == - BT_CSR_BC4)) - p_regtoset = regtoset_bt; - else - p_regtoset = regtoset_normal; - - factor_toset = *(val); - if (factor_toset <= 3) { - factor_toset = (1 << (factor_toset + 2)); - if (factor_toset > 0xf) - factor_toset = 0xf; - - for (index = 0; index < 4; index++) { - if ((p_regtoset[index] & 0xf0) > - (factor_toset << 4)) - p_regtoset[index] = - (p_regtoset[index] & 0x0f) | - (factor_toset << 4); - - if ((p_regtoset[index] & 0x0f) > - factor_toset) - p_regtoset[index] = - (p_regtoset[index] & 0xf0) | - (factor_toset); - - rtl_write_byte(rtlpriv, - (REG_AGGLEN_LMT + index), - p_regtoset[index]); - - } - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_AMPDU_FACTOR: %#x\n", - factor_toset); - } - break; - } - case HW_VAR_AC_PARAM:{ - u8 e_aci = *(val); - rtl92c_dm_init_edca_turbo(hw); - - if (rtlpci->acm_method != eAcmWay2_SW) - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_ACM_CTRL, - (&e_aci)); - break; - } - case HW_VAR_ACM_CTRL:{ - u8 e_aci = *(val); - union aci_aifsn *p_aci_aifsn = - (union aci_aifsn *)(&(mac->ac[0].aifs)); - u8 acm = p_aci_aifsn->f.acm; - u8 acm_ctrl = rtl_read_byte(rtlpriv, REG_ACMHWCTRL); - - acm_ctrl = - acm_ctrl | ((rtlpci->acm_method == 2) ? 0x0 : 0x1); - - if (acm) { - switch (e_aci) { - case AC0_BE: - acm_ctrl |= AcmHw_BeqEn; - break; - case AC2_VI: - acm_ctrl |= AcmHw_ViqEn; - break; - case AC3_VO: - acm_ctrl |= AcmHw_VoqEn; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "HW_VAR_ACM_CTRL acm set failed: eACI is %d\n", - acm); - break; - } - } else { - switch (e_aci) { - case AC0_BE: - acm_ctrl &= (~AcmHw_BeqEn); - break; - case AC2_VI: - acm_ctrl &= (~AcmHw_ViqEn); - break; - case AC3_VO: - acm_ctrl &= (~AcmHw_BeqEn); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - } - - RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE, - "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", - acm_ctrl); - rtl_write_byte(rtlpriv, REG_ACMHWCTRL, acm_ctrl); - break; - } - case HW_VAR_RCR:{ - rtl_write_dword(rtlpriv, REG_RCR, ((u32 *) (val))[0]); - rtlpci->receive_config = ((u32 *) (val))[0]; - break; - } - case HW_VAR_RETRY_LIMIT:{ - u8 retry_limit = val[0]; - - rtl_write_word(rtlpriv, REG_RL, - retry_limit << RETRY_LIMIT_SHORT_SHIFT | - retry_limit << RETRY_LIMIT_LONG_SHIFT); - break; - } - case HW_VAR_DUAL_TSF_RST: - rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, (BIT(0) | BIT(1))); - break; - case HW_VAR_EFUSE_BYTES: - rtlefuse->efuse_usedbytes = *((u16 *) val); - break; - case HW_VAR_EFUSE_USAGE: - rtlefuse->efuse_usedpercentage = *val; - break; - case HW_VAR_IO_CMD: - rtl92c_phy_set_io_cmd(hw, (*(enum io_type *)val)); - break; - case HW_VAR_WPA_CONFIG: - rtl_write_byte(rtlpriv, REG_SECCFG, *val); - break; - case HW_VAR_SET_RPWM:{ - u8 rpwm_val; - - rpwm_val = rtl_read_byte(rtlpriv, REG_PCIE_HRPWM); - udelay(1); - - if (rpwm_val & BIT(7)) { - rtl_write_byte(rtlpriv, REG_PCIE_HRPWM, *val); - } else { - rtl_write_byte(rtlpriv, REG_PCIE_HRPWM, - *val | BIT(7)); - } - - break; - } - case HW_VAR_H2C_FW_PWRMODE:{ - u8 psmode = *val; - - if ((psmode != FW_PS_ACTIVE_MODE) && - (!IS_92C_SERIAL(rtlhal->version))) { - rtl92c_dm_rf_saving(hw, true); - } - - rtl92c_set_fw_pwrmode_cmd(hw, *val); - break; - } - case HW_VAR_FW_PSMODE_STATUS: - ppsc->fw_current_inpsmode = *((bool *) val); - break; - case HW_VAR_H2C_FW_JOINBSSRPT:{ - u8 mstatus = *val; - u8 tmp_regcr, tmp_reg422; - bool recover = false; - - if (mstatus == RT_MEDIA_CONNECT) { - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_AID, - NULL); - - tmp_regcr = rtl_read_byte(rtlpriv, REG_CR + 1); - rtl_write_byte(rtlpriv, REG_CR + 1, - (tmp_regcr | BIT(0))); - - _rtl92ce_set_bcn_ctrl_reg(hw, 0, BIT(3)); - _rtl92ce_set_bcn_ctrl_reg(hw, BIT(4), 0); - - tmp_reg422 = - rtl_read_byte(rtlpriv, - REG_FWHW_TXQ_CTRL + 2); - if (tmp_reg422 & BIT(6)) - recover = true; - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, - tmp_reg422 & (~BIT(6))); - - rtl92c_set_fw_rsvdpagepkt(hw, 0); - - _rtl92ce_set_bcn_ctrl_reg(hw, BIT(3), 0); - _rtl92ce_set_bcn_ctrl_reg(hw, 0, BIT(4)); - - if (recover) { - rtl_write_byte(rtlpriv, - REG_FWHW_TXQ_CTRL + 2, - tmp_reg422); - } - - rtl_write_byte(rtlpriv, REG_CR + 1, - (tmp_regcr & ~(BIT(0)))); - } - rtl92c_set_fw_joinbss_report_cmd(hw, *val); - - break; - } - case HW_VAR_H2C_FW_P2P_PS_OFFLOAD: - rtl92c_set_p2p_ps_offload_cmd(hw, (*(u8 *)val)); - break; - case HW_VAR_AID:{ - u16 u2btmp; - u2btmp = rtl_read_word(rtlpriv, REG_BCN_PSR_RPT); - u2btmp &= 0xC000; - rtl_write_word(rtlpriv, REG_BCN_PSR_RPT, (u2btmp | - mac->assoc_id)); - - break; - } - case HW_VAR_CORRECT_TSF:{ - u8 btype_ibss = val[0]; - - if (btype_ibss) - _rtl92ce_stop_tx_beacon(hw); - - _rtl92ce_set_bcn_ctrl_reg(hw, 0, BIT(3)); - - rtl_write_dword(rtlpriv, REG_TSFTR, - (u32) (mac->tsf & 0xffffffff)); - rtl_write_dword(rtlpriv, REG_TSFTR + 4, - (u32) ((mac->tsf >> 32) & 0xffffffff)); - - _rtl92ce_set_bcn_ctrl_reg(hw, BIT(3), 0); - - if (btype_ibss) - _rtl92ce_resume_tx_beacon(hw); - - break; - - } - case HW_VAR_FW_LPS_ACTION: { - bool enter_fwlps = *((bool *)val); - u8 rpwm_val, fw_pwrmode; - bool fw_current_inps; - - if (enter_fwlps) { - rpwm_val = 0x02; /* RF off */ - fw_current_inps = true; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_FW_PSMODE_STATUS, - (u8 *)(&fw_current_inps)); - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_PWRMODE, - (u8 *)(&ppsc->fwctrl_psmode)); - - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_SET_RPWM, - (u8 *)(&rpwm_val)); - } else { - rpwm_val = 0x0C; /* RF on */ - fw_pwrmode = FW_PS_ACTIVE_MODE; - fw_current_inps = false; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_SET_RPWM, - (u8 *)(&rpwm_val)); - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_PWRMODE, - (u8 *)(&fw_pwrmode)); - - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_FW_PSMODE_STATUS, - (u8 *)(&fw_current_inps)); - } - break; } - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } -} - -static bool _rtl92ce_llt_write(struct ieee80211_hw *hw, u32 address, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - bool status = true; - long count = 0; - u32 value = _LLT_INIT_ADDR(address) | - _LLT_INIT_DATA(data) | _LLT_OP(_LLT_WRITE_ACCESS); - - rtl_write_dword(rtlpriv, REG_LLT_INIT, value); - - do { - value = rtl_read_dword(rtlpriv, REG_LLT_INIT); - if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)) - break; - - if (count > POLLING_LLT_THRESHOLD) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Failed to polling write LLT done at address %d!\n", - address); - status = false; - break; - } - } while (++count); - - return status; -} - -static bool _rtl92ce_llt_table_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - unsigned short i; - u8 txpktbuf_bndy; - u8 maxPage; - bool status; - -#if LLT_CONFIG == 1 - maxPage = 255; - txpktbuf_bndy = 252; -#elif LLT_CONFIG == 2 - maxPage = 127; - txpktbuf_bndy = 124; -#elif LLT_CONFIG == 3 - maxPage = 255; - txpktbuf_bndy = 174; -#elif LLT_CONFIG == 4 - maxPage = 255; - txpktbuf_bndy = 246; -#elif LLT_CONFIG == 5 - maxPage = 255; - txpktbuf_bndy = 246; -#endif - -#if LLT_CONFIG == 1 - rtl_write_byte(rtlpriv, REG_RQPN_NPQ, 0x1c); - rtl_write_dword(rtlpriv, REG_RQPN, 0x80a71c1c); -#elif LLT_CONFIG == 2 - rtl_write_dword(rtlpriv, REG_RQPN, 0x845B1010); -#elif LLT_CONFIG == 3 - rtl_write_dword(rtlpriv, REG_RQPN, 0x84838484); -#elif LLT_CONFIG == 4 - rtl_write_dword(rtlpriv, REG_RQPN, 0x80bd1c1c); -#elif LLT_CONFIG == 5 - rtl_write_word(rtlpriv, REG_RQPN_NPQ, 0x0000); - - rtl_write_dword(rtlpriv, REG_RQPN, 0x80b01c29); -#endif - - rtl_write_dword(rtlpriv, REG_TRXFF_BNDY, (0x27FF0000 | txpktbuf_bndy)); - rtl_write_byte(rtlpriv, REG_TDECTRL + 1, txpktbuf_bndy); - - rtl_write_byte(rtlpriv, REG_TXPKTBUF_BCNQ_BDNY, txpktbuf_bndy); - rtl_write_byte(rtlpriv, REG_TXPKTBUF_MGQ_BDNY, txpktbuf_bndy); - - rtl_write_byte(rtlpriv, 0x45D, txpktbuf_bndy); - rtl_write_byte(rtlpriv, REG_PBP, 0x11); - rtl_write_byte(rtlpriv, REG_RX_DRVINFO_SZ, 0x4); - - for (i = 0; i < (txpktbuf_bndy - 1); i++) { - status = _rtl92ce_llt_write(hw, i, i + 1); - if (true != status) - return status; - } - - status = _rtl92ce_llt_write(hw, (txpktbuf_bndy - 1), 0xFF); - if (true != status) - return status; - - for (i = txpktbuf_bndy; i < maxPage; i++) { - status = _rtl92ce_llt_write(hw, i, (i + 1)); - if (true != status) - return status; - } - - status = _rtl92ce_llt_write(hw, maxPage, txpktbuf_bndy); - if (true != status) - return status; - - return true; -} - -static void _rtl92ce_gen_refresh_led_state(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); - - if (rtlpci->up_first_time) - return; - - if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) - rtl92ce_sw_led_on(hw, pLed0); - else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT) - rtl92ce_sw_led_on(hw, pLed0); - else - rtl92ce_sw_led_off(hw, pLed0); -} - -static bool _rtl92ce_init_mac(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - unsigned char bytetmp; - unsigned short wordtmp; - u16 retry; - - rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x00); - if (rtlpcipriv->bt_coexist.bt_coexistence) { - u32 value32; - value32 = rtl_read_dword(rtlpriv, REG_APS_FSMCO); - value32 |= (SOP_ABG | SOP_AMB | XOP_BTCK); - rtl_write_dword(rtlpriv, REG_APS_FSMCO, value32); - } - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x2b); - rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL, 0x0F); - - if (rtlpcipriv->bt_coexist.bt_coexistence) { - u32 u4b_tmp = rtl_read_dword(rtlpriv, REG_AFE_XTAL_CTRL); - - u4b_tmp &= (~0x00024800); - rtl_write_dword(rtlpriv, REG_AFE_XTAL_CTRL, u4b_tmp); - } - - bytetmp = rtl_read_byte(rtlpriv, REG_APS_FSMCO + 1) | BIT(0); - udelay(2); - - rtl_write_byte(rtlpriv, REG_APS_FSMCO + 1, bytetmp); - udelay(2); - - bytetmp = rtl_read_byte(rtlpriv, REG_APS_FSMCO + 1); - udelay(2); - - retry = 0; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "reg0xec:%x:%x\n", - rtl_read_dword(rtlpriv, 0xEC), bytetmp); - - while ((bytetmp & BIT(0)) && retry < 1000) { - retry++; - udelay(50); - bytetmp = rtl_read_byte(rtlpriv, REG_APS_FSMCO + 1); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "reg0xec:%x:%x\n", - rtl_read_dword(rtlpriv, 0xEC), bytetmp); - udelay(50); - } - - rtl_write_word(rtlpriv, REG_APS_FSMCO, 0x1012); - - rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL + 1, 0x82); - udelay(2); - - if (rtlpcipriv->bt_coexist.bt_coexistence) { - bytetmp = rtl_read_byte(rtlpriv, REG_AFE_XTAL_CTRL+2) & 0xfd; - rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL+2, bytetmp); - } - - rtl_write_word(rtlpriv, REG_CR, 0x2ff); - - if (!_rtl92ce_llt_table_init(hw)) - return false; - - rtl_write_dword(rtlpriv, REG_HISR, 0xffffffff); - rtl_write_byte(rtlpriv, REG_HISRE, 0xff); - - rtl_write_word(rtlpriv, REG_TRXFF_BNDY + 2, 0x27ff); - - wordtmp = rtl_read_word(rtlpriv, REG_TRXDMA_CTRL); - wordtmp &= 0xf; - wordtmp |= 0xF771; - rtl_write_word(rtlpriv, REG_TRXDMA_CTRL, wordtmp); - - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 1, 0x1F); - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); - rtl_write_dword(rtlpriv, REG_TCR, rtlpci->transmit_config); - - rtl_write_byte(rtlpriv, 0x4d0, 0x0); - - rtl_write_dword(rtlpriv, REG_BCNQ_DESA, - ((u64) rtlpci->tx_ring[BEACON_QUEUE].dma) & - DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_MGQ_DESA, - (u64) rtlpci->tx_ring[MGNT_QUEUE].dma & - DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_VOQ_DESA, - (u64) rtlpci->tx_ring[VO_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_VIQ_DESA, - (u64) rtlpci->tx_ring[VI_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_BEQ_DESA, - (u64) rtlpci->tx_ring[BE_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_BKQ_DESA, - (u64) rtlpci->tx_ring[BK_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_HQ_DESA, - (u64) rtlpci->tx_ring[HIGH_QUEUE].dma & - DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_RX_DESA, - (u64) rtlpci->rx_ring[RX_MPDU_QUEUE].dma & - DMA_BIT_MASK(32)); - - if (IS_92C_SERIAL(rtlhal->version)) - rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG + 3, 0x77); - else - rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG + 3, 0x22); - - rtl_write_dword(rtlpriv, REG_INT_MIG, 0); - - bytetmp = rtl_read_byte(rtlpriv, REG_APSD_CTRL); - rtl_write_byte(rtlpriv, REG_APSD_CTRL, bytetmp & ~BIT(6)); - do { - retry++; - bytetmp = rtl_read_byte(rtlpriv, REG_APSD_CTRL); - } while ((retry < 200) && (bytetmp & BIT(7))); - - _rtl92ce_gen_refresh_led_state(hw); - - rtl_write_dword(rtlpriv, REG_MCUTST_1, 0x0); - - return true; -} - -static void _rtl92ce_hw_configure(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u8 reg_bw_opmode; - u32 reg_prsr; - - reg_bw_opmode = BW_OPMODE_20MHZ; - reg_prsr = RATE_ALL_CCK | RATE_ALL_OFDM_AG; - - rtl_write_byte(rtlpriv, REG_INIRTS_RATE_SEL, 0x8); - - rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); - - rtl_write_dword(rtlpriv, REG_RRSR, reg_prsr); - - rtl_write_byte(rtlpriv, REG_SLOT, 0x09); - - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, 0x0); - - rtl_write_word(rtlpriv, REG_FWHW_TXQ_CTRL, 0x1F80); - - rtl_write_word(rtlpriv, REG_RL, 0x0707); - - rtl_write_dword(rtlpriv, REG_BAR_MODE_CTRL, 0x02012802); - - rtl_write_byte(rtlpriv, REG_HWSEQ_CTRL, 0xFF); - - rtl_write_dword(rtlpriv, REG_DARFRC, 0x01000000); - rtl_write_dword(rtlpriv, REG_DARFRC + 4, 0x07060504); - rtl_write_dword(rtlpriv, REG_RARFRC, 0x01000000); - rtl_write_dword(rtlpriv, REG_RARFRC + 4, 0x07060504); - - if ((rtlpcipriv->bt_coexist.bt_coexistence) && - (rtlpcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC4)) - rtl_write_dword(rtlpriv, REG_AGGLEN_LMT, 0x97427431); - else - rtl_write_dword(rtlpriv, REG_AGGLEN_LMT, 0xb972a841); - - rtl_write_byte(rtlpriv, REG_ATIMWND, 0x2); - - rtl_write_byte(rtlpriv, REG_BCN_MAX_ERR, 0xff); - - rtlpci->reg_bcn_ctrl_val = 0x1f; - rtl_write_byte(rtlpriv, REG_BCN_CTRL, rtlpci->reg_bcn_ctrl_val); - - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0xff); - - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0xff); - - rtl_write_byte(rtlpriv, REG_PIFS, 0x1C); - rtl_write_byte(rtlpriv, REG_AGGR_BREAK_TIME, 0x16); - - if ((rtlpcipriv->bt_coexist.bt_coexistence) && - (rtlpcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC4)) { - rtl_write_word(rtlpriv, REG_NAV_PROT_LEN, 0x0020); - rtl_write_word(rtlpriv, REG_PROT_MODE_CTRL, 0x0402); - } else { - rtl_write_word(rtlpriv, REG_NAV_PROT_LEN, 0x0020); - rtl_write_word(rtlpriv, REG_NAV_PROT_LEN, 0x0020); - } - - if ((rtlpcipriv->bt_coexist.bt_coexistence) && - (rtlpcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC4)) - rtl_write_dword(rtlpriv, REG_FAST_EDCA_CTRL, 0x03086666); - else - rtl_write_dword(rtlpriv, REG_FAST_EDCA_CTRL, 0x086666); - - rtl_write_byte(rtlpriv, REG_ACKTO, 0x40); - - rtl_write_word(rtlpriv, REG_SPEC_SIFS, 0x1010); - rtl_write_word(rtlpriv, REG_MAC_SPEC_SIFS, 0x1010); - - rtl_write_word(rtlpriv, REG_SIFS_CTX, 0x1010); - - rtl_write_word(rtlpriv, REG_SIFS_TRX, 0x1010); - - rtl_write_dword(rtlpriv, REG_MAR, 0xffffffff); - rtl_write_dword(rtlpriv, REG_MAR + 4, 0xffffffff); - -} - -static void _rtl92ce_enable_aspm_back_door(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - rtl_write_byte(rtlpriv, 0x34b, 0x93); - rtl_write_word(rtlpriv, 0x350, 0x870c); - rtl_write_byte(rtlpriv, 0x352, 0x1); - - if (ppsc->support_backdoor) - rtl_write_byte(rtlpriv, 0x349, 0x1b); - else - rtl_write_byte(rtlpriv, 0x349, 0x03); - - rtl_write_word(rtlpriv, 0x350, 0x2718); - rtl_write_byte(rtlpriv, 0x352, 0x1); -} - -void rtl92ce_enable_hw_security_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 sec_reg_value; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n", - rtlpriv->sec.pairwise_enc_algorithm, - rtlpriv->sec.group_enc_algorithm); - - if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "not open hw encryption\n"); - return; - } - - sec_reg_value = SCR_TxEncEnable | SCR_RxDecEnable; - - if (rtlpriv->sec.use_defaultkey) { - sec_reg_value |= SCR_TxUseDK; - sec_reg_value |= SCR_RxUseDK; - } - - sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK); - - rtl_write_byte(rtlpriv, REG_CR + 1, 0x02); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, - "The SECR-value %x\n", sec_reg_value); - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value); - -} - -int rtl92ce_hw_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool rtstatus = true; - bool is92c; - int err; - u8 tmp_u1b; - - rtlpci->being_init_adapter = true; - rtlpriv->intf_ops->disable_aspm(hw); - rtstatus = _rtl92ce_init_mac(hw); - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Init MAC failed\n"); - err = 1; - return err; - } - - err = rtl92c_download_fw(hw); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Failed to download FW. Init HW without FW now..\n"); - err = 1; - return err; - } - - rtlhal->last_hmeboxnum = 0; - rtl92c_phy_mac_config(hw); - /* because last function modify RCR, so we update - * rcr var here, or TP will unstable for receive_config - * is wrong, RX RCR_ACRC32 will cause TP unstabel & Rx - * RCR_APP_ICV will cause mac80211 unassoc for cisco 1252*/ - rtlpci->receive_config = rtl_read_dword(rtlpriv, REG_RCR); - rtlpci->receive_config &= ~(RCR_ACRC32 | RCR_AICV); - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); - rtl92c_phy_bb_config(hw); - rtlphy->rf_mode = RF_OP_BY_SW_3WIRE; - rtl92c_phy_rf_config(hw); - if (IS_VENDOR_UMC_A_CUT(rtlhal->version) && - !IS_92C_SERIAL(rtlhal->version)) { - rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G1, MASKDWORD, 0x30255); - rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G2, MASKDWORD, 0x50a00); - } else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) { - rtl_set_rfreg(hw, RF90_PATH_A, 0x0C, MASKDWORD, 0x894AE); - rtl_set_rfreg(hw, RF90_PATH_A, 0x0A, MASKDWORD, 0x1AF31); - rtl_set_rfreg(hw, RF90_PATH_A, RF_IPA, MASKDWORD, 0x8F425); - rtl_set_rfreg(hw, RF90_PATH_A, RF_SYN_G2, MASKDWORD, 0x4F200); - rtl_set_rfreg(hw, RF90_PATH_A, RF_RCK1, MASKDWORD, 0x44053); - rtl_set_rfreg(hw, RF90_PATH_A, RF_RCK2, MASKDWORD, 0x80201); - } - rtlphy->rfreg_chnlval[0] = rtl_get_rfreg(hw, (enum radio_path)0, - RF_CHNLBW, RFREG_OFFSET_MASK); - rtlphy->rfreg_chnlval[1] = rtl_get_rfreg(hw, (enum radio_path)1, - RF_CHNLBW, RFREG_OFFSET_MASK); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BCCKEN, 0x1); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BOFDMEN, 0x1); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 1); - _rtl92ce_hw_configure(hw); - rtl_cam_reset_all_entry(hw); - rtl92ce_enable_hw_security_config(hw); - - ppsc->rfpwr_state = ERFON; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, mac->mac_addr); - _rtl92ce_enable_aspm_back_door(hw); - rtlpriv->intf_ops->enable_aspm(hw); - - rtl8192ce_bt_hw_init(hw); - - if (ppsc->rfpwr_state == ERFON) { - rtl92c_phy_set_rfpath_switch(hw, 1); - if (rtlphy->iqk_initialized) { - rtl92c_phy_iq_calibrate(hw, true); - } else { - rtl92c_phy_iq_calibrate(hw, false); - rtlphy->iqk_initialized = true; - } - - rtl92c_dm_check_txpower_tracking(hw); - rtl92c_phy_lc_calibrate(hw); - } - - is92c = IS_92C_SERIAL(rtlhal->version); - tmp_u1b = efuse_read_1byte(hw, 0x1FA); - if (!(tmp_u1b & BIT(0))) { - rtl_set_rfreg(hw, RF90_PATH_A, 0x15, 0x0F, 0x05); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "PA BIAS path A\n"); - } - - if (!(tmp_u1b & BIT(1)) && is92c) { - rtl_set_rfreg(hw, RF90_PATH_B, 0x15, 0x0F, 0x05); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "PA BIAS path B\n"); - } - - if (!(tmp_u1b & BIT(4))) { - tmp_u1b = rtl_read_byte(rtlpriv, 0x16); - tmp_u1b &= 0x0F; - rtl_write_byte(rtlpriv, 0x16, tmp_u1b | 0x80); - udelay(10); - rtl_write_byte(rtlpriv, 0x16, tmp_u1b | 0x90); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "under 1.5V\n"); - } - rtl92c_dm_init(hw); - rtlpci->being_init_adapter = false; - return err; -} - -static enum version_8192c _rtl92ce_read_chip_version(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - enum version_8192c version = VERSION_UNKNOWN; - u32 value32; - const char *versionid; - - value32 = rtl_read_dword(rtlpriv, REG_SYS_CFG); - if (value32 & TRP_VAUX_EN) { - version = (value32 & TYPE_ID) ? VERSION_A_CHIP_92C : - VERSION_A_CHIP_88C; - } else { - version = (enum version_8192c) (CHIP_VER_B | - ((value32 & TYPE_ID) ? CHIP_92C_BITMASK : 0) | - ((value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : 0)); - if ((!IS_CHIP_VENDOR_UMC(version)) && (value32 & - CHIP_VER_RTL_MASK)) { - version = (enum version_8192c)(version | - ((((value32 & CHIP_VER_RTL_MASK) == BIT(12)) - ? CHIP_VENDOR_UMC_B_CUT : CHIP_UNKNOWN) | - CHIP_VENDOR_UMC)); - } - if (IS_92C_SERIAL(version)) { - value32 = rtl_read_dword(rtlpriv, REG_HPON_FSM); - version = (enum version_8192c)(version | - ((CHIP_BONDING_IDENTIFIER(value32) - == CHIP_BONDING_92C_1T2R) ? - RF_TYPE_1T2R : 0)); - } - } - - switch (version) { - case VERSION_B_CHIP_92C: - versionid = "B_CHIP_92C"; - break; - case VERSION_B_CHIP_88C: - versionid = "B_CHIP_88C"; - break; - case VERSION_A_CHIP_92C: - versionid = "A_CHIP_92C"; - break; - case VERSION_A_CHIP_88C: - versionid = "A_CHIP_88C"; - break; - case VERSION_NORMAL_UMC_CHIP_92C_1T2R_A_CUT: - versionid = "A_CUT_92C_1T2R"; - break; - case VERSION_NORMAL_UMC_CHIP_92C_A_CUT: - versionid = "A_CUT_92C"; - break; - case VERSION_NORMAL_UMC_CHIP_88C_A_CUT: - versionid = "A_CUT_88C"; - break; - case VERSION_NORMAL_UMC_CHIP_92C_1T2R_B_CUT: - versionid = "B_CUT_92C_1T2R"; - break; - case VERSION_NORMAL_UMC_CHIP_92C_B_CUT: - versionid = "B_CUT_92C"; - break; - case VERSION_NORMAL_UMC_CHIP_88C_B_CUT: - versionid = "B_CUT_88C"; - break; - default: - versionid = "Unknown. Bug?"; - break; - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, - "Chip Version ID: %s\n", versionid); - - switch (version & 0x3) { - case CHIP_88C: - rtlphy->rf_type = RF_1T1R; - break; - case CHIP_92C: - rtlphy->rf_type = RF_2T2R; - break; - case CHIP_92C_1T2R: - rtlphy->rf_type = RF_1T2R; - break; - default: - rtlphy->rf_type = RF_1T1R; - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "ERROR RF_Type is set!!\n"); - break; - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Chip RF Type: %s\n", - rtlphy->rf_type == RF_2T2R ? "RF_2T2R" : "RF_1T1R"); - - return version; -} - -static int _rtl92ce_set_media_status(struct ieee80211_hw *hw, - enum nl80211_iftype type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 bt_msr = rtl_read_byte(rtlpriv, MSR); - enum led_ctl_mode ledaction = LED_CTL_NO_LINK; - bt_msr &= 0xfc; - - if (type == NL80211_IFTYPE_UNSPECIFIED || - type == NL80211_IFTYPE_STATION) { - _rtl92ce_stop_tx_beacon(hw); - _rtl92ce_enable_bcn_sub_func(hw); - } else if (type == NL80211_IFTYPE_ADHOC || type == NL80211_IFTYPE_AP || - type == NL80211_IFTYPE_MESH_POINT) { - _rtl92ce_resume_tx_beacon(hw); - _rtl92ce_disable_bcn_sub_func(hw); - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Set HW_VAR_MEDIA_STATUS: No such media status(%x)\n", - type); - } - - switch (type) { - case NL80211_IFTYPE_UNSPECIFIED: - bt_msr |= MSR_NOLINK; - ledaction = LED_CTL_LINK; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to NO LINK!\n"); - break; - case NL80211_IFTYPE_ADHOC: - bt_msr |= MSR_ADHOC; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to Ad Hoc!\n"); - break; - case NL80211_IFTYPE_STATION: - bt_msr |= MSR_INFRA; - ledaction = LED_CTL_LINK; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to STA!\n"); - break; - case NL80211_IFTYPE_AP: - bt_msr |= MSR_AP; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to AP!\n"); - break; - case NL80211_IFTYPE_MESH_POINT: - bt_msr |= MSR_ADHOC; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to Mesh Point!\n"); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Network type %d not supported!\n", type); - return 1; - break; - - } - - rtl_write_byte(rtlpriv, (MSR), bt_msr); - rtlpriv->cfg->ops->led_control(hw, ledaction); - if ((bt_msr & 0xfc) == MSR_AP) - rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); - else - rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); - return 0; -} - -void rtl92ce_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR); - - if (rtlpriv->psc.rfpwr_state != ERFON) - return; - - if (check_bssid) { - reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, - (u8 *) (®_rcr)); - _rtl92ce_set_bcn_ctrl_reg(hw, 0, BIT(4)); - } else if (!check_bssid) { - reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); - _rtl92ce_set_bcn_ctrl_reg(hw, BIT(4), 0); - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_RCR, (u8 *) (®_rcr)); - } - -} - -int rtl92ce_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (_rtl92ce_set_media_status(hw, type)) - return -EOPNOTSUPP; - - if (rtlpriv->mac80211.link_state == MAC80211_LINKED) { - if (type != NL80211_IFTYPE_AP && - type != NL80211_IFTYPE_MESH_POINT) - rtl92ce_set_check_bssid(hw, true); - } else { - rtl92ce_set_check_bssid(hw, false); - } - - return 0; -} - -/* don't set REG_EDCA_BE_PARAM here because mac80211 will send pkt when scan */ -void rtl92ce_set_qos(struct ieee80211_hw *hw, int aci) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - rtl92c_dm_init_edca_turbo(hw); - switch (aci) { - case AC1_BK: - rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM, 0xa44f); - break; - case AC0_BE: - /* rtl_write_dword(rtlpriv, REG_EDCA_BE_PARAM, u4b_ac_param); */ - break; - case AC2_VI: - rtl_write_dword(rtlpriv, REG_EDCA_VI_PARAM, 0x5e4322); - break; - case AC3_VO: - rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, 0x2f3222); - break; - default: - RT_ASSERT(false, "invalid aci: %d !\n", aci); - break; - } -} - -void rtl92ce_enable_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF); - rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF); -} - -void rtl92ce_disable_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - rtl_write_dword(rtlpriv, REG_HIMR, IMR8190_DISABLED); - rtl_write_dword(rtlpriv, REG_HIMRE, IMR8190_DISABLED); - synchronize_irq(rtlpci->pdev->irq); -} - -static void _rtl92ce_poweroff_adapter(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - u8 u1b_tmp; - u32 u4b_tmp; - - rtlpriv->intf_ops->enable_aspm(hw); - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF); - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, RFREG_OFFSET_MASK, 0x00); - rtl_write_byte(rtlpriv, REG_RF_CTRL, 0x00); - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE0); - if (rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(7)) - rtl92c_firmware_selfreset(hw); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, 0x51); - rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x00); - rtl_write_dword(rtlpriv, REG_GPIO_PIN_CTRL, 0x00000000); - u1b_tmp = rtl_read_byte(rtlpriv, REG_GPIO_PIN_CTRL); - if ((rtlpcipriv->bt_coexist.bt_coexistence) && - ((rtlpcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC4) || - (rtlpcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC8))) { - rtl_write_dword(rtlpriv, REG_GPIO_PIN_CTRL, 0x00F30000 | - (u1b_tmp << 8)); - } else { - rtl_write_dword(rtlpriv, REG_GPIO_PIN_CTRL, 0x00FF0000 | - (u1b_tmp << 8)); - } - rtl_write_word(rtlpriv, REG_GPIO_IO_SEL, 0x0790); - rtl_write_word(rtlpriv, REG_LEDCFG0, 0x8080); - rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL, 0x80); - if (!IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x23); - if (rtlpcipriv->bt_coexist.bt_coexistence) { - u4b_tmp = rtl_read_dword(rtlpriv, REG_AFE_XTAL_CTRL); - u4b_tmp |= 0x03824800; - rtl_write_dword(rtlpriv, REG_AFE_XTAL_CTRL, u4b_tmp); - } else { - rtl_write_dword(rtlpriv, REG_AFE_XTAL_CTRL, 0x0e); - } - - rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x0e); - rtl_write_byte(rtlpriv, REG_APS_FSMCO + 1, 0x10); -} - -void rtl92ce_card_disable(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - enum nl80211_iftype opmode; - - mac->link_state = MAC80211_NOLINK; - opmode = NL80211_IFTYPE_UNSPECIFIED; - _rtl92ce_set_media_status(hw, opmode); - if (rtlpci->driver_is_goingto_unload || - ppsc->rfoff_reason > RF_CHANGE_BY_PS) - rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF); - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - _rtl92ce_poweroff_adapter(hw); - - /* after power off we should do iqk again */ - rtlpriv->phy.iqk_initialized = false; -} - -void rtl92ce_interrupt_recognized(struct ieee80211_hw *hw, - u32 *p_inta, u32 *p_intb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - *p_inta = rtl_read_dword(rtlpriv, ISR) & rtlpci->irq_mask[0]; - rtl_write_dword(rtlpriv, ISR, *p_inta); - - /* - * *p_intb = rtl_read_dword(rtlpriv, REG_HISRE) & rtlpci->irq_mask[1]; - * rtl_write_dword(rtlpriv, ISR + 4, *p_intb); - */ -} - -void rtl92ce_set_beacon_related_registers(struct ieee80211_hw *hw) -{ - - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 bcn_interval, atim_window; - - bcn_interval = mac->beacon_interval; - atim_window = 2; /*FIX MERGE */ - rtl92ce_disable_interrupt(hw); - rtl_write_word(rtlpriv, REG_ATIMWND, atim_window); - rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); - rtl_write_word(rtlpriv, REG_BCNTCFG, 0x660f); - rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_CCK, 0x18); - rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_OFDM, 0x18); - rtl_write_byte(rtlpriv, 0x606, 0x30); - rtl92ce_enable_interrupt(hw); -} - -void rtl92ce_set_beacon_interval(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 bcn_interval = mac->beacon_interval; - - RT_TRACE(rtlpriv, COMP_BEACON, DBG_DMESG, - "beacon_interval:%d\n", bcn_interval); - rtl92ce_disable_interrupt(hw); - rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); - rtl92ce_enable_interrupt(hw); -} - -void rtl92ce_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, "add_msr:%x, rm_msr:%x\n", - add_msr, rm_msr); - - if (add_msr) - rtlpci->irq_mask[0] |= add_msr; - if (rm_msr) - rtlpci->irq_mask[0] &= (~rm_msr); - rtl92ce_disable_interrupt(hw); - rtl92ce_enable_interrupt(hw); -} - -static void _rtl92ce_read_txpower_info_from_hwpg(struct ieee80211_hw *hw, - bool autoload_fail, - u8 *hwinfo) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 rf_path, index, tempval; - u16 i; - - for (rf_path = 0; rf_path < 2; rf_path++) { - for (i = 0; i < 3; i++) { - if (!autoload_fail) { - rtlefuse-> - eeprom_chnlarea_txpwr_cck[rf_path][i] = - hwinfo[EEPROM_TXPOWERCCK + rf_path * 3 + i]; - rtlefuse-> - eeprom_chnlarea_txpwr_ht40_1s[rf_path][i] = - hwinfo[EEPROM_TXPOWERHT40_1S + rf_path * 3 + - i]; - } else { - rtlefuse-> - eeprom_chnlarea_txpwr_cck[rf_path][i] = - EEPROM_DEFAULT_TXPOWERLEVEL; - rtlefuse-> - eeprom_chnlarea_txpwr_ht40_1s[rf_path][i] = - EEPROM_DEFAULT_TXPOWERLEVEL; - } - } - } - - for (i = 0; i < 3; i++) { - if (!autoload_fail) - tempval = hwinfo[EEPROM_TXPOWERHT40_2SDIFF + i]; - else - tempval = EEPROM_DEFAULT_HT40_2SDIFF; - rtlefuse->eprom_chnl_txpwr_ht40_2sdf[RF90_PATH_A][i] = - (tempval & 0xf); - rtlefuse->eprom_chnl_txpwr_ht40_2sdf[RF90_PATH_B][i] = - ((tempval & 0xf0) >> 4); - } - - for (rf_path = 0; rf_path < 2; rf_path++) - for (i = 0; i < 3; i++) - RTPRINT(rtlpriv, FINIT, INIT_EEPROM, - "RF(%d) EEPROM CCK Area(%d) = 0x%x\n", - rf_path, i, - rtlefuse-> - eeprom_chnlarea_txpwr_cck[rf_path][i]); - for (rf_path = 0; rf_path < 2; rf_path++) - for (i = 0; i < 3; i++) - RTPRINT(rtlpriv, FINIT, INIT_EEPROM, - "RF(%d) EEPROM HT40 1S Area(%d) = 0x%x\n", - rf_path, i, - rtlefuse-> - eeprom_chnlarea_txpwr_ht40_1s[rf_path][i]); - for (rf_path = 0; rf_path < 2; rf_path++) - for (i = 0; i < 3; i++) - RTPRINT(rtlpriv, FINIT, INIT_EEPROM, - "RF(%d) EEPROM HT40 2S Diff Area(%d) = 0x%x\n", - rf_path, i, - rtlefuse-> - eprom_chnl_txpwr_ht40_2sdf[rf_path][i]); - - for (rf_path = 0; rf_path < 2; rf_path++) { - for (i = 0; i < 14; i++) { - index = _rtl92c_get_chnl_group((u8) i); - - rtlefuse->txpwrlevel_cck[rf_path][i] = - rtlefuse->eeprom_chnlarea_txpwr_cck[rf_path][index]; - rtlefuse->txpwrlevel_ht40_1s[rf_path][i] = - rtlefuse-> - eeprom_chnlarea_txpwr_ht40_1s[rf_path][index]; - - if ((rtlefuse-> - eeprom_chnlarea_txpwr_ht40_1s[rf_path][index] - - rtlefuse-> - eprom_chnl_txpwr_ht40_2sdf[rf_path][index]) - > 0) { - rtlefuse->txpwrlevel_ht40_2s[rf_path][i] = - rtlefuse-> - eeprom_chnlarea_txpwr_ht40_1s[rf_path] - [index] - - rtlefuse-> - eprom_chnl_txpwr_ht40_2sdf[rf_path] - [index]; - } else { - rtlefuse->txpwrlevel_ht40_2s[rf_path][i] = 0; - } - } - - for (i = 0; i < 14; i++) { - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF(%d)-Ch(%d) [CCK / HT40_1S / HT40_2S] = [0x%x / 0x%x / 0x%x]\n", - rf_path, i, - rtlefuse->txpwrlevel_cck[rf_path][i], - rtlefuse->txpwrlevel_ht40_1s[rf_path][i], - rtlefuse->txpwrlevel_ht40_2s[rf_path][i]); - } - } - - for (i = 0; i < 3; i++) { - if (!autoload_fail) { - rtlefuse->eeprom_pwrlimit_ht40[i] = - hwinfo[EEPROM_TXPWR_GROUP + i]; - rtlefuse->eeprom_pwrlimit_ht20[i] = - hwinfo[EEPROM_TXPWR_GROUP + 3 + i]; - } else { - rtlefuse->eeprom_pwrlimit_ht40[i] = 0; - rtlefuse->eeprom_pwrlimit_ht20[i] = 0; - } - } - - for (rf_path = 0; rf_path < 2; rf_path++) { - for (i = 0; i < 14; i++) { - index = _rtl92c_get_chnl_group((u8) i); - - if (rf_path == RF90_PATH_A) { - rtlefuse->pwrgroup_ht20[rf_path][i] = - (rtlefuse->eeprom_pwrlimit_ht20[index] - & 0xf); - rtlefuse->pwrgroup_ht40[rf_path][i] = - (rtlefuse->eeprom_pwrlimit_ht40[index] - & 0xf); - } else if (rf_path == RF90_PATH_B) { - rtlefuse->pwrgroup_ht20[rf_path][i] = - ((rtlefuse->eeprom_pwrlimit_ht20[index] - & 0xf0) >> 4); - rtlefuse->pwrgroup_ht40[rf_path][i] = - ((rtlefuse->eeprom_pwrlimit_ht40[index] - & 0xf0) >> 4); - } - - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-%d pwrgroup_ht20[%d] = 0x%x\n", - rf_path, i, - rtlefuse->pwrgroup_ht20[rf_path][i]); - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-%d pwrgroup_ht40[%d] = 0x%x\n", - rf_path, i, - rtlefuse->pwrgroup_ht40[rf_path][i]); - } - } - - for (i = 0; i < 14; i++) { - index = _rtl92c_get_chnl_group((u8) i); - - if (!autoload_fail) - tempval = hwinfo[EEPROM_TXPOWERHT20DIFF + index]; - else - tempval = EEPROM_DEFAULT_HT20_DIFF; - - rtlefuse->txpwr_ht20diff[RF90_PATH_A][i] = (tempval & 0xF); - rtlefuse->txpwr_ht20diff[RF90_PATH_B][i] = - ((tempval >> 4) & 0xF); - - if (rtlefuse->txpwr_ht20diff[RF90_PATH_A][i] & BIT(3)) - rtlefuse->txpwr_ht20diff[RF90_PATH_A][i] |= 0xF0; - - if (rtlefuse->txpwr_ht20diff[RF90_PATH_B][i] & BIT(3)) - rtlefuse->txpwr_ht20diff[RF90_PATH_B][i] |= 0xF0; - - index = _rtl92c_get_chnl_group((u8) i); - - if (!autoload_fail) - tempval = hwinfo[EEPROM_TXPOWER_OFDMDIFF + index]; - else - tempval = EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF; - - rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][i] = (tempval & 0xF); - rtlefuse->txpwr_legacyhtdiff[RF90_PATH_B][i] = - ((tempval >> 4) & 0xF); - } - - rtlefuse->legacy_ht_txpowerdiff = - rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][7]; - - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-A Ht20 to HT40 Diff[%d] = 0x%x\n", - i, rtlefuse->txpwr_ht20diff[RF90_PATH_A][i]); - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-A Legacy to Ht40 Diff[%d] = 0x%x\n", - i, rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][i]); - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-B Ht20 to HT40 Diff[%d] = 0x%x\n", - i, rtlefuse->txpwr_ht20diff[RF90_PATH_B][i]); - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-B Legacy to HT40 Diff[%d] = 0x%x\n", - i, rtlefuse->txpwr_legacyhtdiff[RF90_PATH_B][i]); - - if (!autoload_fail) - rtlefuse->eeprom_regulatory = (hwinfo[RF_OPTION1] & 0x7); - else - rtlefuse->eeprom_regulatory = 0; - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory); - - if (!autoload_fail) { - rtlefuse->eeprom_tssi[RF90_PATH_A] = hwinfo[EEPROM_TSSI_A]; - rtlefuse->eeprom_tssi[RF90_PATH_B] = hwinfo[EEPROM_TSSI_B]; - } else { - rtlefuse->eeprom_tssi[RF90_PATH_A] = EEPROM_DEFAULT_TSSI; - rtlefuse->eeprom_tssi[RF90_PATH_B] = EEPROM_DEFAULT_TSSI; - } - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, "TSSI_A = 0x%x, TSSI_B = 0x%x\n", - rtlefuse->eeprom_tssi[RF90_PATH_A], - rtlefuse->eeprom_tssi[RF90_PATH_B]); - - if (!autoload_fail) - tempval = hwinfo[EEPROM_THERMAL_METER]; - else - tempval = EEPROM_DEFAULT_THERMALMETER; - rtlefuse->eeprom_thermalmeter = (tempval & 0x1f); - - if (rtlefuse->eeprom_thermalmeter == 0x1f || autoload_fail) - rtlefuse->apk_thermalmeterignore = true; - - rtlefuse->thermalmeter[0] = rtlefuse->eeprom_thermalmeter; - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "thermalmeter = 0x%x\n", rtlefuse->eeprom_thermalmeter); -} - -static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE]; - u16 eeprom_id; - - if (rtlefuse->epromtype == EEPROM_BOOT_EFUSE) { - rtl_efuse_shadow_map_update(hw); - - memcpy((void *)hwinfo, - (void *)&rtlefuse->efuse_map[EFUSE_INIT_MAP][0], - HWSET_MAX_SIZE); - } else if (rtlefuse->epromtype == EEPROM_93C46) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "RTL819X Not boot from eeprom, check it !!"); - } - - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP", - hwinfo, HWSET_MAX_SIZE); - - eeprom_id = *((u16 *)&hwinfo[0]); - if (eeprom_id != RTL8190_EEPROM_ID) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "EEPROM ID(%#x) is invalid!!\n", eeprom_id); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - } - - if (rtlefuse->autoload_failflag) - return; - - rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID]; - rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID]; - rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID]; - rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROMId = 0x%4x\n", eeprom_id); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); - - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; - *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue; - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "%pM\n", rtlefuse->dev_addr); - - _rtl92ce_read_txpower_info_from_hwpg(hw, - rtlefuse->autoload_failflag, - hwinfo); - - rtl8192ce_read_bt_coexist_info_from_hwpg(hw, - rtlefuse->autoload_failflag, - hwinfo); - - rtlefuse->eeprom_channelplan = *&hwinfo[EEPROM_CHANNELPLAN]; - rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION]; - rtlefuse->txpwr_fromeprom = true; - rtlefuse->eeprom_oemid = *&hwinfo[EEPROM_CUSTOMER_ID]; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); - - /* set channel paln to world wide 13 */ - rtlefuse->channel_plan = COUNTRY_CODE_WORLD_WIDE_13; - - if (rtlhal->oem_id == RT_CID_DEFAULT) { - switch (rtlefuse->eeprom_oemid) { - case EEPROM_CID_DEFAULT: - if (rtlefuse->eeprom_did == 0x8176) { - if ((rtlefuse->eeprom_svid == 0x103C && - rtlefuse->eeprom_smid == 0x1629)) - rtlhal->oem_id = RT_CID_819x_HP; - else - rtlhal->oem_id = RT_CID_DEFAULT; - } else { - rtlhal->oem_id = RT_CID_DEFAULT; - } - break; - case EEPROM_CID_TOSHIBA: - rtlhal->oem_id = RT_CID_TOSHIBA; - break; - case EEPROM_CID_QMI: - rtlhal->oem_id = RT_CID_819x_QMI; - break; - case EEPROM_CID_WHQL: - default: - rtlhal->oem_id = RT_CID_DEFAULT; - break; - - } - } - -} - -static void _rtl92ce_hal_customized_behavior(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - switch (rtlhal->oem_id) { - case RT_CID_819x_HP: - pcipriv->ledctl.led_opendrain = true; - break; - case RT_CID_819x_Lenovo: - case RT_CID_DEFAULT: - case RT_CID_TOSHIBA: - case RT_CID_CCX: - case RT_CID_819x_Acer: - case RT_CID_WHQL: - default: - break; - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "RT Customized ID: 0x%02X\n", rtlhal->oem_id); -} - -void rtl92ce_read_eeprom_info(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 tmp_u1b; - - rtlhal->version = _rtl92ce_read_chip_version(hw); - if (get_rf_type(rtlphy) == RF_1T1R) - rtlpriv->dm.rfpath_rxenable[0] = true; - else - rtlpriv->dm.rfpath_rxenable[0] = - rtlpriv->dm.rfpath_rxenable[1] = true; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "VersionID = 0x%4x\n", - rtlhal->version); - tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR); - if (tmp_u1b & BIT(4)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EEPROM\n"); - rtlefuse->epromtype = EEPROM_93C46; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EFUSE\n"); - rtlefuse->epromtype = EEPROM_BOOT_EFUSE; - } - if (tmp_u1b & BIT(5)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - _rtl92ce_read_adapter_info(hw); - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Autoload ERR!!\n"); - } - _rtl92ce_hal_customized_behavior(hw); -} - -static void rtl92ce_update_hal_rate_table(struct ieee80211_hw *hw, - struct ieee80211_sta *sta) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u32 ratr_value; - u8 ratr_index = 0; - u8 nmode = mac->ht_enable; - u8 mimo_ps = IEEE80211_SMPS_OFF; - u16 shortgi_rate; - u32 tmp_ratr_value; - u8 curtxbw_40mhz = mac->bw_40; - u8 curshortgi_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? - 1 : 0; - u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? - 1 : 0; - enum wireless_mode wirelessmode = mac->mode; - - if (rtlhal->current_bandtype == BAND_ON_5G) - ratr_value = sta->supp_rates[1] << 4; - else - ratr_value = sta->supp_rates[0]; - if (mac->opmode == NL80211_IFTYPE_ADHOC) - ratr_value = 0xfff; - - ratr_value |= (sta->ht_cap.mcs.rx_mask[1] << 20 | - sta->ht_cap.mcs.rx_mask[0] << 12); - switch (wirelessmode) { - case WIRELESS_MODE_B: - if (ratr_value & 0x0000000c) - ratr_value &= 0x0000000d; - else - ratr_value &= 0x0000000f; - break; - case WIRELESS_MODE_G: - ratr_value &= 0x00000FF5; - break; - case WIRELESS_MODE_N_24G: - case WIRELESS_MODE_N_5G: - nmode = 1; - if (mimo_ps == IEEE80211_SMPS_STATIC) { - ratr_value &= 0x0007F005; - } else { - u32 ratr_mask; - - if (get_rf_type(rtlphy) == RF_1T2R || - get_rf_type(rtlphy) == RF_1T1R) - ratr_mask = 0x000ff005; - else - ratr_mask = 0x0f0ff005; - - ratr_value &= ratr_mask; - } - break; - default: - if (rtlphy->rf_type == RF_1T2R) - ratr_value &= 0x000ff0ff; - else - ratr_value &= 0x0f0ff0ff; - - break; - } - - if ((rtlpcipriv->bt_coexist.bt_coexistence) && - (rtlpcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC4) && - (rtlpcipriv->bt_coexist.bt_cur_state) && - (rtlpcipriv->bt_coexist.bt_ant_isolation) && - ((rtlpcipriv->bt_coexist.bt_service == BT_SCO) || - (rtlpcipriv->bt_coexist.bt_service == BT_BUSY))) - ratr_value &= 0x0fffcfc0; - else - ratr_value &= 0x0FFFFFFF; - - if (nmode && ((curtxbw_40mhz && - curshortgi_40mhz) || (!curtxbw_40mhz && - curshortgi_20mhz))) { - - ratr_value |= 0x10000000; - tmp_ratr_value = (ratr_value >> 12); - - for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) { - if ((1 << shortgi_rate) & tmp_ratr_value) - break; - } - - shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) | - (shortgi_rate << 4) | (shortgi_rate); - } - - rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); - - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n", - rtl_read_dword(rtlpriv, REG_ARFR0)); -} - -static void rtl92ce_update_hal_rate_mask(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_sta_info *sta_entry = NULL; - u32 ratr_bitmap; - u8 ratr_index; - u8 curtxbw_40mhz = (sta->bandwidth >= IEEE80211_STA_RX_BW_40) ? 1 : 0; - u8 curshortgi_40mhz = curtxbw_40mhz && - (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? - 1 : 0; - u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? - 1 : 0; - enum wireless_mode wirelessmode = 0; - bool shortgi = false; - u8 rate_mask[5]; - u8 macid = 0; - u8 mimo_ps = IEEE80211_SMPS_OFF; - - sta_entry = (struct rtl_sta_info *) sta->drv_priv; - wirelessmode = sta_entry->wireless_mode; - if (mac->opmode == NL80211_IFTYPE_STATION || - mac->opmode == NL80211_IFTYPE_MESH_POINT) - curtxbw_40mhz = mac->bw_40; - else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) - macid = sta->aid + 1; - - if (rtlhal->current_bandtype == BAND_ON_5G) - ratr_bitmap = sta->supp_rates[1] << 4; - else - ratr_bitmap = sta->supp_rates[0]; - if (mac->opmode == NL80211_IFTYPE_ADHOC) - ratr_bitmap = 0xfff; - ratr_bitmap |= (sta->ht_cap.mcs.rx_mask[1] << 20 | - sta->ht_cap.mcs.rx_mask[0] << 12); - switch (wirelessmode) { - case WIRELESS_MODE_B: - ratr_index = RATR_INX_WIRELESS_B; - if (ratr_bitmap & 0x0000000c) - ratr_bitmap &= 0x0000000d; - else - ratr_bitmap &= 0x0000000f; - break; - case WIRELESS_MODE_G: - ratr_index = RATR_INX_WIRELESS_GB; - - if (rssi_level == 1) - ratr_bitmap &= 0x00000f00; - else if (rssi_level == 2) - ratr_bitmap &= 0x00000ff0; - else - ratr_bitmap &= 0x00000ff5; - break; - case WIRELESS_MODE_A: - ratr_index = RATR_INX_WIRELESS_A; - ratr_bitmap &= 0x00000ff0; - break; - case WIRELESS_MODE_N_24G: - case WIRELESS_MODE_N_5G: - ratr_index = RATR_INX_WIRELESS_NGB; - - if (mimo_ps == IEEE80211_SMPS_STATIC) { - if (rssi_level == 1) - ratr_bitmap &= 0x00070000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0007f000; - else - ratr_bitmap &= 0x0007f005; - } else { - if (rtlphy->rf_type == RF_1T2R || - rtlphy->rf_type == RF_1T1R) { - if (curtxbw_40mhz) { - if (rssi_level == 1) - ratr_bitmap &= 0x000f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x000ff000; - else - ratr_bitmap &= 0x000ff015; - } else { - if (rssi_level == 1) - ratr_bitmap &= 0x000f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x000ff000; - else - ratr_bitmap &= 0x000ff005; - } - } else { - if (curtxbw_40mhz) { - if (rssi_level == 1) - ratr_bitmap &= 0x0f0f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0f0ff000; - else - ratr_bitmap &= 0x0f0ff015; - } else { - if (rssi_level == 1) - ratr_bitmap &= 0x0f0f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0f0ff000; - else - ratr_bitmap &= 0x0f0ff005; - } - } - } - - if ((curtxbw_40mhz && curshortgi_40mhz) || - (!curtxbw_40mhz && curshortgi_20mhz)) { - - if (macid == 0) - shortgi = true; - else if (macid == 1) - shortgi = false; - } - break; - default: - ratr_index = RATR_INX_WIRELESS_NGB; - - if (rtlphy->rf_type == RF_1T2R) - ratr_bitmap &= 0x000ff0ff; - else - ratr_bitmap &= 0x0f0ff0ff; - break; - } - sta_entry->ratr_index = ratr_index; - - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, - "ratr_bitmap :%x\n", ratr_bitmap); - *(u32 *)&rate_mask = (ratr_bitmap & 0x0fffffff) | - (ratr_index << 28); - rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80; - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, - "Rate_index:%x, ratr_val:%x, %5phC\n", - ratr_index, ratr_bitmap, rate_mask); - rtl92c_fill_h2c_cmd(hw, H2C_RA_MASK, 5, rate_mask); - - if (macid != 0) - sta_entry->ratr_index = ratr_index; -} - -void rtl92ce_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->dm.useramask) - rtl92ce_update_hal_rate_mask(hw, sta, rssi_level); - else - rtl92ce_update_hal_rate_table(hw, sta); -} - -void rtl92ce_update_channel_access_setting(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 sifs_timer; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME, - &mac->slot_time); - if (!mac->ht_enable) - sifs_timer = 0x0a0a; - else - sifs_timer = 0x1010; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SIFS, (u8 *)&sifs_timer); -} - -bool rtl92ce_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - enum rf_pwrstate e_rfpowerstate_toset; - u8 u1tmp; - bool actuallyset = false; - unsigned long flag; - - if (rtlpci->being_init_adapter) - return false; - - if (ppsc->swrf_processing) - return false; - - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); - if (ppsc->rfchange_inprogress) { - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - return false; - } else { - ppsc->rfchange_inprogress = true; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - } - - rtl_write_byte(rtlpriv, REG_MAC_PINMUX_CFG, rtl_read_byte(rtlpriv, - REG_MAC_PINMUX_CFG)&~(BIT(3))); - - u1tmp = rtl_read_byte(rtlpriv, REG_GPIO_IO_SEL); - e_rfpowerstate_toset = (u1tmp & BIT(3)) ? ERFON : ERFOFF; - - if ((ppsc->hwradiooff) && (e_rfpowerstate_toset == ERFON)) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "GPIOChangeRF - HW Radio ON, RF ON\n"); - - e_rfpowerstate_toset = ERFON; - ppsc->hwradiooff = false; - actuallyset = true; - } else if (!ppsc->hwradiooff && (e_rfpowerstate_toset == ERFOFF)) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "GPIOChangeRF - HW Radio OFF, RF OFF\n"); - - e_rfpowerstate_toset = ERFOFF; - ppsc->hwradiooff = true; - actuallyset = true; - } - - if (actuallyset) { - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); - ppsc->rfchange_inprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - } else { - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); - ppsc->rfchange_inprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - } - - *valid = 1; - return !ppsc->hwradiooff; - -} - -void rtl92ce_set_key(struct ieee80211_hw *hw, u32 key_index, - u8 *p_macaddr, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 *macaddr = p_macaddr; - u32 entry_id = 0; - bool is_pairwise = false; - - static u8 cam_const_addr[4][6] = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} - }; - static u8 cam_const_broad[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - }; - - if (clear_all) { - u8 idx = 0; - u8 cam_offset = 0; - u8 clear_number = 5; - - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "clear_all\n"); - - for (idx = 0; idx < clear_number; idx++) { - rtl_cam_mark_invalid(hw, cam_offset + idx); - rtl_cam_empty_entry(hw, cam_offset + idx); - - if (idx < 5) { - memset(rtlpriv->sec.key_buf[idx], 0, - MAX_KEY_LEN); - rtlpriv->sec.key_len[idx] = 0; - } - } - - } else { - switch (enc_algo) { - case WEP40_ENCRYPTION: - enc_algo = CAM_WEP40; - break; - case WEP104_ENCRYPTION: - enc_algo = CAM_WEP104; - break; - case TKIP_ENCRYPTION: - enc_algo = CAM_TKIP; - break; - case AESCCMP_ENCRYPTION: - enc_algo = CAM_AES; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - enc_algo = CAM_TKIP; - break; - } - - if (is_wepkey || rtlpriv->sec.use_defaultkey) { - macaddr = cam_const_addr[key_index]; - entry_id = key_index; - } else { - if (is_group) { - macaddr = cam_const_broad; - entry_id = key_index; - } else { - if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_MESH_POINT) { - entry_id = rtl_cam_get_free_entry(hw, - p_macaddr); - if (entry_id >= TOTAL_CAM_ENTRY) { - RT_TRACE(rtlpriv, COMP_SEC, - DBG_EMERG, - "Can not find free hw security cam entry\n"); - return; - } - } else { - entry_id = CAM_PAIRWISE_KEY_POSITION; - } - - key_index = PAIRWISE_KEYIDX; - is_pairwise = true; - } - } - - if (rtlpriv->sec.key_len[key_index] == 0) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "delete one entry, entry_id is %d\n", - entry_id); - if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_MESH_POINT) - rtl_cam_del_entry(hw, p_macaddr); - rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); - } else { - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, - "The insert KEY length is %d\n", - rtlpriv->sec.key_len[PAIRWISE_KEYIDX]); - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, - "The insert KEY is %x %x\n", - rtlpriv->sec.key_buf[0][0], - rtlpriv->sec.key_buf[0][1]); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "add one entry\n"); - if (is_pairwise) { - RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_LOUD, - "Pairwise Key content", - rtlpriv->sec.pairwise_key, - rtlpriv->sec. - key_len[PAIRWISE_KEYIDX]); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "set Pairwise key\n"); - - rtl_cam_add_one_entry(hw, macaddr, key_index, - entry_id, enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec. - key_buf[key_index]); - } else { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "set group key\n"); - - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - rtl_cam_add_one_entry(hw, - rtlefuse->dev_addr, - PAIRWISE_KEYIDX, - CAM_PAIRWISE_KEY_POSITION, - enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf - [entry_id]); - } - - rtl_cam_add_one_entry(hw, macaddr, key_index, - entry_id, enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf[entry_id]); - } - - } - } -} - -static void rtl8192ce_bt_var_init(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - rtlpcipriv->bt_coexist.bt_coexistence = - rtlpcipriv->bt_coexist.eeprom_bt_coexist; - rtlpcipriv->bt_coexist.bt_ant_num = - rtlpcipriv->bt_coexist.eeprom_bt_ant_num; - rtlpcipriv->bt_coexist.bt_coexist_type = - rtlpcipriv->bt_coexist.eeprom_bt_type; - - if (rtlpcipriv->bt_coexist.reg_bt_iso == 2) - rtlpcipriv->bt_coexist.bt_ant_isolation = - rtlpcipriv->bt_coexist.eeprom_bt_ant_isol; - else - rtlpcipriv->bt_coexist.bt_ant_isolation = - rtlpcipriv->bt_coexist.reg_bt_iso; - - rtlpcipriv->bt_coexist.bt_radio_shared_type = - rtlpcipriv->bt_coexist.eeprom_bt_radio_shared; - - if (rtlpcipriv->bt_coexist.bt_coexistence) { - - if (rtlpcipriv->bt_coexist.reg_bt_sco == 1) - rtlpcipriv->bt_coexist.bt_service = BT_OTHER_ACTION; - else if (rtlpcipriv->bt_coexist.reg_bt_sco == 2) - rtlpcipriv->bt_coexist.bt_service = BT_SCO; - else if (rtlpcipriv->bt_coexist.reg_bt_sco == 4) - rtlpcipriv->bt_coexist.bt_service = BT_BUSY; - else if (rtlpcipriv->bt_coexist.reg_bt_sco == 5) - rtlpcipriv->bt_coexist.bt_service = BT_OTHERBUSY; - else - rtlpcipriv->bt_coexist.bt_service = BT_IDLE; - - rtlpcipriv->bt_coexist.bt_edca_ul = 0; - rtlpcipriv->bt_coexist.bt_edca_dl = 0; - rtlpcipriv->bt_coexist.bt_rssi_state = 0xff; - } -} - -void rtl8192ce_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, - bool auto_load_fail, u8 *hwinfo) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u8 val; - - if (!auto_load_fail) { - rtlpcipriv->bt_coexist.eeprom_bt_coexist = - ((hwinfo[RF_OPTION1] & 0xe0) >> 5); - val = hwinfo[RF_OPTION4]; - rtlpcipriv->bt_coexist.eeprom_bt_type = ((val & 0xe) >> 1); - rtlpcipriv->bt_coexist.eeprom_bt_ant_num = (val & 0x1); - rtlpcipriv->bt_coexist.eeprom_bt_ant_isol = ((val & 0x10) >> 4); - rtlpcipriv->bt_coexist.eeprom_bt_radio_shared = - ((val & 0x20) >> 5); - } else { - rtlpcipriv->bt_coexist.eeprom_bt_coexist = 0; - rtlpcipriv->bt_coexist.eeprom_bt_type = BT_2WIRE; - rtlpcipriv->bt_coexist.eeprom_bt_ant_num = ANT_X2; - rtlpcipriv->bt_coexist.eeprom_bt_ant_isol = 0; - rtlpcipriv->bt_coexist.eeprom_bt_radio_shared = BT_RADIO_SHARED; - } - - rtl8192ce_bt_var_init(hw); -} - -void rtl8192ce_bt_reg_init(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - /* 0:Low, 1:High, 2:From Efuse. */ - rtlpcipriv->bt_coexist.reg_bt_iso = 2; - /* 0:Idle, 1:None-SCO, 2:SCO, 3:From Counter. */ - rtlpcipriv->bt_coexist.reg_bt_sco = 3; - /* 0:Disable BT control A-MPDU, 1:Enable BT control A-MPDU. */ - rtlpcipriv->bt_coexist.reg_bt_sco = 0; -} - - -void rtl8192ce_bt_hw_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - u8 u1_tmp; - - if (rtlpcipriv->bt_coexist.bt_coexistence && - ((rtlpcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC4) || - rtlpcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC8)) { - - if (rtlpcipriv->bt_coexist.bt_ant_isolation) - rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, 0xa0); - - u1_tmp = rtl_read_byte(rtlpriv, 0x4fd) & - BIT_OFFSET_LEN_MASK_32(0, 1); - u1_tmp = u1_tmp | - ((rtlpcipriv->bt_coexist.bt_ant_isolation == 1) ? - 0 : BIT_OFFSET_LEN_MASK_32(1, 1)) | - ((rtlpcipriv->bt_coexist.bt_service == BT_SCO) ? - 0 : BIT_OFFSET_LEN_MASK_32(2, 1)); - rtl_write_byte(rtlpriv, 0x4fd, u1_tmp); - - rtl_write_dword(rtlpriv, REG_BT_COEX_TABLE+4, 0xaaaa9aaa); - rtl_write_dword(rtlpriv, REG_BT_COEX_TABLE+8, 0xffbd0040); - rtl_write_dword(rtlpriv, REG_BT_COEX_TABLE+0xc, 0x40000010); - - /* Config to 1T1R. */ - if (rtlphy->rf_type == RF_1T1R) { - u1_tmp = rtl_read_byte(rtlpriv, ROFDM0_TRXPATHENABLE); - u1_tmp &= ~(BIT_OFFSET_LEN_MASK_32(1, 1)); - rtl_write_byte(rtlpriv, ROFDM0_TRXPATHENABLE, u1_tmp); - - u1_tmp = rtl_read_byte(rtlpriv, ROFDM1_TRXPATHENABLE); - u1_tmp &= ~(BIT_OFFSET_LEN_MASK_32(1, 1)); - rtl_write_byte(rtlpriv, ROFDM1_TRXPATHENABLE, u1_tmp); - } - } -} - -void rtl92ce_suspend(struct ieee80211_hw *hw) -{ -} - -void rtl92ce_resume(struct ieee80211_hw *hw) -{ -} - -/* Turn on AAP (RCR:bit 0) for promicuous mode. */ -void rtl92ce_allow_all_destaddr(struct ieee80211_hw *hw, - bool allow_all_da, bool write_into_reg) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - if (allow_all_da) {/* Set BIT0 */ - rtlpci->receive_config |= RCR_AAP; - } else {/* Clear BIT0 */ - rtlpci->receive_config &= ~RCR_AAP; - } - - if (write_into_reg) - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); - - RT_TRACE(rtlpriv, COMP_TURBO | COMP_INIT, DBG_LOUD, - "receive_config=0x%08X, write_into_reg=%d\n", - rtlpci->receive_config, write_into_reg); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h deleted file mode 100644 index 2d063b0c7760..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.h +++ /dev/null @@ -1,82 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CE_HW_H__ -#define __RTL92CE_HW_H__ - -static inline u8 _rtl92c_get_chnl_group(u8 chnl) -{ - u8 group; - - if (chnl < 3) - group = 0; - else if (chnl < 9) - group = 1; - else - group = 2; - return group; -} - -void rtl92ce_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); -void rtl92ce_read_eeprom_info(struct ieee80211_hw *hw); -void rtl92ce_interrupt_recognized(struct ieee80211_hw *hw, - u32 *p_inta, u32 *p_intb); -int rtl92ce_hw_init(struct ieee80211_hw *hw); -void rtl92ce_card_disable(struct ieee80211_hw *hw); -void rtl92ce_enable_interrupt(struct ieee80211_hw *hw); -void rtl92ce_disable_interrupt(struct ieee80211_hw *hw); -int rtl92ce_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type); -void rtl92ce_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); -void rtl92ce_set_qos(struct ieee80211_hw *hw, int aci); -void rtl92ce_set_beacon_related_registers(struct ieee80211_hw *hw); -void rtl92ce_set_beacon_interval(struct ieee80211_hw *hw); -void rtl92ce_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr); -void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); -void rtl92ce_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level); -void rtl92ce_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level); -void rtl92ce_update_channel_access_setting(struct ieee80211_hw *hw); -bool rtl92ce_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid); -void rtl92ce_enable_hw_security_config(struct ieee80211_hw *hw); -void rtl92ce_set_key(struct ieee80211_hw *hw, u32 key_index, - u8 *p_macaddr, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all); - -void rtl8192ce_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, - bool autoload_fail, u8 *hwinfo); -void rtl8192ce_bt_reg_init(struct ieee80211_hw *hw); -void rtl8192ce_bt_hw_init(struct ieee80211_hw *hw); -void rtl92ce_suspend(struct ieee80211_hw *hw); -void rtl92ce_resume(struct ieee80211_hw *hw); -void rtl92ce_allow_all_destaddr(struct ieee80211_hw *hw, - bool allow_all_da, bool write_into_reg); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/led.c b/drivers/net/wireless/rtlwifi/rtl8192ce/led.c deleted file mode 100644 index 8283e9b27639..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/led.c +++ /dev/null @@ -1,151 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "reg.h" -#include "led.h" - -static void _rtl92ce_init_led(struct ieee80211_hw *hw, - struct rtl_led *pled, enum rtl_led_pin ledpin) -{ - pled->hw = hw; - pled->ledpin = ledpin; - pled->ledon = false; -} - -void rtl92ce_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - u8 ledcfg; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n", - REG_LEDCFG2, pled->ledpin); - - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); - - switch (pled->ledpin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - rtl_write_byte(rtlpriv, - REG_LEDCFG2, (ledcfg & 0xf0) | BIT(5) | BIT(6)); - break; - case LED_PIN_LED1: - rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg & 0x0f) | BIT(5)); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - pled->ledon = true; -} - -void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - u8 ledcfg; - - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n", - REG_LEDCFG2, pled->ledpin); - - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); - - switch (pled->ledpin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - ledcfg &= 0xf0; - if (pcipriv->ledctl.led_opendrain) - rtl_write_byte(rtlpriv, REG_LEDCFG2, - (ledcfg | BIT(1) | BIT(5) | BIT(6))); - else - rtl_write_byte(rtlpriv, REG_LEDCFG2, - (ledcfg | BIT(3) | BIT(5) | BIT(6))); - break; - case LED_PIN_LED1: - ledcfg &= 0x0f; - rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg | BIT(3))); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - pled->ledon = false; -} - -void rtl92ce_init_sw_leds(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - _rtl92ce_init_led(hw, &(pcipriv->ledctl.sw_led0), LED_PIN_LED0); - _rtl92ce_init_led(hw, &(pcipriv->ledctl.sw_led1), LED_PIN_LED1); -} - -static void _rtl92ce_sw_led_control(struct ieee80211_hw *hw, - enum led_ctl_mode ledaction) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); - switch (ledaction) { - case LED_CTL_POWER_ON: - case LED_CTL_LINK: - case LED_CTL_NO_LINK: - rtl92ce_sw_led_on(hw, pLed0); - break; - case LED_CTL_POWER_OFF: - rtl92ce_sw_led_off(hw, pLed0); - break; - default: - break; - } -} - -void rtl92ce_led_control(struct ieee80211_hw *hw, - enum led_ctl_mode ledaction) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - if ((ppsc->rfoff_reason > RF_CHANGE_BY_PS) && - (ledaction == LED_CTL_TX || - ledaction == LED_CTL_RX || - ledaction == LED_CTL_SITE_SURVEY || - ledaction == LED_CTL_LINK || - ledaction == LED_CTL_NO_LINK || - ledaction == LED_CTL_START_TO_LINK || - ledaction == LED_CTL_POWER_ON)) { - return; - } - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "ledaction %d\n", - ledaction); - _rtl92ce_sw_led_control(hw, ledaction); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/led.h b/drivers/net/wireless/rtlwifi/rtl8192ce/led.h deleted file mode 100644 index c5761066d383..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/led.h +++ /dev/null @@ -1,38 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CE_LED_H__ -#define __RTL92CE_LED_H__ - -void rtl92ce_init_sw_leds(struct ieee80211_hw *hw); -void rtl92ce_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl92ce_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c deleted file mode 100644 index 73262ca3864b..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c +++ /dev/null @@ -1,622 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../ps.h" -#include "reg.h" -#include "def.h" -#include "hw.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" -#include "table.h" - -static bool _rtl92c_phy_config_mac_with_headerfile(struct ieee80211_hw *hw); - -u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, u32 bitmask) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 original_value, readback_value, bitshift; - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n", - regaddr, rfpath, bitmask); - - spin_lock(&rtlpriv->locks.rf_lock); - - if (rtlphy->rf_mode != RF_OP_BY_FW) { - original_value = _rtl92c_phy_rf_serial_read(hw, - rfpath, regaddr); - } else { - original_value = _rtl92c_phy_fw_rf_serial_read(hw, - rfpath, regaddr); - } - - bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); - readback_value = (original_value & bitmask) >> bitshift; - - spin_unlock(&rtlpriv->locks.rf_lock); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n", - regaddr, rfpath, bitmask, original_value); - - return readback_value; -} - -bool rtl92c_phy_mac_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - bool is92c = IS_92C_SERIAL(rtlhal->version); - bool rtstatus = _rtl92c_phy_config_mac_with_headerfile(hw); - - if (is92c) - rtl_write_byte(rtlpriv, 0x14, 0x71); - else - rtl_write_byte(rtlpriv, 0x04CA, 0x0A); - return rtstatus; -} - -bool rtl92c_phy_bb_config(struct ieee80211_hw *hw) -{ - bool rtstatus = true; - struct rtl_priv *rtlpriv = rtl_priv(hw); - u16 regval; - u32 regvaldw; - u8 reg_hwparafile = 1; - - _rtl92c_phy_init_bb_rf_register_definition(hw); - regval = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN); - rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, - regval | BIT(13) | BIT(0) | BIT(1)); - rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL, 0x83); - rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL + 1, 0xdb); - rtl_write_byte(rtlpriv, REG_RF_CTRL, RF_EN | RF_RSTB | RF_SDMRSTB); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, - FEN_PPLL | FEN_PCIEA | FEN_DIO_PCIE | - FEN_BB_GLB_RSTn | FEN_BBRSTB); - rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL + 1, 0x80); - regvaldw = rtl_read_dword(rtlpriv, REG_LEDCFG0); - rtl_write_dword(rtlpriv, REG_LEDCFG0, regvaldw | BIT(23)); - if (reg_hwparafile == 1) - rtstatus = _rtl92c_phy_bb8192c_config_parafile(hw); - return rtstatus; -} - -void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, - u32 regaddr, u32 bitmask, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 original_value, bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", - regaddr, bitmask, data, rfpath); - - spin_lock(&rtlpriv->locks.rf_lock); - - if (rtlphy->rf_mode != RF_OP_BY_FW) { - if (bitmask != RFREG_OFFSET_MASK) { - original_value = _rtl92c_phy_rf_serial_read(hw, - rfpath, - regaddr); - bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); - data = - ((original_value & (~bitmask)) | - (data << bitshift)); - } - - _rtl92c_phy_rf_serial_write(hw, rfpath, regaddr, data); - } else { - if (bitmask != RFREG_OFFSET_MASK) { - original_value = _rtl92c_phy_fw_rf_serial_read(hw, - rfpath, - regaddr); - bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); - data = - ((original_value & (~bitmask)) | - (data << bitshift)); - } - _rtl92c_phy_fw_rf_serial_write(hw, rfpath, regaddr, data); - } - - spin_unlock(&rtlpriv->locks.rf_lock); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", - regaddr, bitmask, data, rfpath); -} - -static bool _rtl92c_phy_config_mac_with_headerfile(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - u32 arraylength; - u32 *ptrarray; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Read Rtl819XMACPHY_Array\n"); - arraylength = MAC_2T_ARRAYLENGTH; - ptrarray = RTL8192CEMAC_2T_ARRAY; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Img:RTL8192CEMAC_2T_ARRAY\n"); - for (i = 0; i < arraylength; i = i + 2) - rtl_write_byte(rtlpriv, ptrarray[i], (u8) ptrarray[i + 1]); - return true; -} - -bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw, - u8 configtype) -{ - int i; - u32 *phy_regarray_table; - u32 *agctab_array_table; - u16 phy_reg_arraylen, agctab_arraylen; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (IS_92C_SERIAL(rtlhal->version)) { - agctab_arraylen = AGCTAB_2TARRAYLENGTH; - agctab_array_table = RTL8192CEAGCTAB_2TARRAY; - phy_reg_arraylen = PHY_REG_2TARRAY_LENGTH; - phy_regarray_table = RTL8192CEPHY_REG_2TARRAY; - } else { - agctab_arraylen = AGCTAB_1TARRAYLENGTH; - agctab_array_table = RTL8192CEAGCTAB_1TARRAY; - phy_reg_arraylen = PHY_REG_1TARRAY_LENGTH; - phy_regarray_table = RTL8192CEPHY_REG_1TARRAY; - } - if (configtype == BASEBAND_CONFIG_PHY_REG) { - for (i = 0; i < phy_reg_arraylen; i = i + 2) { - if (phy_regarray_table[i] == 0xfe) - mdelay(50); - else if (phy_regarray_table[i] == 0xfd) - mdelay(5); - else if (phy_regarray_table[i] == 0xfc) - mdelay(1); - else if (phy_regarray_table[i] == 0xfb) - udelay(50); - else if (phy_regarray_table[i] == 0xfa) - udelay(5); - else if (phy_regarray_table[i] == 0xf9) - udelay(1); - rtl_set_bbreg(hw, phy_regarray_table[i], MASKDWORD, - phy_regarray_table[i + 1]); - udelay(1); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "The phy_regarray_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n", - phy_regarray_table[i], - phy_regarray_table[i + 1]); - } - } else if (configtype == BASEBAND_CONFIG_AGC_TAB) { - for (i = 0; i < agctab_arraylen; i = i + 2) { - rtl_set_bbreg(hw, agctab_array_table[i], MASKDWORD, - agctab_array_table[i + 1]); - udelay(1); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "The agctab_array_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n", - agctab_array_table[i], - agctab_array_table[i + 1]); - } - } - return true; -} - -bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw, - u8 configtype) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int i; - u32 *phy_regarray_table_pg; - u16 phy_regarray_pg_len; - - phy_regarray_pg_len = PHY_REG_ARRAY_PGLENGTH; - phy_regarray_table_pg = RTL8192CEPHY_REG_ARRAY_PG; - - if (configtype == BASEBAND_CONFIG_PHY_REG) { - for (i = 0; i < phy_regarray_pg_len; i = i + 3) { - if (phy_regarray_table_pg[i] == 0xfe) - mdelay(50); - else if (phy_regarray_table_pg[i] == 0xfd) - mdelay(5); - else if (phy_regarray_table_pg[i] == 0xfc) - mdelay(1); - else if (phy_regarray_table_pg[i] == 0xfb) - udelay(50); - else if (phy_regarray_table_pg[i] == 0xfa) - udelay(5); - else if (phy_regarray_table_pg[i] == 0xf9) - udelay(1); - - _rtl92c_store_pwrIndex_diffrate_offset(hw, - phy_regarray_table_pg[i], - phy_regarray_table_pg[i + 1], - phy_regarray_table_pg[i + 2]); - } - } else { - - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "configtype != BaseBand_Config_PHY_REG\n"); - } - return true; -} - -bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, - enum radio_path rfpath) -{ - - int i; - u32 *radioa_array_table; - u32 *radiob_array_table; - u16 radioa_arraylen, radiob_arraylen; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (IS_92C_SERIAL(rtlhal->version)) { - radioa_arraylen = RADIOA_2TARRAYLENGTH; - radioa_array_table = RTL8192CERADIOA_2TARRAY; - radiob_arraylen = RADIOB_2TARRAYLENGTH; - radiob_array_table = RTL8192CE_RADIOB_2TARRAY; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Radio_A:RTL8192CERADIOA_2TARRAY\n"); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Radio_B:RTL8192CE_RADIOB_2TARRAY\n"); - } else { - radioa_arraylen = RADIOA_1TARRAYLENGTH; - radioa_array_table = RTL8192CE_RADIOA_1TARRAY; - radiob_arraylen = RADIOB_1TARRAYLENGTH; - radiob_array_table = RTL8192CE_RADIOB_1TARRAY; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Radio_A:RTL8192CE_RADIOA_1TARRAY\n"); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Radio_B:RTL8192CE_RADIOB_1TARRAY\n"); - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Radio No %x\n", rfpath); - switch (rfpath) { - case RF90_PATH_A: - for (i = 0; i < radioa_arraylen; i = i + 2) { - if (radioa_array_table[i] == 0xfe) - mdelay(50); - else if (radioa_array_table[i] == 0xfd) - mdelay(5); - else if (radioa_array_table[i] == 0xfc) - mdelay(1); - else if (radioa_array_table[i] == 0xfb) - udelay(50); - else if (radioa_array_table[i] == 0xfa) - udelay(5); - else if (radioa_array_table[i] == 0xf9) - udelay(1); - else { - rtl_set_rfreg(hw, rfpath, radioa_array_table[i], - RFREG_OFFSET_MASK, - radioa_array_table[i + 1]); - udelay(1); - } - } - break; - case RF90_PATH_B: - for (i = 0; i < radiob_arraylen; i = i + 2) { - if (radiob_array_table[i] == 0xfe) { - mdelay(50); - } else if (radiob_array_table[i] == 0xfd) - mdelay(5); - else if (radiob_array_table[i] == 0xfc) - mdelay(1); - else if (radiob_array_table[i] == 0xfb) - udelay(50); - else if (radiob_array_table[i] == 0xfa) - udelay(5); - else if (radiob_array_table[i] == 0xf9) - udelay(1); - else { - rtl_set_rfreg(hw, rfpath, radiob_array_table[i], - RFREG_OFFSET_MASK, - radiob_array_table[i + 1]); - udelay(1); - } - } - break; - case RF90_PATH_C: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - case RF90_PATH_D: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - return true; -} - -void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u8 reg_bw_opmode; - u8 reg_prsr_rsc; - - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "Switch to %s bandwidth\n", - rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? - "20MHz" : "40MHz"); - - if (is_hal_stop(rtlhal)) { - rtlphy->set_bwmode_inprogress = false; - return; - } - - reg_bw_opmode = rtl_read_byte(rtlpriv, REG_BWOPMODE); - reg_prsr_rsc = rtl_read_byte(rtlpriv, REG_RRSR + 2); - - switch (rtlphy->current_chan_bw) { - case HT_CHANNEL_WIDTH_20: - reg_bw_opmode |= BW_OPMODE_20MHZ; - rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); - break; - case HT_CHANNEL_WIDTH_20_40: - reg_bw_opmode &= ~BW_OPMODE_20MHZ; - rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); - reg_prsr_rsc = - (reg_prsr_rsc & 0x90) | (mac->cur_40_prime_sc << 5); - rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_prsr_rsc); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", rtlphy->current_chan_bw); - break; - } - - switch (rtlphy->current_chan_bw) { - case HT_CHANNEL_WIDTH_20: - rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x0); - rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x0); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 1); - break; - case HT_CHANNEL_WIDTH_20_40: - rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x1); - rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x1); - - rtl_set_bbreg(hw, RCCK0_SYSTEM, BCCK_SIDEBAND, - (mac->cur_40_prime_sc >> 1)); - rtl_set_bbreg(hw, ROFDM1_LSTF, 0xC00, mac->cur_40_prime_sc); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 0); - - rtl_set_bbreg(hw, 0x818, (BIT(26) | BIT(27)), - (mac->cur_40_prime_sc == - HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", rtlphy->current_chan_bw); - break; - } - rtl92ce_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); - rtlphy->set_bwmode_inprogress = false; - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n"); -} - -void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) -{ - u8 tmpreg; - u32 rf_a_mode = 0, rf_b_mode = 0, lc_cal; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - tmpreg = rtl_read_byte(rtlpriv, 0xd03); - - if ((tmpreg & 0x70) != 0) - rtl_write_byte(rtlpriv, 0xd03, tmpreg & 0x8F); - else - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF); - - if ((tmpreg & 0x70) != 0) { - rf_a_mode = rtl_get_rfreg(hw, RF90_PATH_A, 0x00, MASK12BITS); - - if (is2t) - rf_b_mode = rtl_get_rfreg(hw, RF90_PATH_B, 0x00, - MASK12BITS); - - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, MASK12BITS, - (rf_a_mode & 0x8FFFF) | 0x10000); - - if (is2t) - rtl_set_rfreg(hw, RF90_PATH_B, 0x00, MASK12BITS, - (rf_b_mode & 0x8FFFF) | 0x10000); - } - lc_cal = rtl_get_rfreg(hw, RF90_PATH_A, 0x18, MASK12BITS); - - rtl_set_rfreg(hw, RF90_PATH_A, 0x18, MASK12BITS, lc_cal | 0x08000); - - mdelay(100); - - if ((tmpreg & 0x70) != 0) { - rtl_write_byte(rtlpriv, 0xd03, tmpreg); - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, MASK12BITS, rf_a_mode); - - if (is2t) - rtl_set_rfreg(hw, RF90_PATH_B, 0x00, MASK12BITS, - rf_b_mode); - } else { - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); - } -} - -static void _rtl92ce_phy_set_rf_sleep(struct ieee80211_hw *hw) -{ - u32 u4b_tmp; - u8 delay = 5; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF); - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, RFREG_OFFSET_MASK, 0x00); - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40); - u4b_tmp = rtl_get_rfreg(hw, RF90_PATH_A, 0, RFREG_OFFSET_MASK); - while (u4b_tmp != 0 && delay > 0) { - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x0); - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, RFREG_OFFSET_MASK, 0x00); - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40); - u4b_tmp = rtl_get_rfreg(hw, RF90_PATH_A, 0, RFREG_OFFSET_MASK); - delay--; - } - if (delay == 0) { - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x00); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); - RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, - "Switch RF timeout !!!\n"); - return; - } - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x22); -} - -static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool bresult = true; - u8 i, queue_id; - struct rtl8192_tx_ring *ring = NULL; - - switch (rfpwr_state) { - case ERFON:{ - if ((ppsc->rfpwr_state == ERFOFF) && - RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) { - bool rtstatus; - u32 InitializeCount = 0; - do { - InitializeCount++; - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "IPS Set eRf nic enable\n"); - rtstatus = rtl_ps_enable_nic(hw); - } while (!rtstatus && (InitializeCount < 10)); - RT_CLEAR_PS_LEVEL(ppsc, - RT_RF_OFF_LEVL_HALT_NIC); - } else { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "Set ERFON sleeped:%d ms\n", - jiffies_to_msecs(jiffies - - ppsc-> - last_sleep_jiffies)); - ppsc->last_awake_jiffies = jiffies; - rtl92ce_phy_set_rf_on(hw); - } - if (mac->link_state == MAC80211_LINKED) { - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_LINK); - } else { - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_NO_LINK); - } - break; - } - case ERFOFF:{ - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "IPS Set eRf nic disable\n"); - rtl_ps_disable_nic(hw); - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - } else { - if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) { - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_NO_LINK); - } else { - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_POWER_OFF); - } - } - break; - } - case ERFSLEEP:{ - if (ppsc->rfpwr_state == ERFOFF) - return false; - for (queue_id = 0, i = 0; - queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { - ring = &pcipriv->dev.tx_ring[queue_id]; - if (skb_queue_len(&ring->queue) == 0) { - queue_id++; - continue; - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n", - i + 1, queue_id, - skb_queue_len(&ring->queue)); - - udelay(10); - i++; - } - if (i >= MAX_DOZE_WAITING_TIMES_9x) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n", - MAX_DOZE_WAITING_TIMES_9x, - queue_id, - skb_queue_len(&ring->queue)); - break; - } - } - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "Set ERFSLEEP awaked:%d ms\n", - jiffies_to_msecs(jiffies - - ppsc->last_awake_jiffies)); - ppsc->last_sleep_jiffies = jiffies; - _rtl92ce_phy_set_rf_sleep(hw); - break; - } - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - bresult = false; - break; - } - if (bresult) - ppsc->rfpwr_state = rfpwr_state; - return bresult; -} - -bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state) -{ - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - bool bresult = false; - - if (rfpwr_state == ppsc->rfpwr_state) - return bresult; - bresult = _rtl92ce_phy_set_rf_power_state(hw, rfpwr_state); - return bresult; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h deleted file mode 100644 index d5e3b704f930..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h +++ /dev/null @@ -1,262 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C_PHY_H__ -#define __RTL92C_PHY_H__ - -#define MAX_PRECMD_CNT 16 -#define MAX_RFDEPENDCMD_CNT 16 -#define MAX_POSTCMD_CNT 16 - -#define MAX_DOZE_WAITING_TIMES_9x 64 - -#define RT_CANNOT_IO(hw) false -#define HIGHPOWER_RADIOA_ARRAYLEN 22 - -#define IQK_ADDA_REG_NUM 16 -#define MAX_TOLERANCE 5 -#define IQK_DELAY_TIME 1 - -#define APK_BB_REG_NUM 5 -#define APK_AFE_REG_NUM 16 -#define APK_CURVE_REG_NUM 4 -#define PATH_NUM 2 - -#define LOOP_LIMIT 5 -#define MAX_STALL_TIME 50 -#define AntennaDiversityValue 0x80 -#define MAX_TXPWR_IDX_NMODE_92S 63 -#define Reset_Cnt_Limit 3 - -#define IQK_ADDA_REG_NUM 16 -#define IQK_MAC_REG_NUM 4 - -#define IQK_DELAY_TIME 1 - -#define RF90_PATH_MAX 2 - -#define CT_OFFSET_MAC_ADDR 0X16 - -#define CT_OFFSET_CCK_TX_PWR_IDX 0x5A -#define CT_OFFSET_HT401S_TX_PWR_IDX 0x60 -#define CT_OFFSET_HT402S_TX_PWR_IDX_DIF 0x66 -#define CT_OFFSET_HT20_TX_PWR_IDX_DIFF 0x69 -#define CT_OFFSET_OFDM_TX_PWR_IDX_DIFF 0x6C - -#define CT_OFFSET_HT40_MAX_PWR_OFFSET 0x6F -#define CT_OFFSET_HT20_MAX_PWR_OFFSET 0x72 - -#define CT_OFFSET_CHANNEL_PLAH 0x75 -#define CT_OFFSET_THERMAL_METER 0x78 -#define CT_OFFSET_RF_OPTION 0x79 -#define CT_OFFSET_VERSION 0x7E -#define CT_OFFSET_CUSTOMER_ID 0x7F - -#define RTL92C_MAX_PATH_NUM 2 - -enum swchnlcmd_id { - CMDID_END, - CMDID_SET_TXPOWEROWER_LEVEL, - CMDID_BBREGWRITE10, - CMDID_WRITEPORT_ULONG, - CMDID_WRITEPORT_USHORT, - CMDID_WRITEPORT_UCHAR, - CMDID_RF_WRITEREG, -}; - -struct swchnlcmd { - enum swchnlcmd_id cmdid; - u32 para1; - u32 para2; - u32 msdelay; -}; - -enum hw90_block_e { - HW90_BLOCK_MAC = 0, - HW90_BLOCK_PHY0 = 1, - HW90_BLOCK_PHY1 = 2, - HW90_BLOCK_RF = 3, - HW90_BLOCK_MAXIMUM = 4, -}; - -enum baseband_config_type { - BASEBAND_CONFIG_PHY_REG = 0, - BASEBAND_CONFIG_AGC_TAB = 1, -}; - -enum ra_offset_area { - RA_OFFSET_LEGACY_OFDM1, - RA_OFFSET_LEGACY_OFDM2, - RA_OFFSET_HT_OFDM1, - RA_OFFSET_HT_OFDM2, - RA_OFFSET_HT_OFDM3, - RA_OFFSET_HT_OFDM4, - RA_OFFSET_HT_CCK, -}; - -enum antenna_path { - ANTENNA_NONE, - ANTENNA_D, - ANTENNA_C, - ANTENNA_CD, - ANTENNA_B, - ANTENNA_BD, - ANTENNA_BC, - ANTENNA_BCD, - ANTENNA_A, - ANTENNA_AD, - ANTENNA_AC, - ANTENNA_ACD, - ANTENNA_AB, - ANTENNA_ABD, - ANTENNA_ABC, - ANTENNA_ABCD -}; - -struct r_antenna_select_ofdm { - u32 r_tx_antenna:4; - u32 r_ant_l:4; - u32 r_ant_non_ht:4; - u32 r_ant_ht1:4; - u32 r_ant_ht2:4; - u32 r_ant_ht_s1:4; - u32 r_ant_non_ht_s1:4; - u32 ofdm_txsc:2; - u32 reserved:2; -}; - -struct r_antenna_select_cck { - u8 r_cckrx_enable_2:2; - u8 r_cckrx_enable:2; - u8 r_ccktx_enable:4; -}; - -struct efuse_contents { - u8 mac_addr[ETH_ALEN]; - u8 cck_tx_power_idx[6]; - u8 ht40_1s_tx_power_idx[6]; - u8 ht40_2s_tx_power_idx_diff[3]; - u8 ht20_tx_power_idx_diff[3]; - u8 ofdm_tx_power_idx_diff[3]; - u8 ht40_max_power_offset[3]; - u8 ht20_max_power_offset[3]; - u8 channel_plan; - u8 thermal_meter; - u8 rf_option[5]; - u8 version; - u8 oem_id; - u8 regulatory; -}; - -struct tx_power_struct { - u8 cck[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht40_1s[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht40_2s[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht20_diff[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 legacy_ht_diff[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 legacy_ht_txpowerdiff; - u8 groupht20[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 groupht40[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 pwrgroup_cnt; - u32 mcs_original_offset[4][16]; -}; - -bool rtl92c_phy_bb_config(struct ieee80211_hw *hw); -u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask); -void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, u32 data); -u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, - u32 bitmask); -extern void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, - u32 bitmask, u32 data); -bool rtl92c_phy_mac_config(struct ieee80211_hw *hw); -bool rtl92ce_phy_bb_config(struct ieee80211_hw *hw); -bool rtl92c_phy_rf_config(struct ieee80211_hw *hw); -bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, - enum radio_path rfpath); -void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); -void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, - long *powerlevel); -void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); -bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, - long power_indbm); -void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw, - u8 operation); -void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, - enum nl80211_channel_type ch_type); -void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw); -u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw); -void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); -void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, - u16 beaconinterval); -void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); -void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); -void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t); -void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); -bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, - enum radio_path rfpath); -bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, - u32 rfpath); -bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); -bool rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state); -void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw); -bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); -void rtl92c_phy_set_io(struct ieee80211_hw *hw); -void rtl92c_bb_block_on(struct ieee80211_hw *hw); -u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset); -u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset); -u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask); -void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset, - u32 data); -void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset, - u32 data); -void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, - u32 data); -bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw); -void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw); -bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw); -void _rtl92c_phy_set_rf_sleep(struct ieee80211_hw *hw); -bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state); -bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw, - u8 configtype); -bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw, - u8 configtype); -void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h deleted file mode 100644 index bd4aef74c056..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h +++ /dev/null @@ -1,2092 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C_REG_H__ -#define __RTL92C_REG_H__ - -#define REG_SYS_ISO_CTRL 0x0000 -#define REG_SYS_FUNC_EN 0x0002 -#define REG_APS_FSMCO 0x0004 -#define REG_SYS_CLKR 0x0008 -#define REG_9346CR 0x000A -#define REG_EE_VPD 0x000C -#define REG_AFE_MISC 0x0010 -#define REG_SPS0_CTRL 0x0011 -#define REG_SPS_OCP_CFG 0x0018 -#define REG_RSV_CTRL 0x001C -#define REG_RF_CTRL 0x001F -#define REG_LDOA15_CTRL 0x0020 -#define REG_LDOV12D_CTRL 0x0021 -#define REG_LDOHCI12_CTRL 0x0022 -#define REG_LPLDO_CTRL 0x0023 -#define REG_AFE_XTAL_CTRL 0x0024 -#define REG_AFE_PLL_CTRL 0x0028 -#define REG_EFUSE_CTRL 0x0030 -#define REG_EFUSE_TEST 0x0034 -#define REG_PWR_DATA 0x0038 -#define REG_CAL_TIMER 0x003C -#define REG_ACLK_MON 0x003E -#define REG_GPIO_MUXCFG 0x0040 -#define REG_GPIO_IO_SEL 0x0042 -#define REG_MAC_PINMUX_CFG 0x0043 -#define REG_GPIO_PIN_CTRL 0x0044 -#define REG_GPIO_INTM 0x0048 -#define REG_LEDCFG0 0x004C -#define REG_LEDCFG1 0x004D -#define REG_LEDCFG2 0x004E -#define REG_LEDCFG3 0x004F -#define REG_FSIMR 0x0050 -#define REG_FSISR 0x0054 -#define REG_HSIMR 0x0058 -#define REG_HSISR 0x005c - -/* RTL8723 WIFI/BT/GPS Multi-Function GPIO Pin Control. */ -#define REG_GPIO_PIN_CTRL_2 0x0060 -/* RTL8723 WIFI/BT/GPS Multi-Function GPIO Select. */ -#define REG_GPIO_IO_SEL_2 0x0062 -/* RTL8723 WIFI/BT/GPS Multi-Function control source. */ -#define REG_MULTI_FUNC_CTRL 0x0068 - -#define REG_MCUFWDL 0x0080 - -#define REG_HMEBOX_EXT_0 0x0088 -#define REG_HMEBOX_EXT_1 0x008A -#define REG_HMEBOX_EXT_2 0x008C -#define REG_HMEBOX_EXT_3 0x008E - -#define REG_BIST_SCAN 0x00D0 -#define REG_BIST_RPT 0x00D4 -#define REG_BIST_ROM_RPT 0x00D8 -#define REG_USB_SIE_INTF 0x00E0 -#define REG_PCIE_MIO_INTF 0x00E4 -#define REG_PCIE_MIO_INTD 0x00E8 -#define REG_HPON_FSM 0x00EC -#define REG_SYS_CFG 0x00F0 -#define REG_GPIO_OUTSTS 0x00F4 /* For RTL8723 only.*/ - -#define REG_CR 0x0100 -#define REG_PBP 0x0104 -#define REG_TRXDMA_CTRL 0x010C -#define REG_TRXFF_BNDY 0x0114 -#define REG_TRXFF_STATUS 0x0118 -#define REG_RXFF_PTR 0x011C -#define REG_HIMR 0x0120 -#define REG_HISR 0x0124 -#define REG_HIMRE 0x0128 -#define REG_HISRE 0x012C -#define REG_CPWM 0x012F -#define REG_FWIMR 0x0130 -#define REG_FWISR 0x0134 -#define REG_PKTBUF_DBG_CTRL 0x0140 -#define REG_PKTBUF_DBG_DATA_L 0x0144 -#define REG_PKTBUF_DBG_DATA_H 0x0148 - -#define REG_TC0_CTRL 0x0150 -#define REG_TC1_CTRL 0x0154 -#define REG_TC2_CTRL 0x0158 -#define REG_TC3_CTRL 0x015C -#define REG_TC4_CTRL 0x0160 -#define REG_TCUNIT_BASE 0x0164 -#define REG_MBIST_START 0x0174 -#define REG_MBIST_DONE 0x0178 -#define REG_MBIST_FAIL 0x017C -#define REG_C2HEVT_MSG_NORMAL 0x01A0 -#define REG_C2HEVT_MSG_TEST 0x01B8 -#define REG_C2HEVT_CLEAR 0x01BF -#define REG_MCUTST_1 0x01c0 -#define REG_FMETHR 0x01C8 -#define REG_HMETFR 0x01CC -#define REG_HMEBOX_0 0x01D0 -#define REG_HMEBOX_1 0x01D4 -#define REG_HMEBOX_2 0x01D8 -#define REG_HMEBOX_3 0x01DC - -#define REG_LLT_INIT 0x01E0 -#define REG_BB_ACCEESS_CTRL 0x01E8 -#define REG_BB_ACCESS_DATA 0x01EC - -#define REG_RQPN 0x0200 -#define REG_FIFOPAGE 0x0204 -#define REG_TDECTRL 0x0208 -#define REG_TXDMA_OFFSET_CHK 0x020C -#define REG_TXDMA_STATUS 0x0210 -#define REG_RQPN_NPQ 0x0214 - -#define REG_RXDMA_AGG_PG_TH 0x0280 -#define REG_RXPKT_NUM 0x0284 -#define REG_RXDMA_STATUS 0x0288 - -#define REG_PCIE_CTRL_REG 0x0300 -#define REG_INT_MIG 0x0304 -#define REG_BCNQ_DESA 0x0308 -#define REG_HQ_DESA 0x0310 -#define REG_MGQ_DESA 0x0318 -#define REG_VOQ_DESA 0x0320 -#define REG_VIQ_DESA 0x0328 -#define REG_BEQ_DESA 0x0330 -#define REG_BKQ_DESA 0x0338 -#define REG_RX_DESA 0x0340 -#define REG_DBI 0x0348 -#define REG_MDIO 0x0354 -#define REG_DBG_SEL 0x0360 -#define REG_PCIE_HRPWM 0x0361 -#define REG_PCIE_HCPWM 0x0363 -#define REG_UART_CTRL 0x0364 -#define REG_UART_TX_DESA 0x0370 -#define REG_UART_RX_DESA 0x0378 - -#define REG_HDAQ_DESA_NODEF 0x0000 -#define REG_CMDQ_DESA_NODEF 0x0000 - -#define REG_VOQ_INFORMATION 0x0400 -#define REG_VIQ_INFORMATION 0x0404 -#define REG_BEQ_INFORMATION 0x0408 -#define REG_BKQ_INFORMATION 0x040C -#define REG_MGQ_INFORMATION 0x0410 -#define REG_HGQ_INFORMATION 0x0414 -#define REG_BCNQ_INFORMATION 0x0418 - -#define REG_CPU_MGQ_INFORMATION 0x041C -#define REG_FWHW_TXQ_CTRL 0x0420 -#define REG_HWSEQ_CTRL 0x0423 -#define REG_TXPKTBUF_BCNQ_BDNY 0x0424 -#define REG_TXPKTBUF_MGQ_BDNY 0x0425 -#define REG_MULTI_BCNQ_EN 0x0426 -#define REG_MULTI_BCNQ_OFFSET 0x0427 -#define REG_SPEC_SIFS 0x0428 -#define REG_RL 0x042A -#define REG_DARFRC 0x0430 -#define REG_RARFRC 0x0438 -#define REG_RRSR 0x0440 -#define REG_ARFR0 0x0444 -#define REG_ARFR1 0x0448 -#define REG_ARFR2 0x044C -#define REG_ARFR3 0x0450 -#define REG_AGGLEN_LMT 0x0458 -#define REG_AMPDU_MIN_SPACE 0x045C -#define REG_TXPKTBUF_WMAC_LBK_BF_HD 0x045D -#define REG_FAST_EDCA_CTRL 0x0460 -#define REG_RD_RESP_PKT_TH 0x0463 -#define REG_INIRTS_RATE_SEL 0x0480 -#define REG_INIDATA_RATE_SEL 0x0484 -#define REG_POWER_STATUS 0x04A4 -#define REG_POWER_STAGE1 0x04B4 -#define REG_POWER_STAGE2 0x04B8 -#define REG_PKT_LIFE_TIME 0x04C0 -#define REG_STBC_SETTING 0x04C4 -#define REG_PROT_MODE_CTRL 0x04C8 -#define REG_BAR_MODE_CTRL 0x04CC -#define REG_RA_TRY_RATE_AGG_LMT 0x04CF -#define REG_NQOS_SEQ 0x04DC -#define REG_QOS_SEQ 0x04DE -#define REG_NEED_CPU_HANDLE 0x04E0 -#define REG_PKT_LOSE_RPT 0x04E1 -#define REG_PTCL_ERR_STATUS 0x04E2 -#define REG_DUMMY 0x04FC - -#define REG_EDCA_VO_PARAM 0x0500 -#define REG_EDCA_VI_PARAM 0x0504 -#define REG_EDCA_BE_PARAM 0x0508 -#define REG_EDCA_BK_PARAM 0x050C -#define REG_BCNTCFG 0x0510 -#define REG_PIFS 0x0512 -#define REG_RDG_PIFS 0x0513 -#define REG_SIFS_CTX 0x0514 -#define REG_SIFS_TRX 0x0516 -#define REG_SIFS_CCK 0x0514 -#define REG_SIFS_OFDM 0x0516 -#define REG_AGGR_BREAK_TIME 0x051A -#define REG_SLOT 0x051B -#define REG_TX_PTCL_CTRL 0x0520 -#define REG_TXPAUSE 0x0522 -#define REG_DIS_TXREQ_CLR 0x0523 -#define REG_RD_CTRL 0x0524 -#define REG_TBTT_PROHIBIT 0x0540 -#define REG_RD_NAV_NXT 0x0544 -#define REG_NAV_PROT_LEN 0x0546 -#define REG_BCN_CTRL 0x0550 -#define REG_USTIME_TSF 0x0551 -#define REG_MBID_NUM 0x0552 -#define REG_DUAL_TSF_RST 0x0553 -#define REG_BCN_INTERVAL 0x0554 -#define REG_MBSSID_BCN_SPACE 0x0554 -#define REG_DRVERLYINT 0x0558 -#define REG_BCNDMATIM 0x0559 -#define REG_ATIMWND 0x055A -#define REG_BCN_MAX_ERR 0x055D -#define REG_RXTSF_OFFSET_CCK 0x055E -#define REG_RXTSF_OFFSET_OFDM 0x055F -#define REG_TSFTR 0x0560 -#define REG_INIT_TSFTR 0x0564 -#define REG_PSTIMER 0x0580 -#define REG_TIMER0 0x0584 -#define REG_TIMER1 0x0588 -#define REG_ACMHWCTRL 0x05C0 -#define REG_ACMRSTCTRL 0x05C1 -#define REG_ACMAVG 0x05C2 -#define REG_VO_ADMTIME 0x05C4 -#define REG_VI_ADMTIME 0x05C6 -#define REG_BE_ADMTIME 0x05C8 -#define REG_EDCA_RANDOM_GEN 0x05CC -#define REG_SCH_TXCMD 0x05D0 - -#define REG_APSD_CTRL 0x0600 -#define REG_BWOPMODE 0x0603 -#define REG_TCR 0x0604 -#define REG_RCR 0x0608 -#define REG_RX_PKT_LIMIT 0x060C -#define REG_RX_DLK_TIME 0x060D -#define REG_RX_DRVINFO_SZ 0x060F - -#define REG_MACID 0x0610 -#define REG_BSSID 0x0618 -#define REG_MAR 0x0620 -#define REG_MBIDCAMCFG 0x0628 - -#define REG_USTIME_EDCA 0x0638 -#define REG_MAC_SPEC_SIFS 0x063A -#define REG_RESP_SIFS_CCK 0x063C -#define REG_RESP_SIFS_OFDM 0x063E -/* [15:8]SIFS_R2T_OFDM, [7:0]SIFS_R2T_CCK */ -#define REG_R2T_SIFS 0x063C -/* [15:8]SIFS_T2T_OFDM, [7:0]SIFS_T2T_CCK */ -#define REG_T2T_SIFS 0x063E -#define REG_ACKTO 0x0640 -#define REG_CTS2TO 0x0641 -#define REG_EIFS 0x0642 - -#define REG_NAV_CTRL 0x0650 -#define REG_BACAMCMD 0x0654 -#define REG_BACAMCONTENT 0x0658 -#define REG_LBDLY 0x0660 -#define REG_FWDLY 0x0661 -#define REG_RXERR_RPT 0x0664 -#define REG_WMAC_TRXPTCL_CTL 0x0668 - -#define REG_CAMCMD 0x0670 -#define REG_CAMWRITE 0x0674 -#define REG_CAMREAD 0x0678 -#define REG_CAMDBG 0x067C -#define REG_SECCFG 0x0680 - -#define REG_WOW_CTRL 0x0690 -#define REG_PSSTATUS 0x0691 -#define REG_PS_RX_INFO 0x0692 -#define REG_LPNAV_CTRL 0x0694 -#define REG_WKFMCAM_CMD 0x0698 -#define REG_WKFMCAM_RWD 0x069C -#define REG_RXFLTMAP0 0x06A0 -#define REG_RXFLTMAP1 0x06A2 -#define REG_RXFLTMAP2 0x06A4 -#define REG_BCN_PSR_RPT 0x06A8 -#define REG_CALB32K_CTRL 0x06AC -#define REG_PKT_MON_CTRL 0x06B4 -#define REG_BT_COEX_TABLE 0x06C0 -#define REG_WMAC_RESP_TXINFO 0x06D8 - -#define REG_USB_INFO 0xFE17 -#define REG_USB_SPECIAL_OPTION 0xFE55 -#define REG_USB_DMA_AGG_TO 0xFE5B -#define REG_USB_AGG_TO 0xFE5C -#define REG_USB_AGG_TH 0xFE5D - -#define REG_TEST_USB_TXQS 0xFE48 -#define REG_TEST_SIE_VID 0xFE60 -#define REG_TEST_SIE_PID 0xFE62 -#define REG_TEST_SIE_OPTIONAL 0xFE64 -#define REG_TEST_SIE_CHIRP_K 0xFE65 -#define REG_TEST_SIE_PHY 0xFE66 -#define REG_TEST_SIE_MAC_ADDR 0xFE70 -#define REG_TEST_SIE_STRING 0xFE80 - -#define REG_NORMAL_SIE_VID 0xFE60 -#define REG_NORMAL_SIE_PID 0xFE62 -#define REG_NORMAL_SIE_OPTIONAL 0xFE64 -#define REG_NORMAL_SIE_EP 0xFE65 -#define REG_NORMAL_SIE_PHY 0xFE68 -#define REG_NORMAL_SIE_MAC_ADDR 0xFE70 -#define REG_NORMAL_SIE_STRING 0xFE80 - -#define CR9346 REG_9346CR -#define MSR (REG_CR + 2) -#define ISR REG_HISR -#define TSFR REG_TSFTR - -#define MACIDR0 REG_MACID -#define MACIDR4 (REG_MACID + 4) - -#define PBP REG_PBP - -#define IDR0 MACIDR0 -#define IDR4 MACIDR4 - -#define UNUSED_REGISTER 0x1BF -#define DCAM UNUSED_REGISTER -#define PSR UNUSED_REGISTER -#define BBADDR UNUSED_REGISTER -#define PHYDATAR UNUSED_REGISTER - -#define INVALID_BBRF_VALUE 0x12345678 - -#define MAX_MSS_DENSITY_2T 0x13 -#define MAX_MSS_DENSITY_1T 0x0A - -#define CMDEEPROM_EN BIT(5) -#define CMDEEPROM_SEL BIT(4) -#define CMD9346CR_9356SEL BIT(4) -#define AUTOLOAD_EEPROM (CMDEEPROM_EN|CMDEEPROM_SEL) -#define AUTOLOAD_EFUSE CMDEEPROM_EN - -#define GPIOSEL_GPIO 0 -#define GPIOSEL_ENBT BIT(5) - -#define GPIO_IN REG_GPIO_PIN_CTRL -#define GPIO_OUT (REG_GPIO_PIN_CTRL+1) -#define GPIO_IO_SEL (REG_GPIO_PIN_CTRL+2) -#define GPIO_MOD (REG_GPIO_PIN_CTRL+3) - -#define MSR_NOLINK 0x00 -#define MSR_ADHOC 0x01 -#define MSR_INFRA 0x02 -#define MSR_AP 0x03 - -#define RRSR_RSC_OFFSET 21 -#define RRSR_SHORT_OFFSET 23 -#define RRSR_RSC_BW_40M 0x600000 -#define RRSR_RSC_UPSUBCHNL 0x400000 -#define RRSR_RSC_LOWSUBCHNL 0x200000 -#define RRSR_SHORT 0x800000 -#define RRSR_1M BIT(0) -#define RRSR_2M BIT(1) -#define RRSR_5_5M BIT(2) -#define RRSR_11M BIT(3) -#define RRSR_6M BIT(4) -#define RRSR_9M BIT(5) -#define RRSR_12M BIT(6) -#define RRSR_18M BIT(7) -#define RRSR_24M BIT(8) -#define RRSR_36M BIT(9) -#define RRSR_48M BIT(10) -#define RRSR_54M BIT(11) -#define RRSR_MCS0 BIT(12) -#define RRSR_MCS1 BIT(13) -#define RRSR_MCS2 BIT(14) -#define RRSR_MCS3 BIT(15) -#define RRSR_MCS4 BIT(16) -#define RRSR_MCS5 BIT(17) -#define RRSR_MCS6 BIT(18) -#define RRSR_MCS7 BIT(19) -#define BRSR_ACKSHORTPMB BIT(23) - -#define RATR_1M 0x00000001 -#define RATR_2M 0x00000002 -#define RATR_55M 0x00000004 -#define RATR_11M 0x00000008 -#define RATR_6M 0x00000010 -#define RATR_9M 0x00000020 -#define RATR_12M 0x00000040 -#define RATR_18M 0x00000080 -#define RATR_24M 0x00000100 -#define RATR_36M 0x00000200 -#define RATR_48M 0x00000400 -#define RATR_54M 0x00000800 -#define RATR_MCS0 0x00001000 -#define RATR_MCS1 0x00002000 -#define RATR_MCS2 0x00004000 -#define RATR_MCS3 0x00008000 -#define RATR_MCS4 0x00010000 -#define RATR_MCS5 0x00020000 -#define RATR_MCS6 0x00040000 -#define RATR_MCS7 0x00080000 -#define RATR_MCS8 0x00100000 -#define RATR_MCS9 0x00200000 -#define RATR_MCS10 0x00400000 -#define RATR_MCS11 0x00800000 -#define RATR_MCS12 0x01000000 -#define RATR_MCS13 0x02000000 -#define RATR_MCS14 0x04000000 -#define RATR_MCS15 0x08000000 - -#define RATE_1M BIT(0) -#define RATE_2M BIT(1) -#define RATE_5_5M BIT(2) -#define RATE_11M BIT(3) -#define RATE_6M BIT(4) -#define RATE_9M BIT(5) -#define RATE_12M BIT(6) -#define RATE_18M BIT(7) -#define RATE_24M BIT(8) -#define RATE_36M BIT(9) -#define RATE_48M BIT(10) -#define RATE_54M BIT(11) -#define RATE_MCS0 BIT(12) -#define RATE_MCS1 BIT(13) -#define RATE_MCS2 BIT(14) -#define RATE_MCS3 BIT(15) -#define RATE_MCS4 BIT(16) -#define RATE_MCS5 BIT(17) -#define RATE_MCS6 BIT(18) -#define RATE_MCS7 BIT(19) -#define RATE_MCS8 BIT(20) -#define RATE_MCS9 BIT(21) -#define RATE_MCS10 BIT(22) -#define RATE_MCS11 BIT(23) -#define RATE_MCS12 BIT(24) -#define RATE_MCS13 BIT(25) -#define RATE_MCS14 BIT(26) -#define RATE_MCS15 BIT(27) - -#define RATE_ALL_CCK (RATR_1M | RATR_2M | RATR_55M | RATR_11M) -#define RATE_ALL_OFDM_AG (RATR_6M | RATR_9M | RATR_12M | RATR_18M \ - | RATR_24M | RATR_36M | RATR_48M | RATR_54M) -#define RATE_ALL_OFDM_1SS (RATR_MCS0 | RATR_MCS1 | RATR_MCS2 | \ - RATR_MCS3 | RATR_MCS4 | RATR_MCS5 | \ - RATR_MCS6 | RATR_MCS7) -#define RATE_ALL_OFDM_2SS (RATR_MCS8 | RATR_MCS9 | RATR_MCS10 | \ - RATR_MCS11 | RATR_MCS12 | RATR_MCS13 | \ - RATR_MCS14 | RATR_MCS15) - -#define BW_OPMODE_20MHZ BIT(2) -#define BW_OPMODE_5G BIT(1) -#define BW_OPMODE_11J BIT(0) - -#define CAM_VALID BIT(15) -#define CAM_NOTVALID 0x0000 -#define CAM_USEDK BIT(5) - -#define CAM_NONE 0x0 -#define CAM_WEP40 0x01 -#define CAM_TKIP 0x02 -#define CAM_AES 0x04 -#define CAM_WEP104 0x05 - -#define TOTAL_CAM_ENTRY 32 -#define HALF_CAM_ENTRY 16 - -#define CAM_WRITE BIT(16) -#define CAM_READ 0x00000000 -#define CAM_POLLINIG BIT(31) - -#define SCR_USEDK 0x01 -#define SCR_TXSEC_ENABLE 0x02 -#define SCR_RXSEC_ENABLE 0x04 - -#define WOW_PMEN BIT(0) -#define WOW_WOMEN BIT(1) -#define WOW_MAGIC BIT(2) -#define WOW_UWF BIT(3) - -#define IMR8190_DISABLED 0x0 -#define IMR_BCNDMAINT6 BIT(31) -#define IMR_BCNDMAINT5 BIT(30) -#define IMR_BCNDMAINT4 BIT(29) -#define IMR_BCNDMAINT3 BIT(28) -#define IMR_BCNDMAINT2 BIT(27) -#define IMR_BCNDMAINT1 BIT(26) -#define IMR_BCNDOK8 BIT(25) -#define IMR_BCNDOK7 BIT(24) -#define IMR_BCNDOK6 BIT(23) -#define IMR_BCNDOK5 BIT(22) -#define IMR_BCNDOK4 BIT(21) -#define IMR_BCNDOK3 BIT(20) -#define IMR_BCNDOK2 BIT(19) -#define IMR_BCNDOK1 BIT(18) -#define IMR_TIMEOUT2 BIT(17) -#define IMR_TIMEOUT1 BIT(16) -#define IMR_TXFOVW BIT(15) -#define IMR_PSTIMEOUT BIT(14) -#define IMR_BCNINT BIT(13) -#define IMR_RXFOVW BIT(12) -#define IMR_RDU BIT(11) -#define IMR_ATIMEND BIT(10) -#define IMR_BDOK BIT(9) -#define IMR_HIGHDOK BIT(8) -#define IMR_TBDOK BIT(7) -#define IMR_MGNTDOK BIT(6) -#define IMR_TBDER BIT(5) -#define IMR_BKDOK BIT(4) -#define IMR_BEDOK BIT(3) -#define IMR_VIDOK BIT(2) -#define IMR_VODOK BIT(1) -#define IMR_ROK BIT(0) - -#define IMR_TXERR BIT(11) -#define IMR_RXERR BIT(10) -#define IMR_C2HCMD BIT(9) -#define IMR_CPWM BIT(8) -#define IMR_OCPINT BIT(1) -#define IMR_WLANOFF BIT(0) - -#define EFUSE_REAL_CONTENT_LEN 512 -#define EFUSE_OOB_PROTECT_BYTES 15 - -#define EEPROM_DEFAULT_TSSI 0x0 -#define EEPROM_DEFAULT_TXPOWERDIFF 0x0 -#define EEPROM_DEFAULT_CRYSTALCAP 0x5 -#define EEPROM_DEFAULT_BOARDTYPE 0x02 -#define EEPROM_DEFAULT_TXPOWER 0x1010 -#define EEPROM_DEFAULT_HT2T_TXPWR 0x10 - -#define EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF 0x3 -#define EEPROM_DEFAULT_THERMALMETER 0x12 -#define EEPROM_DEFAULT_ANTTXPOWERDIFF 0x0 -#define EEPROM_DEFAULT_TXPWDIFF_CRYSTALCAP 0x5 -#define EEPROM_DEFAULT_TXPOWERLEVEL 0x22 -#define EEPROM_DEFAULT_HT40_2SDIFF 0x0 -#define EEPROM_DEFAULT_HT20_DIFF 2 -#define EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF 0x3 -#define EEPROM_DEFAULT_HT40_PWRMAXOFFSET 0 -#define EEPROM_DEFAULT_HT20_PWRMAXOFFSET 0 - -#define RF_OPTION1 0x79 -#define RF_OPTION2 0x7A -#define RF_OPTION3 0x7B -#define RF_OPTION4 0x7C - -#define EEPROM_DEFAULT_PID 0x1234 -#define EEPROM_DEFAULT_VID 0x5678 -#define EEPROM_DEFAULT_CUSTOMERID 0xAB -#define EEPROM_DEFAULT_SUBCUSTOMERID 0xCD -#define EEPROM_DEFAULT_VERSION 0 - -#define EEPROM_CHANNEL_PLAN_FCC 0x0 -#define EEPROM_CHANNEL_PLAN_IC 0x1 -#define EEPROM_CHANNEL_PLAN_ETSI 0x2 -#define EEPROM_CHANNEL_PLAN_SPAIN 0x3 -#define EEPROM_CHANNEL_PLAN_FRANCE 0x4 -#define EEPROM_CHANNEL_PLAN_MKK 0x5 -#define EEPROM_CHANNEL_PLAN_MKK1 0x6 -#define EEPROM_CHANNEL_PLAN_ISRAEL 0x7 -#define EEPROM_CHANNEL_PLAN_TELEC 0x8 -#define EEPROM_CHANNEL_PLAN_GLOBAL_DOMAIN 0x9 -#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_13 0xA -#define EEPROM_CHANNEL_PLAN_NCC 0xB -#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80 - -#define EEPROM_CID_DEFAULT 0x0 -#define EEPROM_CID_TOSHIBA 0x4 -#define EEPROM_CID_CCX 0x10 -#define EEPROM_CID_QMI 0x0D -#define EEPROM_CID_WHQL 0xFE - -#define RTL8192_EEPROM_ID 0x8129 - -#define RTL8190_EEPROM_ID 0x8129 -#define EEPROM_HPON 0x02 -#define EEPROM_CLK 0x06 -#define EEPROM_TESTR 0x08 - -#define EEPROM_VID 0x0A -#define EEPROM_DID 0x0C -#define EEPROM_SVID 0x0E -#define EEPROM_SMID 0x10 - -#define EEPROM_MAC_ADDR 0x16 - -#define EEPROM_CCK_TX_PWR_INX 0x5A -#define EEPROM_HT40_1S_TX_PWR_INX 0x60 -#define EEPROM_HT40_2S_TX_PWR_INX_DIFF 0x66 -#define EEPROM_HT20_TX_PWR_INX_DIFF 0x69 -#define EEPROM_OFDM_TX_PWR_INX_DIFF 0x6C -#define EEPROM_HT40_MAX_PWR_OFFSET 0x6F -#define EEPROM_HT20_MAX_PWR_OFFSET 0x72 - -#define EEPROM_TSSI_A 0x76 -#define EEPROM_TSSI_B 0x77 -#define EEPROM_THERMAL_METER 0x78 -#define EEPROM_XTAL_K 0x78 -#define EEPROM_RF_OPT1 0x79 -#define EEPROM_RF_OPT2 0x7A -#define EEPROM_RF_OPT3 0x7B -#define EEPROM_RF_OPT4 0x7C -#define EEPROM_CHANNEL_PLAN 0x7D -#define EEPROM_VERSION 0x7E -#define EEPROM_CUSTOMER_ID 0x7F - -#define EEPROM_PWRDIFF 0x54 - -#define EEPROM_TXPOWERCCK 0x5A -#define EEPROM_TXPOWERHT40_1S 0x60 -#define EEPROM_TXPOWERHT40_2SDIFF 0x66 -#define EEPROM_TXPOWERHT20DIFF 0x69 -#define EEPROM_TXPOWER_OFDMDIFF 0x6C - -#define EEPROM_TXPWR_GROUP 0x6F - -#define EEPROM_TSSI_A 0x76 -#define EEPROM_TSSI_B 0x77 -#define EEPROM_THERMAL_METER 0x78 - -#define EEPROM_CHANNELPLAN 0x75 - -#define RF_OPTION1 0x79 -#define RF_OPTION2 0x7A -#define RF_OPTION3 0x7B -#define RF_OPTION4 0x7C - -#define STOPBECON BIT(6) -#define STOPHIGHT BIT(5) -#define STOPMGT BIT(4) -#define STOPVO BIT(3) -#define STOPVI BIT(2) -#define STOPBE BIT(1) -#define STOPBK BIT(0) - -#define RCR_APPFCS BIT(31) -#define RCR_APP_FCS BIT(31) -#define RCR_APP_MIC BIT(30) -#define RCR_APP_ICV BIT(29) -#define RCR_APP_PHYSTS BIT(28) -#define RCR_APP_PHYST_RXFF BIT(28) -#define RCR_APP_BA_SSN BIT(27) -#define RCR_ENMBID BIT(24) -#define RCR_LSIGEN BIT(23) -#define RCR_MFBEN BIT(22) -#define RCR_HTC_LOC_CTRL BIT(14) -#define RCR_AMF BIT(13) -#define RCR_ACF BIT(12) -#define RCR_ADF BIT(11) -#define RCR_AICV BIT(9) -#define RCR_ACRC32 BIT(8) -#define RCR_CBSSID_BCN BIT(7) -#define RCR_CBSSID_DATA BIT(6) -#define RCR_CBSSID RCR_CBSSID_DATA -#define RCR_APWRMGT BIT(5) -#define RCR_ADD3 BIT(4) -#define RCR_AB BIT(3) -#define RCR_AM BIT(2) -#define RCR_APM BIT(1) -#define RCR_AAP BIT(0) -#define RCR_MXDMA_OFFSET 8 -#define RCR_FIFO_OFFSET 13 - -#define RSV_CTRL 0x001C -#define RD_CTRL 0x0524 - -#define REG_USB_INFO 0xFE17 -#define REG_USB_SPECIAL_OPTION 0xFE55 - -#define REG_USB_DMA_AGG_TO 0xFE5B -#define REG_USB_AGG_TO 0xFE5C -#define REG_USB_AGG_TH 0xFE5D - -#define REG_USB_VID 0xFE60 -#define REG_USB_PID 0xFE62 -#define REG_USB_OPTIONAL 0xFE64 -#define REG_USB_CHIRP_K 0xFE65 -#define REG_USB_PHY 0xFE66 -#define REG_USB_MAC_ADDR 0xFE70 -#define REG_USB_HRPWM 0xFE58 -#define REG_USB_HCPWM 0xFE57 - -#define SW18_FPWM BIT(3) - -#define ISO_MD2PP BIT(0) -#define ISO_UA2USB BIT(1) -#define ISO_UD2CORE BIT(2) -#define ISO_PA2PCIE BIT(3) -#define ISO_PD2CORE BIT(4) -#define ISO_IP2MAC BIT(5) -#define ISO_DIOP BIT(6) -#define ISO_DIOE BIT(7) -#define ISO_EB2CORE BIT(8) -#define ISO_DIOR BIT(9) - -#define PWC_EV25V BIT(14) -#define PWC_EV12V BIT(15) - -#define FEN_BBRSTB BIT(0) -#define FEN_BB_GLB_RSTn BIT(1) -#define FEN_USBA BIT(2) -#define FEN_UPLL BIT(3) -#define FEN_USBD BIT(4) -#define FEN_DIO_PCIE BIT(5) -#define FEN_PCIEA BIT(6) -#define FEN_PPLL BIT(7) -#define FEN_PCIED BIT(8) -#define FEN_DIOE BIT(9) -#define FEN_CPUEN BIT(10) -#define FEN_DCORE BIT(11) -#define FEN_ELDR BIT(12) -#define FEN_DIO_RF BIT(13) -#define FEN_HWPDN BIT(14) -#define FEN_MREGEN BIT(15) - -#define PFM_LDALL BIT(0) -#define PFM_ALDN BIT(1) -#define PFM_LDKP BIT(2) -#define PFM_WOWL BIT(3) -#define EnPDN BIT(4) -#define PDN_PL BIT(5) -#define APFM_ONMAC BIT(8) -#define APFM_OFF BIT(9) -#define APFM_RSM BIT(10) -#define AFSM_HSUS BIT(11) -#define AFSM_PCIE BIT(12) -#define APDM_MAC BIT(13) -#define APDM_HOST BIT(14) -#define APDM_HPDN BIT(15) -#define RDY_MACON BIT(16) -#define SUS_HOST BIT(17) -#define ROP_ALD BIT(20) -#define ROP_PWR BIT(21) -#define ROP_SPS BIT(22) -#define SOP_MRST BIT(25) -#define SOP_FUSE BIT(26) -#define SOP_ABG BIT(27) -#define SOP_AMB BIT(28) -#define SOP_RCK BIT(29) -#define SOP_A8M BIT(30) -#define XOP_BTCK BIT(31) - -#define ANAD16V_EN BIT(0) -#define ANA8M BIT(1) -#define MACSLP BIT(4) -#define LOADER_CLK_EN BIT(5) -#define _80M_SSC_DIS BIT(7) -#define _80M_SSC_EN_HO BIT(8) -#define PHY_SSC_RSTB BIT(9) -#define SEC_CLK_EN BIT(10) -#define MAC_CLK_EN BIT(11) -#define SYS_CLK_EN BIT(12) -#define RING_CLK_EN BIT(13) - -#define BOOT_FROM_EEPROM BIT(4) -#define EEPROM_EN BIT(5) - -#define AFE_BGEN BIT(0) -#define AFE_MBEN BIT(1) -#define MAC_ID_EN BIT(7) - -#define WLOCK_ALL BIT(0) -#define WLOCK_00 BIT(1) -#define WLOCK_04 BIT(2) -#define WLOCK_08 BIT(3) -#define WLOCK_40 BIT(4) -#define R_DIS_PRST_0 BIT(5) -#define R_DIS_PRST_1 BIT(6) -#define LOCK_ALL_EN BIT(7) - -#define RF_EN BIT(0) -#define RF_RSTB BIT(1) -#define RF_SDMRSTB BIT(2) - -#define LDA15_EN BIT(0) -#define LDA15_STBY BIT(1) -#define LDA15_OBUF BIT(2) -#define LDA15_REG_VOS BIT(3) -#define _LDA15_VOADJ(x) (((x) & 0x7) << 4) - -#define LDV12_EN BIT(0) -#define LDV12_SDBY BIT(1) -#define LPLDO_HSM BIT(2) -#define LPLDO_LSM_DIS BIT(3) -#define _LDV12_VADJ(x) (((x) & 0xF) << 4) - -#define XTAL_EN BIT(0) -#define XTAL_BSEL BIT(1) -#define _XTAL_BOSC(x) (((x) & 0x3) << 2) -#define _XTAL_CADJ(x) (((x) & 0xF) << 4) -#define XTAL_GATE_USB BIT(8) -#define _XTAL_USB_DRV(x) (((x) & 0x3) << 9) -#define XTAL_GATE_AFE BIT(11) -#define _XTAL_AFE_DRV(x) (((x) & 0x3) << 12) -#define XTAL_RF_GATE BIT(14) -#define _XTAL_RF_DRV(x) (((x) & 0x3) << 15) -#define XTAL_GATE_DIG BIT(17) -#define _XTAL_DIG_DRV(x) (((x) & 0x3) << 18) -#define XTAL_BT_GATE BIT(20) -#define _XTAL_BT_DRV(x) (((x) & 0x3) << 21) -#define _XTAL_GPIO(x) (((x) & 0x7) << 23) - -#define CKDLY_AFE BIT(26) -#define CKDLY_USB BIT(27) -#define CKDLY_DIG BIT(28) -#define CKDLY_BT BIT(29) - -#define APLL_EN BIT(0) -#define APLL_320_EN BIT(1) -#define APLL_FREF_SEL BIT(2) -#define APLL_EDGE_SEL BIT(3) -#define APLL_WDOGB BIT(4) -#define APLL_LPFEN BIT(5) - -#define APLL_REF_CLK_13MHZ 0x1 -#define APLL_REF_CLK_19_2MHZ 0x2 -#define APLL_REF_CLK_20MHZ 0x3 -#define APLL_REF_CLK_25MHZ 0x4 -#define APLL_REF_CLK_26MHZ 0x5 -#define APLL_REF_CLK_38_4MHZ 0x6 -#define APLL_REF_CLK_40MHZ 0x7 - -#define APLL_320EN BIT(14) -#define APLL_80EN BIT(15) -#define APLL_1MEN BIT(24) - -#define ALD_EN BIT(18) -#define EF_PD BIT(19) -#define EF_FLAG BIT(31) - -#define EF_TRPT BIT(7) -#define LDOE25_EN BIT(31) - -#define RSM_EN BIT(0) -#define Timer_EN BIT(4) - -#define TRSW0EN BIT(2) -#define TRSW1EN BIT(3) -#define EROM_EN BIT(4) -#define EnBT BIT(5) -#define EnUart BIT(8) -#define Uart_910 BIT(9) -#define EnPMAC BIT(10) -#define SIC_SWRST BIT(11) -#define EnSIC BIT(12) -#define SIC_23 BIT(13) -#define EnHDP BIT(14) -#define SIC_LBK BIT(15) - -#define LED0PL BIT(4) -#define LED1PL BIT(12) -#define LED0DIS BIT(7) - -#define MCUFWDL_EN BIT(0) -#define MCUFWDL_RDY BIT(1) -#define FWDL_ChkSum_rpt BIT(2) -#define MACINI_RDY BIT(3) -#define BBINI_RDY BIT(4) -#define RFINI_RDY BIT(5) -#define WINTINI_RDY BIT(6) -#define CPRST BIT(23) - -#define XCLK_VLD BIT(0) -#define ACLK_VLD BIT(1) -#define UCLK_VLD BIT(2) -#define PCLK_VLD BIT(3) -#define PCIRSTB BIT(4) -#define V15_VLD BIT(5) -#define TRP_B15V_EN BIT(7) -#define SIC_IDLE BIT(8) -#define BD_MAC2 BIT(9) -#define BD_MAC1 BIT(10) -#define IC_MACPHY_MODE BIT(11) -#define BT_FUNC BIT(16) -#define VENDOR_ID BIT(19) -#define PAD_HWPD_IDN BIT(22) -#define TRP_VAUX_EN BIT(23) -#define TRP_BT_EN BIT(24) -#define BD_PKG_SEL BIT(25) -#define BD_HCI_SEL BIT(26) -#define TYPE_ID BIT(27) -#define RF_RL_ID (BIT(31) | BIT(30) | BIT(29) | BIT(28)) - -#define CHIP_VER_RTL_MASK 0xF000 -#define CHIP_VER_RTL_SHIFT 12 - -#define REG_LBMODE (REG_CR + 3) - -#define HCI_TXDMA_EN BIT(0) -#define HCI_RXDMA_EN BIT(1) -#define TXDMA_EN BIT(2) -#define RXDMA_EN BIT(3) -#define PROTOCOL_EN BIT(4) -#define SCHEDULE_EN BIT(5) -#define MACTXEN BIT(6) -#define MACRXEN BIT(7) -#define ENSWBCN BIT(8) -#define ENSEC BIT(9) - -#define _NETTYPE(x) (((x) & 0x3) << 16) -#define MASK_NETTYPE 0x30000 -#define NT_NO_LINK 0x0 -#define NT_LINK_AD_HOC 0x1 -#define NT_LINK_AP 0x2 -#define NT_AS_AP 0x3 - -#define _LBMODE(x) (((x) & 0xF) << 24) -#define MASK_LBMODE 0xF000000 -#define LOOPBACK_NORMAL 0x0 -#define LOOPBACK_IMMEDIATELY 0xB -#define LOOPBACK_MAC_DELAY 0x3 -#define LOOPBACK_PHY 0x1 -#define LOOPBACK_DMA 0x7 - -#define GET_RX_PAGE_SIZE(value) ((value) & 0xF) -#define GET_TX_PAGE_SIZE(value) (((value) & 0xF0) >> 4) -#define _PSRX_MASK 0xF -#define _PSTX_MASK 0xF0 -#define _PSRX(x) (x) -#define _PSTX(x) ((x) << 4) - -#define PBP_64 0x0 -#define PBP_128 0x1 -#define PBP_256 0x2 -#define PBP_512 0x3 -#define PBP_1024 0x4 - -#define RXDMA_ARBBW_EN BIT(0) -#define RXSHFT_EN BIT(1) -#define RXDMA_AGG_EN BIT(2) -#define QS_VO_QUEUE BIT(8) -#define QS_VI_QUEUE BIT(9) -#define QS_BE_QUEUE BIT(10) -#define QS_BK_QUEUE BIT(11) -#define QS_MANAGER_QUEUE BIT(12) -#define QS_HIGH_QUEUE BIT(13) - -#define HQSEL_VOQ BIT(0) -#define HQSEL_VIQ BIT(1) -#define HQSEL_BEQ BIT(2) -#define HQSEL_BKQ BIT(3) -#define HQSEL_MGTQ BIT(4) -#define HQSEL_HIQ BIT(5) - -#define _TXDMA_HIQ_MAP(x) (((x)&0x3) << 14) -#define _TXDMA_MGQ_MAP(x) (((x)&0x3) << 12) -#define _TXDMA_BKQ_MAP(x) (((x)&0x3) << 10) -#define _TXDMA_BEQ_MAP(x) (((x)&0x3) << 8) -#define _TXDMA_VIQ_MAP(x) (((x)&0x3) << 6) -#define _TXDMA_VOQ_MAP(x) (((x)&0x3) << 4) - -#define QUEUE_LOW 1 -#define QUEUE_NORMAL 2 -#define QUEUE_HIGH 3 - -#define _LLT_NO_ACTIVE 0x0 -#define _LLT_WRITE_ACCESS 0x1 -#define _LLT_READ_ACCESS 0x2 - -#define _LLT_INIT_DATA(x) ((x) & 0xFF) -#define _LLT_INIT_ADDR(x) (((x) & 0xFF) << 8) -#define _LLT_OP(x) (((x) & 0x3) << 30) -#define _LLT_OP_VALUE(x) (((x) >> 30) & 0x3) - -#define BB_WRITE_READ_MASK (BIT(31) | BIT(30)) -#define BB_WRITE_EN BIT(30) -#define BB_READ_EN BIT(31) - -#define _HPQ(x) ((x) & 0xFF) -#define _LPQ(x) (((x) & 0xFF) << 8) -#define _PUBQ(x) (((x) & 0xFF) << 16) -#define _NPQ(x) ((x) & 0xFF) - -#define HPQ_PUBLIC_DIS BIT(24) -#define LPQ_PUBLIC_DIS BIT(25) -#define LD_RQPN BIT(31) - -#define BCN_VALID BIT(16) -#define BCN_HEAD(x) (((x) & 0xFF) << 8) -#define BCN_HEAD_MASK 0xFF00 - -#define BLK_DESC_NUM_SHIFT 4 -#define BLK_DESC_NUM_MASK 0xF - -#define DROP_DATA_EN BIT(9) - -#define EN_AMPDU_RTY_NEW BIT(7) - -#define _INIRTSMCS_SEL(x) ((x) & 0x3F) - -#define _SPEC_SIFS_CCK(x) ((x) & 0xFF) -#define _SPEC_SIFS_OFDM(x) (((x) & 0xFF) << 8) - -#define RATE_REG_BITMAP_ALL 0xFFFFF - -#define _RRSC_BITMAP(x) ((x) & 0xFFFFF) - -#define _RRSR_RSC(x) (((x) & 0x3) << 21) -#define RRSR_RSC_RESERVED 0x0 -#define RRSR_RSC_UPPER_SUBCHANNEL 0x1 -#define RRSR_RSC_LOWER_SUBCHANNEL 0x2 -#define RRSR_RSC_DUPLICATE_MODE 0x3 - -#define USE_SHORT_G1 BIT(20) - -#define _AGGLMT_MCS0(x) ((x) & 0xF) -#define _AGGLMT_MCS1(x) (((x) & 0xF) << 4) -#define _AGGLMT_MCS2(x) (((x) & 0xF) << 8) -#define _AGGLMT_MCS3(x) (((x) & 0xF) << 12) -#define _AGGLMT_MCS4(x) (((x) & 0xF) << 16) -#define _AGGLMT_MCS5(x) (((x) & 0xF) << 20) -#define _AGGLMT_MCS6(x) (((x) & 0xF) << 24) -#define _AGGLMT_MCS7(x) (((x) & 0xF) << 28) - -#define RETRY_LIMIT_SHORT_SHIFT 8 -#define RETRY_LIMIT_LONG_SHIFT 0 - -#define _DARF_RC1(x) ((x) & 0x1F) -#define _DARF_RC2(x) (((x) & 0x1F) << 8) -#define _DARF_RC3(x) (((x) & 0x1F) << 16) -#define _DARF_RC4(x) (((x) & 0x1F) << 24) -#define _DARF_RC5(x) ((x) & 0x1F) -#define _DARF_RC6(x) (((x) & 0x1F) << 8) -#define _DARF_RC7(x) (((x) & 0x1F) << 16) -#define _DARF_RC8(x) (((x) & 0x1F) << 24) - -#define _RARF_RC1(x) ((x) & 0x1F) -#define _RARF_RC2(x) (((x) & 0x1F) << 8) -#define _RARF_RC3(x) (((x) & 0x1F) << 16) -#define _RARF_RC4(x) (((x) & 0x1F) << 24) -#define _RARF_RC5(x) ((x) & 0x1F) -#define _RARF_RC6(x) (((x) & 0x1F) << 8) -#define _RARF_RC7(x) (((x) & 0x1F) << 16) -#define _RARF_RC8(x) (((x) & 0x1F) << 24) - -#define AC_PARAM_TXOP_OFFSET 16 -#define AC_PARAM_TXOP_LIMIT_OFFSET 16 -#define AC_PARAM_ECW_MAX_OFFSET 12 -#define AC_PARAM_ECW_MIN_OFFSET 8 -#define AC_PARAM_AIFS_OFFSET 0 - -#define _AIFS(x) (x) -#define _ECW_MAX_MIN(x) ((x) << 8) -#define _TXOP_LIMIT(x) ((x) << 16) - -#define _BCNIFS(x) ((x) & 0xFF) -#define _BCNECW(x) ((((x) & 0xF)) << 8) - -#define _LRL(x) ((x) & 0x3F) -#define _SRL(x) (((x) & 0x3F) << 8) - -#define _SIFS_CCK_CTX(x) ((x) & 0xFF) -#define _SIFS_CCK_TRX(x) (((x) & 0xFF) << 8) - -#define _SIFS_OFDM_CTX(x) ((x) & 0xFF) -#define _SIFS_OFDM_TRX(x) (((x) & 0xFF) << 8) - -#define _TBTT_PROHIBIT_HOLD(x) (((x) & 0xFF) << 8) - -#define DIS_EDCA_CNT_DWN BIT(11) - -#define EN_MBSSID BIT(1) -#define EN_TXBCN_RPT BIT(2) -#define EN_BCN_FUNCTION BIT(3) - -#define TSFTR_RST BIT(0) -#define TSFTR1_RST BIT(1) - -#define STOP_BCNQ BIT(6) - -#define DIS_TSF_UDT0_NORMAL_CHIP BIT(4) -#define DIS_TSF_UDT0_TEST_CHIP BIT(5) - -#define AcmHw_HwEn BIT(0) -#define AcmHw_BeqEn BIT(1) -#define AcmHw_ViqEn BIT(2) -#define AcmHw_VoqEn BIT(3) -#define AcmHw_BeqStatus BIT(4) -#define AcmHw_ViqStatus BIT(5) -#define AcmHw_VoqStatus BIT(6) - -#define APSDOFF BIT(6) -#define APSDOFF_STATUS BIT(7) - -#define BW_20MHZ BIT(2) - -#define RATE_BITMAP_ALL 0xFFFFF - -#define RATE_RRSR_CCK_ONLY_1M 0xFFFF1 - -#define TSFRST BIT(0) -#define DIS_GCLK BIT(1) -#define PAD_SEL BIT(2) -#define PWR_ST BIT(6) -#define PWRBIT_OW_EN BIT(7) -#define ACRC BIT(8) -#define CFENDFORM BIT(9) -#define ICV BIT(10) - -#define AAP BIT(0) -#define APM BIT(1) -#define AM BIT(2) -#define AB BIT(3) -#define ADD3 BIT(4) -#define APWRMGT BIT(5) -#define CBSSID BIT(6) -#define CBSSID_DATA BIT(6) -#define CBSSID_BCN BIT(7) -#define ACRC32 BIT(8) -#define AICV BIT(9) -#define ADF BIT(11) -#define ACF BIT(12) -#define AMF BIT(13) -#define HTC_LOC_CTRL BIT(14) -#define UC_DATA_EN BIT(16) -#define BM_DATA_EN BIT(17) -#define MFBEN BIT(22) -#define LSIGEN BIT(23) -#define EnMBID BIT(24) -#define APP_BASSN BIT(27) -#define APP_PHYSTS BIT(28) -#define APP_ICV BIT(29) -#define APP_MIC BIT(30) -#define APP_FCS BIT(31) - -#define _MIN_SPACE(x) ((x) & 0x7) -#define _SHORT_GI_PADDING(x) (((x) & 0x1F) << 3) - -#define RXERR_TYPE_OFDM_PPDU 0 -#define RXERR_TYPE_OFDM_FALSE_ALARM 1 -#define RXERR_TYPE_OFDM_MPDU_OK 2 -#define RXERR_TYPE_OFDM_MPDU_FAIL 3 -#define RXERR_TYPE_CCK_PPDU 4 -#define RXERR_TYPE_CCK_FALSE_ALARM 5 -#define RXERR_TYPE_CCK_MPDU_OK 6 -#define RXERR_TYPE_CCK_MPDU_FAIL 7 -#define RXERR_TYPE_HT_PPDU 8 -#define RXERR_TYPE_HT_FALSE_ALARM 9 -#define RXERR_TYPE_HT_MPDU_TOTAL 10 -#define RXERR_TYPE_HT_MPDU_OK 11 -#define RXERR_TYPE_HT_MPDU_FAIL 12 -#define RXERR_TYPE_RX_FULL_DROP 15 - -#define RXERR_COUNTER_MASK 0xFFFFF -#define RXERR_RPT_RST BIT(27) -#define _RXERR_RPT_SEL(type) ((type) << 28) - -#define SCR_TxUseDK BIT(0) -#define SCR_RxUseDK BIT(1) -#define SCR_TxEncEnable BIT(2) -#define SCR_RxDecEnable BIT(3) -#define SCR_SKByA2 BIT(4) -#define SCR_NoSKMC BIT(5) -#define SCR_TXBCUSEDK BIT(6) -#define SCR_RXBCUSEDK BIT(7) - -#define USB_IS_HIGH_SPEED 0 -#define USB_IS_FULL_SPEED 1 -#define USB_SPEED_MASK BIT(5) - -#define USB_NORMAL_SIE_EP_MASK 0xF -#define USB_NORMAL_SIE_EP_SHIFT 4 - -#define USB_TEST_EP_MASK 0x30 -#define USB_TEST_EP_SHIFT 4 - -#define USB_AGG_EN BIT(3) - -#define LAST_ENTRY_OF_TX_PKT_BUFFER 255 - -#define POLLING_LLT_THRESHOLD 20 -#define POLLING_READY_TIMEOUT_COUNT 1000 - -#define MAX_MSS_DENSITY_2T 0x13 -#define MAX_MSS_DENSITY_1T 0x0A - -#define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6)) -#define EPROM_CMD_CONFIG 0x3 -#define EPROM_CMD_LOAD 1 - -#define HWSET_MAX_SIZE 128 -#define HWSET_MAX_SIZE_92S HWSET_MAX_SIZE -#define EFUSE_MAX_SECTION 16 - -#define WL_HWPDN_EN BIT(0) - -#define HAL_8192C_HW_GPIO_WPS_BIT BIT(2) - -#define RPMAC_RESET 0x100 -#define RPMAC_TXSTART 0x104 -#define RPMAC_TXLEGACYSIG 0x108 -#define RPMAC_TXHTSIG1 0x10c -#define RPMAC_TXHTSIG2 0x110 -#define RPMAC_PHYDEBUG 0x114 -#define RPMAC_TXPACKETNUM 0x118 -#define RPMAC_TXIDLE 0x11c -#define RPMAC_TXMACHEADER0 0x120 -#define RPMAC_TXMACHEADER1 0x124 -#define RPMAC_TXMACHEADER2 0x128 -#define RPMAC_TXMACHEADER3 0x12c -#define RPMAC_TXMACHEADER4 0x130 -#define RPMAC_TXMACHEADER5 0x134 -#define RPMAC_TXDADATYPE 0x138 -#define RPMAC_TXRANDOMSEED 0x13c -#define RPMAC_CCKPLCPPREAMBLE 0x140 -#define RPMAC_CCKPLCPHEADER 0x144 -#define RPMAC_CCKCRC16 0x148 -#define RPMAC_OFDMRXCRC32OK 0x170 -#define RPMAC_OFDMRXCRC32Er 0x174 -#define RPMAC_OFDMRXPARITYER 0x178 -#define RPMAC_OFDMRXCRC8ER 0x17c -#define RPMAC_CCKCRXRC16ER 0x180 -#define RPMAC_CCKCRXRC32ER 0x184 -#define RPMAC_CCKCRXRC32OK 0x188 -#define RPMAC_TXSTATUS 0x18c - -#define RFPGA0_RFMOD 0x800 - -#define RFPGA0_TXINFO 0x804 -#define RFPGA0_PSDFUNCTION 0x808 - -#define RFPGA0_TXGAINSTAGE 0x80c - -#define RFPGA0_RFTIMING1 0x810 -#define RFPGA0_RFTIMING2 0x814 - -#define RFPGA0_XA_HSSIPARAMETER1 0x820 -#define RFPGA0_XA_HSSIPARAMETER2 0x824 -#define RFPGA0_XB_HSSIPARAMETER1 0x828 -#define RFPGA0_XB_HSSIPARAMETER2 0x82c - -#define RFPGA0_XA_LSSIPARAMETER 0x840 -#define RFPGA0_XB_LSSIPARAMETER 0x844 - -#define RFPGA0_RFWAKEUPPARAMETER 0x850 -#define RFPGA0_RFSLEEPUPPARAMETER 0x854 - -#define RFPGA0_XAB_SWITCHCONTROL 0x858 -#define RFPGA0_XCD_SWITCHCONTROL 0x85c - -#define RFPGA0_XA_RFINTERFACEOE 0x860 -#define RFPGA0_XB_RFINTERFACEOE 0x864 - -#define RFPGA0_XAB_RFINTERFACESW 0x870 -#define RFPGA0_XCD_RFINTERFACESW 0x874 - -#define rFPGA0_XAB_RFPARAMETER 0x878 -#define rFPGA0_XCD_RFPARAMETER 0x87c - -#define RFPGA0_ANALOGPARAMETER1 0x880 -#define RFPGA0_ANALOGPARAMETER2 0x884 -#define RFPGA0_ANALOGPARAMETER3 0x888 -#define RFPGA0_ANALOGPARAMETER4 0x88c - -#define RFPGA0_XA_LSSIREADBACK 0x8a0 -#define RFPGA0_XB_LSSIREADBACK 0x8a4 -#define RFPGA0_XC_LSSIREADBACK 0x8a8 -#define RFPGA0_XD_LSSIREADBACK 0x8ac - -#define RFPGA0_PSDREPORT 0x8b4 -#define TRANSCEIVEA_HSPI_READBACK 0x8b8 -#define TRANSCEIVEB_HSPI_READBACK 0x8bc -#define RFPGA0_XAB_RFINTERFACERB 0x8e0 -#define RFPGA0_XCD_RFINTERFACERB 0x8e4 - -#define RFPGA1_RFMOD 0x900 - -#define RFPGA1_TXBLOCK 0x904 -#define RFPGA1_DEBUGSELECT 0x908 -#define RFPGA1_TXINFO 0x90c - -#define RCCK0_SYSTEM 0xa00 - -#define RCCK0_AFESETTING 0xa04 -#define RCCK0_CCA 0xa08 - -#define RCCK0_RXAGC1 0xa0c -#define RCCK0_RXAGC2 0xa10 - -#define RCCK0_RXHP 0xa14 - -#define RCCK0_DSPPARAMETER1 0xa18 -#define RCCK0_DSPPARAMETER2 0xa1c - -#define RCCK0_TXFILTER1 0xa20 -#define RCCK0_TXFILTER2 0xa24 -#define RCCK0_DEBUGPORT 0xa28 -#define RCCK0_FALSEALARMREPORT 0xa2c -#define RCCK0_TRSSIREPORT 0xa50 -#define RCCK0_RXREPORT 0xa54 -#define RCCK0_FACOUNTERLOWER 0xa5c -#define RCCK0_FACOUNTERUPPER 0xa58 - -#define ROFDM0_LSTF 0xc00 - -#define ROFDM0_TRXPATHENABLE 0xc04 -#define ROFDM0_TRMUXPAR 0xc08 -#define ROFDM0_TRSWISOLATION 0xc0c - -#define ROFDM0_XARXAFE 0xc10 -#define ROFDM0_XARXIQIMBALANCE 0xc14 -#define ROFDM0_XBRXAFE 0xc18 -#define ROFDM0_XBRXIQIMBALANCE 0xc1c -#define ROFDM0_XCRXAFE 0xc20 -#define ROFDM0_XCRXIQIMBANLANCE 0xc24 -#define ROFDM0_XDRXAFE 0xc28 -#define ROFDM0_XDRXIQIMBALANCE 0xc2c - -#define ROFDM0_RXDETECTOR1 0xc30 -#define ROFDM0_RXDETECTOR2 0xc34 -#define ROFDM0_RXDETECTOR3 0xc38 -#define ROFDM0_RXDETECTOR4 0xc3c - -#define ROFDM0_RXDSP 0xc40 -#define ROFDM0_CFOANDDAGC 0xc44 -#define ROFDM0_CCADROPTHRESHOLD 0xc48 -#define ROFDM0_ECCATHRESHOLD 0xc4c - -#define ROFDM0_XAAGCCORE1 0xc50 -#define ROFDM0_XAAGCCORE2 0xc54 -#define ROFDM0_XBAGCCORE1 0xc58 -#define ROFDM0_XBAGCCORE2 0xc5c -#define ROFDM0_XCAGCCORE1 0xc60 -#define ROFDM0_XCAGCCORE2 0xc64 -#define ROFDM0_XDAGCCORE1 0xc68 -#define ROFDM0_XDAGCCORE2 0xc6c - -#define ROFDM0_AGCPARAMETER1 0xc70 -#define ROFDM0_AGCPARAMETER2 0xc74 -#define ROFDM0_AGCRSSITABLE 0xc78 -#define ROFDM0_HTSTFAGC 0xc7c - -#define ROFDM0_XATXIQIMBALANCE 0xc80 -#define ROFDM0_XATXAFE 0xc84 -#define ROFDM0_XBTXIQIMBALANCE 0xc88 -#define ROFDM0_XBTXAFE 0xc8c -#define ROFDM0_XCTXIQIMBALANCE 0xc90 -#define ROFDM0_XCTXAFE 0xc94 -#define ROFDM0_XDTXIQIMBALANCE 0xc98 -#define ROFDM0_XDTXAFE 0xc9c - -#define ROFDM0_RXIQEXTANTA 0xca0 - -#define ROFDM0_RXHPPARAMETER 0xce0 -#define ROFDM0_TXPSEUDONOISEWGT 0xce4 -#define ROFDM0_FRAMESYNC 0xcf0 -#define ROFDM0_DFSREPORT 0xcf4 -#define ROFDM0_TXCOEFF1 0xca4 -#define ROFDM0_TXCOEFF2 0xca8 -#define ROFDM0_TXCOEFF3 0xcac -#define ROFDM0_TXCOEFF4 0xcb0 -#define ROFDM0_TXCOEFF5 0xcb4 -#define ROFDM0_TXCOEFF6 0xcb8 - -#define ROFDM1_LSTF 0xd00 -#define ROFDM1_TRXPATHENABLE 0xd04 - -#define ROFDM1_CF0 0xd08 -#define ROFDM1_CSI1 0xd10 -#define ROFDM1_SBD 0xd14 -#define ROFDM1_CSI2 0xd18 -#define ROFDM1_CFOTRACKING 0xd2c -#define ROFDM1_TRXMESAURE1 0xd34 -#define ROFDM1_INTFDET 0xd3c -#define ROFDM1_PSEUDONOISESTATEAB 0xd50 -#define ROFDM1_PSEUDONOISESTATECD 0xd54 -#define ROFDM1_RXPSEUDONOISEWGT 0xd58 - -#define ROFDM_PHYCOUNTER1 0xda0 -#define ROFDM_PHYCOUNTER2 0xda4 -#define ROFDM_PHYCOUNTER3 0xda8 - -#define ROFDM_SHORTCFOAB 0xdac -#define ROFDM_SHORTCFOCD 0xdb0 -#define ROFDM_LONGCFOAB 0xdb4 -#define ROFDM_LONGCFOCD 0xdb8 -#define ROFDM_TAILCF0AB 0xdbc -#define ROFDM_TAILCF0CD 0xdc0 -#define ROFDM_PWMEASURE1 0xdc4 -#define ROFDM_PWMEASURE2 0xdc8 -#define ROFDM_BWREPORT 0xdcc -#define ROFDM_AGCREPORT 0xdd0 -#define ROFDM_RXSNR 0xdd4 -#define ROFDM_RXEVMCSI 0xdd8 -#define ROFDM_SIGREPORT 0xddc - -#define RTXAGC_A_RATE18_06 0xe00 -#define RTXAGC_A_RATE54_24 0xe04 -#define RTXAGC_A_CCK1_MCS32 0xe08 -#define RTXAGC_A_MCS03_MCS00 0xe10 -#define RTXAGC_A_MCS07_MCS04 0xe14 -#define RTXAGC_A_MCS11_MCS08 0xe18 -#define RTXAGC_A_MCS15_MCS12 0xe1c - -#define RTXAGC_B_RATE18_06 0x830 -#define RTXAGC_B_RATE54_24 0x834 -#define RTXAGC_B_CCK1_55_MCS32 0x838 -#define RTXAGC_B_MCS03_MCS00 0x83c -#define RTXAGC_B_MCS07_MCS04 0x848 -#define RTXAGC_B_MCS11_MCS08 0x84c -#define RTXAGC_B_MCS15_MCS12 0x868 -#define RTXAGC_B_CCK11_A_CCK2_11 0x86c - -#define RZEBRA1_HSSIENABLE 0x0 -#define RZEBRA1_TRXENABLE1 0x1 -#define RZEBRA1_TRXENABLE2 0x2 -#define RZEBRA1_AGC 0x4 -#define RZEBRA1_CHARGEPUMP 0x5 -#define RZEBRA1_CHANNEL 0x7 - -#define RZEBRA1_TXGAIN 0x8 -#define RZEBRA1_TXLPF 0x9 -#define RZEBRA1_RXLPF 0xb -#define RZEBRA1_RXHPFCORNER 0xc - -#define RGLOBALCTRL 0 -#define RRTL8256_TXLPF 19 -#define RRTL8256_RXLPF 11 -#define RRTL8258_TXLPF 0x11 -#define RRTL8258_RXLPF 0x13 -#define RRTL8258_RSSILPF 0xa - -#define RF_AC 0x00 - -#define RF_IQADJ_G1 0x01 -#define RF_IQADJ_G2 0x02 -#define RF_POW_TRSW 0x05 - -#define RF_GAIN_RX 0x06 -#define RF_GAIN_TX 0x07 - -#define RF_TXM_IDAC 0x08 -#define RF_BS_IQGEN 0x0F - -#define RF_MODE1 0x10 -#define RF_MODE2 0x11 - -#define RF_RX_AGC_HP 0x12 -#define RF_TX_AGC 0x13 -#define RF_BIAS 0x14 -#define RF_IPA 0x15 -#define RF_POW_ABILITY 0x17 -#define RF_MODE_AG 0x18 -#define RRFCHANNEL 0x18 -#define RF_CHNLBW 0x18 -#define RF_TOP 0x19 - -#define RF_RX_G1 0x1A -#define RF_RX_G2 0x1B - -#define RF_RX_BB2 0x1C -#define RF_RX_BB1 0x1D - -#define RF_RCK1 0x1E -#define RF_RCK2 0x1F - -#define RF_TX_G1 0x20 -#define RF_TX_G2 0x21 -#define RF_TX_G3 0x22 - -#define RF_TX_BB1 0x23 -#define RF_T_METER 0x24 - -#define RF_SYN_G1 0x25 -#define RF_SYN_G2 0x26 -#define RF_SYN_G3 0x27 -#define RF_SYN_G4 0x28 -#define RF_SYN_G5 0x29 -#define RF_SYN_G6 0x2A -#define RF_SYN_G7 0x2B -#define RF_SYN_G8 0x2C - -#define RF_RCK_OS 0x30 -#define RF_TXPA_G1 0x31 -#define RF_TXPA_G2 0x32 -#define RF_TXPA_G3 0x33 - -#define BBBRESETB 0x100 -#define BGLOBALRESETB 0x200 -#define BOFDMTXSTART 0x4 -#define BCCKTXSTART 0x8 -#define BCRC32DEBUG 0x100 -#define BPMACLOOPBACK 0x10 -#define BTXLSIG 0xffffff -#define BOFDMTXRATE 0xf -#define BOFDMTXRESERVED 0x10 -#define BOFDMTXLENGTH 0x1ffe0 -#define BOFDMTXPARITY 0x20000 -#define BTXHTSIG1 0xffffff -#define BTXHTMCSRATE 0x7f -#define BTXHTBW 0x80 -#define BTXHTLENGTH 0xffff00 -#define BTXHTSIG2 0xffffff -#define BTXHTSMOOTHING 0x1 -#define BTXHTSOUNDING 0x2 -#define BTXHTRESERVED 0x4 -#define BTXHTAGGREATION 0x8 -#define BTXHTSTBC 0x30 -#define BTXHTADVANCECODING 0x40 -#define BTXHTSHORTGI 0x80 -#define BTXHTNUMBERHT_LTF 0x300 -#define BTXHTCRC8 0x3fc00 -#define BCOUNTERRESET 0x10000 -#define BNUMOFOFDMTX 0xffff -#define BNUMOFCCKTX 0xffff0000 -#define BTXIDLEINTERVAL 0xffff -#define BOFDMSERVICE 0xffff0000 -#define BTXMACHEADER 0xffffffff -#define BTXDATAINIT 0xff -#define BTXHTMODE 0x100 -#define BTXDATATYPE 0x30000 -#define BTXRANDOMSEED 0xffffffff -#define BCCKTXPREAMBLE 0x1 -#define BCCKTXSFD 0xffff0000 -#define BCCKTXSIG 0xff -#define BCCKTXSERVICE 0xff00 -#define BCCKLENGTHEXT 0x8000 -#define BCCKTXLENGHT 0xffff0000 -#define BCCKTXCRC16 0xffff -#define BCCKTXSTATUS 0x1 -#define BOFDMTXSTATUS 0x2 -#define IS_BB_REG_OFFSET_92S(_Offset) \ - ((_Offset >= 0x800) && (_Offset <= 0xfff)) - -#define BRFMOD 0x1 -#define BJAPANMODE 0x2 -#define BCCKTXSC 0x30 -#define BCCKEN 0x1000000 -#define BOFDMEN 0x2000000 - -#define BOFDMRXADCPHASE 0x10000 -#define BOFDMTXDACPHASE 0x40000 -#define BXATXAGC 0x3f - -#define BXBTXAGC 0xf00 -#define BXCTXAGC 0xf000 -#define BXDTXAGC 0xf0000 - -#define BPASTART 0xf0000000 -#define BTRSTART 0x00f00000 -#define BRFSTART 0x0000f000 -#define BBBSTART 0x000000f0 -#define BBBCCKSTART 0x0000000f -#define BPAEND 0xf -#define BTREND 0x0f000000 -#define BRFEND 0x000f0000 -#define BCCAMASK 0x000000f0 -#define BR2RCCAMASK 0x00000f00 -#define BHSSI_R2TDELAY 0xf8000000 -#define BHSSI_T2RDELAY 0xf80000 -#define BCONTXHSSI 0x400 -#define BIGFROMCCK 0x200 -#define BAGCADDRESS 0x3f -#define BRXHPTX 0x7000 -#define BRXHP2RX 0x38000 -#define BRXHPCCKINI 0xc0000 -#define BAGCTXCODE 0xc00000 -#define BAGCRXCODE 0x300000 - -#define B3WIREDATALENGTH 0x800 -#define B3WIREADDREAALENGTH 0x400 - -#define B3WIRERFPOWERDOWN 0x1 -#define B5GPAPEPOLARITY 0x40000000 -#define B2GPAPEPOLARITY 0x80000000 -#define BRFSW_TXDEFAULTANT 0x3 -#define BRFSW_TXOPTIONANT 0x30 -#define BRFSW_RXDEFAULTANT 0x300 -#define BRFSW_RXOPTIONANT 0x3000 -#define BRFSI_3WIREDATA 0x1 -#define BRFSI_3WIRECLOCK 0x2 -#define BRFSI_3WIRELOAD 0x4 -#define BRFSI_3WIRERW 0x8 -#define BRFSI_3WIRE 0xf - -#define BRFSI_RFENV 0x10 - -#define BRFSI_TRSW 0x20 -#define BRFSI_TRSWB 0x40 -#define BRFSI_ANTSW 0x100 -#define BRFSI_ANTSWB 0x200 -#define BRFSI_PAPE 0x400 -#define BRFSI_PAPE5G 0x800 -#define BBANDSELECT 0x1 -#define BHTSIG2_GI 0x80 -#define BHTSIG2_SMOOTHING 0x01 -#define BHTSIG2_SOUNDING 0x02 -#define BHTSIG2_AGGREATON 0x08 -#define BHTSIG2_STBC 0x30 -#define BHTSIG2_ADVCODING 0x40 -#define BHTSIG2_NUMOFHTLTF 0x300 -#define BHTSIG2_CRC8 0x3fc -#define BHTSIG1_MCS 0x7f -#define BHTSIG1_BANDWIDTH 0x80 -#define BHTSIG1_HTLENGTH 0xffff -#define BLSIG_RATE 0xf -#define BLSIG_RESERVED 0x10 -#define BLSIG_LENGTH 0x1fffe -#define BLSIG_PARITY 0x20 -#define BCCKRXPHASE 0x4 - -#define BLSSIREADADDRESS 0x7f800000 -#define BLSSIREADEDGE 0x80000000 - -#define BLSSIREADBACKDATA 0xfffff - -#define BLSSIREADOKFLAG 0x1000 -#define BCCKSAMPLERATE 0x8 -#define BREGULATOR0STANDBY 0x1 -#define BREGULATORPLLSTANDBY 0x2 -#define BREGULATOR1STANDBY 0x4 -#define BPLLPOWERUP 0x8 -#define BDPLLPOWERUP 0x10 -#define BDA10POWERUP 0x20 -#define BAD7POWERUP 0x200 -#define BDA6POWERUP 0x2000 -#define BXTALPOWERUP 0x4000 -#define B40MDCLKPOWERUP 0x8000 -#define BDA6DEBUGMODE 0x20000 -#define BDA6SWING 0x380000 - -#define BADCLKPHASE 0x4000000 -#define B80MCLKDELAY 0x18000000 -#define BAFEWATCHDOGENABLE 0x20000000 - -#define BXTALCAP01 0xc0000000 -#define BXTALCAP23 0x3 -#define BXTALCAP92X 0x0f000000 -#define BXTALCAP 0x0f000000 - -#define BINTDIFCLKENABLE 0x400 -#define BEXTSIGCLKENABLE 0x800 -#define BBANDGAP_MBIAS_POWERUP 0x10000 -#define BAD11SH_GAIN 0xc0000 -#define BAD11NPUT_RANGE 0x700000 -#define BAD110P_CURRENT 0x3800000 -#define BLPATH_LOOPBACK 0x4000000 -#define BQPATH_LOOPBACK 0x8000000 -#define BAFE_LOOPBACK 0x10000000 -#define BDA10_SWING 0x7e0 -#define BDA10_REVERSE 0x800 -#define BDA_CLK_SOURCE 0x1000 -#define BDA7INPUT_RANGE 0x6000 -#define BDA7_GAIN 0x38000 -#define BDA7OUTPUT_CM_MODE 0x40000 -#define BDA7INPUT_CM_MODE 0x380000 -#define BDA7CURRENT 0xc00000 -#define BREGULATOR_ADJUST 0x7000000 -#define BAD11POWERUP_ATTX 0x1 -#define BDA10PS_ATTX 0x10 -#define BAD11POWERUP_ATRX 0x100 -#define BDA10PS_ATRX 0x1000 -#define BCCKRX_AGC_FORMAT 0x200 -#define BPSDFFT_SAMPLE_POINT 0xc000 -#define BPSD_AVERAGE_NUM 0x3000 -#define BIQPATH_CONTROL 0xc00 -#define BPSD_FREQ 0x3ff -#define BPSD_ANTENNA_PATH 0x30 -#define BPSD_IQ_SWITCH 0x40 -#define BPSD_RX_TRIGGER 0x400000 -#define BPSD_TX_TRIGGER 0x80000000 -#define BPSD_SINE_TONE_SCALE 0x7f000000 -#define BPSD_REPORT 0xffff - -#define BOFDM_TXSC 0x30000000 -#define BCCK_TXON 0x1 -#define BOFDM_TXON 0x2 -#define BDEBUG_PAGE 0xfff -#define BDEBUG_ITEM 0xff -#define BANTL 0x10 -#define BANT_NONHT 0x100 -#define BANT_HT1 0x1000 -#define BANT_HT2 0x10000 -#define BANT_HT1S1 0x100000 -#define BANT_NONHTS1 0x1000000 - -#define BCCK_BBMODE 0x3 -#define BCCK_TXPOWERSAVING 0x80 -#define BCCK_RXPOWERSAVING 0x40 - -#define BCCK_SIDEBAND 0x10 - -#define BCCK_SCRAMBLE 0x8 -#define BCCK_ANTDIVERSITY 0x8000 -#define BCCK_CARRIER_RECOVERY 0x4000 -#define BCCK_TXRATE 0x3000 -#define BCCK_DCCANCEL 0x0800 -#define BCCK_ISICANCEL 0x0400 -#define BCCK_MATCH_FILTER 0x0200 -#define BCCK_EQUALIZER 0x0100 -#define BCCK_PREAMBLE_DETECT 0x800000 -#define BCCK_FAST_FALSECCA 0x400000 -#define BCCK_CH_ESTSTART 0x300000 -#define BCCK_CCA_COUNT 0x080000 -#define BCCK_CS_LIM 0x070000 -#define BCCK_BIST_MODE 0x80000000 -#define BCCK_CCAMASK 0x40000000 -#define BCCK_TX_DAC_PHASE 0x4 -#define BCCK_RX_ADC_PHASE 0x20000000 -#define BCCKR_CP_MODE 0x0100 -#define BCCK_TXDC_OFFSET 0xf0 -#define BCCK_RXDC_OFFSET 0xf -#define BCCK_CCA_MODE 0xc000 -#define BCCK_FALSECS_LIM 0x3f00 -#define BCCK_CS_RATIO 0xc00000 -#define BCCK_CORGBIT_SEL 0x300000 -#define BCCK_PD_LIM 0x0f0000 -#define BCCK_NEWCCA 0x80000000 -#define BCCK_RXHP_OF_IG 0x8000 -#define BCCK_RXIG 0x7f00 -#define BCCK_LNA_POLARITY 0x800000 -#define BCCK_RX1ST_BAIN 0x7f0000 -#define BCCK_RF_EXTEND 0x20000000 -#define BCCK_RXAGC_SATLEVEL 0x1f000000 -#define BCCK_RXAGC_SATCOUNT 0xe0 -#define bCCKRxRFSettle 0x1f -#define BCCK_FIXED_RXAGC 0x8000 -#define BCCK_ANTENNA_POLARITY 0x2000 -#define BCCK_TXFILTER_TYPE 0x0c00 -#define BCCK_RXAGC_REPORTTYPE 0x0300 -#define BCCK_RXDAGC_EN 0x80000000 -#define BCCK_RXDAGC_PERIOD 0x20000000 -#define BCCK_RXDAGC_SATLEVEL 0x1f000000 -#define BCCK_TIMING_RECOVERY 0x800000 -#define BCCK_TXC0 0x3f0000 -#define BCCK_TXC1 0x3f000000 -#define BCCK_TXC2 0x3f -#define BCCK_TXC3 0x3f00 -#define BCCK_TXC4 0x3f0000 -#define BCCK_TXC5 0x3f000000 -#define BCCK_TXC6 0x3f -#define BCCK_TXC7 0x3f00 -#define BCCK_DEBUGPORT 0xff0000 -#define BCCK_DAC_DEBUG 0x0f000000 -#define BCCK_FALSEALARM_ENABLE 0x8000 -#define BCCK_FALSEALARM_READ 0x4000 -#define BCCK_TRSSI 0x7f -#define BCCK_RXAGC_REPORT 0xfe -#define BCCK_RXREPORT_ANTSEL 0x80000000 -#define BCCK_RXREPORT_MFOFF 0x40000000 -#define BCCK_RXREPORT_SQLOSS 0x20000000 -#define BCCK_RXREPORT_PKTLOSS 0x10000000 -#define BCCK_RXREPORT_LOCKEDBIT 0x08000000 -#define BCCK_RXREPORT_RATEERROR 0x04000000 -#define BCCK_RXREPORT_RXRATE 0x03000000 -#define BCCK_RXFA_COUNTER_LOWER 0xff -#define BCCK_RXFA_COUNTER_UPPER 0xff000000 -#define BCCK_RXHPAGC_START 0xe000 -#define BCCK_RXHPAGC_FINAL 0x1c00 -#define BCCK_RXFALSEALARM_ENABLE 0x8000 -#define BCCK_FACOUNTER_FREEZE 0x4000 -#define BCCK_TXPATH_SEL 0x10000000 -#define BCCK_DEFAULT_RXPATH 0xc000000 -#define BCCK_OPTION_RXPATH 0x3000000 - -#define BNUM_OFSTF 0x3 -#define BSHIFT_L 0xc0 -#define BGI_TH 0xc -#define BRXPATH_A 0x1 -#define BRXPATH_B 0x2 -#define BRXPATH_C 0x4 -#define BRXPATH_D 0x8 -#define BTXPATH_A 0x1 -#define BTXPATH_B 0x2 -#define BTXPATH_C 0x4 -#define BTXPATH_D 0x8 -#define BTRSSI_FREQ 0x200 -#define BADC_BACKOFF 0x3000 -#define BDFIR_BACKOFF 0xc000 -#define BTRSSI_LATCH_PHASE 0x10000 -#define BRX_LDC_OFFSET 0xff -#define BRX_QDC_OFFSET 0xff00 -#define BRX_DFIR_MODE 0x1800000 -#define BRX_DCNF_TYPE 0xe000000 -#define BRXIQIMB_A 0x3ff -#define BRXIQIMB_B 0xfc00 -#define BRXIQIMB_C 0x3f0000 -#define BRXIQIMB_D 0xffc00000 -#define BDC_DC_NOTCH 0x60000 -#define BRXNB_NOTCH 0x1f000000 -#define BPD_TH 0xf -#define BPD_TH_OPT2 0xc000 -#define BPWED_TH 0x700 -#define BIFMF_WIN_L 0x800 -#define BPD_OPTION 0x1000 -#define BMF_WIN_L 0xe000 -#define BBW_SEARCH_L 0x30000 -#define BWIN_ENH_L 0xc0000 -#define BBW_TH 0x700000 -#define BED_TH2 0x3800000 -#define BBW_OPTION 0x4000000 -#define BRADIO_TH 0x18000000 -#define BWINDOW_L 0xe0000000 -#define BSBD_OPTION 0x1 -#define BFRAME_TH 0x1c -#define BFS_OPTION 0x60 -#define BDC_SLOPE_CHECK 0x80 -#define BFGUARD_COUNTER_DC_L 0xe00 -#define BFRAME_WEIGHT_SHORT 0x7000 -#define BSUB_TUNE 0xe00000 -#define BFRAME_DC_LENGTH 0xe000000 -#define BSBD_START_OFFSET 0x30000000 -#define BFRAME_TH_2 0x7 -#define BFRAME_GI2_TH 0x38 -#define BGI2_SYNC_EN 0x40 -#define BSARCH_SHORT_EARLY 0x300 -#define BSARCH_SHORT_LATE 0xc00 -#define BSARCH_GI2_LATE 0x70000 -#define BCFOANTSUM 0x1 -#define BCFOACC 0x2 -#define BCFOSTARTOFFSET 0xc -#define BCFOLOOPBACK 0x70 -#define BCFOSUMWEIGHT 0x80 -#define BDAGCENABLE 0x10000 -#define BTXIQIMB_A 0x3ff -#define BTXIQIMB_b 0xfc00 -#define BTXIQIMB_C 0x3f0000 -#define BTXIQIMB_D 0xffc00000 -#define BTXIDCOFFSET 0xff -#define BTXIQDCOFFSET 0xff00 -#define BTXDFIRMODE 0x10000 -#define BTXPESUDO_NOISEON 0x4000000 -#define BTXPESUDO_NOISE_A 0xff -#define BTXPESUDO_NOISE_B 0xff00 -#define BTXPESUDO_NOISE_C 0xff0000 -#define BTXPESUDO_NOISE_D 0xff000000 -#define BCCA_DROPOPTION 0x20000 -#define BCCA_DROPTHRES 0xfff00000 -#define BEDCCA_H 0xf -#define BEDCCA_L 0xf0 -#define BLAMBDA_ED 0x300 -#define BRX_INITIALGAIN 0x7f -#define BRX_ANTDIV_EN 0x80 -#define BRX_AGC_ADDRESS_FOR_LNA 0x7f00 -#define BRX_HIGHPOWER_FLOW 0x8000 -#define BRX_AGC_FREEZE_THRES 0xc0000 -#define BRX_FREEZESTEP_AGC1 0x300000 -#define BRX_FREEZESTEP_AGC2 0xc00000 -#define BRX_FREEZESTEP_AGC3 0x3000000 -#define BRX_FREEZESTEP_AGC0 0xc000000 -#define BRXRSSI_CMP_EN 0x10000000 -#define BRXQUICK_AGCEN 0x20000000 -#define BRXAGC_FREEZE_THRES_MODE 0x40000000 -#define BRX_OVERFLOW_CHECKTYPE 0x80000000 -#define BRX_AGCSHIFT 0x7f -#define BTRSW_TRI_ONLY 0x80 -#define BPOWER_THRES 0x300 -#define BRXAGC_EN 0x1 -#define BRXAGC_TOGETHER_EN 0x2 -#define BRXAGC_MIN 0x4 -#define BRXHP_INI 0x7 -#define BRXHP_TRLNA 0x70 -#define BRXHP_RSSI 0x700 -#define BRXHP_BBP1 0x7000 -#define BRXHP_BBP2 0x70000 -#define BRXHP_BBP3 0x700000 -#define BRSSI_H 0x7f0000 -#define BRSSI_GEN 0x7f000000 -#define BRXSETTLE_TRSW 0x7 -#define BRXSETTLE_LNA 0x38 -#define BRXSETTLE_RSSI 0x1c0 -#define BRXSETTLE_BBP 0xe00 -#define BRXSETTLE_RXHP 0x7000 -#define BRXSETTLE_ANTSW_RSSI 0x38000 -#define BRXSETTLE_ANTSW 0xc0000 -#define BRXPROCESS_TIME_DAGC 0x300000 -#define BRXSETTLE_HSSI 0x400000 -#define BRXPROCESS_TIME_BBPPW 0x800000 -#define BRXANTENNA_POWER_SHIFT 0x3000000 -#define BRSSI_TABLE_SELECT 0xc000000 -#define BRXHP_FINAL 0x7000000 -#define BRXHPSETTLE_BBP 0x7 -#define BRXHTSETTLE_HSSI 0x8 -#define BRXHTSETTLE_RXHP 0x70 -#define BRXHTSETTLE_BBPPW 0x80 -#define BRXHTSETTLE_IDLE 0x300 -#define BRXHTSETTLE_RESERVED 0x1c00 -#define BRXHT_RXHP_EN 0x8000 -#define BRXAGC_FREEZE_THRES 0x30000 -#define BRXAGC_TOGETHEREN 0x40000 -#define BRXHTAGC_MIN 0x80000 -#define BRXHTAGC_EN 0x100000 -#define BRXHTDAGC_EN 0x200000 -#define BRXHT_RXHP_BBP 0x1c00000 -#define BRXHT_RXHP_FINAL 0xe0000000 -#define BRXPW_RADIO_TH 0x3 -#define BRXPW_RADIO_EN 0x4 -#define BRXMF_HOLD 0x3800 -#define BRXPD_DELAY_TH1 0x38 -#define BRXPD_DELAY_TH2 0x1c0 -#define BRXPD_DC_COUNT_MAX 0x600 -#define BRXPD_DELAY_TH 0x8000 -#define BRXPROCESS_DELAY 0xf0000 -#define BRXSEARCHRANGE_GI2_EARLY 0x700000 -#define BRXFRAME_FUARD_COUNTER_L 0x3800000 -#define BRXSGI_GUARD_L 0xc000000 -#define BRXSGI_SEARCH_L 0x30000000 -#define BRXSGI_TH 0xc0000000 -#define BDFSCNT0 0xff -#define BDFSCNT1 0xff00 -#define BDFSFLAG 0xf0000 -#define BMF_WEIGHT_SUM 0x300000 -#define BMINIDX_TH 0x7f000000 -#define BDAFORMAT 0x40000 -#define BTXCH_EMU_ENABLE 0x01000000 -#define BTRSW_ISOLATION_A 0x7f -#define BTRSW_ISOLATION_B 0x7f00 -#define BTRSW_ISOLATION_C 0x7f0000 -#define BTRSW_ISOLATION_D 0x7f000000 -#define BEXT_LNA_GAIN 0x7c00 - -#define BSTBC_EN 0x4 -#define BANTENNA_MAPPING 0x10 -#define BNSS 0x20 -#define BCFO_ANTSUM_ID 0x200 -#define BPHY_COUNTER_RESET 0x8000000 -#define BCFO_REPORT_GET 0x4000000 -#define BOFDM_CONTINUE_TX 0x10000000 -#define BOFDM_SINGLE_CARRIER 0x20000000 -#define BOFDM_SINGLE_TONE 0x40000000 -#define BHT_DETECT 0x100 -#define BCFOEN 0x10000 -#define BCFOVALUE 0xfff00000 -#define BSIGTONE_RE 0x3f -#define BSIGTONE_IM 0x7f00 -#define BCOUNTER_CCA 0xffff -#define BCOUNTER_PARITYFAIL 0xffff0000 -#define BCOUNTER_RATEILLEGAL 0xffff -#define BCOUNTER_CRC8FAIL 0xffff0000 -#define BCOUNTER_MCSNOSUPPORT 0xffff -#define BCOUNTER_FASTSYNC 0xffff -#define BSHORTCFO 0xfff -#define BSHORTCFOT_LENGTH 12 -#define BSHORTCFOF_LENGTH 11 -#define BLONGCFO 0x7ff -#define BLONGCFOT_LENGTH 11 -#define BLONGCFOF_LENGTH 11 -#define BTAILCFO 0x1fff -#define BTAILCFOT_LENGTH 13 -#define BTAILCFOF_LENGTH 12 -#define BNOISE_EN_PWDB 0xffff -#define BCC_POWER_DB 0xffff0000 -#define BMOISE_PWDB 0xffff -#define BPOWERMEAST_LENGTH 10 -#define BPOWERMEASF_LENGTH 3 -#define BRX_HT_BW 0x1 -#define BRXSC 0x6 -#define BRX_HT 0x8 -#define BNB_INTF_DET_ON 0x1 -#define BINTF_WIN_LEN_CFG 0x30 -#define BNB_INTF_TH_CFG 0x1c0 -#define BRFGAIN 0x3f -#define BTABLESEL 0x40 -#define BTRSW 0x80 -#define BRXSNR_A 0xff -#define BRXSNR_B 0xff00 -#define BRXSNR_C 0xff0000 -#define BRXSNR_D 0xff000000 -#define BSNR_EVMT_LENGTH 8 -#define BSNR_EVMF_LENGTH 1 -#define BCSI1ST 0xff -#define BCSI2ND 0xff00 -#define BRXEVM1ST 0xff0000 -#define BRXEVM2ND 0xff000000 -#define BSIGEVM 0xff -#define BPWDB 0xff00 -#define BSGIEN 0x10000 - -#define BSFACTOR_QMA1 0xf -#define BSFACTOR_QMA2 0xf0 -#define BSFACTOR_QMA3 0xf00 -#define BSFACTOR_QMA4 0xf000 -#define BSFACTOR_QMA5 0xf0000 -#define BSFACTOR_QMA6 0xf0000 -#define BSFACTOR_QMA7 0xf00000 -#define BSFACTOR_QMA8 0xf000000 -#define BSFACTOR_QMA9 0xf0000000 -#define BCSI_SCHEME 0x100000 - -#define BNOISE_LVL_TOP_SET 0x3 -#define BCHSMOOTH 0x4 -#define BCHSMOOTH_CFG1 0x38 -#define BCHSMOOTH_CFG2 0x1c0 -#define BCHSMOOTH_CFG3 0xe00 -#define BCHSMOOTH_CFG4 0x7000 -#define BMRCMODE 0x800000 -#define BTHEVMCFG 0x7000000 - -#define BLOOP_FIT_TYPE 0x1 -#define BUPD_CFO 0x40 -#define BUPD_CFO_OFFDATA 0x80 -#define BADV_UPD_CFO 0x100 -#define BADV_TIME_CTRL 0x800 -#define BUPD_CLKO 0x1000 -#define BFC 0x6000 -#define BTRACKING_MODE 0x8000 -#define BPHCMP_ENABLE 0x10000 -#define BUPD_CLKO_LTF 0x20000 -#define BCOM_CH_CFO 0x40000 -#define BCSI_ESTI_MODE 0x80000 -#define BADV_UPD_EQZ 0x100000 -#define BUCHCFG 0x7000000 -#define BUPDEQZ 0x8000000 - -#define BRX_PESUDO_NOISE_ON 0x20000000 -#define BRX_PESUDO_NOISE_A 0xff -#define BRX_PESUDO_NOISE_B 0xff00 -#define BRX_PESUDO_NOISE_C 0xff0000 -#define BRX_PESUDO_NOISE_D 0xff000000 -#define BRX_PESUDO_NOISESTATE_A 0xffff -#define BRX_PESUDO_NOISESTATE_B 0xffff0000 -#define BRX_PESUDO_NOISESTATE_C 0xffff -#define BRX_PESUDO_NOISESTATE_D 0xffff0000 - -#define BZEBRA1_HSSIENABLE 0x8 -#define BZEBRA1_TRXCONTROL 0xc00 -#define BZEBRA1_TRXGAINSETTING 0x07f -#define BZEBRA1_RXCOUNTER 0xc00 -#define BZEBRA1_TXCHANGEPUMP 0x38 -#define BZEBRA1_RXCHANGEPUMP 0x7 -#define BZEBRA1_CHANNEL_NUM 0xf80 -#define BZEBRA1_TXLPFBW 0x400 -#define BZEBRA1_RXLPFBW 0x600 - -#define BRTL8256REG_MODE_CTRL1 0x100 -#define BRTL8256REG_MODE_CTRL0 0x40 -#define BRTL8256REG_TXLPFBW 0x18 -#define BRTL8256REG_RXLPFBW 0x600 - -#define BRTL8258_TXLPFBW 0xc -#define BRTL8258_RXLPFBW 0xc00 -#define BRTL8258_RSSILPFBW 0xc0 - -#define BBYTE0 0x1 -#define BBYTE1 0x2 -#define BBYTE2 0x4 -#define BBYTE3 0x8 -#define BWORD0 0x3 -#define BWORD1 0xc -#define BWORD 0xf - -#define MASKBYTE0 0xff -#define MASKBYTE1 0xff00 -#define MASKBYTE2 0xff0000 -#define MASKBYTE3 0xff000000 -#define MASKHWORD 0xffff0000 -#define MASKLWORD 0x0000ffff -#define MASKDWORD 0xffffffff -#define MASK12BITS 0xfff -#define MASKH4BITS 0xf0000000 -#define MASKOFDM_D 0xffc00000 -#define MASKCCK 0x3f3f3f3f - -#define MASK4BITS 0x0f -#define MASK20BITS 0xfffff -#define RFREG_OFFSET_MASK 0xfffff - -#define BENABLE 0x1 -#define BDISABLE 0x0 - -#define LEFT_ANTENNA 0x0 -#define RIGHT_ANTENNA 0x1 - -#define TCHECK_TXSTATUS 500 -#define TUPDATE_RXCOUNTER 100 - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c deleted file mode 100644 index a9c406f33d0a..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.c +++ /dev/null @@ -1,509 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" - -static bool _rtl92ce_phy_rf6052_config_parafile(struct ieee80211_hw *hw); - -void rtl92ce_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - switch (bandwidth) { - case HT_CHANNEL_WIDTH_20: - rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] & - 0xfffff3ff) | 0x0400); - rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK, - rtlphy->rfreg_chnlval[0]); - break; - case HT_CHANNEL_WIDTH_20_40: - rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] & - 0xfffff3ff)); - rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK, - rtlphy->rfreg_chnlval[0]); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", bandwidth); - break; - } -} - -void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u32 tx_agc[2] = {0, 0}, tmpval; - bool turbo_scanoff = false; - u8 idx1, idx2; - u8 *ptr; - - if (rtlefuse->eeprom_regulatory != 0) - turbo_scanoff = true; - - if (mac->act_scanning) { - tx_agc[RF90_PATH_A] = 0x3f3f3f3f; - tx_agc[RF90_PATH_B] = 0x3f3f3f3f; - - if (turbo_scanoff) { - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - tx_agc[idx1] = ppowerlevel[idx1] | - (ppowerlevel[idx1] << 8) | - (ppowerlevel[idx1] << 16) | - (ppowerlevel[idx1] << 24); - } - } - } else { - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - tx_agc[idx1] = ppowerlevel[idx1] | - (ppowerlevel[idx1] << 8) | - (ppowerlevel[idx1] << 16) | - (ppowerlevel[idx1] << 24); - } - - if (rtlefuse->eeprom_regulatory == 0) { - tmpval = (rtlphy->mcs_offset[0][6]) + - (rtlphy->mcs_offset[0][7] << 8); - tx_agc[RF90_PATH_A] += tmpval; - - tmpval = (rtlphy->mcs_offset[0][14]) + - (rtlphy->mcs_offset[0][15] << 24); - tx_agc[RF90_PATH_B] += tmpval; - } - } - - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - ptr = (u8 *) (&(tx_agc[idx1])); - for (idx2 = 0; idx2 < 4; idx2++) { - if (*ptr > RF6052_MAX_TX_PWR) - *ptr = RF6052_MAX_TX_PWR; - ptr++; - } - } - - tmpval = tx_agc[RF90_PATH_A] & 0xff; - rtl_set_bbreg(hw, RTXAGC_A_CCK1_MCS32, MASKBYTE1, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n", - tmpval, RTXAGC_A_CCK1_MCS32); - - tmpval = tx_agc[RF90_PATH_A] >> 8; - - tmpval = tmpval & 0xff00ffff; - - rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n", - tmpval, RTXAGC_B_CCK11_A_CCK2_11); - - tmpval = tx_agc[RF90_PATH_B] >> 24; - rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, MASKBYTE0, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n", - tmpval, RTXAGC_B_CCK11_A_CCK2_11); - - tmpval = tx_agc[RF90_PATH_B] & 0x00ffffff; - rtl_set_bbreg(hw, RTXAGC_B_CCK1_55_MCS32, 0xffffff00, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n", - tmpval, RTXAGC_B_CCK1_55_MCS32); -} - -static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel, - u32 *ofdmbase, u32 *mcsbase) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u32 powerBase0, powerBase1; - u8 legacy_pwrdiff, ht20_pwrdiff; - u8 i, powerlevel[2]; - - for (i = 0; i < 2; i++) { - powerlevel[i] = ppowerlevel[i]; - legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff[i][channel - 1]; - powerBase0 = powerlevel[i] + legacy_pwrdiff; - - powerBase0 = (powerBase0 << 24) | (powerBase0 << 16) | - (powerBase0 << 8) | powerBase0; - *(ofdmbase + i) = powerBase0; - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - " [OFDM power base index rf(%c) = 0x%x]\n", - i == 0 ? 'A' : 'B', *(ofdmbase + i)); - } - - for (i = 0; i < 2; i++) { - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) { - ht20_pwrdiff = rtlefuse->txpwr_ht20diff[i][channel - 1]; - powerlevel[i] += ht20_pwrdiff; - } - powerBase1 = powerlevel[i]; - powerBase1 = (powerBase1 << 24) | - (powerBase1 << 16) | (powerBase1 << 8) | powerBase1; - - *(mcsbase + i) = powerBase1; - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - " [MCS power base index rf(%c) = 0x%x]\n", - i == 0 ? 'A' : 'B', *(mcsbase + i)); - } -} - -static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw, - u8 channel, u8 index, - u32 *powerBase0, - u32 *powerBase1, - u32 *p_outwriteval) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 i, chnlgroup = 0, pwr_diff_limit[4]; - u32 writeVal, customer_limit, rf; - - for (rf = 0; rf < 2; rf++) { - switch (rtlefuse->eeprom_regulatory) { - case 0: - chnlgroup = 0; - - writeVal = rtlphy->mcs_offset[chnlgroup][index + - (rf ? 8 : 0)] - + ((index < 2) ? powerBase0[rf] : powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "RTK better performance, writeVal(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', writeVal); - break; - case 1: - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - writeVal = ((index < 2) ? powerBase0[rf] : - powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Realtek regulatory, 40MHz, writeVal(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', writeVal); - } else { - if (rtlphy->pwrgroup_cnt == 1) - chnlgroup = 0; - if (rtlphy->pwrgroup_cnt >= 3) { - if (channel <= 3) - chnlgroup = 0; - else if (channel >= 4 && channel <= 9) - chnlgroup = 1; - else if (channel > 9) - chnlgroup = 2; - if (rtlphy->pwrgroup_cnt == 4) - chnlgroup++; - } - - writeVal = rtlphy->mcs_offset[chnlgroup] - [index + (rf ? 8 : 0)] + ((index < 2) ? - powerBase0[rf] : - powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', writeVal); - } - break; - case 2: - writeVal = - ((index < 2) ? powerBase0[rf] : powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Better regulatory, writeVal(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', writeVal); - break; - case 3: - chnlgroup = 0; - - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "customer's limit, 40MHz rf(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', - rtlefuse->pwrgroup_ht40[rf][channel - - 1]); - } else { - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "customer's limit, 20MHz rf(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', - rtlefuse->pwrgroup_ht20[rf][channel - - 1]); - } - for (i = 0; i < 4; i++) { - pwr_diff_limit[i] = (u8) ((rtlphy->mcs_offset - [chnlgroup][index + - (rf ? 8 : 0)] & (0x7f << (i * 8))) >> - (i * 8)); - - if (rtlphy->current_chan_bw == - HT_CHANNEL_WIDTH_20_40) { - if (pwr_diff_limit[i] > - rtlefuse-> - pwrgroup_ht40[rf][channel - 1]) - pwr_diff_limit[i] = - rtlefuse->pwrgroup_ht40[rf] - [channel - 1]; - } else { - if (pwr_diff_limit[i] > - rtlefuse-> - pwrgroup_ht20[rf][channel - 1]) - pwr_diff_limit[i] = - rtlefuse->pwrgroup_ht20[rf] - [channel - 1]; - } - } - - customer_limit = (pwr_diff_limit[3] << 24) | - (pwr_diff_limit[2] << 16) | - (pwr_diff_limit[1] << 8) | (pwr_diff_limit[0]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Customer's limit rf(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', customer_limit); - - writeVal = customer_limit + - ((index < 2) ? powerBase0[rf] : powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Customer, writeVal rf(%c)= 0x%x\n", - rf == 0 ? 'A' : 'B', writeVal); - break; - default: - chnlgroup = 0; - writeVal = rtlphy->mcs_offset[chnlgroup] - [index + (rf ? 8 : 0)] - + ((index < 2) ? powerBase0[rf] : powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "RTK better performance, writeVal rf(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', writeVal); - break; - } - - if (rtlpriv->dm.dynamic_txhighpower_lvl == TXHIGHPWRLEVEL_BT1) - writeVal = writeVal - 0x06060606; - else if (rtlpriv->dm.dynamic_txhighpower_lvl == - TXHIGHPWRLEVEL_BT2) - writeVal = writeVal - 0x0c0c0c0c; - *(p_outwriteval + rf) = writeVal; - } -} - -static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw, - u8 index, u32 *pValue) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - u16 regoffset_a[6] = { - RTXAGC_A_RATE18_06, RTXAGC_A_RATE54_24, - RTXAGC_A_MCS03_MCS00, RTXAGC_A_MCS07_MCS04, - RTXAGC_A_MCS11_MCS08, RTXAGC_A_MCS15_MCS12 - }; - u16 regoffset_b[6] = { - RTXAGC_B_RATE18_06, RTXAGC_B_RATE54_24, - RTXAGC_B_MCS03_MCS00, RTXAGC_B_MCS07_MCS04, - RTXAGC_B_MCS11_MCS08, RTXAGC_B_MCS15_MCS12 - }; - u8 i, rf, pwr_val[4]; - u32 writeVal; - u16 regoffset; - - for (rf = 0; rf < 2; rf++) { - writeVal = pValue[rf]; - for (i = 0; i < 4; i++) { - pwr_val[i] = (u8) ((writeVal & (0x7f << - (i * 8))) >> (i * 8)); - - if (pwr_val[i] > RF6052_MAX_TX_PWR) - pwr_val[i] = RF6052_MAX_TX_PWR; - } - writeVal = (pwr_val[3] << 24) | (pwr_val[2] << 16) | - (pwr_val[1] << 8) | pwr_val[0]; - - if (rf == 0) - regoffset = regoffset_a[index]; - else - regoffset = regoffset_b[index]; - rtl_set_bbreg(hw, regoffset, MASKDWORD, writeVal); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Set 0x%x = %08x\n", regoffset, writeVal); - - if (((get_rf_type(rtlphy) == RF_2T2R) && - (regoffset == RTXAGC_A_MCS15_MCS12 || - regoffset == RTXAGC_B_MCS15_MCS12)) || - ((get_rf_type(rtlphy) != RF_2T2R) && - (regoffset == RTXAGC_A_MCS07_MCS04 || - regoffset == RTXAGC_B_MCS07_MCS04))) { - - writeVal = pwr_val[3]; - if (regoffset == RTXAGC_A_MCS15_MCS12 || - regoffset == RTXAGC_A_MCS07_MCS04) - regoffset = 0xc90; - if (regoffset == RTXAGC_B_MCS15_MCS12 || - regoffset == RTXAGC_B_MCS07_MCS04) - regoffset = 0xc98; - - for (i = 0; i < 3; i++) { - writeVal = (writeVal > 6) ? (writeVal - 6) : 0; - rtl_write_byte(rtlpriv, (u32) (regoffset + i), - (u8) writeVal); - } - } - } -} - -void rtl92ce_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel) -{ - u32 writeVal[2], powerBase0[2], powerBase1[2]; - u8 index; - - rtl92c_phy_get_power_base(hw, ppowerlevel, - channel, &powerBase0[0], &powerBase1[0]); - - for (index = 0; index < 6; index++) { - _rtl92c_get_txpower_writeval_by_regulatory(hw, - channel, index, - &powerBase0[0], - &powerBase1[0], - &writeVal[0]); - - _rtl92c_write_ofdm_power_reg(hw, index, &writeVal[0]); - } -} - -bool rtl92ce_phy_rf6052_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - if (rtlphy->rf_type == RF_1T1R) - rtlphy->num_total_rfpath = 1; - else - rtlphy->num_total_rfpath = 2; - - return _rtl92ce_phy_rf6052_config_parafile(hw); - -} - -static bool _rtl92ce_phy_rf6052_config_parafile(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 u4_regvalue = 0; - u8 rfpath; - bool rtstatus = true; - struct bb_reg_def *pphyreg; - - for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) { - - pphyreg = &rtlphy->phyreg_def[rfpath]; - - switch (rfpath) { - case RF90_PATH_A: - case RF90_PATH_C: - u4_regvalue = rtl_get_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV); - break; - case RF90_PATH_B: - case RF90_PATH_D: - u4_regvalue = rtl_get_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV << 16); - break; - } - - rtl_set_bbreg(hw, pphyreg->rfintfe, BRFSI_RFENV << 16, 0x1); - udelay(1); - - rtl_set_bbreg(hw, pphyreg->rfintfo, BRFSI_RFENV, 0x1); - udelay(1); - - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, - B3WIREADDREAALENGTH, 0x0); - udelay(1); - - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, B3WIREDATALENGTH, 0x0); - udelay(1); - - switch (rfpath) { - case RF90_PATH_A: - rtstatus = rtl92c_phy_config_rf_with_headerfile(hw, - (enum radio_path)rfpath); - break; - case RF90_PATH_B: - rtstatus = rtl92c_phy_config_rf_with_headerfile(hw, - (enum radio_path)rfpath); - break; - case RF90_PATH_C: - break; - case RF90_PATH_D: - break; - } - - switch (rfpath) { - case RF90_PATH_A: - case RF90_PATH_C: - rtl_set_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV, u4_regvalue); - break; - case RF90_PATH_B: - case RF90_PATH_D: - rtl_set_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV << 16, u4_regvalue); - break; - } - - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Radio[%d] Fail!!\n", rfpath); - return false; - } - - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "<---\n"); - return rtstatus; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h deleted file mode 100644 index 6c8d56efceae..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h +++ /dev/null @@ -1,44 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C_RF_H__ -#define __RTL92C_RF_H__ - -#define RF6052_MAX_TX_PWR 0x3F -#define RF6052_MAX_REG 0x3F -#define RF6052_MAX_PATH 2 - -extern void rtl92ce_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, - u8 bandwidth); -extern void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel); -extern void rtl92ce_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel); -extern bool rtl92ce_phy_rf6052_config(struct ieee80211_hw *hw); -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c deleted file mode 100644 index 14203561b6ee..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c +++ /dev/null @@ -1,387 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../core.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "hw.h" -#include "rf.h" -#include "sw.h" -#include "trx.h" -#include "led.h" - -#include - -static void rtl92c_init_aspm_vars(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - /*close ASPM for AMD defaultly */ - rtlpci->const_amdpci_aspm = 0; - - /* - * ASPM PS mode. - * 0 - Disable ASPM, - * 1 - Enable ASPM without Clock Req, - * 2 - Enable ASPM with Clock Req, - * 3 - Alwyas Enable ASPM with Clock Req, - * 4 - Always Enable ASPM without Clock Req. - * set defult to RTL8192CE:3 RTL8192E:2 - * */ - rtlpci->const_pci_aspm = 3; - - /*Setting for PCI-E device */ - rtlpci->const_devicepci_aspm_setting = 0x03; - - /*Setting for PCI-E bridge */ - rtlpci->const_hostpci_aspm_setting = 0x02; - - /* - * In Hw/Sw Radio Off situation. - * 0 - Default, - * 1 - From ASPM setting without low Mac Pwr, - * 2 - From ASPM setting with low Mac Pwr, - * 3 - Bus D3 - * set default to RTL8192CE:0 RTL8192SE:2 - */ - rtlpci->const_hwsw_rfoff_d3 = 0; - - /* - * This setting works for those device with - * backdoor ASPM setting such as EPHY setting. - * 0 - Not support ASPM, - * 1 - Support ASPM, - * 2 - According to chipset. - */ - rtlpci->const_support_pciaspm = 1; -} - -int rtl92c_init_sw_vars(struct ieee80211_hw *hw) -{ - int err; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - rtl8192ce_bt_reg_init(hw); - - rtlpriv->dm.dm_initialgain_enable = true; - rtlpriv->dm.dm_flag = 0; - rtlpriv->dm.disable_framebursting = false; - rtlpriv->dm.thermalvalue = 0; - rtlpci->transmit_config = CFENDFORM | BIT(12) | BIT(13); - - /* compatible 5G band 88ce just 2.4G band & smsp */ - rtlpriv->rtlhal.current_bandtype = BAND_ON_2_4G; - rtlpriv->rtlhal.bandset = BAND_ON_2_4G; - rtlpriv->rtlhal.macphymode = SINGLEMAC_SINGLEPHY; - - rtlpci->receive_config = (RCR_APPFCS | - RCR_AMF | - RCR_ADF | - RCR_APP_MIC | - RCR_APP_ICV | - RCR_AICV | - RCR_ACRC32 | - RCR_AB | - RCR_AM | - RCR_APM | - RCR_APP_PHYST_RXFF | RCR_HTC_LOC_CTRL | 0); - - rtlpci->irq_mask[0] = - (u32) (IMR_ROK | - IMR_VODOK | - IMR_VIDOK | - IMR_BEDOK | - IMR_BKDOK | - IMR_MGNTDOK | - IMR_HIGHDOK | IMR_BDOK | IMR_RDU | IMR_RXFOVW | 0); - - rtlpci->irq_mask[1] = (u32) (IMR_CPWM | IMR_C2HCMD | 0); - - /* for debug level */ - rtlpriv->dbg.global_debuglevel = rtlpriv->cfg->mod_params->debug; - /* for LPS & IPS */ - rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps; - rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; - rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; - if (!rtlpriv->psc.inactiveps) - pr_info("rtl8192ce: Power Save off (module option)\n"); - if (!rtlpriv->psc.fwctrl_lps) - pr_info("rtl8192ce: FW Power Save off (module option)\n"); - rtlpriv->psc.reg_fwctrl_lps = 3; - rtlpriv->psc.reg_max_lps_awakeintvl = 5; - /* for ASPM, you can close aspm through - * set const_support_pciaspm = 0 */ - rtl92c_init_aspm_vars(hw); - - if (rtlpriv->psc.reg_fwctrl_lps == 1) - rtlpriv->psc.fwctrl_psmode = FW_PS_MIN_MODE; - else if (rtlpriv->psc.reg_fwctrl_lps == 2) - rtlpriv->psc.fwctrl_psmode = FW_PS_MAX_MODE; - else if (rtlpriv->psc.reg_fwctrl_lps == 3) - rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE; - - /* for firmware buf */ - rtlpriv->rtlhal.pfirmware = vzalloc(0x4000); - if (!rtlpriv->rtlhal.pfirmware) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Can't alloc buffer for fw\n"); - return 1; - } - - /* request fw */ - if (IS_VENDOR_UMC_A_CUT(rtlhal->version) && - !IS_92C_SERIAL(rtlhal->version)) - rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU.bin"; - else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) - rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU_B.bin"; - - rtlpriv->max_fw_size = 0x4000; - pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name); - err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Failed to request firmware!\n"); - return 1; - } - - return 0; -} - -void rtl92c_deinit_sw_vars(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->rtlhal.pfirmware) { - vfree(rtlpriv->rtlhal.pfirmware); - rtlpriv->rtlhal.pfirmware = NULL; - } -} - -static struct rtl_hal_ops rtl8192ce_hal_ops = { - .init_sw_vars = rtl92c_init_sw_vars, - .deinit_sw_vars = rtl92c_deinit_sw_vars, - .read_eeprom_info = rtl92ce_read_eeprom_info, - .interrupt_recognized = rtl92ce_interrupt_recognized, - .hw_init = rtl92ce_hw_init, - .hw_disable = rtl92ce_card_disable, - .hw_suspend = rtl92ce_suspend, - .hw_resume = rtl92ce_resume, - .enable_interrupt = rtl92ce_enable_interrupt, - .disable_interrupt = rtl92ce_disable_interrupt, - .set_network_type = rtl92ce_set_network_type, - .set_chk_bssid = rtl92ce_set_check_bssid, - .set_qos = rtl92ce_set_qos, - .set_bcn_reg = rtl92ce_set_beacon_related_registers, - .set_bcn_intv = rtl92ce_set_beacon_interval, - .update_interrupt_mask = rtl92ce_update_interrupt_mask, - .get_hw_reg = rtl92ce_get_hw_reg, - .set_hw_reg = rtl92ce_set_hw_reg, - .update_rate_tbl = rtl92ce_update_hal_rate_tbl, - .fill_tx_desc = rtl92ce_tx_fill_desc, - .fill_tx_cmddesc = rtl92ce_tx_fill_cmddesc, - .query_rx_desc = rtl92ce_rx_query_desc, - .set_channel_access = rtl92ce_update_channel_access_setting, - .radio_onoff_checking = rtl92ce_gpio_radio_on_off_checking, - .set_bw_mode = rtl92c_phy_set_bw_mode, - .switch_channel = rtl92c_phy_sw_chnl, - .dm_watchdog = rtl92c_dm_watchdog, - .scan_operation_backup = rtl92c_phy_scan_operation_backup, - .set_rf_power_state = rtl92c_phy_set_rf_power_state, - .led_control = rtl92ce_led_control, - .set_desc = rtl92ce_set_desc, - .get_desc = rtl92ce_get_desc, - .tx_polling = rtl92ce_tx_polling, - .enable_hw_sec = rtl92ce_enable_hw_security_config, - .set_key = rtl92ce_set_key, - .init_sw_leds = rtl92ce_init_sw_leds, - .allow_all_destaddr = rtl92ce_allow_all_destaddr, - .get_bbreg = rtl92c_phy_query_bb_reg, - .set_bbreg = rtl92c_phy_set_bb_reg, - .set_rfreg = rtl92ce_phy_set_rf_reg, - .get_rfreg = rtl92c_phy_query_rf_reg, - .phy_rf6052_config = rtl92ce_phy_rf6052_config, - .phy_rf6052_set_cck_txpower = rtl92ce_phy_rf6052_set_cck_txpower, - .phy_rf6052_set_ofdm_txpower = rtl92ce_phy_rf6052_set_ofdm_txpower, - .config_bb_with_headerfile = _rtl92ce_phy_config_bb_with_headerfile, - .config_bb_with_pgheaderfile = _rtl92ce_phy_config_bb_with_pgheaderfile, - .phy_lc_calibrate = _rtl92ce_phy_lc_calibrate, - .phy_set_bw_mode_callback = rtl92ce_phy_set_bw_mode_callback, - .dm_dynamic_txpower = rtl92ce_dm_dynamic_txpower, -}; - -static struct rtl_mod_params rtl92ce_mod_params = { - .sw_crypto = false, - .inactiveps = true, - .swctrl_lps = false, - .fwctrl_lps = true, - .debug = DBG_EMERG, -}; - -static struct rtl_hal_cfg rtl92ce_hal_cfg = { - .bar_id = 2, - .write_readback = true, - .name = "rtl92c_pci", - .fw_name = "rtlwifi/rtl8192cfw.bin", - .ops = &rtl8192ce_hal_ops, - .mod_params = &rtl92ce_mod_params, - - .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, - .maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN, - .maps[SYS_CLK] = REG_SYS_CLKR, - .maps[MAC_RCR_AM] = AM, - .maps[MAC_RCR_AB] = AB, - .maps[MAC_RCR_ACRC32] = ACRC32, - .maps[MAC_RCR_ACF] = ACF, - .maps[MAC_RCR_AAP] = AAP, - - .maps[EFUSE_TEST] = REG_EFUSE_TEST, - .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, - .maps[EFUSE_CLK] = 0, - .maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL, - .maps[EFUSE_PWC_EV12V] = PWC_EV12V, - .maps[EFUSE_FEN_ELDR] = FEN_ELDR, - .maps[EFUSE_LOADER_CLK_EN] = LOADER_CLK_EN, - .maps[EFUSE_ANA8M] = EFUSE_ANA8M, - .maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE, - .maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION, - .maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN, - .maps[EFUSE_OOB_PROTECT_BYTES_LEN] = EFUSE_OOB_PROTECT_BYTES, - - .maps[RWCAM] = REG_CAMCMD, - .maps[WCAMI] = REG_CAMWRITE, - .maps[RCAMO] = REG_CAMREAD, - .maps[CAMDBG] = REG_CAMDBG, - .maps[SECR] = REG_SECCFG, - .maps[SEC_CAM_NONE] = CAM_NONE, - .maps[SEC_CAM_WEP40] = CAM_WEP40, - .maps[SEC_CAM_TKIP] = CAM_TKIP, - .maps[SEC_CAM_AES] = CAM_AES, - .maps[SEC_CAM_WEP104] = CAM_WEP104, - - .maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6, - .maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5, - .maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4, - .maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3, - .maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2, - .maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1, - .maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8, - .maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7, - .maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6, - .maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5, - .maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4, - .maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3, - .maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2, - .maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1, - .maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2, - .maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1, - - .maps[RTL_IMR_TXFOVW] = IMR_TXFOVW, - .maps[RTL_IMR_PSTIMEOUT] = IMR_PSTIMEOUT, - .maps[RTL_IMR_BCNINT] = IMR_BCNINT, - .maps[RTL_IMR_RXFOVW] = IMR_RXFOVW, - .maps[RTL_IMR_RDU] = IMR_RDU, - .maps[RTL_IMR_ATIMEND] = IMR_ATIMEND, - .maps[RTL_IMR_BDOK] = IMR_BDOK, - .maps[RTL_IMR_MGNTDOK] = IMR_MGNTDOK, - .maps[RTL_IMR_TBDER] = IMR_TBDER, - .maps[RTL_IMR_HIGHDOK] = IMR_HIGHDOK, - .maps[RTL_IMR_TBDOK] = IMR_TBDOK, - .maps[RTL_IMR_BKDOK] = IMR_BKDOK, - .maps[RTL_IMR_BEDOK] = IMR_BEDOK, - .maps[RTL_IMR_VIDOK] = IMR_VIDOK, - .maps[RTL_IMR_VODOK] = IMR_VODOK, - .maps[RTL_IMR_ROK] = IMR_ROK, - .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER), - - .maps[RTL_RC_CCK_RATE1M] = DESC92_RATE1M, - .maps[RTL_RC_CCK_RATE2M] = DESC92_RATE2M, - .maps[RTL_RC_CCK_RATE5_5M] = DESC92_RATE5_5M, - .maps[RTL_RC_CCK_RATE11M] = DESC92_RATE11M, - .maps[RTL_RC_OFDM_RATE6M] = DESC92_RATE6M, - .maps[RTL_RC_OFDM_RATE9M] = DESC92_RATE9M, - .maps[RTL_RC_OFDM_RATE12M] = DESC92_RATE12M, - .maps[RTL_RC_OFDM_RATE18M] = DESC92_RATE18M, - .maps[RTL_RC_OFDM_RATE24M] = DESC92_RATE24M, - .maps[RTL_RC_OFDM_RATE36M] = DESC92_RATE36M, - .maps[RTL_RC_OFDM_RATE48M] = DESC92_RATE48M, - .maps[RTL_RC_OFDM_RATE54M] = DESC92_RATE54M, - - .maps[RTL_RC_HT_RATEMCS7] = DESC92_RATEMCS7, - .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, -}; - -static DEFINE_PCI_DEVICE_TABLE(rtl92ce_pci_ids) = { - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8191, rtl92ce_hal_cfg)}, - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8178, rtl92ce_hal_cfg)}, - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8177, rtl92ce_hal_cfg)}, - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8176, rtl92ce_hal_cfg)}, - {}, -}; - -MODULE_DEVICE_TABLE(pci, rtl92ce_pci_ids); - -MODULE_AUTHOR("lizhaoming "); -MODULE_AUTHOR("Realtek WlanFAE "); -MODULE_AUTHOR("Larry Finger "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Realtek 8192C/8188C 802.11n PCI wireless"); -MODULE_FIRMWARE("rtlwifi/rtl8192cfw.bin"); -MODULE_FIRMWARE("rtlwifi/rtl8192cfwU.bin"); -MODULE_FIRMWARE("rtlwifi/rtl8192cfwU_B.bin"); - -module_param_named(swenc, rtl92ce_mod_params.sw_crypto, bool, 0444); -module_param_named(debug, rtl92ce_mod_params.debug, int, 0444); -module_param_named(ips, rtl92ce_mod_params.inactiveps, bool, 0444); -module_param_named(swlps, rtl92ce_mod_params.swctrl_lps, bool, 0444); -module_param_named(fwlps, rtl92ce_mod_params.fwctrl_lps, bool, 0444); -MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); -MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); -MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); -MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); -MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); - -static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); - -static struct pci_driver rtl92ce_driver = { - .name = KBUILD_MODNAME, - .id_table = rtl92ce_pci_ids, - .probe = rtl_pci_probe, - .remove = rtl_pci_disconnect, - .driver.pm = &rtlwifi_pm_ops, -}; - -module_pci_driver(rtl92ce_driver); diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.h b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.h deleted file mode 100644 index d2367a5d0cf5..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.h +++ /dev/null @@ -1,41 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CE_SW_H__ -#define __RTL92CE_SW_H__ - -int rtl92c_init_sw_vars(struct ieee80211_hw *hw); -void rtl92c_deinit_sw_vars(struct ieee80211_hw *hw); -void rtl92c_init_var_map(struct ieee80211_hw *hw); -bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw, - u8 configtype); -bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw, - u8 configtype); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/table.c b/drivers/net/wireless/rtlwifi/rtl8192ce/table.c deleted file mode 100644 index 752f943a84ae..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/table.c +++ /dev/null @@ -1,1224 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Created on 2010/ 5/18, 1:41 - * - * Larry Finger - * - *****************************************************************************/ - -#include "table.h" - - -u32 RTL8192CEPHY_REG_2TARRAY[PHY_REG_2TARRAY_LENGTH] = { - 0x024, 0x0011800f, - 0x028, 0x00ffdb83, - 0x800, 0x80040002, - 0x804, 0x00000003, - 0x808, 0x0000fc00, - 0x80c, 0x0000000a, - 0x810, 0x10005388, - 0x814, 0x020c3d10, - 0x818, 0x02200385, - 0x81c, 0x00000000, - 0x820, 0x01000100, - 0x824, 0x00390004, - 0x828, 0x01000100, - 0x82c, 0x00390004, - 0x830, 0x27272727, - 0x834, 0x27272727, - 0x838, 0x27272727, - 0x83c, 0x27272727, - 0x840, 0x00010000, - 0x844, 0x00010000, - 0x848, 0x27272727, - 0x84c, 0x27272727, - 0x850, 0x00000000, - 0x854, 0x00000000, - 0x858, 0x569a569a, - 0x85c, 0x0c1b25a4, - 0x860, 0x66e60230, - 0x864, 0x061f0130, - 0x868, 0x27272727, - 0x86c, 0x2b2b2b27, - 0x870, 0x07000700, - 0x874, 0x22184000, - 0x878, 0x08080808, - 0x87c, 0x00000000, - 0x880, 0xc0083070, - 0x884, 0x000004d5, - 0x888, 0x00000000, - 0x88c, 0xcc0000c0, - 0x890, 0x00000800, - 0x894, 0xfffffffe, - 0x898, 0x40302010, - 0x89c, 0x00706050, - 0x900, 0x00000000, - 0x904, 0x00000023, - 0x908, 0x00000000, - 0x90c, 0x81121313, - 0xa00, 0x00d047c8, - 0xa04, 0x80ff000c, - 0xa08, 0x8c838300, - 0xa0c, 0x2e68120f, - 0xa10, 0x9500bb78, - 0xa14, 0x11144028, - 0xa18, 0x00881117, - 0xa1c, 0x89140f00, - 0xa20, 0x1a1b0000, - 0xa24, 0x090e1317, - 0xa28, 0x00000204, - 0xa2c, 0x00d30000, - 0xa70, 0x101fbf00, - 0xa74, 0x00000007, - 0xc00, 0x48071d40, - 0xc04, 0x03a05633, - 0xc08, 0x000000e4, - 0xc0c, 0x6c6c6c6c, - 0xc10, 0x08800000, - 0xc14, 0x40000100, - 0xc18, 0x08800000, - 0xc1c, 0x40000100, - 0xc20, 0x00000000, - 0xc24, 0x00000000, - 0xc28, 0x00000000, - 0xc2c, 0x00000000, - 0xc30, 0x69e9ac44, - 0xc34, 0x469652cf, - 0xc38, 0x49795994, - 0xc3c, 0x0a97971c, - 0xc40, 0x1f7c403f, - 0xc44, 0x000100b7, - 0xc48, 0xec020107, - 0xc4c, 0x007f037f, - 0xc50, 0x69543420, - 0xc54, 0x43bc0094, - 0xc58, 0x69543420, - 0xc5c, 0x433c0094, - 0xc60, 0x00000000, - 0xc64, 0x5116848b, - 0xc68, 0x47c00bff, - 0xc6c, 0x00000036, - 0xc70, 0x2c7f000d, - 0xc74, 0x018610db, - 0xc78, 0x0000001f, - 0xc7c, 0x00b91612, - 0xc80, 0x40000100, - 0xc84, 0x20f60000, - 0xc88, 0x40000100, - 0xc8c, 0x20200000, - 0xc90, 0x00121820, - 0xc94, 0x00000000, - 0xc98, 0x00121820, - 0xc9c, 0x00007f7f, - 0xca0, 0x00000000, - 0xca4, 0x00000080, - 0xca8, 0x00000000, - 0xcac, 0x00000000, - 0xcb0, 0x00000000, - 0xcb4, 0x00000000, - 0xcb8, 0x00000000, - 0xcbc, 0x28000000, - 0xcc0, 0x00000000, - 0xcc4, 0x00000000, - 0xcc8, 0x00000000, - 0xccc, 0x00000000, - 0xcd0, 0x00000000, - 0xcd4, 0x00000000, - 0xcd8, 0x64b22427, - 0xcdc, 0x00766932, - 0xce0, 0x00222222, - 0xce4, 0x00000000, - 0xce8, 0x37644302, - 0xcec, 0x2f97d40c, - 0xd00, 0x00080740, - 0xd04, 0x00020403, - 0xd08, 0x0000907f, - 0xd0c, 0x20010201, - 0xd10, 0xa0633333, - 0xd14, 0x3333bc43, - 0xd18, 0x7a8f5b6b, - 0xd2c, 0xcc979975, - 0xd30, 0x00000000, - 0xd34, 0x80608000, - 0xd38, 0x00000000, - 0xd3c, 0x00027293, - 0xd40, 0x00000000, - 0xd44, 0x00000000, - 0xd48, 0x00000000, - 0xd4c, 0x00000000, - 0xd50, 0x6437140a, - 0xd54, 0x00000000, - 0xd58, 0x00000000, - 0xd5c, 0x30032064, - 0xd60, 0x4653de68, - 0xd64, 0x04518a3c, - 0xd68, 0x00002101, - 0xd6c, 0x2a201c16, - 0xd70, 0x1812362e, - 0xd74, 0x322c2220, - 0xd78, 0x000e3c24, - 0xe00, 0x2a2a2a2a, - 0xe04, 0x2a2a2a2a, - 0xe08, 0x03902a2a, - 0xe10, 0x2a2a2a2a, - 0xe14, 0x2a2a2a2a, - 0xe18, 0x2a2a2a2a, - 0xe1c, 0x2a2a2a2a, - 0xe28, 0x00000000, - 0xe30, 0x1000dc1f, - 0xe34, 0x10008c1f, - 0xe38, 0x02140102, - 0xe3c, 0x681604c2, - 0xe40, 0x01007c00, - 0xe44, 0x01004800, - 0xe48, 0xfb000000, - 0xe4c, 0x000028d1, - 0xe50, 0x1000dc1f, - 0xe54, 0x10008c1f, - 0xe58, 0x02140102, - 0xe5c, 0x28160d05, - 0xe60, 0x00000010, - 0xe68, 0x001b25a4, - 0xe6c, 0x63db25a4, - 0xe70, 0x63db25a4, - 0xe74, 0x0c1b25a4, - 0xe78, 0x0c1b25a4, - 0xe7c, 0x0c1b25a4, - 0xe80, 0x0c1b25a4, - 0xe84, 0x63db25a4, - 0xe88, 0x0c1b25a4, - 0xe8c, 0x63db25a4, - 0xed0, 0x63db25a4, - 0xed4, 0x63db25a4, - 0xed8, 0x63db25a4, - 0xedc, 0x001b25a4, - 0xee0, 0x001b25a4, - 0xeec, 0x6fdb25a4, - 0xf14, 0x00000003, - 0xf4c, 0x00000000, - 0xf00, 0x00000300, -}; - -u32 RTL8192CEPHY_REG_1TARRAY[PHY_REG_1TARRAY_LENGTH] = { - 0x024, 0x0011800f, - 0x028, 0x00ffdb83, - 0x800, 0x80040000, - 0x804, 0x00000001, - 0x808, 0x0000fc00, - 0x80c, 0x0000000a, - 0x810, 0x10005388, - 0x814, 0x020c3d10, - 0x818, 0x02200385, - 0x81c, 0x00000000, - 0x820, 0x01000100, - 0x824, 0x00390004, - 0x828, 0x00000000, - 0x82c, 0x00000000, - 0x830, 0x00000000, - 0x834, 0x00000000, - 0x838, 0x00000000, - 0x83c, 0x00000000, - 0x840, 0x00010000, - 0x844, 0x00000000, - 0x848, 0x00000000, - 0x84c, 0x00000000, - 0x850, 0x00000000, - 0x854, 0x00000000, - 0x858, 0x569a569a, - 0x85c, 0x001b25a4, - 0x860, 0x66e60230, - 0x864, 0x061f0130, - 0x868, 0x00000000, - 0x86c, 0x32323200, - 0x870, 0x07000700, - 0x874, 0x22004000, - 0x878, 0x00000808, - 0x87c, 0x00000000, - 0x880, 0xc0083070, - 0x884, 0x000004d5, - 0x888, 0x00000000, - 0x88c, 0xccc000c0, - 0x890, 0x00000800, - 0x894, 0xfffffffe, - 0x898, 0x40302010, - 0x89c, 0x00706050, - 0x900, 0x00000000, - 0x904, 0x00000023, - 0x908, 0x00000000, - 0x90c, 0x81121111, - 0xa00, 0x00d047c8, - 0xa04, 0x80ff000c, - 0xa08, 0x8c838300, - 0xa0c, 0x2e68120f, - 0xa10, 0x9500bb78, - 0xa14, 0x11144028, - 0xa18, 0x00881117, - 0xa1c, 0x89140f00, - 0xa20, 0x1a1b0000, - 0xa24, 0x090e1317, - 0xa28, 0x00000204, - 0xa2c, 0x00d30000, - 0xa70, 0x101fbf00, - 0xa74, 0x00000007, - 0xc00, 0x48071d40, - 0xc04, 0x03a05611, - 0xc08, 0x000000e4, - 0xc0c, 0x6c6c6c6c, - 0xc10, 0x08800000, - 0xc14, 0x40000100, - 0xc18, 0x08800000, - 0xc1c, 0x40000100, - 0xc20, 0x00000000, - 0xc24, 0x00000000, - 0xc28, 0x00000000, - 0xc2c, 0x00000000, - 0xc30, 0x69e9ac44, - 0xc34, 0x469652cf, - 0xc38, 0x49795994, - 0xc3c, 0x0a97971c, - 0xc40, 0x1f7c403f, - 0xc44, 0x000100b7, - 0xc48, 0xec020107, - 0xc4c, 0x007f037f, - 0xc50, 0x69543420, - 0xc54, 0x43bc0094, - 0xc58, 0x69543420, - 0xc5c, 0x433c0094, - 0xc60, 0x00000000, - 0xc64, 0x5116848b, - 0xc68, 0x47c00bff, - 0xc6c, 0x00000036, - 0xc70, 0x2c7f000d, - 0xc74, 0x018610db, - 0xc78, 0x0000001f, - 0xc7c, 0x00b91612, - 0xc80, 0x40000100, - 0xc84, 0x20f60000, - 0xc88, 0x40000100, - 0xc8c, 0x20200000, - 0xc90, 0x00121820, - 0xc94, 0x00000000, - 0xc98, 0x00121820, - 0xc9c, 0x00007f7f, - 0xca0, 0x00000000, - 0xca4, 0x00000080, - 0xca8, 0x00000000, - 0xcac, 0x00000000, - 0xcb0, 0x00000000, - 0xcb4, 0x00000000, - 0xcb8, 0x00000000, - 0xcbc, 0x28000000, - 0xcc0, 0x00000000, - 0xcc4, 0x00000000, - 0xcc8, 0x00000000, - 0xccc, 0x00000000, - 0xcd0, 0x00000000, - 0xcd4, 0x00000000, - 0xcd8, 0x64b22427, - 0xcdc, 0x00766932, - 0xce0, 0x00222222, - 0xce4, 0x00000000, - 0xce8, 0x37644302, - 0xcec, 0x2f97d40c, - 0xd00, 0x00080740, - 0xd04, 0x00020401, - 0xd08, 0x0000907f, - 0xd0c, 0x20010201, - 0xd10, 0xa0633333, - 0xd14, 0x3333bc43, - 0xd18, 0x7a8f5b6b, - 0xd2c, 0xcc979975, - 0xd30, 0x00000000, - 0xd34, 0x80608000, - 0xd38, 0x00000000, - 0xd3c, 0x00027293, - 0xd40, 0x00000000, - 0xd44, 0x00000000, - 0xd48, 0x00000000, - 0xd4c, 0x00000000, - 0xd50, 0x6437140a, - 0xd54, 0x00000000, - 0xd58, 0x00000000, - 0xd5c, 0x30032064, - 0xd60, 0x4653de68, - 0xd64, 0x04518a3c, - 0xd68, 0x00002101, - 0xd6c, 0x2a201c16, - 0xd70, 0x1812362e, - 0xd74, 0x322c2220, - 0xd78, 0x000e3c24, - 0xe00, 0x2a2a2a2a, - 0xe04, 0x2a2a2a2a, - 0xe08, 0x03902a2a, - 0xe10, 0x2a2a2a2a, - 0xe14, 0x2a2a2a2a, - 0xe18, 0x2a2a2a2a, - 0xe1c, 0x2a2a2a2a, - 0xe28, 0x00000000, - 0xe30, 0x1000dc1f, - 0xe34, 0x10008c1f, - 0xe38, 0x02140102, - 0xe3c, 0x681604c2, - 0xe40, 0x01007c00, - 0xe44, 0x01004800, - 0xe48, 0xfb000000, - 0xe4c, 0x000028d1, - 0xe50, 0x1000dc1f, - 0xe54, 0x10008c1f, - 0xe58, 0x02140102, - 0xe5c, 0x28160d05, - 0xe60, 0x00000010, - 0xe68, 0x001b25a4, - 0xe6c, 0x631b25a0, - 0xe70, 0x631b25a0, - 0xe74, 0x081b25a0, - 0xe78, 0x081b25a0, - 0xe7c, 0x081b25a0, - 0xe80, 0x081b25a0, - 0xe84, 0x631b25a0, - 0xe88, 0x081b25a0, - 0xe8c, 0x631b25a0, - 0xed0, 0x631b25a0, - 0xed4, 0x631b25a0, - 0xed8, 0x631b25a0, - 0xedc, 0x001b25a0, - 0xee0, 0x001b25a0, - 0xeec, 0x6b1b25a0, - 0xf14, 0x00000003, - 0xf4c, 0x00000000, - 0xf00, 0x00000300, -}; - -u32 RTL8192CEPHY_REG_ARRAY_PG[PHY_REG_ARRAY_PGLENGTH] = { - 0xe00, 0xffffffff, 0x0a0c0c0c, - 0xe04, 0xffffffff, 0x02040608, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x0a0c0d0e, - 0xe14, 0xffffffff, 0x02040608, - 0xe18, 0xffffffff, 0x0a0c0d0e, - 0xe1c, 0xffffffff, 0x02040608, - 0x830, 0xffffffff, 0x0a0c0c0c, - 0x834, 0xffffffff, 0x02040608, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x0a0c0d0e, - 0x848, 0xffffffff, 0x02040608, - 0x84c, 0xffffffff, 0x0a0c0d0e, - 0x868, 0xffffffff, 0x02040608, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x06060606, - 0xe14, 0xffffffff, 0x00020406, - 0xe18, 0xffffffff, 0x06060606, - 0xe1c, 0xffffffff, 0x00020406, - 0x830, 0xffffffff, 0x04040404, - 0x834, 0xffffffff, 0x00020204, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x06060606, - 0x848, 0xffffffff, 0x00020406, - 0x84c, 0xffffffff, 0x06060606, - 0x868, 0xffffffff, 0x00020406, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, -}; - -u32 RTL8192CERADIOA_2TARRAY[RADIOA_2TARRAYLENGTH] = { - 0x000, 0x00030159, - 0x001, 0x00031284, - 0x002, 0x00098000, - 0x003, 0x00018c63, - 0x004, 0x000210e7, - 0x009, 0x0002044f, - 0x00a, 0x0001adb0, - 0x00b, 0x00054867, - 0x00c, 0x0008992e, - 0x00d, 0x0000e52c, - 0x00e, 0x00039ce7, - 0x00f, 0x00000451, - 0x019, 0x00000000, - 0x01a, 0x00010255, - 0x01b, 0x00060a00, - 0x01c, 0x000fc378, - 0x01d, 0x000a1250, - 0x01e, 0x0004445f, - 0x01f, 0x00080001, - 0x020, 0x0000b614, - 0x021, 0x0006c000, - 0x022, 0x00000000, - 0x023, 0x00001558, - 0x024, 0x00000060, - 0x025, 0x00000483, - 0x026, 0x0004f000, - 0x027, 0x000ec7d9, - 0x028, 0x000977c0, - 0x029, 0x00004783, - 0x02a, 0x00000001, - 0x02b, 0x00021334, - 0x02a, 0x00000000, - 0x02b, 0x00000054, - 0x02a, 0x00000001, - 0x02b, 0x00000808, - 0x02b, 0x00053333, - 0x02c, 0x0000000c, - 0x02a, 0x00000002, - 0x02b, 0x00000808, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000003, - 0x02b, 0x00000808, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x00000004, - 0x02b, 0x00000808, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000005, - 0x02b, 0x00000808, - 0x02b, 0x00073333, - 0x02c, 0x0000000d, - 0x02a, 0x00000006, - 0x02b, 0x00000709, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000007, - 0x02b, 0x00000709, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x00000008, - 0x02b, 0x0000060a, - 0x02b, 0x0004b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000009, - 0x02b, 0x0000060a, - 0x02b, 0x00053333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000a, - 0x02b, 0x0000060a, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000b, - 0x02b, 0x0000060a, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000c, - 0x02b, 0x0000060a, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000d, - 0x02b, 0x0000060a, - 0x02b, 0x00073333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000e, - 0x02b, 0x0000050b, - 0x02b, 0x00066666, - 0x02c, 0x0000001a, - 0x02a, 0x000e0000, - 0x010, 0x0004000f, - 0x011, 0x000e31fc, - 0x010, 0x0006000f, - 0x011, 0x000ff9f8, - 0x010, 0x0002000f, - 0x011, 0x000203f9, - 0x010, 0x0003000f, - 0x011, 0x000ff500, - 0x010, 0x00000000, - 0x011, 0x00000000, - 0x010, 0x0008000f, - 0x011, 0x0003f100, - 0x010, 0x0009000f, - 0x011, 0x00023100, - 0x012, 0x00032000, - 0x012, 0x00071000, - 0x012, 0x000b0000, - 0x012, 0x000fc000, - 0x013, 0x000287af, - 0x013, 0x000244b7, - 0x013, 0x000204ab, - 0x013, 0x0001c49f, - 0x013, 0x00018493, - 0x013, 0x00014297, - 0x013, 0x00010295, - 0x013, 0x0000c298, - 0x013, 0x0000819c, - 0x013, 0x000040a8, - 0x013, 0x0000001c, - 0x014, 0x0001944c, - 0x014, 0x00059444, - 0x014, 0x0009944c, - 0x014, 0x000d9444, - 0x015, 0x0000f424, - 0x015, 0x0004f424, - 0x015, 0x0008f424, - 0x015, 0x000cf424, - 0x016, 0x000e0330, - 0x016, 0x000a0330, - 0x016, 0x00060330, - 0x016, 0x00020330, - 0x000, 0x00010159, - 0x018, 0x0000f401, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01f, 0x00080003, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01e, 0x00044457, - 0x01f, 0x00080000, - 0x000, 0x00030159, -}; - -u32 RTL8192CE_RADIOB_2TARRAY[RADIOB_2TARRAYLENGTH] = { - 0x000, 0x00030159, - 0x001, 0x00031284, - 0x002, 0x00098000, - 0x003, 0x00018c63, - 0x004, 0x000210e7, - 0x009, 0x0002044f, - 0x00a, 0x0001adb0, - 0x00b, 0x00054867, - 0x00c, 0x0008992e, - 0x00d, 0x0000e52c, - 0x00e, 0x00039ce7, - 0x00f, 0x00000451, - 0x012, 0x00032000, - 0x012, 0x00071000, - 0x012, 0x000b0000, - 0x012, 0x000fc000, - 0x013, 0x000287af, - 0x013, 0x000244b7, - 0x013, 0x000204ab, - 0x013, 0x0001c49f, - 0x013, 0x00018493, - 0x013, 0x00014297, - 0x013, 0x00010295, - 0x013, 0x0000c298, - 0x013, 0x0000819c, - 0x013, 0x000040a8, - 0x013, 0x0000001c, - 0x014, 0x0001944c, - 0x014, 0x00059444, - 0x014, 0x0009944c, - 0x014, 0x000d9444, - 0x015, 0x0000f424, - 0x015, 0x0004f424, - 0x015, 0x0008f424, - 0x015, 0x000cf424, - 0x016, 0x000e0330, - 0x016, 0x000a0330, - 0x016, 0x00060330, - 0x016, 0x00020330, -}; - -u32 RTL8192CE_RADIOA_1TARRAY[RADIOA_1TARRAYLENGTH] = { - 0x000, 0x00030159, - 0x001, 0x00031284, - 0x002, 0x00098000, - 0x003, 0x00018c63, - 0x004, 0x000210e7, - 0x009, 0x0002044f, - 0x00a, 0x0001adb0, - 0x00b, 0x00054867, - 0x00c, 0x0008992e, - 0x00d, 0x0000e52c, - 0x00e, 0x00039ce7, - 0x00f, 0x00000451, - 0x019, 0x00000000, - 0x01a, 0x00010255, - 0x01b, 0x00060a00, - 0x01c, 0x000fc378, - 0x01d, 0x000a1250, - 0x01e, 0x0004445f, - 0x01f, 0x00080001, - 0x020, 0x0000b614, - 0x021, 0x0006c000, - 0x022, 0x00000000, - 0x023, 0x00001558, - 0x024, 0x00000060, - 0x025, 0x00000483, - 0x026, 0x0004f000, - 0x027, 0x000ec7d9, - 0x028, 0x000977c0, - 0x029, 0x00004783, - 0x02a, 0x00000001, - 0x02b, 0x00021334, - 0x02a, 0x00000000, - 0x02b, 0x00000054, - 0x02a, 0x00000001, - 0x02b, 0x00000808, - 0x02b, 0x00053333, - 0x02c, 0x0000000c, - 0x02a, 0x00000002, - 0x02b, 0x00000808, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000003, - 0x02b, 0x00000808, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x00000004, - 0x02b, 0x00000808, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000005, - 0x02b, 0x00000808, - 0x02b, 0x00073333, - 0x02c, 0x0000000d, - 0x02a, 0x00000006, - 0x02b, 0x00000709, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000007, - 0x02b, 0x00000709, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x00000008, - 0x02b, 0x0000060a, - 0x02b, 0x0004b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000009, - 0x02b, 0x0000060a, - 0x02b, 0x00053333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000a, - 0x02b, 0x0000060a, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000b, - 0x02b, 0x0000060a, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000c, - 0x02b, 0x0000060a, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000d, - 0x02b, 0x0000060a, - 0x02b, 0x00073333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000e, - 0x02b, 0x0000050b, - 0x02b, 0x00066666, - 0x02c, 0x0000001a, - 0x02a, 0x000e0000, - 0x010, 0x0004000f, - 0x011, 0x000e31fc, - 0x010, 0x0006000f, - 0x011, 0x000ff9f8, - 0x010, 0x0002000f, - 0x011, 0x000203f9, - 0x010, 0x0003000f, - 0x011, 0x000ff500, - 0x010, 0x00000000, - 0x011, 0x00000000, - 0x010, 0x0008000f, - 0x011, 0x0003f100, - 0x010, 0x0009000f, - 0x011, 0x00023100, - 0x012, 0x00032000, - 0x012, 0x00071000, - 0x012, 0x000b0000, - 0x012, 0x000fc000, - 0x013, 0x000287af, - 0x013, 0x000244b7, - 0x013, 0x000204ab, - 0x013, 0x0001c49f, - 0x013, 0x00018493, - 0x013, 0x00014297, - 0x013, 0x00010295, - 0x013, 0x0000c298, - 0x013, 0x0000819c, - 0x013, 0x000040a8, - 0x013, 0x0000001c, - 0x014, 0x0001944c, - 0x014, 0x00059444, - 0x014, 0x0009944c, - 0x014, 0x000d9444, - 0x015, 0x0000f424, - 0x015, 0x0004f424, - 0x015, 0x0008f424, - 0x015, 0x000cf424, - 0x016, 0x000e0330, - 0x016, 0x000a0330, - 0x016, 0x00060330, - 0x016, 0x00020330, - 0x000, 0x00010159, - 0x018, 0x0000f401, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01f, 0x00080003, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01e, 0x00044457, - 0x01f, 0x00080000, - 0x000, 0x00030159, -}; - -u32 RTL8192CE_RADIOB_1TARRAY[RADIOB_1TARRAYLENGTH] = { - 0x0, -}; - -u32 RTL8192CEMAC_2T_ARRAY[MAC_2T_ARRAYLENGTH] = { - 0x420, 0x00000080, - 0x423, 0x00000000, - 0x430, 0x00000000, - 0x431, 0x00000000, - 0x432, 0x00000000, - 0x433, 0x00000001, - 0x434, 0x00000004, - 0x435, 0x00000005, - 0x436, 0x00000006, - 0x437, 0x00000007, - 0x438, 0x00000000, - 0x439, 0x00000000, - 0x43a, 0x00000000, - 0x43b, 0x00000001, - 0x43c, 0x00000004, - 0x43d, 0x00000005, - 0x43e, 0x00000006, - 0x43f, 0x00000007, - 0x440, 0x0000005d, - 0x441, 0x00000001, - 0x442, 0x00000000, - 0x444, 0x00000015, - 0x445, 0x000000f0, - 0x446, 0x0000000f, - 0x447, 0x00000000, - 0x458, 0x00000041, - 0x459, 0x000000a8, - 0x45a, 0x00000072, - 0x45b, 0x000000b9, - 0x460, 0x00000088, - 0x461, 0x00000088, - 0x462, 0x00000006, - 0x463, 0x00000003, - 0x4c8, 0x00000004, - 0x4c9, 0x00000008, - 0x4cc, 0x00000002, - 0x4cd, 0x00000028, - 0x4ce, 0x00000001, - 0x500, 0x00000026, - 0x501, 0x000000a2, - 0x502, 0x0000002f, - 0x503, 0x00000000, - 0x504, 0x00000028, - 0x505, 0x000000a3, - 0x506, 0x0000005e, - 0x507, 0x00000000, - 0x508, 0x0000002b, - 0x509, 0x000000a4, - 0x50a, 0x0000005e, - 0x50b, 0x00000000, - 0x50c, 0x0000004f, - 0x50d, 0x000000a4, - 0x50e, 0x00000000, - 0x50f, 0x00000000, - 0x512, 0x0000001c, - 0x514, 0x0000000a, - 0x515, 0x00000010, - 0x516, 0x0000000a, - 0x517, 0x00000010, - 0x51a, 0x00000016, - 0x524, 0x0000000f, - 0x525, 0x0000004f, - 0x546, 0x00000020, - 0x547, 0x00000000, - 0x559, 0x00000002, - 0x55a, 0x00000002, - 0x55d, 0x000000ff, - 0x605, 0x00000030, - 0x608, 0x0000000e, - 0x609, 0x0000002a, - 0x652, 0x00000020, - 0x63c, 0x0000000a, - 0x63d, 0x0000000a, - 0x700, 0x00000021, - 0x701, 0x00000043, - 0x702, 0x00000065, - 0x703, 0x00000087, - 0x708, 0x00000021, - 0x709, 0x00000043, - 0x70a, 0x00000065, - 0x70b, 0x00000087, -}; - -u32 RTL8192CEAGCTAB_2TARRAY[AGCTAB_2TARRAYLENGTH] = { - 0xc78, 0x7b000001, - 0xc78, 0x7b010001, - 0xc78, 0x7b020001, - 0xc78, 0x7b030001, - 0xc78, 0x7b040001, - 0xc78, 0x7b050001, - 0xc78, 0x7a060001, - 0xc78, 0x79070001, - 0xc78, 0x78080001, - 0xc78, 0x77090001, - 0xc78, 0x760a0001, - 0xc78, 0x750b0001, - 0xc78, 0x740c0001, - 0xc78, 0x730d0001, - 0xc78, 0x720e0001, - 0xc78, 0x710f0001, - 0xc78, 0x70100001, - 0xc78, 0x6f110001, - 0xc78, 0x6e120001, - 0xc78, 0x6d130001, - 0xc78, 0x6c140001, - 0xc78, 0x6b150001, - 0xc78, 0x6a160001, - 0xc78, 0x69170001, - 0xc78, 0x68180001, - 0xc78, 0x67190001, - 0xc78, 0x661a0001, - 0xc78, 0x651b0001, - 0xc78, 0x641c0001, - 0xc78, 0x631d0001, - 0xc78, 0x621e0001, - 0xc78, 0x611f0001, - 0xc78, 0x60200001, - 0xc78, 0x49210001, - 0xc78, 0x48220001, - 0xc78, 0x47230001, - 0xc78, 0x46240001, - 0xc78, 0x45250001, - 0xc78, 0x44260001, - 0xc78, 0x43270001, - 0xc78, 0x42280001, - 0xc78, 0x41290001, - 0xc78, 0x402a0001, - 0xc78, 0x262b0001, - 0xc78, 0x252c0001, - 0xc78, 0x242d0001, - 0xc78, 0x232e0001, - 0xc78, 0x222f0001, - 0xc78, 0x21300001, - 0xc78, 0x20310001, - 0xc78, 0x06320001, - 0xc78, 0x05330001, - 0xc78, 0x04340001, - 0xc78, 0x03350001, - 0xc78, 0x02360001, - 0xc78, 0x01370001, - 0xc78, 0x00380001, - 0xc78, 0x00390001, - 0xc78, 0x003a0001, - 0xc78, 0x003b0001, - 0xc78, 0x003c0001, - 0xc78, 0x003d0001, - 0xc78, 0x003e0001, - 0xc78, 0x003f0001, - 0xc78, 0x7b400001, - 0xc78, 0x7b410001, - 0xc78, 0x7b420001, - 0xc78, 0x7b430001, - 0xc78, 0x7b440001, - 0xc78, 0x7b450001, - 0xc78, 0x7a460001, - 0xc78, 0x79470001, - 0xc78, 0x78480001, - 0xc78, 0x77490001, - 0xc78, 0x764a0001, - 0xc78, 0x754b0001, - 0xc78, 0x744c0001, - 0xc78, 0x734d0001, - 0xc78, 0x724e0001, - 0xc78, 0x714f0001, - 0xc78, 0x70500001, - 0xc78, 0x6f510001, - 0xc78, 0x6e520001, - 0xc78, 0x6d530001, - 0xc78, 0x6c540001, - 0xc78, 0x6b550001, - 0xc78, 0x6a560001, - 0xc78, 0x69570001, - 0xc78, 0x68580001, - 0xc78, 0x67590001, - 0xc78, 0x665a0001, - 0xc78, 0x655b0001, - 0xc78, 0x645c0001, - 0xc78, 0x635d0001, - 0xc78, 0x625e0001, - 0xc78, 0x615f0001, - 0xc78, 0x60600001, - 0xc78, 0x49610001, - 0xc78, 0x48620001, - 0xc78, 0x47630001, - 0xc78, 0x46640001, - 0xc78, 0x45650001, - 0xc78, 0x44660001, - 0xc78, 0x43670001, - 0xc78, 0x42680001, - 0xc78, 0x41690001, - 0xc78, 0x406a0001, - 0xc78, 0x266b0001, - 0xc78, 0x256c0001, - 0xc78, 0x246d0001, - 0xc78, 0x236e0001, - 0xc78, 0x226f0001, - 0xc78, 0x21700001, - 0xc78, 0x20710001, - 0xc78, 0x06720001, - 0xc78, 0x05730001, - 0xc78, 0x04740001, - 0xc78, 0x03750001, - 0xc78, 0x02760001, - 0xc78, 0x01770001, - 0xc78, 0x00780001, - 0xc78, 0x00790001, - 0xc78, 0x007a0001, - 0xc78, 0x007b0001, - 0xc78, 0x007c0001, - 0xc78, 0x007d0001, - 0xc78, 0x007e0001, - 0xc78, 0x007f0001, - 0xc78, 0x3800001e, - 0xc78, 0x3801001e, - 0xc78, 0x3802001e, - 0xc78, 0x3803001e, - 0xc78, 0x3804001e, - 0xc78, 0x3805001e, - 0xc78, 0x3806001e, - 0xc78, 0x3807001e, - 0xc78, 0x3808001e, - 0xc78, 0x3c09001e, - 0xc78, 0x3e0a001e, - 0xc78, 0x400b001e, - 0xc78, 0x440c001e, - 0xc78, 0x480d001e, - 0xc78, 0x4c0e001e, - 0xc78, 0x500f001e, - 0xc78, 0x5210001e, - 0xc78, 0x5611001e, - 0xc78, 0x5a12001e, - 0xc78, 0x5e13001e, - 0xc78, 0x6014001e, - 0xc78, 0x6015001e, - 0xc78, 0x6016001e, - 0xc78, 0x6217001e, - 0xc78, 0x6218001e, - 0xc78, 0x6219001e, - 0xc78, 0x621a001e, - 0xc78, 0x621b001e, - 0xc78, 0x621c001e, - 0xc78, 0x621d001e, - 0xc78, 0x621e001e, - 0xc78, 0x621f001e, -}; - -u32 RTL8192CEAGCTAB_1TARRAY[AGCTAB_1TARRAYLENGTH] = { - 0xc78, 0x7b000001, - 0xc78, 0x7b010001, - 0xc78, 0x7b020001, - 0xc78, 0x7b030001, - 0xc78, 0x7b040001, - 0xc78, 0x7b050001, - 0xc78, 0x7a060001, - 0xc78, 0x79070001, - 0xc78, 0x78080001, - 0xc78, 0x77090001, - 0xc78, 0x760a0001, - 0xc78, 0x750b0001, - 0xc78, 0x740c0001, - 0xc78, 0x730d0001, - 0xc78, 0x720e0001, - 0xc78, 0x710f0001, - 0xc78, 0x70100001, - 0xc78, 0x6f110001, - 0xc78, 0x6e120001, - 0xc78, 0x6d130001, - 0xc78, 0x6c140001, - 0xc78, 0x6b150001, - 0xc78, 0x6a160001, - 0xc78, 0x69170001, - 0xc78, 0x68180001, - 0xc78, 0x67190001, - 0xc78, 0x661a0001, - 0xc78, 0x651b0001, - 0xc78, 0x641c0001, - 0xc78, 0x631d0001, - 0xc78, 0x621e0001, - 0xc78, 0x611f0001, - 0xc78, 0x60200001, - 0xc78, 0x49210001, - 0xc78, 0x48220001, - 0xc78, 0x47230001, - 0xc78, 0x46240001, - 0xc78, 0x45250001, - 0xc78, 0x44260001, - 0xc78, 0x43270001, - 0xc78, 0x42280001, - 0xc78, 0x41290001, - 0xc78, 0x402a0001, - 0xc78, 0x262b0001, - 0xc78, 0x252c0001, - 0xc78, 0x242d0001, - 0xc78, 0x232e0001, - 0xc78, 0x222f0001, - 0xc78, 0x21300001, - 0xc78, 0x20310001, - 0xc78, 0x06320001, - 0xc78, 0x05330001, - 0xc78, 0x04340001, - 0xc78, 0x03350001, - 0xc78, 0x02360001, - 0xc78, 0x01370001, - 0xc78, 0x00380001, - 0xc78, 0x00390001, - 0xc78, 0x003a0001, - 0xc78, 0x003b0001, - 0xc78, 0x003c0001, - 0xc78, 0x003d0001, - 0xc78, 0x003e0001, - 0xc78, 0x003f0001, - 0xc78, 0x7b400001, - 0xc78, 0x7b410001, - 0xc78, 0x7b420001, - 0xc78, 0x7b430001, - 0xc78, 0x7b440001, - 0xc78, 0x7b450001, - 0xc78, 0x7a460001, - 0xc78, 0x79470001, - 0xc78, 0x78480001, - 0xc78, 0x77490001, - 0xc78, 0x764a0001, - 0xc78, 0x754b0001, - 0xc78, 0x744c0001, - 0xc78, 0x734d0001, - 0xc78, 0x724e0001, - 0xc78, 0x714f0001, - 0xc78, 0x70500001, - 0xc78, 0x6f510001, - 0xc78, 0x6e520001, - 0xc78, 0x6d530001, - 0xc78, 0x6c540001, - 0xc78, 0x6b550001, - 0xc78, 0x6a560001, - 0xc78, 0x69570001, - 0xc78, 0x68580001, - 0xc78, 0x67590001, - 0xc78, 0x665a0001, - 0xc78, 0x655b0001, - 0xc78, 0x645c0001, - 0xc78, 0x635d0001, - 0xc78, 0x625e0001, - 0xc78, 0x615f0001, - 0xc78, 0x60600001, - 0xc78, 0x49610001, - 0xc78, 0x48620001, - 0xc78, 0x47630001, - 0xc78, 0x46640001, - 0xc78, 0x45650001, - 0xc78, 0x44660001, - 0xc78, 0x43670001, - 0xc78, 0x42680001, - 0xc78, 0x41690001, - 0xc78, 0x406a0001, - 0xc78, 0x266b0001, - 0xc78, 0x256c0001, - 0xc78, 0x246d0001, - 0xc78, 0x236e0001, - 0xc78, 0x226f0001, - 0xc78, 0x21700001, - 0xc78, 0x20710001, - 0xc78, 0x06720001, - 0xc78, 0x05730001, - 0xc78, 0x04740001, - 0xc78, 0x03750001, - 0xc78, 0x02760001, - 0xc78, 0x01770001, - 0xc78, 0x00780001, - 0xc78, 0x00790001, - 0xc78, 0x007a0001, - 0xc78, 0x007b0001, - 0xc78, 0x007c0001, - 0xc78, 0x007d0001, - 0xc78, 0x007e0001, - 0xc78, 0x007f0001, - 0xc78, 0x3800001e, - 0xc78, 0x3801001e, - 0xc78, 0x3802001e, - 0xc78, 0x3803001e, - 0xc78, 0x3804001e, - 0xc78, 0x3805001e, - 0xc78, 0x3806001e, - 0xc78, 0x3807001e, - 0xc78, 0x3808001e, - 0xc78, 0x3c09001e, - 0xc78, 0x3e0a001e, - 0xc78, 0x400b001e, - 0xc78, 0x440c001e, - 0xc78, 0x480d001e, - 0xc78, 0x4c0e001e, - 0xc78, 0x500f001e, - 0xc78, 0x5210001e, - 0xc78, 0x5611001e, - 0xc78, 0x5a12001e, - 0xc78, 0x5e13001e, - 0xc78, 0x6014001e, - 0xc78, 0x6015001e, - 0xc78, 0x6016001e, - 0xc78, 0x6217001e, - 0xc78, 0x6218001e, - 0xc78, 0x6219001e, - 0xc78, 0x621a001e, - 0xc78, 0x621b001e, - 0xc78, 0x621c001e, - 0xc78, 0x621d001e, - 0xc78, 0x621e001e, - 0xc78, 0x621f001e, -}; diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/table.h b/drivers/net/wireless/rtlwifi/rtl8192ce/table.h deleted file mode 100644 index 8b79161f71be..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/table.h +++ /dev/null @@ -1,58 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Created on 2010/ 5/18, 1:41 - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CE_TABLE__H_ -#define __RTL92CE_TABLE__H_ - -#include - -#define PHY_REG_2TARRAY_LENGTH 374 -extern u32 RTL8192CEPHY_REG_2TARRAY[PHY_REG_2TARRAY_LENGTH]; -#define PHY_REG_1TARRAY_LENGTH 374 -extern u32 RTL8192CEPHY_REG_1TARRAY[PHY_REG_1TARRAY_LENGTH]; -#define PHY_REG_ARRAY_PGLENGTH 192 -extern u32 RTL8192CEPHY_REG_ARRAY_PG[PHY_REG_ARRAY_PGLENGTH]; -#define RADIOA_2TARRAYLENGTH 282 -extern u32 RTL8192CERADIOA_2TARRAY[RADIOA_2TARRAYLENGTH]; -#define RADIOB_2TARRAYLENGTH 78 -extern u32 RTL8192CE_RADIOB_2TARRAY[RADIOB_2TARRAYLENGTH]; -#define RADIOA_1TARRAYLENGTH 282 -extern u32 RTL8192CE_RADIOA_1TARRAY[RADIOA_1TARRAYLENGTH]; -#define RADIOB_1TARRAYLENGTH 1 -extern u32 RTL8192CE_RADIOB_1TARRAY[RADIOB_1TARRAYLENGTH]; -#define MAC_2T_ARRAYLENGTH 162 -extern u32 RTL8192CEMAC_2T_ARRAY[MAC_2T_ARRAYLENGTH]; -#define AGCTAB_2TARRAYLENGTH 320 -extern u32 RTL8192CEAGCTAB_2TARRAY[AGCTAB_2TARRAYLENGTH]; -#define AGCTAB_1TARRAYLENGTH 320 -extern u32 RTL8192CEAGCTAB_1TARRAY[AGCTAB_1TARRAYLENGTH]; - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c deleted file mode 100644 index 6ad23b413eb3..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c +++ /dev/null @@ -1,754 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../base.h" -#include "../stats.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "trx.h" -#include "led.h" - -static u8 _rtl92ce_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) -{ - __le16 fc = rtl_get_fc(skb); - - if (unlikely(ieee80211_is_beacon(fc))) - return QSLT_BEACON; - if (ieee80211_is_mgmt(fc) || ieee80211_is_ctl(fc)) - return QSLT_MGNT; - - return skb->priority; -} - -static u8 _rtl92c_query_rxpwrpercentage(char antpower) -{ - if ((antpower <= -100) || (antpower >= 20)) - return 0; - else if (antpower >= 0) - return 100; - else - return 100 + antpower; -} - -static u8 _rtl92c_evm_db_to_percentage(char value) -{ - char ret_val; - ret_val = value; - - if (ret_val >= 0) - ret_val = 0; - - if (ret_val <= -33) - ret_val = -33; - - ret_val = 0 - ret_val; - ret_val *= 3; - - if (ret_val == 99) - ret_val = 100; - - return ret_val; -} - -static long _rtl92ce_signal_scale_mapping(struct ieee80211_hw *hw, - long currsig) -{ - long retsig; - - if (currsig >= 61 && currsig <= 100) - retsig = 90 + ((currsig - 60) / 4); - else if (currsig >= 41 && currsig <= 60) - retsig = 78 + ((currsig - 40) / 2); - else if (currsig >= 31 && currsig <= 40) - retsig = 66 + (currsig - 30); - else if (currsig >= 21 && currsig <= 30) - retsig = 54 + (currsig - 20); - else if (currsig >= 5 && currsig <= 20) - retsig = 42 + (((currsig - 5) * 2) / 3); - else if (currsig == 4) - retsig = 36; - else if (currsig == 3) - retsig = 27; - else if (currsig == 2) - retsig = 18; - else if (currsig == 1) - retsig = 9; - else - retsig = currsig; - - return retsig; -} - -static void _rtl92ce_query_rxphystatus(struct ieee80211_hw *hw, - struct rtl_stats *pstats, - struct rx_desc_92c *pdesc, - struct rx_fwinfo_92c *p_drvinfo, - bool packet_match_bssid, - bool packet_toself, - bool packet_beacon) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct phy_sts_cck_8192s_t *cck_buf; - struct rtl_ps_ctl *ppsc = rtl_psc(rtlpriv); - s8 rx_pwr_all = 0, rx_pwr[4]; - u8 evm, pwdb_all, rf_rx_num = 0; - u8 i, max_spatial_stream; - u32 rssi, total_rssi = 0; - bool is_cck_rate; - - is_cck_rate = RX_HAL_IS_CCK_RATE(pdesc); - pstats->packet_matchbssid = packet_match_bssid; - pstats->packet_toself = packet_toself; - pstats->is_cck = is_cck_rate; - pstats->packet_beacon = packet_beacon; - pstats->rx_mimo_sig_qual[0] = -1; - pstats->rx_mimo_sig_qual[1] = -1; - - if (is_cck_rate) { - u8 report, cck_highpwr; - cck_buf = (struct phy_sts_cck_8192s_t *)p_drvinfo; - - if (ppsc->rfpwr_state == ERFON) - cck_highpwr = (u8) rtl_get_bbreg(hw, - RFPGA0_XA_HSSIPARAMETER2, - BIT(9)); - else - cck_highpwr = false; - - if (!cck_highpwr) { - u8 cck_agc_rpt = cck_buf->cck_agc_rpt; - report = cck_buf->cck_agc_rpt & 0xc0; - report = report >> 6; - switch (report) { - case 0x3: - rx_pwr_all = -46 - (cck_agc_rpt & 0x3e); - break; - case 0x2: - rx_pwr_all = -26 - (cck_agc_rpt & 0x3e); - break; - case 0x1: - rx_pwr_all = -12 - (cck_agc_rpt & 0x3e); - break; - case 0x0: - rx_pwr_all = 16 - (cck_agc_rpt & 0x3e); - break; - } - } else { - u8 cck_agc_rpt = cck_buf->cck_agc_rpt; - report = p_drvinfo->cfosho[0] & 0x60; - report = report >> 5; - switch (report) { - case 0x3: - rx_pwr_all = -46 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x2: - rx_pwr_all = -26 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x1: - rx_pwr_all = -12 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x0: - rx_pwr_all = 16 - ((cck_agc_rpt & 0x1f) << 1); - break; - } - } - - pwdb_all = rtl_query_rxpwrpercentage(rx_pwr_all); - /* CCK gain is smaller than OFDM/MCS gain, - * so we add gain diff by experiences, - * the val is 6 - */ - pwdb_all += 6; - if (pwdb_all > 100) - pwdb_all = 100; - /* modify the offset to make the same - * gain index with OFDM. - */ - if (pwdb_all > 34 && pwdb_all <= 42) - pwdb_all -= 2; - else if (pwdb_all > 26 && pwdb_all <= 34) - pwdb_all -= 6; - else if (pwdb_all > 14 && pwdb_all <= 26) - pwdb_all -= 8; - else if (pwdb_all > 4 && pwdb_all <= 14) - pwdb_all -= 4; - - pstats->rx_pwdb_all = pwdb_all; - pstats->recvsignalpower = rx_pwr_all; - - /* (3) Get Signal Quality (EVM) */ - if (packet_match_bssid) { - u8 sq; - if (pstats->rx_pwdb_all > 40) - sq = 100; - else { - sq = cck_buf->sq_rpt; - if (sq > 64) - sq = 0; - else if (sq < 20) - sq = 100; - else - sq = ((64 - sq) * 100) / 44; - } - - pstats->signalquality = sq; - pstats->rx_mimo_sig_qual[0] = sq; - pstats->rx_mimo_sig_qual[1] = -1; - } - } else { - rtlpriv->dm.rfpath_rxenable[0] = - rtlpriv->dm.rfpath_rxenable[1] = true; - /* (1)Get RSSI for HT rate */ - for (i = RF90_PATH_A; i < RF90_PATH_MAX; i++) { - /* we will judge RF RX path now. */ - if (rtlpriv->dm.rfpath_rxenable[i]) - rf_rx_num++; - - rx_pwr[i] = - ((p_drvinfo->gain_trsw[i] & 0x3f) * 2) - 110; - /* Translate DBM to percentage. */ - rssi = _rtl92c_query_rxpwrpercentage(rx_pwr[i]); - total_rssi += rssi; - /* Get Rx snr value in DB */ - rtlpriv->stats.rx_snr_db[i] = - (long)(p_drvinfo->rxsnr[i] / 2); - - /* Record Signal Strength for next packet */ - if (packet_match_bssid) - pstats->rx_mimo_signalstrength[i] = (u8) rssi; - } - - /* (2)PWDB, Average PWDB cacluated by - * hardware (for rate adaptive) - */ - rx_pwr_all = ((p_drvinfo->pwdb_all >> 1) & 0x7f) - 110; - pwdb_all = _rtl92c_query_rxpwrpercentage(rx_pwr_all); - pstats->rx_pwdb_all = pwdb_all; - pstats->rxpower = rx_pwr_all; - pstats->recvsignalpower = rx_pwr_all; - - /* (3)EVM of HT rate */ - if (pstats->is_ht && pstats->rate >= DESC92_RATEMCS8 && - pstats->rate <= DESC92_RATEMCS15) - max_spatial_stream = 2; - else - max_spatial_stream = 1; - - for (i = 0; i < max_spatial_stream; i++) { - evm = _rtl92c_evm_db_to_percentage(p_drvinfo->rxevm[i]); - - if (packet_match_bssid) { - /* Fill value in RFD, Get the first - * spatial stream only - */ - if (i == 0) - pstats->signalquality = - (u8) (evm & 0xff); - pstats->rx_mimo_sig_qual[i] = (u8) (evm & 0xff); - } - } - } - - /* UI BSS List signal strength(in percentage), - * make it good looking, from 0~100. - */ - if (is_cck_rate) - pstats->signalstrength = - (u8) (_rtl92ce_signal_scale_mapping(hw, pwdb_all)); - else if (rf_rx_num != 0) - pstats->signalstrength = - (u8) (_rtl92ce_signal_scale_mapping - (hw, total_rssi /= rf_rx_num)); -} - -static void _rtl92ce_translate_rx_signal_stuff(struct ieee80211_hw *hw, - struct sk_buff *skb, - struct rtl_stats *pstats, - struct rx_desc_92c *pdesc, - struct rx_fwinfo_92c *p_drvinfo) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - - struct ieee80211_hdr *hdr; - u8 *tmp_buf; - u8 *praddr; - __le16 fc; - u16 type, c_fc; - bool packet_matchbssid, packet_toself, packet_beacon = false; - - tmp_buf = skb->data + pstats->rx_drvinfo_size + pstats->rx_bufshift; - - hdr = (struct ieee80211_hdr *)tmp_buf; - fc = hdr->frame_control; - c_fc = le16_to_cpu(fc); - type = WLAN_FC_GET_TYPE(fc); - praddr = hdr->addr1; - - packet_matchbssid = - ((IEEE80211_FTYPE_CTL != type) && - ether_addr_equal(mac->bssid, - (c_fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : - (c_fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : - hdr->addr3) && - (!pstats->hwerror) && (!pstats->crc) && (!pstats->icv)); - - packet_toself = packet_matchbssid && - ether_addr_equal(praddr, rtlefuse->dev_addr); - - if (ieee80211_is_beacon(fc)) - packet_beacon = true; - - _rtl92ce_query_rxphystatus(hw, pstats, pdesc, p_drvinfo, - packet_matchbssid, packet_toself, - packet_beacon); - - rtl_process_phyinfo(hw, tmp_buf, pstats); -} - -bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw, - struct rtl_stats *stats, - struct ieee80211_rx_status *rx_status, - u8 *p_desc, struct sk_buff *skb) -{ - struct rx_fwinfo_92c *p_drvinfo; - struct rx_desc_92c *pdesc = (struct rx_desc_92c *)p_desc; - struct ieee80211_hdr *hdr; - u32 phystatus = GET_RX_DESC_PHYST(pdesc); - stats->length = (u16) GET_RX_DESC_PKT_LEN(pdesc); - stats->rx_drvinfo_size = (u8) GET_RX_DESC_DRV_INFO_SIZE(pdesc) * - RX_DRV_INFO_SIZE_UNIT; - stats->rx_bufshift = (u8) (GET_RX_DESC_SHIFT(pdesc) & 0x03); - stats->icv = (u16) GET_RX_DESC_ICV(pdesc); - stats->crc = (u16) GET_RX_DESC_CRC32(pdesc); - stats->hwerror = (stats->crc | stats->icv); - stats->decrypted = !GET_RX_DESC_SWDEC(pdesc); - stats->rate = (u8) GET_RX_DESC_RXMCS(pdesc); - stats->shortpreamble = (u16) GET_RX_DESC_SPLCP(pdesc); - stats->isampdu = (bool) (GET_RX_DESC_PAGGR(pdesc) == 1); - stats->isfirst_ampdu = (bool) ((GET_RX_DESC_PAGGR(pdesc) == 1) - && (GET_RX_DESC_FAGGR(pdesc) == 1)); - stats->timestamp_low = GET_RX_DESC_TSFL(pdesc); - stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); - stats->is_ht = (bool)GET_RX_DESC_RXHT(pdesc); - - stats->is_cck = RX_HAL_IS_CCK_RATE(pdesc); - - rx_status->freq = hw->conf.chandef.chan->center_freq; - rx_status->band = hw->conf.chandef.chan->band; - - hdr = (struct ieee80211_hdr *)(skb->data + stats->rx_drvinfo_size - + stats->rx_bufshift); - - if (stats->crc) - rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; - - if (stats->rx_is40Mhzpacket) - rx_status->flag |= RX_FLAG_40MHZ; - - if (stats->is_ht) - rx_status->flag |= RX_FLAG_HT; - - rx_status->flag |= RX_FLAG_MACTIME_START; - - /* hw will set stats->decrypted true, if it finds the - * frame is open data frame or mgmt frame. - * So hw will not decryption robust managment frame - * for IEEE80211w but still set status->decrypted - * true, so here we should set it back to undecrypted - * for IEEE80211w frame, and mac80211 sw will help - * to decrypt it - */ - if (stats->decrypted) { - if (!hdr) { - /* In testing, hdr was NULL here */ - return false; - } - if ((ieee80211_is_robust_mgmt_frame(hdr)) && - (ieee80211_has_protected(hdr->frame_control))) - rx_status->flag &= ~RX_FLAG_DECRYPTED; - else - rx_status->flag |= RX_FLAG_DECRYPTED; - } - /* rate_idx: index of data rate into band's - * supported rates or MCS index if HT rates - * are use (RX_FLAG_HT) - * Notice: this is diff with windows define - */ - rx_status->rate_idx = rtlwifi_rate_mapping(hw, - stats->is_ht, stats->rate, - stats->isfirst_ampdu); - - rx_status->mactime = stats->timestamp_low; - if (phystatus) { - p_drvinfo = (struct rx_fwinfo_92c *)(skb->data + - stats->rx_bufshift); - - _rtl92ce_translate_rx_signal_stuff(hw, - skb, stats, pdesc, - p_drvinfo); - } - - /*rx_status->qual = stats->signal; */ - rx_status->signal = stats->recvsignalpower + 10; - /*rx_status->noise = -stats->noise; */ - - return true; -} - -void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, - u8 hw_queue, struct rtl_tcb_desc *tcb_desc) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool defaultadapter = true; - u8 *pdesc = pdesc_tx; - u16 seq_number; - __le16 fc = hdr->frame_control; - u8 fw_qsel = _rtl92ce_map_hwqueue_to_fwqueue(skb, hw_queue); - bool firstseg = ((hdr->seq_ctrl & - cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0); - - bool lastseg = ((hdr->frame_control & - cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) == 0); - - dma_addr_t mapping = pci_map_single(rtlpci->pdev, - skb->data, skb->len, - PCI_DMA_TODEVICE); - - u8 bw_40 = 0; - - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } - rcu_read_lock(); - sta = get_sta(hw, mac->vif, mac->bssid); - if (mac->opmode == NL80211_IFTYPE_STATION) { - bw_40 = mac->bw_40; - } else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC || - mac->opmode == NL80211_IFTYPE_MESH_POINT) { - if (sta) - bw_40 = sta->bandwidth >= IEEE80211_STA_RX_BW_40; - } - - seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4; - - rtl_get_tcb_desc(hw, info, sta, skb, tcb_desc); - - CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92c)); - - if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) { - firstseg = true; - lastseg = true; - } - if (firstseg) { - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); - - SET_TX_DESC_TX_RATE(pdesc, tcb_desc->hw_rate); - - if (tcb_desc->use_shortgi || tcb_desc->use_shortpreamble) - SET_TX_DESC_DATA_SHORTGI(pdesc, 1); - - if (info->flags & IEEE80211_TX_CTL_AMPDU) { - SET_TX_DESC_AGG_BREAK(pdesc, 1); - SET_TX_DESC_MAX_AGG_NUM(pdesc, 0x14); - } - SET_TX_DESC_SEQ(pdesc, seq_number); - - SET_TX_DESC_RTS_ENABLE(pdesc, ((tcb_desc->rts_enable && - !tcb_desc-> - cts_enable) ? 1 : 0)); - SET_TX_DESC_HW_RTS_ENABLE(pdesc, - ((tcb_desc->rts_enable - || tcb_desc->cts_enable) ? 1 : 0)); - SET_TX_DESC_CTS2SELF(pdesc, ((tcb_desc->cts_enable) ? 1 : 0)); - SET_TX_DESC_RTS_STBC(pdesc, ((tcb_desc->rts_stbc) ? 1 : 0)); - - SET_TX_DESC_RTS_RATE(pdesc, tcb_desc->rts_rate); - SET_TX_DESC_RTS_BW(pdesc, 0); - SET_TX_DESC_RTS_SC(pdesc, tcb_desc->rts_sc); - SET_TX_DESC_RTS_SHORT(pdesc, - ((tcb_desc->rts_rate <= DESC92_RATE54M) ? - (tcb_desc->rts_use_shortpreamble ? 1 : 0) - : (tcb_desc->rts_use_shortgi ? 1 : 0))); - - if (bw_40) { - if (tcb_desc->packet_bw) { - SET_TX_DESC_DATA_BW(pdesc, 1); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, 3); - } else { - SET_TX_DESC_DATA_BW(pdesc, 0); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, - mac->cur_40_prime_sc); - } - } else { - SET_TX_DESC_DATA_BW(pdesc, 0); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, 0); - } - - SET_TX_DESC_LINIP(pdesc, 0); - SET_TX_DESC_PKT_SIZE(pdesc, (u16) skb->len); - - if (sta) { - u8 ampdu_density = sta->ht_cap.ampdu_density; - SET_TX_DESC_AMPDU_DENSITY(pdesc, ampdu_density); - } - - if (info->control.hw_key) { - struct ieee80211_key_conf *keyconf = - info->control.hw_key; - - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - case WLAN_CIPHER_SUITE_TKIP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x1); - break; - case WLAN_CIPHER_SUITE_CCMP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x3); - break; - default: - SET_TX_DESC_SEC_TYPE(pdesc, 0x0); - break; - - } - } - - SET_TX_DESC_PKT_ID(pdesc, 0); - SET_TX_DESC_QUEUE_SEL(pdesc, fw_qsel); - - SET_TX_DESC_DATA_RATE_FB_LIMIT(pdesc, 0x1F); - SET_TX_DESC_RTS_RATE_FB_LIMIT(pdesc, 0xF); - SET_TX_DESC_DISABLE_FB(pdesc, 0); - SET_TX_DESC_USE_RATE(pdesc, tcb_desc->use_driver_rate ? 1 : 0); - - if (ieee80211_is_data_qos(fc)) { - if (mac->rdg_en) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "Enable RDG function\n"); - SET_TX_DESC_RDG_ENABLE(pdesc, 1); - SET_TX_DESC_HTC(pdesc, 1); - } - } - } - rcu_read_unlock(); - - SET_TX_DESC_FIRST_SEG(pdesc, (firstseg ? 1 : 0)); - SET_TX_DESC_LAST_SEG(pdesc, (lastseg ? 1 : 0)); - - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16) skb->len); - - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping); - - if (rtlpriv->dm.useramask) { - SET_TX_DESC_RATE_ID(pdesc, tcb_desc->ratr_index); - SET_TX_DESC_MACID(pdesc, tcb_desc->mac_id); - } else { - SET_TX_DESC_RATE_ID(pdesc, 0xC + tcb_desc->ratr_index); - SET_TX_DESC_MACID(pdesc, tcb_desc->ratr_index); - } - - if ((!ieee80211_is_data_qos(fc)) && ppsc->fwctrl_lps) { - SET_TX_DESC_HWSEQ_EN(pdesc, 1); - SET_TX_DESC_PKT_ID(pdesc, 8); - - if (!defaultadapter) - SET_TX_DESC_QOS(pdesc, 1); - } - - SET_TX_DESC_MORE_FRAG(pdesc, (lastseg ? 0 : 1)); - - if (is_multicast_ether_addr(ieee80211_get_DA(hdr)) || - is_broadcast_ether_addr(ieee80211_get_DA(hdr))) { - SET_TX_DESC_BMC(pdesc, 1); - } - - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "\n"); -} - -void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, - u8 *pdesc, bool firstseg, - bool lastseg, struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u8 fw_queue = QSLT_BEACON; - - dma_addr_t mapping = pci_map_single(rtlpci->pdev, - skb->data, skb->len, - PCI_DMA_TODEVICE); - - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); - __le16 fc = hdr->frame_control; - - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } - CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); - - if (firstseg) - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); - - SET_TX_DESC_TX_RATE(pdesc, DESC92_RATE1M); - - SET_TX_DESC_SEQ(pdesc, 0); - - SET_TX_DESC_LINIP(pdesc, 0); - - SET_TX_DESC_QUEUE_SEL(pdesc, fw_queue); - - SET_TX_DESC_FIRST_SEG(pdesc, 1); - SET_TX_DESC_LAST_SEG(pdesc, 1); - - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16) (skb->len)); - - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping); - - SET_TX_DESC_RATE_ID(pdesc, 7); - SET_TX_DESC_MACID(pdesc, 0); - - SET_TX_DESC_OWN(pdesc, 1); - - SET_TX_DESC_PKT_SIZE(pdesc, (u16) (skb->len)); - - SET_TX_DESC_FIRST_SEG(pdesc, 1); - SET_TX_DESC_LAST_SEG(pdesc, 1); - - SET_TX_DESC_OFFSET(pdesc, 0x20); - - SET_TX_DESC_USE_RATE(pdesc, 1); - - if (!ieee80211_is_data_qos(fc)) { - SET_TX_DESC_HWSEQ_EN(pdesc, 1); - SET_TX_DESC_PKT_ID(pdesc, 8); - } - - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, - "H2C Tx Cmd Content", pdesc, TX_DESC_SIZE); -} - -void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val) -{ - if (istx) { - switch (desc_name) { - case HW_DESC_OWN: - wmb(); - SET_TX_DESC_OWN(pdesc, 1); - break; - case HW_DESC_TX_NEXTDESC_ADDR: - SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *) val); - break; - default: - RT_ASSERT(false, "ERR txdesc :%d not process\n", - desc_name); - break; - } - } else { - switch (desc_name) { - case HW_DESC_RXOWN: - wmb(); - SET_RX_DESC_OWN(pdesc, 1); - break; - case HW_DESC_RXBUFF_ADDR: - SET_RX_DESC_BUFF_ADDR(pdesc, *(u32 *) val); - break; - case HW_DESC_RXPKT_LEN: - SET_RX_DESC_PKT_LEN(pdesc, *(u32 *) val); - break; - case HW_DESC_RXERO: - SET_RX_DESC_EOR(pdesc, 1); - break; - default: - RT_ASSERT(false, "ERR rxdesc :%d not process\n", - desc_name); - break; - } - } -} - -u32 rtl92ce_get_desc(u8 *p_desc, bool istx, u8 desc_name) -{ - u32 ret = 0; - - if (istx) { - switch (desc_name) { - case HW_DESC_OWN: - ret = GET_TX_DESC_OWN(p_desc); - break; - case HW_DESC_TXBUFF_ADDR: - ret = GET_TX_DESC_TX_BUFFER_ADDRESS(p_desc); - break; - default: - RT_ASSERT(false, "ERR txdesc :%d not process\n", - desc_name); - break; - } - } else { - struct rx_desc_92c *pdesc = (struct rx_desc_92c *)p_desc; - switch (desc_name) { - case HW_DESC_OWN: - ret = GET_RX_DESC_OWN(pdesc); - break; - case HW_DESC_RXPKT_LEN: - ret = GET_RX_DESC_PKT_LEN(pdesc); - break; - default: - RT_ASSERT(false, "ERR rxdesc :%d not process\n", - desc_name); - break; - } - } - return ret; -} - -void rtl92ce_tx_polling(struct ieee80211_hw *hw, u8 hw_queue) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - if (hw_queue == BEACON_QUEUE) { - rtl_write_word(rtlpriv, REG_PCIE_CTRL_REG, BIT(4)); - } else { - rtl_write_word(rtlpriv, REG_PCIE_CTRL_REG, - BIT(0) << (hw_queue)); - } -} - diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h deleted file mode 100644 index a7cdd514cb2e..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.h +++ /dev/null @@ -1,729 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CE_TRX_H__ -#define __RTL92CE_TRX_H__ - -#define TX_DESC_SIZE 64 -#define TX_DESC_AGGR_SUBFRAME_SIZE 32 - -#define RX_DESC_SIZE 32 -#define RX_DRV_INFO_SIZE_UNIT 8 - -#define TX_DESC_NEXT_DESC_OFFSET 40 -#define USB_HWDESC_HEADER_LEN 32 -#define CRCLENGTH 4 - -/* Define a macro that takes a le32 word, converts it to host ordering, - * right shifts by a specified count, creates a mask of the specified - * bit count, and extracts that number of bits. - */ - -#define SHIFT_AND_MASK_LE(__pdesc, __shift, __mask) \ - ((le32_to_cpu(*(((__le32 *)(__pdesc)))) >> (__shift)) & \ - BIT_LEN_MASK_32(__mask)) - -/* Define a macro that clears a bit field in an le32 word and - * sets the specified value into that bit field. The resulting - * value remains in le32 ordering; however, it is properly converted - * to host ordering for the clear and set operations before conversion - * back to le32. - */ - -#define SET_BITS_OFFSET_LE(__pdesc, __shift, __len, __val) \ - (*(__le32 *)(__pdesc) = \ - (cpu_to_le32((le32_to_cpu(*((__le32 *)(__pdesc))) & \ - (~(BIT_OFFSET_LEN_MASK_32((__shift), __len)))) | \ - (((u32)(__val) & BIT_LEN_MASK_32(__len)) << (__shift))))); - -/* macros to read/write various fields in RX or TX descriptors */ - -#define SET_TX_DESC_PKT_SIZE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 0, 16, __val) -#define SET_TX_DESC_OFFSET(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 16, 8, __val) -#define SET_TX_DESC_BMC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 24, 1, __val) -#define SET_TX_DESC_HTC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 25, 1, __val) -#define SET_TX_DESC_LAST_SEG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 26, 1, __val) -#define SET_TX_DESC_FIRST_SEG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 27, 1, __val) -#define SET_TX_DESC_LINIP(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 28, 1, __val) -#define SET_TX_DESC_NO_ACM(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 29, 1, __val) -#define SET_TX_DESC_GF(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 30, 1, __val) -#define SET_TX_DESC_OWN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 31, 1, __val) - -#define GET_TX_DESC_PKT_SIZE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 0, 16) -#define GET_TX_DESC_OFFSET(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 16, 8) -#define GET_TX_DESC_BMC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 24, 1) -#define GET_TX_DESC_HTC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 25, 1) -#define GET_TX_DESC_LAST_SEG(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 26, 1) -#define GET_TX_DESC_FIRST_SEG(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 27, 1) -#define GET_TX_DESC_LINIP(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 28, 1) -#define GET_TX_DESC_NO_ACM(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 29, 1) -#define GET_TX_DESC_GF(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 30, 1) -#define GET_TX_DESC_OWN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 31, 1) - -#define SET_TX_DESC_MACID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 0, 5, __val) -#define SET_TX_DESC_AGG_BREAK(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 5, 1, __val) -#define SET_TX_DESC_BK(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 6, 1, __val) -#define SET_TX_DESC_RDG_ENABLE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 7, 1, __val) -#define SET_TX_DESC_QUEUE_SEL(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 8, 5, __val) -#define SET_TX_DESC_RDG_NAV_EXT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 13, 1, __val) -#define SET_TX_DESC_LSIG_TXOP_EN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 14, 1, __val) -#define SET_TX_DESC_PIFS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 15, 1, __val) -#define SET_TX_DESC_RATE_ID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 16, 4, __val) -#define SET_TX_DESC_NAV_USE_HDR(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 20, 1, __val) -#define SET_TX_DESC_EN_DESC_ID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 21, 1, __val) -#define SET_TX_DESC_SEC_TYPE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 22, 2, __val) -#define SET_TX_DESC_PKT_OFFSET(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 24, 8, __val) - -#define GET_TX_DESC_MACID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 0, 5) -#define GET_TX_DESC_AGG_ENABLE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 5, 1) -#define GET_TX_DESC_AGG_BREAK(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 6, 1) -#define GET_TX_DESC_RDG_ENABLE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 7, 1) -#define GET_TX_DESC_QUEUE_SEL(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 8, 5) -#define GET_TX_DESC_RDG_NAV_EXT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 13, 1) -#define GET_TX_DESC_LSIG_TXOP_EN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 14, 1) -#define GET_TX_DESC_PIFS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 15, 1) -#define GET_TX_DESC_RATE_ID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 16, 4) -#define GET_TX_DESC_NAV_USE_HDR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 20, 1) -#define GET_TX_DESC_EN_DESC_ID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 21, 1) -#define GET_TX_DESC_SEC_TYPE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 22, 2) -#define GET_TX_DESC_PKT_OFFSET(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 24, 8) - -#define SET_TX_DESC_RTS_RC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 0, 6, __val) -#define SET_TX_DESC_DATA_RC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 6, 6, __val) -#define SET_TX_DESC_BAR_RTY_TH(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 14, 2, __val) -#define SET_TX_DESC_MORE_FRAG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 17, 1, __val) -#define SET_TX_DESC_RAW(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 18, 1, __val) -#define SET_TX_DESC_CCX(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 19, 1, __val) -#define SET_TX_DESC_AMPDU_DENSITY(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 20, 3, __val) -#define SET_TX_DESC_ANTSEL_A(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 24, 1, __val) -#define SET_TX_DESC_ANTSEL_B(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 25, 1, __val) -#define SET_TX_DESC_TX_ANT_CCK(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 26, 2, __val) -#define SET_TX_DESC_TX_ANTL(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 28, 2, __val) -#define SET_TX_DESC_TX_ANT_HT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 30, 2, __val) - -#define GET_TX_DESC_RTS_RC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 0, 6) -#define GET_TX_DESC_DATA_RC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 6, 6) -#define GET_TX_DESC_BAR_RTY_TH(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 14, 2) -#define GET_TX_DESC_MORE_FRAG(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 17, 1) -#define GET_TX_DESC_RAW(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 18, 1) -#define GET_TX_DESC_CCX(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 19, 1) -#define GET_TX_DESC_AMPDU_DENSITY(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 20, 3) -#define GET_TX_DESC_ANTSEL_A(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 24, 1) -#define GET_TX_DESC_ANTSEL_B(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 25, 1) -#define GET_TX_DESC_TX_ANT_CCK(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 26, 2) -#define GET_TX_DESC_TX_ANTL(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 28, 2) -#define GET_TX_DESC_TX_ANT_HT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 30, 2) - -#define SET_TX_DESC_NEXT_HEAP_PAGE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+12, 0, 8, __val) -#define SET_TX_DESC_TAIL_PAGE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+12, 8, 8, __val) -#define SET_TX_DESC_SEQ(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+12, 16, 12, __val) -#define SET_TX_DESC_PKT_ID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+12, 28, 4, __val) - -#define GET_TX_DESC_NEXT_HEAP_PAGE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 0, 8) -#define GET_TX_DESC_TAIL_PAGE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 8, 8) -#define GET_TX_DESC_SEQ(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 16, 12) -#define GET_TX_DESC_PKT_ID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 28, 4) - -#define SET_TX_DESC_RTS_RATE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 0, 5, __val) -#define SET_TX_DESC_AP_DCFE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 5, 1, __val) -#define SET_TX_DESC_QOS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 6, 1, __val) -#define SET_TX_DESC_HWSEQ_EN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 7, 1, __val) -#define SET_TX_DESC_USE_RATE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 8, 1, __val) -#define SET_TX_DESC_DISABLE_RTS_FB(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 9, 1, __val) -#define SET_TX_DESC_DISABLE_FB(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 10, 1, __val) -#define SET_TX_DESC_CTS2SELF(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 11, 1, __val) -#define SET_TX_DESC_RTS_ENABLE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 12, 1, __val) -#define SET_TX_DESC_HW_RTS_ENABLE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 13, 1, __val) -#define SET_TX_DESC_PORT_ID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 14, 1, __val) -#define SET_TX_DESC_WAIT_DCTS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 18, 1, __val) -#define SET_TX_DESC_CTS2AP_EN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 19, 1, __val) -#define SET_TX_DESC_TX_SUB_CARRIER(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 20, 2, __val) -#define SET_TX_DESC_TX_STBC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 22, 2, __val) -#define SET_TX_DESC_DATA_SHORT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 24, 1, __val) -#define SET_TX_DESC_DATA_BW(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 25, 1, __val) -#define SET_TX_DESC_RTS_SHORT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 26, 1, __val) -#define SET_TX_DESC_RTS_BW(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 27, 1, __val) -#define SET_TX_DESC_RTS_SC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 28, 2, __val) -#define SET_TX_DESC_RTS_STBC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 30, 2, __val) - -#define GET_TX_DESC_RTS_RATE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 0, 5) -#define GET_TX_DESC_AP_DCFE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 5, 1) -#define GET_TX_DESC_QOS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 6, 1) -#define GET_TX_DESC_HWSEQ_EN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 7, 1) -#define GET_TX_DESC_USE_RATE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 8, 1) -#define GET_TX_DESC_DISABLE_RTS_FB(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 9, 1) -#define GET_TX_DESC_DISABLE_FB(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 10, 1) -#define GET_TX_DESC_CTS2SELF(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 11, 1) -#define GET_TX_DESC_RTS_ENABLE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 12, 1) -#define GET_TX_DESC_HW_RTS_ENABLE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 13, 1) -#define GET_TX_DESC_PORT_ID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 14, 1) -#define GET_TX_DESC_WAIT_DCTS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 18, 1) -#define GET_TX_DESC_CTS2AP_EN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 19, 1) -#define GET_TX_DESC_TX_SUB_CARRIER(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 20, 2) -#define GET_TX_DESC_TX_STBC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 22, 2) -#define GET_TX_DESC_DATA_SHORT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 24, 1) -#define GET_TX_DESC_DATA_BW(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 25, 1) -#define GET_TX_DESC_RTS_SHORT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 26, 1) -#define GET_TX_DESC_RTS_BW(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 27, 1) -#define GET_TX_DESC_RTS_SC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 28, 2) -#define GET_TX_DESC_RTS_STBC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 30, 2) - -#define SET_TX_DESC_TX_RATE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 0, 6, __val) -#define SET_TX_DESC_DATA_SHORTGI(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 6, 1, __val) -#define SET_TX_DESC_CCX_TAG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 7, 1, __val) -#define SET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 8, 5, __val) -#define SET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 13, 4, __val) -#define SET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 17, 1, __val) -#define SET_TX_DESC_DATA_RETRY_LIMIT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 18, 6, __val) -#define SET_TX_DESC_USB_TXAGG_NUM(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 24, 8, __val) - -#define GET_TX_DESC_TX_RATE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 0, 6) -#define GET_TX_DESC_DATA_SHORTGI(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 6, 1) -#define GET_TX_DESC_CCX_TAG(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 7, 1) -#define GET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 8, 5) -#define GET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 13, 4) -#define GET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 17, 1) -#define GET_TX_DESC_DATA_RETRY_LIMIT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 18, 6) -#define GET_TX_DESC_USB_TXAGG_NUM(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 24, 8) - -#define SET_TX_DESC_TXAGC_A(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 0, 5, __val) -#define SET_TX_DESC_TXAGC_B(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 5, 5, __val) -#define SET_TX_DESC_USE_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 10, 1, __val) -#define SET_TX_DESC_MAX_AGG_NUM(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 11, 5, __val) -#define SET_TX_DESC_MCSG1_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 16, 4, __val) -#define SET_TX_DESC_MCSG2_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 20, 4, __val) -#define SET_TX_DESC_MCSG3_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 24, 4, __val) -#define SET_TX_DESC_MCS7_SGI_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 28, 4, __val) - -#define GET_TX_DESC_TXAGC_A(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 0, 5) -#define GET_TX_DESC_TXAGC_B(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 5, 5) -#define GET_TX_DESC_USE_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 10, 1) -#define GET_TX_DESC_MAX_AGG_NUM(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 11, 5) -#define GET_TX_DESC_MCSG1_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 16, 4) -#define GET_TX_DESC_MCSG2_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 20, 4) -#define GET_TX_DESC_MCSG3_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 24, 4) -#define GET_TX_DESC_MCS7_SGI_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 28, 4) - -#define SET_TX_DESC_TX_BUFFER_SIZE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+28, 0, 16, __val) -#define SET_TX_DESC_MCSG4_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+28, 16, 4, __val) -#define SET_TX_DESC_MCSG5_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+28, 20, 4, __val) -#define SET_TX_DESC_MCSG6_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+28, 24, 4, __val) -#define SET_TX_DESC_MCS15_SGI_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+28, 28, 4, __val) - -#define GET_TX_DESC_TX_BUFFER_SIZE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+28, 0, 16) -#define GET_TX_DESC_MCSG4_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+28, 16, 4) -#define GET_TX_DESC_MCSG5_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+28, 20, 4) -#define GET_TX_DESC_MCSG6_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+28, 24, 4) -#define GET_TX_DESC_MCS15_SGI_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+28, 28, 4) - -#define SET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+32, 0, 32, __val) -#define SET_TX_DESC_TX_BUFFER_ADDRESS64(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+36, 0, 32, __val) - -#define GET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+32, 0, 32) -#define GET_TX_DESC_TX_BUFFER_ADDRESS64(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+36, 0, 32) - -#define SET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+40, 0, 32, __val) -#define SET_TX_DESC_NEXT_DESC_ADDRESS64(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+44, 0, 32, __val) - -#define GET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+40, 0, 32) -#define GET_TX_DESC_NEXT_DESC_ADDRESS64(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+44, 0, 32) - -#define GET_RX_DESC_PKT_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 0, 14) -#define GET_RX_DESC_CRC32(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 14, 1) -#define GET_RX_DESC_ICV(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 15, 1) -#define GET_RX_DESC_DRV_INFO_SIZE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 16, 4) -#define GET_RX_DESC_SECURITY(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 20, 3) -#define GET_RX_DESC_QOS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 23, 1) -#define GET_RX_DESC_SHIFT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 24, 2) -#define GET_RX_DESC_PHYST(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 26, 1) -#define GET_RX_DESC_SWDEC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 27, 1) -#define GET_RX_DESC_LS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 28, 1) -#define GET_RX_DESC_FS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 29, 1) -#define GET_RX_DESC_EOR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 30, 1) -#define GET_RX_DESC_OWN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 31, 1) - -#define SET_RX_DESC_PKT_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 0, 14, __val) -#define SET_RX_DESC_EOR(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 30, 1, __val) -#define SET_RX_DESC_OWN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 31, 1, __val) - -#define GET_RX_DESC_MACID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 0, 5) -#define GET_RX_DESC_TID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 5, 4) -#define GET_RX_DESC_HWRSVD(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 9, 5) -#define GET_RX_DESC_PAGGR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 14, 1) -#define GET_RX_DESC_FAGGR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 15, 1) -#define GET_RX_DESC_A1_FIT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 16, 4) -#define GET_RX_DESC_A2_FIT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 20, 4) -#define GET_RX_DESC_PAM(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 24, 1) -#define GET_RX_DESC_PWR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 25, 1) -#define GET_RX_DESC_MD(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 26, 1) -#define GET_RX_DESC_MF(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 27, 1) -#define GET_RX_DESC_TYPE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 28, 2) -#define GET_RX_DESC_MC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 30, 1) -#define GET_RX_DESC_BC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 31, 1) -#define GET_RX_DESC_SEQ(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 0, 12) -#define GET_RX_DESC_FRAG(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 12, 4) -#define GET_RX_DESC_NEXT_PKT_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 16, 14) -#define GET_RX_DESC_NEXT_IND(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 30, 1) -#define GET_RX_DESC_RSVD(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 31, 1) - -#define GET_RX_DESC_RXMCS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 0, 6) -#define GET_RX_DESC_RXHT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 6, 1) -#define GET_RX_DESC_SPLCP(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 8, 1) -#define GET_RX_DESC_BW(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 9, 1) -#define GET_RX_DESC_HTC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 10, 1) -#define GET_RX_DESC_HWPC_ERR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 14, 1) -#define GET_RX_DESC_HWPC_IND(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 15, 1) -#define GET_RX_DESC_IV0(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 16, 16) - -#define GET_RX_DESC_IV1(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 0, 32) -#define GET_RX_DESC_TSFL(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 0, 32) - -#define GET_RX_DESC_BUFF_ADDR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 0, 32) -#define GET_RX_DESC_BUFF_ADDR64(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+28, 0, 32) - -#define SET_RX_DESC_BUFF_ADDR(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 0, 32, __val) -#define SET_RX_DESC_BUFF_ADDR64(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+28, 0, 32, __val) - -#define CLEAR_PCI_TX_DESC_CONTENT(__pdesc, _size) \ - memset(__pdesc, 0, min_t(size_t, _size, TX_DESC_NEXT_DESC_OFFSET)) - -struct rx_fwinfo_92c { - u8 gain_trsw[4]; - u8 pwdb_all; - u8 cfosho[4]; - u8 cfotail[4]; - char rxevm[2]; - char rxsnr[4]; - u8 pdsnr[2]; - u8 csi_current[2]; - u8 csi_target[2]; - u8 sigevm; - u8 max_ex_pwr; - u8 ex_intf_flag:1; - u8 sgi_en:1; - u8 rxsc:2; - u8 reserve:4; -} __packed; - -struct tx_desc_92c { - u32 pktsize:16; - u32 offset:8; - u32 bmc:1; - u32 htc:1; - u32 lastseg:1; - u32 firstseg:1; - u32 linip:1; - u32 noacm:1; - u32 gf:1; - u32 own:1; - - u32 macid:5; - u32 agg_en:1; - u32 bk:1; - u32 rdg_en:1; - u32 queuesel:5; - u32 rd_nav_ext:1; - u32 lsig_txop_en:1; - u32 pifs:1; - u32 rateid:4; - u32 nav_usehdr:1; - u32 en_descid:1; - u32 sectype:2; - u32 pktoffset:8; - - u32 rts_rc:6; - u32 data_rc:6; - u32 rsvd0:2; - u32 bar_retryht:2; - u32 rsvd1:1; - u32 morefrag:1; - u32 raw:1; - u32 ccx:1; - u32 ampdudensity:3; - u32 rsvd2:1; - u32 ant_sela:1; - u32 ant_selb:1; - u32 txant_cck:2; - u32 txant_l:2; - u32 txant_ht:2; - - u32 nextheadpage:8; - u32 tailpage:8; - u32 seq:12; - u32 pktid:4; - - u32 rtsrate:5; - u32 apdcfe:1; - u32 qos:1; - u32 hwseq_enable:1; - u32 userrate:1; - u32 dis_rtsfb:1; - u32 dis_datafb:1; - u32 cts2self:1; - u32 rts_en:1; - u32 hwrts_en:1; - u32 portid:1; - u32 rsvd3:3; - u32 waitdcts:1; - u32 cts2ap_en:1; - u32 txsc:2; - u32 stbc:2; - u32 txshort:1; - u32 txbw:1; - u32 rtsshort:1; - u32 rtsbw:1; - u32 rtssc:2; - u32 rtsstbc:2; - - u32 txrate:6; - u32 shortgi:1; - u32 ccxt:1; - u32 txrate_fb_lmt:5; - u32 rtsrate_fb_lmt:4; - u32 retrylmt_en:1; - u32 txretrylmt:6; - u32 usb_txaggnum:8; - - u32 txagca:5; - u32 txagcb:5; - u32 usemaxlen:1; - u32 maxaggnum:5; - u32 mcsg1maxlen:4; - u32 mcsg2maxlen:4; - u32 mcsg3maxlen:4; - u32 mcs7sgimaxlen:4; - - u32 txbuffersize:16; - u32 mcsg4maxlen:4; - u32 mcsg5maxlen:4; - u32 mcsg6maxlen:4; - u32 mcsg15sgimaxlen:4; - - u32 txbuffaddr; - u32 txbufferaddr64; - u32 nextdescaddress; - u32 nextdescaddress64; - - u32 reserve_pass_pcie_mm_limit[4]; -} __packed; - -struct rx_desc_92c { - u32 length:14; - u32 crc32:1; - u32 icverror:1; - u32 drv_infosize:4; - u32 security:3; - u32 qos:1; - u32 shift:2; - u32 phystatus:1; - u32 swdec:1; - u32 lastseg:1; - u32 firstseg:1; - u32 eor:1; - u32 own:1; - - u32 macid:5; - u32 tid:4; - u32 hwrsvd:5; - u32 paggr:1; - u32 faggr:1; - u32 a1_fit:4; - u32 a2_fit:4; - u32 pam:1; - u32 pwr:1; - u32 moredata:1; - u32 morefrag:1; - u32 type:2; - u32 mc:1; - u32 bc:1; - - u32 seq:12; - u32 frag:4; - u32 nextpktlen:14; - u32 nextind:1; - u32 rsvd:1; - - u32 rxmcs:6; - u32 rxht:1; - u32 amsdu:1; - u32 splcp:1; - u32 bandwidth:1; - u32 htc:1; - u32 tcpchk_rpt:1; - u32 ipcchk_rpt:1; - u32 tcpchk_valid:1; - u32 hwpcerr:1; - u32 hwpcind:1; - u32 iv0:16; - - u32 iv1; - - u32 tsfl; - - u32 bufferaddress; - u32 bufferaddress64; - -} __packed; - -void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, - u8 *pdesc, struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, u8 hw_queue, - struct rtl_tcb_desc *ptcb_desc); -bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw, - struct rtl_stats *stats, - struct ieee80211_rx_status *rx_status, - u8 *pdesc, struct sk_buff *skb); -void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val); -u32 rtl92ce_get_desc(u8 *pdesc, bool istx, u8 desc_name); -void rtl92ce_tx_polling(struct ieee80211_hw *hw, u8 hw_queue); -void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, - bool b_firstseg, bool b_lastseg, - struct sk_buff *skb); -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/Makefile b/drivers/net/wireless/rtlwifi/rtl8192cu/Makefile deleted file mode 100644 index ad2de6b839ef..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -rtl8192cu-objs := \ - dm.o \ - hw.o \ - led.o \ - mac.o \ - phy.o \ - rf.o \ - sw.o \ - table.o \ - trx.o - -obj-$(CONFIG_RTL8192CU) += rtl8192cu.o - -ccflags-y += -D__CHECK_ENDIAN__ diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/def.h b/drivers/net/wireless/rtlwifi/rtl8192cu/def.h deleted file mode 100644 index f916555e6311..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/def.h +++ /dev/null @@ -1,58 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../rtl8192ce/def.h" - -/*------------------------------------------------------------------------- - * Chip specific - *-------------------------------------------------------------------------*/ -#define CHIP_8723 BIT(2) /* RTL8723 With BT feature */ -#define CHIP_8723_DRV_REV BIT(3) /* RTL8723 Driver Revised */ -#define NORMAL_CHIP BIT(4) -#define CHIP_VENDOR_UMC BIT(5) -#define CHIP_VENDOR_UMC_B_CUT BIT(6) - -#define IS_NORMAL_CHIP(version) \ - (((version) & NORMAL_CHIP) ? true : false) - -#define IS_8723_SERIES(version) \ - (((version) & CHIP_8723) ? true : false) - -#define IS_92C_1T2R(version) \ - (((version) & CHIP_92C) && ((version) & CHIP_92C_1T2R)) - -#define IS_VENDOR_UMC(version) \ - (((version) & CHIP_VENDOR_UMC) ? true : false) - -#define IS_VENDOR_8723_A_CUT(version) \ - (((version) & CHIP_VENDOR_UMC) ? (((version) & (BIT(6))) ? \ - false : true) : false) - -#define CHIP_BONDING_92C_1T2R 0x1 -#define CHIP_BONDING_IDENTIFIER(_value) (((_value) >> 22) & 0x3) diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c deleted file mode 100644 index 16a0b9e59acf..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.c +++ /dev/null @@ -1,107 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../base.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" - -void rtl92cu_dm_dynamic_txpower(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - long undec_sm_pwdb; - - if (!rtlpriv->dm.dynamic_txpower_enable) - return; - - if (rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - return; - } - - if ((mac->link_state < MAC80211_LINKED) && - (rtlpriv->dm.entry_min_undec_sm_pwdb == 0)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, - "Not connected to any\n"); - - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - - rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; - return; - } - - if (mac->link_state >= MAC80211_LINKED) { - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "AP Client PWDB = 0x%lx\n", - undec_sm_pwdb); - } else { - undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "STA Default Port PWDB = 0x%lx\n", - undec_sm_pwdb); - } - } else { - undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb; - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "AP Ext Port PWDB = 0x%lx\n", - undec_sm_pwdb); - } - - if (undec_sm_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n"); - } else if ((undec_sm_pwdb < (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) && - (undec_sm_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL1)) { - - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n"); - } else if (undec_sm_pwdb < (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_NORMAL\n"); - } - - if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "PHY_SetTxPowerLevel8192S() Channel = %d\n", - rtlphy->current_channel); - rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel); - } - - rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h b/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h deleted file mode 100644 index d947e7d350bb..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/dm.h +++ /dev/null @@ -1,32 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../rtl8192ce/dm.h" - -void rtl92cu_dm_dynamic_txpower(struct ieee80211_hw *hw); diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c deleted file mode 100644 index 189ba124a8c6..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ /dev/null @@ -1,2357 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../efuse.h" -#include "../base.h" -#include "../cam.h" -#include "../ps.h" -#include "../usb.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "mac.h" -#include "dm.h" -#include "hw.h" -#include "../rtl8192ce/hw.h" -#include "trx.h" -#include "led.h" -#include "table.h" - -static void _rtl92cu_phy_param_tab_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtlpriv); - - rtlphy->hwparam_tables[MAC_REG].length = RTL8192CUMAC_2T_ARRAYLENGTH; - rtlphy->hwparam_tables[MAC_REG].pdata = RTL8192CUMAC_2T_ARRAY; - if (IS_HIGHT_PA(rtlefuse->board_type)) { - rtlphy->hwparam_tables[PHY_REG_PG].length = - RTL8192CUPHY_REG_Array_PG_HPLength; - rtlphy->hwparam_tables[PHY_REG_PG].pdata = - RTL8192CUPHY_REG_Array_PG_HP; - } else { - rtlphy->hwparam_tables[PHY_REG_PG].length = - RTL8192CUPHY_REG_ARRAY_PGLENGTH; - rtlphy->hwparam_tables[PHY_REG_PG].pdata = - RTL8192CUPHY_REG_ARRAY_PG; - } - /* 2T */ - rtlphy->hwparam_tables[PHY_REG_2T].length = - RTL8192CUPHY_REG_2TARRAY_LENGTH; - rtlphy->hwparam_tables[PHY_REG_2T].pdata = - RTL8192CUPHY_REG_2TARRAY; - rtlphy->hwparam_tables[RADIOA_2T].length = - RTL8192CURADIOA_2TARRAYLENGTH; - rtlphy->hwparam_tables[RADIOA_2T].pdata = - RTL8192CURADIOA_2TARRAY; - rtlphy->hwparam_tables[RADIOB_2T].length = - RTL8192CURADIOB_2TARRAYLENGTH; - rtlphy->hwparam_tables[RADIOB_2T].pdata = - RTL8192CU_RADIOB_2TARRAY; - rtlphy->hwparam_tables[AGCTAB_2T].length = - RTL8192CUAGCTAB_2TARRAYLENGTH; - rtlphy->hwparam_tables[AGCTAB_2T].pdata = - RTL8192CUAGCTAB_2TARRAY; - /* 1T */ - if (IS_HIGHT_PA(rtlefuse->board_type)) { - rtlphy->hwparam_tables[PHY_REG_1T].length = - RTL8192CUPHY_REG_1T_HPArrayLength; - rtlphy->hwparam_tables[PHY_REG_1T].pdata = - RTL8192CUPHY_REG_1T_HPArray; - rtlphy->hwparam_tables[RADIOA_1T].length = - RTL8192CURadioA_1T_HPArrayLength; - rtlphy->hwparam_tables[RADIOA_1T].pdata = - RTL8192CURadioA_1T_HPArray; - rtlphy->hwparam_tables[RADIOB_1T].length = - RTL8192CURADIOB_1TARRAYLENGTH; - rtlphy->hwparam_tables[RADIOB_1T].pdata = - RTL8192CU_RADIOB_1TARRAY; - rtlphy->hwparam_tables[AGCTAB_1T].length = - RTL8192CUAGCTAB_1T_HPArrayLength; - rtlphy->hwparam_tables[AGCTAB_1T].pdata = - Rtl8192CUAGCTAB_1T_HPArray; - } else { - rtlphy->hwparam_tables[PHY_REG_1T].length = - RTL8192CUPHY_REG_1TARRAY_LENGTH; - rtlphy->hwparam_tables[PHY_REG_1T].pdata = - RTL8192CUPHY_REG_1TARRAY; - rtlphy->hwparam_tables[RADIOA_1T].length = - RTL8192CURADIOA_1TARRAYLENGTH; - rtlphy->hwparam_tables[RADIOA_1T].pdata = - RTL8192CU_RADIOA_1TARRAY; - rtlphy->hwparam_tables[RADIOB_1T].length = - RTL8192CURADIOB_1TARRAYLENGTH; - rtlphy->hwparam_tables[RADIOB_1T].pdata = - RTL8192CU_RADIOB_1TARRAY; - rtlphy->hwparam_tables[AGCTAB_1T].length = - RTL8192CUAGCTAB_1TARRAYLENGTH; - rtlphy->hwparam_tables[AGCTAB_1T].pdata = - RTL8192CUAGCTAB_1TARRAY; - } -} - -static void _rtl92cu_read_txpower_info_from_hwpg(struct ieee80211_hw *hw, - bool autoload_fail, - u8 *hwinfo) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 rf_path, index, tempval; - u16 i; - - for (rf_path = 0; rf_path < 2; rf_path++) { - for (i = 0; i < 3; i++) { - if (!autoload_fail) { - rtlefuse-> - eeprom_chnlarea_txpwr_cck[rf_path][i] = - hwinfo[EEPROM_TXPOWERCCK + rf_path * 3 + i]; - rtlefuse-> - eeprom_chnlarea_txpwr_ht40_1s[rf_path][i] = - hwinfo[EEPROM_TXPOWERHT40_1S + rf_path * 3 + - i]; - } else { - rtlefuse-> - eeprom_chnlarea_txpwr_cck[rf_path][i] = - EEPROM_DEFAULT_TXPOWERLEVEL; - rtlefuse-> - eeprom_chnlarea_txpwr_ht40_1s[rf_path][i] = - EEPROM_DEFAULT_TXPOWERLEVEL; - } - } - } - for (i = 0; i < 3; i++) { - if (!autoload_fail) - tempval = hwinfo[EEPROM_TXPOWERHT40_2SDIFF + i]; - else - tempval = EEPROM_DEFAULT_HT40_2SDIFF; - rtlefuse->eprom_chnl_txpwr_ht40_2sdf[RF90_PATH_A][i] = - (tempval & 0xf); - rtlefuse->eprom_chnl_txpwr_ht40_2sdf[RF90_PATH_B][i] = - ((tempval & 0xf0) >> 4); - } - for (rf_path = 0; rf_path < 2; rf_path++) - for (i = 0; i < 3; i++) - RTPRINT(rtlpriv, FINIT, INIT_EEPROM, - "RF(%d) EEPROM CCK Area(%d) = 0x%x\n", - rf_path, i, - rtlefuse-> - eeprom_chnlarea_txpwr_cck[rf_path][i]); - for (rf_path = 0; rf_path < 2; rf_path++) - for (i = 0; i < 3; i++) - RTPRINT(rtlpriv, FINIT, INIT_EEPROM, - "RF(%d) EEPROM HT40 1S Area(%d) = 0x%x\n", - rf_path, i, - rtlefuse-> - eeprom_chnlarea_txpwr_ht40_1s[rf_path][i]); - for (rf_path = 0; rf_path < 2; rf_path++) - for (i = 0; i < 3; i++) - RTPRINT(rtlpriv, FINIT, INIT_EEPROM, - "RF(%d) EEPROM HT40 2S Diff Area(%d) = 0x%x\n", - rf_path, i, - rtlefuse-> - eprom_chnl_txpwr_ht40_2sdf[rf_path][i]); - for (rf_path = 0; rf_path < 2; rf_path++) { - for (i = 0; i < 14; i++) { - index = _rtl92c_get_chnl_group((u8) i); - rtlefuse->txpwrlevel_cck[rf_path][i] = - rtlefuse->eeprom_chnlarea_txpwr_cck[rf_path][index]; - rtlefuse->txpwrlevel_ht40_1s[rf_path][i] = - rtlefuse-> - eeprom_chnlarea_txpwr_ht40_1s[rf_path][index]; - if ((rtlefuse-> - eeprom_chnlarea_txpwr_ht40_1s[rf_path][index] - - rtlefuse-> - eprom_chnl_txpwr_ht40_2sdf[rf_path][index]) - > 0) { - rtlefuse->txpwrlevel_ht40_2s[rf_path][i] = - rtlefuse-> - eeprom_chnlarea_txpwr_ht40_1s[rf_path] - [index] - rtlefuse-> - eprom_chnl_txpwr_ht40_2sdf[rf_path] - [index]; - } else { - rtlefuse->txpwrlevel_ht40_2s[rf_path][i] = 0; - } - } - for (i = 0; i < 14; i++) { - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF(%d)-Ch(%d) [CCK / HT40_1S / HT40_2S] = [0x%x / 0x%x / 0x%x]\n", rf_path, i, - rtlefuse->txpwrlevel_cck[rf_path][i], - rtlefuse->txpwrlevel_ht40_1s[rf_path][i], - rtlefuse->txpwrlevel_ht40_2s[rf_path][i]); - } - } - for (i = 0; i < 3; i++) { - if (!autoload_fail) { - rtlefuse->eeprom_pwrlimit_ht40[i] = - hwinfo[EEPROM_TXPWR_GROUP + i]; - rtlefuse->eeprom_pwrlimit_ht20[i] = - hwinfo[EEPROM_TXPWR_GROUP + 3 + i]; - } else { - rtlefuse->eeprom_pwrlimit_ht40[i] = 0; - rtlefuse->eeprom_pwrlimit_ht20[i] = 0; - } - } - for (rf_path = 0; rf_path < 2; rf_path++) { - for (i = 0; i < 14; i++) { - index = _rtl92c_get_chnl_group((u8) i); - if (rf_path == RF90_PATH_A) { - rtlefuse->pwrgroup_ht20[rf_path][i] = - (rtlefuse->eeprom_pwrlimit_ht20[index] - & 0xf); - rtlefuse->pwrgroup_ht40[rf_path][i] = - (rtlefuse->eeprom_pwrlimit_ht40[index] - & 0xf); - } else if (rf_path == RF90_PATH_B) { - rtlefuse->pwrgroup_ht20[rf_path][i] = - ((rtlefuse->eeprom_pwrlimit_ht20[index] - & 0xf0) >> 4); - rtlefuse->pwrgroup_ht40[rf_path][i] = - ((rtlefuse->eeprom_pwrlimit_ht40[index] - & 0xf0) >> 4); - } - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-%d pwrgroup_ht20[%d] = 0x%x\n", - rf_path, i, - rtlefuse->pwrgroup_ht20[rf_path][i]); - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-%d pwrgroup_ht40[%d] = 0x%x\n", - rf_path, i, - rtlefuse->pwrgroup_ht40[rf_path][i]); - } - } - for (i = 0; i < 14; i++) { - index = _rtl92c_get_chnl_group((u8) i); - if (!autoload_fail) - tempval = hwinfo[EEPROM_TXPOWERHT20DIFF + index]; - else - tempval = EEPROM_DEFAULT_HT20_DIFF; - rtlefuse->txpwr_ht20diff[RF90_PATH_A][i] = (tempval & 0xF); - rtlefuse->txpwr_ht20diff[RF90_PATH_B][i] = - ((tempval >> 4) & 0xF); - if (rtlefuse->txpwr_ht20diff[RF90_PATH_A][i] & BIT(3)) - rtlefuse->txpwr_ht20diff[RF90_PATH_A][i] |= 0xF0; - if (rtlefuse->txpwr_ht20diff[RF90_PATH_B][i] & BIT(3)) - rtlefuse->txpwr_ht20diff[RF90_PATH_B][i] |= 0xF0; - index = _rtl92c_get_chnl_group((u8) i); - if (!autoload_fail) - tempval = hwinfo[EEPROM_TXPOWER_OFDMDIFF + index]; - else - tempval = EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF; - rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][i] = (tempval & 0xF); - rtlefuse->txpwr_legacyhtdiff[RF90_PATH_B][i] = - ((tempval >> 4) & 0xF); - } - rtlefuse->legacy_ht_txpowerdiff = - rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][7]; - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-A Ht20 to HT40 Diff[%d] = 0x%x\n", - i, rtlefuse->txpwr_ht20diff[RF90_PATH_A][i]); - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-A Legacy to Ht40 Diff[%d] = 0x%x\n", - i, rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][i]); - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-B Ht20 to HT40 Diff[%d] = 0x%x\n", - i, rtlefuse->txpwr_ht20diff[RF90_PATH_B][i]); - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-B Legacy to HT40 Diff[%d] = 0x%x\n", - i, rtlefuse->txpwr_legacyhtdiff[RF90_PATH_B][i]); - if (!autoload_fail) - rtlefuse->eeprom_regulatory = (hwinfo[RF_OPTION1] & 0x7); - else - rtlefuse->eeprom_regulatory = 0; - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory); - if (!autoload_fail) { - rtlefuse->eeprom_tssi[RF90_PATH_A] = hwinfo[EEPROM_TSSI_A]; - rtlefuse->eeprom_tssi[RF90_PATH_B] = hwinfo[EEPROM_TSSI_B]; - } else { - rtlefuse->eeprom_tssi[RF90_PATH_A] = EEPROM_DEFAULT_TSSI; - rtlefuse->eeprom_tssi[RF90_PATH_B] = EEPROM_DEFAULT_TSSI; - } - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "TSSI_A = 0x%x, TSSI_B = 0x%x\n", - rtlefuse->eeprom_tssi[RF90_PATH_A], - rtlefuse->eeprom_tssi[RF90_PATH_B]); - if (!autoload_fail) - tempval = hwinfo[EEPROM_THERMAL_METER]; - else - tempval = EEPROM_DEFAULT_THERMALMETER; - rtlefuse->eeprom_thermalmeter = (tempval & 0x1f); - if (rtlefuse->eeprom_thermalmeter < 0x06 || - rtlefuse->eeprom_thermalmeter > 0x1c) - rtlefuse->eeprom_thermalmeter = 0x12; - if (rtlefuse->eeprom_thermalmeter == 0x1f || autoload_fail) - rtlefuse->apk_thermalmeterignore = true; - rtlefuse->thermalmeter[0] = rtlefuse->eeprom_thermalmeter; - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "thermalmeter = 0x%x\n", rtlefuse->eeprom_thermalmeter); -} - -static void _rtl92cu_read_board_type(struct ieee80211_hw *hw, u8 *contents) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 boardType; - - if (IS_NORMAL_CHIP(rtlhal->version)) { - boardType = ((contents[EEPROM_RF_OPT1]) & - BOARD_TYPE_NORMAL_MASK) >> 5; /*bit[7:5]*/ - } else { - boardType = contents[EEPROM_RF_OPT4]; - boardType &= BOARD_TYPE_TEST_MASK; - } - rtlefuse->board_type = boardType; - if (IS_HIGHT_PA(rtlefuse->board_type)) - rtlefuse->external_pa = 1; - pr_info("Board Type %x\n", rtlefuse->board_type); -} - -static void _rtl92cu_read_adapter_info(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE] = {0}; - u16 eeprom_id; - - if (rtlefuse->epromtype == EEPROM_BOOT_EFUSE) { - rtl_efuse_shadow_map_update(hw); - memcpy((void *)hwinfo, - (void *)&rtlefuse->efuse_map[EFUSE_INIT_MAP][0], - HWSET_MAX_SIZE); - } else if (rtlefuse->epromtype == EEPROM_93C46) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "RTL819X Not boot from eeprom, check it !!\n"); - } - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_LOUD, "MAP", - hwinfo, HWSET_MAX_SIZE); - eeprom_id = le16_to_cpu(*((__le16 *)&hwinfo[0])); - if (eeprom_id != RTL8190_EEPROM_ID) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "EEPROM ID(%#x) is invalid!!\n", eeprom_id); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - } - if (rtlefuse->autoload_failflag) - return; - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; - *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue; - } - pr_info("MAC address: %pM\n", rtlefuse->dev_addr); - _rtl92cu_read_txpower_info_from_hwpg(hw, - rtlefuse->autoload_failflag, hwinfo); - rtlefuse->eeprom_vid = le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_VID]); - rtlefuse->eeprom_did = le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_DID]); - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, " VID = 0x%02x PID = 0x%02x\n", - rtlefuse->eeprom_vid, rtlefuse->eeprom_did); - rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN]; - rtlefuse->eeprom_version = - le16_to_cpu(*(__le16 *)&hwinfo[EEPROM_VERSION]); - rtlefuse->txpwr_fromeprom = true; - rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROM Customer ID: 0x%2x\n", - rtlefuse->eeprom_oemid); - if (rtlhal->oem_id == RT_CID_DEFAULT) { - switch (rtlefuse->eeprom_oemid) { - case EEPROM_CID_DEFAULT: - if (rtlefuse->eeprom_did == 0x8176) { - if ((rtlefuse->eeprom_svid == 0x103C && - rtlefuse->eeprom_smid == 0x1629)) - rtlhal->oem_id = RT_CID_819x_HP; - else - rtlhal->oem_id = RT_CID_DEFAULT; - } else { - rtlhal->oem_id = RT_CID_DEFAULT; - } - break; - case EEPROM_CID_TOSHIBA: - rtlhal->oem_id = RT_CID_TOSHIBA; - break; - case EEPROM_CID_QMI: - rtlhal->oem_id = RT_CID_819x_QMI; - break; - case EEPROM_CID_WHQL: - default: - rtlhal->oem_id = RT_CID_DEFAULT; - break; - } - } - _rtl92cu_read_board_type(hw, hwinfo); -} - -static void _rtl92cu_hal_customized_behavior(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_usb_priv *usb_priv = rtl_usbpriv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - switch (rtlhal->oem_id) { - case RT_CID_819x_HP: - usb_priv->ledctl.led_opendrain = true; - break; - case RT_CID_819x_Lenovo: - case RT_CID_DEFAULT: - case RT_CID_TOSHIBA: - case RT_CID_CCX: - case RT_CID_819x_Acer: - case RT_CID_WHQL: - default: - break; - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "RT Customized ID: 0x%02X\n", - rtlhal->oem_id); -} - -void rtl92cu_read_eeprom_info(struct ieee80211_hw *hw) -{ - - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 tmp_u1b; - - if (!IS_NORMAL_CHIP(rtlhal->version)) - return; - tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR); - rtlefuse->epromtype = (tmp_u1b & BOOT_FROM_EEPROM) ? - EEPROM_93C46 : EEPROM_BOOT_EFUSE; - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from %s\n", - tmp_u1b & BOOT_FROM_EEPROM ? "EERROM" : "EFUSE"); - rtlefuse->autoload_failflag = (tmp_u1b & EEPROM_EN) ? false : true; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload %s\n", - tmp_u1b & EEPROM_EN ? "OK!!" : "ERR!!"); - _rtl92cu_read_adapter_info(hw); - _rtl92cu_hal_customized_behavior(hw); - return; -} - -static int _rtl92cu_init_power_on(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int status = 0; - u16 value16; - u8 value8; - /* polling autoload done. */ - u32 pollingCount = 0; - - do { - if (rtl_read_byte(rtlpriv, REG_APS_FSMCO) & PFM_ALDN) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "Autoload Done!\n"); - break; - } - if (pollingCount++ > 100) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, - "Failed to polling REG_APS_FSMCO[PFM_ALDN] done!\n"); - return -ENODEV; - } - } while (true); - /* 0. RSV_CTRL 0x1C[7:0] = 0 unlock ISO/CLK/Power control register */ - rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x0); - /* Power on when re-enter from IPS/Radio off/card disable */ - /* enable SPS into PWM mode */ - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x2b); - udelay(100); - value8 = rtl_read_byte(rtlpriv, REG_LDOV12D_CTRL); - if (0 == (value8 & LDV12_EN)) { - value8 |= LDV12_EN; - rtl_write_byte(rtlpriv, REG_LDOV12D_CTRL, value8); - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - " power-on :REG_LDOV12D_CTRL Reg0x21:0x%02x\n", - value8); - udelay(100); - value8 = rtl_read_byte(rtlpriv, REG_SYS_ISO_CTRL); - value8 &= ~ISO_MD2PP; - rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL, value8); - } - /* auto enable WLAN */ - pollingCount = 0; - value16 = rtl_read_word(rtlpriv, REG_APS_FSMCO); - value16 |= APFM_ONMAC; - rtl_write_word(rtlpriv, REG_APS_FSMCO, value16); - do { - if (!(rtl_read_word(rtlpriv, REG_APS_FSMCO) & APFM_ONMAC)) { - pr_info("MAC auto ON okay!\n"); - break; - } - if (pollingCount++ > 100) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, - "Failed to polling REG_APS_FSMCO[APFM_ONMAC] done!\n"); - return -ENODEV; - } - } while (true); - /* Enable Radio ,GPIO ,and LED function */ - rtl_write_word(rtlpriv, REG_APS_FSMCO, 0x0812); - /* release RF digital isolation */ - value16 = rtl_read_word(rtlpriv, REG_SYS_ISO_CTRL); - value16 &= ~ISO_DIOR; - rtl_write_word(rtlpriv, REG_SYS_ISO_CTRL, value16); - /* Reconsider when to do this operation after asking HWSD. */ - pollingCount = 0; - rtl_write_byte(rtlpriv, REG_APSD_CTRL, (rtl_read_byte(rtlpriv, - REG_APSD_CTRL) & ~BIT(6))); - do { - pollingCount++; - } while ((pollingCount < 200) && - (rtl_read_byte(rtlpriv, REG_APSD_CTRL) & BIT(7))); - /* Enable MAC DMA/WMAC/SCHEDULE/SEC block */ - value16 = rtl_read_word(rtlpriv, REG_CR); - value16 |= (HCI_TXDMA_EN | HCI_RXDMA_EN | TXDMA_EN | RXDMA_EN | - PROTOCOL_EN | SCHEDULE_EN | MACTXEN | MACRXEN | ENSEC); - rtl_write_word(rtlpriv, REG_CR, value16); - return status; -} - -static void _rtl92cu_init_queue_reserved_page(struct ieee80211_hw *hw, - bool wmm_enable, - u8 out_ep_num, - u8 queue_sel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - bool isChipN = IS_NORMAL_CHIP(rtlhal->version); - u32 outEPNum = (u32)out_ep_num; - u32 numHQ = 0; - u32 numLQ = 0; - u32 numNQ = 0; - u32 numPubQ; - u32 value32; - u8 value8; - u32 txQPageNum, txQPageUnit, txQRemainPage; - - if (!wmm_enable) { - numPubQ = (isChipN) ? CHIP_B_PAGE_NUM_PUBQ : - CHIP_A_PAGE_NUM_PUBQ; - txQPageNum = TX_TOTAL_PAGE_NUMBER - numPubQ; - - txQPageUnit = txQPageNum/outEPNum; - txQRemainPage = txQPageNum % outEPNum; - if (queue_sel & TX_SELE_HQ) - numHQ = txQPageUnit; - if (queue_sel & TX_SELE_LQ) - numLQ = txQPageUnit; - /* HIGH priority queue always present in the configuration of - * 2 out-ep. Remainder pages have assigned to High queue */ - if ((outEPNum > 1) && (txQRemainPage)) - numHQ += txQRemainPage; - /* NOTE: This step done before writting REG_RQPN. */ - if (isChipN) { - if (queue_sel & TX_SELE_NQ) - numNQ = txQPageUnit; - value8 = (u8)_NPQ(numNQ); - rtl_write_byte(rtlpriv, REG_RQPN_NPQ, value8); - } - } else { - /* for WMM ,number of out-ep must more than or equal to 2! */ - numPubQ = isChipN ? WMM_CHIP_B_PAGE_NUM_PUBQ : - WMM_CHIP_A_PAGE_NUM_PUBQ; - if (queue_sel & TX_SELE_HQ) { - numHQ = isChipN ? WMM_CHIP_B_PAGE_NUM_HPQ : - WMM_CHIP_A_PAGE_NUM_HPQ; - } - if (queue_sel & TX_SELE_LQ) { - numLQ = isChipN ? WMM_CHIP_B_PAGE_NUM_LPQ : - WMM_CHIP_A_PAGE_NUM_LPQ; - } - /* NOTE: This step done before writting REG_RQPN. */ - if (isChipN) { - if (queue_sel & TX_SELE_NQ) - numNQ = WMM_CHIP_B_PAGE_NUM_NPQ; - value8 = (u8)_NPQ(numNQ); - rtl_write_byte(rtlpriv, REG_RQPN_NPQ, value8); - } - } - /* TX DMA */ - value32 = _HPQ(numHQ) | _LPQ(numLQ) | _PUBQ(numPubQ) | LD_RQPN; - rtl_write_dword(rtlpriv, REG_RQPN, value32); -} - -static void _rtl92c_init_trx_buffer(struct ieee80211_hw *hw, bool wmm_enable) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 txpktbuf_bndy; - u8 value8; - - if (!wmm_enable) - txpktbuf_bndy = TX_PAGE_BOUNDARY; - else /* for WMM */ - txpktbuf_bndy = (IS_NORMAL_CHIP(rtlhal->version)) - ? WMM_CHIP_B_TX_PAGE_BOUNDARY - : WMM_CHIP_A_TX_PAGE_BOUNDARY; - rtl_write_byte(rtlpriv, REG_TXPKTBUF_BCNQ_BDNY, txpktbuf_bndy); - rtl_write_byte(rtlpriv, REG_TXPKTBUF_MGQ_BDNY, txpktbuf_bndy); - rtl_write_byte(rtlpriv, REG_TXPKTBUF_WMAC_LBK_BF_HD, txpktbuf_bndy); - rtl_write_byte(rtlpriv, REG_TRXFF_BNDY, txpktbuf_bndy); - rtl_write_byte(rtlpriv, REG_TDECTRL+1, txpktbuf_bndy); - rtl_write_word(rtlpriv, (REG_TRXFF_BNDY + 2), 0x27FF); - value8 = _PSRX(RX_PAGE_SIZE_REG_VALUE) | _PSTX(PBP_128); - rtl_write_byte(rtlpriv, REG_PBP, value8); -} - -static void _rtl92c_init_chipN_reg_priority(struct ieee80211_hw *hw, u16 beQ, - u16 bkQ, u16 viQ, u16 voQ, - u16 mgtQ, u16 hiQ) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u16 value16 = (rtl_read_word(rtlpriv, REG_TRXDMA_CTRL) & 0x7); - - value16 |= _TXDMA_BEQ_MAP(beQ) | _TXDMA_BKQ_MAP(bkQ) | - _TXDMA_VIQ_MAP(viQ) | _TXDMA_VOQ_MAP(voQ) | - _TXDMA_MGQ_MAP(mgtQ) | _TXDMA_HIQ_MAP(hiQ); - rtl_write_word(rtlpriv, REG_TRXDMA_CTRL, value16); -} - -static void _rtl92cu_init_chipN_one_out_ep_priority(struct ieee80211_hw *hw, - bool wmm_enable, - u8 queue_sel) -{ - u16 uninitialized_var(value); - - switch (queue_sel) { - case TX_SELE_HQ: - value = QUEUE_HIGH; - break; - case TX_SELE_LQ: - value = QUEUE_LOW; - break; - case TX_SELE_NQ: - value = QUEUE_NORMAL; - break; - default: - WARN_ON(1); /* Shall not reach here! */ - break; - } - _rtl92c_init_chipN_reg_priority(hw, value, value, value, value, - value, value); - pr_info("Tx queue select: 0x%02x\n", queue_sel); -} - -static void _rtl92cu_init_chipN_two_out_ep_priority(struct ieee80211_hw *hw, - bool wmm_enable, - u8 queue_sel) -{ - u16 beQ, bkQ, viQ, voQ, mgtQ, hiQ; - u16 uninitialized_var(valueHi); - u16 uninitialized_var(valueLow); - - switch (queue_sel) { - case (TX_SELE_HQ | TX_SELE_LQ): - valueHi = QUEUE_HIGH; - valueLow = QUEUE_LOW; - break; - case (TX_SELE_NQ | TX_SELE_LQ): - valueHi = QUEUE_NORMAL; - valueLow = QUEUE_LOW; - break; - case (TX_SELE_HQ | TX_SELE_NQ): - valueHi = QUEUE_HIGH; - valueLow = QUEUE_NORMAL; - break; - default: - WARN_ON(1); - break; - } - if (!wmm_enable) { - beQ = valueLow; - bkQ = valueLow; - viQ = valueHi; - voQ = valueHi; - mgtQ = valueHi; - hiQ = valueHi; - } else {/* for WMM ,CONFIG_OUT_EP_WIFI_MODE */ - beQ = valueHi; - bkQ = valueLow; - viQ = valueLow; - voQ = valueHi; - mgtQ = valueHi; - hiQ = valueHi; - } - _rtl92c_init_chipN_reg_priority(hw, beQ, bkQ, viQ, voQ, mgtQ, hiQ); - pr_info("Tx queue select: 0x%02x\n", queue_sel); -} - -static void _rtl92cu_init_chipN_three_out_ep_priority(struct ieee80211_hw *hw, - bool wmm_enable, - u8 queue_sel) -{ - u16 beQ, bkQ, viQ, voQ, mgtQ, hiQ; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (!wmm_enable) { /* typical setting */ - beQ = QUEUE_LOW; - bkQ = QUEUE_LOW; - viQ = QUEUE_NORMAL; - voQ = QUEUE_HIGH; - mgtQ = QUEUE_HIGH; - hiQ = QUEUE_HIGH; - } else { /* for WMM */ - beQ = QUEUE_LOW; - bkQ = QUEUE_NORMAL; - viQ = QUEUE_NORMAL; - voQ = QUEUE_HIGH; - mgtQ = QUEUE_HIGH; - hiQ = QUEUE_HIGH; - } - _rtl92c_init_chipN_reg_priority(hw, beQ, bkQ, viQ, voQ, mgtQ, hiQ); - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, "Tx queue select :0x%02x..\n", - queue_sel); -} - -static void _rtl92cu_init_chipN_queue_priority(struct ieee80211_hw *hw, - bool wmm_enable, - u8 out_ep_num, - u8 queue_sel) -{ - switch (out_ep_num) { - case 1: - _rtl92cu_init_chipN_one_out_ep_priority(hw, wmm_enable, - queue_sel); - break; - case 2: - _rtl92cu_init_chipN_two_out_ep_priority(hw, wmm_enable, - queue_sel); - break; - case 3: - _rtl92cu_init_chipN_three_out_ep_priority(hw, wmm_enable, - queue_sel); - break; - default: - WARN_ON(1); /* Shall not reach here! */ - break; - } -} - -static void _rtl92cu_init_chipT_queue_priority(struct ieee80211_hw *hw, - bool wmm_enable, - u8 out_ep_num, - u8 queue_sel) -{ - u8 hq_sele = 0; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - switch (out_ep_num) { - case 2: /* (TX_SELE_HQ|TX_SELE_LQ) */ - if (!wmm_enable) /* typical setting */ - hq_sele = HQSEL_VOQ | HQSEL_VIQ | HQSEL_MGTQ | - HQSEL_HIQ; - else /* for WMM */ - hq_sele = HQSEL_VOQ | HQSEL_BEQ | HQSEL_MGTQ | - HQSEL_HIQ; - break; - case 1: - if (TX_SELE_LQ == queue_sel) { - /* map all endpoint to Low queue */ - hq_sele = 0; - } else if (TX_SELE_HQ == queue_sel) { - /* map all endpoint to High queue */ - hq_sele = HQSEL_VOQ | HQSEL_VIQ | HQSEL_BEQ | - HQSEL_BKQ | HQSEL_MGTQ | HQSEL_HIQ; - } - break; - default: - WARN_ON(1); /* Shall not reach here! */ - break; - } - rtl_write_byte(rtlpriv, (REG_TRXDMA_CTRL+1), hq_sele); - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, "Tx queue select :0x%02x..\n", - hq_sele); -} - -static void _rtl92cu_init_queue_priority(struct ieee80211_hw *hw, - bool wmm_enable, - u8 out_ep_num, - u8 queue_sel) -{ - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - if (IS_NORMAL_CHIP(rtlhal->version)) - _rtl92cu_init_chipN_queue_priority(hw, wmm_enable, out_ep_num, - queue_sel); - else - _rtl92cu_init_chipT_queue_priority(hw, wmm_enable, out_ep_num, - queue_sel); -} - -static void _rtl92cu_init_usb_aggregation(struct ieee80211_hw *hw) -{ -} - -static void _rtl92cu_init_wmac_setting(struct ieee80211_hw *hw) -{ - u16 value16; - - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - mac->rx_conf = (RCR_APM | RCR_AM | RCR_ADF | RCR_AB | RCR_APPFCS | - RCR_APP_ICV | RCR_AMF | RCR_HTC_LOC_CTRL | - RCR_APP_MIC | RCR_APP_PHYSTS | RCR_ACRC32); - rtl_write_dword(rtlpriv, REG_RCR, mac->rx_conf); - /* Accept all multicast address */ - rtl_write_dword(rtlpriv, REG_MAR, 0xFFFFFFFF); - rtl_write_dword(rtlpriv, REG_MAR + 4, 0xFFFFFFFF); - /* Accept all management frames */ - value16 = 0xFFFF; - rtl92c_set_mgt_filter(hw, value16); - /* Reject all control frame - default value is 0 */ - rtl92c_set_ctrl_filter(hw, 0x0); - /* Accept all data frames */ - value16 = 0xFFFF; - rtl92c_set_data_filter(hw, value16); -} - -static int _rtl92cu_init_mac(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_usb_priv *usb_priv = rtl_usbpriv(hw); - struct rtl_usb *rtlusb = rtl_usbdev(usb_priv); - int err = 0; - u32 boundary = 0; - u8 wmm_enable = false; /* TODO */ - u8 out_ep_nums = rtlusb->out_ep_nums; - u8 queue_sel = rtlusb->out_queue_sel; - err = _rtl92cu_init_power_on(hw); - - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Failed to init power on!\n"); - return err; - } - if (!wmm_enable) { - boundary = TX_PAGE_BOUNDARY; - } else { /* for WMM */ - boundary = (IS_NORMAL_CHIP(rtlhal->version)) - ? WMM_CHIP_B_TX_PAGE_BOUNDARY - : WMM_CHIP_A_TX_PAGE_BOUNDARY; - } - if (false == rtl92c_init_llt_table(hw, boundary)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Failed to init LLT Table!\n"); - return -EINVAL; - } - _rtl92cu_init_queue_reserved_page(hw, wmm_enable, out_ep_nums, - queue_sel); - _rtl92c_init_trx_buffer(hw, wmm_enable); - _rtl92cu_init_queue_priority(hw, wmm_enable, out_ep_nums, - queue_sel); - /* Get Rx PHY status in order to report RSSI and others. */ - rtl92c_init_driver_info_size(hw, RTL92C_DRIVER_INFO_SIZE); - rtl92c_init_interrupt(hw); - rtl92c_init_network_type(hw); - _rtl92cu_init_wmac_setting(hw); - rtl92c_init_adaptive_ctrl(hw); - rtl92c_init_edca(hw); - rtl92c_init_rate_fallback(hw); - rtl92c_init_retry_function(hw); - _rtl92cu_init_usb_aggregation(hw); - rtlpriv->cfg->ops->set_bw_mode(hw, NL80211_CHAN_HT20); - rtl92c_set_min_space(hw, IS_92C_SERIAL(rtlhal->version)); - rtl92c_init_beacon_parameters(hw, rtlhal->version); - rtl92c_init_ampdu_aggregation(hw); - rtl92c_init_beacon_max_error(hw, true); - return err; -} - -void rtl92cu_enable_hw_security_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 sec_reg_value = 0x0; - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n", - rtlpriv->sec.pairwise_enc_algorithm, - rtlpriv->sec.group_enc_algorithm); - if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "not open sw encryption\n"); - return; - } - sec_reg_value = SCR_TxEncEnable | SCR_RxDecEnable; - if (rtlpriv->sec.use_defaultkey) { - sec_reg_value |= SCR_TxUseDK; - sec_reg_value |= SCR_RxUseDK; - } - if (IS_NORMAL_CHIP(rtlhal->version)) - sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK); - rtl_write_byte(rtlpriv, REG_CR + 1, 0x02); - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "The SECR-value %x\n", - sec_reg_value); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value); -} - -static void _rtl92cu_hw_configure(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - - /* To Fix MAC loopback mode fail. */ - rtl_write_byte(rtlpriv, REG_LDOHCI12_CTRL, 0x0f); - rtl_write_byte(rtlpriv, 0x15, 0xe9); - /* HW SEQ CTRL */ - /* set 0x0 to 0xFF by tynli. Default enable HW SEQ NUM. */ - rtl_write_byte(rtlpriv, REG_HWSEQ_CTRL, 0xFF); - /* fixed USB interface interference issue */ - rtl_write_byte(rtlpriv, 0xfe40, 0xe0); - rtl_write_byte(rtlpriv, 0xfe41, 0x8d); - rtl_write_byte(rtlpriv, 0xfe42, 0x80); - rtlusb->reg_bcn_ctrl_val = 0x18; - rtl_write_byte(rtlpriv, REG_BCN_CTRL, (u8)rtlusb->reg_bcn_ctrl_val); -} - -static void _InitPABias(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 pa_setting; - - /* FIXED PA current issue */ - pa_setting = efuse_read_1byte(hw, 0x1FA); - if (!(pa_setting & BIT(0))) { - rtl_set_rfreg(hw, RF90_PATH_A, 0x15, 0x0FFFFF, 0x0F406); - rtl_set_rfreg(hw, RF90_PATH_A, 0x15, 0x0FFFFF, 0x4F406); - rtl_set_rfreg(hw, RF90_PATH_A, 0x15, 0x0FFFFF, 0x8F406); - rtl_set_rfreg(hw, RF90_PATH_A, 0x15, 0x0FFFFF, 0xCF406); - } - if (!(pa_setting & BIT(1)) && IS_NORMAL_CHIP(rtlhal->version) && - IS_92C_SERIAL(rtlhal->version)) { - rtl_set_rfreg(hw, RF90_PATH_B, 0x15, 0x0FFFFF, 0x0F406); - rtl_set_rfreg(hw, RF90_PATH_B, 0x15, 0x0FFFFF, 0x4F406); - rtl_set_rfreg(hw, RF90_PATH_B, 0x15, 0x0FFFFF, 0x8F406); - rtl_set_rfreg(hw, RF90_PATH_B, 0x15, 0x0FFFFF, 0xCF406); - } - if (!(pa_setting & BIT(4))) { - pa_setting = rtl_read_byte(rtlpriv, 0x16); - pa_setting &= 0x0F; - rtl_write_byte(rtlpriv, 0x16, pa_setting | 0x90); - } -} - -static void _update_mac_setting(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - mac->rx_conf = rtl_read_dword(rtlpriv, REG_RCR); - mac->rx_mgt_filter = rtl_read_word(rtlpriv, REG_RXFLTMAP0); - mac->rx_ctrl_filter = rtl_read_word(rtlpriv, REG_RXFLTMAP1); - mac->rx_data_filter = rtl_read_word(rtlpriv, REG_RXFLTMAP2); -} - -int rtl92cu_hw_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - int err = 0; - static bool iqk_initialized; - - rtlhal->hw_type = HARDWARE_TYPE_RTL8192CU; - err = _rtl92cu_init_mac(hw); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "init mac failed!\n"); - return err; - } - err = rtl92c_download_fw(hw); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Failed to download FW. Init HW without FW now..\n"); - err = 1; - return err; - } - rtlhal->last_hmeboxnum = 0; /* h2c */ - _rtl92cu_phy_param_tab_init(hw); - rtl92cu_phy_mac_config(hw); - rtl92cu_phy_bb_config(hw); - rtlphy->rf_mode = RF_OP_BY_SW_3WIRE; - rtl92c_phy_rf_config(hw); - if (IS_VENDOR_UMC_A_CUT(rtlhal->version) && - !IS_92C_SERIAL(rtlhal->version)) { - rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G1, MASKDWORD, 0x30255); - rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G2, MASKDWORD, 0x50a00); - } - rtlphy->rfreg_chnlval[0] = rtl_get_rfreg(hw, (enum radio_path)0, - RF_CHNLBW, RFREG_OFFSET_MASK); - rtlphy->rfreg_chnlval[1] = rtl_get_rfreg(hw, (enum radio_path)1, - RF_CHNLBW, RFREG_OFFSET_MASK); - rtl92cu_bb_block_on(hw); - rtl_cam_reset_all_entry(hw); - rtl92cu_enable_hw_security_config(hw); - ppsc->rfpwr_state = ERFON; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, mac->mac_addr); - if (ppsc->rfpwr_state == ERFON) { - rtl92c_phy_set_rfpath_switch(hw, 1); - if (iqk_initialized) { - rtl92c_phy_iq_calibrate(hw, false); - } else { - rtl92c_phy_iq_calibrate(hw, false); - iqk_initialized = true; - } - rtl92c_dm_check_txpower_tracking(hw); - rtl92c_phy_lc_calibrate(hw); - } - _rtl92cu_hw_configure(hw); - _InitPABias(hw); - _update_mac_setting(hw); - rtl92c_dm_init(hw); - return err; -} - -static void _DisableRFAFEAndResetBB(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); -/************************************** -a. TXPAUSE 0x522[7:0] = 0xFF Pause MAC TX queue -b. RF path 0 offset 0x00 = 0x00 disable RF -c. APSD_CTRL 0x600[7:0] = 0x40 -d. SYS_FUNC_EN 0x02[7:0] = 0x16 reset BB state machine -e. SYS_FUNC_EN 0x02[7:0] = 0x14 reset BB state machine -***************************************/ - u8 eRFPath = 0, value8 = 0; - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF); - rtl_set_rfreg(hw, (enum radio_path)eRFPath, 0x0, MASKBYTE0, 0x0); - - value8 |= APSDOFF; - rtl_write_byte(rtlpriv, REG_APSD_CTRL, value8); /*0x40*/ - value8 = 0; - value8 |= (FEN_USBD | FEN_USBA | FEN_BB_GLB_RSTn); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, value8);/*0x16*/ - value8 &= (~FEN_BB_GLB_RSTn); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, value8); /*0x14*/ -} - -static void _ResetDigitalProcedure1(struct ieee80211_hw *hw, bool bWithoutHWSM) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (rtlhal->fw_version <= 0x20) { - /***************************** - f. MCUFWDL 0x80[7:0]=0 reset MCU ready status - g. SYS_FUNC_EN 0x02[10]= 0 reset MCU reg, (8051 reset) - h. SYS_FUNC_EN 0x02[15-12]= 5 reset MAC reg, DCORE - i. SYS_FUNC_EN 0x02[10]= 1 enable MCU reg, (8051 enable) - ******************************/ - u16 valu16 = 0; - - rtl_write_byte(rtlpriv, REG_MCUFWDL, 0); - valu16 = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN); - rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, (valu16 & - (~FEN_CPUEN))); /* reset MCU ,8051 */ - valu16 = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN)&0x0FFF; - rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, (valu16 | - (FEN_HWPDN|FEN_ELDR))); /* reset MAC */ - valu16 = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN); - rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, (valu16 | - FEN_CPUEN)); /* enable MCU ,8051 */ - } else { - u8 retry_cnts = 0; - - /* IF fw in RAM code, do reset */ - if (rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(1)) { - /* reset MCU ready status */ - rtl_write_byte(rtlpriv, REG_MCUFWDL, 0); - /* 8051 reset by self */ - rtl_write_byte(rtlpriv, REG_HMETFR+3, 0x20); - while ((retry_cnts++ < 100) && - (FEN_CPUEN & rtl_read_word(rtlpriv, - REG_SYS_FUNC_EN))) { - udelay(50); - } - if (retry_cnts >= 100) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "#####=> 8051 reset failed!.........................\n"); - /* if 8051 reset fail, reset MAC. */ - rtl_write_byte(rtlpriv, - REG_SYS_FUNC_EN + 1, - 0x50); - udelay(100); - } - } - /* Reset MAC and Enable 8051 */ - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, 0x54); - rtl_write_byte(rtlpriv, REG_MCUFWDL, 0); - } - if (bWithoutHWSM) { - /***************************** - Without HW auto state machine - g.SYS_CLKR 0x08[15:0] = 0x30A3 disable MAC clock - h.AFE_PLL_CTRL 0x28[7:0] = 0x80 disable AFE PLL - i.AFE_XTAL_CTRL 0x24[15:0] = 0x880F gated AFE DIG_CLOCK - j.SYS_ISu_CTRL 0x00[7:0] = 0xF9 isolated digital to PON - ******************************/ - rtl_write_word(rtlpriv, REG_SYS_CLKR, 0x70A3); - rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL, 0x80); - rtl_write_word(rtlpriv, REG_AFE_XTAL_CTRL, 0x880F); - rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL, 0xF9); - } -} - -static void _ResetDigitalProcedure2(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); -/***************************** -k. SYS_FUNC_EN 0x03[7:0] = 0x44 disable ELDR runction -l. SYS_CLKR 0x08[15:0] = 0x3083 disable ELDR clock -m. SYS_ISO_CTRL 0x01[7:0] = 0x83 isolated ELDR to PON -******************************/ - rtl_write_word(rtlpriv, REG_SYS_CLKR, 0x70A3); - rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL+1, 0x82); -} - -static void _DisableGPIO(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); -/*************************************** -j. GPIO_PIN_CTRL 0x44[31:0]=0x000 -k. Value = GPIO_PIN_CTRL[7:0] -l. GPIO_PIN_CTRL 0x44[31:0] = 0x00FF0000 | (value <<8); write ext PIN level -m. GPIO_MUXCFG 0x42 [15:0] = 0x0780 -n. LEDCFG 0x4C[15:0] = 0x8080 -***************************************/ - u8 value8; - u16 value16; - u32 value32; - - /* 1. Disable GPIO[7:0] */ - rtl_write_word(rtlpriv, REG_GPIO_PIN_CTRL+2, 0x0000); - value32 = rtl_read_dword(rtlpriv, REG_GPIO_PIN_CTRL) & 0xFFFF00FF; - value8 = (u8) (value32&0x000000FF); - value32 |= ((value8<<8) | 0x00FF0000); - rtl_write_dword(rtlpriv, REG_GPIO_PIN_CTRL, value32); - /* 2. Disable GPIO[10:8] */ - rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG+3, 0x00); - value16 = rtl_read_word(rtlpriv, REG_GPIO_MUXCFG+2) & 0xFF0F; - value8 = (u8) (value16&0x000F); - value16 |= ((value8<<4) | 0x0780); - rtl_write_word(rtlpriv, REG_GPIO_PIN_CTRL+2, value16); - /* 3. Disable LED0 & 1 */ - rtl_write_word(rtlpriv, REG_LEDCFG0, 0x8080); -} - -static void _DisableAnalog(struct ieee80211_hw *hw, bool bWithoutHWSM) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u16 value16 = 0; - u8 value8 = 0; - - if (bWithoutHWSM) { - /***************************** - n. LDOA15_CTRL 0x20[7:0] = 0x04 disable A15 power - o. LDOV12D_CTRL 0x21[7:0] = 0x54 disable digital core power - r. When driver call disable, the ASIC will turn off remaining - clock automatically - ******************************/ - rtl_write_byte(rtlpriv, REG_LDOA15_CTRL, 0x04); - value8 = rtl_read_byte(rtlpriv, REG_LDOV12D_CTRL); - value8 &= (~LDV12_EN); - rtl_write_byte(rtlpriv, REG_LDOV12D_CTRL, value8); - } - -/***************************** -h. SPS0_CTRL 0x11[7:0] = 0x23 enter PFM mode -i. APS_FSMCO 0x04[15:0] = 0x4802 set USB suspend -******************************/ - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x23); - value16 |= (APDM_HOST | AFSM_HSUS | PFM_ALDN); - rtl_write_word(rtlpriv, REG_APS_FSMCO, (u16)value16); - rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x0E); -} - -static void _CardDisableHWSM(struct ieee80211_hw *hw) -{ - /* ==== RF Off Sequence ==== */ - _DisableRFAFEAndResetBB(hw); - /* ==== Reset digital sequence ====== */ - _ResetDigitalProcedure1(hw, false); - /* ==== Pull GPIO PIN to balance level and LED control ====== */ - _DisableGPIO(hw); - /* ==== Disable analog sequence === */ - _DisableAnalog(hw, false); -} - -static void _CardDisableWithoutHWSM(struct ieee80211_hw *hw) -{ - /*==== RF Off Sequence ==== */ - _DisableRFAFEAndResetBB(hw); - /* ==== Reset digital sequence ====== */ - _ResetDigitalProcedure1(hw, true); - /* ==== Pull GPIO PIN to balance level and LED control ====== */ - _DisableGPIO(hw); - /* ==== Reset digital sequence ====== */ - _ResetDigitalProcedure2(hw); - /* ==== Disable analog sequence === */ - _DisableAnalog(hw, true); -} - -static void _rtl92cu_set_bcn_ctrl_reg(struct ieee80211_hw *hw, - u8 set_bits, u8 clear_bits) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - - rtlusb->reg_bcn_ctrl_val |= set_bits; - rtlusb->reg_bcn_ctrl_val &= ~clear_bits; - rtl_write_byte(rtlpriv, REG_BCN_CTRL, (u8) rtlusb->reg_bcn_ctrl_val); -} - -static void _rtl92cu_stop_tx_beacon(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - u8 tmp1byte = 0; - if (IS_NORMAL_CHIP(rtlhal->version)) { - tmp1byte = rtl_read_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2); - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, - tmp1byte & (~BIT(6))); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0x64); - tmp1byte = rtl_read_byte(rtlpriv, REG_TBTT_PROHIBIT + 2); - tmp1byte &= ~(BIT(0)); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 2, tmp1byte); - } else { - rtl_write_byte(rtlpriv, REG_TXPAUSE, - rtl_read_byte(rtlpriv, REG_TXPAUSE) | BIT(6)); - } -} - -static void _rtl92cu_resume_tx_beacon(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - u8 tmp1byte = 0; - - if (IS_NORMAL_CHIP(rtlhal->version)) { - tmp1byte = rtl_read_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2); - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, - tmp1byte | BIT(6)); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0xff); - tmp1byte = rtl_read_byte(rtlpriv, REG_TBTT_PROHIBIT + 2); - tmp1byte |= BIT(0); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 2, tmp1byte); - } else { - rtl_write_byte(rtlpriv, REG_TXPAUSE, - rtl_read_byte(rtlpriv, REG_TXPAUSE) & (~BIT(6))); - } -} - -static void _rtl92cu_enable_bcn_sub_func(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - - if (IS_NORMAL_CHIP(rtlhal->version)) - _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(1)); - else - _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(4)); -} - -static void _rtl92cu_disable_bcn_sub_func(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - - if (IS_NORMAL_CHIP(rtlhal->version)) - _rtl92cu_set_bcn_ctrl_reg(hw, BIT(1), 0); - else - _rtl92cu_set_bcn_ctrl_reg(hw, BIT(4), 0); -} - -static int _rtl92cu_set_media_status(struct ieee80211_hw *hw, - enum nl80211_iftype type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 bt_msr = rtl_read_byte(rtlpriv, MSR); - enum led_ctl_mode ledaction = LED_CTL_NO_LINK; - - bt_msr &= 0xfc; - rtl_write_byte(rtlpriv, REG_BCN_MAX_ERR, 0xFF); - if (type == NL80211_IFTYPE_UNSPECIFIED || type == - NL80211_IFTYPE_STATION) { - _rtl92cu_stop_tx_beacon(hw); - _rtl92cu_enable_bcn_sub_func(hw); - } else if (type == NL80211_IFTYPE_ADHOC || type == NL80211_IFTYPE_AP) { - _rtl92cu_resume_tx_beacon(hw); - _rtl92cu_disable_bcn_sub_func(hw); - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Set HW_VAR_MEDIA_STATUS:No such media status(%x)\n", - type); - } - switch (type) { - case NL80211_IFTYPE_UNSPECIFIED: - bt_msr |= MSR_NOLINK; - ledaction = LED_CTL_LINK; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to NO LINK!\n"); - break; - case NL80211_IFTYPE_ADHOC: - bt_msr |= MSR_ADHOC; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to Ad Hoc!\n"); - break; - case NL80211_IFTYPE_STATION: - bt_msr |= MSR_INFRA; - ledaction = LED_CTL_LINK; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to STA!\n"); - break; - case NL80211_IFTYPE_AP: - bt_msr |= MSR_AP; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to AP!\n"); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Network type %d not supported!\n", type); - goto error_out; - } - rtl_write_byte(rtlpriv, (MSR), bt_msr); - rtlpriv->cfg->ops->led_control(hw, ledaction); - if ((bt_msr & 0xfc) == MSR_AP) - rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); - else - rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); - return 0; -error_out: - return 1; -} - -void rtl92cu_card_disable(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - enum nl80211_iftype opmode; - - mac->link_state = MAC80211_NOLINK; - opmode = NL80211_IFTYPE_UNSPECIFIED; - _rtl92cu_set_media_status(hw, opmode); - rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF); - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - if (rtlusb->disableHWSM) - _CardDisableHWSM(hw); - else - _CardDisableWithoutHWSM(hw); -} - -void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR); - - if (rtlpriv->psc.rfpwr_state != ERFON) - return; - - if (check_bssid) { - u8 tmp; - if (IS_NORMAL_CHIP(rtlhal->version)) { - reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); - tmp = BIT(4); - } else { - reg_rcr |= RCR_CBSSID; - tmp = BIT(4) | BIT(5); - } - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, - (u8 *) (®_rcr)); - _rtl92cu_set_bcn_ctrl_reg(hw, 0, tmp); - } else { - u8 tmp; - if (IS_NORMAL_CHIP(rtlhal->version)) { - reg_rcr &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN); - tmp = BIT(4); - } else { - reg_rcr &= ~RCR_CBSSID; - tmp = BIT(4) | BIT(5); - } - reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_RCR, (u8 *) (®_rcr)); - _rtl92cu_set_bcn_ctrl_reg(hw, tmp, 0); - } -} - -/*========================================================================== */ - -int rtl92cu_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (_rtl92cu_set_media_status(hw, type)) - return -EOPNOTSUPP; - - if (rtlpriv->mac80211.link_state == MAC80211_LINKED) { - if (type != NL80211_IFTYPE_AP) - rtl92cu_set_check_bssid(hw, true); - } else { - rtl92cu_set_check_bssid(hw, false); - } - - return 0; -} - -static void _InitBeaconParameters(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - - rtl_write_word(rtlpriv, REG_BCN_CTRL, 0x1010); - - /* TODO: Remove these magic number */ - rtl_write_word(rtlpriv, REG_TBTT_PROHIBIT, 0x6404); - rtl_write_byte(rtlpriv, REG_DRVERLYINT, DRIVER_EARLY_INT_TIME); - rtl_write_byte(rtlpriv, REG_BCNDMATIM, BCN_DMA_ATIME_INT_TIME); - /* Change beacon AIFS to the largest number - * beacause test chip does not contension before sending beacon. */ - if (IS_NORMAL_CHIP(rtlhal->version)) - rtl_write_word(rtlpriv, REG_BCNTCFG, 0x660F); - else - rtl_write_word(rtlpriv, REG_BCNTCFG, 0x66FF); -} - -static void _beacon_function_enable(struct ieee80211_hw *hw, bool Enable, - bool Linked) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - _rtl92cu_set_bcn_ctrl_reg(hw, (BIT(4) | BIT(3) | BIT(1)), 0x00); - rtl_write_byte(rtlpriv, REG_RD_CTRL+1, 0x6F); -} - -void rtl92cu_set_beacon_related_registers(struct ieee80211_hw *hw) -{ - - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 bcn_interval, atim_window; - u32 value32; - - bcn_interval = mac->beacon_interval; - atim_window = 2; /*FIX MERGE */ - rtl_write_word(rtlpriv, REG_ATIMWND, atim_window); - rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); - _InitBeaconParameters(hw); - rtl_write_byte(rtlpriv, REG_SLOT, 0x09); - /* - * Force beacon frame transmission even after receiving beacon frame - * from other ad hoc STA - * - * - * Reset TSF Timer to zero, added by Roger. 2008.06.24 - */ - value32 = rtl_read_dword(rtlpriv, REG_TCR); - value32 &= ~TSFRST; - rtl_write_dword(rtlpriv, REG_TCR, value32); - value32 |= TSFRST; - rtl_write_dword(rtlpriv, REG_TCR, value32); - RT_TRACE(rtlpriv, COMP_INIT|COMP_BEACON, DBG_LOUD, - "SetBeaconRelatedRegisters8192CUsb(): Set TCR(%x)\n", - value32); - /* TODO: Modify later (Find the right parameters) - * NOTE: Fix test chip's bug (about contention windows's randomness) */ - if ((mac->opmode == NL80211_IFTYPE_ADHOC) || - (mac->opmode == NL80211_IFTYPE_AP)) { - rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_CCK, 0x50); - rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_OFDM, 0x50); - } - _beacon_function_enable(hw, true, true); -} - -void rtl92cu_set_beacon_interval(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 bcn_interval = mac->beacon_interval; - - RT_TRACE(rtlpriv, COMP_BEACON, DBG_DMESG, "beacon_interval:%d\n", - bcn_interval); - rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); -} - -void rtl92cu_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr) -{ -} - -void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - switch (variable) { - case HW_VAR_RCR: - *((u32 *)(val)) = mac->rx_conf; - break; - case HW_VAR_RF_STATE: - *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state; - break; - case HW_VAR_FWLPS_RF_ON:{ - enum rf_pwrstate rfState; - u32 val_rcr; - - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RF_STATE, - (u8 *)(&rfState)); - if (rfState == ERFOFF) { - *((bool *) (val)) = true; - } else { - val_rcr = rtl_read_dword(rtlpriv, REG_RCR); - val_rcr &= 0x00070000; - if (val_rcr) - *((bool *) (val)) = false; - else - *((bool *) (val)) = true; - } - break; - } - case HW_VAR_FW_PSMODE_STATUS: - *((bool *) (val)) = ppsc->fw_current_inpsmode; - break; - case HW_VAR_CORRECT_TSF:{ - u64 tsf; - u32 *ptsf_low = (u32 *)&tsf; - u32 *ptsf_high = ((u32 *)&tsf) + 1; - - *ptsf_high = rtl_read_dword(rtlpriv, (REG_TSFTR + 4)); - *ptsf_low = rtl_read_dword(rtlpriv, REG_TSFTR); - *((u64 *)(val)) = tsf; - break; - } - case HW_VAR_MGT_FILTER: - *((u16 *) (val)) = rtl_read_word(rtlpriv, REG_RXFLTMAP0); - break; - case HW_VAR_CTRL_FILTER: - *((u16 *) (val)) = rtl_read_word(rtlpriv, REG_RXFLTMAP1); - break; - case HW_VAR_DATA_FILTER: - *((u16 *) (val)) = rtl_read_word(rtlpriv, REG_RXFLTMAP2); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } -} - -void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - enum wireless_mode wirelessmode = mac->mode; - u8 idx = 0; - - switch (variable) { - case HW_VAR_ETHER_ADDR:{ - for (idx = 0; idx < ETH_ALEN; idx++) { - rtl_write_byte(rtlpriv, (REG_MACID + idx), - val[idx]); - } - break; - } - case HW_VAR_BASIC_RATE:{ - u16 rate_cfg = ((u16 *) val)[0]; - u8 rate_index = 0; - - rate_cfg &= 0x15f; - /* TODO */ - /* if (mac->current_network.vender == HT_IOT_PEER_CISCO - * && ((rate_cfg & 0x150) == 0)) { - * rate_cfg |= 0x010; - * } */ - rate_cfg |= 0x01; - rtl_write_byte(rtlpriv, REG_RRSR, rate_cfg & 0xff); - rtl_write_byte(rtlpriv, REG_RRSR + 1, - (rate_cfg >> 8) & 0xff); - while (rate_cfg > 0x1) { - rate_cfg >>= 1; - rate_index++; - } - rtl_write_byte(rtlpriv, REG_INIRTS_RATE_SEL, - rate_index); - break; - } - case HW_VAR_BSSID:{ - for (idx = 0; idx < ETH_ALEN; idx++) { - rtl_write_byte(rtlpriv, (REG_BSSID + idx), - val[idx]); - } - break; - } - case HW_VAR_SIFS:{ - rtl_write_byte(rtlpriv, REG_SIFS_CCK + 1, val[0]); - rtl_write_byte(rtlpriv, REG_SIFS_OFDM + 1, val[1]); - rtl_write_byte(rtlpriv, REG_SPEC_SIFS + 1, val[0]); - rtl_write_byte(rtlpriv, REG_MAC_SPEC_SIFS + 1, val[0]); - rtl_write_byte(rtlpriv, REG_R2T_SIFS+1, val[0]); - rtl_write_byte(rtlpriv, REG_T2T_SIFS+1, val[0]); - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, "HW_VAR_SIFS\n"); - break; - } - case HW_VAR_SLOT_TIME:{ - u8 e_aci; - u8 QOS_MODE = 1; - - rtl_write_byte(rtlpriv, REG_SLOT, val[0]); - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "HW_VAR_SLOT_TIME %x\n", val[0]); - if (QOS_MODE) { - for (e_aci = 0; e_aci < AC_MAX; e_aci++) - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_AC_PARAM, - &e_aci); - } else { - u8 sifstime = 0; - u8 u1bAIFS; - - if (IS_WIRELESS_MODE_A(wirelessmode) || - IS_WIRELESS_MODE_N_24G(wirelessmode) || - IS_WIRELESS_MODE_N_5G(wirelessmode)) - sifstime = 16; - else - sifstime = 10; - u1bAIFS = sifstime + (2 * val[0]); - rtl_write_byte(rtlpriv, REG_EDCA_VO_PARAM, - u1bAIFS); - rtl_write_byte(rtlpriv, REG_EDCA_VI_PARAM, - u1bAIFS); - rtl_write_byte(rtlpriv, REG_EDCA_BE_PARAM, - u1bAIFS); - rtl_write_byte(rtlpriv, REG_EDCA_BK_PARAM, - u1bAIFS); - } - break; - } - case HW_VAR_ACK_PREAMBLE:{ - u8 reg_tmp; - u8 short_preamble = (bool)*val; - reg_tmp = 0; - if (short_preamble) - reg_tmp |= 0x80; - rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_tmp); - break; - } - case HW_VAR_AMPDU_MIN_SPACE:{ - u8 min_spacing_to_set; - u8 sec_min_space; - - min_spacing_to_set = *val; - if (min_spacing_to_set <= 7) { - switch (rtlpriv->sec.pairwise_enc_algorithm) { - case NO_ENCRYPTION: - case AESCCMP_ENCRYPTION: - sec_min_space = 0; - break; - case WEP40_ENCRYPTION: - case WEP104_ENCRYPTION: - case TKIP_ENCRYPTION: - sec_min_space = 6; - break; - default: - sec_min_space = 7; - break; - } - if (min_spacing_to_set < sec_min_space) - min_spacing_to_set = sec_min_space; - mac->min_space_cfg = ((mac->min_space_cfg & - 0xf8) | - min_spacing_to_set); - *val = min_spacing_to_set; - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_AMPDU_MIN_SPACE: %#x\n", - mac->min_space_cfg); - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, - mac->min_space_cfg); - } - break; - } - case HW_VAR_SHORTGI_DENSITY:{ - u8 density_to_set; - - density_to_set = *val; - density_to_set &= 0x1f; - mac->min_space_cfg &= 0x07; - mac->min_space_cfg |= (density_to_set << 3); - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_SHORTGI_DENSITY: %#x\n", - mac->min_space_cfg); - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, - mac->min_space_cfg); - break; - } - case HW_VAR_AMPDU_FACTOR:{ - u8 regtoset_normal[4] = {0x41, 0xa8, 0x72, 0xb9}; - u8 factor_toset; - u8 *p_regtoset = NULL; - u8 index = 0; - - p_regtoset = regtoset_normal; - factor_toset = *val; - if (factor_toset <= 3) { - factor_toset = (1 << (factor_toset + 2)); - if (factor_toset > 0xf) - factor_toset = 0xf; - for (index = 0; index < 4; index++) { - if ((p_regtoset[index] & 0xf0) > - (factor_toset << 4)) - p_regtoset[index] = - (p_regtoset[index] & 0x0f) - | (factor_toset << 4); - if ((p_regtoset[index] & 0x0f) > - factor_toset) - p_regtoset[index] = - (p_regtoset[index] & 0xf0) - | (factor_toset); - rtl_write_byte(rtlpriv, - (REG_AGGLEN_LMT + index), - p_regtoset[index]); - } - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_AMPDU_FACTOR: %#x\n", - factor_toset); - } - break; - } - case HW_VAR_AC_PARAM:{ - u8 e_aci = *val; - u32 u4b_ac_param; - u16 cw_min = le16_to_cpu(mac->ac[e_aci].cw_min); - u16 cw_max = le16_to_cpu(mac->ac[e_aci].cw_max); - u16 tx_op = le16_to_cpu(mac->ac[e_aci].tx_op); - - u4b_ac_param = (u32) mac->ac[e_aci].aifs; - u4b_ac_param |= (u32) ((cw_min & 0xF) << - AC_PARAM_ECW_MIN_OFFSET); - u4b_ac_param |= (u32) ((cw_max & 0xF) << - AC_PARAM_ECW_MAX_OFFSET); - u4b_ac_param |= (u32) tx_op << AC_PARAM_TXOP_OFFSET; - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "queue:%x, ac_param:%x\n", - e_aci, u4b_ac_param); - switch (e_aci) { - case AC1_BK: - rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM, - u4b_ac_param); - break; - case AC0_BE: - rtl_write_dword(rtlpriv, REG_EDCA_BE_PARAM, - u4b_ac_param); - break; - case AC2_VI: - rtl_write_dword(rtlpriv, REG_EDCA_VI_PARAM, - u4b_ac_param); - break; - case AC3_VO: - rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, - u4b_ac_param); - break; - default: - RT_ASSERT(false, - "SetHwReg8185(): invalid aci: %d !\n", - e_aci); - break; - } - if (rtlusb->acm_method != eAcmWay2_SW) - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_ACM_CTRL, &e_aci); - break; - } - case HW_VAR_ACM_CTRL:{ - u8 e_aci = *val; - union aci_aifsn *p_aci_aifsn = (union aci_aifsn *) - (&(mac->ac[0].aifs)); - u8 acm = p_aci_aifsn->f.acm; - u8 acm_ctrl = rtl_read_byte(rtlpriv, REG_ACMHWCTRL); - - acm_ctrl = - acm_ctrl | ((rtlusb->acm_method == 2) ? 0x0 : 0x1); - if (acm) { - switch (e_aci) { - case AC0_BE: - acm_ctrl |= AcmHw_BeqEn; - break; - case AC2_VI: - acm_ctrl |= AcmHw_ViqEn; - break; - case AC3_VO: - acm_ctrl |= AcmHw_VoqEn; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "HW_VAR_ACM_CTRL acm set failed: eACI is %d\n", - acm); - break; - } - } else { - switch (e_aci) { - case AC0_BE: - acm_ctrl &= (~AcmHw_BeqEn); - break; - case AC2_VI: - acm_ctrl &= (~AcmHw_ViqEn); - break; - case AC3_VO: - acm_ctrl &= (~AcmHw_BeqEn); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - } - RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE, - "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", - acm_ctrl); - rtl_write_byte(rtlpriv, REG_ACMHWCTRL, acm_ctrl); - break; - } - case HW_VAR_RCR:{ - rtl_write_dword(rtlpriv, REG_RCR, ((u32 *) (val))[0]); - mac->rx_conf = ((u32 *) (val))[0]; - RT_TRACE(rtlpriv, COMP_RECV, DBG_DMESG, - "### Set RCR(0x%08x) ###\n", mac->rx_conf); - break; - } - case HW_VAR_RETRY_LIMIT:{ - u8 retry_limit = val[0]; - - rtl_write_word(rtlpriv, REG_RL, - retry_limit << RETRY_LIMIT_SHORT_SHIFT | - retry_limit << RETRY_LIMIT_LONG_SHIFT); - RT_TRACE(rtlpriv, COMP_MLME, DBG_DMESG, - "Set HW_VAR_RETRY_LIMIT(0x%08x)\n", - retry_limit); - break; - } - case HW_VAR_DUAL_TSF_RST: - rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, (BIT(0) | BIT(1))); - break; - case HW_VAR_EFUSE_BYTES: - rtlefuse->efuse_usedbytes = *((u16 *) val); - break; - case HW_VAR_EFUSE_USAGE: - rtlefuse->efuse_usedpercentage = *val; - break; - case HW_VAR_IO_CMD: - rtl92c_phy_set_io_cmd(hw, (*(enum io_type *)val)); - break; - case HW_VAR_WPA_CONFIG: - rtl_write_byte(rtlpriv, REG_SECCFG, *val); - break; - case HW_VAR_SET_RPWM:{ - u8 rpwm_val = rtl_read_byte(rtlpriv, REG_USB_HRPWM); - - if (rpwm_val & BIT(7)) - rtl_write_byte(rtlpriv, REG_USB_HRPWM, *val); - else - rtl_write_byte(rtlpriv, REG_USB_HRPWM, - *val | BIT(7)); - break; - } - case HW_VAR_H2C_FW_PWRMODE:{ - u8 psmode = *val; - - if ((psmode != FW_PS_ACTIVE_MODE) && - (!IS_92C_SERIAL(rtlhal->version))) - rtl92c_dm_rf_saving(hw, true); - rtl92c_set_fw_pwrmode_cmd(hw, (*val)); - break; - } - case HW_VAR_FW_PSMODE_STATUS: - ppsc->fw_current_inpsmode = *((bool *) val); - break; - case HW_VAR_H2C_FW_JOINBSSRPT:{ - u8 mstatus = *val; - u8 tmp_reg422; - bool recover = false; - - if (mstatus == RT_MEDIA_CONNECT) { - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_AID, NULL); - rtl_write_byte(rtlpriv, REG_CR + 1, 0x03); - _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(3)); - _rtl92cu_set_bcn_ctrl_reg(hw, BIT(4), 0); - tmp_reg422 = rtl_read_byte(rtlpriv, - REG_FWHW_TXQ_CTRL + 2); - if (tmp_reg422 & BIT(6)) - recover = true; - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, - tmp_reg422 & (~BIT(6))); - rtl92c_set_fw_rsvdpagepkt(hw, 0); - _rtl92cu_set_bcn_ctrl_reg(hw, BIT(3), 0); - _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(4)); - if (recover) - rtl_write_byte(rtlpriv, - REG_FWHW_TXQ_CTRL + 2, - tmp_reg422 | BIT(6)); - rtl_write_byte(rtlpriv, REG_CR + 1, 0x02); - } - rtl92c_set_fw_joinbss_report_cmd(hw, (*val)); - break; - } - case HW_VAR_AID:{ - u16 u2btmp; - - u2btmp = rtl_read_word(rtlpriv, REG_BCN_PSR_RPT); - u2btmp &= 0xC000; - rtl_write_word(rtlpriv, REG_BCN_PSR_RPT, - (u2btmp | mac->assoc_id)); - break; - } - case HW_VAR_CORRECT_TSF:{ - u8 btype_ibss = val[0]; - - if (btype_ibss) - _rtl92cu_stop_tx_beacon(hw); - _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(3)); - rtl_write_dword(rtlpriv, REG_TSFTR, (u32)(mac->tsf & - 0xffffffff)); - rtl_write_dword(rtlpriv, REG_TSFTR + 4, - (u32)((mac->tsf >> 32) & 0xffffffff)); - _rtl92cu_set_bcn_ctrl_reg(hw, BIT(3), 0); - if (btype_ibss) - _rtl92cu_resume_tx_beacon(hw); - break; - } - case HW_VAR_MGT_FILTER: - rtl_write_word(rtlpriv, REG_RXFLTMAP0, *(u16 *)val); - break; - case HW_VAR_CTRL_FILTER: - rtl_write_word(rtlpriv, REG_RXFLTMAP1, *(u16 *)val); - break; - case HW_VAR_DATA_FILTER: - rtl_write_word(rtlpriv, REG_RXFLTMAP2, *(u16 *)val); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } -} - -static void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, - struct ieee80211_sta *sta) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u32 ratr_value; - u8 ratr_index = 0; - u8 nmode = mac->ht_enable; - u8 mimo_ps = IEEE80211_SMPS_OFF; - u16 shortgi_rate; - u32 tmp_ratr_value; - u8 curtxbw_40mhz = mac->bw_40; - u8 curshortgi_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? - 1 : 0; - u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? - 1 : 0; - enum wireless_mode wirelessmode = mac->mode; - - if (rtlhal->current_bandtype == BAND_ON_5G) - ratr_value = sta->supp_rates[1] << 4; - else - ratr_value = sta->supp_rates[0]; - if (mac->opmode == NL80211_IFTYPE_ADHOC) - ratr_value = 0xfff; - - ratr_value |= (sta->ht_cap.mcs.rx_mask[1] << 20 | - sta->ht_cap.mcs.rx_mask[0] << 12); - switch (wirelessmode) { - case WIRELESS_MODE_B: - if (ratr_value & 0x0000000c) - ratr_value &= 0x0000000d; - else - ratr_value &= 0x0000000f; - break; - case WIRELESS_MODE_G: - ratr_value &= 0x00000FF5; - break; - case WIRELESS_MODE_N_24G: - case WIRELESS_MODE_N_5G: - nmode = 1; - if (mimo_ps == IEEE80211_SMPS_STATIC) { - ratr_value &= 0x0007F005; - } else { - u32 ratr_mask; - - if (get_rf_type(rtlphy) == RF_1T2R || - get_rf_type(rtlphy) == RF_1T1R) - ratr_mask = 0x000ff005; - else - ratr_mask = 0x0f0ff005; - - ratr_value &= ratr_mask; - } - break; - default: - if (rtlphy->rf_type == RF_1T2R) - ratr_value &= 0x000ff0ff; - else - ratr_value &= 0x0f0ff0ff; - - break; - } - - ratr_value &= 0x0FFFFFFF; - - if (nmode && ((curtxbw_40mhz && - curshortgi_40mhz) || (!curtxbw_40mhz && - curshortgi_20mhz))) { - - ratr_value |= 0x10000000; - tmp_ratr_value = (ratr_value >> 12); - - for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) { - if ((1 << shortgi_rate) & tmp_ratr_value) - break; - } - - shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) | - (shortgi_rate << 4) | (shortgi_rate); - } - - rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); - - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n", - rtl_read_dword(rtlpriv, REG_ARFR0)); -} - -static void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - u8 rssi_level) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_sta_info *sta_entry = NULL; - u32 ratr_bitmap; - u8 ratr_index; - u8 curtxbw_40mhz = (sta->bandwidth >= IEEE80211_STA_RX_BW_40) ? 1 : 0; - u8 curshortgi_40mhz = curtxbw_40mhz && - (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? - 1 : 0; - u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? - 1 : 0; - enum wireless_mode wirelessmode = 0; - bool shortgi = false; - u8 rate_mask[5]; - u8 macid = 0; - u8 mimo_ps = IEEE80211_SMPS_OFF; - - sta_entry = (struct rtl_sta_info *) sta->drv_priv; - wirelessmode = sta_entry->wireless_mode; - if (mac->opmode == NL80211_IFTYPE_STATION || - mac->opmode == NL80211_IFTYPE_MESH_POINT) - curtxbw_40mhz = mac->bw_40; - else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) - macid = sta->aid + 1; - - if (rtlhal->current_bandtype == BAND_ON_5G) - ratr_bitmap = sta->supp_rates[1] << 4; - else - ratr_bitmap = sta->supp_rates[0]; - if (mac->opmode == NL80211_IFTYPE_ADHOC) - ratr_bitmap = 0xfff; - ratr_bitmap |= (sta->ht_cap.mcs.rx_mask[1] << 20 | - sta->ht_cap.mcs.rx_mask[0] << 12); - switch (wirelessmode) { - case WIRELESS_MODE_B: - ratr_index = RATR_INX_WIRELESS_B; - if (ratr_bitmap & 0x0000000c) - ratr_bitmap &= 0x0000000d; - else - ratr_bitmap &= 0x0000000f; - break; - case WIRELESS_MODE_G: - ratr_index = RATR_INX_WIRELESS_GB; - - if (rssi_level == 1) - ratr_bitmap &= 0x00000f00; - else if (rssi_level == 2) - ratr_bitmap &= 0x00000ff0; - else - ratr_bitmap &= 0x00000ff5; - break; - case WIRELESS_MODE_A: - ratr_index = RATR_INX_WIRELESS_A; - ratr_bitmap &= 0x00000ff0; - break; - case WIRELESS_MODE_N_24G: - case WIRELESS_MODE_N_5G: - ratr_index = RATR_INX_WIRELESS_NGB; - - if (mimo_ps == IEEE80211_SMPS_STATIC) { - if (rssi_level == 1) - ratr_bitmap &= 0x00070000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0007f000; - else - ratr_bitmap &= 0x0007f005; - } else { - if (rtlphy->rf_type == RF_1T2R || - rtlphy->rf_type == RF_1T1R) { - if (curtxbw_40mhz) { - if (rssi_level == 1) - ratr_bitmap &= 0x000f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x000ff000; - else - ratr_bitmap &= 0x000ff015; - } else { - if (rssi_level == 1) - ratr_bitmap &= 0x000f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x000ff000; - else - ratr_bitmap &= 0x000ff005; - } - } else { - if (curtxbw_40mhz) { - if (rssi_level == 1) - ratr_bitmap &= 0x0f0f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0f0ff000; - else - ratr_bitmap &= 0x0f0ff015; - } else { - if (rssi_level == 1) - ratr_bitmap &= 0x0f0f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0f0ff000; - else - ratr_bitmap &= 0x0f0ff005; - } - } - } - - if ((curtxbw_40mhz && curshortgi_40mhz) || - (!curtxbw_40mhz && curshortgi_20mhz)) { - - if (macid == 0) - shortgi = true; - else if (macid == 1) - shortgi = false; - } - break; - default: - ratr_index = RATR_INX_WIRELESS_NGB; - - if (rtlphy->rf_type == RF_1T2R) - ratr_bitmap &= 0x000ff0ff; - else - ratr_bitmap &= 0x0f0ff0ff; - break; - } - sta_entry->ratr_index = ratr_index; - - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, - "ratr_bitmap :%x\n", ratr_bitmap); - *(u32 *)&rate_mask = (ratr_bitmap & 0x0fffffff) | - (ratr_index << 28); - rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80; - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, - "Rate_index:%x, ratr_val:%x, %5phC\n", - ratr_index, ratr_bitmap, rate_mask); - memcpy(rtlpriv->rate_mask, rate_mask, 5); - /* rtl92c_fill_h2c_cmd() does USB I/O and will result in a - * "scheduled while atomic" if called directly */ - schedule_work(&rtlpriv->works.fill_h2c_cmd); - - if (macid != 0) - sta_entry->ratr_index = ratr_index; -} - -void rtl92cu_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - u8 rssi_level) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->dm.useramask) - rtl92cu_update_hal_rate_mask(hw, sta, rssi_level); - else - rtl92cu_update_hal_rate_table(hw, sta); -} - -void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 sifs_timer; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME, - &mac->slot_time); - if (!mac->ht_enable) - sifs_timer = 0x0a0a; - else - sifs_timer = 0x0e0e; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SIFS, (u8 *)&sifs_timer); -} - -bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - enum rf_pwrstate e_rfpowerstate_toset, cur_rfstate; - u8 u1tmp = 0; - bool actuallyset = false; - unsigned long flag = 0; - /* to do - usb autosuspend */ - u8 usb_autosuspend = 0; - - if (ppsc->swrf_processing) - return false; - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); - if (ppsc->rfchange_inprogress) { - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - return false; - } else { - ppsc->rfchange_inprogress = true; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - } - cur_rfstate = ppsc->rfpwr_state; - if (usb_autosuspend) { - /* to do................... */ - } else { - if (ppsc->pwrdown_mode) { - u1tmp = rtl_read_byte(rtlpriv, REG_HSISR); - e_rfpowerstate_toset = (u1tmp & BIT(7)) ? - ERFOFF : ERFON; - RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, - "pwrdown, 0x5c(BIT7)=%02x\n", u1tmp); - } else { - rtl_write_byte(rtlpriv, REG_MAC_PINMUX_CFG, - rtl_read_byte(rtlpriv, - REG_MAC_PINMUX_CFG) & ~(BIT(3))); - u1tmp = rtl_read_byte(rtlpriv, REG_GPIO_IO_SEL); - e_rfpowerstate_toset = (u1tmp & BIT(3)) ? - ERFON : ERFOFF; - RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, - "GPIO_IN=%02x\n", u1tmp); - } - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "N-SS RF =%x\n", - e_rfpowerstate_toset); - } - if ((ppsc->hwradiooff) && (e_rfpowerstate_toset == ERFON)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "GPIOChangeRF - HW Radio ON, RF ON\n"); - ppsc->hwradiooff = false; - actuallyset = true; - } else if ((!ppsc->hwradiooff) && (e_rfpowerstate_toset == - ERFOFF)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "GPIOChangeRF - HW Radio OFF\n"); - ppsc->hwradiooff = true; - actuallyset = true; - } else { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "pHalData->bHwRadioOff and eRfPowerStateToSet do not match: pHalData->bHwRadioOff %x, eRfPowerStateToSet %x\n", - ppsc->hwradiooff, e_rfpowerstate_toset); - } - if (actuallyset) { - ppsc->hwradiooff = true; - if (e_rfpowerstate_toset == ERFON) { - if ((ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM) && - RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_ASPM)) - RT_CLEAR_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_ASPM); - else if ((ppsc->reg_rfps_level & RT_RF_OFF_LEVL_PCI_D3) - && RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_PCI_D3)) - RT_CLEAR_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_PCI_D3); - } - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); - ppsc->rfchange_inprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - /* For power down module, we need to enable register block - * contrl reg at 0x1c. Then enable power down control bit - * of register 0x04 BIT4 and BIT15 as 1. - */ - if (ppsc->pwrdown_mode && e_rfpowerstate_toset == ERFOFF) { - /* Enable register area 0x0-0xc. */ - rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x0); - if (IS_HARDWARE_TYPE_8723U(rtlhal)) { - /* - * We should configure HW PDn source for WiFi - * ONLY, and then our HW will be set in - * power-down mode if PDn source from all - * functions are configured. - */ - u1tmp = rtl_read_byte(rtlpriv, - REG_MULTI_FUNC_CTRL); - rtl_write_byte(rtlpriv, REG_MULTI_FUNC_CTRL, - (u1tmp|WL_HWPDN_EN)); - } else { - rtl_write_word(rtlpriv, REG_APS_FSMCO, 0x8812); - } - } - if (e_rfpowerstate_toset == ERFOFF) { - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM) - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_ASPM); - else if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_PCI_D3) - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_PCI_D3); - } - } else if (e_rfpowerstate_toset == ERFOFF || cur_rfstate == ERFOFF) { - /* Enter D3 or ASPM after GPIO had been done. */ - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM) - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_ASPM); - else if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_PCI_D3) - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_PCI_D3); - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); - ppsc->rfchange_inprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - } else { - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); - ppsc->rfchange_inprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - } - *valid = 1; - return !ppsc->hwradiooff; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h deleted file mode 100644 index 8e3ec1e25644..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h +++ /dev/null @@ -1,113 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CU_HW_H__ -#define __RTL92CU_HW_H__ - -#define H2C_RA_MASK 6 - -#define LLT_POLLING_LLT_THRESHOLD 20 -#define LLT_POLLING_READY_TIMEOUT_COUNT 100 -#define LLT_LAST_ENTRY_OF_TX_PKT_BUFFER 255 - -#define RX_PAGE_SIZE_REG_VALUE PBP_128 -/* Note: We will divide number of page equally for each queue - * other than public queue! */ -#define TX_TOTAL_PAGE_NUMBER 0xF8 -#define TX_PAGE_BOUNDARY (TX_TOTAL_PAGE_NUMBER + 1) - - -#define CHIP_B_PAGE_NUM_PUBQ 0xE7 - -/* For Test Chip Setting - * (HPQ + LPQ + PUBQ) shall be TX_TOTAL_PAGE_NUMBER */ -#define CHIP_A_PAGE_NUM_PUBQ 0x7E - - -/* For Chip A Setting */ -#define WMM_CHIP_A_TX_TOTAL_PAGE_NUMBER 0xF5 -#define WMM_CHIP_A_TX_PAGE_BOUNDARY \ - (WMM_CHIP_A_TX_TOTAL_PAGE_NUMBER + 1) /* F6 */ - -#define WMM_CHIP_A_PAGE_NUM_PUBQ 0xA3 -#define WMM_CHIP_A_PAGE_NUM_HPQ 0x29 -#define WMM_CHIP_A_PAGE_NUM_LPQ 0x29 - - - -/* Note: For Chip B Setting ,modify later */ -#define WMM_CHIP_B_TX_TOTAL_PAGE_NUMBER 0xF5 -#define WMM_CHIP_B_TX_PAGE_BOUNDARY \ - (WMM_CHIP_B_TX_TOTAL_PAGE_NUMBER + 1) /* F6 */ - -#define WMM_CHIP_B_PAGE_NUM_PUBQ 0xB0 -#define WMM_CHIP_B_PAGE_NUM_HPQ 0x29 -#define WMM_CHIP_B_PAGE_NUM_LPQ 0x1C -#define WMM_CHIP_B_PAGE_NUM_NPQ 0x1C - -#define BOARD_TYPE_NORMAL_MASK 0xE0 -#define BOARD_TYPE_TEST_MASK 0x0F - -/* should be renamed and moved to another file */ -enum _BOARD_TYPE_8192CUSB { - BOARD_USB_DONGLE = 0, /* USB dongle */ - BOARD_USB_High_PA = 1, /* USB dongle - high power PA */ - BOARD_MINICARD = 2, /* Minicard */ - BOARD_USB_SOLO = 3, /* USB solo-Slim module */ - BOARD_USB_COMBO = 4, /* USB Combo-Slim module */ -}; - -#define IS_HIGHT_PA(boardtype) \ - ((boardtype == BOARD_USB_High_PA) ? true : false) - -#define RTL92C_DRIVER_INFO_SIZE 4 -void rtl92cu_read_eeprom_info(struct ieee80211_hw *hw); -void rtl92cu_enable_hw_security_config(struct ieee80211_hw *hw); -int rtl92cu_hw_init(struct ieee80211_hw *hw); -void rtl92cu_card_disable(struct ieee80211_hw *hw); -int rtl92cu_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type); -void rtl92cu_set_beacon_related_registers(struct ieee80211_hw *hw); -void rtl92cu_set_beacon_interval(struct ieee80211_hw *hw); -void rtl92cu_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr); -void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); -void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); - -void rtl92cu_update_channel_access_setting(struct ieee80211_hw *hw); -bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid); -void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); -int rtl92c_download_fw(struct ieee80211_hw *hw); -void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); -void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished); -void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); -void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, - u8 element_id, u32 cmd_len, u8 *p_cmdbuffer); -bool rtl92cu_phy_mac_config(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/led.c b/drivers/net/wireless/rtlwifi/rtl8192cu/led.c deleted file mode 100644 index 75a2deb23af1..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/led.c +++ /dev/null @@ -1,141 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../usb.h" -#include "reg.h" -#include "led.h" - -static void _rtl92cu_init_led(struct ieee80211_hw *hw, - struct rtl_led *pled, enum rtl_led_pin ledpin) -{ - pled->hw = hw; - pled->ledpin = ledpin; - pled->ledon = false; -} - -static void _rtl92cu_deInit_led(struct rtl_led *pled) -{ -} - -void rtl92cu_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - u8 ledcfg; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n", - REG_LEDCFG2, pled->ledpin); - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); - switch (pled->ledpin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - rtl_write_byte(rtlpriv, - REG_LEDCFG2, (ledcfg & 0xf0) | BIT(5) | BIT(6)); - break; - case LED_PIN_LED1: - rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg & 0x0f) | BIT(5)); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - pled->ledon = true; -} - -void rtl92cu_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_usb_priv *usbpriv = rtl_usbpriv(hw); - u8 ledcfg; - - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n", - REG_LEDCFG2, pled->ledpin); - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); - switch (pled->ledpin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - ledcfg &= 0xf0; - if (usbpriv->ledctl.led_opendrain) - rtl_write_byte(rtlpriv, REG_LEDCFG2, - (ledcfg | BIT(1) | BIT(5) | BIT(6))); - else - rtl_write_byte(rtlpriv, REG_LEDCFG2, - (ledcfg | BIT(3) | BIT(5) | BIT(6))); - break; - case LED_PIN_LED1: - ledcfg &= 0x0f; - rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg | BIT(3))); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - pled->ledon = false; -} - -void rtl92cu_init_sw_leds(struct ieee80211_hw *hw) -{ - struct rtl_usb_priv *usbpriv = rtl_usbpriv(hw); - _rtl92cu_init_led(hw, &(usbpriv->ledctl.sw_led0), LED_PIN_LED0); - _rtl92cu_init_led(hw, &(usbpriv->ledctl.sw_led1), LED_PIN_LED1); -} - -void rtl92cu_deinit_sw_leds(struct ieee80211_hw *hw) -{ - struct rtl_usb_priv *usbpriv = rtl_usbpriv(hw); - _rtl92cu_deInit_led(&(usbpriv->ledctl.sw_led0)); - _rtl92cu_deInit_led(&(usbpriv->ledctl.sw_led1)); -} - -static void _rtl92cu_sw_led_control(struct ieee80211_hw *hw, - enum led_ctl_mode ledaction) -{ -} - -void rtl92cu_led_control(struct ieee80211_hw *hw, - enum led_ctl_mode ledaction) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - if ((ppsc->rfoff_reason > RF_CHANGE_BY_PS) && - (ledaction == LED_CTL_TX || - ledaction == LED_CTL_RX || - ledaction == LED_CTL_SITE_SURVEY || - ledaction == LED_CTL_LINK || - ledaction == LED_CTL_NO_LINK || - ledaction == LED_CTL_START_TO_LINK || - ledaction == LED_CTL_POWER_ON)) { - return; - } - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "ledaction %d\n", ledaction); - _rtl92cu_sw_led_control(hw, ledaction); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/led.h b/drivers/net/wireless/rtlwifi/rtl8192cu/led.h deleted file mode 100644 index 0f372278b7af..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/led.h +++ /dev/null @@ -1,37 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - *****************************************************************************/ - -#ifndef __RTL92CU_LED_H__ -#define __RTL92CU_LED_H__ - -void rtl92cu_init_sw_leds(struct ieee80211_hw *hw); -void rtl92cu_deinit_sw_leds(struct ieee80211_hw *hw); -void rtl92cu_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl92cu_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl92cu_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c deleted file mode 100644 index 2c68c138912f..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c +++ /dev/null @@ -1,1127 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * -****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../usb.h" -#include "../ps.h" -#include "../cam.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" -#include "mac.h" -#include "trx.h" - -#include - -/* macro to shorten lines */ - -#define LINK_Q ui_link_quality -#define RX_EVM rx_evm_percentage -#define RX_SIGQ rx_mimo_sig_qual - - -void rtl92c_read_chip_version(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - enum version_8192c chip_version = VERSION_UNKNOWN; - const char *versionid; - u32 value32; - - value32 = rtl_read_dword(rtlpriv, REG_SYS_CFG); - if (value32 & TRP_VAUX_EN) { - chip_version = (value32 & TYPE_ID) ? VERSION_TEST_CHIP_92C : - VERSION_TEST_CHIP_88C; - } else { - /* Normal mass production chip. */ - chip_version = NORMAL_CHIP; - chip_version |= ((value32 & TYPE_ID) ? CHIP_92C : 0); - chip_version |= ((value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : 0); - /* RTL8723 with BT function. */ - chip_version |= ((value32 & BT_FUNC) ? CHIP_8723 : 0); - if (IS_VENDOR_UMC(chip_version)) - chip_version |= ((value32 & CHIP_VER_RTL_MASK) ? - CHIP_VENDOR_UMC_B_CUT : 0); - if (IS_92C_SERIAL(chip_version)) { - value32 = rtl_read_dword(rtlpriv, REG_HPON_FSM); - chip_version |= ((CHIP_BONDING_IDENTIFIER(value32) == - CHIP_BONDING_92C_1T2R) ? CHIP_92C_1T2R : 0); - } else if (IS_8723_SERIES(chip_version)) { - value32 = rtl_read_dword(rtlpriv, REG_GPIO_OUTSTS); - chip_version |= ((value32 & RF_RL_ID) ? - CHIP_8723_DRV_REV : 0); - } - } - rtlhal->version = (enum version_8192c)chip_version; - pr_info("Chip version 0x%x\n", chip_version); - switch (rtlhal->version) { - case VERSION_NORMAL_TSMC_CHIP_92C_1T2R: - versionid = "NORMAL_B_CHIP_92C"; - break; - case VERSION_NORMAL_TSMC_CHIP_92C: - versionid = "NORMAL_TSMC_CHIP_92C"; - break; - case VERSION_NORMAL_TSMC_CHIP_88C: - versionid = "NORMAL_TSMC_CHIP_88C"; - break; - case VERSION_NORMAL_UMC_CHIP_92C_1T2R_A_CUT: - versionid = "NORMAL_UMC_CHIP_i92C_1T2R_A_CUT"; - break; - case VERSION_NORMAL_UMC_CHIP_92C_A_CUT: - versionid = "NORMAL_UMC_CHIP_92C_A_CUT"; - break; - case VERSION_NORMAL_UMC_CHIP_88C_A_CUT: - versionid = "NORMAL_UMC_CHIP_88C_A_CUT"; - break; - case VERSION_NORMAL_UMC_CHIP_92C_1T2R_B_CUT: - versionid = "NORMAL_UMC_CHIP_92C_1T2R_B_CUT"; - break; - case VERSION_NORMAL_UMC_CHIP_92C_B_CUT: - versionid = "NORMAL_UMC_CHIP_92C_B_CUT"; - break; - case VERSION_NORMAL_UMC_CHIP_88C_B_CUT: - versionid = "NORMAL_UMC_CHIP_88C_B_CUT"; - break; - case VERSION_NORMA_UMC_CHIP_8723_1T1R_A_CUT: - versionid = "NORMAL_UMC_CHIP_8723_1T1R_A_CUT"; - break; - case VERSION_NORMA_UMC_CHIP_8723_1T1R_B_CUT: - versionid = "NORMAL_UMC_CHIP_8723_1T1R_B_CUT"; - break; - case VERSION_TEST_CHIP_92C: - versionid = "TEST_CHIP_92C"; - break; - case VERSION_TEST_CHIP_88C: - versionid = "TEST_CHIP_88C"; - break; - default: - versionid = "UNKNOWN"; - break; - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Chip Version ID: %s\n", versionid); - - if (IS_92C_SERIAL(rtlhal->version)) - rtlphy->rf_type = - (IS_92C_1T2R(rtlhal->version)) ? RF_1T2R : RF_2T2R; - else - rtlphy->rf_type = RF_1T1R; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Chip RF Type: %s\n", - rtlphy->rf_type == RF_2T2R ? "RF_2T2R" : "RF_1T1R"); - if (get_rf_type(rtlphy) == RF_1T1R) - rtlpriv->dm.rfpath_rxenable[0] = true; - else - rtlpriv->dm.rfpath_rxenable[0] = - rtlpriv->dm.rfpath_rxenable[1] = true; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "VersionID = 0x%4x\n", - rtlhal->version); -} - -/** - * writeLLT - LLT table write access - * @io: io callback - * @address: LLT logical address. - * @data: LLT data content - * - * Realtek hardware access function. - * - */ -bool rtl92c_llt_write(struct ieee80211_hw *hw, u32 address, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - bool status = true; - long count = 0; - u32 value = _LLT_INIT_ADDR(address) | - _LLT_INIT_DATA(data) | _LLT_OP(_LLT_WRITE_ACCESS); - - rtl_write_dword(rtlpriv, REG_LLT_INIT, value); - do { - value = rtl_read_dword(rtlpriv, REG_LLT_INIT); - if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)) - break; - if (count > POLLING_LLT_THRESHOLD) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Failed to polling write LLT done at address %d! _LLT_OP_VALUE(%x)\n", - address, _LLT_OP_VALUE(value)); - status = false; - break; - } - } while (++count); - return status; -} -/** - * rtl92c_init_LLT_table - Init LLT table - * @io: io callback - * @boundary: - * - * Realtek hardware access function. - * - */ -bool rtl92c_init_llt_table(struct ieee80211_hw *hw, u32 boundary) -{ - bool rst = true; - u32 i; - - for (i = 0; i < (boundary - 1); i++) { - rst = rtl92c_llt_write(hw, i , i + 1); - if (true != rst) { - pr_err("===> %s #1 fail\n", __func__); - return rst; - } - } - /* end of list */ - rst = rtl92c_llt_write(hw, (boundary - 1), 0xFF); - if (true != rst) { - pr_err("===> %s #2 fail\n", __func__); - return rst; - } - /* Make the other pages as ring buffer - * This ring buffer is used as beacon buffer if we config this MAC - * as two MAC transfer. - * Otherwise used as local loopback buffer. - */ - for (i = boundary; i < LLT_LAST_ENTRY_OF_TX_PKT_BUFFER; i++) { - rst = rtl92c_llt_write(hw, i, (i + 1)); - if (true != rst) { - pr_err("===> %s #3 fail\n", __func__); - return rst; - } - } - /* Let last entry point to the start entry of ring buffer */ - rst = rtl92c_llt_write(hw, LLT_LAST_ENTRY_OF_TX_PKT_BUFFER, boundary); - if (true != rst) { - pr_err("===> %s #4 fail\n", __func__); - return rst; - } - return rst; -} -void rtl92c_set_key(struct ieee80211_hw *hw, u32 key_index, - u8 *p_macaddr, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 *macaddr = p_macaddr; - u32 entry_id = 0; - bool is_pairwise = false; - static u8 cam_const_addr[4][6] = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} - }; - static u8 cam_const_broad[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - }; - - if (clear_all) { - u8 idx = 0; - u8 cam_offset = 0; - u8 clear_number = 5; - - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "clear_all\n"); - for (idx = 0; idx < clear_number; idx++) { - rtl_cam_mark_invalid(hw, cam_offset + idx); - rtl_cam_empty_entry(hw, cam_offset + idx); - if (idx < 5) { - memset(rtlpriv->sec.key_buf[idx], 0, - MAX_KEY_LEN); - rtlpriv->sec.key_len[idx] = 0; - } - } - } else { - switch (enc_algo) { - case WEP40_ENCRYPTION: - enc_algo = CAM_WEP40; - break; - case WEP104_ENCRYPTION: - enc_algo = CAM_WEP104; - break; - case TKIP_ENCRYPTION: - enc_algo = CAM_TKIP; - break; - case AESCCMP_ENCRYPTION: - enc_algo = CAM_AES; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "illegal switch case\n"); - enc_algo = CAM_TKIP; - break; - } - if (is_wepkey || rtlpriv->sec.use_defaultkey) { - macaddr = cam_const_addr[key_index]; - entry_id = key_index; - } else { - if (is_group) { - macaddr = cam_const_broad; - entry_id = key_index; - } else { - if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_MESH_POINT) { - entry_id = rtl_cam_get_free_entry(hw, - p_macaddr); - if (entry_id >= TOTAL_CAM_ENTRY) { - RT_TRACE(rtlpriv, COMP_SEC, - DBG_EMERG, - "Can not find free hw security cam entry\n"); - return; - } - } else { - entry_id = CAM_PAIRWISE_KEY_POSITION; - } - - key_index = PAIRWISE_KEYIDX; - is_pairwise = true; - } - } - if (rtlpriv->sec.key_len[key_index] == 0) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "delete one entry\n"); - if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_MESH_POINT) - rtl_cam_del_entry(hw, p_macaddr); - rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); - } else { - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, - "The insert KEY length is %d\n", - rtlpriv->sec.key_len[PAIRWISE_KEYIDX]); - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, - "The insert KEY is %x %x\n", - rtlpriv->sec.key_buf[0][0], - rtlpriv->sec.key_buf[0][1]); - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "add one entry\n"); - if (is_pairwise) { - RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_LOUD, - "Pairwise Key content", - rtlpriv->sec.pairwise_key, - rtlpriv->sec. - key_len[PAIRWISE_KEYIDX]); - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "set Pairwise key\n"); - - rtl_cam_add_one_entry(hw, macaddr, key_index, - entry_id, enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec. - key_buf[key_index]); - } else { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "set group key\n"); - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - rtl_cam_add_one_entry(hw, - rtlefuse->dev_addr, - PAIRWISE_KEYIDX, - CAM_PAIRWISE_KEY_POSITION, - enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf - [entry_id]); - } - rtl_cam_add_one_entry(hw, macaddr, key_index, - entry_id, enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf[entry_id]); - } - } - } -} - -u32 rtl92c_get_txdma_status(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - return rtl_read_dword(rtlpriv, REG_TXDMA_STATUS); -} - -void rtl92c_enable_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - - if (IS_HARDWARE_TYPE_8192CE(rtlhal)) { - rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & - 0xFFFFFFFF); - rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & - 0xFFFFFFFF); - } else { - rtl_write_dword(rtlpriv, REG_HIMR, rtlusb->irq_mask[0] & - 0xFFFFFFFF); - rtl_write_dword(rtlpriv, REG_HIMRE, rtlusb->irq_mask[1] & - 0xFFFFFFFF); - } -} - -void rtl92c_init_interrupt(struct ieee80211_hw *hw) -{ - rtl92c_enable_interrupt(hw); -} - -void rtl92c_disable_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_dword(rtlpriv, REG_HIMR, IMR8190_DISABLED); - rtl_write_dword(rtlpriv, REG_HIMRE, IMR8190_DISABLED); -} - -void rtl92c_set_qos(struct ieee80211_hw *hw, int aci) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u32 u4b_ac_param; - - rtl92c_dm_init_edca_turbo(hw); - u4b_ac_param = (u32) mac->ac[aci].aifs; - u4b_ac_param |= - ((u32) le16_to_cpu(mac->ac[aci].cw_min) & 0xF) << - AC_PARAM_ECW_MIN_OFFSET; - u4b_ac_param |= - ((u32) le16_to_cpu(mac->ac[aci].cw_max) & 0xF) << - AC_PARAM_ECW_MAX_OFFSET; - u4b_ac_param |= (u32) le16_to_cpu(mac->ac[aci].tx_op) << - AC_PARAM_TXOP_OFFSET; - RT_TRACE(rtlpriv, COMP_QOS, DBG_LOUD, "queue:%x, ac_param:%x\n", - aci, u4b_ac_param); - switch (aci) { - case AC1_BK: - rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM, u4b_ac_param); - break; - case AC0_BE: - rtl_write_dword(rtlpriv, REG_EDCA_BE_PARAM, u4b_ac_param); - break; - case AC2_VI: - rtl_write_dword(rtlpriv, REG_EDCA_VI_PARAM, u4b_ac_param); - break; - case AC3_VO: - rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, u4b_ac_param); - break; - default: - RT_ASSERT(false, "invalid aci: %d !\n", aci); - break; - } -} - -/*------------------------------------------------------------------------- - * HW MAC Address - *-------------------------------------------------------------------------*/ -void rtl92c_set_mac_addr(struct ieee80211_hw *hw, const u8 *addr) -{ - u32 i; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - for (i = 0 ; i < ETH_ALEN ; i++) - rtl_write_byte(rtlpriv, (REG_MACID + i), *(addr+i)); - - RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, - "MAC Address: %02X-%02X-%02X-%02X-%02X-%02X\n", - rtl_read_byte(rtlpriv, REG_MACID), - rtl_read_byte(rtlpriv, REG_MACID+1), - rtl_read_byte(rtlpriv, REG_MACID+2), - rtl_read_byte(rtlpriv, REG_MACID+3), - rtl_read_byte(rtlpriv, REG_MACID+4), - rtl_read_byte(rtlpriv, REG_MACID+5)); -} - -void rtl92c_init_driver_info_size(struct ieee80211_hw *hw, u8 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - rtl_write_byte(rtlpriv, REG_RX_DRVINFO_SZ, size); -} - -int rtl92c_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) -{ - u8 value; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - switch (type) { - case NL80211_IFTYPE_UNSPECIFIED: - value = NT_NO_LINK; - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "Set Network type to NO LINK!\n"); - break; - case NL80211_IFTYPE_ADHOC: - value = NT_LINK_AD_HOC; - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "Set Network type to Ad Hoc!\n"); - break; - case NL80211_IFTYPE_STATION: - value = NT_LINK_AP; - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "Set Network type to STA!\n"); - break; - case NL80211_IFTYPE_AP: - value = NT_AS_AP; - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "Set Network type to AP!\n"); - break; - default: - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "Network type %d not supported!\n", type); - return -EOPNOTSUPP; - } - rtl_write_byte(rtlpriv, (REG_CR + 2), value); - return 0; -} - -void rtl92c_init_network_type(struct ieee80211_hw *hw) -{ - rtl92c_set_network_type(hw, NL80211_IFTYPE_UNSPECIFIED); -} - -void rtl92c_init_adaptive_ctrl(struct ieee80211_hw *hw) -{ - u16 value16; - u32 value32; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - /* Response Rate Set */ - value32 = rtl_read_dword(rtlpriv, REG_RRSR); - value32 &= ~RATE_BITMAP_ALL; - value32 |= RATE_RRSR_CCK_ONLY_1M; - rtl_write_dword(rtlpriv, REG_RRSR, value32); - /* SIFS (used in NAV) */ - value16 = _SPEC_SIFS_CCK(0x10) | _SPEC_SIFS_OFDM(0x10); - rtl_write_word(rtlpriv, REG_SPEC_SIFS, value16); - /* Retry Limit */ - value16 = _LRL(0x30) | _SRL(0x30); - rtl_write_dword(rtlpriv, REG_RL, value16); -} - -void rtl92c_init_rate_fallback(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - /* Set Data Auto Rate Fallback Retry Count register. */ - rtl_write_dword(rtlpriv, REG_DARFRC, 0x00000000); - rtl_write_dword(rtlpriv, REG_DARFRC+4, 0x10080404); - rtl_write_dword(rtlpriv, REG_RARFRC, 0x04030201); - rtl_write_dword(rtlpriv, REG_RARFRC+4, 0x08070605); -} - -static void rtl92c_set_cck_sifs(struct ieee80211_hw *hw, u8 trx_sifs, - u8 ctx_sifs) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_byte(rtlpriv, REG_SIFS_CCK, trx_sifs); - rtl_write_byte(rtlpriv, (REG_SIFS_CCK + 1), ctx_sifs); -} - -static void rtl92c_set_ofdm_sifs(struct ieee80211_hw *hw, u8 trx_sifs, - u8 ctx_sifs) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_byte(rtlpriv, REG_SIFS_OFDM, trx_sifs); - rtl_write_byte(rtlpriv, (REG_SIFS_OFDM + 1), ctx_sifs); -} - -void rtl92c_init_edca_param(struct ieee80211_hw *hw, - u16 queue, u16 txop, u8 cw_min, u8 cw_max, u8 aifs) -{ - /* sequence: VO, VI, BE, BK ==> the same as 92C hardware design. - * referenc : enum nl80211_txq_q or ieee80211_set_wmm_default function. - */ - u32 value; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - value = (u32)aifs; - value |= ((u32)cw_min & 0xF) << 8; - value |= ((u32)cw_max & 0xF) << 12; - value |= (u32)txop << 16; - /* 92C hardware register sequence is the same as queue number. */ - rtl_write_dword(rtlpriv, (REG_EDCA_VO_PARAM + (queue * 4)), value); -} - -void rtl92c_init_edca(struct ieee80211_hw *hw) -{ - u16 value16; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - /* disable EDCCA count down, to reduce collison and retry */ - value16 = rtl_read_word(rtlpriv, REG_RD_CTRL); - value16 |= DIS_EDCA_CNT_DWN; - rtl_write_word(rtlpriv, REG_RD_CTRL, value16); - /* Update SIFS timing. ?????????? - * pHalData->SifsTime = 0x0e0e0a0a; */ - rtl92c_set_cck_sifs(hw, 0xa, 0xa); - rtl92c_set_ofdm_sifs(hw, 0xe, 0xe); - /* Set CCK/OFDM SIFS to be 10us. */ - rtl_write_word(rtlpriv, REG_SIFS_CCK, 0x0a0a); - rtl_write_word(rtlpriv, REG_SIFS_OFDM, 0x1010); - rtl_write_word(rtlpriv, REG_PROT_MODE_CTRL, 0x0204); - rtl_write_dword(rtlpriv, REG_BAR_MODE_CTRL, 0x014004); - /* TXOP */ - rtl_write_dword(rtlpriv, REG_EDCA_BE_PARAM, 0x005EA42B); - rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM, 0x0000A44F); - rtl_write_dword(rtlpriv, REG_EDCA_VI_PARAM, 0x005EA324); - rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, 0x002FA226); - /* PIFS */ - rtl_write_byte(rtlpriv, REG_PIFS, 0x1C); - /* AGGR BREAK TIME Register */ - rtl_write_byte(rtlpriv, REG_AGGR_BREAK_TIME, 0x16); - rtl_write_word(rtlpriv, REG_NAV_PROT_LEN, 0x0040); - rtl_write_byte(rtlpriv, REG_BCNDMATIM, 0x02); - rtl_write_byte(rtlpriv, REG_ATIMWND, 0x02); -} - -void rtl92c_init_ampdu_aggregation(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_dword(rtlpriv, REG_AGGLEN_LMT, 0x99997631); - rtl_write_byte(rtlpriv, REG_AGGR_BREAK_TIME, 0x16); - /* init AMPDU aggregation number, tuning for Tx's TP, */ - rtl_write_word(rtlpriv, 0x4CA, 0x0708); -} - -void rtl92c_init_beacon_max_error(struct ieee80211_hw *hw, bool infra_mode) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_byte(rtlpriv, REG_BCN_MAX_ERR, 0xFF); -} - -void rtl92c_init_rdg_setting(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_byte(rtlpriv, REG_RD_CTRL, 0xFF); - rtl_write_word(rtlpriv, REG_RD_NAV_NXT, 0x200); - rtl_write_byte(rtlpriv, REG_RD_RESP_PKT_TH, 0x05); -} - -void rtl92c_init_retry_function(struct ieee80211_hw *hw) -{ - u8 value8; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - value8 = rtl_read_byte(rtlpriv, REG_FWHW_TXQ_CTRL); - value8 |= EN_AMPDU_RTY_NEW; - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL, value8); - /* Set ACK timeout */ - rtl_write_byte(rtlpriv, REG_ACKTO, 0x40); -} - -void rtl92c_init_beacon_parameters(struct ieee80211_hw *hw, - enum version_8192c version) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - - rtl_write_word(rtlpriv, REG_TBTT_PROHIBIT, 0x6404);/* ms */ - rtl_write_byte(rtlpriv, REG_DRVERLYINT, DRIVER_EARLY_INT_TIME);/*ms*/ - rtl_write_byte(rtlpriv, REG_BCNDMATIM, BCN_DMA_ATIME_INT_TIME); - if (IS_NORMAL_CHIP(rtlhal->version)) - rtl_write_word(rtlpriv, REG_BCNTCFG, 0x660F); - else - rtl_write_word(rtlpriv, REG_BCNTCFG, 0x66FF); -} - -void rtl92c_disable_fast_edca(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_word(rtlpriv, REG_FAST_EDCA_CTRL, 0); -} - -void rtl92c_set_min_space(struct ieee80211_hw *hw, bool is2T) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 value = is2T ? MAX_MSS_DENSITY_2T : MAX_MSS_DENSITY_1T; - - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, value); -} - -u16 rtl92c_get_mgt_filter(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - return rtl_read_word(rtlpriv, REG_RXFLTMAP0); -} - -void rtl92c_set_mgt_filter(struct ieee80211_hw *hw, u16 filter) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_word(rtlpriv, REG_RXFLTMAP0, filter); -} - -u16 rtl92c_get_ctrl_filter(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - return rtl_read_word(rtlpriv, REG_RXFLTMAP1); -} - -void rtl92c_set_ctrl_filter(struct ieee80211_hw *hw, u16 filter) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_word(rtlpriv, REG_RXFLTMAP1, filter); -} - -u16 rtl92c_get_data_filter(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - return rtl_read_word(rtlpriv, REG_RXFLTMAP2); -} - -void rtl92c_set_data_filter(struct ieee80211_hw *hw, u16 filter) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_word(rtlpriv, REG_RXFLTMAP2, filter); -} -/*==============================================================*/ - -static u8 _rtl92c_query_rxpwrpercentage(char antpower) -{ - if ((antpower <= -100) || (antpower >= 20)) - return 0; - else if (antpower >= 0) - return 100; - else - return 100 + antpower; -} - -static u8 _rtl92c_evm_db_to_percentage(char value) -{ - char ret_val; - - ret_val = value; - if (ret_val >= 0) - ret_val = 0; - if (ret_val <= -33) - ret_val = -33; - ret_val = 0 - ret_val; - ret_val *= 3; - if (ret_val == 99) - ret_val = 100; - return ret_val; -} - -static long _rtl92c_translate_todbm(struct ieee80211_hw *hw, - u8 signal_strength_index) -{ - long signal_power; - - signal_power = (long)((signal_strength_index + 1) >> 1); - signal_power -= 95; - return signal_power; -} - -static long _rtl92c_signal_scale_mapping(struct ieee80211_hw *hw, - long currsig) -{ - long retsig; - - if (currsig >= 61 && currsig <= 100) - retsig = 90 + ((currsig - 60) / 4); - else if (currsig >= 41 && currsig <= 60) - retsig = 78 + ((currsig - 40) / 2); - else if (currsig >= 31 && currsig <= 40) - retsig = 66 + (currsig - 30); - else if (currsig >= 21 && currsig <= 30) - retsig = 54 + (currsig - 20); - else if (currsig >= 5 && currsig <= 20) - retsig = 42 + (((currsig - 5) * 2) / 3); - else if (currsig == 4) - retsig = 36; - else if (currsig == 3) - retsig = 27; - else if (currsig == 2) - retsig = 18; - else if (currsig == 1) - retsig = 9; - else - retsig = currsig; - return retsig; -} - -static void _rtl92c_query_rxphystatus(struct ieee80211_hw *hw, - struct rtl_stats *pstats, - struct rx_desc_92c *p_desc, - struct rx_fwinfo_92c *p_drvinfo, - bool packet_match_bssid, - bool packet_toself, - bool packet_beacon) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct phy_sts_cck_8192s_t *cck_buf; - s8 rx_pwr_all = 0, rx_pwr[4]; - u8 rf_rx_num = 0, evm, pwdb_all; - u8 i, max_spatial_stream; - u32 rssi, total_rssi = 0; - bool in_powersavemode = false; - bool is_cck_rate; - u8 *pdesc = (u8 *)p_desc; - - is_cck_rate = RX_HAL_IS_CCK_RATE(p_desc); - pstats->packet_matchbssid = packet_match_bssid; - pstats->packet_toself = packet_toself; - pstats->packet_beacon = packet_beacon; - pstats->is_cck = is_cck_rate; - pstats->RX_SIGQ[0] = -1; - pstats->RX_SIGQ[1] = -1; - if (is_cck_rate) { - u8 report, cck_highpwr; - cck_buf = (struct phy_sts_cck_8192s_t *)p_drvinfo; - if (!in_powersavemode) - cck_highpwr = rtlphy->cck_high_power; - else - cck_highpwr = false; - if (!cck_highpwr) { - u8 cck_agc_rpt = cck_buf->cck_agc_rpt; - report = cck_buf->cck_agc_rpt & 0xc0; - report = report >> 6; - switch (report) { - case 0x3: - rx_pwr_all = -46 - (cck_agc_rpt & 0x3e); - break; - case 0x2: - rx_pwr_all = -26 - (cck_agc_rpt & 0x3e); - break; - case 0x1: - rx_pwr_all = -12 - (cck_agc_rpt & 0x3e); - break; - case 0x0: - rx_pwr_all = 16 - (cck_agc_rpt & 0x3e); - break; - } - } else { - u8 cck_agc_rpt = cck_buf->cck_agc_rpt; - report = p_drvinfo->cfosho[0] & 0x60; - report = report >> 5; - switch (report) { - case 0x3: - rx_pwr_all = -46 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x2: - rx_pwr_all = -26 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x1: - rx_pwr_all = -12 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x0: - rx_pwr_all = 16 - ((cck_agc_rpt & 0x1f) << 1); - break; - } - } - pwdb_all = _rtl92c_query_rxpwrpercentage(rx_pwr_all); - pstats->rx_pwdb_all = pwdb_all; - pstats->recvsignalpower = rx_pwr_all; - if (packet_match_bssid) { - u8 sq; - if (pstats->rx_pwdb_all > 40) - sq = 100; - else { - sq = cck_buf->sq_rpt; - if (sq > 64) - sq = 0; - else if (sq < 20) - sq = 100; - else - sq = ((64 - sq) * 100) / 44; - } - pstats->signalquality = sq; - pstats->RX_SIGQ[0] = sq; - pstats->RX_SIGQ[1] = -1; - } - } else { - rtlpriv->dm.rfpath_rxenable[0] = - rtlpriv->dm.rfpath_rxenable[1] = true; - for (i = RF90_PATH_A; i < RF90_PATH_MAX; i++) { - if (rtlpriv->dm.rfpath_rxenable[i]) - rf_rx_num++; - rx_pwr[i] = - ((p_drvinfo->gain_trsw[i] & 0x3f) * 2) - 110; - rssi = _rtl92c_query_rxpwrpercentage(rx_pwr[i]); - total_rssi += rssi; - rtlpriv->stats.rx_snr_db[i] = - (long)(p_drvinfo->rxsnr[i] / 2); - - if (packet_match_bssid) - pstats->rx_mimo_signalstrength[i] = (u8) rssi; - } - rx_pwr_all = ((p_drvinfo->pwdb_all >> 1) & 0x7f) - 110; - pwdb_all = _rtl92c_query_rxpwrpercentage(rx_pwr_all); - pstats->rx_pwdb_all = pwdb_all; - pstats->rxpower = rx_pwr_all; - pstats->recvsignalpower = rx_pwr_all; - if (GET_RX_DESC_RX_MCS(pdesc) && - GET_RX_DESC_RX_MCS(pdesc) >= DESC92_RATEMCS8 && - GET_RX_DESC_RX_MCS(pdesc) <= DESC92_RATEMCS15) - max_spatial_stream = 2; - else - max_spatial_stream = 1; - for (i = 0; i < max_spatial_stream; i++) { - evm = _rtl92c_evm_db_to_percentage(p_drvinfo->rxevm[i]); - if (packet_match_bssid) { - if (i == 0) - pstats->signalquality = - (u8) (evm & 0xff); - pstats->RX_SIGQ[i] = - (u8) (evm & 0xff); - } - } - } - if (is_cck_rate) - pstats->signalstrength = - (u8) (_rtl92c_signal_scale_mapping(hw, pwdb_all)); - else if (rf_rx_num != 0) - pstats->signalstrength = - (u8) (_rtl92c_signal_scale_mapping - (hw, total_rssi /= rf_rx_num)); -} - -static void _rtl92c_process_ui_rssi(struct ieee80211_hw *hw, - struct rtl_stats *pstats) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u8 rfpath; - u32 last_rssi, tmpval; - - if (pstats->packet_toself || pstats->packet_beacon) { - rtlpriv->stats.rssi_calculate_cnt++; - if (rtlpriv->stats.ui_rssi.total_num++ >= - PHY_RSSI_SLID_WIN_MAX) { - rtlpriv->stats.ui_rssi.total_num = - PHY_RSSI_SLID_WIN_MAX; - last_rssi = - rtlpriv->stats.ui_rssi.elements[rtlpriv-> - stats.ui_rssi.index]; - rtlpriv->stats.ui_rssi.total_val -= last_rssi; - } - rtlpriv->stats.ui_rssi.total_val += pstats->signalstrength; - rtlpriv->stats.ui_rssi.elements[rtlpriv->stats.ui_rssi. - index++] = pstats->signalstrength; - if (rtlpriv->stats.ui_rssi.index >= PHY_RSSI_SLID_WIN_MAX) - rtlpriv->stats.ui_rssi.index = 0; - tmpval = rtlpriv->stats.ui_rssi.total_val / - rtlpriv->stats.ui_rssi.total_num; - rtlpriv->stats.signal_strength = - _rtl92c_translate_todbm(hw, (u8) tmpval); - pstats->rssi = rtlpriv->stats.signal_strength; - } - if (!pstats->is_cck && pstats->packet_toself) { - for (rfpath = RF90_PATH_A; rfpath < rtlphy->num_total_rfpath; - rfpath++) { - if (!rtl8192_phy_check_is_legal_rfpath(hw, rfpath)) - continue; - if (rtlpriv->stats.rx_rssi_percentage[rfpath] == 0) { - rtlpriv->stats.rx_rssi_percentage[rfpath] = - pstats->rx_mimo_signalstrength[rfpath]; - } - if (pstats->rx_mimo_signalstrength[rfpath] > - rtlpriv->stats.rx_rssi_percentage[rfpath]) { - rtlpriv->stats.rx_rssi_percentage[rfpath] = - ((rtlpriv->stats. - rx_rssi_percentage[rfpath] * - (RX_SMOOTH_FACTOR - 1)) + - (pstats->rx_mimo_signalstrength[rfpath])) / - (RX_SMOOTH_FACTOR); - - rtlpriv->stats.rx_rssi_percentage[rfpath] = - rtlpriv->stats.rx_rssi_percentage[rfpath] + - 1; - } else { - rtlpriv->stats.rx_rssi_percentage[rfpath] = - ((rtlpriv->stats. - rx_rssi_percentage[rfpath] * - (RX_SMOOTH_FACTOR - 1)) + - (pstats->rx_mimo_signalstrength[rfpath])) / - (RX_SMOOTH_FACTOR); - } - } - } -} - -static void _rtl92c_update_rxsignalstatistics(struct ieee80211_hw *hw, - struct rtl_stats *pstats) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int weighting = 0; - - if (rtlpriv->stats.recv_signal_power == 0) - rtlpriv->stats.recv_signal_power = pstats->recvsignalpower; - if (pstats->recvsignalpower > rtlpriv->stats.recv_signal_power) - weighting = 5; - else if (pstats->recvsignalpower < rtlpriv->stats.recv_signal_power) - weighting = (-5); - rtlpriv->stats.recv_signal_power = - (rtlpriv->stats.recv_signal_power * 5 + - pstats->recvsignalpower + weighting) / 6; -} - -static void _rtl92c_process_pwdb(struct ieee80211_hw *hw, - struct rtl_stats *pstats) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - long undec_sm_pwdb = 0; - - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - return; - } else { - undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb; - } - if (pstats->packet_toself || pstats->packet_beacon) { - if (undec_sm_pwdb < 0) - undec_sm_pwdb = pstats->rx_pwdb_all; - if (pstats->rx_pwdb_all > (u32) undec_sm_pwdb) { - undec_sm_pwdb = (((undec_sm_pwdb) * - (RX_SMOOTH_FACTOR - 1)) + - (pstats->rx_pwdb_all)) / (RX_SMOOTH_FACTOR); - undec_sm_pwdb += 1; - } else { - undec_sm_pwdb = (((undec_sm_pwdb) * - (RX_SMOOTH_FACTOR - 1)) + - (pstats->rx_pwdb_all)) / (RX_SMOOTH_FACTOR); - } - rtlpriv->dm.undec_sm_pwdb = undec_sm_pwdb; - _rtl92c_update_rxsignalstatistics(hw, pstats); - } -} - -static void _rtl92c_process_LINK_Q(struct ieee80211_hw *hw, - struct rtl_stats *pstats) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 last_evm = 0, n_stream, tmpval; - - if (pstats->signalquality != 0) { - if (pstats->packet_toself || pstats->packet_beacon) { - if (rtlpriv->stats.LINK_Q.total_num++ >= - PHY_LINKQUALITY_SLID_WIN_MAX) { - rtlpriv->stats.LINK_Q.total_num = - PHY_LINKQUALITY_SLID_WIN_MAX; - last_evm = - rtlpriv->stats.LINK_Q.elements - [rtlpriv->stats.LINK_Q.index]; - rtlpriv->stats.LINK_Q.total_val -= - last_evm; - } - rtlpriv->stats.LINK_Q.total_val += - pstats->signalquality; - rtlpriv->stats.LINK_Q.elements - [rtlpriv->stats.LINK_Q.index++] = - pstats->signalquality; - if (rtlpriv->stats.LINK_Q.index >= - PHY_LINKQUALITY_SLID_WIN_MAX) - rtlpriv->stats.LINK_Q.index = 0; - tmpval = rtlpriv->stats.LINK_Q.total_val / - rtlpriv->stats.LINK_Q.total_num; - rtlpriv->stats.signal_quality = tmpval; - rtlpriv->stats.last_sigstrength_inpercent = tmpval; - for (n_stream = 0; n_stream < 2; - n_stream++) { - if (pstats->RX_SIGQ[n_stream] != -1) { - if (!rtlpriv->stats.RX_EVM[n_stream]) { - rtlpriv->stats.RX_EVM[n_stream] - = pstats->RX_SIGQ[n_stream]; - } - rtlpriv->stats.RX_EVM[n_stream] = - ((rtlpriv->stats.RX_EVM - [n_stream] * - (RX_SMOOTH_FACTOR - 1)) + - (pstats->RX_SIGQ - [n_stream] * 1)) / - (RX_SMOOTH_FACTOR); - } - } - } - } else { - ; - } -} - -static void _rtl92c_process_phyinfo(struct ieee80211_hw *hw, - u8 *buffer, - struct rtl_stats *pcurrent_stats) -{ - if (!pcurrent_stats->packet_matchbssid && - !pcurrent_stats->packet_beacon) - return; - _rtl92c_process_ui_rssi(hw, pcurrent_stats); - _rtl92c_process_pwdb(hw, pcurrent_stats); - _rtl92c_process_LINK_Q(hw, pcurrent_stats); -} - -void rtl92c_translate_rx_signal_stuff(struct ieee80211_hw *hw, - struct sk_buff *skb, - struct rtl_stats *pstats, - struct rx_desc_92c *pdesc, - struct rx_fwinfo_92c *p_drvinfo) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct ieee80211_hdr *hdr; - u8 *tmp_buf; - u8 *praddr; - __le16 fc; - u16 type, cpu_fc; - bool packet_matchbssid, packet_toself, packet_beacon = false; - - tmp_buf = skb->data + pstats->rx_drvinfo_size + pstats->rx_bufshift; - hdr = (struct ieee80211_hdr *)tmp_buf; - fc = hdr->frame_control; - cpu_fc = le16_to_cpu(fc); - type = WLAN_FC_GET_TYPE(fc); - praddr = hdr->addr1; - packet_matchbssid = - ((IEEE80211_FTYPE_CTL != type) && - ether_addr_equal(mac->bssid, - (cpu_fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : - (cpu_fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : - hdr->addr3) && - (!pstats->hwerror) && (!pstats->crc) && (!pstats->icv)); - - packet_toself = packet_matchbssid && - ether_addr_equal(praddr, rtlefuse->dev_addr); - if (ieee80211_is_beacon(fc)) - packet_beacon = true; - _rtl92c_query_rxphystatus(hw, pstats, pdesc, p_drvinfo, - packet_matchbssid, packet_toself, - packet_beacon); - _rtl92c_process_phyinfo(hw, tmp_buf, pstats); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.h b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.h deleted file mode 100644 index bf53652e4edd..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.h +++ /dev/null @@ -1,174 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C_MAC_H__ -#define __RTL92C_MAC_H__ - -#define LLT_LAST_ENTRY_OF_TX_PKT_BUFFER 255 -#define DRIVER_EARLY_INT_TIME 0x05 -#define BCN_DMA_ATIME_INT_TIME 0x02 - -void rtl92c_read_chip_version(struct ieee80211_hw *hw); -bool rtl92c_llt_write(struct ieee80211_hw *hw, u32 address, u32 data); -bool rtl92c_init_llt_table(struct ieee80211_hw *hw, u32 boundary); -void rtl92c_set_key(struct ieee80211_hw *hw, u32 key_index, - u8 *p_macaddr, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all); -void rtl92c_enable_interrupt(struct ieee80211_hw *hw); -void rtl92c_disable_interrupt(struct ieee80211_hw *hw); -void rtl92c_set_qos(struct ieee80211_hw *hw, int aci); - - -/*--------------------------------------------------------------- - * Hardware init functions - *---------------------------------------------------------------*/ -void rtl92c_set_mac_addr(struct ieee80211_hw *hw, const u8 *addr); -void rtl92c_init_interrupt(struct ieee80211_hw *hw); -void rtl92c_init_driver_info_size(struct ieee80211_hw *hw, u8 size); - -int rtl92c_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type); -void rtl92c_init_network_type(struct ieee80211_hw *hw); -void rtl92c_init_adaptive_ctrl(struct ieee80211_hw *hw); -void rtl92c_init_rate_fallback(struct ieee80211_hw *hw); - -void rtl92c_init_edca_param(struct ieee80211_hw *hw, - u16 queue, - u16 txop, - u8 ecwmax, - u8 ecwmin, - u8 aifs); - -void rtl92c_init_edca(struct ieee80211_hw *hw); -void rtl92c_init_ampdu_aggregation(struct ieee80211_hw *hw); -void rtl92c_init_beacon_max_error(struct ieee80211_hw *hw, bool infra_mode); -void rtl92c_init_rdg_setting(struct ieee80211_hw *hw); -void rtl92c_init_retry_function(struct ieee80211_hw *hw); - -void rtl92c_init_beacon_parameters(struct ieee80211_hw *hw, - enum version_8192c version); - -void rtl92c_disable_fast_edca(struct ieee80211_hw *hw); -void rtl92c_set_min_space(struct ieee80211_hw *hw, bool is2T); - -/* For filter */ -u16 rtl92c_get_mgt_filter(struct ieee80211_hw *hw); -void rtl92c_set_mgt_filter(struct ieee80211_hw *hw, u16 filter); -u16 rtl92c_get_ctrl_filter(struct ieee80211_hw *hw); -void rtl92c_set_ctrl_filter(struct ieee80211_hw *hw, u16 filter); -u16 rtl92c_get_data_filter(struct ieee80211_hw *hw); -void rtl92c_set_data_filter(struct ieee80211_hw *hw, u16 filter); - - -u32 rtl92c_get_txdma_status(struct ieee80211_hw *hw); - -struct rx_fwinfo_92c { - u8 gain_trsw[4]; - u8 pwdb_all; - u8 cfosho[4]; - u8 cfotail[4]; - char rxevm[2]; - char rxsnr[4]; - u8 pdsnr[2]; - u8 csi_current[2]; - u8 csi_target[2]; - u8 sigevm; - u8 max_ex_pwr; - u8 ex_intf_flag:1; - u8 sgi_en:1; - u8 rxsc:2; - u8 reserve:4; -} __packed; - -struct rx_desc_92c { - u32 length:14; - u32 crc32:1; - u32 icverror:1; - u32 drv_infosize:4; - u32 security:3; - u32 qos:1; - u32 shift:2; - u32 phystatus:1; - u32 swdec:1; - u32 lastseg:1; - u32 firstseg:1; - u32 eor:1; - u32 own:1; - u32 macid:5; /* word 1 */ - u32 tid:4; - u32 hwrsvd:5; - u32 paggr:1; - u32 faggr:1; - u32 a1_fit:4; - u32 a2_fit:4; - u32 pam:1; - u32 pwr:1; - u32 moredata:1; - u32 morefrag:1; - u32 type:2; - u32 mc:1; - u32 bc:1; - u32 seq:12; /* word 2 */ - u32 frag:4; - u32 nextpktlen:14; - u32 nextind:1; - u32 rsvd:1; - u32 rxmcs:6; /* word 3 */ - u32 rxht:1; - u32 amsdu:1; - u32 splcp:1; - u32 bandwidth:1; - u32 htc:1; - u32 tcpchk_rpt:1; - u32 ipcchk_rpt:1; - u32 tcpchk_valid:1; - u32 hwpcerr:1; - u32 hwpcind:1; - u32 iv0:16; - u32 iv1; /* word 4 */ - u32 tsfl; /* word 5 */ - u32 bufferaddress; /* word 6 */ - u32 bufferaddress64; /* word 7 */ -} __packed; - -enum rtl_desc_qsel rtl92c_map_hwqueue_to_fwqueue(u16 fc, - unsigned int - skb_queue); -void rtl92c_translate_rx_signal_stuff(struct ieee80211_hw *hw, - struct sk_buff *skb, - struct rtl_stats *pstats, - struct rx_desc_92c *pdesc, - struct rx_fwinfo_92c *p_drvinfo); - -/*--------------------------------------------------------------- - * Card disable functions - *---------------------------------------------------------------*/ - - - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c b/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c deleted file mode 100644 index 34e56308301e..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c +++ /dev/null @@ -1,593 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../ps.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" -#include "table.h" - -u32 rtl92cu_phy_query_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, u32 bitmask) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 original_value, readback_value, bitshift; - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n", - regaddr, rfpath, bitmask); - if (rtlphy->rf_mode != RF_OP_BY_FW) { - original_value = _rtl92c_phy_rf_serial_read(hw, - rfpath, regaddr); - } else { - original_value = _rtl92c_phy_fw_rf_serial_read(hw, - rfpath, regaddr); - } - bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); - readback_value = (original_value & bitmask) >> bitshift; - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n", - regaddr, rfpath, bitmask, original_value); - return readback_value; -} - -void rtl92cu_phy_set_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, - u32 regaddr, u32 bitmask, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 original_value, bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", - regaddr, bitmask, data, rfpath); - if (rtlphy->rf_mode != RF_OP_BY_FW) { - if (bitmask != RFREG_OFFSET_MASK) { - original_value = _rtl92c_phy_rf_serial_read(hw, - rfpath, - regaddr); - bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); - data = - ((original_value & (~bitmask)) | - (data << bitshift)); - } - _rtl92c_phy_rf_serial_write(hw, rfpath, regaddr, data); - } else { - if (bitmask != RFREG_OFFSET_MASK) { - original_value = _rtl92c_phy_fw_rf_serial_read(hw, - rfpath, - regaddr); - bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); - data = - ((original_value & (~bitmask)) | - (data << bitshift)); - } - _rtl92c_phy_fw_rf_serial_write(hw, rfpath, regaddr, data); - } - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", - regaddr, bitmask, data, rfpath); -} - -bool rtl92cu_phy_mac_config(struct ieee80211_hw *hw) -{ - bool rtstatus; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - bool is92c = IS_92C_SERIAL(rtlhal->version); - - rtstatus = _rtl92cu_phy_config_mac_with_headerfile(hw); - if (is92c && IS_HARDWARE_TYPE_8192CE(rtlhal)) - rtl_write_byte(rtlpriv, 0x14, 0x71); - return rtstatus; -} - -bool rtl92cu_phy_bb_config(struct ieee80211_hw *hw) -{ - bool rtstatus = true; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u16 regval; - u8 b_reg_hwparafile = 1; - - _rtl92c_phy_init_bb_rf_register_definition(hw); - regval = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN); - rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, regval | BIT(13) | - BIT(0) | BIT(1)); - rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL, 0x83); - rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL + 1, 0xdb); - rtl_write_byte(rtlpriv, REG_RF_CTRL, RF_EN | RF_RSTB | RF_SDMRSTB); - if (IS_HARDWARE_TYPE_8192CE(rtlhal)) { - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, FEN_PPLL | FEN_PCIEA | - FEN_DIO_PCIE | FEN_BB_GLB_RSTn | FEN_BBRSTB); - } else if (IS_HARDWARE_TYPE_8192CU(rtlhal)) { - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, FEN_USBA | FEN_USBD | - FEN_BB_GLB_RSTn | FEN_BBRSTB); - rtl_write_byte(rtlpriv, REG_LDOHCI12_CTRL, 0x0f); - } - rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL + 1, 0x80); - if (b_reg_hwparafile == 1) - rtstatus = _rtl92c_phy_bb8192c_config_parafile(hw); - return rtstatus; -} - -bool _rtl92cu_phy_config_mac_with_headerfile(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 i; - u32 arraylength; - u32 *ptrarray; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Read Rtl819XMACPHY_Array\n"); - arraylength = rtlphy->hwparam_tables[MAC_REG].length ; - ptrarray = rtlphy->hwparam_tables[MAC_REG].pdata; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Img:RTL8192CEMAC_2T_ARRAY\n"); - for (i = 0; i < arraylength; i = i + 2) - rtl_write_byte(rtlpriv, ptrarray[i], (u8) ptrarray[i + 1]); - return true; -} - -bool _rtl92cu_phy_config_bb_with_headerfile(struct ieee80211_hw *hw, - u8 configtype) -{ - int i; - u32 *phy_regarray_table; - u32 *agctab_array_table; - u16 phy_reg_arraylen, agctab_arraylen; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - if (IS_92C_SERIAL(rtlhal->version)) { - agctab_arraylen = rtlphy->hwparam_tables[AGCTAB_2T].length; - agctab_array_table = rtlphy->hwparam_tables[AGCTAB_2T].pdata; - phy_reg_arraylen = rtlphy->hwparam_tables[PHY_REG_2T].length; - phy_regarray_table = rtlphy->hwparam_tables[PHY_REG_2T].pdata; - } else { - agctab_arraylen = rtlphy->hwparam_tables[AGCTAB_1T].length; - agctab_array_table = rtlphy->hwparam_tables[AGCTAB_1T].pdata; - phy_reg_arraylen = rtlphy->hwparam_tables[PHY_REG_1T].length; - phy_regarray_table = rtlphy->hwparam_tables[PHY_REG_1T].pdata; - } - if (configtype == BASEBAND_CONFIG_PHY_REG) { - for (i = 0; i < phy_reg_arraylen; i = i + 2) { - if (phy_regarray_table[i] == 0xfe) - mdelay(50); - else if (phy_regarray_table[i] == 0xfd) - mdelay(5); - else if (phy_regarray_table[i] == 0xfc) - mdelay(1); - else if (phy_regarray_table[i] == 0xfb) - udelay(50); - else if (phy_regarray_table[i] == 0xfa) - udelay(5); - else if (phy_regarray_table[i] == 0xf9) - udelay(1); - rtl_set_bbreg(hw, phy_regarray_table[i], MASKDWORD, - phy_regarray_table[i + 1]); - udelay(1); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "The phy_regarray_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n", - phy_regarray_table[i], - phy_regarray_table[i + 1]); - } - } else if (configtype == BASEBAND_CONFIG_AGC_TAB) { - for (i = 0; i < agctab_arraylen; i = i + 2) { - rtl_set_bbreg(hw, agctab_array_table[i], MASKDWORD, - agctab_array_table[i + 1]); - udelay(1); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "The agctab_array_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n", - agctab_array_table[i], - agctab_array_table[i + 1]); - } - } - return true; -} - -bool _rtl92cu_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw, - u8 configtype) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - int i; - u32 *phy_regarray_table_pg; - u16 phy_regarray_pg_len; - - rtlphy->pwrgroup_cnt = 0; - phy_regarray_pg_len = rtlphy->hwparam_tables[PHY_REG_PG].length; - phy_regarray_table_pg = rtlphy->hwparam_tables[PHY_REG_PG].pdata; - if (configtype == BASEBAND_CONFIG_PHY_REG) { - for (i = 0; i < phy_regarray_pg_len; i = i + 3) { - if (phy_regarray_table_pg[i] == 0xfe) - mdelay(50); - else if (phy_regarray_table_pg[i] == 0xfd) - mdelay(5); - else if (phy_regarray_table_pg[i] == 0xfc) - mdelay(1); - else if (phy_regarray_table_pg[i] == 0xfb) - udelay(50); - else if (phy_regarray_table_pg[i] == 0xfa) - udelay(5); - else if (phy_regarray_table_pg[i] == 0xf9) - udelay(1); - _rtl92c_store_pwrIndex_diffrate_offset(hw, - phy_regarray_table_pg[i], - phy_regarray_table_pg[i + 1], - phy_regarray_table_pg[i + 2]); - } - } else { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "configtype != BaseBand_Config_PHY_REG\n"); - } - return true; -} - -bool rtl92cu_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, - enum radio_path rfpath) -{ - int i; - u32 *radioa_array_table; - u32 *radiob_array_table; - u16 radioa_arraylen, radiob_arraylen; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - if (IS_92C_SERIAL(rtlhal->version)) { - radioa_arraylen = rtlphy->hwparam_tables[RADIOA_2T].length; - radioa_array_table = rtlphy->hwparam_tables[RADIOA_2T].pdata; - radiob_arraylen = rtlphy->hwparam_tables[RADIOB_2T].length; - radiob_array_table = rtlphy->hwparam_tables[RADIOB_2T].pdata; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Radio_A:RTL8192CERADIOA_2TARRAY\n"); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Radio_B:RTL8192CE_RADIOB_2TARRAY\n"); - } else { - radioa_arraylen = rtlphy->hwparam_tables[RADIOA_1T].length; - radioa_array_table = rtlphy->hwparam_tables[RADIOA_1T].pdata; - radiob_arraylen = rtlphy->hwparam_tables[RADIOB_1T].length; - radiob_array_table = rtlphy->hwparam_tables[RADIOB_1T].pdata; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Radio_A:RTL8192CE_RADIOA_1TARRAY\n"); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Radio_B:RTL8192CE_RADIOB_1TARRAY\n"); - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Radio No %x\n", rfpath); - switch (rfpath) { - case RF90_PATH_A: - for (i = 0; i < radioa_arraylen; i = i + 2) { - if (radioa_array_table[i] == 0xfe) - mdelay(50); - else if (radioa_array_table[i] == 0xfd) - mdelay(5); - else if (radioa_array_table[i] == 0xfc) - mdelay(1); - else if (radioa_array_table[i] == 0xfb) - udelay(50); - else if (radioa_array_table[i] == 0xfa) - udelay(5); - else if (radioa_array_table[i] == 0xf9) - udelay(1); - else { - rtl_set_rfreg(hw, rfpath, radioa_array_table[i], - RFREG_OFFSET_MASK, - radioa_array_table[i + 1]); - udelay(1); - } - } - break; - case RF90_PATH_B: - for (i = 0; i < radiob_arraylen; i = i + 2) { - if (radiob_array_table[i] == 0xfe) { - mdelay(50); - } else if (radiob_array_table[i] == 0xfd) - mdelay(5); - else if (radiob_array_table[i] == 0xfc) - mdelay(1); - else if (radiob_array_table[i] == 0xfb) - udelay(50); - else if (radiob_array_table[i] == 0xfa) - udelay(5); - else if (radiob_array_table[i] == 0xf9) - udelay(1); - else { - rtl_set_rfreg(hw, rfpath, radiob_array_table[i], - RFREG_OFFSET_MASK, - radiob_array_table[i + 1]); - udelay(1); - } - } - break; - case RF90_PATH_C: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - case RF90_PATH_D: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - return true; -} - -void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u8 reg_bw_opmode; - u8 reg_prsr_rsc; - - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "Switch to %s bandwidth\n", - rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? - "20MHz" : "40MHz"); - if (is_hal_stop(rtlhal)) { - rtlphy->set_bwmode_inprogress = false; - return; - } - reg_bw_opmode = rtl_read_byte(rtlpriv, REG_BWOPMODE); - reg_prsr_rsc = rtl_read_byte(rtlpriv, REG_RRSR + 2); - switch (rtlphy->current_chan_bw) { - case HT_CHANNEL_WIDTH_20: - reg_bw_opmode |= BW_OPMODE_20MHZ; - rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); - break; - case HT_CHANNEL_WIDTH_20_40: - reg_bw_opmode &= ~BW_OPMODE_20MHZ; - rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); - reg_prsr_rsc = - (reg_prsr_rsc & 0x90) | (mac->cur_40_prime_sc << 5); - rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_prsr_rsc); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", rtlphy->current_chan_bw); - break; - } - switch (rtlphy->current_chan_bw) { - case HT_CHANNEL_WIDTH_20: - rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x0); - rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x0); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 1); - break; - case HT_CHANNEL_WIDTH_20_40: - rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x1); - rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x1); - rtl_set_bbreg(hw, RCCK0_SYSTEM, BCCK_SIDEBAND, - (mac->cur_40_prime_sc >> 1)); - rtl_set_bbreg(hw, ROFDM1_LSTF, 0xC00, mac->cur_40_prime_sc); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 0); - rtl_set_bbreg(hw, 0x818, (BIT(26) | BIT(27)), - (mac->cur_40_prime_sc == - HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", rtlphy->current_chan_bw); - break; - } - rtl92cu_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); - rtlphy->set_bwmode_inprogress = false; - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n"); -} - -void rtl92cu_bb_block_on(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - mutex_lock(&rtlpriv->io.bb_mutex); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BCCKEN, 0x1); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BOFDMEN, 0x1); - mutex_unlock(&rtlpriv->io.bb_mutex); -} - -void _rtl92cu_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) -{ - u8 tmpreg; - u32 rf_a_mode = 0, rf_b_mode = 0, lc_cal; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - tmpreg = rtl_read_byte(rtlpriv, 0xd03); - - if ((tmpreg & 0x70) != 0) - rtl_write_byte(rtlpriv, 0xd03, tmpreg & 0x8F); - else - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF); - - if ((tmpreg & 0x70) != 0) { - rf_a_mode = rtl_get_rfreg(hw, RF90_PATH_A, 0x00, MASK12BITS); - if (is2t) - rf_b_mode = rtl_get_rfreg(hw, RF90_PATH_B, 0x00, - MASK12BITS); - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, MASK12BITS, - (rf_a_mode & 0x8FFFF) | 0x10000); - if (is2t) - rtl_set_rfreg(hw, RF90_PATH_B, 0x00, MASK12BITS, - (rf_b_mode & 0x8FFFF) | 0x10000); - } - lc_cal = rtl_get_rfreg(hw, RF90_PATH_A, 0x18, MASK12BITS); - rtl_set_rfreg(hw, RF90_PATH_A, 0x18, MASK12BITS, lc_cal | 0x08000); - mdelay(100); - if ((tmpreg & 0x70) != 0) { - rtl_write_byte(rtlpriv, 0xd03, tmpreg); - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, MASK12BITS, rf_a_mode); - if (is2t) - rtl_set_rfreg(hw, RF90_PATH_B, 0x00, MASK12BITS, - rf_b_mode); - } else { - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); - } -} - -static bool _rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool bresult = true; - u8 i, queue_id; - struct rtl8192_tx_ring *ring = NULL; - - switch (rfpwr_state) { - case ERFON: - if ((ppsc->rfpwr_state == ERFOFF) && - RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) { - bool rtstatus; - u32 InitializeCount = 0; - - do { - InitializeCount++; - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "IPS Set eRf nic enable\n"); - rtstatus = rtl_ps_enable_nic(hw); - } while (!rtstatus && (InitializeCount < 10)); - RT_CLEAR_PS_LEVEL(ppsc, - RT_RF_OFF_LEVL_HALT_NIC); - } else { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "Set ERFON sleeped:%d ms\n", - jiffies_to_msecs(jiffies - - ppsc->last_sleep_jiffies)); - ppsc->last_awake_jiffies = jiffies; - rtl92ce_phy_set_rf_on(hw); - } - if (mac->link_state == MAC80211_LINKED) { - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_LINK); - } else { - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_NO_LINK); - } - break; - case ERFOFF: - for (queue_id = 0, i = 0; - queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { - ring = &pcipriv->dev.tx_ring[queue_id]; - if (skb_queue_len(&ring->queue) == 0 || - queue_id == BEACON_QUEUE) { - queue_id++; - continue; - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n", - i + 1, - queue_id, - skb_queue_len(&ring->queue)); - udelay(10); - i++; - } - if (i >= MAX_DOZE_WAITING_TIMES_9x) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "ERFOFF: %d times TcbBusyQueue[%d] = %d !\n", - MAX_DOZE_WAITING_TIMES_9x, - queue_id, - skb_queue_len(&ring->queue)); - break; - } - } - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "IPS Set eRf nic disable\n"); - rtl_ps_disable_nic(hw); - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - } else { - if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) { - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_NO_LINK); - } else { - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_POWER_OFF); - } - } - break; - case ERFSLEEP: - if (ppsc->rfpwr_state == ERFOFF) - return false; - for (queue_id = 0, i = 0; - queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { - ring = &pcipriv->dev.tx_ring[queue_id]; - if (skb_queue_len(&ring->queue) == 0) { - queue_id++; - continue; - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n", - i + 1, queue_id, - skb_queue_len(&ring->queue)); - udelay(10); - i++; - } - if (i >= MAX_DOZE_WAITING_TIMES_9x) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n", - MAX_DOZE_WAITING_TIMES_9x, - queue_id, - skb_queue_len(&ring->queue)); - break; - } - } - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "Set ERFSLEEP awaked:%d ms\n", - jiffies_to_msecs(jiffies - ppsc->last_awake_jiffies)); - ppsc->last_sleep_jiffies = jiffies; - _rtl92c_phy_set_rf_sleep(hw); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - bresult = false; - break; - } - if (bresult) - ppsc->rfpwr_state = rfpwr_state; - return bresult; -} - -bool rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state) -{ - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool bresult = false; - - if (rfpwr_state == ppsc->rfpwr_state) - return bresult; - bresult = _rtl92cu_phy_set_rf_power_state(hw, rfpwr_state); - return bresult; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.h b/drivers/net/wireless/rtlwifi/rtl8192cu/phy.h deleted file mode 100644 index 42b068660483..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.h +++ /dev/null @@ -1,50 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../rtl8192ce/phy.h" - -void rtl92cu_bb_block_on(struct ieee80211_hw *hw); -bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, u32 rfpath); -void rtl92c_phy_set_io(struct ieee80211_hw *hw); -bool _rtl92cu_phy_config_mac_with_headerfile(struct ieee80211_hw *hw); -bool rtl92cu_phy_bb_config(struct ieee80211_hw *hw); -u32 rtl92cu_phy_query_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, u32 bitmask); -void rtl92cu_phy_set_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, - u32 regaddr, u32 bitmask, u32 data); -bool rtl92cu_phy_mac_config(struct ieee80211_hw *hw); -bool _rtl92cu_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw, - u8 configtype); -void _rtl92cu_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t); -bool _rtl92cu_phy_config_bb_with_headerfile(struct ieee80211_hw *hw, - u8 configtype); -void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw); -bool rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state); diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/reg.h b/drivers/net/wireless/rtlwifi/rtl8192cu/reg.h deleted file mode 100644 index 8b81465c629b..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/reg.h +++ /dev/null @@ -1,30 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../rtl8192ce/reg.h" diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c deleted file mode 100644 index 2119313a737b..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c +++ /dev/null @@ -1,486 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" - -static bool _rtl92c_phy_rf6052_config_parafile(struct ieee80211_hw *hw); - -void rtl92cu_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - switch (bandwidth) { - case HT_CHANNEL_WIDTH_20: - rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] & - 0xfffff3ff) | 0x0400); - rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK, - rtlphy->rfreg_chnlval[0]); - break; - case HT_CHANNEL_WIDTH_20_40: - rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] & - 0xfffff3ff)); - rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK, - rtlphy->rfreg_chnlval[0]); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", bandwidth); - break; - } -} - -void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u32 tx_agc[2] = { 0, 0 }, tmpval = 0; - bool turbo_scanoff = false; - u8 idx1, idx2; - u8 *ptr; - - if (rtlhal->interface == INTF_PCI) { - if (rtlefuse->eeprom_regulatory != 0) - turbo_scanoff = true; - } else { - if ((rtlefuse->eeprom_regulatory != 0) || - (rtlefuse->external_pa)) - turbo_scanoff = true; - } - if (mac->act_scanning) { - tx_agc[RF90_PATH_A] = 0x3f3f3f3f; - tx_agc[RF90_PATH_B] = 0x3f3f3f3f; - if (turbo_scanoff) { - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - tx_agc[idx1] = ppowerlevel[idx1] | - (ppowerlevel[idx1] << 8) | - (ppowerlevel[idx1] << 16) | - (ppowerlevel[idx1] << 24); - if (rtlhal->interface == INTF_USB) { - if (tx_agc[idx1] > 0x20 && - rtlefuse->external_pa) - tx_agc[idx1] = 0x20; - } - } - } - } else { - if (rtlpriv->dm.dynamic_txhighpower_lvl == - TXHIGHPWRLEVEL_LEVEL1) { - tx_agc[RF90_PATH_A] = 0x10101010; - tx_agc[RF90_PATH_B] = 0x10101010; - } else if (rtlpriv->dm.dynamic_txhighpower_lvl == - TXHIGHPWRLEVEL_LEVEL2) { - tx_agc[RF90_PATH_A] = 0x00000000; - tx_agc[RF90_PATH_B] = 0x00000000; - } else{ - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - tx_agc[idx1] = ppowerlevel[idx1] | - (ppowerlevel[idx1] << 8) | - (ppowerlevel[idx1] << 16) | - (ppowerlevel[idx1] << 24); - } - if (rtlefuse->eeprom_regulatory == 0) { - tmpval = (rtlphy->mcs_offset[0][6]) + - (rtlphy->mcs_offset[0][7] << 8); - tx_agc[RF90_PATH_A] += tmpval; - tmpval = (rtlphy->mcs_offset[0][14]) + - (rtlphy->mcs_offset[0][15] << 24); - tx_agc[RF90_PATH_B] += tmpval; - } - } - } - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - ptr = (u8 *) (&(tx_agc[idx1])); - for (idx2 = 0; idx2 < 4; idx2++) { - if (*ptr > RF6052_MAX_TX_PWR) - *ptr = RF6052_MAX_TX_PWR; - ptr++; - } - } - tmpval = tx_agc[RF90_PATH_A] & 0xff; - rtl_set_bbreg(hw, RTXAGC_A_CCK1_MCS32, MASKBYTE1, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n", - tmpval, RTXAGC_A_CCK1_MCS32); - - tmpval = tx_agc[RF90_PATH_A] >> 8; - if (mac->mode == WIRELESS_MODE_B) - tmpval = tmpval & 0xff00ffff; - rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n", - tmpval, RTXAGC_B_CCK11_A_CCK2_11); - tmpval = tx_agc[RF90_PATH_B] >> 24; - rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, MASKBYTE0, tmpval); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n", - tmpval, RTXAGC_B_CCK11_A_CCK2_11); - tmpval = tx_agc[RF90_PATH_B] & 0x00ffffff; - rtl_set_bbreg(hw, RTXAGC_B_CCK1_55_MCS32, 0xffffff00, tmpval); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n", - tmpval, RTXAGC_B_CCK1_55_MCS32); -} - -static void rtl92c_phy_get_power_base(struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel, - u32 *ofdmbase, u32 *mcsbase) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u32 powerBase0, powerBase1; - u8 legacy_pwrdiff = 0, ht20_pwrdiff = 0; - u8 i, powerlevel[2]; - - for (i = 0; i < 2; i++) { - powerlevel[i] = ppowerlevel[i]; - legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff[i][channel - 1]; - powerBase0 = powerlevel[i] + legacy_pwrdiff; - powerBase0 = (powerBase0 << 24) | (powerBase0 << 16) | - (powerBase0 << 8) | powerBase0; - *(ofdmbase + i) = powerBase0; - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - " [OFDM power base index rf(%c) = 0x%x]\n", - i == 0 ? 'A' : 'B', *(ofdmbase + i)); - } - for (i = 0; i < 2; i++) { - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) { - ht20_pwrdiff = rtlefuse->txpwr_ht20diff[i][channel - 1]; - powerlevel[i] += ht20_pwrdiff; - } - powerBase1 = powerlevel[i]; - powerBase1 = (powerBase1 << 24) | - (powerBase1 << 16) | (powerBase1 << 8) | powerBase1; - *(mcsbase + i) = powerBase1; - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - " [MCS power base index rf(%c) = 0x%x]\n", - i == 0 ? 'A' : 'B', *(mcsbase + i)); - } -} - -static void _rtl92c_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw, - u8 channel, u8 index, - u32 *powerBase0, - u32 *powerBase1, - u32 *p_outwriteval) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 i, chnlgroup = 0, pwr_diff_limit[4]; - u32 writeVal, customer_limit, rf; - - for (rf = 0; rf < 2; rf++) { - switch (rtlefuse->eeprom_regulatory) { - case 0: - chnlgroup = 0; - writeVal = rtlphy->mcs_offset - [chnlgroup][index + (rf ? 8 : 0)] - + ((index < 2) ? powerBase0[rf] : powerBase1[rf]); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "RTK better performance,writeVal(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', writeVal); - break; - case 1: - if (rtlphy->pwrgroup_cnt == 1) - chnlgroup = 0; - if (rtlphy->pwrgroup_cnt >= 3) { - if (channel <= 3) - chnlgroup = 0; - else if (channel >= 4 && channel <= 9) - chnlgroup = 1; - else if (channel > 9) - chnlgroup = 2; - if (rtlphy->current_chan_bw == - HT_CHANNEL_WIDTH_20) - chnlgroup++; - else - chnlgroup += 4; - } - writeVal = rtlphy->mcs_offset[chnlgroup][index + - (rf ? 8 : 0)] + - ((index < 2) ? powerBase0[rf] : - powerBase1[rf]); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', writeVal); - break; - case 2: - writeVal = ((index < 2) ? powerBase0[rf] : - powerBase1[rf]); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Better regulatory,writeVal(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', writeVal); - break; - case 3: - chnlgroup = 0; - if (rtlphy->current_chan_bw == - HT_CHANNEL_WIDTH_20_40) { - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "customer's limit, 40MHzrf(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', - rtlefuse->pwrgroup_ht40[rf] - [channel - 1]); - } else { - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "customer's limit, 20MHz rf(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', - rtlefuse->pwrgroup_ht20[rf] - [channel - 1]); - } - for (i = 0; i < 4; i++) { - pwr_diff_limit[i] = (u8) ((rtlphy->mcs_offset - [chnlgroup][index + (rf ? 8 : 0)] - & (0x7f << (i * 8))) >> (i * 8)); - if (rtlphy->current_chan_bw == - HT_CHANNEL_WIDTH_20_40) { - if (pwr_diff_limit[i] > - rtlefuse->pwrgroup_ht40[rf] - [channel - 1]) - pwr_diff_limit[i] = rtlefuse-> - pwrgroup_ht40[rf] - [channel - 1]; - } else { - if (pwr_diff_limit[i] > - rtlefuse->pwrgroup_ht20[rf] - [channel - 1]) - pwr_diff_limit[i] = - rtlefuse->pwrgroup_ht20[rf] - [channel - 1]; - } - } - customer_limit = (pwr_diff_limit[3] << 24) | - (pwr_diff_limit[2] << 16) | - (pwr_diff_limit[1] << 8) | (pwr_diff_limit[0]); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Customer's limit rf(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', customer_limit); - writeVal = customer_limit + ((index < 2) ? - powerBase0[rf] : powerBase1[rf]); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Customer, writeVal rf(%c)= 0x%x\n", - rf == 0 ? 'A' : 'B', writeVal); - break; - default: - chnlgroup = 0; - writeVal = rtlphy->mcs_offset[chnlgroup] - [index + (rf ? 8 : 0)] + ((index < 2) ? - powerBase0[rf] : powerBase1[rf]); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "RTK better performance, writeValrf(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', writeVal); - break; - } - if (rtlpriv->dm.dynamic_txhighpower_lvl == - TXHIGHPWRLEVEL_LEVEL1) - writeVal = 0x14141414; - else if (rtlpriv->dm.dynamic_txhighpower_lvl == - TXHIGHPWRLEVEL_LEVEL2) - writeVal = 0x00000000; - if (rtlpriv->dm.dynamic_txhighpower_lvl == TXHIGHPWRLEVEL_BT1) - writeVal = writeVal - 0x06060606; - else if (rtlpriv->dm.dynamic_txhighpower_lvl == - TXHIGHPWRLEVEL_BT2) - writeVal = writeVal; - *(p_outwriteval + rf) = writeVal; - } -} - -static void _rtl92c_write_ofdm_power_reg(struct ieee80211_hw *hw, - u8 index, u32 *pValue) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u16 regoffset_a[6] = { - RTXAGC_A_RATE18_06, RTXAGC_A_RATE54_24, - RTXAGC_A_MCS03_MCS00, RTXAGC_A_MCS07_MCS04, - RTXAGC_A_MCS11_MCS08, RTXAGC_A_MCS15_MCS12 - }; - u16 regoffset_b[6] = { - RTXAGC_B_RATE18_06, RTXAGC_B_RATE54_24, - RTXAGC_B_MCS03_MCS00, RTXAGC_B_MCS07_MCS04, - RTXAGC_B_MCS11_MCS08, RTXAGC_B_MCS15_MCS12 - }; - u8 i, rf, pwr_val[4]; - u32 writeVal; - u16 regoffset; - - for (rf = 0; rf < 2; rf++) { - writeVal = pValue[rf]; - for (i = 0; i < 4; i++) { - pwr_val[i] = (u8)((writeVal & (0x7f << (i * 8))) >> - (i * 8)); - if (pwr_val[i] > RF6052_MAX_TX_PWR) - pwr_val[i] = RF6052_MAX_TX_PWR; - } - writeVal = (pwr_val[3] << 24) | (pwr_val[2] << 16) | - (pwr_val[1] << 8) | pwr_val[0]; - if (rf == 0) - regoffset = regoffset_a[index]; - else - regoffset = regoffset_b[index]; - rtl_set_bbreg(hw, regoffset, MASKDWORD, writeVal); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Set 0x%x = %08x\n", regoffset, writeVal); - if (((get_rf_type(rtlphy) == RF_2T2R) && - (regoffset == RTXAGC_A_MCS15_MCS12 || - regoffset == RTXAGC_B_MCS15_MCS12)) || - ((get_rf_type(rtlphy) != RF_2T2R) && - (regoffset == RTXAGC_A_MCS07_MCS04 || - regoffset == RTXAGC_B_MCS07_MCS04))) { - writeVal = pwr_val[3]; - if (regoffset == RTXAGC_A_MCS15_MCS12 || - regoffset == RTXAGC_A_MCS07_MCS04) - regoffset = 0xc90; - if (regoffset == RTXAGC_B_MCS15_MCS12 || - regoffset == RTXAGC_B_MCS07_MCS04) - regoffset = 0xc98; - for (i = 0; i < 3; i++) { - writeVal = (writeVal > 6) ? (writeVal - 6) : 0; - rtl_write_byte(rtlpriv, (u32)(regoffset + i), - (u8)writeVal); - } - } - } -} - -void rtl92cu_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel) -{ - u32 writeVal[2], powerBase0[2], powerBase1[2]; - u8 index = 0; - - rtl92c_phy_get_power_base(hw, ppowerlevel, - channel, &powerBase0[0], &powerBase1[0]); - for (index = 0; index < 6; index++) { - _rtl92c_get_txpower_writeval_by_regulatory(hw, - channel, index, - &powerBase0[0], - &powerBase1[0], - &writeVal[0]); - _rtl92c_write_ofdm_power_reg(hw, index, &writeVal[0]); - } -} - -bool rtl92cu_phy_rf6052_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - bool rtstatus = true; - u8 b_reg_hwparafile = 1; - - if (rtlphy->rf_type == RF_1T1R) - rtlphy->num_total_rfpath = 1; - else - rtlphy->num_total_rfpath = 2; - if (b_reg_hwparafile == 1) - rtstatus = _rtl92c_phy_rf6052_config_parafile(hw); - return rtstatus; -} - -static bool _rtl92c_phy_rf6052_config_parafile(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 u4_regvalue = 0; - u8 rfpath; - bool rtstatus = true; - struct bb_reg_def *pphyreg; - - for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) { - pphyreg = &rtlphy->phyreg_def[rfpath]; - switch (rfpath) { - case RF90_PATH_A: - case RF90_PATH_C: - u4_regvalue = rtl_get_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV); - break; - case RF90_PATH_B: - case RF90_PATH_D: - u4_regvalue = rtl_get_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV << 16); - break; - } - rtl_set_bbreg(hw, pphyreg->rfintfe, BRFSI_RFENV << 16, 0x1); - udelay(1); - rtl_set_bbreg(hw, pphyreg->rfintfo, BRFSI_RFENV, 0x1); - udelay(1); - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, - B3WIREADDREAALENGTH, 0x0); - udelay(1); - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, B3WIREDATALENGTH, 0x0); - udelay(1); - switch (rfpath) { - case RF90_PATH_A: - rtstatus = rtl92cu_phy_config_rf_with_headerfile(hw, - (enum radio_path) rfpath); - break; - case RF90_PATH_B: - rtstatus = rtl92cu_phy_config_rf_with_headerfile(hw, - (enum radio_path) rfpath); - break; - case RF90_PATH_C: - break; - case RF90_PATH_D: - break; - } - switch (rfpath) { - case RF90_PATH_A: - case RF90_PATH_C: - rtl_set_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV, u4_regvalue); - break; - case RF90_PATH_B: - case RF90_PATH_D: - rtl_set_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV << 16, u4_regvalue); - break; - } - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Radio[%d] Fail!!", rfpath); - goto phy_rf_cfg_fail; - } - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "<---\n"); - return rtstatus; -phy_rf_cfg_fail: - return rtstatus; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h deleted file mode 100644 index 090fd33a158d..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h +++ /dev/null @@ -1,51 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CU_RF_H__ -#define __RTL92CU_RF_H__ - -#define RF6052_MAX_TX_PWR 0x3F -#define RF6052_MAX_REG 0x3F -#define RF6052_MAX_PATH 2 - -extern void rtl92cu_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, - u8 bandwidth); -extern void rtl92c_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel); -extern void rtl92c_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel); -bool rtl92cu_phy_rf6052_config(struct ieee80211_hw *hw); -bool rtl92cu_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, - enum radio_path rfpath); -void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel); -void rtl92cu_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c deleted file mode 100644 index 2bd598526217..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +++ /dev/null @@ -1,392 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../core.h" -#include "../usb.h" -#include "../efuse.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "mac.h" -#include "dm.h" -#include "rf.h" -#include "sw.h" -#include "trx.h" -#include "led.h" -#include "hw.h" -#include - -MODULE_AUTHOR("Georgia "); -MODULE_AUTHOR("Ziv Huang "); -MODULE_AUTHOR("Larry Finger "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Realtek 8192C/8188C 802.11n USB wireless"); -MODULE_FIRMWARE("rtlwifi/rtl8192cufw.bin"); - -static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int err; - - rtlpriv->dm.dm_initialgain_enable = true; - rtlpriv->dm.dm_flag = 0; - rtlpriv->dm.disable_framebursting = false; - rtlpriv->dm.thermalvalue = 0; - rtlpriv->dbg.global_debuglevel = rtlpriv->cfg->mod_params->debug; - - /* for firmware buf */ - rtlpriv->rtlhal.pfirmware = vzalloc(0x4000); - if (!rtlpriv->rtlhal.pfirmware) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Can't alloc buffer for fw\n"); - return 1; - } - - pr_info("Loading firmware %s\n", rtlpriv->cfg->fw_name); - rtlpriv->max_fw_size = 0x4000; - err = request_firmware_nowait(THIS_MODULE, 1, - rtlpriv->cfg->fw_name, rtlpriv->io.dev, - GFP_KERNEL, hw, rtl_fw_cb); - - - return err; -} - -static void rtl92cu_deinit_sw_vars(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->rtlhal.pfirmware) { - vfree(rtlpriv->rtlhal.pfirmware); - rtlpriv->rtlhal.pfirmware = NULL; - } -} - -static struct rtl_hal_ops rtl8192cu_hal_ops = { - .init_sw_vars = rtl92cu_init_sw_vars, - .deinit_sw_vars = rtl92cu_deinit_sw_vars, - .read_chip_version = rtl92c_read_chip_version, - .read_eeprom_info = rtl92cu_read_eeprom_info, - .enable_interrupt = rtl92c_enable_interrupt, - .disable_interrupt = rtl92c_disable_interrupt, - .hw_init = rtl92cu_hw_init, - .hw_disable = rtl92cu_card_disable, - .set_network_type = rtl92cu_set_network_type, - .set_chk_bssid = rtl92cu_set_check_bssid, - .set_qos = rtl92c_set_qos, - .set_bcn_reg = rtl92cu_set_beacon_related_registers, - .set_bcn_intv = rtl92cu_set_beacon_interval, - .update_interrupt_mask = rtl92cu_update_interrupt_mask, - .get_hw_reg = rtl92cu_get_hw_reg, - .set_hw_reg = rtl92cu_set_hw_reg, - .update_rate_tbl = rtl92cu_update_hal_rate_tbl, - .fill_tx_desc = rtl92cu_tx_fill_desc, - .fill_fake_txdesc = rtl92cu_fill_fake_txdesc, - .fill_tx_cmddesc = rtl92cu_tx_fill_cmddesc, - .cmd_send_packet = rtl92cu_cmd_send_packet, - .query_rx_desc = rtl92cu_rx_query_desc, - .set_channel_access = rtl92cu_update_channel_access_setting, - .radio_onoff_checking = rtl92cu_gpio_radio_on_off_checking, - .set_bw_mode = rtl92c_phy_set_bw_mode, - .switch_channel = rtl92c_phy_sw_chnl, - .dm_watchdog = rtl92c_dm_watchdog, - .scan_operation_backup = rtl92c_phy_scan_operation_backup, - .set_rf_power_state = rtl92cu_phy_set_rf_power_state, - .led_control = rtl92cu_led_control, - .enable_hw_sec = rtl92cu_enable_hw_security_config, - .set_key = rtl92c_set_key, - .init_sw_leds = rtl92cu_init_sw_leds, - .deinit_sw_leds = rtl92cu_deinit_sw_leds, - .get_bbreg = rtl92c_phy_query_bb_reg, - .set_bbreg = rtl92c_phy_set_bb_reg, - .get_rfreg = rtl92cu_phy_query_rf_reg, - .set_rfreg = rtl92cu_phy_set_rf_reg, - .phy_rf6052_config = rtl92cu_phy_rf6052_config, - .phy_rf6052_set_cck_txpower = rtl92cu_phy_rf6052_set_cck_txpower, - .phy_rf6052_set_ofdm_txpower = rtl92cu_phy_rf6052_set_ofdm_txpower, - .config_bb_with_headerfile = _rtl92cu_phy_config_bb_with_headerfile, - .config_bb_with_pgheaderfile = _rtl92cu_phy_config_bb_with_pgheaderfile, - .phy_lc_calibrate = _rtl92cu_phy_lc_calibrate, - .phy_set_bw_mode_callback = rtl92cu_phy_set_bw_mode_callback, - .dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower, - .fill_h2c_cmd = rtl92c_fill_h2c_cmd, -}; - -static struct rtl_mod_params rtl92cu_mod_params = { - .sw_crypto = 0, - .debug = DBG_EMERG, -}; - -module_param_named(swenc, rtl92cu_mod_params.sw_crypto, bool, 0444); -module_param_named(debug, rtl92cu_mod_params.debug, int, 0444); -MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); -MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); - -static struct rtl_hal_usbint_cfg rtl92cu_interface_cfg = { - /* rx */ - .in_ep_num = RTL92C_USB_BULK_IN_NUM, - .rx_urb_num = RTL92C_NUM_RX_URBS, - .rx_max_size = RTL92C_SIZE_MAX_RX_BUFFER, - .usb_rx_hdl = rtl8192cu_rx_hdl, - .usb_rx_segregate_hdl = NULL, /* rtl8192c_rx_segregate_hdl; */ - /* tx */ - .usb_tx_cleanup = rtl8192c_tx_cleanup, - .usb_tx_post_hdl = rtl8192c_tx_post_hdl, - .usb_tx_aggregate_hdl = rtl8192c_tx_aggregate_hdl, - /* endpoint mapping */ - .usb_endpoint_mapping = rtl8192cu_endpoint_mapping, - .usb_mq_to_hwq = rtl8192cu_mq_to_hwq, -}; - -static struct rtl_hal_cfg rtl92cu_hal_cfg = { - .name = "rtl92c_usb", - .fw_name = "rtlwifi/rtl8192cufw.bin", - .ops = &rtl8192cu_hal_ops, - .mod_params = &rtl92cu_mod_params, - .usb_interface_cfg = &rtl92cu_interface_cfg, - - .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, - .maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN, - .maps[SYS_CLK] = REG_SYS_CLKR, - .maps[MAC_RCR_AM] = AM, - .maps[MAC_RCR_AB] = AB, - .maps[MAC_RCR_ACRC32] = ACRC32, - .maps[MAC_RCR_ACF] = ACF, - .maps[MAC_RCR_AAP] = AAP, - - .maps[EFUSE_TEST] = REG_EFUSE_TEST, - .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, - .maps[EFUSE_CLK] = 0, - .maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL, - .maps[EFUSE_PWC_EV12V] = PWC_EV12V, - .maps[EFUSE_FEN_ELDR] = FEN_ELDR, - .maps[EFUSE_LOADER_CLK_EN] = LOADER_CLK_EN, - .maps[EFUSE_ANA8M] = EFUSE_ANA8M, - .maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE, - .maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION, - .maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN, - - .maps[RWCAM] = REG_CAMCMD, - .maps[WCAMI] = REG_CAMWRITE, - .maps[RCAMO] = REG_CAMREAD, - .maps[CAMDBG] = REG_CAMDBG, - .maps[SECR] = REG_SECCFG, - .maps[SEC_CAM_NONE] = CAM_NONE, - .maps[SEC_CAM_WEP40] = CAM_WEP40, - .maps[SEC_CAM_TKIP] = CAM_TKIP, - .maps[SEC_CAM_AES] = CAM_AES, - .maps[SEC_CAM_WEP104] = CAM_WEP104, - - .maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6, - .maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5, - .maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4, - .maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3, - .maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2, - .maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1, - .maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8, - .maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7, - .maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6, - .maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5, - .maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4, - .maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3, - .maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2, - .maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1, - .maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2, - .maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1, - - .maps[RTL_IMR_TXFOVW] = IMR_TXFOVW, - .maps[RTL_IMR_PSTIMEOUT] = IMR_PSTIMEOUT, - .maps[RTL_IMR_BCNINT] = IMR_BCNINT, - .maps[RTL_IMR_RXFOVW] = IMR_RXFOVW, - .maps[RTL_IMR_RDU] = IMR_RDU, - .maps[RTL_IMR_ATIMEND] = IMR_ATIMEND, - .maps[RTL_IMR_BDOK] = IMR_BDOK, - .maps[RTL_IMR_MGNTDOK] = IMR_MGNTDOK, - .maps[RTL_IMR_TBDER] = IMR_TBDER, - .maps[RTL_IMR_HIGHDOK] = IMR_HIGHDOK, - .maps[RTL_IMR_TBDOK] = IMR_TBDOK, - .maps[RTL_IMR_BKDOK] = IMR_BKDOK, - .maps[RTL_IMR_BEDOK] = IMR_BEDOK, - .maps[RTL_IMR_VIDOK] = IMR_VIDOK, - .maps[RTL_IMR_VODOK] = IMR_VODOK, - .maps[RTL_IMR_ROK] = IMR_ROK, - .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER), - - .maps[RTL_RC_CCK_RATE1M] = DESC92_RATE1M, - .maps[RTL_RC_CCK_RATE2M] = DESC92_RATE2M, - .maps[RTL_RC_CCK_RATE5_5M] = DESC92_RATE5_5M, - .maps[RTL_RC_CCK_RATE11M] = DESC92_RATE11M, - .maps[RTL_RC_OFDM_RATE6M] = DESC92_RATE6M, - .maps[RTL_RC_OFDM_RATE9M] = DESC92_RATE9M, - .maps[RTL_RC_OFDM_RATE12M] = DESC92_RATE12M, - .maps[RTL_RC_OFDM_RATE18M] = DESC92_RATE18M, - .maps[RTL_RC_OFDM_RATE24M] = DESC92_RATE24M, - .maps[RTL_RC_OFDM_RATE36M] = DESC92_RATE36M, - .maps[RTL_RC_OFDM_RATE48M] = DESC92_RATE48M, - .maps[RTL_RC_OFDM_RATE54M] = DESC92_RATE54M, - .maps[RTL_RC_HT_RATEMCS7] = DESC92_RATEMCS7, - .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, -}; - -#define USB_VENDER_ID_REALTEK 0x0bda - -/* 2010-10-19 DID_USB_V3.4 */ -static struct usb_device_id rtl8192c_usb_ids[] = { - - /*=== Realtek demoboard ===*/ - /* Default ID */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8191, rtl92cu_hal_cfg)}, - - /****** 8188CU ********/ - /* RTL8188CTV */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x018a, rtl92cu_hal_cfg)}, - /* 8188CE-VAU USB minCard */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8170, rtl92cu_hal_cfg)}, - /* 8188cu 1*1 dongle */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8176, rtl92cu_hal_cfg)}, - /* 8188cu 1*1 dongle, (b/g mode only) */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8177, rtl92cu_hal_cfg)}, - /* 8188cu Slim Solo */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817a, rtl92cu_hal_cfg)}, - /* 8188cu Slim Combo */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817b, rtl92cu_hal_cfg)}, - /* 8188RU High-power USB Dongle */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817d, rtl92cu_hal_cfg)}, - /* 8188CE-VAU USB minCard (b/g mode only) */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817e, rtl92cu_hal_cfg)}, - /* 8188RU in Alfa AWUS036NHR */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817f, rtl92cu_hal_cfg)}, - /* RTL8188CUS-VL */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x818a, rtl92cu_hal_cfg)}, - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x819a, rtl92cu_hal_cfg)}, - /* 8188 Combo for BC4 */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8754, rtl92cu_hal_cfg)}, - - /****** 8192CU ********/ - /* 8192cu 2*2 */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8178, rtl92cu_hal_cfg)}, - /* 8192CE-VAU USB minCard */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817c, rtl92cu_hal_cfg)}, - - /*=== Customer ID ===*/ - /****** 8188CU ********/ - {RTL_USB_DEVICE(0x050d, 0x1102, rtl92cu_hal_cfg)}, /*Belkin - Edimax*/ - {RTL_USB_DEVICE(0x050d, 0x11f2, rtl92cu_hal_cfg)}, /*Belkin - ISY*/ - {RTL_USB_DEVICE(0x06f8, 0xe033, rtl92cu_hal_cfg)}, /*Hercules - Edimax*/ - {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ - {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ - {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/ - {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ - {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ - {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ - {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ - {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/ - /* HP - Lite-On ,8188CUS Slim Combo */ - {RTL_USB_DEVICE(0x103c, 0x1629, rtl92cu_hal_cfg)}, - {RTL_USB_DEVICE(0x13d3, 0x3357, rtl92cu_hal_cfg)}, /* AzureWave */ - {RTL_USB_DEVICE(0x2001, 0x3308, rtl92cu_hal_cfg)}, /*D-Link - Alpha*/ - {RTL_USB_DEVICE(0x2019, 0x4902, rtl92cu_hal_cfg)}, /*Planex - Etop*/ - {RTL_USB_DEVICE(0x2019, 0xab2a, rtl92cu_hal_cfg)}, /*Planex - Abocom*/ - /*SW-WF02-AD15 -Abocom*/ - {RTL_USB_DEVICE(0x2019, 0xab2e, rtl92cu_hal_cfg)}, - {RTL_USB_DEVICE(0x2019, 0xed17, rtl92cu_hal_cfg)}, /*PCI - Edimax*/ - {RTL_USB_DEVICE(0x20f4, 0x648b, rtl92cu_hal_cfg)}, /*TRENDnet - Cameo*/ - {RTL_USB_DEVICE(0x7392, 0x7811, rtl92cu_hal_cfg)}, /*Edimax - Edimax*/ - {RTL_USB_DEVICE(0x13d3, 0x3358, rtl92cu_hal_cfg)}, /*Azwave 8188CE-VAU*/ - /* Russian customer -Azwave (8188CE-VAU b/g mode only) */ - {RTL_USB_DEVICE(0x13d3, 0x3359, rtl92cu_hal_cfg)}, - {RTL_USB_DEVICE(0x4855, 0x0090, rtl92cu_hal_cfg)}, /* Feixun */ - {RTL_USB_DEVICE(0x4855, 0x0091, rtl92cu_hal_cfg)}, /* NetweeN-Feixun */ - {RTL_USB_DEVICE(0x9846, 0x9041, rtl92cu_hal_cfg)}, /* Netgear Cameo */ - - /****** 8188 RU ********/ - /* Netcore */ - {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x317f, rtl92cu_hal_cfg)}, - - /****** 8188CUS Slim Solo********/ - {RTL_USB_DEVICE(0x04f2, 0xaff7, rtl92cu_hal_cfg)}, /*Xavi*/ - {RTL_USB_DEVICE(0x04f2, 0xaff9, rtl92cu_hal_cfg)}, /*Xavi*/ - {RTL_USB_DEVICE(0x04f2, 0xaffa, rtl92cu_hal_cfg)}, /*Xavi*/ - - /****** 8188CUS Slim Combo ********/ - {RTL_USB_DEVICE(0x04f2, 0xaff8, rtl92cu_hal_cfg)}, /*Xavi*/ - {RTL_USB_DEVICE(0x04f2, 0xaffb, rtl92cu_hal_cfg)}, /*Xavi*/ - {RTL_USB_DEVICE(0x04f2, 0xaffc, rtl92cu_hal_cfg)}, /*Xavi*/ - {RTL_USB_DEVICE(0x2019, 0x1201, rtl92cu_hal_cfg)}, /*Planex-Vencer*/ - - /****** 8192CU ********/ - {RTL_USB_DEVICE(0x050d, 0x1004, rtl92cu_hal_cfg)}, /*Belcom-SurfN300*/ - {RTL_USB_DEVICE(0x050d, 0x2102, rtl92cu_hal_cfg)}, /*Belcom-Sercomm*/ - {RTL_USB_DEVICE(0x050d, 0x2103, rtl92cu_hal_cfg)}, /*Belcom-Edimax*/ - {RTL_USB_DEVICE(0x0586, 0x341f, rtl92cu_hal_cfg)}, /*Zyxel -Abocom*/ - {RTL_USB_DEVICE(0x07aa, 0x0056, rtl92cu_hal_cfg)}, /*ATKK-Gemtek*/ - {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ - {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ - {RTL_USB_DEVICE(0x0846, 0xf001, rtl92cu_hal_cfg)}, /*On Netwrks N300MA*/ - {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ - {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/ - {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ - {RTL_USB_DEVICE(0x0e66, 0x0019, rtl92cu_hal_cfg)}, /*Hawking-Edimax*/ - {RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/ - {RTL_USB_DEVICE(0x2001, 0x3309, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/ - {RTL_USB_DEVICE(0x2001, 0x330a, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/ - {RTL_USB_DEVICE(0x2019, 0xab2b, rtl92cu_hal_cfg)}, /*Planex -Abocom*/ - {RTL_USB_DEVICE(0x20f4, 0x624d, rtl92cu_hal_cfg)}, /*TRENDNet*/ - {RTL_USB_DEVICE(0x2357, 0x0100, rtl92cu_hal_cfg)}, /*TP-Link WN8200ND*/ - {RTL_USB_DEVICE(0x7392, 0x7822, rtl92cu_hal_cfg)}, /*Edimax -Edimax*/ - {} -}; - -MODULE_DEVICE_TABLE(usb, rtl8192c_usb_ids); - -static int rtl8192cu_probe(struct usb_interface *intf, - const struct usb_device_id *id) -{ - return rtl_usb_probe(intf, id, &rtl92cu_hal_cfg); -} - -static struct usb_driver rtl8192cu_driver = { - .name = "rtl8192cu", - .probe = rtl8192cu_probe, - .disconnect = rtl_usb_disconnect, - .id_table = rtl8192c_usb_ids, - -#ifdef CONFIG_PM - /* .suspend = rtl_usb_suspend, */ - /* .resume = rtl_usb_resume, */ - /* .reset_resume = rtl8192c_resume, */ -#endif /* CONFIG_PM */ -#ifdef CONFIG_AUTOSUSPEND - .supports_autosuspend = 1, -#endif - .disable_hub_initiated_lpm = 1, -}; - -module_usb_driver(rtl8192cu_driver); diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h deleted file mode 100644 index 262e1e4c6e5b..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.h +++ /dev/null @@ -1,56 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CU_SW_H__ -#define __RTL92CU_SW_H__ - -#define EFUSE_MAX_SECTION 16 - -void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, - u8 *powerlevel); -void rtl92cu_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel); -bool _rtl92cu_phy_config_bb_with_headerfile(struct ieee80211_hw *hw, - u8 configtype); -bool _rtl92cu_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw, - u8 configtype); -void _rtl92cu_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t); -void rtl92cu_phy_set_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, - u32 regaddr, u32 bitmask, u32 data); -bool rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state); -u32 rtl92cu_phy_query_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, u32 bitmask); -void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw); -void rtl92cu_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - u8 rssi_level); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/table.c b/drivers/net/wireless/rtlwifi/rtl8192cu/table.c deleted file mode 100644 index 966be519edb8..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/table.c +++ /dev/null @@ -1,1888 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "table.h" - -u32 RTL8192CUPHY_REG_2TARRAY[RTL8192CUPHY_REG_2TARRAY_LENGTH] = { - 0x024, 0x0011800f, - 0x028, 0x00ffdb83, - 0x800, 0x80040002, - 0x804, 0x00000003, - 0x808, 0x0000fc00, - 0x80c, 0x0000000a, - 0x810, 0x10005388, - 0x814, 0x020c3d10, - 0x818, 0x02200385, - 0x81c, 0x00000000, - 0x820, 0x01000100, - 0x824, 0x00390004, - 0x828, 0x01000100, - 0x82c, 0x00390004, - 0x830, 0x27272727, - 0x834, 0x27272727, - 0x838, 0x27272727, - 0x83c, 0x27272727, - 0x840, 0x00010000, - 0x844, 0x00010000, - 0x848, 0x27272727, - 0x84c, 0x27272727, - 0x850, 0x00000000, - 0x854, 0x00000000, - 0x858, 0x569a569a, - 0x85c, 0x0c1b25a4, - 0x860, 0x66e60230, - 0x864, 0x061f0130, - 0x868, 0x27272727, - 0x86c, 0x2b2b2b27, - 0x870, 0x07000700, - 0x874, 0x22184000, - 0x878, 0x08080808, - 0x87c, 0x00000000, - 0x880, 0xc0083070, - 0x884, 0x000004d5, - 0x888, 0x00000000, - 0x88c, 0xcc0000c0, - 0x890, 0x00000800, - 0x894, 0xfffffffe, - 0x898, 0x40302010, - 0x89c, 0x00706050, - 0x900, 0x00000000, - 0x904, 0x00000023, - 0x908, 0x00000000, - 0x90c, 0x81121313, - 0xa00, 0x00d047c8, - 0xa04, 0x80ff000c, - 0xa08, 0x8c838300, - 0xa0c, 0x2e68120f, - 0xa10, 0x9500bb78, - 0xa14, 0x11144028, - 0xa18, 0x00881117, - 0xa1c, 0x89140f00, - 0xa20, 0x1a1b0000, - 0xa24, 0x090e1317, - 0xa28, 0x00000204, - 0xa2c, 0x00d30000, - 0xa70, 0x101fbf00, - 0xa74, 0x00000007, - 0xc00, 0x48071d40, - 0xc04, 0x03a05633, - 0xc08, 0x000000e4, - 0xc0c, 0x6c6c6c6c, - 0xc10, 0x08800000, - 0xc14, 0x40000100, - 0xc18, 0x08800000, - 0xc1c, 0x40000100, - 0xc20, 0x00000000, - 0xc24, 0x00000000, - 0xc28, 0x00000000, - 0xc2c, 0x00000000, - 0xc30, 0x69e9ac44, - 0xc34, 0x469652cf, - 0xc38, 0x49795994, - 0xc3c, 0x0a97971c, - 0xc40, 0x1f7c403f, - 0xc44, 0x000100b7, - 0xc48, 0xec020107, - 0xc4c, 0x007f037f, - 0xc50, 0x6954341e, - 0xc54, 0x43bc0094, - 0xc58, 0x6954341e, - 0xc5c, 0x433c0094, - 0xc60, 0x00000000, - 0xc64, 0x5116848b, - 0xc68, 0x47c00bff, - 0xc6c, 0x00000036, - 0xc70, 0x2c7f000d, - 0xc74, 0x0186115b, - 0xc78, 0x0000001f, - 0xc7c, 0x00b99612, - 0xc80, 0x40000100, - 0xc84, 0x20f60000, - 0xc88, 0x40000100, - 0xc8c, 0x20200000, - 0xc90, 0x00121820, - 0xc94, 0x00000000, - 0xc98, 0x00121820, - 0xc9c, 0x00007f7f, - 0xca0, 0x00000000, - 0xca4, 0x00000080, - 0xca8, 0x00000000, - 0xcac, 0x00000000, - 0xcb0, 0x00000000, - 0xcb4, 0x00000000, - 0xcb8, 0x00000000, - 0xcbc, 0x28000000, - 0xcc0, 0x00000000, - 0xcc4, 0x00000000, - 0xcc8, 0x00000000, - 0xccc, 0x00000000, - 0xcd0, 0x00000000, - 0xcd4, 0x00000000, - 0xcd8, 0x64b22427, - 0xcdc, 0x00766932, - 0xce0, 0x00222222, - 0xce4, 0x00000000, - 0xce8, 0x37644302, - 0xcec, 0x2f97d40c, - 0xd00, 0x00080740, - 0xd04, 0x00020403, - 0xd08, 0x0000907f, - 0xd0c, 0x20010201, - 0xd10, 0xa0633333, - 0xd14, 0x3333bc43, - 0xd18, 0x7a8f5b6b, - 0xd2c, 0xcc979975, - 0xd30, 0x00000000, - 0xd34, 0x80608000, - 0xd38, 0x00000000, - 0xd3c, 0x00027293, - 0xd40, 0x00000000, - 0xd44, 0x00000000, - 0xd48, 0x00000000, - 0xd4c, 0x00000000, - 0xd50, 0x6437140a, - 0xd54, 0x00000000, - 0xd58, 0x00000000, - 0xd5c, 0x30032064, - 0xd60, 0x4653de68, - 0xd64, 0x04518a3c, - 0xd68, 0x00002101, - 0xd6c, 0x2a201c16, - 0xd70, 0x1812362e, - 0xd74, 0x322c2220, - 0xd78, 0x000e3c24, - 0xe00, 0x2a2a2a2a, - 0xe04, 0x2a2a2a2a, - 0xe08, 0x03902a2a, - 0xe10, 0x2a2a2a2a, - 0xe14, 0x2a2a2a2a, - 0xe18, 0x2a2a2a2a, - 0xe1c, 0x2a2a2a2a, - 0xe28, 0x00000000, - 0xe30, 0x1000dc1f, - 0xe34, 0x10008c1f, - 0xe38, 0x02140102, - 0xe3c, 0x681604c2, - 0xe40, 0x01007c00, - 0xe44, 0x01004800, - 0xe48, 0xfb000000, - 0xe4c, 0x000028d1, - 0xe50, 0x1000dc1f, - 0xe54, 0x10008c1f, - 0xe58, 0x02140102, - 0xe5c, 0x28160d05, - 0xe60, 0x00000010, - 0xe68, 0x001b25a4, - 0xe6c, 0x63db25a4, - 0xe70, 0x63db25a4, - 0xe74, 0x0c1b25a4, - 0xe78, 0x0c1b25a4, - 0xe7c, 0x0c1b25a4, - 0xe80, 0x0c1b25a4, - 0xe84, 0x63db25a4, - 0xe88, 0x0c1b25a4, - 0xe8c, 0x63db25a4, - 0xed0, 0x63db25a4, - 0xed4, 0x63db25a4, - 0xed8, 0x63db25a4, - 0xedc, 0x001b25a4, - 0xee0, 0x001b25a4, - 0xeec, 0x6fdb25a4, - 0xf14, 0x00000003, - 0xf4c, 0x00000000, - 0xf00, 0x00000300, -}; - -u32 RTL8192CUPHY_REG_1TARRAY[RTL8192CUPHY_REG_1TARRAY_LENGTH] = { - 0x024, 0x0011800f, - 0x028, 0x00ffdb83, - 0x800, 0x80040000, - 0x804, 0x00000001, - 0x808, 0x0000fc00, - 0x80c, 0x0000000a, - 0x810, 0x10005388, - 0x814, 0x020c3d10, - 0x818, 0x02200385, - 0x81c, 0x00000000, - 0x820, 0x01000100, - 0x824, 0x00390004, - 0x828, 0x00000000, - 0x82c, 0x00000000, - 0x830, 0x00000000, - 0x834, 0x00000000, - 0x838, 0x00000000, - 0x83c, 0x00000000, - 0x840, 0x00010000, - 0x844, 0x00000000, - 0x848, 0x00000000, - 0x84c, 0x00000000, - 0x850, 0x00000000, - 0x854, 0x00000000, - 0x858, 0x569a569a, - 0x85c, 0x001b25a4, - 0x860, 0x66e60230, - 0x864, 0x061f0130, - 0x868, 0x00000000, - 0x86c, 0x32323200, - 0x870, 0x07000700, - 0x874, 0x22004000, - 0x878, 0x00000808, - 0x87c, 0x00000000, - 0x880, 0xc0083070, - 0x884, 0x000004d5, - 0x888, 0x00000000, - 0x88c, 0xccc000c0, - 0x890, 0x00000800, - 0x894, 0xfffffffe, - 0x898, 0x40302010, - 0x89c, 0x00706050, - 0x900, 0x00000000, - 0x904, 0x00000023, - 0x908, 0x00000000, - 0x90c, 0x81121111, - 0xa00, 0x00d047c8, - 0xa04, 0x80ff000c, - 0xa08, 0x8c838300, - 0xa0c, 0x2e68120f, - 0xa10, 0x9500bb78, - 0xa14, 0x11144028, - 0xa18, 0x00881117, - 0xa1c, 0x89140f00, - 0xa20, 0x1a1b0000, - 0xa24, 0x090e1317, - 0xa28, 0x00000204, - 0xa2c, 0x00d30000, - 0xa70, 0x101fbf00, - 0xa74, 0x00000007, - 0xc00, 0x48071d40, - 0xc04, 0x03a05611, - 0xc08, 0x000000e4, - 0xc0c, 0x6c6c6c6c, - 0xc10, 0x08800000, - 0xc14, 0x40000100, - 0xc18, 0x08800000, - 0xc1c, 0x40000100, - 0xc20, 0x00000000, - 0xc24, 0x00000000, - 0xc28, 0x00000000, - 0xc2c, 0x00000000, - 0xc30, 0x69e9ac44, - 0xc34, 0x469652cf, - 0xc38, 0x49795994, - 0xc3c, 0x0a97971c, - 0xc40, 0x1f7c403f, - 0xc44, 0x000100b7, - 0xc48, 0xec020107, - 0xc4c, 0x007f037f, - 0xc50, 0x6954341e, - 0xc54, 0x43bc0094, - 0xc58, 0x6954341e, - 0xc5c, 0x433c0094, - 0xc60, 0x00000000, - 0xc64, 0x5116848b, - 0xc68, 0x47c00bff, - 0xc6c, 0x00000036, - 0xc70, 0x2c7f000d, - 0xc74, 0x018610db, - 0xc78, 0x0000001f, - 0xc7c, 0x00b91612, - 0xc80, 0x40000100, - 0xc84, 0x20f60000, - 0xc88, 0x40000100, - 0xc8c, 0x20200000, - 0xc90, 0x00121820, - 0xc94, 0x00000000, - 0xc98, 0x00121820, - 0xc9c, 0x00007f7f, - 0xca0, 0x00000000, - 0xca4, 0x00000080, - 0xca8, 0x00000000, - 0xcac, 0x00000000, - 0xcb0, 0x00000000, - 0xcb4, 0x00000000, - 0xcb8, 0x00000000, - 0xcbc, 0x28000000, - 0xcc0, 0x00000000, - 0xcc4, 0x00000000, - 0xcc8, 0x00000000, - 0xccc, 0x00000000, - 0xcd0, 0x00000000, - 0xcd4, 0x00000000, - 0xcd8, 0x64b22427, - 0xcdc, 0x00766932, - 0xce0, 0x00222222, - 0xce4, 0x00000000, - 0xce8, 0x37644302, - 0xcec, 0x2f97d40c, - 0xd00, 0x00080740, - 0xd04, 0x00020401, - 0xd08, 0x0000907f, - 0xd0c, 0x20010201, - 0xd10, 0xa0633333, - 0xd14, 0x3333bc43, - 0xd18, 0x7a8f5b6b, - 0xd2c, 0xcc979975, - 0xd30, 0x00000000, - 0xd34, 0x80608000, - 0xd38, 0x00000000, - 0xd3c, 0x00027293, - 0xd40, 0x00000000, - 0xd44, 0x00000000, - 0xd48, 0x00000000, - 0xd4c, 0x00000000, - 0xd50, 0x6437140a, - 0xd54, 0x00000000, - 0xd58, 0x00000000, - 0xd5c, 0x30032064, - 0xd60, 0x4653de68, - 0xd64, 0x04518a3c, - 0xd68, 0x00002101, - 0xd6c, 0x2a201c16, - 0xd70, 0x1812362e, - 0xd74, 0x322c2220, - 0xd78, 0x000e3c24, - 0xe00, 0x2a2a2a2a, - 0xe04, 0x2a2a2a2a, - 0xe08, 0x03902a2a, - 0xe10, 0x2a2a2a2a, - 0xe14, 0x2a2a2a2a, - 0xe18, 0x2a2a2a2a, - 0xe1c, 0x2a2a2a2a, - 0xe28, 0x00000000, - 0xe30, 0x1000dc1f, - 0xe34, 0x10008c1f, - 0xe38, 0x02140102, - 0xe3c, 0x681604c2, - 0xe40, 0x01007c00, - 0xe44, 0x01004800, - 0xe48, 0xfb000000, - 0xe4c, 0x000028d1, - 0xe50, 0x1000dc1f, - 0xe54, 0x10008c1f, - 0xe58, 0x02140102, - 0xe5c, 0x28160d05, - 0xe60, 0x00000008, - 0xe68, 0x001b25a4, - 0xe6c, 0x631b25a0, - 0xe70, 0x631b25a0, - 0xe74, 0x081b25a0, - 0xe78, 0x081b25a0, - 0xe7c, 0x081b25a0, - 0xe80, 0x081b25a0, - 0xe84, 0x631b25a0, - 0xe88, 0x081b25a0, - 0xe8c, 0x631b25a0, - 0xed0, 0x631b25a0, - 0xed4, 0x631b25a0, - 0xed8, 0x631b25a0, - 0xedc, 0x001b25a0, - 0xee0, 0x001b25a0, - 0xeec, 0x6b1b25a0, - 0xf14, 0x00000003, - 0xf4c, 0x00000000, - 0xf00, 0x00000300, -}; - -u32 RTL8192CUPHY_REG_ARRAY_PG[RTL8192CUPHY_REG_ARRAY_PGLENGTH] = { - 0xe00, 0xffffffff, 0x07090c0c, - 0xe04, 0xffffffff, 0x01020405, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x0b0c0c0e, - 0xe14, 0xffffffff, 0x01030506, - 0xe18, 0xffffffff, 0x0b0c0d0e, - 0xe1c, 0xffffffff, 0x01030509, - 0x830, 0xffffffff, 0x07090c0c, - 0x834, 0xffffffff, 0x01020405, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x0b0c0d0e, - 0x848, 0xffffffff, 0x01030509, - 0x84c, 0xffffffff, 0x0b0c0d0e, - 0x868, 0xffffffff, 0x01030509, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x06060606, - 0xe14, 0xffffffff, 0x00020406, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x04040404, - 0x834, 0xffffffff, 0x00020204, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x06060606, - 0x848, 0xffffffff, 0x00020406, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x04040404, - 0x834, 0xffffffff, 0x00020204, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, -}; - -u32 RTL8192CURADIOA_2TARRAY[RTL8192CURADIOA_2TARRAYLENGTH] = { - 0x000, 0x00030159, - 0x001, 0x00031284, - 0x002, 0x00098000, - 0x003, 0x00018c63, - 0x004, 0x000210e7, - 0x009, 0x0002044f, - 0x00a, 0x0001adb1, - 0x00b, 0x00054867, - 0x00c, 0x0008992e, - 0x00d, 0x0000e52c, - 0x00e, 0x00039ce7, - 0x00f, 0x00000451, - 0x019, 0x00000000, - 0x01a, 0x00010255, - 0x01b, 0x00060a00, - 0x01c, 0x000fc378, - 0x01d, 0x000a1250, - 0x01e, 0x0004445f, - 0x01f, 0x00080001, - 0x020, 0x0000b614, - 0x021, 0x0006c000, - 0x022, 0x00000000, - 0x023, 0x00001558, - 0x024, 0x00000060, - 0x025, 0x00000483, - 0x026, 0x0004f000, - 0x027, 0x000ec7d9, - 0x028, 0x000577c0, - 0x029, 0x00004783, - 0x02a, 0x00000001, - 0x02b, 0x00021334, - 0x02a, 0x00000000, - 0x02b, 0x00000054, - 0x02a, 0x00000001, - 0x02b, 0x00000808, - 0x02b, 0x00053333, - 0x02c, 0x0000000c, - 0x02a, 0x00000002, - 0x02b, 0x00000808, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000003, - 0x02b, 0x00000808, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x00000004, - 0x02b, 0x00000808, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000005, - 0x02b, 0x00000808, - 0x02b, 0x00073333, - 0x02c, 0x0000000d, - 0x02a, 0x00000006, - 0x02b, 0x00000709, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000007, - 0x02b, 0x00000709, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x00000008, - 0x02b, 0x0000060a, - 0x02b, 0x0004b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000009, - 0x02b, 0x0000060a, - 0x02b, 0x00053333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000a, - 0x02b, 0x0000060a, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000b, - 0x02b, 0x0000060a, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000c, - 0x02b, 0x0000060a, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000d, - 0x02b, 0x0000060a, - 0x02b, 0x00073333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000e, - 0x02b, 0x0000050b, - 0x02b, 0x00066666, - 0x02c, 0x0000001a, - 0x02a, 0x000e0000, - 0x010, 0x0004000f, - 0x011, 0x000e31fc, - 0x010, 0x0006000f, - 0x011, 0x000ff9f8, - 0x010, 0x0002000f, - 0x011, 0x000203f9, - 0x010, 0x0003000f, - 0x011, 0x000ff500, - 0x010, 0x00000000, - 0x011, 0x00000000, - 0x010, 0x0008000f, - 0x011, 0x0003f100, - 0x010, 0x0009000f, - 0x011, 0x00023100, - 0x012, 0x00032000, - 0x012, 0x00071000, - 0x012, 0x000b0000, - 0x012, 0x000fc000, - 0x013, 0x000287af, - 0x013, 0x000244b7, - 0x013, 0x000204ab, - 0x013, 0x0001c49f, - 0x013, 0x00018493, - 0x013, 0x00014297, - 0x013, 0x00010295, - 0x013, 0x0000c298, - 0x013, 0x0000819c, - 0x013, 0x000040a8, - 0x013, 0x0000001c, - 0x014, 0x0001944c, - 0x014, 0x00059444, - 0x014, 0x0009944c, - 0x014, 0x000d9444, - 0x015, 0x0000f424, - 0x015, 0x0004f424, - 0x015, 0x0008f424, - 0x015, 0x000cf424, - 0x016, 0x000e0330, - 0x016, 0x000a0330, - 0x016, 0x00060330, - 0x016, 0x00020330, - 0x000, 0x00010159, - 0x018, 0x0000f401, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01f, 0x00080003, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01e, 0x00044457, - 0x01f, 0x00080000, - 0x000, 0x00030159, -}; - -u32 RTL8192CU_RADIOB_2TARRAY[RTL8192CURADIOB_2TARRAYLENGTH] = { - 0x000, 0x00030159, - 0x001, 0x00031284, - 0x002, 0x00098000, - 0x003, 0x00018c63, - 0x004, 0x000210e7, - 0x009, 0x0002044f, - 0x00a, 0x0001adb1, - 0x00b, 0x00054867, - 0x00c, 0x0008992e, - 0x00d, 0x0000e52c, - 0x00e, 0x00039ce7, - 0x00f, 0x00000451, - 0x012, 0x00032000, - 0x012, 0x00071000, - 0x012, 0x000b0000, - 0x012, 0x000fc000, - 0x013, 0x000287af, - 0x013, 0x000244b7, - 0x013, 0x000204ab, - 0x013, 0x0001c49f, - 0x013, 0x00018493, - 0x013, 0x00014297, - 0x013, 0x00010295, - 0x013, 0x0000c298, - 0x013, 0x0000819c, - 0x013, 0x000040a8, - 0x013, 0x0000001c, - 0x014, 0x0001944c, - 0x014, 0x00059444, - 0x014, 0x0009944c, - 0x014, 0x000d9444, - 0x015, 0x0000f424, - 0x015, 0x0004f424, - 0x015, 0x0008f424, - 0x015, 0x000cf424, - 0x016, 0x000e0330, - 0x016, 0x000a0330, - 0x016, 0x00060330, - 0x016, 0x00020330, -}; - -u32 RTL8192CU_RADIOA_1TARRAY[RTL8192CURADIOA_1TARRAYLENGTH] = { - 0x000, 0x00030159, - 0x001, 0x00031284, - 0x002, 0x00098000, - 0x003, 0x00018c63, - 0x004, 0x000210e7, - 0x009, 0x0002044f, - 0x00a, 0x0001adb1, - 0x00b, 0x00054867, - 0x00c, 0x0008992e, - 0x00d, 0x0000e52c, - 0x00e, 0x00039ce7, - 0x00f, 0x00000451, - 0x019, 0x00000000, - 0x01a, 0x00010255, - 0x01b, 0x00060a00, - 0x01c, 0x000fc378, - 0x01d, 0x000a1250, - 0x01e, 0x0004445f, - 0x01f, 0x00080001, - 0x020, 0x0000b614, - 0x021, 0x0006c000, - 0x022, 0x00000000, - 0x023, 0x00001558, - 0x024, 0x00000060, - 0x025, 0x00000483, - 0x026, 0x0004f000, - 0x027, 0x000ec7d9, - 0x028, 0x000577c0, - 0x029, 0x00004783, - 0x02a, 0x00000001, - 0x02b, 0x00021334, - 0x02a, 0x00000000, - 0x02b, 0x00000054, - 0x02a, 0x00000001, - 0x02b, 0x00000808, - 0x02b, 0x00053333, - 0x02c, 0x0000000c, - 0x02a, 0x00000002, - 0x02b, 0x00000808, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000003, - 0x02b, 0x00000808, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x00000004, - 0x02b, 0x00000808, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000005, - 0x02b, 0x00000808, - 0x02b, 0x00073333, - 0x02c, 0x0000000d, - 0x02a, 0x00000006, - 0x02b, 0x00000709, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000007, - 0x02b, 0x00000709, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x00000008, - 0x02b, 0x0000060a, - 0x02b, 0x0004b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000009, - 0x02b, 0x0000060a, - 0x02b, 0x00053333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000a, - 0x02b, 0x0000060a, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000b, - 0x02b, 0x0000060a, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000c, - 0x02b, 0x0000060a, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000d, - 0x02b, 0x0000060a, - 0x02b, 0x00073333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000e, - 0x02b, 0x0000050b, - 0x02b, 0x00066666, - 0x02c, 0x0000001a, - 0x02a, 0x000e0000, - 0x010, 0x0004000f, - 0x011, 0x000e31fc, - 0x010, 0x0006000f, - 0x011, 0x000ff9f8, - 0x010, 0x0002000f, - 0x011, 0x000203f9, - 0x010, 0x0003000f, - 0x011, 0x000ff500, - 0x010, 0x00000000, - 0x011, 0x00000000, - 0x010, 0x0008000f, - 0x011, 0x0003f100, - 0x010, 0x0009000f, - 0x011, 0x00023100, - 0x012, 0x00032000, - 0x012, 0x00071000, - 0x012, 0x000b0000, - 0x012, 0x000fc000, - 0x013, 0x000287b3, - 0x013, 0x000244b7, - 0x013, 0x000204ab, - 0x013, 0x0001c49f, - 0x013, 0x00018493, - 0x013, 0x0001429b, - 0x013, 0x00010299, - 0x013, 0x0000c29c, - 0x013, 0x000081a0, - 0x013, 0x000040ac, - 0x013, 0x00000020, - 0x014, 0x0001944c, - 0x014, 0x00059444, - 0x014, 0x0009944c, - 0x014, 0x000d9444, - 0x015, 0x0000f405, - 0x015, 0x0004f405, - 0x015, 0x0008f405, - 0x015, 0x000cf405, - 0x016, 0x000e0330, - 0x016, 0x000a0330, - 0x016, 0x00060330, - 0x016, 0x00020330, - 0x000, 0x00010159, - 0x018, 0x0000f401, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01f, 0x00080003, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01e, 0x00044457, - 0x01f, 0x00080000, - 0x000, 0x00030159, -}; - -u32 RTL8192CU_RADIOB_1TARRAY[RTL8192CURADIOB_1TARRAYLENGTH] = { - 0x0, -}; - -u32 RTL8192CUMAC_2T_ARRAY[RTL8192CUMAC_2T_ARRAYLENGTH] = { - 0x420, 0x00000080, - 0x423, 0x00000000, - 0x430, 0x00000000, - 0x431, 0x00000000, - 0x432, 0x00000000, - 0x433, 0x00000001, - 0x434, 0x00000004, - 0x435, 0x00000005, - 0x436, 0x00000006, - 0x437, 0x00000007, - 0x438, 0x00000000, - 0x439, 0x00000000, - 0x43a, 0x00000000, - 0x43b, 0x00000001, - 0x43c, 0x00000004, - 0x43d, 0x00000005, - 0x43e, 0x00000006, - 0x43f, 0x00000007, - 0x440, 0x0000005d, - 0x441, 0x00000001, - 0x442, 0x00000000, - 0x444, 0x00000015, - 0x445, 0x000000f0, - 0x446, 0x0000000f, - 0x447, 0x00000000, - 0x458, 0x00000041, - 0x459, 0x000000a8, - 0x45a, 0x00000072, - 0x45b, 0x000000b9, - 0x460, 0x00000066, - 0x461, 0x00000066, - 0x462, 0x00000008, - 0x463, 0x00000003, - 0x4c8, 0x000000ff, - 0x4c9, 0x00000008, - 0x4cc, 0x000000ff, - 0x4cd, 0x000000ff, - 0x4ce, 0x00000001, - 0x500, 0x00000026, - 0x501, 0x000000a2, - 0x502, 0x0000002f, - 0x503, 0x00000000, - 0x504, 0x00000028, - 0x505, 0x000000a3, - 0x506, 0x0000005e, - 0x507, 0x00000000, - 0x508, 0x0000002b, - 0x509, 0x000000a4, - 0x50a, 0x0000005e, - 0x50b, 0x00000000, - 0x50c, 0x0000004f, - 0x50d, 0x000000a4, - 0x50e, 0x00000000, - 0x50f, 0x00000000, - 0x512, 0x0000001c, - 0x514, 0x0000000a, - 0x515, 0x00000010, - 0x516, 0x0000000a, - 0x517, 0x00000010, - 0x51a, 0x00000016, - 0x524, 0x0000000f, - 0x525, 0x0000004f, - 0x546, 0x00000040, - 0x547, 0x00000000, - 0x550, 0x00000010, - 0x551, 0x00000010, - 0x559, 0x00000002, - 0x55a, 0x00000002, - 0x55d, 0x000000ff, - 0x605, 0x00000030, - 0x608, 0x0000000e, - 0x609, 0x0000002a, - 0x652, 0x00000020, - 0x63c, 0x0000000a, - 0x63d, 0x0000000e, - 0x63e, 0x0000000a, - 0x63f, 0x0000000e, - 0x66e, 0x00000005, - 0x700, 0x00000021, - 0x701, 0x00000043, - 0x702, 0x00000065, - 0x703, 0x00000087, - 0x708, 0x00000021, - 0x709, 0x00000043, - 0x70a, 0x00000065, - 0x70b, 0x00000087, -}; - -u32 RTL8192CUAGCTAB_2TARRAY[RTL8192CUAGCTAB_2TARRAYLENGTH] = { - 0xc78, 0x7b000001, - 0xc78, 0x7b010001, - 0xc78, 0x7b020001, - 0xc78, 0x7b030001, - 0xc78, 0x7b040001, - 0xc78, 0x7b050001, - 0xc78, 0x7a060001, - 0xc78, 0x79070001, - 0xc78, 0x78080001, - 0xc78, 0x77090001, - 0xc78, 0x760a0001, - 0xc78, 0x750b0001, - 0xc78, 0x740c0001, - 0xc78, 0x730d0001, - 0xc78, 0x720e0001, - 0xc78, 0x710f0001, - 0xc78, 0x70100001, - 0xc78, 0x6f110001, - 0xc78, 0x6e120001, - 0xc78, 0x6d130001, - 0xc78, 0x6c140001, - 0xc78, 0x6b150001, - 0xc78, 0x6a160001, - 0xc78, 0x69170001, - 0xc78, 0x68180001, - 0xc78, 0x67190001, - 0xc78, 0x661a0001, - 0xc78, 0x651b0001, - 0xc78, 0x641c0001, - 0xc78, 0x631d0001, - 0xc78, 0x621e0001, - 0xc78, 0x611f0001, - 0xc78, 0x60200001, - 0xc78, 0x49210001, - 0xc78, 0x48220001, - 0xc78, 0x47230001, - 0xc78, 0x46240001, - 0xc78, 0x45250001, - 0xc78, 0x44260001, - 0xc78, 0x43270001, - 0xc78, 0x42280001, - 0xc78, 0x41290001, - 0xc78, 0x402a0001, - 0xc78, 0x262b0001, - 0xc78, 0x252c0001, - 0xc78, 0x242d0001, - 0xc78, 0x232e0001, - 0xc78, 0x222f0001, - 0xc78, 0x21300001, - 0xc78, 0x20310001, - 0xc78, 0x06320001, - 0xc78, 0x05330001, - 0xc78, 0x04340001, - 0xc78, 0x03350001, - 0xc78, 0x02360001, - 0xc78, 0x01370001, - 0xc78, 0x00380001, - 0xc78, 0x00390001, - 0xc78, 0x003a0001, - 0xc78, 0x003b0001, - 0xc78, 0x003c0001, - 0xc78, 0x003d0001, - 0xc78, 0x003e0001, - 0xc78, 0x003f0001, - 0xc78, 0x7b400001, - 0xc78, 0x7b410001, - 0xc78, 0x7b420001, - 0xc78, 0x7b430001, - 0xc78, 0x7b440001, - 0xc78, 0x7b450001, - 0xc78, 0x7a460001, - 0xc78, 0x79470001, - 0xc78, 0x78480001, - 0xc78, 0x77490001, - 0xc78, 0x764a0001, - 0xc78, 0x754b0001, - 0xc78, 0x744c0001, - 0xc78, 0x734d0001, - 0xc78, 0x724e0001, - 0xc78, 0x714f0001, - 0xc78, 0x70500001, - 0xc78, 0x6f510001, - 0xc78, 0x6e520001, - 0xc78, 0x6d530001, - 0xc78, 0x6c540001, - 0xc78, 0x6b550001, - 0xc78, 0x6a560001, - 0xc78, 0x69570001, - 0xc78, 0x68580001, - 0xc78, 0x67590001, - 0xc78, 0x665a0001, - 0xc78, 0x655b0001, - 0xc78, 0x645c0001, - 0xc78, 0x635d0001, - 0xc78, 0x625e0001, - 0xc78, 0x615f0001, - 0xc78, 0x60600001, - 0xc78, 0x49610001, - 0xc78, 0x48620001, - 0xc78, 0x47630001, - 0xc78, 0x46640001, - 0xc78, 0x45650001, - 0xc78, 0x44660001, - 0xc78, 0x43670001, - 0xc78, 0x42680001, - 0xc78, 0x41690001, - 0xc78, 0x406a0001, - 0xc78, 0x266b0001, - 0xc78, 0x256c0001, - 0xc78, 0x246d0001, - 0xc78, 0x236e0001, - 0xc78, 0x226f0001, - 0xc78, 0x21700001, - 0xc78, 0x20710001, - 0xc78, 0x06720001, - 0xc78, 0x05730001, - 0xc78, 0x04740001, - 0xc78, 0x03750001, - 0xc78, 0x02760001, - 0xc78, 0x01770001, - 0xc78, 0x00780001, - 0xc78, 0x00790001, - 0xc78, 0x007a0001, - 0xc78, 0x007b0001, - 0xc78, 0x007c0001, - 0xc78, 0x007d0001, - 0xc78, 0x007e0001, - 0xc78, 0x007f0001, - 0xc78, 0x3800001e, - 0xc78, 0x3801001e, - 0xc78, 0x3802001e, - 0xc78, 0x3803001e, - 0xc78, 0x3804001e, - 0xc78, 0x3805001e, - 0xc78, 0x3806001e, - 0xc78, 0x3807001e, - 0xc78, 0x3808001e, - 0xc78, 0x3c09001e, - 0xc78, 0x3e0a001e, - 0xc78, 0x400b001e, - 0xc78, 0x440c001e, - 0xc78, 0x480d001e, - 0xc78, 0x4c0e001e, - 0xc78, 0x500f001e, - 0xc78, 0x5210001e, - 0xc78, 0x5611001e, - 0xc78, 0x5a12001e, - 0xc78, 0x5e13001e, - 0xc78, 0x6014001e, - 0xc78, 0x6015001e, - 0xc78, 0x6016001e, - 0xc78, 0x6217001e, - 0xc78, 0x6218001e, - 0xc78, 0x6219001e, - 0xc78, 0x621a001e, - 0xc78, 0x621b001e, - 0xc78, 0x621c001e, - 0xc78, 0x621d001e, - 0xc78, 0x621e001e, - 0xc78, 0x621f001e, -}; - -u32 RTL8192CUAGCTAB_1TARRAY[RTL8192CUAGCTAB_1TARRAYLENGTH] = { - 0xc78, 0x7b000001, - 0xc78, 0x7b010001, - 0xc78, 0x7b020001, - 0xc78, 0x7b030001, - 0xc78, 0x7b040001, - 0xc78, 0x7b050001, - 0xc78, 0x7a060001, - 0xc78, 0x79070001, - 0xc78, 0x78080001, - 0xc78, 0x77090001, - 0xc78, 0x760a0001, - 0xc78, 0x750b0001, - 0xc78, 0x740c0001, - 0xc78, 0x730d0001, - 0xc78, 0x720e0001, - 0xc78, 0x710f0001, - 0xc78, 0x70100001, - 0xc78, 0x6f110001, - 0xc78, 0x6e120001, - 0xc78, 0x6d130001, - 0xc78, 0x6c140001, - 0xc78, 0x6b150001, - 0xc78, 0x6a160001, - 0xc78, 0x69170001, - 0xc78, 0x68180001, - 0xc78, 0x67190001, - 0xc78, 0x661a0001, - 0xc78, 0x651b0001, - 0xc78, 0x641c0001, - 0xc78, 0x631d0001, - 0xc78, 0x621e0001, - 0xc78, 0x611f0001, - 0xc78, 0x60200001, - 0xc78, 0x49210001, - 0xc78, 0x48220001, - 0xc78, 0x47230001, - 0xc78, 0x46240001, - 0xc78, 0x45250001, - 0xc78, 0x44260001, - 0xc78, 0x43270001, - 0xc78, 0x42280001, - 0xc78, 0x41290001, - 0xc78, 0x402a0001, - 0xc78, 0x262b0001, - 0xc78, 0x252c0001, - 0xc78, 0x242d0001, - 0xc78, 0x232e0001, - 0xc78, 0x222f0001, - 0xc78, 0x21300001, - 0xc78, 0x20310001, - 0xc78, 0x06320001, - 0xc78, 0x05330001, - 0xc78, 0x04340001, - 0xc78, 0x03350001, - 0xc78, 0x02360001, - 0xc78, 0x01370001, - 0xc78, 0x00380001, - 0xc78, 0x00390001, - 0xc78, 0x003a0001, - 0xc78, 0x003b0001, - 0xc78, 0x003c0001, - 0xc78, 0x003d0001, - 0xc78, 0x003e0001, - 0xc78, 0x003f0001, - 0xc78, 0x7b400001, - 0xc78, 0x7b410001, - 0xc78, 0x7b420001, - 0xc78, 0x7b430001, - 0xc78, 0x7b440001, - 0xc78, 0x7b450001, - 0xc78, 0x7a460001, - 0xc78, 0x79470001, - 0xc78, 0x78480001, - 0xc78, 0x77490001, - 0xc78, 0x764a0001, - 0xc78, 0x754b0001, - 0xc78, 0x744c0001, - 0xc78, 0x734d0001, - 0xc78, 0x724e0001, - 0xc78, 0x714f0001, - 0xc78, 0x70500001, - 0xc78, 0x6f510001, - 0xc78, 0x6e520001, - 0xc78, 0x6d530001, - 0xc78, 0x6c540001, - 0xc78, 0x6b550001, - 0xc78, 0x6a560001, - 0xc78, 0x69570001, - 0xc78, 0x68580001, - 0xc78, 0x67590001, - 0xc78, 0x665a0001, - 0xc78, 0x655b0001, - 0xc78, 0x645c0001, - 0xc78, 0x635d0001, - 0xc78, 0x625e0001, - 0xc78, 0x615f0001, - 0xc78, 0x60600001, - 0xc78, 0x49610001, - 0xc78, 0x48620001, - 0xc78, 0x47630001, - 0xc78, 0x46640001, - 0xc78, 0x45650001, - 0xc78, 0x44660001, - 0xc78, 0x43670001, - 0xc78, 0x42680001, - 0xc78, 0x41690001, - 0xc78, 0x406a0001, - 0xc78, 0x266b0001, - 0xc78, 0x256c0001, - 0xc78, 0x246d0001, - 0xc78, 0x236e0001, - 0xc78, 0x226f0001, - 0xc78, 0x21700001, - 0xc78, 0x20710001, - 0xc78, 0x06720001, - 0xc78, 0x05730001, - 0xc78, 0x04740001, - 0xc78, 0x03750001, - 0xc78, 0x02760001, - 0xc78, 0x01770001, - 0xc78, 0x00780001, - 0xc78, 0x00790001, - 0xc78, 0x007a0001, - 0xc78, 0x007b0001, - 0xc78, 0x007c0001, - 0xc78, 0x007d0001, - 0xc78, 0x007e0001, - 0xc78, 0x007f0001, - 0xc78, 0x3800001e, - 0xc78, 0x3801001e, - 0xc78, 0x3802001e, - 0xc78, 0x3803001e, - 0xc78, 0x3804001e, - 0xc78, 0x3805001e, - 0xc78, 0x3806001e, - 0xc78, 0x3807001e, - 0xc78, 0x3808001e, - 0xc78, 0x3c09001e, - 0xc78, 0x3e0a001e, - 0xc78, 0x400b001e, - 0xc78, 0x440c001e, - 0xc78, 0x480d001e, - 0xc78, 0x4c0e001e, - 0xc78, 0x500f001e, - 0xc78, 0x5210001e, - 0xc78, 0x5611001e, - 0xc78, 0x5a12001e, - 0xc78, 0x5e13001e, - 0xc78, 0x6014001e, - 0xc78, 0x6015001e, - 0xc78, 0x6016001e, - 0xc78, 0x6217001e, - 0xc78, 0x6218001e, - 0xc78, 0x6219001e, - 0xc78, 0x621a001e, - 0xc78, 0x621b001e, - 0xc78, 0x621c001e, - 0xc78, 0x621d001e, - 0xc78, 0x621e001e, - 0xc78, 0x621f001e, -}; - -u32 RTL8192CUPHY_REG_1T_HPArray[RTL8192CUPHY_REG_1T_HPArrayLength] = { - 0x024, 0x0011800f, - 0x028, 0x00ffdb83, - 0x040, 0x000c0004, - 0x800, 0x80040000, - 0x804, 0x00000001, - 0x808, 0x0000fc00, - 0x80c, 0x0000000a, - 0x810, 0x10005388, - 0x814, 0x020c3d10, - 0x818, 0x02200385, - 0x81c, 0x00000000, - 0x820, 0x01000100, - 0x824, 0x00390204, - 0x828, 0x00000000, - 0x82c, 0x00000000, - 0x830, 0x00000000, - 0x834, 0x00000000, - 0x838, 0x00000000, - 0x83c, 0x00000000, - 0x840, 0x00010000, - 0x844, 0x00000000, - 0x848, 0x00000000, - 0x84c, 0x00000000, - 0x850, 0x00000000, - 0x854, 0x00000000, - 0x858, 0x569a569a, - 0x85c, 0x001b25a4, - 0x860, 0x66e60230, - 0x864, 0x061f0130, - 0x868, 0x00000000, - 0x86c, 0x20202000, - 0x870, 0x03000300, - 0x874, 0x22004000, - 0x878, 0x00000808, - 0x87c, 0x00ffc3f1, - 0x880, 0xc0083070, - 0x884, 0x000004d5, - 0x888, 0x00000000, - 0x88c, 0xccc000c0, - 0x890, 0x00000800, - 0x894, 0xfffffffe, - 0x898, 0x40302010, - 0x89c, 0x00706050, - 0x900, 0x00000000, - 0x904, 0x00000023, - 0x908, 0x00000000, - 0x90c, 0x81121111, - 0xa00, 0x00d047c8, - 0xa04, 0x80ff000c, - 0xa08, 0x8c838300, - 0xa0c, 0x2e68120f, - 0xa10, 0x9500bb78, - 0xa14, 0x11144028, - 0xa18, 0x00881117, - 0xa1c, 0x89140f00, - 0xa20, 0x15160000, - 0xa24, 0x070b0f12, - 0xa28, 0x00000104, - 0xa2c, 0x00d30000, - 0xa70, 0x101fbf00, - 0xa74, 0x00000007, - 0xc00, 0x48071d40, - 0xc04, 0x03a05611, - 0xc08, 0x000000e4, - 0xc0c, 0x6c6c6c6c, - 0xc10, 0x08800000, - 0xc14, 0x40000100, - 0xc18, 0x08800000, - 0xc1c, 0x40000100, - 0xc20, 0x00000000, - 0xc24, 0x00000000, - 0xc28, 0x00000000, - 0xc2c, 0x00000000, - 0xc30, 0x69e9ac44, - 0xc34, 0x469652cf, - 0xc38, 0x49795994, - 0xc3c, 0x0a97971c, - 0xc40, 0x1f7c403f, - 0xc44, 0x000100b7, - 0xc48, 0xec020107, - 0xc4c, 0x007f037f, - 0xc50, 0x6954342e, - 0xc54, 0x43bc0094, - 0xc58, 0x6954342f, - 0xc5c, 0x433c0094, - 0xc60, 0x00000000, - 0xc64, 0x5116848b, - 0xc68, 0x47c00bff, - 0xc6c, 0x00000036, - 0xc70, 0x2c46000d, - 0xc74, 0x018610db, - 0xc78, 0x0000001f, - 0xc7c, 0x00b91612, - 0xc80, 0x24000090, - 0xc84, 0x20f60000, - 0xc88, 0x24000090, - 0xc8c, 0x20200000, - 0xc90, 0x00121820, - 0xc94, 0x00000000, - 0xc98, 0x00121820, - 0xc9c, 0x00007f7f, - 0xca0, 0x00000000, - 0xca4, 0x00000080, - 0xca8, 0x00000000, - 0xcac, 0x00000000, - 0xcb0, 0x00000000, - 0xcb4, 0x00000000, - 0xcb8, 0x00000000, - 0xcbc, 0x28000000, - 0xcc0, 0x00000000, - 0xcc4, 0x00000000, - 0xcc8, 0x00000000, - 0xccc, 0x00000000, - 0xcd0, 0x00000000, - 0xcd4, 0x00000000, - 0xcd8, 0x64b22427, - 0xcdc, 0x00766932, - 0xce0, 0x00222222, - 0xce4, 0x00000000, - 0xce8, 0x37644302, - 0xcec, 0x2f97d40c, - 0xd00, 0x00080740, - 0xd04, 0x00020401, - 0xd08, 0x0000907f, - 0xd0c, 0x20010201, - 0xd10, 0xa0633333, - 0xd14, 0x3333bc43, - 0xd18, 0x7a8f5b6b, - 0xd2c, 0xcc979975, - 0xd30, 0x00000000, - 0xd34, 0x80608000, - 0xd38, 0x00000000, - 0xd3c, 0x00027293, - 0xd40, 0x00000000, - 0xd44, 0x00000000, - 0xd48, 0x00000000, - 0xd4c, 0x00000000, - 0xd50, 0x6437140a, - 0xd54, 0x00000000, - 0xd58, 0x00000000, - 0xd5c, 0x30032064, - 0xd60, 0x4653de68, - 0xd64, 0x04518a3c, - 0xd68, 0x00002101, - 0xd6c, 0x2a201c16, - 0xd70, 0x1812362e, - 0xd74, 0x322c2220, - 0xd78, 0x000e3c24, - 0xe00, 0x24242424, - 0xe04, 0x24242424, - 0xe08, 0x03902024, - 0xe10, 0x24242424, - 0xe14, 0x24242424, - 0xe18, 0x24242424, - 0xe1c, 0x24242424, - 0xe28, 0x00000000, - 0xe30, 0x1000dc1f, - 0xe34, 0x10008c1f, - 0xe38, 0x02140102, - 0xe3c, 0x681604c2, - 0xe40, 0x01007c00, - 0xe44, 0x01004800, - 0xe48, 0xfb000000, - 0xe4c, 0x000028d1, - 0xe50, 0x1000dc1f, - 0xe54, 0x10008c1f, - 0xe58, 0x02140102, - 0xe5c, 0x28160d05, - 0xe60, 0x00000008, - 0xe68, 0x001b25a4, - 0xe6c, 0x631b25a0, - 0xe70, 0x631b25a0, - 0xe74, 0x081b25a0, - 0xe78, 0x081b25a0, - 0xe7c, 0x081b25a0, - 0xe80, 0x081b25a0, - 0xe84, 0x631b25a0, - 0xe88, 0x081b25a0, - 0xe8c, 0x631b25a0, - 0xed0, 0x631b25a0, - 0xed4, 0x631b25a0, - 0xed8, 0x631b25a0, - 0xedc, 0x001b25a0, - 0xee0, 0x001b25a0, - 0xeec, 0x6b1b25a0, - 0xee8, 0x31555448, - 0xf14, 0x00000003, - 0xf4c, 0x00000000, - 0xf00, 0x00000300, -}; - -u32 RTL8192CUPHY_REG_Array_PG_HP[RTL8192CUPHY_REG_Array_PG_HPLength] = { - 0xe00, 0xffffffff, 0x06080808, - 0xe04, 0xffffffff, 0x00040406, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x04060608, - 0xe14, 0xffffffff, 0x00020204, - 0xe18, 0xffffffff, 0x04060608, - 0xe1c, 0xffffffff, 0x00020204, - 0x830, 0xffffffff, 0x06080808, - 0x834, 0xffffffff, 0x00040406, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x04060608, - 0x848, 0xffffffff, 0x00020204, - 0x84c, 0xffffffff, 0x04060608, - 0x868, 0xffffffff, 0x00020204, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, -}; - -u32 RTL8192CURadioA_1T_HPArray[RTL8192CURadioA_1T_HPArrayLength] = { - 0x000, 0x00030159, - 0x001, 0x00031284, - 0x002, 0x00098000, - 0x003, 0x00018c63, - 0x004, 0x000210e7, - 0x009, 0x0002044f, - 0x00a, 0x0001adb0, - 0x00b, 0x00054867, - 0x00c, 0x0008992e, - 0x00d, 0x0000e529, - 0x00e, 0x00039ce7, - 0x00f, 0x00000451, - 0x019, 0x00000000, - 0x01a, 0x00000255, - 0x01b, 0x00060a00, - 0x01c, 0x000fc378, - 0x01d, 0x000a1250, - 0x01e, 0x0004445f, - 0x01f, 0x00080001, - 0x020, 0x0000b614, - 0x021, 0x0006c000, - 0x022, 0x0000083c, - 0x023, 0x00001558, - 0x024, 0x00000060, - 0x025, 0x00000483, - 0x026, 0x0004f000, - 0x027, 0x000ec7d9, - 0x028, 0x000977c0, - 0x029, 0x00004783, - 0x02a, 0x00000001, - 0x02b, 0x00021334, - 0x02a, 0x00000000, - 0x02b, 0x00000054, - 0x02a, 0x00000001, - 0x02b, 0x00000808, - 0x02b, 0x00053333, - 0x02c, 0x0000000c, - 0x02a, 0x00000002, - 0x02b, 0x00000808, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000003, - 0x02b, 0x00000808, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x00000004, - 0x02b, 0x00000808, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000005, - 0x02b, 0x00000808, - 0x02b, 0x00073333, - 0x02c, 0x0000000d, - 0x02a, 0x00000006, - 0x02b, 0x00000709, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000007, - 0x02b, 0x00000709, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x00000008, - 0x02b, 0x0000060a, - 0x02b, 0x0004b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000009, - 0x02b, 0x0000060a, - 0x02b, 0x00053333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000a, - 0x02b, 0x0000060a, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000b, - 0x02b, 0x0000060a, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000c, - 0x02b, 0x0000060a, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000d, - 0x02b, 0x0000060a, - 0x02b, 0x00073333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000e, - 0x02b, 0x0000050b, - 0x02b, 0x00066666, - 0x02c, 0x0000001a, - 0x02a, 0x000e0000, - 0x010, 0x0004000f, - 0x011, 0x000e31fc, - 0x010, 0x0006000f, - 0x011, 0x000ff9f8, - 0x010, 0x0002000f, - 0x011, 0x000203f9, - 0x010, 0x0003000f, - 0x011, 0x000ff500, - 0x010, 0x00000000, - 0x011, 0x00000000, - 0x010, 0x0008000f, - 0x011, 0x0003f100, - 0x010, 0x0009000f, - 0x011, 0x00023100, - 0x012, 0x000d8000, - 0x012, 0x00090000, - 0x012, 0x00051000, - 0x012, 0x00012000, - 0x013, 0x00028fb4, - 0x013, 0x00024fa8, - 0x013, 0x000207a4, - 0x013, 0x0001c798, - 0x013, 0x000183a4, - 0x013, 0x00014398, - 0x013, 0x000101a4, - 0x013, 0x0000c198, - 0x013, 0x000080a4, - 0x013, 0x00004098, - 0x013, 0x00000000, - 0x014, 0x0001944c, - 0x014, 0x00059444, - 0x014, 0x0009944c, - 0x014, 0x000d9444, - 0x015, 0x0000f405, - 0x015, 0x0004f405, - 0x015, 0x0008f405, - 0x015, 0x000cf405, - 0x016, 0x000e0330, - 0x016, 0x000a0330, - 0x016, 0x00060330, - 0x016, 0x00020330, - 0x000, 0x00010159, - 0x018, 0x0000f401, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01f, 0x00080003, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01e, 0x00044457, - 0x01f, 0x00080000, - 0x000, 0x00030159, -}; - -u32 Rtl8192CUAGCTAB_1T_HPArray[RTL8192CUAGCTAB_1T_HPArrayLength] = { - 0xc78, 0x7b000001, - 0xc78, 0x7b010001, - 0xc78, 0x7b020001, - 0xc78, 0x7b030001, - 0xc78, 0x7b040001, - 0xc78, 0x7b050001, - 0xc78, 0x7b060001, - 0xc78, 0x7b070001, - 0xc78, 0x7b080001, - 0xc78, 0x7a090001, - 0xc78, 0x790a0001, - 0xc78, 0x780b0001, - 0xc78, 0x770c0001, - 0xc78, 0x760d0001, - 0xc78, 0x750e0001, - 0xc78, 0x740f0001, - 0xc78, 0x73100001, - 0xc78, 0x72110001, - 0xc78, 0x71120001, - 0xc78, 0x70130001, - 0xc78, 0x6f140001, - 0xc78, 0x6e150001, - 0xc78, 0x6d160001, - 0xc78, 0x6c170001, - 0xc78, 0x6b180001, - 0xc78, 0x6a190001, - 0xc78, 0x691a0001, - 0xc78, 0x681b0001, - 0xc78, 0x671c0001, - 0xc78, 0x661d0001, - 0xc78, 0x651e0001, - 0xc78, 0x641f0001, - 0xc78, 0x63200001, - 0xc78, 0x62210001, - 0xc78, 0x61220001, - 0xc78, 0x60230001, - 0xc78, 0x46240001, - 0xc78, 0x45250001, - 0xc78, 0x44260001, - 0xc78, 0x43270001, - 0xc78, 0x42280001, - 0xc78, 0x41290001, - 0xc78, 0x402a0001, - 0xc78, 0x262b0001, - 0xc78, 0x252c0001, - 0xc78, 0x242d0001, - 0xc78, 0x232e0001, - 0xc78, 0x222f0001, - 0xc78, 0x21300001, - 0xc78, 0x20310001, - 0xc78, 0x06320001, - 0xc78, 0x05330001, - 0xc78, 0x04340001, - 0xc78, 0x03350001, - 0xc78, 0x02360001, - 0xc78, 0x01370001, - 0xc78, 0x00380001, - 0xc78, 0x00390001, - 0xc78, 0x003a0001, - 0xc78, 0x003b0001, - 0xc78, 0x003c0001, - 0xc78, 0x003d0001, - 0xc78, 0x003e0001, - 0xc78, 0x003f0001, - 0xc78, 0x7b400001, - 0xc78, 0x7b410001, - 0xc78, 0x7b420001, - 0xc78, 0x7b430001, - 0xc78, 0x7b440001, - 0xc78, 0x7b450001, - 0xc78, 0x7b460001, - 0xc78, 0x7b470001, - 0xc78, 0x7b480001, - 0xc78, 0x7a490001, - 0xc78, 0x794a0001, - 0xc78, 0x784b0001, - 0xc78, 0x774c0001, - 0xc78, 0x764d0001, - 0xc78, 0x754e0001, - 0xc78, 0x744f0001, - 0xc78, 0x73500001, - 0xc78, 0x72510001, - 0xc78, 0x71520001, - 0xc78, 0x70530001, - 0xc78, 0x6f540001, - 0xc78, 0x6e550001, - 0xc78, 0x6d560001, - 0xc78, 0x6c570001, - 0xc78, 0x6b580001, - 0xc78, 0x6a590001, - 0xc78, 0x695a0001, - 0xc78, 0x685b0001, - 0xc78, 0x675c0001, - 0xc78, 0x665d0001, - 0xc78, 0x655e0001, - 0xc78, 0x645f0001, - 0xc78, 0x63600001, - 0xc78, 0x62610001, - 0xc78, 0x61620001, - 0xc78, 0x60630001, - 0xc78, 0x46640001, - 0xc78, 0x45650001, - 0xc78, 0x44660001, - 0xc78, 0x43670001, - 0xc78, 0x42680001, - 0xc78, 0x41690001, - 0xc78, 0x406a0001, - 0xc78, 0x266b0001, - 0xc78, 0x256c0001, - 0xc78, 0x246d0001, - 0xc78, 0x236e0001, - 0xc78, 0x226f0001, - 0xc78, 0x21700001, - 0xc78, 0x20710001, - 0xc78, 0x06720001, - 0xc78, 0x05730001, - 0xc78, 0x04740001, - 0xc78, 0x03750001, - 0xc78, 0x02760001, - 0xc78, 0x01770001, - 0xc78, 0x00780001, - 0xc78, 0x00790001, - 0xc78, 0x007a0001, - 0xc78, 0x007b0001, - 0xc78, 0x007c0001, - 0xc78, 0x007d0001, - 0xc78, 0x007e0001, - 0xc78, 0x007f0001, - 0xc78, 0x3800001e, - 0xc78, 0x3801001e, - 0xc78, 0x3802001e, - 0xc78, 0x3803001e, - 0xc78, 0x3804001e, - 0xc78, 0x3805001e, - 0xc78, 0x3806001e, - 0xc78, 0x3807001e, - 0xc78, 0x3808001e, - 0xc78, 0x3c09001e, - 0xc78, 0x3e0a001e, - 0xc78, 0x400b001e, - 0xc78, 0x440c001e, - 0xc78, 0x480d001e, - 0xc78, 0x4c0e001e, - 0xc78, 0x500f001e, - 0xc78, 0x5210001e, - 0xc78, 0x5611001e, - 0xc78, 0x5a12001e, - 0xc78, 0x5e13001e, - 0xc78, 0x6014001e, - 0xc78, 0x6015001e, - 0xc78, 0x6016001e, - 0xc78, 0x6217001e, - 0xc78, 0x6218001e, - 0xc78, 0x6219001e, - 0xc78, 0x621a001e, - 0xc78, 0x621b001e, - 0xc78, 0x621c001e, - 0xc78, 0x621d001e, - 0xc78, 0x621e001e, - 0xc78, 0x621f001e, -}; diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/table.h b/drivers/net/wireless/rtlwifi/rtl8192cu/table.h deleted file mode 100644 index 4b020e9e30b1..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/table.h +++ /dev/null @@ -1,71 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CU_TABLE__H_ -#define __RTL92CU_TABLE__H_ - -#include - -#define RTL8192CUPHY_REG_2TARRAY_LENGTH 374 -extern u32 RTL8192CUPHY_REG_2TARRAY[RTL8192CUPHY_REG_2TARRAY_LENGTH]; -#define RTL8192CUPHY_REG_1TARRAY_LENGTH 374 -extern u32 RTL8192CUPHY_REG_1TARRAY[RTL8192CUPHY_REG_1TARRAY_LENGTH]; - -#define RTL8192CUPHY_REG_ARRAY_PGLENGTH 336 -extern u32 RTL8192CUPHY_REG_ARRAY_PG[RTL8192CUPHY_REG_ARRAY_PGLENGTH]; - -#define RTL8192CURADIOA_2TARRAYLENGTH 282 -extern u32 RTL8192CURADIOA_2TARRAY[RTL8192CURADIOA_2TARRAYLENGTH]; -#define RTL8192CURADIOB_2TARRAYLENGTH 78 -extern u32 RTL8192CU_RADIOB_2TARRAY[RTL8192CURADIOB_2TARRAYLENGTH]; -#define RTL8192CURADIOA_1TARRAYLENGTH 282 -extern u32 RTL8192CU_RADIOA_1TARRAY[RTL8192CURADIOA_1TARRAYLENGTH]; -#define RTL8192CURADIOB_1TARRAYLENGTH 1 -extern u32 RTL8192CU_RADIOB_1TARRAY[RTL8192CURADIOB_1TARRAYLENGTH]; - -#define RTL8192CUMAC_2T_ARRAYLENGTH 172 -extern u32 RTL8192CUMAC_2T_ARRAY[RTL8192CUMAC_2T_ARRAYLENGTH]; - -#define RTL8192CUAGCTAB_2TARRAYLENGTH 320 -extern u32 RTL8192CUAGCTAB_2TARRAY[RTL8192CUAGCTAB_2TARRAYLENGTH]; -#define RTL8192CUAGCTAB_1TARRAYLENGTH 320 -extern u32 RTL8192CUAGCTAB_1TARRAY[RTL8192CUAGCTAB_1TARRAYLENGTH]; - -#define RTL8192CUPHY_REG_1T_HPArrayLength 378 -extern u32 RTL8192CUPHY_REG_1T_HPArray[RTL8192CUPHY_REG_1T_HPArrayLength]; - -#define RTL8192CUPHY_REG_Array_PG_HPLength 336 -extern u32 RTL8192CUPHY_REG_Array_PG_HP[RTL8192CUPHY_REG_Array_PG_HPLength]; - -#define RTL8192CURadioA_1T_HPArrayLength 282 -extern u32 RTL8192CURadioA_1T_HPArray[RTL8192CURadioA_1T_HPArrayLength]; -#define RTL8192CUAGCTAB_1T_HPArrayLength 320 -extern u32 Rtl8192CUAGCTAB_1T_HPArray[RTL8192CUAGCTAB_1T_HPArrayLength]; - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c deleted file mode 100644 index 5c52a8ac314c..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +++ /dev/null @@ -1,689 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../usb.h" -#include "../ps.h" -#include "../base.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" -#include "mac.h" -#include "trx.h" - -static int _ConfigVerTOutEP(struct ieee80211_hw *hw) -{ - u8 ep_cfg, txqsele; - u8 ep_nums = 0; - - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_usb_priv *usb_priv = rtl_usbpriv(hw); - struct rtl_usb *rtlusb = rtl_usbdev(usb_priv); - - rtlusb->out_queue_sel = 0; - ep_cfg = rtl_read_byte(rtlpriv, REG_TEST_SIE_OPTIONAL); - ep_cfg = (ep_cfg & USB_TEST_EP_MASK) >> USB_TEST_EP_SHIFT; - switch (ep_cfg) { - case 0: /* 2 bulk OUT, 1 bulk IN */ - case 3: - rtlusb->out_queue_sel = TX_SELE_HQ | TX_SELE_LQ; - ep_nums = 2; - break; - case 1: /* 1 bulk IN/OUT => map all endpoint to Low queue */ - case 2: /* 1 bulk IN, 1 bulk OUT => map all endpoint to High queue */ - txqsele = rtl_read_byte(rtlpriv, REG_TEST_USB_TXQS); - if (txqsele & 0x0F) /* /map all endpoint to High queue */ - rtlusb->out_queue_sel = TX_SELE_HQ; - else if (txqsele&0xF0) /* map all endpoint to Low queue */ - rtlusb->out_queue_sel = TX_SELE_LQ; - ep_nums = 1; - break; - default: - break; - } - return (rtlusb->out_ep_nums == ep_nums) ? 0 : -EINVAL; -} - -static int _ConfigVerNOutEP(struct ieee80211_hw *hw) -{ - u8 ep_cfg; - u8 ep_nums = 0; - - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_usb_priv *usb_priv = rtl_usbpriv(hw); - struct rtl_usb *rtlusb = rtl_usbdev(usb_priv); - - rtlusb->out_queue_sel = 0; - /* Normal and High queue */ - ep_cfg = rtl_read_byte(rtlpriv, (REG_NORMAL_SIE_EP + 1)); - if (ep_cfg & USB_NORMAL_SIE_EP_MASK) { - rtlusb->out_queue_sel |= TX_SELE_HQ; - ep_nums++; - } - if ((ep_cfg >> USB_NORMAL_SIE_EP_SHIFT) & USB_NORMAL_SIE_EP_MASK) { - rtlusb->out_queue_sel |= TX_SELE_NQ; - ep_nums++; - } - /* Low queue */ - ep_cfg = rtl_read_byte(rtlpriv, (REG_NORMAL_SIE_EP + 2)); - if (ep_cfg & USB_NORMAL_SIE_EP_MASK) { - rtlusb->out_queue_sel |= TX_SELE_LQ; - ep_nums++; - } - return (rtlusb->out_ep_nums == ep_nums) ? 0 : -EINVAL; -} - -static void _TwoOutEpMapping(struct ieee80211_hw *hw, bool bIsChipB, - bool bwificfg, struct rtl_ep_map *ep_map) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (bwificfg) { /* for WMM */ - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "USB Chip-B & WMM Setting.....\n"); - ep_map->ep_mapping[RTL_TXQ_BE] = 2; - ep_map->ep_mapping[RTL_TXQ_BK] = 3; - ep_map->ep_mapping[RTL_TXQ_VI] = 3; - ep_map->ep_mapping[RTL_TXQ_VO] = 2; - ep_map->ep_mapping[RTL_TXQ_MGT] = 2; - ep_map->ep_mapping[RTL_TXQ_BCN] = 2; - ep_map->ep_mapping[RTL_TXQ_HI] = 2; - } else { /* typical setting */ - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "USB typical Setting.....\n"); - ep_map->ep_mapping[RTL_TXQ_BE] = 3; - ep_map->ep_mapping[RTL_TXQ_BK] = 3; - ep_map->ep_mapping[RTL_TXQ_VI] = 2; - ep_map->ep_mapping[RTL_TXQ_VO] = 2; - ep_map->ep_mapping[RTL_TXQ_MGT] = 2; - ep_map->ep_mapping[RTL_TXQ_BCN] = 2; - ep_map->ep_mapping[RTL_TXQ_HI] = 2; - } -} - -static void _ThreeOutEpMapping(struct ieee80211_hw *hw, bool bwificfg, - struct rtl_ep_map *ep_map) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - if (bwificfg) { /* for WMM */ - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "USB 3EP Setting for WMM.....\n"); - ep_map->ep_mapping[RTL_TXQ_BE] = 5; - ep_map->ep_mapping[RTL_TXQ_BK] = 3; - ep_map->ep_mapping[RTL_TXQ_VI] = 3; - ep_map->ep_mapping[RTL_TXQ_VO] = 2; - ep_map->ep_mapping[RTL_TXQ_MGT] = 2; - ep_map->ep_mapping[RTL_TXQ_BCN] = 2; - ep_map->ep_mapping[RTL_TXQ_HI] = 2; - } else { /* typical setting */ - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "USB 3EP Setting for typical.....\n"); - ep_map->ep_mapping[RTL_TXQ_BE] = 5; - ep_map->ep_mapping[RTL_TXQ_BK] = 5; - ep_map->ep_mapping[RTL_TXQ_VI] = 3; - ep_map->ep_mapping[RTL_TXQ_VO] = 2; - ep_map->ep_mapping[RTL_TXQ_MGT] = 2; - ep_map->ep_mapping[RTL_TXQ_BCN] = 2; - ep_map->ep_mapping[RTL_TXQ_HI] = 2; - } -} - -static void _OneOutEpMapping(struct ieee80211_hw *hw, struct rtl_ep_map *ep_map) -{ - ep_map->ep_mapping[RTL_TXQ_BE] = 2; - ep_map->ep_mapping[RTL_TXQ_BK] = 2; - ep_map->ep_mapping[RTL_TXQ_VI] = 2; - ep_map->ep_mapping[RTL_TXQ_VO] = 2; - ep_map->ep_mapping[RTL_TXQ_MGT] = 2; - ep_map->ep_mapping[RTL_TXQ_BCN] = 2; - ep_map->ep_mapping[RTL_TXQ_HI] = 2; -} -static int _out_ep_mapping(struct ieee80211_hw *hw) -{ - int err = 0; - bool bIsChipN, bwificfg = false; - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_usb_priv *usb_priv = rtl_usbpriv(hw); - struct rtl_usb *rtlusb = rtl_usbdev(usb_priv); - struct rtl_ep_map *ep_map = &(rtlusb->ep_map); - - bIsChipN = IS_NORMAL_CHIP(rtlhal->version); - switch (rtlusb->out_ep_nums) { - case 2: - _TwoOutEpMapping(hw, bIsChipN, bwificfg, ep_map); - break; - case 3: - /* Test chip doesn't support three out EPs. */ - if (!bIsChipN) { - err = -EINVAL; - goto err_out; - } - _ThreeOutEpMapping(hw, bIsChipN, ep_map); - break; - case 1: - _OneOutEpMapping(hw, ep_map); - break; - default: - err = -EINVAL; - break; - } -err_out: - return err; - -} -/* endpoint mapping */ -int rtl8192cu_endpoint_mapping(struct ieee80211_hw *hw) -{ - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - int error = 0; - if (likely(IS_NORMAL_CHIP(rtlhal->version))) - error = _ConfigVerNOutEP(hw); - else - error = _ConfigVerTOutEP(hw); - if (error) - goto err_out; - error = _out_ep_mapping(hw); - if (error) - goto err_out; -err_out: - return error; -} - -u16 rtl8192cu_mq_to_hwq(__le16 fc, u16 mac80211_queue_index) -{ - u16 hw_queue_index; - - if (unlikely(ieee80211_is_beacon(fc))) { - hw_queue_index = RTL_TXQ_BCN; - goto out; - } - if (ieee80211_is_mgmt(fc)) { - hw_queue_index = RTL_TXQ_MGT; - goto out; - } - switch (mac80211_queue_index) { - case 0: - hw_queue_index = RTL_TXQ_VO; - break; - case 1: - hw_queue_index = RTL_TXQ_VI; - break; - case 2: - hw_queue_index = RTL_TXQ_BE; - break; - case 3: - hw_queue_index = RTL_TXQ_BK; - break; - default: - hw_queue_index = RTL_TXQ_BE; - RT_ASSERT(false, "QSLT_BE queue, skb_queue:%d\n", - mac80211_queue_index); - break; - } -out: - return hw_queue_index; -} - -static enum rtl_desc_qsel _rtl8192cu_mq_to_descq(struct ieee80211_hw *hw, - __le16 fc, u16 mac80211_queue_index) -{ - enum rtl_desc_qsel qsel; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (unlikely(ieee80211_is_beacon(fc))) { - qsel = QSLT_BEACON; - goto out; - } - if (ieee80211_is_mgmt(fc)) { - qsel = QSLT_MGNT; - goto out; - } - switch (mac80211_queue_index) { - case 0: /* VO */ - qsel = QSLT_VO; - RT_TRACE(rtlpriv, COMP_USB, DBG_DMESG, - "VO queue, set qsel = 0x%x\n", QSLT_VO); - break; - case 1: /* VI */ - qsel = QSLT_VI; - RT_TRACE(rtlpriv, COMP_USB, DBG_DMESG, - "VI queue, set qsel = 0x%x\n", QSLT_VI); - break; - case 3: /* BK */ - qsel = QSLT_BK; - RT_TRACE(rtlpriv, COMP_USB, DBG_DMESG, - "BK queue, set qsel = 0x%x\n", QSLT_BK); - break; - case 2: /* BE */ - default: - qsel = QSLT_BE; - RT_TRACE(rtlpriv, COMP_USB, DBG_DMESG, - "BE queue, set qsel = 0x%x\n", QSLT_BE); - break; - } -out: - return qsel; -} - -/* =============================================================== */ - -/*---------------------------------------------------------------------- - * - * Rx handler - * - *---------------------------------------------------------------------- */ -bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw, - struct rtl_stats *stats, - struct ieee80211_rx_status *rx_status, - u8 *pdesc, struct sk_buff *skb) -{ - struct rx_fwinfo_92c *p_drvinfo; - struct rx_desc_92c *p_desc = (struct rx_desc_92c *)pdesc; - u32 phystatus = GET_RX_DESC_PHY_STATUS(pdesc); - - stats->length = (u16) GET_RX_DESC_PKT_LEN(pdesc); - stats->rx_drvinfo_size = (u8)GET_RX_DESC_DRVINFO_SIZE(pdesc) * - RX_DRV_INFO_SIZE_UNIT; - stats->rx_bufshift = (u8) (GET_RX_DESC_SHIFT(pdesc) & 0x03); - stats->icv = (u16) GET_RX_DESC_ICV(pdesc); - stats->crc = (u16) GET_RX_DESC_CRC32(pdesc); - stats->hwerror = (stats->crc | stats->icv); - stats->decrypted = !GET_RX_DESC_SWDEC(pdesc); - stats->rate = (u8) GET_RX_DESC_RX_MCS(pdesc); - stats->shortpreamble = (u16) GET_RX_DESC_SPLCP(pdesc); - stats->isampdu = (bool) (GET_RX_DESC_PAGGR(pdesc) == 1); - stats->isampdu = (bool) ((GET_RX_DESC_PAGGR(pdesc) == 1) - && (GET_RX_DESC_FAGGR(pdesc) == 1)); - stats->timestamp_low = GET_RX_DESC_TSFL(pdesc); - stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); - rx_status->freq = hw->conf.chandef.chan->center_freq; - rx_status->band = hw->conf.chandef.chan->band; - if (GET_RX_DESC_CRC32(pdesc)) - rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; - if (!GET_RX_DESC_SWDEC(pdesc)) - rx_status->flag |= RX_FLAG_DECRYPTED; - if (GET_RX_DESC_BW(pdesc)) - rx_status->flag |= RX_FLAG_40MHZ; - if (GET_RX_DESC_RX_HT(pdesc)) - rx_status->flag |= RX_FLAG_HT; - rx_status->flag |= RX_FLAG_MACTIME_START; - if (stats->decrypted) - rx_status->flag |= RX_FLAG_DECRYPTED; - rx_status->rate_idx = rtlwifi_rate_mapping(hw, - (bool)GET_RX_DESC_RX_HT(pdesc), - (u8)GET_RX_DESC_RX_MCS(pdesc), - (bool)GET_RX_DESC_PAGGR(pdesc)); - rx_status->mactime = GET_RX_DESC_TSFL(pdesc); - if (phystatus) { - p_drvinfo = (struct rx_fwinfo_92c *)(skb->data + - stats->rx_bufshift); - rtl92c_translate_rx_signal_stuff(hw, skb, stats, p_desc, - p_drvinfo); - } - /*rx_status->qual = stats->signal; */ - rx_status->signal = stats->recvsignalpower + 10; - /*rx_status->noise = -stats->noise; */ - return true; -} - -#define RTL_RX_DRV_INFO_UNIT 8 - -static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) -{ - struct ieee80211_rx_status *rx_status = - (struct ieee80211_rx_status *)IEEE80211_SKB_RXCB(skb); - u32 skb_len, pkt_len, drvinfo_len; - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 *rxdesc; - struct rtl_stats stats = { - .signal = 0, - .noise = -98, - .rate = 0, - }; - struct rx_fwinfo_92c *p_drvinfo; - bool bv; - __le16 fc; - struct ieee80211_hdr *hdr; - - memset(rx_status, 0, sizeof(*rx_status)); - rxdesc = skb->data; - skb_len = skb->len; - drvinfo_len = (GET_RX_DESC_DRVINFO_SIZE(rxdesc) * RTL_RX_DRV_INFO_UNIT); - pkt_len = GET_RX_DESC_PKT_LEN(rxdesc); - /* TODO: Error recovery. drop this skb or something. */ - WARN_ON(skb_len < (pkt_len + RTL_RX_DESC_SIZE + drvinfo_len)); - stats.length = (u16) GET_RX_DESC_PKT_LEN(rxdesc); - stats.rx_drvinfo_size = (u8)GET_RX_DESC_DRVINFO_SIZE(rxdesc) * - RX_DRV_INFO_SIZE_UNIT; - stats.rx_bufshift = (u8) (GET_RX_DESC_SHIFT(rxdesc) & 0x03); - stats.icv = (u16) GET_RX_DESC_ICV(rxdesc); - stats.crc = (u16) GET_RX_DESC_CRC32(rxdesc); - stats.hwerror = (stats.crc | stats.icv); - stats.decrypted = !GET_RX_DESC_SWDEC(rxdesc); - stats.rate = (u8) GET_RX_DESC_RX_MCS(rxdesc); - stats.shortpreamble = (u16) GET_RX_DESC_SPLCP(rxdesc); - stats.isampdu = (bool) ((GET_RX_DESC_PAGGR(rxdesc) == 1) - && (GET_RX_DESC_FAGGR(rxdesc) == 1)); - stats.timestamp_low = GET_RX_DESC_TSFL(rxdesc); - stats.rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(rxdesc); - /* TODO: is center_freq changed when doing scan? */ - /* TODO: Shall we add protection or just skip those two step? */ - rx_status->freq = hw->conf.chandef.chan->center_freq; - rx_status->band = hw->conf.chandef.chan->band; - if (GET_RX_DESC_CRC32(rxdesc)) - rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; - if (!GET_RX_DESC_SWDEC(rxdesc)) - rx_status->flag |= RX_FLAG_DECRYPTED; - if (GET_RX_DESC_BW(rxdesc)) - rx_status->flag |= RX_FLAG_40MHZ; - if (GET_RX_DESC_RX_HT(rxdesc)) - rx_status->flag |= RX_FLAG_HT; - /* Data rate */ - rx_status->rate_idx = rtlwifi_rate_mapping(hw, - (bool)GET_RX_DESC_RX_HT(rxdesc), - (u8)GET_RX_DESC_RX_MCS(rxdesc), - (bool)GET_RX_DESC_PAGGR(rxdesc)); - /* There is a phy status after this rx descriptor. */ - if (GET_RX_DESC_PHY_STATUS(rxdesc)) { - p_drvinfo = (struct rx_fwinfo_92c *)(rxdesc + RTL_RX_DESC_SIZE); - rtl92c_translate_rx_signal_stuff(hw, skb, &stats, - (struct rx_desc_92c *)rxdesc, p_drvinfo); - } - skb_pull(skb, (drvinfo_len + RTL_RX_DESC_SIZE)); - hdr = (struct ieee80211_hdr *)(skb->data); - fc = hdr->frame_control; - bv = ieee80211_is_probe_resp(fc); - if (bv) - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "Got probe response frame\n"); - if (ieee80211_is_beacon(fc)) - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Got beacon frame\n"); - if (ieee80211_is_data(fc)) - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Got data frame\n"); - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "Fram: fc = 0x%X addr1 = 0x%02X:0x%02X:0x%02X:0x%02X:0x%02X:0x%02X\n", - fc, - (u32)hdr->addr1[0], (u32)hdr->addr1[1], - (u32)hdr->addr1[2], (u32)hdr->addr1[3], - (u32)hdr->addr1[4], (u32)hdr->addr1[5]); - memcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status)); - ieee80211_rx(hw, skb); -} - -void rtl8192cu_rx_hdl(struct ieee80211_hw *hw, struct sk_buff * skb) -{ - _rtl_rx_process(hw, skb); -} - -void rtl8192c_rx_segregate_hdl( - struct ieee80211_hw *hw, - struct sk_buff *skb, - struct sk_buff_head *skb_list) -{ -} - -/*---------------------------------------------------------------------- - * - * Tx handler - * - *---------------------------------------------------------------------- */ -void rtl8192c_tx_cleanup(struct ieee80211_hw *hw, struct sk_buff *skb) -{ -} - -int rtl8192c_tx_post_hdl(struct ieee80211_hw *hw, struct urb *urb, - struct sk_buff *skb) -{ - return 0; -} - -struct sk_buff *rtl8192c_tx_aggregate_hdl(struct ieee80211_hw *hw, - struct sk_buff_head *list) -{ - return skb_dequeue(list); -} - -/*======================================== trx ===============================*/ - -static void _rtl_fill_usb_tx_desc(u8 *txdesc) -{ - SET_TX_DESC_OWN(txdesc, 1); - SET_TX_DESC_LAST_SEG(txdesc, 1); - SET_TX_DESC_FIRST_SEG(txdesc, 1); -} -/** - * For HW recovery information - */ -static void _rtl_tx_desc_checksum(u8 *txdesc) -{ - u16 *ptr = (u16 *)txdesc; - u16 checksum = 0; - u32 index; - - /* Clear first */ - SET_TX_DESC_TX_DESC_CHECKSUM(txdesc, 0); - for (index = 0; index < 16; index++) - checksum = checksum ^ (*(ptr + index)); - SET_TX_DESC_TX_DESC_CHECKSUM(txdesc, checksum); -} - -void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, - u8 queue_index, - struct rtl_tcb_desc *tcb_desc) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool defaultadapter = true; - u8 *qc = ieee80211_get_qos_ctl(hdr); - u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; - u16 seq_number; - __le16 fc = hdr->frame_control; - u8 rate_flag = info->control.rates[0].flags; - u16 pktlen = skb->len; - enum rtl_desc_qsel fw_qsel = _rtl8192cu_mq_to_descq(hw, fc, - skb_get_queue_mapping(skb)); - u8 *txdesc; - - seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4; - rtl_get_tcb_desc(hw, info, sta, skb, tcb_desc); - txdesc = (u8 *)skb_push(skb, RTL_TX_HEADER_SIZE); - memset(txdesc, 0, RTL_TX_HEADER_SIZE); - SET_TX_DESC_PKT_SIZE(txdesc, pktlen); - SET_TX_DESC_LINIP(txdesc, 0); - SET_TX_DESC_PKT_OFFSET(txdesc, RTL_DUMMY_OFFSET); - SET_TX_DESC_OFFSET(txdesc, RTL_TX_HEADER_SIZE); - SET_TX_DESC_TX_RATE(txdesc, tcb_desc->hw_rate); - if (tcb_desc->use_shortgi || tcb_desc->use_shortpreamble) - SET_TX_DESC_DATA_SHORTGI(txdesc, 1); - if (mac->tids[tid].agg.agg_state == RTL_AGG_ON && - info->flags & IEEE80211_TX_CTL_AMPDU) { - SET_TX_DESC_AGG_ENABLE(txdesc, 1); - SET_TX_DESC_MAX_AGG_NUM(txdesc, 0x14); - } else { - SET_TX_DESC_AGG_BREAK(txdesc, 1); - } - SET_TX_DESC_SEQ(txdesc, seq_number); - SET_TX_DESC_RTS_ENABLE(txdesc, ((tcb_desc->rts_enable && - !tcb_desc->cts_enable) ? 1 : 0)); - SET_TX_DESC_HW_RTS_ENABLE(txdesc, ((tcb_desc->rts_enable || - tcb_desc->cts_enable) ? 1 : 0)); - SET_TX_DESC_CTS2SELF(txdesc, ((tcb_desc->cts_enable) ? 1 : 0)); - SET_TX_DESC_RTS_STBC(txdesc, ((tcb_desc->rts_stbc) ? 1 : 0)); - SET_TX_DESC_RTS_RATE(txdesc, tcb_desc->rts_rate); - SET_TX_DESC_RTS_BW(txdesc, 0); - SET_TX_DESC_RTS_SC(txdesc, tcb_desc->rts_sc); - SET_TX_DESC_RTS_SHORT(txdesc, - ((tcb_desc->rts_rate <= DESC92_RATE54M) ? - (tcb_desc->rts_use_shortpreamble ? 1 : 0) - : (tcb_desc->rts_use_shortgi ? 1 : 0))); - if (mac->bw_40) { - if (rate_flag & IEEE80211_TX_RC_DUP_DATA) { - SET_TX_DESC_DATA_BW(txdesc, 1); - SET_TX_DESC_DATA_SC(txdesc, 3); - } else if(rate_flag & IEEE80211_TX_RC_40_MHZ_WIDTH){ - SET_TX_DESC_DATA_BW(txdesc, 1); - SET_TX_DESC_DATA_SC(txdesc, mac->cur_40_prime_sc); - } else { - SET_TX_DESC_DATA_BW(txdesc, 0); - SET_TX_DESC_DATA_SC(txdesc, 0); - } - } else { - SET_TX_DESC_DATA_BW(txdesc, 0); - SET_TX_DESC_DATA_SC(txdesc, 0); - } - rcu_read_lock(); - sta = ieee80211_find_sta(mac->vif, mac->bssid); - if (sta) { - u8 ampdu_density = sta->ht_cap.ampdu_density; - SET_TX_DESC_AMPDU_DENSITY(txdesc, ampdu_density); - } - rcu_read_unlock(); - if (info->control.hw_key) { - struct ieee80211_key_conf *keyconf = info->control.hw_key; - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - case WLAN_CIPHER_SUITE_TKIP: - SET_TX_DESC_SEC_TYPE(txdesc, 0x1); - break; - case WLAN_CIPHER_SUITE_CCMP: - SET_TX_DESC_SEC_TYPE(txdesc, 0x3); - break; - default: - SET_TX_DESC_SEC_TYPE(txdesc, 0x0); - break; - } - } - SET_TX_DESC_PKT_ID(txdesc, 0); - SET_TX_DESC_QUEUE_SEL(txdesc, fw_qsel); - SET_TX_DESC_DATA_RATE_FB_LIMIT(txdesc, 0x1F); - SET_TX_DESC_RTS_RATE_FB_LIMIT(txdesc, 0xF); - SET_TX_DESC_DISABLE_FB(txdesc, 0); - SET_TX_DESC_USE_RATE(txdesc, tcb_desc->use_driver_rate ? 1 : 0); - if (ieee80211_is_data_qos(fc)) { - if (mac->rdg_en) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "Enable RDG function\n"); - SET_TX_DESC_RDG_ENABLE(txdesc, 1); - SET_TX_DESC_HTC(txdesc, 1); - } - } - if (rtlpriv->dm.useramask) { - SET_TX_DESC_RATE_ID(txdesc, tcb_desc->ratr_index); - SET_TX_DESC_MACID(txdesc, tcb_desc->mac_id); - } else { - SET_TX_DESC_RATE_ID(txdesc, 0xC + tcb_desc->ratr_index); - SET_TX_DESC_MACID(txdesc, tcb_desc->ratr_index); - } - if ((!ieee80211_is_data_qos(fc)) && ppsc->leisure_ps && - ppsc->fwctrl_lps) { - SET_TX_DESC_HWSEQ_EN(txdesc, 1); - SET_TX_DESC_PKT_ID(txdesc, 8); - if (!defaultadapter) - SET_TX_DESC_QOS(txdesc, 1); - } - if (ieee80211_has_morefrags(fc)) - SET_TX_DESC_MORE_FRAG(txdesc, 1); - if (is_multicast_ether_addr(ieee80211_get_DA(hdr)) || - is_broadcast_ether_addr(ieee80211_get_DA(hdr))) - SET_TX_DESC_BMC(txdesc, 1); - _rtl_fill_usb_tx_desc(txdesc); - _rtl_tx_desc_checksum(txdesc); - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "==>\n"); -} - -void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 * pDesc, - u32 buffer_len, bool bIsPsPoll) -{ - /* Clear all status */ - memset(pDesc, 0, RTL_TX_HEADER_SIZE); - SET_TX_DESC_FIRST_SEG(pDesc, 1); /* bFirstSeg; */ - SET_TX_DESC_LAST_SEG(pDesc, 1); /* bLastSeg; */ - SET_TX_DESC_OFFSET(pDesc, RTL_TX_HEADER_SIZE); /* Offset = 32 */ - SET_TX_DESC_PKT_SIZE(pDesc, buffer_len); /* Buffer size + command hdr */ - SET_TX_DESC_QUEUE_SEL(pDesc, QSLT_MGNT); /* Fixed queue of Mgnt queue */ - /* Set NAVUSEHDR to prevent Ps-poll AId filed to be changed to error - * vlaue by Hw. */ - if (bIsPsPoll) { - SET_TX_DESC_NAV_USE_HDR(pDesc, 1); - } else { - SET_TX_DESC_HWSEQ_EN(pDesc, 1); /* Hw set sequence number */ - SET_TX_DESC_PKT_ID(pDesc, 0x100); /* set bit3 to 1. */ - } - SET_TX_DESC_USE_RATE(pDesc, 1); /* use data rate which is set by Sw */ - SET_TX_DESC_OWN(pDesc, 1); - SET_TX_DESC_TX_RATE(pDesc, DESC92_RATE1M); - _rtl_tx_desc_checksum(pDesc); -} - -void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw, - u8 *pdesc, bool firstseg, - bool lastseg, struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 fw_queue = QSLT_BEACON; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); - __le16 fc = hdr->frame_control; - - memset((void *)pdesc, 0, RTL_TX_HEADER_SIZE); - if (firstseg) - SET_TX_DESC_OFFSET(pdesc, RTL_TX_HEADER_SIZE); - SET_TX_DESC_TX_RATE(pdesc, DESC92_RATE1M); - SET_TX_DESC_SEQ(pdesc, 0); - SET_TX_DESC_LINIP(pdesc, 0); - SET_TX_DESC_QUEUE_SEL(pdesc, fw_queue); - SET_TX_DESC_FIRST_SEG(pdesc, 1); - SET_TX_DESC_LAST_SEG(pdesc, 1); - SET_TX_DESC_RATE_ID(pdesc, 7); - SET_TX_DESC_MACID(pdesc, 0); - SET_TX_DESC_OWN(pdesc, 1); - SET_TX_DESC_PKT_SIZE(pdesc, (u16)skb->len); - SET_TX_DESC_FIRST_SEG(pdesc, 1); - SET_TX_DESC_LAST_SEG(pdesc, 1); - SET_TX_DESC_OFFSET(pdesc, 0x20); - SET_TX_DESC_USE_RATE(pdesc, 1); - if (!ieee80211_is_data_qos(fc)) { - SET_TX_DESC_HWSEQ_EN(pdesc, 1); - SET_TX_DESC_PKT_ID(pdesc, 8); - } - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, "H2C Tx Cmd Content", - pdesc, RTL_TX_DESC_SIZE); -} - -bool rtl92cu_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb) -{ - return true; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h deleted file mode 100644 index 725c53accc58..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h +++ /dev/null @@ -1,435 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CU_TRX_H__ -#define __RTL92CU_TRX_H__ - -#define RTL92C_USB_BULK_IN_NUM 1 -#define RTL92C_NUM_RX_URBS 8 -#define RTL92C_NUM_TX_URBS 32 - -#define RTL92C_SIZE_MAX_RX_BUFFER 15360 /* 8192 */ -#define RX_DRV_INFO_SIZE_UNIT 8 - -#define RTL_AGG_ON 1 - -enum usb_rx_agg_mode { - USB_RX_AGG_DISABLE, - USB_RX_AGG_DMA, - USB_RX_AGG_USB, - USB_RX_AGG_DMA_USB -}; - -#define TX_SELE_HQ BIT(0) /* High Queue */ -#define TX_SELE_LQ BIT(1) /* Low Queue */ -#define TX_SELE_NQ BIT(2) /* Normal Queue */ - -#define RTL_USB_TX_AGG_NUM_DESC 5 - -#define RTL_USB_RX_AGG_PAGE_NUM 4 -#define RTL_USB_RX_AGG_PAGE_TIMEOUT 3 - -#define RTL_USB_RX_AGG_BLOCK_NUM 5 -#define RTL_USB_RX_AGG_BLOCK_TIMEOUT 3 - -/*======================== rx status =========================================*/ - -struct rx_drv_info_92c { - /* - * Driver info contain PHY status and other variabel size info - * PHY Status content as below - */ - - /* DWORD 0 */ - u8 gain_trsw[4]; - - /* DWORD 1 */ - u8 pwdb_all; - u8 cfosho[4]; - - /* DWORD 2 */ - u8 cfotail[4]; - - /* DWORD 3 */ - s8 rxevm[2]; - s8 rxsnr[4]; - - /* DWORD 4 */ - u8 pdsnr[2]; - - /* DWORD 5 */ - u8 csi_current[2]; - u8 csi_target[2]; - - /* DWORD 6 */ - u8 sigevm; - u8 max_ex_pwr; - u8 ex_intf_flag:1; - u8 sgi_en:1; - u8 rxsc:2; - u8 reserve:4; -} __packed; - -/* Define a macro that takes a le32 word, converts it to host ordering, - * right shifts by a specified count, creates a mask of the specified - * bit count, and extracts that number of bits. - */ - -#define SHIFT_AND_MASK_LE(__pdesc, __shift, __bits) \ - ((le32_to_cpu(*(((__le32 *)(__pdesc)))) >> (__shift)) & \ - BIT_LEN_MASK_32(__bits)) - -/* Define a macro that clears a bit field in an le32 word and - * sets the specified value into that bit field. The resulting - * value remains in le32 ordering; however, it is properly converted - * to host ordering for the clear and set operations before conversion - * back to le32. - */ - -#define SET_BITS_OFFSET_LE(__pdesc, __shift, __len, __val) \ - (*(__le32 *)(__pdesc) = \ - (cpu_to_le32((le32_to_cpu(*((__le32 *)(__pdesc))) & \ - (~(BIT_OFFSET_LEN_MASK_32((__shift), __len)))) | \ - (((u32)(__val) & BIT_LEN_MASK_32(__len)) << (__shift))))); - -/* macros to read various fields in RX descriptor */ - -/* DWORD 0 */ -#define GET_RX_DESC_PKT_LEN(__rxdesc) \ - SHIFT_AND_MASK_LE((__rxdesc), 0, 14) -#define GET_RX_DESC_CRC32(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc, 14, 1) -#define GET_RX_DESC_ICV(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc, 15, 1) -#define GET_RX_DESC_DRVINFO_SIZE(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc, 16, 4) -#define GET_RX_DESC_SECURITY(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc, 20, 3) -#define GET_RX_DESC_QOS(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc, 23, 1) -#define GET_RX_DESC_SHIFT(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc, 24, 2) -#define GET_RX_DESC_PHY_STATUS(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc, 26, 1) -#define GET_RX_DESC_SWDEC(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc, 27, 1) -#define GET_RX_DESC_LAST_SEG(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc, 28, 1) -#define GET_RX_DESC_FIRST_SEG(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc, 29, 1) -#define GET_RX_DESC_EOR(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc, 30, 1) -#define GET_RX_DESC_OWN(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc, 31, 1) - -/* DWORD 1 */ -#define GET_RX_DESC_MACID(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+4, 0, 5) -#define GET_RX_DESC_TID(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+4, 5, 4) -#define GET_RX_DESC_PAGGR(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+4, 14, 1) -#define GET_RX_DESC_FAGGR(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+4, 15, 1) -#define GET_RX_DESC_A1_FIT(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+4, 16, 4) -#define GET_RX_DESC_A2_FIT(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+4, 20, 4) -#define GET_RX_DESC_PAM(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+4, 24, 1) -#define GET_RX_DESC_PWR(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+4, 25, 1) -#define GET_RX_DESC_MORE_DATA(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+4, 26, 1) -#define GET_RX_DESC_MORE_FRAG(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+4, 27, 1) -#define GET_RX_DESC_TYPE(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+4, 28, 2) -#define GET_RX_DESC_MC(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+4, 30, 1) -#define GET_RX_DESC_BC(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+4, 31, 1) - -/* DWORD 2 */ -#define GET_RX_DESC_SEQ(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+8, 0, 12) -#define GET_RX_DESC_FRAG(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+8, 12, 4) -#define GET_RX_DESC_USB_AGG_PKTNUM(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+8, 16, 8) -#define GET_RX_DESC_NEXT_IND(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+8, 30, 1) - -/* DWORD 3 */ -#define GET_RX_DESC_RX_MCS(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+12, 0, 6) -#define GET_RX_DESC_RX_HT(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+12, 6, 1) -#define GET_RX_DESC_AMSDU(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+12, 7, 1) -#define GET_RX_DESC_SPLCP(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+12, 8, 1) -#define GET_RX_DESC_BW(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+12, 9, 1) -#define GET_RX_DESC_HTC(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+12, 10, 1) -#define GET_RX_DESC_TCP_CHK_RPT(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+12, 11, 1) -#define GET_RX_DESC_IP_CHK_RPT(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+12, 12, 1) -#define GET_RX_DESC_TCP_CHK_VALID(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+12, 13, 1) -#define GET_RX_DESC_HWPC_ERR(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+12, 14, 1) -#define GET_RX_DESC_HWPC_IND(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+12, 15, 1) -#define GET_RX_DESC_IV0(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+12, 16, 16) - -/* DWORD 4 */ -#define GET_RX_DESC_IV1(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+16, 0, 32) - -/* DWORD 5 */ -#define GET_RX_DESC_TSFL(__rxdesc) \ - SHIFT_AND_MASK_LE(__rxdesc+20, 0, 32) - -/*======================= tx desc ============================================*/ - -/* macros to set various fields in TX descriptor */ - -/* Dword 0 */ -#define SET_TX_DESC_PKT_SIZE(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc, 0, 16, __value) -#define SET_TX_DESC_OFFSET(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc, 16, 8, __value) -#define SET_TX_DESC_BMC(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc, 24, 1, __value) -#define SET_TX_DESC_HTC(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc, 25, 1, __value) -#define SET_TX_DESC_LAST_SEG(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc, 26, 1, __value) -#define SET_TX_DESC_FIRST_SEG(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc, 27, 1, __value) -#define SET_TX_DESC_LINIP(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc, 28, 1, __value) -#define SET_TX_DESC_NO_ACM(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc, 29, 1, __value) -#define SET_TX_DESC_GF(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc, 30, 1, __value) -#define SET_TX_DESC_OWN(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc, 31, 1, __value) - - -/* Dword 1 */ -#define SET_TX_DESC_MACID(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+4, 0, 5, __value) -#define SET_TX_DESC_AGG_ENABLE(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+4, 5, 1, __value) -#define SET_TX_DESC_AGG_BREAK(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+4, 6, 1, __value) -#define SET_TX_DESC_RDG_ENABLE(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+4, 7, 1, __value) -#define SET_TX_DESC_QUEUE_SEL(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+4, 8, 5, __value) -#define SET_TX_DESC_RDG_NAV_EXT(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+4, 13, 1, __value) -#define SET_TX_DESC_LSIG_TXOP_EN(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+4, 14, 1, __value) -#define SET_TX_DESC_PIFS(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+4, 15, 1, __value) -#define SET_TX_DESC_RATE_ID(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+4, 16, 4, __value) -#define SET_TX_DESC_RA_BRSR_ID(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+4, 16, 4, __value) -#define SET_TX_DESC_NAV_USE_HDR(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+4, 20, 1, __value) -#define SET_TX_DESC_EN_DESC_ID(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+4, 21, 1, __value) -#define SET_TX_DESC_SEC_TYPE(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+4, 22, 2, __value) -#define SET_TX_DESC_PKT_OFFSET(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+4, 26, 5, __value) - -/* Dword 2 */ -#define SET_TX_DESC_RTS_RC(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+8, 0, 6, __value) -#define SET_TX_DESC_DATA_RC(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+8, 6, 6, __value) -#define SET_TX_DESC_BAR_RTY_TH(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+8, 14, 2, __value) -#define SET_TX_DESC_MORE_FRAG(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+8, 17, 1, __value) -#define SET_TX_DESC_RAW(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+8, 18, 1, __value) -#define SET_TX_DESC_CCX(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+8, 19, 1, __value) -#define SET_TX_DESC_AMPDU_DENSITY(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+8, 20, 3, __value) -#define SET_TX_DESC_ANTSEL_A(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+8, 24, 1, __value) -#define SET_TX_DESC_ANTSEL_B(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+8, 25, 1, __value) -#define SET_TX_DESC_TX_ANT_CCK(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+8, 26, 2, __value) -#define SET_TX_DESC_TX_ANTL(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+8, 28, 2, __value) -#define SET_TX_DESC_TX_ANT_HT(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+8, 30, 2, __value) - -/* Dword 3 */ -#define SET_TX_DESC_NEXT_HEAP_PAGE(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+12, 0, 8, __value) -#define SET_TX_DESC_TAIL_PAGE(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+12, 8, 8, __value) -#define SET_TX_DESC_SEQ(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+12, 16, 12, __value) -#define SET_TX_DESC_PKT_ID(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+12, 28, 4, __value) - -/* Dword 4 */ -#define SET_TX_DESC_RTS_RATE(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 0, 5, __value) -#define SET_TX_DESC_AP_DCFE(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 5, 1, __value) -#define SET_TX_DESC_QOS(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 6, 1, __value) -#define SET_TX_DESC_HWSEQ_EN(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 7, 1, __value) -#define SET_TX_DESC_USE_RATE(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 8, 1, __value) -#define SET_TX_DESC_DISABLE_RTS_FB(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 9, 1, __value) -#define SET_TX_DESC_DISABLE_FB(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 10, 1, __value) -#define SET_TX_DESC_CTS2SELF(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 11, 1, __value) -#define SET_TX_DESC_RTS_ENABLE(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 12, 1, __value) -#define SET_TX_DESC_HW_RTS_ENABLE(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 13, 1, __value) -#define SET_TX_DESC_WAIT_DCTS(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 18, 1, __value) -#define SET_TX_DESC_CTS2AP_EN(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 19, 1, __value) -#define SET_TX_DESC_DATA_SC(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 20, 2, __value) -#define SET_TX_DESC_DATA_STBC(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 22, 2, __value) -#define SET_TX_DESC_DATA_SHORT(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 24, 1, __value) -#define SET_TX_DESC_DATA_BW(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 25, 1, __value) -#define SET_TX_DESC_RTS_SHORT(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 26, 1, __value) -#define SET_TX_DESC_RTS_BW(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 27, 1, __value) -#define SET_TX_DESC_RTS_SC(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 28, 2, __value) -#define SET_TX_DESC_RTS_STBC(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+16, 30, 2, __value) - -/* Dword 5 */ -#define SET_TX_DESC_TX_RATE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 0, 6, __val) -#define SET_TX_DESC_DATA_SHORTGI(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 6, 1, __val) -#define SET_TX_DESC_CCX_TAG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 7, 1, __val) -#define SET_TX_DESC_DATA_RATE_FB_LIMIT(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+20, 8, 5, __value) -#define SET_TX_DESC_RTS_RATE_FB_LIMIT(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+20, 13, 4, __value) -#define SET_TX_DESC_RETRY_LIMIT_ENABLE(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+20, 17, 1, __value) -#define SET_TX_DESC_DATA_RETRY_LIMIT(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+20, 18, 6, __value) -#define SET_TX_DESC_USB_TXAGG_NUM(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+20, 24, 8, __value) - -/* Dword 6 */ -#define SET_TX_DESC_TXAGC_A(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+24, 0, 5, __value) -#define SET_TX_DESC_TXAGC_B(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+24, 5, 5, __value) -#define SET_TX_DESC_USB_MAX_LEN(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+24, 10, 1, __value) -#define SET_TX_DESC_MAX_AGG_NUM(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+24, 11, 5, __value) -#define SET_TX_DESC_MCSG1_MAX_LEN(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+24, 16, 4, __value) -#define SET_TX_DESC_MCSG2_MAX_LEN(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+24, 20, 4, __value) -#define SET_TX_DESC_MCSG3_MAX_LEN(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+24, 24, 4, __value) -#define SET_TX_DESC_MCSG7_MAX_LEN(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+24, 28, 4, __value) - -/* Dword 7 */ -#define SET_TX_DESC_TX_DESC_CHECKSUM(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+28, 0, 16, __value) -#define SET_TX_DESC_MCSG4_MAX_LEN(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+28, 16, 4, __value) -#define SET_TX_DESC_MCSG5_MAX_LEN(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+28, 20, 4, __value) -#define SET_TX_DESC_MCSG6_MAX_LEN(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+28, 24, 4, __value) -#define SET_TX_DESC_MCSG15_MAX_LEN(__txdesc, __value) \ - SET_BITS_OFFSET_LE(__txdesc+28, 28, 4, __value) - - -int rtl8192cu_endpoint_mapping(struct ieee80211_hw *hw); -u16 rtl8192cu_mq_to_hwq(__le16 fc, u16 mac80211_queue_index); -bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw, - struct rtl_stats *stats, - struct ieee80211_rx_status *rx_status, - u8 *p_desc, struct sk_buff *skb); -void rtl8192cu_rx_hdl(struct ieee80211_hw *hw, struct sk_buff * skb); -void rtl8192c_rx_segregate_hdl(struct ieee80211_hw *, struct sk_buff *, - struct sk_buff_head *); -void rtl8192c_tx_cleanup(struct ieee80211_hw *hw, struct sk_buff *skb); -int rtl8192c_tx_post_hdl(struct ieee80211_hw *hw, struct urb *urb, - struct sk_buff *skb); -struct sk_buff *rtl8192c_tx_aggregate_hdl(struct ieee80211_hw *, - struct sk_buff_head *); -void rtl92cu_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, - u8 queue_index, - struct rtl_tcb_desc *tcb_desc); -void rtl92cu_fill_fake_txdesc(struct ieee80211_hw *hw, u8 * pDesc, - u32 buffer_len, bool bIsPsPoll); -void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw, - u8 *pdesc, bool b_firstseg, - bool b_lastseg, struct sk_buff *skb); -bool rtl92cu_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/Makefile b/drivers/net/wireless/rtlwifi/rtl8192de/Makefile deleted file mode 100644 index e3213c8264b6..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -rtl8192de-objs := \ - dm.o \ - fw.o \ - hw.o \ - led.o \ - phy.o \ - rf.o \ - sw.o \ - table.o \ - trx.o - -obj-$(CONFIG_RTL8192DE) += rtl8192de.o - -ccflags-y += -D__CHECK_ENDIAN__ diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/def.h b/drivers/net/wireless/rtlwifi/rtl8192de/def.h deleted file mode 100644 index 939c905f547f..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/def.h +++ /dev/null @@ -1,271 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92D_DEF_H__ -#define __RTL92D_DEF_H__ - -/* Min Spacing related settings. */ -#define MAX_MSS_DENSITY_2T 0x13 -#define MAX_MSS_DENSITY_1T 0x0A - -#define RF6052_MAX_TX_PWR 0x3F -#define RF6052_MAX_REG 0x3F -#define RF6052_MAX_PATH 2 - -#define HAL_RETRY_LIMIT_INFRA 48 -#define HAL_RETRY_LIMIT_AP_ADHOC 7 - -#define PHY_RSSI_SLID_WIN_MAX 100 -#define PHY_LINKQUALITY_SLID_WIN_MAX 20 -#define PHY_BEACON_RSSI_SLID_WIN_MAX 10 - -#define RESET_DELAY_8185 20 - -#define RT_IBSS_INT_MASKS (IMR_BCNINT | IMR_TBDOK | IMR_TBDER) -#define RT_AC_INT_MASKS (IMR_VIDOK | IMR_VODOK | IMR_BEDOK|IMR_BKDOK) - -#define NUM_OF_FIRMWARE_QUEUE 10 -#define NUM_OF_PAGES_IN_FW 0x100 -#define NUM_OF_PAGE_IN_FW_QUEUE_BK 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_BE 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_VI 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_VO 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_HCCA 0x0 -#define NUM_OF_PAGE_IN_FW_QUEUE_CMD 0x0 -#define NUM_OF_PAGE_IN_FW_QUEUE_MGNT 0x02 -#define NUM_OF_PAGE_IN_FW_QUEUE_HIGH 0x02 -#define NUM_OF_PAGE_IN_FW_QUEUE_BCN 0x2 -#define NUM_OF_PAGE_IN_FW_QUEUE_PUB 0xA1 - -#define NUM_OF_PAGE_IN_FW_QUEUE_BK_DTM 0x026 -#define NUM_OF_PAGE_IN_FW_QUEUE_BE_DTM 0x048 -#define NUM_OF_PAGE_IN_FW_QUEUE_VI_DTM 0x048 -#define NUM_OF_PAGE_IN_FW_QUEUE_VO_DTM 0x026 -#define NUM_OF_PAGE_IN_FW_QUEUE_PUB_DTM 0x00 - -#define MAX_LINES_HWCONFIG_TXT 1000 -#define MAX_BYTES_LINE_HWCONFIG_TXT 256 - -#define SW_THREE_WIRE 0 -#define HW_THREE_WIRE 2 - -#define BT_DEMO_BOARD 0 -#define BT_QA_BOARD 1 -#define BT_FPGA 2 - -#define RX_SMOOTH_FACTOR 20 - -#define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0 -#define HAL_PRIME_CHNL_OFFSET_LOWER 1 -#define HAL_PRIME_CHNL_OFFSET_UPPER 2 - -#define MAX_H2C_QUEUE_NUM 10 - -#define RX_MPDU_QUEUE 0 -#define RX_CMD_QUEUE 1 -#define RX_MAX_QUEUE 2 - -#define C2H_RX_CMD_HDR_LEN 8 -#define GET_C2H_CMD_CMD_LEN(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 0, 16) -#define GET_C2H_CMD_ELEMENT_ID(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 16, 8) -#define GET_C2H_CMD_CMD_SEQ(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 24, 7) -#define GET_C2H_CMD_CONTINUE(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 31, 1) -#define GET_C2H_CMD_CONTENT(__prxhdr) \ - ((u8 *)(__prxhdr) + C2H_RX_CMD_HDR_LEN) - -#define GET_C2H_CMD_FEEDBACK_ELEMENT_ID(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE((__pcmdfbhdr), 0, 8) -#define GET_C2H_CMD_FEEDBACK_CCX_LEN(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE((__pcmdfbhdr), 8, 8) -#define GET_C2H_CMD_FEEDBACK_CCX_CMD_CNT(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE((__pcmdfbhdr), 16, 16) -#define GET_C2H_CMD_FEEDBACK_CCX_MAC_ID(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 0, 5) -#define GET_C2H_CMD_FEEDBACK_CCX_VALID(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 7, 1) -#define GET_C2H_CMD_FEEDBACK_CCX_RETRY_CNT(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 8, 5) -#define GET_C2H_CMD_FEEDBACK_CCX_TOK(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 15, 1) -#define GET_C2H_CMD_FEEDBACK_CCX_QSEL(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 16, 4) -#define GET_C2H_CMD_FEEDBACK_CCX_SEQ(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 20, 12) - -enum version_8192d { - VERSION_TEST_CHIP_88C = 0x0000, - VERSION_TEST_CHIP_92C = 0x0020, - VERSION_TEST_UMC_CHIP_8723 = 0x0081, - VERSION_NORMAL_TSMC_CHIP_88C = 0x0008, - VERSION_NORMAL_TSMC_CHIP_92C = 0x0028, - VERSION_NORMAL_TSMC_CHIP_92C_1T2R = 0x0018, - VERSION_NORMAL_UMC_CHIP_88C_A_CUT = 0x0088, - VERSION_NORMAL_UMC_CHIP_92C_A_CUT = 0x00a8, - VERSION_NORMAL_UMC_CHIP_92C_1T2R_A_CUT = 0x0098, - VERSION_NORMAL_UMC_CHIP_8723_1T1R_A_CUT = 0x0089, - VERSION_NORMAL_UMC_CHIP_8723_1T1R_B_CUT = 0x1089, - VERSION_NORMAL_UMC_CHIP_88C_B_CUT = 0x1088, - VERSION_NORMAL_UMC_CHIP_92C_B_CUT = 0x10a8, - VERSION_NORMAL_UMC_CHIP_92C_1T2R_B_CUT = 0x1090, - VERSION_TEST_CHIP_92D_SINGLEPHY = 0x0022, - VERSION_TEST_CHIP_92D_DUALPHY = 0x0002, - VERSION_NORMAL_CHIP_92D_SINGLEPHY = 0x002a, - VERSION_NORMAL_CHIP_92D_DUALPHY = 0x000a, - VERSION_NORMAL_CHIP_92D_C_CUT_SINGLEPHY = 0x202a, - VERSION_NORMAL_CHIP_92D_C_CUT_DUALPHY = 0x200a, - VERSION_NORMAL_CHIP_92D_D_CUT_SINGLEPHY = 0x302a, - VERSION_NORMAL_CHIP_92D_D_CUT_DUALPHY = 0x300a, - VERSION_NORMAL_CHIP_92D_E_CUT_SINGLEPHY = 0x402a, - VERSION_NORMAL_CHIP_92D_E_CUT_DUALPHY = 0x400a, -}; - -/* for 92D */ -#define CHIP_92D_SINGLEPHY BIT(9) - -/* Chip specific */ -#define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3) -#define CHIP_BONDING_92C_1T2R 0x1 -#define CHIP_BONDING_88C_USB_MCARD 0x2 -#define CHIP_BONDING_88C_USB_HP 0x1 - -/* [15:12] IC version(CUT): A-cut=0, B-cut=1, C-cut=2, D-cut=3 */ -/* [7] Manufacturer: TSMC=0, UMC=1 */ -/* [6:4] RF type: 1T1R=0, 1T2R=1, 2T2R=2 */ -/* [3] Chip type: TEST=0, NORMAL=1 */ -/* [2:0] IC type: 81xxC=0, 8723=1, 92D=2 */ -#define CHIP_8723 BIT(0) -#define CHIP_92D BIT(1) -#define NORMAL_CHIP BIT(3) -#define RF_TYPE_1T1R (~(BIT(4)|BIT(5)|BIT(6))) -#define RF_TYPE_1T2R BIT(4) -#define RF_TYPE_2T2R BIT(5) -#define CHIP_VENDOR_UMC BIT(7) -#define CHIP_92D_B_CUT BIT(12) -#define CHIP_92D_C_CUT BIT(13) -#define CHIP_92D_D_CUT (BIT(13)|BIT(12)) -#define CHIP_92D_E_CUT BIT(14) - -/* MASK */ -#define IC_TYPE_MASK (BIT(0)|BIT(1)|BIT(2)) -#define CHIP_TYPE_MASK BIT(3) -#define RF_TYPE_MASK (BIT(4)|BIT(5)|BIT(6)) -#define MANUFACTUER_MASK BIT(7) -#define ROM_VERSION_MASK (BIT(11)|BIT(10)|BIT(9)|BIT(8)) -#define CUT_VERSION_MASK (BIT(15)|BIT(14)|BIT(13)|BIT(12)) - - -/* Get element */ -#define GET_CVID_IC_TYPE(version) ((version) & IC_TYPE_MASK) -#define GET_CVID_CHIP_TYPE(version) ((version) & CHIP_TYPE_MASK) -#define GET_CVID_RF_TYPE(version) ((version) & RF_TYPE_MASK) -#define GET_CVID_MANUFACTUER(version) ((version) & MANUFACTUER_MASK) -#define GET_CVID_ROM_VERSION(version) ((version) & ROM_VERSION_MASK) -#define GET_CVID_CUT_VERSION(version) ((version) & CUT_VERSION_MASK) - -#define IS_1T1R(version) ((GET_CVID_RF_TYPE(version)) ? \ - false : true) -#define IS_1T2R(version) ((GET_CVID_RF_TYPE(version) == \ - RF_TYPE_1T2R) ? true : false) -#define IS_2T2R(version) ((GET_CVID_RF_TYPE(version) == \ - RF_TYPE_2T2R) ? true : false) - -#define IS_92D_SINGLEPHY(version) ((IS_92D(version)) ? \ - (IS_2T2R(version) ? true : false) : false) -#define IS_92D(version) ((GET_CVID_IC_TYPE(version) == \ - CHIP_92D) ? true : false) -#define IS_92D_C_CUT(version) ((IS_92D(version)) ? \ - ((GET_CVID_CUT_VERSION(version) == \ - CHIP_92D_C_CUT) ? true : false) : false) -#define IS_92D_D_CUT(version) ((IS_92D(version)) ? \ - ((GET_CVID_CUT_VERSION(version) == \ - CHIP_92D_D_CUT) ? true : false) : false) -#define IS_92D_E_CUT(version) ((IS_92D(version)) ? \ - ((GET_CVID_CUT_VERSION(version) == \ - CHIP_92D_E_CUT) ? true : false) : false) - -enum rf_optype { - RF_OP_BY_SW_3WIRE = 0, - RF_OP_BY_FW, - RF_OP_MAX -}; - -enum rtl_desc_qsel { - QSLT_BK = 0x2, - QSLT_BE = 0x0, - QSLT_VI = 0x5, - QSLT_VO = 0x7, - QSLT_BEACON = 0x10, - QSLT_HIGH = 0x11, - QSLT_MGNT = 0x12, - QSLT_CMD = 0x13, -}; - -enum channel_plan { - CHPL_FCC = 0, - CHPL_IC = 1, - CHPL_ETSI = 2, - CHPL_SPAIN = 3, - CHPL_FRANCE = 4, - CHPL_MKK = 5, - CHPL_MKK1 = 6, - CHPL_ISRAEL = 7, - CHPL_TELEC = 8, - CHPL_GLOBAL = 9, - CHPL_WORLD = 10, -}; - -struct phy_sts_cck_8192d { - u8 adc_pwdb_X[4]; - u8 sq_rpt; - u8 cck_agc_rpt; -}; - -struct h2c_cmd_8192c { - u8 element_id; - u32 cmd_len; - u8 *p_cmdbuffer; -}; - -struct txpower_info { - u8 cck_index[RF6052_MAX_PATH][CHANNEL_GROUP_MAX]; - u8 ht40_1sindex[RF6052_MAX_PATH][CHANNEL_GROUP_MAX]; - u8 ht40_2sindexdiff[RF6052_MAX_PATH][CHANNEL_GROUP_MAX]; - u8 ht20indexdiff[RF6052_MAX_PATH][CHANNEL_GROUP_MAX]; - u8 ofdmindexdiff[RF6052_MAX_PATH][CHANNEL_GROUP_MAX]; - u8 ht40maxoffset[RF6052_MAX_PATH][CHANNEL_GROUP_MAX]; - u8 ht20maxoffset[RF6052_MAX_PATH][CHANNEL_GROUP_MAX]; - u8 tssi_a[3]; /* 5GL/5GM/5GH */ - u8 tssi_b[3]; -}; - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/dm.c b/drivers/net/wireless/rtlwifi/rtl8192de/dm.c deleted file mode 100644 index 19a765532603..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/dm.c +++ /dev/null @@ -1,1338 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../base.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "fw.h" - -#define UNDEC_SM_PWDB entry_min_undec_sm_pwdb - -static const u32 ofdmswing_table[OFDM_TABLE_SIZE_92D] = { - 0x7f8001fe, /* 0, +6.0dB */ - 0x788001e2, /* 1, +5.5dB */ - 0x71c001c7, /* 2, +5.0dB */ - 0x6b8001ae, /* 3, +4.5dB */ - 0x65400195, /* 4, +4.0dB */ - 0x5fc0017f, /* 5, +3.5dB */ - 0x5a400169, /* 6, +3.0dB */ - 0x55400155, /* 7, +2.5dB */ - 0x50800142, /* 8, +2.0dB */ - 0x4c000130, /* 9, +1.5dB */ - 0x47c0011f, /* 10, +1.0dB */ - 0x43c0010f, /* 11, +0.5dB */ - 0x40000100, /* 12, +0dB */ - 0x3c8000f2, /* 13, -0.5dB */ - 0x390000e4, /* 14, -1.0dB */ - 0x35c000d7, /* 15, -1.5dB */ - 0x32c000cb, /* 16, -2.0dB */ - 0x300000c0, /* 17, -2.5dB */ - 0x2d4000b5, /* 18, -3.0dB */ - 0x2ac000ab, /* 19, -3.5dB */ - 0x288000a2, /* 20, -4.0dB */ - 0x26000098, /* 21, -4.5dB */ - 0x24000090, /* 22, -5.0dB */ - 0x22000088, /* 23, -5.5dB */ - 0x20000080, /* 24, -6.0dB */ - 0x1e400079, /* 25, -6.5dB */ - 0x1c800072, /* 26, -7.0dB */ - 0x1b00006c, /* 27. -7.5dB */ - 0x19800066, /* 28, -8.0dB */ - 0x18000060, /* 29, -8.5dB */ - 0x16c0005b, /* 30, -9.0dB */ - 0x15800056, /* 31, -9.5dB */ - 0x14400051, /* 32, -10.0dB */ - 0x1300004c, /* 33, -10.5dB */ - 0x12000048, /* 34, -11.0dB */ - 0x11000044, /* 35, -11.5dB */ - 0x10000040, /* 36, -12.0dB */ - 0x0f00003c, /* 37, -12.5dB */ - 0x0e400039, /* 38, -13.0dB */ - 0x0d800036, /* 39, -13.5dB */ - 0x0cc00033, /* 40, -14.0dB */ - 0x0c000030, /* 41, -14.5dB */ - 0x0b40002d, /* 42, -15.0dB */ -}; - -static const u8 cckswing_table_ch1ch13[CCK_TABLE_SIZE][8] = { - {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, /* 0, +0dB */ - {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, /* 1, -0.5dB */ - {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, /* 2, -1.0dB */ - {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, /* 3, -1.5dB */ - {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, /* 4, -2.0dB */ - {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, /* 5, -2.5dB */ - {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, /* 6, -3.0dB */ - {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, /* 7, -3.5dB */ - {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, /* 8, -4.0dB */ - {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, /* 9, -4.5dB */ - {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, /* 10, -5.0dB */ - {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, /* 11, -5.5dB */ - {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, /* 12, -6.0dB */ - {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, /* 13, -6.5dB */ - {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, /* 14, -7.0dB */ - {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, /* 15, -7.5dB */ - {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, /* 16, -8.0dB */ - {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, /* 17, -8.5dB */ - {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, /* 18, -9.0dB */ - {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, /* 19, -9.5dB */ - {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, /* 20, -10.0dB */ - {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, /* 21, -10.5dB */ - {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, /* 22, -11.0dB */ - {0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, /* 23, -11.5dB */ - {0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, /* 24, -12.0dB */ - {0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, /* 25, -12.5dB */ - {0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, /* 26, -13.0dB */ - {0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, /* 27, -13.5dB */ - {0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, /* 28, -14.0dB */ - {0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, /* 29, -14.5dB */ - {0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, /* 30, -15.0dB */ - {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, /* 31, -15.5dB */ - {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01} /* 32, -16.0dB */ -}; - -static const u8 cckswing_table_ch14[CCK_TABLE_SIZE][8] = { - {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, /* 0, +0dB */ - {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, /* 1, -0.5dB */ - {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, /* 2, -1.0dB */ - {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, /* 3, -1.5dB */ - {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, /* 4, -2.0dB */ - {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, /* 5, -2.5dB */ - {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, /* 6, -3.0dB */ - {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, /* 7, -3.5dB */ - {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, /* 8, -4.0dB */ - {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, /* 9, -4.5dB */ - {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, /* 10, -5.0dB */ - {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 11, -5.5dB */ - {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 12, -6.0dB */ - {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, /* 13, -6.5dB */ - {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, /* 14, -7.0dB */ - {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 15, -7.5dB */ - {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 16, -8.0dB */ - {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 17, -8.5dB */ - {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 18, -9.0dB */ - {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 19, -9.5dB */ - {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 20, -10.0dB */ - {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, /* 21, -10.5dB */ - {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, /* 22, -11.0dB */ - {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, /* 23, -11.5dB */ - {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, /* 24, -12.0dB */ - {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 25, -12.5dB */ - {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 26, -13.0dB */ - {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 27, -13.5dB */ - {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 28, -14.0dB */ - {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 29, -14.5dB */ - {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 30, -15.0dB */ - {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 31, -15.5dB */ - {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00} /* 32, -16.0dB */ -}; - -static void rtl92d_dm_diginit(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *de_digtable = &rtlpriv->dm_digtable; - - de_digtable->dig_enable_flag = true; - de_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; - de_digtable->cur_igvalue = 0x20; - de_digtable->pre_igvalue = 0x0; - de_digtable->cursta_cstate = DIG_STA_DISCONNECT; - de_digtable->presta_cstate = DIG_STA_DISCONNECT; - de_digtable->curmultista_cstate = DIG_MULTISTA_DISCONNECT; - de_digtable->rssi_lowthresh = DM_DIG_THRESH_LOW; - de_digtable->rssi_highthresh = DM_DIG_THRESH_HIGH; - de_digtable->fa_lowthresh = DM_FALSEALARM_THRESH_LOW; - de_digtable->fa_highthresh = DM_FALSEALARM_THRESH_HIGH; - de_digtable->rx_gain_max = DM_DIG_FA_UPPER; - de_digtable->rx_gain_min = DM_DIG_FA_LOWER; - de_digtable->back_val = DM_DIG_BACKOFF_DEFAULT; - de_digtable->back_range_max = DM_DIG_BACKOFF_MAX; - de_digtable->back_range_min = DM_DIG_BACKOFF_MIN; - de_digtable->pre_cck_pd_state = CCK_PD_STAGE_LOWRSSI; - de_digtable->cur_cck_pd_state = CCK_PD_STAGE_MAX; - de_digtable->large_fa_hit = 0; - de_digtable->recover_cnt = 0; - de_digtable->forbidden_igi = DM_DIG_FA_LOWER; -} - -static void rtl92d_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) -{ - u32 ret_value; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); - unsigned long flag = 0; - - /* hold ofdm counter */ - rtl_set_bbreg(hw, ROFDM0_LSTF, BIT(31), 1); /* hold page C counter */ - rtl_set_bbreg(hw, ROFDM1_LSTF, BIT(31), 1); /*hold page D counter */ - - ret_value = rtl_get_bbreg(hw, ROFDM0_FRAMESYNC, BMASKDWORD); - falsealm_cnt->cnt_fast_fsync_fail = (ret_value & 0xffff); - falsealm_cnt->cnt_sb_search_fail = ((ret_value & 0xffff0000) >> 16); - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER1, BMASKDWORD); - falsealm_cnt->cnt_parity_fail = ((ret_value & 0xffff0000) >> 16); - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER2, BMASKDWORD); - falsealm_cnt->cnt_rate_illegal = (ret_value & 0xffff); - falsealm_cnt->cnt_crc8_fail = ((ret_value & 0xffff0000) >> 16); - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER3, BMASKDWORD); - falsealm_cnt->cnt_mcs_fail = (ret_value & 0xffff); - falsealm_cnt->cnt_ofdm_fail = falsealm_cnt->cnt_parity_fail + - falsealm_cnt->cnt_rate_illegal + - falsealm_cnt->cnt_crc8_fail + - falsealm_cnt->cnt_mcs_fail + - falsealm_cnt->cnt_fast_fsync_fail + - falsealm_cnt->cnt_sb_search_fail; - - if (rtlpriv->rtlhal.current_bandtype != BAND_ON_5G) { - /* hold cck counter */ - rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag); - ret_value = rtl_get_bbreg(hw, RCCK0_FACOUNTERLOWER, BMASKBYTE0); - falsealm_cnt->cnt_cck_fail = ret_value; - ret_value = rtl_get_bbreg(hw, RCCK0_FACOUNTERUPPER, BMASKBYTE3); - falsealm_cnt->cnt_cck_fail += (ret_value & 0xff) << 8; - rtl92d_release_cckandrw_pagea_ctl(hw, &flag); - } else { - falsealm_cnt->cnt_cck_fail = 0; - } - - /* reset false alarm counter registers */ - falsealm_cnt->cnt_all = falsealm_cnt->cnt_fast_fsync_fail + - falsealm_cnt->cnt_sb_search_fail + - falsealm_cnt->cnt_parity_fail + - falsealm_cnt->cnt_rate_illegal + - falsealm_cnt->cnt_crc8_fail + - falsealm_cnt->cnt_mcs_fail + - falsealm_cnt->cnt_cck_fail; - - rtl_set_bbreg(hw, ROFDM1_LSTF, 0x08000000, 1); - /* update ofdm counter */ - rtl_set_bbreg(hw, ROFDM1_LSTF, 0x08000000, 0); - /* update page C counter */ - rtl_set_bbreg(hw, ROFDM0_LSTF, BIT(31), 0); - /* update page D counter */ - rtl_set_bbreg(hw, ROFDM1_LSTF, BIT(31), 0); - if (rtlpriv->rtlhal.current_bandtype != BAND_ON_5G) { - /* reset cck counter */ - rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag); - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, 0x0000c000, 0); - /* enable cck counter */ - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, 0x0000c000, 2); - rtl92d_release_cckandrw_pagea_ctl(hw, &flag); - } - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "Cnt_Fast_Fsync_fail = %x, Cnt_SB_Search_fail = %x\n", - falsealm_cnt->cnt_fast_fsync_fail, - falsealm_cnt->cnt_sb_search_fail); - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "Cnt_Parity_Fail = %x, Cnt_Rate_Illegal = %x, Cnt_Crc8_fail = %x, Cnt_Mcs_fail = %x\n", - falsealm_cnt->cnt_parity_fail, - falsealm_cnt->cnt_rate_illegal, - falsealm_cnt->cnt_crc8_fail, - falsealm_cnt->cnt_mcs_fail); - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "Cnt_Ofdm_fail = %x, Cnt_Cck_fail = %x, Cnt_all = %x\n", - falsealm_cnt->cnt_ofdm_fail, - falsealm_cnt->cnt_cck_fail, - falsealm_cnt->cnt_all); -} - -static void rtl92d_dm_find_minimum_rssi(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *de_digtable = &rtlpriv->dm_digtable; - struct rtl_mac *mac = rtl_mac(rtlpriv); - - /* Determine the minimum RSSI */ - if ((mac->link_state < MAC80211_LINKED) && - (rtlpriv->dm.UNDEC_SM_PWDB == 0)) { - de_digtable->min_undec_pwdb_for_dm = 0; - RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, - "Not connected to any\n"); - } - if (mac->link_state >= MAC80211_LINKED) { - if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) { - de_digtable->min_undec_pwdb_for_dm = - rtlpriv->dm.UNDEC_SM_PWDB; - RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, - "AP Client PWDB = 0x%lx\n", - rtlpriv->dm.UNDEC_SM_PWDB); - } else { - de_digtable->min_undec_pwdb_for_dm = - rtlpriv->dm.undec_sm_pwdb; - RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, - "STA Default Port PWDB = 0x%x\n", - de_digtable->min_undec_pwdb_for_dm); - } - } else { - de_digtable->min_undec_pwdb_for_dm = rtlpriv->dm.UNDEC_SM_PWDB; - RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, - "AP Ext Port or disconnect PWDB = 0x%x\n", - de_digtable->min_undec_pwdb_for_dm); - } - - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "MinUndecoratedPWDBForDM =%d\n", - de_digtable->min_undec_pwdb_for_dm); -} - -static void rtl92d_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *de_digtable = &rtlpriv->dm_digtable; - unsigned long flag = 0; - - if (de_digtable->cursta_cstate == DIG_STA_CONNECT) { - if (de_digtable->pre_cck_pd_state == CCK_PD_STAGE_LOWRSSI) { - if (de_digtable->min_undec_pwdb_for_dm <= 25) - de_digtable->cur_cck_pd_state = - CCK_PD_STAGE_LOWRSSI; - else - de_digtable->cur_cck_pd_state = - CCK_PD_STAGE_HIGHRSSI; - } else { - if (de_digtable->min_undec_pwdb_for_dm <= 20) - de_digtable->cur_cck_pd_state = - CCK_PD_STAGE_LOWRSSI; - else - de_digtable->cur_cck_pd_state = - CCK_PD_STAGE_HIGHRSSI; - } - } else { - de_digtable->cur_cck_pd_state = CCK_PD_STAGE_LOWRSSI; - } - if (de_digtable->pre_cck_pd_state != de_digtable->cur_cck_pd_state) { - if (de_digtable->cur_cck_pd_state == CCK_PD_STAGE_LOWRSSI) { - rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag); - rtl_set_bbreg(hw, RCCK0_CCA, BMASKBYTE2, 0x83); - rtl92d_release_cckandrw_pagea_ctl(hw, &flag); - } else { - rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag); - rtl_set_bbreg(hw, RCCK0_CCA, BMASKBYTE2, 0xcd); - rtl92d_release_cckandrw_pagea_ctl(hw, &flag); - } - de_digtable->pre_cck_pd_state = de_digtable->cur_cck_pd_state; - } - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "CurSTAConnectState=%s\n", - de_digtable->cursta_cstate == DIG_STA_CONNECT ? - "DIG_STA_CONNECT " : "DIG_STA_DISCONNECT"); - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "CCKPDStage=%s\n", - de_digtable->cur_cck_pd_state == CCK_PD_STAGE_LOWRSSI ? - "Low RSSI " : "High RSSI "); - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "is92d single phy =%x\n", - IS_92D_SINGLEPHY(rtlpriv->rtlhal.version)); - -} - -void rtl92d_dm_write_dig(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *de_digtable = &rtlpriv->dm_digtable; - - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "cur_igvalue = 0x%x, pre_igvalue = 0x%x, back_val = %d\n", - de_digtable->cur_igvalue, de_digtable->pre_igvalue, - de_digtable->back_val); - if (de_digtable->dig_enable_flag == false) { - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "DIG is disabled\n"); - de_digtable->pre_igvalue = 0x17; - return; - } - if (de_digtable->pre_igvalue != de_digtable->cur_igvalue) { - rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, - de_digtable->cur_igvalue); - rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, 0x7f, - de_digtable->cur_igvalue); - de_digtable->pre_igvalue = de_digtable->cur_igvalue; - } -} - -static void rtl92d_early_mode_enabled(struct rtl_priv *rtlpriv) -{ - struct dig_t *de_digtable = &rtlpriv->dm_digtable; - - if ((rtlpriv->mac80211.link_state >= MAC80211_LINKED) && - (rtlpriv->mac80211.vendor == PEER_CISCO)) { - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "IOT_PEER = CISCO\n"); - if (de_digtable->last_min_undec_pwdb_for_dm >= 50 - && de_digtable->min_undec_pwdb_for_dm < 50) { - rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x00); - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "Early Mode Off\n"); - } else if (de_digtable->last_min_undec_pwdb_for_dm <= 55 && - de_digtable->min_undec_pwdb_for_dm > 55) { - rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x0f); - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "Early Mode On\n"); - } - } else if (!(rtl_read_byte(rtlpriv, REG_EARLY_MODE_CONTROL) & 0xf)) { - rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x0f); - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "Early Mode On\n"); - } -} - -static void rtl92d_dm_dig(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *de_digtable = &rtlpriv->dm_digtable; - u8 value_igi = de_digtable->cur_igvalue; - struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); - - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "==>\n"); - if (rtlpriv->rtlhal.earlymode_enable) { - rtl92d_early_mode_enabled(rtlpriv); - de_digtable->last_min_undec_pwdb_for_dm = - de_digtable->min_undec_pwdb_for_dm; - } - if (!rtlpriv->dm.dm_initialgain_enable) - return; - - /* because we will send data pkt when scanning - * this will cause some ap like gear-3700 wep TP - * lower if we retrun here, this is the diff of - * mac80211 driver vs ieee80211 driver */ - /* if (rtlpriv->mac80211.act_scanning) - * return; */ - - /* Not STA mode return tmp */ - if (rtlpriv->mac80211.opmode != NL80211_IFTYPE_STATION) - return; - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "progress\n"); - /* Decide the current status and if modify initial gain or not */ - if (rtlpriv->mac80211.link_state >= MAC80211_LINKED) - de_digtable->cursta_cstate = DIG_STA_CONNECT; - else - de_digtable->cursta_cstate = DIG_STA_DISCONNECT; - - /* adjust initial gain according to false alarm counter */ - if (falsealm_cnt->cnt_all < DM_DIG_FA_TH0) - value_igi--; - else if (falsealm_cnt->cnt_all < DM_DIG_FA_TH1) - value_igi += 0; - else if (falsealm_cnt->cnt_all < DM_DIG_FA_TH2) - value_igi++; - else if (falsealm_cnt->cnt_all >= DM_DIG_FA_TH2) - value_igi += 2; - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "dm_DIG() Before: large_fa_hit=%d, forbidden_igi=%x\n", - de_digtable->large_fa_hit, de_digtable->forbidden_igi); - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "dm_DIG() Before: Recover_cnt=%d, rx_gain_min=%x\n", - de_digtable->recover_cnt, de_digtable->rx_gain_min); - - /* deal with abnorally large false alarm */ - if (falsealm_cnt->cnt_all > 10000) { - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "dm_DIG(): Abnormally false alarm case\n"); - - de_digtable->large_fa_hit++; - if (de_digtable->forbidden_igi < de_digtable->cur_igvalue) { - de_digtable->forbidden_igi = de_digtable->cur_igvalue; - de_digtable->large_fa_hit = 1; - } - if (de_digtable->large_fa_hit >= 3) { - if ((de_digtable->forbidden_igi + 1) > DM_DIG_MAX) - de_digtable->rx_gain_min = DM_DIG_MAX; - else - de_digtable->rx_gain_min = - (de_digtable->forbidden_igi + 1); - de_digtable->recover_cnt = 3600; /* 3600=2hr */ - } - } else { - /* Recovery mechanism for IGI lower bound */ - if (de_digtable->recover_cnt != 0) { - de_digtable->recover_cnt--; - } else { - if (de_digtable->large_fa_hit == 0) { - if ((de_digtable->forbidden_igi - 1) < - DM_DIG_FA_LOWER) { - de_digtable->forbidden_igi = - DM_DIG_FA_LOWER; - de_digtable->rx_gain_min = - DM_DIG_FA_LOWER; - - } else { - de_digtable->forbidden_igi--; - de_digtable->rx_gain_min = - (de_digtable->forbidden_igi + 1); - } - } else if (de_digtable->large_fa_hit == 3) { - de_digtable->large_fa_hit = 0; - } - } - } - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "dm_DIG() After: large_fa_hit=%d, forbidden_igi=%x\n", - de_digtable->large_fa_hit, de_digtable->forbidden_igi); - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "dm_DIG() After: recover_cnt=%d, rx_gain_min=%x\n", - de_digtable->recover_cnt, de_digtable->rx_gain_min); - - if (value_igi > DM_DIG_MAX) - value_igi = DM_DIG_MAX; - else if (value_igi < de_digtable->rx_gain_min) - value_igi = de_digtable->rx_gain_min; - de_digtable->cur_igvalue = value_igi; - rtl92d_dm_write_dig(hw); - if (rtlpriv->rtlhal.current_bandtype != BAND_ON_5G) - rtl92d_dm_cck_packet_detection_thresh(hw); - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "<<==\n"); -} - -static void rtl92d_dm_init_dynamic_txpower(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.dynamic_txpower_enable = true; - rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; -} - -static void rtl92d_dm_dynamic_txpower(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - long undec_sm_pwdb; - - if ((!rtlpriv->dm.dynamic_txpower_enable) - || rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - return; - } - if ((mac->link_state < MAC80211_LINKED) && - (rtlpriv->dm.UNDEC_SM_PWDB == 0)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, - "Not connected to any\n"); - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; - return; - } - if (mac->link_state >= MAC80211_LINKED) { - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - undec_sm_pwdb = - rtlpriv->dm.UNDEC_SM_PWDB; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "IBSS Client PWDB = 0x%lx\n", - undec_sm_pwdb); - } else { - undec_sm_pwdb = - rtlpriv->dm.undec_sm_pwdb; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "STA Default Port PWDB = 0x%lx\n", - undec_sm_pwdb); - } - } else { - undec_sm_pwdb = - rtlpriv->dm.UNDEC_SM_PWDB; - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "AP Ext Port PWDB = 0x%lx\n", - undec_sm_pwdb); - } - if (rtlhal->current_bandtype == BAND_ON_5G) { - if (undec_sm_pwdb >= 0x33) { - rtlpriv->dm.dynamic_txhighpower_lvl = - TXHIGHPWRLEVEL_LEVEL2; - RT_TRACE(rtlpriv, COMP_HIPWR, DBG_LOUD, - "5G:TxHighPwrLevel_Level2 (TxPwr=0x0)\n"); - } else if ((undec_sm_pwdb < 0x33) - && (undec_sm_pwdb >= 0x2b)) { - rtlpriv->dm.dynamic_txhighpower_lvl = - TXHIGHPWRLEVEL_LEVEL1; - RT_TRACE(rtlpriv, COMP_HIPWR, DBG_LOUD, - "5G:TxHighPwrLevel_Level1 (TxPwr=0x10)\n"); - } else if (undec_sm_pwdb < 0x2b) { - rtlpriv->dm.dynamic_txhighpower_lvl = - TXHIGHPWRLEVEL_NORMAL; - RT_TRACE(rtlpriv, COMP_HIPWR, DBG_LOUD, - "5G:TxHighPwrLevel_Normal\n"); - } - } else { - if (undec_sm_pwdb >= - TX_POWER_NEAR_FIELD_THRESH_LVL2) { - rtlpriv->dm.dynamic_txhighpower_lvl = - TXHIGHPWRLEVEL_LEVEL2; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n"); - } else - if ((undec_sm_pwdb < - (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) - && (undec_sm_pwdb >= - TX_POWER_NEAR_FIELD_THRESH_LVL1)) { - - rtlpriv->dm.dynamic_txhighpower_lvl = - TXHIGHPWRLEVEL_LEVEL1; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n"); - } else if (undec_sm_pwdb < - (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) { - rtlpriv->dm.dynamic_txhighpower_lvl = - TXHIGHPWRLEVEL_NORMAL; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_NORMAL\n"); - } - } - if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "PHY_SetTxPowerLevel8192S() Channel = %d\n", - rtlphy->current_channel); - rtl92d_phy_set_txpower_level(hw, rtlphy->current_channel); - } - rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl; -} - -static void rtl92d_dm_pwdb_monitor(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - /* AP & ADHOC & MESH will return tmp */ - if (rtlpriv->mac80211.opmode != NL80211_IFTYPE_STATION) - return; - /* Indicate Rx signal strength to FW. */ - if (rtlpriv->dm.useramask) { - u32 temp = rtlpriv->dm.undec_sm_pwdb; - - temp <<= 16; - temp |= 0x100; - /* fw v12 cmdid 5:use max macid ,for nic , - * default macid is 0 ,max macid is 1 */ - rtl92d_fill_h2c_cmd(hw, H2C_RSSI_REPORT, 3, (u8 *) (&temp)); - } else { - rtl_write_byte(rtlpriv, 0x4fe, - (u8) rtlpriv->dm.undec_sm_pwdb); - } -} - -void rtl92d_dm_init_edca_turbo(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.current_turbo_edca = false; - rtlpriv->dm.is_any_nonbepkts = false; - rtlpriv->dm.is_cur_rdlstate = false; -} - -static void rtl92d_dm_check_edca_turbo(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - static u64 last_txok_cnt; - static u64 last_rxok_cnt; - u64 cur_txok_cnt; - u64 cur_rxok_cnt; - u32 edca_be_ul = 0x5ea42b; - u32 edca_be_dl = 0x5ea42b; - - if (mac->link_state != MAC80211_LINKED) { - rtlpriv->dm.current_turbo_edca = false; - goto exit; - } - - /* Enable BEQ TxOP limit configuration in wireless G-mode. */ - /* To check whether we shall force turn on TXOP configuration. */ - if ((!rtlpriv->dm.disable_framebursting) && - (rtlpriv->sec.pairwise_enc_algorithm == WEP40_ENCRYPTION || - rtlpriv->sec.pairwise_enc_algorithm == WEP104_ENCRYPTION || - rtlpriv->sec.pairwise_enc_algorithm == TKIP_ENCRYPTION)) { - /* Force TxOP limit to 0x005e for UL. */ - if (!(edca_be_ul & 0xffff0000)) - edca_be_ul |= 0x005e0000; - /* Force TxOP limit to 0x005e for DL. */ - if (!(edca_be_dl & 0xffff0000)) - edca_be_dl |= 0x005e0000; - } - - if ((!rtlpriv->dm.is_any_nonbepkts) && - (!rtlpriv->dm.disable_framebursting)) { - cur_txok_cnt = rtlpriv->stats.txbytesunicast - last_txok_cnt; - cur_rxok_cnt = rtlpriv->stats.rxbytesunicast - last_rxok_cnt; - if (cur_rxok_cnt > 4 * cur_txok_cnt) { - if (!rtlpriv->dm.is_cur_rdlstate || - !rtlpriv->dm.current_turbo_edca) { - rtl_write_dword(rtlpriv, REG_EDCA_BE_PARAM, - edca_be_dl); - rtlpriv->dm.is_cur_rdlstate = true; - } - } else { - if (rtlpriv->dm.is_cur_rdlstate || - !rtlpriv->dm.current_turbo_edca) { - rtl_write_dword(rtlpriv, REG_EDCA_BE_PARAM, - edca_be_ul); - rtlpriv->dm.is_cur_rdlstate = false; - } - } - rtlpriv->dm.current_turbo_edca = true; - } else { - if (rtlpriv->dm.current_turbo_edca) { - u8 tmp = AC0_BE; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_AC_PARAM, - &tmp); - rtlpriv->dm.current_turbo_edca = false; - } - } - -exit: - rtlpriv->dm.is_any_nonbepkts = false; - last_txok_cnt = rtlpriv->stats.txbytesunicast; - last_rxok_cnt = rtlpriv->stats.rxbytesunicast; -} - -static void rtl92d_dm_rxgain_tracking_thermalmeter(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 index_mapping[RX_INDEX_MAPPING_NUM] = { - 0x0f, 0x0f, 0x0d, 0x0c, 0x0b, - 0x0a, 0x09, 0x08, 0x07, 0x06, - 0x05, 0x04, 0x04, 0x03, 0x02 - }; - int i; - u32 u4tmp; - - u4tmp = (index_mapping[(rtlpriv->efuse.eeprom_thermalmeter - - rtlpriv->dm.thermalvalue_rxgain)]) << 12; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "===> Rx Gain %x\n", u4tmp); - for (i = RF90_PATH_A; i < rtlpriv->phy.num_total_rfpath; i++) - rtl_set_rfreg(hw, i, 0x3C, BRFREGOFFSETMASK, - (rtlpriv->phy.reg_rf3c[i] & (~(0xF000))) | u4tmp); -} - -static void rtl92d_bandtype_2_4G(struct ieee80211_hw *hw, long *temp_cckg, - u8 *cck_index_old) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int i; - unsigned long flag = 0; - long temp_cck; - - /* Query CCK default setting From 0xa24 */ - rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag); - temp_cck = rtl_get_bbreg(hw, RCCK0_TXFILTER2, - BMASKDWORD) & BMASKCCK; - rtl92d_release_cckandrw_pagea_ctl(hw, &flag); - for (i = 0; i < CCK_TABLE_LENGTH; i++) { - if (rtlpriv->dm.cck_inch14) { - if (!memcmp((void *)&temp_cck, - (void *)&cckswing_table_ch14[i][2], 4)) { - *cck_index_old = (u8) i; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Initial reg0x%x = 0x%lx, cck_index=0x%x, ch 14 %d\n", - RCCK0_TXFILTER2, temp_cck, - *cck_index_old, - rtlpriv->dm.cck_inch14); - break; - } - } else { - if (!memcmp((void *) &temp_cck, - &cckswing_table_ch1ch13[i][2], 4)) { - *cck_index_old = (u8) i; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Initial reg0x%x = 0x%lx, cck_index = 0x%x, ch14 %d\n", - RCCK0_TXFILTER2, temp_cck, - *cck_index_old, - rtlpriv->dm.cck_inch14); - break; - } - } - } - *temp_cckg = temp_cck; -} - -static void rtl92d_bandtype_5G(struct rtl_hal *rtlhal, u8 *ofdm_index, - bool *internal_pa, u8 thermalvalue, u8 delta, - u8 rf, struct rtl_efuse *rtlefuse, - struct rtl_priv *rtlpriv, struct rtl_phy *rtlphy, - u8 index_mapping[5][INDEX_MAPPING_NUM], - u8 index_mapping_pa[8][INDEX_MAPPING_NUM]) -{ - int i; - u8 index; - u8 offset = 0; - - for (i = 0; i < rf; i++) { - if (rtlhal->macphymode == DUALMAC_DUALPHY && - rtlhal->interfaceindex == 1) /* MAC 1 5G */ - *internal_pa = rtlefuse->internal_pa_5g[1]; - else - *internal_pa = rtlefuse->internal_pa_5g[i]; - if (*internal_pa) { - if (rtlhal->interfaceindex == 1 || i == rf) - offset = 4; - else - offset = 0; - if (rtlphy->current_channel >= 100 && - rtlphy->current_channel <= 165) - offset += 2; - } else { - if (rtlhal->interfaceindex == 1 || i == rf) - offset = 2; - else - offset = 0; - } - if (thermalvalue > rtlefuse->eeprom_thermalmeter) - offset++; - if (*internal_pa) { - if (delta > INDEX_MAPPING_NUM - 1) - index = index_mapping_pa[offset] - [INDEX_MAPPING_NUM - 1]; - else - index = - index_mapping_pa[offset][delta]; - } else { - if (delta > INDEX_MAPPING_NUM - 1) - index = - index_mapping[offset][INDEX_MAPPING_NUM - 1]; - else - index = index_mapping[offset][delta]; - } - if (thermalvalue > rtlefuse->eeprom_thermalmeter) { - if (*internal_pa && thermalvalue > 0x12) { - ofdm_index[i] = rtlpriv->dm.ofdm_index[i] - - ((delta / 2) * 3 + (delta % 2)); - } else { - ofdm_index[i] -= index; - } - } else { - ofdm_index[i] += index; - } - } -} - -static void rtl92d_dm_txpower_tracking_callback_thermalmeter( - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 thermalvalue, delta, delta_lck, delta_iqk, delta_rxgain; - u8 offset, thermalvalue_avg_count = 0; - u32 thermalvalue_avg = 0; - bool internal_pa = false; - long ele_a = 0, ele_d, temp_cck, val_x, value32; - long val_y, ele_c = 0; - u8 ofdm_index[2]; - s8 cck_index = 0; - u8 ofdm_index_old[2]; - s8 cck_index_old = 0; - u8 index; - int i; - bool is2t = IS_92D_SINGLEPHY(rtlhal->version); - u8 ofdm_min_index = 6, ofdm_min_index_internal_pa = 3, rf; - u8 indexforchannel = - rtl92d_get_rightchnlplace_for_iqk(rtlphy->current_channel); - u8 index_mapping[5][INDEX_MAPPING_NUM] = { - /* 5G, path A/MAC 0, decrease power */ - {0, 1, 3, 6, 8, 9, 11, 13, 14, 16, 17, 18, 18}, - /* 5G, path A/MAC 0, increase power */ - {0, 2, 4, 5, 7, 10, 12, 14, 16, 18, 18, 18, 18}, - /* 5G, path B/MAC 1, decrease power */ - {0, 2, 3, 6, 8, 9, 11, 13, 14, 16, 17, 18, 18}, - /* 5G, path B/MAC 1, increase power */ - {0, 2, 4, 5, 7, 10, 13, 16, 16, 18, 18, 18, 18}, - /* 2.4G, for decreas power */ - {0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 10}, - }; - u8 index_mapping_internal_pa[8][INDEX_MAPPING_NUM] = { - /* 5G, path A/MAC 0, ch36-64, decrease power */ - {0, 1, 2, 4, 6, 7, 9, 11, 12, 14, 15, 16, 16}, - /* 5G, path A/MAC 0, ch36-64, increase power */ - {0, 2, 4, 5, 7, 10, 12, 14, 16, 18, 18, 18, 18}, - /* 5G, path A/MAC 0, ch100-165, decrease power */ - {0, 1, 2, 3, 5, 6, 8, 10, 11, 13, 14, 15, 15}, - /* 5G, path A/MAC 0, ch100-165, increase power */ - {0, 2, 4, 5, 7, 10, 12, 14, 16, 18, 18, 18, 18}, - /* 5G, path B/MAC 1, ch36-64, decrease power */ - {0, 1, 2, 4, 6, 7, 9, 11, 12, 14, 15, 16, 16}, - /* 5G, path B/MAC 1, ch36-64, increase power */ - {0, 2, 4, 5, 7, 10, 13, 16, 16, 18, 18, 18, 18}, - /* 5G, path B/MAC 1, ch100-165, decrease power */ - {0, 1, 2, 3, 5, 6, 8, 9, 10, 12, 13, 14, 14}, - /* 5G, path B/MAC 1, ch100-165, increase power */ - {0, 2, 4, 5, 7, 10, 13, 16, 16, 18, 18, 18, 18}, - }; - - rtlpriv->dm.txpower_trackinginit = true; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "\n"); - thermalvalue = (u8) rtl_get_rfreg(hw, RF90_PATH_A, RF_T_METER, 0xf800); - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x\n", - thermalvalue, - rtlpriv->dm.thermalvalue, rtlefuse->eeprom_thermalmeter); - rtl92d_phy_ap_calibrate(hw, (thermalvalue - - rtlefuse->eeprom_thermalmeter)); - if (is2t) - rf = 2; - else - rf = 1; - if (thermalvalue) { - ele_d = rtl_get_bbreg(hw, ROFDM0_XATxIQIMBALANCE, - BMASKDWORD) & BMASKOFDM_D; - for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) { - if (ele_d == (ofdmswing_table[i] & BMASKOFDM_D)) { - ofdm_index_old[0] = (u8) i; - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Initial pathA ele_d reg0x%x = 0x%lx, ofdm_index=0x%x\n", - ROFDM0_XATxIQIMBALANCE, - ele_d, ofdm_index_old[0]); - break; - } - } - if (is2t) { - ele_d = rtl_get_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, - BMASKDWORD) & BMASKOFDM_D; - for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) { - if (ele_d == - (ofdmswing_table[i] & BMASKOFDM_D)) { - ofdm_index_old[1] = (u8) i; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, - DBG_LOUD, - "Initial pathB ele_d reg 0x%x = 0x%lx, ofdm_index = 0x%x\n", - ROFDM0_XBTxIQIMBALANCE, ele_d, - ofdm_index_old[1]); - break; - } - } - } - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - rtl92d_bandtype_2_4G(hw, &temp_cck, &cck_index_old); - } else { - temp_cck = 0x090e1317; - cck_index_old = 12; - } - - if (!rtlpriv->dm.thermalvalue) { - rtlpriv->dm.thermalvalue = - rtlefuse->eeprom_thermalmeter; - rtlpriv->dm.thermalvalue_lck = thermalvalue; - rtlpriv->dm.thermalvalue_iqk = thermalvalue; - rtlpriv->dm.thermalvalue_rxgain = - rtlefuse->eeprom_thermalmeter; - for (i = 0; i < rf; i++) - rtlpriv->dm.ofdm_index[i] = ofdm_index_old[i]; - rtlpriv->dm.cck_index = cck_index_old; - } - if (rtlhal->reloadtxpowerindex) { - for (i = 0; i < rf; i++) - rtlpriv->dm.ofdm_index[i] = ofdm_index_old[i]; - rtlpriv->dm.cck_index = cck_index_old; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "reload ofdm index for band switch\n"); - } - rtlpriv->dm.thermalvalue_avg - [rtlpriv->dm.thermalvalue_avg_index] = thermalvalue; - rtlpriv->dm.thermalvalue_avg_index++; - if (rtlpriv->dm.thermalvalue_avg_index == AVG_THERMAL_NUM) - rtlpriv->dm.thermalvalue_avg_index = 0; - for (i = 0; i < AVG_THERMAL_NUM; i++) { - if (rtlpriv->dm.thermalvalue_avg[i]) { - thermalvalue_avg += - rtlpriv->dm.thermalvalue_avg[i]; - thermalvalue_avg_count++; - } - } - if (thermalvalue_avg_count) - thermalvalue = (u8) (thermalvalue_avg / - thermalvalue_avg_count); - if (rtlhal->reloadtxpowerindex) { - delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ? - (thermalvalue - rtlefuse->eeprom_thermalmeter) : - (rtlefuse->eeprom_thermalmeter - thermalvalue); - rtlhal->reloadtxpowerindex = false; - rtlpriv->dm.done_txpower = false; - } else if (rtlpriv->dm.done_txpower) { - delta = (thermalvalue > rtlpriv->dm.thermalvalue) ? - (thermalvalue - rtlpriv->dm.thermalvalue) : - (rtlpriv->dm.thermalvalue - thermalvalue); - } else { - delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ? - (thermalvalue - rtlefuse->eeprom_thermalmeter) : - (rtlefuse->eeprom_thermalmeter - thermalvalue); - } - delta_lck = (thermalvalue > rtlpriv->dm.thermalvalue_lck) ? - (thermalvalue - rtlpriv->dm.thermalvalue_lck) : - (rtlpriv->dm.thermalvalue_lck - thermalvalue); - delta_iqk = (thermalvalue > rtlpriv->dm.thermalvalue_iqk) ? - (thermalvalue - rtlpriv->dm.thermalvalue_iqk) : - (rtlpriv->dm.thermalvalue_iqk - thermalvalue); - delta_rxgain = - (thermalvalue > rtlpriv->dm.thermalvalue_rxgain) ? - (thermalvalue - rtlpriv->dm.thermalvalue_rxgain) : - (rtlpriv->dm.thermalvalue_rxgain - thermalvalue); - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x delta 0x%x delta_lck 0x%x delta_iqk 0x%x\n", - thermalvalue, rtlpriv->dm.thermalvalue, - rtlefuse->eeprom_thermalmeter, delta, delta_lck, - delta_iqk); - if ((delta_lck > rtlefuse->delta_lck) && - (rtlefuse->delta_lck != 0)) { - rtlpriv->dm.thermalvalue_lck = thermalvalue; - rtl92d_phy_lc_calibrate(hw); - } - if (delta > 0 && rtlpriv->dm.txpower_track_control) { - rtlpriv->dm.done_txpower = true; - delta = (thermalvalue > rtlefuse->eeprom_thermalmeter) ? - (thermalvalue - rtlefuse->eeprom_thermalmeter) : - (rtlefuse->eeprom_thermalmeter - thermalvalue); - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - offset = 4; - if (delta > INDEX_MAPPING_NUM - 1) - index = index_mapping[offset] - [INDEX_MAPPING_NUM - 1]; - else - index = index_mapping[offset][delta]; - if (thermalvalue > rtlpriv->dm.thermalvalue) { - for (i = 0; i < rf; i++) - ofdm_index[i] -= delta; - cck_index -= delta; - } else { - for (i = 0; i < rf; i++) - ofdm_index[i] += index; - cck_index += index; - } - } else if (rtlhal->current_bandtype == BAND_ON_5G) { - rtl92d_bandtype_5G(rtlhal, ofdm_index, - &internal_pa, thermalvalue, - delta, rf, rtlefuse, rtlpriv, - rtlphy, index_mapping, - index_mapping_internal_pa); - } - if (is2t) { - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "temp OFDM_A_index=0x%x, OFDM_B_index = 0x%x,cck_index=0x%x\n", - rtlpriv->dm.ofdm_index[0], - rtlpriv->dm.ofdm_index[1], - rtlpriv->dm.cck_index); - } else { - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "temp OFDM_A_index=0x%x,cck_index = 0x%x\n", - rtlpriv->dm.ofdm_index[0], - rtlpriv->dm.cck_index); - } - for (i = 0; i < rf; i++) { - if (ofdm_index[i] > OFDM_TABLE_SIZE_92D - 1) - ofdm_index[i] = OFDM_TABLE_SIZE_92D - 1; - else if (ofdm_index[i] < ofdm_min_index) - ofdm_index[i] = ofdm_min_index; - } - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - if (cck_index > CCK_TABLE_SIZE - 1) { - cck_index = CCK_TABLE_SIZE - 1; - } else if (internal_pa || - rtlhal->current_bandtype == - BAND_ON_2_4G) { - if (ofdm_index[i] < - ofdm_min_index_internal_pa) - ofdm_index[i] = - ofdm_min_index_internal_pa; - } else if (cck_index < 0) { - cck_index = 0; - } - } - if (is2t) { - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "new OFDM_A_index=0x%x, OFDM_B_index = 0x%x, cck_index=0x%x\n", - ofdm_index[0], ofdm_index[1], - cck_index); - } else { - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "new OFDM_A_index=0x%x,cck_index = 0x%x\n", - ofdm_index[0], cck_index); - } - ele_d = (ofdmswing_table[(u8) ofdm_index[0]] & - 0xFFC00000) >> 22; - val_x = rtlphy->iqk_matrix - [indexforchannel].value[0][0]; - val_y = rtlphy->iqk_matrix - [indexforchannel].value[0][1]; - if (val_x != 0) { - if ((val_x & 0x00000200) != 0) - val_x = val_x | 0xFFFFFC00; - ele_a = - ((val_x * ele_d) >> 8) & 0x000003FF; - - /* new element C = element D x Y */ - if ((val_y & 0x00000200) != 0) - val_y = val_y | 0xFFFFFC00; - ele_c = ((val_y * ele_d) >> 8) & 0x000003FF; - - /* wirte new elements A, C, D to regC80 and - * regC94, element B is always 0 */ - value32 = (ele_d << 22) | ((ele_c & 0x3F) << - 16) | ele_a; - rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, - BMASKDWORD, value32); - - value32 = (ele_c & 0x000003C0) >> 6; - rtl_set_bbreg(hw, ROFDM0_XCTxAFE, BMASKH4BITS, - value32); - - value32 = ((val_x * ele_d) >> 7) & 0x01; - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(24), - value32); - - } else { - rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, - BMASKDWORD, - ofdmswing_table - [(u8)ofdm_index[0]]); - rtl_set_bbreg(hw, ROFDM0_XCTxAFE, BMASKH4BITS, - 0x00); - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, - BIT(24), 0x00); - } - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "TxPwrTracking for interface %d path A: X = 0x%lx, Y = 0x%lx ele_A = 0x%lx ele_C = 0x%lx ele_D = 0x%lx 0xe94 = 0x%lx 0xe9c = 0x%lx\n", - rtlhal->interfaceindex, - val_x, val_y, ele_a, ele_c, ele_d, - val_x, val_y); - - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - /* Adjust CCK according to IQK result */ - if (!rtlpriv->dm.cck_inch14) { - rtl_write_byte(rtlpriv, 0xa22, - cckswing_table_ch1ch13 - [(u8)cck_index][0]); - rtl_write_byte(rtlpriv, 0xa23, - cckswing_table_ch1ch13 - [(u8)cck_index][1]); - rtl_write_byte(rtlpriv, 0xa24, - cckswing_table_ch1ch13 - [(u8)cck_index][2]); - rtl_write_byte(rtlpriv, 0xa25, - cckswing_table_ch1ch13 - [(u8)cck_index][3]); - rtl_write_byte(rtlpriv, 0xa26, - cckswing_table_ch1ch13 - [(u8)cck_index][4]); - rtl_write_byte(rtlpriv, 0xa27, - cckswing_table_ch1ch13 - [(u8)cck_index][5]); - rtl_write_byte(rtlpriv, 0xa28, - cckswing_table_ch1ch13 - [(u8)cck_index][6]); - rtl_write_byte(rtlpriv, 0xa29, - cckswing_table_ch1ch13 - [(u8)cck_index][7]); - } else { - rtl_write_byte(rtlpriv, 0xa22, - cckswing_table_ch14 - [(u8)cck_index][0]); - rtl_write_byte(rtlpriv, 0xa23, - cckswing_table_ch14 - [(u8)cck_index][1]); - rtl_write_byte(rtlpriv, 0xa24, - cckswing_table_ch14 - [(u8)cck_index][2]); - rtl_write_byte(rtlpriv, 0xa25, - cckswing_table_ch14 - [(u8)cck_index][3]); - rtl_write_byte(rtlpriv, 0xa26, - cckswing_table_ch14 - [(u8)cck_index][4]); - rtl_write_byte(rtlpriv, 0xa27, - cckswing_table_ch14 - [(u8)cck_index][5]); - rtl_write_byte(rtlpriv, 0xa28, - cckswing_table_ch14 - [(u8)cck_index][6]); - rtl_write_byte(rtlpriv, 0xa29, - cckswing_table_ch14 - [(u8)cck_index][7]); - } - } - if (is2t) { - ele_d = (ofdmswing_table[(u8) ofdm_index[1]] & - 0xFFC00000) >> 22; - val_x = rtlphy->iqk_matrix - [indexforchannel].value[0][4]; - val_y = rtlphy->iqk_matrix - [indexforchannel].value[0][5]; - if (val_x != 0) { - if ((val_x & 0x00000200) != 0) - /* consider minus */ - val_x = val_x | 0xFFFFFC00; - ele_a = ((val_x * ele_d) >> 8) & - 0x000003FF; - /* new element C = element D x Y */ - if ((val_y & 0x00000200) != 0) - val_y = - val_y | 0xFFFFFC00; - ele_c = - ((val_y * - ele_d) >> 8) & 0x00003FF; - /* write new elements A, C, D to regC88 - * and regC9C, element B is always 0 - */ - value32 = (ele_d << 22) | - ((ele_c & 0x3F) << 16) | - ele_a; - rtl_set_bbreg(hw, - ROFDM0_XBTxIQIMBALANCE, - BMASKDWORD, value32); - value32 = (ele_c & 0x000003C0) >> 6; - rtl_set_bbreg(hw, ROFDM0_XDTxAFE, - BMASKH4BITS, value32); - value32 = ((val_x * ele_d) >> 7) & 0x01; - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, - BIT(28), value32); - } else { - rtl_set_bbreg(hw, - ROFDM0_XBTxIQIMBALANCE, - BMASKDWORD, - ofdmswing_table - [(u8) ofdm_index[1]]); - rtl_set_bbreg(hw, ROFDM0_XDTxAFE, - BMASKH4BITS, 0x00); - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, - BIT(28), 0x00); - } - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "TxPwrTracking path B: X = 0x%lx, Y = 0x%lx ele_A = 0x%lx ele_C = 0x%lx ele_D = 0x%lx 0xeb4 = 0x%lx 0xebc = 0x%lx\n", - val_x, val_y, ele_a, ele_c, - ele_d, val_x, val_y); - } - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "TxPwrTracking 0xc80 = 0x%x, 0xc94 = 0x%x RF 0x24 = 0x%x\n", - rtl_get_bbreg(hw, 0xc80, BMASKDWORD), - rtl_get_bbreg(hw, 0xc94, BMASKDWORD), - rtl_get_rfreg(hw, RF90_PATH_A, 0x24, - BRFREGOFFSETMASK)); - } - if ((delta_iqk > rtlefuse->delta_iqk) && - (rtlefuse->delta_iqk != 0)) { - rtl92d_phy_reset_iqk_result(hw); - rtlpriv->dm.thermalvalue_iqk = thermalvalue; - rtl92d_phy_iq_calibrate(hw); - } - if (delta_rxgain > 0 && rtlhal->current_bandtype == BAND_ON_5G - && thermalvalue <= rtlefuse->eeprom_thermalmeter) { - rtlpriv->dm.thermalvalue_rxgain = thermalvalue; - rtl92d_dm_rxgain_tracking_thermalmeter(hw); - } - if (rtlpriv->dm.txpower_track_control) - rtlpriv->dm.thermalvalue = thermalvalue; - } - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "<===\n"); -} - -static void rtl92d_dm_initialize_txpower_tracking(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.txpower_tracking = true; - rtlpriv->dm.txpower_trackinginit = false; - rtlpriv->dm.txpower_track_control = true; - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "pMgntInfo->txpower_tracking = %d\n", - rtlpriv->dm.txpower_tracking); -} - -void rtl92d_dm_check_txpower_tracking_thermal_meter(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - static u8 tm_trigger; - - if (!rtlpriv->dm.txpower_tracking) - return; - - if (!tm_trigger) { - rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER, BIT(17) | - BIT(16), 0x03); - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Trigger 92S Thermal Meter!!\n"); - tm_trigger = 1; - return; - } else { - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Schedule TxPowerTracking direct call!!\n"); - rtl92d_dm_txpower_tracking_callback_thermalmeter(hw); - tm_trigger = 0; - } -} - -void rtl92d_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rate_adaptive *ra = &(rtlpriv->ra); - - ra->ratr_state = DM_RATR_STA_INIT; - ra->pre_ratr_state = DM_RATR_STA_INIT; - if (rtlpriv->dm.dm_type == DM_TYPE_BYDRIVER) - rtlpriv->dm.useramask = true; - else - rtlpriv->dm.useramask = false; -} - -void rtl92d_dm_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.dm_type = DM_TYPE_BYDRIVER; - rtl92d_dm_diginit(hw); - rtl92d_dm_init_dynamic_txpower(hw); - rtl92d_dm_init_edca_turbo(hw); - rtl92d_dm_init_rate_adaptive_mask(hw); - rtl92d_dm_initialize_txpower_tracking(hw); -} - -void rtl92d_dm_watchdog(struct ieee80211_hw *hw) -{ - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool fw_current_inpsmode = false; - bool fwps_awake = true; - - /* 1. RF is OFF. (No need to do DM.) - * 2. Fw is under power saving mode for FwLPS. - * (Prevent from SW/FW I/O racing.) - * 3. IPS workitem is scheduled. (Prevent from IPS sequence - * to be swapped with DM. - * 4. RFChangeInProgress is TRUE. - * (Prevent from broken by IPS/HW/SW Rf off.) */ - - if ((ppsc->rfpwr_state == ERFON) && ((!fw_current_inpsmode) && - fwps_awake) && (!ppsc->rfchange_inprogress)) { - rtl92d_dm_pwdb_monitor(hw); - rtl92d_dm_false_alarm_counter_statistics(hw); - rtl92d_dm_find_minimum_rssi(hw); - rtl92d_dm_dig(hw); - /* rtl92d_dm_dynamic_bb_powersaving(hw); */ - rtl92d_dm_dynamic_txpower(hw); - /* rtl92d_dm_check_txpower_tracking_thermal_meter(hw); */ - /* rtl92d_dm_refresh_rate_adaptive_mask(hw); */ - /* rtl92d_dm_interrupt_migration(hw); */ - rtl92d_dm_check_edca_turbo(hw); - } -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/dm.h b/drivers/net/wireless/rtlwifi/rtl8192de/dm.h deleted file mode 100644 index 3fea0c11c24a..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/dm.h +++ /dev/null @@ -1,161 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C_DM_H__ -#define __RTL92C_DM_H__ - -#define HAL_DM_DIG_DISABLE BIT(0) -#define HAL_DM_HIPWR_DISABLE BIT(1) - -#define OFDM_TABLE_LENGTH 37 -#define OFDM_TABLE_SIZE_92D 43 -#define CCK_TABLE_LENGTH 33 - -#define CCK_TABLE_SIZE 33 - -#define BW_AUTO_SWITCH_HIGH_LOW 25 -#define BW_AUTO_SWITCH_LOW_HIGH 30 - -#define DM_DIG_THRESH_HIGH 40 -#define DM_DIG_THRESH_LOW 35 - -#define DM_FALSEALARM_THRESH_LOW 400 -#define DM_FALSEALARM_THRESH_HIGH 1000 - -#define DM_DIG_MAX 0x3e -#define DM_DIG_MIN 0x1c - -#define DM_DIG_FA_UPPER 0x32 -#define DM_DIG_FA_LOWER 0x20 -#define DM_DIG_FA_TH0 0x100 -#define DM_DIG_FA_TH1 0x400 -#define DM_DIG_FA_TH2 0x600 - -#define DM_DIG_BACKOFF_MAX 12 -#define DM_DIG_BACKOFF_MIN -4 -#define DM_DIG_BACKOFF_DEFAULT 10 - -#define RXPATHSELECTION_SS_TH_lOW 30 -#define RXPATHSELECTION_DIFF_TH 18 - -#define DM_RATR_STA_INIT 0 -#define DM_RATR_STA_HIGH 1 -#define DM_RATR_STA_MIDDLE 2 -#define DM_RATR_STA_LOW 3 - -#define CTS2SELF_THVAL 30 -#define REGC38_TH 20 - -#define WAIOTTHVAL 25 - -#define TXHIGHPWRLEVEL_NORMAL 0 -#define TXHIGHPWRLEVEL_LEVEL1 1 -#define TXHIGHPWRLEVEL_LEVEL2 2 -#define TXHIGHPWRLEVEL_BT1 3 -#define TXHIGHPWRLEVEL_BT2 4 - -#define DM_TYPE_BYFW 0 -#define DM_TYPE_BYDRIVER 1 - -#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 -#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 -#define INDEX_MAPPING_NUM 13 - -struct swat { - u8 failure_cnt; - u8 try_flag; - u8 stop_trying; - long pre_rssi; - long trying_threshold; - u8 cur_antenna; - u8 pre_antenna; -}; - -enum tag_dynamic_init_gain_operation_type_definition { - DIG_TYPE_THRESH_HIGH = 0, - DIG_TYPE_THRESH_LOW = 1, - DIG_TYPE_BACKOFF = 2, - DIG_TYPE_RX_GAIN_MIN = 3, - DIG_TYPE_RX_GAIN_MAX = 4, - DIG_TYPE_ENABLE = 5, - DIG_TYPE_DISABLE = 6, - DIG_OP_TYPE_MAX -}; - -enum tag_cck_packet_detection_threshold_type_definition { - CCK_PD_STAGE_LOWRSSI = 0, - CCK_PD_STAGE_HIGHRSSI = 1, - CCK_FA_STAGE_LOW = 2, - CCK_FA_STAGE_HIGH = 3, - CCK_PD_STAGE_MAX = 4, -}; - -enum dm_1r_cca { - CCA_1R = 0, - CCA_2R = 1, - CCA_MAX = 2, -}; - -enum dm_rf { - RF_SAVE = 0, - RF_NORMAL = 1, - RF_MAX = 2, -}; - -enum dm_sw_ant_switch { - ANS_ANTENNA_B = 1, - ANS_ANTENNA_A = 2, - ANS_ANTENNA_MAX = 3, -}; - -enum dm_dig_ext_port_alg { - DIG_EXT_PORT_STAGE_0 = 0, - DIG_EXT_PORT_STAGE_1 = 1, - DIG_EXT_PORT_STAGE_2 = 2, - DIG_EXT_PORT_STAGE_3 = 3, - DIG_EXT_PORT_STAGE_MAX = 4, -}; - -enum dm_dig_connect { - DIG_STA_DISCONNECT = 0, - DIG_STA_CONNECT = 1, - DIG_STA_BEFORE_CONNECT = 2, - DIG_MULTISTA_DISCONNECT = 3, - DIG_MULTISTA_CONNECT = 4, - DIG_CONNECT_MAX -}; - -void rtl92d_dm_init(struct ieee80211_hw *hw); -void rtl92d_dm_watchdog(struct ieee80211_hw *hw); -void rtl92d_dm_init_edca_turbo(struct ieee80211_hw *hw); -void rtl92d_dm_write_dig(struct ieee80211_hw *hw); -void rtl92d_dm_check_txpower_tracking_thermal_meter(struct ieee80211_hw *hw); -void rtl92d_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/fw.c b/drivers/net/wireless/rtlwifi/rtl8192de/fw.c deleted file mode 100644 index 23177076b97f..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/fw.c +++ /dev/null @@ -1,780 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../base.h" -#include "reg.h" -#include "def.h" -#include "fw.h" -#include "sw.h" - -static bool _rtl92d_is_fw_downloaded(struct rtl_priv *rtlpriv) -{ - return (rtl_read_dword(rtlpriv, REG_MCUFWDL) & MCUFWDL_RDY) ? - true : false; -} - -static void _rtl92d_enable_fw_download(struct ieee80211_hw *hw, bool enable) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp; - - if (enable) { - tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, tmp | 0x04); - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL); - rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp | 0x01); - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL + 2); - rtl_write_byte(rtlpriv, REG_MCUFWDL + 2, tmp & 0xf7); - } else { - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL); - rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp & 0xfe); - /* Reserved for fw extension. - * 0x81[7] is used for mac0 status , - * so don't write this reg here - * rtl_write_byte(rtlpriv, REG_MCUFWDL + 1, 0x00);*/ - } -} - -static void _rtl92d_fw_block_write(struct ieee80211_hw *hw, - const u8 *buffer, u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 blocksize = sizeof(u32); - u8 *bufferptr = (u8 *) buffer; - u32 *pu4BytePtr = (u32 *) buffer; - u32 i, offset, blockCount, remainSize; - - blockCount = size / blocksize; - remainSize = size % blocksize; - for (i = 0; i < blockCount; i++) { - offset = i * blocksize; - rtl_write_dword(rtlpriv, (FW_8192D_START_ADDRESS + offset), - *(pu4BytePtr + i)); - } - if (remainSize) { - offset = blockCount * blocksize; - bufferptr += offset; - for (i = 0; i < remainSize; i++) { - rtl_write_byte(rtlpriv, (FW_8192D_START_ADDRESS + - offset + i), *(bufferptr + i)); - } - } -} - -static void _rtl92d_fw_page_write(struct ieee80211_hw *hw, - u32 page, const u8 *buffer, u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 value8; - u8 u8page = (u8) (page & 0x07); - - value8 = (rtl_read_byte(rtlpriv, REG_MCUFWDL + 2) & 0xF8) | u8page; - rtl_write_byte(rtlpriv, (REG_MCUFWDL + 2), value8); - _rtl92d_fw_block_write(hw, buffer, size); -} - -static void _rtl92d_fill_dummy(u8 *pfwbuf, u32 *pfwlen) -{ - u32 fwlen = *pfwlen; - u8 remain = (u8) (fwlen % 4); - - remain = (remain == 0) ? 0 : (4 - remain); - while (remain > 0) { - pfwbuf[fwlen] = 0; - fwlen++; - remain--; - } - *pfwlen = fwlen; -} - -static void _rtl92d_write_fw(struct ieee80211_hw *hw, - enum version_8192d version, u8 *buffer, u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 *bufferPtr = buffer; - u32 pagenums, remainSize; - u32 page, offset; - - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, "FW size is %d bytes,\n", size); - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192DE) - _rtl92d_fill_dummy(bufferPtr, &size); - pagenums = size / FW_8192D_PAGE_SIZE; - remainSize = size % FW_8192D_PAGE_SIZE; - if (pagenums > 8) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Page numbers should not greater then 8\n"); - } - for (page = 0; page < pagenums; page++) { - offset = page * FW_8192D_PAGE_SIZE; - _rtl92d_fw_page_write(hw, page, (bufferPtr + offset), - FW_8192D_PAGE_SIZE); - } - if (remainSize) { - offset = pagenums * FW_8192D_PAGE_SIZE; - page = pagenums; - _rtl92d_fw_page_write(hw, page, (bufferPtr + offset), - remainSize); - } -} - -static int _rtl92d_fw_free_to_go(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 counter = 0; - u32 value32; - - do { - value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - } while ((counter++ < FW_8192D_POLLING_TIMEOUT_COUNT) && - (!(value32 & FWDL_ChkSum_rpt))); - if (counter >= FW_8192D_POLLING_TIMEOUT_COUNT) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "chksum report faill ! REG_MCUFWDL:0x%08x\n", - value32); - return -EIO; - } - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, - "Checksum report OK ! REG_MCUFWDL:0x%08x\n", value32); - value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - value32 |= MCUFWDL_RDY; - rtl_write_dword(rtlpriv, REG_MCUFWDL, value32); - return 0; -} - -void rtl92d_firmware_selfreset(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 u1b_tmp; - u8 delay = 100; - - /* Set (REG_HMETFR + 3) to 0x20 is reset 8051 */ - rtl_write_byte(rtlpriv, REG_HMETFR + 3, 0x20); - u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - while (u1b_tmp & BIT(2)) { - delay--; - if (delay == 0) - break; - udelay(50); - u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - } - RT_ASSERT((delay > 0), "8051 reset failed!\n"); - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, - "=====> 8051 reset success (%d)\n", delay); -} - -static int _rtl92d_fw_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u32 counter; - - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, "FW already have download\n"); - /* polling for FW ready */ - counter = 0; - do { - if (rtlhal->interfaceindex == 0) { - if (rtl_read_byte(rtlpriv, FW_MAC0_READY) & - MAC0_READY) { - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, - "Polling FW ready success!! REG_MCUFWDL: 0x%x\n", - rtl_read_byte(rtlpriv, - FW_MAC0_READY)); - return 0; - } - udelay(5); - } else { - if (rtl_read_byte(rtlpriv, FW_MAC1_READY) & - MAC1_READY) { - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, - "Polling FW ready success!! REG_MCUFWDL: 0x%x\n", - rtl_read_byte(rtlpriv, - FW_MAC1_READY)); - return 0; - } - udelay(5); - } - } while (counter++ < POLLING_READY_TIMEOUT_COUNT); - - if (rtlhal->interfaceindex == 0) { - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, - "Polling FW ready fail!! MAC0 FW init not ready: 0x%x\n", - rtl_read_byte(rtlpriv, FW_MAC0_READY)); - } else { - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, - "Polling FW ready fail!! MAC1 FW init not ready: 0x%x\n", - rtl_read_byte(rtlpriv, FW_MAC1_READY)); - } - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, - "Polling FW ready fail!! REG_MCUFWDL:0x%08ul\n", - rtl_read_dword(rtlpriv, REG_MCUFWDL)); - return -1; -} - -int rtl92d_download_fw(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 *pfwheader; - u8 *pfwdata; - u32 fwsize; - int err; - enum version_8192d version = rtlhal->version; - u8 value; - u32 count; - bool fw_downloaded = false, fwdl_in_process = false; - unsigned long flags; - - if (rtlpriv->max_fw_size == 0 || !rtlhal->pfirmware) - return 1; - fwsize = rtlhal->fwsize; - pfwheader = rtlhal->pfirmware; - pfwdata = rtlhal->pfirmware; - rtlhal->fw_version = (u16) GET_FIRMWARE_HDR_VERSION(pfwheader); - rtlhal->fw_subversion = (u16) GET_FIRMWARE_HDR_SUB_VER(pfwheader); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "FirmwareVersion(%d), FirmwareSubVersion(%d), Signature(%#x)\n", - rtlhal->fw_version, rtlhal->fw_subversion, - GET_FIRMWARE_HDR_SIGNATURE(pfwheader)); - if (IS_FW_HEADER_EXIST(pfwheader)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Shift 32 bytes for FW header!!\n"); - pfwdata = pfwdata + 32; - fwsize = fwsize - 32; - } - - spin_lock_irqsave(&globalmutex_for_fwdownload, flags); - fw_downloaded = _rtl92d_is_fw_downloaded(rtlpriv); - if ((rtl_read_byte(rtlpriv, 0x1f) & BIT(5)) == BIT(5)) - fwdl_in_process = true; - else - fwdl_in_process = false; - if (fw_downloaded) { - spin_unlock_irqrestore(&globalmutex_for_fwdownload, flags); - goto exit; - } else if (fwdl_in_process) { - spin_unlock_irqrestore(&globalmutex_for_fwdownload, flags); - for (count = 0; count < 5000; count++) { - udelay(500); - spin_lock_irqsave(&globalmutex_for_fwdownload, flags); - fw_downloaded = _rtl92d_is_fw_downloaded(rtlpriv); - if ((rtl_read_byte(rtlpriv, 0x1f) & BIT(5)) == BIT(5)) - fwdl_in_process = true; - else - fwdl_in_process = false; - spin_unlock_irqrestore(&globalmutex_for_fwdownload, - flags); - if (fw_downloaded) - goto exit; - else if (!fwdl_in_process) - break; - else - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, - "Wait for another mac download fw\n"); - } - spin_lock_irqsave(&globalmutex_for_fwdownload, flags); - value = rtl_read_byte(rtlpriv, 0x1f); - value |= BIT(5); - rtl_write_byte(rtlpriv, 0x1f, value); - spin_unlock_irqrestore(&globalmutex_for_fwdownload, flags); - } else { - value = rtl_read_byte(rtlpriv, 0x1f); - value |= BIT(5); - rtl_write_byte(rtlpriv, 0x1f, value); - spin_unlock_irqrestore(&globalmutex_for_fwdownload, flags); - } - - /* If 8051 is running in RAM code, driver should - * inform Fw to reset by itself, or it will cause - * download Fw fail.*/ - /* 8051 RAM code */ - if (rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(7)) { - rtl92d_firmware_selfreset(hw); - rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x00); - } - _rtl92d_enable_fw_download(hw, true); - _rtl92d_write_fw(hw, version, pfwdata, fwsize); - _rtl92d_enable_fw_download(hw, false); - spin_lock_irqsave(&globalmutex_for_fwdownload, flags); - err = _rtl92d_fw_free_to_go(hw); - /* download fw over,clear 0x1f[5] */ - value = rtl_read_byte(rtlpriv, 0x1f); - value &= (~BIT(5)); - rtl_write_byte(rtlpriv, 0x1f, value); - spin_unlock_irqrestore(&globalmutex_for_fwdownload, flags); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "fw is not ready to run!\n"); - goto exit; - } else { - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, "fw is ready to run!\n"); - } -exit: - err = _rtl92d_fw_init(hw); - return err; -} - -static bool _rtl92d_check_fw_read_last_h2c(struct ieee80211_hw *hw, u8 boxnum) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 val_hmetfr; - bool result = false; - - val_hmetfr = rtl_read_byte(rtlpriv, REG_HMETFR); - if (((val_hmetfr >> boxnum) & BIT(0)) == 0) - result = true; - return result; -} - -static void _rtl92d_fill_h2c_command(struct ieee80211_hw *hw, - u8 element_id, u32 cmd_len, u8 *cmdbuffer) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - u8 boxnum; - u16 box_reg = 0, box_extreg = 0; - u8 u1b_tmp; - bool isfw_read = false; - u8 buf_index = 0; - bool bwrite_success = false; - u8 wait_h2c_limmit = 100; - u8 wait_writeh2c_limmit = 100; - u8 boxcontent[4], boxextcontent[2]; - u32 h2c_waitcounter = 0; - unsigned long flag; - u8 idx; - - if (ppsc->rfpwr_state == ERFOFF || ppsc->inactive_pwrstate == ERFOFF) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Return as RF is off!!!\n"); - return; - } - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "come in\n"); - while (true) { - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag); - if (rtlhal->h2c_setinprogress) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "H2C set in progress! Wait to set..element_id(%d)\n", - element_id); - - while (rtlhal->h2c_setinprogress) { - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, - flag); - h2c_waitcounter++; - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Wait 100 us (%d times)...\n", - h2c_waitcounter); - udelay(100); - - if (h2c_waitcounter > 1000) - return; - - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, - flag); - } - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - } else { - rtlhal->h2c_setinprogress = true; - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - break; - } - } - while (!bwrite_success) { - wait_writeh2c_limmit--; - if (wait_writeh2c_limmit == 0) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Write H2C fail because no trigger for FW INT!\n"); - break; - } - boxnum = rtlhal->last_hmeboxnum; - switch (boxnum) { - case 0: - box_reg = REG_HMEBOX_0; - box_extreg = REG_HMEBOX_EXT_0; - break; - case 1: - box_reg = REG_HMEBOX_1; - box_extreg = REG_HMEBOX_EXT_1; - break; - case 2: - box_reg = REG_HMEBOX_2; - box_extreg = REG_HMEBOX_EXT_2; - break; - case 3: - box_reg = REG_HMEBOX_3; - box_extreg = REG_HMEBOX_EXT_3; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - isfw_read = _rtl92d_check_fw_read_last_h2c(hw, boxnum); - while (!isfw_read) { - wait_h2c_limmit--; - if (wait_h2c_limmit == 0) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Waiting too long for FW read clear HMEBox(%d)!\n", - boxnum); - break; - } - udelay(10); - isfw_read = _rtl92d_check_fw_read_last_h2c(hw, boxnum); - u1b_tmp = rtl_read_byte(rtlpriv, 0x1BF); - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Waiting for FW read clear HMEBox(%d)!!! 0x1BF = %2x\n", - boxnum, u1b_tmp); - } - if (!isfw_read) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Write H2C register BOX[%d] fail!!!!! Fw do not read.\n", - boxnum); - break; - } - memset(boxcontent, 0, sizeof(boxcontent)); - memset(boxextcontent, 0, sizeof(boxextcontent)); - boxcontent[0] = element_id; - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Write element_id box_reg(%4x) = %2x\n", - box_reg, element_id); - switch (cmd_len) { - case 1: - boxcontent[0] &= ~(BIT(7)); - memcpy(boxcontent + 1, cmdbuffer + buf_index, 1); - for (idx = 0; idx < 4; idx++) - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - break; - case 2: - boxcontent[0] &= ~(BIT(7)); - memcpy(boxcontent + 1, cmdbuffer + buf_index, 2); - for (idx = 0; idx < 4; idx++) - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - break; - case 3: - boxcontent[0] &= ~(BIT(7)); - memcpy(boxcontent + 1, cmdbuffer + buf_index, 3); - for (idx = 0; idx < 4; idx++) - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - break; - case 4: - boxcontent[0] |= (BIT(7)); - memcpy(boxextcontent, cmdbuffer + buf_index, 2); - memcpy(boxcontent + 1, cmdbuffer + buf_index + 2, 2); - for (idx = 0; idx < 2; idx++) - rtl_write_byte(rtlpriv, box_extreg + idx, - boxextcontent[idx]); - for (idx = 0; idx < 4; idx++) - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - break; - case 5: - boxcontent[0] |= (BIT(7)); - memcpy(boxextcontent, cmdbuffer + buf_index, 2); - memcpy(boxcontent + 1, cmdbuffer + buf_index + 2, 3); - for (idx = 0; idx < 2; idx++) - rtl_write_byte(rtlpriv, box_extreg + idx, - boxextcontent[idx]); - for (idx = 0; idx < 4; idx++) - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - bwrite_success = true; - rtlhal->last_hmeboxnum = boxnum + 1; - if (rtlhal->last_hmeboxnum == 4) - rtlhal->last_hmeboxnum = 0; - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "pHalData->last_hmeboxnum = %d\n", - rtlhal->last_hmeboxnum); - } - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag); - rtlhal->h2c_setinprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "go out\n"); -} - -void rtl92d_fill_h2c_cmd(struct ieee80211_hw *hw, - u8 element_id, u32 cmd_len, u8 *cmdbuffer) -{ - u32 tmp_cmdbuf[2]; - - memset(tmp_cmdbuf, 0, 8); - memcpy(tmp_cmdbuf, cmdbuffer, cmd_len); - _rtl92d_fill_h2c_command(hw, element_id, cmd_len, (u8 *)&tmp_cmdbuf); - return; -} - -void rtl92d_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 u1_h2c_set_pwrmode[3] = { 0 }; - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "FW LPS mode = %d\n", mode); - SET_H2CCMD_PWRMODE_PARM_MODE(u1_h2c_set_pwrmode, mode); - SET_H2CCMD_PWRMODE_PARM_SMART_PS(u1_h2c_set_pwrmode, 1); - SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(u1_h2c_set_pwrmode, - ppsc->reg_max_lps_awakeintvl); - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "rtl92d_set_fw_rsvdpagepkt(): u1_h2c_set_pwrmode", - u1_h2c_set_pwrmode, 3); - rtl92d_fill_h2c_cmd(hw, H2C_SETPWRMODE, 3, u1_h2c_set_pwrmode); -} - -static bool _rtl92d_cmd_send_packet(struct ieee80211_hw *hw, - struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl8192_tx_ring *ring; - struct rtl_tx_desc *pdesc; - u8 idx = 0; - unsigned long flags; - struct sk_buff *pskb; - - ring = &rtlpci->tx_ring[BEACON_QUEUE]; - pskb = __skb_dequeue(&ring->queue); - kfree_skb(pskb); - spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); - pdesc = &ring->desc[idx]; - /* discard output from call below */ - rtlpriv->cfg->ops->get_desc((u8 *) pdesc, true, HW_DESC_OWN); - rtlpriv->cfg->ops->fill_tx_cmddesc(hw, (u8 *) pdesc, 1, 1, skb); - __skb_queue_tail(&ring->queue, skb); - spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); - rtlpriv->cfg->ops->tx_polling(hw, BEACON_QUEUE); - return true; -} - -#define BEACON_PG 0 /*->1 */ -#define PSPOLL_PG 2 -#define NULL_PG 3 -#define PROBERSP_PG 4 /*->5 */ -#define TOTAL_RESERVED_PKT_LEN 768 - -static u8 reserved_page_packet[TOTAL_RESERVED_PKT_LEN] = { - /* page 0 beacon */ - 0x80, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x50, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x64, 0x00, 0x00, 0x04, 0x00, 0x0C, 0x6C, 0x69, - 0x6E, 0x6B, 0x73, 0x79, 0x73, 0x5F, 0x77, 0x6C, - 0x61, 0x6E, 0x01, 0x04, 0x82, 0x84, 0x8B, 0x96, - 0x03, 0x01, 0x01, 0x06, 0x02, 0x00, 0x00, 0x2A, - 0x01, 0x00, 0x32, 0x08, 0x24, 0x30, 0x48, 0x6C, - 0x0C, 0x12, 0x18, 0x60, 0x2D, 0x1A, 0x6C, 0x18, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3D, 0x00, 0xDD, 0x06, 0x00, 0xE0, 0x4C, 0x02, - 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 1 beacon */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 2 ps-poll */ - 0xA4, 0x10, 0x01, 0xC0, 0x00, 0x40, 0x10, 0x10, - 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 3 null */ - 0x48, 0x01, 0x00, 0x00, 0x00, 0x40, 0x10, 0x10, - 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x72, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 4 probe_resp */ - 0x50, 0x00, 0x00, 0x00, 0x00, 0x40, 0x10, 0x10, - 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, - 0x9E, 0x46, 0x15, 0x32, 0x27, 0xF2, 0x2D, 0x00, - 0x64, 0x00, 0x00, 0x04, 0x00, 0x0C, 0x6C, 0x69, - 0x6E, 0x6B, 0x73, 0x79, 0x73, 0x5F, 0x77, 0x6C, - 0x61, 0x6E, 0x01, 0x04, 0x82, 0x84, 0x8B, 0x96, - 0x03, 0x01, 0x01, 0x06, 0x02, 0x00, 0x00, 0x2A, - 0x01, 0x00, 0x32, 0x08, 0x24, 0x30, 0x48, 0x6C, - 0x0C, 0x12, 0x18, 0x60, 0x2D, 0x1A, 0x6C, 0x18, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3D, 0x00, 0xDD, 0x06, 0x00, 0xE0, 0x4C, 0x02, - 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 5 probe_resp */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct sk_buff *skb = NULL; - u32 totalpacketlen; - bool rtstatus; - u8 u1RsvdPageLoc[3] = { 0 }; - bool dlok = false; - u8 *beacon; - u8 *p_pspoll; - u8 *nullfunc; - u8 *p_probersp; - /*--------------------------------------------------------- - (1) beacon - ---------------------------------------------------------*/ - beacon = &reserved_page_packet[BEACON_PG * 128]; - SET_80211_HDR_ADDRESS2(beacon, mac->mac_addr); - SET_80211_HDR_ADDRESS3(beacon, mac->bssid); - /*------------------------------------------------------- - (2) ps-poll - --------------------------------------------------------*/ - p_pspoll = &reserved_page_packet[PSPOLL_PG * 128]; - SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000)); - SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid); - SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr); - SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG); - /*-------------------------------------------------------- - (3) null data - ---------------------------------------------------------*/ - nullfunc = &reserved_page_packet[NULL_PG * 128]; - SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid); - SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr); - SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid); - SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1RsvdPageLoc, NULL_PG); - /*--------------------------------------------------------- - (4) probe response - ----------------------------------------------------------*/ - p_probersp = &reserved_page_packet[PROBERSP_PG * 128]; - SET_80211_HDR_ADDRESS1(p_probersp, mac->bssid); - SET_80211_HDR_ADDRESS2(p_probersp, mac->mac_addr); - SET_80211_HDR_ADDRESS3(p_probersp, mac->bssid); - SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1RsvdPageLoc, PROBERSP_PG); - totalpacketlen = TOTAL_RESERVED_PKT_LEN; - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, - "rtl92d_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL", - &reserved_page_packet[0], totalpacketlen); - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "rtl92d_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL", - u1RsvdPageLoc, 3); - skb = dev_alloc_skb(totalpacketlen); - if (!skb) { - dlok = false; - } else { - memcpy((u8 *) skb_put(skb, totalpacketlen), - &reserved_page_packet, totalpacketlen); - rtstatus = _rtl92d_cmd_send_packet(hw, skb); - - if (rtstatus) - dlok = true; - } - if (dlok) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Set RSVD page location to Fw\n"); - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "H2C_RSVDPAGE", u1RsvdPageLoc, 3); - rtl92d_fill_h2c_cmd(hw, H2C_RSVDPAGE, - sizeof(u1RsvdPageLoc), u1RsvdPageLoc); - } else - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Set RSVD page location to Fw FAIL!!!!!!\n"); -} - -void rtl92d_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus) -{ - u8 u1_joinbssrpt_parm[1] = {0}; - - SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(u1_joinbssrpt_parm, mstatus); - rtl92d_fill_h2c_cmd(hw, H2C_JOINBSSRPT, 1, u1_joinbssrpt_parm); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/fw.h b/drivers/net/wireless/rtlwifi/rtl8192de/fw.h deleted file mode 100644 index 1ffacdda734c..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/fw.h +++ /dev/null @@ -1,155 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92D__FW__H__ -#define __RTL92D__FW__H__ - -#define FW_8192D_START_ADDRESS 0x1000 -#define FW_8192D_PAGE_SIZE 4096 -#define FW_8192D_POLLING_TIMEOUT_COUNT 1000 - -#define IS_FW_HEADER_EXIST(_pfwhdr) \ - ((GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFF0) == 0x92C0 || \ - (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFF0) == 0x88C0 || \ - (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFFF) == 0x92D0 || \ - (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFFF) == 0x92D1 || \ - (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFFF) == 0x92D2 || \ - (GET_FIRMWARE_HDR_SIGNATURE(_pfwhdr) & 0xFFFF) == 0x92D3) - -/* Define a macro that takes an le32 word, converts it to host ordering, - * right shifts by a specified count, creates a mask of the specified - * bit count, and extracts that number of bits. - */ - -#define SHIFT_AND_MASK_LE(__pdesc, __shift, __mask) \ - ((le32_to_cpu(*(((__le32 *)(__pdesc)))) >> (__shift)) & \ - BIT_LEN_MASK_32(__mask)) - -/* Firmware Header(8-byte alinment required) */ -/* --- LONG WORD 0 ---- */ -#define GET_FIRMWARE_HDR_SIGNATURE(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr, 0, 16) -#define GET_FIRMWARE_HDR_CATEGORY(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr, 16, 8) -#define GET_FIRMWARE_HDR_FUNCTION(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr, 24, 8) -#define GET_FIRMWARE_HDR_VERSION(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr + 4, 0, 16) -#define GET_FIRMWARE_HDR_SUB_VER(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr + 4, 16, 8) -#define GET_FIRMWARE_HDR_RSVD1(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr + 4, 24, 8) - -/* --- LONG WORD 1 ---- */ -#define GET_FIRMWARE_HDR_MONTH(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr + 8, 0, 8) -#define GET_FIRMWARE_HDR_DATE(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr + 8, 8, 8) -#define GET_FIRMWARE_HDR_HOUR(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr + 8, 16, 8) -#define GET_FIRMWARE_HDR_MINUTE(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr + 8, 24, 8) -#define GET_FIRMWARE_HDR_ROMCODE_SIZE(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr + 12, 0, 16) -#define GET_FIRMWARE_HDR_RSVD2(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr + 12, 16, 16) - -/* --- LONG WORD 2 ---- */ -#define GET_FIRMWARE_HDR_SVN_IDX(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr + 16, 0, 32) -#define GET_FIRMWARE_HDR_RSVD3(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr + 20, 0, 32) - -/* --- LONG WORD 3 ---- */ -#define GET_FIRMWARE_HDR_RSVD4(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr + 24, 0, 32) -#define GET_FIRMWARE_HDR_RSVD5(__fwhdr) \ - SHIFT_AND_MASK_LE(__fwhdr + 28, 0, 32) - -#define pagenum_128(_len) \ - (u32)(((_len) >> 7) + ((_len) & 0x7F ? 1 : 0)) - -#define SET_H2CCMD_PWRMODE_PARM_MODE(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_PWRMODE_PARM_SMART_PS(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd) + 1, 0, 8, __val) -#define SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd) + 2, 0, 8, __val) -#define SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd) + 1, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd) + 2, 0, 8, __val) - -struct rtl92d_firmware_header { - u16 signature; - u8 category; - u8 function; - u16 version; - u8 subversion; - u8 rsvd1; - - u8 month; - u8 date; - u8 hour; - u8 minute; - u16 ramcodeSize; - u16 rsvd2; - - u32 svnindex; - u32 rsvd3; - - u32 rsvd4; - u32 rsvd5; -}; - -enum rtl8192d_h2c_cmd { - H2C_AP_OFFLOAD = 0, - H2C_SETPWRMODE = 1, - H2C_JOINBSSRPT = 2, - H2C_RSVDPAGE = 3, - H2C_RSSI_REPORT = 5, - H2C_RA_MASK = 6, - H2C_MAC_MODE_SEL = 9, - H2C_PWRM = 15, - MAX_H2CCMD -}; - -int rtl92d_download_fw(struct ieee80211_hw *hw); -void rtl92d_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id, - u32 cmd_len, u8 *p_cmdbuffer); -void rtl92d_firmware_selfreset(struct ieee80211_hw *hw); -void rtl92d_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); -void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished); -void rtl92d_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/rtlwifi/rtl8192de/hw.c deleted file mode 100644 index 7dd8f6de0550..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/hw.c +++ /dev/null @@ -1,2323 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../efuse.h" -#include "../base.h" -#include "../regd.h" -#include "../cam.h" -#include "../ps.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "fw.h" -#include "led.h" -#include "sw.h" -#include "hw.h" - -u32 rtl92de_read_dword_dbi(struct ieee80211_hw *hw, u16 offset, u8 direct) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 value; - - rtl_write_word(rtlpriv, REG_DBI_CTRL, (offset & 0xFFC)); - rtl_write_byte(rtlpriv, REG_DBI_FLAG, BIT(1) | direct); - udelay(10); - value = rtl_read_dword(rtlpriv, REG_DBI_RDATA); - return value; -} - -void rtl92de_write_dword_dbi(struct ieee80211_hw *hw, - u16 offset, u32 value, u8 direct) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_word(rtlpriv, REG_DBI_CTRL, ((offset & 0xFFC) | 0xF000)); - rtl_write_dword(rtlpriv, REG_DBI_WDATA, value); - rtl_write_byte(rtlpriv, REG_DBI_FLAG, BIT(0) | direct); -} - -static void _rtl92de_set_bcn_ctrl_reg(struct ieee80211_hw *hw, - u8 set_bits, u8 clear_bits) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpci->reg_bcn_ctrl_val |= set_bits; - rtlpci->reg_bcn_ctrl_val &= ~clear_bits; - rtl_write_byte(rtlpriv, REG_BCN_CTRL, (u8) rtlpci->reg_bcn_ctrl_val); -} - -static void _rtl92de_stop_tx_beacon(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp1byte; - - tmp1byte = rtl_read_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2); - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, tmp1byte & (~BIT(6))); - rtl_write_byte(rtlpriv, REG_BCN_MAX_ERR, 0xff); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0x64); - tmp1byte = rtl_read_byte(rtlpriv, REG_TBTT_PROHIBIT + 2); - tmp1byte &= ~(BIT(0)); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 2, tmp1byte); -} - -static void _rtl92de_resume_tx_beacon(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp1byte; - - tmp1byte = rtl_read_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2); - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, tmp1byte | BIT(6)); - rtl_write_byte(rtlpriv, REG_BCN_MAX_ERR, 0x0a); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0xff); - tmp1byte = rtl_read_byte(rtlpriv, REG_TBTT_PROHIBIT + 2); - tmp1byte |= BIT(0); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 2, tmp1byte); -} - -static void _rtl92de_enable_bcn_sub_func(struct ieee80211_hw *hw) -{ - _rtl92de_set_bcn_ctrl_reg(hw, 0, BIT(1)); -} - -static void _rtl92de_disable_bcn_sub_func(struct ieee80211_hw *hw) -{ - _rtl92de_set_bcn_ctrl_reg(hw, BIT(1), 0); -} - -void rtl92de_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - switch (variable) { - case HW_VAR_RCR: - *((u32 *) (val)) = rtlpci->receive_config; - break; - case HW_VAR_RF_STATE: - *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state; - break; - case HW_VAR_FWLPS_RF_ON:{ - enum rf_pwrstate rfState; - u32 val_rcr; - - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RF_STATE, - (u8 *) (&rfState)); - if (rfState == ERFOFF) { - *((bool *) (val)) = true; - } else { - val_rcr = rtl_read_dword(rtlpriv, REG_RCR); - val_rcr &= 0x00070000; - if (val_rcr) - *((bool *) (val)) = false; - else - *((bool *) (val)) = true; - } - break; - } - case HW_VAR_FW_PSMODE_STATUS: - *((bool *) (val)) = ppsc->fw_current_inpsmode; - break; - case HW_VAR_CORRECT_TSF:{ - u64 tsf; - u32 *ptsf_low = (u32 *)&tsf; - u32 *ptsf_high = ((u32 *)&tsf) + 1; - - *ptsf_high = rtl_read_dword(rtlpriv, (REG_TSFTR + 4)); - *ptsf_low = rtl_read_dword(rtlpriv, REG_TSFTR); - *((u64 *) (val)) = tsf; - break; - } - case HW_VAR_INT_MIGRATION: - *((bool *)(val)) = rtlpriv->dm.interrupt_migration; - break; - case HW_VAR_INT_AC: - *((bool *)(val)) = rtlpriv->dm.disable_tx_int; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } -} - -void rtl92de_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - u8 idx; - - switch (variable) { - case HW_VAR_ETHER_ADDR: - for (idx = 0; idx < ETH_ALEN; idx++) { - rtl_write_byte(rtlpriv, (REG_MACID + idx), - val[idx]); - } - break; - case HW_VAR_BASIC_RATE: { - u16 rate_cfg = ((u16 *) val)[0]; - u8 rate_index = 0; - - rate_cfg = rate_cfg & 0x15f; - if (mac->vendor == PEER_CISCO && - ((rate_cfg & 0x150) == 0)) - rate_cfg |= 0x01; - rtl_write_byte(rtlpriv, REG_RRSR, rate_cfg & 0xff); - rtl_write_byte(rtlpriv, REG_RRSR + 1, - (rate_cfg >> 8) & 0xff); - while (rate_cfg > 0x1) { - rate_cfg = (rate_cfg >> 1); - rate_index++; - } - if (rtlhal->fw_version > 0xe) - rtl_write_byte(rtlpriv, REG_INIRTS_RATE_SEL, - rate_index); - break; - } - case HW_VAR_BSSID: - for (idx = 0; idx < ETH_ALEN; idx++) { - rtl_write_byte(rtlpriv, (REG_BSSID + idx), - val[idx]); - } - break; - case HW_VAR_SIFS: - rtl_write_byte(rtlpriv, REG_SIFS_CTX + 1, val[0]); - rtl_write_byte(rtlpriv, REG_SIFS_TRX + 1, val[1]); - rtl_write_byte(rtlpriv, REG_SPEC_SIFS + 1, val[0]); - rtl_write_byte(rtlpriv, REG_MAC_SPEC_SIFS + 1, val[0]); - if (!mac->ht_enable) - rtl_write_word(rtlpriv, REG_RESP_SIFS_OFDM, - 0x0e0e); - else - rtl_write_word(rtlpriv, REG_RESP_SIFS_OFDM, - *((u16 *) val)); - break; - case HW_VAR_SLOT_TIME: { - u8 e_aci; - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "HW_VAR_SLOT_TIME %x\n", val[0]); - rtl_write_byte(rtlpriv, REG_SLOT, val[0]); - for (e_aci = 0; e_aci < AC_MAX; e_aci++) - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_AC_PARAM, - (&e_aci)); - break; - } - case HW_VAR_ACK_PREAMBLE: { - u8 reg_tmp; - u8 short_preamble = (bool) (*val); - - reg_tmp = (mac->cur_40_prime_sc) << 5; - if (short_preamble) - reg_tmp |= 0x80; - rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_tmp); - break; - } - case HW_VAR_AMPDU_MIN_SPACE: { - u8 min_spacing_to_set; - u8 sec_min_space; - - min_spacing_to_set = *val; - if (min_spacing_to_set <= 7) { - sec_min_space = 0; - if (min_spacing_to_set < sec_min_space) - min_spacing_to_set = sec_min_space; - mac->min_space_cfg = ((mac->min_space_cfg & 0xf8) | - min_spacing_to_set); - *val = min_spacing_to_set; - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_AMPDU_MIN_SPACE: %#x\n", - mac->min_space_cfg); - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, - mac->min_space_cfg); - } - break; - } - case HW_VAR_SHORTGI_DENSITY: { - u8 density_to_set; - - density_to_set = *val; - mac->min_space_cfg = rtlpriv->rtlhal.minspace_cfg; - mac->min_space_cfg |= (density_to_set << 3); - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_SHORTGI_DENSITY: %#x\n", - mac->min_space_cfg); - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, - mac->min_space_cfg); - break; - } - case HW_VAR_AMPDU_FACTOR: { - u8 factor_toset; - u32 regtoSet; - u8 *ptmp_byte = NULL; - u8 index; - - if (rtlhal->macphymode == DUALMAC_DUALPHY) - regtoSet = 0xb9726641; - else if (rtlhal->macphymode == DUALMAC_SINGLEPHY) - regtoSet = 0x66626641; - else - regtoSet = 0xb972a841; - factor_toset = *val; - if (factor_toset <= 3) { - factor_toset = (1 << (factor_toset + 2)); - if (factor_toset > 0xf) - factor_toset = 0xf; - for (index = 0; index < 4; index++) { - ptmp_byte = (u8 *) (®toSet) + index; - if ((*ptmp_byte & 0xf0) > - (factor_toset << 4)) - *ptmp_byte = (*ptmp_byte & 0x0f) - | (factor_toset << 4); - if ((*ptmp_byte & 0x0f) > factor_toset) - *ptmp_byte = (*ptmp_byte & 0xf0) - | (factor_toset); - } - rtl_write_dword(rtlpriv, REG_AGGLEN_LMT, regtoSet); - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_AMPDU_FACTOR: %#x\n", - factor_toset); - } - break; - } - case HW_VAR_AC_PARAM: { - u8 e_aci = *val; - rtl92d_dm_init_edca_turbo(hw); - if (rtlpci->acm_method != eAcmWay2_SW) - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ACM_CTRL, - &e_aci); - break; - } - case HW_VAR_ACM_CTRL: { - u8 e_aci = *val; - union aci_aifsn *p_aci_aifsn = - (union aci_aifsn *)(&(mac->ac[0].aifs)); - u8 acm = p_aci_aifsn->f.acm; - u8 acm_ctrl = rtl_read_byte(rtlpriv, REG_ACMHWCTRL); - - acm_ctrl = acm_ctrl | ((rtlpci->acm_method == 2) ? 0x0 : 0x1); - if (acm) { - switch (e_aci) { - case AC0_BE: - acm_ctrl |= ACMHW_BEQEN; - break; - case AC2_VI: - acm_ctrl |= ACMHW_VIQEN; - break; - case AC3_VO: - acm_ctrl |= ACMHW_VOQEN; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "HW_VAR_ACM_CTRL acm set failed: eACI is %d\n", - acm); - break; - } - } else { - switch (e_aci) { - case AC0_BE: - acm_ctrl &= (~ACMHW_BEQEN); - break; - case AC2_VI: - acm_ctrl &= (~ACMHW_VIQEN); - break; - case AC3_VO: - acm_ctrl &= (~ACMHW_VOQEN); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - } - RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE, - "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", - acm_ctrl); - rtl_write_byte(rtlpriv, REG_ACMHWCTRL, acm_ctrl); - break; - } - case HW_VAR_RCR: - rtl_write_dword(rtlpriv, REG_RCR, ((u32 *) (val))[0]); - rtlpci->receive_config = ((u32 *) (val))[0]; - break; - case HW_VAR_RETRY_LIMIT: { - u8 retry_limit = val[0]; - - rtl_write_word(rtlpriv, REG_RL, - retry_limit << RETRY_LIMIT_SHORT_SHIFT | - retry_limit << RETRY_LIMIT_LONG_SHIFT); - break; - } - case HW_VAR_DUAL_TSF_RST: - rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, (BIT(0) | BIT(1))); - break; - case HW_VAR_EFUSE_BYTES: - rtlefuse->efuse_usedbytes = *((u16 *) val); - break; - case HW_VAR_EFUSE_USAGE: - rtlefuse->efuse_usedpercentage = *val; - break; - case HW_VAR_IO_CMD: - rtl92d_phy_set_io_cmd(hw, (*(enum io_type *)val)); - break; - case HW_VAR_WPA_CONFIG: - rtl_write_byte(rtlpriv, REG_SECCFG, *val); - break; - case HW_VAR_SET_RPWM: - rtl92d_fill_h2c_cmd(hw, H2C_PWRM, 1, (val)); - break; - case HW_VAR_H2C_FW_PWRMODE: - break; - case HW_VAR_FW_PSMODE_STATUS: - ppsc->fw_current_inpsmode = *((bool *) val); - break; - case HW_VAR_H2C_FW_JOINBSSRPT: { - u8 mstatus = (*val); - u8 tmp_regcr, tmp_reg422; - bool recover = false; - - if (mstatus == RT_MEDIA_CONNECT) { - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_AID, NULL); - tmp_regcr = rtl_read_byte(rtlpriv, REG_CR + 1); - rtl_write_byte(rtlpriv, REG_CR + 1, - (tmp_regcr | BIT(0))); - _rtl92de_set_bcn_ctrl_reg(hw, 0, BIT(3)); - _rtl92de_set_bcn_ctrl_reg(hw, BIT(4), 0); - tmp_reg422 = rtl_read_byte(rtlpriv, - REG_FWHW_TXQ_CTRL + 2); - if (tmp_reg422 & BIT(6)) - recover = true; - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, - tmp_reg422 & (~BIT(6))); - rtl92d_set_fw_rsvdpagepkt(hw, 0); - _rtl92de_set_bcn_ctrl_reg(hw, BIT(3), 0); - _rtl92de_set_bcn_ctrl_reg(hw, 0, BIT(4)); - if (recover) - rtl_write_byte(rtlpriv, - REG_FWHW_TXQ_CTRL + 2, - tmp_reg422); - rtl_write_byte(rtlpriv, REG_CR + 1, - (tmp_regcr & ~(BIT(0)))); - } - rtl92d_set_fw_joinbss_report_cmd(hw, (*val)); - break; - } - case HW_VAR_AID: { - u16 u2btmp; - u2btmp = rtl_read_word(rtlpriv, REG_BCN_PSR_RPT); - u2btmp &= 0xC000; - rtl_write_word(rtlpriv, REG_BCN_PSR_RPT, (u2btmp | - mac->assoc_id)); - break; - } - case HW_VAR_CORRECT_TSF: { - u8 btype_ibss = val[0]; - - if (btype_ibss) - _rtl92de_stop_tx_beacon(hw); - _rtl92de_set_bcn_ctrl_reg(hw, 0, BIT(3)); - rtl_write_dword(rtlpriv, REG_TSFTR, - (u32) (mac->tsf & 0xffffffff)); - rtl_write_dword(rtlpriv, REG_TSFTR + 4, - (u32) ((mac->tsf >> 32) & 0xffffffff)); - _rtl92de_set_bcn_ctrl_reg(hw, BIT(3), 0); - if (btype_ibss) - _rtl92de_resume_tx_beacon(hw); - - break; - } - case HW_VAR_INT_MIGRATION: { - bool int_migration = *(bool *) (val); - - if (int_migration) { - /* Set interrupt migration timer and - * corresponding Tx/Rx counter. - * timer 25ns*0xfa0=100us for 0xf packets. - * 0x306:Rx, 0x307:Tx */ - rtl_write_dword(rtlpriv, REG_INT_MIG, 0xfe000fa0); - rtlpriv->dm.interrupt_migration = int_migration; - } else { - /* Reset all interrupt migration settings. */ - rtl_write_dword(rtlpriv, REG_INT_MIG, 0); - rtlpriv->dm.interrupt_migration = int_migration; - } - break; - } - case HW_VAR_INT_AC: { - bool disable_ac_int = *((bool *) val); - - /* Disable four ACs interrupts. */ - if (disable_ac_int) { - /* Disable VO, VI, BE and BK four AC interrupts - * to gain more efficient CPU utilization. - * When extremely highly Rx OK occurs, - * we will disable Tx interrupts. - */ - rtlpriv->cfg->ops->update_interrupt_mask(hw, 0, - RT_AC_INT_MASKS); - rtlpriv->dm.disable_tx_int = disable_ac_int; - /* Enable four ACs interrupts. */ - } else { - rtlpriv->cfg->ops->update_interrupt_mask(hw, - RT_AC_INT_MASKS, 0); - rtlpriv->dm.disable_tx_int = disable_ac_int; - } - break; - } - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } -} - -static bool _rtl92de_llt_write(struct ieee80211_hw *hw, u32 address, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - bool status = true; - long count = 0; - u32 value = _LLT_INIT_ADDR(address) | - _LLT_INIT_DATA(data) | _LLT_OP(_LLT_WRITE_ACCESS); - - rtl_write_dword(rtlpriv, REG_LLT_INIT, value); - do { - value = rtl_read_dword(rtlpriv, REG_LLT_INIT); - if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)) - break; - if (count > POLLING_LLT_THRESHOLD) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Failed to polling write LLT done at address %d!\n", - address); - status = false; - break; - } - } while (++count); - return status; -} - -static bool _rtl92de_llt_table_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - unsigned short i; - u8 txpktbuf_bndy; - u8 maxPage; - bool status; - u32 value32; /* High+low page number */ - u8 value8; /* normal page number */ - - if (rtlpriv->rtlhal.macphymode == SINGLEMAC_SINGLEPHY) { - maxPage = 255; - txpktbuf_bndy = 246; - value8 = 0; - value32 = 0x80bf0d29; - } else if (rtlpriv->rtlhal.macphymode != SINGLEMAC_SINGLEPHY) { - maxPage = 127; - txpktbuf_bndy = 123; - value8 = 0; - value32 = 0x80750005; - } - - /* Set reserved page for each queue */ - /* 11. RQPN 0x200[31:0] = 0x80BD1C1C */ - /* load RQPN */ - rtl_write_byte(rtlpriv, REG_RQPN_NPQ, value8); - rtl_write_dword(rtlpriv, REG_RQPN, value32); - - /* 12. TXRKTBUG_PG_BNDY 0x114[31:0] = 0x27FF00F6 */ - /* TXRKTBUG_PG_BNDY */ - rtl_write_dword(rtlpriv, REG_TRXFF_BNDY, - (rtl_read_word(rtlpriv, REG_TRXFF_BNDY + 2) << 16 | - txpktbuf_bndy)); - - /* 13. TDECTRL[15:8] 0x209[7:0] = 0xF6 */ - /* Beacon Head for TXDMA */ - rtl_write_byte(rtlpriv, REG_TDECTRL + 1, txpktbuf_bndy); - - /* 14. BCNQ_PGBNDY 0x424[7:0] = 0xF6 */ - /* BCNQ_PGBNDY */ - rtl_write_byte(rtlpriv, REG_TXPKTBUF_BCNQ_BDNY, txpktbuf_bndy); - rtl_write_byte(rtlpriv, REG_TXPKTBUF_MGQ_BDNY, txpktbuf_bndy); - - /* 15. WMAC_LBK_BF_HD 0x45D[7:0] = 0xF6 */ - /* WMAC_LBK_BF_HD */ - rtl_write_byte(rtlpriv, 0x45D, txpktbuf_bndy); - - /* Set Tx/Rx page size (Tx must be 128 Bytes, */ - /* Rx can be 64,128,256,512,1024 bytes) */ - /* 16. PBP [7:0] = 0x11 */ - /* TRX page size */ - rtl_write_byte(rtlpriv, REG_PBP, 0x11); - - /* 17. DRV_INFO_SZ = 0x04 */ - rtl_write_byte(rtlpriv, REG_RX_DRVINFO_SZ, 0x4); - - /* 18. LLT_table_init(Adapter); */ - for (i = 0; i < (txpktbuf_bndy - 1); i++) { - status = _rtl92de_llt_write(hw, i, i + 1); - if (true != status) - return status; - } - - /* end of list */ - status = _rtl92de_llt_write(hw, (txpktbuf_bndy - 1), 0xFF); - if (true != status) - return status; - - /* Make the other pages as ring buffer */ - /* This ring buffer is used as beacon buffer if we */ - /* config this MAC as two MAC transfer. */ - /* Otherwise used as local loopback buffer. */ - for (i = txpktbuf_bndy; i < maxPage; i++) { - status = _rtl92de_llt_write(hw, i, (i + 1)); - if (true != status) - return status; - } - - /* Let last entry point to the start entry of ring buffer */ - status = _rtl92de_llt_write(hw, maxPage, txpktbuf_bndy); - if (true != status) - return status; - - return true; -} - -static void _rtl92de_gen_refresh_led_state(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); - - if (rtlpci->up_first_time) - return; - if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) - rtl92de_sw_led_on(hw, pLed0); - else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT) - rtl92de_sw_led_on(hw, pLed0); - else - rtl92de_sw_led_off(hw, pLed0); -} - -static bool _rtl92de_init_mac(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - unsigned char bytetmp; - unsigned short wordtmp; - u16 retry; - - rtl92d_phy_set_poweron(hw); - /* Add for resume sequence of power domain according - * to power document V11. Chapter V.11.... */ - /* 0. RSV_CTRL 0x1C[7:0] = 0x00 */ - /* unlock ISO/CLK/Power control register */ - rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x00); - rtl_write_byte(rtlpriv, REG_LDOA15_CTRL, 0x05); - - /* 1. AFE_XTAL_CTRL [7:0] = 0x0F enable XTAL */ - /* 2. SPS0_CTRL 0x11[7:0] = 0x2b enable SPS into PWM mode */ - /* 3. delay (1ms) this is not necessary when initially power on */ - - /* C. Resume Sequence */ - /* a. SPS0_CTRL 0x11[7:0] = 0x2b */ - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x2b); - - /* b. AFE_XTAL_CTRL [7:0] = 0x0F */ - rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL, 0x0F); - - /* c. DRV runs power on init flow */ - - /* auto enable WLAN */ - /* 4. APS_FSMCO 0x04[8] = 1; wait till 0x04[8] = 0 */ - /* Power On Reset for MAC Block */ - bytetmp = rtl_read_byte(rtlpriv, REG_APS_FSMCO + 1) | BIT(0); - udelay(2); - rtl_write_byte(rtlpriv, REG_APS_FSMCO + 1, bytetmp); - udelay(2); - - /* 5. Wait while 0x04[8] == 0 goto 2, otherwise goto 1 */ - bytetmp = rtl_read_byte(rtlpriv, REG_APS_FSMCO + 1); - udelay(50); - retry = 0; - while ((bytetmp & BIT(0)) && retry < 1000) { - retry++; - bytetmp = rtl_read_byte(rtlpriv, REG_APS_FSMCO + 1); - udelay(50); - } - - /* Enable Radio off, GPIO, and LED function */ - /* 6. APS_FSMCO 0x04[15:0] = 0x0012 when enable HWPDN */ - rtl_write_word(rtlpriv, REG_APS_FSMCO, 0x1012); - - /* release RF digital isolation */ - /* 7. SYS_ISO_CTRL 0x01[1] = 0x0; */ - /*Set REG_SYS_ISO_CTRL 0x1=0x82 to prevent wake# problem. */ - rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL + 1, 0x82); - udelay(2); - - /* make sure that BB reset OK. */ - /* rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); */ - - /* Disable REG_CR before enable it to assure reset */ - rtl_write_word(rtlpriv, REG_CR, 0x0); - - /* Release MAC IO register reset */ - rtl_write_word(rtlpriv, REG_CR, 0x2ff); - - /* clear stopping tx/rx dma */ - rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG + 1, 0x0); - - /* rtl_write_word(rtlpriv,REG_CR+2, 0x2); */ - - /* System init */ - /* 18. LLT_table_init(Adapter); */ - if (!_rtl92de_llt_table_init(hw)) - return false; - - /* Clear interrupt and enable interrupt */ - /* 19. HISR 0x124[31:0] = 0xffffffff; */ - /* HISRE 0x12C[7:0] = 0xFF */ - rtl_write_dword(rtlpriv, REG_HISR, 0xffffffff); - rtl_write_byte(rtlpriv, REG_HISRE, 0xff); - - /* 20. HIMR 0x120[31:0] |= [enable INT mask bit map]; */ - /* 21. HIMRE 0x128[7:0] = [enable INT mask bit map] */ - /* The IMR should be enabled later after all init sequence - * is finished. */ - - /* 22. PCIE configuration space configuration */ - /* 23. Ensure PCIe Device 0x80[15:0] = 0x0143 (ASPM+CLKREQ), */ - /* and PCIe gated clock function is enabled. */ - /* PCIE configuration space will be written after - * all init sequence.(Or by BIOS) */ - - rtl92d_phy_config_maccoexist_rfpage(hw); - - /* THe below section is not related to power document Vxx . */ - /* This is only useful for driver and OS setting. */ - /* -------------------Software Relative Setting---------------------- */ - wordtmp = rtl_read_word(rtlpriv, REG_TRXDMA_CTRL); - wordtmp &= 0xf; - wordtmp |= 0xF771; - rtl_write_word(rtlpriv, REG_TRXDMA_CTRL, wordtmp); - - /* Reported Tx status from HW for rate adaptive. */ - /* This should be realtive to power on step 14. But in document V11 */ - /* still not contain the description.!!! */ - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 1, 0x1F); - - /* Set Tx/Rx page size (Tx must be 128 Bytes, - * Rx can be 64,128,256,512,1024 bytes) */ - /* rtl_write_byte(rtlpriv,REG_PBP, 0x11); */ - - /* Set RCR register */ - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); - /* rtl_write_byte(rtlpriv,REG_RX_DRVINFO_SZ, 4); */ - - /* Set TCR register */ - rtl_write_dword(rtlpriv, REG_TCR, rtlpci->transmit_config); - - /* disable earlymode */ - rtl_write_byte(rtlpriv, 0x4d0, 0x0); - - /* Set TX/RX descriptor physical address(from OS API). */ - rtl_write_dword(rtlpriv, REG_BCNQ_DESA, - rtlpci->tx_ring[BEACON_QUEUE].dma); - rtl_write_dword(rtlpriv, REG_MGQ_DESA, rtlpci->tx_ring[MGNT_QUEUE].dma); - rtl_write_dword(rtlpriv, REG_VOQ_DESA, rtlpci->tx_ring[VO_QUEUE].dma); - rtl_write_dword(rtlpriv, REG_VIQ_DESA, rtlpci->tx_ring[VI_QUEUE].dma); - rtl_write_dword(rtlpriv, REG_BEQ_DESA, rtlpci->tx_ring[BE_QUEUE].dma); - rtl_write_dword(rtlpriv, REG_BKQ_DESA, rtlpci->tx_ring[BK_QUEUE].dma); - rtl_write_dword(rtlpriv, REG_HQ_DESA, rtlpci->tx_ring[HIGH_QUEUE].dma); - /* Set RX Desc Address */ - rtl_write_dword(rtlpriv, REG_RX_DESA, - rtlpci->rx_ring[RX_MPDU_QUEUE].dma); - - /* if we want to support 64 bit DMA, we should set it here, - * but now we do not support 64 bit DMA*/ - - rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG + 3, 0x33); - - /* Reset interrupt migration setting when initialization */ - rtl_write_dword(rtlpriv, REG_INT_MIG, 0); - - /* Reconsider when to do this operation after asking HWSD. */ - bytetmp = rtl_read_byte(rtlpriv, REG_APSD_CTRL); - rtl_write_byte(rtlpriv, REG_APSD_CTRL, bytetmp & ~BIT(6)); - do { - retry++; - bytetmp = rtl_read_byte(rtlpriv, REG_APSD_CTRL); - } while ((retry < 200) && !(bytetmp & BIT(7))); - - /* After MACIO reset,we must refresh LED state. */ - _rtl92de_gen_refresh_led_state(hw); - - /* Reset H2C protection register */ - rtl_write_dword(rtlpriv, REG_MCUTST_1, 0x0); - - return true; -} - -static void _rtl92de_hw_configure(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 reg_bw_opmode = BW_OPMODE_20MHZ; - u32 reg_rrsr; - - reg_rrsr = RATE_ALL_CCK | RATE_ALL_OFDM_AG; - rtl_write_byte(rtlpriv, REG_INIRTS_RATE_SEL, 0x8); - rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); - rtl_write_dword(rtlpriv, REG_RRSR, reg_rrsr); - rtl_write_byte(rtlpriv, REG_SLOT, 0x09); - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, 0x0); - rtl_write_word(rtlpriv, REG_FWHW_TXQ_CTRL, 0x1F80); - rtl_write_word(rtlpriv, REG_RL, 0x0707); - rtl_write_dword(rtlpriv, REG_BAR_MODE_CTRL, 0x02012802); - rtl_write_byte(rtlpriv, REG_HWSEQ_CTRL, 0xFF); - rtl_write_dword(rtlpriv, REG_DARFRC, 0x01000000); - rtl_write_dword(rtlpriv, REG_DARFRC + 4, 0x07060504); - rtl_write_dword(rtlpriv, REG_RARFRC, 0x01000000); - rtl_write_dword(rtlpriv, REG_RARFRC + 4, 0x07060504); - /* Aggregation threshold */ - if (rtlhal->macphymode == DUALMAC_DUALPHY) - rtl_write_dword(rtlpriv, REG_AGGLEN_LMT, 0xb9726641); - else if (rtlhal->macphymode == DUALMAC_SINGLEPHY) - rtl_write_dword(rtlpriv, REG_AGGLEN_LMT, 0x66626641); - else - rtl_write_dword(rtlpriv, REG_AGGLEN_LMT, 0xb972a841); - rtl_write_byte(rtlpriv, REG_ATIMWND, 0x2); - rtl_write_byte(rtlpriv, REG_BCN_MAX_ERR, 0x0a); - rtlpci->reg_bcn_ctrl_val = 0x1f; - rtl_write_byte(rtlpriv, REG_BCN_CTRL, rtlpci->reg_bcn_ctrl_val); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0xff); - rtl_write_byte(rtlpriv, REG_PIFS, 0x1C); - rtl_write_byte(rtlpriv, REG_AGGR_BREAK_TIME, 0x16); - rtl_write_word(rtlpriv, REG_NAV_PROT_LEN, 0x0020); - /* For throughput */ - rtl_write_word(rtlpriv, REG_FAST_EDCA_CTRL, 0x6666); - /* ACKTO for IOT issue. */ - rtl_write_byte(rtlpriv, REG_ACKTO, 0x40); - /* Set Spec SIFS (used in NAV) */ - rtl_write_word(rtlpriv, REG_SPEC_SIFS, 0x1010); - rtl_write_word(rtlpriv, REG_MAC_SPEC_SIFS, 0x1010); - /* Set SIFS for CCK */ - rtl_write_word(rtlpriv, REG_SIFS_CTX, 0x1010); - /* Set SIFS for OFDM */ - rtl_write_word(rtlpriv, REG_SIFS_TRX, 0x1010); - /* Set Multicast Address. */ - rtl_write_dword(rtlpriv, REG_MAR, 0xffffffff); - rtl_write_dword(rtlpriv, REG_MAR + 4, 0xffffffff); - switch (rtlpriv->phy.rf_type) { - case RF_1T2R: - case RF_1T1R: - rtlhal->minspace_cfg = (MAX_MSS_DENSITY_1T << 3); - break; - case RF_2T2R: - case RF_2T2R_GREEN: - rtlhal->minspace_cfg = (MAX_MSS_DENSITY_2T << 3); - break; - } -} - -static void _rtl92de_enable_aspm_back_door(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - rtl_write_byte(rtlpriv, 0x34b, 0x93); - rtl_write_word(rtlpriv, 0x350, 0x870c); - rtl_write_byte(rtlpriv, 0x352, 0x1); - if (ppsc->support_backdoor) - rtl_write_byte(rtlpriv, 0x349, 0x1b); - else - rtl_write_byte(rtlpriv, 0x349, 0x03); - rtl_write_word(rtlpriv, 0x350, 0x2718); - rtl_write_byte(rtlpriv, 0x352, 0x1); -} - -void rtl92de_enable_hw_security_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 sec_reg_value; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n", - rtlpriv->sec.pairwise_enc_algorithm, - rtlpriv->sec.group_enc_algorithm); - if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "not open hw encryption\n"); - return; - } - sec_reg_value = SCR_TXENCENABLE | SCR_RXENCENABLE; - if (rtlpriv->sec.use_defaultkey) { - sec_reg_value |= SCR_TXUSEDK; - sec_reg_value |= SCR_RXUSEDK; - } - sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK); - rtl_write_byte(rtlpriv, REG_CR + 1, 0x02); - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, - "The SECR-value %x\n", sec_reg_value); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value); -} - -int rtl92de_hw_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool rtstatus = true; - u8 tmp_u1b; - int i; - int err; - unsigned long flags; - - rtlpci->being_init_adapter = true; - rtlpci->init_ready = false; - spin_lock_irqsave(&globalmutex_for_power_and_efuse, flags); - /* we should do iqk after disable/enable */ - rtl92d_phy_reset_iqk_result(hw); - /* rtlpriv->intf_ops->disable_aspm(hw); */ - rtstatus = _rtl92de_init_mac(hw); - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Init MAC failed\n"); - err = 1; - spin_unlock_irqrestore(&globalmutex_for_power_and_efuse, flags); - return err; - } - err = rtl92d_download_fw(hw); - spin_unlock_irqrestore(&globalmutex_for_power_and_efuse, flags); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Failed to download FW. Init HW without FW..\n"); - return 1; - } - rtlhal->last_hmeboxnum = 0; - rtlpriv->psc.fw_current_inpsmode = false; - - tmp_u1b = rtl_read_byte(rtlpriv, 0x605); - tmp_u1b = tmp_u1b | 0x30; - rtl_write_byte(rtlpriv, 0x605, tmp_u1b); - - if (rtlhal->earlymode_enable) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EarlyMode Enabled!!!\n"); - - tmp_u1b = rtl_read_byte(rtlpriv, 0x4d0); - tmp_u1b = tmp_u1b | 0x1f; - rtl_write_byte(rtlpriv, 0x4d0, tmp_u1b); - - rtl_write_byte(rtlpriv, 0x4d3, 0x80); - - tmp_u1b = rtl_read_byte(rtlpriv, 0x605); - tmp_u1b = tmp_u1b | 0x40; - rtl_write_byte(rtlpriv, 0x605, tmp_u1b); - } - - if (mac->rdg_en) { - rtl_write_byte(rtlpriv, REG_RD_CTRL, 0xff); - rtl_write_word(rtlpriv, REG_RD_NAV_NXT, 0x200); - rtl_write_byte(rtlpriv, REG_RD_RESP_PKT_TH, 0x05); - } - - rtl92d_phy_mac_config(hw); - /* because last function modify RCR, so we update - * rcr var here, or TP will unstable for receive_config - * is wrong, RX RCR_ACRC32 will cause TP unstabel & Rx - * RCR_APP_ICV will cause mac80211 unassoc for cisco 1252*/ - rtlpci->receive_config = rtl_read_dword(rtlpriv, REG_RCR); - rtlpci->receive_config &= ~(RCR_ACRC32 | RCR_AICV); - - rtl92d_phy_bb_config(hw); - - rtlphy->rf_mode = RF_OP_BY_SW_3WIRE; - /* set before initialize RF */ - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, 0x00f00000, 0xf); - - /* config RF */ - rtl92d_phy_rf_config(hw); - - /* After read predefined TXT, we must set BB/MAC/RF - * register as our requirement */ - /* After load BB,RF params,we need do more for 92D. */ - rtl92d_update_bbrf_configuration(hw); - /* set default value after initialize RF, */ - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, 0x00f00000, 0); - rtlphy->rfreg_chnlval[0] = rtl_get_rfreg(hw, (enum radio_path)0, - RF_CHNLBW, BRFREGOFFSETMASK); - rtlphy->rfreg_chnlval[1] = rtl_get_rfreg(hw, (enum radio_path)1, - RF_CHNLBW, BRFREGOFFSETMASK); - - /*---- Set CCK and OFDM Block "ON"----*/ - if (rtlhal->current_bandtype == BAND_ON_2_4G) - rtl_set_bbreg(hw, RFPGA0_RFMOD, BCCKEN, 0x1); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BOFDMEN, 0x1); - if (rtlhal->interfaceindex == 0) { - /* RFPGA0_ANALOGPARAMETER2: cck clock select, - * set to 20MHz by default */ - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10) | - BIT(11), 3); - } else { - /* Mac1 */ - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(11) | - BIT(10), 3); - } - - _rtl92de_hw_configure(hw); - - /* reset hw sec */ - rtl_cam_reset_all_entry(hw); - rtl92de_enable_hw_security_config(hw); - - /* Read EEPROM TX power index and PHY_REG_PG.txt to capture correct */ - /* TX power index for different rate set. */ - rtl92d_phy_get_hw_reg_originalvalue(hw); - rtl92d_phy_set_txpower_level(hw, rtlphy->current_channel); - - ppsc->rfpwr_state = ERFON; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, mac->mac_addr); - - _rtl92de_enable_aspm_back_door(hw); - /* rtlpriv->intf_ops->enable_aspm(hw); */ - - rtl92d_dm_init(hw); - rtlpci->being_init_adapter = false; - - if (ppsc->rfpwr_state == ERFON) { - rtl92d_phy_lc_calibrate(hw); - /* 5G and 2.4G must wait sometime to let RF LO ready */ - if (rtlhal->macphymode == DUALMAC_DUALPHY) { - u32 tmp_rega; - for (i = 0; i < 10000; i++) { - udelay(MAX_STALL_TIME); - - tmp_rega = rtl_get_rfreg(hw, - (enum radio_path)RF90_PATH_A, - 0x2a, BMASKDWORD); - - if (((tmp_rega & BIT(11)) == BIT(11))) - break; - } - /* check that loop was successful. If not, exit now */ - if (i == 10000) { - rtlpci->init_ready = false; - return 1; - } - } - } - rtlpci->init_ready = true; - return err; -} - -static enum version_8192d _rtl92de_read_chip_version(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - enum version_8192d version = VERSION_NORMAL_CHIP_92D_SINGLEPHY; - u32 value32; - - value32 = rtl_read_dword(rtlpriv, REG_SYS_CFG); - if (!(value32 & 0x000f0000)) { - version = VERSION_TEST_CHIP_92D_SINGLEPHY; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "TEST CHIP!!!\n"); - } else { - version = VERSION_NORMAL_CHIP_92D_SINGLEPHY; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Normal CHIP!!!\n"); - } - return version; -} - -static int _rtl92de_set_media_status(struct ieee80211_hw *hw, - enum nl80211_iftype type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 bt_msr = rtl_read_byte(rtlpriv, MSR); - enum led_ctl_mode ledaction = LED_CTL_NO_LINK; - u8 bcnfunc_enable; - - bt_msr &= 0xfc; - - if (type == NL80211_IFTYPE_UNSPECIFIED || - type == NL80211_IFTYPE_STATION) { - _rtl92de_stop_tx_beacon(hw); - _rtl92de_enable_bcn_sub_func(hw); - } else if (type == NL80211_IFTYPE_ADHOC || - type == NL80211_IFTYPE_AP) { - _rtl92de_resume_tx_beacon(hw); - _rtl92de_disable_bcn_sub_func(hw); - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Set HW_VAR_MEDIA_STATUS: No such media status(%x)\n", - type); - } - bcnfunc_enable = rtl_read_byte(rtlpriv, REG_BCN_CTRL); - switch (type) { - case NL80211_IFTYPE_UNSPECIFIED: - bt_msr |= MSR_NOLINK; - ledaction = LED_CTL_LINK; - bcnfunc_enable &= 0xF7; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to NO LINK!\n"); - break; - case NL80211_IFTYPE_ADHOC: - bt_msr |= MSR_ADHOC; - bcnfunc_enable |= 0x08; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to Ad Hoc!\n"); - break; - case NL80211_IFTYPE_STATION: - bt_msr |= MSR_INFRA; - ledaction = LED_CTL_LINK; - bcnfunc_enable &= 0xF7; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to STA!\n"); - break; - case NL80211_IFTYPE_AP: - bt_msr |= MSR_AP; - bcnfunc_enable |= 0x08; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to AP!\n"); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Network type %d not supported!\n", type); - return 1; - break; - - } - rtl_write_byte(rtlpriv, REG_CR + 2, bt_msr); - rtlpriv->cfg->ops->led_control(hw, ledaction); - if ((bt_msr & 0xfc) == MSR_AP) - rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); - else - rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); - return 0; -} - -void rtl92de_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u32 reg_rcr = rtlpci->receive_config; - - if (rtlpriv->psc.rfpwr_state != ERFON) - return; - if (check_bssid) { - reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, (u8 *)(®_rcr)); - _rtl92de_set_bcn_ctrl_reg(hw, 0, BIT(4)); - } else if (!check_bssid) { - reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); - _rtl92de_set_bcn_ctrl_reg(hw, BIT(4), 0); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, (u8 *)(®_rcr)); - } -} - -int rtl92de_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (_rtl92de_set_media_status(hw, type)) - return -EOPNOTSUPP; - - /* check bssid */ - if (rtlpriv->mac80211.link_state == MAC80211_LINKED) { - if (type != NL80211_IFTYPE_AP) - rtl92de_set_check_bssid(hw, true); - } else { - rtl92de_set_check_bssid(hw, false); - } - return 0; -} - -/* do iqk or reload iqk */ -/* windows just rtl92d_phy_reload_iqk_setting in set channel, - * but it's very strict for time sequence so we add - * rtl92d_phy_reload_iqk_setting here */ -void rtl92d_linked_set_reg(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u8 indexforchannel; - u8 channel = rtlphy->current_channel; - - indexforchannel = rtl92d_get_rightchnlplace_for_iqk(channel); - if (!rtlphy->iqk_matrix[indexforchannel].iqk_done) { - RT_TRACE(rtlpriv, COMP_SCAN | COMP_INIT, DBG_DMESG, - "Do IQK for channel:%d\n", channel); - rtl92d_phy_iq_calibrate(hw); - } -} - -/* don't set REG_EDCA_BE_PARAM here because - * mac80211 will send pkt when scan */ -void rtl92de_set_qos(struct ieee80211_hw *hw, int aci) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - rtl92d_dm_init_edca_turbo(hw); - return; - switch (aci) { - case AC1_BK: - rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM, 0xa44f); - break; - case AC0_BE: - break; - case AC2_VI: - rtl_write_dword(rtlpriv, REG_EDCA_VI_PARAM, 0x5e4322); - break; - case AC3_VO: - rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, 0x2f3222); - break; - default: - RT_ASSERT(false, "invalid aci: %d !\n", aci); - break; - } -} - -void rtl92de_enable_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF); - rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF); -} - -void rtl92de_disable_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - rtl_write_dword(rtlpriv, REG_HIMR, IMR8190_DISABLED); - rtl_write_dword(rtlpriv, REG_HIMRE, IMR8190_DISABLED); - synchronize_irq(rtlpci->pdev->irq); -} - -static void _rtl92de_poweroff_adapter(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 u1b_tmp; - unsigned long flags; - - rtlpriv->intf_ops->enable_aspm(hw); - rtl_write_byte(rtlpriv, REG_RF_CTRL, 0x00); - rtl_set_bbreg(hw, RFPGA0_XCD_RFPARAMETER, BIT(3), 0); - rtl_set_bbreg(hw, RFPGA0_XCD_RFPARAMETER, BIT(15), 0); - - /* 0x20:value 05-->04 */ - rtl_write_byte(rtlpriv, REG_LDOA15_CTRL, 0x04); - - /* ==== Reset digital sequence ====== */ - rtl92d_firmware_selfreset(hw); - - /* f. SYS_FUNC_EN 0x03[7:0]=0x51 reset MCU, MAC register, DCORE */ - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, 0x51); - - /* g. MCUFWDL 0x80[1:0]=0 reset MCU ready status */ - rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x00); - - /* ==== Pull GPIO PIN to balance level and LED control ====== */ - - /* h. GPIO_PIN_CTRL 0x44[31:0]=0x000 */ - rtl_write_dword(rtlpriv, REG_GPIO_PIN_CTRL, 0x00000000); - - /* i. Value = GPIO_PIN_CTRL[7:0] */ - u1b_tmp = rtl_read_byte(rtlpriv, REG_GPIO_PIN_CTRL); - - /* j. GPIO_PIN_CTRL 0x44[31:0] = 0x00FF0000 | (value <<8); */ - /* write external PIN level */ - rtl_write_dword(rtlpriv, REG_GPIO_PIN_CTRL, - 0x00FF0000 | (u1b_tmp << 8)); - - /* k. GPIO_MUXCFG 0x42 [15:0] = 0x0780 */ - rtl_write_word(rtlpriv, REG_GPIO_IO_SEL, 0x0790); - - /* l. LEDCFG 0x4C[15:0] = 0x8080 */ - rtl_write_word(rtlpriv, REG_LEDCFG0, 0x8080); - - /* ==== Disable analog sequence === */ - - /* m. AFE_PLL_CTRL[7:0] = 0x80 disable PLL */ - rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL, 0x80); - - /* n. SPS0_CTRL 0x11[7:0] = 0x22 enter PFM mode */ - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x23); - - /* o. AFE_XTAL_CTRL 0x24[7:0] = 0x0E disable XTAL, if No BT COEX */ - rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL, 0x0e); - - /* p. RSV_CTRL 0x1C[7:0] = 0x0E lock ISO/CLK/Power control register */ - rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x0e); - - /* ==== interface into suspend === */ - - /* q. APS_FSMCO[15:8] = 0x58 PCIe suspend mode */ - /* According to power document V11, we need to set this */ - /* value as 0x18. Otherwise, we may not L0s sometimes. */ - /* This indluences power consumption. Bases on SD1's test, */ - /* set as 0x00 do not affect power current. And if it */ - /* is set as 0x18, they had ever met auto load fail problem. */ - rtl_write_byte(rtlpriv, REG_APS_FSMCO + 1, 0x10); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "In PowerOff,reg0x%x=%X\n", - REG_SPS0_CTRL, rtl_read_byte(rtlpriv, REG_SPS0_CTRL)); - /* r. Note: for PCIe interface, PON will not turn */ - /* off m-bias and BandGap in PCIe suspend mode. */ - - /* 0x17[7] 1b': power off in process 0b' : power off over */ - if (rtlpriv->rtlhal.macphymode != SINGLEMAC_SINGLEPHY) { - spin_lock_irqsave(&globalmutex_power, flags); - u1b_tmp = rtl_read_byte(rtlpriv, REG_POWER_OFF_IN_PROCESS); - u1b_tmp &= (~BIT(7)); - rtl_write_byte(rtlpriv, REG_POWER_OFF_IN_PROCESS, u1b_tmp); - spin_unlock_irqrestore(&globalmutex_power, flags); - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "<=======\n"); -} - -void rtl92de_card_disable(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - enum nl80211_iftype opmode; - - mac->link_state = MAC80211_NOLINK; - opmode = NL80211_IFTYPE_UNSPECIFIED; - _rtl92de_set_media_status(hw, opmode); - - if (rtlpci->driver_is_goingto_unload || - ppsc->rfoff_reason > RF_CHANGE_BY_PS) - rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF); - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - /* Power sequence for each MAC. */ - /* a. stop tx DMA */ - /* b. close RF */ - /* c. clear rx buf */ - /* d. stop rx DMA */ - /* e. reset MAC */ - - /* a. stop tx DMA */ - rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG + 1, 0xFE); - udelay(50); - - /* b. TXPAUSE 0x522[7:0] = 0xFF Pause MAC TX queue */ - - /* c. ========RF OFF sequence========== */ - /* 0x88c[23:20] = 0xf. */ - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, 0x00f00000, 0xf); - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, BRFREGOFFSETMASK, 0x00); - - /* APSD_CTRL 0x600[7:0] = 0x40 */ - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40); - - /* Close antenna 0,0xc04,0xd04 */ - rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, BMASKBYTE0, 0); - rtl_set_bbreg(hw, ROFDM1_TRXPATHENABLE, BDWORD, 0); - - /* SYS_FUNC_EN 0x02[7:0] = 0xE2 reset BB state machine */ - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - - /* Mac0 can not do Global reset. Mac1 can do. */ - /* SYS_FUNC_EN 0x02[7:0] = 0xE0 reset BB state machine */ - if (rtlpriv->rtlhal.interfaceindex == 1) - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE0); - udelay(50); - - /* d. stop tx/rx dma before disable REG_CR (0x100) to fix */ - /* dma hang issue when disable/enable device. */ - rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG + 1, 0xff); - udelay(50); - rtl_write_byte(rtlpriv, REG_CR, 0x0); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "==> Do power off.......\n"); - if (rtl92d_phy_check_poweroff(hw)) - _rtl92de_poweroff_adapter(hw); - return; -} - -void rtl92de_interrupt_recognized(struct ieee80211_hw *hw, - u32 *p_inta, u32 *p_intb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - *p_inta = rtl_read_dword(rtlpriv, ISR) & rtlpci->irq_mask[0]; - rtl_write_dword(rtlpriv, ISR, *p_inta); - - /* - * *p_intb = rtl_read_dword(rtlpriv, REG_HISRE) & rtlpci->irq_mask[1]; - * rtl_write_dword(rtlpriv, ISR + 4, *p_intb); - */ -} - -void rtl92de_set_beacon_related_registers(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 bcn_interval, atim_window; - - bcn_interval = mac->beacon_interval; - atim_window = 2; - /*rtl92de_disable_interrupt(hw); */ - rtl_write_word(rtlpriv, REG_ATIMWND, atim_window); - rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); - rtl_write_word(rtlpriv, REG_BCNTCFG, 0x660f); - rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_CCK, 0x20); - if (rtlpriv->rtlhal.current_bandtype == BAND_ON_5G) - rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_OFDM, 0x30); - else - rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_OFDM, 0x20); - rtl_write_byte(rtlpriv, 0x606, 0x30); -} - -void rtl92de_set_beacon_interval(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 bcn_interval = mac->beacon_interval; - - RT_TRACE(rtlpriv, COMP_BEACON, DBG_DMESG, - "beacon_interval:%d\n", bcn_interval); - /* rtl92de_disable_interrupt(hw); */ - rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); - /* rtl92de_enable_interrupt(hw); */ -} - -void rtl92de_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, "add_msr:%x, rm_msr:%x\n", - add_msr, rm_msr); - if (add_msr) - rtlpci->irq_mask[0] |= add_msr; - if (rm_msr) - rtlpci->irq_mask[0] &= (~rm_msr); - rtl92de_disable_interrupt(hw); - rtl92de_enable_interrupt(hw); -} - -static void _rtl92de_readpowervalue_fromprom(struct txpower_info *pwrinfo, - u8 *rom_content, bool autoLoadfail) -{ - u32 rfpath, eeaddr, group, offset1, offset2; - u8 i; - - memset(pwrinfo, 0, sizeof(struct txpower_info)); - if (autoLoadfail) { - for (group = 0; group < CHANNEL_GROUP_MAX; group++) { - for (rfpath = 0; rfpath < RF6052_MAX_PATH; rfpath++) { - if (group < CHANNEL_GROUP_MAX_2G) { - pwrinfo->cck_index[rfpath][group] = - EEPROM_DEFAULT_TXPOWERLEVEL_2G; - pwrinfo->ht40_1sindex[rfpath][group] = - EEPROM_DEFAULT_TXPOWERLEVEL_2G; - } else { - pwrinfo->ht40_1sindex[rfpath][group] = - EEPROM_DEFAULT_TXPOWERLEVEL_5G; - } - pwrinfo->ht40_2sindexdiff[rfpath][group] = - EEPROM_DEFAULT_HT40_2SDIFF; - pwrinfo->ht20indexdiff[rfpath][group] = - EEPROM_DEFAULT_HT20_DIFF; - pwrinfo->ofdmindexdiff[rfpath][group] = - EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF; - pwrinfo->ht40maxoffset[rfpath][group] = - EEPROM_DEFAULT_HT40_PWRMAXOFFSET; - pwrinfo->ht20maxoffset[rfpath][group] = - EEPROM_DEFAULT_HT20_PWRMAXOFFSET; - } - } - for (i = 0; i < 3; i++) { - pwrinfo->tssi_a[i] = EEPROM_DEFAULT_TSSI; - pwrinfo->tssi_b[i] = EEPROM_DEFAULT_TSSI; - } - return; - } - - /* Maybe autoload OK,buf the tx power index value is not filled. - * If we find it, we set it to default value. */ - for (rfpath = 0; rfpath < RF6052_MAX_PATH; rfpath++) { - for (group = 0; group < CHANNEL_GROUP_MAX_2G; group++) { - eeaddr = EEPROM_CCK_TX_PWR_INX_2G + (rfpath * 3) - + group; - pwrinfo->cck_index[rfpath][group] = - (rom_content[eeaddr] == 0xFF) ? - (eeaddr > 0x7B ? - EEPROM_DEFAULT_TXPOWERLEVEL_5G : - EEPROM_DEFAULT_TXPOWERLEVEL_2G) : - rom_content[eeaddr]; - } - } - for (rfpath = 0; rfpath < RF6052_MAX_PATH; rfpath++) { - for (group = 0; group < CHANNEL_GROUP_MAX; group++) { - offset1 = group / 3; - offset2 = group % 3; - eeaddr = EEPROM_HT40_1S_TX_PWR_INX_2G + (rfpath * 3) + - offset2 + offset1 * 21; - pwrinfo->ht40_1sindex[rfpath][group] = - (rom_content[eeaddr] == 0xFF) ? (eeaddr > 0x7B ? - EEPROM_DEFAULT_TXPOWERLEVEL_5G : - EEPROM_DEFAULT_TXPOWERLEVEL_2G) : - rom_content[eeaddr]; - } - } - /* These just for 92D efuse offset. */ - for (group = 0; group < CHANNEL_GROUP_MAX; group++) { - for (rfpath = 0; rfpath < RF6052_MAX_PATH; rfpath++) { - int base1 = EEPROM_HT40_2S_TX_PWR_INX_DIFF_2G; - - offset1 = group / 3; - offset2 = group % 3; - - if (rom_content[base1 + offset2 + offset1 * 21] != 0xFF) - pwrinfo->ht40_2sindexdiff[rfpath][group] = - (rom_content[base1 + - offset2 + offset1 * 21] >> (rfpath * 4)) - & 0xF; - else - pwrinfo->ht40_2sindexdiff[rfpath][group] = - EEPROM_DEFAULT_HT40_2SDIFF; - if (rom_content[EEPROM_HT20_TX_PWR_INX_DIFF_2G + offset2 - + offset1 * 21] != 0xFF) - pwrinfo->ht20indexdiff[rfpath][group] = - (rom_content[EEPROM_HT20_TX_PWR_INX_DIFF_2G - + offset2 + offset1 * 21] >> (rfpath * 4)) - & 0xF; - else - pwrinfo->ht20indexdiff[rfpath][group] = - EEPROM_DEFAULT_HT20_DIFF; - if (rom_content[EEPROM_OFDM_TX_PWR_INX_DIFF_2G + offset2 - + offset1 * 21] != 0xFF) - pwrinfo->ofdmindexdiff[rfpath][group] = - (rom_content[EEPROM_OFDM_TX_PWR_INX_DIFF_2G - + offset2 + offset1 * 21] >> (rfpath * 4)) - & 0xF; - else - pwrinfo->ofdmindexdiff[rfpath][group] = - EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF; - if (rom_content[EEPROM_HT40_MAX_PWR_OFFSET_2G + offset2 - + offset1 * 21] != 0xFF) - pwrinfo->ht40maxoffset[rfpath][group] = - (rom_content[EEPROM_HT40_MAX_PWR_OFFSET_2G - + offset2 + offset1 * 21] >> (rfpath * 4)) - & 0xF; - else - pwrinfo->ht40maxoffset[rfpath][group] = - EEPROM_DEFAULT_HT40_PWRMAXOFFSET; - if (rom_content[EEPROM_HT20_MAX_PWR_OFFSET_2G + offset2 - + offset1 * 21] != 0xFF) - pwrinfo->ht20maxoffset[rfpath][group] = - (rom_content[EEPROM_HT20_MAX_PWR_OFFSET_2G + - offset2 + offset1 * 21] >> (rfpath * 4)) & - 0xF; - else - pwrinfo->ht20maxoffset[rfpath][group] = - EEPROM_DEFAULT_HT20_PWRMAXOFFSET; - } - } - if (rom_content[EEPROM_TSSI_A_5G] != 0xFF) { - /* 5GL */ - pwrinfo->tssi_a[0] = rom_content[EEPROM_TSSI_A_5G] & 0x3F; - pwrinfo->tssi_b[0] = rom_content[EEPROM_TSSI_B_5G] & 0x3F; - /* 5GM */ - pwrinfo->tssi_a[1] = rom_content[EEPROM_TSSI_AB_5G] & 0x3F; - pwrinfo->tssi_b[1] = - (rom_content[EEPROM_TSSI_AB_5G] & 0xC0) >> 6 | - (rom_content[EEPROM_TSSI_AB_5G + 1] & 0x0F) << 2; - /* 5GH */ - pwrinfo->tssi_a[2] = (rom_content[EEPROM_TSSI_AB_5G + 1] & - 0xF0) >> 4 | - (rom_content[EEPROM_TSSI_AB_5G + 2] & 0x03) << 4; - pwrinfo->tssi_b[2] = (rom_content[EEPROM_TSSI_AB_5G + 2] & - 0xFC) >> 2; - } else { - for (i = 0; i < 3; i++) { - pwrinfo->tssi_a[i] = EEPROM_DEFAULT_TSSI; - pwrinfo->tssi_b[i] = EEPROM_DEFAULT_TSSI; - } - } -} - -static void _rtl92de_read_txpower_info(struct ieee80211_hw *hw, - bool autoload_fail, u8 *hwinfo) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct txpower_info pwrinfo; - u8 tempval[2], i, pwr, diff; - u32 ch, rfPath, group; - - _rtl92de_readpowervalue_fromprom(&pwrinfo, hwinfo, autoload_fail); - if (!autoload_fail) { - /* bit0~2 */ - rtlefuse->eeprom_regulatory = (hwinfo[EEPROM_RF_OPT1] & 0x7); - rtlefuse->eeprom_thermalmeter = - hwinfo[EEPROM_THERMAL_METER] & 0x1f; - rtlefuse->crystalcap = hwinfo[EEPROM_XTAL_K]; - tempval[0] = hwinfo[EEPROM_IQK_DELTA] & 0x03; - tempval[1] = (hwinfo[EEPROM_LCK_DELTA] & 0x0C) >> 2; - rtlefuse->txpwr_fromeprom = true; - if (IS_92D_D_CUT(rtlpriv->rtlhal.version) || - IS_92D_E_CUT(rtlpriv->rtlhal.version)) { - rtlefuse->internal_pa_5g[0] = - !((hwinfo[EEPROM_TSSI_A_5G] & BIT(6)) >> 6); - rtlefuse->internal_pa_5g[1] = - !((hwinfo[EEPROM_TSSI_B_5G] & BIT(6)) >> 6); - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "Is D cut,Internal PA0 %d Internal PA1 %d\n", - rtlefuse->internal_pa_5g[0], - rtlefuse->internal_pa_5g[1]); - } - rtlefuse->eeprom_c9 = hwinfo[EEPROM_RF_OPT6]; - rtlefuse->eeprom_cc = hwinfo[EEPROM_RF_OPT7]; - } else { - rtlefuse->eeprom_regulatory = 0; - rtlefuse->eeprom_thermalmeter = EEPROM_DEFAULT_THERMALMETER; - rtlefuse->crystalcap = EEPROM_DEFAULT_CRYSTALCAP; - tempval[0] = tempval[1] = 3; - } - - /* Use default value to fill parameters if - * efuse is not filled on some place. */ - - /* ThermalMeter from EEPROM */ - if (rtlefuse->eeprom_thermalmeter < 0x06 || - rtlefuse->eeprom_thermalmeter > 0x1c) - rtlefuse->eeprom_thermalmeter = 0x12; - rtlefuse->thermalmeter[0] = rtlefuse->eeprom_thermalmeter; - - /* check XTAL_K */ - if (rtlefuse->crystalcap == 0xFF) - rtlefuse->crystalcap = 0; - if (rtlefuse->eeprom_regulatory > 3) - rtlefuse->eeprom_regulatory = 0; - - for (i = 0; i < 2; i++) { - switch (tempval[i]) { - case 0: - tempval[i] = 5; - break; - case 1: - tempval[i] = 4; - break; - case 2: - tempval[i] = 3; - break; - case 3: - default: - tempval[i] = 0; - break; - } - } - - rtlefuse->delta_iqk = tempval[0]; - if (tempval[1] > 0) - rtlefuse->delta_lck = tempval[1] - 1; - if (rtlefuse->eeprom_c9 == 0xFF) - rtlefuse->eeprom_c9 = 0x00; - RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, - "EEPROMRegulatory = 0x%x\n", rtlefuse->eeprom_regulatory); - RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, - "ThermalMeter = 0x%x\n", rtlefuse->eeprom_thermalmeter); - RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, - "CrystalCap = 0x%x\n", rtlefuse->crystalcap); - RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, - "Delta_IQK = 0x%x Delta_LCK = 0x%x\n", - rtlefuse->delta_iqk, rtlefuse->delta_lck); - - for (rfPath = 0; rfPath < RF6052_MAX_PATH; rfPath++) { - for (ch = 0; ch < CHANNEL_MAX_NUMBER; ch++) { - group = rtl92d_get_chnlgroup_fromarray((u8) ch); - if (ch < CHANNEL_MAX_NUMBER_2G) - rtlefuse->txpwrlevel_cck[rfPath][ch] = - pwrinfo.cck_index[rfPath][group]; - rtlefuse->txpwrlevel_ht40_1s[rfPath][ch] = - pwrinfo.ht40_1sindex[rfPath][group]; - rtlefuse->txpwr_ht20diff[rfPath][ch] = - pwrinfo.ht20indexdiff[rfPath][group]; - rtlefuse->txpwr_legacyhtdiff[rfPath][ch] = - pwrinfo.ofdmindexdiff[rfPath][group]; - rtlefuse->pwrgroup_ht20[rfPath][ch] = - pwrinfo.ht20maxoffset[rfPath][group]; - rtlefuse->pwrgroup_ht40[rfPath][ch] = - pwrinfo.ht40maxoffset[rfPath][group]; - pwr = pwrinfo.ht40_1sindex[rfPath][group]; - diff = pwrinfo.ht40_2sindexdiff[rfPath][group]; - rtlefuse->txpwrlevel_ht40_2s[rfPath][ch] = - (pwr > diff) ? (pwr - diff) : 0; - } - } -} - -static void _rtl92de_read_macphymode_from_prom(struct ieee80211_hw *hw, - u8 *content) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 macphy_crvalue = content[EEPROM_MAC_FUNCTION]; - - if (macphy_crvalue & BIT(3)) { - rtlhal->macphymode = SINGLEMAC_SINGLEPHY; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "MacPhyMode SINGLEMAC_SINGLEPHY\n"); - } else { - rtlhal->macphymode = DUALMAC_DUALPHY; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "MacPhyMode DUALMAC_DUALPHY\n"); - } -} - -static void _rtl92de_read_macphymode_and_bandtype(struct ieee80211_hw *hw, - u8 *content) -{ - _rtl92de_read_macphymode_from_prom(hw, content); - rtl92d_phy_config_macphymode(hw); - rtl92d_phy_config_macphymode_info(hw); -} - -static void _rtl92de_efuse_update_chip_version(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - enum version_8192d chipver = rtlpriv->rtlhal.version; - u8 cutvalue[2]; - u16 chipvalue; - - rtlpriv->intf_ops->read_efuse_byte(hw, EEPROME_CHIP_VERSION_H, - &cutvalue[1]); - rtlpriv->intf_ops->read_efuse_byte(hw, EEPROME_CHIP_VERSION_L, - &cutvalue[0]); - chipvalue = (cutvalue[1] << 8) | cutvalue[0]; - switch (chipvalue) { - case 0xAA55: - chipver |= CHIP_92D_C_CUT; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "C-CUT!!!\n"); - break; - case 0x9966: - chipver |= CHIP_92D_D_CUT; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "D-CUT!!!\n"); - break; - case 0xCC33: - chipver |= CHIP_92D_E_CUT; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "E-CUT!!!\n"); - break; - default: - chipver |= CHIP_92D_D_CUT; - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, "Unknown CUT!\n"); - break; - } - rtlpriv->rtlhal.version = chipver; -} - -static void _rtl92de_read_adapter_info(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE]; - u16 eeprom_id; - unsigned long flags; - - if (rtlefuse->epromtype == EEPROM_BOOT_EFUSE) { - spin_lock_irqsave(&globalmutex_for_power_and_efuse, flags); - rtl_efuse_shadow_map_update(hw); - _rtl92de_efuse_update_chip_version(hw); - spin_unlock_irqrestore(&globalmutex_for_power_and_efuse, flags); - memcpy((void *)hwinfo, (void *)&rtlefuse->efuse_map - [EFUSE_INIT_MAP][0], - HWSET_MAX_SIZE); - } else if (rtlefuse->epromtype == EEPROM_93C46) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "RTL819X Not boot from eeprom, check it !!\n"); - } - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP", - hwinfo, HWSET_MAX_SIZE); - - eeprom_id = *((u16 *)&hwinfo[0]); - if (eeprom_id != RTL8190_EEPROM_ID) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "EEPROM ID(%#x) is invalid!!\n", eeprom_id); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - } - if (rtlefuse->autoload_failflag) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "RTL819X Not boot from eeprom, check it !!\n"); - return; - } - rtlefuse->eeprom_oemid = hwinfo[EEPROM_CUSTOMER_ID]; - _rtl92de_read_macphymode_and_bandtype(hw, hwinfo); - - /* VID, DID SE 0xA-D */ - rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID]; - rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID]; - rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID]; - rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROMId = 0x%4x\n", eeprom_id); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); - - /* Read Permanent MAC address */ - if (rtlhal->interfaceindex == 0) { - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR_MAC0_92D + i]; - *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue; - } - } else { - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR_MAC1_92D + i]; - *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue; - } - } - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, - rtlefuse->dev_addr); - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "%pM\n", rtlefuse->dev_addr); - _rtl92de_read_txpower_info(hw, rtlefuse->autoload_failflag, hwinfo); - - /* Read Channel Plan */ - switch (rtlhal->bandset) { - case BAND_ON_2_4G: - rtlefuse->channel_plan = COUNTRY_CODE_TELEC; - break; - case BAND_ON_5G: - rtlefuse->channel_plan = COUNTRY_CODE_FCC; - break; - case BAND_ON_BOTH: - rtlefuse->channel_plan = COUNTRY_CODE_FCC; - break; - default: - rtlefuse->channel_plan = COUNTRY_CODE_FCC; - break; - } - rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION]; - rtlefuse->txpwr_fromeprom = true; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); -} - -void rtl92de_read_eeprom_info(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 tmp_u1b; - - rtlhal->version = _rtl92de_read_chip_version(hw); - tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR); - rtlefuse->autoload_status = tmp_u1b; - if (tmp_u1b & BIT(4)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EEPROM\n"); - rtlefuse->epromtype = EEPROM_93C46; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EFUSE\n"); - rtlefuse->epromtype = EEPROM_BOOT_EFUSE; - } - if (tmp_u1b & BIT(5)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - - rtlefuse->autoload_failflag = false; - _rtl92de_read_adapter_info(hw); - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Autoload ERR!!\n"); - } - return; -} - -static void rtl92de_update_hal_rate_table(struct ieee80211_hw *hw, - struct ieee80211_sta *sta) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u32 ratr_value; - u8 ratr_index = 0; - u8 nmode = mac->ht_enable; - u8 mimo_ps = IEEE80211_SMPS_OFF; - u16 shortgi_rate; - u32 tmp_ratr_value; - u8 curtxbw_40mhz = mac->bw_40; - u8 curshortgi_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? - 1 : 0; - u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? - 1 : 0; - enum wireless_mode wirelessmode = mac->mode; - - if (rtlhal->current_bandtype == BAND_ON_5G) - ratr_value = sta->supp_rates[1] << 4; - else - ratr_value = sta->supp_rates[0]; - ratr_value |= (sta->ht_cap.mcs.rx_mask[1] << 20 | - sta->ht_cap.mcs.rx_mask[0] << 12); - switch (wirelessmode) { - case WIRELESS_MODE_A: - ratr_value &= 0x00000FF0; - break; - case WIRELESS_MODE_B: - if (ratr_value & 0x0000000c) - ratr_value &= 0x0000000d; - else - ratr_value &= 0x0000000f; - break; - case WIRELESS_MODE_G: - ratr_value &= 0x00000FF5; - break; - case WIRELESS_MODE_N_24G: - case WIRELESS_MODE_N_5G: - nmode = 1; - if (mimo_ps == IEEE80211_SMPS_STATIC) { - ratr_value &= 0x0007F005; - } else { - u32 ratr_mask; - - if (get_rf_type(rtlphy) == RF_1T2R || - get_rf_type(rtlphy) == RF_1T1R) { - ratr_mask = 0x000ff005; - } else { - ratr_mask = 0x0f0ff005; - } - - ratr_value &= ratr_mask; - } - break; - default: - if (rtlphy->rf_type == RF_1T2R) - ratr_value &= 0x000ff0ff; - else - ratr_value &= 0x0f0ff0ff; - - break; - } - ratr_value &= 0x0FFFFFFF; - if (nmode && ((curtxbw_40mhz && curshortgi_40mhz) || - (!curtxbw_40mhz && curshortgi_20mhz))) { - ratr_value |= 0x10000000; - tmp_ratr_value = (ratr_value >> 12); - for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) { - if ((1 << shortgi_rate) & tmp_ratr_value) - break; - } - shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) | - (shortgi_rate << 4) | (shortgi_rate); - } - rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n", - rtl_read_dword(rtlpriv, REG_ARFR0)); -} - -static void rtl92de_update_hal_rate_mask(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_sta_info *sta_entry = NULL; - u32 ratr_bitmap; - u8 ratr_index; - u8 curtxbw_40mhz = (sta->bandwidth >= IEEE80211_STA_RX_BW_40) ? 1 : 0; - u8 curshortgi_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? - 1 : 0; - u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? - 1 : 0; - enum wireless_mode wirelessmode = 0; - bool shortgi = false; - u32 value[2]; - u8 macid = 0; - u8 mimo_ps = IEEE80211_SMPS_OFF; - - sta_entry = (struct rtl_sta_info *) sta->drv_priv; - mimo_ps = sta_entry->mimo_ps; - wirelessmode = sta_entry->wireless_mode; - if (mac->opmode == NL80211_IFTYPE_STATION) - curtxbw_40mhz = mac->bw_40; - else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) - macid = sta->aid + 1; - - if (rtlhal->current_bandtype == BAND_ON_5G) - ratr_bitmap = sta->supp_rates[1] << 4; - else - ratr_bitmap = sta->supp_rates[0]; - ratr_bitmap |= (sta->ht_cap.mcs.rx_mask[1] << 20 | - sta->ht_cap.mcs.rx_mask[0] << 12); - switch (wirelessmode) { - case WIRELESS_MODE_B: - ratr_index = RATR_INX_WIRELESS_B; - if (ratr_bitmap & 0x0000000c) - ratr_bitmap &= 0x0000000d; - else - ratr_bitmap &= 0x0000000f; - break; - case WIRELESS_MODE_G: - ratr_index = RATR_INX_WIRELESS_GB; - - if (rssi_level == 1) - ratr_bitmap &= 0x00000f00; - else if (rssi_level == 2) - ratr_bitmap &= 0x00000ff0; - else - ratr_bitmap &= 0x00000ff5; - break; - case WIRELESS_MODE_A: - ratr_index = RATR_INX_WIRELESS_G; - ratr_bitmap &= 0x00000ff0; - break; - case WIRELESS_MODE_N_24G: - case WIRELESS_MODE_N_5G: - if (wirelessmode == WIRELESS_MODE_N_24G) - ratr_index = RATR_INX_WIRELESS_NGB; - else - ratr_index = RATR_INX_WIRELESS_NG; - if (mimo_ps == IEEE80211_SMPS_STATIC) { - if (rssi_level == 1) - ratr_bitmap &= 0x00070000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0007f000; - else - ratr_bitmap &= 0x0007f005; - } else { - if (rtlphy->rf_type == RF_1T2R || - rtlphy->rf_type == RF_1T1R) { - if (curtxbw_40mhz) { - if (rssi_level == 1) - ratr_bitmap &= 0x000f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x000ff000; - else - ratr_bitmap &= 0x000ff015; - } else { - if (rssi_level == 1) - ratr_bitmap &= 0x000f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x000ff000; - else - ratr_bitmap &= 0x000ff005; - } - } else { - if (curtxbw_40mhz) { - if (rssi_level == 1) - ratr_bitmap &= 0x0f0f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0f0ff000; - else - ratr_bitmap &= 0x0f0ff015; - } else { - if (rssi_level == 1) - ratr_bitmap &= 0x0f0f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0f0ff000; - else - ratr_bitmap &= 0x0f0ff005; - } - } - } - if ((curtxbw_40mhz && curshortgi_40mhz) || - (!curtxbw_40mhz && curshortgi_20mhz)) { - - if (macid == 0) - shortgi = true; - else if (macid == 1) - shortgi = false; - } - break; - default: - ratr_index = RATR_INX_WIRELESS_NGB; - - if (rtlphy->rf_type == RF_1T2R) - ratr_bitmap &= 0x000ff0ff; - else - ratr_bitmap &= 0x0f0ff0ff; - break; - } - - value[0] = (ratr_bitmap & 0x0fffffff) | (ratr_index << 28); - value[1] = macid | (shortgi ? 0x20 : 0x00) | 0x80; - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, - "ratr_bitmap :%x value0:%x value1:%x\n", - ratr_bitmap, value[0], value[1]); - rtl92d_fill_h2c_cmd(hw, H2C_RA_MASK, 5, (u8 *) value); - if (macid != 0) - sta_entry->ratr_index = ratr_index; -} - -void rtl92de_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->dm.useramask) - rtl92de_update_hal_rate_mask(hw, sta, rssi_level); - else - rtl92de_update_hal_rate_table(hw, sta); -} - -void rtl92de_update_channel_access_setting(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 sifs_timer; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME, - &mac->slot_time); - if (!mac->ht_enable) - sifs_timer = 0x0a0a; - else - sifs_timer = 0x1010; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SIFS, (u8 *)&sifs_timer); -} - -bool rtl92de_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - enum rf_pwrstate e_rfpowerstate_toset; - u8 u1tmp; - bool actuallyset = false; - unsigned long flag; - - if (rtlpci->being_init_adapter) - return false; - if (ppsc->swrf_processing) - return false; - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); - if (ppsc->rfchange_inprogress) { - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - return false; - } else { - ppsc->rfchange_inprogress = true; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - } - rtl_write_byte(rtlpriv, REG_MAC_PINMUX_CFG, rtl_read_byte(rtlpriv, - REG_MAC_PINMUX_CFG) & ~(BIT(3))); - u1tmp = rtl_read_byte(rtlpriv, REG_GPIO_IO_SEL); - e_rfpowerstate_toset = (u1tmp & BIT(3)) ? ERFON : ERFOFF; - if (ppsc->hwradiooff && (e_rfpowerstate_toset == ERFON)) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "GPIOChangeRF - HW Radio ON, RF ON\n"); - e_rfpowerstate_toset = ERFON; - ppsc->hwradiooff = false; - actuallyset = true; - } else if (!ppsc->hwradiooff && (e_rfpowerstate_toset == ERFOFF)) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "GPIOChangeRF - HW Radio OFF, RF OFF\n"); - e_rfpowerstate_toset = ERFOFF; - ppsc->hwradiooff = true; - actuallyset = true; - } - if (actuallyset) { - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); - ppsc->rfchange_inprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - } else { - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); - ppsc->rfchange_inprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - } - *valid = 1; - return !ppsc->hwradiooff; -} - -void rtl92de_set_key(struct ieee80211_hw *hw, u32 key_index, - u8 *p_macaddr, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 *macaddr = p_macaddr; - u32 entry_id; - bool is_pairwise = false; - static u8 cam_const_addr[4][6] = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} - }; - static u8 cam_const_broad[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - }; - - if (clear_all) { - u8 idx; - u8 cam_offset = 0; - u8 clear_number = 5; - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "clear_all\n"); - for (idx = 0; idx < clear_number; idx++) { - rtl_cam_mark_invalid(hw, cam_offset + idx); - rtl_cam_empty_entry(hw, cam_offset + idx); - - if (idx < 5) { - memset(rtlpriv->sec.key_buf[idx], 0, - MAX_KEY_LEN); - rtlpriv->sec.key_len[idx] = 0; - } - } - } else { - switch (enc_algo) { - case WEP40_ENCRYPTION: - enc_algo = CAM_WEP40; - break; - case WEP104_ENCRYPTION: - enc_algo = CAM_WEP104; - break; - case TKIP_ENCRYPTION: - enc_algo = CAM_TKIP; - break; - case AESCCMP_ENCRYPTION: - enc_algo = CAM_AES; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - enc_algo = CAM_TKIP; - break; - } - if (is_wepkey || rtlpriv->sec.use_defaultkey) { - macaddr = cam_const_addr[key_index]; - entry_id = key_index; - } else { - if (is_group) { - macaddr = cam_const_broad; - entry_id = key_index; - } else { - if (mac->opmode == NL80211_IFTYPE_AP) { - entry_id = rtl_cam_get_free_entry(hw, - p_macaddr); - if (entry_id >= TOTAL_CAM_ENTRY) { - RT_TRACE(rtlpriv, COMP_SEC, - DBG_EMERG, - "Can not find free hw security cam entry\n"); - return; - } - } else { - entry_id = CAM_PAIRWISE_KEY_POSITION; - } - key_index = PAIRWISE_KEYIDX; - is_pairwise = true; - } - } - if (rtlpriv->sec.key_len[key_index] == 0) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "delete one entry, entry_id is %d\n", - entry_id); - if (mac->opmode == NL80211_IFTYPE_AP) - rtl_cam_del_entry(hw, p_macaddr); - rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); - } else { - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, - "The insert KEY length is %d\n", - rtlpriv->sec.key_len[PAIRWISE_KEYIDX]); - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, - "The insert KEY is %x %x\n", - rtlpriv->sec.key_buf[0][0], - rtlpriv->sec.key_buf[0][1]); - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "add one entry\n"); - if (is_pairwise) { - RT_PRINT_DATA(rtlpriv, COMP_SEC, DBG_LOUD, - "Pairwise Key content", - rtlpriv->sec.pairwise_key, - rtlpriv-> - sec.key_len[PAIRWISE_KEYIDX]); - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "set Pairwise key\n"); - rtl_cam_add_one_entry(hw, macaddr, key_index, - entry_id, enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv-> - sec.key_buf[key_index]); - } else { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "set group key\n"); - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - rtl_cam_add_one_entry(hw, - rtlefuse->dev_addr, - PAIRWISE_KEYIDX, - CAM_PAIRWISE_KEY_POSITION, - enc_algo, CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf[entry_id]); - } - rtl_cam_add_one_entry(hw, macaddr, key_index, - entry_id, enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf - [entry_id]); - } - } - } -} - -void rtl92de_suspend(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->rtlhal.macphyctl_reg = rtl_read_byte(rtlpriv, - REG_MAC_PHY_CTRL_NORMAL); -} - -void rtl92de_resume(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_byte(rtlpriv, REG_MAC_PHY_CTRL_NORMAL, - rtlpriv->rtlhal.macphyctl_reg); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/hw.h b/drivers/net/wireless/rtlwifi/rtl8192de/hw.h deleted file mode 100644 index 7c9f7a2f1e42..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/hw.h +++ /dev/null @@ -1,66 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92DE_HW_H__ -#define __RTL92DE_HW_H__ - -void rtl92de_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); -void rtl92de_read_eeprom_info(struct ieee80211_hw *hw); -void rtl92de_interrupt_recognized(struct ieee80211_hw *hw, - u32 *p_inta, u32 *p_intb); -int rtl92de_hw_init(struct ieee80211_hw *hw); -void rtl92de_card_disable(struct ieee80211_hw *hw); -void rtl92de_enable_interrupt(struct ieee80211_hw *hw); -void rtl92de_disable_interrupt(struct ieee80211_hw *hw); -int rtl92de_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type); -void rtl92de_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); -void rtl92de_set_qos(struct ieee80211_hw *hw, int aci); -void rtl92de_set_beacon_related_registers(struct ieee80211_hw *hw); -void rtl92de_set_beacon_interval(struct ieee80211_hw *hw); -void rtl92de_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr); -void rtl92de_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); -void rtl92de_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level); -void rtl92de_update_channel_access_setting(struct ieee80211_hw *hw); -bool rtl92de_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid); -void rtl92de_enable_hw_security_config(struct ieee80211_hw *hw); -void rtl92de_set_key(struct ieee80211_hw *hw, u32 key_index, - u8 *p_macaddr, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all); - -extern void rtl92de_write_dword_dbi(struct ieee80211_hw *hw, u16 offset, - u32 value, u8 direct); -extern u32 rtl92de_read_dword_dbi(struct ieee80211_hw *hw, u16 offset, - u8 direct); -void rtl92de_suspend(struct ieee80211_hw *hw); -void rtl92de_resume(struct ieee80211_hw *hw); -void rtl92d_linked_set_reg(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/led.c b/drivers/net/wireless/rtlwifi/rtl8192de/led.c deleted file mode 100644 index 76a57ae4af3e..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/led.c +++ /dev/null @@ -1,159 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "reg.h" -#include "led.h" - -static void _rtl92ce_init_led(struct ieee80211_hw *hw, - struct rtl_led *pled, enum rtl_led_pin ledpin) -{ - pled->hw = hw; - pled->ledpin = ledpin; - pled->ledon = false; -} - -void rtl92de_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - u8 ledcfg; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n", - REG_LEDCFG2, pled->ledpin); - - switch (pled->ledpin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); - - if ((rtlpriv->efuse.eeprom_did == 0x8176) || - (rtlpriv->efuse.eeprom_did == 0x8193)) - /* BIT7 of REG_LEDCFG2 should be set to - * make sure we could emit the led2. */ - rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg & 0xf0) | - BIT(7) | BIT(5) | BIT(6)); - else - rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg & 0xf0) | - BIT(7) | BIT(5)); - break; - case LED_PIN_LED1: - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG1); - - rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg & 0x0f) | BIT(5)); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - pled->ledon = true; -} - -void rtl92de_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - u8 ledcfg; - - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n", - REG_LEDCFG2, pled->ledpin); - - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); - - switch (pled->ledpin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - ledcfg &= 0xf0; - if (pcipriv->ledctl.led_opendrain) - rtl_write_byte(rtlpriv, REG_LEDCFG2, - (ledcfg | BIT(1) | BIT(5) | BIT(6))); - else - rtl_write_byte(rtlpriv, REG_LEDCFG2, - (ledcfg | BIT(3) | BIT(5) | BIT(6))); - break; - case LED_PIN_LED1: - ledcfg &= 0x0f; - rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg | BIT(3))); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - pled->ledon = false; -} - -void rtl92de_init_sw_leds(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - _rtl92ce_init_led(hw, &(pcipriv->ledctl.sw_led0), LED_PIN_LED0); - _rtl92ce_init_led(hw, &(pcipriv->ledctl.sw_led1), LED_PIN_LED1); -} - -static void _rtl92ce_sw_led_control(struct ieee80211_hw *hw, - enum led_ctl_mode ledaction) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); - switch (ledaction) { - case LED_CTL_POWER_ON: - case LED_CTL_LINK: - case LED_CTL_NO_LINK: - rtl92de_sw_led_on(hw, pLed0); - break; - case LED_CTL_POWER_OFF: - rtl92de_sw_led_off(hw, pLed0); - break; - default: - break; - } -} - -void rtl92de_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - if ((ppsc->rfoff_reason > RF_CHANGE_BY_PS) && - (ledaction == LED_CTL_TX || - ledaction == LED_CTL_RX || - ledaction == LED_CTL_SITE_SURVEY || - ledaction == LED_CTL_LINK || - ledaction == LED_CTL_NO_LINK || - ledaction == LED_CTL_START_TO_LINK || - ledaction == LED_CTL_POWER_ON)) { - return; - } - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "ledaction %d,\n", ledaction); - - _rtl92ce_sw_led_control(hw, ledaction); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/led.h b/drivers/net/wireless/rtlwifi/rtl8192de/led.h deleted file mode 100644 index a29df30c3025..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/led.h +++ /dev/null @@ -1,38 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CE_LED_H__ -#define __RTL92CE_LED_H__ - -void rtl92de_init_sw_leds(struct ieee80211_hw *hw); -void rtl92de_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl92de_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl92de_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c deleted file mode 100644 index 840bac5fa2f8..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c +++ /dev/null @@ -1,3695 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../ps.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" -#include "table.h" -#include "sw.h" -#include "hw.h" - -#define MAX_RF_IMR_INDEX 12 -#define MAX_RF_IMR_INDEX_NORMAL 13 -#define RF_REG_NUM_FOR_C_CUT_5G 6 -#define RF_REG_NUM_FOR_C_CUT_5G_INTERNALPA 7 -#define RF_REG_NUM_FOR_C_CUT_2G 5 -#define RF_CHNL_NUM_5G 19 -#define RF_CHNL_NUM_5G_40M 17 -#define TARGET_CHNL_NUM_5G 221 -#define TARGET_CHNL_NUM_2G 14 -#define CV_CURVE_CNT 64 - -static u32 rf_reg_for_5g_swchnl_normal[MAX_RF_IMR_INDEX_NORMAL] = { - 0, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x0 -}; - -static u8 rf_reg_for_c_cut_5g[RF_REG_NUM_FOR_C_CUT_5G] = { - RF_SYN_G1, RF_SYN_G2, RF_SYN_G3, RF_SYN_G4, RF_SYN_G5, RF_SYN_G6 -}; - -static u8 rf_reg_for_c_cut_2g[RF_REG_NUM_FOR_C_CUT_2G] = { - RF_SYN_G1, RF_SYN_G2, RF_SYN_G3, RF_SYN_G7, RF_SYN_G8 -}; - -static u8 rf_for_c_cut_5g_internal_pa[RF_REG_NUM_FOR_C_CUT_5G_INTERNALPA] = { - 0x0B, 0x48, 0x49, 0x4B, 0x03, 0x04, 0x0E -}; - -static u32 rf_reg_mask_for_c_cut_2g[RF_REG_NUM_FOR_C_CUT_2G] = { - BIT(19) | BIT(18) | BIT(17) | BIT(14) | BIT(1), - BIT(10) | BIT(9), - BIT(18) | BIT(17) | BIT(16) | BIT(1), - BIT(2) | BIT(1), - BIT(15) | BIT(14) | BIT(13) | BIT(12) | BIT(11) -}; - -static u8 rf_chnl_5g[RF_CHNL_NUM_5G] = { - 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, - 112, 116, 120, 124, 128, 132, 136, 140 -}; - -static u8 rf_chnl_5g_40m[RF_CHNL_NUM_5G_40M] = { - 38, 42, 46, 50, 54, 58, 62, 102, 106, 110, 114, - 118, 122, 126, 130, 134, 138 -}; -static u32 rf_reg_pram_c_5g[5][RF_REG_NUM_FOR_C_CUT_5G] = { - {0xE43BE, 0xFC638, 0x77C0A, 0xDE471, 0xd7110, 0x8EB04}, - {0xE43BE, 0xFC078, 0xF7C1A, 0xE0C71, 0xD7550, 0xAEB04}, - {0xE43BF, 0xFF038, 0xF7C0A, 0xDE471, 0xE5550, 0xAEB04}, - {0xE43BF, 0xFF079, 0xF7C1A, 0xDE471, 0xE5550, 0xAEB04}, - {0xE43BF, 0xFF038, 0xF7C1A, 0xDE471, 0xd7550, 0xAEB04} -}; - -static u32 rf_reg_param_for_c_cut_2g[3][RF_REG_NUM_FOR_C_CUT_2G] = { - {0x643BC, 0xFC038, 0x77C1A, 0x41289, 0x01840}, - {0x643BC, 0xFC038, 0x07C1A, 0x41289, 0x01840}, - {0x243BC, 0xFC438, 0x07C1A, 0x4128B, 0x0FC41} -}; - -static u32 rf_syn_g4_for_c_cut_2g = 0xD1C31 & 0x7FF; - -static u32 rf_pram_c_5g_int_pa[3][RF_REG_NUM_FOR_C_CUT_5G_INTERNALPA] = { - {0x01a00, 0x40443, 0x00eb5, 0x89bec, 0x94a12, 0x94a12, 0x94a12}, - {0x01800, 0xc0443, 0x00730, 0x896ee, 0x94a52, 0x94a52, 0x94a52}, - {0x01800, 0xc0443, 0x00730, 0x896ee, 0x94a12, 0x94a12, 0x94a12} -}; - -/* [mode][patha+b][reg] */ -static u32 rf_imr_param_normal[1][3][MAX_RF_IMR_INDEX_NORMAL] = { - { - /* channel 1-14. */ - { - 0x70000, 0x00ff0, 0x4400f, 0x00ff0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x64888, 0xe266c, 0x00090, 0x22fff - }, - /* path 36-64 */ - { - 0x70000, 0x22880, 0x4470f, 0x55880, 0x00070, 0x88000, - 0x0, 0x88080, 0x70000, 0x64a82, 0xe466c, 0x00090, - 0x32c9a - }, - /* 100 -165 */ - { - 0x70000, 0x44880, 0x4477f, 0x77880, 0x00070, 0x88000, - 0x0, 0x880b0, 0x0, 0x64b82, 0xe466c, 0x00090, 0x32c9a - } - } -}; - -static u32 curveindex_5g[TARGET_CHNL_NUM_5G] = {0}; - -static u32 curveindex_2g[TARGET_CHNL_NUM_2G] = {0}; - -static u32 targetchnl_5g[TARGET_CHNL_NUM_5G] = { - 25141, 25116, 25091, 25066, 25041, - 25016, 24991, 24966, 24941, 24917, - 24892, 24867, 24843, 24818, 24794, - 24770, 24765, 24721, 24697, 24672, - 24648, 24624, 24600, 24576, 24552, - 24528, 24504, 24480, 24457, 24433, - 24409, 24385, 24362, 24338, 24315, - 24291, 24268, 24245, 24221, 24198, - 24175, 24151, 24128, 24105, 24082, - 24059, 24036, 24013, 23990, 23967, - 23945, 23922, 23899, 23876, 23854, - 23831, 23809, 23786, 23764, 23741, - 23719, 23697, 23674, 23652, 23630, - 23608, 23586, 23564, 23541, 23519, - 23498, 23476, 23454, 23432, 23410, - 23388, 23367, 23345, 23323, 23302, - 23280, 23259, 23237, 23216, 23194, - 23173, 23152, 23130, 23109, 23088, - 23067, 23046, 23025, 23003, 22982, - 22962, 22941, 22920, 22899, 22878, - 22857, 22837, 22816, 22795, 22775, - 22754, 22733, 22713, 22692, 22672, - 22652, 22631, 22611, 22591, 22570, - 22550, 22530, 22510, 22490, 22469, - 22449, 22429, 22409, 22390, 22370, - 22350, 22336, 22310, 22290, 22271, - 22251, 22231, 22212, 22192, 22173, - 22153, 22134, 22114, 22095, 22075, - 22056, 22037, 22017, 21998, 21979, - 21960, 21941, 21921, 21902, 21883, - 21864, 21845, 21826, 21807, 21789, - 21770, 21751, 21732, 21713, 21695, - 21676, 21657, 21639, 21620, 21602, - 21583, 21565, 21546, 21528, 21509, - 21491, 21473, 21454, 21436, 21418, - 21400, 21381, 21363, 21345, 21327, - 21309, 21291, 21273, 21255, 21237, - 21219, 21201, 21183, 21166, 21148, - 21130, 21112, 21095, 21077, 21059, - 21042, 21024, 21007, 20989, 20972, - 25679, 25653, 25627, 25601, 25575, - 25549, 25523, 25497, 25471, 25446, - 25420, 25394, 25369, 25343, 25318, - 25292, 25267, 25242, 25216, 25191, - 25166 -}; - -/* channel 1~14 */ -static u32 targetchnl_2g[TARGET_CHNL_NUM_2G] = { - 26084, 26030, 25976, 25923, 25869, 25816, 25764, - 25711, 25658, 25606, 25554, 25502, 25451, 25328 -}; - -static u32 _rtl92d_phy_calculate_bit_shift(u32 bitmask) -{ - u32 i; - - for (i = 0; i <= 31; i++) { - if (((bitmask >> i) & 0x1) == 1) - break; - } - - return i; -} - -u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - u32 returnvalue, originalvalue, bitshift; - u8 dbi_direct; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "regaddr(%#x), bitmask(%#x)\n", - regaddr, bitmask); - if (rtlhal->during_mac1init_radioa || rtlhal->during_mac0init_radiob) { - /* mac1 use phy0 read radio_b. */ - /* mac0 use phy1 read radio_b. */ - if (rtlhal->during_mac1init_radioa) - dbi_direct = BIT(3); - else if (rtlhal->during_mac0init_radiob) - dbi_direct = BIT(3) | BIT(2); - originalvalue = rtl92de_read_dword_dbi(hw, (u16)regaddr, - dbi_direct); - } else { - originalvalue = rtl_read_dword(rtlpriv, regaddr); - } - bitshift = _rtl92d_phy_calculate_bit_shift(bitmask); - returnvalue = (originalvalue & bitmask) >> bitshift; - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "BBR MASK=0x%x Addr[0x%x]=0x%x\n", - bitmask, regaddr, originalvalue); - return returnvalue; -} - -void rtl92d_phy_set_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - u8 dbi_direct = 0; - u32 originalvalue, bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x)\n", - regaddr, bitmask, data); - if (rtlhal->during_mac1init_radioa) - dbi_direct = BIT(3); - else if (rtlhal->during_mac0init_radiob) - /* mac0 use phy1 write radio_b. */ - dbi_direct = BIT(3) | BIT(2); - if (bitmask != BMASKDWORD) { - if (rtlhal->during_mac1init_radioa || - rtlhal->during_mac0init_radiob) - originalvalue = rtl92de_read_dword_dbi(hw, - (u16) regaddr, - dbi_direct); - else - originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _rtl92d_phy_calculate_bit_shift(bitmask); - data = ((originalvalue & (~bitmask)) | (data << bitshift)); - } - if (rtlhal->during_mac1init_radioa || rtlhal->during_mac0init_radiob) - rtl92de_write_dword_dbi(hw, (u16) regaddr, data, dbi_direct); - else - rtl_write_dword(rtlpriv, regaddr, data); - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x)\n", - regaddr, bitmask, data); -} - -static u32 _rtl92d_phy_rf_serial_read(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset) -{ - - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; - u32 newoffset; - u32 tmplong, tmplong2; - u8 rfpi_enable = 0; - u32 retvalue; - - newoffset = offset; - tmplong = rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, BMASKDWORD); - if (rfpath == RF90_PATH_A) - tmplong2 = tmplong; - else - tmplong2 = rtl_get_bbreg(hw, pphyreg->rfhssi_para2, BMASKDWORD); - tmplong2 = (tmplong2 & (~BLSSIREADADDRESS)) | - (newoffset << 23) | BLSSIREADEDGE; - rtl_set_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, BMASKDWORD, - tmplong & (~BLSSIREADEDGE)); - udelay(10); - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, BMASKDWORD, tmplong2); - udelay(50); - udelay(50); - rtl_set_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, BMASKDWORD, - tmplong | BLSSIREADEDGE); - udelay(10); - if (rfpath == RF90_PATH_A) - rfpi_enable = (u8) rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER1, - BIT(8)); - else if (rfpath == RF90_PATH_B) - rfpi_enable = (u8) rtl_get_bbreg(hw, RFPGA0_XB_HSSIPARAMETER1, - BIT(8)); - if (rfpi_enable) - retvalue = rtl_get_bbreg(hw, pphyreg->rf_rbpi, - BLSSIREADBACKDATA); - else - retvalue = rtl_get_bbreg(hw, pphyreg->rf_rb, - BLSSIREADBACKDATA); - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFR-%d Addr[0x%x] = 0x%x\n", - rfpath, pphyreg->rf_rb, retvalue); - return retvalue; -} - -static void _rtl92d_phy_rf_serial_write(struct ieee80211_hw *hw, - enum radio_path rfpath, - u32 offset, u32 data) -{ - u32 data_and_addr; - u32 newoffset; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; - - newoffset = offset; - /* T65 RF */ - data_and_addr = ((newoffset << 20) | (data & 0x000fffff)) & 0x0fffffff; - rtl_set_bbreg(hw, pphyreg->rf3wire_offset, BMASKDWORD, data_and_addr); - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFW-%d Addr[0x%x]=0x%x\n", - rfpath, pphyreg->rf3wire_offset, data_and_addr); -} - -u32 rtl92d_phy_query_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, u32 bitmask) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 original_value, readback_value, bitshift; - unsigned long flags; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n", - regaddr, rfpath, bitmask); - spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags); - original_value = _rtl92d_phy_rf_serial_read(hw, rfpath, regaddr); - bitshift = _rtl92d_phy_calculate_bit_shift(bitmask); - readback_value = (original_value & bitmask) >> bitshift; - spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags); - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n", - regaddr, rfpath, bitmask, original_value); - return readback_value; -} - -void rtl92d_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, - u32 regaddr, u32 bitmask, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 original_value, bitshift; - unsigned long flags; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", - regaddr, bitmask, data, rfpath); - if (bitmask == 0) - return; - spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags); - if (rtlphy->rf_mode != RF_OP_BY_FW) { - if (bitmask != BRFREGOFFSETMASK) { - original_value = _rtl92d_phy_rf_serial_read(hw, - rfpath, regaddr); - bitshift = _rtl92d_phy_calculate_bit_shift(bitmask); - data = ((original_value & (~bitmask)) | - (data << bitshift)); - } - _rtl92d_phy_rf_serial_write(hw, rfpath, regaddr, data); - } - spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags); - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", - regaddr, bitmask, data, rfpath); -} - -bool rtl92d_phy_mac_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - u32 arraylength; - u32 *ptrarray; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Read Rtl819XMACPHY_Array\n"); - arraylength = MAC_2T_ARRAYLENGTH; - ptrarray = rtl8192de_mac_2tarray; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Img:Rtl819XMAC_Array\n"); - for (i = 0; i < arraylength; i = i + 2) - rtl_write_byte(rtlpriv, ptrarray[i], (u8) ptrarray[i + 1]); - if (rtlpriv->rtlhal.macphymode == SINGLEMAC_SINGLEPHY) { - /* improve 2-stream TX EVM */ - /* rtl_write_byte(rtlpriv, 0x14,0x71); */ - /* AMPDU aggregation number 9 */ - /* rtl_write_word(rtlpriv, REG_MAX_AGGR_NUM, MAX_AGGR_NUM); */ - rtl_write_byte(rtlpriv, REG_MAX_AGGR_NUM, 0x0B); - } else { - /* 92D need to test to decide the num. */ - rtl_write_byte(rtlpriv, REG_MAX_AGGR_NUM, 0x07); - } - return true; -} - -static void _rtl92d_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - /* RF Interface Sowrtware Control */ - /* 16 LSBs if read 32-bit from 0x870 */ - rtlphy->phyreg_def[RF90_PATH_A].rfintfs = RFPGA0_XAB_RFINTERFACESW; - /* 16 MSBs if read 32-bit from 0x870 (16-bit for 0x872) */ - rtlphy->phyreg_def[RF90_PATH_B].rfintfs = RFPGA0_XAB_RFINTERFACESW; - /* 16 LSBs if read 32-bit from 0x874 */ - rtlphy->phyreg_def[RF90_PATH_C].rfintfs = RFPGA0_XCD_RFINTERFACESW; - /* 16 MSBs if read 32-bit from 0x874 (16-bit for 0x876) */ - - rtlphy->phyreg_def[RF90_PATH_D].rfintfs = RFPGA0_XCD_RFINTERFACESW; - /* RF Interface Readback Value */ - /* 16 LSBs if read 32-bit from 0x8E0 */ - rtlphy->phyreg_def[RF90_PATH_A].rfintfi = RFPGA0_XAB_RFINTERFACERB; - /* 16 MSBs if read 32-bit from 0x8E0 (16-bit for 0x8E2) */ - rtlphy->phyreg_def[RF90_PATH_B].rfintfi = RFPGA0_XAB_RFINTERFACERB; - /* 16 LSBs if read 32-bit from 0x8E4 */ - rtlphy->phyreg_def[RF90_PATH_C].rfintfi = RFPGA0_XCD_RFINTERFACERB; - /* 16 MSBs if read 32-bit from 0x8E4 (16-bit for 0x8E6) */ - rtlphy->phyreg_def[RF90_PATH_D].rfintfi = RFPGA0_XCD_RFINTERFACERB; - - /* RF Interface Output (and Enable) */ - /* 16 LSBs if read 32-bit from 0x860 */ - rtlphy->phyreg_def[RF90_PATH_A].rfintfo = RFPGA0_XA_RFINTERFACEOE; - /* 16 LSBs if read 32-bit from 0x864 */ - rtlphy->phyreg_def[RF90_PATH_B].rfintfo = RFPGA0_XB_RFINTERFACEOE; - - /* RF Interface (Output and) Enable */ - /* 16 MSBs if read 32-bit from 0x860 (16-bit for 0x862) */ - rtlphy->phyreg_def[RF90_PATH_A].rfintfe = RFPGA0_XA_RFINTERFACEOE; - /* 16 MSBs if read 32-bit from 0x864 (16-bit for 0x866) */ - rtlphy->phyreg_def[RF90_PATH_B].rfintfe = RFPGA0_XB_RFINTERFACEOE; - - /* Addr of LSSI. Wirte RF register by driver */ - /* LSSI Parameter */ - rtlphy->phyreg_def[RF90_PATH_A].rf3wire_offset = - RFPGA0_XA_LSSIPARAMETER; - rtlphy->phyreg_def[RF90_PATH_B].rf3wire_offset = - RFPGA0_XB_LSSIPARAMETER; - - /* RF parameter */ - /* BB Band Select */ - rtlphy->phyreg_def[RF90_PATH_A].rflssi_select = RFPGA0_XAB_RFPARAMETER; - rtlphy->phyreg_def[RF90_PATH_B].rflssi_select = RFPGA0_XAB_RFPARAMETER; - rtlphy->phyreg_def[RF90_PATH_C].rflssi_select = RFPGA0_XCD_RFPARAMETER; - rtlphy->phyreg_def[RF90_PATH_D].rflssi_select = RFPGA0_XCD_RFPARAMETER; - - /* Tx AGC Gain Stage (same for all path. Should we remove this?) */ - /* Tx gain stage */ - rtlphy->phyreg_def[RF90_PATH_A].rftxgain_stage = RFPGA0_TXGAINSTAGE; - /* Tx gain stage */ - rtlphy->phyreg_def[RF90_PATH_B].rftxgain_stage = RFPGA0_TXGAINSTAGE; - /* Tx gain stage */ - rtlphy->phyreg_def[RF90_PATH_C].rftxgain_stage = RFPGA0_TXGAINSTAGE; - /* Tx gain stage */ - rtlphy->phyreg_def[RF90_PATH_D].rftxgain_stage = RFPGA0_TXGAINSTAGE; - - /* Tranceiver A~D HSSI Parameter-1 */ - /* wire control parameter1 */ - rtlphy->phyreg_def[RF90_PATH_A].rfhssi_para1 = RFPGA0_XA_HSSIPARAMETER1; - /* wire control parameter1 */ - rtlphy->phyreg_def[RF90_PATH_B].rfhssi_para1 = RFPGA0_XB_HSSIPARAMETER1; - - /* Tranceiver A~D HSSI Parameter-2 */ - /* wire control parameter2 */ - rtlphy->phyreg_def[RF90_PATH_A].rfhssi_para2 = RFPGA0_XA_HSSIPARAMETER2; - /* wire control parameter2 */ - rtlphy->phyreg_def[RF90_PATH_B].rfhssi_para2 = RFPGA0_XB_HSSIPARAMETER2; - - /* RF switch Control */ - /* TR/Ant switch control */ - rtlphy->phyreg_def[RF90_PATH_A].rfsw_ctrl = RFPGA0_XAB_SWITCHCONTROL; - rtlphy->phyreg_def[RF90_PATH_B].rfsw_ctrl = RFPGA0_XAB_SWITCHCONTROL; - rtlphy->phyreg_def[RF90_PATH_C].rfsw_ctrl = RFPGA0_XCD_SWITCHCONTROL; - rtlphy->phyreg_def[RF90_PATH_D].rfsw_ctrl = RFPGA0_XCD_SWITCHCONTROL; - - /* AGC control 1 */ - rtlphy->phyreg_def[RF90_PATH_A].rfagc_control1 = ROFDM0_XAAGCCORE1; - rtlphy->phyreg_def[RF90_PATH_B].rfagc_control1 = ROFDM0_XBAGCCORE1; - rtlphy->phyreg_def[RF90_PATH_C].rfagc_control1 = ROFDM0_XCAGCCORE1; - rtlphy->phyreg_def[RF90_PATH_D].rfagc_control1 = ROFDM0_XDAGCCORE1; - - /* AGC control 2 */ - rtlphy->phyreg_def[RF90_PATH_A].rfagc_control2 = ROFDM0_XAAGCCORE2; - rtlphy->phyreg_def[RF90_PATH_B].rfagc_control2 = ROFDM0_XBAGCCORE2; - rtlphy->phyreg_def[RF90_PATH_C].rfagc_control2 = ROFDM0_XCAGCCORE2; - rtlphy->phyreg_def[RF90_PATH_D].rfagc_control2 = ROFDM0_XDAGCCORE2; - - /* RX AFE control 1 */ - rtlphy->phyreg_def[RF90_PATH_A].rfrxiq_imbal = ROFDM0_XARXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_B].rfrxiq_imbal = ROFDM0_XBRXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_C].rfrxiq_imbal = ROFDM0_XCRXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_D].rfrxiq_imbal = ROFDM0_XDRXIQIMBALANCE; - - /*RX AFE control 1 */ - rtlphy->phyreg_def[RF90_PATH_A].rfrx_afe = ROFDM0_XARXAFE; - rtlphy->phyreg_def[RF90_PATH_B].rfrx_afe = ROFDM0_XBRXAFE; - rtlphy->phyreg_def[RF90_PATH_C].rfrx_afe = ROFDM0_XCRXAFE; - rtlphy->phyreg_def[RF90_PATH_D].rfrx_afe = ROFDM0_XDRXAFE; - - /* Tx AFE control 1 */ - rtlphy->phyreg_def[RF90_PATH_A].rftxiq_imbal = ROFDM0_XATxIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_B].rftxiq_imbal = ROFDM0_XBTxIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_C].rftxiq_imbal = ROFDM0_XCTxIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_D].rftxiq_imbal = ROFDM0_XDTxIQIMBALANCE; - - /* Tx AFE control 2 */ - rtlphy->phyreg_def[RF90_PATH_A].rftx_afe = ROFDM0_XATxAFE; - rtlphy->phyreg_def[RF90_PATH_B].rftx_afe = ROFDM0_XBTxAFE; - rtlphy->phyreg_def[RF90_PATH_C].rftx_afe = ROFDM0_XCTxAFE; - rtlphy->phyreg_def[RF90_PATH_D].rftx_afe = ROFDM0_XDTxAFE; - - /* Tranceiver LSSI Readback SI mode */ - rtlphy->phyreg_def[RF90_PATH_A].rf_rb = RFPGA0_XA_LSSIREADBACK; - rtlphy->phyreg_def[RF90_PATH_B].rf_rb = RFPGA0_XB_LSSIREADBACK; - rtlphy->phyreg_def[RF90_PATH_C].rf_rb = RFPGA0_XC_LSSIREADBACK; - rtlphy->phyreg_def[RF90_PATH_D].rf_rb = RFPGA0_XD_LSSIREADBACK; - - /* Tranceiver LSSI Readback PI mode */ - rtlphy->phyreg_def[RF90_PATH_A].rf_rbpi = TRANSCEIVERA_HSPI_READBACK; - rtlphy->phyreg_def[RF90_PATH_B].rf_rbpi = TRANSCEIVERB_HSPI_READBACK; -} - -static bool _rtl92d_phy_config_bb_with_headerfile(struct ieee80211_hw *hw, - u8 configtype) -{ - int i; - u32 *phy_regarray_table; - u32 *agctab_array_table = NULL; - u32 *agctab_5garray_table; - u16 phy_reg_arraylen, agctab_arraylen = 0, agctab_5garraylen; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - /* Normal chip,Mac0 use AGC_TAB.txt for 2G and 5G band. */ - if (rtlhal->interfaceindex == 0) { - agctab_arraylen = AGCTAB_ARRAYLENGTH; - agctab_array_table = rtl8192de_agctab_array; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - " ===> phy:MAC0, Rtl819XAGCTAB_Array\n"); - } else { - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - agctab_arraylen = AGCTAB_2G_ARRAYLENGTH; - agctab_array_table = rtl8192de_agctab_2garray; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - " ===> phy:MAC1, Rtl819XAGCTAB_2GArray\n"); - } else { - agctab_5garraylen = AGCTAB_5G_ARRAYLENGTH; - agctab_5garray_table = rtl8192de_agctab_5garray; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - " ===> phy:MAC1, Rtl819XAGCTAB_5GArray\n"); - - } - } - phy_reg_arraylen = PHY_REG_2T_ARRAYLENGTH; - phy_regarray_table = rtl8192de_phy_reg_2tarray; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - " ===> phy:Rtl819XPHY_REG_Array_PG\n"); - if (configtype == BASEBAND_CONFIG_PHY_REG) { - for (i = 0; i < phy_reg_arraylen; i = i + 2) { - if (phy_regarray_table[i] == 0xfe) - mdelay(50); - else if (phy_regarray_table[i] == 0xfd) - mdelay(5); - else if (phy_regarray_table[i] == 0xfc) - mdelay(1); - else if (phy_regarray_table[i] == 0xfb) - udelay(50); - else if (phy_regarray_table[i] == 0xfa) - udelay(5); - else if (phy_regarray_table[i] == 0xf9) - udelay(1); - rtl_set_bbreg(hw, phy_regarray_table[i], BMASKDWORD, - phy_regarray_table[i + 1]); - udelay(1); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "The phy_regarray_table[0] is %x Rtl819XPHY_REGArray[1] is %x\n", - phy_regarray_table[i], - phy_regarray_table[i + 1]); - } - } else if (configtype == BASEBAND_CONFIG_AGC_TAB) { - if (rtlhal->interfaceindex == 0) { - for (i = 0; i < agctab_arraylen; i = i + 2) { - rtl_set_bbreg(hw, agctab_array_table[i], - BMASKDWORD, - agctab_array_table[i + 1]); - /* Add 1us delay between BB/RF register - * setting. */ - udelay(1); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "The Rtl819XAGCTAB_Array_Table[0] is %ul Rtl819XPHY_REGArray[1] is %ul\n", - agctab_array_table[i], - agctab_array_table[i + 1]); - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Normal Chip, MAC0, load Rtl819XAGCTAB_Array\n"); - } else { - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - for (i = 0; i < agctab_arraylen; i = i + 2) { - rtl_set_bbreg(hw, agctab_array_table[i], - BMASKDWORD, - agctab_array_table[i + 1]); - /* Add 1us delay between BB/RF register - * setting. */ - udelay(1); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "The Rtl819XAGCTAB_Array_Table[0] is %ul Rtl819XPHY_REGArray[1] is %ul\n", - agctab_array_table[i], - agctab_array_table[i + 1]); - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Load Rtl819XAGCTAB_2GArray\n"); - } else { - for (i = 0; i < agctab_5garraylen; i = i + 2) { - rtl_set_bbreg(hw, - agctab_5garray_table[i], - BMASKDWORD, - agctab_5garray_table[i + 1]); - /* Add 1us delay between BB/RF registeri - * setting. */ - udelay(1); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "The Rtl819XAGCTAB_5GArray_Table[0] is %ul Rtl819XPHY_REGArray[1] is %ul\n", - agctab_5garray_table[i], - agctab_5garray_table[i + 1]); - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Load Rtl819XAGCTAB_5GArray\n"); - } - } - } - return true; -} - -static void _rtl92d_store_pwrindex_diffrate_offset(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, - u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - int index; - - if (regaddr == RTXAGC_A_RATE18_06) - index = 0; - else if (regaddr == RTXAGC_A_RATE54_24) - index = 1; - else if (regaddr == RTXAGC_A_CCK1_MCS32) - index = 6; - else if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00) - index = 7; - else if (regaddr == RTXAGC_A_MCS03_MCS00) - index = 2; - else if (regaddr == RTXAGC_A_MCS07_MCS04) - index = 3; - else if (regaddr == RTXAGC_A_MCS11_MCS08) - index = 4; - else if (regaddr == RTXAGC_A_MCS15_MCS12) - index = 5; - else if (regaddr == RTXAGC_B_RATE18_06) - index = 8; - else if (regaddr == RTXAGC_B_RATE54_24) - index = 9; - else if (regaddr == RTXAGC_B_CCK1_55_MCS32) - index = 14; - else if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff) - index = 15; - else if (regaddr == RTXAGC_B_MCS03_MCS00) - index = 10; - else if (regaddr == RTXAGC_B_MCS07_MCS04) - index = 11; - else if (regaddr == RTXAGC_B_MCS11_MCS08) - index = 12; - else if (regaddr == RTXAGC_B_MCS15_MCS12) - index = 13; - else - return; - - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][index] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][%d] = 0x%ulx\n", - rtlphy->pwrgroup_cnt, index, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][index]); - if (index == 13) - rtlphy->pwrgroup_cnt++; -} - -static bool _rtl92d_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw, - u8 configtype) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int i; - u32 *phy_regarray_table_pg; - u16 phy_regarray_pg_len; - - phy_regarray_pg_len = PHY_REG_ARRAY_PG_LENGTH; - phy_regarray_table_pg = rtl8192de_phy_reg_array_pg; - if (configtype == BASEBAND_CONFIG_PHY_REG) { - for (i = 0; i < phy_regarray_pg_len; i = i + 3) { - if (phy_regarray_table_pg[i] == 0xfe) - mdelay(50); - else if (phy_regarray_table_pg[i] == 0xfd) - mdelay(5); - else if (phy_regarray_table_pg[i] == 0xfc) - mdelay(1); - else if (phy_regarray_table_pg[i] == 0xfb) - udelay(50); - else if (phy_regarray_table_pg[i] == 0xfa) - udelay(5); - else if (phy_regarray_table_pg[i] == 0xf9) - udelay(1); - _rtl92d_store_pwrindex_diffrate_offset(hw, - phy_regarray_table_pg[i], - phy_regarray_table_pg[i + 1], - phy_regarray_table_pg[i + 2]); - } - } else { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "configtype != BaseBand_Config_PHY_REG\n"); - } - return true; -} - -static bool _rtl92d_phy_bb_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - bool rtstatus = true; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "==>\n"); - rtstatus = _rtl92d_phy_config_bb_with_headerfile(hw, - BASEBAND_CONFIG_PHY_REG); - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!\n"); - return false; - } - - /* if (rtlphy->rf_type == RF_1T2R) { - * _rtl92c_phy_bb_config_1t(hw); - * RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Config to 1T!!\n"); - *} */ - - if (rtlefuse->autoload_failflag == false) { - rtlphy->pwrgroup_cnt = 0; - rtstatus = _rtl92d_phy_config_bb_with_pgheaderfile(hw, - BASEBAND_CONFIG_PHY_REG); - } - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!\n"); - return false; - } - rtstatus = _rtl92d_phy_config_bb_with_headerfile(hw, - BASEBAND_CONFIG_AGC_TAB); - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "AGC Table Fail\n"); - return false; - } - rtlphy->cck_high_power = (bool) (rtl_get_bbreg(hw, - RFPGA0_XA_HSSIPARAMETER2, 0x200)); - - return true; -} - -bool rtl92d_phy_bb_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u16 regval; - u32 regvaldw; - u8 value; - - _rtl92d_phy_init_bb_rf_register_definition(hw); - regval = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN); - rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, - regval | BIT(13) | BIT(0) | BIT(1)); - rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL, 0x83); - rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL + 1, 0xdb); - /* 0x1f bit7 bit6 represent for mac0/mac1 driver ready */ - value = rtl_read_byte(rtlpriv, REG_RF_CTRL); - rtl_write_byte(rtlpriv, REG_RF_CTRL, value | RF_EN | RF_RSTB | - RF_SDMRSTB); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, FEN_PPLL | FEN_PCIEA | - FEN_DIO_PCIE | FEN_BB_GLB_RSTn | FEN_BBRSTB); - rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL + 1, 0x80); - if (!(IS_92D_SINGLEPHY(rtlpriv->rtlhal.version))) { - regvaldw = rtl_read_dword(rtlpriv, REG_LEDCFG0); - rtl_write_dword(rtlpriv, REG_LEDCFG0, regvaldw | BIT(23)); - } - - return _rtl92d_phy_bb_config(hw); -} - -bool rtl92d_phy_rf_config(struct ieee80211_hw *hw) -{ - return rtl92d_phy_rf6052_config(hw); -} - -bool rtl92d_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, - enum rf_content content, - enum radio_path rfpath) -{ - int i; - u32 *radioa_array_table; - u32 *radiob_array_table; - u16 radioa_arraylen, radiob_arraylen; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - radioa_arraylen = RADIOA_2T_ARRAYLENGTH; - radioa_array_table = rtl8192de_radioa_2tarray; - radiob_arraylen = RADIOB_2T_ARRAYLENGTH; - radiob_array_table = rtl8192de_radiob_2tarray; - if (rtlpriv->efuse.internal_pa_5g[0]) { - radioa_arraylen = RADIOA_2T_INT_PA_ARRAYLENGTH; - radioa_array_table = rtl8192de_radioa_2t_int_paarray; - } - if (rtlpriv->efuse.internal_pa_5g[1]) { - radiob_arraylen = RADIOB_2T_INT_PA_ARRAYLENGTH; - radiob_array_table = rtl8192de_radiob_2t_int_paarray; - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "PHY_ConfigRFWithHeaderFile() Radio_A:Rtl819XRadioA_1TArray\n"); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "PHY_ConfigRFWithHeaderFile() Radio_B:Rtl819XRadioB_1TArray\n"); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Radio No %x\n", rfpath); - - /* this only happens when DMDP, mac0 start on 2.4G, - * mac1 start on 5G, mac 0 has to set phy0&phy1 - * pathA or mac1 has to set phy0&phy1 pathA */ - if ((content == radiob_txt) && (rfpath == RF90_PATH_A)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - " ===> althougth Path A, we load radiob.txt\n"); - radioa_arraylen = radiob_arraylen; - radioa_array_table = radiob_array_table; - } - switch (rfpath) { - case RF90_PATH_A: - for (i = 0; i < radioa_arraylen; i = i + 2) { - if (radioa_array_table[i] == 0xfe) { - mdelay(50); - } else if (radioa_array_table[i] == 0xfd) { - /* delay_ms(5); */ - mdelay(5); - } else if (radioa_array_table[i] == 0xfc) { - /* delay_ms(1); */ - mdelay(1); - } else if (radioa_array_table[i] == 0xfb) { - udelay(50); - } else if (radioa_array_table[i] == 0xfa) { - udelay(5); - } else if (radioa_array_table[i] == 0xf9) { - udelay(1); - } else { - rtl_set_rfreg(hw, rfpath, radioa_array_table[i], - BRFREGOFFSETMASK, - radioa_array_table[i + 1]); - /* Add 1us delay between BB/RF register set. */ - udelay(1); - } - } - break; - case RF90_PATH_B: - for (i = 0; i < radiob_arraylen; i = i + 2) { - if (radiob_array_table[i] == 0xfe) { - /* Delay specific ms. Only RF configuration - * requires delay. */ - mdelay(50); - } else if (radiob_array_table[i] == 0xfd) { - /* delay_ms(5); */ - mdelay(5); - } else if (radiob_array_table[i] == 0xfc) { - /* delay_ms(1); */ - mdelay(1); - } else if (radiob_array_table[i] == 0xfb) { - udelay(50); - } else if (radiob_array_table[i] == 0xfa) { - udelay(5); - } else if (radiob_array_table[i] == 0xf9) { - udelay(1); - } else { - rtl_set_rfreg(hw, rfpath, radiob_array_table[i], - BRFREGOFFSETMASK, - radiob_array_table[i + 1]); - /* Add 1us delay between BB/RF register set. */ - udelay(1); - } - } - break; - case RF90_PATH_C: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - case RF90_PATH_D: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - return true; -} - -void rtl92d_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - rtlphy->default_initialgain[0] = - (u8) rtl_get_bbreg(hw, ROFDM0_XAAGCCORE1, BMASKBYTE0); - rtlphy->default_initialgain[1] = - (u8) rtl_get_bbreg(hw, ROFDM0_XBAGCCORE1, BMASKBYTE0); - rtlphy->default_initialgain[2] = - (u8) rtl_get_bbreg(hw, ROFDM0_XCAGCCORE1, BMASKBYTE0); - rtlphy->default_initialgain[3] = - (u8) rtl_get_bbreg(hw, ROFDM0_XDAGCCORE1, BMASKBYTE0); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x\n", - rtlphy->default_initialgain[0], - rtlphy->default_initialgain[1], - rtlphy->default_initialgain[2], - rtlphy->default_initialgain[3]); - rtlphy->framesync = (u8)rtl_get_bbreg(hw, ROFDM0_RXDETECTOR3, - BMASKBYTE0); - rtlphy->framesync_c34 = rtl_get_bbreg(hw, ROFDM0_RXDETECTOR2, - BMASKDWORD); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Default framesync (0x%x) = 0x%x\n", - ROFDM0_RXDETECTOR3, rtlphy->framesync); -} - -static void _rtl92d_get_txpower_index(struct ieee80211_hw *hw, u8 channel, - u8 *cckpowerlevel, u8 *ofdmpowerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 index = (channel - 1); - - /* 1. CCK */ - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - /* RF-A */ - cckpowerlevel[RF90_PATH_A] = - rtlefuse->txpwrlevel_cck[RF90_PATH_A][index]; - /* RF-B */ - cckpowerlevel[RF90_PATH_B] = - rtlefuse->txpwrlevel_cck[RF90_PATH_B][index]; - } else { - cckpowerlevel[RF90_PATH_A] = 0; - cckpowerlevel[RF90_PATH_B] = 0; - } - /* 2. OFDM for 1S or 2S */ - if (rtlphy->rf_type == RF_1T2R || rtlphy->rf_type == RF_1T1R) { - /* Read HT 40 OFDM TX power */ - ofdmpowerlevel[RF90_PATH_A] = - rtlefuse->txpwrlevel_ht40_1s[RF90_PATH_A][index]; - ofdmpowerlevel[RF90_PATH_B] = - rtlefuse->txpwrlevel_ht40_1s[RF90_PATH_B][index]; - } else if (rtlphy->rf_type == RF_2T2R) { - /* Read HT 40 OFDM TX power */ - ofdmpowerlevel[RF90_PATH_A] = - rtlefuse->txpwrlevel_ht40_2s[RF90_PATH_A][index]; - ofdmpowerlevel[RF90_PATH_B] = - rtlefuse->txpwrlevel_ht40_2s[RF90_PATH_B][index]; - } -} - -static void _rtl92d_ccxpower_index_check(struct ieee80211_hw *hw, - u8 channel, u8 *cckpowerlevel, u8 *ofdmpowerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - rtlphy->cur_cck_txpwridx = cckpowerlevel[0]; - rtlphy->cur_ofdm24g_txpwridx = ofdmpowerlevel[0]; -} - -static u8 _rtl92c_phy_get_rightchnlplace(u8 chnl) -{ - u8 channel_5g[59] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, - 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, - 114, 116, 118, 120, 122, 124, 126, 128, - 130, 132, 134, 136, 138, 140, 149, 151, - 153, 155, 157, 159, 161, 163, 165 - }; - u8 place = chnl; - - if (chnl > 14) { - for (place = 14; place < sizeof(channel_5g); place++) { - if (channel_5g[place] == chnl) { - place++; - break; - } - } - } - return place; -} - -void rtl92d_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 cckpowerlevel[2], ofdmpowerlevel[2]; - - if (!rtlefuse->txpwr_fromeprom) - return; - channel = _rtl92c_phy_get_rightchnlplace(channel); - _rtl92d_get_txpower_index(hw, channel, &cckpowerlevel[0], - &ofdmpowerlevel[0]); - if (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G) - _rtl92d_ccxpower_index_check(hw, channel, &cckpowerlevel[0], - &ofdmpowerlevel[0]); - if (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G) - rtl92d_phy_rf6052_set_cck_txpower(hw, &cckpowerlevel[0]); - rtl92d_phy_rf6052_set_ofdm_txpower(hw, &ofdmpowerlevel[0], channel); -} - -void rtl92d_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - enum io_type iotype; - - if (!is_hal_stop(rtlhal)) { - switch (operation) { - case SCAN_OPT_BACKUP: - rtlhal->current_bandtypebackup = - rtlhal->current_bandtype; - iotype = IO_CMD_PAUSE_DM_BY_SCAN; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_IO_CMD, - (u8 *)&iotype); - break; - case SCAN_OPT_RESTORE: - iotype = IO_CMD_RESUME_DM_BY_SCAN; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_IO_CMD, - (u8 *)&iotype); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Unknown Scan Backup operation\n"); - break; - } - } -} - -void rtl92d_phy_set_bw_mode(struct ieee80211_hw *hw, - enum nl80211_channel_type ch_type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - unsigned long flag = 0; - u8 reg_prsr_rsc; - u8 reg_bw_opmode; - - if (rtlphy->set_bwmode_inprogress) - return; - if ((is_hal_stop(rtlhal)) || (RT_CANNOT_IO(hw))) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "FALSE driver sleep or unload\n"); - return; - } - rtlphy->set_bwmode_inprogress = true; - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "Switch to %s bandwidth\n", - rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? - "20MHz" : "40MHz"); - reg_bw_opmode = rtl_read_byte(rtlpriv, REG_BWOPMODE); - reg_prsr_rsc = rtl_read_byte(rtlpriv, REG_RRSR + 2); - switch (rtlphy->current_chan_bw) { - case HT_CHANNEL_WIDTH_20: - reg_bw_opmode |= BW_OPMODE_20MHZ; - rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); - break; - case HT_CHANNEL_WIDTH_20_40: - reg_bw_opmode &= ~BW_OPMODE_20MHZ; - rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); - - reg_prsr_rsc = (reg_prsr_rsc & 0x90) | - (mac->cur_40_prime_sc << 5); - rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_prsr_rsc); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", rtlphy->current_chan_bw); - break; - } - switch (rtlphy->current_chan_bw) { - case HT_CHANNEL_WIDTH_20: - rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x0); - rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x0); - /* SET BIT10 BIT11 for receive cck */ - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10) | - BIT(11), 3); - break; - case HT_CHANNEL_WIDTH_20_40: - rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x1); - rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x1); - /* Set Control channel to upper or lower. - * These settings are required only for 40MHz */ - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag); - rtl_set_bbreg(hw, RCCK0_SYSTEM, BCCKSIDEBAND, - (mac->cur_40_prime_sc >> 1)); - rtl92d_release_cckandrw_pagea_ctl(hw, &flag); - } - rtl_set_bbreg(hw, ROFDM1_LSTF, 0xC00, mac->cur_40_prime_sc); - /* SET BIT10 BIT11 for receive cck */ - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10) | - BIT(11), 0); - rtl_set_bbreg(hw, 0x818, (BIT(26) | BIT(27)), - (mac->cur_40_prime_sc == - HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", rtlphy->current_chan_bw); - break; - - } - rtl92d_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); - rtlphy->set_bwmode_inprogress = false; - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n"); -} - -static void _rtl92d_phy_stop_trx_before_changeband(struct ieee80211_hw *hw) -{ - rtl_set_bbreg(hw, RFPGA0_RFMOD, BCCKEN, 0); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BOFDMEN, 0); - rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, BMASKBYTE0, 0x00); - rtl_set_bbreg(hw, ROFDM1_TRXPATHENABLE, BDWORD, 0x0); -} - -static void rtl92d_phy_switch_wirelessband(struct ieee80211_hw *hw, u8 band) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 value8; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "==>\n"); - rtlhal->bandset = band; - rtlhal->current_bandtype = band; - if (IS_92D_SINGLEPHY(rtlhal->version)) - rtlhal->bandset = BAND_ON_BOTH; - /* stop RX/Tx */ - _rtl92d_phy_stop_trx_before_changeband(hw); - /* reconfig BB/RF according to wireless mode */ - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - /* BB & RF Config */ - RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "====>2.4G\n"); - if (rtlhal->interfaceindex == 1) - _rtl92d_phy_config_bb_with_headerfile(hw, - BASEBAND_CONFIG_AGC_TAB); - } else { - /* 5G band */ - RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "====>5G\n"); - if (rtlhal->interfaceindex == 1) - _rtl92d_phy_config_bb_with_headerfile(hw, - BASEBAND_CONFIG_AGC_TAB); - } - rtl92d_update_bbrf_configuration(hw); - if (rtlhal->current_bandtype == BAND_ON_2_4G) - rtl_set_bbreg(hw, RFPGA0_RFMOD, BCCKEN, 0x1); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BOFDMEN, 0x1); - - /* 20M BW. */ - /* rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 1); */ - rtlhal->reloadtxpowerindex = true; - /* notice fw know band status 0x81[1]/0x53[1] = 0: 5G, 1: 2G */ - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - value8 = rtl_read_byte(rtlpriv, (rtlhal->interfaceindex == - 0 ? REG_MAC0 : REG_MAC1)); - value8 |= BIT(1); - rtl_write_byte(rtlpriv, (rtlhal->interfaceindex == - 0 ? REG_MAC0 : REG_MAC1), value8); - } else { - value8 = rtl_read_byte(rtlpriv, (rtlhal->interfaceindex == - 0 ? REG_MAC0 : REG_MAC1)); - value8 &= (~BIT(1)); - rtl_write_byte(rtlpriv, (rtlhal->interfaceindex == - 0 ? REG_MAC0 : REG_MAC1), value8); - } - mdelay(1); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "<==Switch Band OK\n"); -} - -static void _rtl92d_phy_reload_imr_setting(struct ieee80211_hw *hw, - u8 channel, u8 rfpath) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 imr_num = MAX_RF_IMR_INDEX; - u32 rfmask = BRFREGOFFSETMASK; - u8 group, i; - unsigned long flag = 0; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "====>path %d\n", rfpath); - if (rtlpriv->rtlhal.current_bandtype == BAND_ON_5G) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "====>5G\n"); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BIT(25) | BIT(24), 0); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, 0x00f00000, 0xf); - /* fc area 0xd2c */ - if (channel > 99) - rtl_set_bbreg(hw, ROFDM1_CFOTRACKING, BIT(13) | - BIT(14), 2); - else - rtl_set_bbreg(hw, ROFDM1_CFOTRACKING, BIT(13) | - BIT(14), 1); - /* leave 0 for channel1-14. */ - group = channel <= 64 ? 1 : 2; - imr_num = MAX_RF_IMR_INDEX_NORMAL; - for (i = 0; i < imr_num; i++) - rtl_set_rfreg(hw, (enum radio_path)rfpath, - rf_reg_for_5g_swchnl_normal[i], rfmask, - rf_imr_param_normal[0][group][i]); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, 0x00f00000, 0); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BOFDMEN, 1); - } else { - /* G band. */ - RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, - "Load RF IMR parameters for G band. IMR already setting %d\n", - rtlpriv->rtlhal.load_imrandiqk_setting_for2g); - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "====>2.4G\n"); - if (!rtlpriv->rtlhal.load_imrandiqk_setting_for2g) { - RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, - "Load RF IMR parameters for G band. %d\n", - rfpath); - rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BIT(25) | BIT(24), 0); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, - 0x00f00000, 0xf); - imr_num = MAX_RF_IMR_INDEX_NORMAL; - for (i = 0; i < imr_num; i++) { - rtl_set_rfreg(hw, (enum radio_path)rfpath, - rf_reg_for_5g_swchnl_normal[i], - BRFREGOFFSETMASK, - rf_imr_param_normal[0][0][i]); - } - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, - 0x00f00000, 0); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BOFDMEN | BCCKEN, 3); - rtl92d_release_cckandrw_pagea_ctl(hw, &flag); - } - } - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "<====\n"); -} - -static void _rtl92d_phy_enable_rf_env(struct ieee80211_hw *hw, - u8 rfpath, u32 *pu4_regval) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; - - RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "====>\n"); - /*----Store original RFENV control type----*/ - switch (rfpath) { - case RF90_PATH_A: - case RF90_PATH_C: - *pu4_regval = rtl_get_bbreg(hw, pphyreg->rfintfs, BRFSI_RFENV); - break; - case RF90_PATH_B: - case RF90_PATH_D: - *pu4_regval = - rtl_get_bbreg(hw, pphyreg->rfintfs, BRFSI_RFENV << 16); - break; - } - /*----Set RF_ENV enable----*/ - rtl_set_bbreg(hw, pphyreg->rfintfe, BRFSI_RFENV << 16, 0x1); - udelay(1); - /*----Set RF_ENV output high----*/ - rtl_set_bbreg(hw, pphyreg->rfintfo, BRFSI_RFENV, 0x1); - udelay(1); - /* Set bit number of Address and Data for RF register */ - /* Set 1 to 4 bits for 8255 */ - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, B3WIREADDRESSLENGTH, 0x0); - udelay(1); - /*Set 0 to 12 bits for 8255 */ - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, B3WIREDATALENGTH, 0x0); - udelay(1); - RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "<====\n"); -} - -static void _rtl92d_phy_restore_rf_env(struct ieee80211_hw *hw, u8 rfpath, - u32 *pu4_regval) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; - - RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "=====>\n"); - /*----Restore RFENV control type----*/ - switch (rfpath) { - case RF90_PATH_A: - case RF90_PATH_C: - rtl_set_bbreg(hw, pphyreg->rfintfs, BRFSI_RFENV, *pu4_regval); - break; - case RF90_PATH_B: - case RF90_PATH_D: - rtl_set_bbreg(hw, pphyreg->rfintfs, BRFSI_RFENV << 16, - *pu4_regval); - break; - } - RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "<=====\n"); -} - -static void _rtl92d_phy_switch_rf_setting(struct ieee80211_hw *hw, u8 channel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); - u8 path = rtlhal->current_bandtype == - BAND_ON_5G ? RF90_PATH_A : RF90_PATH_B; - u8 index = 0, i = 0, rfpath = RF90_PATH_A; - bool need_pwr_down = false, internal_pa = false; - u32 u4regvalue, mask = 0x1C000, value = 0, u4tmp, u4tmp2; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "====>\n"); - /* config path A for 5G */ - if (rtlhal->current_bandtype == BAND_ON_5G) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "====>5G\n"); - u4tmp = curveindex_5g[channel - 1]; - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "ver 1 set RF-A, 5G, 0x28 = 0x%x !!\n", u4tmp); - for (i = 0; i < RF_CHNL_NUM_5G; i++) { - if (channel == rf_chnl_5g[i] && channel <= 140) - index = 0; - } - for (i = 0; i < RF_CHNL_NUM_5G_40M; i++) { - if (channel == rf_chnl_5g_40m[i] && channel <= 140) - index = 1; - } - if (channel == 149 || channel == 155 || channel == 161) - index = 2; - else if (channel == 151 || channel == 153 || channel == 163 - || channel == 165) - index = 3; - else if (channel == 157 || channel == 159) - index = 4; - - if (rtlhal->macphymode == DUALMAC_DUALPHY - && rtlhal->interfaceindex == 1) { - need_pwr_down = rtl92d_phy_enable_anotherphy(hw, false); - rtlhal->during_mac1init_radioa = true; - /* asume no this case */ - if (need_pwr_down) - _rtl92d_phy_enable_rf_env(hw, path, - &u4regvalue); - } - for (i = 0; i < RF_REG_NUM_FOR_C_CUT_5G; i++) { - if (i == 0 && (rtlhal->macphymode == DUALMAC_DUALPHY)) { - rtl_set_rfreg(hw, (enum radio_path)path, - rf_reg_for_c_cut_5g[i], - BRFREGOFFSETMASK, 0xE439D); - } else if (rf_reg_for_c_cut_5g[i] == RF_SYN_G4) { - u4tmp2 = (rf_reg_pram_c_5g[index][i] & - 0x7FF) | (u4tmp << 11); - if (channel == 36) - u4tmp2 &= ~(BIT(7) | BIT(6)); - rtl_set_rfreg(hw, (enum radio_path)path, - rf_reg_for_c_cut_5g[i], - BRFREGOFFSETMASK, u4tmp2); - } else { - rtl_set_rfreg(hw, (enum radio_path)path, - rf_reg_for_c_cut_5g[i], - BRFREGOFFSETMASK, - rf_reg_pram_c_5g[index][i]); - } - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "offset 0x%x value 0x%x path %d index %d readback 0x%x\n", - rf_reg_for_c_cut_5g[i], - rf_reg_pram_c_5g[index][i], - path, index, - rtl_get_rfreg(hw, (enum radio_path)path, - rf_reg_for_c_cut_5g[i], - BRFREGOFFSETMASK)); - } - if (need_pwr_down) - _rtl92d_phy_restore_rf_env(hw, path, &u4regvalue); - if (rtlhal->during_mac1init_radioa) - rtl92d_phy_powerdown_anotherphy(hw, false); - if (channel < 149) - value = 0x07; - else if (channel >= 149) - value = 0x02; - if (channel >= 36 && channel <= 64) - index = 0; - else if (channel >= 100 && channel <= 140) - index = 1; - else - index = 2; - for (rfpath = RF90_PATH_A; rfpath < rtlphy->num_total_rfpath; - rfpath++) { - if (rtlhal->macphymode == DUALMAC_DUALPHY && - rtlhal->interfaceindex == 1) /* MAC 1 5G */ - internal_pa = rtlpriv->efuse.internal_pa_5g[1]; - else - internal_pa = - rtlpriv->efuse.internal_pa_5g[rfpath]; - if (internal_pa) { - for (i = 0; - i < RF_REG_NUM_FOR_C_CUT_5G_INTERNALPA; - i++) { - rtl_set_rfreg(hw, rfpath, - rf_for_c_cut_5g_internal_pa[i], - BRFREGOFFSETMASK, - rf_pram_c_5g_int_pa[index][i]); - RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, - "offset 0x%x value 0x%x path %d index %d\n", - rf_for_c_cut_5g_internal_pa[i], - rf_pram_c_5g_int_pa[index][i], - rfpath, index); - } - } else { - rtl_set_rfreg(hw, (enum radio_path)rfpath, 0x0B, - mask, value); - } - } - } else if (rtlhal->current_bandtype == BAND_ON_2_4G) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "====>2.4G\n"); - u4tmp = curveindex_2g[channel - 1]; - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "ver 3 set RF-B, 2G, 0x28 = 0x%x !!\n", u4tmp); - if (channel == 1 || channel == 2 || channel == 4 || channel == 9 - || channel == 10 || channel == 11 || channel == 12) - index = 0; - else if (channel == 3 || channel == 13 || channel == 14) - index = 1; - else if (channel >= 5 && channel <= 8) - index = 2; - if (rtlhal->macphymode == DUALMAC_DUALPHY) { - path = RF90_PATH_A; - if (rtlhal->interfaceindex == 0) { - need_pwr_down = - rtl92d_phy_enable_anotherphy(hw, true); - rtlhal->during_mac0init_radiob = true; - - if (need_pwr_down) - _rtl92d_phy_enable_rf_env(hw, path, - &u4regvalue); - } - } - for (i = 0; i < RF_REG_NUM_FOR_C_CUT_2G; i++) { - if (rf_reg_for_c_cut_2g[i] == RF_SYN_G7) - rtl_set_rfreg(hw, (enum radio_path)path, - rf_reg_for_c_cut_2g[i], - BRFREGOFFSETMASK, - (rf_reg_param_for_c_cut_2g[index][i] | - BIT(17))); - else - rtl_set_rfreg(hw, (enum radio_path)path, - rf_reg_for_c_cut_2g[i], - BRFREGOFFSETMASK, - rf_reg_param_for_c_cut_2g - [index][i]); - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "offset 0x%x value 0x%x mak 0x%x path %d index %d readback 0x%x\n", - rf_reg_for_c_cut_2g[i], - rf_reg_param_for_c_cut_2g[index][i], - rf_reg_mask_for_c_cut_2g[i], path, index, - rtl_get_rfreg(hw, (enum radio_path)path, - rf_reg_for_c_cut_2g[i], - BRFREGOFFSETMASK)); - } - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "cosa ver 3 set RF-B, 2G, 0x28 = 0x%x !!\n", - rf_syn_g4_for_c_cut_2g | (u4tmp << 11)); - - rtl_set_rfreg(hw, (enum radio_path)path, RF_SYN_G4, - BRFREGOFFSETMASK, - rf_syn_g4_for_c_cut_2g | (u4tmp << 11)); - if (need_pwr_down) - _rtl92d_phy_restore_rf_env(hw, path, &u4regvalue); - if (rtlhal->during_mac0init_radiob) - rtl92d_phy_powerdown_anotherphy(hw, true); - } - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "<====\n"); -} - -u8 rtl92d_get_rightchnlplace_for_iqk(u8 chnl) -{ - u8 channel_all[59] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, - 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, - 114, 116, 118, 120, 122, 124, 126, 128, 130, - 132, 134, 136, 138, 140, 149, 151, 153, 155, - 157, 159, 161, 163, 165 - }; - u8 place = chnl; - - if (chnl > 14) { - for (place = 14; place < sizeof(channel_all); place++) { - if (channel_all[place] == chnl) - return place - 13; - } - } - - return 0; -} - -#define MAX_TOLERANCE 5 -#define IQK_DELAY_TIME 1 /* ms */ -#define MAX_TOLERANCE_92D 3 - -/* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */ -static u8 _rtl92d_phy_patha_iqk(struct ieee80211_hw *hw, bool configpathb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u32 regeac, rege94, rege9c, regea4; - u8 result = 0; - - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path A IQK!\n"); - /* path-A IQK setting */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path-A IQK setting!\n"); - if (rtlhal->interfaceindex == 0) { - rtl_set_bbreg(hw, 0xe30, BMASKDWORD, 0x10008c1f); - rtl_set_bbreg(hw, 0xe34, BMASKDWORD, 0x10008c1f); - } else { - rtl_set_bbreg(hw, 0xe30, BMASKDWORD, 0x10008c22); - rtl_set_bbreg(hw, 0xe34, BMASKDWORD, 0x10008c22); - } - rtl_set_bbreg(hw, 0xe38, BMASKDWORD, 0x82140102); - rtl_set_bbreg(hw, 0xe3c, BMASKDWORD, 0x28160206); - /* path-B IQK setting */ - if (configpathb) { - rtl_set_bbreg(hw, 0xe50, BMASKDWORD, 0x10008c22); - rtl_set_bbreg(hw, 0xe54, BMASKDWORD, 0x10008c22); - rtl_set_bbreg(hw, 0xe58, BMASKDWORD, 0x82140102); - rtl_set_bbreg(hw, 0xe5c, BMASKDWORD, 0x28160206); - } - /* LO calibration setting */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, "LO calibration setting!\n"); - rtl_set_bbreg(hw, 0xe4c, BMASKDWORD, 0x00462911); - /* One shot, path A LOK & IQK */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, "One shot, path A LOK & IQK!\n"); - rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf9000000); - rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf8000000); - /* delay x ms */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Delay %d ms for One shot, path A LOK & IQK\n", - IQK_DELAY_TIME); - mdelay(IQK_DELAY_TIME); - /* Check failed */ - regeac = rtl_get_bbreg(hw, 0xeac, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xeac = 0x%x\n", regeac); - rege94 = rtl_get_bbreg(hw, 0xe94, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xe94 = 0x%x\n", rege94); - rege9c = rtl_get_bbreg(hw, 0xe9c, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xe9c = 0x%x\n", rege9c); - regea4 = rtl_get_bbreg(hw, 0xea4, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xea4 = 0x%x\n", regea4); - if (!(regeac & BIT(28)) && (((rege94 & 0x03FF0000) >> 16) != 0x142) && - (((rege9c & 0x03FF0000) >> 16) != 0x42)) - result |= 0x01; - else /* if Tx not OK, ignore Rx */ - return result; - /* if Tx is OK, check whether Rx is OK */ - if (!(regeac & BIT(27)) && (((regea4 & 0x03FF0000) >> 16) != 0x132) && - (((regeac & 0x03FF0000) >> 16) != 0x36)) - result |= 0x02; - else - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path A Rx IQK fail!!\n"); - return result; -} - -/* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */ -static u8 _rtl92d_phy_patha_iqk_5g_normal(struct ieee80211_hw *hw, - bool configpathb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 regeac, rege94, rege9c, regea4; - u8 result = 0; - u8 i; - u8 retrycount = 2; - u32 TxOKBit = BIT(28), RxOKBit = BIT(27); - - if (rtlhal->interfaceindex == 1) { /* PHY1 */ - TxOKBit = BIT(31); - RxOKBit = BIT(30); - } - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path A IQK!\n"); - /* path-A IQK setting */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path-A IQK setting!\n"); - rtl_set_bbreg(hw, 0xe30, BMASKDWORD, 0x18008c1f); - rtl_set_bbreg(hw, 0xe34, BMASKDWORD, 0x18008c1f); - rtl_set_bbreg(hw, 0xe38, BMASKDWORD, 0x82140307); - rtl_set_bbreg(hw, 0xe3c, BMASKDWORD, 0x68160960); - /* path-B IQK setting */ - if (configpathb) { - rtl_set_bbreg(hw, 0xe50, BMASKDWORD, 0x18008c2f); - rtl_set_bbreg(hw, 0xe54, BMASKDWORD, 0x18008c2f); - rtl_set_bbreg(hw, 0xe58, BMASKDWORD, 0x82110000); - rtl_set_bbreg(hw, 0xe5c, BMASKDWORD, 0x68110000); - } - /* LO calibration setting */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, "LO calibration setting!\n"); - rtl_set_bbreg(hw, 0xe4c, BMASKDWORD, 0x00462911); - /* path-A PA on */ - rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW, BMASKDWORD, 0x07000f60); - rtl_set_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, BMASKDWORD, 0x66e60e30); - for (i = 0; i < retrycount; i++) { - /* One shot, path A LOK & IQK */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "One shot, path A LOK & IQK!\n"); - rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf9000000); - rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf8000000); - /* delay x ms */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Delay %d ms for One shot, path A LOK & IQK.\n", - IQK_DELAY_TIME); - mdelay(IQK_DELAY_TIME * 10); - /* Check failed */ - regeac = rtl_get_bbreg(hw, 0xeac, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xeac = 0x%x\n", regeac); - rege94 = rtl_get_bbreg(hw, 0xe94, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xe94 = 0x%x\n", rege94); - rege9c = rtl_get_bbreg(hw, 0xe9c, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xe9c = 0x%x\n", rege9c); - regea4 = rtl_get_bbreg(hw, 0xea4, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xea4 = 0x%x\n", regea4); - if (!(regeac & TxOKBit) && - (((rege94 & 0x03FF0000) >> 16) != 0x142)) { - result |= 0x01; - } else { /* if Tx not OK, ignore Rx */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Path A Tx IQK fail!!\n"); - continue; - } - - /* if Tx is OK, check whether Rx is OK */ - if (!(regeac & RxOKBit) && - (((regea4 & 0x03FF0000) >> 16) != 0x132)) { - result |= 0x02; - break; - } else { - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Path A Rx IQK fail!!\n"); - } - } - /* path A PA off */ - rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW, BMASKDWORD, - rtlphy->iqk_bb_backup[0]); - rtl_set_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, BMASKDWORD, - rtlphy->iqk_bb_backup[1]); - return result; -} - -/* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */ -static u8 _rtl92d_phy_pathb_iqk(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 regeac, regeb4, regebc, regec4, regecc; - u8 result = 0; - - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path B IQK!\n"); - /* One shot, path B LOK & IQK */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, "One shot, path A LOK & IQK!\n"); - rtl_set_bbreg(hw, 0xe60, BMASKDWORD, 0x00000002); - rtl_set_bbreg(hw, 0xe60, BMASKDWORD, 0x00000000); - /* delay x ms */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Delay %d ms for One shot, path B LOK & IQK\n", IQK_DELAY_TIME); - mdelay(IQK_DELAY_TIME); - /* Check failed */ - regeac = rtl_get_bbreg(hw, 0xeac, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xeac = 0x%x\n", regeac); - regeb4 = rtl_get_bbreg(hw, 0xeb4, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xeb4 = 0x%x\n", regeb4); - regebc = rtl_get_bbreg(hw, 0xebc, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xebc = 0x%x\n", regebc); - regec4 = rtl_get_bbreg(hw, 0xec4, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xec4 = 0x%x\n", regec4); - regecc = rtl_get_bbreg(hw, 0xecc, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xecc = 0x%x\n", regecc); - if (!(regeac & BIT(31)) && (((regeb4 & 0x03FF0000) >> 16) != 0x142) && - (((regebc & 0x03FF0000) >> 16) != 0x42)) - result |= 0x01; - else - return result; - if (!(regeac & BIT(30)) && (((regec4 & 0x03FF0000) >> 16) != 0x132) && - (((regecc & 0x03FF0000) >> 16) != 0x36)) - result |= 0x02; - else - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path B Rx IQK fail!!\n"); - return result; -} - -/* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */ -static u8 _rtl92d_phy_pathb_iqk_5g_normal(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 regeac, regeb4, regebc, regec4, regecc; - u8 result = 0; - u8 i; - u8 retrycount = 2; - - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path B IQK!\n"); - /* path-A IQK setting */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path-A IQK setting!\n"); - rtl_set_bbreg(hw, 0xe30, BMASKDWORD, 0x18008c1f); - rtl_set_bbreg(hw, 0xe34, BMASKDWORD, 0x18008c1f); - rtl_set_bbreg(hw, 0xe38, BMASKDWORD, 0x82110000); - rtl_set_bbreg(hw, 0xe3c, BMASKDWORD, 0x68110000); - - /* path-B IQK setting */ - rtl_set_bbreg(hw, 0xe50, BMASKDWORD, 0x18008c2f); - rtl_set_bbreg(hw, 0xe54, BMASKDWORD, 0x18008c2f); - rtl_set_bbreg(hw, 0xe58, BMASKDWORD, 0x82140307); - rtl_set_bbreg(hw, 0xe5c, BMASKDWORD, 0x68160960); - - /* LO calibration setting */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, "LO calibration setting!\n"); - rtl_set_bbreg(hw, 0xe4c, BMASKDWORD, 0x00462911); - - /* path-B PA on */ - rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW, BMASKDWORD, 0x0f600700); - rtl_set_bbreg(hw, RFPGA0_XB_RFINTERFACEOE, BMASKDWORD, 0x061f0d30); - - for (i = 0; i < retrycount; i++) { - /* One shot, path B LOK & IQK */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "One shot, path A LOK & IQK!\n"); - rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xfa000000); - rtl_set_bbreg(hw, 0xe48, BMASKDWORD, 0xf8000000); - - /* delay x ms */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Delay %d ms for One shot, path B LOK & IQK.\n", 10); - mdelay(IQK_DELAY_TIME * 10); - - /* Check failed */ - regeac = rtl_get_bbreg(hw, 0xeac, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xeac = 0x%x\n", regeac); - regeb4 = rtl_get_bbreg(hw, 0xeb4, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xeb4 = 0x%x\n", regeb4); - regebc = rtl_get_bbreg(hw, 0xebc, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xebc = 0x%x\n", regebc); - regec4 = rtl_get_bbreg(hw, 0xec4, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xec4 = 0x%x\n", regec4); - regecc = rtl_get_bbreg(hw, 0xecc, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xecc = 0x%x\n", regecc); - if (!(regeac & BIT(31)) && - (((regeb4 & 0x03FF0000) >> 16) != 0x142)) - result |= 0x01; - else - continue; - if (!(regeac & BIT(30)) && - (((regec4 & 0x03FF0000) >> 16) != 0x132)) { - result |= 0x02; - break; - } else { - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Path B Rx IQK fail!!\n"); - } - } - - /* path B PA off */ - rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW, BMASKDWORD, - rtlphy->iqk_bb_backup[0]); - rtl_set_bbreg(hw, RFPGA0_XB_RFINTERFACEOE, BMASKDWORD, - rtlphy->iqk_bb_backup[2]); - return result; -} - -static void _rtl92d_phy_save_adda_registers(struct ieee80211_hw *hw, - u32 *adda_reg, u32 *adda_backup, - u32 regnum) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Save ADDA parameters.\n"); - for (i = 0; i < regnum; i++) - adda_backup[i] = rtl_get_bbreg(hw, adda_reg[i], BMASKDWORD); -} - -static void _rtl92d_phy_save_mac_registers(struct ieee80211_hw *hw, - u32 *macreg, u32 *macbackup) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Save MAC parameters.\n"); - for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++) - macbackup[i] = rtl_read_byte(rtlpriv, macreg[i]); - macbackup[i] = rtl_read_dword(rtlpriv, macreg[i]); -} - -static void _rtl92d_phy_reload_adda_registers(struct ieee80211_hw *hw, - u32 *adda_reg, u32 *adda_backup, - u32 regnum) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Reload ADDA power saving parameters !\n"); - for (i = 0; i < regnum; i++) - rtl_set_bbreg(hw, adda_reg[i], BMASKDWORD, adda_backup[i]); -} - -static void _rtl92d_phy_reload_mac_registers(struct ieee80211_hw *hw, - u32 *macreg, u32 *macbackup) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Reload MAC parameters !\n"); - for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++) - rtl_write_byte(rtlpriv, macreg[i], (u8) macbackup[i]); - rtl_write_byte(rtlpriv, macreg[i], macbackup[i]); -} - -static void _rtl92d_phy_path_adda_on(struct ieee80211_hw *hw, - u32 *adda_reg, bool patha_on, bool is2t) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 pathon; - u32 i; - - RTPRINT(rtlpriv, FINIT, INIT_IQK, "ADDA ON.\n"); - pathon = patha_on ? 0x04db25a4 : 0x0b1b25a4; - if (patha_on) - pathon = rtlpriv->rtlhal.interfaceindex == 0 ? - 0x04db25a4 : 0x0b1b25a4; - for (i = 0; i < IQK_ADDA_REG_NUM; i++) - rtl_set_bbreg(hw, adda_reg[i], BMASKDWORD, pathon); -} - -static void _rtl92d_phy_mac_setting_calibration(struct ieee80211_hw *hw, - u32 *macreg, u32 *macbackup) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - - RTPRINT(rtlpriv, FINIT, INIT_IQK, "MAC settings for Calibration.\n"); - rtl_write_byte(rtlpriv, macreg[0], 0x3F); - - for (i = 1; i < (IQK_MAC_REG_NUM - 1); i++) - rtl_write_byte(rtlpriv, macreg[i], (u8)(macbackup[i] & - (~BIT(3)))); - rtl_write_byte(rtlpriv, macreg[i], (u8) (macbackup[i] & (~BIT(5)))); -} - -static void _rtl92d_phy_patha_standby(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path-A standby mode!\n"); - - rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0x0); - rtl_set_bbreg(hw, RFPGA0_XA_LSSIPARAMETER, BMASKDWORD, 0x00010000); - rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0x80800000); -} - -static void _rtl92d_phy_pimode_switch(struct ieee80211_hw *hw, bool pi_mode) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 mode; - - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "BB Switch to %s mode!\n", pi_mode ? "PI" : "SI"); - mode = pi_mode ? 0x01000100 : 0x01000000; - rtl_set_bbreg(hw, 0x820, BMASKDWORD, mode); - rtl_set_bbreg(hw, 0x828, BMASKDWORD, mode); -} - -static void _rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw, long result[][8], - u8 t, bool is2t) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 i; - u8 patha_ok, pathb_ok; - static u32 adda_reg[IQK_ADDA_REG_NUM] = { - RFPGA0_XCD_SWITCHCONTROL, 0xe6c, 0xe70, 0xe74, - 0xe78, 0xe7c, 0xe80, 0xe84, - 0xe88, 0xe8c, 0xed0, 0xed4, - 0xed8, 0xedc, 0xee0, 0xeec - }; - static u32 iqk_mac_reg[IQK_MAC_REG_NUM] = { - 0x522, 0x550, 0x551, 0x040 - }; - static u32 iqk_bb_reg[IQK_BB_REG_NUM] = { - RFPGA0_XAB_RFINTERFACESW, RFPGA0_XA_RFINTERFACEOE, - RFPGA0_XB_RFINTERFACEOE, ROFDM0_TRMUXPAR, - RFPGA0_XCD_RFINTERFACESW, ROFDM0_TRXPATHENABLE, - RFPGA0_RFMOD, RFPGA0_ANALOGPARAMETER4, - ROFDM0_XAAGCCORE1, ROFDM0_XBAGCCORE1 - }; - const u32 retrycount = 2; - u32 bbvalue; - - RTPRINT(rtlpriv, FINIT, INIT_IQK, "IQK for 2.4G :Start!!!\n"); - if (t == 0) { - bbvalue = rtl_get_bbreg(hw, RFPGA0_RFMOD, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "==>0x%08x\n", bbvalue); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "IQ Calibration for %s\n", - is2t ? "2T2R" : "1T1R"); - - /* Save ADDA parameters, turn Path A ADDA on */ - _rtl92d_phy_save_adda_registers(hw, adda_reg, - rtlphy->adda_backup, IQK_ADDA_REG_NUM); - _rtl92d_phy_save_mac_registers(hw, iqk_mac_reg, - rtlphy->iqk_mac_backup); - _rtl92d_phy_save_adda_registers(hw, iqk_bb_reg, - rtlphy->iqk_bb_backup, IQK_BB_REG_NUM); - } - _rtl92d_phy_path_adda_on(hw, adda_reg, true, is2t); - if (t == 0) - rtlphy->rfpi_enable = (u8) rtl_get_bbreg(hw, - RFPGA0_XA_HSSIPARAMETER1, BIT(8)); - - /* Switch BB to PI mode to do IQ Calibration. */ - if (!rtlphy->rfpi_enable) - _rtl92d_phy_pimode_switch(hw, true); - - rtl_set_bbreg(hw, RFPGA0_RFMOD, BIT(24), 0x00); - rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, BMASKDWORD, 0x03a05600); - rtl_set_bbreg(hw, ROFDM0_TRMUXPAR, BMASKDWORD, 0x000800e4); - rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, BMASKDWORD, 0x22204000); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, 0xf00000, 0x0f); - if (is2t) { - rtl_set_bbreg(hw, RFPGA0_XA_LSSIPARAMETER, BMASKDWORD, - 0x00010000); - rtl_set_bbreg(hw, RFPGA0_XB_LSSIPARAMETER, BMASKDWORD, - 0x00010000); - } - /* MAC settings */ - _rtl92d_phy_mac_setting_calibration(hw, iqk_mac_reg, - rtlphy->iqk_mac_backup); - /* Page B init */ - rtl_set_bbreg(hw, 0xb68, BMASKDWORD, 0x0f600000); - if (is2t) - rtl_set_bbreg(hw, 0xb6c, BMASKDWORD, 0x0f600000); - /* IQ calibration setting */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, "IQK setting!\n"); - rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0x80800000); - rtl_set_bbreg(hw, 0xe40, BMASKDWORD, 0x01007c00); - rtl_set_bbreg(hw, 0xe44, BMASKDWORD, 0x01004800); - for (i = 0; i < retrycount; i++) { - patha_ok = _rtl92d_phy_patha_iqk(hw, is2t); - if (patha_ok == 0x03) { - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Path A IQK Success!!\n"); - result[t][0] = (rtl_get_bbreg(hw, 0xe94, BMASKDWORD) & - 0x3FF0000) >> 16; - result[t][1] = (rtl_get_bbreg(hw, 0xe9c, BMASKDWORD) & - 0x3FF0000) >> 16; - result[t][2] = (rtl_get_bbreg(hw, 0xea4, BMASKDWORD) & - 0x3FF0000) >> 16; - result[t][3] = (rtl_get_bbreg(hw, 0xeac, BMASKDWORD) & - 0x3FF0000) >> 16; - break; - } else if (i == (retrycount - 1) && patha_ok == 0x01) { - /* Tx IQK OK */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Path A IQK Only Tx Success!!\n"); - - result[t][0] = (rtl_get_bbreg(hw, 0xe94, BMASKDWORD) & - 0x3FF0000) >> 16; - result[t][1] = (rtl_get_bbreg(hw, 0xe9c, BMASKDWORD) & - 0x3FF0000) >> 16; - } - } - if (0x00 == patha_ok) - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path A IQK failed!!\n"); - if (is2t) { - _rtl92d_phy_patha_standby(hw); - /* Turn Path B ADDA on */ - _rtl92d_phy_path_adda_on(hw, adda_reg, false, is2t); - for (i = 0; i < retrycount; i++) { - pathb_ok = _rtl92d_phy_pathb_iqk(hw); - if (pathb_ok == 0x03) { - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Path B IQK Success!!\n"); - result[t][4] = (rtl_get_bbreg(hw, 0xeb4, - BMASKDWORD) & 0x3FF0000) >> 16; - result[t][5] = (rtl_get_bbreg(hw, 0xebc, - BMASKDWORD) & 0x3FF0000) >> 16; - result[t][6] = (rtl_get_bbreg(hw, 0xec4, - BMASKDWORD) & 0x3FF0000) >> 16; - result[t][7] = (rtl_get_bbreg(hw, 0xecc, - BMASKDWORD) & 0x3FF0000) >> 16; - break; - } else if (i == (retrycount - 1) && pathb_ok == 0x01) { - /* Tx IQK OK */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Path B Only Tx IQK Success!!\n"); - result[t][4] = (rtl_get_bbreg(hw, 0xeb4, - BMASKDWORD) & 0x3FF0000) >> 16; - result[t][5] = (rtl_get_bbreg(hw, 0xebc, - BMASKDWORD) & 0x3FF0000) >> 16; - } - } - if (0x00 == pathb_ok) - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Path B IQK failed!!\n"); - } - - /* Back to BB mode, load original value */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "IQK:Back to BB mode, load original value!\n"); - - rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0); - if (t != 0) { - /* Switch back BB to SI mode after finish IQ Calibration. */ - if (!rtlphy->rfpi_enable) - _rtl92d_phy_pimode_switch(hw, false); - /* Reload ADDA power saving parameters */ - _rtl92d_phy_reload_adda_registers(hw, adda_reg, - rtlphy->adda_backup, IQK_ADDA_REG_NUM); - /* Reload MAC parameters */ - _rtl92d_phy_reload_mac_registers(hw, iqk_mac_reg, - rtlphy->iqk_mac_backup); - if (is2t) - _rtl92d_phy_reload_adda_registers(hw, iqk_bb_reg, - rtlphy->iqk_bb_backup, - IQK_BB_REG_NUM); - else - _rtl92d_phy_reload_adda_registers(hw, iqk_bb_reg, - rtlphy->iqk_bb_backup, - IQK_BB_REG_NUM - 1); - /* load 0xe30 IQC default value */ - rtl_set_bbreg(hw, 0xe30, BMASKDWORD, 0x01008c00); - rtl_set_bbreg(hw, 0xe34, BMASKDWORD, 0x01008c00); - } - RTPRINT(rtlpriv, FINIT, INIT_IQK, "<==\n"); -} - -static void _rtl92d_phy_iq_calibrate_5g_normal(struct ieee80211_hw *hw, - long result[][8], u8 t) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); - u8 patha_ok, pathb_ok; - static u32 adda_reg[IQK_ADDA_REG_NUM] = { - RFPGA0_XCD_SWITCHCONTROL, 0xe6c, 0xe70, 0xe74, - 0xe78, 0xe7c, 0xe80, 0xe84, - 0xe88, 0xe8c, 0xed0, 0xed4, - 0xed8, 0xedc, 0xee0, 0xeec - }; - static u32 iqk_mac_reg[IQK_MAC_REG_NUM] = { - 0x522, 0x550, 0x551, 0x040 - }; - static u32 iqk_bb_reg[IQK_BB_REG_NUM] = { - RFPGA0_XAB_RFINTERFACESW, RFPGA0_XA_RFINTERFACEOE, - RFPGA0_XB_RFINTERFACEOE, ROFDM0_TRMUXPAR, - RFPGA0_XCD_RFINTERFACESW, ROFDM0_TRXPATHENABLE, - RFPGA0_RFMOD, RFPGA0_ANALOGPARAMETER4, - ROFDM0_XAAGCCORE1, ROFDM0_XBAGCCORE1 - }; - u32 bbvalue; - bool is2t = IS_92D_SINGLEPHY(rtlhal->version); - - /* Note: IQ calibration must be performed after loading - * PHY_REG.txt , and radio_a, radio_b.txt */ - - RTPRINT(rtlpriv, FINIT, INIT_IQK, "IQK for 5G NORMAL:Start!!!\n"); - mdelay(IQK_DELAY_TIME * 20); - if (t == 0) { - bbvalue = rtl_get_bbreg(hw, RFPGA0_RFMOD, BMASKDWORD); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "==>0x%08x\n", bbvalue); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "IQ Calibration for %s\n", - is2t ? "2T2R" : "1T1R"); - /* Save ADDA parameters, turn Path A ADDA on */ - _rtl92d_phy_save_adda_registers(hw, adda_reg, - rtlphy->adda_backup, - IQK_ADDA_REG_NUM); - _rtl92d_phy_save_mac_registers(hw, iqk_mac_reg, - rtlphy->iqk_mac_backup); - if (is2t) - _rtl92d_phy_save_adda_registers(hw, iqk_bb_reg, - rtlphy->iqk_bb_backup, - IQK_BB_REG_NUM); - else - _rtl92d_phy_save_adda_registers(hw, iqk_bb_reg, - rtlphy->iqk_bb_backup, - IQK_BB_REG_NUM - 1); - } - _rtl92d_phy_path_adda_on(hw, adda_reg, true, is2t); - /* MAC settings */ - _rtl92d_phy_mac_setting_calibration(hw, iqk_mac_reg, - rtlphy->iqk_mac_backup); - if (t == 0) - rtlphy->rfpi_enable = (u8) rtl_get_bbreg(hw, - RFPGA0_XA_HSSIPARAMETER1, BIT(8)); - /* Switch BB to PI mode to do IQ Calibration. */ - if (!rtlphy->rfpi_enable) - _rtl92d_phy_pimode_switch(hw, true); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BIT(24), 0x00); - rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, BMASKDWORD, 0x03a05600); - rtl_set_bbreg(hw, ROFDM0_TRMUXPAR, BMASKDWORD, 0x000800e4); - rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, BMASKDWORD, 0x22208000); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, 0xf00000, 0x0f); - - /* Page B init */ - rtl_set_bbreg(hw, 0xb68, BMASKDWORD, 0x0f600000); - if (is2t) - rtl_set_bbreg(hw, 0xb6c, BMASKDWORD, 0x0f600000); - /* IQ calibration setting */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, "IQK setting!\n"); - rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0x80800000); - rtl_set_bbreg(hw, 0xe40, BMASKDWORD, 0x10007c00); - rtl_set_bbreg(hw, 0xe44, BMASKDWORD, 0x01004800); - patha_ok = _rtl92d_phy_patha_iqk_5g_normal(hw, is2t); - if (patha_ok == 0x03) { - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path A IQK Success!!\n"); - result[t][0] = (rtl_get_bbreg(hw, 0xe94, BMASKDWORD) & - 0x3FF0000) >> 16; - result[t][1] = (rtl_get_bbreg(hw, 0xe9c, BMASKDWORD) & - 0x3FF0000) >> 16; - result[t][2] = (rtl_get_bbreg(hw, 0xea4, BMASKDWORD) & - 0x3FF0000) >> 16; - result[t][3] = (rtl_get_bbreg(hw, 0xeac, BMASKDWORD) & - 0x3FF0000) >> 16; - } else if (patha_ok == 0x01) { /* Tx IQK OK */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Path A IQK Only Tx Success!!\n"); - - result[t][0] = (rtl_get_bbreg(hw, 0xe94, BMASKDWORD) & - 0x3FF0000) >> 16; - result[t][1] = (rtl_get_bbreg(hw, 0xe9c, BMASKDWORD) & - 0x3FF0000) >> 16; - } else { - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path A IQK Fail!!\n"); - } - if (is2t) { - /* _rtl92d_phy_patha_standby(hw); */ - /* Turn Path B ADDA on */ - _rtl92d_phy_path_adda_on(hw, adda_reg, false, is2t); - pathb_ok = _rtl92d_phy_pathb_iqk_5g_normal(hw); - if (pathb_ok == 0x03) { - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Path B IQK Success!!\n"); - result[t][4] = (rtl_get_bbreg(hw, 0xeb4, BMASKDWORD) & - 0x3FF0000) >> 16; - result[t][5] = (rtl_get_bbreg(hw, 0xebc, BMASKDWORD) & - 0x3FF0000) >> 16; - result[t][6] = (rtl_get_bbreg(hw, 0xec4, BMASKDWORD) & - 0x3FF0000) >> 16; - result[t][7] = (rtl_get_bbreg(hw, 0xecc, BMASKDWORD) & - 0x3FF0000) >> 16; - } else if (pathb_ok == 0x01) { /* Tx IQK OK */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Path B Only Tx IQK Success!!\n"); - result[t][4] = (rtl_get_bbreg(hw, 0xeb4, BMASKDWORD) & - 0x3FF0000) >> 16; - result[t][5] = (rtl_get_bbreg(hw, 0xebc, BMASKDWORD) & - 0x3FF0000) >> 16; - } else { - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Path B IQK failed!!\n"); - } - } - - /* Back to BB mode, load original value */ - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "IQK:Back to BB mode, load original value!\n"); - rtl_set_bbreg(hw, 0xe28, BMASKDWORD, 0); - if (t != 0) { - if (is2t) - _rtl92d_phy_reload_adda_registers(hw, iqk_bb_reg, - rtlphy->iqk_bb_backup, - IQK_BB_REG_NUM); - else - _rtl92d_phy_reload_adda_registers(hw, iqk_bb_reg, - rtlphy->iqk_bb_backup, - IQK_BB_REG_NUM - 1); - /* Reload MAC parameters */ - _rtl92d_phy_reload_mac_registers(hw, iqk_mac_reg, - rtlphy->iqk_mac_backup); - /* Switch back BB to SI mode after finish IQ Calibration. */ - if (!rtlphy->rfpi_enable) - _rtl92d_phy_pimode_switch(hw, false); - /* Reload ADDA power saving parameters */ - _rtl92d_phy_reload_adda_registers(hw, adda_reg, - rtlphy->adda_backup, - IQK_ADDA_REG_NUM); - } - RTPRINT(rtlpriv, FINIT, INIT_IQK, "<==\n"); -} - -static bool _rtl92d_phy_simularity_compare(struct ieee80211_hw *hw, - long result[][8], u8 c1, u8 c2) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); - u32 i, j, diff, sim_bitmap, bound; - u8 final_candidate[2] = {0xFF, 0xFF}; /* for path A and path B */ - bool bresult = true; - bool is2t = IS_92D_SINGLEPHY(rtlhal->version); - - if (is2t) - bound = 8; - else - bound = 4; - sim_bitmap = 0; - for (i = 0; i < bound; i++) { - diff = (result[c1][i] > result[c2][i]) ? (result[c1][i] - - result[c2][i]) : (result[c2][i] - result[c1][i]); - if (diff > MAX_TOLERANCE_92D) { - if ((i == 2 || i == 6) && !sim_bitmap) { - if (result[c1][i] + result[c1][i + 1] == 0) - final_candidate[(i / 4)] = c2; - else if (result[c2][i] + result[c2][i + 1] == 0) - final_candidate[(i / 4)] = c1; - else - sim_bitmap = sim_bitmap | (1 << i); - } else { - sim_bitmap = sim_bitmap | (1 << i); - } - } - } - if (sim_bitmap == 0) { - for (i = 0; i < (bound / 4); i++) { - if (final_candidate[i] != 0xFF) { - for (j = i * 4; j < (i + 1) * 4 - 2; j++) - result[3][j] = - result[final_candidate[i]][j]; - bresult = false; - } - } - return bresult; - } - if (!(sim_bitmap & 0x0F)) { /* path A OK */ - for (i = 0; i < 4; i++) - result[3][i] = result[c1][i]; - } else if (!(sim_bitmap & 0x03)) { /* path A, Tx OK */ - for (i = 0; i < 2; i++) - result[3][i] = result[c1][i]; - } - if (!(sim_bitmap & 0xF0) && is2t) { /* path B OK */ - for (i = 4; i < 8; i++) - result[3][i] = result[c1][i]; - } else if (!(sim_bitmap & 0x30)) { /* path B, Tx OK */ - for (i = 4; i < 6; i++) - result[3][i] = result[c1][i]; - } - return false; -} - -static void _rtl92d_phy_patha_fill_iqk_matrix(struct ieee80211_hw *hw, - bool iqk_ok, long result[][8], - u8 final_candidate, bool txonly) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); - u32 oldval_0, val_x, tx0_a, reg; - long val_y, tx0_c; - bool is2t = IS_92D_SINGLEPHY(rtlhal->version) || - rtlhal->macphymode == DUALMAC_DUALPHY; - - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Path A IQ Calibration %s !\n", iqk_ok ? "Success" : "Failed"); - if (final_candidate == 0xFF) { - return; - } else if (iqk_ok) { - oldval_0 = (rtl_get_bbreg(hw, ROFDM0_XATxIQIMBALANCE, - BMASKDWORD) >> 22) & 0x3FF; /* OFDM0_D */ - val_x = result[final_candidate][0]; - if ((val_x & 0x00000200) != 0) - val_x = val_x | 0xFFFFFC00; - tx0_a = (val_x * oldval_0) >> 8; - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "X = 0x%x, tx0_a = 0x%x, oldval_0 0x%x\n", - val_x, tx0_a, oldval_0); - rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, 0x3FF, tx0_a); - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(24), - ((val_x * oldval_0 >> 7) & 0x1)); - val_y = result[final_candidate][1]; - if ((val_y & 0x00000200) != 0) - val_y = val_y | 0xFFFFFC00; - /* path B IQK result + 3 */ - if (rtlhal->interfaceindex == 1 && - rtlhal->current_bandtype == BAND_ON_5G) - val_y += 3; - tx0_c = (val_y * oldval_0) >> 8; - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "Y = 0x%lx, tx0_c = 0x%lx\n", - val_y, tx0_c); - rtl_set_bbreg(hw, ROFDM0_XCTxAFE, 0xF0000000, - ((tx0_c & 0x3C0) >> 6)); - rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, 0x003F0000, - (tx0_c & 0x3F)); - if (is2t) - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(26), - ((val_y * oldval_0 >> 7) & 0x1)); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "0xC80 = 0x%x\n", - rtl_get_bbreg(hw, ROFDM0_XATxIQIMBALANCE, - BMASKDWORD)); - if (txonly) { - RTPRINT(rtlpriv, FINIT, INIT_IQK, "only Tx OK\n"); - return; - } - reg = result[final_candidate][2]; - rtl_set_bbreg(hw, ROFDM0_XARXIQIMBALANCE, 0x3FF, reg); - reg = result[final_candidate][3] & 0x3F; - rtl_set_bbreg(hw, ROFDM0_XARXIQIMBALANCE, 0xFC00, reg); - reg = (result[final_candidate][3] >> 6) & 0xF; - rtl_set_bbreg(hw, 0xca0, 0xF0000000, reg); - } -} - -static void _rtl92d_phy_pathb_fill_iqk_matrix(struct ieee80211_hw *hw, - bool iqk_ok, long result[][8], u8 final_candidate, bool txonly) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); - u32 oldval_1, val_x, tx1_a, reg; - long val_y, tx1_c; - - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Path B IQ Calibration %s !\n", - iqk_ok ? "Success" : "Failed"); - if (final_candidate == 0xFF) { - return; - } else if (iqk_ok) { - oldval_1 = (rtl_get_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, - BMASKDWORD) >> 22) & 0x3FF; - val_x = result[final_candidate][4]; - if ((val_x & 0x00000200) != 0) - val_x = val_x | 0xFFFFFC00; - tx1_a = (val_x * oldval_1) >> 8; - RTPRINT(rtlpriv, FINIT, INIT_IQK, "X = 0x%x, tx1_a = 0x%x\n", - val_x, tx1_a); - rtl_set_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, 0x3FF, tx1_a); - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(28), - ((val_x * oldval_1 >> 7) & 0x1)); - val_y = result[final_candidate][5]; - if ((val_y & 0x00000200) != 0) - val_y = val_y | 0xFFFFFC00; - if (rtlhal->current_bandtype == BAND_ON_5G) - val_y += 3; - tx1_c = (val_y * oldval_1) >> 8; - RTPRINT(rtlpriv, FINIT, INIT_IQK, "Y = 0x%lx, tx1_c = 0x%lx\n", - val_y, tx1_c); - rtl_set_bbreg(hw, ROFDM0_XDTxAFE, 0xF0000000, - ((tx1_c & 0x3C0) >> 6)); - rtl_set_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, 0x003F0000, - (tx1_c & 0x3F)); - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(30), - ((val_y * oldval_1 >> 7) & 0x1)); - if (txonly) - return; - reg = result[final_candidate][6]; - rtl_set_bbreg(hw, ROFDM0_XBRXIQIMBALANCE, 0x3FF, reg); - reg = result[final_candidate][7] & 0x3F; - rtl_set_bbreg(hw, ROFDM0_XBRXIQIMBALANCE, 0xFC00, reg); - reg = (result[final_candidate][7] >> 6) & 0xF; - rtl_set_bbreg(hw, ROFDM0_AGCRSSITABLE, 0x0000F000, reg); - } -} - -void rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); - long result[4][8]; - u8 i, final_candidate, indexforchannel; - bool patha_ok, pathb_ok; - long rege94, rege9c, regea4, regeac, regeb4; - long regebc, regec4, regecc, regtmp = 0; - bool is12simular, is13simular, is23simular; - unsigned long flag = 0; - - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "IQK:Start!!!channel %d\n", rtlphy->current_channel); - for (i = 0; i < 8; i++) { - result[0][i] = 0; - result[1][i] = 0; - result[2][i] = 0; - result[3][i] = 0; - } - final_candidate = 0xff; - patha_ok = false; - pathb_ok = false; - is12simular = false; - is23simular = false; - is13simular = false; - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "IQK !!!currentband %d\n", rtlhal->current_bandtype); - rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag); - for (i = 0; i < 3; i++) { - if (rtlhal->current_bandtype == BAND_ON_5G) { - _rtl92d_phy_iq_calibrate_5g_normal(hw, result, i); - } else if (rtlhal->current_bandtype == BAND_ON_2_4G) { - if (IS_92D_SINGLEPHY(rtlhal->version)) - _rtl92d_phy_iq_calibrate(hw, result, i, true); - else - _rtl92d_phy_iq_calibrate(hw, result, i, false); - } - if (i == 1) { - is12simular = _rtl92d_phy_simularity_compare(hw, result, - 0, 1); - if (is12simular) { - final_candidate = 0; - break; - } - } - if (i == 2) { - is13simular = _rtl92d_phy_simularity_compare(hw, result, - 0, 2); - if (is13simular) { - final_candidate = 0; - break; - } - is23simular = _rtl92d_phy_simularity_compare(hw, result, - 1, 2); - if (is23simular) { - final_candidate = 1; - } else { - for (i = 0; i < 8; i++) - regtmp += result[3][i]; - - if (regtmp != 0) - final_candidate = 3; - else - final_candidate = 0xFF; - } - } - } - rtl92d_release_cckandrw_pagea_ctl(hw, &flag); - for (i = 0; i < 4; i++) { - rege94 = result[i][0]; - rege9c = result[i][1]; - regea4 = result[i][2]; - regeac = result[i][3]; - regeb4 = result[i][4]; - regebc = result[i][5]; - regec4 = result[i][6]; - regecc = result[i][7]; - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "IQK: rege94=%lx rege9c=%lx regea4=%lx regeac=%lx regeb4=%lx regebc=%lx regec4=%lx regecc=%lx\n", - rege94, rege9c, regea4, regeac, regeb4, regebc, regec4, - regecc); - } - if (final_candidate != 0xff) { - rtlphy->reg_e94 = rege94 = result[final_candidate][0]; - rtlphy->reg_e9c = rege9c = result[final_candidate][1]; - regea4 = result[final_candidate][2]; - regeac = result[final_candidate][3]; - rtlphy->reg_eb4 = regeb4 = result[final_candidate][4]; - rtlphy->reg_ebc = regebc = result[final_candidate][5]; - regec4 = result[final_candidate][6]; - regecc = result[final_candidate][7]; - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "IQK: final_candidate is %x\n", final_candidate); - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "IQK: rege94=%lx rege9c=%lx regea4=%lx regeac=%lx regeb4=%lx regebc=%lx regec4=%lx regecc=%lx\n", - rege94, rege9c, regea4, regeac, regeb4, regebc, regec4, - regecc); - patha_ok = pathb_ok = true; - } else { - rtlphy->reg_e94 = rtlphy->reg_eb4 = 0x100; /* X default value */ - rtlphy->reg_e9c = rtlphy->reg_ebc = 0x0; /* Y default value */ - } - if ((rege94 != 0) /*&&(regea4 != 0) */) - _rtl92d_phy_patha_fill_iqk_matrix(hw, patha_ok, result, - final_candidate, (regea4 == 0)); - if (IS_92D_SINGLEPHY(rtlhal->version)) { - if ((regeb4 != 0) /*&&(regec4 != 0) */) - _rtl92d_phy_pathb_fill_iqk_matrix(hw, pathb_ok, result, - final_candidate, (regec4 == 0)); - } - if (final_candidate != 0xFF) { - indexforchannel = rtl92d_get_rightchnlplace_for_iqk( - rtlphy->current_channel); - - for (i = 0; i < IQK_MATRIX_REG_NUM; i++) - rtlphy->iqk_matrix[indexforchannel]. - value[0][i] = result[final_candidate][i]; - rtlphy->iqk_matrix[indexforchannel].iqk_done = - true; - - RT_TRACE(rtlpriv, COMP_SCAN | COMP_MLME, DBG_LOUD, - "IQK OK indexforchannel %d\n", indexforchannel); - } -} - -void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); - u8 indexforchannel; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "channel %d\n", channel); - /*------Do IQK for normal chip and test chip 5G band------- */ - indexforchannel = rtl92d_get_rightchnlplace_for_iqk(channel); - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "indexforchannel %d done %d\n", - indexforchannel, - rtlphy->iqk_matrix[indexforchannel].iqk_done); - if (0 && !rtlphy->iqk_matrix[indexforchannel].iqk_done && - rtlphy->need_iqk) { - /* Re Do IQK. */ - RT_TRACE(rtlpriv, COMP_SCAN | COMP_INIT, DBG_LOUD, - "Do IQK Matrix reg for channel:%d....\n", channel); - rtl92d_phy_iq_calibrate(hw); - } else { - /* Just load the value. */ - /* 2G band just load once. */ - if (((!rtlhal->load_imrandiqk_setting_for2g) && - indexforchannel == 0) || indexforchannel > 0) { - RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD, - "Just Read IQK Matrix reg for channel:%d....\n", - channel); - if ((rtlphy->iqk_matrix[indexforchannel]. - value[0] != NULL) - /*&&(regea4 != 0) */) - _rtl92d_phy_patha_fill_iqk_matrix(hw, true, - rtlphy->iqk_matrix[ - indexforchannel].value, 0, - (rtlphy->iqk_matrix[ - indexforchannel].value[0][2] == 0)); - if (IS_92D_SINGLEPHY(rtlhal->version)) { - if ((rtlphy->iqk_matrix[ - indexforchannel].value[0][4] != 0) - /*&&(regec4 != 0) */) - _rtl92d_phy_pathb_fill_iqk_matrix(hw, - true, - rtlphy->iqk_matrix[ - indexforchannel].value, 0, - (rtlphy->iqk_matrix[ - indexforchannel].value[0][6] - == 0)); - } - } - } - rtlphy->need_iqk = false; - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "<====\n"); -} - -static u32 _rtl92d_phy_get_abs(u32 val1, u32 val2) -{ - u32 ret; - - if (val1 >= val2) - ret = val1 - val2; - else - ret = val2 - val1; - return ret; -} - -static bool _rtl92d_is_legal_5g_channel(struct ieee80211_hw *hw, u8 channel) -{ - - int i; - u8 channel_5g[45] = { - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, - 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, - 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, - 134, 136, 138, 140, 149, 151, 153, 155, 157, 159, - 161, 163, 165 - }; - - for (i = 0; i < sizeof(channel_5g); i++) - if (channel == channel_5g[i]) - return true; - return false; -} - -static void _rtl92d_phy_calc_curvindex(struct ieee80211_hw *hw, - u32 *targetchnl, u32 * curvecount_val, - bool is5g, u32 *curveindex) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 smallest_abs_val = 0xffffffff, u4tmp; - u8 i, j; - u8 chnl_num = is5g ? TARGET_CHNL_NUM_5G : TARGET_CHNL_NUM_2G; - - for (i = 0; i < chnl_num; i++) { - if (is5g && !_rtl92d_is_legal_5g_channel(hw, i + 1)) - continue; - curveindex[i] = 0; - for (j = 0; j < (CV_CURVE_CNT * 2); j++) { - u4tmp = _rtl92d_phy_get_abs(targetchnl[i], - curvecount_val[j]); - - if (u4tmp < smallest_abs_val) { - curveindex[i] = j; - smallest_abs_val = u4tmp; - } - } - smallest_abs_val = 0xffffffff; - RTPRINT(rtlpriv, FINIT, INIT_IQK, "curveindex[%d] = %x\n", - i, curveindex[i]); - } -} - -static void _rtl92d_phy_reload_lck_setting(struct ieee80211_hw *hw, - u8 channel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 erfpath = rtlpriv->rtlhal.current_bandtype == - BAND_ON_5G ? RF90_PATH_A : - IS_92D_SINGLEPHY(rtlpriv->rtlhal.version) ? - RF90_PATH_B : RF90_PATH_A; - u32 u4tmp = 0, u4regvalue = 0; - bool bneed_powerdown_radio = false; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "path %d\n", erfpath); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "band type = %d\n", - rtlpriv->rtlhal.current_bandtype); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "channel = %d\n", channel); - if (rtlpriv->rtlhal.current_bandtype == BAND_ON_5G) {/* Path-A for 5G */ - u4tmp = curveindex_5g[channel-1]; - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "ver 1 set RF-A, 5G, 0x28 = 0x%ulx !!\n", u4tmp); - if (rtlpriv->rtlhal.macphymode == DUALMAC_DUALPHY && - rtlpriv->rtlhal.interfaceindex == 1) { - bneed_powerdown_radio = - rtl92d_phy_enable_anotherphy(hw, false); - rtlpriv->rtlhal.during_mac1init_radioa = true; - /* asume no this case */ - if (bneed_powerdown_radio) - _rtl92d_phy_enable_rf_env(hw, erfpath, - &u4regvalue); - } - rtl_set_rfreg(hw, erfpath, RF_SYN_G4, 0x3f800, u4tmp); - if (bneed_powerdown_radio) - _rtl92d_phy_restore_rf_env(hw, erfpath, &u4regvalue); - if (rtlpriv->rtlhal.during_mac1init_radioa) - rtl92d_phy_powerdown_anotherphy(hw, false); - } else if (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G) { - u4tmp = curveindex_2g[channel-1]; - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "ver 3 set RF-B, 2G, 0x28 = 0x%ulx !!\n", u4tmp); - if (rtlpriv->rtlhal.macphymode == DUALMAC_DUALPHY && - rtlpriv->rtlhal.interfaceindex == 0) { - bneed_powerdown_radio = - rtl92d_phy_enable_anotherphy(hw, true); - rtlpriv->rtlhal.during_mac0init_radiob = true; - if (bneed_powerdown_radio) - _rtl92d_phy_enable_rf_env(hw, erfpath, - &u4regvalue); - } - rtl_set_rfreg(hw, erfpath, RF_SYN_G4, 0x3f800, u4tmp); - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "ver 3 set RF-B, 2G, 0x28 = 0x%ulx !!\n", - rtl_get_rfreg(hw, erfpath, RF_SYN_G4, 0x3f800)); - if (bneed_powerdown_radio) - _rtl92d_phy_restore_rf_env(hw, erfpath, &u4regvalue); - if (rtlpriv->rtlhal.during_mac0init_radiob) - rtl92d_phy_powerdown_anotherphy(hw, true); - } - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "<====\n"); -} - -static void _rtl92d_phy_lc_calibrate_sw(struct ieee80211_hw *hw, bool is2t) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u8 tmpreg, index, rf_mode[2]; - u8 path = is2t ? 2 : 1; - u8 i; - u32 u4tmp, offset; - u32 curvecount_val[CV_CURVE_CNT * 2] = {0}; - u16 timeout = 800, timecount = 0; - - /* Check continuous TX and Packet TX */ - tmpreg = rtl_read_byte(rtlpriv, 0xd03); - /* if Deal with contisuous TX case, disable all continuous TX */ - /* if Deal with Packet TX case, block all queues */ - if ((tmpreg & 0x70) != 0) - rtl_write_byte(rtlpriv, 0xd03, tmpreg & 0x8F); - else - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, 0xF00000, 0x0F); - for (index = 0; index < path; index++) { - /* 1. Read original RF mode */ - offset = index == 0 ? ROFDM0_XAAGCCORE1 : ROFDM0_XBAGCCORE1; - rf_mode[index] = rtl_read_byte(rtlpriv, offset); - /* 2. Set RF mode = standby mode */ - rtl_set_rfreg(hw, (enum radio_path)index, RF_AC, - BRFREGOFFSETMASK, 0x010000); - if (rtlpci->init_ready) { - /* switch CV-curve control by LC-calibration */ - rtl_set_rfreg(hw, (enum radio_path)index, RF_SYN_G7, - BIT(17), 0x0); - /* 4. Set LC calibration begin */ - rtl_set_rfreg(hw, (enum radio_path)index, RF_CHNLBW, - 0x08000, 0x01); - } - u4tmp = rtl_get_rfreg(hw, (enum radio_path)index, RF_SYN_G6, - BRFREGOFFSETMASK); - while ((!(u4tmp & BIT(11))) && timecount <= timeout) { - mdelay(50); - timecount += 50; - u4tmp = rtl_get_rfreg(hw, (enum radio_path)index, - RF_SYN_G6, BRFREGOFFSETMASK); - } - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "PHY_LCK finish delay for %d ms=2\n", timecount); - u4tmp = rtl_get_rfreg(hw, index, RF_SYN_G4, BRFREGOFFSETMASK); - if (index == 0 && rtlhal->interfaceindex == 0) { - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "path-A / 5G LCK\n"); - } else { - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "path-B / 2.4G LCK\n"); - } - memset(&curvecount_val[0], 0, CV_CURVE_CNT * 2); - /* Set LC calibration off */ - rtl_set_rfreg(hw, (enum radio_path)index, RF_CHNLBW, - 0x08000, 0x0); - RTPRINT(rtlpriv, FINIT, INIT_IQK, "set RF 0x18[15] = 0\n"); - /* save Curve-counting number */ - for (i = 0; i < CV_CURVE_CNT; i++) { - u32 readval = 0, readval2 = 0; - rtl_set_rfreg(hw, (enum radio_path)index, 0x3F, - 0x7f, i); - - rtl_set_rfreg(hw, (enum radio_path)index, 0x4D, - BRFREGOFFSETMASK, 0x0); - readval = rtl_get_rfreg(hw, (enum radio_path)index, - 0x4F, BRFREGOFFSETMASK); - curvecount_val[2 * i + 1] = (readval & 0xfffe0) >> 5; - /* reg 0x4f [4:0] */ - /* reg 0x50 [19:10] */ - readval2 = rtl_get_rfreg(hw, (enum radio_path)index, - 0x50, 0xffc00); - curvecount_val[2 * i] = (((readval & 0x1F) << 10) | - readval2); - } - if (index == 0 && rtlhal->interfaceindex == 0) - _rtl92d_phy_calc_curvindex(hw, targetchnl_5g, - curvecount_val, - true, curveindex_5g); - else - _rtl92d_phy_calc_curvindex(hw, targetchnl_2g, - curvecount_val, - false, curveindex_2g); - /* switch CV-curve control mode */ - rtl_set_rfreg(hw, (enum radio_path)index, RF_SYN_G7, - BIT(17), 0x1); - } - - /* Restore original situation */ - for (index = 0; index < path; index++) { - offset = index == 0 ? ROFDM0_XAAGCCORE1 : ROFDM0_XBAGCCORE1; - rtl_write_byte(rtlpriv, offset, 0x50); - rtl_write_byte(rtlpriv, offset, rf_mode[index]); - } - if ((tmpreg & 0x70) != 0) - rtl_write_byte(rtlpriv, 0xd03, tmpreg); - else /*Deal with Packet TX case */ - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER4, 0xF00000, 0x00); - _rtl92d_phy_reload_lck_setting(hw, rtlpriv->phy.current_channel); -} - -static void _rtl92d_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RTPRINT(rtlpriv, FINIT, INIT_IQK, "cosa PHY_LCK ver=2\n"); - _rtl92d_phy_lc_calibrate_sw(hw, is2t); -} - -void rtl92d_phy_lc_calibrate(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); - u32 timeout = 2000, timecount = 0; - - while (rtlpriv->mac80211.act_scanning && timecount < timeout) { - udelay(50); - timecount += 50; - } - - rtlphy->lck_inprogress = true; - RTPRINT(rtlpriv, FINIT, INIT_IQK, - "LCK:Start!!! currentband %x delay %d ms\n", - rtlhal->current_bandtype, timecount); - if (IS_92D_SINGLEPHY(rtlhal->version)) { - _rtl92d_phy_lc_calibrate(hw, true); - } else { - /* For 1T1R */ - _rtl92d_phy_lc_calibrate(hw, false); - } - rtlphy->lck_inprogress = false; - RTPRINT(rtlpriv, FINIT, INIT_IQK, "LCK:Finish!!!\n"); -} - -void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, char delta) -{ - return; -} - -static bool _rtl92d_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable, - u32 cmdtableidx, u32 cmdtablesz, enum swchnlcmd_id cmdid, - u32 para1, u32 para2, u32 msdelay) -{ - struct swchnlcmd *pcmd; - - if (cmdtable == NULL) { - RT_ASSERT(false, "cmdtable cannot be NULL\n"); - return false; - } - if (cmdtableidx >= cmdtablesz) - return false; - - pcmd = cmdtable + cmdtableidx; - pcmd->cmdid = cmdid; - pcmd->para1 = para1; - pcmd->para2 = para2; - pcmd->msdelay = msdelay; - return true; -} - -void rtl92d_phy_reset_iqk_result(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u8 i; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "settings regs %d default regs %d\n", - (int)(sizeof(rtlphy->iqk_matrix) / - sizeof(struct iqk_matrix_regs)), - IQK_MATRIX_REG_NUM); - /* 0xe94, 0xe9c, 0xea4, 0xeac, 0xeb4, 0xebc, 0xec4, 0xecc */ - for (i = 0; i < IQK_MATRIX_SETTINGS_NUM; i++) { - rtlphy->iqk_matrix[i].value[0][0] = 0x100; - rtlphy->iqk_matrix[i].value[0][2] = 0x100; - rtlphy->iqk_matrix[i].value[0][4] = 0x100; - rtlphy->iqk_matrix[i].value[0][6] = 0x100; - rtlphy->iqk_matrix[i].value[0][1] = 0x0; - rtlphy->iqk_matrix[i].value[0][3] = 0x0; - rtlphy->iqk_matrix[i].value[0][5] = 0x0; - rtlphy->iqk_matrix[i].value[0][7] = 0x0; - rtlphy->iqk_matrix[i].iqk_done = false; - } -} - -static bool _rtl92d_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, - u8 channel, u8 *stage, u8 *step, - u32 *delay) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct swchnlcmd precommoncmd[MAX_PRECMD_CNT]; - u32 precommoncmdcnt; - struct swchnlcmd postcommoncmd[MAX_POSTCMD_CNT]; - u32 postcommoncmdcnt; - struct swchnlcmd rfdependcmd[MAX_RFDEPENDCMD_CNT]; - u32 rfdependcmdcnt; - struct swchnlcmd *currentcmd = NULL; - u8 rfpath; - u8 num_total_rfpath = rtlphy->num_total_rfpath; - - precommoncmdcnt = 0; - _rtl92d_phy_set_sw_chnl_cmdarray(precommoncmd, precommoncmdcnt++, - MAX_PRECMD_CNT, - CMDID_SET_TXPOWEROWER_LEVEL, 0, 0, 0); - _rtl92d_phy_set_sw_chnl_cmdarray(precommoncmd, precommoncmdcnt++, - MAX_PRECMD_CNT, CMDID_END, 0, 0, 0); - postcommoncmdcnt = 0; - _rtl92d_phy_set_sw_chnl_cmdarray(postcommoncmd, postcommoncmdcnt++, - MAX_POSTCMD_CNT, CMDID_END, 0, 0, 0); - rfdependcmdcnt = 0; - _rtl92d_phy_set_sw_chnl_cmdarray(rfdependcmd, rfdependcmdcnt++, - MAX_RFDEPENDCMD_CNT, CMDID_RF_WRITEREG, - RF_CHNLBW, channel, 0); - _rtl92d_phy_set_sw_chnl_cmdarray(rfdependcmd, rfdependcmdcnt++, - MAX_RFDEPENDCMD_CNT, CMDID_END, - 0, 0, 0); - - do { - switch (*stage) { - case 0: - currentcmd = &precommoncmd[*step]; - break; - case 1: - currentcmd = &rfdependcmd[*step]; - break; - case 2: - currentcmd = &postcommoncmd[*step]; - break; - } - if (currentcmd->cmdid == CMDID_END) { - if ((*stage) == 2) { - return true; - } else { - (*stage)++; - (*step) = 0; - continue; - } - } - switch (currentcmd->cmdid) { - case CMDID_SET_TXPOWEROWER_LEVEL: - rtl92d_phy_set_txpower_level(hw, channel); - break; - case CMDID_WRITEPORT_ULONG: - rtl_write_dword(rtlpriv, currentcmd->para1, - currentcmd->para2); - break; - case CMDID_WRITEPORT_USHORT: - rtl_write_word(rtlpriv, currentcmd->para1, - (u16)currentcmd->para2); - break; - case CMDID_WRITEPORT_UCHAR: - rtl_write_byte(rtlpriv, currentcmd->para1, - (u8)currentcmd->para2); - break; - case CMDID_RF_WRITEREG: - for (rfpath = 0; rfpath < num_total_rfpath; rfpath++) { - rtlphy->rfreg_chnlval[rfpath] = - ((rtlphy->rfreg_chnlval[rfpath] & - 0xffffff00) | currentcmd->para2); - if (rtlpriv->rtlhal.current_bandtype == - BAND_ON_5G) { - if (currentcmd->para2 > 99) - rtlphy->rfreg_chnlval[rfpath] = - rtlphy->rfreg_chnlval - [rfpath] | (BIT(18)); - else - rtlphy->rfreg_chnlval[rfpath] = - rtlphy->rfreg_chnlval - [rfpath] & (~BIT(18)); - rtlphy->rfreg_chnlval[rfpath] |= - (BIT(16) | BIT(8)); - } else { - rtlphy->rfreg_chnlval[rfpath] &= - ~(BIT(8) | BIT(16) | BIT(18)); - } - rtl_set_rfreg(hw, (enum radio_path)rfpath, - currentcmd->para1, - BRFREGOFFSETMASK, - rtlphy->rfreg_chnlval[rfpath]); - _rtl92d_phy_reload_imr_setting(hw, channel, - rfpath); - } - _rtl92d_phy_switch_rf_setting(hw, channel); - /* do IQK when all parameters are ready */ - rtl92d_phy_reload_iqk_setting(hw, channel); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - break; - } while (true); - (*delay) = currentcmd->msdelay; - (*step)++; - return false; -} - -u8 rtl92d_phy_sw_chnl(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u32 delay; - u32 timeout = 1000, timecount = 0; - u8 channel = rtlphy->current_channel; - u32 ret_value; - - if (rtlphy->sw_chnl_inprogress) - return 0; - if (rtlphy->set_bwmode_inprogress) - return 0; - - if ((is_hal_stop(rtlhal)) || (RT_CANNOT_IO(hw))) { - RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, - "sw_chnl_inprogress false driver sleep or unload\n"); - return 0; - } - while (rtlphy->lck_inprogress && timecount < timeout) { - mdelay(50); - timecount += 50; - } - if (rtlhal->macphymode == SINGLEMAC_SINGLEPHY && - rtlhal->bandset == BAND_ON_BOTH) { - ret_value = rtl_get_bbreg(hw, RFPGA0_XAB_RFPARAMETER, - BMASKDWORD); - if (rtlphy->current_channel > 14 && !(ret_value & BIT(0))) - rtl92d_phy_switch_wirelessband(hw, BAND_ON_5G); - else if (rtlphy->current_channel <= 14 && (ret_value & BIT(0))) - rtl92d_phy_switch_wirelessband(hw, BAND_ON_2_4G); - } - switch (rtlhal->current_bandtype) { - case BAND_ON_5G: - /* Get first channel error when change between - * 5G and 2.4G band. */ - if (channel <= 14) - return 0; - RT_ASSERT((channel > 14), "5G but channel<=14\n"); - break; - case BAND_ON_2_4G: - /* Get first channel error when change between - * 5G and 2.4G band. */ - if (channel > 14) - return 0; - RT_ASSERT((channel <= 14), "2G but channel>14\n"); - break; - default: - RT_ASSERT(false, "Invalid WirelessMode(%#x)!!\n", - rtlpriv->mac80211.mode); - break; - } - rtlphy->sw_chnl_inprogress = true; - if (channel == 0) - channel = 1; - rtlphy->sw_chnl_stage = 0; - rtlphy->sw_chnl_step = 0; - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, - "switch to channel%d\n", rtlphy->current_channel); - - do { - if (!rtlphy->sw_chnl_inprogress) - break; - if (!_rtl92d_phy_sw_chnl_step_by_step(hw, - rtlphy->current_channel, - &rtlphy->sw_chnl_stage, &rtlphy->sw_chnl_step, &delay)) { - if (delay > 0) - mdelay(delay); - else - continue; - } else { - rtlphy->sw_chnl_inprogress = false; - } - break; - } while (true); - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n"); - rtlphy->sw_chnl_inprogress = false; - return 1; -} - -static void rtl92d_phy_set_io(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *de_digtable = &rtlpriv->dm_digtable; - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "--->Cmd(%#x), set_io_inprogress(%d)\n", - rtlphy->current_io_type, rtlphy->set_io_inprogress); - switch (rtlphy->current_io_type) { - case IO_CMD_RESUME_DM_BY_SCAN: - de_digtable->cur_igvalue = rtlphy->initgain_backup.xaagccore1; - rtl92d_dm_write_dig(hw); - rtl92d_phy_set_txpower_level(hw, rtlphy->current_channel); - break; - case IO_CMD_PAUSE_DM_BY_SCAN: - rtlphy->initgain_backup.xaagccore1 = de_digtable->cur_igvalue; - de_digtable->cur_igvalue = 0x37; - rtl92d_dm_write_dig(hw); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - rtlphy->set_io_inprogress = false; - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, "<---(%#x)\n", - rtlphy->current_io_type); -} - -bool rtl92d_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - bool postprocessing = false; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "-->IO Cmd(%#x), set_io_inprogress(%d)\n", - iotype, rtlphy->set_io_inprogress); - do { - switch (iotype) { - case IO_CMD_RESUME_DM_BY_SCAN: - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "[IO CMD] Resume DM after scan\n"); - postprocessing = true; - break; - case IO_CMD_PAUSE_DM_BY_SCAN: - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "[IO CMD] Pause DM before scan\n"); - postprocessing = true; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - } while (false); - if (postprocessing && !rtlphy->set_io_inprogress) { - rtlphy->set_io_inprogress = true; - rtlphy->current_io_type = iotype; - } else { - return false; - } - rtl92d_phy_set_io(hw); - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, "<--IO Type(%#x)\n", iotype); - return true; -} - -static void _rtl92d_phy_set_rfon(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - /* a. SYS_CLKR 0x08[11] = 1 restore MAC clock */ - /* b. SPS_CTRL 0x11[7:0] = 0x2b */ - if (rtlpriv->rtlhal.macphymode == SINGLEMAC_SINGLEPHY) - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x2b); - /* c. For PCIE: SYS_FUNC_EN 0x02[7:0] = 0xE3 enable BB TRX function */ - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); - /* RF_ON_EXCEP(d~g): */ - /* d. APSD_CTRL 0x600[7:0] = 0x00 */ - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x00); - /* e. SYS_FUNC_EN 0x02[7:0] = 0xE2 reset BB TRX function again */ - /* f. SYS_FUNC_EN 0x02[7:0] = 0xE3 enable BB TRX function*/ - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); - /* g. txpause 0x522[7:0] = 0x00 enable mac tx queue */ - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); -} - -static void _rtl92d_phy_set_rfsleep(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 u4btmp; - u8 delay = 5; - - /* a. TXPAUSE 0x522[7:0] = 0xFF Pause MAC TX queue */ - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF); - /* b. RF path 0 offset 0x00 = 0x00 disable RF */ - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, BRFREGOFFSETMASK, 0x00); - /* c. APSD_CTRL 0x600[7:0] = 0x40 */ - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40); - /* d. APSD_CTRL 0x600[7:0] = 0x00 - * APSD_CTRL 0x600[7:0] = 0x00 - * RF path 0 offset 0x00 = 0x00 - * APSD_CTRL 0x600[7:0] = 0x40 - * */ - u4btmp = rtl_get_rfreg(hw, RF90_PATH_A, 0, BRFREGOFFSETMASK); - while (u4btmp != 0 && delay > 0) { - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x0); - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, BRFREGOFFSETMASK, 0x00); - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40); - u4btmp = rtl_get_rfreg(hw, RF90_PATH_A, 0, BRFREGOFFSETMASK); - delay--; - } - if (delay == 0) { - /* Jump out the LPS turn off sequence to RF_ON_EXCEP */ - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x00); - - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Fail !!! Switch RF timeout\n"); - return; - } - /* e. For PCIE: SYS_FUNC_EN 0x02[7:0] = 0xE2 reset BB TRX function */ - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - /* f. SPS_CTRL 0x11[7:0] = 0x22 */ - if (rtlpriv->rtlhal.macphymode == SINGLEMAC_SINGLEPHY) - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x22); - /* g. SYS_CLKR 0x08[11] = 0 gated MAC clock */ -} - -bool rtl92d_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state) -{ - - bool bresult = true; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u8 i, queue_id; - struct rtl8192_tx_ring *ring = NULL; - - if (rfpwr_state == ppsc->rfpwr_state) - return false; - switch (rfpwr_state) { - case ERFON: - if ((ppsc->rfpwr_state == ERFOFF) && - RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) { - bool rtstatus; - u32 InitializeCount = 0; - do { - InitializeCount++; - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "IPS Set eRf nic enable\n"); - rtstatus = rtl_ps_enable_nic(hw); - } while (!rtstatus && (InitializeCount < 10)); - - RT_CLEAR_PS_LEVEL(ppsc, - RT_RF_OFF_LEVL_HALT_NIC); - } else { - RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, - "awake, sleeped:%d ms state_inap:%x\n", - jiffies_to_msecs(jiffies - - ppsc->last_sleep_jiffies), - rtlpriv->psc.state_inap); - ppsc->last_awake_jiffies = jiffies; - _rtl92d_phy_set_rfon(hw); - } - - if (mac->link_state == MAC80211_LINKED) - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_LINK); - else - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_NO_LINK); - break; - case ERFOFF: - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "IPS Set eRf nic disable\n"); - rtl_ps_disable_nic(hw); - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - } else { - if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_NO_LINK); - else - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_POWER_OFF); - } - break; - case ERFSLEEP: - if (ppsc->rfpwr_state == ERFOFF) - return false; - - for (queue_id = 0, i = 0; - queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { - ring = &pcipriv->dev.tx_ring[queue_id]; - if (skb_queue_len(&ring->queue) == 0 || - queue_id == BEACON_QUEUE) { - queue_id++; - continue; - } else if (rtlpci->pdev->current_state != PCI_D0) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "eRf Off/Sleep: %d times TcbBusyQueue[%d] !=0 but lower power state!\n", - i + 1, queue_id); - break; - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n", - i + 1, queue_id, - skb_queue_len(&ring->queue)); - udelay(10); - i++; - } - - if (i >= MAX_DOZE_WAITING_TIMES_9x) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "ERFOFF: %d times TcbBusyQueue[%d] = %d !\n", - MAX_DOZE_WAITING_TIMES_9x, queue_id, - skb_queue_len(&ring->queue)); - break; - } - } - RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, - "Set rfsleep awaked:%d ms\n", - jiffies_to_msecs(jiffies - ppsc->last_awake_jiffies)); - RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, - "sleep awaked:%d ms state_inap:%x\n", - jiffies_to_msecs(jiffies - - ppsc->last_awake_jiffies), - rtlpriv->psc.state_inap); - ppsc->last_sleep_jiffies = jiffies; - _rtl92d_phy_set_rfsleep(hw); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - bresult = false; - break; - } - if (bresult) - ppsc->rfpwr_state = rfpwr_state; - return bresult; -} - -void rtl92d_phy_config_macphymode(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 offset = REG_MAC_PHY_CTRL_NORMAL; - - switch (rtlhal->macphymode) { - case DUALMAC_DUALPHY: - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "MacPhyMode: DUALMAC_DUALPHY\n"); - rtl_write_byte(rtlpriv, offset, 0xF3); - break; - case SINGLEMAC_SINGLEPHY: - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "MacPhyMode: SINGLEMAC_SINGLEPHY\n"); - rtl_write_byte(rtlpriv, offset, 0xF4); - break; - case DUALMAC_SINGLEPHY: - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "MacPhyMode: DUALMAC_SINGLEPHY\n"); - rtl_write_byte(rtlpriv, offset, 0xF1); - break; - } -} - -void rtl92d_phy_config_macphymode_info(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - switch (rtlhal->macphymode) { - case DUALMAC_SINGLEPHY: - rtlphy->rf_type = RF_2T2R; - rtlhal->version |= RF_TYPE_2T2R; - rtlhal->bandset = BAND_ON_BOTH; - rtlhal->current_bandtype = BAND_ON_2_4G; - break; - - case SINGLEMAC_SINGLEPHY: - rtlphy->rf_type = RF_2T2R; - rtlhal->version |= RF_TYPE_2T2R; - rtlhal->bandset = BAND_ON_BOTH; - rtlhal->current_bandtype = BAND_ON_2_4G; - break; - - case DUALMAC_DUALPHY: - rtlphy->rf_type = RF_1T1R; - rtlhal->version &= RF_TYPE_1T1R; - /* Now we let MAC0 run on 5G band. */ - if (rtlhal->interfaceindex == 0) { - rtlhal->bandset = BAND_ON_5G; - rtlhal->current_bandtype = BAND_ON_5G; - } else { - rtlhal->bandset = BAND_ON_2_4G; - rtlhal->current_bandtype = BAND_ON_2_4G; - } - break; - default: - break; - } -} - -u8 rtl92d_get_chnlgroup_fromarray(u8 chnl) -{ - u8 group; - u8 channel_info[59] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, - 58, 60, 62, 64, 100, 102, 104, 106, 108, - 110, 112, 114, 116, 118, 120, 122, 124, - 126, 128, 130, 132, 134, 136, 138, 140, - 149, 151, 153, 155, 157, 159, 161, 163, - 165 - }; - - if (channel_info[chnl] <= 3) - group = 0; - else if (channel_info[chnl] <= 9) - group = 1; - else if (channel_info[chnl] <= 14) - group = 2; - else if (channel_info[chnl] <= 44) - group = 3; - else if (channel_info[chnl] <= 54) - group = 4; - else if (channel_info[chnl] <= 64) - group = 5; - else if (channel_info[chnl] <= 112) - group = 6; - else if (channel_info[chnl] <= 126) - group = 7; - else if (channel_info[chnl] <= 140) - group = 8; - else if (channel_info[chnl] <= 153) - group = 9; - else if (channel_info[chnl] <= 159) - group = 10; - else - group = 11; - return group; -} - -void rtl92d_phy_set_poweron(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - unsigned long flags; - u8 value8; - u16 i; - u32 mac_reg = (rtlhal->interfaceindex == 0 ? REG_MAC0 : REG_MAC1); - - /* notice fw know band status 0x81[1]/0x53[1] = 0: 5G, 1: 2G */ - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - value8 = rtl_read_byte(rtlpriv, mac_reg); - value8 |= BIT(1); - rtl_write_byte(rtlpriv, mac_reg, value8); - } else { - value8 = rtl_read_byte(rtlpriv, mac_reg); - value8 &= (~BIT(1)); - rtl_write_byte(rtlpriv, mac_reg, value8); - } - - if (rtlhal->macphymode == SINGLEMAC_SINGLEPHY) { - value8 = rtl_read_byte(rtlpriv, REG_MAC0); - rtl_write_byte(rtlpriv, REG_MAC0, value8 | MAC0_ON); - } else { - spin_lock_irqsave(&globalmutex_power, flags); - if (rtlhal->interfaceindex == 0) { - value8 = rtl_read_byte(rtlpriv, REG_MAC0); - rtl_write_byte(rtlpriv, REG_MAC0, value8 | MAC0_ON); - } else { - value8 = rtl_read_byte(rtlpriv, REG_MAC1); - rtl_write_byte(rtlpriv, REG_MAC1, value8 | MAC1_ON); - } - value8 = rtl_read_byte(rtlpriv, REG_POWER_OFF_IN_PROCESS); - spin_unlock_irqrestore(&globalmutex_power, flags); - for (i = 0; i < 200; i++) { - if ((value8 & BIT(7)) == 0) { - break; - } else { - udelay(500); - spin_lock_irqsave(&globalmutex_power, flags); - value8 = rtl_read_byte(rtlpriv, - REG_POWER_OFF_IN_PROCESS); - spin_unlock_irqrestore(&globalmutex_power, - flags); - } - } - if (i == 200) - RT_ASSERT(false, "Another mac power off over time\n"); - } -} - -void rtl92d_phy_config_maccoexist_rfpage(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - switch (rtlpriv->rtlhal.macphymode) { - case DUALMAC_DUALPHY: - rtl_write_byte(rtlpriv, REG_DMC, 0x0); - rtl_write_byte(rtlpriv, REG_RX_PKT_LIMIT, 0x08); - rtl_write_word(rtlpriv, REG_TRXFF_BNDY + 2, 0x13ff); - break; - case DUALMAC_SINGLEPHY: - rtl_write_byte(rtlpriv, REG_DMC, 0xf8); - rtl_write_byte(rtlpriv, REG_RX_PKT_LIMIT, 0x08); - rtl_write_word(rtlpriv, REG_TRXFF_BNDY + 2, 0x13ff); - break; - case SINGLEMAC_SINGLEPHY: - rtl_write_byte(rtlpriv, REG_DMC, 0x0); - rtl_write_byte(rtlpriv, REG_RX_PKT_LIMIT, 0x10); - rtl_write_word(rtlpriv, (REG_TRXFF_BNDY + 2), 0x27FF); - break; - default: - break; - } -} - -void rtl92d_update_bbrf_configuration(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 rfpath, i; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "==>\n"); - /* r_select_5G for path_A/B 0 for 2.4G, 1 for 5G */ - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - /* r_select_5G for path_A/B,0x878 */ - rtl_set_bbreg(hw, RFPGA0_XAB_RFPARAMETER, BIT(0), 0x0); - rtl_set_bbreg(hw, RFPGA0_XAB_RFPARAMETER, BIT(15), 0x0); - if (rtlhal->macphymode != DUALMAC_DUALPHY) { - rtl_set_bbreg(hw, RFPGA0_XAB_RFPARAMETER, BIT(16), 0x0); - rtl_set_bbreg(hw, RFPGA0_XAB_RFPARAMETER, BIT(31), 0x0); - } - /* rssi_table_select:index 0 for 2.4G.1~3 for 5G,0xc78 */ - rtl_set_bbreg(hw, ROFDM0_AGCRSSITABLE, BIT(6) | BIT(7), 0x0); - /* fc_area 0xd2c */ - rtl_set_bbreg(hw, ROFDM1_CFOTRACKING, BIT(14) | BIT(13), 0x0); - /* 5G LAN ON */ - rtl_set_bbreg(hw, 0xB30, 0x00F00000, 0xa); - /* TX BB gain shift*1,Just for testchip,0xc80,0xc88 */ - rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, BMASKDWORD, - 0x40000100); - rtl_set_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, BMASKDWORD, - 0x40000100); - if (rtlhal->macphymode == DUALMAC_DUALPHY) { - rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW, - BIT(10) | BIT(6) | BIT(5), - ((rtlefuse->eeprom_c9 & BIT(3)) >> 3) | - (rtlefuse->eeprom_c9 & BIT(1)) | - ((rtlefuse->eeprom_cc & BIT(1)) << 4)); - rtl_set_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, - BIT(10) | BIT(6) | BIT(5), - ((rtlefuse->eeprom_c9 & BIT(2)) >> 2) | - ((rtlefuse->eeprom_c9 & BIT(0)) << 1) | - ((rtlefuse->eeprom_cc & BIT(0)) << 5)); - rtl_set_bbreg(hw, RFPGA0_XAB_RFPARAMETER, BIT(15), 0); - } else { - rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW, - BIT(26) | BIT(22) | BIT(21) | BIT(10) | - BIT(6) | BIT(5), - ((rtlefuse->eeprom_c9 & BIT(3)) >> 3) | - (rtlefuse->eeprom_c9 & BIT(1)) | - ((rtlefuse->eeprom_cc & BIT(1)) << 4) | - ((rtlefuse->eeprom_c9 & BIT(7)) << 9) | - ((rtlefuse->eeprom_c9 & BIT(5)) << 12) | - ((rtlefuse->eeprom_cc & BIT(3)) << 18)); - rtl_set_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, - BIT(10) | BIT(6) | BIT(5), - ((rtlefuse->eeprom_c9 & BIT(2)) >> 2) | - ((rtlefuse->eeprom_c9 & BIT(0)) << 1) | - ((rtlefuse->eeprom_cc & BIT(0)) << 5)); - rtl_set_bbreg(hw, RFPGA0_XB_RFINTERFACEOE, - BIT(10) | BIT(6) | BIT(5), - ((rtlefuse->eeprom_c9 & BIT(6)) >> 6) | - ((rtlefuse->eeprom_c9 & BIT(4)) >> 3) | - ((rtlefuse->eeprom_cc & BIT(2)) << 3)); - rtl_set_bbreg(hw, RFPGA0_XAB_RFPARAMETER, - BIT(31) | BIT(15), 0); - } - /* 1.5V_LDO */ - } else { - /* r_select_5G for path_A/B */ - rtl_set_bbreg(hw, RFPGA0_XAB_RFPARAMETER, BIT(0), 0x1); - rtl_set_bbreg(hw, RFPGA0_XAB_RFPARAMETER, BIT(15), 0x1); - if (rtlhal->macphymode != DUALMAC_DUALPHY) { - rtl_set_bbreg(hw, RFPGA0_XAB_RFPARAMETER, BIT(16), 0x1); - rtl_set_bbreg(hw, RFPGA0_XAB_RFPARAMETER, BIT(31), 0x1); - } - /* rssi_table_select:index 0 for 2.4G.1~3 for 5G */ - rtl_set_bbreg(hw, ROFDM0_AGCRSSITABLE, BIT(6) | BIT(7), 0x1); - /* fc_area */ - rtl_set_bbreg(hw, ROFDM1_CFOTRACKING, BIT(14) | BIT(13), 0x1); - /* 5G LAN ON */ - rtl_set_bbreg(hw, 0xB30, 0x00F00000, 0x0); - /* TX BB gain shift,Just for testchip,0xc80,0xc88 */ - if (rtlefuse->internal_pa_5g[0]) - rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, BMASKDWORD, - 0x2d4000b5); - else - rtl_set_bbreg(hw, ROFDM0_XATxIQIMBALANCE, BMASKDWORD, - 0x20000080); - if (rtlefuse->internal_pa_5g[1]) - rtl_set_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, BMASKDWORD, - 0x2d4000b5); - else - rtl_set_bbreg(hw, ROFDM0_XBTxIQIMBALANCE, BMASKDWORD, - 0x20000080); - if (rtlhal->macphymode == DUALMAC_DUALPHY) { - rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW, - BIT(10) | BIT(6) | BIT(5), - (rtlefuse->eeprom_cc & BIT(5))); - rtl_set_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, BIT(10), - ((rtlefuse->eeprom_cc & BIT(4)) >> 4)); - rtl_set_bbreg(hw, RFPGA0_XAB_RFPARAMETER, BIT(15), - (rtlefuse->eeprom_cc & BIT(4)) >> 4); - } else { - rtl_set_bbreg(hw, RFPGA0_XAB_RFINTERFACESW, - BIT(26) | BIT(22) | BIT(21) | BIT(10) | - BIT(6) | BIT(5), - (rtlefuse->eeprom_cc & BIT(5)) | - ((rtlefuse->eeprom_cc & BIT(7)) << 14)); - rtl_set_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, BIT(10), - ((rtlefuse->eeprom_cc & BIT(4)) >> 4)); - rtl_set_bbreg(hw, RFPGA0_XB_RFINTERFACEOE, BIT(10), - ((rtlefuse->eeprom_cc & BIT(6)) >> 6)); - rtl_set_bbreg(hw, RFPGA0_XAB_RFPARAMETER, - BIT(31) | BIT(15), - ((rtlefuse->eeprom_cc & BIT(4)) >> 4) | - ((rtlefuse->eeprom_cc & BIT(6)) << 10)); - } - } - /* update IQK related settings */ - rtl_set_bbreg(hw, ROFDM0_XARXIQIMBALANCE, BMASKDWORD, 0x40000100); - rtl_set_bbreg(hw, ROFDM0_XBRXIQIMBALANCE, BMASKDWORD, 0x40000100); - rtl_set_bbreg(hw, ROFDM0_XCTxAFE, 0xF0000000, 0x00); - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(30) | BIT(28) | - BIT(26) | BIT(24), 0x00); - rtl_set_bbreg(hw, ROFDM0_XDTxAFE, 0xF0000000, 0x00); - rtl_set_bbreg(hw, 0xca0, 0xF0000000, 0x00); - rtl_set_bbreg(hw, ROFDM0_AGCRSSITABLE, 0x0000F000, 0x00); - - /* Update RF */ - for (rfpath = RF90_PATH_A; rfpath < rtlphy->num_total_rfpath; - rfpath++) { - if (rtlhal->current_bandtype == BAND_ON_2_4G) { - /* MOD_AG for RF paht_A 0x18 BIT8,BIT16 */ - rtl_set_rfreg(hw, rfpath, RF_CHNLBW, BIT(8) | BIT(16) | - BIT(18), 0); - /* RF0x0b[16:14] =3b'111 */ - rtl_set_rfreg(hw, (enum radio_path)rfpath, 0x0B, - 0x1c000, 0x07); - } else { - /* MOD_AG for RF paht_A 0x18 BIT8,BIT16 */ - rtl_set_rfreg(hw, rfpath, RF_CHNLBW, BIT(8) | - BIT(16) | BIT(18), - (BIT(16) | BIT(8)) >> 8); - } - } - /* Update for all band. */ - /* DMDP */ - if (rtlphy->rf_type == RF_1T1R) { - /* Use antenna 0,0xc04,0xd04 */ - rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, BMASKBYTE0, 0x11); - rtl_set_bbreg(hw, ROFDM1_TRXPATHENABLE, BDWORD, 0x1); - - /* enable ad/da clock1 for dual-phy reg0x888 */ - if (rtlhal->interfaceindex == 0) { - rtl_set_bbreg(hw, RFPGA0_ADDALLOCKEN, BIT(12) | - BIT(13), 0x3); - } else { - rtl92d_phy_enable_anotherphy(hw, false); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "MAC1 use DBI to update 0x888\n"); - /* 0x888 */ - rtl92de_write_dword_dbi(hw, RFPGA0_ADDALLOCKEN, - rtl92de_read_dword_dbi(hw, - RFPGA0_ADDALLOCKEN, - BIT(3)) | BIT(12) | BIT(13), - BIT(3)); - rtl92d_phy_powerdown_anotherphy(hw, false); - } - } else { - /* Single PHY */ - /* Use antenna 0 & 1,0xc04,0xd04 */ - rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, BMASKBYTE0, 0x33); - rtl_set_bbreg(hw, ROFDM1_TRXPATHENABLE, BDWORD, 0x3); - /* disable ad/da clock1,0x888 */ - rtl_set_bbreg(hw, RFPGA0_ADDALLOCKEN, BIT(12) | BIT(13), 0); - } - for (rfpath = RF90_PATH_A; rfpath < rtlphy->num_total_rfpath; - rfpath++) { - rtlphy->rfreg_chnlval[rfpath] = rtl_get_rfreg(hw, rfpath, - RF_CHNLBW, BRFREGOFFSETMASK); - rtlphy->reg_rf3c[rfpath] = rtl_get_rfreg(hw, rfpath, 0x3C, - BRFREGOFFSETMASK); - } - for (i = 0; i < 2; i++) - RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "RF 0x18 = 0x%x\n", - rtlphy->rfreg_chnlval[i]); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "<==\n"); - -} - -bool rtl92d_phy_check_poweroff(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 u1btmp; - unsigned long flags; - - if (rtlhal->macphymode == SINGLEMAC_SINGLEPHY) { - u1btmp = rtl_read_byte(rtlpriv, REG_MAC0); - rtl_write_byte(rtlpriv, REG_MAC0, u1btmp & (~MAC0_ON)); - return true; - } - spin_lock_irqsave(&globalmutex_power, flags); - if (rtlhal->interfaceindex == 0) { - u1btmp = rtl_read_byte(rtlpriv, REG_MAC0); - rtl_write_byte(rtlpriv, REG_MAC0, u1btmp & (~MAC0_ON)); - u1btmp = rtl_read_byte(rtlpriv, REG_MAC1); - u1btmp &= MAC1_ON; - } else { - u1btmp = rtl_read_byte(rtlpriv, REG_MAC1); - rtl_write_byte(rtlpriv, REG_MAC1, u1btmp & (~MAC1_ON)); - u1btmp = rtl_read_byte(rtlpriv, REG_MAC0); - u1btmp &= MAC0_ON; - } - if (u1btmp) { - spin_unlock_irqrestore(&globalmutex_power, flags); - return false; - } - u1btmp = rtl_read_byte(rtlpriv, REG_POWER_OFF_IN_PROCESS); - u1btmp |= BIT(7); - rtl_write_byte(rtlpriv, REG_POWER_OFF_IN_PROCESS, u1btmp); - spin_unlock_irqrestore(&globalmutex_power, flags); - return true; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.h b/drivers/net/wireless/rtlwifi/rtl8192de/phy.h deleted file mode 100644 index f074952bf25c..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.h +++ /dev/null @@ -1,178 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92D_PHY_H__ -#define __RTL92D_PHY_H__ - -#define MAX_PRECMD_CNT 16 -#define MAX_RFDEPENDCMD_CNT 16 -#define MAX_POSTCMD_CNT 16 - -#define MAX_DOZE_WAITING_TIMES_9x 64 - -#define RT_CANNOT_IO(hw) false -#define HIGHPOWER_RADIOA_ARRAYLEN 22 - -#define IQK_ADDA_REG_NUM 16 -#define MAX_TOLERANCE 5 -#define IQK_DELAY_TIME 1 - -#define APK_BB_REG_NUM 5 -#define APK_AFE_REG_NUM 16 -#define APK_CURVE_REG_NUM 4 -#define PATH_NUM 2 - -#define LOOP_LIMIT 5 -#define MAX_STALL_TIME 50 -#define ANTENNA_DIVERSITY_VALUE 0x80 -#define MAX_TXPWR_IDX_NMODE_92S 63 -#define RESET_CNT_LIMIT 3 - -#define IQK_ADDA_REG_NUM 16 -#define IQK_BB_REG_NUM 10 -#define IQK_BB_REG_NUM_test 6 -#define IQK_MAC_REG_NUM 4 -#define RX_INDEX_MAPPING_NUM 15 - -#define IQK_DELAY_TIME 1 - -#define CT_OFFSET_MAC_ADDR 0X16 - -#define CT_OFFSET_CCK_TX_PWR_IDX 0x5A -#define CT_OFFSET_HT401S_TX_PWR_IDX 0x60 -#define CT_OFFSET_HT402S_TX_PWR_IDX_DIFF 0x66 -#define CT_OFFSET_HT20_TX_PWR_IDX_DIFF 0x69 -#define CT_OFFSET_OFDM_TX_PWR_IDX_DIFF 0x6C - -#define CT_OFFSET_HT40_MAX_PWR_OFFSET 0x6F -#define CT_OFFSET_HT20_MAX_PWR_OFFSET 0x72 - -#define CT_OFFSET_CHANNEL_PLAH 0x75 -#define CT_OFFSET_THERMAL_METER 0x78 -#define CT_OFFSET_RF_OPTION 0x79 -#define CT_OFFSET_VERSION 0x7E -#define CT_OFFSET_CUSTOMER_ID 0x7F - -enum swchnlcmd_id { - CMDID_END, - CMDID_SET_TXPOWEROWER_LEVEL, - CMDID_BBREGWRITE10, - CMDID_WRITEPORT_ULONG, - CMDID_WRITEPORT_USHORT, - CMDID_WRITEPORT_UCHAR, - CMDID_RF_WRITEREG, -}; - -struct swchnlcmd { - enum swchnlcmd_id cmdid; - u32 para1; - u32 para2; - u32 msdelay; -}; - -enum baseband_config_type { - BASEBAND_CONFIG_PHY_REG = 0, - BASEBAND_CONFIG_AGC_TAB = 1, -}; - -enum rf_content { - radioa_txt = 0, - radiob_txt = 1, - radioc_txt = 2, - radiod_txt = 3 -}; - -static inline void rtl92d_acquire_cckandrw_pagea_ctl(struct ieee80211_hw *hw, - unsigned long *flag) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->rtlhal.interfaceindex == 1) - spin_lock_irqsave(&rtlpriv->locks.cck_and_rw_pagea_lock, *flag); -} - -static inline void rtl92d_release_cckandrw_pagea_ctl(struct ieee80211_hw *hw, - unsigned long *flag) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->rtlhal.interfaceindex == 1) - spin_unlock_irqrestore(&rtlpriv->locks.cck_and_rw_pagea_lock, - *flag); -} - -extern u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask); -extern void rtl92d_phy_set_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, u32 data); -extern u32 rtl92d_phy_query_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, - u32 bitmask); -extern void rtl92d_phy_set_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, - u32 bitmask, u32 data); -extern bool rtl92d_phy_mac_config(struct ieee80211_hw *hw); -extern bool rtl92d_phy_bb_config(struct ieee80211_hw *hw); -extern bool rtl92d_phy_rf_config(struct ieee80211_hw *hw); -extern bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, - enum radio_path rfpath); -extern void rtl92d_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); -extern void rtl92d_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); -extern void rtl92d_phy_scan_operation_backup(struct ieee80211_hw *hw, - u8 operation); -extern void rtl92d_phy_set_bw_mode(struct ieee80211_hw *hw, - enum nl80211_channel_type ch_type); -extern u8 rtl92d_phy_sw_chnl(struct ieee80211_hw *hw); -bool rtl92d_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, - enum rf_content content, - enum radio_path rfpath); -bool rtl92d_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); -extern bool rtl92d_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state); - -void rtl92d_phy_config_macphymode(struct ieee80211_hw *hw); -void rtl92d_phy_config_macphymode_info(struct ieee80211_hw *hw); -u8 rtl92d_get_chnlgroup_fromarray(u8 chnl); -void rtl92d_phy_set_poweron(struct ieee80211_hw *hw); -void rtl92d_phy_config_maccoexist_rfpage(struct ieee80211_hw *hw); -bool rtl92d_phy_check_poweroff(struct ieee80211_hw *hw); -void rtl92d_phy_lc_calibrate(struct ieee80211_hw *hw); -void rtl92d_update_bbrf_configuration(struct ieee80211_hw *hw); -void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); -void rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw); -void rtl92d_phy_reset_iqk_result(struct ieee80211_hw *hw); -void rtl92d_release_cckandrw_pagea_ctl(struct ieee80211_hw *hw, - unsigned long *flag); -void rtl92d_acquire_cckandrw_pagea_ctl(struct ieee80211_hw *hw, - unsigned long *flag); -u8 rtl92d_get_rightchnlplace_for_iqk(u8 chnl); -void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel); -void rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/reg.h b/drivers/net/wireless/rtlwifi/rtl8192de/reg.h deleted file mode 100644 index b7498c5bafc5..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/reg.h +++ /dev/null @@ -1,1312 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92D_REG_H__ -#define __RTL92D_REG_H__ - -/* ----------------------------------------------------- */ -/* 0x0000h ~ 0x00FFh System Configuration */ -/* ----------------------------------------------------- */ -#define REG_SYS_ISO_CTRL 0x0000 -#define REG_SYS_FUNC_EN 0x0002 -#define REG_APS_FSMCO 0x0004 -#define REG_SYS_CLKR 0x0008 -#define REG_9346CR 0x000A -#define REG_EE_VPD 0x000C -#define REG_AFE_MISC 0x0010 -#define REG_SPS0_CTRL 0x0011 -#define REG_POWER_OFF_IN_PROCESS 0x0017 -#define REG_SPS_OCP_CFG 0x0018 -#define REG_RSV_CTRL 0x001C -#define REG_RF_CTRL 0x001F -#define REG_LDOA15_CTRL 0x0020 -#define REG_LDOV12D_CTRL 0x0021 -#define REG_LDOHCI12_CTRL 0x0022 -#define REG_LPLDO_CTRL 0x0023 -#define REG_AFE_XTAL_CTRL 0x0024 -#define REG_AFE_PLL_CTRL 0x0028 -/* for 92d, DMDP,SMSP,DMSP contrl */ -#define REG_MAC_PHY_CTRL 0x002c -#define REG_EFUSE_CTRL 0x0030 -#define REG_EFUSE_TEST 0x0034 -#define REG_PWR_DATA 0x0038 -#define REG_CAL_TIMER 0x003C -#define REG_ACLK_MON 0x003E -#define REG_GPIO_MUXCFG 0x0040 -#define REG_GPIO_IO_SEL 0x0042 -#define REG_MAC_PINMUX_CFG 0x0043 -#define REG_GPIO_PIN_CTRL 0x0044 -#define REG_GPIO_INTM 0x0048 -#define REG_LEDCFG0 0x004C -#define REG_LEDCFG1 0x004D -#define REG_LEDCFG2 0x004E -#define REG_LEDCFG3 0x004F -#define REG_FSIMR 0x0050 -#define REG_FSISR 0x0054 - -#define REG_MCUFWDL 0x0080 - -#define REG_HMEBOX_EXT_0 0x0088 -#define REG_HMEBOX_EXT_1 0x008A -#define REG_HMEBOX_EXT_2 0x008C -#define REG_HMEBOX_EXT_3 0x008E - -#define REG_BIST_SCAN 0x00D0 -#define REG_BIST_RPT 0x00D4 -#define REG_BIST_ROM_RPT 0x00D8 -#define REG_USB_SIE_INTF 0x00E0 -#define REG_PCIE_MIO_INTF 0x00E4 -#define REG_PCIE_MIO_INTD 0x00E8 -#define REG_HPON_FSM 0x00EC -#define REG_SYS_CFG 0x00F0 -#define REG_MAC_PHY_CTRL_NORMAL 0x00f8 - -#define REG_MAC0 0x0081 -#define REG_MAC1 0x0053 -#define FW_MAC0_READY 0x18 -#define FW_MAC1_READY 0x1A -#define MAC0_ON BIT(7) -#define MAC1_ON BIT(0) -#define MAC0_READY BIT(0) -#define MAC1_READY BIT(0) - -/* ----------------------------------------------------- */ -/* 0x0100h ~ 0x01FFh MACTOP General Configuration */ -/* ----------------------------------------------------- */ -#define REG_CR 0x0100 -#define REG_PBP 0x0104 -#define REG_TRXDMA_CTRL 0x010C -#define REG_TRXFF_BNDY 0x0114 -#define REG_TRXFF_STATUS 0x0118 -#define REG_RXFF_PTR 0x011C -#define REG_HIMR 0x0120 -#define REG_HISR 0x0124 -#define REG_HIMRE 0x0128 -#define REG_HISRE 0x012C -#define REG_CPWM 0x012F -#define REG_FWIMR 0x0130 -#define REG_FWISR 0x0134 -#define REG_PKTBUF_DBG_CTRL 0x0140 -#define REG_PKTBUF_DBG_DATA_L 0x0144 -#define REG_PKTBUF_DBG_DATA_H 0x0148 - -#define REG_TC0_CTRL 0x0150 -#define REG_TC1_CTRL 0x0154 -#define REG_TC2_CTRL 0x0158 -#define REG_TC3_CTRL 0x015C -#define REG_TC4_CTRL 0x0160 -#define REG_TCUNIT_BASE 0x0164 -#define REG_MBIST_START 0x0174 -#define REG_MBIST_DONE 0x0178 -#define REG_MBIST_FAIL 0x017C -#define REG_C2HEVT_MSG_NORMAL 0x01A0 -#define REG_C2HEVT_MSG_TEST 0x01B8 -#define REG_C2HEVT_CLEAR 0x01BF -#define REG_MCUTST_1 0x01c0 -#define REG_FMETHR 0x01C8 -#define REG_HMETFR 0x01CC -#define REG_HMEBOX_0 0x01D0 -#define REG_HMEBOX_1 0x01D4 -#define REG_HMEBOX_2 0x01D8 -#define REG_HMEBOX_3 0x01DC - -#define REG_LLT_INIT 0x01E0 -#define REG_BB_ACCEESS_CTRL 0x01E8 -#define REG_BB_ACCESS_DATA 0x01EC - - -/* ----------------------------------------------------- */ -/* 0x0200h ~ 0x027Fh TXDMA Configuration */ -/* ----------------------------------------------------- */ -#define REG_RQPN 0x0200 -#define REG_FIFOPAGE 0x0204 -#define REG_TDECTRL 0x0208 -#define REG_TXDMA_OFFSET_CHK 0x020C -#define REG_TXDMA_STATUS 0x0210 -#define REG_RQPN_NPQ 0x0214 - -/* ----------------------------------------------------- */ -/* 0x0280h ~ 0x02FFh RXDMA Configuration */ -/* ----------------------------------------------------- */ -#define REG_RXDMA_AGG_PG_TH 0x0280 -#define REG_RXPKT_NUM 0x0284 -#define REG_RXDMA_STATUS 0x0288 - -/* ----------------------------------------------------- */ -/* 0x0300h ~ 0x03FFh PCIe */ -/* ----------------------------------------------------- */ -#define REG_PCIE_CTRL_REG 0x0300 -#define REG_INT_MIG 0x0304 -#define REG_BCNQ_DESA 0x0308 -#define REG_HQ_DESA 0x0310 -#define REG_MGQ_DESA 0x0318 -#define REG_VOQ_DESA 0x0320 -#define REG_VIQ_DESA 0x0328 -#define REG_BEQ_DESA 0x0330 -#define REG_BKQ_DESA 0x0338 -#define REG_RX_DESA 0x0340 -#define REG_DBI 0x0348 -#define REG_DBI_WDATA 0x0348 -#define REG_DBI_RDATA 0x034C -#define REG_DBI_CTRL 0x0350 -#define REG_DBI_FLAG 0x0352 -#define REG_MDIO 0x0354 -#define REG_DBG_SEL 0x0360 -#define REG_PCIE_HRPWM 0x0361 -#define REG_PCIE_HCPWM 0x0363 -#define REG_UART_CTRL 0x0364 -#define REG_UART_TX_DESA 0x0370 -#define REG_UART_RX_DESA 0x0378 - -/* ----------------------------------------------------- */ -/* 0x0400h ~ 0x047Fh Protocol Configuration */ -/* ----------------------------------------------------- */ -#define REG_VOQ_INFORMATION 0x0400 -#define REG_VIQ_INFORMATION 0x0404 -#define REG_BEQ_INFORMATION 0x0408 -#define REG_BKQ_INFORMATION 0x040C -#define REG_MGQ_INFORMATION 0x0410 -#define REG_HGQ_INFORMATION 0x0414 -#define REG_BCNQ_INFORMATION 0x0418 - - -#define REG_CPU_MGQ_INFORMATION 0x041C -#define REG_FWHW_TXQ_CTRL 0x0420 -#define REG_HWSEQ_CTRL 0x0423 -#define REG_TXPKTBUF_BCNQ_BDNY 0x0424 -#define REG_TXPKTBUF_MGQ_BDNY 0x0425 -#define REG_MULTI_BCNQ_EN 0x0426 -#define REG_MULTI_BCNQ_OFFSET 0x0427 -#define REG_SPEC_SIFS 0x0428 -#define REG_RL 0x042A -#define REG_DARFRC 0x0430 -#define REG_RARFRC 0x0438 -#define REG_RRSR 0x0440 -#define REG_ARFR0 0x0444 -#define REG_ARFR1 0x0448 -#define REG_ARFR2 0x044C -#define REG_ARFR3 0x0450 -#define REG_AGGLEN_LMT 0x0458 -#define REG_AMPDU_MIN_SPACE 0x045C -#define REG_TXPKTBUF_WMAC_LBK_BF_HD 0x045D -#define REG_FAST_EDCA_CTRL 0x0460 -#define REG_RD_RESP_PKT_TH 0x0463 -#define REG_INIRTS_RATE_SEL 0x0480 -#define REG_INIDATA_RATE_SEL 0x0484 -#define REG_POWER_STATUS 0x04A4 -#define REG_POWER_STAGE1 0x04B4 -#define REG_POWER_STAGE2 0x04B8 -#define REG_PKT_LIFE_TIME 0x04C0 -#define REG_STBC_SETTING 0x04C4 -#define REG_PROT_MODE_CTRL 0x04C8 -#define REG_MAX_AGGR_NUM 0x04CA -#define REG_RTS_MAX_AGGR_NUM 0x04CB -#define REG_BAR_MODE_CTRL 0x04CC -#define REG_RA_TRY_RATE_AGG_LMT 0x04CF -#define REG_EARLY_MODE_CONTROL 0x4D0 -#define REG_NQOS_SEQ 0x04DC -#define REG_QOS_SEQ 0x04DE -#define REG_NEED_CPU_HANDLE 0x04E0 -#define REG_PKT_LOSE_RPT 0x04E1 -#define REG_PTCL_ERR_STATUS 0x04E2 -#define REG_DUMMY 0x04FC - -/* ----------------------------------------------------- */ -/* 0x0500h ~ 0x05FFh EDCA Configuration */ -/* ----------------------------------------------------- */ -#define REG_EDCA_VO_PARAM 0x0500 -#define REG_EDCA_VI_PARAM 0x0504 -#define REG_EDCA_BE_PARAM 0x0508 -#define REG_EDCA_BK_PARAM 0x050C -#define REG_BCNTCFG 0x0510 -#define REG_PIFS 0x0512 -#define REG_RDG_PIFS 0x0513 -#define REG_SIFS_CTX 0x0514 -#define REG_SIFS_TRX 0x0516 -#define REG_AGGR_BREAK_TIME 0x051A -#define REG_SLOT 0x051B -#define REG_TX_PTCL_CTRL 0x0520 -#define REG_TXPAUSE 0x0522 -#define REG_DIS_TXREQ_CLR 0x0523 -#define REG_RD_CTRL 0x0524 -#define REG_TBTT_PROHIBIT 0x0540 -#define REG_RD_NAV_NXT 0x0544 -#define REG_NAV_PROT_LEN 0x0546 -#define REG_BCN_CTRL 0x0550 -#define REG_USTIME_TSF 0x0551 -#define REG_MBID_NUM 0x0552 -#define REG_DUAL_TSF_RST 0x0553 -#define REG_BCN_INTERVAL 0x0554 -#define REG_MBSSID_BCN_SPACE 0x0554 -#define REG_DRVERLYINT 0x0558 -#define REG_BCNDMATIM 0x0559 -#define REG_ATIMWND 0x055A -#define REG_BCN_MAX_ERR 0x055D -#define REG_RXTSF_OFFSET_CCK 0x055E -#define REG_RXTSF_OFFSET_OFDM 0x055F -#define REG_TSFTR 0x0560 -#define REG_INIT_TSFTR 0x0564 -#define REG_PSTIMER 0x0580 -#define REG_TIMER0 0x0584 -#define REG_TIMER1 0x0588 -#define REG_ACMHWCTRL 0x05C0 -#define REG_ACMRSTCTRL 0x05C1 -#define REG_ACMAVG 0x05C2 -#define REG_VO_ADMTIME 0x05C4 -#define REG_VI_ADMTIME 0x05C6 -#define REG_BE_ADMTIME 0x05C8 -#define REG_EDCA_RANDOM_GEN 0x05CC -#define REG_SCH_TXCMD 0x05D0 - -/* Dual MAC Co-Existence Register */ -#define REG_DMC 0x05F0 - -/* ----------------------------------------------------- */ -/* 0x0600h ~ 0x07FFh WMAC Configuration */ -/* ----------------------------------------------------- */ -#define REG_APSD_CTRL 0x0600 -#define REG_BWOPMODE 0x0603 -#define REG_TCR 0x0604 -#define REG_RCR 0x0608 -#define REG_RX_PKT_LIMIT 0x060C -#define REG_RX_DLK_TIME 0x060D -#define REG_RX_DRVINFO_SZ 0x060F - -#define REG_MACID 0x0610 -#define REG_BSSID 0x0618 -#define REG_MAR 0x0620 -#define REG_MBIDCAMCFG 0x0628 - -#define REG_USTIME_EDCA 0x0638 -#define REG_MAC_SPEC_SIFS 0x063A -#define REG_RESP_SIFS_CCK 0x063C -#define REG_RESP_SIFS_OFDM 0x063E -#define REG_ACKTO 0x0640 -#define REG_CTS2TO 0x0641 -#define REG_EIFS 0x0642 - - -/* WMA, BA, CCX */ -#define REG_NAV_CTRL 0x0650 -#define REG_BACAMCMD 0x0654 -#define REG_BACAMCONTENT 0x0658 -#define REG_LBDLY 0x0660 -#define REG_FWDLY 0x0661 -#define REG_RXERR_RPT 0x0664 -#define REG_WMAC_TRXPTCL_CTL 0x0668 - - -/* Security */ -#define REG_CAMCMD 0x0670 -#define REG_CAMWRITE 0x0674 -#define REG_CAMREAD 0x0678 -#define REG_CAMDBG 0x067C -#define REG_SECCFG 0x0680 - -/* Power */ -#define REG_WOW_CTRL 0x0690 -#define REG_PSSTATUS 0x0691 -#define REG_PS_RX_INFO 0x0692 -#define REG_LPNAV_CTRL 0x0694 -#define REG_WKFMCAM_CMD 0x0698 -#define REG_WKFMCAM_RWD 0x069C -#define REG_RXFLTMAP0 0x06A0 -#define REG_RXFLTMAP1 0x06A2 -#define REG_RXFLTMAP2 0x06A4 -#define REG_BCN_PSR_RPT 0x06A8 -#define REG_CALB32K_CTRL 0x06AC -#define REG_PKT_MON_CTRL 0x06B4 -#define REG_BT_COEX_TABLE 0x06C0 -#define REG_WMAC_RESP_TXINFO 0x06D8 - - -/* ----------------------------------------------------- */ -/* Redifine 8192C register definition for compatibility */ -/* ----------------------------------------------------- */ -#define CR9346 REG_9346CR -#define MSR (REG_CR + 2) -#define ISR REG_HISR -#define TSFR REG_TSFTR - -#define MACIDR0 REG_MACID -#define MACIDR4 (REG_MACID + 4) - -#define PBP REG_PBP - -#define IDR0 MACIDR0 -#define IDR4 MACIDR4 - -/* ----------------------------------------------------- */ -/* 8192C (MSR) Media Status Register(Offset 0x4C, 8 bits)*/ -/* ----------------------------------------------------- */ -#define MSR_NOLINK 0x00 -#define MSR_ADHOC 0x01 -#define MSR_INFRA 0x02 -#define MSR_AP 0x03 - -/* 6. Adaptive Control Registers (Offset: 0x0160 - 0x01CF) */ -/* ----------------------------------------------------- */ -/* 8192C Response Rate Set Register(offset 0x181, 24bits)*/ -/* ----------------------------------------------------- */ -#define RRSR_RSC_OFFSET 21 -#define RRSR_SHORT_OFFSET 23 -#define RRSR_RSC_BW_40M 0x600000 -#define RRSR_RSC_UPSUBCHNL 0x400000 -#define RRSR_RSC_LOWSUBCHNL 0x200000 -#define RRSR_SHORT 0x800000 -#define RRSR_1M BIT0 -#define RRSR_2M BIT1 -#define RRSR_5_5M BIT2 -#define RRSR_11M BIT3 -#define RRSR_6M BIT4 -#define RRSR_9M BIT5 -#define RRSR_12M BIT6 -#define RRSR_18M BIT7 -#define RRSR_24M BIT8 -#define RRSR_36M BIT9 -#define RRSR_48M BIT10 -#define RRSR_54M BIT11 -#define RRSR_MCS0 BIT12 -#define RRSR_MCS1 BIT13 -#define RRSR_MCS2 BIT14 -#define RRSR_MCS3 BIT15 -#define RRSR_MCS4 BIT16 -#define RRSR_MCS5 BIT17 -#define RRSR_MCS6 BIT18 -#define RRSR_MCS7 BIT19 -#define BRSR_ACKSHORTPMB BIT23 - -/* ----------------------------------------------------- */ -/* 8192C Rate Definition */ -/* ----------------------------------------------------- */ -/* CCK */ -#define RATR_1M 0x00000001 -#define RATR_2M 0x00000002 -#define RATR_55M 0x00000004 -#define RATR_11M 0x00000008 -/* OFDM */ -#define RATR_6M 0x00000010 -#define RATR_9M 0x00000020 -#define RATR_12M 0x00000040 -#define RATR_18M 0x00000080 -#define RATR_24M 0x00000100 -#define RATR_36M 0x00000200 -#define RATR_48M 0x00000400 -#define RATR_54M 0x00000800 -/* MCS 1 Spatial Stream */ -#define RATR_MCS0 0x00001000 -#define RATR_MCS1 0x00002000 -#define RATR_MCS2 0x00004000 -#define RATR_MCS3 0x00008000 -#define RATR_MCS4 0x00010000 -#define RATR_MCS5 0x00020000 -#define RATR_MCS6 0x00040000 -#define RATR_MCS7 0x00080000 -/* MCS 2 Spatial Stream */ -#define RATR_MCS8 0x00100000 -#define RATR_MCS9 0x00200000 -#define RATR_MCS10 0x00400000 -#define RATR_MCS11 0x00800000 -#define RATR_MCS12 0x01000000 -#define RATR_MCS13 0x02000000 -#define RATR_MCS14 0x04000000 -#define RATR_MCS15 0x08000000 - -/* CCK */ -#define RATE_1M BIT(0) -#define RATE_2M BIT(1) -#define RATE_5_5M BIT(2) -#define RATE_11M BIT(3) -/* OFDM */ -#define RATE_6M BIT(4) -#define RATE_9M BIT(5) -#define RATE_12M BIT(6) -#define RATE_18M BIT(7) -#define RATE_24M BIT(8) -#define RATE_36M BIT(9) -#define RATE_48M BIT(10) -#define RATE_54M BIT(11) -/* MCS 1 Spatial Stream */ -#define RATE_MCS0 BIT(12) -#define RATE_MCS1 BIT(13) -#define RATE_MCS2 BIT(14) -#define RATE_MCS3 BIT(15) -#define RATE_MCS4 BIT(16) -#define RATE_MCS5 BIT(17) -#define RATE_MCS6 BIT(18) -#define RATE_MCS7 BIT(19) -/* MCS 2 Spatial Stream */ -#define RATE_MCS8 BIT(20) -#define RATE_MCS9 BIT(21) -#define RATE_MCS10 BIT(22) -#define RATE_MCS11 BIT(23) -#define RATE_MCS12 BIT(24) -#define RATE_MCS13 BIT(25) -#define RATE_MCS14 BIT(26) -#define RATE_MCS15 BIT(27) - -/* ALL CCK Rate */ -#define RATE_ALL_CCK (RATR_1M | RATR_2M | RATR_55M | \ - RATR_11M) -#define RATE_ALL_OFDM_AG (RATR_6M | RATR_9M | RATR_12M | \ - RATR_18M | RATR_24M | \ - RATR_36M | RATR_48M | RATR_54M) -#define RATE_ALL_OFDM_1SS (RATR_MCS0 | RATR_MCS1 | RATR_MCS2 | \ - RATR_MCS3 | RATR_MCS4 | RATR_MCS5 | \ - RATR_MCS6 | RATR_MCS7) -#define RATE_ALL_OFDM_2SS (RATR_MCS8 | RATR_MCS9 | RATR_MCS10 | \ - RATR_MCS11 | RATR_MCS12 | RATR_MCS13 | \ - RATR_MCS14 | RATR_MCS15) - -/* ----------------------------------------------------- */ -/* 8192C BW_OPMODE bits (Offset 0x203, 8bit) */ -/* ----------------------------------------------------- */ -#define BW_OPMODE_20MHZ BIT(2) -#define BW_OPMODE_5G BIT(1) -#define BW_OPMODE_11J BIT(0) - - -/* ----------------------------------------------------- */ -/* 8192C CAM Config Setting (offset 0x250, 1 byte) */ -/* ----------------------------------------------------- */ -#define CAM_VALID BIT(15) -#define CAM_NOTVALID 0x0000 -#define CAM_USEDK BIT(5) - -#define CAM_NONE 0x0 -#define CAM_WEP40 0x01 -#define CAM_TKIP 0x02 -#define CAM_AES 0x04 -#define CAM_WEP104 0x05 -#define CAM_SMS4 0x6 - - -#define TOTAL_CAM_ENTRY 32 -#define HALF_CAM_ENTRY 16 - -#define CAM_WRITE BIT(16) -#define CAM_READ 0x00000000 -#define CAM_POLLINIG BIT(31) - -/* 10. Power Save Control Registers (Offset: 0x0260 - 0x02DF) */ -#define WOW_PMEN BIT0 /* Power management Enable. */ -#define WOW_WOMEN BIT1 /* WoW function on or off. */ -#define WOW_MAGIC BIT2 /* Magic packet */ -#define WOW_UWF BIT3 /* Unicast Wakeup frame. */ - -/* 12. Host Interrupt Status Registers (Offset: 0x0300 - 0x030F) */ -/* ----------------------------------------------------- */ -/* 8190 IMR/ISR bits (offset 0xfd, 8bits) */ -/* ----------------------------------------------------- */ -#define IMR8190_DISABLED 0x0 -#define IMR_BCNDMAINT6 BIT(31) -#define IMR_BCNDMAINT5 BIT(30) -#define IMR_BCNDMAINT4 BIT(29) -#define IMR_BCNDMAINT3 BIT(28) -#define IMR_BCNDMAINT2 BIT(27) -#define IMR_BCNDMAINT1 BIT(26) -#define IMR_BCNDOK8 BIT(25) -#define IMR_BCNDOK7 BIT(24) -#define IMR_BCNDOK6 BIT(23) -#define IMR_BCNDOK5 BIT(22) -#define IMR_BCNDOK4 BIT(21) -#define IMR_BCNDOK3 BIT(20) -#define IMR_BCNDOK2 BIT(19) -#define IMR_BCNDOK1 BIT(18) -#define IMR_TIMEOUT2 BIT(17) -#define IMR_TIMEOUT1 BIT(16) -#define IMR_TXFOVW BIT(15) -#define IMR_PSTIMEOUT BIT(14) -#define IMR_BCNINT BIT(13) -#define IMR_RXFOVW BIT(12) -#define IMR_RDU BIT(11) -#define IMR_ATIMEND BIT(10) -#define IMR_BDOK BIT(9) -#define IMR_HIGHDOK BIT(8) -#define IMR_TBDOK BIT(7) -#define IMR_MGNTDOK BIT(6) -#define IMR_TBDER BIT(5) -#define IMR_BKDOK BIT(4) -#define IMR_BEDOK BIT(3) -#define IMR_VIDOK BIT(2) -#define IMR_VODOK BIT(1) -#define IMR_ROK BIT(0) - -#define IMR_TXERR BIT(11) -#define IMR_RXERR BIT(10) -#define IMR_C2HCMD BIT(9) -#define IMR_CPWM BIT(8) -#define IMR_OCPINT BIT(1) -#define IMR_WLANOFF BIT(0) - -/* ----------------------------------------------------- */ -/* 8192C EFUSE */ -/* ----------------------------------------------------- */ -#define HWSET_MAX_SIZE 256 -#define EFUSE_MAX_SECTION 32 -#define EFUSE_REAL_CONTENT_LEN 512 - -/* ----------------------------------------------------- */ -/* 8192C EEPROM/EFUSE share register definition. */ -/* ----------------------------------------------------- */ -#define EEPROM_DEFAULT_TSSI 0x0 -#define EEPROM_DEFAULT_CRYSTALCAP 0x0 -#define EEPROM_DEFAULT_THERMALMETER 0x12 - -#define EEPROM_DEFAULT_TXPOWERLEVEL_2G 0x2C -#define EEPROM_DEFAULT_TXPOWERLEVEL_5G 0x22 - -#define EEPROM_DEFAULT_HT40_2SDIFF 0x0 -/* HT20<->40 default Tx Power Index Difference */ -#define EEPROM_DEFAULT_HT20_DIFF 2 -/* OFDM Tx Power index diff */ -#define EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF 0x4 -#define EEPROM_DEFAULT_HT40_PWRMAXOFFSET 0 -#define EEPROM_DEFAULT_HT20_PWRMAXOFFSET 0 - -#define EEPROM_CHANNEL_PLAN_FCC 0x0 -#define EEPROM_CHANNEL_PLAN_IC 0x1 -#define EEPROM_CHANNEL_PLAN_ETSI 0x2 -#define EEPROM_CHANNEL_PLAN_SPAIN 0x3 -#define EEPROM_CHANNEL_PLAN_FRANCE 0x4 -#define EEPROM_CHANNEL_PLAN_MKK 0x5 -#define EEPROM_CHANNEL_PLAN_MKK1 0x6 -#define EEPROM_CHANNEL_PLAN_ISRAEL 0x7 -#define EEPROM_CHANNEL_PLAN_TELEC 0x8 -#define EEPROM_CHANNEL_PLAN_GLOBAL_DOMAIN 0x9 -#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_13 0xA -#define EEPROM_CHANNEL_PLAN_NCC 0xB -#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80 - -#define EEPROM_CID_DEFAULT 0x0 -#define EEPROM_CID_TOSHIBA 0x4 -#define EEPROM_CID_CCX 0x10 -#define EEPROM_CID_QMI 0x0D -#define EEPROM_CID_WHQL 0xFE - - -#define RTL8192_EEPROM_ID 0x8129 -#define EEPROM_WAPI_SUPPORT 0x78 - - -#define RTL8190_EEPROM_ID 0x8129 /* 0-1 */ -#define EEPROM_HPON 0x02 /* LDO settings.2-5 */ -#define EEPROM_CLK 0x06 /* Clock settings.6-7 */ -#define EEPROM_MAC_FUNCTION 0x08 /* SE Test mode.8 */ - -#define EEPROM_VID 0x28 /* SE Vendor ID.A-B */ -#define EEPROM_DID 0x2A /* SE Device ID. C-D */ -#define EEPROM_SVID 0x2C /* SE Vendor ID.E-F */ -#define EEPROM_SMID 0x2E /* SE PCI Subsystem ID. 10-11 */ - -#define EEPROM_MAC_ADDR 0x16 /* SEMAC Address. 12-17 */ -#define EEPROM_MAC_ADDR_MAC0_92D 0x55 -#define EEPROM_MAC_ADDR_MAC1_92D 0x5B - -/* 2.4G band Tx power index setting */ -#define EEPROM_CCK_TX_PWR_INX_2G 0x61 -#define EEPROM_HT40_1S_TX_PWR_INX_2G 0x67 -#define EEPROM_HT40_2S_TX_PWR_INX_DIFF_2G 0x6D -#define EEPROM_HT20_TX_PWR_INX_DIFF_2G 0x70 -#define EEPROM_OFDM_TX_PWR_INX_DIFF_2G 0x73 -#define EEPROM_HT40_MAX_PWR_OFFSET_2G 0x76 -#define EEPROM_HT20_MAX_PWR_OFFSET_2G 0x79 - -/*5GL channel 32-64 */ -#define EEPROM_HT40_1S_TX_PWR_INX_5GL 0x7C -#define EEPROM_HT40_2S_TX_PWR_INX_DIFF_5GL 0x82 -#define EEPROM_HT20_TX_PWR_INX_DIFF_5GL 0x85 -#define EEPROM_OFDM_TX_PWR_INX_DIFF_5GL 0x88 -#define EEPROM_HT40_MAX_PWR_OFFSET_5GL 0x8B -#define EEPROM_HT20_MAX_PWR_OFFSET_5GL 0x8E - -/* 5GM channel 100-140 */ -#define EEPROM_HT40_1S_TX_PWR_INX_5GM 0x91 -#define EEPROM_HT40_2S_TX_PWR_INX_DIFF_5GM 0x97 -#define EEPROM_HT20_TX_PWR_INX_DIFF_5GM 0x9A -#define EEPROM_OFDM_TX_PWR_INX_DIFF_5GM 0x9D -#define EEPROM_HT40_MAX_PWR_OFFSET_5GM 0xA0 -#define EEPROM_HT20_MAX_PWR_OFFSET_5GM 0xA3 - -/* 5GH channel 149-165 */ -#define EEPROM_HT40_1S_TX_PWR_INX_5GH 0xA6 -#define EEPROM_HT40_2S_TX_PWR_INX_DIFF_5GH 0xAC -#define EEPROM_HT20_TX_PWR_INX_DIFF_5GH 0xAF -#define EEPROM_OFDM_TX_PWR_INX_DIFF_5GH 0xB2 -#define EEPROM_HT40_MAX_PWR_OFFSET_5GH 0xB5 -#define EEPROM_HT20_MAX_PWR_OFFSET_5GH 0xB8 - -/* Map of supported channels. */ -#define EEPROM_CHANNEL_PLAN 0xBB -#define EEPROM_IQK_DELTA 0xBC -#define EEPROM_LCK_DELTA 0xBC -#define EEPROM_XTAL_K 0xBD /* [7:5] */ -#define EEPROM_TSSI_A_5G 0xBE -#define EEPROM_TSSI_B_5G 0xBF -#define EEPROM_TSSI_AB_5G 0xC0 -#define EEPROM_THERMAL_METER 0xC3 /* [4:0] */ -#define EEPROM_RF_OPT1 0xC4 -#define EEPROM_RF_OPT2 0xC5 -#define EEPROM_RF_OPT3 0xC6 -#define EEPROM_RF_OPT4 0xC7 -#define EEPROM_RF_OPT5 0xC8 -#define EEPROM_RF_OPT6 0xC9 -#define EEPROM_VERSION 0xCA -#define EEPROM_CUSTOMER_ID 0xCB -#define EEPROM_RF_OPT7 0xCC - -#define EEPROM_DEF_PART_NO 0x3FD /* Byte */ -#define EEPROME_CHIP_VERSION_L 0x3FF -#define EEPROME_CHIP_VERSION_H 0x3FE - -/* - * Current IOREG MAP - * 0x0000h ~ 0x00FFh System Configuration (256 Bytes) - * 0x0100h ~ 0x01FFh MACTOP General Configuration (256 Bytes) - * 0x0200h ~ 0x027Fh TXDMA Configuration (128 Bytes) - * 0x0280h ~ 0x02FFh RXDMA Configuration (128 Bytes) - * 0x0300h ~ 0x03FFh PCIE EMAC Reserved Region (256 Bytes) - * 0x0400h ~ 0x04FFh Protocol Configuration (256 Bytes) - * 0x0500h ~ 0x05FFh EDCA Configuration (256 Bytes) - * 0x0600h ~ 0x07FFh WMAC Configuration (512 Bytes) - * 0x2000h ~ 0x3FFFh 8051 FW Download Region (8196 Bytes) - */ - -/* ----------------------------------------------------- */ -/* 8192C (RCR) (Offset 0x608, 32 bits) */ -/* ----------------------------------------------------- */ -#define RCR_APPFCS BIT(31) -#define RCR_APP_MIC BIT(30) -#define RCR_APP_ICV BIT(29) -#define RCR_APP_PHYST_RXFF BIT(28) -#define RCR_APP_BA_SSN BIT(27) -#define RCR_ENMBID BIT(24) -#define RCR_LSIGEN BIT(23) -#define RCR_MFBEN BIT(22) -#define RCR_HTC_LOC_CTRL BIT(14) -#define RCR_AMF BIT(13) -#define RCR_ACF BIT(12) -#define RCR_ADF BIT(11) -#define RCR_AICV BIT(9) -#define RCR_ACRC32 BIT(8) -#define RCR_CBSSID_BCN BIT(7) -#define RCR_CBSSID_DATA BIT(6) -#define RCR_APWRMGT BIT(5) -#define RCR_ADD3 BIT(4) -#define RCR_AB BIT(3) -#define RCR_AM BIT(2) -#define RCR_APM BIT(1) -#define RCR_AAP BIT(0) -#define RCR_MXDMA_OFFSET 8 -#define RCR_FIFO_OFFSET 13 - -/* ----------------------------------------------------- */ -/* 8192C Regsiter Bit and Content definition */ -/* ----------------------------------------------------- */ -/* ----------------------------------------------------- */ -/* 0x0000h ~ 0x00FFh System Configuration */ -/* ----------------------------------------------------- */ - -/* SPS0_CTRL */ -#define SW18_FPWM BIT(3) - - -/* SYS_ISO_CTRL */ -#define ISO_MD2PP BIT(0) -#define ISO_UA2USB BIT(1) -#define ISO_UD2CORE BIT(2) -#define ISO_PA2PCIE BIT(3) -#define ISO_PD2CORE BIT(4) -#define ISO_IP2MAC BIT(5) -#define ISO_DIOP BIT(6) -#define ISO_DIOE BIT(7) -#define ISO_EB2CORE BIT(8) -#define ISO_DIOR BIT(9) - -#define PWC_EV25V BIT(14) -#define PWC_EV12V BIT(15) - - -/* SYS_FUNC_EN */ -#define FEN_BBRSTB BIT(0) -#define FEN_BB_GLB_RSTn BIT(1) -#define FEN_USBA BIT(2) -#define FEN_UPLL BIT(3) -#define FEN_USBD BIT(4) -#define FEN_DIO_PCIE BIT(5) -#define FEN_PCIEA BIT(6) -#define FEN_PPLL BIT(7) -#define FEN_PCIED BIT(8) -#define FEN_DIOE BIT(9) -#define FEN_CPUEN BIT(10) -#define FEN_DCORE BIT(11) -#define FEN_ELDR BIT(12) -#define FEN_DIO_RF BIT(13) -#define FEN_HWPDN BIT(14) -#define FEN_MREGEN BIT(15) - -/* APS_FSMCO */ -#define PFM_LDALL BIT(0) -#define PFM_ALDN BIT(1) -#define PFM_LDKP BIT(2) -#define PFM_WOWL BIT(3) -#define EnPDN BIT(4) -#define PDN_PL BIT(5) -#define APFM_ONMAC BIT(8) -#define APFM_OFF BIT(9) -#define APFM_RSM BIT(10) -#define AFSM_HSUS BIT(11) -#define AFSM_PCIE BIT(12) -#define APDM_MAC BIT(13) -#define APDM_HOST BIT(14) -#define APDM_HPDN BIT(15) -#define RDY_MACON BIT(16) -#define SUS_HOST BIT(17) -#define ROP_ALD BIT(20) -#define ROP_PWR BIT(21) -#define ROP_SPS BIT(22) -#define SOP_MRST BIT(25) -#define SOP_FUSE BIT(26) -#define SOP_ABG BIT(27) -#define SOP_AMB BIT(28) -#define SOP_RCK BIT(29) -#define SOP_A8M BIT(30) -#define XOP_BTCK BIT(31) - -/* SYS_CLKR */ -#define ANAD16V_EN BIT(0) -#define ANA8M BIT(1) -#define MACSLP BIT(4) -#define LOADER_CLK_EN BIT(5) -#define _80M_SSC_DIS BIT(7) -#define _80M_SSC_EN_HO BIT(8) -#define PHY_SSC_RSTB BIT(9) -#define SEC_CLK_EN BIT(10) -#define MAC_CLK_EN BIT(11) -#define SYS_CLK_EN BIT(12) -#define RING_CLK_EN BIT(13) - - -/* 9346CR */ -#define BOOT_FROM_EEPROM BIT(4) -#define EEPROM_EN BIT(5) - -/* AFE_MISC */ -#define AFE_BGEN BIT(0) -#define AFE_MBEN BIT(1) -#define MAC_ID_EN BIT(7) - -/* RSV_CTRL */ -#define WLOCK_ALL BIT(0) -#define WLOCK_00 BIT(1) -#define WLOCK_04 BIT(2) -#define WLOCK_08 BIT(3) -#define WLOCK_40 BIT(4) -#define R_DIS_PRST_0 BIT(5) -#define R_DIS_PRST_1 BIT(6) -#define LOCK_ALL_EN BIT(7) - -/* RF_CTRL */ -#define RF_EN BIT(0) -#define RF_RSTB BIT(1) -#define RF_SDMRSTB BIT(2) - - - -/* LDOA15_CTRL */ -#define LDA15_EN BIT(0) -#define LDA15_STBY BIT(1) -#define LDA15_OBUF BIT(2) -#define LDA15_REG_VOS BIT(3) -#define _LDA15_VOADJ(x) (((x) & 0x7) << 4) - - - -/* LDOV12D_CTRL */ -#define LDV12_EN BIT(0) -#define LDV12_SDBY BIT(1) -#define LPLDO_HSM BIT(2) -#define LPLDO_LSM_DIS BIT(3) -#define _LDV12_VADJ(x) (((x) & 0xF) << 4) - - -/* AFE_XTAL_CTRL */ -#define XTAL_EN BIT(0) -#define XTAL_BSEL BIT(1) -#define _XTAL_BOSC(x) (((x) & 0x3) << 2) -#define _XTAL_CADJ(x) (((x) & 0xF) << 4) -#define XTAL_GATE_USB BIT(8) -#define _XTAL_USB_DRV(x) (((x) & 0x3) << 9) -#define XTAL_GATE_AFE BIT(11) -#define _XTAL_AFE_DRV(x) (((x) & 0x3) << 12) -#define XTAL_RF_GATE BIT(14) -#define _XTAL_RF_DRV(x) (((x) & 0x3) << 15) -#define XTAL_GATE_DIG BIT(17) -#define _XTAL_DIG_DRV(x) (((x) & 0x3) << 18) -#define XTAL_BT_GATE BIT(20) -#define _XTAL_BT_DRV(x) (((x) & 0x3) << 21) -#define _XTAL_GPIO(x) (((x) & 0x7) << 23) - - -#define CKDLY_AFE BIT(26) -#define CKDLY_USB BIT(27) -#define CKDLY_DIG BIT(28) -#define CKDLY_BT BIT(29) - - -/* AFE_PLL_CTRL */ -#define APLL_EN BIT(0) -#define APLL_320_EN BIT(1) -#define APLL_FREF_SEL BIT(2) -#define APLL_EDGE_SEL BIT(3) -#define APLL_WDOGB BIT(4) -#define APLL_LPFEN BIT(5) - -#define APLL_REF_CLK_13MHZ 0x1 -#define APLL_REF_CLK_19_2MHZ 0x2 -#define APLL_REF_CLK_20MHZ 0x3 -#define APLL_REF_CLK_25MHZ 0x4 -#define APLL_REF_CLK_26MHZ 0x5 -#define APLL_REF_CLK_38_4MHZ 0x6 -#define APLL_REF_CLK_40MHZ 0x7 - -#define APLL_320EN BIT(14) -#define APLL_80EN BIT(15) -#define APLL_1MEN BIT(24) - - -/* EFUSE_CTRL */ -#define ALD_EN BIT(18) -#define EF_PD BIT(19) -#define EF_FLAG BIT(31) - -/* EFUSE_TEST */ -#define EF_TRPT BIT(7) -#define LDOE25_EN BIT(31) - -/* MCUFWDL */ -#define MCUFWDL_EN BIT(0) -#define MCUFWDL_RDY BIT(1) -#define FWDL_ChkSum_rpt BIT(2) -#define MACINI_RDY BIT(3) -#define BBINI_RDY BIT(4) -#define RFINI_RDY BIT(5) -#define WINTINI_RDY BIT(6) -#define MAC1_WINTINI_RDY BIT(11) -#define CPRST BIT(23) - -/* REG_SYS_CFG */ -#define XCLK_VLD BIT(0) -#define ACLK_VLD BIT(1) -#define UCLK_VLD BIT(2) -#define PCLK_VLD BIT(3) -#define PCIRSTB BIT(4) -#define V15_VLD BIT(5) -#define TRP_B15V_EN BIT(7) -#define SIC_IDLE BIT(8) -#define BD_MAC2 BIT(9) -#define BD_MAC1 BIT(10) -#define IC_MACPHY_MODE BIT(11) -#define PAD_HWPD_IDN BIT(22) -#define TRP_VAUX_EN BIT(23) -#define TRP_BT_EN BIT(24) -#define BD_PKG_SEL BIT(25) -#define BD_HCI_SEL BIT(26) -#define TYPE_ID BIT(27) - -/* LLT_INIT */ -#define _LLT_NO_ACTIVE 0x0 -#define _LLT_WRITE_ACCESS 0x1 -#define _LLT_READ_ACCESS 0x2 - -#define _LLT_INIT_DATA(x) ((x) & 0xFF) -#define _LLT_INIT_ADDR(x) (((x) & 0xFF) << 8) -#define _LLT_OP(x) (((x) & 0x3) << 30) -#define _LLT_OP_VALUE(x) (((x) >> 30) & 0x3) - - -/* ----------------------------------------------------- */ -/* 0x0400h ~ 0x047Fh Protocol Configuration */ -/* ----------------------------------------------------- */ -#define RETRY_LIMIT_SHORT_SHIFT 8 -#define RETRY_LIMIT_LONG_SHIFT 0 - - -/* ----------------------------------------------------- */ -/* 0x0500h ~ 0x05FFh EDCA Configuration */ -/* ----------------------------------------------------- */ -/* EDCA setting */ -#define AC_PARAM_TXOP_LIMIT_OFFSET 16 -#define AC_PARAM_ECW_MAX_OFFSET 12 -#define AC_PARAM_ECW_MIN_OFFSET 8 -#define AC_PARAM_AIFS_OFFSET 0 - -/* ACMHWCTRL */ -#define ACMHW_HWEN BIT(0) -#define ACMHW_BEQEN BIT(1) -#define ACMHW_VIQEN BIT(2) -#define ACMHW_VOQEN BIT(3) - -/* ----------------------------------------------------- */ -/* 0x0600h ~ 0x07FFh WMAC Configuration */ -/* ----------------------------------------------------- */ - -/* TCR */ -#define TSFRST BIT(0) -#define DIS_GCLK BIT(1) -#define PAD_SEL BIT(2) -#define PWR_ST BIT(6) -#define PWRBIT_OW_EN BIT(7) -#define ACRC BIT(8) -#define CFENDFORM BIT(9) -#define ICV BIT(10) - -/* SECCFG */ -#define SCR_TXUSEDK BIT(0) -#define SCR_RXUSEDK BIT(1) -#define SCR_TXENCENABLE BIT(2) -#define SCR_RXENCENABLE BIT(3) -#define SCR_SKBYA2 BIT(4) -#define SCR_NOSKMC BIT(5) -#define SCR_TXBCUSEDK BIT(6) -#define SCR_RXBCUSEDK BIT(7) - -/* General definitions */ -#define LAST_ENTRY_OF_TX_PKT_BUFFER 255 -#define LAST_ENTRY_OF_TX_PKT_BUFFER_DUAL_MAC 127 - -#define POLLING_LLT_THRESHOLD 20 -#define POLLING_READY_TIMEOUT_COUNT 1000 - -/* Min Spacing related settings. */ -#define MAX_MSS_DENSITY_2T 0x13 -#define MAX_MSS_DENSITY_1T 0x0A - - -/* BB-PHY register PMAC 0x100 PHY 0x800 - 0xEFF */ -/* 1. PMAC duplicate register due to connection: */ -/* RF_Mode, TRxRN, NumOf L-STF */ -/* 2. 0x800/0x900/0xA00/0xC00/0xD00/0xE00 */ -/* 3. RF register 0x00-2E */ -/* 4. Bit Mask for BB/RF register */ -/* 5. Other defintion for BB/RF R/W */ - -/* 3. Page8(0x800) */ -#define RFPGA0_RFMOD 0x800 - -#define RFPGA0_TXINFO 0x804 -#define RFPGA0_PSDFUNCTION 0x808 - -#define RFPGA0_TXGAINSTAGE 0x80c - -#define RFPGA0_RFTIMING1 0x810 -#define RFPGA0_RFTIMING2 0x814 - -#define RFPGA0_XA_HSSIPARAMETER1 0x820 -#define RFPGA0_XA_HSSIPARAMETER2 0x824 -#define RFPGA0_XB_HSSIPARAMETER1 0x828 -#define RFPGA0_XB_HSSIPARAMETER2 0x82c - -#define RFPGA0_XA_LSSIPARAMETER 0x840 -#define RFPGA0_XB_LSSIPARAMETER 0x844 - -#define RFPGA0_RFWAkEUPPARAMETER 0x850 -#define RFPGA0_RFSLEEPUPPARAMETER 0x854 - -#define RFPGA0_XAB_SWITCHCONTROL 0x858 -#define RFPGA0_XCD_SWITCHCONTROL 0x85c - -#define RFPGA0_XA_RFINTERFACEOE 0x860 -#define RFPGA0_XB_RFINTERFACEOE 0x864 - -#define RFPGA0_XAB_RFINTERFACESW 0x870 -#define RFPGA0_XCD_RFINTERFACESW 0x874 - -#define RFPGA0_XAB_RFPARAMETER 0x878 -#define RFPGA0_XCD_RFPARAMETER 0x87c - -#define RFPGA0_ANALOGPARAMETER1 0x880 -#define RFPGA0_ANALOGPARAMETER2 0x884 -#define RFPGA0_ANALOGPARAMETER3 0x888 -#define RFPGA0_ADDALLOCKEN 0x888 -#define RFPGA0_ANALOGPARAMETER4 0x88c - -#define RFPGA0_XA_LSSIREADBACK 0x8a0 -#define RFPGA0_XB_LSSIREADBACK 0x8a4 -#define RFPGA0_XC_LSSIREADBACK 0x8a8 -#define RFPGA0_XD_LSSIREADBACK 0x8ac - -#define RFPGA0_PSDREPORT 0x8b4 -#define TRANSCEIVERA_HSPI_READBACK 0x8b8 -#define TRANSCEIVERB_HSPI_READBACK 0x8bc -#define RFPGA0_XAB_RFINTERFACERB 0x8e0 -#define RFPGA0_XCD_RFINTERFACERB 0x8e4 - -/* 4. Page9(0x900) */ -#define RFPGA1_RFMOD 0x900 - -#define RFPGA1_TXBLOCK 0x904 -#define RFPGA1_DEBUGSELECT 0x908 -#define RFPGA1_TXINFO 0x90c - -/* 5. PageA(0xA00) */ -#define RCCK0_SYSTEM 0xa00 - -#define RCCK0_AFESSTTING 0xa04 -#define RCCK0_CCA 0xa08 - -#define RCCK0_RXAGC1 0xa0c -#define RCCK0_RXAGC2 0xa10 - -#define RCCK0_RXHP 0xa14 - -#define RCCK0_DSPPARAMETER1 0xa18 -#define RCCK0_DSPPARAMETER2 0xa1c - -#define RCCK0_TXFILTER1 0xa20 -#define RCCK0_TXFILTER2 0xa24 -#define RCCK0_DEBUGPORT 0xa28 -#define RCCK0_FALSEALARMREPORT 0xa2c -#define RCCK0_TRSSIREPORT 0xa50 -#define RCCK0_RXREPORT 0xa54 -#define RCCK0_FACOUNTERLOWER 0xa5c -#define RCCK0_FACOUNTERUPPER 0xa58 - -/* 6. PageC(0xC00) */ -#define ROFDM0_LSTF 0xc00 - -#define ROFDM0_TRXPATHENABLE 0xc04 -#define ROFDM0_TRMUXPAR 0xc08 -#define ROFDM0_TRSWISOLATION 0xc0c - -#define ROFDM0_XARXAFE 0xc10 -#define ROFDM0_XARXIQIMBALANCE 0xc14 -#define ROFDM0_XBRXAFE 0xc18 -#define ROFDM0_XBRXIQIMBALANCE 0xc1c -#define ROFDM0_XCRXAFE 0xc20 -#define ROFDM0_XCRXIQIMBALANCE 0xc24 -#define ROFDM0_XDRXAFE 0xc28 -#define ROFDM0_XDRXIQIMBALANCE 0xc2c - -#define ROFDM0_RXDETECTOR1 0xc30 -#define ROFDM0_RXDETECTOR2 0xc34 -#define ROFDM0_RXDETECTOR3 0xc38 -#define ROFDM0_RXDETECTOR4 0xc3c - -#define ROFDM0_RXDSP 0xc40 -#define ROFDM0_CFOANDDAGC 0xc44 -#define ROFDM0_CCADROPTHRESHOLD 0xc48 -#define ROFDM0_ECCATHRESHOLD 0xc4c - -#define ROFDM0_XAAGCCORE1 0xc50 -#define ROFDM0_XAAGCCORE2 0xc54 -#define ROFDM0_XBAGCCORE1 0xc58 -#define ROFDM0_XBAGCCORE2 0xc5c -#define ROFDM0_XCAGCCORE1 0xc60 -#define ROFDM0_XCAGCCORE2 0xc64 -#define ROFDM0_XDAGCCORE1 0xc68 -#define ROFDM0_XDAGCCORE2 0xc6c - -#define ROFDM0_AGCPARAMETER1 0xc70 -#define ROFDM0_AGCPARAMETER2 0xc74 -#define ROFDM0_AGCRSSITABLE 0xc78 -#define ROFDM0_HTSTFAGC 0xc7c - -#define ROFDM0_XATxIQIMBALANCE 0xc80 -#define ROFDM0_XATxAFE 0xc84 -#define ROFDM0_XBTxIQIMBALANCE 0xc88 -#define ROFDM0_XBTxAFE 0xc8c -#define ROFDM0_XCTxIQIMBALANCE 0xc90 -#define ROFDM0_XCTxAFE 0xc94 -#define ROFDM0_XDTxIQIMBALANCE 0xc98 -#define ROFDM0_XDTxAFE 0xc9c - -#define ROFDM0_RXHPPARAMETER 0xce0 -#define ROFDM0_TXPSEUDONOISEWGT 0xce4 -#define ROFDM0_FRAMESYNC 0xcf0 -#define ROFDM0_DFSREPORT 0xcf4 -#define ROFDM0_TXCOEFF1 0xca4 -#define ROFDM0_TXCOEFF2 0xca8 -#define ROFDM0_TXCOEFF3 0xcac -#define ROFDM0_TXCOEFF4 0xcb0 -#define ROFDM0_TXCOEFF5 0xcb4 -#define ROFDM0_TXCOEFF6 0xcb8 - -/* 7. PageD(0xD00) */ -#define ROFDM1_LSTF 0xd00 -#define ROFDM1_TRXPATHENABLE 0xd04 - -#define ROFDM1_CFO 0xd08 -#define ROFDM1_CSI1 0xd10 -#define ROFDM1_SBD 0xd14 -#define ROFDM1_CSI2 0xd18 -#define ROFDM1_CFOTRACKING 0xd2c -#define ROFDM1_TRXMESAURE1 0xd34 -#define ROFDM1_INTFDET 0xd3c -#define ROFDM1_PSEUDONOISESTATEAB 0xd50 -#define ROFDM1_PSEUDONOISESTATECD 0xd54 -#define ROFDM1_RXPSEUDONOISEWGT 0xd58 - -#define ROFDM_PHYCOUNTER1 0xda0 -#define ROFDM_PHYCOUNTER2 0xda4 -#define ROFDM_PHYCOUNTER3 0xda8 - -#define ROFDM_SHORTCFOAB 0xdac -#define ROFDM_SHORTCFOCD 0xdb0 -#define ROFDM_LONGCFOAB 0xdb4 -#define ROFDM_LONGCFOCD 0xdb8 -#define ROFDM_TAILCFOAB 0xdbc -#define ROFDM_TAILCFOCD 0xdc0 -#define ROFDM_PWMEASURE1 0xdc4 -#define ROFDM_PWMEASURE2 0xdc8 -#define ROFDM_BWREPORT 0xdcc -#define ROFDM_AGCREPORT 0xdd0 -#define ROFDM_RXSNR 0xdd4 -#define ROFDM_RXEVMCSI 0xdd8 -#define ROFDM_SIGReport 0xddc - -/* 8. PageE(0xE00) */ -#define RTXAGC_A_RATE18_06 0xe00 -#define RTXAGC_A_RATE54_24 0xe04 -#define RTXAGC_A_CCK1_MCS32 0xe08 -#define RTXAGC_A_MCS03_MCS00 0xe10 -#define RTXAGC_A_MCS07_MCS04 0xe14 -#define RTXAGC_A_MCS11_MCS08 0xe18 -#define RTXAGC_A_MCS15_MCS12 0xe1c - -#define RTXAGC_B_RATE18_06 0x830 -#define RTXAGC_B_RATE54_24 0x834 -#define RTXAGC_B_CCK1_55_MCS32 0x838 -#define RTXAGC_B_MCS03_MCS00 0x83c -#define RTXAGC_B_MCS07_MCS04 0x848 -#define RTXAGC_B_MCS11_MCS08 0x84c -#define RTXAGC_B_MCS15_MCS12 0x868 -#define RTXAGC_B_CCK11_A_CCK2_11 0x86c - -/* RL6052 Register definition */ -#define RF_AC 0x00 - -#define RF_IQADJ_G1 0x01 -#define RF_IQADJ_G2 0x02 -#define RF_POW_TRSW 0x05 - -#define RF_GAIN_RX 0x06 -#define RF_GAIN_TX 0x07 - -#define RF_TXM_IDAC 0x08 -#define RF_BS_IQGEN 0x0F - -#define RF_MODE1 0x10 -#define RF_MODE2 0x11 - -#define RF_RX_AGC_HP 0x12 -#define RF_TX_AGC 0x13 -#define RF_BIAS 0x14 -#define RF_IPA 0x15 -#define RF_POW_ABILITY 0x17 -#define RF_MODE_AG 0x18 -#define rRfChannel 0x18 -#define RF_CHNLBW 0x18 -#define RF_TOP 0x19 - -#define RF_RX_G1 0x1A -#define RF_RX_G2 0x1B - -#define RF_RX_BB2 0x1C -#define RF_RX_BB1 0x1D - -#define RF_RCK1 0x1E -#define RF_RCK2 0x1F - -#define RF_TX_G1 0x20 -#define RF_TX_G2 0x21 -#define RF_TX_G3 0x22 - -#define RF_TX_BB1 0x23 - -#define RF_T_METER 0x42 - -#define RF_SYN_G1 0x25 -#define RF_SYN_G2 0x26 -#define RF_SYN_G3 0x27 -#define RF_SYN_G4 0x28 -#define RF_SYN_G5 0x29 -#define RF_SYN_G6 0x2A -#define RF_SYN_G7 0x2B -#define RF_SYN_G8 0x2C - -#define RF_RCK_OS 0x30 - -#define RF_TXPA_G1 0x31 -#define RF_TXPA_G2 0x32 -#define RF_TXPA_G3 0x33 - -/* Bit Mask */ - -/* 2. Page8(0x800) */ -#define BRFMOD 0x1 -#define BCCKTXSC 0x30 -#define BCCKEN 0x1000000 -#define BOFDMEN 0x2000000 - -#define B3WIREDATALENGTH 0x800 -#define B3WIREADDRESSLENGTH 0x400 - -#define BRFSI_RFENV 0x10 - -#define BLSSIREADADDRESS 0x7f800000 -#define BLSSIREADEDGE 0x80000000 -#define BLSSIREADBACKDATA 0xfffff -/* 4. PageA(0xA00) */ -#define BCCKSIDEBAND 0x10 - -/* Other Definition */ -#define BBYTE0 0x1 -#define BBYTE1 0x2 -#define BBYTE2 0x4 -#define BBYTE3 0x8 -#define BWORD0 0x3 -#define BWORD1 0xc -#define BDWORD 0xf - -#define BMASKBYTE0 0xff -#define BMASKBYTE1 0xff00 -#define BMASKBYTE2 0xff0000 -#define BMASKBYTE3 0xff000000 -#define BMASKHWORD 0xffff0000 -#define BMASKLWORD 0x0000ffff -#define BMASKDWORD 0xffffffff -#define BMASK12BITS 0xfff -#define BMASKH4BITS 0xf0000000 -#define BMASKOFDM_D 0xffc00000 -#define BMASKCCK 0x3f3f3f3f - -#define BRFREGOFFSETMASK 0xfffff - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/rf.c b/drivers/net/wireless/rtlwifi/rtl8192de/rf.c deleted file mode 100644 index 20144e0b4142..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/rf.c +++ /dev/null @@ -1,623 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" -#include "hw.h" - -void rtl92d_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u8 rfpath; - - switch (bandwidth) { - case HT_CHANNEL_WIDTH_20: - for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) { - rtlphy->rfreg_chnlval[rfpath] = ((rtlphy->rfreg_chnlval - [rfpath] & 0xfffff3ff) | 0x0400); - rtl_set_rfreg(hw, rfpath, RF_CHNLBW, BIT(10) | - BIT(11), 0x01); - - RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, - "20M RF 0x18 = 0x%x\n", - rtlphy->rfreg_chnlval[rfpath]); - } - - break; - case HT_CHANNEL_WIDTH_20_40: - for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) { - rtlphy->rfreg_chnlval[rfpath] = - ((rtlphy->rfreg_chnlval[rfpath] & 0xfffff3ff)); - rtl_set_rfreg(hw, rfpath, RF_CHNLBW, BIT(10) | BIT(11), - 0x00); - RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, - "40M RF 0x18 = 0x%x\n", - rtlphy->rfreg_chnlval[rfpath]); - } - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", bandwidth); - break; - } -} - -void rtl92d_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u32 tx_agc[2] = {0, 0}, tmpval; - bool turbo_scanoff = false; - u8 idx1, idx2; - u8 *ptr; - - if (rtlefuse->eeprom_regulatory != 0) - turbo_scanoff = true; - if (mac->act_scanning) { - tx_agc[RF90_PATH_A] = 0x3f3f3f3f; - tx_agc[RF90_PATH_B] = 0x3f3f3f3f; - if (turbo_scanoff) { - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - tx_agc[idx1] = ppowerlevel[idx1] | - (ppowerlevel[idx1] << 8) | - (ppowerlevel[idx1] << 16) | - (ppowerlevel[idx1] << 24); - } - } - } else { - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - tx_agc[idx1] = ppowerlevel[idx1] | - (ppowerlevel[idx1] << 8) | - (ppowerlevel[idx1] << 16) | - (ppowerlevel[idx1] << 24); - } - if (rtlefuse->eeprom_regulatory == 0) { - tmpval = (rtlphy->mcs_offset[0][6]) + - (rtlphy->mcs_offset[0][7] << 8); - tx_agc[RF90_PATH_A] += tmpval; - tmpval = (rtlphy->mcs_offset[0][14]) + - (rtlphy->mcs_offset[0][15] << 24); - tx_agc[RF90_PATH_B] += tmpval; - } - } - - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - ptr = (u8 *) (&(tx_agc[idx1])); - for (idx2 = 0; idx2 < 4; idx2++) { - if (*ptr > RF6052_MAX_TX_PWR) - *ptr = RF6052_MAX_TX_PWR; - ptr++; - } - } - - tmpval = tx_agc[RF90_PATH_A] & 0xff; - rtl_set_bbreg(hw, RTXAGC_A_CCK1_MCS32, BMASKBYTE1, tmpval); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n", - tmpval, RTXAGC_A_CCK1_MCS32); - tmpval = tx_agc[RF90_PATH_A] >> 8; - rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n", - tmpval, RTXAGC_B_CCK11_A_CCK2_11); - tmpval = tx_agc[RF90_PATH_B] >> 24; - rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, BMASKBYTE0, tmpval); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n", - tmpval, RTXAGC_B_CCK11_A_CCK2_11); - tmpval = tx_agc[RF90_PATH_B] & 0x00ffffff; - rtl_set_bbreg(hw, RTXAGC_B_CCK1_55_MCS32, 0xffffff00, tmpval); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n", - tmpval, RTXAGC_B_CCK1_55_MCS32); -} - -static void _rtl92d_phy_get_power_base(struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel, - u32 *ofdmbase, u32 *mcsbase) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u32 powerbase0, powerbase1; - u8 legacy_pwrdiff, ht20_pwrdiff; - u8 i, powerlevel[2]; - - for (i = 0; i < 2; i++) { - powerlevel[i] = ppowerlevel[i]; - legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff[i][channel - 1]; - powerbase0 = powerlevel[i] + legacy_pwrdiff; - powerbase0 = (powerbase0 << 24) | (powerbase0 << 16) | - (powerbase0 << 8) | powerbase0; - *(ofdmbase + i) = powerbase0; - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - " [OFDM power base index rf(%c) = 0x%x]\n", - i == 0 ? 'A' : 'B', *(ofdmbase + i)); - } - - for (i = 0; i < 2; i++) { - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) { - ht20_pwrdiff = rtlefuse->txpwr_ht20diff[i][channel - 1]; - powerlevel[i] += ht20_pwrdiff; - } - powerbase1 = powerlevel[i]; - powerbase1 = (powerbase1 << 24) | (powerbase1 << 16) | - (powerbase1 << 8) | powerbase1; - *(mcsbase + i) = powerbase1; - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - " [MCS power base index rf(%c) = 0x%x]\n", - i == 0 ? 'A' : 'B', *(mcsbase + i)); - } -} - -static u8 _rtl92d_phy_get_chnlgroup_bypg(u8 chnlindex) -{ - u8 group; - u8 channel_info[59] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, - 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, - 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, - 134, 136, 138, 140, 149, 151, 153, 155, 157, 159, - 161, 163, 165 - }; - - if (channel_info[chnlindex] <= 3) /* Chanel 1-3 */ - group = 0; - else if (channel_info[chnlindex] <= 9) /* Channel 4-9 */ - group = 1; - else if (channel_info[chnlindex] <= 14) /* Channel 10-14 */ - group = 2; - else if (channel_info[chnlindex] <= 64) - group = 6; - else if (channel_info[chnlindex] <= 140) - group = 7; - else - group = 8; - return group; -} - -static void _rtl92d_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw, - u8 channel, u8 index, - u32 *powerbase0, - u32 *powerbase1, - u32 *p_outwriteval) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 i, chnlgroup = 0, pwr_diff_limit[4]; - u32 writeval = 0, customer_limit, rf; - - for (rf = 0; rf < 2; rf++) { - switch (rtlefuse->eeprom_regulatory) { - case 0: - chnlgroup = 0; - writeval = rtlphy->mcs_offset - [chnlgroup][index + - (rf ? 8 : 0)] + ((index < 2) ? - powerbase0[rf] : - powerbase1[rf]); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "RTK better performance, writeval(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', writeval); - break; - case 1: - if (rtlphy->pwrgroup_cnt == 1) - chnlgroup = 0; - if (rtlphy->pwrgroup_cnt >= MAX_PG_GROUP) { - chnlgroup = _rtl92d_phy_get_chnlgroup_bypg( - channel - 1); - if (rtlphy->current_chan_bw == - HT_CHANNEL_WIDTH_20) - chnlgroup++; - else - chnlgroup += 4; - writeval = rtlphy->mcs_offset - [chnlgroup][index + - (rf ? 8 : 0)] + ((index < 2) ? - powerbase0[rf] : - powerbase1[rf]); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Realtek regulatory, 20MHz, writeval(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', writeval); - } - break; - case 2: - writeval = ((index < 2) ? powerbase0[rf] : - powerbase1[rf]); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Better regulatory, writeval(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', writeval); - break; - case 3: - chnlgroup = 0; - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "customer's limit, 40MHz rf(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', - rtlefuse->pwrgroup_ht40[rf] - [channel - 1]); - } else { - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "customer's limit, 20MHz rf(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', - rtlefuse->pwrgroup_ht20[rf] - [channel - 1]); - } - for (i = 0; i < 4; i++) { - pwr_diff_limit[i] = (u8)((rtlphy->mcs_offset - [chnlgroup][index + (rf ? 8 : 0)] & - (0x7f << (i * 8))) >> (i * 8)); - if (rtlphy->current_chan_bw == - HT_CHANNEL_WIDTH_20_40) { - if (pwr_diff_limit[i] > - rtlefuse->pwrgroup_ht40[rf] - [channel - 1]) - pwr_diff_limit[i] = - rtlefuse->pwrgroup_ht40 - [rf][channel - 1]; - } else { - if (pwr_diff_limit[i] > - rtlefuse->pwrgroup_ht20[rf][ - channel - 1]) - pwr_diff_limit[i] = - rtlefuse->pwrgroup_ht20[rf] - [channel - 1]; - } - } - customer_limit = (pwr_diff_limit[3] << 24) | - (pwr_diff_limit[2] << 16) | - (pwr_diff_limit[1] << 8) | - (pwr_diff_limit[0]); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Customer's limit rf(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', customer_limit); - writeval = customer_limit + ((index < 2) ? - powerbase0[rf] : powerbase1[rf]); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Customer, writeval rf(%c)= 0x%x\n", - rf == 0 ? 'A' : 'B', writeval); - break; - default: - chnlgroup = 0; - writeval = rtlphy->mcs_offset[chnlgroup][index + - (rf ? 8 : 0)] + ((index < 2) ? - powerbase0[rf] : powerbase1[rf]); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "RTK better performance, writeval rf(%c) = 0x%x\n", - rf == 0 ? 'A' : 'B', writeval); - break; - } - *(p_outwriteval + rf) = writeval; - } -} - -static void _rtl92d_write_ofdm_power_reg(struct ieee80211_hw *hw, - u8 index, u32 *pvalue) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - static u16 regoffset_a[6] = { - RTXAGC_A_RATE18_06, RTXAGC_A_RATE54_24, - RTXAGC_A_MCS03_MCS00, RTXAGC_A_MCS07_MCS04, - RTXAGC_A_MCS11_MCS08, RTXAGC_A_MCS15_MCS12 - }; - static u16 regoffset_b[6] = { - RTXAGC_B_RATE18_06, RTXAGC_B_RATE54_24, - RTXAGC_B_MCS03_MCS00, RTXAGC_B_MCS07_MCS04, - RTXAGC_B_MCS11_MCS08, RTXAGC_B_MCS15_MCS12 - }; - u8 i, rf, pwr_val[4]; - u32 writeval; - u16 regoffset; - - for (rf = 0; rf < 2; rf++) { - writeval = pvalue[rf]; - for (i = 0; i < 4; i++) { - pwr_val[i] = (u8) ((writeval & (0x7f << - (i * 8))) >> (i * 8)); - if (pwr_val[i] > RF6052_MAX_TX_PWR) - pwr_val[i] = RF6052_MAX_TX_PWR; - } - writeval = (pwr_val[3] << 24) | (pwr_val[2] << 16) | - (pwr_val[1] << 8) | pwr_val[0]; - if (rf == 0) - regoffset = regoffset_a[index]; - else - regoffset = regoffset_b[index]; - rtl_set_bbreg(hw, regoffset, BMASKDWORD, writeval); - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Set 0x%x = %08x\n", regoffset, writeval); - if (((get_rf_type(rtlphy) == RF_2T2R) && - (regoffset == RTXAGC_A_MCS15_MCS12 || - regoffset == RTXAGC_B_MCS15_MCS12)) || - ((get_rf_type(rtlphy) != RF_2T2R) && - (regoffset == RTXAGC_A_MCS07_MCS04 || - regoffset == RTXAGC_B_MCS07_MCS04))) { - writeval = pwr_val[3]; - if (regoffset == RTXAGC_A_MCS15_MCS12 || - regoffset == RTXAGC_A_MCS07_MCS04) - regoffset = 0xc90; - if (regoffset == RTXAGC_B_MCS15_MCS12 || - regoffset == RTXAGC_B_MCS07_MCS04) - regoffset = 0xc98; - for (i = 0; i < 3; i++) { - if (i != 2) - writeval = (writeval > 8) ? - (writeval - 8) : 0; - else - writeval = (writeval > 6) ? - (writeval - 6) : 0; - rtl_write_byte(rtlpriv, (u32) (regoffset + i), - (u8) writeval); - } - } - } -} - -void rtl92d_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel) -{ - u32 writeval[2], powerbase0[2], powerbase1[2]; - u8 index; - - _rtl92d_phy_get_power_base(hw, ppowerlevel, channel, - &powerbase0[0], &powerbase1[0]); - for (index = 0; index < 6; index++) { - _rtl92d_get_txpower_writeval_by_regulatory(hw, - channel, index, &powerbase0[0], - &powerbase1[0], &writeval[0]); - _rtl92d_write_ofdm_power_reg(hw, index, &writeval[0]); - } -} - -bool rtl92d_phy_enable_anotherphy(struct ieee80211_hw *hw, bool bmac0) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); - u8 u1btmp; - u8 direct = bmac0 ? BIT(3) | BIT(2) : BIT(3); - u8 mac_reg = bmac0 ? REG_MAC1 : REG_MAC0; - u8 mac_on_bit = bmac0 ? MAC1_ON : MAC0_ON; - bool bresult = true; /* true: need to enable BB/RF power */ - - rtlhal->during_mac0init_radiob = false; - rtlhal->during_mac1init_radioa = false; - RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "===>\n"); - /* MAC0 Need PHY1 load radio_b.txt . Driver use DBI to write. */ - u1btmp = rtl_read_byte(rtlpriv, mac_reg); - if (!(u1btmp & mac_on_bit)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "enable BB & RF\n"); - /* Enable BB and RF power */ - rtl92de_write_dword_dbi(hw, REG_SYS_ISO_CTRL, - rtl92de_read_dword_dbi(hw, REG_SYS_ISO_CTRL, direct) | - BIT(29) | BIT(16) | BIT(17), direct); - } else { - /* We think if MAC1 is ON,then radio_a.txt - * and radio_b.txt has been load. */ - bresult = false; - } - RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "<===\n"); - return bresult; - -} - -void rtl92d_phy_powerdown_anotherphy(struct ieee80211_hw *hw, bool bmac0) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); - u8 u1btmp; - u8 direct = bmac0 ? BIT(3) | BIT(2) : BIT(3); - u8 mac_reg = bmac0 ? REG_MAC1 : REG_MAC0; - u8 mac_on_bit = bmac0 ? MAC1_ON : MAC0_ON; - - rtlhal->during_mac0init_radiob = false; - rtlhal->during_mac1init_radioa = false; - RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "====>\n"); - /* check MAC0 enable or not again now, if - * enabled, not power down radio A. */ - u1btmp = rtl_read_byte(rtlpriv, mac_reg); - if (!(u1btmp & mac_on_bit)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "power down\n"); - /* power down RF radio A according to YuNan's advice. */ - rtl92de_write_dword_dbi(hw, RFPGA0_XA_LSSIPARAMETER, - 0x00000000, direct); - } - RT_TRACE(rtlpriv, COMP_RF, DBG_LOUD, "<====\n"); -} - -bool rtl92d_phy_rf6052_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - bool rtstatus = true; - struct rtl_hal *rtlhal = &(rtlpriv->rtlhal); - u32 u4_regvalue = 0; - u8 rfpath; - struct bb_reg_def *pphyreg; - bool mac1_initradioa_first = false, mac0_initradiob_first = false; - bool need_pwrdown_radioa = false, need_pwrdown_radiob = false; - bool true_bpath = false; - - if (rtlphy->rf_type == RF_1T1R) - rtlphy->num_total_rfpath = 1; - else - rtlphy->num_total_rfpath = 2; - - /* Single phy mode: use radio_a radio_b config path_A path_B */ - /* seperately by MAC0, and MAC1 needn't configure RF; */ - /* Dual PHY mode:MAC0 use radio_a config 1st phy path_A, */ - /* MAC1 use radio_b config 2nd PHY path_A. */ - /* DMDP,MAC0 on G band,MAC1 on A band. */ - if (rtlhal->macphymode == DUALMAC_DUALPHY) { - if (rtlhal->current_bandtype == BAND_ON_2_4G && - rtlhal->interfaceindex == 0) { - /* MAC0 needs PHY1 load radio_b.txt. - * Driver use DBI to write. */ - if (rtl92d_phy_enable_anotherphy(hw, true)) { - rtlphy->num_total_rfpath = 2; - mac0_initradiob_first = true; - } else { - /* We think if MAC1 is ON,then radio_a.txt and - * radio_b.txt has been load. */ - return rtstatus; - } - } else if (rtlhal->current_bandtype == BAND_ON_5G && - rtlhal->interfaceindex == 1) { - /* MAC1 needs PHY0 load radio_a.txt. - * Driver use DBI to write. */ - if (rtl92d_phy_enable_anotherphy(hw, false)) { - rtlphy->num_total_rfpath = 2; - mac1_initradioa_first = true; - } else { - /* We think if MAC0 is ON,then radio_a.txt and - * radio_b.txt has been load. */ - return rtstatus; - } - } else if (rtlhal->interfaceindex == 1) { - /* MAC0 enabled, only init radia B. */ - true_bpath = true; - } - } - - for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) { - /* Mac1 use PHY0 write */ - if (mac1_initradioa_first) { - if (rfpath == RF90_PATH_A) { - rtlhal->during_mac1init_radioa = true; - need_pwrdown_radioa = true; - } else if (rfpath == RF90_PATH_B) { - rtlhal->during_mac1init_radioa = false; - mac1_initradioa_first = false; - rfpath = RF90_PATH_A; - true_bpath = true; - rtlphy->num_total_rfpath = 1; - } - } else if (mac0_initradiob_first) { - /* Mac0 use PHY1 write */ - if (rfpath == RF90_PATH_A) - rtlhal->during_mac0init_radiob = false; - if (rfpath == RF90_PATH_B) { - rtlhal->during_mac0init_radiob = true; - mac0_initradiob_first = false; - need_pwrdown_radiob = true; - rfpath = RF90_PATH_A; - true_bpath = true; - rtlphy->num_total_rfpath = 1; - } - } - pphyreg = &rtlphy->phyreg_def[rfpath]; - switch (rfpath) { - case RF90_PATH_A: - case RF90_PATH_C: - u4_regvalue = rtl_get_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV); - break; - case RF90_PATH_B: - case RF90_PATH_D: - u4_regvalue = rtl_get_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV << 16); - break; - } - rtl_set_bbreg(hw, pphyreg->rfintfe, BRFSI_RFENV << 16, 0x1); - udelay(1); - rtl_set_bbreg(hw, pphyreg->rfintfo, BRFSI_RFENV, 0x1); - udelay(1); - /* Set bit number of Address and Data for RF register */ - /* Set 1 to 4 bits for 8255 */ - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, - B3WIREADDRESSLENGTH, 0x0); - udelay(1); - /* Set 0 to 12 bits for 8255 */ - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, B3WIREDATALENGTH, 0x0); - udelay(1); - switch (rfpath) { - case RF90_PATH_A: - if (true_bpath) - rtstatus = rtl92d_phy_config_rf_with_headerfile( - hw, radiob_txt, - (enum radio_path)rfpath); - else - rtstatus = rtl92d_phy_config_rf_with_headerfile( - hw, radioa_txt, - (enum radio_path)rfpath); - break; - case RF90_PATH_B: - rtstatus = - rtl92d_phy_config_rf_with_headerfile(hw, radiob_txt, - (enum radio_path) rfpath); - break; - case RF90_PATH_C: - break; - case RF90_PATH_D: - break; - } - switch (rfpath) { - case RF90_PATH_A: - case RF90_PATH_C: - rtl_set_bbreg(hw, pphyreg->rfintfs, BRFSI_RFENV, - u4_regvalue); - break; - case RF90_PATH_B: - case RF90_PATH_D: - rtl_set_bbreg(hw, pphyreg->rfintfs, BRFSI_RFENV << 16, - u4_regvalue); - break; - } - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Radio[%d] Fail!!", rfpath); - goto phy_rf_cfg_fail; - } - - } - - /* check MAC0 enable or not again, if enabled, - * not power down radio A. */ - /* check MAC1 enable or not again, if enabled, - * not power down radio B. */ - if (need_pwrdown_radioa) - rtl92d_phy_powerdown_anotherphy(hw, false); - else if (need_pwrdown_radiob) - rtl92d_phy_powerdown_anotherphy(hw, true); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "<---\n"); - return rtstatus; - -phy_rf_cfg_fail: - return rtstatus; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/rf.h b/drivers/net/wireless/rtlwifi/rtl8192de/rf.h deleted file mode 100644 index 0fe1a48593e8..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/rf.h +++ /dev/null @@ -1,44 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92D_RF_H__ -#define __RTL92D_RF_H__ - -extern void rtl92d_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, - u8 bandwidth); -extern void rtl92d_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel); -extern void rtl92d_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel); -extern bool rtl92d_phy_rf6052_config(struct ieee80211_hw *hw); -extern bool rtl92d_phy_enable_anotherphy(struct ieee80211_hw *hw, bool bmac0); -extern void rtl92d_phy_powerdown_anotherphy(struct ieee80211_hw *hw, - bool bmac0); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c deleted file mode 100644 index c18c04bf0c13..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c +++ /dev/null @@ -1,417 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../core.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "hw.h" -#include "sw.h" -#include "trx.h" -#include "led.h" - -#include - -static void rtl92d_init_aspm_vars(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - /*close ASPM for AMD defaultly */ - rtlpci->const_amdpci_aspm = 0; - - /* - * ASPM PS mode. - * 0 - Disable ASPM, - * 1 - Enable ASPM without Clock Req, - * 2 - Enable ASPM with Clock Req, - * 3 - Alwyas Enable ASPM with Clock Req, - * 4 - Always Enable ASPM without Clock Req. - * set defult to RTL8192CE:3 RTL8192E:2 - * */ - rtlpci->const_pci_aspm = 3; - - /*Setting for PCI-E device */ - rtlpci->const_devicepci_aspm_setting = 0x03; - - /*Setting for PCI-E bridge */ - rtlpci->const_hostpci_aspm_setting = 0x02; - - /* - * In Hw/Sw Radio Off situation. - * 0 - Default, - * 1 - From ASPM setting without low Mac Pwr, - * 2 - From ASPM setting with low Mac Pwr, - * 3 - Bus D3 - * set default to RTL8192CE:0 RTL8192SE:2 - */ - rtlpci->const_hwsw_rfoff_d3 = 0; - - /* - * This setting works for those device with - * backdoor ASPM setting such as EPHY setting. - * 0 - Not support ASPM, - * 1 - Support ASPM, - * 2 - According to chipset. - */ - rtlpci->const_support_pciaspm = 1; -} - -static int rtl92d_init_sw_vars(struct ieee80211_hw *hw) -{ - int err; - u8 tid; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - rtlpriv->dm.dm_initialgain_enable = true; - rtlpriv->dm.dm_flag = 0; - rtlpriv->dm.disable_framebursting = false; - rtlpriv->dm.thermalvalue = 0; - rtlpriv->dm.useramask = true; - - /* dual mac */ - if (rtlpriv->rtlhal.current_bandtype == BAND_ON_5G) - rtlpriv->phy.current_channel = 36; - else - rtlpriv->phy.current_channel = 1; - - if (rtlpriv->rtlhal.macphymode != SINGLEMAC_SINGLEPHY) { - rtlpriv->rtlhal.disable_amsdu_8k = true; - /* No long RX - reduce fragmentation */ - rtlpci->rxbuffersize = 4096; - } - - rtlpci->transmit_config = CFENDFORM | BIT(12) | BIT(13); - - rtlpci->receive_config = ( - RCR_APPFCS - | RCR_AMF - | RCR_ADF - | RCR_APP_MIC - | RCR_APP_ICV - | RCR_AICV - | RCR_ACRC32 - | RCR_AB - | RCR_AM - | RCR_APM - | RCR_APP_PHYST_RXFF - | RCR_HTC_LOC_CTRL - ); - - rtlpci->irq_mask[0] = (u32) ( - IMR_ROK - | IMR_VODOK - | IMR_VIDOK - | IMR_BEDOK - | IMR_BKDOK - | IMR_MGNTDOK - | IMR_HIGHDOK - | IMR_BDOK - | IMR_RDU - | IMR_RXFOVW - ); - - rtlpci->irq_mask[1] = (u32) (IMR_CPWM | IMR_C2HCMD); - - /* for debug level */ - rtlpriv->dbg.global_debuglevel = rtlpriv->cfg->mod_params->debug; - /* for LPS & IPS */ - rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps; - rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; - rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; - if (!rtlpriv->psc.inactiveps) - pr_info("Power Save off (module option)\n"); - if (!rtlpriv->psc.fwctrl_lps) - pr_info("FW Power Save off (module option)\n"); - rtlpriv->psc.reg_fwctrl_lps = 3; - rtlpriv->psc.reg_max_lps_awakeintvl = 5; - /* for ASPM, you can close aspm through - * set const_support_pciaspm = 0 */ - rtl92d_init_aspm_vars(hw); - - if (rtlpriv->psc.reg_fwctrl_lps == 1) - rtlpriv->psc.fwctrl_psmode = FW_PS_MIN_MODE; - else if (rtlpriv->psc.reg_fwctrl_lps == 2) - rtlpriv->psc.fwctrl_psmode = FW_PS_MAX_MODE; - else if (rtlpriv->psc.reg_fwctrl_lps == 3) - rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE; - - /* for early mode */ - rtlpriv->rtlhal.earlymode_enable = false; - for (tid = 0; tid < 8; tid++) - skb_queue_head_init(&rtlpriv->mac80211.skb_waitq[tid]); - - /* for firmware buf */ - rtlpriv->rtlhal.pfirmware = vzalloc(0x8000); - if (!rtlpriv->rtlhal.pfirmware) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Can't alloc buffer for fw\n"); - return 1; - } - - rtlpriv->max_fw_size = 0x8000; - pr_info("Driver for Realtek RTL8192DE WLAN interface\n"); - pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name); - - /* request fw */ - err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Failed to request firmware!\n"); - return 1; - } - - return 0; -} - -static void rtl92d_deinit_sw_vars(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tid; - - if (rtlpriv->rtlhal.pfirmware) { - vfree(rtlpriv->rtlhal.pfirmware); - rtlpriv->rtlhal.pfirmware = NULL; - } - for (tid = 0; tid < 8; tid++) - skb_queue_purge(&rtlpriv->mac80211.skb_waitq[tid]); -} - -static struct rtl_hal_ops rtl8192de_hal_ops = { - .init_sw_vars = rtl92d_init_sw_vars, - .deinit_sw_vars = rtl92d_deinit_sw_vars, - .read_eeprom_info = rtl92de_read_eeprom_info, - .interrupt_recognized = rtl92de_interrupt_recognized, - .hw_init = rtl92de_hw_init, - .hw_disable = rtl92de_card_disable, - .hw_suspend = rtl92de_suspend, - .hw_resume = rtl92de_resume, - .enable_interrupt = rtl92de_enable_interrupt, - .disable_interrupt = rtl92de_disable_interrupt, - .set_network_type = rtl92de_set_network_type, - .set_chk_bssid = rtl92de_set_check_bssid, - .set_qos = rtl92de_set_qos, - .set_bcn_reg = rtl92de_set_beacon_related_registers, - .set_bcn_intv = rtl92de_set_beacon_interval, - .update_interrupt_mask = rtl92de_update_interrupt_mask, - .get_hw_reg = rtl92de_get_hw_reg, - .set_hw_reg = rtl92de_set_hw_reg, - .update_rate_tbl = rtl92de_update_hal_rate_tbl, - .fill_tx_desc = rtl92de_tx_fill_desc, - .fill_tx_cmddesc = rtl92de_tx_fill_cmddesc, - .query_rx_desc = rtl92de_rx_query_desc, - .set_channel_access = rtl92de_update_channel_access_setting, - .radio_onoff_checking = rtl92de_gpio_radio_on_off_checking, - .set_bw_mode = rtl92d_phy_set_bw_mode, - .switch_channel = rtl92d_phy_sw_chnl, - .dm_watchdog = rtl92d_dm_watchdog, - .scan_operation_backup = rtl92d_phy_scan_operation_backup, - .set_rf_power_state = rtl92d_phy_set_rf_power_state, - .led_control = rtl92de_led_control, - .set_desc = rtl92de_set_desc, - .get_desc = rtl92de_get_desc, - .tx_polling = rtl92de_tx_polling, - .enable_hw_sec = rtl92de_enable_hw_security_config, - .set_key = rtl92de_set_key, - .init_sw_leds = rtl92de_init_sw_leds, - .get_bbreg = rtl92d_phy_query_bb_reg, - .set_bbreg = rtl92d_phy_set_bb_reg, - .get_rfreg = rtl92d_phy_query_rf_reg, - .set_rfreg = rtl92d_phy_set_rf_reg, - .linked_set_reg = rtl92d_linked_set_reg, -}; - -static struct rtl_mod_params rtl92de_mod_params = { - .sw_crypto = false, - .inactiveps = true, - .swctrl_lps = true, - .fwctrl_lps = false, - .debug = DBG_EMERG, -}; - -static struct rtl_hal_cfg rtl92de_hal_cfg = { - .bar_id = 2, - .write_readback = true, - .name = "rtl8192de", - .fw_name = "rtlwifi/rtl8192defw.bin", - .ops = &rtl8192de_hal_ops, - .mod_params = &rtl92de_mod_params, - - .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, - .maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN, - .maps[SYS_CLK] = REG_SYS_CLKR, - .maps[MAC_RCR_AM] = RCR_AM, - .maps[MAC_RCR_AB] = RCR_AB, - .maps[MAC_RCR_ACRC32] = RCR_ACRC32, - .maps[MAC_RCR_ACF] = RCR_ACF, - .maps[MAC_RCR_AAP] = RCR_AAP, - - .maps[EFUSE_TEST] = REG_EFUSE_TEST, - .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, - .maps[EFUSE_CLK] = 0, /* just for 92se */ - .maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL, - .maps[EFUSE_PWC_EV12V] = PWC_EV12V, - .maps[EFUSE_FEN_ELDR] = FEN_ELDR, - .maps[EFUSE_LOADER_CLK_EN] = LOADER_CLK_EN, - .maps[EFUSE_ANA8M] = 0, /* just for 92se */ - .maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE, - .maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION, - .maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN, - - .maps[RWCAM] = REG_CAMCMD, - .maps[WCAMI] = REG_CAMWRITE, - .maps[RCAMO] = REG_CAMREAD, - .maps[CAMDBG] = REG_CAMDBG, - .maps[SECR] = REG_SECCFG, - .maps[SEC_CAM_NONE] = CAM_NONE, - .maps[SEC_CAM_WEP40] = CAM_WEP40, - .maps[SEC_CAM_TKIP] = CAM_TKIP, - .maps[SEC_CAM_AES] = CAM_AES, - .maps[SEC_CAM_WEP104] = CAM_WEP104, - - .maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6, - .maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5, - .maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4, - .maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3, - .maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2, - .maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1, - .maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8, - .maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7, - .maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6, - .maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5, - .maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4, - .maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3, - .maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2, - .maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1, - .maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2, - .maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1, - - .maps[RTL_IMR_TXFOVW] = IMR_TXFOVW, - .maps[RTL_IMR_PSTIMEOUT] = IMR_PSTIMEOUT, - .maps[RTL_IMR_BCNINT] = IMR_BCNINT, - .maps[RTL_IMR_RXFOVW] = IMR_RXFOVW, - .maps[RTL_IMR_RDU] = IMR_RDU, - .maps[RTL_IMR_ATIMEND] = IMR_ATIMEND, - .maps[RTL_IMR_BDOK] = IMR_BDOK, - .maps[RTL_IMR_MGNTDOK] = IMR_MGNTDOK, - .maps[RTL_IMR_TBDER] = IMR_TBDER, - .maps[RTL_IMR_HIGHDOK] = IMR_HIGHDOK, - .maps[RTL_IMR_TBDOK] = IMR_TBDOK, - .maps[RTL_IMR_BKDOK] = IMR_BKDOK, - .maps[RTL_IMR_BEDOK] = IMR_BEDOK, - .maps[RTL_IMR_VIDOK] = IMR_VIDOK, - .maps[RTL_IMR_VODOK] = IMR_VODOK, - .maps[RTL_IMR_ROK] = IMR_ROK, - .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER), - - .maps[RTL_RC_CCK_RATE1M] = DESC92_RATE1M, - .maps[RTL_RC_CCK_RATE2M] = DESC92_RATE2M, - .maps[RTL_RC_CCK_RATE5_5M] = DESC92_RATE5_5M, - .maps[RTL_RC_CCK_RATE11M] = DESC92_RATE11M, - .maps[RTL_RC_OFDM_RATE6M] = DESC92_RATE6M, - .maps[RTL_RC_OFDM_RATE9M] = DESC92_RATE9M, - .maps[RTL_RC_OFDM_RATE12M] = DESC92_RATE12M, - .maps[RTL_RC_OFDM_RATE18M] = DESC92_RATE18M, - .maps[RTL_RC_OFDM_RATE24M] = DESC92_RATE24M, - .maps[RTL_RC_OFDM_RATE36M] = DESC92_RATE36M, - .maps[RTL_RC_OFDM_RATE48M] = DESC92_RATE48M, - .maps[RTL_RC_OFDM_RATE54M] = DESC92_RATE54M, - - .maps[RTL_RC_HT_RATEMCS7] = DESC92_RATEMCS7, - .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, -}; - -static struct pci_device_id rtl92de_pci_ids[] = { - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8193, rtl92de_hal_cfg)}, - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x002B, rtl92de_hal_cfg)}, - {}, -}; - -MODULE_DEVICE_TABLE(pci, rtl92de_pci_ids); - -MODULE_AUTHOR("lizhaoming "); -MODULE_AUTHOR("Realtek WlanFAE "); -MODULE_AUTHOR("Larry Finger "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Realtek 8192DE 802.11n Dual Mac PCI wireless"); -MODULE_FIRMWARE("rtlwifi/rtl8192defw.bin"); - -module_param_named(swenc, rtl92de_mod_params.sw_crypto, bool, 0444); -module_param_named(debug, rtl92de_mod_params.debug, int, 0444); -module_param_named(ips, rtl92de_mod_params.inactiveps, bool, 0444); -module_param_named(swlps, rtl92de_mod_params.swctrl_lps, bool, 0444); -module_param_named(fwlps, rtl92de_mod_params.fwctrl_lps, bool, 0444); -MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); -MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); -MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); -MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); -MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); - -static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); - -static struct pci_driver rtl92de_driver = { - .name = KBUILD_MODNAME, - .id_table = rtl92de_pci_ids, - .probe = rtl_pci_probe, - .remove = rtl_pci_disconnect, - .driver.pm = &rtlwifi_pm_ops, -}; - -/* add global spin lock to solve the problem that - * Dul mac register operation on the same time */ -spinlock_t globalmutex_power; -spinlock_t globalmutex_for_fwdownload; -spinlock_t globalmutex_for_power_and_efuse; - -static int __init rtl92de_module_init(void) -{ - int ret = 0; - - spin_lock_init(&globalmutex_power); - spin_lock_init(&globalmutex_for_fwdownload); - spin_lock_init(&globalmutex_for_power_and_efuse); - - ret = pci_register_driver(&rtl92de_driver); - if (ret) - RT_ASSERT(false, "No device found\n"); - return ret; -} - -static void __exit rtl92de_module_exit(void) -{ - pci_unregister_driver(&rtl92de_driver); -} - -module_init(rtl92de_module_init); -module_exit(rtl92de_module_exit); diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/sw.h b/drivers/net/wireless/rtlwifi/rtl8192de/sw.h deleted file mode 100644 index 0e6035b8fd86..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.h +++ /dev/null @@ -1,37 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92DE_SW_H__ -#define __RTL92DE_SW_H__ - -extern spinlock_t globalmutex_power; -extern spinlock_t globalmutex_for_fwdownload; -extern spinlock_t globalmutex_for_power_and_efuse; - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/table.c b/drivers/net/wireless/rtlwifi/rtl8192de/table.c deleted file mode 100644 index 8ea6f528dfa6..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/table.c +++ /dev/null @@ -1,1690 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - * Created on 2010/12/23, 6:38 - *****************************************************************************/ - -#include - -#include "table.h" - -u32 rtl8192de_phy_reg_2tarray[PHY_REG_2T_ARRAYLENGTH] = { - 0x024, 0x0011800d, - 0x028, 0x00ffdb83, - 0x014, 0x088ba955, - 0x010, 0x49022b03, - 0x800, 0x80040002, - 0x804, 0x00000003, - 0x808, 0x0000fc00, - 0x80c, 0x0000000a, - 0x810, 0x80706388, - 0x814, 0x020c3d10, - 0x818, 0x02200385, - 0x81c, 0x00000000, - 0x820, 0x01000100, - 0x824, 0x00390004, - 0x828, 0x01000100, - 0x82c, 0x00390004, - 0x830, 0x27272727, - 0x834, 0x27272727, - 0x838, 0x27272727, - 0x83c, 0x27272727, - 0x840, 0x00010000, - 0x844, 0x00010000, - 0x848, 0x27272727, - 0x84c, 0x27272727, - 0x850, 0x00000000, - 0x854, 0x00000000, - 0x858, 0x569a569a, - 0x85c, 0x0c1b25a4, - 0x860, 0x66e60230, - 0x864, 0x061f0130, - 0x868, 0x27272727, - 0x86c, 0x272b2b2b, - 0x870, 0x07000700, - 0x874, 0x22188000, - 0x878, 0x08080808, - 0x87c, 0x00007ff8, - 0x880, 0xc0083070, - 0x884, 0x00000cd5, - 0x888, 0x00000000, - 0x88c, 0xcc0000c0, - 0x890, 0x00000800, - 0x894, 0xfffffffe, - 0x898, 0x40302010, - 0x89c, 0x00706050, - 0x900, 0x00000000, - 0x904, 0x00000023, - 0x908, 0x00000000, - 0x90c, 0x81121313, - 0xa00, 0x00d047c8, - 0xa04, 0x80ff000c, - 0xa08, 0x8c838300, - 0xa0c, 0x2e68120f, - 0xa10, 0x9500bb78, - 0xa14, 0x11144028, - 0xa18, 0x00881117, - 0xa1c, 0x89140f00, - 0xa20, 0x1a1b0000, - 0xa24, 0x090e1317, - 0xa28, 0x00000204, - 0xa2c, 0x00d30000, - 0xa70, 0x101fbf00, - 0xa74, 0x00000007, - 0xc00, 0x40071d40, - 0xc04, 0x03a05633, - 0xc08, 0x001000e4, - 0xc0c, 0x6c6c6c6c, - 0xc10, 0x08800000, - 0xc14, 0x40000100, - 0xc18, 0x08800000, - 0xc1c, 0x40000100, - 0xc20, 0x00000000, - 0xc24, 0x00000000, - 0xc28, 0x00000000, - 0xc2c, 0x00000000, - 0xc30, 0x69e9ac44, - 0xc34, 0x469652cf, - 0xc38, 0x49795994, - 0xc3c, 0x0a979718, - 0xc40, 0x1f7c403f, - 0xc44, 0x000100b7, - 0xc48, 0xec020107, - 0xc4c, 0x007f037f, - 0xc50, 0x69543420, - 0xc54, 0x43bc009e, - 0xc58, 0x69543420, - 0xc5c, 0x433c00a8, - 0xc60, 0x00000000, - 0xc64, 0x5116848b, - 0xc68, 0x47c00bff, - 0xc6c, 0x00000036, - 0xc70, 0x2c7f000d, - 0xc74, 0x058610db, - 0xc78, 0x0000001f, - 0xc7c, 0x40b95612, - 0xc80, 0x40000100, - 0xc84, 0x20f60000, - 0xc88, 0x40000100, - 0xc8c, 0x20e00000, - 0xc90, 0x00121820, - 0xc94, 0x00000007, - 0xc98, 0x00121820, - 0xc9c, 0x00007f7f, - 0xca0, 0x00000000, - 0xca4, 0x00000080, - 0xca8, 0x00000000, - 0xcac, 0x00000000, - 0xcb0, 0x00000000, - 0xcb4, 0x00000000, - 0xcb8, 0x00000000, - 0xcbc, 0x28000000, - 0xcc0, 0x00000000, - 0xcc4, 0x00000000, - 0xcc8, 0x00000000, - 0xccc, 0x00000000, - 0xcd0, 0x00000000, - 0xcd4, 0x00000000, - 0xcd8, 0x64b11e20, - 0xcdc, 0xe8767533, - 0xce0, 0x00222222, - 0xce4, 0x00000000, - 0xce8, 0x37644302, - 0xcec, 0x2f97d40c, - 0xd00, 0x00080740, - 0xd04, 0x00020403, - 0xd08, 0x0000907f, - 0xd0c, 0x20010201, - 0xd10, 0xa0633333, - 0xd14, 0x3333bc43, - 0xd18, 0x7a8f5b6b, - 0xd2c, 0xcc979975, - 0xd30, 0x00000000, - 0xd34, 0x80608404, - 0xd38, 0x00000000, - 0xd3c, 0x00027293, - 0xd40, 0x00000000, - 0xd44, 0x00000000, - 0xd48, 0x00000000, - 0xd4c, 0x00000000, - 0xd50, 0x6437140a, - 0xd54, 0x00000000, - 0xd58, 0x00000000, - 0xd5c, 0x30032064, - 0xd60, 0x4653de68, - 0xd64, 0x04518a3c, - 0xd68, 0x00002101, - 0xd6c, 0x2a201c16, - 0xd70, 0x1812362e, - 0xd74, 0x322c2220, - 0xd78, 0x000e3c24, - 0xe00, 0x2a2a2a2a, - 0xe04, 0x2a2a2a2a, - 0xe08, 0x03902a2a, - 0xe10, 0x2a2a2a2a, - 0xe14, 0x2a2a2a2a, - 0xe18, 0x2a2a2a2a, - 0xe1c, 0x2a2a2a2a, - 0xe28, 0x00000000, - 0xe30, 0x1000dc1f, - 0xe34, 0x10008c1f, - 0xe38, 0x02140102, - 0xe3c, 0x681604c2, - 0xe40, 0x01007c00, - 0xe44, 0x01004800, - 0xe48, 0xfb000000, - 0xe4c, 0x000028d1, - 0xe50, 0x1000dc1f, - 0xe54, 0x10008c1f, - 0xe58, 0x02140102, - 0xe5c, 0x28160d05, - 0xe60, 0x00000010, - 0xe68, 0x001b25a4, - 0xe6c, 0x63db25a4, - 0xe70, 0x63db25a4, - 0xe74, 0x0c126da4, - 0xe78, 0x0c126da4, - 0xe7c, 0x0c126da4, - 0xe80, 0x0c126da4, - 0xe84, 0x63db25a4, - 0xe88, 0x0c126da4, - 0xe8c, 0x63db25a4, - 0xed0, 0x63db25a4, - 0xed4, 0x63db25a4, - 0xed8, 0x63db25a4, - 0xedc, 0x001b25a4, - 0xee0, 0x001b25a4, - 0xeec, 0x6fdb25a4, - 0xf14, 0x00000003, - 0xf1c, 0x00000064, - 0xf4c, 0x00000004, - 0xf00, 0x00000300, -}; - -u32 rtl8192de_phy_reg_array_pg[PHY_REG_ARRAY_PG_LENGTH] = { - 0xe00, 0xffffffff, 0x07090c0c, - 0xe04, 0xffffffff, 0x01020405, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x0b0c0c0e, - 0xe14, 0xffffffff, 0x01030506, - 0xe18, 0xffffffff, 0x0b0c0d0e, - 0xe1c, 0xffffffff, 0x01030509, - 0x830, 0xffffffff, 0x07090c0c, - 0x834, 0xffffffff, 0x01020405, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x0b0c0c0e, - 0x848, 0xffffffff, 0x01030506, - 0x84c, 0xffffffff, 0x0b0c0d0e, - 0x868, 0xffffffff, 0x01030509, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x06060606, - 0xe14, 0xffffffff, 0x00020406, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x04040404, - 0x834, 0xffffffff, 0x00020204, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x06060606, - 0x848, 0xffffffff, 0x00020406, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x04040404, - 0x834, 0xffffffff, 0x00020204, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x08080808, - 0xe14, 0xffffffff, 0x00040408, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x04040404, - 0x834, 0xffffffff, 0x00020204, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x08080808, - 0x848, 0xffffffff, 0x00040408, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x08080808, - 0xe14, 0xffffffff, 0x00040408, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x04040404, - 0x834, 0xffffffff, 0x00020204, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x08080808, - 0x848, 0xffffffff, 0x00040408, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x08080808, - 0xe14, 0xffffffff, 0x00040408, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x04040404, - 0x834, 0xffffffff, 0x00020204, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x08080808, - 0x848, 0xffffffff, 0x00040408, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x08080808, - 0xe14, 0xffffffff, 0x00040408, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x04040404, - 0x834, 0xffffffff, 0x00020204, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x08080808, - 0x848, 0xffffffff, 0x00040408, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x08080808, - 0xe14, 0xffffffff, 0x00040408, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x04040404, - 0x834, 0xffffffff, 0x00020204, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x08080808, - 0x848, 0xffffffff, 0x00040408, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x08080808, - 0xe14, 0xffffffff, 0x00040408, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x04040404, - 0x834, 0xffffffff, 0x00020204, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x08080808, - 0x848, 0xffffffff, 0x00040408, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, -}; - -u32 rtl8192de_radioa_2tarray[RADIOA_2T_ARRAYLENGTH] = { - 0x000, 0x00030000, - 0x001, 0x00030000, - 0x002, 0x00000000, - 0x003, 0x00018c63, - 0x004, 0x00018c63, - 0x008, 0x00084000, - 0x00b, 0x0001c000, - 0x00e, 0x00018c67, - 0x00f, 0x00000851, - 0x014, 0x00021440, - 0x018, 0x00017524, - 0x019, 0x00000000, - 0x01d, 0x000a1290, - 0x023, 0x00001558, - 0x01a, 0x00030a99, - 0x01b, 0x00040b00, - 0x01c, 0x000fc339, - 0x03a, 0x000a57eb, - 0x03b, 0x00020000, - 0x03c, 0x000ff454, - 0x020, 0x0000aa52, - 0x021, 0x00054000, - 0x040, 0x0000aa52, - 0x041, 0x00014000, - 0x025, 0x000803be, - 0x026, 0x000fc638, - 0x027, 0x00077c18, - 0x028, 0x000de471, - 0x029, 0x000d7110, - 0x02a, 0x0008cb04, - 0x02b, 0x0004128b, - 0x02c, 0x00001840, - 0x043, 0x0002444f, - 0x044, 0x0001adb0, - 0x045, 0x00056467, - 0x046, 0x0008992c, - 0x047, 0x0000452c, - 0x048, 0x000f9c43, - 0x049, 0x00002e0c, - 0x04a, 0x000546eb, - 0x04b, 0x0008966c, - 0x04c, 0x0000dde9, - 0x018, 0x00007401, - 0x000, 0x00070000, - 0x012, 0x000dc000, - 0x012, 0x00090000, - 0x012, 0x00051000, - 0x012, 0x00012000, - 0x013, 0x000287b7, - 0x013, 0x000247ab, - 0x013, 0x0002079f, - 0x013, 0x0001c793, - 0x013, 0x0001839b, - 0x013, 0x00014392, - 0x013, 0x0001019a, - 0x013, 0x0000c191, - 0x013, 0x00008194, - 0x013, 0x000040a0, - 0x013, 0x00000018, - 0x015, 0x0000f424, - 0x015, 0x0004f424, - 0x015, 0x0008f424, - 0x016, 0x000e1330, - 0x016, 0x000a1330, - 0x016, 0x00061330, - 0x016, 0x00021330, - 0x018, 0x00017524, - 0x000, 0x00070000, - 0x012, 0x000cf000, - 0x012, 0x000bc000, - 0x012, 0x00078000, - 0x012, 0x00000000, - 0x013, 0x000287bc, - 0x013, 0x000247b0, - 0x013, 0x000203b4, - 0x013, 0x0001c3a8, - 0x013, 0x000181b4, - 0x013, 0x000141a8, - 0x013, 0x000100b0, - 0x013, 0x0000c0a4, - 0x013, 0x0000b02c, - 0x013, 0x00004020, - 0x013, 0x00000014, - 0x015, 0x0000f4c3, - 0x015, 0x0004f4c3, - 0x015, 0x0008f4c3, - 0x016, 0x000e085f, - 0x016, 0x000a085f, - 0x016, 0x0006085f, - 0x016, 0x0002085f, - 0x018, 0x00037524, - 0x000, 0x00070000, - 0x012, 0x000cf000, - 0x012, 0x000bc000, - 0x012, 0x00078000, - 0x012, 0x00000000, - 0x013, 0x000287bc, - 0x013, 0x000247b0, - 0x013, 0x000203b4, - 0x013, 0x0001c3a8, - 0x013, 0x000181b4, - 0x013, 0x000141a8, - 0x013, 0x000100b0, - 0x013, 0x0000c0a4, - 0x013, 0x0000b02c, - 0x013, 0x00004020, - 0x013, 0x00000014, - 0x015, 0x0000f4c3, - 0x015, 0x0004f4c3, - 0x015, 0x0008f4c3, - 0x016, 0x000e085f, - 0x016, 0x000a085f, - 0x016, 0x0006085f, - 0x016, 0x0002085f, - 0x018, 0x00057568, - 0x000, 0x00070000, - 0x012, 0x000cf000, - 0x012, 0x000bc000, - 0x012, 0x00078000, - 0x012, 0x00000000, - 0x013, 0x000287bc, - 0x013, 0x000247b0, - 0x013, 0x000203b4, - 0x013, 0x0001c3a8, - 0x013, 0x000181b4, - 0x013, 0x000141a8, - 0x013, 0x000100b0, - 0x013, 0x0000c0a4, - 0x013, 0x0000b02c, - 0x013, 0x00004020, - 0x013, 0x00000014, - 0x015, 0x0000f4c3, - 0x015, 0x0004f4c3, - 0x015, 0x0008f4c3, - 0x016, 0x000e085f, - 0x016, 0x000a085f, - 0x016, 0x0006085f, - 0x016, 0x0002085f, - 0x030, 0x0004470f, - 0x031, 0x00044ff0, - 0x032, 0x00000070, - 0x033, 0x000dd480, - 0x034, 0x000ffac0, - 0x035, 0x000b80c0, - 0x036, 0x00077000, - 0x037, 0x00064ff2, - 0x038, 0x000e7661, - 0x039, 0x00000e90, - 0x000, 0x00030000, - 0x018, 0x0000f401, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01e, 0x00088009, - 0x01f, 0x00080003, - 0x0fe, 0x00000000, - 0x01e, 0x00088001, - 0x01f, 0x00080000, - 0x0fe, 0x00000000, - 0x018, 0x00097524, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x02b, 0x00041289, - 0x0fe, 0x00000000, - 0x02d, 0x0006aaaa, - 0x02e, 0x000b4d01, - 0x02d, 0x00080000, - 0x02e, 0x00004d02, - 0x02d, 0x00095555, - 0x02e, 0x00054d03, - 0x02d, 0x000aaaaa, - 0x02e, 0x000b4d04, - 0x02d, 0x000c0000, - 0x02e, 0x00004d05, - 0x02d, 0x000d5555, - 0x02e, 0x00054d06, - 0x02d, 0x000eaaaa, - 0x02e, 0x000b4d07, - 0x02d, 0x00000000, - 0x02e, 0x00005108, - 0x02d, 0x00015555, - 0x02e, 0x00055109, - 0x02d, 0x0002aaaa, - 0x02e, 0x000b510a, - 0x02d, 0x00040000, - 0x02e, 0x0000510b, - 0x02d, 0x00055555, - 0x02e, 0x0005510c, -}; - -u32 rtl8192de_radiob_2tarray[RADIOB_2T_ARRAYLENGTH] = { - 0x000, 0x00030000, - 0x001, 0x00030000, - 0x002, 0x00000000, - 0x003, 0x00018c63, - 0x004, 0x00018c63, - 0x008, 0x00084000, - 0x00b, 0x0001c000, - 0x00e, 0x00018c67, - 0x00f, 0x00000851, - 0x014, 0x00021440, - 0x018, 0x00007401, - 0x019, 0x00000060, - 0x01d, 0x000a1290, - 0x023, 0x00001558, - 0x01a, 0x00030a99, - 0x01b, 0x00040b00, - 0x01c, 0x000fc339, - 0x03a, 0x000a57eb, - 0x03b, 0x00020000, - 0x03c, 0x000ff454, - 0x020, 0x0000aa52, - 0x021, 0x00054000, - 0x040, 0x0000aa52, - 0x041, 0x00014000, - 0x025, 0x000803be, - 0x026, 0x000fc638, - 0x027, 0x00077c18, - 0x028, 0x000d1c31, - 0x029, 0x000d7110, - 0x02a, 0x000aeb04, - 0x02b, 0x0004128b, - 0x02c, 0x00001840, - 0x043, 0x0002444f, - 0x044, 0x0001adb0, - 0x045, 0x00056467, - 0x046, 0x0008992c, - 0x047, 0x0000452c, - 0x048, 0x000f9c43, - 0x049, 0x00002e0c, - 0x04a, 0x000546eb, - 0x04b, 0x0008966c, - 0x04c, 0x0000dde9, - 0x018, 0x00007401, - 0x000, 0x00070000, - 0x012, 0x000dc000, - 0x012, 0x00090000, - 0x012, 0x00051000, - 0x012, 0x00012000, - 0x013, 0x000287b7, - 0x013, 0x000247ab, - 0x013, 0x0002079f, - 0x013, 0x0001c793, - 0x013, 0x0001839b, - 0x013, 0x00014392, - 0x013, 0x0001019a, - 0x013, 0x0000c191, - 0x013, 0x00008194, - 0x013, 0x000040a0, - 0x013, 0x00000018, - 0x015, 0x0000f424, - 0x015, 0x0004f424, - 0x015, 0x0008f424, - 0x016, 0x000e1330, - 0x016, 0x000a1330, - 0x016, 0x00061330, - 0x016, 0x00021330, - 0x018, 0x00017524, - 0x000, 0x00070000, - 0x012, 0x000cf000, - 0x012, 0x000bc000, - 0x012, 0x00078000, - 0x012, 0x00000000, - 0x013, 0x000287bc, - 0x013, 0x000247b0, - 0x013, 0x000203b4, - 0x013, 0x0001c3a8, - 0x013, 0x000181b4, - 0x013, 0x000141a8, - 0x013, 0x000100b0, - 0x013, 0x0000c0a4, - 0x013, 0x0000b02c, - 0x013, 0x00004020, - 0x013, 0x00000014, - 0x015, 0x0000f4c3, - 0x015, 0x0004f4c3, - 0x015, 0x0008f4c3, - 0x016, 0x000e085f, - 0x016, 0x000a085f, - 0x016, 0x0006085f, - 0x016, 0x0002085f, - 0x018, 0x00037524, - 0x000, 0x00070000, - 0x012, 0x000cf000, - 0x012, 0x000bc000, - 0x012, 0x00078000, - 0x012, 0x00000000, - 0x013, 0x000287bc, - 0x013, 0x000247b0, - 0x013, 0x000203b4, - 0x013, 0x0001c3a8, - 0x013, 0x000181b4, - 0x013, 0x000141a8, - 0x013, 0x000100b0, - 0x013, 0x0000c0a4, - 0x013, 0x0000b02c, - 0x013, 0x00004020, - 0x013, 0x00000014, - 0x015, 0x0000f4c3, - 0x015, 0x0004f4c3, - 0x015, 0x0008f4c3, - 0x016, 0x000e085f, - 0x016, 0x000a085f, - 0x016, 0x0006085f, - 0x016, 0x0002085f, - 0x018, 0x00057524, - 0x000, 0x00070000, - 0x012, 0x000cf000, - 0x012, 0x000bc000, - 0x012, 0x00078000, - 0x012, 0x00000000, - 0x013, 0x000287bc, - 0x013, 0x000247b0, - 0x013, 0x000203b4, - 0x013, 0x0001c3a8, - 0x013, 0x000181b4, - 0x013, 0x000141a8, - 0x013, 0x000100b0, - 0x013, 0x0000c0a4, - 0x013, 0x0000b02c, - 0x013, 0x00004020, - 0x013, 0x00000014, - 0x015, 0x0000f4c3, - 0x015, 0x0004f4c3, - 0x015, 0x0008f4c3, - 0x016, 0x000e085f, - 0x016, 0x000a085f, - 0x016, 0x0006085f, - 0x016, 0x0002085f, - 0x030, 0x0004470f, - 0x031, 0x00044ff0, - 0x032, 0x00000070, - 0x033, 0x000dd480, - 0x034, 0x000ffac0, - 0x035, 0x000b80c0, - 0x036, 0x00077000, - 0x037, 0x00064ff2, - 0x038, 0x000e7661, - 0x039, 0x00000e90, - 0x000, 0x00030000, - 0x018, 0x0000f401, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01e, 0x00088009, - 0x01f, 0x00080003, - 0x0fe, 0x00000000, - 0x01e, 0x00088001, - 0x01f, 0x00080000, - 0x0fe, 0x00000000, - 0x018, 0x00087401, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x02b, 0x00041289, - 0x0fe, 0x00000000, - 0x02d, 0x00066666, - 0x02e, 0x00064001, - 0x02d, 0x00091111, - 0x02e, 0x00014002, - 0x02d, 0x000bbbbb, - 0x02e, 0x000b4003, - 0x02d, 0x000e6666, - 0x02e, 0x00064004, - 0x02d, 0x00088888, - 0x02e, 0x00084005, - 0x02d, 0x0009dddd, - 0x02e, 0x000d4006, - 0x02d, 0x000b3333, - 0x02e, 0x00034007, - 0x02d, 0x00048888, - 0x02e, 0x00084408, - 0x02d, 0x000bbbbb, - 0x02e, 0x000b4409, - 0x02d, 0x000e6666, - 0x02e, 0x0006440a, - 0x02d, 0x00011111, - 0x02e, 0x0001480b, - 0x02d, 0x0003bbbb, - 0x02e, 0x000b480c, - 0x02d, 0x00066666, - 0x02e, 0x0006480d, - 0x02d, 0x000ccccc, - 0x02e, 0x000c480e, -}; - -u32 rtl8192de_radioa_2t_int_paarray[RADIOA_2T_INT_PA_ARRAYLENGTH] = { - 0x000, 0x00030000, - 0x001, 0x00030000, - 0x002, 0x00000000, - 0x003, 0x00018c63, - 0x004, 0x00018c63, - 0x008, 0x00084000, - 0x00b, 0x0001c000, - 0x00e, 0x00018c67, - 0x00f, 0x00000851, - 0x014, 0x00021440, - 0x018, 0x00017524, - 0x019, 0x00000000, - 0x01d, 0x000a1290, - 0x023, 0x00001558, - 0x01a, 0x00030a99, - 0x01b, 0x00040b00, - 0x01c, 0x000fc339, - 0x03a, 0x000a57eb, - 0x03b, 0x00020000, - 0x03c, 0x000ff454, - 0x020, 0x0000aa52, - 0x021, 0x00054000, - 0x040, 0x0000aa52, - 0x041, 0x00014000, - 0x025, 0x000803be, - 0x026, 0x000fc638, - 0x027, 0x00077c18, - 0x028, 0x000de471, - 0x029, 0x000d7110, - 0x02a, 0x0008eb04, - 0x02b, 0x0004128b, - 0x02c, 0x00001840, - 0x043, 0x0002444f, - 0x044, 0x0001adb0, - 0x045, 0x00056467, - 0x046, 0x0008992c, - 0x047, 0x0000452c, - 0x048, 0x000c0443, - 0x049, 0x00000730, - 0x04a, 0x00050f0f, - 0x04b, 0x000896ee, - 0x04c, 0x0000ddee, - 0x018, 0x00007401, - 0x000, 0x00070000, - 0x012, 0x000dc000, - 0x012, 0x00090000, - 0x012, 0x00051000, - 0x012, 0x00012000, - 0x013, 0x000287b7, - 0x013, 0x000247ab, - 0x013, 0x0002079f, - 0x013, 0x0001c793, - 0x013, 0x0001839b, - 0x013, 0x00014392, - 0x013, 0x0001019a, - 0x013, 0x0000c191, - 0x013, 0x00008194, - 0x013, 0x000040a0, - 0x013, 0x00000018, - 0x015, 0x0000f424, - 0x015, 0x0004f424, - 0x015, 0x0008f424, - 0x016, 0x000e1330, - 0x016, 0x000a1330, - 0x016, 0x00061330, - 0x016, 0x00021330, - 0x018, 0x00017524, - 0x000, 0x00070000, - 0x012, 0x000cf000, - 0x012, 0x000bc000, - 0x012, 0x00078000, - 0x012, 0x00000000, - 0x013, 0x000287bf, - 0x013, 0x000247b3, - 0x013, 0x000207a7, - 0x013, 0x0001c79b, - 0x013, 0x0001839f, - 0x013, 0x00014393, - 0x013, 0x00010399, - 0x013, 0x0000c38d, - 0x013, 0x00008199, - 0x013, 0x0000418d, - 0x013, 0x00000099, - 0x015, 0x0000f495, - 0x015, 0x0004f495, - 0x015, 0x0008f495, - 0x016, 0x000e1874, - 0x016, 0x000a1874, - 0x016, 0x00061874, - 0x016, 0x00021874, - 0x018, 0x00037564, - 0x000, 0x00070000, - 0x012, 0x000cf000, - 0x012, 0x000bc000, - 0x012, 0x00078000, - 0x012, 0x00000000, - 0x013, 0x000287bf, - 0x013, 0x000247b3, - 0x013, 0x000207a7, - 0x013, 0x0001c79b, - 0x013, 0x0001839f, - 0x013, 0x00014393, - 0x013, 0x00010399, - 0x013, 0x0000c38d, - 0x013, 0x00008199, - 0x013, 0x0000418d, - 0x013, 0x00000099, - 0x015, 0x0000f495, - 0x015, 0x0004f495, - 0x015, 0x0008f495, - 0x016, 0x000e1874, - 0x016, 0x000a1874, - 0x016, 0x00061874, - 0x016, 0x00021874, - 0x018, 0x00057595, - 0x000, 0x00070000, - 0x012, 0x000cf000, - 0x012, 0x000bc000, - 0x012, 0x00078000, - 0x012, 0x00000000, - 0x013, 0x000287bf, - 0x013, 0x000247b3, - 0x013, 0x000207a7, - 0x013, 0x0001c79b, - 0x013, 0x0001839f, - 0x013, 0x00014393, - 0x013, 0x00010399, - 0x013, 0x0000c38d, - 0x013, 0x00008199, - 0x013, 0x0000418d, - 0x013, 0x00000099, - 0x015, 0x0000f495, - 0x015, 0x0004f495, - 0x015, 0x0008f495, - 0x016, 0x000e1874, - 0x016, 0x000a1874, - 0x016, 0x00061874, - 0x016, 0x00021874, - 0x030, 0x0004470f, - 0x031, 0x00044ff0, - 0x032, 0x00000070, - 0x033, 0x000dd480, - 0x034, 0x000ffac0, - 0x035, 0x000b80c0, - 0x036, 0x00077000, - 0x037, 0x00064ff2, - 0x038, 0x000e7661, - 0x039, 0x00000e90, - 0x000, 0x00030000, - 0x018, 0x0000f401, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01e, 0x00088009, - 0x01f, 0x00080003, - 0x0fe, 0x00000000, - 0x01e, 0x00088001, - 0x01f, 0x00080000, - 0x0fe, 0x00000000, - 0x018, 0x00097524, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x02b, 0x00041289, - 0x0fe, 0x00000000, - 0x02d, 0x0006aaaa, - 0x02e, 0x000b4d01, - 0x02d, 0x00080000, - 0x02e, 0x00004d02, - 0x02d, 0x00095555, - 0x02e, 0x00054d03, - 0x02d, 0x000aaaaa, - 0x02e, 0x000b4d04, - 0x02d, 0x000c0000, - 0x02e, 0x00004d05, - 0x02d, 0x000d5555, - 0x02e, 0x00054d06, - 0x02d, 0x000eaaaa, - 0x02e, 0x000b4d07, - 0x02d, 0x00000000, - 0x02e, 0x00005108, - 0x02d, 0x00015555, - 0x02e, 0x00055109, - 0x02d, 0x0002aaaa, - 0x02e, 0x000b510a, - 0x02d, 0x00040000, - 0x02e, 0x0000510b, - 0x02d, 0x00055555, - 0x02e, 0x0005510c, -}; - -u32 rtl8192de_radiob_2t_int_paarray[RADIOB_2T_INT_PA_ARRAYLENGTH] = { - 0x000, 0x00030000, - 0x001, 0x00030000, - 0x002, 0x00000000, - 0x003, 0x00018c63, - 0x004, 0x00018c63, - 0x008, 0x00084000, - 0x00b, 0x0001c000, - 0x00e, 0x00018c67, - 0x00f, 0x00000851, - 0x014, 0x00021440, - 0x018, 0x00007401, - 0x019, 0x00000060, - 0x01d, 0x000a1290, - 0x023, 0x00001558, - 0x01a, 0x00030a99, - 0x01b, 0x00040b00, - 0x01c, 0x000fc339, - 0x03a, 0x000a57eb, - 0x03b, 0x00020000, - 0x03c, 0x000ff454, - 0x020, 0x0000aa52, - 0x021, 0x00054000, - 0x040, 0x0000aa52, - 0x041, 0x00014000, - 0x025, 0x000803be, - 0x026, 0x000fc638, - 0x027, 0x00077c18, - 0x028, 0x000d1c31, - 0x029, 0x000d7110, - 0x02a, 0x000aeb04, - 0x02b, 0x0004128b, - 0x02c, 0x00001840, - 0x043, 0x0002444f, - 0x044, 0x0001adb0, - 0x045, 0x00056467, - 0x046, 0x0008992c, - 0x047, 0x0000452c, - 0x048, 0x000c0443, - 0x049, 0x00000730, - 0x04a, 0x00050f0f, - 0x04b, 0x000896ee, - 0x04c, 0x0000ddee, - 0x018, 0x00007401, - 0x000, 0x00070000, - 0x012, 0x000dc000, - 0x012, 0x00090000, - 0x012, 0x00051000, - 0x012, 0x00012000, - 0x013, 0x000287b7, - 0x013, 0x000247ab, - 0x013, 0x0002079f, - 0x013, 0x0001c793, - 0x013, 0x0001839b, - 0x013, 0x00014392, - 0x013, 0x0001019a, - 0x013, 0x0000c191, - 0x013, 0x00008194, - 0x013, 0x000040a0, - 0x013, 0x00000018, - 0x015, 0x0000f424, - 0x015, 0x0004f424, - 0x015, 0x0008f424, - 0x016, 0x000e1330, - 0x016, 0x000a1330, - 0x016, 0x00061330, - 0x016, 0x00021330, - 0x018, 0x00017524, - 0x000, 0x00070000, - 0x012, 0x000cf000, - 0x012, 0x000bc000, - 0x012, 0x00078000, - 0x012, 0x00000000, - 0x013, 0x000287bf, - 0x013, 0x000247b3, - 0x013, 0x000207a7, - 0x013, 0x0001c79b, - 0x013, 0x0001839f, - 0x013, 0x00014393, - 0x013, 0x00010399, - 0x013, 0x0000c38d, - 0x013, 0x00008199, - 0x013, 0x0000418d, - 0x013, 0x00000099, - 0x015, 0x0000f495, - 0x015, 0x0004f495, - 0x015, 0x0008f495, - 0x016, 0x000e1874, - 0x016, 0x000a1874, - 0x016, 0x00061874, - 0x016, 0x00021874, - 0x018, 0x00037564, - 0x000, 0x00070000, - 0x012, 0x000cf000, - 0x012, 0x000bc000, - 0x012, 0x00078000, - 0x012, 0x00000000, - 0x013, 0x000287bf, - 0x013, 0x000247b3, - 0x013, 0x000207a7, - 0x013, 0x0001c79b, - 0x013, 0x0001839f, - 0x013, 0x00014393, - 0x013, 0x00010399, - 0x013, 0x0000c38d, - 0x013, 0x00008199, - 0x013, 0x0000418d, - 0x013, 0x00000099, - 0x015, 0x0000f495, - 0x015, 0x0004f495, - 0x015, 0x0008f495, - 0x016, 0x000e1874, - 0x016, 0x000a1874, - 0x016, 0x00061874, - 0x016, 0x00021874, - 0x018, 0x00057595, - 0x000, 0x00070000, - 0x012, 0x000cf000, - 0x012, 0x000bc000, - 0x012, 0x00078000, - 0x012, 0x00000000, - 0x013, 0x000287bf, - 0x013, 0x000247b3, - 0x013, 0x000207a7, - 0x013, 0x0001c79b, - 0x013, 0x0001839f, - 0x013, 0x00014393, - 0x013, 0x00010399, - 0x013, 0x0000c38d, - 0x013, 0x00008199, - 0x013, 0x0000418d, - 0x013, 0x00000099, - 0x015, 0x0000f495, - 0x015, 0x0004f495, - 0x015, 0x0008f495, - 0x016, 0x000e1874, - 0x016, 0x000a1874, - 0x016, 0x00061874, - 0x016, 0x00021874, - 0x030, 0x0004470f, - 0x031, 0x00044ff0, - 0x032, 0x00000070, - 0x033, 0x000dd480, - 0x034, 0x000ffac0, - 0x035, 0x000b80c0, - 0x036, 0x00077000, - 0x037, 0x00064ff2, - 0x038, 0x000e7661, - 0x039, 0x00000e90, - 0x000, 0x00030000, - 0x018, 0x0000f401, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01e, 0x00088009, - 0x01f, 0x00080003, - 0x0fe, 0x00000000, - 0x01e, 0x00088001, - 0x01f, 0x00080000, - 0x0fe, 0x00000000, - 0x018, 0x00087401, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x02b, 0x00041289, - 0x0fe, 0x00000000, - 0x02d, 0x00066666, - 0x02e, 0x00064001, - 0x02d, 0x00091111, - 0x02e, 0x00014002, - 0x02d, 0x000bbbbb, - 0x02e, 0x000b4003, - 0x02d, 0x000e6666, - 0x02e, 0x00064004, - 0x02d, 0x00088888, - 0x02e, 0x00084005, - 0x02d, 0x0009dddd, - 0x02e, 0x000d4006, - 0x02d, 0x000b3333, - 0x02e, 0x00034007, - 0x02d, 0x00048888, - 0x02e, 0x00084408, - 0x02d, 0x000bbbbb, - 0x02e, 0x000b4409, - 0x02d, 0x000e6666, - 0x02e, 0x0006440a, - 0x02d, 0x00011111, - 0x02e, 0x0001480b, - 0x02d, 0x0003bbbb, - 0x02e, 0x000b480c, - 0x02d, 0x00066666, - 0x02e, 0x0006480d, - 0x02d, 0x000ccccc, - 0x02e, 0x000c480e, -}; - -u32 rtl8192de_mac_2tarray[MAC_2T_ARRAYLENGTH] = { - 0x420, 0x00000080, - 0x423, 0x00000000, - 0x430, 0x00000000, - 0x431, 0x00000000, - 0x432, 0x00000000, - 0x433, 0x00000001, - 0x434, 0x00000004, - 0x435, 0x00000005, - 0x436, 0x00000006, - 0x437, 0x00000007, - 0x438, 0x00000000, - 0x439, 0x00000000, - 0x43a, 0x00000000, - 0x43b, 0x00000001, - 0x43c, 0x00000004, - 0x43d, 0x00000005, - 0x43e, 0x00000006, - 0x43f, 0x00000007, - 0x440, 0x00000050, - 0x441, 0x00000001, - 0x442, 0x00000000, - 0x444, 0x00000015, - 0x445, 0x000000f0, - 0x446, 0x0000000f, - 0x447, 0x00000000, - 0x462, 0x00000008, - 0x463, 0x00000003, - 0x4c8, 0x000000ff, - 0x4c9, 0x00000008, - 0x4cc, 0x000000ff, - 0x4cd, 0x000000ff, - 0x4ce, 0x00000001, - 0x500, 0x00000026, - 0x501, 0x000000a2, - 0x502, 0x0000002f, - 0x503, 0x00000000, - 0x504, 0x00000028, - 0x505, 0x000000a3, - 0x506, 0x0000005e, - 0x507, 0x00000000, - 0x508, 0x0000002b, - 0x509, 0x000000a4, - 0x50a, 0x0000005e, - 0x50b, 0x00000000, - 0x50c, 0x0000004f, - 0x50d, 0x000000a4, - 0x50e, 0x00000000, - 0x50f, 0x00000000, - 0x512, 0x0000001c, - 0x514, 0x0000000a, - 0x515, 0x00000010, - 0x516, 0x0000000a, - 0x517, 0x00000010, - 0x51a, 0x00000016, - 0x524, 0x0000000f, - 0x525, 0x0000004f, - 0x546, 0x00000040, - 0x547, 0x00000000, - 0x550, 0x00000010, - 0x551, 0x00000010, - 0x559, 0x00000002, - 0x55a, 0x00000002, - 0x55d, 0x000000ff, - 0x605, 0x00000030, - 0x608, 0x0000000e, - 0x609, 0x0000002a, - 0x652, 0x00000020, - 0x63c, 0x0000000a, - 0x63d, 0x0000000a, - 0x63e, 0x0000000e, - 0x63f, 0x0000000e, - 0x66e, 0x00000005, - 0x700, 0x00000021, - 0x701, 0x00000043, - 0x702, 0x00000065, - 0x703, 0x00000087, - 0x708, 0x00000021, - 0x709, 0x00000043, - 0x70a, 0x00000065, - 0x70b, 0x00000087, -}; - -u32 rtl8192de_agctab_array[AGCTAB_ARRAYLENGTH] = { - 0xc78, 0x7b000001, - 0xc78, 0x7b010001, - 0xc78, 0x7b020001, - 0xc78, 0x7b030001, - 0xc78, 0x7b040001, - 0xc78, 0x7b050001, - 0xc78, 0x7b060001, - 0xc78, 0x7a070001, - 0xc78, 0x79080001, - 0xc78, 0x78090001, - 0xc78, 0x770a0001, - 0xc78, 0x760b0001, - 0xc78, 0x750c0001, - 0xc78, 0x740d0001, - 0xc78, 0x730e0001, - 0xc78, 0x720f0001, - 0xc78, 0x71100001, - 0xc78, 0x70110001, - 0xc78, 0x6f120001, - 0xc78, 0x6e130001, - 0xc78, 0x6d140001, - 0xc78, 0x6c150001, - 0xc78, 0x6b160001, - 0xc78, 0x6a170001, - 0xc78, 0x69180001, - 0xc78, 0x68190001, - 0xc78, 0x671a0001, - 0xc78, 0x661b0001, - 0xc78, 0x651c0001, - 0xc78, 0x641d0001, - 0xc78, 0x631e0001, - 0xc78, 0x621f0001, - 0xc78, 0x61200001, - 0xc78, 0x60210001, - 0xc78, 0x49220001, - 0xc78, 0x48230001, - 0xc78, 0x47240001, - 0xc78, 0x46250001, - 0xc78, 0x45260001, - 0xc78, 0x44270001, - 0xc78, 0x43280001, - 0xc78, 0x42290001, - 0xc78, 0x412a0001, - 0xc78, 0x402b0001, - 0xc78, 0x262c0001, - 0xc78, 0x252d0001, - 0xc78, 0x242e0001, - 0xc78, 0x232f0001, - 0xc78, 0x22300001, - 0xc78, 0x21310001, - 0xc78, 0x20320001, - 0xc78, 0x06330001, - 0xc78, 0x05340001, - 0xc78, 0x04350001, - 0xc78, 0x03360001, - 0xc78, 0x02370001, - 0xc78, 0x01380001, - 0xc78, 0x00390001, - 0xc78, 0x003a0001, - 0xc78, 0x003b0001, - 0xc78, 0x003c0001, - 0xc78, 0x003d0001, - 0xc78, 0x003e0001, - 0xc78, 0x003f0001, - 0xc78, 0x7b400001, - 0xc78, 0x7b410001, - 0xc78, 0x7a420001, - 0xc78, 0x79430001, - 0xc78, 0x78440001, - 0xc78, 0x77450001, - 0xc78, 0x76460001, - 0xc78, 0x75470001, - 0xc78, 0x74480001, - 0xc78, 0x73490001, - 0xc78, 0x724a0001, - 0xc78, 0x714b0001, - 0xc78, 0x704c0001, - 0xc78, 0x6f4d0001, - 0xc78, 0x6e4e0001, - 0xc78, 0x6d4f0001, - 0xc78, 0x6c500001, - 0xc78, 0x6b510001, - 0xc78, 0x6a520001, - 0xc78, 0x69530001, - 0xc78, 0x68540001, - 0xc78, 0x67550001, - 0xc78, 0x66560001, - 0xc78, 0x65570001, - 0xc78, 0x64580001, - 0xc78, 0x63590001, - 0xc78, 0x625a0001, - 0xc78, 0x615b0001, - 0xc78, 0x605c0001, - 0xc78, 0x485d0001, - 0xc78, 0x475e0001, - 0xc78, 0x465f0001, - 0xc78, 0x45600001, - 0xc78, 0x44610001, - 0xc78, 0x43620001, - 0xc78, 0x42630001, - 0xc78, 0x41640001, - 0xc78, 0x40650001, - 0xc78, 0x27660001, - 0xc78, 0x26670001, - 0xc78, 0x25680001, - 0xc78, 0x24690001, - 0xc78, 0x236a0001, - 0xc78, 0x226b0001, - 0xc78, 0x216c0001, - 0xc78, 0x206d0001, - 0xc78, 0x206e0001, - 0xc78, 0x206f0001, - 0xc78, 0x20700001, - 0xc78, 0x20710001, - 0xc78, 0x20720001, - 0xc78, 0x20730001, - 0xc78, 0x20740001, - 0xc78, 0x20750001, - 0xc78, 0x20760001, - 0xc78, 0x20770001, - 0xc78, 0x20780001, - 0xc78, 0x20790001, - 0xc78, 0x207a0001, - 0xc78, 0x207b0001, - 0xc78, 0x207c0001, - 0xc78, 0x207d0001, - 0xc78, 0x207e0001, - 0xc78, 0x207f0001, - 0xc78, 0x38000002, - 0xc78, 0x38010002, - 0xc78, 0x38020002, - 0xc78, 0x38030002, - 0xc78, 0x38040002, - 0xc78, 0x38050002, - 0xc78, 0x38060002, - 0xc78, 0x38070002, - 0xc78, 0x38080002, - 0xc78, 0x3c090002, - 0xc78, 0x3e0a0002, - 0xc78, 0x400b0002, - 0xc78, 0x440c0002, - 0xc78, 0x480d0002, - 0xc78, 0x4c0e0002, - 0xc78, 0x500f0002, - 0xc78, 0x52100002, - 0xc78, 0x56110002, - 0xc78, 0x5a120002, - 0xc78, 0x5e130002, - 0xc78, 0x60140002, - 0xc78, 0x60150002, - 0xc78, 0x60160002, - 0xc78, 0x62170002, - 0xc78, 0x62180002, - 0xc78, 0x62190002, - 0xc78, 0x621a0002, - 0xc78, 0x621b0002, - 0xc78, 0x621c0002, - 0xc78, 0x621d0002, - 0xc78, 0x621e0002, - 0xc78, 0x621f0002, - 0xc78, 0x32000044, - 0xc78, 0x32010044, - 0xc78, 0x32020044, - 0xc78, 0x32030044, - 0xc78, 0x32040044, - 0xc78, 0x32050044, - 0xc78, 0x32060044, - 0xc78, 0x32070044, - 0xc78, 0x32080044, - 0xc78, 0x34090044, - 0xc78, 0x350a0044, - 0xc78, 0x360b0044, - 0xc78, 0x370c0044, - 0xc78, 0x380d0044, - 0xc78, 0x390e0044, - 0xc78, 0x3a0f0044, - 0xc78, 0x3e100044, - 0xc78, 0x42110044, - 0xc78, 0x44120044, - 0xc78, 0x46130044, - 0xc78, 0x4a140044, - 0xc78, 0x4e150044, - 0xc78, 0x50160044, - 0xc78, 0x55170044, - 0xc78, 0x5a180044, - 0xc78, 0x5e190044, - 0xc78, 0x641a0044, - 0xc78, 0x6e1b0044, - 0xc78, 0x6e1c0044, - 0xc78, 0x6e1d0044, - 0xc78, 0x6e1e0044, - 0xc78, 0x6e1f0044, - 0xc78, 0x6e1f0000, -}; - -u32 rtl8192de_agctab_5garray[AGCTAB_5G_ARRAYLENGTH] = { - 0xc78, 0x7b000001, - 0xc78, 0x7b010001, - 0xc78, 0x7a020001, - 0xc78, 0x79030001, - 0xc78, 0x78040001, - 0xc78, 0x77050001, - 0xc78, 0x76060001, - 0xc78, 0x75070001, - 0xc78, 0x74080001, - 0xc78, 0x73090001, - 0xc78, 0x720a0001, - 0xc78, 0x710b0001, - 0xc78, 0x700c0001, - 0xc78, 0x6f0d0001, - 0xc78, 0x6e0e0001, - 0xc78, 0x6d0f0001, - 0xc78, 0x6c100001, - 0xc78, 0x6b110001, - 0xc78, 0x6a120001, - 0xc78, 0x69130001, - 0xc78, 0x68140001, - 0xc78, 0x67150001, - 0xc78, 0x66160001, - 0xc78, 0x65170001, - 0xc78, 0x64180001, - 0xc78, 0x63190001, - 0xc78, 0x621a0001, - 0xc78, 0x611b0001, - 0xc78, 0x601c0001, - 0xc78, 0x481d0001, - 0xc78, 0x471e0001, - 0xc78, 0x461f0001, - 0xc78, 0x45200001, - 0xc78, 0x44210001, - 0xc78, 0x43220001, - 0xc78, 0x42230001, - 0xc78, 0x41240001, - 0xc78, 0x40250001, - 0xc78, 0x27260001, - 0xc78, 0x26270001, - 0xc78, 0x25280001, - 0xc78, 0x24290001, - 0xc78, 0x232a0001, - 0xc78, 0x222b0001, - 0xc78, 0x212c0001, - 0xc78, 0x202d0001, - 0xc78, 0x202e0001, - 0xc78, 0x202f0001, - 0xc78, 0x20300001, - 0xc78, 0x20310001, - 0xc78, 0x20320001, - 0xc78, 0x20330001, - 0xc78, 0x20340001, - 0xc78, 0x20350001, - 0xc78, 0x20360001, - 0xc78, 0x20370001, - 0xc78, 0x20380001, - 0xc78, 0x20390001, - 0xc78, 0x203a0001, - 0xc78, 0x203b0001, - 0xc78, 0x203c0001, - 0xc78, 0x203d0001, - 0xc78, 0x203e0001, - 0xc78, 0x203f0001, - 0xc78, 0x32000044, - 0xc78, 0x32010044, - 0xc78, 0x32020044, - 0xc78, 0x32030044, - 0xc78, 0x32040044, - 0xc78, 0x32050044, - 0xc78, 0x32060044, - 0xc78, 0x32070044, - 0xc78, 0x32080044, - 0xc78, 0x34090044, - 0xc78, 0x350a0044, - 0xc78, 0x360b0044, - 0xc78, 0x370c0044, - 0xc78, 0x380d0044, - 0xc78, 0x390e0044, - 0xc78, 0x3a0f0044, - 0xc78, 0x3e100044, - 0xc78, 0x42110044, - 0xc78, 0x44120044, - 0xc78, 0x46130044, - 0xc78, 0x4a140044, - 0xc78, 0x4e150044, - 0xc78, 0x50160044, - 0xc78, 0x55170044, - 0xc78, 0x5a180044, - 0xc78, 0x5e190044, - 0xc78, 0x641a0044, - 0xc78, 0x6e1b0044, - 0xc78, 0x6e1c0044, - 0xc78, 0x6e1d0044, - 0xc78, 0x6e1e0044, - 0xc78, 0x6e1f0044, - 0xc78, 0x6e1f0000, -}; - -u32 rtl8192de_agctab_2garray[AGCTAB_2G_ARRAYLENGTH] = { - 0xc78, 0x7b000001, - 0xc78, 0x7b010001, - 0xc78, 0x7b020001, - 0xc78, 0x7b030001, - 0xc78, 0x7b040001, - 0xc78, 0x7b050001, - 0xc78, 0x7b060001, - 0xc78, 0x7a070001, - 0xc78, 0x79080001, - 0xc78, 0x78090001, - 0xc78, 0x770a0001, - 0xc78, 0x760b0001, - 0xc78, 0x750c0001, - 0xc78, 0x740d0001, - 0xc78, 0x730e0001, - 0xc78, 0x720f0001, - 0xc78, 0x71100001, - 0xc78, 0x70110001, - 0xc78, 0x6f120001, - 0xc78, 0x6e130001, - 0xc78, 0x6d140001, - 0xc78, 0x6c150001, - 0xc78, 0x6b160001, - 0xc78, 0x6a170001, - 0xc78, 0x69180001, - 0xc78, 0x68190001, - 0xc78, 0x671a0001, - 0xc78, 0x661b0001, - 0xc78, 0x651c0001, - 0xc78, 0x641d0001, - 0xc78, 0x631e0001, - 0xc78, 0x621f0001, - 0xc78, 0x61200001, - 0xc78, 0x60210001, - 0xc78, 0x49220001, - 0xc78, 0x48230001, - 0xc78, 0x47240001, - 0xc78, 0x46250001, - 0xc78, 0x45260001, - 0xc78, 0x44270001, - 0xc78, 0x43280001, - 0xc78, 0x42290001, - 0xc78, 0x412a0001, - 0xc78, 0x402b0001, - 0xc78, 0x262c0001, - 0xc78, 0x252d0001, - 0xc78, 0x242e0001, - 0xc78, 0x232f0001, - 0xc78, 0x22300001, - 0xc78, 0x21310001, - 0xc78, 0x20320001, - 0xc78, 0x06330001, - 0xc78, 0x05340001, - 0xc78, 0x04350001, - 0xc78, 0x03360001, - 0xc78, 0x02370001, - 0xc78, 0x01380001, - 0xc78, 0x00390001, - 0xc78, 0x003a0001, - 0xc78, 0x003b0001, - 0xc78, 0x003c0001, - 0xc78, 0x003d0001, - 0xc78, 0x003e0001, - 0xc78, 0x003f0001, - 0xc78, 0x38000002, - 0xc78, 0x38010002, - 0xc78, 0x38020002, - 0xc78, 0x38030002, - 0xc78, 0x38040002, - 0xc78, 0x38050002, - 0xc78, 0x38060002, - 0xc78, 0x38070002, - 0xc78, 0x38080002, - 0xc78, 0x3c090002, - 0xc78, 0x3e0a0002, - 0xc78, 0x400b0002, - 0xc78, 0x440c0002, - 0xc78, 0x480d0002, - 0xc78, 0x4c0e0002, - 0xc78, 0x500f0002, - 0xc78, 0x52100002, - 0xc78, 0x56110002, - 0xc78, 0x5a120002, - 0xc78, 0x5e130002, - 0xc78, 0x60140002, - 0xc78, 0x60150002, - 0xc78, 0x60160002, - 0xc78, 0x62170002, - 0xc78, 0x62180002, - 0xc78, 0x62190002, - 0xc78, 0x621a0002, - 0xc78, 0x621b0002, - 0xc78, 0x621c0002, - 0xc78, 0x621d0002, - 0xc78, 0x621e0002, - 0xc78, 0x621f0002, - 0xc78, 0x6e1f0000, -}; diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/table.h b/drivers/net/wireless/rtlwifi/rtl8192de/table.h deleted file mode 100644 index 8b724a86117a..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/table.h +++ /dev/null @@ -1,57 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - * Created on 2010/ 5/18, 1:41 - *****************************************************************************/ - -#ifndef __RTL92DE_TABLE__H_ -#define __RTL92DE_TABLE__H_ - -/*Created on 2011/ 1/14, 1:35*/ - -#define PHY_REG_2T_ARRAYLENGTH 380 -extern u32 rtl8192de_phy_reg_2tarray[PHY_REG_2T_ARRAYLENGTH]; -#define PHY_REG_ARRAY_PG_LENGTH 624 -extern u32 rtl8192de_phy_reg_array_pg[PHY_REG_ARRAY_PG_LENGTH]; -#define RADIOA_2T_ARRAYLENGTH 378 -extern u32 rtl8192de_radioa_2tarray[RADIOA_2T_ARRAYLENGTH]; -#define RADIOB_2T_ARRAYLENGTH 384 -extern u32 rtl8192de_radiob_2tarray[RADIOB_2T_ARRAYLENGTH]; -#define RADIOA_2T_INT_PA_ARRAYLENGTH 378 -extern u32 rtl8192de_radioa_2t_int_paarray[RADIOA_2T_INT_PA_ARRAYLENGTH]; -#define RADIOB_2T_INT_PA_ARRAYLENGTH 384 -extern u32 rtl8192de_radiob_2t_int_paarray[RADIOB_2T_INT_PA_ARRAYLENGTH]; -#define MAC_2T_ARRAYLENGTH 160 -extern u32 rtl8192de_mac_2tarray[MAC_2T_ARRAYLENGTH]; -#define AGCTAB_ARRAYLENGTH 386 -extern u32 rtl8192de_agctab_array[AGCTAB_ARRAYLENGTH]; -#define AGCTAB_5G_ARRAYLENGTH 194 -extern u32 rtl8192de_agctab_5garray[AGCTAB_5G_ARRAYLENGTH]; -#define AGCTAB_2G_ARRAYLENGTH 194 -extern u32 rtl8192de_agctab_2garray[AGCTAB_2G_ARRAYLENGTH]; - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c deleted file mode 100644 index 542394c843e6..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c +++ /dev/null @@ -1,872 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../base.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "trx.h" -#include "led.h" - -static u8 _rtl92de_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) -{ - __le16 fc = rtl_get_fc(skb); - - if (unlikely(ieee80211_is_beacon(fc))) - return QSLT_BEACON; - if (ieee80211_is_mgmt(fc)) - return QSLT_MGNT; - - return skb->priority; -} - -static u8 _rtl92d_query_rxpwrpercentage(char antpower) -{ - if ((antpower <= -100) || (antpower >= 20)) - return 0; - else if (antpower >= 0) - return 100; - else - return 100 + antpower; -} - -static u8 _rtl92d_evm_db_to_percentage(char value) -{ - char ret_val = value; - - if (ret_val >= 0) - ret_val = 0; - if (ret_val <= -33) - ret_val = -33; - ret_val = 0 - ret_val; - ret_val *= 3; - if (ret_val == 99) - ret_val = 100; - return ret_val; -} - -static long _rtl92de_translate_todbm(struct ieee80211_hw *hw, - u8 signal_strength_index) -{ - long signal_power; - - signal_power = (long)((signal_strength_index + 1) >> 1); - signal_power -= 95; - return signal_power; -} - -static long _rtl92de_signal_scale_mapping(struct ieee80211_hw *hw, long currsig) -{ - long retsig; - - if (currsig >= 61 && currsig <= 100) - retsig = 90 + ((currsig - 60) / 4); - else if (currsig >= 41 && currsig <= 60) - retsig = 78 + ((currsig - 40) / 2); - else if (currsig >= 31 && currsig <= 40) - retsig = 66 + (currsig - 30); - else if (currsig >= 21 && currsig <= 30) - retsig = 54 + (currsig - 20); - else if (currsig >= 5 && currsig <= 20) - retsig = 42 + (((currsig - 5) * 2) / 3); - else if (currsig == 4) - retsig = 36; - else if (currsig == 3) - retsig = 27; - else if (currsig == 2) - retsig = 18; - else if (currsig == 1) - retsig = 9; - else - retsig = currsig; - return retsig; -} - -static void _rtl92de_query_rxphystatus(struct ieee80211_hw *hw, - struct rtl_stats *pstats, - struct rx_desc_92d *pdesc, - struct rx_fwinfo_92d *p_drvinfo, - bool packet_match_bssid, - bool packet_toself, - bool packet_beacon) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtlpriv); - struct phy_sts_cck_8192d *cck_buf; - s8 rx_pwr_all, rx_pwr[4]; - u8 rf_rx_num = 0, evm, pwdb_all; - u8 i, max_spatial_stream; - u32 rssi, total_rssi = 0; - bool is_cck_rate; - - is_cck_rate = RX_HAL_IS_CCK_RATE(pdesc); - pstats->packet_matchbssid = packet_match_bssid; - pstats->packet_toself = packet_toself; - pstats->packet_beacon = packet_beacon; - pstats->is_cck = is_cck_rate; - pstats->rx_mimo_sig_qual[0] = -1; - pstats->rx_mimo_sig_qual[1] = -1; - - if (is_cck_rate) { - u8 report, cck_highpwr; - cck_buf = (struct phy_sts_cck_8192d *)p_drvinfo; - if (ppsc->rfpwr_state == ERFON) - cck_highpwr = (u8) rtl_get_bbreg(hw, - RFPGA0_XA_HSSIPARAMETER2, - BIT(9)); - else - cck_highpwr = false; - if (!cck_highpwr) { - u8 cck_agc_rpt = cck_buf->cck_agc_rpt; - report = cck_buf->cck_agc_rpt & 0xc0; - report = report >> 6; - switch (report) { - case 0x3: - rx_pwr_all = -46 - (cck_agc_rpt & 0x3e); - break; - case 0x2: - rx_pwr_all = -26 - (cck_agc_rpt & 0x3e); - break; - case 0x1: - rx_pwr_all = -12 - (cck_agc_rpt & 0x3e); - break; - case 0x0: - rx_pwr_all = 16 - (cck_agc_rpt & 0x3e); - break; - } - } else { - u8 cck_agc_rpt = cck_buf->cck_agc_rpt; - report = p_drvinfo->cfosho[0] & 0x60; - report = report >> 5; - switch (report) { - case 0x3: - rx_pwr_all = -46 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x2: - rx_pwr_all = -26 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x1: - rx_pwr_all = -12 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x0: - rx_pwr_all = 16 - ((cck_agc_rpt & 0x1f) << 1); - break; - } - } - pwdb_all = _rtl92d_query_rxpwrpercentage(rx_pwr_all); - /* CCK gain is smaller than OFDM/MCS gain, */ - /* so we add gain diff by experiences, the val is 6 */ - pwdb_all += 6; - if (pwdb_all > 100) - pwdb_all = 100; - /* modify the offset to make the same gain index with OFDM. */ - if (pwdb_all > 34 && pwdb_all <= 42) - pwdb_all -= 2; - else if (pwdb_all > 26 && pwdb_all <= 34) - pwdb_all -= 6; - else if (pwdb_all > 14 && pwdb_all <= 26) - pwdb_all -= 8; - else if (pwdb_all > 4 && pwdb_all <= 14) - pwdb_all -= 4; - pstats->rx_pwdb_all = pwdb_all; - pstats->recvsignalpower = rx_pwr_all; - if (packet_match_bssid) { - u8 sq; - if (pstats->rx_pwdb_all > 40) { - sq = 100; - } else { - sq = cck_buf->sq_rpt; - if (sq > 64) - sq = 0; - else if (sq < 20) - sq = 100; - else - sq = ((64 - sq) * 100) / 44; - } - pstats->signalquality = sq; - pstats->rx_mimo_sig_qual[0] = sq; - pstats->rx_mimo_sig_qual[1] = -1; - } - } else { - rtlpriv->dm.rfpath_rxenable[0] = true; - rtlpriv->dm.rfpath_rxenable[1] = true; - for (i = RF90_PATH_A; i < RF6052_MAX_PATH; i++) { - if (rtlpriv->dm.rfpath_rxenable[i]) - rf_rx_num++; - rx_pwr[i] = ((p_drvinfo->gain_trsw[i] & 0x3f) * 2) - - 110; - rssi = _rtl92d_query_rxpwrpercentage(rx_pwr[i]); - total_rssi += rssi; - rtlpriv->stats.rx_snr_db[i] = - (long)(p_drvinfo->rxsnr[i] / 2); - if (packet_match_bssid) - pstats->rx_mimo_signalstrength[i] = (u8) rssi; - } - rx_pwr_all = ((p_drvinfo->pwdb_all >> 1) & 0x7f) - 106; - pwdb_all = _rtl92d_query_rxpwrpercentage(rx_pwr_all); - pstats->rx_pwdb_all = pwdb_all; - pstats->rxpower = rx_pwr_all; - pstats->recvsignalpower = rx_pwr_all; - if (pdesc->rxht && pdesc->rxmcs >= DESC92_RATEMCS8 && - pdesc->rxmcs <= DESC92_RATEMCS15) - max_spatial_stream = 2; - else - max_spatial_stream = 1; - for (i = 0; i < max_spatial_stream; i++) { - evm = _rtl92d_evm_db_to_percentage(p_drvinfo->rxevm[i]); - if (packet_match_bssid) { - if (i == 0) - pstats->signalquality = - (u8)(evm & 0xff); - pstats->rx_mimo_sig_qual[i] = - (u8)(evm & 0xff); - } - } - } - if (is_cck_rate) - pstats->signalstrength = (u8)(_rtl92de_signal_scale_mapping(hw, - pwdb_all)); - else if (rf_rx_num != 0) - pstats->signalstrength = (u8)(_rtl92de_signal_scale_mapping(hw, - total_rssi /= rf_rx_num)); -} - -static void rtl92d_loop_over_paths(struct ieee80211_hw *hw, - struct rtl_stats *pstats) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u8 rfpath; - - for (rfpath = RF90_PATH_A; rfpath < rtlphy->num_total_rfpath; - rfpath++) { - if (rtlpriv->stats.rx_rssi_percentage[rfpath] == 0) { - rtlpriv->stats.rx_rssi_percentage[rfpath] = - pstats->rx_mimo_signalstrength[rfpath]; - - } - if (pstats->rx_mimo_signalstrength[rfpath] > - rtlpriv->stats.rx_rssi_percentage[rfpath]) { - rtlpriv->stats.rx_rssi_percentage[rfpath] = - ((rtlpriv->stats.rx_rssi_percentage[rfpath] * - (RX_SMOOTH_FACTOR - 1)) + - (pstats->rx_mimo_signalstrength[rfpath])) / - (RX_SMOOTH_FACTOR); - rtlpriv->stats.rx_rssi_percentage[rfpath] = - rtlpriv->stats.rx_rssi_percentage[rfpath] + 1; - } else { - rtlpriv->stats.rx_rssi_percentage[rfpath] = - ((rtlpriv->stats.rx_rssi_percentage[rfpath] * - (RX_SMOOTH_FACTOR - 1)) + - (pstats->rx_mimo_signalstrength[rfpath])) / - (RX_SMOOTH_FACTOR); - } - } -} - -static void _rtl92de_process_ui_rssi(struct ieee80211_hw *hw, - struct rtl_stats *pstats) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 last_rssi, tmpval; - - if (pstats->packet_toself || pstats->packet_beacon) { - rtlpriv->stats.rssi_calculate_cnt++; - if (rtlpriv->stats.ui_rssi.total_num++ >= - PHY_RSSI_SLID_WIN_MAX) { - rtlpriv->stats.ui_rssi.total_num = - PHY_RSSI_SLID_WIN_MAX; - last_rssi = rtlpriv->stats.ui_rssi.elements[ - rtlpriv->stats.ui_rssi.index]; - rtlpriv->stats.ui_rssi.total_val -= last_rssi; - } - rtlpriv->stats.ui_rssi.total_val += pstats->signalstrength; - rtlpriv->stats.ui_rssi.elements - [rtlpriv->stats.ui_rssi.index++] = - pstats->signalstrength; - if (rtlpriv->stats.ui_rssi.index >= PHY_RSSI_SLID_WIN_MAX) - rtlpriv->stats.ui_rssi.index = 0; - tmpval = rtlpriv->stats.ui_rssi.total_val / - rtlpriv->stats.ui_rssi.total_num; - rtlpriv->stats.signal_strength = _rtl92de_translate_todbm(hw, - (u8) tmpval); - pstats->rssi = rtlpriv->stats.signal_strength; - } - if (!pstats->is_cck && pstats->packet_toself) - rtl92d_loop_over_paths(hw, pstats); -} - -static void _rtl92de_update_rxsignalstatistics(struct ieee80211_hw *hw, - struct rtl_stats *pstats) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int weighting = 0; - - if (rtlpriv->stats.recv_signal_power == 0) - rtlpriv->stats.recv_signal_power = pstats->recvsignalpower; - if (pstats->recvsignalpower > rtlpriv->stats.recv_signal_power) - weighting = 5; - else if (pstats->recvsignalpower < rtlpriv->stats.recv_signal_power) - weighting = (-5); - rtlpriv->stats.recv_signal_power = (rtlpriv->stats.recv_signal_power * - 5 + pstats->recvsignalpower + weighting) / 6; -} - -static void _rtl92de_process_pwdb(struct ieee80211_hw *hw, - struct rtl_stats *pstats) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - long undec_sm_pwdb; - - if (mac->opmode == NL80211_IFTYPE_ADHOC || - mac->opmode == NL80211_IFTYPE_AP) - return; - else - undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb; - - if (pstats->packet_toself || pstats->packet_beacon) { - if (undec_sm_pwdb < 0) - undec_sm_pwdb = pstats->rx_pwdb_all; - if (pstats->rx_pwdb_all > (u32) undec_sm_pwdb) { - undec_sm_pwdb = (((undec_sm_pwdb) * - (RX_SMOOTH_FACTOR - 1)) + - (pstats->rx_pwdb_all)) / (RX_SMOOTH_FACTOR); - undec_sm_pwdb = undec_sm_pwdb + 1; - } else { - undec_sm_pwdb = (((undec_sm_pwdb) * - (RX_SMOOTH_FACTOR - 1)) + - (pstats->rx_pwdb_all)) / (RX_SMOOTH_FACTOR); - } - rtlpriv->dm.undec_sm_pwdb = undec_sm_pwdb; - _rtl92de_update_rxsignalstatistics(hw, pstats); - } -} - -static void rtl92d_loop_over_streams(struct ieee80211_hw *hw, - struct rtl_stats *pstats) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int stream; - - for (stream = 0; stream < 2; stream++) { - if (pstats->rx_mimo_sig_qual[stream] != -1) { - if (rtlpriv->stats.rx_evm_percentage[stream] == 0) { - rtlpriv->stats.rx_evm_percentage[stream] = - pstats->rx_mimo_sig_qual[stream]; - } - rtlpriv->stats.rx_evm_percentage[stream] = - ((rtlpriv->stats.rx_evm_percentage[stream] - * (RX_SMOOTH_FACTOR - 1)) + - (pstats->rx_mimo_sig_qual[stream] * 1)) / - (RX_SMOOTH_FACTOR); - } - } -} - -static void _rtl92de_process_ui_link_quality(struct ieee80211_hw *hw, - struct rtl_stats *pstats) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 last_evm, tmpval; - - if (pstats->signalquality == 0) - return; - if (pstats->packet_toself || pstats->packet_beacon) { - if (rtlpriv->stats.ui_link_quality.total_num++ >= - PHY_LINKQUALITY_SLID_WIN_MAX) { - rtlpriv->stats.ui_link_quality.total_num = - PHY_LINKQUALITY_SLID_WIN_MAX; - last_evm = rtlpriv->stats.ui_link_quality.elements[ - rtlpriv->stats.ui_link_quality.index]; - rtlpriv->stats.ui_link_quality.total_val -= last_evm; - } - rtlpriv->stats.ui_link_quality.total_val += - pstats->signalquality; - rtlpriv->stats.ui_link_quality.elements[ - rtlpriv->stats.ui_link_quality.index++] = - pstats->signalquality; - if (rtlpriv->stats.ui_link_quality.index >= - PHY_LINKQUALITY_SLID_WIN_MAX) - rtlpriv->stats.ui_link_quality.index = 0; - tmpval = rtlpriv->stats.ui_link_quality.total_val / - rtlpriv->stats.ui_link_quality.total_num; - rtlpriv->stats.signal_quality = tmpval; - rtlpriv->stats.last_sigstrength_inpercent = tmpval; - rtl92d_loop_over_streams(hw, pstats); - } -} - -static void _rtl92de_process_phyinfo(struct ieee80211_hw *hw, - u8 *buffer, - struct rtl_stats *pcurrent_stats) -{ - - if (!pcurrent_stats->packet_matchbssid && - !pcurrent_stats->packet_beacon) - return; - - _rtl92de_process_ui_rssi(hw, pcurrent_stats); - _rtl92de_process_pwdb(hw, pcurrent_stats); - _rtl92de_process_ui_link_quality(hw, pcurrent_stats); -} - -static void _rtl92de_translate_rx_signal_stuff(struct ieee80211_hw *hw, - struct sk_buff *skb, - struct rtl_stats *pstats, - struct rx_desc_92d *pdesc, - struct rx_fwinfo_92d *p_drvinfo) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct ieee80211_hdr *hdr; - u8 *tmp_buf; - u8 *praddr; - u16 type, cfc; - __le16 fc; - bool packet_matchbssid, packet_toself, packet_beacon = false; - - tmp_buf = skb->data + pstats->rx_drvinfo_size + pstats->rx_bufshift; - hdr = (struct ieee80211_hdr *)tmp_buf; - fc = hdr->frame_control; - cfc = le16_to_cpu(fc); - type = WLAN_FC_GET_TYPE(fc); - praddr = hdr->addr1; - packet_matchbssid = ((IEEE80211_FTYPE_CTL != type) && - ether_addr_equal(mac->bssid, - (cfc & IEEE80211_FCTL_TODS) ? hdr->addr1 : - (cfc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : - hdr->addr3) && - (!pstats->hwerror) && (!pstats->crc) && (!pstats->icv)); - packet_toself = packet_matchbssid && - ether_addr_equal(praddr, rtlefuse->dev_addr); - if (ieee80211_is_beacon(fc)) - packet_beacon = true; - _rtl92de_query_rxphystatus(hw, pstats, pdesc, p_drvinfo, - packet_matchbssid, packet_toself, - packet_beacon); - _rtl92de_process_phyinfo(hw, tmp_buf, pstats); -} - -bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, - struct ieee80211_rx_status *rx_status, - u8 *p_desc, struct sk_buff *skb) -{ - struct rx_fwinfo_92d *p_drvinfo; - struct rx_desc_92d *pdesc = (struct rx_desc_92d *)p_desc; - u32 phystatus = GET_RX_DESC_PHYST(pdesc); - - stats->length = (u16) GET_RX_DESC_PKT_LEN(pdesc); - stats->rx_drvinfo_size = (u8) GET_RX_DESC_DRV_INFO_SIZE(pdesc) * - RX_DRV_INFO_SIZE_UNIT; - stats->rx_bufshift = (u8) (GET_RX_DESC_SHIFT(pdesc) & 0x03); - stats->icv = (u16) GET_RX_DESC_ICV(pdesc); - stats->crc = (u16) GET_RX_DESC_CRC32(pdesc); - stats->hwerror = (stats->crc | stats->icv); - stats->decrypted = !GET_RX_DESC_SWDEC(pdesc); - stats->rate = (u8) GET_RX_DESC_RXMCS(pdesc); - stats->shortpreamble = (u16) GET_RX_DESC_SPLCP(pdesc); - stats->isampdu = (bool) (GET_RX_DESC_PAGGR(pdesc) == 1); - stats->isfirst_ampdu = (bool) ((GET_RX_DESC_PAGGR(pdesc) == 1) - && (GET_RX_DESC_FAGGR(pdesc) == 1)); - stats->timestamp_low = GET_RX_DESC_TSFL(pdesc); - stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); - rx_status->freq = hw->conf.chandef.chan->center_freq; - rx_status->band = hw->conf.chandef.chan->band; - if (GET_RX_DESC_CRC32(pdesc)) - rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; - if (!GET_RX_DESC_SWDEC(pdesc)) - rx_status->flag |= RX_FLAG_DECRYPTED; - if (GET_RX_DESC_BW(pdesc)) - rx_status->flag |= RX_FLAG_40MHZ; - if (GET_RX_DESC_RXHT(pdesc)) - rx_status->flag |= RX_FLAG_HT; - rx_status->flag |= RX_FLAG_MACTIME_START; - if (stats->decrypted) - rx_status->flag |= RX_FLAG_DECRYPTED; - rx_status->rate_idx = rtlwifi_rate_mapping(hw, - (bool)GET_RX_DESC_RXHT(pdesc), - (u8)GET_RX_DESC_RXMCS(pdesc), - (bool)GET_RX_DESC_PAGGR(pdesc)); - rx_status->mactime = GET_RX_DESC_TSFL(pdesc); - if (phystatus) { - p_drvinfo = (struct rx_fwinfo_92d *)(skb->data + - stats->rx_bufshift); - _rtl92de_translate_rx_signal_stuff(hw, - skb, stats, pdesc, - p_drvinfo); - } - /*rx_status->qual = stats->signal; */ - rx_status->signal = stats->recvsignalpower + 10; - /*rx_status->noise = -stats->noise; */ - return true; -} - -static void _rtl92de_insert_emcontent(struct rtl_tcb_desc *ptcb_desc, - u8 *virtualaddress) -{ - memset(virtualaddress, 0, 8); - - SET_EARLYMODE_PKTNUM(virtualaddress, ptcb_desc->empkt_num); - SET_EARLYMODE_LEN0(virtualaddress, ptcb_desc->empkt_len[0]); - SET_EARLYMODE_LEN1(virtualaddress, ptcb_desc->empkt_len[1]); - SET_EARLYMODE_LEN2_1(virtualaddress, ptcb_desc->empkt_len[2] & 0xF); - SET_EARLYMODE_LEN2_2(virtualaddress, ptcb_desc->empkt_len[2] >> 4); - SET_EARLYMODE_LEN3(virtualaddress, ptcb_desc->empkt_len[3]); - SET_EARLYMODE_LEN4(virtualaddress, ptcb_desc->empkt_len[4]); -} - -void rtl92de_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, - u8 hw_queue, struct rtl_tcb_desc *ptcb_desc) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - u8 *pdesc = pdesc_tx; - u16 seq_number; - __le16 fc = hdr->frame_control; - unsigned int buf_len = 0; - unsigned int skb_len = skb->len; - u8 fw_qsel = _rtl92de_map_hwqueue_to_fwqueue(skb, hw_queue); - bool firstseg = ((hdr->seq_ctrl & - cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0); - bool lastseg = ((hdr->frame_control & - cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) == 0); - dma_addr_t mapping; - u8 bw_40 = 0; - - if (mac->opmode == NL80211_IFTYPE_STATION) { - bw_40 = mac->bw_40; - } else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) { - if (sta) - bw_40 = sta->bandwidth >= IEEE80211_STA_RX_BW_40; - } - seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4; - rtl_get_tcb_desc(hw, info, sta, skb, ptcb_desc); - /* reserve 8 byte for AMPDU early mode */ - if (rtlhal->earlymode_enable) { - skb_push(skb, EM_HDR_LEN); - memset(skb->data, 0, EM_HDR_LEN); - } - buf_len = skb->len; - mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, - PCI_DMA_TODEVICE); - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } - CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92d)); - if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) { - firstseg = true; - lastseg = true; - } - if (firstseg) { - if (rtlhal->earlymode_enable) { - SET_TX_DESC_PKT_OFFSET(pdesc, 1); - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN + - EM_HDR_LEN); - if (ptcb_desc->empkt_num) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_LOUD, - "Insert 8 byte.pTcb->EMPktNum:%d\n", - ptcb_desc->empkt_num); - _rtl92de_insert_emcontent(ptcb_desc, - (u8 *)(skb->data)); - } - } else { - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); - } - /* 5G have no CCK rate */ - if (rtlhal->current_bandtype == BAND_ON_5G) - if (ptcb_desc->hw_rate < DESC92_RATE6M) - ptcb_desc->hw_rate = DESC92_RATE6M; - SET_TX_DESC_TX_RATE(pdesc, ptcb_desc->hw_rate); - if (ptcb_desc->use_shortgi || ptcb_desc->use_shortpreamble) - SET_TX_DESC_DATA_SHORTGI(pdesc, 1); - - if (rtlhal->macphymode == DUALMAC_DUALPHY && - ptcb_desc->hw_rate == DESC92_RATEMCS7) - SET_TX_DESC_DATA_SHORTGI(pdesc, 1); - - if (info->flags & IEEE80211_TX_CTL_AMPDU) { - SET_TX_DESC_AGG_ENABLE(pdesc, 1); - SET_TX_DESC_MAX_AGG_NUM(pdesc, 0x14); - } - SET_TX_DESC_SEQ(pdesc, seq_number); - SET_TX_DESC_RTS_ENABLE(pdesc, ((ptcb_desc->rts_enable && - !ptcb_desc->cts_enable) ? 1 : 0)); - SET_TX_DESC_HW_RTS_ENABLE(pdesc, ((ptcb_desc->rts_enable - || ptcb_desc->cts_enable) ? 1 : 0)); - SET_TX_DESC_CTS2SELF(pdesc, ((ptcb_desc->cts_enable) ? 1 : 0)); - SET_TX_DESC_RTS_STBC(pdesc, ((ptcb_desc->rts_stbc) ? 1 : 0)); - /* 5G have no CCK rate */ - if (rtlhal->current_bandtype == BAND_ON_5G) - if (ptcb_desc->rts_rate < DESC92_RATE6M) - ptcb_desc->rts_rate = DESC92_RATE6M; - SET_TX_DESC_RTS_RATE(pdesc, ptcb_desc->rts_rate); - SET_TX_DESC_RTS_BW(pdesc, 0); - SET_TX_DESC_RTS_SC(pdesc, ptcb_desc->rts_sc); - SET_TX_DESC_RTS_SHORT(pdesc, ((ptcb_desc->rts_rate <= - DESC92_RATE54M) ? - (ptcb_desc->rts_use_shortpreamble ? 1 : 0) : - (ptcb_desc->rts_use_shortgi ? 1 : 0))); - if (bw_40) { - if (ptcb_desc->packet_bw) { - SET_TX_DESC_DATA_BW(pdesc, 1); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, 3); - } else { - SET_TX_DESC_DATA_BW(pdesc, 0); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, - mac->cur_40_prime_sc); - } - } else { - SET_TX_DESC_DATA_BW(pdesc, 0); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, 0); - } - SET_TX_DESC_LINIP(pdesc, 0); - SET_TX_DESC_PKT_SIZE(pdesc, (u16) skb_len); - if (sta) { - u8 ampdu_density = sta->ht_cap.ampdu_density; - SET_TX_DESC_AMPDU_DENSITY(pdesc, ampdu_density); - } - if (info->control.hw_key) { - struct ieee80211_key_conf *keyconf; - - keyconf = info->control.hw_key; - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - case WLAN_CIPHER_SUITE_TKIP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x1); - break; - case WLAN_CIPHER_SUITE_CCMP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x3); - break; - default: - SET_TX_DESC_SEC_TYPE(pdesc, 0x0); - break; - - } - } - SET_TX_DESC_PKT_ID(pdesc, 0); - SET_TX_DESC_QUEUE_SEL(pdesc, fw_qsel); - SET_TX_DESC_DATA_RATE_FB_LIMIT(pdesc, 0x1F); - SET_TX_DESC_RTS_RATE_FB_LIMIT(pdesc, 0xF); - SET_TX_DESC_DISABLE_FB(pdesc, ptcb_desc->disable_ratefallback ? - 1 : 0); - SET_TX_DESC_USE_RATE(pdesc, ptcb_desc->use_driver_rate ? 1 : 0); - - /* Set TxRate and RTSRate in TxDesc */ - /* This prevent Tx initial rate of new-coming packets */ - /* from being overwritten by retried packet rate.*/ - if (!ptcb_desc->use_driver_rate) { - SET_TX_DESC_RTS_RATE(pdesc, 0x08); - /* SET_TX_DESC_TX_RATE(pdesc, 0x0b); */ - } - if (ieee80211_is_data_qos(fc)) { - if (mac->rdg_en) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "Enable RDG function\n"); - SET_TX_DESC_RDG_ENABLE(pdesc, 1); - SET_TX_DESC_HTC(pdesc, 1); - } - } - } - - SET_TX_DESC_FIRST_SEG(pdesc, (firstseg ? 1 : 0)); - SET_TX_DESC_LAST_SEG(pdesc, (lastseg ? 1 : 0)); - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16) buf_len); - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping); - if (rtlpriv->dm.useramask) { - SET_TX_DESC_RATE_ID(pdesc, ptcb_desc->ratr_index); - SET_TX_DESC_MACID(pdesc, ptcb_desc->mac_id); - } else { - SET_TX_DESC_RATE_ID(pdesc, 0xC + ptcb_desc->ratr_index); - SET_TX_DESC_MACID(pdesc, ptcb_desc->ratr_index); - } - if (ieee80211_is_data_qos(fc)) - SET_TX_DESC_QOS(pdesc, 1); - - if ((!ieee80211_is_data_qos(fc)) && ppsc->fwctrl_lps) { - SET_TX_DESC_HWSEQ_EN(pdesc, 1); - SET_TX_DESC_PKT_ID(pdesc, 8); - } - SET_TX_DESC_MORE_FRAG(pdesc, (lastseg ? 0 : 1)); - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "\n"); -} - -void rtl92de_tx_fill_cmddesc(struct ieee80211_hw *hw, - u8 *pdesc, bool firstseg, - bool lastseg, struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtlpriv); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - u8 fw_queue = QSLT_BEACON; - dma_addr_t mapping = pci_map_single(rtlpci->pdev, - skb->data, skb->len, PCI_DMA_TODEVICE); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); - __le16 fc = hdr->frame_control; - - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } - CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); - if (firstseg) - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); - /* 5G have no CCK rate - * Caution: The macros below are multi-line expansions. - * The braces are needed no matter what checkpatch says - */ - if (rtlhal->current_bandtype == BAND_ON_5G) { - SET_TX_DESC_TX_RATE(pdesc, DESC92_RATE6M); - } else { - SET_TX_DESC_TX_RATE(pdesc, DESC92_RATE1M); - } - SET_TX_DESC_SEQ(pdesc, 0); - SET_TX_DESC_LINIP(pdesc, 0); - SET_TX_DESC_QUEUE_SEL(pdesc, fw_queue); - SET_TX_DESC_FIRST_SEG(pdesc, 1); - SET_TX_DESC_LAST_SEG(pdesc, 1); - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16)skb->len); - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping); - SET_TX_DESC_RATE_ID(pdesc, 7); - SET_TX_DESC_MACID(pdesc, 0); - SET_TX_DESC_PKT_SIZE(pdesc, (u16) (skb->len)); - SET_TX_DESC_FIRST_SEG(pdesc, 1); - SET_TX_DESC_LAST_SEG(pdesc, 1); - SET_TX_DESC_OFFSET(pdesc, 0x20); - SET_TX_DESC_USE_RATE(pdesc, 1); - - if (!ieee80211_is_data_qos(fc) && ppsc->fwctrl_lps) { - SET_TX_DESC_HWSEQ_EN(pdesc, 1); - SET_TX_DESC_PKT_ID(pdesc, 8); - } - - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, - "H2C Tx Cmd Content", pdesc, TX_DESC_SIZE); - wmb(); - SET_TX_DESC_OWN(pdesc, 1); -} - -void rtl92de_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val) -{ - if (istx) { - switch (desc_name) { - case HW_DESC_OWN: - wmb(); - SET_TX_DESC_OWN(pdesc, 1); - break; - case HW_DESC_TX_NEXTDESC_ADDR: - SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *) val); - break; - default: - RT_ASSERT(false, "ERR txdesc :%d not process\n", - desc_name); - break; - } - } else { - switch (desc_name) { - case HW_DESC_RXOWN: - wmb(); - SET_RX_DESC_OWN(pdesc, 1); - break; - case HW_DESC_RXBUFF_ADDR: - SET_RX_DESC_BUFF_ADDR(pdesc, *(u32 *) val); - break; - case HW_DESC_RXPKT_LEN: - SET_RX_DESC_PKT_LEN(pdesc, *(u32 *) val); - break; - case HW_DESC_RXERO: - SET_RX_DESC_EOR(pdesc, 1); - break; - default: - RT_ASSERT(false, "ERR rxdesc :%d not process\n", - desc_name); - break; - } - } -} - -u32 rtl92de_get_desc(u8 *p_desc, bool istx, u8 desc_name) -{ - u32 ret = 0; - - if (istx) { - switch (desc_name) { - case HW_DESC_OWN: - ret = GET_TX_DESC_OWN(p_desc); - break; - case HW_DESC_TXBUFF_ADDR: - ret = GET_TX_DESC_TX_BUFFER_ADDRESS(p_desc); - break; - default: - RT_ASSERT(false, "ERR txdesc :%d not process\n", - desc_name); - break; - } - } else { - struct rx_desc_92c *pdesc = (struct rx_desc_92c *)p_desc; - switch (desc_name) { - case HW_DESC_OWN: - ret = GET_RX_DESC_OWN(pdesc); - break; - case HW_DESC_RXPKT_LEN: - ret = GET_RX_DESC_PKT_LEN(pdesc); - break; - default: - RT_ASSERT(false, "ERR rxdesc :%d not process\n", - desc_name); - break; - } - } - return ret; -} - -void rtl92de_tx_polling(struct ieee80211_hw *hw, u8 hw_queue) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - if (hw_queue == BEACON_QUEUE) - rtl_write_word(rtlpriv, REG_PCIE_CTRL_REG, BIT(4)); - else - rtl_write_word(rtlpriv, REG_PCIE_CTRL_REG, - BIT(0) << (hw_queue)); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.h b/drivers/net/wireless/rtlwifi/rtl8192de/trx.h deleted file mode 100644 index c1b5dfb79d53..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.h +++ /dev/null @@ -1,747 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92DE_TRX_H__ -#define __RTL92DE_TRX_H__ - -#define TX_DESC_SIZE 64 -#define TX_DESC_AGGR_SUBFRAME_SIZE 32 - -#define RX_DESC_SIZE 32 -#define RX_DRV_INFO_SIZE_UNIT 8 - -#define TX_DESC_NEXT_DESC_OFFSET 40 -#define USB_HWDESC_HEADER_LEN 32 -#define CRCLENGTH 4 - -/* Define a macro that takes a le32 word, converts it to host ordering, - * right shifts by a specified count, creates a mask of the specified - * bit count, and extracts that number of bits. - */ - -#define SHIFT_AND_MASK_LE(__pdesc, __shift, __mask) \ - ((le32_to_cpu(*(((__le32 *)(__pdesc)))) >> (__shift)) & \ - BIT_LEN_MASK_32(__mask)) - -/* Define a macro that clears a bit field in an le32 word and - * sets the specified value into that bit field. The resulting - * value remains in le32 ordering; however, it is properly converted - * to host ordering for the clear and set operations before conversion - * back to le32. - */ - -#define SET_BITS_OFFSET_LE(__pdesc, __shift, __len, __val) \ - (*(__le32 *)(__pdesc) = \ - (cpu_to_le32((le32_to_cpu(*((__le32 *)(__pdesc))) & \ - (~(BIT_OFFSET_LEN_MASK_32((__shift), __len)))) | \ - (((u32)(__val) & BIT_LEN_MASK_32(__len)) << (__shift))))); - -/* macros to read/write various fields in RX or TX descriptors */ - -#define SET_TX_DESC_PKT_SIZE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 0, 16, __val) -#define SET_TX_DESC_OFFSET(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 16, 8, __val) -#define SET_TX_DESC_BMC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 24, 1, __val) -#define SET_TX_DESC_HTC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 25, 1, __val) -#define SET_TX_DESC_LAST_SEG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 26, 1, __val) -#define SET_TX_DESC_FIRST_SEG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 27, 1, __val) -#define SET_TX_DESC_LINIP(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 28, 1, __val) -#define SET_TX_DESC_NO_ACM(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 29, 1, __val) -#define SET_TX_DESC_GF(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 30, 1, __val) -#define SET_TX_DESC_OWN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 31, 1, __val) - -#define GET_TX_DESC_PKT_SIZE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 0, 16) -#define GET_TX_DESC_OFFSET(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 16, 8) -#define GET_TX_DESC_BMC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 24, 1) -#define GET_TX_DESC_HTC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 25, 1) -#define GET_TX_DESC_LAST_SEG(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 26, 1) -#define GET_TX_DESC_FIRST_SEG(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 27, 1) -#define GET_TX_DESC_LINIP(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 28, 1) -#define GET_TX_DESC_NO_ACM(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 29, 1) -#define GET_TX_DESC_GF(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 30, 1) -#define GET_TX_DESC_OWN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 31, 1) - -#define SET_TX_DESC_MACID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 0, 5, __val) -#define SET_TX_DESC_AGG_ENABLE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 5, 1, __val) -#define SET_TX_DESC_BK(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 6, 1, __val) -#define SET_TX_DESC_RDG_ENABLE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 7, 1, __val) -#define SET_TX_DESC_QUEUE_SEL(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 8, 5, __val) -#define SET_TX_DESC_RDG_NAV_EXT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 13, 1, __val) -#define SET_TX_DESC_LSIG_TXOP_EN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 14, 1, __val) -#define SET_TX_DESC_PIFS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 15, 1, __val) -#define SET_TX_DESC_RATE_ID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 16, 4, __val) -#define SET_TX_DESC_NAV_USE_HDR(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 20, 1, __val) -#define SET_TX_DESC_EN_DESC_ID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 21, 1, __val) -#define SET_TX_DESC_SEC_TYPE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 22, 2, __val) -#define SET_TX_DESC_PKT_OFFSET(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+4, 26, 8, __val) - -#define GET_TX_DESC_MACID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 0, 5) -#define GET_TX_DESC_AGG_ENABLE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 5, 1) -#define GET_TX_DESC_AGG_BREAK(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 6, 1) -#define GET_TX_DESC_RDG_ENABLE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 7, 1) -#define GET_TX_DESC_QUEUE_SEL(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 8, 5) -#define GET_TX_DESC_RDG_NAV_EXT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 13, 1) -#define GET_TX_DESC_LSIG_TXOP_EN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 14, 1) -#define GET_TX_DESC_PIFS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 15, 1) -#define GET_TX_DESC_RATE_ID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 16, 4) -#define GET_TX_DESC_NAV_USE_HDR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 20, 1) -#define GET_TX_DESC_EN_DESC_ID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 21, 1) -#define GET_TX_DESC_SEC_TYPE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 22, 2) -#define GET_TX_DESC_PKT_OFFSET(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 24, 8) - -#define SET_TX_DESC_RTS_RC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 0, 6, __val) -#define SET_TX_DESC_DATA_RC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 6, 6, __val) -#define SET_TX_DESC_BAR_RTY_TH(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 14, 2, __val) -#define SET_TX_DESC_MORE_FRAG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 17, 1, __val) -#define SET_TX_DESC_RAW(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 18, 1, __val) -#define SET_TX_DESC_CCX(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 19, 1, __val) -#define SET_TX_DESC_AMPDU_DENSITY(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 20, 3, __val) -#define SET_TX_DESC_ANTSEL_A(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 24, 1, __val) -#define SET_TX_DESC_ANTSEL_B(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 25, 1, __val) -#define SET_TX_DESC_TX_ANT_CCK(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 26, 2, __val) -#define SET_TX_DESC_TX_ANTL(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 28, 2, __val) -#define SET_TX_DESC_TX_ANT_HT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+8, 30, 2, __val) - -#define GET_TX_DESC_RTS_RC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 0, 6) -#define GET_TX_DESC_DATA_RC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 6, 6) -#define GET_TX_DESC_BAR_RTY_TH(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 14, 2) -#define GET_TX_DESC_MORE_FRAG(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 17, 1) -#define GET_TX_DESC_RAW(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 18, 1) -#define GET_TX_DESC_CCX(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 19, 1) -#define GET_TX_DESC_AMPDU_DENSITY(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 20, 3) -#define GET_TX_DESC_ANTSEL_A(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 24, 1) -#define GET_TX_DESC_ANTSEL_B(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 25, 1) -#define GET_TX_DESC_TX_ANT_CCK(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 26, 2) -#define GET_TX_DESC_TX_ANTL(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 28, 2) -#define GET_TX_DESC_TX_ANT_HT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 30, 2) - -#define SET_TX_DESC_NEXT_HEAP_PAGE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+12, 0, 8, __val) -#define SET_TX_DESC_TAIL_PAGE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+12, 8, 8, __val) -#define SET_TX_DESC_SEQ(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+12, 16, 12, __val) -#define SET_TX_DESC_PKT_ID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+12, 28, 4, __val) - -#define GET_TX_DESC_NEXT_HEAP_PAGE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 0, 8) -#define GET_TX_DESC_TAIL_PAGE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 8, 8) -#define GET_TX_DESC_SEQ(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 16, 12) -#define GET_TX_DESC_PKT_ID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 28, 4) - -#define SET_TX_DESC_RTS_RATE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 0, 5, __val) -#define SET_TX_DESC_AP_DCFE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 5, 1, __val) -#define SET_TX_DESC_QOS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 6, 1, __val) -#define SET_TX_DESC_HWSEQ_EN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 7, 1, __val) -#define SET_TX_DESC_USE_RATE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 8, 1, __val) -#define SET_TX_DESC_DISABLE_RTS_FB(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 9, 1, __val) -#define SET_TX_DESC_DISABLE_FB(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 10, 1, __val) -#define SET_TX_DESC_CTS2SELF(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 11, 1, __val) -#define SET_TX_DESC_RTS_ENABLE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 12, 1, __val) -#define SET_TX_DESC_HW_RTS_ENABLE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 13, 1, __val) -#define SET_TX_DESC_PORT_ID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 14, 1, __val) -#define SET_TX_DESC_WAIT_DCTS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 18, 1, __val) -#define SET_TX_DESC_CTS2AP_EN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 19, 1, __val) -#define SET_TX_DESC_TX_SUB_CARRIER(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 20, 2, __val) -#define SET_TX_DESC_TX_STBC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 22, 2, __val) -#define SET_TX_DESC_DATA_SHORT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 24, 1, __val) -#define SET_TX_DESC_DATA_BW(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 25, 1, __val) -#define SET_TX_DESC_RTS_SHORT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 26, 1, __val) -#define SET_TX_DESC_RTS_BW(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 27, 1, __val) -#define SET_TX_DESC_RTS_SC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 28, 2, __val) -#define SET_TX_DESC_RTS_STBC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+16, 30, 2, __val) - -#define GET_TX_DESC_RTS_RATE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 0, 5) -#define GET_TX_DESC_AP_DCFE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 5, 1) -#define GET_TX_DESC_QOS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 6, 1) -#define GET_TX_DESC_HWSEQ_EN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 7, 1) -#define GET_TX_DESC_USE_RATE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 8, 1) -#define GET_TX_DESC_DISABLE_RTS_FB(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 9, 1) -#define GET_TX_DESC_DISABLE_FB(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 10, 1) -#define GET_TX_DESC_CTS2SELF(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 11, 1) -#define GET_TX_DESC_RTS_ENABLE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 12, 1) -#define GET_TX_DESC_HW_RTS_ENABLE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 13, 1) -#define GET_TX_DESC_PORT_ID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 14, 1) -#define GET_TX_DESC_WAIT_DCTS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 18, 1) -#define GET_TX_DESC_CTS2AP_EN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 19, 1) -#define GET_TX_DESC_TX_SUB_CARRIER(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 20, 2) -#define GET_TX_DESC_TX_STBC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 22, 2) -#define GET_TX_DESC_DATA_SHORT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 24, 1) -#define GET_TX_DESC_DATA_BW(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 25, 1) -#define GET_TX_DESC_RTS_SHORT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 26, 1) -#define GET_TX_DESC_RTS_BW(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 27, 1) -#define GET_TX_DESC_RTS_SC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 28, 2) -#define GET_TX_DESC_RTS_STBC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 30, 2) - -#define SET_TX_DESC_TX_RATE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 0, 6, __val) -#define SET_TX_DESC_DATA_SHORTGI(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 6, 1, __val) -#define SET_TX_DESC_CCX_TAG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 7, 1, __val) -#define SET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 8, 5, __val) -#define SET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 13, 4, __val) -#define SET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 17, 1, __val) -#define SET_TX_DESC_DATA_RETRY_LIMIT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 18, 6, __val) -#define SET_TX_DESC_USB_TXAGG_NUM(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+20, 24, 8, __val) - -#define GET_TX_DESC_TX_RATE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 0, 6) -#define GET_TX_DESC_DATA_SHORTGI(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 6, 1) -#define GET_TX_DESC_CCX_TAG(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 7, 1) -#define GET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 8, 5) -#define GET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 13, 4) -#define GET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 17, 1) -#define GET_TX_DESC_DATA_RETRY_LIMIT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 18, 6) -#define GET_TX_DESC_USB_TXAGG_NUM(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 24, 8) - -#define SET_TX_DESC_TXAGC_A(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 0, 5, __val) -#define SET_TX_DESC_TXAGC_B(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 5, 5, __val) -#define SET_TX_DESC_USE_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 10, 1, __val) -#define SET_TX_DESC_MAX_AGG_NUM(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 11, 5, __val) -#define SET_TX_DESC_MCSG1_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 16, 4, __val) -#define SET_TX_DESC_MCSG2_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 20, 4, __val) -#define SET_TX_DESC_MCSG3_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 24, 4, __val) -#define SET_TX_DESC_MCS7_SGI_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 28, 4, __val) - -#define GET_TX_DESC_TXAGC_A(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 0, 5) -#define GET_TX_DESC_TXAGC_B(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 5, 5) -#define GET_TX_DESC_USE_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 10, 1) -#define GET_TX_DESC_MAX_AGG_NUM(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 11, 5) -#define GET_TX_DESC_MCSG1_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 16, 4) -#define GET_TX_DESC_MCSG2_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 20, 4) -#define GET_TX_DESC_MCSG3_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 24, 4) -#define GET_TX_DESC_MCS7_SGI_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 28, 4) - -#define SET_TX_DESC_TX_BUFFER_SIZE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+28, 0, 16, __val) -#define SET_TX_DESC_MCSG4_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+28, 16, 4, __val) -#define SET_TX_DESC_MCSG5_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+28, 20, 4, __val) -#define SET_TX_DESC_MCSG6_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+28, 24, 4, __val) -#define SET_TX_DESC_MCS15_SGI_MAX_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+28, 28, 4, __val) - -#define GET_TX_DESC_TX_BUFFER_SIZE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+28, 0, 16) -#define GET_TX_DESC_MCSG4_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+28, 16, 4) -#define GET_TX_DESC_MCSG5_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+28, 20, 4) -#define GET_TX_DESC_MCSG6_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+28, 24, 4) -#define GET_TX_DESC_MCS15_SGI_MAX_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+28, 28, 4) - -#define SET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+32, 0, 32, __val) -#define SET_TX_DESC_TX_BUFFER_ADDRESS64(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+36, 0, 32, __val) - -#define GET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+32, 0, 32) -#define GET_TX_DESC_TX_BUFFER_ADDRESS64(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+36, 0, 32) - -#define SET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+40, 0, 32, __val) -#define SET_TX_DESC_NEXT_DESC_ADDRESS64(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+44, 0, 32, __val) - -#define GET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+40, 0, 32) -#define GET_TX_DESC_NEXT_DESC_ADDRESS64(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+44, 0, 32) - -#define GET_RX_DESC_PKT_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 0, 14) -#define GET_RX_DESC_CRC32(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 14, 1) -#define GET_RX_DESC_ICV(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 15, 1) -#define GET_RX_DESC_DRV_INFO_SIZE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 16, 4) -#define GET_RX_DESC_SECURITY(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 20, 3) -#define GET_RX_DESC_QOS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 23, 1) -#define GET_RX_DESC_SHIFT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 24, 2) -#define GET_RX_DESC_PHYST(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 26, 1) -#define GET_RX_DESC_SWDEC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 27, 1) -#define GET_RX_DESC_LS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 28, 1) -#define GET_RX_DESC_FS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 29, 1) -#define GET_RX_DESC_EOR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 30, 1) -#define GET_RX_DESC_OWN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 31, 1) - -#define SET_RX_DESC_PKT_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 0, 14, __val) -#define SET_RX_DESC_EOR(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 30, 1, __val) -#define SET_RX_DESC_OWN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 31, 1, __val) - -#define GET_RX_DESC_MACID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 0, 5) -#define GET_RX_DESC_TID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 5, 4) -#define GET_RX_DESC_HWRSVD(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 9, 5) -#define GET_RX_DESC_PAGGR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 14, 1) -#define GET_RX_DESC_FAGGR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 15, 1) -#define GET_RX_DESC_A1_FIT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 16, 4) -#define GET_RX_DESC_A2_FIT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 20, 4) -#define GET_RX_DESC_PAM(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 24, 1) -#define GET_RX_DESC_PWR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 25, 1) -#define GET_RX_DESC_MD(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 26, 1) -#define GET_RX_DESC_MF(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 27, 1) -#define GET_RX_DESC_TYPE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 28, 2) -#define GET_RX_DESC_MC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 30, 1) -#define GET_RX_DESC_BC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+4, 31, 1) -#define GET_RX_DESC_SEQ(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 0, 12) -#define GET_RX_DESC_FRAG(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 12, 4) -#define GET_RX_DESC_NEXT_PKT_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 16, 14) -#define GET_RX_DESC_NEXT_IND(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 30, 1) -#define GET_RX_DESC_RSVD(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+8, 31, 1) - -#define GET_RX_DESC_RXMCS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 0, 6) -#define GET_RX_DESC_RXHT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 6, 1) -#define GET_RX_DESC_SPLCP(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 8, 1) -#define GET_RX_DESC_BW(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 9, 1) -#define GET_RX_DESC_HTC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 10, 1) -#define GET_RX_DESC_HWPC_ERR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 14, 1) -#define GET_RX_DESC_HWPC_IND(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 15, 1) -#define GET_RX_DESC_IV0(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+12, 16, 16) - -#define GET_RX_DESC_IV1(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+16, 0, 32) -#define GET_RX_DESC_TSFL(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+20, 0, 32) - -#define GET_RX_DESC_BUFF_ADDR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+24, 0, 32) -#define GET_RX_DESC_BUFF_ADDR64(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc+28, 0, 32) - -#define SET_RX_DESC_BUFF_ADDR(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+24, 0, 32, __val) -#define SET_RX_DESC_BUFF_ADDR64(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc+28, 0, 32, __val) - -#define CLEAR_PCI_TX_DESC_CONTENT(__pdesc, _size) \ - memset((void *)__pdesc, 0, \ - min_t(size_t, _size, TX_DESC_NEXT_DESC_OFFSET)) - -/* For 92D early mode */ -#define SET_EARLYMODE_PKTNUM(__paddr, __value) \ - SET_BITS_OFFSET_LE(__paddr, 0, 3, __value) -#define SET_EARLYMODE_LEN0(__paddr, __value) \ - SET_BITS_OFFSET_LE(__paddr, 4, 12, __value) -#define SET_EARLYMODE_LEN1(__paddr, __value) \ - SET_BITS_OFFSET_LE(__paddr, 16, 12, __value) -#define SET_EARLYMODE_LEN2_1(__paddr, __value) \ - SET_BITS_OFFSET_LE(__paddr, 28, 4, __value) -#define SET_EARLYMODE_LEN2_2(__paddr, __value) \ - SET_BITS_OFFSET_LE(__paddr+4, 0, 8, __value) -#define SET_EARLYMODE_LEN3(__paddr, __value) \ - SET_BITS_OFFSET_LE(__paddr+4, 8, 12, __value) -#define SET_EARLYMODE_LEN4(__paddr, __value) \ - SET_BITS_OFFSET_LE(__paddr+4, 20, 12, __value) - -struct rx_fwinfo_92d { - u8 gain_trsw[4]; - u8 pwdb_all; - u8 cfosho[4]; - u8 cfotail[4]; - char rxevm[2]; - char rxsnr[4]; - u8 pdsnr[2]; - u8 csi_current[2]; - u8 csi_target[2]; - u8 sigevm; - u8 max_ex_pwr; - u8 ex_intf_flag:1; - u8 sgi_en:1; - u8 rxsc:2; - u8 reserve:4; -} __packed; - -struct tx_desc_92d { - u32 pktsize:16; - u32 offset:8; - u32 bmc:1; - u32 htc:1; - u32 lastseg:1; - u32 firstseg:1; - u32 linip:1; - u32 noacm:1; - u32 gf:1; - u32 own:1; - - u32 macid:5; - u32 agg_en:1; - u32 bk:1; - u32 rdg_en:1; - u32 queuesel:5; - u32 rd_nav_ext:1; - u32 lsig_txop_en:1; - u32 pifs:1; - u32 rateid:4; - u32 nav_usehdr:1; - u32 en_descid:1; - u32 sectype:2; - u32 pktoffset:8; - - u32 rts_rc:6; - u32 data_rc:6; - u32 rsvd0:2; - u32 bar_retryht:2; - u32 rsvd1:1; - u32 morefrag:1; - u32 raw:1; - u32 ccx:1; - u32 ampdudensity:3; - u32 rsvd2:1; - u32 ant_sela:1; - u32 ant_selb:1; - u32 txant_cck:2; - u32 txant_l:2; - u32 txant_ht:2; - - u32 nextheadpage:8; - u32 tailpage:8; - u32 seq:12; - u32 pktid:4; - - u32 rtsrate:5; - u32 apdcfe:1; - u32 qos:1; - u32 hwseq_enable:1; - u32 userrate:1; - u32 dis_rtsfb:1; - u32 dis_datafb:1; - u32 cts2self:1; - u32 rts_en:1; - u32 hwrts_en:1; - u32 portid:1; - u32 rsvd3:3; - u32 waitdcts:1; - u32 cts2ap_en:1; - u32 txsc:2; - u32 stbc:2; - u32 txshort:1; - u32 txbw:1; - u32 rtsshort:1; - u32 rtsbw:1; - u32 rtssc:2; - u32 rtsstbc:2; - - u32 txrate:6; - u32 shortgi:1; - u32 ccxt:1; - u32 txrate_fb_lmt:5; - u32 rtsrate_fb_lmt:4; - u32 retrylmt_en:1; - u32 txretrylmt:6; - u32 usb_txaggnum:8; - - u32 txagca:5; - u32 txagcb:5; - u32 usemaxlen:1; - u32 maxaggnum:5; - u32 mcsg1maxlen:4; - u32 mcsg2maxlen:4; - u32 mcsg3maxlen:4; - u32 mcs7sgimaxlen:4; - - u32 txbuffersize:16; - u32 mcsg4maxlen:4; - u32 mcsg5maxlen:4; - u32 mcsg6maxlen:4; - u32 mcsg15sgimaxlen:4; - - u32 txbuffaddr; - u32 txbufferaddr64; - u32 nextdescaddress; - u32 nextdescaddress64; - - u32 reserve_pass_pcie_mm_limit[4]; -} __packed; - -struct rx_desc_92d { - u32 length:14; - u32 crc32:1; - u32 icverror:1; - u32 drv_infosize:4; - u32 security:3; - u32 qos:1; - u32 shift:2; - u32 phystatus:1; - u32 swdec:1; - u32 lastseg:1; - u32 firstseg:1; - u32 eor:1; - u32 own:1; - - u32 macid:5; - u32 tid:4; - u32 hwrsvd:5; - u32 paggr:1; - u32 faggr:1; - u32 a1_fit:4; - u32 a2_fit:4; - u32 pam:1; - u32 pwr:1; - u32 moredata:1; - u32 morefrag:1; - u32 type:2; - u32 mc:1; - u32 bc:1; - - u32 seq:12; - u32 frag:4; - u32 nextpktlen:14; - u32 nextind:1; - u32 rsvd:1; - - u32 rxmcs:6; - u32 rxht:1; - u32 amsdu:1; - u32 splcp:1; - u32 bandwidth:1; - u32 htc:1; - u32 tcpchk_rpt:1; - u32 ipcchk_rpt:1; - u32 tcpchk_valid:1; - u32 hwpcerr:1; - u32 hwpcind:1; - u32 iv0:16; - - u32 iv1; - - u32 tsfl; - - u32 bufferaddress; - u32 bufferaddress64; - -} __packed; - -void rtl92de_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, - u8 *pdesc, struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, u8 hw_queue, - struct rtl_tcb_desc *ptcb_desc); -bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, - struct rtl_stats *stats, - struct ieee80211_rx_status *rx_status, - u8 *pdesc, struct sk_buff *skb); -void rtl92de_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val); -u32 rtl92de_get_desc(u8 *pdesc, bool istx, u8 desc_name); -void rtl92de_tx_polling(struct ieee80211_hw *hw, u8 hw_queue); -void rtl92de_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, - bool b_firstseg, bool b_lastseg, - struct sk_buff *skb); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/Makefile b/drivers/net/wireless/rtlwifi/rtl8192se/Makefile deleted file mode 100644 index b7eb13819cbc..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -rtl8192se-objs := \ - dm.o \ - fw.o \ - hw.o \ - led.o \ - phy.o \ - rf.o \ - sw.o \ - table.o \ - trx.o - -obj-$(CONFIG_RTL8192SE) += rtl8192se.o - -ccflags-y += -D__CHECK_ENDIAN__ - diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/def.h b/drivers/net/wireless/rtlwifi/rtl8192se/def.h deleted file mode 100644 index 83c98674bfd3..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/def.h +++ /dev/null @@ -1,554 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ -#ifndef __REALTEK_92S_DEF_H__ -#define __REALTEK_92S_DEF_H__ - -#define RX_MPDU_QUEUE 0 -#define RX_CMD_QUEUE 1 -#define RX_MAX_QUEUE 2 - -#define SHORT_SLOT_TIME 9 -#define NON_SHORT_SLOT_TIME 20 - -/* Queue Select Value in TxDesc */ -#define QSLT_BK 0x2 -#define QSLT_BE 0x0 -#define QSLT_VI 0x5 -#define QSLT_VO 0x6 -#define QSLT_BEACON 0x10 -#define QSLT_HIGH 0x11 -#define QSLT_MGNT 0x12 -#define QSLT_CMD 0x13 - -/* Tx Desc */ -#define TX_DESC_SIZE_RTL8192S (16 * 4) -#define TX_CMDDESC_SIZE_RTL8192S (16 * 4) - -/* Define a macro that takes a le32 word, converts it to host ordering, - * right shifts by a specified count, creates a mask of the specified - * bit count, and extracts that number of bits. - */ - -#define SHIFT_AND_MASK_LE(__pdesc, __shift, __mask) \ - ((le32_to_cpu(*(((__le32 *)(__pdesc)))) >> (__shift)) & \ - BIT_LEN_MASK_32(__mask)) - -/* Define a macro that clears a bit field in an le32 word and - * sets the specified value into that bit field. The resulting - * value remains in le32 ordering; however, it is properly converted - * to host ordering for the clear and set operations before conversion - * back to le32. - */ - -#define SET_BITS_OFFSET_LE(__pdesc, __shift, __len, __val) \ - (*(__le32 *)(__pdesc) = \ - (cpu_to_le32((le32_to_cpu(*((__le32 *)(__pdesc))) & \ - (~(BIT_OFFSET_LEN_MASK_32((__shift), __len)))) | \ - (((u32)(__val) & BIT_LEN_MASK_32(__len)) << (__shift))))); - -/* macros to read/write various fields in RX or TX descriptors */ - -/* Dword 0 */ -#define SET_TX_DESC_PKT_SIZE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 0, 16, __val) -#define SET_TX_DESC_OFFSET(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 16, 8, __val) -#define SET_TX_DESC_TYPE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 24, 2, __val) -#define SET_TX_DESC_LAST_SEG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 26, 1, __val) -#define SET_TX_DESC_FIRST_SEG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 27, 1, __val) -#define SET_TX_DESC_LINIP(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 28, 1, __val) -#define SET_TX_DESC_AMSDU(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 29, 1, __val) -#define SET_TX_DESC_GREEN_FIELD(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 30, 1, __val) -#define SET_TX_DESC_OWN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 31, 1, __val) - -#define GET_TX_DESC_OWN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 31, 1) - -/* Dword 1 */ -#define SET_TX_DESC_MACID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 0, 5, __val) -#define SET_TX_DESC_MORE_DATA(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 5, 1, __val) -#define SET_TX_DESC_MORE_FRAG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 6, 1, __val) -#define SET_TX_DESC_PIFS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 7, 1, __val) -#define SET_TX_DESC_QUEUE_SEL(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 8, 5, __val) -#define SET_TX_DESC_ACK_POLICY(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 13, 2, __val) -#define SET_TX_DESC_NO_ACM(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 15, 1, __val) -#define SET_TX_DESC_NON_QOS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 16, 1, __val) -#define SET_TX_DESC_KEY_ID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 17, 2, __val) -#define SET_TX_DESC_OUI(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 19, 1, __val) -#define SET_TX_DESC_PKT_TYPE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 20, 1, __val) -#define SET_TX_DESC_EN_DESC_ID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 21, 1, __val) -#define SET_TX_DESC_SEC_TYPE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 22, 2, __val) -#define SET_TX_DESC_WDS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 24, 1, __val) -#define SET_TX_DESC_HTC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 25, 1, __val) -#define SET_TX_DESC_PKT_OFFSET(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 26, 5, __val) -#define SET_TX_DESC_HWPC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 27, 1, __val) - -/* Dword 2 */ -#define SET_TX_DESC_DATA_RETRY_LIMIT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 8, 0, 6, __val) -#define SET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 8, 6, 1, __val) -#define SET_TX_DESC_TSFL(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 8, 7, 5, __val) -#define SET_TX_DESC_RTS_RETRY_COUNT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 8, 12, 6, __val) -#define SET_TX_DESC_DATA_RETRY_COUNT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 8, 18, 6, __val) -#define SET_TX_DESC_RSVD_MACID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(((__pdesc) + 8), 24, 5, __val) -#define SET_TX_DESC_AGG_ENABLE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 8, 29, 1, __val) -#define SET_TX_DESC_AGG_BREAK(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 8, 30, 1, __val) -#define SET_TX_DESC_OWN_MAC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 8, 31, 1, __val) - -/* Dword 3 */ -#define SET_TX_DESC_NEXT_HEAP_PAGE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 0, 8, __val) -#define SET_TX_DESC_TAIL_PAGE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 8, 8, __val) -#define SET_TX_DESC_SEQ(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 16, 12, __val) -#define SET_TX_DESC_FRAG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 28, 4, __val) - -/* Dword 4 */ -#define SET_TX_DESC_RTS_RATE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 0, 6, __val) -#define SET_TX_DESC_DISABLE_RTS_FB(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 6, 1, __val) -#define SET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 7, 4, __val) -#define SET_TX_DESC_CTS_ENABLE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 11, 1, __val) -#define SET_TX_DESC_RTS_ENABLE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 12, 1, __val) -#define SET_TX_DESC_RA_BRSR_ID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 13, 3, __val) -#define SET_TX_DESC_TXHT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 16, 1, __val) -#define SET_TX_DESC_TX_SHORT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 17, 1, __val) -#define SET_TX_DESC_TX_BANDWIDTH(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 18, 1, __val) -#define SET_TX_DESC_TX_SUB_CARRIER(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 19, 2, __val) -#define SET_TX_DESC_TX_STBC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 21, 2, __val) -#define SET_TX_DESC_TX_REVERSE_DIRECTION(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 23, 1, __val) -#define SET_TX_DESC_RTS_HT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 24, 1, __val) -#define SET_TX_DESC_RTS_SHORT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 25, 1, __val) -#define SET_TX_DESC_RTS_BANDWIDTH(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 26, 1, __val) -#define SET_TX_DESC_RTS_SUB_CARRIER(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 27, 2, __val) -#define SET_TX_DESC_RTS_STBC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 29, 2, __val) -#define SET_TX_DESC_USER_RATE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 31, 1, __val) - -/* Dword 5 */ -#define SET_TX_DESC_PACKET_ID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 20, 0, 9, __val) -#define SET_TX_DESC_TX_RATE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 20, 9, 6, __val) -#define SET_TX_DESC_DISABLE_FB(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 20, 15, 1, __val) -#define SET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 20, 16, 5, __val) -#define SET_TX_DESC_TX_AGC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 20, 21, 11, __val) - -/* Dword 6 */ -#define SET_TX_DESC_IP_CHECK_SUM(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 24, 0, 16, __val) -#define SET_TX_DESC_TCP_CHECK_SUM(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 24, 16, 16, __val) - -/* Dword 7 */ -#define SET_TX_DESC_TX_BUFFER_SIZE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 28, 0, 16, __val) -#define SET_TX_DESC_IP_HEADER_OFFSET(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 28, 16, 8, __val) -#define SET_TX_DESC_TCP_ENABLE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 28, 31, 1, __val) - -/* Dword 8 */ -#define SET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 32, 0, 32, __val) -#define GET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 32, 0, 32) - -/* Dword 9 */ -#define SET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 36, 0, 32, __val) - -/* Because the PCI Tx descriptors are chaied at the - * initialization and all the NextDescAddresses in - * these descriptors cannot not be cleared (,or - * driver/HW cannot find the next descriptor), the - * offset 36 (NextDescAddresses) is reserved when - * the desc is cleared. */ -#define TX_DESC_NEXT_DESC_OFFSET 36 -#define CLEAR_PCI_TX_DESC_CONTENT(__pdesc, _size) \ - memset(__pdesc, 0, min_t(size_t, _size, TX_DESC_NEXT_DESC_OFFSET)) - -/* Rx Desc */ -#define RX_STATUS_DESC_SIZE 24 -#define RX_DRV_INFO_SIZE_UNIT 8 - -/* DWORD 0 */ -#define SET_RX_STATUS_DESC_PKT_LEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 0, 14, __val) -#define SET_RX_STATUS_DESC_CRC32(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 14, 1, __val) -#define SET_RX_STATUS_DESC_ICV(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 15, 1, __val) -#define SET_RX_STATUS_DESC_DRVINFO_SIZE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 16, 4, __val) -#define SET_RX_STATUS_DESC_SECURITY(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 20, 3, __val) -#define SET_RX_STATUS_DESC_QOS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 23, 1, __val) -#define SET_RX_STATUS_DESC_SHIFT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 24, 2, __val) -#define SET_RX_STATUS_DESC_PHY_STATUS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 26, 1, __val) -#define SET_RX_STATUS_DESC_SWDEC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 27, 1, __val) -#define SET_RX_STATUS_DESC_LAST_SEG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 28, 1, __val) -#define SET_RX_STATUS_DESC_FIRST_SEG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 29, 1, __val) -#define SET_RX_STATUS_DESC_EOR(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 30, 1, __val) -#define SET_RX_STATUS_DESC_OWN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc, 31, 1, __val) - -#define GET_RX_STATUS_DESC_PKT_LEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 0, 14) -#define GET_RX_STATUS_DESC_CRC32(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 14, 1) -#define GET_RX_STATUS_DESC_ICV(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 15, 1) -#define GET_RX_STATUS_DESC_DRVINFO_SIZE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 16, 4) -#define GET_RX_STATUS_DESC_SECURITY(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 20, 3) -#define GET_RX_STATUS_DESC_QOS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 23, 1) -#define GET_RX_STATUS_DESC_SHIFT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 24, 2) -#define GET_RX_STATUS_DESC_PHY_STATUS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 26, 1) -#define GET_RX_STATUS_DESC_SWDEC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 27, 1) -#define GET_RX_STATUS_DESC_LAST_SEG(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 28, 1) -#define GET_RX_STATUS_DESC_FIRST_SEG(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 29, 1) -#define GET_RX_STATUS_DESC_EOR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 30, 1) -#define GET_RX_STATUS_DESC_OWN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc, 31, 1) - -/* DWORD 1 */ -#define SET_RX_STATUS_DESC_MACID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 0, 5, __val) -#define SET_RX_STATUS_DESC_TID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 5, 4, __val) -#define SET_RX_STATUS_DESC_PAGGR(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 14, 1, __val) -#define SET_RX_STATUS_DESC_FAGGR(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 15, 1, __val) -#define SET_RX_STATUS_DESC_A1_FIT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 16, 4, __val) -#define SET_RX_STATUS_DESC_A2_FIT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 20, 4, __val) -#define SET_RX_STATUS_DESC_PAM(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 24, 1, __val) -#define SET_RX_STATUS_DESC_PWR(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 25, 1, __val) -#define SET_RX_STATUS_DESC_MOREDATA(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 26, 1, __val) -#define SET_RX_STATUS_DESC_MOREFRAG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 27, 1, __val) -#define SET_RX_STATUS_DESC_TYPE(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 28, 2, __val) -#define SET_RX_STATUS_DESC_MC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 30, 1, __val) -#define SET_RX_STATUS_DESC_BC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 4, 31, 1, __val) - -#define GET_RX_STATUS_DEC_MACID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 4, 0, 5) -#define GET_RX_STATUS_DESC_TID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 4, 5, 4) -#define GET_RX_STATUS_DESC_PAGGR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 4, 14, 1) -#define GET_RX_STATUS_DESC_FAGGR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 4, 15, 1) -#define GET_RX_STATUS_DESC_A1_FIT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 4, 16, 4) -#define GET_RX_STATUS_DESC_A2_FIT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 4, 20, 4) -#define GET_RX_STATUS_DESC_PAM(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 4, 24, 1) -#define GET_RX_STATUS_DESC_PWR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 4, 25, 1) -#define GET_RX_STATUS_DESC_MORE_DATA(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 4, 26, 1) -#define GET_RX_STATUS_DESC_MORE_FRAG(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 4, 27, 1) -#define GET_RX_STATUS_DESC_TYPE(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 4, 28, 2) -#define GET_RX_STATUS_DESC_MC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 4, 30, 1) -#define GET_RX_STATUS_DESC_BC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 4, 31, 1) - -/* DWORD 2 */ -#define SET_RX_STATUS_DESC_SEQ(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 8, 0, 12, __val) -#define SET_RX_STATUS_DESC_FRAG(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 8, 12, 4, __val) -#define SET_RX_STATUS_DESC_NEXT_PKTLEN(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 8, 16, 8, __val) -#define SET_RX_STATUS_DESC_NEXT_IND(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 8, 30, 1, __val) - -#define GET_RX_STATUS_DESC_SEQ(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 8, 0, 12) -#define GET_RX_STATUS_DESC_FRAG(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 8, 12, 4) -#define GET_RX_STATUS_DESC_NEXT_PKTLEN(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 8, 16, 8) -#define GET_RX_STATUS_DESC_NEXT_IND(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 8, 30, 1) - -/* DWORD 3 */ -#define SET_RX_STATUS_DESC_RX_MCS(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 0, 6, __val) -#define SET_RX_STATUS_DESC_RX_HT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 6, 1, __val) -#define SET_RX_STATUS_DESC_AMSDU(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 7, 1, __val) -#define SET_RX_STATUS_DESC_SPLCP(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 8, 1, __val) -#define SET_RX_STATUS_DESC_BW(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 9, 1, __val) -#define SET_RX_STATUS_DESC_HTC(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 10, 1, __val) -#define SET_RX_STATUS_DESC_TCP_CHK_RPT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 11, 1, __val) -#define SET_RX_STATUS_DESC_IP_CHK_RPT(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 12, 1, __val) -#define SET_RX_STATUS_DESC_TCP_CHK_VALID(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 13, 1, __val) -#define SET_RX_STATUS_DESC_HWPC_ERR(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 14, 1, __val) -#define SET_RX_STATUS_DESC_HWPC_IND(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 15, 1, __val) -#define SET_RX_STATUS_DESC_IV0(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 12, 16, 16, __val) - -#define GET_RX_STATUS_DESC_RX_MCS(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 12, 0, 6) -#define GET_RX_STATUS_DESC_RX_HT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 12, 6, 1) -#define GET_RX_STATUS_DESC_AMSDU(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 12, 7, 1) -#define GET_RX_STATUS_DESC_SPLCP(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 12, 8, 1) -#define GET_RX_STATUS_DESC_BW(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 12, 9, 1) -#define GET_RX_STATUS_DESC_HTC(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 12, 10, 1) -#define GET_RX_STATUS_DESC_TCP_CHK_RPT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 12, 11, 1) -#define GET_RX_STATUS_DESC_IP_CHK_RPT(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 12, 12, 1) -#define GET_RX_STATUS_DESC_TCP_CHK_VALID(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 12, 13, 1) -#define GET_RX_STATUS_DESC_HWPC_ERR(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 12, 14, 1) -#define GET_RX_STATUS_DESC_HWPC_IND(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 12, 15, 1) -#define GET_RX_STATUS_DESC_IV0(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 12, 16, 16) - -/* DWORD 4 */ -#define SET_RX_STATUS_DESC_IV1(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 16, 0, 32, __val) -#define GET_RX_STATUS_DESC_IV1(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 16, 0, 32) - -/* DWORD 5 */ -#define SET_RX_STATUS_DESC_TSFL(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 20, 0, 32, __val) -#define GET_RX_STATUS_DESC_TSFL(__pdesc) \ - SHIFT_AND_MASK_LE(__pdesc + 20, 0, 32) - -/* DWORD 6 */ -#define SET_RX_STATUS__DESC_BUFF_ADDR(__pdesc, __val) \ - SET_BITS_OFFSET_LE(__pdesc + 24, 0, 32, __val) - -#define SE_RX_HAL_IS_CCK_RATE(_pdesc)\ - (GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC92_RATE1M || \ - GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC92_RATE2M || \ - GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC92_RATE5_5M ||\ - GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC92_RATE11M) - -enum rf_optype { - RF_OP_BY_SW_3WIRE = 0, - RF_OP_BY_FW, - RF_OP_MAX -}; - -enum ic_inferiority { - IC_INFERIORITY_A = 0, - IC_INFERIORITY_B = 1, -}; - -enum fwcmd_iotype { - /* For DIG DM */ - FW_CMD_DIG_ENABLE = 0, - FW_CMD_DIG_DISABLE = 1, - FW_CMD_DIG_HALT = 2, - FW_CMD_DIG_RESUME = 3, - /* For High Power DM */ - FW_CMD_HIGH_PWR_ENABLE = 4, - FW_CMD_HIGH_PWR_DISABLE = 5, - /* For Rate adaptive DM */ - FW_CMD_RA_RESET = 6, - FW_CMD_RA_ACTIVE = 7, - FW_CMD_RA_REFRESH_N = 8, - FW_CMD_RA_REFRESH_BG = 9, - FW_CMD_RA_INIT = 10, - /* For FW supported IQK */ - FW_CMD_IQK_INIT = 11, - /* Tx power tracking switch, - * MP driver only */ - FW_CMD_TXPWR_TRACK_ENABLE = 12, - /* Tx power tracking switch, - * MP driver only */ - FW_CMD_TXPWR_TRACK_DISABLE = 13, - /* Tx power tracking with thermal - * indication, for Normal driver */ - FW_CMD_TXPWR_TRACK_THERMAL = 14, - FW_CMD_PAUSE_DM_BY_SCAN = 15, - FW_CMD_RESUME_DM_BY_SCAN = 16, - FW_CMD_RA_REFRESH_N_COMB = 17, - FW_CMD_RA_REFRESH_BG_COMB = 18, - FW_CMD_ANTENNA_SW_ENABLE = 19, - FW_CMD_ANTENNA_SW_DISABLE = 20, - /* Tx Status report for CCX from FW */ - FW_CMD_TX_FEEDBACK_CCX_ENABLE = 21, - /* Indifate firmware that driver - * enters LPS, For PS-Poll issue */ - FW_CMD_LPS_ENTER = 22, - /* Indicate firmware that driver - * leave LPS*/ - FW_CMD_LPS_LEAVE = 23, - /* Set DIG mode to signal strength */ - FW_CMD_DIG_MODE_SS = 24, - /* Set DIG mode to false alarm. */ - FW_CMD_DIG_MODE_FA = 25, - FW_CMD_ADD_A2_ENTRY = 26, - FW_CMD_CTRL_DM_BY_DRIVER = 27, - FW_CMD_CTRL_DM_BY_DRIVER_NEW = 28, - FW_CMD_PAPE_CONTROL = 29, - FW_CMD_IQK_ENABLE = 30, -}; - -/* Driver info contain PHY status - * and other variabel size info - * PHY Status content as below - */ -struct rx_fwinfo { - /* DWORD 0 */ - u8 gain_trsw[4]; - /* DWORD 1 */ - u8 pwdb_all; - u8 cfosho[4]; - /* DWORD 2 */ - u8 cfotail[4]; - /* DWORD 3 */ - s8 rxevm[2]; - s8 rxsnr[4]; - /* DWORD 4 */ - u8 pdsnr[2]; - /* DWORD 5 */ - u8 csi_current[2]; - u8 csi_target[2]; - /* DWORD 6 */ - u8 sigevm; - u8 max_ex_pwr; - u8 ex_intf_flag:1; - u8 sgi_en:1; - u8 rxsc:2; - u8 reserve:4; -}; - -struct phy_sts_cck_8192s_t { - u8 adc_pwdb_x[4]; - u8 sq_rpt; - u8 cck_agc_rpt; -}; - -#endif - diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/dm.c b/drivers/net/wireless/rtlwifi/rtl8192se/dm.c deleted file mode 100644 index b3a2d5ec59e6..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/dm.c +++ /dev/null @@ -1,742 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../base.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "fw.h" - -static const u32 edca_setting_dl[PEER_MAX] = { - 0xa44f, /* 0 UNKNOWN */ - 0x5ea44f, /* 1 REALTEK_90 */ - 0x5ea44f, /* 2 REALTEK_92SE */ - 0xa630, /* 3 BROAD */ - 0xa44f, /* 4 RAL */ - 0xa630, /* 5 ATH */ - 0xa630, /* 6 CISCO */ - 0xa42b, /* 7 MARV */ -}; - -static const u32 edca_setting_dl_gmode[PEER_MAX] = { - 0x4322, /* 0 UNKNOWN */ - 0xa44f, /* 1 REALTEK_90 */ - 0x5ea44f, /* 2 REALTEK_92SE */ - 0xa42b, /* 3 BROAD */ - 0x5e4322, /* 4 RAL */ - 0x4322, /* 5 ATH */ - 0xa430, /* 6 CISCO */ - 0x5ea44f, /* 7 MARV */ -}; - -static const u32 edca_setting_ul[PEER_MAX] = { - 0x5e4322, /* 0 UNKNOWN */ - 0xa44f, /* 1 REALTEK_90 */ - 0x5ea44f, /* 2 REALTEK_92SE */ - 0x5ea322, /* 3 BROAD */ - 0x5ea422, /* 4 RAL */ - 0x5ea322, /* 5 ATH */ - 0x3ea44f, /* 6 CISCO */ - 0x5ea44f, /* 7 MARV */ -}; - -static void _rtl92s_dm_check_edca_turbo(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - static u64 last_txok_cnt; - static u64 last_rxok_cnt; - u64 cur_txok_cnt = 0; - u64 cur_rxok_cnt = 0; - - u32 edca_be_ul = edca_setting_ul[mac->vendor]; - u32 edca_be_dl = edca_setting_dl[mac->vendor]; - u32 edca_gmode = edca_setting_dl_gmode[mac->vendor]; - - if (mac->link_state != MAC80211_LINKED) { - rtlpriv->dm.current_turbo_edca = false; - goto dm_checkedcaturbo_exit; - } - - if ((!rtlpriv->dm.is_any_nonbepkts) && - (!rtlpriv->dm.disable_framebursting)) { - cur_txok_cnt = rtlpriv->stats.txbytesunicast - last_txok_cnt; - cur_rxok_cnt = rtlpriv->stats.rxbytesunicast - last_rxok_cnt; - - if (rtlpriv->phy.rf_type == RF_1T2R) { - if (cur_txok_cnt > 4 * cur_rxok_cnt) { - /* Uplink TP is present. */ - if (rtlpriv->dm.is_cur_rdlstate || - !rtlpriv->dm.current_turbo_edca) { - rtl_write_dword(rtlpriv, EDCAPARA_BE, - edca_be_ul); - rtlpriv->dm.is_cur_rdlstate = false; - } - } else {/* Balance TP is present. */ - if (!rtlpriv->dm.is_cur_rdlstate || - !rtlpriv->dm.current_turbo_edca) { - if (mac->mode == WIRELESS_MODE_G || - mac->mode == WIRELESS_MODE_B) - rtl_write_dword(rtlpriv, - EDCAPARA_BE, - edca_gmode); - else - rtl_write_dword(rtlpriv, - EDCAPARA_BE, - edca_be_dl); - rtlpriv->dm.is_cur_rdlstate = true; - } - } - rtlpriv->dm.current_turbo_edca = true; - } else { - if (cur_rxok_cnt > 4 * cur_txok_cnt) { - if (!rtlpriv->dm.is_cur_rdlstate || - !rtlpriv->dm.current_turbo_edca) { - if (mac->mode == WIRELESS_MODE_G || - mac->mode == WIRELESS_MODE_B) - rtl_write_dword(rtlpriv, - EDCAPARA_BE, - edca_gmode); - else - rtl_write_dword(rtlpriv, - EDCAPARA_BE, - edca_be_dl); - rtlpriv->dm.is_cur_rdlstate = true; - } - } else { - if (rtlpriv->dm.is_cur_rdlstate || - !rtlpriv->dm.current_turbo_edca) { - rtl_write_dword(rtlpriv, EDCAPARA_BE, - edca_be_ul); - rtlpriv->dm.is_cur_rdlstate = false; - } - } - rtlpriv->dm.current_turbo_edca = true; - } - } else { - if (rtlpriv->dm.current_turbo_edca) { - u8 tmp = AC0_BE; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_AC_PARAM, - &tmp); - rtlpriv->dm.current_turbo_edca = false; - } - } - -dm_checkedcaturbo_exit: - rtlpriv->dm.is_any_nonbepkts = false; - last_txok_cnt = rtlpriv->stats.txbytesunicast; - last_rxok_cnt = rtlpriv->stats.rxbytesunicast; -} - -static void _rtl92s_dm_txpowertracking_callback_thermalmeter( - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 thermalvalue = 0; - u32 fw_cmd = 0; - - rtlpriv->dm.txpower_trackinginit = true; - - thermalvalue = (u8)rtl_get_rfreg(hw, RF90_PATH_A, RF_T_METER, 0x1f); - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermal meter 0x%x\n", - thermalvalue, - rtlpriv->dm.thermalvalue, rtlefuse->eeprom_thermalmeter); - - if (thermalvalue) { - rtlpriv->dm.thermalvalue = thermalvalue; - if (hal_get_firmwareversion(rtlpriv) >= 0x35) { - rtl92s_phy_set_fw_cmd(hw, FW_CMD_TXPWR_TRACK_THERMAL); - } else { - fw_cmd = (FW_TXPWR_TRACK_THERMAL | - (rtlpriv->efuse.thermalmeter[0] << 8) | - (thermalvalue << 16)); - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "Write to FW Thermal Val = 0x%x\n", fw_cmd); - - rtl_write_dword(rtlpriv, WFM5, fw_cmd); - rtl92s_phy_chk_fwcmd_iodone(hw); - } - } - - rtlpriv->dm.txpowercount = 0; -} - -static void _rtl92s_dm_check_txpowertracking_thermalmeter( - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - static u8 tm_trigger; - u8 tx_power_checkcnt = 5; - - /* 2T2R TP issue */ - if (rtlphy->rf_type == RF_2T2R) - return; - - if (!rtlpriv->dm.txpower_tracking) - return; - - if (rtlpriv->dm.txpowercount <= tx_power_checkcnt) { - rtlpriv->dm.txpowercount++; - return; - } - - if (!tm_trigger) { - rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER, - RFREG_OFFSET_MASK, 0x60); - tm_trigger = 1; - } else { - _rtl92s_dm_txpowertracking_callback_thermalmeter(hw); - tm_trigger = 0; - } -} - -static void _rtl92s_dm_refresh_rateadaptive_mask(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rate_adaptive *ra = &(rtlpriv->ra); - struct ieee80211_sta *sta = NULL; - u32 low_rssi_thresh = 0; - u32 middle_rssi_thresh = 0; - u32 high_rssi_thresh = 0; - - if (is_hal_stop(rtlhal)) - return; - - if (!rtlpriv->dm.useramask) - return; - - if (hal_get_firmwareversion(rtlpriv) >= 61 && - !rtlpriv->dm.inform_fw_driverctrldm) { - rtl92s_phy_set_fw_cmd(hw, FW_CMD_CTRL_DM_BY_DRIVER); - rtlpriv->dm.inform_fw_driverctrldm = true; - } - - if ((mac->link_state == MAC80211_LINKED) && - (mac->opmode == NL80211_IFTYPE_STATION)) { - switch (ra->pre_ratr_state) { - case DM_RATR_STA_HIGH: - high_rssi_thresh = 40; - middle_rssi_thresh = 30; - low_rssi_thresh = 20; - break; - case DM_RATR_STA_MIDDLE: - high_rssi_thresh = 44; - middle_rssi_thresh = 30; - low_rssi_thresh = 20; - break; - case DM_RATR_STA_LOW: - high_rssi_thresh = 44; - middle_rssi_thresh = 34; - low_rssi_thresh = 20; - break; - case DM_RATR_STA_ULTRALOW: - high_rssi_thresh = 44; - middle_rssi_thresh = 34; - low_rssi_thresh = 24; - break; - default: - high_rssi_thresh = 44; - middle_rssi_thresh = 34; - low_rssi_thresh = 24; - break; - } - - if (rtlpriv->dm.undec_sm_pwdb > (long)high_rssi_thresh) { - ra->ratr_state = DM_RATR_STA_HIGH; - } else if (rtlpriv->dm.undec_sm_pwdb > - (long)middle_rssi_thresh) { - ra->ratr_state = DM_RATR_STA_LOW; - } else if (rtlpriv->dm.undec_sm_pwdb > - (long)low_rssi_thresh) { - ra->ratr_state = DM_RATR_STA_LOW; - } else { - ra->ratr_state = DM_RATR_STA_ULTRALOW; - } - - if (ra->pre_ratr_state != ra->ratr_state) { - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, - "RSSI = %ld RSSI_LEVEL = %d PreState = %d, CurState = %d\n", - rtlpriv->dm.undec_sm_pwdb, ra->ratr_state, - ra->pre_ratr_state, ra->ratr_state); - - rcu_read_lock(); - sta = rtl_find_sta(hw, mac->bssid); - if (sta) - rtlpriv->cfg->ops->update_rate_tbl(hw, sta, - ra->ratr_state); - rcu_read_unlock(); - - ra->pre_ratr_state = ra->ratr_state; - } - } -} - -static void _rtl92s_dm_switch_baseband_mrc(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - bool current_mrc; - bool enable_mrc = true; - long tmpentry_maxpwdb = 0; - u8 rssi_a = 0; - u8 rssi_b = 0; - - if (is_hal_stop(rtlhal)) - return; - - if ((rtlphy->rf_type == RF_1T1R) || (rtlphy->rf_type == RF_2T2R)) - return; - - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_MRC, (u8 *)(¤t_mrc)); - - if (mac->link_state >= MAC80211_LINKED) { - if (rtlpriv->dm.undec_sm_pwdb > tmpentry_maxpwdb) { - rssi_a = rtlpriv->stats.rx_rssi_percentage[RF90_PATH_A]; - rssi_b = rtlpriv->stats.rx_rssi_percentage[RF90_PATH_B]; - } - } - - /* MRC settings would NOT affect TP on Wireless B mode. */ - if (mac->mode != WIRELESS_MODE_B) { - if ((rssi_a == 0) && (rssi_b == 0)) { - enable_mrc = true; - } else if (rssi_b > 30) { - /* Turn on B-Path */ - enable_mrc = true; - } else if (rssi_b < 5) { - /* Turn off B-path */ - enable_mrc = false; - /* Take care of RSSI differentiation. */ - } else if (rssi_a > 15 && (rssi_a >= rssi_b)) { - if ((rssi_a - rssi_b) > 15) - /* Turn off B-path */ - enable_mrc = false; - else if ((rssi_a - rssi_b) < 10) - /* Turn on B-Path */ - enable_mrc = true; - else - enable_mrc = current_mrc; - } else { - /* Turn on B-Path */ - enable_mrc = true; - } - } - - /* Update MRC settings if needed. */ - if (enable_mrc != current_mrc) - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_MRC, - (u8 *)&enable_mrc); - -} - -void rtl92s_dm_init_edca_turbo(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.current_turbo_edca = false; - rtlpriv->dm.is_any_nonbepkts = false; - rtlpriv->dm.is_cur_rdlstate = false; -} - -static void _rtl92s_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rate_adaptive *ra = &(rtlpriv->ra); - - ra->ratr_state = DM_RATR_STA_MAX; - ra->pre_ratr_state = DM_RATR_STA_MAX; - - if (rtlpriv->dm.dm_type == DM_TYPE_BYDRIVER && - hal_get_firmwareversion(rtlpriv) >= 60) - rtlpriv->dm.useramask = true; - else - rtlpriv->dm.useramask = false; - - rtlpriv->dm.useramask = false; - rtlpriv->dm.inform_fw_driverctrldm = false; -} - -static void _rtl92s_dm_init_txpowertracking_thermalmeter( - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.txpower_tracking = true; - rtlpriv->dm.txpowercount = 0; - rtlpriv->dm.txpower_trackinginit = false; -} - -static void _rtl92s_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); - u32 ret_value; - - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER1, MASKDWORD); - falsealm_cnt->cnt_parity_fail = ((ret_value & 0xffff0000) >> 16); - - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER2, MASKDWORD); - falsealm_cnt->cnt_rate_illegal = (ret_value & 0xffff); - falsealm_cnt->cnt_crc8_fail = ((ret_value & 0xffff0000) >> 16); - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER3, MASKDWORD); - falsealm_cnt->cnt_mcs_fail = (ret_value & 0xffff); - - falsealm_cnt->cnt_ofdm_fail = falsealm_cnt->cnt_parity_fail + - falsealm_cnt->cnt_rate_illegal + falsealm_cnt->cnt_crc8_fail + - falsealm_cnt->cnt_mcs_fail; - - /* read CCK false alarm */ - ret_value = rtl_get_bbreg(hw, 0xc64, MASKDWORD); - falsealm_cnt->cnt_cck_fail = (ret_value & 0xffff); - falsealm_cnt->cnt_all = falsealm_cnt->cnt_ofdm_fail + - falsealm_cnt->cnt_cck_fail; -} - -static void rtl92s_backoff_enable_flag(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *digtable = &rtlpriv->dm_digtable; - struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); - - if (falsealm_cnt->cnt_all > digtable->fa_highthresh) { - if ((digtable->back_val - 6) < - digtable->backoffval_range_min) - digtable->back_val = digtable->backoffval_range_min; - else - digtable->back_val -= 6; - } else if (falsealm_cnt->cnt_all < digtable->fa_lowthresh) { - if ((digtable->back_val + 6) > - digtable->backoffval_range_max) - digtable->back_val = - digtable->backoffval_range_max; - else - digtable->back_val += 6; - } -} - -static void _rtl92s_dm_initial_gain_sta_beforeconnect(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *digtable = &rtlpriv->dm_digtable; - struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); - static u8 initialized, force_write; - u8 initial_gain = 0; - - if ((digtable->pre_sta_cstate == digtable->cur_sta_cstate) || - (digtable->cur_sta_cstate == DIG_STA_BEFORE_CONNECT)) { - if (digtable->cur_sta_cstate == DIG_STA_BEFORE_CONNECT) { - if (rtlpriv->psc.rfpwr_state != ERFON) - return; - - if (digtable->backoff_enable_flag) - rtl92s_backoff_enable_flag(hw); - else - digtable->back_val = DM_DIG_BACKOFF; - - if ((digtable->rssi_val + 10 - digtable->back_val) > - digtable->rx_gain_max) - digtable->cur_igvalue = - digtable->rx_gain_max; - else if ((digtable->rssi_val + 10 - digtable->back_val) - < digtable->rx_gain_min) - digtable->cur_igvalue = - digtable->rx_gain_min; - else - digtable->cur_igvalue = digtable->rssi_val + 10 - - digtable->back_val; - - if (falsealm_cnt->cnt_all > 10000) - digtable->cur_igvalue = - (digtable->cur_igvalue > 0x33) ? - digtable->cur_igvalue : 0x33; - - if (falsealm_cnt->cnt_all > 16000) - digtable->cur_igvalue = - digtable->rx_gain_max; - /* connected -> connected or disconnected -> disconnected */ - } else { - /* Firmware control DIG, do nothing in driver dm */ - return; - } - /* disconnected -> connected or connected -> - * disconnected or beforeconnect->(dis)connected */ - } else { - /* Enable FW DIG */ - digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; - rtl92s_phy_set_fw_cmd(hw, FW_CMD_DIG_ENABLE); - - digtable->back_val = DM_DIG_BACKOFF; - digtable->cur_igvalue = rtlpriv->phy.default_initialgain[0]; - digtable->pre_igvalue = 0; - return; - } - - /* Forced writing to prevent from fw-dig overwriting. */ - if (digtable->pre_igvalue != rtl_get_bbreg(hw, ROFDM0_XAAGCCORE1, - MASKBYTE0)) - force_write = 1; - - if ((digtable->pre_igvalue != digtable->cur_igvalue) || - !initialized || force_write) { - /* Disable FW DIG */ - rtl92s_phy_set_fw_cmd(hw, FW_CMD_DIG_DISABLE); - - initial_gain = (u8)digtable->cur_igvalue; - - /* Set initial gain. */ - rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, MASKBYTE0, initial_gain); - rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, MASKBYTE0, initial_gain); - digtable->pre_igvalue = digtable->cur_igvalue; - initialized = 1; - force_write = 0; - } -} - -static void _rtl92s_dm_ctrl_initgain_bytwoport(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dig = &rtlpriv->dm_digtable; - - if (rtlpriv->mac80211.act_scanning) - return; - - /* Decide the current status and if modify initial gain or not */ - if (rtlpriv->mac80211.link_state >= MAC80211_LINKED || - rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC) - dig->cur_sta_cstate = DIG_STA_CONNECT; - else - dig->cur_sta_cstate = DIG_STA_DISCONNECT; - - dig->rssi_val = rtlpriv->dm.undec_sm_pwdb; - - /* Change dig mode to rssi */ - if (dig->cur_sta_cstate != DIG_STA_DISCONNECT) { - if (dig->dig_twoport_algorithm == - DIG_TWO_PORT_ALGO_FALSE_ALARM) { - dig->dig_twoport_algorithm = DIG_TWO_PORT_ALGO_RSSI; - rtl92s_phy_set_fw_cmd(hw, FW_CMD_DIG_MODE_SS); - } - } - - _rtl92s_dm_false_alarm_counter_statistics(hw); - _rtl92s_dm_initial_gain_sta_beforeconnect(hw); - - dig->pre_sta_cstate = dig->cur_sta_cstate; -} - -static void _rtl92s_dm_ctrl_initgain_byrssi(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct dig_t *digtable = &rtlpriv->dm_digtable; - - /* 2T2R TP issue */ - if (rtlphy->rf_type == RF_2T2R) - return; - - if (!rtlpriv->dm.dm_initialgain_enable) - return; - - if (digtable->dig_enable_flag == false) - return; - - _rtl92s_dm_ctrl_initgain_bytwoport(hw); -} - -static void _rtl92s_dm_dynamic_txpower(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - long undec_sm_pwdb; - long txpwr_threshold_lv1, txpwr_threshold_lv2; - - /* 2T2R TP issue */ - if (rtlphy->rf_type == RF_2T2R) - return; - - if (!rtlpriv->dm.dynamic_txpower_enable || - rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) { - rtlpriv->dm.dynamic_txhighpower_lvl = TX_HIGHPWR_LEVEL_NORMAL; - return; - } - - if ((mac->link_state < MAC80211_LINKED) && - (rtlpriv->dm.entry_min_undec_sm_pwdb == 0)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, - "Not connected to any\n"); - - rtlpriv->dm.dynamic_txhighpower_lvl = TX_HIGHPWR_LEVEL_NORMAL; - - rtlpriv->dm.last_dtp_lvl = TX_HIGHPWR_LEVEL_NORMAL; - return; - } - - if (mac->link_state >= MAC80211_LINKED) { - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "AP Client PWDB = 0x%lx\n", - undec_sm_pwdb); - } else { - undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "STA Default Port PWDB = 0x%lx\n", - undec_sm_pwdb); - } - } else { - undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb; - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "AP Ext Port PWDB = 0x%lx\n", - undec_sm_pwdb); - } - - txpwr_threshold_lv2 = TX_POWER_NEAR_FIELD_THRESH_LVL2; - txpwr_threshold_lv1 = TX_POWER_NEAR_FIELD_THRESH_LVL1; - - if (rtl_get_bbreg(hw, 0xc90, MASKBYTE0) == 1) - rtlpriv->dm.dynamic_txhighpower_lvl = TX_HIGHPWR_LEVEL_NORMAL; - else if (undec_sm_pwdb >= txpwr_threshold_lv2) - rtlpriv->dm.dynamic_txhighpower_lvl = TX_HIGHPWR_LEVEL_NORMAL2; - else if ((undec_sm_pwdb < (txpwr_threshold_lv2 - 3)) && - (undec_sm_pwdb >= txpwr_threshold_lv1)) - rtlpriv->dm.dynamic_txhighpower_lvl = TX_HIGHPWR_LEVEL_NORMAL1; - else if (undec_sm_pwdb < (txpwr_threshold_lv1 - 3)) - rtlpriv->dm.dynamic_txhighpower_lvl = TX_HIGHPWR_LEVEL_NORMAL; - - if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) - rtl92s_phy_set_txpower(hw, rtlphy->current_channel); - - rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl; -} - -static void _rtl92s_dm_init_dig(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *digtable = &rtlpriv->dm_digtable; - - /* Disable DIG scheme now.*/ - digtable->dig_enable_flag = true; - digtable->backoff_enable_flag = true; - - if ((rtlpriv->dm.dm_type == DM_TYPE_BYDRIVER) && - (hal_get_firmwareversion(rtlpriv) >= 0x3c)) - digtable->dig_algorithm = DIG_ALGO_BY_TOW_PORT; - else - digtable->dig_algorithm = - DIG_ALGO_BEFORE_CONNECT_BY_RSSI_AND_ALARM; - - digtable->dig_twoport_algorithm = DIG_TWO_PORT_ALGO_RSSI; - digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; - /* off=by real rssi value, on=by digtable->rssi_val for new dig */ - digtable->dig_dbgmode = DM_DBG_OFF; - digtable->dig_slgorithm_switch = 0; - - /* 2007/10/04 MH Define init gain threshol. */ - digtable->dig_state = DM_STA_DIG_MAX; - digtable->dig_highpwrstate = DM_STA_DIG_MAX; - - digtable->cur_sta_cstate = DIG_STA_DISCONNECT; - digtable->pre_sta_cstate = DIG_STA_DISCONNECT; - digtable->cur_ap_cstate = DIG_AP_DISCONNECT; - digtable->pre_ap_cstate = DIG_AP_DISCONNECT; - - digtable->rssi_lowthresh = DM_DIG_THRESH_LOW; - digtable->rssi_highthresh = DM_DIG_THRESH_HIGH; - - digtable->fa_lowthresh = DM_FALSEALARM_THRESH_LOW; - digtable->fa_highthresh = DM_FALSEALARM_THRESH_HIGH; - - digtable->rssi_highpower_lowthresh = DM_DIG_HIGH_PWR_THRESH_LOW; - digtable->rssi_highpower_highthresh = DM_DIG_HIGH_PWR_THRESH_HIGH; - - /* for dig debug rssi value */ - digtable->rssi_val = 50; - digtable->back_val = DM_DIG_BACKOFF; - digtable->rx_gain_max = DM_DIG_MAX; - - digtable->rx_gain_min = DM_DIG_MIN; - - digtable->backoffval_range_max = DM_DIG_BACKOFF_MAX; - digtable->backoffval_range_min = DM_DIG_BACKOFF_MIN; -} - -static void _rtl92s_dm_init_dynamic_txpower(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if ((hal_get_firmwareversion(rtlpriv) >= 60) && - (rtlpriv->dm.dm_type == DM_TYPE_BYDRIVER)) - rtlpriv->dm.dynamic_txpower_enable = true; - else - rtlpriv->dm.dynamic_txpower_enable = false; - - rtlpriv->dm.last_dtp_lvl = TX_HIGHPWR_LEVEL_NORMAL; - rtlpriv->dm.dynamic_txhighpower_lvl = TX_HIGHPWR_LEVEL_NORMAL; -} - -void rtl92s_dm_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.dm_type = DM_TYPE_BYDRIVER; - rtlpriv->dm.undec_sm_pwdb = -1; - - _rtl92s_dm_init_dynamic_txpower(hw); - rtl92s_dm_init_edca_turbo(hw); - _rtl92s_dm_init_rate_adaptive_mask(hw); - _rtl92s_dm_init_txpowertracking_thermalmeter(hw); - _rtl92s_dm_init_dig(hw); - - rtl_write_dword(rtlpriv, WFM5, FW_CCA_CHK_ENABLE); -} - -void rtl92s_dm_watchdog(struct ieee80211_hw *hw) -{ - _rtl92s_dm_check_edca_turbo(hw); - _rtl92s_dm_check_txpowertracking_thermalmeter(hw); - _rtl92s_dm_ctrl_initgain_byrssi(hw); - _rtl92s_dm_dynamic_txpower(hw); - _rtl92s_dm_refresh_rateadaptive_mask(hw); - _rtl92s_dm_switch_baseband_mrc(hw); -} - diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/dm.h b/drivers/net/wireless/rtlwifi/rtl8192se/dm.h deleted file mode 100644 index 2e9052c8fe4b..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/dm.h +++ /dev/null @@ -1,120 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ -#ifndef __RTL_92S_DM_H__ -#define __RTL_92S_DM_H__ - -enum dm_dig_alg { - DIG_ALGO_BY_FALSE_ALARM = 0, - DIG_ALGO_BY_RSSI = 1, - DIG_ALGO_BEFORE_CONNECT_BY_RSSI_AND_ALARM = 2, - DIG_ALGO_BY_TOW_PORT = 3, - DIG_ALGO_MAX -}; - -enum dm_dig_two_port_alg { - DIG_TWO_PORT_ALGO_RSSI = 0, - DIG_TWO_PORT_ALGO_FALSE_ALARM = 1, -}; - -enum dm_dig_dbg { - DM_DBG_OFF = 0, - DM_DBG_ON = 1, - DM_DBG_MAX -}; - -enum dm_dig_sta { - DM_STA_DIG_OFF = 0, - DM_STA_DIG_ON, - DM_STA_DIG_MAX -}; - -enum dm_dig_connect { - DIG_STA_DISCONNECT = 0, - DIG_STA_CONNECT = 1, - DIG_STA_BEFORE_CONNECT = 2, - DIG_AP_DISCONNECT = 3, - DIG_AP_CONNECT = 4, - DIG_AP_ADD_STATION = 5, - DIG_CONNECT_MAX -}; - -enum dm_dig_ext_port_alg { - DIG_EXT_PORT_STAGE_0 = 0, - DIG_EXT_PORT_STAGE_1 = 1, - DIG_EXT_PORT_STAGE_2 = 2, - DIG_EXT_PORT_STAGE_3 = 3, - DIG_EXT_PORT_STAGE_MAX = 4, -}; - -enum dm_ratr_sta { - DM_RATR_STA_HIGH = 0, - DM_RATR_STA_MIDDLEHIGH = 1, - DM_RATR_STA_MIDDLE = 2, - DM_RATR_STA_MIDDLELOW = 3, - DM_RATR_STA_LOW = 4, - DM_RATR_STA_ULTRALOW = 5, - DM_RATR_STA_MAX -}; - -#define DM_TYPE_BYFW 0 -#define DM_TYPE_BYDRIVER 1 - -#define TX_HIGH_PWR_LEVEL_NORMAL 0 -#define TX_HIGH_PWR_LEVEL_LEVEL1 1 -#define TX_HIGH_PWR_LEVEL_LEVEL2 2 - -#define HAL_DM_DIG_DISABLE BIT(0) /* Disable Dig */ -#define HAL_DM_HIPWR_DISABLE BIT(1) /* Disable High Power */ - -#define TX_HIGHPWR_LEVEL_NORMAL 0 -#define TX_HIGHPWR_LEVEL_NORMAL1 1 -#define TX_HIGHPWR_LEVEL_NORMAL2 2 - -#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 -#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 - -#define DM_DIG_THRESH_HIGH 40 -#define DM_DIG_THRESH_LOW 35 -#define DM_FALSEALARM_THRESH_LOW 40 -#define DM_FALSEALARM_THRESH_HIGH 1000 -#define DM_DIG_HIGH_PWR_THRESH_HIGH 75 -#define DM_DIG_HIGH_PWR_THRESH_LOW 70 -#define DM_DIG_BACKOFF 12 -#define DM_DIG_MAX 0x3e -#define DM_DIG_MIN 0x1c -#define DM_DIG_MIN_Netcore 0x12 -#define DM_DIG_BACKOFF_MAX 12 -#define DM_DIG_BACKOFF_MIN -4 - -void rtl92s_dm_watchdog(struct ieee80211_hw *hw); -void rtl92s_dm_init(struct ieee80211_hw *hw); -void rtl92s_dm_init_edca_turbo(struct ieee80211_hw *hw); - -#endif - diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/fw.c b/drivers/net/wireless/rtlwifi/rtl8192se/fw.c deleted file mode 100644 index 380e7d4b1ccf..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/fw.c +++ /dev/null @@ -1,656 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../base.h" -#include "reg.h" -#include "def.h" -#include "fw.h" - -static void _rtl92s_fw_set_rqpn(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_dword(rtlpriv, RQPN, 0xffffffff); - rtl_write_dword(rtlpriv, RQPN + 4, 0xffffffff); - rtl_write_byte(rtlpriv, RQPN + 8, 0xff); - rtl_write_byte(rtlpriv, RQPN + 0xB, 0x80); -} - -static bool _rtl92s_firmware_enable_cpu(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 ichecktime = 200; - u16 tmpu2b; - u8 tmpu1b, cpustatus = 0; - - _rtl92s_fw_set_rqpn(hw); - - /* Enable CPU. */ - tmpu1b = rtl_read_byte(rtlpriv, SYS_CLKR); - /* AFE source */ - rtl_write_byte(rtlpriv, SYS_CLKR, (tmpu1b | SYS_CPU_CLKSEL)); - - tmpu2b = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN); - rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, (tmpu2b | FEN_CPUEN)); - - /* Polling IMEM Ready after CPU has refilled. */ - do { - cpustatus = rtl_read_byte(rtlpriv, TCR); - if (cpustatus & IMEM_RDY) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "IMEM Ready after CPU has refilled\n"); - break; - } - - udelay(100); - } while (ichecktime--); - - if (!(cpustatus & IMEM_RDY)) - return false; - - return true; -} - -static enum fw_status _rtl92s_firmware_get_nextstatus( - enum fw_status fw_currentstatus) -{ - enum fw_status next_fwstatus = 0; - - switch (fw_currentstatus) { - case FW_STATUS_INIT: - next_fwstatus = FW_STATUS_LOAD_IMEM; - break; - case FW_STATUS_LOAD_IMEM: - next_fwstatus = FW_STATUS_LOAD_EMEM; - break; - case FW_STATUS_LOAD_EMEM: - next_fwstatus = FW_STATUS_LOAD_DMEM; - break; - case FW_STATUS_LOAD_DMEM: - next_fwstatus = FW_STATUS_READY; - break; - default: - break; - } - - return next_fwstatus; -} - -static u8 _rtl92s_firmware_header_map_rftype(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - switch (rtlphy->rf_type) { - case RF_1T1R: - return 0x11; - break; - case RF_1T2R: - return 0x12; - break; - case RF_2T2R: - return 0x22; - break; - default: - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, "Unknown RF type(%x)\n", - rtlphy->rf_type); - break; - } - return 0x22; -} - -static void _rtl92s_firmwareheader_priveupdate(struct ieee80211_hw *hw, - struct fw_priv *pfw_priv) -{ - /* Update RF types for RATR settings. */ - pfw_priv->rf_config = _rtl92s_firmware_header_map_rftype(hw); -} - - - -static bool _rtl92s_cmd_send_packet(struct ieee80211_hw *hw, - struct sk_buff *skb, u8 last) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl8192_tx_ring *ring; - struct rtl_tx_desc *pdesc; - unsigned long flags; - u8 idx = 0; - - ring = &rtlpci->tx_ring[TXCMD_QUEUE]; - - spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); - - idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries; - pdesc = &ring->desc[idx]; - rtlpriv->cfg->ops->fill_tx_cmddesc(hw, (u8 *)pdesc, 1, 1, skb); - __skb_queue_tail(&ring->queue, skb); - - spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); - - return true; -} - -static bool _rtl92s_firmware_downloadcode(struct ieee80211_hw *hw, - u8 *code_virtual_address, u32 buffer_len) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct sk_buff *skb; - struct rtl_tcb_desc *tcb_desc; - unsigned char *seg_ptr; - u16 frag_threshold = MAX_FIRMWARE_CODE_SIZE; - u16 frag_length, frag_offset = 0; - u16 extra_descoffset = 0; - u8 last_inipkt = 0; - - _rtl92s_fw_set_rqpn(hw); - - if (buffer_len >= MAX_FIRMWARE_CODE_SIZE) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Size over FIRMWARE_CODE_SIZE!\n"); - - return false; - } - - extra_descoffset = 0; - - do { - if ((buffer_len - frag_offset) > frag_threshold) { - frag_length = frag_threshold + extra_descoffset; - } else { - frag_length = (u16)(buffer_len - frag_offset + - extra_descoffset); - last_inipkt = 1; - } - - /* Allocate skb buffer to contain firmware */ - /* info and tx descriptor info. */ - skb = dev_alloc_skb(frag_length); - if (!skb) - return false; - skb_reserve(skb, extra_descoffset); - seg_ptr = (u8 *)skb_put(skb, (u32)(frag_length - - extra_descoffset)); - memcpy(seg_ptr, code_virtual_address + frag_offset, - (u32)(frag_length - extra_descoffset)); - - tcb_desc = (struct rtl_tcb_desc *)(skb->cb); - tcb_desc->queue_index = TXCMD_QUEUE; - tcb_desc->cmd_or_init = DESC_PACKET_TYPE_INIT; - tcb_desc->last_inipkt = last_inipkt; - - _rtl92s_cmd_send_packet(hw, skb, last_inipkt); - - frag_offset += (frag_length - extra_descoffset); - - } while (frag_offset < buffer_len); - - rtl_write_byte(rtlpriv, TP_POLL, TPPOLL_CQ); - - return true ; -} - -static bool _rtl92s_firmware_checkready(struct ieee80211_hw *hw, - u8 loadfw_status) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rt_firmware *firmware = (struct rt_firmware *)rtlhal->pfirmware; - u32 tmpu4b; - u8 cpustatus = 0; - short pollingcnt = 1000; - bool rtstatus = true; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "LoadStaus(%d)\n", loadfw_status); - - firmware->fwstatus = (enum fw_status)loadfw_status; - - switch (loadfw_status) { - case FW_STATUS_LOAD_IMEM: - /* Polling IMEM code done. */ - do { - cpustatus = rtl_read_byte(rtlpriv, TCR); - if (cpustatus & IMEM_CODE_DONE) - break; - udelay(5); - } while (pollingcnt--); - - if (!(cpustatus & IMEM_CHK_RPT) || (pollingcnt <= 0)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "FW_STATUS_LOAD_IMEM FAIL CPU, Status=%x\n", - cpustatus); - goto status_check_fail; - } - break; - - case FW_STATUS_LOAD_EMEM: - /* Check Put Code OK and Turn On CPU */ - /* Polling EMEM code done. */ - do { - cpustatus = rtl_read_byte(rtlpriv, TCR); - if (cpustatus & EMEM_CODE_DONE) - break; - udelay(5); - } while (pollingcnt--); - - if (!(cpustatus & EMEM_CHK_RPT) || (pollingcnt <= 0)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "FW_STATUS_LOAD_EMEM FAIL CPU, Status=%x\n", - cpustatus); - goto status_check_fail; - } - - /* Turn On CPU */ - rtstatus = _rtl92s_firmware_enable_cpu(hw); - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Enable CPU fail!\n"); - goto status_check_fail; - } - break; - - case FW_STATUS_LOAD_DMEM: - /* Polling DMEM code done */ - do { - cpustatus = rtl_read_byte(rtlpriv, TCR); - if (cpustatus & DMEM_CODE_DONE) - break; - udelay(5); - } while (pollingcnt--); - - if (!(cpustatus & DMEM_CODE_DONE) || (pollingcnt <= 0)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Polling DMEM code done fail ! cpustatus(%#x)\n", - cpustatus); - goto status_check_fail; - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "DMEM code download success, cpustatus(%#x)\n", - cpustatus); - - /* Prevent Delay too much and being scheduled out */ - /* Polling Load Firmware ready */ - pollingcnt = 2000; - do { - cpustatus = rtl_read_byte(rtlpriv, TCR); - if (cpustatus & FWRDY) - break; - udelay(40); - } while (pollingcnt--); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Polling Load Firmware ready, cpustatus(%x)\n", - cpustatus); - - if (((cpustatus & LOAD_FW_READY) != LOAD_FW_READY) || - (pollingcnt <= 0)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Polling Load Firmware ready fail ! cpustatus(%x)\n", - cpustatus); - goto status_check_fail; - } - - /* If right here, we can set TCR/RCR to desired value */ - /* and config MAC lookback mode to normal mode */ - tmpu4b = rtl_read_dword(rtlpriv, TCR); - rtl_write_dword(rtlpriv, TCR, (tmpu4b & (~TCR_ICV))); - - tmpu4b = rtl_read_dword(rtlpriv, RCR); - rtl_write_dword(rtlpriv, RCR, (tmpu4b | RCR_APPFCS | - RCR_APP_ICV | RCR_APP_MIC)); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Current RCR settings(%#x)\n", tmpu4b); - - /* Set to normal mode. */ - rtl_write_byte(rtlpriv, LBKMD_SEL, LBK_NORMAL); - break; - - default: - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, - "Unknown status check!\n"); - rtstatus = false; - break; - } - -status_check_fail: - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "loadfw_status(%d), rtstatus(%x)\n", - loadfw_status, rtstatus); - return rtstatus; -} - -int rtl92s_download_fw(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rt_firmware *firmware = NULL; - struct fw_hdr *pfwheader; - struct fw_priv *pfw_priv = NULL; - u8 *puc_mappedfile = NULL; - u32 ul_filelength = 0; - u8 fwhdr_size = RT_8192S_FIRMWARE_HDR_SIZE; - u8 fwstatus = FW_STATUS_INIT; - bool rtstatus = true; - - if (rtlpriv->max_fw_size == 0 || !rtlhal->pfirmware) - return 1; - - firmware = (struct rt_firmware *)rtlhal->pfirmware; - firmware->fwstatus = FW_STATUS_INIT; - - puc_mappedfile = firmware->sz_fw_tmpbuffer; - - /* 1. Retrieve FW header. */ - firmware->pfwheader = (struct fw_hdr *) puc_mappedfile; - pfwheader = firmware->pfwheader; - firmware->firmwareversion = byte(pfwheader->version, 0); - firmware->pfwheader->fwpriv.hci_sel = 1;/* pcie */ - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "signature:%x, version:%x, size:%x, imemsize:%x, sram size:%x\n", - pfwheader->signature, - pfwheader->version, pfwheader->dmem_size, - pfwheader->img_imem_size, pfwheader->img_sram_size); - - /* 2. Retrieve IMEM image. */ - if ((pfwheader->img_imem_size == 0) || (pfwheader->img_imem_size > - sizeof(firmware->fw_imem))) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "memory for data image is less than IMEM required\n"); - goto fail; - } else { - puc_mappedfile += fwhdr_size; - - memcpy(firmware->fw_imem, puc_mappedfile, - pfwheader->img_imem_size); - firmware->fw_imem_len = pfwheader->img_imem_size; - } - - /* 3. Retriecve EMEM image. */ - if (pfwheader->img_sram_size > sizeof(firmware->fw_emem)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "memory for data image is less than EMEM required\n"); - goto fail; - } else { - puc_mappedfile += firmware->fw_imem_len; - - memcpy(firmware->fw_emem, puc_mappedfile, - pfwheader->img_sram_size); - firmware->fw_emem_len = pfwheader->img_sram_size; - } - - /* 4. download fw now */ - fwstatus = _rtl92s_firmware_get_nextstatus(firmware->fwstatus); - while (fwstatus != FW_STATUS_READY) { - /* Image buffer redirection. */ - switch (fwstatus) { - case FW_STATUS_LOAD_IMEM: - puc_mappedfile = firmware->fw_imem; - ul_filelength = firmware->fw_imem_len; - break; - case FW_STATUS_LOAD_EMEM: - puc_mappedfile = firmware->fw_emem; - ul_filelength = firmware->fw_emem_len; - break; - case FW_STATUS_LOAD_DMEM: - /* Partial update the content of header private. */ - pfwheader = firmware->pfwheader; - pfw_priv = &pfwheader->fwpriv; - _rtl92s_firmwareheader_priveupdate(hw, pfw_priv); - puc_mappedfile = (u8 *)(firmware->pfwheader) + - RT_8192S_FIRMWARE_HDR_EXCLUDE_PRI_SIZE; - ul_filelength = fwhdr_size - - RT_8192S_FIRMWARE_HDR_EXCLUDE_PRI_SIZE; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Unexpected Download step!!\n"); - goto fail; - break; - } - - /* <2> Download image file */ - rtstatus = _rtl92s_firmware_downloadcode(hw, puc_mappedfile, - ul_filelength); - - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "fail!\n"); - goto fail; - } - - /* <3> Check whether load FW process is ready */ - rtstatus = _rtl92s_firmware_checkready(hw, fwstatus); - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "fail!\n"); - goto fail; - } - - fwstatus = _rtl92s_firmware_get_nextstatus(firmware->fwstatus); - } - - return rtstatus; -fail: - return 0; -} - -static u32 _rtl92s_fill_h2c_cmd(struct sk_buff *skb, u32 h2cbufferlen, - u32 cmd_num, u32 *pelement_id, u32 *pcmd_len, - u8 **pcmb_buffer, u8 *cmd_start_seq) -{ - u32 totallen = 0, len = 0, tx_desclen = 0; - u32 pre_continueoffset = 0; - u8 *ph2c_buffer; - u8 i = 0; - - do { - /* 8 - Byte aligment */ - len = H2C_TX_CMD_HDR_LEN + N_BYTE_ALIGMENT(pcmd_len[i], 8); - - /* Buffer length is not enough */ - if (h2cbufferlen < totallen + len + tx_desclen) - break; - - /* Clear content */ - ph2c_buffer = (u8 *)skb_put(skb, (u32)len); - memset((ph2c_buffer + totallen + tx_desclen), 0, len); - - /* CMD len */ - SET_BITS_TO_LE_4BYTE((ph2c_buffer + totallen + tx_desclen), - 0, 16, pcmd_len[i]); - - /* CMD ID */ - SET_BITS_TO_LE_4BYTE((ph2c_buffer + totallen + tx_desclen), - 16, 8, pelement_id[i]); - - /* CMD Sequence */ - *cmd_start_seq = *cmd_start_seq % 0x80; - SET_BITS_TO_LE_4BYTE((ph2c_buffer + totallen + tx_desclen), - 24, 7, *cmd_start_seq); - ++*cmd_start_seq; - - /* Copy memory */ - memcpy((ph2c_buffer + totallen + tx_desclen + - H2C_TX_CMD_HDR_LEN), pcmb_buffer[i], pcmd_len[i]); - - /* CMD continue */ - /* set the continue in prevoius cmd. */ - if (i < cmd_num - 1) - SET_BITS_TO_LE_4BYTE((ph2c_buffer + pre_continueoffset), - 31, 1, 1); - - pre_continueoffset = totallen; - - totallen += len; - } while (++i < cmd_num); - - return totallen; -} - -static u32 _rtl92s_get_h2c_cmdlen(u32 h2cbufferlen, u32 cmd_num, u32 *pcmd_len) -{ - u32 totallen = 0, len = 0, tx_desclen = 0; - u8 i = 0; - - do { - /* 8 - Byte aligment */ - len = H2C_TX_CMD_HDR_LEN + N_BYTE_ALIGMENT(pcmd_len[i], 8); - - /* Buffer length is not enough */ - if (h2cbufferlen < totallen + len + tx_desclen) - break; - - totallen += len; - } while (++i < cmd_num); - - return totallen + tx_desclen; -} - -static bool _rtl92s_firmware_set_h2c_cmd(struct ieee80211_hw *hw, u8 h2c_cmd, - u8 *pcmd_buffer) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_tcb_desc *cb_desc; - struct sk_buff *skb; - u32 element_id = 0; - u32 cmd_len = 0; - u32 len; - - switch (h2c_cmd) { - case FW_H2C_SETPWRMODE: - element_id = H2C_SETPWRMODE_CMD ; - cmd_len = sizeof(struct h2c_set_pwrmode_parm); - break; - case FW_H2C_JOINBSSRPT: - element_id = H2C_JOINBSSRPT_CMD; - cmd_len = sizeof(struct h2c_joinbss_rpt_parm); - break; - case FW_H2C_WOWLAN_UPDATE_GTK: - element_id = H2C_WOWLAN_UPDATE_GTK_CMD; - cmd_len = sizeof(struct h2c_wpa_two_way_parm); - break; - case FW_H2C_WOWLAN_UPDATE_IV: - element_id = H2C_WOWLAN_UPDATE_IV_CMD; - cmd_len = sizeof(unsigned long long); - break; - case FW_H2C_WOWLAN_OFFLOAD: - element_id = H2C_WOWLAN_FW_OFFLOAD; - cmd_len = sizeof(u8); - break; - default: - break; - } - - len = _rtl92s_get_h2c_cmdlen(MAX_TRANSMIT_BUFFER_SIZE, 1, &cmd_len); - skb = dev_alloc_skb(len); - if (!skb) - return false; - cb_desc = (struct rtl_tcb_desc *)(skb->cb); - cb_desc->queue_index = TXCMD_QUEUE; - cb_desc->cmd_or_init = DESC_PACKET_TYPE_NORMAL; - cb_desc->last_inipkt = false; - - _rtl92s_fill_h2c_cmd(skb, MAX_TRANSMIT_BUFFER_SIZE, 1, &element_id, - &cmd_len, &pcmd_buffer, &rtlhal->h2c_txcmd_seq); - _rtl92s_cmd_send_packet(hw, skb, false); - rtlpriv->cfg->ops->tx_polling(hw, TXCMD_QUEUE); - - return true; -} - -void rtl92s_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 Mode) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct h2c_set_pwrmode_parm pwrmode; - u16 max_wakeup_period = 0; - - pwrmode.mode = Mode; - pwrmode.flag_low_traffic_en = 0; - pwrmode.flag_lpnav_en = 0; - pwrmode.flag_rf_low_snr_en = 0; - pwrmode.flag_dps_en = 0; - pwrmode.bcn_rx_en = 0; - pwrmode.bcn_to = 0; - SET_BITS_TO_LE_2BYTE((u8 *)(&pwrmode) + 8, 0, 16, - mac->vif->bss_conf.beacon_int); - pwrmode.app_itv = 0; - pwrmode.awake_bcn_itvl = ppsc->reg_max_lps_awakeintvl; - pwrmode.smart_ps = 1; - pwrmode.bcn_pass_period = 10; - - /* Set beacon pass count */ - if (pwrmode.mode == FW_PS_MIN_MODE) - max_wakeup_period = mac->vif->bss_conf.beacon_int; - else if (pwrmode.mode == FW_PS_MAX_MODE) - max_wakeup_period = mac->vif->bss_conf.beacon_int * - mac->vif->bss_conf.dtim_period; - - if (max_wakeup_period >= 500) - pwrmode.bcn_pass_cnt = 1; - else if ((max_wakeup_period >= 300) && (max_wakeup_period < 500)) - pwrmode.bcn_pass_cnt = 2; - else if ((max_wakeup_period >= 200) && (max_wakeup_period < 300)) - pwrmode.bcn_pass_cnt = 3; - else if ((max_wakeup_period >= 20) && (max_wakeup_period < 200)) - pwrmode.bcn_pass_cnt = 5; - else - pwrmode.bcn_pass_cnt = 1; - - _rtl92s_firmware_set_h2c_cmd(hw, FW_H2C_SETPWRMODE, (u8 *)&pwrmode); - -} - -void rtl92s_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, - u8 mstatus, u8 ps_qosinfo) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct h2c_joinbss_rpt_parm joinbss_rpt; - - joinbss_rpt.opmode = mstatus; - joinbss_rpt.ps_qos_info = ps_qosinfo; - joinbss_rpt.bssid[0] = mac->bssid[0]; - joinbss_rpt.bssid[1] = mac->bssid[1]; - joinbss_rpt.bssid[2] = mac->bssid[2]; - joinbss_rpt.bssid[3] = mac->bssid[3]; - joinbss_rpt.bssid[4] = mac->bssid[4]; - joinbss_rpt.bssid[5] = mac->bssid[5]; - SET_BITS_TO_LE_2BYTE((u8 *)(&joinbss_rpt) + 8, 0, 16, - mac->vif->bss_conf.beacon_int); - SET_BITS_TO_LE_2BYTE((u8 *)(&joinbss_rpt) + 10, 0, 16, mac->assoc_id); - - _rtl92s_firmware_set_h2c_cmd(hw, FW_H2C_JOINBSSRPT, (u8 *)&joinbss_rpt); -} - diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/fw.h b/drivers/net/wireless/rtlwifi/rtl8192se/fw.h deleted file mode 100644 index d53f4332464d..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/fw.h +++ /dev/null @@ -1,376 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ -#ifndef __REALTEK_FIRMWARE92S_H__ -#define __REALTEK_FIRMWARE92S_H__ - -#define RTL8190_MAX_FIRMWARE_CODE_SIZE 64000 -#define RTL8190_MAX_RAW_FIRMWARE_CODE_SIZE 90000 -#define RTL8190_CPU_START_OFFSET 0x80 -/* Firmware Local buffer size. 64k */ -#define MAX_FIRMWARE_CODE_SIZE 0xFF00 - -#define RT_8192S_FIRMWARE_HDR_SIZE 80 -#define RT_8192S_FIRMWARE_HDR_EXCLUDE_PRI_SIZE 32 - -/* support till 64 bit bus width OS */ -#define MAX_DEV_ADDR_SIZE 8 -#define MAX_FIRMWARE_INFORMATION_SIZE 32 -#define MAX_802_11_HEADER_LENGTH (40 + \ - MAX_FIRMWARE_INFORMATION_SIZE) -#define ENCRYPTION_MAX_OVERHEAD 128 -#define MAX_FRAGMENT_COUNT 8 -#define MAX_TRANSMIT_BUFFER_SIZE (1600 + \ - (MAX_802_11_HEADER_LENGTH + \ - ENCRYPTION_MAX_OVERHEAD) *\ - MAX_FRAGMENT_COUNT) - -#define H2C_TX_CMD_HDR_LEN 8 - -/* The following DM control code are for Reg0x364, */ -#define FW_DIG_ENABLE_CTL BIT(0) -#define FW_HIGH_PWR_ENABLE_CTL BIT(1) -#define FW_SS_CTL BIT(2) -#define FW_RA_INIT_CTL BIT(3) -#define FW_RA_BG_CTL BIT(4) -#define FW_RA_N_CTL BIT(5) -#define FW_PWR_TRK_CTL BIT(6) -#define FW_IQK_CTL BIT(7) -#define FW_FA_CTL BIT(8) -#define FW_DRIVER_CTRL_DM_CTL BIT(9) -#define FW_PAPE_CTL_BY_SW_HW BIT(10) -#define FW_DISABLE_ALL_DM 0 -#define FW_PWR_TRK_PARAM_CLR 0x0000ffff -#define FW_RA_PARAM_CLR 0xffff0000 - -enum desc_packet_type { - DESC_PACKET_TYPE_INIT = 0, - DESC_PACKET_TYPE_NORMAL = 1, -}; - -/* 8-bytes alignment required */ -struct fw_priv { - /* --- long word 0 ---- */ - /* 0x12: CE product, 0x92: IT product */ - u8 signature_0; - /* 0x87: CE product, 0x81: IT product */ - u8 signature_1; - /* 0x81: PCI-AP, 01:PCIe, 02: 92S-U, - * 0x82: USB-AP, 0x12: 72S-U, 03:SDIO */ - u8 hci_sel; - /* the same value as reigster value */ - u8 chip_version; - /* customer ID low byte */ - u8 customer_id_0; - /* customer ID high byte */ - u8 customer_id_1; - /* 0x11: 1T1R, 0x12: 1T2R, - * 0x92: 1T2R turbo, 0x22: 2T2R */ - u8 rf_config; - /* 4: 4EP, 6: 6EP, 11: 11EP */ - u8 usb_ep_num; - - /* --- long word 1 ---- */ - /* regulatory class bit map 0 */ - u8 regulatory_class_0; - /* regulatory class bit map 1 */ - u8 regulatory_class_1; - /* regulatory class bit map 2 */ - u8 regulatory_class_2; - /* regulatory class bit map 3 */ - u8 regulatory_class_3; - /* 0:SWSI, 1:HWSI, 2:HWPI */ - u8 rfintfs; - u8 def_nettype; - u8 rsvd010; - u8 rsvd011; - - /* --- long word 2 ---- */ - /* 0x00: normal, 0x03: MACLBK, 0x01: PHYLBK */ - u8 lbk_mode; - /* 1: for MP use, 0: for normal - * driver (to be discussed) */ - u8 mp_mode; - u8 rsvd020; - u8 rsvd021; - u8 rsvd022; - u8 rsvd023; - u8 rsvd024; - u8 rsvd025; - - /* --- long word 3 ---- */ - /* QoS enable */ - u8 qos_en; - /* 40MHz BW enable */ - /* 4181 convert AMSDU to AMPDU, 0: disable */ - u8 bw_40mhz_en; - u8 amsdu2ampdu_en; - /* 11n AMPDU enable */ - u8 ampdu_en; - /* FW offloads, 0: driver handles */ - u8 rate_control_offload; - /* FW offloads, 0: driver handles */ - u8 aggregation_offload; - u8 rsvd030; - u8 rsvd031; - - /* --- long word 4 ---- */ - /* 1. FW offloads, 0: driver handles */ - u8 beacon_offload; - /* 2. FW offloads, 0: driver handles */ - u8 mlme_offload; - /* 3. FW offloads, 0: driver handles */ - u8 hwpc_offload; - /* 4. FW offloads, 0: driver handles */ - u8 tcp_checksum_offload; - /* 5. FW offloads, 0: driver handles */ - u8 tcp_offload; - /* 6. FW offloads, 0: driver handles */ - u8 ps_control_offload; - /* 7. FW offloads, 0: driver handles */ - u8 wwlan_offload; - u8 rsvd040; - - /* --- long word 5 ---- */ - /* tcp tx packet length low byte */ - u8 tcp_tx_frame_len_L; - /* tcp tx packet length high byte */ - u8 tcp_tx_frame_len_H; - /* tcp rx packet length low byte */ - u8 tcp_rx_frame_len_L; - /* tcp rx packet length high byte */ - u8 tcp_rx_frame_len_H; - u8 rsvd050; - u8 rsvd051; - u8 rsvd052; - u8 rsvd053; -}; - -/* 8-byte alinment required */ -struct fw_hdr { - - /* --- LONG WORD 0 ---- */ - u16 signature; - /* 0x8000 ~ 0x8FFF for FPGA version, - * 0x0000 ~ 0x7FFF for ASIC version, */ - u16 version; - /* define the size of boot loader */ - u32 dmem_size; - - - /* --- LONG WORD 1 ---- */ - /* define the size of FW in IMEM */ - u32 img_imem_size; - /* define the size of FW in SRAM */ - u32 img_sram_size; - - /* --- LONG WORD 2 ---- */ - /* define the size of DMEM variable */ - u32 fw_priv_size; - u32 rsvd0; - - /* --- LONG WORD 3 ---- */ - u32 rsvd1; - u32 rsvd2; - - struct fw_priv fwpriv; - -} ; - -enum fw_status { - FW_STATUS_INIT = 0, - FW_STATUS_LOAD_IMEM = 1, - FW_STATUS_LOAD_EMEM = 2, - FW_STATUS_LOAD_DMEM = 3, - FW_STATUS_READY = 4, -}; - -struct rt_firmware { - struct fw_hdr *pfwheader; - enum fw_status fwstatus; - u16 firmwareversion; - u8 fw_imem[RTL8190_MAX_FIRMWARE_CODE_SIZE]; - u8 fw_emem[RTL8190_MAX_FIRMWARE_CODE_SIZE]; - u32 fw_imem_len; - u32 fw_emem_len; - u8 sz_fw_tmpbuffer[RTL8190_MAX_RAW_FIRMWARE_CODE_SIZE]; - u32 sz_fw_tmpbufferlen; - u16 cmdpacket_fragthresold; -}; - -struct h2c_set_pwrmode_parm { - u8 mode; - u8 flag_low_traffic_en; - u8 flag_lpnav_en; - u8 flag_rf_low_snr_en; - /* 1: dps, 0: 32k */ - u8 flag_dps_en; - u8 bcn_rx_en; - u8 bcn_pass_cnt; - /* beacon TO (ms). ¡§=0¡¨ no limit. */ - u8 bcn_to; - u16 bcn_itv; - /* only for VOIP mode. */ - u8 app_itv; - u8 awake_bcn_itvl; - u8 smart_ps; - /* unit: 100 ms */ - u8 bcn_pass_period; -}; - -struct h2c_joinbss_rpt_parm { - u8 opmode; - u8 ps_qos_info; - u8 bssid[6]; - u16 bcnitv; - u16 aid; -} ; - -struct h2c_wpa_ptk { - /* EAPOL-Key Key Confirmation Key (KCK) */ - u8 kck[16]; - /* EAPOL-Key Key Encryption Key (KEK) */ - u8 kek[16]; - /* Temporal Key 1 (TK1) */ - u8 tk1[16]; - union { - /* Temporal Key 2 (TK2) */ - u8 tk2[16]; - struct { - u8 tx_mic_key[8]; - u8 rx_mic_key[8]; - } athu; - } u; -}; - -struct h2c_wpa_two_way_parm { - /* algorithm TKIP or AES */ - u8 pairwise_en_alg; - u8 group_en_alg; - struct h2c_wpa_ptk wpa_ptk_value; -} ; - -enum h2c_cmd { - FW_H2C_SETPWRMODE = 0, - FW_H2C_JOINBSSRPT = 1, - FW_H2C_WOWLAN_UPDATE_GTK = 2, - FW_H2C_WOWLAN_UPDATE_IV = 3, - FW_H2C_WOWLAN_OFFLOAD = 4, -}; - -enum fw_h2c_cmd { - H2C_READ_MACREG_CMD, /*0*/ - H2C_WRITE_MACREG_CMD, - H2C_READBB_CMD, - H2C_WRITEBB_CMD, - H2C_READRF_CMD, - H2C_WRITERF_CMD, /*5*/ - H2C_READ_EEPROM_CMD, - H2C_WRITE_EEPROM_CMD, - H2C_READ_EFUSE_CMD, - H2C_WRITE_EFUSE_CMD, - H2C_READ_CAM_CMD, /*10*/ - H2C_WRITE_CAM_CMD, - H2C_SETBCNITV_CMD, - H2C_SETMBIDCFG_CMD, - H2C_JOINBSS_CMD, - H2C_DISCONNECT_CMD, /*15*/ - H2C_CREATEBSS_CMD, - H2C_SETOPMode_CMD, - H2C_SITESURVEY_CMD, - H2C_SETAUTH_CMD, - H2C_SETKEY_CMD, /*20*/ - H2C_SETSTAKEY_CMD, - H2C_SETASSOCSTA_CMD, - H2C_DELASSOCSTA_CMD, - H2C_SETSTAPWRSTATE_CMD, - H2C_SETBASICRATE_CMD, /*25*/ - H2C_GETBASICRATE_CMD, - H2C_SETDATARATE_CMD, - H2C_GETDATARATE_CMD, - H2C_SETPHYINFO_CMD, - H2C_GETPHYINFO_CMD, /*30*/ - H2C_SETPHY_CMD, - H2C_GETPHY_CMD, - H2C_READRSSI_CMD, - H2C_READGAIN_CMD, - H2C_SETATIM_CMD, /*35*/ - H2C_SETPWRMODE_CMD, - H2C_JOINBSSRPT_CMD, - H2C_SETRATABLE_CMD, - H2C_GETRATABLE_CMD, - H2C_GETCCXREPORT_CMD, /*40*/ - H2C_GETDTMREPORT_CMD, - H2C_GETTXRATESTATICS_CMD, - H2C_SETUSBSUSPEND_CMD, - H2C_SETH2CLBK_CMD, - H2C_TMP1, /*45*/ - H2C_WOWLAN_UPDATE_GTK_CMD, - H2C_WOWLAN_FW_OFFLOAD, - H2C_TMP2, - H2C_TMP3, - H2C_WOWLAN_UPDATE_IV_CMD, /*50*/ - H2C_TMP4, - MAX_H2CCMD /*52*/ -}; - -/* The following macros are used for FW - * CMD map and parameter updated. */ -#define FW_CMD_IO_CLR(rtlpriv, _Bit) \ - do { \ - udelay(1000); \ - rtlpriv->rtlhal.fwcmd_iomap &= (~_Bit); \ - } while (0) - -#define FW_CMD_IO_UPDATE(rtlpriv, _val) \ - rtlpriv->rtlhal.fwcmd_iomap = _val; - -#define FW_CMD_IO_SET(rtlpriv, _val) \ - do { \ - rtl_write_word(rtlpriv, LBUS_MON_ADDR, (u16)_val); \ - FW_CMD_IO_UPDATE(rtlpriv, _val); \ - } while (0) - -#define FW_CMD_PARA_SET(rtlpriv, _val) \ - do { \ - rtl_write_dword(rtlpriv, LBUS_ADDR_MASK, _val); \ - rtlpriv->rtlhal.fwcmd_ioparam = _val; \ - } while (0) - -#define FW_CMD_IO_QUERY(rtlpriv) \ - (u16)(rtlpriv->rtlhal.fwcmd_iomap) -#define FW_CMD_IO_PARA_QUERY(rtlpriv) \ - ((u32)(rtlpriv->rtlhal.fwcmd_ioparam)) - -int rtl92s_download_fw(struct ieee80211_hw *hw); -void rtl92s_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); -void rtl92s_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, - u8 mstatus, u8 ps_qosinfo); - -#endif - diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c deleted file mode 100644 index 4f461786a7eb..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c +++ /dev/null @@ -1,2552 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../efuse.h" -#include "../base.h" -#include "../regd.h" -#include "../cam.h" -#include "../ps.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "fw.h" -#include "led.h" -#include "hw.h" - -void rtl92se_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - switch (variable) { - case HW_VAR_RCR: { - *((u32 *) (val)) = rtlpci->receive_config; - break; - } - case HW_VAR_RF_STATE: { - *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state; - break; - } - case HW_VAR_FW_PSMODE_STATUS: { - *((bool *) (val)) = ppsc->fw_current_inpsmode; - break; - } - case HW_VAR_CORRECT_TSF: { - u64 tsf; - u32 *ptsf_low = (u32 *)&tsf; - u32 *ptsf_high = ((u32 *)&tsf) + 1; - - *ptsf_high = rtl_read_dword(rtlpriv, (TSFR + 4)); - *ptsf_low = rtl_read_dword(rtlpriv, TSFR); - - *((u64 *) (val)) = tsf; - - break; - } - case HW_VAR_MRC: { - *((bool *)(val)) = rtlpriv->dm.current_mrc_switch; - break; - } - default: { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - } -} - -void rtl92se_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - switch (variable) { - case HW_VAR_ETHER_ADDR:{ - rtl_write_dword(rtlpriv, IDR0, ((u32 *)(val))[0]); - rtl_write_word(rtlpriv, IDR4, ((u16 *)(val + 4))[0]); - break; - } - case HW_VAR_BASIC_RATE:{ - u16 rate_cfg = ((u16 *) val)[0]; - u8 rate_index = 0; - - if (rtlhal->version == VERSION_8192S_ACUT) - rate_cfg = rate_cfg & 0x150; - else - rate_cfg = rate_cfg & 0x15f; - - rate_cfg |= 0x01; - - rtl_write_byte(rtlpriv, RRSR, rate_cfg & 0xff); - rtl_write_byte(rtlpriv, RRSR + 1, - (rate_cfg >> 8) & 0xff); - - while (rate_cfg > 0x1) { - rate_cfg = (rate_cfg >> 1); - rate_index++; - } - rtl_write_byte(rtlpriv, INIRTSMCS_SEL, rate_index); - - break; - } - case HW_VAR_BSSID:{ - rtl_write_dword(rtlpriv, BSSIDR, ((u32 *)(val))[0]); - rtl_write_word(rtlpriv, BSSIDR + 4, - ((u16 *)(val + 4))[0]); - break; - } - case HW_VAR_SIFS:{ - rtl_write_byte(rtlpriv, SIFS_OFDM, val[0]); - rtl_write_byte(rtlpriv, SIFS_OFDM + 1, val[1]); - break; - } - case HW_VAR_SLOT_TIME:{ - u8 e_aci; - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "HW_VAR_SLOT_TIME %x\n", val[0]); - - rtl_write_byte(rtlpriv, SLOT_TIME, val[0]); - - for (e_aci = 0; e_aci < AC_MAX; e_aci++) { - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_AC_PARAM, - (&e_aci)); - } - break; - } - case HW_VAR_ACK_PREAMBLE:{ - u8 reg_tmp; - u8 short_preamble = (bool) (*val); - reg_tmp = (mac->cur_40_prime_sc) << 5; - if (short_preamble) - reg_tmp |= 0x80; - - rtl_write_byte(rtlpriv, RRSR + 2, reg_tmp); - break; - } - case HW_VAR_AMPDU_MIN_SPACE:{ - u8 min_spacing_to_set; - u8 sec_min_space; - - min_spacing_to_set = *val; - if (min_spacing_to_set <= 7) { - if (rtlpriv->sec.pairwise_enc_algorithm == - NO_ENCRYPTION) - sec_min_space = 0; - else - sec_min_space = 1; - - if (min_spacing_to_set < sec_min_space) - min_spacing_to_set = sec_min_space; - if (min_spacing_to_set > 5) - min_spacing_to_set = 5; - - mac->min_space_cfg = - ((mac->min_space_cfg & 0xf8) | - min_spacing_to_set); - - *val = min_spacing_to_set; - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_AMPDU_MIN_SPACE: %#x\n", - mac->min_space_cfg); - - rtl_write_byte(rtlpriv, AMPDU_MIN_SPACE, - mac->min_space_cfg); - } - break; - } - case HW_VAR_SHORTGI_DENSITY:{ - u8 density_to_set; - - density_to_set = *val; - mac->min_space_cfg = rtlpriv->rtlhal.minspace_cfg; - mac->min_space_cfg |= (density_to_set << 3); - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_SHORTGI_DENSITY: %#x\n", - mac->min_space_cfg); - - rtl_write_byte(rtlpriv, AMPDU_MIN_SPACE, - mac->min_space_cfg); - - break; - } - case HW_VAR_AMPDU_FACTOR:{ - u8 factor_toset; - u8 regtoset; - u8 factorlevel[18] = { - 2, 4, 4, 7, 7, 13, 13, - 13, 2, 7, 7, 13, 13, - 15, 15, 15, 15, 0}; - u8 index = 0; - - factor_toset = *val; - if (factor_toset <= 3) { - factor_toset = (1 << (factor_toset + 2)); - if (factor_toset > 0xf) - factor_toset = 0xf; - - for (index = 0; index < 17; index++) { - if (factorlevel[index] > factor_toset) - factorlevel[index] = - factor_toset; - } - - for (index = 0; index < 8; index++) { - regtoset = ((factorlevel[index * 2]) | - (factorlevel[index * - 2 + 1] << 4)); - rtl_write_byte(rtlpriv, - AGGLEN_LMT_L + index, - regtoset); - } - - regtoset = ((factorlevel[16]) | - (factorlevel[17] << 4)); - rtl_write_byte(rtlpriv, AGGLEN_LMT_H, regtoset); - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_AMPDU_FACTOR: %#x\n", - factor_toset); - } - break; - } - case HW_VAR_AC_PARAM:{ - u8 e_aci = *val; - rtl92s_dm_init_edca_turbo(hw); - - if (rtlpci->acm_method != eAcmWay2_SW) - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_ACM_CTRL, - &e_aci); - break; - } - case HW_VAR_ACM_CTRL:{ - u8 e_aci = *val; - union aci_aifsn *p_aci_aifsn = (union aci_aifsn *)(&( - mac->ac[0].aifs)); - u8 acm = p_aci_aifsn->f.acm; - u8 acm_ctrl = rtl_read_byte(rtlpriv, AcmHwCtrl); - - acm_ctrl = acm_ctrl | ((rtlpci->acm_method == 2) ? - 0x0 : 0x1); - - if (acm) { - switch (e_aci) { - case AC0_BE: - acm_ctrl |= AcmHw_BeqEn; - break; - case AC2_VI: - acm_ctrl |= AcmHw_ViqEn; - break; - case AC3_VO: - acm_ctrl |= AcmHw_VoqEn; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "HW_VAR_ACM_CTRL acm set failed: eACI is %d\n", - acm); - break; - } - } else { - switch (e_aci) { - case AC0_BE: - acm_ctrl &= (~AcmHw_BeqEn); - break; - case AC2_VI: - acm_ctrl &= (~AcmHw_ViqEn); - break; - case AC3_VO: - acm_ctrl &= (~AcmHw_BeqEn); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - } - - RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE, - "HW_VAR_ACM_CTRL Write 0x%X\n", acm_ctrl); - rtl_write_byte(rtlpriv, AcmHwCtrl, acm_ctrl); - break; - } - case HW_VAR_RCR:{ - rtl_write_dword(rtlpriv, RCR, ((u32 *) (val))[0]); - rtlpci->receive_config = ((u32 *) (val))[0]; - break; - } - case HW_VAR_RETRY_LIMIT:{ - u8 retry_limit = val[0]; - - rtl_write_word(rtlpriv, RETRY_LIMIT, - retry_limit << RETRY_LIMIT_SHORT_SHIFT | - retry_limit << RETRY_LIMIT_LONG_SHIFT); - break; - } - case HW_VAR_DUAL_TSF_RST: { - break; - } - case HW_VAR_EFUSE_BYTES: { - rtlefuse->efuse_usedbytes = *((u16 *) val); - break; - } - case HW_VAR_EFUSE_USAGE: { - rtlefuse->efuse_usedpercentage = *val; - break; - } - case HW_VAR_IO_CMD: { - break; - } - case HW_VAR_WPA_CONFIG: { - rtl_write_byte(rtlpriv, REG_SECR, *val); - break; - } - case HW_VAR_SET_RPWM:{ - break; - } - case HW_VAR_H2C_FW_PWRMODE:{ - break; - } - case HW_VAR_FW_PSMODE_STATUS: { - ppsc->fw_current_inpsmode = *((bool *) val); - break; - } - case HW_VAR_H2C_FW_JOINBSSRPT:{ - break; - } - case HW_VAR_AID:{ - break; - } - case HW_VAR_CORRECT_TSF:{ - break; - } - case HW_VAR_MRC: { - bool bmrc_toset = *((bool *)val); - u8 u1bdata = 0; - - if (bmrc_toset) { - rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, - MASKBYTE0, 0x33); - u1bdata = (u8)rtl_get_bbreg(hw, - ROFDM1_TRXPATHENABLE, - MASKBYTE0); - rtl_set_bbreg(hw, ROFDM1_TRXPATHENABLE, - MASKBYTE0, - ((u1bdata & 0xf0) | 0x03)); - u1bdata = (u8)rtl_get_bbreg(hw, - ROFDM0_TRXPATHENABLE, - MASKBYTE1); - rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, - MASKBYTE1, - (u1bdata | 0x04)); - - /* Update current settings. */ - rtlpriv->dm.current_mrc_switch = bmrc_toset; - } else { - rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, - MASKBYTE0, 0x13); - u1bdata = (u8)rtl_get_bbreg(hw, - ROFDM1_TRXPATHENABLE, - MASKBYTE0); - rtl_set_bbreg(hw, ROFDM1_TRXPATHENABLE, - MASKBYTE0, - ((u1bdata & 0xf0) | 0x01)); - u1bdata = (u8)rtl_get_bbreg(hw, - ROFDM0_TRXPATHENABLE, - MASKBYTE1); - rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, - MASKBYTE1, (u1bdata & 0xfb)); - - /* Update current settings. */ - rtlpriv->dm.current_mrc_switch = bmrc_toset; - } - - break; - } - case HW_VAR_FW_LPS_ACTION: { - bool enter_fwlps = *((bool *)val); - u8 rpwm_val, fw_pwrmode; - bool fw_current_inps; - - if (enter_fwlps) { - rpwm_val = 0x02; /* RF off */ - fw_current_inps = true; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_FW_PSMODE_STATUS, - (u8 *)(&fw_current_inps)); - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_PWRMODE, - (u8 *)(&ppsc->fwctrl_psmode)); - - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_SET_RPWM, - (u8 *)(&rpwm_val)); - } else { - rpwm_val = 0x0C; /* RF on */ - fw_pwrmode = FW_PS_ACTIVE_MODE; - fw_current_inps = false; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SET_RPWM, - (u8 *)(&rpwm_val)); - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_PWRMODE, - (u8 *)(&fw_pwrmode)); - - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_FW_PSMODE_STATUS, - (u8 *)(&fw_current_inps)); - } - break; } - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - -} - -void rtl92se_enable_hw_security_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 sec_reg_value = 0x0; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n", - rtlpriv->sec.pairwise_enc_algorithm, - rtlpriv->sec.group_enc_algorithm); - - if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "not open hw encryption\n"); - return; - } - - sec_reg_value = SCR_TXENCENABLE | SCR_RXENCENABLE; - - if (rtlpriv->sec.use_defaultkey) { - sec_reg_value |= SCR_TXUSEDK; - sec_reg_value |= SCR_RXUSEDK; - } - - RT_TRACE(rtlpriv, COMP_SEC, DBG_LOUD, "The SECR-value %x\n", - sec_reg_value); - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value); - -} - -static u8 _rtl92se_halset_sysclk(struct ieee80211_hw *hw, u8 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 waitcount = 100; - bool bresult = false; - u8 tmpvalue; - - rtl_write_byte(rtlpriv, SYS_CLKR + 1, data); - - /* Wait the MAC synchronized. */ - udelay(400); - - /* Check if it is set ready. */ - tmpvalue = rtl_read_byte(rtlpriv, SYS_CLKR + 1); - bresult = ((tmpvalue & BIT(7)) == (data & BIT(7))); - - if ((data & (BIT(6) | BIT(7))) == false) { - waitcount = 100; - tmpvalue = 0; - - while (1) { - waitcount--; - - tmpvalue = rtl_read_byte(rtlpriv, SYS_CLKR + 1); - if ((tmpvalue & BIT(6))) - break; - - pr_err("wait for BIT(6) return value %x\n", tmpvalue); - if (waitcount == 0) - break; - - udelay(10); - } - - if (waitcount == 0) - bresult = false; - else - bresult = true; - } - - return bresult; -} - -void rtl8192se_gpiobit3_cfg_inputmode(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 u1tmp; - - /* The following config GPIO function */ - rtl_write_byte(rtlpriv, MAC_PINMUX_CFG, (GPIOMUX_EN | GPIOSEL_GPIO)); - u1tmp = rtl_read_byte(rtlpriv, GPIO_IO_SEL); - - /* config GPIO3 to input */ - u1tmp &= HAL_8192S_HW_GPIO_OFF_MASK; - rtl_write_byte(rtlpriv, GPIO_IO_SEL, u1tmp); - -} - -static u8 _rtl92se_rf_onoff_detect(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 u1tmp; - u8 retval = ERFON; - - /* The following config GPIO function */ - rtl_write_byte(rtlpriv, MAC_PINMUX_CFG, (GPIOMUX_EN | GPIOSEL_GPIO)); - u1tmp = rtl_read_byte(rtlpriv, GPIO_IO_SEL); - - /* config GPIO3 to input */ - u1tmp &= HAL_8192S_HW_GPIO_OFF_MASK; - rtl_write_byte(rtlpriv, GPIO_IO_SEL, u1tmp); - - /* On some of the platform, driver cannot read correct - * value without delay between Write_GPIO_SEL and Read_GPIO_IN */ - mdelay(10); - - /* check GPIO3 */ - u1tmp = rtl_read_byte(rtlpriv, GPIO_IN_SE); - retval = (u1tmp & HAL_8192S_HW_GPIO_OFF_BIT) ? ERFON : ERFOFF; - - return retval; -} - -static void _rtl92se_macconfig_before_fwdownload(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - u8 i; - u8 tmpu1b; - u16 tmpu2b; - u8 pollingcnt = 20; - - if (rtlpci->first_init) { - /* Reset PCIE Digital */ - tmpu1b = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - tmpu1b &= 0xFE; - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, tmpu1b); - udelay(1); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, tmpu1b | BIT(0)); - } - - /* Switch to SW IO control */ - tmpu1b = rtl_read_byte(rtlpriv, (SYS_CLKR + 1)); - if (tmpu1b & BIT(7)) { - tmpu1b &= ~(BIT(6) | BIT(7)); - - /* Set failed, return to prevent hang. */ - if (!_rtl92se_halset_sysclk(hw, tmpu1b)) - return; - } - - rtl_write_byte(rtlpriv, AFE_PLL_CTRL, 0x0); - udelay(50); - rtl_write_byte(rtlpriv, LDOA15_CTRL, 0x34); - udelay(50); - - /* Clear FW RPWM for FW control LPS.*/ - rtl_write_byte(rtlpriv, RPWM, 0x0); - - /* Reset MAC-IO and CPU and Core Digital BIT(10)/11/15 */ - tmpu1b = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - tmpu1b &= 0x73; - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, tmpu1b); - /* wait for BIT 10/11/15 to pull high automatically!! */ - mdelay(1); - - rtl_write_byte(rtlpriv, CMDR, 0); - rtl_write_byte(rtlpriv, TCR, 0); - - /* Data sheet not define 0x562!!! Copy from WMAC!!!!! */ - tmpu1b = rtl_read_byte(rtlpriv, 0x562); - tmpu1b |= 0x08; - rtl_write_byte(rtlpriv, 0x562, tmpu1b); - tmpu1b &= ~(BIT(3)); - rtl_write_byte(rtlpriv, 0x562, tmpu1b); - - /* Enable AFE clock source */ - tmpu1b = rtl_read_byte(rtlpriv, AFE_XTAL_CTRL); - rtl_write_byte(rtlpriv, AFE_XTAL_CTRL, (tmpu1b | 0x01)); - /* Delay 1.5ms */ - mdelay(2); - tmpu1b = rtl_read_byte(rtlpriv, AFE_XTAL_CTRL + 1); - rtl_write_byte(rtlpriv, AFE_XTAL_CTRL + 1, (tmpu1b & 0xfb)); - - /* Enable AFE Macro Block's Bandgap */ - tmpu1b = rtl_read_byte(rtlpriv, AFE_MISC); - rtl_write_byte(rtlpriv, AFE_MISC, (tmpu1b | BIT(0))); - mdelay(1); - - /* Enable AFE Mbias */ - tmpu1b = rtl_read_byte(rtlpriv, AFE_MISC); - rtl_write_byte(rtlpriv, AFE_MISC, (tmpu1b | 0x02)); - mdelay(1); - - /* Enable LDOA15 block */ - tmpu1b = rtl_read_byte(rtlpriv, LDOA15_CTRL); - rtl_write_byte(rtlpriv, LDOA15_CTRL, (tmpu1b | BIT(0))); - - /* Set Digital Vdd to Retention isolation Path. */ - tmpu2b = rtl_read_word(rtlpriv, REG_SYS_ISO_CTRL); - rtl_write_word(rtlpriv, REG_SYS_ISO_CTRL, (tmpu2b | BIT(11))); - - /* For warm reboot NIC disappera bug. */ - tmpu2b = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN); - rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, (tmpu2b | BIT(13))); - - rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL + 1, 0x68); - - /* Enable AFE PLL Macro Block */ - /* We need to delay 100u before enabling PLL. */ - udelay(200); - tmpu1b = rtl_read_byte(rtlpriv, AFE_PLL_CTRL); - rtl_write_byte(rtlpriv, AFE_PLL_CTRL, (tmpu1b | BIT(0) | BIT(4))); - - /* for divider reset */ - udelay(100); - rtl_write_byte(rtlpriv, AFE_PLL_CTRL, (tmpu1b | BIT(0) | - BIT(4) | BIT(6))); - udelay(10); - rtl_write_byte(rtlpriv, AFE_PLL_CTRL, (tmpu1b | BIT(0) | BIT(4))); - udelay(10); - - /* Enable MAC 80MHZ clock */ - tmpu1b = rtl_read_byte(rtlpriv, AFE_PLL_CTRL + 1); - rtl_write_byte(rtlpriv, AFE_PLL_CTRL + 1, (tmpu1b | BIT(0))); - mdelay(1); - - /* Release isolation AFE PLL & MD */ - rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL, 0xA6); - - /* Enable MAC clock */ - tmpu2b = rtl_read_word(rtlpriv, SYS_CLKR); - rtl_write_word(rtlpriv, SYS_CLKR, (tmpu2b | BIT(12) | BIT(11))); - - /* Enable Core digital and enable IOREG R/W */ - tmpu2b = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN); - rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, (tmpu2b | BIT(11))); - - tmpu1b = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, tmpu1b & ~(BIT(7))); - - /* enable REG_EN */ - rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, (tmpu2b | BIT(11) | BIT(15))); - - /* Switch the control path. */ - tmpu2b = rtl_read_word(rtlpriv, SYS_CLKR); - rtl_write_word(rtlpriv, SYS_CLKR, (tmpu2b & (~BIT(2)))); - - tmpu1b = rtl_read_byte(rtlpriv, (SYS_CLKR + 1)); - tmpu1b = ((tmpu1b | BIT(7)) & (~BIT(6))); - if (!_rtl92se_halset_sysclk(hw, tmpu1b)) - return; /* Set failed, return to prevent hang. */ - - rtl_write_word(rtlpriv, CMDR, 0x07FC); - - /* MH We must enable the section of code to prevent load IMEM fail. */ - /* Load MAC register from WMAc temporarily We simulate macreg. */ - /* txt HW will provide MAC txt later */ - rtl_write_byte(rtlpriv, 0x6, 0x30); - rtl_write_byte(rtlpriv, 0x49, 0xf0); - - rtl_write_byte(rtlpriv, 0x4b, 0x81); - - rtl_write_byte(rtlpriv, 0xb5, 0x21); - - rtl_write_byte(rtlpriv, 0xdc, 0xff); - rtl_write_byte(rtlpriv, 0xdd, 0xff); - rtl_write_byte(rtlpriv, 0xde, 0xff); - rtl_write_byte(rtlpriv, 0xdf, 0xff); - - rtl_write_byte(rtlpriv, 0x11a, 0x00); - rtl_write_byte(rtlpriv, 0x11b, 0x00); - - for (i = 0; i < 32; i++) - rtl_write_byte(rtlpriv, INIMCS_SEL + i, 0x1b); - - rtl_write_byte(rtlpriv, 0x236, 0xff); - - rtl_write_byte(rtlpriv, 0x503, 0x22); - - if (ppsc->support_aspm && !ppsc->support_backdoor) - rtl_write_byte(rtlpriv, 0x560, 0x40); - else - rtl_write_byte(rtlpriv, 0x560, 0x00); - - rtl_write_byte(rtlpriv, DBG_PORT, 0x91); - - /* Set RX Desc Address */ - rtl_write_dword(rtlpriv, RDQDA, rtlpci->rx_ring[RX_MPDU_QUEUE].dma); - rtl_write_dword(rtlpriv, RCDA, rtlpci->rx_ring[RX_CMD_QUEUE].dma); - - /* Set TX Desc Address */ - rtl_write_dword(rtlpriv, TBKDA, rtlpci->tx_ring[BK_QUEUE].dma); - rtl_write_dword(rtlpriv, TBEDA, rtlpci->tx_ring[BE_QUEUE].dma); - rtl_write_dword(rtlpriv, TVIDA, rtlpci->tx_ring[VI_QUEUE].dma); - rtl_write_dword(rtlpriv, TVODA, rtlpci->tx_ring[VO_QUEUE].dma); - rtl_write_dword(rtlpriv, TBDA, rtlpci->tx_ring[BEACON_QUEUE].dma); - rtl_write_dword(rtlpriv, TCDA, rtlpci->tx_ring[TXCMD_QUEUE].dma); - rtl_write_dword(rtlpriv, TMDA, rtlpci->tx_ring[MGNT_QUEUE].dma); - rtl_write_dword(rtlpriv, THPDA, rtlpci->tx_ring[HIGH_QUEUE].dma); - rtl_write_dword(rtlpriv, HDA, rtlpci->tx_ring[HCCA_QUEUE].dma); - - rtl_write_word(rtlpriv, CMDR, 0x37FC); - - /* To make sure that TxDMA can ready to download FW. */ - /* We should reset TxDMA if IMEM RPT was not ready. */ - do { - tmpu1b = rtl_read_byte(rtlpriv, TCR); - if ((tmpu1b & TXDMA_INIT_VALUE) == TXDMA_INIT_VALUE) - break; - - udelay(5); - } while (pollingcnt--); - - if (pollingcnt <= 0) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Polling TXDMA_INIT_VALUE timeout!! Current TCR(%#x)\n", - tmpu1b); - tmpu1b = rtl_read_byte(rtlpriv, CMDR); - rtl_write_byte(rtlpriv, CMDR, tmpu1b & (~TXDMA_EN)); - udelay(2); - /* Reset TxDMA */ - rtl_write_byte(rtlpriv, CMDR, tmpu1b | TXDMA_EN); - } - - /* After MACIO reset,we must refresh LED state. */ - if ((ppsc->rfoff_reason == RF_CHANGE_BY_IPS) || - (ppsc->rfoff_reason == 0)) { - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); - enum rf_pwrstate rfpwr_state_toset; - rfpwr_state_toset = _rtl92se_rf_onoff_detect(hw); - - if (rfpwr_state_toset == ERFON) - rtl92se_sw_led_on(hw, pLed0); - } -} - -static void _rtl92se_macconfig_after_fwdownload(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u8 i; - u16 tmpu2b; - - /* 1. System Configure Register (Offset: 0x0000 - 0x003F) */ - - /* 2. Command Control Register (Offset: 0x0040 - 0x004F) */ - /* Turn on 0x40 Command register */ - rtl_write_word(rtlpriv, CMDR, (BBRSTN | BB_GLB_RSTN | - SCHEDULE_EN | MACRXEN | MACTXEN | DDMA_EN | FW2HW_EN | - RXDMA_EN | TXDMA_EN | HCI_RXDMA_EN | HCI_TXDMA_EN)); - - /* Set TCR TX DMA pre 2 FULL enable bit */ - rtl_write_dword(rtlpriv, TCR, rtl_read_dword(rtlpriv, TCR) | - TXDMAPRE2FULL); - - /* Set RCR */ - rtl_write_dword(rtlpriv, RCR, rtlpci->receive_config); - - /* 3. MACID Setting Register (Offset: 0x0050 - 0x007F) */ - - /* 4. Timing Control Register (Offset: 0x0080 - 0x009F) */ - /* Set CCK/OFDM SIFS */ - /* CCK SIFS shall always be 10us. */ - rtl_write_word(rtlpriv, SIFS_CCK, 0x0a0a); - rtl_write_word(rtlpriv, SIFS_OFDM, 0x1010); - - /* Set AckTimeout */ - rtl_write_byte(rtlpriv, ACK_TIMEOUT, 0x40); - - /* Beacon related */ - rtl_write_word(rtlpriv, BCN_INTERVAL, 100); - rtl_write_word(rtlpriv, ATIMWND, 2); - - /* 5. FIFO Control Register (Offset: 0x00A0 - 0x015F) */ - /* 5.1 Initialize Number of Reserved Pages in Firmware Queue */ - /* Firmware allocate now, associate with FW internal setting.!!! */ - - /* 5.2 Setting TX/RX page size 0/1/2/3/4=64/128/256/512/1024 */ - /* 5.3 Set driver info, we only accept PHY status now. */ - /* 5.4 Set RXDMA arbitration to control RXDMA/MAC/FW R/W for RXFIFO */ - rtl_write_byte(rtlpriv, RXDMA, rtl_read_byte(rtlpriv, RXDMA) | BIT(6)); - - /* 6. Adaptive Control Register (Offset: 0x0160 - 0x01CF) */ - /* Set RRSR to all legacy rate and HT rate - * CCK rate is supported by default. - * CCK rate will be filtered out only when associated - * AP does not support it. - * Only enable ACK rate to OFDM 24M - * Disable RRSR for CCK rate in A-Cut */ - - if (rtlhal->version == VERSION_8192S_ACUT) - rtl_write_byte(rtlpriv, RRSR, 0xf0); - else if (rtlhal->version == VERSION_8192S_BCUT) - rtl_write_byte(rtlpriv, RRSR, 0xff); - rtl_write_byte(rtlpriv, RRSR + 1, 0x01); - rtl_write_byte(rtlpriv, RRSR + 2, 0x00); - - /* A-Cut IC do not support CCK rate. We forbid ARFR to */ - /* fallback to CCK rate */ - for (i = 0; i < 8; i++) { - /*Disable RRSR for CCK rate in A-Cut */ - if (rtlhal->version == VERSION_8192S_ACUT) - rtl_write_dword(rtlpriv, ARFR0 + i * 4, 0x1f0ff0f0); - } - - /* Different rate use different AMPDU size */ - /* MCS32/ MCS15_SG use max AMPDU size 15*2=30K */ - rtl_write_byte(rtlpriv, AGGLEN_LMT_H, 0x0f); - /* MCS0/1/2/3 use max AMPDU size 4*2=8K */ - rtl_write_word(rtlpriv, AGGLEN_LMT_L, 0x7442); - /* MCS4/5 use max AMPDU size 8*2=16K 6/7 use 10*2=20K */ - rtl_write_word(rtlpriv, AGGLEN_LMT_L + 2, 0xddd7); - /* MCS8/9 use max AMPDU size 8*2=16K 10/11 use 10*2=20K */ - rtl_write_word(rtlpriv, AGGLEN_LMT_L + 4, 0xd772); - /* MCS12/13/14/15 use max AMPDU size 15*2=30K */ - rtl_write_word(rtlpriv, AGGLEN_LMT_L + 6, 0xfffd); - - /* Set Data / Response auto rate fallack retry count */ - rtl_write_dword(rtlpriv, DARFRC, 0x04010000); - rtl_write_dword(rtlpriv, DARFRC + 4, 0x09070605); - rtl_write_dword(rtlpriv, RARFRC, 0x04010000); - rtl_write_dword(rtlpriv, RARFRC + 4, 0x09070605); - - /* 7. EDCA Setting Register (Offset: 0x01D0 - 0x01FF) */ - /* Set all rate to support SG */ - rtl_write_word(rtlpriv, SG_RATE, 0xFFFF); - - /* 8. WMAC, BA, and CCX related Register (Offset: 0x0200 - 0x023F) */ - /* Set NAV protection length */ - rtl_write_word(rtlpriv, NAV_PROT_LEN, 0x0080); - /* CF-END Threshold */ - rtl_write_byte(rtlpriv, CFEND_TH, 0xFF); - /* Set AMPDU minimum space */ - rtl_write_byte(rtlpriv, AMPDU_MIN_SPACE, 0x07); - /* Set TXOP stall control for several queue/HI/BCN/MGT/ */ - rtl_write_byte(rtlpriv, TXOP_STALL_CTRL, 0x00); - - /* 9. Security Control Register (Offset: 0x0240 - 0x025F) */ - /* 10. Power Save Control Register (Offset: 0x0260 - 0x02DF) */ - /* 11. General Purpose Register (Offset: 0x02E0 - 0x02FF) */ - /* 12. Host Interrupt Status Register (Offset: 0x0300 - 0x030F) */ - /* 13. Test Mode and Debug Control Register (Offset: 0x0310 - 0x034F) */ - - /* 14. Set driver info, we only accept PHY status now. */ - rtl_write_byte(rtlpriv, RXDRVINFO_SZ, 4); - - /* 15. For EEPROM R/W Workaround */ - /* 16. For EFUSE to share REG_SYS_FUNC_EN with EEPROM!!! */ - tmpu2b = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, tmpu2b | BIT(13)); - tmpu2b = rtl_read_byte(rtlpriv, REG_SYS_ISO_CTRL); - rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL, tmpu2b & (~BIT(8))); - - /* 17. For EFUSE */ - /* We may R/W EFUSE in EEPROM mode */ - if (rtlefuse->epromtype == EEPROM_BOOT_EFUSE) { - u8 tempval; - - tempval = rtl_read_byte(rtlpriv, REG_SYS_ISO_CTRL + 1); - tempval &= 0xFE; - rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL + 1, tempval); - - /* Change Program timing */ - rtl_write_byte(rtlpriv, REG_EFUSE_CTRL + 3, 0x72); - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "EFUSE CONFIG OK\n"); - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "OK\n"); - -} - -static void _rtl92se_hw_configure(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - u8 reg_bw_opmode = 0; - u32 reg_rrsr = 0; - u8 regtmp = 0; - - reg_bw_opmode = BW_OPMODE_20MHZ; - reg_rrsr = RATE_ALL_CCK | RATE_ALL_OFDM_AG; - - regtmp = rtl_read_byte(rtlpriv, INIRTSMCS_SEL); - reg_rrsr = ((reg_rrsr & 0x000fffff) << 8) | regtmp; - rtl_write_dword(rtlpriv, INIRTSMCS_SEL, reg_rrsr); - rtl_write_byte(rtlpriv, BW_OPMODE, reg_bw_opmode); - - /* Set Retry Limit here */ - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT, - (u8 *)(&rtlpci->shortretry_limit)); - - rtl_write_byte(rtlpriv, MLT, 0x8f); - - /* For Min Spacing configuration. */ - switch (rtlphy->rf_type) { - case RF_1T2R: - case RF_1T1R: - rtlhal->minspace_cfg = (MAX_MSS_DENSITY_1T << 3); - break; - case RF_2T2R: - case RF_2T2R_GREEN: - rtlhal->minspace_cfg = (MAX_MSS_DENSITY_2T << 3); - break; - } - rtl_write_byte(rtlpriv, AMPDU_MIN_SPACE, rtlhal->minspace_cfg); -} - -int rtl92se_hw_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 tmp_byte = 0; - - bool rtstatus = true; - u8 tmp_u1b; - int err = false; - u8 i; - int wdcapra_add[] = { - EDCAPARA_BE, EDCAPARA_BK, - EDCAPARA_VI, EDCAPARA_VO}; - u8 secr_value = 0x0; - - rtlpci->being_init_adapter = true; - - rtlpriv->intf_ops->disable_aspm(hw); - - /* 1. MAC Initialize */ - /* Before FW download, we have to set some MAC register */ - _rtl92se_macconfig_before_fwdownload(hw); - - rtlhal->version = (enum version_8192s)((rtl_read_dword(rtlpriv, - PMC_FSM) >> 16) & 0xF); - - rtl8192se_gpiobit3_cfg_inputmode(hw); - - /* 2. download firmware */ - rtstatus = rtl92s_download_fw(hw); - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Failed to download FW. Init HW without FW now... " - "Please copy FW into /lib/firmware/rtlwifi\n"); - return 1; - } - - /* After FW download, we have to reset MAC register */ - _rtl92se_macconfig_after_fwdownload(hw); - - /*Retrieve default FW Cmd IO map. */ - rtlhal->fwcmd_iomap = rtl_read_word(rtlpriv, LBUS_MON_ADDR); - rtlhal->fwcmd_ioparam = rtl_read_dword(rtlpriv, LBUS_ADDR_MASK); - - /* 3. Initialize MAC/PHY Config by MACPHY_reg.txt */ - if (!rtl92s_phy_mac_config(hw)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "MAC Config failed\n"); - return rtstatus; - } - - /* because last function modify RCR, so we update - * rcr var here, or TP will unstable for receive_config - * is wrong, RX RCR_ACRC32 will cause TP unstabel & Rx - * RCR_APP_ICV will cause mac80211 unassoc for cisco 1252 - */ - rtlpci->receive_config = rtl_read_dword(rtlpriv, RCR); - rtlpci->receive_config &= ~(RCR_ACRC32 | RCR_AICV); - rtl_write_dword(rtlpriv, RCR, rtlpci->receive_config); - - /* Make sure BB/RF write OK. We should prevent enter IPS. radio off. */ - /* We must set flag avoid BB/RF config period later!! */ - rtl_write_dword(rtlpriv, CMDR, 0x37FC); - - /* 4. Initialize BB After MAC Config PHY_reg.txt, AGC_Tab.txt */ - if (!rtl92s_phy_bb_config(hw)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, "BB Config failed\n"); - return rtstatus; - } - - /* 5. Initiailze RF RAIO_A.txt RF RAIO_B.txt */ - /* Before initalizing RF. We can not use FW to do RF-R/W. */ - - rtlphy->rf_mode = RF_OP_BY_SW_3WIRE; - - /* Before RF-R/W we must execute the IO from Scott's suggestion. */ - rtl_write_byte(rtlpriv, AFE_XTAL_CTRL + 1, 0xDB); - if (rtlhal->version == VERSION_8192S_ACUT) - rtl_write_byte(rtlpriv, SPS1_CTRL + 3, 0x07); - else - rtl_write_byte(rtlpriv, RF_CTRL, 0x07); - - if (!rtl92s_phy_rf_config(hw)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "RF Config failed\n"); - return rtstatus; - } - - /* After read predefined TXT, we must set BB/MAC/RF - * register as our requirement */ - - rtlphy->rfreg_chnlval[0] = rtl92s_phy_query_rf_reg(hw, - (enum radio_path)0, - RF_CHNLBW, - RFREG_OFFSET_MASK); - rtlphy->rfreg_chnlval[1] = rtl92s_phy_query_rf_reg(hw, - (enum radio_path)1, - RF_CHNLBW, - RFREG_OFFSET_MASK); - - /*---- Set CCK and OFDM Block "ON"----*/ - rtl_set_bbreg(hw, RFPGA0_RFMOD, BCCKEN, 0x1); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BOFDMEN, 0x1); - - /*3 Set Hardware(Do nothing now) */ - _rtl92se_hw_configure(hw); - - /* Read EEPROM TX power index and PHY_REG_PG.txt to capture correct */ - /* TX power index for different rate set. */ - /* Get original hw reg values */ - rtl92s_phy_get_hw_reg_originalvalue(hw); - /* Write correct tx power index */ - rtl92s_phy_set_txpower(hw, rtlphy->current_channel); - - /* We must set MAC address after firmware download. */ - for (i = 0; i < 6; i++) - rtl_write_byte(rtlpriv, MACIDR0 + i, rtlefuse->dev_addr[i]); - - /* EEPROM R/W workaround */ - tmp_u1b = rtl_read_byte(rtlpriv, MAC_PINMUX_CFG); - rtl_write_byte(rtlpriv, MAC_PINMUX_CFG, tmp_u1b & (~BIT(3))); - - rtl_write_byte(rtlpriv, 0x4d, 0x0); - - if (hal_get_firmwareversion(rtlpriv) >= 0x49) { - tmp_byte = rtl_read_byte(rtlpriv, FW_RSVD_PG_CRTL) & (~BIT(4)); - tmp_byte = tmp_byte | BIT(5); - rtl_write_byte(rtlpriv, FW_RSVD_PG_CRTL, tmp_byte); - rtl_write_dword(rtlpriv, TXDESC_MSK, 0xFFFFCFFF); - } - - /* We enable high power and RA related mechanism after NIC - * initialized. */ - if (hal_get_firmwareversion(rtlpriv) >= 0x35) { - /* Fw v.53 and later. */ - rtl92s_phy_set_fw_cmd(hw, FW_CMD_RA_INIT); - } else if (hal_get_firmwareversion(rtlpriv) == 0x34) { - /* Fw v.52. */ - rtl_write_dword(rtlpriv, WFM5, FW_RA_INIT); - rtl92s_phy_chk_fwcmd_iodone(hw); - } else { - /* Compatible earlier FW version. */ - rtl_write_dword(rtlpriv, WFM5, FW_RA_RESET); - rtl92s_phy_chk_fwcmd_iodone(hw); - rtl_write_dword(rtlpriv, WFM5, FW_RA_ACTIVE); - rtl92s_phy_chk_fwcmd_iodone(hw); - rtl_write_dword(rtlpriv, WFM5, FW_RA_REFRESH); - rtl92s_phy_chk_fwcmd_iodone(hw); - } - - /* Add to prevent ASPM bug. */ - /* Always enable hst and NIC clock request. */ - rtl92s_phy_switch_ephy_parameter(hw); - - /* Security related - * 1. Clear all H/W keys. - * 2. Enable H/W encryption/decryption. */ - rtl_cam_reset_all_entry(hw); - secr_value |= SCR_TXENCENABLE; - secr_value |= SCR_RXENCENABLE; - secr_value |= SCR_NOSKMC; - rtl_write_byte(rtlpriv, REG_SECR, secr_value); - - for (i = 0; i < 4; i++) - rtl_write_dword(rtlpriv, wdcapra_add[i], 0x5e4322); - - if (rtlphy->rf_type == RF_1T2R) { - bool mrc2set = true; - /* Turn on B-Path */ - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_MRC, (u8 *)&mrc2set); - } - - rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_ON); - rtl92s_dm_init(hw); - rtlpci->being_init_adapter = false; - - return err; -} - -void rtl92se_set_mac_addr(struct rtl_io *io, const u8 *addr) -{ - /* This is a stub. */ -} - -void rtl92se_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u32 reg_rcr = rtlpci->receive_config; - - if (rtlpriv->psc.rfpwr_state != ERFON) - return; - - if (check_bssid) { - reg_rcr |= (RCR_CBSSID); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, (u8 *)(®_rcr)); - } else if (!check_bssid) { - reg_rcr &= (~RCR_CBSSID); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, (u8 *)(®_rcr)); - } - -} - -static int _rtl92se_set_media_status(struct ieee80211_hw *hw, - enum nl80211_iftype type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 bt_msr = rtl_read_byte(rtlpriv, MSR); - u32 temp; - bt_msr &= ~MSR_LINK_MASK; - - switch (type) { - case NL80211_IFTYPE_UNSPECIFIED: - bt_msr |= (MSR_LINK_NONE << MSR_LINK_SHIFT); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to NO LINK!\n"); - break; - case NL80211_IFTYPE_ADHOC: - bt_msr |= (MSR_LINK_ADHOC << MSR_LINK_SHIFT); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to Ad Hoc!\n"); - break; - case NL80211_IFTYPE_STATION: - bt_msr |= (MSR_LINK_MANAGED << MSR_LINK_SHIFT); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to STA!\n"); - break; - case NL80211_IFTYPE_AP: - bt_msr |= (MSR_LINK_MASTER << MSR_LINK_SHIFT); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to AP!\n"); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Network type %d not supported!\n", type); - return 1; - break; - - } - - rtl_write_byte(rtlpriv, (MSR), bt_msr); - - temp = rtl_read_dword(rtlpriv, TCR); - rtl_write_dword(rtlpriv, TCR, temp & (~BIT(8))); - rtl_write_dword(rtlpriv, TCR, temp | BIT(8)); - - - return 0; -} - -/* HW_VAR_MEDIA_STATUS & HW_VAR_CECHK_BSSID */ -int rtl92se_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (_rtl92se_set_media_status(hw, type)) - return -EOPNOTSUPP; - - if (rtlpriv->mac80211.link_state == MAC80211_LINKED) { - if (type != NL80211_IFTYPE_AP) - rtl92se_set_check_bssid(hw, true); - } else { - rtl92se_set_check_bssid(hw, false); - } - - return 0; -} - -/* don't set REG_EDCA_BE_PARAM here because mac80211 will send pkt when scan */ -void rtl92se_set_qos(struct ieee80211_hw *hw, int aci) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - rtl92s_dm_init_edca_turbo(hw); - - switch (aci) { - case AC1_BK: - rtl_write_dword(rtlpriv, EDCAPARA_BK, 0xa44f); - break; - case AC0_BE: - /* rtl_write_dword(rtlpriv, EDCAPARA_BE, u4b_ac_param); */ - break; - case AC2_VI: - rtl_write_dword(rtlpriv, EDCAPARA_VI, 0x5e4322); - break; - case AC3_VO: - rtl_write_dword(rtlpriv, EDCAPARA_VO, 0x2f3222); - break; - default: - RT_ASSERT(false, "invalid aci: %d !\n", aci); - break; - } -} - -void rtl92se_enable_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - rtl_write_dword(rtlpriv, INTA_MASK, rtlpci->irq_mask[0]); - /* Support Bit 32-37(Assign as Bit 0-5) interrupt setting now */ - rtl_write_dword(rtlpriv, INTA_MASK + 4, rtlpci->irq_mask[1] & 0x3F); -} - -void rtl92se_disable_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv; - struct rtl_pci *rtlpci; - - rtlpriv = rtl_priv(hw); - /* if firmware not available, no interrupts */ - if (!rtlpriv || !rtlpriv->max_fw_size) - return; - rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - rtl_write_dword(rtlpriv, INTA_MASK, 0); - rtl_write_dword(rtlpriv, INTA_MASK + 4, 0); - - synchronize_irq(rtlpci->pdev->irq); -} - -static u8 _rtl92s_set_sysclk(struct ieee80211_hw *hw, u8 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 waitcnt = 100; - bool result = false; - u8 tmp; - - rtl_write_byte(rtlpriv, SYS_CLKR + 1, data); - - /* Wait the MAC synchronized. */ - udelay(400); - - /* Check if it is set ready. */ - tmp = rtl_read_byte(rtlpriv, SYS_CLKR + 1); - result = ((tmp & BIT(7)) == (data & BIT(7))); - - if ((data & (BIT(6) | BIT(7))) == false) { - waitcnt = 100; - tmp = 0; - - while (1) { - waitcnt--; - tmp = rtl_read_byte(rtlpriv, SYS_CLKR + 1); - - if ((tmp & BIT(6))) - break; - - pr_err("wait for BIT(6) return value %x\n", tmp); - - if (waitcnt == 0) - break; - udelay(10); - } - - if (waitcnt == 0) - result = false; - else - result = true; - } - - return result; -} - -static void _rtl92s_phy_set_rfhalt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - u8 u1btmp; - - if (rtlhal->driver_going2unload) - rtl_write_byte(rtlpriv, 0x560, 0x0); - - /* Power save for BB/RF */ - u1btmp = rtl_read_byte(rtlpriv, LDOV12D_CTRL); - u1btmp |= BIT(0); - rtl_write_byte(rtlpriv, LDOV12D_CTRL, u1btmp); - rtl_write_byte(rtlpriv, SPS1_CTRL, 0x0); - rtl_write_byte(rtlpriv, TXPAUSE, 0xFF); - rtl_write_word(rtlpriv, CMDR, 0x57FC); - udelay(100); - rtl_write_word(rtlpriv, CMDR, 0x77FC); - rtl_write_byte(rtlpriv, PHY_CCA, 0x0); - udelay(10); - rtl_write_word(rtlpriv, CMDR, 0x37FC); - udelay(10); - rtl_write_word(rtlpriv, CMDR, 0x77FC); - udelay(10); - rtl_write_word(rtlpriv, CMDR, 0x57FC); - rtl_write_word(rtlpriv, CMDR, 0x0000); - - if (rtlhal->driver_going2unload) { - u1btmp = rtl_read_byte(rtlpriv, (REG_SYS_FUNC_EN + 1)); - u1btmp &= ~(BIT(0)); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, u1btmp); - } - - u1btmp = rtl_read_byte(rtlpriv, (SYS_CLKR + 1)); - - /* Add description. After switch control path. register - * after page1 will be invisible. We can not do any IO - * for register>0x40. After resume&MACIO reset, we need - * to remember previous reg content. */ - if (u1btmp & BIT(7)) { - u1btmp &= ~(BIT(6) | BIT(7)); - if (!_rtl92s_set_sysclk(hw, u1btmp)) { - pr_err("Switch ctrl path fail\n"); - return; - } - } - - /* Power save for MAC */ - if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS && - !rtlhal->driver_going2unload) { - /* enable LED function */ - rtl_write_byte(rtlpriv, 0x03, 0xF9); - /* SW/HW radio off or halt adapter!! For example S3/S4 */ - } else { - /* LED function disable. Power range is about 8mA now. */ - /* if write 0xF1 disconnet_pci power - * ifconfig wlan0 down power are both high 35:70 */ - /* if write oxF9 disconnet_pci power - * ifconfig wlan0 down power are both low 12:45*/ - rtl_write_byte(rtlpriv, 0x03, 0xF9); - } - - rtl_write_byte(rtlpriv, SYS_CLKR + 1, 0x70); - rtl_write_byte(rtlpriv, AFE_PLL_CTRL + 1, 0x68); - rtl_write_byte(rtlpriv, AFE_PLL_CTRL, 0x00); - rtl_write_byte(rtlpriv, LDOA15_CTRL, 0x34); - rtl_write_byte(rtlpriv, AFE_XTAL_CTRL, 0x0E); - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - -} - -static void _rtl92se_gen_refreshledstate(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); - - if (rtlpci->up_first_time == 1) - return; - - if (rtlpriv->psc.rfoff_reason == RF_CHANGE_BY_IPS) - rtl92se_sw_led_on(hw, pLed0); - else - rtl92se_sw_led_off(hw, pLed0); -} - - -static void _rtl92se_power_domain_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u16 tmpu2b; - u8 tmpu1b; - - rtlpriv->psc.pwrdomain_protect = true; - - tmpu1b = rtl_read_byte(rtlpriv, (SYS_CLKR + 1)); - if (tmpu1b & BIT(7)) { - tmpu1b &= ~(BIT(6) | BIT(7)); - if (!_rtl92s_set_sysclk(hw, tmpu1b)) { - rtlpriv->psc.pwrdomain_protect = false; - return; - } - } - - rtl_write_byte(rtlpriv, AFE_PLL_CTRL, 0x0); - rtl_write_byte(rtlpriv, LDOA15_CTRL, 0x34); - - /* Reset MAC-IO and CPU and Core Digital BIT10/11/15 */ - tmpu1b = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - - /* If IPS we need to turn LED on. So we not - * not disable BIT 3/7 of reg3. */ - if (rtlpriv->psc.rfoff_reason & (RF_CHANGE_BY_IPS | RF_CHANGE_BY_HW)) - tmpu1b &= 0xFB; - else - tmpu1b &= 0x73; - - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, tmpu1b); - /* wait for BIT 10/11/15 to pull high automatically!! */ - mdelay(1); - - rtl_write_byte(rtlpriv, CMDR, 0); - rtl_write_byte(rtlpriv, TCR, 0); - - /* Data sheet not define 0x562!!! Copy from WMAC!!!!! */ - tmpu1b = rtl_read_byte(rtlpriv, 0x562); - tmpu1b |= 0x08; - rtl_write_byte(rtlpriv, 0x562, tmpu1b); - tmpu1b &= ~(BIT(3)); - rtl_write_byte(rtlpriv, 0x562, tmpu1b); - - /* Enable AFE clock source */ - tmpu1b = rtl_read_byte(rtlpriv, AFE_XTAL_CTRL); - rtl_write_byte(rtlpriv, AFE_XTAL_CTRL, (tmpu1b | 0x01)); - /* Delay 1.5ms */ - udelay(1500); - tmpu1b = rtl_read_byte(rtlpriv, AFE_XTAL_CTRL + 1); - rtl_write_byte(rtlpriv, AFE_XTAL_CTRL + 1, (tmpu1b & 0xfb)); - - /* Enable AFE Macro Block's Bandgap */ - tmpu1b = rtl_read_byte(rtlpriv, AFE_MISC); - rtl_write_byte(rtlpriv, AFE_MISC, (tmpu1b | BIT(0))); - mdelay(1); - - /* Enable AFE Mbias */ - tmpu1b = rtl_read_byte(rtlpriv, AFE_MISC); - rtl_write_byte(rtlpriv, AFE_MISC, (tmpu1b | 0x02)); - mdelay(1); - - /* Enable LDOA15 block */ - tmpu1b = rtl_read_byte(rtlpriv, LDOA15_CTRL); - rtl_write_byte(rtlpriv, LDOA15_CTRL, (tmpu1b | BIT(0))); - - /* Set Digital Vdd to Retention isolation Path. */ - tmpu2b = rtl_read_word(rtlpriv, REG_SYS_ISO_CTRL); - rtl_write_word(rtlpriv, REG_SYS_ISO_CTRL, (tmpu2b | BIT(11))); - - - /* For warm reboot NIC disappera bug. */ - tmpu2b = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN); - rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, (tmpu2b | BIT(13))); - - rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL + 1, 0x68); - - /* Enable AFE PLL Macro Block */ - tmpu1b = rtl_read_byte(rtlpriv, AFE_PLL_CTRL); - rtl_write_byte(rtlpriv, AFE_PLL_CTRL, (tmpu1b | BIT(0) | BIT(4))); - /* Enable MAC 80MHZ clock */ - tmpu1b = rtl_read_byte(rtlpriv, AFE_PLL_CTRL + 1); - rtl_write_byte(rtlpriv, AFE_PLL_CTRL + 1, (tmpu1b | BIT(0))); - mdelay(1); - - /* Release isolation AFE PLL & MD */ - rtl_write_byte(rtlpriv, REG_SYS_ISO_CTRL, 0xA6); - - /* Enable MAC clock */ - tmpu2b = rtl_read_word(rtlpriv, SYS_CLKR); - rtl_write_word(rtlpriv, SYS_CLKR, (tmpu2b | BIT(12) | BIT(11))); - - /* Enable Core digital and enable IOREG R/W */ - tmpu2b = rtl_read_word(rtlpriv, REG_SYS_FUNC_EN); - rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, (tmpu2b | BIT(11))); - /* enable REG_EN */ - rtl_write_word(rtlpriv, REG_SYS_FUNC_EN, (tmpu2b | BIT(11) | BIT(15))); - - /* Switch the control path. */ - tmpu2b = rtl_read_word(rtlpriv, SYS_CLKR); - rtl_write_word(rtlpriv, SYS_CLKR, (tmpu2b & (~BIT(2)))); - - tmpu1b = rtl_read_byte(rtlpriv, (SYS_CLKR + 1)); - tmpu1b = ((tmpu1b | BIT(7)) & (~BIT(6))); - if (!_rtl92s_set_sysclk(hw, tmpu1b)) { - rtlpriv->psc.pwrdomain_protect = false; - return; - } - - rtl_write_word(rtlpriv, CMDR, 0x37FC); - - /* After MACIO reset,we must refresh LED state. */ - _rtl92se_gen_refreshledstate(hw); - - rtlpriv->psc.pwrdomain_protect = false; -} - -void rtl92se_card_disable(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - enum nl80211_iftype opmode; - u8 wait = 30; - - rtlpriv->intf_ops->enable_aspm(hw); - - if (rtlpci->driver_is_goingto_unload || - ppsc->rfoff_reason > RF_CHANGE_BY_PS) - rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF); - - /* we should chnge GPIO to input mode - * this will drop away current about 25mA*/ - rtl8192se_gpiobit3_cfg_inputmode(hw); - - /* this is very important for ips power save */ - while (wait-- >= 10 && rtlpriv->psc.pwrdomain_protect) { - if (rtlpriv->psc.pwrdomain_protect) - mdelay(20); - else - break; - } - - mac->link_state = MAC80211_NOLINK; - opmode = NL80211_IFTYPE_UNSPECIFIED; - _rtl92se_set_media_status(hw, opmode); - - _rtl92s_phy_set_rfhalt(hw); - udelay(100); -} - -void rtl92se_interrupt_recognized(struct ieee80211_hw *hw, u32 *p_inta, - u32 *p_intb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - *p_inta = rtl_read_dword(rtlpriv, ISR) & rtlpci->irq_mask[0]; - rtl_write_dword(rtlpriv, ISR, *p_inta); - - *p_intb = rtl_read_dword(rtlpriv, ISR + 4) & rtlpci->irq_mask[1]; - rtl_write_dword(rtlpriv, ISR + 4, *p_intb); -} - -void rtl92se_set_beacon_related_registers(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 bcntime_cfg = 0; - u16 bcn_cw = 6, bcn_ifs = 0xf; - u16 atim_window = 2; - - /* ATIM Window (in unit of TU). */ - rtl_write_word(rtlpriv, ATIMWND, atim_window); - - /* Beacon interval (in unit of TU). */ - rtl_write_word(rtlpriv, BCN_INTERVAL, mac->beacon_interval); - - /* DrvErlyInt (in unit of TU). (Time to send - * interrupt to notify driver to change - * beacon content) */ - rtl_write_word(rtlpriv, BCN_DRV_EARLY_INT, 10 << 4); - - /* BcnDMATIM(in unit of us). Indicates the - * time before TBTT to perform beacon queue DMA */ - rtl_write_word(rtlpriv, BCN_DMATIME, 256); - - /* Force beacon frame transmission even - * after receiving beacon frame from - * other ad hoc STA */ - rtl_write_byte(rtlpriv, BCN_ERR_THRESH, 100); - - /* Beacon Time Configuration */ - if (mac->opmode == NL80211_IFTYPE_ADHOC) - bcntime_cfg |= (bcn_cw << BCN_TCFG_CW_SHIFT); - - /* TODO: bcn_ifs may required to be changed on ASIC */ - bcntime_cfg |= bcn_ifs << BCN_TCFG_IFS; - - /*for beacon changed */ - rtl92s_phy_set_beacon_hwreg(hw, mac->beacon_interval); -} - -void rtl92se_set_beacon_interval(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 bcn_interval = mac->beacon_interval; - - /* Beacon interval (in unit of TU). */ - rtl_write_word(rtlpriv, BCN_INTERVAL, bcn_interval); - /* 2008.10.24 added by tynli for beacon changed. */ - rtl92s_phy_set_beacon_hwreg(hw, bcn_interval); -} - -void rtl92se_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, "add_msr:%x, rm_msr:%x\n", - add_msr, rm_msr); - - if (add_msr) - rtlpci->irq_mask[0] |= add_msr; - - if (rm_msr) - rtlpci->irq_mask[0] &= (~rm_msr); - - rtl92se_disable_interrupt(hw); - rtl92se_enable_interrupt(hw); -} - -static void _rtl8192se_get_IC_Inferiority(struct ieee80211_hw *hw) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 efuse_id; - - rtlhal->ic_class = IC_INFERIORITY_A; - - /* Only retrieving while using EFUSE. */ - if ((rtlefuse->epromtype == EEPROM_BOOT_EFUSE) && - !rtlefuse->autoload_failflag) { - efuse_id = efuse_read_1byte(hw, EFUSE_IC_ID_OFFSET); - - if (efuse_id == 0xfe) - rtlhal->ic_class = IC_INFERIORITY_B; - } -} - -static void _rtl92se_read_adapter_info(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u16 i, usvalue; - u16 eeprom_id; - u8 tempval; - u8 hwinfo[HWSET_MAX_SIZE_92S]; - u8 rf_path, index; - - if (rtlefuse->epromtype == EEPROM_93C46) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "RTL819X Not boot from eeprom, check it !!\n"); - } else if (rtlefuse->epromtype == EEPROM_BOOT_EFUSE) { - rtl_efuse_shadow_map_update(hw); - - memcpy((void *)hwinfo, (void *) - &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], - HWSET_MAX_SIZE_92S); - } - - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "MAP", - hwinfo, HWSET_MAX_SIZE_92S); - - eeprom_id = *((u16 *)&hwinfo[0]); - if (eeprom_id != RTL8190_EEPROM_ID) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "EEPROM ID(%#x) is invalid!!\n", eeprom_id); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - } - - if (rtlefuse->autoload_failflag) - return; - - _rtl8192se_get_IC_Inferiority(hw); - - /* Read IC Version && Channel Plan */ - /* VID, DID SE 0xA-D */ - rtlefuse->eeprom_vid = *(u16 *)&hwinfo[EEPROM_VID]; - rtlefuse->eeprom_did = *(u16 *)&hwinfo[EEPROM_DID]; - rtlefuse->eeprom_svid = *(u16 *)&hwinfo[EEPROM_SVID]; - rtlefuse->eeprom_smid = *(u16 *)&hwinfo[EEPROM_SMID]; - rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION]; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROMId = 0x%4x\n", eeprom_id); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); - - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; - *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue; - } - - for (i = 0; i < 6; i++) - rtl_write_byte(rtlpriv, MACIDR0 + i, rtlefuse->dev_addr[i]); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "%pM\n", rtlefuse->dev_addr); - - /* Get Tx Power Level by Channel */ - /* Read Tx power of Channel 1 ~ 14 from EEPROM. */ - /* 92S suupport RF A & B */ - for (rf_path = 0; rf_path < 2; rf_path++) { - for (i = 0; i < 3; i++) { - /* Read CCK RF A & B Tx power */ - rtlefuse->eeprom_chnlarea_txpwr_cck[rf_path][i] = - hwinfo[EEPROM_TXPOWERBASE + rf_path * 3 + i]; - - /* Read OFDM RF A & B Tx power for 1T */ - rtlefuse->eeprom_chnlarea_txpwr_ht40_1s[rf_path][i] = - hwinfo[EEPROM_TXPOWERBASE + 6 + rf_path * 3 + i]; - - /* Read OFDM RF A & B Tx power for 2T */ - rtlefuse->eprom_chnl_txpwr_ht40_2sdf[rf_path][i] - = hwinfo[EEPROM_TXPOWERBASE + 12 + - rf_path * 3 + i]; - } - } - - for (rf_path = 0; rf_path < 2; rf_path++) - for (i = 0; i < 3; i++) - RTPRINT(rtlpriv, FINIT, INIT_EEPROM, - "RF(%d) EEPROM CCK Area(%d) = 0x%x\n", - rf_path, i, - rtlefuse->eeprom_chnlarea_txpwr_cck - [rf_path][i]); - for (rf_path = 0; rf_path < 2; rf_path++) - for (i = 0; i < 3; i++) - RTPRINT(rtlpriv, FINIT, INIT_EEPROM, - "RF(%d) EEPROM HT40 1S Area(%d) = 0x%x\n", - rf_path, i, - rtlefuse->eeprom_chnlarea_txpwr_ht40_1s - [rf_path][i]); - for (rf_path = 0; rf_path < 2; rf_path++) - for (i = 0; i < 3; i++) - RTPRINT(rtlpriv, FINIT, INIT_EEPROM, - "RF(%d) EEPROM HT40 2S Diff Area(%d) = 0x%x\n", - rf_path, i, - rtlefuse->eprom_chnl_txpwr_ht40_2sdf - [rf_path][i]); - - for (rf_path = 0; rf_path < 2; rf_path++) { - - /* Assign dedicated channel tx power */ - for (i = 0; i < 14; i++) { - /* channel 1~3 use the same Tx Power Level. */ - if (i < 3) - index = 0; - /* Channel 4-8 */ - else if (i < 8) - index = 1; - /* Channel 9-14 */ - else - index = 2; - - /* Record A & B CCK /OFDM - 1T/2T Channel area - * tx power */ - rtlefuse->txpwrlevel_cck[rf_path][i] = - rtlefuse->eeprom_chnlarea_txpwr_cck - [rf_path][index]; - rtlefuse->txpwrlevel_ht40_1s[rf_path][i] = - rtlefuse->eeprom_chnlarea_txpwr_ht40_1s - [rf_path][index]; - rtlefuse->txpwrlevel_ht40_2s[rf_path][i] = - rtlefuse->eprom_chnl_txpwr_ht40_2sdf - [rf_path][index]; - } - - for (i = 0; i < 14; i++) { - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF(%d)-Ch(%d) [CCK / HT40_1S / HT40_2S] = [0x%x / 0x%x / 0x%x]\n", - rf_path, i, - rtlefuse->txpwrlevel_cck[rf_path][i], - rtlefuse->txpwrlevel_ht40_1s[rf_path][i], - rtlefuse->txpwrlevel_ht40_2s[rf_path][i]); - } - } - - for (rf_path = 0; rf_path < 2; rf_path++) { - for (i = 0; i < 3; i++) { - /* Read Power diff limit. */ - rtlefuse->eeprom_pwrgroup[rf_path][i] = - hwinfo[EEPROM_TXPWRGROUP + rf_path * 3 + i]; - } - } - - for (rf_path = 0; rf_path < 2; rf_path++) { - /* Fill Pwr group */ - for (i = 0; i < 14; i++) { - /* Chanel 1-3 */ - if (i < 3) - index = 0; - /* Channel 4-8 */ - else if (i < 8) - index = 1; - /* Channel 9-13 */ - else - index = 2; - - rtlefuse->pwrgroup_ht20[rf_path][i] = - (rtlefuse->eeprom_pwrgroup[rf_path][index] & - 0xf); - rtlefuse->pwrgroup_ht40[rf_path][i] = - ((rtlefuse->eeprom_pwrgroup[rf_path][index] & - 0xf0) >> 4); - - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-%d pwrgroup_ht20[%d] = 0x%x\n", - rf_path, i, - rtlefuse->pwrgroup_ht20[rf_path][i]); - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-%d pwrgroup_ht40[%d] = 0x%x\n", - rf_path, i, - rtlefuse->pwrgroup_ht40[rf_path][i]); - } - } - - for (i = 0; i < 14; i++) { - /* Read tx power difference between HT OFDM 20/40 MHZ */ - /* channel 1-3 */ - if (i < 3) - index = 0; - /* Channel 4-8 */ - else if (i < 8) - index = 1; - /* Channel 9-14 */ - else - index = 2; - - tempval = hwinfo[EEPROM_TX_PWR_HT20_DIFF + index] & 0xff; - rtlefuse->txpwr_ht20diff[RF90_PATH_A][i] = (tempval & 0xF); - rtlefuse->txpwr_ht20diff[RF90_PATH_B][i] = - ((tempval >> 4) & 0xF); - - /* Read OFDM<->HT tx power diff */ - /* Channel 1-3 */ - if (i < 3) - index = 0; - /* Channel 4-8 */ - else if (i < 8) - index = 0x11; - /* Channel 9-14 */ - else - index = 1; - - tempval = hwinfo[EEPROM_TX_PWR_OFDM_DIFF + index] & 0xff; - rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][i] = - (tempval & 0xF); - rtlefuse->txpwr_legacyhtdiff[RF90_PATH_B][i] = - ((tempval >> 4) & 0xF); - - tempval = hwinfo[TX_PWR_SAFETY_CHK]; - rtlefuse->txpwr_safetyflag = (tempval & 0x01); - } - - rtlefuse->eeprom_regulatory = 0; - if (rtlefuse->eeprom_version >= 2) { - /* BIT(0)~2 */ - if (rtlefuse->eeprom_version >= 4) - rtlefuse->eeprom_regulatory = - (hwinfo[EEPROM_REGULATORY] & 0x7); - else /* BIT(0) */ - rtlefuse->eeprom_regulatory = - (hwinfo[EEPROM_REGULATORY] & 0x1); - } - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory); - - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-A Ht20 to HT40 Diff[%d] = 0x%x\n", - i, rtlefuse->txpwr_ht20diff[RF90_PATH_A][i]); - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-A Legacy to Ht40 Diff[%d] = 0x%x\n", - i, rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][i]); - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-B Ht20 to HT40 Diff[%d] = 0x%x\n", - i, rtlefuse->txpwr_ht20diff[RF90_PATH_B][i]); - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-B Legacy to HT40 Diff[%d] = 0x%x\n", - i, rtlefuse->txpwr_legacyhtdiff[RF90_PATH_B][i]); - - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "TxPwrSafetyFlag = %d\n", rtlefuse->txpwr_safetyflag); - - /* Read RF-indication and Tx Power gain - * index diff of legacy to HT OFDM rate. */ - tempval = hwinfo[EEPROM_RFIND_POWERDIFF] & 0xff; - rtlefuse->eeprom_txpowerdiff = tempval; - rtlefuse->legacy_httxpowerdiff = - rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][0]; - - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "TxPowerDiff = %#x\n", rtlefuse->eeprom_txpowerdiff); - - /* Get TSSI value for each path. */ - usvalue = *(u16 *)&hwinfo[EEPROM_TSSI_A]; - rtlefuse->eeprom_tssi[RF90_PATH_A] = (u8)((usvalue & 0xff00) >> 8); - usvalue = hwinfo[EEPROM_TSSI_B]; - rtlefuse->eeprom_tssi[RF90_PATH_B] = (u8)(usvalue & 0xff); - - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, "TSSI_A = 0x%x, TSSI_B = 0x%x\n", - rtlefuse->eeprom_tssi[RF90_PATH_A], - rtlefuse->eeprom_tssi[RF90_PATH_B]); - - /* Read antenna tx power offset of B/C/D to A from EEPROM */ - /* and read ThermalMeter from EEPROM */ - tempval = hwinfo[EEPROM_THERMALMETER]; - rtlefuse->eeprom_thermalmeter = tempval; - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "thermalmeter = 0x%x\n", rtlefuse->eeprom_thermalmeter); - - /* ThermalMeter, BIT(0)~3 for RFIC1, BIT(4)~7 for RFIC2 */ - rtlefuse->thermalmeter[0] = (rtlefuse->eeprom_thermalmeter & 0x1f); - rtlefuse->tssi_13dbm = rtlefuse->eeprom_thermalmeter * 100; - - /* Read CrystalCap from EEPROM */ - tempval = hwinfo[EEPROM_CRYSTALCAP] >> 4; - rtlefuse->eeprom_crystalcap = tempval; - /* CrystalCap, BIT(12)~15 */ - rtlefuse->crystalcap = rtlefuse->eeprom_crystalcap; - - /* Read IC Version && Channel Plan */ - /* Version ID, Channel plan */ - rtlefuse->eeprom_channelplan = hwinfo[EEPROM_CHANNELPLAN]; - rtlefuse->txpwr_fromeprom = true; - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "EEPROM ChannelPlan = 0x%4x\n", rtlefuse->eeprom_channelplan); - - /* Read Customer ID or Board Type!!! */ - tempval = hwinfo[EEPROM_BOARDTYPE]; - /* Change RF type definition */ - if (tempval == 0) - rtlphy->rf_type = RF_2T2R; - else if (tempval == 1) - rtlphy->rf_type = RF_1T2R; - else if (tempval == 2) - rtlphy->rf_type = RF_1T2R; - else if (tempval == 3) - rtlphy->rf_type = RF_1T1R; - - /* 1T2R but 1SS (1x1 receive combining) */ - rtlefuse->b1x1_recvcombine = false; - if (rtlphy->rf_type == RF_1T2R) { - tempval = rtl_read_byte(rtlpriv, 0x07); - if (!(tempval & BIT(0))) { - rtlefuse->b1x1_recvcombine = true; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "RF_TYPE=1T2R but only 1SS\n"); - } - } - rtlefuse->b1ss_support = rtlefuse->b1x1_recvcombine; - rtlefuse->eeprom_oemid = *&hwinfo[EEPROM_CUSTOMID]; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "EEPROM Customer ID: 0x%2x", - rtlefuse->eeprom_oemid); - - /* set channel paln to world wide 13 */ - rtlefuse->channel_plan = COUNTRY_CODE_WORLD_WIDE_13; -} - -void rtl92se_read_eeprom_info(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 tmp_u1b = 0; - - tmp_u1b = rtl_read_byte(rtlpriv, EPROM_CMD); - - if (tmp_u1b & BIT(4)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EEPROM\n"); - rtlefuse->epromtype = EEPROM_93C46; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EFUSE\n"); - rtlefuse->epromtype = EEPROM_BOOT_EFUSE; - } - - if (tmp_u1b & BIT(5)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - _rtl92se_read_adapter_info(hw); - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Autoload ERR!!\n"); - rtlefuse->autoload_failflag = true; - } -} - -static void rtl92se_update_hal_rate_table(struct ieee80211_hw *hw, - struct ieee80211_sta *sta) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u32 ratr_value; - u8 ratr_index = 0; - u8 nmode = mac->ht_enable; - u8 mimo_ps = IEEE80211_SMPS_OFF; - u16 shortgi_rate = 0; - u32 tmp_ratr_value = 0; - u8 curtxbw_40mhz = mac->bw_40; - u8 curshortgi_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? - 1 : 0; - u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? - 1 : 0; - enum wireless_mode wirelessmode = mac->mode; - - if (rtlhal->current_bandtype == BAND_ON_5G) - ratr_value = sta->supp_rates[1] << 4; - else - ratr_value = sta->supp_rates[0]; - if (mac->opmode == NL80211_IFTYPE_ADHOC) - ratr_value = 0xfff; - ratr_value |= (sta->ht_cap.mcs.rx_mask[1] << 20 | - sta->ht_cap.mcs.rx_mask[0] << 12); - switch (wirelessmode) { - case WIRELESS_MODE_B: - ratr_value &= 0x0000000D; - break; - case WIRELESS_MODE_G: - ratr_value &= 0x00000FF5; - break; - case WIRELESS_MODE_N_24G: - case WIRELESS_MODE_N_5G: - nmode = 1; - if (mimo_ps == IEEE80211_SMPS_STATIC) { - ratr_value &= 0x0007F005; - } else { - u32 ratr_mask; - - if (get_rf_type(rtlphy) == RF_1T2R || - get_rf_type(rtlphy) == RF_1T1R) { - if (curtxbw_40mhz) - ratr_mask = 0x000ff015; - else - ratr_mask = 0x000ff005; - } else { - if (curtxbw_40mhz) - ratr_mask = 0x0f0ff015; - else - ratr_mask = 0x0f0ff005; - } - - ratr_value &= ratr_mask; - } - break; - default: - if (rtlphy->rf_type == RF_1T2R) - ratr_value &= 0x000ff0ff; - else - ratr_value &= 0x0f0ff0ff; - - break; - } - - if (rtlpriv->rtlhal.version >= VERSION_8192S_BCUT) - ratr_value &= 0x0FFFFFFF; - else if (rtlpriv->rtlhal.version == VERSION_8192S_ACUT) - ratr_value &= 0x0FFFFFF0; - - if (nmode && ((curtxbw_40mhz && - curshortgi_40mhz) || (!curtxbw_40mhz && - curshortgi_20mhz))) { - - ratr_value |= 0x10000000; - tmp_ratr_value = (ratr_value >> 12); - - for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) { - if ((1 << shortgi_rate) & tmp_ratr_value) - break; - } - - shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) | - (shortgi_rate << 4) | (shortgi_rate); - - rtl_write_byte(rtlpriv, SG_RATE, shortgi_rate); - } - - rtl_write_dword(rtlpriv, ARFR0 + ratr_index * 4, ratr_value); - if (ratr_value & 0xfffff000) - rtl92s_phy_set_fw_cmd(hw, FW_CMD_RA_REFRESH_N); - else - rtl92s_phy_set_fw_cmd(hw, FW_CMD_RA_REFRESH_BG); - - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n", - rtl_read_dword(rtlpriv, ARFR0)); -} - -static void rtl92se_update_hal_rate_mask(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - u8 rssi_level) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_sta_info *sta_entry = NULL; - u32 ratr_bitmap; - u8 ratr_index = 0; - u8 curtxbw_40mhz = (sta->bandwidth >= IEEE80211_STA_RX_BW_40) ? 1 : 0; - u8 curshortgi_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? - 1 : 0; - u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? - 1 : 0; - enum wireless_mode wirelessmode = 0; - bool shortgi = false; - u32 ratr_value = 0; - u8 shortgi_rate = 0; - u32 mask = 0; - u32 band = 0; - bool bmulticast = false; - u8 macid = 0; - u8 mimo_ps = IEEE80211_SMPS_OFF; - - sta_entry = (struct rtl_sta_info *) sta->drv_priv; - wirelessmode = sta_entry->wireless_mode; - if (mac->opmode == NL80211_IFTYPE_STATION) - curtxbw_40mhz = mac->bw_40; - else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) - macid = sta->aid + 1; - - if (rtlhal->current_bandtype == BAND_ON_5G) - ratr_bitmap = sta->supp_rates[1] << 4; - else - ratr_bitmap = sta->supp_rates[0]; - if (mac->opmode == NL80211_IFTYPE_ADHOC) - ratr_bitmap = 0xfff; - ratr_bitmap |= (sta->ht_cap.mcs.rx_mask[1] << 20 | - sta->ht_cap.mcs.rx_mask[0] << 12); - switch (wirelessmode) { - case WIRELESS_MODE_B: - band |= WIRELESS_11B; - ratr_index = RATR_INX_WIRELESS_B; - if (ratr_bitmap & 0x0000000c) - ratr_bitmap &= 0x0000000d; - else - ratr_bitmap &= 0x0000000f; - break; - case WIRELESS_MODE_G: - band |= (WIRELESS_11G | WIRELESS_11B); - ratr_index = RATR_INX_WIRELESS_GB; - - if (rssi_level == 1) - ratr_bitmap &= 0x00000f00; - else if (rssi_level == 2) - ratr_bitmap &= 0x00000ff0; - else - ratr_bitmap &= 0x00000ff5; - break; - case WIRELESS_MODE_A: - band |= WIRELESS_11A; - ratr_index = RATR_INX_WIRELESS_A; - ratr_bitmap &= 0x00000ff0; - break; - case WIRELESS_MODE_N_24G: - case WIRELESS_MODE_N_5G: - band |= (WIRELESS_11N | WIRELESS_11G | WIRELESS_11B); - ratr_index = RATR_INX_WIRELESS_NGB; - - if (mimo_ps == IEEE80211_SMPS_STATIC) { - if (rssi_level == 1) - ratr_bitmap &= 0x00070000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0007f000; - else - ratr_bitmap &= 0x0007f005; - } else { - if (rtlphy->rf_type == RF_1T2R || - rtlphy->rf_type == RF_1T1R) { - if (rssi_level == 1) { - ratr_bitmap &= 0x000f0000; - } else if (rssi_level == 3) { - ratr_bitmap &= 0x000fc000; - } else if (rssi_level == 5) { - ratr_bitmap &= 0x000ff000; - } else { - if (curtxbw_40mhz) - ratr_bitmap &= 0x000ff015; - else - ratr_bitmap &= 0x000ff005; - } - } else { - if (rssi_level == 1) { - ratr_bitmap &= 0x0f8f0000; - } else if (rssi_level == 3) { - ratr_bitmap &= 0x0f8fc000; - } else if (rssi_level == 5) { - ratr_bitmap &= 0x0f8ff000; - } else { - if (curtxbw_40mhz) - ratr_bitmap &= 0x0f8ff015; - else - ratr_bitmap &= 0x0f8ff005; - } - } - } - - if ((curtxbw_40mhz && curshortgi_40mhz) || - (!curtxbw_40mhz && curshortgi_20mhz)) { - if (macid == 0) - shortgi = true; - else if (macid == 1) - shortgi = false; - } - break; - default: - band |= (WIRELESS_11N | WIRELESS_11G | WIRELESS_11B); - ratr_index = RATR_INX_WIRELESS_NGB; - - if (rtlphy->rf_type == RF_1T2R) - ratr_bitmap &= 0x000ff0ff; - else - ratr_bitmap &= 0x0f8ff0ff; - break; - } - sta_entry->ratr_index = ratr_index; - - if (rtlpriv->rtlhal.version >= VERSION_8192S_BCUT) - ratr_bitmap &= 0x0FFFFFFF; - else if (rtlpriv->rtlhal.version == VERSION_8192S_ACUT) - ratr_bitmap &= 0x0FFFFFF0; - - if (shortgi) { - ratr_bitmap |= 0x10000000; - /* Get MAX MCS available. */ - ratr_value = (ratr_bitmap >> 12); - for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) { - if ((1 << shortgi_rate) & ratr_value) - break; - } - - shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) | - (shortgi_rate << 4) | (shortgi_rate); - rtl_write_byte(rtlpriv, SG_RATE, shortgi_rate); - } - - mask |= (bmulticast ? 1 : 0) << 9 | (macid & 0x1f) << 4 | (band & 0xf); - - RT_TRACE(rtlpriv, COMP_RATR, DBG_TRACE, "mask = %x, bitmap = %x\n", - mask, ratr_bitmap); - rtl_write_dword(rtlpriv, 0x2c4, ratr_bitmap); - rtl_write_dword(rtlpriv, WFM5, (FW_RA_UPDATE_MASK | (mask << 8))); - - if (macid != 0) - sta_entry->ratr_index = ratr_index; -} - -void rtl92se_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->dm.useramask) - rtl92se_update_hal_rate_mask(hw, sta, rssi_level); - else - rtl92se_update_hal_rate_table(hw, sta); -} - -void rtl92se_update_channel_access_setting(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 sifs_timer; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME, - &mac->slot_time); - sifs_timer = 0x0e0e; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SIFS, (u8 *)&sifs_timer); - -} - -/* this ifunction is for RFKILL, it's different with windows, - * because UI will disable wireless when GPIO Radio Off. - * And here we not check or Disable/Enable ASPM like windows*/ -bool rtl92se_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - enum rf_pwrstate rfpwr_toset /*, cur_rfstate */; - unsigned long flag = 0; - bool actuallyset = false; - bool turnonbypowerdomain = false; - - /* just 8191se can check gpio before firstup, 92c/92d have fixed it */ - if ((rtlpci->up_first_time == 1) || (rtlpci->being_init_adapter)) - return false; - - if (ppsc->swrf_processing) - return false; - - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); - if (ppsc->rfchange_inprogress) { - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - return false; - } else { - ppsc->rfchange_inprogress = true; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - } - - /* cur_rfstate = ppsc->rfpwr_state;*/ - - /* because after _rtl92s_phy_set_rfhalt, all power - * closed, so we must open some power for GPIO check, - * or we will always check GPIO RFOFF here, - * And we should close power after GPIO check */ - if (RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) { - _rtl92se_power_domain_init(hw); - turnonbypowerdomain = true; - } - - rfpwr_toset = _rtl92se_rf_onoff_detect(hw); - - if ((ppsc->hwradiooff) && (rfpwr_toset == ERFON)) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "RFKILL-HW Radio ON, RF ON\n"); - - rfpwr_toset = ERFON; - ppsc->hwradiooff = false; - actuallyset = true; - } else if ((!ppsc->hwradiooff) && (rfpwr_toset == ERFOFF)) { - RT_TRACE(rtlpriv, COMP_RF, - DBG_DMESG, "RFKILL-HW Radio OFF, RF OFF\n"); - - rfpwr_toset = ERFOFF; - ppsc->hwradiooff = true; - actuallyset = true; - } - - if (actuallyset) { - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); - ppsc->rfchange_inprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - - /* this not include ifconfig wlan0 down case */ - /* } else if (rfpwr_toset == ERFOFF || cur_rfstate == ERFOFF) { */ - } else { - /* because power_domain_init may be happen when - * _rtl92s_phy_set_rfhalt, this will open some powers - * and cause current increasing about 40 mA for ips, - * rfoff and ifconfig down, so we set - * _rtl92s_phy_set_rfhalt again here */ - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC && - turnonbypowerdomain) { - _rtl92s_phy_set_rfhalt(hw); - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - } - - spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flag); - ppsc->rfchange_inprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flag); - } - - *valid = 1; - return !ppsc->hwradiooff; - -} - -/* Is_wepkey just used for WEP used as group & pairwise key - * if pairwise is AES ang group is WEP Is_wepkey == false.*/ -void rtl92se_set_key(struct ieee80211_hw *hw, u32 key_index, u8 *p_macaddr, - bool is_group, u8 enc_algo, bool is_wepkey, bool clear_all) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 *macaddr = p_macaddr; - - u32 entry_id = 0; - bool is_pairwise = false; - - static u8 cam_const_addr[4][6] = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} - }; - static u8 cam_const_broad[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - }; - - if (clear_all) { - u8 idx = 0; - u8 cam_offset = 0; - u8 clear_number = 5; - - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "clear_all\n"); - - for (idx = 0; idx < clear_number; idx++) { - rtl_cam_mark_invalid(hw, cam_offset + idx); - rtl_cam_empty_entry(hw, cam_offset + idx); - - if (idx < 5) { - memset(rtlpriv->sec.key_buf[idx], 0, - MAX_KEY_LEN); - rtlpriv->sec.key_len[idx] = 0; - } - } - - } else { - switch (enc_algo) { - case WEP40_ENCRYPTION: - enc_algo = CAM_WEP40; - break; - case WEP104_ENCRYPTION: - enc_algo = CAM_WEP104; - break; - case TKIP_ENCRYPTION: - enc_algo = CAM_TKIP; - break; - case AESCCMP_ENCRYPTION: - enc_algo = CAM_AES; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - enc_algo = CAM_TKIP; - break; - } - - if (is_wepkey || rtlpriv->sec.use_defaultkey) { - macaddr = cam_const_addr[key_index]; - entry_id = key_index; - } else { - if (is_group) { - macaddr = cam_const_broad; - entry_id = key_index; - } else { - if (mac->opmode == NL80211_IFTYPE_AP) { - entry_id = rtl_cam_get_free_entry(hw, - p_macaddr); - if (entry_id >= TOTAL_CAM_ENTRY) { - RT_TRACE(rtlpriv, - COMP_SEC, DBG_EMERG, - "Can not find free hw security cam entry\n"); - return; - } - } else { - entry_id = CAM_PAIRWISE_KEY_POSITION; - } - - key_index = PAIRWISE_KEYIDX; - is_pairwise = true; - } - } - - if (rtlpriv->sec.key_len[key_index] == 0) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "delete one entry, entry_id is %d\n", - entry_id); - if (mac->opmode == NL80211_IFTYPE_AP) - rtl_cam_del_entry(hw, p_macaddr); - rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); - } else { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "add one entry\n"); - if (is_pairwise) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "set Pairwise key\n"); - - rtl_cam_add_one_entry(hw, macaddr, key_index, - entry_id, enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf[key_index]); - } else { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "set group key\n"); - - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - rtl_cam_add_one_entry(hw, - rtlefuse->dev_addr, - PAIRWISE_KEYIDX, - CAM_PAIRWISE_KEY_POSITION, - enc_algo, CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf[entry_id]); - } - - rtl_cam_add_one_entry(hw, macaddr, key_index, - entry_id, enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf[entry_id]); - } - - } - } -} - -void rtl92se_suspend(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - rtlpci->up_first_time = true; -} - -void rtl92se_resume(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u32 val; - - pci_read_config_dword(rtlpci->pdev, 0x40, &val); - if ((val & 0x0000ff00) != 0) - pci_write_config_dword(rtlpci->pdev, 0x40, - val & 0xffff00ff); -} - -/* Turn on AAP (RCR:bit 0) for promicuous mode. */ -void rtl92se_allow_all_destaddr(struct ieee80211_hw *hw, - bool allow_all_da, bool write_into_reg) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - if (allow_all_da) /* Set BIT0 */ - rtlpci->receive_config |= RCR_AAP; - else /* Clear BIT0 */ - rtlpci->receive_config &= ~RCR_AAP; - - if (write_into_reg) - rtl_write_dword(rtlpriv, RCR, rtlpci->receive_config); - - RT_TRACE(rtlpriv, COMP_TURBO | COMP_INIT, DBG_LOUD, - "receive_config=0x%08X, write_into_reg=%d\n", - rtlpci->receive_config, write_into_reg); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.h b/drivers/net/wireless/rtlwifi/rtl8192se/hw.h deleted file mode 100644 index da48aa8cbe6f..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.h +++ /dev/null @@ -1,80 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ -#ifndef __REALTEK_PCI92SE_HW_H__ -#define __REALTEK_PCI92SE_HW_H__ - -#define MSR_LINK_MANAGED 2 -#define MSR_LINK_NONE 0 -#define MSR_LINK_SHIFT 0 -#define MSR_LINK_ADHOC 1 -#define MSR_LINK_MASTER 3 - -enum WIRELESS_NETWORK_TYPE { - WIRELESS_11B = 1, - WIRELESS_11G = 2, - WIRELESS_11A = 4, - WIRELESS_11N = 8 -}; - -void rtl92se_get_hw_reg(struct ieee80211_hw *hw, - u8 variable, u8 *val); -void rtl92se_read_eeprom_info(struct ieee80211_hw *hw); -void rtl92se_interrupt_recognized(struct ieee80211_hw *hw, - u32 *inta, u32 *intb); -int rtl92se_hw_init(struct ieee80211_hw *hw); -void rtl92se_card_disable(struct ieee80211_hw *hw); -void rtl92se_enable_interrupt(struct ieee80211_hw *hw); -void rtl92se_disable_interrupt(struct ieee80211_hw *hw); -int rtl92se_set_network_type(struct ieee80211_hw *hw, - enum nl80211_iftype type); -void rtl92se_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); -void rtl92se_set_mac_addr(struct rtl_io *io, const u8 *addr); -void rtl92se_set_qos(struct ieee80211_hw *hw, int aci); -void rtl92se_set_beacon_related_registers(struct ieee80211_hw *hw); -void rtl92se_set_beacon_interval(struct ieee80211_hw *hw); -void rtl92se_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr); -void rtl92se_set_hw_reg(struct ieee80211_hw *hw, u8 variable, - u8 *val); -void rtl92se_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level); -void rtl92se_update_channel_access_setting(struct ieee80211_hw *hw); -bool rtl92se_gpio_radio_on_off_checking(struct ieee80211_hw *hw, - u8 *valid); -void rtl8192se_gpiobit3_cfg_inputmode(struct ieee80211_hw *hw); -void rtl92se_enable_hw_security_config(struct ieee80211_hw *hw); -void rtl92se_set_key(struct ieee80211_hw *hw, - u32 key_index, u8 *macaddr, bool is_group, - u8 enc_algo, bool is_wepkey, bool clear_all); -void rtl92se_suspend(struct ieee80211_hw *hw); -void rtl92se_resume(struct ieee80211_hw *hw); -void rtl92se_allow_all_destaddr(struct ieee80211_hw *hw, - bool allow_all_da, bool write_into_reg); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/led.c b/drivers/net/wireless/rtlwifi/rtl8192se/led.c deleted file mode 100644 index 44949b5cbb87..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/led.c +++ /dev/null @@ -1,151 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "reg.h" -#include "led.h" - -static void _rtl92se_init_led(struct ieee80211_hw *hw, - struct rtl_led *pled, enum rtl_led_pin ledpin) -{ - pled->hw = hw; - pled->ledpin = ledpin; - pled->ledon = false; -} - -void rtl92se_init_sw_leds(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - _rtl92se_init_led(hw, &(pcipriv->ledctl.sw_led0), LED_PIN_LED0); - _rtl92se_init_led(hw, &(pcipriv->ledctl.sw_led1), LED_PIN_LED1); -} - -void rtl92se_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - u8 ledcfg; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n", - LEDCFG, pled->ledpin); - - ledcfg = rtl_read_byte(rtlpriv, LEDCFG); - - switch (pled->ledpin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - rtl_write_byte(rtlpriv, LEDCFG, ledcfg & 0xf0); - break; - case LED_PIN_LED1: - rtl_write_byte(rtlpriv, LEDCFG, ledcfg & 0x0f); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - pled->ledon = true; -} - -void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - struct rtl_priv *rtlpriv; - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - u8 ledcfg; - - rtlpriv = rtl_priv(hw); - if (!rtlpriv || rtlpriv->max_fw_size) - return; - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "LedAddr:%X ledpin=%d\n", - LEDCFG, pled->ledpin); - - ledcfg = rtl_read_byte(rtlpriv, LEDCFG); - - switch (pled->ledpin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - ledcfg &= 0xf0; - if (pcipriv->ledctl.led_opendrain) - rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(1))); - else - rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(3))); - break; - case LED_PIN_LED1: - ledcfg &= 0x0f; - rtl_write_byte(rtlpriv, LEDCFG, (ledcfg | BIT(3))); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - pled->ledon = false; -} - -static void _rtl92se_sw_led_control(struct ieee80211_hw *hw, - enum led_ctl_mode ledaction) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); - switch (ledaction) { - case LED_CTL_POWER_ON: - case LED_CTL_LINK: - case LED_CTL_NO_LINK: - rtl92se_sw_led_on(hw, pLed0); - break; - case LED_CTL_POWER_OFF: - rtl92se_sw_led_off(hw, pLed0); - break; - default: - break; - } -} - -void rtl92se_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - if ((ppsc->rfoff_reason > RF_CHANGE_BY_PS) && - (ledaction == LED_CTL_TX || - ledaction == LED_CTL_RX || - ledaction == LED_CTL_SITE_SURVEY || - ledaction == LED_CTL_LINK || - ledaction == LED_CTL_NO_LINK || - ledaction == LED_CTL_START_TO_LINK || - ledaction == LED_CTL_POWER_ON)) { - return; - } - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "ledaction %d\n", ledaction); - - _rtl92se_sw_led_control(hw, ledaction); -} - diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/led.h b/drivers/net/wireless/rtlwifi/rtl8192se/led.h deleted file mode 100644 index 2182dbeb5f32..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/led.h +++ /dev/null @@ -1,37 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ -#ifndef __REALTEK_PCI92SE_LED_H__ -#define __REALTEK_PCI92SE_LED_H__ - -void rtl92se_init_sw_leds(struct ieee80211_hw *hw); -void rtl92se_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl92se_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl92se_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c deleted file mode 100644 index 9c092e6eb3fe..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c +++ /dev/null @@ -1,1727 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../ps.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" -#include "fw.h" -#include "hw.h" -#include "table.h" - -static u32 _rtl92s_phy_calculate_bit_shift(u32 bitmask) -{ - u32 i; - - for (i = 0; i <= 31; i++) { - if (((bitmask >> i) & 0x1) == 1) - break; - } - - return i; -} - -u32 rtl92s_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 returnvalue = 0, originalvalue, bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "regaddr(%#x), bitmask(%#x)\n", - regaddr, bitmask); - - originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _rtl92s_phy_calculate_bit_shift(bitmask); - returnvalue = (originalvalue & bitmask) >> bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "BBR MASK=0x%x Addr[0x%x]=0x%x\n", - bitmask, regaddr, originalvalue); - - return returnvalue; - -} - -void rtl92s_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask, - u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 originalvalue, bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x)\n", - regaddr, bitmask, data); - - if (bitmask != MASKDWORD) { - originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _rtl92s_phy_calculate_bit_shift(bitmask); - data = ((originalvalue & (~bitmask)) | (data << bitshift)); - } - - rtl_write_dword(rtlpriv, regaddr, data); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x)\n", - regaddr, bitmask, data); - -} - -static u32 _rtl92s_phy_rf_serial_read(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset) -{ - - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; - u32 newoffset; - u32 tmplong, tmplong2; - u8 rfpi_enable = 0; - u32 retvalue = 0; - - offset &= 0x3f; - newoffset = offset; - - tmplong = rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, MASKDWORD); - - if (rfpath == RF90_PATH_A) - tmplong2 = tmplong; - else - tmplong2 = rtl_get_bbreg(hw, pphyreg->rfhssi_para2, MASKDWORD); - - tmplong2 = (tmplong2 & (~BLSSI_READADDRESS)) | (newoffset << 23) | - BLSSI_READEDGE; - - rtl_set_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, MASKDWORD, - tmplong & (~BLSSI_READEDGE)); - - mdelay(1); - - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, MASKDWORD, tmplong2); - mdelay(1); - - rtl_set_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, MASKDWORD, tmplong | - BLSSI_READEDGE); - mdelay(1); - - if (rfpath == RF90_PATH_A) - rfpi_enable = (u8)rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER1, - BIT(8)); - else if (rfpath == RF90_PATH_B) - rfpi_enable = (u8)rtl_get_bbreg(hw, RFPGA0_XB_HSSIPARAMETER1, - BIT(8)); - - if (rfpi_enable) - retvalue = rtl_get_bbreg(hw, pphyreg->rf_rbpi, - BLSSI_READBACK_DATA); - else - retvalue = rtl_get_bbreg(hw, pphyreg->rf_rb, - BLSSI_READBACK_DATA); - - retvalue = rtl_get_bbreg(hw, pphyreg->rf_rb, - BLSSI_READBACK_DATA); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFR-%d Addr[0x%x]=0x%x\n", - rfpath, pphyreg->rf_rb, retvalue); - - return retvalue; - -} - -static void _rtl92s_phy_rf_serial_write(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset, - u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; - u32 data_and_addr = 0; - u32 newoffset; - - offset &= 0x3f; - newoffset = offset; - - data_and_addr = ((newoffset << 20) | (data & 0x000fffff)) & 0x0fffffff; - rtl_set_bbreg(hw, pphyreg->rf3wire_offset, MASKDWORD, data_and_addr); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFW-%d Addr[0x%x]=0x%x\n", - rfpath, pphyreg->rf3wire_offset, data_and_addr); -} - - -u32 rtl92s_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, - u32 regaddr, u32 bitmask) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 original_value, readback_value, bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n", - regaddr, rfpath, bitmask); - - spin_lock(&rtlpriv->locks.rf_lock); - - original_value = _rtl92s_phy_rf_serial_read(hw, rfpath, regaddr); - - bitshift = _rtl92s_phy_calculate_bit_shift(bitmask); - readback_value = (original_value & bitmask) >> bitshift; - - spin_unlock(&rtlpriv->locks.rf_lock); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n", - regaddr, rfpath, bitmask, original_value); - - return readback_value; -} - -void rtl92s_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, - u32 regaddr, u32 bitmask, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 original_value, bitshift; - - if (!((rtlphy->rf_pathmap >> rfpath) & 0x1)) - return; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", - regaddr, bitmask, data, rfpath); - - spin_lock(&rtlpriv->locks.rf_lock); - - if (bitmask != RFREG_OFFSET_MASK) { - original_value = _rtl92s_phy_rf_serial_read(hw, rfpath, - regaddr); - bitshift = _rtl92s_phy_calculate_bit_shift(bitmask); - data = ((original_value & (~bitmask)) | (data << bitshift)); - } - - _rtl92s_phy_rf_serial_write(hw, rfpath, regaddr, data); - - spin_unlock(&rtlpriv->locks.rf_lock); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", - regaddr, bitmask, data, rfpath); - -} - -void rtl92s_phy_scan_operation_backup(struct ieee80211_hw *hw, - u8 operation) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (!is_hal_stop(rtlhal)) { - switch (operation) { - case SCAN_OPT_BACKUP: - rtl92s_phy_set_fw_cmd(hw, FW_CMD_PAUSE_DM_BY_SCAN); - break; - case SCAN_OPT_RESTORE: - rtl92s_phy_set_fw_cmd(hw, FW_CMD_RESUME_DM_BY_SCAN); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Unknown operation\n"); - break; - } - } -} - -void rtl92s_phy_set_bw_mode(struct ieee80211_hw *hw, - enum nl80211_channel_type ch_type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u8 reg_bw_opmode; - - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "Switch to %s bandwidth\n", - rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? - "20MHz" : "40MHz"); - - if (rtlphy->set_bwmode_inprogress) - return; - if (is_hal_stop(rtlhal)) - return; - - rtlphy->set_bwmode_inprogress = true; - - reg_bw_opmode = rtl_read_byte(rtlpriv, BW_OPMODE); - /* dummy read */ - rtl_read_byte(rtlpriv, RRSR + 2); - - switch (rtlphy->current_chan_bw) { - case HT_CHANNEL_WIDTH_20: - reg_bw_opmode |= BW_OPMODE_20MHZ; - rtl_write_byte(rtlpriv, BW_OPMODE, reg_bw_opmode); - break; - case HT_CHANNEL_WIDTH_20_40: - reg_bw_opmode &= ~BW_OPMODE_20MHZ; - rtl_write_byte(rtlpriv, BW_OPMODE, reg_bw_opmode); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", rtlphy->current_chan_bw); - break; - } - - switch (rtlphy->current_chan_bw) { - case HT_CHANNEL_WIDTH_20: - rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x0); - rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x0); - - if (rtlhal->version >= VERSION_8192S_BCUT) - rtl_write_byte(rtlpriv, RFPGA0_ANALOGPARAMETER2, 0x58); - break; - case HT_CHANNEL_WIDTH_20_40: - rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x1); - rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x1); - - rtl_set_bbreg(hw, RCCK0_SYSTEM, BCCK_SIDEBAND, - (mac->cur_40_prime_sc >> 1)); - rtl_set_bbreg(hw, ROFDM1_LSTF, 0xC00, mac->cur_40_prime_sc); - - if (rtlhal->version >= VERSION_8192S_BCUT) - rtl_write_byte(rtlpriv, RFPGA0_ANALOGPARAMETER2, 0x18); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", rtlphy->current_chan_bw); - break; - } - - rtl92s_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); - rtlphy->set_bwmode_inprogress = false; - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n"); -} - -static bool _rtl92s_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable, - u32 cmdtableidx, u32 cmdtablesz, enum swchnlcmd_id cmdid, - u32 para1, u32 para2, u32 msdelay) -{ - struct swchnlcmd *pcmd; - - if (cmdtable == NULL) { - RT_ASSERT(false, "cmdtable cannot be NULL\n"); - return false; - } - - if (cmdtableidx >= cmdtablesz) - return false; - - pcmd = cmdtable + cmdtableidx; - pcmd->cmdid = cmdid; - pcmd->para1 = para1; - pcmd->para2 = para2; - pcmd->msdelay = msdelay; - - return true; -} - -static bool _rtl92s_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, - u8 channel, u8 *stage, u8 *step, u32 *delay) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct swchnlcmd precommoncmd[MAX_PRECMD_CNT]; - u32 precommoncmdcnt; - struct swchnlcmd postcommoncmd[MAX_POSTCMD_CNT]; - u32 postcommoncmdcnt; - struct swchnlcmd rfdependcmd[MAX_RFDEPENDCMD_CNT]; - u32 rfdependcmdcnt; - struct swchnlcmd *currentcmd = NULL; - u8 rfpath; - u8 num_total_rfpath = rtlphy->num_total_rfpath; - - precommoncmdcnt = 0; - _rtl92s_phy_set_sw_chnl_cmdarray(precommoncmd, precommoncmdcnt++, - MAX_PRECMD_CNT, CMDID_SET_TXPOWEROWER_LEVEL, 0, 0, 0); - _rtl92s_phy_set_sw_chnl_cmdarray(precommoncmd, precommoncmdcnt++, - MAX_PRECMD_CNT, CMDID_END, 0, 0, 0); - - postcommoncmdcnt = 0; - - _rtl92s_phy_set_sw_chnl_cmdarray(postcommoncmd, postcommoncmdcnt++, - MAX_POSTCMD_CNT, CMDID_END, 0, 0, 0); - - rfdependcmdcnt = 0; - - RT_ASSERT((channel >= 1 && channel <= 14), - "invalid channel for Zebra: %d\n", channel); - - _rtl92s_phy_set_sw_chnl_cmdarray(rfdependcmd, rfdependcmdcnt++, - MAX_RFDEPENDCMD_CNT, CMDID_RF_WRITEREG, - RF_CHNLBW, channel, 10); - - _rtl92s_phy_set_sw_chnl_cmdarray(rfdependcmd, rfdependcmdcnt++, - MAX_RFDEPENDCMD_CNT, CMDID_END, 0, 0, 0); - - do { - switch (*stage) { - case 0: - currentcmd = &precommoncmd[*step]; - break; - case 1: - currentcmd = &rfdependcmd[*step]; - break; - case 2: - currentcmd = &postcommoncmd[*step]; - break; - } - - if (currentcmd->cmdid == CMDID_END) { - if ((*stage) == 2) { - return true; - } else { - (*stage)++; - (*step) = 0; - continue; - } - } - - switch (currentcmd->cmdid) { - case CMDID_SET_TXPOWEROWER_LEVEL: - rtl92s_phy_set_txpower(hw, channel); - break; - case CMDID_WRITEPORT_ULONG: - rtl_write_dword(rtlpriv, currentcmd->para1, - currentcmd->para2); - break; - case CMDID_WRITEPORT_USHORT: - rtl_write_word(rtlpriv, currentcmd->para1, - (u16)currentcmd->para2); - break; - case CMDID_WRITEPORT_UCHAR: - rtl_write_byte(rtlpriv, currentcmd->para1, - (u8)currentcmd->para2); - break; - case CMDID_RF_WRITEREG: - for (rfpath = 0; rfpath < num_total_rfpath; rfpath++) { - rtlphy->rfreg_chnlval[rfpath] = - ((rtlphy->rfreg_chnlval[rfpath] & - 0xfffffc00) | currentcmd->para2); - rtl_set_rfreg(hw, (enum radio_path)rfpath, - currentcmd->para1, - RFREG_OFFSET_MASK, - rtlphy->rfreg_chnlval[rfpath]); - } - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - - break; - } while (true); - - (*delay) = currentcmd->msdelay; - (*step)++; - return false; -} - -u8 rtl92s_phy_sw_chnl(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 delay; - bool ret; - - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "switch to channel%d\n", - rtlphy->current_channel); - - if (rtlphy->sw_chnl_inprogress) - return 0; - - if (rtlphy->set_bwmode_inprogress) - return 0; - - if (is_hal_stop(rtlhal)) - return 0; - - rtlphy->sw_chnl_inprogress = true; - rtlphy->sw_chnl_stage = 0; - rtlphy->sw_chnl_step = 0; - - do { - if (!rtlphy->sw_chnl_inprogress) - break; - - ret = _rtl92s_phy_sw_chnl_step_by_step(hw, - rtlphy->current_channel, - &rtlphy->sw_chnl_stage, - &rtlphy->sw_chnl_step, &delay); - if (!ret) { - if (delay > 0) - mdelay(delay); - else - continue; - } else { - rtlphy->sw_chnl_inprogress = false; - } - break; - } while (true); - - rtlphy->sw_chnl_inprogress = false; - - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n"); - - return 1; -} - -static void _rtl92se_phy_set_rf_sleep(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 u1btmp; - - u1btmp = rtl_read_byte(rtlpriv, LDOV12D_CTRL); - u1btmp |= BIT(0); - - rtl_write_byte(rtlpriv, LDOV12D_CTRL, u1btmp); - rtl_write_byte(rtlpriv, SPS1_CTRL, 0x0); - rtl_write_byte(rtlpriv, TXPAUSE, 0xFF); - rtl_write_word(rtlpriv, CMDR, 0x57FC); - udelay(100); - - rtl_write_word(rtlpriv, CMDR, 0x77FC); - rtl_write_byte(rtlpriv, PHY_CCA, 0x0); - udelay(10); - - rtl_write_word(rtlpriv, CMDR, 0x37FC); - udelay(10); - - rtl_write_word(rtlpriv, CMDR, 0x77FC); - udelay(10); - - rtl_write_word(rtlpriv, CMDR, 0x57FC); - - /* we should chnge GPIO to input mode - * this will drop away current about 25mA*/ - rtl8192se_gpiobit3_cfg_inputmode(hw); -} - -bool rtl92s_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool bresult = true; - u8 i, queue_id; - struct rtl8192_tx_ring *ring = NULL; - - if (rfpwr_state == ppsc->rfpwr_state) - return false; - - switch (rfpwr_state) { - case ERFON:{ - if ((ppsc->rfpwr_state == ERFOFF) && - RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) { - - bool rtstatus; - u32 InitializeCount = 0; - do { - InitializeCount++; - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "IPS Set eRf nic enable\n"); - rtstatus = rtl_ps_enable_nic(hw); - } while (!rtstatus && (InitializeCount < 10)); - - RT_CLEAR_PS_LEVEL(ppsc, - RT_RF_OFF_LEVL_HALT_NIC); - } else { - RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, - "awake, sleeped:%d ms state_inap:%x\n", - jiffies_to_msecs(jiffies - - ppsc-> - last_sleep_jiffies), - rtlpriv->psc.state_inap); - ppsc->last_awake_jiffies = jiffies; - rtl_write_word(rtlpriv, CMDR, 0x37FC); - rtl_write_byte(rtlpriv, TXPAUSE, 0x00); - rtl_write_byte(rtlpriv, PHY_CCA, 0x3); - } - - if (mac->link_state == MAC80211_LINKED) - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_LINK); - else - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_NO_LINK); - break; - } - case ERFOFF:{ - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "IPS Set eRf nic disable\n"); - rtl_ps_disable_nic(hw); - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - } else { - if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_NO_LINK); - else - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_POWER_OFF); - } - break; - } - case ERFSLEEP: - if (ppsc->rfpwr_state == ERFOFF) - return false; - - for (queue_id = 0, i = 0; - queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { - ring = &pcipriv->dev.tx_ring[queue_id]; - if (skb_queue_len(&ring->queue) == 0 || - queue_id == BEACON_QUEUE) { - queue_id++; - continue; - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "eRf Off/Sleep: %d times TcbBusyQueue[%d] = %d before doze!\n", - i + 1, queue_id, - skb_queue_len(&ring->queue)); - - udelay(10); - i++; - } - - if (i >= MAX_DOZE_WAITING_TIMES_9x) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "ERFOFF: %d times TcbBusyQueue[%d] = %d !\n", - MAX_DOZE_WAITING_TIMES_9x, - queue_id, - skb_queue_len(&ring->queue)); - break; - } - } - - RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, - "Set ERFSLEEP awaked:%d ms\n", - jiffies_to_msecs(jiffies - - ppsc->last_awake_jiffies)); - - RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, - "sleep awaked:%d ms state_inap:%x\n", - jiffies_to_msecs(jiffies - - ppsc->last_awake_jiffies), - rtlpriv->psc.state_inap); - ppsc->last_sleep_jiffies = jiffies; - _rtl92se_phy_set_rf_sleep(hw); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - bresult = false; - break; - } - - if (bresult) - ppsc->rfpwr_state = rfpwr_state; - - return bresult; -} - -static bool _rtl92s_phy_config_rfpa_bias_current(struct ieee80211_hw *hw, - enum radio_path rfpath) -{ - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - bool rtstatus = true; - u32 tmpval = 0; - - /* If inferiority IC, we have to increase the PA bias current */ - if (rtlhal->ic_class != IC_INFERIORITY_A) { - tmpval = rtl92s_phy_query_rf_reg(hw, rfpath, RF_IPA, 0xf); - rtl92s_phy_set_rf_reg(hw, rfpath, RF_IPA, 0xf, tmpval + 1); - } - - return rtstatus; -} - -static void _rtl92s_store_pwrindex_diffrate_offset(struct ieee80211_hw *hw, - u32 reg_addr, u32 bitmask, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - int index; - - if (reg_addr == RTXAGC_RATE18_06) - index = 0; - else if (reg_addr == RTXAGC_RATE54_24) - index = 1; - else if (reg_addr == RTXAGC_CCK_MCS32) - index = 6; - else if (reg_addr == RTXAGC_MCS03_MCS00) - index = 2; - else if (reg_addr == RTXAGC_MCS07_MCS04) - index = 3; - else if (reg_addr == RTXAGC_MCS11_MCS08) - index = 4; - else if (reg_addr == RTXAGC_MCS15_MCS12) - index = 5; - else - return; - - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][index] = data; - if (index == 5) - rtlphy->pwrgroup_cnt++; -} - -static void _rtl92s_phy_init_register_definition(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - /*RF Interface Sowrtware Control */ - rtlphy->phyreg_def[RF90_PATH_A].rfintfs = RFPGA0_XAB_RFINTERFACESW; - rtlphy->phyreg_def[RF90_PATH_B].rfintfs = RFPGA0_XAB_RFINTERFACESW; - rtlphy->phyreg_def[RF90_PATH_C].rfintfs = RFPGA0_XCD_RFINTERFACESW; - rtlphy->phyreg_def[RF90_PATH_D].rfintfs = RFPGA0_XCD_RFINTERFACESW; - - /* RF Interface Readback Value */ - rtlphy->phyreg_def[RF90_PATH_A].rfintfi = RFPGA0_XAB_RFINTERFACERB; - rtlphy->phyreg_def[RF90_PATH_B].rfintfi = RFPGA0_XAB_RFINTERFACERB; - rtlphy->phyreg_def[RF90_PATH_C].rfintfi = RFPGA0_XCD_RFINTERFACERB; - rtlphy->phyreg_def[RF90_PATH_D].rfintfi = RFPGA0_XCD_RFINTERFACERB; - - /* RF Interface Output (and Enable) */ - rtlphy->phyreg_def[RF90_PATH_A].rfintfo = RFPGA0_XA_RFINTERFACEOE; - rtlphy->phyreg_def[RF90_PATH_B].rfintfo = RFPGA0_XB_RFINTERFACEOE; - rtlphy->phyreg_def[RF90_PATH_C].rfintfo = RFPGA0_XC_RFINTERFACEOE; - rtlphy->phyreg_def[RF90_PATH_D].rfintfo = RFPGA0_XD_RFINTERFACEOE; - - /* RF Interface (Output and) Enable */ - rtlphy->phyreg_def[RF90_PATH_A].rfintfe = RFPGA0_XA_RFINTERFACEOE; - rtlphy->phyreg_def[RF90_PATH_B].rfintfe = RFPGA0_XB_RFINTERFACEOE; - rtlphy->phyreg_def[RF90_PATH_C].rfintfe = RFPGA0_XC_RFINTERFACEOE; - rtlphy->phyreg_def[RF90_PATH_D].rfintfe = RFPGA0_XD_RFINTERFACEOE; - - /* Addr of LSSI. Wirte RF register by driver */ - rtlphy->phyreg_def[RF90_PATH_A].rf3wire_offset = - RFPGA0_XA_LSSIPARAMETER; - rtlphy->phyreg_def[RF90_PATH_B].rf3wire_offset = - RFPGA0_XB_LSSIPARAMETER; - rtlphy->phyreg_def[RF90_PATH_C].rf3wire_offset = - RFPGA0_XC_LSSIPARAMETER; - rtlphy->phyreg_def[RF90_PATH_D].rf3wire_offset = - RFPGA0_XD_LSSIPARAMETER; - - /* RF parameter */ - rtlphy->phyreg_def[RF90_PATH_A].rflssi_select = RFPGA0_XAB_RFPARAMETER; - rtlphy->phyreg_def[RF90_PATH_B].rflssi_select = RFPGA0_XAB_RFPARAMETER; - rtlphy->phyreg_def[RF90_PATH_C].rflssi_select = RFPGA0_XCD_RFPARAMETER; - rtlphy->phyreg_def[RF90_PATH_D].rflssi_select = RFPGA0_XCD_RFPARAMETER; - - /* Tx AGC Gain Stage (same for all path. Should we remove this?) */ - rtlphy->phyreg_def[RF90_PATH_A].rftxgain_stage = RFPGA0_TXGAINSTAGE; - rtlphy->phyreg_def[RF90_PATH_B].rftxgain_stage = RFPGA0_TXGAINSTAGE; - rtlphy->phyreg_def[RF90_PATH_C].rftxgain_stage = RFPGA0_TXGAINSTAGE; - rtlphy->phyreg_def[RF90_PATH_D].rftxgain_stage = RFPGA0_TXGAINSTAGE; - - /* Tranceiver A~D HSSI Parameter-1 */ - rtlphy->phyreg_def[RF90_PATH_A].rfhssi_para1 = RFPGA0_XA_HSSIPARAMETER1; - rtlphy->phyreg_def[RF90_PATH_B].rfhssi_para1 = RFPGA0_XB_HSSIPARAMETER1; - rtlphy->phyreg_def[RF90_PATH_C].rfhssi_para1 = RFPGA0_XC_HSSIPARAMETER1; - rtlphy->phyreg_def[RF90_PATH_D].rfhssi_para1 = RFPGA0_XD_HSSIPARAMETER1; - - /* Tranceiver A~D HSSI Parameter-2 */ - rtlphy->phyreg_def[RF90_PATH_A].rfhssi_para2 = RFPGA0_XA_HSSIPARAMETER2; - rtlphy->phyreg_def[RF90_PATH_B].rfhssi_para2 = RFPGA0_XB_HSSIPARAMETER2; - rtlphy->phyreg_def[RF90_PATH_C].rfhssi_para2 = RFPGA0_XC_HSSIPARAMETER2; - rtlphy->phyreg_def[RF90_PATH_D].rfhssi_para2 = RFPGA0_XD_HSSIPARAMETER2; - - /* RF switch Control */ - rtlphy->phyreg_def[RF90_PATH_A].rfsw_ctrl = RFPGA0_XAB_SWITCHCONTROL; - rtlphy->phyreg_def[RF90_PATH_B].rfsw_ctrl = RFPGA0_XAB_SWITCHCONTROL; - rtlphy->phyreg_def[RF90_PATH_C].rfsw_ctrl = RFPGA0_XCD_SWITCHCONTROL; - rtlphy->phyreg_def[RF90_PATH_D].rfsw_ctrl = RFPGA0_XCD_SWITCHCONTROL; - - /* AGC control 1 */ - rtlphy->phyreg_def[RF90_PATH_A].rfagc_control1 = ROFDM0_XAAGCCORE1; - rtlphy->phyreg_def[RF90_PATH_B].rfagc_control1 = ROFDM0_XBAGCCORE1; - rtlphy->phyreg_def[RF90_PATH_C].rfagc_control1 = ROFDM0_XCAGCCORE1; - rtlphy->phyreg_def[RF90_PATH_D].rfagc_control1 = ROFDM0_XDAGCCORE1; - - /* AGC control 2 */ - rtlphy->phyreg_def[RF90_PATH_A].rfagc_control2 = ROFDM0_XAAGCCORE2; - rtlphy->phyreg_def[RF90_PATH_B].rfagc_control2 = ROFDM0_XBAGCCORE2; - rtlphy->phyreg_def[RF90_PATH_C].rfagc_control2 = ROFDM0_XCAGCCORE2; - rtlphy->phyreg_def[RF90_PATH_D].rfagc_control2 = ROFDM0_XDAGCCORE2; - - /* RX AFE control 1 */ - rtlphy->phyreg_def[RF90_PATH_A].rfrxiq_imbal = ROFDM0_XARXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_B].rfrxiq_imbal = ROFDM0_XBRXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_C].rfrxiq_imbal = ROFDM0_XCRXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_D].rfrxiq_imbal = ROFDM0_XDRXIQIMBALANCE; - - /* RX AFE control 1 */ - rtlphy->phyreg_def[RF90_PATH_A].rfrx_afe = ROFDM0_XARXAFE; - rtlphy->phyreg_def[RF90_PATH_B].rfrx_afe = ROFDM0_XBRXAFE; - rtlphy->phyreg_def[RF90_PATH_C].rfrx_afe = ROFDM0_XCRXAFE; - rtlphy->phyreg_def[RF90_PATH_D].rfrx_afe = ROFDM0_XDRXAFE; - - /* Tx AFE control 1 */ - rtlphy->phyreg_def[RF90_PATH_A].rftxiq_imbal = ROFDM0_XATXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_B].rftxiq_imbal = ROFDM0_XBTXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_C].rftxiq_imbal = ROFDM0_XCTXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_D].rftxiq_imbal = ROFDM0_XDTXIQIMBALANCE; - - /* Tx AFE control 2 */ - rtlphy->phyreg_def[RF90_PATH_A].rftx_afe = ROFDM0_XATXAFE; - rtlphy->phyreg_def[RF90_PATH_B].rftx_afe = ROFDM0_XBTXAFE; - rtlphy->phyreg_def[RF90_PATH_C].rftx_afe = ROFDM0_XCTXAFE; - rtlphy->phyreg_def[RF90_PATH_D].rftx_afe = ROFDM0_XDTXAFE; - - /* Tranceiver LSSI Readback */ - rtlphy->phyreg_def[RF90_PATH_A].rf_rb = RFPGA0_XA_LSSIREADBACK; - rtlphy->phyreg_def[RF90_PATH_B].rf_rb = RFPGA0_XB_LSSIREADBACK; - rtlphy->phyreg_def[RF90_PATH_C].rf_rb = RFPGA0_XC_LSSIREADBACK; - rtlphy->phyreg_def[RF90_PATH_D].rf_rb = RFPGA0_XD_LSSIREADBACK; - - /* Tranceiver LSSI Readback PI mode */ - rtlphy->phyreg_def[RF90_PATH_A].rf_rbpi = TRANSCEIVERA_HSPI_READBACK; - rtlphy->phyreg_def[RF90_PATH_B].rf_rbpi = TRANSCEIVERB_HSPI_READBACK; -} - - -static bool _rtl92s_phy_config_bb(struct ieee80211_hw *hw, u8 configtype) -{ - int i; - u32 *phy_reg_table; - u32 *agc_table; - u16 phy_reg_len, agc_len; - - agc_len = AGCTAB_ARRAYLENGTH; - agc_table = rtl8192seagctab_array; - /* Default RF_type: 2T2R */ - phy_reg_len = PHY_REG_2T2RARRAYLENGTH; - phy_reg_table = rtl8192sephy_reg_2t2rarray; - - if (configtype == BASEBAND_CONFIG_PHY_REG) { - for (i = 0; i < phy_reg_len; i = i + 2) { - if (phy_reg_table[i] == 0xfe) - mdelay(50); - else if (phy_reg_table[i] == 0xfd) - mdelay(5); - else if (phy_reg_table[i] == 0xfc) - mdelay(1); - else if (phy_reg_table[i] == 0xfb) - udelay(50); - else if (phy_reg_table[i] == 0xfa) - udelay(5); - else if (phy_reg_table[i] == 0xf9) - udelay(1); - - /* Add delay for ECS T20 & LG malow platform, */ - udelay(1); - - rtl92s_phy_set_bb_reg(hw, phy_reg_table[i], MASKDWORD, - phy_reg_table[i + 1]); - } - } else if (configtype == BASEBAND_CONFIG_AGC_TAB) { - for (i = 0; i < agc_len; i = i + 2) { - rtl92s_phy_set_bb_reg(hw, agc_table[i], MASKDWORD, - agc_table[i + 1]); - - /* Add delay for ECS T20 & LG malow platform */ - udelay(1); - } - } - - return true; -} - -static bool _rtl92s_phy_set_bb_to_diff_rf(struct ieee80211_hw *hw, - u8 configtype) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 *phy_regarray2xtxr_table; - u16 phy_regarray2xtxr_len; - int i; - - if (rtlphy->rf_type == RF_1T1R) { - phy_regarray2xtxr_table = rtl8192sephy_changeto_1t1rarray; - phy_regarray2xtxr_len = PHY_CHANGETO_1T1RARRAYLENGTH; - } else if (rtlphy->rf_type == RF_1T2R) { - phy_regarray2xtxr_table = rtl8192sephy_changeto_1t2rarray; - phy_regarray2xtxr_len = PHY_CHANGETO_1T2RARRAYLENGTH; - } else { - return false; - } - - if (configtype == BASEBAND_CONFIG_PHY_REG) { - for (i = 0; i < phy_regarray2xtxr_len; i = i + 3) { - if (phy_regarray2xtxr_table[i] == 0xfe) - mdelay(50); - else if (phy_regarray2xtxr_table[i] == 0xfd) - mdelay(5); - else if (phy_regarray2xtxr_table[i] == 0xfc) - mdelay(1); - else if (phy_regarray2xtxr_table[i] == 0xfb) - udelay(50); - else if (phy_regarray2xtxr_table[i] == 0xfa) - udelay(5); - else if (phy_regarray2xtxr_table[i] == 0xf9) - udelay(1); - - rtl92s_phy_set_bb_reg(hw, phy_regarray2xtxr_table[i], - phy_regarray2xtxr_table[i + 1], - phy_regarray2xtxr_table[i + 2]); - } - } - - return true; -} - -static bool _rtl92s_phy_config_bb_with_pg(struct ieee80211_hw *hw, - u8 configtype) -{ - int i; - u32 *phy_table_pg; - u16 phy_pg_len; - - phy_pg_len = PHY_REG_ARRAY_PGLENGTH; - phy_table_pg = rtl8192sephy_reg_array_pg; - - if (configtype == BASEBAND_CONFIG_PHY_REG) { - for (i = 0; i < phy_pg_len; i = i + 3) { - if (phy_table_pg[i] == 0xfe) - mdelay(50); - else if (phy_table_pg[i] == 0xfd) - mdelay(5); - else if (phy_table_pg[i] == 0xfc) - mdelay(1); - else if (phy_table_pg[i] == 0xfb) - udelay(50); - else if (phy_table_pg[i] == 0xfa) - udelay(5); - else if (phy_table_pg[i] == 0xf9) - udelay(1); - - _rtl92s_store_pwrindex_diffrate_offset(hw, - phy_table_pg[i], - phy_table_pg[i + 1], - phy_table_pg[i + 2]); - rtl92s_phy_set_bb_reg(hw, phy_table_pg[i], - phy_table_pg[i + 1], - phy_table_pg[i + 2]); - } - } - - return true; -} - -static bool _rtl92s_phy_bb_config_parafile(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - bool rtstatus = true; - - /* 1. Read PHY_REG.TXT BB INIT!! */ - /* We will separate as 1T1R/1T2R/1T2R_GREEN/2T2R */ - if (rtlphy->rf_type == RF_1T2R || rtlphy->rf_type == RF_2T2R || - rtlphy->rf_type == RF_1T1R || rtlphy->rf_type == RF_2T2R_GREEN) { - rtstatus = _rtl92s_phy_config_bb(hw, BASEBAND_CONFIG_PHY_REG); - - if (rtlphy->rf_type != RF_2T2R && - rtlphy->rf_type != RF_2T2R_GREEN) - /* so we should reconfig BB reg with the right - * PHY parameters. */ - rtstatus = _rtl92s_phy_set_bb_to_diff_rf(hw, - BASEBAND_CONFIG_PHY_REG); - } else { - rtstatus = false; - } - - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, - "Write BB Reg Fail!!\n"); - goto phy_BB8190_Config_ParaFile_Fail; - } - - /* 2. If EEPROM or EFUSE autoload OK, We must config by - * PHY_REG_PG.txt */ - if (rtlefuse->autoload_failflag == false) { - rtlphy->pwrgroup_cnt = 0; - - rtstatus = _rtl92s_phy_config_bb_with_pg(hw, - BASEBAND_CONFIG_PHY_REG); - } - if (!rtstatus) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, - "_rtl92s_phy_bb_config_parafile(): BB_PG Reg Fail!!\n"); - goto phy_BB8190_Config_ParaFile_Fail; - } - - /* 3. BB AGC table Initialization */ - rtstatus = _rtl92s_phy_config_bb(hw, BASEBAND_CONFIG_AGC_TAB); - - if (!rtstatus) { - pr_err("%s(): AGC Table Fail\n", __func__); - goto phy_BB8190_Config_ParaFile_Fail; - } - - /* Check if the CCK HighPower is turned ON. */ - /* This is used to calculate PWDB. */ - rtlphy->cck_high_power = (bool)(rtl92s_phy_query_bb_reg(hw, - RFPGA0_XA_HSSIPARAMETER2, 0x200)); - -phy_BB8190_Config_ParaFile_Fail: - return rtstatus; -} - -u8 rtl92s_phy_config_rf(struct ieee80211_hw *hw, enum radio_path rfpath) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - int i; - bool rtstatus = true; - u32 *radio_a_table; - u32 *radio_b_table; - u16 radio_a_tblen, radio_b_tblen; - - radio_a_tblen = RADIOA_1T_ARRAYLENGTH; - radio_a_table = rtl8192seradioa_1t_array; - - /* Using Green mode array table for RF_2T2R_GREEN */ - if (rtlphy->rf_type == RF_2T2R_GREEN) { - radio_b_table = rtl8192seradiob_gm_array; - radio_b_tblen = RADIOB_GM_ARRAYLENGTH; - } else { - radio_b_table = rtl8192seradiob_array; - radio_b_tblen = RADIOB_ARRAYLENGTH; - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Radio No %x\n", rfpath); - rtstatus = true; - - switch (rfpath) { - case RF90_PATH_A: - for (i = 0; i < radio_a_tblen; i = i + 2) { - if (radio_a_table[i] == 0xfe) - /* Delay specific ms. Only RF configuration - * requires delay. */ - mdelay(50); - else if (radio_a_table[i] == 0xfd) - mdelay(5); - else if (radio_a_table[i] == 0xfc) - mdelay(1); - else if (radio_a_table[i] == 0xfb) - udelay(50); - else if (radio_a_table[i] == 0xfa) - udelay(5); - else if (radio_a_table[i] == 0xf9) - udelay(1); - else - rtl92s_phy_set_rf_reg(hw, rfpath, - radio_a_table[i], - MASK20BITS, - radio_a_table[i + 1]); - - /* Add delay for ECS T20 & LG malow platform */ - udelay(1); - } - - /* PA Bias current for inferiority IC */ - _rtl92s_phy_config_rfpa_bias_current(hw, rfpath); - break; - case RF90_PATH_B: - for (i = 0; i < radio_b_tblen; i = i + 2) { - if (radio_b_table[i] == 0xfe) - /* Delay specific ms. Only RF configuration - * requires delay.*/ - mdelay(50); - else if (radio_b_table[i] == 0xfd) - mdelay(5); - else if (radio_b_table[i] == 0xfc) - mdelay(1); - else if (radio_b_table[i] == 0xfb) - udelay(50); - else if (radio_b_table[i] == 0xfa) - udelay(5); - else if (radio_b_table[i] == 0xf9) - udelay(1); - else - rtl92s_phy_set_rf_reg(hw, rfpath, - radio_b_table[i], - MASK20BITS, - radio_b_table[i + 1]); - - /* Add delay for ECS T20 & LG malow platform */ - udelay(1); - } - break; - case RF90_PATH_C: - ; - break; - case RF90_PATH_D: - ; - break; - default: - break; - } - - return rtstatus; -} - - -bool rtl92s_phy_mac_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - u32 arraylength; - u32 *ptraArray; - - arraylength = MAC_2T_ARRAYLENGTH; - ptraArray = rtl8192semac_2t_array; - - for (i = 0; i < arraylength; i = i + 2) - rtl_write_byte(rtlpriv, ptraArray[i], (u8)ptraArray[i + 1]); - - return true; -} - - -bool rtl92s_phy_bb_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - bool rtstatus = true; - u8 pathmap, index, rf_num = 0; - u8 path1, path2; - - _rtl92s_phy_init_register_definition(hw); - - /* Config BB and AGC */ - rtstatus = _rtl92s_phy_bb_config_parafile(hw); - - - /* Check BB/RF confiuration setting. */ - /* We only need to configure RF which is turned on. */ - path1 = (u8)(rtl92s_phy_query_bb_reg(hw, RFPGA0_TXINFO, 0xf)); - mdelay(10); - path2 = (u8)(rtl92s_phy_query_bb_reg(hw, ROFDM0_TRXPATHENABLE, 0xf)); - pathmap = path1 | path2; - - rtlphy->rf_pathmap = pathmap; - for (index = 0; index < 4; index++) { - if ((pathmap >> index) & 0x1) - rf_num++; - } - - if ((rtlphy->rf_type == RF_1T1R && rf_num != 1) || - (rtlphy->rf_type == RF_1T2R && rf_num != 2) || - (rtlphy->rf_type == RF_2T2R && rf_num != 2) || - (rtlphy->rf_type == RF_2T2R_GREEN && rf_num != 2)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, - "RF_Type(%x) does not match RF_Num(%x)!!\n", - rtlphy->rf_type, rf_num); - RT_TRACE(rtlpriv, COMP_INIT, DBG_EMERG, - "path1 0x%x, path2 0x%x, pathmap 0x%x\n", - path1, path2, pathmap); - } - - return rtstatus; -} - -bool rtl92s_phy_rf_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - /* Initialize general global value */ - if (rtlphy->rf_type == RF_1T1R) - rtlphy->num_total_rfpath = 1; - else - rtlphy->num_total_rfpath = 2; - - /* Config BB and RF */ - return rtl92s_phy_rf6052_config(hw); -} - -void rtl92s_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - /* read rx initial gain */ - rtlphy->default_initialgain[0] = rtl_get_bbreg(hw, - ROFDM0_XAAGCCORE1, MASKBYTE0); - rtlphy->default_initialgain[1] = rtl_get_bbreg(hw, - ROFDM0_XBAGCCORE1, MASKBYTE0); - rtlphy->default_initialgain[2] = rtl_get_bbreg(hw, - ROFDM0_XCAGCCORE1, MASKBYTE0); - rtlphy->default_initialgain[3] = rtl_get_bbreg(hw, - ROFDM0_XDAGCCORE1, MASKBYTE0); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x)\n", - rtlphy->default_initialgain[0], - rtlphy->default_initialgain[1], - rtlphy->default_initialgain[2], - rtlphy->default_initialgain[3]); - - /* read framesync */ - rtlphy->framesync = rtl_get_bbreg(hw, ROFDM0_RXDETECTOR3, MASKBYTE0); - rtlphy->framesync_c34 = rtl_get_bbreg(hw, ROFDM0_RXDETECTOR2, - MASKDWORD); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "Default framesync (0x%x) = 0x%x\n", - ROFDM0_RXDETECTOR3, rtlphy->framesync); - -} - -static void _rtl92s_phy_get_txpower_index(struct ieee80211_hw *hw, u8 channel, - u8 *cckpowerlevel, u8 *ofdmpowerLevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 index = (channel - 1); - - /* 1. CCK */ - /* RF-A */ - cckpowerlevel[0] = rtlefuse->txpwrlevel_cck[0][index]; - /* RF-B */ - cckpowerlevel[1] = rtlefuse->txpwrlevel_cck[1][index]; - - /* 2. OFDM for 1T or 2T */ - if (rtlphy->rf_type == RF_1T2R || rtlphy->rf_type == RF_1T1R) { - /* Read HT 40 OFDM TX power */ - ofdmpowerLevel[0] = rtlefuse->txpwrlevel_ht40_1s[0][index]; - ofdmpowerLevel[1] = rtlefuse->txpwrlevel_ht40_1s[1][index]; - } else if (rtlphy->rf_type == RF_2T2R) { - /* Read HT 40 OFDM TX power */ - ofdmpowerLevel[0] = rtlefuse->txpwrlevel_ht40_2s[0][index]; - ofdmpowerLevel[1] = rtlefuse->txpwrlevel_ht40_2s[1][index]; - } else { - ofdmpowerLevel[0] = 0; - ofdmpowerLevel[1] = 0; - } -} - -static void _rtl92s_phy_ccxpower_indexcheck(struct ieee80211_hw *hw, - u8 channel, u8 *cckpowerlevel, u8 *ofdmpowerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - rtlphy->cur_cck_txpwridx = cckpowerlevel[0]; - rtlphy->cur_ofdm24g_txpwridx = ofdmpowerlevel[0]; -} - -void rtl92s_phy_set_txpower(struct ieee80211_hw *hw, u8 channel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - /* [0]:RF-A, [1]:RF-B */ - u8 cckpowerlevel[2], ofdmpowerLevel[2]; - - if (!rtlefuse->txpwr_fromeprom) - return; - - /* Mainly we use RF-A Tx Power to write the Tx Power registers, - * but the RF-B Tx Power must be calculated by the antenna diff. - * So we have to rewrite Antenna gain offset register here. - * Please refer to BB register 0x80c - * 1. For CCK. - * 2. For OFDM 1T or 2T */ - _rtl92s_phy_get_txpower_index(hw, channel, &cckpowerlevel[0], - &ofdmpowerLevel[0]); - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Channel-%d, cckPowerLevel (A / B) = 0x%x / 0x%x, ofdmPowerLevel (A / B) = 0x%x / 0x%x\n", - channel, cckpowerlevel[0], cckpowerlevel[1], - ofdmpowerLevel[0], ofdmpowerLevel[1]); - - _rtl92s_phy_ccxpower_indexcheck(hw, channel, &cckpowerlevel[0], - &ofdmpowerLevel[0]); - - rtl92s_phy_rf6052_set_ccktxpower(hw, cckpowerlevel[0]); - rtl92s_phy_rf6052_set_ofdmtxpower(hw, &ofdmpowerLevel[0], channel); - -} - -void rtl92s_phy_chk_fwcmd_iodone(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u16 pollingcnt = 10000; - u32 tmpvalue; - - /* Make sure that CMD IO has be accepted by FW. */ - do { - udelay(10); - - tmpvalue = rtl_read_dword(rtlpriv, WFM5); - if (tmpvalue == 0) - break; - } while (--pollingcnt); - - if (pollingcnt == 0) - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Set FW Cmd fail!!\n"); -} - - -static void _rtl92s_phy_set_fwcmd_io(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 input, current_aid = 0; - - if (is_hal_stop(rtlhal)) - return; - - if (hal_get_firmwareversion(rtlpriv) < 0x34) - goto skip; - /* We re-map RA related CMD IO to combinational ones */ - /* if FW version is v.52 or later. */ - switch (rtlhal->current_fwcmd_io) { - case FW_CMD_RA_REFRESH_N: - rtlhal->current_fwcmd_io = FW_CMD_RA_REFRESH_N_COMB; - break; - case FW_CMD_RA_REFRESH_BG: - rtlhal->current_fwcmd_io = FW_CMD_RA_REFRESH_BG_COMB; - break; - default: - break; - } - -skip: - switch (rtlhal->current_fwcmd_io) { - case FW_CMD_RA_RESET: - RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "FW_CMD_RA_RESET\n"); - rtl_write_dword(rtlpriv, WFM5, FW_RA_RESET); - rtl92s_phy_chk_fwcmd_iodone(hw); - break; - case FW_CMD_RA_ACTIVE: - RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "FW_CMD_RA_ACTIVE\n"); - rtl_write_dword(rtlpriv, WFM5, FW_RA_ACTIVE); - rtl92s_phy_chk_fwcmd_iodone(hw); - break; - case FW_CMD_RA_REFRESH_N: - RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "FW_CMD_RA_REFRESH_N\n"); - input = FW_RA_REFRESH; - rtl_write_dword(rtlpriv, WFM5, input); - rtl92s_phy_chk_fwcmd_iodone(hw); - rtl_write_dword(rtlpriv, WFM5, FW_RA_ENABLE_RSSI_MASK); - rtl92s_phy_chk_fwcmd_iodone(hw); - break; - case FW_CMD_RA_REFRESH_BG: - RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, - "FW_CMD_RA_REFRESH_BG\n"); - rtl_write_dword(rtlpriv, WFM5, FW_RA_REFRESH); - rtl92s_phy_chk_fwcmd_iodone(hw); - rtl_write_dword(rtlpriv, WFM5, FW_RA_DISABLE_RSSI_MASK); - rtl92s_phy_chk_fwcmd_iodone(hw); - break; - case FW_CMD_RA_REFRESH_N_COMB: - RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, - "FW_CMD_RA_REFRESH_N_COMB\n"); - input = FW_RA_IOT_N_COMB; - rtl_write_dword(rtlpriv, WFM5, input); - rtl92s_phy_chk_fwcmd_iodone(hw); - break; - case FW_CMD_RA_REFRESH_BG_COMB: - RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, - "FW_CMD_RA_REFRESH_BG_COMB\n"); - input = FW_RA_IOT_BG_COMB; - rtl_write_dword(rtlpriv, WFM5, input); - rtl92s_phy_chk_fwcmd_iodone(hw); - break; - case FW_CMD_IQK_ENABLE: - RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "FW_CMD_IQK_ENABLE\n"); - rtl_write_dword(rtlpriv, WFM5, FW_IQK_ENABLE); - rtl92s_phy_chk_fwcmd_iodone(hw); - break; - case FW_CMD_PAUSE_DM_BY_SCAN: - /* Lower initial gain */ - rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, MASKBYTE0, 0x17); - rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, MASKBYTE0, 0x17); - /* CCA threshold */ - rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, 0x40); - break; - case FW_CMD_RESUME_DM_BY_SCAN: - /* CCA threshold */ - rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, 0xcd); - rtl92s_phy_set_txpower(hw, rtlphy->current_channel); - break; - case FW_CMD_HIGH_PWR_DISABLE: - if (rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) - break; - - /* Lower initial gain */ - rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, MASKBYTE0, 0x17); - rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, MASKBYTE0, 0x17); - /* CCA threshold */ - rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, 0x40); - break; - case FW_CMD_HIGH_PWR_ENABLE: - if ((rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) || - rtlpriv->dm.dynamic_txpower_enable) - break; - - /* CCA threshold */ - rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, 0xcd); - break; - case FW_CMD_LPS_ENTER: - RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "FW_CMD_LPS_ENTER\n"); - current_aid = rtlpriv->mac80211.assoc_id; - rtl_write_dword(rtlpriv, WFM5, (FW_LPS_ENTER | - ((current_aid | 0xc000) << 8))); - rtl92s_phy_chk_fwcmd_iodone(hw); - /* FW set TXOP disable here, so disable EDCA - * turbo mode until driver leave LPS */ - break; - case FW_CMD_LPS_LEAVE: - RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "FW_CMD_LPS_LEAVE\n"); - rtl_write_dword(rtlpriv, WFM5, FW_LPS_LEAVE); - rtl92s_phy_chk_fwcmd_iodone(hw); - break; - case FW_CMD_ADD_A2_ENTRY: - RT_TRACE(rtlpriv, COMP_CMD, DBG_DMESG, "FW_CMD_ADD_A2_ENTRY\n"); - rtl_write_dword(rtlpriv, WFM5, FW_ADD_A2_ENTRY); - rtl92s_phy_chk_fwcmd_iodone(hw); - break; - case FW_CMD_CTRL_DM_BY_DRIVER: - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "FW_CMD_CTRL_DM_BY_DRIVER\n"); - rtl_write_dword(rtlpriv, WFM5, FW_CTRL_DM_BY_DRIVER); - rtl92s_phy_chk_fwcmd_iodone(hw); - break; - - default: - break; - } - - rtl92s_phy_chk_fwcmd_iodone(hw); - - /* Clear FW CMD operation flag. */ - rtlhal->set_fwcmd_inprogress = false; -} - -bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fw_cmdio) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *digtable = &rtlpriv->dm_digtable; - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u32 fw_param = FW_CMD_IO_PARA_QUERY(rtlpriv); - u16 fw_cmdmap = FW_CMD_IO_QUERY(rtlpriv); - bool postprocessing = false; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Set FW Cmd(%#x), set_fwcmd_inprogress(%d)\n", - fw_cmdio, rtlhal->set_fwcmd_inprogress); - - do { - /* We re-map to combined FW CMD ones if firmware version */ - /* is v.53 or later. */ - if (hal_get_firmwareversion(rtlpriv) >= 0x35) { - switch (fw_cmdio) { - case FW_CMD_RA_REFRESH_N: - fw_cmdio = FW_CMD_RA_REFRESH_N_COMB; - break; - case FW_CMD_RA_REFRESH_BG: - fw_cmdio = FW_CMD_RA_REFRESH_BG_COMB; - break; - default: - break; - } - } else { - if ((fw_cmdio == FW_CMD_IQK_ENABLE) || - (fw_cmdio == FW_CMD_RA_REFRESH_N) || - (fw_cmdio == FW_CMD_RA_REFRESH_BG)) { - postprocessing = true; - break; - } - } - - /* If firmware version is v.62 or later, - * use FW_CMD_IO_SET for FW_CMD_CTRL_DM_BY_DRIVER */ - if (hal_get_firmwareversion(rtlpriv) >= 0x3E) { - if (fw_cmdio == FW_CMD_CTRL_DM_BY_DRIVER) - fw_cmdio = FW_CMD_CTRL_DM_BY_DRIVER_NEW; - } - - - /* We shall revise all FW Cmd IO into Reg0x364 - * DM map table in the future. */ - switch (fw_cmdio) { - case FW_CMD_RA_INIT: - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "RA init!!\n"); - fw_cmdmap |= FW_RA_INIT_CTL; - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - /* Clear control flag to sync with FW. */ - FW_CMD_IO_CLR(rtlpriv, FW_RA_INIT_CTL); - break; - case FW_CMD_DIG_DISABLE: - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Set DIG disable!!\n"); - fw_cmdmap &= ~FW_DIG_ENABLE_CTL; - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - break; - case FW_CMD_DIG_ENABLE: - case FW_CMD_DIG_RESUME: - if (!(rtlpriv->dm.dm_flag & HAL_DM_DIG_DISABLE)) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Set DIG enable or resume!!\n"); - fw_cmdmap |= (FW_DIG_ENABLE_CTL | FW_SS_CTL); - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - } - break; - case FW_CMD_DIG_HALT: - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Set DIG halt!!\n"); - fw_cmdmap &= ~(FW_DIG_ENABLE_CTL | FW_SS_CTL); - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - break; - case FW_CMD_TXPWR_TRACK_THERMAL: { - u8 thermalval = 0; - fw_cmdmap |= FW_PWR_TRK_CTL; - - /* Clear FW parameter in terms of thermal parts. */ - fw_param &= FW_PWR_TRK_PARAM_CLR; - - thermalval = rtlpriv->dm.thermalvalue; - fw_param |= ((thermalval << 24) | - (rtlefuse->thermalmeter[0] << 16)); - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Set TxPwr tracking!! FwCmdMap(%#x), FwParam(%#x)\n", - fw_cmdmap, fw_param); - - FW_CMD_PARA_SET(rtlpriv, fw_param); - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - - /* Clear control flag to sync with FW. */ - FW_CMD_IO_CLR(rtlpriv, FW_PWR_TRK_CTL); - } - break; - /* The following FW CMDs are only compatible to - * v.53 or later. */ - case FW_CMD_RA_REFRESH_N_COMB: - fw_cmdmap |= FW_RA_N_CTL; - - /* Clear RA BG mode control. */ - fw_cmdmap &= ~(FW_RA_BG_CTL | FW_RA_INIT_CTL); - - /* Clear FW parameter in terms of RA parts. */ - fw_param &= FW_RA_PARAM_CLR; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "[FW CMD] [New Version] Set RA/IOT Comb in n mode!! FwCmdMap(%#x), FwParam(%#x)\n", - fw_cmdmap, fw_param); - - FW_CMD_PARA_SET(rtlpriv, fw_param); - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - - /* Clear control flag to sync with FW. */ - FW_CMD_IO_CLR(rtlpriv, FW_RA_N_CTL); - break; - case FW_CMD_RA_REFRESH_BG_COMB: - fw_cmdmap |= FW_RA_BG_CTL; - - /* Clear RA n-mode control. */ - fw_cmdmap &= ~(FW_RA_N_CTL | FW_RA_INIT_CTL); - /* Clear FW parameter in terms of RA parts. */ - fw_param &= FW_RA_PARAM_CLR; - - FW_CMD_PARA_SET(rtlpriv, fw_param); - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - - /* Clear control flag to sync with FW. */ - FW_CMD_IO_CLR(rtlpriv, FW_RA_BG_CTL); - break; - case FW_CMD_IQK_ENABLE: - fw_cmdmap |= FW_IQK_CTL; - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - /* Clear control flag to sync with FW. */ - FW_CMD_IO_CLR(rtlpriv, FW_IQK_CTL); - break; - /* The following FW CMD is compatible to v.62 or later. */ - case FW_CMD_CTRL_DM_BY_DRIVER_NEW: - fw_cmdmap |= FW_DRIVER_CTRL_DM_CTL; - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - break; - /* The followed FW Cmds needs post-processing later. */ - case FW_CMD_RESUME_DM_BY_SCAN: - fw_cmdmap |= (FW_DIG_ENABLE_CTL | - FW_HIGH_PWR_ENABLE_CTL | - FW_SS_CTL); - - if (rtlpriv->dm.dm_flag & HAL_DM_DIG_DISABLE || - !digtable->dig_enable_flag) - fw_cmdmap &= ~FW_DIG_ENABLE_CTL; - - if ((rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) || - rtlpriv->dm.dynamic_txpower_enable) - fw_cmdmap &= ~FW_HIGH_PWR_ENABLE_CTL; - - if ((digtable->dig_ext_port_stage == - DIG_EXT_PORT_STAGE_0) || - (digtable->dig_ext_port_stage == - DIG_EXT_PORT_STAGE_1)) - fw_cmdmap &= ~FW_DIG_ENABLE_CTL; - - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - postprocessing = true; - break; - case FW_CMD_PAUSE_DM_BY_SCAN: - fw_cmdmap &= ~(FW_DIG_ENABLE_CTL | - FW_HIGH_PWR_ENABLE_CTL | - FW_SS_CTL); - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - postprocessing = true; - break; - case FW_CMD_HIGH_PWR_DISABLE: - fw_cmdmap &= ~FW_HIGH_PWR_ENABLE_CTL; - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - postprocessing = true; - break; - case FW_CMD_HIGH_PWR_ENABLE: - if (!(rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) && - !rtlpriv->dm.dynamic_txpower_enable) { - fw_cmdmap |= (FW_HIGH_PWR_ENABLE_CTL | - FW_SS_CTL); - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - postprocessing = true; - } - break; - case FW_CMD_DIG_MODE_FA: - fw_cmdmap |= FW_FA_CTL; - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - break; - case FW_CMD_DIG_MODE_SS: - fw_cmdmap &= ~FW_FA_CTL; - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - break; - case FW_CMD_PAPE_CONTROL: - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "[FW CMD] Set PAPE Control\n"); - fw_cmdmap &= ~FW_PAPE_CTL_BY_SW_HW; - - FW_CMD_IO_SET(rtlpriv, fw_cmdmap); - break; - default: - /* Pass to original FW CMD processing callback - * routine. */ - postprocessing = true; - break; - } - } while (false); - - /* We shall post processing these FW CMD if - * variable postprocessing is set. - */ - if (postprocessing && !rtlhal->set_fwcmd_inprogress) { - rtlhal->set_fwcmd_inprogress = true; - /* Update current FW Cmd for callback use. */ - rtlhal->current_fwcmd_io = fw_cmdio; - } else { - return false; - } - - _rtl92s_phy_set_fwcmd_io(hw); - return true; -} - -static void _rtl92s_phy_check_ephy_switchready(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 delay = 100; - u8 regu1; - - regu1 = rtl_read_byte(rtlpriv, 0x554); - while ((regu1 & BIT(5)) && (delay > 0)) { - regu1 = rtl_read_byte(rtlpriv, 0x554); - delay--; - /* We delay only 50us to prevent - * being scheduled out. */ - udelay(50); - } -} - -void rtl92s_phy_switch_ephy_parameter(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - /* The way to be capable to switch clock request - * when the PG setting does not support clock request. - * This is the backdoor solution to switch clock - * request before ASPM or D3. */ - rtl_write_dword(rtlpriv, 0x540, 0x73c11); - rtl_write_dword(rtlpriv, 0x548, 0x2407c); - - /* Switch EPHY parameter!!!! */ - rtl_write_word(rtlpriv, 0x550, 0x1000); - rtl_write_byte(rtlpriv, 0x554, 0x20); - _rtl92s_phy_check_ephy_switchready(hw); - - rtl_write_word(rtlpriv, 0x550, 0xa0eb); - rtl_write_byte(rtlpriv, 0x554, 0x3e); - _rtl92s_phy_check_ephy_switchready(hw); - - rtl_write_word(rtlpriv, 0x550, 0xff80); - rtl_write_byte(rtlpriv, 0x554, 0x39); - _rtl92s_phy_check_ephy_switchready(hw); - - /* Delay L1 enter time */ - if (ppsc->support_aspm && !ppsc->support_backdoor) - rtl_write_byte(rtlpriv, 0x560, 0x40); - else - rtl_write_byte(rtlpriv, 0x560, 0x00); - -} - -void rtl92s_phy_set_beacon_hwreg(struct ieee80211_hw *hw, u16 beaconinterval) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 new_bcn_num = 0; - - if (hal_get_firmwareversion(rtlpriv) >= 0x33) { - /* Fw v.51 and later. */ - rtl_write_dword(rtlpriv, WFM5, 0xF1000000 | - (beaconinterval << 8)); - } else { - new_bcn_num = beaconinterval * 32 - 64; - rtl_write_dword(rtlpriv, WFM3 + 4, new_bcn_num); - rtl_write_dword(rtlpriv, WFM3, 0xB026007C); - } -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.h b/drivers/net/wireless/rtlwifi/rtl8192se/phy.h deleted file mode 100644 index 8acf4765a7a6..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.h +++ /dev/null @@ -1,102 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ -#ifndef __RTL92S_PHY_H__ -#define __RTL92S_PHY_H__ - -#define MAX_TXPWR_IDX_NMODE_92S 63 -#define MAX_DOZE_WAITING_TIMES_9x 64 - -/* Channel switch:The size of - * command tables for switch channel */ -#define MAX_PRECMD_CNT 16 -#define MAX_RFDEPENDCMD_CNT 16 -#define MAX_POSTCMD_CNT 16 - -#define RF90_PATH_MAX 4 -#define RF6052_MAX_PATH 2 - -enum version_8192s { - VERSION_8192S_ACUT, - VERSION_8192S_BCUT, - VERSION_8192S_CCUT -}; - -enum swchnlcmd_id { - CMDID_END, - CMDID_SET_TXPOWEROWER_LEVEL, - CMDID_BBREGWRITE10, - CMDID_WRITEPORT_ULONG, - CMDID_WRITEPORT_USHORT, - CMDID_WRITEPORT_UCHAR, - CMDID_RF_WRITEREG, -}; - -struct swchnlcmd { - enum swchnlcmd_id cmdid; - u32 para1; - u32 para2; - u32 msdelay; -}; - -enum baseband_config_type { - /* Radio Path A */ - BASEBAND_CONFIG_PHY_REG = 0, - /* Radio Path B */ - BASEBAND_CONFIG_AGC_TAB = 1, -}; - -#define hal_get_firmwareversion(rtlpriv) \ - (((struct rt_firmware *)(rtlpriv->rtlhal.pfirmware))->firmwareversion) - -u32 rtl92s_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask); -void rtl92s_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask, - u32 data); -void rtl92s_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation); -u32 rtl92s_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, - u32 regaddr, u32 bitmask); -void rtl92s_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, - u32 regaddr, u32 bitmask, u32 data); -void rtl92s_phy_set_bw_mode(struct ieee80211_hw *hw, - enum nl80211_channel_type ch_type); -u8 rtl92s_phy_sw_chnl(struct ieee80211_hw *hw); -bool rtl92s_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpower_state); -bool rtl92s_phy_mac_config(struct ieee80211_hw *hw); -void rtl92s_phy_switch_ephy_parameter(struct ieee80211_hw *hw); -bool rtl92s_phy_bb_config(struct ieee80211_hw *hw); -bool rtl92s_phy_rf_config(struct ieee80211_hw *hw); -void rtl92s_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); -void rtl92s_phy_set_txpower(struct ieee80211_hw *hw, u8 channel); -bool rtl92s_phy_set_fw_cmd(struct ieee80211_hw *hw, enum fwcmd_iotype fwcmd_io); -void rtl92s_phy_chk_fwcmd_iodone(struct ieee80211_hw *hw); -void rtl92s_phy_set_beacon_hwreg(struct ieee80211_hw *hw, u16 beaconinterval); -u8 rtl92s_phy_config_rf(struct ieee80211_hw *hw, enum radio_path rfpath) ; - -#endif - diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/reg.h b/drivers/net/wireless/rtlwifi/rtl8192se/reg.h deleted file mode 100644 index 84d1181795b8..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/reg.h +++ /dev/null @@ -1,1185 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ -#ifndef __REALTEK_92S_REG_H__ -#define __REALTEK_92S_REG_H__ - -/* 1. System Configuration Registers */ -#define REG_SYS_ISO_CTRL 0x0000 -#define REG_SYS_FUNC_EN 0x0002 -#define PMC_FSM 0x0004 -#define SYS_CLKR 0x0008 -#define EPROM_CMD 0x000A -#define EE_VPD 0x000C -#define AFE_MISC 0x0010 -#define SPS0_CTRL 0x0011 -#define SPS1_CTRL 0x0018 -#define RF_CTRL 0x001F -#define LDOA15_CTRL 0x0020 -#define LDOV12D_CTRL 0x0021 -#define LDOHCI12_CTRL 0x0022 -#define LDO_USB_SDIO 0x0023 -#define LPLDO_CTRL 0x0024 -#define AFE_XTAL_CTRL 0x0026 -#define AFE_PLL_CTRL 0x0028 -#define REG_EFUSE_CTRL 0x0030 -#define REG_EFUSE_TEST 0x0034 -#define PWR_DATA 0x0038 -#define DBG_PORT 0x003A -#define DPS_TIMER 0x003C -#define RCLK_MON 0x003E - -/* 2. Command Control Registers */ -#define CMDR 0x0040 -#define TXPAUSE 0x0042 -#define LBKMD_SEL 0x0043 -#define TCR 0x0044 -#define RCR 0x0048 -#define MSR 0x004C -#define SYSF_CFG 0x004D -#define RX_PKY_LIMIT 0x004E -#define MBIDCTRL 0x004F - -/* 3. MACID Setting Registers */ -#define MACIDR 0x0050 -#define MACIDR0 0x0050 -#define MACIDR4 0x0054 -#define BSSIDR 0x0058 -#define HWVID 0x005E -#define MAR 0x0060 -#define MBIDCAMCONTENT 0x0068 -#define MBIDCAMCFG 0x0070 -#define BUILDTIME 0x0074 -#define BUILDUSER 0x0078 - -#define IDR0 MACIDR0 -#define IDR4 MACIDR4 - -/* 4. Timing Control Registers */ -#define TSFR 0x0080 -#define SLOT_TIME 0x0089 -#define USTIME 0x008A -#define SIFS_CCK 0x008C -#define SIFS_OFDM 0x008E -#define PIFS_TIME 0x0090 -#define ACK_TIMEOUT 0x0091 -#define EIFSTR 0x0092 -#define BCN_INTERVAL 0x0094 -#define ATIMWND 0x0096 -#define BCN_DRV_EARLY_INT 0x0098 -#define BCN_DMATIME 0x009A -#define BCN_ERR_THRESH 0x009C -#define MLT 0x009D -#define RSVD_MAC_TUNE_US 0x009E - -/* 5. FIFO Control Registers */ -#define RQPN 0x00A0 -#define RQPN1 0x00A0 -#define RQPN2 0x00A1 -#define RQPN3 0x00A2 -#define RQPN4 0x00A3 -#define RQPN5 0x00A4 -#define RQPN6 0x00A5 -#define RQPN7 0x00A6 -#define RQPN8 0x00A7 -#define RQPN9 0x00A8 -#define RQPN10 0x00A9 -#define LD_RQPN 0x00AB -#define RXFF_BNDY 0x00AC -#define RXRPT_BNDY 0x00B0 -#define TXPKTBUF_PGBNDY 0x00B4 -#define PBP 0x00B5 -#define RXDRVINFO_SZ 0x00B6 -#define TXFF_STATUS 0x00B7 -#define RXFF_STATUS 0x00B8 -#define TXFF_EMPTY_TH 0x00B9 -#define SDIO_RX_BLKSZ 0x00BC -#define RXDMA 0x00BD -#define RXPKT_NUM 0x00BE -#define C2HCMD_UDT_SIZE 0x00C0 -#define C2HCMD_UDT_ADDR 0x00C2 -#define FIFOPAGE1 0x00C4 -#define FIFOPAGE2 0x00C8 -#define FIFOPAGE3 0x00CC -#define FIFOPAGE4 0x00D0 -#define FIFOPAGE5 0x00D4 -#define FW_RSVD_PG_CRTL 0x00D8 -#define RXDMA_AGG_PG_TH 0x00D9 -#define TXDESC_MSK 0x00DC -#define TXRPTFF_RDPTR 0x00E0 -#define TXRPTFF_WTPTR 0x00E4 -#define C2HFF_RDPTR 0x00E8 -#define C2HFF_WTPTR 0x00EC -#define RXFF0_RDPTR 0x00F0 -#define RXFF0_WTPTR 0x00F4 -#define RXFF1_RDPTR 0x00F8 -#define RXFF1_WTPTR 0x00FC -#define RXRPT0_RDPTR 0x0100 -#define RXRPT0_WTPTR 0x0104 -#define RXRPT1_RDPTR 0x0108 -#define RXRPT1_WTPTR 0x010C -#define RX0_UDT_SIZE 0x0110 -#define RX1PKTNUM 0x0114 -#define RXFILTERMAP 0x0116 -#define RXFILTERMAP_GP1 0x0118 -#define RXFILTERMAP_GP2 0x011A -#define RXFILTERMAP_GP3 0x011C -#define BCNQ_CTRL 0x0120 -#define MGTQ_CTRL 0x0124 -#define HIQ_CTRL 0x0128 -#define VOTID7_CTRL 0x012c -#define VOTID6_CTRL 0x0130 -#define VITID5_CTRL 0x0134 -#define VITID4_CTRL 0x0138 -#define BETID3_CTRL 0x013c -#define BETID0_CTRL 0x0140 -#define BKTID2_CTRL 0x0144 -#define BKTID1_CTRL 0x0148 -#define CMDQ_CTRL 0x014c -#define TXPKT_NUM_CTRL 0x0150 -#define TXQ_PGADD 0x0152 -#define TXFF_PG_NUM 0x0154 -#define TRXDMA_STATUS 0x0156 - -/* 6. Adaptive Control Registers */ -#define INIMCS_SEL 0x0160 -#define TX_RATE_REG INIMCS_SEL -#define INIRTSMCS_SEL 0x0180 -#define RRSR 0x0181 -#define ARFR0 0x0184 -#define ARFR1 0x0188 -#define ARFR2 0x018C -#define ARFR3 0x0190 -#define ARFR4 0x0194 -#define ARFR5 0x0198 -#define ARFR6 0x019C -#define ARFR7 0x01A0 -#define AGGLEN_LMT_H 0x01A7 -#define AGGLEN_LMT_L 0x01A8 -#define DARFRC 0x01B0 -#define RARFRC 0x01B8 -#define MCS_TXAGC 0x01C0 -#define CCK_TXAGC 0x01C8 - -/* 7. EDCA Setting Registers */ -#define EDCAPARA_VO 0x01D0 -#define EDCAPARA_VI 0x01D4 -#define EDCAPARA_BE 0x01D8 -#define EDCAPARA_BK 0x01DC -#define BCNTCFG 0x01E0 -#define CWRR 0x01E2 -#define ACMAVG 0x01E4 -#define AcmHwCtrl 0x01E7 -#define VO_ADMTM 0x01E8 -#define VI_ADMTM 0x01EC -#define BE_ADMTM 0x01F0 -#define RETRY_LIMIT 0x01F4 -#define SG_RATE 0x01F6 - -/* 8. WMAC, BA and CCX related Register. */ -#define NAV_CTRL 0x0200 -#define BW_OPMODE 0x0203 -#define BACAMCMD 0x0204 -#define BACAMCONTENT 0x0208 - -/* the 0x2xx register WMAC definition */ -#define LBDLY 0x0210 -#define FWDLY 0x0211 -#define HWPC_RX_CTRL 0x0218 -#define MQIR 0x0220 -#define MAIR 0x0222 -#define MSIR 0x0224 -#define CLM_RESULT 0x0227 -#define NHM_RPI_CNT 0x0228 -#define RXERR_RPT 0x0230 -#define NAV_PROT_LEN 0x0234 -#define CFEND_TH 0x0236 -#define AMPDU_MIN_SPACE 0x0237 -#define TXOP_STALL_CTRL 0x0238 - -/* 9. Security Control Registers */ -#define REG_RWCAM 0x0240 -#define REG_WCAMI 0x0244 -#define REG_RCAMO 0x0248 -#define REG_CAMDBG 0x024C -#define REG_SECR 0x0250 - -/* 10. Power Save Control Registers */ -#define WOW_CTRL 0x0260 -#define PSSTATUS 0x0261 -#define PSSWITCH 0x0262 -#define MIMOPS_WAIT_PERIOD 0x0263 -#define LPNAV_CTRL 0x0264 -#define WFM0 0x0270 -#define WFM1 0x0280 -#define WFM2 0x0290 -#define WFM3 0x02A0 -#define WFM4 0x02B0 -#define WFM5 0x02C0 -#define WFCRC 0x02D0 -#define FW_RPT_REG 0x02c4 - -/* 11. General Purpose Registers */ -#define PSTIME 0x02E0 -#define TIMER0 0x02E4 -#define TIMER1 0x02E8 -#define GPIO_IN_SE 0x02EC -#define GPIO_IO_SEL 0x02EE -#define MAC_PINMUX_CFG 0x02F1 -#define LEDCFG 0x02F2 -#define PHY_REG 0x02F3 -#define PHY_REG_DATA 0x02F4 -#define REG_EFUSE_CLK 0x02F8 - -/* 12. Host Interrupt Status Registers */ -#define INTA_MASK 0x0300 -#define ISR 0x0308 - -/* 13. Test Mode and Debug Control Registers */ -#define DBG_PORT_SWITCH 0x003A -#define BIST 0x0310 -#define DBS 0x0314 -#define CPUINST 0x0318 -#define CPUCAUSE 0x031C -#define LBUS_ERR_ADDR 0x0320 -#define LBUS_ERR_CMD 0x0324 -#define LBUS_ERR_DATA_L 0x0328 -#define LBUS_ERR_DATA_H 0x032C -#define LX_EXCEPTION_ADDR 0x0330 -#define WDG_CTRL 0x0334 -#define INTMTU 0x0338 -#define INTM 0x033A -#define FDLOCKTURN0 0x033C -#define FDLOCKTURN1 0x033D -#define TRXPKTBUF_DBG_DATA 0x0340 -#define TRXPKTBUF_DBG_CTRL 0x0348 -#define DPLL 0x034A -#define CBUS_ERR_ADDR 0x0350 -#define CBUS_ERR_CMD 0x0354 -#define CBUS_ERR_DATA_L 0x0358 -#define CBUS_ERR_DATA_H 0x035C -#define USB_SIE_INTF_ADDR 0x0360 -#define USB_SIE_INTF_WD 0x0361 -#define USB_SIE_INTF_RD 0x0362 -#define USB_SIE_INTF_CTRL 0x0363 -#define LBUS_MON_ADDR 0x0364 -#define LBUS_ADDR_MASK 0x0368 - -/* Boundary is 0x37F */ - -/* 14. PCIE config register */ -#define TP_POLL 0x0500 -#define PM_CTRL 0x0502 -#define PCIF 0x0503 - -#define THPDA 0x0514 -#define TMDA 0x0518 -#define TCDA 0x051C -#define HDA 0x0520 -#define TVODA 0x0524 -#define TVIDA 0x0528 -#define TBEDA 0x052C -#define TBKDA 0x0530 -#define TBDA 0x0534 -#define RCDA 0x0538 -#define RDQDA 0x053C -#define DBI_WDATA 0x0540 -#define DBI_RDATA 0x0544 -#define DBI_CTRL 0x0548 -#define MDIO_DATA 0x0550 -#define MDIO_CTRL 0x0554 -#define PCI_RPWM 0x0561 -#define PCI_CPWM 0x0563 - -/* Config register (Offset 0x800-) */ -#define PHY_CCA 0x803 - -/* Min Spacing related settings. */ -#define MAX_MSS_DENSITY_2T 0x13 -#define MAX_MSS_DENSITY_1T 0x0A - -/* Rx DMA Control related settings */ -#define RXDMA_AGG_EN BIT(7) - -#define RPWM PCI_RPWM - -/* Regsiter Bit and Content definition */ - -#define ISO_MD2PP BIT(0) -#define ISO_PA2PCIE BIT(3) -#define ISO_PLL2MD BIT(4) -#define ISO_PWC_DV2RP BIT(11) -#define ISO_PWC_RV2RP BIT(12) - - -#define FEN_MREGEN BIT(15) -#define FEN_DCORE BIT(11) -#define FEN_CPUEN BIT(10) - -#define PAD_HWPD_IDN BIT(22) - -#define SYS_CLKSEL_80M BIT(0) -#define SYS_PS_CLKSEL BIT(1) -#define SYS_CPU_CLKSEL BIT(2) -#define SYS_MAC_CLK_EN BIT(11) -#define SYS_SWHW_SEL BIT(14) -#define SYS_FWHW_SEL BIT(15) - -#define CmdEEPROM_En BIT(5) -#define CmdEERPOMSEL BIT(4) -#define Cmd9346CR_9356SEL BIT(4) - -#define AFE_MBEN BIT(1) -#define AFE_BGEN BIT(0) - -#define SPS1_SWEN BIT(1) -#define SPS1_LDEN BIT(0) - -#define RF_EN BIT(0) -#define RF_RSTB BIT(1) -#define RF_SDMRSTB BIT(2) - -#define LDA15_EN BIT(0) - -#define LDV12_EN BIT(0) -#define LDV12_SDBY BIT(1) - -#define XTAL_GATE_AFE BIT(10) - -#define APLL_EN BIT(0) - -#define AFR_CardBEn BIT(0) -#define AFR_CLKRUN_SEL BIT(1) -#define AFR_FuncRegEn BIT(2) - -#define APSDOFF_STATUS BIT(15) -#define APSDOFF BIT(14) -#define BBRSTN BIT(13) -#define BB_GLB_RSTN BIT(12) -#define SCHEDULE_EN BIT(10) -#define MACRXEN BIT(9) -#define MACTXEN BIT(8) -#define DDMA_EN BIT(7) -#define FW2HW_EN BIT(6) -#define RXDMA_EN BIT(5) -#define TXDMA_EN BIT(4) -#define HCI_RXDMA_EN BIT(3) -#define HCI_TXDMA_EN BIT(2) - -#define StopHCCA BIT(6) -#define StopHigh BIT(5) -#define StopMgt BIT(4) -#define StopVO BIT(3) -#define StopVI BIT(2) -#define StopBE BIT(1) -#define StopBK BIT(0) - -#define LBK_NORMAL 0x00 -#define LBK_MAC_LB (BIT(0) | BIT(1) | BIT(3)) -#define LBK_MAC_DLB (BIT(0) | BIT(1)) -#define LBK_DMA_LB (BIT(0) | BIT(1) | BIT(2)) - -#define TCP_OFDL_EN BIT(25) -#define HWPC_TX_EN BIT(24) -#define TXDMAPRE2FULL BIT(23) -#define DISCW BIT(20) -#define TCRICV BIT(19) -#define CfendForm BIT(17) -#define TCRCRC BIT(16) -#define FAKE_IMEM_EN BIT(15) -#define TSFRST BIT(9) -#define TSFEN BIT(8) -#define FWALLRDY (BIT(0) | BIT(1) | BIT(2) | \ - BIT(3) | BIT(4) | BIT(5) | \ - BIT(6) | BIT(7)) -#define FWRDY BIT(7) -#define BASECHG BIT(6) -#define IMEM BIT(5) -#define DMEM_CODE_DONE BIT(4) -#define EXT_IMEM_CHK_RPT BIT(3) -#define EXT_IMEM_CODE_DONE BIT(2) -#define IMEM_CHK_RPT BIT(1) -#define IMEM_CODE_DONE BIT(0) -#define IMEM_CODE_DONE BIT(0) -#define IMEM_CHK_RPT BIT(1) -#define EMEM_CODE_DONE BIT(2) -#define EMEM_CHK_RPT BIT(3) -#define DMEM_CODE_DONE BIT(4) -#define IMEM_RDY BIT(5) -#define BASECHG BIT(6) -#define FWRDY BIT(7) -#define LOAD_FW_READY (IMEM_CODE_DONE | \ - IMEM_CHK_RPT | \ - EMEM_CODE_DONE | \ - EMEM_CHK_RPT | \ - DMEM_CODE_DONE | \ - IMEM_RDY | \ - BASECHG | \ - FWRDY) -#define TCR_TSFEN BIT(8) -#define TCR_TSFRST BIT(9) -#define TCR_FAKE_IMEM_EN BIT(15) -#define TCR_CRC BIT(16) -#define TCR_ICV BIT(19) -#define TCR_DISCW BIT(20) -#define TCR_HWPC_TX_EN BIT(24) -#define TCR_TCP_OFDL_EN BIT(25) -#define TXDMA_INIT_VALUE (IMEM_CHK_RPT | \ - EXT_IMEM_CHK_RPT) - -#define RCR_APPFCS BIT(31) -#define RCR_DIS_ENC_2BYTE BIT(30) -#define RCR_DIS_AES_2BYTE BIT(29) -#define RCR_HTC_LOC_CTRL BIT(28) -#define RCR_ENMBID BIT(27) -#define RCR_RX_TCPOFDL_EN BIT(26) -#define RCR_APP_PHYST_RXFF BIT(25) -#define RCR_APP_PHYST_STAFF BIT(24) -#define RCR_CBSSID BIT(23) -#define RCR_APWRMGT BIT(22) -#define RCR_ADD3 BIT(21) -#define RCR_AMF BIT(20) -#define RCR_ACF BIT(19) -#define RCR_ADF BIT(18) -#define RCR_APP_MIC BIT(17) -#define RCR_APP_ICV BIT(16) -#define RCR_RXFTH BIT(13) -#define RCR_AICV BIT(12) -#define RCR_RXDESC_LK_EN BIT(11) -#define RCR_APP_BA_SSN BIT(6) -#define RCR_ACRC32 BIT(5) -#define RCR_RXSHFT_EN BIT(4) -#define RCR_AB BIT(3) -#define RCR_AM BIT(2) -#define RCR_APM BIT(1) -#define RCR_AAP BIT(0) -#define RCR_MXDMA_OFFSET 8 -#define RCR_FIFO_OFFSET 13 - - -#define MSR_LINK_MASK ((1 << 0) | (1 << 1)) -#define MSR_LINK_MANAGED 2 -#define MSR_LINK_NONE 0 -#define MSR_LINK_SHIFT 0 -#define MSR_LINK_ADHOC 1 -#define MSR_LINK_MASTER 3 -#define MSR_NOLINK 0x00 -#define MSR_ADHOC 0x01 -#define MSR_INFRA 0x02 -#define MSR_AP 0x03 - -#define ENUART BIT(7) -#define ENJTAG BIT(3) -#define BTMODE (BIT(2) | BIT(1)) -#define ENBT BIT(0) - -#define ENMBID BIT(7) -#define BCNUM (BIT(6) | BIT(5) | BIT(4)) - -#define USTIME_EDCA 0xFF00 -#define USTIME_TSF 0x00FF - -#define SIFS_TRX 0xFF00 -#define SIFS_CTX 0x00FF - -#define ENSWBCN BIT(15) -#define DRVERLY_TU 0x0FF0 -#define DRVERLY_US 0x000F -#define BCN_TCFG_CW_SHIFT 8 -#define BCN_TCFG_IFS 0 - -#define RRSR_RSC_OFFSET 21 -#define RRSR_SHORT_OFFSET 23 -#define RRSR_RSC_BW_40M 0x600000 -#define RRSR_RSC_UPSUBCHNL 0x400000 -#define RRSR_RSC_LOWSUBCHNL 0x200000 -#define RRSR_SHORT 0x800000 -#define RRSR_1M BIT(0) -#define RRSR_2M BIT(1) -#define RRSR_5_5M BIT(2) -#define RRSR_11M BIT(3) -#define RRSR_6M BIT(4) -#define RRSR_9M BIT(5) -#define RRSR_12M BIT(6) -#define RRSR_18M BIT(7) -#define RRSR_24M BIT(8) -#define RRSR_36M BIT(9) -#define RRSR_48M BIT(10) -#define RRSR_54M BIT(11) -#define RRSR_MCS0 BIT(12) -#define RRSR_MCS1 BIT(13) -#define RRSR_MCS2 BIT(14) -#define RRSR_MCS3 BIT(15) -#define RRSR_MCS4 BIT(16) -#define RRSR_MCS5 BIT(17) -#define RRSR_MCS6 BIT(18) -#define RRSR_MCS7 BIT(19) -#define BRSR_AckShortPmb BIT(23) - -#define RATR_1M 0x00000001 -#define RATR_2M 0x00000002 -#define RATR_55M 0x00000004 -#define RATR_11M 0x00000008 -#define RATR_6M 0x00000010 -#define RATR_9M 0x00000020 -#define RATR_12M 0x00000040 -#define RATR_18M 0x00000080 -#define RATR_24M 0x00000100 -#define RATR_36M 0x00000200 -#define RATR_48M 0x00000400 -#define RATR_54M 0x00000800 -#define RATR_MCS0 0x00001000 -#define RATR_MCS1 0x00002000 -#define RATR_MCS2 0x00004000 -#define RATR_MCS3 0x00008000 -#define RATR_MCS4 0x00010000 -#define RATR_MCS5 0x00020000 -#define RATR_MCS6 0x00040000 -#define RATR_MCS7 0x00080000 -#define RATR_MCS8 0x00100000 -#define RATR_MCS9 0x00200000 -#define RATR_MCS10 0x00400000 -#define RATR_MCS11 0x00800000 -#define RATR_MCS12 0x01000000 -#define RATR_MCS13 0x02000000 -#define RATR_MCS14 0x04000000 -#define RATR_MCS15 0x08000000 - -#define RATE_ALL_CCK (RATR_1M | RATR_2M | \ - RATR_55M | RATR_11M) -#define RATE_ALL_OFDM_AG (RATR_6M | RATR_9M | \ - RATR_12M | RATR_18M | \ - RATR_24M | RATR_36M | \ - RATR_48M | RATR_54M) -#define RATE_ALL_OFDM_1SS (RATR_MCS0 | RATR_MCS1 | \ - RATR_MCS2 | RATR_MCS3 | \ - RATR_MCS4 | RATR_MCS5 | \ - RATR_MCS6 | RATR_MCS7) -#define RATE_ALL_OFDM_2SS (RATR_MCS8 | RATR_MCS9 | \ - RATR_MCS10 | RATR_MCS11 | \ - RATR_MCS12 | RATR_MCS13 | \ - RATR_MCS14 | RATR_MCS15) - -#define AC_PARAM_TXOP_LIMIT_OFFSET 16 -#define AC_PARAM_ECW_MAX_OFFSET 12 -#define AC_PARAM_ECW_MIN_OFFSET 8 -#define AC_PARAM_AIFS_OFFSET 0 - -#define AcmHw_HwEn BIT(0) -#define AcmHw_BeqEn BIT(1) -#define AcmHw_ViqEn BIT(2) -#define AcmHw_VoqEn BIT(3) -#define AcmHw_BeqStatus BIT(4) -#define AcmHw_ViqStatus BIT(5) -#define AcmHw_VoqStatus BIT(6) - -#define RETRY_LIMIT_SHORT_SHIFT 8 -#define RETRY_LIMIT_LONG_SHIFT 0 - -#define NAV_UPPER_EN BIT(16) -#define NAV_UPPER 0xFF00 -#define NAV_RTSRST 0xFF - -#define BW_OPMODE_20MHZ BIT(2) -#define BW_OPMODE_5G BIT(1) -#define BW_OPMODE_11J BIT(0) - -#define RXERR_RPT_RST BIT(27) -#define RXERR_OFDM_PPDU 0 -#define RXERR_OFDM_FALSE_ALARM 1 -#define RXERR_OFDM_MPDU_OK 2 -#define RXERR_OFDM_MPDU_FAIL 3 -#define RXERR_CCK_PPDU 4 -#define RXERR_CCK_FALSE_ALARM 5 -#define RXERR_CCK_MPDU_OK 6 -#define RXERR_CCK_MPDU_FAIL 7 -#define RXERR_HT_PPDU 8 -#define RXERR_HT_FALSE_ALARM 9 -#define RXERR_HT_MPDU_TOTAL 10 -#define RXERR_HT_MPDU_OK 11 -#define RXERR_HT_MPDU_FAIL 12 -#define RXERR_RX_FULL_DROP 15 - -#define SCR_TXUSEDK BIT(0) -#define SCR_RXUSEDK BIT(1) -#define SCR_TXENCENABLE BIT(2) -#define SCR_RXENCENABLE BIT(3) -#define SCR_SKBYA2 BIT(4) -#define SCR_NOSKMC BIT(5) - -#define CAM_VALID BIT(15) -#define CAM_NOTVALID 0x0000 -#define CAM_USEDK BIT(5) - -#define CAM_NONE 0x0 -#define CAM_WEP40 0x01 -#define CAM_TKIP 0x02 -#define CAM_AES 0x04 -#define CAM_WEP104 0x05 - -#define TOTAL_CAM_ENTRY 32 -#define HALF_CAM_ENTRY 16 - -#define CAM_WRITE BIT(16) -#define CAM_READ 0x00000000 -#define CAM_POLLINIG BIT(31) - -#define WOW_PMEN BIT(0) -#define WOW_WOMEN BIT(1) -#define WOW_MAGIC BIT(2) -#define WOW_UWF BIT(3) - -#define GPIOMUX_EN BIT(3) -#define GPIOSEL_GPIO 0 -#define GPIOSEL_PHYDBG 1 -#define GPIOSEL_BT 2 -#define GPIOSEL_WLANDBG 3 -#define GPIOSEL_GPIO_MASK (~(BIT(0)|BIT(1))) - -#define HST_RDBUSY BIT(0) -#define CPU_WTBUSY BIT(1) - -#define IMR8190_DISABLED 0x0 -#define IMR_CPUERR BIT(5) -#define IMR_ATIMEND BIT(4) -#define IMR_TBDOK BIT(3) -#define IMR_TBDER BIT(2) -#define IMR_BCNDMAINT8 BIT(1) -#define IMR_BCNDMAINT7 BIT(0) -#define IMR_BCNDMAINT6 BIT(31) -#define IMR_BCNDMAINT5 BIT(30) -#define IMR_BCNDMAINT4 BIT(29) -#define IMR_BCNDMAINT3 BIT(28) -#define IMR_BCNDMAINT2 BIT(27) -#define IMR_BCNDMAINT1 BIT(26) -#define IMR_BCNDOK8 BIT(25) -#define IMR_BCNDOK7 BIT(24) -#define IMR_BCNDOK6 BIT(23) -#define IMR_BCNDOK5 BIT(22) -#define IMR_BCNDOK4 BIT(21) -#define IMR_BCNDOK3 BIT(20) -#define IMR_BCNDOK2 BIT(19) -#define IMR_BCNDOK1 BIT(18) -#define IMR_TIMEOUT2 BIT(17) -#define IMR_TIMEOUT1 BIT(16) -#define IMR_TXFOVW BIT(15) -#define IMR_PSTIMEOUT BIT(14) -#define IMR_BCNINT BIT(13) -#define IMR_RXFOVW BIT(12) -#define IMR_RDU BIT(11) -#define IMR_RXCMDOK BIT(10) -#define IMR_BDOK BIT(9) -#define IMR_HIGHDOK BIT(8) -#define IMR_COMDOK BIT(7) -#define IMR_MGNTDOK BIT(6) -#define IMR_HCCADOK BIT(5) -#define IMR_BKDOK BIT(4) -#define IMR_BEDOK BIT(3) -#define IMR_VIDOK BIT(2) -#define IMR_VODOK BIT(1) -#define IMR_ROK BIT(0) - -#define TPPOLL_BKQ BIT(0) -#define TPPOLL_BEQ BIT(1) -#define TPPOLL_VIQ BIT(2) -#define TPPOLL_VOQ BIT(3) -#define TPPOLL_BQ BIT(4) -#define TPPOLL_CQ BIT(5) -#define TPPOLL_MQ BIT(6) -#define TPPOLL_HQ BIT(7) -#define TPPOLL_HCCAQ BIT(8) -#define TPPOLL_STOPBK BIT(9) -#define TPPOLL_STOPBE BIT(10) -#define TPPOLL_STOPVI BIT(11) -#define TPPOLL_STOPVO BIT(12) -#define TPPOLL_STOPMGT BIT(13) -#define TPPOLL_STOPHIGH BIT(14) -#define TPPOLL_STOPHCCA BIT(15) -#define TPPOLL_SHIFT 8 - -#define CCX_CMD_CLM_ENABLE BIT(0) -#define CCX_CMD_NHM_ENABLE BIT(1) -#define CCX_CMD_FUNCTION_ENABLE BIT(8) -#define CCX_CMD_IGNORE_CCA BIT(9) -#define CCX_CMD_IGNORE_TXON BIT(10) -#define CCX_CLM_RESULT_READY BIT(16) -#define CCX_NHM_RESULT_READY BIT(16) -#define CCX_CMD_RESET 0x0 - - -#define HWSET_MAX_SIZE_92S 128 -#define EFUSE_MAX_SECTION 16 -#define EFUSE_REAL_CONTENT_LEN 512 -#define EFUSE_OOB_PROTECT_BYTES 15 - -#define RTL8190_EEPROM_ID 0x8129 -#define EEPROM_HPON 0x02 -#define EEPROM_CLK 0x06 -#define EEPROM_TESTR 0x08 - -#define EEPROM_VID 0x0A -#define EEPROM_DID 0x0C -#define EEPROM_SVID 0x0E -#define EEPROM_SMID 0x10 - -#define EEPROM_MAC_ADDR 0x12 -#define EEPROM_NODE_ADDRESS_BYTE_0 0x12 - -#define EEPROM_PWDIFF 0x54 - -#define EEPROM_TXPOWERBASE 0x50 -#define EEPROM_TX_PWR_INDEX_RANGE 28 - -#define EEPROM_TX_PWR_HT20_DIFF 0x62 -#define DEFAULT_HT20_TXPWR_DIFF 2 -#define EEPROM_TX_PWR_OFDM_DIFF 0x65 - -#define EEPROM_TXPWRGROUP 0x67 -#define EEPROM_REGULATORY 0x6D - -#define TX_PWR_SAFETY_CHK 0x6D -#define EEPROM_TXPWINDEX_CCK_24G 0x5D -#define EEPROM_TXPWINDEX_OFDM_24G 0x6B -#define EEPROM_HT2T_CH1_A 0x6c -#define EEPROM_HT2T_CH7_A 0x6d -#define EEPROM_HT2T_CH13_A 0x6e -#define EEPROM_HT2T_CH1_B 0x6f -#define EEPROM_HT2T_CH7_B 0x70 -#define EEPROM_HT2T_CH13_B 0x71 - -#define EEPROM_TSSI_A 0x74 -#define EEPROM_TSSI_B 0x75 - -#define EEPROM_RFIND_POWERDIFF 0x76 -#define EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF 0x3 - -#define EEPROM_THERMALMETER 0x77 -#define EEPROM_BLUETOOTH_COEXIST 0x78 -#define EEPROM_BLUETOOTH_TYPE 0x4f - -#define EEPROM_OPTIONAL 0x78 -#define EEPROM_WOWLAN 0x78 - -#define EEPROM_CRYSTALCAP 0x79 -#define EEPROM_CHANNELPLAN 0x7B -#define EEPROM_VERSION 0x7C -#define EEPROM_CUSTOMID 0x7A -#define EEPROM_BOARDTYPE 0x7E - -#define EEPROM_CHANNEL_PLAN_FCC 0x0 -#define EEPROM_CHANNEL_PLAN_IC 0x1 -#define EEPROM_CHANNEL_PLAN_ETSI 0x2 -#define EEPROM_CHANNEL_PLAN_SPAIN 0x3 -#define EEPROM_CHANNEL_PLAN_FRANCE 0x4 -#define EEPROM_CHANNEL_PLAN_MKK 0x5 -#define EEPROM_CHANNEL_PLAN_MKK1 0x6 -#define EEPROM_CHANNEL_PLAN_ISRAEL 0x7 -#define EEPROM_CHANNEL_PLAN_TELEC 0x8 -#define EEPROM_CHANNEL_PLAN_GLOBAL_DOMAIN 0x9 -#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_13 0xA -#define EEPROM_CHANNEL_PLAN_NCC 0xB -#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80 - -#define FW_DIG_DISABLE 0xfd00cc00 -#define FW_DIG_ENABLE 0xfd000000 -#define FW_DIG_HALT 0xfd000001 -#define FW_DIG_RESUME 0xfd000002 -#define FW_HIGH_PWR_DISABLE 0xfd000008 -#define FW_HIGH_PWR_ENABLE 0xfd000009 -#define FW_ADD_A2_ENTRY 0xfd000016 -#define FW_TXPWR_TRACK_ENABLE 0xfd000017 -#define FW_TXPWR_TRACK_DISABLE 0xfd000018 -#define FW_TXPWR_TRACK_THERMAL 0xfd000019 -#define FW_TXANT_SWITCH_ENABLE 0xfd000023 -#define FW_TXANT_SWITCH_DISABLE 0xfd000024 -#define FW_RA_INIT 0xfd000026 -#define FW_CTRL_DM_BY_DRIVER 0Xfd00002a -#define FW_RA_IOT_BG_COMB 0xfd000030 -#define FW_RA_IOT_N_COMB 0xfd000031 -#define FW_RA_REFRESH 0xfd0000a0 -#define FW_RA_UPDATE_MASK 0xfd0000a2 -#define FW_RA_DISABLE 0xfd0000a4 -#define FW_RA_ACTIVE 0xfd0000a6 -#define FW_RA_DISABLE_RSSI_MASK 0xfd0000ac -#define FW_RA_ENABLE_RSSI_MASK 0xfd0000ad -#define FW_RA_RESET 0xfd0000af -#define FW_DM_DISABLE 0xfd00aa00 -#define FW_IQK_ENABLE 0xf0000020 -#define FW_IQK_SUCCESS 0x0000dddd -#define FW_IQK_FAIL 0x0000ffff -#define FW_OP_FAILURE 0xffffffff -#define FW_TX_FEEDBACK_NONE 0xfb000000 -#define FW_TX_FEEDBACK_DTM_ENABLE (FW_TX_FEEDBACK_NONE | 0x1) -#define FW_TX_FEEDBACK_CCX_ENABL (FW_TX_FEEDBACK_NONE | 0x2) -#define FW_BB_RESET_ENABLE 0xff00000d -#define FW_BB_RESET_DISABLE 0xff00000e -#define FW_CCA_CHK_ENABLE 0xff000011 -#define FW_CCK_RESET_CNT 0xff000013 -#define FW_LPS_ENTER 0xfe000010 -#define FW_LPS_LEAVE 0xfe000011 -#define FW_INDIRECT_READ 0xf2000000 -#define FW_INDIRECT_WRITE 0xf2000001 -#define FW_CHAN_SET 0xf3000001 - -#define RFPC 0x5F -#define RCR_9356SEL BIT(6) -#define TCR_LRL_OFFSET 0 -#define TCR_SRL_OFFSET 8 -#define TCR_MXDMA_OFFSET 21 -#define TCR_SAT BIT(24) -#define RCR_MXDMA_OFFSET 8 -#define RCR_FIFO_OFFSET 13 -#define RCR_OnlyErlPkt BIT(31) -#define CWR 0xDC -#define RETRYCTR 0xDE - -#define CPU_GEN_SYSTEM_RESET 0x00000001 - -#define CCX_COMMAND_REG 0x890 -#define CLM_PERIOD_REG 0x894 -#define NHM_PERIOD_REG 0x896 - -#define NHM_THRESHOLD0 0x898 -#define NHM_THRESHOLD1 0x899 -#define NHM_THRESHOLD2 0x89A -#define NHM_THRESHOLD3 0x89B -#define NHM_THRESHOLD4 0x89C -#define NHM_THRESHOLD5 0x89D -#define NHM_THRESHOLD6 0x89E -#define CLM_RESULT_REG 0x8D0 -#define NHM_RESULT_REG 0x8D4 -#define NHM_RPI_COUNTER0 0x8D8 -#define NHM_RPI_COUNTER1 0x8D9 -#define NHM_RPI_COUNTER2 0x8DA -#define NHM_RPI_COUNTER3 0x8DB -#define NHM_RPI_COUNTER4 0x8DC -#define NHM_RPI_COUNTER5 0x8DD -#define NHM_RPI_COUNTER6 0x8DE -#define NHM_RPI_COUNTER7 0x8DF - -#define HAL_8192S_HW_GPIO_OFF_BIT BIT(3) -#define HAL_8192S_HW_GPIO_OFF_MASK 0xF7 -#define HAL_8192S_HW_GPIO_WPS_BIT BIT(4) - -#define RPMAC_RESET 0x100 -#define RPMAC_TXSTART 0x104 -#define RPMAC_TXLEGACYSIG 0x108 -#define RPMAC_TXHTSIG1 0x10c -#define RPMAC_TXHTSIG2 0x110 -#define RPMAC_PHYDEBUG 0x114 -#define RPMAC_TXPACKETNNM 0x118 -#define RPMAC_TXIDLE 0x11c -#define RPMAC_TXMACHEADER0 0x120 -#define RPMAC_TXMACHEADER1 0x124 -#define RPMAC_TXMACHEADER2 0x128 -#define RPMAC_TXMACHEADER3 0x12c -#define RPMAC_TXMACHEADER4 0x130 -#define RPMAC_TXMACHEADER5 0x134 -#define RPMAC_TXDATATYPE 0x138 -#define RPMAC_TXRANDOMSEED 0x13c -#define RPMAC_CCKPLCPPREAMBLE 0x140 -#define RPMAC_CCKPLCPHEADER 0x144 -#define RPMAC_CCKCRC16 0x148 -#define RPMAC_OFDMRXCRC32OK 0x170 -#define RPMAC_OFDMRXCRC32ER 0x174 -#define RPMAC_OFDMRXPARITYER 0x178 -#define RPMAC_OFDMRXCRC8ER 0x17c -#define RPMAC_CCKCRXRC16ER 0x180 -#define RPMAC_CCKCRXRC32ER 0x184 -#define RPMAC_CCKCRXRC32OK 0x188 -#define RPMAC_TXSTATUS 0x18c - -#define RF_BB_CMD_ADDR 0x02c0 -#define RF_BB_CMD_DATA 0x02c4 - -#define RFPGA0_RFMOD 0x800 - -#define RFPGA0_TXINFO 0x804 -#define RFPGA0_PSDFUNCTION 0x808 - -#define RFPGA0_TXGAINSTAGE 0x80c - -#define RFPGA0_RFTIMING1 0x810 -#define RFPGA0_RFTIMING2 0x814 -#define RFPGA0_XA_HSSIPARAMETER1 0x820 -#define RFPGA0_XA_HSSIPARAMETER2 0x824 -#define RFPGA0_XB_HSSIPARAMETER1 0x828 -#define RFPGA0_XB_HSSIPARAMETER2 0x82c -#define RFPGA0_XC_HSSIPARAMETER1 0x830 -#define RFPGA0_XC_HSSIPARAMETER2 0x834 -#define RFPGA0_XD_HSSIPARAMETER1 0x838 -#define RFPGA0_XD_HSSIPARAMETER2 0x83c -#define RFPGA0_XA_LSSIPARAMETER 0x840 -#define RFPGA0_XB_LSSIPARAMETER 0x844 -#define RFPGA0_XC_LSSIPARAMETER 0x848 -#define RFPGA0_XD_LSSIPARAMETER 0x84c - -#define RFPGA0_RFWAKEUP_PARAMETER 0x850 -#define RFPGA0_RFSLEEPUP_PARAMETER 0x854 - -#define RFPGA0_XAB_SWITCHCONTROL 0x858 -#define RFPGA0_XCD_SWITCHCONTROL 0x85c - -#define RFPGA0_XA_RFINTERFACEOE 0x860 -#define RFPGA0_XB_RFINTERFACEOE 0x864 -#define RFPGA0_XC_RFINTERFACEOE 0x868 -#define RFPGA0_XD_RFINTERFACEOE 0x86c - -#define RFPGA0_XAB_RFINTERFACESW 0x870 -#define RFPGA0_XCD_RFINTERFACESW 0x874 - -#define RFPGA0_XAB_RFPARAMETER 0x878 -#define RFPGA0_XCD_RFPARAMETER 0x87c - -#define RFPGA0_ANALOGPARAMETER1 0x880 -#define RFPGA0_ANALOGPARAMETER2 0x884 -#define RFPGA0_ANALOGPARAMETER3 0x888 -#define RFPGA0_ANALOGPARAMETER4 0x88c - -#define RFPGA0_XA_LSSIREADBACK 0x8a0 -#define RFPGA0_XB_LSSIREADBACK 0x8a4 -#define RFPGA0_XC_LSSIREADBACK 0x8a8 -#define RFPGA0_XD_LSSIREADBACK 0x8ac - -#define RFPGA0_PSDREPORT 0x8b4 -#define TRANSCEIVERA_HSPI_READBACK 0x8b8 -#define TRANSCEIVERB_HSPI_READBACK 0x8bc -#define RFPGA0_XAB_RFINTERFACERB 0x8e0 -#define RFPGA0_XCD_RFINTERFACERB 0x8e4 -#define RFPGA1_RFMOD 0x900 - -#define RFPGA1_TXBLOCK 0x904 -#define RFPGA1_DEBUGSELECT 0x908 -#define RFPGA1_TXINFO 0x90c - -#define RCCK0_SYSTEM 0xa00 - -#define RCCK0_AFESETTING 0xa04 -#define RCCK0_CCA 0xa08 - -#define RCCK0_RXAGC1 0xa0c -#define RCCK0_RXAGC2 0xa10 - -#define RCCK0_RXHP 0xa14 - -#define RCCK0_DSPPARAMETER1 0xa18 -#define RCCK0_DSPPARAMETER2 0xa1c - -#define RCCK0_TXFILTER1 0xa20 -#define RCCK0_TXFILTER2 0xa24 -#define RCCK0_DEBUGPORT 0xa28 -#define RCCK0_FALSEALARMREPORT 0xa2c -#define RCCK0_TRSSIREPORT 0xa50 -#define RCCK0_RXREPORT 0xa54 -#define RCCK0_FACOUNTERLOWER 0xa5c -#define RCCK0_FACOUNTERUPPER 0xa58 - -#define ROFDM0_LSTF 0xc00 - -#define ROFDM0_TRXPATHENABLE 0xc04 -#define ROFDM0_TRMUXPAR 0xc08 -#define ROFDM0_TRSWISOLATION 0xc0c - -#define ROFDM0_XARXAFE 0xc10 -#define ROFDM0_XARXIQIMBALANCE 0xc14 -#define ROFDM0_XBRXAFE 0xc18 -#define ROFDM0_XBRXIQIMBALANCE 0xc1c -#define ROFDM0_XCRXAFE 0xc20 -#define ROFDM0_XCRXIQIMBALANCE 0xc24 -#define ROFDM0_XDRXAFE 0xc28 -#define ROFDM0_XDRXIQIMBALANCE 0xc2c - -#define ROFDM0_RXDETECTOR1 0xc30 -#define ROFDM0_RXDETECTOR2 0xc34 -#define ROFDM0_RXDETECTOR3 0xc38 -#define ROFDM0_RXDETECTOR4 0xc3c - -#define ROFDM0_RXDSP 0xc40 -#define ROFDM0_CFO_AND_DAGC 0xc44 -#define ROFDM0_CCADROP_THRESHOLD 0xc48 -#define ROFDM0_ECCA_THRESHOLD 0xc4c - -#define ROFDM0_XAAGCCORE1 0xc50 -#define ROFDM0_XAAGCCORE2 0xc54 -#define ROFDM0_XBAGCCORE1 0xc58 -#define ROFDM0_XBAGCCORE2 0xc5c -#define ROFDM0_XCAGCCORE1 0xc60 -#define ROFDM0_XCAGCCORE2 0xc64 -#define ROFDM0_XDAGCCORE1 0xc68 -#define ROFDM0_XDAGCCORE2 0xc6c - -#define ROFDM0_AGCPARAMETER1 0xc70 -#define ROFDM0_AGCPARAMETER2 0xc74 -#define ROFDM0_AGCRSSITABLE 0xc78 -#define ROFDM0_HTSTFAGC 0xc7c - -#define ROFDM0_XATXIQIMBALANCE 0xc80 -#define ROFDM0_XATXAFE 0xc84 -#define ROFDM0_XBTXIQIMBALANCE 0xc88 -#define ROFDM0_XBTXAFE 0xc8c -#define ROFDM0_XCTXIQIMBALANCE 0xc90 -#define ROFDM0_XCTXAFE 0xc94 -#define ROFDM0_XDTXIQIMBALANCE 0xc98 -#define ROFDM0_XDTXAFE 0xc9c - -#define ROFDM0_RXHP_PARAMETER 0xce0 -#define ROFDM0_TXPSEUDO_NOISE_WGT 0xce4 -#define ROFDM0_FRAME_SYNC 0xcf0 -#define ROFDM0_DFSREPORT 0xcf4 -#define ROFDM0_TXCOEFF1 0xca4 -#define ROFDM0_TXCOEFF2 0xca8 -#define ROFDM0_TXCOEFF3 0xcac -#define ROFDM0_TXCOEFF4 0xcb0 -#define ROFDM0_TXCOEFF5 0xcb4 -#define ROFDM0_TXCOEFF6 0xcb8 - - -#define ROFDM1_LSTF 0xd00 -#define ROFDM1_TRXPATHENABLE 0xd04 - -#define ROFDM1_CFO 0xd08 -#define ROFDM1_CSI1 0xd10 -#define ROFDM1_SBD 0xd14 -#define ROFDM1_CSI2 0xd18 -#define ROFDM1_CFOTRACKING 0xd2c -#define ROFDM1_TRXMESAURE1 0xd34 -#define ROFDM1_INTF_DET 0xd3c -#define ROFDM1_PSEUDO_NOISESTATEAB 0xd50 -#define ROFDM1_PSEUDO_NOISESTATECD 0xd54 -#define ROFDM1_RX_PSEUDO_NOISE_WGT 0xd58 - -#define ROFDM_PHYCOUNTER1 0xda0 -#define ROFDM_PHYCOUNTER2 0xda4 -#define ROFDM_PHYCOUNTER3 0xda8 - -#define ROFDM_SHORT_CFOAB 0xdac -#define ROFDM_SHORT_CFOCD 0xdb0 -#define ROFDM_LONG_CFOAB 0xdb4 -#define ROFDM_LONG_CFOCD 0xdb8 -#define ROFDM_TAIL_CFOAB 0xdbc -#define ROFDM_TAIL_CFOCD 0xdc0 -#define ROFDM_PW_MEASURE1 0xdc4 -#define ROFDM_PW_MEASURE2 0xdc8 -#define ROFDM_BW_REPORT 0xdcc -#define ROFDM_AGC_REPORT 0xdd0 -#define ROFDM_RXSNR 0xdd4 -#define ROFDM_RXEVMCSI 0xdd8 -#define ROFDM_SIG_REPORT 0xddc - - -#define RTXAGC_RATE18_06 0xe00 -#define RTXAGC_RATE54_24 0xe04 -#define RTXAGC_CCK_MCS32 0xe08 -#define RTXAGC_MCS03_MCS00 0xe10 -#define RTXAGC_MCS07_MCS04 0xe14 -#define RTXAGC_MCS11_MCS08 0xe18 -#define RTXAGC_MCS15_MCS12 0xe1c - - -#define RF_AC 0x00 -#define RF_IQADJ_G1 0x01 -#define RF_IQADJ_G2 0x02 -#define RF_POW_TRSW 0x05 -#define RF_GAIN_RX 0x06 -#define RF_GAIN_TX 0x07 -#define RF_TXM_IDAC 0x08 -#define RF_BS_IQGEN 0x0F - -#define RF_MODE1 0x10 -#define RF_MODE2 0x11 -#define RF_RX_AGC_HP 0x12 -#define RF_TX_AGC 0x13 -#define RF_BIAS 0x14 -#define RF_IPA 0x15 -#define RF_POW_ABILITY 0x17 -#define RF_MODE_AG 0x18 -#define RF_CHANNEL 0x18 -#define RF_CHNLBW 0x18 -#define RF_TOP 0x19 -#define RF_RX_G1 0x1A -#define RF_RX_G2 0x1B -#define RF_RX_BB2 0x1C -#define RF_RX_BB1 0x1D -#define RF_RCK1 0x1E -#define RF_RCK2 0x1F - -#define RF_TX_G1 0x20 -#define RF_TX_G2 0x21 -#define RF_TX_G3 0x22 -#define RF_TX_BB1 0x23 -#define RF_T_METER 0x24 -#define RF_SYN_G1 0x25 -#define RF_SYN_G2 0x26 -#define RF_SYN_G3 0x27 -#define RF_SYN_G4 0x28 -#define RF_SYN_G5 0x29 -#define RF_SYN_G6 0x2A -#define RF_SYN_G7 0x2B -#define RF_SYN_G8 0x2C - -#define RF_RCK_OS 0x30 -#define RF_TXPA_G1 0x31 -#define RF_TXPA_G2 0x32 -#define RF_TXPA_G3 0x33 - -#define BRFMOD 0x1 -#define BCCKEN 0x1000000 -#define BOFDMEN 0x2000000 - -#define BXBTXAGC 0xf00 -#define BXCTXAGC 0xf000 -#define BXDTXAGC 0xf0000 - -#define B3WIRE_DATALENGTH 0x800 -#define B3WIRE_ADDRESSLENGTH 0x400 - -#define BRFSI_RFENV 0x10 - -#define BLSSI_READADDRESS 0x7f800000 -#define BLSSI_READEDGE 0x80000000 -#define BLSSI_READBACK_DATA 0xfffff - -#define BADCLKPHASE 0x4000000 - -#define BCCK_SIDEBAND 0x10 - -#define BTX_AGCRATECCK 0x7f00 - -#define MASKBYTE0 0xff -#define MASKBYTE1 0xff00 -#define MASKBYTE2 0xff0000 -#define MASKBYTE3 0xff000000 -#define MASKHWORD 0xffff0000 -#define MASKLWORD 0x0000ffff -#define MASKDWORD 0xffffffff - -#define MAKS12BITS 0xfffff -#define MASK20BITS 0xfffff -#define RFREG_OFFSET_MASK 0xfffff - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c deleted file mode 100644 index 92d38ab3c60e..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c +++ /dev/null @@ -1,535 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" - - -static void _rtl92s_get_powerbase(struct ieee80211_hw *hw, u8 *p_pwrlevel, - u8 chnl, u32 *ofdmbase, u32 *mcsbase, - u8 *p_final_pwridx) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u32 pwrbase0, pwrbase1; - u8 legacy_pwrdiff = 0, ht20_pwrdiff = 0; - u8 i, pwrlevel[4]; - - for (i = 0; i < 2; i++) - pwrlevel[i] = p_pwrlevel[i]; - - /* We only care about the path A for legacy. */ - if (rtlefuse->eeprom_version < 2) { - pwrbase0 = pwrlevel[0] + (rtlefuse->legacy_httxpowerdiff & 0xf); - } else if (rtlefuse->eeprom_version >= 2) { - legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff - [RF90_PATH_A][chnl - 1]; - - /* For legacy OFDM, tx pwr always > HT OFDM pwr. - * We do not care Path B - * legacy OFDM pwr diff. NO BB register - * to notify HW. */ - pwrbase0 = pwrlevel[0] + legacy_pwrdiff; - } - - pwrbase0 = (pwrbase0 << 24) | (pwrbase0 << 16) | (pwrbase0 << 8) | - pwrbase0; - *ofdmbase = pwrbase0; - - /* MCS rates */ - if (rtlefuse->eeprom_version >= 2) { - /* Check HT20 to HT40 diff */ - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) { - for (i = 0; i < 2; i++) { - /* rf-A, rf-B */ - /* HT 20<->40 pwr diff */ - ht20_pwrdiff = rtlefuse->txpwr_ht20diff - [i][chnl - 1]; - - if (ht20_pwrdiff < 8) /* 0~+7 */ - pwrlevel[i] += ht20_pwrdiff; - else /* index8-15=-8~-1 */ - pwrlevel[i] -= (16 - ht20_pwrdiff); - } - } - } - - /* use index of rf-A */ - pwrbase1 = pwrlevel[0]; - pwrbase1 = (pwrbase1 << 24) | (pwrbase1 << 16) | (pwrbase1 << 8) | - pwrbase1; - *mcsbase = pwrbase1; - - /* The following is for Antenna - * diff from Ant-B to Ant-A */ - p_final_pwridx[0] = pwrlevel[0]; - p_final_pwridx[1] = pwrlevel[1]; - - switch (rtlefuse->eeprom_regulatory) { - case 3: - /* The following is for calculation - * of the power diff for Ant-B to Ant-A. */ - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - p_final_pwridx[0] += rtlefuse->pwrgroup_ht40 - [RF90_PATH_A][ - chnl - 1]; - p_final_pwridx[1] += rtlefuse->pwrgroup_ht40 - [RF90_PATH_B][ - chnl - 1]; - } else { - p_final_pwridx[0] += rtlefuse->pwrgroup_ht20 - [RF90_PATH_A][ - chnl - 1]; - p_final_pwridx[1] += rtlefuse->pwrgroup_ht20 - [RF90_PATH_B][ - chnl - 1]; - } - break; - default: - break; - } - - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "40MHz finalpwr_idx (A / B) = 0x%x / 0x%x\n", - p_final_pwridx[0], p_final_pwridx[1]); - } else { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "20MHz finalpwr_idx (A / B) = 0x%x / 0x%x\n", - p_final_pwridx[0], p_final_pwridx[1]); - } -} - -static void _rtl92s_set_antennadiff(struct ieee80211_hw *hw, - u8 *p_final_pwridx) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - char ant_pwr_diff = 0; - u32 u4reg_val = 0; - - if (rtlphy->rf_type == RF_2T2R) { - ant_pwr_diff = p_final_pwridx[1] - p_final_pwridx[0]; - - /* range is from 7~-8, - * index = 0x0~0xf */ - if (ant_pwr_diff > 7) - ant_pwr_diff = 7; - if (ant_pwr_diff < -8) - ant_pwr_diff = -8; - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Antenna Diff from RF-B to RF-A = %d (0x%x)\n", - ant_pwr_diff, ant_pwr_diff & 0xf); - - ant_pwr_diff &= 0xf; - } - - /* Antenna TX power difference */ - rtlefuse->antenna_txpwdiff[2] = 0;/* RF-D, don't care */ - rtlefuse->antenna_txpwdiff[1] = 0;/* RF-C, don't care */ - rtlefuse->antenna_txpwdiff[0] = (u8)(ant_pwr_diff); /* RF-B */ - - u4reg_val = rtlefuse->antenna_txpwdiff[2] << 8 | - rtlefuse->antenna_txpwdiff[1] << 4 | - rtlefuse->antenna_txpwdiff[0]; - - rtl_set_bbreg(hw, RFPGA0_TXGAINSTAGE, (BXBTXAGC | BXCTXAGC | BXDTXAGC), - u4reg_val); - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "Write BCD-Diff(0x%x) = 0x%x\n", - RFPGA0_TXGAINSTAGE, u4reg_val); -} - -static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw, - u8 chnl, u8 index, - u32 pwrbase0, - u32 pwrbase1, - u32 *p_outwrite_val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 i, chnlgroup, pwrdiff_limit[4]; - u32 writeval, customer_limit; - - /* Index 0 & 1= legacy OFDM, 2-5=HT_MCS rate */ - switch (rtlefuse->eeprom_regulatory) { - case 0: - /* Realtek better performance increase power diff - * defined by Realtek for large power */ - chnlgroup = 0; - - writeval = rtlphy->mcs_offset[chnlgroup][index] + - ((index < 2) ? pwrbase0 : pwrbase1); - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "RTK better performance, writeval = 0x%x\n", writeval); - break; - case 1: - /* Realtek regulatory increase power diff defined - * by Realtek for regulatory */ - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - writeval = ((index < 2) ? pwrbase0 : pwrbase1); - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Realtek regulatory, 40MHz, writeval = 0x%x\n", - writeval); - } else { - if (rtlphy->pwrgroup_cnt == 1) - chnlgroup = 0; - - if (rtlphy->pwrgroup_cnt >= 3) { - if (chnl <= 3) - chnlgroup = 0; - else if (chnl >= 4 && chnl <= 8) - chnlgroup = 1; - else if (chnl > 8) - chnlgroup = 2; - if (rtlphy->pwrgroup_cnt == 4) - chnlgroup++; - } - - writeval = rtlphy->mcs_offset[chnlgroup][index] - + ((index < 2) ? - pwrbase0 : pwrbase1); - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Realtek regulatory, 20MHz, writeval = 0x%x\n", - writeval); - } - break; - case 2: - /* Better regulatory don't increase any power diff */ - writeval = ((index < 2) ? pwrbase0 : pwrbase1); - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Better regulatory, writeval = 0x%x\n", writeval); - break; - case 3: - /* Customer defined power diff. increase power diff - defined by customer. */ - chnlgroup = 0; - - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "customer's limit, 40MHz = 0x%x\n", - rtlefuse->pwrgroup_ht40 - [RF90_PATH_A][chnl - 1]); - } else { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "customer's limit, 20MHz = 0x%x\n", - rtlefuse->pwrgroup_ht20 - [RF90_PATH_A][chnl - 1]); - } - - for (i = 0; i < 4; i++) { - pwrdiff_limit[i] = (u8)((rtlphy->mcs_offset - [chnlgroup][index] & (0x7f << (i * 8))) - >> (i * 8)); - - if (rtlphy->current_chan_bw == - HT_CHANNEL_WIDTH_20_40) { - if (pwrdiff_limit[i] > - rtlefuse->pwrgroup_ht40 - [RF90_PATH_A][chnl - 1]) { - pwrdiff_limit[i] = - rtlefuse->pwrgroup_ht40 - [RF90_PATH_A][chnl - 1]; - } - } else { - if (pwrdiff_limit[i] > - rtlefuse->pwrgroup_ht20 - [RF90_PATH_A][chnl - 1]) { - pwrdiff_limit[i] = - rtlefuse->pwrgroup_ht20 - [RF90_PATH_A][chnl - 1]; - } - } - } - - customer_limit = (pwrdiff_limit[3] << 24) | - (pwrdiff_limit[2] << 16) | - (pwrdiff_limit[1] << 8) | - (pwrdiff_limit[0]); - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Customer's limit = 0x%x\n", customer_limit); - - writeval = customer_limit + ((index < 2) ? - pwrbase0 : pwrbase1); - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Customer, writeval = 0x%x\n", writeval); - break; - default: - chnlgroup = 0; - writeval = rtlphy->mcs_offset[chnlgroup][index] + - ((index < 2) ? pwrbase0 : pwrbase1); - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "RTK better performance, writeval = 0x%x\n", writeval); - break; - } - - if (rtlpriv->dm.dynamic_txhighpower_lvl == TX_HIGH_PWR_LEVEL_LEVEL1) - writeval = 0x10101010; - else if (rtlpriv->dm.dynamic_txhighpower_lvl == - TX_HIGH_PWR_LEVEL_LEVEL2) - writeval = 0x0; - - *p_outwrite_val = writeval; - -} - -static void _rtl92s_write_ofdm_powerreg(struct ieee80211_hw *hw, - u8 index, u32 val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u16 regoffset[6] = {0xe00, 0xe04, 0xe10, 0xe14, 0xe18, 0xe1c}; - u8 i, rfa_pwr[4]; - u8 rfa_lower_bound = 0, rfa_upper_bound = 0, rf_pwr_diff = 0; - u32 writeval = val; - - /* If path A and Path B coexist, we must limit Path A tx power. - * Protect Path B pwr over or under flow. We need to calculate - * upper and lower bound of path A tx power. */ - if (rtlphy->rf_type == RF_2T2R) { - rf_pwr_diff = rtlefuse->antenna_txpwdiff[0]; - - /* Diff=-8~-1 */ - if (rf_pwr_diff >= 8) { - /* Prevent underflow!! */ - rfa_lower_bound = 0x10 - rf_pwr_diff; - /* if (rf_pwr_diff >= 0) Diff = 0-7 */ - } else { - rfa_upper_bound = RF6052_MAX_TX_PWR - rf_pwr_diff; - } - } - - for (i = 0; i < 4; i++) { - rfa_pwr[i] = (u8)((writeval & (0x7f << (i * 8))) >> (i * 8)); - if (rfa_pwr[i] > RF6052_MAX_TX_PWR) - rfa_pwr[i] = RF6052_MAX_TX_PWR; - - /* If path A and Path B coexist, we must limit Path A tx power. - * Protect Path B pwr over or under flow. We need to calculate - * upper and lower bound of path A tx power. */ - if (rtlphy->rf_type == RF_2T2R) { - /* Diff=-8~-1 */ - if (rf_pwr_diff >= 8) { - /* Prevent underflow!! */ - if (rfa_pwr[i] < rfa_lower_bound) - rfa_pwr[i] = rfa_lower_bound; - /* Diff = 0-7 */ - } else if (rf_pwr_diff >= 1) { - /* Prevent overflow */ - if (rfa_pwr[i] > rfa_upper_bound) - rfa_pwr[i] = rfa_upper_bound; - } - } - - } - - writeval = (rfa_pwr[3] << 24) | (rfa_pwr[2] << 16) | (rfa_pwr[1] << 8) | - rfa_pwr[0]; - - rtl_set_bbreg(hw, regoffset[index], 0x7f7f7f7f, writeval); -} - -void rtl92s_phy_rf6052_set_ofdmtxpower(struct ieee80211_hw *hw, - u8 *p_pwrlevel, u8 chnl) -{ - u32 writeval, pwrbase0, pwrbase1; - u8 index = 0; - u8 finalpwr_idx[4]; - - _rtl92s_get_powerbase(hw, p_pwrlevel, chnl, &pwrbase0, &pwrbase1, - &finalpwr_idx[0]); - _rtl92s_set_antennadiff(hw, &finalpwr_idx[0]); - - for (index = 0; index < 6; index++) { - _rtl92s_get_txpower_writeval_byregulatory(hw, chnl, index, - pwrbase0, pwrbase1, &writeval); - - _rtl92s_write_ofdm_powerreg(hw, index, writeval); - } -} - -void rtl92s_phy_rf6052_set_ccktxpower(struct ieee80211_hw *hw, u8 pwrlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u32 txagc = 0; - bool dont_inc_cck_or_turboscanoff = false; - - if (((rtlefuse->eeprom_version >= 2) && - (rtlefuse->txpwr_safetyflag == 1)) || - ((rtlefuse->eeprom_version >= 2) && - (rtlefuse->eeprom_regulatory != 0))) - dont_inc_cck_or_turboscanoff = true; - - if (mac->act_scanning) { - txagc = 0x3f; - if (dont_inc_cck_or_turboscanoff) - txagc = pwrlevel; - } else { - txagc = pwrlevel; - - if (rtlpriv->dm.dynamic_txhighpower_lvl == - TX_HIGH_PWR_LEVEL_LEVEL1) - txagc = 0x10; - else if (rtlpriv->dm.dynamic_txhighpower_lvl == - TX_HIGH_PWR_LEVEL_LEVEL2) - txagc = 0x0; - } - - if (txagc > RF6052_MAX_TX_PWR) - txagc = RF6052_MAX_TX_PWR; - - rtl_set_bbreg(hw, RTXAGC_CCK_MCS32, BTX_AGCRATECCK, txagc); - -} - -bool rtl92s_phy_rf6052_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 u4reg_val = 0; - u8 rfpath; - bool rtstatus = true; - struct bb_reg_def *pphyreg; - - /* Initialize RF */ - for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) { - - pphyreg = &rtlphy->phyreg_def[rfpath]; - - /* Store original RFENV control type */ - switch (rfpath) { - case RF90_PATH_A: - case RF90_PATH_C: - u4reg_val = rtl92s_phy_query_bb_reg(hw, - pphyreg->rfintfs, - BRFSI_RFENV); - break; - case RF90_PATH_B: - case RF90_PATH_D: - u4reg_val = rtl92s_phy_query_bb_reg(hw, - pphyreg->rfintfs, - BRFSI_RFENV << 16); - break; - } - - /* Set RF_ENV enable */ - rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfe, - BRFSI_RFENV << 16, 0x1); - - /* Set RF_ENV output high */ - rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfo, BRFSI_RFENV, 0x1); - - /* Set bit number of Address and Data for RF register */ - rtl92s_phy_set_bb_reg(hw, pphyreg->rfhssi_para2, - B3WIRE_ADDRESSLENGTH, 0x0); - rtl92s_phy_set_bb_reg(hw, pphyreg->rfhssi_para2, - B3WIRE_DATALENGTH, 0x0); - - /* Initialize RF fom connfiguration file */ - switch (rfpath) { - case RF90_PATH_A: - rtstatus = rtl92s_phy_config_rf(hw, - (enum radio_path)rfpath); - break; - case RF90_PATH_B: - rtstatus = rtl92s_phy_config_rf(hw, - (enum radio_path)rfpath); - break; - case RF90_PATH_C: - break; - case RF90_PATH_D: - break; - } - - /* Restore RFENV control type */ - switch (rfpath) { - case RF90_PATH_A: - case RF90_PATH_C: - rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfs, BRFSI_RFENV, - u4reg_val); - break; - case RF90_PATH_B: - case RF90_PATH_D: - rtl92s_phy_set_bb_reg(hw, pphyreg->rfintfs, - BRFSI_RFENV << 16, - u4reg_val); - break; - } - - if (!rtstatus) { - pr_err("Radio[%d] Fail!!\n", rfpath); - goto fail; - } - - } - - return rtstatus; - -fail: - return rtstatus; -} - -void rtl92s_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - switch (bandwidth) { - case HT_CHANNEL_WIDTH_20: - rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] & - 0xfffff3ff) | 0x0400); - rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK, - rtlphy->rfreg_chnlval[0]); - break; - case HT_CHANNEL_WIDTH_20_40: - rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] & - 0xfffff3ff)); - rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK, - rtlphy->rfreg_chnlval[0]); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", bandwidth); - break; - } -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.h b/drivers/net/wireless/rtlwifi/rtl8192se/rf.h deleted file mode 100644 index 8a29eb94ab17..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.h +++ /dev/null @@ -1,43 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ -#ifndef __INC_RTL92S_RF_H -#define __INC_RTL92S_RF_H - -#define RF6052_MAX_TX_PWR 0x3F - -void rtl92s_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, - u8 bandwidth); -bool rtl92s_phy_rf6052_config(struct ieee80211_hw *hw) ; -void rtl92s_phy_rf6052_set_ccktxpower(struct ieee80211_hw *hw, - u8 powerlevel); -void rtl92s_phy_rf6052_set_ofdmtxpower(struct ieee80211_hw *hw, - u8 *p_pwrlevel, u8 chnl); - -#endif - diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c deleted file mode 100644 index 2e8e6f8d2d51..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c +++ /dev/null @@ -1,443 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../core.h" -#include "../base.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "fw.h" -#include "hw.h" -#include "sw.h" -#include "trx.h" -#include "led.h" - -#include - -static void rtl92s_init_aspm_vars(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - /*close ASPM for AMD defaultly */ - rtlpci->const_amdpci_aspm = 0; - - /* ASPM PS mode. - * 0 - Disable ASPM, - * 1 - Enable ASPM without Clock Req, - * 2 - Enable ASPM with Clock Req, - * 3 - Alwyas Enable ASPM with Clock Req, - * 4 - Always Enable ASPM without Clock Req. - * set defult to RTL8192CE:3 RTL8192E:2 - * */ - rtlpci->const_pci_aspm = 2; - - /*Setting for PCI-E device */ - rtlpci->const_devicepci_aspm_setting = 0x03; - - /*Setting for PCI-E bridge */ - rtlpci->const_hostpci_aspm_setting = 0x02; - - /* In Hw/Sw Radio Off situation. - * 0 - Default, - * 1 - From ASPM setting without low Mac Pwr, - * 2 - From ASPM setting with low Mac Pwr, - * 3 - Bus D3 - * set default to RTL8192CE:0 RTL8192SE:2 - */ - rtlpci->const_hwsw_rfoff_d3 = 2; - - /* This setting works for those device with - * backdoor ASPM setting such as EPHY setting. - * 0 - Not support ASPM, - * 1 - Support ASPM, - * 2 - According to chipset. - */ - rtlpci->const_support_pciaspm = 2; -} - -static void rtl92se_fw_cb(const struct firmware *firmware, void *context) -{ - struct ieee80211_hw *hw = context; - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(pcipriv); - struct rt_firmware *pfirmware = NULL; - int err; - - RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD, - "Firmware callback routine entered!\n"); - complete(&rtlpriv->firmware_loading_complete); - if (!firmware) { - pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name); - rtlpriv->max_fw_size = 0; - return; - } - if (firmware->size > rtlpriv->max_fw_size) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Firmware is too big!\n"); - rtlpriv->max_fw_size = 0; - release_firmware(firmware); - return; - } - pfirmware = (struct rt_firmware *)rtlpriv->rtlhal.pfirmware; - memcpy(pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size); - pfirmware->sz_fw_tmpbufferlen = firmware->size; - release_firmware(firmware); - - err = ieee80211_register_hw(hw); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Can't register mac80211 hw\n"); - return; - } else { - rtlpriv->mac80211.mac80211_registered = 1; - } - rtlpci->irq_alloc = 1; - set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status); - - /*init rfkill */ - rtl_init_rfkill(hw); -} - -static int rtl92s_init_sw_vars(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - int err = 0; - u16 earlyrxthreshold = 7; - - rtlpriv->dm.dm_initialgain_enable = true; - rtlpriv->dm.dm_flag = 0; - rtlpriv->dm.disable_framebursting = false; - rtlpriv->dm.thermalvalue = 0; - rtlpriv->dm.useramask = true; - - /* compatible 5G band 91se just 2.4G band & smsp */ - rtlpriv->rtlhal.current_bandtype = BAND_ON_2_4G; - rtlpriv->rtlhal.bandset = BAND_ON_2_4G; - rtlpriv->rtlhal.macphymode = SINGLEMAC_SINGLEPHY; - - rtlpci->transmit_config = 0; - - rtlpci->receive_config = - RCR_APPFCS | - RCR_APWRMGT | - /*RCR_ADD3 |*/ - RCR_AMF | - RCR_ADF | - RCR_APP_MIC | - RCR_APP_ICV | - RCR_AICV | - /* Accept ICV error, CRC32 Error */ - RCR_ACRC32 | - RCR_AB | - /* Accept Broadcast, Multicast */ - RCR_AM | - /* Accept Physical match */ - RCR_APM | - /* Accept Destination Address packets */ - /*RCR_AAP |*/ - RCR_APP_PHYST_STAFF | - /* Accept PHY status */ - RCR_APP_PHYST_RXFF | - (earlyrxthreshold << RCR_FIFO_OFFSET); - - rtlpci->irq_mask[0] = (u32) - (IMR_ROK | - IMR_VODOK | - IMR_VIDOK | - IMR_BEDOK | - IMR_BKDOK | - IMR_HCCADOK | - IMR_MGNTDOK | - IMR_COMDOK | - IMR_HIGHDOK | - IMR_BDOK | - IMR_RXCMDOK | - /*IMR_TIMEOUT0 |*/ - IMR_RDU | - IMR_RXFOVW | - IMR_BCNINT - /*| IMR_TXFOVW*/ - /*| IMR_TBDOK | - IMR_TBDER*/); - - rtlpci->irq_mask[1] = (u32) 0; - - rtlpci->shortretry_limit = 0x30; - rtlpci->longretry_limit = 0x30; - - rtlpci->first_init = true; - - /* for debug level */ - rtlpriv->dbg.global_debuglevel = rtlpriv->cfg->mod_params->debug; - /* for LPS & IPS */ - rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps; - rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; - rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; - if (!rtlpriv->psc.inactiveps) - pr_info("Power Save off (module option)\n"); - if (!rtlpriv->psc.fwctrl_lps) - pr_info("FW Power Save off (module option)\n"); - rtlpriv->psc.reg_fwctrl_lps = 3; - rtlpriv->psc.reg_max_lps_awakeintvl = 5; - /* for ASPM, you can close aspm through - * set const_support_pciaspm = 0 */ - rtl92s_init_aspm_vars(hw); - - if (rtlpriv->psc.reg_fwctrl_lps == 1) - rtlpriv->psc.fwctrl_psmode = FW_PS_MIN_MODE; - else if (rtlpriv->psc.reg_fwctrl_lps == 2) - rtlpriv->psc.fwctrl_psmode = FW_PS_MAX_MODE; - else if (rtlpriv->psc.reg_fwctrl_lps == 3) - rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE; - - /* for firmware buf */ - rtlpriv->rtlhal.pfirmware = vzalloc(sizeof(struct rt_firmware)); - if (!rtlpriv->rtlhal.pfirmware) - return 1; - - rtlpriv->max_fw_size = RTL8190_MAX_RAW_FIRMWARE_CODE_SIZE; - - pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n" - "Loading firmware %s\n", rtlpriv->cfg->fw_name); - /* request fw */ - err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl92se_fw_cb); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Failed to request firmware!\n"); - return 1; - } - - return err; -} - -static void rtl92s_deinit_sw_vars(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->rtlhal.pfirmware) { - vfree(rtlpriv->rtlhal.pfirmware); - rtlpriv->rtlhal.pfirmware = NULL; - } -} - -static struct rtl_hal_ops rtl8192se_hal_ops = { - .init_sw_vars = rtl92s_init_sw_vars, - .deinit_sw_vars = rtl92s_deinit_sw_vars, - .read_eeprom_info = rtl92se_read_eeprom_info, - .interrupt_recognized = rtl92se_interrupt_recognized, - .hw_init = rtl92se_hw_init, - .hw_disable = rtl92se_card_disable, - .hw_suspend = rtl92se_suspend, - .hw_resume = rtl92se_resume, - .enable_interrupt = rtl92se_enable_interrupt, - .disable_interrupt = rtl92se_disable_interrupt, - .set_network_type = rtl92se_set_network_type, - .set_chk_bssid = rtl92se_set_check_bssid, - .set_qos = rtl92se_set_qos, - .set_bcn_reg = rtl92se_set_beacon_related_registers, - .set_bcn_intv = rtl92se_set_beacon_interval, - .update_interrupt_mask = rtl92se_update_interrupt_mask, - .get_hw_reg = rtl92se_get_hw_reg, - .set_hw_reg = rtl92se_set_hw_reg, - .update_rate_tbl = rtl92se_update_hal_rate_tbl, - .fill_tx_desc = rtl92se_tx_fill_desc, - .fill_tx_cmddesc = rtl92se_tx_fill_cmddesc, - .query_rx_desc = rtl92se_rx_query_desc, - .set_channel_access = rtl92se_update_channel_access_setting, - .radio_onoff_checking = rtl92se_gpio_radio_on_off_checking, - .set_bw_mode = rtl92s_phy_set_bw_mode, - .switch_channel = rtl92s_phy_sw_chnl, - .dm_watchdog = rtl92s_dm_watchdog, - .scan_operation_backup = rtl92s_phy_scan_operation_backup, - .set_rf_power_state = rtl92s_phy_set_rf_power_state, - .led_control = rtl92se_led_control, - .set_desc = rtl92se_set_desc, - .get_desc = rtl92se_get_desc, - .tx_polling = rtl92se_tx_polling, - .enable_hw_sec = rtl92se_enable_hw_security_config, - .set_key = rtl92se_set_key, - .init_sw_leds = rtl92se_init_sw_leds, - .allow_all_destaddr = rtl92se_allow_all_destaddr, - .get_bbreg = rtl92s_phy_query_bb_reg, - .set_bbreg = rtl92s_phy_set_bb_reg, - .get_rfreg = rtl92s_phy_query_rf_reg, - .set_rfreg = rtl92s_phy_set_rf_reg, -}; - -static struct rtl_mod_params rtl92se_mod_params = { - .sw_crypto = false, - .inactiveps = true, - .swctrl_lps = true, - .fwctrl_lps = false, - .debug = DBG_EMERG, -}; - -/* Because memory R/W bursting will cause system hang/crash - * for 92se, so we don't read back after every write action */ -static struct rtl_hal_cfg rtl92se_hal_cfg = { - .bar_id = 1, - .write_readback = false, - .name = "rtl92s_pci", - .fw_name = "rtlwifi/rtl8192sefw.bin", - .ops = &rtl8192se_hal_ops, - .mod_params = &rtl92se_mod_params, - - .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, - .maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN, - .maps[SYS_CLK] = SYS_CLKR, - .maps[MAC_RCR_AM] = RCR_AM, - .maps[MAC_RCR_AB] = RCR_AB, - .maps[MAC_RCR_ACRC32] = RCR_ACRC32, - .maps[MAC_RCR_ACF] = RCR_ACF, - .maps[MAC_RCR_AAP] = RCR_AAP, - - .maps[EFUSE_TEST] = REG_EFUSE_TEST, - .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, - .maps[EFUSE_CLK] = REG_EFUSE_CLK, - .maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL, - .maps[EFUSE_PWC_EV12V] = 0, /* nouse for 8192se */ - .maps[EFUSE_FEN_ELDR] = 0, /* nouse for 8192se */ - .maps[EFUSE_LOADER_CLK_EN] = 0,/* nouse for 8192se */ - .maps[EFUSE_ANA8M] = EFUSE_ANA8M, - .maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE_92S, - .maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION, - .maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN, - .maps[EFUSE_OOB_PROTECT_BYTES_LEN] = EFUSE_OOB_PROTECT_BYTES, - - .maps[RWCAM] = REG_RWCAM, - .maps[WCAMI] = REG_WCAMI, - .maps[RCAMO] = REG_RCAMO, - .maps[CAMDBG] = REG_CAMDBG, - .maps[SECR] = REG_SECR, - .maps[SEC_CAM_NONE] = CAM_NONE, - .maps[SEC_CAM_WEP40] = CAM_WEP40, - .maps[SEC_CAM_TKIP] = CAM_TKIP, - .maps[SEC_CAM_AES] = CAM_AES, - .maps[SEC_CAM_WEP104] = CAM_WEP104, - - .maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6, - .maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5, - .maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4, - .maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3, - .maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2, - .maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1, - .maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8, - .maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7, - .maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6, - .maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5, - .maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4, - .maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3, - .maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2, - .maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1, - .maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2, - .maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1, - - .maps[RTL_IMR_TXFOVW] = IMR_TXFOVW, - .maps[RTL_IMR_PSTIMEOUT] = IMR_PSTIMEOUT, - .maps[RTL_IMR_BCNINT] = IMR_BCNINT, - .maps[RTL_IMR_RXFOVW] = IMR_RXFOVW, - .maps[RTL_IMR_RDU] = IMR_RDU, - .maps[RTL_IMR_ATIMEND] = IMR_ATIMEND, - .maps[RTL_IMR_BDOK] = IMR_BDOK, - .maps[RTL_IMR_MGNTDOK] = IMR_MGNTDOK, - .maps[RTL_IMR_TBDER] = IMR_TBDER, - .maps[RTL_IMR_HIGHDOK] = IMR_HIGHDOK, - .maps[RTL_IMR_COMDOK] = IMR_COMDOK, - .maps[RTL_IMR_TBDOK] = IMR_TBDOK, - .maps[RTL_IMR_BKDOK] = IMR_BKDOK, - .maps[RTL_IMR_BEDOK] = IMR_BEDOK, - .maps[RTL_IMR_VIDOK] = IMR_VIDOK, - .maps[RTL_IMR_VODOK] = IMR_VODOK, - .maps[RTL_IMR_ROK] = IMR_ROK, - .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNINT | IMR_TBDOK | IMR_TBDER), - - .maps[RTL_RC_CCK_RATE1M] = DESC92_RATE1M, - .maps[RTL_RC_CCK_RATE2M] = DESC92_RATE2M, - .maps[RTL_RC_CCK_RATE5_5M] = DESC92_RATE5_5M, - .maps[RTL_RC_CCK_RATE11M] = DESC92_RATE11M, - .maps[RTL_RC_OFDM_RATE6M] = DESC92_RATE6M, - .maps[RTL_RC_OFDM_RATE9M] = DESC92_RATE9M, - .maps[RTL_RC_OFDM_RATE12M] = DESC92_RATE12M, - .maps[RTL_RC_OFDM_RATE18M] = DESC92_RATE18M, - .maps[RTL_RC_OFDM_RATE24M] = DESC92_RATE24M, - .maps[RTL_RC_OFDM_RATE36M] = DESC92_RATE36M, - .maps[RTL_RC_OFDM_RATE48M] = DESC92_RATE48M, - .maps[RTL_RC_OFDM_RATE54M] = DESC92_RATE54M, - - .maps[RTL_RC_HT_RATEMCS7] = DESC92_RATEMCS7, - .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, -}; - -static struct pci_device_id rtl92se_pci_ids[] = { - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8192, rtl92se_hal_cfg)}, - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8171, rtl92se_hal_cfg)}, - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8172, rtl92se_hal_cfg)}, - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8173, rtl92se_hal_cfg)}, - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8174, rtl92se_hal_cfg)}, - {}, -}; - -MODULE_DEVICE_TABLE(pci, rtl92se_pci_ids); - -MODULE_AUTHOR("lizhaoming "); -MODULE_AUTHOR("Realtek WlanFAE "); -MODULE_AUTHOR("Larry Finger "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Realtek 8192S/8191S 802.11n PCI wireless"); -MODULE_FIRMWARE("rtlwifi/rtl8192sefw.bin"); - -module_param_named(swenc, rtl92se_mod_params.sw_crypto, bool, 0444); -module_param_named(debug, rtl92se_mod_params.debug, int, 0444); -module_param_named(ips, rtl92se_mod_params.inactiveps, bool, 0444); -module_param_named(swlps, rtl92se_mod_params.swctrl_lps, bool, 0444); -module_param_named(fwlps, rtl92se_mod_params.fwctrl_lps, bool, 0444); -MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); -MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); -MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); -MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); -MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); - -static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); - -static struct pci_driver rtl92se_driver = { - .name = KBUILD_MODNAME, - .id_table = rtl92se_pci_ids, - .probe = rtl_pci_probe, - .remove = rtl_pci_disconnect, - .driver.pm = &rtlwifi_pm_ops, -}; - -module_pci_driver(rtl92se_driver); diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.h b/drivers/net/wireless/rtlwifi/rtl8192se/sw.h deleted file mode 100644 index 2eb88862ebe4..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.h +++ /dev/null @@ -1,36 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - *****************************************************************************/ -#ifndef __REALTEK_PCI92SE_SW_H__ -#define __REALTEK_PCI92SE_SW_H__ - -#define EFUSE_MAX_SECTION 16 - -int rtl92se_init_sw(struct ieee80211_hw *hw); -void rtl92se_deinit_sw(struct ieee80211_hw *hw); -void rtl92se_init_var_map(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/table.c b/drivers/net/wireless/rtlwifi/rtl8192se/table.c deleted file mode 100644 index f1a73f75127e..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/table.c +++ /dev/null @@ -1,634 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - * Created on 2010/ 5/18, 1:41 - *****************************************************************************/ - -#include "table.h" - -u32 rtl8192sephy_reg_2t2rarray[PHY_REG_2T2RARRAYLENGTH] = { - 0x01c, 0x07000000, - 0x800, 0x00040000, - 0x804, 0x00008003, - 0x808, 0x0000fc00, - 0x80c, 0x0000000a, - 0x810, 0x10005088, - 0x814, 0x020c3d10, - 0x818, 0x00200185, - 0x81c, 0x00000000, - 0x820, 0x01000000, - 0x824, 0x00390004, - 0x828, 0x01000000, - 0x82c, 0x00390004, - 0x830, 0x00000004, - 0x834, 0x00690200, - 0x838, 0x00000004, - 0x83c, 0x00690200, - 0x840, 0x00010000, - 0x844, 0x00010000, - 0x848, 0x00000000, - 0x84c, 0x00000000, - 0x850, 0x00000000, - 0x854, 0x00000000, - 0x858, 0x48484848, - 0x85c, 0x65a965a9, - 0x860, 0x0f7f0130, - 0x864, 0x0f7f0130, - 0x868, 0x0f7f0130, - 0x86c, 0x0f7f0130, - 0x870, 0x03000700, - 0x874, 0x03000300, - 0x878, 0x00020002, - 0x87c, 0x004f0201, - 0x880, 0xa8300ac1, - 0x884, 0x00000058, - 0x888, 0x00000008, - 0x88c, 0x00000004, - 0x890, 0x00000000, - 0x894, 0xfffffffe, - 0x898, 0x40302010, - 0x89c, 0x00706050, - 0x8b0, 0x00000000, - 0x8e0, 0x00000000, - 0x8e4, 0x00000000, - 0xe00, 0x30333333, - 0xe04, 0x2a2d2e2f, - 0xe08, 0x00003232, - 0xe10, 0x30333333, - 0xe14, 0x2a2d2e2f, - 0xe18, 0x30333333, - 0xe1c, 0x2a2d2e2f, - 0xe30, 0x01007c00, - 0xe34, 0x01004800, - 0xe38, 0x1000dc1f, - 0xe3c, 0x10008c1f, - 0xe40, 0x021400a0, - 0xe44, 0x281600a0, - 0xe48, 0xf8000001, - 0xe4c, 0x00002910, - 0xe50, 0x01007c00, - 0xe54, 0x01004800, - 0xe58, 0x1000dc1f, - 0xe5c, 0x10008c1f, - 0xe60, 0x021400a0, - 0xe64, 0x281600a0, - 0xe6c, 0x00002910, - 0xe70, 0x31ed92fb, - 0xe74, 0x361536fb, - 0xe78, 0x361536fb, - 0xe7c, 0x361536fb, - 0xe80, 0x361536fb, - 0xe84, 0x000d92fb, - 0xe88, 0x000d92fb, - 0xe8c, 0x31ed92fb, - 0xed0, 0x31ed92fb, - 0xed4, 0x31ed92fb, - 0xed8, 0x000d92fb, - 0xedc, 0x000d92fb, - 0xee0, 0x000d92fb, - 0xee4, 0x015e5448, - 0xee8, 0x21555448, - 0x900, 0x00000000, - 0x904, 0x00000023, - 0x908, 0x00000000, - 0x90c, 0x01121313, - 0xa00, 0x00d047c8, - 0xa04, 0x80ff0008, - 0xa08, 0x8ccd8300, - 0xa0c, 0x2e62120f, - 0xa10, 0x9500bb78, - 0xa14, 0x11144028, - 0xa18, 0x00881117, - 0xa1c, 0x89140f00, - 0xa20, 0x1a1b0000, - 0xa24, 0x090e1317, - 0xa28, 0x00000204, - 0xa2c, 0x10d30000, - 0xc00, 0x40071d40, - 0xc04, 0x00a05633, - 0xc08, 0x000000e4, - 0xc0c, 0x6c6c6c6c, - 0xc10, 0x08800000, - 0xc14, 0x40000100, - 0xc18, 0x08000000, - 0xc1c, 0x40000100, - 0xc20, 0x08000000, - 0xc24, 0x40000100, - 0xc28, 0x08000000, - 0xc2c, 0x40000100, - 0xc30, 0x6de9ac44, - 0xc34, 0x469652cf, - 0xc38, 0x49795994, - 0xc3c, 0x0a979764, - 0xc40, 0x1f7c403f, - 0xc44, 0x000100b7, - 0xc48, 0xec020000, - 0xc4c, 0x007f037f, - 0xc50, 0x69543420, - 0xc54, 0x433c0094, - 0xc58, 0x69543420, - 0xc5c, 0x433c0094, - 0xc60, 0x69543420, - 0xc64, 0x433c0094, - 0xc68, 0x69543420, - 0xc6c, 0x433c0094, - 0xc70, 0x2c7f000d, - 0xc74, 0x0186155b, - 0xc78, 0x0000001f, - 0xc7c, 0x00b91612, - 0xc80, 0x40000100, - 0xc84, 0x20f60000, - 0xc88, 0x20000080, - 0xc8c, 0x20200000, - 0xc90, 0x40000100, - 0xc94, 0x00000000, - 0xc98, 0x40000100, - 0xc9c, 0x00000000, - 0xca0, 0x00492492, - 0xca4, 0x00000000, - 0xca8, 0x00000000, - 0xcac, 0x00000000, - 0xcb0, 0x00000000, - 0xcb4, 0x00000000, - 0xcb8, 0x00000000, - 0xcbc, 0x28000000, - 0xcc0, 0x00000000, - 0xcc4, 0x00000000, - 0xcc8, 0x00000000, - 0xccc, 0x00000000, - 0xcd0, 0x00000000, - 0xcd4, 0x00000000, - 0xcd8, 0x64b22427, - 0xcdc, 0x00766932, - 0xce0, 0x00222222, - 0xce4, 0x00000000, - 0xce8, 0x37644302, - 0xcec, 0x2f97d40c, - 0xd00, 0x00000750, - 0xd04, 0x00000403, - 0xd08, 0x0000907f, - 0xd0c, 0x00000001, - 0xd10, 0xa0633333, - 0xd14, 0x33333c63, - 0xd18, 0x6a8f5b6b, - 0xd1c, 0x00000000, - 0xd20, 0x00000000, - 0xd24, 0x00000000, - 0xd28, 0x00000000, - 0xd2c, 0xcc979975, - 0xd30, 0x00000000, - 0xd34, 0x00000000, - 0xd38, 0x00000000, - 0xd3c, 0x00027293, - 0xd40, 0x00000000, - 0xd44, 0x00000000, - 0xd48, 0x00000000, - 0xd50, 0x6437140a, - 0xd54, 0x024dbd02, - 0xd58, 0x00000000, - 0xd5c, 0x30032064, - 0xd60, 0x4653de68, - 0xd64, 0x00518a3c, - 0xd68, 0x00002101, - 0xf14, 0x00000003, - 0xf4c, 0x00000000, - 0xf00, 0x00000300, -}; - -u32 rtl8192sephy_changeto_1t1rarray[PHY_CHANGETO_1T1RARRAYLENGTH] = { - 0x844, 0xffffffff, 0x00010000, - 0x804, 0x0000000f, 0x00000001, - 0x824, 0x00f0000f, 0x00300004, - 0x82c, 0x00f0000f, 0x00100002, - 0x870, 0x04000000, 0x00000001, - 0x864, 0x00000400, 0x00000000, - 0x878, 0x000f000f, 0x00000002, - 0xe74, 0x0f000000, 0x00000002, - 0xe78, 0x0f000000, 0x00000002, - 0xe7c, 0x0f000000, 0x00000002, - 0xe80, 0x0f000000, 0x00000002, - 0x90c, 0x000000ff, 0x00000011, - 0xc04, 0x000000ff, 0x00000011, - 0xd04, 0x0000000f, 0x00000001, - 0x1f4, 0xffff0000, 0x00007777, - 0x234, 0xf8000000, 0x0000000a, -}; - -u32 rtl8192sephy_changeto_1t2rarray[PHY_CHANGETO_1T2RARRAYLENGTH] = { - 0x804, 0x0000000f, 0x00000003, - 0x824, 0x00f0000f, 0x00300004, - 0x82c, 0x00f0000f, 0x00300002, - 0x870, 0x04000000, 0x00000001, - 0x864, 0x00000400, 0x00000000, - 0x878, 0x000f000f, 0x00000002, - 0xe74, 0x0f000000, 0x00000002, - 0xe78, 0x0f000000, 0x00000002, - 0xe7c, 0x0f000000, 0x00000002, - 0xe80, 0x0f000000, 0x00000002, - 0x90c, 0x000000ff, 0x00000011, - 0xc04, 0x000000ff, 0x00000033, - 0xd04, 0x0000000f, 0x00000003, - 0x1f4, 0xffff0000, 0x00007777, - 0x234, 0xf8000000, 0x0000000a, -}; - -u32 rtl8192sephy_reg_array_pg[PHY_REG_ARRAY_PGLENGTH] = { - 0xe00, 0xffffffff, 0x06090909, - 0xe04, 0xffffffff, 0x00030406, - 0xe08, 0x0000ff00, 0x00000000, - 0xe10, 0xffffffff, 0x0a0c0d0e, - 0xe14, 0xffffffff, 0x04070809, - 0xe18, 0xffffffff, 0x0a0c0d0e, - 0xe1c, 0xffffffff, 0x04070809, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0xe10, 0xffffffff, 0x02040404, - 0xe14, 0xffffffff, 0x00000002, - 0xe18, 0xffffffff, 0x02040404, - 0xe1c, 0xffffffff, 0x00000002, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0xe10, 0xffffffff, 0x02040404, - 0xe14, 0xffffffff, 0x00000002, - 0xe18, 0xffffffff, 0x02040404, - 0xe1c, 0xffffffff, 0x00000002, - 0xe00, 0xffffffff, 0x02020202, - 0xe04, 0xffffffff, 0x00020202, - 0xe08, 0x0000ff00, 0x00000000, - 0xe10, 0xffffffff, 0x02020202, - 0xe14, 0xffffffff, 0x00000002, - 0xe18, 0xffffffff, 0x02020202, - 0xe1c, 0xffffffff, 0x00000002, -}; - -u32 rtl8192seradioa_1t_array[RADIOA_1T_ARRAYLENGTH] = { - 0x000, 0x00030159, - 0x001, 0x00030250, - 0x002, 0x00010000, - 0x010, 0x0008000f, - 0x011, 0x000231fc, - 0x010, 0x000c000f, - 0x011, 0x0003f9f8, - 0x010, 0x0002000f, - 0x011, 0x00020101, - 0x014, 0x0001093e, - 0x014, 0x0009093e, - 0x015, 0x0000f8f4, - 0x017, 0x000f6500, - 0x01a, 0x00013056, - 0x01b, 0x00060000, - 0x01c, 0x00000300, - 0x01e, 0x00031059, - 0x021, 0x00054000, - 0x022, 0x0000083c, - 0x023, 0x00001558, - 0x024, 0x00000060, - 0x025, 0x00022583, - 0x026, 0x0000f200, - 0x027, 0x000eacf1, - 0x028, 0x0009bd54, - 0x029, 0x00004582, - 0x02a, 0x00000001, - 0x02b, 0x00021334, - 0x02a, 0x00000000, - 0x02b, 0x0000000a, - 0x02a, 0x00000001, - 0x02b, 0x00000808, - 0x02b, 0x00053333, - 0x02c, 0x0000000c, - 0x02a, 0x00000002, - 0x02b, 0x00000808, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000003, - 0x02b, 0x00000808, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x00000004, - 0x02b, 0x00000808, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000005, - 0x02b, 0x00000709, - 0x02b, 0x00053333, - 0x02c, 0x0000000d, - 0x02a, 0x00000006, - 0x02b, 0x00000709, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000007, - 0x02b, 0x00000709, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x00000008, - 0x02b, 0x00000709, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000009, - 0x02b, 0x0000060a, - 0x02b, 0x00053333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000a, - 0x02b, 0x0000060a, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000b, - 0x02b, 0x0000060a, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000c, - 0x02b, 0x0000060a, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000d, - 0x02b, 0x0000050b, - 0x02b, 0x00053333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000e, - 0x02b, 0x0000050b, - 0x02b, 0x00066623, - 0x02c, 0x0000001a, - 0x02a, 0x000e4000, - 0x030, 0x00020000, - 0x031, 0x000b9631, - 0x032, 0x0000130d, - 0x033, 0x00000187, - 0x013, 0x00019e6c, - 0x013, 0x00015e94, - 0x000, 0x00010159, - 0x018, 0x0000f401, - 0x0fe, 0x00000000, - 0x01e, 0x0003105b, - 0x0fe, 0x00000000, - 0x000, 0x00030159, - 0x010, 0x0004000f, - 0x011, 0x000203f9, -}; - -u32 rtl8192seradiob_array[RADIOB_ARRAYLENGTH] = { - 0x000, 0x00030159, - 0x001, 0x00001041, - 0x002, 0x00011000, - 0x005, 0x00080fc0, - 0x007, 0x000fc803, - 0x013, 0x00017cb0, - 0x013, 0x00011cc0, - 0x013, 0x0000dc60, - 0x013, 0x00008c60, - 0x013, 0x00004450, - 0x013, 0x00000020, -}; - -u32 rtl8192seradiob_gm_array[RADIOB_GM_ARRAYLENGTH] = { - 0x000, 0x00030159, - 0x001, 0x00001041, - 0x002, 0x00011000, - 0x005, 0x00080fc0, - 0x007, 0x000fc803, -}; - -u32 rtl8192semac_2t_array[MAC_2T_ARRAYLENGTH] = { - 0x020, 0x00000035, - 0x048, 0x0000000e, - 0x049, 0x000000f0, - 0x04a, 0x00000077, - 0x04b, 0x00000083, - 0x0b5, 0x00000021, - 0x0dc, 0x000000ff, - 0x0dd, 0x000000ff, - 0x0de, 0x000000ff, - 0x0df, 0x000000ff, - 0x116, 0x00000000, - 0x117, 0x00000000, - 0x118, 0x00000000, - 0x119, 0x00000000, - 0x11a, 0x00000000, - 0x11b, 0x00000000, - 0x11c, 0x00000000, - 0x11d, 0x00000000, - 0x160, 0x0000000b, - 0x161, 0x0000000b, - 0x162, 0x0000000b, - 0x163, 0x0000000b, - 0x164, 0x0000000b, - 0x165, 0x0000000b, - 0x166, 0x0000000b, - 0x167, 0x0000000b, - 0x168, 0x0000000b, - 0x169, 0x0000000b, - 0x16a, 0x0000000b, - 0x16b, 0x0000000b, - 0x16c, 0x0000000b, - 0x16d, 0x0000000b, - 0x16e, 0x0000000b, - 0x16f, 0x0000000b, - 0x170, 0x0000000b, - 0x171, 0x0000000b, - 0x172, 0x0000000b, - 0x173, 0x0000000b, - 0x174, 0x0000000b, - 0x175, 0x0000000b, - 0x176, 0x0000000b, - 0x177, 0x0000000b, - 0x178, 0x0000000b, - 0x179, 0x0000000b, - 0x17a, 0x0000000b, - 0x17b, 0x0000000b, - 0x17c, 0x0000000b, - 0x17d, 0x0000000b, - 0x17e, 0x0000000b, - 0x17f, 0x0000000b, - 0x236, 0x0000000c, - 0x503, 0x00000022, - 0x560, 0x00000000, -}; - -u32 rtl8192seagctab_array[AGCTAB_ARRAYLENGTH] = { - 0xc78, 0x7f000001, - 0xc78, 0x7f010001, - 0xc78, 0x7e020001, - 0xc78, 0x7d030001, - 0xc78, 0x7c040001, - 0xc78, 0x7b050001, - 0xc78, 0x7a060001, - 0xc78, 0x79070001, - 0xc78, 0x78080001, - 0xc78, 0x77090001, - 0xc78, 0x760a0001, - 0xc78, 0x750b0001, - 0xc78, 0x740c0001, - 0xc78, 0x730d0001, - 0xc78, 0x720e0001, - 0xc78, 0x710f0001, - 0xc78, 0x70100001, - 0xc78, 0x6f110001, - 0xc78, 0x6f120001, - 0xc78, 0x6e130001, - 0xc78, 0x6d140001, - 0xc78, 0x6d150001, - 0xc78, 0x6c160001, - 0xc78, 0x6b170001, - 0xc78, 0x6a180001, - 0xc78, 0x6a190001, - 0xc78, 0x691a0001, - 0xc78, 0x681b0001, - 0xc78, 0x671c0001, - 0xc78, 0x661d0001, - 0xc78, 0x651e0001, - 0xc78, 0x641f0001, - 0xc78, 0x63200001, - 0xc78, 0x4c210001, - 0xc78, 0x4b220001, - 0xc78, 0x4a230001, - 0xc78, 0x49240001, - 0xc78, 0x48250001, - 0xc78, 0x47260001, - 0xc78, 0x46270001, - 0xc78, 0x45280001, - 0xc78, 0x44290001, - 0xc78, 0x2c2a0001, - 0xc78, 0x2b2b0001, - 0xc78, 0x2a2c0001, - 0xc78, 0x292d0001, - 0xc78, 0x282e0001, - 0xc78, 0x272f0001, - 0xc78, 0x26300001, - 0xc78, 0x25310001, - 0xc78, 0x24320001, - 0xc78, 0x23330001, - 0xc78, 0x22340001, - 0xc78, 0x09350001, - 0xc78, 0x08360001, - 0xc78, 0x07370001, - 0xc78, 0x06380001, - 0xc78, 0x05390001, - 0xc78, 0x043a0001, - 0xc78, 0x033b0001, - 0xc78, 0x023c0001, - 0xc78, 0x013d0001, - 0xc78, 0x003e0001, - 0xc78, 0x003f0001, - 0xc78, 0x7f400001, - 0xc78, 0x7f410001, - 0xc78, 0x7e420001, - 0xc78, 0x7d430001, - 0xc78, 0x7c440001, - 0xc78, 0x7b450001, - 0xc78, 0x7a460001, - 0xc78, 0x79470001, - 0xc78, 0x78480001, - 0xc78, 0x77490001, - 0xc78, 0x764a0001, - 0xc78, 0x754b0001, - 0xc78, 0x744c0001, - 0xc78, 0x734d0001, - 0xc78, 0x724e0001, - 0xc78, 0x714f0001, - 0xc78, 0x70500001, - 0xc78, 0x6f510001, - 0xc78, 0x6f520001, - 0xc78, 0x6e530001, - 0xc78, 0x6d540001, - 0xc78, 0x6d550001, - 0xc78, 0x6c560001, - 0xc78, 0x6b570001, - 0xc78, 0x6a580001, - 0xc78, 0x6a590001, - 0xc78, 0x695a0001, - 0xc78, 0x685b0001, - 0xc78, 0x675c0001, - 0xc78, 0x665d0001, - 0xc78, 0x655e0001, - 0xc78, 0x645f0001, - 0xc78, 0x63600001, - 0xc78, 0x4c610001, - 0xc78, 0x4b620001, - 0xc78, 0x4a630001, - 0xc78, 0x49640001, - 0xc78, 0x48650001, - 0xc78, 0x47660001, - 0xc78, 0x46670001, - 0xc78, 0x45680001, - 0xc78, 0x44690001, - 0xc78, 0x2c6a0001, - 0xc78, 0x2b6b0001, - 0xc78, 0x2a6c0001, - 0xc78, 0x296d0001, - 0xc78, 0x286e0001, - 0xc78, 0x276f0001, - 0xc78, 0x26700001, - 0xc78, 0x25710001, - 0xc78, 0x24720001, - 0xc78, 0x23730001, - 0xc78, 0x22740001, - 0xc78, 0x09750001, - 0xc78, 0x08760001, - 0xc78, 0x07770001, - 0xc78, 0x06780001, - 0xc78, 0x05790001, - 0xc78, 0x047a0001, - 0xc78, 0x037b0001, - 0xc78, 0x027c0001, - 0xc78, 0x017d0001, - 0xc78, 0x007e0001, - 0xc78, 0x007f0001, - 0xc78, 0x3000001e, - 0xc78, 0x3001001e, - 0xc78, 0x3002001e, - 0xc78, 0x3003001e, - 0xc78, 0x3004001e, - 0xc78, 0x3405001e, - 0xc78, 0x3806001e, - 0xc78, 0x3e07001e, - 0xc78, 0x3e08001e, - 0xc78, 0x4409001e, - 0xc78, 0x460a001e, - 0xc78, 0x480b001e, - 0xc78, 0x480c001e, - 0xc78, 0x4e0d001e, - 0xc78, 0x560e001e, - 0xc78, 0x5a0f001e, - 0xc78, 0x5e10001e, - 0xc78, 0x6211001e, - 0xc78, 0x6c12001e, - 0xc78, 0x7213001e, - 0xc78, 0x7214001e, - 0xc78, 0x7215001e, - 0xc78, 0x7216001e, - 0xc78, 0x7217001e, - 0xc78, 0x7218001e, - 0xc78, 0x7219001e, - 0xc78, 0x721a001e, - 0xc78, 0x721b001e, - 0xc78, 0x721c001e, - 0xc78, 0x721d001e, - 0xc78, 0x721e001e, - 0xc78, 0x721f001e, -}; - diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/table.h b/drivers/net/wireless/rtlwifi/rtl8192se/table.h deleted file mode 100644 index 2feb73b71a4f..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/table.h +++ /dev/null @@ -1,49 +0,0 @@ -/****************************************************************************** - * Copyright(c) 2008 - 2012 Realtek Corporation. All rights reserved. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * - * Larry Finger - * - ******************************************************************************/ -#ifndef __INC_HAL8192SE_FW_IMG_H -#define __INC_HAL8192SE_FW_IMG_H - -#include - -/*Created on 2010/ 4/12, 5:56*/ - -#define PHY_REG_2T2RARRAYLENGTH 372 -extern u32 rtl8192sephy_reg_2t2rarray[PHY_REG_2T2RARRAYLENGTH]; -#define PHY_CHANGETO_1T1RARRAYLENGTH 48 -extern u32 rtl8192sephy_changeto_1t1rarray[PHY_CHANGETO_1T1RARRAYLENGTH]; -#define PHY_CHANGETO_1T2RARRAYLENGTH 45 -extern u32 rtl8192sephy_changeto_1t2rarray[PHY_CHANGETO_1T2RARRAYLENGTH]; -#define PHY_REG_ARRAY_PGLENGTH 84 -extern u32 rtl8192sephy_reg_array_pg[PHY_REG_ARRAY_PGLENGTH]; -#define RADIOA_1T_ARRAYLENGTH 202 -extern u32 rtl8192seradioa_1t_array[RADIOA_1T_ARRAYLENGTH]; -#define RADIOB_ARRAYLENGTH 22 -extern u32 rtl8192seradiob_array[RADIOB_ARRAYLENGTH]; -#define RADIOB_GM_ARRAYLENGTH 10 -extern u32 rtl8192seradiob_gm_array[RADIOB_GM_ARRAYLENGTH]; -#define MAC_2T_ARRAYLENGTH 106 -extern u32 rtl8192semac_2t_array[MAC_2T_ARRAYLENGTH]; -#define AGCTAB_ARRAYLENGTH 320 -extern u32 rtl8192seagctab_array[AGCTAB_ARRAYLENGTH]; - -#endif - diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c deleted file mode 100644 index 7d0f2e20f1a2..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c +++ /dev/null @@ -1,654 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../base.h" -#include "../stats.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "fw.h" -#include "trx.h" -#include "led.h" - -static u8 _rtl92se_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 skb_queue) -{ - __le16 fc = rtl_get_fc(skb); - - if (unlikely(ieee80211_is_beacon(fc))) - return QSLT_BEACON; - if (ieee80211_is_mgmt(fc) || ieee80211_is_ctl(fc)) - return QSLT_MGNT; - if (ieee80211_is_nullfunc(fc)) - return QSLT_HIGH; - - return skb->priority; -} - -static void _rtl92se_query_rxphystatus(struct ieee80211_hw *hw, - struct rtl_stats *pstats, u8 *pdesc, - struct rx_fwinfo *p_drvinfo, - bool packet_match_bssid, - bool packet_toself, - bool packet_beacon) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct phy_sts_cck_8192s_t *cck_buf; - struct rtl_ps_ctl *ppsc = rtl_psc(rtlpriv); - s8 rx_pwr_all = 0, rx_pwr[4]; - u8 rf_rx_num = 0, evm, pwdb_all; - u8 i, max_spatial_stream; - u32 rssi, total_rssi = 0; - bool is_cck = pstats->is_cck; - - pstats->packet_matchbssid = packet_match_bssid; - pstats->packet_toself = packet_toself; - pstats->packet_beacon = packet_beacon; - pstats->rx_mimo_sig_qual[0] = -1; - pstats->rx_mimo_sig_qual[1] = -1; - - if (is_cck) { - u8 report, cck_highpwr; - cck_buf = (struct phy_sts_cck_8192s_t *)p_drvinfo; - - if (ppsc->rfpwr_state == ERFON) - cck_highpwr = (u8) rtl_get_bbreg(hw, - RFPGA0_XA_HSSIPARAMETER2, - 0x200); - else - cck_highpwr = false; - - if (!cck_highpwr) { - u8 cck_agc_rpt = cck_buf->cck_agc_rpt; - report = cck_buf->cck_agc_rpt & 0xc0; - report = report >> 6; - switch (report) { - case 0x3: - rx_pwr_all = -40 - (cck_agc_rpt & 0x3e); - break; - case 0x2: - rx_pwr_all = -20 - (cck_agc_rpt & 0x3e); - break; - case 0x1: - rx_pwr_all = -2 - (cck_agc_rpt & 0x3e); - break; - case 0x0: - rx_pwr_all = 14 - (cck_agc_rpt & 0x3e); - break; - } - } else { - u8 cck_agc_rpt = cck_buf->cck_agc_rpt; - report = p_drvinfo->cfosho[0] & 0x60; - report = report >> 5; - switch (report) { - case 0x3: - rx_pwr_all = -40 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x2: - rx_pwr_all = -20 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x1: - rx_pwr_all = -2 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x0: - rx_pwr_all = 14 - ((cck_agc_rpt & 0x1f) << 1); - break; - } - } - - pwdb_all = rtl_query_rxpwrpercentage(rx_pwr_all); - - /* CCK gain is smaller than OFDM/MCS gain, */ - /* so we add gain diff by experiences, the val is 6 */ - pwdb_all += 6; - if (pwdb_all > 100) - pwdb_all = 100; - /* modify the offset to make the same gain index with OFDM. */ - if (pwdb_all > 34 && pwdb_all <= 42) - pwdb_all -= 2; - else if (pwdb_all > 26 && pwdb_all <= 34) - pwdb_all -= 6; - else if (pwdb_all > 14 && pwdb_all <= 26) - pwdb_all -= 8; - else if (pwdb_all > 4 && pwdb_all <= 14) - pwdb_all -= 4; - - pstats->rx_pwdb_all = pwdb_all; - pstats->recvsignalpower = rx_pwr_all; - - if (packet_match_bssid) { - u8 sq; - if (pstats->rx_pwdb_all > 40) { - sq = 100; - } else { - sq = cck_buf->sq_rpt; - if (sq > 64) - sq = 0; - else if (sq < 20) - sq = 100; - else - sq = ((64 - sq) * 100) / 44; - } - - pstats->signalquality = sq; - pstats->rx_mimo_sig_qual[0] = sq; - pstats->rx_mimo_sig_qual[1] = -1; - } - } else { - rtlpriv->dm.rfpath_rxenable[0] = - rtlpriv->dm.rfpath_rxenable[1] = true; - for (i = RF90_PATH_A; i < RF6052_MAX_PATH; i++) { - if (rtlpriv->dm.rfpath_rxenable[i]) - rf_rx_num++; - - rx_pwr[i] = ((p_drvinfo->gain_trsw[i] & - 0x3f) * 2) - 110; - rssi = rtl_query_rxpwrpercentage(rx_pwr[i]); - total_rssi += rssi; - rtlpriv->stats.rx_snr_db[i] = - (long)(p_drvinfo->rxsnr[i] / 2); - - if (packet_match_bssid) - pstats->rx_mimo_signalstrength[i] = (u8) rssi; - } - - rx_pwr_all = ((p_drvinfo->pwdb_all >> 1) & 0x7f) - 110; - pwdb_all = rtl_query_rxpwrpercentage(rx_pwr_all); - pstats->rx_pwdb_all = pwdb_all; - pstats->rxpower = rx_pwr_all; - pstats->recvsignalpower = rx_pwr_all; - - if (pstats->is_ht && pstats->rate >= DESC92_RATEMCS8 && - pstats->rate <= DESC92_RATEMCS15) - max_spatial_stream = 2; - else - max_spatial_stream = 1; - - for (i = 0; i < max_spatial_stream; i++) { - evm = rtl_evm_db_to_percentage(p_drvinfo->rxevm[i]); - - if (packet_match_bssid) { - if (i == 0) - pstats->signalquality = (u8)(evm & - 0xff); - pstats->rx_mimo_sig_qual[i] = (u8) (evm & 0xff); - } - } - } - - if (is_cck) - pstats->signalstrength = (u8)(rtl_signal_scale_mapping(hw, - pwdb_all)); - else if (rf_rx_num != 0) - pstats->signalstrength = (u8) (rtl_signal_scale_mapping(hw, - total_rssi /= rf_rx_num)); -} - -static void _rtl92se_translate_rx_signal_stuff(struct ieee80211_hw *hw, - struct sk_buff *skb, struct rtl_stats *pstats, - u8 *pdesc, struct rx_fwinfo *p_drvinfo) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - - struct ieee80211_hdr *hdr; - u8 *tmp_buf; - u8 *praddr; - __le16 fc; - u16 type, cfc; - bool packet_matchbssid, packet_toself, packet_beacon = false; - - tmp_buf = skb->data + pstats->rx_drvinfo_size + pstats->rx_bufshift; - - hdr = (struct ieee80211_hdr *)tmp_buf; - fc = hdr->frame_control; - cfc = le16_to_cpu(fc); - type = WLAN_FC_GET_TYPE(fc); - praddr = hdr->addr1; - - packet_matchbssid = ((IEEE80211_FTYPE_CTL != type) && - ether_addr_equal(mac->bssid, - (cfc & IEEE80211_FCTL_TODS) ? hdr->addr1 : - (cfc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : - hdr->addr3) && - (!pstats->hwerror) && (!pstats->crc) && (!pstats->icv)); - - packet_toself = packet_matchbssid && - ether_addr_equal(praddr, rtlefuse->dev_addr); - - if (ieee80211_is_beacon(fc)) - packet_beacon = true; - - _rtl92se_query_rxphystatus(hw, pstats, pdesc, p_drvinfo, - packet_matchbssid, packet_toself, packet_beacon); - rtl_process_phyinfo(hw, tmp_buf, pstats); -} - -bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, - struct ieee80211_rx_status *rx_status, u8 *pdesc, - struct sk_buff *skb) -{ - struct rx_fwinfo *p_drvinfo; - u32 phystatus = (u32)GET_RX_STATUS_DESC_PHY_STATUS(pdesc); - struct ieee80211_hdr *hdr; - bool first_ampdu = false; - - stats->length = (u16)GET_RX_STATUS_DESC_PKT_LEN(pdesc); - stats->rx_drvinfo_size = (u8)GET_RX_STATUS_DESC_DRVINFO_SIZE(pdesc) * 8; - stats->rx_bufshift = (u8)(GET_RX_STATUS_DESC_SHIFT(pdesc) & 0x03); - stats->icv = (u16)GET_RX_STATUS_DESC_ICV(pdesc); - stats->crc = (u16)GET_RX_STATUS_DESC_CRC32(pdesc); - stats->hwerror = (u16)(stats->crc | stats->icv); - stats->decrypted = !GET_RX_STATUS_DESC_SWDEC(pdesc); - - stats->rate = (u8)GET_RX_STATUS_DESC_RX_MCS(pdesc); - stats->shortpreamble = (u16)GET_RX_STATUS_DESC_SPLCP(pdesc); - stats->isampdu = (bool)(GET_RX_STATUS_DESC_PAGGR(pdesc) == 1); - stats->isfirst_ampdu = (bool) ((GET_RX_STATUS_DESC_PAGGR(pdesc) == 1) - && (GET_RX_STATUS_DESC_FAGGR(pdesc) == 1)); - stats->timestamp_low = GET_RX_STATUS_DESC_TSFL(pdesc); - stats->rx_is40Mhzpacket = (bool)GET_RX_STATUS_DESC_BW(pdesc); - stats->is_ht = (bool)GET_RX_STATUS_DESC_RX_HT(pdesc); - stats->is_cck = SE_RX_HAL_IS_CCK_RATE(pdesc); - - if (stats->hwerror) - return false; - - rx_status->freq = hw->conf.chandef.chan->center_freq; - rx_status->band = hw->conf.chandef.chan->band; - - if (stats->crc) - rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; - - if (stats->rx_is40Mhzpacket) - rx_status->flag |= RX_FLAG_40MHZ; - - if (stats->is_ht) - rx_status->flag |= RX_FLAG_HT; - - rx_status->flag |= RX_FLAG_MACTIME_START; - - /* hw will set stats->decrypted true, if it finds the - * frame is open data frame or mgmt frame, - * hw will not decrypt robust managment frame - * for IEEE80211w but still set stats->decrypted - * true, so here we should set it back to undecrypted - * for IEEE80211w frame, and mac80211 sw will help - * to decrypt it */ - if (stats->decrypted) { - hdr = (struct ieee80211_hdr *)(skb->data + - stats->rx_drvinfo_size + stats->rx_bufshift); - - if (!hdr) { - /* during testing, hdr was NULL here */ - return false; - } - if ((ieee80211_is_robust_mgmt_frame(hdr)) && - (ieee80211_has_protected(hdr->frame_control))) - rx_status->flag &= ~RX_FLAG_DECRYPTED; - else - rx_status->flag |= RX_FLAG_DECRYPTED; - } - - rx_status->rate_idx = rtlwifi_rate_mapping(hw, - stats->is_ht, stats->rate, first_ampdu); - - rx_status->mactime = stats->timestamp_low; - if (phystatus) { - p_drvinfo = (struct rx_fwinfo *)(skb->data + - stats->rx_bufshift); - _rtl92se_translate_rx_signal_stuff(hw, skb, stats, pdesc, - p_drvinfo); - } - - /*rx_status->qual = stats->signal; */ - rx_status->signal = stats->recvsignalpower + 10; - /*rx_status->noise = -stats->noise; */ - - return true; -} - -void rtl92se_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, - u8 hw_queue, struct rtl_tcb_desc *ptcb_desc) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 *pdesc = pdesc_tx; - u16 seq_number; - __le16 fc = hdr->frame_control; - u8 reserved_macid = 0; - u8 fw_qsel = _rtl92se_map_hwqueue_to_fwqueue(skb, hw_queue); - bool firstseg = (!(hdr->seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG))); - bool lastseg = (!(hdr->frame_control & - cpu_to_le16(IEEE80211_FCTL_MOREFRAGS))); - dma_addr_t mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, - PCI_DMA_TODEVICE); - u8 bw_40 = 0; - - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } - if (mac->opmode == NL80211_IFTYPE_STATION) { - bw_40 = mac->bw_40; - } else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) { - if (sta) - bw_40 = sta->bandwidth >= IEEE80211_STA_RX_BW_40; - } - - seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4; - - rtl_get_tcb_desc(hw, info, sta, skb, ptcb_desc); - - CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE_RTL8192S); - - if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) { - firstseg = true; - lastseg = true; - } - - if (firstseg) { - if (rtlpriv->dm.useramask) { - /* set txdesc macId */ - if (ptcb_desc->mac_id < 32) { - SET_TX_DESC_MACID(pdesc, ptcb_desc->mac_id); - reserved_macid |= ptcb_desc->mac_id; - } - } - SET_TX_DESC_RSVD_MACID(pdesc, reserved_macid); - - SET_TX_DESC_TXHT(pdesc, ((ptcb_desc->hw_rate >= - DESC92_RATEMCS0) ? 1 : 0)); - - if (rtlhal->version == VERSION_8192S_ACUT) { - if (ptcb_desc->hw_rate == DESC92_RATE1M || - ptcb_desc->hw_rate == DESC92_RATE2M || - ptcb_desc->hw_rate == DESC92_RATE5_5M || - ptcb_desc->hw_rate == DESC92_RATE11M) { - ptcb_desc->hw_rate = DESC92_RATE12M; - } - } - - SET_TX_DESC_TX_RATE(pdesc, ptcb_desc->hw_rate); - - if (ptcb_desc->use_shortgi || ptcb_desc->use_shortpreamble) - SET_TX_DESC_TX_SHORT(pdesc, 0); - - /* Aggregation related */ - if (info->flags & IEEE80211_TX_CTL_AMPDU) - SET_TX_DESC_AGG_ENABLE(pdesc, 1); - - /* For AMPDU, we must insert SSN into TX_DESC */ - SET_TX_DESC_SEQ(pdesc, seq_number); - - /* Protection mode related */ - /* For 92S, if RTS/CTS are set, HW will execute RTS. */ - /* We choose only one protection mode to execute */ - SET_TX_DESC_RTS_ENABLE(pdesc, ((ptcb_desc->rts_enable && - !ptcb_desc->cts_enable) ? 1 : 0)); - SET_TX_DESC_CTS_ENABLE(pdesc, ((ptcb_desc->cts_enable) ? - 1 : 0)); - SET_TX_DESC_RTS_STBC(pdesc, ((ptcb_desc->rts_stbc) ? 1 : 0)); - - SET_TX_DESC_RTS_RATE(pdesc, ptcb_desc->rts_rate); - SET_TX_DESC_RTS_BANDWIDTH(pdesc, 0); - SET_TX_DESC_RTS_SUB_CARRIER(pdesc, ptcb_desc->rts_sc); - SET_TX_DESC_RTS_SHORT(pdesc, ((ptcb_desc->rts_rate <= - DESC92_RATE54M) ? - (ptcb_desc->rts_use_shortpreamble ? 1 : 0) - : (ptcb_desc->rts_use_shortgi ? 1 : 0))); - - - /* Set Bandwidth and sub-channel settings. */ - if (bw_40) { - if (ptcb_desc->packet_bw) { - SET_TX_DESC_TX_BANDWIDTH(pdesc, 1); - /* use duplicated mode */ - SET_TX_DESC_TX_SUB_CARRIER(pdesc, 0); - } else { - SET_TX_DESC_TX_BANDWIDTH(pdesc, 0); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, - mac->cur_40_prime_sc); - } - } else { - SET_TX_DESC_TX_BANDWIDTH(pdesc, 0); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, 0); - } - - /* 3 Fill necessary field in First Descriptor */ - /*DWORD 0*/ - SET_TX_DESC_LINIP(pdesc, 0); - SET_TX_DESC_OFFSET(pdesc, 32); - SET_TX_DESC_PKT_SIZE(pdesc, (u16) skb->len); - - /*DWORD 1*/ - SET_TX_DESC_RA_BRSR_ID(pdesc, ptcb_desc->ratr_index); - - /* Fill security related */ - if (info->control.hw_key) { - struct ieee80211_key_conf *keyconf; - - keyconf = info->control.hw_key; - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - SET_TX_DESC_SEC_TYPE(pdesc, 0x1); - break; - case WLAN_CIPHER_SUITE_TKIP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x2); - break; - case WLAN_CIPHER_SUITE_CCMP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x3); - break; - default: - SET_TX_DESC_SEC_TYPE(pdesc, 0x0); - break; - - } - } - - /* Set Packet ID */ - SET_TX_DESC_PACKET_ID(pdesc, 0); - - /* We will assign magement queue to BK. */ - SET_TX_DESC_QUEUE_SEL(pdesc, fw_qsel); - - /* Alwasy enable all rate fallback range */ - SET_TX_DESC_DATA_RATE_FB_LIMIT(pdesc, 0x1F); - - /* Fix: I don't kown why hw use 6.5M to tx when set it */ - SET_TX_DESC_USER_RATE(pdesc, - ptcb_desc->use_driver_rate ? 1 : 0); - - /* Set NON_QOS bit. */ - if (!ieee80211_is_data_qos(fc)) - SET_TX_DESC_NON_QOS(pdesc, 1); - - } - - /* Fill fields that are required to be initialized - * in all of the descriptors */ - /*DWORD 0 */ - SET_TX_DESC_FIRST_SEG(pdesc, (firstseg ? 1 : 0)); - SET_TX_DESC_LAST_SEG(pdesc, (lastseg ? 1 : 0)); - - /* DWORD 7 */ - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16) skb->len); - - /* DOWRD 8 */ - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping); - - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "\n"); -} - -void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, - bool firstseg, bool lastseg, struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_tcb_desc *tcb_desc = (struct rtl_tcb_desc *)(skb->cb); - - dma_addr_t mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, - PCI_DMA_TODEVICE); - - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } - /* Clear all status */ - CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_CMDDESC_SIZE_RTL8192S); - - /* This bit indicate this packet is used for FW download. */ - if (tcb_desc->cmd_or_init == DESC_PACKET_TYPE_INIT) { - /* For firmware downlaod we only need to set LINIP */ - SET_TX_DESC_LINIP(pdesc, tcb_desc->last_inipkt); - - /* 92SE must set as 1 for firmware download HW DMA error */ - SET_TX_DESC_FIRST_SEG(pdesc, 1); - SET_TX_DESC_LAST_SEG(pdesc, 1); - - /* 92SE need not to set TX packet size when firmware download */ - SET_TX_DESC_PKT_SIZE(pdesc, (u16)(skb->len)); - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16)(skb->len)); - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping); - - wmb(); - SET_TX_DESC_OWN(pdesc, 1); - } else { /* H2C Command Desc format (Host TXCMD) */ - /* 92SE must set as 1 for firmware download HW DMA error */ - SET_TX_DESC_FIRST_SEG(pdesc, 1); - SET_TX_DESC_LAST_SEG(pdesc, 1); - - SET_TX_DESC_OFFSET(pdesc, 0x20); - - /* Buffer size + command header */ - SET_TX_DESC_PKT_SIZE(pdesc, (u16)(skb->len)); - /* Fixed queue of H2C command */ - SET_TX_DESC_QUEUE_SEL(pdesc, 0x13); - - SET_BITS_TO_LE_4BYTE(skb->data, 24, 7, rtlhal->h2c_txcmd_seq); - - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16)(skb->len)); - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping); - - wmb(); - SET_TX_DESC_OWN(pdesc, 1); - - } -} - -void rtl92se_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val) -{ - if (istx) { - switch (desc_name) { - case HW_DESC_OWN: - wmb(); - SET_TX_DESC_OWN(pdesc, 1); - break; - case HW_DESC_TX_NEXTDESC_ADDR: - SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *) val); - break; - default: - RT_ASSERT(false, "ERR txdesc :%d not process\n", - desc_name); - break; - } - } else { - switch (desc_name) { - case HW_DESC_RXOWN: - wmb(); - SET_RX_STATUS_DESC_OWN(pdesc, 1); - break; - case HW_DESC_RXBUFF_ADDR: - SET_RX_STATUS__DESC_BUFF_ADDR(pdesc, *(u32 *) val); - break; - case HW_DESC_RXPKT_LEN: - SET_RX_STATUS_DESC_PKT_LEN(pdesc, *(u32 *) val); - break; - case HW_DESC_RXERO: - SET_RX_STATUS_DESC_EOR(pdesc, 1); - break; - default: - RT_ASSERT(false, "ERR rxdesc :%d not process\n", - desc_name); - break; - } - } -} - -u32 rtl92se_get_desc(u8 *desc, bool istx, u8 desc_name) -{ - u32 ret = 0; - - if (istx) { - switch (desc_name) { - case HW_DESC_OWN: - ret = GET_TX_DESC_OWN(desc); - break; - case HW_DESC_TXBUFF_ADDR: - ret = GET_TX_DESC_TX_BUFFER_ADDRESS(desc); - break; - default: - RT_ASSERT(false, "ERR txdesc :%d not process\n", - desc_name); - break; - } - } else { - switch (desc_name) { - case HW_DESC_OWN: - ret = GET_RX_STATUS_DESC_OWN(desc); - break; - case HW_DESC_RXPKT_LEN: - ret = GET_RX_STATUS_DESC_PKT_LEN(desc); - break; - default: - RT_ASSERT(false, "ERR rxdesc :%d not process\n", - desc_name); - break; - } - } - return ret; -} - -void rtl92se_tx_polling(struct ieee80211_hw *hw, u8 hw_queue) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - rtl_write_word(rtlpriv, TP_POLL, BIT(0) << (hw_queue)); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.h b/drivers/net/wireless/rtlwifi/rtl8192se/trx.h deleted file mode 100644 index 64dd66f287c1..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.h +++ /dev/null @@ -1,46 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ -#ifndef __REALTEK_PCI92SE_TRX_H__ -#define __REALTEK_PCI92SE_TRX_H__ - -void rtl92se_tx_fill_desc(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, - u8 *pdesc, struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, u8 hw_queue, - struct rtl_tcb_desc *ptcb_desc); -void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, bool firstseg, - bool lastseg, struct sk_buff *skb); -bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, - struct ieee80211_rx_status *rx_status, u8 *pdesc, - struct sk_buff *skb); -void rtl92se_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val); -u32 rtl92se_get_desc(u8 *pdesc, bool istx, u8 desc_name); -void rtl92se_tx_polling(struct ieee80211_hw *hw, u8 hw_queue); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/Makefile b/drivers/net/wireless/rtlwifi/rtl8723ae/Makefile deleted file mode 100644 index 4ed731f09b1f..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -obj-m := rtl8723ae.o - - -rtl8723ae-objs := \ - dm.o \ - fw.o \ - hal_btc.o \ - hal_bt_coexist.o\ - hw.o \ - led.o \ - phy.o \ - pwrseq.o \ - pwrseqcmd.o \ - rf.o \ - sw.o \ - table.o \ - trx.o \ - - -obj-$(CONFIG_RTL8723AE) += rtl8723ae.o - -ccflags-y += -D__CHECK_ENDIAN__ diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/btc.h b/drivers/net/wireless/rtlwifi/rtl8723ae/btc.h deleted file mode 100644 index 417afeed36af..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/btc.h +++ /dev/null @@ -1,41 +0,0 @@ -/****************************************************************************** - ** - ** Copyright(c) 2009-2012 Realtek Corporation. - ** - ** 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 - ** - ** The full GNU General Public License is included in this distribution in the - ** file called LICENSE. - ** - ** Contact Information: - ** wlanfae - ** Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - ** Hsinchu 300, Taiwan. - ** Larry Finger - ** - ***************************************************************************** - */ - -#ifndef __RTL8723E_BTC_H__ -#define __RTL8723E_BTC_H__ - -#include "../wifi.h" -#include "hal_bt_coexist.h" - -struct bt_coexist_c2h_info { - u8 no_parse_c2h; - u8 has_c2h; -}; - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/def.h b/drivers/net/wireless/rtlwifi/rtl8723ae/def.h deleted file mode 100644 index 8c110356dff9..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/def.h +++ /dev/null @@ -1,163 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - **************************************************************************** - */ - -#ifndef __RTL8723E_DEF_H__ -#define __RTL8723E_DEF_H__ - -#define HAL_PRIME_CHNL_OFFSET_LOWER 1 - -#define RX_MPDU_QUEUE 0 - -#define CHIP_8723 BIT(0) -#define NORMAL_CHIP BIT(3) -#define RF_TYPE_1T2R BIT(4) -#define RF_TYPE_2T2R BIT(5) -#define CHIP_VENDOR_UMC BIT(7) -#define B_CUT_VERSION BIT(12) -#define C_CUT_VERSION BIT(13) -#define D_CUT_VERSION ((BIT(12)|BIT(13))) -#define E_CUT_VERSION BIT(14) -#define RF_RL_ID (BIT(31)|BIT(30)|BIT(29)|BIT(28)) - -enum version_8723e { - VERSION_TEST_UMC_CHIP_8723 = 0x0081, - VERSION_NORMAL_UMC_CHIP_8723_1T1R_A_CUT = 0x0089, - VERSION_NORMAL_UMC_CHIP_8723_1T1R_B_CUT = 0x1089, -}; - -/* MASK */ -#define IC_TYPE_MASK (BIT(0)|BIT(1)|BIT(2)) -#define CHIP_TYPE_MASK BIT(3) -#define RF_TYPE_MASK (BIT(4)|BIT(5)|BIT(6)) -#define MANUFACTUER_MASK BIT(7) -#define ROM_VERSION_MASK (BIT(11)|BIT(10)|BIT(9)|BIT(8)) -#define CUT_VERSION_MASK (BIT(15)|BIT(14)|BIT(13)|BIT(12)) - -/* Get element */ -#define GET_CVID_IC_TYPE(version) ((version) & IC_TYPE_MASK) -#define GET_CVID_MANUFACTUER(version) ((version) & MANUFACTUER_MASK) -#define GET_CVID_CUT_VERSION(version) ((version) & CUT_VERSION_MASK) - -#define IS_81XXC(version) ((GET_CVID_IC_TYPE(version) == 0) ?\ - true : false) -#define IS_8723_SERIES(version) \ - ((GET_CVID_IC_TYPE(version) == CHIP_8723) ? true : false) -#define IS_CHIP_VENDOR_UMC(version) \ - ((GET_CVID_MANUFACTUER(version)) ? true : false) - -#define IS_VENDOR_UMC_A_CUT(version) ((IS_CHIP_VENDOR_UMC(version)) ? \ - ((GET_CVID_CUT_VERSION(version)) ? false : true) : false) -#define IS_VENDOR_8723_A_CUT(version) ((IS_8723_SERIES(version)) ? \ - ((GET_CVID_CUT_VERSION(version)) ? false : true) : false) -#define IS_81xxC_VENDOR_UMC_B_CUT(version) ((IS_CHIP_VENDOR_UMC(version)) \ - ? ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? \ - true : false) : false) - -enum rf_optype { - RF_OP_BY_SW_3WIRE = 0, - RF_OP_BY_FW, - RF_OP_MAX -}; - -enum rf_power_state { - RF_ON, - RF_OFF, - RF_SLEEP, - RF_SHUT_DOWN, -}; - -enum power_save_mode { - POWER_SAVE_MODE_ACTIVE, - POWER_SAVE_MODE_SAVE, -}; - -enum power_polocy_config { - POWERCFG_MAX_POWER_SAVINGS, - POWERCFG_GLOBAL_POWER_SAVINGS, - POWERCFG_LOCAL_POWER_SAVINGS, - POWERCFG_LENOVO, -}; - -enum interface_select_pci { - INTF_SEL1_MINICARD = 0, - INTF_SEL0_PCIE = 1, - INTF_SEL2_RSV = 2, - INTF_SEL3_RSV = 3, -}; - -enum hal_fw_c2h_cmd_id { - HAL_FW_C2H_CMD_Read_MACREG = 0, - HAL_FW_C2H_CMD_Read_BBREG = 1, - HAL_FW_C2H_CMD_Read_RFREG = 2, - HAL_FW_C2H_CMD_Read_EEPROM = 3, - HAL_FW_C2H_CMD_Read_EFUSE = 4, - HAL_FW_C2H_CMD_Read_CAM = 5, - HAL_FW_C2H_CMD_Get_BasicRate = 6, - HAL_FW_C2H_CMD_Get_DataRate = 7, - HAL_FW_C2H_CMD_Survey = 8, - HAL_FW_C2H_CMD_SurveyDone = 9, - HAL_FW_C2H_CMD_JoinBss = 10, - HAL_FW_C2H_CMD_AddSTA = 11, - HAL_FW_C2H_CMD_DelSTA = 12, - HAL_FW_C2H_CMD_AtimDone = 13, - HAL_FW_C2H_CMD_TX_Report = 14, - HAL_FW_C2H_CMD_CCX_Report = 15, - HAL_FW_C2H_CMD_DTM_Report = 16, - HAL_FW_C2H_CMD_TX_Rate_Statistics = 17, - HAL_FW_C2H_CMD_C2HLBK = 18, - HAL_FW_C2H_CMD_C2HDBG = 19, - HAL_FW_C2H_CMD_C2HFEEDBACK = 20, - HAL_FW_C2H_CMD_MAX -}; - -enum rtl_desc_qsel { - QSLT_BK = 0x2, - QSLT_BE = 0x0, - QSLT_VI = 0x5, - QSLT_VO = 0x7, - QSLT_BEACON = 0x10, - QSLT_HIGH = 0x11, - QSLT_MGNT = 0x12, - QSLT_CMD = 0x13, -}; - -struct phy_sts_cck_8723e_t { - u8 adc_pwdb_X[4]; - u8 sq_rpt; - u8 cck_agc_rpt; -}; - -struct h2c_cmd_8723e { - u8 element_id; - u32 cmd_len; - u8 *p_cmdbuffer; -}; - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/dm.c b/drivers/net/wireless/rtlwifi/rtl8723ae/dm.c deleted file mode 100644 index a36eee28f9e7..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/dm.c +++ /dev/null @@ -1,994 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - **************************************************************************** - */ - -#include "../wifi.h" -#include "../base.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "fw.h" -#include "hal_btc.h" - -static const u32 ofdmswing_table[OFDM_TABLE_SIZE] = { - 0x7f8001fe, - 0x788001e2, - 0x71c001c7, - 0x6b8001ae, - 0x65400195, - 0x5fc0017f, - 0x5a400169, - 0x55400155, - 0x50800142, - 0x4c000130, - 0x47c0011f, - 0x43c0010f, - 0x40000100, - 0x3c8000f2, - 0x390000e4, - 0x35c000d7, - 0x32c000cb, - 0x300000c0, - 0x2d4000b5, - 0x2ac000ab, - 0x288000a2, - 0x26000098, - 0x24000090, - 0x22000088, - 0x20000080, - 0x1e400079, - 0x1c800072, - 0x1b00006c, - 0x19800066, - 0x18000060, - 0x16c0005b, - 0x15800056, - 0x14400051, - 0x1300004c, - 0x12000048, - 0x11000044, - 0x10000040, -}; - -static const u8 cckswing_table_ch1ch13[CCK_TABLE_SIZE][8] = { - {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, - {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, - {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, - {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, - {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, - {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, - {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, - {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, - {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, - {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, - {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, - {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, - {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, - {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, - {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, - {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, - {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, - {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, - {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, - {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, - {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, - {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, - {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, - {0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, - {0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, - {0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, - {0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, - {0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, - {0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, - {0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, - {0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, - {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, - {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01} -}; - -static const u8 cckswing_table_ch14[CCK_TABLE_SIZE][8] = { - {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, - {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, - {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, - {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, - {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, - {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, - {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, - {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, - {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, - {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, - {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, - {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, - {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, - {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, - {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, - {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, - {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, - {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, - {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, - {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, - {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, - {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, - {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, - {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, - {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, - {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, - {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, - {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, - {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, - {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, - {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, - {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, - {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00} -}; - -static void rtl8723ae_dm_diginit(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - - dm_digtable->dig_enable_flag = true; - dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; - dm_digtable->cur_igvalue = 0x20; - dm_digtable->pre_igvalue = 0x0; - dm_digtable->cursta_cstate = DIG_STA_DISCONNECT; - dm_digtable->presta_cstate = DIG_STA_DISCONNECT; - dm_digtable->curmultista_cstate = DIG_MULTISTA_DISCONNECT; - dm_digtable->rssi_lowthresh = DM_DIG_THRESH_LOW; - dm_digtable->rssi_highthresh = DM_DIG_THRESH_HIGH; - dm_digtable->fa_lowthresh = DM_FALSEALARM_THRESH_LOW; - dm_digtable->fa_highthresh = DM_FALSEALARM_THRESH_HIGH; - dm_digtable->rx_gain_max = DM_DIG_MAX; - dm_digtable->rx_gain_min = DM_DIG_MIN; - dm_digtable->back_val = DM_DIG_BACKOFF_DEFAULT; - dm_digtable->back_range_max = DM_DIG_BACKOFF_MAX; - dm_digtable->back_range_min = DM_DIG_BACKOFF_MIN; - dm_digtable->pre_cck_pd_state = CCK_PD_STAGE_MAX; - dm_digtable->cur_cck_pd_state = CCK_PD_STAGE_MAX; -} - -static u8 rtl_init_gain_min_pwdb(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - long rssi_val_min = 0; - - if ((dm_digtable->curmultista_cstate == DIG_MULTISTA_CONNECT) && - (dm_digtable->cursta_cstate == DIG_STA_CONNECT)) { - if (rtlpriv->dm.entry_min_undec_sm_pwdb != 0) - rssi_val_min = - (rtlpriv->dm.entry_min_undec_sm_pwdb > - rtlpriv->dm.undec_sm_pwdb) ? - rtlpriv->dm.undec_sm_pwdb : - rtlpriv->dm.entry_min_undec_sm_pwdb; - else - rssi_val_min = rtlpriv->dm.undec_sm_pwdb; - } else if (dm_digtable->cursta_cstate == DIG_STA_CONNECT || - dm_digtable->cursta_cstate == DIG_STA_BEFORE_CONNECT) { - rssi_val_min = rtlpriv->dm.undec_sm_pwdb; - } else if (dm_digtable->curmultista_cstate == DIG_MULTISTA_CONNECT) { - rssi_val_min = rtlpriv->dm.entry_min_undec_sm_pwdb; - } - - return (u8) rssi_val_min; -} - -static void rtl8723ae_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) -{ - u32 ret_value; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); - - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER1, MASKDWORD); - falsealm_cnt->cnt_parity_fail = ((ret_value & 0xffff0000) >> 16); - - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER2, MASKDWORD); - falsealm_cnt->cnt_rate_illegal = (ret_value & 0xffff); - falsealm_cnt->cnt_crc8_fail = ((ret_value & 0xffff0000) >> 16); - - ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER3, MASKDWORD); - falsealm_cnt->cnt_mcs_fail = (ret_value & 0xffff); - falsealm_cnt->cnt_ofdm_fail = falsealm_cnt->cnt_parity_fail + - falsealm_cnt->cnt_rate_illegal + - falsealm_cnt->cnt_crc8_fail + falsealm_cnt->cnt_mcs_fail; - - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, BIT(14), 1); - ret_value = rtl_get_bbreg(hw, RCCK0_FACOUNTERLOWER, MASKBYTE0); - falsealm_cnt->cnt_cck_fail = ret_value; - - ret_value = rtl_get_bbreg(hw, RCCK0_FACOUNTERUPPER, MASKBYTE3); - falsealm_cnt->cnt_cck_fail += (ret_value & 0xff) << 8; - falsealm_cnt->cnt_all = (falsealm_cnt->cnt_parity_fail + - falsealm_cnt->cnt_rate_illegal + - falsealm_cnt->cnt_crc8_fail + - falsealm_cnt->cnt_mcs_fail + - falsealm_cnt->cnt_cck_fail); - - rtl_set_bbreg(hw, ROFDM1_LSTF, 0x08000000, 1); - rtl_set_bbreg(hw, ROFDM1_LSTF, 0x08000000, 0); - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, 0x0000c000, 0); - rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, 0x0000c000, 2); - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, - "cnt_parity_fail = %d, cnt_rate_illegal = %d, " - "cnt_crc8_fail = %d, cnt_mcs_fail = %d\n", - falsealm_cnt->cnt_parity_fail, - falsealm_cnt->cnt_rate_illegal, - falsealm_cnt->cnt_crc8_fail, falsealm_cnt->cnt_mcs_fail); - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, - "cnt_ofdm_fail = %x, cnt_cck_fail = %x, cnt_all = %x\n", - falsealm_cnt->cnt_ofdm_fail, - falsealm_cnt->cnt_cck_fail, falsealm_cnt->cnt_all); -} - -static void rtl92c_dm_ctrl_initgain_by_fa(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - u8 value_igi = dm_digtable->cur_igvalue; - - if (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH0) - value_igi--; - else if (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH1) - value_igi += 0; - else if (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH2) - value_igi++; - else - value_igi += 2; - - value_igi = clamp(value_igi, (u8)DM_DIG_FA_LOWER, (u8)DM_DIG_FA_UPPER); - if (rtlpriv->falsealm_cnt.cnt_all > 10000) - value_igi = 0x32; - - dm_digtable->cur_igvalue = value_igi; - rtl8723ae_dm_write_dig(hw); -} - -static void rtl92c_dm_ctrl_initgain_by_rssi(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dgtbl = &rtlpriv->dm_digtable; - - if (rtlpriv->falsealm_cnt.cnt_all > dgtbl->fa_highthresh) { - if ((dgtbl->back_val - 2) < dgtbl->back_range_min) - dgtbl->back_val = dgtbl->back_range_min; - else - dgtbl->back_val -= 2; - } else if (rtlpriv->falsealm_cnt.cnt_all < dgtbl->fa_lowthresh) { - if ((dgtbl->back_val + 2) > dgtbl->back_range_max) - dgtbl->back_val = dgtbl->back_range_max; - else - dgtbl->back_val += 2; - } - - if ((dgtbl->rssi_val_min + 10 - dgtbl->back_val) > - dgtbl->rx_gain_max) - dgtbl->cur_igvalue = dgtbl->rx_gain_max; - else if ((dgtbl->rssi_val_min + 10 - - dgtbl->back_val) < dgtbl->rx_gain_min) - dgtbl->cur_igvalue = dgtbl->rx_gain_min; - else - dgtbl->cur_igvalue = dgtbl->rssi_val_min + 10 - dgtbl->back_val; - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, - "rssi_val_min = %x back_val %x\n", - dgtbl->rssi_val_min, dgtbl->back_val); - - rtl8723ae_dm_write_dig(hw); -} - -static void rtl8723ae_dm_initial_gain_multi_sta(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - long rssi_strength = rtlpriv->dm.entry_min_undec_sm_pwdb; - bool multi_sta = false; - - if (mac->opmode == NL80211_IFTYPE_ADHOC) - multi_sta = true; - - if ((!multi_sta) || - (dm_digtable->cursta_cstate != DIG_STA_DISCONNECT)) { - rtlpriv->initialized = false; - dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; - return; - } else if (!rtlpriv->initialized) { - rtlpriv->initialized = true; - dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; - dm_digtable->cur_igvalue = 0x20; - rtl8723ae_dm_write_dig(hw); - } - - if (dm_digtable->curmultista_cstate == DIG_MULTISTA_CONNECT) { - if ((rssi_strength < dm_digtable->rssi_lowthresh) && - (dm_digtable->dig_ext_port_stage != DIG_EXT_PORT_STAGE_1)) { - - if (dm_digtable->dig_ext_port_stage == - DIG_EXT_PORT_STAGE_2) { - dm_digtable->cur_igvalue = 0x20; - rtl8723ae_dm_write_dig(hw); - } - - dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_1; - } else if (rssi_strength > dm_digtable->rssi_highthresh) { - dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_2; - rtl92c_dm_ctrl_initgain_by_fa(hw); - } - } else if (dm_digtable->dig_ext_port_stage != DIG_EXT_PORT_STAGE_0) { - dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; - dm_digtable->cur_igvalue = 0x20; - rtl8723ae_dm_write_dig(hw); - } - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, - "curmultista_cstate = %x dig_ext_port_stage %x\n", - dm_digtable->curmultista_cstate, - dm_digtable->dig_ext_port_stage); -} - -static void rtl8723ae_dm_initial_gain_sta(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, - "presta_cstate = %x, cursta_cstate = %x\n", - dm_digtable->presta_cstate, - dm_digtable->cursta_cstate); - - if (dm_digtable->presta_cstate == dm_digtable->cursta_cstate || - dm_digtable->cursta_cstate == DIG_STA_BEFORE_CONNECT || - dm_digtable->cursta_cstate == DIG_STA_CONNECT) { - - if (dm_digtable->cursta_cstate != DIG_STA_DISCONNECT) { - dm_digtable->rssi_val_min = rtl_init_gain_min_pwdb(hw); - rtl92c_dm_ctrl_initgain_by_rssi(hw); - } - } else { - dm_digtable->rssi_val_min = 0; - dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; - dm_digtable->back_val = DM_DIG_BACKOFF_DEFAULT; - dm_digtable->cur_igvalue = 0x20; - dm_digtable->pre_igvalue = 0; - rtl8723ae_dm_write_dig(hw); - } -} -static void rtl8723ae_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - - if (dm_digtable->cursta_cstate == DIG_STA_CONNECT) { - dm_digtable->rssi_val_min = rtl_init_gain_min_pwdb(hw); - - if (dm_digtable->pre_cck_pd_state == CCK_PD_STAGE_LowRssi) { - if (dm_digtable->rssi_val_min <= 25) - dm_digtable->cur_cck_pd_state = - CCK_PD_STAGE_LowRssi; - else - dm_digtable->cur_cck_pd_state = - CCK_PD_STAGE_HighRssi; - } else { - if (dm_digtable->rssi_val_min <= 20) - dm_digtable->cur_cck_pd_state = - CCK_PD_STAGE_LowRssi; - else - dm_digtable->cur_cck_pd_state = - CCK_PD_STAGE_HighRssi; - } - } else { - dm_digtable->cur_cck_pd_state = CCK_PD_STAGE_MAX; - } - - if (dm_digtable->pre_cck_pd_state != dm_digtable->cur_cck_pd_state) { - if (dm_digtable->cur_cck_pd_state == CCK_PD_STAGE_LowRssi) { - if (rtlpriv->falsealm_cnt.cnt_cck_fail > 800) - dm_digtable->cur_cck_fa_state = - CCK_FA_STAGE_High; - else - dm_digtable->cur_cck_fa_state = - CCK_FA_STAGE_Low; - - if (dm_digtable->pre_cck_fa_state != - dm_digtable->cur_cck_fa_state) { - if (dm_digtable->cur_cck_fa_state == - CCK_FA_STAGE_Low) - rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, - 0x83); - else - rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, - 0xcd); - - dm_digtable->pre_cck_fa_state = - dm_digtable->cur_cck_fa_state; - } - - rtl_set_bbreg(hw, RCCK0_SYSTEM, MASKBYTE1, 0x40); - - } else { - rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, 0xcd); - rtl_set_bbreg(hw, RCCK0_SYSTEM, MASKBYTE1, 0x47); - - } - dm_digtable->pre_cck_pd_state = dm_digtable->cur_cck_pd_state; - } - - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, - "CCKPDStage=%x\n", dm_digtable->cur_cck_pd_state); - -} - -static void rtl8723ae_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - - if (mac->act_scanning == true) - return; - - if (mac->link_state >= MAC80211_LINKED) - dm_digtable->cursta_cstate = DIG_STA_CONNECT; - else - dm_digtable->cursta_cstate = DIG_STA_DISCONNECT; - - rtl8723ae_dm_initial_gain_sta(hw); - rtl8723ae_dm_initial_gain_multi_sta(hw); - rtl8723ae_dm_cck_packet_detection_thresh(hw); - - dm_digtable->presta_cstate = dm_digtable->cursta_cstate; - -} - -static void rtl8723ae_dm_dig(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - - if (rtlpriv->dm.dm_initialgain_enable == false) - return; - if (dm_digtable->dig_enable_flag == false) - return; - - rtl8723ae_dm_ctrl_initgain_by_twoport(hw); -} - -static void rtl8723ae_dm_init_dynamic_txpower(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.dynamic_txpower_enable = false; - - rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; -} - -static void rtl8723ae_dm_dynamic_txpower(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - long undec_sm_pwdb; - - if (!rtlpriv->dm.dynamic_txpower_enable) - return; - - if (rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - return; - } - - if ((mac->link_state < MAC80211_LINKED) && - (rtlpriv->dm.entry_min_undec_sm_pwdb == 0)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, - "Not connected\n"); - - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - - rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; - return; - } - - if (mac->link_state >= MAC80211_LINKED) { - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "AP Client PWDB = 0x%lx\n", - undec_sm_pwdb); - } else { - undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "STA Default Port PWDB = 0x%lx\n", - undec_sm_pwdb); - } - } else { - undec_sm_pwdb = rtlpriv->dm.entry_min_undec_sm_pwdb; - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "AP Ext Port PWDB = 0x%lx\n", - undec_sm_pwdb); - } - - if (undec_sm_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n"); - } else if ((undec_sm_pwdb < (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) && - (undec_sm_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL1)) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n"); - } else if (undec_sm_pwdb < (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) { - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "TXHIGHPWRLEVEL_NORMAL\n"); - } - - if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "PHY_SetTxPowerLevel8192S() Channel = %d\n", - rtlphy->current_channel); - rtl8723ae_phy_set_txpower_level(hw, rtlphy->current_channel); - } - - rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl; -} - -void rtl8723ae_dm_write_dig(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, - "cur_igvalue = 0x%x, " - "pre_igvalue = 0x%x, back_val = %d\n", - dm_digtable->cur_igvalue, dm_digtable->pre_igvalue, - dm_digtable->back_val); - - if (dm_digtable->pre_igvalue != dm_digtable->cur_igvalue) { - rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, - dm_digtable->cur_igvalue); - rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, 0x7f, - dm_digtable->cur_igvalue); - - dm_digtable->pre_igvalue = dm_digtable->cur_igvalue; - } -} - -static void rtl8723ae_dm_pwdmonitor(struct ieee80211_hw *hw) -{ -} - -void rtl8723ae_dm_init_edca_turbo(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.current_turbo_edca = false; - rtlpriv->dm.is_any_nonbepkts = false; - rtlpriv->dm.is_cur_rdlstate = false; -} - -static void rtl8723ae_dm_check_edca_turbo(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - u64 cur_txok_cnt = 0; - u64 cur_rxok_cnt = 0; - u32 edca_be_ul = 0x5ea42b; - u32 edca_be_dl = 0x5ea42b; - bool bt_change_edca = false; - - if ((mac->last_bt_edca_ul != rtlpcipriv->bt_coexist.bt_edca_ul) || - (mac->last_bt_edca_dl != rtlpcipriv->bt_coexist.bt_edca_dl)) { - rtlpriv->dm.current_turbo_edca = false; - mac->last_bt_edca_ul = rtlpcipriv->bt_coexist.bt_edca_ul; - mac->last_bt_edca_dl = rtlpcipriv->bt_coexist.bt_edca_dl; - } - - if (rtlpcipriv->bt_coexist.bt_edca_ul != 0) { - edca_be_ul = rtlpcipriv->bt_coexist.bt_edca_ul; - bt_change_edca = true; - } - - if (rtlpcipriv->bt_coexist.bt_edca_dl != 0) { - edca_be_ul = rtlpcipriv->bt_coexist.bt_edca_dl; - bt_change_edca = true; - } - - if (mac->link_state != MAC80211_LINKED) { - rtlpriv->dm.current_turbo_edca = false; - return; - } - - if ((!mac->ht_enable) && (!rtlpcipriv->bt_coexist.bt_coexistence)) { - if (!(edca_be_ul & 0xffff0000)) - edca_be_ul |= 0x005e0000; - - if (!(edca_be_dl & 0xffff0000)) - edca_be_dl |= 0x005e0000; - } - - if ((bt_change_edca) || ((!rtlpriv->dm.is_any_nonbepkts) && - (!rtlpriv->dm.disable_framebursting))) { - - cur_txok_cnt = rtlpriv->stats.txbytesunicast - - mac->last_txok_cnt; - cur_rxok_cnt = rtlpriv->stats.rxbytesunicast - - mac->last_rxok_cnt; - - if (cur_rxok_cnt > 4 * cur_txok_cnt) { - if (!rtlpriv->dm.is_cur_rdlstate || - !rtlpriv->dm.current_turbo_edca) { - rtl_write_dword(rtlpriv, - REG_EDCA_BE_PARAM, - edca_be_dl); - rtlpriv->dm.is_cur_rdlstate = true; - } - } else { - if (rtlpriv->dm.is_cur_rdlstate || - !rtlpriv->dm.current_turbo_edca) { - rtl_write_dword(rtlpriv, - REG_EDCA_BE_PARAM, - edca_be_ul); - rtlpriv->dm.is_cur_rdlstate = false; - } - } - rtlpriv->dm.current_turbo_edca = true; - } else { - if (rtlpriv->dm.current_turbo_edca) { - u8 tmp = AC0_BE; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_AC_PARAM, - (u8 *) (&tmp)); - rtlpriv->dm.current_turbo_edca = false; - } - } - - rtlpriv->dm.is_any_nonbepkts = false; - mac->last_txok_cnt = rtlpriv->stats.txbytesunicast; - mac->last_rxok_cnt = rtlpriv->stats.rxbytesunicast; -} - -static void rtl8723ae_dm_initialize_txpower_tracking(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.txpower_tracking = true; - rtlpriv->dm.txpower_trackinginit = false; - - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, - "pMgntInfo->txpower_tracking = %d\n", - rtlpriv->dm.txpower_tracking); -} - -void rtl8723ae_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rate_adaptive *p_ra = &(rtlpriv->ra); - - p_ra->ratr_state = DM_RATR_STA_INIT; - p_ra->pre_ratr_state = DM_RATR_STA_INIT; - - if (rtlpriv->dm.dm_type == DM_TYPE_BYDRIVER) - rtlpriv->dm.useramask = true; - else - rtlpriv->dm.useramask = false; -} - -static void rtl8723ae_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rate_adaptive *p_ra = &(rtlpriv->ra); - u32 low_rssithresh_for_ra, high_rssithresh_for_ra; - struct ieee80211_sta *sta = NULL; - - if (is_hal_stop(rtlhal)) { - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, - " driver is going to unload\n"); - return; - } - - if (!rtlpriv->dm.useramask) { - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, - " driver does not control rate adaptive mask\n"); - return; - } - - if (mac->link_state == MAC80211_LINKED && - mac->opmode == NL80211_IFTYPE_STATION) { - switch (p_ra->pre_ratr_state) { - case DM_RATR_STA_HIGH: - high_rssithresh_for_ra = 50; - low_rssithresh_for_ra = 20; - break; - case DM_RATR_STA_MIDDLE: - high_rssithresh_for_ra = 55; - low_rssithresh_for_ra = 20; - break; - case DM_RATR_STA_LOW: - high_rssithresh_for_ra = 50; - low_rssithresh_for_ra = 25; - break; - default: - high_rssithresh_for_ra = 50; - low_rssithresh_for_ra = 20; - break; - } - - if (rtlpriv->dm.undec_sm_pwdb > high_rssithresh_for_ra) - p_ra->ratr_state = DM_RATR_STA_HIGH; - else if (rtlpriv->dm.undec_sm_pwdb > low_rssithresh_for_ra) - p_ra->ratr_state = DM_RATR_STA_MIDDLE; - else - p_ra->ratr_state = DM_RATR_STA_LOW; - - if (p_ra->pre_ratr_state != p_ra->ratr_state) { - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, - "RSSI = %ld\n", - rtlpriv->dm.undec_sm_pwdb); - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, - "RSSI_LEVEL = %d\n", p_ra->ratr_state); - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, - "PreState = %d, CurState = %d\n", - p_ra->pre_ratr_state, p_ra->ratr_state); - - rcu_read_lock(); - sta = rtl_find_sta(hw, mac->bssid); - if (sta) - rtlpriv->cfg->ops->update_rate_tbl(hw, sta, - p_ra->ratr_state); - rcu_read_unlock(); - - p_ra->pre_ratr_state = p_ra->ratr_state; - } - } -} - -static void rtl8723ae_dm_init_dynamic_bpowersaving(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm_pstable.pre_ccastate = CCA_MAX; - rtlpriv->dm_pstable.cur_ccasate = CCA_MAX; - rtlpriv->dm_pstable.pre_rfstate = RF_MAX; - rtlpriv->dm_pstable.cur_rfstate = RF_MAX; - rtlpriv->dm_pstable.rssi_val_min = 0; -} - -void rtl8723ae_dm_rf_saving(struct ieee80211_hw *hw, u8 force_in_normal) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct ps_t *dm_pstable = &rtlpriv->dm_pstable; - - if (!rtlpriv->reg_init) { - rtlpriv->reg_874 = (rtl_get_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, - MASKDWORD) & 0x1CC000) >> 14; - - rtlpriv->reg_c70 = (rtl_get_bbreg(hw, ROFDM0_AGCPARAMETER1, - MASKDWORD) & BIT(3)) >> 3; - - rtlpriv->reg_85c = (rtl_get_bbreg(hw, RFPGA0_XCD_SWITCHCONTROL, - MASKDWORD) & 0xFF000000) >> 24; - - rtlpriv->reg_a74 = (rtl_get_bbreg(hw, 0xa74, MASKDWORD) & - 0xF000) >> 12; - - rtlpriv->reg_init = true; - } - - if (!force_in_normal) { - if (dm_pstable->rssi_val_min != 0) { - if (dm_pstable->pre_rfstate == RF_NORMAL) { - if (dm_pstable->rssi_val_min >= 30) - dm_pstable->cur_rfstate = RF_SAVE; - else - dm_pstable->cur_rfstate = RF_NORMAL; - } else { - if (dm_pstable->rssi_val_min <= 25) - dm_pstable->cur_rfstate = RF_NORMAL; - else - dm_pstable->cur_rfstate = RF_SAVE; - } - } else { - dm_pstable->cur_rfstate = RF_MAX; - } - } else { - dm_pstable->cur_rfstate = RF_NORMAL; - } - - if (dm_pstable->pre_rfstate != dm_pstable->cur_rfstate) { - if (dm_pstable->cur_rfstate == RF_SAVE) { - - rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, - BIT(5), 0x1); - rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, - 0x1C0000, 0x2); - rtl_set_bbreg(hw, ROFDM0_AGCPARAMETER1, BIT(3), 0); - rtl_set_bbreg(hw, RFPGA0_XCD_SWITCHCONTROL, - 0xFF000000, 0x63); - rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, - 0xC000, 0x2); - rtl_set_bbreg(hw, 0xa74, 0xF000, 0x3); - rtl_set_bbreg(hw, 0x818, BIT(28), 0x0); - rtl_set_bbreg(hw, 0x818, BIT(28), 0x1); - } else { - rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, - 0x1CC000, rtlpriv->reg_874); - rtl_set_bbreg(hw, ROFDM0_AGCPARAMETER1, BIT(3), - rtlpriv->reg_c70); - rtl_set_bbreg(hw, RFPGA0_XCD_SWITCHCONTROL, 0xFF000000, - rtlpriv->reg_85c); - rtl_set_bbreg(hw, 0xa74, 0xF000, rtlpriv->reg_a74); - rtl_set_bbreg(hw, 0x818, BIT(28), 0x0); - rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, - BIT(5), 0x0); - } - - dm_pstable->pre_rfstate = dm_pstable->cur_rfstate; - } -} - -static void rtl8723ae_dm_dynamic_bpowersaving(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct ps_t *dm_pstable = &rtlpriv->dm_pstable; - - if (((mac->link_state == MAC80211_NOLINK)) && - (rtlpriv->dm.entry_min_undec_sm_pwdb == 0)) { - dm_pstable->rssi_val_min = 0; - RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, - "Not connected to any\n"); - } - - if (mac->link_state == MAC80211_LINKED) { - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - dm_pstable->rssi_val_min = - rtlpriv->dm.entry_min_undec_sm_pwdb; - RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, - "AP Client PWDB = 0x%lx\n", - dm_pstable->rssi_val_min); - } else { - dm_pstable->rssi_val_min = rtlpriv->dm.undec_sm_pwdb; - RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, - "STA Default Port PWDB = 0x%lx\n", - dm_pstable->rssi_val_min); - } - } else { - dm_pstable->rssi_val_min = rtlpriv->dm.entry_min_undec_sm_pwdb; - - RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, - "AP Ext Port PWDB = 0x%lx\n", - dm_pstable->rssi_val_min); - } - - rtl8723ae_dm_rf_saving(hw, false); -} - -void rtl8723ae_dm_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.dm_type = DM_TYPE_BYDRIVER; - rtl8723ae_dm_diginit(hw); - rtl8723ae_dm_init_dynamic_txpower(hw); - rtl8723ae_dm_init_edca_turbo(hw); - rtl8723ae_dm_init_rate_adaptive_mask(hw); - rtl8723ae_dm_initialize_txpower_tracking(hw); - rtl8723ae_dm_init_dynamic_bpowersaving(hw); -} - -void rtl8723ae_dm_watchdog(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - bool fw_current_inpsmode = false; - bool fw_ps_awake = true; - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_FW_PSMODE_STATUS, - (u8 *) (&fw_current_inpsmode)); - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_FWLPS_RF_ON, - (u8 *) (&fw_ps_awake)); - - if (ppsc->p2p_ps_info.p2p_ps_mode) - fw_ps_awake = false; - - if ((ppsc->rfpwr_state == ERFON) && - ((!fw_current_inpsmode) && fw_ps_awake) && - (!ppsc->rfchange_inprogress)) { - rtl8723ae_dm_pwdmonitor(hw); - rtl8723ae_dm_dig(hw); - rtl8723ae_dm_false_alarm_counter_statistics(hw); - rtl8723ae_dm_dynamic_bpowersaving(hw); - rtl8723ae_dm_dynamic_txpower(hw); - rtl8723ae_dm_refresh_rate_adaptive_mask(hw); - rtl8723ae_dm_bt_coexist(hw); - rtl8723ae_dm_check_edca_turbo(hw); - } - if (rtlpcipriv->bt_coexist.init_set) - rtl_write_byte(rtlpriv, 0x76e, 0xc); -} - -static void rtl8723ae_dm_init_bt_coexist(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - rtlpcipriv->bt_coexist.bt_rfreg_origin_1e - = rtl_get_rfreg(hw, (enum radio_path)0, RF_RCK1, 0xfffff); - rtlpcipriv->bt_coexist.bt_rfreg_origin_1f - = rtl_get_rfreg(hw, (enum radio_path)0, RF_RCK2, 0xf0); - - rtlpcipriv->bt_coexist.cstate = 0; - rtlpcipriv->bt_coexist.previous_state = 0; - rtlpcipriv->bt_coexist.cstate_h = 0; - rtlpcipriv->bt_coexist.previous_state_h = 0; - rtlpcipriv->bt_coexist.lps_counter = 0; - - /* Enable counter statistics */ - rtl_write_byte(rtlpriv, 0x76e, 0x4); - rtl_write_byte(rtlpriv, 0x778, 0x3); - rtl_write_byte(rtlpriv, 0x40, 0x20); - - rtlpcipriv->bt_coexist.init_set = true; -} - -void rtl8723ae_dm_bt_coexist(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u8 tmp_byte = 0; - if (!rtlpcipriv->bt_coexist.bt_coexistence) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, - "[DM]{BT], BT not exist!!\n"); - return; - } - - if (!rtlpcipriv->bt_coexist.init_set) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, - "[DM][BT], rtl8723ae_dm_bt_coexist()\n"); - - rtl8723ae_dm_init_bt_coexist(hw); - } - - tmp_byte = rtl_read_byte(rtlpriv, 0x40); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, - "[DM][BT], 0x40 is 0x%x", tmp_byte); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[DM][BT], bt_dm_coexist start"); - rtl8723ae_dm_bt_coexist_8723(hw); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/dm.h b/drivers/net/wireless/rtlwifi/rtl8723ae/dm.h deleted file mode 100644 index a372b0204456..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/dm.h +++ /dev/null @@ -1,155 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - **************************************************************************** - */ - -#ifndef __RTL8723E_DM_H__ -#define __RTL8723E_DM_H__ - -#define HAL_DM_HIPWR_DISABLE BIT(1) - -#define OFDM_TABLE_SIZE 37 -#define CCK_TABLE_SIZE 33 - -#define DM_DIG_THRESH_HIGH 40 -#define DM_DIG_THRESH_LOW 35 - -#define DM_FALSEALARM_THRESH_LOW 400 -#define DM_FALSEALARM_THRESH_HIGH 1000 - -#define DM_DIG_MAX 0x3e -#define DM_DIG_MIN 0x1e - -#define DM_DIG_FA_UPPER 0x32 -#define DM_DIG_FA_LOWER 0x20 -#define DM_DIG_FA_TH0 0x20 -#define DM_DIG_FA_TH1 0x100 -#define DM_DIG_FA_TH2 0x200 - -#define DM_DIG_BACKOFF_MAX 12 -#define DM_DIG_BACKOFF_MIN -4 -#define DM_DIG_BACKOFF_DEFAULT 10 - -#define RXPATHSELECTION_SS_TH_LOW 30 -#define RXPATHSELECTION_DIFF_TH 18 - -#define DM_RATR_STA_INIT 0 -#define DM_RATR_STA_HIGH 1 -#define DM_RATR_STA_MIDDLE 2 -#define DM_RATR_STA_LOW 3 - -#define TXHIGHPWRLEVEL_NORMAL 0 -#define TXHIGHPWRLEVEL_LEVEL1 1 -#define TXHIGHPWRLEVEL_LEVEL2 2 -#define TXHIGHPWRLEVEL_BT1 3 -#define TXHIGHPWRLEVEL_BT2 4 - -#define DM_TYPE_BYDRIVER 1 - -#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 -#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 - -struct swat_t { - u8 failure_cnt; - u8 try_flag; - u8 stop_trying; - long pre_rssi; - long trying_threshold; - u8 cur_antenna; - u8 pre_antenna; -}; - -enum tag_dynamic_init_gain_operation_type_definition { - DIG_TYPE_THRESH_HIGH = 0, - DIG_TYPE_THRESH_LOW = 1, - DIG_TYPE_BACKOFF = 2, - DIG_TYPE_RX_GAIN_MIN = 3, - DIG_TYPE_RX_GAIN_MAX = 4, - DIG_TYPE_ENABLE = 5, - DIG_TYPE_DISABLE = 6, - DIG_OP_TYPE_MAX -}; - -enum tag_cck_packet_detection_threshold_type_definition { - CCK_PD_STAGE_LowRssi = 0, - CCK_PD_STAGE_HighRssi = 1, - CCK_FA_STAGE_Low = 2, - CCK_FA_STAGE_High = 3, - CCK_PD_STAGE_MAX = 4, -}; - -enum dm_1r_cca_e { - CCA_1R = 0, - CCA_2R = 1, - CCA_MAX = 2, -}; - -enum dm_rf_e { - RF_SAVE = 0, - RF_NORMAL = 1, - RF_MAX = 2, -}; - -enum dm_sw_ant_switch_e { - ANS_ANTENNA_B = 1, - ANS_ANTENNA_A = 2, - ANS_ANTENNA_MAX = 3, -}; - -enum dm_dig_ext_port_alg_e { - DIG_EXT_PORT_STAGE_0 = 0, - DIG_EXT_PORT_STAGE_1 = 1, - DIG_EXT_PORT_STAGE_2 = 2, - DIG_EXT_PORT_STAGE_3 = 3, - DIG_EXT_PORT_STAGE_MAX = 4, -}; - -enum dm_dig_connect_e { - DIG_STA_DISCONNECT = 0, - DIG_STA_CONNECT = 1, - DIG_STA_BEFORE_CONNECT = 2, - DIG_MULTISTA_DISCONNECT = 3, - DIG_MULTISTA_CONNECT = 4, - DIG_CONNECT_MAX -}; - -#define GET_UNDECORATED_AVERAGE_RSSI(_priv) \ - ((((struct rtl_priv *)(_priv))->mac80211.opmode == \ - NL80211_IFTYPE_ADHOC) ? \ - (((struct rtl_priv *)(_priv))->dm.entry_min_undec_sm_pwdb) \ - : (((struct rtl_priv *)(_priv))->dm.undec_sm_pwdb)) - -void rtl8723ae_dm_init(struct ieee80211_hw *hw); -void rtl8723ae_dm_watchdog(struct ieee80211_hw *hw); -void rtl8723ae_dm_write_dig(struct ieee80211_hw *hw); -void rtl8723ae_dm_init_edca_turbo(struct ieee80211_hw *hw); -void rtl8723ae_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw); -void rtl8723ae_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal); -void rtl8723ae_dm_bt_coexist(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/fw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/fw.c deleted file mode 100644 index dedfa1ed3e02..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/fw.c +++ /dev/null @@ -1,838 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - **************************************************************************** - */ - -#include "../wifi.h" -#include "../pci.h" -#include "../base.h" -#include "reg.h" -#include "def.h" -#include "fw.h" - -static void _rtl8723ae_enable_fw_download(struct ieee80211_hw *hw, bool enable) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp; - if (enable) { - tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, tmp | 0x04); - - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL); - rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp | 0x01); - - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL + 2); - rtl_write_byte(rtlpriv, REG_MCUFWDL + 2, tmp & 0xf7); - } else { - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL); - rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp & 0xfe); - - rtl_write_byte(rtlpriv, REG_MCUFWDL + 1, 0x00); - } -} - -static void _rtl8723ae_fw_block_write(struct ieee80211_hw *hw, - const u8 *buffer, u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 blockSize = sizeof(u32); - u8 *bufferPtr = (u8 *) buffer; - u32 *pu4BytePtr = (u32 *) buffer; - u32 i, offset, blockCount, remainSize; - - blockCount = size / blockSize; - remainSize = size % blockSize; - - for (i = 0; i < blockCount; i++) { - offset = i * blockSize; - rtl_write_dword(rtlpriv, (FW_8192C_START_ADDRESS + offset), - *(pu4BytePtr + i)); - } - - if (remainSize) { - offset = blockCount * blockSize; - bufferPtr += offset; - for (i = 0; i < remainSize; i++) { - rtl_write_byte(rtlpriv, (FW_8192C_START_ADDRESS + - offset + i), *(bufferPtr + i)); - } - } -} - -static void _rtl8723ae_fw_page_write(struct ieee80211_hw *hw, - u32 page, const u8 *buffer, u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 value8; - u8 u8page = (u8) (page & 0x07); - - value8 = (rtl_read_byte(rtlpriv, REG_MCUFWDL + 2) & 0xF8) | u8page; - - rtl_write_byte(rtlpriv, (REG_MCUFWDL + 2), value8); - _rtl8723ae_fw_block_write(hw, buffer, size); -} - -static void _rtl8723ae_write_fw(struct ieee80211_hw *hw, - enum version_8723e version, u8 *buffer, - u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 *bufferPtr = (u8 *) buffer; - u32 page_nums, remain_size; - u32 page, offset; - - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, "FW size is %d bytes,\n", size); - - page_nums = size / FW_8192C_PAGE_SIZE; - remain_size = size % FW_8192C_PAGE_SIZE; - - if (page_nums > 6) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Page numbers should not be greater then 6\n"); - } - - for (page = 0; page < page_nums; page++) { - offset = page * FW_8192C_PAGE_SIZE; - _rtl8723ae_fw_page_write(hw, page, (bufferPtr + offset), - FW_8192C_PAGE_SIZE); - } - - if (remain_size) { - offset = page_nums * FW_8192C_PAGE_SIZE; - page = page_nums; - _rtl8723ae_fw_page_write(hw, page, (bufferPtr + offset), - remain_size); - } - - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, "FW write done.\n"); -} - -static int _rtl8723ae_fw_free_to_go(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int err = -EIO; - u32 counter = 0; - u32 value32; - - do { - value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - } while ((counter++ < FW_8192C_POLLING_TIMEOUT_COUNT) && - (!(value32 & FWDL_ChkSum_rpt))); - - if (counter >= FW_8192C_POLLING_TIMEOUT_COUNT) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "chksum report faill ! REG_MCUFWDL:0x%08x .\n", - value32); - goto exit; - } - - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, - "Checksum report OK ! REG_MCUFWDL:0x%08x .\n", value32); - - value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - value32 |= MCUFWDL_RDY; - value32 &= ~WINTINI_RDY; - rtl_write_dword(rtlpriv, REG_MCUFWDL, value32); - - counter = 0; - - do { - value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - if (value32 & WINTINI_RDY) { - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, - "Polling FW ready success!! REG_MCUFWDL:0x%08x .\n", - value32); - err = 0; - goto exit; - } - - mdelay(FW_8192C_POLLING_DELAY); - - } while (counter++ < FW_8192C_POLLING_TIMEOUT_COUNT); - - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Polling FW ready fail!! REG_MCUFWDL:0x%08x .\n", value32); - -exit: - return err; -} - -int rtl8723ae_download_fw(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl8723ae_firmware_header *pfwheader; - u8 *pfwdata; - u32 fwsize; - int err; - enum version_8723e version = rtlhal->version; - - if (!rtlhal->pfirmware) - return 1; - - pfwheader = (struct rtl8723ae_firmware_header *)rtlhal->pfirmware; - pfwdata = (u8 *) rtlhal->pfirmware; - fwsize = rtlhal->fwsize; - - if (IS_FW_HEADER_EXIST(pfwheader)) { - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, - "Firmware Version(%d), Signature(%#x),Size(%d)\n", - pfwheader->version, pfwheader->signature, - (int)sizeof(struct rtl8723ae_firmware_header)); - - pfwdata = pfwdata + sizeof(struct rtl8723ae_firmware_header); - fwsize = fwsize - sizeof(struct rtl8723ae_firmware_header); - } - - if (rtl_read_byte(rtlpriv, REG_MCUFWDL)&BIT(7)) { - rtl8723ae_firmware_selfreset(hw); - rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x00); - } - _rtl8723ae_enable_fw_download(hw, true); - _rtl8723ae_write_fw(hw, version, pfwdata, fwsize); - _rtl8723ae_enable_fw_download(hw, false); - - err = _rtl8723ae_fw_free_to_go(hw); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Firmware is not ready to run!\n"); - } else { - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, - "Firmware is ready to run!\n"); - } - return 0; -} - -static bool rtl8723ae_check_fw_read_last_h2c(struct ieee80211_hw *hw, u8 boxnum) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 val_hmetfr, val_mcutst_1; - bool result = false; - - val_hmetfr = rtl_read_byte(rtlpriv, REG_HMETFR); - val_mcutst_1 = rtl_read_byte(rtlpriv, (REG_MCUTST_1 + boxnum)); - - if (((val_hmetfr >> boxnum) & BIT(0)) == 0 && val_mcutst_1 == 0) - result = true; - return result; -} - -static void _rtl8723ae_fill_h2c_command(struct ieee80211_hw *hw, - u8 element_id, u32 cmd_len, - u8 *p_cmdbuffer) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 boxnum; - u16 box_reg = 0, box_extreg = 0; - u8 u1tmp; - bool isfw_rd = false; - bool bwrite_success = false; - u8 wait_h2c_limmit = 100; - u8 wait_writeh2c_limmit = 100; - u8 boxcontent[4], boxextcontent[2]; - u32 h2c_waitcounter = 0; - unsigned long flag; - u8 idx; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "come in\n"); - - while (true) { - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag); - if (rtlhal->h2c_setinprogress) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "H2C set in progress! Wait to set..element_id(%d).\n", - element_id); - - while (rtlhal->h2c_setinprogress) { - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, - flag); - h2c_waitcounter++; - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Wait 100 us (%d times)...\n", - h2c_waitcounter); - udelay(100); - - if (h2c_waitcounter > 1000) - return; - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, - flag); - } - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - } else { - rtlhal->h2c_setinprogress = true; - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - break; - } - } - - while (!bwrite_success) { - wait_writeh2c_limmit--; - if (wait_writeh2c_limmit == 0) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Write H2C fail because no trigger " - "for FW INT!\n"); - break; - } - - boxnum = rtlhal->last_hmeboxnum; - switch (boxnum) { - case 0: - box_reg = REG_HMEBOX_0; - box_extreg = REG_HMEBOX_EXT_0; - break; - case 1: - box_reg = REG_HMEBOX_1; - box_extreg = REG_HMEBOX_EXT_1; - break; - case 2: - box_reg = REG_HMEBOX_2; - box_extreg = REG_HMEBOX_EXT_2; - break; - case 3: - box_reg = REG_HMEBOX_3; - box_extreg = REG_HMEBOX_EXT_3; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - - isfw_rd = rtl8723ae_check_fw_read_last_h2c(hw, boxnum); - while (!isfw_rd) { - - wait_h2c_limmit--; - if (wait_h2c_limmit == 0) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Wating too long for FW read clear HMEBox(%d)!\n", - boxnum); - break; - } - - udelay(10); - - isfw_rd = rtl8723ae_check_fw_read_last_h2c(hw, boxnum); - u1tmp = rtl_read_byte(rtlpriv, 0x1BF); - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Wating for FW read clear HMEBox(%d)!!! " - "0x1BF = %2x\n", boxnum, u1tmp); - } - - if (!isfw_rd) { - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Write H2C register BOX[%d] fail!!!!! " - "Fw do not read.\n", boxnum); - break; - } - - memset(boxcontent, 0, sizeof(boxcontent)); - memset(boxextcontent, 0, sizeof(boxextcontent)); - boxcontent[0] = element_id; - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "Write element_id box_reg(%4x) = %2x\n", - box_reg, element_id); - - switch (cmd_len) { - case 1: - boxcontent[0] &= ~(BIT(7)); - memcpy((u8 *) (boxcontent) + 1, - p_cmdbuffer, 1); - - for (idx = 0; idx < 4; idx++) { - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - } - break; - case 2: - boxcontent[0] &= ~(BIT(7)); - memcpy((u8 *) (boxcontent) + 1, - p_cmdbuffer, 2); - - for (idx = 0; idx < 4; idx++) { - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - } - break; - case 3: - boxcontent[0] &= ~(BIT(7)); - memcpy((u8 *) (boxcontent) + 1, - p_cmdbuffer, 3); - - for (idx = 0; idx < 4; idx++) { - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - } - break; - case 4: - boxcontent[0] |= (BIT(7)); - memcpy((u8 *) (boxextcontent), - p_cmdbuffer, 2); - memcpy((u8 *) (boxcontent) + 1, - p_cmdbuffer + 2, 2); - - for (idx = 0; idx < 2; idx++) { - rtl_write_byte(rtlpriv, box_extreg + idx, - boxextcontent[idx]); - } - - for (idx = 0; idx < 4; idx++) { - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - } - break; - case 5: - boxcontent[0] |= (BIT(7)); - memcpy((u8 *) (boxextcontent), - p_cmdbuffer, 2); - memcpy((u8 *) (boxcontent) + 1, - p_cmdbuffer + 2, 3); - - for (idx = 0; idx < 2; idx++) { - rtl_write_byte(rtlpriv, box_extreg + idx, - boxextcontent[idx]); - } - - for (idx = 0; idx < 4; idx++) { - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - } - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not process\n"); - break; - } - - bwrite_success = true; - - rtlhal->last_hmeboxnum = boxnum + 1; - if (rtlhal->last_hmeboxnum == 4) - rtlhal->last_hmeboxnum = 0; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, - "pHalData->last_hmeboxnum = %d\n", - rtlhal->last_hmeboxnum); - } - - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag); - rtlhal->h2c_setinprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - - RT_TRACE(rtlpriv, COMP_CMD, DBG_LOUD, "go out\n"); -} - -void rtl8723ae_fill_h2c_cmd(struct ieee80211_hw *hw, - u8 element_id, u32 cmd_len, u8 *p_cmdbuffer) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - - if (rtlhal->fw_ready == false) { - RT_ASSERT(false, - "return H2C cmd because of Fw download fail!!!\n"); - return; - } - - _rtl8723ae_fill_h2c_command(hw, element_id, cmd_len, p_cmdbuffer); - return; -} - -void rtl8723ae_firmware_selfreset(struct ieee80211_hw *hw) -{ - u8 u1tmp; - u8 delay = 100; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_byte(rtlpriv, REG_HMETFR + 3, 0x20); - u1tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - - while (u1tmp & BIT(2)) { - delay--; - if (delay == 0) - break; - udelay(50); - u1tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - } - if (delay == 0) { - u1tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, u1tmp&(~BIT(2))); - } -} - -void rtl8723ae_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 u1_h2c_set_pwrmode[3] = { 0 }; - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, "FW LPS mode = %d\n", mode); - - SET_H2CCMD_PWRMODE_PARM_MODE(u1_h2c_set_pwrmode, mode); - SET_H2CCMD_PWRMODE_PARM_SMART_PS(u1_h2c_set_pwrmode, - (rtlpriv->mac80211.p2p) ? - ppsc->smart_ps : 1); - SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(u1_h2c_set_pwrmode, - ppsc->reg_max_lps_awakeintvl); - - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "rtl8723ae_set_fw_rsvdpagepkt(): u1_h2c_set_pwrmode\n", - u1_h2c_set_pwrmode, 3); - rtl8723ae_fill_h2c_cmd(hw, H2C_SETPWRMODE, 3, u1_h2c_set_pwrmode); - -} - -static bool _rtl8723ae_cmd_send_packet(struct ieee80211_hw *hw, - struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl8192_tx_ring *ring; - struct rtl_tx_desc *pdesc; - unsigned long flags; - struct sk_buff *pskb = NULL; - - ring = &rtlpci->tx_ring[BEACON_QUEUE]; - - pskb = __skb_dequeue(&ring->queue); - if (pskb) - kfree_skb(pskb); - - spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); - - pdesc = &ring->desc[0]; - - rtlpriv->cfg->ops->fill_tx_cmddesc(hw, (u8 *) pdesc, 1, 1, skb); - - __skb_queue_tail(&ring->queue, skb); - - spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); - - rtlpriv->cfg->ops->tx_polling(hw, BEACON_QUEUE); - - return true; -} - -static u8 reserved_page_packet[TOTAL_RESERVED_PKT_LEN] = { - /* page 0 beacon */ - 0x80, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x50, 0x08, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x64, 0x00, 0x00, 0x04, 0x00, 0x0C, 0x6C, 0x69, - 0x6E, 0x6B, 0x73, 0x79, 0x73, 0x5F, 0x77, 0x6C, - 0x61, 0x6E, 0x01, 0x04, 0x82, 0x84, 0x8B, 0x96, - 0x03, 0x01, 0x01, 0x06, 0x02, 0x00, 0x00, 0x2A, - 0x01, 0x00, 0x32, 0x08, 0x24, 0x30, 0x48, 0x6C, - 0x0C, 0x12, 0x18, 0x60, 0x2D, 0x1A, 0x6C, 0x18, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3D, 0x00, 0xDD, 0x06, 0x00, 0xE0, 0x4C, 0x02, - 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 1 beacon */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 2 ps-poll */ - 0xA4, 0x10, 0x01, 0xC0, 0x00, 0x40, 0x10, 0x10, - 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 3 null */ - 0x48, 0x01, 0x00, 0x00, 0x00, 0x40, 0x10, 0x10, - 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x72, 0x00, 0x20, 0x8C, 0x00, 0x12, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 4 probe_resp */ - 0x50, 0x00, 0x00, 0x00, 0x00, 0x40, 0x10, 0x10, - 0x00, 0x03, 0x00, 0xE0, 0x4C, 0x76, 0x00, 0x42, - 0x00, 0x40, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, - 0x9E, 0x46, 0x15, 0x32, 0x27, 0xF2, 0x2D, 0x00, - 0x64, 0x00, 0x00, 0x04, 0x00, 0x0C, 0x6C, 0x69, - 0x6E, 0x6B, 0x73, 0x79, 0x73, 0x5F, 0x77, 0x6C, - 0x61, 0x6E, 0x01, 0x04, 0x82, 0x84, 0x8B, 0x96, - 0x03, 0x01, 0x01, 0x06, 0x02, 0x00, 0x00, 0x2A, - 0x01, 0x00, 0x32, 0x08, 0x24, 0x30, 0x48, 0x6C, - 0x0C, 0x12, 0x18, 0x60, 0x2D, 0x1A, 0x6C, 0x18, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3D, 0x00, 0xDD, 0x06, 0x00, 0xE0, 0x4C, 0x02, - 0x01, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - /* page 5 probe_resp */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -void rtl8723ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct sk_buff *skb = NULL; - - u32 totalpacketlen; - bool rtstatus; - u8 u1RsvdPageLoc[3] = { 0 }; - bool dlok = false; - - u8 *beacon; - u8 *p_pspoll; - u8 *nullfunc; - u8 *p_probersp; - /*--------------------------------------------------------- - (1) beacon - --------------------------------------------------------- - */ - beacon = &reserved_page_packet[BEACON_PG * 128]; - SET_80211_HDR_ADDRESS2(beacon, mac->mac_addr); - SET_80211_HDR_ADDRESS3(beacon, mac->bssid); - - /*------------------------------------------------------- - (2) ps-poll - -------------------------------------------------------- - */ - p_pspoll = &reserved_page_packet[PSPOLL_PG * 128]; - SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000)); - SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid); - SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr); - - SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG); - - /*-------------------------------------------------------- - (3) null data - ---------------------------------------------------------i - */ - nullfunc = &reserved_page_packet[NULL_PG * 128]; - SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid); - SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr); - SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid); - - SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1RsvdPageLoc, NULL_PG); - - /*--------------------------------------------------------- - (4) probe response - ---------------------------------------------------------- - */ - p_probersp = &reserved_page_packet[PROBERSP_PG * 128]; - SET_80211_HDR_ADDRESS1(p_probersp, mac->bssid); - SET_80211_HDR_ADDRESS2(p_probersp, mac->mac_addr); - SET_80211_HDR_ADDRESS3(p_probersp, mac->bssid); - - SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1RsvdPageLoc, PROBERSP_PG); - - totalpacketlen = TOTAL_RESERVED_PKT_LEN; - - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, - "rtl8723ae_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL\n", - &reserved_page_packet[0], totalpacketlen); - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "rtl8723ae_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL\n", - u1RsvdPageLoc, 3); - - skb = dev_alloc_skb(totalpacketlen); - memcpy((u8 *) skb_put(skb, totalpacketlen), - &reserved_page_packet, totalpacketlen); - - rtstatus = _rtl8723ae_cmd_send_packet(hw, skb); - - if (rtstatus) - dlok = true; - - if (dlok) { - RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, - "Set RSVD page location to Fw.\n"); - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "H2C_RSVDPAGE:\n", - u1RsvdPageLoc, 3); - rtl8723ae_fill_h2c_cmd(hw, H2C_RSVDPAGE, - sizeof(u1RsvdPageLoc), u1RsvdPageLoc); - } else - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Set RSVD page location to Fw FAIL!!!!!!.\n"); -} - -void rtl8723ae_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus) -{ - u8 u1_joinbssrpt_parm[1] = { 0 }; - - SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(u1_joinbssrpt_parm, mstatus); - - rtl8723ae_fill_h2c_cmd(hw, H2C_JOINBSSRPT, 1, u1_joinbssrpt_parm); -} - -static void rtl8723e_set_p2p_ctw_period_cmd(struct ieee80211_hw *hw, - u8 ctwindow) -{ - u8 u1_ctwindow_period[1] = {ctwindow}; - - rtl8723ae_fill_h2c_cmd(hw, H2C_P2P_PS_CTW_CMD, 1, u1_ctwindow_period); -} - -void rtl8723ae_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *rtlps = rtl_psc(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_p2p_ps_info *p2pinfo = &(rtlps->p2p_ps_info); - struct p2p_ps_offload_t *p2p_ps_offload = &rtlhal->p2p_ps_offload; - u8 i; - u16 ctwindow; - u32 start_time, tsf_low; - - switch (p2p_ps_state) { - case P2P_PS_DISABLE: - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_DISABLE\n"); - memset(p2p_ps_offload, 0, sizeof(struct p2p_ps_offload_t)); - break; - case P2P_PS_ENABLE: - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_ENABLE\n"); - /* update CTWindow value. */ - if (p2pinfo->ctwindow > 0) { - p2p_ps_offload->ctwindow_en = 1; - ctwindow = p2pinfo->ctwindow; - rtl8723e_set_p2p_ctw_period_cmd(hw, ctwindow); - } - - /* hw only support 2 set of NoA */ - for (i = 0; i < p2pinfo->noa_num; i++) { - /* To control the register setting for which NOA*/ - rtl_write_byte(rtlpriv, 0x5cf, (i << 4)); - if (i == 0) - p2p_ps_offload->noa0_en = 1; - else - p2p_ps_offload->noa1_en = 1; - - /* config P2P NoA Descriptor Register */ - rtl_write_dword(rtlpriv, 0x5E0, - p2pinfo->noa_duration[i]); - rtl_write_dword(rtlpriv, 0x5E4, - p2pinfo->noa_interval[i]); - - /*Get Current TSF value */ - tsf_low = rtl_read_dword(rtlpriv, REG_TSFTR); - - start_time = p2pinfo->noa_start_time[i]; - if (p2pinfo->noa_count_type[i] != 1) { - while (start_time <= (tsf_low+(50*1024))) { - start_time += p2pinfo->noa_interval[i]; - if (p2pinfo->noa_count_type[i] != 255) - p2pinfo->noa_count_type[i]--; - } - } - rtl_write_dword(rtlpriv, 0x5E8, start_time); - rtl_write_dword(rtlpriv, 0x5EC, - p2pinfo->noa_count_type[i]); - } - if ((p2pinfo->opp_ps == 1) || (p2pinfo->noa_num > 0)) { - /* rst p2p circuit */ - rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, BIT(4)); - - p2p_ps_offload->offload_en = 1; - - if (P2P_ROLE_GO == rtlpriv->mac80211.p2p) { - p2p_ps_offload->role = 1; - p2p_ps_offload->allstasleep = 0; - } else { - p2p_ps_offload->role = 0; - } - p2p_ps_offload->discovery = 0; - } - break; - case P2P_PS_SCAN: - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_SCAN\n"); - p2p_ps_offload->discovery = 1; - break; - case P2P_PS_SCAN_DONE: - RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "P2P_PS_SCAN_DONE\n"); - p2p_ps_offload->discovery = 0; - p2pinfo->p2p_ps_state = P2P_PS_ENABLE; - break; - default: - break; - } - rtl8723ae_fill_h2c_cmd(hw, H2C_P2P_PS_OFFLOAD, 1, (u8 *)p2p_ps_offload); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/fw.h b/drivers/net/wireless/rtlwifi/rtl8723ae/fw.h deleted file mode 100644 index ed3b795e6980..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/fw.h +++ /dev/null @@ -1,104 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * Larry Finger - * - **************************************************************************** - */ - -#ifndef __RTL92C__FW__H__ -#define __RTL92C__FW__H__ - -#define FW_8192C_START_ADDRESS 0x1000 -#define FW_8192C_END_ADDRESS 0x3FFF -#define FW_8192C_PAGE_SIZE 4096 -#define FW_8192C_POLLING_DELAY 5 -#define FW_8192C_POLLING_TIMEOUT_COUNT 1000 - -#define BEACON_PG 0 -#define PSPOLL_PG 2 -#define NULL_PG 3 -#define PROBERSP_PG 4 /* ->5 */ - -#define TOTAL_RESERVED_PKT_LEN 768 - -#define IS_FW_HEADER_EXIST(_pfwhdr) \ - ((_pfwhdr->signature&0xFF00) == 0x2300) - -struct rtl8723ae_firmware_header { - u16 signature; - u8 category; - u8 function; - u16 version; - u8 subversion; - u8 rsvd1; - u8 month; - u8 date; - u8 hour; - u8 minute; - u16 ramcodeSize; - u16 rsvd2; - u32 svnindex; - u32 rsvd3; - u32 rsvd4; - u32 rsvd5; -}; - -enum rtl8192c_h2c_cmd { - H2C_AP_OFFLOAD = 0, - H2C_SETPWRMODE = 1, - H2C_JOINBSSRPT = 2, - H2C_RSVDPAGE = 3, - H2C_RSSI_REPORT = 4, - H2C_P2P_PS_CTW_CMD = 5, - H2C_P2P_PS_OFFLOAD = 6, - H2C_RA_MASK = 7, - MAX_H2CCMD -}; - -#define SET_H2CCMD_PWRMODE_PARM_MODE(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_PWRMODE_PARM_SMART_PS(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val) -#define SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val) -#define SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val) - -int rtl8723ae_download_fw(struct ieee80211_hw *hw); -void rtl8723ae_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id, - u32 cmd_len, u8 *p_cmdbuffer); -void rtl8723ae_firmware_selfreset(struct ieee80211_hw *hw); -void rtl8723ae_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); -void rtl8723ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished); -void rtl8723ae_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); -void rtl8723ae_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/hal_bt_coexist.c b/drivers/net/wireless/rtlwifi/rtl8723ae/hal_bt_coexist.c deleted file mode 100644 index 3d092e4b0b7f..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/hal_bt_coexist.c +++ /dev/null @@ -1,542 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "hal_bt_coexist.h" -#include "../pci.h" -#include "dm.h" -#include "fw.h" -#include "phy.h" -#include "reg.h" -#include "hal_btc.h" - -void rtl8723ae_dm_bt_reject_ap_aggregated_packet(struct ieee80211_hw *hw, - bool reject) -{ -} - -void _rtl8723_dm_bt_check_wifi_state(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - if (rtlpriv->link_info.busytraffic) { - rtlpcipriv->bt_coexist.cstate &= ~BT_COEX_STATE_WIFI_IDLE; - - if (rtlpriv->link_info.tx_busy_traffic) - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_WIFI_UPLINK; - else - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_UPLINK; - - if (rtlpriv->link_info.rx_busy_traffic) - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_WIFI_DOWNLINK; - else - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_DOWNLINK; - } else { - rtlpcipriv->bt_coexist.cstate |= BT_COEX_STATE_WIFI_IDLE; - rtlpcipriv->bt_coexist.cstate &= ~BT_COEX_STATE_WIFI_UPLINK; - rtlpcipriv->bt_coexist.cstate &= ~BT_COEX_STATE_WIFI_DOWNLINK; - } - - if (rtlpriv->mac80211.mode == WIRELESS_MODE_G || - rtlpriv->mac80211.mode == WIRELESS_MODE_B) { - rtlpcipriv->bt_coexist.cstate |= BT_COEX_STATE_WIFI_LEGACY; - rtlpcipriv->bt_coexist.cstate &= ~BT_COEX_STATE_WIFI_HT20; - rtlpcipriv->bt_coexist.cstate &= ~BT_COEX_STATE_WIFI_HT40; - } else { - rtlpcipriv->bt_coexist.cstate &= ~BT_COEX_STATE_WIFI_LEGACY; - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_WIFI_HT40; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_HT20; - } else { - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_WIFI_HT20; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_HT40; - } - } - - if (rtlpriv->bt_operation_on) - rtlpcipriv->bt_coexist.cstate |= BT_COEX_STATE_BT30; - else - rtlpcipriv->bt_coexist.cstate &= ~BT_COEX_STATE_BT30; -} - -u8 rtl8723ae_dm_bt_check_coex_rssi_state1(struct ieee80211_hw *hw, - u8 level_num, u8 rssi_thresh, - u8 rssi_thresh1) - -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - long smooth; - u8 bt_rssi_state = 0; - - smooth = rtl8723ae_dm_bt_get_rx_ss(hw); - - if (level_num == 2) { - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_RSSI_1_MEDIUM; - - if ((rtlpcipriv->bt_coexist.bt_pre_rssi_state == - BT_RSSI_STATE_LOW) || - (rtlpcipriv->bt_coexist.bt_pre_rssi_state == - BT_RSSI_STATE_STAY_LOW)) { - if (smooth >= (rssi_thresh + - BT_FW_COEX_THRESH_TOL)) { - bt_rssi_state = BT_RSSI_STATE_HIGH; - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_WIFI_RSSI_1_HIGH; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_RSSI_1_LOW; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI_1 state switch to High\n"); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_LOW; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI_1 state stay at Low\n"); - } - } else { - if (smooth < rssi_thresh) { - bt_rssi_state = BT_RSSI_STATE_LOW; - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_WIFI_RSSI_1_LOW; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_RSSI_1_HIGH; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI_1 state switch to Low\n"); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_HIGH; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI_1 state stay at High\n"); - } - } - } else if (level_num == 3) { - if (rssi_thresh > rssi_thresh1) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI_1 thresh error!!\n"); - return rtlpcipriv->bt_coexist.bt_pre_rssi_state; - } - - if ((rtlpcipriv->bt_coexist.bt_pre_rssi_state == - BT_RSSI_STATE_LOW) || - (rtlpcipriv->bt_coexist.bt_pre_rssi_state == - BT_RSSI_STATE_STAY_LOW)) { - if (smooth >= - (rssi_thresh+BT_FW_COEX_THRESH_TOL)) { - bt_rssi_state = BT_RSSI_STATE_MEDIUM; - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_WIFI_RSSI_1_MEDIUM; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_RSSI_1_LOW; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_RSSI_1_HIGH; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI_1 state switch to Medium\n"); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_LOW; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI_1 state stay at Low\n"); - } - } else if ((rtlpcipriv->bt_coexist.bt_pre_rssi_state == - BT_RSSI_STATE_MEDIUM) || - (rtlpcipriv->bt_coexist.bt_pre_rssi_state == - BT_RSSI_STATE_STAY_MEDIUM)) { - if (smooth >= (rssi_thresh1 + - BT_FW_COEX_THRESH_TOL)) { - bt_rssi_state = BT_RSSI_STATE_HIGH; - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_WIFI_RSSI_1_HIGH; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_RSSI_1_LOW; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_RSSI_1_MEDIUM; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI_1 state switch to High\n"); - } else if (smooth < rssi_thresh) { - bt_rssi_state = BT_RSSI_STATE_LOW; - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_WIFI_RSSI_1_LOW; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_RSSI_1_HIGH; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_RSSI_1_MEDIUM; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI_1 state switch to Low\n"); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_MEDIUM; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI_1 state stay at Medium\n"); - } - } else { - if (smooth < rssi_thresh1) { - bt_rssi_state = BT_RSSI_STATE_MEDIUM; - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_WIFI_RSSI_1_MEDIUM; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_RSSI_1_HIGH; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_RSSI_1_LOW; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI_1 state switch to Medium\n"); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_HIGH; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI_1 state stay at High\n"); - } - } - } - - rtlpcipriv->bt_coexist.bt_pre_rssi_state1 = bt_rssi_state; - - return bt_rssi_state; -} - -u8 rtl8723ae_dm_bt_check_coex_rssi_state(struct ieee80211_hw *hw, - u8 level_num, u8 rssi_thresh, - u8 rssi_thresh1) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - long smooth; - u8 bt_rssi_state = 0; - - smooth = rtl8723ae_dm_bt_get_rx_ss(hw); - - if (level_num == 2) { - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_RSSI_MEDIUM; - - if ((rtlpcipriv->bt_coexist.bt_pre_rssi_state == - BT_RSSI_STATE_LOW) || - (rtlpcipriv->bt_coexist.bt_pre_rssi_state == - BT_RSSI_STATE_STAY_LOW)){ - if (smooth >= - (rssi_thresh + BT_FW_COEX_THRESH_TOL)) { - bt_rssi_state = BT_RSSI_STATE_HIGH; - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_WIFI_RSSI_HIGH; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_RSSI_LOW; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI state switch to High\n"); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_LOW; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI state stay at Low\n"); - } - } else { - if (smooth < rssi_thresh) { - bt_rssi_state = BT_RSSI_STATE_LOW; - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_WIFI_RSSI_LOW; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_WIFI_RSSI_HIGH; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI state switch to Low\n"); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_HIGH; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI state stay at High\n"); - } - } - } else if (level_num == 3) { - if (rssi_thresh > rssi_thresh1) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI thresh error!!\n"); - return rtlpcipriv->bt_coexist.bt_pre_rssi_state; - } - if ((rtlpcipriv->bt_coexist.bt_pre_rssi_state == - BT_RSSI_STATE_LOW) || - (rtlpcipriv->bt_coexist.bt_pre_rssi_state == - BT_RSSI_STATE_STAY_LOW)) { - if (smooth >= - (rssi_thresh + BT_FW_COEX_THRESH_TOL)) { - bt_rssi_state = BT_RSSI_STATE_MEDIUM; - rtlpcipriv->bt_coexist.cstate - |= BT_COEX_STATE_WIFI_RSSI_MEDIUM; - rtlpcipriv->bt_coexist.cstate - &= ~BT_COEX_STATE_WIFI_RSSI_LOW; - rtlpcipriv->bt_coexist.cstate - &= ~BT_COEX_STATE_WIFI_RSSI_HIGH; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI state switch to Medium\n"); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_LOW; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI state stay at Low\n"); - } - } else if ((rtlpcipriv->bt_coexist.bt_pre_rssi_state == - BT_RSSI_STATE_MEDIUM) || - (rtlpcipriv->bt_coexist.bt_pre_rssi_state == - BT_RSSI_STATE_STAY_MEDIUM)) { - if (smooth >= - (rssi_thresh1 + BT_FW_COEX_THRESH_TOL)) { - bt_rssi_state = BT_RSSI_STATE_HIGH; - rtlpcipriv->bt_coexist.cstate - |= BT_COEX_STATE_WIFI_RSSI_HIGH; - rtlpcipriv->bt_coexist.cstate - &= ~BT_COEX_STATE_WIFI_RSSI_LOW; - rtlpcipriv->bt_coexist.cstate - &= ~BT_COEX_STATE_WIFI_RSSI_MEDIUM; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI state switch to High\n"); - } else if (smooth < rssi_thresh) { - bt_rssi_state = BT_RSSI_STATE_LOW; - rtlpcipriv->bt_coexist.cstate - |= BT_COEX_STATE_WIFI_RSSI_LOW; - rtlpcipriv->bt_coexist.cstate - &= ~BT_COEX_STATE_WIFI_RSSI_HIGH; - rtlpcipriv->bt_coexist.cstate - &= ~BT_COEX_STATE_WIFI_RSSI_MEDIUM; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI state switch to Low\n"); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_MEDIUM; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI state stay at Medium\n"); - } - } else { - if (smooth < rssi_thresh1) { - bt_rssi_state = BT_RSSI_STATE_MEDIUM; - rtlpcipriv->bt_coexist.cstate - |= BT_COEX_STATE_WIFI_RSSI_MEDIUM; - rtlpcipriv->bt_coexist.cstate - &= ~BT_COEX_STATE_WIFI_RSSI_HIGH; - rtlpcipriv->bt_coexist.cstate - &= ~BT_COEX_STATE_WIFI_RSSI_LOW; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI state switch to Medium\n"); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_HIGH; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], RSSI state stay at High\n"); - } - } - } - - rtlpcipriv->bt_coexist.bt_pre_rssi_state = bt_rssi_state; - return bt_rssi_state; -} - -long rtl8723ae_dm_bt_get_rx_ss(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - long smooth = 0; - - if (rtlpriv->mac80211.link_state >= MAC80211_LINKED) - smooth = GET_UNDECORATED_AVERAGE_RSSI(rtlpriv); - else - smooth = rtlpriv->dm.entry_min_undec_sm_pwdb; - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "rtl8723ae_dm_bt_get_rx_ss() = %ld\n", smooth); - - return smooth; -} - -void rtl8723ae_dm_bt_balance(struct ieee80211_hw *hw, - bool balance_on, u8 ms0, u8 ms1) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[3] = {0}; - - if (balance_on) { - h2c_parameter[2] = 1; - h2c_parameter[1] = ms1; - h2c_parameter[0] = ms0; - rtlpcipriv->bt_coexist.fw_coexist_all_off = false; - } else { - h2c_parameter[2] = 0; - h2c_parameter[1] = 0; - h2c_parameter[0] = 0; - } - rtlpcipriv->bt_coexist.balance_on = balance_on; - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[DM][BT], Balance=[%s:%dms:%dms], write 0xc=0x%x\n", - balance_on ? "ON" : "OFF", ms0, ms1, - h2c_parameter[0]<<16 | h2c_parameter[1]<<8 | h2c_parameter[2]); - - rtl8723ae_fill_h2c_cmd(hw, 0xc, 3, h2c_parameter); -} - - -void rtl8723ae_dm_bt_agc_table(struct ieee80211_hw *hw, u8 type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - if (type == BT_AGCTABLE_OFF) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BT]AGCTable Off!\n"); - rtl_write_dword(rtlpriv, 0xc78, 0x641c0001); - rtl_write_dword(rtlpriv, 0xc78, 0x631d0001); - rtl_write_dword(rtlpriv, 0xc78, 0x621e0001); - rtl_write_dword(rtlpriv, 0xc78, 0x611f0001); - rtl_write_dword(rtlpriv, 0xc78, 0x60200001); - - rtl8723ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0x32000); - rtl8723ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0x71000); - rtl8723ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0xb0000); - rtl8723ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0xfc000); - rtl8723ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_G1, 0xfffff, 0x30355); - } else if (type == BT_AGCTABLE_ON) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BT]AGCTable On!\n"); - rtl_write_dword(rtlpriv, 0xc78, 0x4e1c0001); - rtl_write_dword(rtlpriv, 0xc78, 0x4d1d0001); - rtl_write_dword(rtlpriv, 0xc78, 0x4c1e0001); - rtl_write_dword(rtlpriv, 0xc78, 0x4b1f0001); - rtl_write_dword(rtlpriv, 0xc78, 0x4a200001); - - rtl8723ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0xdc000); - rtl8723ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0x90000); - rtl8723ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0x51000); - rtl8723ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0x12000); - rtl8723ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_G1, 0xfffff, 0x00355); - - rtlpcipriv->bt_coexist.sw_coexist_all_off = false; - } -} - -void rtl8723ae_dm_bt_bback_off_level(struct ieee80211_hw *hw, u8 type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - if (type == BT_BB_BACKOFF_OFF) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BT]BBBackOffLevel Off!\n"); - rtl_write_dword(rtlpriv, 0xc04, 0x3a05611); - } else if (type == BT_BB_BACKOFF_ON) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BT]BBBackOffLevel On!\n"); - rtl_write_dword(rtlpriv, 0xc04, 0x3a07611); - rtlpcipriv->bt_coexist.sw_coexist_all_off = false; - } -} - -void rtl8723ae_dm_bt_fw_coex_all_off(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "rtl8723ae_dm_bt_fw_coex_all_off()\n"); - - if (rtlpcipriv->bt_coexist.fw_coexist_all_off) - return; - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "rtl8723ae_dm_bt_fw_coex_all_off(), real Do\n"); - rtl8723ae_dm_bt_fw_coex_all_off_8723a(hw); - rtlpcipriv->bt_coexist.fw_coexist_all_off = true; -} - -void rtl8723ae_dm_bt_sw_coex_all_off(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "rtl8723ae_dm_bt_sw_coex_all_off()\n"); - - if (rtlpcipriv->bt_coexist.sw_coexist_all_off) - return; - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "rtl8723ae_dm_bt_sw_coex_all_off(), real Do\n"); - rtl8723ae_dm_bt_sw_coex_all_off_8723a(hw); - rtlpcipriv->bt_coexist.sw_coexist_all_off = true; -} - -void rtl8723ae_dm_bt_hw_coex_all_off(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "rtl8723ae_dm_bt_hw_coex_all_off()\n"); - - if (rtlpcipriv->bt_coexist.hw_coexist_all_off) - return; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "rtl8723ae_dm_bt_hw_coex_all_off(), real Do\n"); - - rtl8723ae_dm_bt_hw_coex_all_off_8723a(hw); - - rtlpcipriv->bt_coexist.hw_coexist_all_off = true; -} - -void rtl8723ae_btdm_coex_all_off(struct ieee80211_hw *hw) -{ - rtl8723ae_dm_bt_fw_coex_all_off(hw); - rtl8723ae_dm_bt_sw_coex_all_off(hw); - rtl8723ae_dm_bt_hw_coex_all_off(hw); -} - -bool rtl8723ae_dm_bt_is_coexist_state_changed(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - if ((rtlpcipriv->bt_coexist.previous_state == - rtlpcipriv->bt_coexist.cstate) && - (rtlpcipriv->bt_coexist.previous_state_h == - rtlpcipriv->bt_coexist.cstate_h)) - return false; - else - return true; -} - -bool rtl8723ae_dm_bt_is_wifi_up_link(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->link_info.tx_busy_traffic) - return true; - else - return false; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/hal_bt_coexist.h b/drivers/net/wireless/rtlwifi/rtl8723ae/hal_bt_coexist.h deleted file mode 100644 index 76f4d122dbc1..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/hal_bt_coexist.h +++ /dev/null @@ -1,160 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL8723E_HAL_BT_COEXIST_H__ -#define __RTL8723E_HAL_BT_COEXIST_H__ - -#include "../wifi.h" - -/* The reg define is for 8723 */ -#define REG_HIGH_PRIORITY_TXRX 0x770 -#define REG_LOW_PRIORITY_TXRX 0x774 - -#define BT_FW_COEX_THRESH_TOL 6 -#define BT_FW_COEX_THRESH_20 20 -#define BT_FW_COEX_THRESH_23 23 -#define BT_FW_COEX_THRESH_25 25 -#define BT_FW_COEX_THRESH_30 30 -#define BT_FW_COEX_THRESH_35 35 -#define BT_FW_COEX_THRESH_40 40 -#define BT_FW_COEX_THRESH_45 45 -#define BT_FW_COEX_THRESH_47 47 -#define BT_FW_COEX_THRESH_50 50 -#define BT_FW_COEX_THRESH_55 55 - -#define BT_COEX_STATE_BT30 BIT(0) -#define BT_COEX_STATE_WIFI_HT20 BIT(1) -#define BT_COEX_STATE_WIFI_HT40 BIT(2) -#define BT_COEX_STATE_WIFI_LEGACY BIT(3) - -#define BT_COEX_STATE_WIFI_RSSI_LOW BIT(4) -#define BT_COEX_STATE_WIFI_RSSI_MEDIUM BIT(5) -#define BT_COEX_STATE_WIFI_RSSI_HIGH BIT(6) -#define BT_COEX_STATE_DEC_BT_POWER BIT(7) - -#define BT_COEX_STATE_WIFI_IDLE BIT(8) -#define BT_COEX_STATE_WIFI_UPLINK BIT(9) -#define BT_COEX_STATE_WIFI_DOWNLINK BIT(10) - -#define BT_COEX_STATE_BT_INQ_PAGE BIT(11) -#define BT_COEX_STATE_BT_IDLE BIT(12) -#define BT_COEX_STATE_BT_UPLINK BIT(13) -#define BT_COEX_STATE_BT_DOWNLINK BIT(14) - -#define BT_COEX_STATE_HOLD_FOR_BT_OPERATION BIT(15) -#define BT_COEX_STATE_BT_RSSI_LOW BIT(19) - -#define BT_COEX_STATE_PROFILE_HID BIT(20) -#define BT_COEX_STATE_PROFILE_A2DP BIT(21) -#define BT_COEX_STATE_PROFILE_PAN BIT(22) -#define BT_COEX_STATE_PROFILE_SCO BIT(23) - -#define BT_COEX_STATE_WIFI_RSSI_1_LOW BIT(24) -#define BT_COEX_STATE_WIFI_RSSI_1_MEDIUM BIT(25) -#define BT_COEX_STATE_WIFI_RSSI_1_HIGH BIT(26) - -#define BT_COEX_STATE_BTINFO_COMMON BIT(30) -#define BT_COEX_STATE_BTINFO_B_HID_SCOESCO BIT(31) -#define BT_COEX_STATE_BTINFO_B_FTP_A2DP BIT(29) - -#define BT_COEX_STATE_BT_CNT_LEVEL_0 BIT(0) -#define BT_COEX_STATE_BT_CNT_LEVEL_1 BIT(1) -#define BT_COEX_STATE_BT_CNT_LEVEL_2 BIT(2) -#define BT_COEX_STATE_BT_CNT_LEVEL_3 BIT(3) - -#define BT_RSSI_STATE_HIGH 0 -#define BT_RSSI_STATE_MEDIUM 1 -#define BT_RSSI_STATE_LOW 2 -#define BT_RSSI_STATE_STAY_HIGH 3 -#define BT_RSSI_STATE_STAY_MEDIUM 4 -#define BT_RSSI_STATE_STAY_LOW 5 - -#define BT_AGCTABLE_OFF 0 -#define BT_AGCTABLE_ON 1 -#define BT_BB_BACKOFF_OFF 0 -#define BT_BB_BACKOFF_ON 1 -#define BT_FW_NAV_OFF 0 -#define BT_FW_NAV_ON 1 - -#define BT_COEX_MECH_NONE 0 -#define BT_COEX_MECH_SCO 1 -#define BT_COEX_MECH_HID 2 -#define BT_COEX_MECH_A2DP 3 -#define BT_COEX_MECH_PAN 4 -#define BT_COEX_MECH_HID_A2DP 5 -#define BT_COEX_MECH_HID_PAN 6 -#define BT_COEX_MECH_PAN_A2DP 7 -#define BT_COEX_MECH_HID_SCO_ESCO 8 -#define BT_COEX_MECH_FTP_A2DP 9 -#define BT_COEX_MECH_COMMON 10 -#define BT_COEX_MECH_MAX 11 - -#define BT_DBG_PROFILE_NONE 0 -#define BT_DBG_PROFILE_SCO 1 -#define BT_DBG_PROFILE_HID 2 -#define BT_DBG_PROFILE_A2DP 3 -#define BT_DBG_PROFILE_PAN 4 -#define BT_DBG_PROFILE_HID_A2DP 5 -#define BT_DBG_PROFILE_HID_PAN 6 -#define BT_DBG_PROFILE_PAN_A2DP 7 -#define BT_DBG_PROFILE_MAX 9 - -#define BTINFO_B_FTP BIT(7) -#define BTINFO_B_A2DP BIT(6) -#define BTINFO_B_HID BIT(5) -#define BTINFO_B_SCO_BUSY BIT(4) -#define BTINFO_B_ACL_BUSY BIT(3) -#define BTINFO_B_INQ_PAGE BIT(2) -#define BTINFO_B_SCO_ESCO BIT(1) -#define BTINFO_B_CONNECTION BIT(0) - - -void rtl8723ae_btdm_coex_all_off(struct ieee80211_hw *hw); -void rtl8723ae_dm_bt_fw_coex_all_off(struct ieee80211_hw *hw); - -void rtl8723ae_dm_bt_sw_coex_all_off(struct ieee80211_hw *hw); -void rtl8723ae_dm_bt_hw_coex_all_off(struct ieee80211_hw *hw); -long rtl8723ae_dm_bt_get_rx_ss(struct ieee80211_hw *hw); -void rtl8723ae_dm_bt_balance(struct ieee80211_hw *hw, - bool balance_on, u8 ms0, u8 ms1); -void rtl8723ae_dm_bt_agc_table(struct ieee80211_hw *hw, u8 type); -void rtl8723ae_dm_bt_bback_off_level(struct ieee80211_hw *hw, u8 type); -u8 rtl8723ae_dm_bt_check_coex_rssi_state(struct ieee80211_hw *hw, - u8 level_num, u8 rssi_thresh, - u8 rssi_thresh1); -u8 rtl8723ae_dm_bt_check_coex_rssi_state1(struct ieee80211_hw *hw, - u8 level_num, u8 rssi_thresh, - u8 rssi_thresh1); -void _rtl8723_dm_bt_check_wifi_state(struct ieee80211_hw *hw); -void rtl8723ae_dm_bt_reject_ap_aggregated_packet(struct ieee80211_hw *hw, - bool reject); - -bool rtl8723ae_dm_bt_is_coexist_state_changed(struct ieee80211_hw *hw); -bool rtl8723ae_dm_bt_is_wifi_up_link(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/hal_btc.c b/drivers/net/wireless/rtlwifi/rtl8723ae/hal_btc.c deleted file mode 100644 index 68c28340f791..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/hal_btc.c +++ /dev/null @@ -1,1784 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - **************************************************************************** - */ -#include "hal_btc.h" -#include "../pci.h" -#include "phy.h" -#include "fw.h" -#include "reg.h" -#include "def.h" - -void rtl8723ae_bt_coex_off_before_lps(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - if (!rtlpcipriv->bt_coexist.bt_coexistence) - return; - - if (ppsc->inactiveps) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BT][DM], Before enter IPS, turn off all Coexist DM\n"); - rtlpcipriv->bt_coexist.cstate = 0; - rtlpcipriv->bt_coexist.previous_state = 0; - rtlpcipriv->bt_coexist.cstate_h = 0; - rtlpcipriv->bt_coexist.previous_state_h = 0; - rtl8723ae_btdm_coex_all_off(hw); - } -} - -static enum _RT_MEDIA_STATUS mgnt_link_status_query(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - enum _RT_MEDIA_STATUS m_status = RT_MEDIA_DISCONNECT; - - u8 bibss = (mac->opmode == NL80211_IFTYPE_ADHOC) ? 1 : 0; - - if (bibss || rtlpriv->mac80211.link_state >= MAC80211_LINKED) - m_status = RT_MEDIA_CONNECT; - - return m_status; -} - -void rtl_8723e_bt_wifi_media_status_notify(struct ieee80211_hw *hw, - bool mstatus) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u8 h2c_parameter[3] = {0}; - u8 chnl; - - if (!rtlpcipriv->bt_coexist.bt_coexistence) - return; - - if (RT_MEDIA_CONNECT == mstatus) - h2c_parameter[0] = 0x1; /* 0: disconnected, 1:connected */ - else - h2c_parameter[0] = 0x0; - - if (mgnt_link_status_query(hw)) { - chnl = rtlphy->current_channel; - h2c_parameter[1] = chnl; - } - - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) - h2c_parameter[2] = 0x30; - else - h2c_parameter[2] = 0x20; - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], FW write 0x19 = 0x%x\n", - h2c_parameter[0]<<16|h2c_parameter[1]<<8|h2c_parameter[2]); - - rtl8723ae_fill_h2c_cmd(hw, 0x19, 3, h2c_parameter); - -} - -static bool rtl8723ae_dm_bt_is_wifi_busy(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - if (rtlpriv->link_info.busytraffic || - rtlpriv->link_info.rx_busy_traffic || - rtlpriv->link_info.tx_busy_traffic) - return true; - else - return false; -} - -static void rtl8723ae_dm_bt_set_fw_3a(struct ieee80211_hw *hw, - u8 byte1, u8 byte2, u8 byte3, - u8 byte4, u8 byte5) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[5] = {0}; - - h2c_parameter[0] = byte1; - h2c_parameter[1] = byte2; - h2c_parameter[2] = byte3; - h2c_parameter[3] = byte4; - h2c_parameter[4] = byte5; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], FW write 0x3a(4bytes) = 0x%x%8x\n", - h2c_parameter[0], h2c_parameter[1]<<24 | h2c_parameter[2]<<16 | - h2c_parameter[3]<<8 | h2c_parameter[4]); - rtl8723ae_fill_h2c_cmd(hw, 0x3a, 5, h2c_parameter); -} - -static bool rtl8723ae_dm_bt_need_to_dec_bt_pwr(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (mgnt_link_status_query(hw) == RT_MEDIA_CONNECT) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Need to decrease bt power\n"); - rtlpcipriv->bt_coexist.cstate |= BT_COEX_STATE_DEC_BT_POWER; - return true; - } - - rtlpcipriv->bt_coexist.cstate &= ~BT_COEX_STATE_DEC_BT_POWER; - return false; -} - -static bool rtl8723ae_dm_bt_is_same_coexist_state(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - if ((rtlpcipriv->bt_coexist.previous_state == - rtlpcipriv->bt_coexist.cstate) && - (rtlpcipriv->bt_coexist.previous_state_h == - rtlpcipriv->bt_coexist.cstate_h)) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[DM][BT], Coexist state do not chang!!\n"); - return true; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[DM][BT], Coexist state changed!!\n"); - return false; - } -} - -static void rtl8723ae_dm_bt_set_coex_table(struct ieee80211_hw *hw, - u32 val_0x6c0, u32 val_0x6c8, - u32 val_0x6cc) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "set coex table, set 0x6c0 = 0x%x\n", val_0x6c0); - rtl_write_dword(rtlpriv, 0x6c0, val_0x6c0); - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "set coex table, set 0x6c8 = 0x%x\n", val_0x6c8); - rtl_write_dword(rtlpriv, 0x6c8, val_0x6c8); - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "set coex table, set 0x6cc = 0x%x\n", val_0x6cc); - rtl_write_byte(rtlpriv, 0x6cc, val_0x6cc); -} - -static void rtl8723ae_dm_bt_set_hw_pta_mode(struct ieee80211_hw *hw, bool mode) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (BT_PTA_MODE_ON == mode) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, "PTA mode on, "); - /* Enable GPIO 0/1/2/3/8 pins for bt */ - rtl_write_byte(rtlpriv, 0x40, 0x20); - rtlpcipriv->bt_coexist.hw_coexist_all_off = false; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, "PTA mode off\n"); - rtl_write_byte(rtlpriv, 0x40, 0x0); - } -} - -static void rtl8723ae_dm_bt_set_sw_rf_rx_lpf_corner(struct ieee80211_hw *hw, - u8 type) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (BT_RF_RX_LPF_CORNER_SHRINK == type) { - /* Shrink RF Rx LPF corner, 0x1e[7:4]=1111 ==> [11:4] by Jenyu*/ - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "Shrink RF Rx LPF corner!!\n"); - rtl8723ae_phy_set_rf_reg(hw, RF90_PATH_A, 0x1e, 0xfffff, - 0xf0ff7); - rtlpcipriv->bt_coexist.sw_coexist_all_off = false; - } else if (BT_RF_RX_LPF_CORNER_RESUME == type) { - /*Resume RF Rx LPF corner*/ - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "Resume RF Rx LPF corner!!\n"); - rtl8723ae_phy_set_rf_reg(hw, RF90_PATH_A, 0x1e, 0xfffff, - rtlpcipriv->bt_coexist.bt_rfreg_origin_1e); - } -} - -static void rtl8723ae_bt_set_penalty_tx_rate_adap(struct ieee80211_hw *hw, - u8 ra_type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u8 tmu1; - - tmu1 = rtl_read_byte(rtlpriv, 0x4fd); - tmu1 |= BIT(0); - if (BT_TX_RATE_ADAPTIVE_LOW_PENALTY == ra_type) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "Tx rate adaptive, set low penalty!!\n"); - tmu1 &= ~BIT(2); - rtlpcipriv->bt_coexist.sw_coexist_all_off = false; - } else if (BT_TX_RATE_ADAPTIVE_NORMAL == ra_type) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "Tx rate adaptive, set normal!!\n"); - tmu1 |= BIT(2); - } - rtl_write_byte(rtlpriv, 0x4fd, tmu1); -} - -static void rtl8723ae_dm_bt_btdm_structure_reload(struct ieee80211_hw *hw, - struct btdm_8723 *btdm) -{ - btdm->all_off = false; - btdm->agc_table_en = false; - btdm->adc_back_off_on = false; - btdm->b2_ant_hid_en = false; - btdm->low_penalty_rate_adaptive = false; - btdm->rf_rx_lpf_shrink = false; - btdm->reject_aggre_pkt = false; - - btdm->tdma_on = false; - btdm->tdma_ant = TDMA_2ANT; - btdm->tdma_nav = TDMA_NAV_OFF; - btdm->tdma_dac_swing = TDMA_DAC_SWING_OFF; - btdm->fw_dac_swing_lvl = 0x20; - - btdm->tra_tdma_on = false; - btdm->tra_tdma_ant = TDMA_2ANT; - btdm->tra_tdma_nav = TDMA_NAV_OFF; - btdm->ignore_wlan_act = false; - - btdm->ps_tdma_on = false; - btdm->ps_tdma_byte[0] = 0x0; - btdm->ps_tdma_byte[1] = 0x0; - btdm->ps_tdma_byte[2] = 0x0; - btdm->ps_tdma_byte[3] = 0x8; - btdm->ps_tdma_byte[4] = 0x0; - - btdm->pta_on = true; - btdm->val_0x6c0 = 0x5a5aaaaa; - btdm->val_0x6c8 = 0xcc; - btdm->val_0x6cc = 0x3; - - btdm->sw_dac_swing_on = false; - btdm->sw_dac_swing_lvl = 0xc0; - btdm->wlan_act_hi = 0x20; - btdm->wlan_act_lo = 0x10; - btdm->bt_retry_index = 2; - - btdm->dec_bt_pwr = false; -} - -static void dm_bt_btdm_structure_reload_all_off(struct ieee80211_hw *hw, - struct btdm_8723 *btdm) -{ - rtl8723ae_dm_bt_btdm_structure_reload(hw, btdm); - btdm->all_off = true; - btdm->pta_on = false; - btdm->wlan_act_hi = 0x10; -} - -static bool rtl8723ae_dm_bt_is_2_ant_common_action(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct btdm_8723 btdm8723; - bool common = false; - - rtl8723ae_dm_bt_btdm_structure_reload(hw, &btdm8723); - - if (!rtl8723ae_dm_bt_is_wifi_busy(hw) - && !rtlpcipriv->bt_coexist.bt_busy) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Wifi idle + Bt idle, bt coex mechanism always off!!\n"); - dm_bt_btdm_structure_reload_all_off(hw, &btdm8723); - common = true; - } else if (rtl8723ae_dm_bt_is_wifi_busy(hw) - && !rtlpcipriv->bt_coexist.bt_busy) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Wifi non-idle + Bt disabled/idle!!\n"); - btdm8723.low_penalty_rate_adaptive = true; - btdm8723.rf_rx_lpf_shrink = false; - btdm8723.reject_aggre_pkt = false; - - /* sw mechanism */ - btdm8723.agc_table_en = false; - btdm8723.adc_back_off_on = false; - btdm8723.sw_dac_swing_on = false; - - btdm8723.pta_on = true; - btdm8723.val_0x6c0 = 0x5a5aaaaa; - btdm8723.val_0x6c8 = 0xcccc; - btdm8723.val_0x6cc = 0x3; - - btdm8723.tdma_on = false; - btdm8723.tdma_dac_swing = TDMA_DAC_SWING_OFF; - btdm8723.b2_ant_hid_en = false; - - common = true; - } else if (rtlpcipriv->bt_coexist.bt_busy) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Bt non-idle!\n"); - if (mgnt_link_status_query(hw) == RT_MEDIA_CONNECT) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Wifi connection exist\n"); - common = false; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "No Wifi connection!\n"); - btdm8723.rf_rx_lpf_shrink = true; - btdm8723.low_penalty_rate_adaptive = false; - btdm8723.reject_aggre_pkt = false; - - /* sw mechanism */ - btdm8723.agc_table_en = false; - btdm8723.adc_back_off_on = false; - btdm8723.sw_dac_swing_on = false; - - btdm8723.pta_on = true; - btdm8723.val_0x6c0 = 0x55555555; - btdm8723.val_0x6c8 = 0x0000ffff; - btdm8723.val_0x6cc = 0x3; - - btdm8723.tdma_on = false; - btdm8723.tdma_dac_swing = TDMA_DAC_SWING_OFF; - btdm8723.b2_ant_hid_en = false; - - common = true; - } - } - - if (rtl8723ae_dm_bt_need_to_dec_bt_pwr(hw)) - btdm8723.dec_bt_pwr = true; - - if (common) - rtlpcipriv->bt_coexist.cstate |= BT_COEX_STATE_BTINFO_COMMON; - - if (common && rtl8723ae_dm_bt_is_coexist_state_changed(hw)) - rtl8723ae_dm_bt_set_bt_dm(hw, &btdm8723); - - return common; -} - -static void rtl8723ae_dm_bt_set_sw_full_time_dac_swing(struct ieee80211_hw *hw, - bool sw_dac_swing_on, - u32 sw_dac_swing_lvl) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (sw_dac_swing_on) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], SwDacSwing = 0x%x\n", sw_dac_swing_lvl); - rtl8723ae_phy_set_bb_reg(hw, 0x880, 0xff000000, - sw_dac_swing_lvl); - rtlpcipriv->bt_coexist.sw_coexist_all_off = false; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], SwDacSwing Off!\n"); - rtl8723ae_phy_set_bb_reg(hw, 0x880, 0xff000000, 0xc0); - } -} - -static void rtl8723ae_dm_bt_set_fw_dec_bt_pwr(struct ieee80211_hw *hw, - bool dec_bt_pwr) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[1] = {0}; - - h2c_parameter[0] = 0; - - if (dec_bt_pwr) { - h2c_parameter[0] |= BIT(1); - rtlpcipriv->bt_coexist.fw_coexist_all_off = false; - } - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], decrease Bt Power : %s, write 0x21 = 0x%x\n", - (dec_bt_pwr ? "Yes!!" : "No!!"), h2c_parameter[0]); - - rtl8723ae_fill_h2c_cmd(hw, 0x21, 1, h2c_parameter); -} - -static void rtl8723ae_dm_bt_set_fw_2_ant_hid(struct ieee80211_hw *hw, - bool enable, bool dac_swing_on) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[1] = {0}; - - if (enable) { - h2c_parameter[0] |= BIT(0); - rtlpcipriv->bt_coexist.fw_coexist_all_off = false; - } - if (dac_swing_on) - h2c_parameter[0] |= BIT(1); /* Dac Swing default enable */ - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], turn 2-Ant+HID mode %s, DACSwing:%s, write 0x15 = 0x%x\n", - (enable ? "ON!!" : "OFF!!"), (dac_swing_on ? "ON" : "OFF"), - h2c_parameter[0]); - - rtl8723ae_fill_h2c_cmd(hw, 0x15, 1, h2c_parameter); -} - -static void rtl8723ae_dm_bt_set_fw_tdma_ctrl(struct ieee80211_hw *hw, - bool enable, u8 ant_num, u8 nav_en, - u8 dac_swing_en) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u8 h2c_parameter[1] = {0}; - u8 h2c_parameter1[1] = {0}; - - h2c_parameter[0] = 0; - h2c_parameter1[0] = 0; - - if (enable) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], set BT PTA update manager to trigger update!!\n"); - h2c_parameter1[0] |= BIT(0); - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], turn TDMA mode ON!!\n"); - h2c_parameter[0] |= BIT(0); /* function enable */ - if (TDMA_1ANT == ant_num) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], TDMA_1ANT\n"); - h2c_parameter[0] |= BIT(1); - } else if (TDMA_2ANT == ant_num) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], TDMA_2ANT\n"); - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], Unknown Ant\n"); - } - - if (TDMA_NAV_OFF == nav_en) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], TDMA_NAV_OFF\n"); - } else if (TDMA_NAV_ON == nav_en) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], TDMA_NAV_ON\n"); - h2c_parameter[0] |= BIT(2); - } - - if (TDMA_DAC_SWING_OFF == dac_swing_en) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], TDMA_DAC_SWING_OFF\n"); - } else if (TDMA_DAC_SWING_ON == dac_swing_en) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], TDMA_DAC_SWING_ON\n"); - h2c_parameter[0] |= BIT(4); - } - rtlpcipriv->bt_coexist.fw_coexist_all_off = false; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], set BT PTA update manager to no update!!\n"); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], turn TDMA mode OFF!!\n"); - } - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], FW2AntTDMA, write 0x26 = 0x%x\n", - h2c_parameter1[0]); - rtl8723ae_fill_h2c_cmd(hw, 0x26, 1, h2c_parameter1); - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], FW2AntTDMA, write 0x14 = 0x%x\n", h2c_parameter[0]); - rtl8723ae_fill_h2c_cmd(hw, 0x14, 1, h2c_parameter); -} - -static void rtl8723ae_dm_bt_set_fw_ignore_wlan_act(struct ieee80211_hw *hw, - bool enable) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u8 h2c_parameter[1] = {0}; - - if (enable) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], BT Ignore Wlan_Act !!\n"); - h2c_parameter[0] |= BIT(0); /* function enable */ - rtlpcipriv->bt_coexist.fw_coexist_all_off = false; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], BT don't ignore Wlan_Act !!\n"); - } - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], set FW for BT Ignore Wlan_Act, write 0x25 = 0x%x\n", - h2c_parameter[0]); - - rtl8723ae_fill_h2c_cmd(hw, 0x25, 1, h2c_parameter); -} - -static void rtl8723ae_dm_bt_set_fw_tra_tdma_ctrl(struct ieee80211_hw *hw, - bool enable, u8 ant_num, - u8 nav_en) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 h2c_parameter[2] = {0}; - - /* Only 8723 B cut should do this */ - if (IS_VENDOR_8723_A_CUT(rtlhal->version)) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], not 8723B cut, don't set Traditional TDMA!!\n"); - return; - } - - if (enable) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], turn TTDMA mode ON!!\n"); - h2c_parameter[0] |= BIT(0); /* function enable */ - if (TDMA_1ANT == ant_num) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], TTDMA_1ANT\n"); - h2c_parameter[0] |= BIT(1); - } else if (TDMA_2ANT == ant_num) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], TTDMA_2ANT\n"); - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], Unknown Ant\n"); - } - - if (TDMA_NAV_OFF == nav_en) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], TTDMA_NAV_OFF\n"); - } else if (TDMA_NAV_ON == nav_en) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], TTDMA_NAV_ON\n"); - h2c_parameter[1] |= BIT(0); - } - - rtlpcipriv->bt_coexist.fw_coexist_all_off = false; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], turn TTDMA mode OFF!!\n"); - } - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], FW Traditional TDMA, write 0x33 = 0x%x\n", - h2c_parameter[0] << 8 | h2c_parameter[1]); - - rtl8723ae_fill_h2c_cmd(hw, 0x33, 2, h2c_parameter); -} - -static void rtl8723ae_dm_bt_set_fw_dac_swing_level(struct ieee80211_hw *hw, - u8 dac_swing_lvl) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[1] = {0}; - - h2c_parameter[0] = dac_swing_lvl; - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], Set Dac Swing Level = 0x%x\n", dac_swing_lvl); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], write 0x29 = 0x%x\n", h2c_parameter[0]); - - rtl8723ae_fill_h2c_cmd(hw, 0x29, 1, h2c_parameter); -} - -static void rtl8723ae_dm_bt_set_fw_bt_hid_info(struct ieee80211_hw *hw, - bool enable) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[1] = {0}; - - h2c_parameter[0] = 0; - - if (enable) { - h2c_parameter[0] |= BIT(0); - rtlpcipriv->bt_coexist.fw_coexist_all_off = false; - } - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], Set BT HID information = 0x%x\n", enable); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], write 0x24 = 0x%x\n", h2c_parameter[0]); - - rtl8723ae_fill_h2c_cmd(hw, 0x24, 1, h2c_parameter); -} - -static void rtl8723ae_dm_bt_set_fw_bt_retry_index(struct ieee80211_hw *hw, - u8 retry_index) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[1] = {0}; - - h2c_parameter[0] = retry_index; - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], Set BT Retry Index=%d\n", retry_index); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], write 0x23 = 0x%x\n", h2c_parameter[0]); - - rtl8723ae_fill_h2c_cmd(hw, 0x23, 1, h2c_parameter); -} - -static void rtl8723ae_dm_bt_set_fw_wlan_act(struct ieee80211_hw *hw, - u8 wlan_act_hi, u8 wlan_act_lo) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter_hi[1] = {0}; - u8 h2c_parameter_lo[1] = {0}; - - h2c_parameter_hi[0] = wlan_act_hi; - h2c_parameter_lo[0] = wlan_act_lo; - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], Set WLAN_ACT Hi:Lo = 0x%x/0x%x\n", wlan_act_hi, - wlan_act_lo); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], write 0x22 = 0x%x\n", h2c_parameter_hi[0]); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], write 0x11 = 0x%x\n", h2c_parameter_lo[0]); - - /* WLAN_ACT = High duration, unit:ms */ - rtl8723ae_fill_h2c_cmd(hw, 0x22, 1, h2c_parameter_hi); - /* WLAN_ACT = Low duration, unit:3*625us */ - rtl8723ae_fill_h2c_cmd(hw, 0x11, 1, h2c_parameter_lo); -} - -void rtl8723ae_dm_bt_set_bt_dm(struct ieee80211_hw *hw, struct btdm_8723 *btdm) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - struct btdm_8723 *btdm_8723 = &rtlhal->hal_coex_8723.btdm; - u8 i; - bool fw_current_inpsmode = false; - bool fw_ps_awake = true; - - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_FW_PSMODE_STATUS, - (u8 *)(&fw_current_inpsmode)); - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_FWLPS_RF_ON, - (u8 *)(&fw_ps_awake)); - - /* check new setting is different than the old one, - * if all the same, don't do the setting again. - */ - if (memcmp(btdm_8723, btdm, sizeof(struct btdm_8723)) == 0) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], the same coexist setting, return!!\n"); - return; - } else { /* save the new coexist setting */ - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], UPDATE TO NEW COEX SETTING!!\n"); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new bAllOff = 0x%x/ 0x%x\n", - btdm_8723->all_off, btdm->all_off); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new agc_table_en = 0x%x/ 0x%x\n", - btdm_8723->agc_table_en, btdm->agc_table_en); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new adc_back_off_on = 0x%x/ 0x%x\n", - btdm_8723->adc_back_off_on, btdm->adc_back_off_on); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new b2_ant_hid_en = 0x%x/ 0x%x\n", - btdm_8723->b2_ant_hid_en, btdm->b2_ant_hid_en); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new bLowPenaltyRateAdaptive = 0x%x/ 0x%x\n", - btdm_8723->low_penalty_rate_adaptive, - btdm->low_penalty_rate_adaptive); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new bRfRxLpfShrink = 0x%x/ 0x%x\n", - btdm_8723->rf_rx_lpf_shrink, btdm->rf_rx_lpf_shrink); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new bRejectAggrePkt = 0x%x/ 0x%x\n", - btdm_8723->reject_aggre_pkt, btdm->reject_aggre_pkt); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new tdma_on = 0x%x/ 0x%x\n", - btdm_8723->tdma_on, btdm->tdma_on); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new tdmaAnt = 0x%x/ 0x%x\n", - btdm_8723->tdma_ant, btdm->tdma_ant); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new tdmaNav = 0x%x/ 0x%x\n", - btdm_8723->tdma_nav, btdm->tdma_nav); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new tdma_dac_swing = 0x%x/ 0x%x\n", - btdm_8723->tdma_dac_swing, btdm->tdma_dac_swing); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new fwDacSwingLvl = 0x%x/ 0x%x\n", - btdm_8723->fw_dac_swing_lvl, btdm->fw_dac_swing_lvl); - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new bTraTdmaOn = 0x%x/ 0x%x\n", - btdm_8723->tra_tdma_on, btdm->tra_tdma_on); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new traTdmaAnt = 0x%x/ 0x%x\n", - btdm_8723->tra_tdma_ant, btdm->tra_tdma_ant); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new traTdmaNav = 0x%x/ 0x%x\n", - btdm_8723->tra_tdma_nav, btdm->tra_tdma_nav); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new bPsTdmaOn = 0x%x/ 0x%x\n", - btdm_8723->ps_tdma_on, btdm->ps_tdma_on); - for (i = 0; i < 5; i++) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new psTdmaByte[i] = 0x%x/ 0x%x\n", - btdm_8723->ps_tdma_byte[i], - btdm->ps_tdma_byte[i]); - } - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new bIgnoreWlanAct = 0x%x/ 0x%x\n", - btdm_8723->ignore_wlan_act, btdm->ignore_wlan_act); - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new bPtaOn = 0x%x/ 0x%x\n", - btdm_8723->pta_on, btdm->pta_on); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new val_0x6c0 = 0x%x/ 0x%x\n", - btdm_8723->val_0x6c0, btdm->val_0x6c0); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new val_0x6c8 = 0x%x/ 0x%x\n", - btdm_8723->val_0x6c8, btdm->val_0x6c8); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new val_0x6cc = 0x%x/ 0x%x\n", - btdm_8723->val_0x6cc, btdm->val_0x6cc); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new sw_dac_swing_on = 0x%x/ 0x%x\n", - btdm_8723->sw_dac_swing_on, btdm->sw_dac_swing_on); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new sw_dac_swing_lvl = 0x%x/ 0x%x\n", - btdm_8723->sw_dac_swing_lvl, - btdm->sw_dac_swing_lvl); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new wlanActHi = 0x%x/ 0x%x\n", - btdm_8723->wlan_act_hi, btdm->wlan_act_hi); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new wlanActLo = 0x%x/ 0x%x\n", - btdm_8723->wlan_act_lo, btdm->wlan_act_lo); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], original/new btRetryIndex = 0x%x/ 0x%x\n", - btdm_8723->bt_retry_index, btdm->bt_retry_index); - - memcpy(btdm_8723, btdm, sizeof(struct btdm_8723)); - } - /* - * Here we only consider when Bt Operation - * inquiry/paging/pairing is ON - * we only need to turn off TDMA - */ - - if (rtlpcipriv->bt_coexist.hold_for_bt_operation) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], set to ignore wlanAct for BT OP!!\n"); - rtl8723ae_dm_bt_set_fw_ignore_wlan_act(hw, true); - return; - } - - if (btdm->all_off) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], disable all coexist mechanism !!\n"); - rtl8723ae_btdm_coex_all_off(hw); - return; - } - - rtl8723ae_dm_bt_reject_ap_aggregated_packet(hw, btdm->reject_aggre_pkt); - - if (btdm->low_penalty_rate_adaptive) - rtl8723ae_bt_set_penalty_tx_rate_adap(hw, - BT_TX_RATE_ADAPTIVE_LOW_PENALTY); - else - rtl8723ae_bt_set_penalty_tx_rate_adap(hw, - BT_TX_RATE_ADAPTIVE_NORMAL); - - if (btdm->rf_rx_lpf_shrink) - rtl8723ae_dm_bt_set_sw_rf_rx_lpf_corner(hw, - BT_RF_RX_LPF_CORNER_SHRINK); - else - rtl8723ae_dm_bt_set_sw_rf_rx_lpf_corner(hw, - BT_RF_RX_LPF_CORNER_RESUME); - - if (btdm->agc_table_en) - rtl8723ae_dm_bt_agc_table(hw, BT_AGCTABLE_ON); - else - rtl8723ae_dm_bt_agc_table(hw, BT_AGCTABLE_OFF); - - if (btdm->adc_back_off_on) - rtl8723ae_dm_bt_bback_off_level(hw, BT_BB_BACKOFF_ON); - else - rtl8723ae_dm_bt_bback_off_level(hw, BT_BB_BACKOFF_OFF); - - rtl8723ae_dm_bt_set_fw_bt_retry_index(hw, btdm->bt_retry_index); - - rtl8723ae_dm_bt_set_fw_dac_swing_level(hw, btdm->fw_dac_swing_lvl); - rtl8723ae_dm_bt_set_fw_wlan_act(hw, btdm->wlan_act_hi, - btdm->wlan_act_lo); - - rtl8723ae_dm_bt_set_coex_table(hw, btdm->val_0x6c0, - btdm->val_0x6c8, btdm->val_0x6cc); - rtl8723ae_dm_bt_set_hw_pta_mode(hw, btdm->pta_on); - - /* Note: There is a constraint between TDMA and 2AntHID - * Only one of 2AntHid and tdma can be turned on - * We should turn off those mechanisms first - * and then turn on them on. - */ - if (btdm->b2_ant_hid_en) { - /* turn off tdma */ - rtl8723ae_dm_bt_set_fw_tra_tdma_ctrl(hw, btdm->tra_tdma_on, - btdm->tra_tdma_ant, - btdm->tra_tdma_nav); - rtl8723ae_dm_bt_set_fw_tdma_ctrl(hw, false, btdm->tdma_ant, - btdm->tdma_nav, - btdm->tdma_dac_swing); - - /* turn off Pstdma */ - rtl8723ae_dm_bt_set_fw_ignore_wlan_act(hw, - btdm->ignore_wlan_act); - /* Antenna control by PTA, 0x870 = 0x300. */ - rtl8723ae_dm_bt_set_fw_3a(hw, 0x0, 0x0, 0x0, 0x8, 0x0); - - /* turn on 2AntHid */ - rtl8723ae_dm_bt_set_fw_bt_hid_info(hw, true); - rtl8723ae_dm_bt_set_fw_2_ant_hid(hw, true, true); - } else if (btdm->tdma_on) { - /* turn off 2AntHid */ - rtl8723ae_dm_bt_set_fw_bt_hid_info(hw, false); - rtl8723ae_dm_bt_set_fw_2_ant_hid(hw, false, false); - - /* turn off pstdma */ - rtl8723ae_dm_bt_set_fw_ignore_wlan_act(hw, - btdm->ignore_wlan_act); - /* Antenna control by PTA, 0x870 = 0x300. */ - rtl8723ae_dm_bt_set_fw_3a(hw, 0x0, 0x0, 0x0, 0x8, 0x0); - - /* turn on tdma */ - rtl8723ae_dm_bt_set_fw_tra_tdma_ctrl(hw, btdm->tra_tdma_on, - btdm->tra_tdma_ant, btdm->tra_tdma_nav); - rtl8723ae_dm_bt_set_fw_tdma_ctrl(hw, true, btdm->tdma_ant, - btdm->tdma_nav, btdm->tdma_dac_swing); - } else if (btdm->ps_tdma_on) { - /* turn off 2AntHid */ - rtl8723ae_dm_bt_set_fw_bt_hid_info(hw, false); - rtl8723ae_dm_bt_set_fw_2_ant_hid(hw, false, false); - - /* turn off tdma */ - rtl8723ae_dm_bt_set_fw_tra_tdma_ctrl(hw, btdm->tra_tdma_on, - btdm->tra_tdma_ant, btdm->tra_tdma_nav); - rtl8723ae_dm_bt_set_fw_tdma_ctrl(hw, false, btdm->tdma_ant, - btdm->tdma_nav, btdm->tdma_dac_swing); - - /* turn on pstdma */ - rtl8723ae_dm_bt_set_fw_ignore_wlan_act(hw, - btdm->ignore_wlan_act); - rtl8723ae_dm_bt_set_fw_3a(hw, - btdm->ps_tdma_byte[0], - btdm->ps_tdma_byte[1], - btdm->ps_tdma_byte[2], - btdm->ps_tdma_byte[3], - btdm->ps_tdma_byte[4]); - } else { - /* turn off 2AntHid */ - rtl8723ae_dm_bt_set_fw_bt_hid_info(hw, false); - rtl8723ae_dm_bt_set_fw_2_ant_hid(hw, false, false); - - /* turn off tdma */ - rtl8723ae_dm_bt_set_fw_tra_tdma_ctrl(hw, btdm->tra_tdma_on, - btdm->tra_tdma_ant, btdm->tra_tdma_nav); - rtl8723ae_dm_bt_set_fw_tdma_ctrl(hw, false, btdm->tdma_ant, - btdm->tdma_nav, btdm->tdma_dac_swing); - - /* turn off pstdma */ - rtl8723ae_dm_bt_set_fw_ignore_wlan_act(hw, - btdm->ignore_wlan_act); - /* Antenna control by PTA, 0x870 = 0x300. */ - rtl8723ae_dm_bt_set_fw_3a(hw, 0x0, 0x0, 0x0, 0x8, 0x0); - } - - /* Note: - * We should add delay for making sure sw DacSwing can be set - * sucessfully. Because of that rtl8723ae_dm_bt_set_fw_2_ant_hid() - * and rtl8723ae_dm_bt_set_fw_tdma_ctrl() - * will overwrite the reg 0x880. - */ - mdelay(30); - rtl8723ae_dm_bt_set_sw_full_time_dac_swing(hw, - btdm->sw_dac_swing_on, btdm->sw_dac_swing_lvl); - rtl8723ae_dm_bt_set_fw_dec_bt_pwr(hw, btdm->dec_bt_pwr); -} - -/*============================================================ - * extern function start with BTDM_ - *============================================================ - */ -static u32 rtl8723ae_dm_bt_tx_rx_couter_h(struct ieee80211_hw *hw) -{ - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u32 counters = 0; - - counters = rtlhal->hal_coex_8723.high_priority_tx + - rtlhal->hal_coex_8723.high_priority_rx; - return counters; -} - -static u32 rtl8723ae_dm_bt_tx_rx_couter_l(struct ieee80211_hw *hw) -{ - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - return rtlhal->hal_coex_8723.low_priority_tx + - rtlhal->hal_coex_8723.low_priority_rx; -} - -static u8 rtl8723ae_dm_bt_bt_tx_rx_counter_level(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u32 bt_tx_rx_cnt = 0; - u8 bt_tx_rx_cnt_lvl = 0; - - bt_tx_rx_cnt = rtl8723ae_dm_bt_tx_rx_couter_h(hw) + - rtl8723ae_dm_bt_tx_rx_couter_l(hw); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters = %d\n", bt_tx_rx_cnt); - - rtlpcipriv->bt_coexist.cstate_h &= - ~(BT_COEX_STATE_BT_CNT_LEVEL_0 | BT_COEX_STATE_BT_CNT_LEVEL_1 | - BT_COEX_STATE_BT_CNT_LEVEL_2); - - if (bt_tx_rx_cnt >= BT_TXRX_CNT_THRES_3) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters at level 3\n"); - bt_tx_rx_cnt_lvl = BT_TXRX_CNT_LEVEL_3; - rtlpcipriv->bt_coexist.cstate_h |= BT_COEX_STATE_BT_CNT_LEVEL_3; - } else if (bt_tx_rx_cnt >= BT_TXRX_CNT_THRES_2) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters at level 2\n"); - bt_tx_rx_cnt_lvl = BT_TXRX_CNT_LEVEL_2; - rtlpcipriv->bt_coexist.cstate_h |= BT_COEX_STATE_BT_CNT_LEVEL_2; - } else if (bt_tx_rx_cnt >= BT_TXRX_CNT_THRES_1) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters at level 1\n"); - bt_tx_rx_cnt_lvl = BT_TXRX_CNT_LEVEL_1; - rtlpcipriv->bt_coexist.cstate_h |= BT_COEX_STATE_BT_CNT_LEVEL_1; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters at level 0\n"); - bt_tx_rx_cnt_lvl = BT_TXRX_CNT_LEVEL_0; - rtlpcipriv->bt_coexist.cstate_h |= BT_COEX_STATE_BT_CNT_LEVEL_0; - } - return bt_tx_rx_cnt_lvl; -} - -static void rtl8723ae_dm_bt_2_ant_hid_sco_esco(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct btdm_8723 btdm8723; - u8 bt_rssi_state, bt_rssi_state1; - u8 bt_tx_rx_cnt_lvl; - - rtl8723ae_dm_bt_btdm_structure_reload(hw, &btdm8723); - - btdm8723.rf_rx_lpf_shrink = true; - btdm8723.low_penalty_rate_adaptive = true; - btdm8723.reject_aggre_pkt = false; - - bt_tx_rx_cnt_lvl = rtl8723ae_dm_bt_bt_tx_rx_counter_level(hw); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters = %d\n", bt_tx_rx_cnt_lvl); - - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, "HT40\n"); - /* coex table */ - btdm8723.val_0x6c0 = 0x55555555; - btdm8723.val_0x6c8 = 0xffff; - btdm8723.val_0x6cc = 0x3; - - /* sw mechanism */ - btdm8723.agc_table_en = false; - btdm8723.adc_back_off_on = false; - btdm8723.sw_dac_swing_on = false; - - /* fw mechanism */ - btdm8723.ps_tdma_on = true; - if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_2) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters >= 1400\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0x5; - btdm8723.ps_tdma_byte[2] = 0x5; - btdm8723.ps_tdma_byte[3] = 0x2; - btdm8723.ps_tdma_byte[4] = 0x80; - } else if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_1) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters >= 1200 && < 1400\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0xa; - btdm8723.ps_tdma_byte[2] = 0xa; - btdm8723.ps_tdma_byte[3] = 0x2; - btdm8723.ps_tdma_byte[4] = 0x80; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters < 1200\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0xf; - btdm8723.ps_tdma_byte[2] = 0xf; - btdm8723.ps_tdma_byte[3] = 0x2; - btdm8723.ps_tdma_byte[4] = 0x80; - } - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "HT20 or Legacy\n"); - bt_rssi_state = rtl8723ae_dm_bt_check_coex_rssi_state(hw, 2, - 47, 0); - bt_rssi_state1 = rtl8723ae_dm_bt_check_coex_rssi_state1(hw, 2, - 27, 0); - - /* coex table */ - btdm8723.val_0x6c0 = 0x55555555; - btdm8723.val_0x6c8 = 0xffff; - btdm8723.val_0x6cc = 0x3; - - /* sw mechanism */ - if ((bt_rssi_state == BT_RSSI_STATE_HIGH) || - (bt_rssi_state == BT_RSSI_STATE_STAY_HIGH)) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Wifi rssi high\n"); - btdm8723.agc_table_en = true; - btdm8723.adc_back_off_on = true; - btdm8723.sw_dac_swing_on = false; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Wifi rssi low\n"); - btdm8723.agc_table_en = false; - btdm8723.adc_back_off_on = false; - btdm8723.sw_dac_swing_on = false; - } - - /* fw mechanism */ - btdm8723.ps_tdma_on = true; - if ((bt_rssi_state1 == BT_RSSI_STATE_HIGH) || - (bt_rssi_state1 == BT_RSSI_STATE_STAY_HIGH)) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Wifi rssi-1 high\n"); - /* only rssi high we need to do this, - * when rssi low, the value will modified by fw - */ - rtl_write_byte(rtlpriv, 0x883, 0x40); - if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_2) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters >= 1400\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0x5; - btdm8723.ps_tdma_byte[2] = 0x5; - btdm8723.ps_tdma_byte[3] = 0x83; - btdm8723.ps_tdma_byte[4] = 0x80; - } else if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_1) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters >= 1200 && < 1400\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0xa; - btdm8723.ps_tdma_byte[2] = 0xa; - btdm8723.ps_tdma_byte[3] = 0x83; - btdm8723.ps_tdma_byte[4] = 0x80; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters < 1200\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0xf; - btdm8723.ps_tdma_byte[2] = 0xf; - btdm8723.ps_tdma_byte[3] = 0x83; - btdm8723.ps_tdma_byte[4] = 0x80; - } - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Wifi rssi-1 low\n"); - if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_2) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters >= 1400\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0x5; - btdm8723.ps_tdma_byte[2] = 0x5; - btdm8723.ps_tdma_byte[3] = 0x2; - btdm8723.ps_tdma_byte[4] = 0x80; - } else if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_1) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters >= 1200 && < 1400\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0xa; - btdm8723.ps_tdma_byte[2] = 0xa; - btdm8723.ps_tdma_byte[3] = 0x2; - btdm8723.ps_tdma_byte[4] = 0x80; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters < 1200\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0xf; - btdm8723.ps_tdma_byte[2] = 0xf; - btdm8723.ps_tdma_byte[3] = 0x2; - btdm8723.ps_tdma_byte[4] = 0x80; - } - } - } - - if (rtl8723ae_dm_bt_need_to_dec_bt_pwr(hw)) - btdm8723.dec_bt_pwr = true; - - /* Always ignore WlanAct if bHid|bSCOBusy|bSCOeSCO */ - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT btInqPageStartTime = 0x%x, btTxRxCntLvl = %d\n", - rtlhal->hal_coex_8723.bt_inq_page_start_time, - bt_tx_rx_cnt_lvl); - if ((rtlhal->hal_coex_8723.bt_inq_page_start_time) || - (BT_TXRX_CNT_LEVEL_3 == bt_tx_rx_cnt_lvl)) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], Set BT inquiry / page scan 0x3a setting\n"); - btdm8723.ps_tdma_on = true; - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0x5; - btdm8723.ps_tdma_byte[2] = 0x5; - btdm8723.ps_tdma_byte[3] = 0x2; - btdm8723.ps_tdma_byte[4] = 0x80; - } - - if (rtl8723ae_dm_bt_is_coexist_state_changed(hw)) - rtl8723ae_dm_bt_set_bt_dm(hw, &btdm8723); -} - -static void rtl8723ae_dm_bt_2_ant_fta2dp(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct btdm_8723 btdm8723; - u8 bt_rssi_state, bt_rssi_state1; - u32 bt_tx_rx_cnt_lvl; - - rtl8723ae_dm_bt_btdm_structure_reload(hw, &btdm8723); - btdm8723.rf_rx_lpf_shrink = true; - btdm8723.low_penalty_rate_adaptive = true; - btdm8723.reject_aggre_pkt = false; - - bt_tx_rx_cnt_lvl = rtl8723ae_dm_bt_bt_tx_rx_counter_level(hw); - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters = %d\n", bt_tx_rx_cnt_lvl); - - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, "HT40\n"); - bt_rssi_state = rtl8723ae_dm_bt_check_coex_rssi_state(hw, 2, - 37, 0); - - /* coex table */ - btdm8723.val_0x6c0 = 0x55555555; - btdm8723.val_0x6c8 = 0xffff; - btdm8723.val_0x6cc = 0x3; - - /* sw mechanism */ - btdm8723.agc_table_en = false; - btdm8723.adc_back_off_on = true; - btdm8723.sw_dac_swing_on = false; - - /* fw mechanism */ - btdm8723.ps_tdma_on = true; - if ((bt_rssi_state == BT_RSSI_STATE_HIGH) || - (bt_rssi_state == BT_RSSI_STATE_STAY_HIGH)) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Wifi rssi high\n"); - if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_2) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters >= 1400\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0x5; - btdm8723.ps_tdma_byte[2] = 0x5; - btdm8723.ps_tdma_byte[3] = 0x81; - btdm8723.ps_tdma_byte[4] = 0x80; - } else if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_1) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters >= 1200 && < 1400\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0xa; - btdm8723.ps_tdma_byte[2] = 0xa; - btdm8723.ps_tdma_byte[3] = 0x81; - btdm8723.ps_tdma_byte[4] = 0x80; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters < 1200\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0xf; - btdm8723.ps_tdma_byte[2] = 0xf; - btdm8723.ps_tdma_byte[3] = 0x81; - btdm8723.ps_tdma_byte[4] = 0x80; - } - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Wifi rssi low\n"); - if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_2) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters >= 1400\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0x5; - btdm8723.ps_tdma_byte[2] = 0x5; - btdm8723.ps_tdma_byte[3] = 0x0; - btdm8723.ps_tdma_byte[4] = 0x80; - } else if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_1) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters >= 1200 && < 1400\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0xa; - btdm8723.ps_tdma_byte[2] = 0xa; - btdm8723.ps_tdma_byte[3] = 0x0; - btdm8723.ps_tdma_byte[4] = 0x80; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters < 1200\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0xf; - btdm8723.ps_tdma_byte[2] = 0xf; - btdm8723.ps_tdma_byte[3] = 0x0; - btdm8723.ps_tdma_byte[4] = 0x80; - } - } - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "HT20 or Legacy\n"); - bt_rssi_state = rtl8723ae_dm_bt_check_coex_rssi_state(hw, 2, - 47, 0); - bt_rssi_state1 = rtl8723ae_dm_bt_check_coex_rssi_state1(hw, 2, - 27, 0); - - /* coex table */ - btdm8723.val_0x6c0 = 0x55555555; - btdm8723.val_0x6c8 = 0xffff; - btdm8723.val_0x6cc = 0x3; - - /* sw mechanism */ - if ((bt_rssi_state == BT_RSSI_STATE_HIGH) || - (bt_rssi_state == BT_RSSI_STATE_STAY_HIGH)) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Wifi rssi high\n"); - btdm8723.agc_table_en = true; - btdm8723.adc_back_off_on = true; - btdm8723.sw_dac_swing_on = false; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Wifi rssi low\n"); - btdm8723.agc_table_en = false; - btdm8723.adc_back_off_on = false; - btdm8723.sw_dac_swing_on = false; - } - - /* fw mechanism */ - btdm8723.ps_tdma_on = true; - if ((bt_rssi_state1 == BT_RSSI_STATE_HIGH) || - (bt_rssi_state1 == BT_RSSI_STATE_STAY_HIGH)) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Wifi rssi-1 high\n"); - /* only rssi high we need to do this, - * when rssi low, the value will modified by fw - */ - rtl_write_byte(rtlpriv, 0x883, 0x40); - if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_2) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters >= 1400\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0x5; - btdm8723.ps_tdma_byte[2] = 0x5; - btdm8723.ps_tdma_byte[3] = 0x81; - btdm8723.ps_tdma_byte[4] = 0x80; - } else if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_1) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters >= 1200 && < 1400\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0xa; - btdm8723.ps_tdma_byte[2] = 0xa; - btdm8723.ps_tdma_byte[3] = 0x81; - btdm8723.ps_tdma_byte[4] = 0x80; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters < 1200\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0xf; - btdm8723.ps_tdma_byte[2] = 0xf; - btdm8723.ps_tdma_byte[3] = 0x81; - btdm8723.ps_tdma_byte[4] = 0x80; - } - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Wifi rssi-1 low\n"); - if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_2) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters >= 1400\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0x5; - btdm8723.ps_tdma_byte[2] = 0x5; - btdm8723.ps_tdma_byte[3] = 0x0; - btdm8723.ps_tdma_byte[4] = 0x80; - } else if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_1) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters >= 1200 && < 1400\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0xa; - btdm8723.ps_tdma_byte[2] = 0xa; - btdm8723.ps_tdma_byte[3] = 0x0; - btdm8723.ps_tdma_byte[4] = 0x80; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT TxRx Counters < 1200\n"); - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0xf; - btdm8723.ps_tdma_byte[2] = 0xf; - btdm8723.ps_tdma_byte[3] = 0x0; - btdm8723.ps_tdma_byte[4] = 0x80; - } - } - } - - if (rtl8723ae_dm_bt_need_to_dec_bt_pwr(hw)) - btdm8723.dec_bt_pwr = true; - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT btInqPageStartTime = 0x%x, btTxRxCntLvl = %d\n", - rtlhal->hal_coex_8723.bt_inq_page_start_time, - bt_tx_rx_cnt_lvl); - - if ((rtlhal->hal_coex_8723.bt_inq_page_start_time) || - (BT_TXRX_CNT_LEVEL_3 == bt_tx_rx_cnt_lvl)) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], Set BT inquiry / page scan 0x3a setting\n"); - btdm8723.ps_tdma_on = true; - btdm8723.ps_tdma_byte[0] = 0xa3; - btdm8723.ps_tdma_byte[1] = 0x5; - btdm8723.ps_tdma_byte[2] = 0x5; - btdm8723.ps_tdma_byte[3] = 0x83; - btdm8723.ps_tdma_byte[4] = 0x80; - } - - if (rtl8723ae_dm_bt_is_coexist_state_changed(hw)) - rtl8723ae_dm_bt_set_bt_dm(hw, &btdm8723); -} - -static void rtl8723ae_dm_bt_inq_page_monitor(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - u32 cur_time = jiffies; - - if (rtlhal->hal_coex_8723.c2h_bt_inquiry_page) { - /* bt inquiry or page is started. */ - if (rtlhal->hal_coex_8723.bt_inq_page_start_time == 0) { - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_BT_INQ_PAGE; - rtlhal->hal_coex_8723.bt_inq_page_start_time = cur_time; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT Inquiry/page is started at time : 0x%x\n", - rtlhal->hal_coex_8723.bt_inq_page_start_time); - } - } - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT Inquiry/page started time : 0x%x, cur_time : 0x%x\n", - rtlhal->hal_coex_8723.bt_inq_page_start_time, cur_time); - - if (rtlhal->hal_coex_8723.bt_inq_page_start_time) { - if ((((long)cur_time - - (long)rtlhal->hal_coex_8723.bt_inq_page_start_time) / HZ) >= - 10) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BT Inquiry/page >= 10sec!!!"); - rtlhal->hal_coex_8723.bt_inq_page_start_time = 0; - rtlpcipriv->bt_coexist.cstate &= - ~BT_COEX_STATE_BT_INQ_PAGE; - } - } -} - -static void rtl8723ae_dm_bt_reset_action_profile_state(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - rtlpcipriv->bt_coexist.cstate &= - ~(BT_COEX_STATE_PROFILE_HID | BT_COEX_STATE_PROFILE_A2DP | - BT_COEX_STATE_PROFILE_PAN | BT_COEX_STATE_PROFILE_SCO); - - rtlpcipriv->bt_coexist.cstate &= - ~(BT_COEX_STATE_BTINFO_COMMON | - BT_COEX_STATE_BTINFO_B_HID_SCOESCO | - BT_COEX_STATE_BTINFO_B_FTP_A2DP); -} - -static void _rtl8723ae_dm_bt_coexist_2_ant(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u8 bt_info_original; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex] Get bt info by fw!!\n"); - - _rtl8723_dm_bt_check_wifi_state(hw); - - if (rtlhal->hal_coex_8723.c2h_bt_info_req_sent) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex] c2h for btInfo not rcvd yet!!\n"); - } - - bt_info_original = rtlhal->hal_coex_8723.c2h_bt_info_original; - - /* when bt inquiry or page scan, we have to set h2c 0x25 - * ignore wlanact for continuous 4x2secs - */ - rtl8723ae_dm_bt_inq_page_monitor(hw); - rtl8723ae_dm_bt_reset_action_profile_state(hw); - - if (rtl8723ae_dm_bt_is_2_ant_common_action(hw)) { - rtlpcipriv->bt_coexist.bt_profile_case = BT_COEX_MECH_COMMON; - rtlpcipriv->bt_coexist.bt_profile_action = BT_COEX_MECH_COMMON; - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Action 2-Ant common.\n"); - } else { - if ((bt_info_original & BTINFO_B_HID) || - (bt_info_original & BTINFO_B_SCO_BUSY) || - (bt_info_original & BTINFO_B_SCO_ESCO)) { - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_BTINFO_B_HID_SCOESCO; - rtlpcipriv->bt_coexist.bt_profile_case = - BT_COEX_MECH_HID_SCO_ESCO; - rtlpcipriv->bt_coexist.bt_profile_action = - BT_COEX_MECH_HID_SCO_ESCO; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BTInfo: bHid|bSCOBusy|bSCOeSCO\n"); - rtl8723ae_dm_bt_2_ant_hid_sco_esco(hw); - } else if ((bt_info_original & BTINFO_B_FTP) || - (bt_info_original & BTINFO_B_A2DP)) { - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_BTINFO_B_FTP_A2DP; - rtlpcipriv->bt_coexist.bt_profile_case = - BT_COEX_MECH_FTP_A2DP; - rtlpcipriv->bt_coexist.bt_profile_action = - BT_COEX_MECH_FTP_A2DP; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "BTInfo: bFTP|bA2DP\n"); - rtl8723ae_dm_bt_2_ant_fta2dp(hw); - } else { - rtlpcipriv->bt_coexist.cstate |= - BT_COEX_STATE_BTINFO_B_HID_SCOESCO; - rtlpcipriv->bt_coexist.bt_profile_case = - BT_COEX_MECH_NONE; - rtlpcipriv->bt_coexist.bt_profile_action = - BT_COEX_MECH_NONE; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], BTInfo: undefined case!!!!\n"); - rtl8723ae_dm_bt_2_ant_hid_sco_esco(hw); - } - } -} - -static void _rtl8723ae_dm_bt_coexist_1_ant(struct ieee80211_hw *hw) -{ -} - -void rtl8723ae_dm_bt_hw_coex_all_off_8723a(struct ieee80211_hw *hw) -{ - rtl8723ae_dm_bt_set_coex_table(hw, 0x5a5aaaaa, 0xcc, 0x3); - rtl8723ae_dm_bt_set_hw_pta_mode(hw, true); -} - -void rtl8723ae_dm_bt_fw_coex_all_off_8723a(struct ieee80211_hw *hw) -{ - rtl8723ae_dm_bt_set_fw_ignore_wlan_act(hw, false); - rtl8723ae_dm_bt_set_fw_3a(hw, 0x0, 0x0, 0x0, 0x8, 0x0); - rtl8723ae_dm_bt_set_fw_2_ant_hid(hw, false, false); - rtl8723ae_dm_bt_set_fw_tra_tdma_ctrl(hw, false, - TDMA_2ANT, TDMA_NAV_OFF); - rtl8723ae_dm_bt_set_fw_tdma_ctrl(hw, false, TDMA_2ANT, - TDMA_NAV_OFF, TDMA_DAC_SWING_OFF); - rtl8723ae_dm_bt_set_fw_dac_swing_level(hw, 0); - rtl8723ae_dm_bt_set_fw_bt_hid_info(hw, false); - rtl8723ae_dm_bt_set_fw_bt_retry_index(hw, 2); - rtl8723ae_dm_bt_set_fw_wlan_act(hw, 0x10, 0x10); - rtl8723ae_dm_bt_set_fw_dec_bt_pwr(hw, false); -} - -void rtl8723ae_dm_bt_sw_coex_all_off_8723a(struct ieee80211_hw *hw) -{ - rtl8723ae_dm_bt_agc_table(hw, BT_AGCTABLE_OFF); - rtl8723ae_dm_bt_bback_off_level(hw, BT_BB_BACKOFF_OFF); - rtl8723ae_dm_bt_reject_ap_aggregated_packet(hw, false); - - rtl8723ae_bt_set_penalty_tx_rate_adap(hw, BT_TX_RATE_ADAPTIVE_NORMAL); - rtl8723ae_dm_bt_set_sw_rf_rx_lpf_corner(hw, BT_RF_RX_LPF_CORNER_RESUME); - rtl8723ae_dm_bt_set_sw_full_time_dac_swing(hw, false, 0xc0); -} - -static void rtl8723ae_dm_bt_query_bt_information(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - u8 h2c_parameter[1] = {0}; - - rtlhal->hal_coex_8723.c2h_bt_info_req_sent = true; - - h2c_parameter[0] |= BIT(0); - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "Query Bt information, write 0x38 = 0x%x\n", - h2c_parameter[0]); - - rtl8723ae_fill_h2c_cmd(hw, 0x38, 1, h2c_parameter); -} - -static void rtl8723ae_dm_bt_bt_hw_counters_monitor(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u32 reg_htx_rx, reg_ltx_rx, u32_tmp; - u32 reg_htx, reg_hrx, reg_ltx, reg_lrx; - - reg_htx_rx = REG_HIGH_PRIORITY_TXRX; - reg_ltx_rx = REG_LOW_PRIORITY_TXRX; - - u32_tmp = rtl_read_dword(rtlpriv, reg_htx_rx); - reg_htx = u32_tmp & MASKLWORD; - reg_hrx = (u32_tmp & MASKHWORD)>>16; - - u32_tmp = rtl_read_dword(rtlpriv, reg_ltx_rx); - reg_ltx = u32_tmp & MASKLWORD; - reg_lrx = (u32_tmp & MASKHWORD)>>16; - - if (rtlpcipriv->bt_coexist.lps_counter > 1) { - reg_htx %= rtlpcipriv->bt_coexist.lps_counter; - reg_hrx %= rtlpcipriv->bt_coexist.lps_counter; - reg_ltx %= rtlpcipriv->bt_coexist.lps_counter; - reg_lrx %= rtlpcipriv->bt_coexist.lps_counter; - } - - rtlhal->hal_coex_8723.high_priority_tx = reg_htx; - rtlhal->hal_coex_8723.high_priority_rx = reg_hrx; - rtlhal->hal_coex_8723.low_priority_tx = reg_ltx; - rtlhal->hal_coex_8723.low_priority_rx = reg_lrx; - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "High Priority Tx/Rx (reg 0x%x)=%x(%d)/%x(%d)\n", - reg_htx_rx, reg_htx, reg_htx, reg_hrx, reg_hrx); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "Low Priority Tx/Rx (reg 0x%x)=%x(%d)/%x(%d)\n", - reg_ltx_rx, reg_ltx, reg_ltx, reg_lrx, reg_lrx); - rtlpcipriv->bt_coexist.lps_counter = 0; -} - -static void rtl8723ae_dm_bt_bt_enable_disable_check(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - bool bt_alife = true; - - if (rtlhal->hal_coex_8723.high_priority_tx == 0 && - rtlhal->hal_coex_8723.high_priority_rx == 0 && - rtlhal->hal_coex_8723.low_priority_tx == 0 && - rtlhal->hal_coex_8723.low_priority_rx == 0) - bt_alife = false; - if (rtlhal->hal_coex_8723.high_priority_tx == 0xeaea && - rtlhal->hal_coex_8723.high_priority_rx == 0xeaea && - rtlhal->hal_coex_8723.low_priority_tx == 0xeaea && - rtlhal->hal_coex_8723.low_priority_rx == 0xeaea) - bt_alife = false; - if (rtlhal->hal_coex_8723.high_priority_tx == 0xffff && - rtlhal->hal_coex_8723.high_priority_rx == 0xffff && - rtlhal->hal_coex_8723.low_priority_tx == 0xffff && - rtlhal->hal_coex_8723.low_priority_rx == 0xffff) - bt_alife = false; - if (bt_alife) { - rtlpcipriv->bt_coexist.bt_active_zero_cnt = 0; - rtlpcipriv->bt_coexist.cur_bt_disabled = false; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "8723A BT is enabled !!\n"); - } else { - rtlpcipriv->bt_coexist.bt_active_zero_cnt++; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "8723A bt all counters = 0, %d times!!\n", - rtlpcipriv->bt_coexist.bt_active_zero_cnt); - if (rtlpcipriv->bt_coexist.bt_active_zero_cnt >= 2) { - rtlpcipriv->bt_coexist.cur_bt_disabled = true; - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "8723A BT is disabled !!\n"); - } - } - if (rtlpcipriv->bt_coexist.pre_bt_disabled != - rtlpcipriv->bt_coexist.cur_bt_disabled) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "8723A BT is from %s to %s!!\n", - (rtlpcipriv->bt_coexist.pre_bt_disabled ? - "disabled" : "enabled"), - (rtlpcipriv->bt_coexist.cur_bt_disabled ? - "disabled" : "enabled")); - rtlpcipriv->bt_coexist.pre_bt_disabled - = rtlpcipriv->bt_coexist.cur_bt_disabled; - } -} - - -void rtl8723ae_dm_bt_coexist_8723(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - rtl8723ae_dm_bt_query_bt_information(hw); - rtl8723ae_dm_bt_bt_hw_counters_monitor(hw); - rtl8723ae_dm_bt_bt_enable_disable_check(hw); - - if (rtlpcipriv->bt_coexist.bt_ant_num == ANT_X2) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], 2 Ant mechanism\n"); - _rtl8723ae_dm_bt_coexist_2_ant(hw); - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "[BTCoex], 1 Ant mechanism\n"); - _rtl8723ae_dm_bt_coexist_1_ant(hw); - } - - if (!rtl8723ae_dm_bt_is_same_coexist_state(hw)) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTCoex], Coexist State[bitMap] change from 0x%x%8x to 0x%x%8x\n", - rtlpcipriv->bt_coexist.previous_state_h, - rtlpcipriv->bt_coexist.previous_state, - rtlpcipriv->bt_coexist.cstate_h, - rtlpcipriv->bt_coexist.cstate); - rtlpcipriv->bt_coexist.previous_state - = rtlpcipriv->bt_coexist.cstate; - rtlpcipriv->bt_coexist.previous_state_h - = rtlpcipriv->bt_coexist.cstate_h; - } -} - -static void rtl8723ae_dm_bt_parse_bt_info(struct ieee80211_hw *hw, - u8 *tmbuf, u8 len) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u8 bt_info; - u8 i; - - rtlhal->hal_coex_8723.c2h_bt_info_req_sent = false; - rtlhal->hal_coex_8723.bt_retry_cnt = 0; - for (i = 0; i < len; i++) { - if (i == 0) - rtlhal->hal_coex_8723.c2h_bt_info_original = tmbuf[i]; - else if (i == 1) - rtlhal->hal_coex_8723.bt_retry_cnt = tmbuf[i]; - if (i == len-1) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "0x%2x]", tmbuf[i]); - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "0x%2x, ", tmbuf[i]); - } - } - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "BT info bt_info (Data)= 0x%x\n", - rtlhal->hal_coex_8723.c2h_bt_info_original); - bt_info = rtlhal->hal_coex_8723.c2h_bt_info_original; - - if (bt_info & BIT(2)) - rtlhal->hal_coex_8723.c2h_bt_inquiry_page = true; - else - rtlhal->hal_coex_8723.c2h_bt_inquiry_page = false; - - if (bt_info & BTINFO_B_CONNECTION) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTC2H], BTInfo: bConnect=true\n"); - rtlpcipriv->bt_coexist.bt_busy = true; - rtlpcipriv->bt_coexist.cstate &= ~BT_COEX_STATE_BT_IDLE; - } else { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, - "[BTC2H], BTInfo: bConnect=false\n"); - rtlpcipriv->bt_coexist.bt_busy = false; - rtlpcipriv->bt_coexist.cstate |= BT_COEX_STATE_BT_IDLE; - } -} -void rtl_8723e_c2h_command_handle(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct c2h_evt_hdr c2h_event; - u8 *ptmbuf; - u8 index; - u8 u1tmp; - - memset(&c2h_event, 0, sizeof(c2h_event)); - u1tmp = rtl_read_byte(rtlpriv, REG_C2HEVT_MSG_NORMAL); - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, - "&&&&&&: REG_C2HEVT_MSG_NORMAL is 0x%x\n", u1tmp); - c2h_event.cmd_id = u1tmp & 0xF; - c2h_event.cmd_len = (u1tmp & 0xF0) >> 4; - c2h_event.cmd_seq = rtl_read_byte(rtlpriv, REG_C2HEVT_MSG_NORMAL + 1); - RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, - "cmd_id: %d, cmd_len: %d, cmd_seq: %d\n", - c2h_event.cmd_id , c2h_event.cmd_len, c2h_event.cmd_seq); - u1tmp = rtl_read_byte(rtlpriv, 0x01AF); - if (u1tmp == C2H_EVT_HOST_CLOSE) { - return; - } else if (u1tmp != C2H_EVT_FW_CLOSE) { - rtl_write_byte(rtlpriv, 0x1AF, 0x00); - return; - } - ptmbuf = kmalloc(c2h_event.cmd_len, GFP_KERNEL); - if (ptmbuf == NULL) { - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, - "malloc cmd buf failed\n"); - return; - } - - /* Read the content */ - for (index = 0; index < c2h_event.cmd_len; index++) - ptmbuf[index] = rtl_read_byte(rtlpriv, REG_C2HEVT_MSG_NORMAL + - 2 + index); - - switch (c2h_event.cmd_id) { - case C2H_BT_RSSI: - break; - - case C2H_BT_OP_MODE: - break; - - case BT_INFO: - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, - "BT info Byte[0] (ID) is 0x%x\n", c2h_event.cmd_id); - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, - "BT info Byte[1] (Seq) is 0x%x\n", c2h_event.cmd_seq); - RT_TRACE(rtlpriv, COMP_FW, DBG_TRACE, - "BT info Byte[2] (Data)= 0x%x\n", ptmbuf[0]); - - rtl8723ae_dm_bt_parse_bt_info(hw, ptmbuf, c2h_event.cmd_len); - break; - default: - break; - } - kfree(ptmbuf); - - rtl_write_byte(rtlpriv, 0x01AF, C2H_EVT_HOST_CLOSE); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/hal_btc.h b/drivers/net/wireless/rtlwifi/rtl8723ae/hal_btc.h deleted file mode 100644 index 4325ecd58f0c..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/hal_btc.h +++ /dev/null @@ -1,151 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * Larry Finger - * - **************************************************************************** - */ - -#ifndef __RTL8723E_HAL_BTC_H__ -#define __RTL8723E_HAL_BTC_H__ - -#include "../wifi.h" -#include "btc.h" -#include "hal_bt_coexist.h" - -#define BT_TXRX_CNT_THRES_1 1200 -#define BT_TXRX_CNT_THRES_2 1400 -#define BT_TXRX_CNT_THRES_3 3000 -#define BT_TXRX_CNT_LEVEL_0 0 /* < 1200 */ -#define BT_TXRX_CNT_LEVEL_1 1 /* >= 1200 && < 1400 */ -#define BT_TXRX_CNT_LEVEL_2 2 /* >= 1400 */ -#define BT_TXRX_CNT_LEVEL_3 3 - -/* TDMA mode definition */ -#define TDMA_2ANT 0 -#define TDMA_1ANT 1 -#define TDMA_NAV_OFF 0 -#define TDMA_NAV_ON 1 -#define TDMA_DAC_SWING_OFF 0 -#define TDMA_DAC_SWING_ON 1 - -/* PTA mode related definition */ -#define BT_PTA_MODE_OFF 0 -#define BT_PTA_MODE_ON 1 - -/* Penalty Tx Rate Adaptive */ -#define BT_TX_RATE_ADAPTIVE_NORMAL 0 -#define BT_TX_RATE_ADAPTIVE_LOW_PENALTY 1 - -/* RF Corner */ -#define BT_RF_RX_LPF_CORNER_RESUME 0 -#define BT_RF_RX_LPF_CORNER_SHRINK 1 - -#define C2H_EVT_HOST_CLOSE 0x00 -#define C2H_EVT_FW_CLOSE 0xFF - -enum bt_traffic_mode { - BT_MOTOR_EXT_BE = 0x00, - BT_MOTOR_EXT_GUL = 0x01, - BT_MOTOR_EXT_GUB = 0x02, - BT_MOTOR_EXT_GULB = 0x03 -}; - -enum bt_traffic_mode_profile { - BT_PROFILE_NONE, - BT_PROFILE_A2DP, - BT_PROFILE_PAN, - BT_PROFILE_HID, - BT_PROFILE_SCO -}; - -enum hci_ext_bt_operation { - HCI_BT_OP_NONE = 0x0, - HCI_BT_OP_INQUIRE_START = 0x1, - HCI_BT_OP_INQUIRE_FINISH = 0x2, - HCI_BT_OP_PAGING_START = 0x3, - HCI_BT_OP_PAGING_SUCCESS = 0x4, - HCI_BT_OP_PAGING_UNSUCCESS = 0x5, - HCI_BT_OP_PAIRING_START = 0x6, - HCI_BT_OP_PAIRING_FINISH = 0x7, - HCI_BT_OP_BT_DEV_ENABLE = 0x8, - HCI_BT_OP_BT_DEV_DISABLE = 0x9, - HCI_BT_OP_MAX, -}; - -enum bt_spec { - BT_SPEC_1_0_b = 0x00, - BT_SPEC_1_1 = 0x01, - BT_SPEC_1_2 = 0x02, - BT_SPEC_2_0_EDR = 0x03, - BT_SPEC_2_1_EDR = 0x04, - BT_SPEC_3_0_HS = 0x05, - BT_SPEC_4_0 = 0x06 -}; - -struct c2h_evt_hdr { - u8 cmd_id; - u8 cmd_len; - u8 cmd_seq; -}; - -enum bt_state { - BT_INFO_STATE_DISABLED = 0, - BT_INFO_STATE_NO_CONNECTION = 1, - BT_INFO_STATE_CONNECT_IDLE = 2, - BT_INFO_STATE_INQ_OR_PAG = 3, - BT_INFO_STATE_ACL_ONLY_BUSY = 4, - BT_INFO_STATE_SCO_ONLY_BUSY = 5, - BT_INFO_STATE_ACL_SCO_BUSY = 6, - BT_INFO_STATE_HID_BUSY = 7, - BT_INFO_STATE_HID_SCO_BUSY = 8, - BT_INFO_STATE_MAX = 7 -}; - -enum rtl8723ae_c2h_evt { - C2H_DBG = 0, - C2H_TSF = 1, - C2H_AP_RPT_RSP = 2, - C2H_CCX_TX_RPT = 3, /* The FW notify the report of the specific */ - /* tx packet. */ - C2H_BT_RSSI = 4, - C2H_BT_OP_MODE = 5, - C2H_HW_INFO_EXCH = 10, - C2H_C2H_H2C_TEST = 11, - BT_INFO = 12, - MAX_C2HEVENT -}; - -void rtl8723ae_dm_bt_fw_coex_all_off_8723a(struct ieee80211_hw *hw); -void rtl8723ae_dm_bt_sw_coex_all_off_8723a(struct ieee80211_hw *hw); -void rtl8723ae_dm_bt_hw_coex_all_off_8723a(struct ieee80211_hw *hw); -void rtl8723ae_dm_bt_coexist_8723(struct ieee80211_hw *hw); -void rtl8723ae_dm_bt_set_bt_dm(struct ieee80211_hw *hw, - struct btdm_8723 *p_btdm); -void rtl_8723e_c2h_command_handle(struct ieee80211_hw *hw); -void rtl_8723e_bt_wifi_media_status_notify(struct ieee80211_hw *hw, - bool mstatus); -void rtl8723ae_bt_coex_off_before_lps(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c deleted file mode 100644 index c333dfd116b8..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c +++ /dev/null @@ -1,2399 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../efuse.h" -#include "../base.h" -#include "../regd.h" -#include "../cam.h" -#include "../ps.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "fw.h" -#include "led.h" -#include "hw.h" -#include "pwrseqcmd.h" -#include "pwrseq.h" -#include "btc.h" - -static void _rtl8723ae_set_bcn_ctrl_reg(struct ieee80211_hw *hw, - u8 set_bits, u8 clear_bits) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpci->reg_bcn_ctrl_val |= set_bits; - rtlpci->reg_bcn_ctrl_val &= ~clear_bits; - - rtl_write_byte(rtlpriv, REG_BCN_CTRL, (u8) rtlpci->reg_bcn_ctrl_val); -} - -static void _rtl8723ae_stop_tx_beacon(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp1byte; - - tmp1byte = rtl_read_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2); - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, tmp1byte & (~BIT(6))); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0x64); - tmp1byte = rtl_read_byte(rtlpriv, REG_TBTT_PROHIBIT + 2); - tmp1byte &= ~(BIT(0)); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 2, tmp1byte); -} - -static void _rtl8723ae_resume_tx_beacon(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp1byte; - - tmp1byte = rtl_read_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2); - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, tmp1byte | BIT(6)); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0xff); - tmp1byte = rtl_read_byte(rtlpriv, REG_TBTT_PROHIBIT + 2); - tmp1byte |= BIT(1); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 2, tmp1byte); -} - -static void _rtl8723ae_enable_bcn_sufunc(struct ieee80211_hw *hw) -{ - _rtl8723ae_set_bcn_ctrl_reg(hw, 0, BIT(1)); -} - -static void _rtl8723ae_disable_bcn_sufunc(struct ieee80211_hw *hw) -{ - _rtl8723ae_set_bcn_ctrl_reg(hw, BIT(1), 0); -} - -void rtl8723ae_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - switch (variable) { - case HW_VAR_RCR: - *((u32 *) (val)) = rtlpci->receive_config; - break; - case HW_VAR_RF_STATE: - *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state; - break; - case HW_VAR_FWLPS_RF_ON:{ - enum rf_pwrstate rfState; - u32 val_rcr; - - rtlpriv->cfg->ops->get_hw_reg(hw, - HW_VAR_RF_STATE, - (u8 *) (&rfState)); - if (rfState == ERFOFF) { - *((bool *) (val)) = true; - } else { - val_rcr = rtl_read_dword(rtlpriv, REG_RCR); - val_rcr &= 0x00070000; - if (val_rcr) - *((bool *) (val)) = false; - else - *((bool *) (val)) = true; - } - break; } - case HW_VAR_FW_PSMODE_STATUS: - *((bool *) (val)) = ppsc->fw_current_inpsmode; - break; - case HW_VAR_CORRECT_TSF:{ - u64 tsf; - u32 *ptsf_low = (u32 *)&tsf; - u32 *ptsf_high = ((u32 *)&tsf) + 1; - - *ptsf_high = rtl_read_dword(rtlpriv, (REG_TSFTR + 4)); - *ptsf_low = rtl_read_dword(rtlpriv, REG_TSFTR); - - *((u64 *) (val)) = tsf; - - break; } - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not process\n"); - break; - } -} - -void rtl8723ae_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - u8 idx; - - switch (variable) { - case HW_VAR_ETHER_ADDR: - for (idx = 0; idx < ETH_ALEN; idx++) { - rtl_write_byte(rtlpriv, (REG_MACID + idx), - val[idx]); - } - break; - case HW_VAR_BASIC_RATE:{ - u16 rate_cfg = ((u16 *) val)[0]; - u8 rate_index = 0; - rate_cfg = rate_cfg & 0x15f; - rate_cfg |= 0x01; - rtl_write_byte(rtlpriv, REG_RRSR, rate_cfg & 0xff); - rtl_write_byte(rtlpriv, REG_RRSR + 1, - (rate_cfg >> 8) & 0xff); - while (rate_cfg > 0x1) { - rate_cfg = (rate_cfg >> 1); - rate_index++; - } - rtl_write_byte(rtlpriv, REG_INIRTS_RATE_SEL, - rate_index); - break; } - case HW_VAR_BSSID: - for (idx = 0; idx < ETH_ALEN; idx++) { - rtl_write_byte(rtlpriv, (REG_BSSID + idx), - val[idx]); - } - break; - case HW_VAR_SIFS: - rtl_write_byte(rtlpriv, REG_SIFS_CTX + 1, val[0]); - rtl_write_byte(rtlpriv, REG_SIFS_TRX + 1, val[1]); - - rtl_write_byte(rtlpriv, REG_SPEC_SIFS + 1, val[0]); - rtl_write_byte(rtlpriv, REG_MAC_SPEC_SIFS + 1, val[0]); - - if (!mac->ht_enable) - rtl_write_word(rtlpriv, REG_RESP_SIFS_OFDM, - 0x0e0e); - else - rtl_write_word(rtlpriv, REG_RESP_SIFS_OFDM, - *((u16 *) val)); - break; - case HW_VAR_SLOT_TIME:{ - u8 e_aci; - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "HW_VAR_SLOT_TIME %x\n", val[0]); - - rtl_write_byte(rtlpriv, REG_SLOT, val[0]); - - for (e_aci = 0; e_aci < AC_MAX; e_aci++) { - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_AC_PARAM, - (u8 *) (&e_aci)); - } - break; } - case HW_VAR_ACK_PREAMBLE:{ - u8 reg_tmp; - u8 short_preamble = (bool) (*(u8 *) val); - reg_tmp = (mac->cur_40_prime_sc) << 5; - if (short_preamble) - reg_tmp |= 0x80; - - rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_tmp); - break; } - case HW_VAR_AMPDU_MIN_SPACE:{ - u8 min_spacing_to_set; - u8 sec_min_space; - - min_spacing_to_set = *((u8 *) val); - if (min_spacing_to_set <= 7) { - sec_min_space = 0; - - if (min_spacing_to_set < sec_min_space) - min_spacing_to_set = sec_min_space; - - mac->min_space_cfg = ((mac->min_space_cfg & - 0xf8) | - min_spacing_to_set); - - *val = min_spacing_to_set; - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_AMPDU_MIN_SPACE: %#x\n", - mac->min_space_cfg); - - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, - mac->min_space_cfg); - } - break; } - case HW_VAR_SHORTGI_DENSITY:{ - u8 density_to_set; - - density_to_set = *((u8 *) val); - mac->min_space_cfg |= (density_to_set << 3); - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_SHORTGI_DENSITY: %#x\n", - mac->min_space_cfg); - - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, - mac->min_space_cfg); - - break; } - case HW_VAR_AMPDU_FACTOR:{ - u8 regtoset_normal[4] = {0x41, 0xa8, 0x72, 0xb9}; - u8 regtoset_bt[4] = {0x31, 0x74, 0x42, 0x97}; - u8 factor_toset; - u8 *p_regtoset = NULL; - u8 index; - - if ((pcipriv->bt_coexist.bt_coexistence) && - (pcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC4)) - p_regtoset = regtoset_bt; - else - p_regtoset = regtoset_normal; - - factor_toset = *((u8 *) val); - if (factor_toset <= 3) { - factor_toset = (1 << (factor_toset + 2)); - if (factor_toset > 0xf) - factor_toset = 0xf; - - for (index = 0; index < 4; index++) { - if ((p_regtoset[index] & 0xf0) > - (factor_toset << 4)) - p_regtoset[index] = - (p_regtoset[index] & 0x0f) | - (factor_toset << 4); - - if ((p_regtoset[index] & 0x0f) > - factor_toset) - p_regtoset[index] = - (p_regtoset[index] & 0xf0) | - (factor_toset); - - rtl_write_byte(rtlpriv, - (REG_AGGLEN_LMT + index), - p_regtoset[index]); - - } - - RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD, - "Set HW_VAR_AMPDU_FACTOR: %#x\n", - factor_toset); - } - break; } - case HW_VAR_AC_PARAM:{ - u8 e_aci = *((u8 *) val); - rtl8723ae_dm_init_edca_turbo(hw); - - if (rtlpci->acm_method != eAcmWay2_SW) - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_ACM_CTRL, - (u8 *) (&e_aci)); - break; } - case HW_VAR_ACM_CTRL:{ - u8 e_aci = *((u8 *) val); - union aci_aifsn *p_aci_aifsn = - (union aci_aifsn *)(&(mac->ac[0].aifs)); - u8 acm = p_aci_aifsn->f.acm; - u8 acm_ctrl = rtl_read_byte(rtlpriv, REG_ACMHWCTRL); - - acm_ctrl |= ((rtlpci->acm_method == 2) ? 0x0 : 0x1); - - if (acm) { - switch (e_aci) { - case AC0_BE: - acm_ctrl |= AcmHw_BeqEn; - break; - case AC2_VI: - acm_ctrl |= AcmHw_ViqEn; - break; - case AC3_VO: - acm_ctrl |= AcmHw_VoqEn; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "HW_VAR_ACM_CTRL acm set failed: eACI is %d\n", - acm); - break; - } - } else { - switch (e_aci) { - case AC0_BE: - acm_ctrl &= (~AcmHw_BeqEn); - break; - case AC2_VI: - acm_ctrl &= (~AcmHw_ViqEn); - break; - case AC3_VO: - acm_ctrl &= (~AcmHw_BeqEn); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - } - - RT_TRACE(rtlpriv, COMP_QOS, DBG_TRACE, - "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", - acm_ctrl); - rtl_write_byte(rtlpriv, REG_ACMHWCTRL, acm_ctrl); - break; } - case HW_VAR_RCR: - rtl_write_dword(rtlpriv, REG_RCR, ((u32 *) (val))[0]); - rtlpci->receive_config = ((u32 *) (val))[0]; - break; - case HW_VAR_RETRY_LIMIT:{ - u8 retry_limit = ((u8 *) (val))[0]; - - rtl_write_word(rtlpriv, REG_RL, - retry_limit << RETRY_LIMIT_SHORT_SHIFT | - retry_limit << RETRY_LIMIT_LONG_SHIFT); - break; } - case HW_VAR_DUAL_TSF_RST: - rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, (BIT(0) | BIT(1))); - break; - case HW_VAR_EFUSE_BYTES: - rtlefuse->efuse_usedbytes = *((u16 *) val); - break; - case HW_VAR_EFUSE_USAGE: - rtlefuse->efuse_usedpercentage = *((u8 *) val); - break; - case HW_VAR_IO_CMD: - rtl8723ae_phy_set_io_cmd(hw, (*(enum io_type *)val)); - break; - case HW_VAR_WPA_CONFIG: - rtl_write_byte(rtlpriv, REG_SECCFG, *((u8 *) val)); - break; - case HW_VAR_SET_RPWM:{ - u8 rpwm_val; - - rpwm_val = rtl_read_byte(rtlpriv, REG_PCIE_HRPWM); - udelay(1); - - if (rpwm_val & BIT(7)) { - rtl_write_byte(rtlpriv, REG_PCIE_HRPWM, - (*(u8 *) val)); - } else { - rtl_write_byte(rtlpriv, REG_PCIE_HRPWM, - ((*(u8 *) val) | BIT(7))); - } - - break; } - case HW_VAR_H2C_FW_PWRMODE:{ - u8 psmode = (*(u8 *) val); - - if (psmode != FW_PS_ACTIVE_MODE) - rtl8723ae_dm_rf_saving(hw, true); - - rtl8723ae_set_fw_pwrmode_cmd(hw, (*(u8 *) val)); - break; } - case HW_VAR_FW_PSMODE_STATUS: - ppsc->fw_current_inpsmode = *((bool *) val); - break; - case HW_VAR_H2C_FW_JOINBSSRPT:{ - u8 mstatus = (*(u8 *) val); - u8 tmp_regcr, tmp_reg422; - bool recover = false; - - if (mstatus == RT_MEDIA_CONNECT) { - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_AID, NULL); - - tmp_regcr = rtl_read_byte(rtlpriv, REG_CR + 1); - rtl_write_byte(rtlpriv, REG_CR + 1, - (tmp_regcr | BIT(0))); - - _rtl8723ae_set_bcn_ctrl_reg(hw, 0, BIT(3)); - _rtl8723ae_set_bcn_ctrl_reg(hw, BIT(4), 0); - - tmp_reg422 = rtl_read_byte(rtlpriv, - REG_FWHW_TXQ_CTRL + 2); - if (tmp_reg422 & BIT(6)) - recover = true; - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, - tmp_reg422 & (~BIT(6))); - - rtl8723ae_set_fw_rsvdpagepkt(hw, 0); - - _rtl8723ae_set_bcn_ctrl_reg(hw, BIT(3), 0); - _rtl8723ae_set_bcn_ctrl_reg(hw, 0, BIT(4)); - - if (recover) - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, - tmp_reg422); - - rtl_write_byte(rtlpriv, REG_CR + 1, - (tmp_regcr & ~(BIT(0)))); - } - rtl8723ae_set_fw_joinbss_report_cmd(hw, (*(u8 *) val)); - - break; } - case HW_VAR_H2C_FW_P2P_PS_OFFLOAD: - rtl8723ae_set_p2p_ps_offload_cmd(hw, (*(u8 *)val)); - break; - case HW_VAR_AID:{ - u16 u2btmp; - u2btmp = rtl_read_word(rtlpriv, REG_BCN_PSR_RPT); - u2btmp &= 0xC000; - rtl_write_word(rtlpriv, REG_BCN_PSR_RPT, (u2btmp | - mac->assoc_id)); - break; } - case HW_VAR_CORRECT_TSF:{ - u8 btype_ibss = ((u8 *) (val))[0]; - - if (btype_ibss == true) - _rtl8723ae_stop_tx_beacon(hw); - - _rtl8723ae_set_bcn_ctrl_reg(hw, 0, BIT(3)); - - rtl_write_dword(rtlpriv, REG_TSFTR, - (u32) (mac->tsf & 0xffffffff)); - rtl_write_dword(rtlpriv, REG_TSFTR + 4, - (u32) ((mac->tsf >> 32) & 0xffffffff)); - - _rtl8723ae_set_bcn_ctrl_reg(hw, BIT(3), 0); - - if (btype_ibss == true) - _rtl8723ae_resume_tx_beacon(hw); - break; } - case HW_VAR_FW_LPS_ACTION: { - bool enter_fwlps = *((bool *)val); - u8 rpwm_val, fw_pwrmode; - bool fw_current_inps; - - if (enter_fwlps) { - rpwm_val = 0x02; /* RF off */ - fw_current_inps = true; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_FW_PSMODE_STATUS, - (u8 *)(&fw_current_inps)); - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_PWRMODE, - (u8 *)(&ppsc->fwctrl_psmode)); - - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_SET_RPWM, - (u8 *)(&rpwm_val)); - } else { - rpwm_val = 0x0C; /* RF on */ - fw_pwrmode = FW_PS_ACTIVE_MODE; - fw_current_inps = false; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SET_RPWM, - (u8 *)(&rpwm_val)); - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_PWRMODE, - (u8 *)(&fw_pwrmode)); - - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_FW_PSMODE_STATUS, - (u8 *)(&fw_current_inps)); - } - break; } - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } -} - -static bool _rtl8723ae_llt_write(struct ieee80211_hw *hw, u32 address, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - bool status = true; - long count = 0; - u32 value = _LLT_INIT_ADDR(address) | - _LLT_INIT_DATA(data) | _LLT_OP(_LLT_WRITE_ACCESS); - - rtl_write_dword(rtlpriv, REG_LLT_INIT, value); - - do { - value = rtl_read_dword(rtlpriv, REG_LLT_INIT); - if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)) - break; - - if (count > POLLING_LLT_THRESHOLD) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Failed to polling write LLT done at address %d!\n", - address); - status = false; - break; - } - } while (++count); - - return status; -} - -static bool _rtl8723ae_llt_table_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - unsigned short i; - u8 txpktbuf_bndy; - u8 maxPage; - bool status; - u8 ubyte; - - maxPage = 255; - txpktbuf_bndy = 246; - - rtl_write_byte(rtlpriv, REG_CR, 0x8B); - - rtl_write_word(rtlpriv, REG_RQPN_NPQ, 0x0000); - - rtl_write_dword(rtlpriv, REG_RQPN, 0x80ac1c29); - rtl_write_byte(rtlpriv, REG_RQPN_NPQ, 0x03); - - rtl_write_dword(rtlpriv, REG_TRXFF_BNDY, (0x27FF0000 | txpktbuf_bndy)); - rtl_write_byte(rtlpriv, REG_TDECTRL + 1, txpktbuf_bndy); - - rtl_write_byte(rtlpriv, REG_TXPKTBUF_BCNQ_BDNY, txpktbuf_bndy); - rtl_write_byte(rtlpriv, REG_TXPKTBUF_MGQ_BDNY, txpktbuf_bndy); - - rtl_write_byte(rtlpriv, 0x45D, txpktbuf_bndy); - rtl_write_byte(rtlpriv, REG_PBP, 0x11); - rtl_write_byte(rtlpriv, REG_RX_DRVINFO_SZ, 0x4); - - for (i = 0; i < (txpktbuf_bndy - 1); i++) { - status = _rtl8723ae_llt_write(hw, i, i + 1); - if (true != status) - return status; - } - - status = _rtl8723ae_llt_write(hw, (txpktbuf_bndy - 1), 0xFF); - if (true != status) - return status; - - for (i = txpktbuf_bndy; i < maxPage; i++) { - status = _rtl8723ae_llt_write(hw, i, (i + 1)); - if (true != status) - return status; - } - - status = _rtl8723ae_llt_write(hw, maxPage, txpktbuf_bndy); - if (true != status) - return status; - - rtl_write_byte(rtlpriv, REG_CR, 0xff); - ubyte = rtl_read_byte(rtlpriv, REG_RQPN + 3); - rtl_write_byte(rtlpriv, REG_RQPN + 3, ubyte | BIT(7)); - - return true; -} - -static void _rtl8723ae_gen_refresh_led_state(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); - - if (rtlpriv->rtlhal.up_first_time) - return; - - if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) - rtl8723ae_sw_led_on(hw, pLed0); - else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT) - rtl8723ae_sw_led_on(hw, pLed0); - else - rtl8723ae_sw_led_off(hw, pLed0); -} - -static bool _rtl8712e_init_mac(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - unsigned char bytetmp; - unsigned short wordtmp; - u16 retry = 0; - u16 tmpu2b; - bool mac_func_enable; - - rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x00); - bytetmp = rtl_read_byte(rtlpriv, REG_CR); - if (bytetmp == 0xFF) - mac_func_enable = true; - else - mac_func_enable = false; - - - /* HW Power on sequence */ - if (!rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, - PWR_INTF_PCI_MSK, Rtl8723_NIC_ENABLE_FLOW)) - return false; - - bytetmp = rtl_read_byte(rtlpriv, REG_PCIE_CTRL_REG+2); - rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG+2, bytetmp | BIT(4)); - - /* eMAC time out function enable, 0x369[7]=1 */ - bytetmp = rtl_read_byte(rtlpriv, 0x369); - rtl_write_byte(rtlpriv, 0x369, bytetmp | BIT(7)); - - /* ePHY reg 0x1e bit[4]=1 using MDIO interface, - * we should do this before Enabling ASPM backdoor. - */ - do { - rtl_write_word(rtlpriv, 0x358, 0x5e); - udelay(100); - rtl_write_word(rtlpriv, 0x356, 0xc280); - rtl_write_word(rtlpriv, 0x354, 0xc290); - rtl_write_word(rtlpriv, 0x358, 0x3e); - udelay(100); - rtl_write_word(rtlpriv, 0x358, 0x5e); - udelay(100); - tmpu2b = rtl_read_word(rtlpriv, 0x356); - retry++; - } while (tmpu2b != 0xc290 && retry < 100); - - if (retry >= 100) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "InitMAC(): ePHY configure fail!!!\n"); - return false; - } - - rtl_write_word(rtlpriv, REG_CR, 0x2ff); - rtl_write_word(rtlpriv, REG_CR + 1, 0x06); - - if (!mac_func_enable) { - if (_rtl8723ae_llt_table_init(hw) == false) - return false; - } - - rtl_write_dword(rtlpriv, REG_HISR, 0xffffffff); - rtl_write_byte(rtlpriv, REG_HISRE, 0xff); - - rtl_write_word(rtlpriv, REG_TRXFF_BNDY + 2, 0x27ff); - - wordtmp = rtl_read_word(rtlpriv, REG_TRXDMA_CTRL) & 0xf; - wordtmp |= 0xF771; - rtl_write_word(rtlpriv, REG_TRXDMA_CTRL, wordtmp); - - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 1, 0x1F); - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); - rtl_write_word(rtlpriv, REG_RXFLTMAP2, 0xFFFF); - rtl_write_dword(rtlpriv, REG_TCR, rtlpci->transmit_config); - - rtl_write_byte(rtlpriv, 0x4d0, 0x0); - - rtl_write_dword(rtlpriv, REG_BCNQ_DESA, - ((u64) rtlpci->tx_ring[BEACON_QUEUE].dma) & - DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_MGQ_DESA, - (u64) rtlpci->tx_ring[MGNT_QUEUE].dma & - DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_VOQ_DESA, - (u64) rtlpci->tx_ring[VO_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_VIQ_DESA, - (u64) rtlpci->tx_ring[VI_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_BEQ_DESA, - (u64) rtlpci->tx_ring[BE_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_BKQ_DESA, - (u64) rtlpci->tx_ring[BK_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_HQ_DESA, - (u64) rtlpci->tx_ring[HIGH_QUEUE].dma & - DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_RX_DESA, - (u64) rtlpci->rx_ring[RX_MPDU_QUEUE].dma & - DMA_BIT_MASK(32)); - - rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG + 3, 0x74); - - rtl_write_dword(rtlpriv, REG_INT_MIG, 0); - - bytetmp = rtl_read_byte(rtlpriv, REG_APSD_CTRL); - rtl_write_byte(rtlpriv, REG_APSD_CTRL, bytetmp & ~BIT(6)); - do { - retry++; - bytetmp = rtl_read_byte(rtlpriv, REG_APSD_CTRL); - } while ((retry < 200) && (bytetmp & BIT(7))); - - _rtl8723ae_gen_refresh_led_state(hw); - - rtl_write_dword(rtlpriv, REG_MCUTST_1, 0x0); - - return true; -} - -static void _rtl8723ae_hw_configure(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - u8 reg_bw_opmode; - u32 reg_prsr; - - reg_bw_opmode = BW_OPMODE_20MHZ; - reg_prsr = RATE_ALL_CCK | RATE_ALL_OFDM_AG; - - rtl_write_byte(rtlpriv, REG_INIRTS_RATE_SEL, 0x8); - - rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); - - rtl_write_dword(rtlpriv, REG_RRSR, reg_prsr); - - rtl_write_byte(rtlpriv, REG_SLOT, 0x09); - - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, 0x0); - - rtl_write_word(rtlpriv, REG_FWHW_TXQ_CTRL, 0x1F80); - - rtl_write_word(rtlpriv, REG_RL, 0x0707); - - rtl_write_dword(rtlpriv, REG_BAR_MODE_CTRL, 0x02012802); - - rtl_write_byte(rtlpriv, REG_HWSEQ_CTRL, 0xFF); - - rtl_write_dword(rtlpriv, REG_DARFRC, 0x01000000); - rtl_write_dword(rtlpriv, REG_DARFRC + 4, 0x07060504); - rtl_write_dword(rtlpriv, REG_RARFRC, 0x01000000); - rtl_write_dword(rtlpriv, REG_RARFRC + 4, 0x07060504); - - if ((pcipriv->bt_coexist.bt_coexistence) && - (pcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC4)) - rtl_write_dword(rtlpriv, REG_AGGLEN_LMT, 0x97427431); - else - rtl_write_dword(rtlpriv, REG_AGGLEN_LMT, 0xb972a841); - - rtl_write_byte(rtlpriv, REG_ATIMWND, 0x2); - - rtl_write_byte(rtlpriv, REG_BCN_MAX_ERR, 0xff); - - rtlpci->reg_bcn_ctrl_val = 0x1f; - rtl_write_byte(rtlpriv, REG_BCN_CTRL, rtlpci->reg_bcn_ctrl_val); - - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0xff); - - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0xff); - - rtl_write_byte(rtlpriv, REG_PIFS, 0x1C); - rtl_write_byte(rtlpriv, REG_AGGR_BREAK_TIME, 0x16); - - if ((pcipriv->bt_coexist.bt_coexistence) && - (pcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC4)) { - rtl_write_word(rtlpriv, REG_NAV_PROT_LEN, 0x0020); - rtl_write_word(rtlpriv, REG_PROT_MODE_CTRL, 0x0402); - } else { - rtl_write_word(rtlpriv, REG_NAV_PROT_LEN, 0x0020); - rtl_write_word(rtlpriv, REG_NAV_PROT_LEN, 0x0020); - } - - if ((pcipriv->bt_coexist.bt_coexistence) && - (pcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC4)) - rtl_write_dword(rtlpriv, REG_FAST_EDCA_CTRL, 0x03086666); - else - rtl_write_dword(rtlpriv, REG_FAST_EDCA_CTRL, 0x086666); - - rtl_write_byte(rtlpriv, REG_ACKTO, 0x40); - - rtl_write_word(rtlpriv, REG_SPEC_SIFS, 0x1010); - rtl_write_word(rtlpriv, REG_MAC_SPEC_SIFS, 0x1010); - - rtl_write_word(rtlpriv, REG_SIFS_CTX, 0x1010); - - rtl_write_word(rtlpriv, REG_SIFS_TRX, 0x1010); - - rtl_write_dword(rtlpriv, REG_MAR, 0xffffffff); - rtl_write_dword(rtlpriv, REG_MAR + 4, 0xffffffff); - - rtl_write_dword(rtlpriv, 0x394, 0x1); -} - -static void _rtl8723ae_enable_aspm_back_door(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - rtl_write_byte(rtlpriv, 0x34b, 0x93); - rtl_write_word(rtlpriv, 0x350, 0x870c); - rtl_write_byte(rtlpriv, 0x352, 0x1); - - if (ppsc->support_backdoor) - rtl_write_byte(rtlpriv, 0x349, 0x1b); - else - rtl_write_byte(rtlpriv, 0x349, 0x03); - - rtl_write_word(rtlpriv, 0x350, 0x2718); - rtl_write_byte(rtlpriv, 0x352, 0x1); -} - -void rtl8723ae_enable_hw_security_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 sec_reg_value; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n", - rtlpriv->sec.pairwise_enc_algorithm, - rtlpriv->sec.group_enc_algorithm); - - if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "not open hw encryption\n"); - return; - } - - sec_reg_value = SCR_TxEncEnable | SCR_RxDecEnable; - - if (rtlpriv->sec.use_defaultkey) { - sec_reg_value |= SCR_TxUseDK; - sec_reg_value |= SCR_RxUseDK; - } - - sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK); - - rtl_write_byte(rtlpriv, REG_CR + 1, 0x02); - - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "The SECR-value %x\n", sec_reg_value); - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value); - -} - -int rtl8723ae_hw_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - bool rtstatus = true; - int err; - u8 tmp_u1b; - - rtlpriv->rtlhal.being_init_adapter = true; - rtlpriv->intf_ops->disable_aspm(hw); - rtstatus = _rtl8712e_init_mac(hw); - if (rtstatus != true) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Init MAC failed\n"); - err = 1; - return err; - } - - err = rtl8723ae_download_fw(hw); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Failed to download FW. Init HW without FW now..\n"); - err = 1; - rtlhal->fw_ready = false; - return err; - } else { - rtlhal->fw_ready = true; - } - - rtlhal->last_hmeboxnum = 0; - rtl8723ae_phy_mac_config(hw); - /* because the last function modifies RCR, we update - * rcr var here, or TP will be unstable as ther receive_config - * is wrong, RX RCR_ACRC32 will cause TP unstable & Rx - * RCR_APP_ICV will cause mac80211 unassoc for cisco 1252 - */ - rtlpci->receive_config = rtl_read_dword(rtlpriv, REG_RCR); - rtlpci->receive_config &= ~(RCR_ACRC32 | RCR_AICV); - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); - - rtl8723ae_phy_bb_config(hw); - rtlphy->rf_mode = RF_OP_BY_SW_3WIRE; - rtl8723ae_phy_rf_config(hw); - if (IS_VENDOR_UMC_A_CUT(rtlhal->version)) { - rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G1, MASKDWORD, 0x30255); - rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G2, MASKDWORD, 0x50a00); - } else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) { - rtl_set_rfreg(hw, RF90_PATH_A, 0x0C, MASKDWORD, 0x894AE); - rtl_set_rfreg(hw, RF90_PATH_A, 0x0A, MASKDWORD, 0x1AF31); - rtl_set_rfreg(hw, RF90_PATH_A, RF_IPA, MASKDWORD, 0x8F425); - rtl_set_rfreg(hw, RF90_PATH_A, RF_SYN_G2, MASKDWORD, 0x4F200); - rtl_set_rfreg(hw, RF90_PATH_A, RF_RCK1, MASKDWORD, 0x44053); - rtl_set_rfreg(hw, RF90_PATH_A, RF_RCK2, MASKDWORD, 0x80201); - } - rtlphy->rfreg_chnlval[0] = rtl_get_rfreg(hw, (enum radio_path)0, - RF_CHNLBW, RFREG_OFFSET_MASK); - rtlphy->rfreg_chnlval[1] = rtl_get_rfreg(hw, (enum radio_path)1, - RF_CHNLBW, RFREG_OFFSET_MASK); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BCCKEN, 0x1); - rtl_set_bbreg(hw, RFPGA0_RFMOD, BOFDMEN, 0x1); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 1); - _rtl8723ae_hw_configure(hw); - rtl_cam_reset_all_entry(hw); - rtl8723ae_enable_hw_security_config(hw); - - ppsc->rfpwr_state = ERFON; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, mac->mac_addr); - _rtl8723ae_enable_aspm_back_door(hw); - rtlpriv->intf_ops->enable_aspm(hw); - - rtl8723ae_bt_hw_init(hw); - - if (ppsc->rfpwr_state == ERFON) { - rtl8723ae_phy_set_rfpath_switch(hw, 1); - if (rtlphy->iqk_initialized) { - rtl8723ae_phy_iq_calibrate(hw, true); - } else { - rtl8723ae_phy_iq_calibrate(hw, false); - rtlphy->iqk_initialized = true; - } - - rtl8723ae_phy_lc_calibrate(hw); - } - - tmp_u1b = efuse_read_1byte(hw, 0x1FA); - if (!(tmp_u1b & BIT(0))) { - rtl_set_rfreg(hw, RF90_PATH_A, 0x15, 0x0F, 0x05); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "PA BIAS path A\n"); - } - - if (!(tmp_u1b & BIT(4))) { - tmp_u1b = rtl_read_byte(rtlpriv, 0x16) & 0x0F; - rtl_write_byte(rtlpriv, 0x16, tmp_u1b | 0x80); - udelay(10); - rtl_write_byte(rtlpriv, 0x16, tmp_u1b | 0x90); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "under 1.5V\n"); - } - rtl8723ae_dm_init(hw); - rtlpriv->rtlhal.being_init_adapter = false; - return err; -} - -static enum version_8723e _rtl8723ae_read_chip_version(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - enum version_8723e version = 0x0000; - u32 value32; - - value32 = rtl_read_dword(rtlpriv, REG_SYS_CFG); - if (value32 & TRP_VAUX_EN) { - version = (enum version_8723e)(version | - ((value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : 0)); - /* RTL8723 with BT function. */ - version = (enum version_8723e)(version | - ((value32 & BT_FUNC) ? CHIP_8723 : 0)); - - } else { - /* Normal mass production chip. */ - version = (enum version_8723e) NORMAL_CHIP; - version = (enum version_8723e)(version | - ((value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : 0)); - /* RTL8723 with BT function. */ - version = (enum version_8723e)(version | - ((value32 & BT_FUNC) ? CHIP_8723 : 0)); - if (IS_CHIP_VENDOR_UMC(version)) - version = (enum version_8723e)(version | - ((value32 & CHIP_VER_RTL_MASK)));/* IC version (CUT) */ - if (IS_8723_SERIES(version)) { - value32 = rtl_read_dword(rtlpriv, REG_GPIO_OUTSTS); - /* ROM code version */ - version = (enum version_8723e)(version | - ((value32 & RF_RL_ID)>>20)); - } - } - - if (IS_8723_SERIES(version)) { - value32 = rtl_read_dword(rtlpriv, REG_MULTI_FUNC_CTRL); - rtlphy->polarity_ctl = ((value32 & WL_HWPDN_SL) ? - RT_POLARITY_HIGH_ACT : - RT_POLARITY_LOW_ACT); - } - switch (version) { - case VERSION_TEST_UMC_CHIP_8723: - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Chip Version ID: VERSION_TEST_UMC_CHIP_8723.\n"); - break; - case VERSION_NORMAL_UMC_CHIP_8723_1T1R_A_CUT: - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Chip Version ID: VERSION_NORMAL_UMC_CHIP_8723_1T1R_A_CUT.\n"); - break; - case VERSION_NORMAL_UMC_CHIP_8723_1T1R_B_CUT: - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Chip Version ID: VERSION_NORMAL_UMC_CHIP_8723_1T1R_B_CUT.\n"); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Chip Version ID: Unknown. Bug?\n"); - break; - } - - if (IS_8723_SERIES(version)) - rtlphy->rf_type = RF_1T1R; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Chip RF Type: %s\n", - (rtlphy->rf_type == RF_2T2R) ? "RF_2T2R" : "RF_1T1R"); - - return version; -} - -static int _rtl8723ae_set_media_status(struct ieee80211_hw *hw, - enum nl80211_iftype type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 bt_msr = rtl_read_byte(rtlpriv, MSR) & 0xfc; - enum led_ctl_mode ledaction = LED_CTL_NO_LINK; - - rtl_write_dword(rtlpriv, REG_BCN_CTRL, 0); - RT_TRACE(rtlpriv, COMP_BEACON, DBG_LOUD, - "clear 0x550 when set HW_VAR_MEDIA_STATUS\n"); - - if (type == NL80211_IFTYPE_UNSPECIFIED || - type == NL80211_IFTYPE_STATION) { - _rtl8723ae_stop_tx_beacon(hw); - _rtl8723ae_enable_bcn_sufunc(hw); - } else if (type == NL80211_IFTYPE_ADHOC || - type == NL80211_IFTYPE_AP) { - _rtl8723ae_resume_tx_beacon(hw); - _rtl8723ae_disable_bcn_sufunc(hw); - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "Set HW_VAR_MEDIA_STATUS: No such media status(%x).\n", - type); - } - - switch (type) { - case NL80211_IFTYPE_UNSPECIFIED: - bt_msr |= MSR_NOLINK; - ledaction = LED_CTL_LINK; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to NO LINK!\n"); - break; - case NL80211_IFTYPE_ADHOC: - bt_msr |= MSR_ADHOC; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to Ad Hoc!\n"); - break; - case NL80211_IFTYPE_STATION: - bt_msr |= MSR_INFRA; - ledaction = LED_CTL_LINK; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to STA!\n"); - break; - case NL80211_IFTYPE_AP: - bt_msr |= MSR_AP; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Set Network type to AP!\n"); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Network type %d not supported!\n", - type); - return 1; - break; - - } - - rtl_write_byte(rtlpriv, (MSR), bt_msr); - rtlpriv->cfg->ops->led_control(hw, ledaction); - if ((bt_msr & 0x03) == MSR_AP) - rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); - else - rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); - return 0; -} - -void rtl8723ae_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u32 reg_rcr = rtlpci->receive_config; - - if (rtlpriv->psc.rfpwr_state != ERFON) - return; - - if (check_bssid == true) { - reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, - (u8 *)(®_rcr)); - _rtl8723ae_set_bcn_ctrl_reg(hw, 0, BIT(4)); - } else if (check_bssid == false) { - reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); - _rtl8723ae_set_bcn_ctrl_reg(hw, BIT(4), 0); - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_RCR, (u8 *) (®_rcr)); - } -} - -int rtl8723ae_set_network_type(struct ieee80211_hw *hw, - enum nl80211_iftype type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (_rtl8723ae_set_media_status(hw, type)) - return -EOPNOTSUPP; - - if (rtlpriv->mac80211.link_state == MAC80211_LINKED) { - if (type != NL80211_IFTYPE_AP) - rtl8723ae_set_check_bssid(hw, true); - } else { - rtl8723ae_set_check_bssid(hw, false); - } - return 0; -} - -/* don't set REG_EDCA_BE_PARAM here because mac80211 will send pkt when scan */ -void rtl8723ae_set_qos(struct ieee80211_hw *hw, int aci) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl8723ae_dm_init_edca_turbo(hw); - switch (aci) { - case AC1_BK: - rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM, 0xa44f); - break; - case AC0_BE: - /* rtl_write_dword(rtlpriv, REG_EDCA_BE_PARAM, u4ac_param); */ - break; - case AC2_VI: - rtl_write_dword(rtlpriv, REG_EDCA_VI_PARAM, 0x5e4322); - break; - case AC3_VO: - rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, 0x2f3222); - break; - default: - RT_ASSERT(false, "invalid aci: %d !\n", aci); - break; - } -} - -void rtl8723ae_enable_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - rtl_write_dword(rtlpriv, 0x3a8, rtlpci->irq_mask[0] & 0xFFFFFFFF); - rtl_write_dword(rtlpriv, 0x3ac, rtlpci->irq_mask[1] & 0xFFFFFFFF); - rtlpci->irq_enabled = true; -} - -void rtl8723ae_disable_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - rtl_write_dword(rtlpriv, 0x3a8, IMR8190_DISABLED); - rtl_write_dword(rtlpriv, 0x3ac, IMR8190_DISABLED); - rtlpci->irq_enabled = false; - synchronize_irq(rtlpci->pdev->irq); -} - -static void _rtl8723ae_poweroff_adapter(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 u1tmp; - - /* Combo (PCIe + USB) Card and PCIe-MF Card */ - /* 1. Run LPS WL RFOFF flow */ - rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, - PWR_INTF_PCI_MSK, Rtl8723_NIC_LPS_ENTER_FLOW); - - /* 2. 0x1F[7:0] = 0 */ - /* turn off RF */ - rtl_write_byte(rtlpriv, REG_RF_CTRL, 0x00); - if ((rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(7)) && rtlhal->fw_ready) - rtl8723ae_firmware_selfreset(hw); - - /* Reset MCU. Suggested by Filen. */ - u1tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN+1); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN+1, (u1tmp & (~BIT(2)))); - - /* g. MCUFWDL 0x80[1:0]=0 */ - /* reset MCU ready status */ - rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x00); - - /* HW card disable configuration. */ - rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, - PWR_INTF_PCI_MSK, Rtl8723_NIC_DISABLE_FLOW); - - /* Reset MCU IO Wrapper */ - u1tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL + 1); - rtl_write_byte(rtlpriv, REG_RSV_CTRL + 1, (u1tmp & (~BIT(0)))); - u1tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL + 1); - rtl_write_byte(rtlpriv, REG_RSV_CTRL + 1, u1tmp | BIT(0)); - - /* 7. RSV_CTRL 0x1C[7:0] = 0x0E */ - /* lock ISO/CLK/Power control register */ - rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x0e); -} - -void rtl8723ae_card_disable(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - enum nl80211_iftype opmode; - - mac->link_state = MAC80211_NOLINK; - opmode = NL80211_IFTYPE_UNSPECIFIED; - _rtl8723ae_set_media_status(hw, opmode); - if (rtlpci->driver_is_goingto_unload || - ppsc->rfoff_reason > RF_CHANGE_BY_PS) - rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF); - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - _rtl8723ae_poweroff_adapter(hw); - - /* after power off we should do iqk again */ - rtlpriv->phy.iqk_initialized = false; -} - -void rtl8723ae_interrupt_recognized(struct ieee80211_hw *hw, - u32 *p_inta, u32 *p_intb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - *p_inta = rtl_read_dword(rtlpriv, 0x3a0) & rtlpci->irq_mask[0]; - rtl_write_dword(rtlpriv, 0x3a0, *p_inta); -} - -void rtl8723ae_set_beacon_related_registers(struct ieee80211_hw *hw) -{ - - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 bcn_interval, atim_window; - - bcn_interval = mac->beacon_interval; - atim_window = 2; /*FIX MERGE */ - rtl8723ae_disable_interrupt(hw); - rtl_write_word(rtlpriv, REG_ATIMWND, atim_window); - rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); - rtl_write_word(rtlpriv, REG_BCNTCFG, 0x660f); - rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_CCK, 0x18); - rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_OFDM, 0x18); - rtl_write_byte(rtlpriv, 0x606, 0x30); - rtl8723ae_enable_interrupt(hw); -} - -void rtl8723ae_set_beacon_interval(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 bcn_interval = mac->beacon_interval; - - RT_TRACE(rtlpriv, COMP_BEACON, DBG_DMESG, - "beacon_interval:%d\n", bcn_interval); - rtl8723ae_disable_interrupt(hw); - rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); - rtl8723ae_enable_interrupt(hw); -} - -void rtl8723ae_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - RT_TRACE(rtlpriv, COMP_INTR, DBG_LOUD, - "add_msr:%x, rm_msr:%x\n", add_msr, rm_msr); - - if (add_msr) - rtlpci->irq_mask[0] |= add_msr; - if (rm_msr) - rtlpci->irq_mask[0] &= (~rm_msr); - rtl8723ae_disable_interrupt(hw); - rtl8723ae_enable_interrupt(hw); -} - -static u8 _rtl8723ae_get_chnl_group(u8 chnl) -{ - u8 group; - - if (chnl < 3) - group = 0; - else if (chnl < 9) - group = 1; - else - group = 2; - return group; -} - -static void _rtl8723ae_read_txpower_info_from_hwpg(struct ieee80211_hw *hw, - bool autoload_fail, - u8 *hwinfo) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 rf_path, index, tempval; - u16 i; - - for (rf_path = 0; rf_path < 1; rf_path++) { - for (i = 0; i < 3; i++) { - if (!autoload_fail) { - rtlefuse->eeprom_chnlarea_txpwr_cck - [rf_path][i] = - hwinfo[EEPROM_TXPOWERCCK + rf_path * 3 + i]; - rtlefuse->eeprom_chnlarea_txpwr_ht40_1s - [rf_path][i] = - hwinfo[EEPROM_TXPOWERHT40_1S + rf_path * - 3 + i]; - } else { - rtlefuse->eeprom_chnlarea_txpwr_cck - [rf_path][i] = - EEPROM_DEFAULT_TXPOWERLEVEL; - rtlefuse->eeprom_chnlarea_txpwr_ht40_1s - [rf_path][i] = - EEPROM_DEFAULT_TXPOWERLEVEL; - } - } - } - - for (i = 0; i < 3; i++) { - if (!autoload_fail) - tempval = hwinfo[EEPROM_TXPOWERHT40_2SDIFF + i]; - else - tempval = EEPROM_DEFAULT_HT40_2SDIFF; - rtlefuse->eprom_chnl_txpwr_ht40_2sdf[RF90_PATH_A][i] = - (tempval & 0xf); - rtlefuse->eprom_chnl_txpwr_ht40_2sdf[RF90_PATH_B][i] = - ((tempval & 0xf0) >> 4); - } - - for (rf_path = 0; rf_path < 2; rf_path++) - for (i = 0; i < 3; i++) - RTPRINT(rtlpriv, FINIT, INIT_EEPROM, - "RF(%d) EEPROM CCK Area(%d) = 0x%x\n", rf_path, - i, rtlefuse->eeprom_chnlarea_txpwr_cck - [rf_path][i]); - for (rf_path = 0; rf_path < 2; rf_path++) - for (i = 0; i < 3; i++) - RTPRINT(rtlpriv, FINIT, INIT_EEPROM, - "RF(%d) EEPROM HT40 1S Area(%d) = 0x%x\n", - rf_path, i, - rtlefuse->eeprom_chnlarea_txpwr_ht40_1s - [rf_path][i]); - for (rf_path = 0; rf_path < 2; rf_path++) - for (i = 0; i < 3; i++) - RTPRINT(rtlpriv, FINIT, INIT_EEPROM, - "RF(%d) EEPROM HT40 2S Diff Area(%d) = 0x%x\n", - rf_path, i, - rtlefuse->eprom_chnl_txpwr_ht40_2sdf - [rf_path][i]); - - for (rf_path = 0; rf_path < 2; rf_path++) { - for (i = 0; i < 14; i++) { - index = _rtl8723ae_get_chnl_group((u8) i); - - rtlefuse->txpwrlevel_cck[rf_path][i] = - rtlefuse->eeprom_chnlarea_txpwr_cck - [rf_path][index]; - rtlefuse->txpwrlevel_ht40_1s[rf_path][i] = - rtlefuse->eeprom_chnlarea_txpwr_ht40_1s - [rf_path][index]; - - if ((rtlefuse->eeprom_chnlarea_txpwr_ht40_1s - [rf_path][index] - - rtlefuse->eprom_chnl_txpwr_ht40_2sdf[rf_path] - [index]) > 0) { - rtlefuse->txpwrlevel_ht40_2s[rf_path][i] = - rtlefuse->eeprom_chnlarea_txpwr_ht40_1s - [rf_path][index] - - rtlefuse->eprom_chnl_txpwr_ht40_2sdf - [rf_path][index]; - } else { - rtlefuse->txpwrlevel_ht40_2s[rf_path][i] = 0; - } - } - - for (i = 0; i < 14; i++) { - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF(%d)-Ch(%d) [CCK / HT40_1S / HT40_2S] = " - "[0x%x / 0x%x / 0x%x]\n", rf_path, i, - rtlefuse->txpwrlevel_cck[rf_path][i], - rtlefuse->txpwrlevel_ht40_1s[rf_path][i], - rtlefuse->txpwrlevel_ht40_2s[rf_path][i]); - } - } - - for (i = 0; i < 3; i++) { - if (!autoload_fail) { - rtlefuse->eeprom_pwrlimit_ht40[i] = - hwinfo[EEPROM_TXPWR_GROUP + i]; - rtlefuse->eeprom_pwrlimit_ht20[i] = - hwinfo[EEPROM_TXPWR_GROUP + 3 + i]; - } else { - rtlefuse->eeprom_pwrlimit_ht40[i] = 0; - rtlefuse->eeprom_pwrlimit_ht20[i] = 0; - } - } - - for (rf_path = 0; rf_path < 2; rf_path++) { - for (i = 0; i < 14; i++) { - index = _rtl8723ae_get_chnl_group((u8) i); - - if (rf_path == RF90_PATH_A) { - rtlefuse->pwrgroup_ht20[rf_path][i] = - (rtlefuse->eeprom_pwrlimit_ht20[index] & - 0xf); - rtlefuse->pwrgroup_ht40[rf_path][i] = - (rtlefuse->eeprom_pwrlimit_ht40[index] & - 0xf); - } else if (rf_path == RF90_PATH_B) { - rtlefuse->pwrgroup_ht20[rf_path][i] = - ((rtlefuse->eeprom_pwrlimit_ht20[index] & - 0xf0) >> 4); - rtlefuse->pwrgroup_ht40[rf_path][i] = - ((rtlefuse->eeprom_pwrlimit_ht40[index] & - 0xf0) >> 4); - } - - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-%d pwrgroup_ht20[%d] = 0x%x\n", rf_path, i, - rtlefuse->pwrgroup_ht20[rf_path][i]); - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-%d pwrgroup_ht40[%d] = 0x%x\n", rf_path, i, - rtlefuse->pwrgroup_ht40[rf_path][i]); - } - } - - for (i = 0; i < 14; i++) { - index = _rtl8723ae_get_chnl_group((u8) i); - - if (!autoload_fail) - tempval = hwinfo[EEPROM_TXPOWERHT20DIFF + index]; - else - tempval = EEPROM_DEFAULT_HT20_DIFF; - - rtlefuse->txpwr_ht20diff[RF90_PATH_A][i] = (tempval & 0xF); - rtlefuse->txpwr_ht20diff[RF90_PATH_B][i] = - ((tempval >> 4) & 0xF); - - if (rtlefuse->txpwr_ht20diff[RF90_PATH_A][i] & BIT(3)) - rtlefuse->txpwr_ht20diff[RF90_PATH_A][i] |= 0xF0; - - if (rtlefuse->txpwr_ht20diff[RF90_PATH_B][i] & BIT(3)) - rtlefuse->txpwr_ht20diff[RF90_PATH_B][i] |= 0xF0; - - index = _rtl8723ae_get_chnl_group((u8) i); - - if (!autoload_fail) - tempval = hwinfo[EEPROM_TXPOWER_OFDMDIFF + index]; - else - tempval = EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF; - - rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][i] = (tempval & 0xF); - rtlefuse->txpwr_legacyhtdiff[RF90_PATH_B][i] = - ((tempval >> 4) & 0xF); - } - - rtlefuse->legacy_ht_txpowerdiff = - rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][7]; - - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-A Ht20 to HT40 Diff[%d] = 0x%x\n", i, - rtlefuse->txpwr_ht20diff[RF90_PATH_A][i]); - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-A Legacy to Ht40 Diff[%d] = 0x%x\n", i, - rtlefuse->txpwr_legacyhtdiff[RF90_PATH_A][i]); - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-B Ht20 to HT40 Diff[%d] = 0x%x\n", i, - rtlefuse->txpwr_ht20diff[RF90_PATH_B][i]); - for (i = 0; i < 14; i++) - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "RF-B Legacy to HT40 Diff[%d] = 0x%x\n", i, - rtlefuse->txpwr_legacyhtdiff[RF90_PATH_B][i]); - - if (!autoload_fail) - rtlefuse->eeprom_regulatory = (hwinfo[RF_OPTION1] & 0x7); - else - rtlefuse->eeprom_regulatory = 0; - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory); - - if (!autoload_fail) - rtlefuse->eeprom_tssi[RF90_PATH_A] = hwinfo[EEPROM_TSSI_A]; - else - rtlefuse->eeprom_tssi[RF90_PATH_A] = EEPROM_DEFAULT_TSSI; - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "TSSI_A = 0x%x, TSSI_B = 0x%x\n", - rtlefuse->eeprom_tssi[RF90_PATH_A], - rtlefuse->eeprom_tssi[RF90_PATH_B]); - - if (!autoload_fail) - tempval = hwinfo[EEPROM_THERMAL_METER]; - else - tempval = EEPROM_DEFAULT_THERMALMETER; - rtlefuse->eeprom_thermalmeter = (tempval & 0x1f); - - if (rtlefuse->eeprom_thermalmeter == 0x1f || autoload_fail) - rtlefuse->apk_thermalmeterignore = true; - - rtlefuse->thermalmeter[0] = rtlefuse->eeprom_thermalmeter; - RTPRINT(rtlpriv, FINIT, INIT_TXPOWER, - "thermalmeter = 0x%x\n", rtlefuse->eeprom_thermalmeter); -} - -static void _rtl8723ae_read_adapter_info(struct ieee80211_hw *hw, - bool pseudo_test) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE]; - u16 eeprom_id; - - if (pseudo_test) { - /* need add */ - return; - } - if (rtlefuse->epromtype == EEPROM_BOOT_EFUSE) { - rtl_efuse_shadow_map_update(hw); - - memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], - HWSET_MAX_SIZE); - } else if (rtlefuse->epromtype == EEPROM_93C46) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "RTL819X Not boot from eeprom, check it !!"); - } - - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, ("MAP\n"), - hwinfo, HWSET_MAX_SIZE); - - eeprom_id = *((u16 *)&hwinfo[0]); - if (eeprom_id != RTL8190_EEPROM_ID) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "EEPROM ID(%#x) is invalid!!\n", eeprom_id); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - } - - if (rtlefuse->autoload_failflag == true) - return; - - rtlefuse->eeprom_vid = *(u16 *) &hwinfo[EEPROM_VID]; - rtlefuse->eeprom_did = *(u16 *) &hwinfo[EEPROM_DID]; - rtlefuse->eeprom_svid = *(u16 *) &hwinfo[EEPROM_SVID]; - rtlefuse->eeprom_smid = *(u16 *) &hwinfo[EEPROM_SMID]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROMId = 0x%4x\n", eeprom_id); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid); - - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *)&hwinfo[EEPROM_MAC_ADDR + i]; - *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue; - } - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "dev_addr: %pM\n", rtlefuse->dev_addr); - - _rtl8723ae_read_txpower_info_from_hwpg(hw, - rtlefuse->autoload_failflag, hwinfo); - - rtl8723ae_read_bt_coexist_info_from_hwpg(hw, - rtlefuse->autoload_failflag, hwinfo); - - rtlefuse->eeprom_channelplan = *(u8 *)&hwinfo[EEPROM_CHANNELPLAN]; - rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION]; - rtlefuse->txpwr_fromeprom = true; - rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMER_ID]; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, - "EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid); - - /* set channel paln to world wide 13 */ - rtlefuse->channel_plan = COUNTRY_CODE_WORLD_WIDE_13; - - if (rtlhal->oem_id == RT_CID_DEFAULT) { - switch (rtlefuse->eeprom_oemid) { - case EEPROM_CID_DEFAULT: - if (rtlefuse->eeprom_did == 0x8176) { - if (CHK_SVID_SMID(0x10EC, 0x6151) || - CHK_SVID_SMID(0x10EC, 0x6152) || - CHK_SVID_SMID(0x10EC, 0x6154) || - CHK_SVID_SMID(0x10EC, 0x6155) || - CHK_SVID_SMID(0x10EC, 0x6177) || - CHK_SVID_SMID(0x10EC, 0x6178) || - CHK_SVID_SMID(0x10EC, 0x6179) || - CHK_SVID_SMID(0x10EC, 0x6180) || - CHK_SVID_SMID(0x10EC, 0x8151) || - CHK_SVID_SMID(0x10EC, 0x8152) || - CHK_SVID_SMID(0x10EC, 0x8154) || - CHK_SVID_SMID(0x10EC, 0x8155) || - CHK_SVID_SMID(0x10EC, 0x8181) || - CHK_SVID_SMID(0x10EC, 0x8182) || - CHK_SVID_SMID(0x10EC, 0x8184) || - CHK_SVID_SMID(0x10EC, 0x8185) || - CHK_SVID_SMID(0x10EC, 0x9151) || - CHK_SVID_SMID(0x10EC, 0x9152) || - CHK_SVID_SMID(0x10EC, 0x9154) || - CHK_SVID_SMID(0x10EC, 0x9155) || - CHK_SVID_SMID(0x10EC, 0x9181) || - CHK_SVID_SMID(0x10EC, 0x9182) || - CHK_SVID_SMID(0x10EC, 0x9184) || - CHK_SVID_SMID(0x10EC, 0x9185)) - rtlhal->oem_id = RT_CID_TOSHIBA; - else if (rtlefuse->eeprom_svid == 0x1025) - rtlhal->oem_id = RT_CID_819x_Acer; - else if (CHK_SVID_SMID(0x10EC, 0x6191) || - CHK_SVID_SMID(0x10EC, 0x6192) || - CHK_SVID_SMID(0x10EC, 0x6193) || - CHK_SVID_SMID(0x10EC, 0x7191) || - CHK_SVID_SMID(0x10EC, 0x7192) || - CHK_SVID_SMID(0x10EC, 0x7193) || - CHK_SVID_SMID(0x10EC, 0x8191) || - CHK_SVID_SMID(0x10EC, 0x8192) || - CHK_SVID_SMID(0x10EC, 0x8193)) - rtlhal->oem_id = RT_CID_819x_SAMSUNG; - else if (CHK_SVID_SMID(0x10EC, 0x8195) || - CHK_SVID_SMID(0x10EC, 0x9195) || - CHK_SVID_SMID(0x10EC, 0x7194) || - CHK_SVID_SMID(0x10EC, 0x8200) || - CHK_SVID_SMID(0x10EC, 0x8201) || - CHK_SVID_SMID(0x10EC, 0x8202) || - CHK_SVID_SMID(0x10EC, 0x9200)) - rtlhal->oem_id = RT_CID_819x_Lenovo; - else if (CHK_SVID_SMID(0x10EC, 0x8197) || - CHK_SVID_SMID(0x10EC, 0x9196)) - rtlhal->oem_id = RT_CID_819x_CLEVO; - else if (CHK_SVID_SMID(0x1028, 0x8194) || - CHK_SVID_SMID(0x1028, 0x8198) || - CHK_SVID_SMID(0x1028, 0x9197) || - CHK_SVID_SMID(0x1028, 0x9198)) - rtlhal->oem_id = RT_CID_819x_DELL; - else if (CHK_SVID_SMID(0x103C, 0x1629)) - rtlhal->oem_id = RT_CID_819x_HP; - else if (CHK_SVID_SMID(0x1A32, 0x2315)) - rtlhal->oem_id = RT_CID_819x_QMI; - else if (CHK_SVID_SMID(0x10EC, 0x8203)) - rtlhal->oem_id = RT_CID_819x_PRONETS; - else if (CHK_SVID_SMID(0x1043, 0x84B5)) - rtlhal->oem_id = - RT_CID_819x_Edimax_ASUS; - else - rtlhal->oem_id = RT_CID_DEFAULT; - } else if (rtlefuse->eeprom_did == 0x8178) { - if (CHK_SVID_SMID(0x10EC, 0x6181) || - CHK_SVID_SMID(0x10EC, 0x6182) || - CHK_SVID_SMID(0x10EC, 0x6184) || - CHK_SVID_SMID(0x10EC, 0x6185) || - CHK_SVID_SMID(0x10EC, 0x7181) || - CHK_SVID_SMID(0x10EC, 0x7182) || - CHK_SVID_SMID(0x10EC, 0x7184) || - CHK_SVID_SMID(0x10EC, 0x7185) || - CHK_SVID_SMID(0x10EC, 0x8181) || - CHK_SVID_SMID(0x10EC, 0x8182) || - CHK_SVID_SMID(0x10EC, 0x8184) || - CHK_SVID_SMID(0x10EC, 0x8185) || - CHK_SVID_SMID(0x10EC, 0x9181) || - CHK_SVID_SMID(0x10EC, 0x9182) || - CHK_SVID_SMID(0x10EC, 0x9184) || - CHK_SVID_SMID(0x10EC, 0x9185)) - rtlhal->oem_id = RT_CID_TOSHIBA; - else if (rtlefuse->eeprom_svid == 0x1025) - rtlhal->oem_id = RT_CID_819x_Acer; - else if (CHK_SVID_SMID(0x10EC, 0x8186)) - rtlhal->oem_id = RT_CID_819x_PRONETS; - else if (CHK_SVID_SMID(0x1043, 0x8486)) - rtlhal->oem_id = - RT_CID_819x_Edimax_ASUS; - else - rtlhal->oem_id = RT_CID_DEFAULT; - } else { - rtlhal->oem_id = RT_CID_DEFAULT; - } - break; - case EEPROM_CID_TOSHIBA: - rtlhal->oem_id = RT_CID_TOSHIBA; - break; - case EEPROM_CID_CCX: - rtlhal->oem_id = RT_CID_CCX; - break; - case EEPROM_CID_QMI: - rtlhal->oem_id = RT_CID_819x_QMI; - break; - case EEPROM_CID_WHQL: - break; - default: - rtlhal->oem_id = RT_CID_DEFAULT; - break; - - } - } -} - -static void _rtl8723ae_hal_customized_behavior(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - pcipriv->ledctl.led_opendrain = true; - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "RT Customized ID: 0x%02X\n", rtlhal->oem_id); -} - -void rtl8723ae_read_eeprom_info(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 tmp_u1b; - u32 value32; - - value32 = rtl_read_dword(rtlpriv, rtlpriv->cfg->maps[EFUSE_TEST]); - value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_WIFI_SEL_0); - rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[EFUSE_TEST], value32); - - rtlhal->version = _rtl8723ae_read_chip_version(hw); - - if (get_rf_type(rtlphy) == RF_1T1R) - rtlpriv->dm.rfpath_rxenable[0] = true; - else - rtlpriv->dm.rfpath_rxenable[0] = - rtlpriv->dm.rfpath_rxenable[1] = true; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "VersionID = 0x%4x\n", - rtlhal->version); - - tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR); - if (tmp_u1b & BIT(4)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EEPROM\n"); - rtlefuse->epromtype = EEPROM_93C46; - } else { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "Boot from EFUSE\n"); - rtlefuse->epromtype = EEPROM_BOOT_EFUSE; - } - if (tmp_u1b & BIT(5)) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "Autoload OK\n"); - rtlefuse->autoload_failflag = false; - _rtl8723ae_read_adapter_info(hw, false); - } else { - rtlefuse->autoload_failflag = true; - _rtl8723ae_read_adapter_info(hw, false); - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Autoload ERR!!\n"); - } - _rtl8723ae_hal_customized_behavior(hw); -} - -static void rtl8723ae_update_hal_rate_table(struct ieee80211_hw *hw, - struct ieee80211_sta *sta) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u32 ratr_value; - u8 ratr_index = 0; - u8 nmode = mac->ht_enable; - u8 mimo_ps = IEEE80211_SMPS_OFF; - u8 curtxbw_40mhz = mac->bw_40; - u8 curshortgi_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? - 1 : 0; - u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? - 1 : 0; - enum wireless_mode wirelessmode = mac->mode; - - if (rtlhal->current_bandtype == BAND_ON_5G) - ratr_value = sta->supp_rates[1] << 4; - else - ratr_value = sta->supp_rates[0]; - if (mac->opmode == NL80211_IFTYPE_ADHOC) - ratr_value = 0xfff; - ratr_value |= (sta->ht_cap.mcs.rx_mask[1] << 20 | - sta->ht_cap.mcs.rx_mask[0] << 12); - switch (wirelessmode) { - case WIRELESS_MODE_B: - if (ratr_value & 0x0000000c) - ratr_value &= 0x0000000d; - else - ratr_value &= 0x0000000f; - break; - case WIRELESS_MODE_G: - ratr_value &= 0x00000FF5; - break; - case WIRELESS_MODE_N_24G: - case WIRELESS_MODE_N_5G: - nmode = 1; - if (mimo_ps == IEEE80211_SMPS_STATIC) { - ratr_value &= 0x0007F005; - } else { - u32 ratr_mask; - - if (get_rf_type(rtlphy) == RF_1T2R || - get_rf_type(rtlphy) == RF_1T1R) - ratr_mask = 0x000ff005; - else - ratr_mask = 0x0f0ff005; - - ratr_value &= ratr_mask; - } - break; - default: - if (rtlphy->rf_type == RF_1T2R) - ratr_value &= 0x000ff0ff; - else - ratr_value &= 0x0f0ff0ff; - - break; - } - - if ((pcipriv->bt_coexist.bt_coexistence) && - (pcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC4) && - (pcipriv->bt_coexist.bt_cur_state) && - (pcipriv->bt_coexist.bt_ant_isolation) && - ((pcipriv->bt_coexist.bt_service == BT_SCO) || - (pcipriv->bt_coexist.bt_service == BT_BUSY))) - ratr_value &= 0x0fffcfc0; - else - ratr_value &= 0x0FFFFFFF; - - if (nmode && ((curtxbw_40mhz && curshortgi_40mhz) || - (!curtxbw_40mhz && curshortgi_20mhz))) - ratr_value |= 0x10000000; - - rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); - - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, - "%x\n", rtl_read_dword(rtlpriv, REG_ARFR0)); -} - -static void rtl8723ae_update_hal_rate_mask(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_sta_info *sta_entry = NULL; - u32 ratr_bitmap; - u8 ratr_index; - u8 curtxbw_40mhz = (sta->bandwidth >= IEEE80211_STA_RX_BW_40) ? 1 : 0; - u8 curshortgi_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? - 1 : 0; - u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? - 1 : 0; - enum wireless_mode wirelessmode = 0; - bool shortgi = false; - u8 rate_mask[5]; - u8 macid = 0; - u8 mimo_ps = IEEE80211_SMPS_OFF; - - sta_entry = (struct rtl_sta_info *) sta->drv_priv; - wirelessmode = sta_entry->wireless_mode; - if (mac->opmode == NL80211_IFTYPE_STATION) - curtxbw_40mhz = mac->bw_40; - else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) - macid = sta->aid + 1; - - if (rtlhal->current_bandtype == BAND_ON_5G) - ratr_bitmap = sta->supp_rates[1] << 4; - else - ratr_bitmap = sta->supp_rates[0]; - if (mac->opmode == NL80211_IFTYPE_ADHOC) - ratr_bitmap = 0xfff; - ratr_bitmap |= (sta->ht_cap.mcs.rx_mask[1] << 20 | - sta->ht_cap.mcs.rx_mask[0] << 12); - switch (wirelessmode) { - case WIRELESS_MODE_B: - ratr_index = RATR_INX_WIRELESS_B; - if (ratr_bitmap & 0x0000000c) - ratr_bitmap &= 0x0000000d; - else - ratr_bitmap &= 0x0000000f; - break; - case WIRELESS_MODE_G: - ratr_index = RATR_INX_WIRELESS_GB; - - if (rssi_level == 1) - ratr_bitmap &= 0x00000f00; - else if (rssi_level == 2) - ratr_bitmap &= 0x00000ff0; - else - ratr_bitmap &= 0x00000ff5; - break; - case WIRELESS_MODE_A: - ratr_index = RATR_INX_WIRELESS_A; - ratr_bitmap &= 0x00000ff0; - break; - case WIRELESS_MODE_N_24G: - case WIRELESS_MODE_N_5G: - ratr_index = RATR_INX_WIRELESS_NGB; - - if (mimo_ps == IEEE80211_SMPS_STATIC) { - if (rssi_level == 1) - ratr_bitmap &= 0x00070000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0007f000; - else - ratr_bitmap &= 0x0007f005; - } else { - if (rtlphy->rf_type == RF_1T2R || - rtlphy->rf_type == RF_1T1R) { - if (curtxbw_40mhz) { - if (rssi_level == 1) - ratr_bitmap &= 0x000f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x000ff000; - else - ratr_bitmap &= 0x000ff015; - } else { - if (rssi_level == 1) - ratr_bitmap &= 0x000f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x000ff000; - else - ratr_bitmap &= 0x000ff005; - } - } else { - if (curtxbw_40mhz) { - if (rssi_level == 1) - ratr_bitmap &= 0x0f0f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0f0ff000; - else - ratr_bitmap &= 0x0f0ff015; - } else { - if (rssi_level == 1) - ratr_bitmap &= 0x0f0f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0f0ff000; - else - ratr_bitmap &= 0x0f0ff005; - } - } - } - - if ((curtxbw_40mhz && curshortgi_40mhz) || - (!curtxbw_40mhz && curshortgi_20mhz)) { - if (macid == 0) - shortgi = true; - else if (macid == 1) - shortgi = false; - } - break; - default: - ratr_index = RATR_INX_WIRELESS_NGB; - - if (rtlphy->rf_type == RF_1T2R) - ratr_bitmap &= 0x000ff0ff; - else - ratr_bitmap &= 0x0f0ff0ff; - break; - } - sta_entry->ratr_index = ratr_index; - - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, - "ratr_bitmap :%x\n", ratr_bitmap); - /* convert ratr_bitmap to le byte array */ - rate_mask[0] = ratr_bitmap; - rate_mask[1] = (ratr_bitmap >>= 8); - rate_mask[2] = (ratr_bitmap >>= 8); - rate_mask[3] = ((ratr_bitmap >> 8) & 0x0f) | (ratr_index << 4); - rate_mask[4] = macid | (shortgi ? 0x20 : 0x00) | 0x80; - RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, - "Rate_index:%x, ratr_bitmap: %*phC\n", - ratr_index, 5, rate_mask); - rtl8723ae_fill_h2c_cmd(hw, H2C_RA_MASK, 5, rate_mask); -} - -void rtl8723ae_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->dm.useramask) - rtl8723ae_update_hal_rate_mask(hw, sta, rssi_level); - else - rtl8723ae_update_hal_rate_table(hw, sta); -} - -void rtl8723ae_update_channel_access_setting(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 sifs_timer; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME, - (u8 *)&mac->slot_time); - if (!mac->ht_enable) - sifs_timer = 0x0a0a; - else - sifs_timer = 0x1010; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SIFS, (u8 *)&sifs_timer); -} - -bool rtl8723ae_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - enum rf_pwrstate e_rfpowerstate_toset; - u8 u1tmp; - bool actuallyset = false; - - if (rtlpriv->rtlhal.being_init_adapter) - return false; - - if (ppsc->swrf_processing) - return false; - - spin_lock(&rtlpriv->locks.rf_ps_lock); - if (ppsc->rfchange_inprogress) { - spin_unlock(&rtlpriv->locks.rf_ps_lock); - return false; - } else { - ppsc->rfchange_inprogress = true; - spin_unlock(&rtlpriv->locks.rf_ps_lock); - } - - rtl_write_byte(rtlpriv, REG_GPIO_IO_SEL_2, - rtl_read_byte(rtlpriv, REG_GPIO_IO_SEL_2)&~(BIT(1))); - - u1tmp = rtl_read_byte(rtlpriv, REG_GPIO_PIN_CTRL_2); - - if (rtlphy->polarity_ctl) - e_rfpowerstate_toset = (u1tmp & BIT(1)) ? ERFOFF : ERFON; - else - e_rfpowerstate_toset = (u1tmp & BIT(1)) ? ERFON : ERFOFF; - - if ((ppsc->hwradiooff == true) && (e_rfpowerstate_toset == ERFON)) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "GPIOChangeRF - HW Radio ON, RF ON\n"); - - e_rfpowerstate_toset = ERFON; - ppsc->hwradiooff = false; - actuallyset = true; - } else if ((ppsc->hwradiooff == false) - && (e_rfpowerstate_toset == ERFOFF)) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "GPIOChangeRF - HW Radio OFF, RF OFF\n"); - - e_rfpowerstate_toset = ERFOFF; - ppsc->hwradiooff = true; - actuallyset = true; - } - - if (actuallyset) { - spin_lock(&rtlpriv->locks.rf_ps_lock); - ppsc->rfchange_inprogress = false; - spin_unlock(&rtlpriv->locks.rf_ps_lock); - } else { - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - - spin_lock(&rtlpriv->locks.rf_ps_lock); - ppsc->rfchange_inprogress = false; - spin_unlock(&rtlpriv->locks.rf_ps_lock); - } - - *valid = 1; - return !ppsc->hwradiooff; -} - -void rtl8723ae_set_key(struct ieee80211_hw *hw, u32 key_index, - u8 *p_macaddr, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 *macaddr = p_macaddr; - u32 entry_id = 0; - bool is_pairwise = false; - static u8 cam_const_addr[4][6] = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} - }; - static u8 cam_const_broad[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - }; - - if (clear_all) { - u8 idx = 0; - u8 cam_offset = 0; - u8 clear_number = 5; - - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, "clear_all\n"); - - for (idx = 0; idx < clear_number; idx++) { - rtl_cam_mark_invalid(hw, cam_offset + idx); - rtl_cam_empty_entry(hw, cam_offset + idx); - - if (idx < 5) { - memset(rtlpriv->sec.key_buf[idx], 0, - MAX_KEY_LEN); - rtlpriv->sec.key_len[idx] = 0; - } - } - } else { - switch (enc_algo) { - case WEP40_ENCRYPTION: - enc_algo = CAM_WEP40; - break; - case WEP104_ENCRYPTION: - enc_algo = CAM_WEP104; - break; - case TKIP_ENCRYPTION: - enc_algo = CAM_TKIP; - break; - case AESCCMP_ENCRYPTION: - enc_algo = CAM_AES; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - enc_algo = CAM_TKIP; - break; - } - - if (is_wepkey || rtlpriv->sec.use_defaultkey) { - macaddr = cam_const_addr[key_index]; - entry_id = key_index; - } else { - if (is_group) { - macaddr = cam_const_broad; - entry_id = key_index; - } else { - if (mac->opmode == NL80211_IFTYPE_AP) { - entry_id = rtl_cam_get_free_entry(hw, - macaddr); - if (entry_id >= TOTAL_CAM_ENTRY) { - RT_TRACE(rtlpriv, COMP_SEC, - DBG_EMERG, - "Can not find free hw security cam entry\n"); - return; - } - } else { - entry_id = CAM_PAIRWISE_KEY_POSITION; - } - - key_index = PAIRWISE_KEYIDX; - is_pairwise = true; - } - } - - if (rtlpriv->sec.key_len[key_index] == 0) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "delete one entry, entry_id is %d\n", - entry_id); - if (mac->opmode == NL80211_IFTYPE_AP) - rtl_cam_del_entry(hw, p_macaddr); - rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); - } else { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "add one entry\n"); - if (is_pairwise) { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "set Pairwiase key\n"); - - rtl_cam_add_one_entry(hw, macaddr, key_index, - entry_id, enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf[key_index]); - } else { - RT_TRACE(rtlpriv, COMP_SEC, DBG_DMESG, - "set group key\n"); - - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - rtl_cam_add_one_entry(hw, - rtlefuse->dev_addr, - PAIRWISE_KEYIDX, - CAM_PAIRWISE_KEY_POSITION, - enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf - [entry_id]); - } - - rtl_cam_add_one_entry(hw, macaddr, key_index, - entry_id, enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf[entry_id]); - } - - } - } -} - -static void rtl8723ae_bt_var_init(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - pcipriv->bt_coexist.bt_coexistence = - pcipriv->bt_coexist.eeprom_bt_coexist; - pcipriv->bt_coexist.bt_ant_num = - pcipriv->bt_coexist.eeprom_bt_ant_num; - pcipriv->bt_coexist.bt_coexist_type = - pcipriv->bt_coexist.eeprom_bt_type; - - pcipriv->bt_coexist.bt_ant_isolation = - pcipriv->bt_coexist.eeprom_bt_ant_isol; - - pcipriv->bt_coexist.bt_radio_shared_type = - pcipriv->bt_coexist.eeprom_bt_radio_shared; - - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "BT Coexistance = 0x%x\n", - pcipriv->bt_coexist.bt_coexistence); - - if (pcipriv->bt_coexist.bt_coexistence) { - pcipriv->bt_coexist.bt_busy_traffic = false; - pcipriv->bt_coexist.bt_traffic_mode_set = false; - pcipriv->bt_coexist.bt_non_traffic_mode_set = false; - - pcipriv->bt_coexist.cstate = 0; - pcipriv->bt_coexist.previous_state = 0; - - if (pcipriv->bt_coexist.bt_ant_num == ANT_X2) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "BlueTooth BT_Ant_Num = Antx2\n"); - } else if (pcipriv->bt_coexist.bt_ant_num == ANT_X1) { - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "BlueTooth BT_Ant_Num = Antx1\n"); - } - - switch (pcipriv->bt_coexist.bt_coexist_type) { - case BT_2WIRE: - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "BlueTooth BT_CoexistType = BT_2Wire\n"); - break; - case BT_ISSC_3WIRE: - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "BlueTooth BT_CoexistType = BT_ISSC_3Wire\n"); - break; - case BT_ACCEL: - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "BlueTooth BT_CoexistType = BT_ACCEL\n"); - break; - case BT_CSR_BC4: - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "BlueTooth BT_CoexistType = BT_CSR_BC4\n"); - break; - case BT_CSR_BC8: - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "BlueTooth BT_CoexistType = BT_CSR_BC8\n"); - break; - case BT_RTL8756: - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "BlueTooth BT_CoexistType = BT_RTL8756\n"); - break; - default: - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "BlueTooth BT_CoexistType = Unknown\n"); - break; - } - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "BlueTooth BT_Ant_isolation = %d\n", - pcipriv->bt_coexist.bt_ant_isolation); - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_TRACE, - "BT_RadioSharedType = 0x%x\n", - pcipriv->bt_coexist.bt_radio_shared_type); - pcipriv->bt_coexist.bt_active_zero_cnt = 0; - pcipriv->bt_coexist.cur_bt_disabled = false; - pcipriv->bt_coexist.pre_bt_disabled = false; - } -} - -void rtl8723ae_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, - bool auto_load_fail, u8 *hwinfo) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 value; - u32 tmpu_32; - - if (!auto_load_fail) { - tmpu_32 = rtl_read_dword(rtlpriv, REG_MULTI_FUNC_CTRL); - if (tmpu_32 & BIT(18)) - pcipriv->bt_coexist.eeprom_bt_coexist = 1; - else - pcipriv->bt_coexist.eeprom_bt_coexist = 0; - value = hwinfo[RF_OPTION4]; - pcipriv->bt_coexist.eeprom_bt_type = BT_RTL8723A; - pcipriv->bt_coexist.eeprom_bt_ant_num = (value & 0x1); - pcipriv->bt_coexist.eeprom_bt_ant_isol = ((value & 0x10) >> 4); - pcipriv->bt_coexist.eeprom_bt_radio_shared = - ((value & 0x20) >> 5); - } else { - pcipriv->bt_coexist.eeprom_bt_coexist = 0; - pcipriv->bt_coexist.eeprom_bt_type = BT_RTL8723A; - pcipriv->bt_coexist.eeprom_bt_ant_num = ANT_X2; - pcipriv->bt_coexist.eeprom_bt_ant_isol = 0; - pcipriv->bt_coexist.eeprom_bt_radio_shared = BT_RADIO_SHARED; - } - - rtl8723ae_bt_var_init(hw); -} - -void rtl8723ae_bt_reg_init(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - - /* 0:Low, 1:High, 2:From Efuse. */ - pcipriv->bt_coexist.reg_bt_iso = 2; - /* 0:Idle, 1:None-SCO, 2:SCO, 3:From Counter. */ - pcipriv->bt_coexist.reg_bt_sco = 3; - /* 0:Disable BT control A-MPDU, 1:Enable BT control A-MPDU. */ - pcipriv->bt_coexist.reg_bt_sco = 0; -} - - -void rtl8723ae_bt_hw_init(struct ieee80211_hw *hw) -{ -} - -void rtl8723ae_suspend(struct ieee80211_hw *hw) -{ -} - -void rtl8723ae_resume(struct ieee80211_hw *hw) -{ -} - -/* Turn on AAP (RCR:bit 0) for promicuous mode. */ -void rtl8723ae_allow_all_destaddr(struct ieee80211_hw *hw, - bool allow_all_da, bool write_into_reg) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - if (allow_all_da) /* Set BIT0 */ - rtlpci->receive_config |= RCR_AAP; - else /* Clear BIT0 */ - rtlpci->receive_config &= ~RCR_AAP; - - if (write_into_reg) - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); - - - RT_TRACE(rtlpriv, COMP_TURBO | COMP_INIT, DBG_LOUD, - "receive_config=0x%08X, write_into_reg=%d\n", - rtlpci->receive_config, write_into_reg); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/hw.h b/drivers/net/wireless/rtlwifi/rtl8723ae/hw.h deleted file mode 100644 index 6fa24f79b1d7..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/hw.h +++ /dev/null @@ -1,73 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL8723E_HW_H__ -#define __RTL8723E_HW_H__ - -#define CHK_SVID_SMID(_val1, _val2) \ - ((rtlefuse->eeprom_svid == (_val1)) && \ - (rtlefuse->eeprom_smid == (_val2))) - -void rtl8723ae_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); -void rtl8723ae_read_eeprom_info(struct ieee80211_hw *hw); - -void rtl8723ae_interrupt_recognized(struct ieee80211_hw *hw, - u32 *p_inta, u32 *p_intb); -int rtl8723ae_hw_init(struct ieee80211_hw *hw); -void rtl8723ae_card_disable(struct ieee80211_hw *hw); -void rtl8723ae_enable_interrupt(struct ieee80211_hw *hw); -void rtl8723ae_disable_interrupt(struct ieee80211_hw *hw); -int rtl8723ae_set_network_type(struct ieee80211_hw *hw, - enum nl80211_iftype type); -void rtl8723ae_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); -void rtl8723ae_set_qos(struct ieee80211_hw *hw, int aci); -void rtl8723ae_set_beacon_related_registers(struct ieee80211_hw *hw); -void rtl8723ae_set_beacon_interval(struct ieee80211_hw *hw); -void rtl8723ae_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr); -void rtl8723ae_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); -void rtl8723ae_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level); -void rtl8723ae_update_channel_access_setting(struct ieee80211_hw *hw); -bool rtl8723ae_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid); -void rtl8723ae_enable_hw_security_config(struct ieee80211_hw *hw); -void rtl8723ae_set_key(struct ieee80211_hw *hw, u32 key_index, - u8 *p_macaddr, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all); - -void rtl8723ae_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, - bool autoload_fail, u8 *hwinfo); -void rtl8723ae_bt_reg_init(struct ieee80211_hw *hw); -void rtl8723ae_bt_hw_init(struct ieee80211_hw *hw); -void rtl8723ae_suspend(struct ieee80211_hw *hw); -void rtl8723ae_resume(struct ieee80211_hw *hw); -void rtl8723ae_allow_all_destaddr(struct ieee80211_hw *hw, - bool allow_all_da, bool write_into_reg); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/led.c b/drivers/net/wireless/rtlwifi/rtl8723ae/led.c deleted file mode 100644 index 061526fe6e2d..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/led.c +++ /dev/null @@ -1,157 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "reg.h" -#include "led.h" - -static void _rtl8723ae_init_led(struct ieee80211_hw *hw, - struct rtl_led *pled, enum rtl_led_pin ledpin) -{ - pled->hw = hw; - pled->ledpin = ledpin; - pled->ledon = false; -} - -void rtl8723ae_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 ledcfg; - - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, - "LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin); - - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); - - switch (pled->ledpin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - ledcfg &= ~BIT(6); - rtl_write_byte(rtlpriv, - REG_LEDCFG2, (ledcfg & 0xf0) | BIT(5)); - break; - case LED_PIN_LED1: - rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg & 0x0f) | BIT(5)); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - pled->ledon = true; -} - -void rtl8723ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - u8 ledcfg; - - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, - "LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin); - - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); - - switch (pled->ledpin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - ledcfg &= 0xf0; - if (pcipriv->ledctl.led_opendrain) { - ledcfg &= 0x90; - rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg|BIT(3))); - ledcfg = rtl_read_byte(rtlpriv, REG_MAC_PINMUX_CFG); - ledcfg &= 0xFE; - rtl_write_byte(rtlpriv, REG_MAC_PINMUX_CFG, ledcfg); - } else { - ledcfg &= ~BIT(6); - rtl_write_byte(rtlpriv, REG_LEDCFG2, - (ledcfg | BIT(3) | BIT(5))); - } - break; - case LED_PIN_LED1: - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG1) & 0x10; - rtl_write_byte(rtlpriv, REG_LEDCFG1, (ledcfg | BIT(3))); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - break; - } - pled->ledon = false; -} - -void rtl8723ae_init_sw_leds(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - - _rtl8723ae_init_led(hw, &(pcipriv->ledctl.sw_led0), LED_PIN_LED0); - _rtl8723ae_init_led(hw, &(pcipriv->ledctl.sw_led1), LED_PIN_LED1); -} - -static void _rtl8723ae_sw_led_control(struct ieee80211_hw *hw, - enum led_ctl_mode ledaction) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); - - switch (ledaction) { - case LED_CTL_POWER_ON: - case LED_CTL_LINK: - case LED_CTL_NO_LINK: - rtl8723ae_sw_led_on(hw, pLed0); - break; - case LED_CTL_POWER_OFF: - rtl8723ae_sw_led_off(hw, pLed0); - break; - default: - break; - } -} - -void rtl8723ae_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - if ((ppsc->rfoff_reason > RF_CHANGE_BY_PS) && - (ledaction == LED_CTL_TX || - ledaction == LED_CTL_RX || - ledaction == LED_CTL_SITE_SURVEY || - ledaction == LED_CTL_LINK || - ledaction == LED_CTL_NO_LINK || - ledaction == LED_CTL_START_TO_LINK || - ledaction == LED_CTL_POWER_ON)) { - return; - } - RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, "ledaction %d,\n", ledaction); - _rtl8723ae_sw_led_control(hw, ledaction); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/led.h b/drivers/net/wireless/rtlwifi/rtl8723ae/led.h deleted file mode 100644 index 2cb88e78f62a..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/led.h +++ /dev/null @@ -1,39 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92CE_LED_H__ -#define __RTL92CE_LED_H__ - -void rtl8723ae_init_sw_leds(struct ieee80211_hw *hw); -void rtl8723ae_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl8723ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl8723ae_led_control(struct ieee80211_hw *hw, - enum led_ctl_mode ledaction); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c b/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c deleted file mode 100644 index eafbb18dd48e..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c +++ /dev/null @@ -1,2028 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../ps.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" -#include "table.h" - -/* static forward definitions */ -static u32 _phy_fw_rf_serial_read(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset); -static void _phy_fw_rf_serial_write(struct ieee80211_hw *hw, - enum radio_path rfpath, - u32 offset, u32 data); -static u32 _phy_rf_serial_read(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset); -static void _phy_rf_serial_write(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset, u32 data); -static u32 _phy_calculate_bit_shift(u32 bitmask); -static bool _phy_bb8192c_config_parafile(struct ieee80211_hw *hw); -static bool _phy_cfg_mac_w_header(struct ieee80211_hw *hw); -static bool _phy_cfg_bb_w_header(struct ieee80211_hw *hw, u8 configtype); -static bool _phy_cfg_bb_w_pgheader(struct ieee80211_hw *hw, u8 configtype); -static void _phy_init_bb_rf_reg_def(struct ieee80211_hw *hw); -static bool _phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable, - u32 cmdtableidx, u32 cmdtablesz, - enum swchnlcmd_id cmdid, - u32 para1, u32 para2, - u32 msdelay); -static bool _phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, u8 channel, - u8 *stage, u8 *step, u32 *delay); -static u8 _phy_dbm_to_txpwr_Idx(struct ieee80211_hw *hw, - enum wireless_mode wirelessmode, - long power_indbm); -static long _phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw, - enum wireless_mode wirelessmode, u8 txpwridx); -static void rtl8723ae_phy_set_io(struct ieee80211_hw *hw); - -u32 rtl8723ae_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, - u32 bitmask) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 returnvalue, originalvalue, bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x)\n", regaddr, bitmask); - originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _phy_calculate_bit_shift(bitmask); - returnvalue = (originalvalue & bitmask) >> bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "BBR MASK=0x%x Addr[0x%x]=0x%x\n", bitmask, regaddr, - originalvalue); - - return returnvalue; -} - -void rtl8723ae_phy_set_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 originalvalue, bitshift; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x)\n", regaddr, - bitmask, data); - - if (bitmask != MASKDWORD) { - originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _phy_calculate_bit_shift(bitmask); - data = ((originalvalue & (~bitmask)) | (data << bitshift)); - } - - rtl_write_dword(rtlpriv, regaddr, data); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x)\n", - regaddr, bitmask, data); -} - -u32 rtl8723ae_phy_query_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, u32 bitmask) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 original_value, readback_value, bitshift; - struct rtl_phy *rtlphy = &(rtlpriv->phy); - unsigned long flags; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n", - regaddr, rfpath, bitmask); - - spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags); - - if (rtlphy->rf_mode != RF_OP_BY_FW) - original_value = _phy_rf_serial_read(hw, rfpath, regaddr); - else - original_value = _phy_fw_rf_serial_read(hw, rfpath, regaddr); - - bitshift = _phy_calculate_bit_shift(bitmask); - readback_value = (original_value & bitmask) >> bitshift; - - spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n", - regaddr, rfpath, bitmask, original_value); - - return readback_value; -} - -void rtl8723ae_phy_set_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, - u32 regaddr, u32 bitmask, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 original_value, bitshift; - unsigned long flags; - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", - regaddr, bitmask, data, rfpath); - - spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags); - - if (rtlphy->rf_mode != RF_OP_BY_FW) { - if (bitmask != RFREG_OFFSET_MASK) { - original_value = _phy_rf_serial_read(hw, rfpath, - regaddr); - bitshift = _phy_calculate_bit_shift(bitmask); - data = ((original_value & (~bitmask)) | - (data << bitshift)); - } - - _phy_rf_serial_write(hw, rfpath, regaddr, data); - } else { - if (bitmask != RFREG_OFFSET_MASK) { - original_value = _phy_fw_rf_serial_read(hw, rfpath, - regaddr); - bitshift = _phy_calculate_bit_shift(bitmask); - data = ((original_value & (~bitmask)) | - (data << bitshift)); - } - _phy_fw_rf_serial_write(hw, rfpath, regaddr, data); - } - - spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags); - - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, - "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n", - regaddr, bitmask, data, rfpath); -} - -static u32 _phy_fw_rf_serial_read(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset) -{ - RT_ASSERT(false, "deprecated!\n"); - return 0; -} - -static void _phy_fw_rf_serial_write(struct ieee80211_hw *hw, - enum radio_path rfpath, - u32 offset, u32 data) -{ - RT_ASSERT(false, "deprecated!\n"); -} - -static u32 _phy_rf_serial_read(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; - u32 newoffset; - u32 tmplong, tmplong2; - u8 rfpi_enable = 0; - u32 retvalue; - - offset &= 0x3f; - newoffset = offset; - if (RT_CANNOT_IO(hw)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "return all one\n"); - return 0xFFFFFFFF; - } - tmplong = rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, MASKDWORD); - if (rfpath == RF90_PATH_A) - tmplong2 = tmplong; - else - tmplong2 = rtl_get_bbreg(hw, pphyreg->rfhssi_para2, MASKDWORD); - tmplong2 = (tmplong2 & (~BLSSIREADADDRESS)) | - (newoffset << 23) | BLSSIREADEDGE; - rtl_set_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, MASKDWORD, - tmplong & (~BLSSIREADEDGE)); - mdelay(1); - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, MASKDWORD, tmplong2); - mdelay(1); - rtl_set_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, MASKDWORD, - tmplong | BLSSIREADEDGE); - mdelay(1); - if (rfpath == RF90_PATH_A) - rfpi_enable = (u8) rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER1, - BIT(8)); - else if (rfpath == RF90_PATH_B) - rfpi_enable = (u8) rtl_get_bbreg(hw, RFPGA0_XB_HSSIPARAMETER1, - BIT(8)); - if (rfpi_enable) - retvalue = rtl_get_bbreg(hw, pphyreg->rf_rbpi, - BLSSIREADBACKDATA); - else - retvalue = rtl_get_bbreg(hw, pphyreg->rf_rb, - BLSSIREADBACKDATA); - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFR-%d Addr[0x%x]=0x%x\n", - rfpath, pphyreg->rf_rb, retvalue); - return retvalue; -} - -static void _phy_rf_serial_write(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 offset, u32 data) -{ - u32 data_and_addr; - u32 newoffset; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath]; - - if (RT_CANNOT_IO(hw)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "stop\n"); - return; - } - offset &= 0x3f; - newoffset = offset; - data_and_addr = ((newoffset << 20) | (data & 0x000fffff)) & 0x0fffffff; - rtl_set_bbreg(hw, pphyreg->rf3wire_offset, MASKDWORD, data_and_addr); - RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, "RFW-%d Addr[0x%x]=0x%x\n", - rfpath, pphyreg->rf3wire_offset, data_and_addr); -} - -static u32 _phy_calculate_bit_shift(u32 bitmask) -{ - u32 i; - - for (i = 0; i <= 31; i++) { - if (((bitmask >> i) & 0x1) == 1) - break; - } - return i; -} - -static void _rtl8723ae_phy_bb_config_1t(struct ieee80211_hw *hw) -{ - rtl_set_bbreg(hw, RFPGA0_TXINFO, 0x3, 0x2); - rtl_set_bbreg(hw, RFPGA1_TXINFO, 0x300033, 0x200022); - rtl_set_bbreg(hw, RCCK0_AFESETTING, MASKBYTE3, 0x45); - rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, MASKBYTE0, 0x23); - rtl_set_bbreg(hw, ROFDM0_AGCPARAMETER1, 0x30, 0x1); - rtl_set_bbreg(hw, 0xe74, 0x0c000000, 0x2); - rtl_set_bbreg(hw, 0xe78, 0x0c000000, 0x2); - rtl_set_bbreg(hw, 0xe7c, 0x0c000000, 0x2); - rtl_set_bbreg(hw, 0xe80, 0x0c000000, 0x2); - rtl_set_bbreg(hw, 0xe88, 0x0c000000, 0x2); -} - -bool rtl8723ae_phy_mac_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - bool rtstatus = _phy_cfg_mac_w_header(hw); - rtl_write_byte(rtlpriv, 0x04CA, 0x0A); - return rtstatus; -} - -bool rtl8723ae_phy_bb_config(struct ieee80211_hw *hw) -{ - bool rtstatus = true; - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmpu1b; - u8 reg_hwparafile = 1; - - _phy_init_bb_rf_reg_def(hw); - - /* 1. 0x28[1] = 1 */ - tmpu1b = rtl_read_byte(rtlpriv, REG_AFE_PLL_CTRL); - udelay(2); - rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL, (tmpu1b|BIT(1))); - udelay(2); - /* 2. 0x29[7:0] = 0xFF */ - rtl_write_byte(rtlpriv, REG_AFE_PLL_CTRL+1, 0xff); - udelay(2); - - /* 3. 0x02[1:0] = 2b'11 */ - tmpu1b = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, (tmpu1b | - FEN_BB_GLB_RSTn | FEN_BBRSTB)); - - /* 4. 0x25[6] = 0 */ - tmpu1b = rtl_read_byte(rtlpriv, REG_AFE_XTAL_CTRL+1); - rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL+1, (tmpu1b&(~BIT(6)))); - - /* 5. 0x24[20] = 0 Advised by SD3 Alex Wang. 2011.02.09. */ - tmpu1b = rtl_read_byte(rtlpriv, REG_AFE_XTAL_CTRL+2); - rtl_write_byte(rtlpriv, REG_AFE_XTAL_CTRL+2, (tmpu1b&(~BIT(4)))); - - /* 6. 0x1f[7:0] = 0x07 */ - rtl_write_byte(rtlpriv, REG_RF_CTRL, 0x07); - - if (reg_hwparafile == 1) - rtstatus = _phy_bb8192c_config_parafile(hw); - return rtstatus; -} - -bool rtl8723ae_phy_rf_config(struct ieee80211_hw *hw) -{ - return rtl8723ae_phy_rf6052_config(hw); -} - -static bool _phy_bb8192c_config_parafile(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - bool rtstatus; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "==>\n"); - rtstatus = _phy_cfg_bb_w_header(hw, BASEBAND_CONFIG_PHY_REG); - if (rtstatus != true) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!"); - return false; - } - - if (rtlphy->rf_type == RF_1T2R) { - _rtl8723ae_phy_bb_config_1t(hw); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Config to 1T!!\n"); - } - if (rtlefuse->autoload_failflag == false) { - rtlphy->pwrgroup_cnt = 0; - rtstatus = _phy_cfg_bb_w_pgheader(hw, BASEBAND_CONFIG_PHY_REG); - } - if (rtstatus != true) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!"); - return false; - } - rtstatus = _phy_cfg_bb_w_header(hw, BASEBAND_CONFIG_AGC_TAB); - if (rtstatus != true) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "AGC Table Fail\n"); - return false; - } - rtlphy->cck_high_power = (bool) (rtl_get_bbreg(hw, - RFPGA0_XA_HSSIPARAMETER2, 0x200)); - return true; -} - -static bool _phy_cfg_mac_w_header(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - u32 arraylength; - u32 *ptrarray; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Read Rtl723MACPHY_Array\n"); - arraylength = RTL8723E_MACARRAYLENGTH; - ptrarray = RTL8723EMAC_ARRAY; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Img:RTL8192CEMAC_2T_ARRAY\n"); - for (i = 0; i < arraylength; i = i + 2) - rtl_write_byte(rtlpriv, ptrarray[i], (u8) ptrarray[i + 1]); - return true; -} - -static bool _phy_cfg_bb_w_header(struct ieee80211_hw *hw, u8 configtype) -{ - int i; - u32 *phy_regarray_table; - u32 *agctab_array_table; - u16 phy_reg_arraylen, agctab_arraylen; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - agctab_arraylen = RTL8723E_AGCTAB_1TARRAYLENGTH; - agctab_array_table = RTL8723EAGCTAB_1TARRAY; - phy_reg_arraylen = RTL8723E_PHY_REG_1TARRAY_LENGTH; - phy_regarray_table = RTL8723EPHY_REG_1TARRAY; - if (configtype == BASEBAND_CONFIG_PHY_REG) { - for (i = 0; i < phy_reg_arraylen; i = i + 2) { - if (phy_regarray_table[i] == 0xfe) - mdelay(50); - else if (phy_regarray_table[i] == 0xfd) - mdelay(5); - else if (phy_regarray_table[i] == 0xfc) - mdelay(1); - else if (phy_regarray_table[i] == 0xfb) - udelay(50); - else if (phy_regarray_table[i] == 0xfa) - udelay(5); - else if (phy_regarray_table[i] == 0xf9) - udelay(1); - rtl_set_bbreg(hw, phy_regarray_table[i], MASKDWORD, - phy_regarray_table[i + 1]); - udelay(1); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "The phy_regarray_table[0] is %x" - " Rtl819XPHY_REGArray[1] is %x\n", - phy_regarray_table[i], - phy_regarray_table[i + 1]); - } - } else if (configtype == BASEBAND_CONFIG_AGC_TAB) { - for (i = 0; i < agctab_arraylen; i = i + 2) { - rtl_set_bbreg(hw, agctab_array_table[i], MASKDWORD, - agctab_array_table[i + 1]); - udelay(1); - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "The agctab_array_table[0] is " - "%x Rtl819XPHY_REGArray[1] is %x\n", - agctab_array_table[i], - agctab_array_table[i + 1]); - } - } - return true; -} - -static void _st_pwrIdx_dfrate_off(struct ieee80211_hw *hw, u32 regaddr, - u32 bitmask, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - switch (regaddr) { - case RTXAGC_A_RATE18_06: - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][0] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][0] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][0]); - break; - case RTXAGC_A_RATE54_24: - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][1] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][1] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][1]); - break; - case RTXAGC_A_CCK1_MCS32: - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][6] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][6] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][6]); - break; - case RTXAGC_B_CCK11_A_CCK2_11: - if (bitmask == 0xffffff00) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][7] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][7] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][7]); - } - if (bitmask == 0x000000ff) { - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][15] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][15] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][15]); - } - break; - case RTXAGC_A_MCS03_MCS00: - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][2] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][2] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][2]); - break; - case RTXAGC_A_MCS07_MCS04: - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][3] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][3] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][3]); - break; - case RTXAGC_A_MCS11_MCS08: - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][4] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][4] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][4]); - break; - case RTXAGC_A_MCS15_MCS12: - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][5] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][5] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][5]); - break; - case RTXAGC_B_RATE18_06: - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][8] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][8] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][8]); - break; - case RTXAGC_B_RATE54_24: - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][9] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][9] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][9]); - break; - case RTXAGC_B_CCK1_55_MCS32: - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][14] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][14] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][14]); - break; - case RTXAGC_B_MCS03_MCS00: - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][10] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][10] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][10]); - break; - case RTXAGC_B_MCS07_MCS04: - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][11] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][11] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][11]); - break; - case RTXAGC_B_MCS11_MCS08: - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][12] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][12] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][12]); - break; - case RTXAGC_B_MCS15_MCS12: - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][13] = data; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "MCSTxPowerLevelOriginalOffset[%d][13] = 0x%x\n", - rtlphy->pwrgroup_cnt, - rtlphy->mcs_offset[rtlphy->pwrgroup_cnt][13]); - rtlphy->pwrgroup_cnt++; - break; - } -} - -static bool _phy_cfg_bb_w_pgheader(struct ieee80211_hw *hw, u8 configtype) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int i; - u32 *phy_regarray_table_pg; - u16 phy_regarray_pg_len; - - phy_regarray_pg_len = RTL8723E_PHY_REG_ARRAY_PGLENGTH; - phy_regarray_table_pg = RTL8723EPHY_REG_ARRAY_PG; - - if (configtype == BASEBAND_CONFIG_PHY_REG) { - for (i = 0; i < phy_regarray_pg_len; i = i + 3) { - if (phy_regarray_table_pg[i] == 0xfe) - mdelay(50); - else if (phy_regarray_table_pg[i] == 0xfd) - mdelay(5); - else if (phy_regarray_table_pg[i] == 0xfc) - mdelay(1); - else if (phy_regarray_table_pg[i] == 0xfb) - udelay(50); - else if (phy_regarray_table_pg[i] == 0xfa) - udelay(5); - else if (phy_regarray_table_pg[i] == 0xf9) - udelay(1); - - _st_pwrIdx_dfrate_off(hw, phy_regarray_table_pg[i], - phy_regarray_table_pg[i + 1], - phy_regarray_table_pg[i + 2]); - } - } else { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "configtype != BaseBand_Config_PHY_REG\n"); - } - return true; -} - -bool rtl8723ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, - enum radio_path rfpath) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int i; - u32 *radioa_array_table; - u16 radioa_arraylen; - - radioa_arraylen = Rtl8723ERADIOA_1TARRAYLENGTH; - radioa_array_table = RTL8723E_RADIOA_1TARRAY; - - switch (rfpath) { - case RF90_PATH_A: - for (i = 0; i < radioa_arraylen; i = i + 2) { - if (radioa_array_table[i] == 0xfe) - mdelay(50); - else if (radioa_array_table[i] == 0xfd) - mdelay(5); - else if (radioa_array_table[i] == 0xfc) - mdelay(1); - else if (radioa_array_table[i] == 0xfb) - udelay(50); - else if (radioa_array_table[i] == 0xfa) - udelay(5); - else if (radioa_array_table[i] == 0xf9) - udelay(1); - else { - rtl_set_rfreg(hw, rfpath, radioa_array_table[i], - RFREG_OFFSET_MASK, - radioa_array_table[i + 1]); - udelay(1); - } - } - break; - case RF90_PATH_B: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not process\n"); - break; - case RF90_PATH_C: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not process\n"); - break; - case RF90_PATH_D: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not process\n"); - break; - } - return true; -} - -void rtl8723ae_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - rtlphy->default_initialgain[0] = - (u8) rtl_get_bbreg(hw, ROFDM0_XAAGCCORE1, MASKBYTE0); - rtlphy->default_initialgain[1] = - (u8) rtl_get_bbreg(hw, ROFDM0_XBAGCCORE1, MASKBYTE0); - rtlphy->default_initialgain[2] = - (u8) rtl_get_bbreg(hw, ROFDM0_XCAGCCORE1, MASKBYTE0); - rtlphy->default_initialgain[3] = - (u8) rtl_get_bbreg(hw, ROFDM0_XDAGCCORE1, MASKBYTE0); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x\n", - rtlphy->default_initialgain[0], - rtlphy->default_initialgain[1], - rtlphy->default_initialgain[2], - rtlphy->default_initialgain[3]); - - rtlphy->framesync = (u8) rtl_get_bbreg(hw, - ROFDM0_RXDETECTOR3, MASKBYTE0); - rtlphy->framesync_c34 = rtl_get_bbreg(hw, - ROFDM0_RXDETECTOR2, MASKDWORD); - - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Default framesync (0x%x) = 0x%x\n", - ROFDM0_RXDETECTOR3, rtlphy->framesync); -} - -static void _phy_init_bb_rf_reg_def(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - rtlphy->phyreg_def[RF90_PATH_A].rfintfs = RFPGA0_XAB_RFINTERFACESW; - rtlphy->phyreg_def[RF90_PATH_B].rfintfs = RFPGA0_XAB_RFINTERFACESW; - rtlphy->phyreg_def[RF90_PATH_C].rfintfs = RFPGA0_XCD_RFINTERFACESW; - rtlphy->phyreg_def[RF90_PATH_D].rfintfs = RFPGA0_XCD_RFINTERFACESW; - - rtlphy->phyreg_def[RF90_PATH_A].rfintfi = RFPGA0_XAB_RFINTERFACERB; - rtlphy->phyreg_def[RF90_PATH_B].rfintfi = RFPGA0_XAB_RFINTERFACERB; - rtlphy->phyreg_def[RF90_PATH_C].rfintfi = RFPGA0_XCD_RFINTERFACERB; - rtlphy->phyreg_def[RF90_PATH_D].rfintfi = RFPGA0_XCD_RFINTERFACERB; - - rtlphy->phyreg_def[RF90_PATH_A].rfintfo = RFPGA0_XA_RFINTERFACEOE; - rtlphy->phyreg_def[RF90_PATH_B].rfintfo = RFPGA0_XB_RFINTERFACEOE; - - rtlphy->phyreg_def[RF90_PATH_A].rfintfe = RFPGA0_XA_RFINTERFACEOE; - rtlphy->phyreg_def[RF90_PATH_B].rfintfe = RFPGA0_XB_RFINTERFACEOE; - - rtlphy->phyreg_def[RF90_PATH_A].rf3wire_offset = - RFPGA0_XA_LSSIPARAMETER; - rtlphy->phyreg_def[RF90_PATH_B].rf3wire_offset = - RFPGA0_XB_LSSIPARAMETER; - - rtlphy->phyreg_def[RF90_PATH_A].rflssi_select = rFPGA0_XAB_RFPARAMETER; - rtlphy->phyreg_def[RF90_PATH_B].rflssi_select = rFPGA0_XAB_RFPARAMETER; - rtlphy->phyreg_def[RF90_PATH_C].rflssi_select = rFPGA0_XCD_RFPARAMETER; - rtlphy->phyreg_def[RF90_PATH_D].rflssi_select = rFPGA0_XCD_RFPARAMETER; - - rtlphy->phyreg_def[RF90_PATH_A].rftxgain_stage = RFPGA0_TXGAINSTAGE; - rtlphy->phyreg_def[RF90_PATH_B].rftxgain_stage = RFPGA0_TXGAINSTAGE; - rtlphy->phyreg_def[RF90_PATH_C].rftxgain_stage = RFPGA0_TXGAINSTAGE; - rtlphy->phyreg_def[RF90_PATH_D].rftxgain_stage = RFPGA0_TXGAINSTAGE; - - rtlphy->phyreg_def[RF90_PATH_A].rfhssi_para1 = RFPGA0_XA_HSSIPARAMETER1; - rtlphy->phyreg_def[RF90_PATH_B].rfhssi_para1 = RFPGA0_XB_HSSIPARAMETER1; - - rtlphy->phyreg_def[RF90_PATH_A].rfhssi_para2 = RFPGA0_XA_HSSIPARAMETER2; - rtlphy->phyreg_def[RF90_PATH_B].rfhssi_para2 = RFPGA0_XB_HSSIPARAMETER2; - - rtlphy->phyreg_def[RF90_PATH_A].rfsw_ctrl = RFPGA0_XAB_SWITCHCONTROL; - rtlphy->phyreg_def[RF90_PATH_B].rfsw_ctrl = RFPGA0_XAB_SWITCHCONTROL; - rtlphy->phyreg_def[RF90_PATH_C].rfsw_ctrl = RFPGA0_XCD_SWITCHCONTROL; - rtlphy->phyreg_def[RF90_PATH_D].rfsw_ctrl = RFPGA0_XCD_SWITCHCONTROL; - - rtlphy->phyreg_def[RF90_PATH_A].rfagc_control1 = ROFDM0_XAAGCCORE1; - rtlphy->phyreg_def[RF90_PATH_B].rfagc_control1 = ROFDM0_XBAGCCORE1; - rtlphy->phyreg_def[RF90_PATH_C].rfagc_control1 = ROFDM0_XCAGCCORE1; - rtlphy->phyreg_def[RF90_PATH_D].rfagc_control1 = ROFDM0_XDAGCCORE1; - - rtlphy->phyreg_def[RF90_PATH_A].rfagc_control2 = ROFDM0_XAAGCCORE2; - rtlphy->phyreg_def[RF90_PATH_B].rfagc_control2 = ROFDM0_XBAGCCORE2; - rtlphy->phyreg_def[RF90_PATH_C].rfagc_control2 = ROFDM0_XCAGCCORE2; - rtlphy->phyreg_def[RF90_PATH_D].rfagc_control2 = ROFDM0_XDAGCCORE2; - - rtlphy->phyreg_def[RF90_PATH_A].rfrxiq_imbal = ROFDM0_XARXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_B].rfrxiq_imbal = ROFDM0_XBRXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_C].rfrxiq_imbal = ROFDM0_XCRXIQIMBANLANCE; - rtlphy->phyreg_def[RF90_PATH_D].rfrxiq_imbal = ROFDM0_XDRXIQIMBALANCE; - - rtlphy->phyreg_def[RF90_PATH_A].rfrx_afe = ROFDM0_XARXAFE; - rtlphy->phyreg_def[RF90_PATH_B].rfrx_afe = ROFDM0_XBRXAFE; - rtlphy->phyreg_def[RF90_PATH_C].rfrx_afe = ROFDM0_XCRXAFE; - rtlphy->phyreg_def[RF90_PATH_D].rfrx_afe = ROFDM0_XDRXAFE; - - rtlphy->phyreg_def[RF90_PATH_A].rftxiq_imbal = ROFDM0_XATXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_B].rftxiq_imbal = ROFDM0_XBTXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_C].rftxiq_imbal = ROFDM0_XCTXIQIMBALANCE; - rtlphy->phyreg_def[RF90_PATH_D].rftxiq_imbal = ROFDM0_XDTXIQIMBALANCE; - - rtlphy->phyreg_def[RF90_PATH_A].rftx_afe = ROFDM0_XATXAFE; - rtlphy->phyreg_def[RF90_PATH_B].rftx_afe = ROFDM0_XBTXAFE; - rtlphy->phyreg_def[RF90_PATH_C].rftx_afe = ROFDM0_XCTXAFE; - rtlphy->phyreg_def[RF90_PATH_D].rftx_afe = ROFDM0_XDTXAFE; - - rtlphy->phyreg_def[RF90_PATH_A].rf_rb = RFPGA0_XA_LSSIREADBACK; - rtlphy->phyreg_def[RF90_PATH_B].rf_rb = RFPGA0_XB_LSSIREADBACK; - rtlphy->phyreg_def[RF90_PATH_C].rf_rb = RFPGA0_XC_LSSIREADBACK; - rtlphy->phyreg_def[RF90_PATH_D].rf_rb = RFPGA0_XD_LSSIREADBACK; - - rtlphy->phyreg_def[RF90_PATH_A].rf_rbpi = TRANSCEIVEA_HSPI_READBACK; - rtlphy->phyreg_def[RF90_PATH_B].rf_rbpi = TRANSCEIVEB_HSPI_READBACK; -} - -void rtl8723ae_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 txpwr_level; - long txpwr_dbm; - - txpwr_level = rtlphy->cur_cck_txpwridx; - txpwr_dbm = _phy_txpwr_idx_to_dbm(hw, WIRELESS_MODE_B, txpwr_level); - txpwr_level = rtlphy->cur_ofdm24g_txpwridx + - rtlefuse->legacy_ht_txpowerdiff; - if (_phy_txpwr_idx_to_dbm(hw, WIRELESS_MODE_G, txpwr_level) > txpwr_dbm) - txpwr_dbm = _phy_txpwr_idx_to_dbm(hw, WIRELESS_MODE_G, - txpwr_level); - txpwr_level = rtlphy->cur_ofdm24g_txpwridx; - if (_phy_txpwr_idx_to_dbm(hw, WIRELESS_MODE_N_24G, txpwr_level) > - txpwr_dbm) - txpwr_dbm = _phy_txpwr_idx_to_dbm(hw, WIRELESS_MODE_N_24G, - txpwr_level); - *powerlevel = txpwr_dbm; -} - -static void _rtl8723ae_get_txpower_index(struct ieee80211_hw *hw, u8 channel, - u8 *cckpowerlevel, u8 *ofdmpowerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 index = (channel - 1); - - cckpowerlevel[RF90_PATH_A] = - rtlefuse->txpwrlevel_cck[RF90_PATH_A][index]; - cckpowerlevel[RF90_PATH_B] = - rtlefuse->txpwrlevel_cck[RF90_PATH_B][index]; - if (get_rf_type(rtlphy) == RF_1T2R || get_rf_type(rtlphy) == RF_1T1R) { - ofdmpowerlevel[RF90_PATH_A] = - rtlefuse->txpwrlevel_ht40_1s[RF90_PATH_A][index]; - ofdmpowerlevel[RF90_PATH_B] = - rtlefuse->txpwrlevel_ht40_1s[RF90_PATH_B][index]; - } else if (get_rf_type(rtlphy) == RF_2T2R) { - ofdmpowerlevel[RF90_PATH_A] = - rtlefuse->txpwrlevel_ht40_2s[RF90_PATH_A][index]; - ofdmpowerlevel[RF90_PATH_B] = - rtlefuse->txpwrlevel_ht40_2s[RF90_PATH_B][index]; - } -} - -static void _rtl8723ae_ccxpower_index_check(struct ieee80211_hw *hw, - u8 channel, u8 *cckpowerlevel, - u8 *ofdmpowerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - rtlphy->cur_cck_txpwridx = cckpowerlevel[0]; - rtlphy->cur_ofdm24g_txpwridx = ofdmpowerlevel[0]; -} - -void rtl8723ae_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 cckpowerlevel[2], ofdmpowerlevel[2]; - - if (rtlefuse->txpwr_fromeprom == false) - return; - _rtl8723ae_get_txpower_index(hw, channel, &cckpowerlevel[0], - &ofdmpowerlevel[0]); - _rtl8723ae_ccxpower_index_check(hw, channel, &cckpowerlevel[0], - &ofdmpowerlevel[0]); - rtl8723ae_phy_rf6052_set_cck_txpower(hw, &cckpowerlevel[0]); - rtl8723ae_phy_rf6052_set_ofdm_txpower(hw, &ofdmpowerlevel[0], channel); -} - -bool rtl8723ae_phy_update_txpower_dbm(struct ieee80211_hw *hw, long power_indbm) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 idx; - u8 rf_path; - u8 ccktxpwridx = _phy_dbm_to_txpwr_Idx(hw, WIRELESS_MODE_B, - power_indbm); - u8 ofdmtxpwridx = _phy_dbm_to_txpwr_Idx(hw, WIRELESS_MODE_N_24G, - power_indbm); - if (ofdmtxpwridx - rtlefuse->legacy_ht_txpowerdiff > 0) - ofdmtxpwridx -= rtlefuse->legacy_ht_txpowerdiff; - else - ofdmtxpwridx = 0; - RT_TRACE(rtlpriv, COMP_TXAGC, DBG_TRACE, - "%lx dBm, ccktxpwridx = %d, ofdmtxpwridx = %d\n", - power_indbm, ccktxpwridx, ofdmtxpwridx); - for (idx = 0; idx < 14; idx++) { - for (rf_path = 0; rf_path < 2; rf_path++) { - rtlefuse->txpwrlevel_cck[rf_path][idx] = ccktxpwridx; - rtlefuse->txpwrlevel_ht40_1s[rf_path][idx] = - ofdmtxpwridx; - rtlefuse->txpwrlevel_ht40_2s[rf_path][idx] = - ofdmtxpwridx; - } - } - rtl8723ae_phy_set_txpower_level(hw, rtlphy->current_channel); - return true; -} - -static u8 _phy_dbm_to_txpwr_Idx(struct ieee80211_hw *hw, - enum wireless_mode wirelessmode, - long power_indbm) -{ - u8 txpwridx; - long offset; - - switch (wirelessmode) { - case WIRELESS_MODE_B: - offset = -7; - break; - case WIRELESS_MODE_G: - case WIRELESS_MODE_N_24G: - offset = -8; - break; - default: - offset = -8; - break; - } - - if ((power_indbm - offset) > 0) - txpwridx = (u8) ((power_indbm - offset) * 2); - else - txpwridx = 0; - - if (txpwridx > MAX_TXPWR_IDX_NMODE_92S) - txpwridx = MAX_TXPWR_IDX_NMODE_92S; - - return txpwridx; -} - -static long _phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw, - enum wireless_mode wirelessmode, u8 txpwridx) -{ - long offset; - long pwrout_dbm; - - switch (wirelessmode) { - case WIRELESS_MODE_B: - offset = -7; - break; - case WIRELESS_MODE_G: - case WIRELESS_MODE_N_24G: - offset = -8; - break; - default: - offset = -8; - break; - } - pwrout_dbm = txpwridx / 2 + offset; - return pwrout_dbm; -} - -void rtl8723ae_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - enum io_type iotype; - - if (!is_hal_stop(rtlhal)) { - switch (operation) { - case SCAN_OPT_BACKUP: - iotype = IO_CMD_PAUSE_DM_BY_SCAN; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_IO_CMD, - (u8 *)&iotype); - - break; - case SCAN_OPT_RESTORE: - iotype = IO_CMD_RESUME_DM_BY_SCAN; - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_IO_CMD, - (u8 *)&iotype); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Unknown Scan Backup operation.\n"); - break; - } - } -} - -void rtl8723ae_phy_set_bw_mode_callback(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u8 reg_bw_opmode; - u8 reg_prsr_rsc; - - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, - "Switch to %s bandwidth\n", - rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? - "20MHz" : "40MHz"); - - if (is_hal_stop(rtlhal)) { - rtlphy->set_bwmode_inprogress = false; - return; - } - - reg_bw_opmode = rtl_read_byte(rtlpriv, REG_BWOPMODE); - reg_prsr_rsc = rtl_read_byte(rtlpriv, REG_RRSR + 2); - - switch (rtlphy->current_chan_bw) { - case HT_CHANNEL_WIDTH_20: - reg_bw_opmode |= BW_OPMODE_20MHZ; - rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); - break; - case HT_CHANNEL_WIDTH_20_40: - reg_bw_opmode &= ~BW_OPMODE_20MHZ; - rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode); - reg_prsr_rsc = - (reg_prsr_rsc & 0x90) | (mac->cur_40_prime_sc << 5); - rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_prsr_rsc); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", rtlphy->current_chan_bw); - break; - } - - switch (rtlphy->current_chan_bw) { - case HT_CHANNEL_WIDTH_20: - rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x0); - rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x0); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 1); - break; - case HT_CHANNEL_WIDTH_20_40: - rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x1); - rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x1); - - rtl_set_bbreg(hw, RCCK0_SYSTEM, BCCK_SIDEBAND, - (mac->cur_40_prime_sc >> 1)); - rtl_set_bbreg(hw, ROFDM1_LSTF, 0xC00, mac->cur_40_prime_sc); - rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 0); - - rtl_set_bbreg(hw, 0x818, (BIT(26) | BIT(27)), - (mac->cur_40_prime_sc == - HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", rtlphy->current_chan_bw); - break; - } - rtl8723ae_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw); - rtlphy->set_bwmode_inprogress = false; - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n"); -} - -void rtl8723ae_phy_set_bw_mode(struct ieee80211_hw *hw, - enum nl80211_channel_type ch_type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 tmp_bw = rtlphy->current_chan_bw; - - if (rtlphy->set_bwmode_inprogress) - return; - rtlphy->set_bwmode_inprogress = true; - if ((!is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { - rtl8723ae_phy_set_bw_mode_callback(hw); - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "FALSE driver sleep or unload\n"); - rtlphy->set_bwmode_inprogress = false; - rtlphy->current_chan_bw = tmp_bw; - } -} - -void rtl8723ae_phy_sw_chnl_callback(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 delay; - - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, - "switch to channel%d\n", rtlphy->current_channel); - if (is_hal_stop(rtlhal)) - return; - do { - if (!rtlphy->sw_chnl_inprogress) - break; - if (!_phy_sw_chnl_step_by_step - (hw, rtlphy->current_channel, &rtlphy->sw_chnl_stage, - &rtlphy->sw_chnl_step, &delay)) { - if (delay > 0) - mdelay(delay); - else - continue; - } else { - rtlphy->sw_chnl_inprogress = false; - } - break; - } while (true); - RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, "<==\n"); -} - -u8 rtl8723ae_phy_sw_chnl(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (rtlphy->sw_chnl_inprogress) - return 0; - if (rtlphy->set_bwmode_inprogress) - return 0; - RT_ASSERT((rtlphy->current_channel <= 14), - "WIRELESS_MODE_G but channel>14"); - rtlphy->sw_chnl_inprogress = true; - rtlphy->sw_chnl_stage = 0; - rtlphy->sw_chnl_step = 0; - if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { - rtl8723ae_phy_sw_chnl_callback(hw); - RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, - "sw_chnl_inprogress false schedule workitem\n"); - rtlphy->sw_chnl_inprogress = false; - } else { - RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, - "sw_chnl_inprogress false driver sleep or unload\n"); - rtlphy->sw_chnl_inprogress = false; - } - return 1; -} - -static void _rtl8723ae_phy_sw_rf_seting(struct ieee80211_hw *hw, u8 channel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) { - if (channel == 6 && rtlphy->current_chan_bw == - HT_CHANNEL_WIDTH_20) - rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G1, MASKDWORD, - 0x00255); - else{ - u32 backupRF0x1A = (u32)rtl_get_rfreg(hw, RF90_PATH_A, - RF_RX_G1, RFREG_OFFSET_MASK); - rtl_set_rfreg(hw, RF90_PATH_A, RF_RX_G1, MASKDWORD, - backupRF0x1A); - } - } -} - -static bool _phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, u8 channel, - u8 *stage, u8 *step, u32 *delay) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct swchnlcmd precommoncmd[MAX_PRECMD_CNT]; - u32 precommoncmdcnt; - struct swchnlcmd postcommoncmd[MAX_POSTCMD_CNT]; - u32 postcommoncmdcnt; - struct swchnlcmd rfdependcmd[MAX_RFDEPENDCMD_CNT]; - u32 rfdependcmdcnt; - struct swchnlcmd *currentcmd = NULL; - u8 rfpath; - u8 num_total_rfpath = rtlphy->num_total_rfpath; - - precommoncmdcnt = 0; - _phy_set_sw_chnl_cmdarray(precommoncmd, precommoncmdcnt++, - MAX_PRECMD_CNT, CMDID_SET_TXPOWEROWER_LEVEL, - 0, 0, 0); - _phy_set_sw_chnl_cmdarray(precommoncmd, precommoncmdcnt++, - MAX_PRECMD_CNT, CMDID_END, 0, 0, 0); - postcommoncmdcnt = 0; - - _phy_set_sw_chnl_cmdarray(postcommoncmd, postcommoncmdcnt++, - MAX_POSTCMD_CNT, CMDID_END, 0, 0, 0); - rfdependcmdcnt = 0; - - RT_ASSERT((channel >= 1 && channel <= 14), - "illegal channel for Zebra: %d\n", channel); - - _phy_set_sw_chnl_cmdarray(rfdependcmd, rfdependcmdcnt++, - MAX_RFDEPENDCMD_CNT, CMDID_RF_WRITEREG, - RF_CHNLBW, channel, 10); - - _phy_set_sw_chnl_cmdarray(rfdependcmd, rfdependcmdcnt++, - MAX_RFDEPENDCMD_CNT, CMDID_END, 0, 0, 0); - - do { - switch (*stage) { - case 0: - currentcmd = &precommoncmd[*step]; - break; - case 1: - currentcmd = &rfdependcmd[*step]; - break; - case 2: - currentcmd = &postcommoncmd[*step]; - break; - } - - if (currentcmd->cmdid == CMDID_END) { - if ((*stage) == 2) { - return true; - } else { - (*stage)++; - (*step) = 0; - continue; - } - } - - switch (currentcmd->cmdid) { - case CMDID_SET_TXPOWEROWER_LEVEL: - rtl8723ae_phy_set_txpower_level(hw, channel); - break; - case CMDID_WRITEPORT_ULONG: - rtl_write_dword(rtlpriv, currentcmd->para1, - currentcmd->para2); - break; - case CMDID_WRITEPORT_USHORT: - rtl_write_word(rtlpriv, currentcmd->para1, - (u16) currentcmd->para2); - break; - case CMDID_WRITEPORT_UCHAR: - rtl_write_byte(rtlpriv, currentcmd->para1, - (u8) currentcmd->para2); - break; - case CMDID_RF_WRITEREG: - for (rfpath = 0; rfpath < num_total_rfpath; rfpath++) { - rtlphy->rfreg_chnlval[rfpath] = - ((rtlphy->rfreg_chnlval[rfpath] & - 0xfffffc00) | currentcmd->para2); - - rtl_set_rfreg(hw, (enum radio_path)rfpath, - currentcmd->para1, - RFREG_OFFSET_MASK, - rtlphy->rfreg_chnlval[rfpath]); - } - _rtl8723ae_phy_sw_rf_seting(hw, channel); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not process\n"); - break; - } - - break; - } while (true); - - (*delay) = currentcmd->msdelay; - (*step)++; - return false; -} - -static bool _phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable, - u32 cmdtableidx, u32 cmdtablesz, - enum swchnlcmd_id cmdid, u32 para1, - u32 para2, u32 msdelay) -{ - struct swchnlcmd *pcmd; - - if (cmdtable == NULL) { - RT_ASSERT(false, "cmdtable cannot be NULL.\n"); - return false; - } - - if (cmdtableidx >= cmdtablesz) - return false; - - pcmd = cmdtable + cmdtableidx; - pcmd->cmdid = cmdid; - pcmd->para1 = para1; - pcmd->para2 = para2; - pcmd->msdelay = msdelay; - return true; -} - -static u8 _rtl8723ae_phy_path_a_iqk(struct ieee80211_hw *hw, bool config_pathb) -{ - u32 reg_eac, reg_e94, reg_e9c, reg_ea4; - u8 result = 0x00; - - rtl_set_bbreg(hw, 0xe30, MASKDWORD, 0x10008c1f); - rtl_set_bbreg(hw, 0xe34, MASKDWORD, 0x10008c1f); - rtl_set_bbreg(hw, 0xe38, MASKDWORD, 0x82140102); - rtl_set_bbreg(hw, 0xe3c, MASKDWORD, - config_pathb ? 0x28160202 : 0x28160502); - - if (config_pathb) { - rtl_set_bbreg(hw, 0xe50, MASKDWORD, 0x10008c22); - rtl_set_bbreg(hw, 0xe54, MASKDWORD, 0x10008c22); - rtl_set_bbreg(hw, 0xe58, MASKDWORD, 0x82140102); - rtl_set_bbreg(hw, 0xe5c, MASKDWORD, 0x28160202); - } - - rtl_set_bbreg(hw, 0xe4c, MASKDWORD, 0x001028d1); - rtl_set_bbreg(hw, 0xe48, MASKDWORD, 0xf9000000); - rtl_set_bbreg(hw, 0xe48, MASKDWORD, 0xf8000000); - - mdelay(IQK_DELAY_TIME); - - reg_eac = rtl_get_bbreg(hw, 0xeac, MASKDWORD); - reg_e94 = rtl_get_bbreg(hw, 0xe94, MASKDWORD); - reg_e9c = rtl_get_bbreg(hw, 0xe9c, MASKDWORD); - reg_ea4 = rtl_get_bbreg(hw, 0xea4, MASKDWORD); - - if (!(reg_eac & BIT(28)) && - (((reg_e94 & 0x03FF0000) >> 16) != 0x142) && - (((reg_e9c & 0x03FF0000) >> 16) != 0x42)) - result |= 0x01; - else - return result; - - if (!(reg_eac & BIT(27)) && - (((reg_ea4 & 0x03FF0000) >> 16) != 0x132) && - (((reg_eac & 0x03FF0000) >> 16) != 0x36)) - result |= 0x02; - return result; -} - -static u8 _rtl8723ae_phy_path_b_iqk(struct ieee80211_hw *hw) -{ - u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc; - u8 result = 0x00; - - rtl_set_bbreg(hw, 0xe60, MASKDWORD, 0x00000002); - rtl_set_bbreg(hw, 0xe60, MASKDWORD, 0x00000000); - mdelay(IQK_DELAY_TIME); - reg_eac = rtl_get_bbreg(hw, 0xeac, MASKDWORD); - reg_eb4 = rtl_get_bbreg(hw, 0xeb4, MASKDWORD); - reg_ebc = rtl_get_bbreg(hw, 0xebc, MASKDWORD); - reg_ec4 = rtl_get_bbreg(hw, 0xec4, MASKDWORD); - reg_ecc = rtl_get_bbreg(hw, 0xecc, MASKDWORD); - - if (!(reg_eac & BIT(31)) && - (((reg_eb4 & 0x03FF0000) >> 16) != 0x142) && - (((reg_ebc & 0x03FF0000) >> 16) != 0x42)) - result |= 0x01; - else - return result; - if (!(reg_eac & BIT(30)) && - (((reg_ec4 & 0x03FF0000) >> 16) != 0x132) && - (((reg_ecc & 0x03FF0000) >> 16) != 0x36)) - result |= 0x02; - return result; -} - -static void phy_path_a_fill_iqk_matrix(struct ieee80211_hw *hw, bool iqk_ok, - long result[][8], u8 final_candidate, - bool btxonly) -{ - u32 oldval_0, x, tx0_a, reg; - long y, tx0_c; - - if (final_candidate == 0xFF) { - return; - } else if (iqk_ok) { - oldval_0 = (rtl_get_bbreg(hw, ROFDM0_XATXIQIMBALANCE, - MASKDWORD) >> 22) & 0x3FF; - x = result[final_candidate][0]; - if ((x & 0x00000200) != 0) - x = x | 0xFFFFFC00; - tx0_a = (x * oldval_0) >> 8; - rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE, 0x3FF, tx0_a); - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(31), - ((x * oldval_0 >> 7) & 0x1)); - y = result[final_candidate][1]; - if ((y & 0x00000200) != 0) - y = y | 0xFFFFFC00; - tx0_c = (y * oldval_0) >> 8; - rtl_set_bbreg(hw, ROFDM0_XCTXAFE, 0xF0000000, - ((tx0_c & 0x3C0) >> 6)); - rtl_set_bbreg(hw, ROFDM0_XATXIQIMBALANCE, 0x003F0000, - (tx0_c & 0x3F)); - rtl_set_bbreg(hw, ROFDM0_ECCATHRESHOLD, BIT(29), - ((y * oldval_0 >> 7) & 0x1)); - if (btxonly) - return; - reg = result[final_candidate][2]; - rtl_set_bbreg(hw, ROFDM0_XARXIQIMBALANCE, 0x3FF, reg); - reg = result[final_candidate][3] & 0x3F; - rtl_set_bbreg(hw, ROFDM0_XARXIQIMBALANCE, 0xFC00, reg); - reg = (result[final_candidate][3] >> 6) & 0xF; - rtl_set_bbreg(hw, 0xca0, 0xF0000000, reg); - } -} - -static void phy_save_adda_regs(struct ieee80211_hw *hw, - u32 *addareg, u32 *addabackup, - u32 registernum) -{ - u32 i; - - for (i = 0; i < registernum; i++) - addabackup[i] = rtl_get_bbreg(hw, addareg[i], MASKDWORD); -} - -static void phy_save_mac_regs(struct ieee80211_hw *hw, u32 *macreg, - u32 *macbackup) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - - for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++) - macbackup[i] = rtl_read_byte(rtlpriv, macreg[i]); - macbackup[i] = rtl_read_dword(rtlpriv, macreg[i]); -} - -static void phy_reload_adda_regs(struct ieee80211_hw *hw, u32 *addareg, - u32 *addabackup, u32 regiesternum) -{ - u32 i; - - for (i = 0; i < regiesternum; i++) - rtl_set_bbreg(hw, addareg[i], MASKDWORD, addabackup[i]); -} - -static void phy_reload_mac_regs(struct ieee80211_hw *hw, u32 *macreg, - u32 *macbackup) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i; - - for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++) - rtl_write_byte(rtlpriv, macreg[i], (u8) macbackup[i]); - rtl_write_dword(rtlpriv, macreg[i], macbackup[i]); -} - -static void _rtl8723ae_phy_path_adda_on(struct ieee80211_hw *hw, - u32 *addareg, bool is_patha_on, - bool is2t) -{ - u32 pathOn; - u32 i; - - pathOn = is_patha_on ? 0x04db25a4 : 0x0b1b25a4; - if (false == is2t) { - pathOn = 0x0bdb25a0; - rtl_set_bbreg(hw, addareg[0], MASKDWORD, 0x0b1b25a0); - } else { - rtl_set_bbreg(hw, addareg[0], MASKDWORD, pathOn); - } - - for (i = 1; i < IQK_ADDA_REG_NUM; i++) - rtl_set_bbreg(hw, addareg[i], MASKDWORD, pathOn); -} - -static void _rtl8723ae_phy_mac_setting_calibration(struct ieee80211_hw *hw, - u32 *macreg, u32 *macbackup) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 i = 0; - - rtl_write_byte(rtlpriv, macreg[i], 0x3F); - - for (i = 1; i < (IQK_MAC_REG_NUM - 1); i++) - rtl_write_byte(rtlpriv, macreg[i], - (u8) (macbackup[i] & (~BIT(3)))); - rtl_write_byte(rtlpriv, macreg[i], (u8) (macbackup[i] & (~BIT(5)))); -} - -static void _rtl8723ae_phy_path_a_standby(struct ieee80211_hw *hw) -{ - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x0); - rtl_set_bbreg(hw, 0x840, MASKDWORD, 0x00010000); - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x80800000); -} - -static void _rtl8723ae_phy_pi_mode_switch(struct ieee80211_hw *hw, bool pi_mode) -{ - u32 mode; - - mode = pi_mode ? 0x01000100 : 0x01000000; - rtl_set_bbreg(hw, 0x820, MASKDWORD, mode); - rtl_set_bbreg(hw, 0x828, MASKDWORD, mode); -} - -static bool phy_simularity_comp(struct ieee80211_hw *hw, long result[][8], - u8 c1, u8 c2) -{ - u32 i, j, diff, simularity_bitmap, bound; - - u8 final_candidate[2] = { 0xFF, 0xFF }; - bool bresult = true; - - bound = 4; - - simularity_bitmap = 0; - - for (i = 0; i < bound; i++) { - diff = (result[c1][i] > result[c2][i]) ? - (result[c1][i] - result[c2][i]) : - (result[c2][i] - result[c1][i]); - - if (diff > MAX_TOLERANCE) { - if ((i == 2 || i == 6) && !simularity_bitmap) { - if (result[c1][i] + result[c1][i + 1] == 0) - final_candidate[(i / 4)] = c2; - else if (result[c2][i] + result[c2][i + 1] == 0) - final_candidate[(i / 4)] = c1; - else - simularity_bitmap = simularity_bitmap | - (1 << i); - } else - simularity_bitmap = - simularity_bitmap | (1 << i); - } - } - - if (simularity_bitmap == 0) { - for (i = 0; i < (bound / 4); i++) { - if (final_candidate[i] != 0xFF) { - for (j = i * 4; j < (i + 1) * 4 - 2; j++) - result[3][j] = - result[final_candidate[i]][j]; - bresult = false; - } - } - return bresult; - } else if (!(simularity_bitmap & 0x0F)) { - for (i = 0; i < 4; i++) - result[3][i] = result[c1][i]; - return false; - } else { - return false; - } - -} - -static void _rtl8723ae_phy_iq_calibrate(struct ieee80211_hw *hw, - long result[][8], u8 t, bool is2t) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 i; - u8 patha_ok, pathb_ok; - u32 adda_reg[IQK_ADDA_REG_NUM] = { - 0x85c, 0xe6c, 0xe70, 0xe74, - 0xe78, 0xe7c, 0xe80, 0xe84, - 0xe88, 0xe8c, 0xed0, 0xed4, - 0xed8, 0xedc, 0xee0, 0xeec - }; - u32 iqk_mac_reg[IQK_MAC_REG_NUM] = { - 0x522, 0x550, 0x551, 0x040 - }; - const u32 retrycount = 2; - - if (t == 0) { - phy_save_adda_regs(hw, adda_reg, rtlphy->adda_backup, 16); - phy_save_mac_regs(hw, iqk_mac_reg, rtlphy->iqk_mac_backup); - } - _rtl8723ae_phy_path_adda_on(hw, adda_reg, true, is2t); - if (t == 0) { - rtlphy->rfpi_enable = (u8) rtl_get_bbreg(hw, - RFPGA0_XA_HSSIPARAMETER1, - BIT(8)); - } - - if (!rtlphy->rfpi_enable) - _rtl8723ae_phy_pi_mode_switch(hw, true); - if (t == 0) { - rtlphy->reg_c04 = rtl_get_bbreg(hw, 0xc04, MASKDWORD); - rtlphy->reg_c08 = rtl_get_bbreg(hw, 0xc08, MASKDWORD); - rtlphy->reg_874 = rtl_get_bbreg(hw, 0x874, MASKDWORD); - } - rtl_set_bbreg(hw, 0xc04, MASKDWORD, 0x03a05600); - rtl_set_bbreg(hw, 0xc08, MASKDWORD, 0x000800e4); - rtl_set_bbreg(hw, 0x874, MASKDWORD, 0x22204000); - if (is2t) { - rtl_set_bbreg(hw, 0x840, MASKDWORD, 0x00010000); - rtl_set_bbreg(hw, 0x844, MASKDWORD, 0x00010000); - } - _rtl8723ae_phy_mac_setting_calibration(hw, iqk_mac_reg, - rtlphy->iqk_mac_backup); - rtl_set_bbreg(hw, 0xb68, MASKDWORD, 0x00080000); - if (is2t) - rtl_set_bbreg(hw, 0xb6c, MASKDWORD, 0x00080000); - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0x80800000); - rtl_set_bbreg(hw, 0xe40, MASKDWORD, 0x01007c00); - rtl_set_bbreg(hw, 0xe44, MASKDWORD, 0x01004800); - for (i = 0; i < retrycount; i++) { - patha_ok = _rtl8723ae_phy_path_a_iqk(hw, is2t); - if (patha_ok == 0x03) { - result[t][0] = (rtl_get_bbreg(hw, 0xe94, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][1] = (rtl_get_bbreg(hw, 0xe9c, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][2] = (rtl_get_bbreg(hw, 0xea4, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][3] = (rtl_get_bbreg(hw, 0xeac, MASKDWORD) & - 0x3FF0000) >> 16; - break; - } else if (i == (retrycount - 1) && patha_ok == 0x01) - - result[t][0] = (rtl_get_bbreg(hw, 0xe94, - MASKDWORD) & 0x3FF0000) >> 16; - result[t][1] = - (rtl_get_bbreg(hw, 0xe9c, MASKDWORD) & 0x3FF0000) >> 16; - - } - - if (is2t) { - _rtl8723ae_phy_path_a_standby(hw); - _rtl8723ae_phy_path_adda_on(hw, adda_reg, false, is2t); - for (i = 0; i < retrycount; i++) { - pathb_ok = _rtl8723ae_phy_path_b_iqk(hw); - if (pathb_ok == 0x03) { - result[t][4] = - (rtl_get_bbreg(hw, 0xeb4, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][5] = - (rtl_get_bbreg(hw, 0xebc, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][6] = - (rtl_get_bbreg(hw, 0xec4, MASKDWORD) & - 0x3FF0000) >> 16; - result[t][7] = - (rtl_get_bbreg(hw, 0xecc, MASKDWORD) & - 0x3FF0000) >> 16; - break; - } else if (i == (retrycount - 1) && pathb_ok == 0x01) { - result[t][4] = - (rtl_get_bbreg(hw, 0xeb4, MASKDWORD) & - 0x3FF0000) >> 16; - } - result[t][5] = (rtl_get_bbreg(hw, 0xebc, MASKDWORD) & - 0x3FF0000) >> 16; - } - } - rtl_set_bbreg(hw, 0xc04, MASKDWORD, rtlphy->reg_c04); - rtl_set_bbreg(hw, 0x874, MASKDWORD, rtlphy->reg_874); - rtl_set_bbreg(hw, 0xc08, MASKDWORD, rtlphy->reg_c08); - rtl_set_bbreg(hw, 0xe28, MASKDWORD, 0); - rtl_set_bbreg(hw, 0x840, MASKDWORD, 0x00032ed3); - if (is2t) - rtl_set_bbreg(hw, 0x844, MASKDWORD, 0x00032ed3); - if (t != 0) { - if (!rtlphy->rfpi_enable) - _rtl8723ae_phy_pi_mode_switch(hw, false); - phy_reload_adda_regs(hw, adda_reg, rtlphy->adda_backup, 16); - phy_reload_mac_regs(hw, iqk_mac_reg, rtlphy->iqk_mac_backup); - } -} - -static void _rtl8723ae_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmpreg; - u32 rf_a_mode = 0, rf_b_mode = 0, lc_cal; - - tmpreg = rtl_read_byte(rtlpriv, 0xd03); - - if ((tmpreg & 0x70) != 0) - rtl_write_byte(rtlpriv, 0xd03, tmpreg & 0x8F); - else - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF); - - if ((tmpreg & 0x70) != 0) { - rf_a_mode = rtl_get_rfreg(hw, RF90_PATH_A, 0x00, MASK12BITS); - - if (is2t) - rf_b_mode = rtl_get_rfreg(hw, RF90_PATH_B, 0x00, - MASK12BITS); - - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, MASK12BITS, - (rf_a_mode & 0x8FFFF) | 0x10000); - - if (is2t) - rtl_set_rfreg(hw, RF90_PATH_B, 0x00, MASK12BITS, - (rf_b_mode & 0x8FFFF) | 0x10000); - } - lc_cal = rtl_get_rfreg(hw, RF90_PATH_A, 0x18, MASK12BITS); - - rtl_set_rfreg(hw, RF90_PATH_A, 0x18, MASK12BITS, lc_cal | 0x08000); - - mdelay(100); - - if ((tmpreg & 0x70) != 0) { - rtl_write_byte(rtlpriv, 0xd03, tmpreg); - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, MASK12BITS, rf_a_mode); - - if (is2t) - rtl_set_rfreg(hw, RF90_PATH_B, 0x00, MASK12BITS, - rf_b_mode); - } else { - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); - } -} - -static void _rtl8723ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, - bool bmain, bool is2t) -{ - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (is_hal_stop(rtlhal)) { - rtl_set_bbreg(hw, REG_LEDCFG0, BIT(23), 0x01); - rtl_set_bbreg(hw, rFPGA0_XAB_RFPARAMETER, BIT(13), 0x01); - } - if (is2t) { - if (bmain) - rtl_set_bbreg(hw, RFPGA0_XB_RFINTERFACEOE, - BIT(5) | BIT(6), 0x1); - else - rtl_set_bbreg(hw, RFPGA0_XB_RFINTERFACEOE, - BIT(5) | BIT(6), 0x2); - } else { - if (bmain) - rtl_set_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, 0x300, 0x2); - else - rtl_set_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, 0x300, 0x1); - - } -} - -#undef IQK_ADDA_REG_NUM -#undef IQK_DELAY_TIME - -void rtl8723ae_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - long result[4][8]; - u8 i, final_candidate; - bool patha_ok, pathb_ok; - long reg_e94, reg_e9c, reg_ea4, reg_eb4, reg_ebc, reg_tmp = 0; - bool is12simular, is13simular, is23simular; - bool start_conttx = false, singletone = false; - u32 iqk_bb_reg[10] = { - ROFDM0_XARXIQIMBALANCE, - ROFDM0_XBRXIQIMBALANCE, - ROFDM0_ECCATHRESHOLD, - ROFDM0_AGCRSSITABLE, - ROFDM0_XATXIQIMBALANCE, - ROFDM0_XBTXIQIMBALANCE, - ROFDM0_XCTXIQIMBALANCE, - ROFDM0_XCTXAFE, - ROFDM0_XDTXAFE, - ROFDM0_RXIQEXTANTA - }; - - if (recovery) { - phy_reload_adda_regs(hw, iqk_bb_reg, rtlphy->iqk_bb_backup, 10); - return; - } - if (start_conttx || singletone) - return; - for (i = 0; i < 8; i++) { - result[0][i] = 0; - result[1][i] = 0; - result[2][i] = 0; - result[3][i] = 0; - } - final_candidate = 0xff; - patha_ok = false; - pathb_ok = false; - is12simular = false; - is23simular = false; - is13simular = false; - for (i = 0; i < 3; i++) { - _rtl8723ae_phy_iq_calibrate(hw, result, i, false); - if (i == 1) { - is12simular = phy_simularity_comp(hw, result, 0, 1); - if (is12simular) { - final_candidate = 0; - break; - } - } - if (i == 2) { - is13simular = phy_simularity_comp(hw, result, 0, 2); - if (is13simular) { - final_candidate = 0; - break; - } - is23simular = phy_simularity_comp(hw, result, 1, 2); - if (is23simular) { - final_candidate = 1; - } else { - for (i = 0; i < 8; i++) - reg_tmp += result[3][i]; - - if (reg_tmp != 0) - final_candidate = 3; - else - final_candidate = 0xFF; - } - } - } - for (i = 0; i < 4; i++) { - reg_e94 = result[i][0]; - reg_e9c = result[i][1]; - reg_ea4 = result[i][2]; - reg_eb4 = result[i][4]; - reg_ebc = result[i][5]; - } - if (final_candidate != 0xff) { - rtlphy->reg_e94 = reg_e94 = result[final_candidate][0]; - rtlphy->reg_e9c = reg_e9c = result[final_candidate][1]; - reg_ea4 = result[final_candidate][2]; - rtlphy->reg_eb4 = reg_eb4 = result[final_candidate][4]; - rtlphy->reg_ebc = reg_ebc = result[final_candidate][5]; - patha_ok = pathb_ok = true; - } else { - rtlphy->reg_e94 = rtlphy->reg_eb4 = 0x100; - rtlphy->reg_e9c = rtlphy->reg_ebc = 0x0; - } - if (reg_e94 != 0) /*&&(reg_ea4 != 0) */ - phy_path_a_fill_iqk_matrix(hw, patha_ok, result, - final_candidate, (reg_ea4 == 0)); - phy_save_adda_regs(hw, iqk_bb_reg, rtlphy->iqk_bb_backup, 10); -} - -void rtl8723ae_phy_lc_calibrate(struct ieee80211_hw *hw) -{ - bool start_conttx = false, singletone = false; - - if (start_conttx || singletone) - return; - _rtl8723ae_phy_lc_calibrate(hw, false); -} - -void rtl8723ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain) -{ - _rtl8723ae_phy_set_rfpath_switch(hw, bmain, false); -} - -bool rtl8723ae_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - bool postprocessing = false; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "-->IO Cmd(%#x), set_io_inprogress(%d)\n", - iotype, rtlphy->set_io_inprogress); - do { - switch (iotype) { - case IO_CMD_RESUME_DM_BY_SCAN: - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "[IO CMD] Resume DM after scan.\n"); - postprocessing = true; - break; - case IO_CMD_PAUSE_DM_BY_SCAN: - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "[IO CMD] Pause DM before scan.\n"); - postprocessing = true; - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not process\n"); - break; - } - } while (false); - if (postprocessing && !rtlphy->set_io_inprogress) { - rtlphy->set_io_inprogress = true; - rtlphy->current_io_type = iotype; - } else { - return false; - } - rtl8723ae_phy_set_io(hw); - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, "<--IO Type(%#x)\n", iotype); - return true; -} - -static void rtl8723ae_phy_set_io(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct dig_t *dm_digtable = &rtlpriv->dm_digtable; - - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "--->Cmd(%#x), set_io_inprogress(%d)\n", - rtlphy->current_io_type, rtlphy->set_io_inprogress); - switch (rtlphy->current_io_type) { - case IO_CMD_RESUME_DM_BY_SCAN: - dm_digtable->cur_igvalue = rtlphy->initgain_backup.xaagccore1; - rtl8723ae_dm_write_dig(hw); - rtl8723ae_phy_set_txpower_level(hw, rtlphy->current_channel); - break; - case IO_CMD_PAUSE_DM_BY_SCAN: - rtlphy->initgain_backup.xaagccore1 = dm_digtable->cur_igvalue; - dm_digtable->cur_igvalue = 0x17; - rtl8723ae_dm_write_dig(hw); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not process\n"); - break; - } - rtlphy->set_io_inprogress = false; - RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, - "<---(%#x)\n", rtlphy->current_io_type); -} - -static void rtl8723ae_phy_set_rf_on(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x2b); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x00); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); -} - -static void _rtl8723ae_phy_set_rf_sleep(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 u4b_tmp; - u8 delay = 5; - - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0xFF); - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, RFREG_OFFSET_MASK, 0x00); - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40); - u4b_tmp = rtl_get_rfreg(hw, RF90_PATH_A, 0, RFREG_OFFSET_MASK); - while (u4b_tmp != 0 && delay > 0) { - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x0); - rtl_set_rfreg(hw, RF90_PATH_A, 0x00, RFREG_OFFSET_MASK, 0x00); - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x40); - u4b_tmp = rtl_get_rfreg(hw, RF90_PATH_A, 0, RFREG_OFFSET_MASK); - delay--; - } - if (delay == 0) { - rtl_write_byte(rtlpriv, REG_APSD_CTRL, 0x00); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE3); - rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); - RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, - "Switch RF timeout !!!.\n"); - return; - } - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN, 0xE2); - rtl_write_byte(rtlpriv, REG_SPS0_CTRL, 0x22); -} - -static bool _rtl8723ae_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl8192_tx_ring *ring = NULL; - bool bresult = true; - u8 i, queue_id; - - switch (rfpwr_state) { - case ERFON: - if ((ppsc->rfpwr_state == ERFOFF) && - RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) { - bool rtstatus; - u32 InitializeCount = 0; - do { - InitializeCount++; - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "IPS Set eRf nic enable\n"); - rtstatus = rtl_ps_enable_nic(hw); - } while ((rtstatus != true) && (InitializeCount < 10)); - RT_CLEAR_PS_LEVEL(ppsc, - RT_RF_OFF_LEVL_HALT_NIC); - } else { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "Set ERFON sleeped:%d ms\n", - jiffies_to_msecs(jiffies - - ppsc->last_sleep_jiffies)); - ppsc->last_awake_jiffies = jiffies; - rtl8723ae_phy_set_rf_on(hw); - } - if (mac->link_state == MAC80211_LINKED) { - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_LINK); - } else { - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_NO_LINK); - } - break; - case ERFOFF: - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) { - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "IPS Set eRf nic disable\n"); - rtl_ps_disable_nic(hw); - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - } else { - if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) { - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_NO_LINK); - } else { - rtlpriv->cfg->ops->led_control(hw, - LED_CTL_POWER_OFF); - } - } - break; - case ERFSLEEP: - if (ppsc->rfpwr_state == ERFOFF) - break; - for (queue_id = 0, i = 0; - queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { - ring = &pcipriv->dev.tx_ring[queue_id]; - if (skb_queue_len(&ring->queue) == 0) { - queue_id++; - continue; - } else { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n", - (i + 1), queue_id, - skb_queue_len(&ring->queue)); - - udelay(10); - i++; - } - if (i >= MAX_DOZE_WAITING_TIMES_9x) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, - "\n ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n", - MAX_DOZE_WAITING_TIMES_9x, - queue_id, - skb_queue_len(&ring->queue)); - break; - } - } - RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, - "Set ERFSLEEP awaked:%d ms\n", - jiffies_to_msecs(jiffies - ppsc->last_awake_jiffies)); - ppsc->last_sleep_jiffies = jiffies; - _rtl8723ae_phy_set_rf_sleep(hw); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "switch case not processed\n"); - bresult = false; - break; - } - if (bresult) - ppsc->rfpwr_state = rfpwr_state; - return bresult; -} - -bool rtl8723ae_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state) -{ - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool bresult = false; - - if (rfpwr_state == ppsc->rfpwr_state) - return bresult; - bresult = _rtl8723ae_phy_set_rf_power_state(hw, rfpwr_state); - return bresult; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/phy.h b/drivers/net/wireless/rtlwifi/rtl8723ae/phy.h deleted file mode 100644 index e7a59eba351a..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/phy.h +++ /dev/null @@ -1,224 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL92C_PHY_H__ -#define __RTL92C_PHY_H__ - -#define MAX_PRECMD_CNT 16 -#define MAX_RFDEPENDCMD_CNT 16 -#define MAX_POSTCMD_CNT 16 - -#define MAX_DOZE_WAITING_TIMES_9x 64 - -#define RT_CANNOT_IO(hw) false -#define HIGHPOWER_RADIOA_ARRAYLEN 22 - -#define MAX_TOLERANCE 5 -#define IQK_DELAY_TIME 1 - -#define APK_BB_REG_NUM 5 -#define APK_AFE_REG_NUM 16 -#define APK_CURVE_REG_NUM 4 -#define PATH_NUM 2 - -#define LOOP_LIMIT 5 -#define MAX_STALL_TIME 50 -#define AntennaDiversityValue 0x80 -#define MAX_TXPWR_IDX_NMODE_92S 63 -#define Reset_Cnt_Limit 3 - -#define IQK_MAC_REG_NUM 4 - -#define RF6052_MAX_PATH 2 - -#define CT_OFFSET_MAC_ADDR 0X16 - -#define CT_OFFSET_CCK_TX_PWR_IDX 0x5A -#define CT_OFFSET_HT401S_TX_PWR_IDX 0x60 -#define CT_OFFSET_HT402S_TX_PWR_IDX_DIFF 0x66 -#define CT_OFFSET_HT20_TX_PWR_IDX_DIFF 0x69 -#define CT_OFFSET_OFDM_TX_PWR_IDX_DIFF 0x6C - -#define CT_OFFSET_HT40_MAX_PWR_OFFSET 0x6F -#define CT_OFFSET_HT20_MAX_PWR_OFFSET 0x72 - -#define CT_OFFSET_CHANNEL_PLAH 0x75 -#define CT_OFFSET_THERMAL_METER 0x78 -#define CT_OFFSET_RF_OPTION 0x79 -#define CT_OFFSET_VERSION 0x7E -#define CT_OFFSET_CUSTOMER_ID 0x7F - -#define RTL92C_MAX_PATH_NUM 2 - -enum swchnlcmd_id { - CMDID_END, - CMDID_SET_TXPOWEROWER_LEVEL, - CMDID_BBREGWRITE10, - CMDID_WRITEPORT_ULONG, - CMDID_WRITEPORT_USHORT, - CMDID_WRITEPORT_UCHAR, - CMDID_RF_WRITEREG, -}; - -struct swchnlcmd { - enum swchnlcmd_id cmdid; - u32 para1; - u32 para2; - u32 msdelay; -}; - -enum hw90_block_e { - HW90_BLOCK_MAC = 0, - HW90_BLOCK_PHY0 = 1, - HW90_BLOCK_PHY1 = 2, - HW90_BLOCK_RF = 3, - HW90_BLOCK_MAXIMUM = 4, -}; - -enum baseband_config_type { - BASEBAND_CONFIG_PHY_REG = 0, - BASEBAND_CONFIG_AGC_TAB = 1, -}; - -enum ra_offset_area { - RA_OFFSET_LEGACY_OFDM1, - RA_OFFSET_LEGACY_OFDM2, - RA_OFFSET_HT_OFDM1, - RA_OFFSET_HT_OFDM2, - RA_OFFSET_HT_OFDM3, - RA_OFFSET_HT_OFDM4, - RA_OFFSET_HT_CCK, -}; - -enum antenna_path { - ANTENNA_NONE, - ANTENNA_D, - ANTENNA_C, - ANTENNA_CD, - ANTENNA_B, - ANTENNA_BD, - ANTENNA_BC, - ANTENNA_BCD, - ANTENNA_A, - ANTENNA_AD, - ANTENNA_AC, - ANTENNA_ACD, - ANTENNA_AB, - ANTENNA_ABD, - ANTENNA_ABC, - ANTENNA_ABCD -}; - -struct r_antenna_select_ofdm { - u32 r_tx_antenna:4; - u32 r_ant_l:4; - u32 r_ant_non_ht:4; - u32 r_ant_ht1:4; - u32 r_ant_ht2:4; - u32 r_ant_ht_s1:4; - u32 r_ant_non_ht_s1:4; - u32 ofdm_txsc:2; - u32 reserved:2; -}; - -struct r_antenna_select_cck { - u8 r_cckrx_enable_2:2; - u8 r_cckrx_enable:2; - u8 r_ccktx_enable:4; -}; - -struct efuse_contents { - u8 mac_addr[ETH_ALEN]; - u8 cck_tx_power_idx[6]; - u8 ht40_1s_tx_power_idx[6]; - u8 ht40_2s_tx_power_idx_diff[3]; - u8 ht20_tx_power_idx_diff[3]; - u8 ofdm_tx_power_idx_diff[3]; - u8 ht40_max_power_offset[3]; - u8 ht20_max_power_offset[3]; - u8 channel_plan; - u8 thermal_meter; - u8 rf_option[5]; - u8 version; - u8 oem_id; - u8 regulatory; -}; - -struct tx_power_struct { - u8 cck[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht40_1s[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht40_2s[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht20_diff[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 legacy_ht_diff[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 legacy_ht_txpowerdiff; - u8 groupht20[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 groupht40[RTL92C_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 pwrgroup_cnt; - u32 mcs_original_offset[4][16]; -}; - -extern u32 rtl8723ae_phy_query_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask); -extern void rtl8723ae_phy_set_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, u32 data); -extern u32 rtl8723ae_phy_query_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, - u32 bitmask); -extern void rtl8723ae_phy_set_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, - u32 bitmask, u32 data); -extern bool rtl8723ae_phy_mac_config(struct ieee80211_hw *hw); -extern bool rtl8723ae_phy_bb_config(struct ieee80211_hw *hw); -extern bool rtl8723ae_phy_rf_config(struct ieee80211_hw *hw); -extern bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, - enum radio_path rfpath); -extern void rtl8723ae_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); -extern void rtl8723ae_phy_get_txpower_level(struct ieee80211_hw *hw, - long *powerlevel); -extern void rtl8723ae_phy_set_txpower_level(struct ieee80211_hw *hw, - u8 channel); -extern bool rtl8723ae_phy_update_txpower_dbm(struct ieee80211_hw *hw, - long power_indbm); -extern void rtl8723ae_phy_scan_operation_backup(struct ieee80211_hw *hw, - u8 operation); -extern void rtl8723ae_phy_set_bw_mode_callback(struct ieee80211_hw *hw); -extern void rtl8723ae_phy_set_bw_mode(struct ieee80211_hw *hw, - enum nl80211_channel_type ch_type); -extern void rtl8723ae_phy_sw_chnl_callback(struct ieee80211_hw *hw); -extern u8 rtl8723ae_phy_sw_chnl(struct ieee80211_hw *hw); -extern void rtl8723ae_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery); -void rtl8723ae_phy_lc_calibrate(struct ieee80211_hw *hw); -void rtl8723ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); -bool rtl8723ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, - enum radio_path rfpath); -bool rtl8723ae_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); -extern bool rtl8723ae_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseq.c b/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseq.c deleted file mode 100644 index df6ca9a57f7f..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseq.c +++ /dev/null @@ -1,109 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "pwrseqcmd.h" -#include "pwrseq.h" - -/* drivers should parse arrays below and do the corresponding actions */ - -/*3 Power on Array*/ -struct wlan_pwr_cfg rtl8723A_power_on_flow[RTL8723A_TRANS_CARDEMU_TO_ACT_STPS - + RTL8723A_TRANS_END_STPS] = { - RTL8723A_TRANS_CARDEMU_TO_ACT, - RTL8723A_TRANS_END -}; - -/*3Radio off GPIO Array */ -struct wlan_pwr_cfg rtl8723A_radio_off_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STPS - + RTL8723A_TRANS_END_STPS] = { - RTL8723A_TRANS_ACT_TO_CARDEMU, - RTL8723A_TRANS_END -}; - -/*3Card Disable Array*/ -struct wlan_pwr_cfg -rtl8723A_card_disable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STPS - + RTL8723A_TRANS_CARDEMU_TO_PDN_STPS - + RTL8723A_TRANS_END_STPS] = { - RTL8723A_TRANS_ACT_TO_CARDEMU, - RTL8723A_TRANS_CARDEMU_TO_CARDDIS, - RTL8723A_TRANS_END -}; - -/*3 Card Enable Array*/ -struct wlan_pwr_cfg rtl8723A_card_enable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STPS - + RTL8723A_TRANS_CARDEMU_TO_PDN_STPS - + RTL8723A_TRANS_END_STPS] = { - RTL8723A_TRANS_CARDDIS_TO_CARDEMU, - RTL8723A_TRANS_CARDEMU_TO_ACT, - RTL8723A_TRANS_END -}; - -/*3Suspend Array*/ -struct wlan_pwr_cfg rtl8723A_suspend_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STPS - + RTL8723A_TRANS_CARDEMU_TO_SUS_STPS - + RTL8723A_TRANS_END_STPS] = { - RTL8723A_TRANS_ACT_TO_CARDEMU, - RTL8723A_TRANS_CARDEMU_TO_SUS, - RTL8723A_TRANS_END -}; - -/*3 Resume Array*/ -struct wlan_pwr_cfg rtl8723A_resume_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STPS - + RTL8723A_TRANS_CARDEMU_TO_SUS_STPS - + RTL8723A_TRANS_END_STPS] = { - RTL8723A_TRANS_SUS_TO_CARDEMU, - RTL8723A_TRANS_CARDEMU_TO_ACT, - RTL8723A_TRANS_END -}; - -/*3HWPDN Array*/ -struct wlan_pwr_cfg rtl8723A_hwpdn_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STPS - + RTL8723A_TRANS_CARDEMU_TO_PDN_STPS - + RTL8723A_TRANS_END_STPS] = { - RTL8723A_TRANS_ACT_TO_CARDEMU, - RTL8723A_TRANS_CARDEMU_TO_PDN, - RTL8723A_TRANS_END -}; - -/*3 Enter LPS */ -struct wlan_pwr_cfg rtl8723A_enter_lps_flow[RTL8723A_TRANS_ACT_TO_LPS_STPS - + RTL8723A_TRANS_END_STPS] = { - /*FW behavior*/ - RTL8723A_TRANS_ACT_TO_LPS, - RTL8723A_TRANS_END -}; - -/*3 Leave LPS */ -struct wlan_pwr_cfg rtl8723A_leave_lps_flow[RTL8723A_TRANS_LPS_TO_ACT_STPS - + RTL8723A_TRANS_END_STPS] = { - /*FW behavior*/ - RTL8723A_TRANS_LPS_TO_ACT, - RTL8723A_TRANS_END -}; diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseq.h b/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseq.h deleted file mode 100644 index 7a46f9fdf558..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseq.h +++ /dev/null @@ -1,322 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL8723E_PWRSEQ_H__ -#define __RTL8723E_PWRSEQ_H__ - -#include "pwrseqcmd.h" -/* - Check document WM-20110607-Paul-RTL8723A_Power_Architecture-R02.vsd - There are 6 HW Power States: - 0: POFF--Power Off - 1: PDN--Power Down - 2: CARDEMU--Card Emulation - 3: ACT--Active Mode - 4: LPS--Low Power State - 5: SUS--Suspend - - The transision from different states are defined below - TRANS_CARDEMU_TO_ACT - TRANS_ACT_TO_CARDEMU - TRANS_CARDEMU_TO_SUS - TRANS_SUS_TO_CARDEMU - TRANS_CARDEMU_TO_PDN - TRANS_ACT_TO_LPS - TRANS_LPS_TO_ACT - - TRANS_END -*/ - -#define RTL8723A_TRANS_CARDEMU_TO_ACT_STPS 10 -#define RTL8723A_TRANS_ACT_TO_CARDEMU_STPS 10 -#define RTL8723A_TRANS_CARDEMU_TO_SUS_STPS 10 -#define RTL8723A_TRANS_SUS_TO_CARDEMU_STPS 10 -#define RTL8723A_TRANS_CARDEMU_TO_PDN_STPS 10 -#define RTL8723A_TRANS_PDN_TO_CARDEMU_STPS 10 -#define RTL8723A_TRANS_ACT_TO_LPS_STPS 15 -#define RTL8723A_TRANS_LPS_TO_ACT_STPS 15 -#define RTL8723A_TRANS_END_STPS 1 - - -#define RTL8723A_TRANS_CARDEMU_TO_ACT \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, \ - * comments here*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(2), 0}, \ - /* disable SW LPS 0x04[10]=0*/ \ - {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(1), BIT(1)}, \ - /* wait till 0x04[17] = 1 power ready*/ \ - {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), BIT(0)}, \ - /* release WLON reset 0x04[16]=1*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), 0}, \ - /* disable HWPDN 0x04[15]=0*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, (BIT(4)|BIT(3)), 0}, \ - /* disable WL suspend*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), BIT(0)}, \ - /* polling until return 0*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(0), 0} - -#define RTL8723A_TRANS_ACT_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, \ - * comments here*/ \ - {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0}, \ - /*0x1F[7:0] = 0 turn off RF*/ \ - {0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), 0}, \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), BIT(1)}, \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(1), 0} - -#define RTL8723A_TRANS_CARDEMU_TO_SUS \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, \ - * comments here*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4)|BIT(3), \ - (BIT(4)|BIT(3))}, \ - /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK | \ - PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), BIT(3)},\ - /*0x04[12:11] = 2b'01 enable WL suspend*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, \ - PWR_BASEADDR_MAC, \ - PWR_CMD_WRITE, BIT(3)|BIT(4), BIT(3)|BIT(4)}, \ - /*0x04[12:11] = 2b'11 enable WL suspend for PCIe*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_SDIO, \ - PWR_CMD_WRITE, BIT(0), BIT(0)}, \ - /*Set SDIO suspend local register*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_SDIO, \ - PWR_CMD_POLLING, BIT(1), 0} \ - /*wait power state to suspend*/ - -#define RTL8723A_TRANS_SUS_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT(0), 0}, \ - /*Set SDIO suspend local register*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT(1), BIT(1)}, \ - /*wait power state to suspend*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), 0} \ - /*0x04[12:11] = 2b'01enable WL suspend*/ - -#define RTL8723A_TRANS_CARDEMU_TO_CARDDIS \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, \ - PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), BIT(3)},\ - /*0x04[12:11] = 2b'01 enable WL suspend*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(2), BIT(2)}, \ - /*0x04[10] = 1, enable SW LPS*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT(0), BIT(0)}, \ - /*Set SDIO suspend local register*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT(1), 0} \ - /*wait power state to suspend*/ - -#define RTL8723A_TRANS_CARDDIS_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT(0), 0}, \ - /*Set SDIO suspend local register*/ \ - {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT(1), BIT(1)}, \ - /*wait power state to suspend*/ \ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(3)|BIT(4), 0}, \ - /*0x04[12:11] = 2b'00enable WL suspend*/ \ - {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0} \ - /*PCIe DMA start*/ - -#define RTL8723A_TRANS_CARDEMU_TO_PDN \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\ - {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), 0}, \ - /* 0x04[16] = 0*/\ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), BIT(7)} \ - /* 0x04[15] = 1*/ - -#define RTL8723A_TRANS_PDN_TO_CARDEMU \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\ - {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(7), 0} \ - /* 0x04[15] = 0*/ - -#define RTL8723A_TRANS_ACT_TO_LPS \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\ - {0x0301, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF}, \ - /*PCIe DMA stop*/ \ - {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x7F}, \ - /*Tx Pause*/ \ - {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0}, \ - /*Should be zero if no packet is transmitting*/ \ - {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0}, \ - /*Should be zero if no packet is transmitting*/ \ - {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0}, \ - /*Should be zero if no packet is transmitting*/ \ - {0x05FB, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0}, \ - /*Should be zero if no packet is transmitting*/ \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(0), 0}, \ - /*CCK and OFDM are disabled,and clock are gated*/ \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US}, \ - /*Delay 1us*/ \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), 0}, \ - /*Whole BB is reset*/ \ - {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x3F}, \ - /*Reset MAC TRX*/ \ - {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), 0}, \ - /*check if removed later*/ \ - {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(5), BIT(5)} \ - /*Respond TxOK to scheduler*/ - -#define RTL8723A_TRANS_LPS_TO_ACT \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\ - {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, \ - PWR_BASEADDR_SDIO, PWR_CMD_WRITE, 0xFF, 0x84}, \ - /*SDIO RPWM*/ \ - {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x84}, \ - /*USB RPWM*/ \ - {0x0361, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x84}, \ - /*PCIe RPWM*/ \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, \ - /*Delay*/ \ - {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(4), 0}, \ - /* 0x08[4] = 0 switch TSF to 40M*/ \ - {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT(7), 0}, \ - /*Polling 0x109[7]=0 TSF in 40M*/ \ - {0x0029, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(6)|BIT(7), 0}, \ - /*. 0x29[7:6] = 2b'00 enable BB clock*/ \ - {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1), BIT(1)}, \ - /*. 0x101[1] = 1*/ \ - {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF}, \ - /* 0x100[7:0] = 0xFF enable WMAC TRX*/ \ - {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT(1)|BIT(0), \ - BIT(1)|BIT(0)}, \ - /* 0x02[1:0] = 2b'11 enable BB macro*/ \ - {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0} \ - /*. 0x522 = 0*/ - -#define RTL8723A_TRANS_END \ - /* format */ \ - /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, */\ - {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, \ - 0, PWR_CMD_END, 0, 0} - -extern struct -wlan_pwr_cfg rtl8723A_power_on_flow[RTL8723A_TRANS_CARDEMU_TO_ACT_STPS - + RTL8723A_TRANS_END_STPS]; -extern struct -wlan_pwr_cfg rtl8723A_radio_off_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STPS - + RTL8723A_TRANS_END_STPS]; -extern struct -wlan_pwr_cfg rtl8723A_card_disable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STPS - + RTL8723A_TRANS_CARDEMU_TO_PDN_STPS - + RTL8723A_TRANS_END_STPS]; -extern struct -wlan_pwr_cfg rtl8723A_card_enable_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STPS - + RTL8723A_TRANS_CARDEMU_TO_PDN_STPS - + RTL8723A_TRANS_END_STPS]; -extern struct -wlan_pwr_cfg rtl8723A_suspend_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STPS - + RTL8723A_TRANS_CARDEMU_TO_SUS_STPS - + RTL8723A_TRANS_END_STPS]; -extern struct -wlan_pwr_cfg rtl8723A_resume_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STPS - + RTL8723A_TRANS_CARDEMU_TO_SUS_STPS - + RTL8723A_TRANS_END_STPS]; -extern struct -wlan_pwr_cfg rtl8723A_hwpdn_flow[RTL8723A_TRANS_ACT_TO_CARDEMU_STPS - + RTL8723A_TRANS_CARDEMU_TO_PDN_STPS - + RTL8723A_TRANS_END_STPS]; -extern struct -wlan_pwr_cfg rtl8723A_enter_lps_flow[RTL8723A_TRANS_ACT_TO_LPS_STPS - + RTL8723A_TRANS_END_STPS]; -extern struct -wlan_pwr_cfg rtl8723A_leave_lps_flow[RTL8723A_TRANS_LPS_TO_ACT_STPS - + RTL8723A_TRANS_END_STPS]; - -/* RTL8723 Power Configuration CMDs for PCIe interface */ -#define Rtl8723_NIC_PWR_ON_FLOW rtl8723A_power_on_flow -#define Rtl8723_NIC_RF_OFF_FLOW rtl8723A_radio_off_flow -#define Rtl8723_NIC_DISABLE_FLOW rtl8723A_card_disable_flow -#define Rtl8723_NIC_ENABLE_FLOW rtl8723A_card_enable_flow -#define Rtl8723_NIC_SUSPEND_FLOW rtl8723A_suspend_flow -#define Rtl8723_NIC_RESUME_FLOW rtl8723A_resume_flow -#define Rtl8723_NIC_PDN_FLOW rtl8723A_hwpdn_flow -#define Rtl8723_NIC_LPS_ENTER_FLOW rtl8723A_enter_lps_flow -#define Rtl8723_NIC_LPS_LEAVE_FLOW rtl8723A_leave_lps_flow - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseqcmd.c b/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseqcmd.c deleted file mode 100644 index 2044b5936b7f..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseqcmd.c +++ /dev/null @@ -1,129 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "pwrseq.h" - -/* Description: - * This routine deals with the Power Configuration CMD - * parsing for RTL8723/RTL8188E Series IC. - * Assumption: - * We should follow specific format that was released from HW SD. - */ -bool rtl_hal_pwrseqcmdparsing(struct rtl_priv *rtlpriv, u8 cut_version, - u8 faversion, u8 interface_type, - struct wlan_pwr_cfg pwrcfgcmd[]) -{ - struct wlan_pwr_cfg cfg_cmd = {0}; - bool polling_bit = false; - u32 ary_idx = 0; - u8 value = 0; - u32 offset = 0; - u32 polling_count = 0; - u32 max_polling_cnt = 5000; - - do { - cfg_cmd = pwrcfgcmd[ary_idx]; - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "rtl_hal_pwrseqcmdparsing(): offset(%#x),cut_msk(%#x), famsk(%#x)," - "interface_msk(%#x), base(%#x), cmd(%#x), msk(%#x), value(%#x)\n", - GET_PWR_CFG_OFFSET(cfg_cmd), - GET_PWR_CFG_CUT_MASK(cfg_cmd), - GET_PWR_CFG_FAB_MASK(cfg_cmd), - GET_PWR_CFG_INTF_MASK(cfg_cmd), - GET_PWR_CFG_BASE(cfg_cmd), GET_PWR_CFG_CMD(cfg_cmd), - GET_PWR_CFG_MASK(cfg_cmd), GET_PWR_CFG_VALUE(cfg_cmd)); - - if ((GET_PWR_CFG_FAB_MASK(cfg_cmd)&faversion) && - (GET_PWR_CFG_CUT_MASK(cfg_cmd)&cut_version) && - (GET_PWR_CFG_INTF_MASK(cfg_cmd)&interface_type)) { - switch (GET_PWR_CFG_CMD(cfg_cmd)) { - case PWR_CMD_READ: - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "rtl_hal_pwrseqcmdparsing(): PWR_CMD_READ\n"); - break; - case PWR_CMD_WRITE: - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "rtl_hal_pwrseqcmdparsing(): PWR_CMD_WRITE\n"); - offset = GET_PWR_CFG_OFFSET(cfg_cmd); - - /*Read the value from system register*/ - value = rtl_read_byte(rtlpriv, offset); - value &= (~(GET_PWR_CFG_MASK(cfg_cmd))); - value |= (GET_PWR_CFG_VALUE(cfg_cmd) & - GET_PWR_CFG_MASK(cfg_cmd)); - - /*Write the value back to sytem register*/ - rtl_write_byte(rtlpriv, offset, value); - break; - case PWR_CMD_POLLING: - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "rtl_hal_pwrseqcmdparsing(): PWR_CMD_POLLING\n"); - polling_bit = false; - offset = GET_PWR_CFG_OFFSET(cfg_cmd); - - do { - value = rtl_read_byte(rtlpriv, offset); - - value &= GET_PWR_CFG_MASK(cfg_cmd); - if (value == - (GET_PWR_CFG_VALUE(cfg_cmd) - & GET_PWR_CFG_MASK(cfg_cmd))) - polling_bit = true; - else - udelay(10); - - if (polling_count++ > max_polling_cnt) - return false; - } while (!polling_bit); - break; - case PWR_CMD_DELAY: - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "rtl_hal_pwrseqcmdparsing(): PWR_CMD_DELAY\n"); - if (GET_PWR_CFG_VALUE(cfg_cmd) == - PWRSEQ_DELAY_US) - udelay(GET_PWR_CFG_OFFSET(cfg_cmd)); - else - mdelay(GET_PWR_CFG_OFFSET(cfg_cmd)); - break; - case PWR_CMD_END: - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "rtl_hal_pwrseqcmdparsing(): PWR_CMD_END\n"); - return true; - default: - RT_ASSERT(false, - "rtl_hal_pwrseqcmdparsing(): Unknown CMD!!\n"); - break; - } - - } - ary_idx++; - } while (1); - - return true; -} diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseqcmd.h b/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseqcmd.h deleted file mode 100644 index 6e0f3ea37ec0..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseqcmd.h +++ /dev/null @@ -1,98 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL8723E_PWRSEQCMD_H__ -#define __RTL8723E_PWRSEQCMD_H__ - -#include "../wifi.h" -/*--------------------------------------------- - * 3 The value of cmd: 4 bits - *--------------------------------------------- - */ -#define PWR_CMD_READ 0x00 -#define PWR_CMD_WRITE 0x01 -#define PWR_CMD_POLLING 0x02 -#define PWR_CMD_DELAY 0x03 -#define PWR_CMD_END 0x04 - -/* define the base address of each block */ -#define PWR_BASEADDR_MAC 0x00 -#define PWR_BASEADDR_USB 0x01 -#define PWR_BASEADDR_PCIE 0x02 -#define PWR_BASEADDR_SDIO 0x03 - -#define PWR_INTF_SDIO_MSK BIT(0) -#define PWR_INTF_USB_MSK BIT(1) -#define PWR_INTF_PCI_MSK BIT(2) -#define PWR_INTF_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3)) - -#define PWR_FAB_TSMC_MSK BIT(0) -#define PWR_FAB_UMC_MSK BIT(1) -#define PWR_FAB_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3)) - -#define PWR_CUT_TESTCHIP_MSK BIT(0) -#define PWR_CUT_A_MSK BIT(1) -#define PWR_CUT_B_MSK BIT(2) -#define PWR_CUT_C_MSK BIT(3) -#define PWR_CUT_D_MSK BIT(4) -#define PWR_CUT_E_MSK BIT(5) -#define PWR_CUT_F_MSK BIT(6) -#define PWR_CUT_G_MSK BIT(7) -#define PWR_CUT_ALL_MSK 0xFF - -enum pwrseq_delay_unit { - PWRSEQ_DELAY_US, - PWRSEQ_DELAY_MS, -}; - -struct wlan_pwr_cfg { - u16 offset; - u8 cut_msk; - u8 fab_msk:4; - u8 interface_msk:4; - u8 base:4; - u8 cmd:4; - u8 msk; - u8 value; -}; - -#define GET_PWR_CFG_OFFSET(__PWR_CMD) (__PWR_CMD.offset) -#define GET_PWR_CFG_CUT_MASK(__PWR_CMD) (__PWR_CMD.cut_msk) -#define GET_PWR_CFG_FAB_MASK(__PWR_CMD) (__PWR_CMD.fab_msk) -#define GET_PWR_CFG_INTF_MASK(__PWR_CMD) (__PWR_CMD.interface_msk) -#define GET_PWR_CFG_BASE(__PWR_CMD) (__PWR_CMD.base) -#define GET_PWR_CFG_CMD(__PWR_CMD) (__PWR_CMD.cmd) -#define GET_PWR_CFG_MASK(__PWR_CMD) (__PWR_CMD.msk) -#define GET_PWR_CFG_VALUE(__PWR_CMD) (__PWR_CMD.value) - -bool rtl_hal_pwrseqcmdparsing(struct rtl_priv *rtlpriv, u8 cut_version, - u8 fab_version, u8 interface_type, - struct wlan_pwr_cfg pwrcfgcmd[]); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/reg.h b/drivers/net/wireless/rtlwifi/rtl8723ae/reg.h deleted file mode 100644 index 199da366c6da..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/reg.h +++ /dev/null @@ -1,2097 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL8723E_REG_H__ -#define __RTL8723E_REG_H__ - -#define REG_SYS_ISO_CTRL 0x0000 -#define REG_SYS_FUNC_EN 0x0002 -#define REG_APS_FSMCO 0x0004 -#define REG_SYS_CLKR 0x0008 -#define REG_9346CR 0x000A -#define REG_EE_VPD 0x000C -#define REG_AFE_MISC 0x0010 -#define REG_SPS0_CTRL 0x0011 -#define REG_SPS_OCP_CFG 0x0018 -#define REG_RSV_CTRL 0x001C -#define REG_RF_CTRL 0x001F -#define REG_LDOA15_CTRL 0x0020 -#define REG_LDOV12D_CTRL 0x0021 -#define REG_LDOHCI12_CTRL 0x0022 -#define REG_LPLDO_CTRL 0x0023 -#define REG_AFE_XTAL_CTRL 0x0024 -#define REG_AFE_PLL_CTRL 0x0028 -#define REG_EFUSE_CTRL 0x0030 -#define REG_EFUSE_TEST 0x0034 -#define REG_PWR_DATA 0x0038 -#define REG_CAL_TIMER 0x003C -#define REG_ACLK_MON 0x003E -#define REG_GPIO_MUXCFG 0x0040 -#define REG_GPIO_IO_SEL 0x0042 -#define REG_MAC_PINMUX_CFG 0x0043 -#define REG_GPIO_PIN_CTRL 0x0044 -#define REG_GPIO_INTM 0x0048 -#define REG_LEDCFG0 0x004C -#define REG_LEDCFG1 0x004D -#define REG_LEDCFG2 0x004E -#define REG_LEDCFG3 0x004F -#define REG_FSIMR 0x0050 -#define REG_FSISR 0x0054 -#define REG_GPIO_PIN_CTRL_2 0x0060 -#define REG_GPIO_IO_SEL_2 0x0062 -#define REG_MULTI_FUNC_CTRL 0x0068 - -#define REG_MCUFWDL 0x0080 - -#define REG_HMEBOX_EXT_0 0x0088 -#define REG_HMEBOX_EXT_1 0x008A -#define REG_HMEBOX_EXT_2 0x008C -#define REG_HMEBOX_EXT_3 0x008E - -#define REG_BIST_SCAN 0x00D0 -#define REG_BIST_RPT 0x00D4 -#define REG_BIST_ROM_RPT 0x00D8 -#define REG_USB_SIE_INTF 0x00E0 -#define REG_PCIE_MIO_INTF 0x00E4 -#define REG_PCIE_MIO_INTD 0x00E8 -#define REG_SYS_CFG 0x00F0 -#define REG_GPIO_OUTSTS 0x00F4 - -#define REG_CR 0x0100 -#define REG_PBP 0x0104 -#define REG_TRXDMA_CTRL 0x010C -#define REG_TRXFF_BNDY 0x0114 -#define REG_TRXFF_STATUS 0x0118 -#define REG_RXFF_PTR 0x011C -#define REG_HIMR 0x0120 -#define REG_HISR 0x0124 -#define REG_HIMRE 0x0128 -#define REG_HISRE 0x012C -#define REG_CPWM 0x012F -#define REG_FWIMR 0x0130 -#define REG_FWISR 0x0134 -#define REG_PKTBUF_DBG_CTRL 0x0140 -#define REG_PKTBUF_DBG_DATA_L 0x0144 -#define REG_PKTBUF_DBG_DATA_H 0x0148 - -#define REG_TC0_CTRL 0x0150 -#define REG_TC1_CTRL 0x0154 -#define REG_TC2_CTRL 0x0158 -#define REG_TC3_CTRL 0x015C -#define REG_TC4_CTRL 0x0160 -#define REG_TCUNIT_BASE 0x0164 -#define REG_MBIST_START 0x0174 -#define REG_MBIST_DONE 0x0178 -#define REG_MBIST_FAIL 0x017C -#define REG_C2HEVT_MSG_NORMAL 0x01A0 -#define REG_C2HEVT_MSG_TEST 0x01B8 -#define REG_MCUTST_1 0x01c0 -#define REG_FMETHR 0x01C8 -#define REG_HMETFR 0x01CC -#define REG_HMEBOX_0 0x01D0 -#define REG_HMEBOX_1 0x01D4 -#define REG_HMEBOX_2 0x01D8 -#define REG_HMEBOX_3 0x01DC - -#define REG_LLT_INIT 0x01E0 -#define REG_BB_ACCEESS_CTRL 0x01E8 -#define REG_BB_ACCESS_DATA 0x01EC - -#define REG_RQPN 0x0200 -#define REG_FIFOPAGE 0x0204 -#define REG_TDECTRL 0x0208 -#define REG_TXDMA_OFFSET_CHK 0x020C -#define REG_TXDMA_STATUS 0x0210 -#define REG_RQPN_NPQ 0x0214 - -#define REG_RXDMA_AGG_PG_TH 0x0280 -#define REG_RXPKT_NUM 0x0284 -#define REG_RXDMA_STATUS 0x0288 - -#define REG_PCIE_CTRL_REG 0x0300 -#define REG_INT_MIG 0x0304 -#define REG_BCNQ_DESA 0x0308 -#define REG_HQ_DESA 0x0310 -#define REG_MGQ_DESA 0x0318 -#define REG_VOQ_DESA 0x0320 -#define REG_VIQ_DESA 0x0328 -#define REG_BEQ_DESA 0x0330 -#define REG_BKQ_DESA 0x0338 -#define REG_RX_DESA 0x0340 -#define REG_DBI 0x0348 -#define REG_MDIO 0x0354 -#define REG_DBG_SEL 0x0360 -#define REG_PCIE_HRPWM 0x0361 -#define REG_PCIE_HCPWM 0x0363 -#define REG_UART_CTRL 0x0364 -#define REG_UART_TX_DESA 0x0370 -#define REG_UART_RX_DESA 0x0378 - -#define REG_HDAQ_DESA_NODEF 0x0000 -#define REG_CMDQ_DESA_NODEF 0x0000 - -#define REG_VOQ_INFORMATION 0x0400 -#define REG_VIQ_INFORMATION 0x0404 -#define REG_BEQ_INFORMATION 0x0408 -#define REG_BKQ_INFORMATION 0x040C -#define REG_MGQ_INFORMATION 0x0410 -#define REG_HGQ_INFORMATION 0x0414 -#define REG_BCNQ_INFORMATION 0x0418 - -#define REG_CPU_MGQ_INFORMATION 0x041C -#define REG_FWHW_TXQ_CTRL 0x0420 -#define REG_HWSEQ_CTRL 0x0423 -#define REG_TXPKTBUF_BCNQ_BDNY 0x0424 -#define REG_TXPKTBUF_MGQ_BDNY 0x0425 -#define REG_MULTI_BCNQ_EN 0x0426 -#define REG_MULTI_BCNQ_OFFSET 0x0427 -#define REG_SPEC_SIFS 0x0428 -#define REG_RL 0x042A -#define REG_DARFRC 0x0430 -#define REG_RARFRC 0x0438 -#define REG_RRSR 0x0440 -#define REG_ARFR0 0x0444 -#define REG_ARFR1 0x0448 -#define REG_ARFR2 0x044C -#define REG_ARFR3 0x0450 -#define REG_AGGLEN_LMT 0x0458 -#define REG_AMPDU_MIN_SPACE 0x045C -#define REG_TXPKTBUF_WMAC_LBK_BF_HD 0x045D -#define REG_FAST_EDCA_CTRL 0x0460 -#define REG_RD_RESP_PKT_TH 0x0463 -#define REG_INIRTS_RATE_SEL 0x0480 -#define REG_INIDATA_RATE_SEL 0x0484 -#define REG_POWER_STATUS 0x04A4 -#define REG_POWER_STAGE1 0x04B4 -#define REG_POWER_STAGE2 0x04B8 -#define REG_PKT_LIFE_TIME 0x04C0 -#define REG_STBC_SETTING 0x04C4 -#define REG_PROT_MODE_CTRL 0x04C8 -#define REG_BAR_MODE_CTRL 0x04CC -#define REG_RA_TRY_RATE_AGG_LMT 0x04CF -#define REG_NQOS_SEQ 0x04DC -#define REG_QOS_SEQ 0x04DE -#define REG_NEED_CPU_HANDLE 0x04E0 -#define REG_PKT_LOSE_RPT 0x04E1 -#define REG_PTCL_ERR_STATUS 0x04E2 -#define REG_DUMMY 0x04FC - -#define REG_EDCA_VO_PARAM 0x0500 -#define REG_EDCA_VI_PARAM 0x0504 -#define REG_EDCA_BE_PARAM 0x0508 -#define REG_EDCA_BK_PARAM 0x050C -#define REG_BCNTCFG 0x0510 -#define REG_PIFS 0x0512 -#define REG_RDG_PIFS 0x0513 -#define REG_SIFS_CTX 0x0514 -#define REG_SIFS_TRX 0x0516 -#define REG_AGGR_BREAK_TIME 0x051A -#define REG_SLOT 0x051B -#define REG_TX_PTCL_CTRL 0x0520 -#define REG_TXPAUSE 0x0522 -#define REG_DIS_TXREQ_CLR 0x0523 -#define REG_RD_CTRL 0x0524 -#define REG_TBTT_PROHIBIT 0x0540 -#define REG_RD_NAV_NXT 0x0544 -#define REG_NAV_PROT_LEN 0x0546 -#define REG_BCN_CTRL 0x0550 -#define REG_USTIME_TSF 0x0551 -#define REG_MBID_NUM 0x0552 -#define REG_DUAL_TSF_RST 0x0553 -#define REG_BCN_INTERVAL 0x0554 -#define REG_MBSSID_BCN_SPACE 0x0554 -#define REG_DRVERLYINT 0x0558 -#define REG_BCNDMATIM 0x0559 -#define REG_ATIMWND 0x055A -#define REG_BCN_MAX_ERR 0x055D -#define REG_RXTSF_OFFSET_CCK 0x055E -#define REG_RXTSF_OFFSET_OFDM 0x055F -#define REG_TSFTR 0x0560 -#define REG_INIT_TSFTR 0x0564 -#define REG_PSTIMER 0x0580 -#define REG_TIMER0 0x0584 -#define REG_TIMER1 0x0588 -#define REG_ACMHWCTRL 0x05C0 -#define REG_ACMRSTCTRL 0x05C1 -#define REG_ACMAVG 0x05C2 -#define REG_VO_ADMTIME 0x05C4 -#define REG_VI_ADMTIME 0x05C6 -#define REG_BE_ADMTIME 0x05C8 -#define REG_EDCA_RANDOM_GEN 0x05CC -#define REG_SCH_TXCMD 0x05D0 - -#define REG_APSD_CTRL 0x0600 -#define REG_BWOPMODE 0x0603 -#define REG_TCR 0x0604 -#define REG_RCR 0x0608 -#define REG_RX_PKT_LIMIT 0x060C -#define REG_RX_DLK_TIME 0x060D -#define REG_RX_DRVINFO_SZ 0x060F - -#define REG_MACID 0x0610 -#define REG_BSSID 0x0618 -#define REG_MAR 0x0620 -#define REG_MBIDCAMCFG 0x0628 - -#define REG_USTIME_EDCA 0x0638 -#define REG_MAC_SPEC_SIFS 0x063A -#define REG_RESP_SIFS_CCK 0x063C -#define REG_RESP_SIFS_OFDM 0x063E -#define REG_ACKTO 0x0640 -#define REG_CTS2TO 0x0641 -#define REG_EIFS 0x0642 - -#define REG_NAV_CTRL 0x0650 -#define REG_BACAMCMD 0x0654 -#define REG_BACAMCONTENT 0x0658 -#define REG_LBDLY 0x0660 -#define REG_FWDLY 0x0661 -#define REG_RXERR_RPT 0x0664 -#define REG_WMAC_TRXPTCL_CTL 0x0668 - -#define REG_CAMCMD 0x0670 -#define REG_CAMWRITE 0x0674 -#define REG_CAMREAD 0x0678 -#define REG_CAMDBG 0x067C -#define REG_SECCFG 0x0680 - -#define REG_WOW_CTRL 0x0690 -#define REG_PSSTATUS 0x0691 -#define REG_PS_RX_INFO 0x0692 -#define REG_LPNAV_CTRL 0x0694 -#define REG_WKFMCAM_CMD 0x0698 -#define REG_WKFMCAM_RWD 0x069C -#define REG_RXFLTMAP0 0x06A0 -#define REG_RXFLTMAP1 0x06A2 -#define REG_RXFLTMAP2 0x06A4 -#define REG_BCN_PSR_RPT 0x06A8 -#define REG_CALB32K_CTRL 0x06AC -#define REG_PKT_MON_CTRL 0x06B4 -#define REG_BT_COEX_TABLE 0x06C0 -#define REG_WMAC_RESP_TXINFO 0x06D8 - -#define REG_USB_INFO 0xFE17 -#define REG_USB_SPECIAL_OPTION 0xFE55 -#define REG_USB_DMA_AGG_TO 0xFE5B -#define REG_USB_AGG_TO 0xFE5C -#define REG_USB_AGG_TH 0xFE5D - -#define REG_TEST_USB_TXQS 0xFE48 -#define REG_TEST_SIE_VID 0xFE60 -#define REG_TEST_SIE_PID 0xFE62 -#define REG_TEST_SIE_OPTIONAL 0xFE64 -#define REG_TEST_SIE_CHIRP_K 0xFE65 -#define REG_TEST_SIE_PHY 0xFE66 -#define REG_TEST_SIE_MAC_ADDR 0xFE70 -#define REG_TEST_SIE_STRING 0xFE80 - -#define REG_NORMAL_SIE_VID 0xFE60 -#define REG_NORMAL_SIE_PID 0xFE62 -#define REG_NORMAL_SIE_OPTIONAL 0xFE64 -#define REG_NORMAL_SIE_EP 0xFE65 -#define REG_NORMAL_SIE_PHY 0xFE68 -#define REG_NORMAL_SIE_MAC_ADDR 0xFE70 -#define REG_NORMAL_SIE_STRING 0xFE80 - -#define CR9346 REG_9346CR -#define MSR (REG_CR + 2) -#define ISR REG_HISR -#define TSFR REG_TSFTR - -#define MACIDR0 REG_MACID -#define MACIDR4 (REG_MACID + 4) - -#define PBP REG_PBP - -#define IDR0 MACIDR0 -#define IDR4 MACIDR4 - -#define UNUSED_REGISTER 0x1BF -#define DCAM UNUSED_REGISTER -#define PSR UNUSED_REGISTER -#define BBADDR UNUSED_REGISTER -#define PHYDATAR UNUSED_REGISTER - -#define INVALID_BBRF_VALUE 0x12345678 - -#define MAX_MSS_DENSITY_2T 0x13 -#define MAX_MSS_DENSITY_1T 0x0A - -#define CMDEEPROM_EN BIT(5) -#define CMDEEPROM_SEL BIT(4) -#define CMD9346CR_9356SEL BIT(4) -#define AUTOLOAD_EEPROM (CMDEEPROM_EN|CMDEEPROM_SEL) -#define AUTOLOAD_EFUSE CMDEEPROM_EN - -#define GPIOSEL_GPIO 0 -#define GPIOSEL_ENBT BIT(5) - -#define GPIO_IN REG_GPIO_PIN_CTRL -#define GPIO_OUT (REG_GPIO_PIN_CTRL+1) -#define GPIO_IO_SEL (REG_GPIO_PIN_CTRL+2) -#define GPIO_MOD (REG_GPIO_PIN_CTRL+3) - -#define MSR_NOLINK 0x00 -#define MSR_ADHOC 0x01 -#define MSR_INFRA 0x02 -#define MSR_AP 0x03 - -#define RRSR_RSC_OFFSET 21 -#define RRSR_SHORT_OFFSET 23 -#define RRSR_RSC_BW_40M 0x600000 -#define RRSR_RSC_UPSUBCHNL 0x400000 -#define RRSR_RSC_LOWSUBCHNL 0x200000 -#define RRSR_SHORT 0x800000 -#define RRSR_1M BIT(0) -#define RRSR_2M BIT(1) -#define RRSR_5_5M BIT(2) -#define RRSR_11M BIT(3) -#define RRSR_6M BIT(4) -#define RRSR_9M BIT(5) -#define RRSR_12M BIT(6) -#define RRSR_18M BIT(7) -#define RRSR_24M BIT(8) -#define RRSR_36M BIT(9) -#define RRSR_48M BIT(10) -#define RRSR_54M BIT(11) -#define RRSR_MCS0 BIT(12) -#define RRSR_MCS1 BIT(13) -#define RRSR_MCS2 BIT(14) -#define RRSR_MCS3 BIT(15) -#define RRSR_MCS4 BIT(16) -#define RRSR_MCS5 BIT(17) -#define RRSR_MCS6 BIT(18) -#define RRSR_MCS7 BIT(19) -#define BRSR_ACKSHORTPMB BIT(23) - -#define RATR_1M 0x00000001 -#define RATR_2M 0x00000002 -#define RATR_55M 0x00000004 -#define RATR_11M 0x00000008 -#define RATR_6M 0x00000010 -#define RATR_9M 0x00000020 -#define RATR_12M 0x00000040 -#define RATR_18M 0x00000080 -#define RATR_24M 0x00000100 -#define RATR_36M 0x00000200 -#define RATR_48M 0x00000400 -#define RATR_54M 0x00000800 -#define RATR_MCS0 0x00001000 -#define RATR_MCS1 0x00002000 -#define RATR_MCS2 0x00004000 -#define RATR_MCS3 0x00008000 -#define RATR_MCS4 0x00010000 -#define RATR_MCS5 0x00020000 -#define RATR_MCS6 0x00040000 -#define RATR_MCS7 0x00080000 -#define RATR_MCS8 0x00100000 -#define RATR_MCS9 0x00200000 -#define RATR_MCS10 0x00400000 -#define RATR_MCS11 0x00800000 -#define RATR_MCS12 0x01000000 -#define RATR_MCS13 0x02000000 -#define RATR_MCS14 0x04000000 -#define RATR_MCS15 0x08000000 - -#define RATE_ALL_CCK (RATR_1M | RATR_2M | RATR_55M | RATR_11M) -#define RATE_ALL_OFDM_AG (RATR_6M | RATR_9M | RATR_12M | RATR_18M |\ - RATR_24M | RATR_36M | RATR_48M | RATR_54M) -#define RATE_ALL_OFDM_1SS (RATR_MCS0 | RATR_MCS1 | RATR_MCS2 |\ - RATR_MCS3 | RATR_MCS4 | RATR_MCS5 |\ - RATR_MCS6 | RATR_MCS7) -#define RATE_ALL_OFDM_2SS (RATR_MCS8 | RATR_MCS9 | RATR_MCS10 |\ - RATR_MCS11 | RATR_MCS12 | RATR_MCS13 |\ - RATR_MCS14 | RATR_MCS15) - -#define BW_OPMODE_20MHZ BIT(2) -#define BW_OPMODE_5G BIT(1) -#define BW_OPMODE_11J BIT(0) - -#define CAM_VALID BIT(15) -#define CAM_NOTVALID 0x0000 -#define CAM_USEDK BIT(5) - -#define CAM_NONE 0x0 -#define CAM_WEP40 0x01 -#define CAM_TKIP 0x02 -#define CAM_AES 0x04 -#define CAM_WEP104 0x05 - -#define TOTAL_CAM_ENTRY 32 -#define HALF_CAM_ENTRY 16 - -#define CAM_WRITE BIT(16) -#define CAM_READ 0x00000000 -#define CAM_POLLINIG BIT(31) - -#define SCR_USEDK 0x01 -#define SCR_TXSEC_ENABLE 0x02 -#define SCR_RXSEC_ENABLE 0x04 - -#define WOW_PMEN BIT(0) -#define WOW_WOMEN BIT(1) -#define WOW_MAGIC BIT(2) -#define WOW_UWF BIT(3) - -#define IMR8190_DISABLED 0x0 -#define IMR_BCNDMAINT6 BIT(31) -#define IMR_BCNDMAINT5 BIT(30) -#define IMR_BCNDMAINT4 BIT(29) -#define IMR_BCNDMAINT3 BIT(28) -#define IMR_BCNDMAINT2 BIT(27) -#define IMR_BCNDMAINT1 BIT(26) -#define IMR_BCNDOK8 BIT(25) -#define IMR_BCNDOK7 BIT(24) -#define IMR_BCNDOK6 BIT(23) -#define IMR_BCNDOK5 BIT(22) -#define IMR_BCNDOK4 BIT(21) -#define IMR_BCNDOK3 BIT(20) -#define IMR_BCNDOK2 BIT(19) -#define IMR_BCNDOK1 BIT(18) -#define IMR_TIMEOUT2 BIT(17) -#define IMR_TIMEOUT1 BIT(16) -#define IMR_TXFOVW BIT(15) -#define IMR_PSTIMEOUT BIT(14) -#define IMR_BCNINT BIT(13) -#define IMR_RXFOVW BIT(12) -#define IMR_RDU BIT(11) -#define IMR_ATIMEND BIT(10) -#define IMR_BDOK BIT(9) -#define IMR_HIGHDOK BIT(8) -#define IMR_TBDOK BIT(7) -#define IMR_MGNTDOK BIT(6) -#define IMR_TBDER BIT(5) -#define IMR_BKDOK BIT(4) -#define IMR_BEDOK BIT(3) -#define IMR_VIDOK BIT(2) -#define IMR_VODOK BIT(1) -#define IMR_ROK BIT(0) - -#define IMR_TXERR BIT(11) -#define IMR_RXERR BIT(10) -#define IMR_CPWM BIT(8) -#define IMR_OCPINT BIT(1) -#define IMR_WLANOFF BIT(0) - -/* 8723E series PCIE Host IMR/ISR bit */ -/* IMR DW0 Bit 0-31 */ -#define PHIMR_TIMEOUT2 BIT(31) -#define PHIMR_TIMEOUT1 BIT(30) -#define PHIMR_PSTIMEOUT BIT(29) -#define PHIMR_GTINT4 BIT(28) -#define PHIMR_GTINT3 BIT(27) -#define PHIMR_TXBCNERR BIT(26) -#define PHIMR_TXBCNOK BIT(25) -#define PHIMR_TSF_BIT32_TOGGLE BIT(24) -#define PHIMR_BCNDMAINT3 BIT(23) -#define PHIMR_BCNDMAINT2 BIT(22) -#define PHIMR_BCNDMAINT1 BIT(21) -#define PHIMR_BCNDMAINT0 BIT(20) -#define PHIMR_BCNDOK3 BIT(19) -#define PHIMR_BCNDOK2 BIT(18) -#define PHIMR_BCNDOK1 BIT(17) -#define PHIMR_BCNDOK0 BIT(16) -#define PHIMR_HSISR_IND_ON BIT(15) -#define PHIMR_BCNDMAINT_E BIT(14) -#define PHIMR_ATIMEND_E BIT(13) -#define PHIMR_ATIM_CTW_END BIT(12) -#define PHIMR_HISRE_IND BIT(11) -#define PHIMR_C2HCMD BIT(10) -#define PHIMR_CPWM2 BIT(9) -#define PHIMR_CPWM BIT(8) -#define PHIMR_HIGHDOK BIT(7) -#define PHIMR_MGNTDOK BIT(6) -#define PHIMR_BKDOK BIT(5) -#define PHIMR_BEDOK BIT(4) -#define PHIMR_VIDOK BIT(3) -#define PHIMR_VODOK BIT(2) -#define PHIMR_RDU BIT(1) -#define PHIMR_ROK BIT(0) - -/* PCIE Host Interrupt Status Extension bit */ -#define PHIMR_BCNDMAINT7 BIT(23) -#define PHIMR_BCNDMAINT6 BIT(22) -#define PHIMR_BCNDMAINT5 BIT(21) -#define PHIMR_BCNDMAINT4 BIT(20) -#define PHIMR_BCNDOK7 BIT(19) -#define PHIMR_BCNDOK6 BIT(18) -#define PHIMR_BCNDOK5 BIT(17) -#define PHIMR_BCNDOK4 BIT(16) -/* bit12-15: RSVD */ -#define PHIMR_TXERR BIT(11) -#define PHIMR_RXERR BIT(10) -#define PHIMR_TXFOVW BIT(9) -#define PHIMR_RXFOVW BIT(8) -/* bit2-7: RSV */ -#define PHIMR_OCPINT BIT(1) - -#define HWSET_MAX_SIZE 256 -#define EFUSE_MAX_SECTION 32 -#define EFUSE_REAL_CONTENT_LEN 512 -#define EFUSE_OOB_PROTECT_BYTES 15 - -#define EEPROM_DEFAULT_TSSI 0x0 -#define EEPROM_DEFAULT_TXPOWERDIFF 0x0 -#define EEPROM_DEFAULT_CRYSTALCAP 0x5 -#define EEPROM_DEFAULT_BOARDTYPE 0x02 -#define EEPROM_DEFAULT_TXPOWER 0x1010 -#define EEPROM_DEFAULT_HT2T_TXPWR 0x10 - -#define EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF 0x3 -#define EEPROM_DEFAULT_THERMALMETER 0x12 -#define EEPROM_DEFAULT_ANTTXPOWERDIFF 0x0 -#define EEPROM_DEFAULT_TXPWDIFF_CRYSTALCAP 0x5 -#define EEPROM_DEFAULT_TXPOWERLEVEL 0x22 -#define EEPROM_DEFAULT_HT40_2SDIFF 0x0 -#define EEPROM_DEFAULT_HT20_DIFF 2 -#define EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF 0x3 -#define EEPROM_DEFAULT_HT40_PWRMAXOFFSET 0 -#define EEPROM_DEFAULT_HT20_PWRMAXOFFSET 0 - - -#define EEPROM_DEFAULT_PID 0x1234 -#define EEPROM_DEFAULT_VID 0x5678 -#define EEPROM_DEFAULT_CUSTOMERID 0xAB -#define EEPROM_DEFAULT_SUBCUSTOMERID 0xCD -#define EEPROM_DEFAULT_VERSION 0 - -#define EEPROM_CHANNEL_PLAN_FCC 0x0 -#define EEPROM_CHANNEL_PLAN_IC 0x1 -#define EEPROM_CHANNEL_PLAN_ETSI 0x2 -#define EEPROM_CHANNEL_PLAN_SPAIN 0x3 -#define EEPROM_CHANNEL_PLAN_FRANCE 0x4 -#define EEPROM_CHANNEL_PLAN_MKK 0x5 -#define EEPROM_CHANNEL_PLAN_MKK1 0x6 -#define EEPROM_CHANNEL_PLAN_ISRAEL 0x7 -#define EEPROM_CHANNEL_PLAN_TELEC 0x8 -#define EEPROM_CHANNEL_PLAN_GLOBAL_DOMAIN 0x9 -#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_13 0xA -#define EEPROM_CHANNEL_PLAN_NCC 0xB -#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80 - -#define EEPROM_CID_DEFAULT 0x0 -#define EEPROM_CID_TOSHIBA 0x4 -#define EEPROM_CID_CCX 0x10 -#define EEPROM_CID_QMI 0x0D -#define EEPROM_CID_WHQL 0xFE - -#define RTL8192_EEPROM_ID 0x8129 - -#define RTL8190_EEPROM_ID 0x8129 -#define EEPROM_HPON 0x02 -#define EEPROM_CLK 0x06 -#define EEPROM_TESTR 0x08 - -#define EEPROM_VID 0x49 -#define EEPROM_DID 0x4B -#define EEPROM_SVID 0x4D -#define EEPROM_SMID 0x4F - -#define EEPROM_MAC_ADDR 0x67 - -#define EEPROM_CCK_TX_PWR_INX 0x5A -#define EEPROM_HT40_1S_TX_PWR_INX 0x60 -#define EEPROM_HT40_2S_TX_PWR_INX_DIFF 0x66 -#define EEPROM_HT20_TX_PWR_INX_DIFF 0x69 -#define EEPROM_OFDM_TX_PWR_INX_DIFF 0x6C -#define EEPROM_HT40_MAX_PWR_OFFSET 0x25 -#define EEPROM_HT20_MAX_PWR_OFFSET 0x22 - -#define EEPROM_THERMAL_METER 0x2a -#define EEPROM_XTAL_K 0x78 -#define EEPROM_RF_OPT1 0x79 -#define EEPROM_RF_OPT2 0x7A -#define EEPROM_RF_OPT3 0x7B -#define EEPROM_RF_OPT4 0x7C -#define EEPROM_CHANNEL_PLAN 0x28 -#define EEPROM_VERSION 0x30 -#define EEPROM_CUSTOMER_ID 0x31 - -#define EEPROM_PWRDIFF 0x54 - -#define EEPROM_TXPOWERCCK 0x10 -#define EEPROM_TXPOWERHT40_1S 0x16 -#define EEPROM_TXPOWERHT40_2SDIFF 0x66 -#define EEPROM_TXPOWERHT20DIFF 0x1C -#define EEPROM_TXPOWER_OFDMDIFF 0x1F - -#define EEPROM_TXPWR_GROUP 0x22 - -#define EEPROM_TSSI_A 0x29 -#define EEPROM_TSSI_B 0x77 - -#define EEPROM_CHANNELPLAN 0x28 - -#define RF_OPTION1 0x2B -#define RF_OPTION2 0x2C -#define RF_OPTION3 0x2D -#define RF_OPTION4 0x2E - -#define STOPBECON BIT(6) -#define STOPHIGHT BIT(5) -#define STOPMGT BIT(4) -#define STOPVO BIT(3) -#define STOPVI BIT(2) -#define STOPBE BIT(1) -#define STOPBK BIT(0) - -#define RCR_APPFCS BIT(31) -#define RCR_APP_MIC BIT(30) -#define RCR_APP_ICV BIT(29) -#define RCR_APP_PHYST_RXFF BIT(28) -#define RCR_APP_BA_SSN BIT(27) -#define RCR_ENMBID BIT(24) -#define RCR_LSIGEN BIT(23) -#define RCR_MFBEN BIT(22) -#define RCR_HTC_LOC_CTRL BIT(14) -#define RCR_AMF BIT(13) -#define RCR_ACF BIT(12) -#define RCR_ADF BIT(11) -#define RCR_AICV BIT(9) -#define RCR_ACRC32 BIT(8) -#define RCR_CBSSID_BCN BIT(7) -#define RCR_CBSSID_DATA BIT(6) -#define RCR_CBSSID RCR_CBSSID_DATA -#define RCR_APWRMGT BIT(5) -#define RCR_ADD3 BIT(4) -#define RCR_AB BIT(3) -#define RCR_AM BIT(2) -#define RCR_APM BIT(1) -#define RCR_AAP BIT(0) -#define RCR_MXDMA_OFFSET 8 -#define RCR_FIFO_OFFSET 13 - -#define RSV_CTRL 0x001C -#define RD_CTRL 0x0524 - -#define REG_USB_INFO 0xFE17 -#define REG_USB_SPECIAL_OPTION 0xFE55 -#define REG_USB_DMA_AGG_TO 0xFE5B -#define REG_USB_AGG_TO 0xFE5C -#define REG_USB_AGG_TH 0xFE5D - -#define REG_USB_VID 0xFE60 -#define REG_USB_PID 0xFE62 -#define REG_USB_OPTIONAL 0xFE64 -#define REG_USB_CHIRP_K 0xFE65 -#define REG_USB_PHY 0xFE66 -#define REG_USB_MAC_ADDR 0xFE70 -#define REG_USB_HRPWM 0xFE58 -#define REG_USB_HCPWM 0xFE57 - -#define SW18_FPWM BIT(3) - -#define ISO_MD2PP BIT(0) -#define ISO_UA2USB BIT(1) -#define ISO_UD2CORE BIT(2) -#define ISO_PA2PCIE BIT(3) -#define ISO_PD2CORE BIT(4) -#define ISO_IP2MAC BIT(5) -#define ISO_DIOP BIT(6) -#define ISO_DIOE BIT(7) -#define ISO_EB2CORE BIT(8) -#define ISO_DIOR BIT(9) - -#define PWC_EV25V BIT(14) -#define PWC_EV12V BIT(15) - -#define FEN_BBRSTB BIT(0) -#define FEN_BB_GLB_RSTn BIT(1) -#define FEN_USBA BIT(2) -#define FEN_UPLL BIT(3) -#define FEN_USBD BIT(4) -#define FEN_DIO_PCIE BIT(5) -#define FEN_PCIEA BIT(6) -#define FEN_PPLL BIT(7) -#define FEN_PCIED BIT(8) -#define FEN_DIOE BIT(9) -#define FEN_CPUEN BIT(10) -#define FEN_DCORE BIT(11) -#define FEN_ELDR BIT(12) -#define FEN_DIO_RF BIT(13) -#define FEN_HWPDN BIT(14) -#define FEN_MREGEN BIT(15) - -#define PFM_LDALL BIT(0) -#define PFM_ALDN BIT(1) -#define PFM_LDKP BIT(2) -#define PFM_WOWL BIT(3) -#define EnPDN BIT(4) -#define PDN_PL BIT(5) -#define APFM_ONMAC BIT(8) -#define APFM_OFF BIT(9) -#define APFM_RSM BIT(10) -#define AFSM_HSUS BIT(11) -#define AFSM_PCIE BIT(12) -#define APDM_MAC BIT(13) -#define APDM_HOST BIT(14) -#define APDM_HPDN BIT(15) -#define RDY_MACON BIT(16) -#define SUS_HOST BIT(17) -#define ROP_ALD BIT(20) -#define ROP_PWR BIT(21) -#define ROP_SPS BIT(22) -#define SOP_MRST BIT(25) -#define SOP_FUSE BIT(26) -#define SOP_ABG BIT(27) -#define SOP_AMB BIT(28) -#define SOP_RCK BIT(29) -#define SOP_A8M BIT(30) -#define XOP_BTCK BIT(31) - -#define ANAD16V_EN BIT(0) -#define ANA8M BIT(1) -#define MACSLP BIT(4) -#define LOADER_CLK_EN BIT(5) -#define _80M_SSC_DIS BIT(7) -#define _80M_SSC_EN_HO BIT(8) -#define PHY_SSC_RSTB BIT(9) -#define SEC_CLK_EN BIT(10) -#define MAC_CLK_EN BIT(11) -#define SYS_CLK_EN BIT(12) -#define RING_CLK_EN BIT(13) - -#define BOOT_FROM_EEPROM BIT(4) -#define EEPROM_EN BIT(5) - -#define AFE_BGEN BIT(0) -#define AFE_MBEN BIT(1) -#define MAC_ID_EN BIT(7) - -#define WLOCK_ALL BIT(0) -#define WLOCK_00 BIT(1) -#define WLOCK_04 BIT(2) -#define WLOCK_08 BIT(3) -#define WLOCK_40 BIT(4) -#define R_DIS_PRST_0 BIT(5) -#define R_DIS_PRST_1 BIT(6) -#define LOCK_ALL_EN BIT(7) - -#define RF_EN BIT(0) -#define RF_RSTB BIT(1) -#define RF_SDMRSTB BIT(2) - -#define LDA15_EN BIT(0) -#define LDA15_STBY BIT(1) -#define LDA15_OBUF BIT(2) -#define LDA15_REG_VOS BIT(3) -#define _LDA15_VOADJ(x) (((x) & 0x7) << 4) - -#define LDV12_EN BIT(0) -#define LDV12_SDBY BIT(1) -#define LPLDO_HSM BIT(2) -#define LPLDO_LSM_DIS BIT(3) -#define _LDV12_VADJ(x) (((x) & 0xF) << 4) - -#define XTAL_EN BIT(0) -#define XTAL_BSEL BIT(1) -#define _XTAL_BOSC(x) (((x) & 0x3) << 2) -#define _XTAL_CADJ(x) (((x) & 0xF) << 4) -#define XTAL_GATE_USB BIT(8) -#define _XTAL_USB_DRV(x) (((x) & 0x3) << 9) -#define XTAL_GATE_AFE BIT(11) -#define _XTAL_AFE_DRV(x) (((x) & 0x3) << 12) -#define XTAL_RF_GATE BIT(14) -#define _XTAL_RF_DRV(x) (((x) & 0x3) << 15) -#define XTAL_GATE_DIG BIT(17) -#define _XTAL_DIG_DRV(x) (((x) & 0x3) << 18) -#define XTAL_BT_GATE BIT(20) -#define _XTAL_BT_DRV(x) (((x) & 0x3) << 21) -#define _XTAL_GPIO(x) (((x) & 0x7) << 23) - -#define CKDLY_AFE BIT(26) -#define CKDLY_USB BIT(27) -#define CKDLY_DIG BIT(28) -#define CKDLY_BT BIT(29) - -#define APLL_EN BIT(0) -#define APLL_320_EN BIT(1) -#define APLL_FREF_SEL BIT(2) -#define APLL_EDGE_SEL BIT(3) -#define APLL_WDOGB BIT(4) -#define APLL_LPFEN BIT(5) - -#define APLL_REF_CLK_13MHZ 0x1 -#define APLL_REF_CLK_19_2MHZ 0x2 -#define APLL_REF_CLK_20MHZ 0x3 -#define APLL_REF_CLK_25MHZ 0x4 -#define APLL_REF_CLK_26MHZ 0x5 -#define APLL_REF_CLK_38_4MHZ 0x6 -#define APLL_REF_CLK_40MHZ 0x7 - -#define APLL_320EN BIT(14) -#define APLL_80EN BIT(15) -#define APLL_1MEN BIT(24) - -#define ALD_EN BIT(18) -#define EF_PD BIT(19) -#define EF_FLAG BIT(31) - -#define EF_TRPT BIT(7) -#define LDOE25_EN BIT(31) - -#define RSM_EN BIT(0) -#define Timer_EN BIT(4) - -#define TRSW0EN BIT(2) -#define TRSW1EN BIT(3) -#define EROM_EN BIT(4) -#define EnBT BIT(5) -#define EnUart BIT(8) -#define Uart_910 BIT(9) -#define EnPMAC BIT(10) -#define SIC_SWRST BIT(11) -#define EnSIC BIT(12) -#define SIC_23 BIT(13) -#define EnHDP BIT(14) -#define SIC_LBK BIT(15) - -#define LED0PL BIT(4) -#define LED1PL BIT(12) -#define LED0DIS BIT(7) - -#define MCUFWDL_EN BIT(0) -#define MCUFWDL_RDY BIT(1) -#define FWDL_ChkSum_rpt BIT(2) -#define MACINI_RDY BIT(3) -#define BBINI_RDY BIT(4) -#define RFINI_RDY BIT(5) -#define WINTINI_RDY BIT(6) -#define CPRST BIT(23) - -#define XCLK_VLD BIT(0) -#define ACLK_VLD BIT(1) -#define UCLK_VLD BIT(2) -#define PCLK_VLD BIT(3) -#define PCIRSTB BIT(4) -#define V15_VLD BIT(5) -#define TRP_B15V_EN BIT(7) -#define SIC_IDLE BIT(8) -#define BD_MAC2 BIT(9) -#define BD_MAC1 BIT(10) -#define IC_MACPHY_MODE BIT(11) -#define BT_FUNC BIT(16) -#define VENDOR_ID BIT(19) -#define PAD_HWPD_IDN BIT(22) -#define TRP_VAUX_EN BIT(23) -#define TRP_BT_EN BIT(24) -#define BD_PKG_SEL BIT(25) -#define BD_HCI_SEL BIT(26) -#define TYPE_ID BIT(27) - -#define CHIP_VER_RTL_MASK 0xF000 -#define CHIP_VER_RTL_SHIFT 12 - -#define REG_LBMODE (REG_CR + 3) - -#define HCI_TXDMA_EN BIT(0) -#define HCI_RXDMA_EN BIT(1) -#define TXDMA_EN BIT(2) -#define RXDMA_EN BIT(3) -#define PROTOCOL_EN BIT(4) -#define SCHEDULE_EN BIT(5) -#define MACTXEN BIT(6) -#define MACRXEN BIT(7) -#define ENSWBCN BIT(8) -#define ENSEC BIT(9) - -#define _NETTYPE(x) (((x) & 0x3) << 16) -#define MASK_NETTYPE 0x30000 -#define NT_NO_LINK 0x0 -#define NT_LINK_AD_HOC 0x1 -#define NT_LINK_AP 0x2 -#define NT_AS_AP 0x3 - -#define _LBMODE(x) (((x) & 0xF) << 24) -#define MASK_LBMODE 0xF000000 -#define LOOPBACK_NORMAL 0x0 -#define LOOPBACK_IMMEDIATELY 0xB -#define LOOPBACK_MAC_DELAY 0x3 -#define LOOPBACK_PHY 0x1 -#define LOOPBACK_DMA 0x7 - -#define GET_RX_PAGE_SIZE(value) ((value) & 0xF) -#define GET_TX_PAGE_SIZE(value) (((value) & 0xF0) >> 4) -#define _PSRX_MASK 0xF -#define _PSTX_MASK 0xF0 -#define _PSRX(x) (x) -#define _PSTX(x) ((x) << 4) - -#define PBP_64 0x0 -#define PBP_128 0x1 -#define PBP_256 0x2 -#define PBP_512 0x3 -#define PBP_1024 0x4 - -#define RXDMA_ARBBW_EN BIT(0) -#define RXSHFT_EN BIT(1) -#define RXDMA_AGG_EN BIT(2) -#define QS_VO_QUEUE BIT(8) -#define QS_VI_QUEUE BIT(9) -#define QS_BE_QUEUE BIT(10) -#define QS_BK_QUEUE BIT(11) -#define QS_MANAGER_QUEUE BIT(12) -#define QS_HIGH_QUEUE BIT(13) - -#define HQSEL_VOQ BIT(0) -#define HQSEL_VIQ BIT(1) -#define HQSEL_BEQ BIT(2) -#define HQSEL_BKQ BIT(3) -#define HQSEL_MGTQ BIT(4) -#define HQSEL_HIQ BIT(5) - -#define _TXDMA_HIQ_MAP(x) (((x)&0x3) << 14) -#define _TXDMA_MGQ_MAP(x) (((x)&0x3) << 12) -#define _TXDMA_BKQ_MAP(x) (((x)&0x3) << 10) -#define _TXDMA_BEQ_MAP(x) (((x)&0x3) << 8) -#define _TXDMA_VIQ_MAP(x) (((x)&0x3) << 6) -#define _TXDMA_VOQ_MAP(x) (((x)&0x3) << 4) - -#define QUEUE_LOW 1 -#define QUEUE_NORMAL 2 -#define QUEUE_HIGH 3 - -#define _LLT_NO_ACTIVE 0x0 -#define _LLT_WRITE_ACCESS 0x1 -#define _LLT_READ_ACCESS 0x2 - -#define _LLT_INIT_DATA(x) ((x) & 0xFF) -#define _LLT_INIT_ADDR(x) (((x) & 0xFF) << 8) -#define _LLT_OP(x) (((x) & 0x3) << 30) -#define _LLT_OP_VALUE(x) (((x) >> 30) & 0x3) - -#define BB_WRITE_READ_MASK (BIT(31) | BIT(30)) -#define BB_WRITE_EN BIT(30) -#define BB_READ_EN BIT(31) - -#define _HPQ(x) ((x) & 0xFF) -#define _LPQ(x) (((x) & 0xFF) << 8) -#define _PUBQ(x) (((x) & 0xFF) << 16) -#define _NPQ(x) ((x) & 0xFF) - -#define HPQ_PUBLIC_DIS BIT(24) -#define LPQ_PUBLIC_DIS BIT(25) -#define LD_RQPN BIT(31) - -#define BCN_VALID BIT(16) -#define BCN_HEAD(x) (((x) & 0xFF) << 8) -#define BCN_HEAD_MASK 0xFF00 - -#define BLK_DESC_NUM_SHIFT 4 -#define BLK_DESC_NUM_MASK 0xF - -#define DROP_DATA_EN BIT(9) - -#define EN_AMPDU_RTY_NEW BIT(7) - -#define _INIRTSMCS_SEL(x) ((x) & 0x3F) - -#define _SPEC_SIFS_CCK(x) ((x) & 0xFF) -#define _SPEC_SIFS_OFDM(x) (((x) & 0xFF) << 8) - -#define RATE_REG_BITMAP_ALL 0xFFFFF - -#define _RRSC_BITMAP(x) ((x) & 0xFFFFF) - -#define _RRSR_RSC(x) (((x) & 0x3) << 21) -#define RRSR_RSC_RESERVED 0x0 -#define RRSR_RSC_UPPER_SUBCHANNEL 0x1 -#define RRSR_RSC_LOWER_SUBCHANNEL 0x2 -#define RRSR_RSC_DUPLICATE_MODE 0x3 - -#define USE_SHORT_G1 BIT(20) - -#define _AGGLMT_MCS0(x) ((x) & 0xF) -#define _AGGLMT_MCS1(x) (((x) & 0xF) << 4) -#define _AGGLMT_MCS2(x) (((x) & 0xF) << 8) -#define _AGGLMT_MCS3(x) (((x) & 0xF) << 12) -#define _AGGLMT_MCS4(x) (((x) & 0xF) << 16) -#define _AGGLMT_MCS5(x) (((x) & 0xF) << 20) -#define _AGGLMT_MCS6(x) (((x) & 0xF) << 24) -#define _AGGLMT_MCS7(x) (((x) & 0xF) << 28) - -#define RETRY_LIMIT_SHORT_SHIFT 8 -#define RETRY_LIMIT_LONG_SHIFT 0 - -#define _DARF_RC1(x) ((x) & 0x1F) -#define _DARF_RC2(x) (((x) & 0x1F) << 8) -#define _DARF_RC3(x) (((x) & 0x1F) << 16) -#define _DARF_RC4(x) (((x) & 0x1F) << 24) -#define _DARF_RC5(x) ((x) & 0x1F) -#define _DARF_RC6(x) (((x) & 0x1F) << 8) -#define _DARF_RC7(x) (((x) & 0x1F) << 16) -#define _DARF_RC8(x) (((x) & 0x1F) << 24) - -#define _RARF_RC1(x) ((x) & 0x1F) -#define _RARF_RC2(x) (((x) & 0x1F) << 8) -#define _RARF_RC3(x) (((x) & 0x1F) << 16) -#define _RARF_RC4(x) (((x) & 0x1F) << 24) -#define _RARF_RC5(x) ((x) & 0x1F) -#define _RARF_RC6(x) (((x) & 0x1F) << 8) -#define _RARF_RC7(x) (((x) & 0x1F) << 16) -#define _RARF_RC8(x) (((x) & 0x1F) << 24) - -#define AC_PARAM_TXOP_LIMIT_OFFSET 16 -#define AC_PARAM_ECW_MAX_OFFSET 12 -#define AC_PARAM_ECW_MIN_OFFSET 8 -#define AC_PARAM_AIFS_OFFSET 0 - -#define _AIFS(x) (x) -#define _ECW_MAX_MIN(x) ((x) << 8) -#define _TXOP_LIMIT(x) ((x) << 16) - -#define _BCNIFS(x) ((x) & 0xFF) -#define _BCNECW(x) ((((x) & 0xF)) << 8) - -#define _LRL(x) ((x) & 0x3F) -#define _SRL(x) (((x) & 0x3F) << 8) - -#define _SIFS_CCK_CTX(x) ((x) & 0xFF) -#define _SIFS_CCK_TRX(x) (((x) & 0xFF) << 8); - -#define _SIFS_OFDM_CTX(x) ((x) & 0xFF) -#define _SIFS_OFDM_TRX(x) (((x) & 0xFF) << 8); - -#define _TBTT_PROHIBIT_HOLD(x) (((x) & 0xFF) << 8) - -#define DIS_EDCA_CNT_DWN BIT(11) - -#define EN_MBSSID BIT(1) -#define EN_TXBCN_RPT BIT(2) -#define EN_BCN_FUNCTION BIT(3) - -#define TSFTR_RST BIT(0) -#define TSFTR1_RST BIT(1) - -#define STOP_BCNQ BIT(6) - -#define DIS_TSF_UDT0_NORMAL_CHIP BIT(4) -#define DIS_TSF_UDT0_TEST_CHIP BIT(5) - -#define AcmHw_HwEn BIT(0) -#define AcmHw_BeqEn BIT(1) -#define AcmHw_ViqEn BIT(2) -#define AcmHw_VoqEn BIT(3) -#define AcmHw_BeqStatus BIT(4) -#define AcmHw_ViqStatus BIT(5) -#define AcmHw_VoqStatus BIT(6) - -#define APSDOFF BIT(6) -#define APSDOFF_STATUS BIT(7) - -#define BW_20MHZ BIT(2) - -#define RATE_BITMAP_ALL 0xFFFFF - -#define RATE_RRSR_CCK_ONLY_1M 0xFFFF1 - -#define TSFRST BIT(0) -#define DIS_GCLK BIT(1) -#define PAD_SEL BIT(2) -#define PWR_ST BIT(6) -#define PWRBIT_OW_EN BIT(7) -#define ACRC BIT(8) -#define CFENDFORM BIT(9) -#define ICV BIT(10) - -#define AAP BIT(0) -#define APM BIT(1) -#define AM BIT(2) -#define AB BIT(3) -#define ADD3 BIT(4) -#define APWRMGT BIT(5) -#define CBSSID BIT(6) -#define CBSSID_DATA BIT(6) -#define CBSSID_BCN BIT(7) -#define ACRC32 BIT(8) -#define AICV BIT(9) -#define ADF BIT(11) -#define ACF BIT(12) -#define AMF BIT(13) -#define HTC_LOC_CTRL BIT(14) -#define UC_DATA_EN BIT(16) -#define BM_DATA_EN BIT(17) -#define MFBEN BIT(22) -#define LSIGEN BIT(23) -#define EnMBID BIT(24) -#define APP_BASSN BIT(27) -#define APP_PHYSTS BIT(28) -#define APP_ICV BIT(29) -#define APP_MIC BIT(30) -#define APP_FCS BIT(31) - -#define _MIN_SPACE(x) ((x) & 0x7) -#define _SHORT_GI_PADDING(x) (((x) & 0x1F) << 3) - -#define RXERR_TYPE_OFDM_PPDU 0 -#define RXERR_TYPE_OFDM_FALSE_ALARM 1 -#define RXERR_TYPE_OFDM_MPDU_OK 2 -#define RXERR_TYPE_OFDM_MPDU_FAIL 3 -#define RXERR_TYPE_CCK_PPDU 4 -#define RXERR_TYPE_CCK_FALSE_ALARM 5 -#define RXERR_TYPE_CCK_MPDU_OK 6 -#define RXERR_TYPE_CCK_MPDU_FAIL 7 -#define RXERR_TYPE_HT_PPDU 8 -#define RXERR_TYPE_HT_FALSE_ALARM 9 -#define RXERR_TYPE_HT_MPDU_TOTAL 10 -#define RXERR_TYPE_HT_MPDU_OK 11 -#define RXERR_TYPE_HT_MPDU_FAIL 12 -#define RXERR_TYPE_RX_FULL_DROP 15 - -#define RXERR_COUNTER_MASK 0xFFFFF -#define RXERR_RPT_RST BIT(27) -#define _RXERR_RPT_SEL(type) ((type) << 28) - -#define SCR_TxUseDK BIT(0) -#define SCR_RxUseDK BIT(1) -#define SCR_TxEncEnable BIT(2) -#define SCR_RxDecEnable BIT(3) -#define SCR_SKByA2 BIT(4) -#define SCR_NoSKMC BIT(5) -#define SCR_TXBCUSEDK BIT(6) -#define SCR_RXBCUSEDK BIT(7) - -#define USB_IS_HIGH_SPEED 0 -#define USB_IS_FULL_SPEED 1 -#define USB_SPEED_MASK BIT(5) - -#define USB_NORMAL_SIE_EP_MASK 0xF -#define USB_NORMAL_SIE_EP_SHIFT 4 - -#define USB_TEST_EP_MASK 0x30 -#define USB_TEST_EP_SHIFT 4 - -#define USB_AGG_EN BIT(3) - -#define MAC_ADDR_LEN 6 -#define LAST_ENTRY_OF_TX_PKT_BUFFER 255 - -#define POLLING_LLT_THRESHOLD 20 -#define POLLING_READY_TIMEOUT_COUNT 1000 - -#define MAX_MSS_DENSITY_2T 0x13 -#define MAX_MSS_DENSITY_1T 0x0A - -#define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6)) -#define EPROM_CMD_CONFIG 0x3 -#define EPROM_CMD_LOAD 1 - -#define HWSET_MAX_SIZE_92S HWSET_MAX_SIZE - -#define HAL_8192C_HW_GPIO_WPS_BIT BIT(2) - -#define RPMAC_RESET 0x100 -#define RPMAC_TXSTART 0x104 -#define RPMAC_TXLEGACYSIG 0x108 -#define RPMAC_TXHTSIG1 0x10c -#define RPMAC_TXHTSIG2 0x110 -#define RPMAC_PHYDEBUG 0x114 -#define RPMAC_TXPACKETNUM 0x118 -#define RPMAC_TXIDLE 0x11c -#define RPMAC_TXMACHEADER0 0x120 -#define RPMAC_TXMACHEADER1 0x124 -#define RPMAC_TXMACHEADER2 0x128 -#define RPMAC_TXMACHEADER3 0x12c -#define RPMAC_TXMACHEADER4 0x130 -#define RPMAC_TXMACHEADER5 0x134 -#define RPMAC_TXDADATYPE 0x138 -#define RPMAC_TXRANDOMSEED 0x13c -#define RPMAC_CCKPLCPPREAMBLE 0x140 -#define RPMAC_CCKPLCPHEADER 0x144 -#define RPMAC_CCKCRC16 0x148 -#define RPMAC_OFDMRXCRC32OK 0x170 -#define RPMAC_OFDMRXCRC32Er 0x174 -#define RPMAC_OFDMRXPARITYER 0x178 -#define RPMAC_OFDMRXCRC8ER 0x17c -#define RPMAC_CCKCRXRC16ER 0x180 -#define RPMAC_CCKCRXRC32ER 0x184 -#define RPMAC_CCKCRXRC32OK 0x188 -#define RPMAC_TXSTATUS 0x18c - -#define RFPGA0_RFMOD 0x800 - -#define RFPGA0_TXINFO 0x804 -#define RFPGA0_PSDFUNCTION 0x808 - -#define RFPGA0_TXGAINSTAGE 0x80c - -#define RFPGA0_RFTIMING1 0x810 -#define RFPGA0_RFTIMING2 0x814 - -#define RFPGA0_XA_HSSIPARAMETER1 0x820 -#define RFPGA0_XA_HSSIPARAMETER2 0x824 -#define RFPGA0_XB_HSSIPARAMETER1 0x828 -#define RFPGA0_XB_HSSIPARAMETER2 0x82c - -#define RFPGA0_XA_LSSIPARAMETER 0x840 -#define RFPGA0_XB_LSSIPARAMETER 0x844 - -#define RFPGA0_RFWAKEUPPARAMETER 0x850 -#define RFPGA0_RFSLEEPUPPARAMETER 0x854 - -#define RFPGA0_XAB_SWITCHCONTROL 0x858 -#define RFPGA0_XCD_SWITCHCONTROL 0x85c - -#define RFPGA0_XA_RFINTERFACEOE 0x860 -#define RFPGA0_XB_RFINTERFACEOE 0x864 - -#define RFPGA0_XAB_RFINTERFACESW 0x870 -#define RFPGA0_XCD_RFINTERFACESW 0x874 - -#define rFPGA0_XAB_RFPARAMETER 0x878 -#define rFPGA0_XCD_RFPARAMETER 0x87c - -#define RFPGA0_ANALOGPARAMETER1 0x880 -#define RFPGA0_ANALOGPARAMETER2 0x884 -#define RFPGA0_ANALOGPARAMETER3 0x888 -#define RFPGA0_ANALOGPARAMETER4 0x88c - -#define RFPGA0_XA_LSSIREADBACK 0x8a0 -#define RFPGA0_XB_LSSIREADBACK 0x8a4 -#define RFPGA0_XC_LSSIREADBACK 0x8a8 -#define RFPGA0_XD_LSSIREADBACK 0x8ac - -#define RFPGA0_PSDREPORT 0x8b4 -#define TRANSCEIVEA_HSPI_READBACK 0x8b8 -#define TRANSCEIVEB_HSPI_READBACK 0x8bc -#define RFPGA0_XAB_RFINTERFACERB 0x8e0 -#define RFPGA0_XCD_RFINTERFACERB 0x8e4 - -#define RFPGA1_RFMOD 0x900 - -#define RFPGA1_TXBLOCK 0x904 -#define RFPGA1_DEBUGSELECT 0x908 -#define RFPGA1_TXINFO 0x90c - -#define RCCK0_SYSTEM 0xa00 - -#define RCCK0_AFESETTING 0xa04 -#define RCCK0_CCA 0xa08 - -#define RCCK0_RXAGC1 0xa0c -#define RCCK0_RXAGC2 0xa10 - -#define RCCK0_RXHP 0xa14 - -#define RCCK0_DSPPARAMETER1 0xa18 -#define RCCK0_DSPPARAMETER2 0xa1c - -#define RCCK0_TXFILTER1 0xa20 -#define RCCK0_TXFILTER2 0xa24 -#define RCCK0_DEBUGPORT 0xa28 -#define RCCK0_FALSEALARMREPORT 0xa2c -#define RCCK0_TRSSIREPORT 0xa50 -#define RCCK0_RXREPORT 0xa54 -#define RCCK0_FACOUNTERLOWER 0xa5c -#define RCCK0_FACOUNTERUPPER 0xa58 - -#define ROFDM0_LSTF 0xc00 - -#define ROFDM0_TRXPATHENABLE 0xc04 -#define ROFDM0_TRMUXPAR 0xc08 -#define ROFDM0_TRSWISOLATION 0xc0c - -#define ROFDM0_XARXAFE 0xc10 -#define ROFDM0_XARXIQIMBALANCE 0xc14 -#define ROFDM0_XBRXAFE 0xc18 -#define ROFDM0_XBRXIQIMBALANCE 0xc1c -#define ROFDM0_XCRXAFE 0xc20 -#define ROFDM0_XCRXIQIMBANLANCE 0xc24 -#define ROFDM0_XDRXAFE 0xc28 -#define ROFDM0_XDRXIQIMBALANCE 0xc2c - -#define ROFDM0_RXDETECTOR1 0xc30 -#define ROFDM0_RXDETECTOR2 0xc34 -#define ROFDM0_RXDETECTOR3 0xc38 -#define ROFDM0_RXDETECTOR4 0xc3c - -#define ROFDM0_RXDSP 0xc40 -#define ROFDM0_CFOANDDAGC 0xc44 -#define ROFDM0_CCADROPTHRESHOLD 0xc48 -#define ROFDM0_ECCATHRESHOLD 0xc4c - -#define ROFDM0_XAAGCCORE1 0xc50 -#define ROFDM0_XAAGCCORE2 0xc54 -#define ROFDM0_XBAGCCORE1 0xc58 -#define ROFDM0_XBAGCCORE2 0xc5c -#define ROFDM0_XCAGCCORE1 0xc60 -#define ROFDM0_XCAGCCORE2 0xc64 -#define ROFDM0_XDAGCCORE1 0xc68 -#define ROFDM0_XDAGCCORE2 0xc6c - -#define ROFDM0_AGCPARAMETER1 0xc70 -#define ROFDM0_AGCPARAMETER2 0xc74 -#define ROFDM0_AGCRSSITABLE 0xc78 -#define ROFDM0_HTSTFAGC 0xc7c - -#define ROFDM0_XATXIQIMBALANCE 0xc80 -#define ROFDM0_XATXAFE 0xc84 -#define ROFDM0_XBTXIQIMBALANCE 0xc88 -#define ROFDM0_XBTXAFE 0xc8c -#define ROFDM0_XCTXIQIMBALANCE 0xc90 -#define ROFDM0_XCTXAFE 0xc94 -#define ROFDM0_XDTXIQIMBALANCE 0xc98 -#define ROFDM0_XDTXAFE 0xc9c - -#define ROFDM0_RXIQEXTANTA 0xca0 - -#define ROFDM0_RXHPPARAMETER 0xce0 -#define ROFDM0_TXPSEUDONOISEWGT 0xce4 -#define ROFDM0_FRAMESYNC 0xcf0 -#define ROFDM0_DFSREPORT 0xcf4 -#define ROFDM0_TXCOEFF1 0xca4 -#define ROFDM0_TXCOEFF2 0xca8 -#define ROFDM0_TXCOEFF3 0xcac -#define ROFDM0_TXCOEFF4 0xcb0 -#define ROFDM0_TXCOEFF5 0xcb4 -#define ROFDM0_TXCOEFF6 0xcb8 - -#define ROFDM1_LSTF 0xd00 -#define ROFDM1_TRXPATHENABLE 0xd04 - -#define ROFDM1_CF0 0xd08 -#define ROFDM1_CSI1 0xd10 -#define ROFDM1_SBD 0xd14 -#define ROFDM1_CSI2 0xd18 -#define ROFDM1_CFOTRACKING 0xd2c -#define ROFDM1_TRXMESAURE1 0xd34 -#define ROFDM1_INTFDET 0xd3c -#define ROFDM1_PSEUDONOISESTATEAB 0xd50 -#define ROFDM1_PSEUDONOISESTATECD 0xd54 -#define ROFDM1_RXPSEUDONOISEWGT 0xd58 - -#define ROFDM_PHYCOUNTER1 0xda0 -#define ROFDM_PHYCOUNTER2 0xda4 -#define ROFDM_PHYCOUNTER3 0xda8 - -#define ROFDM_SHORTCFOAB 0xdac -#define ROFDM_SHORTCFOCD 0xdb0 -#define ROFDM_LONGCFOAB 0xdb4 -#define ROFDM_LONGCFOCD 0xdb8 -#define ROFDM_TAILCF0AB 0xdbc -#define ROFDM_TAILCF0CD 0xdc0 -#define ROFDM_PWMEASURE1 0xdc4 -#define ROFDM_PWMEASURE2 0xdc8 -#define ROFDM_BWREPORT 0xdcc -#define ROFDM_AGCREPORT 0xdd0 -#define ROFDM_RXSNR 0xdd4 -#define ROFDM_RXEVMCSI 0xdd8 -#define ROFDM_SIGREPORT 0xddc - -#define RTXAGC_A_RATE18_06 0xe00 -#define RTXAGC_A_RATE54_24 0xe04 -#define RTXAGC_A_CCK1_MCS32 0xe08 -#define RTXAGC_A_MCS03_MCS00 0xe10 -#define RTXAGC_A_MCS07_MCS04 0xe14 -#define RTXAGC_A_MCS11_MCS08 0xe18 -#define RTXAGC_A_MCS15_MCS12 0xe1c - -#define RTXAGC_B_RATE18_06 0x830 -#define RTXAGC_B_RATE54_24 0x834 -#define RTXAGC_B_CCK1_55_MCS32 0x838 -#define RTXAGC_B_MCS03_MCS00 0x83c -#define RTXAGC_B_MCS07_MCS04 0x848 -#define RTXAGC_B_MCS11_MCS08 0x84c -#define RTXAGC_B_MCS15_MCS12 0x868 -#define RTXAGC_B_CCK11_A_CCK2_11 0x86c - -#define RZEBRA1_HSSIENABLE 0x0 -#define RZEBRA1_TRXENABLE1 0x1 -#define RZEBRA1_TRXENABLE2 0x2 -#define RZEBRA1_AGC 0x4 -#define RZEBRA1_CHARGEPUMP 0x5 -#define RZEBRA1_CHANNEL 0x7 - -#define RZEBRA1_TXGAIN 0x8 -#define RZEBRA1_TXLPF 0x9 -#define RZEBRA1_RXLPF 0xb -#define RZEBRA1_RXHPFCORNER 0xc - -#define RGLOBALCTRL 0 -#define RRTL8256_TXLPF 19 -#define RRTL8256_RXLPF 11 -#define RRTL8258_TXLPF 0x11 -#define RRTL8258_RXLPF 0x13 -#define RRTL8258_RSSILPF 0xa - -#define RF_AC 0x00 - -#define RF_IQADJ_G1 0x01 -#define RF_IQADJ_G2 0x02 -#define RF_POW_TRSW 0x05 - -#define RF_GAIN_RX 0x06 -#define RF_GAIN_TX 0x07 - -#define RF_TXM_IDAC 0x08 -#define RF_BS_IQGEN 0x0F - -#define RF_MODE1 0x10 -#define RF_MODE2 0x11 - -#define RF_RX_AGC_HP 0x12 -#define RF_TX_AGC 0x13 -#define RF_BIAS 0x14 -#define RF_IPA 0x15 -#define RF_POW_ABILITY 0x17 -#define RF_MODE_AG 0x18 -#define RRFCHANNEL 0x18 -#define RF_CHNLBW 0x18 -#define RF_TOP 0x19 - -#define RF_RX_G1 0x1A -#define RF_RX_G2 0x1B - -#define RF_RX_BB2 0x1C -#define RF_RX_BB1 0x1D - -#define RF_RCK1 0x1E -#define RF_RCK2 0x1F - -#define RF_TX_G1 0x20 -#define RF_TX_G2 0x21 -#define RF_TX_G3 0x22 - -#define RF_TX_BB1 0x23 -#define RF_T_METER 0x24 - -#define RF_SYN_G1 0x25 -#define RF_SYN_G2 0x26 -#define RF_SYN_G3 0x27 -#define RF_SYN_G4 0x28 -#define RF_SYN_G5 0x29 -#define RF_SYN_G6 0x2A -#define RF_SYN_G7 0x2B -#define RF_SYN_G8 0x2C - -#define RF_RCK_OS 0x30 -#define RF_TXPA_G1 0x31 -#define RF_TXPA_G2 0x32 -#define RF_TXPA_G3 0x33 - -#define BBBRESETB 0x100 -#define BGLOBALRESETB 0x200 -#define BOFDMTXSTART 0x4 -#define BCCKTXSTART 0x8 -#define BCRC32DEBUG 0x100 -#define BPMACLOOPBACK 0x10 -#define BTXLSIG 0xffffff -#define BOFDMTXRATE 0xf -#define BOFDMTXRESERVED 0x10 -#define BOFDMTXLENGTH 0x1ffe0 -#define BOFDMTXPARITY 0x20000 -#define BTXHTSIG1 0xffffff -#define BTXHTMCSRATE 0x7f -#define BTXHTBW 0x80 -#define BTXHTLENGTH 0xffff00 -#define BTXHTSIG2 0xffffff -#define BTXHTSMOOTHING 0x1 -#define BTXHTSOUNDING 0x2 -#define BTXHTRESERVED 0x4 -#define BTXHTAGGREATION 0x8 -#define BTXHTSTBC 0x30 -#define BTXHTADVANCECODING 0x40 -#define BTXHTSHORTGI 0x80 -#define BTXHTNUMBERHT_LTF 0x300 -#define BTXHTCRC8 0x3fc00 -#define BCOUNTERRESET 0x10000 -#define BNUMOFOFDMTX 0xffff -#define BNUMOFCCKTX 0xffff0000 -#define BTXIDLEINTERVAL 0xffff -#define BOFDMSERVICE 0xffff0000 -#define BTXMACHEADER 0xffffffff -#define BTXDATAINIT 0xff -#define BTXHTMODE 0x100 -#define BTXDATATYPE 0x30000 -#define BTXRANDOMSEED 0xffffffff -#define BCCKTXPREAMBLE 0x1 -#define BCCKTXSFD 0xffff0000 -#define BCCKTXSIG 0xff -#define BCCKTXSERVICE 0xff00 -#define BCCKLENGTHEXT 0x8000 -#define BCCKTXLENGHT 0xffff0000 -#define BCCKTXCRC16 0xffff -#define BCCKTXSTATUS 0x1 -#define BOFDMTXSTATUS 0x2 -#define IS_BB_REG_OFFSET_92S(_Offset) \ - ((_Offset >= 0x800) && (_Offset <= 0xfff)) - -#define BRFMOD 0x1 -#define BJAPANMODE 0x2 -#define BCCKTXSC 0x30 -#define BCCKEN 0x1000000 -#define BOFDMEN 0x2000000 - -#define BOFDMRXADCPHASE 0x10000 -#define BOFDMTXDACPHASE 0x40000 -#define BXATXAGC 0x3f - -#define BXBTXAGC 0xf00 -#define BXCTXAGC 0xf000 -#define BXDTXAGC 0xf0000 - -#define BPASTART 0xf0000000 -#define BTRSTART 0x00f00000 -#define BRFSTART 0x0000f000 -#define BBBSTART 0x000000f0 -#define BBBCCKSTART 0x0000000f -#define BPAEND 0xf -#define BTREND 0x0f000000 -#define BRFEND 0x000f0000 -#define BCCAMASK 0x000000f0 -#define BR2RCCAMASK 0x00000f00 -#define BHSSI_R2TDELAY 0xf8000000 -#define BHSSI_T2RDELAY 0xf80000 -#define BCONTXHSSI 0x400 -#define BIGFROMCCK 0x200 -#define BAGCADDRESS 0x3f -#define BRXHPTX 0x7000 -#define BRXHP2RX 0x38000 -#define BRXHPCCKINI 0xc0000 -#define BAGCTXCODE 0xc00000 -#define BAGCRXCODE 0x300000 - -#define B3WIREDATALENGTH 0x800 -#define B3WIREADDREAALENGTH 0x400 - -#define B3WIRERFPOWERDOWN 0x1 -#define B5GPAPEPOLARITY 0x40000000 -#define B2GPAPEPOLARITY 0x80000000 -#define BRFSW_TXDEFAULTANT 0x3 -#define BRFSW_TXOPTIONANT 0x30 -#define BRFSW_RXDEFAULTANT 0x300 -#define BRFSW_RXOPTIONANT 0x3000 -#define BRFSI_3WIREDATA 0x1 -#define BRFSI_3WIRECLOCK 0x2 -#define BRFSI_3WIRELOAD 0x4 -#define BRFSI_3WIRERW 0x8 -#define BRFSI_3WIRE 0xf - -#define BRFSI_RFENV 0x10 - -#define BRFSI_TRSW 0x20 -#define BRFSI_TRSWB 0x40 -#define BRFSI_ANTSW 0x100 -#define BRFSI_ANTSWB 0x200 -#define BRFSI_PAPE 0x400 -#define BRFSI_PAPE5G 0x800 -#define BBANDSELECT 0x1 -#define BHTSIG2_GI 0x80 -#define BHTSIG2_SMOOTHING 0x01 -#define BHTSIG2_SOUNDING 0x02 -#define BHTSIG2_AGGREATON 0x08 -#define BHTSIG2_STBC 0x30 -#define BHTSIG2_ADVCODING 0x40 -#define BHTSIG2_NUMOFHTLTF 0x300 -#define BHTSIG2_CRC8 0x3fc -#define BHTSIG1_MCS 0x7f -#define BHTSIG1_BANDWIDTH 0x80 -#define BHTSIG1_HTLENGTH 0xffff -#define BLSIG_RATE 0xf -#define BLSIG_RESERVED 0x10 -#define BLSIG_LENGTH 0x1fffe -#define BLSIG_PARITY 0x20 -#define BCCKRXPHASE 0x4 - -#define BLSSIREADADDRESS 0x7f800000 -#define BLSSIREADEDGE 0x80000000 - -#define BLSSIREADBACKDATA 0xfffff - -#define BLSSIREADOKFLAG 0x1000 -#define BCCKSAMPLERATE 0x8 -#define BREGULATOR0STANDBY 0x1 -#define BREGULATORPLLSTANDBY 0x2 -#define BREGULATOR1STANDBY 0x4 -#define BPLLPOWERUP 0x8 -#define BDPLLPOWERUP 0x10 -#define BDA10POWERUP 0x20 -#define BAD7POWERUP 0x200 -#define BDA6POWERUP 0x2000 -#define BXTALPOWERUP 0x4000 -#define B40MDCLKPOWERUP 0x8000 -#define BDA6DEBUGMODE 0x20000 -#define BDA6SWING 0x380000 - -#define BADCLKPHASE 0x4000000 -#define B80MCLKDELAY 0x18000000 -#define BAFEWATCHDOGENABLE 0x20000000 - -#define BXTALCAP01 0xc0000000 -#define BXTALCAP23 0x3 -#define BXTALCAP92X 0x0f000000 -#define BXTALCAP 0x0f000000 - -#define BINTDIFCLKENABLE 0x400 -#define BEXTSIGCLKENABLE 0x800 -#define BBANDGAP_MBIAS_POWERUP 0x10000 -#define BAD11SH_GAIN 0xc0000 -#define BAD11NPUT_RANGE 0x700000 -#define BAD110P_CURRENT 0x3800000 -#define BLPATH_LOOPBACK 0x4000000 -#define BQPATH_LOOPBACK 0x8000000 -#define BAFE_LOOPBACK 0x10000000 -#define BDA10_SWING 0x7e0 -#define BDA10_REVERSE 0x800 -#define BDA_CLK_SOURCE 0x1000 -#define BDA7INPUT_RANGE 0x6000 -#define BDA7_GAIN 0x38000 -#define BDA7OUTPUT_CM_MODE 0x40000 -#define BDA7INPUT_CM_MODE 0x380000 -#define BDA7CURRENT 0xc00000 -#define BREGULATOR_ADJUST 0x7000000 -#define BAD11POWERUP_ATTX 0x1 -#define BDA10PS_ATTX 0x10 -#define BAD11POWERUP_ATRX 0x100 -#define BDA10PS_ATRX 0x1000 -#define BCCKRX_AGC_FORMAT 0x200 -#define BPSDFFT_SAMPLE_POINT 0xc000 -#define BPSD_AVERAGE_NUM 0x3000 -#define BIQPATH_CONTROL 0xc00 -#define BPSD_FREQ 0x3ff -#define BPSD_ANTENNA_PATH 0x30 -#define BPSD_IQ_SWITCH 0x40 -#define BPSD_RX_TRIGGER 0x400000 -#define BPSD_TX_TRIGGER 0x80000000 -#define BPSD_SINE_TONE_SCALE 0x7f000000 -#define BPSD_REPORT 0xffff - -#define BOFDM_TXSC 0x30000000 -#define BCCK_TXON 0x1 -#define BOFDM_TXON 0x2 -#define BDEBUG_PAGE 0xfff -#define BDEBUG_ITEM 0xff -#define BANTL 0x10 -#define BANT_NONHT 0x100 -#define BANT_HT1 0x1000 -#define BANT_HT2 0x10000 -#define BANT_HT1S1 0x100000 -#define BANT_NONHTS1 0x1000000 - -#define BCCK_BBMODE 0x3 -#define BCCK_TXPOWERSAVING 0x80 -#define BCCK_RXPOWERSAVING 0x40 - -#define BCCK_SIDEBAND 0x10 - -#define BCCK_SCRAMBLE 0x8 -#define BCCK_ANTDIVERSITY 0x8000 -#define BCCK_CARRIER_RECOVERY 0x4000 -#define BCCK_TXRATE 0x3000 -#define BCCK_DCCANCEL 0x0800 -#define BCCK_ISICANCEL 0x0400 -#define BCCK_MATCH_FILTER 0x0200 -#define BCCK_EQUALIZER 0x0100 -#define BCCK_PREAMBLE_DETECT 0x800000 -#define BCCK_FAST_FALSECCAi 0x400000 -#define BCCK_CH_ESTSTARTi 0x300000 -#define BCCK_CCA_COUNTi 0x080000 -#define BCCK_CS_LIM 0x070000 -#define BCCK_BIST_MODEi 0x80000000 -#define BCCK_CCAMASK 0x40000000 -#define BCCK_TX_DAC_PHASE 0x4 -#define BCCK_RX_ADC_PHASE 0x20000000 -#define BCCKR_CP_MODE 0x0100 -#define BCCK_TXDC_OFFSET 0xf0 -#define BCCK_RXDC_OFFSET 0xf -#define BCCK_CCA_MODE 0xc000 -#define BCCK_FALSECS_LIM 0x3f00 -#define BCCK_CS_RATIO 0xc00000 -#define BCCK_CORGBIT_SEL 0x300000 -#define BCCK_PD_LIM 0x0f0000 -#define BCCK_NEWCCA 0x80000000 -#define BCCK_RXHP_OF_IG 0x8000 -#define BCCK_RXIG 0x7f00 -#define BCCK_LNA_POLARITY 0x800000 -#define BCCK_RX1ST_BAIN 0x7f0000 -#define BCCK_RF_EXTEND 0x20000000 -#define BCCK_RXAGC_SATLEVEL 0x1f000000 -#define BCCK_RXAGC_SATCOUNT 0xe0 -#define bCCKRxRFSettle 0x1f -#define BCCK_FIXED_RXAGC 0x8000 -#define BCCK_ANTENNA_POLARITY 0x2000 -#define BCCK_TXFILTER_TYPE 0x0c00 -#define BCCK_RXAGC_REPORTTYPE 0x0300 -#define BCCK_RXDAGC_EN 0x80000000 -#define BCCK_RXDAGC_PERIOD 0x20000000 -#define BCCK_RXDAGC_SATLEVEL 0x1f000000 -#define BCCK_TIMING_RECOVERY 0x800000 -#define BCCK_TXC0 0x3f0000 -#define BCCK_TXC1 0x3f000000 -#define BCCK_TXC2 0x3f -#define BCCK_TXC3 0x3f00 -#define BCCK_TXC4 0x3f0000 -#define BCCK_TXC5 0x3f000000 -#define BCCK_TXC6 0x3f -#define BCCK_TXC7 0x3f00 -#define BCCK_DEBUGPORT 0xff0000 -#define BCCK_DAC_DEBUG 0x0f000000 -#define BCCK_FALSEALARM_ENABLE 0x8000 -#define BCCK_FALSEALARM_READ 0x4000 -#define BCCK_TRSSI 0x7f -#define BCCK_RXAGC_REPORT 0xfe -#define BCCK_RXREPORT_ANTSEL 0x80000000 -#define BCCK_RXREPORT_MFOFF 0x40000000 -#define BCCK_RXREPORT_SQLOSS 0x20000000 -#define BCCK_RXREPORT_PKTLOSS 0x10000000 -#define BCCK_RXREPORT_LOCKEDBIT 0x08000000 -#define BCCK_RXREPORT_RATEERROR 0x04000000 -#define BCCK_RXREPORT_RXRATE 0x03000000 -#define BCCK_RXFA_COUNTER_LOWER 0xff -#define BCCK_RXFA_COUNTER_UPPER 0xff000000 -#define BCCK_RXHPAGC_START 0xe000 -#define BCCK_RXHPAGC_FINAL 0x1c00 -#define BCCK_RXFALSEALARM_ENABLE 0x8000 -#define BCCK_FACOUNTER_FREEZE 0x4000 -#define BCCK_TXPATH_SEL 0x10000000 -#define BCCK_DEFAULT_RXPATH 0xc000000 -#define BCCK_OPTION_RXPATH 0x3000000 - -#define BNUM_OFSTF 0x3 -#define BSHIFT_L 0xc0 -#define BGI_TH 0xc -#define BRXPATH_A 0x1 -#define BRXPATH_B 0x2 -#define BRXPATH_C 0x4 -#define BRXPATH_D 0x8 -#define BTXPATH_A 0x1 -#define BTXPATH_B 0x2 -#define BTXPATH_C 0x4 -#define BTXPATH_D 0x8 -#define BTRSSI_FREQ 0x200 -#define BADC_BACKOFF 0x3000 -#define BDFIR_BACKOFF 0xc000 -#define BTRSSI_LATCH_PHASE 0x10000 -#define BRX_LDC_OFFSET 0xff -#define BRX_QDC_OFFSET 0xff00 -#define BRX_DFIR_MODE 0x1800000 -#define BRX_DCNF_TYPE 0xe000000 -#define BRXIQIMB_A 0x3ff -#define BRXIQIMB_B 0xfc00 -#define BRXIQIMB_C 0x3f0000 -#define BRXIQIMB_D 0xffc00000 -#define BDC_DC_NOTCH 0x60000 -#define BRXNB_NOTCH 0x1f000000 -#define BPD_TH 0xf -#define BPD_TH_OPT2 0xc000 -#define BPWED_TH 0x700 -#define BIFMF_WIN_L 0x800 -#define BPD_OPTION 0x1000 -#define BMF_WIN_L 0xe000 -#define BBW_SEARCH_L 0x30000 -#define BWIN_ENH_L 0xc0000 -#define BBW_TH 0x700000 -#define BED_TH2 0x3800000 -#define BBW_OPTION 0x4000000 -#define BRADIO_TH 0x18000000 -#define BWINDOW_L 0xe0000000 -#define BSBD_OPTION 0x1 -#define BFRAME_TH 0x1c -#define BFS_OPTION 0x60 -#define BDC_SLOPE_CHECK 0x80 -#define BFGUARD_COUNTER_DC_L 0xe00 -#define BFRAME_WEIGHT_SHORT 0x7000 -#define BSUB_TUNE 0xe00000 -#define BFRAME_DC_LENGTH 0xe000000 -#define BSBD_START_OFFSET 0x30000000 -#define BFRAME_TH_2 0x7 -#define BFRAME_GI2_TH 0x38 -#define BGI2_SYNC_EN 0x40 -#define BSARCH_SHORT_EARLY 0x300 -#define BSARCH_SHORT_LATE 0xc00 -#define BSARCH_GI2_LATE 0x70000 -#define BCFOANTSUM 0x1 -#define BCFOACC 0x2 -#define BCFOSTARTOFFSET 0xc -#define BCFOLOOPBACK 0x70 -#define BCFOSUMWEIGHT 0x80 -#define BDAGCENABLE 0x10000 -#define BTXIQIMB_A 0x3ff -#define BTXIQIMB_b 0xfc00 -#define BTXIQIMB_C 0x3f0000 -#define BTXIQIMB_D 0xffc00000 -#define BTXIDCOFFSET 0xff -#define BTXIQDCOFFSET 0xff00 -#define BTXDFIRMODE 0x10000 -#define BTXPESUDO_NOISEON 0x4000000 -#define BTXPESUDO_NOISE_A 0xff -#define BTXPESUDO_NOISE_B 0xff00 -#define BTXPESUDO_NOISE_C 0xff0000 -#define BTXPESUDO_NOISE_D 0xff000000 -#define BCCA_DROPOPTION 0x20000 -#define BCCA_DROPTHRES 0xfff00000 -#define BEDCCA_H 0xf -#define BEDCCA_L 0xf0 -#define BLAMBDA_ED 0x300 -#define BRX_INITIALGAIN 0x7f -#define BRX_ANTDIV_EN 0x80 -#define BRX_AGC_ADDRESS_FOR_LNA 0x7f00 -#define BRX_HIGHPOWER_FLOW 0x8000 -#define BRX_AGC_FREEZE_THRES 0xc0000 -#define BRX_FREEZESTEP_AGC1 0x300000 -#define BRX_FREEZESTEP_AGC2 0xc00000 -#define BRX_FREEZESTEP_AGC3 0x3000000 -#define BRX_FREEZESTEP_AGC0 0xc000000 -#define BRXRSSI_CMP_EN 0x10000000 -#define BRXQUICK_AGCEN 0x20000000 -#define BRXAGC_FREEZE_THRES_MODE 0x40000000 -#define BRX_OVERFLOW_CHECKTYPE 0x80000000 -#define BRX_AGCSHIFT 0x7f -#define BTRSW_TRI_ONLY 0x80 -#define BPOWER_THRES 0x300 -#define BRXAGC_EN 0x1 -#define BRXAGC_TOGETHER_EN 0x2 -#define BRXAGC_MIN 0x4 -#define BRXHP_INI 0x7 -#define BRXHP_TRLNA 0x70 -#define BRXHP_RSSI 0x700 -#define BRXHP_BBP1 0x7000 -#define BRXHP_BBP2 0x70000 -#define BRXHP_BBP3 0x700000 -#define BRSSI_H 0x7f0000 -#define BRSSI_GEN 0x7f000000 -#define BRXSETTLE_TRSW 0x7 -#define BRXSETTLE_LNA 0x38 -#define BRXSETTLE_RSSI 0x1c0 -#define BRXSETTLE_BBP 0xe00 -#define BRXSETTLE_RXHP 0x7000 -#define BRXSETTLE_ANTSW_RSSI 0x38000 -#define BRXSETTLE_ANTSW 0xc0000 -#define BRXPROCESS_TIME_DAGC 0x300000 -#define BRXSETTLE_HSSI 0x400000 -#define BRXPROCESS_TIME_BBPPW 0x800000 -#define BRXANTENNA_POWER_SHIFT 0x3000000 -#define BRSSI_TABLE_SELECT 0xc000000 -#define BRXHP_FINAL 0x7000000 -#define BRXHPSETTLE_BBP 0x7 -#define BRXHTSETTLE_HSSI 0x8 -#define BRXHTSETTLE_RXHP 0x70 -#define BRXHTSETTLE_BBPPW 0x80 -#define BRXHTSETTLE_IDLE 0x300 -#define BRXHTSETTLE_RESERVED 0x1c00 -#define BRXHT_RXHP_EN 0x8000 -#define BRXAGC_FREEZE_THRES 0x30000 -#define BRXAGC_TOGETHEREN 0x40000 -#define BRXHTAGC_MIN 0x80000 -#define BRXHTAGC_EN 0x100000 -#define BRXHTDAGC_EN 0x200000 -#define BRXHT_RXHP_BBP 0x1c00000 -#define BRXHT_RXHP_FINAL 0xe0000000 -#define BRXPW_RADIO_TH 0x3 -#define BRXPW_RADIO_EN 0x4 -#define BRXMF_HOLD 0x3800 -#define BRXPD_DELAY_TH1 0x38 -#define BRXPD_DELAY_TH2 0x1c0 -#define BRXPD_DC_COUNT_MAX 0x600 -#define BRXPD_DELAY_TH 0x8000 -#define BRXPROCESS_DELAY 0xf0000 -#define BRXSEARCHRANGE_GI2_EARLY 0x700000 -#define BRXFRAME_FUARD_COUNTER_L 0x3800000 -#define BRXSGI_GUARD_L 0xc000000 -#define BRXSGI_SEARCH_L 0x30000000 -#define BRXSGI_TH 0xc0000000 -#define BDFSCNT0 0xff -#define BDFSCNT1 0xff00 -#define BDFSFLAG 0xf0000 -#define BMF_WEIGHT_SUM 0x300000 -#define BMINIDX_TH 0x7f000000 -#define BDAFORMAT 0x40000 -#define BTXCH_EMU_ENABLE 0x01000000 -#define BTRSW_ISOLATION_A 0x7f -#define BTRSW_ISOLATION_B 0x7f00 -#define BTRSW_ISOLATION_C 0x7f0000 -#define BTRSW_ISOLATION_D 0x7f000000 -#define BEXT_LNA_GAIN 0x7c00 - -#define BSTBC_EN 0x4 -#define BANTENNA_MAPPING 0x10 -#define BNSS 0x20 -#define BCFO_ANTSUM_ID 0x200 -#define BPHY_COUNTER_RESET 0x8000000 -#define BCFO_REPORT_GET 0x4000000 -#define BOFDM_CONTINUE_TX 0x10000000 -#define BOFDM_SINGLE_CARRIER 0x20000000 -#define BOFDM_SINGLE_TONE 0x40000000 -#define BHT_DETECT 0x100 -#define BCFOEN 0x10000 -#define BCFOVALUE 0xfff00000 -#define BSIGTONE_RE 0x3f -#define BSIGTONE_IM 0x7f00 -#define BCOUNTER_CCA 0xffff -#define BCOUNTER_PARITYFAIL 0xffff0000 -#define BCOUNTER_RATEILLEGAL 0xffff -#define BCOUNTER_CRC8FAIL 0xffff0000 -#define BCOUNTER_MCSNOSUPPORT 0xffff -#define BCOUNTER_FASTSYNC 0xffff -#define BSHORTCFO 0xfff -#define BSHORTCFOT_LENGTH 12 -#define BSHORTCFOF_LENGTH 11 -#define BLONGCFO 0x7ff -#define BLONGCFOT_LENGTH 11 -#define BLONGCFOF_LENGTH 11 -#define BTAILCFO 0x1fff -#define BTAILCFOT_LENGTH 13 -#define BTAILCFOF_LENGTH 12 -#define BNOISE_EN_PWDB 0xffff -#define BCC_POWER_DB 0xffff0000 -#define BMOISE_PWDB 0xffff -#define BPOWERMEAST_LENGTH 10 -#define BPOWERMEASF_LENGTH 3 -#define BRX_HT_BW 0x1 -#define BRXSC 0x6 -#define BRX_HT 0x8 -#define BNB_INTF_DET_ON 0x1 -#define BINTF_WIN_LEN_CFG 0x30 -#define BNB_INTF_TH_CFG 0x1c0 -#define BRFGAIN 0x3f -#define BTABLESEL 0x40 -#define BTRSW 0x80 -#define BRXSNR_A 0xff -#define BRXSNR_B 0xff00 -#define BRXSNR_C 0xff0000 -#define BRXSNR_D 0xff000000 -#define BSNR_EVMT_LENGTH 8 -#define BSNR_EVMF_LENGTH 1 -#define BCSI1ST 0xff -#define BCSI2ND 0xff00 -#define BRXEVM1ST 0xff0000 -#define BRXEVM2ND 0xff000000 -#define BSIGEVM 0xff -#define BPWDB 0xff00 -#define BSGIEN 0x10000 - -#define BSFACTOR_QMA1 0xf -#define BSFACTOR_QMA2 0xf0 -#define BSFACTOR_QMA3 0xf00 -#define BSFACTOR_QMA4 0xf000 -#define BSFACTOR_QMA5 0xf0000 -#define BSFACTOR_QMA6 0xf0000 -#define BSFACTOR_QMA7 0xf00000 -#define BSFACTOR_QMA8 0xf000000 -#define BSFACTOR_QMA9 0xf0000000 -#define BCSI_SCHEME 0x100000 - -#define BNOISE_LVL_TOP_SET 0x3 -#define BCHSMOOTH 0x4 -#define BCHSMOOTH_CFG1 0x38 -#define BCHSMOOTH_CFG2 0x1c0 -#define BCHSMOOTH_CFG3 0xe00 -#define BCHSMOOTH_CFG4 0x7000 -#define BMRCMODE 0x800000 -#define BTHEVMCFG 0x7000000 - -#define BLOOP_FIT_TYPE 0x1 -#define BUPD_CFO 0x40 -#define BUPD_CFO_OFFDATA 0x80 -#define BADV_UPD_CFO 0x100 -#define BADV_TIME_CTRL 0x800 -#define BUPD_CLKO 0x1000 -#define BFC 0x6000 -#define BTRACKING_MODE 0x8000 -#define BPHCMP_ENABLE 0x10000 -#define BUPD_CLKO_LTF 0x20000 -#define BCOM_CH_CFO 0x40000 -#define BCSI_ESTI_MODE 0x80000 -#define BADV_UPD_EQZ 0x100000 -#define BUCHCFG 0x7000000 -#define BUPDEQZ 0x8000000 - -#define BRX_PESUDO_NOISE_ON 0x20000000 -#define BRX_PESUDO_NOISE_A 0xff -#define BRX_PESUDO_NOISE_B 0xff00 -#define BRX_PESUDO_NOISE_C 0xff0000 -#define BRX_PESUDO_NOISE_D 0xff000000 -#define BRX_PESUDO_NOISESTATE_A 0xffff -#define BRX_PESUDO_NOISESTATE_B 0xffff0000 -#define BRX_PESUDO_NOISESTATE_C 0xffff -#define BRX_PESUDO_NOISESTATE_D 0xffff0000 - -#define BZEBRA1_HSSIENABLE 0x8 -#define BZEBRA1_TRXCONTROL 0xc00 -#define BZEBRA1_TRXGAINSETTING 0x07f -#define BZEBRA1_RXCOUNTER 0xc00 -#define BZEBRA1_TXCHANGEPUMP 0x38 -#define BZEBRA1_RXCHANGEPUMP 0x7 -#define BZEBRA1_CHANNEL_NUM 0xf80 -#define BZEBRA1_TXLPFBW 0x400 -#define BZEBRA1_RXLPFBW 0x600 - -#define BRTL8256REG_MODE_CTRL1 0x100 -#define BRTL8256REG_MODE_CTRL0 0x40 -#define BRTL8256REG_TXLPFBW 0x18 -#define BRTL8256REG_RXLPFBW 0x600 - -#define BRTL8258_TXLPFBW 0xc -#define BRTL8258_RXLPFBW 0xc00 -#define BRTL8258_RSSILPFBW 0xc0 - -#define BBYTE0 0x1 -#define BBYTE1 0x2 -#define BBYTE2 0x4 -#define BBYTE3 0x8 -#define BWORD0 0x3 -#define BWORD1 0xc -#define BWORD 0xf - -#define MASKBYTE0 0xff -#define MASKBYTE1 0xff00 -#define MASKBYTE2 0xff0000 -#define MASKBYTE3 0xff000000 -#define MASKHWORD 0xffff0000 -#define MASKLWORD 0x0000ffff -#define MASKDWORD 0xffffffff -#define MASK12BITS 0xfff -#define MASKH4BITS 0xf0000000 -#define MASKOFDM_D 0xffc00000 -#define MASKCCK 0x3f3f3f3f - -#define MASK4BITS 0x0f -#define MASK20BITS 0xfffff -#define RFREG_OFFSET_MASK 0xfffff - -#define BENABLE 0x1 -#define BDISABLE 0x0 - -#define LEFT_ANTENNA 0x0 -#define RIGHT_ANTENNA 0x1 - -#define TCHECK_TXSTATUS 500 -#define TUPDATE_RXCOUNTER 100 - -/* 2 EFUSE_TEST (For RTL8723 partially) */ -#define EFUSE_SEL(x) (((x) & 0x3) << 8) -#define EFUSE_SEL_MASK 0x300 -#define EFUSE_WIFI_SEL_0 0x0 - -/* Enable GPIO[9] as WiFi HW PDn source*/ -#define WL_HWPDN_EN BIT(0) -/* WiFi HW PDn polarity control*/ -#define WL_HWPDN_SL BIT(1) - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/rf.c b/drivers/net/wireless/rtlwifi/rtl8723ae/rf.c deleted file mode 100644 index 50dd2fb2c93d..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/rf.c +++ /dev/null @@ -1,505 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" - -void rtl8723ae_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - switch (bandwidth) { - case HT_CHANNEL_WIDTH_20: - rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] & - 0xfffff3ff) | 0x0400); - rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK, - rtlphy->rfreg_chnlval[0]); - break; - case HT_CHANNEL_WIDTH_20_40: - rtlphy->rfreg_chnlval[0] = ((rtlphy->rfreg_chnlval[0] & - 0xfffff3ff)); - rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, RFREG_OFFSET_MASK, - rtlphy->rfreg_chnlval[0]); - break; - default: - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "unknown bandwidth: %#X\n", bandwidth); - break; - } -} - -void rtl8723ae_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u32 tx_agc[2] = {0, 0}, tmpval; - bool turbo_scanoff = false; - u8 idx1, idx2; - u8 *ptr; - - if (rtlefuse->eeprom_regulatory != 0) - turbo_scanoff = true; - - if (mac->act_scanning == true) { - tx_agc[RF90_PATH_A] = 0x3f3f3f3f; - tx_agc[RF90_PATH_B] = 0x3f3f3f3f; - - if (turbo_scanoff) { - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - tx_agc[idx1] = ppowerlevel[idx1] | - (ppowerlevel[idx1] << 8) | - (ppowerlevel[idx1] << 16) | - (ppowerlevel[idx1] << 24); - } - } - } else { - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - tx_agc[idx1] = ppowerlevel[idx1] | - (ppowerlevel[idx1] << 8) | - (ppowerlevel[idx1] << 16) | - (ppowerlevel[idx1] << 24); - } - - if (rtlefuse->eeprom_regulatory == 0) { - tmpval = (rtlphy->mcs_offset[0][6]) + - (rtlphy->mcs_offset[0][7] << 8); - tx_agc[RF90_PATH_A] += tmpval; - - tmpval = (rtlphy->mcs_offset[0][14]) + - (rtlphy->mcs_offset[0][15] << 24); - tx_agc[RF90_PATH_B] += tmpval; - } - } - - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - ptr = (u8 *) (&(tx_agc[idx1])); - for (idx2 = 0; idx2 < 4; idx2++) { - if (*ptr > RF6052_MAX_TX_PWR) - *ptr = RF6052_MAX_TX_PWR; - ptr++; - } - } - - tmpval = tx_agc[RF90_PATH_A] & 0xff; - rtl_set_bbreg(hw, RTXAGC_A_CCK1_MCS32, MASKBYTE1, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 1M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, - RTXAGC_A_CCK1_MCS32); - - tmpval = tx_agc[RF90_PATH_A] >> 8; - - tmpval = tmpval & 0xff00ffff; - - rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 2~11M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, - RTXAGC_B_CCK11_A_CCK2_11); - - tmpval = tx_agc[RF90_PATH_B] >> 24; - rtl_set_bbreg(hw, RTXAGC_B_CCK11_A_CCK2_11, MASKBYTE0, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n", tmpval, - RTXAGC_B_CCK11_A_CCK2_11); - - tmpval = tx_agc[RF90_PATH_B] & 0x00ffffff; - rtl_set_bbreg(hw, RTXAGC_B_CCK1_55_MCS32, 0xffffff00, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "CCK PWR 1~5.5M (rf-B) = 0x%x (reg 0x%x)\n", tmpval, - RTXAGC_B_CCK1_55_MCS32); -} - -static void rtl8723ae_phy_get_power_base(struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel, - u32 *ofdmbase, u32 *mcsbase) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u32 powerBase0, powerBase1; - u8 legacy_pwrdiff, ht20_pwrdiff; - u8 i, powerlevel[2]; - - for (i = 0; i < 2; i++) { - powerlevel[i] = ppowerlevel[i]; - legacy_pwrdiff = rtlefuse->txpwr_legacyhtdiff[i][channel - 1]; - powerBase0 = powerlevel[i] + legacy_pwrdiff; - - powerBase0 = (powerBase0 << 24) | (powerBase0 << 16) | - (powerBase0 << 8) | powerBase0; - *(ofdmbase + i) = powerBase0; - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - " [OFDM power base index rf(%c) = 0x%x]\n", - ((i == 0) ? 'A' : 'B'), *(ofdmbase + i)); - } - - for (i = 0; i < 2; i++) { - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) { - ht20_pwrdiff = rtlefuse->txpwr_ht20diff[i][channel - 1]; - powerlevel[i] += ht20_pwrdiff; - } - powerBase1 = powerlevel[i]; - powerBase1 = (powerBase1 << 24) | - (powerBase1 << 16) | (powerBase1 << 8) | powerBase1; - - *(mcsbase + i) = powerBase1; - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - " [MCS power base index rf(%c) = 0x%x]\n", - ((i == 0) ? 'A' : 'B'), *(mcsbase + i)); - } -} - -static void rtl8723ae_get_txpwr_val_by_reg(struct ieee80211_hw *hw, - u8 channel, u8 index, - u32 *powerBase0, - u32 *powerBase1, - u32 *p_outwriteval) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 i, chnlgroup = 0, pwr_diff_limit[4]; - u32 writeVal, customer_limit, rf; - - for (rf = 0; rf < 2; rf++) { - switch (rtlefuse->eeprom_regulatory) { - case 0: - chnlgroup = 0; - - writeVal = rtlphy->mcs_offset[chnlgroup] - [index + (rf ? 8 : 0)] + - ((index < 2) ? powerBase0[rf] : - powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "RTK better performance, " - "writeVal(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeVal); - break; - case 1: - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - writeVal = ((index < 2) ? powerBase0[rf] : - powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Realtek regulatory, 40MHz, " - "writeVal(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeVal); - } else { - if (rtlphy->pwrgroup_cnt == 1) - chnlgroup = 0; - if (rtlphy->pwrgroup_cnt >= 3) { - if (channel <= 3) - chnlgroup = 0; - else if (channel >= 4 && channel <= 9) - chnlgroup = 1; - else if (channel > 9) - chnlgroup = 2; - if (rtlphy->current_chan_bw == - HT_CHANNEL_WIDTH_20) - chnlgroup++; - else - chnlgroup += 4; - } - - writeVal = rtlphy->mcs_offset[chnlgroup] - [index + (rf ? 8 : 0)] + ((index < 2) ? - powerBase0[rf] : - powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Realtek regulatory, 20MHz, writeVal(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeVal); - } - break; - case 2: - writeVal = - ((index < 2) ? powerBase0[rf] : powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Better regulatory, writeVal(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeVal); - break; - case 3: - chnlgroup = 0; - - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "customer's limit, 40MHz rf(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), - rtlefuse->pwrgroup_ht40[rf][channel-1]); - } else { - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "customer's limit, 20MHz rf(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), - rtlefuse->pwrgroup_ht20[rf][channel-1]); - } - for (i = 0; i < 4; i++) { - pwr_diff_limit[i] = - (u8) ((rtlphy->mcs_offset - [chnlgroup][index + (rf ? 8 : 0)] & - (0x7f << (i * 8))) >> (i * 8)); - - if (rtlphy->current_chan_bw == - HT_CHANNEL_WIDTH_20_40) { - if (pwr_diff_limit[i] > - rtlefuse-> - pwrgroup_ht40[rf][channel - 1]) - pwr_diff_limit[i] = - rtlefuse->pwrgroup_ht40[rf] - [channel - 1]; - } else { - if (pwr_diff_limit[i] > - rtlefuse-> - pwrgroup_ht20[rf][channel - 1]) - pwr_diff_limit[i] = - rtlefuse->pwrgroup_ht20[rf] - [channel - 1]; - } - } - - customer_limit = (pwr_diff_limit[3] << 24) | - (pwr_diff_limit[2] << 16) | - (pwr_diff_limit[1] << 8) | (pwr_diff_limit[0]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Customer's limit rf(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), customer_limit); - - writeVal = customer_limit + - ((index < 2) ? powerBase0[rf] : powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Customer, writeVal rf(%c)= 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeVal); - break; - default: - chnlgroup = 0; - writeVal = rtlphy->mcs_offset[chnlgroup][index + - (rf ? 8 : 0)] + ((index < 2) ? powerBase0[rf] : - powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "RTK better performance, writeVal rf(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeVal); - break; - } - - if (rtlpriv->dm.dynamic_txhighpower_lvl == TXHIGHPWRLEVEL_BT1) - writeVal = writeVal - 0x06060606; - else if (rtlpriv->dm.dynamic_txhighpower_lvl == - TXHIGHPWRLEVEL_BT2) - writeVal = writeVal - 0x0c0c0c0c; - *(p_outwriteval + rf) = writeVal; - } -} - -static void _rtl8723ae_write_ofdm_power_reg(struct ieee80211_hw *hw, - u8 index, u32 *pValue) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - u16 regoffset_a[6] = { - RTXAGC_A_RATE18_06, RTXAGC_A_RATE54_24, - RTXAGC_A_MCS03_MCS00, RTXAGC_A_MCS07_MCS04, - RTXAGC_A_MCS11_MCS08, RTXAGC_A_MCS15_MCS12 - }; - u16 regoffset_b[6] = { - RTXAGC_B_RATE18_06, RTXAGC_B_RATE54_24, - RTXAGC_B_MCS03_MCS00, RTXAGC_B_MCS07_MCS04, - RTXAGC_B_MCS11_MCS08, RTXAGC_B_MCS15_MCS12 - }; - u8 i, rf, pwr_val[4]; - u32 writeVal; - u16 regoffset; - - for (rf = 0; rf < 2; rf++) { - writeVal = pValue[rf]; - for (i = 0; i < 4; i++) { - pwr_val[i] = (u8) ((writeVal & (0x7f << - (i * 8))) >> (i * 8)); - - if (pwr_val[i] > RF6052_MAX_TX_PWR) - pwr_val[i] = RF6052_MAX_TX_PWR; - } - writeVal = (pwr_val[3] << 24) | (pwr_val[2] << 16) | - (pwr_val[1] << 8) | pwr_val[0]; - - if (rf == 0) - regoffset = regoffset_a[index]; - else - regoffset = regoffset_b[index]; - rtl_set_bbreg(hw, regoffset, MASKDWORD, writeVal); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - "Set 0x%x = %08x\n", regoffset, writeVal); - - if (((get_rf_type(rtlphy) == RF_2T2R) && - (regoffset == RTXAGC_A_MCS15_MCS12 || - regoffset == RTXAGC_B_MCS15_MCS12)) || - ((get_rf_type(rtlphy) != RF_2T2R) && - (regoffset == RTXAGC_A_MCS07_MCS04 || - regoffset == RTXAGC_B_MCS07_MCS04))) { - - writeVal = pwr_val[3]; - if (regoffset == RTXAGC_A_MCS15_MCS12 || - regoffset == RTXAGC_A_MCS07_MCS04) - regoffset = 0xc90; - if (regoffset == RTXAGC_B_MCS15_MCS12 || - regoffset == RTXAGC_B_MCS07_MCS04) - regoffset = 0xc98; - - for (i = 0; i < 3; i++) { - writeVal = (writeVal > 6) ? (writeVal - 6) : 0; - rtl_write_byte(rtlpriv, (u32) (regoffset + i), - (u8) writeVal); - } - } - } -} - -void rtl8723ae_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel) -{ - u32 writeVal[2], powerBase0[2], powerBase1[2]; - u8 index; - - rtl8723ae_phy_get_power_base(hw, ppowerlevel, - channel, &powerBase0[0], &powerBase1[0]); - - for (index = 0; index < 6; index++) { - rtl8723ae_get_txpwr_val_by_reg(hw, channel, index, - &powerBase0[0], - &powerBase1[0], - &writeVal[0]); - - _rtl8723ae_write_ofdm_power_reg(hw, index, &writeVal[0]); - } -} - -static bool _rtl8723ae_phy_rf6052_config_parafile(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 u4_regvalue = 0; - u8 rfpath; - bool rtstatus = true; - struct bb_reg_def *pphyreg; - - for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) { - - pphyreg = &rtlphy->phyreg_def[rfpath]; - - switch (rfpath) { - case RF90_PATH_A: - case RF90_PATH_C: - u4_regvalue = rtl_get_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV); - break; - case RF90_PATH_B: - case RF90_PATH_D: - u4_regvalue = rtl_get_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV << 16); - break; - } - - rtl_set_bbreg(hw, pphyreg->rfintfe, BRFSI_RFENV << 16, 0x1); - udelay(1); - - rtl_set_bbreg(hw, pphyreg->rfintfo, BRFSI_RFENV, 0x1); - udelay(1); - - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, - B3WIREADDREAALENGTH, 0x0); - udelay(1); - - rtl_set_bbreg(hw, pphyreg->rfhssi_para2, B3WIREDATALENGTH, 0x0); - udelay(1); - - switch (rfpath) { - case RF90_PATH_A: - rtstatus = rtl8723ae_phy_config_rf_with_headerfile(hw, - (enum radio_path)rfpath); - break; - case RF90_PATH_B: - rtstatus = rtl8723ae_phy_config_rf_with_headerfile(hw, - (enum radio_path)rfpath); - break; - case RF90_PATH_C: - break; - case RF90_PATH_D: - break; - } - switch (rfpath) { - case RF90_PATH_A: - case RF90_PATH_C: - rtl_set_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV, u4_regvalue); - break; - case RF90_PATH_B: - case RF90_PATH_D: - rtl_set_bbreg(hw, pphyreg->rfintfs, - BRFSI_RFENV << 16, u4_regvalue); - break; - } - if (rtstatus != true) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, - "Radio[%d] Fail!!", rfpath); - return false; - } - } - RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "<---\n"); - return rtstatus; -} - -bool rtl8723ae_phy_rf6052_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - if (rtlphy->rf_type == RF_1T1R) - rtlphy->num_total_rfpath = 1; - else - rtlphy->num_total_rfpath = 2; - - return _rtl8723ae_phy_rf6052_config_parafile(hw); -} diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h b/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h deleted file mode 100644 index d0f9dd79abea..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h +++ /dev/null @@ -1,43 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL8723E_RF_H__ -#define __RTL8723E_RF_H__ - -#define RF6052_MAX_TX_PWR 0x3F - -extern void rtl8723ae_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, - u8 bandwidth); -extern void rtl8723ae_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel); -extern void rtl8723ae_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel); -extern bool rtl8723ae_phy_rf6052_config(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c deleted file mode 100644 index d9ee2efffe5f..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c +++ /dev/null @@ -1,380 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include -#include - -#include "../core.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "hw.h" -#include "sw.h" -#include "trx.h" -#include "led.h" -#include "table.h" -#include "hal_btc.h" - -static void rtl8723ae_init_aspm_vars(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - /*close ASPM for AMD defaultly */ - rtlpci->const_amdpci_aspm = 0; - - /* ASPM PS mode. - * 0 - Disable ASPM, - * 1 - Enable ASPM without Clock Req, - * 2 - Enable ASPM with Clock Req, - * 3 - Alwyas Enable ASPM with Clock Req, - * 4 - Always Enable ASPM without Clock Req. - * set defult to RTL8192CE:3 RTL8192E:2 - */ - rtlpci->const_pci_aspm = 3; - - /*Setting for PCI-E device */ - rtlpci->const_devicepci_aspm_setting = 0x03; - - /*Setting for PCI-E bridge */ - rtlpci->const_hostpci_aspm_setting = 0x02; - - /* In Hw/Sw Radio Off situation. - * 0 - Default, - * 1 - From ASPM setting without low Mac Pwr, - * 2 - From ASPM setting with low Mac Pwr, - * 3 - Bus D3 - * set default to RTL8192CE:0 RTL8192SE:2 - */ - rtlpci->const_hwsw_rfoff_d3 = 0; - - /* This setting works for those device with - * backdoor ASPM setting such as EPHY setting. - * 0 - Not support ASPM, - * 1 - Support ASPM, - * 2 - According to chipset. - */ - rtlpci->const_support_pciaspm = 1; -} - -int rtl8723ae_init_sw_vars(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - int err; - - rtl8723ae_bt_reg_init(hw); - rtlpriv->dm.dm_initialgain_enable = 1; - rtlpriv->dm.dm_flag = 0; - rtlpriv->dm.disable_framebursting = 0; - rtlpriv->dm.thermalvalue = 0; - rtlpci->transmit_config = CFENDFORM | BIT(12) | BIT(13); - - /* compatible 5G band 88ce just 2.4G band & smsp */ - rtlpriv->rtlhal.current_bandtype = BAND_ON_2_4G; - rtlpriv->rtlhal.bandset = BAND_ON_2_4G; - rtlpriv->rtlhal.macphymode = SINGLEMAC_SINGLEPHY; - - rtlpci->receive_config = (RCR_APPFCS | - RCR_APP_MIC | - RCR_APP_ICV | - RCR_APP_PHYST_RXFF | - RCR_HTC_LOC_CTRL | - RCR_AMF | - RCR_ACF | - RCR_ADF | - RCR_AICV | - RCR_AB | - RCR_AM | - RCR_APM | - 0); - - rtlpci->irq_mask[0] = - (u32) (PHIMR_ROK | - PHIMR_RDU | - PHIMR_VODOK | - PHIMR_VIDOK | - PHIMR_BEDOK | - PHIMR_BKDOK | - PHIMR_MGNTDOK | - PHIMR_HIGHDOK | - PHIMR_C2HCMD | - PHIMR_HISRE_IND | - PHIMR_TSF_BIT32_TOGGLE | - PHIMR_TXBCNOK | - PHIMR_PSTIMEOUT | - 0); - - rtlpci->irq_mask[1] = (u32)(PHIMR_RXFOVW | 0); - - /* for debug level */ - rtlpriv->dbg.global_debuglevel = rtlpriv->cfg->mod_params->debug; - /* for LPS & IPS */ - rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps; - rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; - rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; - rtlpriv->psc.reg_fwctrl_lps = 3; - rtlpriv->psc.reg_max_lps_awakeintvl = 5; - /* for ASPM, you can close aspm through - * set const_support_pciaspm = 0 - */ - rtl8723ae_init_aspm_vars(hw); - - if (rtlpriv->psc.reg_fwctrl_lps == 1) - rtlpriv->psc.fwctrl_psmode = FW_PS_MIN_MODE; - else if (rtlpriv->psc.reg_fwctrl_lps == 2) - rtlpriv->psc.fwctrl_psmode = FW_PS_MAX_MODE; - else if (rtlpriv->psc.reg_fwctrl_lps == 3) - rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE; - - /* for firmware buf */ - rtlpriv->rtlhal.pfirmware = vmalloc(0x6000); - if (!rtlpriv->rtlhal.pfirmware) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Can't alloc buffer for fw.\n"); - return 1; - } - - if (IS_VENDOR_8723_A_CUT(rtlhal->version)) - rtlpriv->cfg->fw_name = "rtlwifi/rtl8723fw.bin"; - else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) - rtlpriv->cfg->fw_name = "rtlwifi/rtl8723fw_B.bin"; - - rtlpriv->max_fw_size = 0x6000; - pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name); - err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Failed to request firmware!\n"); - return 1; - } - return 0; -} - -void rtl8723ae_deinit_sw_vars(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->rtlhal.pfirmware) { - vfree(rtlpriv->rtlhal.pfirmware); - rtlpriv->rtlhal.pfirmware = NULL; - } -} - -static struct rtl_hal_ops rtl8723ae_hal_ops = { - .init_sw_vars = rtl8723ae_init_sw_vars, - .deinit_sw_vars = rtl8723ae_deinit_sw_vars, - .read_eeprom_info = rtl8723ae_read_eeprom_info, - .interrupt_recognized = rtl8723ae_interrupt_recognized, - .hw_init = rtl8723ae_hw_init, - .hw_disable = rtl8723ae_card_disable, - .hw_suspend = rtl8723ae_suspend, - .hw_resume = rtl8723ae_resume, - .enable_interrupt = rtl8723ae_enable_interrupt, - .disable_interrupt = rtl8723ae_disable_interrupt, - .set_network_type = rtl8723ae_set_network_type, - .set_chk_bssid = rtl8723ae_set_check_bssid, - .set_qos = rtl8723ae_set_qos, - .set_bcn_reg = rtl8723ae_set_beacon_related_registers, - .set_bcn_intv = rtl8723ae_set_beacon_interval, - .update_interrupt_mask = rtl8723ae_update_interrupt_mask, - .get_hw_reg = rtl8723ae_get_hw_reg, - .set_hw_reg = rtl8723ae_set_hw_reg, - .update_rate_tbl = rtl8723ae_update_hal_rate_tbl, - .fill_tx_desc = rtl8723ae_tx_fill_desc, - .fill_tx_cmddesc = rtl8723ae_tx_fill_cmddesc, - .query_rx_desc = rtl8723ae_rx_query_desc, - .set_channel_access = rtl8723ae_update_channel_access_setting, - .radio_onoff_checking = rtl8723ae_gpio_radio_on_off_checking, - .set_bw_mode = rtl8723ae_phy_set_bw_mode, - .switch_channel = rtl8723ae_phy_sw_chnl, - .dm_watchdog = rtl8723ae_dm_watchdog, - .scan_operation_backup = rtl8723ae_phy_scan_operation_backup, - .set_rf_power_state = rtl8723ae_phy_set_rf_power_state, - .led_control = rtl8723ae_led_control, - .set_desc = rtl8723ae_set_desc, - .get_desc = rtl8723ae_get_desc, - .tx_polling = rtl8723ae_tx_polling, - .enable_hw_sec = rtl8723ae_enable_hw_security_config, - .set_key = rtl8723ae_set_key, - .init_sw_leds = rtl8723ae_init_sw_leds, - .allow_all_destaddr = rtl8723ae_allow_all_destaddr, - .get_bbreg = rtl8723ae_phy_query_bb_reg, - .set_bbreg = rtl8723ae_phy_set_bb_reg, - .get_rfreg = rtl8723ae_phy_query_rf_reg, - .set_rfreg = rtl8723ae_phy_set_rf_reg, - .c2h_command_handle = rtl_8723e_c2h_command_handle, - .bt_wifi_media_status_notify = rtl_8723e_bt_wifi_media_status_notify, - .bt_coex_off_before_lps = rtl8723ae_bt_coex_off_before_lps, -}; - -static struct rtl_mod_params rtl8723ae_mod_params = { - .sw_crypto = false, - .inactiveps = true, - .swctrl_lps = false, - .fwctrl_lps = true, - .debug = DBG_EMERG, -}; - -static struct rtl_hal_cfg rtl8723ae_hal_cfg = { - .bar_id = 2, - .write_readback = true, - .name = "rtl8723ae_pci", - .fw_name = "rtlwifi/rtl8723fw.bin", - .ops = &rtl8723ae_hal_ops, - .mod_params = &rtl8723ae_mod_params, - .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, - .maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN, - .maps[SYS_CLK] = REG_SYS_CLKR, - .maps[MAC_RCR_AM] = AM, - .maps[MAC_RCR_AB] = AB, - .maps[MAC_RCR_ACRC32] = ACRC32, - .maps[MAC_RCR_ACF] = ACF, - .maps[MAC_RCR_AAP] = AAP, - .maps[EFUSE_TEST] = REG_EFUSE_TEST, - .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, - .maps[EFUSE_CLK] = 0, - .maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL, - .maps[EFUSE_PWC_EV12V] = PWC_EV12V, - .maps[EFUSE_FEN_ELDR] = FEN_ELDR, - .maps[EFUSE_LOADER_CLK_EN] = LOADER_CLK_EN, - .maps[EFUSE_ANA8M] = ANA8M, - .maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE, - .maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION, - .maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN, - .maps[EFUSE_OOB_PROTECT_BYTES_LEN] = EFUSE_OOB_PROTECT_BYTES, - - .maps[RWCAM] = REG_CAMCMD, - .maps[WCAMI] = REG_CAMWRITE, - .maps[RCAMO] = REG_CAMREAD, - .maps[CAMDBG] = REG_CAMDBG, - .maps[SECR] = REG_SECCFG, - .maps[SEC_CAM_NONE] = CAM_NONE, - .maps[SEC_CAM_WEP40] = CAM_WEP40, - .maps[SEC_CAM_TKIP] = CAM_TKIP, - .maps[SEC_CAM_AES] = CAM_AES, - .maps[SEC_CAM_WEP104] = CAM_WEP104, - - .maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6, - .maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5, - .maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4, - .maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3, - .maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2, - .maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1, - .maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8, - .maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7, - .maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6, - .maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5, - .maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4, - .maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3, - .maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2, - .maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1, - .maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2, - .maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1, - - .maps[RTL_IMR_TXFOVW] = PHIMR_TXFOVW, - .maps[RTL_IMR_PSTIMEOUT] = PHIMR_PSTIMEOUT, - .maps[RTL_IMR_BCNINT] = PHIMR_BCNDMAINT0, - .maps[RTL_IMR_RXFOVW] = PHIMR_RXFOVW, - .maps[RTL_IMR_RDU] = PHIMR_RDU, - .maps[RTL_IMR_ATIMEND] = PHIMR_ATIMEND_E, - .maps[RTL_IMR_BDOK] = PHIMR_BCNDOK0, - .maps[RTL_IMR_MGNTDOK] = PHIMR_MGNTDOK, - .maps[RTL_IMR_TBDER] = PHIMR_TXBCNERR, - .maps[RTL_IMR_HIGHDOK] = PHIMR_HIGHDOK, - .maps[RTL_IMR_TBDOK] = PHIMR_TXBCNOK, - .maps[RTL_IMR_BKDOK] = PHIMR_BKDOK, - .maps[RTL_IMR_BEDOK] = PHIMR_BEDOK, - .maps[RTL_IMR_VIDOK] = PHIMR_VIDOK, - .maps[RTL_IMR_VODOK] = PHIMR_VODOK, - .maps[RTL_IMR_ROK] = PHIMR_ROK, - .maps[RTL_IBSS_INT_MASKS] = (PHIMR_BCNDMAINT0 | - PHIMR_TXBCNOK | PHIMR_TXBCNERR), - .maps[RTL_IMR_C2HCMD] = PHIMR_C2HCMD, - - - .maps[RTL_RC_CCK_RATE1M] = DESC92_RATE1M, - .maps[RTL_RC_CCK_RATE2M] = DESC92_RATE2M, - .maps[RTL_RC_CCK_RATE5_5M] = DESC92_RATE5_5M, - .maps[RTL_RC_CCK_RATE11M] = DESC92_RATE11M, - .maps[RTL_RC_OFDM_RATE6M] = DESC92_RATE6M, - .maps[RTL_RC_OFDM_RATE9M] = DESC92_RATE9M, - .maps[RTL_RC_OFDM_RATE12M] = DESC92_RATE12M, - .maps[RTL_RC_OFDM_RATE18M] = DESC92_RATE18M, - .maps[RTL_RC_OFDM_RATE24M] = DESC92_RATE24M, - .maps[RTL_RC_OFDM_RATE36M] = DESC92_RATE36M, - .maps[RTL_RC_OFDM_RATE48M] = DESC92_RATE48M, - .maps[RTL_RC_OFDM_RATE54M] = DESC92_RATE54M, - - .maps[RTL_RC_HT_RATEMCS7] = DESC92_RATEMCS7, - .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, -}; - -static struct pci_device_id rtl8723ae_pci_ids[] = { - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8723, rtl8723ae_hal_cfg)}, - {}, -}; - -MODULE_DEVICE_TABLE(pci, rtl8723ae_pci_ids); - -MODULE_AUTHOR("lizhaoming "); -MODULE_AUTHOR("Realtek WlanFAE "); -MODULE_AUTHOR("Larry Finger "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Realtek 8723E 802.11n PCI wireless"); -MODULE_FIRMWARE("rtlwifi/rtl8723fw.bin"); -MODULE_FIRMWARE("rtlwifi/rtl8723fw_B.bin"); - -module_param_named(swenc, rtl8723ae_mod_params.sw_crypto, bool, 0444); -module_param_named(debug, rtl8723ae_mod_params.debug, int, 0444); -module_param_named(ips, rtl8723ae_mod_params.inactiveps, bool, 0444); -module_param_named(swlps, rtl8723ae_mod_params.swctrl_lps, bool, 0444); -module_param_named(fwlps, rtl8723ae_mod_params.fwctrl_lps, bool, 0444); -MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); -MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); -MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); -MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n"); -MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); - -static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); - -static struct pci_driver rtl8723ae_driver = { - .name = KBUILD_MODNAME, - .id_table = rtl8723ae_pci_ids, - .probe = rtl_pci_probe, - .remove = rtl_pci_disconnect, - .driver.pm = &rtlwifi_pm_ops, -}; - -module_pci_driver(rtl8723ae_driver); diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.h b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.h deleted file mode 100644 index fc4fde5e3eb5..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.h +++ /dev/null @@ -1,37 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL8723E_SW_H__ -#define __RTL8723E_SW_H__ - -int rtl8723ae_init_sw_vars(struct ieee80211_hw *hw); -void rtl8723ae_deinit_sw_vars(struct ieee80211_hw *hw); -void rtl8723ae_init_var_map(struct ieee80211_hw *hw); - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/table.c b/drivers/net/wireless/rtlwifi/rtl8723ae/table.c deleted file mode 100644 index 9b0b50cc4ade..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/table.c +++ /dev/null @@ -1,738 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Created on 2010/ 5/18, 1:41 - * - * Larry Finger - * - *****************************************************************************/ - -#include "table.h" - -u32 RTL8723EPHY_REG_1TARRAY[RTL8723E_PHY_REG_1TARRAY_LENGTH] = { - 0x800, 0x80040000, - 0x804, 0x00000003, - 0x808, 0x0000fc00, - 0x80c, 0x0000000a, - 0x810, 0x10005388, - 0x814, 0x020c3d10, - 0x818, 0x02200385, - 0x81c, 0x00000000, - 0x820, 0x01000100, - 0x824, 0x00390004, - 0x828, 0x00000000, - 0x82c, 0x00000000, - 0x830, 0x00000000, - 0x834, 0x00000000, - 0x838, 0x00000000, - 0x83c, 0x00000000, - 0x840, 0x00010000, - 0x844, 0x00000000, - 0x848, 0x00000000, - 0x84c, 0x00000000, - 0x850, 0x00000000, - 0x854, 0x00000000, - 0x858, 0x569a569a, - 0x85c, 0x001b25a4, - 0x860, 0x66f60110, - 0x864, 0x061f0130, - 0x868, 0x00000000, - 0x86c, 0x32323200, - 0x870, 0x07000760, - 0x874, 0x22004000, - 0x878, 0x00000808, - 0x87c, 0x00000000, - 0x880, 0xc0083070, - 0x884, 0x000004d5, - 0x888, 0x00000000, - 0x88c, 0xccc000c0, - 0x890, 0x00000800, - 0x894, 0xfffffffe, - 0x898, 0x40302010, - 0x89c, 0x00706050, - 0x900, 0x00000000, - 0x904, 0x00000023, - 0x908, 0x00000000, - 0x90c, 0x81121111, - 0xa00, 0x00d047c8, - 0xa04, 0x80ff000c, - 0xa08, 0x8c838300, - 0xa0c, 0x2e68120f, - 0xa10, 0x9500bb78, - 0xa14, 0x11144028, - 0xa18, 0x00881117, - 0xa1c, 0x89140f00, - 0xa20, 0x1a1b0000, - 0xa24, 0x090e1317, - 0xa28, 0x00000204, - 0xa2c, 0x00d30000, - 0xa70, 0x101fbf00, - 0xa74, 0x00000007, - 0xa78, 0x00000900, - 0xc00, 0x48071d40, - 0xc04, 0x03a05611, - 0xc08, 0x000000e4, - 0xc0c, 0x6c6c6c6c, - 0xc10, 0x08800000, - 0xc14, 0x40000100, - 0xc18, 0x08800000, - 0xc1c, 0x40000100, - 0xc20, 0x00000000, - 0xc24, 0x00000000, - 0xc28, 0x00000000, - 0xc2c, 0x00000000, - 0xc30, 0x69e9ac44, - 0xc34, 0x469652cf, - 0xc38, 0x49795994, - 0xc3c, 0x0a97971c, - 0xc40, 0x1f7c403f, - 0xc44, 0x000100b7, - 0xc48, 0xec020107, - 0xc4c, 0x007f037f, - 0xc50, 0x69543420, - 0xc54, 0x43bc0094, - 0xc58, 0x69543420, - 0xc5c, 0x433c0094, - 0xc60, 0x00000000, - 0xc64, 0x7116848b, - 0xc68, 0x47c00bff, - 0xc6c, 0x00000036, - 0xc70, 0x2c7f000d, - 0xc74, 0x018610db, - 0xc78, 0x0000001f, - 0xc7c, 0x00b91612, - 0xc80, 0x40000100, - 0xc84, 0x20f60000, - 0xc88, 0x40000100, - 0xc8c, 0x20200000, - 0xc90, 0x00121820, - 0xc94, 0x00000000, - 0xc98, 0x00121820, - 0xc9c, 0x00007f7f, - 0xca0, 0x00000000, - 0xca4, 0x00000080, - 0xca8, 0x00000000, - 0xcac, 0x00000000, - 0xcb0, 0x00000000, - 0xcb4, 0x00000000, - 0xcb8, 0x00000000, - 0xcbc, 0x28000000, - 0xcc0, 0x00000000, - 0xcc4, 0x00000000, - 0xcc8, 0x00000000, - 0xccc, 0x00000000, - 0xcd0, 0x00000000, - 0xcd4, 0x00000000, - 0xcd8, 0x64b22427, - 0xcdc, 0x00766932, - 0xce0, 0x00222222, - 0xce4, 0x00000000, - 0xce8, 0x37644302, - 0xcec, 0x2f97d40c, - 0xd00, 0x00080740, - 0xd04, 0x00020401, - 0xd08, 0x0000907f, - 0xd0c, 0x20010201, - 0xd10, 0xa0633333, - 0xd14, 0x3333bc43, - 0xd18, 0x7a8f5b6b, - 0xd2c, 0xcc979975, - 0xd30, 0x00000000, - 0xd34, 0x80608000, - 0xd38, 0x00000000, - 0xd3c, 0x00027293, - 0xd40, 0x00000000, - 0xd44, 0x00000000, - 0xd48, 0x00000000, - 0xd4c, 0x00000000, - 0xd50, 0x6437140a, - 0xd54, 0x00000000, - 0xd58, 0x00000000, - 0xd5c, 0x30032064, - 0xd60, 0x4653de68, - 0xd64, 0x04518a3c, - 0xd68, 0x00002101, - 0xd6c, 0x2a201c16, - 0xd70, 0x1812362e, - 0xd74, 0x322c2220, - 0xd78, 0x000e3c24, - 0xe00, 0x2a2a2a2a, - 0xe04, 0x2a2a2a2a, - 0xe08, 0x03902a2a, - 0xe10, 0x2a2a2a2a, - 0xe14, 0x2a2a2a2a, - 0xe18, 0x2a2a2a2a, - 0xe1c, 0x2a2a2a2a, - 0xe28, 0x00000000, - 0xe30, 0x1000dc1f, - 0xe34, 0x10008c1f, - 0xe38, 0x02140102, - 0xe3c, 0x681604c2, - 0xe40, 0x01007c00, - 0xe44, 0x01004800, - 0xe48, 0xfb000000, - 0xe4c, 0x000028d1, - 0xe50, 0x1000dc1f, - 0xe54, 0x10008c1f, - 0xe58, 0x02140102, - 0xe5c, 0x28160d05, - 0xe60, 0x00000008, - 0xe68, 0x001b25a4, - 0xe6c, 0x631b25a0, - 0xe70, 0x631b25a0, - 0xe74, 0x081b25a0, - 0xe78, 0x081b25a0, - 0xe7c, 0x081b25a0, - 0xe80, 0x081b25a0, - 0xe84, 0x631b25a0, - 0xe88, 0x081b25a0, - 0xe8c, 0x631b25a0, - 0xed0, 0x631b25a0, - 0xed4, 0x631b25a0, - 0xed8, 0x631b25a0, - 0xedc, 0x001b25a0, - 0xee0, 0x001b25a0, - 0xeec, 0x6b1b25a0, - 0xf14, 0x00000003, - 0xf4c, 0x00000000, - 0xf00, 0x00000300, -}; - -u32 RTL8723EPHY_REG_ARRAY_PG[RTL8723E_PHY_REG_ARRAY_PGLENGTH] = { - 0xe00, 0xffffffff, 0x0a0c0c0c, - 0xe04, 0xffffffff, 0x02040608, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x0a0c0d0e, - 0xe14, 0xffffffff, 0x02040608, - 0xe18, 0xffffffff, 0x0a0c0d0e, - 0xe1c, 0xffffffff, 0x02040608, - 0x830, 0xffffffff, 0x0a0c0c0c, - 0x834, 0xffffffff, 0x02040608, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x0a0c0d0e, - 0x848, 0xffffffff, 0x02040608, - 0x84c, 0xffffffff, 0x0a0c0d0e, - 0x868, 0xffffffff, 0x02040608, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x06060606, - 0xe14, 0xffffffff, 0x00020406, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x04040404, - 0x834, 0xffffffff, 0x00020204, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x06060606, - 0x848, 0xffffffff, 0x00020406, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x04040404, - 0xe04, 0xffffffff, 0x00020204, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x04040404, - 0x834, 0xffffffff, 0x00020204, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, - 0xe00, 0xffffffff, 0x00000000, - 0xe04, 0xffffffff, 0x00000000, - 0xe08, 0x0000ff00, 0x00000000, - 0x86c, 0xffffff00, 0x00000000, - 0xe10, 0xffffffff, 0x00000000, - 0xe14, 0xffffffff, 0x00000000, - 0xe18, 0xffffffff, 0x00000000, - 0xe1c, 0xffffffff, 0x00000000, - 0x830, 0xffffffff, 0x00000000, - 0x834, 0xffffffff, 0x00000000, - 0x838, 0xffffff00, 0x00000000, - 0x86c, 0x000000ff, 0x00000000, - 0x83c, 0xffffffff, 0x00000000, - 0x848, 0xffffffff, 0x00000000, - 0x84c, 0xffffffff, 0x00000000, - 0x868, 0xffffffff, 0x00000000, -}; - -u32 RTL8723E_RADIOA_1TARRAY[Rtl8723ERADIOA_1TARRAYLENGTH] = { - 0x000, 0x00030159, - 0x001, 0x00031284, - 0x002, 0x00098000, - 0x003, 0x00018c63, - 0x004, 0x000210e7, - 0x009, 0x0002044f, - 0x00a, 0x0001a3f1, - 0x00b, 0x00014787, - 0x00c, 0x000896fe, - 0x00d, 0x0000e02c, - 0x00e, 0x00039ce7, - 0x00f, 0x00000451, - 0x019, 0x00000000, - 0x01a, 0x00030355, - 0x01b, 0x00060a00, - 0x01c, 0x000fc378, - 0x01d, 0x000a1250, - 0x01e, 0x0004445f, - 0x01f, 0x00080001, - 0x020, 0x0000b614, - 0x021, 0x0006c000, - 0x022, 0x00000000, - 0x023, 0x00001558, - 0x024, 0x00000060, - 0x025, 0x00000483, - 0x026, 0x0004f000, - 0x027, 0x000ec7d9, - 0x028, 0x00057730, - 0x029, 0x00004783, - 0x02a, 0x00000001, - 0x02b, 0x00021334, - 0x02a, 0x00000000, - 0x02b, 0x00000054, - 0x02a, 0x00000001, - 0x02b, 0x00000808, - 0x02b, 0x00053333, - 0x02c, 0x0000000c, - 0x02a, 0x00000002, - 0x02b, 0x00000808, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000003, - 0x02b, 0x00000808, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x00000004, - 0x02b, 0x00000808, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000005, - 0x02b, 0x00000808, - 0x02b, 0x00073333, - 0x02c, 0x0000000d, - 0x02a, 0x00000006, - 0x02b, 0x00000709, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000007, - 0x02b, 0x00000709, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x00000008, - 0x02b, 0x0000060a, - 0x02b, 0x0004b333, - 0x02c, 0x0000000d, - 0x02a, 0x00000009, - 0x02b, 0x0000060a, - 0x02b, 0x00053333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000a, - 0x02b, 0x0000060a, - 0x02b, 0x0005b333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000b, - 0x02b, 0x0000060a, - 0x02b, 0x00063333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000c, - 0x02b, 0x0000060a, - 0x02b, 0x0006b333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000d, - 0x02b, 0x0000060a, - 0x02b, 0x00073333, - 0x02c, 0x0000000d, - 0x02a, 0x0000000e, - 0x02b, 0x0000050b, - 0x02b, 0x00066666, - 0x02c, 0x0000001a, - 0x02a, 0x000e0000, - 0x010, 0x0004000f, - 0x011, 0x000e31fc, - 0x010, 0x0006000f, - 0x011, 0x000ff9f8, - 0x010, 0x0002000f, - 0x011, 0x000203f9, - 0x010, 0x0003000f, - 0x011, 0x000ff500, - 0x010, 0x00000000, - 0x011, 0x00000000, - 0x010, 0x0008000f, - 0x011, 0x0003f100, - 0x010, 0x0009000f, - 0x011, 0x00023100, - 0x012, 0x00032000, - 0x012, 0x00071000, - 0x012, 0x000b0000, - 0x012, 0x000fc000, - 0x013, 0x000287b3, - 0x013, 0x000244b7, - 0x013, 0x000204ab, - 0x013, 0x0001c49f, - 0x013, 0x00018493, - 0x013, 0x0001429b, - 0x013, 0x00010299, - 0x013, 0x0000c29c, - 0x013, 0x000081a0, - 0x013, 0x000040ac, - 0x013, 0x00000020, - 0x014, 0x0001944c, - 0x014, 0x00059444, - 0x014, 0x0009944c, - 0x014, 0x000d9444, - 0x015, 0x0000f424, - 0x015, 0x0004f407, - 0x015, 0x0008f424, - 0x015, 0x000cf424, - 0x016, 0x00000339, - 0x016, 0x00040339, - 0x016, 0x00080339, - 0x016, 0x000c0336, - 0x000, 0x00010159, - 0x018, 0x0000f401, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01f, 0x00080003, - 0x0fe, 0x00000000, - 0x0fe, 0x00000000, - 0x01e, 0x00044457, - 0x01f, 0x00080000, - 0x000, 0x00030159, -}; - - -u32 RTL8723E_RADIOB_1TARRAY[RTL8723E_RADIOB_1TARRAYLENGTH] = { - 0x0, -}; - - -u32 RTL8723EMAC_ARRAY[RTL8723E_MACARRAYLENGTH] = { - 0x420, 0x00000080, - 0x423, 0x00000000, - 0x430, 0x00000000, - 0x431, 0x00000000, - 0x432, 0x00000000, - 0x433, 0x00000001, - 0x434, 0x00000004, - 0x435, 0x00000005, - 0x436, 0x00000006, - 0x437, 0x00000007, - 0x438, 0x00000000, - 0x439, 0x00000000, - 0x43a, 0x00000000, - 0x43b, 0x00000001, - 0x43c, 0x00000004, - 0x43d, 0x00000005, - 0x43e, 0x00000006, - 0x43f, 0x00000007, - 0x440, 0x0000005d, - 0x441, 0x00000001, - 0x442, 0x00000000, - 0x444, 0x00000015, - 0x445, 0x000000f0, - 0x446, 0x0000000f, - 0x447, 0x00000000, - 0x458, 0x00000041, - 0x459, 0x000000a8, - 0x45a, 0x00000072, - 0x45b, 0x000000b9, - 0x460, 0x00000066, - 0x461, 0x00000066, - 0x462, 0x00000008, - 0x463, 0x00000003, - 0x4c8, 0x000000ff, - 0x4c9, 0x00000008, - 0x4cc, 0x000000ff, - 0x4cd, 0x000000ff, - 0x4ce, 0x00000001, - 0x500, 0x00000026, - 0x501, 0x000000a2, - 0x502, 0x0000002f, - 0x503, 0x00000000, - 0x504, 0x00000028, - 0x505, 0x000000a3, - 0x506, 0x0000005e, - 0x507, 0x00000000, - 0x508, 0x0000002b, - 0x509, 0x000000a4, - 0x50a, 0x0000005e, - 0x50b, 0x00000000, - 0x50c, 0x0000004f, - 0x50d, 0x000000a4, - 0x50e, 0x00000000, - 0x50f, 0x00000000, - 0x512, 0x0000001c, - 0x514, 0x0000000a, - 0x515, 0x00000010, - 0x516, 0x0000000a, - 0x517, 0x00000010, - 0x51a, 0x00000016, - 0x524, 0x0000000f, - 0x525, 0x0000004f, - 0x546, 0x00000040, - 0x547, 0x00000000, - 0x550, 0x00000010, - 0x551, 0x00000010, - 0x559, 0x00000002, - 0x55a, 0x00000002, - 0x55d, 0x000000ff, - 0x605, 0x00000030, - 0x608, 0x0000000e, - 0x609, 0x0000002a, - 0x652, 0x00000020, - 0x63c, 0x0000000a, - 0x63d, 0x0000000e, - 0x63e, 0x0000000a, - 0x63f, 0x0000000e, - 0x66e, 0x00000005, - 0x700, 0x00000021, - 0x701, 0x00000043, - 0x702, 0x00000065, - 0x703, 0x00000087, - 0x708, 0x00000021, - 0x709, 0x00000043, - 0x70a, 0x00000065, - 0x70b, 0x00000087, -}; - -u32 RTL8723EAGCTAB_1TARRAY[RTL8723E_AGCTAB_1TARRAYLENGTH] = { - 0xc78, 0x7b000001, - 0xc78, 0x7b010001, - 0xc78, 0x7b020001, - 0xc78, 0x7b030001, - 0xc78, 0x7b040001, - 0xc78, 0x7b050001, - 0xc78, 0x7a060001, - 0xc78, 0x79070001, - 0xc78, 0x78080001, - 0xc78, 0x77090001, - 0xc78, 0x760a0001, - 0xc78, 0x750b0001, - 0xc78, 0x740c0001, - 0xc78, 0x730d0001, - 0xc78, 0x720e0001, - 0xc78, 0x710f0001, - 0xc78, 0x70100001, - 0xc78, 0x6f110001, - 0xc78, 0x6e120001, - 0xc78, 0x6d130001, - 0xc78, 0x6c140001, - 0xc78, 0x6b150001, - 0xc78, 0x6a160001, - 0xc78, 0x69170001, - 0xc78, 0x68180001, - 0xc78, 0x67190001, - 0xc78, 0x661a0001, - 0xc78, 0x651b0001, - 0xc78, 0x641c0001, - 0xc78, 0x631d0001, - 0xc78, 0x621e0001, - 0xc78, 0x611f0001, - 0xc78, 0x60200001, - 0xc78, 0x49210001, - 0xc78, 0x48220001, - 0xc78, 0x47230001, - 0xc78, 0x46240001, - 0xc78, 0x45250001, - 0xc78, 0x44260001, - 0xc78, 0x43270001, - 0xc78, 0x42280001, - 0xc78, 0x41290001, - 0xc78, 0x402a0001, - 0xc78, 0x262b0001, - 0xc78, 0x252c0001, - 0xc78, 0x242d0001, - 0xc78, 0x232e0001, - 0xc78, 0x222f0001, - 0xc78, 0x21300001, - 0xc78, 0x20310001, - 0xc78, 0x06320001, - 0xc78, 0x05330001, - 0xc78, 0x04340001, - 0xc78, 0x03350001, - 0xc78, 0x02360001, - 0xc78, 0x01370001, - 0xc78, 0x00380001, - 0xc78, 0x00390001, - 0xc78, 0x003a0001, - 0xc78, 0x003b0001, - 0xc78, 0x003c0001, - 0xc78, 0x003d0001, - 0xc78, 0x003e0001, - 0xc78, 0x003f0001, - 0xc78, 0x7b400001, - 0xc78, 0x7b410001, - 0xc78, 0x7b420001, - 0xc78, 0x7b430001, - 0xc78, 0x7b440001, - 0xc78, 0x7b450001, - 0xc78, 0x7a460001, - 0xc78, 0x79470001, - 0xc78, 0x78480001, - 0xc78, 0x77490001, - 0xc78, 0x764a0001, - 0xc78, 0x754b0001, - 0xc78, 0x744c0001, - 0xc78, 0x734d0001, - 0xc78, 0x724e0001, - 0xc78, 0x714f0001, - 0xc78, 0x70500001, - 0xc78, 0x6f510001, - 0xc78, 0x6e520001, - 0xc78, 0x6d530001, - 0xc78, 0x6c540001, - 0xc78, 0x6b550001, - 0xc78, 0x6a560001, - 0xc78, 0x69570001, - 0xc78, 0x68580001, - 0xc78, 0x67590001, - 0xc78, 0x665a0001, - 0xc78, 0x655b0001, - 0xc78, 0x645c0001, - 0xc78, 0x635d0001, - 0xc78, 0x625e0001, - 0xc78, 0x615f0001, - 0xc78, 0x60600001, - 0xc78, 0x49610001, - 0xc78, 0x48620001, - 0xc78, 0x47630001, - 0xc78, 0x46640001, - 0xc78, 0x45650001, - 0xc78, 0x44660001, - 0xc78, 0x43670001, - 0xc78, 0x42680001, - 0xc78, 0x41690001, - 0xc78, 0x406a0001, - 0xc78, 0x266b0001, - 0xc78, 0x256c0001, - 0xc78, 0x246d0001, - 0xc78, 0x236e0001, - 0xc78, 0x226f0001, - 0xc78, 0x21700001, - 0xc78, 0x20710001, - 0xc78, 0x06720001, - 0xc78, 0x05730001, - 0xc78, 0x04740001, - 0xc78, 0x03750001, - 0xc78, 0x02760001, - 0xc78, 0x01770001, - 0xc78, 0x00780001, - 0xc78, 0x00790001, - 0xc78, 0x007a0001, - 0xc78, 0x007b0001, - 0xc78, 0x007c0001, - 0xc78, 0x007d0001, - 0xc78, 0x007e0001, - 0xc78, 0x007f0001, - 0xc78, 0x3800001e, - 0xc78, 0x3801001e, - 0xc78, 0x3802001e, - 0xc78, 0x3803001e, - 0xc78, 0x3804001e, - 0xc78, 0x3805001e, - 0xc78, 0x3806001e, - 0xc78, 0x3807001e, - 0xc78, 0x3808001e, - 0xc78, 0x3c09001e, - 0xc78, 0x3e0a001e, - 0xc78, 0x400b001e, - 0xc78, 0x440c001e, - 0xc78, 0x480d001e, - 0xc78, 0x4c0e001e, - 0xc78, 0x500f001e, - 0xc78, 0x5210001e, - 0xc78, 0x5611001e, - 0xc78, 0x5a12001e, - 0xc78, 0x5e13001e, - 0xc78, 0x6014001e, - 0xc78, 0x6015001e, - 0xc78, 0x6016001e, - 0xc78, 0x6217001e, - 0xc78, 0x6218001e, - 0xc78, 0x6219001e, - 0xc78, 0x621a001e, - 0xc78, 0x621b001e, - 0xc78, 0x621c001e, - 0xc78, 0x621d001e, - 0xc78, 0x621e001e, - 0xc78, 0x621f001e, -}; diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/table.h b/drivers/net/wireless/rtlwifi/rtl8723ae/table.h deleted file mode 100644 index f5ce71375c20..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/table.h +++ /dev/null @@ -1,50 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Created on 2010/ 5/18, 1:41 - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL8723E_TABLE__H_ -#define __RTL8723E_TABLE__H_ - -#include - -#define RTL8723E_PHY_REG_1TARRAY_LENGTH 372 -extern u32 RTL8723EPHY_REG_1TARRAY[RTL8723E_PHY_REG_1TARRAY_LENGTH]; -#define RTL8723E_PHY_REG_ARRAY_PGLENGTH 336 -extern u32 RTL8723EPHY_REG_ARRAY_PG[RTL8723E_PHY_REG_ARRAY_PGLENGTH]; -#define Rtl8723ERADIOA_1TARRAYLENGTH 282 -extern u32 RTL8723E_RADIOA_1TARRAY[Rtl8723ERADIOA_1TARRAYLENGTH]; -#define RTL8723E_RADIOB_1TARRAYLENGTH 1 -extern u32 RTL8723E_RADIOB_1TARRAY[RTL8723E_RADIOB_1TARRAYLENGTH]; -#define RTL8723E_MACARRAYLENGTH 172 -extern u32 RTL8723EMAC_ARRAY[RTL8723E_MACARRAYLENGTH]; -#define RTL8723E_AGCTAB_1TARRAYLENGTH 320 -extern u32 RTL8723EAGCTAB_1TARRAY[RTL8723E_AGCTAB_1TARRAYLENGTH]; - -#endif diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c b/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c deleted file mode 100644 index c72758d8f4ed..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c +++ /dev/null @@ -1,681 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../base.h" -#include "../stats.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "trx.h" -#include "led.h" - -static u8 _rtl8723ae_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) -{ - __le16 fc = rtl_get_fc(skb); - - if (unlikely(ieee80211_is_beacon(fc))) - return QSLT_BEACON; - if (ieee80211_is_mgmt(fc) || ieee80211_is_ctl(fc)) - return QSLT_MGNT; - - return skb->priority; -} - -static void _rtl8723ae_query_rxphystatus(struct ieee80211_hw *hw, - struct rtl_stats *pstatus, u8 *pdesc, - struct rx_fwinfo_8723e *p_drvinfo, - bool bpacket_match_bssid, - bool bpacket_toself, bool packet_beacon) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtlpriv); - struct phy_sts_cck_8723e_t *cck_buf; - s8 rx_pwr_all, rx_pwr[4]; - u8 rf_rx_num = 0, evm, pwdb_all; - u8 i, max_spatial_stream; - u32 rssi, total_rssi = 0; - bool is_cck = pstatus->is_cck; - - /* Record it for next packet processing */ - pstatus->packet_matchbssid = bpacket_match_bssid; - pstatus->packet_toself = bpacket_toself; - pstatus->packet_beacon = packet_beacon; - pstatus->rx_mimo_sig_qual[0] = -1; - pstatus->rx_mimo_sig_qual[1] = -1; - - if (is_cck) { - u8 report, cck_highpwr; - - /* CCK Driver info Structure is not the same as OFDM packet. */ - cck_buf = (struct phy_sts_cck_8723e_t *)p_drvinfo; - - /* (1)Hardware does not provide RSSI for CCK - * (2)PWDB, Average PWDB cacluated by - * hardware (for rate adaptive) - */ - if (ppsc->rfpwr_state == ERFON) - cck_highpwr = (u8) rtl_get_bbreg(hw, - RFPGA0_XA_HSSIPARAMETER2, - BIT(9)); - else - cck_highpwr = false; - - if (!cck_highpwr) { - u8 cck_agc_rpt = cck_buf->cck_agc_rpt; - report = cck_buf->cck_agc_rpt & 0xc0; - report = report >> 6; - switch (report) { - case 0x3: - rx_pwr_all = -46 - (cck_agc_rpt & 0x3e); - break; - case 0x2: - rx_pwr_all = -26 - (cck_agc_rpt & 0x3e); - break; - case 0x1: - rx_pwr_all = -12 - (cck_agc_rpt & 0x3e); - break; - case 0x0: - rx_pwr_all = 16 - (cck_agc_rpt & 0x3e); - break; - } - } else { - u8 cck_agc_rpt = cck_buf->cck_agc_rpt; - report = p_drvinfo->cfosho[0] & 0x60; - report = report >> 5; - switch (report) { - case 0x3: - rx_pwr_all = -46 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x2: - rx_pwr_all = -26 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x1: - rx_pwr_all = -12 - ((cck_agc_rpt & 0x1f) << 1); - break; - case 0x0: - rx_pwr_all = 16 - ((cck_agc_rpt & 0x1f) << 1); - break; - } - } - - pwdb_all = rtl_query_rxpwrpercentage(rx_pwr_all); - /* CCK gain is smaller than OFDM/MCS gain, - * so we add gain diff. From experience, the val is 6 - */ - pwdb_all += 6; - if (pwdb_all > 100) - pwdb_all = 100; - /* modify the offset to make the same - * gain index with OFDM. - */ - if (pwdb_all > 34 && pwdb_all <= 42) - pwdb_all -= 2; - else if (pwdb_all > 26 && pwdb_all <= 34) - pwdb_all -= 6; - else if (pwdb_all > 14 && pwdb_all <= 26) - pwdb_all -= 8; - else if (pwdb_all > 4 && pwdb_all <= 14) - pwdb_all -= 4; - - pstatus->rx_pwdb_all = pwdb_all; - pstatus->recvsignalpower = rx_pwr_all; - - /* (3) Get Signal Quality (EVM) */ - if (bpacket_match_bssid) { - u8 sq; - - if (pstatus->rx_pwdb_all > 40) { - sq = 100; - } else { - sq = cck_buf->sq_rpt; - if (sq > 64) - sq = 0; - else if (sq < 20) - sq = 100; - else - sq = ((64 - sq) * 100) / 44; - } - - pstatus->signalquality = sq; - pstatus->rx_mimo_sig_qual[0] = sq; - pstatus->rx_mimo_sig_qual[1] = -1; - } - } else { - rtlpriv->dm.rfpath_rxenable[0] = - rtlpriv->dm.rfpath_rxenable[1] = true; - - /* (1)Get RSSI for HT rate */ - for (i = RF90_PATH_A; i < RF6052_MAX_PATH; i++) { - - /* we will judge RF RX path now. */ - if (rtlpriv->dm.rfpath_rxenable[i]) - rf_rx_num++; - - rx_pwr[i] = ((p_drvinfo->gain_trsw[i] & 0x3f)*2) - 110; - - /* Translate DBM to percentage. */ - rssi = rtl_query_rxpwrpercentage(rx_pwr[i]); - total_rssi += rssi; - - /* Get Rx snr value in DB */ - rtlpriv->stats.rx_snr_db[i] = (p_drvinfo->rxsnr[i] / 2); - - /* Record Signal Strength for next packet */ - if (bpacket_match_bssid) - pstatus->rx_mimo_signalstrength[i] = (u8) rssi; - } - - /* (2)PWDB, Average PWDB cacluated by - * hardware (for rate adaptive) - */ - rx_pwr_all = ((p_drvinfo->pwdb_all >> 1) & 0x7f) - 110; - - pwdb_all = rtl_query_rxpwrpercentage(rx_pwr_all); - pstatus->rx_pwdb_all = pwdb_all; - pstatus->rxpower = rx_pwr_all; - pstatus->recvsignalpower = rx_pwr_all; - - /* (3)EVM of HT rate */ - if (pstatus->is_ht && pstatus->rate >= DESC92_RATEMCS8 && - pstatus->rate <= DESC92_RATEMCS15) - max_spatial_stream = 2; - else - max_spatial_stream = 1; - - for (i = 0; i < max_spatial_stream; i++) { - evm = rtl_evm_db_to_percentage(p_drvinfo->rxevm[i]); - - if (bpacket_match_bssid) { - /* Fill value in RFD, Get the first - * spatial stream only - */ - if (i == 0) - pstatus->signalquality = (evm & 0xff); - pstatus->rx_mimo_sig_qual[i] = (evm & 0xff); - } - } - } - - /* UI BSS List signal strength(in percentage), - * make it good looking, from 0~100. - */ - if (is_cck) - pstatus->signalstrength = (u8)(rtl_signal_scale_mapping(hw, - pwdb_all)); - else if (rf_rx_num != 0) - pstatus->signalstrength = (u8)(rtl_signal_scale_mapping(hw, - total_rssi /= rf_rx_num)); -} - -static void _rtl8723ae_translate_rx_signal_stuff(struct ieee80211_hw *hw, - struct sk_buff *skb, struct rtl_stats *pstatus, - u8 *pdesc, struct rx_fwinfo_8723e *p_drvinfo) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct ieee80211_hdr *hdr; - u8 *tmp_buf; - u8 *praddr; - __le16 fc; - u16 type; - bool packet_matchbssid, packet_toself, packet_beacon = false; - - tmp_buf = skb->data + pstatus->rx_drvinfo_size + pstatus->rx_bufshift; - - hdr = (struct ieee80211_hdr *)tmp_buf; - fc = hdr->frame_control; - type = WLAN_FC_GET_TYPE(fc); - praddr = hdr->addr1; - - packet_matchbssid = ((IEEE80211_FTYPE_CTL != type) && - (!compare_ether_addr(mac->bssid, - (le16_to_cpu(fc) & IEEE80211_FCTL_TODS) ? - hdr->addr1 : (le16_to_cpu(fc) & - IEEE80211_FCTL_FROMDS) ? - hdr->addr2 : hdr->addr3)) && (!pstatus->hwerror) && - (!pstatus->crc) && (!pstatus->icv)); - - packet_toself = packet_matchbssid && - (!compare_ether_addr(praddr, rtlefuse->dev_addr)); - - if (ieee80211_is_beacon(fc)) - packet_beacon = true; - - _rtl8723ae_query_rxphystatus(hw, pstatus, pdesc, p_drvinfo, - packet_matchbssid, packet_toself, - packet_beacon); - - rtl_process_phyinfo(hw, tmp_buf, pstatus); -} - -bool rtl8723ae_rx_query_desc(struct ieee80211_hw *hw, - struct rtl_stats *status, - struct ieee80211_rx_status *rx_status, - u8 *pdesc, struct sk_buff *skb) -{ - struct rx_fwinfo_8723e *p_drvinfo; - struct ieee80211_hdr *hdr; - u32 phystatus = GET_RX_DESC_PHYST(pdesc); - - status->length = (u16) GET_RX_DESC_PKT_LEN(pdesc); - status->rx_drvinfo_size = (u8) GET_RX_DESC_DRV_INFO_SIZE(pdesc) * - RX_DRV_INFO_SIZE_UNIT; - status->rx_bufshift = (u8) (GET_RX_DESC_SHIFT(pdesc) & 0x03); - status->icv = (u16) GET_RX_DESC_ICV(pdesc); - status->crc = (u16) GET_RX_DESC_CRC32(pdesc); - status->hwerror = (status->crc | status->icv); - status->decrypted = !GET_RX_DESC_SWDEC(pdesc); - status->rate = (u8) GET_RX_DESC_RXMCS(pdesc); - status->shortpreamble = (u16) GET_RX_DESC_SPLCP(pdesc); - status->isampdu = (bool) (GET_RX_DESC_PAGGR(pdesc) == 1); - status->isfirst_ampdu = (bool) ((GET_RX_DESC_PAGGR(pdesc) == 1) - && (GET_RX_DESC_FAGGR(pdesc) == 1)); - status->timestamp_low = GET_RX_DESC_TSFL(pdesc); - status->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); - status->is_ht = (bool)GET_RX_DESC_RXHT(pdesc); - - status->is_cck = RTL8723E_RX_HAL_IS_CCK_RATE(status->rate); - - rx_status->freq = hw->conf.chandef.chan->center_freq; - rx_status->band = hw->conf.chandef.chan->band; - - if (status->crc) - rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; - - if (status->rx_is40Mhzpacket) - rx_status->flag |= RX_FLAG_40MHZ; - - if (status->is_ht) - rx_status->flag |= RX_FLAG_HT; - - rx_status->flag |= RX_FLAG_MACTIME_START; - - /* hw will set status->decrypted true, if it finds the - * frame is open data frame or mgmt frame. - * Thus hw will not decrypt a robust managment frame - * for IEEE80211w but still set status->decrypted - * true, so here we should set it back to undecrypted - * for IEEE80211w frame, and mac80211 sw will help - * to decrypt it - */ - if (status->decrypted) { - hdr = (struct ieee80211_hdr *)(skb->data + - status->rx_drvinfo_size + status->rx_bufshift); - - if (!hdr) { - /* during testing, hdr could be NULL here */ - return false; - } - if ((ieee80211_is_robust_mgmt_frame(hdr)) && - (ieee80211_has_protected(hdr->frame_control))) - rx_status->flag &= ~RX_FLAG_DECRYPTED; - else - rx_status->flag |= RX_FLAG_DECRYPTED; - } - - /* rate_idx: index of data rate into band's - * supported rates or MCS index if HT rates - * are use (RX_FLAG_HT) - */ - rx_status->rate_idx = rtlwifi_rate_mapping(hw, status->is_ht, - status->rate, false); - - rx_status->mactime = status->timestamp_low; - if (phystatus == true) { - p_drvinfo = (struct rx_fwinfo_8723e *)(skb->data + - status->rx_bufshift); - - _rtl8723ae_translate_rx_signal_stuff(hw, - skb, status, pdesc, p_drvinfo); - } - - /*rx_status->qual = status->signal; */ - rx_status->signal = status->recvsignalpower + 10; - /*rx_status->noise = -status->noise; */ - - return true; -} - -void rtl8723ae_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, u8 hw_queue, - struct rtl_tcb_desc *ptcdesc) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool defaultadapter = true; - u8 *pdesc = (u8 *) pdesc_tx; - u16 seq_number; - __le16 fc = hdr->frame_control; - u8 fw_qsel = _rtl8723ae_map_hwqueue_to_fwqueue(skb, hw_queue); - bool firstseg = ((hdr->seq_ctrl & - cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0); - bool lastseg = ((hdr->frame_control & - cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) == 0); - dma_addr_t mapping = pci_map_single(rtlpci->pdev, - skb->data, skb->len, - PCI_DMA_TODEVICE); - u8 bw_40 = 0; - - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } - if (mac->opmode == NL80211_IFTYPE_STATION) { - bw_40 = mac->bw_40; - } else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) { - if (sta) - bw_40 = sta->bandwidth >= IEEE80211_STA_RX_BW_40; - } - - seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4; - - rtl_get_tcb_desc(hw, info, sta, skb, ptcdesc); - - CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_8723e)); - - if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) { - firstseg = true; - lastseg = true; - } - - if (firstseg) { - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); - - SET_TX_DESC_TX_RATE(pdesc, ptcdesc->hw_rate); - - if (ptcdesc->use_shortgi || ptcdesc->use_shortpreamble) - SET_TX_DESC_DATA_SHORTGI(pdesc, 1); - - if (info->flags & IEEE80211_TX_CTL_AMPDU) { - SET_TX_DESC_AGG_BREAK(pdesc, 1); - SET_TX_DESC_MAX_AGG_NUM(pdesc, 0x14); - } - SET_TX_DESC_SEQ(pdesc, seq_number); - - SET_TX_DESC_RTS_ENABLE(pdesc, ((ptcdesc->rts_enable && - !ptcdesc-> - cts_enable) ? 1 : 0)); - SET_TX_DESC_HW_RTS_ENABLE(pdesc, - ((ptcdesc->rts_enable - || ptcdesc->cts_enable) ? 1 : 0)); - SET_TX_DESC_CTS2SELF(pdesc, ((ptcdesc->cts_enable) ? 1 : 0)); - SET_TX_DESC_RTS_STBC(pdesc, ((ptcdesc->rts_stbc) ? 1 : 0)); - - SET_TX_DESC_RTS_RATE(pdesc, ptcdesc->rts_rate); - SET_TX_DESC_RTS_BW(pdesc, 0); - SET_TX_DESC_RTS_SC(pdesc, ptcdesc->rts_sc); - SET_TX_DESC_RTS_SHORT(pdesc, - ((ptcdesc->rts_rate <= DESC92_RATE54M) ? - (ptcdesc->rts_use_shortpreamble ? 1 : 0) - : (ptcdesc->rts_use_shortgi ? 1 : 0))); - - if (bw_40) { - if (ptcdesc->packet_bw) { - SET_TX_DESC_DATA_BW(pdesc, 1); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, 3); - } else { - SET_TX_DESC_DATA_BW(pdesc, 0); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, - mac->cur_40_prime_sc); - } - } else { - SET_TX_DESC_DATA_BW(pdesc, 0); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, 0); - } - - SET_TX_DESC_LINIP(pdesc, 0); - SET_TX_DESC_PKT_SIZE(pdesc, (u16) skb->len); - - if (sta) { - u8 ampdu_density = sta->ht_cap.ampdu_density; - SET_TX_DESC_AMPDU_DENSITY(pdesc, ampdu_density); - } - - if (info->control.hw_key) { - struct ieee80211_key_conf *keyconf = - info->control.hw_key; - - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - case WLAN_CIPHER_SUITE_TKIP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x1); - break; - case WLAN_CIPHER_SUITE_CCMP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x3); - break; - default: - SET_TX_DESC_SEC_TYPE(pdesc, 0x0); - break; - } - } - - SET_TX_DESC_PKT_ID(pdesc, 0); - SET_TX_DESC_QUEUE_SEL(pdesc, fw_qsel); - - SET_TX_DESC_DATA_RATE_FB_LIMIT(pdesc, 0x1F); - SET_TX_DESC_RTS_RATE_FB_LIMIT(pdesc, 0xF); - SET_TX_DESC_DISABLE_FB(pdesc, 0); - SET_TX_DESC_USE_RATE(pdesc, ptcdesc->use_driver_rate ? 1 : 0); - - if (ieee80211_is_data_qos(fc)) { - if (mac->rdg_en) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "Enable RDG function.\n"); - SET_TX_DESC_RDG_ENABLE(pdesc, 1); - SET_TX_DESC_HTC(pdesc, 1); - } - } - } - - SET_TX_DESC_FIRST_SEG(pdesc, (firstseg ? 1 : 0)); - SET_TX_DESC_LAST_SEG(pdesc, (lastseg ? 1 : 0)); - - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16) skb->len); - - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping); - - if (rtlpriv->dm.useramask) { - SET_TX_DESC_RATE_ID(pdesc, ptcdesc->ratr_index); - SET_TX_DESC_MACID(pdesc, ptcdesc->mac_id); - } else { - SET_TX_DESC_RATE_ID(pdesc, 0xC + ptcdesc->ratr_index); - SET_TX_DESC_MACID(pdesc, ptcdesc->ratr_index); - } - - if ((!ieee80211_is_data_qos(fc)) && ppsc->fwctrl_lps) { - SET_TX_DESC_HWSEQ_EN_8723(pdesc, 1); - - if (!defaultadapter) - SET_TX_DESC_HWSEQ_SEL_8723(pdesc, 1); - } - - SET_TX_DESC_MORE_FRAG(pdesc, (lastseg ? 0 : 1)); - - if (is_multicast_ether_addr(ieee80211_get_DA(hdr)) || - is_broadcast_ether_addr(ieee80211_get_DA(hdr))) { - SET_TX_DESC_BMC(pdesc, 1); - } - - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, "\n"); -} - -void rtl8723ae_tx_fill_cmddesc(struct ieee80211_hw *hw, - u8 *pdesc, bool firstseg, - bool lastseg, struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); - u8 fw_queue = QSLT_BEACON; - dma_addr_t mapping = pci_map_single(rtlpci->pdev, - skb->data, skb->len, - PCI_DMA_TODEVICE); - __le16 fc = hdr->frame_control; - - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } - CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); - - if (firstseg) - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); - - SET_TX_DESC_TX_RATE(pdesc, DESC92_RATE1M); - - SET_TX_DESC_SEQ(pdesc, 0); - - SET_TX_DESC_LINIP(pdesc, 0); - - SET_TX_DESC_QUEUE_SEL(pdesc, fw_queue); - - SET_TX_DESC_FIRST_SEG(pdesc, 1); - SET_TX_DESC_LAST_SEG(pdesc, 1); - - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16) (skb->len)); - - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, mapping); - - SET_TX_DESC_RATE_ID(pdesc, 7); - SET_TX_DESC_MACID(pdesc, 0); - - SET_TX_DESC_OWN(pdesc, 1); - - SET_TX_DESC_PKT_SIZE((u8 *) pdesc, (u16) (skb->len)); - - SET_TX_DESC_FIRST_SEG(pdesc, 1); - SET_TX_DESC_LAST_SEG(pdesc, 1); - - SET_TX_DESC_OFFSET(pdesc, 0x20); - - SET_TX_DESC_USE_RATE(pdesc, 1); - - if (!ieee80211_is_data_qos(fc)) { - SET_TX_DESC_HWSEQ_EN_8723(pdesc, 1); - /* SET_TX_DESC_HWSEQ_EN(pdesc, 1); */ - /* SET_TX_DESC_PKT_ID(pdesc, 8); */ - } - - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, - "H2C Tx Cmd Content\n", - pdesc, TX_DESC_SIZE); -} - -void rtl8723ae_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val) -{ - if (istx == true) { - switch (desc_name) { - case HW_DESC_OWN: - SET_TX_DESC_OWN(pdesc, 1); - break; - case HW_DESC_TX_NEXTDESC_ADDR: - SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *) val); - break; - default: - RT_ASSERT(false, "ERR txdesc :%d not process\n", - desc_name); - break; - } - } else { - switch (desc_name) { - case HW_DESC_RXOWN: - SET_RX_DESC_OWN(pdesc, 1); - break; - case HW_DESC_RXBUFF_ADDR: - SET_RX_DESC_BUFF_ADDR(pdesc, *(u32 *) val); - break; - case HW_DESC_RXPKT_LEN: - SET_RX_DESC_PKT_LEN(pdesc, *(u32 *) val); - break; - case HW_DESC_RXERO: - SET_RX_DESC_EOR(pdesc, 1); - break; - default: - RT_ASSERT(false, "ERR rxdesc :%d not process\n", - desc_name); - break; - } - } -} - -u32 rtl8723ae_get_desc(u8 *pdesc, bool istx, u8 desc_name) -{ - u32 ret = 0; - - if (istx == true) { - switch (desc_name) { - case HW_DESC_OWN: - ret = GET_TX_DESC_OWN(pdesc); - break; - case HW_DESC_TXBUFF_ADDR: - ret = GET_TX_DESC_TX_BUFFER_ADDRESS(pdesc); - break; - default: - RT_ASSERT(false, "ERR txdesc :%d not process\n", - desc_name); - break; - } - } else { - switch (desc_name) { - case HW_DESC_OWN: - ret = GET_RX_DESC_OWN(pdesc); - break; - case HW_DESC_RXPKT_LEN: - ret = GET_RX_DESC_PKT_LEN(pdesc); - break; - default: - RT_ASSERT(false, "ERR rxdesc :%d not process\n", - desc_name); - break; - } - } - return ret; -} - -void rtl8723ae_tx_polling(struct ieee80211_hw *hw, u8 hw_queue) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - if (hw_queue == BEACON_QUEUE) { - rtl_write_word(rtlpriv, REG_PCIE_CTRL_REG, BIT(4)); - } else { - rtl_write_word(rtlpriv, REG_PCIE_CTRL_REG, - BIT(0) << (hw_queue)); - } -} diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.h b/drivers/net/wireless/rtlwifi/rtl8723ae/trx.h deleted file mode 100644 index ad05b54bc0f1..000000000000 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.h +++ /dev/null @@ -1,725 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL8723E_TRX_H__ -#define __RTL8723E_TRX_H__ - -#define TX_DESC_SIZE 64 -#define TX_DESC_AGGR_SUBFRAME_SIZE 32 - -#define RX_DESC_SIZE 32 -#define RX_DRV_INFO_SIZE_UNIT 8 - -#define TX_DESC_NEXT_DESC_OFFSET 40 -#define USB_HWDESC_HEADER_LEN 32 -#define CRCLENGTH 4 - -#define SET_TX_DESC_PKT_SIZE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 0, 16, __val) -#define SET_TX_DESC_OFFSET(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 16, 8, __val) -#define SET_TX_DESC_BMC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 24, 1, __val) -#define SET_TX_DESC_HTC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 25, 1, __val) -#define SET_TX_DESC_LAST_SEG(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 26, 1, __val) -#define SET_TX_DESC_FIRST_SEG(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 27, 1, __val) -#define SET_TX_DESC_LINIP(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 28, 1, __val) -#define SET_TX_DESC_NO_ACM(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 29, 1, __val) -#define SET_TX_DESC_GF(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 30, 1, __val) -#define SET_TX_DESC_OWN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val) - -#define GET_TX_DESC_PKT_SIZE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 0, 16) -#define GET_TX_DESC_OFFSET(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 16, 8) -#define GET_TX_DESC_BMC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 24, 1) -#define GET_TX_DESC_HTC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 25, 1) -#define GET_TX_DESC_LAST_SEG(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 26, 1) -#define GET_TX_DESC_FIRST_SEG(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 27, 1) -#define GET_TX_DESC_LINIP(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 28, 1) -#define GET_TX_DESC_NO_ACM(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 29, 1) -#define GET_TX_DESC_GF(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 30, 1) -#define GET_TX_DESC_OWN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 31, 1) - -#define SET_TX_DESC_MACID(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 0, 5, __val) -#define SET_TX_DESC_AGG_BREAK(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 5, 1, __val) -#define SET_TX_DESC_BK(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 6, 1, __val) -#define SET_TX_DESC_RDG_ENABLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 7, 1, __val) -#define SET_TX_DESC_QUEUE_SEL(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 8, 5, __val) -#define SET_TX_DESC_RDG_NAV_EXT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 13, 1, __val) -#define SET_TX_DESC_LSIG_TXOP_EN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 14, 1, __val) -#define SET_TX_DESC_PIFS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 15, 1, __val) -#define SET_TX_DESC_RATE_ID(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 16, 4, __val) -#define SET_TX_DESC_NAV_USE_HDR(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 20, 1, __val) -#define SET_TX_DESC_EN_DESC_ID(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 21, 1, __val) -#define SET_TX_DESC_SEC_TYPE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 22, 2, __val) -#define SET_TX_DESC_PKT_OFFSET(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 24, 8, __val) - -#define GET_TX_DESC_MACID(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 0, 5) -#define GET_TX_DESC_AGG_ENABLE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 5, 1) -#define GET_TX_DESC_AGG_BREAK(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 6, 1) -#define GET_TX_DESC_RDG_ENABLE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 7, 1) -#define GET_TX_DESC_QUEUE_SEL(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 8, 5) -#define GET_TX_DESC_RDG_NAV_EXT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 13, 1) -#define GET_TX_DESC_LSIG_TXOP_EN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 14, 1) -#define GET_TX_DESC_PIFS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 15, 1) -#define GET_TX_DESC_RATE_ID(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 16, 4) -#define GET_TX_DESC_NAV_USE_HDR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 20, 1) -#define GET_TX_DESC_EN_DESC_ID(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 21, 1) -#define GET_TX_DESC_SEC_TYPE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 22, 2) -#define GET_TX_DESC_PKT_OFFSET(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 24, 8) - -#define SET_TX_DESC_RTS_RC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 0, 6, __val) -#define SET_TX_DESC_DATA_RC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 6, 6, __val) -#define SET_TX_DESC_BAR_RTY_TH(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 14, 2, __val) -#define SET_TX_DESC_MORE_FRAG(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 17, 1, __val) -#define SET_TX_DESC_RAW(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 18, 1, __val) -#define SET_TX_DESC_CCX(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 19, 1, __val) -#define SET_TX_DESC_AMPDU_DENSITY(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 20, 3, __val) -#define SET_TX_DESC_ANTSEL_A(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 24, 1, __val) -#define SET_TX_DESC_ANTSEL_B(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 25, 1, __val) -#define SET_TX_DESC_TX_ANT_CCK(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 26, 2, __val) -#define SET_TX_DESC_TX_ANTL(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 28, 2, __val) -#define SET_TX_DESC_TX_ANT_HT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 30, 2, __val) - -#define GET_TX_DESC_RTS_RC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 0, 6) -#define GET_TX_DESC_DATA_RC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 6, 6) -#define GET_TX_DESC_BAR_RTY_TH(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 14, 2) -#define GET_TX_DESC_MORE_FRAG(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 17, 1) -#define GET_TX_DESC_RAW(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 18, 1) -#define GET_TX_DESC_CCX(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 19, 1) -#define GET_TX_DESC_AMPDU_DENSITY(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 20, 3) -#define GET_TX_DESC_ANTSEL_A(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 24, 1) -#define GET_TX_DESC_ANTSEL_B(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 25, 1) -#define GET_TX_DESC_TX_ANT_CCK(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 26, 2) -#define GET_TX_DESC_TX_ANTL(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 28, 2) -#define GET_TX_DESC_TX_ANT_HT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 30, 2) - -#define SET_TX_DESC_NEXT_HEAP_PAGE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 0, 8, __val) -#define SET_TX_DESC_TAIL_PAGE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 8, 8, __val) -#define SET_TX_DESC_SEQ(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 16, 12, __val) -#define SET_TX_DESC_PKT_ID(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 28, 4, __val) - -#define GET_TX_DESC_NEXT_HEAP_PAGE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 0, 8) -#define GET_TX_DESC_TAIL_PAGE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 8, 8) -#define GET_TX_DESC_SEQ(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 16, 12) -#define GET_TX_DESC_PKT_ID(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 28, 4) - -/* For RTL8723 */ -#define SET_TX_DESC_TRIGGER_INT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 30, 1, __val) -#define SET_TX_DESC_HWSEQ_EN_8723(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 31, 1, __val) -#define SET_TX_DESC_HWSEQ_SEL_8723(__pTxDesc, __Value) \ - SET_BITS_TO_LE_4BYTE(__pTxDesc+16, 6, 2, __Value) - -#define SET_TX_DESC_RTS_RATE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 0, 5, __val) -#define SET_TX_DESC_AP_DCFE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 5, 1, __val) -#define SET_TX_DESC_QOS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 6, 1, __val) -#define SET_TX_DESC_HWSEQ_EN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 7, 1, __val) -#define SET_TX_DESC_USE_RATE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 8, 1, __val) -#define SET_TX_DESC_DISABLE_RTS_FB(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 9, 1, __val) -#define SET_TX_DESC_DISABLE_FB(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 10, 1, __val) -#define SET_TX_DESC_CTS2SELF(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 11, 1, __val) -#define SET_TX_DESC_RTS_ENABLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 12, 1, __val) -#define SET_TX_DESC_HW_RTS_ENABLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 13, 1, __val) -#define SET_TX_DESC_PORT_ID(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 14, 1, __val) -#define SET_TX_DESC_WAIT_DCTS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 18, 1, __val) -#define SET_TX_DESC_CTS2AP_EN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 19, 1, __val) -#define SET_TX_DESC_TX_SUB_CARRIER(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 20, 2, __val) -#define SET_TX_DESC_TX_STBC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 22, 2, __val) -#define SET_TX_DESC_DATA_SHORT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 24, 1, __val) -#define SET_TX_DESC_DATA_BW(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 25, 1, __val) -#define SET_TX_DESC_RTS_SHORT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 26, 1, __val) -#define SET_TX_DESC_RTS_BW(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 27, 1, __val) -#define SET_TX_DESC_RTS_SC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 28, 2, __val) -#define SET_TX_DESC_RTS_STBC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 30, 2, __val) - -#define GET_TX_DESC_RTS_RATE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 0, 5) -#define GET_TX_DESC_AP_DCFE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 5, 1) -#define GET_TX_DESC_QOS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 6, 1) -#define GET_TX_DESC_HWSEQ_EN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 7, 1) -#define GET_TX_DESC_USE_RATE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 8, 1) -#define GET_TX_DESC_DISABLE_RTS_FB(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 9, 1) -#define GET_TX_DESC_DISABLE_FB(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 10, 1) -#define GET_TX_DESC_CTS2SELF(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 11, 1) -#define GET_TX_DESC_RTS_ENABLE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 12, 1) -#define GET_TX_DESC_HW_RTS_ENABLE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 13, 1) -#define GET_TX_DESC_PORT_ID(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 14, 1) -#define GET_TX_DESC_WAIT_DCTS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 18, 1) -#define GET_TX_DESC_CTS2AP_EN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 19, 1) -#define GET_TX_DESC_TX_SUB_CARRIER(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 20, 2) -#define GET_TX_DESC_TX_STBC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 22, 2) -#define GET_TX_DESC_DATA_SHORT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 24, 1) -#define GET_TX_DESC_DATA_BW(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 25, 1) -#define GET_TX_DESC_RTS_SHORT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 26, 1) -#define GET_TX_DESC_RTS_BW(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 27, 1) -#define GET_TX_DESC_RTS_SC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 28, 2) -#define GET_TX_DESC_RTS_STBC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 30, 2) - -#define SET_TX_DESC_TX_RATE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 0, 6, __val) -#define SET_TX_DESC_DATA_SHORTGI(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 6, 1, __val) -#define SET_TX_DESC_CCX_TAG(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 7, 1, __val) -#define SET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 8, 5, __val) -#define SET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 13, 4, __val) -#define SET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 17, 1, __val) -#define SET_TX_DESC_DATA_RETRY_LIMIT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 18, 6, __val) -#define SET_TX_DESC_USB_TXAGG_NUM(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 24, 8, __val) - -#define GET_TX_DESC_TX_RATE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 0, 6) -#define GET_TX_DESC_DATA_SHORTGI(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 6, 1) -#define GET_TX_DESC_CCX_TAG(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 7, 1) -#define GET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 8, 5) -#define GET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 13, 4) -#define GET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 17, 1) -#define GET_TX_DESC_DATA_RETRY_LIMIT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 18, 6) -#define GET_TX_DESC_USB_TXAGG_NUM(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 24, 8) - -#define SET_TX_DESC_TXAGC_A(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 0, 5, __val) -#define SET_TX_DESC_TXAGC_B(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 5, 5, __val) -#define SET_TX_DESC_USE_MAX_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 10, 1, __val) -#define SET_TX_DESC_MAX_AGG_NUM(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 11, 5, __val) -#define SET_TX_DESC_MCSG1_MAX_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 16, 4, __val) -#define SET_TX_DESC_MCSG2_MAX_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 20, 4, __val) -#define SET_TX_DESC_MCSG3_MAX_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 24, 4, __val) -#define SET_TX_DESC_MCS7_SGI_MAX_LEN(__pdesc, __val)\ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 28, 4, __val) - -#define GET_TX_DESC_TXAGC_A(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 0, 5) -#define GET_TX_DESC_TXAGC_B(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 5, 5) -#define GET_TX_DESC_USE_MAX_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 10, 1) -#define GET_TX_DESC_MAX_AGG_NUM(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 11, 5) -#define GET_TX_DESC_MCSG1_MAX_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 16, 4) -#define GET_TX_DESC_MCSG2_MAX_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 20, 4) -#define GET_TX_DESC_MCSG3_MAX_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 24, 4) -#define GET_TX_DESC_MCS7_SGI_MAX_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 28, 4) - -#define SET_TX_DESC_TX_BUFFER_SIZE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 16, __val) -#define SET_TX_DESC_MCSG4_MAX_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 16, 4, __val) -#define SET_TX_DESC_MCSG5_MAX_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 20, 4, __val) -#define SET_TX_DESC_MCSG6_MAX_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 24, 4, __val) -#define SET_TX_DESC_MCS15_SGI_MAX_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 28, 4, __val) - -#define GET_TX_DESC_TX_BUFFER_SIZE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+28, 0, 16) -#define GET_TX_DESC_MCSG4_MAX_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+28, 16, 4) -#define GET_TX_DESC_MCSG5_MAX_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+28, 20, 4) -#define GET_TX_DESC_MCSG6_MAX_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+28, 24, 4) -#define GET_TX_DESC_MCS15_SGI_MAX_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+28, 28, 4) - -#define SET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+32, 0, 32, __val) -#define SET_TX_DESC_TX_BUFFER_ADDRESS64(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+36, 0, 32, __val) - -#define GET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+32, 0, 32) -#define GET_TX_DESC_TX_BUFFER_ADDRESS64(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+36, 0, 32) - -#define SET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+40, 0, 32, __val) -#define SET_TX_DESC_NEXT_DESC_ADDRESS64(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+44, 0, 32, __val) - -#define GET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+40, 0, 32) -#define GET_TX_DESC_NEXT_DESC_ADDRESS64(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+44, 0, 32) - -#define GET_RX_DESC_PKT_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 0, 14) -#define GET_RX_DESC_CRC32(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 14, 1) -#define GET_RX_DESC_ICV(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 15, 1) -#define GET_RX_DESC_DRV_INFO_SIZE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 16, 4) -#define GET_RX_DESC_SECURITY(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 20, 3) -#define GET_RX_DESC_QOS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 23, 1) -#define GET_RX_DESC_SHIFT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 24, 2) -#define GET_RX_DESC_PHYST(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 26, 1) -#define GET_RX_DESC_SWDEC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 27, 1) -#define GET_RX_DESC_LS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 28, 1) -#define GET_RX_DESC_FS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 29, 1) -#define GET_RX_DESC_EOR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 30, 1) -#define GET_RX_DESC_OWN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 31, 1) - -#define SET_RX_DESC_PKT_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 0, 14, __val) -#define SET_RX_DESC_EOR(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 30, 1, __val) -#define SET_RX_DESC_OWN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val) - -#define GET_RX_DESC_MACID(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 0, 5) -#define GET_RX_DESC_TID(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 5, 4) -#define GET_RX_DESC_HWRSVD(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 9, 5) -#define GET_RX_DESC_PAGGR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 14, 1) -#define GET_RX_DESC_FAGGR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 15, 1) -#define GET_RX_DESC_A1_FIT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 16, 4) -#define GET_RX_DESC_A2_FIT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 20, 4) -#define GET_RX_DESC_PAM(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 24, 1) -#define GET_RX_DESC_PWR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 25, 1) -#define GET_RX_DESC_MD(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 26, 1) -#define GET_RX_DESC_MF(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 27, 1) -#define GET_RX_DESC_TYPE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 28, 2) -#define GET_RX_DESC_MC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 30, 1) -#define GET_RX_DESC_BC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 31, 1) -#define GET_RX_DESC_SEQ(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 0, 12) -#define GET_RX_DESC_FRAG(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 12, 4) -#define GET_RX_DESC_NEXT_PKT_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 16, 14) -#define GET_RX_DESC_NEXT_IND(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 30, 1) -#define GET_RX_DESC_RSVD(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 31, 1) - -#define GET_RX_DESC_RXMCS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 0, 6) -#define GET_RX_DESC_RXHT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 6, 1) -#define GET_RX_DESC_SPLCP(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 8, 1) -#define GET_RX_DESC_BW(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 9, 1) -#define GET_RX_DESC_HTC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 10, 1) -#define GET_RX_DESC_HWPC_ERR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 14, 1) -#define GET_RX_DESC_HWPC_IND(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 15, 1) -#define GET_RX_DESC_IV0(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 16, 16) - -#define GET_RX_DESC_IV1(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 0, 32) -#define GET_RX_DESC_TSFL(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 0, 32) - -#define GET_RX_DESC_BUFF_ADDR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 0, 32) -#define GET_RX_DESC_BUFF_ADDR64(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+28, 0, 32) - -#define SET_RX_DESC_BUFF_ADDR(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 0, 32, __val) -#define SET_RX_DESC_BUFF_ADDR64(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 32, __val) - -#define CLEAR_PCI_TX_DESC_CONTENT(__pdesc, _size) \ -do { \ - if (_size > TX_DESC_NEXT_DESC_OFFSET) \ - memset(__pdesc, 0, TX_DESC_NEXT_DESC_OFFSET); \ - else \ - memset(__pdesc, 0, _size); \ -} while (0) - -#define RTL8723E_RX_HAL_IS_CCK_RATE(rxmcs) \ - ((rxmcs) == DESC92_RATE1M || \ - (rxmcs) == DESC92_RATE2M || \ - (rxmcs) == DESC92_RATE5_5M || \ - (rxmcs) == DESC92_RATE11M) - -struct rx_fwinfo_8723e { - u8 gain_trsw[4]; - u8 pwdb_all; - u8 cfosho[4]; - u8 cfotail[4]; - char rxevm[2]; - char rxsnr[4]; - u8 pdsnr[2]; - u8 csi_current[2]; - u8 csi_target[2]; - u8 sigevm; - u8 max_ex_pwr; - u8 ex_intf_flag:1; - u8 sgi_en:1; - u8 rxsc:2; - u8 reserve:4; -} __packed; - -struct tx_desc_8723e { - u32 pktsize:16; - u32 offset:8; - u32 bmc:1; - u32 htc:1; - u32 lastseg:1; - u32 firstseg:1; - u32 linip:1; - u32 noacm:1; - u32 gf:1; - u32 own:1; - - u32 macid:5; - u32 agg_en:1; - u32 bk:1; - u32 rdg_en:1; - u32 queuesel:5; - u32 rd_nav_ext:1; - u32 lsig_txop_en:1; - u32 pifs:1; - u32 rateid:4; - u32 nav_usehdr:1; - u32 en_descid:1; - u32 sectype:2; - u32 pktoffset:8; - - u32 rts_rc:6; - u32 data_rc:6; - u32 rsvd0:2; - u32 bar_retryht:2; - u32 rsvd1:1; - u32 morefrag:1; - u32 raw:1; - u32 ccx:1; - u32 ampdudensity:3; - u32 rsvd2:1; - u32 ant_sela:1; - u32 ant_selb:1; - u32 txant_cck:2; - u32 txant_l:2; - u32 txant_ht:2; - - u32 nextheadpage:8; - u32 tailpage:8; - u32 seq:12; - u32 pktid:4; - - u32 rtsrate:5; - u32 apdcfe:1; - u32 qos:1; - u32 hwseq_enable:1; - u32 userrate:1; - u32 dis_rtsfb:1; - u32 dis_datafb:1; - u32 cts2self:1; - u32 rts_en:1; - u32 hwrts_en:1; - u32 portid:1; - u32 rsvd3:3; - u32 waitdcts:1; - u32 cts2ap_en:1; - u32 txsc:2; - u32 stbc:2; - u32 txshort:1; - u32 txbw:1; - u32 rtsshort:1; - u32 rtsbw:1; - u32 rtssc:2; - u32 rtsstbc:2; - - u32 txrate:6; - u32 shortgi:1; - u32 ccxt:1; - u32 txrate_fb_lmt:5; - u32 rtsrate_fb_lmt:4; - u32 retrylmt_en:1; - u32 txretrylmt:6; - u32 usb_txaggnum:8; - - u32 txagca:5; - u32 txagcb:5; - u32 usemaxlen:1; - u32 maxaggnum:5; - u32 mcsg1maxlen:4; - u32 mcsg2maxlen:4; - u32 mcsg3maxlen:4; - u32 mcs7sgimaxlen:4; - - u32 txbuffersize:16; - u32 mcsg4maxlen:4; - u32 mcsg5maxlen:4; - u32 mcsg6maxlen:4; - u32 mcsg15sgimaxlen:4; - - u32 txbuffaddr; - u32 txbufferaddr64; - u32 nextdescaddress; - u32 nextdescaddress64; - - u32 reserve_pass_pcie_mm_limit[4]; -} __packed; - -struct rx_desc_8723e { - u32 length:14; - u32 crc32:1; - u32 icverror:1; - u32 drv_infosize:4; - u32 security:3; - u32 qos:1; - u32 shift:2; - u32 phystatus:1; - u32 swdec:1; - u32 lastseg:1; - u32 firstseg:1; - u32 eor:1; - u32 own:1; - - u32 macid:5; - u32 tid:4; - u32 hwrsvd:5; - u32 paggr:1; - u32 faggr:1; - u32 a1_fit:4; - u32 a2_fit:4; - u32 pam:1; - u32 pwr:1; - u32 moredata:1; - u32 morefrag:1; - u32 type:2; - u32 mc:1; - u32 bc:1; - - u32 seq:12; - u32 frag:4; - u32 nextpktlen:14; - u32 nextind:1; - u32 rsvd:1; - - u32 rxmcs:6; - u32 rxht:1; - u32 amsdu:1; - u32 splcp:1; - u32 bandwidth:1; - u32 htc:1; - u32 tcpchk_rpt:1; - u32 ipcchk_rpt:1; - u32 tcpchk_valid:1; - u32 hwpcerr:1; - u32 hwpcind:1; - u32 iv0:16; - - u32 iv1; - - u32 tsfl; - - u32 bufferaddress; - u32 bufferaddress64; - -} __packed; - -void rtl8723ae_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, u8 hw_queue, - struct rtl_tcb_desc *ptcb_desc); -bool rtl8723ae_rx_query_desc(struct ieee80211_hw *hw, - struct rtl_stats *status, - struct ieee80211_rx_status *rx_status, - u8 *pdesc, struct sk_buff *skb); -void rtl8723ae_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val); -u32 rtl8723ae_get_desc(u8 *pdesc, bool istx, u8 desc_name); -void rtl8723ae_tx_polling(struct ieee80211_hw *hw, u8 hw_queue); -void rtl8723ae_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, - bool b_firstseg, bool b_lastseg, - struct sk_buff *skb); - -#endif diff --git a/drivers/net/wireless/rtlwifi/stats.c b/drivers/net/wireless/rtlwifi/stats.c deleted file mode 100644 index 8ed31744a054..000000000000 --- a/drivers/net/wireless/rtlwifi/stats.c +++ /dev/null @@ -1,268 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ -#include "wifi.h" -#include "stats.h" -#include - -u8 rtl_query_rxpwrpercentage(char antpower) -{ - if ((antpower <= -100) || (antpower >= 20)) - return 0; - else if (antpower >= 0) - return 100; - else - return 100 + antpower; -} -EXPORT_SYMBOL(rtl_query_rxpwrpercentage); - -u8 rtl_evm_db_to_percentage(char value) -{ - char ret_val; - ret_val = value; - - if (ret_val >= 0) - ret_val = 0; - if (ret_val <= -33) - ret_val = -33; - ret_val = 0 - ret_val; - ret_val *= 3; - if (ret_val == 99) - ret_val = 100; - - return ret_val; -} -EXPORT_SYMBOL(rtl_evm_db_to_percentage); - -static long rtl_translate_todbm(struct ieee80211_hw *hw, - u8 signal_strength_index) -{ - long signal_power; - - signal_power = (long)((signal_strength_index + 1) >> 1); - signal_power -= 95; - return signal_power; -} - -long rtl_signal_scale_mapping(struct ieee80211_hw *hw, long currsig) -{ - long retsig; - - if (currsig >= 61 && currsig <= 100) - retsig = 90 + ((currsig - 60) / 4); - else if (currsig >= 41 && currsig <= 60) - retsig = 78 + ((currsig - 40) / 2); - else if (currsig >= 31 && currsig <= 40) - retsig = 66 + (currsig - 30); - else if (currsig >= 21 && currsig <= 30) - retsig = 54 + (currsig - 20); - else if (currsig >= 5 && currsig <= 20) - retsig = 42 + (((currsig - 5) * 2) / 3); - else if (currsig == 4) - retsig = 36; - else if (currsig == 3) - retsig = 27; - else if (currsig == 2) - retsig = 18; - else if (currsig == 1) - retsig = 9; - else - retsig = currsig; - - return retsig; -} -EXPORT_SYMBOL(rtl_signal_scale_mapping); - -static void rtl_process_ui_rssi(struct ieee80211_hw *hw, - struct rtl_stats *pstatus) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u8 rfpath; - u32 last_rssi, tmpval; - - rtlpriv->stats.rssi_calculate_cnt++; - - if (rtlpriv->stats.ui_rssi.total_num++ >= PHY_RSSI_SLID_WIN_MAX) { - rtlpriv->stats.ui_rssi.total_num = PHY_RSSI_SLID_WIN_MAX; - last_rssi = rtlpriv->stats.ui_rssi.elements[ - rtlpriv->stats.ui_rssi.index]; - rtlpriv->stats.ui_rssi.total_val -= last_rssi; - } - rtlpriv->stats.ui_rssi.total_val += pstatus->signalstrength; - rtlpriv->stats.ui_rssi.elements[rtlpriv->stats.ui_rssi.index++] = - pstatus->signalstrength; - if (rtlpriv->stats.ui_rssi.index >= PHY_RSSI_SLID_WIN_MAX) - rtlpriv->stats.ui_rssi.index = 0; - tmpval = rtlpriv->stats.ui_rssi.total_val / - rtlpriv->stats.ui_rssi.total_num; - rtlpriv->stats.signal_strength = rtl_translate_todbm(hw, - (u8) tmpval); - pstatus->rssi = rtlpriv->stats.signal_strength; - - if (pstatus->is_cck) - return; - - for (rfpath = RF90_PATH_A; rfpath < rtlphy->num_total_rfpath; - rfpath++) { - if (rtlpriv->stats.rx_rssi_percentage[rfpath] == 0) { - rtlpriv->stats.rx_rssi_percentage[rfpath] = - pstatus->rx_mimo_signalstrength[rfpath]; - - } - if (pstatus->rx_mimo_signalstrength[rfpath] > - rtlpriv->stats.rx_rssi_percentage[rfpath]) { - rtlpriv->stats.rx_rssi_percentage[rfpath] = - ((rtlpriv->stats.rx_rssi_percentage[rfpath] * - (RX_SMOOTH_FACTOR - 1)) + - (pstatus->rx_mimo_signalstrength[rfpath])) / - (RX_SMOOTH_FACTOR); - rtlpriv->stats.rx_rssi_percentage[rfpath] = - rtlpriv->stats.rx_rssi_percentage[rfpath] + 1; - } else { - rtlpriv->stats.rx_rssi_percentage[rfpath] = - ((rtlpriv->stats.rx_rssi_percentage[rfpath] * - (RX_SMOOTH_FACTOR - 1)) + - (pstatus->rx_mimo_signalstrength[rfpath])) / - (RX_SMOOTH_FACTOR); - } - } -} - -static void rtl_update_rxsignalstatistics(struct ieee80211_hw *hw, - struct rtl_stats *pstatus) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int weighting = 0; - - if (rtlpriv->stats.recv_signal_power == 0) - rtlpriv->stats.recv_signal_power = pstatus->recvsignalpower; - if (pstatus->recvsignalpower > rtlpriv->stats.recv_signal_power) - weighting = 5; - else if (pstatus->recvsignalpower < rtlpriv->stats.recv_signal_power) - weighting = (-5); - rtlpriv->stats.recv_signal_power = (rtlpriv->stats.recv_signal_power * - 5 + pstatus->recvsignalpower + weighting) / 6; -} - -static void rtl_process_pwdb(struct ieee80211_hw *hw, struct rtl_stats *pstatus) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_sta_info *drv_priv = NULL; - struct ieee80211_sta *sta = NULL; - long undec_sm_pwdb; - - rcu_read_lock(); - if (rtlpriv->mac80211.opmode != NL80211_IFTYPE_STATION) - sta = rtl_find_sta(hw, pstatus->psaddr); - - /* adhoc or ap mode */ - if (sta) { - drv_priv = (struct rtl_sta_info *) sta->drv_priv; - undec_sm_pwdb = drv_priv->rssi_stat.undec_sm_pwdb; - } else { - undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb; - } - - if (undec_sm_pwdb < 0) - undec_sm_pwdb = pstatus->rx_pwdb_all; - if (pstatus->rx_pwdb_all > (u32) undec_sm_pwdb) { - undec_sm_pwdb = (((undec_sm_pwdb) * - (RX_SMOOTH_FACTOR - 1)) + - (pstatus->rx_pwdb_all)) / (RX_SMOOTH_FACTOR); - undec_sm_pwdb = undec_sm_pwdb + 1; - } else { - undec_sm_pwdb = (((undec_sm_pwdb) * (RX_SMOOTH_FACTOR - 1)) + - (pstatus->rx_pwdb_all)) / (RX_SMOOTH_FACTOR); - } - - if (sta) { - drv_priv->rssi_stat.undec_sm_pwdb = undec_sm_pwdb; - } else { - rtlpriv->dm.undec_sm_pwdb = undec_sm_pwdb; - } - rcu_read_unlock(); - - rtl_update_rxsignalstatistics(hw, pstatus); -} - -static void rtl_process_ui_link_quality(struct ieee80211_hw *hw, - struct rtl_stats *pstatus) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 last_evm, n_stream, tmpval; - - if (pstatus->signalquality == 0) - return; - - if (rtlpriv->stats.ui_link_quality.total_num++ >= - PHY_LINKQUALITY_SLID_WIN_MAX) { - rtlpriv->stats.ui_link_quality.total_num = - PHY_LINKQUALITY_SLID_WIN_MAX; - last_evm = rtlpriv->stats.ui_link_quality.elements[ - rtlpriv->stats.ui_link_quality.index]; - rtlpriv->stats.ui_link_quality.total_val -= last_evm; - } - rtlpriv->stats.ui_link_quality.total_val += pstatus->signalquality; - rtlpriv->stats.ui_link_quality.elements[ - rtlpriv->stats.ui_link_quality.index++] = - pstatus->signalquality; - if (rtlpriv->stats.ui_link_quality.index >= - PHY_LINKQUALITY_SLID_WIN_MAX) - rtlpriv->stats.ui_link_quality.index = 0; - tmpval = rtlpriv->stats.ui_link_quality.total_val / - rtlpriv->stats.ui_link_quality.total_num; - rtlpriv->stats.signal_quality = tmpval; - rtlpriv->stats.last_sigstrength_inpercent = tmpval; - for (n_stream = 0; n_stream < 2; n_stream++) { - if (pstatus->rx_mimo_sig_qual[n_stream] != -1) { - if (rtlpriv->stats.rx_evm_percentage[n_stream] == 0) { - rtlpriv->stats.rx_evm_percentage[n_stream] = - pstatus->rx_mimo_sig_qual[n_stream]; - } - rtlpriv->stats.rx_evm_percentage[n_stream] = - ((rtlpriv->stats.rx_evm_percentage[n_stream] - * (RX_SMOOTH_FACTOR - 1)) + - (pstatus->rx_mimo_sig_qual[n_stream] * 1)) / - (RX_SMOOTH_FACTOR); - } - } -} - -void rtl_process_phyinfo(struct ieee80211_hw *hw, u8 *buffer, - struct rtl_stats *pstatus) -{ - - if (!pstatus->packet_matchbssid) - return; - - rtl_process_ui_rssi(hw, pstatus); - rtl_process_pwdb(hw, pstatus); - rtl_process_ui_link_quality(hw, pstatus); -} -EXPORT_SYMBOL(rtl_process_phyinfo); diff --git a/drivers/net/wireless/rtlwifi/stats.h b/drivers/net/wireless/rtlwifi/stats.h deleted file mode 100644 index 0dbdc5203830..000000000000 --- a/drivers/net/wireless/rtlwifi/stats.h +++ /dev/null @@ -1,46 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL_STATS_H__ -#define __RTL_STATS_H__ - -#define PHY_RSSI_SLID_WIN_MAX 100 -#define PHY_LINKQUALITY_SLID_WIN_MAX 20 -#define PHY_BEACON_RSSI_SLID_WIN_MAX 10 - -/* Rx smooth factor */ -#define RX_SMOOTH_FACTOR 20 - -u8 rtl_query_rxpwrpercentage(char antpower); -u8 rtl_evm_db_to_percentage(char value); -long rtl_signal_scale_mapping(struct ieee80211_hw *hw, long currsig); -void rtl_process_phyinfo(struct ieee80211_hw *hw, u8 *buffer, - struct rtl_stats *pstatus); - -#endif diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c deleted file mode 100644 index 1feebdc92f41..000000000000 --- a/drivers/net/wireless/rtlwifi/usb.c +++ /dev/null @@ -1,1167 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - *****************************************************************************/ - -#include "wifi.h" -#include "core.h" -#include "usb.h" -#include "base.h" -#include "ps.h" -#include "rtl8192c/fw_common.h" -#include - -#define REALTEK_USB_VENQT_READ 0xC0 -#define REALTEK_USB_VENQT_WRITE 0x40 -#define REALTEK_USB_VENQT_CMD_REQ 0x05 -#define REALTEK_USB_VENQT_CMD_IDX 0x00 - -#define MAX_USBCTRL_VENDORREQ_TIMES 10 - -static void usbctrl_async_callback(struct urb *urb) -{ - if (urb) { - /* free dr */ - kfree(urb->setup_packet); - /* free databuf */ - kfree(urb->transfer_buffer); - } -} - -static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request, - u16 value, u16 index, void *pdata, - u16 len) -{ - int rc; - unsigned int pipe; - u8 reqtype; - struct usb_ctrlrequest *dr; - struct urb *urb; - const u16 databuf_maxlen = REALTEK_USB_VENQT_MAX_BUF_SIZE; - u8 *databuf; - - if (WARN_ON_ONCE(len > databuf_maxlen)) - len = databuf_maxlen; - - pipe = usb_sndctrlpipe(udev, 0); /* write_out */ - reqtype = REALTEK_USB_VENQT_WRITE; - - dr = kmalloc(sizeof(*dr), GFP_ATOMIC); - if (!dr) - return -ENOMEM; - - databuf = kmalloc(databuf_maxlen, GFP_ATOMIC); - if (!databuf) { - kfree(dr); - return -ENOMEM; - } - - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!urb) { - kfree(databuf); - kfree(dr); - return -ENOMEM; - } - - dr->bRequestType = reqtype; - dr->bRequest = request; - dr->wValue = cpu_to_le16(value); - dr->wIndex = cpu_to_le16(index); - dr->wLength = cpu_to_le16(len); - /* data are already in little-endian order */ - memcpy(databuf, pdata, len); - usb_fill_control_urb(urb, udev, pipe, - (unsigned char *)dr, databuf, len, - usbctrl_async_callback, NULL); - rc = usb_submit_urb(urb, GFP_ATOMIC); - if (rc < 0) { - kfree(databuf); - kfree(dr); - } - usb_free_urb(urb); - return rc; -} - -static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request, - u16 value, u16 index, void *pdata, - u16 len) -{ - unsigned int pipe; - int status; - u8 reqtype; - int vendorreq_times = 0; - static int count; - - pipe = usb_rcvctrlpipe(udev, 0); /* read_in */ - reqtype = REALTEK_USB_VENQT_READ; - - do { - status = usb_control_msg(udev, pipe, request, reqtype, value, - index, pdata, len, 0); /*max. timeout*/ - if (status < 0) { - /* firmware download is checksumed, don't retry */ - if ((value >= FW_8192C_START_ADDRESS && - value <= FW_8192C_END_ADDRESS)) - break; - } else { - break; - } - } while (++vendorreq_times < MAX_USBCTRL_VENDORREQ_TIMES); - - if (status < 0 && count++ < 4) - pr_err("reg 0x%x, usbctrl_vendorreq TimeOut! status:0x%x value=0x%x\n", - value, status, *(u32 *)pdata); - return status; -} - -static u32 _usb_read_sync(struct rtl_priv *rtlpriv, u32 addr, u16 len) -{ - struct device *dev = rtlpriv->io.dev; - struct usb_device *udev = to_usb_device(dev); - u8 request; - u16 wvalue; - u16 index; - __le32 *data; - unsigned long flags; - - spin_lock_irqsave(&rtlpriv->locks.usb_lock, flags); - if (++rtlpriv->usb_data_index >= RTL_USB_MAX_RX_COUNT) - rtlpriv->usb_data_index = 0; - data = &rtlpriv->usb_data[rtlpriv->usb_data_index]; - spin_unlock_irqrestore(&rtlpriv->locks.usb_lock, flags); - request = REALTEK_USB_VENQT_CMD_REQ; - index = REALTEK_USB_VENQT_CMD_IDX; /* n/a */ - - wvalue = (u16)addr; - _usbctrl_vendorreq_sync_read(udev, request, wvalue, index, data, len); - return le32_to_cpu(*data); -} - -static u8 _usb_read8_sync(struct rtl_priv *rtlpriv, u32 addr) -{ - return (u8)_usb_read_sync(rtlpriv, addr, 1); -} - -static u16 _usb_read16_sync(struct rtl_priv *rtlpriv, u32 addr) -{ - return (u16)_usb_read_sync(rtlpriv, addr, 2); -} - -static u32 _usb_read32_sync(struct rtl_priv *rtlpriv, u32 addr) -{ - return _usb_read_sync(rtlpriv, addr, 4); -} - -static void _usb_write_async(struct usb_device *udev, u32 addr, u32 val, - u16 len) -{ - u8 request; - u16 wvalue; - u16 index; - __le32 data; - - request = REALTEK_USB_VENQT_CMD_REQ; - index = REALTEK_USB_VENQT_CMD_IDX; /* n/a */ - wvalue = (u16)(addr&0x0000ffff); - data = cpu_to_le32(val); - _usbctrl_vendorreq_async_write(udev, request, wvalue, index, &data, - len); -} - -static void _usb_write8_async(struct rtl_priv *rtlpriv, u32 addr, u8 val) -{ - struct device *dev = rtlpriv->io.dev; - - _usb_write_async(to_usb_device(dev), addr, val, 1); -} - -static void _usb_write16_async(struct rtl_priv *rtlpriv, u32 addr, u16 val) -{ - struct device *dev = rtlpriv->io.dev; - - _usb_write_async(to_usb_device(dev), addr, val, 2); -} - -static void _usb_write32_async(struct rtl_priv *rtlpriv, u32 addr, u32 val) -{ - struct device *dev = rtlpriv->io.dev; - - _usb_write_async(to_usb_device(dev), addr, val, 4); -} - -static void _usb_writeN_sync(struct rtl_priv *rtlpriv, u32 addr, void *data, - u16 len) -{ - struct device *dev = rtlpriv->io.dev; - struct usb_device *udev = to_usb_device(dev); - u8 request = REALTEK_USB_VENQT_CMD_REQ; - u8 reqtype = REALTEK_USB_VENQT_WRITE; - u16 wvalue; - u16 index = REALTEK_USB_VENQT_CMD_IDX; - int pipe = usb_sndctrlpipe(udev, 0); /* write_out */ - u8 *buffer; - - wvalue = (u16)(addr & 0x0000ffff); - buffer = kmemdup(data, len, GFP_ATOMIC); - if (!buffer) - return; - usb_control_msg(udev, pipe, request, reqtype, wvalue, - index, buffer, len, 50); - - kfree(buffer); -} - -static void _rtl_usb_io_handler_init(struct device *dev, - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->io.dev = dev; - mutex_init(&rtlpriv->io.bb_mutex); - rtlpriv->io.write8_async = _usb_write8_async; - rtlpriv->io.write16_async = _usb_write16_async; - rtlpriv->io.write32_async = _usb_write32_async; - rtlpriv->io.read8_sync = _usb_read8_sync; - rtlpriv->io.read16_sync = _usb_read16_sync; - rtlpriv->io.read32_sync = _usb_read32_sync; - rtlpriv->io.writeN_sync = _usb_writeN_sync; -} - -static void _rtl_usb_io_handler_release(struct ieee80211_hw *hw) -{ - struct rtl_priv __maybe_unused *rtlpriv = rtl_priv(hw); - - mutex_destroy(&rtlpriv->io.bb_mutex); -} - -/** - * - * Default aggregation handler. Do nothing and just return the oldest skb. - */ -static struct sk_buff *_none_usb_tx_aggregate_hdl(struct ieee80211_hw *hw, - struct sk_buff_head *list) -{ - return skb_dequeue(list); -} - -#define IS_HIGH_SPEED_USB(udev) \ - ((USB_SPEED_HIGH == (udev)->speed) ? true : false) - -static int _rtl_usb_init_tx(struct ieee80211_hw *hw) -{ - u32 i; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - - rtlusb->max_bulk_out_size = IS_HIGH_SPEED_USB(rtlusb->udev) - ? USB_HIGH_SPEED_BULK_SIZE - : USB_FULL_SPEED_BULK_SIZE; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "USB Max Bulk-out Size=%d\n", - rtlusb->max_bulk_out_size); - - for (i = 0; i < __RTL_TXQ_NUM; i++) { - u32 ep_num = rtlusb->ep_map.ep_mapping[i]; - if (!ep_num) { - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "Invalid endpoint map setting!\n"); - return -EINVAL; - } - } - - rtlusb->usb_tx_post_hdl = - rtlpriv->cfg->usb_interface_cfg->usb_tx_post_hdl; - rtlusb->usb_tx_cleanup = - rtlpriv->cfg->usb_interface_cfg->usb_tx_cleanup; - rtlusb->usb_tx_aggregate_hdl = - (rtlpriv->cfg->usb_interface_cfg->usb_tx_aggregate_hdl) - ? rtlpriv->cfg->usb_interface_cfg->usb_tx_aggregate_hdl - : &_none_usb_tx_aggregate_hdl; - - init_usb_anchor(&rtlusb->tx_submitted); - for (i = 0; i < RTL_USB_MAX_EP_NUM; i++) { - skb_queue_head_init(&rtlusb->tx_skb_queue[i]); - init_usb_anchor(&rtlusb->tx_pending[i]); - } - return 0; -} - -static void _rtl_rx_work(unsigned long param); - -static int _rtl_usb_init_rx(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_usb_priv *usb_priv = rtl_usbpriv(hw); - struct rtl_usb *rtlusb = rtl_usbdev(usb_priv); - - rtlusb->rx_max_size = rtlpriv->cfg->usb_interface_cfg->rx_max_size; - rtlusb->rx_urb_num = rtlpriv->cfg->usb_interface_cfg->rx_urb_num; - rtlusb->in_ep = rtlpriv->cfg->usb_interface_cfg->in_ep_num; - rtlusb->usb_rx_hdl = rtlpriv->cfg->usb_interface_cfg->usb_rx_hdl; - rtlusb->usb_rx_segregate_hdl = - rtlpriv->cfg->usb_interface_cfg->usb_rx_segregate_hdl; - - pr_info("rx_max_size %d, rx_urb_num %d, in_ep %d\n", - rtlusb->rx_max_size, rtlusb->rx_urb_num, rtlusb->in_ep); - init_usb_anchor(&rtlusb->rx_submitted); - init_usb_anchor(&rtlusb->rx_cleanup_urbs); - - skb_queue_head_init(&rtlusb->rx_queue); - rtlusb->rx_work_tasklet.func = _rtl_rx_work; - rtlusb->rx_work_tasklet.data = (unsigned long)rtlusb; - - return 0; -} - -static int _rtl_usb_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_usb_priv *usb_priv = rtl_usbpriv(hw); - struct rtl_usb *rtlusb = rtl_usbdev(usb_priv); - int err; - u8 epidx; - struct usb_interface *usb_intf = rtlusb->intf; - u8 epnums = usb_intf->cur_altsetting->desc.bNumEndpoints; - - rtlusb->out_ep_nums = rtlusb->in_ep_nums = 0; - for (epidx = 0; epidx < epnums; epidx++) { - struct usb_endpoint_descriptor *pep_desc; - pep_desc = &usb_intf->cur_altsetting->endpoint[epidx].desc; - - if (usb_endpoint_dir_in(pep_desc)) - rtlusb->in_ep_nums++; - else if (usb_endpoint_dir_out(pep_desc)) - rtlusb->out_ep_nums++; - - RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, - "USB EP(0x%02x), MaxPacketSize=%d, Interval=%d\n", - pep_desc->bEndpointAddress, pep_desc->wMaxPacketSize, - pep_desc->bInterval); - } - if (rtlusb->in_ep_nums < rtlpriv->cfg->usb_interface_cfg->in_ep_num) { - pr_err("Too few input end points found\n"); - return -EINVAL; - } - if (rtlusb->out_ep_nums == 0) { - pr_err("No output end points found\n"); - return -EINVAL; - } - /* usb endpoint mapping */ - err = rtlpriv->cfg->usb_interface_cfg->usb_endpoint_mapping(hw); - rtlusb->usb_mq_to_hwq = rtlpriv->cfg->usb_interface_cfg->usb_mq_to_hwq; - _rtl_usb_init_tx(hw); - _rtl_usb_init_rx(hw); - return err; -} - -static void rtl_usb_init_sw(struct ieee80211_hw *hw) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - - rtlhal->hw = hw; - ppsc->inactiveps = false; - ppsc->leisure_ps = false; - ppsc->fwctrl_lps = false; - ppsc->reg_fwctrl_lps = 3; - ppsc->reg_max_lps_awakeintvl = 5; - ppsc->fwctrl_psmode = FW_PS_DTIM_MODE; - - /* IBSS */ - mac->beacon_interval = 100; - - /* AMPDU */ - mac->min_space_cfg = 0; - mac->max_mss_density = 0; - - /* set sane AMPDU defaults */ - mac->current_ampdu_density = 7; - mac->current_ampdu_factor = 3; - - /* QOS */ - rtlusb->acm_method = eAcmWay2_SW; - - /* IRQ */ - /* HIMR - turn all on */ - rtlusb->irq_mask[0] = 0xFFFFFFFF; - /* HIMR_EX - turn all on */ - rtlusb->irq_mask[1] = 0xFFFFFFFF; - rtlusb->disableHWSM = true; -} - -static void _rtl_rx_completed(struct urb *urb); - -static int _rtl_prep_rx_urb(struct ieee80211_hw *hw, struct rtl_usb *rtlusb, - struct urb *urb, gfp_t gfp_mask) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - void *buf; - - buf = usb_alloc_coherent(rtlusb->udev, rtlusb->rx_max_size, gfp_mask, - &urb->transfer_dma); - if (!buf) { - RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, - "Failed to usb_alloc_coherent!!\n"); - return -ENOMEM; - } - - usb_fill_bulk_urb(urb, rtlusb->udev, - usb_rcvbulkpipe(rtlusb->udev, rtlusb->in_ep), - buf, rtlusb->rx_max_size, _rtl_rx_completed, rtlusb); - urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - - return 0; -} - -static void _rtl_usb_rx_process_agg(struct ieee80211_hw *hw, - struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 *rxdesc = skb->data; - struct ieee80211_hdr *hdr; - bool unicast = false; - __le16 fc; - struct ieee80211_rx_status rx_status = {0}; - struct rtl_stats stats = { - .signal = 0, - .noise = -98, - .rate = 0, - }; - - skb_pull(skb, RTL_RX_DESC_SIZE); - rtlpriv->cfg->ops->query_rx_desc(hw, &stats, &rx_status, rxdesc, skb); - skb_pull(skb, (stats.rx_drvinfo_size + stats.rx_bufshift)); - hdr = (struct ieee80211_hdr *)(skb->data); - fc = hdr->frame_control; - if (!stats.crc) { - memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); - - if (is_broadcast_ether_addr(hdr->addr1)) { - /*TODO*/; - } else if (is_multicast_ether_addr(hdr->addr1)) { - /*TODO*/ - } else { - unicast = true; - rtlpriv->stats.rxbytesunicast += skb->len; - } - - rtl_is_special_data(hw, skb, false); - - if (ieee80211_is_data(fc)) { - rtlpriv->cfg->ops->led_control(hw, LED_CTL_RX); - - if (unicast) - rtlpriv->link_info.num_rx_inperiod++; - } - } -} - -static void _rtl_usb_rx_process_noagg(struct ieee80211_hw *hw, - struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 *rxdesc = skb->data; - struct ieee80211_hdr *hdr; - bool unicast = false; - __le16 fc; - struct ieee80211_rx_status rx_status = {0}; - struct rtl_stats stats = { - .signal = 0, - .noise = -98, - .rate = 0, - }; - - skb_pull(skb, RTL_RX_DESC_SIZE); - rtlpriv->cfg->ops->query_rx_desc(hw, &stats, &rx_status, rxdesc, skb); - skb_pull(skb, (stats.rx_drvinfo_size + stats.rx_bufshift)); - hdr = (struct ieee80211_hdr *)(skb->data); - fc = hdr->frame_control; - if (!stats.crc) { - memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); - - if (is_broadcast_ether_addr(hdr->addr1)) { - /*TODO*/; - } else if (is_multicast_ether_addr(hdr->addr1)) { - /*TODO*/ - } else { - unicast = true; - rtlpriv->stats.rxbytesunicast += skb->len; - } - - rtl_is_special_data(hw, skb, false); - - if (ieee80211_is_data(fc)) { - rtlpriv->cfg->ops->led_control(hw, LED_CTL_RX); - - if (unicast) - rtlpriv->link_info.num_rx_inperiod++; - } - - /* static bcn for roaming */ - rtl_beacon_statistic(hw, skb); - - if (likely(rtl_action_proc(hw, skb, false))) - ieee80211_rx(hw, skb); - else - dev_kfree_skb_any(skb); - } -} - -static void _rtl_rx_pre_process(struct ieee80211_hw *hw, struct sk_buff *skb) -{ - struct sk_buff *_skb; - struct sk_buff_head rx_queue; - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - - skb_queue_head_init(&rx_queue); - if (rtlusb->usb_rx_segregate_hdl) - rtlusb->usb_rx_segregate_hdl(hw, skb, &rx_queue); - WARN_ON(skb_queue_empty(&rx_queue)); - while (!skb_queue_empty(&rx_queue)) { - _skb = skb_dequeue(&rx_queue); - _rtl_usb_rx_process_agg(hw, _skb); - ieee80211_rx(hw, _skb); - } -} - -#define __RX_SKB_MAX_QUEUED 32 - -static void _rtl_rx_work(unsigned long param) -{ - struct rtl_usb *rtlusb = (struct rtl_usb *)param; - struct ieee80211_hw *hw = usb_get_intfdata(rtlusb->intf); - struct sk_buff *skb; - - while ((skb = skb_dequeue(&rtlusb->rx_queue))) { - if (unlikely(IS_USB_STOP(rtlusb))) { - dev_kfree_skb_any(skb); - continue; - } - - if (likely(!rtlusb->usb_rx_segregate_hdl)) { - _rtl_usb_rx_process_noagg(hw, skb); - } else { - /* TO DO */ - _rtl_rx_pre_process(hw, skb); - pr_err("rx agg not supported\n"); - } - } -} - -static unsigned int _rtl_rx_get_padding(struct ieee80211_hdr *hdr, - unsigned int len) -{ - unsigned int padding = 0; - - /* make function no-op when possible */ - if (NET_IP_ALIGN == 0 || len < sizeof(*hdr)) - return 0; - - /* alignment calculation as in lbtf_rx() / carl9170_rx_copy_data() */ - /* TODO: deduplicate common code, define helper function instead? */ - - if (ieee80211_is_data_qos(hdr->frame_control)) { - u8 *qc = ieee80211_get_qos_ctl(hdr); - - padding ^= NET_IP_ALIGN; - - /* Input might be invalid, avoid accessing memory outside - * the buffer. - */ - if ((unsigned long)qc - (unsigned long)hdr < len && - *qc & IEEE80211_QOS_CTL_A_MSDU_PRESENT) - padding ^= NET_IP_ALIGN; - } - - if (ieee80211_has_a4(hdr->frame_control)) - padding ^= NET_IP_ALIGN; - - return padding; -} - -#define __RADIO_TAP_SIZE_RSV 32 - -static void _rtl_rx_completed(struct urb *_urb) -{ - struct rtl_usb *rtlusb = (struct rtl_usb *)_urb->context; - struct ieee80211_hw *hw = usb_get_intfdata(rtlusb->intf); - struct rtl_priv *rtlpriv = rtl_priv(hw); - int err = 0; - - if (unlikely(IS_USB_STOP(rtlusb))) - goto free; - - if (likely(0 == _urb->status)) { - unsigned int padding; - struct sk_buff *skb; - unsigned int qlen; - unsigned int size = _urb->actual_length; - struct ieee80211_hdr *hdr; - - if (size < RTL_RX_DESC_SIZE + sizeof(struct ieee80211_hdr)) { - RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, - "Too short packet from bulk IN! (len: %d)\n", - size); - goto resubmit; - } - - qlen = skb_queue_len(&rtlusb->rx_queue); - if (qlen >= __RX_SKB_MAX_QUEUED) { - RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, - "Pending RX skbuff queue full! (qlen: %d)\n", - qlen); - goto resubmit; - } - - hdr = (void *)(_urb->transfer_buffer + RTL_RX_DESC_SIZE); - padding = _rtl_rx_get_padding(hdr, size - RTL_RX_DESC_SIZE); - - skb = dev_alloc_skb(size + __RADIO_TAP_SIZE_RSV + padding); - if (!skb) { - RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, - "Can't allocate skb for bulk IN!\n"); - goto resubmit; - } - - _rtl_install_trx_info(rtlusb, skb, rtlusb->in_ep); - - /* Make sure the payload data is 4 byte aligned. */ - skb_reserve(skb, padding); - - /* reserve some space for mac80211's radiotap */ - skb_reserve(skb, __RADIO_TAP_SIZE_RSV); - - memcpy(skb_put(skb, size), _urb->transfer_buffer, size); - - skb_queue_tail(&rtlusb->rx_queue, skb); - tasklet_schedule(&rtlusb->rx_work_tasklet); - - goto resubmit; - } - - switch (_urb->status) { - /* disconnect */ - case -ENOENT: - case -ECONNRESET: - case -ENODEV: - case -ESHUTDOWN: - goto free; - default: - break; - } - -resubmit: - usb_anchor_urb(_urb, &rtlusb->rx_submitted); - err = usb_submit_urb(_urb, GFP_ATOMIC); - if (unlikely(err)) { - usb_unanchor_urb(_urb); - goto free; - } - return; - -free: - /* On some architectures, usb_free_coherent must not be called from - * hardirq context. Queue urb to cleanup list. - */ - usb_anchor_urb(_urb, &rtlusb->rx_cleanup_urbs); -} - -#undef __RADIO_TAP_SIZE_RSV - -static void _rtl_usb_cleanup_rx(struct ieee80211_hw *hw) -{ - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - struct urb *urb; - - usb_kill_anchored_urbs(&rtlusb->rx_submitted); - - tasklet_kill(&rtlusb->rx_work_tasklet); - skb_queue_purge(&rtlusb->rx_queue); - - while ((urb = usb_get_from_anchor(&rtlusb->rx_cleanup_urbs))) { - usb_free_coherent(urb->dev, urb->transfer_buffer_length, - urb->transfer_buffer, urb->transfer_dma); - usb_free_urb(urb); - } -} - -static int _rtl_usb_receive(struct ieee80211_hw *hw) -{ - struct urb *urb; - int err; - int i; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - - WARN_ON(0 == rtlusb->rx_urb_num); - /* 1600 == 1514 + max WLAN header + rtk info */ - WARN_ON(rtlusb->rx_max_size < 1600); - - for (i = 0; i < rtlusb->rx_urb_num; i++) { - err = -ENOMEM; - urb = usb_alloc_urb(0, GFP_KERNEL); - if (!urb) { - RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, - "Failed to alloc URB!!\n"); - goto err_out; - } - - err = _rtl_prep_rx_urb(hw, rtlusb, urb, GFP_KERNEL); - if (err < 0) { - RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, - "Failed to prep_rx_urb!!\n"); - usb_free_urb(urb); - goto err_out; - } - - usb_anchor_urb(urb, &rtlusb->rx_submitted); - err = usb_submit_urb(urb, GFP_KERNEL); - if (err) - goto err_out; - usb_free_urb(urb); - } - return 0; - -err_out: - usb_kill_anchored_urbs(&rtlusb->rx_submitted); - _rtl_usb_cleanup_rx(hw); - return err; -} - -static int rtl_usb_start(struct ieee80211_hw *hw) -{ - int err; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - - err = rtlpriv->cfg->ops->hw_init(hw); - if (!err) { - rtl_init_rx_config(hw); - - /* Enable software */ - SET_USB_START(rtlusb); - /* should after adapter start and interrupt enable. */ - set_hal_start(rtlhal); - - /* Start bulk IN */ - err = _rtl_usb_receive(hw); - } - - return err; -} -/** - * - * - */ - -/*======================= tx =========================================*/ -static void rtl_usb_cleanup(struct ieee80211_hw *hw) -{ - u32 i; - struct sk_buff *_skb; - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - struct ieee80211_tx_info *txinfo; - - SET_USB_STOP(rtlusb); - - /* clean up rx stuff. */ - _rtl_usb_cleanup_rx(hw); - - /* clean up tx stuff */ - for (i = 0; i < RTL_USB_MAX_EP_NUM; i++) { - while ((_skb = skb_dequeue(&rtlusb->tx_skb_queue[i]))) { - rtlusb->usb_tx_cleanup(hw, _skb); - txinfo = IEEE80211_SKB_CB(_skb); - ieee80211_tx_info_clear_status(txinfo); - txinfo->flags |= IEEE80211_TX_STAT_ACK; - ieee80211_tx_status_irqsafe(hw, _skb); - } - usb_kill_anchored_urbs(&rtlusb->tx_pending[i]); - } - usb_kill_anchored_urbs(&rtlusb->tx_submitted); -} - -/** - * - * We may add some struct into struct rtl_usb later. Do deinit here. - * - */ -static void rtl_usb_deinit(struct ieee80211_hw *hw) -{ - rtl_usb_cleanup(hw); -} - -static void rtl_usb_stop(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - - /* should after adapter start and interrupt enable. */ - set_hal_stop(rtlhal); - cancel_work_sync(&rtlpriv->works.fill_h2c_cmd); - /* Enable software */ - SET_USB_STOP(rtlusb); - rtl_usb_deinit(hw); - rtlpriv->cfg->ops->hw_disable(hw); -} - -static void _rtl_submit_tx_urb(struct ieee80211_hw *hw, struct urb *_urb) -{ - int err; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - - usb_anchor_urb(_urb, &rtlusb->tx_submitted); - err = usb_submit_urb(_urb, GFP_ATOMIC); - if (err < 0) { - struct sk_buff *skb; - - RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, - "Failed to submit urb\n"); - usb_unanchor_urb(_urb); - skb = (struct sk_buff *)_urb->context; - kfree_skb(skb); - } - usb_free_urb(_urb); -} - -static int _usb_tx_post(struct ieee80211_hw *hw, struct urb *urb, - struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - struct ieee80211_tx_info *txinfo; - - rtlusb->usb_tx_post_hdl(hw, urb, skb); - skb_pull(skb, RTL_TX_HEADER_SIZE); - txinfo = IEEE80211_SKB_CB(skb); - ieee80211_tx_info_clear_status(txinfo); - txinfo->flags |= IEEE80211_TX_STAT_ACK; - - if (urb->status) { - RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, - "Urb has error status 0x%X\n", urb->status); - goto out; - } - /* TODO: statistics */ -out: - ieee80211_tx_status_irqsafe(hw, skb); - return urb->status; -} - -static void _rtl_tx_complete(struct urb *urb) -{ - struct sk_buff *skb = (struct sk_buff *)urb->context; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct rtl_usb *rtlusb = (struct rtl_usb *)info->rate_driver_data[0]; - struct ieee80211_hw *hw = usb_get_intfdata(rtlusb->intf); - int err; - - if (unlikely(IS_USB_STOP(rtlusb))) - return; - err = _usb_tx_post(hw, urb, skb); - if (err) { - /* Ignore error and keep issuiing other urbs */ - return; - } -} - -static struct urb *_rtl_usb_tx_urb_setup(struct ieee80211_hw *hw, - struct sk_buff *skb, u32 ep_num) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - struct urb *_urb; - - WARN_ON(NULL == skb); - _urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!_urb) { - RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, - "Can't allocate URB for bulk out!\n"); - kfree_skb(skb); - return NULL; - } - _rtl_install_trx_info(rtlusb, skb, ep_num); - usb_fill_bulk_urb(_urb, rtlusb->udev, usb_sndbulkpipe(rtlusb->udev, - ep_num), skb->data, skb->len, _rtl_tx_complete, skb); - _urb->transfer_flags |= URB_ZERO_PACKET; - return _urb; -} - -static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb, - enum rtl_txq qnum) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - u32 ep_num; - struct urb *_urb = NULL; - struct sk_buff *_skb = NULL; - - WARN_ON(NULL == rtlusb->usb_tx_aggregate_hdl); - if (unlikely(IS_USB_STOP(rtlusb))) { - RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, - "USB device is stopping...\n"); - kfree_skb(skb); - return; - } - ep_num = rtlusb->ep_map.ep_mapping[qnum]; - _skb = skb; - _urb = _rtl_usb_tx_urb_setup(hw, _skb, ep_num); - if (unlikely(!_urb)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Can't allocate urb. Drop skb!\n"); - kfree_skb(skb); - return; - } - _rtl_submit_tx_urb(hw, _urb); -} - -static void _rtl_usb_tx_preprocess(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - struct sk_buff *skb, - u16 hw_queue) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct rtl_tx_desc *pdesc = NULL; - struct rtl_tcb_desc tcb_desc; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); - __le16 fc = hdr->frame_control; - u8 *pda_addr = hdr->addr1; - /* ssn */ - u8 *qc = NULL; - u8 tid = 0; - u16 seq_number = 0; - - memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); - if (ieee80211_is_auth(fc)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, "MAC80211_LINKING\n"); - rtl_ips_nic_on(hw); - } - - if (rtlpriv->psc.sw_ps_enabled) { - if (ieee80211_is_data(fc) && !ieee80211_is_nullfunc(fc) && - !ieee80211_has_pm(fc)) - hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); - } - - rtl_action_proc(hw, skb, true); - if (is_multicast_ether_addr(pda_addr)) - rtlpriv->stats.txbytesmulticast += skb->len; - else if (is_broadcast_ether_addr(pda_addr)) - rtlpriv->stats.txbytesbroadcast += skb->len; - else - rtlpriv->stats.txbytesunicast += skb->len; - if (ieee80211_is_data_qos(fc)) { - qc = ieee80211_get_qos_ctl(hdr); - tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; - seq_number = (le16_to_cpu(hdr->seq_ctrl) & - IEEE80211_SCTL_SEQ) >> 4; - seq_number += 1; - seq_number <<= 4; - } - rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *)pdesc, info, sta, skb, - hw_queue, &tcb_desc); - if (!ieee80211_has_morefrags(hdr->frame_control)) { - if (qc) - mac->tids[tid].seq_number = seq_number; - } - if (ieee80211_is_data(fc)) - rtlpriv->cfg->ops->led_control(hw, LED_CTL_TX); -} - -static int rtl_usb_tx(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - struct sk_buff *skb, - struct rtl_tcb_desc *dummy) -{ - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); - __le16 fc = hdr->frame_control; - u16 hw_queue; - - if (unlikely(is_hal_stop(rtlhal))) - goto err_free; - hw_queue = rtlusb->usb_mq_to_hwq(fc, skb_get_queue_mapping(skb)); - _rtl_usb_tx_preprocess(hw, sta, skb, hw_queue); - _rtl_usb_transmit(hw, skb, hw_queue); - return NETDEV_TX_OK; - -err_free: - dev_kfree_skb_any(skb); - return NETDEV_TX_OK; -} - -static bool rtl_usb_tx_chk_waitq_insert(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - struct sk_buff *skb) -{ - return false; -} - -static void rtl_fill_h2c_cmd_work_callback(struct work_struct *work) -{ - struct rtl_works *rtlworks = - container_of(work, struct rtl_works, fill_h2c_cmd); - struct ieee80211_hw *hw = rtlworks->hw; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->cfg->ops->fill_h2c_cmd(hw, H2C_RA_MASK, 5, rtlpriv->rate_mask); -} - -static struct rtl_intf_ops rtl_usb_ops = { - .adapter_start = rtl_usb_start, - .adapter_stop = rtl_usb_stop, - .adapter_tx = rtl_usb_tx, - .waitq_insert = rtl_usb_tx_chk_waitq_insert, -}; - -int rtl_usb_probe(struct usb_interface *intf, - const struct usb_device_id *id, - struct rtl_hal_cfg *rtl_hal_cfg) -{ - int err; - struct ieee80211_hw *hw = NULL; - struct rtl_priv *rtlpriv = NULL; - struct usb_device *udev; - struct rtl_usb_priv *usb_priv; - - hw = ieee80211_alloc_hw(sizeof(struct rtl_priv) + - sizeof(struct rtl_usb_priv), &rtl_ops); - if (!hw) { - RT_ASSERT(false, "ieee80211 alloc failed\n"); - return -ENOMEM; - } - rtlpriv = hw->priv; - rtlpriv->usb_data = kzalloc(RTL_USB_MAX_RX_COUNT * sizeof(u32), - GFP_KERNEL); - if (!rtlpriv->usb_data) - return -ENOMEM; - - /* this spin lock must be initialized early */ - spin_lock_init(&rtlpriv->locks.usb_lock); - INIT_WORK(&rtlpriv->works.fill_h2c_cmd, - rtl_fill_h2c_cmd_work_callback); - INIT_WORK(&rtlpriv->works.lps_change_work, - rtl_lps_change_work_callback); - - rtlpriv->usb_data_index = 0; - init_completion(&rtlpriv->firmware_loading_complete); - SET_IEEE80211_DEV(hw, &intf->dev); - udev = interface_to_usbdev(intf); - usb_get_dev(udev); - usb_priv = rtl_usbpriv(hw); - memset(usb_priv, 0, sizeof(*usb_priv)); - usb_priv->dev.intf = intf; - usb_priv->dev.udev = udev; - usb_set_intfdata(intf, hw); - /* init cfg & intf_ops */ - rtlpriv->rtlhal.interface = INTF_USB; - rtlpriv->cfg = rtl_hal_cfg; - rtlpriv->intf_ops = &rtl_usb_ops; - rtl_dbgp_flag_init(hw); - /* Init IO handler */ - _rtl_usb_io_handler_init(&udev->dev, hw); - rtlpriv->cfg->ops->read_chip_version(hw); - /*like read eeprom and so on */ - rtlpriv->cfg->ops->read_eeprom_info(hw); - err = _rtl_usb_init(hw); - if (err) - goto error_out; - rtl_usb_init_sw(hw); - /* Init mac80211 sw */ - err = rtl_init_core(hw); - if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, - "Can't allocate sw for mac80211\n"); - goto error_out; - } - if (rtlpriv->cfg->ops->init_sw_vars(hw)) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); - goto error_out; - } - rtlpriv->cfg->ops->init_sw_leds(hw); - - return 0; -error_out: - rtl_deinit_core(hw); - _rtl_usb_io_handler_release(hw); - usb_put_dev(udev); - complete(&rtlpriv->firmware_loading_complete); - return -ENODEV; -} -EXPORT_SYMBOL(rtl_usb_probe); - -void rtl_usb_disconnect(struct usb_interface *intf) -{ - struct ieee80211_hw *hw = usb_get_intfdata(intf); - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *rtlmac = rtl_mac(rtl_priv(hw)); - struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); - - if (unlikely(!rtlpriv)) - return; - - /* just in case driver is removed before firmware callback */ - wait_for_completion(&rtlpriv->firmware_loading_complete); - /*ieee80211_unregister_hw will call ops_stop */ - if (rtlmac->mac80211_registered == 1) { - ieee80211_unregister_hw(hw); - rtlmac->mac80211_registered = 0; - } else { - rtl_deinit_deferred_work(hw); - rtlpriv->intf_ops->adapter_stop(hw); - } - /*deinit rfkill */ - /* rtl_deinit_rfkill(hw); */ - rtl_usb_deinit(hw); - rtl_deinit_core(hw); - kfree(rtlpriv->usb_data); - rtlpriv->cfg->ops->deinit_sw_leds(hw); - rtlpriv->cfg->ops->deinit_sw_vars(hw); - _rtl_usb_io_handler_release(hw); - usb_put_dev(rtlusb->udev); - usb_set_intfdata(intf, NULL); - ieee80211_free_hw(hw); -} -EXPORT_SYMBOL(rtl_usb_disconnect); - -int rtl_usb_suspend(struct usb_interface *pusb_intf, pm_message_t message) -{ - return 0; -} -EXPORT_SYMBOL(rtl_usb_suspend); - -int rtl_usb_resume(struct usb_interface *pusb_intf) -{ - return 0; -} -EXPORT_SYMBOL(rtl_usb_resume); diff --git a/drivers/net/wireless/rtlwifi/usb.h b/drivers/net/wireless/rtlwifi/usb.h deleted file mode 100644 index 685273ca9561..000000000000 --- a/drivers/net/wireless/rtlwifi/usb.h +++ /dev/null @@ -1,169 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - *****************************************************************************/ - -#ifndef __RTL_USB_H__ -#define __RTL_USB_H__ - -#include - -#define RTL_RX_DESC_SIZE 24 - -#define RTL_USB_DEVICE(vend, prod, cfg) \ - .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \ - .idVendor = (vend), \ - .idProduct = (prod), \ - .driver_info = (kernel_ulong_t)&(cfg) - -#define USB_HIGH_SPEED_BULK_SIZE 512 -#define USB_FULL_SPEED_BULK_SIZE 64 - - -#define RTL_USB_MAX_TXQ_NUM 4 /* max tx queue */ -#define RTL_USB_MAX_EP_NUM 6 /* max ep number */ -#define RTL_USB_MAX_TX_URBS_NUM 8 - -enum rtl_txq { - /* These definitions shall be consistent with value - * returned by skb_get_queue_mapping - *------------------------------------*/ - RTL_TXQ_BK, - RTL_TXQ_BE, - RTL_TXQ_VI, - RTL_TXQ_VO, - /*------------------------------------*/ - RTL_TXQ_BCN, - RTL_TXQ_MGT, - RTL_TXQ_HI, - - /* Must be last */ - __RTL_TXQ_NUM, -}; - -struct rtl_ep_map { - u32 ep_mapping[__RTL_TXQ_NUM]; -}; - -struct _trx_info { - struct rtl_usb *rtlusb; - u32 ep_num; -}; - -static inline void _rtl_install_trx_info(struct rtl_usb *rtlusb, - struct sk_buff *skb, - u32 ep_num) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - info->rate_driver_data[0] = rtlusb; - info->rate_driver_data[1] = (void *)(__kernel_size_t)ep_num; -} - - -/* Add suspend/resume later */ -enum rtl_usb_state { - USB_STATE_STOP = 0, - USB_STATE_START = 1, -}; - -#define IS_USB_STOP(rtlusb_ptr) (USB_STATE_STOP == (rtlusb_ptr)->state) -#define IS_USB_START(rtlusb_ptr) (USB_STATE_START == (rtlusb_ptr)->state) -#define SET_USB_STOP(rtlusb_ptr) \ - do { \ - (rtlusb_ptr)->state = USB_STATE_STOP; \ - } while (0) - -#define SET_USB_START(rtlusb_ptr) \ - do { \ - (rtlusb_ptr)->state = USB_STATE_START; \ - } while (0) - -struct rtl_usb { - struct usb_device *udev; - struct usb_interface *intf; - enum rtl_usb_state state; - - /* Bcn control register setting */ - u32 reg_bcn_ctrl_val; - /* for 88/92cu card disable */ - u8 disableHWSM; - /*QOS & EDCA */ - enum acm_method acm_method; - /* irq . HIMR,HIMR_EX */ - u32 irq_mask[2]; - bool irq_enabled; - - u16 (*usb_mq_to_hwq)(__le16 fc, u16 mac80211_queue_index); - - /* Tx */ - u8 out_ep_nums ; - u8 out_queue_sel; - struct rtl_ep_map ep_map; - - u32 max_bulk_out_size; - u32 tx_submitted_urbs; - struct sk_buff_head tx_skb_queue[RTL_USB_MAX_EP_NUM]; - - struct usb_anchor tx_pending[RTL_USB_MAX_EP_NUM]; - struct usb_anchor tx_submitted; - - struct sk_buff *(*usb_tx_aggregate_hdl)(struct ieee80211_hw *, - struct sk_buff_head *); - int (*usb_tx_post_hdl)(struct ieee80211_hw *, - struct urb *, struct sk_buff *); - void (*usb_tx_cleanup)(struct ieee80211_hw *, struct sk_buff *); - - /* Rx */ - u8 in_ep_nums; - u32 in_ep; /* Bulk IN endpoint number */ - u32 rx_max_size; /* Bulk IN max buffer size */ - u32 rx_urb_num; /* How many Bulk INs are submitted to host. */ - struct usb_anchor rx_submitted; - struct usb_anchor rx_cleanup_urbs; - struct tasklet_struct rx_work_tasklet; - struct sk_buff_head rx_queue; - void (*usb_rx_segregate_hdl)(struct ieee80211_hw *, struct sk_buff *, - struct sk_buff_head *); - void (*usb_rx_hdl)(struct ieee80211_hw *, struct sk_buff *); -}; - -struct rtl_usb_priv { - struct rtl_usb dev; - struct rtl_led_ctl ledctl; -}; - -#define rtl_usbpriv(hw) (((struct rtl_usb_priv *)(rtl_priv(hw))->priv)) -#define rtl_usbdev(usbpriv) (&((usbpriv)->dev)) - - - -int rtl_usb_probe(struct usb_interface *intf, - const struct usb_device_id *id, - struct rtl_hal_cfg *rtl92cu_hal_cfg); -void rtl_usb_disconnect(struct usb_interface *intf); -int rtl_usb_suspend(struct usb_interface *pusb_intf, pm_message_t message); -int rtl_usb_resume(struct usb_interface *pusb_intf); - -#endif diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h deleted file mode 100644 index ad9c37a42709..000000000000 --- a/drivers/net/wireless/rtlwifi/wifi.h +++ /dev/null @@ -1,2475 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2012 Realtek Corporation. - * - * 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 - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger - * - *****************************************************************************/ - -#ifndef __RTL_WIFI_H__ -#define __RTL_WIFI_H__ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include -#include "debug.h" - -#define RF_CHANGE_BY_INIT 0 -#define RF_CHANGE_BY_IPS BIT(28) -#define RF_CHANGE_BY_PS BIT(29) -#define RF_CHANGE_BY_HW BIT(30) -#define RF_CHANGE_BY_SW BIT(31) - -#define IQK_ADDA_REG_NUM 16 -#define IQK_MAC_REG_NUM 4 - -#define MAX_KEY_LEN 61 -#define KEY_BUF_SIZE 5 - -/* QoS related. */ -/*aci: 0x00 Best Effort*/ -/*aci: 0x01 Background*/ -/*aci: 0x10 Video*/ -/*aci: 0x11 Voice*/ -/*Max: define total number.*/ -#define AC0_BE 0 -#define AC1_BK 1 -#define AC2_VI 2 -#define AC3_VO 3 -#define AC_MAX 4 -#define QOS_QUEUE_NUM 4 -#define RTL_MAC80211_NUM_QUEUE 5 -#define REALTEK_USB_VENQT_MAX_BUF_SIZE 254 -#define RTL_USB_MAX_RX_COUNT 100 -#define QBSS_LOAD_SIZE 5 -#define MAX_WMMELE_LENGTH 64 - -#define TOTAL_CAM_ENTRY 32 - -/*slot time for 11g. */ -#define RTL_SLOT_TIME_9 9 -#define RTL_SLOT_TIME_20 20 - -/*related to tcp/ip. */ -#define SNAP_SIZE 6 -#define PROTOC_TYPE_SIZE 2 - -/*related with 802.11 frame*/ -#define MAC80211_3ADDR_LEN 24 -#define MAC80211_4ADDR_LEN 30 - -#define CHANNEL_MAX_NUMBER (14 + 24 + 21) /* 14 is the max channel no */ -#define CHANNEL_GROUP_MAX (3 + 9) /* ch1~3, 4~9, 10~14 = three groups */ -#define MAX_PG_GROUP 13 -#define CHANNEL_GROUP_MAX_2G 3 -#define CHANNEL_GROUP_IDX_5GL 3 -#define CHANNEL_GROUP_IDX_5GM 6 -#define CHANNEL_GROUP_IDX_5GH 9 -#define CHANNEL_GROUP_MAX_5G 9 -#define CHANNEL_MAX_NUMBER_2G 14 -#define AVG_THERMAL_NUM 8 -#define AVG_THERMAL_NUM_88E 4 -#define MAX_TID_COUNT 9 - -/* for early mode */ -#define FCS_LEN 4 -#define EM_HDR_LEN 8 - -#define MAX_TX_COUNT 4 -#define MAX_RF_PATH 4 -#define MAX_CHNL_GROUP_24G 6 -#define MAX_CHNL_GROUP_5G 14 - -struct txpower_info_2g { - u8 index_cck_base[MAX_RF_PATH][MAX_CHNL_GROUP_24G]; - u8 index_bw40_base[MAX_RF_PATH][MAX_CHNL_GROUP_24G]; - /*If only one tx, only BW20 and OFDM are used.*/ - u8 cck_diff[MAX_RF_PATH][MAX_TX_COUNT]; - u8 ofdm_diff[MAX_RF_PATH][MAX_TX_COUNT]; - u8 bw20_diff[MAX_RF_PATH][MAX_TX_COUNT]; - u8 bw40_diff[MAX_RF_PATH][MAX_TX_COUNT]; -}; - -struct txpower_info_5g { - u8 index_bw40_base[MAX_RF_PATH][MAX_CHNL_GROUP_5G]; - /*If only one tx, only BW20, OFDM, BW80 and BW160 are used.*/ - u8 ofdm_diff[MAX_RF_PATH][MAX_TX_COUNT]; - u8 bw20_diff[MAX_RF_PATH][MAX_TX_COUNT]; - u8 bw40_diff[MAX_RF_PATH][MAX_TX_COUNT]; -}; - -enum intf_type { - INTF_PCI = 0, - INTF_USB = 1, -}; - -enum radio_path { - RF90_PATH_A = 0, - RF90_PATH_B = 1, - RF90_PATH_C = 2, - RF90_PATH_D = 3, -}; - -enum rt_eeprom_type { - EEPROM_93C46, - EEPROM_93C56, - EEPROM_BOOT_EFUSE, -}; - -enum ttl_status { - RTL_STATUS_INTERFACE_START = 0, -}; - -enum hardware_type { - HARDWARE_TYPE_RTL8192E, - HARDWARE_TYPE_RTL8192U, - HARDWARE_TYPE_RTL8192SE, - HARDWARE_TYPE_RTL8192SU, - HARDWARE_TYPE_RTL8192CE, - HARDWARE_TYPE_RTL8192CU, - HARDWARE_TYPE_RTL8192DE, - HARDWARE_TYPE_RTL8192DU, - HARDWARE_TYPE_RTL8723AE, - HARDWARE_TYPE_RTL8723U, - HARDWARE_TYPE_RTL8188EE, - - /* keep it last */ - HARDWARE_TYPE_NUM -}; - -#define IS_HARDWARE_TYPE_8192SU(rtlhal) \ - (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SU) -#define IS_HARDWARE_TYPE_8192SE(rtlhal) \ - (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) -#define IS_HARDWARE_TYPE_8192CE(rtlhal) \ - (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CE) -#define IS_HARDWARE_TYPE_8192CU(rtlhal) \ - (rtlhal->hw_type == HARDWARE_TYPE_RTL8192CU) -#define IS_HARDWARE_TYPE_8192DE(rtlhal) \ - (rtlhal->hw_type == HARDWARE_TYPE_RTL8192DE) -#define IS_HARDWARE_TYPE_8192DU(rtlhal) \ - (rtlhal->hw_type == HARDWARE_TYPE_RTL8192DU) -#define IS_HARDWARE_TYPE_8723E(rtlhal) \ - (rtlhal->hw_type == HARDWARE_TYPE_RTL8723E) -#define IS_HARDWARE_TYPE_8723U(rtlhal) \ - (rtlhal->hw_type == HARDWARE_TYPE_RTL8723U) -#define IS_HARDWARE_TYPE_8192S(rtlhal) \ -(IS_HARDWARE_TYPE_8192SE(rtlhal) || IS_HARDWARE_TYPE_8192SU(rtlhal)) -#define IS_HARDWARE_TYPE_8192C(rtlhal) \ -(IS_HARDWARE_TYPE_8192CE(rtlhal) || IS_HARDWARE_TYPE_8192CU(rtlhal)) -#define IS_HARDWARE_TYPE_8192D(rtlhal) \ -(IS_HARDWARE_TYPE_8192DE(rtlhal) || IS_HARDWARE_TYPE_8192DU(rtlhal)) -#define IS_HARDWARE_TYPE_8723(rtlhal) \ -(IS_HARDWARE_TYPE_8723E(rtlhal) || IS_HARDWARE_TYPE_8723U(rtlhal)) -#define IS_HARDWARE_TYPE_8723U(rtlhal) \ - (rtlhal->hw_type == HARDWARE_TYPE_RTL8723U) - -#define RX_HAL_IS_CCK_RATE(_pdesc)\ - (_pdesc->rxmcs == DESC92_RATE1M || \ - _pdesc->rxmcs == DESC92_RATE2M || \ - _pdesc->rxmcs == DESC92_RATE5_5M || \ - _pdesc->rxmcs == DESC92_RATE11M) - -enum scan_operation_backup_opt { - SCAN_OPT_BACKUP = 0, - SCAN_OPT_RESTORE, - SCAN_OPT_MAX -}; - -/*RF state.*/ -enum rf_pwrstate { - ERFON, - ERFSLEEP, - ERFOFF -}; - -struct bb_reg_def { - u32 rfintfs; - u32 rfintfi; - u32 rfintfo; - u32 rfintfe; - u32 rf3wire_offset; - u32 rflssi_select; - u32 rftxgain_stage; - u32 rfhssi_para1; - u32 rfhssi_para2; - u32 rfsw_ctrl; - u32 rfagc_control1; - u32 rfagc_control2; - u32 rfrxiq_imbal; - u32 rfrx_afe; - u32 rftxiq_imbal; - u32 rftx_afe; - u32 rf_rb; /* rflssi_readback */ - u32 rf_rbpi; /* rflssi_readbackpi */ -}; - -enum io_type { - IO_CMD_PAUSE_DM_BY_SCAN = 0, - IO_CMD_RESUME_DM_BY_SCAN = 1, -}; - -enum hw_variables { - HW_VAR_ETHER_ADDR, - HW_VAR_MULTICAST_REG, - HW_VAR_BASIC_RATE, - HW_VAR_BSSID, - HW_VAR_MEDIA_STATUS, - HW_VAR_SECURITY_CONF, - HW_VAR_BEACON_INTERVAL, - HW_VAR_ATIM_WINDOW, - HW_VAR_LISTEN_INTERVAL, - HW_VAR_CS_COUNTER, - HW_VAR_DEFAULTKEY0, - HW_VAR_DEFAULTKEY1, - HW_VAR_DEFAULTKEY2, - HW_VAR_DEFAULTKEY3, - HW_VAR_SIFS, - HW_VAR_DIFS, - HW_VAR_EIFS, - HW_VAR_SLOT_TIME, - HW_VAR_ACK_PREAMBLE, - HW_VAR_CW_CONFIG, - HW_VAR_CW_VALUES, - HW_VAR_RATE_FALLBACK_CONTROL, - HW_VAR_CONTENTION_WINDOW, - HW_VAR_RETRY_COUNT, - HW_VAR_TR_SWITCH, - HW_VAR_COMMAND, - HW_VAR_WPA_CONFIG, - HW_VAR_AMPDU_MIN_SPACE, - HW_VAR_SHORTGI_DENSITY, - HW_VAR_AMPDU_FACTOR, - HW_VAR_MCS_RATE_AVAILABLE, - HW_VAR_AC_PARAM, - HW_VAR_ACM_CTRL, - HW_VAR_DIS_Req_Qsize, - HW_VAR_CCX_CHNL_LOAD, - HW_VAR_CCX_NOISE_HISTOGRAM, - HW_VAR_CCX_CLM_NHM, - HW_VAR_TxOPLimit, - HW_VAR_TURBO_MODE, - HW_VAR_RF_STATE, - HW_VAR_RF_OFF_BY_HW, - HW_VAR_BUS_SPEED, - HW_VAR_SET_DEV_POWER, - - HW_VAR_RCR, - HW_VAR_RATR_0, - HW_VAR_RRSR, - HW_VAR_CPU_RST, - HW_VAR_CHECK_BSSID, - HW_VAR_LBK_MODE, - HW_VAR_AES_11N_FIX, - HW_VAR_USB_RX_AGGR, - HW_VAR_USER_CONTROL_TURBO_MODE, - HW_VAR_RETRY_LIMIT, - HW_VAR_INIT_TX_RATE, - HW_VAR_TX_RATE_REG, - HW_VAR_EFUSE_USAGE, - HW_VAR_EFUSE_BYTES, - HW_VAR_AUTOLOAD_STATUS, - HW_VAR_RF_2R_DISABLE, - HW_VAR_SET_RPWM, - HW_VAR_H2C_FW_PWRMODE, - HW_VAR_H2C_FW_JOINBSSRPT, - HW_VAR_H2C_FW_P2P_PS_OFFLOAD, - HW_VAR_FW_PSMODE_STATUS, - HW_VAR_RESUME_CLK_ON, - HW_VAR_FW_LPS_ACTION, - HW_VAR_1X1_RECV_COMBINE, - HW_VAR_STOP_SEND_BEACON, - HW_VAR_TSF_TIMER, - HW_VAR_IO_CMD, - - HW_VAR_RF_RECOVERY, - HW_VAR_H2C_FW_UPDATE_GTK, - HW_VAR_WF_MASK, - HW_VAR_WF_CRC, - HW_VAR_WF_IS_MAC_ADDR, - HW_VAR_H2C_FW_OFFLOAD, - HW_VAR_RESET_WFCRC, - - HW_VAR_HANDLE_FW_C2H, - HW_VAR_DL_FW_RSVD_PAGE, - HW_VAR_AID, - HW_VAR_HW_SEQ_ENABLE, - HW_VAR_CORRECT_TSF, - HW_VAR_BCN_VALID, - HW_VAR_FWLPS_RF_ON, - HW_VAR_DUAL_TSF_RST, - HW_VAR_SWITCH_EPHY_WoWLAN, - HW_VAR_INT_MIGRATION, - HW_VAR_INT_AC, - HW_VAR_RF_TIMING, - - HAL_DEF_WOWLAN, - HW_VAR_MRC, - - HW_VAR_MGT_FILTER, - HW_VAR_CTRL_FILTER, - HW_VAR_DATA_FILTER, -}; - -enum _RT_MEDIA_STATUS { - RT_MEDIA_DISCONNECT = 0, - RT_MEDIA_CONNECT = 1 -}; - -enum rt_oem_id { - RT_CID_DEFAULT = 0, - RT_CID_8187_ALPHA0 = 1, - RT_CID_8187_SERCOMM_PS = 2, - RT_CID_8187_HW_LED = 3, - RT_CID_8187_NETGEAR = 4, - RT_CID_WHQL = 5, - RT_CID_819x_CAMEO = 6, - RT_CID_819x_RUNTOP = 7, - RT_CID_819x_Senao = 8, - RT_CID_TOSHIBA = 9, - RT_CID_819x_Netcore = 10, - RT_CID_Nettronix = 11, - RT_CID_DLINK = 12, - RT_CID_PRONET = 13, - RT_CID_COREGA = 14, - RT_CID_819x_ALPHA = 15, - RT_CID_819x_Sitecom = 16, - RT_CID_CCX = 17, - RT_CID_819x_Lenovo = 18, - RT_CID_819x_QMI = 19, - RT_CID_819x_Edimax_Belkin = 20, - RT_CID_819x_Sercomm_Belkin = 21, - RT_CID_819x_CAMEO1 = 22, - RT_CID_819x_MSI = 23, - RT_CID_819x_Acer = 24, - RT_CID_819x_HP = 27, - RT_CID_819x_CLEVO = 28, - RT_CID_819x_Arcadyan_Belkin = 29, - RT_CID_819x_SAMSUNG = 30, - RT_CID_819x_WNC_COREGA = 31, - RT_CID_819x_Foxcoon = 32, - RT_CID_819x_DELL = 33, - RT_CID_819x_PRONETS = 34, - RT_CID_819x_Edimax_ASUS = 35, - RT_CID_NETGEAR = 36, - RT_CID_PLANEX = 37, - RT_CID_CC_C = 38, -}; - -enum hw_descs { - HW_DESC_OWN, - HW_DESC_RXOWN, - HW_DESC_TX_NEXTDESC_ADDR, - HW_DESC_TXBUFF_ADDR, - HW_DESC_RXBUFF_ADDR, - HW_DESC_RXPKT_LEN, - HW_DESC_RXERO, -}; - -enum prime_sc { - PRIME_CHNL_OFFSET_DONT_CARE = 0, - PRIME_CHNL_OFFSET_LOWER = 1, - PRIME_CHNL_OFFSET_UPPER = 2, -}; - -enum rf_type { - RF_1T1R = 0, - RF_1T2R = 1, - RF_2T2R = 2, - RF_2T2R_GREEN = 3, -}; - -enum ht_channel_width { - HT_CHANNEL_WIDTH_20 = 0, - HT_CHANNEL_WIDTH_20_40 = 1, -}; - -/* Ref: 802.11i sepc D10.0 7.3.2.25.1 -Cipher Suites Encryption Algorithms */ -enum rt_enc_alg { - NO_ENCRYPTION = 0, - WEP40_ENCRYPTION = 1, - TKIP_ENCRYPTION = 2, - RSERVED_ENCRYPTION = 3, - AESCCMP_ENCRYPTION = 4, - WEP104_ENCRYPTION = 5, - AESCMAC_ENCRYPTION = 6, /*IEEE802.11w */ -}; - -enum rtl_hal_state { - _HAL_STATE_STOP = 0, - _HAL_STATE_START = 1, -}; - -enum rtl_desc92_rate { - DESC92_RATE1M = 0x00, - DESC92_RATE2M = 0x01, - DESC92_RATE5_5M = 0x02, - DESC92_RATE11M = 0x03, - - DESC92_RATE6M = 0x04, - DESC92_RATE9M = 0x05, - DESC92_RATE12M = 0x06, - DESC92_RATE18M = 0x07, - DESC92_RATE24M = 0x08, - DESC92_RATE36M = 0x09, - DESC92_RATE48M = 0x0a, - DESC92_RATE54M = 0x0b, - - DESC92_RATEMCS0 = 0x0c, - DESC92_RATEMCS1 = 0x0d, - DESC92_RATEMCS2 = 0x0e, - DESC92_RATEMCS3 = 0x0f, - DESC92_RATEMCS4 = 0x10, - DESC92_RATEMCS5 = 0x11, - DESC92_RATEMCS6 = 0x12, - DESC92_RATEMCS7 = 0x13, - DESC92_RATEMCS8 = 0x14, - DESC92_RATEMCS9 = 0x15, - DESC92_RATEMCS10 = 0x16, - DESC92_RATEMCS11 = 0x17, - DESC92_RATEMCS12 = 0x18, - DESC92_RATEMCS13 = 0x19, - DESC92_RATEMCS14 = 0x1a, - DESC92_RATEMCS15 = 0x1b, - DESC92_RATEMCS15_SG = 0x1c, - DESC92_RATEMCS32 = 0x20, -}; - -enum rtl_var_map { - /*reg map */ - SYS_ISO_CTRL = 0, - SYS_FUNC_EN, - SYS_CLK, - MAC_RCR_AM, - MAC_RCR_AB, - MAC_RCR_ACRC32, - MAC_RCR_ACF, - MAC_RCR_AAP, - - /*efuse map */ - EFUSE_TEST, - EFUSE_CTRL, - EFUSE_CLK, - EFUSE_CLK_CTRL, - EFUSE_PWC_EV12V, - EFUSE_FEN_ELDR, - EFUSE_LOADER_CLK_EN, - EFUSE_ANA8M, - EFUSE_HWSET_MAX_SIZE, - EFUSE_MAX_SECTION_MAP, - EFUSE_REAL_CONTENT_SIZE, - EFUSE_OOB_PROTECT_BYTES_LEN, - EFUSE_ACCESS, - - /*CAM map */ - RWCAM, - WCAMI, - RCAMO, - CAMDBG, - SECR, - SEC_CAM_NONE, - SEC_CAM_WEP40, - SEC_CAM_TKIP, - SEC_CAM_AES, - SEC_CAM_WEP104, - - /*IMR map */ - RTL_IMR_BCNDMAINT6, /*Beacon DMA Interrupt 6 */ - RTL_IMR_BCNDMAINT5, /*Beacon DMA Interrupt 5 */ - RTL_IMR_BCNDMAINT4, /*Beacon DMA Interrupt 4 */ - RTL_IMR_BCNDMAINT3, /*Beacon DMA Interrupt 3 */ - RTL_IMR_BCNDMAINT2, /*Beacon DMA Interrupt 2 */ - RTL_IMR_BCNDMAINT1, /*Beacon DMA Interrupt 1 */ - RTL_IMR_BCNDOK8, /*Beacon Queue DMA OK Interrup 8 */ - RTL_IMR_BCNDOK7, /*Beacon Queue DMA OK Interrup 7 */ - RTL_IMR_BCNDOK6, /*Beacon Queue DMA OK Interrup 6 */ - RTL_IMR_BCNDOK5, /*Beacon Queue DMA OK Interrup 5 */ - RTL_IMR_BCNDOK4, /*Beacon Queue DMA OK Interrup 4 */ - RTL_IMR_BCNDOK3, /*Beacon Queue DMA OK Interrup 3 */ - RTL_IMR_BCNDOK2, /*Beacon Queue DMA OK Interrup 2 */ - RTL_IMR_BCNDOK1, /*Beacon Queue DMA OK Interrup 1 */ - RTL_IMR_TIMEOUT2, /*Timeout interrupt 2 */ - RTL_IMR_TIMEOUT1, /*Timeout interrupt 1 */ - RTL_IMR_TXFOVW, /*Transmit FIFO Overflow */ - RTL_IMR_PSTIMEOUT, /*Power save time out interrupt */ - RTL_IMR_BCNINT, /*Beacon DMA Interrupt 0 */ - RTL_IMR_RXFOVW, /*Receive FIFO Overflow */ - RTL_IMR_RDU, /*Receive Descriptor Unavailable */ - RTL_IMR_ATIMEND, /*For 92C,ATIM Window End Interrupt */ - RTL_IMR_BDOK, /*Beacon Queue DMA OK Interrup */ - RTL_IMR_HIGHDOK, /*High Queue DMA OK Interrupt */ - RTL_IMR_COMDOK, /*Command Queue DMA OK Interrupt*/ - RTL_IMR_TBDOK, /*Transmit Beacon OK interrup */ - RTL_IMR_MGNTDOK, /*Management Queue DMA OK Interrupt */ - RTL_IMR_TBDER, /*For 92C,Transmit Beacon Error Interrupt */ - RTL_IMR_BKDOK, /*AC_BK DMA OK Interrupt */ - RTL_IMR_BEDOK, /*AC_BE DMA OK Interrupt */ - RTL_IMR_VIDOK, /*AC_VI DMA OK Interrupt */ - RTL_IMR_VODOK, /*AC_VO DMA Interrupt */ - RTL_IMR_ROK, /*Receive DMA OK Interrupt */ - RTL_IBSS_INT_MASKS, /*(RTL_IMR_BCNINT | RTL_IMR_TBDOK | - * RTL_IMR_TBDER) */ - RTL_IMR_C2HCMD, /*fw interrupt*/ - - /*CCK Rates, TxHT = 0 */ - RTL_RC_CCK_RATE1M, - RTL_RC_CCK_RATE2M, - RTL_RC_CCK_RATE5_5M, - RTL_RC_CCK_RATE11M, - - /*OFDM Rates, TxHT = 0 */ - RTL_RC_OFDM_RATE6M, - RTL_RC_OFDM_RATE9M, - RTL_RC_OFDM_RATE12M, - RTL_RC_OFDM_RATE18M, - RTL_RC_OFDM_RATE24M, - RTL_RC_OFDM_RATE36M, - RTL_RC_OFDM_RATE48M, - RTL_RC_OFDM_RATE54M, - - RTL_RC_HT_RATEMCS7, - RTL_RC_HT_RATEMCS15, - - /*keep it last */ - RTL_VAR_MAP_MAX, -}; - -/*Firmware PS mode for control LPS.*/ -enum _fw_ps_mode { - FW_PS_ACTIVE_MODE = 0, - FW_PS_MIN_MODE = 1, - FW_PS_MAX_MODE = 2, - FW_PS_DTIM_MODE = 3, - FW_PS_VOIP_MODE = 4, - FW_PS_UAPSD_WMM_MODE = 5, - FW_PS_UAPSD_MODE = 6, - FW_PS_IBSS_MODE = 7, - FW_PS_WWLAN_MODE = 8, - FW_PS_PM_Radio_Off = 9, - FW_PS_PM_Card_Disable = 10, -}; - -enum rt_psmode { - EACTIVE, /*Active/Continuous access. */ - EMAXPS, /*Max power save mode. */ - EFASTPS, /*Fast power save mode. */ - EAUTOPS, /*Auto power save mode. */ -}; - -/*LED related.*/ -enum led_ctl_mode { - LED_CTL_POWER_ON = 1, - LED_CTL_LINK = 2, - LED_CTL_NO_LINK = 3, - LED_CTL_TX = 4, - LED_CTL_RX = 5, - LED_CTL_SITE_SURVEY = 6, - LED_CTL_POWER_OFF = 7, - LED_CTL_START_TO_LINK = 8, - LED_CTL_START_WPS = 9, - LED_CTL_STOP_WPS = 10, -}; - -enum rtl_led_pin { - LED_PIN_GPIO0, - LED_PIN_LED0, - LED_PIN_LED1, - LED_PIN_LED2 -}; - -/*QoS related.*/ -/*acm implementation method.*/ -enum acm_method { - eAcmWay0_SwAndHw = 0, - eAcmWay1_HW = 1, - eAcmWay2_SW = 2, -}; - -enum macphy_mode { - SINGLEMAC_SINGLEPHY = 0, - DUALMAC_DUALPHY, - DUALMAC_SINGLEPHY, -}; - -enum band_type { - BAND_ON_2_4G = 0, - BAND_ON_5G, - BAND_ON_BOTH, - BANDMAX -}; - -/*aci/aifsn Field. -Ref: WMM spec 2.2.2: WME Parameter Element, p.12.*/ -union aci_aifsn { - u8 char_data; - - struct { - u8 aifsn:4; - u8 acm:1; - u8 aci:2; - u8 reserved:1; - } f; /* Field */ -}; - -/*mlme related.*/ -enum wireless_mode { - WIRELESS_MODE_UNKNOWN = 0x00, - WIRELESS_MODE_A = 0x01, - WIRELESS_MODE_B = 0x02, - WIRELESS_MODE_G = 0x04, - WIRELESS_MODE_AUTO = 0x08, - WIRELESS_MODE_N_24G = 0x10, - WIRELESS_MODE_N_5G = 0x20 -}; - -#define IS_WIRELESS_MODE_A(wirelessmode) \ - (wirelessmode == WIRELESS_MODE_A) -#define IS_WIRELESS_MODE_B(wirelessmode) \ - (wirelessmode == WIRELESS_MODE_B) -#define IS_WIRELESS_MODE_G(wirelessmode) \ - (wirelessmode == WIRELESS_MODE_G) -#define IS_WIRELESS_MODE_N_24G(wirelessmode) \ - (wirelessmode == WIRELESS_MODE_N_24G) -#define IS_WIRELESS_MODE_N_5G(wirelessmode) \ - (wirelessmode == WIRELESS_MODE_N_5G) - -enum ratr_table_mode { - RATR_INX_WIRELESS_NGB = 0, - RATR_INX_WIRELESS_NG = 1, - RATR_INX_WIRELESS_NB = 2, - RATR_INX_WIRELESS_N = 3, - RATR_INX_WIRELESS_GB = 4, - RATR_INX_WIRELESS_G = 5, - RATR_INX_WIRELESS_B = 6, - RATR_INX_WIRELESS_MC = 7, - RATR_INX_WIRELESS_A = 8, -}; - -enum rtl_link_state { - MAC80211_NOLINK = 0, - MAC80211_LINKING = 1, - MAC80211_LINKED = 2, - MAC80211_LINKED_SCANNING = 3, -}; - -enum act_category { - ACT_CAT_QOS = 1, - ACT_CAT_DLS = 2, - ACT_CAT_BA = 3, - ACT_CAT_HT = 7, - ACT_CAT_WMM = 17, -}; - -enum ba_action { - ACT_ADDBAREQ = 0, - ACT_ADDBARSP = 1, - ACT_DELBA = 2, -}; - -enum rt_polarity_ctl { - RT_POLARITY_LOW_ACT = 0, - RT_POLARITY_HIGH_ACT = 1, -}; - -struct octet_string { - u8 *octet; - u16 length; -}; - -struct rtl_hdr_3addr { - __le16 frame_ctl; - __le16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 addr3[ETH_ALEN]; - __le16 seq_ctl; - u8 payload[0]; -} __packed; - -struct rtl_info_element { - u8 id; - u8 len; - u8 data[0]; -} __packed; - -struct rtl_probe_rsp { - struct rtl_hdr_3addr header; - u32 time_stamp[2]; - __le16 beacon_interval; - __le16 capability; - /*SSID, supported rates, FH params, DS params, - CF params, IBSS params, TIM (if beacon), RSN */ - struct rtl_info_element info_element[0]; -} __packed; - -/*LED related.*/ -/*ledpin Identify how to implement this SW led.*/ -struct rtl_led { - void *hw; - enum rtl_led_pin ledpin; - bool ledon; -}; - -struct rtl_led_ctl { - bool led_opendrain; - struct rtl_led sw_led0; - struct rtl_led sw_led1; -}; - -struct rtl_qos_parameters { - __le16 cw_min; - __le16 cw_max; - u8 aifs; - u8 flag; - __le16 tx_op; -} __packed; - -struct rt_smooth_data { - u32 elements[100]; /*array to store values */ - u32 index; /*index to current array to store */ - u32 total_num; /*num of valid elements */ - u32 total_val; /*sum of valid elements */ -}; - -struct false_alarm_statistics { - u32 cnt_parity_fail; - u32 cnt_rate_illegal; - u32 cnt_crc8_fail; - u32 cnt_mcs_fail; - u32 cnt_fast_fsync_fail; - u32 cnt_sb_search_fail; - u32 cnt_ofdm_fail; - u32 cnt_cck_fail; - u32 cnt_all; - u32 cnt_ofdm_cca; - u32 cnt_cck_cca; - u32 cnt_cca_all; - u32 cnt_bw_usc; - u32 cnt_bw_lsc; -}; - -struct init_gain { - u8 xaagccore1; - u8 xbagccore1; - u8 xcagccore1; - u8 xdagccore1; - u8 cca; - -}; - -struct wireless_stats { - unsigned long txbytesunicast; - unsigned long txbytesmulticast; - unsigned long txbytesbroadcast; - unsigned long rxbytesunicast; - - long rx_snr_db[4]; - /*Correct smoothed ss in Dbm, only used - in driver to report real power now. */ - long recv_signal_power; - long signal_quality; - long last_sigstrength_inpercent; - - u32 rssi_calculate_cnt; - - /*Transformed, in dbm. Beautified signal - strength for UI, not correct. */ - long signal_strength; - - u8 rx_rssi_percentage[4]; - u8 rx_evm_percentage[2]; - - struct rt_smooth_data ui_rssi; - struct rt_smooth_data ui_link_quality; -}; - -struct rate_adaptive { - u8 rate_adaptive_disabled; - u8 ratr_state; - u16 reserve; - - u32 high_rssi_thresh_for_ra; - u32 high2low_rssi_thresh_for_ra; - u8 low2high_rssi_thresh_for_ra40m; - u32 low_rssi_thresh_for_ra40M; - u8 low2high_rssi_thresh_for_ra20m; - u32 low_rssi_thresh_for_ra20M; - u32 upper_rssi_threshold_ratr; - u32 middleupper_rssi_threshold_ratr; - u32 middle_rssi_threshold_ratr; - u32 middlelow_rssi_threshold_ratr; - u32 low_rssi_threshold_ratr; - u32 ultralow_rssi_threshold_ratr; - u32 low_rssi_threshold_ratr_40m; - u32 low_rssi_threshold_ratr_20m; - u8 ping_rssi_enable; - u32 ping_rssi_ratr; - u32 ping_rssi_thresh_for_ra; - u32 last_ratr; - u8 pre_ratr_state; -}; - -struct regd_pair_mapping { - u16 reg_dmnenum; - u16 reg_5ghz_ctl; - u16 reg_2ghz_ctl; -}; - -struct rtl_regulatory { - char alpha2[2]; - u16 country_code; - u16 max_power_level; - u32 tp_scale; - u16 current_rd; - u16 current_rd_ext; - int16_t power_limit; - struct regd_pair_mapping *regpair; -}; - -struct rtl_rfkill { - bool rfkill_state; /*0 is off, 1 is on */ -}; - -/*for P2P PS**/ -#define P2P_MAX_NOA_NUM 2 - -enum p2p_role { - P2P_ROLE_DISABLE = 0, - P2P_ROLE_DEVICE = 1, - P2P_ROLE_CLIENT = 2, - P2P_ROLE_GO = 3 -}; - -enum p2p_ps_state { - P2P_PS_DISABLE = 0, - P2P_PS_ENABLE = 1, - P2P_PS_SCAN = 2, - P2P_PS_SCAN_DONE = 3, - P2P_PS_ALLSTASLEEP = 4, /* for P2P GO */ -}; - -enum p2p_ps_mode { - P2P_PS_NONE = 0, - P2P_PS_CTWINDOW = 1, - P2P_PS_NOA = 2, - P2P_PS_MIX = 3, /* CTWindow and NoA */ -}; - -struct rtl_p2p_ps_info { - enum p2p_ps_mode p2p_ps_mode; /* indicate p2p ps mode */ - enum p2p_ps_state p2p_ps_state; /* indicate p2p ps state */ - u8 noa_index; /* Identifies instance of Notice of Absence timing. */ - /* Client traffic window. A period of time in TU after TBTT. */ - u8 ctwindow; - u8 opp_ps; /* opportunistic power save. */ - u8 noa_num; /* number of NoA descriptor in P2P IE. */ - /* Count for owner, Type of client. */ - u8 noa_count_type[P2P_MAX_NOA_NUM]; - /* Max duration for owner, preferred or min acceptable duration - * for client. - */ - u32 noa_duration[P2P_MAX_NOA_NUM]; - /* Length of interval for owner, preferred or max acceptable intervali - * of client. - */ - u32 noa_interval[P2P_MAX_NOA_NUM]; - /* schedule in terms of the lower 4 bytes of the TSF timer. */ - u32 noa_start_time[P2P_MAX_NOA_NUM]; -}; - -struct p2p_ps_offload_t { - u8 offload_en:1; - u8 role:1; /* 1: Owner, 0: Client */ - u8 ctwindow_en:1; - u8 noa0_en:1; - u8 noa1_en:1; - u8 allstasleep:1; - u8 discovery:1; - u8 reserved:1; -}; - -#define IQK_MATRIX_REG_NUM 8 -#define IQK_MATRIX_SETTINGS_NUM (1 + 24 + 21) - -struct iqk_matrix_regs { - bool iqk_done; - long value[1][IQK_MATRIX_REG_NUM]; -}; - -struct phy_parameters { - u16 length; - u32 *pdata; -}; - -enum hw_param_tab_index { - PHY_REG_2T, - PHY_REG_1T, - PHY_REG_PG, - RADIOA_2T, - RADIOB_2T, - RADIOA_1T, - RADIOB_1T, - MAC_REG, - AGCTAB_2T, - AGCTAB_1T, - MAX_TAB -}; - -struct rtl_phy { - struct bb_reg_def phyreg_def[4]; /*Radio A/B/C/D */ - struct init_gain initgain_backup; - enum io_type current_io_type; - - u8 rf_mode; - u8 rf_type; - u8 current_chan_bw; - u8 set_bwmode_inprogress; - u8 sw_chnl_inprogress; - u8 sw_chnl_stage; - u8 sw_chnl_step; - u8 current_channel; - u8 h2c_box_num; - u8 set_io_inprogress; - u8 lck_inprogress; - - /* record for power tracking */ - s32 reg_e94; - s32 reg_e9c; - s32 reg_ea4; - s32 reg_eac; - s32 reg_eb4; - s32 reg_ebc; - s32 reg_ec4; - s32 reg_ecc; - u8 rfpienable; - u8 reserve_0; - u16 reserve_1; - u32 reg_c04, reg_c08, reg_874; - u32 adda_backup[16]; - u32 iqk_mac_backup[IQK_MAC_REG_NUM]; - u32 iqk_bb_backup[10]; - bool iqk_initialized; - - /* Dual mac */ - bool need_iqk; - struct iqk_matrix_regs iqk_matrix[IQK_MATRIX_SETTINGS_NUM]; - - bool rfpi_enable; - - u8 pwrgroup_cnt; - u8 cck_high_power; - /* MAX_PG_GROUP groups of pwr diff by rates */ - u32 mcs_offset[MAX_PG_GROUP][16]; - u8 default_initialgain[4]; - - /* the current Tx power level */ - u8 cur_cck_txpwridx; - u8 cur_ofdm24g_txpwridx; - u8 cur_bw20_txpwridx; - u8 cur_bw40_txpwridx; - - u32 rfreg_chnlval[2]; - bool apk_done; - u32 reg_rf3c[2]; /* pathA / pathB */ - - /* bfsync */ - u8 framesync; - u32 framesync_c34; - - u8 num_total_rfpath; - struct phy_parameters hwparam_tables[MAX_TAB]; - u16 rf_pathmap; - - enum rt_polarity_ctl polarity_ctl; -}; - -#define MAX_TID_COUNT 9 -#define RTL_AGG_STOP 0 -#define RTL_AGG_PROGRESS 1 -#define RTL_AGG_START 2 -#define RTL_AGG_OPERATIONAL 3 -#define RTL_AGG_OFF 0 -#define RTL_AGG_ON 1 -#define RTL_RX_AGG_START 1 -#define RTL_RX_AGG_STOP 0 -#define RTL_AGG_EMPTYING_HW_QUEUE_ADDBA 2 -#define RTL_AGG_EMPTYING_HW_QUEUE_DELBA 3 - -struct rtl_ht_agg { - u16 txq_id; - u16 wait_for_ba; - u16 start_idx; - u64 bitmap; - u32 rate_n_flags; - u8 agg_state; - u8 rx_agg_state; -}; - -struct rssi_sta { - long undec_sm_pwdb; -}; - -struct rtl_tid_data { - u16 seq_number; - struct rtl_ht_agg agg; -}; - -struct rtl_sta_info { - struct list_head list; - u8 ratr_index; - u8 wireless_mode; - u8 mimo_ps; - u8 mac_addr[ETH_ALEN]; - struct rtl_tid_data tids[MAX_TID_COUNT]; - - /* just used for ap adhoc or mesh*/ - struct rssi_sta rssi_stat; -} __packed; - -struct rtl_priv; -struct rtl_io { - struct device *dev; - struct mutex bb_mutex; - - /*PCI MEM map */ - unsigned long pci_mem_end; /*shared mem end */ - unsigned long pci_mem_start; /*shared mem start */ - - /*PCI IO map */ - unsigned long pci_base_addr; /*device I/O address */ - - void (*write8_async) (struct rtl_priv *rtlpriv, u32 addr, u8 val); - void (*write16_async) (struct rtl_priv *rtlpriv, u32 addr, u16 val); - void (*write32_async) (struct rtl_priv *rtlpriv, u32 addr, u32 val); - void (*writeN_sync) (struct rtl_priv *rtlpriv, u32 addr, void *buf, - u16 len); - - u8(*read8_sync) (struct rtl_priv *rtlpriv, u32 addr); - u16(*read16_sync) (struct rtl_priv *rtlpriv, u32 addr); - u32(*read32_sync) (struct rtl_priv *rtlpriv, u32 addr); - -}; - -struct rtl_mac { - u8 mac_addr[ETH_ALEN]; - u8 mac80211_registered; - u8 beacon_enabled; - - u32 tx_ss_num; - u32 rx_ss_num; - - struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; - struct ieee80211_hw *hw; - struct ieee80211_vif *vif; - enum nl80211_iftype opmode; - - /*Probe Beacon management */ - struct rtl_tid_data tids[MAX_TID_COUNT]; - enum rtl_link_state link_state; - - int n_channels; - int n_bitrates; - - bool offchan_delay; - u8 p2p; /*using p2p role*/ - bool p2p_in_use; - - /*filters */ - u32 rx_conf; - u16 rx_mgt_filter; - u16 rx_ctrl_filter; - u16 rx_data_filter; - - bool act_scanning; - u8 cnt_after_linked; - bool skip_scan; - - /* early mode */ - /* skb wait queue */ - struct sk_buff_head skb_waitq[MAX_TID_COUNT]; - - /*RDG*/ - bool rdg_en; - - /*AP*/ - u8 bssid[6]; - u32 vendor; - u8 mcs[16]; /* 16 bytes mcs for HT rates. */ - u32 basic_rates; /* b/g rates */ - u8 ht_enable; - u8 sgi_40; - u8 sgi_20; - u8 bw_40; - u8 mode; /* wireless mode */ - u8 slot_time; - u8 short_preamble; - u8 use_cts_protect; - u8 cur_40_prime_sc; - u8 cur_40_prime_sc_bk; - u64 tsf; - u8 retry_short; - u8 retry_long; - u16 assoc_id; - bool hiddenssid; - - /*IBSS*/ - int beacon_interval; - - /*AMPDU*/ - u8 min_space_cfg; /*For Min spacing configurations */ - u8 max_mss_density; - u8 current_ampdu_factor; - u8 current_ampdu_density; - - /*QOS & EDCA */ - struct ieee80211_tx_queue_params edca_param[RTL_MAC80211_NUM_QUEUE]; - struct rtl_qos_parameters ac[AC_MAX]; - - /* counters */ - u64 last_txok_cnt; - u64 last_rxok_cnt; - u32 last_bt_edca_ul; - u32 last_bt_edca_dl; -}; - -struct btdm_8723 { - bool all_off; - bool agc_table_en; - bool adc_back_off_on; - bool b2_ant_hid_en; - bool low_penalty_rate_adaptive; - bool rf_rx_lpf_shrink; - bool reject_aggre_pkt; - bool tra_tdma_on; - u8 tra_tdma_nav; - u8 tra_tdma_ant; - bool tdma_on; - u8 tdma_ant; - u8 tdma_nav; - u8 tdma_dac_swing; - u8 fw_dac_swing_lvl; - bool ps_tdma_on; - u8 ps_tdma_byte[5]; - bool pta_on; - u32 val_0x6c0; - u32 val_0x6c8; - u32 val_0x6cc; - bool sw_dac_swing_on; - u32 sw_dac_swing_lvl; - u32 wlan_act_hi; - u32 wlan_act_lo; - u32 bt_retry_index; - bool dec_bt_pwr; - bool ignore_wlan_act; -}; - -struct bt_coexist_8723 { - u32 high_priority_tx; - u32 high_priority_rx; - u32 low_priority_tx; - u32 low_priority_rx; - u8 c2h_bt_info; - bool c2h_bt_info_req_sent; - bool c2h_bt_inquiry_page; - u32 bt_inq_page_start_time; - u8 bt_retry_cnt; - u8 c2h_bt_info_original; - u8 bt_inquiry_page_cnt; - struct btdm_8723 btdm; -}; - -struct rtl_hal { - struct ieee80211_hw *hw; - bool driver_is_goingto_unload; - bool up_first_time; - bool first_init; - bool being_init_adapter; - bool bbrf_ready; - bool mac_func_enable; - struct bt_coexist_8723 hal_coex_8723; - - enum intf_type interface; - u16 hw_type; /*92c or 92d or 92s and so on */ - u8 ic_class; - u8 oem_id; - u32 version; /*version of chip */ - u8 state; /*stop 0, start 1 */ - u8 board_type; - - /*firmware */ - u32 fwsize; - u8 *pfirmware; - u16 fw_version; - u16 fw_subversion; - bool h2c_setinprogress; - u8 last_hmeboxnum; - bool fw_ready; - /*Reserve page start offset except beacon in TxQ. */ - u8 fw_rsvdpage_startoffset; - u8 h2c_txcmd_seq; - - /* FW Cmd IO related */ - u16 fwcmd_iomap; - u32 fwcmd_ioparam; - bool set_fwcmd_inprogress; - u8 current_fwcmd_io; - - struct p2p_ps_offload_t p2p_ps_offload; - bool fw_clk_change_in_progress; - bool allow_sw_to_change_hwclc; - u8 fw_ps_state; - /**/ - bool driver_going2unload; - - /*AMPDU init min space*/ - u8 minspace_cfg; /*For Min spacing configurations */ - - /* Dual mac */ - enum macphy_mode macphymode; - enum band_type current_bandtype; /* 0:2.4G, 1:5G */ - enum band_type current_bandtypebackup; - enum band_type bandset; - /* dual MAC 0--Mac0 1--Mac1 */ - u32 interfaceindex; - /* just for DualMac S3S4 */ - u8 macphyctl_reg; - bool earlymode_enable; - u8 max_earlymode_num; - /* Dual mac*/ - bool during_mac0init_radiob; - bool during_mac1init_radioa; - bool reloadtxpowerindex; - /* True if IMR or IQK have done - for 2.4G in scan progress */ - bool load_imrandiqk_setting_for2g; - - bool disable_amsdu_8k; - bool master_of_dmsp; - bool slave_of_dmsp; -}; - -struct rtl_security { - /*default 0 */ - bool use_sw_sec; - - bool being_setkey; - bool use_defaultkey; - /*Encryption Algorithm for Unicast Packet */ - enum rt_enc_alg pairwise_enc_algorithm; - /*Encryption Algorithm for Brocast/Multicast */ - enum rt_enc_alg group_enc_algorithm; - /*Cam Entry Bitmap */ - u32 hwsec_cam_bitmap; - u8 hwsec_cam_sta_addr[TOTAL_CAM_ENTRY][ETH_ALEN]; - /*local Key buffer, indx 0 is for - pairwise key 1-4 is for agoup key. */ - u8 key_buf[KEY_BUF_SIZE][MAX_KEY_LEN]; - u8 key_len[KEY_BUF_SIZE]; - - /*The pointer of Pairwise Key, - it always points to KeyBuf[4] */ - u8 *pairwise_key; -}; - -#define ASSOCIATE_ENTRY_NUM 33 - -struct fast_ant_training { - u8 bssid[6]; - u8 antsel_rx_keep_0; - u8 antsel_rx_keep_1; - u8 antsel_rx_keep_2; - u32 ant_sum[7]; - u32 ant_cnt[7]; - u32 ant_ave[7]; - u8 fat_state; - u32 train_idx; - u8 antsel_a[ASSOCIATE_ENTRY_NUM]; - u8 antsel_b[ASSOCIATE_ENTRY_NUM]; - u8 antsel_c[ASSOCIATE_ENTRY_NUM]; - u32 main_ant_sum[ASSOCIATE_ENTRY_NUM]; - u32 aux_ant_sum[ASSOCIATE_ENTRY_NUM]; - u32 main_ant_cnt[ASSOCIATE_ENTRY_NUM]; - u32 aux_ant_cnt[ASSOCIATE_ENTRY_NUM]; - u8 rx_idle_ant; - bool becomelinked; -}; - -struct rtl_dm { - /*PHY status for Dynamic Management */ - long entry_min_undec_sm_pwdb; - long undec_sm_pwdb; /*out dm */ - long entry_max_undec_sm_pwdb; - bool dm_initialgain_enable; - bool dynamic_txpower_enable; - bool current_turbo_edca; - bool is_any_nonbepkts; /*out dm */ - bool is_cur_rdlstate; - bool txpower_trackinginit; - bool disable_framebursting; - bool cck_inch14; - bool txpower_tracking; - bool useramask; - bool rfpath_rxenable[4]; - bool inform_fw_driverctrldm; - bool current_mrc_switch; - u8 txpowercount; - - u8 thermalvalue_rxgain; - u8 thermalvalue_iqk; - u8 thermalvalue_lck; - u8 thermalvalue; - u8 last_dtp_lvl; - u8 thermalvalue_avg[AVG_THERMAL_NUM]; - u8 thermalvalue_avg_index; - bool done_txpower; - u8 dynamic_txhighpower_lvl; /*Tx high power level */ - u8 dm_flag; /*Indicate each dynamic mechanism's status. */ - u8 dm_type; - u8 txpower_track_control; - bool interrupt_migration; - bool disable_tx_int; - char ofdm_index[2]; - char cck_index; - char delta_power_index; - char delta_power_index_last; - char power_index_offset; - - /*88e tx power tracking*/ - u8 swing_idx_ofdm[2]; - u8 swing_idx_ofdm_cur; - u8 swing_idx_ofdm_base; - bool swing_flag_ofdm; - u8 swing_idx_cck; - u8 swing_idx_cck_cur; - u8 swing_idx_cck_base; - bool swing_flag_cck; - - /* DMSP */ - bool supp_phymode_switch; - - struct fast_ant_training fat_table; -}; - -#define EFUSE_MAX_LOGICAL_SIZE 256 - -struct rtl_efuse { - bool autoLoad_ok; - bool bootfromefuse; - u16 max_physical_size; - - u8 efuse_map[2][EFUSE_MAX_LOGICAL_SIZE]; - u16 efuse_usedbytes; - u8 efuse_usedpercentage; -#ifdef EFUSE_REPG_WORKAROUND - bool efuse_re_pg_sec1flag; - u8 efuse_re_pg_data[8]; -#endif - - u8 autoload_failflag; - u8 autoload_status; - - short epromtype; - u16 eeprom_vid; - u16 eeprom_did; - u16 eeprom_svid; - u16 eeprom_smid; - u8 eeprom_oemid; - u16 eeprom_channelplan; - u8 eeprom_version; - u8 board_type; - u8 external_pa; - - u8 dev_addr[6]; - u8 wowlan_enable; - u8 antenna_div_cfg; - u8 antenna_div_type; - - bool txpwr_fromeprom; - u8 eeprom_crystalcap; - u8 eeprom_tssi[2]; - u8 eeprom_tssi_5g[3][2]; /* for 5GL/5GM/5GH band. */ - u8 eeprom_pwrlimit_ht20[CHANNEL_GROUP_MAX]; - u8 eeprom_pwrlimit_ht40[CHANNEL_GROUP_MAX]; - u8 eeprom_chnlarea_txpwr_cck[2][CHANNEL_GROUP_MAX_2G]; - u8 eeprom_chnlarea_txpwr_ht40_1s[2][CHANNEL_GROUP_MAX]; - u8 eprom_chnl_txpwr_ht40_2sdf[2][CHANNEL_GROUP_MAX]; - u8 txpwrlevel_cck[2][CHANNEL_MAX_NUMBER_2G]; - u8 txpwrlevel_ht40_1s[2][CHANNEL_MAX_NUMBER]; /*For HT 40MHZ pwr */ - u8 txpwrlevel_ht40_2s[2][CHANNEL_MAX_NUMBER]; /*For HT 40MHZ pwr */ - - u8 internal_pa_5g[2]; /* pathA / pathB */ - u8 eeprom_c9; - u8 eeprom_cc; - - /*For power group */ - u8 eeprom_pwrgroup[2][3]; - u8 pwrgroup_ht20[2][CHANNEL_MAX_NUMBER]; - u8 pwrgroup_ht40[2][CHANNEL_MAX_NUMBER]; - - char txpwr_ht20diff[2][CHANNEL_MAX_NUMBER]; /*HT 20<->40 Pwr diff */ - /*For HT<->legacy pwr diff*/ - u8 txpwr_legacyhtdiff[2][CHANNEL_MAX_NUMBER]; - u8 txpwr_safetyflag; /* Band edge enable flag */ - u16 eeprom_txpowerdiff; - u8 legacy_httxpowerdiff; /* Legacy to HT rate power diff */ - u8 antenna_txpwdiff[3]; - - u8 eeprom_regulatory; - u8 eeprom_thermalmeter; - u8 thermalmeter[2]; /*ThermalMeter, index 0 for RFIC0, 1 for RFIC1 */ - u16 tssi_13dbm; - u8 crystalcap; /* CrystalCap. */ - u8 delta_iqk; - u8 delta_lck; - - u8 legacy_ht_txpowerdiff; /*Legacy to HT rate power diff */ - bool apk_thermalmeterignore; - - bool b1x1_recvcombine; - bool b1ss_support; - - /*channel plan */ - u8 channel_plan; -}; - -struct rtl_ps_ctl { - bool pwrdomain_protect; - bool in_powersavemode; - bool rfchange_inprogress; - bool swrf_processing; - bool hwradiooff; - /* - * just for PCIE ASPM - * If it supports ASPM, Offset[560h] = 0x40, - * otherwise Offset[560h] = 0x00. - * */ - bool support_aspm; - bool support_backdoor; - - /*for LPS */ - enum rt_psmode dot11_psmode; /*Power save mode configured. */ - bool swctrl_lps; - bool leisure_ps; - bool fwctrl_lps; - u8 fwctrl_psmode; - /*For Fw control LPS mode */ - u8 reg_fwctrl_lps; - /*Record Fw PS mode status. */ - bool fw_current_inpsmode; - u8 reg_max_lps_awakeintvl; - bool report_linked; - bool low_power_enable;/*for 32k*/ - - /*for IPS */ - bool inactiveps; - - u32 rfoff_reason; - - /*RF OFF Level */ - u32 cur_ps_level; - u32 reg_rfps_level; - - /*just for PCIE ASPM */ - u8 const_amdpci_aspm; - bool pwrdown_mode; - - enum rf_pwrstate inactive_pwrstate; - enum rf_pwrstate rfpwr_state; /*cur power state */ - - /* for SW LPS*/ - bool sw_ps_enabled; - bool state; - bool state_inap; - bool multi_buffered; - u16 nullfunc_seq; - unsigned int dtim_counter; - unsigned int sleep_ms; - unsigned long last_sleep_jiffies; - unsigned long last_awake_jiffies; - unsigned long last_delaylps_stamp_jiffies; - unsigned long last_dtim; - unsigned long last_beacon; - unsigned long last_action; - unsigned long last_slept; - - /*For P2P PS */ - struct rtl_p2p_ps_info p2p_ps_info; - u8 pwr_mode; - u8 smart_ps; -}; - -struct rtl_stats { - u8 psaddr[ETH_ALEN]; - u32 mac_time[2]; - s8 rssi; - u8 signal; - u8 noise; - u8 rate; /* hw desc rate */ - u8 received_channel; - u8 control; - u8 mask; - u8 freq; - u16 len; - u64 tsf; - u32 beacon_time; - u8 nic_type; - u16 length; - u8 signalquality; /*in 0-100 index. */ - /* - * Real power in dBm for this packet, - * no beautification and aggregation. - * */ - s32 recvsignalpower; - s8 rxpower; /*in dBm Translate from PWdB */ - u8 signalstrength; /*in 0-100 index. */ - u16 hwerror:1; - u16 crc:1; - u16 icv:1; - u16 shortpreamble:1; - u16 antenna:1; - u16 decrypted:1; - u16 wakeup:1; - u32 timestamp_low; - u32 timestamp_high; - - u8 rx_drvinfo_size; - u8 rx_bufshift; - bool isampdu; - bool isfirst_ampdu; - bool rx_is40Mhzpacket; - u32 rx_pwdb_all; - u8 rx_mimo_signalstrength[4]; /*in 0~100 index */ - s8 rx_mimo_sig_qual[2]; - bool packet_matchbssid; - bool is_cck; - bool is_ht; - bool packet_toself; - bool packet_beacon; /*for rssi */ - char cck_adc_pwdb[4]; /*for rx path selection */ - - u8 packet_report_type; - - u32 macid; - u8 wake_match; - u32 bt_rx_rssi_percentage; - u32 macid_valid_entry[2]; -}; - - -struct rt_link_detect { - /* count for roaming */ - u32 bcn_rx_inperiod; - u32 roam_times; - - u32 num_tx_in4period[4]; - u32 num_rx_in4period[4]; - - u32 num_tx_inperiod; - u32 num_rx_inperiod; - - bool busytraffic; - bool tx_busy_traffic; - bool rx_busy_traffic; - bool higher_busytraffic; - bool higher_busyrxtraffic; - - u32 tidtx_in4period[MAX_TID_COUNT][4]; - u32 tidtx_inperiod[MAX_TID_COUNT]; - bool higher_busytxtraffic[MAX_TID_COUNT]; -}; - -struct rtl_tcb_desc { - u8 packet_bw:1; - u8 multicast:1; - u8 broadcast:1; - - u8 rts_stbc:1; - u8 rts_enable:1; - u8 cts_enable:1; - u8 rts_use_shortpreamble:1; - u8 rts_use_shortgi:1; - u8 rts_sc:1; - u8 rts_bw:1; - u8 rts_rate; - - u8 use_shortgi:1; - u8 use_shortpreamble:1; - u8 use_driver_rate:1; - u8 disable_ratefallback:1; - - u8 ratr_index; - u8 mac_id; - u8 hw_rate; - - u8 last_inipkt:1; - u8 cmd_or_init:1; - u8 queue_index; - - /* early mode */ - u8 empkt_num; - /* The max value by HW */ - u32 empkt_len[10]; - bool btx_enable_sw_calc_duration; -}; - -struct rtl_hal_ops { - int (*init_sw_vars) (struct ieee80211_hw *hw); - void (*deinit_sw_vars) (struct ieee80211_hw *hw); - void (*read_chip_version)(struct ieee80211_hw *hw); - void (*read_eeprom_info) (struct ieee80211_hw *hw); - void (*interrupt_recognized) (struct ieee80211_hw *hw, - u32 *p_inta, u32 *p_intb); - int (*hw_init) (struct ieee80211_hw *hw); - void (*hw_disable) (struct ieee80211_hw *hw); - void (*hw_suspend) (struct ieee80211_hw *hw); - void (*hw_resume) (struct ieee80211_hw *hw); - void (*enable_interrupt) (struct ieee80211_hw *hw); - void (*disable_interrupt) (struct ieee80211_hw *hw); - int (*set_network_type) (struct ieee80211_hw *hw, - enum nl80211_iftype type); - void (*set_chk_bssid)(struct ieee80211_hw *hw, - bool check_bssid); - void (*set_bw_mode) (struct ieee80211_hw *hw, - enum nl80211_channel_type ch_type); - u8(*switch_channel) (struct ieee80211_hw *hw); - void (*set_qos) (struct ieee80211_hw *hw, int aci); - void (*set_bcn_reg) (struct ieee80211_hw *hw); - void (*set_bcn_intv) (struct ieee80211_hw *hw); - void (*update_interrupt_mask) (struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr); - void (*get_hw_reg) (struct ieee80211_hw *hw, u8 variable, u8 *val); - void (*set_hw_reg) (struct ieee80211_hw *hw, u8 variable, u8 *val); - void (*update_rate_tbl) (struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level); - void (*update_rate_mask) (struct ieee80211_hw *hw, u8 rssi_level); - void (*fill_tx_desc) (struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, u8 hw_queue, - struct rtl_tcb_desc *ptcb_desc); - void (*fill_fake_txdesc) (struct ieee80211_hw *hw, u8 *pDesc, - u32 buffer_len, bool bIsPsPoll); - void (*fill_tx_cmddesc) (struct ieee80211_hw *hw, u8 *pdesc, - bool firstseg, bool lastseg, - struct sk_buff *skb); - bool (*cmd_send_packet)(struct ieee80211_hw *hw, struct sk_buff *skb); - bool (*query_rx_desc) (struct ieee80211_hw *hw, - struct rtl_stats *stats, - struct ieee80211_rx_status *rx_status, - u8 *pdesc, struct sk_buff *skb); - void (*set_channel_access) (struct ieee80211_hw *hw); - bool (*radio_onoff_checking) (struct ieee80211_hw *hw, u8 *valid); - void (*dm_watchdog) (struct ieee80211_hw *hw); - void (*scan_operation_backup) (struct ieee80211_hw *hw, u8 operation); - bool (*set_rf_power_state) (struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state); - void (*led_control) (struct ieee80211_hw *hw, - enum led_ctl_mode ledaction); - void (*set_desc) (u8 *pdesc, bool istx, u8 desc_name, u8 *val); - u32 (*get_desc) (u8 *pdesc, bool istx, u8 desc_name); - void (*tx_polling) (struct ieee80211_hw *hw, u8 hw_queue); - void (*enable_hw_sec) (struct ieee80211_hw *hw); - void (*set_key) (struct ieee80211_hw *hw, u32 key_index, - u8 *macaddr, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all); - void (*init_sw_leds) (struct ieee80211_hw *hw); - void (*deinit_sw_leds) (struct ieee80211_hw *hw); - u32 (*get_bbreg) (struct ieee80211_hw *hw, u32 regaddr, u32 bitmask); - void (*set_bbreg) (struct ieee80211_hw *hw, u32 regaddr, u32 bitmask, - u32 data); - u32 (*get_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath, - u32 regaddr, u32 bitmask); - void (*set_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath, - u32 regaddr, u32 bitmask, u32 data); - void (*allow_all_destaddr)(struct ieee80211_hw *hw, - bool allow_all_da, bool write_into_reg); - void (*linked_set_reg) (struct ieee80211_hw *hw); - void (*chk_switch_dmdp) (struct ieee80211_hw *hw); - void (*dualmac_easy_concurrent) (struct ieee80211_hw *hw); - void (*dualmac_switch_to_dmdp) (struct ieee80211_hw *hw); - bool (*phy_rf6052_config) (struct ieee80211_hw *hw); - void (*phy_rf6052_set_cck_txpower) (struct ieee80211_hw *hw, - u8 *powerlevel); - void (*phy_rf6052_set_ofdm_txpower) (struct ieee80211_hw *hw, - u8 *ppowerlevel, u8 channel); - bool (*config_bb_with_headerfile) (struct ieee80211_hw *hw, - u8 configtype); - bool (*config_bb_with_pgheaderfile) (struct ieee80211_hw *hw, - u8 configtype); - void (*phy_lc_calibrate) (struct ieee80211_hw *hw, bool is2t); - void (*phy_set_bw_mode_callback) (struct ieee80211_hw *hw); - void (*dm_dynamic_txpower) (struct ieee80211_hw *hw); - void (*c2h_command_handle) (struct ieee80211_hw *hw); - void (*bt_wifi_media_status_notify) (struct ieee80211_hw *hw, - bool mstate); - void (*bt_coex_off_before_lps) (struct ieee80211_hw *hw); - void (*fill_h2c_cmd) (struct ieee80211_hw *hw, u8 element_id, - u32 cmd_len, u8 *p_cmdbuffer); -}; - -struct rtl_intf_ops { - /*com */ - void (*read_efuse_byte)(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf); - int (*adapter_start) (struct ieee80211_hw *hw); - void (*adapter_stop) (struct ieee80211_hw *hw); - bool (*check_buddy_priv)(struct ieee80211_hw *hw, - struct rtl_priv **buddy_priv); - - int (*adapter_tx) (struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - struct sk_buff *skb, - struct rtl_tcb_desc *ptcb_desc); - void (*flush)(struct ieee80211_hw *hw, bool drop); - int (*reset_trx_ring) (struct ieee80211_hw *hw); - bool (*waitq_insert) (struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - struct sk_buff *skb); - - /*pci */ - void (*disable_aspm) (struct ieee80211_hw *hw); - void (*enable_aspm) (struct ieee80211_hw *hw); - - /*usb */ -}; - -struct rtl_mod_params { - /* default: 0 = using hardware encryption */ - bool sw_crypto; - - /* default: 0 = DBG_EMERG (0)*/ - int debug; - - /* default: 1 = using no linked power save */ - bool inactiveps; - - /* default: 1 = using linked sw power save */ - bool swctrl_lps; - - /* default: 1 = using linked fw power save */ - bool fwctrl_lps; -}; - -struct rtl_hal_usbint_cfg { - /* data - rx */ - u32 in_ep_num; - u32 rx_urb_num; - u32 rx_max_size; - - /* op - rx */ - void (*usb_rx_hdl)(struct ieee80211_hw *, struct sk_buff *); - void (*usb_rx_segregate_hdl)(struct ieee80211_hw *, struct sk_buff *, - struct sk_buff_head *); - - /* tx */ - void (*usb_tx_cleanup)(struct ieee80211_hw *, struct sk_buff *); - int (*usb_tx_post_hdl)(struct ieee80211_hw *, struct urb *, - struct sk_buff *); - struct sk_buff *(*usb_tx_aggregate_hdl)(struct ieee80211_hw *, - struct sk_buff_head *); - - /* endpoint mapping */ - int (*usb_endpoint_mapping)(struct ieee80211_hw *hw); - u16 (*usb_mq_to_hwq)(__le16 fc, u16 mac80211_queue_index); -}; - -struct rtl_hal_cfg { - u8 bar_id; - bool write_readback; - char *name; - char *fw_name; - struct rtl_hal_ops *ops; - struct rtl_mod_params *mod_params; - struct rtl_hal_usbint_cfg *usb_interface_cfg; - - /*this map used for some registers or vars - defined int HAL but used in MAIN */ - u32 maps[RTL_VAR_MAP_MAX]; - -}; - -struct rtl_locks { - /* mutex */ - struct mutex conf_mutex; - struct mutex ps_mutex; - - /*spin lock */ - spinlock_t ips_lock; - spinlock_t irq_th_lock; - spinlock_t irq_pci_lock; - spinlock_t tx_lock; - spinlock_t h2c_lock; - spinlock_t rf_ps_lock; - spinlock_t rf_lock; - spinlock_t lps_lock; - spinlock_t waitq_lock; - spinlock_t entry_list_lock; - spinlock_t usb_lock; - - /*FW clock change */ - spinlock_t fw_ps_lock; - - /*Dual mac*/ - spinlock_t cck_and_rw_pagea_lock; - - /*Easy concurrent*/ - spinlock_t check_sendpkt_lock; -}; - -struct rtl_works { - struct ieee80211_hw *hw; - - /*timer */ - struct timer_list watchdog_timer; - struct timer_list dualmac_easyconcurrent_retrytimer; - struct timer_list fw_clockoff_timer; - struct timer_list fast_antenna_training_timer; - /*task */ - struct tasklet_struct irq_tasklet; - struct tasklet_struct irq_prepare_bcn_tasklet; - - /*work queue */ - struct workqueue_struct *rtl_wq; - struct delayed_work watchdog_wq; - struct delayed_work ips_nic_off_wq; - - /* For SW LPS */ - struct delayed_work ps_work; - struct delayed_work ps_rfon_wq; - struct delayed_work fwevt_wq; - - struct work_struct lps_change_work; - struct work_struct fill_h2c_cmd; -}; - -struct rtl_debug { - u32 dbgp_type[DBGP_TYPE_MAX]; - int global_debuglevel; - u64 global_debugcomponents; - - /* add for proc debug */ - struct proc_dir_entry *proc_dir; - char proc_name[20]; -}; - -#define MIMO_PS_STATIC 0 -#define MIMO_PS_DYNAMIC 1 -#define MIMO_PS_NOLIMIT 3 - -struct rtl_dualmac_easy_concurrent_ctl { - enum band_type currentbandtype_backfordmdp; - bool close_bbandrf_for_dmsp; - bool change_to_dmdp; - bool change_to_dmsp; - bool switch_in_process; -}; - -struct rtl_dmsp_ctl { - bool activescan_for_slaveofdmsp; - bool scan_for_anothermac_fordmsp; - bool scan_for_itself_fordmsp; - bool writedig_for_anothermacofdmsp; - u32 curdigvalue_for_anothermacofdmsp; - bool changecckpdstate_for_anothermacofdmsp; - u8 curcckpdstate_for_anothermacofdmsp; - bool changetxhighpowerlvl_for_anothermacofdmsp; - u8 curtxhighlvl_for_anothermacofdmsp; - long rssivalmin_for_anothermacofdmsp; -}; - -struct ps_t { - u8 pre_ccastate; - u8 cur_ccasate; - u8 pre_rfstate; - u8 cur_rfstate; - long rssi_val_min; -}; - -struct dig_t { - u32 rssi_lowthresh; - u32 rssi_highthresh; - u32 fa_lowthresh; - u32 fa_highthresh; - long last_min_undec_pwdb_for_dm; - long rssi_highpower_lowthresh; - long rssi_highpower_highthresh; - u32 recover_cnt; - u32 pre_igvalue; - u32 cur_igvalue; - long rssi_val; - u8 dig_enable_flag; - u8 dig_ext_port_stage; - u8 dig_algorithm; - u8 dig_twoport_algorithm; - u8 dig_dbgmode; - u8 dig_slgorithm_switch; - u8 cursta_cstate; - u8 presta_cstate; - u8 curmultista_cstate; - char back_val; - char back_range_max; - char back_range_min; - u8 rx_gain_max; - u8 rx_gain_min; - u8 min_undec_pwdb_for_dm; - u8 rssi_val_min; - u8 pre_cck_cca_thres; - u8 cur_cck_cca_thres; - u8 pre_cck_pd_state; - u8 cur_cck_pd_state; - u8 pre_cck_fa_state; - u8 cur_cck_fa_state; - u8 pre_ccastate; - u8 cur_ccasate; - u8 large_fa_hit; - u8 forbidden_igi; - u8 dig_state; - u8 dig_highpwrstate; - u8 cur_sta_cstate; - u8 pre_sta_cstate; - u8 cur_ap_cstate; - u8 pre_ap_cstate; - u8 cur_pd_thstate; - u8 pre_pd_thstate; - u8 cur_cs_ratiostate; - u8 pre_cs_ratiostate; - u8 backoff_enable_flag; - char backoffval_range_max; - char backoffval_range_min; - u8 dig_min_0; - u8 dig_min_1; - bool media_connect_0; - bool media_connect_1; - - u32 antdiv_rssi_max; - u32 rssi_max; -}; - -struct rtl_global_var { - /* from this list we can get - * other adapter's rtl_priv */ - struct list_head glb_priv_list; - spinlock_t glb_list_lock; -}; - -struct rtl_priv { - struct ieee80211_hw *hw; - struct completion firmware_loading_complete; - struct list_head list; - struct rtl_priv *buddy_priv; - struct rtl_global_var *glb_var; - struct rtl_dualmac_easy_concurrent_ctl easy_concurrent_ctl; - struct rtl_dmsp_ctl dmsp_ctl; - struct rtl_locks locks; - struct rtl_works works; - struct rtl_mac mac80211; - struct rtl_hal rtlhal; - struct rtl_regulatory regd; - struct rtl_rfkill rfkill; - struct rtl_io io; - struct rtl_phy phy; - struct rtl_dm dm; - struct rtl_security sec; - struct rtl_efuse efuse; - - struct rtl_ps_ctl psc; - struct rate_adaptive ra; - struct wireless_stats stats; - struct rt_link_detect link_info; - struct false_alarm_statistics falsealm_cnt; - - struct rtl_rate_priv *rate_priv; - - /* sta entry list for ap adhoc or mesh */ - struct list_head entry_list; - - struct rtl_debug dbg; - int max_fw_size; - - /* - *hal_cfg : for diff cards - *intf_ops : for diff interrface usb/pcie - */ - struct rtl_hal_cfg *cfg; - struct rtl_intf_ops *intf_ops; - - /*this var will be set by set_bit, - and was used to indicate status of - interface or hardware */ - unsigned long status; - - /* tables for dm */ - struct dig_t dm_digtable; - struct ps_t dm_pstable; - - /* section shared by individual drivers */ - union { - struct { /* data buffer pointer for USB reads */ - __le32 *usb_data; - int usb_data_index; - bool initialized; - }; - struct { /* section for 8723ae */ - bool reg_init; /* true if regs saved */ - u32 reg_874; - u32 reg_c70; - u32 reg_85c; - u32 reg_a74; - bool bt_operation_on; - }; - }; - bool enter_ps; /* true when entering PS */ - u8 rate_mask[5]; - - /*This must be the last item so - that it points to the data allocated - beyond this structure like: - rtl_pci_priv or rtl_usb_priv */ - u8 priv[0] __aligned(sizeof(void *)); -}; - -#define rtl_priv(hw) (((struct rtl_priv *)(hw)->priv)) -#define rtl_mac(rtlpriv) (&((rtlpriv)->mac80211)) -#define rtl_hal(rtlpriv) (&((rtlpriv)->rtlhal)) -#define rtl_efuse(rtlpriv) (&((rtlpriv)->efuse)) -#define rtl_psc(rtlpriv) (&((rtlpriv)->psc)) - - -/*************************************** - Bluetooth Co-existence Related -****************************************/ - -enum bt_ant_num { - ANT_X2 = 0, - ANT_X1 = 1, -}; - -enum bt_co_type { - BT_2WIRE = 0, - BT_ISSC_3WIRE = 1, - BT_ACCEL = 2, - BT_CSR_BC4 = 3, - BT_CSR_BC8 = 4, - BT_RTL8756 = 5, - BT_RTL8723A = 6, -}; - -enum bt_cur_state { - BT_OFF = 0, - BT_ON = 1, -}; - -enum bt_service_type { - BT_SCO = 0, - BT_A2DP = 1, - BT_HID = 2, - BT_HID_IDLE = 3, - BT_SCAN = 4, - BT_IDLE = 5, - BT_OTHER_ACTION = 6, - BT_BUSY = 7, - BT_OTHERBUSY = 8, - BT_PAN = 9, -}; - -enum bt_radio_shared { - BT_RADIO_SHARED = 0, - BT_RADIO_INDIVIDUAL = 1, -}; - -struct bt_coexist_info { - - /* EEPROM BT info. */ - u8 eeprom_bt_coexist; - u8 eeprom_bt_type; - u8 eeprom_bt_ant_num; - u8 eeprom_bt_ant_isol; - u8 eeprom_bt_radio_shared; - - u8 bt_coexistence; - u8 bt_ant_num; - u8 bt_coexist_type; - u8 bt_state; - u8 bt_cur_state; /* 0:on, 1:off */ - u8 bt_ant_isolation; /* 0:good, 1:bad */ - u8 bt_pape_ctrl; /* 0:SW, 1:SW/HW dynamic */ - u8 bt_service; - u8 bt_radio_shared_type; - u8 bt_rfreg_origin_1e; - u8 bt_rfreg_origin_1f; - u8 bt_rssi_state; - u32 ratio_tx; - u32 ratio_pri; - u32 bt_edca_ul; - u32 bt_edca_dl; - - bool init_set; - bool bt_busy_traffic; - bool bt_traffic_mode_set; - bool bt_non_traffic_mode_set; - - bool fw_coexist_all_off; - bool sw_coexist_all_off; - bool hw_coexist_all_off; - u32 cstate; - u32 previous_state; - u32 cstate_h; - u32 previous_state_h; - - u8 bt_pre_rssi_state; - u8 bt_pre_rssi_state1; - - u8 reg_bt_iso; - u8 reg_bt_sco; - bool balance_on; - u8 bt_active_zero_cnt; - bool cur_bt_disabled; - bool pre_bt_disabled; - - u8 bt_profile_case; - u8 bt_profile_action; - bool bt_busy; - bool hold_for_bt_operation; - u8 lps_counter; -}; - - -/**************************************** - mem access macro define start - Call endian free function when - 1. Read/write packet content. - 2. Before write integer to IO. - 3. After read integer from IO. -****************************************/ -/* Convert little data endian to host ordering */ -#define EF1BYTE(_val) \ - ((u8)(_val)) -#define EF2BYTE(_val) \ - (le16_to_cpu(_val)) -#define EF4BYTE(_val) \ - (le32_to_cpu(_val)) - -/* Read data from memory */ -#define READEF1BYTE(_ptr) \ - EF1BYTE(*((u8 *)(_ptr))) -/* Read le16 data from memory and convert to host ordering */ -#define READEF2BYTE(_ptr) \ - EF2BYTE(*(_ptr)) -#define READEF4BYTE(_ptr) \ - EF4BYTE(*(_ptr)) - -/* Write data to memory */ -#define WRITEEF1BYTE(_ptr, _val) \ - (*((u8 *)(_ptr))) = EF1BYTE(_val) -/* Write le16 data to memory in host ordering */ -#define WRITEEF2BYTE(_ptr, _val) \ - (*((u16 *)(_ptr))) = EF2BYTE(_val) -#define WRITEEF4BYTE(_ptr, _val) \ - (*((u32 *)(_ptr))) = EF2BYTE(_val) - -/* Create a bit mask - * Examples: - * BIT_LEN_MASK_32(0) => 0x00000000 - * BIT_LEN_MASK_32(1) => 0x00000001 - * BIT_LEN_MASK_32(2) => 0x00000003 - * BIT_LEN_MASK_32(32) => 0xFFFFFFFF - */ -#define BIT_LEN_MASK_32(__bitlen) \ - (0xFFFFFFFF >> (32 - (__bitlen))) -#define BIT_LEN_MASK_16(__bitlen) \ - (0xFFFF >> (16 - (__bitlen))) -#define BIT_LEN_MASK_8(__bitlen) \ - (0xFF >> (8 - (__bitlen))) - -/* Create an offset bit mask - * Examples: - * BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003 - * BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000 - */ -#define BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen) \ - (BIT_LEN_MASK_32(__bitlen) << (__bitoffset)) -#define BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen) \ - (BIT_LEN_MASK_16(__bitlen) << (__bitoffset)) -#define BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen) \ - (BIT_LEN_MASK_8(__bitlen) << (__bitoffset)) - -/*Description: - * Return 4-byte value in host byte ordering from - * 4-byte pointer in little-endian system. - */ -#define LE_P4BYTE_TO_HOST_4BYTE(__pstart) \ - (EF4BYTE(*((__le32 *)(__pstart)))) -#define LE_P2BYTE_TO_HOST_2BYTE(__pstart) \ - (EF2BYTE(*((__le16 *)(__pstart)))) -#define LE_P1BYTE_TO_HOST_1BYTE(__pstart) \ - (EF1BYTE(*((u8 *)(__pstart)))) - -/*Description: -Translate subfield (continuous bits in little-endian) of 4-byte -value to host byte ordering.*/ -#define LE_BITS_TO_4BYTE(__pstart, __bitoffset, __bitlen) \ - ( \ - (LE_P4BYTE_TO_HOST_4BYTE(__pstart) >> (__bitoffset)) & \ - BIT_LEN_MASK_32(__bitlen) \ - ) -#define LE_BITS_TO_2BYTE(__pstart, __bitoffset, __bitlen) \ - ( \ - (LE_P2BYTE_TO_HOST_2BYTE(__pstart) >> (__bitoffset)) & \ - BIT_LEN_MASK_16(__bitlen) \ - ) -#define LE_BITS_TO_1BYTE(__pstart, __bitoffset, __bitlen) \ - ( \ - (LE_P1BYTE_TO_HOST_1BYTE(__pstart) >> (__bitoffset)) & \ - BIT_LEN_MASK_8(__bitlen) \ - ) - -/* Description: - * Mask subfield (continuous bits in little-endian) of 4-byte value - * and return the result in 4-byte value in host byte ordering. - */ -#define LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) \ - ( \ - LE_P4BYTE_TO_HOST_4BYTE(__pstart) & \ - (~BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen)) \ - ) -#define LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) \ - ( \ - LE_P2BYTE_TO_HOST_2BYTE(__pstart) & \ - (~BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen)) \ - ) -#define LE_BITS_CLEARED_TO_1BYTE(__pstart, __bitoffset, __bitlen) \ - ( \ - LE_P1BYTE_TO_HOST_1BYTE(__pstart) & \ - (~BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen)) \ - ) - -/* Description: - * Set subfield of little-endian 4-byte value to specified value. - */ -#define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \ - *((u32 *)(__pstart)) = \ - ( \ - LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \ - ((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \ - ); -#define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \ - *((u16 *)(__pstart)) = \ - ( \ - LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) | \ - ((((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset)) \ - ); -#define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \ - *((u8 *)(__pstart)) = EF1BYTE \ - ( \ - LE_BITS_CLEARED_TO_1BYTE(__pstart, __bitoffset, __bitlen) | \ - ((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \ - ); - -#define N_BYTE_ALIGMENT(__value, __aligment) ((__aligment == 1) ? \ - (__value) : (((__value + __aligment - 1) / __aligment) * __aligment)) - -/**************************************** - mem access macro define end -****************************************/ - -#define byte(x, n) ((x >> (8 * n)) & 0xff) - -#define packet_get_type(_packet) (EF1BYTE((_packet).octet[0]) & 0xFC) -#define RTL_WATCH_DOG_TIME 2000 -#define MSECS(t) msecs_to_jiffies(t) -#define WLAN_FC_GET_VERS(fc) (le16_to_cpu(fc) & IEEE80211_FCTL_VERS) -#define WLAN_FC_GET_TYPE(fc) (le16_to_cpu(fc) & IEEE80211_FCTL_FTYPE) -#define WLAN_FC_GET_STYPE(fc) (le16_to_cpu(fc) & IEEE80211_FCTL_STYPE) -#define WLAN_FC_MORE_DATA(fc) (le16_to_cpu(fc) & IEEE80211_FCTL_MOREDATA) -#define rtl_dm(rtlpriv) (&((rtlpriv)->dm)) - -#define RT_RF_OFF_LEVL_ASPM BIT(0) /*PCI ASPM */ -#define RT_RF_OFF_LEVL_CLK_REQ BIT(1) /*PCI clock request */ -#define RT_RF_OFF_LEVL_PCI_D3 BIT(2) /*PCI D3 mode */ -/*NIC halt, re-initialize hw parameters*/ -#define RT_RF_OFF_LEVL_HALT_NIC BIT(3) -#define RT_RF_OFF_LEVL_FREE_FW BIT(4) /*FW free, re-download the FW */ -#define RT_RF_OFF_LEVL_FW_32K BIT(5) /*FW in 32k */ -/*Always enable ASPM and Clock Req in initialization.*/ -#define RT_RF_PS_LEVEL_ALWAYS_ASPM BIT(6) -/* no matter RFOFF or SLEEP we set PS_ASPM_LEVL*/ -#define RT_PS_LEVEL_ASPM BIT(7) -/*When LPS is on, disable 2R if no packet is received or transmittd.*/ -#define RT_RF_LPS_DISALBE_2R BIT(30) -#define RT_RF_LPS_LEVEL_ASPM BIT(31) /*LPS with ASPM */ -#define RT_IN_PS_LEVEL(ppsc, _ps_flg) \ - ((ppsc->cur_ps_level & _ps_flg) ? true : false) -#define RT_CLEAR_PS_LEVEL(ppsc, _ps_flg) \ - (ppsc->cur_ps_level &= (~(_ps_flg))) -#define RT_SET_PS_LEVEL(ppsc, _ps_flg) \ - (ppsc->cur_ps_level |= _ps_flg) - -#define container_of_dwork_rtl(x, y, z) \ - container_of(container_of(x, struct delayed_work, work), y, z) - -#define FILL_OCTET_STRING(_os, _octet, _len) \ - (_os).octet = (u8 *)(_octet); \ - (_os).length = (_len); - -#define CP_MACADDR(des, src) \ - ((des)[0] = (src)[0], (des)[1] = (src)[1],\ - (des)[2] = (src)[2], (des)[3] = (src)[3],\ - (des)[4] = (src)[4], (des)[5] = (src)[5]) - -static inline u8 rtl_read_byte(struct rtl_priv *rtlpriv, u32 addr) -{ - return rtlpriv->io.read8_sync(rtlpriv, addr); -} - -static inline u16 rtl_read_word(struct rtl_priv *rtlpriv, u32 addr) -{ - return rtlpriv->io.read16_sync(rtlpriv, addr); -} - -static inline u32 rtl_read_dword(struct rtl_priv *rtlpriv, u32 addr) -{ - return rtlpriv->io.read32_sync(rtlpriv, addr); -} - -static inline void rtl_write_byte(struct rtl_priv *rtlpriv, u32 addr, u8 val8) -{ - rtlpriv->io.write8_async(rtlpriv, addr, val8); - - if (rtlpriv->cfg->write_readback) - rtlpriv->io.read8_sync(rtlpriv, addr); -} - -static inline void rtl_write_word(struct rtl_priv *rtlpriv, u32 addr, u16 val16) -{ - rtlpriv->io.write16_async(rtlpriv, addr, val16); - - if (rtlpriv->cfg->write_readback) - rtlpriv->io.read16_sync(rtlpriv, addr); -} - -static inline void rtl_write_dword(struct rtl_priv *rtlpriv, - u32 addr, u32 val32) -{ - rtlpriv->io.write32_async(rtlpriv, addr, val32); - - if (rtlpriv->cfg->write_readback) - rtlpriv->io.read32_sync(rtlpriv, addr); -} - -static inline u32 rtl_get_bbreg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask) -{ - struct rtl_priv *rtlpriv = hw->priv; - - return rtlpriv->cfg->ops->get_bbreg(hw, regaddr, bitmask); -} - -static inline void rtl_set_bbreg(struct ieee80211_hw *hw, u32 regaddr, - u32 bitmask, u32 data) -{ - struct rtl_priv *rtlpriv = hw->priv; - - rtlpriv->cfg->ops->set_bbreg(hw, regaddr, bitmask, data); -} - -static inline u32 rtl_get_rfreg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, - u32 bitmask) -{ - struct rtl_priv *rtlpriv = hw->priv; - - return rtlpriv->cfg->ops->get_rfreg(hw, rfpath, regaddr, bitmask); -} - -static inline void rtl_set_rfreg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, - u32 bitmask, u32 data) -{ - struct rtl_priv *rtlpriv = hw->priv; - - rtlpriv->cfg->ops->set_rfreg(hw, rfpath, regaddr, bitmask, data); -} - -static inline bool is_hal_stop(struct rtl_hal *rtlhal) -{ - return (_HAL_STATE_STOP == rtlhal->state); -} - -static inline void set_hal_start(struct rtl_hal *rtlhal) -{ - rtlhal->state = _HAL_STATE_START; -} - -static inline void set_hal_stop(struct rtl_hal *rtlhal) -{ - rtlhal->state = _HAL_STATE_STOP; -} - -static inline u8 get_rf_type(struct rtl_phy *rtlphy) -{ - return rtlphy->rf_type; -} - -static inline struct ieee80211_hdr *rtl_get_hdr(struct sk_buff *skb) -{ - return (struct ieee80211_hdr *)(skb->data); -} - -static inline __le16 rtl_get_fc(struct sk_buff *skb) -{ - return rtl_get_hdr(skb)->frame_control; -} - -static inline u16 rtl_get_tid_h(struct ieee80211_hdr *hdr) -{ - return (ieee80211_get_qos_ctl(hdr))[0] & IEEE80211_QOS_CTL_TID_MASK; -} - -static inline u16 rtl_get_tid(struct sk_buff *skb) -{ - return rtl_get_tid_h(rtl_get_hdr(skb)); -} - -static inline struct ieee80211_sta *get_sta(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - const u8 *bssid) -{ - return ieee80211_find_sta(vif, bssid); -} - -static inline struct ieee80211_sta *rtl_find_sta(struct ieee80211_hw *hw, - u8 *mac_addr) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - return ieee80211_find_sta(mac->vif, mac_addr); -} - -#endif diff --git a/drivers/net/wireless/ti/Kconfig b/drivers/net/wireless/ti/Kconfig deleted file mode 100644 index cbe1e7fef61b..000000000000 --- a/drivers/net/wireless/ti/Kconfig +++ /dev/null @@ -1,24 +0,0 @@ -menuconfig WL_TI - bool "TI Wireless LAN support" - ---help--- - This section contains support for all the wireless drivers - for Texas Instruments WLAN chips, such as wl1251 and the wl12xx - family. - -if WL_TI -source "drivers/net/wireless/ti/wl1251/Kconfig" -source "drivers/net/wireless/ti/wl12xx/Kconfig" -source "drivers/net/wireless/ti/wl18xx/Kconfig" - -# keep last for automatic dependencies -source "drivers/net/wireless/ti/wlcore/Kconfig" - -config WILINK_PLATFORM_DATA - bool "TI WiLink platform data" - depends on WLCORE_SDIO || WL1251_SDIO - default y - ---help--- - Small platform data bit needed to pass data to the sdio modules. - - -endif # WL_TI diff --git a/drivers/net/wireless/ti/Makefile b/drivers/net/wireless/ti/Makefile deleted file mode 100644 index af14231aeede..000000000000 --- a/drivers/net/wireless/ti/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -obj-$(CONFIG_WLCORE) += wlcore/ -obj-$(CONFIG_WL12XX) += wl12xx/ -obj-$(CONFIG_WL1251) += wl1251/ -obj-$(CONFIG_WL18XX) += wl18xx/ - -# small builtin driver bit -obj-$(CONFIG_WILINK_PLATFORM_DATA) += wilink_platform_data.o diff --git a/drivers/net/wireless/ti/wilink_platform_data.c b/drivers/net/wireless/ti/wilink_platform_data.c deleted file mode 100644 index 998e95895f9d..000000000000 --- a/drivers/net/wireless/ti/wilink_platform_data.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2010-2011 Texas Instruments, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include - -static struct wl12xx_platform_data *platform_data; - -int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data) -{ - if (platform_data) - return -EBUSY; - if (!data) - return -EINVAL; - - platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL); - if (!platform_data) - return -ENOMEM; - - return 0; -} - -struct wl12xx_platform_data *wl12xx_get_platform_data(void) -{ - if (!platform_data) - return ERR_PTR(-ENODEV); - - return platform_data; -} -EXPORT_SYMBOL(wl12xx_get_platform_data); diff --git a/drivers/net/wireless/ti/wl1251/Kconfig b/drivers/net/wireless/ti/wl1251/Kconfig deleted file mode 100644 index 8fec4ed36ac2..000000000000 --- a/drivers/net/wireless/ti/wl1251/Kconfig +++ /dev/null @@ -1,33 +0,0 @@ -menuconfig WL1251 - tristate "TI wl1251 driver support" - depends on MAC80211 && GENERIC_HARDIRQS - select FW_LOADER - select CRC7 - ---help--- - This will enable TI wl1251 driver support. The drivers make - use of the mac80211 stack. - - If you choose to build a module, it'll be called wl1251. Say - N if unsure. - -config WL1251_SPI - tristate "TI wl1251 SPI support" - depends on WL1251 && SPI_MASTER - ---help--- - This module adds support for the SPI interface of adapters using - TI wl1251 chipset. Select this if your platform is using - the SPI bus. - - If you choose to build a module, it'll be called wl1251_spi. - Say N if unsure. - -config WL1251_SDIO - tristate "TI wl1251 SDIO support" - depends on WL1251 && MMC - ---help--- - This module adds support for the SDIO interface of adapters using - TI wl1251 chipset. Select this if your platform is using - the SDIO bus. - - If you choose to build a module, it'll be called - wl1251_sdio. Say N if unsure. diff --git a/drivers/net/wireless/ti/wl1251/Makefile b/drivers/net/wireless/ti/wl1251/Makefile deleted file mode 100644 index a5c6328b5f72..000000000000 --- a/drivers/net/wireless/ti/wl1251/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -wl1251-objs = main.o event.o tx.o rx.o ps.o cmd.o \ - acx.o boot.o init.o debugfs.o io.o -wl1251_spi-objs += spi.o -wl1251_sdio-objs += sdio.o - -obj-$(CONFIG_WL1251) += wl1251.o -obj-$(CONFIG_WL1251_SPI) += wl1251_spi.o -obj-$(CONFIG_WL1251_SDIO) += wl1251_sdio.o - -ccflags-y += -D__CHECK_ENDIAN__ diff --git a/drivers/net/wireless/ti/wl1251/acx.c b/drivers/net/wireless/ti/wl1251/acx.c deleted file mode 100644 index db6430c1a084..000000000000 --- a/drivers/net/wireless/ti/wl1251/acx.c +++ /dev/null @@ -1,1097 +0,0 @@ -#include "acx.h" - -#include -#include -#include - -#include "wl1251.h" -#include "reg.h" -#include "cmd.h" -#include "ps.h" - -int wl1251_acx_frame_rates(struct wl1251 *wl, u8 ctrl_rate, u8 ctrl_mod, - u8 mgt_rate, u8 mgt_mod) -{ - struct acx_fw_gen_frame_rates *rates; - int ret; - - wl1251_debug(DEBUG_ACX, "acx frame rates"); - - rates = kzalloc(sizeof(*rates), GFP_KERNEL); - if (!rates) { - ret = -ENOMEM; - goto out; - } - - rates->tx_ctrl_frame_rate = ctrl_rate; - rates->tx_ctrl_frame_mod = ctrl_mod; - rates->tx_mgt_frame_rate = mgt_rate; - rates->tx_mgt_frame_mod = mgt_mod; - - ret = wl1251_cmd_configure(wl, ACX_FW_GEN_FRAME_RATES, - rates, sizeof(*rates)); - if (ret < 0) { - wl1251_error("Failed to set FW rates and modulation"); - goto out; - } - -out: - kfree(rates); - return ret; -} - - -int wl1251_acx_station_id(struct wl1251 *wl) -{ - struct acx_dot11_station_id *mac; - int ret, i; - - wl1251_debug(DEBUG_ACX, "acx dot11_station_id"); - - mac = kzalloc(sizeof(*mac), GFP_KERNEL); - if (!mac) { - ret = -ENOMEM; - goto out; - } - - for (i = 0; i < ETH_ALEN; i++) - mac->mac[i] = wl->mac_addr[ETH_ALEN - 1 - i]; - - ret = wl1251_cmd_configure(wl, DOT11_STATION_ID, mac, sizeof(*mac)); - if (ret < 0) - goto out; - -out: - kfree(mac); - return ret; -} - -int wl1251_acx_default_key(struct wl1251 *wl, u8 key_id) -{ - struct acx_dot11_default_key *default_key; - int ret; - - wl1251_debug(DEBUG_ACX, "acx dot11_default_key (%d)", key_id); - - default_key = kzalloc(sizeof(*default_key), GFP_KERNEL); - if (!default_key) { - ret = -ENOMEM; - goto out; - } - - default_key->id = key_id; - - ret = wl1251_cmd_configure(wl, DOT11_DEFAULT_KEY, - default_key, sizeof(*default_key)); - if (ret < 0) { - wl1251_error("Couldn't set default key"); - goto out; - } - - wl->default_key = key_id; - -out: - kfree(default_key); - return ret; -} - -int wl1251_acx_wake_up_conditions(struct wl1251 *wl, u8 wake_up_event, - u8 listen_interval) -{ - struct acx_wake_up_condition *wake_up; - int ret; - - wl1251_debug(DEBUG_ACX, "acx wake up conditions"); - - wake_up = kzalloc(sizeof(*wake_up), GFP_KERNEL); - if (!wake_up) { - ret = -ENOMEM; - goto out; - } - - wake_up->wake_up_event = wake_up_event; - wake_up->listen_interval = listen_interval; - - ret = wl1251_cmd_configure(wl, ACX_WAKE_UP_CONDITIONS, - wake_up, sizeof(*wake_up)); - if (ret < 0) { - wl1251_warning("could not set wake up conditions: %d", ret); - goto out; - } - -out: - kfree(wake_up); - return ret; -} - -int wl1251_acx_sleep_auth(struct wl1251 *wl, u8 sleep_auth) -{ - struct acx_sleep_auth *auth; - int ret; - - wl1251_debug(DEBUG_ACX, "acx sleep auth"); - - auth = kzalloc(sizeof(*auth), GFP_KERNEL); - if (!auth) { - ret = -ENOMEM; - goto out; - } - - auth->sleep_auth = sleep_auth; - - ret = wl1251_cmd_configure(wl, ACX_SLEEP_AUTH, auth, sizeof(*auth)); - -out: - kfree(auth); - return ret; -} - -int wl1251_acx_fw_version(struct wl1251 *wl, char *buf, size_t len) -{ - struct acx_revision *rev; - int ret; - - wl1251_debug(DEBUG_ACX, "acx fw rev"); - - rev = kzalloc(sizeof(*rev), GFP_KERNEL); - if (!rev) { - ret = -ENOMEM; - goto out; - } - - ret = wl1251_cmd_interrogate(wl, ACX_FW_REV, rev, sizeof(*rev)); - if (ret < 0) { - wl1251_warning("ACX_FW_REV interrogate failed"); - goto out; - } - - /* be careful with the buffer sizes */ - strncpy(buf, rev->fw_version, min(len, sizeof(rev->fw_version))); - - /* - * if the firmware version string is exactly - * sizeof(rev->fw_version) long or fw_len is less than - * sizeof(rev->fw_version) it won't be null terminated - */ - buf[min(len, sizeof(rev->fw_version)) - 1] = '\0'; - -out: - kfree(rev); - return ret; -} - -int wl1251_acx_tx_power(struct wl1251 *wl, int power) -{ - struct acx_current_tx_power *acx; - int ret; - - wl1251_debug(DEBUG_ACX, "acx dot11_cur_tx_pwr"); - - if (power < 0 || power > 25) - return -EINVAL; - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->current_tx_power = power * 10; - - ret = wl1251_cmd_configure(wl, DOT11_CUR_TX_PWR, acx, sizeof(*acx)); - if (ret < 0) { - wl1251_warning("configure of tx power failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1251_acx_feature_cfg(struct wl1251 *wl) -{ - struct acx_feature_config *feature; - int ret; - - wl1251_debug(DEBUG_ACX, "acx feature cfg"); - - feature = kzalloc(sizeof(*feature), GFP_KERNEL); - if (!feature) { - ret = -ENOMEM; - goto out; - } - - /* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE are disabled */ - feature->data_flow_options = 0; - feature->options = 0; - - ret = wl1251_cmd_configure(wl, ACX_FEATURE_CFG, - feature, sizeof(*feature)); - if (ret < 0) { - wl1251_error("Couldn't set HW encryption"); - goto out; - } - -out: - kfree(feature); - return ret; -} - -int wl1251_acx_mem_map(struct wl1251 *wl, struct acx_header *mem_map, - size_t len) -{ - int ret; - - wl1251_debug(DEBUG_ACX, "acx mem map"); - - ret = wl1251_cmd_interrogate(wl, ACX_MEM_MAP, mem_map, len); - if (ret < 0) - return ret; - - return 0; -} - -int wl1251_acx_data_path_params(struct wl1251 *wl, - struct acx_data_path_params_resp *resp) -{ - struct acx_data_path_params *params; - int ret; - - wl1251_debug(DEBUG_ACX, "acx data path params"); - - params = kzalloc(sizeof(*params), GFP_KERNEL); - if (!params) { - ret = -ENOMEM; - goto out; - } - - params->rx_packet_ring_chunk_size = DP_RX_PACKET_RING_CHUNK_SIZE; - params->tx_packet_ring_chunk_size = DP_TX_PACKET_RING_CHUNK_SIZE; - - params->rx_packet_ring_chunk_num = DP_RX_PACKET_RING_CHUNK_NUM; - params->tx_packet_ring_chunk_num = DP_TX_PACKET_RING_CHUNK_NUM; - - params->tx_complete_threshold = 1; - - params->tx_complete_ring_depth = FW_TX_CMPLT_BLOCK_SIZE; - - params->tx_complete_timeout = DP_TX_COMPLETE_TIME_OUT; - - ret = wl1251_cmd_configure(wl, ACX_DATA_PATH_PARAMS, - params, sizeof(*params)); - if (ret < 0) - goto out; - - /* FIXME: shouldn't this be ACX_DATA_PATH_RESP_PARAMS? */ - ret = wl1251_cmd_interrogate(wl, ACX_DATA_PATH_PARAMS, - resp, sizeof(*resp)); - - if (ret < 0) { - wl1251_warning("failed to read data path parameters: %d", ret); - goto out; - } else if (resp->header.cmd.status != CMD_STATUS_SUCCESS) { - wl1251_warning("data path parameter acx status failed"); - ret = -EIO; - goto out; - } - -out: - kfree(params); - return ret; -} - -int wl1251_acx_rx_msdu_life_time(struct wl1251 *wl, u32 life_time) -{ - struct acx_rx_msdu_lifetime *acx; - int ret; - - wl1251_debug(DEBUG_ACX, "acx rx msdu life time"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->lifetime = life_time; - ret = wl1251_cmd_configure(wl, DOT11_RX_MSDU_LIFE_TIME, - acx, sizeof(*acx)); - if (ret < 0) { - wl1251_warning("failed to set rx msdu life time: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1251_acx_rx_config(struct wl1251 *wl, u32 config, u32 filter) -{ - struct acx_rx_config *rx_config; - int ret; - - wl1251_debug(DEBUG_ACX, "acx rx config"); - - rx_config = kzalloc(sizeof(*rx_config), GFP_KERNEL); - if (!rx_config) { - ret = -ENOMEM; - goto out; - } - - rx_config->config_options = config; - rx_config->filter_options = filter; - - ret = wl1251_cmd_configure(wl, ACX_RX_CFG, - rx_config, sizeof(*rx_config)); - if (ret < 0) { - wl1251_warning("failed to set rx config: %d", ret); - goto out; - } - -out: - kfree(rx_config); - return ret; -} - -int wl1251_acx_pd_threshold(struct wl1251 *wl) -{ - struct acx_packet_detection *pd; - int ret; - - wl1251_debug(DEBUG_ACX, "acx data pd threshold"); - - pd = kzalloc(sizeof(*pd), GFP_KERNEL); - if (!pd) { - ret = -ENOMEM; - goto out; - } - - /* FIXME: threshold value not set */ - - ret = wl1251_cmd_configure(wl, ACX_PD_THRESHOLD, pd, sizeof(*pd)); - if (ret < 0) { - wl1251_warning("failed to set pd threshold: %d", ret); - goto out; - } - -out: - kfree(pd); - return ret; -} - -int wl1251_acx_slot(struct wl1251 *wl, enum acx_slot_type slot_time) -{ - struct acx_slot *slot; - int ret; - - wl1251_debug(DEBUG_ACX, "acx slot"); - - slot = kzalloc(sizeof(*slot), GFP_KERNEL); - if (!slot) { - ret = -ENOMEM; - goto out; - } - - slot->wone_index = STATION_WONE_INDEX; - slot->slot_time = slot_time; - - ret = wl1251_cmd_configure(wl, ACX_SLOT, slot, sizeof(*slot)); - if (ret < 0) { - wl1251_warning("failed to set slot time: %d", ret); - goto out; - } - -out: - kfree(slot); - return ret; -} - -int wl1251_acx_group_address_tbl(struct wl1251 *wl) -{ - struct acx_dot11_grp_addr_tbl *acx; - int ret; - - wl1251_debug(DEBUG_ACX, "acx group address tbl"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - /* MAC filtering */ - acx->enabled = 0; - acx->num_groups = 0; - memset(acx->mac_table, 0, ADDRESS_GROUP_MAX_LEN); - - ret = wl1251_cmd_configure(wl, DOT11_GROUP_ADDRESS_TBL, - acx, sizeof(*acx)); - if (ret < 0) { - wl1251_warning("failed to set group addr table: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1251_acx_service_period_timeout(struct wl1251 *wl) -{ - struct acx_rx_timeout *rx_timeout; - int ret; - - rx_timeout = kzalloc(sizeof(*rx_timeout), GFP_KERNEL); - if (!rx_timeout) { - ret = -ENOMEM; - goto out; - } - - wl1251_debug(DEBUG_ACX, "acx service period timeout"); - - rx_timeout->ps_poll_timeout = RX_TIMEOUT_PS_POLL_DEF; - rx_timeout->upsd_timeout = RX_TIMEOUT_UPSD_DEF; - - ret = wl1251_cmd_configure(wl, ACX_SERVICE_PERIOD_TIMEOUT, - rx_timeout, sizeof(*rx_timeout)); - if (ret < 0) { - wl1251_warning("failed to set service period timeout: %d", - ret); - goto out; - } - -out: - kfree(rx_timeout); - return ret; -} - -int wl1251_acx_rts_threshold(struct wl1251 *wl, u16 rts_threshold) -{ - struct acx_rts_threshold *rts; - int ret; - - wl1251_debug(DEBUG_ACX, "acx rts threshold"); - - rts = kzalloc(sizeof(*rts), GFP_KERNEL); - if (!rts) { - ret = -ENOMEM; - goto out; - } - - rts->threshold = rts_threshold; - - ret = wl1251_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts)); - if (ret < 0) { - wl1251_warning("failed to set rts threshold: %d", ret); - goto out; - } - -out: - kfree(rts); - return ret; -} - -int wl1251_acx_beacon_filter_opt(struct wl1251 *wl, bool enable_filter) -{ - struct acx_beacon_filter_option *beacon_filter; - int ret; - - wl1251_debug(DEBUG_ACX, "acx beacon filter opt"); - - beacon_filter = kzalloc(sizeof(*beacon_filter), GFP_KERNEL); - if (!beacon_filter) { - ret = -ENOMEM; - goto out; - } - - beacon_filter->enable = enable_filter; - beacon_filter->max_num_beacons = 0; - - ret = wl1251_cmd_configure(wl, ACX_BEACON_FILTER_OPT, - beacon_filter, sizeof(*beacon_filter)); - if (ret < 0) { - wl1251_warning("failed to set beacon filter opt: %d", ret); - goto out; - } - -out: - kfree(beacon_filter); - return ret; -} - -int wl1251_acx_beacon_filter_table(struct wl1251 *wl) -{ - struct acx_beacon_filter_ie_table *ie_table; - int idx = 0; - int ret; - - wl1251_debug(DEBUG_ACX, "acx beacon filter table"); - - ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL); - if (!ie_table) { - ret = -ENOMEM; - goto out; - } - - /* configure default beacon pass-through rules */ - ie_table->num_ie = 1; - ie_table->table[idx++] = BEACON_FILTER_IE_ID_CHANNEL_SWITCH_ANN; - ie_table->table[idx++] = BEACON_RULE_PASS_ON_APPEARANCE; - - ret = wl1251_cmd_configure(wl, ACX_BEACON_FILTER_TABLE, - ie_table, sizeof(*ie_table)); - if (ret < 0) { - wl1251_warning("failed to set beacon filter table: %d", ret); - goto out; - } - -out: - kfree(ie_table); - return ret; -} - -int wl1251_acx_conn_monit_params(struct wl1251 *wl) -{ - struct acx_conn_monit_params *acx; - int ret; - - wl1251_debug(DEBUG_ACX, "acx connection monitor parameters"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->synch_fail_thold = SYNCH_FAIL_DEFAULT_THRESHOLD; - acx->bss_lose_timeout = NO_BEACON_DEFAULT_TIMEOUT; - - ret = wl1251_cmd_configure(wl, ACX_CONN_MONIT_PARAMS, - acx, sizeof(*acx)); - if (ret < 0) { - wl1251_warning("failed to set connection monitor " - "parameters: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1251_acx_sg_enable(struct wl1251 *wl) -{ - struct acx_bt_wlan_coex *pta; - int ret; - - wl1251_debug(DEBUG_ACX, "acx sg enable"); - - pta = kzalloc(sizeof(*pta), GFP_KERNEL); - if (!pta) { - ret = -ENOMEM; - goto out; - } - - pta->enable = SG_ENABLE; - - ret = wl1251_cmd_configure(wl, ACX_SG_ENABLE, pta, sizeof(*pta)); - if (ret < 0) { - wl1251_warning("failed to set softgemini enable: %d", ret); - goto out; - } - -out: - kfree(pta); - return ret; -} - -int wl1251_acx_sg_cfg(struct wl1251 *wl) -{ - struct acx_bt_wlan_coex_param *param; - int ret; - - wl1251_debug(DEBUG_ACX, "acx sg cfg"); - - param = kzalloc(sizeof(*param), GFP_KERNEL); - if (!param) { - ret = -ENOMEM; - goto out; - } - - /* BT-WLAN coext parameters */ - param->min_rate = RATE_INDEX_24MBPS; - param->bt_hp_max_time = PTA_BT_HP_MAXTIME_DEF; - param->wlan_hp_max_time = PTA_WLAN_HP_MAX_TIME_DEF; - param->sense_disable_timer = PTA_SENSE_DISABLE_TIMER_DEF; - param->rx_time_bt_hp = PTA_PROTECTIVE_RX_TIME_DEF; - param->tx_time_bt_hp = PTA_PROTECTIVE_TX_TIME_DEF; - param->rx_time_bt_hp_fast = PTA_PROTECTIVE_RX_TIME_FAST_DEF; - param->tx_time_bt_hp_fast = PTA_PROTECTIVE_TX_TIME_FAST_DEF; - param->wlan_cycle_fast = PTA_CYCLE_TIME_FAST_DEF; - param->bt_anti_starvation_period = PTA_ANTI_STARVE_PERIOD_DEF; - param->next_bt_lp_packet = PTA_TIMEOUT_NEXT_BT_LP_PACKET_DEF; - param->wake_up_beacon = PTA_TIME_BEFORE_BEACON_DEF; - param->hp_dm_max_guard_time = PTA_HPDM_MAX_TIME_DEF; - param->next_wlan_packet = PTA_TIME_OUT_NEXT_WLAN_DEF; - param->antenna_type = PTA_ANTENNA_TYPE_DEF; - param->signal_type = PTA_SIGNALING_TYPE_DEF; - param->afh_leverage_on = PTA_AFH_LEVERAGE_ON_DEF; - param->quiet_cycle_num = PTA_NUMBER_QUIET_CYCLE_DEF; - param->max_cts = PTA_MAX_NUM_CTS_DEF; - param->wlan_packets_num = PTA_NUMBER_OF_WLAN_PACKETS_DEF; - param->bt_packets_num = PTA_NUMBER_OF_BT_PACKETS_DEF; - param->missed_rx_avalanche = PTA_RX_FOR_AVALANCHE_DEF; - param->wlan_elp_hp = PTA_ELP_HP_DEF; - param->bt_anti_starvation_cycles = PTA_ANTI_STARVE_NUM_CYCLE_DEF; - param->ack_mode_dual_ant = PTA_ACK_MODE_DEF; - param->pa_sd_enable = PTA_ALLOW_PA_SD_DEF; - param->pta_auto_mode_enable = PTA_AUTO_MODE_NO_CTS_DEF; - param->bt_hp_respected_num = PTA_BT_HP_RESPECTED_DEF; - - ret = wl1251_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param)); - if (ret < 0) { - wl1251_warning("failed to set sg config: %d", ret); - goto out; - } - -out: - kfree(param); - return ret; -} - -int wl1251_acx_cca_threshold(struct wl1251 *wl) -{ - struct acx_energy_detection *detection; - int ret; - - wl1251_debug(DEBUG_ACX, "acx cca threshold"); - - detection = kzalloc(sizeof(*detection), GFP_KERNEL); - if (!detection) { - ret = -ENOMEM; - goto out; - } - - detection->rx_cca_threshold = CCA_THRSH_DISABLE_ENERGY_D; - detection->tx_energy_detection = 0; - - ret = wl1251_cmd_configure(wl, ACX_CCA_THRESHOLD, - detection, sizeof(*detection)); - if (ret < 0) - wl1251_warning("failed to set cca threshold: %d", ret); - -out: - kfree(detection); - return ret; -} - -int wl1251_acx_bcn_dtim_options(struct wl1251 *wl) -{ - struct acx_beacon_broadcast *bb; - int ret; - - wl1251_debug(DEBUG_ACX, "acx bcn dtim options"); - - bb = kzalloc(sizeof(*bb), GFP_KERNEL); - if (!bb) { - ret = -ENOMEM; - goto out; - } - - bb->beacon_rx_timeout = BCN_RX_TIMEOUT_DEF_VALUE; - bb->broadcast_timeout = BROADCAST_RX_TIMEOUT_DEF_VALUE; - bb->rx_broadcast_in_ps = RX_BROADCAST_IN_PS_DEF_VALUE; - bb->ps_poll_threshold = CONSECUTIVE_PS_POLL_FAILURE_DEF; - - ret = wl1251_cmd_configure(wl, ACX_BCN_DTIM_OPTIONS, bb, sizeof(*bb)); - if (ret < 0) { - wl1251_warning("failed to set rx config: %d", ret); - goto out; - } - -out: - kfree(bb); - return ret; -} - -int wl1251_acx_aid(struct wl1251 *wl, u16 aid) -{ - struct acx_aid *acx_aid; - int ret; - - wl1251_debug(DEBUG_ACX, "acx aid"); - - acx_aid = kzalloc(sizeof(*acx_aid), GFP_KERNEL); - if (!acx_aid) { - ret = -ENOMEM; - goto out; - } - - acx_aid->aid = aid; - - ret = wl1251_cmd_configure(wl, ACX_AID, acx_aid, sizeof(*acx_aid)); - if (ret < 0) { - wl1251_warning("failed to set aid: %d", ret); - goto out; - } - -out: - kfree(acx_aid); - return ret; -} - -int wl1251_acx_event_mbox_mask(struct wl1251 *wl, u32 event_mask) -{ - struct acx_event_mask *mask; - int ret; - - wl1251_debug(DEBUG_ACX, "acx event mbox mask"); - - mask = kzalloc(sizeof(*mask), GFP_KERNEL); - if (!mask) { - ret = -ENOMEM; - goto out; - } - - /* high event mask is unused */ - mask->high_event_mask = 0xffffffff; - - mask->event_mask = event_mask; - - ret = wl1251_cmd_configure(wl, ACX_EVENT_MBOX_MASK, - mask, sizeof(*mask)); - if (ret < 0) { - wl1251_warning("failed to set acx_event_mbox_mask: %d", ret); - goto out; - } - -out: - kfree(mask); - return ret; -} - -int wl1251_acx_low_rssi(struct wl1251 *wl, s8 threshold, u8 weight, - u8 depth, enum wl1251_acx_low_rssi_type type) -{ - struct acx_low_rssi *rssi; - int ret; - - wl1251_debug(DEBUG_ACX, "acx low rssi"); - - rssi = kzalloc(sizeof(*rssi), GFP_KERNEL); - if (!rssi) - return -ENOMEM; - - rssi->threshold = threshold; - rssi->weight = weight; - rssi->depth = depth; - rssi->type = type; - - ret = wl1251_cmd_configure(wl, ACX_LOW_RSSI, rssi, sizeof(*rssi)); - if (ret < 0) - wl1251_warning("failed to set low rssi threshold: %d", ret); - - kfree(rssi); - return ret; -} - -int wl1251_acx_set_preamble(struct wl1251 *wl, enum acx_preamble_type preamble) -{ - struct acx_preamble *acx; - int ret; - - wl1251_debug(DEBUG_ACX, "acx_set_preamble"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->preamble = preamble; - - ret = wl1251_cmd_configure(wl, ACX_PREAMBLE_TYPE, acx, sizeof(*acx)); - if (ret < 0) { - wl1251_warning("Setting of preamble failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1251_acx_cts_protect(struct wl1251 *wl, - enum acx_ctsprotect_type ctsprotect) -{ - struct acx_ctsprotect *acx; - int ret; - - wl1251_debug(DEBUG_ACX, "acx_set_ctsprotect"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->ctsprotect = ctsprotect; - - ret = wl1251_cmd_configure(wl, ACX_CTS_PROTECTION, acx, sizeof(*acx)); - if (ret < 0) { - wl1251_warning("Setting of ctsprotect failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1251_acx_tsf_info(struct wl1251 *wl, u64 *mactime) -{ - struct acx_tsf_info *tsf_info; - int ret; - - tsf_info = kzalloc(sizeof(*tsf_info), GFP_KERNEL); - if (!tsf_info) { - ret = -ENOMEM; - goto out; - } - - ret = wl1251_cmd_interrogate(wl, ACX_TSF_INFO, - tsf_info, sizeof(*tsf_info)); - if (ret < 0) { - wl1251_warning("ACX_FW_REV interrogate failed"); - goto out; - } - - *mactime = tsf_info->current_tsf_lsb | - ((u64)tsf_info->current_tsf_msb << 32); - -out: - kfree(tsf_info); - return ret; -} - -int wl1251_acx_statistics(struct wl1251 *wl, struct acx_statistics *stats) -{ - int ret; - - wl1251_debug(DEBUG_ACX, "acx statistics"); - - ret = wl1251_cmd_interrogate(wl, ACX_STATISTICS, stats, - sizeof(*stats)); - if (ret < 0) { - wl1251_warning("acx statistics failed: %d", ret); - return -ENOMEM; - } - - return 0; -} - -int wl1251_acx_rate_policies(struct wl1251 *wl) -{ - struct acx_rate_policy *acx; - int ret = 0; - - wl1251_debug(DEBUG_ACX, "acx rate policies"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - - if (!acx) { - ret = -ENOMEM; - goto out; - } - - /* configure one default (one-size-fits-all) rate class */ - acx->rate_class_cnt = 1; - acx->rate_class[0].enabled_rates = ACX_RATE_MASK_UNSPECIFIED; - acx->rate_class[0].short_retry_limit = ACX_RATE_RETRY_LIMIT; - acx->rate_class[0].long_retry_limit = ACX_RATE_RETRY_LIMIT; - acx->rate_class[0].aflags = 0; - - ret = wl1251_cmd_configure(wl, ACX_RATE_POLICY, acx, sizeof(*acx)); - if (ret < 0) { - wl1251_warning("Setting of rate policies failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1251_acx_mem_cfg(struct wl1251 *wl) -{ - struct wl1251_acx_config_memory *mem_conf; - int ret, i; - - wl1251_debug(DEBUG_ACX, "acx mem cfg"); - - mem_conf = kzalloc(sizeof(*mem_conf), GFP_KERNEL); - if (!mem_conf) { - ret = -ENOMEM; - goto out; - } - - /* memory config */ - mem_conf->mem_config.num_stations = cpu_to_le16(DEFAULT_NUM_STATIONS); - mem_conf->mem_config.rx_mem_block_num = 35; - mem_conf->mem_config.tx_min_mem_block_num = 64; - mem_conf->mem_config.num_tx_queues = MAX_TX_QUEUES; - mem_conf->mem_config.host_if_options = HOSTIF_PKT_RING; - mem_conf->mem_config.num_ssid_profiles = 1; - mem_conf->mem_config.debug_buffer_size = - cpu_to_le16(TRACE_BUFFER_MAX_SIZE); - - /* RX queue config */ - mem_conf->rx_queue_config.dma_address = 0; - mem_conf->rx_queue_config.num_descs = ACX_RX_DESC_DEF; - mem_conf->rx_queue_config.priority = DEFAULT_RXQ_PRIORITY; - mem_conf->rx_queue_config.type = DEFAULT_RXQ_TYPE; - - /* TX queue config */ - for (i = 0; i < MAX_TX_QUEUES; i++) { - mem_conf->tx_queue_config[i].num_descs = ACX_TX_DESC_DEF; - mem_conf->tx_queue_config[i].attributes = i; - } - - ret = wl1251_cmd_configure(wl, ACX_MEM_CFG, mem_conf, - sizeof(*mem_conf)); - if (ret < 0) { - wl1251_warning("wl1251 mem config failed: %d", ret); - goto out; - } - -out: - kfree(mem_conf); - return ret; -} - -int wl1251_acx_wr_tbtt_and_dtim(struct wl1251 *wl, u16 tbtt, u8 dtim) -{ - struct wl1251_acx_wr_tbtt_and_dtim *acx; - int ret; - - wl1251_debug(DEBUG_ACX, "acx tbtt and dtim"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->tbtt = tbtt; - acx->dtim = dtim; - - ret = wl1251_cmd_configure(wl, ACX_WR_TBTT_AND_DTIM, - acx, sizeof(*acx)); - if (ret < 0) { - wl1251_warning("failed to set tbtt and dtim: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1251_acx_bet_enable(struct wl1251 *wl, enum wl1251_acx_bet_mode mode, - u8 max_consecutive) -{ - struct wl1251_acx_bet_enable *acx; - int ret; - - wl1251_debug(DEBUG_ACX, "acx bet enable"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->enable = mode; - acx->max_consecutive = max_consecutive; - - ret = wl1251_cmd_configure(wl, ACX_BET_ENABLE, acx, sizeof(*acx)); - if (ret < 0) { - wl1251_warning("wl1251 acx bet enable failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1251_acx_ac_cfg(struct wl1251 *wl, u8 ac, u8 cw_min, u16 cw_max, - u8 aifs, u16 txop) -{ - struct wl1251_acx_ac_cfg *acx; - int ret = 0; - - wl1251_debug(DEBUG_ACX, "acx ac cfg %d cw_ming %d cw_max %d " - "aifs %d txop %d", ac, cw_min, cw_max, aifs, txop); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->ac = ac; - acx->cw_min = cw_min; - acx->cw_max = cw_max; - acx->aifsn = aifs; - acx->txop_limit = txop; - - ret = wl1251_cmd_configure(wl, ACX_AC_CFG, acx, sizeof(*acx)); - if (ret < 0) { - wl1251_warning("acx ac cfg failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1251_acx_tid_cfg(struct wl1251 *wl, u8 queue, - enum wl1251_acx_channel_type type, - u8 tsid, enum wl1251_acx_ps_scheme ps_scheme, - enum wl1251_acx_ack_policy ack_policy) -{ - struct wl1251_acx_tid_cfg *acx; - int ret = 0; - - wl1251_debug(DEBUG_ACX, "acx tid cfg %d type %d tsid %d " - "ps_scheme %d ack_policy %d", queue, type, tsid, - ps_scheme, ack_policy); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->queue = queue; - acx->type = type; - acx->tsid = tsid; - acx->ps_scheme = ps_scheme; - acx->ack_policy = ack_policy; - - ret = wl1251_cmd_configure(wl, ACX_TID_CFG, acx, sizeof(*acx)); - if (ret < 0) { - wl1251_warning("acx tid cfg failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} diff --git a/drivers/net/wireless/ti/wl1251/acx.h b/drivers/net/wireless/ti/wl1251/acx.h deleted file mode 100644 index c2ba100f9b1a..000000000000 --- a/drivers/net/wireless/ti/wl1251/acx.h +++ /dev/null @@ -1,1483 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (c) 1998-2007 Texas Instruments Incorporated - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL1251_ACX_H__ -#define __WL1251_ACX_H__ - -#include "wl1251.h" -#include "cmd.h" - -/* Target's information element */ -struct acx_header { - struct wl1251_cmd_header cmd; - - /* acx (or information element) header */ - u16 id; - - /* payload length (not including headers */ - u16 len; -} __packed; - -struct acx_error_counter { - struct acx_header header; - - /* The number of PLCP errors since the last time this */ - /* information element was interrogated. This field is */ - /* automatically cleared when it is interrogated.*/ - u32 PLCP_error; - - /* The number of FCS errors since the last time this */ - /* information element was interrogated. This field is */ - /* automatically cleared when it is interrogated.*/ - u32 FCS_error; - - /* The number of MPDUs without PLCP header errors received*/ - /* since the last time this information element was interrogated. */ - /* This field is automatically cleared when it is interrogated.*/ - u32 valid_frame; - - /* the number of missed sequence numbers in the squentially */ - /* values of frames seq numbers */ - u32 seq_num_miss; -} __packed; - -struct acx_revision { - struct acx_header header; - - /* - * The WiLink firmware version, an ASCII string x.x.x.x, - * that uniquely identifies the current firmware. - * The left most digit is incremented each time a - * significant change is made to the firmware, such as - * code redesign or new platform support. - * The second digit is incremented when major enhancements - * are added or major fixes are made. - * The third digit is incremented for each GA release. - * The fourth digit is incremented for each build. - * The first two digits identify a firmware release version, - * in other words, a unique set of features. - * The first three digits identify a GA release. - */ - char fw_version[20]; - - /* - * This 4 byte field specifies the WiLink hardware version. - * bits 0 - 15: Reserved. - * bits 16 - 23: Version ID - The WiLink version ID - * (1 = first spin, 2 = second spin, and so on). - * bits 24 - 31: Chip ID - The WiLink chip ID. - */ - u32 hw_version; -} __packed; - -enum wl1251_psm_mode { - /* Active mode */ - WL1251_PSM_CAM = 0, - - /* Power save mode */ - WL1251_PSM_PS = 1, - - /* Extreme low power */ - WL1251_PSM_ELP = 2, -}; - -struct acx_sleep_auth { - struct acx_header header; - - /* The sleep level authorization of the device. */ - /* 0 - Always active*/ - /* 1 - Power down mode: light / fast sleep*/ - /* 2 - ELP mode: Deep / Max sleep*/ - u8 sleep_auth; - u8 padding[3]; -} __packed; - -enum { - HOSTIF_PCI_MASTER_HOST_INDIRECT, - HOSTIF_PCI_MASTER_HOST_DIRECT, - HOSTIF_SLAVE, - HOSTIF_PKT_RING, - HOSTIF_DONTCARE = 0xFF -}; - -#define DEFAULT_UCAST_PRIORITY 0 -#define DEFAULT_RX_Q_PRIORITY 0 -#define DEFAULT_NUM_STATIONS 1 -#define DEFAULT_RXQ_PRIORITY 0 /* low 0 .. 15 high */ -#define DEFAULT_RXQ_TYPE 0x07 /* All frames, Data/Ctrl/Mgmt */ -#define TRACE_BUFFER_MAX_SIZE 256 - -#define DP_RX_PACKET_RING_CHUNK_SIZE 1600 -#define DP_TX_PACKET_RING_CHUNK_SIZE 1600 -#define DP_RX_PACKET_RING_CHUNK_NUM 2 -#define DP_TX_PACKET_RING_CHUNK_NUM 2 -#define DP_TX_COMPLETE_TIME_OUT 20 -#define FW_TX_CMPLT_BLOCK_SIZE 16 - -struct acx_data_path_params { - struct acx_header header; - - u16 rx_packet_ring_chunk_size; - u16 tx_packet_ring_chunk_size; - - u8 rx_packet_ring_chunk_num; - u8 tx_packet_ring_chunk_num; - - /* - * Maximum number of packets that can be gathered - * in the TX complete ring before an interrupt - * is generated. - */ - u8 tx_complete_threshold; - - /* Number of pending TX complete entries in cyclic ring.*/ - u8 tx_complete_ring_depth; - - /* - * Max num microseconds since a packet enters the TX - * complete ring until an interrupt is generated. - */ - u32 tx_complete_timeout; -} __packed; - - -struct acx_data_path_params_resp { - struct acx_header header; - - u16 rx_packet_ring_chunk_size; - u16 tx_packet_ring_chunk_size; - - u8 rx_packet_ring_chunk_num; - u8 tx_packet_ring_chunk_num; - - u8 pad[2]; - - u32 rx_packet_ring_addr; - u32 tx_packet_ring_addr; - - u32 rx_control_addr; - u32 tx_control_addr; - - u32 tx_complete_addr; -} __packed; - -#define TX_MSDU_LIFETIME_MIN 0 -#define TX_MSDU_LIFETIME_MAX 3000 -#define TX_MSDU_LIFETIME_DEF 512 -#define RX_MSDU_LIFETIME_MIN 0 -#define RX_MSDU_LIFETIME_MAX 0xFFFFFFFF -#define RX_MSDU_LIFETIME_DEF 512000 - -struct acx_rx_msdu_lifetime { - struct acx_header header; - - /* - * The maximum amount of time, in TU, before the - * firmware discards the MSDU. - */ - u32 lifetime; -} __packed; - -/* - * RX Config Options Table - * Bit Definition - * === ========== - * 31:14 Reserved - * 13 Copy RX Status - when set, write three receive status words - * to top of rx'd MPDUs. - * When cleared, do not write three status words (added rev 1.5) - * 12 Reserved - * 11 RX Complete upon FCS error - when set, give rx complete - * interrupt for FCS errors, after the rx filtering, e.g. unicast - * frames not to us with FCS error will not generate an interrupt. - * 10 SSID Filter Enable - When set, the WiLink discards all beacon, - * probe request, and probe response frames with an SSID that does - * not match the SSID specified by the host in the START/JOIN - * command. - * When clear, the WiLink receives frames with any SSID. - * 9 Broadcast Filter Enable - When set, the WiLink discards all - * broadcast frames. When clear, the WiLink receives all received - * broadcast frames. - * 8:6 Reserved - * 5 BSSID Filter Enable - When set, the WiLink discards any frames - * with a BSSID that does not match the BSSID specified by the - * host. - * When clear, the WiLink receives frames from any BSSID. - * 4 MAC Addr Filter - When set, the WiLink discards any frames - * with a destination address that does not match the MAC address - * of the adaptor. - * When clear, the WiLink receives frames destined to any MAC - * address. - * 3 Promiscuous - When set, the WiLink receives all valid frames - * (i.e., all frames that pass the FCS check). - * When clear, only frames that pass the other filters specified - * are received. - * 2 FCS - When set, the WiLink includes the FCS with the received - * frame. - * When cleared, the FCS is discarded. - * 1 PLCP header - When set, write all data from baseband to frame - * buffer including PHY header. - * 0 Reserved - Always equal to 0. - * - * RX Filter Options Table - * Bit Definition - * === ========== - * 31:12 Reserved - Always equal to 0. - * 11 Association - When set, the WiLink receives all association - * related frames (association request/response, reassocation - * request/response, and disassociation). When clear, these frames - * are discarded. - * 10 Auth/De auth - When set, the WiLink receives all authentication - * and de-authentication frames. When clear, these frames are - * discarded. - * 9 Beacon - When set, the WiLink receives all beacon frames. - * When clear, these frames are discarded. - * 8 Contention Free - When set, the WiLink receives all contention - * free frames. - * When clear, these frames are discarded. - * 7 Control - When set, the WiLink receives all control frames. - * When clear, these frames are discarded. - * 6 Data - When set, the WiLink receives all data frames. - * When clear, these frames are discarded. - * 5 FCS Error - When set, the WiLink receives frames that have FCS - * errors. - * When clear, these frames are discarded. - * 4 Management - When set, the WiLink receives all management - * frames. - * When clear, these frames are discarded. - * 3 Probe Request - When set, the WiLink receives all probe request - * frames. - * When clear, these frames are discarded. - * 2 Probe Response - When set, the WiLink receives all probe - * response frames. - * When clear, these frames are discarded. - * 1 RTS/CTS/ACK - When set, the WiLink receives all RTS, CTS and ACK - * frames. - * When clear, these frames are discarded. - * 0 Rsvd Type/Sub Type - When set, the WiLink receives all frames - * that have reserved frame types and sub types as defined by the - * 802.11 specification. - * When clear, these frames are discarded. - */ -struct acx_rx_config { - struct acx_header header; - - u32 config_options; - u32 filter_options; -} __packed; - -enum { - QOS_AC_BE = 0, - QOS_AC_BK, - QOS_AC_VI, - QOS_AC_VO, - QOS_HIGHEST_AC_INDEX = QOS_AC_VO, -}; - -#define MAX_NUM_OF_AC (QOS_HIGHEST_AC_INDEX+1) -#define FIRST_AC_INDEX QOS_AC_BE -#define MAX_NUM_OF_802_1d_TAGS 8 -#define AC_PARAMS_MAX_TSID 15 -#define MAX_APSD_CONF 0xffff - -#define QOS_TX_HIGH_MIN (0) -#define QOS_TX_HIGH_MAX (100) - -#define QOS_TX_HIGH_BK_DEF (25) -#define QOS_TX_HIGH_BE_DEF (35) -#define QOS_TX_HIGH_VI_DEF (35) -#define QOS_TX_HIGH_VO_DEF (35) - -#define QOS_TX_LOW_BK_DEF (15) -#define QOS_TX_LOW_BE_DEF (25) -#define QOS_TX_LOW_VI_DEF (25) -#define QOS_TX_LOW_VO_DEF (25) - -struct acx_tx_queue_qos_config { - struct acx_header header; - - u8 qid; - u8 pad[3]; - - /* Max number of blocks allowd in the queue */ - u16 high_threshold; - - /* Lowest memory blocks guaranteed for this queue */ - u16 low_threshold; -} __packed; - -struct acx_packet_detection { - struct acx_header header; - - u32 threshold; -} __packed; - - -enum acx_slot_type { - SLOT_TIME_LONG = 0, - SLOT_TIME_SHORT = 1, - DEFAULT_SLOT_TIME = SLOT_TIME_SHORT, - MAX_SLOT_TIMES = 0xFF -}; - -#define STATION_WONE_INDEX 0 - -struct acx_slot { - struct acx_header header; - - u8 wone_index; /* Reserved */ - u8 slot_time; - u8 reserved[6]; -} __packed; - - -#define ADDRESS_GROUP_MAX (8) -#define ADDRESS_GROUP_MAX_LEN (ETH_ALEN * ADDRESS_GROUP_MAX) - -struct acx_dot11_grp_addr_tbl { - struct acx_header header; - - u8 enabled; - u8 num_groups; - u8 pad[2]; - u8 mac_table[ADDRESS_GROUP_MAX_LEN]; -} __packed; - - -#define RX_TIMEOUT_PS_POLL_MIN 0 -#define RX_TIMEOUT_PS_POLL_MAX (200000) -#define RX_TIMEOUT_PS_POLL_DEF (15) -#define RX_TIMEOUT_UPSD_MIN 0 -#define RX_TIMEOUT_UPSD_MAX (200000) -#define RX_TIMEOUT_UPSD_DEF (15) - -struct acx_rx_timeout { - struct acx_header header; - - /* - * The longest time the STA will wait to receive - * traffic from the AP after a PS-poll has been - * transmitted. - */ - u16 ps_poll_timeout; - - /* - * The longest time the STA will wait to receive - * traffic from the AP after a frame has been sent - * from an UPSD enabled queue. - */ - u16 upsd_timeout; -} __packed; - -#define RTS_THRESHOLD_MIN 0 -#define RTS_THRESHOLD_MAX 4096 -#define RTS_THRESHOLD_DEF 2347 - -struct acx_rts_threshold { - struct acx_header header; - - u16 threshold; - u8 pad[2]; -} __packed; - -enum wl1251_acx_low_rssi_type { - /* - * The event is a "Level" indication which keeps triggering - * as long as the average RSSI is below the threshold. - */ - WL1251_ACX_LOW_RSSI_TYPE_LEVEL = 0, - - /* - * The event is an "Edge" indication which triggers - * only when the RSSI threshold is crossed from above. - */ - WL1251_ACX_LOW_RSSI_TYPE_EDGE = 1, -}; - -struct acx_low_rssi { - struct acx_header header; - - /* - * The threshold (in dBm) below (or above after low rssi - * indication) which the firmware generates an interrupt to the - * host. This parameter is signed. - */ - s8 threshold; - - /* - * The weight of the current RSSI sample, before adding the new - * sample, that is used to calculate the average RSSI. - */ - u8 weight; - - /* - * The number of Beacons/Probe response frames that will be - * received before issuing the Low or Regained RSSI event. - */ - u8 depth; - - /* - * Configures how the Low RSSI Event is triggered. Refer to - * enum wl1251_acx_low_rssi_type for more. - */ - u8 type; -} __packed; - -struct acx_beacon_filter_option { - struct acx_header header; - - u8 enable; - - /* - * The number of beacons without the unicast TIM - * bit set that the firmware buffers before - * signaling the host about ready frames. - * When set to 0 and the filter is enabled, beacons - * without the unicast TIM bit set are dropped. - */ - u8 max_num_beacons; - u8 pad[2]; -} __packed; - -/* - * ACXBeaconFilterEntry (not 221) - * Byte Offset Size (Bytes) Definition - * =========== ============ ========== - * 0 1 IE identifier - * 1 1 Treatment bit mask - * - * ACXBeaconFilterEntry (221) - * Byte Offset Size (Bytes) Definition - * =========== ============ ========== - * 0 1 IE identifier - * 1 1 Treatment bit mask - * 2 3 OUI - * 5 1 Type - * 6 2 Version - * - * - * Treatment bit mask - The information element handling: - * bit 0 - The information element is compared and transferred - * in case of change. - * bit 1 - The information element is transferred to the host - * with each appearance or disappearance. - * Note that both bits can be set at the same time. - */ -#define BEACON_FILTER_TABLE_MAX_IE_NUM (32) -#define BEACON_FILTER_TABLE_MAX_VENDOR_SPECIFIC_IE_NUM (6) -#define BEACON_FILTER_TABLE_IE_ENTRY_SIZE (2) -#define BEACON_FILTER_TABLE_EXTRA_VENDOR_SPECIFIC_IE_SIZE (6) -#define BEACON_FILTER_TABLE_MAX_SIZE ((BEACON_FILTER_TABLE_MAX_IE_NUM * \ - BEACON_FILTER_TABLE_IE_ENTRY_SIZE) + \ - (BEACON_FILTER_TABLE_MAX_VENDOR_SPECIFIC_IE_NUM * \ - BEACON_FILTER_TABLE_EXTRA_VENDOR_SPECIFIC_IE_SIZE)) - -#define BEACON_RULE_PASS_ON_CHANGE BIT(0) -#define BEACON_RULE_PASS_ON_APPEARANCE BIT(1) - -#define BEACON_FILTER_IE_ID_CHANNEL_SWITCH_ANN (37) - -struct acx_beacon_filter_ie_table { - struct acx_header header; - - u8 num_ie; - u8 pad[3]; - u8 table[BEACON_FILTER_TABLE_MAX_SIZE]; -} __packed; - -#define SYNCH_FAIL_DEFAULT_THRESHOLD 10 /* number of beacons */ -#define NO_BEACON_DEFAULT_TIMEOUT (500) /* in microseconds */ - -struct acx_conn_monit_params { - struct acx_header header; - - u32 synch_fail_thold; /* number of beacons missed */ - u32 bss_lose_timeout; /* number of TU's from synch fail */ -} __packed; - -enum { - SG_ENABLE = 0, - SG_DISABLE, - SG_SENSE_NO_ACTIVITY, - SG_SENSE_ACTIVE -}; - -struct acx_bt_wlan_coex { - struct acx_header header; - - /* - * 0 -> PTA enabled - * 1 -> PTA disabled - * 2 -> sense no active mode, i.e. - * an interrupt is sent upon - * BT activity. - * 3 -> PTA is switched on in response - * to the interrupt sending. - */ - u8 enable; - u8 pad[3]; -} __packed; - -#define PTA_ANTENNA_TYPE_DEF (0) -#define PTA_BT_HP_MAXTIME_DEF (2000) -#define PTA_WLAN_HP_MAX_TIME_DEF (5000) -#define PTA_SENSE_DISABLE_TIMER_DEF (1350) -#define PTA_PROTECTIVE_RX_TIME_DEF (1500) -#define PTA_PROTECTIVE_TX_TIME_DEF (1500) -#define PTA_TIMEOUT_NEXT_BT_LP_PACKET_DEF (3000) -#define PTA_SIGNALING_TYPE_DEF (1) -#define PTA_AFH_LEVERAGE_ON_DEF (0) -#define PTA_NUMBER_QUIET_CYCLE_DEF (0) -#define PTA_MAX_NUM_CTS_DEF (3) -#define PTA_NUMBER_OF_WLAN_PACKETS_DEF (2) -#define PTA_NUMBER_OF_BT_PACKETS_DEF (2) -#define PTA_PROTECTIVE_RX_TIME_FAST_DEF (1500) -#define PTA_PROTECTIVE_TX_TIME_FAST_DEF (3000) -#define PTA_CYCLE_TIME_FAST_DEF (8700) -#define PTA_RX_FOR_AVALANCHE_DEF (5) -#define PTA_ELP_HP_DEF (0) -#define PTA_ANTI_STARVE_PERIOD_DEF (500) -#define PTA_ANTI_STARVE_NUM_CYCLE_DEF (4) -#define PTA_ALLOW_PA_SD_DEF (1) -#define PTA_TIME_BEFORE_BEACON_DEF (6300) -#define PTA_HPDM_MAX_TIME_DEF (1600) -#define PTA_TIME_OUT_NEXT_WLAN_DEF (2550) -#define PTA_AUTO_MODE_NO_CTS_DEF (0) -#define PTA_BT_HP_RESPECTED_DEF (3) -#define PTA_WLAN_RX_MIN_RATE_DEF (24) -#define PTA_ACK_MODE_DEF (1) - -struct acx_bt_wlan_coex_param { - struct acx_header header; - - /* - * The minimum rate of a received WLAN packet in the STA, - * during protective mode, of which a new BT-HP request - * during this Rx will always be respected and gain the antenna. - */ - u32 min_rate; - - /* Max time the BT HP will be respected. */ - u16 bt_hp_max_time; - - /* Max time the WLAN HP will be respected. */ - u16 wlan_hp_max_time; - - /* - * The time between the last BT activity - * and the moment when the sense mode returns - * to SENSE_INACTIVE. - */ - u16 sense_disable_timer; - - /* Time before the next BT HP instance */ - u16 rx_time_bt_hp; - u16 tx_time_bt_hp; - - /* range: 10-20000 default: 1500 */ - u16 rx_time_bt_hp_fast; - u16 tx_time_bt_hp_fast; - - /* range: 2000-65535 default: 8700 */ - u16 wlan_cycle_fast; - - /* range: 0 - 15000 (Msec) default: 1000 */ - u16 bt_anti_starvation_period; - - /* range 400-10000(Usec) default: 3000 */ - u16 next_bt_lp_packet; - - /* Deafult: worst case for BT DH5 traffic */ - u16 wake_up_beacon; - - /* range: 0-50000(Usec) default: 1050 */ - u16 hp_dm_max_guard_time; - - /* - * This is to prevent both BT & WLAN antenna - * starvation. - * Range: 100-50000(Usec) default:2550 - */ - u16 next_wlan_packet; - - /* 0 -> shared antenna */ - u8 antenna_type; - - /* - * 0 -> TI legacy - * 1 -> Palau - */ - u8 signal_type; - - /* - * BT AFH status - * 0 -> no AFH - * 1 -> from dedicated GPIO - * 2 -> AFH on (from host) - */ - u8 afh_leverage_on; - - /* - * The number of cycles during which no - * TX will be sent after 1 cycle of RX - * transaction in protective mode - */ - u8 quiet_cycle_num; - - /* - * The maximum number of CTSs that will - * be sent for receiving RX packet in - * protective mode - */ - u8 max_cts; - - /* - * The number of WLAN packets - * transferred in common mode before - * switching to BT. - */ - u8 wlan_packets_num; - - /* - * The number of BT packets - * transferred in common mode before - * switching to WLAN. - */ - u8 bt_packets_num; - - /* range: 1-255 default: 5 */ - u8 missed_rx_avalanche; - - /* range: 0-1 default: 1 */ - u8 wlan_elp_hp; - - /* range: 0 - 15 default: 4 */ - u8 bt_anti_starvation_cycles; - - u8 ack_mode_dual_ant; - - /* - * Allow PA_SD assertion/de-assertion - * during enabled BT activity. - */ - u8 pa_sd_enable; - - /* - * Enable/Disable PTA in auto mode: - * Support Both Active & P.S modes - */ - u8 pta_auto_mode_enable; - - /* range: 0 - 20 default: 1 */ - u8 bt_hp_respected_num; -} __packed; - -#define CCA_THRSH_ENABLE_ENERGY_D 0x140A -#define CCA_THRSH_DISABLE_ENERGY_D 0xFFEF - -struct acx_energy_detection { - struct acx_header header; - - /* The RX Clear Channel Assessment threshold in the PHY */ - u16 rx_cca_threshold; - u8 tx_energy_detection; - u8 pad; -} __packed; - -#define BCN_RX_TIMEOUT_DEF_VALUE 10000 -#define BROADCAST_RX_TIMEOUT_DEF_VALUE 20000 -#define RX_BROADCAST_IN_PS_DEF_VALUE 1 -#define CONSECUTIVE_PS_POLL_FAILURE_DEF 4 - -struct acx_beacon_broadcast { - struct acx_header header; - - u16 beacon_rx_timeout; - u16 broadcast_timeout; - - /* Enables receiving of broadcast packets in PS mode */ - u8 rx_broadcast_in_ps; - - /* Consecutive PS Poll failures before updating the host */ - u8 ps_poll_threshold; - u8 pad[2]; -} __packed; - -struct acx_event_mask { - struct acx_header header; - - u32 event_mask; - u32 high_event_mask; /* Unused */ -} __packed; - -#define CFG_RX_FCS BIT(2) -#define CFG_RX_ALL_GOOD BIT(3) -#define CFG_UNI_FILTER_EN BIT(4) -#define CFG_BSSID_FILTER_EN BIT(5) -#define CFG_MC_FILTER_EN BIT(6) -#define CFG_MC_ADDR0_EN BIT(7) -#define CFG_MC_ADDR1_EN BIT(8) -#define CFG_BC_REJECT_EN BIT(9) -#define CFG_SSID_FILTER_EN BIT(10) -#define CFG_RX_INT_FCS_ERROR BIT(11) -#define CFG_RX_INT_ENCRYPTED BIT(12) -#define CFG_RX_WR_RX_STATUS BIT(13) -#define CFG_RX_FILTER_NULTI BIT(14) -#define CFG_RX_RESERVE BIT(15) -#define CFG_RX_TIMESTAMP_TSF BIT(16) - -#define CFG_RX_RSV_EN BIT(0) -#define CFG_RX_RCTS_ACK BIT(1) -#define CFG_RX_PRSP_EN BIT(2) -#define CFG_RX_PREQ_EN BIT(3) -#define CFG_RX_MGMT_EN BIT(4) -#define CFG_RX_FCS_ERROR BIT(5) -#define CFG_RX_DATA_EN BIT(6) -#define CFG_RX_CTL_EN BIT(7) -#define CFG_RX_CF_EN BIT(8) -#define CFG_RX_BCN_EN BIT(9) -#define CFG_RX_AUTH_EN BIT(10) -#define CFG_RX_ASSOC_EN BIT(11) - -#define SCAN_PASSIVE BIT(0) -#define SCAN_5GHZ_BAND BIT(1) -#define SCAN_TRIGGERED BIT(2) -#define SCAN_PRIORITY_HIGH BIT(3) - -struct acx_fw_gen_frame_rates { - struct acx_header header; - - u8 tx_ctrl_frame_rate; /* RATE_* */ - u8 tx_ctrl_frame_mod; /* CCK_* or PBCC_* */ - u8 tx_mgt_frame_rate; - u8 tx_mgt_frame_mod; -} __packed; - -/* STA MAC */ -struct acx_dot11_station_id { - struct acx_header header; - - u8 mac[ETH_ALEN]; - u8 pad[2]; -} __packed; - -struct acx_feature_config { - struct acx_header header; - - u32 options; - u32 data_flow_options; -} __packed; - -struct acx_current_tx_power { - struct acx_header header; - - u8 current_tx_power; - u8 padding[3]; -} __packed; - -struct acx_dot11_default_key { - struct acx_header header; - - u8 id; - u8 pad[3]; -} __packed; - -struct acx_tsf_info { - struct acx_header header; - - u32 current_tsf_msb; - u32 current_tsf_lsb; - u32 last_TBTT_msb; - u32 last_TBTT_lsb; - u8 last_dtim_count; - u8 pad[3]; -} __packed; - -enum acx_wake_up_event { - WAKE_UP_EVENT_BEACON_BITMAP = 0x01, /* Wake on every Beacon*/ - WAKE_UP_EVENT_DTIM_BITMAP = 0x02, /* Wake on every DTIM*/ - WAKE_UP_EVENT_N_DTIM_BITMAP = 0x04, /* Wake on every Nth DTIM */ - WAKE_UP_EVENT_N_BEACONS_BITMAP = 0x08, /* Wake on every Nth Beacon */ - WAKE_UP_EVENT_BITS_MASK = 0x0F -}; - -struct acx_wake_up_condition { - struct acx_header header; - - u8 wake_up_event; /* Only one bit can be set */ - u8 listen_interval; - u8 pad[2]; -} __packed; - -struct acx_aid { - struct acx_header header; - - /* - * To be set when associated with an AP. - */ - u16 aid; - u8 pad[2]; -} __packed; - -enum acx_preamble_type { - ACX_PREAMBLE_LONG = 0, - ACX_PREAMBLE_SHORT = 1 -}; - -struct acx_preamble { - struct acx_header header; - - /* - * When set, the WiLink transmits the frames with a short preamble and - * when cleared, the WiLink transmits the frames with a long preamble. - */ - u8 preamble; - u8 padding[3]; -} __packed; - -enum acx_ctsprotect_type { - CTSPROTECT_DISABLE = 0, - CTSPROTECT_ENABLE = 1 -}; - -struct acx_ctsprotect { - struct acx_header header; - u8 ctsprotect; - u8 padding[3]; -} __packed; - -struct acx_tx_statistics { - u32 internal_desc_overflow; -} __packed; - -struct acx_rx_statistics { - u32 out_of_mem; - u32 hdr_overflow; - u32 hw_stuck; - u32 dropped; - u32 fcs_err; - u32 xfr_hint_trig; - u32 path_reset; - u32 reset_counter; -} __packed; - -struct acx_dma_statistics { - u32 rx_requested; - u32 rx_errors; - u32 tx_requested; - u32 tx_errors; -} __packed; - -struct acx_isr_statistics { - /* host command complete */ - u32 cmd_cmplt; - - /* fiqisr() */ - u32 fiqs; - - /* (INT_STS_ND & INT_TRIG_RX_HEADER) */ - u32 rx_headers; - - /* (INT_STS_ND & INT_TRIG_RX_CMPLT) */ - u32 rx_completes; - - /* (INT_STS_ND & INT_TRIG_NO_RX_BUF) */ - u32 rx_mem_overflow; - - /* (INT_STS_ND & INT_TRIG_S_RX_RDY) */ - u32 rx_rdys; - - /* irqisr() */ - u32 irqs; - - /* (INT_STS_ND & INT_TRIG_TX_PROC) */ - u32 tx_procs; - - /* (INT_STS_ND & INT_TRIG_DECRYPT_DONE) */ - u32 decrypt_done; - - /* (INT_STS_ND & INT_TRIG_DMA0) */ - u32 dma0_done; - - /* (INT_STS_ND & INT_TRIG_DMA1) */ - u32 dma1_done; - - /* (INT_STS_ND & INT_TRIG_TX_EXC_CMPLT) */ - u32 tx_exch_complete; - - /* (INT_STS_ND & INT_TRIG_COMMAND) */ - u32 commands; - - /* (INT_STS_ND & INT_TRIG_RX_PROC) */ - u32 rx_procs; - - /* (INT_STS_ND & INT_TRIG_PM_802) */ - u32 hw_pm_mode_changes; - - /* (INT_STS_ND & INT_TRIG_ACKNOWLEDGE) */ - u32 host_acknowledges; - - /* (INT_STS_ND & INT_TRIG_PM_PCI) */ - u32 pci_pm; - - /* (INT_STS_ND & INT_TRIG_ACM_WAKEUP) */ - u32 wakeups; - - /* (INT_STS_ND & INT_TRIG_LOW_RSSI) */ - u32 low_rssi; -} __packed; - -struct acx_wep_statistics { - /* WEP address keys configured */ - u32 addr_key_count; - - /* default keys configured */ - u32 default_key_count; - - u32 reserved; - - /* number of times that WEP key not found on lookup */ - u32 key_not_found; - - /* number of times that WEP key decryption failed */ - u32 decrypt_fail; - - /* WEP packets decrypted */ - u32 packets; - - /* WEP decrypt interrupts */ - u32 interrupt; -} __packed; - -#define ACX_MISSED_BEACONS_SPREAD 10 - -struct acx_pwr_statistics { - /* the amount of enters into power save mode (both PD & ELP) */ - u32 ps_enter; - - /* the amount of enters into ELP mode */ - u32 elp_enter; - - /* the amount of missing beacon interrupts to the host */ - u32 missing_bcns; - - /* the amount of wake on host-access times */ - u32 wake_on_host; - - /* the amount of wake on timer-expire */ - u32 wake_on_timer_exp; - - /* the number of packets that were transmitted with PS bit set */ - u32 tx_with_ps; - - /* the number of packets that were transmitted with PS bit clear */ - u32 tx_without_ps; - - /* the number of received beacons */ - u32 rcvd_beacons; - - /* the number of entering into PowerOn (power save off) */ - u32 power_save_off; - - /* the number of entries into power save mode */ - u16 enable_ps; - - /* - * the number of exits from power save, not including failed PS - * transitions - */ - u16 disable_ps; - - /* - * the number of times the TSF counter was adjusted because - * of drift - */ - u32 fix_tsf_ps; - - /* Gives statistics about the spread continuous missed beacons. - * The 16 LSB are dedicated for the PS mode. - * The 16 MSB are dedicated for the PS mode. - * cont_miss_bcns_spread[0] - single missed beacon. - * cont_miss_bcns_spread[1] - two continuous missed beacons. - * cont_miss_bcns_spread[2] - three continuous missed beacons. - * ... - * cont_miss_bcns_spread[9] - ten and more continuous missed beacons. - */ - u32 cont_miss_bcns_spread[ACX_MISSED_BEACONS_SPREAD]; - - /* the number of beacons in awake mode */ - u32 rcvd_awake_beacons; -} __packed; - -struct acx_mic_statistics { - u32 rx_pkts; - u32 calc_failure; -} __packed; - -struct acx_aes_statistics { - u32 encrypt_fail; - u32 decrypt_fail; - u32 encrypt_packets; - u32 decrypt_packets; - u32 encrypt_interrupt; - u32 decrypt_interrupt; -} __packed; - -struct acx_event_statistics { - u32 heart_beat; - u32 calibration; - u32 rx_mismatch; - u32 rx_mem_empty; - u32 rx_pool; - u32 oom_late; - u32 phy_transmit_error; - u32 tx_stuck; -} __packed; - -struct acx_ps_statistics { - u32 pspoll_timeouts; - u32 upsd_timeouts; - u32 upsd_max_sptime; - u32 upsd_max_apturn; - u32 pspoll_max_apturn; - u32 pspoll_utilization; - u32 upsd_utilization; -} __packed; - -struct acx_rxpipe_statistics { - u32 rx_prep_beacon_drop; - u32 descr_host_int_trig_rx_data; - u32 beacon_buffer_thres_host_int_trig_rx_data; - u32 missed_beacon_host_int_trig_rx_data; - u32 tx_xfr_host_int_trig_rx_data; -} __packed; - -struct acx_statistics { - struct acx_header header; - - struct acx_tx_statistics tx; - struct acx_rx_statistics rx; - struct acx_dma_statistics dma; - struct acx_isr_statistics isr; - struct acx_wep_statistics wep; - struct acx_pwr_statistics pwr; - struct acx_aes_statistics aes; - struct acx_mic_statistics mic; - struct acx_event_statistics event; - struct acx_ps_statistics ps; - struct acx_rxpipe_statistics rxpipe; -} __packed; - -#define ACX_MAX_RATE_CLASSES 8 -#define ACX_RATE_MASK_UNSPECIFIED 0 -#define ACX_RATE_RETRY_LIMIT 10 - -struct acx_rate_class { - u32 enabled_rates; - u8 short_retry_limit; - u8 long_retry_limit; - u8 aflags; - u8 reserved; -} __packed; - -struct acx_rate_policy { - struct acx_header header; - - u32 rate_class_cnt; - struct acx_rate_class rate_class[ACX_MAX_RATE_CLASSES]; -} __packed; - -struct wl1251_acx_memory { - __le16 num_stations; /* number of STAs to be supported. */ - u16 reserved_1; - - /* - * Nmber of memory buffers for the RX mem pool. - * The actual number may be less if there are - * not enough blocks left for the minimum num - * of TX ones. - */ - u8 rx_mem_block_num; - u8 reserved_2; - u8 num_tx_queues; /* From 1 to 16 */ - u8 host_if_options; /* HOST_IF* */ - u8 tx_min_mem_block_num; - u8 num_ssid_profiles; - __le16 debug_buffer_size; -} __packed; - - -#define ACX_RX_DESC_MIN 1 -#define ACX_RX_DESC_MAX 127 -#define ACX_RX_DESC_DEF 32 -struct wl1251_acx_rx_queue_config { - u8 num_descs; - u8 pad; - u8 type; - u8 priority; - __le32 dma_address; -} __packed; - -#define ACX_TX_DESC_MIN 1 -#define ACX_TX_DESC_MAX 127 -#define ACX_TX_DESC_DEF 16 -struct wl1251_acx_tx_queue_config { - u8 num_descs; - u8 pad[2]; - u8 attributes; -} __packed; - -#define MAX_TX_QUEUE_CONFIGS 5 -#define MAX_TX_QUEUES 4 -struct wl1251_acx_config_memory { - struct acx_header header; - - struct wl1251_acx_memory mem_config; - struct wl1251_acx_rx_queue_config rx_queue_config; - struct wl1251_acx_tx_queue_config tx_queue_config[MAX_TX_QUEUE_CONFIGS]; -} __packed; - -struct wl1251_acx_mem_map { - struct acx_header header; - - void *code_start; - void *code_end; - - void *wep_defkey_start; - void *wep_defkey_end; - - void *sta_table_start; - void *sta_table_end; - - void *packet_template_start; - void *packet_template_end; - - void *queue_memory_start; - void *queue_memory_end; - - void *packet_memory_pool_start; - void *packet_memory_pool_end; - - void *debug_buffer1_start; - void *debug_buffer1_end; - - void *debug_buffer2_start; - void *debug_buffer2_end; - - /* Number of blocks FW allocated for TX packets */ - u32 num_tx_mem_blocks; - - /* Number of blocks FW allocated for RX packets */ - u32 num_rx_mem_blocks; -} __packed; - - -struct wl1251_acx_wr_tbtt_and_dtim { - - struct acx_header header; - - /* Time in TUs between two consecutive beacons */ - u16 tbtt; - - /* - * DTIM period - * For BSS: Number of TBTTs in a DTIM period (range: 1-10) - * For IBSS: value shall be set to 1 - */ - u8 dtim; - u8 padding; -} __packed; - -enum wl1251_acx_bet_mode { - WL1251_ACX_BET_DISABLE = 0, - WL1251_ACX_BET_ENABLE = 1, -}; - -struct wl1251_acx_bet_enable { - struct acx_header header; - - /* - * Specifies if beacon early termination procedure is enabled or - * disabled, see enum wl1251_acx_bet_mode. - */ - u8 enable; - - /* - * Specifies the maximum number of consecutive beacons that may be - * early terminated. After this number is reached at least one full - * beacon must be correctly received in FW before beacon ET - * resumes. Range 0 - 255. - */ - u8 max_consecutive; - - u8 padding[2]; -} __packed; - -struct wl1251_acx_ac_cfg { - struct acx_header header; - - /* - * Access Category - The TX queue's access category - * (refer to AccessCategory_enum) - */ - u8 ac; - - /* - * The contention window minimum size (in slots) for - * the access class. - */ - u8 cw_min; - - /* - * The contention window maximum size (in slots) for - * the access class. - */ - u16 cw_max; - - /* The AIF value (in slots) for the access class. */ - u8 aifsn; - - u8 reserved; - - /* The TX Op Limit (in microseconds) for the access class. */ - u16 txop_limit; -} __packed; - - -enum wl1251_acx_channel_type { - CHANNEL_TYPE_DCF = 0, - CHANNEL_TYPE_EDCF = 1, - CHANNEL_TYPE_HCCA = 2, -}; - -enum wl1251_acx_ps_scheme { - /* regular ps: simple sending of packets */ - WL1251_ACX_PS_SCHEME_LEGACY = 0, - - /* sending a packet triggers a unscheduled apsd downstream */ - WL1251_ACX_PS_SCHEME_UPSD_TRIGGER = 1, - - /* a pspoll packet will be sent before every data packet */ - WL1251_ACX_PS_SCHEME_LEGACY_PSPOLL = 2, - - /* scheduled apsd mode */ - WL1251_ACX_PS_SCHEME_SAPSD = 3, -}; - -enum wl1251_acx_ack_policy { - WL1251_ACX_ACK_POLICY_LEGACY = 0, - WL1251_ACX_ACK_POLICY_NO_ACK = 1, - WL1251_ACX_ACK_POLICY_BLOCK = 2, -}; - -struct wl1251_acx_tid_cfg { - struct acx_header header; - - /* tx queue id number (0-7) */ - u8 queue; - - /* channel access type for the queue, enum wl1251_acx_channel_type */ - u8 type; - - /* EDCA: ac index (0-3), HCCA: traffic stream id (8-15) */ - u8 tsid; - - /* ps scheme of the specified queue, enum wl1251_acx_ps_scheme */ - u8 ps_scheme; - - /* the tx queue ack policy, enum wl1251_acx_ack_policy */ - u8 ack_policy; - - u8 padding[3]; - - /* not supported */ - u32 apsdconf[2]; -} __packed; - -/************************************************************************* - - Host Interrupt Register (WiLink -> Host) - -**************************************************************************/ - -/* RX packet is ready in Xfer buffer #0 */ -#define WL1251_ACX_INTR_RX0_DATA BIT(0) - -/* TX result(s) are in the TX complete buffer */ -#define WL1251_ACX_INTR_TX_RESULT BIT(1) - -/* OBSOLETE */ -#define WL1251_ACX_INTR_TX_XFR BIT(2) - -/* RX packet is ready in Xfer buffer #1 */ -#define WL1251_ACX_INTR_RX1_DATA BIT(3) - -/* Event was entered to Event MBOX #A */ -#define WL1251_ACX_INTR_EVENT_A BIT(4) - -/* Event was entered to Event MBOX #B */ -#define WL1251_ACX_INTR_EVENT_B BIT(5) - -/* OBSOLETE */ -#define WL1251_ACX_INTR_WAKE_ON_HOST BIT(6) - -/* Trace message on MBOX #A */ -#define WL1251_ACX_INTR_TRACE_A BIT(7) - -/* Trace message on MBOX #B */ -#define WL1251_ACX_INTR_TRACE_B BIT(8) - -/* Command processing completion */ -#define WL1251_ACX_INTR_CMD_COMPLETE BIT(9) - -/* Init sequence is done */ -#define WL1251_ACX_INTR_INIT_COMPLETE BIT(14) - -#define WL1251_ACX_INTR_ALL 0xFFFFFFFF - -enum { - ACX_WAKE_UP_CONDITIONS = 0x0002, - ACX_MEM_CFG = 0x0003, - ACX_SLOT = 0x0004, - ACX_QUEUE_HEAD = 0x0005, /* for MASTER mode only */ - ACX_AC_CFG = 0x0007, - ACX_MEM_MAP = 0x0008, - ACX_AID = 0x000A, - ACX_RADIO_PARAM = 0x000B, /* Not used */ - ACX_CFG = 0x000C, /* Not used */ - ACX_FW_REV = 0x000D, - ACX_MEDIUM_USAGE = 0x000F, - ACX_RX_CFG = 0x0010, - ACX_TX_QUEUE_CFG = 0x0011, /* FIXME: only used by wl1251 */ - ACX_BSS_IN_PS = 0x0012, /* for AP only */ - ACX_STATISTICS = 0x0013, /* Debug API */ - ACX_FEATURE_CFG = 0x0015, - ACX_MISC_CFG = 0x0017, /* Not used */ - ACX_TID_CFG = 0x001A, - ACX_BEACON_FILTER_OPT = 0x001F, - ACX_LOW_RSSI = 0x0020, - ACX_NOISE_HIST = 0x0021, - ACX_HDK_VERSION = 0x0022, /* ??? */ - ACX_PD_THRESHOLD = 0x0023, - ACX_DATA_PATH_PARAMS = 0x0024, /* WO */ - ACX_DATA_PATH_RESP_PARAMS = 0x0024, /* RO */ - ACX_CCA_THRESHOLD = 0x0025, - ACX_EVENT_MBOX_MASK = 0x0026, -#ifdef FW_RUNNING_AS_AP - ACX_DTIM_PERIOD = 0x0027, /* for AP only */ -#else - ACX_WR_TBTT_AND_DTIM = 0x0027, /* STA only */ -#endif - ACX_ACI_OPTION_CFG = 0x0029, /* OBSOLETE (for 1251)*/ - ACX_GPIO_CFG = 0x002A, /* Not used */ - ACX_GPIO_SET = 0x002B, /* Not used */ - ACX_PM_CFG = 0x002C, /* To Be Documented */ - ACX_CONN_MONIT_PARAMS = 0x002D, - ACX_AVERAGE_RSSI = 0x002E, /* Not used */ - ACX_CONS_TX_FAILURE = 0x002F, - ACX_BCN_DTIM_OPTIONS = 0x0031, - ACX_SG_ENABLE = 0x0032, - ACX_SG_CFG = 0x0033, - ACX_ANTENNA_DIVERSITY_CFG = 0x0035, /* To Be Documented */ - ACX_LOW_SNR = 0x0037, /* To Be Documented */ - ACX_BEACON_FILTER_TABLE = 0x0038, - ACX_ARP_IP_FILTER = 0x0039, - ACX_ROAMING_STATISTICS_TBL = 0x003B, - ACX_RATE_POLICY = 0x003D, - ACX_CTS_PROTECTION = 0x003E, - ACX_SLEEP_AUTH = 0x003F, - ACX_PREAMBLE_TYPE = 0x0040, - ACX_ERROR_CNT = 0x0041, - ACX_FW_GEN_FRAME_RATES = 0x0042, - ACX_IBSS_FILTER = 0x0044, - ACX_SERVICE_PERIOD_TIMEOUT = 0x0045, - ACX_TSF_INFO = 0x0046, - ACX_CONFIG_PS_WMM = 0x0049, - ACX_ENABLE_RX_DATA_FILTER = 0x004A, - ACX_SET_RX_DATA_FILTER = 0x004B, - ACX_GET_DATA_FILTER_STATISTICS = 0x004C, - ACX_POWER_LEVEL_TABLE = 0x004D, - ACX_BET_ENABLE = 0x0050, - DOT11_STATION_ID = 0x1001, - DOT11_RX_MSDU_LIFE_TIME = 0x1004, - DOT11_CUR_TX_PWR = 0x100D, - DOT11_DEFAULT_KEY = 0x1010, - DOT11_RX_DOT11_MODE = 0x1012, - DOT11_RTS_THRESHOLD = 0x1013, - DOT11_GROUP_ADDRESS_TBL = 0x1014, - - MAX_DOT11_IE = DOT11_GROUP_ADDRESS_TBL, - - MAX_IE = 0xFFFF -}; - - -int wl1251_acx_frame_rates(struct wl1251 *wl, u8 ctrl_rate, u8 ctrl_mod, - u8 mgt_rate, u8 mgt_mod); -int wl1251_acx_station_id(struct wl1251 *wl); -int wl1251_acx_default_key(struct wl1251 *wl, u8 key_id); -int wl1251_acx_wake_up_conditions(struct wl1251 *wl, u8 wake_up_event, - u8 listen_interval); -int wl1251_acx_sleep_auth(struct wl1251 *wl, u8 sleep_auth); -int wl1251_acx_fw_version(struct wl1251 *wl, char *buf, size_t len); -int wl1251_acx_tx_power(struct wl1251 *wl, int power); -int wl1251_acx_feature_cfg(struct wl1251 *wl); -int wl1251_acx_mem_map(struct wl1251 *wl, - struct acx_header *mem_map, size_t len); -int wl1251_acx_data_path_params(struct wl1251 *wl, - struct acx_data_path_params_resp *data_path); -int wl1251_acx_rx_msdu_life_time(struct wl1251 *wl, u32 life_time); -int wl1251_acx_rx_config(struct wl1251 *wl, u32 config, u32 filter); -int wl1251_acx_pd_threshold(struct wl1251 *wl); -int wl1251_acx_slot(struct wl1251 *wl, enum acx_slot_type slot_time); -int wl1251_acx_group_address_tbl(struct wl1251 *wl); -int wl1251_acx_service_period_timeout(struct wl1251 *wl); -int wl1251_acx_rts_threshold(struct wl1251 *wl, u16 rts_threshold); -int wl1251_acx_beacon_filter_opt(struct wl1251 *wl, bool enable_filter); -int wl1251_acx_beacon_filter_table(struct wl1251 *wl); -int wl1251_acx_conn_monit_params(struct wl1251 *wl); -int wl1251_acx_sg_enable(struct wl1251 *wl); -int wl1251_acx_sg_cfg(struct wl1251 *wl); -int wl1251_acx_cca_threshold(struct wl1251 *wl); -int wl1251_acx_bcn_dtim_options(struct wl1251 *wl); -int wl1251_acx_aid(struct wl1251 *wl, u16 aid); -int wl1251_acx_event_mbox_mask(struct wl1251 *wl, u32 event_mask); -int wl1251_acx_low_rssi(struct wl1251 *wl, s8 threshold, u8 weight, - u8 depth, enum wl1251_acx_low_rssi_type type); -int wl1251_acx_set_preamble(struct wl1251 *wl, enum acx_preamble_type preamble); -int wl1251_acx_cts_protect(struct wl1251 *wl, - enum acx_ctsprotect_type ctsprotect); -int wl1251_acx_statistics(struct wl1251 *wl, struct acx_statistics *stats); -int wl1251_acx_tsf_info(struct wl1251 *wl, u64 *mactime); -int wl1251_acx_rate_policies(struct wl1251 *wl); -int wl1251_acx_mem_cfg(struct wl1251 *wl); -int wl1251_acx_wr_tbtt_and_dtim(struct wl1251 *wl, u16 tbtt, u8 dtim); -int wl1251_acx_bet_enable(struct wl1251 *wl, enum wl1251_acx_bet_mode mode, - u8 max_consecutive); -int wl1251_acx_ac_cfg(struct wl1251 *wl, u8 ac, u8 cw_min, u16 cw_max, - u8 aifs, u16 txop); -int wl1251_acx_tid_cfg(struct wl1251 *wl, u8 queue, - enum wl1251_acx_channel_type type, - u8 tsid, enum wl1251_acx_ps_scheme ps_scheme, - enum wl1251_acx_ack_policy ack_policy); - -#endif /* __WL1251_ACX_H__ */ diff --git a/drivers/net/wireless/ti/wl1251/boot.c b/drivers/net/wireless/ti/wl1251/boot.c deleted file mode 100644 index a2e5241382da..000000000000 --- a/drivers/net/wireless/ti/wl1251/boot.c +++ /dev/null @@ -1,554 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include - -#include "reg.h" -#include "boot.h" -#include "io.h" -#include "spi.h" -#include "event.h" -#include "acx.h" - -void wl1251_boot_target_enable_interrupts(struct wl1251 *wl) -{ - wl1251_reg_write32(wl, ACX_REG_INTERRUPT_MASK, ~(wl->intr_mask)); - wl1251_reg_write32(wl, HI_CFG, HI_CFG_DEF_VAL); -} - -int wl1251_boot_soft_reset(struct wl1251 *wl) -{ - unsigned long timeout; - u32 boot_data; - - /* perform soft reset */ - wl1251_reg_write32(wl, ACX_REG_SLV_SOFT_RESET, ACX_SLV_SOFT_RESET_BIT); - - /* SOFT_RESET is self clearing */ - timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME); - while (1) { - boot_data = wl1251_reg_read32(wl, ACX_REG_SLV_SOFT_RESET); - wl1251_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data); - if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0) - break; - - if (time_after(jiffies, timeout)) { - /* 1.2 check pWhalBus->uSelfClearTime if the - * timeout was reached */ - wl1251_error("soft reset timeout"); - return -1; - } - - udelay(SOFT_RESET_STALL_TIME); - } - - /* disable Rx/Tx */ - wl1251_reg_write32(wl, ENABLE, 0x0); - - /* disable auto calibration on start*/ - wl1251_reg_write32(wl, SPARE_A2, 0xffff); - - return 0; -} - -int wl1251_boot_init_seq(struct wl1251 *wl) -{ - u32 scr_pad6, init_data, tmp, elp_cmd, ref_freq; - - /* - * col #1: INTEGER_DIVIDER - * col #2: FRACTIONAL_DIVIDER - * col #3: ATTN_BB - * col #4: ALPHA_BB - * col #5: STOP_TIME_BB - * col #6: BB_PLL_LOOP_FILTER - */ - static const u32 LUT[REF_FREQ_NUM][LUT_PARAM_NUM] = { - - { 83, 87381, 0xB, 5, 0xF00, 3}, /* REF_FREQ_19_2*/ - { 61, 141154, 0xB, 5, 0x1450, 2}, /* REF_FREQ_26_0*/ - { 41, 174763, 0xC, 6, 0x2D00, 1}, /* REF_FREQ_38_4*/ - { 40, 0, 0xC, 6, 0x2EE0, 1}, /* REF_FREQ_40_0*/ - { 47, 162280, 0xC, 6, 0x2760, 1} /* REF_FREQ_33_6 */ - }; - - /* read NVS params */ - scr_pad6 = wl1251_reg_read32(wl, SCR_PAD6); - wl1251_debug(DEBUG_BOOT, "scr_pad6 0x%x", scr_pad6); - - /* read ELP_CMD */ - elp_cmd = wl1251_reg_read32(wl, ELP_CMD); - wl1251_debug(DEBUG_BOOT, "elp_cmd 0x%x", elp_cmd); - - /* set the BB calibration time to be 300 usec (PLL_CAL_TIME) */ - ref_freq = scr_pad6 & 0x000000FF; - wl1251_debug(DEBUG_BOOT, "ref_freq 0x%x", ref_freq); - - wl1251_reg_write32(wl, PLL_CAL_TIME, 0x9); - - /* - * PG 1.2: set the clock buffer time to be 210 usec (CLK_BUF_TIME) - */ - wl1251_reg_write32(wl, CLK_BUF_TIME, 0x6); - - /* - * set the clock detect feature to work in the restart wu procedure - * (ELP_CFG_MODE[14]) and Select the clock source type - * (ELP_CFG_MODE[13:12]) - */ - tmp = ((scr_pad6 & 0x0000FF00) << 4) | 0x00004000; - wl1251_reg_write32(wl, ELP_CFG_MODE, tmp); - - /* PG 1.2: enable the BB PLL fix. Enable the PLL_LIMP_CLK_EN_CMD */ - elp_cmd |= 0x00000040; - wl1251_reg_write32(wl, ELP_CMD, elp_cmd); - - /* PG 1.2: Set the BB PLL stable time to be 1000usec - * (PLL_STABLE_TIME) */ - wl1251_reg_write32(wl, CFG_PLL_SYNC_CNT, 0x20); - - /* PG 1.2: read clock request time */ - init_data = wl1251_reg_read32(wl, CLK_REQ_TIME); - - /* - * PG 1.2: set the clock request time to be ref_clk_settling_time - - * 1ms = 4ms - */ - if (init_data > 0x21) - tmp = init_data - 0x21; - else - tmp = 0; - wl1251_reg_write32(wl, CLK_REQ_TIME, tmp); - - /* set BB PLL configurations in RF AFE */ - wl1251_reg_write32(wl, 0x003058cc, 0x4B5); - - /* set RF_AFE_REG_5 */ - wl1251_reg_write32(wl, 0x003058d4, 0x50); - - /* set RF_AFE_CTRL_REG_2 */ - wl1251_reg_write32(wl, 0x00305948, 0x11c001); - - /* - * change RF PLL and BB PLL divider for VCO clock and adjust VCO - * bais current(RF_AFE_REG_13) - */ - wl1251_reg_write32(wl, 0x003058f4, 0x1e); - - /* set BB PLL configurations */ - tmp = LUT[ref_freq][LUT_PARAM_INTEGER_DIVIDER] | 0x00017000; - wl1251_reg_write32(wl, 0x00305840, tmp); - - /* set fractional divider according to Appendix C-BB PLL - * Calculations - */ - tmp = LUT[ref_freq][LUT_PARAM_FRACTIONAL_DIVIDER]; - wl1251_reg_write32(wl, 0x00305844, tmp); - - /* set the initial data for the sigma delta */ - wl1251_reg_write32(wl, 0x00305848, 0x3039); - - /* - * set the accumulator attenuation value, calibration loop1 - * (alpha), calibration loop2 (beta), calibration loop3 (gamma) and - * the VCO gain - */ - tmp = (LUT[ref_freq][LUT_PARAM_ATTN_BB] << 16) | - (LUT[ref_freq][LUT_PARAM_ALPHA_BB] << 12) | 0x1; - wl1251_reg_write32(wl, 0x00305854, tmp); - - /* - * set the calibration stop time after holdoff time expires and set - * settling time HOLD_OFF_TIME_BB - */ - tmp = LUT[ref_freq][LUT_PARAM_STOP_TIME_BB] | 0x000A0000; - wl1251_reg_write32(wl, 0x00305858, tmp); - - /* - * set BB PLL Loop filter capacitor3- BB_C3[2:0] and set BB PLL - * constant leakage current to linearize PFD to 0uA - - * BB_ILOOPF[7:3] - */ - tmp = LUT[ref_freq][LUT_PARAM_BB_PLL_LOOP_FILTER] | 0x00000030; - wl1251_reg_write32(wl, 0x003058f8, tmp); - - /* - * set regulator output voltage for n divider to - * 1.35-BB_REFDIV[1:0], set charge pump current- BB_CPGAIN[4:2], - * set BB PLL Loop filter capacitor2- BB_C2[7:5], set gain of BB - * PLL auto-call to normal mode- BB_CALGAIN_3DB[8] - */ - wl1251_reg_write32(wl, 0x003058f0, 0x29); - - /* enable restart wakeup sequence (ELP_CMD[0]) */ - wl1251_reg_write32(wl, ELP_CMD, elp_cmd | 0x1); - - /* restart sequence completed */ - udelay(2000); - - return 0; -} - -static void wl1251_boot_set_ecpu_ctrl(struct wl1251 *wl, u32 flag) -{ - u32 cpu_ctrl; - - /* 10.5.0 run the firmware (I) */ - cpu_ctrl = wl1251_reg_read32(wl, ACX_REG_ECPU_CONTROL); - - /* 10.5.1 run the firmware (II) */ - cpu_ctrl &= ~flag; - wl1251_reg_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl); -} - -int wl1251_boot_run_firmware(struct wl1251 *wl) -{ - int loop, ret; - u32 chip_id, acx_intr; - - wl1251_boot_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT); - - chip_id = wl1251_reg_read32(wl, CHIP_ID_B); - - wl1251_debug(DEBUG_BOOT, "chip id after firmware boot: 0x%x", chip_id); - - if (chip_id != wl->chip_id) { - wl1251_error("chip id doesn't match after firmware boot"); - return -EIO; - } - - /* wait for init to complete */ - loop = 0; - while (loop++ < INIT_LOOP) { - udelay(INIT_LOOP_DELAY); - acx_intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); - - if (acx_intr == 0xffffffff) { - wl1251_error("error reading hardware complete " - "init indication"); - return -EIO; - } - /* check that ACX_INTR_INIT_COMPLETE is enabled */ - else if (acx_intr & WL1251_ACX_INTR_INIT_COMPLETE) { - wl1251_reg_write32(wl, ACX_REG_INTERRUPT_ACK, - WL1251_ACX_INTR_INIT_COMPLETE); - break; - } - } - - if (loop > INIT_LOOP) { - wl1251_error("timeout waiting for the hardware to " - "complete initialization"); - return -EIO; - } - - /* get hardware config command mail box */ - wl->cmd_box_addr = wl1251_reg_read32(wl, REG_COMMAND_MAILBOX_PTR); - - /* get hardware config event mail box */ - wl->event_box_addr = wl1251_reg_read32(wl, REG_EVENT_MAILBOX_PTR); - - /* set the working partition to its "running" mode offset */ - wl1251_set_partition(wl, WL1251_PART_WORK_MEM_START, - WL1251_PART_WORK_MEM_SIZE, - WL1251_PART_WORK_REG_START, - WL1251_PART_WORK_REG_SIZE); - - wl1251_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x event_box_addr 0x%x", - wl->cmd_box_addr, wl->event_box_addr); - - wl1251_acx_fw_version(wl, wl->fw_ver, sizeof(wl->fw_ver)); - - /* - * in case of full asynchronous mode the firmware event must be - * ready to receive event from the command mailbox - */ - - /* enable gpio interrupts */ - wl1251_enable_interrupts(wl); - - /* Enable target's interrupts */ - wl->intr_mask = WL1251_ACX_INTR_RX0_DATA | - WL1251_ACX_INTR_RX1_DATA | - WL1251_ACX_INTR_TX_RESULT | - WL1251_ACX_INTR_EVENT_A | - WL1251_ACX_INTR_EVENT_B | - WL1251_ACX_INTR_INIT_COMPLETE; - wl1251_boot_target_enable_interrupts(wl); - - wl->event_mask = SCAN_COMPLETE_EVENT_ID | BSS_LOSE_EVENT_ID | - SYNCHRONIZATION_TIMEOUT_EVENT_ID | - ROAMING_TRIGGER_LOW_RSSI_EVENT_ID | - ROAMING_TRIGGER_REGAINED_RSSI_EVENT_ID | - REGAINED_BSS_EVENT_ID | BT_PTA_SENSE_EVENT_ID | - BT_PTA_PREDICTION_EVENT_ID | JOIN_EVENT_COMPLETE_ID; - - ret = wl1251_event_unmask(wl); - if (ret < 0) { - wl1251_error("EVENT mask setting failed"); - return ret; - } - - wl1251_event_mbox_config(wl); - - /* firmware startup completed */ - return 0; -} - -static int wl1251_boot_upload_firmware(struct wl1251 *wl) -{ - int addr, chunk_num, partition_limit; - size_t fw_data_len, len; - u8 *p, *buf; - - /* whal_FwCtrl_LoadFwImageSm() */ - - wl1251_debug(DEBUG_BOOT, "chip id before fw upload: 0x%x", - wl1251_reg_read32(wl, CHIP_ID_B)); - - /* 10.0 check firmware length and set partition */ - fw_data_len = (wl->fw[4] << 24) | (wl->fw[5] << 16) | - (wl->fw[6] << 8) | (wl->fw[7]); - - wl1251_debug(DEBUG_BOOT, "fw_data_len %zu chunk_size %d", fw_data_len, - CHUNK_SIZE); - - if ((fw_data_len % 4) != 0) { - wl1251_error("firmware length not multiple of four"); - return -EIO; - } - - buf = kmalloc(CHUNK_SIZE, GFP_KERNEL); - if (!buf) { - wl1251_error("allocation for firmware upload chunk failed"); - return -ENOMEM; - } - - wl1251_set_partition(wl, WL1251_PART_DOWN_MEM_START, - WL1251_PART_DOWN_MEM_SIZE, - WL1251_PART_DOWN_REG_START, - WL1251_PART_DOWN_REG_SIZE); - - /* 10.1 set partition limit and chunk num */ - chunk_num = 0; - partition_limit = WL1251_PART_DOWN_MEM_SIZE; - - while (chunk_num < fw_data_len / CHUNK_SIZE) { - /* 10.2 update partition, if needed */ - addr = WL1251_PART_DOWN_MEM_START + - (chunk_num + 2) * CHUNK_SIZE; - if (addr > partition_limit) { - addr = WL1251_PART_DOWN_MEM_START + - chunk_num * CHUNK_SIZE; - partition_limit = chunk_num * CHUNK_SIZE + - WL1251_PART_DOWN_MEM_SIZE; - wl1251_set_partition(wl, - addr, - WL1251_PART_DOWN_MEM_SIZE, - WL1251_PART_DOWN_REG_START, - WL1251_PART_DOWN_REG_SIZE); - } - - /* 10.3 upload the chunk */ - addr = WL1251_PART_DOWN_MEM_START + chunk_num * CHUNK_SIZE; - p = wl->fw + FW_HDR_SIZE + chunk_num * CHUNK_SIZE; - wl1251_debug(DEBUG_BOOT, "uploading fw chunk 0x%p to 0x%x", - p, addr); - - /* need to copy the chunk for dma */ - len = CHUNK_SIZE; - memcpy(buf, p, len); - wl1251_mem_write(wl, addr, buf, len); - - chunk_num++; - } - - /* 10.4 upload the last chunk */ - addr = WL1251_PART_DOWN_MEM_START + chunk_num * CHUNK_SIZE; - p = wl->fw + FW_HDR_SIZE + chunk_num * CHUNK_SIZE; - - /* need to copy the chunk for dma */ - len = fw_data_len % CHUNK_SIZE; - memcpy(buf, p, len); - - wl1251_debug(DEBUG_BOOT, "uploading fw last chunk (%zu B) 0x%p to 0x%x", - len, p, addr); - wl1251_mem_write(wl, addr, buf, len); - - kfree(buf); - - return 0; -} - -static int wl1251_boot_upload_nvs(struct wl1251 *wl) -{ - size_t nvs_len, nvs_bytes_written, burst_len; - int nvs_start, i; - u32 dest_addr, val; - u8 *nvs_ptr, *nvs; - - nvs = wl->nvs; - if (nvs == NULL) - return -ENODEV; - - nvs_ptr = nvs; - - nvs_len = wl->nvs_len; - nvs_start = wl->fw_len; - - /* - * Layout before the actual NVS tables: - * 1 byte : burst length. - * 2 bytes: destination address. - * n bytes: data to burst copy. - * - * This is ended by a 0 length, then the NVS tables. - */ - - while (nvs_ptr[0]) { - burst_len = nvs_ptr[0]; - dest_addr = (nvs_ptr[1] & 0xfe) | ((u32)(nvs_ptr[2] << 8)); - - /* We move our pointer to the data */ - nvs_ptr += 3; - - for (i = 0; i < burst_len; i++) { - val = (nvs_ptr[0] | (nvs_ptr[1] << 8) - | (nvs_ptr[2] << 16) | (nvs_ptr[3] << 24)); - - wl1251_debug(DEBUG_BOOT, - "nvs burst write 0x%x: 0x%x", - dest_addr, val); - wl1251_mem_write32(wl, dest_addr, val); - - nvs_ptr += 4; - dest_addr += 4; - } - } - - /* - * We've reached the first zero length, the first NVS table - * is 7 bytes further. - */ - nvs_ptr += 7; - nvs_len -= nvs_ptr - nvs; - nvs_len = ALIGN(nvs_len, 4); - - /* Now we must set the partition correctly */ - wl1251_set_partition(wl, nvs_start, - WL1251_PART_DOWN_MEM_SIZE, - WL1251_PART_DOWN_REG_START, - WL1251_PART_DOWN_REG_SIZE); - - /* And finally we upload the NVS tables */ - nvs_bytes_written = 0; - while (nvs_bytes_written < nvs_len) { - val = (nvs_ptr[0] | (nvs_ptr[1] << 8) - | (nvs_ptr[2] << 16) | (nvs_ptr[3] << 24)); - - wl1251_debug(DEBUG_BOOT, - "nvs write table 0x%x: 0x%x", - nvs_start, val); - wl1251_mem_write32(wl, nvs_start, val); - - nvs_ptr += 4; - nvs_bytes_written += 4; - nvs_start += 4; - } - - return 0; -} - -int wl1251_boot(struct wl1251 *wl) -{ - int ret = 0, minor_minor_e2_ver; - u32 tmp, boot_data; - - /* halt embedded ARM CPU while loading firmware */ - wl1251_reg_write32(wl, ACX_REG_ECPU_CONTROL, ECPU_CONTROL_HALT); - - ret = wl1251_boot_soft_reset(wl); - if (ret < 0) - goto out; - - /* 2. start processing NVS file */ - if (wl->use_eeprom) { - wl1251_reg_write32(wl, ACX_REG_EE_START, START_EEPROM_MGR); - /* Wait for EEPROM NVS burst read to complete */ - msleep(40); - wl1251_reg_write32(wl, ACX_EEPROMLESS_IND_REG, USE_EEPROM); - } else { - ret = wl1251_boot_upload_nvs(wl); - if (ret < 0) - goto out; - - /* write firmware's last address (ie. it's length) to - * ACX_EEPROMLESS_IND_REG */ - wl1251_reg_write32(wl, ACX_EEPROMLESS_IND_REG, wl->fw_len); - } - - /* 6. read the EEPROM parameters */ - tmp = wl1251_reg_read32(wl, SCR_PAD2); - - /* 7. read bootdata */ - wl->boot_attr.radio_type = (tmp & 0x0000FF00) >> 8; - wl->boot_attr.major = (tmp & 0x00FF0000) >> 16; - tmp = wl1251_reg_read32(wl, SCR_PAD3); - - /* 8. check bootdata and call restart sequence */ - wl->boot_attr.minor = (tmp & 0x00FF0000) >> 16; - minor_minor_e2_ver = (tmp & 0xFF000000) >> 24; - - wl1251_debug(DEBUG_BOOT, "radioType 0x%x majorE2Ver 0x%x " - "minorE2Ver 0x%x minor_minor_e2_ver 0x%x", - wl->boot_attr.radio_type, wl->boot_attr.major, - wl->boot_attr.minor, minor_minor_e2_ver); - - ret = wl1251_boot_init_seq(wl); - if (ret < 0) - goto out; - - /* 9. NVS processing done */ - boot_data = wl1251_reg_read32(wl, ACX_REG_ECPU_CONTROL); - - wl1251_debug(DEBUG_BOOT, "halt boot_data 0x%x", boot_data); - - /* 10. check that ECPU_CONTROL_HALT bits are set in - * pWhalBus->uBootData and start uploading firmware - */ - if ((boot_data & ECPU_CONTROL_HALT) == 0) { - wl1251_error("boot failed, ECPU_CONTROL_HALT not set"); - ret = -EIO; - goto out; - } - - ret = wl1251_boot_upload_firmware(wl); - if (ret < 0) - goto out; - - /* 10.5 start firmware */ - ret = wl1251_boot_run_firmware(wl); - if (ret < 0) - goto out; - -out: - return ret; -} diff --git a/drivers/net/wireless/ti/wl1251/boot.h b/drivers/net/wireless/ti/wl1251/boot.h deleted file mode 100644 index 7661bc5e4662..000000000000 --- a/drivers/net/wireless/ti/wl1251/boot.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __BOOT_H__ -#define __BOOT_H__ - -#include "wl1251.h" - -int wl1251_boot_soft_reset(struct wl1251 *wl); -int wl1251_boot_init_seq(struct wl1251 *wl); -int wl1251_boot_run_firmware(struct wl1251 *wl); -void wl1251_boot_target_enable_interrupts(struct wl1251 *wl); -int wl1251_boot(struct wl1251 *wl); - -/* number of times we try to read the INIT interrupt */ -#define INIT_LOOP 20000 - -/* delay between retries */ -#define INIT_LOOP_DELAY 50 - -#endif diff --git a/drivers/net/wireless/ti/wl1251/cmd.c b/drivers/net/wireless/ti/wl1251/cmd.c deleted file mode 100644 index 6822b845efc1..000000000000 --- a/drivers/net/wireless/ti/wl1251/cmd.c +++ /dev/null @@ -1,487 +0,0 @@ -#include "cmd.h" - -#include -#include -#include - -#include "wl1251.h" -#include "reg.h" -#include "io.h" -#include "ps.h" -#include "acx.h" - -/** - * send command to firmware - * - * @wl: wl struct - * @id: command id - * @buf: buffer containing the command, must work with dma - * @len: length of the buffer - */ -int wl1251_cmd_send(struct wl1251 *wl, u16 id, void *buf, size_t len) -{ - struct wl1251_cmd_header *cmd; - unsigned long timeout; - u32 intr; - int ret = 0; - - cmd = buf; - cmd->id = id; - cmd->status = 0; - - WARN_ON(len % 4 != 0); - - wl1251_mem_write(wl, wl->cmd_box_addr, buf, len); - - wl1251_reg_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD); - - timeout = jiffies + msecs_to_jiffies(WL1251_COMMAND_TIMEOUT); - - intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); - while (!(intr & WL1251_ACX_INTR_CMD_COMPLETE)) { - if (time_after(jiffies, timeout)) { - wl1251_error("command complete timeout"); - ret = -ETIMEDOUT; - goto out; - } - - msleep(1); - - intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); - } - - wl1251_reg_write32(wl, ACX_REG_INTERRUPT_ACK, - WL1251_ACX_INTR_CMD_COMPLETE); - -out: - return ret; -} - -/** - * send test command to firmware - * - * @wl: wl struct - * @buf: buffer containing the command, with all headers, must work with dma - * @len: length of the buffer - * @answer: is answer needed - */ -int wl1251_cmd_test(struct wl1251 *wl, void *buf, size_t buf_len, u8 answer) -{ - int ret; - - wl1251_debug(DEBUG_CMD, "cmd test"); - - ret = wl1251_cmd_send(wl, CMD_TEST, buf, buf_len); - - if (ret < 0) { - wl1251_warning("TEST command failed"); - return ret; - } - - if (answer) { - struct wl1251_command *cmd_answer; - - /* - * The test command got in, we can read the answer. - * The answer would be a wl1251_command, where the - * parameter array contains the actual answer. - */ - wl1251_mem_read(wl, wl->cmd_box_addr, buf, buf_len); - - cmd_answer = buf; - - if (cmd_answer->header.status != CMD_STATUS_SUCCESS) - wl1251_error("TEST command answer error: %d", - cmd_answer->header.status); - } - - return 0; -} - -/** - * read acx from firmware - * - * @wl: wl struct - * @id: acx id - * @buf: buffer for the response, including all headers, must work with dma - * @len: length of buf - */ -int wl1251_cmd_interrogate(struct wl1251 *wl, u16 id, void *buf, size_t len) -{ - struct acx_header *acx = buf; - int ret; - - wl1251_debug(DEBUG_CMD, "cmd interrogate"); - - acx->id = id; - - /* payload length, does not include any headers */ - acx->len = len - sizeof(*acx); - - ret = wl1251_cmd_send(wl, CMD_INTERROGATE, acx, sizeof(*acx)); - if (ret < 0) { - wl1251_error("INTERROGATE command failed"); - goto out; - } - - /* the interrogate command got in, we can read the answer */ - wl1251_mem_read(wl, wl->cmd_box_addr, buf, len); - - acx = buf; - if (acx->cmd.status != CMD_STATUS_SUCCESS) - wl1251_error("INTERROGATE command error: %d", - acx->cmd.status); - -out: - return ret; -} - -/** - * write acx value to firmware - * - * @wl: wl struct - * @id: acx id - * @buf: buffer containing acx, including all headers, must work with dma - * @len: length of buf - */ -int wl1251_cmd_configure(struct wl1251 *wl, u16 id, void *buf, size_t len) -{ - struct acx_header *acx = buf; - int ret; - - wl1251_debug(DEBUG_CMD, "cmd configure"); - - acx->id = id; - - /* payload length, does not include any headers */ - acx->len = len - sizeof(*acx); - - ret = wl1251_cmd_send(wl, CMD_CONFIGURE, acx, len); - if (ret < 0) { - wl1251_warning("CONFIGURE command NOK"); - return ret; - } - - return 0; -} - -int wl1251_cmd_vbm(struct wl1251 *wl, u8 identity, - void *bitmap, u16 bitmap_len, u8 bitmap_control) -{ - struct wl1251_cmd_vbm_update *vbm; - int ret; - - wl1251_debug(DEBUG_CMD, "cmd vbm"); - - vbm = kzalloc(sizeof(*vbm), GFP_KERNEL); - if (!vbm) { - ret = -ENOMEM; - goto out; - } - - /* Count and period will be filled by the target */ - vbm->tim.bitmap_ctrl = bitmap_control; - if (bitmap_len > PARTIAL_VBM_MAX) { - wl1251_warning("cmd vbm len is %d B, truncating to %d", - bitmap_len, PARTIAL_VBM_MAX); - bitmap_len = PARTIAL_VBM_MAX; - } - memcpy(vbm->tim.pvb_field, bitmap, bitmap_len); - vbm->tim.identity = identity; - vbm->tim.length = bitmap_len + 3; - - vbm->len = cpu_to_le16(bitmap_len + 5); - - ret = wl1251_cmd_send(wl, CMD_VBM, vbm, sizeof(*vbm)); - if (ret < 0) { - wl1251_error("VBM command failed"); - goto out; - } - -out: - kfree(vbm); - return ret; -} - -int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, bool enable) -{ - struct cmd_enabledisable_path *cmd; - int ret; - u16 cmd_rx, cmd_tx; - - wl1251_debug(DEBUG_CMD, "cmd data path"); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->channel = channel; - - if (enable) { - cmd_rx = CMD_ENABLE_RX; - cmd_tx = CMD_ENABLE_TX; - } else { - cmd_rx = CMD_DISABLE_RX; - cmd_tx = CMD_DISABLE_TX; - } - - ret = wl1251_cmd_send(wl, cmd_rx, cmd, sizeof(*cmd)); - if (ret < 0) { - wl1251_error("rx %s cmd for channel %d failed", - enable ? "start" : "stop", channel); - goto out; - } - - wl1251_debug(DEBUG_BOOT, "rx %s cmd channel %d", - enable ? "start" : "stop", channel); - - ret = wl1251_cmd_send(wl, cmd_tx, cmd, sizeof(*cmd)); - if (ret < 0) { - wl1251_error("tx %s cmd for channel %d failed", - enable ? "start" : "stop", channel); - goto out; - } - - wl1251_debug(DEBUG_BOOT, "tx %s cmd channel %d", - enable ? "start" : "stop", channel); - -out: - kfree(cmd); - return ret; -} - -int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel, - u16 beacon_interval, u8 dtim_interval) -{ - struct cmd_join *join; - int ret, i; - u8 *bssid; - - join = kzalloc(sizeof(*join), GFP_KERNEL); - if (!join) { - ret = -ENOMEM; - goto out; - } - - wl1251_debug(DEBUG_CMD, "cmd join%s ch %d %d/%d", - bss_type == BSS_TYPE_IBSS ? " ibss" : "", - channel, beacon_interval, dtim_interval); - - /* Reverse order BSSID */ - bssid = (u8 *) &join->bssid_lsb; - for (i = 0; i < ETH_ALEN; i++) - bssid[i] = wl->bssid[ETH_ALEN - i - 1]; - - join->rx_config_options = wl->rx_config; - join->rx_filter_options = wl->rx_filter; - - join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS | - RATE_MASK_5_5MBPS | RATE_MASK_11MBPS; - - join->beacon_interval = beacon_interval; - join->dtim_interval = dtim_interval; - join->bss_type = bss_type; - join->channel = channel; - join->ctrl = JOIN_CMD_CTRL_TX_FLUSH; - - ret = wl1251_cmd_send(wl, CMD_START_JOIN, join, sizeof(*join)); - if (ret < 0) { - wl1251_error("failed to initiate cmd join"); - goto out; - } - -out: - kfree(join); - return ret; -} - -int wl1251_cmd_ps_mode(struct wl1251 *wl, u8 ps_mode) -{ - struct wl1251_cmd_ps_params *ps_params = NULL; - int ret = 0; - - wl1251_debug(DEBUG_CMD, "cmd set ps mode"); - - ps_params = kzalloc(sizeof(*ps_params), GFP_KERNEL); - if (!ps_params) { - ret = -ENOMEM; - goto out; - } - - ps_params->ps_mode = ps_mode; - ps_params->send_null_data = 1; - ps_params->retries = 5; - ps_params->hang_over_period = 128; - ps_params->null_data_rate = 1; /* 1 Mbps */ - - ret = wl1251_cmd_send(wl, CMD_SET_PS_MODE, ps_params, - sizeof(*ps_params)); - if (ret < 0) { - wl1251_error("cmd set_ps_mode failed"); - goto out; - } - -out: - kfree(ps_params); - return ret; -} - -int wl1251_cmd_read_memory(struct wl1251 *wl, u32 addr, void *answer, - size_t len) -{ - struct cmd_read_write_memory *cmd; - int ret = 0; - - wl1251_debug(DEBUG_CMD, "cmd read memory"); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - WARN_ON(len > MAX_READ_SIZE); - len = min_t(size_t, len, MAX_READ_SIZE); - - cmd->addr = addr; - cmd->size = len; - - ret = wl1251_cmd_send(wl, CMD_READ_MEMORY, cmd, sizeof(*cmd)); - if (ret < 0) { - wl1251_error("read memory command failed: %d", ret); - goto out; - } - - /* the read command got in, we can now read the answer */ - wl1251_mem_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd)); - - if (cmd->header.status != CMD_STATUS_SUCCESS) - wl1251_error("error in read command result: %d", - cmd->header.status); - - memcpy(answer, cmd->value, len); - -out: - kfree(cmd); - return ret; -} - -int wl1251_cmd_template_set(struct wl1251 *wl, u16 cmd_id, - void *buf, size_t buf_len) -{ - struct wl1251_cmd_packet_template *cmd; - size_t cmd_len; - int ret = 0; - - wl1251_debug(DEBUG_CMD, "cmd template %d", cmd_id); - - WARN_ON(buf_len > WL1251_MAX_TEMPLATE_SIZE); - buf_len = min_t(size_t, buf_len, WL1251_MAX_TEMPLATE_SIZE); - cmd_len = ALIGN(sizeof(*cmd) + buf_len, 4); - - cmd = kzalloc(cmd_len, GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->size = cpu_to_le16(buf_len); - - if (buf) - memcpy(cmd->data, buf, buf_len); - - ret = wl1251_cmd_send(wl, cmd_id, cmd, cmd_len); - if (ret < 0) { - wl1251_warning("cmd set_template failed: %d", ret); - goto out; - } - -out: - kfree(cmd); - return ret; -} - -int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len, - struct ieee80211_channel *channels[], - unsigned int n_channels, unsigned int n_probes) -{ - struct wl1251_cmd_scan *cmd; - int i, ret = 0; - - wl1251_debug(DEBUG_CMD, "cmd scan"); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) - return -ENOMEM; - - cmd->params.rx_config_options = cpu_to_le32(CFG_RX_ALL_GOOD); - cmd->params.rx_filter_options = cpu_to_le32(CFG_RX_PRSP_EN | - CFG_RX_MGMT_EN | - CFG_RX_BCN_EN); - cmd->params.scan_options = 0; - cmd->params.num_channels = n_channels; - cmd->params.num_probe_requests = n_probes; - cmd->params.tx_rate = cpu_to_le16(1 << 1); /* 2 Mbps */ - cmd->params.tid_trigger = 0; - - for (i = 0; i < n_channels; i++) { - cmd->channels[i].min_duration = - cpu_to_le32(WL1251_SCAN_MIN_DURATION); - cmd->channels[i].max_duration = - cpu_to_le32(WL1251_SCAN_MAX_DURATION); - memset(&cmd->channels[i].bssid_lsb, 0xff, 4); - memset(&cmd->channels[i].bssid_msb, 0xff, 2); - cmd->channels[i].early_termination = 0; - cmd->channels[i].tx_power_att = 0; - cmd->channels[i].channel = channels[i]->hw_value; - } - - cmd->params.ssid_len = ssid_len; - if (ssid) - memcpy(cmd->params.ssid, ssid, ssid_len); - - ret = wl1251_cmd_send(wl, CMD_SCAN, cmd, sizeof(*cmd)); - if (ret < 0) { - wl1251_error("cmd scan failed: %d", ret); - goto out; - } - - wl1251_mem_read(wl, wl->cmd_box_addr, cmd, sizeof(*cmd)); - - if (cmd->header.status != CMD_STATUS_SUCCESS) { - wl1251_error("cmd scan status wasn't success: %d", - cmd->header.status); - ret = -EIO; - goto out; - } - -out: - kfree(cmd); - return ret; -} - -int wl1251_cmd_trigger_scan_to(struct wl1251 *wl, u32 timeout) -{ - struct wl1251_cmd_trigger_scan_to *cmd; - int ret; - - wl1251_debug(DEBUG_CMD, "cmd trigger scan to"); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) - return -ENOMEM; - - cmd->timeout = timeout; - - ret = wl1251_cmd_send(wl, CMD_TRIGGER_SCAN_TO, cmd, sizeof(*cmd)); - if (ret < 0) { - wl1251_error("cmd trigger scan to failed: %d", ret); - goto out; - } - -out: - kfree(cmd); - return ret; -} diff --git a/drivers/net/wireless/ti/wl1251/cmd.h b/drivers/net/wireless/ti/wl1251/cmd.h deleted file mode 100644 index ee4f2b391822..000000000000 --- a/drivers/net/wireless/ti/wl1251/cmd.h +++ /dev/null @@ -1,415 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (c) 1998-2007 Texas Instruments Incorporated - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL1251_CMD_H__ -#define __WL1251_CMD_H__ - -#include "wl1251.h" - -#include - -struct acx_header; - -int wl1251_cmd_send(struct wl1251 *wl, u16 type, void *buf, size_t buf_len); -int wl1251_cmd_test(struct wl1251 *wl, void *buf, size_t buf_len, u8 answer); -int wl1251_cmd_interrogate(struct wl1251 *wl, u16 id, void *buf, size_t len); -int wl1251_cmd_configure(struct wl1251 *wl, u16 id, void *buf, size_t len); -int wl1251_cmd_vbm(struct wl1251 *wl, u8 identity, - void *bitmap, u16 bitmap_len, u8 bitmap_control); -int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, bool enable); -int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel, - u16 beacon_interval, u8 dtim_interval); -int wl1251_cmd_ps_mode(struct wl1251 *wl, u8 ps_mode); -int wl1251_cmd_read_memory(struct wl1251 *wl, u32 addr, void *answer, - size_t len); -int wl1251_cmd_template_set(struct wl1251 *wl, u16 cmd_id, - void *buf, size_t buf_len); -int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len, - struct ieee80211_channel *channels[], - unsigned int n_channels, unsigned int n_probes); -int wl1251_cmd_trigger_scan_to(struct wl1251 *wl, u32 timeout); - -/* unit ms */ -#define WL1251_COMMAND_TIMEOUT 2000 - -enum wl1251_commands { - CMD_RESET = 0, - CMD_INTERROGATE = 1, /*use this to read information elements*/ - CMD_CONFIGURE = 2, /*use this to write information elements*/ - CMD_ENABLE_RX = 3, - CMD_ENABLE_TX = 4, - CMD_DISABLE_RX = 5, - CMD_DISABLE_TX = 6, - CMD_SCAN = 8, - CMD_STOP_SCAN = 9, - CMD_VBM = 10, - CMD_START_JOIN = 11, - CMD_SET_KEYS = 12, - CMD_READ_MEMORY = 13, - CMD_WRITE_MEMORY = 14, - CMD_BEACON = 19, - CMD_PROBE_RESP = 20, - CMD_NULL_DATA = 21, - CMD_PROBE_REQ = 22, - CMD_TEST = 23, - CMD_RADIO_CALIBRATE = 25, /* OBSOLETE */ - CMD_ENABLE_RX_PATH = 27, /* OBSOLETE */ - CMD_NOISE_HIST = 28, - CMD_RX_RESET = 29, - CMD_PS_POLL = 30, - CMD_QOS_NULL_DATA = 31, - CMD_LNA_CONTROL = 32, - CMD_SET_BCN_MODE = 33, - CMD_MEASUREMENT = 34, - CMD_STOP_MEASUREMENT = 35, - CMD_DISCONNECT = 36, - CMD_SET_PS_MODE = 37, - CMD_CHANNEL_SWITCH = 38, - CMD_STOP_CHANNEL_SWICTH = 39, - CMD_AP_DISCOVERY = 40, - CMD_STOP_AP_DISCOVERY = 41, - CMD_SPS_SCAN = 42, - CMD_STOP_SPS_SCAN = 43, - CMD_HEALTH_CHECK = 45, - CMD_DEBUG = 46, - CMD_TRIGGER_SCAN_TO = 47, - - NUM_COMMANDS, - MAX_COMMAND_ID = 0xFFFF, -}; - -#define MAX_CMD_PARAMS 572 - -struct wl1251_cmd_header { - u16 id; - u16 status; - /* payload */ - u8 data[0]; -} __packed; - -struct wl1251_command { - struct wl1251_cmd_header header; - u8 parameters[MAX_CMD_PARAMS]; -} __packed; - -enum { - CMD_MAILBOX_IDLE = 0, - CMD_STATUS_SUCCESS = 1, - CMD_STATUS_UNKNOWN_CMD = 2, - CMD_STATUS_UNKNOWN_IE = 3, - CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11, - CMD_STATUS_RX_BUSY = 13, - CMD_STATUS_INVALID_PARAM = 14, - CMD_STATUS_TEMPLATE_TOO_LARGE = 15, - CMD_STATUS_OUT_OF_MEMORY = 16, - CMD_STATUS_STA_TABLE_FULL = 17, - CMD_STATUS_RADIO_ERROR = 18, - CMD_STATUS_WRONG_NESTING = 19, - CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/ - CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/ - MAX_COMMAND_STATUS = 0xff -}; - - -/* - * CMD_READ_MEMORY - * - * The host issues this command to read the WiLink device memory/registers. - * - * Note: The Base Band address has special handling (16 bits registers and - * addresses). For more information, see the hardware specification. - */ -/* - * CMD_WRITE_MEMORY - * - * The host issues this command to write the WiLink device memory/registers. - * - * The Base Band address has special handling (16 bits registers and - * addresses). For more information, see the hardware specification. - */ -#define MAX_READ_SIZE 256 - -struct cmd_read_write_memory { - struct wl1251_cmd_header header; - - /* The address of the memory to read from or write to.*/ - u32 addr; - - /* The amount of data in bytes to read from or write to the WiLink - * device.*/ - u32 size; - - /* The actual value read from or written to the Wilink. The source - of this field is the Host in WRITE command or the Wilink in READ - command. */ - u8 value[MAX_READ_SIZE]; -} __packed; - -#define CMDMBOX_HEADER_LEN 4 -#define CMDMBOX_INFO_ELEM_HEADER_LEN 4 - -#define WL1251_SCAN_MIN_DURATION 30000 -#define WL1251_SCAN_MAX_DURATION 60000 - -#define WL1251_SCAN_NUM_PROBES 3 - -struct wl1251_scan_parameters { - __le32 rx_config_options; - __le32 rx_filter_options; - - /* - * Scan options: - * bit 0: When this bit is set, passive scan. - * bit 1: Band, when this bit is set we scan - * in the 5Ghz band. - * bit 2: voice mode, 0 for normal scan. - * bit 3: scan priority, 1 for high priority. - */ - __le16 scan_options; - - /* Number of channels to scan */ - u8 num_channels; - - /* Number opf probe requests to send, per channel */ - u8 num_probe_requests; - - /* Rate and modulation for probe requests */ - __le16 tx_rate; - - u8 tid_trigger; - u8 ssid_len; - u8 ssid[32]; - -} __packed; - -struct wl1251_scan_ch_parameters { - __le32 min_duration; /* in TU */ - __le32 max_duration; /* in TU */ - u32 bssid_lsb; - u16 bssid_msb; - - /* - * bits 0-3: Early termination count. - * bits 4-5: Early termination condition. - */ - u8 early_termination; - - u8 tx_power_att; - u8 channel; - u8 pad[3]; -} __packed; - -/* SCAN parameters */ -#define SCAN_MAX_NUM_OF_CHANNELS 16 - -struct wl1251_cmd_scan { - struct wl1251_cmd_header header; - - struct wl1251_scan_parameters params; - struct wl1251_scan_ch_parameters channels[SCAN_MAX_NUM_OF_CHANNELS]; -} __packed; - -enum { - BSS_TYPE_IBSS = 0, - BSS_TYPE_STA_BSS = 2, - BSS_TYPE_AP_BSS = 3, - MAX_BSS_TYPE = 0xFF -}; - -#define JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */ -#define JOIN_CMD_CTRL_EARLY_WAKEUP_ENABLE 0x01 /* Early wakeup time */ - - -struct cmd_join { - struct wl1251_cmd_header header; - - u32 bssid_lsb; - u16 bssid_msb; - u16 beacon_interval; /* in TBTTs */ - u32 rx_config_options; - u32 rx_filter_options; - - /* - * The target uses this field to determine the rate at - * which to transmit control frame responses (such as - * ACK or CTS frames). - */ - u16 basic_rate_set; - u8 dtim_interval; - u8 tx_ctrl_frame_rate; /* OBSOLETE */ - u8 tx_ctrl_frame_mod; /* OBSOLETE */ - /* - * bits 0-2: This bitwise field specifies the type - * of BSS to start or join (BSS_TYPE_*). - * bit 4: Band - The radio band in which to join - * or start. - * 0 - 2.4GHz band - * 1 - 5GHz band - * bits 3, 5-7: Reserved - */ - u8 bss_type; - u8 channel; - u8 ssid_len; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - u8 ctrl; /* JOIN_CMD_CTRL_* */ - u8 tx_mgt_frame_rate; /* OBSOLETE */ - u8 tx_mgt_frame_mod; /* OBSOLETE */ - u8 reserved; -} __packed; - -struct cmd_enabledisable_path { - struct wl1251_cmd_header header; - - u8 channel; - u8 padding[3]; -} __packed; - -#define WL1251_MAX_TEMPLATE_SIZE 300 - -struct wl1251_cmd_packet_template { - struct wl1251_cmd_header header; - - __le16 size; - u8 data[0]; -} __packed; - -#define TIM_ELE_ID 5 -#define PARTIAL_VBM_MAX 251 - -struct wl1251_tim { - u8 identity; - u8 length; - u8 dtim_count; - u8 dtim_period; - u8 bitmap_ctrl; - u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */ -} __packed; - -/* Virtual Bit Map update */ -struct wl1251_cmd_vbm_update { - struct wl1251_cmd_header header; - __le16 len; - u8 padding[2]; - struct wl1251_tim tim; -} __packed; - -enum wl1251_cmd_ps_mode { - CHIP_ACTIVE_MODE, - CHIP_POWER_SAVE_MODE -}; - -struct wl1251_cmd_ps_params { - struct wl1251_cmd_header header; - - u8 ps_mode; /* STATION_* */ - u8 send_null_data; /* Do we have to send NULL data packet ? */ - u8 retries; /* Number of retires for the initial NULL data packet */ - - /* - * TUs during which the target stays awake after switching - * to power save mode. - */ - u8 hang_over_period; - u16 null_data_rate; - u8 pad[2]; -} __packed; - -struct wl1251_cmd_trigger_scan_to { - struct wl1251_cmd_header header; - - u32 timeout; -} __packed; - -/* HW encryption keys */ -#define NUM_ACCESS_CATEGORIES_COPY 4 -#define MAX_KEY_SIZE 32 - -/* When set, disable HW encryption */ -#define DF_ENCRYPTION_DISABLE 0x01 -/* When set, disable HW decryption */ -#define DF_SNIFF_MODE_ENABLE 0x80 - -enum wl1251_cmd_key_action { - KEY_ADD_OR_REPLACE = 1, - KEY_REMOVE = 2, - KEY_SET_ID = 3, - MAX_KEY_ACTION = 0xffff, -}; - -enum wl1251_cmd_key_type { - KEY_WEP_DEFAULT = 0, - KEY_WEP_ADDR = 1, - KEY_AES_GROUP = 4, - KEY_AES_PAIRWISE = 5, - KEY_WEP_GROUP = 6, - KEY_TKIP_MIC_GROUP = 10, - KEY_TKIP_MIC_PAIRWISE = 11, -}; - -/* - * - * key_type_e key size key format - * ---------- --------- ---------- - * 0x00 5, 13, 29 Key data - * 0x01 5, 13, 29 Key data - * 0x04 16 16 bytes of key data - * 0x05 16 16 bytes of key data - * 0x0a 32 16 bytes of TKIP key data - * 8 bytes of RX MIC key data - * 8 bytes of TX MIC key data - * 0x0b 32 16 bytes of TKIP key data - * 8 bytes of RX MIC key data - * 8 bytes of TX MIC key data - * - */ - -struct wl1251_cmd_set_keys { - struct wl1251_cmd_header header; - - /* Ignored for default WEP key */ - u8 addr[ETH_ALEN]; - - /* key_action_e */ - u16 key_action; - - u16 reserved_1; - - /* key size in bytes */ - u8 key_size; - - /* key_type_e */ - u8 key_type; - u8 ssid_profile; - - /* - * TKIP, AES: frame's key id field. - * For WEP default key: key id; - */ - u8 id; - u8 reserved_2[6]; - u8 key[MAX_KEY_SIZE]; - u16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY]; - u32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY]; -} __packed; - - -#endif /* __WL1251_CMD_H__ */ diff --git a/drivers/net/wireless/ti/wl1251/debugfs.c b/drivers/net/wireless/ti/wl1251/debugfs.c deleted file mode 100644 index 448da1f8c22f..000000000000 --- a/drivers/net/wireless/ti/wl1251/debugfs.c +++ /dev/null @@ -1,539 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (C) 2009 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "debugfs.h" - -#include -#include - -#include "wl1251.h" -#include "acx.h" -#include "ps.h" - -/* ms */ -#define WL1251_DEBUGFS_STATS_LIFETIME 1000 - -/* debugfs macros idea from mac80211 */ - -#define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \ -static ssize_t name## _read(struct file *file, char __user *userbuf, \ - size_t count, loff_t *ppos) \ -{ \ - struct wl1251 *wl = file->private_data; \ - char buf[buflen]; \ - int res; \ - \ - res = scnprintf(buf, buflen, fmt "\n", ##value); \ - return simple_read_from_buffer(userbuf, count, ppos, buf, res); \ -} \ - \ -static const struct file_operations name## _ops = { \ - .read = name## _read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -#define DEBUGFS_ADD(name, parent) \ - wl->debugfs.name = debugfs_create_file(#name, 0400, parent, \ - wl, &name## _ops); \ - if (IS_ERR(wl->debugfs.name)) { \ - ret = PTR_ERR(wl->debugfs.name); \ - wl->debugfs.name = NULL; \ - goto out; \ - } - -#define DEBUGFS_DEL(name) \ - do { \ - debugfs_remove(wl->debugfs.name); \ - wl->debugfs.name = NULL; \ - } while (0) - -#define DEBUGFS_FWSTATS_FILE(sub, name, buflen, fmt) \ -static ssize_t sub## _ ##name## _read(struct file *file, \ - char __user *userbuf, \ - size_t count, loff_t *ppos) \ -{ \ - struct wl1251 *wl = file->private_data; \ - char buf[buflen]; \ - int res; \ - \ - wl1251_debugfs_update_stats(wl); \ - \ - res = scnprintf(buf, buflen, fmt "\n", \ - wl->stats.fw_stats->sub.name); \ - return simple_read_from_buffer(userbuf, count, ppos, buf, res); \ -} \ - \ -static const struct file_operations sub## _ ##name## _ops = { \ - .read = sub## _ ##name## _read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -#define DEBUGFS_FWSTATS_ADD(sub, name) \ - DEBUGFS_ADD(sub## _ ##name, wl->debugfs.fw_statistics) - -#define DEBUGFS_FWSTATS_DEL(sub, name) \ - DEBUGFS_DEL(sub## _ ##name) - -static void wl1251_debugfs_update_stats(struct wl1251 *wl) -{ - int ret; - - mutex_lock(&wl->mutex); - - ret = wl1251_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - if (wl->state == WL1251_STATE_ON && - time_after(jiffies, wl->stats.fw_stats_update + - msecs_to_jiffies(WL1251_DEBUGFS_STATS_LIFETIME))) { - wl1251_acx_statistics(wl, wl->stats.fw_stats); - wl->stats.fw_stats_update = jiffies; - } - - wl1251_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); -} - -DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, 20, "%u"); - -DEBUGFS_FWSTATS_FILE(rx, out_of_mem, 20, "%u"); -DEBUGFS_FWSTATS_FILE(rx, hdr_overflow, 20, "%u"); -DEBUGFS_FWSTATS_FILE(rx, hw_stuck, 20, "%u"); -DEBUGFS_FWSTATS_FILE(rx, dropped, 20, "%u"); -DEBUGFS_FWSTATS_FILE(rx, fcs_err, 20, "%u"); -DEBUGFS_FWSTATS_FILE(rx, xfr_hint_trig, 20, "%u"); -DEBUGFS_FWSTATS_FILE(rx, path_reset, 20, "%u"); -DEBUGFS_FWSTATS_FILE(rx, reset_counter, 20, "%u"); - -DEBUGFS_FWSTATS_FILE(dma, rx_requested, 20, "%u"); -DEBUGFS_FWSTATS_FILE(dma, rx_errors, 20, "%u"); -DEBUGFS_FWSTATS_FILE(dma, tx_requested, 20, "%u"); -DEBUGFS_FWSTATS_FILE(dma, tx_errors, 20, "%u"); - -DEBUGFS_FWSTATS_FILE(isr, cmd_cmplt, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, fiqs, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, rx_headers, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, rx_mem_overflow, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, rx_rdys, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, irqs, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, tx_procs, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, decrypt_done, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, dma0_done, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, dma1_done, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, tx_exch_complete, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, commands, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, rx_procs, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, hw_pm_mode_changes, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, host_acknowledges, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, pci_pm, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, wakeups, 20, "%u"); -DEBUGFS_FWSTATS_FILE(isr, low_rssi, 20, "%u"); - -DEBUGFS_FWSTATS_FILE(wep, addr_key_count, 20, "%u"); -DEBUGFS_FWSTATS_FILE(wep, default_key_count, 20, "%u"); -/* skipping wep.reserved */ -DEBUGFS_FWSTATS_FILE(wep, key_not_found, 20, "%u"); -DEBUGFS_FWSTATS_FILE(wep, decrypt_fail, 20, "%u"); -DEBUGFS_FWSTATS_FILE(wep, packets, 20, "%u"); -DEBUGFS_FWSTATS_FILE(wep, interrupt, 20, "%u"); - -DEBUGFS_FWSTATS_FILE(pwr, ps_enter, 20, "%u"); -DEBUGFS_FWSTATS_FILE(pwr, elp_enter, 20, "%u"); -DEBUGFS_FWSTATS_FILE(pwr, missing_bcns, 20, "%u"); -DEBUGFS_FWSTATS_FILE(pwr, wake_on_host, 20, "%u"); -DEBUGFS_FWSTATS_FILE(pwr, wake_on_timer_exp, 20, "%u"); -DEBUGFS_FWSTATS_FILE(pwr, tx_with_ps, 20, "%u"); -DEBUGFS_FWSTATS_FILE(pwr, tx_without_ps, 20, "%u"); -DEBUGFS_FWSTATS_FILE(pwr, rcvd_beacons, 20, "%u"); -DEBUGFS_FWSTATS_FILE(pwr, power_save_off, 20, "%u"); -DEBUGFS_FWSTATS_FILE(pwr, enable_ps, 20, "%u"); -DEBUGFS_FWSTATS_FILE(pwr, disable_ps, 20, "%u"); -DEBUGFS_FWSTATS_FILE(pwr, fix_tsf_ps, 20, "%u"); -/* skipping cont_miss_bcns_spread for now */ -DEBUGFS_FWSTATS_FILE(pwr, rcvd_awake_beacons, 20, "%u"); - -DEBUGFS_FWSTATS_FILE(mic, rx_pkts, 20, "%u"); -DEBUGFS_FWSTATS_FILE(mic, calc_failure, 20, "%u"); - -DEBUGFS_FWSTATS_FILE(aes, encrypt_fail, 20, "%u"); -DEBUGFS_FWSTATS_FILE(aes, decrypt_fail, 20, "%u"); -DEBUGFS_FWSTATS_FILE(aes, encrypt_packets, 20, "%u"); -DEBUGFS_FWSTATS_FILE(aes, decrypt_packets, 20, "%u"); -DEBUGFS_FWSTATS_FILE(aes, encrypt_interrupt, 20, "%u"); -DEBUGFS_FWSTATS_FILE(aes, decrypt_interrupt, 20, "%u"); - -DEBUGFS_FWSTATS_FILE(event, heart_beat, 20, "%u"); -DEBUGFS_FWSTATS_FILE(event, calibration, 20, "%u"); -DEBUGFS_FWSTATS_FILE(event, rx_mismatch, 20, "%u"); -DEBUGFS_FWSTATS_FILE(event, rx_mem_empty, 20, "%u"); -DEBUGFS_FWSTATS_FILE(event, rx_pool, 20, "%u"); -DEBUGFS_FWSTATS_FILE(event, oom_late, 20, "%u"); -DEBUGFS_FWSTATS_FILE(event, phy_transmit_error, 20, "%u"); -DEBUGFS_FWSTATS_FILE(event, tx_stuck, 20, "%u"); - -DEBUGFS_FWSTATS_FILE(ps, pspoll_timeouts, 20, "%u"); -DEBUGFS_FWSTATS_FILE(ps, upsd_timeouts, 20, "%u"); -DEBUGFS_FWSTATS_FILE(ps, upsd_max_sptime, 20, "%u"); -DEBUGFS_FWSTATS_FILE(ps, upsd_max_apturn, 20, "%u"); -DEBUGFS_FWSTATS_FILE(ps, pspoll_max_apturn, 20, "%u"); -DEBUGFS_FWSTATS_FILE(ps, pspoll_utilization, 20, "%u"); -DEBUGFS_FWSTATS_FILE(ps, upsd_utilization, 20, "%u"); - -DEBUGFS_FWSTATS_FILE(rxpipe, rx_prep_beacon_drop, 20, "%u"); -DEBUGFS_FWSTATS_FILE(rxpipe, descr_host_int_trig_rx_data, 20, "%u"); -DEBUGFS_FWSTATS_FILE(rxpipe, beacon_buffer_thres_host_int_trig_rx_data, - 20, "%u"); -DEBUGFS_FWSTATS_FILE(rxpipe, missed_beacon_host_int_trig_rx_data, 20, "%u"); -DEBUGFS_FWSTATS_FILE(rxpipe, tx_xfr_host_int_trig_rx_data, 20, "%u"); - -DEBUGFS_READONLY_FILE(retry_count, 20, "%u", wl->stats.retry_count); -DEBUGFS_READONLY_FILE(excessive_retries, 20, "%u", - wl->stats.excessive_retries); - -static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct wl1251 *wl = file->private_data; - u32 queue_len; - char buf[20]; - int res; - - queue_len = skb_queue_len(&wl->tx_queue); - - res = scnprintf(buf, sizeof(buf), "%u\n", queue_len); - return simple_read_from_buffer(userbuf, count, ppos, buf, res); -} - -static const struct file_operations tx_queue_len_ops = { - .read = tx_queue_len_read, - .open = simple_open, - .llseek = generic_file_llseek, -}; - -static ssize_t tx_queue_status_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct wl1251 *wl = file->private_data; - char buf[3], status; - int len; - - if (wl->tx_queue_stopped) - status = 's'; - else - status = 'r'; - - len = scnprintf(buf, sizeof(buf), "%c\n", status); - return simple_read_from_buffer(userbuf, count, ppos, buf, len); -} - -static const struct file_operations tx_queue_status_ops = { - .read = tx_queue_status_read, - .open = simple_open, - .llseek = generic_file_llseek, -}; - -static void wl1251_debugfs_delete_files(struct wl1251 *wl) -{ - DEBUGFS_FWSTATS_DEL(tx, internal_desc_overflow); - - DEBUGFS_FWSTATS_DEL(rx, out_of_mem); - DEBUGFS_FWSTATS_DEL(rx, hdr_overflow); - DEBUGFS_FWSTATS_DEL(rx, hw_stuck); - DEBUGFS_FWSTATS_DEL(rx, dropped); - DEBUGFS_FWSTATS_DEL(rx, fcs_err); - DEBUGFS_FWSTATS_DEL(rx, xfr_hint_trig); - DEBUGFS_FWSTATS_DEL(rx, path_reset); - DEBUGFS_FWSTATS_DEL(rx, reset_counter); - - DEBUGFS_FWSTATS_DEL(dma, rx_requested); - DEBUGFS_FWSTATS_DEL(dma, rx_errors); - DEBUGFS_FWSTATS_DEL(dma, tx_requested); - DEBUGFS_FWSTATS_DEL(dma, tx_errors); - - DEBUGFS_FWSTATS_DEL(isr, cmd_cmplt); - DEBUGFS_FWSTATS_DEL(isr, fiqs); - DEBUGFS_FWSTATS_DEL(isr, rx_headers); - DEBUGFS_FWSTATS_DEL(isr, rx_mem_overflow); - DEBUGFS_FWSTATS_DEL(isr, rx_rdys); - DEBUGFS_FWSTATS_DEL(isr, irqs); - DEBUGFS_FWSTATS_DEL(isr, tx_procs); - DEBUGFS_FWSTATS_DEL(isr, decrypt_done); - DEBUGFS_FWSTATS_DEL(isr, dma0_done); - DEBUGFS_FWSTATS_DEL(isr, dma1_done); - DEBUGFS_FWSTATS_DEL(isr, tx_exch_complete); - DEBUGFS_FWSTATS_DEL(isr, commands); - DEBUGFS_FWSTATS_DEL(isr, rx_procs); - DEBUGFS_FWSTATS_DEL(isr, hw_pm_mode_changes); - DEBUGFS_FWSTATS_DEL(isr, host_acknowledges); - DEBUGFS_FWSTATS_DEL(isr, pci_pm); - DEBUGFS_FWSTATS_DEL(isr, wakeups); - DEBUGFS_FWSTATS_DEL(isr, low_rssi); - - DEBUGFS_FWSTATS_DEL(wep, addr_key_count); - DEBUGFS_FWSTATS_DEL(wep, default_key_count); - /* skipping wep.reserved */ - DEBUGFS_FWSTATS_DEL(wep, key_not_found); - DEBUGFS_FWSTATS_DEL(wep, decrypt_fail); - DEBUGFS_FWSTATS_DEL(wep, packets); - DEBUGFS_FWSTATS_DEL(wep, interrupt); - - DEBUGFS_FWSTATS_DEL(pwr, ps_enter); - DEBUGFS_FWSTATS_DEL(pwr, elp_enter); - DEBUGFS_FWSTATS_DEL(pwr, missing_bcns); - DEBUGFS_FWSTATS_DEL(pwr, wake_on_host); - DEBUGFS_FWSTATS_DEL(pwr, wake_on_timer_exp); - DEBUGFS_FWSTATS_DEL(pwr, tx_with_ps); - DEBUGFS_FWSTATS_DEL(pwr, tx_without_ps); - DEBUGFS_FWSTATS_DEL(pwr, rcvd_beacons); - DEBUGFS_FWSTATS_DEL(pwr, power_save_off); - DEBUGFS_FWSTATS_DEL(pwr, enable_ps); - DEBUGFS_FWSTATS_DEL(pwr, disable_ps); - DEBUGFS_FWSTATS_DEL(pwr, fix_tsf_ps); - /* skipping cont_miss_bcns_spread for now */ - DEBUGFS_FWSTATS_DEL(pwr, rcvd_awake_beacons); - - DEBUGFS_FWSTATS_DEL(mic, rx_pkts); - DEBUGFS_FWSTATS_DEL(mic, calc_failure); - - DEBUGFS_FWSTATS_DEL(aes, encrypt_fail); - DEBUGFS_FWSTATS_DEL(aes, decrypt_fail); - DEBUGFS_FWSTATS_DEL(aes, encrypt_packets); - DEBUGFS_FWSTATS_DEL(aes, decrypt_packets); - DEBUGFS_FWSTATS_DEL(aes, encrypt_interrupt); - DEBUGFS_FWSTATS_DEL(aes, decrypt_interrupt); - - DEBUGFS_FWSTATS_DEL(event, heart_beat); - DEBUGFS_FWSTATS_DEL(event, calibration); - DEBUGFS_FWSTATS_DEL(event, rx_mismatch); - DEBUGFS_FWSTATS_DEL(event, rx_mem_empty); - DEBUGFS_FWSTATS_DEL(event, rx_pool); - DEBUGFS_FWSTATS_DEL(event, oom_late); - DEBUGFS_FWSTATS_DEL(event, phy_transmit_error); - DEBUGFS_FWSTATS_DEL(event, tx_stuck); - - DEBUGFS_FWSTATS_DEL(ps, pspoll_timeouts); - DEBUGFS_FWSTATS_DEL(ps, upsd_timeouts); - DEBUGFS_FWSTATS_DEL(ps, upsd_max_sptime); - DEBUGFS_FWSTATS_DEL(ps, upsd_max_apturn); - DEBUGFS_FWSTATS_DEL(ps, pspoll_max_apturn); - DEBUGFS_FWSTATS_DEL(ps, pspoll_utilization); - DEBUGFS_FWSTATS_DEL(ps, upsd_utilization); - - DEBUGFS_FWSTATS_DEL(rxpipe, rx_prep_beacon_drop); - DEBUGFS_FWSTATS_DEL(rxpipe, descr_host_int_trig_rx_data); - DEBUGFS_FWSTATS_DEL(rxpipe, beacon_buffer_thres_host_int_trig_rx_data); - DEBUGFS_FWSTATS_DEL(rxpipe, missed_beacon_host_int_trig_rx_data); - DEBUGFS_FWSTATS_DEL(rxpipe, tx_xfr_host_int_trig_rx_data); - - DEBUGFS_DEL(tx_queue_len); - DEBUGFS_DEL(tx_queue_status); - DEBUGFS_DEL(retry_count); - DEBUGFS_DEL(excessive_retries); -} - -static int wl1251_debugfs_add_files(struct wl1251 *wl) -{ - int ret = 0; - - DEBUGFS_FWSTATS_ADD(tx, internal_desc_overflow); - - DEBUGFS_FWSTATS_ADD(rx, out_of_mem); - DEBUGFS_FWSTATS_ADD(rx, hdr_overflow); - DEBUGFS_FWSTATS_ADD(rx, hw_stuck); - DEBUGFS_FWSTATS_ADD(rx, dropped); - DEBUGFS_FWSTATS_ADD(rx, fcs_err); - DEBUGFS_FWSTATS_ADD(rx, xfr_hint_trig); - DEBUGFS_FWSTATS_ADD(rx, path_reset); - DEBUGFS_FWSTATS_ADD(rx, reset_counter); - - DEBUGFS_FWSTATS_ADD(dma, rx_requested); - DEBUGFS_FWSTATS_ADD(dma, rx_errors); - DEBUGFS_FWSTATS_ADD(dma, tx_requested); - DEBUGFS_FWSTATS_ADD(dma, tx_errors); - - DEBUGFS_FWSTATS_ADD(isr, cmd_cmplt); - DEBUGFS_FWSTATS_ADD(isr, fiqs); - DEBUGFS_FWSTATS_ADD(isr, rx_headers); - DEBUGFS_FWSTATS_ADD(isr, rx_mem_overflow); - DEBUGFS_FWSTATS_ADD(isr, rx_rdys); - DEBUGFS_FWSTATS_ADD(isr, irqs); - DEBUGFS_FWSTATS_ADD(isr, tx_procs); - DEBUGFS_FWSTATS_ADD(isr, decrypt_done); - DEBUGFS_FWSTATS_ADD(isr, dma0_done); - DEBUGFS_FWSTATS_ADD(isr, dma1_done); - DEBUGFS_FWSTATS_ADD(isr, tx_exch_complete); - DEBUGFS_FWSTATS_ADD(isr, commands); - DEBUGFS_FWSTATS_ADD(isr, rx_procs); - DEBUGFS_FWSTATS_ADD(isr, hw_pm_mode_changes); - DEBUGFS_FWSTATS_ADD(isr, host_acknowledges); - DEBUGFS_FWSTATS_ADD(isr, pci_pm); - DEBUGFS_FWSTATS_ADD(isr, wakeups); - DEBUGFS_FWSTATS_ADD(isr, low_rssi); - - DEBUGFS_FWSTATS_ADD(wep, addr_key_count); - DEBUGFS_FWSTATS_ADD(wep, default_key_count); - /* skipping wep.reserved */ - DEBUGFS_FWSTATS_ADD(wep, key_not_found); - DEBUGFS_FWSTATS_ADD(wep, decrypt_fail); - DEBUGFS_FWSTATS_ADD(wep, packets); - DEBUGFS_FWSTATS_ADD(wep, interrupt); - - DEBUGFS_FWSTATS_ADD(pwr, ps_enter); - DEBUGFS_FWSTATS_ADD(pwr, elp_enter); - DEBUGFS_FWSTATS_ADD(pwr, missing_bcns); - DEBUGFS_FWSTATS_ADD(pwr, wake_on_host); - DEBUGFS_FWSTATS_ADD(pwr, wake_on_timer_exp); - DEBUGFS_FWSTATS_ADD(pwr, tx_with_ps); - DEBUGFS_FWSTATS_ADD(pwr, tx_without_ps); - DEBUGFS_FWSTATS_ADD(pwr, rcvd_beacons); - DEBUGFS_FWSTATS_ADD(pwr, power_save_off); - DEBUGFS_FWSTATS_ADD(pwr, enable_ps); - DEBUGFS_FWSTATS_ADD(pwr, disable_ps); - DEBUGFS_FWSTATS_ADD(pwr, fix_tsf_ps); - /* skipping cont_miss_bcns_spread for now */ - DEBUGFS_FWSTATS_ADD(pwr, rcvd_awake_beacons); - - DEBUGFS_FWSTATS_ADD(mic, rx_pkts); - DEBUGFS_FWSTATS_ADD(mic, calc_failure); - - DEBUGFS_FWSTATS_ADD(aes, encrypt_fail); - DEBUGFS_FWSTATS_ADD(aes, decrypt_fail); - DEBUGFS_FWSTATS_ADD(aes, encrypt_packets); - DEBUGFS_FWSTATS_ADD(aes, decrypt_packets); - DEBUGFS_FWSTATS_ADD(aes, encrypt_interrupt); - DEBUGFS_FWSTATS_ADD(aes, decrypt_interrupt); - - DEBUGFS_FWSTATS_ADD(event, heart_beat); - DEBUGFS_FWSTATS_ADD(event, calibration); - DEBUGFS_FWSTATS_ADD(event, rx_mismatch); - DEBUGFS_FWSTATS_ADD(event, rx_mem_empty); - DEBUGFS_FWSTATS_ADD(event, rx_pool); - DEBUGFS_FWSTATS_ADD(event, oom_late); - DEBUGFS_FWSTATS_ADD(event, phy_transmit_error); - DEBUGFS_FWSTATS_ADD(event, tx_stuck); - - DEBUGFS_FWSTATS_ADD(ps, pspoll_timeouts); - DEBUGFS_FWSTATS_ADD(ps, upsd_timeouts); - DEBUGFS_FWSTATS_ADD(ps, upsd_max_sptime); - DEBUGFS_FWSTATS_ADD(ps, upsd_max_apturn); - DEBUGFS_FWSTATS_ADD(ps, pspoll_max_apturn); - DEBUGFS_FWSTATS_ADD(ps, pspoll_utilization); - DEBUGFS_FWSTATS_ADD(ps, upsd_utilization); - - DEBUGFS_FWSTATS_ADD(rxpipe, rx_prep_beacon_drop); - DEBUGFS_FWSTATS_ADD(rxpipe, descr_host_int_trig_rx_data); - DEBUGFS_FWSTATS_ADD(rxpipe, beacon_buffer_thres_host_int_trig_rx_data); - DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data); - DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data); - - DEBUGFS_ADD(tx_queue_len, wl->debugfs.rootdir); - DEBUGFS_ADD(tx_queue_status, wl->debugfs.rootdir); - DEBUGFS_ADD(retry_count, wl->debugfs.rootdir); - DEBUGFS_ADD(excessive_retries, wl->debugfs.rootdir); - -out: - if (ret < 0) - wl1251_debugfs_delete_files(wl); - - return ret; -} - -void wl1251_debugfs_reset(struct wl1251 *wl) -{ - if (wl->stats.fw_stats != NULL) - memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats)); - wl->stats.retry_count = 0; - wl->stats.excessive_retries = 0; -} - -int wl1251_debugfs_init(struct wl1251 *wl) -{ - int ret; - - wl->debugfs.rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL); - - if (IS_ERR(wl->debugfs.rootdir)) { - ret = PTR_ERR(wl->debugfs.rootdir); - wl->debugfs.rootdir = NULL; - goto err; - } - - wl->debugfs.fw_statistics = debugfs_create_dir("fw-statistics", - wl->debugfs.rootdir); - - if (IS_ERR(wl->debugfs.fw_statistics)) { - ret = PTR_ERR(wl->debugfs.fw_statistics); - wl->debugfs.fw_statistics = NULL; - goto err_root; - } - - wl->stats.fw_stats = kzalloc(sizeof(*wl->stats.fw_stats), - GFP_KERNEL); - - if (!wl->stats.fw_stats) { - ret = -ENOMEM; - goto err_fw; - } - - wl->stats.fw_stats_update = jiffies; - - ret = wl1251_debugfs_add_files(wl); - - if (ret < 0) - goto err_file; - - return 0; - -err_file: - kfree(wl->stats.fw_stats); - wl->stats.fw_stats = NULL; - -err_fw: - debugfs_remove(wl->debugfs.fw_statistics); - wl->debugfs.fw_statistics = NULL; - -err_root: - debugfs_remove(wl->debugfs.rootdir); - wl->debugfs.rootdir = NULL; - -err: - return ret; -} - -void wl1251_debugfs_exit(struct wl1251 *wl) -{ - wl1251_debugfs_delete_files(wl); - - kfree(wl->stats.fw_stats); - wl->stats.fw_stats = NULL; - - debugfs_remove(wl->debugfs.fw_statistics); - wl->debugfs.fw_statistics = NULL; - - debugfs_remove(wl->debugfs.rootdir); - wl->debugfs.rootdir = NULL; - -} diff --git a/drivers/net/wireless/ti/wl1251/debugfs.h b/drivers/net/wireless/ti/wl1251/debugfs.h deleted file mode 100644 index b3417c02a218..000000000000 --- a/drivers/net/wireless/ti/wl1251/debugfs.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (C) 2009 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef WL1251_DEBUGFS_H -#define WL1251_DEBUGFS_H - -#include "wl1251.h" - -int wl1251_debugfs_init(struct wl1251 *wl); -void wl1251_debugfs_exit(struct wl1251 *wl); -void wl1251_debugfs_reset(struct wl1251 *wl); - -#endif /* WL1251_DEBUGFS_H */ diff --git a/drivers/net/wireless/ti/wl1251/event.c b/drivers/net/wireless/ti/wl1251/event.c deleted file mode 100644 index 74ae8e1c2e33..000000000000 --- a/drivers/net/wireless/ti/wl1251/event.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (c) 1998-2007 Texas Instruments Incorporated - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "wl1251.h" -#include "reg.h" -#include "io.h" -#include "event.h" -#include "ps.h" - -static int wl1251_event_scan_complete(struct wl1251 *wl, - struct event_mailbox *mbox) -{ - int ret = 0; - - wl1251_debug(DEBUG_EVENT, "status: 0x%x, channels: %d", - mbox->scheduled_scan_status, - mbox->scheduled_scan_channels); - - if (wl->scanning) { - ieee80211_scan_completed(wl->hw, false); - wl1251_debug(DEBUG_MAC80211, "mac80211 hw scan completed"); - wl->scanning = false; - if (wl->hw->conf.flags & IEEE80211_CONF_IDLE) - ret = wl1251_ps_set_mode(wl, STATION_IDLE); - } - - return ret; -} - -static void wl1251_event_mbox_dump(struct event_mailbox *mbox) -{ - wl1251_debug(DEBUG_EVENT, "MBOX DUMP:"); - wl1251_debug(DEBUG_EVENT, "\tvector: 0x%x", mbox->events_vector); - wl1251_debug(DEBUG_EVENT, "\tmask: 0x%x", mbox->events_mask); -} - -static int wl1251_event_process(struct wl1251 *wl, struct event_mailbox *mbox) -{ - int ret; - u32 vector; - - wl1251_event_mbox_dump(mbox); - - vector = mbox->events_vector & ~(mbox->events_mask); - wl1251_debug(DEBUG_EVENT, "vector: 0x%x", vector); - - if (vector & SCAN_COMPLETE_EVENT_ID) { - ret = wl1251_event_scan_complete(wl, mbox); - if (ret < 0) - return ret; - } - - if (vector & BSS_LOSE_EVENT_ID) { - wl1251_debug(DEBUG_EVENT, "BSS_LOSE_EVENT"); - - if (wl->psm_requested && - wl->station_mode != STATION_ACTIVE_MODE) { - ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE); - if (ret < 0) - return ret; - } - } - - if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) { - wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT"); - - /* indicate to the stack, that beacons have been lost */ - ieee80211_beacon_loss(wl->vif); - } - - if (vector & REGAINED_BSS_EVENT_ID) { - if (wl->psm_requested) { - ret = wl1251_ps_set_mode(wl, STATION_POWER_SAVE_MODE); - if (ret < 0) - return ret; - } - } - - if (wl->vif && wl->rssi_thold) { - if (vector & ROAMING_TRIGGER_LOW_RSSI_EVENT_ID) { - wl1251_debug(DEBUG_EVENT, - "ROAMING_TRIGGER_LOW_RSSI_EVENT"); - ieee80211_cqm_rssi_notify(wl->vif, - NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, - GFP_KERNEL); - } - - if (vector & ROAMING_TRIGGER_REGAINED_RSSI_EVENT_ID) { - wl1251_debug(DEBUG_EVENT, - "ROAMING_TRIGGER_REGAINED_RSSI_EVENT"); - ieee80211_cqm_rssi_notify(wl->vif, - NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, - GFP_KERNEL); - } - } - - return 0; -} - -/* - * Poll the mailbox event field until any of the bits in the mask is set or a - * timeout occurs (WL1251_EVENT_TIMEOUT in msecs) - */ -int wl1251_event_wait(struct wl1251 *wl, u32 mask, int timeout_ms) -{ - u32 events_vector, event; - unsigned long timeout; - - timeout = jiffies + msecs_to_jiffies(timeout_ms); - - do { - if (time_after(jiffies, timeout)) - return -ETIMEDOUT; - - msleep(1); - - /* read from both event fields */ - wl1251_mem_read(wl, wl->mbox_ptr[0], &events_vector, - sizeof(events_vector)); - event = events_vector & mask; - wl1251_mem_read(wl, wl->mbox_ptr[1], &events_vector, - sizeof(events_vector)); - event |= events_vector & mask; - } while (!event); - - return 0; -} - -int wl1251_event_unmask(struct wl1251 *wl) -{ - int ret; - - ret = wl1251_acx_event_mbox_mask(wl, ~(wl->event_mask)); - if (ret < 0) - return ret; - - return 0; -} - -void wl1251_event_mbox_config(struct wl1251 *wl) -{ - wl->mbox_ptr[0] = wl1251_reg_read32(wl, REG_EVENT_MAILBOX_PTR); - wl->mbox_ptr[1] = wl->mbox_ptr[0] + sizeof(struct event_mailbox); - - wl1251_debug(DEBUG_EVENT, "MBOX ptrs: 0x%x 0x%x", - wl->mbox_ptr[0], wl->mbox_ptr[1]); -} - -int wl1251_event_handle(struct wl1251 *wl, u8 mbox_num) -{ - struct event_mailbox mbox; - int ret; - - wl1251_debug(DEBUG_EVENT, "EVENT on mbox %d", mbox_num); - - if (mbox_num > 1) - return -EINVAL; - - /* first we read the mbox descriptor */ - wl1251_mem_read(wl, wl->mbox_ptr[mbox_num], &mbox, - sizeof(struct event_mailbox)); - - /* process the descriptor */ - ret = wl1251_event_process(wl, &mbox); - if (ret < 0) - return ret; - - /* then we let the firmware know it can go on...*/ - wl1251_reg_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_EVENT_ACK); - - return 0; -} diff --git a/drivers/net/wireless/ti/wl1251/event.h b/drivers/net/wireless/ti/wl1251/event.h deleted file mode 100644 index 30eb5d150bf7..000000000000 --- a/drivers/net/wireless/ti/wl1251/event.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (c) 1998-2007 Texas Instruments Incorporated - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL1251_EVENT_H__ -#define __WL1251_EVENT_H__ - -/* - * Mbox events - * - * The event mechanism is based on a pair of event buffers (buffers A and - * B) at fixed locations in the target's memory. The host processes one - * buffer while the other buffer continues to collect events. If the host - * is not processing events, an interrupt is issued to signal that a buffer - * is ready. Once the host is done with processing events from one buffer, - * it signals the target (with an ACK interrupt) that the event buffer is - * free. - */ - -enum { - RESERVED1_EVENT_ID = BIT(0), - RESERVED2_EVENT_ID = BIT(1), - MEASUREMENT_START_EVENT_ID = BIT(2), - SCAN_COMPLETE_EVENT_ID = BIT(3), - CALIBRATION_COMPLETE_EVENT_ID = BIT(4), - ROAMING_TRIGGER_LOW_RSSI_EVENT_ID = BIT(5), - PS_REPORT_EVENT_ID = BIT(6), - SYNCHRONIZATION_TIMEOUT_EVENT_ID = BIT(7), - HEALTH_REPORT_EVENT_ID = BIT(8), - ACI_DETECTION_EVENT_ID = BIT(9), - DEBUG_REPORT_EVENT_ID = BIT(10), - MAC_STATUS_EVENT_ID = BIT(11), - DISCONNECT_EVENT_COMPLETE_ID = BIT(12), - JOIN_EVENT_COMPLETE_ID = BIT(13), - CHANNEL_SWITCH_COMPLETE_EVENT_ID = BIT(14), - BSS_LOSE_EVENT_ID = BIT(15), - ROAMING_TRIGGER_MAX_TX_RETRY_EVENT_ID = BIT(16), - MEASUREMENT_COMPLETE_EVENT_ID = BIT(17), - AP_DISCOVERY_COMPLETE_EVENT_ID = BIT(18), - SCHEDULED_SCAN_COMPLETE_EVENT_ID = BIT(19), - PSPOLL_DELIVERY_FAILURE_EVENT_ID = BIT(20), - RESET_BSS_EVENT_ID = BIT(21), - REGAINED_BSS_EVENT_ID = BIT(22), - ROAMING_TRIGGER_REGAINED_RSSI_EVENT_ID = BIT(23), - ROAMING_TRIGGER_LOW_SNR_EVENT_ID = BIT(24), - ROAMING_TRIGGER_REGAINED_SNR_EVENT_ID = BIT(25), - - DBG_EVENT_ID = BIT(26), - BT_PTA_SENSE_EVENT_ID = BIT(27), - BT_PTA_PREDICTION_EVENT_ID = BIT(28), - BT_PTA_AVALANCHE_EVENT_ID = BIT(29), - - PLT_RX_CALIBRATION_COMPLETE_EVENT_ID = BIT(30), - - EVENT_MBOX_ALL_EVENT_ID = 0x7fffffff, -}; - -struct event_debug_report { - u8 debug_event_id; - u8 num_params; - u16 pad; - u32 report_1; - u32 report_2; - u32 report_3; -} __packed; - -struct event_mailbox { - u32 events_vector; - u32 events_mask; - u32 reserved_1; - u32 reserved_2; - - char average_rssi_level; - u8 ps_status; - u8 channel_switch_status; - u8 scheduled_scan_status; - - /* Channels scanned by the scheduled scan */ - u16 scheduled_scan_channels; - - /* If bit 0 is set -> target's fatal error */ - u16 health_report; - u16 bad_fft_counter; - u8 bt_pta_sense_info; - u8 bt_pta_protective_info; - u32 reserved; - u32 debug_report[2]; - - /* Number of FCS errors since last event */ - u32 fcs_err_counter; - - struct event_debug_report report; - u8 average_snr_level; - u8 padding[19]; -} __packed; - -int wl1251_event_unmask(struct wl1251 *wl); -void wl1251_event_mbox_config(struct wl1251 *wl); -int wl1251_event_handle(struct wl1251 *wl, u8 mbox); -int wl1251_event_wait(struct wl1251 *wl, u32 mask, int timeout_ms); - -#endif diff --git a/drivers/net/wireless/ti/wl1251/init.c b/drivers/net/wireless/ti/wl1251/init.c deleted file mode 100644 index 89b43d35473c..000000000000 --- a/drivers/net/wireless/ti/wl1251/init.c +++ /dev/null @@ -1,423 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (C) 2009 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include - -#include "init.h" -#include "wl12xx_80211.h" -#include "acx.h" -#include "cmd.h" -#include "reg.h" - -int wl1251_hw_init_hwenc_config(struct wl1251 *wl) -{ - int ret; - - ret = wl1251_acx_feature_cfg(wl); - if (ret < 0) { - wl1251_warning("couldn't set feature config"); - return ret; - } - - ret = wl1251_acx_default_key(wl, wl->default_key); - if (ret < 0) { - wl1251_warning("couldn't set default key"); - return ret; - } - - return 0; -} - -int wl1251_hw_init_templates_config(struct wl1251 *wl) -{ - int ret; - u8 partial_vbm[PARTIAL_VBM_MAX]; - - /* send empty templates for fw memory reservation */ - ret = wl1251_cmd_template_set(wl, CMD_PROBE_REQ, NULL, - sizeof(struct wl12xx_probe_req_template)); - if (ret < 0) - return ret; - - ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA, NULL, - sizeof(struct wl12xx_null_data_template)); - if (ret < 0) - return ret; - - ret = wl1251_cmd_template_set(wl, CMD_PS_POLL, NULL, - sizeof(struct wl12xx_ps_poll_template)); - if (ret < 0) - return ret; - - ret = wl1251_cmd_template_set(wl, CMD_QOS_NULL_DATA, NULL, - sizeof - (struct wl12xx_qos_null_data_template)); - if (ret < 0) - return ret; - - ret = wl1251_cmd_template_set(wl, CMD_PROBE_RESP, NULL, - sizeof - (struct wl12xx_probe_resp_template)); - if (ret < 0) - return ret; - - ret = wl1251_cmd_template_set(wl, CMD_BEACON, NULL, - sizeof - (struct wl12xx_beacon_template)); - if (ret < 0) - return ret; - - /* tim templates, first reserve space then allocate an empty one */ - memset(partial_vbm, 0, PARTIAL_VBM_MAX); - ret = wl1251_cmd_vbm(wl, TIM_ELE_ID, partial_vbm, PARTIAL_VBM_MAX, 0); - if (ret < 0) - return ret; - - ret = wl1251_cmd_vbm(wl, TIM_ELE_ID, partial_vbm, 1, 0); - if (ret < 0) - return ret; - - return 0; -} - -int wl1251_hw_init_rx_config(struct wl1251 *wl, u32 config, u32 filter) -{ - int ret; - - ret = wl1251_acx_rx_msdu_life_time(wl, RX_MSDU_LIFETIME_DEF); - if (ret < 0) - return ret; - - ret = wl1251_acx_rx_config(wl, config, filter); - if (ret < 0) - return ret; - - return 0; -} - -int wl1251_hw_init_phy_config(struct wl1251 *wl) -{ - int ret; - - ret = wl1251_acx_pd_threshold(wl); - if (ret < 0) - return ret; - - ret = wl1251_acx_slot(wl, DEFAULT_SLOT_TIME); - if (ret < 0) - return ret; - - ret = wl1251_acx_group_address_tbl(wl); - if (ret < 0) - return ret; - - ret = wl1251_acx_service_period_timeout(wl); - if (ret < 0) - return ret; - - ret = wl1251_acx_rts_threshold(wl, RTS_THRESHOLD_DEF); - if (ret < 0) - return ret; - - return 0; -} - -int wl1251_hw_init_beacon_filter(struct wl1251 *wl) -{ - int ret; - - /* disable beacon filtering at this stage */ - ret = wl1251_acx_beacon_filter_opt(wl, false); - if (ret < 0) - return ret; - - ret = wl1251_acx_beacon_filter_table(wl); - if (ret < 0) - return ret; - - return 0; -} - -int wl1251_hw_init_pta(struct wl1251 *wl) -{ - int ret; - - ret = wl1251_acx_sg_enable(wl); - if (ret < 0) - return ret; - - ret = wl1251_acx_sg_cfg(wl); - if (ret < 0) - return ret; - - return 0; -} - -int wl1251_hw_init_energy_detection(struct wl1251 *wl) -{ - int ret; - - ret = wl1251_acx_cca_threshold(wl); - if (ret < 0) - return ret; - - return 0; -} - -int wl1251_hw_init_beacon_broadcast(struct wl1251 *wl) -{ - int ret; - - ret = wl1251_acx_bcn_dtim_options(wl); - if (ret < 0) - return ret; - - return 0; -} - -int wl1251_hw_init_power_auth(struct wl1251 *wl) -{ - return wl1251_acx_sleep_auth(wl, WL1251_PSM_CAM); -} - -int wl1251_hw_init_mem_config(struct wl1251 *wl) -{ - int ret; - - ret = wl1251_acx_mem_cfg(wl); - if (ret < 0) - return ret; - - wl->target_mem_map = kzalloc(sizeof(struct wl1251_acx_mem_map), - GFP_KERNEL); - if (!wl->target_mem_map) { - wl1251_error("couldn't allocate target memory map"); - return -ENOMEM; - } - - /* we now ask for the firmware built memory map */ - ret = wl1251_acx_mem_map(wl, wl->target_mem_map, - sizeof(struct wl1251_acx_mem_map)); - if (ret < 0) { - wl1251_error("couldn't retrieve firmware memory map"); - kfree(wl->target_mem_map); - wl->target_mem_map = NULL; - return ret; - } - - return 0; -} - -static int wl1251_hw_init_txq_fill(u8 qid, - struct acx_tx_queue_qos_config *config, - u32 num_blocks) -{ - config->qid = qid; - - switch (qid) { - case QOS_AC_BE: - config->high_threshold = - (QOS_TX_HIGH_BE_DEF * num_blocks) / 100; - config->low_threshold = - (QOS_TX_LOW_BE_DEF * num_blocks) / 100; - break; - case QOS_AC_BK: - config->high_threshold = - (QOS_TX_HIGH_BK_DEF * num_blocks) / 100; - config->low_threshold = - (QOS_TX_LOW_BK_DEF * num_blocks) / 100; - break; - case QOS_AC_VI: - config->high_threshold = - (QOS_TX_HIGH_VI_DEF * num_blocks) / 100; - config->low_threshold = - (QOS_TX_LOW_VI_DEF * num_blocks) / 100; - break; - case QOS_AC_VO: - config->high_threshold = - (QOS_TX_HIGH_VO_DEF * num_blocks) / 100; - config->low_threshold = - (QOS_TX_LOW_VO_DEF * num_blocks) / 100; - break; - default: - wl1251_error("Invalid TX queue id: %d", qid); - return -EINVAL; - } - - return 0; -} - -static int wl1251_hw_init_tx_queue_config(struct wl1251 *wl) -{ - struct acx_tx_queue_qos_config *config; - struct wl1251_acx_mem_map *wl_mem_map = wl->target_mem_map; - int ret, i; - - wl1251_debug(DEBUG_ACX, "acx tx queue config"); - - config = kzalloc(sizeof(*config), GFP_KERNEL); - if (!config) { - ret = -ENOMEM; - goto out; - } - - for (i = 0; i < MAX_NUM_OF_AC; i++) { - ret = wl1251_hw_init_txq_fill(i, config, - wl_mem_map->num_tx_mem_blocks); - if (ret < 0) - goto out; - - ret = wl1251_cmd_configure(wl, ACX_TX_QUEUE_CFG, - config, sizeof(*config)); - if (ret < 0) - goto out; - } - - wl1251_acx_ac_cfg(wl, AC_BE, CWMIN_BE, CWMAX_BE, AIFS_DIFS, TXOP_BE); - wl1251_acx_ac_cfg(wl, AC_BK, CWMIN_BK, CWMAX_BK, AIFS_DIFS, TXOP_BK); - wl1251_acx_ac_cfg(wl, AC_VI, CWMIN_VI, CWMAX_VI, AIFS_DIFS, TXOP_VI); - wl1251_acx_ac_cfg(wl, AC_VO, CWMIN_VO, CWMAX_VO, AIFS_DIFS, TXOP_VO); - -out: - kfree(config); - return ret; -} - -static int wl1251_hw_init_data_path_config(struct wl1251 *wl) -{ - int ret; - - /* asking for the data path parameters */ - wl->data_path = kzalloc(sizeof(struct acx_data_path_params_resp), - GFP_KERNEL); - if (!wl->data_path) { - wl1251_error("Couldnt allocate data path parameters"); - return -ENOMEM; - } - - ret = wl1251_acx_data_path_params(wl, wl->data_path); - if (ret < 0) { - kfree(wl->data_path); - wl->data_path = NULL; - return ret; - } - - return 0; -} - - -int wl1251_hw_init(struct wl1251 *wl) -{ - struct wl1251_acx_mem_map *wl_mem_map; - int ret; - - ret = wl1251_hw_init_hwenc_config(wl); - if (ret < 0) - return ret; - - /* Template settings */ - ret = wl1251_hw_init_templates_config(wl); - if (ret < 0) - return ret; - - /* Default memory configuration */ - ret = wl1251_hw_init_mem_config(wl); - if (ret < 0) - return ret; - - /* Default data path configuration */ - ret = wl1251_hw_init_data_path_config(wl); - if (ret < 0) - goto out_free_memmap; - - /* RX config */ - ret = wl1251_hw_init_rx_config(wl, - RX_CFG_PROMISCUOUS | RX_CFG_TSF, - RX_FILTER_OPTION_DEF); - /* RX_CONFIG_OPTION_ANY_DST_ANY_BSS, - RX_FILTER_OPTION_FILTER_ALL); */ - if (ret < 0) - goto out_free_data_path; - - /* TX queues config */ - ret = wl1251_hw_init_tx_queue_config(wl); - if (ret < 0) - goto out_free_data_path; - - /* PHY layer config */ - ret = wl1251_hw_init_phy_config(wl); - if (ret < 0) - goto out_free_data_path; - - /* Initialize connection monitoring thresholds */ - ret = wl1251_acx_conn_monit_params(wl); - if (ret < 0) - goto out_free_data_path; - - /* Beacon filtering */ - ret = wl1251_hw_init_beacon_filter(wl); - if (ret < 0) - goto out_free_data_path; - - /* Bluetooth WLAN coexistence */ - ret = wl1251_hw_init_pta(wl); - if (ret < 0) - goto out_free_data_path; - - /* Energy detection */ - ret = wl1251_hw_init_energy_detection(wl); - if (ret < 0) - goto out_free_data_path; - - /* Beacons and boradcast settings */ - ret = wl1251_hw_init_beacon_broadcast(wl); - if (ret < 0) - goto out_free_data_path; - - /* Enable data path */ - ret = wl1251_cmd_data_path(wl, wl->channel, 1); - if (ret < 0) - goto out_free_data_path; - - /* Default power state */ - ret = wl1251_hw_init_power_auth(wl); - if (ret < 0) - goto out_free_data_path; - - wl_mem_map = wl->target_mem_map; - wl1251_info("%d tx blocks at 0x%x, %d rx blocks at 0x%x", - wl_mem_map->num_tx_mem_blocks, - wl->data_path->tx_control_addr, - wl_mem_map->num_rx_mem_blocks, - wl->data_path->rx_control_addr); - - return 0; - - out_free_data_path: - kfree(wl->data_path); - - out_free_memmap: - kfree(wl->target_mem_map); - - return ret; -} diff --git a/drivers/net/wireless/ti/wl1251/init.h b/drivers/net/wireless/ti/wl1251/init.h deleted file mode 100644 index 543f17582ead..000000000000 --- a/drivers/net/wireless/ti/wl1251/init.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (C) 2009 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL1251_INIT_H__ -#define __WL1251_INIT_H__ - -#include "wl1251.h" - -enum { - /* best effort/legacy */ - AC_BE = 0, - - /* background */ - AC_BK = 1, - - /* video */ - AC_VI = 2, - - /* voice */ - AC_VO = 3, - - /* broadcast dummy access category */ - AC_BCAST = 4, - - NUM_ACCESS_CATEGORIES = 4 -}; - -/* following are defult values for the IE fields*/ -#define CWMIN_BK 15 -#define CWMIN_BE 15 -#define CWMIN_VI 7 -#define CWMIN_VO 3 -#define CWMAX_BK 1023 -#define CWMAX_BE 63 -#define CWMAX_VI 15 -#define CWMAX_VO 7 - -/* slot number setting to start transmission at PIFS interval */ -#define AIFS_PIFS 1 - -/* - * slot number setting to start transmission at DIFS interval - normal DCF - * access - */ -#define AIFS_DIFS 2 - -#define AIFSN_BK 7 -#define AIFSN_BE 3 -#define AIFSN_VI AIFS_PIFS -#define AIFSN_VO AIFS_PIFS -#define TXOP_BK 0 -#define TXOP_BE 0 -#define TXOP_VI 3008 -#define TXOP_VO 1504 - -int wl1251_hw_init_hwenc_config(struct wl1251 *wl); -int wl1251_hw_init_templates_config(struct wl1251 *wl); -int wl1251_hw_init_rx_config(struct wl1251 *wl, u32 config, u32 filter); -int wl1251_hw_init_phy_config(struct wl1251 *wl); -int wl1251_hw_init_beacon_filter(struct wl1251 *wl); -int wl1251_hw_init_pta(struct wl1251 *wl); -int wl1251_hw_init_energy_detection(struct wl1251 *wl); -int wl1251_hw_init_beacon_broadcast(struct wl1251 *wl); -int wl1251_hw_init_power_auth(struct wl1251 *wl); -int wl1251_hw_init_mem_config(struct wl1251 *wl); -int wl1251_hw_init(struct wl1251 *wl); - -#endif diff --git a/drivers/net/wireless/ti/wl1251/io.c b/drivers/net/wireless/ti/wl1251/io.c deleted file mode 100644 index cdcadbf6ac2c..000000000000 --- a/drivers/net/wireless/ti/wl1251/io.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "wl1251.h" -#include "reg.h" -#include "io.h" - -/* FIXME: this is static data nowadays and the table can be removed */ -static enum wl12xx_acx_int_reg wl1251_io_reg_table[ACX_REG_TABLE_LEN] = { - [ACX_REG_INTERRUPT_TRIG] = (REGISTERS_BASE + 0x0474), - [ACX_REG_INTERRUPT_TRIG_H] = (REGISTERS_BASE + 0x0478), - [ACX_REG_INTERRUPT_MASK] = (REGISTERS_BASE + 0x0494), - [ACX_REG_HINT_MASK_SET] = (REGISTERS_BASE + 0x0498), - [ACX_REG_HINT_MASK_CLR] = (REGISTERS_BASE + 0x049C), - [ACX_REG_INTERRUPT_NO_CLEAR] = (REGISTERS_BASE + 0x04B0), - [ACX_REG_INTERRUPT_CLEAR] = (REGISTERS_BASE + 0x04A4), - [ACX_REG_INTERRUPT_ACK] = (REGISTERS_BASE + 0x04A8), - [ACX_REG_SLV_SOFT_RESET] = (REGISTERS_BASE + 0x0000), - [ACX_REG_EE_START] = (REGISTERS_BASE + 0x080C), - [ACX_REG_ECPU_CONTROL] = (REGISTERS_BASE + 0x0804) -}; - -static int wl1251_translate_reg_addr(struct wl1251 *wl, int addr) -{ - /* If the address is lower than REGISTERS_BASE, it means that this is - * a chip-specific register address, so look it up in the registers - * table */ - if (addr < REGISTERS_BASE) { - /* Make sure we don't go over the table */ - if (addr >= ACX_REG_TABLE_LEN) { - wl1251_error("address out of range (%d)", addr); - return -EINVAL; - } - addr = wl1251_io_reg_table[addr]; - } - - return addr - wl->physical_reg_addr + wl->virtual_reg_addr; -} - -static int wl1251_translate_mem_addr(struct wl1251 *wl, int addr) -{ - return addr - wl->physical_mem_addr + wl->virtual_mem_addr; -} - -void wl1251_mem_read(struct wl1251 *wl, int addr, void *buf, size_t len) -{ - int physical; - - physical = wl1251_translate_mem_addr(wl, addr); - - wl->if_ops->read(wl, physical, buf, len); -} - -void wl1251_mem_write(struct wl1251 *wl, int addr, void *buf, size_t len) -{ - int physical; - - physical = wl1251_translate_mem_addr(wl, addr); - - wl->if_ops->write(wl, physical, buf, len); -} - -u32 wl1251_mem_read32(struct wl1251 *wl, int addr) -{ - return wl1251_read32(wl, wl1251_translate_mem_addr(wl, addr)); -} - -void wl1251_mem_write32(struct wl1251 *wl, int addr, u32 val) -{ - wl1251_write32(wl, wl1251_translate_mem_addr(wl, addr), val); -} - -u32 wl1251_reg_read32(struct wl1251 *wl, int addr) -{ - return wl1251_read32(wl, wl1251_translate_reg_addr(wl, addr)); -} - -void wl1251_reg_write32(struct wl1251 *wl, int addr, u32 val) -{ - wl1251_write32(wl, wl1251_translate_reg_addr(wl, addr), val); -} - -/* Set the partitions to access the chip addresses. - * - * There are two VIRTUAL partitions (the memory partition and the - * registers partition), which are mapped to two different areas of the - * PHYSICAL (hardware) memory. This function also makes other checks to - * ensure that the partitions are not overlapping. In the diagram below, the - * memory partition comes before the register partition, but the opposite is - * also supported. - * - * PHYSICAL address - * space - * - * | | - * ...+----+--> mem_start - * VIRTUAL address ... | | - * space ... | | [PART_0] - * ... | | - * 0x00000000 <--+----+... ...+----+--> mem_start + mem_size - * | | ... | | - * |MEM | ... | | - * | | ... | | - * part_size <--+----+... | | {unused area) - * | | ... | | - * |REG | ... | | - * part_size | | ... | | - * + <--+----+... ...+----+--> reg_start - * reg_size ... | | - * ... | | [PART_1] - * ... | | - * ...+----+--> reg_start + reg_size - * | | - * - */ -void wl1251_set_partition(struct wl1251 *wl, - u32 mem_start, u32 mem_size, - u32 reg_start, u32 reg_size) -{ - struct wl1251_partition partition[2]; - - wl1251_debug(DEBUG_SPI, "mem_start %08X mem_size %08X", - mem_start, mem_size); - wl1251_debug(DEBUG_SPI, "reg_start %08X reg_size %08X", - reg_start, reg_size); - - /* Make sure that the two partitions together don't exceed the - * address range */ - if ((mem_size + reg_size) > HW_ACCESS_MEMORY_MAX_RANGE) { - wl1251_debug(DEBUG_SPI, "Total size exceeds maximum virtual" - " address range. Truncating partition[0]."); - mem_size = HW_ACCESS_MEMORY_MAX_RANGE - reg_size; - wl1251_debug(DEBUG_SPI, "mem_start %08X mem_size %08X", - mem_start, mem_size); - wl1251_debug(DEBUG_SPI, "reg_start %08X reg_size %08X", - reg_start, reg_size); - } - - if ((mem_start < reg_start) && - ((mem_start + mem_size) > reg_start)) { - /* Guarantee that the memory partition doesn't overlap the - * registers partition */ - wl1251_debug(DEBUG_SPI, "End of partition[0] is " - "overlapping partition[1]. Adjusted."); - mem_size = reg_start - mem_start; - wl1251_debug(DEBUG_SPI, "mem_start %08X mem_size %08X", - mem_start, mem_size); - wl1251_debug(DEBUG_SPI, "reg_start %08X reg_size %08X", - reg_start, reg_size); - } else if ((reg_start < mem_start) && - ((reg_start + reg_size) > mem_start)) { - /* Guarantee that the register partition doesn't overlap the - * memory partition */ - wl1251_debug(DEBUG_SPI, "End of partition[1] is" - " overlapping partition[0]. Adjusted."); - reg_size = mem_start - reg_start; - wl1251_debug(DEBUG_SPI, "mem_start %08X mem_size %08X", - mem_start, mem_size); - wl1251_debug(DEBUG_SPI, "reg_start %08X reg_size %08X", - reg_start, reg_size); - } - - partition[0].start = mem_start; - partition[0].size = mem_size; - partition[1].start = reg_start; - partition[1].size = reg_size; - - wl->physical_mem_addr = mem_start; - wl->physical_reg_addr = reg_start; - - wl->virtual_mem_addr = 0; - wl->virtual_reg_addr = mem_size; - - wl->if_ops->write(wl, HW_ACCESS_PART0_SIZE_ADDR, partition, - sizeof(partition)); -} diff --git a/drivers/net/wireless/ti/wl1251/io.h b/drivers/net/wireless/ti/wl1251/io.h deleted file mode 100644 index d382877c34cc..000000000000 --- a/drivers/net/wireless/ti/wl1251/io.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ -#ifndef __WL1251_IO_H__ -#define __WL1251_IO_H__ - -#include "wl1251.h" - -#define HW_ACCESS_MEMORY_MAX_RANGE 0x1FFC0 - -#define HW_ACCESS_PART0_SIZE_ADDR 0x1FFC0 -#define HW_ACCESS_PART0_START_ADDR 0x1FFC4 -#define HW_ACCESS_PART1_SIZE_ADDR 0x1FFC8 -#define HW_ACCESS_PART1_START_ADDR 0x1FFCC - -#define HW_ACCESS_REGISTER_SIZE 4 - -#define HW_ACCESS_PRAM_MAX_RANGE 0x3c000 - -static inline u32 wl1251_read32(struct wl1251 *wl, int addr) -{ - wl->if_ops->read(wl, addr, &wl->buffer_32, sizeof(wl->buffer_32)); - - return le32_to_cpu(wl->buffer_32); -} - -static inline void wl1251_write32(struct wl1251 *wl, int addr, u32 val) -{ - wl->buffer_32 = cpu_to_le32(val); - wl->if_ops->write(wl, addr, &wl->buffer_32, sizeof(wl->buffer_32)); -} - -static inline u32 wl1251_read_elp(struct wl1251 *wl, int addr) -{ - u32 response; - - if (wl->if_ops->read_elp) - wl->if_ops->read_elp(wl, addr, &response); - else - wl->if_ops->read(wl, addr, &response, sizeof(u32)); - - return response; -} - -static inline void wl1251_write_elp(struct wl1251 *wl, int addr, u32 val) -{ - if (wl->if_ops->write_elp) - wl->if_ops->write_elp(wl, addr, val); - else - wl->if_ops->write(wl, addr, &val, sizeof(u32)); -} - -/* Memory target IO, address is translated to partition 0 */ -void wl1251_mem_read(struct wl1251 *wl, int addr, void *buf, size_t len); -void wl1251_mem_write(struct wl1251 *wl, int addr, void *buf, size_t len); -u32 wl1251_mem_read32(struct wl1251 *wl, int addr); -void wl1251_mem_write32(struct wl1251 *wl, int addr, u32 val); -/* Registers IO */ -u32 wl1251_reg_read32(struct wl1251 *wl, int addr); -void wl1251_reg_write32(struct wl1251 *wl, int addr, u32 val); - -void wl1251_set_partition(struct wl1251 *wl, - u32 part_start, u32 part_size, - u32 reg_start, u32 reg_size); - -#endif diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c deleted file mode 100644 index 3291ffa95273..000000000000 --- a/drivers/net/wireless/ti/wl1251/main.c +++ /dev/null @@ -1,1480 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (C) 2008-2009 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wl1251.h" -#include "wl12xx_80211.h" -#include "reg.h" -#include "io.h" -#include "cmd.h" -#include "event.h" -#include "tx.h" -#include "rx.h" -#include "ps.h" -#include "init.h" -#include "debugfs.h" -#include "boot.h" - -void wl1251_enable_interrupts(struct wl1251 *wl) -{ - wl->if_ops->enable_irq(wl); -} - -void wl1251_disable_interrupts(struct wl1251 *wl) -{ - wl->if_ops->disable_irq(wl); -} - -static int wl1251_power_off(struct wl1251 *wl) -{ - return wl->if_ops->power(wl, false); -} - -static int wl1251_power_on(struct wl1251 *wl) -{ - return wl->if_ops->power(wl, true); -} - -static int wl1251_fetch_firmware(struct wl1251 *wl) -{ - const struct firmware *fw; - struct device *dev = wiphy_dev(wl->hw->wiphy); - int ret; - - ret = request_firmware(&fw, WL1251_FW_NAME, dev); - - if (ret < 0) { - wl1251_error("could not get firmware: %d", ret); - return ret; - } - - if (fw->size % 4) { - wl1251_error("firmware size is not multiple of 32 bits: %zu", - fw->size); - ret = -EILSEQ; - goto out; - } - - wl->fw_len = fw->size; - wl->fw = vmalloc(wl->fw_len); - - if (!wl->fw) { - wl1251_error("could not allocate memory for the firmware"); - ret = -ENOMEM; - goto out; - } - - memcpy(wl->fw, fw->data, wl->fw_len); - - ret = 0; - -out: - release_firmware(fw); - - return ret; -} - -static int wl1251_fetch_nvs(struct wl1251 *wl) -{ - const struct firmware *fw; - struct device *dev = wiphy_dev(wl->hw->wiphy); - int ret; - - ret = request_firmware(&fw, WL1251_NVS_NAME, dev); - - if (ret < 0) { - wl1251_error("could not get nvs file: %d", ret); - return ret; - } - - if (fw->size % 4) { - wl1251_error("nvs size is not multiple of 32 bits: %zu", - fw->size); - ret = -EILSEQ; - goto out; - } - - wl->nvs_len = fw->size; - wl->nvs = kmemdup(fw->data, wl->nvs_len, GFP_KERNEL); - - if (!wl->nvs) { - wl1251_error("could not allocate memory for the nvs file"); - ret = -ENOMEM; - goto out; - } - - ret = 0; - -out: - release_firmware(fw); - - return ret; -} - -static void wl1251_fw_wakeup(struct wl1251 *wl) -{ - u32 elp_reg; - - elp_reg = ELPCTRL_WAKE_UP; - wl1251_write_elp(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, elp_reg); - elp_reg = wl1251_read_elp(wl, HW_ACCESS_ELP_CTRL_REG_ADDR); - - if (!(elp_reg & ELPCTRL_WLAN_READY)) - wl1251_warning("WLAN not ready"); -} - -static int wl1251_chip_wakeup(struct wl1251 *wl) -{ - int ret; - - ret = wl1251_power_on(wl); - if (ret < 0) - return ret; - - msleep(WL1251_POWER_ON_SLEEP); - wl->if_ops->reset(wl); - - /* We don't need a real memory partition here, because we only want - * to use the registers at this point. */ - wl1251_set_partition(wl, - 0x00000000, - 0x00000000, - REGISTERS_BASE, - REGISTERS_DOWN_SIZE); - - /* ELP module wake up */ - wl1251_fw_wakeup(wl); - - /* whal_FwCtrl_BootSm() */ - - /* 0. read chip id from CHIP_ID */ - wl->chip_id = wl1251_reg_read32(wl, CHIP_ID_B); - - /* 1. check if chip id is valid */ - - switch (wl->chip_id) { - case CHIP_ID_1251_PG12: - wl1251_debug(DEBUG_BOOT, "chip id 0x%x (1251 PG12)", - wl->chip_id); - break; - case CHIP_ID_1251_PG11: - wl1251_debug(DEBUG_BOOT, "chip id 0x%x (1251 PG11)", - wl->chip_id); - break; - case CHIP_ID_1251_PG10: - default: - wl1251_error("unsupported chip id: 0x%x", wl->chip_id); - ret = -ENODEV; - goto out; - } - - if (wl->fw == NULL) { - ret = wl1251_fetch_firmware(wl); - if (ret < 0) - goto out; - } - - if (wl->nvs == NULL && !wl->use_eeprom) { - /* No NVS from netlink, try to get it from the filesystem */ - ret = wl1251_fetch_nvs(wl); - if (ret < 0) - goto out; - } - -out: - return ret; -} - -#define WL1251_IRQ_LOOP_COUNT 10 -static void wl1251_irq_work(struct work_struct *work) -{ - u32 intr, ctr = WL1251_IRQ_LOOP_COUNT; - struct wl1251 *wl = - container_of(work, struct wl1251, irq_work); - int ret; - - mutex_lock(&wl->mutex); - - wl1251_debug(DEBUG_IRQ, "IRQ work"); - - if (wl->state == WL1251_STATE_OFF) - goto out; - - ret = wl1251_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - wl1251_reg_write32(wl, ACX_REG_INTERRUPT_MASK, WL1251_ACX_INTR_ALL); - - intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_CLEAR); - wl1251_debug(DEBUG_IRQ, "intr: 0x%x", intr); - - do { - if (wl->data_path) { - wl->rx_counter = wl1251_mem_read32( - wl, wl->data_path->rx_control_addr); - - /* We handle a frmware bug here */ - switch ((wl->rx_counter - wl->rx_handled) & 0xf) { - case 0: - wl1251_debug(DEBUG_IRQ, - "RX: FW and host in sync"); - intr &= ~WL1251_ACX_INTR_RX0_DATA; - intr &= ~WL1251_ACX_INTR_RX1_DATA; - break; - case 1: - wl1251_debug(DEBUG_IRQ, "RX: FW +1"); - intr |= WL1251_ACX_INTR_RX0_DATA; - intr &= ~WL1251_ACX_INTR_RX1_DATA; - break; - case 2: - wl1251_debug(DEBUG_IRQ, "RX: FW +2"); - intr |= WL1251_ACX_INTR_RX0_DATA; - intr |= WL1251_ACX_INTR_RX1_DATA; - break; - default: - wl1251_warning( - "RX: FW and host out of sync: %d", - wl->rx_counter - wl->rx_handled); - break; - } - - wl->rx_handled = wl->rx_counter; - - wl1251_debug(DEBUG_IRQ, "RX counter: %d", - wl->rx_counter); - } - - intr &= wl->intr_mask; - - if (intr == 0) { - wl1251_debug(DEBUG_IRQ, "INTR is 0"); - goto out_sleep; - } - - if (intr & WL1251_ACX_INTR_RX0_DATA) { - wl1251_debug(DEBUG_IRQ, "WL1251_ACX_INTR_RX0_DATA"); - wl1251_rx(wl); - } - - if (intr & WL1251_ACX_INTR_RX1_DATA) { - wl1251_debug(DEBUG_IRQ, "WL1251_ACX_INTR_RX1_DATA"); - wl1251_rx(wl); - } - - if (intr & WL1251_ACX_INTR_TX_RESULT) { - wl1251_debug(DEBUG_IRQ, "WL1251_ACX_INTR_TX_RESULT"); - wl1251_tx_complete(wl); - } - - if (intr & WL1251_ACX_INTR_EVENT_A) { - wl1251_debug(DEBUG_IRQ, "WL1251_ACX_INTR_EVENT_A"); - wl1251_event_handle(wl, 0); - } - - if (intr & WL1251_ACX_INTR_EVENT_B) { - wl1251_debug(DEBUG_IRQ, "WL1251_ACX_INTR_EVENT_B"); - wl1251_event_handle(wl, 1); - } - - if (intr & WL1251_ACX_INTR_INIT_COMPLETE) - wl1251_debug(DEBUG_IRQ, - "WL1251_ACX_INTR_INIT_COMPLETE"); - - if (--ctr == 0) - break; - - intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_CLEAR); - } while (intr); - -out_sleep: - wl1251_reg_write32(wl, ACX_REG_INTERRUPT_MASK, ~(wl->intr_mask)); - wl1251_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); -} - -static int wl1251_join(struct wl1251 *wl, u8 bss_type, u8 channel, - u16 beacon_interval, u8 dtim_period) -{ - int ret; - - ret = wl1251_acx_frame_rates(wl, DEFAULT_HW_GEN_TX_RATE, - DEFAULT_HW_GEN_MODULATION_TYPE, - wl->tx_mgmt_frm_rate, - wl->tx_mgmt_frm_mod); - if (ret < 0) - goto out; - - /* - * Join command applies filters, and if we are not associated, - * BSSID filter must be disabled for association to work. - */ - if (is_zero_ether_addr(wl->bssid)) - wl->rx_config &= ~CFG_BSSID_FILTER_EN; - - ret = wl1251_cmd_join(wl, bss_type, channel, beacon_interval, - dtim_period); - if (ret < 0) - goto out; - - ret = wl1251_event_wait(wl, JOIN_EVENT_COMPLETE_ID, 100); - if (ret < 0) - wl1251_warning("join timeout"); - -out: - return ret; -} - -static void wl1251_op_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct wl1251 *wl = hw->priv; - unsigned long flags; - - skb_queue_tail(&wl->tx_queue, skb); - - /* - * The chip specific setup must run before the first TX packet - - * before that, the tx_work will not be initialized! - */ - - ieee80211_queue_work(wl->hw, &wl->tx_work); - - /* - * The workqueue is slow to process the tx_queue and we need stop - * the queue here, otherwise the queue will get too long. - */ - if (skb_queue_len(&wl->tx_queue) >= WL1251_TX_QUEUE_HIGH_WATERMARK) { - wl1251_debug(DEBUG_TX, "op_tx: tx_queue full, stop queues"); - - spin_lock_irqsave(&wl->wl_lock, flags); - ieee80211_stop_queues(wl->hw); - wl->tx_queue_stopped = true; - spin_unlock_irqrestore(&wl->wl_lock, flags); - } -} - -static int wl1251_op_start(struct ieee80211_hw *hw) -{ - struct wl1251 *wl = hw->priv; - struct wiphy *wiphy = hw->wiphy; - int ret = 0; - - wl1251_debug(DEBUG_MAC80211, "mac80211 start"); - - mutex_lock(&wl->mutex); - - if (wl->state != WL1251_STATE_OFF) { - wl1251_error("cannot start because not in off state: %d", - wl->state); - ret = -EBUSY; - goto out; - } - - ret = wl1251_chip_wakeup(wl); - if (ret < 0) - goto out; - - ret = wl1251_boot(wl); - if (ret < 0) - goto out; - - ret = wl1251_hw_init(wl); - if (ret < 0) - goto out; - - ret = wl1251_acx_station_id(wl); - if (ret < 0) - goto out; - - wl->state = WL1251_STATE_ON; - - wl1251_info("firmware booted (%s)", wl->fw_ver); - - /* update hw/fw version info in wiphy struct */ - wiphy->hw_version = wl->chip_id; - strncpy(wiphy->fw_version, wl->fw_ver, sizeof(wiphy->fw_version)); - -out: - if (ret < 0) - wl1251_power_off(wl); - - mutex_unlock(&wl->mutex); - - return ret; -} - -static void wl1251_op_stop(struct ieee80211_hw *hw) -{ - struct wl1251 *wl = hw->priv; - - wl1251_info("down"); - - wl1251_debug(DEBUG_MAC80211, "mac80211 stop"); - - mutex_lock(&wl->mutex); - - WARN_ON(wl->state != WL1251_STATE_ON); - - if (wl->scanning) { - ieee80211_scan_completed(wl->hw, true); - wl->scanning = false; - } - - wl->state = WL1251_STATE_OFF; - - wl1251_disable_interrupts(wl); - - mutex_unlock(&wl->mutex); - - cancel_work_sync(&wl->irq_work); - cancel_work_sync(&wl->tx_work); - cancel_delayed_work_sync(&wl->elp_work); - - mutex_lock(&wl->mutex); - - /* let's notify MAC80211 about the remaining pending TX frames */ - wl1251_tx_flush(wl); - wl1251_power_off(wl); - - memset(wl->bssid, 0, ETH_ALEN); - wl->listen_int = 1; - wl->bss_type = MAX_BSS_TYPE; - - wl->data_in_count = 0; - wl->rx_counter = 0; - wl->rx_handled = 0; - wl->rx_current_buffer = 0; - wl->rx_last_id = 0; - wl->next_tx_complete = 0; - wl->elp = false; - wl->station_mode = STATION_ACTIVE_MODE; - wl->tx_queue_stopped = false; - wl->power_level = WL1251_DEFAULT_POWER_LEVEL; - wl->rssi_thold = 0; - wl->channel = WL1251_DEFAULT_CHANNEL; - - wl1251_debugfs_reset(wl); - - mutex_unlock(&wl->mutex); -} - -static int wl1251_op_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct wl1251 *wl = hw->priv; - int ret = 0; - - vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | - IEEE80211_VIF_SUPPORTS_CQM_RSSI; - - wl1251_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM", - vif->type, vif->addr); - - mutex_lock(&wl->mutex); - if (wl->vif) { - ret = -EBUSY; - goto out; - } - - wl->vif = vif; - - switch (vif->type) { - case NL80211_IFTYPE_STATION: - wl->bss_type = BSS_TYPE_STA_BSS; - break; - case NL80211_IFTYPE_ADHOC: - wl->bss_type = BSS_TYPE_IBSS; - break; - default: - ret = -EOPNOTSUPP; - goto out; - } - - if (memcmp(wl->mac_addr, vif->addr, ETH_ALEN)) { - memcpy(wl->mac_addr, vif->addr, ETH_ALEN); - SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr); - ret = wl1251_acx_station_id(wl); - if (ret < 0) - goto out; - } - -out: - mutex_unlock(&wl->mutex); - return ret; -} - -static void wl1251_op_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct wl1251 *wl = hw->priv; - - mutex_lock(&wl->mutex); - wl1251_debug(DEBUG_MAC80211, "mac80211 remove interface"); - wl->vif = NULL; - mutex_unlock(&wl->mutex); -} - -static int wl1251_build_qos_null_data(struct wl1251 *wl) -{ - struct ieee80211_qos_hdr template; - - memset(&template, 0, sizeof(template)); - - memcpy(template.addr1, wl->bssid, ETH_ALEN); - memcpy(template.addr2, wl->mac_addr, ETH_ALEN); - memcpy(template.addr3, wl->bssid, ETH_ALEN); - - template.frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA | - IEEE80211_STYPE_QOS_NULLFUNC | - IEEE80211_FCTL_TODS); - - /* FIXME: not sure what priority to use here */ - template.qos_ctrl = cpu_to_le16(0); - - return wl1251_cmd_template_set(wl, CMD_QOS_NULL_DATA, &template, - sizeof(template)); -} - -static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed) -{ - struct wl1251 *wl = hw->priv; - struct ieee80211_conf *conf = &hw->conf; - int channel, ret = 0; - - channel = ieee80211_frequency_to_channel( - conf->chandef.chan->center_freq); - - wl1251_debug(DEBUG_MAC80211, "mac80211 config ch %d psm %s power %d", - channel, - conf->flags & IEEE80211_CONF_PS ? "on" : "off", - conf->power_level); - - mutex_lock(&wl->mutex); - - ret = wl1251_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - if (channel != wl->channel) { - wl->channel = channel; - - ret = wl1251_join(wl, wl->bss_type, wl->channel, - wl->beacon_int, wl->dtim_period); - if (ret < 0) - goto out_sleep; - } - - if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested) { - wl1251_debug(DEBUG_PSM, "psm enabled"); - - wl->psm_requested = true; - - wl->dtim_period = conf->ps_dtim_period; - - ret = wl1251_acx_wr_tbtt_and_dtim(wl, wl->beacon_int, - wl->dtim_period); - - /* - * mac80211 enables PSM only if we're already associated. - */ - ret = wl1251_ps_set_mode(wl, STATION_POWER_SAVE_MODE); - if (ret < 0) - goto out_sleep; - } else if (!(conf->flags & IEEE80211_CONF_PS) && - wl->psm_requested) { - wl1251_debug(DEBUG_PSM, "psm disabled"); - - wl->psm_requested = false; - - if (wl->station_mode != STATION_ACTIVE_MODE) { - ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE); - if (ret < 0) - goto out_sleep; - } - } - - if (changed & IEEE80211_CONF_CHANGE_IDLE && !wl->scanning) { - if (conf->flags & IEEE80211_CONF_IDLE) { - ret = wl1251_ps_set_mode(wl, STATION_IDLE); - if (ret < 0) - goto out_sleep; - } else { - ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE); - if (ret < 0) - goto out_sleep; - ret = wl1251_join(wl, wl->bss_type, wl->channel, - wl->beacon_int, wl->dtim_period); - if (ret < 0) - goto out_sleep; - } - } - - if (conf->power_level != wl->power_level) { - ret = wl1251_acx_tx_power(wl, conf->power_level); - if (ret < 0) - goto out_sleep; - - wl->power_level = conf->power_level; - } - -out_sleep: - wl1251_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -#define WL1251_SUPPORTED_FILTERS (FIF_PROMISC_IN_BSS | \ - FIF_ALLMULTI | \ - FIF_FCSFAIL | \ - FIF_BCN_PRBRESP_PROMISC | \ - FIF_CONTROL | \ - FIF_OTHER_BSS | \ - FIF_PROBE_REQ) - -static void wl1251_op_configure_filter(struct ieee80211_hw *hw, - unsigned int changed, - unsigned int *total,u64 multicast) -{ - struct wl1251 *wl = hw->priv; - int ret; - - wl1251_debug(DEBUG_MAC80211, "mac80211 configure filter"); - - *total &= WL1251_SUPPORTED_FILTERS; - changed &= WL1251_SUPPORTED_FILTERS; - - if (changed == 0) - /* no filters which we support changed */ - return; - - mutex_lock(&wl->mutex); - - wl->rx_config = WL1251_DEFAULT_RX_CONFIG; - wl->rx_filter = WL1251_DEFAULT_RX_FILTER; - - if (*total & FIF_PROMISC_IN_BSS) { - wl->rx_config |= CFG_BSSID_FILTER_EN; - wl->rx_config |= CFG_RX_ALL_GOOD; - } - if (*total & FIF_ALLMULTI) - /* - * CFG_MC_FILTER_EN in rx_config needs to be 0 to receive - * all multicast frames - */ - wl->rx_config &= ~CFG_MC_FILTER_EN; - if (*total & FIF_FCSFAIL) - wl->rx_filter |= CFG_RX_FCS_ERROR; - if (*total & FIF_BCN_PRBRESP_PROMISC) { - wl->rx_config &= ~CFG_BSSID_FILTER_EN; - wl->rx_config &= ~CFG_SSID_FILTER_EN; - } - if (*total & FIF_CONTROL) - wl->rx_filter |= CFG_RX_CTL_EN; - if (*total & FIF_OTHER_BSS || is_zero_ether_addr(wl->bssid)) - wl->rx_config &= ~CFG_BSSID_FILTER_EN; - if (*total & FIF_PROBE_REQ) - wl->rx_filter |= CFG_RX_PREQ_EN; - - if (wl->state == WL1251_STATE_OFF) - goto out; - - ret = wl1251_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - /* send filters to firmware */ - wl1251_acx_rx_config(wl, wl->rx_config, wl->rx_filter); - - wl1251_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); -} - -/* HW encryption */ -static int wl1251_set_key_type(struct wl1251 *wl, - struct wl1251_cmd_set_keys *key, - enum set_key_cmd cmd, - struct ieee80211_key_conf *mac80211_key, - const u8 *addr) -{ - switch (mac80211_key->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - if (is_broadcast_ether_addr(addr)) - key->key_type = KEY_WEP_DEFAULT; - else - key->key_type = KEY_WEP_ADDR; - - mac80211_key->hw_key_idx = mac80211_key->keyidx; - break; - case WLAN_CIPHER_SUITE_TKIP: - if (is_broadcast_ether_addr(addr)) - key->key_type = KEY_TKIP_MIC_GROUP; - else - key->key_type = KEY_TKIP_MIC_PAIRWISE; - - mac80211_key->hw_key_idx = mac80211_key->keyidx; - break; - case WLAN_CIPHER_SUITE_CCMP: - if (is_broadcast_ether_addr(addr)) - key->key_type = KEY_AES_GROUP; - else - key->key_type = KEY_AES_PAIRWISE; - mac80211_key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; - break; - default: - wl1251_error("Unknown key cipher 0x%x", mac80211_key->cipher); - return -EOPNOTSUPP; - } - - return 0; -} - -static int wl1251_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - struct wl1251 *wl = hw->priv; - struct wl1251_cmd_set_keys *wl_cmd; - const u8 *addr; - int ret; - - static const u8 bcast_addr[ETH_ALEN] = - { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - - wl1251_debug(DEBUG_MAC80211, "mac80211 set key"); - - wl_cmd = kzalloc(sizeof(*wl_cmd), GFP_KERNEL); - if (!wl_cmd) { - ret = -ENOMEM; - goto out; - } - - addr = sta ? sta->addr : bcast_addr; - - wl1251_debug(DEBUG_CRYPT, "CMD: 0x%x", cmd); - wl1251_dump(DEBUG_CRYPT, "ADDR: ", addr, ETH_ALEN); - wl1251_debug(DEBUG_CRYPT, "Key: algo:0x%x, id:%d, len:%d flags 0x%x", - key->cipher, key->keyidx, key->keylen, key->flags); - wl1251_dump(DEBUG_CRYPT, "KEY: ", key->key, key->keylen); - - if (is_zero_ether_addr(addr)) { - /* We dont support TX only encryption */ - ret = -EOPNOTSUPP; - goto out; - } - - mutex_lock(&wl->mutex); - - ret = wl1251_ps_elp_wakeup(wl); - if (ret < 0) - goto out_unlock; - - switch (cmd) { - case SET_KEY: - wl_cmd->key_action = KEY_ADD_OR_REPLACE; - break; - case DISABLE_KEY: - wl_cmd->key_action = KEY_REMOVE; - break; - default: - wl1251_error("Unsupported key cmd 0x%x", cmd); - break; - } - - ret = wl1251_set_key_type(wl, wl_cmd, cmd, key, addr); - if (ret < 0) { - wl1251_error("Set KEY type failed"); - goto out_sleep; - } - - if (wl_cmd->key_type != KEY_WEP_DEFAULT) - memcpy(wl_cmd->addr, addr, ETH_ALEN); - - if ((wl_cmd->key_type == KEY_TKIP_MIC_GROUP) || - (wl_cmd->key_type == KEY_TKIP_MIC_PAIRWISE)) { - /* - * We get the key in the following form: - * TKIP (16 bytes) - TX MIC (8 bytes) - RX MIC (8 bytes) - * but the target is expecting: - * TKIP - RX MIC - TX MIC - */ - memcpy(wl_cmd->key, key->key, 16); - memcpy(wl_cmd->key + 16, key->key + 24, 8); - memcpy(wl_cmd->key + 24, key->key + 16, 8); - - } else { - memcpy(wl_cmd->key, key->key, key->keylen); - } - wl_cmd->key_size = key->keylen; - - wl_cmd->id = key->keyidx; - wl_cmd->ssid_profile = 0; - - wl1251_dump(DEBUG_CRYPT, "TARGET KEY: ", wl_cmd, sizeof(*wl_cmd)); - - ret = wl1251_cmd_send(wl, CMD_SET_KEYS, wl_cmd, sizeof(*wl_cmd)); - if (ret < 0) { - wl1251_warning("could not set keys"); - goto out_sleep; - } - -out_sleep: - wl1251_ps_elp_sleep(wl); - -out_unlock: - mutex_unlock(&wl->mutex); - -out: - kfree(wl_cmd); - - return ret; -} - -static int wl1251_op_hw_scan(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct cfg80211_scan_request *req) -{ - struct wl1251 *wl = hw->priv; - struct sk_buff *skb; - size_t ssid_len = 0; - u8 *ssid = NULL; - int ret; - - wl1251_debug(DEBUG_MAC80211, "mac80211 hw scan"); - - if (req->n_ssids) { - ssid = req->ssids[0].ssid; - ssid_len = req->ssids[0].ssid_len; - } - - mutex_lock(&wl->mutex); - - if (wl->scanning) { - wl1251_debug(DEBUG_SCAN, "scan already in progress"); - ret = -EINVAL; - goto out; - } - - ret = wl1251_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - if (hw->conf.flags & IEEE80211_CONF_IDLE) { - ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE); - if (ret < 0) - goto out_sleep; - ret = wl1251_join(wl, wl->bss_type, wl->channel, - wl->beacon_int, wl->dtim_period); - if (ret < 0) - goto out_sleep; - } - - skb = ieee80211_probereq_get(wl->hw, wl->vif, ssid, ssid_len, - req->ie_len); - if (!skb) { - ret = -ENOMEM; - goto out_idle; - } - if (req->ie_len) - memcpy(skb_put(skb, req->ie_len), req->ie, req->ie_len); - - ret = wl1251_cmd_template_set(wl, CMD_PROBE_REQ, skb->data, - skb->len); - dev_kfree_skb(skb); - if (ret < 0) - goto out_idle; - - ret = wl1251_cmd_trigger_scan_to(wl, 0); - if (ret < 0) - goto out_idle; - - wl->scanning = true; - - ret = wl1251_cmd_scan(wl, ssid, ssid_len, req->channels, - req->n_channels, WL1251_SCAN_NUM_PROBES); - if (ret < 0) { - wl->scanning = false; - goto out_idle; - } - goto out_sleep; - -out_idle: - if (hw->conf.flags & IEEE80211_CONF_IDLE) - ret = wl1251_ps_set_mode(wl, STATION_IDLE); -out_sleep: - wl1251_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -static int wl1251_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value) -{ - struct wl1251 *wl = hw->priv; - int ret; - - mutex_lock(&wl->mutex); - - ret = wl1251_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = wl1251_acx_rts_threshold(wl, (u16) value); - if (ret < 0) - wl1251_warning("wl1251_op_set_rts_threshold failed: %d", ret); - - wl1251_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changed) -{ - struct wl1251 *wl = hw->priv; - struct sk_buff *beacon, *skb; - int ret; - - wl1251_debug(DEBUG_MAC80211, "mac80211 bss info changed"); - - mutex_lock(&wl->mutex); - - ret = wl1251_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - if (changed & BSS_CHANGED_CQM) { - ret = wl1251_acx_low_rssi(wl, bss_conf->cqm_rssi_thold, - WL1251_DEFAULT_LOW_RSSI_WEIGHT, - WL1251_DEFAULT_LOW_RSSI_DEPTH, - WL1251_ACX_LOW_RSSI_TYPE_EDGE); - if (ret < 0) - goto out; - wl->rssi_thold = bss_conf->cqm_rssi_thold; - } - - if (changed & BSS_CHANGED_BSSID) { - memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); - - skb = ieee80211_nullfunc_get(wl->hw, wl->vif); - if (!skb) - goto out_sleep; - - ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA, - skb->data, skb->len); - dev_kfree_skb(skb); - if (ret < 0) - goto out_sleep; - - ret = wl1251_build_qos_null_data(wl); - if (ret < 0) - goto out; - - if (wl->bss_type != BSS_TYPE_IBSS) { - ret = wl1251_join(wl, wl->bss_type, wl->channel, - wl->beacon_int, wl->dtim_period); - if (ret < 0) - goto out_sleep; - } - } - - if (changed & BSS_CHANGED_ASSOC) { - if (bss_conf->assoc) { - wl->beacon_int = bss_conf->beacon_int; - - skb = ieee80211_pspoll_get(wl->hw, wl->vif); - if (!skb) - goto out_sleep; - - ret = wl1251_cmd_template_set(wl, CMD_PS_POLL, - skb->data, - skb->len); - dev_kfree_skb(skb); - if (ret < 0) - goto out_sleep; - - ret = wl1251_acx_aid(wl, bss_conf->aid); - if (ret < 0) - goto out_sleep; - } else { - /* use defaults when not associated */ - wl->beacon_int = WL1251_DEFAULT_BEACON_INT; - wl->dtim_period = WL1251_DEFAULT_DTIM_PERIOD; - } - } - if (changed & BSS_CHANGED_ERP_SLOT) { - if (bss_conf->use_short_slot) - ret = wl1251_acx_slot(wl, SLOT_TIME_SHORT); - else - ret = wl1251_acx_slot(wl, SLOT_TIME_LONG); - if (ret < 0) { - wl1251_warning("Set slot time failed %d", ret); - goto out_sleep; - } - } - - if (changed & BSS_CHANGED_ERP_PREAMBLE) { - if (bss_conf->use_short_preamble) - wl1251_acx_set_preamble(wl, ACX_PREAMBLE_SHORT); - else - wl1251_acx_set_preamble(wl, ACX_PREAMBLE_LONG); - } - - if (changed & BSS_CHANGED_ERP_CTS_PROT) { - if (bss_conf->use_cts_prot) - ret = wl1251_acx_cts_protect(wl, CTSPROTECT_ENABLE); - else - ret = wl1251_acx_cts_protect(wl, CTSPROTECT_DISABLE); - if (ret < 0) { - wl1251_warning("Set ctsprotect failed %d", ret); - goto out_sleep; - } - } - - if (changed & BSS_CHANGED_BEACON) { - beacon = ieee80211_beacon_get(hw, vif); - if (!beacon) - goto out_sleep; - - ret = wl1251_cmd_template_set(wl, CMD_BEACON, beacon->data, - beacon->len); - - if (ret < 0) { - dev_kfree_skb(beacon); - goto out_sleep; - } - - ret = wl1251_cmd_template_set(wl, CMD_PROBE_RESP, beacon->data, - beacon->len); - - dev_kfree_skb(beacon); - - if (ret < 0) - goto out_sleep; - - ret = wl1251_join(wl, wl->bss_type, wl->beacon_int, - wl->channel, wl->dtim_period); - - if (ret < 0) - goto out_sleep; - } - -out_sleep: - wl1251_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); -} - - -/* can't be const, mac80211 writes to this */ -static struct ieee80211_rate wl1251_rates[] = { - { .bitrate = 10, - .hw_value = 0x1, - .hw_value_short = 0x1, }, - { .bitrate = 20, - .hw_value = 0x2, - .hw_value_short = 0x2, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 55, - .hw_value = 0x4, - .hw_value_short = 0x4, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 110, - .hw_value = 0x20, - .hw_value_short = 0x20, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 60, - .hw_value = 0x8, - .hw_value_short = 0x8, }, - { .bitrate = 90, - .hw_value = 0x10, - .hw_value_short = 0x10, }, - { .bitrate = 120, - .hw_value = 0x40, - .hw_value_short = 0x40, }, - { .bitrate = 180, - .hw_value = 0x80, - .hw_value_short = 0x80, }, - { .bitrate = 240, - .hw_value = 0x200, - .hw_value_short = 0x200, }, - { .bitrate = 360, - .hw_value = 0x400, - .hw_value_short = 0x400, }, - { .bitrate = 480, - .hw_value = 0x800, - .hw_value_short = 0x800, }, - { .bitrate = 540, - .hw_value = 0x1000, - .hw_value_short = 0x1000, }, -}; - -/* can't be const, mac80211 writes to this */ -static struct ieee80211_channel wl1251_channels[] = { - { .hw_value = 1, .center_freq = 2412}, - { .hw_value = 2, .center_freq = 2417}, - { .hw_value = 3, .center_freq = 2422}, - { .hw_value = 4, .center_freq = 2427}, - { .hw_value = 5, .center_freq = 2432}, - { .hw_value = 6, .center_freq = 2437}, - { .hw_value = 7, .center_freq = 2442}, - { .hw_value = 8, .center_freq = 2447}, - { .hw_value = 9, .center_freq = 2452}, - { .hw_value = 10, .center_freq = 2457}, - { .hw_value = 11, .center_freq = 2462}, - { .hw_value = 12, .center_freq = 2467}, - { .hw_value = 13, .center_freq = 2472}, -}; - -static int wl1251_op_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - enum wl1251_acx_ps_scheme ps_scheme; - struct wl1251 *wl = hw->priv; - int ret; - - mutex_lock(&wl->mutex); - - wl1251_debug(DEBUG_MAC80211, "mac80211 conf tx %d", queue); - - ret = wl1251_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - /* mac80211 uses units of 32 usec */ - ret = wl1251_acx_ac_cfg(wl, wl1251_tx_get_queue(queue), - params->cw_min, params->cw_max, - params->aifs, params->txop * 32); - if (ret < 0) - goto out_sleep; - - if (params->uapsd) - ps_scheme = WL1251_ACX_PS_SCHEME_UPSD_TRIGGER; - else - ps_scheme = WL1251_ACX_PS_SCHEME_LEGACY; - - ret = wl1251_acx_tid_cfg(wl, wl1251_tx_get_queue(queue), - CHANNEL_TYPE_EDCF, - wl1251_tx_get_queue(queue), ps_scheme, - WL1251_ACX_ACK_POLICY_LEGACY); - if (ret < 0) - goto out_sleep; - -out_sleep: - wl1251_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -static int wl1251_op_get_survey(struct ieee80211_hw *hw, int idx, - struct survey_info *survey) -{ - struct wl1251 *wl = hw->priv; - struct ieee80211_conf *conf = &hw->conf; - - if (idx != 0) - return -ENOENT; - - survey->channel = conf->chandef.chan; - survey->filled = SURVEY_INFO_NOISE_DBM; - survey->noise = wl->noise; - - return 0; -} - -/* can't be const, mac80211 writes to this */ -static struct ieee80211_supported_band wl1251_band_2ghz = { - .channels = wl1251_channels, - .n_channels = ARRAY_SIZE(wl1251_channels), - .bitrates = wl1251_rates, - .n_bitrates = ARRAY_SIZE(wl1251_rates), -}; - -static const struct ieee80211_ops wl1251_ops = { - .start = wl1251_op_start, - .stop = wl1251_op_stop, - .add_interface = wl1251_op_add_interface, - .remove_interface = wl1251_op_remove_interface, - .config = wl1251_op_config, - .configure_filter = wl1251_op_configure_filter, - .tx = wl1251_op_tx, - .set_key = wl1251_op_set_key, - .hw_scan = wl1251_op_hw_scan, - .bss_info_changed = wl1251_op_bss_info_changed, - .set_rts_threshold = wl1251_op_set_rts_threshold, - .conf_tx = wl1251_op_conf_tx, - .get_survey = wl1251_op_get_survey, -}; - -static int wl1251_read_eeprom_byte(struct wl1251 *wl, off_t offset, u8 *data) -{ - unsigned long timeout; - - wl1251_reg_write32(wl, EE_ADDR, offset); - wl1251_reg_write32(wl, EE_CTL, EE_CTL_READ); - - /* EE_CTL_READ clears when data is ready */ - timeout = jiffies + msecs_to_jiffies(100); - while (1) { - if (!(wl1251_reg_read32(wl, EE_CTL) & EE_CTL_READ)) - break; - - if (time_after(jiffies, timeout)) - return -ETIMEDOUT; - - msleep(1); - } - - *data = wl1251_reg_read32(wl, EE_DATA); - return 0; -} - -static int wl1251_read_eeprom(struct wl1251 *wl, off_t offset, - u8 *data, size_t len) -{ - size_t i; - int ret; - - wl1251_reg_write32(wl, EE_START, 0); - - for (i = 0; i < len; i++) { - ret = wl1251_read_eeprom_byte(wl, offset + i, &data[i]); - if (ret < 0) - return ret; - } - - return 0; -} - -static int wl1251_read_eeprom_mac(struct wl1251 *wl) -{ - u8 mac[ETH_ALEN]; - int i, ret; - - wl1251_set_partition(wl, 0, 0, REGISTERS_BASE, REGISTERS_DOWN_SIZE); - - ret = wl1251_read_eeprom(wl, 0x1c, mac, sizeof(mac)); - if (ret < 0) { - wl1251_warning("failed to read MAC address from EEPROM"); - return ret; - } - - /* MAC is stored in reverse order */ - for (i = 0; i < ETH_ALEN; i++) - wl->mac_addr[i] = mac[ETH_ALEN - i - 1]; - - return 0; -} - -static int wl1251_register_hw(struct wl1251 *wl) -{ - int ret; - - if (wl->mac80211_registered) - return 0; - - SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr); - - ret = ieee80211_register_hw(wl->hw); - if (ret < 0) { - wl1251_error("unable to register mac80211 hw: %d", ret); - return ret; - } - - wl->mac80211_registered = true; - - wl1251_notice("loaded"); - - return 0; -} - -int wl1251_init_ieee80211(struct wl1251 *wl) -{ - int ret; - - /* The tx descriptor buffer and the TKIP space */ - wl->hw->extra_tx_headroom = sizeof(struct tx_double_buffer_desc) - + WL1251_TKIP_IV_SPACE; - - /* unit us */ - /* FIXME: find a proper value */ - wl->hw->channel_change_time = 10000; - - wl->hw->flags = IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_SUPPORTS_UAPSD; - - wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC); - wl->hw->wiphy->max_scan_ssids = 1; - wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl1251_band_2ghz; - - wl->hw->queues = 4; - - if (wl->use_eeprom) - wl1251_read_eeprom_mac(wl); - - ret = wl1251_register_hw(wl); - if (ret) - goto out; - - wl1251_debugfs_init(wl); - wl1251_notice("initialized"); - - ret = 0; - -out: - return ret; -} -EXPORT_SYMBOL_GPL(wl1251_init_ieee80211); - -struct ieee80211_hw *wl1251_alloc_hw(void) -{ - struct ieee80211_hw *hw; - struct wl1251 *wl; - int i; - static const u8 nokia_oui[3] = {0x00, 0x1f, 0xdf}; - - hw = ieee80211_alloc_hw(sizeof(*wl), &wl1251_ops); - if (!hw) { - wl1251_error("could not alloc ieee80211_hw"); - return ERR_PTR(-ENOMEM); - } - - wl = hw->priv; - memset(wl, 0, sizeof(*wl)); - - wl->hw = hw; - - wl->data_in_count = 0; - - skb_queue_head_init(&wl->tx_queue); - - INIT_DELAYED_WORK(&wl->elp_work, wl1251_elp_work); - wl->channel = WL1251_DEFAULT_CHANNEL; - wl->scanning = false; - wl->default_key = 0; - wl->listen_int = 1; - wl->rx_counter = 0; - wl->rx_handled = 0; - wl->rx_current_buffer = 0; - wl->rx_last_id = 0; - wl->rx_config = WL1251_DEFAULT_RX_CONFIG; - wl->rx_filter = WL1251_DEFAULT_RX_FILTER; - wl->elp = false; - wl->station_mode = STATION_ACTIVE_MODE; - wl->psm_requested = false; - wl->tx_queue_stopped = false; - wl->power_level = WL1251_DEFAULT_POWER_LEVEL; - wl->rssi_thold = 0; - wl->beacon_int = WL1251_DEFAULT_BEACON_INT; - wl->dtim_period = WL1251_DEFAULT_DTIM_PERIOD; - wl->vif = NULL; - - for (i = 0; i < FW_TX_CMPLT_BLOCK_SIZE; i++) - wl->tx_frames[i] = NULL; - - wl->next_tx_complete = 0; - - INIT_WORK(&wl->irq_work, wl1251_irq_work); - INIT_WORK(&wl->tx_work, wl1251_tx_work); - - /* - * In case our MAC address is not correctly set, - * we use a random but Nokia MAC. - */ - memcpy(wl->mac_addr, nokia_oui, 3); - get_random_bytes(wl->mac_addr + 3, 3); - - wl->state = WL1251_STATE_OFF; - mutex_init(&wl->mutex); - - wl->tx_mgmt_frm_rate = DEFAULT_HW_GEN_TX_RATE; - wl->tx_mgmt_frm_mod = DEFAULT_HW_GEN_MODULATION_TYPE; - - wl->rx_descriptor = kmalloc(sizeof(*wl->rx_descriptor), GFP_KERNEL); - if (!wl->rx_descriptor) { - wl1251_error("could not allocate memory for rx descriptor"); - ieee80211_free_hw(hw); - return ERR_PTR(-ENOMEM); - } - - return hw; -} -EXPORT_SYMBOL_GPL(wl1251_alloc_hw); - -int wl1251_free_hw(struct wl1251 *wl) -{ - ieee80211_unregister_hw(wl->hw); - - wl1251_debugfs_exit(wl); - - kfree(wl->target_mem_map); - kfree(wl->data_path); - vfree(wl->fw); - wl->fw = NULL; - kfree(wl->nvs); - wl->nvs = NULL; - - kfree(wl->rx_descriptor); - wl->rx_descriptor = NULL; - - ieee80211_free_hw(wl->hw); - - return 0; -} -EXPORT_SYMBOL_GPL(wl1251_free_hw); - -MODULE_DESCRIPTION("TI wl1251 Wireles LAN Driver Core"); -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Kalle Valo "); -MODULE_FIRMWARE(WL1251_FW_NAME); diff --git a/drivers/net/wireless/ti/wl1251/ps.c b/drivers/net/wireless/ti/wl1251/ps.c deleted file mode 100644 index b9e27b98bbc9..000000000000 --- a/drivers/net/wireless/ti/wl1251/ps.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "reg.h" -#include "ps.h" -#include "cmd.h" -#include "io.h" - -/* in ms */ -#define WL1251_WAKEUP_TIMEOUT 100 - -void wl1251_elp_work(struct work_struct *work) -{ - struct delayed_work *dwork; - struct wl1251 *wl; - - dwork = container_of(work, struct delayed_work, work); - wl = container_of(dwork, struct wl1251, elp_work); - - wl1251_debug(DEBUG_PSM, "elp work"); - - mutex_lock(&wl->mutex); - - if (wl->elp || wl->station_mode == STATION_ACTIVE_MODE) - goto out; - - wl1251_debug(DEBUG_PSM, "chip to elp"); - wl1251_write_elp(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_SLEEP); - wl->elp = true; - -out: - mutex_unlock(&wl->mutex); -} - -#define ELP_ENTRY_DELAY 5 - -/* Routines to toggle sleep mode while in ELP */ -void wl1251_ps_elp_sleep(struct wl1251 *wl) -{ - unsigned long delay; - - if (wl->station_mode != STATION_ACTIVE_MODE) { - delay = msecs_to_jiffies(ELP_ENTRY_DELAY); - ieee80211_queue_delayed_work(wl->hw, &wl->elp_work, delay); - } -} - -int wl1251_ps_elp_wakeup(struct wl1251 *wl) -{ - unsigned long timeout, start; - u32 elp_reg; - - cancel_delayed_work(&wl->elp_work); - - if (!wl->elp) - return 0; - - wl1251_debug(DEBUG_PSM, "waking up chip from elp"); - - start = jiffies; - timeout = jiffies + msecs_to_jiffies(WL1251_WAKEUP_TIMEOUT); - - wl1251_write_elp(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_WAKE_UP); - - elp_reg = wl1251_read_elp(wl, HW_ACCESS_ELP_CTRL_REG_ADDR); - - /* - * FIXME: we should wait for irq from chip but, as a temporary - * solution to simplify locking, let's poll instead - */ - while (!(elp_reg & ELPCTRL_WLAN_READY)) { - if (time_after(jiffies, timeout)) { - wl1251_error("elp wakeup timeout"); - return -ETIMEDOUT; - } - msleep(1); - elp_reg = wl1251_read_elp(wl, HW_ACCESS_ELP_CTRL_REG_ADDR); - } - - wl1251_debug(DEBUG_PSM, "wakeup time: %u ms", - jiffies_to_msecs(jiffies - start)); - - wl->elp = false; - - return 0; -} - -int wl1251_ps_set_mode(struct wl1251 *wl, enum wl1251_station_mode mode) -{ - int ret; - - switch (mode) { - case STATION_POWER_SAVE_MODE: - wl1251_debug(DEBUG_PSM, "entering psm"); - - /* enable beacon filtering */ - ret = wl1251_acx_beacon_filter_opt(wl, true); - if (ret < 0) - return ret; - - ret = wl1251_acx_wake_up_conditions(wl, - WAKE_UP_EVENT_DTIM_BITMAP, - wl->listen_int); - if (ret < 0) - return ret; - - ret = wl1251_acx_bet_enable(wl, WL1251_ACX_BET_ENABLE, - WL1251_DEFAULT_BET_CONSECUTIVE); - if (ret < 0) - return ret; - - ret = wl1251_cmd_ps_mode(wl, CHIP_POWER_SAVE_MODE); - if (ret < 0) - return ret; - - ret = wl1251_acx_sleep_auth(wl, WL1251_PSM_ELP); - if (ret < 0) - return ret; - break; - case STATION_IDLE: - wl1251_debug(DEBUG_PSM, "entering idle"); - - ret = wl1251_acx_sleep_auth(wl, WL1251_PSM_ELP); - if (ret < 0) - return ret; - - ret = wl1251_cmd_template_set(wl, CMD_DISCONNECT, NULL, 0); - if (ret < 0) - return ret; - break; - case STATION_ACTIVE_MODE: - default: - wl1251_debug(DEBUG_PSM, "leaving psm"); - - ret = wl1251_acx_sleep_auth(wl, WL1251_PSM_CAM); - if (ret < 0) - return ret; - - /* disable BET */ - ret = wl1251_acx_bet_enable(wl, WL1251_ACX_BET_DISABLE, - WL1251_DEFAULT_BET_CONSECUTIVE); - if (ret < 0) - return ret; - - /* disable beacon filtering */ - ret = wl1251_acx_beacon_filter_opt(wl, false); - if (ret < 0) - return ret; - - ret = wl1251_acx_wake_up_conditions(wl, - WAKE_UP_EVENT_DTIM_BITMAP, - wl->listen_int); - if (ret < 0) - return ret; - - ret = wl1251_cmd_ps_mode(wl, CHIP_ACTIVE_MODE); - if (ret < 0) - return ret; - - break; - } - wl->station_mode = mode; - - return ret; -} - diff --git a/drivers/net/wireless/ti/wl1251/ps.h b/drivers/net/wireless/ti/wl1251/ps.h deleted file mode 100644 index 75efad246d67..000000000000 --- a/drivers/net/wireless/ti/wl1251/ps.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (c) 1998-2007 Texas Instruments Incorporated - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL1251_PS_H__ -#define __WL1251_PS_H__ - -#include "wl1251.h" -#include "acx.h" - -int wl1251_ps_set_mode(struct wl1251 *wl, enum wl1251_station_mode mode); -void wl1251_ps_elp_sleep(struct wl1251 *wl); -int wl1251_ps_elp_wakeup(struct wl1251 *wl); -void wl1251_elp_work(struct work_struct *work); - - -#endif /* __WL1251_PS_H__ */ diff --git a/drivers/net/wireless/ti/wl1251/reg.h b/drivers/net/wireless/ti/wl1251/reg.h deleted file mode 100644 index a5809019c5c1..000000000000 --- a/drivers/net/wireless/ti/wl1251/reg.h +++ /dev/null @@ -1,655 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (c) 1998-2007 Texas Instruments Incorporated - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __REG_H__ -#define __REG_H__ - -#include - -#define REGISTERS_BASE 0x00300000 -#define DRPW_BASE 0x00310000 - -#define REGISTERS_DOWN_SIZE 0x00008800 -#define REGISTERS_WORK_SIZE 0x0000b000 - -#define HW_ACCESS_ELP_CTRL_REG_ADDR 0x1FFFC - -/* ELP register commands */ -#define ELPCTRL_WAKE_UP 0x1 -#define ELPCTRL_WAKE_UP_WLAN_READY 0x5 -#define ELPCTRL_SLEEP 0x0 -/* ELP WLAN_READY bit */ -#define ELPCTRL_WLAN_READY 0x2 - -/* Device Configuration registers*/ -#define SOR_CFG (REGISTERS_BASE + 0x0800) -#define ECPU_CTRL (REGISTERS_BASE + 0x0804) -#define HI_CFG (REGISTERS_BASE + 0x0808) - -/* EEPROM registers */ -#define EE_START (REGISTERS_BASE + 0x080C) -#define EE_CTL (REGISTERS_BASE + 0x2000) -#define EE_DATA (REGISTERS_BASE + 0x2004) -#define EE_ADDR (REGISTERS_BASE + 0x2008) - -#define EE_CTL_READ 2 - -#define CHIP_ID_B (REGISTERS_BASE + 0x5674) - -#define CHIP_ID_1251_PG10 (0x7010101) -#define CHIP_ID_1251_PG11 (0x7020101) -#define CHIP_ID_1251_PG12 (0x7030101) - -#define ENABLE (REGISTERS_BASE + 0x5450) - -/* Power Management registers */ -#define ELP_CFG_MODE (REGISTERS_BASE + 0x5804) -#define ELP_CMD (REGISTERS_BASE + 0x5808) -#define PLL_CAL_TIME (REGISTERS_BASE + 0x5810) -#define CLK_REQ_TIME (REGISTERS_BASE + 0x5814) -#define CLK_BUF_TIME (REGISTERS_BASE + 0x5818) - -#define CFG_PLL_SYNC_CNT (REGISTERS_BASE + 0x5820) - -/* Scratch Pad registers*/ -#define SCR_PAD0 (REGISTERS_BASE + 0x5608) -#define SCR_PAD1 (REGISTERS_BASE + 0x560C) -#define SCR_PAD2 (REGISTERS_BASE + 0x5610) -#define SCR_PAD3 (REGISTERS_BASE + 0x5614) -#define SCR_PAD4 (REGISTERS_BASE + 0x5618) -#define SCR_PAD4_SET (REGISTERS_BASE + 0x561C) -#define SCR_PAD4_CLR (REGISTERS_BASE + 0x5620) -#define SCR_PAD5 (REGISTERS_BASE + 0x5624) -#define SCR_PAD5_SET (REGISTERS_BASE + 0x5628) -#define SCR_PAD5_CLR (REGISTERS_BASE + 0x562C) -#define SCR_PAD6 (REGISTERS_BASE + 0x5630) -#define SCR_PAD7 (REGISTERS_BASE + 0x5634) -#define SCR_PAD8 (REGISTERS_BASE + 0x5638) -#define SCR_PAD9 (REGISTERS_BASE + 0x563C) - -/* Spare registers*/ -#define SPARE_A1 (REGISTERS_BASE + 0x0994) -#define SPARE_A2 (REGISTERS_BASE + 0x0998) -#define SPARE_A3 (REGISTERS_BASE + 0x099C) -#define SPARE_A4 (REGISTERS_BASE + 0x09A0) -#define SPARE_A5 (REGISTERS_BASE + 0x09A4) -#define SPARE_A6 (REGISTERS_BASE + 0x09A8) -#define SPARE_A7 (REGISTERS_BASE + 0x09AC) -#define SPARE_A8 (REGISTERS_BASE + 0x09B0) -#define SPARE_B1 (REGISTERS_BASE + 0x5420) -#define SPARE_B2 (REGISTERS_BASE + 0x5424) -#define SPARE_B3 (REGISTERS_BASE + 0x5428) -#define SPARE_B4 (REGISTERS_BASE + 0x542C) -#define SPARE_B5 (REGISTERS_BASE + 0x5430) -#define SPARE_B6 (REGISTERS_BASE + 0x5434) -#define SPARE_B7 (REGISTERS_BASE + 0x5438) -#define SPARE_B8 (REGISTERS_BASE + 0x543C) - -enum wl12xx_acx_int_reg { - ACX_REG_INTERRUPT_TRIG, - ACX_REG_INTERRUPT_TRIG_H, - -/*============================================= - Host Interrupt Mask Register - 32bit (RW) - ------------------------------------------ - Setting a bit in this register masks the - corresponding interrupt to the host. - 0 - RX0 - Rx first dubble buffer Data Interrupt - 1 - TXD - Tx Data Interrupt - 2 - TXXFR - Tx Transfer Interrupt - 3 - RX1 - Rx second dubble buffer Data Interrupt - 4 - RXXFR - Rx Transfer Interrupt - 5 - EVENT_A - Event Mailbox interrupt - 6 - EVENT_B - Event Mailbox interrupt - 7 - WNONHST - Wake On Host Interrupt - 8 - TRACE_A - Debug Trace interrupt - 9 - TRACE_B - Debug Trace interrupt - 10 - CDCMP - Command Complete Interrupt - 11 - - 12 - - 13 - - 14 - ICOMP - Initialization Complete Interrupt - 16 - SG SE - Soft Gemini - Sense enable interrupt - 17 - SG SD - Soft Gemini - Sense disable interrupt - 18 - - - 19 - - - 20 - - - 21- - - Default: 0x0001 -*==============================================*/ - ACX_REG_INTERRUPT_MASK, - -/*============================================= - Host Interrupt Mask Set 16bit, (Write only) - ------------------------------------------ - Setting a bit in this register sets - the corresponding bin in ACX_HINT_MASK register - without effecting the mask - state of other bits (0 = no effect). -==============================================*/ - ACX_REG_HINT_MASK_SET, - -/*============================================= - Host Interrupt Mask Clear 16bit,(Write only) - ------------------------------------------ - Setting a bit in this register clears - the corresponding bin in ACX_HINT_MASK register - without effecting the mask - state of other bits (0 = no effect). -=============================================*/ - ACX_REG_HINT_MASK_CLR, - -/*============================================= - Host Interrupt Status Nondestructive Read - 16bit,(Read only) - ------------------------------------------ - The host can read this register to determine - which interrupts are active. - Reading this register doesn't - effect its content. -=============================================*/ - ACX_REG_INTERRUPT_NO_CLEAR, - -/*============================================= - Host Interrupt Status Clear on Read Register - 16bit,(Read only) - ------------------------------------------ - The host can read this register to determine - which interrupts are active. - Reading this register clears it, - thus making all interrupts inactive. -==============================================*/ - ACX_REG_INTERRUPT_CLEAR, - -/*============================================= - Host Interrupt Acknowledge Register - 16bit,(Write only) - ------------------------------------------ - The host can set individual bits in this - register to clear (acknowledge) the corresp. - interrupt status bits in the HINT_STS_CLR and - HINT_STS_ND registers, thus making the - assotiated interrupt inactive. (0-no effect) -==============================================*/ - ACX_REG_INTERRUPT_ACK, - -/*=============================================== - Host Software Reset - 32bit RW - ------------------------------------------ - [31:1] Reserved - 0 SOFT_RESET Soft Reset - When this bit is set, - it holds the Wlan hardware in a soft reset state. - This reset disables all MAC and baseband processor - clocks except the CardBus/PCI interface clock. - It also initializes all MAC state machines except - the host interface. It does not reload the - contents of the EEPROM. When this bit is cleared - (not self-clearing), the Wlan hardware - exits the software reset state. -===============================================*/ - ACX_REG_SLV_SOFT_RESET, - -/*=============================================== - EEPROM Burst Read Start - 32bit RW - ------------------------------------------ - [31:1] Reserved - 0 ACX_EE_START - EEPROM Burst Read Start 0 - Setting this bit starts a burst read from - the external EEPROM. - If this bit is set (after reset) before an EEPROM read/write, - the burst read starts at EEPROM address 0. - Otherwise, it starts at the address - following the address of the previous access. - TheWlan hardware hardware clears this bit automatically. - - Default: 0x00000000 -*================================================*/ - ACX_REG_EE_START, - -/* Embedded ARM CPU Control */ - -/*=============================================== - Halt eCPU - 32bit RW - ------------------------------------------ - 0 HALT_ECPU Halt Embedded CPU - This bit is the - compliment of bit 1 (MDATA2) in the SOR_CFG register. - During a hardware reset, this bit holds - the inverse of MDATA2. - When downloading firmware from the host, - set this bit (pull down MDATA2). - The host clears this bit after downloading the firmware into - zero-wait-state SSRAM. - When loading firmware from Flash, clear this bit (pull up MDATA2) - so that the eCPU can run the bootloader code in Flash - HALT_ECPU eCPU State - -------------------- - 1 halt eCPU - 0 enable eCPU - ===============================================*/ - ACX_REG_ECPU_CONTROL, - - ACX_REG_TABLE_LEN -}; - -#define ACX_SLV_SOFT_RESET_BIT BIT(0) -#define ACX_REG_EEPROM_START_BIT BIT(0) - -/* Command/Information Mailbox Pointers */ - -/*=============================================== - Command Mailbox Pointer - 32bit RW - ------------------------------------------ - This register holds the start address of - the command mailbox located in the Wlan hardware memory. - The host must read this pointer after a reset to - find the location of the command mailbox. - The Wlan hardware initializes the command mailbox - pointer with the default address of the command mailbox. - The command mailbox pointer is not valid until after - the host receives the Init Complete interrupt from - the Wlan hardware. - ===============================================*/ -#define REG_COMMAND_MAILBOX_PTR (SCR_PAD0) - -/*=============================================== - Information Mailbox Pointer - 32bit RW - ------------------------------------------ - This register holds the start address of - the information mailbox located in the Wlan hardware memory. - The host must read this pointer after a reset to find - the location of the information mailbox. - The Wlan hardware initializes the information mailbox pointer - with the default address of the information mailbox. - The information mailbox pointer is not valid - until after the host receives the Init Complete interrupt from - the Wlan hardware. - ===============================================*/ -#define REG_EVENT_MAILBOX_PTR (SCR_PAD1) - - -/* Misc */ - -#define REG_ENABLE_TX_RX (ENABLE) -/* - * Rx configuration (filter) information element - * --------------------------------------------- - */ -#define REG_RX_CONFIG (RX_CFG) -#define REG_RX_FILTER (RX_FILTER_CFG) - - -#define RX_CFG_ENABLE_PHY_HEADER_PLCP 0x0002 - -/* promiscuous - receives all valid frames */ -#define RX_CFG_PROMISCUOUS 0x0008 - -/* receives frames from any BSSID */ -#define RX_CFG_BSSID 0x0020 - -/* receives frames destined to any MAC address */ -#define RX_CFG_MAC 0x0010 - -#define RX_CFG_ENABLE_ONLY_MY_DEST_MAC 0x0010 -#define RX_CFG_ENABLE_ANY_DEST_MAC 0x0000 -#define RX_CFG_ENABLE_ONLY_MY_BSSID 0x0020 -#define RX_CFG_ENABLE_ANY_BSSID 0x0000 - -/* discards all broadcast frames */ -#define RX_CFG_DISABLE_BCAST 0x0200 - -#define RX_CFG_ENABLE_ONLY_MY_SSID 0x0400 -#define RX_CFG_ENABLE_RX_CMPLT_FCS_ERROR 0x0800 -#define RX_CFG_COPY_RX_STATUS 0x2000 -#define RX_CFG_TSF 0x10000 - -#define RX_CONFIG_OPTION_ANY_DST_MY_BSS (RX_CFG_ENABLE_ANY_DEST_MAC | \ - RX_CFG_ENABLE_ONLY_MY_BSSID) - -#define RX_CONFIG_OPTION_MY_DST_ANY_BSS (RX_CFG_ENABLE_ONLY_MY_DEST_MAC\ - | RX_CFG_ENABLE_ANY_BSSID) - -#define RX_CONFIG_OPTION_ANY_DST_ANY_BSS (RX_CFG_ENABLE_ANY_DEST_MAC | \ - RX_CFG_ENABLE_ANY_BSSID) - -#define RX_CONFIG_OPTION_MY_DST_MY_BSS (RX_CFG_ENABLE_ONLY_MY_DEST_MAC\ - | RX_CFG_ENABLE_ONLY_MY_BSSID) - -#define RX_CONFIG_OPTION_FOR_SCAN (RX_CFG_ENABLE_PHY_HEADER_PLCP \ - | RX_CFG_ENABLE_RX_CMPLT_FCS_ERROR \ - | RX_CFG_COPY_RX_STATUS | RX_CFG_TSF) - -#define RX_CONFIG_OPTION_FOR_MEASUREMENT (RX_CFG_ENABLE_ANY_DEST_MAC) - -#define RX_CONFIG_OPTION_FOR_JOIN (RX_CFG_ENABLE_ONLY_MY_BSSID | \ - RX_CFG_ENABLE_ONLY_MY_DEST_MAC) - -#define RX_CONFIG_OPTION_FOR_IBSS_JOIN (RX_CFG_ENABLE_ONLY_MY_SSID | \ - RX_CFG_ENABLE_ONLY_MY_DEST_MAC) - -#define RX_FILTER_OPTION_DEF (CFG_RX_MGMT_EN | CFG_RX_DATA_EN\ - | CFG_RX_CTL_EN | CFG_RX_BCN_EN\ - | CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN) - -#define RX_FILTER_OPTION_FILTER_ALL 0 - -#define RX_FILTER_OPTION_DEF_PRSP_BCN (CFG_RX_PRSP_EN | CFG_RX_MGMT_EN\ - | CFG_RX_RCTS_ACK | CFG_RX_BCN_EN) - -#define RX_FILTER_OPTION_JOIN (CFG_RX_MGMT_EN | CFG_RX_DATA_EN\ - | CFG_RX_BCN_EN | CFG_RX_AUTH_EN\ - | CFG_RX_ASSOC_EN | CFG_RX_RCTS_ACK\ - | CFG_RX_PRSP_EN) - - -/*=============================================== - EEPROM Read/Write Request 32bit RW - ------------------------------------------ - 1 EE_READ - EEPROM Read Request 1 - Setting this bit - loads a single byte of data into the EE_DATA - register from the EEPROM location specified in - the EE_ADDR register. - The Wlan hardware hardware clears this bit automatically. - EE_DATA is valid when this bit is cleared. - - 0 EE_WRITE - EEPROM Write Request - Setting this bit - writes a single byte of data from the EE_DATA register into the - EEPROM location specified in the EE_ADDR register. - The Wlan hardware hardware clears this bit automatically. -*===============================================*/ -#define EE_CTL (REGISTERS_BASE + 0x2000) -#define ACX_EE_CTL_REG EE_CTL -#define EE_WRITE 0x00000001ul -#define EE_READ 0x00000002ul - -/*=============================================== - EEPROM Address - 32bit RW - ------------------------------------------ - This register specifies the address - within the EEPROM from/to which to read/write data. - ===============================================*/ -#define EE_ADDR (REGISTERS_BASE + 0x2008) -#define ACX_EE_ADDR_REG EE_ADDR - -/*=============================================== - EEPROM Data - 32bit RW - ------------------------------------------ - This register either holds the read 8 bits of - data from the EEPROM or the write data - to be written to the EEPROM. - ===============================================*/ -#define EE_DATA (REGISTERS_BASE + 0x2004) -#define ACX_EE_DATA_REG EE_DATA - -#define EEPROM_ACCESS_TO 10000 /* timeout counter */ -#define START_EEPROM_MGR 0x00000001 - -/*=============================================== - EEPROM Base Address - 32bit RW - ------------------------------------------ - This register holds the upper nine bits - [23:15] of the 24-bit Wlan hardware memory - address for burst reads from EEPROM accesses. - The EEPROM provides the lower 15 bits of this address. - The MSB of the address from the EEPROM is ignored. - ===============================================*/ -#define ACX_EE_CFG EE_CFG - -/*=============================================== - GPIO Output Values -32bit, RW - ------------------------------------------ - [31:16] Reserved - [15: 0] Specify the output values (at the output driver inputs) for - GPIO[15:0], respectively. - ===============================================*/ -#define ACX_GPIO_OUT_REG GPIO_OUT -#define ACX_MAX_GPIO_LINES 15 - -/*=============================================== - Contention window -32bit, RW - ------------------------------------------ - [31:26] Reserved - [25:16] Max (0x3ff) - [15:07] Reserved - [06:00] Current contention window value - default is 0x1F - ===============================================*/ -#define ACX_CONT_WIND_CFG_REG CONT_WIND_CFG -#define ACX_CONT_WIND_MIN_MASK 0x0000007f -#define ACX_CONT_WIND_MAX 0x03ff0000 - -/*=============================================== - HI_CFG Interface Configuration Register Values - ------------------------------------------ - ===============================================*/ -#define HI_CFG_UART_ENABLE 0x00000004 -#define HI_CFG_RST232_ENABLE 0x00000008 -#define HI_CFG_CLOCK_REQ_SELECT 0x00000010 -#define HI_CFG_HOST_INT_ENABLE 0x00000020 -#define HI_CFG_VLYNQ_OUTPUT_ENABLE 0x00000040 -#define HI_CFG_HOST_INT_ACTIVE_LOW 0x00000080 -#define HI_CFG_UART_TX_OUT_GPIO_15 0x00000100 -#define HI_CFG_UART_TX_OUT_GPIO_14 0x00000200 -#define HI_CFG_UART_TX_OUT_GPIO_7 0x00000400 - -/* - * NOTE: USE_ACTIVE_HIGH compilation flag should be defined in makefile - * for platforms using active high interrupt level - */ -#ifdef USE_ACTIVE_HIGH -#define HI_CFG_DEF_VAL \ - (HI_CFG_UART_ENABLE | \ - HI_CFG_RST232_ENABLE | \ - HI_CFG_CLOCK_REQ_SELECT | \ - HI_CFG_HOST_INT_ENABLE) -#else -#define HI_CFG_DEF_VAL \ - (HI_CFG_UART_ENABLE | \ - HI_CFG_RST232_ENABLE | \ - HI_CFG_CLOCK_REQ_SELECT | \ - HI_CFG_HOST_INT_ENABLE) - -#endif - -#define REF_FREQ_19_2 0 -#define REF_FREQ_26_0 1 -#define REF_FREQ_38_4 2 -#define REF_FREQ_40_0 3 -#define REF_FREQ_33_6 4 -#define REF_FREQ_NUM 5 - -#define LUT_PARAM_INTEGER_DIVIDER 0 -#define LUT_PARAM_FRACTIONAL_DIVIDER 1 -#define LUT_PARAM_ATTN_BB 2 -#define LUT_PARAM_ALPHA_BB 3 -#define LUT_PARAM_STOP_TIME_BB 4 -#define LUT_PARAM_BB_PLL_LOOP_FILTER 5 -#define LUT_PARAM_NUM 6 - -#define ACX_EEPROMLESS_IND_REG (SCR_PAD4) -#define USE_EEPROM 0 -#define SOFT_RESET_MAX_TIME 1000000 -#define SOFT_RESET_STALL_TIME 1000 -#define NVS_DATA_BUNDARY_ALIGNMENT 4 - - -/* Firmware image load chunk size */ -#define CHUNK_SIZE 512 - -/* Firmware image header size */ -#define FW_HDR_SIZE 8 - -#define ECPU_CONTROL_HALT 0x00000101 - - -/****************************************************************************** - - CHANNELS, BAND & REG DOMAINS definitions - -******************************************************************************/ - - -enum { - RADIO_BAND_2_4GHZ = 0, /* 2.4 Ghz band */ - RADIO_BAND_5GHZ = 1, /* 5 Ghz band */ - RADIO_BAND_JAPAN_4_9_GHZ = 2, - DEFAULT_BAND = RADIO_BAND_2_4GHZ, - INVALID_BAND = 0xFE, - MAX_RADIO_BANDS = 0xFF -}; - -enum { - NO_RATE = 0, - RATE_1MBPS = 0x0A, - RATE_2MBPS = 0x14, - RATE_5_5MBPS = 0x37, - RATE_6MBPS = 0x0B, - RATE_9MBPS = 0x0F, - RATE_11MBPS = 0x6E, - RATE_12MBPS = 0x0A, - RATE_18MBPS = 0x0E, - RATE_22MBPS = 0xDC, - RATE_24MBPS = 0x09, - RATE_36MBPS = 0x0D, - RATE_48MBPS = 0x08, - RATE_54MBPS = 0x0C -}; - -enum { - RATE_INDEX_1MBPS = 0, - RATE_INDEX_2MBPS = 1, - RATE_INDEX_5_5MBPS = 2, - RATE_INDEX_6MBPS = 3, - RATE_INDEX_9MBPS = 4, - RATE_INDEX_11MBPS = 5, - RATE_INDEX_12MBPS = 6, - RATE_INDEX_18MBPS = 7, - RATE_INDEX_22MBPS = 8, - RATE_INDEX_24MBPS = 9, - RATE_INDEX_36MBPS = 10, - RATE_INDEX_48MBPS = 11, - RATE_INDEX_54MBPS = 12, - RATE_INDEX_MAX = RATE_INDEX_54MBPS, - MAX_RATE_INDEX, - INVALID_RATE_INDEX = MAX_RATE_INDEX, - RATE_INDEX_ENUM_MAX_SIZE = 0x7FFFFFFF -}; - -enum { - RATE_MASK_1MBPS = 0x1, - RATE_MASK_2MBPS = 0x2, - RATE_MASK_5_5MBPS = 0x4, - RATE_MASK_11MBPS = 0x20, -}; - -#define SHORT_PREAMBLE_BIT BIT(0) /* CCK or Barker depending on the rate */ -#define OFDM_RATE_BIT BIT(6) -#define PBCC_RATE_BIT BIT(7) - -enum { - CCK_LONG = 0, - CCK_SHORT = SHORT_PREAMBLE_BIT, - PBCC_LONG = PBCC_RATE_BIT, - PBCC_SHORT = PBCC_RATE_BIT | SHORT_PREAMBLE_BIT, - OFDM = OFDM_RATE_BIT -}; - -/****************************************************************************** - -Transmit-Descriptor RATE-SET field definitions... - -Define a new "Rate-Set" for TX path that incorporates the -Rate & Modulation info into a single 16-bit field. - -TxdRateSet_t: -b15 - Indicates Preamble type (1=SHORT, 0=LONG). - Notes: - Must be LONG (0) for 1Mbps rate. - Does not apply (set to 0) for RevG-OFDM rates. -b14 - Indicates PBCC encoding (1=PBCC, 0=not). - Notes: - Does not apply (set to 0) for rates 1 and 2 Mbps. - Does not apply (set to 0) for RevG-OFDM rates. -b13 - Unused (set to 0). -b12-b0 - Supported Rate indicator bits as defined below. - -******************************************************************************/ - - -/************************************************************************* - - Interrupt Trigger Register (Host -> WiLink) - -**************************************************************************/ - -/* Hardware to Embedded CPU Interrupts - first 32-bit register set */ - -/* - * Host Command Interrupt. Setting this bit masks - * the interrupt that the host issues to inform - * the FW that it has sent a command - * to the Wlan hardware Command Mailbox. - */ -#define INTR_TRIG_CMD BIT(0) - -/* - * Host Event Acknowlegde Interrupt. The host - * sets this bit to acknowledge that it received - * the unsolicited information from the event - * mailbox. - */ -#define INTR_TRIG_EVENT_ACK BIT(1) - -/* - * The host sets this bit to inform the Wlan - * FW that a TX packet is in the XFER - * Buffer #0. - */ -#define INTR_TRIG_TX_PROC0 BIT(2) - -/* - * The host sets this bit to inform the FW - * that it read a packet from RX XFER - * Buffer #0. - */ -#define INTR_TRIG_RX_PROC0 BIT(3) - -#define INTR_TRIG_DEBUG_ACK BIT(4) - -#define INTR_TRIG_STATE_CHANGED BIT(5) - - -/* Hardware to Embedded CPU Interrupts - second 32-bit register set */ - -/* - * The host sets this bit to inform the FW - * that it read a packet from RX XFER - * Buffer #1. - */ -#define INTR_TRIG_RX_PROC1 BIT(17) - -/* - * The host sets this bit to inform the Wlan - * hardware that a TX packet is in the XFER - * Buffer #1. - */ -#define INTR_TRIG_TX_PROC1 BIT(18) - -#endif diff --git a/drivers/net/wireless/ti/wl1251/rx.c b/drivers/net/wireless/ti/wl1251/rx.c deleted file mode 100644 index 23289d49dd31..000000000000 --- a/drivers/net/wireless/ti/wl1251/rx.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (c) 1998-2007 Texas Instruments Incorporated - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include - -#include "wl1251.h" -#include "reg.h" -#include "io.h" -#include "rx.h" -#include "cmd.h" -#include "acx.h" - -static void wl1251_rx_header(struct wl1251 *wl, - struct wl1251_rx_descriptor *desc) -{ - u32 rx_packet_ring_addr; - - rx_packet_ring_addr = wl->data_path->rx_packet_ring_addr; - if (wl->rx_current_buffer) - rx_packet_ring_addr += wl->data_path->rx_packet_ring_chunk_size; - - wl1251_mem_read(wl, rx_packet_ring_addr, desc, sizeof(*desc)); -} - -static void wl1251_rx_status(struct wl1251 *wl, - struct wl1251_rx_descriptor *desc, - struct ieee80211_rx_status *status, - u8 beacon) -{ - u64 mactime; - int ret; - - memset(status, 0, sizeof(struct ieee80211_rx_status)); - - status->band = IEEE80211_BAND_2GHZ; - status->mactime = desc->timestamp; - - /* - * The rx status timestamp is a 32 bits value while the TSF is a - * 64 bits one. - * For IBSS merging, TSF is mandatory, so we have to get it - * somehow, so we ask for ACX_TSF_INFO. - * That could be moved to the get_tsf() hook, but unfortunately, - * this one must be atomic, while our SPI routines can sleep. - */ - if ((wl->bss_type == BSS_TYPE_IBSS) && beacon) { - ret = wl1251_acx_tsf_info(wl, &mactime); - if (ret == 0) - status->mactime = mactime; - } - - status->signal = desc->rssi; - - /* - * FIXME: guessing that snr needs to be divided by two, otherwise - * the values don't make any sense - */ - wl->noise = desc->rssi - desc->snr / 2; - - status->freq = ieee80211_channel_to_frequency(desc->channel, - status->band); - - status->flag |= RX_FLAG_MACTIME_START; - - if (desc->flags & RX_DESC_ENCRYPTION_MASK) { - status->flag |= RX_FLAG_IV_STRIPPED | RX_FLAG_MMIC_STRIPPED; - - if (likely(!(desc->flags & RX_DESC_DECRYPT_FAIL))) - status->flag |= RX_FLAG_DECRYPTED; - - if (unlikely(desc->flags & RX_DESC_MIC_FAIL)) - status->flag |= RX_FLAG_MMIC_ERROR; - } - - if (unlikely(!(desc->flags & RX_DESC_VALID_FCS))) - status->flag |= RX_FLAG_FAILED_FCS_CRC; - - switch (desc->rate) { - /* skip 1 and 12 Mbps because they have same value 0x0a */ - case RATE_2MBPS: - status->rate_idx = 1; - break; - case RATE_5_5MBPS: - status->rate_idx = 2; - break; - case RATE_11MBPS: - status->rate_idx = 3; - break; - case RATE_6MBPS: - status->rate_idx = 4; - break; - case RATE_9MBPS: - status->rate_idx = 5; - break; - case RATE_18MBPS: - status->rate_idx = 7; - break; - case RATE_24MBPS: - status->rate_idx = 8; - break; - case RATE_36MBPS: - status->rate_idx = 9; - break; - case RATE_48MBPS: - status->rate_idx = 10; - break; - case RATE_54MBPS: - status->rate_idx = 11; - break; - } - - /* for 1 and 12 Mbps we have to check the modulation */ - if (desc->rate == RATE_1MBPS) { - if (!(desc->mod_pre & OFDM_RATE_BIT)) - /* CCK -> RATE_1MBPS */ - status->rate_idx = 0; - else - /* OFDM -> RATE_12MBPS */ - status->rate_idx = 6; - } - - if (desc->mod_pre & SHORT_PREAMBLE_BIT) - status->flag |= RX_FLAG_SHORTPRE; -} - -static void wl1251_rx_body(struct wl1251 *wl, - struct wl1251_rx_descriptor *desc) -{ - struct sk_buff *skb; - struct ieee80211_rx_status status; - u8 *rx_buffer, beacon = 0; - u16 length, *fc; - u32 curr_id, last_id_inc, rx_packet_ring_addr; - - length = WL1251_RX_ALIGN(desc->length - PLCP_HEADER_LENGTH); - curr_id = (desc->flags & RX_DESC_SEQNUM_MASK) >> RX_DESC_PACKETID_SHIFT; - last_id_inc = (wl->rx_last_id + 1) % (RX_MAX_PACKET_ID + 1); - - if (last_id_inc != curr_id) { - wl1251_warning("curr ID:%d, last ID inc:%d", - curr_id, last_id_inc); - wl->rx_last_id = curr_id; - } else { - wl->rx_last_id = last_id_inc; - } - - rx_packet_ring_addr = wl->data_path->rx_packet_ring_addr + - sizeof(struct wl1251_rx_descriptor) + 20; - if (wl->rx_current_buffer) - rx_packet_ring_addr += wl->data_path->rx_packet_ring_chunk_size; - - skb = __dev_alloc_skb(length, GFP_KERNEL); - if (!skb) { - wl1251_error("Couldn't allocate RX frame"); - return; - } - - rx_buffer = skb_put(skb, length); - wl1251_mem_read(wl, rx_packet_ring_addr, rx_buffer, length); - - /* The actual length doesn't include the target's alignment */ - skb->len = desc->length - PLCP_HEADER_LENGTH; - - fc = (u16 *)skb->data; - - if ((*fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON) - beacon = 1; - - wl1251_rx_status(wl, desc, &status, beacon); - - wl1251_debug(DEBUG_RX, "rx skb 0x%p: %d B %s", skb, skb->len, - beacon ? "beacon" : ""); - - memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); - ieee80211_rx_ni(wl->hw, skb); -} - -static void wl1251_rx_ack(struct wl1251 *wl) -{ - u32 data, addr; - - if (wl->rx_current_buffer) { - addr = ACX_REG_INTERRUPT_TRIG_H; - data = INTR_TRIG_RX_PROC1; - } else { - addr = ACX_REG_INTERRUPT_TRIG; - data = INTR_TRIG_RX_PROC0; - } - - wl1251_reg_write32(wl, addr, data); - - /* Toggle buffer ring */ - wl->rx_current_buffer = !wl->rx_current_buffer; -} - - -void wl1251_rx(struct wl1251 *wl) -{ - struct wl1251_rx_descriptor *rx_desc; - - if (wl->state != WL1251_STATE_ON) - return; - - rx_desc = wl->rx_descriptor; - - /* We first read the frame's header */ - wl1251_rx_header(wl, rx_desc); - - /* Now we can read the body */ - wl1251_rx_body(wl, rx_desc); - - /* Finally, we need to ACK the RX */ - wl1251_rx_ack(wl); -} diff --git a/drivers/net/wireless/ti/wl1251/rx.h b/drivers/net/wireless/ti/wl1251/rx.h deleted file mode 100644 index 4448f635a4d8..000000000000 --- a/drivers/net/wireless/ti/wl1251/rx.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (c) 1998-2007 Texas Instruments Incorporated - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL1251_RX_H__ -#define __WL1251_RX_H__ - -#include - -#include "wl1251.h" - -/* - * RX PATH - * - * The Rx path uses a double buffer and an rx_contro structure, each located - * at a fixed address in the device memory. The host keeps track of which - * buffer is available and alternates between them on a per packet basis. - * The size of each of the two buffers is large enough to hold the longest - * 802.3 packet. - * The RX path goes like that: - * 1) The target generates an interrupt each time a new packet is received. - * There are 2 RX interrupts, one for each buffer. - * 2) The host reads the received packet from one of the double buffers. - * 3) The host triggers a target interrupt. - * 4) The target prepares the next RX packet. - */ - -#define WL1251_RX_MAX_RSSI -30 -#define WL1251_RX_MIN_RSSI -95 - -#define WL1251_RX_ALIGN_TO 4 -#define WL1251_RX_ALIGN(len) (((len) + WL1251_RX_ALIGN_TO - 1) & \ - ~(WL1251_RX_ALIGN_TO - 1)) - -#define SHORT_PREAMBLE_BIT BIT(0) -#define OFDM_RATE_BIT BIT(6) -#define PBCC_RATE_BIT BIT(7) - -#define PLCP_HEADER_LENGTH 8 -#define RX_DESC_PACKETID_SHIFT 11 -#define RX_MAX_PACKET_ID 3 - -#define RX_DESC_VALID_FCS 0x0001 -#define RX_DESC_MATCH_RXADDR1 0x0002 -#define RX_DESC_MCAST 0x0004 -#define RX_DESC_STAINTIM 0x0008 -#define RX_DESC_VIRTUAL_BM 0x0010 -#define RX_DESC_BCAST 0x0020 -#define RX_DESC_MATCH_SSID 0x0040 -#define RX_DESC_MATCH_BSSID 0x0080 -#define RX_DESC_ENCRYPTION_MASK 0x0300 -#define RX_DESC_MEASURMENT 0x0400 -#define RX_DESC_SEQNUM_MASK 0x1800 -#define RX_DESC_MIC_FAIL 0x2000 -#define RX_DESC_DECRYPT_FAIL 0x4000 - -struct wl1251_rx_descriptor { - u32 timestamp; /* In microseconds */ - u16 length; /* Paylod length, including headers */ - u16 flags; - - /* - * 0 - 802.11 - * 1 - 802.3 - * 2 - IP - * 3 - Raw Codec - */ - u8 type; - - /* - * Received Rate: - * 0x0A - 1MBPS - * 0x14 - 2MBPS - * 0x37 - 5_5MBPS - * 0x0B - 6MBPS - * 0x0F - 9MBPS - * 0x6E - 11MBPS - * 0x0A - 12MBPS - * 0x0E - 18MBPS - * 0xDC - 22MBPS - * 0x09 - 24MBPS - * 0x0D - 36MBPS - * 0x08 - 48MBPS - * 0x0C - 54MBPS - */ - u8 rate; - - u8 mod_pre; /* Modulation and preamble */ - u8 channel; - - /* - * 0 - 2.4 Ghz - * 1 - 5 Ghz - */ - u8 band; - - s8 rssi; /* in dB */ - u8 rcpi; /* in dB */ - u8 snr; /* in dB */ -} __packed; - -void wl1251_rx(struct wl1251 *wl); - -#endif diff --git a/drivers/net/wireless/ti/wl1251/sdio.c b/drivers/net/wireless/ti/wl1251/sdio.c deleted file mode 100644 index e2b3d9c541e8..000000000000 --- a/drivers/net/wireless/ti/wl1251/sdio.c +++ /dev/null @@ -1,376 +0,0 @@ -/* - * wl12xx SDIO routines - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - * Copyright (C) 2005 Texas Instruments Incorporated - * Copyright (C) 2008 Google Inc - * Copyright (C) 2009 Bob Copeland (me@bobcopeland.com) - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wl1251.h" - -#ifndef SDIO_VENDOR_ID_TI -#define SDIO_VENDOR_ID_TI 0x104c -#endif - -#ifndef SDIO_DEVICE_ID_TI_WL1251 -#define SDIO_DEVICE_ID_TI_WL1251 0x9066 -#endif - -struct wl1251_sdio { - struct sdio_func *func; - u32 elp_val; -}; - -static struct sdio_func *wl_to_func(struct wl1251 *wl) -{ - struct wl1251_sdio *wl_sdio = wl->if_priv; - return wl_sdio->func; -} - -static void wl1251_sdio_interrupt(struct sdio_func *func) -{ - struct wl1251 *wl = sdio_get_drvdata(func); - - wl1251_debug(DEBUG_IRQ, "IRQ"); - - /* FIXME should be synchronous for sdio */ - ieee80211_queue_work(wl->hw, &wl->irq_work); -} - -static const struct sdio_device_id wl1251_devices[] = { - { SDIO_DEVICE(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1251) }, - {} -}; -MODULE_DEVICE_TABLE(sdio, wl1251_devices); - - -static void wl1251_sdio_read(struct wl1251 *wl, int addr, - void *buf, size_t len) -{ - int ret; - struct sdio_func *func = wl_to_func(wl); - - sdio_claim_host(func); - ret = sdio_memcpy_fromio(func, buf, addr, len); - if (ret) - wl1251_error("sdio read failed (%d)", ret); - sdio_release_host(func); -} - -static void wl1251_sdio_write(struct wl1251 *wl, int addr, - void *buf, size_t len) -{ - int ret; - struct sdio_func *func = wl_to_func(wl); - - sdio_claim_host(func); - ret = sdio_memcpy_toio(func, addr, buf, len); - if (ret) - wl1251_error("sdio write failed (%d)", ret); - sdio_release_host(func); -} - -static void wl1251_sdio_read_elp(struct wl1251 *wl, int addr, u32 *val) -{ - int ret = 0; - struct wl1251_sdio *wl_sdio = wl->if_priv; - struct sdio_func *func = wl_sdio->func; - - /* - * The hardware only supports RAW (read after write) access for - * reading, regular sdio_readb won't work here (it interprets - * the unused bits of CMD52 as write data even if we send read - * request). - */ - sdio_claim_host(func); - *val = sdio_writeb_readb(func, wl_sdio->elp_val, addr, &ret); - sdio_release_host(func); - - if (ret) - wl1251_error("sdio_readb failed (%d)", ret); -} - -static void wl1251_sdio_write_elp(struct wl1251 *wl, int addr, u32 val) -{ - int ret = 0; - struct wl1251_sdio *wl_sdio = wl->if_priv; - struct sdio_func *func = wl_sdio->func; - - sdio_claim_host(func); - sdio_writeb(func, val, addr, &ret); - sdio_release_host(func); - - if (ret) - wl1251_error("sdio_writeb failed (%d)", ret); - else - wl_sdio->elp_val = val; -} - -static void wl1251_sdio_reset(struct wl1251 *wl) -{ -} - -static void wl1251_sdio_enable_irq(struct wl1251 *wl) -{ - struct sdio_func *func = wl_to_func(wl); - - sdio_claim_host(func); - sdio_claim_irq(func, wl1251_sdio_interrupt); - sdio_release_host(func); -} - -static void wl1251_sdio_disable_irq(struct wl1251 *wl) -{ - struct sdio_func *func = wl_to_func(wl); - - sdio_claim_host(func); - sdio_release_irq(func); - sdio_release_host(func); -} - -/* Interrupts when using dedicated WLAN_IRQ pin */ -static irqreturn_t wl1251_line_irq(int irq, void *cookie) -{ - struct wl1251 *wl = cookie; - - ieee80211_queue_work(wl->hw, &wl->irq_work); - - return IRQ_HANDLED; -} - -static void wl1251_enable_line_irq(struct wl1251 *wl) -{ - return enable_irq(wl->irq); -} - -static void wl1251_disable_line_irq(struct wl1251 *wl) -{ - return disable_irq(wl->irq); -} - -static int wl1251_sdio_set_power(struct wl1251 *wl, bool enable) -{ - struct sdio_func *func = wl_to_func(wl); - int ret; - - if (enable) { - /* - * Power is controlled by runtime PM, but we still call board - * callback in case it wants to do any additional setup, - * for example enabling clock buffer for the module. - */ - if (wl->set_power) - wl->set_power(true); - - ret = pm_runtime_get_sync(&func->dev); - if (ret < 0) { - pm_runtime_put_sync(&func->dev); - goto out; - } - - sdio_claim_host(func); - sdio_enable_func(func); - sdio_release_host(func); - } else { - sdio_claim_host(func); - sdio_disable_func(func); - sdio_release_host(func); - - ret = pm_runtime_put_sync(&func->dev); - if (ret < 0) - goto out; - - if (wl->set_power) - wl->set_power(false); - } - -out: - return ret; -} - -static struct wl1251_if_operations wl1251_sdio_ops = { - .read = wl1251_sdio_read, - .write = wl1251_sdio_write, - .write_elp = wl1251_sdio_write_elp, - .read_elp = wl1251_sdio_read_elp, - .reset = wl1251_sdio_reset, - .power = wl1251_sdio_set_power, -}; - -static int wl1251_sdio_probe(struct sdio_func *func, - const struct sdio_device_id *id) -{ - int ret; - struct wl1251 *wl; - struct ieee80211_hw *hw; - struct wl1251_sdio *wl_sdio; - const struct wl12xx_platform_data *wl12xx_board_data; - - hw = wl1251_alloc_hw(); - if (IS_ERR(hw)) - return PTR_ERR(hw); - - wl = hw->priv; - - wl_sdio = kzalloc(sizeof(*wl_sdio), GFP_KERNEL); - if (wl_sdio == NULL) { - ret = -ENOMEM; - goto out_free_hw; - } - - sdio_claim_host(func); - ret = sdio_enable_func(func); - if (ret) - goto release; - - sdio_set_block_size(func, 512); - sdio_release_host(func); - - SET_IEEE80211_DEV(hw, &func->dev); - wl_sdio->func = func; - wl->if_priv = wl_sdio; - wl->if_ops = &wl1251_sdio_ops; - - wl12xx_board_data = wl12xx_get_platform_data(); - if (!IS_ERR(wl12xx_board_data)) { - wl->set_power = wl12xx_board_data->set_power; - wl->irq = wl12xx_board_data->irq; - wl->use_eeprom = wl12xx_board_data->use_eeprom; - } - - if (wl->irq) { - irq_set_status_flags(wl->irq, IRQ_NOAUTOEN); - ret = request_irq(wl->irq, wl1251_line_irq, 0, "wl1251", wl); - if (ret < 0) { - wl1251_error("request_irq() failed: %d", ret); - goto disable; - } - - irq_set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING); - - wl1251_sdio_ops.enable_irq = wl1251_enable_line_irq; - wl1251_sdio_ops.disable_irq = wl1251_disable_line_irq; - - wl1251_info("using dedicated interrupt line"); - } else { - wl1251_sdio_ops.enable_irq = wl1251_sdio_enable_irq; - wl1251_sdio_ops.disable_irq = wl1251_sdio_disable_irq; - - wl1251_info("using SDIO interrupt"); - } - - ret = wl1251_init_ieee80211(wl); - if (ret) - goto out_free_irq; - - sdio_set_drvdata(func, wl); - - /* Tell PM core that we don't need the card to be powered now */ - pm_runtime_put_noidle(&func->dev); - - return ret; - -out_free_irq: - if (wl->irq) - free_irq(wl->irq, wl); -disable: - sdio_claim_host(func); - sdio_disable_func(func); -release: - sdio_release_host(func); - kfree(wl_sdio); -out_free_hw: - wl1251_free_hw(wl); - return ret; -} - -static void wl1251_sdio_remove(struct sdio_func *func) -{ - struct wl1251 *wl = sdio_get_drvdata(func); - struct wl1251_sdio *wl_sdio = wl->if_priv; - - /* Undo decrement done above in wl1251_probe */ - pm_runtime_get_noresume(&func->dev); - - if (wl->irq) - free_irq(wl->irq, wl); - wl1251_free_hw(wl); - kfree(wl_sdio); - - sdio_claim_host(func); - sdio_release_irq(func); - sdio_disable_func(func); - sdio_release_host(func); -} - -static int wl1251_suspend(struct device *dev) -{ - /* - * Tell MMC/SDIO core it's OK to power down the card - * (if it isn't already), but not to remove it completely. - */ - return 0; -} - -static int wl1251_resume(struct device *dev) -{ - return 0; -} - -static const struct dev_pm_ops wl1251_sdio_pm_ops = { - .suspend = wl1251_suspend, - .resume = wl1251_resume, -}; - -static struct sdio_driver wl1251_sdio_driver = { - .name = "wl1251_sdio", - .id_table = wl1251_devices, - .probe = wl1251_sdio_probe, - .remove = wl1251_sdio_remove, - .drv.pm = &wl1251_sdio_pm_ops, -}; - -static int __init wl1251_sdio_init(void) -{ - int err; - - err = sdio_register_driver(&wl1251_sdio_driver); - if (err) - wl1251_error("failed to register sdio driver: %d", err); - return err; -} - -static void __exit wl1251_sdio_exit(void) -{ - sdio_unregister_driver(&wl1251_sdio_driver); - wl1251_notice("unloaded"); -} - -module_init(wl1251_sdio_init); -module_exit(wl1251_sdio_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Kalle Valo "); diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c deleted file mode 100644 index 4c67c2f9ea71..000000000000 --- a/drivers/net/wireless/ti/wl1251/spi.c +++ /dev/null @@ -1,358 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "wl1251.h" -#include "reg.h" -#include "spi.h" - -static irqreturn_t wl1251_irq(int irq, void *cookie) -{ - struct wl1251 *wl; - - wl1251_debug(DEBUG_IRQ, "IRQ"); - - wl = cookie; - - ieee80211_queue_work(wl->hw, &wl->irq_work); - - return IRQ_HANDLED; -} - -static struct spi_device *wl_to_spi(struct wl1251 *wl) -{ - return wl->if_priv; -} - -static void wl1251_spi_reset(struct wl1251 *wl) -{ - u8 *cmd; - struct spi_transfer t; - struct spi_message m; - - cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); - if (!cmd) { - wl1251_error("could not allocate cmd for spi reset"); - return; - } - - memset(&t, 0, sizeof(t)); - spi_message_init(&m); - - memset(cmd, 0xff, WSPI_INIT_CMD_LEN); - - t.tx_buf = cmd; - t.len = WSPI_INIT_CMD_LEN; - spi_message_add_tail(&t, &m); - - spi_sync(wl_to_spi(wl), &m); - - wl1251_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN); - - kfree(cmd); -} - -static void wl1251_spi_wake(struct wl1251 *wl) -{ - u8 crc[WSPI_INIT_CMD_CRC_LEN], *cmd; - struct spi_transfer t; - struct spi_message m; - - cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); - if (!cmd) { - wl1251_error("could not allocate cmd for spi init"); - return; - } - - memset(crc, 0, sizeof(crc)); - memset(&t, 0, sizeof(t)); - spi_message_init(&m); - - /* - * Set WSPI_INIT_COMMAND - * the data is being send from the MSB to LSB - */ - cmd[2] = 0xff; - cmd[3] = 0xff; - cmd[1] = WSPI_INIT_CMD_START | WSPI_INIT_CMD_TX; - cmd[0] = 0; - cmd[7] = 0; - cmd[6] |= HW_ACCESS_WSPI_INIT_CMD_MASK << 3; - cmd[6] |= HW_ACCESS_WSPI_FIXED_BUSY_LEN & WSPI_INIT_CMD_FIXEDBUSY_LEN; - - if (HW_ACCESS_WSPI_FIXED_BUSY_LEN == 0) - cmd[5] |= WSPI_INIT_CMD_DIS_FIXEDBUSY; - else - cmd[5] |= WSPI_INIT_CMD_EN_FIXEDBUSY; - - cmd[5] |= WSPI_INIT_CMD_IOD | WSPI_INIT_CMD_IP | WSPI_INIT_CMD_CS - | WSPI_INIT_CMD_WSPI | WSPI_INIT_CMD_WS; - - crc[0] = cmd[1]; - crc[1] = cmd[0]; - crc[2] = cmd[7]; - crc[3] = cmd[6]; - crc[4] = cmd[5]; - - cmd[4] |= crc7(0, crc, WSPI_INIT_CMD_CRC_LEN) << 1; - cmd[4] |= WSPI_INIT_CMD_END; - - t.tx_buf = cmd; - t.len = WSPI_INIT_CMD_LEN; - spi_message_add_tail(&t, &m); - - spi_sync(wl_to_spi(wl), &m); - - wl1251_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN); - - kfree(cmd); -} - -static void wl1251_spi_reset_wake(struct wl1251 *wl) -{ - wl1251_spi_reset(wl); - wl1251_spi_wake(wl); -} - -static void wl1251_spi_read(struct wl1251 *wl, int addr, void *buf, - size_t len) -{ - struct spi_transfer t[3]; - struct spi_message m; - u8 *busy_buf; - u32 *cmd; - - cmd = &wl->buffer_cmd; - busy_buf = wl->buffer_busyword; - - *cmd = 0; - *cmd |= WSPI_CMD_READ; - *cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH; - *cmd |= addr & WSPI_CMD_BYTE_ADDR; - - spi_message_init(&m); - memset(t, 0, sizeof(t)); - - t[0].tx_buf = cmd; - t[0].len = 4; - spi_message_add_tail(&t[0], &m); - - /* Busy and non busy words read */ - t[1].rx_buf = busy_buf; - t[1].len = WL1251_BUSY_WORD_LEN; - spi_message_add_tail(&t[1], &m); - - t[2].rx_buf = buf; - t[2].len = len; - spi_message_add_tail(&t[2], &m); - - spi_sync(wl_to_spi(wl), &m); - - /* FIXME: check busy words */ - - wl1251_dump(DEBUG_SPI, "spi_read cmd -> ", cmd, sizeof(*cmd)); - wl1251_dump(DEBUG_SPI, "spi_read buf <- ", buf, len); -} - -static void wl1251_spi_write(struct wl1251 *wl, int addr, void *buf, - size_t len) -{ - struct spi_transfer t[2]; - struct spi_message m; - u32 *cmd; - - cmd = &wl->buffer_cmd; - - *cmd = 0; - *cmd |= WSPI_CMD_WRITE; - *cmd |= (len << WSPI_CMD_BYTE_LENGTH_OFFSET) & WSPI_CMD_BYTE_LENGTH; - *cmd |= addr & WSPI_CMD_BYTE_ADDR; - - spi_message_init(&m); - memset(t, 0, sizeof(t)); - - t[0].tx_buf = cmd; - t[0].len = sizeof(*cmd); - spi_message_add_tail(&t[0], &m); - - t[1].tx_buf = buf; - t[1].len = len; - spi_message_add_tail(&t[1], &m); - - spi_sync(wl_to_spi(wl), &m); - - wl1251_dump(DEBUG_SPI, "spi_write cmd -> ", cmd, sizeof(*cmd)); - wl1251_dump(DEBUG_SPI, "spi_write buf -> ", buf, len); -} - -static void wl1251_spi_enable_irq(struct wl1251 *wl) -{ - return enable_irq(wl->irq); -} - -static void wl1251_spi_disable_irq(struct wl1251 *wl) -{ - return disable_irq(wl->irq); -} - -static int wl1251_spi_set_power(struct wl1251 *wl, bool enable) -{ - if (wl->set_power) - wl->set_power(enable); - - return 0; -} - -static const struct wl1251_if_operations wl1251_spi_ops = { - .read = wl1251_spi_read, - .write = wl1251_spi_write, - .reset = wl1251_spi_reset_wake, - .enable_irq = wl1251_spi_enable_irq, - .disable_irq = wl1251_spi_disable_irq, - .power = wl1251_spi_set_power, -}; - -static int wl1251_spi_probe(struct spi_device *spi) -{ - struct wl12xx_platform_data *pdata; - struct ieee80211_hw *hw; - struct wl1251 *wl; - int ret; - - pdata = spi->dev.platform_data; - if (!pdata) { - wl1251_error("no platform data"); - return -ENODEV; - } - - hw = wl1251_alloc_hw(); - if (IS_ERR(hw)) - return PTR_ERR(hw); - - wl = hw->priv; - - SET_IEEE80211_DEV(hw, &spi->dev); - spi_set_drvdata(spi, wl); - wl->if_priv = spi; - wl->if_ops = &wl1251_spi_ops; - - /* This is the only SPI value that we need to set here, the rest - * comes from the board-peripherals file */ - spi->bits_per_word = 32; - - ret = spi_setup(spi); - if (ret < 0) { - wl1251_error("spi_setup failed"); - goto out_free; - } - - wl->set_power = pdata->set_power; - if (!wl->set_power) { - wl1251_error("set power function missing in platform data"); - return -ENODEV; - } - - wl->irq = spi->irq; - if (wl->irq < 0) { - wl1251_error("irq missing in platform data"); - return -ENODEV; - } - - wl->use_eeprom = pdata->use_eeprom; - - irq_set_status_flags(wl->irq, IRQ_NOAUTOEN); - ret = request_irq(wl->irq, wl1251_irq, 0, DRIVER_NAME, wl); - if (ret < 0) { - wl1251_error("request_irq() failed: %d", ret); - goto out_free; - } - - irq_set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING); - - ret = wl1251_init_ieee80211(wl); - if (ret) - goto out_irq; - - return 0; - - out_irq: - free_irq(wl->irq, wl); - - out_free: - ieee80211_free_hw(hw); - - return ret; -} - -static int wl1251_spi_remove(struct spi_device *spi) -{ - struct wl1251 *wl = spi_get_drvdata(spi); - - free_irq(wl->irq, wl); - wl1251_free_hw(wl); - - return 0; -} - -static struct spi_driver wl1251_spi_driver = { - .driver = { - .name = DRIVER_NAME, - .owner = THIS_MODULE, - }, - - .probe = wl1251_spi_probe, - .remove = wl1251_spi_remove, -}; - -static int __init wl1251_spi_init(void) -{ - int ret; - - ret = spi_register_driver(&wl1251_spi_driver); - if (ret < 0) { - wl1251_error("failed to register spi driver: %d", ret); - goto out; - } - -out: - return ret; -} - -static void __exit wl1251_spi_exit(void) -{ - spi_unregister_driver(&wl1251_spi_driver); - - wl1251_notice("unloaded"); -} - -module_init(wl1251_spi_init); -module_exit(wl1251_spi_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Kalle Valo "); -MODULE_ALIAS("spi:wl1251"); diff --git a/drivers/net/wireless/ti/wl1251/spi.h b/drivers/net/wireless/ti/wl1251/spi.h deleted file mode 100644 index 16d506955cc0..000000000000 --- a/drivers/net/wireless/ti/wl1251/spi.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (c) 1998-2007 Texas Instruments Incorporated - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL1251_SPI_H__ -#define __WL1251_SPI_H__ - -#include "cmd.h" -#include "acx.h" -#include "reg.h" - -#define WSPI_CMD_READ 0x40000000 -#define WSPI_CMD_WRITE 0x00000000 -#define WSPI_CMD_FIXED 0x20000000 -#define WSPI_CMD_BYTE_LENGTH 0x1FFE0000 -#define WSPI_CMD_BYTE_LENGTH_OFFSET 17 -#define WSPI_CMD_BYTE_ADDR 0x0001FFFF - -#define WSPI_INIT_CMD_CRC_LEN 5 - -#define WSPI_INIT_CMD_START 0x00 -#define WSPI_INIT_CMD_TX 0x40 -/* the extra bypass bit is sampled by the TNET as '1' */ -#define WSPI_INIT_CMD_BYPASS_BIT 0x80 -#define WSPI_INIT_CMD_FIXEDBUSY_LEN 0x07 -#define WSPI_INIT_CMD_EN_FIXEDBUSY 0x80 -#define WSPI_INIT_CMD_DIS_FIXEDBUSY 0x00 -#define WSPI_INIT_CMD_IOD 0x40 -#define WSPI_INIT_CMD_IP 0x20 -#define WSPI_INIT_CMD_CS 0x10 -#define WSPI_INIT_CMD_WS 0x08 -#define WSPI_INIT_CMD_WSPI 0x01 -#define WSPI_INIT_CMD_END 0x01 - -#define WSPI_INIT_CMD_LEN 8 - -#define HW_ACCESS_WSPI_FIXED_BUSY_LEN \ - ((WL1251_BUSY_WORD_LEN - 4) / sizeof(u32)) -#define HW_ACCESS_WSPI_INIT_CMD_MASK 0 - -#endif /* __WL1251_SPI_H__ */ diff --git a/drivers/net/wireless/ti/wl1251/tx.c b/drivers/net/wireless/ti/wl1251/tx.c deleted file mode 100644 index 28121c590a2b..000000000000 --- a/drivers/net/wireless/ti/wl1251/tx.c +++ /dev/null @@ -1,560 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (c) 1998-2007 Texas Instruments Incorporated - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include - -#include "wl1251.h" -#include "reg.h" -#include "tx.h" -#include "ps.h" -#include "io.h" - -static bool wl1251_tx_double_buffer_busy(struct wl1251 *wl, u32 data_out_count) -{ - int used, data_in_count; - - data_in_count = wl->data_in_count; - - if (data_in_count < data_out_count) - /* data_in_count has wrapped */ - data_in_count += TX_STATUS_DATA_OUT_COUNT_MASK + 1; - - used = data_in_count - data_out_count; - - WARN_ON(used < 0); - WARN_ON(used > DP_TX_PACKET_RING_CHUNK_NUM); - - if (used >= DP_TX_PACKET_RING_CHUNK_NUM) - return true; - else - return false; -} - -static int wl1251_tx_path_status(struct wl1251 *wl) -{ - u32 status, addr, data_out_count; - bool busy; - - addr = wl->data_path->tx_control_addr; - status = wl1251_mem_read32(wl, addr); - data_out_count = status & TX_STATUS_DATA_OUT_COUNT_MASK; - busy = wl1251_tx_double_buffer_busy(wl, data_out_count); - - if (busy) - return -EBUSY; - - return 0; -} - -static int wl1251_tx_id(struct wl1251 *wl, struct sk_buff *skb) -{ - int i; - - for (i = 0; i < FW_TX_CMPLT_BLOCK_SIZE; i++) - if (wl->tx_frames[i] == NULL) { - wl->tx_frames[i] = skb; - return i; - } - - return -EBUSY; -} - -static void wl1251_tx_control(struct tx_double_buffer_desc *tx_hdr, - struct ieee80211_tx_info *control, u16 fc) -{ - *(u16 *)&tx_hdr->control = 0; - - tx_hdr->control.rate_policy = 0; - - /* 802.11 packets */ - tx_hdr->control.packet_type = 0; - - if (control->flags & IEEE80211_TX_CTL_NO_ACK) - tx_hdr->control.ack_policy = 1; - - tx_hdr->control.tx_complete = 1; - - if ((fc & IEEE80211_FTYPE_DATA) && - ((fc & IEEE80211_STYPE_QOS_DATA) || - (fc & IEEE80211_STYPE_QOS_NULLFUNC))) - tx_hdr->control.qos = 1; -} - -/* RSN + MIC = 8 + 8 = 16 bytes (worst case - AES). */ -#define MAX_MSDU_SECURITY_LENGTH 16 -#define MAX_MPDU_SECURITY_LENGTH 16 -#define WLAN_QOS_HDR_LEN 26 -#define MAX_MPDU_HEADER_AND_SECURITY (MAX_MPDU_SECURITY_LENGTH + \ - WLAN_QOS_HDR_LEN) -#define HW_BLOCK_SIZE 252 -static void wl1251_tx_frag_block_num(struct tx_double_buffer_desc *tx_hdr) -{ - u16 payload_len, frag_threshold, mem_blocks; - u16 num_mpdus, mem_blocks_per_frag; - - frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD; - tx_hdr->frag_threshold = cpu_to_le16(frag_threshold); - - payload_len = le16_to_cpu(tx_hdr->length) + MAX_MSDU_SECURITY_LENGTH; - - if (payload_len > frag_threshold) { - mem_blocks_per_frag = - ((frag_threshold + MAX_MPDU_HEADER_AND_SECURITY) / - HW_BLOCK_SIZE) + 1; - num_mpdus = payload_len / frag_threshold; - mem_blocks = num_mpdus * mem_blocks_per_frag; - payload_len -= num_mpdus * frag_threshold; - num_mpdus++; - - } else { - mem_blocks_per_frag = 0; - mem_blocks = 0; - num_mpdus = 1; - } - - mem_blocks += (payload_len / HW_BLOCK_SIZE) + 1; - - if (num_mpdus > 1) - mem_blocks += min(num_mpdus, mem_blocks_per_frag); - - tx_hdr->num_mem_blocks = mem_blocks; -} - -static int wl1251_tx_fill_hdr(struct wl1251 *wl, struct sk_buff *skb, - struct ieee80211_tx_info *control) -{ - struct tx_double_buffer_desc *tx_hdr; - struct ieee80211_rate *rate; - int id; - u16 fc; - - if (!skb) - return -EINVAL; - - id = wl1251_tx_id(wl, skb); - if (id < 0) - return id; - - fc = *(u16 *)skb->data; - tx_hdr = (struct tx_double_buffer_desc *) skb_push(skb, - sizeof(*tx_hdr)); - - tx_hdr->length = cpu_to_le16(skb->len - sizeof(*tx_hdr)); - rate = ieee80211_get_tx_rate(wl->hw, control); - tx_hdr->rate = cpu_to_le16(rate->hw_value); - tx_hdr->expiry_time = cpu_to_le32(1 << 16); - tx_hdr->id = id; - - tx_hdr->xmit_queue = wl1251_tx_get_queue(skb_get_queue_mapping(skb)); - - wl1251_tx_control(tx_hdr, control, fc); - wl1251_tx_frag_block_num(tx_hdr); - - return 0; -} - -/* We copy the packet to the target */ -static int wl1251_tx_send_packet(struct wl1251 *wl, struct sk_buff *skb, - struct ieee80211_tx_info *control) -{ - struct tx_double_buffer_desc *tx_hdr; - int len; - u32 addr; - - if (!skb) - return -EINVAL; - - tx_hdr = (struct tx_double_buffer_desc *) skb->data; - - if (control->control.hw_key && - control->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) { - int hdrlen; - __le16 fc; - u16 length; - u8 *pos; - - fc = *(__le16 *)(skb->data + sizeof(*tx_hdr)); - length = le16_to_cpu(tx_hdr->length) + WL1251_TKIP_IV_SPACE; - tx_hdr->length = cpu_to_le16(length); - - hdrlen = ieee80211_hdrlen(fc); - - pos = skb_push(skb, WL1251_TKIP_IV_SPACE); - memmove(pos, pos + WL1251_TKIP_IV_SPACE, - sizeof(*tx_hdr) + hdrlen); - } - - /* Revisit. This is a workaround for getting non-aligned packets. - This happens at least with EAPOL packets from the user space. - Our DMA requires packets to be aligned on a 4-byte boundary. - */ - if (unlikely((long)skb->data & 0x03)) { - int offset = (4 - (long)skb->data) & 0x03; - wl1251_debug(DEBUG_TX, "skb offset %d", offset); - - /* check whether the current skb can be used */ - if (skb_cloned(skb) || (skb_tailroom(skb) < offset)) { - struct sk_buff *newskb = skb_copy_expand(skb, 0, 3, - GFP_KERNEL); - - if (unlikely(newskb == NULL)) { - wl1251_error("Can't allocate skb!"); - return -EINVAL; - } - - tx_hdr = (struct tx_double_buffer_desc *) newskb->data; - - dev_kfree_skb_any(skb); - wl->tx_frames[tx_hdr->id] = skb = newskb; - - offset = (4 - (long)skb->data) & 0x03; - wl1251_debug(DEBUG_TX, "new skb offset %d", offset); - } - - /* align the buffer on a 4-byte boundary */ - if (offset) { - unsigned char *src = skb->data; - skb_reserve(skb, offset); - memmove(skb->data, src, skb->len); - tx_hdr = (struct tx_double_buffer_desc *) skb->data; - } - } - - /* Our skb->data at this point includes the HW header */ - len = WL1251_TX_ALIGN(skb->len); - - if (wl->data_in_count & 0x1) - addr = wl->data_path->tx_packet_ring_addr + - wl->data_path->tx_packet_ring_chunk_size; - else - addr = wl->data_path->tx_packet_ring_addr; - - wl1251_mem_write(wl, addr, skb->data, len); - - wl1251_debug(DEBUG_TX, "tx id %u skb 0x%p payload %u rate 0x%x " - "queue %d", tx_hdr->id, skb, tx_hdr->length, - tx_hdr->rate, tx_hdr->xmit_queue); - - return 0; -} - -static void wl1251_tx_trigger(struct wl1251 *wl) -{ - u32 data, addr; - - if (wl->data_in_count & 0x1) { - addr = ACX_REG_INTERRUPT_TRIG_H; - data = INTR_TRIG_TX_PROC1; - } else { - addr = ACX_REG_INTERRUPT_TRIG; - data = INTR_TRIG_TX_PROC0; - } - - wl1251_reg_write32(wl, addr, data); - - /* Bumping data in */ - wl->data_in_count = (wl->data_in_count + 1) & - TX_STATUS_DATA_OUT_COUNT_MASK; -} - -/* caller must hold wl->mutex */ -static int wl1251_tx_frame(struct wl1251 *wl, struct sk_buff *skb) -{ - struct ieee80211_tx_info *info; - int ret = 0; - u8 idx; - - info = IEEE80211_SKB_CB(skb); - - if (info->control.hw_key) { - idx = info->control.hw_key->hw_key_idx; - if (unlikely(wl->default_key != idx)) { - ret = wl1251_acx_default_key(wl, idx); - if (ret < 0) - return ret; - } - } - - ret = wl1251_tx_path_status(wl); - if (ret < 0) - return ret; - - ret = wl1251_tx_fill_hdr(wl, skb, info); - if (ret < 0) - return ret; - - ret = wl1251_tx_send_packet(wl, skb, info); - if (ret < 0) - return ret; - - wl1251_tx_trigger(wl); - - return ret; -} - -void wl1251_tx_work(struct work_struct *work) -{ - struct wl1251 *wl = container_of(work, struct wl1251, tx_work); - struct sk_buff *skb; - bool woken_up = false; - int ret; - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state == WL1251_STATE_OFF)) - goto out; - - while ((skb = skb_dequeue(&wl->tx_queue))) { - if (!woken_up) { - ret = wl1251_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - woken_up = true; - } - - ret = wl1251_tx_frame(wl, skb); - if (ret == -EBUSY) { - skb_queue_head(&wl->tx_queue, skb); - goto out; - } else if (ret < 0) { - dev_kfree_skb(skb); - goto out; - } - } - -out: - if (woken_up) - wl1251_ps_elp_sleep(wl); - - mutex_unlock(&wl->mutex); -} - -static const char *wl1251_tx_parse_status(u8 status) -{ - /* 8 bit status field, one character per bit plus null */ - static char buf[9]; - int i = 0; - - memset(buf, 0, sizeof(buf)); - - if (status & TX_DMA_ERROR) - buf[i++] = 'm'; - if (status & TX_DISABLED) - buf[i++] = 'd'; - if (status & TX_RETRY_EXCEEDED) - buf[i++] = 'r'; - if (status & TX_TIMEOUT) - buf[i++] = 't'; - if (status & TX_KEY_NOT_FOUND) - buf[i++] = 'k'; - if (status & TX_ENCRYPT_FAIL) - buf[i++] = 'e'; - if (status & TX_UNAVAILABLE_PRIORITY) - buf[i++] = 'p'; - - /* bit 0 is unused apparently */ - - return buf; -} - -static void wl1251_tx_packet_cb(struct wl1251 *wl, - struct tx_result *result) -{ - struct ieee80211_tx_info *info; - struct sk_buff *skb; - int hdrlen; - u8 *frame; - - skb = wl->tx_frames[result->id]; - if (skb == NULL) { - wl1251_error("SKB for packet %d is NULL", result->id); - return; - } - - info = IEEE80211_SKB_CB(skb); - - if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) && - (result->status == TX_SUCCESS)) - info->flags |= IEEE80211_TX_STAT_ACK; - - info->status.rates[0].count = result->ack_failures + 1; - wl->stats.retry_count += result->ack_failures; - - /* - * We have to remove our private TX header before pushing - * the skb back to mac80211. - */ - frame = skb_pull(skb, sizeof(struct tx_double_buffer_desc)); - if (info->control.hw_key && - info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) { - hdrlen = ieee80211_get_hdrlen_from_skb(skb); - memmove(frame + WL1251_TKIP_IV_SPACE, frame, hdrlen); - skb_pull(skb, WL1251_TKIP_IV_SPACE); - } - - wl1251_debug(DEBUG_TX, "tx status id %u skb 0x%p failures %u rate 0x%x" - " status 0x%x (%s)", - result->id, skb, result->ack_failures, result->rate, - result->status, wl1251_tx_parse_status(result->status)); - - - ieee80211_tx_status(wl->hw, skb); - - wl->tx_frames[result->id] = NULL; -} - -/* Called upon reception of a TX complete interrupt */ -void wl1251_tx_complete(struct wl1251 *wl) -{ - int i, result_index, num_complete = 0, queue_len; - struct tx_result result[FW_TX_CMPLT_BLOCK_SIZE], *result_ptr; - unsigned long flags; - - if (unlikely(wl->state != WL1251_STATE_ON)) - return; - - /* First we read the result */ - wl1251_mem_read(wl, wl->data_path->tx_complete_addr, - result, sizeof(result)); - - result_index = wl->next_tx_complete; - - for (i = 0; i < ARRAY_SIZE(result); i++) { - result_ptr = &result[result_index]; - - if (result_ptr->done_1 == 1 && - result_ptr->done_2 == 1) { - wl1251_tx_packet_cb(wl, result_ptr); - - result_ptr->done_1 = 0; - result_ptr->done_2 = 0; - - result_index = (result_index + 1) & - (FW_TX_CMPLT_BLOCK_SIZE - 1); - num_complete++; - } else { - break; - } - } - - queue_len = skb_queue_len(&wl->tx_queue); - - if ((num_complete > 0) && (queue_len > 0)) { - /* firmware buffer has space, reschedule tx_work */ - wl1251_debug(DEBUG_TX, "tx_complete: reschedule tx_work"); - ieee80211_queue_work(wl->hw, &wl->tx_work); - } - - if (wl->tx_queue_stopped && - queue_len <= WL1251_TX_QUEUE_LOW_WATERMARK) { - /* tx_queue has space, restart queues */ - wl1251_debug(DEBUG_TX, "tx_complete: waking queues"); - spin_lock_irqsave(&wl->wl_lock, flags); - ieee80211_wake_queues(wl->hw); - wl->tx_queue_stopped = false; - spin_unlock_irqrestore(&wl->wl_lock, flags); - } - - /* Every completed frame needs to be acknowledged */ - if (num_complete) { - /* - * If we've wrapped, we have to clear - * the results in 2 steps. - */ - if (result_index > wl->next_tx_complete) { - /* Only 1 write is needed */ - wl1251_mem_write(wl, - wl->data_path->tx_complete_addr + - (wl->next_tx_complete * - sizeof(struct tx_result)), - &result[wl->next_tx_complete], - num_complete * - sizeof(struct tx_result)); - - - } else if (result_index < wl->next_tx_complete) { - /* 2 writes are needed */ - wl1251_mem_write(wl, - wl->data_path->tx_complete_addr + - (wl->next_tx_complete * - sizeof(struct tx_result)), - &result[wl->next_tx_complete], - (FW_TX_CMPLT_BLOCK_SIZE - - wl->next_tx_complete) * - sizeof(struct tx_result)); - - wl1251_mem_write(wl, - wl->data_path->tx_complete_addr, - result, - (num_complete - - FW_TX_CMPLT_BLOCK_SIZE + - wl->next_tx_complete) * - sizeof(struct tx_result)); - - } else { - /* We have to write the whole array */ - wl1251_mem_write(wl, - wl->data_path->tx_complete_addr, - result, - FW_TX_CMPLT_BLOCK_SIZE * - sizeof(struct tx_result)); - } - - } - - wl->next_tx_complete = result_index; -} - -/* caller must hold wl->mutex */ -void wl1251_tx_flush(struct wl1251 *wl) -{ - int i; - struct sk_buff *skb; - struct ieee80211_tx_info *info; - - /* TX failure */ -/* control->flags = 0; FIXME */ - - while ((skb = skb_dequeue(&wl->tx_queue))) { - info = IEEE80211_SKB_CB(skb); - - wl1251_debug(DEBUG_TX, "flushing skb 0x%p", skb); - - if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) - continue; - - ieee80211_tx_status(wl->hw, skb); - } - - for (i = 0; i < FW_TX_CMPLT_BLOCK_SIZE; i++) - if (wl->tx_frames[i] != NULL) { - skb = wl->tx_frames[i]; - info = IEEE80211_SKB_CB(skb); - - if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) - continue; - - ieee80211_tx_status(wl->hw, skb); - wl->tx_frames[i] = NULL; - } -} diff --git a/drivers/net/wireless/ti/wl1251/tx.h b/drivers/net/wireless/ti/wl1251/tx.h deleted file mode 100644 index 81338d39b43e..000000000000 --- a/drivers/net/wireless/ti/wl1251/tx.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (c) 1998-2007 Texas Instruments Incorporated - * Copyright (C) 2008 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL1251_TX_H__ -#define __WL1251_TX_H__ - -#include -#include "acx.h" - -/* - * - * TX PATH - * - * The Tx path uses a double buffer and a tx_control structure, each located - * at a fixed address in the device's memory. On startup, the host retrieves - * the pointers to these addresses. A double buffer allows for continuous data - * flow towards the device. The host keeps track of which buffer is available - * and alternates between these two buffers on a per packet basis. - * - * The size of each of the two buffers is large enough to hold the longest - * 802.3 packet - maximum size Ethernet packet + header + descriptor. - * TX complete indication will be received a-synchronously in a TX done cyclic - * buffer which is composed of 16 tx_result descriptors structures and is used - * in a cyclic manner. - * - * The TX (HOST) procedure is as follows: - * 1. Read the Tx path status, that will give the data_out_count. - * 2. goto 1, if not possible. - * i.e. if data_in_count - data_out_count >= HwBuffer size (2 for double - * buffer). - * 3. Copy the packet (preceded by double_buffer_desc), if possible. - * i.e. if data_in_count - data_out_count < HwBuffer size (2 for double - * buffer). - * 4. increment data_in_count. - * 5. Inform the firmware by generating a firmware internal interrupt. - * 6. FW will increment data_out_count after it reads the buffer. - * - * The TX Complete procedure: - * 1. To get a TX complete indication the host enables the tx_complete flag in - * the TX descriptor Structure. - * 2. For each packet with a Tx Complete field set, the firmware adds the - * transmit results to the cyclic buffer (txDoneRing) and sets both done_1 - * and done_2 to 1 to indicate driver ownership. - * 3. The firmware sends a Tx Complete interrupt to the host to trigger the - * host to process the new data. Note: interrupt will be send per packet if - * TX complete indication was requested in tx_control or per crossing - * aggregation threshold. - * 4. After receiving the Tx Complete interrupt, the host reads the - * TxDescriptorDone information in a cyclic manner and clears both done_1 - * and done_2 fields. - * - */ - -#define TX_COMPLETE_REQUIRED_BIT 0x80 -#define TX_STATUS_DATA_OUT_COUNT_MASK 0xf - -#define WL1251_TX_ALIGN_TO 4 -#define WL1251_TX_ALIGN(len) (((len) + WL1251_TX_ALIGN_TO - 1) & \ - ~(WL1251_TX_ALIGN_TO - 1)) -#define WL1251_TKIP_IV_SPACE 4 - -struct tx_control { - /* Rate Policy (class) index */ - unsigned rate_policy:3; - - /* When set, no ack policy is expected */ - unsigned ack_policy:1; - - /* - * Packet type: - * 0 -> 802.11 - * 1 -> 802.3 - * 2 -> IP - * 3 -> raw codec - */ - unsigned packet_type:2; - - /* If set, this is a QoS-Null or QoS-Data frame */ - unsigned qos:1; - - /* - * If set, the target triggers the tx complete INT - * upon frame sending completion. - */ - unsigned tx_complete:1; - - /* 2 bytes padding before packet header */ - unsigned xfer_pad:1; - - unsigned reserved:7; -} __packed; - - -struct tx_double_buffer_desc { - /* Length of payload, including headers. */ - __le16 length; - - /* - * A bit mask that specifies the initial rate to be used - * Possible values are: - * 0x0001 - 1Mbits - * 0x0002 - 2Mbits - * 0x0004 - 5.5Mbits - * 0x0008 - 6Mbits - * 0x0010 - 9Mbits - * 0x0020 - 11Mbits - * 0x0040 - 12Mbits - * 0x0080 - 18Mbits - * 0x0100 - 22Mbits - * 0x0200 - 24Mbits - * 0x0400 - 36Mbits - * 0x0800 - 48Mbits - * 0x1000 - 54Mbits - */ - __le16 rate; - - /* Time in us that a packet can spend in the target */ - __le32 expiry_time; - - /* index of the TX queue used for this packet */ - u8 xmit_queue; - - /* Used to identify a packet */ - u8 id; - - struct tx_control control; - - /* - * The FW should cut the packet into fragments - * of this size. - */ - __le16 frag_threshold; - - /* Numbers of HW queue blocks to be allocated */ - u8 num_mem_blocks; - - u8 reserved; -} __packed; - -enum { - TX_SUCCESS = 0, - TX_DMA_ERROR = BIT(7), - TX_DISABLED = BIT(6), - TX_RETRY_EXCEEDED = BIT(5), - TX_TIMEOUT = BIT(4), - TX_KEY_NOT_FOUND = BIT(3), - TX_ENCRYPT_FAIL = BIT(2), - TX_UNAVAILABLE_PRIORITY = BIT(1), -}; - -struct tx_result { - /* - * Ownership synchronization between the host and - * the firmware. If done_1 and done_2 are cleared, - * owned by the FW (no info ready). - */ - u8 done_1; - - /* same as double_buffer_desc->id */ - u8 id; - - /* - * Total air access duration consumed by this - * packet, including all retries and overheads. - */ - u16 medium_usage; - - /* Total media delay (from 1st EDCA AIFS counter until TX Complete). */ - u32 medium_delay; - - /* Time between host xfer and tx complete */ - u32 fw_hnadling_time; - - /* The LS-byte of the last TKIP sequence number. */ - u8 lsb_seq_num; - - /* Retry count */ - u8 ack_failures; - - /* At which rate we got a ACK */ - u16 rate; - - u16 reserved; - - /* TX_* */ - u8 status; - - /* See done_1 */ - u8 done_2; -} __packed; - -static inline int wl1251_tx_get_queue(int queue) -{ - switch (queue) { - case 0: - return QOS_AC_VO; - case 1: - return QOS_AC_VI; - case 2: - return QOS_AC_BE; - case 3: - return QOS_AC_BK; - default: - return QOS_AC_BE; - } -} - -void wl1251_tx_work(struct work_struct *work); -void wl1251_tx_complete(struct wl1251 *wl); -void wl1251_tx_flush(struct wl1251 *wl); - -#endif diff --git a/drivers/net/wireless/ti/wl1251/wl1251.h b/drivers/net/wireless/ti/wl1251/wl1251.h deleted file mode 100644 index fd02060038de..000000000000 --- a/drivers/net/wireless/ti/wl1251/wl1251.h +++ /dev/null @@ -1,445 +0,0 @@ -/* - * This file is part of wl1251 - * - * Copyright (c) 1998-2007 Texas Instruments Incorporated - * Copyright (C) 2008-2009 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL1251_H__ -#define __WL1251_H__ - -#include -#include -#include -#include - -#define DRIVER_NAME "wl1251" -#define DRIVER_PREFIX DRIVER_NAME ": " - -enum { - DEBUG_NONE = 0, - DEBUG_IRQ = BIT(0), - DEBUG_SPI = BIT(1), - DEBUG_BOOT = BIT(2), - DEBUG_MAILBOX = BIT(3), - DEBUG_NETLINK = BIT(4), - DEBUG_EVENT = BIT(5), - DEBUG_TX = BIT(6), - DEBUG_RX = BIT(7), - DEBUG_SCAN = BIT(8), - DEBUG_CRYPT = BIT(9), - DEBUG_PSM = BIT(10), - DEBUG_MAC80211 = BIT(11), - DEBUG_CMD = BIT(12), - DEBUG_ACX = BIT(13), - DEBUG_ALL = ~0, -}; - -#define DEBUG_LEVEL (DEBUG_NONE) - -#define DEBUG_DUMP_LIMIT 1024 - -#define wl1251_error(fmt, arg...) \ - printk(KERN_ERR DRIVER_PREFIX "ERROR " fmt "\n", ##arg) - -#define wl1251_warning(fmt, arg...) \ - printk(KERN_WARNING DRIVER_PREFIX "WARNING " fmt "\n", ##arg) - -#define wl1251_notice(fmt, arg...) \ - printk(KERN_INFO DRIVER_PREFIX fmt "\n", ##arg) - -#define wl1251_info(fmt, arg...) \ - printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg) - -#define wl1251_debug(level, fmt, arg...) \ - do { \ - if (level & DEBUG_LEVEL) \ - printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg); \ - } while (0) - -#define wl1251_dump(level, prefix, buf, len) \ - do { \ - if (level & DEBUG_LEVEL) \ - print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \ - DUMP_PREFIX_OFFSET, 16, 1, \ - buf, \ - min_t(size_t, len, DEBUG_DUMP_LIMIT), \ - 0); \ - } while (0) - -#define wl1251_dump_ascii(level, prefix, buf, len) \ - do { \ - if (level & DEBUG_LEVEL) \ - print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \ - DUMP_PREFIX_OFFSET, 16, 1, \ - buf, \ - min_t(size_t, len, DEBUG_DUMP_LIMIT), \ - true); \ - } while (0) - -#define WL1251_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN | \ - CFG_BSSID_FILTER_EN) - -#define WL1251_DEFAULT_RX_FILTER (CFG_RX_PRSP_EN | \ - CFG_RX_MGMT_EN | \ - CFG_RX_DATA_EN | \ - CFG_RX_CTL_EN | \ - CFG_RX_BCN_EN | \ - CFG_RX_AUTH_EN | \ - CFG_RX_ASSOC_EN) - -#define WL1251_BUSY_WORD_LEN 8 - -struct boot_attr { - u32 radio_type; - u8 mac_clock; - u8 arm_clock; - int firmware_debug; - u32 minor; - u32 major; - u32 bugfix; -}; - -enum wl1251_state { - WL1251_STATE_OFF, - WL1251_STATE_ON, - WL1251_STATE_PLT, -}; - -enum wl1251_partition_type { - PART_DOWN, - PART_WORK, - PART_DRPW, - - PART_TABLE_LEN -}; - -enum wl1251_station_mode { - STATION_ACTIVE_MODE, - STATION_POWER_SAVE_MODE, - STATION_IDLE, -}; - -struct wl1251_partition { - u32 size; - u32 start; -}; - -struct wl1251_partition_set { - struct wl1251_partition mem; - struct wl1251_partition reg; -}; - -struct wl1251; - -struct wl1251_stats { - struct acx_statistics *fw_stats; - unsigned long fw_stats_update; - - unsigned int retry_count; - unsigned int excessive_retries; -}; - -struct wl1251_debugfs { - struct dentry *rootdir; - struct dentry *fw_statistics; - - struct dentry *tx_internal_desc_overflow; - - struct dentry *rx_out_of_mem; - struct dentry *rx_hdr_overflow; - struct dentry *rx_hw_stuck; - struct dentry *rx_dropped; - struct dentry *rx_fcs_err; - struct dentry *rx_xfr_hint_trig; - struct dentry *rx_path_reset; - struct dentry *rx_reset_counter; - - struct dentry *dma_rx_requested; - struct dentry *dma_rx_errors; - struct dentry *dma_tx_requested; - struct dentry *dma_tx_errors; - - struct dentry *isr_cmd_cmplt; - struct dentry *isr_fiqs; - struct dentry *isr_rx_headers; - struct dentry *isr_rx_mem_overflow; - struct dentry *isr_rx_rdys; - struct dentry *isr_irqs; - struct dentry *isr_tx_procs; - struct dentry *isr_decrypt_done; - struct dentry *isr_dma0_done; - struct dentry *isr_dma1_done; - struct dentry *isr_tx_exch_complete; - struct dentry *isr_commands; - struct dentry *isr_rx_procs; - struct dentry *isr_hw_pm_mode_changes; - struct dentry *isr_host_acknowledges; - struct dentry *isr_pci_pm; - struct dentry *isr_wakeups; - struct dentry *isr_low_rssi; - - struct dentry *wep_addr_key_count; - struct dentry *wep_default_key_count; - /* skipping wep.reserved */ - struct dentry *wep_key_not_found; - struct dentry *wep_decrypt_fail; - struct dentry *wep_packets; - struct dentry *wep_interrupt; - - struct dentry *pwr_ps_enter; - struct dentry *pwr_elp_enter; - struct dentry *pwr_missing_bcns; - struct dentry *pwr_wake_on_host; - struct dentry *pwr_wake_on_timer_exp; - struct dentry *pwr_tx_with_ps; - struct dentry *pwr_tx_without_ps; - struct dentry *pwr_rcvd_beacons; - struct dentry *pwr_power_save_off; - struct dentry *pwr_enable_ps; - struct dentry *pwr_disable_ps; - struct dentry *pwr_fix_tsf_ps; - /* skipping cont_miss_bcns_spread for now */ - struct dentry *pwr_rcvd_awake_beacons; - - struct dentry *mic_rx_pkts; - struct dentry *mic_calc_failure; - - struct dentry *aes_encrypt_fail; - struct dentry *aes_decrypt_fail; - struct dentry *aes_encrypt_packets; - struct dentry *aes_decrypt_packets; - struct dentry *aes_encrypt_interrupt; - struct dentry *aes_decrypt_interrupt; - - struct dentry *event_heart_beat; - struct dentry *event_calibration; - struct dentry *event_rx_mismatch; - struct dentry *event_rx_mem_empty; - struct dentry *event_rx_pool; - struct dentry *event_oom_late; - struct dentry *event_phy_transmit_error; - struct dentry *event_tx_stuck; - - struct dentry *ps_pspoll_timeouts; - struct dentry *ps_upsd_timeouts; - struct dentry *ps_upsd_max_sptime; - struct dentry *ps_upsd_max_apturn; - struct dentry *ps_pspoll_max_apturn; - struct dentry *ps_pspoll_utilization; - struct dentry *ps_upsd_utilization; - - struct dentry *rxpipe_rx_prep_beacon_drop; - struct dentry *rxpipe_descr_host_int_trig_rx_data; - struct dentry *rxpipe_beacon_buffer_thres_host_int_trig_rx_data; - struct dentry *rxpipe_missed_beacon_host_int_trig_rx_data; - struct dentry *rxpipe_tx_xfr_host_int_trig_rx_data; - - struct dentry *tx_queue_len; - struct dentry *tx_queue_status; - - struct dentry *retry_count; - struct dentry *excessive_retries; -}; - -struct wl1251_if_operations { - void (*read)(struct wl1251 *wl, int addr, void *buf, size_t len); - void (*write)(struct wl1251 *wl, int addr, void *buf, size_t len); - void (*read_elp)(struct wl1251 *wl, int addr, u32 *val); - void (*write_elp)(struct wl1251 *wl, int addr, u32 val); - int (*power)(struct wl1251 *wl, bool enable); - void (*reset)(struct wl1251 *wl); - void (*enable_irq)(struct wl1251 *wl); - void (*disable_irq)(struct wl1251 *wl); -}; - -struct wl1251 { - struct ieee80211_hw *hw; - bool mac80211_registered; - - void *if_priv; - const struct wl1251_if_operations *if_ops; - - void (*set_power)(bool enable); - int irq; - bool use_eeprom; - - spinlock_t wl_lock; - - enum wl1251_state state; - struct mutex mutex; - - int physical_mem_addr; - int physical_reg_addr; - int virtual_mem_addr; - int virtual_reg_addr; - - int cmd_box_addr; - int event_box_addr; - struct boot_attr boot_attr; - - u8 *fw; - size_t fw_len; - u8 *nvs; - size_t nvs_len; - - u8 bssid[ETH_ALEN]; - u8 mac_addr[ETH_ALEN]; - u8 bss_type; - u8 listen_int; - int channel; - - void *target_mem_map; - struct acx_data_path_params_resp *data_path; - - /* Number of TX packets transferred to the FW, modulo 16 */ - u32 data_in_count; - - /* Frames scheduled for transmission, not handled yet */ - struct sk_buff_head tx_queue; - bool tx_queue_stopped; - - struct work_struct tx_work; - - /* Pending TX frames */ - struct sk_buff *tx_frames[16]; - - /* - * Index pointing to the next TX complete entry - * in the cyclic XT complete array we get from - * the FW. - */ - u32 next_tx_complete; - - /* FW Rx counter */ - u32 rx_counter; - - /* Rx frames handled */ - u32 rx_handled; - - /* Current double buffer */ - u32 rx_current_buffer; - u32 rx_last_id; - - /* The target interrupt mask */ - u32 intr_mask; - struct work_struct irq_work; - - /* The mbox event mask */ - u32 event_mask; - - /* Mailbox pointers */ - u32 mbox_ptr[2]; - - /* Are we currently scanning */ - bool scanning; - - /* Default key (for WEP) */ - u32 default_key; - - unsigned int tx_mgmt_frm_rate; - unsigned int tx_mgmt_frm_mod; - - unsigned int rx_config; - unsigned int rx_filter; - - /* is firmware in elp mode */ - bool elp; - - struct delayed_work elp_work; - - enum wl1251_station_mode station_mode; - - /* PSM mode requested */ - bool psm_requested; - - u16 beacon_int; - u8 dtim_period; - - /* in dBm */ - int power_level; - - int rssi_thold; - - struct wl1251_stats stats; - struct wl1251_debugfs debugfs; - - __le32 buffer_32; - u32 buffer_cmd; - u8 buffer_busyword[WL1251_BUSY_WORD_LEN]; - struct wl1251_rx_descriptor *rx_descriptor; - - struct ieee80211_vif *vif; - - u32 chip_id; - char fw_ver[21]; - - /* Most recently reported noise in dBm */ - s8 noise; -}; - -int wl1251_plt_start(struct wl1251 *wl); -int wl1251_plt_stop(struct wl1251 *wl); - -struct ieee80211_hw *wl1251_alloc_hw(void); -int wl1251_free_hw(struct wl1251 *wl); -int wl1251_init_ieee80211(struct wl1251 *wl); -void wl1251_enable_interrupts(struct wl1251 *wl); -void wl1251_disable_interrupts(struct wl1251 *wl); - -#define DEFAULT_HW_GEN_MODULATION_TYPE CCK_LONG /* Long Preamble */ -#define DEFAULT_HW_GEN_TX_RATE RATE_2MBPS -#define JOIN_TIMEOUT 5000 /* 5000 milliseconds to join */ - -#define WL1251_DEFAULT_POWER_LEVEL 20 - -#define WL1251_TX_QUEUE_LOW_WATERMARK 10 -#define WL1251_TX_QUEUE_HIGH_WATERMARK 25 - -#define WL1251_DEFAULT_BEACON_INT 100 -#define WL1251_DEFAULT_DTIM_PERIOD 1 - -#define WL1251_DEFAULT_CHANNEL 0 - -#define WL1251_DEFAULT_BET_CONSECUTIVE 10 - -#define CHIP_ID_1251_PG10 (0x7010101) -#define CHIP_ID_1251_PG11 (0x7020101) -#define CHIP_ID_1251_PG12 (0x7030101) -#define CHIP_ID_1271_PG10 (0x4030101) -#define CHIP_ID_1271_PG20 (0x4030111) - -#define WL1251_FW_NAME "wl1251-fw.bin" -#define WL1251_NVS_NAME "wl1251-nvs.bin" - -#define WL1251_POWER_ON_SLEEP 10 /* in milliseconds */ - -#define WL1251_PART_DOWN_MEM_START 0x0 -#define WL1251_PART_DOWN_MEM_SIZE 0x16800 -#define WL1251_PART_DOWN_REG_START REGISTERS_BASE -#define WL1251_PART_DOWN_REG_SIZE REGISTERS_DOWN_SIZE - -#define WL1251_PART_WORK_MEM_START 0x28000 -#define WL1251_PART_WORK_MEM_SIZE 0x14000 -#define WL1251_PART_WORK_REG_START REGISTERS_BASE -#define WL1251_PART_WORK_REG_SIZE REGISTERS_WORK_SIZE - -#define WL1251_DEFAULT_LOW_RSSI_WEIGHT 10 -#define WL1251_DEFAULT_LOW_RSSI_DEPTH 10 - -#endif diff --git a/drivers/net/wireless/ti/wl1251/wl12xx_80211.h b/drivers/net/wireless/ti/wl1251/wl12xx_80211.h deleted file mode 100644 index 04ed51495772..000000000000 --- a/drivers/net/wireless/ti/wl1251/wl12xx_80211.h +++ /dev/null @@ -1,155 +0,0 @@ -#ifndef __WL12XX_80211_H__ -#define __WL12XX_80211_H__ - -#include /* ETH_ALEN */ - -/* RATES */ -#define IEEE80211_CCK_RATE_1MB 0x02 -#define IEEE80211_CCK_RATE_2MB 0x04 -#define IEEE80211_CCK_RATE_5MB 0x0B -#define IEEE80211_CCK_RATE_11MB 0x16 -#define IEEE80211_OFDM_RATE_6MB 0x0C -#define IEEE80211_OFDM_RATE_9MB 0x12 -#define IEEE80211_OFDM_RATE_12MB 0x18 -#define IEEE80211_OFDM_RATE_18MB 0x24 -#define IEEE80211_OFDM_RATE_24MB 0x30 -#define IEEE80211_OFDM_RATE_36MB 0x48 -#define IEEE80211_OFDM_RATE_48MB 0x60 -#define IEEE80211_OFDM_RATE_54MB 0x6C -#define IEEE80211_BASIC_RATE_MASK 0x80 - -#define IEEE80211_CCK_RATE_1MB_MASK (1<<0) -#define IEEE80211_CCK_RATE_2MB_MASK (1<<1) -#define IEEE80211_CCK_RATE_5MB_MASK (1<<2) -#define IEEE80211_CCK_RATE_11MB_MASK (1<<3) -#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4) -#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5) -#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6) -#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7) -#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8) -#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9) -#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) -#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) - -#define IEEE80211_CCK_RATES_MASK 0x0000000F -#define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ - IEEE80211_CCK_RATE_2MB_MASK) -#define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ - IEEE80211_CCK_RATE_5MB_MASK | \ - IEEE80211_CCK_RATE_11MB_MASK) - -#define IEEE80211_OFDM_RATES_MASK 0x00000FF0 -#define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ - IEEE80211_OFDM_RATE_12MB_MASK | \ - IEEE80211_OFDM_RATE_24MB_MASK) -#define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \ - IEEE80211_OFDM_RATE_9MB_MASK | \ - IEEE80211_OFDM_RATE_18MB_MASK | \ - IEEE80211_OFDM_RATE_36MB_MASK | \ - IEEE80211_OFDM_RATE_48MB_MASK | \ - IEEE80211_OFDM_RATE_54MB_MASK) -#define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ - IEEE80211_CCK_DEFAULT_RATES_MASK) - - -/* This really should be 8, but not for our firmware */ -#define MAX_SUPPORTED_RATES 32 -#define MAX_COUNTRY_TRIPLETS 32 - -/* Headers */ -struct ieee80211_header { - __le16 frame_ctl; - __le16 duration_id; - u8 da[ETH_ALEN]; - u8 sa[ETH_ALEN]; - u8 bssid[ETH_ALEN]; - __le16 seq_ctl; - u8 payload[0]; -} __packed; - -struct wl12xx_ie_header { - u8 id; - u8 len; -} __packed; - -/* IEs */ - -struct wl12xx_ie_ssid { - struct wl12xx_ie_header header; - char ssid[IEEE80211_MAX_SSID_LEN]; -} __packed; - -struct wl12xx_ie_rates { - struct wl12xx_ie_header header; - u8 rates[MAX_SUPPORTED_RATES]; -} __packed; - -struct wl12xx_ie_ds_params { - struct wl12xx_ie_header header; - u8 channel; -} __packed; - -struct country_triplet { - u8 channel; - u8 num_channels; - u8 max_tx_power; -} __packed; - -struct wl12xx_ie_country { - struct wl12xx_ie_header header; - u8 country_string[IEEE80211_COUNTRY_STRING_LEN]; - struct country_triplet triplets[MAX_COUNTRY_TRIPLETS]; -} __packed; - - -/* Templates */ - -struct wl12xx_beacon_template { - struct ieee80211_header header; - __le32 time_stamp[2]; - __le16 beacon_interval; - __le16 capability; - struct wl12xx_ie_ssid ssid; - struct wl12xx_ie_rates rates; - struct wl12xx_ie_rates ext_rates; - struct wl12xx_ie_ds_params ds_params; - struct wl12xx_ie_country country; -} __packed; - -struct wl12xx_null_data_template { - struct ieee80211_header header; -} __packed; - -struct wl12xx_ps_poll_template { - __le16 fc; - __le16 aid; - u8 bssid[ETH_ALEN]; - u8 ta[ETH_ALEN]; -} __packed; - -struct wl12xx_qos_null_data_template { - struct ieee80211_header header; - __le16 qos_ctl; -} __packed; - -struct wl12xx_probe_req_template { - struct ieee80211_header header; - struct wl12xx_ie_ssid ssid; - struct wl12xx_ie_rates rates; - struct wl12xx_ie_rates ext_rates; -} __packed; - - -struct wl12xx_probe_resp_template { - struct ieee80211_header header; - __le32 time_stamp[2]; - __le16 beacon_interval; - __le16 capability; - struct wl12xx_ie_ssid ssid; - struct wl12xx_ie_rates rates; - struct wl12xx_ie_rates ext_rates; - struct wl12xx_ie_ds_params ds_params; - struct wl12xx_ie_country country; -} __packed; - -#endif diff --git a/drivers/net/wireless/ti/wl12xx/Kconfig b/drivers/net/wireless/ti/wl12xx/Kconfig deleted file mode 100644 index c2183594655a..000000000000 --- a/drivers/net/wireless/ti/wl12xx/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -config WL12XX - tristate "TI wl12xx support" - depends on MAC80211 - select WLCORE - ---help--- - This module adds support for wireless adapters based on TI wl1271, - wl1273, wl1281 and wl1283 chipsets. This module does *not* include - support for wl1251. For wl1251 support, use the separate homonymous - driver instead. diff --git a/drivers/net/wireless/ti/wl12xx/Makefile b/drivers/net/wireless/ti/wl12xx/Makefile deleted file mode 100644 index e6a24056b3c8..000000000000 --- a/drivers/net/wireless/ti/wl12xx/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -wl12xx-objs = main.o cmd.o acx.o debugfs.o scan.o event.o - -obj-$(CONFIG_WL12XX) += wl12xx.o diff --git a/drivers/net/wireless/ti/wl12xx/acx.c b/drivers/net/wireless/ti/wl12xx/acx.c deleted file mode 100644 index bea06b2d7bf4..000000000000 --- a/drivers/net/wireless/ti/wl12xx/acx.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2008-2009 Nokia Corporation - * Copyright (C) 2011 Texas Instruments Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "../wlcore/cmd.h" -#include "../wlcore/debug.h" -#include "../wlcore/acx.h" - -#include "acx.h" - -int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap) -{ - struct wl1271_acx_host_config_bitmap *bitmap_conf; - int ret; - - bitmap_conf = kzalloc(sizeof(*bitmap_conf), GFP_KERNEL); - if (!bitmap_conf) { - ret = -ENOMEM; - goto out; - } - - bitmap_conf->host_cfg_bitmap = cpu_to_le32(host_cfg_bitmap); - - ret = wl1271_cmd_configure(wl, ACX_HOST_IF_CFG_BITMAP, - bitmap_conf, sizeof(*bitmap_conf)); - if (ret < 0) { - wl1271_warning("wl1271 bitmap config opt failed: %d", ret); - goto out; - } - -out: - kfree(bitmap_conf); - - return ret; -} diff --git a/drivers/net/wireless/ti/wl12xx/acx.h b/drivers/net/wireless/ti/wl12xx/acx.h deleted file mode 100644 index 2a26868b837d..000000000000 --- a/drivers/net/wireless/ti/wl12xx/acx.h +++ /dev/null @@ -1,273 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 1998-2009, 2011 Texas Instruments. All rights reserved. - * Copyright (C) 2008-2010 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL12XX_ACX_H__ -#define __WL12XX_ACX_H__ - -#include "../wlcore/wlcore.h" -#include "../wlcore/acx.h" - -#define WL12XX_ACX_ALL_EVENTS_VECTOR (WL1271_ACX_INTR_WATCHDOG | \ - WL1271_ACX_INTR_INIT_COMPLETE | \ - WL1271_ACX_INTR_EVENT_A | \ - WL1271_ACX_INTR_EVENT_B | \ - WL1271_ACX_INTR_CMD_COMPLETE | \ - WL1271_ACX_INTR_HW_AVAILABLE | \ - WL1271_ACX_INTR_DATA) - -#define WL12XX_INTR_MASK (WL1271_ACX_INTR_WATCHDOG | \ - WL1271_ACX_INTR_EVENT_A | \ - WL1271_ACX_INTR_EVENT_B | \ - WL1271_ACX_INTR_HW_AVAILABLE | \ - WL1271_ACX_INTR_DATA) - -struct wl1271_acx_host_config_bitmap { - struct acx_header header; - - __le32 host_cfg_bitmap; -} __packed; - -struct wl12xx_acx_tx_statistics { - __le32 internal_desc_overflow; -} __packed; - -struct wl12xx_acx_rx_statistics { - __le32 out_of_mem; - __le32 hdr_overflow; - __le32 hw_stuck; - __le32 dropped; - __le32 fcs_err; - __le32 xfr_hint_trig; - __le32 path_reset; - __le32 reset_counter; -} __packed; - -struct wl12xx_acx_dma_statistics { - __le32 rx_requested; - __le32 rx_errors; - __le32 tx_requested; - __le32 tx_errors; -} __packed; - -struct wl12xx_acx_isr_statistics { - /* host command complete */ - __le32 cmd_cmplt; - - /* fiqisr() */ - __le32 fiqs; - - /* (INT_STS_ND & INT_TRIG_RX_HEADER) */ - __le32 rx_headers; - - /* (INT_STS_ND & INT_TRIG_RX_CMPLT) */ - __le32 rx_completes; - - /* (INT_STS_ND & INT_TRIG_NO_RX_BUF) */ - __le32 rx_mem_overflow; - - /* (INT_STS_ND & INT_TRIG_S_RX_RDY) */ - __le32 rx_rdys; - - /* irqisr() */ - __le32 irqs; - - /* (INT_STS_ND & INT_TRIG_TX_PROC) */ - __le32 tx_procs; - - /* (INT_STS_ND & INT_TRIG_DECRYPT_DONE) */ - __le32 decrypt_done; - - /* (INT_STS_ND & INT_TRIG_DMA0) */ - __le32 dma0_done; - - /* (INT_STS_ND & INT_TRIG_DMA1) */ - __le32 dma1_done; - - /* (INT_STS_ND & INT_TRIG_TX_EXC_CMPLT) */ - __le32 tx_exch_complete; - - /* (INT_STS_ND & INT_TRIG_COMMAND) */ - __le32 commands; - - /* (INT_STS_ND & INT_TRIG_RX_PROC) */ - __le32 rx_procs; - - /* (INT_STS_ND & INT_TRIG_PM_802) */ - __le32 hw_pm_mode_changes; - - /* (INT_STS_ND & INT_TRIG_ACKNOWLEDGE) */ - __le32 host_acknowledges; - - /* (INT_STS_ND & INT_TRIG_PM_PCI) */ - __le32 pci_pm; - - /* (INT_STS_ND & INT_TRIG_ACM_WAKEUP) */ - __le32 wakeups; - - /* (INT_STS_ND & INT_TRIG_LOW_RSSI) */ - __le32 low_rssi; -} __packed; - -struct wl12xx_acx_wep_statistics { - /* WEP address keys configured */ - __le32 addr_key_count; - - /* default keys configured */ - __le32 default_key_count; - - __le32 reserved; - - /* number of times that WEP key not found on lookup */ - __le32 key_not_found; - - /* number of times that WEP key decryption failed */ - __le32 decrypt_fail; - - /* WEP packets decrypted */ - __le32 packets; - - /* WEP decrypt interrupts */ - __le32 interrupt; -} __packed; - -#define ACX_MISSED_BEACONS_SPREAD 10 - -struct wl12xx_acx_pwr_statistics { - /* the amount of enters into power save mode (both PD & ELP) */ - __le32 ps_enter; - - /* the amount of enters into ELP mode */ - __le32 elp_enter; - - /* the amount of missing beacon interrupts to the host */ - __le32 missing_bcns; - - /* the amount of wake on host-access times */ - __le32 wake_on_host; - - /* the amount of wake on timer-expire */ - __le32 wake_on_timer_exp; - - /* the number of packets that were transmitted with PS bit set */ - __le32 tx_with_ps; - - /* the number of packets that were transmitted with PS bit clear */ - __le32 tx_without_ps; - - /* the number of received beacons */ - __le32 rcvd_beacons; - - /* the number of entering into PowerOn (power save off) */ - __le32 power_save_off; - - /* the number of entries into power save mode */ - __le16 enable_ps; - - /* - * the number of exits from power save, not including failed PS - * transitions - */ - __le16 disable_ps; - - /* - * the number of times the TSF counter was adjusted because - * of drift - */ - __le32 fix_tsf_ps; - - /* Gives statistics about the spread continuous missed beacons. - * The 16 LSB are dedicated for the PS mode. - * The 16 MSB are dedicated for the PS mode. - * cont_miss_bcns_spread[0] - single missed beacon. - * cont_miss_bcns_spread[1] - two continuous missed beacons. - * cont_miss_bcns_spread[2] - three continuous missed beacons. - * ... - * cont_miss_bcns_spread[9] - ten and more continuous missed beacons. - */ - __le32 cont_miss_bcns_spread[ACX_MISSED_BEACONS_SPREAD]; - - /* the number of beacons in awake mode */ - __le32 rcvd_awake_beacons; -} __packed; - -struct wl12xx_acx_mic_statistics { - __le32 rx_pkts; - __le32 calc_failure; -} __packed; - -struct wl12xx_acx_aes_statistics { - __le32 encrypt_fail; - __le32 decrypt_fail; - __le32 encrypt_packets; - __le32 decrypt_packets; - __le32 encrypt_interrupt; - __le32 decrypt_interrupt; -} __packed; - -struct wl12xx_acx_event_statistics { - __le32 heart_beat; - __le32 calibration; - __le32 rx_mismatch; - __le32 rx_mem_empty; - __le32 rx_pool; - __le32 oom_late; - __le32 phy_transmit_error; - __le32 tx_stuck; -} __packed; - -struct wl12xx_acx_ps_statistics { - __le32 pspoll_timeouts; - __le32 upsd_timeouts; - __le32 upsd_max_sptime; - __le32 upsd_max_apturn; - __le32 pspoll_max_apturn; - __le32 pspoll_utilization; - __le32 upsd_utilization; -} __packed; - -struct wl12xx_acx_rxpipe_statistics { - __le32 rx_prep_beacon_drop; - __le32 descr_host_int_trig_rx_data; - __le32 beacon_buffer_thres_host_int_trig_rx_data; - __le32 missed_beacon_host_int_trig_rx_data; - __le32 tx_xfr_host_int_trig_rx_data; -} __packed; - -struct wl12xx_acx_statistics { - struct acx_header header; - - struct wl12xx_acx_tx_statistics tx; - struct wl12xx_acx_rx_statistics rx; - struct wl12xx_acx_dma_statistics dma; - struct wl12xx_acx_isr_statistics isr; - struct wl12xx_acx_wep_statistics wep; - struct wl12xx_acx_pwr_statistics pwr; - struct wl12xx_acx_aes_statistics aes; - struct wl12xx_acx_mic_statistics mic; - struct wl12xx_acx_event_statistics event; - struct wl12xx_acx_ps_statistics ps; - struct wl12xx_acx_rxpipe_statistics rxpipe; -} __packed; - -int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap); - -#endif /* __WL12XX_ACX_H__ */ diff --git a/drivers/net/wireless/ti/wl12xx/cmd.c b/drivers/net/wireless/ti/wl12xx/cmd.c deleted file mode 100644 index 7485dbae8c4b..000000000000 --- a/drivers/net/wireless/ti/wl12xx/cmd.c +++ /dev/null @@ -1,323 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2009-2010 Nokia Corporation - * Copyright (C) 2011 Texas Instruments Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "../wlcore/cmd.h" -#include "../wlcore/debug.h" - -#include "wl12xx.h" -#include "cmd.h" - -int wl1271_cmd_ext_radio_parms(struct wl1271 *wl) -{ - struct wl1271_ext_radio_parms_cmd *ext_radio_parms; - struct wl12xx_priv *priv = wl->priv; - struct wl12xx_conf_rf *rf = &priv->conf.rf; - int ret; - - if (!wl->nvs) - return -ENODEV; - - ext_radio_parms = kzalloc(sizeof(*ext_radio_parms), GFP_KERNEL); - if (!ext_radio_parms) - return -ENOMEM; - - ext_radio_parms->test.id = TEST_CMD_INI_FILE_RF_EXTENDED_PARAM; - - memcpy(ext_radio_parms->tx_per_channel_power_compensation_2, - rf->tx_per_channel_power_compensation_2, - CONF_TX_PWR_COMPENSATION_LEN_2); - memcpy(ext_radio_parms->tx_per_channel_power_compensation_5, - rf->tx_per_channel_power_compensation_5, - CONF_TX_PWR_COMPENSATION_LEN_5); - - wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_EXT_RADIO_PARAM: ", - ext_radio_parms, sizeof(*ext_radio_parms)); - - ret = wl1271_cmd_test(wl, ext_radio_parms, sizeof(*ext_radio_parms), 0); - if (ret < 0) - wl1271_warning("TEST_CMD_INI_FILE_RF_EXTENDED_PARAM failed"); - - kfree(ext_radio_parms); - return ret; -} - -int wl1271_cmd_general_parms(struct wl1271 *wl) -{ - struct wl1271_general_parms_cmd *gen_parms; - struct wl1271_ini_general_params *gp = - &((struct wl1271_nvs_file *)wl->nvs)->general_params; - struct wl12xx_priv *priv = wl->priv; - bool answer = false; - int ret; - - if (!wl->nvs) - return -ENODEV; - - if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { - wl1271_warning("FEM index from INI out of bounds"); - return -EINVAL; - } - - gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); - if (!gen_parms) - return -ENOMEM; - - gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM; - - memcpy(&gen_parms->general_params, gp, sizeof(*gp)); - - /* If we started in PLT FEM_DETECT mode, force auto detect */ - if (wl->plt_mode == PLT_FEM_DETECT) - gen_parms->general_params.tx_bip_fem_auto_detect = true; - - if (gen_parms->general_params.tx_bip_fem_auto_detect) - answer = true; - - /* Override the REF CLK from the NVS with the one from platform data */ - gen_parms->general_params.ref_clock = priv->ref_clock; - - ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), answer); - if (ret < 0) { - wl1271_warning("CMD_INI_FILE_GENERAL_PARAM failed"); - goto out; - } - - gp->tx_bip_fem_manufacturer = - gen_parms->general_params.tx_bip_fem_manufacturer; - - if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { - wl1271_warning("FEM index from FW out of bounds"); - ret = -EINVAL; - goto out; - } - - /* If we are in calibrator based fem auto detect - save fem nr */ - if (wl->plt_mode == PLT_FEM_DETECT) - wl->fem_manuf = gp->tx_bip_fem_manufacturer; - - wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n", - answer == false ? - "manual" : - wl->plt_mode == PLT_FEM_DETECT ? - "calibrator_fem_detect" : - "auto", - gp->tx_bip_fem_manufacturer); - -out: - kfree(gen_parms); - return ret; -} - -int wl128x_cmd_general_parms(struct wl1271 *wl) -{ - struct wl128x_general_parms_cmd *gen_parms; - struct wl128x_ini_general_params *gp = - &((struct wl128x_nvs_file *)wl->nvs)->general_params; - struct wl12xx_priv *priv = wl->priv; - bool answer = false; - int ret; - - if (!wl->nvs) - return -ENODEV; - - if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { - wl1271_warning("FEM index from ini out of bounds"); - return -EINVAL; - } - - gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); - if (!gen_parms) - return -ENOMEM; - - gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM; - - memcpy(&gen_parms->general_params, gp, sizeof(*gp)); - - /* If we started in PLT FEM_DETECT mode, force auto detect */ - if (wl->plt_mode == PLT_FEM_DETECT) - gen_parms->general_params.tx_bip_fem_auto_detect = true; - - if (gen_parms->general_params.tx_bip_fem_auto_detect) - answer = true; - - /* Replace REF and TCXO CLKs with the ones from platform data */ - gen_parms->general_params.ref_clock = priv->ref_clock; - gen_parms->general_params.tcxo_ref_clock = priv->tcxo_clock; - - ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), answer); - if (ret < 0) { - wl1271_warning("CMD_INI_FILE_GENERAL_PARAM failed"); - goto out; - } - - gp->tx_bip_fem_manufacturer = - gen_parms->general_params.tx_bip_fem_manufacturer; - - if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { - wl1271_warning("FEM index from FW out of bounds"); - ret = -EINVAL; - goto out; - } - - /* If we are in calibrator based fem auto detect - save fem nr */ - if (wl->plt_mode == PLT_FEM_DETECT) - wl->fem_manuf = gp->tx_bip_fem_manufacturer; - - wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n", - answer == false ? - "manual" : - wl->plt_mode == PLT_FEM_DETECT ? - "calibrator_fem_detect" : - "auto", - gp->tx_bip_fem_manufacturer); - -out: - kfree(gen_parms); - return ret; -} - -int wl1271_cmd_radio_parms(struct wl1271 *wl) -{ - struct wl1271_nvs_file *nvs = (struct wl1271_nvs_file *)wl->nvs; - struct wl1271_radio_parms_cmd *radio_parms; - struct wl1271_ini_general_params *gp = &nvs->general_params; - int ret, fem_idx; - - if (!wl->nvs) - return -ENODEV; - - radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); - if (!radio_parms) - return -ENOMEM; - - radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; - - fem_idx = WL12XX_FEM_TO_NVS_ENTRY(gp->tx_bip_fem_manufacturer); - - /* 2.4GHz parameters */ - memcpy(&radio_parms->static_params_2, &nvs->stat_radio_params_2, - sizeof(struct wl1271_ini_band_params_2)); - memcpy(&radio_parms->dyn_params_2, - &nvs->dyn_radio_params_2[fem_idx].params, - sizeof(struct wl1271_ini_fem_params_2)); - - /* 5GHz parameters */ - memcpy(&radio_parms->static_params_5, - &nvs->stat_radio_params_5, - sizeof(struct wl1271_ini_band_params_5)); - memcpy(&radio_parms->dyn_params_5, - &nvs->dyn_radio_params_5[fem_idx].params, - sizeof(struct wl1271_ini_fem_params_5)); - - wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", - radio_parms, sizeof(*radio_parms)); - - ret = wl1271_cmd_test(wl, radio_parms, sizeof(*radio_parms), 0); - if (ret < 0) - wl1271_warning("CMD_INI_FILE_RADIO_PARAM failed"); - - kfree(radio_parms); - return ret; -} - -int wl128x_cmd_radio_parms(struct wl1271 *wl) -{ - struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs; - struct wl128x_radio_parms_cmd *radio_parms; - struct wl128x_ini_general_params *gp = &nvs->general_params; - int ret, fem_idx; - - if (!wl->nvs) - return -ENODEV; - - radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); - if (!radio_parms) - return -ENOMEM; - - radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; - - fem_idx = WL12XX_FEM_TO_NVS_ENTRY(gp->tx_bip_fem_manufacturer); - - /* 2.4GHz parameters */ - memcpy(&radio_parms->static_params_2, &nvs->stat_radio_params_2, - sizeof(struct wl128x_ini_band_params_2)); - memcpy(&radio_parms->dyn_params_2, - &nvs->dyn_radio_params_2[fem_idx].params, - sizeof(struct wl128x_ini_fem_params_2)); - - /* 5GHz parameters */ - memcpy(&radio_parms->static_params_5, - &nvs->stat_radio_params_5, - sizeof(struct wl128x_ini_band_params_5)); - memcpy(&radio_parms->dyn_params_5, - &nvs->dyn_radio_params_5[fem_idx].params, - sizeof(struct wl128x_ini_fem_params_5)); - - radio_parms->fem_vendor_and_options = nvs->fem_vendor_and_options; - - wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", - radio_parms, sizeof(*radio_parms)); - - ret = wl1271_cmd_test(wl, radio_parms, sizeof(*radio_parms), 0); - if (ret < 0) - wl1271_warning("CMD_INI_FILE_RADIO_PARAM failed"); - - kfree(radio_parms); - return ret; -} - -int wl12xx_cmd_channel_switch(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct ieee80211_channel_switch *ch_switch) -{ - struct wl12xx_cmd_channel_switch *cmd; - int ret; - - wl1271_debug(DEBUG_ACX, "cmd channel switch"); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->role_id = wlvif->role_id; - cmd->channel = ch_switch->chandef.chan->hw_value; - cmd->switch_time = ch_switch->count; - cmd->stop_tx = ch_switch->block_tx; - - /* FIXME: control from mac80211 in the future */ - /* Enable TX on the target channel */ - cmd->post_switch_tx_disable = 0; - - ret = wl1271_cmd_send(wl, CMD_CHANNEL_SWITCH, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to send channel switch command"); - goto out_free; - } - -out_free: - kfree(cmd); - -out: - return ret; -} diff --git a/drivers/net/wireless/ti/wl12xx/cmd.h b/drivers/net/wireless/ti/wl12xx/cmd.h deleted file mode 100644 index 32cbad54e993..000000000000 --- a/drivers/net/wireless/ti/wl12xx/cmd.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 1998-2009, 2011 Texas Instruments. All rights reserved. - * Copyright (C) 2009 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL12XX_CMD_H__ -#define __WL12XX_CMD_H__ - -#include "conf.h" - -#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19 -#define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E - -struct wl1271_general_parms_cmd { - struct wl1271_cmd_header header; - - struct wl1271_cmd_test_header test; - - struct wl1271_ini_general_params general_params; - - u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM]; - u8 sr_sen_n_p; - u8 sr_sen_n_p_gain; - u8 sr_sen_nrn; - u8 sr_sen_prn; - u8 padding[3]; -} __packed; - -struct wl128x_general_parms_cmd { - struct wl1271_cmd_header header; - - struct wl1271_cmd_test_header test; - - struct wl128x_ini_general_params general_params; - - u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM]; - u8 sr_sen_n_p; - u8 sr_sen_n_p_gain; - u8 sr_sen_nrn; - u8 sr_sen_prn; - u8 padding[3]; -} __packed; - -struct wl1271_radio_parms_cmd { - struct wl1271_cmd_header header; - - struct wl1271_cmd_test_header test; - - /* Static radio parameters */ - struct wl1271_ini_band_params_2 static_params_2; - struct wl1271_ini_band_params_5 static_params_5; - - /* Dynamic radio parameters */ - struct wl1271_ini_fem_params_2 dyn_params_2; - u8 padding2; - struct wl1271_ini_fem_params_5 dyn_params_5; - u8 padding3[2]; -} __packed; - -struct wl128x_radio_parms_cmd { - struct wl1271_cmd_header header; - - struct wl1271_cmd_test_header test; - - /* Static radio parameters */ - struct wl128x_ini_band_params_2 static_params_2; - struct wl128x_ini_band_params_5 static_params_5; - - u8 fem_vendor_and_options; - - /* Dynamic radio parameters */ - struct wl128x_ini_fem_params_2 dyn_params_2; - u8 padding2; - struct wl128x_ini_fem_params_5 dyn_params_5; -} __packed; - -#define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26 - -struct wl1271_ext_radio_parms_cmd { - struct wl1271_cmd_header header; - - struct wl1271_cmd_test_header test; - - u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2]; - u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5]; - u8 padding[3]; -} __packed; - -struct wl12xx_cmd_channel_switch { - struct wl1271_cmd_header header; - - u8 role_id; - - /* The new serving channel */ - u8 channel; - /* Relative time of the serving channel switch in TBTT units */ - u8 switch_time; - /* Stop the role TX, should expect it after radar detection */ - u8 stop_tx; - /* The target channel tx status 1-stopped 0-open*/ - u8 post_switch_tx_disable; - - u8 padding[3]; -} __packed; - -int wl1271_cmd_general_parms(struct wl1271 *wl); -int wl128x_cmd_general_parms(struct wl1271 *wl); -int wl1271_cmd_radio_parms(struct wl1271 *wl); -int wl128x_cmd_radio_parms(struct wl1271 *wl); -int wl1271_cmd_ext_radio_parms(struct wl1271 *wl); -int wl12xx_cmd_channel_switch(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct ieee80211_channel_switch *ch_switch); - -#endif /* __WL12XX_CMD_H__ */ diff --git a/drivers/net/wireless/ti/wl12xx/conf.h b/drivers/net/wireless/ti/wl12xx/conf.h deleted file mode 100644 index 75e29897a0f5..000000000000 --- a/drivers/net/wireless/ti/wl12xx/conf.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2011 Texas Instruments Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL12XX_CONF_H__ -#define __WL12XX_CONF_H__ - -/* these are number of channels on the band divided by two, rounded up */ -#define CONF_TX_PWR_COMPENSATION_LEN_2 7 -#define CONF_TX_PWR_COMPENSATION_LEN_5 18 - -struct wl12xx_conf_rf { - /* - * Per channel power compensation for 2.4GHz - * - * Range: s8 - */ - u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2]; - - /* - * Per channel power compensation for 5GHz - * - * Range: s8 - */ - u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5]; -}; - -struct wl12xx_priv_conf { - struct wl12xx_conf_rf rf; - struct conf_memory_settings mem_wl127x; -}; - -#endif /* __WL12XX_CONF_H__ */ diff --git a/drivers/net/wireless/ti/wl12xx/debugfs.c b/drivers/net/wireless/ti/wl12xx/debugfs.c deleted file mode 100644 index 0521cbf858cf..000000000000 --- a/drivers/net/wireless/ti/wl12xx/debugfs.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2009 Nokia Corporation - * Copyright (C) 2011-2012 Texas Instruments - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "../wlcore/debugfs.h" -#include "../wlcore/wlcore.h" - -#include "wl12xx.h" -#include "acx.h" -#include "debugfs.h" - -#define WL12XX_DEBUGFS_FWSTATS_FILE(a, b, c) \ - DEBUGFS_FWSTATS_FILE(a, b, c, wl12xx_acx_statistics) - -WL12XX_DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, "%u"); - -WL12XX_DEBUGFS_FWSTATS_FILE(rx, out_of_mem, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(rx, hdr_overflow, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(rx, hw_stuck, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(rx, dropped, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(rx, fcs_err, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(rx, xfr_hint_trig, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(rx, path_reset, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(rx, reset_counter, "%u"); - -WL12XX_DEBUGFS_FWSTATS_FILE(dma, rx_requested, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(dma, rx_errors, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(dma, tx_requested, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(dma, tx_errors, "%u"); - -WL12XX_DEBUGFS_FWSTATS_FILE(isr, cmd_cmplt, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, fiqs, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_headers, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_mem_overflow, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_rdys, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, irqs, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, tx_procs, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, decrypt_done, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, dma0_done, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, dma1_done, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, tx_exch_complete, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, commands, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_procs, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, hw_pm_mode_changes, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, host_acknowledges, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, pci_pm, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, wakeups, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(isr, low_rssi, "%u"); - -WL12XX_DEBUGFS_FWSTATS_FILE(wep, addr_key_count, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(wep, default_key_count, "%u"); -/* skipping wep.reserved */ -WL12XX_DEBUGFS_FWSTATS_FILE(wep, key_not_found, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(wep, decrypt_fail, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(wep, packets, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(wep, interrupt, "%u"); - -WL12XX_DEBUGFS_FWSTATS_FILE(pwr, ps_enter, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(pwr, elp_enter, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(pwr, missing_bcns, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(pwr, wake_on_host, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(pwr, wake_on_timer_exp, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(pwr, tx_with_ps, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(pwr, tx_without_ps, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_beacons, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(pwr, power_save_off, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(pwr, enable_ps, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(pwr, disable_ps, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(pwr, fix_tsf_ps, "%u"); -/* skipping cont_miss_bcns_spread for now */ -WL12XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_awake_beacons, "%u"); - -WL12XX_DEBUGFS_FWSTATS_FILE(mic, rx_pkts, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(mic, calc_failure, "%u"); - -WL12XX_DEBUGFS_FWSTATS_FILE(aes, encrypt_fail, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(aes, decrypt_fail, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(aes, encrypt_packets, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(aes, decrypt_packets, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(aes, encrypt_interrupt, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(aes, decrypt_interrupt, "%u"); - -WL12XX_DEBUGFS_FWSTATS_FILE(event, heart_beat, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(event, calibration, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(event, rx_mismatch, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(event, rx_mem_empty, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(event, rx_pool, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(event, oom_late, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(event, phy_transmit_error, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(event, tx_stuck, "%u"); - -WL12XX_DEBUGFS_FWSTATS_FILE(ps, pspoll_timeouts, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_timeouts, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_max_sptime, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_max_apturn, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(ps, pspoll_max_apturn, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(ps, pspoll_utilization, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_utilization, "%u"); - -WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, rx_prep_beacon_drop, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, descr_host_int_trig_rx_data, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, beacon_buffer_thres_host_int_trig_rx_data, - "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, missed_beacon_host_int_trig_rx_data, "%u"); -WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, tx_xfr_host_int_trig_rx_data, "%u"); - -int wl12xx_debugfs_add_files(struct wl1271 *wl, - struct dentry *rootdir) -{ - int ret = 0; - struct dentry *entry, *stats, *moddir; - - moddir = debugfs_create_dir(KBUILD_MODNAME, rootdir); - if (!moddir || IS_ERR(moddir)) { - entry = moddir; - goto err; - } - - stats = debugfs_create_dir("fw_stats", moddir); - if (!stats || IS_ERR(stats)) { - entry = stats; - goto err; - } - - DEBUGFS_FWSTATS_ADD(tx, internal_desc_overflow); - - DEBUGFS_FWSTATS_ADD(rx, out_of_mem); - DEBUGFS_FWSTATS_ADD(rx, hdr_overflow); - DEBUGFS_FWSTATS_ADD(rx, hw_stuck); - DEBUGFS_FWSTATS_ADD(rx, dropped); - DEBUGFS_FWSTATS_ADD(rx, fcs_err); - DEBUGFS_FWSTATS_ADD(rx, xfr_hint_trig); - DEBUGFS_FWSTATS_ADD(rx, path_reset); - DEBUGFS_FWSTATS_ADD(rx, reset_counter); - - DEBUGFS_FWSTATS_ADD(dma, rx_requested); - DEBUGFS_FWSTATS_ADD(dma, rx_errors); - DEBUGFS_FWSTATS_ADD(dma, tx_requested); - DEBUGFS_FWSTATS_ADD(dma, tx_errors); - - DEBUGFS_FWSTATS_ADD(isr, cmd_cmplt); - DEBUGFS_FWSTATS_ADD(isr, fiqs); - DEBUGFS_FWSTATS_ADD(isr, rx_headers); - DEBUGFS_FWSTATS_ADD(isr, rx_mem_overflow); - DEBUGFS_FWSTATS_ADD(isr, rx_rdys); - DEBUGFS_FWSTATS_ADD(isr, irqs); - DEBUGFS_FWSTATS_ADD(isr, tx_procs); - DEBUGFS_FWSTATS_ADD(isr, decrypt_done); - DEBUGFS_FWSTATS_ADD(isr, dma0_done); - DEBUGFS_FWSTATS_ADD(isr, dma1_done); - DEBUGFS_FWSTATS_ADD(isr, tx_exch_complete); - DEBUGFS_FWSTATS_ADD(isr, commands); - DEBUGFS_FWSTATS_ADD(isr, rx_procs); - DEBUGFS_FWSTATS_ADD(isr, hw_pm_mode_changes); - DEBUGFS_FWSTATS_ADD(isr, host_acknowledges); - DEBUGFS_FWSTATS_ADD(isr, pci_pm); - DEBUGFS_FWSTATS_ADD(isr, wakeups); - DEBUGFS_FWSTATS_ADD(isr, low_rssi); - - DEBUGFS_FWSTATS_ADD(wep, addr_key_count); - DEBUGFS_FWSTATS_ADD(wep, default_key_count); - /* skipping wep.reserved */ - DEBUGFS_FWSTATS_ADD(wep, key_not_found); - DEBUGFS_FWSTATS_ADD(wep, decrypt_fail); - DEBUGFS_FWSTATS_ADD(wep, packets); - DEBUGFS_FWSTATS_ADD(wep, interrupt); - - DEBUGFS_FWSTATS_ADD(pwr, ps_enter); - DEBUGFS_FWSTATS_ADD(pwr, elp_enter); - DEBUGFS_FWSTATS_ADD(pwr, missing_bcns); - DEBUGFS_FWSTATS_ADD(pwr, wake_on_host); - DEBUGFS_FWSTATS_ADD(pwr, wake_on_timer_exp); - DEBUGFS_FWSTATS_ADD(pwr, tx_with_ps); - DEBUGFS_FWSTATS_ADD(pwr, tx_without_ps); - DEBUGFS_FWSTATS_ADD(pwr, rcvd_beacons); - DEBUGFS_FWSTATS_ADD(pwr, power_save_off); - DEBUGFS_FWSTATS_ADD(pwr, enable_ps); - DEBUGFS_FWSTATS_ADD(pwr, disable_ps); - DEBUGFS_FWSTATS_ADD(pwr, fix_tsf_ps); - /* skipping cont_miss_bcns_spread for now */ - DEBUGFS_FWSTATS_ADD(pwr, rcvd_awake_beacons); - - DEBUGFS_FWSTATS_ADD(mic, rx_pkts); - DEBUGFS_FWSTATS_ADD(mic, calc_failure); - - DEBUGFS_FWSTATS_ADD(aes, encrypt_fail); - DEBUGFS_FWSTATS_ADD(aes, decrypt_fail); - DEBUGFS_FWSTATS_ADD(aes, encrypt_packets); - DEBUGFS_FWSTATS_ADD(aes, decrypt_packets); - DEBUGFS_FWSTATS_ADD(aes, encrypt_interrupt); - DEBUGFS_FWSTATS_ADD(aes, decrypt_interrupt); - - DEBUGFS_FWSTATS_ADD(event, heart_beat); - DEBUGFS_FWSTATS_ADD(event, calibration); - DEBUGFS_FWSTATS_ADD(event, rx_mismatch); - DEBUGFS_FWSTATS_ADD(event, rx_mem_empty); - DEBUGFS_FWSTATS_ADD(event, rx_pool); - DEBUGFS_FWSTATS_ADD(event, oom_late); - DEBUGFS_FWSTATS_ADD(event, phy_transmit_error); - DEBUGFS_FWSTATS_ADD(event, tx_stuck); - - DEBUGFS_FWSTATS_ADD(ps, pspoll_timeouts); - DEBUGFS_FWSTATS_ADD(ps, upsd_timeouts); - DEBUGFS_FWSTATS_ADD(ps, upsd_max_sptime); - DEBUGFS_FWSTATS_ADD(ps, upsd_max_apturn); - DEBUGFS_FWSTATS_ADD(ps, pspoll_max_apturn); - DEBUGFS_FWSTATS_ADD(ps, pspoll_utilization); - DEBUGFS_FWSTATS_ADD(ps, upsd_utilization); - - DEBUGFS_FWSTATS_ADD(rxpipe, rx_prep_beacon_drop); - DEBUGFS_FWSTATS_ADD(rxpipe, descr_host_int_trig_rx_data); - DEBUGFS_FWSTATS_ADD(rxpipe, beacon_buffer_thres_host_int_trig_rx_data); - DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data); - DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data); - - return 0; - -err: - if (IS_ERR(entry)) - ret = PTR_ERR(entry); - else - ret = -ENOMEM; - - return ret; -} diff --git a/drivers/net/wireless/ti/wl12xx/debugfs.h b/drivers/net/wireless/ti/wl12xx/debugfs.h deleted file mode 100644 index 96898e291b78..000000000000 --- a/drivers/net/wireless/ti/wl12xx/debugfs.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2012 Texas Instruments. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL12XX_DEBUGFS_H__ -#define __WL12XX_DEBUGFS_H__ - -int wl12xx_debugfs_add_files(struct wl1271 *wl, - struct dentry *rootdir); - -#endif /* __WL12XX_DEBUGFS_H__ */ diff --git a/drivers/net/wireless/ti/wl12xx/event.c b/drivers/net/wireless/ti/wl12xx/event.c deleted file mode 100644 index 6ac0ed751da8..000000000000 --- a/drivers/net/wireless/ti/wl12xx/event.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2012 Texas Instruments. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "event.h" -#include "scan.h" -#include "../wlcore/cmd.h" -#include "../wlcore/debug.h" - -int wl12xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event, - bool *timeout) -{ - u32 local_event; - - switch (event) { - case WLCORE_EVENT_ROLE_STOP_COMPLETE: - local_event = ROLE_STOP_COMPLETE_EVENT_ID; - break; - - case WLCORE_EVENT_PEER_REMOVE_COMPLETE: - local_event = PEER_REMOVE_COMPLETE_EVENT_ID; - break; - - default: - /* event not implemented */ - return 0; - } - return wlcore_cmd_wait_for_event_or_timeout(wl, local_event, timeout); -} - -int wl12xx_process_mailbox_events(struct wl1271 *wl) -{ - struct wl12xx_event_mailbox *mbox = wl->mbox; - u32 vector; - - - vector = le32_to_cpu(mbox->events_vector); - vector &= ~(le32_to_cpu(mbox->events_mask)); - - wl1271_debug(DEBUG_EVENT, "MBOX vector: 0x%x", vector); - - if (vector & SCAN_COMPLETE_EVENT_ID) { - wl1271_debug(DEBUG_EVENT, "status: 0x%x", - mbox->scheduled_scan_status); - - if (wl->scan_wlvif) - wl12xx_scan_completed(wl, wl->scan_wlvif); - } - - if (vector & PERIODIC_SCAN_REPORT_EVENT_ID) { - wl1271_debug(DEBUG_EVENT, - "PERIODIC_SCAN_REPORT_EVENT (status 0x%0x)", - mbox->scheduled_scan_status); - - wlcore_scan_sched_scan_results(wl); - } - - if (vector & PERIODIC_SCAN_COMPLETE_EVENT_ID) - wlcore_event_sched_scan_completed(wl, - mbox->scheduled_scan_status); - if (vector & SOFT_GEMINI_SENSE_EVENT_ID) - wlcore_event_soft_gemini_sense(wl, - mbox->soft_gemini_sense_info); - - if (vector & BSS_LOSE_EVENT_ID) - wlcore_event_beacon_loss(wl, 0xff); - - if (vector & RSSI_SNR_TRIGGER_0_EVENT_ID) - wlcore_event_rssi_trigger(wl, mbox->rssi_snr_trigger_metric); - - if (vector & BA_SESSION_RX_CONSTRAINT_EVENT_ID) - wlcore_event_ba_rx_constraint(wl, - BIT(mbox->role_id), - mbox->rx_ba_allowed); - - if (vector & CHANNEL_SWITCH_COMPLETE_EVENT_ID) - wlcore_event_channel_switch(wl, 0xff, - mbox->channel_switch_status); - - if (vector & DUMMY_PACKET_EVENT_ID) - wlcore_event_dummy_packet(wl); - - /* - * "TX retries exceeded" has a different meaning according to mode. - * In AP mode the offending station is disconnected. - */ - if (vector & MAX_TX_RETRY_EVENT_ID) - wlcore_event_max_tx_failure(wl, - le16_to_cpu(mbox->sta_tx_retry_exceeded)); - - if (vector & INACTIVE_STA_EVENT_ID) - wlcore_event_inactive_sta(wl, - le16_to_cpu(mbox->sta_aging_status)); - - if (vector & REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID) - wlcore_event_roc_complete(wl); - - return 0; -} diff --git a/drivers/net/wireless/ti/wl12xx/event.h b/drivers/net/wireless/ti/wl12xx/event.h deleted file mode 100644 index a5cc3fcd9eea..000000000000 --- a/drivers/net/wireless/ti/wl12xx/event.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2012 Texas Instruments. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL12XX_EVENT_H__ -#define __WL12XX_EVENT_H__ - -#include "../wlcore/wlcore.h" - -enum { - MEASUREMENT_START_EVENT_ID = BIT(8), - MEASUREMENT_COMPLETE_EVENT_ID = BIT(9), - SCAN_COMPLETE_EVENT_ID = BIT(10), - WFD_DISCOVERY_COMPLETE_EVENT_ID = BIT(11), - AP_DISCOVERY_COMPLETE_EVENT_ID = BIT(12), - RESERVED1 = BIT(13), - PSPOLL_DELIVERY_FAILURE_EVENT_ID = BIT(14), - ROLE_STOP_COMPLETE_EVENT_ID = BIT(15), - RADAR_DETECTED_EVENT_ID = BIT(16), - CHANNEL_SWITCH_COMPLETE_EVENT_ID = BIT(17), - BSS_LOSE_EVENT_ID = BIT(18), - REGAINED_BSS_EVENT_ID = BIT(19), - MAX_TX_RETRY_EVENT_ID = BIT(20), - DUMMY_PACKET_EVENT_ID = BIT(21), - SOFT_GEMINI_SENSE_EVENT_ID = BIT(22), - CHANGE_AUTO_MODE_TIMEOUT_EVENT_ID = BIT(23), - SOFT_GEMINI_AVALANCHE_EVENT_ID = BIT(24), - PLT_RX_CALIBRATION_COMPLETE_EVENT_ID = BIT(25), - INACTIVE_STA_EVENT_ID = BIT(26), - PEER_REMOVE_COMPLETE_EVENT_ID = BIT(27), - PERIODIC_SCAN_COMPLETE_EVENT_ID = BIT(28), - PERIODIC_SCAN_REPORT_EVENT_ID = BIT(29), - BA_SESSION_RX_CONSTRAINT_EVENT_ID = BIT(30), - REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID = BIT(31), -}; - -struct wl12xx_event_mailbox { - __le32 events_vector; - __le32 events_mask; - __le32 reserved_1; - __le32 reserved_2; - - u8 number_of_scan_results; - u8 scan_tag; - u8 completed_scan_status; - u8 reserved_3; - - u8 soft_gemini_sense_info; - u8 soft_gemini_protective_info; - s8 rssi_snr_trigger_metric[NUM_OF_RSSI_SNR_TRIGGERS]; - u8 change_auto_mode_timeout; - u8 scheduled_scan_status; - u8 reserved4; - /* tuned channel (roc) */ - u8 roc_channel; - - __le16 hlid_removed_bitmap; - - /* bitmap of aged stations (by HLID) */ - __le16 sta_aging_status; - - /* bitmap of stations (by HLID) which exceeded max tx retries */ - __le16 sta_tx_retry_exceeded; - - /* discovery completed results */ - u8 discovery_tag; - u8 number_of_preq_results; - u8 number_of_prsp_results; - u8 reserved_5; - - /* rx ba constraint */ - u8 role_id; /* 0xFF means any role. */ - u8 rx_ba_allowed; - u8 reserved_6[2]; - - /* Channel switch results */ - - u8 channel_switch_role_id; - u8 channel_switch_status; - u8 reserved_7[2]; - - u8 ps_poll_delivery_failure_role_ids; - u8 stopped_role_ids; - u8 started_role_ids; - - u8 reserved_8[9]; -} __packed; - -int wl12xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event, - bool *timeout); -int wl12xx_process_mailbox_events(struct wl1271 *wl); - -#endif - diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c deleted file mode 100644 index 1c627da85083..000000000000 --- a/drivers/net/wireless/ti/wl12xx/main.c +++ /dev/null @@ -1,1850 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2008-2010 Nokia Corporation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include - -#include - -#include - -#include "../wlcore/wlcore.h" -#include "../wlcore/debug.h" -#include "../wlcore/io.h" -#include "../wlcore/acx.h" -#include "../wlcore/tx.h" -#include "../wlcore/rx.h" -#include "../wlcore/boot.h" - -#include "wl12xx.h" -#include "reg.h" -#include "cmd.h" -#include "acx.h" -#include "scan.h" -#include "event.h" -#include "debugfs.h" - -static char *fref_param; -static char *tcxo_param; - -static struct wlcore_conf wl12xx_conf = { - .sg = { - .params = { - [CONF_SG_ACL_BT_MASTER_MIN_BR] = 10, - [CONF_SG_ACL_BT_MASTER_MAX_BR] = 180, - [CONF_SG_ACL_BT_SLAVE_MIN_BR] = 10, - [CONF_SG_ACL_BT_SLAVE_MAX_BR] = 180, - [CONF_SG_ACL_BT_MASTER_MIN_EDR] = 10, - [CONF_SG_ACL_BT_MASTER_MAX_EDR] = 80, - [CONF_SG_ACL_BT_SLAVE_MIN_EDR] = 10, - [CONF_SG_ACL_BT_SLAVE_MAX_EDR] = 80, - [CONF_SG_ACL_WLAN_PS_MASTER_BR] = 8, - [CONF_SG_ACL_WLAN_PS_SLAVE_BR] = 8, - [CONF_SG_ACL_WLAN_PS_MASTER_EDR] = 20, - [CONF_SG_ACL_WLAN_PS_SLAVE_EDR] = 20, - [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MIN_BR] = 20, - [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MAX_BR] = 35, - [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MIN_BR] = 16, - [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MAX_BR] = 35, - [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MIN_EDR] = 32, - [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MAX_EDR] = 50, - [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MIN_EDR] = 28, - [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MAX_EDR] = 50, - [CONF_SG_ACL_ACTIVE_SCAN_WLAN_BR] = 10, - [CONF_SG_ACL_ACTIVE_SCAN_WLAN_EDR] = 20, - [CONF_SG_ACL_PASSIVE_SCAN_BT_BR] = 75, - [CONF_SG_ACL_PASSIVE_SCAN_WLAN_BR] = 15, - [CONF_SG_ACL_PASSIVE_SCAN_BT_EDR] = 27, - [CONF_SG_ACL_PASSIVE_SCAN_WLAN_EDR] = 17, - /* active scan params */ - [CONF_SG_AUTO_SCAN_PROBE_REQ] = 170, - [CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_HV3] = 50, - [CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_A2DP] = 100, - /* passive scan params */ - [CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_A2DP_BR] = 800, - [CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_A2DP_EDR] = 200, - [CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_HV3] = 200, - /* passive scan in dual antenna params */ - [CONF_SG_CONSECUTIVE_HV3_IN_PASSIVE_SCAN] = 0, - [CONF_SG_BCN_HV3_COLLISION_THRESH_IN_PASSIVE_SCAN] = 0, - [CONF_SG_TX_RX_PROTECTION_BWIDTH_IN_PASSIVE_SCAN] = 0, - /* general params */ - [CONF_SG_STA_FORCE_PS_IN_BT_SCO] = 1, - [CONF_SG_ANTENNA_CONFIGURATION] = 0, - [CONF_SG_BEACON_MISS_PERCENT] = 60, - [CONF_SG_DHCP_TIME] = 5000, - [CONF_SG_RXT] = 1200, - [CONF_SG_TXT] = 1000, - [CONF_SG_ADAPTIVE_RXT_TXT] = 1, - [CONF_SG_GENERAL_USAGE_BIT_MAP] = 3, - [CONF_SG_HV3_MAX_SERVED] = 6, - [CONF_SG_PS_POLL_TIMEOUT] = 10, - [CONF_SG_UPSD_TIMEOUT] = 10, - [CONF_SG_CONSECUTIVE_CTS_THRESHOLD] = 2, - [CONF_SG_STA_RX_WINDOW_AFTER_DTIM] = 5, - [CONF_SG_STA_CONNECTION_PROTECTION_TIME] = 30, - /* AP params */ - [CONF_AP_BEACON_MISS_TX] = 3, - [CONF_AP_RX_WINDOW_AFTER_BEACON] = 10, - [CONF_AP_BEACON_WINDOW_INTERVAL] = 2, - [CONF_AP_CONNECTION_PROTECTION_TIME] = 0, - [CONF_AP_BT_ACL_VAL_BT_SERVE_TIME] = 25, - [CONF_AP_BT_ACL_VAL_WL_SERVE_TIME] = 25, - /* CTS Diluting params */ - [CONF_SG_CTS_DILUTED_BAD_RX_PACKETS_TH] = 0, - [CONF_SG_CTS_CHOP_IN_DUAL_ANT_SCO_MASTER] = 0, - }, - .state = CONF_SG_PROTECTIVE, - }, - .rx = { - .rx_msdu_life_time = 512000, - .packet_detection_threshold = 0, - .ps_poll_timeout = 15, - .upsd_timeout = 15, - .rts_threshold = IEEE80211_MAX_RTS_THRESHOLD, - .rx_cca_threshold = 0, - .irq_blk_threshold = 0xFFFF, - .irq_pkt_threshold = 0, - .irq_timeout = 600, - .queue_type = CONF_RX_QUEUE_TYPE_LOW_PRIORITY, - }, - .tx = { - .tx_energy_detection = 0, - .sta_rc_conf = { - .enabled_rates = 0, - .short_retry_limit = 10, - .long_retry_limit = 10, - .aflags = 0, - }, - .ac_conf_count = 4, - .ac_conf = { - [CONF_TX_AC_BE] = { - .ac = CONF_TX_AC_BE, - .cw_min = 15, - .cw_max = 63, - .aifsn = 3, - .tx_op_limit = 0, - }, - [CONF_TX_AC_BK] = { - .ac = CONF_TX_AC_BK, - .cw_min = 15, - .cw_max = 63, - .aifsn = 7, - .tx_op_limit = 0, - }, - [CONF_TX_AC_VI] = { - .ac = CONF_TX_AC_VI, - .cw_min = 15, - .cw_max = 63, - .aifsn = CONF_TX_AIFS_PIFS, - .tx_op_limit = 3008, - }, - [CONF_TX_AC_VO] = { - .ac = CONF_TX_AC_VO, - .cw_min = 15, - .cw_max = 63, - .aifsn = CONF_TX_AIFS_PIFS, - .tx_op_limit = 1504, - }, - }, - .max_tx_retries = 100, - .ap_aging_period = 300, - .tid_conf_count = 4, - .tid_conf = { - [CONF_TX_AC_BE] = { - .queue_id = CONF_TX_AC_BE, - .channel_type = CONF_CHANNEL_TYPE_EDCF, - .tsid = CONF_TX_AC_BE, - .ps_scheme = CONF_PS_SCHEME_LEGACY, - .ack_policy = CONF_ACK_POLICY_LEGACY, - .apsd_conf = {0, 0}, - }, - [CONF_TX_AC_BK] = { - .queue_id = CONF_TX_AC_BK, - .channel_type = CONF_CHANNEL_TYPE_EDCF, - .tsid = CONF_TX_AC_BK, - .ps_scheme = CONF_PS_SCHEME_LEGACY, - .ack_policy = CONF_ACK_POLICY_LEGACY, - .apsd_conf = {0, 0}, - }, - [CONF_TX_AC_VI] = { - .queue_id = CONF_TX_AC_VI, - .channel_type = CONF_CHANNEL_TYPE_EDCF, - .tsid = CONF_TX_AC_VI, - .ps_scheme = CONF_PS_SCHEME_LEGACY, - .ack_policy = CONF_ACK_POLICY_LEGACY, - .apsd_conf = {0, 0}, - }, - [CONF_TX_AC_VO] = { - .queue_id = CONF_TX_AC_VO, - .channel_type = CONF_CHANNEL_TYPE_EDCF, - .tsid = CONF_TX_AC_VO, - .ps_scheme = CONF_PS_SCHEME_LEGACY, - .ack_policy = CONF_ACK_POLICY_LEGACY, - .apsd_conf = {0, 0}, - }, - }, - .frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD, - .tx_compl_timeout = 700, - .tx_compl_threshold = 4, - .basic_rate = CONF_HW_BIT_RATE_1MBPS, - .basic_rate_5 = CONF_HW_BIT_RATE_6MBPS, - .tmpl_short_retry_limit = 10, - .tmpl_long_retry_limit = 10, - .tx_watchdog_timeout = 5000, - .slow_link_thold = 3, - .fast_link_thold = 10, - }, - .conn = { - .wake_up_event = CONF_WAKE_UP_EVENT_DTIM, - .listen_interval = 1, - .suspend_wake_up_event = CONF_WAKE_UP_EVENT_N_DTIM, - .suspend_listen_interval = 3, - .bcn_filt_mode = CONF_BCN_FILT_MODE_ENABLED, - .bcn_filt_ie_count = 3, - .bcn_filt_ie = { - [0] = { - .ie = WLAN_EID_CHANNEL_SWITCH, - .rule = CONF_BCN_RULE_PASS_ON_APPEARANCE, - }, - [1] = { - .ie = WLAN_EID_HT_OPERATION, - .rule = CONF_BCN_RULE_PASS_ON_CHANGE, - }, - [2] = { - .ie = WLAN_EID_ERP_INFO, - .rule = CONF_BCN_RULE_PASS_ON_CHANGE, - }, - }, - .synch_fail_thold = 12, - .bss_lose_timeout = 400, - .beacon_rx_timeout = 10000, - .broadcast_timeout = 20000, - .rx_broadcast_in_ps = 1, - .ps_poll_threshold = 10, - .bet_enable = CONF_BET_MODE_ENABLE, - .bet_max_consecutive = 50, - .psm_entry_retries = 8, - .psm_exit_retries = 16, - .psm_entry_nullfunc_retries = 3, - .dynamic_ps_timeout = 1500, - .forced_ps = false, - .keep_alive_interval = 55000, - .max_listen_interval = 20, - .sta_sleep_auth = WL1271_PSM_ILLEGAL, - }, - .itrim = { - .enable = false, - .timeout = 50000, - }, - .pm_config = { - .host_clk_settling_time = 5000, - .host_fast_wakeup_support = CONF_FAST_WAKEUP_DISABLE, - }, - .roam_trigger = { - .trigger_pacing = 1, - .avg_weight_rssi_beacon = 20, - .avg_weight_rssi_data = 10, - .avg_weight_snr_beacon = 20, - .avg_weight_snr_data = 10, - }, - .scan = { - .min_dwell_time_active = 7500, - .max_dwell_time_active = 30000, - .min_dwell_time_active_long = 25000, - .max_dwell_time_active_long = 50000, - .dwell_time_passive = 100000, - .dwell_time_dfs = 150000, - .num_probe_reqs = 2, - .split_scan_timeout = 50000, - }, - .sched_scan = { - /* - * Values are in TU/1000 but since sched scan FW command - * params are in TUs rounding up may occur. - */ - .base_dwell_time = 7500, - .max_dwell_time_delta = 22500, - /* based on 250bits per probe @1Mbps */ - .dwell_time_delta_per_probe = 2000, - /* based on 250bits per probe @6Mbps (plus a bit more) */ - .dwell_time_delta_per_probe_5 = 350, - .dwell_time_passive = 100000, - .dwell_time_dfs = 150000, - .num_probe_reqs = 2, - .rssi_threshold = -90, - .snr_threshold = 0, - }, - .ht = { - .rx_ba_win_size = 8, - .tx_ba_win_size = 64, - .inactivity_timeout = 10000, - .tx_ba_tid_bitmap = CONF_TX_BA_ENABLED_TID_BITMAP, - }, - /* - * Memory config for wl127x chips is given in the - * wl12xx_default_priv_conf struct. The below configuration is - * for wl128x chips. - */ - .mem = { - .num_stations = 1, - .ssid_profiles = 1, - .rx_block_num = 40, - .tx_min_block_num = 40, - .dynamic_memory = 1, - .min_req_tx_blocks = 45, - .min_req_rx_blocks = 22, - .tx_min = 27, - }, - .fm_coex = { - .enable = true, - .swallow_period = 5, - .n_divider_fref_set_1 = 0xff, /* default */ - .n_divider_fref_set_2 = 12, - .m_divider_fref_set_1 = 0xffff, - .m_divider_fref_set_2 = 148, /* default */ - .coex_pll_stabilization_time = 0xffffffff, /* default */ - .ldo_stabilization_time = 0xffff, /* default */ - .fm_disturbed_band_margin = 0xff, /* default */ - .swallow_clk_diff = 0xff, /* default */ - }, - .rx_streaming = { - .duration = 150, - .queues = 0x1, - .interval = 20, - .always = 0, - }, - .fwlog = { - .mode = WL12XX_FWLOG_ON_DEMAND, - .mem_blocks = 2, - .severity = 0, - .timestamp = WL12XX_FWLOG_TIMESTAMP_DISABLED, - .output = WL12XX_FWLOG_OUTPUT_HOST, - .threshold = 0, - }, - .rate = { - .rate_retry_score = 32000, - .per_add = 8192, - .per_th1 = 2048, - .per_th2 = 4096, - .max_per = 8100, - .inverse_curiosity_factor = 5, - .tx_fail_low_th = 4, - .tx_fail_high_th = 10, - .per_alpha_shift = 4, - .per_add_shift = 13, - .per_beta1_shift = 10, - .per_beta2_shift = 8, - .rate_check_up = 2, - .rate_check_down = 12, - .rate_retry_policy = { - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - }, - }, - .hangover = { - .recover_time = 0, - .hangover_period = 20, - .dynamic_mode = 1, - .early_termination_mode = 1, - .max_period = 20, - .min_period = 1, - .increase_delta = 1, - .decrease_delta = 2, - .quiet_time = 4, - .increase_time = 1, - .window_size = 16, - }, - .recovery = { - .bug_on_recovery = 0, - .no_recovery = 0, - }, -}; - -static struct wl12xx_priv_conf wl12xx_default_priv_conf = { - .rf = { - .tx_per_channel_power_compensation_2 = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }, - .tx_per_channel_power_compensation_5 = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }, - }, - .mem_wl127x = { - .num_stations = 1, - .ssid_profiles = 1, - .rx_block_num = 70, - .tx_min_block_num = 40, - .dynamic_memory = 1, - .min_req_tx_blocks = 100, - .min_req_rx_blocks = 22, - .tx_min = 27, - }, - -}; - -#define WL12XX_TX_HW_BLOCK_SPARE_DEFAULT 1 -#define WL12XX_TX_HW_BLOCK_GEM_SPARE 2 -#define WL12XX_TX_HW_BLOCK_SIZE 252 - -static const u8 wl12xx_rate_to_idx_2ghz[] = { - /* MCS rates are used only with 11n */ - 7, /* WL12XX_CONF_HW_RXTX_RATE_MCS7_SGI */ - 7, /* WL12XX_CONF_HW_RXTX_RATE_MCS7 */ - 6, /* WL12XX_CONF_HW_RXTX_RATE_MCS6 */ - 5, /* WL12XX_CONF_HW_RXTX_RATE_MCS5 */ - 4, /* WL12XX_CONF_HW_RXTX_RATE_MCS4 */ - 3, /* WL12XX_CONF_HW_RXTX_RATE_MCS3 */ - 2, /* WL12XX_CONF_HW_RXTX_RATE_MCS2 */ - 1, /* WL12XX_CONF_HW_RXTX_RATE_MCS1 */ - 0, /* WL12XX_CONF_HW_RXTX_RATE_MCS0 */ - - 11, /* WL12XX_CONF_HW_RXTX_RATE_54 */ - 10, /* WL12XX_CONF_HW_RXTX_RATE_48 */ - 9, /* WL12XX_CONF_HW_RXTX_RATE_36 */ - 8, /* WL12XX_CONF_HW_RXTX_RATE_24 */ - - /* TI-specific rate */ - CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL12XX_CONF_HW_RXTX_RATE_22 */ - - 7, /* WL12XX_CONF_HW_RXTX_RATE_18 */ - 6, /* WL12XX_CONF_HW_RXTX_RATE_12 */ - 3, /* WL12XX_CONF_HW_RXTX_RATE_11 */ - 5, /* WL12XX_CONF_HW_RXTX_RATE_9 */ - 4, /* WL12XX_CONF_HW_RXTX_RATE_6 */ - 2, /* WL12XX_CONF_HW_RXTX_RATE_5_5 */ - 1, /* WL12XX_CONF_HW_RXTX_RATE_2 */ - 0 /* WL12XX_CONF_HW_RXTX_RATE_1 */ -}; - -static const u8 wl12xx_rate_to_idx_5ghz[] = { - /* MCS rates are used only with 11n */ - 7, /* WL12XX_CONF_HW_RXTX_RATE_MCS7_SGI */ - 7, /* WL12XX_CONF_HW_RXTX_RATE_MCS7 */ - 6, /* WL12XX_CONF_HW_RXTX_RATE_MCS6 */ - 5, /* WL12XX_CONF_HW_RXTX_RATE_MCS5 */ - 4, /* WL12XX_CONF_HW_RXTX_RATE_MCS4 */ - 3, /* WL12XX_CONF_HW_RXTX_RATE_MCS3 */ - 2, /* WL12XX_CONF_HW_RXTX_RATE_MCS2 */ - 1, /* WL12XX_CONF_HW_RXTX_RATE_MCS1 */ - 0, /* WL12XX_CONF_HW_RXTX_RATE_MCS0 */ - - 7, /* WL12XX_CONF_HW_RXTX_RATE_54 */ - 6, /* WL12XX_CONF_HW_RXTX_RATE_48 */ - 5, /* WL12XX_CONF_HW_RXTX_RATE_36 */ - 4, /* WL12XX_CONF_HW_RXTX_RATE_24 */ - - /* TI-specific rate */ - CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL12XX_CONF_HW_RXTX_RATE_22 */ - - 3, /* WL12XX_CONF_HW_RXTX_RATE_18 */ - 2, /* WL12XX_CONF_HW_RXTX_RATE_12 */ - CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL12XX_CONF_HW_RXTX_RATE_11 */ - 1, /* WL12XX_CONF_HW_RXTX_RATE_9 */ - 0, /* WL12XX_CONF_HW_RXTX_RATE_6 */ - CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL12XX_CONF_HW_RXTX_RATE_5_5 */ - CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL12XX_CONF_HW_RXTX_RATE_2 */ - CONF_HW_RXTX_RATE_UNSUPPORTED /* WL12XX_CONF_HW_RXTX_RATE_1 */ -}; - -static const u8 *wl12xx_band_rate_to_idx[] = { - [IEEE80211_BAND_2GHZ] = wl12xx_rate_to_idx_2ghz, - [IEEE80211_BAND_5GHZ] = wl12xx_rate_to_idx_5ghz -}; - -enum wl12xx_hw_rates { - WL12XX_CONF_HW_RXTX_RATE_MCS7_SGI = 0, - WL12XX_CONF_HW_RXTX_RATE_MCS7, - WL12XX_CONF_HW_RXTX_RATE_MCS6, - WL12XX_CONF_HW_RXTX_RATE_MCS5, - WL12XX_CONF_HW_RXTX_RATE_MCS4, - WL12XX_CONF_HW_RXTX_RATE_MCS3, - WL12XX_CONF_HW_RXTX_RATE_MCS2, - WL12XX_CONF_HW_RXTX_RATE_MCS1, - WL12XX_CONF_HW_RXTX_RATE_MCS0, - WL12XX_CONF_HW_RXTX_RATE_54, - WL12XX_CONF_HW_RXTX_RATE_48, - WL12XX_CONF_HW_RXTX_RATE_36, - WL12XX_CONF_HW_RXTX_RATE_24, - WL12XX_CONF_HW_RXTX_RATE_22, - WL12XX_CONF_HW_RXTX_RATE_18, - WL12XX_CONF_HW_RXTX_RATE_12, - WL12XX_CONF_HW_RXTX_RATE_11, - WL12XX_CONF_HW_RXTX_RATE_9, - WL12XX_CONF_HW_RXTX_RATE_6, - WL12XX_CONF_HW_RXTX_RATE_5_5, - WL12XX_CONF_HW_RXTX_RATE_2, - WL12XX_CONF_HW_RXTX_RATE_1, - WL12XX_CONF_HW_RXTX_RATE_MAX, -}; - -static struct wlcore_partition_set wl12xx_ptable[PART_TABLE_LEN] = { - [PART_DOWN] = { - .mem = { - .start = 0x00000000, - .size = 0x000177c0 - }, - .reg = { - .start = REGISTERS_BASE, - .size = 0x00008800 - }, - .mem2 = { - .start = 0x00000000, - .size = 0x00000000 - }, - .mem3 = { - .start = 0x00000000, - .size = 0x00000000 - }, - }, - - [PART_BOOT] = { /* in wl12xx we can use a mix of work and down - * partition here */ - .mem = { - .start = 0x00040000, - .size = 0x00014fc0 - }, - .reg = { - .start = REGISTERS_BASE, - .size = 0x00008800 - }, - .mem2 = { - .start = 0x00000000, - .size = 0x00000000 - }, - .mem3 = { - .start = 0x00000000, - .size = 0x00000000 - }, - }, - - [PART_WORK] = { - .mem = { - .start = 0x00040000, - .size = 0x00014fc0 - }, - .reg = { - .start = REGISTERS_BASE, - .size = 0x0000a000 - }, - .mem2 = { - .start = 0x003004f8, - .size = 0x00000004 - }, - .mem3 = { - .start = 0x00040404, - .size = 0x00000000 - }, - }, - - [PART_DRPW] = { - .mem = { - .start = 0x00040000, - .size = 0x00014fc0 - }, - .reg = { - .start = DRPW_BASE, - .size = 0x00006000 - }, - .mem2 = { - .start = 0x00000000, - .size = 0x00000000 - }, - .mem3 = { - .start = 0x00000000, - .size = 0x00000000 - } - } -}; - -static const int wl12xx_rtable[REG_TABLE_LEN] = { - [REG_ECPU_CONTROL] = WL12XX_REG_ECPU_CONTROL, - [REG_INTERRUPT_NO_CLEAR] = WL12XX_REG_INTERRUPT_NO_CLEAR, - [REG_INTERRUPT_ACK] = WL12XX_REG_INTERRUPT_ACK, - [REG_COMMAND_MAILBOX_PTR] = WL12XX_REG_COMMAND_MAILBOX_PTR, - [REG_EVENT_MAILBOX_PTR] = WL12XX_REG_EVENT_MAILBOX_PTR, - [REG_INTERRUPT_TRIG] = WL12XX_REG_INTERRUPT_TRIG, - [REG_INTERRUPT_MASK] = WL12XX_REG_INTERRUPT_MASK, - [REG_PC_ON_RECOVERY] = WL12XX_SCR_PAD4, - [REG_CHIP_ID_B] = WL12XX_CHIP_ID_B, - [REG_CMD_MBOX_ADDRESS] = WL12XX_CMD_MBOX_ADDRESS, - - /* data access memory addresses, used with partition translation */ - [REG_SLV_MEM_DATA] = WL1271_SLV_MEM_DATA, - [REG_SLV_REG_DATA] = WL1271_SLV_REG_DATA, - - /* raw data access memory addresses */ - [REG_RAW_FW_STATUS_ADDR] = FW_STATUS_ADDR, -}; - -/* TODO: maybe move to a new header file? */ -#define WL127X_FW_NAME_MULTI "ti-connectivity/wl127x-fw-5-mr.bin" -#define WL127X_FW_NAME_SINGLE "ti-connectivity/wl127x-fw-5-sr.bin" -#define WL127X_PLT_FW_NAME "ti-connectivity/wl127x-fw-5-plt.bin" - -#define WL128X_FW_NAME_MULTI "ti-connectivity/wl128x-fw-5-mr.bin" -#define WL128X_FW_NAME_SINGLE "ti-connectivity/wl128x-fw-5-sr.bin" -#define WL128X_PLT_FW_NAME "ti-connectivity/wl128x-fw-5-plt.bin" - -static int wl127x_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len) -{ - int ret; - - if (wl->chip.id != CHIP_ID_128X_PG20) { - struct wl1271_acx_mem_map *wl_mem_map = wl->target_mem_map; - struct wl12xx_priv *priv = wl->priv; - - /* - * Choose the block we want to read - * For aggregated packets, only the first memory block - * should be retrieved. The FW takes care of the rest. - */ - u32 mem_block = rx_desc & RX_MEM_BLOCK_MASK; - - priv->rx_mem_addr->addr = (mem_block << 8) + - le32_to_cpu(wl_mem_map->packet_memory_pool_start); - - priv->rx_mem_addr->addr_extra = priv->rx_mem_addr->addr + 4; - - ret = wlcore_write(wl, WL1271_SLV_REG_DATA, priv->rx_mem_addr, - sizeof(*priv->rx_mem_addr), false); - if (ret < 0) - return ret; - } - - return 0; -} - -static int wl12xx_identify_chip(struct wl1271 *wl) -{ - int ret = 0; - - switch (wl->chip.id) { - case CHIP_ID_127X_PG10: - wl1271_warning("chip id 0x%x (1271 PG10) support is obsolete", - wl->chip.id); - - wl->quirks |= WLCORE_QUIRK_LEGACY_NVS | - WLCORE_QUIRK_DUAL_PROBE_TMPL | - WLCORE_QUIRK_TKIP_HEADER_SPACE | - WLCORE_QUIRK_START_STA_FAILS | - WLCORE_QUIRK_AP_ZERO_SESSION_ID; - wl->sr_fw_name = WL127X_FW_NAME_SINGLE; - wl->mr_fw_name = WL127X_FW_NAME_MULTI; - memcpy(&wl->conf.mem, &wl12xx_default_priv_conf.mem_wl127x, - sizeof(wl->conf.mem)); - - /* read data preparation is only needed by wl127x */ - wl->ops->prepare_read = wl127x_prepare_read; - - wlcore_set_min_fw_ver(wl, WL127X_CHIP_VER, - WL127X_IFTYPE_SR_VER, WL127X_MAJOR_SR_VER, - WL127X_SUBTYPE_SR_VER, WL127X_MINOR_SR_VER, - WL127X_IFTYPE_MR_VER, WL127X_MAJOR_MR_VER, - WL127X_SUBTYPE_MR_VER, WL127X_MINOR_MR_VER); - break; - - case CHIP_ID_127X_PG20: - wl1271_debug(DEBUG_BOOT, "chip id 0x%x (1271 PG20)", - wl->chip.id); - - wl->quirks |= WLCORE_QUIRK_LEGACY_NVS | - WLCORE_QUIRK_DUAL_PROBE_TMPL | - WLCORE_QUIRK_TKIP_HEADER_SPACE | - WLCORE_QUIRK_START_STA_FAILS | - WLCORE_QUIRK_AP_ZERO_SESSION_ID; - wl->plt_fw_name = WL127X_PLT_FW_NAME; - wl->sr_fw_name = WL127X_FW_NAME_SINGLE; - wl->mr_fw_name = WL127X_FW_NAME_MULTI; - memcpy(&wl->conf.mem, &wl12xx_default_priv_conf.mem_wl127x, - sizeof(wl->conf.mem)); - - /* read data preparation is only needed by wl127x */ - wl->ops->prepare_read = wl127x_prepare_read; - - wlcore_set_min_fw_ver(wl, WL127X_CHIP_VER, - WL127X_IFTYPE_SR_VER, WL127X_MAJOR_SR_VER, - WL127X_SUBTYPE_SR_VER, WL127X_MINOR_SR_VER, - WL127X_IFTYPE_MR_VER, WL127X_MAJOR_MR_VER, - WL127X_SUBTYPE_MR_VER, WL127X_MINOR_MR_VER); - break; - - case CHIP_ID_128X_PG20: - wl1271_debug(DEBUG_BOOT, "chip id 0x%x (1283 PG20)", - wl->chip.id); - wl->plt_fw_name = WL128X_PLT_FW_NAME; - wl->sr_fw_name = WL128X_FW_NAME_SINGLE; - wl->mr_fw_name = WL128X_FW_NAME_MULTI; - - /* wl128x requires TX blocksize alignment */ - wl->quirks |= WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN | - WLCORE_QUIRK_DUAL_PROBE_TMPL | - WLCORE_QUIRK_TKIP_HEADER_SPACE | - WLCORE_QUIRK_START_STA_FAILS | - WLCORE_QUIRK_AP_ZERO_SESSION_ID; - - wlcore_set_min_fw_ver(wl, WL128X_CHIP_VER, - WL128X_IFTYPE_SR_VER, WL128X_MAJOR_SR_VER, - WL128X_SUBTYPE_SR_VER, WL128X_MINOR_SR_VER, - WL128X_IFTYPE_MR_VER, WL128X_MAJOR_MR_VER, - WL128X_SUBTYPE_MR_VER, WL128X_MINOR_MR_VER); - break; - case CHIP_ID_128X_PG10: - default: - wl1271_warning("unsupported chip id: 0x%x", wl->chip.id); - ret = -ENODEV; - goto out; - } - - /* common settings */ - wl->scan_templ_id_2_4 = CMD_TEMPL_APP_PROBE_REQ_2_4_LEGACY; - wl->scan_templ_id_5 = CMD_TEMPL_APP_PROBE_REQ_5_LEGACY; - wl->sched_scan_templ_id_2_4 = CMD_TEMPL_CFG_PROBE_REQ_2_4; - wl->sched_scan_templ_id_5 = CMD_TEMPL_CFG_PROBE_REQ_5; - wl->max_channels_5 = WL12XX_MAX_CHANNELS_5GHZ; - wl->ba_rx_session_count_max = WL12XX_RX_BA_MAX_SESSIONS; -out: - return ret; -} - -static int __must_check wl12xx_top_reg_write(struct wl1271 *wl, int addr, - u16 val) -{ - int ret; - - /* write address >> 1 + 0x30000 to OCP_POR_CTR */ - addr = (addr >> 1) + 0x30000; - ret = wlcore_write32(wl, WL12XX_OCP_POR_CTR, addr); - if (ret < 0) - goto out; - - /* write value to OCP_POR_WDATA */ - ret = wlcore_write32(wl, WL12XX_OCP_DATA_WRITE, val); - if (ret < 0) - goto out; - - /* write 1 to OCP_CMD */ - ret = wlcore_write32(wl, WL12XX_OCP_CMD, OCP_CMD_WRITE); - if (ret < 0) - goto out; - -out: - return ret; -} - -static int __must_check wl12xx_top_reg_read(struct wl1271 *wl, int addr, - u16 *out) -{ - u32 val; - int timeout = OCP_CMD_LOOP; - int ret; - - /* write address >> 1 + 0x30000 to OCP_POR_CTR */ - addr = (addr >> 1) + 0x30000; - ret = wlcore_write32(wl, WL12XX_OCP_POR_CTR, addr); - if (ret < 0) - return ret; - - /* write 2 to OCP_CMD */ - ret = wlcore_write32(wl, WL12XX_OCP_CMD, OCP_CMD_READ); - if (ret < 0) - return ret; - - /* poll for data ready */ - do { - ret = wlcore_read32(wl, WL12XX_OCP_DATA_READ, &val); - if (ret < 0) - return ret; - } while (!(val & OCP_READY_MASK) && --timeout); - - if (!timeout) { - wl1271_warning("Top register access timed out."); - return -ETIMEDOUT; - } - - /* check data status and return if OK */ - if ((val & OCP_STATUS_MASK) != OCP_STATUS_OK) { - wl1271_warning("Top register access returned error."); - return -EIO; - } - - if (out) - *out = val & 0xffff; - - return 0; -} - -static int wl128x_switch_tcxo_to_fref(struct wl1271 *wl) -{ - u16 spare_reg; - int ret; - - /* Mask bits [2] & [8:4] in the sys_clk_cfg register */ - ret = wl12xx_top_reg_read(wl, WL_SPARE_REG, &spare_reg); - if (ret < 0) - return ret; - - if (spare_reg == 0xFFFF) - return -EFAULT; - spare_reg |= (BIT(3) | BIT(5) | BIT(6)); - ret = wl12xx_top_reg_write(wl, WL_SPARE_REG, spare_reg); - if (ret < 0) - return ret; - - /* Enable FREF_CLK_REQ & mux MCS and coex PLLs to FREF */ - ret = wl12xx_top_reg_write(wl, SYS_CLK_CFG_REG, - WL_CLK_REQ_TYPE_PG2 | MCS_PLL_CLK_SEL_FREF); - if (ret < 0) - return ret; - - /* Delay execution for 15msec, to let the HW settle */ - mdelay(15); - - return 0; -} - -static bool wl128x_is_tcxo_valid(struct wl1271 *wl) -{ - u16 tcxo_detection; - int ret; - - ret = wl12xx_top_reg_read(wl, TCXO_CLK_DETECT_REG, &tcxo_detection); - if (ret < 0) - return false; - - if (tcxo_detection & TCXO_DET_FAILED) - return false; - - return true; -} - -static bool wl128x_is_fref_valid(struct wl1271 *wl) -{ - u16 fref_detection; - int ret; - - ret = wl12xx_top_reg_read(wl, FREF_CLK_DETECT_REG, &fref_detection); - if (ret < 0) - return false; - - if (fref_detection & FREF_CLK_DETECT_FAIL) - return false; - - return true; -} - -static int wl128x_manually_configure_mcs_pll(struct wl1271 *wl) -{ - int ret; - - ret = wl12xx_top_reg_write(wl, MCS_PLL_M_REG, MCS_PLL_M_REG_VAL); - if (ret < 0) - goto out; - - ret = wl12xx_top_reg_write(wl, MCS_PLL_N_REG, MCS_PLL_N_REG_VAL); - if (ret < 0) - goto out; - - ret = wl12xx_top_reg_write(wl, MCS_PLL_CONFIG_REG, - MCS_PLL_CONFIG_REG_VAL); - -out: - return ret; -} - -static int wl128x_configure_mcs_pll(struct wl1271 *wl, int clk) -{ - u16 spare_reg; - u16 pll_config; - u8 input_freq; - struct wl12xx_priv *priv = wl->priv; - int ret; - - /* Mask bits [3:1] in the sys_clk_cfg register */ - ret = wl12xx_top_reg_read(wl, WL_SPARE_REG, &spare_reg); - if (ret < 0) - return ret; - - if (spare_reg == 0xFFFF) - return -EFAULT; - spare_reg |= BIT(2); - ret = wl12xx_top_reg_write(wl, WL_SPARE_REG, spare_reg); - if (ret < 0) - return ret; - - /* Handle special cases of the TCXO clock */ - if (priv->tcxo_clock == WL12XX_TCXOCLOCK_16_8 || - priv->tcxo_clock == WL12XX_TCXOCLOCK_33_6) - return wl128x_manually_configure_mcs_pll(wl); - - /* Set the input frequency according to the selected clock source */ - input_freq = (clk & 1) + 1; - - ret = wl12xx_top_reg_read(wl, MCS_PLL_CONFIG_REG, &pll_config); - if (ret < 0) - return ret; - - if (pll_config == 0xFFFF) - return -EFAULT; - pll_config |= (input_freq << MCS_SEL_IN_FREQ_SHIFT); - pll_config |= MCS_PLL_ENABLE_HP; - ret = wl12xx_top_reg_write(wl, MCS_PLL_CONFIG_REG, pll_config); - - return ret; -} - -/* - * WL128x has two clocks input - TCXO and FREF. - * TCXO is the main clock of the device, while FREF is used to sync - * between the GPS and the cellular modem. - * In cases where TCXO is 32.736MHz or 16.368MHz, the FREF will be used - * as the WLAN/BT main clock. - */ -static int wl128x_boot_clk(struct wl1271 *wl, int *selected_clock) -{ - struct wl12xx_priv *priv = wl->priv; - u16 sys_clk_cfg; - int ret; - - /* For XTAL-only modes, FREF will be used after switching from TCXO */ - if (priv->ref_clock == WL12XX_REFCLOCK_26_XTAL || - priv->ref_clock == WL12XX_REFCLOCK_38_XTAL) { - if (!wl128x_switch_tcxo_to_fref(wl)) - return -EINVAL; - goto fref_clk; - } - - /* Query the HW, to determine which clock source we should use */ - ret = wl12xx_top_reg_read(wl, SYS_CLK_CFG_REG, &sys_clk_cfg); - if (ret < 0) - return ret; - - if (sys_clk_cfg == 0xFFFF) - return -EINVAL; - if (sys_clk_cfg & PRCM_CM_EN_MUX_WLAN_FREF) - goto fref_clk; - - /* If TCXO is either 32.736MHz or 16.368MHz, switch to FREF */ - if (priv->tcxo_clock == WL12XX_TCXOCLOCK_16_368 || - priv->tcxo_clock == WL12XX_TCXOCLOCK_32_736) { - if (!wl128x_switch_tcxo_to_fref(wl)) - return -EINVAL; - goto fref_clk; - } - - /* TCXO clock is selected */ - if (!wl128x_is_tcxo_valid(wl)) - return -EINVAL; - *selected_clock = priv->tcxo_clock; - goto config_mcs_pll; - -fref_clk: - /* FREF clock is selected */ - if (!wl128x_is_fref_valid(wl)) - return -EINVAL; - *selected_clock = priv->ref_clock; - -config_mcs_pll: - return wl128x_configure_mcs_pll(wl, *selected_clock); -} - -static int wl127x_boot_clk(struct wl1271 *wl) -{ - struct wl12xx_priv *priv = wl->priv; - u32 pause; - u32 clk; - int ret; - - if (WL127X_PG_GET_MAJOR(wl->hw_pg_ver) < 3) - wl->quirks |= WLCORE_QUIRK_END_OF_TRANSACTION; - - if (priv->ref_clock == CONF_REF_CLK_19_2_E || - priv->ref_clock == CONF_REF_CLK_38_4_E || - priv->ref_clock == CONF_REF_CLK_38_4_M_XTAL) - /* ref clk: 19.2/38.4/38.4-XTAL */ - clk = 0x3; - else if (priv->ref_clock == CONF_REF_CLK_26_E || - priv->ref_clock == CONF_REF_CLK_26_M_XTAL || - priv->ref_clock == CONF_REF_CLK_52_E) - /* ref clk: 26/52 */ - clk = 0x5; - else - return -EINVAL; - - if (priv->ref_clock != CONF_REF_CLK_19_2_E) { - u16 val; - /* Set clock type (open drain) */ - ret = wl12xx_top_reg_read(wl, OCP_REG_CLK_TYPE, &val); - if (ret < 0) - goto out; - - val &= FREF_CLK_TYPE_BITS; - ret = wl12xx_top_reg_write(wl, OCP_REG_CLK_TYPE, val); - if (ret < 0) - goto out; - - /* Set clock pull mode (no pull) */ - ret = wl12xx_top_reg_read(wl, OCP_REG_CLK_PULL, &val); - if (ret < 0) - goto out; - - val |= NO_PULL; - ret = wl12xx_top_reg_write(wl, OCP_REG_CLK_PULL, val); - if (ret < 0) - goto out; - } else { - u16 val; - /* Set clock polarity */ - ret = wl12xx_top_reg_read(wl, OCP_REG_CLK_POLARITY, &val); - if (ret < 0) - goto out; - - val &= FREF_CLK_POLARITY_BITS; - val |= CLK_REQ_OUTN_SEL; - ret = wl12xx_top_reg_write(wl, OCP_REG_CLK_POLARITY, val); - if (ret < 0) - goto out; - } - - ret = wlcore_write32(wl, WL12XX_PLL_PARAMETERS, clk); - if (ret < 0) - goto out; - - ret = wlcore_read32(wl, WL12XX_PLL_PARAMETERS, &pause); - if (ret < 0) - goto out; - - wl1271_debug(DEBUG_BOOT, "pause1 0x%x", pause); - - pause &= ~(WU_COUNTER_PAUSE_VAL); - pause |= WU_COUNTER_PAUSE_VAL; - ret = wlcore_write32(wl, WL12XX_WU_COUNTER_PAUSE, pause); - -out: - return ret; -} - -static int wl1271_boot_soft_reset(struct wl1271 *wl) -{ - unsigned long timeout; - u32 boot_data; - int ret = 0; - - /* perform soft reset */ - ret = wlcore_write32(wl, WL12XX_SLV_SOFT_RESET, ACX_SLV_SOFT_RESET_BIT); - if (ret < 0) - goto out; - - /* SOFT_RESET is self clearing */ - timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME); - while (1) { - ret = wlcore_read32(wl, WL12XX_SLV_SOFT_RESET, &boot_data); - if (ret < 0) - goto out; - - wl1271_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data); - if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0) - break; - - if (time_after(jiffies, timeout)) { - /* 1.2 check pWhalBus->uSelfClearTime if the - * timeout was reached */ - wl1271_error("soft reset timeout"); - return -1; - } - - udelay(SOFT_RESET_STALL_TIME); - } - - /* disable Rx/Tx */ - ret = wlcore_write32(wl, WL12XX_ENABLE, 0x0); - if (ret < 0) - goto out; - - /* disable auto calibration on start*/ - ret = wlcore_write32(wl, WL12XX_SPARE_A2, 0xffff); - -out: - return ret; -} - -static int wl12xx_pre_boot(struct wl1271 *wl) -{ - struct wl12xx_priv *priv = wl->priv; - int ret = 0; - u32 clk; - int selected_clock = -1; - - if (wl->chip.id == CHIP_ID_128X_PG20) { - ret = wl128x_boot_clk(wl, &selected_clock); - if (ret < 0) - goto out; - } else { - ret = wl127x_boot_clk(wl); - if (ret < 0) - goto out; - } - - /* Continue the ELP wake up sequence */ - ret = wlcore_write32(wl, WL12XX_WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); - if (ret < 0) - goto out; - - udelay(500); - - ret = wlcore_set_partition(wl, &wl->ptable[PART_DRPW]); - if (ret < 0) - goto out; - - /* Read-modify-write DRPW_SCRATCH_START register (see next state) - to be used by DRPw FW. The RTRIM value will be added by the FW - before taking DRPw out of reset */ - - ret = wlcore_read32(wl, WL12XX_DRPW_SCRATCH_START, &clk); - if (ret < 0) - goto out; - - wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk); - - if (wl->chip.id == CHIP_ID_128X_PG20) - clk |= ((selected_clock & 0x3) << 1) << 4; - else - clk |= (priv->ref_clock << 1) << 4; - - ret = wlcore_write32(wl, WL12XX_DRPW_SCRATCH_START, clk); - if (ret < 0) - goto out; - - ret = wlcore_set_partition(wl, &wl->ptable[PART_WORK]); - if (ret < 0) - goto out; - - /* Disable interrupts */ - ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); - if (ret < 0) - goto out; - - ret = wl1271_boot_soft_reset(wl); - if (ret < 0) - goto out; - -out: - return ret; -} - -static int wl12xx_pre_upload(struct wl1271 *wl) -{ - u32 tmp; - u16 polarity; - int ret; - - /* write firmware's last address (ie. it's length) to - * ACX_EEPROMLESS_IND_REG */ - wl1271_debug(DEBUG_BOOT, "ACX_EEPROMLESS_IND_REG"); - - ret = wlcore_write32(wl, WL12XX_EEPROMLESS_IND, WL12XX_EEPROMLESS_IND); - if (ret < 0) - goto out; - - ret = wlcore_read_reg(wl, REG_CHIP_ID_B, &tmp); - if (ret < 0) - goto out; - - wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp); - - /* 6. read the EEPROM parameters */ - ret = wlcore_read32(wl, WL12XX_SCR_PAD2, &tmp); - if (ret < 0) - goto out; - - /* WL1271: The reference driver skips steps 7 to 10 (jumps directly - * to upload_fw) */ - - if (wl->chip.id == CHIP_ID_128X_PG20) { - ret = wl12xx_top_reg_write(wl, SDIO_IO_DS, HCI_IO_DS_6MA); - if (ret < 0) - goto out; - } - - /* polarity must be set before the firmware is loaded */ - ret = wl12xx_top_reg_read(wl, OCP_REG_POLARITY, &polarity); - if (ret < 0) - goto out; - - /* We use HIGH polarity, so unset the LOW bit */ - polarity &= ~POLARITY_LOW; - ret = wl12xx_top_reg_write(wl, OCP_REG_POLARITY, polarity); - -out: - return ret; -} - -static int wl12xx_enable_interrupts(struct wl1271 *wl) -{ - int ret; - - ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, - WL12XX_ACX_ALL_EVENTS_VECTOR); - if (ret < 0) - goto out; - - wlcore_enable_interrupts(wl); - ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, - WL1271_ACX_INTR_ALL & ~(WL12XX_INTR_MASK)); - if (ret < 0) - goto disable_interrupts; - - ret = wlcore_write32(wl, WL12XX_HI_CFG, HI_CFG_DEF_VAL); - if (ret < 0) - goto disable_interrupts; - - return ret; - -disable_interrupts: - wlcore_disable_interrupts(wl); - -out: - return ret; -} - -static int wl12xx_boot(struct wl1271 *wl) -{ - int ret; - - ret = wl12xx_pre_boot(wl); - if (ret < 0) - goto out; - - ret = wlcore_boot_upload_nvs(wl); - if (ret < 0) - goto out; - - ret = wl12xx_pre_upload(wl); - if (ret < 0) - goto out; - - ret = wlcore_boot_upload_firmware(wl); - if (ret < 0) - goto out; - - wl->event_mask = BSS_LOSE_EVENT_ID | - REGAINED_BSS_EVENT_ID | - SCAN_COMPLETE_EVENT_ID | - ROLE_STOP_COMPLETE_EVENT_ID | - RSSI_SNR_TRIGGER_0_EVENT_ID | - PSPOLL_DELIVERY_FAILURE_EVENT_ID | - SOFT_GEMINI_SENSE_EVENT_ID | - PERIODIC_SCAN_REPORT_EVENT_ID | - PERIODIC_SCAN_COMPLETE_EVENT_ID | - DUMMY_PACKET_EVENT_ID | - PEER_REMOVE_COMPLETE_EVENT_ID | - BA_SESSION_RX_CONSTRAINT_EVENT_ID | - REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID | - INACTIVE_STA_EVENT_ID | - MAX_TX_RETRY_EVENT_ID | - CHANNEL_SWITCH_COMPLETE_EVENT_ID; - - ret = wlcore_boot_run_firmware(wl); - if (ret < 0) - goto out; - - ret = wl12xx_enable_interrupts(wl); - -out: - return ret; -} - -static int wl12xx_trigger_cmd(struct wl1271 *wl, int cmd_box_addr, - void *buf, size_t len) -{ - int ret; - - ret = wlcore_write(wl, cmd_box_addr, buf, len, false); - if (ret < 0) - return ret; - - ret = wlcore_write_reg(wl, REG_INTERRUPT_TRIG, WL12XX_INTR_TRIG_CMD); - - return ret; -} - -static int wl12xx_ack_event(struct wl1271 *wl) -{ - return wlcore_write_reg(wl, REG_INTERRUPT_TRIG, - WL12XX_INTR_TRIG_EVENT_ACK); -} - -static u32 wl12xx_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks) -{ - u32 blk_size = WL12XX_TX_HW_BLOCK_SIZE; - u32 align_len = wlcore_calc_packet_alignment(wl, len); - - return (align_len + blk_size - 1) / blk_size + spare_blks; -} - -static void -wl12xx_set_tx_desc_blocks(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc, - u32 blks, u32 spare_blks) -{ - if (wl->chip.id == CHIP_ID_128X_PG20) { - desc->wl128x_mem.total_mem_blocks = blks; - } else { - desc->wl127x_mem.extra_blocks = spare_blks; - desc->wl127x_mem.total_mem_blocks = blks; - } -} - -static void -wl12xx_set_tx_desc_data_len(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc, - struct sk_buff *skb) -{ - u32 aligned_len = wlcore_calc_packet_alignment(wl, skb->len); - - if (wl->chip.id == CHIP_ID_128X_PG20) { - desc->wl128x_mem.extra_bytes = aligned_len - skb->len; - desc->length = cpu_to_le16(aligned_len >> 2); - - wl1271_debug(DEBUG_TX, - "tx_fill_hdr: hlid: %d len: %d life: %d mem: %d extra: %d", - desc->hlid, - le16_to_cpu(desc->length), - le16_to_cpu(desc->life_time), - desc->wl128x_mem.total_mem_blocks, - desc->wl128x_mem.extra_bytes); - } else { - /* calculate number of padding bytes */ - int pad = aligned_len - skb->len; - desc->tx_attr |= - cpu_to_le16(pad << TX_HW_ATTR_OFST_LAST_WORD_PAD); - - /* Store the aligned length in terms of words */ - desc->length = cpu_to_le16(aligned_len >> 2); - - wl1271_debug(DEBUG_TX, - "tx_fill_hdr: pad: %d hlid: %d len: %d life: %d mem: %d", - pad, desc->hlid, - le16_to_cpu(desc->length), - le16_to_cpu(desc->life_time), - desc->wl127x_mem.total_mem_blocks); - } -} - -static enum wl_rx_buf_align -wl12xx_get_rx_buf_align(struct wl1271 *wl, u32 rx_desc) -{ - if (rx_desc & RX_BUF_UNALIGNED_PAYLOAD) - return WLCORE_RX_BUF_UNALIGNED; - - return WLCORE_RX_BUF_ALIGNED; -} - -static u32 wl12xx_get_rx_packet_len(struct wl1271 *wl, void *rx_data, - u32 data_len) -{ - struct wl1271_rx_descriptor *desc = rx_data; - - /* invalid packet */ - if (data_len < sizeof(*desc) || - data_len < sizeof(*desc) + desc->pad_len) - return 0; - - return data_len - sizeof(*desc) - desc->pad_len; -} - -static int wl12xx_tx_delayed_compl(struct wl1271 *wl) -{ - if (wl->fw_status_1->tx_results_counter == - (wl->tx_results_count & 0xff)) - return 0; - - return wlcore_tx_complete(wl); -} - -static int wl12xx_hw_init(struct wl1271 *wl) -{ - int ret; - - if (wl->chip.id == CHIP_ID_128X_PG20) { - u32 host_cfg_bitmap = HOST_IF_CFG_RX_FIFO_ENABLE; - - ret = wl128x_cmd_general_parms(wl); - if (ret < 0) - goto out; - - /* - * If we are in calibrator based auto detect then we got the FEM nr - * in wl->fem_manuf. No need to continue further - */ - if (wl->plt_mode == PLT_FEM_DETECT) - goto out; - - ret = wl128x_cmd_radio_parms(wl); - if (ret < 0) - goto out; - - if (wl->quirks & WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN) - /* Enable SDIO padding */ - host_cfg_bitmap |= HOST_IF_CFG_TX_PAD_TO_SDIO_BLK; - - /* Must be before wl1271_acx_init_mem_config() */ - ret = wl1271_acx_host_if_cfg_bitmap(wl, host_cfg_bitmap); - if (ret < 0) - goto out; - } else { - ret = wl1271_cmd_general_parms(wl); - if (ret < 0) - goto out; - - /* - * If we are in calibrator based auto detect then we got the FEM nr - * in wl->fem_manuf. No need to continue further - */ - if (wl->plt_mode == PLT_FEM_DETECT) - goto out; - - ret = wl1271_cmd_radio_parms(wl); - if (ret < 0) - goto out; - ret = wl1271_cmd_ext_radio_parms(wl); - if (ret < 0) - goto out; - } -out: - return ret; -} - -static u32 wl12xx_sta_get_ap_rate_mask(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - return wlvif->rate_set; -} - -static void wl12xx_conf_init(struct wl1271 *wl) -{ - struct wl12xx_priv *priv = wl->priv; - - /* apply driver default configuration */ - memcpy(&wl->conf, &wl12xx_conf, sizeof(wl12xx_conf)); - - /* apply default private configuration */ - memcpy(&priv->conf, &wl12xx_default_priv_conf, sizeof(priv->conf)); -} - -static bool wl12xx_mac_in_fuse(struct wl1271 *wl) -{ - bool supported = false; - u8 major, minor; - - if (wl->chip.id == CHIP_ID_128X_PG20) { - major = WL128X_PG_GET_MAJOR(wl->hw_pg_ver); - minor = WL128X_PG_GET_MINOR(wl->hw_pg_ver); - - /* in wl128x we have the MAC address if the PG is >= (2, 1) */ - if (major > 2 || (major == 2 && minor >= 1)) - supported = true; - } else { - major = WL127X_PG_GET_MAJOR(wl->hw_pg_ver); - minor = WL127X_PG_GET_MINOR(wl->hw_pg_ver); - - /* in wl127x we have the MAC address if the PG is >= (3, 1) */ - if (major == 3 && minor >= 1) - supported = true; - } - - wl1271_debug(DEBUG_PROBE, - "PG Ver major = %d minor = %d, MAC %s present", - major, minor, supported ? "is" : "is not"); - - return supported; -} - -static int wl12xx_get_fuse_mac(struct wl1271 *wl) -{ - u32 mac1, mac2; - int ret; - - ret = wlcore_set_partition(wl, &wl->ptable[PART_DRPW]); - if (ret < 0) - goto out; - - ret = wlcore_read32(wl, WL12XX_REG_FUSE_BD_ADDR_1, &mac1); - if (ret < 0) - goto out; - - ret = wlcore_read32(wl, WL12XX_REG_FUSE_BD_ADDR_2, &mac2); - if (ret < 0) - goto out; - - /* these are the two parts of the BD_ADDR */ - wl->fuse_oui_addr = ((mac2 & 0xffff) << 8) + - ((mac1 & 0xff000000) >> 24); - wl->fuse_nic_addr = mac1 & 0xffffff; - - ret = wlcore_set_partition(wl, &wl->ptable[PART_DOWN]); - -out: - return ret; -} - -static int wl12xx_get_pg_ver(struct wl1271 *wl, s8 *ver) -{ - u16 die_info; - int ret; - - if (wl->chip.id == CHIP_ID_128X_PG20) - ret = wl12xx_top_reg_read(wl, WL128X_REG_FUSE_DATA_2_1, - &die_info); - else - ret = wl12xx_top_reg_read(wl, WL127X_REG_FUSE_DATA_2_1, - &die_info); - - if (ret >= 0 && ver) - *ver = (s8)((die_info & PG_VER_MASK) >> PG_VER_OFFSET); - - return ret; -} - -static int wl12xx_get_mac(struct wl1271 *wl) -{ - if (wl12xx_mac_in_fuse(wl)) - return wl12xx_get_fuse_mac(wl); - - return 0; -} - -static void wl12xx_set_tx_desc_csum(struct wl1271 *wl, - struct wl1271_tx_hw_descr *desc, - struct sk_buff *skb) -{ - desc->wl12xx_reserved = 0; -} - -static int wl12xx_plt_init(struct wl1271 *wl) -{ - int ret; - - ret = wl->ops->boot(wl); - if (ret < 0) - goto out; - - ret = wl->ops->hw_init(wl); - if (ret < 0) - goto out_irq_disable; - - /* - * If we are in calibrator based auto detect then we got the FEM nr - * in wl->fem_manuf. No need to continue further - */ - if (wl->plt_mode == PLT_FEM_DETECT) - goto out; - - ret = wl1271_acx_init_mem_config(wl); - if (ret < 0) - goto out_irq_disable; - - ret = wl12xx_acx_mem_cfg(wl); - if (ret < 0) - goto out_free_memmap; - - /* Enable data path */ - ret = wl1271_cmd_data_path(wl, 1); - if (ret < 0) - goto out_free_memmap; - - /* Configure for CAM power saving (ie. always active) */ - ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM); - if (ret < 0) - goto out_free_memmap; - - /* configure PM */ - ret = wl1271_acx_pm_config(wl); - if (ret < 0) - goto out_free_memmap; - - goto out; - -out_free_memmap: - kfree(wl->target_mem_map); - wl->target_mem_map = NULL; - -out_irq_disable: - mutex_unlock(&wl->mutex); - /* Unlocking the mutex in the middle of handling is - inherently unsafe. In this case we deem it safe to do, - because we need to let any possibly pending IRQ out of - the system (and while we are WL1271_STATE_OFF the IRQ - work function will not do anything.) Also, any other - possible concurrent operations will fail due to the - current state, hence the wl1271 struct should be safe. */ - wlcore_disable_interrupts(wl); - mutex_lock(&wl->mutex); -out: - return ret; -} - -static int wl12xx_get_spare_blocks(struct wl1271 *wl, bool is_gem) -{ - if (is_gem) - return WL12XX_TX_HW_BLOCK_GEM_SPARE; - - return WL12XX_TX_HW_BLOCK_SPARE_DEFAULT; -} - -static int wl12xx_set_key(struct wl1271 *wl, enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key_conf) -{ - return wlcore_set_key(wl, cmd, vif, sta, key_conf); -} - -static int wl12xx_set_peer_cap(struct wl1271 *wl, - struct ieee80211_sta_ht_cap *ht_cap, - bool allow_ht_operation, - u32 rate_set, u8 hlid) -{ - return wl1271_acx_set_ht_capabilities(wl, ht_cap, allow_ht_operation, - hlid); -} - -static bool wl12xx_lnk_high_prio(struct wl1271 *wl, u8 hlid, - struct wl1271_link *lnk) -{ - u8 thold; - - if (test_bit(hlid, (unsigned long *)&wl->fw_fast_lnk_map)) - thold = wl->conf.tx.fast_link_thold; - else - thold = wl->conf.tx.slow_link_thold; - - return lnk->allocated_pkts < thold; -} - -static bool wl12xx_lnk_low_prio(struct wl1271 *wl, u8 hlid, - struct wl1271_link *lnk) -{ - /* any link is good for low priority */ - return true; -} - -static int wl12xx_setup(struct wl1271 *wl); - -static struct wlcore_ops wl12xx_ops = { - .setup = wl12xx_setup, - .identify_chip = wl12xx_identify_chip, - .boot = wl12xx_boot, - .plt_init = wl12xx_plt_init, - .trigger_cmd = wl12xx_trigger_cmd, - .ack_event = wl12xx_ack_event, - .wait_for_event = wl12xx_wait_for_event, - .process_mailbox_events = wl12xx_process_mailbox_events, - .calc_tx_blocks = wl12xx_calc_tx_blocks, - .set_tx_desc_blocks = wl12xx_set_tx_desc_blocks, - .set_tx_desc_data_len = wl12xx_set_tx_desc_data_len, - .get_rx_buf_align = wl12xx_get_rx_buf_align, - .get_rx_packet_len = wl12xx_get_rx_packet_len, - .tx_immediate_compl = NULL, - .tx_delayed_compl = wl12xx_tx_delayed_compl, - .hw_init = wl12xx_hw_init, - .init_vif = NULL, - .sta_get_ap_rate_mask = wl12xx_sta_get_ap_rate_mask, - .get_pg_ver = wl12xx_get_pg_ver, - .get_mac = wl12xx_get_mac, - .set_tx_desc_csum = wl12xx_set_tx_desc_csum, - .set_rx_csum = NULL, - .ap_get_mimo_wide_rate_mask = NULL, - .debugfs_init = wl12xx_debugfs_add_files, - .scan_start = wl12xx_scan_start, - .scan_stop = wl12xx_scan_stop, - .sched_scan_start = wl12xx_sched_scan_start, - .sched_scan_stop = wl12xx_scan_sched_scan_stop, - .get_spare_blocks = wl12xx_get_spare_blocks, - .set_key = wl12xx_set_key, - .channel_switch = wl12xx_cmd_channel_switch, - .pre_pkt_send = NULL, - .set_peer_cap = wl12xx_set_peer_cap, - .lnk_high_prio = wl12xx_lnk_high_prio, - .lnk_low_prio = wl12xx_lnk_low_prio, -}; - -static struct ieee80211_sta_ht_cap wl12xx_ht_cap = { - .cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 | - (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT), - .ht_supported = true, - .ampdu_factor = IEEE80211_HT_MAX_AMPDU_8K, - .ampdu_density = IEEE80211_HT_MPDU_DENSITY_8, - .mcs = { - .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, - .rx_highest = cpu_to_le16(72), - .tx_params = IEEE80211_HT_MCS_TX_DEFINED, - }, -}; - -static int wl12xx_setup(struct wl1271 *wl) -{ - struct wl12xx_priv *priv = wl->priv; - struct wlcore_platdev_data *pdev_data = wl->pdev->dev.platform_data; - struct wl12xx_platform_data *pdata = pdev_data->pdata; - - wl->rtable = wl12xx_rtable; - wl->num_tx_desc = WL12XX_NUM_TX_DESCRIPTORS; - wl->num_rx_desc = WL12XX_NUM_RX_DESCRIPTORS; - wl->num_channels = 1; - wl->num_mac_addr = WL12XX_NUM_MAC_ADDRESSES; - wl->band_rate_to_idx = wl12xx_band_rate_to_idx; - wl->hw_tx_rate_tbl_size = WL12XX_CONF_HW_RXTX_RATE_MAX; - wl->hw_min_ht_rate = WL12XX_CONF_HW_RXTX_RATE_MCS0; - wl->fw_status_priv_len = 0; - wl->stats.fw_stats_len = sizeof(struct wl12xx_acx_statistics); - wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ, &wl12xx_ht_cap); - wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ, &wl12xx_ht_cap); - wl12xx_conf_init(wl); - - if (!fref_param) { - priv->ref_clock = pdata->board_ref_clock; - } else { - if (!strcmp(fref_param, "19.2")) - priv->ref_clock = WL12XX_REFCLOCK_19; - else if (!strcmp(fref_param, "26")) - priv->ref_clock = WL12XX_REFCLOCK_26; - else if (!strcmp(fref_param, "26x")) - priv->ref_clock = WL12XX_REFCLOCK_26_XTAL; - else if (!strcmp(fref_param, "38.4")) - priv->ref_clock = WL12XX_REFCLOCK_38; - else if (!strcmp(fref_param, "38.4x")) - priv->ref_clock = WL12XX_REFCLOCK_38_XTAL; - else if (!strcmp(fref_param, "52")) - priv->ref_clock = WL12XX_REFCLOCK_52; - else - wl1271_error("Invalid fref parameter %s", fref_param); - } - - if (!tcxo_param) { - priv->tcxo_clock = pdata->board_tcxo_clock; - } else { - if (!strcmp(tcxo_param, "19.2")) - priv->tcxo_clock = WL12XX_TCXOCLOCK_19_2; - else if (!strcmp(tcxo_param, "26")) - priv->tcxo_clock = WL12XX_TCXOCLOCK_26; - else if (!strcmp(tcxo_param, "38.4")) - priv->tcxo_clock = WL12XX_TCXOCLOCK_38_4; - else if (!strcmp(tcxo_param, "52")) - priv->tcxo_clock = WL12XX_TCXOCLOCK_52; - else if (!strcmp(tcxo_param, "16.368")) - priv->tcxo_clock = WL12XX_TCXOCLOCK_16_368; - else if (!strcmp(tcxo_param, "32.736")) - priv->tcxo_clock = WL12XX_TCXOCLOCK_32_736; - else if (!strcmp(tcxo_param, "16.8")) - priv->tcxo_clock = WL12XX_TCXOCLOCK_16_8; - else if (!strcmp(tcxo_param, "33.6")) - priv->tcxo_clock = WL12XX_TCXOCLOCK_33_6; - else - wl1271_error("Invalid tcxo parameter %s", tcxo_param); - } - - priv->rx_mem_addr = kmalloc(sizeof(*priv->rx_mem_addr), GFP_KERNEL); - if (!priv->rx_mem_addr) - return -ENOMEM; - - return 0; -} - -static int wl12xx_probe(struct platform_device *pdev) -{ - struct wl1271 *wl; - struct ieee80211_hw *hw; - int ret; - - hw = wlcore_alloc_hw(sizeof(struct wl12xx_priv), - WL12XX_AGGR_BUFFER_SIZE, - sizeof(struct wl12xx_event_mailbox)); - if (IS_ERR(hw)) { - wl1271_error("can't allocate hw"); - ret = PTR_ERR(hw); - goto out; - } - - wl = hw->priv; - wl->ops = &wl12xx_ops; - wl->ptable = wl12xx_ptable; - ret = wlcore_probe(wl, pdev); - if (ret) - goto out_free; - - return ret; - -out_free: - wlcore_free_hw(wl); -out: - return ret; -} - -static int wl12xx_remove(struct platform_device *pdev) -{ - struct wl1271 *wl = platform_get_drvdata(pdev); - struct wl12xx_priv *priv; - - if (!wl) - goto out; - priv = wl->priv; - - kfree(priv->rx_mem_addr); - -out: - return wlcore_remove(pdev); -} - -static const struct platform_device_id wl12xx_id_table[] = { - { "wl12xx", 0 }, - { } /* Terminating Entry */ -}; -MODULE_DEVICE_TABLE(platform, wl12xx_id_table); - -static struct platform_driver wl12xx_driver = { - .probe = wl12xx_probe, - .remove = wl12xx_remove, - .id_table = wl12xx_id_table, - .driver = { - .name = "wl12xx_driver", - .owner = THIS_MODULE, - } -}; - -module_platform_driver(wl12xx_driver); - -module_param_named(fref, fref_param, charp, 0); -MODULE_PARM_DESC(fref, "FREF clock: 19.2, 26, 26x, 38.4, 38.4x, 52"); - -module_param_named(tcxo, tcxo_param, charp, 0); -MODULE_PARM_DESC(tcxo, - "TCXO clock: 19.2, 26, 38.4, 52, 16.368, 32.736, 16.8, 33.6"); - -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Luciano Coelho "); -MODULE_FIRMWARE(WL127X_FW_NAME_SINGLE); -MODULE_FIRMWARE(WL127X_FW_NAME_MULTI); -MODULE_FIRMWARE(WL127X_PLT_FW_NAME); -MODULE_FIRMWARE(WL128X_FW_NAME_SINGLE); -MODULE_FIRMWARE(WL128X_FW_NAME_MULTI); -MODULE_FIRMWARE(WL128X_PLT_FW_NAME); diff --git a/drivers/net/wireless/ti/wl12xx/reg.h b/drivers/net/wireless/ti/wl12xx/reg.h deleted file mode 100644 index 79ede02e2587..000000000000 --- a/drivers/net/wireless/ti/wl12xx/reg.h +++ /dev/null @@ -1,556 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 1998-2009 Texas Instruments. All rights reserved. - * Copyright (C) 2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __REG_H__ -#define __REG_H__ - -#include - -#define REGISTERS_BASE 0x00300000 -#define DRPW_BASE 0x00310000 - -#define REGISTERS_DOWN_SIZE 0x00008800 -#define REGISTERS_WORK_SIZE 0x0000b000 - -#define FW_STATUS_ADDR (0x14FC0 + 0xA000) - -/*=============================================== - Host Software Reset - 32bit RW - ------------------------------------------ - [31:1] Reserved - 0 SOFT_RESET Soft Reset - When this bit is set, - it holds the Wlan hardware in a soft reset state. - This reset disables all MAC and baseband processor - clocks except the CardBus/PCI interface clock. - It also initializes all MAC state machines except - the host interface. It does not reload the - contents of the EEPROM. When this bit is cleared - (not self-clearing), the Wlan hardware - exits the software reset state. -===============================================*/ -#define WL12XX_SLV_SOFT_RESET (REGISTERS_BASE + 0x0000) - -#define WL1271_SLV_REG_DATA (REGISTERS_BASE + 0x0008) -#define WL1271_SLV_REG_ADATA (REGISTERS_BASE + 0x000c) -#define WL1271_SLV_MEM_DATA (REGISTERS_BASE + 0x0018) - -#define WL12XX_REG_INTERRUPT_TRIG (REGISTERS_BASE + 0x0474) -#define WL12XX_REG_INTERRUPT_TRIG_H (REGISTERS_BASE + 0x0478) - -/*============================================= - Host Interrupt Mask Register - 32bit (RW) - ------------------------------------------ - Setting a bit in this register masks the - corresponding interrupt to the host. - 0 - RX0 - Rx first dubble buffer Data Interrupt - 1 - TXD - Tx Data Interrupt - 2 - TXXFR - Tx Transfer Interrupt - 3 - RX1 - Rx second dubble buffer Data Interrupt - 4 - RXXFR - Rx Transfer Interrupt - 5 - EVENT_A - Event Mailbox interrupt - 6 - EVENT_B - Event Mailbox interrupt - 7 - WNONHST - Wake On Host Interrupt - 8 - TRACE_A - Debug Trace interrupt - 9 - TRACE_B - Debug Trace interrupt - 10 - CDCMP - Command Complete Interrupt - 11 - - 12 - - 13 - - 14 - ICOMP - Initialization Complete Interrupt - 16 - SG SE - Soft Gemini - Sense enable interrupt - 17 - SG SD - Soft Gemini - Sense disable interrupt - 18 - - - 19 - - - 20 - - - 21- - - Default: 0x0001 -*==============================================*/ -#define WL12XX_REG_INTERRUPT_MASK (REGISTERS_BASE + 0x04DC) - -/*============================================= - Host Interrupt Mask Set 16bit, (Write only) - ------------------------------------------ - Setting a bit in this register sets - the corresponding bin in ACX_HINT_MASK register - without effecting the mask - state of other bits (0 = no effect). -==============================================*/ -#define ACX_REG_HINT_MASK_SET (REGISTERS_BASE + 0x04E0) - -/*============================================= - Host Interrupt Mask Clear 16bit,(Write only) - ------------------------------------------ - Setting a bit in this register clears - the corresponding bin in ACX_HINT_MASK register - without effecting the mask - state of other bits (0 = no effect). -=============================================*/ -#define ACX_REG_HINT_MASK_CLR (REGISTERS_BASE + 0x04E4) - -/*============================================= - Host Interrupt Status Nondestructive Read - 16bit,(Read only) - ------------------------------------------ - The host can read this register to determine - which interrupts are active. - Reading this register doesn't - effect its content. -=============================================*/ -#define WL12XX_REG_INTERRUPT_NO_CLEAR (REGISTERS_BASE + 0x04E8) - -/*============================================= - Host Interrupt Status Clear on Read Register - 16bit,(Read only) - ------------------------------------------ - The host can read this register to determine - which interrupts are active. - Reading this register clears it, - thus making all interrupts inactive. -==============================================*/ -#define ACX_REG_INTERRUPT_CLEAR (REGISTERS_BASE + 0x04F8) - -/*============================================= - Host Interrupt Acknowledge Register - 16bit,(Write only) - ------------------------------------------ - The host can set individual bits in this - register to clear (acknowledge) the corresp. - interrupt status bits in the HINT_STS_CLR and - HINT_STS_ND registers, thus making the - assotiated interrupt inactive. (0-no effect) -==============================================*/ -#define WL12XX_REG_INTERRUPT_ACK (REGISTERS_BASE + 0x04F0) - -#define WL12XX_REG_RX_DRIVER_COUNTER (REGISTERS_BASE + 0x0538) - -/* Device Configuration registers*/ -#define SOR_CFG (REGISTERS_BASE + 0x0800) - -/* Embedded ARM CPU Control */ - -/*=============================================== - Halt eCPU - 32bit RW - ------------------------------------------ - 0 HALT_ECPU Halt Embedded CPU - This bit is the - compliment of bit 1 (MDATA2) in the SOR_CFG register. - During a hardware reset, this bit holds - the inverse of MDATA2. - When downloading firmware from the host, - set this bit (pull down MDATA2). - The host clears this bit after downloading the firmware into - zero-wait-state SSRAM. - When loading firmware from Flash, clear this bit (pull up MDATA2) - so that the eCPU can run the bootloader code in Flash - HALT_ECPU eCPU State - -------------------- - 1 halt eCPU - 0 enable eCPU - ===============================================*/ -#define WL12XX_REG_ECPU_CONTROL (REGISTERS_BASE + 0x0804) - -#define WL12XX_HI_CFG (REGISTERS_BASE + 0x0808) - -/*=============================================== - EEPROM Burst Read Start - 32bit RW - ------------------------------------------ - [31:1] Reserved - 0 ACX_EE_START - EEPROM Burst Read Start 0 - Setting this bit starts a burst read from - the external EEPROM. - If this bit is set (after reset) before an EEPROM read/write, - the burst read starts at EEPROM address 0. - Otherwise, it starts at the address - following the address of the previous access. - TheWlan hardware hardware clears this bit automatically. - - Default: 0x00000000 -*================================================*/ -#define ACX_REG_EE_START (REGISTERS_BASE + 0x080C) - -#define WL12XX_OCP_POR_CTR (REGISTERS_BASE + 0x09B4) -#define WL12XX_OCP_DATA_WRITE (REGISTERS_BASE + 0x09B8) -#define WL12XX_OCP_DATA_READ (REGISTERS_BASE + 0x09BC) -#define WL12XX_OCP_CMD (REGISTERS_BASE + 0x09C0) - -#define WL12XX_HOST_WR_ACCESS (REGISTERS_BASE + 0x09F8) - -#define WL12XX_CHIP_ID_B (REGISTERS_BASE + 0x5674) - -#define WL12XX_ENABLE (REGISTERS_BASE + 0x5450) - -/* Power Management registers */ -#define WL12XX_ELP_CFG_MODE (REGISTERS_BASE + 0x5804) -#define WL12XX_ELP_CMD (REGISTERS_BASE + 0x5808) -#define WL12XX_PLL_CAL_TIME (REGISTERS_BASE + 0x5810) -#define WL12XX_CLK_REQ_TIME (REGISTERS_BASE + 0x5814) -#define WL12XX_CLK_BUF_TIME (REGISTERS_BASE + 0x5818) - -#define WL12XX_CFG_PLL_SYNC_CNT (REGISTERS_BASE + 0x5820) - -/* Scratch Pad registers*/ -#define WL12XX_SCR_PAD0 (REGISTERS_BASE + 0x5608) -#define WL12XX_SCR_PAD1 (REGISTERS_BASE + 0x560C) -#define WL12XX_SCR_PAD2 (REGISTERS_BASE + 0x5610) -#define WL12XX_SCR_PAD3 (REGISTERS_BASE + 0x5614) -#define WL12XX_SCR_PAD4 (REGISTERS_BASE + 0x5618) -#define WL12XX_SCR_PAD4_SET (REGISTERS_BASE + 0x561C) -#define WL12XX_SCR_PAD4_CLR (REGISTERS_BASE + 0x5620) -#define WL12XX_SCR_PAD5 (REGISTERS_BASE + 0x5624) -#define WL12XX_SCR_PAD5_SET (REGISTERS_BASE + 0x5628) -#define WL12XX_SCR_PAD5_CLR (REGISTERS_BASE + 0x562C) -#define WL12XX_SCR_PAD6 (REGISTERS_BASE + 0x5630) -#define WL12XX_SCR_PAD7 (REGISTERS_BASE + 0x5634) -#define WL12XX_SCR_PAD8 (REGISTERS_BASE + 0x5638) -#define WL12XX_SCR_PAD9 (REGISTERS_BASE + 0x563C) - -/* Spare registers*/ -#define WL12XX_SPARE_A1 (REGISTERS_BASE + 0x0994) -#define WL12XX_SPARE_A2 (REGISTERS_BASE + 0x0998) -#define WL12XX_SPARE_A3 (REGISTERS_BASE + 0x099C) -#define WL12XX_SPARE_A4 (REGISTERS_BASE + 0x09A0) -#define WL12XX_SPARE_A5 (REGISTERS_BASE + 0x09A4) -#define WL12XX_SPARE_A6 (REGISTERS_BASE + 0x09A8) -#define WL12XX_SPARE_A7 (REGISTERS_BASE + 0x09AC) -#define WL12XX_SPARE_A8 (REGISTERS_BASE + 0x09B0) -#define WL12XX_SPARE_B1 (REGISTERS_BASE + 0x5420) -#define WL12XX_SPARE_B2 (REGISTERS_BASE + 0x5424) -#define WL12XX_SPARE_B3 (REGISTERS_BASE + 0x5428) -#define WL12XX_SPARE_B4 (REGISTERS_BASE + 0x542C) -#define WL12XX_SPARE_B5 (REGISTERS_BASE + 0x5430) -#define WL12XX_SPARE_B6 (REGISTERS_BASE + 0x5434) -#define WL12XX_SPARE_B7 (REGISTERS_BASE + 0x5438) -#define WL12XX_SPARE_B8 (REGISTERS_BASE + 0x543C) - -#define WL12XX_PLL_PARAMETERS (REGISTERS_BASE + 0x6040) -#define WL12XX_WU_COUNTER_PAUSE (REGISTERS_BASE + 0x6008) -#define WL12XX_WELP_ARM_COMMAND (REGISTERS_BASE + 0x6100) -#define WL12XX_DRPW_SCRATCH_START (DRPW_BASE + 0x002C) - -#define WL12XX_CMD_MBOX_ADDRESS 0x407B4 - -#define ACX_REG_EEPROM_START_BIT BIT(1) - -/* Command/Information Mailbox Pointers */ - -/*=============================================== - Command Mailbox Pointer - 32bit RW - ------------------------------------------ - This register holds the start address of - the command mailbox located in the Wlan hardware memory. - The host must read this pointer after a reset to - find the location of the command mailbox. - The Wlan hardware initializes the command mailbox - pointer with the default address of the command mailbox. - The command mailbox pointer is not valid until after - the host receives the Init Complete interrupt from - the Wlan hardware. - ===============================================*/ -#define WL12XX_REG_COMMAND_MAILBOX_PTR (WL12XX_SCR_PAD0) - -/*=============================================== - Information Mailbox Pointer - 32bit RW - ------------------------------------------ - This register holds the start address of - the information mailbox located in the Wlan hardware memory. - The host must read this pointer after a reset to find - the location of the information mailbox. - The Wlan hardware initializes the information mailbox pointer - with the default address of the information mailbox. - The information mailbox pointer is not valid - until after the host receives the Init Complete interrupt from - the Wlan hardware. - ===============================================*/ -#define WL12XX_REG_EVENT_MAILBOX_PTR (WL12XX_SCR_PAD1) - -/*=============================================== - EEPROM Read/Write Request 32bit RW - ------------------------------------------ - 1 EE_READ - EEPROM Read Request 1 - Setting this bit - loads a single byte of data into the EE_DATA - register from the EEPROM location specified in - the EE_ADDR register. - The Wlan hardware hardware clears this bit automatically. - EE_DATA is valid when this bit is cleared. - - 0 EE_WRITE - EEPROM Write Request - Setting this bit - writes a single byte of data from the EE_DATA register into the - EEPROM location specified in the EE_ADDR register. - The Wlan hardware hardware clears this bit automatically. -*===============================================*/ -#define ACX_EE_CTL_REG EE_CTL -#define EE_WRITE 0x00000001ul -#define EE_READ 0x00000002ul - -/*=============================================== - EEPROM Address - 32bit RW - ------------------------------------------ - This register specifies the address - within the EEPROM from/to which to read/write data. - ===============================================*/ -#define ACX_EE_ADDR_REG EE_ADDR - -/*=============================================== - EEPROM Data - 32bit RW - ------------------------------------------ - This register either holds the read 8 bits of - data from the EEPROM or the write data - to be written to the EEPROM. - ===============================================*/ -#define ACX_EE_DATA_REG EE_DATA - -/*=============================================== - EEPROM Base Address - 32bit RW - ------------------------------------------ - This register holds the upper nine bits - [23:15] of the 24-bit Wlan hardware memory - address for burst reads from EEPROM accesses. - The EEPROM provides the lower 15 bits of this address. - The MSB of the address from the EEPROM is ignored. - ===============================================*/ -#define ACX_EE_CFG EE_CFG - -/*=============================================== - GPIO Output Values -32bit, RW - ------------------------------------------ - [31:16] Reserved - [15: 0] Specify the output values (at the output driver inputs) for - GPIO[15:0], respectively. - ===============================================*/ -#define ACX_GPIO_OUT_REG GPIO_OUT -#define ACX_MAX_GPIO_LINES 15 - -/*=============================================== - Contention window -32bit, RW - ------------------------------------------ - [31:26] Reserved - [25:16] Max (0x3ff) - [15:07] Reserved - [06:00] Current contention window value - default is 0x1F - ===============================================*/ -#define ACX_CONT_WIND_CFG_REG CONT_WIND_CFG -#define ACX_CONT_WIND_MIN_MASK 0x0000007f -#define ACX_CONT_WIND_MAX 0x03ff0000 - -#define REF_FREQ_19_2 0 -#define REF_FREQ_26_0 1 -#define REF_FREQ_38_4 2 -#define REF_FREQ_40_0 3 -#define REF_FREQ_33_6 4 -#define REF_FREQ_NUM 5 - -#define LUT_PARAM_INTEGER_DIVIDER 0 -#define LUT_PARAM_FRACTIONAL_DIVIDER 1 -#define LUT_PARAM_ATTN_BB 2 -#define LUT_PARAM_ALPHA_BB 3 -#define LUT_PARAM_STOP_TIME_BB 4 -#define LUT_PARAM_BB_PLL_LOOP_FILTER 5 -#define LUT_PARAM_NUM 6 - -#define WL12XX_EEPROMLESS_IND (WL12XX_SCR_PAD4) -#define USE_EEPROM 0 -#define NVS_DATA_BUNDARY_ALIGNMENT 4 - -/* Firmware image header size */ -#define FW_HDR_SIZE 8 - -/****************************************************************************** - - CHANNELS, BAND & REG DOMAINS definitions - -******************************************************************************/ - -#define SHORT_PREAMBLE_BIT BIT(0) /* CCK or Barker depending on the rate */ -#define OFDM_RATE_BIT BIT(6) -#define PBCC_RATE_BIT BIT(7) - -enum { - CCK_LONG = 0, - CCK_SHORT = SHORT_PREAMBLE_BIT, - PBCC_LONG = PBCC_RATE_BIT, - PBCC_SHORT = PBCC_RATE_BIT | SHORT_PREAMBLE_BIT, - OFDM = OFDM_RATE_BIT -}; - -/****************************************************************************** - -Transmit-Descriptor RATE-SET field definitions... - -Define a new "Rate-Set" for TX path that incorporates the -Rate & Modulation info into a single 16-bit field. - -TxdRateSet_t: -b15 - Indicates Preamble type (1=SHORT, 0=LONG). - Notes: - Must be LONG (0) for 1Mbps rate. - Does not apply (set to 0) for RevG-OFDM rates. -b14 - Indicates PBCC encoding (1=PBCC, 0=not). - Notes: - Does not apply (set to 0) for rates 1 and 2 Mbps. - Does not apply (set to 0) for RevG-OFDM rates. -b13 - Unused (set to 0). -b12-b0 - Supported Rate indicator bits as defined below. - -******************************************************************************/ - -#define OCP_CMD_LOOP 32 -#define OCP_CMD_WRITE 0x1 -#define OCP_CMD_READ 0x2 -#define OCP_READY_MASK BIT(18) -#define OCP_STATUS_MASK (BIT(16) | BIT(17)) -#define OCP_STATUS_NO_RESP 0x00000 -#define OCP_STATUS_OK 0x10000 -#define OCP_STATUS_REQ_FAILED 0x20000 -#define OCP_STATUS_RESP_ERROR 0x30000 - -#define OCP_REG_POLARITY 0x0064 -#define OCP_REG_CLK_TYPE 0x0448 -#define OCP_REG_CLK_POLARITY 0x0cb2 -#define OCP_REG_CLK_PULL 0x0cb4 - -#define POLARITY_LOW BIT(1) -#define NO_PULL (BIT(14) | BIT(15)) - -#define FREF_CLK_TYPE_BITS 0xfffffe7f -#define CLK_REQ_PRCM 0x100 -#define FREF_CLK_POLARITY_BITS 0xfffff8ff -#define CLK_REQ_OUTN_SEL 0x700 - -#define WU_COUNTER_PAUSE_VAL 0x3FF - -/* PLL configuration algorithm for wl128x */ -#define SYS_CLK_CFG_REG 0x2200 -/* Bit[0] - 0-TCXO, 1-FREF */ -#define MCS_PLL_CLK_SEL_FREF BIT(0) -/* Bit[3:2] - 01-TCXO, 10-FREF */ -#define WL_CLK_REQ_TYPE_FREF BIT(3) -#define WL_CLK_REQ_TYPE_PG2 (BIT(3) | BIT(2)) -/* Bit[4] - 0-TCXO, 1-FREF */ -#define PRCM_CM_EN_MUX_WLAN_FREF BIT(4) - -#define TCXO_ILOAD_INT_REG 0x2264 -#define TCXO_CLK_DETECT_REG 0x2266 - -#define TCXO_DET_FAILED BIT(4) - -#define FREF_ILOAD_INT_REG 0x2084 -#define FREF_CLK_DETECT_REG 0x2086 -#define FREF_CLK_DETECT_FAIL BIT(4) - -/* Use this reg for masking during driver access */ -#define WL_SPARE_REG 0x2320 -#define WL_SPARE_VAL BIT(2) -/* Bit[6:5:3] - mask wl write SYS_CLK_CFG[8:5:2:4] */ -#define WL_SPARE_MASK_8526 (BIT(6) | BIT(5) | BIT(3)) - -#define PLL_LOCK_COUNTERS_REG 0xD8C -#define PLL_LOCK_COUNTERS_COEX 0x0F -#define PLL_LOCK_COUNTERS_MCS 0xF0 -#define MCS_PLL_OVERRIDE_REG 0xD90 -#define MCS_PLL_CONFIG_REG 0xD92 -#define MCS_SEL_IN_FREQ_MASK 0x0070 -#define MCS_SEL_IN_FREQ_SHIFT 4 -#define MCS_PLL_CONFIG_REG_VAL 0x73 -#define MCS_PLL_ENABLE_HP (BIT(0) | BIT(1)) - -#define MCS_PLL_M_REG 0xD94 -#define MCS_PLL_N_REG 0xD96 -#define MCS_PLL_M_REG_VAL 0xC8 -#define MCS_PLL_N_REG_VAL 0x07 - -#define SDIO_IO_DS 0xd14 - -/* SDIO/wSPI DS configuration values */ -enum { - HCI_IO_DS_8MA = 0, - HCI_IO_DS_4MA = 1, /* default */ - HCI_IO_DS_6MA = 2, - HCI_IO_DS_2MA = 3, -}; - -/* end PLL configuration algorithm for wl128x */ - -/* - * Host Command Interrupt. Setting this bit masks - * the interrupt that the host issues to inform - * the FW that it has sent a command - * to the Wlan hardware Command Mailbox. - */ -#define WL12XX_INTR_TRIG_CMD BIT(0) - -/* - * Host Event Acknowlegde Interrupt. The host - * sets this bit to acknowledge that it received - * the unsolicited information from the event - * mailbox. - */ -#define WL12XX_INTR_TRIG_EVENT_ACK BIT(1) - -/*=============================================== - HI_CFG Interface Configuration Register Values - ------------------------------------------ - ===============================================*/ -#define HI_CFG_UART_ENABLE 0x00000004 -#define HI_CFG_RST232_ENABLE 0x00000008 -#define HI_CFG_CLOCK_REQ_SELECT 0x00000010 -#define HI_CFG_HOST_INT_ENABLE 0x00000020 -#define HI_CFG_VLYNQ_OUTPUT_ENABLE 0x00000040 -#define HI_CFG_HOST_INT_ACTIVE_LOW 0x00000080 -#define HI_CFG_UART_TX_OUT_GPIO_15 0x00000100 -#define HI_CFG_UART_TX_OUT_GPIO_14 0x00000200 -#define HI_CFG_UART_TX_OUT_GPIO_7 0x00000400 - -#define HI_CFG_DEF_VAL \ - (HI_CFG_UART_ENABLE | \ - HI_CFG_RST232_ENABLE | \ - HI_CFG_CLOCK_REQ_SELECT | \ - HI_CFG_HOST_INT_ENABLE) - -#define WL127X_REG_FUSE_DATA_2_1 0x050a -#define WL128X_REG_FUSE_DATA_2_1 0x2152 -#define PG_VER_MASK 0x3c -#define PG_VER_OFFSET 2 - -#define WL127X_PG_MAJOR_VER_MASK 0x3 -#define WL127X_PG_MAJOR_VER_OFFSET 0x0 -#define WL127X_PG_MINOR_VER_MASK 0xc -#define WL127X_PG_MINOR_VER_OFFSET 0x2 - -#define WL128X_PG_MAJOR_VER_MASK 0xc -#define WL128X_PG_MAJOR_VER_OFFSET 0x2 -#define WL128X_PG_MINOR_VER_MASK 0x3 -#define WL128X_PG_MINOR_VER_OFFSET 0x0 - -#define WL127X_PG_GET_MAJOR(pg_ver) ((pg_ver & WL127X_PG_MAJOR_VER_MASK) >> \ - WL127X_PG_MAJOR_VER_OFFSET) -#define WL127X_PG_GET_MINOR(pg_ver) ((pg_ver & WL127X_PG_MINOR_VER_MASK) >> \ - WL127X_PG_MINOR_VER_OFFSET) -#define WL128X_PG_GET_MAJOR(pg_ver) ((pg_ver & WL128X_PG_MAJOR_VER_MASK) >> \ - WL128X_PG_MAJOR_VER_OFFSET) -#define WL128X_PG_GET_MINOR(pg_ver) ((pg_ver & WL128X_PG_MINOR_VER_MASK) >> \ - WL128X_PG_MINOR_VER_OFFSET) - -#define WL12XX_REG_FUSE_BD_ADDR_1 0x00310eb4 -#define WL12XX_REG_FUSE_BD_ADDR_2 0x00310eb8 - -#endif diff --git a/drivers/net/wireless/ti/wl12xx/scan.c b/drivers/net/wireless/ti/wl12xx/scan.c deleted file mode 100644 index 4a0bbb13806b..000000000000 --- a/drivers/net/wireless/ti/wl12xx/scan.c +++ /dev/null @@ -1,501 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2012 Texas Instruments. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include "scan.h" -#include "../wlcore/debug.h" -#include "../wlcore/tx.h" - -static int wl1271_get_scan_channels(struct wl1271 *wl, - struct cfg80211_scan_request *req, - struct basic_scan_channel_params *channels, - enum ieee80211_band band, bool passive) -{ - struct conf_scan_settings *c = &wl->conf.scan; - int i, j; - u32 flags; - - for (i = 0, j = 0; - i < req->n_channels && j < WL1271_SCAN_MAX_CHANNELS; - i++) { - flags = req->channels[i]->flags; - - if (!test_bit(i, wl->scan.scanned_ch) && - !(flags & IEEE80211_CHAN_DISABLED) && - (req->channels[i]->band == band) && - /* - * In passive scans, we scan all remaining - * channels, even if not marked as such. - * In active scans, we only scan channels not - * marked as passive. - */ - (passive || !(flags & IEEE80211_CHAN_PASSIVE_SCAN))) { - wl1271_debug(DEBUG_SCAN, "band %d, center_freq %d ", - req->channels[i]->band, - req->channels[i]->center_freq); - wl1271_debug(DEBUG_SCAN, "hw_value %d, flags %X", - req->channels[i]->hw_value, - req->channels[i]->flags); - wl1271_debug(DEBUG_SCAN, - "max_antenna_gain %d, max_power %d", - req->channels[i]->max_antenna_gain, - req->channels[i]->max_power); - wl1271_debug(DEBUG_SCAN, "beacon_found %d", - req->channels[i]->beacon_found); - - if (!passive) { - channels[j].min_duration = - cpu_to_le32(c->min_dwell_time_active); - channels[j].max_duration = - cpu_to_le32(c->max_dwell_time_active); - } else { - channels[j].min_duration = - cpu_to_le32(c->dwell_time_passive); - channels[j].max_duration = - cpu_to_le32(c->dwell_time_passive); - } - channels[j].early_termination = 0; - channels[j].tx_power_att = req->channels[i]->max_power; - channels[j].channel = req->channels[i]->hw_value; - - memset(&channels[j].bssid_lsb, 0xff, 4); - memset(&channels[j].bssid_msb, 0xff, 2); - - /* Mark the channels we already used */ - set_bit(i, wl->scan.scanned_ch); - - j++; - } - } - - return j; -} - -#define WL1271_NOTHING_TO_SCAN 1 - -static int wl1271_scan_send(struct wl1271 *wl, struct wl12xx_vif *wlvif, - enum ieee80211_band band, - bool passive, u32 basic_rate) -{ - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - struct wl1271_cmd_scan *cmd; - struct wl1271_cmd_trigger_scan_to *trigger; - int ret; - u16 scan_options = 0; - - /* skip active scans if we don't have SSIDs */ - if (!passive && wl->scan.req->n_ssids == 0) - return WL1271_NOTHING_TO_SCAN; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - trigger = kzalloc(sizeof(*trigger), GFP_KERNEL); - if (!cmd || !trigger) { - ret = -ENOMEM; - goto out; - } - - if (wl->conf.scan.split_scan_timeout) - scan_options |= WL1271_SCAN_OPT_SPLIT_SCAN; - - if (passive) - scan_options |= WL1271_SCAN_OPT_PASSIVE; - - cmd->params.role_id = wlvif->role_id; - - if (WARN_ON(cmd->params.role_id == WL12XX_INVALID_ROLE_ID)) { - ret = -EINVAL; - goto out; - } - - cmd->params.scan_options = cpu_to_le16(scan_options); - - cmd->params.n_ch = wl1271_get_scan_channels(wl, wl->scan.req, - cmd->channels, - band, passive); - if (cmd->params.n_ch == 0) { - ret = WL1271_NOTHING_TO_SCAN; - goto out; - } - - cmd->params.tx_rate = cpu_to_le32(basic_rate); - cmd->params.n_probe_reqs = wl->conf.scan.num_probe_reqs; - cmd->params.tid_trigger = CONF_TX_AC_ANY_TID; - cmd->params.scan_tag = WL1271_SCAN_DEFAULT_TAG; - - if (band == IEEE80211_BAND_2GHZ) - cmd->params.band = WL1271_SCAN_BAND_2_4_GHZ; - else - cmd->params.band = WL1271_SCAN_BAND_5_GHZ; - - if (wl->scan.ssid_len && wl->scan.ssid) { - cmd->params.ssid_len = wl->scan.ssid_len; - memcpy(cmd->params.ssid, wl->scan.ssid, wl->scan.ssid_len); - } - - memcpy(cmd->addr, vif->addr, ETH_ALEN); - - ret = wl12xx_cmd_build_probe_req(wl, wlvif, - cmd->params.role_id, band, - wl->scan.ssid, wl->scan.ssid_len, - wl->scan.req->ie, - wl->scan.req->ie_len, false); - if (ret < 0) { - wl1271_error("PROBE request template failed"); - goto out; - } - - trigger->timeout = cpu_to_le32(wl->conf.scan.split_scan_timeout); - ret = wl1271_cmd_send(wl, CMD_TRIGGER_SCAN_TO, trigger, - sizeof(*trigger), 0); - if (ret < 0) { - wl1271_error("trigger scan to failed for hw scan"); - goto out; - } - - wl1271_dump(DEBUG_SCAN, "SCAN: ", cmd, sizeof(*cmd)); - - ret = wl1271_cmd_send(wl, CMD_SCAN, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("SCAN failed"); - goto out; - } - -out: - kfree(cmd); - kfree(trigger); - return ret; -} - -int wl12xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct wl1271_cmd_header *cmd = NULL; - int ret = 0; - - if (WARN_ON(wl->scan.state == WL1271_SCAN_STATE_IDLE)) - return -EINVAL; - - wl1271_debug(DEBUG_CMD, "cmd scan stop"); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - ret = wl1271_cmd_send(wl, CMD_STOP_SCAN, cmd, - sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("cmd stop_scan failed"); - goto out; - } -out: - kfree(cmd); - return ret; -} - -void wl1271_scan_stm(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int ret = 0; - enum ieee80211_band band; - u32 rate, mask; - - switch (wl->scan.state) { - case WL1271_SCAN_STATE_IDLE: - break; - - case WL1271_SCAN_STATE_2GHZ_ACTIVE: - band = IEEE80211_BAND_2GHZ; - mask = wlvif->bitrate_masks[band]; - if (wl->scan.req->no_cck) { - mask &= ~CONF_TX_CCK_RATES; - if (!mask) - mask = CONF_TX_RATE_MASK_BASIC_P2P; - } - rate = wl1271_tx_min_rate_get(wl, mask); - ret = wl1271_scan_send(wl, wlvif, band, false, rate); - if (ret == WL1271_NOTHING_TO_SCAN) { - wl->scan.state = WL1271_SCAN_STATE_2GHZ_PASSIVE; - wl1271_scan_stm(wl, wlvif); - } - - break; - - case WL1271_SCAN_STATE_2GHZ_PASSIVE: - band = IEEE80211_BAND_2GHZ; - mask = wlvif->bitrate_masks[band]; - if (wl->scan.req->no_cck) { - mask &= ~CONF_TX_CCK_RATES; - if (!mask) - mask = CONF_TX_RATE_MASK_BASIC_P2P; - } - rate = wl1271_tx_min_rate_get(wl, mask); - ret = wl1271_scan_send(wl, wlvif, band, true, rate); - if (ret == WL1271_NOTHING_TO_SCAN) { - if (wl->enable_11a) - wl->scan.state = WL1271_SCAN_STATE_5GHZ_ACTIVE; - else - wl->scan.state = WL1271_SCAN_STATE_DONE; - wl1271_scan_stm(wl, wlvif); - } - - break; - - case WL1271_SCAN_STATE_5GHZ_ACTIVE: - band = IEEE80211_BAND_5GHZ; - rate = wl1271_tx_min_rate_get(wl, wlvif->bitrate_masks[band]); - ret = wl1271_scan_send(wl, wlvif, band, false, rate); - if (ret == WL1271_NOTHING_TO_SCAN) { - wl->scan.state = WL1271_SCAN_STATE_5GHZ_PASSIVE; - wl1271_scan_stm(wl, wlvif); - } - - break; - - case WL1271_SCAN_STATE_5GHZ_PASSIVE: - band = IEEE80211_BAND_5GHZ; - rate = wl1271_tx_min_rate_get(wl, wlvif->bitrate_masks[band]); - ret = wl1271_scan_send(wl, wlvif, band, true, rate); - if (ret == WL1271_NOTHING_TO_SCAN) { - wl->scan.state = WL1271_SCAN_STATE_DONE; - wl1271_scan_stm(wl, wlvif); - } - - break; - - case WL1271_SCAN_STATE_DONE: - wl->scan.failed = false; - cancel_delayed_work(&wl->scan_complete_work); - ieee80211_queue_delayed_work(wl->hw, &wl->scan_complete_work, - msecs_to_jiffies(0)); - break; - - default: - wl1271_error("invalid scan state"); - break; - } - - if (ret < 0) { - cancel_delayed_work(&wl->scan_complete_work); - ieee80211_queue_delayed_work(wl->hw, &wl->scan_complete_work, - msecs_to_jiffies(0)); - } -} - -static void wl12xx_adjust_channels(struct wl1271_cmd_sched_scan_config *cmd, - struct wlcore_scan_channels *cmd_channels) -{ - memcpy(cmd->passive, cmd_channels->passive, sizeof(cmd->passive)); - memcpy(cmd->active, cmd_channels->active, sizeof(cmd->active)); - cmd->dfs = cmd_channels->dfs; - cmd->n_pactive_ch = cmd_channels->passive_active; - - memcpy(cmd->channels_2, cmd_channels->channels_2, - sizeof(cmd->channels_2)); - memcpy(cmd->channels_5, cmd_channels->channels_5, - sizeof(cmd->channels_5)); - /* channels_4 are not supported, so no need to copy them */ -} - -int wl1271_scan_sched_scan_config(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct cfg80211_sched_scan_request *req, - struct ieee80211_sched_scan_ies *ies) -{ - struct wl1271_cmd_sched_scan_config *cfg = NULL; - struct wlcore_scan_channels *cfg_channels = NULL; - struct conf_sched_scan_settings *c = &wl->conf.sched_scan; - int i, ret; - bool force_passive = !req->n_ssids; - - wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config"); - - cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); - if (!cfg) - return -ENOMEM; - - cfg->role_id = wlvif->role_id; - cfg->rssi_threshold = c->rssi_threshold; - cfg->snr_threshold = c->snr_threshold; - cfg->n_probe_reqs = c->num_probe_reqs; - /* cycles set to 0 it means infinite (until manually stopped) */ - cfg->cycles = 0; - /* report APs when at least 1 is found */ - cfg->report_after = 1; - /* don't stop scanning automatically when something is found */ - cfg->terminate = 0; - cfg->tag = WL1271_SCAN_DEFAULT_TAG; - /* don't filter on BSS type */ - cfg->bss_type = SCAN_BSS_TYPE_ANY; - /* currently NL80211 supports only a single interval */ - for (i = 0; i < SCAN_MAX_CYCLE_INTERVALS; i++) - cfg->intervals[i] = cpu_to_le32(req->interval); - - cfg->ssid_len = 0; - ret = wlcore_scan_sched_scan_ssid_list(wl, wlvif, req); - if (ret < 0) - goto out; - - cfg->filter_type = ret; - - wl1271_debug(DEBUG_SCAN, "filter_type = %d", cfg->filter_type); - - cfg_channels = kzalloc(sizeof(*cfg_channels), GFP_KERNEL); - if (!cfg_channels) { - ret = -ENOMEM; - goto out; - } - - if (!wlcore_set_scan_chan_params(wl, cfg_channels, req->channels, - req->n_channels, req->n_ssids, - SCAN_TYPE_PERIODIC)) { - wl1271_error("scan channel list is empty"); - ret = -EINVAL; - goto out; - } - wl12xx_adjust_channels(cfg, cfg_channels); - - if (!force_passive && cfg->active[0]) { - u8 band = IEEE80211_BAND_2GHZ; - ret = wl12xx_cmd_build_probe_req(wl, wlvif, - wlvif->role_id, band, - req->ssids[0].ssid, - req->ssids[0].ssid_len, - ies->ie[band], - ies->len[band], true); - if (ret < 0) { - wl1271_error("2.4GHz PROBE request template failed"); - goto out; - } - } - - if (!force_passive && cfg->active[1]) { - u8 band = IEEE80211_BAND_5GHZ; - ret = wl12xx_cmd_build_probe_req(wl, wlvif, - wlvif->role_id, band, - req->ssids[0].ssid, - req->ssids[0].ssid_len, - ies->ie[band], - ies->len[band], true); - if (ret < 0) { - wl1271_error("5GHz PROBE request template failed"); - goto out; - } - } - - wl1271_dump(DEBUG_SCAN, "SCAN_CFG: ", cfg, sizeof(*cfg)); - - ret = wl1271_cmd_send(wl, CMD_CONNECTION_SCAN_CFG, cfg, - sizeof(*cfg), 0); - if (ret < 0) { - wl1271_error("SCAN configuration failed"); - goto out; - } -out: - kfree(cfg_channels); - kfree(cfg); - return ret; -} - -int wl1271_scan_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct wl1271_cmd_sched_scan_start *start; - int ret = 0; - - wl1271_debug(DEBUG_CMD, "cmd periodic scan start"); - - if (wlvif->bss_type != BSS_TYPE_STA_BSS) - return -EOPNOTSUPP; - - if ((wl->quirks & WLCORE_QUIRK_NO_SCHED_SCAN_WHILE_CONN) && - test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags)) - return -EBUSY; - - start = kzalloc(sizeof(*start), GFP_KERNEL); - if (!start) - return -ENOMEM; - - start->role_id = wlvif->role_id; - start->tag = WL1271_SCAN_DEFAULT_TAG; - - ret = wl1271_cmd_send(wl, CMD_START_PERIODIC_SCAN, start, - sizeof(*start), 0); - if (ret < 0) { - wl1271_error("failed to send scan start command"); - goto out_free; - } - -out_free: - kfree(start); - return ret; -} - -int wl12xx_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct cfg80211_sched_scan_request *req, - struct ieee80211_sched_scan_ies *ies) -{ - int ret; - - ret = wl1271_scan_sched_scan_config(wl, wlvif, req, ies); - if (ret < 0) - return ret; - - return wl1271_scan_sched_scan_start(wl, wlvif); -} - -void wl12xx_scan_sched_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct wl1271_cmd_sched_scan_stop *stop; - int ret = 0; - - wl1271_debug(DEBUG_CMD, "cmd periodic scan stop"); - - /* FIXME: what to do if alloc'ing to stop fails? */ - stop = kzalloc(sizeof(*stop), GFP_KERNEL); - if (!stop) { - wl1271_error("failed to alloc memory to send sched scan stop"); - return; - } - - stop->role_id = wlvif->role_id; - stop->tag = WL1271_SCAN_DEFAULT_TAG; - - ret = wl1271_cmd_send(wl, CMD_STOP_PERIODIC_SCAN, stop, - sizeof(*stop), 0); - if (ret < 0) { - wl1271_error("failed to send sched scan stop command"); - goto out_free; - } - -out_free: - kfree(stop); -} - -int wl12xx_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct cfg80211_scan_request *req) -{ - wl1271_scan_stm(wl, wlvif); - return 0; -} - -void wl12xx_scan_completed(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - wl1271_scan_stm(wl, wlvif); -} diff --git a/drivers/net/wireless/ti/wl12xx/scan.h b/drivers/net/wireless/ti/wl12xx/scan.h deleted file mode 100644 index 264af7ac2785..000000000000 --- a/drivers/net/wireless/ti/wl12xx/scan.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2012 Texas Instruments. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL12XX_SCAN_H__ -#define __WL12XX_SCAN_H__ - -#include "../wlcore/wlcore.h" -#include "../wlcore/cmd.h" -#include "../wlcore/scan.h" - -#define WL12XX_MAX_CHANNELS_5GHZ 23 - -struct basic_scan_params { - /* Scan option flags (WL1271_SCAN_OPT_*) */ - __le16 scan_options; - u8 role_id; - /* Number of scan channels in the list (maximum 30) */ - u8 n_ch; - /* This field indicates the number of probe requests to send - per channel for an active scan */ - u8 n_probe_reqs; - u8 tid_trigger; - u8 ssid_len; - u8 use_ssid_list; - - /* Rate bit field for sending the probes */ - __le32 tx_rate; - - u8 ssid[IEEE80211_MAX_SSID_LEN]; - /* Band to scan */ - u8 band; - - u8 scan_tag; - u8 padding2[2]; -} __packed; - -struct basic_scan_channel_params { - /* Duration in TU to wait for frames on a channel for active scan */ - __le32 min_duration; - __le32 max_duration; - __le32 bssid_lsb; - __le16 bssid_msb; - u8 early_termination; - u8 tx_power_att; - u8 channel; - /* FW internal use only! */ - u8 dfs_candidate; - u8 activity_detected; - u8 pad; -} __packed; - -struct wl1271_cmd_scan { - struct wl1271_cmd_header header; - - struct basic_scan_params params; - struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS]; - - /* src mac address */ - u8 addr[ETH_ALEN]; - u8 padding[2]; -} __packed; - -struct wl1271_cmd_sched_scan_config { - struct wl1271_cmd_header header; - - __le32 intervals[SCAN_MAX_CYCLE_INTERVALS]; - - s8 rssi_threshold; /* for filtering (in dBm) */ - s8 snr_threshold; /* for filtering (in dB) */ - - u8 cycles; /* maximum number of scan cycles */ - u8 report_after; /* report when this number of results are received */ - u8 terminate; /* stop scanning after reporting */ - - u8 tag; - u8 bss_type; /* for filtering */ - u8 filter_type; - - u8 ssid_len; /* For SCAN_SSID_FILTER_SPECIFIC */ - u8 ssid[IEEE80211_MAX_SSID_LEN]; - - u8 n_probe_reqs; /* Number of probes requests per channel */ - - u8 passive[SCAN_MAX_BANDS]; - u8 active[SCAN_MAX_BANDS]; - - u8 dfs; - - u8 n_pactive_ch; /* number of pactive (passive until fw detects energy) - channels in BG band */ - u8 role_id; - u8 padding[1]; - struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ]; - struct conn_scan_ch_params channels_5[WL12XX_MAX_CHANNELS_5GHZ]; - struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ]; -} __packed; - -struct wl1271_cmd_sched_scan_start { - struct wl1271_cmd_header header; - - u8 tag; - u8 role_id; - u8 padding[2]; -} __packed; - -struct wl1271_cmd_sched_scan_stop { - struct wl1271_cmd_header header; - - u8 tag; - u8 role_id; - u8 padding[2]; -} __packed; - -int wl12xx_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct cfg80211_scan_request *req); -int wl12xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif); -void wl12xx_scan_completed(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl12xx_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct cfg80211_sched_scan_request *req, - struct ieee80211_sched_scan_ies *ies); -void wl12xx_scan_sched_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif); -#endif diff --git a/drivers/net/wireless/ti/wl12xx/wl12xx.h b/drivers/net/wireless/ti/wl12xx/wl12xx.h deleted file mode 100644 index 9e5484a73667..000000000000 --- a/drivers/net/wireless/ti/wl12xx/wl12xx.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2011 Texas Instruments Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL12XX_PRIV_H__ -#define __WL12XX_PRIV_H__ - -#include "conf.h" - -/* WiLink 6/7 chip IDs */ -#define CHIP_ID_127X_PG10 (0x04030101) -#define CHIP_ID_127X_PG20 (0x04030111) -#define CHIP_ID_128X_PG10 (0x05030101) -#define CHIP_ID_128X_PG20 (0x05030111) - -/* FW chip version for wl127x */ -#define WL127X_CHIP_VER 6 -/* minimum single-role FW version for wl127x */ -#define WL127X_IFTYPE_SR_VER 3 -#define WL127X_MAJOR_SR_VER 10 -#define WL127X_SUBTYPE_SR_VER WLCORE_FW_VER_IGNORE -#define WL127X_MINOR_SR_VER 133 -/* minimum multi-role FW version for wl127x */ -#define WL127X_IFTYPE_MR_VER 5 -#define WL127X_MAJOR_MR_VER 7 -#define WL127X_SUBTYPE_MR_VER WLCORE_FW_VER_IGNORE -#define WL127X_MINOR_MR_VER 42 - -/* FW chip version for wl128x */ -#define WL128X_CHIP_VER 7 -/* minimum single-role FW version for wl128x */ -#define WL128X_IFTYPE_SR_VER 3 -#define WL128X_MAJOR_SR_VER 10 -#define WL128X_SUBTYPE_SR_VER WLCORE_FW_VER_IGNORE -#define WL128X_MINOR_SR_VER 133 -/* minimum multi-role FW version for wl128x */ -#define WL128X_IFTYPE_MR_VER 5 -#define WL128X_MAJOR_MR_VER 7 -#define WL128X_SUBTYPE_MR_VER WLCORE_FW_VER_IGNORE -#define WL128X_MINOR_MR_VER 42 - -#define WL12XX_AGGR_BUFFER_SIZE (4 * PAGE_SIZE) - -#define WL12XX_NUM_TX_DESCRIPTORS 16 -#define WL12XX_NUM_RX_DESCRIPTORS 8 - -#define WL12XX_NUM_MAC_ADDRESSES 2 - -#define WL12XX_RX_BA_MAX_SESSIONS 3 - -struct wl127x_rx_mem_pool_addr { - u32 addr; - u32 addr_extra; -}; - -struct wl12xx_priv { - struct wl12xx_priv_conf conf; - - int ref_clock; - int tcxo_clock; - - struct wl127x_rx_mem_pool_addr *rx_mem_addr; -}; - -#endif /* __WL12XX_PRIV_H__ */ diff --git a/drivers/net/wireless/ti/wl18xx/Kconfig b/drivers/net/wireless/ti/wl18xx/Kconfig deleted file mode 100644 index 1cfdb2548821..000000000000 --- a/drivers/net/wireless/ti/wl18xx/Kconfig +++ /dev/null @@ -1,7 +0,0 @@ -config WL18XX - tristate "TI wl18xx support" - depends on MAC80211 - select WLCORE - ---help--- - This module adds support for wireless adapters based on TI - WiLink 8 chipsets. diff --git a/drivers/net/wireless/ti/wl18xx/Makefile b/drivers/net/wireless/ti/wl18xx/Makefile deleted file mode 100644 index ae2b81735785..000000000000 --- a/drivers/net/wireless/ti/wl18xx/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -wl18xx-objs = main.o acx.o tx.o io.o debugfs.o scan.o cmd.o event.o - -obj-$(CONFIG_WL18XX) += wl18xx.o diff --git a/drivers/net/wireless/ti/wl18xx/acx.c b/drivers/net/wireless/ti/wl18xx/acx.c deleted file mode 100644 index a169bb5a5dbf..000000000000 --- a/drivers/net/wireless/ti/wl18xx/acx.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2011 Texas Instruments Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "../wlcore/cmd.h" -#include "../wlcore/debug.h" -#include "../wlcore/acx.h" - -#include "acx.h" - -int wl18xx_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap, - u32 sdio_blk_size, u32 extra_mem_blks, - u32 len_field_size) -{ - struct wl18xx_acx_host_config_bitmap *bitmap_conf; - int ret; - - wl1271_debug(DEBUG_ACX, "acx cfg bitmap %d blk %d spare %d field %d", - host_cfg_bitmap, sdio_blk_size, extra_mem_blks, - len_field_size); - - bitmap_conf = kzalloc(sizeof(*bitmap_conf), GFP_KERNEL); - if (!bitmap_conf) { - ret = -ENOMEM; - goto out; - } - - bitmap_conf->host_cfg_bitmap = cpu_to_le32(host_cfg_bitmap); - bitmap_conf->host_sdio_block_size = cpu_to_le32(sdio_blk_size); - bitmap_conf->extra_mem_blocks = cpu_to_le32(extra_mem_blks); - bitmap_conf->length_field_size = cpu_to_le32(len_field_size); - - ret = wl1271_cmd_configure(wl, ACX_HOST_IF_CFG_BITMAP, - bitmap_conf, sizeof(*bitmap_conf)); - if (ret < 0) { - wl1271_warning("wl1271 bitmap config opt failed: %d", ret); - goto out; - } - -out: - kfree(bitmap_conf); - - return ret; -} - -int wl18xx_acx_set_checksum_state(struct wl1271 *wl) -{ - struct wl18xx_acx_checksum_state *acx; - int ret; - - wl1271_debug(DEBUG_ACX, "acx checksum state"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->checksum_state = CHECKSUM_OFFLOAD_ENABLED; - - ret = wl1271_cmd_configure(wl, ACX_CSUM_CONFIG, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("failed to set Tx checksum state: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl18xx_acx_clear_statistics(struct wl1271 *wl) -{ - struct wl18xx_acx_clear_statistics *acx; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx clear statistics"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - ret = wl1271_cmd_configure(wl, ACX_CLEAR_STATISTICS, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("failed to clear firmware statistics: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl18xx_acx_peer_ht_operation_mode(struct wl1271 *wl, u8 hlid, bool wide) -{ - struct wlcore_peer_ht_operation_mode *acx; - int ret; - - wl1271_debug(DEBUG_ACX, "acx peer ht operation mode hlid %d bw %d", - hlid, wide); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->hlid = hlid; - acx->bandwidth = wide ? WLCORE_BANDWIDTH_40MHZ : WLCORE_BANDWIDTH_20MHZ; - - ret = wl1271_cmd_configure(wl, ACX_PEER_HT_OPERATION_MODE_CFG, acx, - sizeof(*acx)); - - if (ret < 0) { - wl1271_warning("acx peer ht operation mode failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; - -} - -/* - * this command is basically the same as wl1271_acx_ht_capabilities, - * with the addition of supported rates. they should be unified in - * the next fw api change - */ -int wl18xx_acx_set_peer_cap(struct wl1271 *wl, - struct ieee80211_sta_ht_cap *ht_cap, - bool allow_ht_operation, - u32 rate_set, u8 hlid) -{ - struct wlcore_acx_peer_cap *acx; - int ret = 0; - u32 ht_capabilites = 0; - - wl1271_debug(DEBUG_ACX, - "acx set cap ht_supp: %d ht_cap: %d rates: 0x%x", - ht_cap->ht_supported, ht_cap->cap, rate_set); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - if (allow_ht_operation && ht_cap->ht_supported) { - /* no need to translate capabilities - use the spec values */ - ht_capabilites = ht_cap->cap; - - /* - * this bit is not employed by the spec but only by FW to - * indicate peer HT support - */ - ht_capabilites |= WL12XX_HT_CAP_HT_OPERATION; - - /* get data from A-MPDU parameters field */ - acx->ampdu_max_length = ht_cap->ampdu_factor; - acx->ampdu_min_spacing = ht_cap->ampdu_density; - } - - acx->hlid = hlid; - acx->ht_capabilites = cpu_to_le32(ht_capabilites); - acx->supported_rates = cpu_to_le32(rate_set); - - ret = wl1271_cmd_configure(wl, ACX_PEER_CAP, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx ht capabilities setting failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} diff --git a/drivers/net/wireless/ti/wl18xx/acx.h b/drivers/net/wireless/ti/wl18xx/acx.h deleted file mode 100644 index 0e636def1217..000000000000 --- a/drivers/net/wireless/ti/wl18xx/acx.h +++ /dev/null @@ -1,340 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2011 Texas Instruments. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL18XX_ACX_H__ -#define __WL18XX_ACX_H__ - -#include "../wlcore/wlcore.h" -#include "../wlcore/acx.h" - -enum { - ACX_NS_IPV6_FILTER = 0x0050, - ACX_PEER_HT_OPERATION_MODE_CFG = 0x0051, - ACX_CSUM_CONFIG = 0x0052, - ACX_SIM_CONFIG = 0x0053, - ACX_CLEAR_STATISTICS = 0x0054, - ACX_AUTO_RX_STREAMING = 0x0055, - ACX_PEER_CAP = 0x0056 -}; - -/* numbers of bits the length field takes (add 1 for the actual number) */ -#define WL18XX_HOST_IF_LEN_SIZE_FIELD 15 - -#define WL18XX_ACX_EVENTS_VECTOR (WL1271_ACX_INTR_WATCHDOG | \ - WL1271_ACX_INTR_INIT_COMPLETE | \ - WL1271_ACX_INTR_EVENT_A | \ - WL1271_ACX_INTR_EVENT_B | \ - WL1271_ACX_INTR_CMD_COMPLETE | \ - WL1271_ACX_INTR_HW_AVAILABLE | \ - WL1271_ACX_INTR_DATA | \ - WL1271_ACX_SW_INTR_WATCHDOG) - -#define WL18XX_INTR_MASK (WL1271_ACX_INTR_WATCHDOG | \ - WL1271_ACX_INTR_EVENT_A | \ - WL1271_ACX_INTR_EVENT_B | \ - WL1271_ACX_INTR_HW_AVAILABLE | \ - WL1271_ACX_INTR_DATA | \ - WL1271_ACX_SW_INTR_WATCHDOG) - -struct wl18xx_acx_host_config_bitmap { - struct acx_header header; - - __le32 host_cfg_bitmap; - - __le32 host_sdio_block_size; - - /* extra mem blocks per frame in TX. */ - __le32 extra_mem_blocks; - - /* - * number of bits of the length field in the first TX word - * (up to 15 - for using the entire 16 bits). - */ - __le32 length_field_size; - -} __packed; - -enum { - CHECKSUM_OFFLOAD_DISABLED = 0, - CHECKSUM_OFFLOAD_ENABLED = 1, - CHECKSUM_OFFLOAD_FAKE_RX = 2, - CHECKSUM_OFFLOAD_INVALID = 0xFF -}; - -struct wl18xx_acx_checksum_state { - struct acx_header header; - - /* enum acx_checksum_state */ - u8 checksum_state; - u8 pad[3]; -} __packed; - - -struct wl18xx_acx_error_stats { - u32 error_frame; - u32 error_null_Frame_tx_start; - u32 error_numll_frame_cts_start; - u32 error_bar_retry; - u32 error_frame_cts_nul_flid; -} __packed; - -struct wl18xx_acx_debug_stats { - u32 debug1; - u32 debug2; - u32 debug3; - u32 debug4; - u32 debug5; - u32 debug6; -} __packed; - -struct wl18xx_acx_ring_stats { - u32 prepared_descs; - u32 tx_cmplt; -} __packed; - -struct wl18xx_acx_tx_stats { - u32 tx_prepared_descs; - u32 tx_cmplt; - u32 tx_template_prepared; - u32 tx_data_prepared; - u32 tx_template_programmed; - u32 tx_data_programmed; - u32 tx_burst_programmed; - u32 tx_starts; - u32 tx_imm_resp; - u32 tx_start_templates; - u32 tx_start_int_templates; - u32 tx_start_fw_gen; - u32 tx_start_data; - u32 tx_start_null_frame; - u32 tx_exch; - u32 tx_retry_template; - u32 tx_retry_data; - u32 tx_exch_pending; - u32 tx_exch_expiry; - u32 tx_done_template; - u32 tx_done_data; - u32 tx_done_int_template; - u32 tx_frame_checksum; - u32 tx_checksum_result; - u32 frag_called; - u32 frag_mpdu_alloc_failed; - u32 frag_init_called; - u32 frag_in_process_called; - u32 frag_tkip_called; - u32 frag_key_not_found; - u32 frag_need_fragmentation; - u32 frag_bad_mblk_num; - u32 frag_failed; - u32 frag_cache_hit; - u32 frag_cache_miss; -} __packed; - -struct wl18xx_acx_rx_stats { - u32 rx_beacon_early_term; - u32 rx_out_of_mpdu_nodes; - u32 rx_hdr_overflow; - u32 rx_dropped_frame; - u32 rx_done_stage; - u32 rx_done; - u32 rx_defrag; - u32 rx_defrag_end; - u32 rx_cmplt; - u32 rx_pre_complt; - u32 rx_cmplt_task; - u32 rx_phy_hdr; - u32 rx_timeout; - u32 rx_timeout_wa; - u32 rx_wa_density_dropped_frame; - u32 rx_wa_ba_not_expected; - u32 rx_frame_checksum; - u32 rx_checksum_result; - u32 defrag_called; - u32 defrag_init_called; - u32 defrag_in_process_called; - u32 defrag_tkip_called; - u32 defrag_need_defrag; - u32 defrag_decrypt_failed; - u32 decrypt_key_not_found; - u32 defrag_need_decrypt; - u32 rx_tkip_replays; -} __packed; - -struct wl18xx_acx_isr_stats { - u32 irqs; -} __packed; - -#define PWR_STAT_MAX_CONT_MISSED_BCNS_SPREAD 10 - -struct wl18xx_acx_pwr_stats { - u32 missing_bcns_cnt; - u32 rcvd_bcns_cnt; - u32 connection_out_of_sync; - u32 cont_miss_bcns_spread[PWR_STAT_MAX_CONT_MISSED_BCNS_SPREAD]; - u32 rcvd_awake_bcns_cnt; -} __packed; - -struct wl18xx_acx_event_stats { - u32 calibration; - u32 rx_mismatch; - u32 rx_mem_empty; -} __packed; - -struct wl18xx_acx_ps_poll_stats { - u32 ps_poll_timeouts; - u32 upsd_timeouts; - u32 upsd_max_ap_turn; - u32 ps_poll_max_ap_turn; - u32 ps_poll_utilization; - u32 upsd_utilization; -} __packed; - -struct wl18xx_acx_rx_filter_stats { - u32 beacon_filter; - u32 arp_filter; - u32 mc_filter; - u32 dup_filter; - u32 data_filter; - u32 ibss_filter; - u32 protection_filter; - u32 accum_arp_pend_requests; - u32 max_arp_queue_dep; -} __packed; - -struct wl18xx_acx_rx_rate_stats { - u32 rx_frames_per_rates[50]; -} __packed; - -#define AGGR_STATS_TX_AGG 16 -#define AGGR_STATS_TX_RATE 16 -#define AGGR_STATS_RX_SIZE_LEN 16 - -struct wl18xx_acx_aggr_stats { - u32 tx_agg_vs_rate[AGGR_STATS_TX_AGG * AGGR_STATS_TX_RATE]; - u32 rx_size[AGGR_STATS_RX_SIZE_LEN]; -} __packed; - -#define PIPE_STATS_HW_FIFO 11 - -struct wl18xx_acx_pipeline_stats { - u32 hs_tx_stat_fifo_int; - u32 hs_rx_stat_fifo_int; - u32 tcp_tx_stat_fifo_int; - u32 tcp_rx_stat_fifo_int; - u32 enc_tx_stat_fifo_int; - u32 enc_rx_stat_fifo_int; - u32 rx_complete_stat_fifo_int; - u32 pre_proc_swi; - u32 post_proc_swi; - u32 sec_frag_swi; - u32 pre_to_defrag_swi; - u32 defrag_to_csum_swi; - u32 csum_to_rx_xfer_swi; - u32 dec_packet_in; - u32 dec_packet_in_fifo_full; - u32 dec_packet_out; - u32 cs_rx_packet_in; - u32 cs_rx_packet_out; - u16 pipeline_fifo_full[PIPE_STATS_HW_FIFO]; -} __packed; - -struct wl18xx_acx_mem_stats { - u32 rx_free_mem_blks; - u32 tx_free_mem_blks; - u32 fwlog_free_mem_blks; - u32 fw_gen_free_mem_blks; -} __packed; - -struct wl18xx_acx_statistics { - struct acx_header header; - - struct wl18xx_acx_error_stats error; - struct wl18xx_acx_debug_stats debug; - struct wl18xx_acx_tx_stats tx; - struct wl18xx_acx_rx_stats rx; - struct wl18xx_acx_isr_stats isr; - struct wl18xx_acx_pwr_stats pwr; - struct wl18xx_acx_ps_poll_stats ps_poll; - struct wl18xx_acx_rx_filter_stats rx_filter; - struct wl18xx_acx_rx_rate_stats rx_rate; - struct wl18xx_acx_aggr_stats aggr_size; - struct wl18xx_acx_pipeline_stats pipeline; - struct wl18xx_acx_mem_stats mem; -} __packed; - -struct wl18xx_acx_clear_statistics { - struct acx_header header; -}; - -enum wlcore_bandwidth { - WLCORE_BANDWIDTH_20MHZ, - WLCORE_BANDWIDTH_40MHZ, -}; - -struct wlcore_peer_ht_operation_mode { - struct acx_header header; - - u8 hlid; - u8 bandwidth; /* enum wlcore_bandwidth */ - u8 padding[2]; -}; - -/* - * ACX_PEER_CAP - * this struct is very similar to wl1271_acx_ht_capabilities, with the - * addition of supported rates - */ -struct wlcore_acx_peer_cap { - struct acx_header header; - - /* bitmask of capability bits supported by the peer */ - __le32 ht_capabilites; - - /* rates supported by the remote peer */ - __le32 supported_rates; - - /* Indicates to which link these capabilities apply. */ - u8 hlid; - - /* - * This the maximum A-MPDU length supported by the AP. The FW may not - * exceed this length when sending A-MPDUs - */ - u8 ampdu_max_length; - - /* This is the minimal spacing required when sending A-MPDUs to the AP*/ - u8 ampdu_min_spacing; - - u8 padding; -} __packed; - -int wl18xx_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap, - u32 sdio_blk_size, u32 extra_mem_blks, - u32 len_field_size); -int wl18xx_acx_set_checksum_state(struct wl1271 *wl); -int wl18xx_acx_clear_statistics(struct wl1271 *wl); -int wl18xx_acx_peer_ht_operation_mode(struct wl1271 *wl, u8 hlid, bool wide); -int wl18xx_acx_set_peer_cap(struct wl1271 *wl, - struct ieee80211_sta_ht_cap *ht_cap, - bool allow_ht_operation, - u32 rate_set, u8 hlid); - -#endif /* __WL18XX_ACX_H__ */ diff --git a/drivers/net/wireless/ti/wl18xx/cmd.c b/drivers/net/wireless/ti/wl18xx/cmd.c deleted file mode 100644 index 7649c75cd68d..000000000000 --- a/drivers/net/wireless/ti/wl18xx/cmd.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2011 Texas Instruments Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "../wlcore/cmd.h" -#include "../wlcore/debug.h" -#include "../wlcore/hw_ops.h" - -#include "cmd.h" - -int wl18xx_cmd_channel_switch(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct ieee80211_channel_switch *ch_switch) -{ - struct wl18xx_cmd_channel_switch *cmd; - u32 supported_rates; - int ret; - - wl1271_debug(DEBUG_ACX, "cmd channel switch"); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->role_id = wlvif->role_id; - cmd->channel = ch_switch->chandef.chan->hw_value; - cmd->switch_time = ch_switch->count; - cmd->stop_tx = ch_switch->block_tx; - - switch (ch_switch->chandef.chan->band) { - case IEEE80211_BAND_2GHZ: - cmd->band = WLCORE_BAND_2_4GHZ; - break; - case IEEE80211_BAND_5GHZ: - cmd->band = WLCORE_BAND_5GHZ; - break; - default: - wl1271_error("invalid channel switch band: %d", - ch_switch->chandef.chan->band); - ret = -EINVAL; - goto out_free; - } - - supported_rates = CONF_TX_ENABLED_RATES | CONF_TX_MCS_RATES | - wlcore_hw_sta_get_ap_rate_mask(wl, wlvif); - if (wlvif->p2p) - supported_rates &= ~CONF_TX_CCK_RATES; - cmd->local_supported_rates = cpu_to_le32(supported_rates); - cmd->channel_type = wlvif->channel_type; - - ret = wl1271_cmd_send(wl, CMD_CHANNEL_SWITCH, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to send channel switch command"); - goto out_free; - } - -out_free: - kfree(cmd); -out: - return ret; -} diff --git a/drivers/net/wireless/ti/wl18xx/cmd.h b/drivers/net/wireless/ti/wl18xx/cmd.h deleted file mode 100644 index 6687d10899ac..000000000000 --- a/drivers/net/wireless/ti/wl18xx/cmd.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2011 Texas Instruments. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL18XX_CMD_H__ -#define __WL18XX_CMD_H__ - -#include "../wlcore/wlcore.h" -#include "../wlcore/acx.h" - -struct wl18xx_cmd_channel_switch { - struct wl1271_cmd_header header; - - u8 role_id; - - /* The new serving channel */ - u8 channel; - /* Relative time of the serving channel switch in TBTT units */ - u8 switch_time; - /* Stop the role TX, should expect it after radar detection */ - u8 stop_tx; - - __le32 local_supported_rates; - - u8 channel_type; - u8 band; - - u8 padding[2]; -} __packed; - -int wl18xx_cmd_channel_switch(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct ieee80211_channel_switch *ch_switch); - -#endif diff --git a/drivers/net/wireless/ti/wl18xx/conf.h b/drivers/net/wireless/ti/wl18xx/conf.h deleted file mode 100644 index e34302e3b51d..000000000000 --- a/drivers/net/wireless/ti/wl18xx/conf.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2011 Texas Instruments Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL18XX_CONF_H__ -#define __WL18XX_CONF_H__ - -#define WL18XX_CONF_MAGIC 0x10e100ca -#define WL18XX_CONF_VERSION (WLCORE_CONF_VERSION | 0x0006) -#define WL18XX_CONF_MASK 0x0000ffff -#define WL18XX_CONF_SIZE (WLCORE_CONF_SIZE + \ - sizeof(struct wl18xx_priv_conf)) - -#define NUM_OF_CHANNELS_11_ABG 150 -#define NUM_OF_CHANNELS_11_P 7 -#define SRF_TABLE_LEN 16 -#define PIN_MUXING_SIZE 2 -#define WL18XX_TRACE_LOSS_GAPS_TX 10 -#define WL18XX_TRACE_LOSS_GAPS_RX 18 - -struct wl18xx_mac_and_phy_params { - u8 phy_standalone; - u8 spare0; - u8 enable_clpc; - u8 enable_tx_low_pwr_on_siso_rdl; - u8 auto_detect; - u8 dedicated_fem; - - u8 low_band_component; - - /* Bit 0: One Hot, Bit 1: Control Enable, Bit 2: 1.8V, Bit 3: 3V */ - u8 low_band_component_type; - - u8 high_band_component; - - /* Bit 0: One Hot, Bit 1: Control Enable, Bit 2: 1.8V, Bit 3: 3V */ - u8 high_band_component_type; - u8 number_of_assembled_ant2_4; - u8 number_of_assembled_ant5; - u8 pin_muxing_platform_options[PIN_MUXING_SIZE]; - u8 external_pa_dc2dc; - u8 tcxo_ldo_voltage; - u8 xtal_itrim_val; - u8 srf_state; - u8 srf1[SRF_TABLE_LEN]; - u8 srf2[SRF_TABLE_LEN]; - u8 srf3[SRF_TABLE_LEN]; - u8 io_configuration; - u8 sdio_configuration; - u8 settings; - u8 rx_profile; - u8 per_chan_pwr_limit_arr_11abg[NUM_OF_CHANNELS_11_ABG]; - u8 pwr_limit_reference_11_abg; - u8 per_chan_pwr_limit_arr_11p[NUM_OF_CHANNELS_11_P]; - u8 pwr_limit_reference_11p; - u8 spare1; - u8 per_chan_bo_mode_11_abg[13]; - u8 per_chan_bo_mode_11_p[4]; - u8 primary_clock_setting_time; - u8 clock_valid_on_wake_up; - u8 secondary_clock_setting_time; - u8 board_type; - /* enable point saturation */ - u8 psat; - /* low/medium/high Tx power in dBm for STA-HP BG */ - s8 low_power_val; - s8 med_power_val; - s8 high_power_val; - s8 per_sub_band_tx_trace_loss[WL18XX_TRACE_LOSS_GAPS_TX]; - s8 per_sub_band_rx_trace_loss[WL18XX_TRACE_LOSS_GAPS_RX]; - u8 tx_rf_margin; - /* low/medium/high Tx power in dBm for other role */ - s8 low_power_val_2nd; - s8 med_power_val_2nd; - s8 high_power_val_2nd; - - u8 padding[1]; -} __packed; - -enum wl18xx_ht_mode { - /* Default - use MIMO, fallback to SISO20 */ - HT_MODE_DEFAULT = 0, - - /* Wide - use SISO40 */ - HT_MODE_WIDE = 1, - - /* Use SISO20 */ - HT_MODE_SISO20 = 2, -}; - -struct wl18xx_ht_settings { - /* DEFAULT / WIDE / SISO20 */ - u8 mode; -} __packed; - -struct wl18xx_priv_conf { - /* Module params structures */ - struct wl18xx_ht_settings ht; - - /* this structure is copied wholesale to FW */ - struct wl18xx_mac_and_phy_params phy; -} __packed; - -#endif /* __WL18XX_CONF_H__ */ diff --git a/drivers/net/wireless/ti/wl18xx/debugfs.c b/drivers/net/wireless/ti/wl18xx/debugfs.c deleted file mode 100644 index 7f1669cdea09..000000000000 --- a/drivers/net/wireless/ti/wl18xx/debugfs.c +++ /dev/null @@ -1,403 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2009 Nokia Corporation - * Copyright (C) 2011-2012 Texas Instruments - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "../wlcore/debugfs.h" -#include "../wlcore/wlcore.h" - -#include "wl18xx.h" -#include "acx.h" -#include "debugfs.h" - -#define WL18XX_DEBUGFS_FWSTATS_FILE(a, b, c) \ - DEBUGFS_FWSTATS_FILE(a, b, c, wl18xx_acx_statistics) -#define WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(a, b, c) \ - DEBUGFS_FWSTATS_FILE_ARRAY(a, b, c, wl18xx_acx_statistics) - - -WL18XX_DEBUGFS_FWSTATS_FILE(debug, debug1, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(debug, debug2, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(debug, debug3, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(debug, debug4, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(debug, debug5, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(debug, debug6, "%u"); - -WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(error, error_null_Frame_tx_start, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(error, error_numll_frame_cts_start, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(error, error_bar_retry, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame_cts_nul_flid, "%u"); - -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_prepared_descs, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_cmplt, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_template_prepared, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_data_prepared, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_template_programmed, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_data_programmed, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_burst_programmed, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_starts, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_imm_resp, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_templates, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_int_templates, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_fw_gen, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_data, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_null_frame, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_retry_template, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_retry_data, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch_pending, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch_expiry, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_template, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_data, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_int_template, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_frame_checksum, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_checksum_result, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_called, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_mpdu_alloc_failed, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_init_called, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_in_process_called, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_tkip_called, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_key_not_found, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_need_fragmentation, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_bad_mblk_num, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_failed, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_cache_hit, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_cache_miss, "%u"); - -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_beacon_early_term, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_out_of_mpdu_nodes, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_hdr_overflow, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_dropped_frame, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_done, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_defrag, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_defrag_end, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_cmplt, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_pre_complt, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_cmplt_task, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_phy_hdr, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_timeout, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_timeout_wa, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_wa_density_dropped_frame, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_wa_ba_not_expected, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_frame_checksum, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_checksum_result, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_called, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_init_called, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_in_process_called, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_tkip_called, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_need_defrag, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_decrypt_failed, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, decrypt_key_not_found, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_need_decrypt, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_tkip_replays, "%u"); - -WL18XX_DEBUGFS_FWSTATS_FILE(isr, irqs, "%u"); - -WL18XX_DEBUGFS_FWSTATS_FILE(pwr, missing_bcns_cnt, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_bcns_cnt, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pwr, connection_out_of_sync, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(pwr, cont_miss_bcns_spread, - PWR_STAT_MAX_CONT_MISSED_BCNS_SPREAD); -WL18XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_awake_bcns_cnt, "%u"); - - -WL18XX_DEBUGFS_FWSTATS_FILE(ps_poll, ps_poll_timeouts, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(ps_poll, upsd_timeouts, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(ps_poll, upsd_max_ap_turn, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(ps_poll, ps_poll_max_ap_turn, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(ps_poll, ps_poll_utilization, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(ps_poll, upsd_utilization, "%u"); - -WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, beacon_filter, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, arp_filter, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, mc_filter, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, dup_filter, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, data_filter, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, ibss_filter, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, protection_filter, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, accum_arp_pend_requests, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, max_arp_queue_dep, "%u"); - -WL18XX_DEBUGFS_FWSTATS_FILE(rx_rate, rx_frames_per_rates, "%u"); - -WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, tx_agg_vs_rate, - AGGR_STATS_TX_AGG*AGGR_STATS_TX_RATE); -WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, rx_size, - AGGR_STATS_RX_SIZE_LEN); - -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, hs_tx_stat_fifo_int, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, tcp_tx_stat_fifo_int, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, tcp_rx_stat_fifo_int, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, enc_tx_stat_fifo_int, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, enc_rx_stat_fifo_int, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, rx_complete_stat_fifo_int, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, pre_proc_swi, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, post_proc_swi, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, sec_frag_swi, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, pre_to_defrag_swi, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, defrag_to_csum_swi, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, csum_to_rx_xfer_swi, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_in, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_in_fifo_full, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_out, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, cs_rx_packet_in, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, cs_rx_packet_out, "%u"); - -WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(pipeline, pipeline_fifo_full, - PIPE_STATS_HW_FIFO); - -WL18XX_DEBUGFS_FWSTATS_FILE(mem, rx_free_mem_blks, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(mem, tx_free_mem_blks, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(mem, fwlog_free_mem_blks, "%u"); -WL18XX_DEBUGFS_FWSTATS_FILE(mem, fw_gen_free_mem_blks, "%u"); - -static ssize_t conf_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - struct wl18xx_priv *priv = wl->priv; - struct wlcore_conf_header header; - char *buf, *pos; - size_t len; - int ret; - - len = WL18XX_CONF_SIZE; - buf = kmalloc(len, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - header.magic = cpu_to_le32(WL18XX_CONF_MAGIC); - header.version = cpu_to_le32(WL18XX_CONF_VERSION); - header.checksum = 0; - - mutex_lock(&wl->mutex); - - pos = buf; - memcpy(pos, &header, sizeof(header)); - pos += sizeof(header); - memcpy(pos, &wl->conf, sizeof(wl->conf)); - pos += sizeof(wl->conf); - memcpy(pos, &priv->conf, sizeof(priv->conf)); - - mutex_unlock(&wl->mutex); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, len); - - kfree(buf); - return ret; -} - -static const struct file_operations conf_ops = { - .read = conf_read, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t clear_fw_stats_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - int ret; - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - ret = wl18xx_acx_clear_statistics(wl); - if (ret < 0) { - count = ret; - goto out; - } -out: - mutex_unlock(&wl->mutex); - return count; -} - -static const struct file_operations clear_fw_stats_ops = { - .write = clear_fw_stats_write, - .open = simple_open, - .llseek = default_llseek, -}; - -int wl18xx_debugfs_add_files(struct wl1271 *wl, - struct dentry *rootdir) -{ - int ret = 0; - struct dentry *entry, *stats, *moddir; - - moddir = debugfs_create_dir(KBUILD_MODNAME, rootdir); - if (!moddir || IS_ERR(moddir)) { - entry = moddir; - goto err; - } - - stats = debugfs_create_dir("fw_stats", moddir); - if (!stats || IS_ERR(stats)) { - entry = stats; - goto err; - } - - DEBUGFS_ADD(clear_fw_stats, stats); - - DEBUGFS_FWSTATS_ADD(debug, debug1); - DEBUGFS_FWSTATS_ADD(debug, debug2); - DEBUGFS_FWSTATS_ADD(debug, debug3); - DEBUGFS_FWSTATS_ADD(debug, debug4); - DEBUGFS_FWSTATS_ADD(debug, debug5); - DEBUGFS_FWSTATS_ADD(debug, debug6); - - DEBUGFS_FWSTATS_ADD(error, error_frame); - DEBUGFS_FWSTATS_ADD(error, error_null_Frame_tx_start); - DEBUGFS_FWSTATS_ADD(error, error_numll_frame_cts_start); - DEBUGFS_FWSTATS_ADD(error, error_bar_retry); - DEBUGFS_FWSTATS_ADD(error, error_frame_cts_nul_flid); - - DEBUGFS_FWSTATS_ADD(tx, tx_prepared_descs); - DEBUGFS_FWSTATS_ADD(tx, tx_cmplt); - DEBUGFS_FWSTATS_ADD(tx, tx_template_prepared); - DEBUGFS_FWSTATS_ADD(tx, tx_data_prepared); - DEBUGFS_FWSTATS_ADD(tx, tx_template_programmed); - DEBUGFS_FWSTATS_ADD(tx, tx_data_programmed); - DEBUGFS_FWSTATS_ADD(tx, tx_burst_programmed); - DEBUGFS_FWSTATS_ADD(tx, tx_starts); - DEBUGFS_FWSTATS_ADD(tx, tx_imm_resp); - DEBUGFS_FWSTATS_ADD(tx, tx_start_templates); - DEBUGFS_FWSTATS_ADD(tx, tx_start_int_templates); - DEBUGFS_FWSTATS_ADD(tx, tx_start_fw_gen); - DEBUGFS_FWSTATS_ADD(tx, tx_start_data); - DEBUGFS_FWSTATS_ADD(tx, tx_start_null_frame); - DEBUGFS_FWSTATS_ADD(tx, tx_exch); - DEBUGFS_FWSTATS_ADD(tx, tx_retry_template); - DEBUGFS_FWSTATS_ADD(tx, tx_retry_data); - DEBUGFS_FWSTATS_ADD(tx, tx_exch_pending); - DEBUGFS_FWSTATS_ADD(tx, tx_exch_expiry); - DEBUGFS_FWSTATS_ADD(tx, tx_done_template); - DEBUGFS_FWSTATS_ADD(tx, tx_done_data); - DEBUGFS_FWSTATS_ADD(tx, tx_done_int_template); - DEBUGFS_FWSTATS_ADD(tx, tx_frame_checksum); - DEBUGFS_FWSTATS_ADD(tx, tx_checksum_result); - DEBUGFS_FWSTATS_ADD(tx, frag_called); - DEBUGFS_FWSTATS_ADD(tx, frag_mpdu_alloc_failed); - DEBUGFS_FWSTATS_ADD(tx, frag_init_called); - DEBUGFS_FWSTATS_ADD(tx, frag_in_process_called); - DEBUGFS_FWSTATS_ADD(tx, frag_tkip_called); - DEBUGFS_FWSTATS_ADD(tx, frag_key_not_found); - DEBUGFS_FWSTATS_ADD(tx, frag_need_fragmentation); - DEBUGFS_FWSTATS_ADD(tx, frag_bad_mblk_num); - DEBUGFS_FWSTATS_ADD(tx, frag_failed); - DEBUGFS_FWSTATS_ADD(tx, frag_cache_hit); - DEBUGFS_FWSTATS_ADD(tx, frag_cache_miss); - - DEBUGFS_FWSTATS_ADD(rx, rx_beacon_early_term); - DEBUGFS_FWSTATS_ADD(rx, rx_out_of_mpdu_nodes); - DEBUGFS_FWSTATS_ADD(rx, rx_hdr_overflow); - DEBUGFS_FWSTATS_ADD(rx, rx_dropped_frame); - DEBUGFS_FWSTATS_ADD(rx, rx_done); - DEBUGFS_FWSTATS_ADD(rx, rx_defrag); - DEBUGFS_FWSTATS_ADD(rx, rx_defrag_end); - DEBUGFS_FWSTATS_ADD(rx, rx_cmplt); - DEBUGFS_FWSTATS_ADD(rx, rx_pre_complt); - DEBUGFS_FWSTATS_ADD(rx, rx_cmplt_task); - DEBUGFS_FWSTATS_ADD(rx, rx_phy_hdr); - DEBUGFS_FWSTATS_ADD(rx, rx_timeout); - DEBUGFS_FWSTATS_ADD(rx, rx_timeout_wa); - DEBUGFS_FWSTATS_ADD(rx, rx_wa_density_dropped_frame); - DEBUGFS_FWSTATS_ADD(rx, rx_wa_ba_not_expected); - DEBUGFS_FWSTATS_ADD(rx, rx_frame_checksum); - DEBUGFS_FWSTATS_ADD(rx, rx_checksum_result); - DEBUGFS_FWSTATS_ADD(rx, defrag_called); - DEBUGFS_FWSTATS_ADD(rx, defrag_init_called); - DEBUGFS_FWSTATS_ADD(rx, defrag_in_process_called); - DEBUGFS_FWSTATS_ADD(rx, defrag_tkip_called); - DEBUGFS_FWSTATS_ADD(rx, defrag_need_defrag); - DEBUGFS_FWSTATS_ADD(rx, defrag_decrypt_failed); - DEBUGFS_FWSTATS_ADD(rx, decrypt_key_not_found); - DEBUGFS_FWSTATS_ADD(rx, defrag_need_decrypt); - DEBUGFS_FWSTATS_ADD(rx, rx_tkip_replays); - - DEBUGFS_FWSTATS_ADD(isr, irqs); - - DEBUGFS_FWSTATS_ADD(pwr, missing_bcns_cnt); - DEBUGFS_FWSTATS_ADD(pwr, rcvd_bcns_cnt); - DEBUGFS_FWSTATS_ADD(pwr, connection_out_of_sync); - DEBUGFS_FWSTATS_ADD(pwr, cont_miss_bcns_spread); - DEBUGFS_FWSTATS_ADD(pwr, rcvd_awake_bcns_cnt); - - DEBUGFS_FWSTATS_ADD(ps_poll, ps_poll_timeouts); - DEBUGFS_FWSTATS_ADD(ps_poll, upsd_timeouts); - DEBUGFS_FWSTATS_ADD(ps_poll, upsd_max_ap_turn); - DEBUGFS_FWSTATS_ADD(ps_poll, ps_poll_max_ap_turn); - DEBUGFS_FWSTATS_ADD(ps_poll, ps_poll_utilization); - DEBUGFS_FWSTATS_ADD(ps_poll, upsd_utilization); - - DEBUGFS_FWSTATS_ADD(rx_filter, beacon_filter); - DEBUGFS_FWSTATS_ADD(rx_filter, arp_filter); - DEBUGFS_FWSTATS_ADD(rx_filter, mc_filter); - DEBUGFS_FWSTATS_ADD(rx_filter, dup_filter); - DEBUGFS_FWSTATS_ADD(rx_filter, data_filter); - DEBUGFS_FWSTATS_ADD(rx_filter, ibss_filter); - DEBUGFS_FWSTATS_ADD(rx_filter, protection_filter); - DEBUGFS_FWSTATS_ADD(rx_filter, accum_arp_pend_requests); - DEBUGFS_FWSTATS_ADD(rx_filter, max_arp_queue_dep); - - DEBUGFS_FWSTATS_ADD(rx_rate, rx_frames_per_rates); - - DEBUGFS_FWSTATS_ADD(aggr_size, tx_agg_vs_rate); - DEBUGFS_FWSTATS_ADD(aggr_size, rx_size); - - DEBUGFS_FWSTATS_ADD(pipeline, hs_tx_stat_fifo_int); - DEBUGFS_FWSTATS_ADD(pipeline, tcp_tx_stat_fifo_int); - DEBUGFS_FWSTATS_ADD(pipeline, tcp_rx_stat_fifo_int); - DEBUGFS_FWSTATS_ADD(pipeline, enc_tx_stat_fifo_int); - DEBUGFS_FWSTATS_ADD(pipeline, enc_rx_stat_fifo_int); - DEBUGFS_FWSTATS_ADD(pipeline, rx_complete_stat_fifo_int); - DEBUGFS_FWSTATS_ADD(pipeline, pre_proc_swi); - DEBUGFS_FWSTATS_ADD(pipeline, post_proc_swi); - DEBUGFS_FWSTATS_ADD(pipeline, sec_frag_swi); - DEBUGFS_FWSTATS_ADD(pipeline, pre_to_defrag_swi); - DEBUGFS_FWSTATS_ADD(pipeline, defrag_to_csum_swi); - DEBUGFS_FWSTATS_ADD(pipeline, csum_to_rx_xfer_swi); - DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_in); - DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_in_fifo_full); - DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_out); - DEBUGFS_FWSTATS_ADD(pipeline, cs_rx_packet_in); - DEBUGFS_FWSTATS_ADD(pipeline, cs_rx_packet_out); - DEBUGFS_FWSTATS_ADD(pipeline, pipeline_fifo_full); - - DEBUGFS_FWSTATS_ADD(mem, rx_free_mem_blks); - DEBUGFS_FWSTATS_ADD(mem, tx_free_mem_blks); - DEBUGFS_FWSTATS_ADD(mem, fwlog_free_mem_blks); - DEBUGFS_FWSTATS_ADD(mem, fw_gen_free_mem_blks); - - DEBUGFS_ADD(conf, moddir); - - return 0; - -err: - if (IS_ERR(entry)) - ret = PTR_ERR(entry); - else - ret = -ENOMEM; - - return ret; -} diff --git a/drivers/net/wireless/ti/wl18xx/debugfs.h b/drivers/net/wireless/ti/wl18xx/debugfs.h deleted file mode 100644 index ed679bebf620..000000000000 --- a/drivers/net/wireless/ti/wl18xx/debugfs.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2012 Texas Instruments. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL18XX_DEBUGFS_H__ -#define __WL18XX_DEBUGFS_H__ - -int wl18xx_debugfs_add_files(struct wl1271 *wl, - struct dentry *rootdir); - -#endif /* __WL18XX_DEBUGFS_H__ */ diff --git a/drivers/net/wireless/ti/wl18xx/event.c b/drivers/net/wireless/ti/wl18xx/event.c deleted file mode 100644 index c9199d7804c6..000000000000 --- a/drivers/net/wireless/ti/wl18xx/event.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2012 Texas Instruments. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "event.h" -#include "scan.h" -#include "../wlcore/cmd.h" -#include "../wlcore/debug.h" - -int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event, - bool *timeout) -{ - u32 local_event; - - switch (event) { - case WLCORE_EVENT_PEER_REMOVE_COMPLETE: - local_event = PEER_REMOVE_COMPLETE_EVENT_ID; - break; - - case WLCORE_EVENT_DFS_CONFIG_COMPLETE: - local_event = DFS_CHANNELS_CONFIG_COMPLETE_EVENT; - break; - - default: - /* event not implemented */ - return 0; - } - return wlcore_cmd_wait_for_event_or_timeout(wl, local_event, timeout); -} - -int wl18xx_process_mailbox_events(struct wl1271 *wl) -{ - struct wl18xx_event_mailbox *mbox = wl->mbox; - u32 vector; - - vector = le32_to_cpu(mbox->events_vector); - wl1271_debug(DEBUG_EVENT, "MBOX vector: 0x%x", vector); - - if (vector & SCAN_COMPLETE_EVENT_ID) { - wl1271_debug(DEBUG_EVENT, "scan results: %d", - mbox->number_of_scan_results); - - if (wl->scan_wlvif) - wl18xx_scan_completed(wl, wl->scan_wlvif); - } - - if (vector & PERIODIC_SCAN_REPORT_EVENT_ID) { - wl1271_debug(DEBUG_EVENT, - "PERIODIC_SCAN_REPORT_EVENT (results %d)", - mbox->number_of_sched_scan_results); - - wlcore_scan_sched_scan_results(wl); - } - - if (vector & PERIODIC_SCAN_COMPLETE_EVENT_ID) - wlcore_event_sched_scan_completed(wl, 1); - - if (vector & RSSI_SNR_TRIGGER_0_EVENT_ID) - wlcore_event_rssi_trigger(wl, mbox->rssi_snr_trigger_metric); - - if (vector & BA_SESSION_RX_CONSTRAINT_EVENT_ID) - wlcore_event_ba_rx_constraint(wl, - le16_to_cpu(mbox->rx_ba_role_id_bitmap), - le16_to_cpu(mbox->rx_ba_allowed_bitmap)); - - if (vector & BSS_LOSS_EVENT_ID) - wlcore_event_beacon_loss(wl, - le16_to_cpu(mbox->bss_loss_bitmap)); - - if (vector & CHANNEL_SWITCH_COMPLETE_EVENT_ID) - wlcore_event_channel_switch(wl, - le16_to_cpu(mbox->channel_switch_role_id_bitmap), - true); - - if (vector & DUMMY_PACKET_EVENT_ID) - wlcore_event_dummy_packet(wl); - - /* - * "TX retries exceeded" has a different meaning according to mode. - * In AP mode the offending station is disconnected. - */ - if (vector & MAX_TX_FAILURE_EVENT_ID) - wlcore_event_max_tx_failure(wl, - le32_to_cpu(mbox->tx_retry_exceeded_bitmap)); - - if (vector & INACTIVE_STA_EVENT_ID) - wlcore_event_inactive_sta(wl, - le32_to_cpu(mbox->inactive_sta_bitmap)); - - if (vector & REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID) - wlcore_event_roc_complete(wl); - - return 0; -} diff --git a/drivers/net/wireless/ti/wl18xx/event.h b/drivers/net/wireless/ti/wl18xx/event.h deleted file mode 100644 index 398f3d2c0a6c..000000000000 --- a/drivers/net/wireless/ti/wl18xx/event.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2012 Texas Instruments. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL18XX_EVENT_H__ -#define __WL18XX_EVENT_H__ - -#include "../wlcore/wlcore.h" - -enum { - SCAN_COMPLETE_EVENT_ID = BIT(8), - RADAR_DETECTED_EVENT_ID = BIT(9), - CHANNEL_SWITCH_COMPLETE_EVENT_ID = BIT(10), - BSS_LOSS_EVENT_ID = BIT(11), - MAX_TX_FAILURE_EVENT_ID = BIT(12), - DUMMY_PACKET_EVENT_ID = BIT(13), - INACTIVE_STA_EVENT_ID = BIT(14), - PEER_REMOVE_COMPLETE_EVENT_ID = BIT(15), - PERIODIC_SCAN_COMPLETE_EVENT_ID = BIT(16), - BA_SESSION_RX_CONSTRAINT_EVENT_ID = BIT(17), - REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID = BIT(18), - DFS_CHANNELS_CONFIG_COMPLETE_EVENT = BIT(19), - PERIODIC_SCAN_REPORT_EVENT_ID = BIT(20), -}; - -struct wl18xx_event_mailbox { - __le32 events_vector; - - u8 number_of_scan_results; - u8 number_of_sched_scan_results; - - __le16 channel_switch_role_id_bitmap; - - s8 rssi_snr_trigger_metric[NUM_OF_RSSI_SNR_TRIGGERS]; - - /* bitmap of removed links */ - __le32 hlid_removed_bitmap; - - /* rx ba constraint */ - __le16 rx_ba_role_id_bitmap; /* 0xfff means any role. */ - __le16 rx_ba_allowed_bitmap; - - /* bitmap of roc completed (by role id) */ - __le16 roc_completed_bitmap; - - /* bitmap of stations (by role id) with bss loss */ - __le16 bss_loss_bitmap; - - /* bitmap of stations (by HLID) which exceeded max tx retries */ - __le32 tx_retry_exceeded_bitmap; - - /* bitmap of inactive stations (by HLID) */ - __le32 inactive_sta_bitmap; -} __packed; - -int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event, - bool *timeout); -int wl18xx_process_mailbox_events(struct wl1271 *wl); - -#endif diff --git a/drivers/net/wireless/ti/wl18xx/io.c b/drivers/net/wireless/ti/wl18xx/io.c deleted file mode 100644 index f0abf3ef2c95..000000000000 --- a/drivers/net/wireless/ti/wl18xx/io.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2011 Texas Instruments - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "../wlcore/wlcore.h" -#include "../wlcore/io.h" - -#include "io.h" - -int wl18xx_top_reg_write(struct wl1271 *wl, int addr, u16 val) -{ - u32 tmp; - int ret; - - if (WARN_ON(addr % 2)) - return -EINVAL; - - if ((addr % 4) == 0) { - ret = wlcore_read32(wl, addr, &tmp); - if (ret < 0) - goto out; - - tmp = (tmp & 0xffff0000) | val; - ret = wlcore_write32(wl, addr, tmp); - } else { - ret = wlcore_read32(wl, addr - 2, &tmp); - if (ret < 0) - goto out; - - tmp = (tmp & 0xffff) | (val << 16); - ret = wlcore_write32(wl, addr - 2, tmp); - } - -out: - return ret; -} - -int wl18xx_top_reg_read(struct wl1271 *wl, int addr, u16 *out) -{ - u32 val = 0; - int ret; - - if (WARN_ON(addr % 2)) - return -EINVAL; - - if ((addr % 4) == 0) { - /* address is 4-bytes aligned */ - ret = wlcore_read32(wl, addr, &val); - if (ret >= 0 && out) - *out = val & 0xffff; - } else { - ret = wlcore_read32(wl, addr - 2, &val); - if (ret >= 0 && out) - *out = (val & 0xffff0000) >> 16; - } - - return ret; -} diff --git a/drivers/net/wireless/ti/wl18xx/io.h b/drivers/net/wireless/ti/wl18xx/io.h deleted file mode 100644 index c32ae30277df..000000000000 --- a/drivers/net/wireless/ti/wl18xx/io.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2011 Texas Instruments - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL18XX_IO_H__ -#define __WL18XX_IO_H__ - -int __must_check wl18xx_top_reg_write(struct wl1271 *wl, int addr, u16 val); -int __must_check wl18xx_top_reg_read(struct wl1271 *wl, int addr, u16 *out); - -#endif /* __WL18XX_IO_H__ */ diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c deleted file mode 100644 index 9fa692d11025..000000000000 --- a/drivers/net/wireless/ti/wl18xx/main.c +++ /dev/null @@ -1,1800 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2011 Texas Instruments - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include -#include - -#include "../wlcore/wlcore.h" -#include "../wlcore/debug.h" -#include "../wlcore/io.h" -#include "../wlcore/acx.h" -#include "../wlcore/tx.h" -#include "../wlcore/rx.h" -#include "../wlcore/boot.h" - -#include "reg.h" -#include "conf.h" -#include "cmd.h" -#include "acx.h" -#include "tx.h" -#include "wl18xx.h" -#include "io.h" -#include "scan.h" -#include "event.h" -#include "debugfs.h" - -#define WL18XX_RX_CHECKSUM_MASK 0x40 - -static char *ht_mode_param = NULL; -static char *board_type_param = NULL; -static bool checksum_param = false; -static int num_rx_desc_param = -1; - -/* phy paramters */ -static int dc2dc_param = -1; -static int n_antennas_2_param = -1; -static int n_antennas_5_param = -1; -static int low_band_component_param = -1; -static int low_band_component_type_param = -1; -static int high_band_component_param = -1; -static int high_band_component_type_param = -1; -static int pwr_limit_reference_11_abg_param = -1; - -static const u8 wl18xx_rate_to_idx_2ghz[] = { - /* MCS rates are used only with 11n */ - 15, /* WL18XX_CONF_HW_RXTX_RATE_MCS15 */ - 14, /* WL18XX_CONF_HW_RXTX_RATE_MCS14 */ - 13, /* WL18XX_CONF_HW_RXTX_RATE_MCS13 */ - 12, /* WL18XX_CONF_HW_RXTX_RATE_MCS12 */ - 11, /* WL18XX_CONF_HW_RXTX_RATE_MCS11 */ - 10, /* WL18XX_CONF_HW_RXTX_RATE_MCS10 */ - 9, /* WL18XX_CONF_HW_RXTX_RATE_MCS9 */ - 8, /* WL18XX_CONF_HW_RXTX_RATE_MCS8 */ - 7, /* WL18XX_CONF_HW_RXTX_RATE_MCS7 */ - 6, /* WL18XX_CONF_HW_RXTX_RATE_MCS6 */ - 5, /* WL18XX_CONF_HW_RXTX_RATE_MCS5 */ - 4, /* WL18XX_CONF_HW_RXTX_RATE_MCS4 */ - 3, /* WL18XX_CONF_HW_RXTX_RATE_MCS3 */ - 2, /* WL18XX_CONF_HW_RXTX_RATE_MCS2 */ - 1, /* WL18XX_CONF_HW_RXTX_RATE_MCS1 */ - 0, /* WL18XX_CONF_HW_RXTX_RATE_MCS0 */ - - 11, /* WL18XX_CONF_HW_RXTX_RATE_54 */ - 10, /* WL18XX_CONF_HW_RXTX_RATE_48 */ - 9, /* WL18XX_CONF_HW_RXTX_RATE_36 */ - 8, /* WL18XX_CONF_HW_RXTX_RATE_24 */ - - /* TI-specific rate */ - CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_22 */ - - 7, /* WL18XX_CONF_HW_RXTX_RATE_18 */ - 6, /* WL18XX_CONF_HW_RXTX_RATE_12 */ - 3, /* WL18XX_CONF_HW_RXTX_RATE_11 */ - 5, /* WL18XX_CONF_HW_RXTX_RATE_9 */ - 4, /* WL18XX_CONF_HW_RXTX_RATE_6 */ - 2, /* WL18XX_CONF_HW_RXTX_RATE_5_5 */ - 1, /* WL18XX_CONF_HW_RXTX_RATE_2 */ - 0 /* WL18XX_CONF_HW_RXTX_RATE_1 */ -}; - -static const u8 wl18xx_rate_to_idx_5ghz[] = { - /* MCS rates are used only with 11n */ - 15, /* WL18XX_CONF_HW_RXTX_RATE_MCS15 */ - 14, /* WL18XX_CONF_HW_RXTX_RATE_MCS14 */ - 13, /* WL18XX_CONF_HW_RXTX_RATE_MCS13 */ - 12, /* WL18XX_CONF_HW_RXTX_RATE_MCS12 */ - 11, /* WL18XX_CONF_HW_RXTX_RATE_MCS11 */ - 10, /* WL18XX_CONF_HW_RXTX_RATE_MCS10 */ - 9, /* WL18XX_CONF_HW_RXTX_RATE_MCS9 */ - 8, /* WL18XX_CONF_HW_RXTX_RATE_MCS8 */ - 7, /* WL18XX_CONF_HW_RXTX_RATE_MCS7 */ - 6, /* WL18XX_CONF_HW_RXTX_RATE_MCS6 */ - 5, /* WL18XX_CONF_HW_RXTX_RATE_MCS5 */ - 4, /* WL18XX_CONF_HW_RXTX_RATE_MCS4 */ - 3, /* WL18XX_CONF_HW_RXTX_RATE_MCS3 */ - 2, /* WL18XX_CONF_HW_RXTX_RATE_MCS2 */ - 1, /* WL18XX_CONF_HW_RXTX_RATE_MCS1 */ - 0, /* WL18XX_CONF_HW_RXTX_RATE_MCS0 */ - - 7, /* WL18XX_CONF_HW_RXTX_RATE_54 */ - 6, /* WL18XX_CONF_HW_RXTX_RATE_48 */ - 5, /* WL18XX_CONF_HW_RXTX_RATE_36 */ - 4, /* WL18XX_CONF_HW_RXTX_RATE_24 */ - - /* TI-specific rate */ - CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_22 */ - - 3, /* WL18XX_CONF_HW_RXTX_RATE_18 */ - 2, /* WL18XX_CONF_HW_RXTX_RATE_12 */ - CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_11 */ - 1, /* WL18XX_CONF_HW_RXTX_RATE_9 */ - 0, /* WL18XX_CONF_HW_RXTX_RATE_6 */ - CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_5_5 */ - CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_2 */ - CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL18XX_CONF_HW_RXTX_RATE_1 */ -}; - -static const u8 *wl18xx_band_rate_to_idx[] = { - [IEEE80211_BAND_2GHZ] = wl18xx_rate_to_idx_2ghz, - [IEEE80211_BAND_5GHZ] = wl18xx_rate_to_idx_5ghz -}; - -enum wl18xx_hw_rates { - WL18XX_CONF_HW_RXTX_RATE_MCS15 = 0, - WL18XX_CONF_HW_RXTX_RATE_MCS14, - WL18XX_CONF_HW_RXTX_RATE_MCS13, - WL18XX_CONF_HW_RXTX_RATE_MCS12, - WL18XX_CONF_HW_RXTX_RATE_MCS11, - WL18XX_CONF_HW_RXTX_RATE_MCS10, - WL18XX_CONF_HW_RXTX_RATE_MCS9, - WL18XX_CONF_HW_RXTX_RATE_MCS8, - WL18XX_CONF_HW_RXTX_RATE_MCS7, - WL18XX_CONF_HW_RXTX_RATE_MCS6, - WL18XX_CONF_HW_RXTX_RATE_MCS5, - WL18XX_CONF_HW_RXTX_RATE_MCS4, - WL18XX_CONF_HW_RXTX_RATE_MCS3, - WL18XX_CONF_HW_RXTX_RATE_MCS2, - WL18XX_CONF_HW_RXTX_RATE_MCS1, - WL18XX_CONF_HW_RXTX_RATE_MCS0, - WL18XX_CONF_HW_RXTX_RATE_54, - WL18XX_CONF_HW_RXTX_RATE_48, - WL18XX_CONF_HW_RXTX_RATE_36, - WL18XX_CONF_HW_RXTX_RATE_24, - WL18XX_CONF_HW_RXTX_RATE_22, - WL18XX_CONF_HW_RXTX_RATE_18, - WL18XX_CONF_HW_RXTX_RATE_12, - WL18XX_CONF_HW_RXTX_RATE_11, - WL18XX_CONF_HW_RXTX_RATE_9, - WL18XX_CONF_HW_RXTX_RATE_6, - WL18XX_CONF_HW_RXTX_RATE_5_5, - WL18XX_CONF_HW_RXTX_RATE_2, - WL18XX_CONF_HW_RXTX_RATE_1, - WL18XX_CONF_HW_RXTX_RATE_MAX, -}; - -static struct wlcore_conf wl18xx_conf = { - .sg = { - .params = { - [CONF_SG_ACL_BT_MASTER_MIN_BR] = 10, - [CONF_SG_ACL_BT_MASTER_MAX_BR] = 180, - [CONF_SG_ACL_BT_SLAVE_MIN_BR] = 10, - [CONF_SG_ACL_BT_SLAVE_MAX_BR] = 180, - [CONF_SG_ACL_BT_MASTER_MIN_EDR] = 10, - [CONF_SG_ACL_BT_MASTER_MAX_EDR] = 80, - [CONF_SG_ACL_BT_SLAVE_MIN_EDR] = 10, - [CONF_SG_ACL_BT_SLAVE_MAX_EDR] = 80, - [CONF_SG_ACL_WLAN_PS_MASTER_BR] = 8, - [CONF_SG_ACL_WLAN_PS_SLAVE_BR] = 8, - [CONF_SG_ACL_WLAN_PS_MASTER_EDR] = 20, - [CONF_SG_ACL_WLAN_PS_SLAVE_EDR] = 20, - [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MIN_BR] = 20, - [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MAX_BR] = 35, - [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MIN_BR] = 16, - [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MAX_BR] = 35, - [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MIN_EDR] = 32, - [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MAX_EDR] = 50, - [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MIN_EDR] = 28, - [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MAX_EDR] = 50, - [CONF_SG_ACL_ACTIVE_SCAN_WLAN_BR] = 10, - [CONF_SG_ACL_ACTIVE_SCAN_WLAN_EDR] = 20, - [CONF_SG_ACL_PASSIVE_SCAN_BT_BR] = 75, - [CONF_SG_ACL_PASSIVE_SCAN_WLAN_BR] = 15, - [CONF_SG_ACL_PASSIVE_SCAN_BT_EDR] = 27, - [CONF_SG_ACL_PASSIVE_SCAN_WLAN_EDR] = 17, - /* active scan params */ - [CONF_SG_AUTO_SCAN_PROBE_REQ] = 170, - [CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_HV3] = 50, - [CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_A2DP] = 100, - /* passive scan params */ - [CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_A2DP_BR] = 800, - [CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_A2DP_EDR] = 200, - [CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_HV3] = 200, - /* passive scan in dual antenna params */ - [CONF_SG_CONSECUTIVE_HV3_IN_PASSIVE_SCAN] = 0, - [CONF_SG_BCN_HV3_COLLISION_THRESH_IN_PASSIVE_SCAN] = 0, - [CONF_SG_TX_RX_PROTECTION_BWIDTH_IN_PASSIVE_SCAN] = 0, - /* general params */ - [CONF_SG_STA_FORCE_PS_IN_BT_SCO] = 1, - [CONF_SG_ANTENNA_CONFIGURATION] = 0, - [CONF_SG_BEACON_MISS_PERCENT] = 60, - [CONF_SG_DHCP_TIME] = 5000, - [CONF_SG_RXT] = 1200, - [CONF_SG_TXT] = 1000, - [CONF_SG_ADAPTIVE_RXT_TXT] = 1, - [CONF_SG_GENERAL_USAGE_BIT_MAP] = 3, - [CONF_SG_HV3_MAX_SERVED] = 6, - [CONF_SG_PS_POLL_TIMEOUT] = 10, - [CONF_SG_UPSD_TIMEOUT] = 10, - [CONF_SG_CONSECUTIVE_CTS_THRESHOLD] = 2, - [CONF_SG_STA_RX_WINDOW_AFTER_DTIM] = 5, - [CONF_SG_STA_CONNECTION_PROTECTION_TIME] = 30, - /* AP params */ - [CONF_AP_BEACON_MISS_TX] = 3, - [CONF_AP_RX_WINDOW_AFTER_BEACON] = 10, - [CONF_AP_BEACON_WINDOW_INTERVAL] = 2, - [CONF_AP_CONNECTION_PROTECTION_TIME] = 0, - [CONF_AP_BT_ACL_VAL_BT_SERVE_TIME] = 25, - [CONF_AP_BT_ACL_VAL_WL_SERVE_TIME] = 25, - /* CTS Diluting params */ - [CONF_SG_CTS_DILUTED_BAD_RX_PACKETS_TH] = 0, - [CONF_SG_CTS_CHOP_IN_DUAL_ANT_SCO_MASTER] = 0, - }, - .state = CONF_SG_PROTECTIVE, - }, - .rx = { - .rx_msdu_life_time = 512000, - .packet_detection_threshold = 0, - .ps_poll_timeout = 15, - .upsd_timeout = 15, - .rts_threshold = IEEE80211_MAX_RTS_THRESHOLD, - .rx_cca_threshold = 0, - .irq_blk_threshold = 0xFFFF, - .irq_pkt_threshold = 0, - .irq_timeout = 600, - .queue_type = CONF_RX_QUEUE_TYPE_LOW_PRIORITY, - }, - .tx = { - .tx_energy_detection = 0, - .sta_rc_conf = { - .enabled_rates = 0, - .short_retry_limit = 10, - .long_retry_limit = 10, - .aflags = 0, - }, - .ac_conf_count = 4, - .ac_conf = { - [CONF_TX_AC_BE] = { - .ac = CONF_TX_AC_BE, - .cw_min = 15, - .cw_max = 63, - .aifsn = 3, - .tx_op_limit = 0, - }, - [CONF_TX_AC_BK] = { - .ac = CONF_TX_AC_BK, - .cw_min = 15, - .cw_max = 63, - .aifsn = 7, - .tx_op_limit = 0, - }, - [CONF_TX_AC_VI] = { - .ac = CONF_TX_AC_VI, - .cw_min = 15, - .cw_max = 63, - .aifsn = CONF_TX_AIFS_PIFS, - .tx_op_limit = 3008, - }, - [CONF_TX_AC_VO] = { - .ac = CONF_TX_AC_VO, - .cw_min = 15, - .cw_max = 63, - .aifsn = CONF_TX_AIFS_PIFS, - .tx_op_limit = 1504, - }, - }, - .max_tx_retries = 100, - .ap_aging_period = 300, - .tid_conf_count = 4, - .tid_conf = { - [CONF_TX_AC_BE] = { - .queue_id = CONF_TX_AC_BE, - .channel_type = CONF_CHANNEL_TYPE_EDCF, - .tsid = CONF_TX_AC_BE, - .ps_scheme = CONF_PS_SCHEME_LEGACY, - .ack_policy = CONF_ACK_POLICY_LEGACY, - .apsd_conf = {0, 0}, - }, - [CONF_TX_AC_BK] = { - .queue_id = CONF_TX_AC_BK, - .channel_type = CONF_CHANNEL_TYPE_EDCF, - .tsid = CONF_TX_AC_BK, - .ps_scheme = CONF_PS_SCHEME_LEGACY, - .ack_policy = CONF_ACK_POLICY_LEGACY, - .apsd_conf = {0, 0}, - }, - [CONF_TX_AC_VI] = { - .queue_id = CONF_TX_AC_VI, - .channel_type = CONF_CHANNEL_TYPE_EDCF, - .tsid = CONF_TX_AC_VI, - .ps_scheme = CONF_PS_SCHEME_LEGACY, - .ack_policy = CONF_ACK_POLICY_LEGACY, - .apsd_conf = {0, 0}, - }, - [CONF_TX_AC_VO] = { - .queue_id = CONF_TX_AC_VO, - .channel_type = CONF_CHANNEL_TYPE_EDCF, - .tsid = CONF_TX_AC_VO, - .ps_scheme = CONF_PS_SCHEME_LEGACY, - .ack_policy = CONF_ACK_POLICY_LEGACY, - .apsd_conf = {0, 0}, - }, - }, - .frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD, - .tx_compl_timeout = 350, - .tx_compl_threshold = 10, - .basic_rate = CONF_HW_BIT_RATE_1MBPS, - .basic_rate_5 = CONF_HW_BIT_RATE_6MBPS, - .tmpl_short_retry_limit = 10, - .tmpl_long_retry_limit = 10, - .tx_watchdog_timeout = 5000, - .slow_link_thold = 3, - .fast_link_thold = 30, - }, - .conn = { - .wake_up_event = CONF_WAKE_UP_EVENT_DTIM, - .listen_interval = 1, - .suspend_wake_up_event = CONF_WAKE_UP_EVENT_N_DTIM, - .suspend_listen_interval = 3, - .bcn_filt_mode = CONF_BCN_FILT_MODE_ENABLED, - .bcn_filt_ie_count = 3, - .bcn_filt_ie = { - [0] = { - .ie = WLAN_EID_CHANNEL_SWITCH, - .rule = CONF_BCN_RULE_PASS_ON_APPEARANCE, - }, - [1] = { - .ie = WLAN_EID_HT_OPERATION, - .rule = CONF_BCN_RULE_PASS_ON_CHANGE, - }, - [2] = { - .ie = WLAN_EID_ERP_INFO, - .rule = CONF_BCN_RULE_PASS_ON_CHANGE, - }, - }, - .synch_fail_thold = 12, - .bss_lose_timeout = 400, - .beacon_rx_timeout = 10000, - .broadcast_timeout = 20000, - .rx_broadcast_in_ps = 1, - .ps_poll_threshold = 10, - .bet_enable = CONF_BET_MODE_ENABLE, - .bet_max_consecutive = 50, - .psm_entry_retries = 8, - .psm_exit_retries = 16, - .psm_entry_nullfunc_retries = 3, - .dynamic_ps_timeout = 1500, - .forced_ps = false, - .keep_alive_interval = 55000, - .max_listen_interval = 20, - .sta_sleep_auth = WL1271_PSM_ILLEGAL, - }, - .itrim = { - .enable = false, - .timeout = 50000, - }, - .pm_config = { - .host_clk_settling_time = 5000, - .host_fast_wakeup_support = CONF_FAST_WAKEUP_DISABLE, - }, - .roam_trigger = { - .trigger_pacing = 1, - .avg_weight_rssi_beacon = 20, - .avg_weight_rssi_data = 10, - .avg_weight_snr_beacon = 20, - .avg_weight_snr_data = 10, - }, - .scan = { - .min_dwell_time_active = 7500, - .max_dwell_time_active = 30000, - .min_dwell_time_active_long = 25000, - .max_dwell_time_active_long = 50000, - .dwell_time_passive = 100000, - .dwell_time_dfs = 150000, - .num_probe_reqs = 2, - .split_scan_timeout = 50000, - }, - .sched_scan = { - /* - * Values are in TU/1000 but since sched scan FW command - * params are in TUs rounding up may occur. - */ - .base_dwell_time = 7500, - .max_dwell_time_delta = 22500, - /* based on 250bits per probe @1Mbps */ - .dwell_time_delta_per_probe = 2000, - /* based on 250bits per probe @6Mbps (plus a bit more) */ - .dwell_time_delta_per_probe_5 = 350, - .dwell_time_passive = 100000, - .dwell_time_dfs = 150000, - .num_probe_reqs = 2, - .rssi_threshold = -90, - .snr_threshold = 0, - }, - .ht = { - .rx_ba_win_size = 32, - .tx_ba_win_size = 64, - .inactivity_timeout = 10000, - .tx_ba_tid_bitmap = CONF_TX_BA_ENABLED_TID_BITMAP, - }, - .mem = { - .num_stations = 1, - .ssid_profiles = 1, - .rx_block_num = 40, - .tx_min_block_num = 40, - .dynamic_memory = 1, - .min_req_tx_blocks = 45, - .min_req_rx_blocks = 22, - .tx_min = 27, - }, - .fm_coex = { - .enable = true, - .swallow_period = 5, - .n_divider_fref_set_1 = 0xff, /* default */ - .n_divider_fref_set_2 = 12, - .m_divider_fref_set_1 = 0xffff, - .m_divider_fref_set_2 = 148, /* default */ - .coex_pll_stabilization_time = 0xffffffff, /* default */ - .ldo_stabilization_time = 0xffff, /* default */ - .fm_disturbed_band_margin = 0xff, /* default */ - .swallow_clk_diff = 0xff, /* default */ - }, - .rx_streaming = { - .duration = 150, - .queues = 0x1, - .interval = 20, - .always = 0, - }, - .fwlog = { - .mode = WL12XX_FWLOG_ON_DEMAND, - .mem_blocks = 2, - .severity = 0, - .timestamp = WL12XX_FWLOG_TIMESTAMP_DISABLED, - .output = WL12XX_FWLOG_OUTPUT_HOST, - .threshold = 0, - }, - .rate = { - .rate_retry_score = 32000, - .per_add = 8192, - .per_th1 = 2048, - .per_th2 = 4096, - .max_per = 8100, - .inverse_curiosity_factor = 5, - .tx_fail_low_th = 4, - .tx_fail_high_th = 10, - .per_alpha_shift = 4, - .per_add_shift = 13, - .per_beta1_shift = 10, - .per_beta2_shift = 8, - .rate_check_up = 2, - .rate_check_down = 12, - .rate_retry_policy = { - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - }, - }, - .hangover = { - .recover_time = 0, - .hangover_period = 20, - .dynamic_mode = 1, - .early_termination_mode = 1, - .max_period = 20, - .min_period = 1, - .increase_delta = 1, - .decrease_delta = 2, - .quiet_time = 4, - .increase_time = 1, - .window_size = 16, - }, - .recovery = { - .bug_on_recovery = 0, - .no_recovery = 0, - }, -}; - -static struct wl18xx_priv_conf wl18xx_default_priv_conf = { - .ht = { - .mode = HT_MODE_DEFAULT, - }, - .phy = { - .phy_standalone = 0x00, - .primary_clock_setting_time = 0x05, - .clock_valid_on_wake_up = 0x00, - .secondary_clock_setting_time = 0x05, - .board_type = BOARD_TYPE_HDK_18XX, - .auto_detect = 0x00, - .dedicated_fem = FEM_NONE, - .low_band_component = COMPONENT_3_WAY_SWITCH, - .low_band_component_type = 0x04, - .high_band_component = COMPONENT_2_WAY_SWITCH, - .high_band_component_type = 0x09, - .tcxo_ldo_voltage = 0x00, - .xtal_itrim_val = 0x04, - .srf_state = 0x00, - .io_configuration = 0x01, - .sdio_configuration = 0x00, - .settings = 0x00, - .enable_clpc = 0x00, - .enable_tx_low_pwr_on_siso_rdl = 0x00, - .rx_profile = 0x00, - .pwr_limit_reference_11_abg = 0x64, - .per_chan_pwr_limit_arr_11abg = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, - .pwr_limit_reference_11p = 0x64, - .per_chan_bo_mode_11_abg = { 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00 }, - .per_chan_bo_mode_11_p = { 0x00, 0x00, 0x00, 0x00 }, - .per_chan_pwr_limit_arr_11p = { 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff }, - .psat = 0, - .low_power_val = 0x08, - .med_power_val = 0x12, - .high_power_val = 0x18, - .low_power_val_2nd = 0x05, - .med_power_val_2nd = 0x0a, - .high_power_val_2nd = 0x14, - .external_pa_dc2dc = 0, - .number_of_assembled_ant2_4 = 2, - .number_of_assembled_ant5 = 1, - .tx_rf_margin = 1, - }, -}; - -static const struct wlcore_partition_set wl18xx_ptable[PART_TABLE_LEN] = { - [PART_TOP_PRCM_ELP_SOC] = { - .mem = { .start = 0x00A02000, .size = 0x00010000 }, - .reg = { .start = 0x00807000, .size = 0x00005000 }, - .mem2 = { .start = 0x00800000, .size = 0x0000B000 }, - .mem3 = { .start = 0x00000000, .size = 0x00000000 }, - }, - [PART_DOWN] = { - .mem = { .start = 0x00000000, .size = 0x00014000 }, - .reg = { .start = 0x00810000, .size = 0x0000BFFF }, - .mem2 = { .start = 0x00000000, .size = 0x00000000 }, - .mem3 = { .start = 0x00000000, .size = 0x00000000 }, - }, - [PART_BOOT] = { - .mem = { .start = 0x00700000, .size = 0x0000030c }, - .reg = { .start = 0x00802000, .size = 0x00014578 }, - .mem2 = { .start = 0x00B00404, .size = 0x00001000 }, - .mem3 = { .start = 0x00C00000, .size = 0x00000400 }, - }, - [PART_WORK] = { - .mem = { .start = 0x00800000, .size = 0x000050FC }, - .reg = { .start = 0x00B00404, .size = 0x00001000 }, - .mem2 = { .start = 0x00C00000, .size = 0x00000400 }, - .mem3 = { .start = 0x00000000, .size = 0x00000000 }, - }, - [PART_PHY_INIT] = { - .mem = { .start = 0x80926000, - .size = sizeof(struct wl18xx_mac_and_phy_params) }, - .reg = { .start = 0x00000000, .size = 0x00000000 }, - .mem2 = { .start = 0x00000000, .size = 0x00000000 }, - .mem3 = { .start = 0x00000000, .size = 0x00000000 }, - }, -}; - -static const int wl18xx_rtable[REG_TABLE_LEN] = { - [REG_ECPU_CONTROL] = WL18XX_REG_ECPU_CONTROL, - [REG_INTERRUPT_NO_CLEAR] = WL18XX_REG_INTERRUPT_NO_CLEAR, - [REG_INTERRUPT_ACK] = WL18XX_REG_INTERRUPT_ACK, - [REG_COMMAND_MAILBOX_PTR] = WL18XX_REG_COMMAND_MAILBOX_PTR, - [REG_EVENT_MAILBOX_PTR] = WL18XX_REG_EVENT_MAILBOX_PTR, - [REG_INTERRUPT_TRIG] = WL18XX_REG_INTERRUPT_TRIG_H, - [REG_INTERRUPT_MASK] = WL18XX_REG_INTERRUPT_MASK, - [REG_PC_ON_RECOVERY] = WL18XX_SCR_PAD4, - [REG_CHIP_ID_B] = WL18XX_REG_CHIP_ID_B, - [REG_CMD_MBOX_ADDRESS] = WL18XX_CMD_MBOX_ADDRESS, - - /* data access memory addresses, used with partition translation */ - [REG_SLV_MEM_DATA] = WL18XX_SLV_MEM_DATA, - [REG_SLV_REG_DATA] = WL18XX_SLV_REG_DATA, - - /* raw data access memory addresses */ - [REG_RAW_FW_STATUS_ADDR] = WL18XX_FW_STATUS_ADDR, -}; - -static const struct wl18xx_clk_cfg wl18xx_clk_table[NUM_CLOCK_CONFIGS] = { - [CLOCK_CONFIG_16_2_M] = { 7, 104, 801, 4, true }, - [CLOCK_CONFIG_16_368_M] = { 9, 132, 3751, 4, true }, - [CLOCK_CONFIG_16_8_M] = { 7, 100, 0, 0, false }, - [CLOCK_CONFIG_19_2_M] = { 8, 100, 0, 0, false }, - [CLOCK_CONFIG_26_M] = { 13, 120, 0, 0, false }, - [CLOCK_CONFIG_32_736_M] = { 9, 132, 3751, 4, true }, - [CLOCK_CONFIG_33_6_M] = { 7, 100, 0, 0, false }, - [CLOCK_CONFIG_38_468_M] = { 8, 100, 0, 0, false }, - [CLOCK_CONFIG_52_M] = { 13, 120, 0, 0, false }, -}; - -/* TODO: maybe move to a new header file? */ -#define WL18XX_FW_NAME "ti-connectivity/wl18xx-fw-2.bin" - -static int wl18xx_identify_chip(struct wl1271 *wl) -{ - int ret = 0; - - switch (wl->chip.id) { - case CHIP_ID_185x_PG20: - wl1271_debug(DEBUG_BOOT, "chip id 0x%x (185x PG20)", - wl->chip.id); - wl->sr_fw_name = WL18XX_FW_NAME; - /* wl18xx uses the same firmware for PLT */ - wl->plt_fw_name = WL18XX_FW_NAME; - wl->quirks |= WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN | - WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN | - WLCORE_QUIRK_NO_SCHED_SCAN_WHILE_CONN | - WLCORE_QUIRK_TX_PAD_LAST_FRAME | - WLCORE_QUIRK_REGDOMAIN_CONF | - WLCORE_QUIRK_DUAL_PROBE_TMPL; - - wlcore_set_min_fw_ver(wl, WL18XX_CHIP_VER, - WL18XX_IFTYPE_VER, WL18XX_MAJOR_VER, - WL18XX_SUBTYPE_VER, WL18XX_MINOR_VER, - /* there's no separate multi-role FW */ - 0, 0, 0, 0); - break; - case CHIP_ID_185x_PG10: - wl1271_warning("chip id 0x%x (185x PG10) is deprecated", - wl->chip.id); - ret = -ENODEV; - goto out; - - default: - wl1271_warning("unsupported chip id: 0x%x", wl->chip.id); - ret = -ENODEV; - goto out; - } - - wl->scan_templ_id_2_4 = CMD_TEMPL_CFG_PROBE_REQ_2_4; - wl->scan_templ_id_5 = CMD_TEMPL_CFG_PROBE_REQ_5; - wl->sched_scan_templ_id_2_4 = CMD_TEMPL_PROBE_REQ_2_4_PERIODIC; - wl->sched_scan_templ_id_5 = CMD_TEMPL_PROBE_REQ_5_PERIODIC; - wl->max_channels_5 = WL18XX_MAX_CHANNELS_5GHZ; - wl->ba_rx_session_count_max = WL18XX_RX_BA_MAX_SESSIONS; -out: - return ret; -} - -static int wl18xx_set_clk(struct wl1271 *wl) -{ - u16 clk_freq; - int ret; - - ret = wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); - if (ret < 0) - goto out; - - /* TODO: PG2: apparently we need to read the clk type */ - - ret = wl18xx_top_reg_read(wl, PRIMARY_CLK_DETECT, &clk_freq); - if (ret < 0) - goto out; - - wl1271_debug(DEBUG_BOOT, "clock freq %d (%d, %d, %d, %d, %s)", clk_freq, - wl18xx_clk_table[clk_freq].n, wl18xx_clk_table[clk_freq].m, - wl18xx_clk_table[clk_freq].p, wl18xx_clk_table[clk_freq].q, - wl18xx_clk_table[clk_freq].swallow ? "swallow" : "spit"); - - ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_N, - wl18xx_clk_table[clk_freq].n); - if (ret < 0) - goto out; - - ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_M, - wl18xx_clk_table[clk_freq].m); - if (ret < 0) - goto out; - - if (wl18xx_clk_table[clk_freq].swallow) { - /* first the 16 lower bits */ - ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_Q_FACTOR_CFG_1, - wl18xx_clk_table[clk_freq].q & - PLLSH_WCS_PLL_Q_FACTOR_CFG_1_MASK); - if (ret < 0) - goto out; - - /* then the 16 higher bits, masked out */ - ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_Q_FACTOR_CFG_2, - (wl18xx_clk_table[clk_freq].q >> 16) & - PLLSH_WCS_PLL_Q_FACTOR_CFG_2_MASK); - if (ret < 0) - goto out; - - /* first the 16 lower bits */ - ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_P_FACTOR_CFG_1, - wl18xx_clk_table[clk_freq].p & - PLLSH_WCS_PLL_P_FACTOR_CFG_1_MASK); - if (ret < 0) - goto out; - - /* then the 16 higher bits, masked out */ - ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_P_FACTOR_CFG_2, - (wl18xx_clk_table[clk_freq].p >> 16) & - PLLSH_WCS_PLL_P_FACTOR_CFG_2_MASK); - } else { - ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_SWALLOW_EN, - PLLSH_WCS_PLL_SWALLOW_EN_VAL2); - } - -out: - return ret; -} - -static int wl18xx_boot_soft_reset(struct wl1271 *wl) -{ - int ret; - - /* disable Rx/Tx */ - ret = wlcore_write32(wl, WL18XX_ENABLE, 0x0); - if (ret < 0) - goto out; - - /* disable auto calibration on start*/ - ret = wlcore_write32(wl, WL18XX_SPARE_A2, 0xffff); - -out: - return ret; -} - -static int wl18xx_pre_boot(struct wl1271 *wl) -{ - int ret; - - ret = wl18xx_set_clk(wl); - if (ret < 0) - goto out; - - /* Continue the ELP wake up sequence */ - ret = wlcore_write32(wl, WL18XX_WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); - if (ret < 0) - goto out; - - udelay(500); - - ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); - if (ret < 0) - goto out; - - /* Disable interrupts */ - ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); - if (ret < 0) - goto out; - - ret = wl18xx_boot_soft_reset(wl); - -out: - return ret; -} - -static int wl18xx_pre_upload(struct wl1271 *wl) -{ - u32 tmp; - int ret; - - ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); - if (ret < 0) - goto out; - - /* TODO: check if this is all needed */ - ret = wlcore_write32(wl, WL18XX_EEPROMLESS_IND, WL18XX_EEPROMLESS_IND); - if (ret < 0) - goto out; - - ret = wlcore_read_reg(wl, REG_CHIP_ID_B, &tmp); - if (ret < 0) - goto out; - - wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp); - - ret = wlcore_read32(wl, WL18XX_SCR_PAD2, &tmp); - -out: - return ret; -} - -static int wl18xx_set_mac_and_phy(struct wl1271 *wl) -{ - struct wl18xx_priv *priv = wl->priv; - struct wl18xx_mac_and_phy_params *params; - int ret; - - params = kmemdup(&priv->conf.phy, sizeof(*params), GFP_KERNEL); - if (!params) { - ret = -ENOMEM; - goto out; - } - - ret = wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]); - if (ret < 0) - goto out; - - ret = wlcore_write(wl, WL18XX_PHY_INIT_MEM_ADDR, params, - sizeof(*params), false); - -out: - kfree(params); - return ret; -} - -static int wl18xx_enable_interrupts(struct wl1271 *wl) -{ - u32 event_mask, intr_mask; - int ret; - - event_mask = WL18XX_ACX_EVENTS_VECTOR; - intr_mask = WL18XX_INTR_MASK; - - ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, event_mask); - if (ret < 0) - goto out; - - wlcore_enable_interrupts(wl); - - ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, - WL1271_ACX_INTR_ALL & ~intr_mask); - if (ret < 0) - goto disable_interrupts; - - return ret; - -disable_interrupts: - wlcore_disable_interrupts(wl); - -out: - return ret; -} - -static int wl18xx_boot(struct wl1271 *wl) -{ - int ret; - - ret = wl18xx_pre_boot(wl); - if (ret < 0) - goto out; - - ret = wl18xx_pre_upload(wl); - if (ret < 0) - goto out; - - ret = wlcore_boot_upload_firmware(wl); - if (ret < 0) - goto out; - - ret = wl18xx_set_mac_and_phy(wl); - if (ret < 0) - goto out; - - wl->event_mask = BSS_LOSS_EVENT_ID | - SCAN_COMPLETE_EVENT_ID | - RSSI_SNR_TRIGGER_0_EVENT_ID | - PERIODIC_SCAN_COMPLETE_EVENT_ID | - PERIODIC_SCAN_REPORT_EVENT_ID | - DUMMY_PACKET_EVENT_ID | - PEER_REMOVE_COMPLETE_EVENT_ID | - BA_SESSION_RX_CONSTRAINT_EVENT_ID | - REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID | - INACTIVE_STA_EVENT_ID | - MAX_TX_FAILURE_EVENT_ID | - CHANNEL_SWITCH_COMPLETE_EVENT_ID | - DFS_CHANNELS_CONFIG_COMPLETE_EVENT; - - ret = wlcore_boot_run_firmware(wl); - if (ret < 0) - goto out; - - ret = wl18xx_enable_interrupts(wl); - -out: - return ret; -} - -static int wl18xx_trigger_cmd(struct wl1271 *wl, int cmd_box_addr, - void *buf, size_t len) -{ - struct wl18xx_priv *priv = wl->priv; - - memcpy(priv->cmd_buf, buf, len); - memset(priv->cmd_buf + len, 0, WL18XX_CMD_MAX_SIZE - len); - - return wlcore_write(wl, cmd_box_addr, priv->cmd_buf, - WL18XX_CMD_MAX_SIZE, false); -} - -static int wl18xx_ack_event(struct wl1271 *wl) -{ - return wlcore_write_reg(wl, REG_INTERRUPT_TRIG, - WL18XX_INTR_TRIG_EVENT_ACK); -} - -static u32 wl18xx_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks) -{ - u32 blk_size = WL18XX_TX_HW_BLOCK_SIZE; - return (len + blk_size - 1) / blk_size + spare_blks; -} - -static void -wl18xx_set_tx_desc_blocks(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc, - u32 blks, u32 spare_blks) -{ - desc->wl18xx_mem.total_mem_blocks = blks; -} - -static void -wl18xx_set_tx_desc_data_len(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc, - struct sk_buff *skb) -{ - desc->length = cpu_to_le16(skb->len); - - /* if only the last frame is to be padded, we unset this bit on Tx */ - if (wl->quirks & WLCORE_QUIRK_TX_PAD_LAST_FRAME) - desc->wl18xx_mem.ctrl = WL18XX_TX_CTRL_NOT_PADDED; - else - desc->wl18xx_mem.ctrl = 0; - - wl1271_debug(DEBUG_TX, "tx_fill_hdr: hlid: %d " - "len: %d life: %d mem: %d", desc->hlid, - le16_to_cpu(desc->length), - le16_to_cpu(desc->life_time), - desc->wl18xx_mem.total_mem_blocks); -} - -static enum wl_rx_buf_align -wl18xx_get_rx_buf_align(struct wl1271 *wl, u32 rx_desc) -{ - if (rx_desc & RX_BUF_PADDED_PAYLOAD) - return WLCORE_RX_BUF_PADDED; - - return WLCORE_RX_BUF_ALIGNED; -} - -static u32 wl18xx_get_rx_packet_len(struct wl1271 *wl, void *rx_data, - u32 data_len) -{ - struct wl1271_rx_descriptor *desc = rx_data; - - /* invalid packet */ - if (data_len < sizeof(*desc)) - return 0; - - return data_len - sizeof(*desc); -} - -static void wl18xx_tx_immediate_completion(struct wl1271 *wl) -{ - wl18xx_tx_immediate_complete(wl); -} - -static int wl18xx_set_host_cfg_bitmap(struct wl1271 *wl, u32 extra_mem_blk) -{ - int ret; - u32 sdio_align_size = 0; - u32 host_cfg_bitmap = HOST_IF_CFG_RX_FIFO_ENABLE | - HOST_IF_CFG_ADD_RX_ALIGNMENT; - - /* Enable Tx SDIO padding */ - if (wl->quirks & WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN) { - host_cfg_bitmap |= HOST_IF_CFG_TX_PAD_TO_SDIO_BLK; - sdio_align_size = WL12XX_BUS_BLOCK_SIZE; - } - - /* Enable Rx SDIO padding */ - if (wl->quirks & WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN) { - host_cfg_bitmap |= HOST_IF_CFG_RX_PAD_TO_SDIO_BLK; - sdio_align_size = WL12XX_BUS_BLOCK_SIZE; - } - - ret = wl18xx_acx_host_if_cfg_bitmap(wl, host_cfg_bitmap, - sdio_align_size, extra_mem_blk, - WL18XX_HOST_IF_LEN_SIZE_FIELD); - if (ret < 0) - return ret; - - return 0; -} - -static int wl18xx_hw_init(struct wl1271 *wl) -{ - int ret; - struct wl18xx_priv *priv = wl->priv; - - /* (re)init private structures. Relevant on recovery as well. */ - priv->last_fw_rls_idx = 0; - priv->extra_spare_key_count = 0; - - /* set the default amount of spare blocks in the bitmap */ - ret = wl18xx_set_host_cfg_bitmap(wl, WL18XX_TX_HW_BLOCK_SPARE); - if (ret < 0) - return ret; - - if (checksum_param) { - ret = wl18xx_acx_set_checksum_state(wl); - if (ret != 0) - return ret; - } - - return ret; -} - -static void wl18xx_set_tx_desc_csum(struct wl1271 *wl, - struct wl1271_tx_hw_descr *desc, - struct sk_buff *skb) -{ - u32 ip_hdr_offset; - struct iphdr *ip_hdr; - - if (!checksum_param) { - desc->wl18xx_checksum_data = 0; - return; - } - - if (skb->ip_summed != CHECKSUM_PARTIAL) { - desc->wl18xx_checksum_data = 0; - return; - } - - ip_hdr_offset = skb_network_header(skb) - skb_mac_header(skb); - if (WARN_ON(ip_hdr_offset >= (1<<7))) { - desc->wl18xx_checksum_data = 0; - return; - } - - desc->wl18xx_checksum_data = ip_hdr_offset << 1; - - /* FW is interested only in the LSB of the protocol TCP=0 UDP=1 */ - ip_hdr = (void *)skb_network_header(skb); - desc->wl18xx_checksum_data |= (ip_hdr->protocol & 0x01); -} - -static void wl18xx_set_rx_csum(struct wl1271 *wl, - struct wl1271_rx_descriptor *desc, - struct sk_buff *skb) -{ - if (desc->status & WL18XX_RX_CHECKSUM_MASK) - skb->ip_summed = CHECKSUM_UNNECESSARY; -} - -static bool wl18xx_is_mimo_supported(struct wl1271 *wl) -{ - struct wl18xx_priv *priv = wl->priv; - - /* only support MIMO with multiple antennas, and when SISO - * is not forced through config - */ - return (priv->conf.phy.number_of_assembled_ant2_4 >= 2) && - (priv->conf.ht.mode != HT_MODE_WIDE) && - (priv->conf.ht.mode != HT_MODE_SISO20); -} - -/* - * TODO: instead of having these two functions to get the rate mask, - * we should modify the wlvif->rate_set instead - */ -static u32 wl18xx_sta_get_ap_rate_mask(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - u32 hw_rate_set = wlvif->rate_set; - - if (wlvif->channel_type == NL80211_CHAN_HT40MINUS || - wlvif->channel_type == NL80211_CHAN_HT40PLUS) { - wl1271_debug(DEBUG_ACX, "using wide channel rate mask"); - hw_rate_set |= CONF_TX_RATE_USE_WIDE_CHAN; - - /* we don't support MIMO in wide-channel mode */ - hw_rate_set &= ~CONF_TX_MIMO_RATES; - } else if (wl18xx_is_mimo_supported(wl)) { - wl1271_debug(DEBUG_ACX, "using MIMO channel rate mask"); - hw_rate_set |= CONF_TX_MIMO_RATES; - } - - return hw_rate_set; -} - -static u32 wl18xx_ap_get_mimo_wide_rate_mask(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - if (wlvif->channel_type == NL80211_CHAN_HT40MINUS || - wlvif->channel_type == NL80211_CHAN_HT40PLUS) { - wl1271_debug(DEBUG_ACX, "using wide channel rate mask"); - - /* sanity check - we don't support this */ - if (WARN_ON(wlvif->band != IEEE80211_BAND_5GHZ)) - return 0; - - return CONF_TX_RATE_USE_WIDE_CHAN; - } else if (wl18xx_is_mimo_supported(wl) && - wlvif->band == IEEE80211_BAND_2GHZ) { - wl1271_debug(DEBUG_ACX, "using MIMO rate mask"); - /* - * we don't care about HT channel here - if a peer doesn't - * support MIMO, we won't enable it in its rates - */ - return CONF_TX_MIMO_RATES; - } else { - return 0; - } -} - -static int wl18xx_get_pg_ver(struct wl1271 *wl, s8 *ver) -{ - u32 fuse; - s8 rom = 0, metal = 0, pg_ver = 0, rdl_ver = 0; - int ret; - - ret = wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); - if (ret < 0) - goto out; - - ret = wlcore_read32(wl, WL18XX_REG_FUSE_DATA_1_3, &fuse); - if (ret < 0) - goto out; - - pg_ver = (fuse & WL18XX_PG_VER_MASK) >> WL18XX_PG_VER_OFFSET; - rom = (fuse & WL18XX_ROM_VER_MASK) >> WL18XX_ROM_VER_OFFSET; - - if (rom <= 0xE) - metal = (fuse & WL18XX_METAL_VER_MASK) >> - WL18XX_METAL_VER_OFFSET; - else - metal = (fuse & WL18XX_NEW_METAL_VER_MASK) >> - WL18XX_NEW_METAL_VER_OFFSET; - - ret = wlcore_read32(wl, WL18XX_REG_FUSE_DATA_2_3, &fuse); - if (ret < 0) - goto out; - - rdl_ver = (fuse & WL18XX_RDL_VER_MASK) >> WL18XX_RDL_VER_OFFSET; - if (rdl_ver > RDL_MAX) - rdl_ver = RDL_NONE; - - wl1271_info("wl18xx HW: RDL %d, %s, PG %x.%x (ROM %x)", - rdl_ver, rdl_names[rdl_ver], pg_ver, metal, rom); - - if (ver) - *ver = pg_ver; - - ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); - -out: - return ret; -} - -#define WL18XX_CONF_FILE_NAME "ti-connectivity/wl18xx-conf.bin" -static int wl18xx_conf_init(struct wl1271 *wl, struct device *dev) -{ - struct wl18xx_priv *priv = wl->priv; - struct wlcore_conf_file *conf_file; - const struct firmware *fw; - int ret; - - ret = request_firmware(&fw, WL18XX_CONF_FILE_NAME, dev); - if (ret < 0) { - wl1271_error("could not get configuration binary %s: %d", - WL18XX_CONF_FILE_NAME, ret); - goto out_fallback; - } - - if (fw->size != WL18XX_CONF_SIZE) { - wl1271_error("configuration binary file size is wrong, expected %zu got %zu", - WL18XX_CONF_SIZE, fw->size); - ret = -EINVAL; - goto out; - } - - conf_file = (struct wlcore_conf_file *) fw->data; - - if (conf_file->header.magic != cpu_to_le32(WL18XX_CONF_MAGIC)) { - wl1271_error("configuration binary file magic number mismatch, " - "expected 0x%0x got 0x%0x", WL18XX_CONF_MAGIC, - conf_file->header.magic); - ret = -EINVAL; - goto out; - } - - if (conf_file->header.version != cpu_to_le32(WL18XX_CONF_VERSION)) { - wl1271_error("configuration binary file version not supported, " - "expected 0x%08x got 0x%08x", - WL18XX_CONF_VERSION, conf_file->header.version); - ret = -EINVAL; - goto out; - } - - memcpy(&wl->conf, &conf_file->core, sizeof(wl18xx_conf)); - memcpy(&priv->conf, &conf_file->priv, sizeof(priv->conf)); - - goto out; - -out_fallback: - wl1271_warning("falling back to default config"); - - /* apply driver default configuration */ - memcpy(&wl->conf, &wl18xx_conf, sizeof(wl18xx_conf)); - /* apply default private configuration */ - memcpy(&priv->conf, &wl18xx_default_priv_conf, sizeof(priv->conf)); - - /* For now we just fallback */ - return 0; - -out: - release_firmware(fw); - return ret; -} - -static int wl18xx_plt_init(struct wl1271 *wl) -{ - int ret; - - /* calibrator based auto/fem detect not supported for 18xx */ - if (wl->plt_mode == PLT_FEM_DETECT) { - wl1271_error("wl18xx_plt_init: PLT FEM_DETECT not supported"); - return -EINVAL; - } - - ret = wlcore_write32(wl, WL18XX_SCR_PAD8, WL18XX_SCR_PAD8_PLT); - if (ret < 0) - return ret; - - return wl->ops->boot(wl); -} - -static int wl18xx_get_mac(struct wl1271 *wl) -{ - u32 mac1, mac2; - int ret; - - ret = wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]); - if (ret < 0) - goto out; - - ret = wlcore_read32(wl, WL18XX_REG_FUSE_BD_ADDR_1, &mac1); - if (ret < 0) - goto out; - - ret = wlcore_read32(wl, WL18XX_REG_FUSE_BD_ADDR_2, &mac2); - if (ret < 0) - goto out; - - /* these are the two parts of the BD_ADDR */ - wl->fuse_oui_addr = ((mac2 & 0xffff) << 8) + - ((mac1 & 0xff000000) >> 24); - wl->fuse_nic_addr = (mac1 & 0xffffff); - - ret = wlcore_set_partition(wl, &wl->ptable[PART_DOWN]); - -out: - return ret; -} - -static int wl18xx_handle_static_data(struct wl1271 *wl, - struct wl1271_static_data *static_data) -{ - struct wl18xx_static_data_priv *static_data_priv = - (struct wl18xx_static_data_priv *) static_data->priv; - - strncpy(wl->chip.phy_fw_ver_str, static_data_priv->phy_version, - sizeof(wl->chip.phy_fw_ver_str)); - - /* make sure the string is NULL-terminated */ - wl->chip.phy_fw_ver_str[sizeof(wl->chip.phy_fw_ver_str) - 1] = '\0'; - - wl1271_info("PHY firmware version: %s", static_data_priv->phy_version); - - return 0; -} - -static int wl18xx_get_spare_blocks(struct wl1271 *wl, bool is_gem) -{ - struct wl18xx_priv *priv = wl->priv; - - /* If we have keys requiring extra spare, indulge them */ - if (priv->extra_spare_key_count) - return WL18XX_TX_HW_EXTRA_BLOCK_SPARE; - - return WL18XX_TX_HW_BLOCK_SPARE; -} - -static int wl18xx_set_key(struct wl1271 *wl, enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key_conf) -{ - struct wl18xx_priv *priv = wl->priv; - bool change_spare = false, special_enc; - int ret; - - wl1271_debug(DEBUG_CRYPT, "extra spare keys before: %d", - priv->extra_spare_key_count); - - special_enc = key_conf->cipher == WL1271_CIPHER_SUITE_GEM || - key_conf->cipher == WLAN_CIPHER_SUITE_TKIP; - - ret = wlcore_set_key(wl, cmd, vif, sta, key_conf); - if (ret < 0) - goto out; - - /* - * when adding the first or removing the last GEM/TKIP key, - * we have to adjust the number of spare blocks. - */ - if (special_enc) { - if (cmd == SET_KEY) { - /* first key */ - change_spare = (priv->extra_spare_key_count == 0); - priv->extra_spare_key_count++; - } else if (cmd == DISABLE_KEY) { - /* last key */ - change_spare = (priv->extra_spare_key_count == 1); - priv->extra_spare_key_count--; - } - } - - wl1271_debug(DEBUG_CRYPT, "extra spare keys after: %d", - priv->extra_spare_key_count); - - if (!change_spare) - goto out; - - /* key is now set, change the spare blocks */ - if (priv->extra_spare_key_count) - ret = wl18xx_set_host_cfg_bitmap(wl, - WL18XX_TX_HW_EXTRA_BLOCK_SPARE); - else - ret = wl18xx_set_host_cfg_bitmap(wl, - WL18XX_TX_HW_BLOCK_SPARE); - -out: - return ret; -} - -static u32 wl18xx_pre_pkt_send(struct wl1271 *wl, - u32 buf_offset, u32 last_len) -{ - if (wl->quirks & WLCORE_QUIRK_TX_PAD_LAST_FRAME) { - struct wl1271_tx_hw_descr *last_desc; - - /* get the last TX HW descriptor written to the aggr buf */ - last_desc = (struct wl1271_tx_hw_descr *)(wl->aggr_buf + - buf_offset - last_len); - - /* the last frame is padded up to an SDIO block */ - last_desc->wl18xx_mem.ctrl &= ~WL18XX_TX_CTRL_NOT_PADDED; - return ALIGN(buf_offset, WL12XX_BUS_BLOCK_SIZE); - } - - /* no modifications */ - return buf_offset; -} - -static void wl18xx_sta_rc_update(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct ieee80211_sta *sta, - u32 changed) -{ - bool wide = sta->bandwidth >= IEEE80211_STA_RX_BW_40; - - wl1271_debug(DEBUG_MAC80211, "mac80211 sta_rc_update wide %d", wide); - - if (!(changed & IEEE80211_RC_BW_CHANGED)) - return; - - mutex_lock(&wl->mutex); - - /* sanity */ - if (WARN_ON(wlvif->bss_type != BSS_TYPE_STA_BSS)) - goto out; - - /* ignore the change before association */ - if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) - goto out; - - /* - * If we started out as wide, we can change the operation mode. If we - * thought this was a 20mhz AP, we have to reconnect - */ - if (wlvif->sta.role_chan_type == NL80211_CHAN_HT40MINUS || - wlvif->sta.role_chan_type == NL80211_CHAN_HT40PLUS) - wl18xx_acx_peer_ht_operation_mode(wl, wlvif->sta.hlid, wide); - else - ieee80211_connection_loss(wl12xx_wlvif_to_vif(wlvif)); - -out: - mutex_unlock(&wl->mutex); -} - -static int wl18xx_set_peer_cap(struct wl1271 *wl, - struct ieee80211_sta_ht_cap *ht_cap, - bool allow_ht_operation, - u32 rate_set, u8 hlid) -{ - return wl18xx_acx_set_peer_cap(wl, ht_cap, allow_ht_operation, - rate_set, hlid); -} - -static bool wl18xx_lnk_high_prio(struct wl1271 *wl, u8 hlid, - struct wl1271_link *lnk) -{ - u8 thold; - struct wl18xx_fw_status_priv *status_priv = - (struct wl18xx_fw_status_priv *)wl->fw_status_2->priv; - u32 suspend_bitmap = le32_to_cpu(status_priv->link_suspend_bitmap); - - /* suspended links are never high priority */ - if (test_bit(hlid, (unsigned long *)&suspend_bitmap)) - return false; - - /* the priority thresholds are taken from FW */ - if (test_bit(hlid, (unsigned long *)&wl->fw_fast_lnk_map) && - !test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map)) - thold = status_priv->tx_fast_link_prio_threshold; - else - thold = status_priv->tx_slow_link_prio_threshold; - - return lnk->allocated_pkts < thold; -} - -static bool wl18xx_lnk_low_prio(struct wl1271 *wl, u8 hlid, - struct wl1271_link *lnk) -{ - u8 thold; - struct wl18xx_fw_status_priv *status_priv = - (struct wl18xx_fw_status_priv *)wl->fw_status_2->priv; - u32 suspend_bitmap = le32_to_cpu(status_priv->link_suspend_bitmap); - - if (test_bit(hlid, (unsigned long *)&suspend_bitmap)) - thold = status_priv->tx_suspend_threshold; - else if (test_bit(hlid, (unsigned long *)&wl->fw_fast_lnk_map) && - !test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map)) - thold = status_priv->tx_fast_stop_threshold; - else - thold = status_priv->tx_slow_stop_threshold; - - return lnk->allocated_pkts < thold; -} - -static int wl18xx_setup(struct wl1271 *wl); - -static struct wlcore_ops wl18xx_ops = { - .setup = wl18xx_setup, - .identify_chip = wl18xx_identify_chip, - .boot = wl18xx_boot, - .plt_init = wl18xx_plt_init, - .trigger_cmd = wl18xx_trigger_cmd, - .ack_event = wl18xx_ack_event, - .wait_for_event = wl18xx_wait_for_event, - .process_mailbox_events = wl18xx_process_mailbox_events, - .calc_tx_blocks = wl18xx_calc_tx_blocks, - .set_tx_desc_blocks = wl18xx_set_tx_desc_blocks, - .set_tx_desc_data_len = wl18xx_set_tx_desc_data_len, - .get_rx_buf_align = wl18xx_get_rx_buf_align, - .get_rx_packet_len = wl18xx_get_rx_packet_len, - .tx_immediate_compl = wl18xx_tx_immediate_completion, - .tx_delayed_compl = NULL, - .hw_init = wl18xx_hw_init, - .set_tx_desc_csum = wl18xx_set_tx_desc_csum, - .get_pg_ver = wl18xx_get_pg_ver, - .set_rx_csum = wl18xx_set_rx_csum, - .sta_get_ap_rate_mask = wl18xx_sta_get_ap_rate_mask, - .ap_get_mimo_wide_rate_mask = wl18xx_ap_get_mimo_wide_rate_mask, - .get_mac = wl18xx_get_mac, - .debugfs_init = wl18xx_debugfs_add_files, - .scan_start = wl18xx_scan_start, - .scan_stop = wl18xx_scan_stop, - .sched_scan_start = wl18xx_sched_scan_start, - .sched_scan_stop = wl18xx_scan_sched_scan_stop, - .handle_static_data = wl18xx_handle_static_data, - .get_spare_blocks = wl18xx_get_spare_blocks, - .set_key = wl18xx_set_key, - .channel_switch = wl18xx_cmd_channel_switch, - .pre_pkt_send = wl18xx_pre_pkt_send, - .sta_rc_update = wl18xx_sta_rc_update, - .set_peer_cap = wl18xx_set_peer_cap, - .lnk_high_prio = wl18xx_lnk_high_prio, - .lnk_low_prio = wl18xx_lnk_low_prio, -}; - -/* HT cap appropriate for wide channels in 2Ghz */ -static struct ieee80211_sta_ht_cap wl18xx_siso40_ht_cap_2ghz = { - .cap = IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40 | - IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_DSSSCCK40 | - IEEE80211_HT_CAP_GRN_FLD, - .ht_supported = true, - .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, - .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, - .mcs = { - .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, - .rx_highest = cpu_to_le16(150), - .tx_params = IEEE80211_HT_MCS_TX_DEFINED, - }, -}; - -/* HT cap appropriate for wide channels in 5Ghz */ -static struct ieee80211_sta_ht_cap wl18xx_siso40_ht_cap_5ghz = { - .cap = IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40 | - IEEE80211_HT_CAP_SUP_WIDTH_20_40 | - IEEE80211_HT_CAP_GRN_FLD, - .ht_supported = true, - .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, - .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, - .mcs = { - .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, - .rx_highest = cpu_to_le16(150), - .tx_params = IEEE80211_HT_MCS_TX_DEFINED, - }, -}; - -/* HT cap appropriate for SISO 20 */ -static struct ieee80211_sta_ht_cap wl18xx_siso20_ht_cap = { - .cap = IEEE80211_HT_CAP_SGI_20 | - IEEE80211_HT_CAP_GRN_FLD, - .ht_supported = true, - .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, - .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, - .mcs = { - .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, - .rx_highest = cpu_to_le16(72), - .tx_params = IEEE80211_HT_MCS_TX_DEFINED, - }, -}; - -/* HT cap appropriate for MIMO rates in 20mhz channel */ -static struct ieee80211_sta_ht_cap wl18xx_mimo_ht_cap_2ghz = { - .cap = IEEE80211_HT_CAP_SGI_20 | - IEEE80211_HT_CAP_GRN_FLD, - .ht_supported = true, - .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K, - .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, - .mcs = { - .rx_mask = { 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, }, - .rx_highest = cpu_to_le16(144), - .tx_params = IEEE80211_HT_MCS_TX_DEFINED, - }, -}; - -static int wl18xx_setup(struct wl1271 *wl) -{ - struct wl18xx_priv *priv = wl->priv; - int ret; - - wl->rtable = wl18xx_rtable; - wl->num_tx_desc = WL18XX_NUM_TX_DESCRIPTORS; - wl->num_rx_desc = WL18XX_NUM_RX_DESCRIPTORS; - wl->num_channels = 2; - wl->num_mac_addr = WL18XX_NUM_MAC_ADDRESSES; - wl->band_rate_to_idx = wl18xx_band_rate_to_idx; - wl->hw_tx_rate_tbl_size = WL18XX_CONF_HW_RXTX_RATE_MAX; - wl->hw_min_ht_rate = WL18XX_CONF_HW_RXTX_RATE_MCS0; - wl->fw_status_priv_len = sizeof(struct wl18xx_fw_status_priv); - wl->stats.fw_stats_len = sizeof(struct wl18xx_acx_statistics); - wl->static_data_priv_len = sizeof(struct wl18xx_static_data_priv); - - if (num_rx_desc_param != -1) - wl->num_rx_desc = num_rx_desc_param; - - ret = wl18xx_conf_init(wl, wl->dev); - if (ret < 0) - return ret; - - /* If the module param is set, update it in conf */ - if (board_type_param) { - if (!strcmp(board_type_param, "fpga")) { - priv->conf.phy.board_type = BOARD_TYPE_FPGA_18XX; - } else if (!strcmp(board_type_param, "hdk")) { - priv->conf.phy.board_type = BOARD_TYPE_HDK_18XX; - } else if (!strcmp(board_type_param, "dvp")) { - priv->conf.phy.board_type = BOARD_TYPE_DVP_18XX; - } else if (!strcmp(board_type_param, "evb")) { - priv->conf.phy.board_type = BOARD_TYPE_EVB_18XX; - } else if (!strcmp(board_type_param, "com8")) { - priv->conf.phy.board_type = BOARD_TYPE_COM8_18XX; - } else { - wl1271_error("invalid board type '%s'", - board_type_param); - return -EINVAL; - } - } - - if (priv->conf.phy.board_type >= NUM_BOARD_TYPES) { - wl1271_error("invalid board type '%d'", - priv->conf.phy.board_type); - return -EINVAL; - } - - if (low_band_component_param != -1) - priv->conf.phy.low_band_component = low_band_component_param; - if (low_band_component_type_param != -1) - priv->conf.phy.low_band_component_type = - low_band_component_type_param; - if (high_band_component_param != -1) - priv->conf.phy.high_band_component = high_band_component_param; - if (high_band_component_type_param != -1) - priv->conf.phy.high_band_component_type = - high_band_component_type_param; - if (pwr_limit_reference_11_abg_param != -1) - priv->conf.phy.pwr_limit_reference_11_abg = - pwr_limit_reference_11_abg_param; - if (n_antennas_2_param != -1) - priv->conf.phy.number_of_assembled_ant2_4 = n_antennas_2_param; - if (n_antennas_5_param != -1) - priv->conf.phy.number_of_assembled_ant5 = n_antennas_5_param; - if (dc2dc_param != -1) - priv->conf.phy.external_pa_dc2dc = dc2dc_param; - - if (ht_mode_param) { - if (!strcmp(ht_mode_param, "default")) - priv->conf.ht.mode = HT_MODE_DEFAULT; - else if (!strcmp(ht_mode_param, "wide")) - priv->conf.ht.mode = HT_MODE_WIDE; - else if (!strcmp(ht_mode_param, "siso20")) - priv->conf.ht.mode = HT_MODE_SISO20; - else { - wl1271_error("invalid ht_mode '%s'", ht_mode_param); - return -EINVAL; - } - } - - if (priv->conf.ht.mode == HT_MODE_DEFAULT) { - /* - * Only support mimo with multiple antennas. Fall back to - * siso40. - */ - if (wl18xx_is_mimo_supported(wl)) - wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ, - &wl18xx_mimo_ht_cap_2ghz); - else - wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ, - &wl18xx_siso40_ht_cap_2ghz); - - /* 5Ghz is always wide */ - wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ, - &wl18xx_siso40_ht_cap_5ghz); - } else if (priv->conf.ht.mode == HT_MODE_WIDE) { - wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ, - &wl18xx_siso40_ht_cap_2ghz); - wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ, - &wl18xx_siso40_ht_cap_5ghz); - } else if (priv->conf.ht.mode == HT_MODE_SISO20) { - wlcore_set_ht_cap(wl, IEEE80211_BAND_2GHZ, - &wl18xx_siso20_ht_cap); - wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ, - &wl18xx_siso20_ht_cap); - } - - if (!checksum_param) { - wl18xx_ops.set_rx_csum = NULL; - wl18xx_ops.init_vif = NULL; - } - - /* Enable 11a Band only if we have 5G antennas */ - wl->enable_11a = (priv->conf.phy.number_of_assembled_ant5 != 0); - - return 0; -} - -static int wl18xx_probe(struct platform_device *pdev) -{ - struct wl1271 *wl; - struct ieee80211_hw *hw; - int ret; - - hw = wlcore_alloc_hw(sizeof(struct wl18xx_priv), - WL18XX_AGGR_BUFFER_SIZE, - sizeof(struct wl18xx_event_mailbox)); - if (IS_ERR(hw)) { - wl1271_error("can't allocate hw"); - ret = PTR_ERR(hw); - goto out; - } - - wl = hw->priv; - wl->ops = &wl18xx_ops; - wl->ptable = wl18xx_ptable; - ret = wlcore_probe(wl, pdev); - if (ret) - goto out_free; - - return ret; - -out_free: - wlcore_free_hw(wl); -out: - return ret; -} - -static const struct platform_device_id wl18xx_id_table[] = { - { "wl18xx", 0 }, - { } /* Terminating Entry */ -}; -MODULE_DEVICE_TABLE(platform, wl18xx_id_table); - -static struct platform_driver wl18xx_driver = { - .probe = wl18xx_probe, - .remove = wlcore_remove, - .id_table = wl18xx_id_table, - .driver = { - .name = "wl18xx_driver", - .owner = THIS_MODULE, - } -}; - -module_platform_driver(wl18xx_driver); -module_param_named(ht_mode, ht_mode_param, charp, S_IRUSR); -MODULE_PARM_DESC(ht_mode, "Force HT mode: wide or siso20"); - -module_param_named(board_type, board_type_param, charp, S_IRUSR); -MODULE_PARM_DESC(board_type, "Board type: fpga, hdk (default), evb, com8 or " - "dvp"); - -module_param_named(checksum, checksum_param, bool, S_IRUSR); -MODULE_PARM_DESC(checksum, "Enable TCP checksum: boolean (defaults to false)"); - -module_param_named(dc2dc, dc2dc_param, int, S_IRUSR); -MODULE_PARM_DESC(dc2dc, "External DC2DC: u8 (defaults to 0)"); - -module_param_named(n_antennas_2, n_antennas_2_param, int, S_IRUSR); -MODULE_PARM_DESC(n_antennas_2, - "Number of installed 2.4GHz antennas: 1 (default) or 2"); - -module_param_named(n_antennas_5, n_antennas_5_param, int, S_IRUSR); -MODULE_PARM_DESC(n_antennas_5, - "Number of installed 5GHz antennas: 1 (default) or 2"); - -module_param_named(low_band_component, low_band_component_param, int, - S_IRUSR); -MODULE_PARM_DESC(low_band_component, "Low band component: u8 " - "(default is 0x01)"); - -module_param_named(low_band_component_type, low_band_component_type_param, - int, S_IRUSR); -MODULE_PARM_DESC(low_band_component_type, "Low band component type: u8 " - "(default is 0x05 or 0x06 depending on the board_type)"); - -module_param_named(high_band_component, high_band_component_param, int, - S_IRUSR); -MODULE_PARM_DESC(high_band_component, "High band component: u8, " - "(default is 0x01)"); - -module_param_named(high_band_component_type, high_band_component_type_param, - int, S_IRUSR); -MODULE_PARM_DESC(high_band_component_type, "High band component type: u8 " - "(default is 0x09)"); - -module_param_named(pwr_limit_reference_11_abg, - pwr_limit_reference_11_abg_param, int, S_IRUSR); -MODULE_PARM_DESC(pwr_limit_reference_11_abg, "Power limit reference: u8 " - "(default is 0xc8)"); - -module_param_named(num_rx_desc, - num_rx_desc_param, int, S_IRUSR); -MODULE_PARM_DESC(num_rx_desc_param, - "Number of Rx descriptors: u8 (default is 32)"); - -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Luciano Coelho "); -MODULE_FIRMWARE(WL18XX_FW_NAME); diff --git a/drivers/net/wireless/ti/wl18xx/reg.h b/drivers/net/wireless/ti/wl18xx/reg.h deleted file mode 100644 index 6306e04cd258..000000000000 --- a/drivers/net/wireless/ti/wl18xx/reg.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - * This file is part of wlcore - * - * Copyright (C) 2011 Texas Instruments Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __REG_H__ -#define __REG_H__ - -#define WL18XX_REGISTERS_BASE 0x00800000 -#define WL18XX_CODE_BASE 0x00000000 -#define WL18XX_DATA_BASE 0x00400000 -#define WL18XX_DOUBLE_BUFFER_BASE 0x00600000 -#define WL18XX_MCU_KEY_SEARCH_BASE 0x00700000 -#define WL18XX_PHY_BASE 0x00900000 -#define WL18XX_TOP_OCP_BASE 0x00A00000 -#define WL18XX_PACKET_RAM_BASE 0x00B00000 -#define WL18XX_HOST_BASE 0x00C00000 - -#define WL18XX_REGISTERS_DOWN_SIZE 0x0000B000 - -#define WL18XX_REG_BOOT_PART_START 0x00802000 -#define WL18XX_REG_BOOT_PART_SIZE 0x00014578 - -#define WL18XX_PHY_INIT_MEM_ADDR 0x80926000 - -#define WL18XX_SDIO_WSPI_BASE (WL18XX_REGISTERS_BASE) -#define WL18XX_REG_CONFIG_BASE (WL18XX_REGISTERS_BASE + 0x02000) -#define WL18XX_WGCM_REGS_BASE (WL18XX_REGISTERS_BASE + 0x03000) -#define WL18XX_ENC_BASE (WL18XX_REGISTERS_BASE + 0x04000) -#define WL18XX_INTERRUPT_BASE (WL18XX_REGISTERS_BASE + 0x05000) -#define WL18XX_UART_BASE (WL18XX_REGISTERS_BASE + 0x06000) -#define WL18XX_WELP_BASE (WL18XX_REGISTERS_BASE + 0x07000) -#define WL18XX_TCP_CKSM_BASE (WL18XX_REGISTERS_BASE + 0x08000) -#define WL18XX_FIFO_BASE (WL18XX_REGISTERS_BASE + 0x09000) -#define WL18XX_OCP_BRIDGE_BASE (WL18XX_REGISTERS_BASE + 0x0A000) -#define WL18XX_PMAC_RX_BASE (WL18XX_REGISTERS_BASE + 0x14800) -#define WL18XX_PMAC_ACM_BASE (WL18XX_REGISTERS_BASE + 0x14C00) -#define WL18XX_PMAC_TX_BASE (WL18XX_REGISTERS_BASE + 0x15000) -#define WL18XX_PMAC_CSR_BASE (WL18XX_REGISTERS_BASE + 0x15400) - -#define WL18XX_REG_ECPU_CONTROL (WL18XX_REGISTERS_BASE + 0x02004) -#define WL18XX_REG_INTERRUPT_NO_CLEAR (WL18XX_REGISTERS_BASE + 0x050E8) -#define WL18XX_REG_INTERRUPT_ACK (WL18XX_REGISTERS_BASE + 0x050F0) -#define WL18XX_REG_INTERRUPT_TRIG (WL18XX_REGISTERS_BASE + 0x5074) -#define WL18XX_REG_INTERRUPT_TRIG_H (WL18XX_REGISTERS_BASE + 0x5078) -#define WL18XX_REG_INTERRUPT_MASK (WL18XX_REGISTERS_BASE + 0x0050DC) - -#define WL18XX_REG_CHIP_ID_B (WL18XX_REGISTERS_BASE + 0x01542C) - -#define WL18XX_SLV_MEM_DATA (WL18XX_HOST_BASE + 0x0018) -#define WL18XX_SLV_REG_DATA (WL18XX_HOST_BASE + 0x0008) - -/* Scratch Pad registers*/ -#define WL18XX_SCR_PAD0 (WL18XX_REGISTERS_BASE + 0x0154EC) -#define WL18XX_SCR_PAD1 (WL18XX_REGISTERS_BASE + 0x0154F0) -#define WL18XX_SCR_PAD2 (WL18XX_REGISTERS_BASE + 0x0154F4) -#define WL18XX_SCR_PAD3 (WL18XX_REGISTERS_BASE + 0x0154F8) -#define WL18XX_SCR_PAD4 (WL18XX_REGISTERS_BASE + 0x0154FC) -#define WL18XX_SCR_PAD4_SET (WL18XX_REGISTERS_BASE + 0x015504) -#define WL18XX_SCR_PAD4_CLR (WL18XX_REGISTERS_BASE + 0x015500) -#define WL18XX_SCR_PAD5 (WL18XX_REGISTERS_BASE + 0x015508) -#define WL18XX_SCR_PAD5_SET (WL18XX_REGISTERS_BASE + 0x015510) -#define WL18XX_SCR_PAD5_CLR (WL18XX_REGISTERS_BASE + 0x01550C) -#define WL18XX_SCR_PAD6 (WL18XX_REGISTERS_BASE + 0x015514) -#define WL18XX_SCR_PAD7 (WL18XX_REGISTERS_BASE + 0x015518) -#define WL18XX_SCR_PAD8 (WL18XX_REGISTERS_BASE + 0x01551C) -#define WL18XX_SCR_PAD9 (WL18XX_REGISTERS_BASE + 0x015520) - -/* Spare registers*/ -#define WL18XX_SPARE_A1 (WL18XX_REGISTERS_BASE + 0x002194) -#define WL18XX_SPARE_A2 (WL18XX_REGISTERS_BASE + 0x002198) -#define WL18XX_SPARE_A3 (WL18XX_REGISTERS_BASE + 0x00219C) -#define WL18XX_SPARE_A4 (WL18XX_REGISTERS_BASE + 0x0021A0) -#define WL18XX_SPARE_A5 (WL18XX_REGISTERS_BASE + 0x0021A4) -#define WL18XX_SPARE_A6 (WL18XX_REGISTERS_BASE + 0x0021A8) -#define WL18XX_SPARE_A7 (WL18XX_REGISTERS_BASE + 0x0021AC) -#define WL18XX_SPARE_A8 (WL18XX_REGISTERS_BASE + 0x0021B0) -#define WL18XX_SPARE_B1 (WL18XX_REGISTERS_BASE + 0x015524) -#define WL18XX_SPARE_B2 (WL18XX_REGISTERS_BASE + 0x015528) -#define WL18XX_SPARE_B3 (WL18XX_REGISTERS_BASE + 0x01552C) -#define WL18XX_SPARE_B4 (WL18XX_REGISTERS_BASE + 0x015530) -#define WL18XX_SPARE_B5 (WL18XX_REGISTERS_BASE + 0x015534) -#define WL18XX_SPARE_B6 (WL18XX_REGISTERS_BASE + 0x015538) -#define WL18XX_SPARE_B7 (WL18XX_REGISTERS_BASE + 0x01553C) -#define WL18XX_SPARE_B8 (WL18XX_REGISTERS_BASE + 0x015540) - -#define WL18XX_REG_COMMAND_MAILBOX_PTR (WL18XX_SCR_PAD0) -#define WL18XX_REG_EVENT_MAILBOX_PTR (WL18XX_SCR_PAD1) -#define WL18XX_EEPROMLESS_IND (WL18XX_SCR_PAD4) - -#define WL18XX_WELP_ARM_COMMAND (WL18XX_REGISTERS_BASE + 0x7100) -#define WL18XX_ENABLE (WL18XX_REGISTERS_BASE + 0x01543C) - -/* PRCM registers */ -#define PLATFORM_DETECTION 0xA0E3E0 -#define OCS_EN 0xA02080 -#define PRIMARY_CLK_DETECT 0xA020A6 -#define PLLSH_WCS_PLL_N 0xA02362 -#define PLLSH_WCS_PLL_M 0xA02360 -#define PLLSH_WCS_PLL_Q_FACTOR_CFG_1 0xA02364 -#define PLLSH_WCS_PLL_Q_FACTOR_CFG_2 0xA02366 -#define PLLSH_WCS_PLL_P_FACTOR_CFG_1 0xA02368 -#define PLLSH_WCS_PLL_P_FACTOR_CFG_2 0xA0236A -#define PLLSH_WCS_PLL_SWALLOW_EN 0xA0236C -#define PLLSH_WL_PLL_EN 0xA02392 - -#define PLLSH_WCS_PLL_Q_FACTOR_CFG_1_MASK 0xFFFF -#define PLLSH_WCS_PLL_Q_FACTOR_CFG_2_MASK 0x007F -#define PLLSH_WCS_PLL_P_FACTOR_CFG_1_MASK 0xFFFF -#define PLLSH_WCS_PLL_P_FACTOR_CFG_2_MASK 0x000F - -#define PLLSH_WCS_PLL_SWALLOW_EN_VAL1 0x1 -#define PLLSH_WCS_PLL_SWALLOW_EN_VAL2 0x12 - -#define WL18XX_REG_FUSE_DATA_1_3 0xA0260C -#define WL18XX_PG_VER_MASK 0x70 -#define WL18XX_PG_VER_OFFSET 4 -#define WL18XX_ROM_VER_MASK 0x3 -#define WL18XX_ROM_VER_OFFSET 0 -#define WL18XX_METAL_VER_MASK 0xC -#define WL18XX_METAL_VER_OFFSET 2 -#define WL18XX_NEW_METAL_VER_MASK 0x180 -#define WL18XX_NEW_METAL_VER_OFFSET 7 - -#define WL18XX_REG_FUSE_DATA_2_3 0xA02614 -#define WL18XX_RDL_VER_MASK 0x1f00 -#define WL18XX_RDL_VER_OFFSET 8 - -#define WL18XX_REG_FUSE_BD_ADDR_1 0xA02602 -#define WL18XX_REG_FUSE_BD_ADDR_2 0xA02606 - -#define WL18XX_CMD_MBOX_ADDRESS 0xB007B4 - -#define WL18XX_FW_STATUS_ADDR 0x50F8 - -#define CHIP_ID_185x_PG10 (0x06030101) -#define CHIP_ID_185x_PG20 (0x06030111) - -/* - * Host Command Interrupt. Setting this bit masks - * the interrupt that the host issues to inform - * the FW that it has sent a command - * to the Wlan hardware Command Mailbox. - */ -#define WL18XX_INTR_TRIG_CMD BIT(28) - -/* - * Host Event Acknowlegde Interrupt. The host - * sets this bit to acknowledge that it received - * the unsolicited information from the event - * mailbox. - */ -#define WL18XX_INTR_TRIG_EVENT_ACK BIT(29) - -/* - * To boot the firmware in PLT mode we need to write this value in - * SCR_PAD8 before starting. - */ -#define WL18XX_SCR_PAD8_PLT 0xBABABEBE - -enum { - COMPONENT_NO_SWITCH = 0x0, - COMPONENT_2_WAY_SWITCH = 0x1, - COMPONENT_3_WAY_SWITCH = 0x2, - COMPONENT_MATCHING = 0x3, -}; - -enum { - FEM_NONE = 0x0, - FEM_VENDOR_1 = 0x1, - FEM_VENDOR_2 = 0x2, - FEM_VENDOR_3 = 0x3, -}; - -enum { - BOARD_TYPE_EVB_18XX = 0, - BOARD_TYPE_DVP_18XX = 1, - BOARD_TYPE_HDK_18XX = 2, - BOARD_TYPE_FPGA_18XX = 3, - BOARD_TYPE_COM8_18XX = 4, - - NUM_BOARD_TYPES, -}; - -enum { - RDL_NONE = 0, - RDL_1_HP = 1, - RDL_2_SP = 2, - RDL_3_HP = 3, - RDL_4_SP = 4, - - _RDL_LAST, - RDL_MAX = _RDL_LAST - 1, -}; - -static const char * const rdl_names[] = { - [RDL_NONE] = "", - [RDL_1_HP] = "1853 SISO", - [RDL_2_SP] = "1857 MIMO", - [RDL_3_HP] = "1893 SISO", - [RDL_4_SP] = "1897 MIMO", -}; - -#endif /* __REG_H__ */ diff --git a/drivers/net/wireless/ti/wl18xx/scan.c b/drivers/net/wireless/ti/wl18xx/scan.c deleted file mode 100644 index 2b642f8c9266..000000000000 --- a/drivers/net/wireless/ti/wl18xx/scan.c +++ /dev/null @@ -1,326 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2012 Texas Instruments. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include "scan.h" -#include "../wlcore/debug.h" - -static void wl18xx_adjust_channels(struct wl18xx_cmd_scan_params *cmd, - struct wlcore_scan_channels *cmd_channels) -{ - memcpy(cmd->passive, cmd_channels->passive, sizeof(cmd->passive)); - memcpy(cmd->active, cmd_channels->active, sizeof(cmd->active)); - cmd->dfs = cmd_channels->dfs; - cmd->passive_active = cmd_channels->passive_active; - - memcpy(cmd->channels_2, cmd_channels->channels_2, - sizeof(cmd->channels_2)); - memcpy(cmd->channels_5, cmd_channels->channels_5, - sizeof(cmd->channels_5)); - /* channels_4 are not supported, so no need to copy them */ -} - -static int wl18xx_scan_send(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct cfg80211_scan_request *req) -{ - struct wl18xx_cmd_scan_params *cmd; - struct wlcore_scan_channels *cmd_channels = NULL; - int ret; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->role_id = wlvif->role_id; - - if (WARN_ON(cmd->role_id == WL12XX_INVALID_ROLE_ID)) { - ret = -EINVAL; - goto out; - } - - cmd->scan_type = SCAN_TYPE_SEARCH; - cmd->rssi_threshold = -127; - cmd->snr_threshold = 0; - - cmd->bss_type = SCAN_BSS_TYPE_ANY; - - cmd->ssid_from_list = 0; - cmd->filter = 0; - cmd->add_broadcast = 0; - - cmd->urgency = 0; - cmd->protect = 0; - - cmd->n_probe_reqs = wl->conf.scan.num_probe_reqs; - cmd->terminate_after = 0; - - /* configure channels */ - WARN_ON(req->n_ssids > 1); - - cmd_channels = kzalloc(sizeof(*cmd_channels), GFP_KERNEL); - if (!cmd_channels) { - ret = -ENOMEM; - goto out; - } - - wlcore_set_scan_chan_params(wl, cmd_channels, req->channels, - req->n_channels, req->n_ssids, - SCAN_TYPE_SEARCH); - wl18xx_adjust_channels(cmd, cmd_channels); - - /* - * all the cycles params (except total cycles) should - * remain 0 for normal scan - */ - cmd->total_cycles = 1; - - if (req->no_cck) - cmd->rate = WL18XX_SCAN_RATE_6; - - cmd->tag = WL1271_SCAN_DEFAULT_TAG; - - if (req->n_ssids) { - cmd->ssid_len = req->ssids[0].ssid_len; - memcpy(cmd->ssid, req->ssids[0].ssid, cmd->ssid_len); - } - - /* TODO: per-band ies? */ - if (cmd->active[0]) { - u8 band = IEEE80211_BAND_2GHZ; - ret = wl12xx_cmd_build_probe_req(wl, wlvif, - cmd->role_id, band, - req->ssids ? req->ssids[0].ssid : NULL, - req->ssids ? req->ssids[0].ssid_len : 0, - req->ie, - req->ie_len, - false); - if (ret < 0) { - wl1271_error("2.4GHz PROBE request template failed"); - goto out; - } - } - - if (cmd->active[1] || cmd->dfs) { - u8 band = IEEE80211_BAND_5GHZ; - ret = wl12xx_cmd_build_probe_req(wl, wlvif, - cmd->role_id, band, - req->ssids ? req->ssids[0].ssid : NULL, - req->ssids ? req->ssids[0].ssid_len : 0, - req->ie, - req->ie_len, - false); - if (ret < 0) { - wl1271_error("5GHz PROBE request template failed"); - goto out; - } - } - - wl1271_dump(DEBUG_SCAN, "SCAN: ", cmd, sizeof(*cmd)); - - ret = wl1271_cmd_send(wl, CMD_SCAN, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("SCAN failed"); - goto out; - } - -out: - kfree(cmd_channels); - kfree(cmd); - return ret; -} - -void wl18xx_scan_completed(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - wl->scan.failed = false; - cancel_delayed_work(&wl->scan_complete_work); - ieee80211_queue_delayed_work(wl->hw, &wl->scan_complete_work, - msecs_to_jiffies(0)); -} - -static -int wl18xx_scan_sched_scan_config(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct cfg80211_sched_scan_request *req, - struct ieee80211_sched_scan_ies *ies) -{ - struct wl18xx_cmd_scan_params *cmd; - struct wlcore_scan_channels *cmd_channels = NULL; - struct conf_sched_scan_settings *c = &wl->conf.sched_scan; - int ret; - int filter_type; - - wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config"); - - filter_type = wlcore_scan_sched_scan_ssid_list(wl, wlvif, req); - if (filter_type < 0) - return filter_type; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->role_id = wlvif->role_id; - - if (WARN_ON(cmd->role_id == WL12XX_INVALID_ROLE_ID)) { - ret = -EINVAL; - goto out; - } - - cmd->scan_type = SCAN_TYPE_PERIODIC; - cmd->rssi_threshold = c->rssi_threshold; - cmd->snr_threshold = c->snr_threshold; - - /* don't filter on BSS type */ - cmd->bss_type = SCAN_BSS_TYPE_ANY; - - cmd->ssid_from_list = 1; - if (filter_type == SCAN_SSID_FILTER_LIST) - cmd->filter = 1; - cmd->add_broadcast = 0; - - cmd->urgency = 0; - cmd->protect = 0; - - cmd->n_probe_reqs = c->num_probe_reqs; - /* don't stop scanning automatically when something is found */ - cmd->terminate_after = 0; - - cmd_channels = kzalloc(sizeof(*cmd_channels), GFP_KERNEL); - if (!cmd_channels) { - ret = -ENOMEM; - goto out; - } - - /* configure channels */ - wlcore_set_scan_chan_params(wl, cmd_channels, req->channels, - req->n_channels, req->n_ssids, - SCAN_TYPE_PERIODIC); - wl18xx_adjust_channels(cmd, cmd_channels); - - cmd->short_cycles_sec = 0; - cmd->long_cycles_sec = cpu_to_le16(req->interval); - cmd->short_cycles_count = 0; - - cmd->total_cycles = 0; - - cmd->tag = WL1271_SCAN_DEFAULT_TAG; - - /* create a PERIODIC_SCAN_REPORT_EVENT whenever we've got a match */ - cmd->report_threshold = 1; - cmd->terminate_on_report = 0; - - if (cmd->active[0]) { - u8 band = IEEE80211_BAND_2GHZ; - ret = wl12xx_cmd_build_probe_req(wl, wlvif, - cmd->role_id, band, - req->ssids ? req->ssids[0].ssid : NULL, - req->ssids ? req->ssids[0].ssid_len : 0, - ies->ie[band], - ies->len[band], - true); - if (ret < 0) { - wl1271_error("2.4GHz PROBE request template failed"); - goto out; - } - } - - if (cmd->active[1] || cmd->dfs) { - u8 band = IEEE80211_BAND_5GHZ; - ret = wl12xx_cmd_build_probe_req(wl, wlvif, - cmd->role_id, band, - req->ssids ? req->ssids[0].ssid : NULL, - req->ssids ? req->ssids[0].ssid_len : 0, - ies->ie[band], - ies->len[band], - true); - if (ret < 0) { - wl1271_error("5GHz PROBE request template failed"); - goto out; - } - } - - wl1271_dump(DEBUG_SCAN, "SCAN: ", cmd, sizeof(*cmd)); - - ret = wl1271_cmd_send(wl, CMD_SCAN, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("SCAN failed"); - goto out; - } - -out: - kfree(cmd_channels); - kfree(cmd); - return ret; -} - -int wl18xx_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct cfg80211_sched_scan_request *req, - struct ieee80211_sched_scan_ies *ies) -{ - return wl18xx_scan_sched_scan_config(wl, wlvif, req, ies); -} - -static int __wl18xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 scan_type) -{ - struct wl18xx_cmd_scan_stop *stop; - int ret; - - wl1271_debug(DEBUG_CMD, "cmd periodic scan stop"); - - stop = kzalloc(sizeof(*stop), GFP_KERNEL); - if (!stop) { - wl1271_error("failed to alloc memory to send sched scan stop"); - return -ENOMEM; - } - - stop->role_id = wlvif->role_id; - stop->scan_type = scan_type; - - ret = wl1271_cmd_send(wl, CMD_STOP_SCAN, stop, sizeof(*stop), 0); - if (ret < 0) { - wl1271_error("failed to send sched scan stop command"); - goto out_free; - } - -out_free: - kfree(stop); - return ret; -} - -void wl18xx_scan_sched_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - __wl18xx_scan_stop(wl, wlvif, SCAN_TYPE_PERIODIC); -} -int wl18xx_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct cfg80211_scan_request *req) -{ - return wl18xx_scan_send(wl, wlvif, req); -} - -int wl18xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - return __wl18xx_scan_stop(wl, wlvif, SCAN_TYPE_SEARCH); -} diff --git a/drivers/net/wireless/ti/wl18xx/scan.h b/drivers/net/wireless/ti/wl18xx/scan.h deleted file mode 100644 index eadee42689d1..000000000000 --- a/drivers/net/wireless/ti/wl18xx/scan.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2012 Texas Instruments. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL18XX_SCAN_H__ -#define __WL18XX_SCAN_H__ - -#include "../wlcore/wlcore.h" -#include "../wlcore/cmd.h" -#include "../wlcore/scan.h" - -struct tracking_ch_params { - struct conn_scan_ch_params channel; - - __le32 bssid_lsb; - __le16 bssid_msb; - - u8 padding[2]; -} __packed; - -/* probe request rate */ -enum -{ - WL18XX_SCAN_RATE_1 = 0, - WL18XX_SCAN_RATE_5_5 = 1, - WL18XX_SCAN_RATE_6 = 2, -}; - -#define WL18XX_MAX_CHANNELS_5GHZ 32 - -struct wl18xx_cmd_scan_params { - struct wl1271_cmd_header header; - - u8 role_id; - u8 scan_type; - - s8 rssi_threshold; /* for filtering (in dBm) */ - s8 snr_threshold; /* for filtering (in dB) */ - - u8 bss_type; /* for filtering */ - u8 ssid_from_list; /* use ssid from configured ssid list */ - u8 filter; /* forward only results with matching ssids */ - - /* - * add broadcast ssid in addition to the configured ssids. - * the driver should add dummy entry for it (?). - */ - u8 add_broadcast; - - u8 urgency; - u8 protect; /* ??? */ - u8 n_probe_reqs; /* Number of probes requests per channel */ - u8 terminate_after; /* early terminate scan operation */ - - u8 passive[SCAN_MAX_BANDS]; /* number of passive scan channels */ - u8 active[SCAN_MAX_BANDS]; /* number of active scan channels */ - u8 dfs; /* number of dfs channels in 5ghz */ - u8 passive_active; /* number of passive before active channels 2.4ghz */ - - __le16 short_cycles_sec; - __le16 long_cycles_sec; - u8 short_cycles_count; - u8 total_cycles; /* 0 - infinite */ - u8 padding[2]; - - union { - struct { - struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ]; - struct conn_scan_ch_params channels_5[WL18XX_MAX_CHANNELS_5GHZ]; - struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ]; - }; - struct tracking_ch_params channels_tracking[WL1271_SCAN_MAX_CHANNELS]; - } ; - - u8 ssid[IEEE80211_MAX_SSID_LEN]; - u8 ssid_len; /* For SCAN_SSID_FILTER_SPECIFIC */ - u8 tag; - u8 rate; - - /* send SCAN_REPORT_EVENT in periodic scans after each cycle - * if number of results >= report_threshold. Must be 0 for - * non periodic scans - */ - u8 report_threshold; - - /* Should periodic scan stop after a report event was created. - * Must be 0 for non periodic scans. - */ - u8 terminate_on_report; - - u8 padding1[3]; -} __packed; - -struct wl18xx_cmd_scan_stop { - struct wl1271_cmd_header header; - - u8 role_id; - u8 scan_type; - u8 padding[2]; -} __packed; - -int wl18xx_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct cfg80211_scan_request *req); -int wl18xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif); -void wl18xx_scan_completed(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl18xx_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct cfg80211_sched_scan_request *req, - struct ieee80211_sched_scan_ies *ies); -void wl18xx_scan_sched_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif); -#endif diff --git a/drivers/net/wireless/ti/wl18xx/tx.c b/drivers/net/wireless/ti/wl18xx/tx.c deleted file mode 100644 index 57c694396647..000000000000 --- a/drivers/net/wireless/ti/wl18xx/tx.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2011 Texas Instruments Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "../wlcore/wlcore.h" -#include "../wlcore/cmd.h" -#include "../wlcore/debug.h" -#include "../wlcore/acx.h" -#include "../wlcore/tx.h" - -#include "wl18xx.h" -#include "tx.h" - -static -void wl18xx_get_last_tx_rate(struct wl1271 *wl, struct ieee80211_vif *vif, - struct ieee80211_tx_rate *rate) -{ - u8 fw_rate = wl->fw_status_2->counters.tx_last_rate; - - if (fw_rate > CONF_HW_RATE_INDEX_MAX) { - wl1271_error("last Tx rate invalid: %d", fw_rate); - rate->idx = 0; - rate->flags = 0; - return; - } - - if (fw_rate <= CONF_HW_RATE_INDEX_54MBPS) { - rate->idx = fw_rate; - rate->flags = 0; - } else { - rate->flags = IEEE80211_TX_RC_MCS; - rate->idx = fw_rate - CONF_HW_RATE_INDEX_MCS0; - - /* SGI modifier is counted as a separate rate */ - if (fw_rate >= CONF_HW_RATE_INDEX_MCS7_SGI) - (rate->idx)--; - if (fw_rate == CONF_HW_RATE_INDEX_MCS15_SGI) - (rate->idx)--; - - /* this also covers the 40Mhz SGI case (= MCS15) */ - if (fw_rate == CONF_HW_RATE_INDEX_MCS7_SGI || - fw_rate == CONF_HW_RATE_INDEX_MCS15_SGI) - rate->flags |= IEEE80211_TX_RC_SHORT_GI; - - if (fw_rate > CONF_HW_RATE_INDEX_MCS7_SGI && vif) { - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - if (wlvif->channel_type == NL80211_CHAN_HT40MINUS || - wlvif->channel_type == NL80211_CHAN_HT40PLUS) { - /* adjustment needed for range 0-7 */ - rate->idx -= 8; - rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; - } - } - } -} - -static void wl18xx_tx_complete_packet(struct wl1271 *wl, u8 tx_stat_byte) -{ - struct ieee80211_tx_info *info; - struct sk_buff *skb; - int id = tx_stat_byte & WL18XX_TX_STATUS_DESC_ID_MASK; - bool tx_success; - - /* check for id legality */ - if (unlikely(id >= wl->num_tx_desc || wl->tx_frames[id] == NULL)) { - wl1271_warning("illegal id in tx completion: %d", id); - return; - } - - /* a zero bit indicates Tx success */ - tx_success = !(tx_stat_byte & BIT(WL18XX_TX_STATUS_STAT_BIT_IDX)); - - skb = wl->tx_frames[id]; - info = IEEE80211_SKB_CB(skb); - - if (wl12xx_is_dummy_packet(wl, skb)) { - wl1271_free_tx_id(wl, id); - return; - } - - /* update the TX status info */ - if (tx_success && !(info->flags & IEEE80211_TX_CTL_NO_ACK)) - info->flags |= IEEE80211_TX_STAT_ACK; - /* - * first pass info->control.vif while it's valid, and then fill out - * the info->status structures - */ - wl18xx_get_last_tx_rate(wl, info->control.vif, &info->status.rates[0]); - - info->status.rates[0].count = 1; /* no data about retries */ - info->status.ack_signal = -1; - - if (!tx_success) - wl->stats.retry_count++; - - /* - * TODO: update sequence number for encryption? seems to be - * unsupported for now. needed for recovery with encryption. - */ - - /* remove private header from packet */ - skb_pull(skb, sizeof(struct wl1271_tx_hw_descr)); - - /* remove TKIP header space if present */ - if ((wl->quirks & WLCORE_QUIRK_TKIP_HEADER_SPACE) && - info->control.hw_key && - info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) { - int hdrlen = ieee80211_get_hdrlen_from_skb(skb); - memmove(skb->data + WL1271_EXTRA_SPACE_TKIP, skb->data, hdrlen); - skb_pull(skb, WL1271_EXTRA_SPACE_TKIP); - } - - wl1271_debug(DEBUG_TX, "tx status id %u skb 0x%p success %d", - id, skb, tx_success); - - /* return the packet to the stack */ - skb_queue_tail(&wl->deferred_tx_queue, skb); - queue_work(wl->freezable_wq, &wl->netstack_work); - wl1271_free_tx_id(wl, id); -} - -void wl18xx_tx_immediate_complete(struct wl1271 *wl) -{ - struct wl18xx_fw_status_priv *status_priv = - (struct wl18xx_fw_status_priv *)wl->fw_status_2->priv; - struct wl18xx_priv *priv = wl->priv; - u8 i; - - /* nothing to do here */ - if (priv->last_fw_rls_idx == status_priv->fw_release_idx) - return; - - /* freed Tx descriptors */ - wl1271_debug(DEBUG_TX, "last released desc = %d, current idx = %d", - priv->last_fw_rls_idx, status_priv->fw_release_idx); - - if (status_priv->fw_release_idx >= WL18XX_FW_MAX_TX_STATUS_DESC) { - wl1271_error("invalid desc release index %d", - status_priv->fw_release_idx); - WARN_ON(1); - return; - } - - for (i = priv->last_fw_rls_idx; - i != status_priv->fw_release_idx; - i = (i + 1) % WL18XX_FW_MAX_TX_STATUS_DESC) { - wl18xx_tx_complete_packet(wl, - status_priv->released_tx_desc[i]); - - wl->tx_results_count++; - } - - priv->last_fw_rls_idx = status_priv->fw_release_idx; -} diff --git a/drivers/net/wireless/ti/wl18xx/tx.h b/drivers/net/wireless/ti/wl18xx/tx.h deleted file mode 100644 index ccddc548e44a..000000000000 --- a/drivers/net/wireless/ti/wl18xx/tx.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2011 Texas Instruments. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL18XX_TX_H__ -#define __WL18XX_TX_H__ - -#include "../wlcore/wlcore.h" - -#define WL18XX_TX_HW_BLOCK_SPARE 1 -/* for special cases - namely, TKIP and GEM */ -#define WL18XX_TX_HW_EXTRA_BLOCK_SPARE 2 -#define WL18XX_TX_HW_BLOCK_SIZE 268 - -#define WL18XX_TX_STATUS_DESC_ID_MASK 0x7F -#define WL18XX_TX_STATUS_STAT_BIT_IDX 7 - -/* Indicates this TX HW frame is not padded to SDIO block size */ -#define WL18XX_TX_CTRL_NOT_PADDED BIT(7) - -/* - * The FW uses a special bit to indicate a wide channel should be used in - * the rate policy. - */ -#define CONF_TX_RATE_USE_WIDE_CHAN BIT(31) - -void wl18xx_tx_immediate_complete(struct wl1271 *wl); - -#endif /* __WL12XX_TX_H__ */ diff --git a/drivers/net/wireless/ti/wl18xx/wl18xx.h b/drivers/net/wireless/ti/wl18xx/wl18xx.h deleted file mode 100644 index 9204e07ee432..000000000000 --- a/drivers/net/wireless/ti/wl18xx/wl18xx.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * This file is part of wl18xx - * - * Copyright (C) 2011 Texas Instruments Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WL18XX_PRIV_H__ -#define __WL18XX_PRIV_H__ - -#include "conf.h" - -/* minimum FW required for driver */ -#define WL18XX_CHIP_VER 8 -#define WL18XX_IFTYPE_VER 5 -#define WL18XX_MAJOR_VER WLCORE_FW_VER_IGNORE -#define WL18XX_SUBTYPE_VER WLCORE_FW_VER_IGNORE -#define WL18XX_MINOR_VER 39 - -#define WL18XX_CMD_MAX_SIZE 740 - -#define WL18XX_AGGR_BUFFER_SIZE (13 * PAGE_SIZE) - -#define WL18XX_NUM_TX_DESCRIPTORS 32 -#define WL18XX_NUM_RX_DESCRIPTORS 32 - -#define WL18XX_NUM_MAC_ADDRESSES 3 - -#define WL18XX_RX_BA_MAX_SESSIONS 5 - -struct wl18xx_priv { - /* buffer for sending commands to FW */ - u8 cmd_buf[WL18XX_CMD_MAX_SIZE]; - - struct wl18xx_priv_conf conf; - - /* Index of last released Tx desc in FW */ - u8 last_fw_rls_idx; - - /* number of keys requiring extra spare mem-blocks */ - int extra_spare_key_count; -}; - -#define WL18XX_FW_MAX_TX_STATUS_DESC 33 - -struct wl18xx_fw_status_priv { - /* - * Index in released_tx_desc for first byte that holds - * released tx host desc - */ - u8 fw_release_idx; - - /* - * Array of host Tx descriptors, where fw_release_idx - * indicated the first released idx. - */ - u8 released_tx_desc[WL18XX_FW_MAX_TX_STATUS_DESC]; - - /* A bitmap representing the currently suspended links. The suspend - * is short lived, for multi-channel Tx requirements. - */ - __le32 link_suspend_bitmap; - - /* packet threshold for an "almost empty" AC, - * for Tx schedulng purposes - */ - u8 tx_ac_threshold; - - /* number of packets to queue up for a link in PS */ - u8 tx_ps_threshold; - - /* number of packet to queue up for a suspended link */ - u8 tx_suspend_threshold; - - /* Should have less than this number of packets in queue of a slow - * link to qualify as high priority link - */ - u8 tx_slow_link_prio_threshold; - - /* Should have less than this number of packets in queue of a fast - * link to qualify as high priority link - */ - u8 tx_fast_link_prio_threshold; - - /* Should have less than this number of packets in queue of a slow - * link before we stop queuing up packets for it. - */ - u8 tx_slow_stop_threshold; - - /* Should have less than this number of packets in queue of a fast - * link before we stop queuing up packets for it. - */ - u8 tx_fast_stop_threshold; - - u8 padding[3]; -}; - -#define WL18XX_PHY_VERSION_MAX_LEN 20 - -struct wl18xx_static_data_priv { - char phy_version[WL18XX_PHY_VERSION_MAX_LEN]; -}; - -struct wl18xx_clk_cfg { - u32 n; - u32 m; - u32 p; - u32 q; - bool swallow; -}; - -enum { - CLOCK_CONFIG_16_2_M = 1, - CLOCK_CONFIG_16_368_M, - CLOCK_CONFIG_16_8_M, - CLOCK_CONFIG_19_2_M, - CLOCK_CONFIG_26_M, - CLOCK_CONFIG_32_736_M, - CLOCK_CONFIG_33_6_M, - CLOCK_CONFIG_38_468_M, - CLOCK_CONFIG_52_M, - - NUM_CLOCK_CONFIGS, -}; - -#endif /* __WL18XX_PRIV_H__ */ diff --git a/drivers/net/wireless/ti/wlcore/Kconfig b/drivers/net/wireless/ti/wlcore/Kconfig deleted file mode 100644 index 2b832825c3d4..000000000000 --- a/drivers/net/wireless/ti/wlcore/Kconfig +++ /dev/null @@ -1,35 +0,0 @@ -config WLCORE - tristate "TI wlcore support" - depends on WL_TI && GENERIC_HARDIRQS && MAC80211 - select FW_LOADER - ---help--- - This module contains the main code for TI WLAN chips. It abstracts - hardware-specific differences among different chipset families. - Each chipset family needs to implement its own lower-level module - that will depend on this module for the common code. - - If you choose to build a module, it will be called wlcore. Say N if - unsure. - -config WLCORE_SPI - tristate "TI wlcore SPI support" - depends on WLCORE && SPI_MASTER - select CRC7 - ---help--- - This module adds support for the SPI interface of adapters using - TI WLAN chipsets. Select this if your platform is using - the SPI bus. - - If you choose to build a module, it'll be called wlcore_spi. - Say N if unsure. - -config WLCORE_SDIO - tristate "TI wlcore SDIO support" - depends on WLCORE && MMC - ---help--- - This module adds support for the SDIO interface of adapters using - TI WLAN chipsets. Select this if your platform is using - the SDIO bus. - - If you choose to build a module, it'll be called wlcore_sdio. - Say N if unsure. diff --git a/drivers/net/wireless/ti/wlcore/Makefile b/drivers/net/wireless/ti/wlcore/Makefile deleted file mode 100644 index b21398f6c3ec..000000000000 --- a/drivers/net/wireless/ti/wlcore/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -wlcore-objs = main.o cmd.o io.o event.o tx.o rx.o ps.o acx.o \ - boot.o init.o debugfs.o scan.o - -wlcore_spi-objs = spi.o -wlcore_sdio-objs = sdio.o - -wlcore-$(CONFIG_NL80211_TESTMODE) += testmode.o -obj-$(CONFIG_WLCORE) += wlcore.o -obj-$(CONFIG_WLCORE_SPI) += wlcore_spi.o -obj-$(CONFIG_WLCORE_SDIO) += wlcore_sdio.o - -ccflags-y += -D__CHECK_ENDIAN__ diff --git a/drivers/net/wireless/ti/wlcore/acx.c b/drivers/net/wireless/ti/wlcore/acx.c deleted file mode 100644 index 7a970cd9c555..000000000000 --- a/drivers/net/wireless/ti/wlcore/acx.c +++ /dev/null @@ -1,1848 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2008-2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "acx.h" - -#include -#include -#include -#include - -#include "wlcore.h" -#include "debug.h" -#include "wl12xx_80211.h" -#include "ps.h" -#include "hw_ops.h" - -int wl1271_acx_wake_up_conditions(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 wake_up_event, u8 listen_interval) -{ - struct acx_wake_up_condition *wake_up; - int ret; - - wl1271_debug(DEBUG_ACX, "acx wake up conditions (wake_up_event %d listen_interval %d)", - wake_up_event, listen_interval); - - wake_up = kzalloc(sizeof(*wake_up), GFP_KERNEL); - if (!wake_up) { - ret = -ENOMEM; - goto out; - } - - wake_up->role_id = wlvif->role_id; - wake_up->wake_up_event = wake_up_event; - wake_up->listen_interval = listen_interval; - - ret = wl1271_cmd_configure(wl, ACX_WAKE_UP_CONDITIONS, - wake_up, sizeof(*wake_up)); - if (ret < 0) { - wl1271_warning("could not set wake up conditions: %d", ret); - goto out; - } - -out: - kfree(wake_up); - return ret; -} - -int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth) -{ - struct acx_sleep_auth *auth; - int ret; - - wl1271_debug(DEBUG_ACX, "acx sleep auth %d", sleep_auth); - - auth = kzalloc(sizeof(*auth), GFP_KERNEL); - if (!auth) { - ret = -ENOMEM; - goto out; - } - - auth->sleep_auth = sleep_auth; - - ret = wl1271_cmd_configure(wl, ACX_SLEEP_AUTH, auth, sizeof(*auth)); - if (ret < 0) { - wl1271_error("could not configure sleep_auth to %d: %d", - sleep_auth, ret); - goto out; - } - - wl->sleep_auth = sleep_auth; -out: - kfree(auth); - return ret; -} -EXPORT_SYMBOL_GPL(wl1271_acx_sleep_auth); - -int wl1271_acx_tx_power(struct wl1271 *wl, struct wl12xx_vif *wlvif, - int power) -{ - struct acx_current_tx_power *acx; - int ret; - - wl1271_debug(DEBUG_ACX, "acx dot11_cur_tx_pwr %d", power); - - if (power < 0 || power > 25) - return -EINVAL; - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->role_id = wlvif->role_id; - acx->current_tx_power = power * 10; - - ret = wl1271_cmd_configure(wl, DOT11_CUR_TX_PWR, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("configure of tx power failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_feature_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct acx_feature_config *feature; - int ret; - - wl1271_debug(DEBUG_ACX, "acx feature cfg"); - - feature = kzalloc(sizeof(*feature), GFP_KERNEL); - if (!feature) { - ret = -ENOMEM; - goto out; - } - - /* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE are disabled */ - feature->role_id = wlvif->role_id; - feature->data_flow_options = 0; - feature->options = 0; - - ret = wl1271_cmd_configure(wl, ACX_FEATURE_CFG, - feature, sizeof(*feature)); - if (ret < 0) { - wl1271_error("Couldnt set HW encryption"); - goto out; - } - -out: - kfree(feature); - return ret; -} - -int wl1271_acx_mem_map(struct wl1271 *wl, struct acx_header *mem_map, - size_t len) -{ - int ret; - - wl1271_debug(DEBUG_ACX, "acx mem map"); - - ret = wl1271_cmd_interrogate(wl, ACX_MEM_MAP, mem_map, len); - if (ret < 0) - return ret; - - return 0; -} - -int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl) -{ - struct acx_rx_msdu_lifetime *acx; - int ret; - - wl1271_debug(DEBUG_ACX, "acx rx msdu life time"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->lifetime = cpu_to_le32(wl->conf.rx.rx_msdu_life_time); - ret = wl1271_cmd_configure(wl, DOT11_RX_MSDU_LIFE_TIME, - acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("failed to set rx msdu life time: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_slot(struct wl1271 *wl, struct wl12xx_vif *wlvif, - enum acx_slot_type slot_time) -{ - struct acx_slot *slot; - int ret; - - wl1271_debug(DEBUG_ACX, "acx slot"); - - slot = kzalloc(sizeof(*slot), GFP_KERNEL); - if (!slot) { - ret = -ENOMEM; - goto out; - } - - slot->role_id = wlvif->role_id; - slot->wone_index = STATION_WONE_INDEX; - slot->slot_time = slot_time; - - ret = wl1271_cmd_configure(wl, ACX_SLOT, slot, sizeof(*slot)); - if (ret < 0) { - wl1271_warning("failed to set slot time: %d", ret); - goto out; - } - -out: - kfree(slot); - return ret; -} - -int wl1271_acx_group_address_tbl(struct wl1271 *wl, struct wl12xx_vif *wlvif, - bool enable, void *mc_list, u32 mc_list_len) -{ - struct acx_dot11_grp_addr_tbl *acx; - int ret; - - wl1271_debug(DEBUG_ACX, "acx group address tbl"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - /* MAC filtering */ - acx->role_id = wlvif->role_id; - acx->enabled = enable; - acx->num_groups = mc_list_len; - memcpy(acx->mac_table, mc_list, mc_list_len * ETH_ALEN); - - ret = wl1271_cmd_configure(wl, DOT11_GROUP_ADDRESS_TBL, - acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("failed to set group addr table: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_service_period_timeout(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - struct acx_rx_timeout *rx_timeout; - int ret; - - rx_timeout = kzalloc(sizeof(*rx_timeout), GFP_KERNEL); - if (!rx_timeout) { - ret = -ENOMEM; - goto out; - } - - wl1271_debug(DEBUG_ACX, "acx service period timeout"); - - rx_timeout->role_id = wlvif->role_id; - rx_timeout->ps_poll_timeout = cpu_to_le16(wl->conf.rx.ps_poll_timeout); - rx_timeout->upsd_timeout = cpu_to_le16(wl->conf.rx.upsd_timeout); - - ret = wl1271_cmd_configure(wl, ACX_SERVICE_PERIOD_TIMEOUT, - rx_timeout, sizeof(*rx_timeout)); - if (ret < 0) { - wl1271_warning("failed to set service period timeout: %d", - ret); - goto out; - } - -out: - kfree(rx_timeout); - return ret; -} - -int wl1271_acx_rts_threshold(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u32 rts_threshold) -{ - struct acx_rts_threshold *rts; - int ret; - - /* - * If the RTS threshold is not configured or out of range, use the - * default value. - */ - if (rts_threshold > IEEE80211_MAX_RTS_THRESHOLD) - rts_threshold = wl->conf.rx.rts_threshold; - - wl1271_debug(DEBUG_ACX, "acx rts threshold: %d", rts_threshold); - - rts = kzalloc(sizeof(*rts), GFP_KERNEL); - if (!rts) { - ret = -ENOMEM; - goto out; - } - - rts->role_id = wlvif->role_id; - rts->threshold = cpu_to_le16((u16)rts_threshold); - - ret = wl1271_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts)); - if (ret < 0) { - wl1271_warning("failed to set rts threshold: %d", ret); - goto out; - } - -out: - kfree(rts); - return ret; -} - -int wl1271_acx_dco_itrim_params(struct wl1271 *wl) -{ - struct acx_dco_itrim_params *dco; - struct conf_itrim_settings *c = &wl->conf.itrim; - int ret; - - wl1271_debug(DEBUG_ACX, "acx dco itrim parameters"); - - dco = kzalloc(sizeof(*dco), GFP_KERNEL); - if (!dco) { - ret = -ENOMEM; - goto out; - } - - dco->enable = c->enable; - dco->timeout = cpu_to_le32(c->timeout); - - ret = wl1271_cmd_configure(wl, ACX_SET_DCO_ITRIM_PARAMS, - dco, sizeof(*dco)); - if (ret < 0) { - wl1271_warning("failed to set dco itrim parameters: %d", ret); - goto out; - } - -out: - kfree(dco); - return ret; -} - -int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, struct wl12xx_vif *wlvif, - bool enable_filter) -{ - struct acx_beacon_filter_option *beacon_filter = NULL; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx beacon filter opt"); - - if (enable_filter && - wl->conf.conn.bcn_filt_mode == CONF_BCN_FILT_MODE_DISABLED) - goto out; - - beacon_filter = kzalloc(sizeof(*beacon_filter), GFP_KERNEL); - if (!beacon_filter) { - ret = -ENOMEM; - goto out; - } - - beacon_filter->role_id = wlvif->role_id; - beacon_filter->enable = enable_filter; - - /* - * When set to zero, and the filter is enabled, beacons - * without the unicast TIM bit set are dropped. - */ - beacon_filter->max_num_beacons = 0; - - ret = wl1271_cmd_configure(wl, ACX_BEACON_FILTER_OPT, - beacon_filter, sizeof(*beacon_filter)); - if (ret < 0) { - wl1271_warning("failed to set beacon filter opt: %d", ret); - goto out; - } - -out: - kfree(beacon_filter); - return ret; -} - -int wl1271_acx_beacon_filter_table(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - struct acx_beacon_filter_ie_table *ie_table; - int i, idx = 0; - int ret; - bool vendor_spec = false; - - wl1271_debug(DEBUG_ACX, "acx beacon filter table"); - - ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL); - if (!ie_table) { - ret = -ENOMEM; - goto out; - } - - /* configure default beacon pass-through rules */ - ie_table->role_id = wlvif->role_id; - ie_table->num_ie = 0; - for (i = 0; i < wl->conf.conn.bcn_filt_ie_count; i++) { - struct conf_bcn_filt_rule *r = &(wl->conf.conn.bcn_filt_ie[i]); - ie_table->table[idx++] = r->ie; - ie_table->table[idx++] = r->rule; - - if (r->ie == WLAN_EID_VENDOR_SPECIFIC) { - /* only one vendor specific ie allowed */ - if (vendor_spec) - continue; - - /* for vendor specific rules configure the - additional fields */ - memcpy(&(ie_table->table[idx]), r->oui, - CONF_BCN_IE_OUI_LEN); - idx += CONF_BCN_IE_OUI_LEN; - ie_table->table[idx++] = r->type; - memcpy(&(ie_table->table[idx]), r->version, - CONF_BCN_IE_VER_LEN); - idx += CONF_BCN_IE_VER_LEN; - vendor_spec = true; - } - - ie_table->num_ie++; - } - - ret = wl1271_cmd_configure(wl, ACX_BEACON_FILTER_TABLE, - ie_table, sizeof(*ie_table)); - if (ret < 0) { - wl1271_warning("failed to set beacon filter table: %d", ret); - goto out; - } - -out: - kfree(ie_table); - return ret; -} - -#define ACX_CONN_MONIT_DISABLE_VALUE 0xffffffff - -int wl1271_acx_conn_monit_params(struct wl1271 *wl, struct wl12xx_vif *wlvif, - bool enable) -{ - struct acx_conn_monit_params *acx; - u32 threshold = ACX_CONN_MONIT_DISABLE_VALUE; - u32 timeout = ACX_CONN_MONIT_DISABLE_VALUE; - int ret; - - wl1271_debug(DEBUG_ACX, "acx connection monitor parameters: %s", - enable ? "enabled" : "disabled"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - if (enable) { - threshold = wl->conf.conn.synch_fail_thold; - timeout = wl->conf.conn.bss_lose_timeout; - } - - acx->role_id = wlvif->role_id; - acx->synch_fail_thold = cpu_to_le32(threshold); - acx->bss_lose_timeout = cpu_to_le32(timeout); - - ret = wl1271_cmd_configure(wl, ACX_CONN_MONIT_PARAMS, - acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("failed to set connection monitor " - "parameters: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - - -int wl1271_acx_sg_enable(struct wl1271 *wl, bool enable) -{ - struct acx_bt_wlan_coex *pta; - int ret; - - wl1271_debug(DEBUG_ACX, "acx sg enable"); - - pta = kzalloc(sizeof(*pta), GFP_KERNEL); - if (!pta) { - ret = -ENOMEM; - goto out; - } - - if (enable) - pta->enable = wl->conf.sg.state; - else - pta->enable = CONF_SG_DISABLE; - - ret = wl1271_cmd_configure(wl, ACX_SG_ENABLE, pta, sizeof(*pta)); - if (ret < 0) { - wl1271_warning("failed to set softgemini enable: %d", ret); - goto out; - } - -out: - kfree(pta); - return ret; -} - -int wl12xx_acx_sg_cfg(struct wl1271 *wl) -{ - struct acx_bt_wlan_coex_param *param; - struct conf_sg_settings *c = &wl->conf.sg; - int i, ret; - - wl1271_debug(DEBUG_ACX, "acx sg cfg"); - - param = kzalloc(sizeof(*param), GFP_KERNEL); - if (!param) { - ret = -ENOMEM; - goto out; - } - - /* BT-WLAN coext parameters */ - for (i = 0; i < CONF_SG_PARAMS_MAX; i++) - param->params[i] = cpu_to_le32(c->params[i]); - param->param_idx = CONF_SG_PARAMS_ALL; - - ret = wl1271_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param)); - if (ret < 0) { - wl1271_warning("failed to set sg config: %d", ret); - goto out; - } - -out: - kfree(param); - return ret; -} - -int wl1271_acx_cca_threshold(struct wl1271 *wl) -{ - struct acx_energy_detection *detection; - int ret; - - wl1271_debug(DEBUG_ACX, "acx cca threshold"); - - detection = kzalloc(sizeof(*detection), GFP_KERNEL); - if (!detection) { - ret = -ENOMEM; - goto out; - } - - detection->rx_cca_threshold = cpu_to_le16(wl->conf.rx.rx_cca_threshold); - detection->tx_energy_detection = wl->conf.tx.tx_energy_detection; - - ret = wl1271_cmd_configure(wl, ACX_CCA_THRESHOLD, - detection, sizeof(*detection)); - if (ret < 0) - wl1271_warning("failed to set cca threshold: %d", ret); - -out: - kfree(detection); - return ret; -} - -int wl1271_acx_bcn_dtim_options(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct acx_beacon_broadcast *bb; - int ret; - - wl1271_debug(DEBUG_ACX, "acx bcn dtim options"); - - bb = kzalloc(sizeof(*bb), GFP_KERNEL); - if (!bb) { - ret = -ENOMEM; - goto out; - } - - bb->role_id = wlvif->role_id; - bb->beacon_rx_timeout = cpu_to_le16(wl->conf.conn.beacon_rx_timeout); - bb->broadcast_timeout = cpu_to_le16(wl->conf.conn.broadcast_timeout); - bb->rx_broadcast_in_ps = wl->conf.conn.rx_broadcast_in_ps; - bb->ps_poll_threshold = wl->conf.conn.ps_poll_threshold; - - ret = wl1271_cmd_configure(wl, ACX_BCN_DTIM_OPTIONS, bb, sizeof(*bb)); - if (ret < 0) { - wl1271_warning("failed to set rx config: %d", ret); - goto out; - } - -out: - kfree(bb); - return ret; -} - -int wl1271_acx_aid(struct wl1271 *wl, struct wl12xx_vif *wlvif, u16 aid) -{ - struct acx_aid *acx_aid; - int ret; - - wl1271_debug(DEBUG_ACX, "acx aid"); - - acx_aid = kzalloc(sizeof(*acx_aid), GFP_KERNEL); - if (!acx_aid) { - ret = -ENOMEM; - goto out; - } - - acx_aid->role_id = wlvif->role_id; - acx_aid->aid = cpu_to_le16(aid); - - ret = wl1271_cmd_configure(wl, ACX_AID, acx_aid, sizeof(*acx_aid)); - if (ret < 0) { - wl1271_warning("failed to set aid: %d", ret); - goto out; - } - -out: - kfree(acx_aid); - return ret; -} - -int wl1271_acx_event_mbox_mask(struct wl1271 *wl, u32 event_mask) -{ - struct acx_event_mask *mask; - int ret; - - wl1271_debug(DEBUG_ACX, "acx event mbox mask"); - - mask = kzalloc(sizeof(*mask), GFP_KERNEL); - if (!mask) { - ret = -ENOMEM; - goto out; - } - - /* high event mask is unused */ - mask->high_event_mask = cpu_to_le32(0xffffffff); - mask->event_mask = cpu_to_le32(event_mask); - - ret = wl1271_cmd_configure(wl, ACX_EVENT_MBOX_MASK, - mask, sizeof(*mask)); - if (ret < 0) { - wl1271_warning("failed to set acx_event_mbox_mask: %d", ret); - goto out; - } - -out: - kfree(mask); - return ret; -} - -int wl1271_acx_set_preamble(struct wl1271 *wl, struct wl12xx_vif *wlvif, - enum acx_preamble_type preamble) -{ - struct acx_preamble *acx; - int ret; - - wl1271_debug(DEBUG_ACX, "acx_set_preamble"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->role_id = wlvif->role_id; - acx->preamble = preamble; - - ret = wl1271_cmd_configure(wl, ACX_PREAMBLE_TYPE, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("Setting of preamble failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_cts_protect(struct wl1271 *wl, struct wl12xx_vif *wlvif, - enum acx_ctsprotect_type ctsprotect) -{ - struct acx_ctsprotect *acx; - int ret; - - wl1271_debug(DEBUG_ACX, "acx_set_ctsprotect"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->role_id = wlvif->role_id; - acx->ctsprotect = ctsprotect; - - ret = wl1271_cmd_configure(wl, ACX_CTS_PROTECTION, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("Setting of ctsprotect failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_statistics(struct wl1271 *wl, void *stats) -{ - int ret; - - wl1271_debug(DEBUG_ACX, "acx statistics"); - - ret = wl1271_cmd_interrogate(wl, ACX_STATISTICS, stats, - wl->stats.fw_stats_len); - if (ret < 0) { - wl1271_warning("acx statistics failed: %d", ret); - return -ENOMEM; - } - - return 0; -} - -int wl1271_acx_sta_rate_policies(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct acx_rate_policy *acx; - struct conf_tx_rate_class *c = &wl->conf.tx.sta_rc_conf; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx rate policies"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - - if (!acx) { - ret = -ENOMEM; - goto out; - } - - wl1271_debug(DEBUG_ACX, "basic_rate: 0x%x, full_rate: 0x%x", - wlvif->basic_rate, wlvif->rate_set); - - /* configure one basic rate class */ - acx->rate_policy_idx = cpu_to_le32(wlvif->sta.basic_rate_idx); - acx->rate_policy.enabled_rates = cpu_to_le32(wlvif->basic_rate); - acx->rate_policy.short_retry_limit = c->short_retry_limit; - acx->rate_policy.long_retry_limit = c->long_retry_limit; - acx->rate_policy.aflags = c->aflags; - - ret = wl1271_cmd_configure(wl, ACX_RATE_POLICY, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("Setting of rate policies failed: %d", ret); - goto out; - } - - /* configure one AP supported rate class */ - acx->rate_policy_idx = cpu_to_le32(wlvif->sta.ap_rate_idx); - - /* the AP policy is HW specific */ - acx->rate_policy.enabled_rates = - cpu_to_le32(wlcore_hw_sta_get_ap_rate_mask(wl, wlvif)); - acx->rate_policy.short_retry_limit = c->short_retry_limit; - acx->rate_policy.long_retry_limit = c->long_retry_limit; - acx->rate_policy.aflags = c->aflags; - - ret = wl1271_cmd_configure(wl, ACX_RATE_POLICY, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("Setting of rate policies failed: %d", ret); - goto out; - } - - /* - * configure one rate class for basic p2p operations. - * (p2p packets should always go out with OFDM rates, even - * if we are currently connected to 11b AP) - */ - acx->rate_policy_idx = cpu_to_le32(wlvif->sta.p2p_rate_idx); - acx->rate_policy.enabled_rates = - cpu_to_le32(CONF_TX_RATE_MASK_BASIC_P2P); - acx->rate_policy.short_retry_limit = c->short_retry_limit; - acx->rate_policy.long_retry_limit = c->long_retry_limit; - acx->rate_policy.aflags = c->aflags; - - ret = wl1271_cmd_configure(wl, ACX_RATE_POLICY, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("Setting of rate policies failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_ap_rate_policy(struct wl1271 *wl, struct conf_tx_rate_class *c, - u8 idx) -{ - struct acx_rate_policy *acx; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx ap rate policy %d rates 0x%x", - idx, c->enabled_rates); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->rate_policy.enabled_rates = cpu_to_le32(c->enabled_rates); - acx->rate_policy.short_retry_limit = c->short_retry_limit; - acx->rate_policy.long_retry_limit = c->long_retry_limit; - acx->rate_policy.aflags = c->aflags; - - acx->rate_policy_idx = cpu_to_le32(idx); - - ret = wl1271_cmd_configure(wl, ACX_RATE_POLICY, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("Setting of ap rate policy failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_ac_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 ac, u8 cw_min, u16 cw_max, u8 aifsn, u16 txop) -{ - struct acx_ac_cfg *acx; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx ac cfg %d cw_ming %d cw_max %d " - "aifs %d txop %d", ac, cw_min, cw_max, aifsn, txop); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->role_id = wlvif->role_id; - acx->ac = ac; - acx->cw_min = cw_min; - acx->cw_max = cpu_to_le16(cw_max); - acx->aifsn = aifsn; - acx->tx_op_limit = cpu_to_le16(txop); - - ret = wl1271_cmd_configure(wl, ACX_AC_CFG, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx ac cfg failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_tid_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 queue_id, u8 channel_type, - u8 tsid, u8 ps_scheme, u8 ack_policy, - u32 apsd_conf0, u32 apsd_conf1) -{ - struct acx_tid_config *acx; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx tid config"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->role_id = wlvif->role_id; - acx->queue_id = queue_id; - acx->channel_type = channel_type; - acx->tsid = tsid; - acx->ps_scheme = ps_scheme; - acx->ack_policy = ack_policy; - acx->apsd_conf[0] = cpu_to_le32(apsd_conf0); - acx->apsd_conf[1] = cpu_to_le32(apsd_conf1); - - ret = wl1271_cmd_configure(wl, ACX_TID_CFG, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("Setting of tid config failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_frag_threshold(struct wl1271 *wl, u32 frag_threshold) -{ - struct acx_frag_threshold *acx; - int ret = 0; - - /* - * If the fragmentation is not configured or out of range, use the - * default value. - */ - if (frag_threshold > IEEE80211_MAX_FRAG_THRESHOLD) - frag_threshold = wl->conf.tx.frag_threshold; - - wl1271_debug(DEBUG_ACX, "acx frag threshold: %d", frag_threshold); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->frag_threshold = cpu_to_le16((u16)frag_threshold); - ret = wl1271_cmd_configure(wl, ACX_FRAG_CFG, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("Setting of frag threshold failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_tx_config_options(struct wl1271 *wl) -{ - struct acx_tx_config_options *acx; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx tx config options"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->tx_compl_timeout = cpu_to_le16(wl->conf.tx.tx_compl_timeout); - acx->tx_compl_threshold = cpu_to_le16(wl->conf.tx.tx_compl_threshold); - ret = wl1271_cmd_configure(wl, ACX_TX_CONFIG_OPT, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("Setting of tx options failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl12xx_acx_mem_cfg(struct wl1271 *wl) -{ - struct wl12xx_acx_config_memory *mem_conf; - struct conf_memory_settings *mem; - int ret; - - wl1271_debug(DEBUG_ACX, "wl1271 mem cfg"); - - mem_conf = kzalloc(sizeof(*mem_conf), GFP_KERNEL); - if (!mem_conf) { - ret = -ENOMEM; - goto out; - } - - mem = &wl->conf.mem; - - /* memory config */ - mem_conf->num_stations = mem->num_stations; - mem_conf->rx_mem_block_num = mem->rx_block_num; - mem_conf->tx_min_mem_block_num = mem->tx_min_block_num; - mem_conf->num_ssid_profiles = mem->ssid_profiles; - mem_conf->total_tx_descriptors = cpu_to_le32(wl->num_tx_desc); - mem_conf->dyn_mem_enable = mem->dynamic_memory; - mem_conf->tx_free_req = mem->min_req_tx_blocks; - mem_conf->rx_free_req = mem->min_req_rx_blocks; - mem_conf->tx_min = mem->tx_min; - mem_conf->fwlog_blocks = wl->conf.fwlog.mem_blocks; - - ret = wl1271_cmd_configure(wl, ACX_MEM_CFG, mem_conf, - sizeof(*mem_conf)); - if (ret < 0) { - wl1271_warning("wl1271 mem config failed: %d", ret); - goto out; - } - -out: - kfree(mem_conf); - return ret; -} -EXPORT_SYMBOL_GPL(wl12xx_acx_mem_cfg); - -int wl1271_acx_init_mem_config(struct wl1271 *wl) -{ - int ret; - - wl->target_mem_map = kzalloc(sizeof(struct wl1271_acx_mem_map), - GFP_KERNEL); - if (!wl->target_mem_map) { - wl1271_error("couldn't allocate target memory map"); - return -ENOMEM; - } - - /* we now ask for the firmware built memory map */ - ret = wl1271_acx_mem_map(wl, (void *)wl->target_mem_map, - sizeof(struct wl1271_acx_mem_map)); - if (ret < 0) { - wl1271_error("couldn't retrieve firmware memory map"); - kfree(wl->target_mem_map); - wl->target_mem_map = NULL; - return ret; - } - - /* initialize TX block book keeping */ - wl->tx_blocks_available = - le32_to_cpu(wl->target_mem_map->num_tx_mem_blocks); - wl1271_debug(DEBUG_TX, "available tx blocks: %d", - wl->tx_blocks_available); - - return 0; -} -EXPORT_SYMBOL_GPL(wl1271_acx_init_mem_config); - -int wl1271_acx_init_rx_interrupt(struct wl1271 *wl) -{ - struct wl1271_acx_rx_config_opt *rx_conf; - int ret; - - wl1271_debug(DEBUG_ACX, "wl1271 rx interrupt config"); - - rx_conf = kzalloc(sizeof(*rx_conf), GFP_KERNEL); - if (!rx_conf) { - ret = -ENOMEM; - goto out; - } - - rx_conf->threshold = cpu_to_le16(wl->conf.rx.irq_pkt_threshold); - rx_conf->timeout = cpu_to_le16(wl->conf.rx.irq_timeout); - rx_conf->mblk_threshold = cpu_to_le16(wl->conf.rx.irq_blk_threshold); - rx_conf->queue_type = wl->conf.rx.queue_type; - - ret = wl1271_cmd_configure(wl, ACX_RX_CONFIG_OPT, rx_conf, - sizeof(*rx_conf)); - if (ret < 0) { - wl1271_warning("wl1271 rx config opt failed: %d", ret); - goto out; - } - -out: - kfree(rx_conf); - return ret; -} - -int wl1271_acx_bet_enable(struct wl1271 *wl, struct wl12xx_vif *wlvif, - bool enable) -{ - struct wl1271_acx_bet_enable *acx = NULL; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx bet enable"); - - if (enable && wl->conf.conn.bet_enable == CONF_BET_MODE_DISABLE) - goto out; - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->role_id = wlvif->role_id; - acx->enable = enable ? CONF_BET_MODE_ENABLE : CONF_BET_MODE_DISABLE; - acx->max_consecutive = wl->conf.conn.bet_max_consecutive; - - ret = wl1271_cmd_configure(wl, ACX_BET_ENABLE, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx bet enable failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_arp_ip_filter(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 enable, __be32 address) -{ - struct wl1271_acx_arp_filter *acx; - int ret; - - wl1271_debug(DEBUG_ACX, "acx arp ip filter, enable: %d", enable); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->role_id = wlvif->role_id; - acx->version = ACX_IPV4_VERSION; - acx->enable = enable; - - if (enable) - memcpy(acx->address, &address, ACX_IPV4_ADDR_SIZE); - - ret = wl1271_cmd_configure(wl, ACX_ARP_IP_FILTER, - acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("failed to set arp ip filter: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_pm_config(struct wl1271 *wl) -{ - struct wl1271_acx_pm_config *acx = NULL; - struct conf_pm_config_settings *c = &wl->conf.pm_config; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx pm config"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->host_clk_settling_time = cpu_to_le32(c->host_clk_settling_time); - acx->host_fast_wakeup_support = c->host_fast_wakeup_support; - - ret = wl1271_cmd_configure(wl, ACX_PM_CONFIG, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx pm config failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} -EXPORT_SYMBOL_GPL(wl1271_acx_pm_config); - -int wl1271_acx_keep_alive_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif, - bool enable) -{ - struct wl1271_acx_keep_alive_mode *acx = NULL; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx keep alive mode: %d", enable); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->role_id = wlvif->role_id; - acx->enabled = enable; - - ret = wl1271_cmd_configure(wl, ACX_KEEP_ALIVE_MODE, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx keep alive mode failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_keep_alive_config(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 index, u8 tpl_valid) -{ - struct wl1271_acx_keep_alive_config *acx = NULL; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx keep alive config"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->role_id = wlvif->role_id; - acx->period = cpu_to_le32(wl->conf.conn.keep_alive_interval); - acx->index = index; - acx->tpl_validation = tpl_valid; - acx->trigger = ACX_KEEP_ALIVE_NO_TX; - - ret = wl1271_cmd_configure(wl, ACX_SET_KEEP_ALIVE_CONFIG, - acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx keep alive config failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_rssi_snr_trigger(struct wl1271 *wl, struct wl12xx_vif *wlvif, - bool enable, s16 thold, u8 hyst) -{ - struct wl1271_acx_rssi_snr_trigger *acx = NULL; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx rssi snr trigger"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - wlvif->last_rssi_event = -1; - - acx->role_id = wlvif->role_id; - acx->pacing = cpu_to_le16(wl->conf.roam_trigger.trigger_pacing); - acx->metric = WL1271_ACX_TRIG_METRIC_RSSI_BEACON; - acx->type = WL1271_ACX_TRIG_TYPE_EDGE; - if (enable) - acx->enable = WL1271_ACX_TRIG_ENABLE; - else - acx->enable = WL1271_ACX_TRIG_DISABLE; - - acx->index = WL1271_ACX_TRIG_IDX_RSSI; - acx->dir = WL1271_ACX_TRIG_DIR_BIDIR; - acx->threshold = cpu_to_le16(thold); - acx->hysteresis = hyst; - - ret = wl1271_cmd_configure(wl, ACX_RSSI_SNR_TRIGGER, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx rssi snr trigger setting failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_rssi_snr_avg_weights(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - struct wl1271_acx_rssi_snr_avg_weights *acx = NULL; - struct conf_roam_trigger_settings *c = &wl->conf.roam_trigger; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx rssi snr avg weights"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->role_id = wlvif->role_id; - acx->rssi_beacon = c->avg_weight_rssi_beacon; - acx->rssi_data = c->avg_weight_rssi_data; - acx->snr_beacon = c->avg_weight_snr_beacon; - acx->snr_data = c->avg_weight_snr_data; - - ret = wl1271_cmd_configure(wl, ACX_RSSI_SNR_WEIGHTS, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx rssi snr trigger weights failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_set_ht_capabilities(struct wl1271 *wl, - struct ieee80211_sta_ht_cap *ht_cap, - bool allow_ht_operation, u8 hlid) -{ - struct wl1271_acx_ht_capabilities *acx; - int ret = 0; - u32 ht_capabilites = 0; - - wl1271_debug(DEBUG_ACX, "acx ht capabilities setting " - "sta supp: %d sta cap: %d", ht_cap->ht_supported, - ht_cap->cap); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - if (allow_ht_operation && ht_cap->ht_supported) { - /* no need to translate capabilities - use the spec values */ - ht_capabilites = ht_cap->cap; - - /* - * this bit is not employed by the spec but only by FW to - * indicate peer HT support - */ - ht_capabilites |= WL12XX_HT_CAP_HT_OPERATION; - - /* get data from A-MPDU parameters field */ - acx->ampdu_max_length = ht_cap->ampdu_factor; - acx->ampdu_min_spacing = ht_cap->ampdu_density; - } - - acx->hlid = hlid; - acx->ht_capabilites = cpu_to_le32(ht_capabilites); - - ret = wl1271_cmd_configure(wl, ACX_PEER_HT_CAP, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx ht capabilities setting failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} -EXPORT_SYMBOL_GPL(wl1271_acx_set_ht_capabilities); - - -int wl1271_acx_set_ht_information(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - u16 ht_operation_mode) -{ - struct wl1271_acx_ht_information *acx; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx ht information setting"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->role_id = wlvif->role_id; - acx->ht_protection = - (u8)(ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION); - acx->rifs_mode = 0; - acx->gf_protection = - !!(ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); - acx->ht_tx_burst_limit = 0; - acx->dual_cts_protection = 0; - - ret = wl1271_cmd_configure(wl, ACX_HT_BSS_OPERATION, acx, sizeof(*acx)); - - if (ret < 0) { - wl1271_warning("acx ht information setting failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -/* Configure BA session initiator/receiver parameters setting in the FW. */ -int wl12xx_acx_set_ba_initiator_policy(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - struct wl1271_acx_ba_initiator_policy *acx; - int ret; - - wl1271_debug(DEBUG_ACX, "acx ba initiator policy"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - /* set for the current role */ - acx->role_id = wlvif->role_id; - acx->tid_bitmap = wl->conf.ht.tx_ba_tid_bitmap; - acx->win_size = wl->conf.ht.tx_ba_win_size; - acx->inactivity_timeout = wl->conf.ht.inactivity_timeout; - - ret = wl1271_cmd_configure(wl, - ACX_BA_SESSION_INIT_POLICY, - acx, - sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx ba initiator policy failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -/* setup BA session receiver setting in the FW. */ -int wl12xx_acx_set_ba_receiver_session(struct wl1271 *wl, u8 tid_index, - u16 ssn, bool enable, u8 peer_hlid) -{ - struct wl1271_acx_ba_receiver_setup *acx; - int ret; - - wl1271_debug(DEBUG_ACX, "acx ba receiver session setting"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->hlid = peer_hlid; - acx->tid = tid_index; - acx->enable = enable; - acx->win_size = wl->conf.ht.rx_ba_win_size; - acx->ssn = ssn; - - ret = wlcore_cmd_configure_failsafe(wl, ACX_BA_SESSION_RX_SETUP, acx, - sizeof(*acx), - BIT(CMD_STATUS_NO_RX_BA_SESSION)); - if (ret < 0) { - wl1271_warning("acx ba receiver session failed: %d", ret); - goto out; - } - - /* sometimes we can't start the session */ - if (ret == CMD_STATUS_NO_RX_BA_SESSION) { - wl1271_warning("no fw rx ba on tid %d", tid_index); - ret = -EBUSY; - goto out; - } - - ret = 0; -out: - kfree(acx); - return ret; -} - -int wl12xx_acx_tsf_info(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u64 *mactime) -{ - struct wl12xx_acx_fw_tsf_information *tsf_info; - int ret; - - tsf_info = kzalloc(sizeof(*tsf_info), GFP_KERNEL); - if (!tsf_info) { - ret = -ENOMEM; - goto out; - } - - tsf_info->role_id = wlvif->role_id; - - ret = wl1271_cmd_interrogate(wl, ACX_TSF_INFO, - tsf_info, sizeof(*tsf_info)); - if (ret < 0) { - wl1271_warning("acx tsf info interrogate failed"); - goto out; - } - - *mactime = le32_to_cpu(tsf_info->current_tsf_low) | - ((u64) le32_to_cpu(tsf_info->current_tsf_high) << 32); - -out: - kfree(tsf_info); - return ret; -} - -int wl1271_acx_ps_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif, - bool enable) -{ - struct wl1271_acx_ps_rx_streaming *rx_streaming; - u32 conf_queues, enable_queues; - int i, ret = 0; - - wl1271_debug(DEBUG_ACX, "acx ps rx streaming"); - - rx_streaming = kzalloc(sizeof(*rx_streaming), GFP_KERNEL); - if (!rx_streaming) { - ret = -ENOMEM; - goto out; - } - - conf_queues = wl->conf.rx_streaming.queues; - if (enable) - enable_queues = conf_queues; - else - enable_queues = 0; - - for (i = 0; i < 8; i++) { - /* - * Skip non-changed queues, to avoid redundant acxs. - * this check assumes conf.rx_streaming.queues can't - * be changed while rx_streaming is enabled. - */ - if (!(conf_queues & BIT(i))) - continue; - - rx_streaming->role_id = wlvif->role_id; - rx_streaming->tid = i; - rx_streaming->enable = enable_queues & BIT(i); - rx_streaming->period = wl->conf.rx_streaming.interval; - rx_streaming->timeout = wl->conf.rx_streaming.interval; - - ret = wl1271_cmd_configure(wl, ACX_PS_RX_STREAMING, - rx_streaming, - sizeof(*rx_streaming)); - if (ret < 0) { - wl1271_warning("acx ps rx streaming failed: %d", ret); - goto out; - } - } -out: - kfree(rx_streaming); - return ret; -} - -int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct wl1271_acx_ap_max_tx_retry *acx = NULL; - int ret; - - wl1271_debug(DEBUG_ACX, "acx ap max tx retry"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) - return -ENOMEM; - - acx->role_id = wlvif->role_id; - acx->max_tx_retry = cpu_to_le16(wl->conf.tx.max_tx_retries); - - ret = wl1271_cmd_configure(wl, ACX_MAX_TX_FAILURE, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx ap max tx retry failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl12xx_acx_config_ps(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct wl1271_acx_config_ps *config_ps; - int ret; - - wl1271_debug(DEBUG_ACX, "acx config ps"); - - config_ps = kzalloc(sizeof(*config_ps), GFP_KERNEL); - if (!config_ps) { - ret = -ENOMEM; - goto out; - } - - config_ps->exit_retries = wl->conf.conn.psm_exit_retries; - config_ps->enter_retries = wl->conf.conn.psm_entry_retries; - config_ps->null_data_rate = cpu_to_le32(wlvif->basic_rate); - - ret = wl1271_cmd_configure(wl, ACX_CONFIG_PS, config_ps, - sizeof(*config_ps)); - - if (ret < 0) { - wl1271_warning("acx config ps failed: %d", ret); - goto out; - } - -out: - kfree(config_ps); - return ret; -} - -int wl1271_acx_set_inconnection_sta(struct wl1271 *wl, u8 *addr) -{ - struct wl1271_acx_inconnection_sta *acx = NULL; - int ret; - - wl1271_debug(DEBUG_ACX, "acx set inconnaction sta %pM", addr); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) - return -ENOMEM; - - memcpy(acx->addr, addr, ETH_ALEN); - - ret = wl1271_cmd_configure(wl, ACX_UPDATE_INCONNECTION_STA_LIST, - acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx set inconnaction sta failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl1271_acx_fm_coex(struct wl1271 *wl) -{ - struct wl1271_acx_fm_coex *acx; - int ret; - - wl1271_debug(DEBUG_ACX, "acx fm coex setting"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->enable = wl->conf.fm_coex.enable; - acx->swallow_period = wl->conf.fm_coex.swallow_period; - acx->n_divider_fref_set_1 = wl->conf.fm_coex.n_divider_fref_set_1; - acx->n_divider_fref_set_2 = wl->conf.fm_coex.n_divider_fref_set_2; - acx->m_divider_fref_set_1 = - cpu_to_le16(wl->conf.fm_coex.m_divider_fref_set_1); - acx->m_divider_fref_set_2 = - cpu_to_le16(wl->conf.fm_coex.m_divider_fref_set_2); - acx->coex_pll_stabilization_time = - cpu_to_le32(wl->conf.fm_coex.coex_pll_stabilization_time); - acx->ldo_stabilization_time = - cpu_to_le16(wl->conf.fm_coex.ldo_stabilization_time); - acx->fm_disturbed_band_margin = - wl->conf.fm_coex.fm_disturbed_band_margin; - acx->swallow_clk_diff = wl->conf.fm_coex.swallow_clk_diff; - - ret = wl1271_cmd_configure(wl, ACX_FM_COEX_CFG, acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx fm coex setting failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl12xx_acx_set_rate_mgmt_params(struct wl1271 *wl) -{ - struct wl12xx_acx_set_rate_mgmt_params *acx = NULL; - struct conf_rate_policy_settings *conf = &wl->conf.rate; - int ret; - - wl1271_debug(DEBUG_ACX, "acx set rate mgmt params"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) - return -ENOMEM; - - acx->index = ACX_RATE_MGMT_ALL_PARAMS; - acx->rate_retry_score = cpu_to_le16(conf->rate_retry_score); - acx->per_add = cpu_to_le16(conf->per_add); - acx->per_th1 = cpu_to_le16(conf->per_th1); - acx->per_th2 = cpu_to_le16(conf->per_th2); - acx->max_per = cpu_to_le16(conf->max_per); - acx->inverse_curiosity_factor = conf->inverse_curiosity_factor; - acx->tx_fail_low_th = conf->tx_fail_low_th; - acx->tx_fail_high_th = conf->tx_fail_high_th; - acx->per_alpha_shift = conf->per_alpha_shift; - acx->per_add_shift = conf->per_add_shift; - acx->per_beta1_shift = conf->per_beta1_shift; - acx->per_beta2_shift = conf->per_beta2_shift; - acx->rate_check_up = conf->rate_check_up; - acx->rate_check_down = conf->rate_check_down; - memcpy(acx->rate_retry_policy, conf->rate_retry_policy, - sizeof(acx->rate_retry_policy)); - - ret = wl1271_cmd_configure(wl, ACX_SET_RATE_MGMT_PARAMS, - acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx set rate mgmt params failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -int wl12xx_acx_config_hangover(struct wl1271 *wl) -{ - struct wl12xx_acx_config_hangover *acx; - struct conf_hangover_settings *conf = &wl->conf.hangover; - int ret; - - wl1271_debug(DEBUG_ACX, "acx config hangover"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->recover_time = cpu_to_le32(conf->recover_time); - acx->hangover_period = conf->hangover_period; - acx->dynamic_mode = conf->dynamic_mode; - acx->early_termination_mode = conf->early_termination_mode; - acx->max_period = conf->max_period; - acx->min_period = conf->min_period; - acx->increase_delta = conf->increase_delta; - acx->decrease_delta = conf->decrease_delta; - acx->quiet_time = conf->quiet_time; - acx->increase_time = conf->increase_time; - acx->window_size = acx->window_size; - - ret = wl1271_cmd_configure(wl, ACX_CONFIG_HANGOVER, acx, - sizeof(*acx)); - - if (ret < 0) { - wl1271_warning("acx config hangover failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; - -} - -int wlcore_acx_average_rssi(struct wl1271 *wl, struct wl12xx_vif *wlvif, - s8 *avg_rssi) -{ - struct acx_roaming_stats *acx; - int ret = 0; - - wl1271_debug(DEBUG_ACX, "acx roaming statistics"); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) { - ret = -ENOMEM; - goto out; - } - - acx->role_id = wlvif->role_id; - ret = wl1271_cmd_interrogate(wl, ACX_ROAMING_STATISTICS_TBL, - acx, sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx roaming statistics failed: %d", ret); - ret = -ENOMEM; - goto out; - } - - *avg_rssi = acx->rssi_beacon; -out: - kfree(acx); - return ret; -} - -#ifdef CONFIG_PM -/* Set the global behaviour of RX filters - On/Off + default action */ -int wl1271_acx_default_rx_filter_enable(struct wl1271 *wl, bool enable, - enum rx_filter_action action) -{ - struct acx_default_rx_filter *acx; - int ret; - - wl1271_debug(DEBUG_ACX, "acx default rx filter en: %d act: %d", - enable, action); - - acx = kzalloc(sizeof(*acx), GFP_KERNEL); - if (!acx) - return -ENOMEM; - - acx->enable = enable; - acx->default_action = action; - - ret = wl1271_cmd_configure(wl, ACX_ENABLE_RX_DATA_FILTER, acx, - sizeof(*acx)); - if (ret < 0) { - wl1271_warning("acx default rx filter enable failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} - -/* Configure or disable a specific RX filter pattern */ -int wl1271_acx_set_rx_filter(struct wl1271 *wl, u8 index, bool enable, - struct wl12xx_rx_filter *filter) -{ - struct acx_rx_filter_cfg *acx; - int fields_size = 0; - int acx_size; - int ret; - - WARN_ON(enable && !filter); - WARN_ON(index >= WL1271_MAX_RX_FILTERS); - - wl1271_debug(DEBUG_ACX, - "acx set rx filter idx: %d enable: %d filter: %p", - index, enable, filter); - - if (enable) { - fields_size = wl1271_rx_filter_get_fields_size(filter); - - wl1271_debug(DEBUG_ACX, "act: %d num_fields: %d field_size: %d", - filter->action, filter->num_fields, fields_size); - } - - acx_size = ALIGN(sizeof(*acx) + fields_size, 4); - acx = kzalloc(acx_size, GFP_KERNEL); - - if (!acx) - return -ENOMEM; - - acx->enable = enable; - acx->index = index; - - if (enable) { - acx->num_fields = filter->num_fields; - acx->action = filter->action; - wl1271_rx_filter_flatten_fields(filter, acx->fields); - } - - wl1271_dump(DEBUG_ACX, "RX_FILTER: ", acx, acx_size); - - ret = wl1271_cmd_configure(wl, ACX_SET_RX_DATA_FILTER, acx, acx_size); - if (ret < 0) { - wl1271_warning("setting rx filter failed: %d", ret); - goto out; - } - -out: - kfree(acx); - return ret; -} -#endif /* CONFIG_PM */ diff --git a/drivers/net/wireless/ti/wlcore/acx.h b/drivers/net/wireless/ti/wlcore/acx.h deleted file mode 100644 index 6dcfad9b0472..000000000000 --- a/drivers/net/wireless/ti/wlcore/acx.h +++ /dev/null @@ -1,1134 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 1998-2009 Texas Instruments. All rights reserved. - * Copyright (C) 2008-2010 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __ACX_H__ -#define __ACX_H__ - -#include "wlcore.h" -#include "cmd.h" - -/************************************************************************* - - Host Interrupt Register (WiLink -> Host) - -**************************************************************************/ -/* HW Initiated interrupt Watchdog timer expiration */ -#define WL1271_ACX_INTR_WATCHDOG BIT(0) -/* Init sequence is done (masked interrupt, detection through polling only ) */ -#define WL1271_ACX_INTR_INIT_COMPLETE BIT(1) -/* Event was entered to Event MBOX #A*/ -#define WL1271_ACX_INTR_EVENT_A BIT(2) -/* Event was entered to Event MBOX #B*/ -#define WL1271_ACX_INTR_EVENT_B BIT(3) -/* Command processing completion*/ -#define WL1271_ACX_INTR_CMD_COMPLETE BIT(4) -/* Signaling the host on HW wakeup */ -#define WL1271_ACX_INTR_HW_AVAILABLE BIT(5) -/* The MISC bit is used for aggregation of RX, TxComplete and TX rate update */ -#define WL1271_ACX_INTR_DATA BIT(6) -/* Trace message on MBOX #A */ -#define WL1271_ACX_INTR_TRACE_A BIT(7) -/* Trace message on MBOX #B */ -#define WL1271_ACX_INTR_TRACE_B BIT(8) -/* SW FW Initiated interrupt Watchdog timer expiration */ -#define WL1271_ACX_SW_INTR_WATCHDOG BIT(9) - -#define WL1271_ACX_INTR_ALL 0xFFFFFFFF - -/* all possible interrupts - only appropriate ones will be masked in */ -#define WLCORE_ALL_INTR_MASK (WL1271_ACX_INTR_WATCHDOG | \ - WL1271_ACX_INTR_EVENT_A | \ - WL1271_ACX_INTR_EVENT_B | \ - WL1271_ACX_INTR_HW_AVAILABLE | \ - WL1271_ACX_INTR_DATA | \ - WL1271_ACX_SW_INTR_WATCHDOG) - -/* Target's information element */ -struct acx_header { - struct wl1271_cmd_header cmd; - - /* acx (or information element) header */ - __le16 id; - - /* payload length (not including headers */ - __le16 len; -} __packed; - -struct acx_error_counter { - struct acx_header header; - - /* The number of PLCP errors since the last time this */ - /* information element was interrogated. This field is */ - /* automatically cleared when it is interrogated.*/ - __le32 PLCP_error; - - /* The number of FCS errors since the last time this */ - /* information element was interrogated. This field is */ - /* automatically cleared when it is interrogated.*/ - __le32 FCS_error; - - /* The number of MPDUs without PLCP header errors received*/ - /* since the last time this information element was interrogated. */ - /* This field is automatically cleared when it is interrogated.*/ - __le32 valid_frame; - - /* the number of missed sequence numbers in the squentially */ - /* values of frames seq numbers */ - __le32 seq_num_miss; -} __packed; - -enum wl12xx_role { - WL1271_ROLE_STA = 0, - WL1271_ROLE_IBSS, - WL1271_ROLE_AP, - WL1271_ROLE_DEVICE, - WL1271_ROLE_P2P_CL, - WL1271_ROLE_P2P_GO, - - WL12XX_INVALID_ROLE_TYPE = 0xff -}; - -enum wl1271_psm_mode { - /* Active mode */ - WL1271_PSM_CAM = 0, - - /* Power save mode */ - WL1271_PSM_PS = 1, - - /* Extreme low power */ - WL1271_PSM_ELP = 2, - - WL1271_PSM_MAX = WL1271_PSM_ELP, - - /* illegal out of band value of PSM mode */ - WL1271_PSM_ILLEGAL = 0xff -}; - -struct acx_sleep_auth { - struct acx_header header; - - /* The sleep level authorization of the device. */ - /* 0 - Always active*/ - /* 1 - Power down mode: light / fast sleep*/ - /* 2 - ELP mode: Deep / Max sleep*/ - u8 sleep_auth; - u8 padding[3]; -} __packed; - -enum { - HOSTIF_PCI_MASTER_HOST_INDIRECT, - HOSTIF_PCI_MASTER_HOST_DIRECT, - HOSTIF_SLAVE, - HOSTIF_PKT_RING, - HOSTIF_DONTCARE = 0xFF -}; - -#define DEFAULT_UCAST_PRIORITY 0 -#define DEFAULT_RX_Q_PRIORITY 0 -#define DEFAULT_RXQ_PRIORITY 0 /* low 0 .. 15 high */ -#define DEFAULT_RXQ_TYPE 0x07 /* All frames, Data/Ctrl/Mgmt */ -#define TRACE_BUFFER_MAX_SIZE 256 - -#define DP_RX_PACKET_RING_CHUNK_SIZE 1600 -#define DP_TX_PACKET_RING_CHUNK_SIZE 1600 -#define DP_RX_PACKET_RING_CHUNK_NUM 2 -#define DP_TX_PACKET_RING_CHUNK_NUM 2 -#define DP_TX_COMPLETE_TIME_OUT 20 - -#define TX_MSDU_LIFETIME_MIN 0 -#define TX_MSDU_LIFETIME_MAX 3000 -#define TX_MSDU_LIFETIME_DEF 512 -#define RX_MSDU_LIFETIME_MIN 0 -#define RX_MSDU_LIFETIME_MAX 0xFFFFFFFF -#define RX_MSDU_LIFETIME_DEF 512000 - -struct acx_rx_msdu_lifetime { - struct acx_header header; - - /* - * The maximum amount of time, in TU, before the - * firmware discards the MSDU. - */ - __le32 lifetime; -} __packed; - -enum acx_slot_type { - SLOT_TIME_LONG = 0, - SLOT_TIME_SHORT = 1, - DEFAULT_SLOT_TIME = SLOT_TIME_SHORT, - MAX_SLOT_TIMES = 0xFF -}; - -#define STATION_WONE_INDEX 0 - -struct acx_slot { - struct acx_header header; - - u8 role_id; - u8 wone_index; /* Reserved */ - u8 slot_time; - u8 reserved[5]; -} __packed; - - -#define ACX_MC_ADDRESS_GROUP_MAX (8) -#define ADDRESS_GROUP_MAX_LEN (ETH_ALEN * ACX_MC_ADDRESS_GROUP_MAX) - -struct acx_dot11_grp_addr_tbl { - struct acx_header header; - - u8 role_id; - u8 enabled; - u8 num_groups; - u8 pad[1]; - u8 mac_table[ADDRESS_GROUP_MAX_LEN]; -} __packed; - -struct acx_rx_timeout { - struct acx_header header; - - u8 role_id; - u8 reserved; - __le16 ps_poll_timeout; - __le16 upsd_timeout; - u8 padding[2]; -} __packed; - -struct acx_rts_threshold { - struct acx_header header; - - u8 role_id; - u8 reserved; - __le16 threshold; -} __packed; - -struct acx_beacon_filter_option { - struct acx_header header; - - u8 role_id; - u8 enable; - /* - * The number of beacons without the unicast TIM - * bit set that the firmware buffers before - * signaling the host about ready frames. - * When set to 0 and the filter is enabled, beacons - * without the unicast TIM bit set are dropped. - */ - u8 max_num_beacons; - u8 pad[1]; -} __packed; - -/* - * ACXBeaconFilterEntry (not 221) - * Byte Offset Size (Bytes) Definition - * =========== ============ ========== - * 0 1 IE identifier - * 1 1 Treatment bit mask - * - * ACXBeaconFilterEntry (221) - * Byte Offset Size (Bytes) Definition - * =========== ============ ========== - * 0 1 IE identifier - * 1 1 Treatment bit mask - * 2 3 OUI - * 5 1 Type - * 6 2 Version - * - * - * Treatment bit mask - The information element handling: - * bit 0 - The information element is compared and transferred - * in case of change. - * bit 1 - The information element is transferred to the host - * with each appearance or disappearance. - * Note that both bits can be set at the same time. - */ -#define BEACON_FILTER_TABLE_MAX_IE_NUM (32) -#define BEACON_FILTER_TABLE_MAX_VENDOR_SPECIFIC_IE_NUM (6) -#define BEACON_FILTER_TABLE_IE_ENTRY_SIZE (2) -#define BEACON_FILTER_TABLE_EXTRA_VENDOR_SPECIFIC_IE_SIZE (6) -#define BEACON_FILTER_TABLE_MAX_SIZE ((BEACON_FILTER_TABLE_MAX_IE_NUM * \ - BEACON_FILTER_TABLE_IE_ENTRY_SIZE) + \ - (BEACON_FILTER_TABLE_MAX_VENDOR_SPECIFIC_IE_NUM * \ - BEACON_FILTER_TABLE_EXTRA_VENDOR_SPECIFIC_IE_SIZE)) - -struct acx_beacon_filter_ie_table { - struct acx_header header; - - u8 role_id; - u8 num_ie; - u8 pad[2]; - u8 table[BEACON_FILTER_TABLE_MAX_SIZE]; -} __packed; - -struct acx_conn_monit_params { - struct acx_header header; - - u8 role_id; - u8 padding[3]; - __le32 synch_fail_thold; /* number of beacons missed */ - __le32 bss_lose_timeout; /* number of TU's from synch fail */ -} __packed; - -struct acx_bt_wlan_coex { - struct acx_header header; - - u8 enable; - u8 pad[3]; -} __packed; - -struct acx_bt_wlan_coex_param { - struct acx_header header; - - __le32 params[CONF_SG_PARAMS_MAX]; - u8 param_idx; - u8 padding[3]; -} __packed; - -struct acx_dco_itrim_params { - struct acx_header header; - - u8 enable; - u8 padding[3]; - __le32 timeout; -} __packed; - -struct acx_energy_detection { - struct acx_header header; - - /* The RX Clear Channel Assessment threshold in the PHY */ - __le16 rx_cca_threshold; - u8 tx_energy_detection; - u8 pad; -} __packed; - -struct acx_beacon_broadcast { - struct acx_header header; - - u8 role_id; - /* Enables receiving of broadcast packets in PS mode */ - u8 rx_broadcast_in_ps; - - __le16 beacon_rx_timeout; - __le16 broadcast_timeout; - - /* Consecutive PS Poll failures before updating the host */ - u8 ps_poll_threshold; - u8 pad[1]; -} __packed; - -struct acx_event_mask { - struct acx_header header; - - __le32 event_mask; - __le32 high_event_mask; /* Unused */ -} __packed; - -#define SCAN_PASSIVE BIT(0) -#define SCAN_5GHZ_BAND BIT(1) -#define SCAN_TRIGGERED BIT(2) -#define SCAN_PRIORITY_HIGH BIT(3) - -/* When set, disable HW encryption */ -#define DF_ENCRYPTION_DISABLE 0x01 -#define DF_SNIFF_MODE_ENABLE 0x80 - -struct acx_feature_config { - struct acx_header header; - - u8 role_id; - u8 padding[3]; - __le32 options; - __le32 data_flow_options; -} __packed; - -struct acx_current_tx_power { - struct acx_header header; - - u8 role_id; - u8 current_tx_power; - u8 padding[2]; -} __packed; - -struct acx_wake_up_condition { - struct acx_header header; - - u8 role_id; - u8 wake_up_event; /* Only one bit can be set */ - u8 listen_interval; - u8 pad[1]; -} __packed; - -struct acx_aid { - struct acx_header header; - - /* - * To be set when associated with an AP. - */ - u8 role_id; - u8 reserved; - __le16 aid; -} __packed; - -enum acx_preamble_type { - ACX_PREAMBLE_LONG = 0, - ACX_PREAMBLE_SHORT = 1 -}; - -struct acx_preamble { - struct acx_header header; - - /* - * When set, the WiLink transmits the frames with a short preamble and - * when cleared, the WiLink transmits the frames with a long preamble. - */ - u8 role_id; - u8 preamble; - u8 padding[2]; -} __packed; - -enum acx_ctsprotect_type { - CTSPROTECT_DISABLE = 0, - CTSPROTECT_ENABLE = 1 -}; - -struct acx_ctsprotect { - struct acx_header header; - u8 role_id; - u8 ctsprotect; - u8 padding[2]; -} __packed; - -struct acx_rate_class { - __le32 enabled_rates; - u8 short_retry_limit; - u8 long_retry_limit; - u8 aflags; - u8 reserved; -}; - -struct acx_rate_policy { - struct acx_header header; - - __le32 rate_policy_idx; - struct acx_rate_class rate_policy; -} __packed; - -struct acx_ac_cfg { - struct acx_header header; - u8 role_id; - u8 ac; - u8 aifsn; - u8 cw_min; - __le16 cw_max; - __le16 tx_op_limit; -} __packed; - -struct acx_tid_config { - struct acx_header header; - u8 role_id; - u8 queue_id; - u8 channel_type; - u8 tsid; - u8 ps_scheme; - u8 ack_policy; - u8 padding[2]; - __le32 apsd_conf[2]; -} __packed; - -struct acx_frag_threshold { - struct acx_header header; - __le16 frag_threshold; - u8 padding[2]; -} __packed; - -struct acx_tx_config_options { - struct acx_header header; - __le16 tx_compl_timeout; /* msec */ - __le16 tx_compl_threshold; /* number of packets */ -} __packed; - -struct wl12xx_acx_config_memory { - struct acx_header header; - - u8 rx_mem_block_num; - u8 tx_min_mem_block_num; - u8 num_stations; - u8 num_ssid_profiles; - __le32 total_tx_descriptors; - u8 dyn_mem_enable; - u8 tx_free_req; - u8 rx_free_req; - u8 tx_min; - u8 fwlog_blocks; - u8 padding[3]; -} __packed; - -struct wl1271_acx_mem_map { - struct acx_header header; - - __le32 code_start; - __le32 code_end; - - __le32 wep_defkey_start; - __le32 wep_defkey_end; - - __le32 sta_table_start; - __le32 sta_table_end; - - __le32 packet_template_start; - __le32 packet_template_end; - - /* Address of the TX result interface (control block) */ - __le32 tx_result; - __le32 tx_result_queue_start; - - __le32 queue_memory_start; - __le32 queue_memory_end; - - __le32 packet_memory_pool_start; - __le32 packet_memory_pool_end; - - __le32 debug_buffer1_start; - __le32 debug_buffer1_end; - - __le32 debug_buffer2_start; - __le32 debug_buffer2_end; - - /* Number of blocks FW allocated for TX packets */ - __le32 num_tx_mem_blocks; - - /* Number of blocks FW allocated for RX packets */ - __le32 num_rx_mem_blocks; - - /* the following 4 fields are valid in SLAVE mode only */ - u8 *tx_cbuf; - u8 *rx_cbuf; - __le32 rx_ctrl; - __le32 tx_ctrl; -} __packed; - -struct wl1271_acx_rx_config_opt { - struct acx_header header; - - __le16 mblk_threshold; - __le16 threshold; - __le16 timeout; - u8 queue_type; - u8 reserved; -} __packed; - - -struct wl1271_acx_bet_enable { - struct acx_header header; - - u8 role_id; - u8 enable; - u8 max_consecutive; - u8 padding[1]; -} __packed; - -#define ACX_IPV4_VERSION 4 -#define ACX_IPV6_VERSION 6 -#define ACX_IPV4_ADDR_SIZE 4 - -/* bitmap of enabled arp_filter features */ -#define ACX_ARP_FILTER_ARP_FILTERING BIT(0) -#define ACX_ARP_FILTER_AUTO_ARP BIT(1) - -struct wl1271_acx_arp_filter { - struct acx_header header; - u8 role_id; - u8 version; /* ACX_IPV4_VERSION, ACX_IPV6_VERSION */ - u8 enable; /* bitmap of enabled ARP filtering features */ - u8 padding[1]; - u8 address[16]; /* The configured device IP address - all ARP - requests directed to this IP address will pass - through. For IPv4, the first four bytes are - used. */ -} __packed; - -struct wl1271_acx_pm_config { - struct acx_header header; - - __le32 host_clk_settling_time; - u8 host_fast_wakeup_support; - u8 padding[3]; -} __packed; - -struct wl1271_acx_keep_alive_mode { - struct acx_header header; - - u8 role_id; - u8 enabled; - u8 padding[2]; -} __packed; - -enum { - ACX_KEEP_ALIVE_NO_TX = 0, - ACX_KEEP_ALIVE_PERIOD_ONLY -}; - -enum { - ACX_KEEP_ALIVE_TPL_INVALID = 0, - ACX_KEEP_ALIVE_TPL_VALID -}; - -struct wl1271_acx_keep_alive_config { - struct acx_header header; - - u8 role_id; - u8 index; - u8 tpl_validation; - u8 trigger; - __le32 period; -} __packed; - -/* TODO: maybe this needs to be moved somewhere else? */ -#define HOST_IF_CFG_RX_FIFO_ENABLE BIT(0) -#define HOST_IF_CFG_TX_EXTRA_BLKS_SWAP BIT(1) -#define HOST_IF_CFG_TX_PAD_TO_SDIO_BLK BIT(3) -#define HOST_IF_CFG_RX_PAD_TO_SDIO_BLK BIT(4) -#define HOST_IF_CFG_ADD_RX_ALIGNMENT BIT(6) - -enum { - WL1271_ACX_TRIG_TYPE_LEVEL = 0, - WL1271_ACX_TRIG_TYPE_EDGE, -}; - -enum { - WL1271_ACX_TRIG_DIR_LOW = 0, - WL1271_ACX_TRIG_DIR_HIGH, - WL1271_ACX_TRIG_DIR_BIDIR, -}; - -enum { - WL1271_ACX_TRIG_ENABLE = 1, - WL1271_ACX_TRIG_DISABLE, -}; - -enum { - WL1271_ACX_TRIG_METRIC_RSSI_BEACON = 0, - WL1271_ACX_TRIG_METRIC_RSSI_DATA, - WL1271_ACX_TRIG_METRIC_SNR_BEACON, - WL1271_ACX_TRIG_METRIC_SNR_DATA, -}; - -enum { - WL1271_ACX_TRIG_IDX_RSSI = 0, - WL1271_ACX_TRIG_COUNT = 8, -}; - -struct wl1271_acx_rssi_snr_trigger { - struct acx_header header; - - u8 role_id; - u8 metric; - u8 type; - u8 dir; - __le16 threshold; - __le16 pacing; /* 0 - 60000 ms */ - u8 hysteresis; - u8 index; - u8 enable; - u8 padding[1]; -}; - -struct wl1271_acx_rssi_snr_avg_weights { - struct acx_header header; - - u8 role_id; - u8 padding[3]; - u8 rssi_beacon; - u8 rssi_data; - u8 snr_beacon; - u8 snr_data; -}; - - -/* special capability bit (not employed by the 802.11n spec) */ -#define WL12XX_HT_CAP_HT_OPERATION BIT(16) - -/* - * ACX_PEER_HT_CAP - * Configure HT capabilities - declare the capabilities of the peer - * we are connected to. - */ -struct wl1271_acx_ht_capabilities { - struct acx_header header; - - /* bitmask of capability bits supported by the peer */ - __le32 ht_capabilites; - - /* Indicates to which link these capabilities apply. */ - u8 hlid; - - /* - * This the maximum A-MPDU length supported by the AP. The FW may not - * exceed this length when sending A-MPDUs - */ - u8 ampdu_max_length; - - /* This is the minimal spacing required when sending A-MPDUs to the AP*/ - u8 ampdu_min_spacing; - - u8 padding; -} __packed; - -/* - * ACX_HT_BSS_OPERATION - * Configure HT capabilities - AP rules for behavior in the BSS. - */ -struct wl1271_acx_ht_information { - struct acx_header header; - - u8 role_id; - - /* Values: 0 - RIFS not allowed, 1 - RIFS allowed */ - u8 rifs_mode; - - /* Values: 0 - 3 like in spec */ - u8 ht_protection; - - /* Values: 0 - GF protection not required, 1 - GF protection required */ - u8 gf_protection; - - /*Values: 0 - TX Burst limit not required, 1 - TX Burst Limit required*/ - u8 ht_tx_burst_limit; - - /* - * Values: 0 - Dual CTS protection not required, - * 1 - Dual CTS Protection required - * Note: When this value is set to 1 FW will protect all TXOP with RTS - * frame and will not use CTS-to-self regardless of the value of the - * ACX_CTS_PROTECTION information element - */ - u8 dual_cts_protection; - - u8 padding[2]; -} __packed; - -struct wl1271_acx_ba_initiator_policy { - struct acx_header header; - - /* Specifies role Id, Range 0-7, 0xFF means ANY role. */ - u8 role_id; - - /* - * Per TID setting for allowing TX BA. Set a bit to 1 to allow - * TX BA sessions for the corresponding TID. - */ - u8 tid_bitmap; - - /* Windows size in number of packets */ - u8 win_size; - - u8 padding1[1]; - - /* As initiator inactivity timeout in time units(TU) of 1024us */ - u16 inactivity_timeout; - - u8 padding[2]; -} __packed; - -struct wl1271_acx_ba_receiver_setup { - struct acx_header header; - - /* Specifies link id, range 0-31 */ - u8 hlid; - - u8 tid; - - u8 enable; - - /* Windows size in number of packets */ - u8 win_size; - - /* BA session starting sequence number. RANGE 0-FFF */ - u16 ssn; - - u8 padding[2]; -} __packed; - -struct wl12xx_acx_fw_tsf_information { - struct acx_header header; - - u8 role_id; - u8 padding1[3]; - __le32 current_tsf_high; - __le32 current_tsf_low; - __le32 last_bttt_high; - __le32 last_tbtt_low; - u8 last_dtim_count; - u8 padding2[3]; -} __packed; - -struct wl1271_acx_ps_rx_streaming { - struct acx_header header; - - u8 role_id; - u8 tid; - u8 enable; - - /* interval between triggers (10-100 msec) */ - u8 period; - - /* timeout before first trigger (0-200 msec) */ - u8 timeout; - u8 padding[3]; -} __packed; - -struct wl1271_acx_ap_max_tx_retry { - struct acx_header header; - - u8 role_id; - u8 padding_1; - - /* - * the number of frames transmission failures before - * issuing the aging event. - */ - __le16 max_tx_retry; -} __packed; - -struct wl1271_acx_config_ps { - struct acx_header header; - - u8 exit_retries; - u8 enter_retries; - u8 padding[2]; - __le32 null_data_rate; -} __packed; - -struct wl1271_acx_inconnection_sta { - struct acx_header header; - - u8 addr[ETH_ALEN]; - u8 padding1[2]; -} __packed; - -/* - * ACX_FM_COEX_CFG - * set the FM co-existence parameters. - */ -struct wl1271_acx_fm_coex { - struct acx_header header; - /* enable(1) / disable(0) the FM Coex feature */ - u8 enable; - /* - * Swallow period used in COEX PLL swallowing mechanism. - * 0xFF = use FW default - */ - u8 swallow_period; - /* - * The N divider used in COEX PLL swallowing mechanism for Fref of - * 38.4/19.2 Mhz. 0xFF = use FW default - */ - u8 n_divider_fref_set_1; - /* - * The N divider used in COEX PLL swallowing mechanism for Fref of - * 26/52 Mhz. 0xFF = use FW default - */ - u8 n_divider_fref_set_2; - /* - * The M divider used in COEX PLL swallowing mechanism for Fref of - * 38.4/19.2 Mhz. 0xFFFF = use FW default - */ - __le16 m_divider_fref_set_1; - /* - * The M divider used in COEX PLL swallowing mechanism for Fref of - * 26/52 Mhz. 0xFFFF = use FW default - */ - __le16 m_divider_fref_set_2; - /* - * The time duration in uSec required for COEX PLL to stabilize. - * 0xFFFFFFFF = use FW default - */ - __le32 coex_pll_stabilization_time; - /* - * The time duration in uSec required for LDO to stabilize. - * 0xFFFFFFFF = use FW default - */ - __le16 ldo_stabilization_time; - /* - * The disturbed frequency band margin around the disturbed frequency - * center (single sided). - * For example, if 2 is configured, the following channels will be - * considered disturbed channel: - * 80 +- 0.1 MHz, 91 +- 0.1 MHz, 98 +- 0.1 MHz, 102 +- 0.1 MH - * 0xFF = use FW default - */ - u8 fm_disturbed_band_margin; - /* - * The swallow clock difference of the swallowing mechanism. - * 0xFF = use FW default - */ - u8 swallow_clk_diff; -} __packed; - -#define ACX_RATE_MGMT_ALL_PARAMS 0xff -struct wl12xx_acx_set_rate_mgmt_params { - struct acx_header header; - - u8 index; /* 0xff to configure all params */ - u8 padding1; - __le16 rate_retry_score; - __le16 per_add; - __le16 per_th1; - __le16 per_th2; - __le16 max_per; - u8 inverse_curiosity_factor; - u8 tx_fail_low_th; - u8 tx_fail_high_th; - u8 per_alpha_shift; - u8 per_add_shift; - u8 per_beta1_shift; - u8 per_beta2_shift; - u8 rate_check_up; - u8 rate_check_down; - u8 rate_retry_policy[ACX_RATE_MGMT_NUM_OF_RATES]; - u8 padding2[2]; -} __packed; - -struct wl12xx_acx_config_hangover { - struct acx_header header; - - __le32 recover_time; - u8 hangover_period; - u8 dynamic_mode; - u8 early_termination_mode; - u8 max_period; - u8 min_period; - u8 increase_delta; - u8 decrease_delta; - u8 quiet_time; - u8 increase_time; - u8 window_size; - u8 padding[2]; -} __packed; - - -struct acx_default_rx_filter { - struct acx_header header; - u8 enable; - - /* action of type FILTER_XXX */ - u8 default_action; - - u8 pad[2]; -} __packed; - - -struct acx_rx_filter_cfg { - struct acx_header header; - - u8 enable; - - /* 0 - WL1271_MAX_RX_FILTERS-1 */ - u8 index; - - u8 action; - - u8 num_fields; - u8 fields[0]; -} __packed; - -struct acx_roaming_stats { - struct acx_header header; - - u8 role_id; - u8 pad[3]; - u32 missed_beacons; - u8 snr_data; - u8 snr_bacon; - s8 rssi_data; - s8 rssi_beacon; -} __packed; - -enum { - ACX_WAKE_UP_CONDITIONS = 0x0000, - ACX_MEM_CFG = 0x0001, - ACX_SLOT = 0x0002, - ACX_AC_CFG = 0x0003, - ACX_MEM_MAP = 0x0004, - ACX_AID = 0x0005, - ACX_MEDIUM_USAGE = 0x0006, - ACX_STATISTICS = 0x0007, - ACX_PWR_CONSUMPTION_STATISTICS = 0x0008, - ACX_TID_CFG = 0x0009, - ACX_PS_RX_STREAMING = 0x000A, - ACX_BEACON_FILTER_OPT = 0x000B, - ACX_NOISE_HIST = 0x000C, - ACX_HDK_VERSION = 0x000D, - ACX_PD_THRESHOLD = 0x000E, - ACX_TX_CONFIG_OPT = 0x000F, - ACX_CCA_THRESHOLD = 0x0010, - ACX_EVENT_MBOX_MASK = 0x0011, - ACX_CONN_MONIT_PARAMS = 0x0012, - ACX_DISABLE_BROADCASTS = 0x0013, - ACX_BCN_DTIM_OPTIONS = 0x0014, - ACX_SG_ENABLE = 0x0015, - ACX_SG_CFG = 0x0016, - ACX_FM_COEX_CFG = 0x0017, - ACX_BEACON_FILTER_TABLE = 0x0018, - ACX_ARP_IP_FILTER = 0x0019, - ACX_ROAMING_STATISTICS_TBL = 0x001A, - ACX_RATE_POLICY = 0x001B, - ACX_CTS_PROTECTION = 0x001C, - ACX_SLEEP_AUTH = 0x001D, - ACX_PREAMBLE_TYPE = 0x001E, - ACX_ERROR_CNT = 0x001F, - ACX_IBSS_FILTER = 0x0020, - ACX_SERVICE_PERIOD_TIMEOUT = 0x0021, - ACX_TSF_INFO = 0x0022, - ACX_CONFIG_PS_WMM = 0x0023, - ACX_ENABLE_RX_DATA_FILTER = 0x0024, - ACX_SET_RX_DATA_FILTER = 0x0025, - ACX_GET_DATA_FILTER_STATISTICS = 0x0026, - ACX_RX_CONFIG_OPT = 0x0027, - ACX_FRAG_CFG = 0x0028, - ACX_BET_ENABLE = 0x0029, - ACX_RSSI_SNR_TRIGGER = 0x002A, - ACX_RSSI_SNR_WEIGHTS = 0x002B, - ACX_KEEP_ALIVE_MODE = 0x002C, - ACX_SET_KEEP_ALIVE_CONFIG = 0x002D, - ACX_BA_SESSION_INIT_POLICY = 0x002E, - ACX_BA_SESSION_RX_SETUP = 0x002F, - ACX_PEER_HT_CAP = 0x0030, - ACX_HT_BSS_OPERATION = 0x0031, - ACX_COEX_ACTIVITY = 0x0032, - ACX_BURST_MODE = 0x0033, - ACX_SET_RATE_MGMT_PARAMS = 0x0034, - ACX_GET_RATE_MGMT_PARAMS = 0x0035, - ACX_SET_RATE_ADAPT_PARAMS = 0x0036, - ACX_SET_DCO_ITRIM_PARAMS = 0x0037, - ACX_GEN_FW_CMD = 0x0038, - ACX_HOST_IF_CFG_BITMAP = 0x0039, - ACX_MAX_TX_FAILURE = 0x003A, - ACX_UPDATE_INCONNECTION_STA_LIST = 0x003B, - DOT11_RX_MSDU_LIFE_TIME = 0x003C, - DOT11_CUR_TX_PWR = 0x003D, - DOT11_RTS_THRESHOLD = 0x003E, - DOT11_GROUP_ADDRESS_TBL = 0x003F, - ACX_PM_CONFIG = 0x0040, - ACX_CONFIG_PS = 0x0041, - ACX_CONFIG_HANGOVER = 0x0042, - ACX_FEATURE_CFG = 0x0043, - ACX_PROTECTION_CFG = 0x0044, -}; - - -int wl1271_acx_wake_up_conditions(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - u8 wake_up_event, u8 listen_interval); -int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth); -int wl1271_acx_tx_power(struct wl1271 *wl, struct wl12xx_vif *wlvif, - int power); -int wl1271_acx_feature_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl1271_acx_mem_map(struct wl1271 *wl, - struct acx_header *mem_map, size_t len); -int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl); -int wl1271_acx_slot(struct wl1271 *wl, struct wl12xx_vif *wlvif, - enum acx_slot_type slot_time); -int wl1271_acx_group_address_tbl(struct wl1271 *wl, struct wl12xx_vif *wlvif, - bool enable, void *mc_list, u32 mc_list_len); -int wl1271_acx_service_period_timeout(struct wl1271 *wl, - struct wl12xx_vif *wlvif); -int wl1271_acx_rts_threshold(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u32 rts_threshold); -int wl1271_acx_dco_itrim_params(struct wl1271 *wl); -int wl1271_acx_beacon_filter_opt(struct wl1271 *wl, struct wl12xx_vif *wlvif, - bool enable_filter); -int wl1271_acx_beacon_filter_table(struct wl1271 *wl, - struct wl12xx_vif *wlvif); -int wl1271_acx_conn_monit_params(struct wl1271 *wl, struct wl12xx_vif *wlvif, - bool enable); -int wl1271_acx_sg_enable(struct wl1271 *wl, bool enable); -int wl12xx_acx_sg_cfg(struct wl1271 *wl); -int wl1271_acx_cca_threshold(struct wl1271 *wl); -int wl1271_acx_bcn_dtim_options(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl1271_acx_aid(struct wl1271 *wl, struct wl12xx_vif *wlvif, u16 aid); -int wl1271_acx_event_mbox_mask(struct wl1271 *wl, u32 event_mask); -int wl1271_acx_set_preamble(struct wl1271 *wl, struct wl12xx_vif *wlvif, - enum acx_preamble_type preamble); -int wl1271_acx_cts_protect(struct wl1271 *wl, struct wl12xx_vif *wlvif, - enum acx_ctsprotect_type ctsprotect); -int wl1271_acx_statistics(struct wl1271 *wl, void *stats); -int wl1271_acx_sta_rate_policies(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl1271_acx_ap_rate_policy(struct wl1271 *wl, struct conf_tx_rate_class *c, - u8 idx); -int wl1271_acx_ac_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 ac, u8 cw_min, u16 cw_max, u8 aifsn, u16 txop); -int wl1271_acx_tid_cfg(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 queue_id, u8 channel_type, - u8 tsid, u8 ps_scheme, u8 ack_policy, - u32 apsd_conf0, u32 apsd_conf1); -int wl1271_acx_frag_threshold(struct wl1271 *wl, u32 frag_threshold); -int wl1271_acx_tx_config_options(struct wl1271 *wl); -int wl12xx_acx_mem_cfg(struct wl1271 *wl); -int wl1271_acx_init_mem_config(struct wl1271 *wl); -int wl1271_acx_init_rx_interrupt(struct wl1271 *wl); -int wl1271_acx_smart_reflex(struct wl1271 *wl); -int wl1271_acx_bet_enable(struct wl1271 *wl, struct wl12xx_vif *wlvif, - bool enable); -int wl1271_acx_arp_ip_filter(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 enable, __be32 address); -int wl1271_acx_pm_config(struct wl1271 *wl); -int wl1271_acx_keep_alive_mode(struct wl1271 *wl, struct wl12xx_vif *vif, - bool enable); -int wl1271_acx_keep_alive_config(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 index, u8 tpl_valid); -int wl1271_acx_rssi_snr_trigger(struct wl1271 *wl, struct wl12xx_vif *wlvif, - bool enable, s16 thold, u8 hyst); -int wl1271_acx_rssi_snr_avg_weights(struct wl1271 *wl, - struct wl12xx_vif *wlvif); -int wl1271_acx_set_ht_capabilities(struct wl1271 *wl, - struct ieee80211_sta_ht_cap *ht_cap, - bool allow_ht_operation, u8 hlid); -int wl1271_acx_set_ht_information(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - u16 ht_operation_mode); -int wl12xx_acx_set_ba_initiator_policy(struct wl1271 *wl, - struct wl12xx_vif *wlvif); -int wl12xx_acx_set_ba_receiver_session(struct wl1271 *wl, u8 tid_index, - u16 ssn, bool enable, u8 peer_hlid); -int wl12xx_acx_tsf_info(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u64 *mactime); -int wl1271_acx_ps_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif, - bool enable); -int wl1271_acx_ap_max_tx_retry(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl12xx_acx_config_ps(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl1271_acx_set_inconnection_sta(struct wl1271 *wl, u8 *addr); -int wl1271_acx_fm_coex(struct wl1271 *wl); -int wl12xx_acx_set_rate_mgmt_params(struct wl1271 *wl); -int wl12xx_acx_config_hangover(struct wl1271 *wl); -int wlcore_acx_average_rssi(struct wl1271 *wl, struct wl12xx_vif *wlvif, - s8 *avg_rssi); - -#ifdef CONFIG_PM -int wl1271_acx_default_rx_filter_enable(struct wl1271 *wl, bool enable, - enum rx_filter_action action); -int wl1271_acx_set_rx_filter(struct wl1271 *wl, u8 index, bool enable, - struct wl12xx_rx_filter *filter); -#endif /* CONFIG_PM */ -#endif /* __WL1271_ACX_H__ */ diff --git a/drivers/net/wireless/ti/wlcore/boot.c b/drivers/net/wireless/ti/wlcore/boot.c deleted file mode 100644 index 77752b03f189..000000000000 --- a/drivers/net/wireless/ti/wlcore/boot.c +++ /dev/null @@ -1,533 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2008-2010 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include - -#include "debug.h" -#include "acx.h" -#include "boot.h" -#include "io.h" -#include "event.h" -#include "rx.h" -#include "hw_ops.h" - -static int wl1271_boot_set_ecpu_ctrl(struct wl1271 *wl, u32 flag) -{ - u32 cpu_ctrl; - int ret; - - /* 10.5.0 run the firmware (I) */ - ret = wlcore_read_reg(wl, REG_ECPU_CONTROL, &cpu_ctrl); - if (ret < 0) - goto out; - - /* 10.5.1 run the firmware (II) */ - cpu_ctrl |= flag; - ret = wlcore_write_reg(wl, REG_ECPU_CONTROL, cpu_ctrl); - -out: - return ret; -} - -static int wlcore_boot_parse_fw_ver(struct wl1271 *wl, - struct wl1271_static_data *static_data) -{ - int ret; - - strncpy(wl->chip.fw_ver_str, static_data->fw_version, - sizeof(wl->chip.fw_ver_str)); - - /* make sure the string is NULL-terminated */ - wl->chip.fw_ver_str[sizeof(wl->chip.fw_ver_str) - 1] = '\0'; - - ret = sscanf(wl->chip.fw_ver_str + 4, "%u.%u.%u.%u.%u", - &wl->chip.fw_ver[0], &wl->chip.fw_ver[1], - &wl->chip.fw_ver[2], &wl->chip.fw_ver[3], - &wl->chip.fw_ver[4]); - - if (ret != 5) { - wl1271_warning("fw version incorrect value"); - memset(wl->chip.fw_ver, 0, sizeof(wl->chip.fw_ver)); - ret = -EINVAL; - goto out; - } - - ret = wlcore_identify_fw(wl); - if (ret < 0) - goto out; -out: - return ret; -} - -static int wlcore_validate_fw_ver(struct wl1271 *wl) -{ - unsigned int *fw_ver = wl->chip.fw_ver; - unsigned int *min_ver = (wl->fw_type == WL12XX_FW_TYPE_MULTI) ? - wl->min_mr_fw_ver : wl->min_sr_fw_ver; - char min_fw_str[32] = ""; - int i; - - /* the chip must be exactly equal */ - if ((min_ver[FW_VER_CHIP] != WLCORE_FW_VER_IGNORE) && - (min_ver[FW_VER_CHIP] != fw_ver[FW_VER_CHIP])) - goto fail; - - /* the firmware type must be equal */ - if ((min_ver[FW_VER_IF_TYPE] != WLCORE_FW_VER_IGNORE) && - (min_ver[FW_VER_IF_TYPE] != fw_ver[FW_VER_IF_TYPE])) - goto fail; - - /* the project number must be equal */ - if ((min_ver[FW_VER_SUBTYPE] != WLCORE_FW_VER_IGNORE) && - (min_ver[FW_VER_SUBTYPE] != fw_ver[FW_VER_SUBTYPE])) - goto fail; - - /* the API version must be greater or equal */ - if ((min_ver[FW_VER_MAJOR] != WLCORE_FW_VER_IGNORE) && - (min_ver[FW_VER_MAJOR] > fw_ver[FW_VER_MAJOR])) - goto fail; - - /* if the API version is equal... */ - if (((min_ver[FW_VER_MAJOR] == WLCORE_FW_VER_IGNORE) || - (min_ver[FW_VER_MAJOR] == fw_ver[FW_VER_MAJOR])) && - /* ...the minor must be greater or equal */ - ((min_ver[FW_VER_MINOR] != WLCORE_FW_VER_IGNORE) && - (min_ver[FW_VER_MINOR] > fw_ver[FW_VER_MINOR]))) - goto fail; - - return 0; - -fail: - for (i = 0; i < NUM_FW_VER; i++) - if (min_ver[i] == WLCORE_FW_VER_IGNORE) - snprintf(min_fw_str, sizeof(min_fw_str), - "%s*.", min_fw_str); - else - snprintf(min_fw_str, sizeof(min_fw_str), - "%s%u.", min_fw_str, min_ver[i]); - - wl1271_error("Your WiFi FW version (%u.%u.%u.%u.%u) is invalid.\n" - "Please use at least FW %s\n" - "You can get the latest firmwares at:\n" - "git://github.com/TI-OpenLink/firmwares.git", - fw_ver[FW_VER_CHIP], fw_ver[FW_VER_IF_TYPE], - fw_ver[FW_VER_MAJOR], fw_ver[FW_VER_SUBTYPE], - fw_ver[FW_VER_MINOR], min_fw_str); - return -EINVAL; -} - -static int wlcore_boot_static_data(struct wl1271 *wl) -{ - struct wl1271_static_data *static_data; - size_t len = sizeof(*static_data) + wl->static_data_priv_len; - int ret; - - static_data = kmalloc(len, GFP_KERNEL); - if (!static_data) { - ret = -ENOMEM; - goto out; - } - - ret = wlcore_read(wl, wl->cmd_box_addr, static_data, len, false); - if (ret < 0) - goto out_free; - - ret = wlcore_boot_parse_fw_ver(wl, static_data); - if (ret < 0) - goto out_free; - - ret = wlcore_validate_fw_ver(wl); - if (ret < 0) - goto out_free; - - ret = wlcore_handle_static_data(wl, static_data); - if (ret < 0) - goto out_free; - -out_free: - kfree(static_data); -out: - return ret; -} - -static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf, - size_t fw_data_len, u32 dest) -{ - struct wlcore_partition_set partition; - int addr, chunk_num, partition_limit; - u8 *p, *chunk; - int ret; - - /* whal_FwCtrl_LoadFwImageSm() */ - - wl1271_debug(DEBUG_BOOT, "starting firmware upload"); - - wl1271_debug(DEBUG_BOOT, "fw_data_len %zd chunk_size %d", - fw_data_len, CHUNK_SIZE); - - if ((fw_data_len % 4) != 0) { - wl1271_error("firmware length not multiple of four"); - return -EIO; - } - - chunk = kmalloc(CHUNK_SIZE, GFP_KERNEL); - if (!chunk) { - wl1271_error("allocation for firmware upload chunk failed"); - return -ENOMEM; - } - - memcpy(&partition, &wl->ptable[PART_DOWN], sizeof(partition)); - partition.mem.start = dest; - ret = wlcore_set_partition(wl, &partition); - if (ret < 0) - goto out; - - /* 10.1 set partition limit and chunk num */ - chunk_num = 0; - partition_limit = wl->ptable[PART_DOWN].mem.size; - - while (chunk_num < fw_data_len / CHUNK_SIZE) { - /* 10.2 update partition, if needed */ - addr = dest + (chunk_num + 2) * CHUNK_SIZE; - if (addr > partition_limit) { - addr = dest + chunk_num * CHUNK_SIZE; - partition_limit = chunk_num * CHUNK_SIZE + - wl->ptable[PART_DOWN].mem.size; - partition.mem.start = addr; - ret = wlcore_set_partition(wl, &partition); - if (ret < 0) - goto out; - } - - /* 10.3 upload the chunk */ - addr = dest + chunk_num * CHUNK_SIZE; - p = buf + chunk_num * CHUNK_SIZE; - memcpy(chunk, p, CHUNK_SIZE); - wl1271_debug(DEBUG_BOOT, "uploading fw chunk 0x%p to 0x%x", - p, addr); - ret = wlcore_write(wl, addr, chunk, CHUNK_SIZE, false); - if (ret < 0) - goto out; - - chunk_num++; - } - - /* 10.4 upload the last chunk */ - addr = dest + chunk_num * CHUNK_SIZE; - p = buf + chunk_num * CHUNK_SIZE; - memcpy(chunk, p, fw_data_len % CHUNK_SIZE); - wl1271_debug(DEBUG_BOOT, "uploading fw last chunk (%zd B) 0x%p to 0x%x", - fw_data_len % CHUNK_SIZE, p, addr); - ret = wlcore_write(wl, addr, chunk, fw_data_len % CHUNK_SIZE, false); - -out: - kfree(chunk); - return ret; -} - -int wlcore_boot_upload_firmware(struct wl1271 *wl) -{ - u32 chunks, addr, len; - int ret = 0; - u8 *fw; - - fw = wl->fw; - chunks = be32_to_cpup((__be32 *) fw); - fw += sizeof(u32); - - wl1271_debug(DEBUG_BOOT, "firmware chunks to be uploaded: %u", chunks); - - while (chunks--) { - addr = be32_to_cpup((__be32 *) fw); - fw += sizeof(u32); - len = be32_to_cpup((__be32 *) fw); - fw += sizeof(u32); - - if (len > 300000) { - wl1271_info("firmware chunk too long: %u", len); - return -EINVAL; - } - wl1271_debug(DEBUG_BOOT, "chunk %d addr 0x%x len %u", - chunks, addr, len); - ret = wl1271_boot_upload_firmware_chunk(wl, fw, len, addr); - if (ret != 0) - break; - fw += len; - } - - return ret; -} -EXPORT_SYMBOL_GPL(wlcore_boot_upload_firmware); - -int wlcore_boot_upload_nvs(struct wl1271 *wl) -{ - size_t nvs_len, burst_len; - int i; - u32 dest_addr, val; - u8 *nvs_ptr, *nvs_aligned; - int ret; - - if (wl->nvs == NULL) { - wl1271_error("NVS file is needed during boot"); - return -ENODEV; - } - - if (wl->quirks & WLCORE_QUIRK_LEGACY_NVS) { - struct wl1271_nvs_file *nvs = - (struct wl1271_nvs_file *)wl->nvs; - /* - * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz - * band configurations) can be removed when those NVS files stop - * floating around. - */ - if (wl->nvs_len == sizeof(struct wl1271_nvs_file) || - wl->nvs_len == WL1271_INI_LEGACY_NVS_FILE_SIZE) { - if (nvs->general_params.dual_mode_select) - wl->enable_11a = true; - } - - if (wl->nvs_len != sizeof(struct wl1271_nvs_file) && - (wl->nvs_len != WL1271_INI_LEGACY_NVS_FILE_SIZE || - wl->enable_11a)) { - wl1271_error("nvs size is not as expected: %zu != %zu", - wl->nvs_len, sizeof(struct wl1271_nvs_file)); - kfree(wl->nvs); - wl->nvs = NULL; - wl->nvs_len = 0; - return -EILSEQ; - } - - /* only the first part of the NVS needs to be uploaded */ - nvs_len = sizeof(nvs->nvs); - nvs_ptr = (u8 *) nvs->nvs; - } else { - struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs; - - if (wl->nvs_len == sizeof(struct wl128x_nvs_file)) { - if (nvs->general_params.dual_mode_select) - wl->enable_11a = true; - } else { - wl1271_error("nvs size is not as expected: %zu != %zu", - wl->nvs_len, - sizeof(struct wl128x_nvs_file)); - kfree(wl->nvs); - wl->nvs = NULL; - wl->nvs_len = 0; - return -EILSEQ; - } - - /* only the first part of the NVS needs to be uploaded */ - nvs_len = sizeof(nvs->nvs); - nvs_ptr = (u8 *)nvs->nvs; - } - - /* update current MAC address to NVS */ - nvs_ptr[11] = wl->addresses[0].addr[0]; - nvs_ptr[10] = wl->addresses[0].addr[1]; - nvs_ptr[6] = wl->addresses[0].addr[2]; - nvs_ptr[5] = wl->addresses[0].addr[3]; - nvs_ptr[4] = wl->addresses[0].addr[4]; - nvs_ptr[3] = wl->addresses[0].addr[5]; - - /* - * Layout before the actual NVS tables: - * 1 byte : burst length. - * 2 bytes: destination address. - * n bytes: data to burst copy. - * - * This is ended by a 0 length, then the NVS tables. - */ - - /* FIXME: Do we need to check here whether the LSB is 1? */ - while (nvs_ptr[0]) { - burst_len = nvs_ptr[0]; - dest_addr = (nvs_ptr[1] & 0xfe) | ((u32)(nvs_ptr[2] << 8)); - - /* - * Due to our new wl1271_translate_reg_addr function, - * we need to add the register partition start address - * to the destination - */ - dest_addr += wl->curr_part.reg.start; - - /* We move our pointer to the data */ - nvs_ptr += 3; - - for (i = 0; i < burst_len; i++) { - if (nvs_ptr + 3 >= (u8 *) wl->nvs + nvs_len) - goto out_badnvs; - - val = (nvs_ptr[0] | (nvs_ptr[1] << 8) - | (nvs_ptr[2] << 16) | (nvs_ptr[3] << 24)); - - wl1271_debug(DEBUG_BOOT, - "nvs burst write 0x%x: 0x%x", - dest_addr, val); - ret = wlcore_write32(wl, dest_addr, val); - if (ret < 0) - return ret; - - nvs_ptr += 4; - dest_addr += 4; - } - - if (nvs_ptr >= (u8 *) wl->nvs + nvs_len) - goto out_badnvs; - } - - /* - * We've reached the first zero length, the first NVS table - * is located at an aligned offset which is at least 7 bytes further. - * NOTE: The wl->nvs->nvs element must be first, in order to - * simplify the casting, we assume it is at the beginning of - * the wl->nvs structure. - */ - nvs_ptr = (u8 *)wl->nvs + - ALIGN(nvs_ptr - (u8 *)wl->nvs + 7, 4); - - if (nvs_ptr >= (u8 *) wl->nvs + nvs_len) - goto out_badnvs; - - nvs_len -= nvs_ptr - (u8 *)wl->nvs; - - /* Now we must set the partition correctly */ - ret = wlcore_set_partition(wl, &wl->ptable[PART_WORK]); - if (ret < 0) - return ret; - - /* Copy the NVS tables to a new block to ensure alignment */ - nvs_aligned = kmemdup(nvs_ptr, nvs_len, GFP_KERNEL); - if (!nvs_aligned) - return -ENOMEM; - - /* And finally we upload the NVS tables */ - ret = wlcore_write_data(wl, REG_CMD_MBOX_ADDRESS, nvs_aligned, nvs_len, - false); - - kfree(nvs_aligned); - return ret; - -out_badnvs: - wl1271_error("nvs data is malformed"); - return -EILSEQ; -} -EXPORT_SYMBOL_GPL(wlcore_boot_upload_nvs); - -int wlcore_boot_run_firmware(struct wl1271 *wl) -{ - int loop, ret; - u32 chip_id, intr; - - /* Make sure we have the boot partition */ - ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); - if (ret < 0) - return ret; - - ret = wl1271_boot_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT); - if (ret < 0) - return ret; - - ret = wlcore_read_reg(wl, REG_CHIP_ID_B, &chip_id); - if (ret < 0) - return ret; - - wl1271_debug(DEBUG_BOOT, "chip id after firmware boot: 0x%x", chip_id); - - if (chip_id != wl->chip.id) { - wl1271_error("chip id doesn't match after firmware boot"); - return -EIO; - } - - /* wait for init to complete */ - loop = 0; - while (loop++ < INIT_LOOP) { - udelay(INIT_LOOP_DELAY); - ret = wlcore_read_reg(wl, REG_INTERRUPT_NO_CLEAR, &intr); - if (ret < 0) - return ret; - - if (intr == 0xffffffff) { - wl1271_error("error reading hardware complete " - "init indication"); - return -EIO; - } - /* check that ACX_INTR_INIT_COMPLETE is enabled */ - else if (intr & WL1271_ACX_INTR_INIT_COMPLETE) { - ret = wlcore_write_reg(wl, REG_INTERRUPT_ACK, - WL1271_ACX_INTR_INIT_COMPLETE); - if (ret < 0) - return ret; - break; - } - } - - if (loop > INIT_LOOP) { - wl1271_error("timeout waiting for the hardware to " - "complete initialization"); - return -EIO; - } - - /* get hardware config command mail box */ - ret = wlcore_read_reg(wl, REG_COMMAND_MAILBOX_PTR, &wl->cmd_box_addr); - if (ret < 0) - return ret; - - wl1271_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x", wl->cmd_box_addr); - - /* get hardware config event mail box */ - ret = wlcore_read_reg(wl, REG_EVENT_MAILBOX_PTR, &wl->mbox_ptr[0]); - if (ret < 0) - return ret; - - wl->mbox_ptr[1] = wl->mbox_ptr[0] + wl->mbox_size; - - wl1271_debug(DEBUG_MAILBOX, "MBOX ptrs: 0x%x 0x%x", - wl->mbox_ptr[0], wl->mbox_ptr[1]); - - ret = wlcore_boot_static_data(wl); - if (ret < 0) { - wl1271_error("error getting static data"); - return ret; - } - - /* - * in case of full asynchronous mode the firmware event must be - * ready to receive event from the command mailbox - */ - - /* unmask required mbox events */ - ret = wl1271_event_unmask(wl); - if (ret < 0) { - wl1271_error("EVENT mask setting failed"); - return ret; - } - - /* set the working partition to its "running" mode offset */ - ret = wlcore_set_partition(wl, &wl->ptable[PART_WORK]); - - /* firmware startup completed */ - return ret; -} -EXPORT_SYMBOL_GPL(wlcore_boot_run_firmware); diff --git a/drivers/net/wireless/ti/wlcore/boot.h b/drivers/net/wireless/ti/wlcore/boot.h deleted file mode 100644 index a525225f990c..000000000000 --- a/drivers/net/wireless/ti/wlcore/boot.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2008-2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __BOOT_H__ -#define __BOOT_H__ - -#include "wlcore.h" - -int wlcore_boot_upload_firmware(struct wl1271 *wl); -int wlcore_boot_upload_nvs(struct wl1271 *wl); -int wlcore_boot_run_firmware(struct wl1271 *wl); - -#define WL1271_NO_SUBBANDS 8 -#define WL1271_NO_POWER_LEVELS 4 -#define WL1271_FW_VERSION_MAX_LEN 20 - -struct wl1271_static_data { - u8 mac_address[ETH_ALEN]; - u8 padding[2]; - u8 fw_version[WL1271_FW_VERSION_MAX_LEN]; - u32 hw_version; - u8 tx_power_table[WL1271_NO_SUBBANDS][WL1271_NO_POWER_LEVELS]; - u8 priv[0]; -}; - -/* number of times we try to read the INIT interrupt */ -#define INIT_LOOP 20000 - -/* delay between retries */ -#define INIT_LOOP_DELAY 50 - -#define WU_COUNTER_PAUSE_VAL 0x3FF -#define WELP_ARM_COMMAND_VAL 0x4 - -#endif diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c deleted file mode 100644 index c9e060795d13..000000000000 --- a/drivers/net/wireless/ti/wlcore/cmd.c +++ /dev/null @@ -1,2025 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2009-2010 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include -#include -#include -#include - -#include "wlcore.h" -#include "debug.h" -#include "io.h" -#include "acx.h" -#include "wl12xx_80211.h" -#include "cmd.h" -#include "event.h" -#include "tx.h" -#include "hw_ops.h" - -#define WL1271_CMD_FAST_POLL_COUNT 50 -#define WL1271_WAIT_EVENT_FAST_POLL_COUNT 20 - -/* - * send command to firmware - * - * @wl: wl struct - * @id: command id - * @buf: buffer containing the command, must work with dma - * @len: length of the buffer - * return the cmd status code on success. - */ -static int __wlcore_cmd_send(struct wl1271 *wl, u16 id, void *buf, - size_t len, size_t res_len) -{ - struct wl1271_cmd_header *cmd; - unsigned long timeout; - u32 intr; - int ret; - u16 status; - u16 poll_count = 0; - - if (WARN_ON(unlikely(wl->state == WLCORE_STATE_RESTARTING))) - return -EIO; - - cmd = buf; - cmd->id = cpu_to_le16(id); - cmd->status = 0; - - WARN_ON(len % 4 != 0); - WARN_ON(test_bit(WL1271_FLAG_IN_ELP, &wl->flags)); - - ret = wlcore_write(wl, wl->cmd_box_addr, buf, len, false); - if (ret < 0) - return ret; - - /* - * TODO: we just need this because one bit is in a different - * place. Is there any better way? - */ - ret = wl->ops->trigger_cmd(wl, wl->cmd_box_addr, buf, len); - if (ret < 0) - return ret; - - timeout = jiffies + msecs_to_jiffies(WL1271_COMMAND_TIMEOUT); - - ret = wlcore_read_reg(wl, REG_INTERRUPT_NO_CLEAR, &intr); - if (ret < 0) - return ret; - - while (!(intr & WL1271_ACX_INTR_CMD_COMPLETE)) { - if (time_after(jiffies, timeout)) { - wl1271_error("command complete timeout"); - return -ETIMEDOUT; - } - - poll_count++; - if (poll_count < WL1271_CMD_FAST_POLL_COUNT) - udelay(10); - else - msleep(1); - - ret = wlcore_read_reg(wl, REG_INTERRUPT_NO_CLEAR, &intr); - if (ret < 0) - return ret; - } - - /* read back the status code of the command */ - if (res_len == 0) - res_len = sizeof(struct wl1271_cmd_header); - - ret = wlcore_read(wl, wl->cmd_box_addr, cmd, res_len, false); - if (ret < 0) - return ret; - - status = le16_to_cpu(cmd->status); - - ret = wlcore_write_reg(wl, REG_INTERRUPT_ACK, - WL1271_ACX_INTR_CMD_COMPLETE); - if (ret < 0) - return ret; - - return status; -} - -/* - * send command to fw and return cmd status on success - * valid_rets contains a bitmap of allowed error codes - */ -int wlcore_cmd_send_failsafe(struct wl1271 *wl, u16 id, void *buf, size_t len, - size_t res_len, unsigned long valid_rets) -{ - int ret = __wlcore_cmd_send(wl, id, buf, len, res_len); - - if (ret < 0) - goto fail; - - /* success is always a valid status */ - valid_rets |= BIT(CMD_STATUS_SUCCESS); - - if (ret >= MAX_COMMAND_STATUS || - !test_bit(ret, &valid_rets)) { - wl1271_error("command execute failure %d", ret); - ret = -EIO; - goto fail; - } - return ret; -fail: - wl12xx_queue_recovery_work(wl); - return ret; -} -EXPORT_SYMBOL_GPL(wl1271_cmd_send); - -/* - * wrapper for wlcore_cmd_send that accept only CMD_STATUS_SUCCESS - * return 0 on success. - */ -int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len, - size_t res_len) -{ - int ret = wlcore_cmd_send_failsafe(wl, id, buf, len, res_len, 0); - - if (ret < 0) - return ret; - return 0; -} - -/* - * Poll the mailbox event field until any of the bits in the mask is set or a - * timeout occurs (WL1271_EVENT_TIMEOUT in msecs) - */ -int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl, - u32 mask, bool *timeout) -{ - u32 *events_vector; - u32 event; - unsigned long timeout_time; - u16 poll_count = 0; - int ret = 0; - - *timeout = false; - - events_vector = kmalloc(sizeof(*events_vector), GFP_KERNEL | GFP_DMA); - if (!events_vector) - return -ENOMEM; - - timeout_time = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT); - - do { - if (time_after(jiffies, timeout_time)) { - wl1271_debug(DEBUG_CMD, "timeout waiting for event %d", - (int)mask); - *timeout = true; - goto out; - } - - poll_count++; - if (poll_count < WL1271_WAIT_EVENT_FAST_POLL_COUNT) - usleep_range(50, 51); - else - usleep_range(1000, 5000); - - /* read from both event fields */ - ret = wlcore_read(wl, wl->mbox_ptr[0], events_vector, - sizeof(*events_vector), false); - if (ret < 0) - goto out; - - event = *events_vector & mask; - - ret = wlcore_read(wl, wl->mbox_ptr[1], events_vector, - sizeof(*events_vector), false); - if (ret < 0) - goto out; - - event |= *events_vector & mask; - } while (!event); - -out: - kfree(events_vector); - return ret; -} -EXPORT_SYMBOL_GPL(wlcore_cmd_wait_for_event_or_timeout); - -int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 *addr, u8 role_type, - u8 *role_id) -{ - struct wl12xx_cmd_role_enable *cmd; - int ret; - - wl1271_debug(DEBUG_CMD, "cmd role enable"); - - if (WARN_ON(*role_id != WL12XX_INVALID_ROLE_ID)) - return -EBUSY; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - /* get role id */ - cmd->role_id = find_first_zero_bit(wl->roles_map, WL12XX_MAX_ROLES); - if (cmd->role_id >= WL12XX_MAX_ROLES) { - ret = -EBUSY; - goto out_free; - } - - memcpy(cmd->mac_address, addr, ETH_ALEN); - cmd->role_type = role_type; - - ret = wl1271_cmd_send(wl, CMD_ROLE_ENABLE, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to initiate cmd role enable"); - goto out_free; - } - - __set_bit(cmd->role_id, wl->roles_map); - *role_id = cmd->role_id; - -out_free: - kfree(cmd); - -out: - return ret; -} - -int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id) -{ - struct wl12xx_cmd_role_disable *cmd; - int ret; - - wl1271_debug(DEBUG_CMD, "cmd role disable"); - - if (WARN_ON(*role_id == WL12XX_INVALID_ROLE_ID)) - return -ENOENT; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - cmd->role_id = *role_id; - - ret = wl1271_cmd_send(wl, CMD_ROLE_DISABLE, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to initiate cmd role disable"); - goto out_free; - } - - __clear_bit(*role_id, wl->roles_map); - *role_id = WL12XX_INVALID_ROLE_ID; - -out_free: - kfree(cmd); - -out: - return ret; -} - -static int wlcore_get_new_session_id(struct wl1271 *wl, u8 hlid) -{ - if (wl->session_ids[hlid] >= SESSION_COUNTER_MAX) - wl->session_ids[hlid] = 0; - - wl->session_ids[hlid]++; - - return wl->session_ids[hlid]; -} - -int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid) -{ - unsigned long flags; - u8 link = find_first_zero_bit(wl->links_map, WL12XX_MAX_LINKS); - if (link >= WL12XX_MAX_LINKS) - return -EBUSY; - - wl->session_ids[link] = wlcore_get_new_session_id(wl, link); - - /* these bits are used by op_tx */ - spin_lock_irqsave(&wl->wl_lock, flags); - __set_bit(link, wl->links_map); - __set_bit(link, wlvif->links_map); - spin_unlock_irqrestore(&wl->wl_lock, flags); - - /* take the last "freed packets" value from the current FW status */ - wl->links[link].prev_freed_pkts = - wl->fw_status_2->counters.tx_lnk_free_pkts[link]; - wl->links[link].wlvif = wlvif; - - /* - * Take saved value for total freed packets from wlvif, in case this is - * recovery/resume - */ - if (wlvif->bss_type != BSS_TYPE_AP_BSS) - wl->links[link].total_freed_pkts = wlvif->total_freed_pkts; - - *hlid = link; - - wl->active_link_count++; - return 0; -} - -void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid) -{ - unsigned long flags; - - if (*hlid == WL12XX_INVALID_LINK_ID) - return; - - /* these bits are used by op_tx */ - spin_lock_irqsave(&wl->wl_lock, flags); - __clear_bit(*hlid, wl->links_map); - __clear_bit(*hlid, wlvif->links_map); - spin_unlock_irqrestore(&wl->wl_lock, flags); - - wl->links[*hlid].allocated_pkts = 0; - wl->links[*hlid].prev_freed_pkts = 0; - wl->links[*hlid].ba_bitmap = 0; - memset(wl->links[*hlid].addr, 0, ETH_ALEN); - - /* - * At this point op_tx() will not add more packets to the queues. We - * can purge them. - */ - wl1271_tx_reset_link_queues(wl, *hlid); - wl->links[*hlid].wlvif = NULL; - - if (wlvif->bss_type == BSS_TYPE_STA_BSS || - (wlvif->bss_type == BSS_TYPE_AP_BSS && - *hlid == wlvif->ap.bcast_hlid)) { - /* - * save the total freed packets in the wlvif, in case this is - * recovery or suspend - */ - wlvif->total_freed_pkts = wl->links[*hlid].total_freed_pkts; - - /* - * increment the initial seq number on recovery to account for - * transmitted packets that we haven't yet got in the FW status - */ - if (test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) - wlvif->total_freed_pkts += - WL1271_TX_SQN_POST_RECOVERY_PADDING; - } - - wl->links[*hlid].total_freed_pkts = 0; - - *hlid = WL12XX_INVALID_LINK_ID; - wl->active_link_count--; - WARN_ON_ONCE(wl->active_link_count < 0); -} - -static u8 wlcore_get_native_channel_type(u8 nl_channel_type) -{ - switch (nl_channel_type) { - case NL80211_CHAN_NO_HT: - return WLCORE_CHAN_NO_HT; - case NL80211_CHAN_HT20: - return WLCORE_CHAN_HT20; - case NL80211_CHAN_HT40MINUS: - return WLCORE_CHAN_HT40MINUS; - case NL80211_CHAN_HT40PLUS: - return WLCORE_CHAN_HT40PLUS; - default: - WARN_ON(1); - return WLCORE_CHAN_NO_HT; - } -} - -static int wl12xx_cmd_role_start_dev(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - enum ieee80211_band band, - int channel) -{ - struct wl12xx_cmd_role_start *cmd; - int ret; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - wl1271_debug(DEBUG_CMD, "cmd role start dev %d", wlvif->dev_role_id); - - cmd->role_id = wlvif->dev_role_id; - if (band == IEEE80211_BAND_5GHZ) - cmd->band = WLCORE_BAND_5GHZ; - cmd->channel = channel; - - if (wlvif->dev_hlid == WL12XX_INVALID_LINK_ID) { - ret = wl12xx_allocate_link(wl, wlvif, &wlvif->dev_hlid); - if (ret) - goto out_free; - } - cmd->device.hlid = wlvif->dev_hlid; - cmd->device.session = wl->session_ids[wlvif->dev_hlid]; - - wl1271_debug(DEBUG_CMD, "role start: roleid=%d, hlid=%d, session=%d", - cmd->role_id, cmd->device.hlid, cmd->device.session); - - ret = wl1271_cmd_send(wl, CMD_ROLE_START, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to initiate cmd role enable"); - goto err_hlid; - } - - goto out_free; - -err_hlid: - /* clear links on error */ - wl12xx_free_link(wl, wlvif, &wlvif->dev_hlid); - -out_free: - kfree(cmd); - -out: - return ret; -} - -static int wl12xx_cmd_role_stop_dev(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - struct wl12xx_cmd_role_stop *cmd; - int ret; - - if (WARN_ON(wlvif->dev_hlid == WL12XX_INVALID_LINK_ID)) - return -EINVAL; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - wl1271_debug(DEBUG_CMD, "cmd role stop dev"); - - cmd->role_id = wlvif->dev_role_id; - cmd->disc_type = DISCONNECT_IMMEDIATE; - cmd->reason = cpu_to_le16(WLAN_REASON_UNSPECIFIED); - - ret = wl1271_cmd_send(wl, CMD_ROLE_STOP, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to initiate cmd role stop"); - goto out_free; - } - - wl12xx_free_link(wl, wlvif, &wlvif->dev_hlid); - -out_free: - kfree(cmd); - -out: - return ret; -} - -int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - struct wl12xx_cmd_role_start *cmd; - u32 supported_rates; - int ret; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - wl1271_debug(DEBUG_CMD, "cmd role start sta %d", wlvif->role_id); - - cmd->role_id = wlvif->role_id; - if (wlvif->band == IEEE80211_BAND_5GHZ) - cmd->band = WLCORE_BAND_5GHZ; - cmd->channel = wlvif->channel; - cmd->sta.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set); - cmd->sta.beacon_interval = cpu_to_le16(wlvif->beacon_int); - cmd->sta.ssid_type = WL12XX_SSID_TYPE_ANY; - cmd->sta.ssid_len = wlvif->ssid_len; - memcpy(cmd->sta.ssid, wlvif->ssid, wlvif->ssid_len); - memcpy(cmd->sta.bssid, vif->bss_conf.bssid, ETH_ALEN); - - supported_rates = CONF_TX_ENABLED_RATES | CONF_TX_MCS_RATES | - wlcore_hw_sta_get_ap_rate_mask(wl, wlvif); - if (wlvif->p2p) - supported_rates &= ~CONF_TX_CCK_RATES; - - cmd->sta.local_rates = cpu_to_le32(supported_rates); - - cmd->channel_type = wlcore_get_native_channel_type(wlvif->channel_type); - - if (wlvif->sta.hlid == WL12XX_INVALID_LINK_ID) { - ret = wl12xx_allocate_link(wl, wlvif, &wlvif->sta.hlid); - if (ret) - goto out_free; - } - cmd->sta.hlid = wlvif->sta.hlid; - cmd->sta.session = wl->session_ids[wlvif->sta.hlid]; - /* - * We don't have the correct remote rates in this stage. The - * rates will be reconfigured later, after association, if the - * firmware supports ACX_PEER_CAP. Otherwise, there's nothing - * we can do, so use all supported_rates here. - */ - cmd->sta.remote_rates = cpu_to_le32(supported_rates); - - wl1271_debug(DEBUG_CMD, "role start: roleid=%d, hlid=%d, session=%d " - "basic_rate_set: 0x%x, remote_rates: 0x%x", - wlvif->role_id, cmd->sta.hlid, cmd->sta.session, - wlvif->basic_rate_set, wlvif->rate_set); - - ret = wl1271_cmd_send(wl, CMD_ROLE_START, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to initiate cmd role start sta"); - goto err_hlid; - } - - wlvif->sta.role_chan_type = wlvif->channel_type; - goto out_free; - -err_hlid: - /* clear links on error. */ - wl12xx_free_link(wl, wlvif, &wlvif->sta.hlid); - -out_free: - kfree(cmd); - -out: - return ret; -} - -/* use this function to stop ibss as well */ -int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct wl12xx_cmd_role_stop *cmd; - int ret; - - if (WARN_ON(wlvif->sta.hlid == WL12XX_INVALID_LINK_ID)) - return -EINVAL; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - wl1271_debug(DEBUG_CMD, "cmd role stop sta %d", wlvif->role_id); - - cmd->role_id = wlvif->role_id; - cmd->disc_type = DISCONNECT_IMMEDIATE; - cmd->reason = cpu_to_le16(WLAN_REASON_UNSPECIFIED); - - ret = wl1271_cmd_send(wl, CMD_ROLE_STOP, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to initiate cmd role stop sta"); - goto out_free; - } - - wl12xx_free_link(wl, wlvif, &wlvif->sta.hlid); - -out_free: - kfree(cmd); - -out: - return ret; -} - -int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct wl12xx_cmd_role_start *cmd; - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; - u32 supported_rates; - int ret; - - wl1271_debug(DEBUG_CMD, "cmd role start ap %d", wlvif->role_id); - - /* trying to use hidden SSID with an old hostapd version */ - if (wlvif->ssid_len == 0 && !bss_conf->hidden_ssid) { - wl1271_error("got a null SSID from beacon/bss"); - ret = -EINVAL; - goto out; - } - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - ret = wl12xx_allocate_link(wl, wlvif, &wlvif->ap.global_hlid); - if (ret < 0) - goto out_free; - - ret = wl12xx_allocate_link(wl, wlvif, &wlvif->ap.bcast_hlid); - if (ret < 0) - goto out_free_global; - - /* use the previous security seq, if this is a recovery/resume */ - wl->links[wlvif->ap.bcast_hlid].total_freed_pkts = - wlvif->total_freed_pkts; - - cmd->role_id = wlvif->role_id; - cmd->ap.aging_period = cpu_to_le16(wl->conf.tx.ap_aging_period); - cmd->ap.bss_index = WL1271_AP_BSS_INDEX; - cmd->ap.global_hlid = wlvif->ap.global_hlid; - cmd->ap.broadcast_hlid = wlvif->ap.bcast_hlid; - cmd->ap.global_session_id = wl->session_ids[wlvif->ap.global_hlid]; - cmd->ap.bcast_session_id = wl->session_ids[wlvif->ap.bcast_hlid]; - cmd->ap.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set); - cmd->ap.beacon_interval = cpu_to_le16(wlvif->beacon_int); - cmd->ap.dtim_interval = bss_conf->dtim_period; - cmd->ap.beacon_expiry = WL1271_AP_DEF_BEACON_EXP; - /* FIXME: Change when adding DFS */ - cmd->ap.reset_tsf = 1; /* By default reset AP TSF */ - cmd->ap.wmm = wlvif->wmm_enabled; - cmd->channel = wlvif->channel; - cmd->channel_type = wlcore_get_native_channel_type(wlvif->channel_type); - - if (!bss_conf->hidden_ssid) { - /* take the SSID from the beacon for backward compatibility */ - cmd->ap.ssid_type = WL12XX_SSID_TYPE_PUBLIC; - cmd->ap.ssid_len = wlvif->ssid_len; - memcpy(cmd->ap.ssid, wlvif->ssid, wlvif->ssid_len); - } else { - cmd->ap.ssid_type = WL12XX_SSID_TYPE_HIDDEN; - cmd->ap.ssid_len = bss_conf->ssid_len; - memcpy(cmd->ap.ssid, bss_conf->ssid, bss_conf->ssid_len); - } - - supported_rates = CONF_TX_ENABLED_RATES | CONF_TX_MCS_RATES | - wlcore_hw_ap_get_mimo_wide_rate_mask(wl, wlvif); - if (wlvif->p2p) - supported_rates &= ~CONF_TX_CCK_RATES; - - wl1271_debug(DEBUG_CMD, "cmd role start ap with supported_rates 0x%08x", - supported_rates); - - cmd->ap.local_rates = cpu_to_le32(supported_rates); - - switch (wlvif->band) { - case IEEE80211_BAND_2GHZ: - cmd->band = WLCORE_BAND_2_4GHZ; - break; - case IEEE80211_BAND_5GHZ: - cmd->band = WLCORE_BAND_5GHZ; - break; - default: - wl1271_warning("ap start - unknown band: %d", (int)wlvif->band); - cmd->band = WLCORE_BAND_2_4GHZ; - break; - } - - ret = wl1271_cmd_send(wl, CMD_ROLE_START, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to initiate cmd role start ap"); - goto out_free_bcast; - } - - goto out_free; - -out_free_bcast: - wl12xx_free_link(wl, wlvif, &wlvif->ap.bcast_hlid); - -out_free_global: - wl12xx_free_link(wl, wlvif, &wlvif->ap.global_hlid); - -out_free: - kfree(cmd); - -out: - return ret; -} - -int wl12xx_cmd_role_stop_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct wl12xx_cmd_role_stop *cmd; - int ret; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - wl1271_debug(DEBUG_CMD, "cmd role stop ap %d", wlvif->role_id); - - cmd->role_id = wlvif->role_id; - - ret = wl1271_cmd_send(wl, CMD_ROLE_STOP, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to initiate cmd role stop ap"); - goto out_free; - } - - wl12xx_free_link(wl, wlvif, &wlvif->ap.bcast_hlid); - wl12xx_free_link(wl, wlvif, &wlvif->ap.global_hlid); - -out_free: - kfree(cmd); - -out: - return ret; -} - -int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - struct wl12xx_cmd_role_start *cmd; - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; - int ret; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - wl1271_debug(DEBUG_CMD, "cmd role start ibss %d", wlvif->role_id); - - cmd->role_id = wlvif->role_id; - if (wlvif->band == IEEE80211_BAND_5GHZ) - cmd->band = WLCORE_BAND_5GHZ; - cmd->channel = wlvif->channel; - cmd->ibss.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set); - cmd->ibss.beacon_interval = cpu_to_le16(wlvif->beacon_int); - cmd->ibss.dtim_interval = bss_conf->dtim_period; - cmd->ibss.ssid_type = WL12XX_SSID_TYPE_ANY; - cmd->ibss.ssid_len = wlvif->ssid_len; - memcpy(cmd->ibss.ssid, wlvif->ssid, wlvif->ssid_len); - memcpy(cmd->ibss.bssid, vif->bss_conf.bssid, ETH_ALEN); - cmd->sta.local_rates = cpu_to_le32(wlvif->rate_set); - - if (wlvif->sta.hlid == WL12XX_INVALID_LINK_ID) { - ret = wl12xx_allocate_link(wl, wlvif, &wlvif->sta.hlid); - if (ret) - goto out_free; - } - cmd->ibss.hlid = wlvif->sta.hlid; - cmd->ibss.remote_rates = cpu_to_le32(wlvif->rate_set); - - wl1271_debug(DEBUG_CMD, "role start: roleid=%d, hlid=%d, session=%d " - "basic_rate_set: 0x%x, remote_rates: 0x%x", - wlvif->role_id, cmd->sta.hlid, cmd->sta.session, - wlvif->basic_rate_set, wlvif->rate_set); - - wl1271_debug(DEBUG_CMD, "vif->bss_conf.bssid = %pM", - vif->bss_conf.bssid); - - ret = wl1271_cmd_send(wl, CMD_ROLE_START, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to initiate cmd role enable"); - goto err_hlid; - } - - goto out_free; - -err_hlid: - /* clear links on error. */ - wl12xx_free_link(wl, wlvif, &wlvif->sta.hlid); - -out_free: - kfree(cmd); - -out: - return ret; -} - - -/** - * send test command to firmware - * - * @wl: wl struct - * @buf: buffer containing the command, with all headers, must work with dma - * @len: length of the buffer - * @answer: is answer needed - */ -int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer) -{ - int ret; - size_t res_len = 0; - - wl1271_debug(DEBUG_CMD, "cmd test"); - - if (answer) - res_len = buf_len; - - ret = wl1271_cmd_send(wl, CMD_TEST, buf, buf_len, res_len); - - if (ret < 0) { - wl1271_warning("TEST command failed"); - return ret; - } - - return ret; -} -EXPORT_SYMBOL_GPL(wl1271_cmd_test); - -/** - * read acx from firmware - * - * @wl: wl struct - * @id: acx id - * @buf: buffer for the response, including all headers, must work with dma - * @len: length of buf - */ -int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len) -{ - struct acx_header *acx = buf; - int ret; - - wl1271_debug(DEBUG_CMD, "cmd interrogate"); - - acx->id = cpu_to_le16(id); - - /* payload length, does not include any headers */ - acx->len = cpu_to_le16(len - sizeof(*acx)); - - ret = wl1271_cmd_send(wl, CMD_INTERROGATE, acx, sizeof(*acx), len); - if (ret < 0) - wl1271_error("INTERROGATE command failed"); - - return ret; -} - -/** - * write acx value to firmware - * - * @wl: wl struct - * @id: acx id - * @buf: buffer containing acx, including all headers, must work with dma - * @len: length of buf - * @valid_rets: bitmap of valid cmd status codes (i.e. return values). - * return the cmd status on success. - */ -int wlcore_cmd_configure_failsafe(struct wl1271 *wl, u16 id, void *buf, - size_t len, unsigned long valid_rets) -{ - struct acx_header *acx = buf; - int ret; - - wl1271_debug(DEBUG_CMD, "cmd configure (%d)", id); - - acx->id = cpu_to_le16(id); - - /* payload length, does not include any headers */ - acx->len = cpu_to_le16(len - sizeof(*acx)); - - ret = wlcore_cmd_send_failsafe(wl, CMD_CONFIGURE, acx, len, 0, - valid_rets); - if (ret < 0) { - wl1271_warning("CONFIGURE command NOK"); - return ret; - } - - return ret; -} - -/* - * wrapper for wlcore_cmd_configure that accepts only success status. - * return 0 on success - */ -int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len) -{ - int ret = wlcore_cmd_configure_failsafe(wl, id, buf, len, 0); - - if (ret < 0) - return ret; - return 0; -} -EXPORT_SYMBOL_GPL(wl1271_cmd_configure); - -int wl1271_cmd_data_path(struct wl1271 *wl, bool enable) -{ - struct cmd_enabledisable_path *cmd; - int ret; - u16 cmd_rx, cmd_tx; - - wl1271_debug(DEBUG_CMD, "cmd data path"); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - /* the channel here is only used for calibration, so hardcoded to 1 */ - cmd->channel = 1; - - if (enable) { - cmd_rx = CMD_ENABLE_RX; - cmd_tx = CMD_ENABLE_TX; - } else { - cmd_rx = CMD_DISABLE_RX; - cmd_tx = CMD_DISABLE_TX; - } - - ret = wl1271_cmd_send(wl, cmd_rx, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("rx %s cmd for channel %d failed", - enable ? "start" : "stop", cmd->channel); - goto out; - } - - wl1271_debug(DEBUG_BOOT, "rx %s cmd channel %d", - enable ? "start" : "stop", cmd->channel); - - ret = wl1271_cmd_send(wl, cmd_tx, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("tx %s cmd for channel %d failed", - enable ? "start" : "stop", cmd->channel); - goto out; - } - - wl1271_debug(DEBUG_BOOT, "tx %s cmd channel %d", - enable ? "start" : "stop", cmd->channel); - -out: - kfree(cmd); - return ret; -} -EXPORT_SYMBOL_GPL(wl1271_cmd_data_path); - -int wl1271_cmd_ps_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 ps_mode, u16 auto_ps_timeout) -{ - struct wl1271_cmd_ps_params *ps_params = NULL; - int ret = 0; - - wl1271_debug(DEBUG_CMD, "cmd set ps mode"); - - ps_params = kzalloc(sizeof(*ps_params), GFP_KERNEL); - if (!ps_params) { - ret = -ENOMEM; - goto out; - } - - ps_params->role_id = wlvif->role_id; - ps_params->ps_mode = ps_mode; - ps_params->auto_ps_timeout = auto_ps_timeout; - - ret = wl1271_cmd_send(wl, CMD_SET_PS_MODE, ps_params, - sizeof(*ps_params), 0); - if (ret < 0) { - wl1271_error("cmd set_ps_mode failed"); - goto out; - } - -out: - kfree(ps_params); - return ret; -} - -int wl1271_cmd_template_set(struct wl1271 *wl, u8 role_id, - u16 template_id, void *buf, size_t buf_len, - int index, u32 rates) -{ - struct wl1271_cmd_template_set *cmd; - int ret = 0; - - wl1271_debug(DEBUG_CMD, "cmd template_set %d (role %d)", - template_id, role_id); - - WARN_ON(buf_len > WL1271_CMD_TEMPL_MAX_SIZE); - buf_len = min_t(size_t, buf_len, WL1271_CMD_TEMPL_MAX_SIZE); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - /* during initialization wlvif is NULL */ - cmd->role_id = role_id; - cmd->len = cpu_to_le16(buf_len); - cmd->template_type = template_id; - cmd->enabled_rates = cpu_to_le32(rates); - cmd->short_retry_limit = wl->conf.tx.tmpl_short_retry_limit; - cmd->long_retry_limit = wl->conf.tx.tmpl_long_retry_limit; - cmd->index = index; - - if (buf) - memcpy(cmd->template_data, buf, buf_len); - - ret = wl1271_cmd_send(wl, CMD_SET_TEMPLATE, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_warning("cmd set_template failed: %d", ret); - goto out_free; - } - -out_free: - kfree(cmd); - -out: - return ret; -} - -int wl12xx_cmd_build_null_data(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct sk_buff *skb = NULL; - int size; - void *ptr; - int ret = -ENOMEM; - - - if (wlvif->bss_type == BSS_TYPE_IBSS) { - size = sizeof(struct wl12xx_null_data_template); - ptr = NULL; - } else { - skb = ieee80211_nullfunc_get(wl->hw, - wl12xx_wlvif_to_vif(wlvif)); - if (!skb) - goto out; - size = skb->len; - ptr = skb->data; - } - - ret = wl1271_cmd_template_set(wl, wlvif->role_id, - CMD_TEMPL_NULL_DATA, ptr, size, 0, - wlvif->basic_rate); - -out: - dev_kfree_skb(skb); - if (ret) - wl1271_warning("cmd buld null data failed %d", ret); - - return ret; - -} - -int wl12xx_cmd_build_klv_null_data(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - struct sk_buff *skb = NULL; - int ret = -ENOMEM; - - skb = ieee80211_nullfunc_get(wl->hw, vif); - if (!skb) - goto out; - - ret = wl1271_cmd_template_set(wl, wlvif->role_id, CMD_TEMPL_KLV, - skb->data, skb->len, - wlvif->sta.klv_template_id, - wlvif->basic_rate); - -out: - dev_kfree_skb(skb); - if (ret) - wl1271_warning("cmd build klv null data failed %d", ret); - - return ret; - -} - -int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u16 aid) -{ - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - struct sk_buff *skb; - int ret = 0; - - skb = ieee80211_pspoll_get(wl->hw, vif); - if (!skb) - goto out; - - ret = wl1271_cmd_template_set(wl, wlvif->role_id, - CMD_TEMPL_PS_POLL, skb->data, - skb->len, 0, wlvif->basic_rate_set); - -out: - dev_kfree_skb(skb); - return ret; -} - -int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 role_id, u8 band, - const u8 *ssid, size_t ssid_len, - const u8 *ie, size_t ie_len, bool sched_scan) -{ - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - struct sk_buff *skb; - int ret; - u32 rate; - u16 template_id_2_4 = wl->scan_templ_id_2_4; - u16 template_id_5 = wl->scan_templ_id_5; - - skb = ieee80211_probereq_get(wl->hw, vif, ssid, ssid_len, - ie_len); - if (!skb) { - ret = -ENOMEM; - goto out; - } - if (ie_len) - memcpy(skb_put(skb, ie_len), ie, ie_len); - - wl1271_dump(DEBUG_SCAN, "PROBE REQ: ", skb->data, skb->len); - - if (sched_scan && - (wl->quirks & WLCORE_QUIRK_DUAL_PROBE_TMPL)) { - template_id_2_4 = wl->sched_scan_templ_id_2_4; - template_id_5 = wl->sched_scan_templ_id_5; - } - - rate = wl1271_tx_min_rate_get(wl, wlvif->bitrate_masks[band]); - if (band == IEEE80211_BAND_2GHZ) - ret = wl1271_cmd_template_set(wl, role_id, - template_id_2_4, - skb->data, skb->len, 0, rate); - else - ret = wl1271_cmd_template_set(wl, role_id, - template_id_5, - skb->data, skb->len, 0, rate); - -out: - dev_kfree_skb(skb); - return ret; -} -EXPORT_SYMBOL_GPL(wl12xx_cmd_build_probe_req); - -struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct sk_buff *skb) -{ - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - int ret; - u32 rate; - - if (!skb) - skb = ieee80211_ap_probereq_get(wl->hw, vif); - if (!skb) - goto out; - - wl1271_dump(DEBUG_SCAN, "AP PROBE REQ: ", skb->data, skb->len); - - rate = wl1271_tx_min_rate_get(wl, wlvif->bitrate_masks[wlvif->band]); - if (wlvif->band == IEEE80211_BAND_2GHZ) - ret = wl1271_cmd_template_set(wl, wlvif->role_id, - CMD_TEMPL_CFG_PROBE_REQ_2_4, - skb->data, skb->len, 0, rate); - else - ret = wl1271_cmd_template_set(wl, wlvif->role_id, - CMD_TEMPL_CFG_PROBE_REQ_5, - skb->data, skb->len, 0, rate); - - if (ret < 0) - wl1271_error("Unable to set ap probe request template."); - -out: - return skb; -} - -int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int ret, extra = 0; - u16 fc; - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - struct sk_buff *skb; - struct wl12xx_arp_rsp_template *tmpl; - struct ieee80211_hdr_3addr *hdr; - struct arphdr *arp_hdr; - - skb = dev_alloc_skb(sizeof(*hdr) + sizeof(__le16) + sizeof(*tmpl) + - WL1271_EXTRA_SPACE_MAX); - if (!skb) { - wl1271_error("failed to allocate buffer for arp rsp template"); - return -ENOMEM; - } - - skb_reserve(skb, sizeof(*hdr) + WL1271_EXTRA_SPACE_MAX); - - tmpl = (struct wl12xx_arp_rsp_template *)skb_put(skb, sizeof(*tmpl)); - memset(tmpl, 0, sizeof(*tmpl)); - - /* llc layer */ - memcpy(tmpl->llc_hdr, rfc1042_header, sizeof(rfc1042_header)); - tmpl->llc_type = cpu_to_be16(ETH_P_ARP); - - /* arp header */ - arp_hdr = &tmpl->arp_hdr; - arp_hdr->ar_hrd = cpu_to_be16(ARPHRD_ETHER); - arp_hdr->ar_pro = cpu_to_be16(ETH_P_IP); - arp_hdr->ar_hln = ETH_ALEN; - arp_hdr->ar_pln = 4; - arp_hdr->ar_op = cpu_to_be16(ARPOP_REPLY); - - /* arp payload */ - memcpy(tmpl->sender_hw, vif->addr, ETH_ALEN); - tmpl->sender_ip = wlvif->ip_addr; - - /* encryption space */ - switch (wlvif->encryption_type) { - case KEY_TKIP: - if (wl->quirks & WLCORE_QUIRK_TKIP_HEADER_SPACE) - extra = WL1271_EXTRA_SPACE_TKIP; - break; - case KEY_AES: - extra = WL1271_EXTRA_SPACE_AES; - break; - case KEY_NONE: - case KEY_WEP: - case KEY_GEM: - extra = 0; - break; - default: - wl1271_warning("Unknown encryption type: %d", - wlvif->encryption_type); - ret = -EINVAL; - goto out; - } - - if (extra) { - u8 *space = skb_push(skb, extra); - memset(space, 0, extra); - } - - /* QoS header - BE */ - if (wlvif->sta.qos) - memset(skb_push(skb, sizeof(__le16)), 0, sizeof(__le16)); - - /* mac80211 header */ - hdr = (struct ieee80211_hdr_3addr *)skb_push(skb, sizeof(*hdr)); - memset(hdr, 0, sizeof(*hdr)); - fc = IEEE80211_FTYPE_DATA | IEEE80211_FCTL_TODS; - if (wlvif->sta.qos) - fc |= IEEE80211_STYPE_QOS_DATA; - else - fc |= IEEE80211_STYPE_DATA; - if (wlvif->encryption_type != KEY_NONE) - fc |= IEEE80211_FCTL_PROTECTED; - - hdr->frame_control = cpu_to_le16(fc); - memcpy(hdr->addr1, vif->bss_conf.bssid, ETH_ALEN); - memcpy(hdr->addr2, vif->addr, ETH_ALEN); - memset(hdr->addr3, 0xff, ETH_ALEN); - - ret = wl1271_cmd_template_set(wl, wlvif->role_id, CMD_TEMPL_ARP_RSP, - skb->data, skb->len, 0, - wlvif->basic_rate); -out: - dev_kfree_skb(skb); - return ret; -} - -int wl1271_build_qos_null_data(struct wl1271 *wl, struct ieee80211_vif *vif) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - struct ieee80211_qos_hdr template; - - memset(&template, 0, sizeof(template)); - - memcpy(template.addr1, vif->bss_conf.bssid, ETH_ALEN); - memcpy(template.addr2, vif->addr, ETH_ALEN); - memcpy(template.addr3, vif->bss_conf.bssid, ETH_ALEN); - - template.frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA | - IEEE80211_STYPE_QOS_NULLFUNC | - IEEE80211_FCTL_TODS); - - /* FIXME: not sure what priority to use here */ - template.qos_ctrl = cpu_to_le16(0); - - return wl1271_cmd_template_set(wl, wlvif->role_id, - CMD_TEMPL_QOS_NULL_DATA, &template, - sizeof(template), 0, - wlvif->basic_rate); -} - -int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid) -{ - struct wl1271_cmd_set_keys *cmd; - int ret = 0; - - wl1271_debug(DEBUG_CMD, "cmd set_default_wep_key %d", id); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->hlid = hlid; - cmd->key_id = id; - cmd->lid_key_type = WEP_DEFAULT_LID_TYPE; - cmd->key_action = cpu_to_le16(KEY_SET_ID); - cmd->key_type = KEY_WEP; - - ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_warning("cmd set_default_wep_key failed: %d", ret); - goto out; - } - -out: - kfree(cmd); - - return ret; -} - -int wl1271_cmd_set_sta_key(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u16 action, u8 id, u8 key_type, - u8 key_size, const u8 *key, const u8 *addr, - u32 tx_seq_32, u16 tx_seq_16) -{ - struct wl1271_cmd_set_keys *cmd; - int ret = 0; - - /* hlid might have already been deleted */ - if (wlvif->sta.hlid == WL12XX_INVALID_LINK_ID) - return 0; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->hlid = wlvif->sta.hlid; - - if (key_type == KEY_WEP) - cmd->lid_key_type = WEP_DEFAULT_LID_TYPE; - else if (is_broadcast_ether_addr(addr)) - cmd->lid_key_type = BROADCAST_LID_TYPE; - else - cmd->lid_key_type = UNICAST_LID_TYPE; - - cmd->key_action = cpu_to_le16(action); - cmd->key_size = key_size; - cmd->key_type = key_type; - - cmd->ac_seq_num16[0] = cpu_to_le16(tx_seq_16); - cmd->ac_seq_num32[0] = cpu_to_le32(tx_seq_32); - - cmd->key_id = id; - - if (key_type == KEY_TKIP) { - /* - * We get the key in the following form: - * TKIP (16 bytes) - TX MIC (8 bytes) - RX MIC (8 bytes) - * but the target is expecting: - * TKIP - RX MIC - TX MIC - */ - memcpy(cmd->key, key, 16); - memcpy(cmd->key + 16, key + 24, 8); - memcpy(cmd->key + 24, key + 16, 8); - - } else { - memcpy(cmd->key, key, key_size); - } - - wl1271_dump(DEBUG_CRYPT, "TARGET KEY: ", cmd, sizeof(*cmd)); - - ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_warning("could not set keys"); - goto out; - } - -out: - kfree(cmd); - - return ret; -} - -/* - * TODO: merge with sta/ibss into 1 set_key function. - * note there are slight diffs - */ -int wl1271_cmd_set_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u16 action, u8 id, u8 key_type, - u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32, - u16 tx_seq_16) -{ - struct wl1271_cmd_set_keys *cmd; - int ret = 0; - u8 lid_type; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) - return -ENOMEM; - - if (hlid == wlvif->ap.bcast_hlid) { - if (key_type == KEY_WEP) - lid_type = WEP_DEFAULT_LID_TYPE; - else - lid_type = BROADCAST_LID_TYPE; - } else { - lid_type = UNICAST_LID_TYPE; - } - - wl1271_debug(DEBUG_CRYPT, "ap key action: %d id: %d lid: %d type: %d" - " hlid: %d", (int)action, (int)id, (int)lid_type, - (int)key_type, (int)hlid); - - cmd->lid_key_type = lid_type; - cmd->hlid = hlid; - cmd->key_action = cpu_to_le16(action); - cmd->key_size = key_size; - cmd->key_type = key_type; - cmd->key_id = id; - cmd->ac_seq_num16[0] = cpu_to_le16(tx_seq_16); - cmd->ac_seq_num32[0] = cpu_to_le32(tx_seq_32); - - if (key_type == KEY_TKIP) { - /* - * We get the key in the following form: - * TKIP (16 bytes) - TX MIC (8 bytes) - RX MIC (8 bytes) - * but the target is expecting: - * TKIP - RX MIC - TX MIC - */ - memcpy(cmd->key, key, 16); - memcpy(cmd->key + 16, key + 24, 8); - memcpy(cmd->key + 24, key + 16, 8); - } else { - memcpy(cmd->key, key, key_size); - } - - wl1271_dump(DEBUG_CRYPT, "TARGET AP KEY: ", cmd, sizeof(*cmd)); - - ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_warning("could not set ap keys"); - goto out; - } - -out: - kfree(cmd); - return ret; -} - -int wl12xx_cmd_set_peer_state(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 hlid) -{ - struct wl12xx_cmd_set_peer_state *cmd; - int ret = 0; - - wl1271_debug(DEBUG_CMD, "cmd set peer state (hlid=%d)", hlid); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->hlid = hlid; - cmd->state = WL1271_CMD_STA_STATE_CONNECTED; - - /* wmm param is valid only for station role */ - if (wlvif->bss_type == BSS_TYPE_STA_BSS) - cmd->wmm = wlvif->wmm_enabled; - - ret = wl1271_cmd_send(wl, CMD_SET_PEER_STATE, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to send set peer state command"); - goto out_free; - } - -out_free: - kfree(cmd); - -out: - return ret; -} - -int wl12xx_cmd_add_peer(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct ieee80211_sta *sta, u8 hlid) -{ - struct wl12xx_cmd_add_peer *cmd; - int i, ret; - u32 sta_rates; - - wl1271_debug(DEBUG_CMD, "cmd add peer %d", (int)hlid); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - memcpy(cmd->addr, sta->addr, ETH_ALEN); - cmd->bss_index = WL1271_AP_BSS_INDEX; - cmd->aid = sta->aid; - cmd->hlid = hlid; - cmd->sp_len = sta->max_sp; - cmd->wmm = sta->wme ? 1 : 0; - cmd->session_id = wl->session_ids[hlid]; - - for (i = 0; i < NUM_ACCESS_CATEGORIES_COPY; i++) - if (sta->wme && (sta->uapsd_queues & BIT(i))) - cmd->psd_type[NUM_ACCESS_CATEGORIES_COPY-1-i] = - WL1271_PSD_UPSD_TRIGGER; - else - cmd->psd_type[NUM_ACCESS_CATEGORIES_COPY-1-i] = - WL1271_PSD_LEGACY; - - - sta_rates = sta->supp_rates[wlvif->band]; - if (sta->ht_cap.ht_supported) - sta_rates |= - (sta->ht_cap.mcs.rx_mask[0] << HW_HT_RATES_OFFSET) | - (sta->ht_cap.mcs.rx_mask[1] << HW_MIMO_RATES_OFFSET); - - cmd->supported_rates = - cpu_to_le32(wl1271_tx_enabled_rates_get(wl, sta_rates, - wlvif->band)); - - wl1271_debug(DEBUG_CMD, "new peer rates=0x%x queues=0x%x", - cmd->supported_rates, sta->uapsd_queues); - - ret = wl1271_cmd_send(wl, CMD_ADD_PEER, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to initiate cmd add peer"); - goto out_free; - } - -out_free: - kfree(cmd); - -out: - return ret; -} - -int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid) -{ - struct wl12xx_cmd_remove_peer *cmd; - int ret; - bool timeout = false; - - wl1271_debug(DEBUG_CMD, "cmd remove peer %d", (int)hlid); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->hlid = hlid; - /* We never send a deauth, mac80211 is in charge of this */ - cmd->reason_opcode = 0; - cmd->send_deauth_flag = 0; - - ret = wl1271_cmd_send(wl, CMD_REMOVE_PEER, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to initiate cmd remove peer"); - goto out_free; - } - - ret = wl->ops->wait_for_event(wl, - WLCORE_EVENT_PEER_REMOVE_COMPLETE, - &timeout); - - /* - * We are ok with a timeout here. The event is sometimes not sent - * due to a firmware bug. In case of another error (like SDIO timeout) - * queue a recovery. - */ - if (ret) - wl12xx_queue_recovery_work(wl); - -out_free: - kfree(cmd); - -out: - return ret; -} - -static int wlcore_get_reg_conf_ch_idx(enum ieee80211_band band, u16 ch) -{ - int idx = -1; - - switch (band) { - case IEEE80211_BAND_5GHZ: - if (ch >= 8 && ch <= 16) - idx = ((ch-8)/4 + 18); - else if (ch >= 34 && ch <= 64) - idx = ((ch-34)/2 + 3 + 18); - else if (ch >= 100 && ch <= 140) - idx = ((ch-100)/4 + 15 + 18); - else if (ch >= 149 && ch <= 165) - idx = ((ch-149)/4 + 26 + 18); - else - idx = -1; - break; - case IEEE80211_BAND_2GHZ: - if (ch >= 1 && ch <= 14) - idx = ch - 1; - else - idx = -1; - break; - default: - wl1271_error("get reg conf ch idx - unknown band: %d", - (int)band); - } - - return idx; -} - -void wlcore_set_pending_regdomain_ch(struct wl1271 *wl, u16 channel, - enum ieee80211_band band) -{ - int ch_bit_idx = 0; - - if (!(wl->quirks & WLCORE_QUIRK_REGDOMAIN_CONF)) - return; - - ch_bit_idx = wlcore_get_reg_conf_ch_idx(band, channel); - - if (ch_bit_idx > 0 && ch_bit_idx <= WL1271_MAX_CHANNELS) - set_bit(ch_bit_idx, (long *)wl->reg_ch_conf_pending); -} - -int wlcore_cmd_regdomain_config_locked(struct wl1271 *wl) -{ - struct wl12xx_cmd_regdomain_dfs_config *cmd = NULL; - int ret = 0, i, b, ch_bit_idx; - struct ieee80211_channel *channel; - u32 tmp_ch_bitmap[2]; - u16 ch; - struct wiphy *wiphy = wl->hw->wiphy; - struct ieee80211_supported_band *band; - bool timeout = false; - - if (!(wl->quirks & WLCORE_QUIRK_REGDOMAIN_CONF)) - return 0; - - wl1271_debug(DEBUG_CMD, "cmd reg domain config"); - - memset(tmp_ch_bitmap, 0, sizeof(tmp_ch_bitmap)); - - for (b = IEEE80211_BAND_2GHZ; b <= IEEE80211_BAND_5GHZ; b++) { - band = wiphy->bands[b]; - for (i = 0; i < band->n_channels; i++) { - channel = &band->channels[i]; - ch = channel->hw_value; - - if (channel->flags & (IEEE80211_CHAN_DISABLED | - IEEE80211_CHAN_RADAR | - IEEE80211_CHAN_PASSIVE_SCAN)) - continue; - - ch_bit_idx = wlcore_get_reg_conf_ch_idx(b, ch); - if (ch_bit_idx < 0) - continue; - - set_bit(ch_bit_idx, (long *)tmp_ch_bitmap); - } - } - - tmp_ch_bitmap[0] |= wl->reg_ch_conf_pending[0]; - tmp_ch_bitmap[1] |= wl->reg_ch_conf_pending[1]; - - if (!memcmp(tmp_ch_bitmap, wl->reg_ch_conf_last, sizeof(tmp_ch_bitmap))) - goto out; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->ch_bit_map1 = cpu_to_le32(tmp_ch_bitmap[0]); - cmd->ch_bit_map2 = cpu_to_le32(tmp_ch_bitmap[1]); - - wl1271_debug(DEBUG_CMD, - "cmd reg domain bitmap1: 0x%08x, bitmap2: 0x%08x", - cmd->ch_bit_map1, cmd->ch_bit_map2); - - ret = wl1271_cmd_send(wl, CMD_DFS_CHANNEL_CONFIG, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to send reg domain dfs config"); - goto out; - } - - ret = wl->ops->wait_for_event(wl, - WLCORE_EVENT_DFS_CONFIG_COMPLETE, - &timeout); - if (ret < 0 || timeout) { - wl1271_error("reg domain conf %serror", - timeout ? "completion " : ""); - ret = timeout ? -ETIMEDOUT : ret; - goto out; - } - - memcpy(wl->reg_ch_conf_last, tmp_ch_bitmap, sizeof(tmp_ch_bitmap)); - memset(wl->reg_ch_conf_pending, 0, sizeof(wl->reg_ch_conf_pending)); - -out: - kfree(cmd); - return ret; -} - -int wl12xx_cmd_config_fwlog(struct wl1271 *wl) -{ - struct wl12xx_cmd_config_fwlog *cmd; - int ret = 0; - - wl1271_debug(DEBUG_CMD, "cmd config firmware logger"); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->logger_mode = wl->conf.fwlog.mode; - cmd->log_severity = wl->conf.fwlog.severity; - cmd->timestamp = wl->conf.fwlog.timestamp; - cmd->output = wl->conf.fwlog.output; - cmd->threshold = wl->conf.fwlog.threshold; - - ret = wl1271_cmd_send(wl, CMD_CONFIG_FWLOGGER, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to send config firmware logger command"); - goto out_free; - } - -out_free: - kfree(cmd); - -out: - return ret; -} - -int wl12xx_cmd_start_fwlog(struct wl1271 *wl) -{ - struct wl12xx_cmd_start_fwlog *cmd; - int ret = 0; - - wl1271_debug(DEBUG_CMD, "cmd start firmware logger"); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - ret = wl1271_cmd_send(wl, CMD_START_FWLOGGER, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to send start firmware logger command"); - goto out_free; - } - -out_free: - kfree(cmd); - -out: - return ret; -} - -int wl12xx_cmd_stop_fwlog(struct wl1271 *wl) -{ - struct wl12xx_cmd_stop_fwlog *cmd; - int ret = 0; - - wl1271_debug(DEBUG_CMD, "cmd stop firmware logger"); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - ret = wl1271_cmd_send(wl, CMD_STOP_FWLOGGER, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to send stop firmware logger command"); - goto out_free; - } - -out_free: - kfree(cmd); - -out: - return ret; -} - -static int wl12xx_cmd_roc(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 role_id, enum ieee80211_band band, u8 channel) -{ - struct wl12xx_cmd_roc *cmd; - int ret = 0; - - wl1271_debug(DEBUG_CMD, "cmd roc %d (%d)", channel, role_id); - - if (WARN_ON(role_id == WL12XX_INVALID_ROLE_ID)) - return -EINVAL; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->role_id = role_id; - cmd->channel = channel; - switch (band) { - case IEEE80211_BAND_2GHZ: - cmd->band = WLCORE_BAND_2_4GHZ; - break; - case IEEE80211_BAND_5GHZ: - cmd->band = WLCORE_BAND_5GHZ; - break; - default: - wl1271_error("roc - unknown band: %d", (int)wlvif->band); - ret = -EINVAL; - goto out_free; - } - - - ret = wl1271_cmd_send(wl, CMD_REMAIN_ON_CHANNEL, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to send ROC command"); - goto out_free; - } - -out_free: - kfree(cmd); - -out: - return ret; -} - -static int wl12xx_cmd_croc(struct wl1271 *wl, u8 role_id) -{ - struct wl12xx_cmd_croc *cmd; - int ret = 0; - - wl1271_debug(DEBUG_CMD, "cmd croc (%d)", role_id); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - cmd->role_id = role_id; - - ret = wl1271_cmd_send(wl, CMD_CANCEL_REMAIN_ON_CHANNEL, cmd, - sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to send ROC command"); - goto out_free; - } - -out_free: - kfree(cmd); - -out: - return ret; -} - -int wl12xx_roc(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 role_id, - enum ieee80211_band band, u8 channel) -{ - int ret = 0; - - if (WARN_ON(test_bit(role_id, wl->roc_map))) - return 0; - - ret = wl12xx_cmd_roc(wl, wlvif, role_id, band, channel); - if (ret < 0) - goto out; - - __set_bit(role_id, wl->roc_map); -out: - return ret; -} - -int wl12xx_croc(struct wl1271 *wl, u8 role_id) -{ - int ret = 0; - - if (WARN_ON(!test_bit(role_id, wl->roc_map))) - return 0; - - ret = wl12xx_cmd_croc(wl, role_id); - if (ret < 0) - goto out; - - __clear_bit(role_id, wl->roc_map); - - /* - * Rearm the tx watchdog when removing the last ROC. This prevents - * recoveries due to just finished ROCs - when Tx hasn't yet had - * a chance to get out. - */ - if (find_first_bit(wl->roc_map, WL12XX_MAX_ROLES) >= WL12XX_MAX_ROLES) - wl12xx_rearm_tx_watchdog_locked(wl); -out: - return ret; -} - -int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct wl12xx_cmd_stop_channel_switch *cmd; - int ret; - - wl1271_debug(DEBUG_ACX, "cmd stop channel switch"); - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->role_id = wlvif->role_id; - - ret = wl1271_cmd_send(wl, CMD_STOP_CHANNEL_SWICTH, cmd, sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("failed to stop channel switch command"); - goto out_free; - } - -out_free: - kfree(cmd); - -out: - return ret; -} - -/* start dev role and roc on its channel */ -int wl12xx_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif, - enum ieee80211_band band, int channel) -{ - int ret; - - if (WARN_ON(!(wlvif->bss_type == BSS_TYPE_STA_BSS || - wlvif->bss_type == BSS_TYPE_IBSS))) - return -EINVAL; - - ret = wl12xx_cmd_role_enable(wl, - wl12xx_wlvif_to_vif(wlvif)->addr, - WL1271_ROLE_DEVICE, - &wlvif->dev_role_id); - if (ret < 0) - goto out; - - ret = wl12xx_cmd_role_start_dev(wl, wlvif, band, channel); - if (ret < 0) - goto out_disable; - - ret = wl12xx_roc(wl, wlvif, wlvif->dev_role_id, band, channel); - if (ret < 0) - goto out_stop; - - return 0; - -out_stop: - wl12xx_cmd_role_stop_dev(wl, wlvif); -out_disable: - wl12xx_cmd_role_disable(wl, &wlvif->dev_role_id); -out: - return ret; -} - -/* croc dev hlid, and stop the role */ -int wl12xx_stop_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int ret; - - if (WARN_ON(!(wlvif->bss_type == BSS_TYPE_STA_BSS || - wlvif->bss_type == BSS_TYPE_IBSS))) - return -EINVAL; - - /* flush all pending packets */ - ret = wlcore_tx_work_locked(wl); - if (ret < 0) - goto out; - - if (test_bit(wlvif->dev_role_id, wl->roc_map)) { - ret = wl12xx_croc(wl, wlvif->dev_role_id); - if (ret < 0) - goto out; - } - - ret = wl12xx_cmd_role_stop_dev(wl, wlvif); - if (ret < 0) - goto out; - - ret = wl12xx_cmd_role_disable(wl, &wlvif->dev_role_id); - if (ret < 0) - goto out; - -out: - return ret; -} diff --git a/drivers/net/wireless/ti/wlcore/cmd.h b/drivers/net/wireless/ti/wlcore/cmd.h deleted file mode 100644 index fd34123047cd..000000000000 --- a/drivers/net/wireless/ti/wlcore/cmd.h +++ /dev/null @@ -1,698 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 1998-2009 Texas Instruments. All rights reserved. - * Copyright (C) 2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __CMD_H__ -#define __CMD_H__ - -#include "wlcore.h" - -struct acx_header; - -int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len, - size_t res_len); -int wlcore_cmd_send_failsafe(struct wl1271 *wl, u16 id, void *buf, size_t len, - size_t res_len, unsigned long valid_rets); -int wl12xx_cmd_role_enable(struct wl1271 *wl, u8 *addr, u8 role_type, - u8 *role_id); -int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id); -int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl12xx_cmd_role_stop_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl12xx_start_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif, - enum ieee80211_band band, int channel); -int wl12xx_stop_dev(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer); -int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len); -int wl1271_cmd_configure(struct wl1271 *wl, u16 id, void *buf, size_t len); -int wlcore_cmd_configure_failsafe(struct wl1271 *wl, u16 id, void *buf, - size_t len, unsigned long valid_rets); -int wl1271_cmd_data_path(struct wl1271 *wl, bool enable); -int wl1271_cmd_ps_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 ps_mode, u16 auto_ps_timeout); -int wl1271_cmd_read_memory(struct wl1271 *wl, u32 addr, void *answer, - size_t len); -int wl1271_cmd_template_set(struct wl1271 *wl, u8 role_id, - u16 template_id, void *buf, size_t buf_len, - int index, u32 rates); -int wl12xx_cmd_build_null_data(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u16 aid); -int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 role_id, u8 band, - const u8 *ssid, size_t ssid_len, - const u8 *ie, size_t ie_len, bool sched_scan); -struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct sk_buff *skb); -int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl1271_build_qos_null_data(struct wl1271 *wl, struct ieee80211_vif *vif); -int wl12xx_cmd_build_klv_null_data(struct wl1271 *wl, - struct wl12xx_vif *wlvif); -int wl12xx_cmd_set_default_wep_key(struct wl1271 *wl, u8 id, u8 hlid); -int wl1271_cmd_set_sta_key(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u16 action, u8 id, u8 key_type, - u8 key_size, const u8 *key, const u8 *addr, - u32 tx_seq_32, u16 tx_seq_16); -int wl1271_cmd_set_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u16 action, u8 id, u8 key_type, - u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32, - u16 tx_seq_16); -int wl12xx_cmd_set_peer_state(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 hlid); -int wl12xx_roc(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 role_id, - enum ieee80211_band band, u8 channel); -int wl12xx_croc(struct wl1271 *wl, u8 role_id); -int wl12xx_cmd_add_peer(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct ieee80211_sta *sta, u8 hlid); -int wl12xx_cmd_remove_peer(struct wl1271 *wl, u8 hlid); -void wlcore_set_pending_regdomain_ch(struct wl1271 *wl, u16 channel, - enum ieee80211_band band); -int wlcore_cmd_regdomain_config_locked(struct wl1271 *wl); -int wl12xx_cmd_config_fwlog(struct wl1271 *wl); -int wl12xx_cmd_start_fwlog(struct wl1271 *wl); -int wl12xx_cmd_stop_fwlog(struct wl1271 *wl); -int wl12xx_cmd_channel_switch(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct ieee80211_channel_switch *ch_switch); -int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl, - struct wl12xx_vif *wlvif); -int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 *hlid); -void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid); -int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl, - u32 mask, bool *timeout); - -enum wl1271_commands { - CMD_INTERROGATE = 1, /* use this to read information elements */ - CMD_CONFIGURE = 2, /* use this to write information elements */ - CMD_ENABLE_RX = 3, - CMD_ENABLE_TX = 4, - CMD_DISABLE_RX = 5, - CMD_DISABLE_TX = 6, - CMD_SCAN = 7, - CMD_STOP_SCAN = 8, - CMD_SET_KEYS = 9, - CMD_READ_MEMORY = 10, - CMD_WRITE_MEMORY = 11, - CMD_SET_TEMPLATE = 12, - CMD_TEST = 13, - CMD_NOISE_HIST = 14, - CMD_QUIET_ELEMENT_SET_STATE = 15, - CMD_SET_BCN_MODE = 16, - - CMD_MEASUREMENT = 17, - CMD_STOP_MEASUREMENT = 18, - CMD_SET_PS_MODE = 19, - CMD_CHANNEL_SWITCH = 20, - CMD_STOP_CHANNEL_SWICTH = 21, - CMD_AP_DISCOVERY = 22, - CMD_STOP_AP_DISCOVERY = 23, - CMD_HEALTH_CHECK = 24, - CMD_DEBUG = 25, - CMD_TRIGGER_SCAN_TO = 26, - CMD_CONNECTION_SCAN_CFG = 27, - CMD_CONNECTION_SCAN_SSID_CFG = 28, - CMD_START_PERIODIC_SCAN = 29, - CMD_STOP_PERIODIC_SCAN = 30, - CMD_SET_PEER_STATE = 31, - CMD_REMAIN_ON_CHANNEL = 32, - CMD_CANCEL_REMAIN_ON_CHANNEL = 33, - CMD_CONFIG_FWLOGGER = 34, - CMD_START_FWLOGGER = 35, - CMD_STOP_FWLOGGER = 36, - - /* Access point commands */ - CMD_ADD_PEER = 37, - CMD_REMOVE_PEER = 38, - - /* Role API */ - CMD_ROLE_ENABLE = 39, - CMD_ROLE_DISABLE = 40, - CMD_ROLE_START = 41, - CMD_ROLE_STOP = 42, - - /* DFS */ - CMD_START_RADAR_DETECTION = 43, - CMD_STOP_RADAR_DETECTION = 44, - - /* WIFI Direct */ - CMD_WFD_START_DISCOVERY = 45, - CMD_WFD_STOP_DISCOVERY = 46, - CMD_WFD_ATTRIBUTE_CONFIG = 47, - CMD_GENERIC_CFG = 48, - CMD_NOP = 49, - - /* start of 18xx specific commands */ - CMD_DFS_CHANNEL_CONFIG = 60, - - MAX_COMMAND_ID = 0xFFFF, -}; - -#define MAX_CMD_PARAMS 572 - -enum cmd_templ { - CMD_TEMPL_NULL_DATA = 0, - CMD_TEMPL_BEACON, - CMD_TEMPL_CFG_PROBE_REQ_2_4, - CMD_TEMPL_CFG_PROBE_REQ_5, - CMD_TEMPL_PROBE_RESPONSE, - CMD_TEMPL_QOS_NULL_DATA, - CMD_TEMPL_PS_POLL, - CMD_TEMPL_KLV, - CMD_TEMPL_DISCONNECT, - CMD_TEMPL_APP_PROBE_REQ_2_4_LEGACY, - CMD_TEMPL_APP_PROBE_REQ_5_LEGACY, - CMD_TEMPL_BAR, /* for firmware internal use only */ - CMD_TEMPL_CTS, /* - * For CTS-to-self (FastCTS) mechanism - * for BT/WLAN coexistence (SoftGemini). */ - CMD_TEMPL_AP_BEACON, - CMD_TEMPL_AP_PROBE_RESPONSE, - CMD_TEMPL_ARP_RSP, - CMD_TEMPL_DEAUTH_AP, - CMD_TEMPL_TEMPORARY, - CMD_TEMPL_LINK_MEASUREMENT_REPORT, - CMD_TEMPL_PROBE_REQ_2_4_PERIODIC, - CMD_TEMPL_PROBE_REQ_5_PERIODIC, - - CMD_TEMPL_MAX = 0xff -}; - -/* unit ms */ -#define WL1271_COMMAND_TIMEOUT 2000 -#define WL1271_CMD_TEMPL_DFLT_SIZE 252 -#define WL1271_CMD_TEMPL_MAX_SIZE 512 -#define WL1271_EVENT_TIMEOUT 1500 - -struct wl1271_cmd_header { - __le16 id; - __le16 status; - /* payload */ - u8 data[0]; -} __packed; - -#define WL1271_CMD_MAX_PARAMS 572 - -struct wl1271_command { - struct wl1271_cmd_header header; - u8 parameters[WL1271_CMD_MAX_PARAMS]; -} __packed; - -enum { - CMD_MAILBOX_IDLE = 0, - CMD_STATUS_SUCCESS = 1, - CMD_STATUS_UNKNOWN_CMD = 2, - CMD_STATUS_UNKNOWN_IE = 3, - CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11, - CMD_STATUS_RX_BUSY = 13, - CMD_STATUS_INVALID_PARAM = 14, - CMD_STATUS_TEMPLATE_TOO_LARGE = 15, - CMD_STATUS_OUT_OF_MEMORY = 16, - CMD_STATUS_STA_TABLE_FULL = 17, - CMD_STATUS_RADIO_ERROR = 18, - CMD_STATUS_WRONG_NESTING = 19, - CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/ - CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/ - CMD_STATUS_TEMPLATE_OOM = 23, - CMD_STATUS_NO_RX_BA_SESSION = 24, - - MAX_COMMAND_STATUS -}; - -#define CMDMBOX_HEADER_LEN 4 -#define CMDMBOX_INFO_ELEM_HEADER_LEN 4 - -enum { - BSS_TYPE_IBSS = 0, - BSS_TYPE_STA_BSS = 2, - BSS_TYPE_AP_BSS = 3, - MAX_BSS_TYPE = 0xFF -}; - -#define WL1271_JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */ -#define WL1271_JOIN_CMD_TX_SESSION_OFFSET 1 -#define WL1271_JOIN_CMD_BSS_TYPE_5GHZ 0x10 - -struct wl12xx_cmd_role_enable { - struct wl1271_cmd_header header; - - u8 role_id; - u8 role_type; - u8 mac_address[ETH_ALEN]; -} __packed; - -struct wl12xx_cmd_role_disable { - struct wl1271_cmd_header header; - - u8 role_id; - u8 padding[3]; -} __packed; - -enum wlcore_band { - WLCORE_BAND_2_4GHZ = 0, - WLCORE_BAND_5GHZ = 1, - WLCORE_BAND_JAPAN_4_9_GHZ = 2, - WLCORE_BAND_DEFAULT = WLCORE_BAND_2_4GHZ, - WLCORE_BAND_INVALID = 0x7E, - WLCORE_BAND_MAX_RADIO = 0x7F, -}; - -enum wlcore_channel_type { - WLCORE_CHAN_NO_HT, - WLCORE_CHAN_HT20, - WLCORE_CHAN_HT40MINUS, - WLCORE_CHAN_HT40PLUS -}; - -struct wl12xx_cmd_role_start { - struct wl1271_cmd_header header; - - u8 role_id; - u8 band; - u8 channel; - - /* enum wlcore_channel_type */ - u8 channel_type; - - union { - struct { - u8 hlid; - u8 session; - u8 padding_1[54]; - } __packed device; - /* sta & p2p_cli use the same struct */ - struct { - u8 bssid[ETH_ALEN]; - u8 hlid; /* data hlid */ - u8 session; - __le32 remote_rates; /* remote supported rates */ - - /* - * The target uses this field to determine the rate at - * which to transmit control frame responses (such as - * ACK or CTS frames). - */ - __le32 basic_rate_set; - __le32 local_rates; /* local supported rates */ - - u8 ssid_type; - u8 ssid_len; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - - __le16 beacon_interval; /* in TBTTs */ - } __packed sta; - struct { - u8 bssid[ETH_ALEN]; - u8 hlid; /* data hlid */ - u8 dtim_interval; - __le32 remote_rates; /* remote supported rates */ - - __le32 basic_rate_set; - __le32 local_rates; /* local supported rates */ - - u8 ssid_type; - u8 ssid_len; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - - __le16 beacon_interval; /* in TBTTs */ - - u8 padding_1[4]; - } __packed ibss; - /* ap & p2p_go use the same struct */ - struct { - __le16 aging_period; /* in secs */ - u8 beacon_expiry; /* in ms */ - u8 bss_index; - /* The host link id for the AP's global queue */ - u8 global_hlid; - /* The host link id for the AP's broadcast queue */ - u8 broadcast_hlid; - - __le16 beacon_interval; /* in TBTTs */ - - __le32 basic_rate_set; - __le32 local_rates; /* local supported rates */ - - u8 dtim_interval; - - u8 ssid_type; - u8 ssid_len; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - - u8 reset_tsf; - - /* - * ap supports wmm (note that there is additional - * per-sta wmm configuration) - */ - u8 wmm; - - u8 bcast_session_id; - u8 global_session_id; - u8 padding_1[1]; - } __packed ap; - }; -} __packed; - -struct wl12xx_cmd_role_stop { - struct wl1271_cmd_header header; - - u8 role_id; - u8 disc_type; /* only STA and P2P_CLI */ - __le16 reason; /* only STA and P2P_CLI */ -} __packed; - -struct cmd_enabledisable_path { - struct wl1271_cmd_header header; - - u8 channel; - u8 padding[3]; -} __packed; - -#define WL1271_RATE_AUTOMATIC 0 - -struct wl1271_cmd_template_set { - struct wl1271_cmd_header header; - - u8 role_id; - u8 template_type; - __le16 len; - u8 index; /* relevant only for KLV_TEMPLATE type */ - u8 padding[3]; - - __le32 enabled_rates; - u8 short_retry_limit; - u8 long_retry_limit; - u8 aflags; - u8 reserved; - - u8 template_data[WL1271_CMD_TEMPL_MAX_SIZE]; -} __packed; - -#define TIM_ELE_ID 5 -#define PARTIAL_VBM_MAX 251 - -struct wl1271_tim { - u8 identity; - u8 length; - u8 dtim_count; - u8 dtim_period; - u8 bitmap_ctrl; - u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */ -} __packed; - -enum wl1271_cmd_ps_mode { - STATION_AUTO_PS_MODE, /* Dynamic Power Save */ - STATION_ACTIVE_MODE, - STATION_POWER_SAVE_MODE -}; - -struct wl1271_cmd_ps_params { - struct wl1271_cmd_header header; - - u8 role_id; - u8 ps_mode; /* STATION_* */ - u16 auto_ps_timeout; -} __packed; - -/* HW encryption keys */ -#define NUM_ACCESS_CATEGORIES_COPY 4 - -enum wl1271_cmd_key_action { - KEY_ADD_OR_REPLACE = 1, - KEY_REMOVE = 2, - KEY_SET_ID = 3, - MAX_KEY_ACTION = 0xffff, -}; - -enum wl1271_cmd_lid_key_type { - UNICAST_LID_TYPE = 0, - BROADCAST_LID_TYPE = 1, - WEP_DEFAULT_LID_TYPE = 2 -}; - -enum wl1271_cmd_key_type { - KEY_NONE = 0, - KEY_WEP = 1, - KEY_TKIP = 2, - KEY_AES = 3, - KEY_GEM = 4, -}; - -struct wl1271_cmd_set_keys { - struct wl1271_cmd_header header; - - /* - * Indicates whether the HLID is a unicast key set - * or broadcast key set. A special value 0xFF is - * used to indicate that the HLID is on WEP-default - * (multi-hlids). of type wl1271_cmd_lid_key_type. - */ - u8 hlid; - - /* - * In WEP-default network (hlid == 0xFF) used to - * indicate which network STA/IBSS/AP role should be - * changed - */ - u8 lid_key_type; - - /* - * Key ID - For TKIP and AES key types, this field - * indicates the value that should be inserted into - * the KeyID field of frames transmitted using this - * key entry. For broadcast keys the index use as a - * marker for TX/RX key. - * For WEP default network (HLID=0xFF), this field - * indicates the ID of the key to add or remove. - */ - u8 key_id; - u8 reserved_1; - - /* key_action_e */ - __le16 key_action; - - /* key size in bytes */ - u8 key_size; - - /* key_type_e */ - u8 key_type; - - /* This field holds the security key data to add to the STA table */ - u8 key[MAX_KEY_SIZE]; - __le16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY]; - __le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY]; -} __packed; - -struct wl1271_cmd_test_header { - u8 id; - u8 padding[3]; -} __packed; - -enum wl1271_channel_tune_bands { - WL1271_CHANNEL_TUNE_BAND_2_4, - WL1271_CHANNEL_TUNE_BAND_5, - WL1271_CHANNEL_TUNE_BAND_4_9 -}; - -#define WL1271_PD_REFERENCE_POINT_BAND_B_G 0 - -/* - * There are three types of disconnections: - * - * DISCONNECT_IMMEDIATE: the fw doesn't send any frames - * DISCONNECT_DEAUTH: the fw generates a DEAUTH request with the reason - * we have passed - * DISCONNECT_DISASSOC: the fw generates a DESASSOC request with the reason - * we have passed - */ -enum wl1271_disconnect_type { - DISCONNECT_IMMEDIATE, - DISCONNECT_DEAUTH, - DISCONNECT_DISASSOC -}; - -#define WL1271_CMD_STA_STATE_CONNECTED 1 - -struct wl12xx_cmd_set_peer_state { - struct wl1271_cmd_header header; - - u8 hlid; - u8 state; - - /* - * wmm is relevant for sta role only. - * ap role configures the per-sta wmm params in - * the add_peer command. - */ - u8 wmm; - u8 padding[1]; -} __packed; - -struct wl12xx_cmd_roc { - struct wl1271_cmd_header header; - - u8 role_id; - u8 channel; - u8 band; - u8 padding; -}; - -struct wl12xx_cmd_croc { - struct wl1271_cmd_header header; - - u8 role_id; - u8 padding[3]; -}; - -enum wl12xx_ssid_type { - WL12XX_SSID_TYPE_PUBLIC = 0, - WL12XX_SSID_TYPE_HIDDEN = 1, - WL12XX_SSID_TYPE_ANY = 2, -}; - -enum wl1271_psd_type { - WL1271_PSD_LEGACY = 0, - WL1271_PSD_UPSD_TRIGGER = 1, - WL1271_PSD_LEGACY_PSPOLL = 2, - WL1271_PSD_SAPSD = 3 -}; - -struct wl12xx_cmd_add_peer { - struct wl1271_cmd_header header; - - u8 addr[ETH_ALEN]; - u8 hlid; - u8 aid; - u8 psd_type[NUM_ACCESS_CATEGORIES_COPY]; - __le32 supported_rates; - u8 bss_index; - u8 sp_len; - u8 wmm; - u8 session_id; -} __packed; - -struct wl12xx_cmd_remove_peer { - struct wl1271_cmd_header header; - - u8 hlid; - u8 reason_opcode; - u8 send_deauth_flag; - u8 padding1; -} __packed; - -/* - * Continuous mode - packets are transferred to the host periodically - * via the data path. - * On demand - Log messages are stored in a cyclic buffer in the - * firmware, and only transferred to the host when explicitly requested - */ -enum wl12xx_fwlogger_log_mode { - WL12XX_FWLOG_CONTINUOUS, - WL12XX_FWLOG_ON_DEMAND -}; - -/* Include/exclude timestamps from the log messages */ -enum wl12xx_fwlogger_timestamp { - WL12XX_FWLOG_TIMESTAMP_DISABLED, - WL12XX_FWLOG_TIMESTAMP_ENABLED -}; - -/* - * Logs can be routed to the debug pinouts (where available), to the host bus - * (SDIO/SPI), or dropped - */ -enum wl12xx_fwlogger_output { - WL12XX_FWLOG_OUTPUT_NONE, - WL12XX_FWLOG_OUTPUT_DBG_PINS, - WL12XX_FWLOG_OUTPUT_HOST, -}; - -struct wl12xx_cmd_regdomain_dfs_config { - struct wl1271_cmd_header header; - - __le32 ch_bit_map1; - __le32 ch_bit_map2; -} __packed; - -struct wl12xx_cmd_config_fwlog { - struct wl1271_cmd_header header; - - /* See enum wl12xx_fwlogger_log_mode */ - u8 logger_mode; - - /* Minimum log level threshold */ - u8 log_severity; - - /* Include/exclude timestamps from the log messages */ - u8 timestamp; - - /* See enum wl1271_fwlogger_output */ - u8 output; - - /* Regulates the frequency of log messages */ - u8 threshold; - - u8 padding[3]; -} __packed; - -struct wl12xx_cmd_start_fwlog { - struct wl1271_cmd_header header; -} __packed; - -struct wl12xx_cmd_stop_fwlog { - struct wl1271_cmd_header header; -} __packed; - -struct wl12xx_cmd_stop_channel_switch { - struct wl1271_cmd_header header; - - u8 role_id; - u8 padding[3]; -} __packed; - -/* Used to check radio status after calibration */ -#define MAX_TLV_LENGTH 500 -#define TEST_CMD_P2G_CAL 2 /* TX BiP */ - -struct wl1271_cmd_cal_p2g { - struct wl1271_cmd_header header; - - struct wl1271_cmd_test_header test; - - __le32 ver; - __le16 len; - u8 buf[MAX_TLV_LENGTH]; - u8 type; - u8 padding; - - __le16 radio_status; - - u8 sub_band_mask; - u8 padding2; -} __packed; - -#endif /* __WL1271_CMD_H__ */ diff --git a/drivers/net/wireless/ti/wlcore/conf.h b/drivers/net/wireless/ti/wlcore/conf.h deleted file mode 100644 index 2b96ff821341..000000000000 --- a/drivers/net/wireless/ti/wlcore/conf.h +++ /dev/null @@ -1,1384 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __CONF_H__ -#define __CONF_H__ - -enum { - CONF_HW_BIT_RATE_1MBPS = BIT(0), - CONF_HW_BIT_RATE_2MBPS = BIT(1), - CONF_HW_BIT_RATE_5_5MBPS = BIT(2), - CONF_HW_BIT_RATE_6MBPS = BIT(3), - CONF_HW_BIT_RATE_9MBPS = BIT(4), - CONF_HW_BIT_RATE_11MBPS = BIT(5), - CONF_HW_BIT_RATE_12MBPS = BIT(6), - CONF_HW_BIT_RATE_18MBPS = BIT(7), - CONF_HW_BIT_RATE_22MBPS = BIT(8), - CONF_HW_BIT_RATE_24MBPS = BIT(9), - CONF_HW_BIT_RATE_36MBPS = BIT(10), - CONF_HW_BIT_RATE_48MBPS = BIT(11), - CONF_HW_BIT_RATE_54MBPS = BIT(12), - CONF_HW_BIT_RATE_MCS_0 = BIT(13), - CONF_HW_BIT_RATE_MCS_1 = BIT(14), - CONF_HW_BIT_RATE_MCS_2 = BIT(15), - CONF_HW_BIT_RATE_MCS_3 = BIT(16), - CONF_HW_BIT_RATE_MCS_4 = BIT(17), - CONF_HW_BIT_RATE_MCS_5 = BIT(18), - CONF_HW_BIT_RATE_MCS_6 = BIT(19), - CONF_HW_BIT_RATE_MCS_7 = BIT(20), - CONF_HW_BIT_RATE_MCS_8 = BIT(21), - CONF_HW_BIT_RATE_MCS_9 = BIT(22), - CONF_HW_BIT_RATE_MCS_10 = BIT(23), - CONF_HW_BIT_RATE_MCS_11 = BIT(24), - CONF_HW_BIT_RATE_MCS_12 = BIT(25), - CONF_HW_BIT_RATE_MCS_13 = BIT(26), - CONF_HW_BIT_RATE_MCS_14 = BIT(27), - CONF_HW_BIT_RATE_MCS_15 = BIT(28), -}; - -enum { - CONF_HW_RATE_INDEX_1MBPS = 0, - CONF_HW_RATE_INDEX_2MBPS = 1, - CONF_HW_RATE_INDEX_5_5MBPS = 2, - CONF_HW_RATE_INDEX_11MBPS = 3, - CONF_HW_RATE_INDEX_6MBPS = 4, - CONF_HW_RATE_INDEX_9MBPS = 5, - CONF_HW_RATE_INDEX_12MBPS = 6, - CONF_HW_RATE_INDEX_18MBPS = 7, - CONF_HW_RATE_INDEX_24MBPS = 8, - CONF_HW_RATE_INDEX_36MBPS = 9, - CONF_HW_RATE_INDEX_48MBPS = 10, - CONF_HW_RATE_INDEX_54MBPS = 11, - CONF_HW_RATE_INDEX_MCS0 = 12, - CONF_HW_RATE_INDEX_MCS1 = 13, - CONF_HW_RATE_INDEX_MCS2 = 14, - CONF_HW_RATE_INDEX_MCS3 = 15, - CONF_HW_RATE_INDEX_MCS4 = 16, - CONF_HW_RATE_INDEX_MCS5 = 17, - CONF_HW_RATE_INDEX_MCS6 = 18, - CONF_HW_RATE_INDEX_MCS7 = 19, - CONF_HW_RATE_INDEX_MCS7_SGI = 20, - CONF_HW_RATE_INDEX_MCS0_40MHZ = 21, - CONF_HW_RATE_INDEX_MCS1_40MHZ = 22, - CONF_HW_RATE_INDEX_MCS2_40MHZ = 23, - CONF_HW_RATE_INDEX_MCS3_40MHZ = 24, - CONF_HW_RATE_INDEX_MCS4_40MHZ = 25, - CONF_HW_RATE_INDEX_MCS5_40MHZ = 26, - CONF_HW_RATE_INDEX_MCS6_40MHZ = 27, - CONF_HW_RATE_INDEX_MCS7_40MHZ = 28, - CONF_HW_RATE_INDEX_MCS7_40MHZ_SGI = 29, - - /* MCS8+ rates overlap with 40Mhz rates */ - CONF_HW_RATE_INDEX_MCS8 = 21, - CONF_HW_RATE_INDEX_MCS9 = 22, - CONF_HW_RATE_INDEX_MCS10 = 23, - CONF_HW_RATE_INDEX_MCS11 = 24, - CONF_HW_RATE_INDEX_MCS12 = 25, - CONF_HW_RATE_INDEX_MCS13 = 26, - CONF_HW_RATE_INDEX_MCS14 = 27, - CONF_HW_RATE_INDEX_MCS15 = 28, - CONF_HW_RATE_INDEX_MCS15_SGI = 29, - - CONF_HW_RATE_INDEX_MAX = CONF_HW_RATE_INDEX_MCS7_40MHZ_SGI, -}; - -#define CONF_HW_RXTX_RATE_UNSUPPORTED 0xff - -enum { - CONF_SG_DISABLE = 0, - CONF_SG_PROTECTIVE, - CONF_SG_OPPORTUNISTIC -}; - -enum { - /* - * Configure the min and max time BT gains the antenna - * in WLAN / BT master basic rate - * - * Range: 0 - 255 (ms) - */ - CONF_SG_ACL_BT_MASTER_MIN_BR = 0, - CONF_SG_ACL_BT_MASTER_MAX_BR, - - /* - * Configure the min and max time BT gains the antenna - * in WLAN / BT slave basic rate - * - * Range: 0 - 255 (ms) - */ - CONF_SG_ACL_BT_SLAVE_MIN_BR, - CONF_SG_ACL_BT_SLAVE_MAX_BR, - - /* - * Configure the min and max time BT gains the antenna - * in WLAN / BT master EDR - * - * Range: 0 - 255 (ms) - */ - CONF_SG_ACL_BT_MASTER_MIN_EDR, - CONF_SG_ACL_BT_MASTER_MAX_EDR, - - /* - * Configure the min and max time BT gains the antenna - * in WLAN / BT slave EDR - * - * Range: 0 - 255 (ms) - */ - CONF_SG_ACL_BT_SLAVE_MIN_EDR, - CONF_SG_ACL_BT_SLAVE_MAX_EDR, - - /* - * The maximum time WLAN can gain the antenna - * in WLAN PSM / BT master/slave BR - * - * Range: 0 - 255 (ms) - */ - CONF_SG_ACL_WLAN_PS_MASTER_BR, - CONF_SG_ACL_WLAN_PS_SLAVE_BR, - - /* - * The maximum time WLAN can gain the antenna - * in WLAN PSM / BT master/slave EDR - * - * Range: 0 - 255 (ms) - */ - CONF_SG_ACL_WLAN_PS_MASTER_EDR, - CONF_SG_ACL_WLAN_PS_SLAVE_EDR, - - /* TODO: explain these values */ - CONF_SG_ACL_WLAN_ACTIVE_MASTER_MIN_BR, - CONF_SG_ACL_WLAN_ACTIVE_MASTER_MAX_BR, - CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MIN_BR, - CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MAX_BR, - CONF_SG_ACL_WLAN_ACTIVE_MASTER_MIN_EDR, - CONF_SG_ACL_WLAN_ACTIVE_MASTER_MAX_EDR, - CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MIN_EDR, - CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MAX_EDR, - - CONF_SG_ACL_ACTIVE_SCAN_WLAN_BR, - CONF_SG_ACL_ACTIVE_SCAN_WLAN_EDR, - CONF_SG_ACL_PASSIVE_SCAN_BT_BR, - CONF_SG_ACL_PASSIVE_SCAN_WLAN_BR, - CONF_SG_ACL_PASSIVE_SCAN_BT_EDR, - CONF_SG_ACL_PASSIVE_SCAN_WLAN_EDR, - - /* - * Compensation percentage of probe requests when scan initiated - * during BT voice/ACL link. - * - * Range: 0 - 255 (%) - */ - CONF_SG_AUTO_SCAN_PROBE_REQ, - - /* - * Compensation percentage of probe requests when active scan initiated - * during BT voice - * - * Range: 0 - 255 (%) - */ - CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_HV3, - - /* - * Compensation percentage of WLAN active scan window if initiated - * during BT A2DP - * - * Range: 0 - 1000 (%) - */ - CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_A2DP, - - /* - * Compensation percentage of WLAN passive scan window if initiated - * during BT A2DP BR - * - * Range: 0 - 1000 (%) - */ - CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_A2DP_BR, - - /* - * Compensation percentage of WLAN passive scan window if initiated - * during BT A2DP EDR - * - * Range: 0 - 1000 (%) - */ - CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_A2DP_EDR, - - /* - * Compensation percentage of WLAN passive scan window if initiated - * during BT voice - * - * Range: 0 - 1000 (%) - */ - CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_HV3, - - /* TODO: explain these values */ - CONF_SG_CONSECUTIVE_HV3_IN_PASSIVE_SCAN, - CONF_SG_BCN_HV3_COLLISION_THRESH_IN_PASSIVE_SCAN, - CONF_SG_TX_RX_PROTECTION_BWIDTH_IN_PASSIVE_SCAN, - - /* - * Defines whether the SG will force WLAN host to enter/exit PSM - * - * Range: 1 - SG can force, 0 - host handles PSM - */ - CONF_SG_STA_FORCE_PS_IN_BT_SCO, - - /* - * Defines antenna configuration (single/dual antenna) - * - * Range: 0 - single antenna, 1 - dual antenna - */ - CONF_SG_ANTENNA_CONFIGURATION, - - /* - * The threshold (percent) of max consecutive beacon misses before - * increasing priority of beacon reception. - * - * Range: 0 - 100 (%) - */ - CONF_SG_BEACON_MISS_PERCENT, - - /* - * Protection time of the DHCP procedure. - * - * Range: 0 - 100000 (ms) - */ - CONF_SG_DHCP_TIME, - - /* - * RX guard time before the beginning of a new BT voice frame during - * which no new WLAN trigger frame is transmitted. - * - * Range: 0 - 100000 (us) - */ - CONF_SG_RXT, - - /* - * TX guard time before the beginning of a new BT voice frame during - * which no new WLAN frame is transmitted. - * - * Range: 0 - 100000 (us) - */ - - CONF_SG_TXT, - - /* - * Enable adaptive RXT/TXT algorithm. If disabled, the host values - * will be utilized. - * - * Range: 0 - disable, 1 - enable - */ - CONF_SG_ADAPTIVE_RXT_TXT, - - /* TODO: explain this value */ - CONF_SG_GENERAL_USAGE_BIT_MAP, - - /* - * Number of consecutive BT voice frames not interrupted by WLAN - * - * Range: 0 - 100 - */ - CONF_SG_HV3_MAX_SERVED, - - /* - * The used WLAN legacy service period during active BT ACL link - * - * Range: 0 - 255 (ms) - */ - CONF_SG_PS_POLL_TIMEOUT, - - /* - * The used WLAN UPSD service period during active BT ACL link - * - * Range: 0 - 255 (ms) - */ - CONF_SG_UPSD_TIMEOUT, - - CONF_SG_CONSECUTIVE_CTS_THRESHOLD, - CONF_SG_STA_RX_WINDOW_AFTER_DTIM, - CONF_SG_STA_CONNECTION_PROTECTION_TIME, - - /* AP params */ - CONF_AP_BEACON_MISS_TX, - CONF_AP_RX_WINDOW_AFTER_BEACON, - CONF_AP_BEACON_WINDOW_INTERVAL, - CONF_AP_CONNECTION_PROTECTION_TIME, - CONF_AP_BT_ACL_VAL_BT_SERVE_TIME, - CONF_AP_BT_ACL_VAL_WL_SERVE_TIME, - - /* CTS Diluting params */ - CONF_SG_CTS_DILUTED_BAD_RX_PACKETS_TH, - CONF_SG_CTS_CHOP_IN_DUAL_ANT_SCO_MASTER, - - CONF_SG_TEMP_PARAM_1, - CONF_SG_TEMP_PARAM_2, - CONF_SG_TEMP_PARAM_3, - CONF_SG_TEMP_PARAM_4, - CONF_SG_TEMP_PARAM_5, - CONF_SG_TEMP_PARAM_6, - CONF_SG_TEMP_PARAM_7, - CONF_SG_TEMP_PARAM_8, - CONF_SG_TEMP_PARAM_9, - CONF_SG_TEMP_PARAM_10, - - CONF_SG_PARAMS_MAX, - CONF_SG_PARAMS_ALL = 0xff -}; - -struct conf_sg_settings { - u32 params[CONF_SG_PARAMS_MAX]; - u8 state; -} __packed; - -enum conf_rx_queue_type { - CONF_RX_QUEUE_TYPE_LOW_PRIORITY, /* All except the high priority */ - CONF_RX_QUEUE_TYPE_HIGH_PRIORITY, /* Management and voice packets */ -}; - -struct conf_rx_settings { - /* - * The maximum amount of time, in TU, before the - * firmware discards the MSDU. - * - * Range: 0 - 0xFFFFFFFF - */ - u32 rx_msdu_life_time; - - /* - * Packet detection threshold in the PHY. - * - * FIXME: details unknown. - */ - u32 packet_detection_threshold; - - /* - * The longest time the STA will wait to receive traffic from the AP - * after a PS-poll has been transmitted. - * - * Range: 0 - 200000 - */ - u16 ps_poll_timeout; - /* - * The longest time the STA will wait to receive traffic from the AP - * after a frame has been sent from an UPSD enabled queue. - * - * Range: 0 - 200000 - */ - u16 upsd_timeout; - - /* - * The number of octets in an MPDU, below which an RTS/CTS - * handshake is not performed. - * - * Range: 0 - 4096 - */ - u16 rts_threshold; - - /* - * The RX Clear Channel Assessment threshold in the PHY - * (the energy threshold). - * - * Range: ENABLE_ENERGY_D == 0x140A - * DISABLE_ENERGY_D == 0xFFEF - */ - u16 rx_cca_threshold; - - /* - * Occupied Rx mem-blocks number which requires interrupting the host - * (0 = no buffering, 0xffff = disabled). - * - * Range: u16 - */ - u16 irq_blk_threshold; - - /* - * Rx packets number which requires interrupting the host - * (0 = no buffering). - * - * Range: u16 - */ - u16 irq_pkt_threshold; - - /* - * Max time in msec the FW may delay RX-Complete interrupt. - * - * Range: 1 - 100 - */ - u16 irq_timeout; - - /* - * The RX queue type. - * - * Range: RX_QUEUE_TYPE_RX_LOW_PRIORITY, RX_QUEUE_TYPE_RX_HIGH_PRIORITY, - */ - u8 queue_type; -} __packed; - -#define CONF_TX_MAX_RATE_CLASSES 10 - -#define CONF_TX_RATE_MASK_UNSPECIFIED 0 -#define CONF_TX_RATE_MASK_BASIC (CONF_HW_BIT_RATE_1MBPS | \ - CONF_HW_BIT_RATE_2MBPS) -#define CONF_TX_RATE_RETRY_LIMIT 10 - -/* basic rates for p2p operations (probe req/resp, etc.) */ -#define CONF_TX_RATE_MASK_BASIC_P2P CONF_HW_BIT_RATE_6MBPS - -/* - * Rates supported for data packets when operating as STA/AP. Note the absence - * of the 22Mbps rate. There is a FW limitation on 12 rates so we must drop - * one. The rate dropped is not mandatory under any operating mode. - */ -#define CONF_TX_ENABLED_RATES (CONF_HW_BIT_RATE_1MBPS | \ - CONF_HW_BIT_RATE_2MBPS | CONF_HW_BIT_RATE_5_5MBPS | \ - CONF_HW_BIT_RATE_6MBPS | CONF_HW_BIT_RATE_9MBPS | \ - CONF_HW_BIT_RATE_11MBPS | CONF_HW_BIT_RATE_12MBPS | \ - CONF_HW_BIT_RATE_18MBPS | CONF_HW_BIT_RATE_24MBPS | \ - CONF_HW_BIT_RATE_36MBPS | CONF_HW_BIT_RATE_48MBPS | \ - CONF_HW_BIT_RATE_54MBPS) - -#define CONF_TX_CCK_RATES (CONF_HW_BIT_RATE_1MBPS | \ - CONF_HW_BIT_RATE_2MBPS | CONF_HW_BIT_RATE_5_5MBPS | \ - CONF_HW_BIT_RATE_11MBPS) - -#define CONF_TX_OFDM_RATES (CONF_HW_BIT_RATE_6MBPS | \ - CONF_HW_BIT_RATE_12MBPS | CONF_HW_BIT_RATE_24MBPS | \ - CONF_HW_BIT_RATE_36MBPS | CONF_HW_BIT_RATE_48MBPS | \ - CONF_HW_BIT_RATE_54MBPS) - -#define CONF_TX_MCS_RATES (CONF_HW_BIT_RATE_MCS_0 | \ - CONF_HW_BIT_RATE_MCS_1 | CONF_HW_BIT_RATE_MCS_2 | \ - CONF_HW_BIT_RATE_MCS_3 | CONF_HW_BIT_RATE_MCS_4 | \ - CONF_HW_BIT_RATE_MCS_5 | CONF_HW_BIT_RATE_MCS_6 | \ - CONF_HW_BIT_RATE_MCS_7) - -#define CONF_TX_MIMO_RATES (CONF_HW_BIT_RATE_MCS_8 | \ - CONF_HW_BIT_RATE_MCS_9 | CONF_HW_BIT_RATE_MCS_10 | \ - CONF_HW_BIT_RATE_MCS_11 | CONF_HW_BIT_RATE_MCS_12 | \ - CONF_HW_BIT_RATE_MCS_13 | CONF_HW_BIT_RATE_MCS_14 | \ - CONF_HW_BIT_RATE_MCS_15) - -/* - * Default rates for management traffic when operating in AP mode. This - * should be configured according to the basic rate set of the AP - */ -#define CONF_TX_AP_DEFAULT_MGMT_RATES (CONF_HW_BIT_RATE_1MBPS | \ - CONF_HW_BIT_RATE_2MBPS | CONF_HW_BIT_RATE_5_5MBPS) - -/* default rates for working as IBSS (11b and OFDM) */ -#define CONF_TX_IBSS_DEFAULT_RATES (CONF_HW_BIT_RATE_1MBPS | \ - CONF_HW_BIT_RATE_2MBPS | CONF_HW_BIT_RATE_5_5MBPS | \ - CONF_HW_BIT_RATE_11MBPS | CONF_TX_OFDM_RATES); - -struct conf_tx_rate_class { - - /* - * The rates enabled for this rate class. - * - * Range: CONF_HW_BIT_RATE_* bit mask - */ - u32 enabled_rates; - - /* - * The dot11 short retry limit used for TX retries. - * - * Range: u8 - */ - u8 short_retry_limit; - - /* - * The dot11 long retry limit used for TX retries. - * - * Range: u8 - */ - u8 long_retry_limit; - - /* - * Flags controlling the attributes of TX transmission. - * - * Range: bit 0: Truncate - when set, FW attempts to send a frame stop - * when the total valid per-rate attempts have - * been exhausted; otherwise transmissions - * will continue at the lowest available rate - * until the appropriate one of the - * short_retry_limit, long_retry_limit, - * dot11_max_transmit_msdu_life_time, or - * max_tx_life_time, is exhausted. - * 1: Preamble Override - indicates if the preamble type - * should be used in TX. - * 2: Preamble Type - the type of the preamble to be used by - * the policy (0 - long preamble, 1 - short preamble. - */ - u8 aflags; -} __packed; - -#define CONF_TX_MAX_AC_COUNT 4 - -/* Slot number setting to start transmission at PIFS interval */ -#define CONF_TX_AIFS_PIFS 1 -/* Slot number setting to start transmission at DIFS interval normal - * DCF access */ -#define CONF_TX_AIFS_DIFS 2 - - -enum conf_tx_ac { - CONF_TX_AC_BE = 0, /* best effort / legacy */ - CONF_TX_AC_BK = 1, /* background */ - CONF_TX_AC_VI = 2, /* video */ - CONF_TX_AC_VO = 3, /* voice */ - CONF_TX_AC_CTS2SELF = 4, /* fictitious AC, follows AC_VO */ - CONF_TX_AC_ANY_TID = 0xff -}; - -struct conf_tx_ac_category { - /* - * The AC class identifier. - * - * Range: enum conf_tx_ac - */ - u8 ac; - - /* - * The contention window minimum size (in slots) for the access - * class. - * - * Range: u8 - */ - u8 cw_min; - - /* - * The contention window maximum size (in slots) for the access - * class. - * - * Range: u8 - */ - u16 cw_max; - - /* - * The AIF value (in slots) for the access class. - * - * Range: u8 - */ - u8 aifsn; - - /* - * The TX Op Limit (in microseconds) for the access class. - * - * Range: u16 - */ - u16 tx_op_limit; -} __packed; - -#define CONF_TX_MAX_TID_COUNT 8 - -/* Allow TX BA on all TIDs but 6,7. These are currently reserved in the FW */ -#define CONF_TX_BA_ENABLED_TID_BITMAP 0x3F - -enum { - CONF_CHANNEL_TYPE_DCF = 0, /* DC/LEGACY*/ - CONF_CHANNEL_TYPE_EDCF = 1, /* EDCA*/ - CONF_CHANNEL_TYPE_HCCA = 2, /* HCCA*/ -}; - -enum { - CONF_PS_SCHEME_LEGACY = 0, - CONF_PS_SCHEME_UPSD_TRIGGER = 1, - CONF_PS_SCHEME_LEGACY_PSPOLL = 2, - CONF_PS_SCHEME_SAPSD = 3, -}; - -enum { - CONF_ACK_POLICY_LEGACY = 0, - CONF_ACK_POLICY_NO_ACK = 1, - CONF_ACK_POLICY_BLOCK = 2, -}; - - -struct conf_tx_tid { - u8 queue_id; - u8 channel_type; - u8 tsid; - u8 ps_scheme; - u8 ack_policy; - u32 apsd_conf[2]; -} __packed; - -struct conf_tx_settings { - /* - * The TX ED value for TELEC Enable/Disable. - * - * Range: 0, 1 - */ - u8 tx_energy_detection; - - /* - * Configuration for rate classes for TX (currently only one - * rate class supported). Used in non-AP mode. - */ - struct conf_tx_rate_class sta_rc_conf; - - /* - * Configuration for access categories for TX rate control. - */ - u8 ac_conf_count; - struct conf_tx_ac_category ac_conf[CONF_TX_MAX_AC_COUNT]; - - /* - * AP-mode - allow this number of TX retries to a station before an - * event is triggered from FW. - * In AP-mode the hlids of unreachable stations are given in the - * "sta_tx_retry_exceeded" member in the event mailbox. - */ - u8 max_tx_retries; - - /* - * AP-mode - after this number of seconds a connected station is - * considered inactive. - */ - u16 ap_aging_period; - - /* - * Configuration for TID parameters. - */ - u8 tid_conf_count; - struct conf_tx_tid tid_conf[CONF_TX_MAX_TID_COUNT]; - - /* - * The TX fragmentation threshold. - * - * Range: u16 - */ - u16 frag_threshold; - - /* - * Max time in msec the FW may delay frame TX-Complete interrupt. - * - * Range: u16 - */ - u16 tx_compl_timeout; - - /* - * Completed TX packet count which requires to issue the TX-Complete - * interrupt. - * - * Range: u16 - */ - u16 tx_compl_threshold; - - /* - * The rate used for control messages and scanning on the 2.4GHz band - * - * Range: CONF_HW_BIT_RATE_* bit mask - */ - u32 basic_rate; - - /* - * The rate used for control messages and scanning on the 5GHz band - * - * Range: CONF_HW_BIT_RATE_* bit mask - */ - u32 basic_rate_5; - - /* - * TX retry limits for templates - */ - u8 tmpl_short_retry_limit; - u8 tmpl_long_retry_limit; - - /* Time in ms for Tx watchdog timer to expire */ - u32 tx_watchdog_timeout; - - /* - * when a slow link has this much packets pending, it becomes a low - * priority link, scheduling-wise - */ - u8 slow_link_thold; - - /* - * when a fast link has this much packets pending, it becomes a low - * priority link, scheduling-wise - */ - u8 fast_link_thold; -} __packed; - -enum { - CONF_WAKE_UP_EVENT_BEACON = 0x01, /* Wake on every Beacon*/ - CONF_WAKE_UP_EVENT_DTIM = 0x02, /* Wake on every DTIM*/ - CONF_WAKE_UP_EVENT_N_DTIM = 0x04, /* Wake every Nth DTIM */ - CONF_WAKE_UP_EVENT_N_BEACONS = 0x08, /* Wake every Nth beacon */ - CONF_WAKE_UP_EVENT_BITS_MASK = 0x0F -}; - -#define CONF_MAX_BCN_FILT_IE_COUNT 32 - -#define CONF_BCN_RULE_PASS_ON_CHANGE BIT(0) -#define CONF_BCN_RULE_PASS_ON_APPEARANCE BIT(1) - -#define CONF_BCN_IE_OUI_LEN 3 -#define CONF_BCN_IE_VER_LEN 2 - -struct conf_bcn_filt_rule { - /* - * IE number to which to associate a rule. - * - * Range: u8 - */ - u8 ie; - - /* - * Rule to associate with the specific ie. - * - * Range: CONF_BCN_RULE_PASS_ON_* - */ - u8 rule; - - /* - * OUI for the vendor specifie IE (221) - */ - u8 oui[CONF_BCN_IE_OUI_LEN]; - - /* - * Type for the vendor specifie IE (221) - */ - u8 type; - - /* - * Version for the vendor specifie IE (221) - */ - u8 version[CONF_BCN_IE_VER_LEN]; -} __packed; - -#define CONF_MAX_RSSI_SNR_TRIGGERS 8 - -enum { - CONF_TRIG_METRIC_RSSI_BEACON = 0, - CONF_TRIG_METRIC_RSSI_DATA, - CONF_TRIG_METRIC_SNR_BEACON, - CONF_TRIG_METRIC_SNR_DATA -}; - -enum { - CONF_TRIG_EVENT_TYPE_LEVEL = 0, - CONF_TRIG_EVENT_TYPE_EDGE -}; - -enum { - CONF_TRIG_EVENT_DIR_LOW = 0, - CONF_TRIG_EVENT_DIR_HIGH, - CONF_TRIG_EVENT_DIR_BIDIR -}; - -struct conf_sig_weights { - - /* - * RSSI from beacons average weight. - * - * Range: u8 - */ - u8 rssi_bcn_avg_weight; - - /* - * RSSI from data average weight. - * - * Range: u8 - */ - u8 rssi_pkt_avg_weight; - - /* - * SNR from beacons average weight. - * - * Range: u8 - */ - u8 snr_bcn_avg_weight; - - /* - * SNR from data average weight. - * - * Range: u8 - */ - u8 snr_pkt_avg_weight; -} __packed; - -enum conf_bcn_filt_mode { - CONF_BCN_FILT_MODE_DISABLED = 0, - CONF_BCN_FILT_MODE_ENABLED = 1 -}; - -enum conf_bet_mode { - CONF_BET_MODE_DISABLE = 0, - CONF_BET_MODE_ENABLE = 1, -}; - -struct conf_conn_settings { - /* - * Firmware wakeup conditions configuration. The host may set only - * one bit. - * - * Range: CONF_WAKE_UP_EVENT_* - */ - u8 wake_up_event; - - /* - * Listen interval for beacons or Dtims. - * - * Range: 0 for beacon and Dtim wakeup - * 1-10 for x Dtims - * 1-255 for x beacons - */ - u8 listen_interval; - - /* - * Firmware wakeup conditions during suspend - * Range: CONF_WAKE_UP_EVENT_* - */ - u8 suspend_wake_up_event; - - /* - * Listen interval during suspend. - * Currently will be in DTIMs (1-10) - * - */ - u8 suspend_listen_interval; - - /* - * Enable or disable the beacon filtering. - * - * Range: CONF_BCN_FILT_MODE_* - */ - u8 bcn_filt_mode; - - /* - * Configure Beacon filter pass-thru rules. - */ - u8 bcn_filt_ie_count; - struct conf_bcn_filt_rule bcn_filt_ie[CONF_MAX_BCN_FILT_IE_COUNT]; - - /* - * The number of consecutive beacons to lose, before the firmware - * becomes out of synch. - * - * Range: u32 - */ - u32 synch_fail_thold; - - /* - * After out-of-synch, the number of TU's to wait without a further - * received beacon (or probe response) before issuing the BSS_EVENT_LOSE - * event. - * - * Range: u32 - */ - u32 bss_lose_timeout; - - /* - * Beacon receive timeout. - * - * Range: u32 - */ - u32 beacon_rx_timeout; - - /* - * Broadcast receive timeout. - * - * Range: u32 - */ - u32 broadcast_timeout; - - /* - * Enable/disable reception of broadcast packets in power save mode - * - * Range: 1 - enable, 0 - disable - */ - u8 rx_broadcast_in_ps; - - /* - * Consecutive PS Poll failures before sending event to driver - * - * Range: u8 - */ - u8 ps_poll_threshold; - - /* - * Configuration of signal average weights. - */ - struct conf_sig_weights sig_weights; - - /* - * Specifies if beacon early termination procedure is enabled or - * disabled. - * - * Range: CONF_BET_MODE_* - */ - u8 bet_enable; - - /* - * Specifies the maximum number of consecutive beacons that may be - * early terminated. After this number is reached at least one full - * beacon must be correctly received in FW before beacon ET - * resumes. - * - * Range 0 - 255 - */ - u8 bet_max_consecutive; - - /* - * Specifies the maximum number of times to try PSM entry if it fails - * (if sending the appropriate null-func message fails.) - * - * Range 0 - 255 - */ - u8 psm_entry_retries; - - /* - * Specifies the maximum number of times to try PSM exit if it fails - * (if sending the appropriate null-func message fails.) - * - * Range 0 - 255 - */ - u8 psm_exit_retries; - - /* - * Specifies the maximum number of times to try transmit the PSM entry - * null-func frame for each PSM entry attempt - * - * Range 0 - 255 - */ - u8 psm_entry_nullfunc_retries; - - /* - * Specifies the dynamic PS timeout in ms that will be used - * by the FW when in AUTO_PS mode - */ - u16 dynamic_ps_timeout; - - /* - * Specifies whether dynamic PS should be disabled and PSM forced. - * This is required for certain WiFi certification tests. - */ - u8 forced_ps; - - /* - * - * Specifies the interval of the connection keep-alive null-func - * frame in ms. - * - * Range: 1000 - 3600000 - */ - u32 keep_alive_interval; - - /* - * Maximum listen interval supported by the driver in units of beacons. - * - * Range: u16 - */ - u8 max_listen_interval; - - /* - * Default sleep authorization for a new STA interface. This determines - * whether we can go to ELP. - */ - u8 sta_sleep_auth; -} __packed; - -enum { - CONF_REF_CLK_19_2_E, - CONF_REF_CLK_26_E, - CONF_REF_CLK_38_4_E, - CONF_REF_CLK_52_E, - CONF_REF_CLK_38_4_M_XTAL, - CONF_REF_CLK_26_M_XTAL, -}; - -enum single_dual_band_enum { - CONF_SINGLE_BAND, - CONF_DUAL_BAND -}; - -#define CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE 15 -#define CONF_NUMBER_OF_SUB_BANDS_5 7 -#define CONF_NUMBER_OF_RATE_GROUPS 6 -#define CONF_NUMBER_OF_CHANNELS_2_4 14 -#define CONF_NUMBER_OF_CHANNELS_5 35 - -struct conf_itrim_settings { - /* enable dco itrim */ - u8 enable; - - /* moderation timeout in microsecs from the last TX */ - u32 timeout; -} __packed; - -enum conf_fast_wakeup { - CONF_FAST_WAKEUP_ENABLE, - CONF_FAST_WAKEUP_DISABLE, -}; - -struct conf_pm_config_settings { - /* - * Host clock settling time - * - * Range: 0 - 30000 us - */ - u32 host_clk_settling_time; - - /* - * Host fast wakeup support - * - * Range: enum conf_fast_wakeup - */ - u8 host_fast_wakeup_support; -} __packed; - -struct conf_roam_trigger_settings { - /* - * The minimum interval between two trigger events. - * - * Range: 0 - 60000 ms - */ - u16 trigger_pacing; - - /* - * The weight for rssi/beacon average calculation - * - * Range: 0 - 255 - */ - u8 avg_weight_rssi_beacon; - - /* - * The weight for rssi/data frame average calculation - * - * Range: 0 - 255 - */ - u8 avg_weight_rssi_data; - - /* - * The weight for snr/beacon average calculation - * - * Range: 0 - 255 - */ - u8 avg_weight_snr_beacon; - - /* - * The weight for snr/data frame average calculation - * - * Range: 0 - 255 - */ - u8 avg_weight_snr_data; -} __packed; - -struct conf_scan_settings { - /* - * The minimum time to wait on each channel for active scans - * This value will be used whenever there's a connected interface. - * - * Range: u32 tu/1000 - */ - u32 min_dwell_time_active; - - /* - * The maximum time to wait on each channel for active scans - * This value will be currently used whenever there's a - * connected interface. It shouldn't exceed 30000 (~30ms) to avoid - * possible interference of voip traffic going on while scanning. - * - * Range: u32 tu/1000 - */ - u32 max_dwell_time_active; - - /* The minimum time to wait on each channel for active scans - * when it's possible to have longer scan dwell times. - * Currently this is used whenever we're idle on all interfaces. - * Longer dwell times improve detection of networks within a - * single scan. - * - * Range: u32 tu/1000 - */ - u32 min_dwell_time_active_long; - - /* The maximum time to wait on each channel for active scans - * when it's possible to have longer scan dwell times. - * See min_dwell_time_active_long - * - * Range: u32 tu/1000 - */ - u32 max_dwell_time_active_long; - - /* time to wait on the channel for passive scans (in TU/1000) */ - u32 dwell_time_passive; - - /* time to wait on the channel for DFS scans (in TU/1000) */ - u32 dwell_time_dfs; - - /* - * Number of probe requests to transmit on each active scan channel - * - * Range: u8 - */ - u16 num_probe_reqs; - - /* - * Scan trigger (split scan) timeout. The FW will split the scan - * operation into slices of the given time and allow the FW to schedule - * other tasks in between. - * - * Range: u32 Microsecs - */ - u32 split_scan_timeout; -} __packed; - -struct conf_sched_scan_settings { - /* - * The base time to wait on the channel for active scans (in TU/1000). - * The minimum dwell time is calculated according to this: - * min_dwell_time = base + num_of_probes_to_be_sent * delta_per_probe - * The maximum dwell time is calculated according to this: - * max_dwell_time = min_dwell_time + max_dwell_time_delta - */ - u32 base_dwell_time; - - /* The delta between the min dwell time and max dwell time for - * active scans (in TU/1000s). The max dwell time is used by the FW once - * traffic is detected on the channel. - */ - u32 max_dwell_time_delta; - - /* Delta added to min dwell time per each probe in 2.4 GHz (TU/1000) */ - u32 dwell_time_delta_per_probe; - - /* Delta added to min dwell time per each probe in 5 GHz (TU/1000) */ - u32 dwell_time_delta_per_probe_5; - - /* time to wait on the channel for passive scans (in TU/1000) */ - u32 dwell_time_passive; - - /* time to wait on the channel for DFS scans (in TU/1000) */ - u32 dwell_time_dfs; - - /* number of probe requests to send on each channel in active scans */ - u8 num_probe_reqs; - - /* RSSI threshold to be used for filtering */ - s8 rssi_threshold; - - /* SNR threshold to be used for filtering */ - s8 snr_threshold; -} __packed; - -struct conf_ht_setting { - u8 rx_ba_win_size; - u8 tx_ba_win_size; - u16 inactivity_timeout; - - /* bitmap of enabled TIDs for TX BA sessions */ - u8 tx_ba_tid_bitmap; -} __packed; - -struct conf_memory_settings { - /* Number of stations supported in IBSS mode */ - u8 num_stations; - - /* Number of ssid profiles used in IBSS mode */ - u8 ssid_profiles; - - /* Number of memory buffers allocated to rx pool */ - u8 rx_block_num; - - /* Minimum number of blocks allocated to tx pool */ - u8 tx_min_block_num; - - /* Disable/Enable dynamic memory */ - u8 dynamic_memory; - - /* - * Minimum required free tx memory blocks in order to assure optimum - * performance - * - * Range: 0-120 - */ - u8 min_req_tx_blocks; - - /* - * Minimum required free rx memory blocks in order to assure optimum - * performance - * - * Range: 0-120 - */ - u8 min_req_rx_blocks; - - /* - * Minimum number of mem blocks (free+used) guaranteed for TX - * - * Range: 0-120 - */ - u8 tx_min; -} __packed; - -struct conf_fm_coex { - u8 enable; - u8 swallow_period; - u8 n_divider_fref_set_1; - u8 n_divider_fref_set_2; - u16 m_divider_fref_set_1; - u16 m_divider_fref_set_2; - u32 coex_pll_stabilization_time; - u16 ldo_stabilization_time; - u8 fm_disturbed_band_margin; - u8 swallow_clk_diff; -} __packed; - -struct conf_rx_streaming_settings { - /* - * RX Streaming duration (in msec) from last tx/rx - * - * Range: u32 - */ - u32 duration; - - /* - * Bitmap of tids to be polled during RX streaming. - * (Note: it doesn't look like it really matters) - * - * Range: 0x1-0xff - */ - u8 queues; - - /* - * RX Streaming interval. - * (Note:this value is also used as the rx streaming timeout) - * Range: 0 (disabled), 10 - 100 - */ - u8 interval; - - /* - * enable rx streaming also when there is no coex activity - */ - u8 always; -} __packed; - -struct conf_fwlog { - /* Continuous or on-demand */ - u8 mode; - - /* - * Number of memory blocks dedicated for the FW logger - * - * Range: 1-3, or 0 to disable the FW logger - */ - u8 mem_blocks; - - /* Minimum log level threshold */ - u8 severity; - - /* Include/exclude timestamps from the log messages */ - u8 timestamp; - - /* See enum wl1271_fwlogger_output */ - u8 output; - - /* Regulates the frequency of log messages */ - u8 threshold; -} __packed; - -#define ACX_RATE_MGMT_NUM_OF_RATES 13 -struct conf_rate_policy_settings { - u16 rate_retry_score; - u16 per_add; - u16 per_th1; - u16 per_th2; - u16 max_per; - u8 inverse_curiosity_factor; - u8 tx_fail_low_th; - u8 tx_fail_high_th; - u8 per_alpha_shift; - u8 per_add_shift; - u8 per_beta1_shift; - u8 per_beta2_shift; - u8 rate_check_up; - u8 rate_check_down; - u8 rate_retry_policy[ACX_RATE_MGMT_NUM_OF_RATES]; -} __packed; - -struct conf_hangover_settings { - u32 recover_time; - u8 hangover_period; - u8 dynamic_mode; - u8 early_termination_mode; - u8 max_period; - u8 min_period; - u8 increase_delta; - u8 decrease_delta; - u8 quiet_time; - u8 increase_time; - u8 window_size; -} __packed; - -struct conf_recovery_settings { - /* BUG() on fw recovery */ - u8 bug_on_recovery; - - /* Prevent HW recovery. FW will remain stuck. */ - u8 no_recovery; -} __packed; - -/* - * The conf version consists of 4 bytes. The two MSB are the wlcore - * version, the two LSB are the lower driver's private conf - * version. - */ -#define WLCORE_CONF_VERSION (0x0005 << 16) -#define WLCORE_CONF_MASK 0xffff0000 -#define WLCORE_CONF_SIZE (sizeof(struct wlcore_conf_header) + \ - sizeof(struct wlcore_conf)) - -struct wlcore_conf_header { - __le32 magic; - __le32 version; - __le32 checksum; -} __packed; - -struct wlcore_conf { - struct conf_sg_settings sg; - struct conf_rx_settings rx; - struct conf_tx_settings tx; - struct conf_conn_settings conn; - struct conf_itrim_settings itrim; - struct conf_pm_config_settings pm_config; - struct conf_roam_trigger_settings roam_trigger; - struct conf_scan_settings scan; - struct conf_sched_scan_settings sched_scan; - struct conf_ht_setting ht; - struct conf_memory_settings mem; - struct conf_fm_coex fm_coex; - struct conf_rx_streaming_settings rx_streaming; - struct conf_fwlog fwlog; - struct conf_rate_policy_settings rate; - struct conf_hangover_settings hangover; - struct conf_recovery_settings recovery; -} __packed; - -struct wlcore_conf_file { - struct wlcore_conf_header header; - struct wlcore_conf core; - u8 priv[0]; -} __packed; - -#endif diff --git a/drivers/net/wireless/ti/wlcore/debug.h b/drivers/net/wireless/ti/wlcore/debug.h deleted file mode 100644 index 0420bd45e4ee..000000000000 --- a/drivers/net/wireless/ti/wlcore/debug.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2011 Texas Instruments. All rights reserved. - * Copyright (C) 2008-2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __DEBUG_H__ -#define __DEBUG_H__ - -#include -#include - -#define DRIVER_NAME "wlcore" -#define DRIVER_PREFIX DRIVER_NAME ": " - -enum { - DEBUG_NONE = 0, - DEBUG_IRQ = BIT(0), - DEBUG_SPI = BIT(1), - DEBUG_BOOT = BIT(2), - DEBUG_MAILBOX = BIT(3), - DEBUG_TESTMODE = BIT(4), - DEBUG_EVENT = BIT(5), - DEBUG_TX = BIT(6), - DEBUG_RX = BIT(7), - DEBUG_SCAN = BIT(8), - DEBUG_CRYPT = BIT(9), - DEBUG_PSM = BIT(10), - DEBUG_MAC80211 = BIT(11), - DEBUG_CMD = BIT(12), - DEBUG_ACX = BIT(13), - DEBUG_SDIO = BIT(14), - DEBUG_FILTERS = BIT(15), - DEBUG_ADHOC = BIT(16), - DEBUG_AP = BIT(17), - DEBUG_PROBE = BIT(18), - DEBUG_IO = BIT(19), - DEBUG_MASTER = (DEBUG_ADHOC | DEBUG_AP), - DEBUG_ALL = ~0, -}; - -extern u32 wl12xx_debug_level; - -#define DEBUG_DUMP_LIMIT 1024 - -#define wl1271_error(fmt, arg...) \ - pr_err(DRIVER_PREFIX "ERROR " fmt "\n", ##arg) - -#define wl1271_warning(fmt, arg...) \ - pr_warning(DRIVER_PREFIX "WARNING " fmt "\n", ##arg) - -#define wl1271_notice(fmt, arg...) \ - pr_info(DRIVER_PREFIX fmt "\n", ##arg) - -#define wl1271_info(fmt, arg...) \ - pr_info(DRIVER_PREFIX fmt "\n", ##arg) - -/* define the debug macro differently if dynamic debug is supported */ -#if defined(CONFIG_DYNAMIC_DEBUG) -#define wl1271_debug(level, fmt, arg...) \ - do { \ - if (unlikely(level & wl12xx_debug_level)) \ - dynamic_pr_debug(DRIVER_PREFIX fmt "\n", ##arg); \ - } while (0) -#else -#define wl1271_debug(level, fmt, arg...) \ - do { \ - if (unlikely(level & wl12xx_debug_level)) \ - printk(KERN_DEBUG pr_fmt(DRIVER_PREFIX fmt "\n"), \ - ##arg); \ - } while (0) -#endif - -#define wl1271_dump(level, prefix, buf, len) \ - do { \ - if (level & wl12xx_debug_level) \ - print_hex_dump_debug(DRIVER_PREFIX prefix, \ - DUMP_PREFIX_OFFSET, 16, 1, \ - buf, \ - min_t(size_t, len, DEBUG_DUMP_LIMIT), \ - 0); \ - } while (0) - -#define wl1271_dump_ascii(level, prefix, buf, len) \ - do { \ - if (level & wl12xx_debug_level) \ - print_hex_dump_debug(DRIVER_PREFIX prefix, \ - DUMP_PREFIX_OFFSET, 16, 1, \ - buf, \ - min_t(size_t, len, DEBUG_DUMP_LIMIT), \ - true); \ - } while (0) - -#endif /* __DEBUG_H__ */ diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c b/drivers/net/wireless/ti/wlcore/debugfs.c deleted file mode 100644 index c3e1f79c7856..000000000000 --- a/drivers/net/wireless/ti/wlcore/debugfs.c +++ /dev/null @@ -1,1330 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "debugfs.h" - -#include -#include -#include - -#include "wlcore.h" -#include "debug.h" -#include "acx.h" -#include "ps.h" -#include "io.h" -#include "tx.h" -#include "hw_ops.h" - -/* ms */ -#define WL1271_DEBUGFS_STATS_LIFETIME 1000 - -#define WLCORE_MAX_BLOCK_SIZE ((size_t)(4*PAGE_SIZE)) - -/* debugfs macros idea from mac80211 */ -int wl1271_format_buffer(char __user *userbuf, size_t count, - loff_t *ppos, char *fmt, ...) -{ - va_list args; - char buf[DEBUGFS_FORMAT_BUFFER_SIZE]; - int res; - - va_start(args, fmt); - res = vscnprintf(buf, sizeof(buf), fmt, args); - va_end(args); - - return simple_read_from_buffer(userbuf, count, ppos, buf, res); -} -EXPORT_SYMBOL_GPL(wl1271_format_buffer); - -void wl1271_debugfs_update_stats(struct wl1271 *wl) -{ - int ret; - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - if (!wl->plt && - time_after(jiffies, wl->stats.fw_stats_update + - msecs_to_jiffies(WL1271_DEBUGFS_STATS_LIFETIME))) { - wl1271_acx_statistics(wl, wl->stats.fw_stats); - wl->stats.fw_stats_update = jiffies; - } - - wl1271_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); -} -EXPORT_SYMBOL_GPL(wl1271_debugfs_update_stats); - -DEBUGFS_READONLY_FILE(retry_count, "%u", wl->stats.retry_count); -DEBUGFS_READONLY_FILE(excessive_retries, "%u", - wl->stats.excessive_retries); - -static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - u32 queue_len; - char buf[20]; - int res; - - queue_len = wl1271_tx_total_queue_count(wl); - - res = scnprintf(buf, sizeof(buf), "%u\n", queue_len); - return simple_read_from_buffer(userbuf, count, ppos, buf, res); -} - -static const struct file_operations tx_queue_len_ops = { - .read = tx_queue_len_read, - .open = simple_open, - .llseek = default_llseek, -}; - -static void chip_op_handler(struct wl1271 *wl, unsigned long value, - void *arg) -{ - int ret; - int (*chip_op) (struct wl1271 *wl); - - if (!arg) { - wl1271_warning("debugfs chip_op_handler with no callback"); - return; - } - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - return; - - chip_op = arg; - chip_op(wl); - - wl1271_ps_elp_sleep(wl); -} - - -static inline void no_write_handler(struct wl1271 *wl, - unsigned long value, - unsigned long param) -{ -} - -#define WL12XX_CONF_DEBUGFS(param, conf_sub_struct, \ - min_val, max_val, write_handler_locked, \ - write_handler_arg) \ - static ssize_t param##_read(struct file *file, \ - char __user *user_buf, \ - size_t count, loff_t *ppos) \ - { \ - struct wl1271 *wl = file->private_data; \ - return wl1271_format_buffer(user_buf, count, \ - ppos, "%d\n", \ - wl->conf.conf_sub_struct.param); \ - } \ - \ - static ssize_t param##_write(struct file *file, \ - const char __user *user_buf, \ - size_t count, loff_t *ppos) \ - { \ - struct wl1271 *wl = file->private_data; \ - unsigned long value; \ - int ret; \ - \ - ret = kstrtoul_from_user(user_buf, count, 10, &value); \ - if (ret < 0) { \ - wl1271_warning("illegal value for " #param); \ - return -EINVAL; \ - } \ - \ - if (value < min_val || value > max_val) { \ - wl1271_warning(#param " is not in valid range"); \ - return -ERANGE; \ - } \ - \ - mutex_lock(&wl->mutex); \ - wl->conf.conf_sub_struct.param = value; \ - \ - write_handler_locked(wl, value, write_handler_arg); \ - \ - mutex_unlock(&wl->mutex); \ - return count; \ - } \ - \ - static const struct file_operations param##_ops = { \ - .read = param##_read, \ - .write = param##_write, \ - .open = simple_open, \ - .llseek = default_llseek, \ - }; - -WL12XX_CONF_DEBUGFS(irq_pkt_threshold, rx, 0, 65535, - chip_op_handler, wl1271_acx_init_rx_interrupt) -WL12XX_CONF_DEBUGFS(irq_blk_threshold, rx, 0, 65535, - chip_op_handler, wl1271_acx_init_rx_interrupt) -WL12XX_CONF_DEBUGFS(irq_timeout, rx, 0, 100, - chip_op_handler, wl1271_acx_init_rx_interrupt) - -static ssize_t gpio_power_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - bool state = test_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); - - int res; - char buf[10]; - - res = scnprintf(buf, sizeof(buf), "%d\n", state); - - return simple_read_from_buffer(user_buf, count, ppos, buf, res); -} - -static ssize_t gpio_power_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - unsigned long value; - int ret; - - ret = kstrtoul_from_user(user_buf, count, 10, &value); - if (ret < 0) { - wl1271_warning("illegal value in gpio_power"); - return -EINVAL; - } - - mutex_lock(&wl->mutex); - - if (value) - wl1271_power_on(wl); - else - wl1271_power_off(wl); - - mutex_unlock(&wl->mutex); - return count; -} - -static const struct file_operations gpio_power_ops = { - .read = gpio_power_read, - .write = gpio_power_write, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t start_recovery_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - - mutex_lock(&wl->mutex); - wl12xx_queue_recovery_work(wl); - mutex_unlock(&wl->mutex); - - return count; -} - -static const struct file_operations start_recovery_ops = { - .write = start_recovery_write, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t dynamic_ps_timeout_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - - return wl1271_format_buffer(user_buf, count, - ppos, "%d\n", - wl->conf.conn.dynamic_ps_timeout); -} - -static ssize_t dynamic_ps_timeout_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - struct wl12xx_vif *wlvif; - unsigned long value; - int ret; - - ret = kstrtoul_from_user(user_buf, count, 10, &value); - if (ret < 0) { - wl1271_warning("illegal value in dynamic_ps"); - return -EINVAL; - } - - if (value < 1 || value > 65535) { - wl1271_warning("dyanmic_ps_timeout is not in valid range"); - return -ERANGE; - } - - mutex_lock(&wl->mutex); - - wl->conf.conn.dynamic_ps_timeout = value; - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - /* In case we're already in PSM, trigger it again to set new timeout - * immediately without waiting for re-association - */ - - wl12xx_for_each_wlvif_sta(wl, wlvif) { - if (test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags)) - wl1271_ps_set_mode(wl, wlvif, STATION_AUTO_PS_MODE); - } - - wl1271_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - return count; -} - -static const struct file_operations dynamic_ps_timeout_ops = { - .read = dynamic_ps_timeout_read, - .write = dynamic_ps_timeout_write, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t forced_ps_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - - return wl1271_format_buffer(user_buf, count, - ppos, "%d\n", - wl->conf.conn.forced_ps); -} - -static ssize_t forced_ps_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - struct wl12xx_vif *wlvif; - unsigned long value; - int ret, ps_mode; - - ret = kstrtoul_from_user(user_buf, count, 10, &value); - if (ret < 0) { - wl1271_warning("illegal value in forced_ps"); - return -EINVAL; - } - - if (value != 1 && value != 0) { - wl1271_warning("forced_ps should be either 0 or 1"); - return -ERANGE; - } - - mutex_lock(&wl->mutex); - - if (wl->conf.conn.forced_ps == value) - goto out; - - wl->conf.conn.forced_ps = value; - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - /* In case we're already in PSM, trigger it again to switch mode - * immediately without waiting for re-association - */ - - ps_mode = value ? STATION_POWER_SAVE_MODE : STATION_AUTO_PS_MODE; - - wl12xx_for_each_wlvif_sta(wl, wlvif) { - if (test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags)) - wl1271_ps_set_mode(wl, wlvif, ps_mode); - } - - wl1271_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - return count; -} - -static const struct file_operations forced_ps_ops = { - .read = forced_ps_read, - .write = forced_ps_write, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t split_scan_timeout_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - - return wl1271_format_buffer(user_buf, count, - ppos, "%d\n", - wl->conf.scan.split_scan_timeout / 1000); -} - -static ssize_t split_scan_timeout_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - unsigned long value; - int ret; - - ret = kstrtoul_from_user(user_buf, count, 10, &value); - if (ret < 0) { - wl1271_warning("illegal value in split_scan_timeout"); - return -EINVAL; - } - - if (value == 0) - wl1271_info("split scan will be disabled"); - - mutex_lock(&wl->mutex); - - wl->conf.scan.split_scan_timeout = value * 1000; - - mutex_unlock(&wl->mutex); - return count; -} - -static const struct file_operations split_scan_timeout_ops = { - .read = split_scan_timeout_read, - .write = split_scan_timeout_write, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t driver_state_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - int res = 0; - ssize_t ret; - char *buf; - -#define DRIVER_STATE_BUF_LEN 1024 - - buf = kmalloc(DRIVER_STATE_BUF_LEN, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - mutex_lock(&wl->mutex); - -#define DRIVER_STATE_PRINT(x, fmt) \ - (res += scnprintf(buf + res, DRIVER_STATE_BUF_LEN - res,\ - #x " = " fmt "\n", wl->x)) - -#define DRIVER_STATE_PRINT_LONG(x) DRIVER_STATE_PRINT(x, "%ld") -#define DRIVER_STATE_PRINT_INT(x) DRIVER_STATE_PRINT(x, "%d") -#define DRIVER_STATE_PRINT_STR(x) DRIVER_STATE_PRINT(x, "%s") -#define DRIVER_STATE_PRINT_LHEX(x) DRIVER_STATE_PRINT(x, "0x%lx") -#define DRIVER_STATE_PRINT_HEX(x) DRIVER_STATE_PRINT(x, "0x%x") - - DRIVER_STATE_PRINT_INT(tx_blocks_available); - DRIVER_STATE_PRINT_INT(tx_allocated_blocks); - DRIVER_STATE_PRINT_INT(tx_allocated_pkts[0]); - DRIVER_STATE_PRINT_INT(tx_allocated_pkts[1]); - DRIVER_STATE_PRINT_INT(tx_allocated_pkts[2]); - DRIVER_STATE_PRINT_INT(tx_allocated_pkts[3]); - DRIVER_STATE_PRINT_INT(tx_frames_cnt); - DRIVER_STATE_PRINT_LHEX(tx_frames_map[0]); - DRIVER_STATE_PRINT_INT(tx_queue_count[0]); - DRIVER_STATE_PRINT_INT(tx_queue_count[1]); - DRIVER_STATE_PRINT_INT(tx_queue_count[2]); - DRIVER_STATE_PRINT_INT(tx_queue_count[3]); - DRIVER_STATE_PRINT_INT(tx_packets_count); - DRIVER_STATE_PRINT_INT(tx_results_count); - DRIVER_STATE_PRINT_LHEX(flags); - DRIVER_STATE_PRINT_INT(tx_blocks_freed); - DRIVER_STATE_PRINT_INT(rx_counter); - DRIVER_STATE_PRINT_INT(state); - DRIVER_STATE_PRINT_INT(channel); - DRIVER_STATE_PRINT_INT(band); - DRIVER_STATE_PRINT_INT(power_level); - DRIVER_STATE_PRINT_INT(sg_enabled); - DRIVER_STATE_PRINT_INT(enable_11a); - DRIVER_STATE_PRINT_INT(noise); - DRIVER_STATE_PRINT_HEX(ap_fw_ps_map); - DRIVER_STATE_PRINT_LHEX(ap_ps_map); - DRIVER_STATE_PRINT_HEX(quirks); - DRIVER_STATE_PRINT_HEX(irq); - /* TODO: ref_clock and tcxo_clock were moved to wl12xx priv */ - DRIVER_STATE_PRINT_HEX(hw_pg_ver); - DRIVER_STATE_PRINT_HEX(platform_quirks); - DRIVER_STATE_PRINT_HEX(chip.id); - DRIVER_STATE_PRINT_STR(chip.fw_ver_str); - DRIVER_STATE_PRINT_STR(chip.phy_fw_ver_str); - DRIVER_STATE_PRINT_INT(recovery_count); - -#undef DRIVER_STATE_PRINT_INT -#undef DRIVER_STATE_PRINT_LONG -#undef DRIVER_STATE_PRINT_HEX -#undef DRIVER_STATE_PRINT_LHEX -#undef DRIVER_STATE_PRINT_STR -#undef DRIVER_STATE_PRINT -#undef DRIVER_STATE_BUF_LEN - - mutex_unlock(&wl->mutex); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, res); - kfree(buf); - return ret; -} - -static const struct file_operations driver_state_ops = { - .read = driver_state_read, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t vifs_state_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - struct wl12xx_vif *wlvif; - int ret, res = 0; - const int buf_size = 4096; - char *buf; - char tmp_buf[64]; - - buf = kzalloc(buf_size, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - mutex_lock(&wl->mutex); - -#define VIF_STATE_PRINT(x, fmt) \ - (res += scnprintf(buf + res, buf_size - res, \ - #x " = " fmt "\n", wlvif->x)) - -#define VIF_STATE_PRINT_LONG(x) VIF_STATE_PRINT(x, "%ld") -#define VIF_STATE_PRINT_INT(x) VIF_STATE_PRINT(x, "%d") -#define VIF_STATE_PRINT_STR(x) VIF_STATE_PRINT(x, "%s") -#define VIF_STATE_PRINT_LHEX(x) VIF_STATE_PRINT(x, "0x%lx") -#define VIF_STATE_PRINT_LLHEX(x) VIF_STATE_PRINT(x, "0x%llx") -#define VIF_STATE_PRINT_HEX(x) VIF_STATE_PRINT(x, "0x%x") - -#define VIF_STATE_PRINT_NSTR(x, len) \ - do { \ - memset(tmp_buf, 0, sizeof(tmp_buf)); \ - memcpy(tmp_buf, wlvif->x, \ - min_t(u8, len, sizeof(tmp_buf) - 1)); \ - res += scnprintf(buf + res, buf_size - res, \ - #x " = %s\n", tmp_buf); \ - } while (0) - - wl12xx_for_each_wlvif(wl, wlvif) { - VIF_STATE_PRINT_INT(role_id); - VIF_STATE_PRINT_INT(bss_type); - VIF_STATE_PRINT_LHEX(flags); - VIF_STATE_PRINT_INT(p2p); - VIF_STATE_PRINT_INT(dev_role_id); - VIF_STATE_PRINT_INT(dev_hlid); - - if (wlvif->bss_type == BSS_TYPE_STA_BSS || - wlvif->bss_type == BSS_TYPE_IBSS) { - VIF_STATE_PRINT_INT(sta.hlid); - VIF_STATE_PRINT_INT(sta.basic_rate_idx); - VIF_STATE_PRINT_INT(sta.ap_rate_idx); - VIF_STATE_PRINT_INT(sta.p2p_rate_idx); - VIF_STATE_PRINT_INT(sta.qos); - } else { - VIF_STATE_PRINT_INT(ap.global_hlid); - VIF_STATE_PRINT_INT(ap.bcast_hlid); - VIF_STATE_PRINT_LHEX(ap.sta_hlid_map[0]); - VIF_STATE_PRINT_INT(ap.mgmt_rate_idx); - VIF_STATE_PRINT_INT(ap.bcast_rate_idx); - VIF_STATE_PRINT_INT(ap.ucast_rate_idx[0]); - VIF_STATE_PRINT_INT(ap.ucast_rate_idx[1]); - VIF_STATE_PRINT_INT(ap.ucast_rate_idx[2]); - VIF_STATE_PRINT_INT(ap.ucast_rate_idx[3]); - } - VIF_STATE_PRINT_INT(last_tx_hlid); - VIF_STATE_PRINT_INT(tx_queue_count[0]); - VIF_STATE_PRINT_INT(tx_queue_count[1]); - VIF_STATE_PRINT_INT(tx_queue_count[2]); - VIF_STATE_PRINT_INT(tx_queue_count[3]); - VIF_STATE_PRINT_LHEX(links_map[0]); - VIF_STATE_PRINT_NSTR(ssid, wlvif->ssid_len); - VIF_STATE_PRINT_INT(band); - VIF_STATE_PRINT_INT(channel); - VIF_STATE_PRINT_HEX(bitrate_masks[0]); - VIF_STATE_PRINT_HEX(bitrate_masks[1]); - VIF_STATE_PRINT_HEX(basic_rate_set); - VIF_STATE_PRINT_HEX(basic_rate); - VIF_STATE_PRINT_HEX(rate_set); - VIF_STATE_PRINT_INT(beacon_int); - VIF_STATE_PRINT_INT(default_key); - VIF_STATE_PRINT_INT(aid); - VIF_STATE_PRINT_INT(psm_entry_retry); - VIF_STATE_PRINT_INT(power_level); - VIF_STATE_PRINT_INT(rssi_thold); - VIF_STATE_PRINT_INT(last_rssi_event); - VIF_STATE_PRINT_INT(ba_support); - VIF_STATE_PRINT_INT(ba_allowed); - VIF_STATE_PRINT_LLHEX(total_freed_pkts); - } - -#undef VIF_STATE_PRINT_INT -#undef VIF_STATE_PRINT_LONG -#undef VIF_STATE_PRINT_HEX -#undef VIF_STATE_PRINT_LHEX -#undef VIF_STATE_PRINT_LLHEX -#undef VIF_STATE_PRINT_STR -#undef VIF_STATE_PRINT_NSTR -#undef VIF_STATE_PRINT - - mutex_unlock(&wl->mutex); - - ret = simple_read_from_buffer(user_buf, count, ppos, buf, res); - kfree(buf); - return ret; -} - -static const struct file_operations vifs_state_ops = { - .read = vifs_state_read, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t dtim_interval_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - u8 value; - - if (wl->conf.conn.wake_up_event == CONF_WAKE_UP_EVENT_DTIM || - wl->conf.conn.wake_up_event == CONF_WAKE_UP_EVENT_N_DTIM) - value = wl->conf.conn.listen_interval; - else - value = 0; - - return wl1271_format_buffer(user_buf, count, ppos, "%d\n", value); -} - -static ssize_t dtim_interval_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - unsigned long value; - int ret; - - ret = kstrtoul_from_user(user_buf, count, 10, &value); - if (ret < 0) { - wl1271_warning("illegal value for dtim_interval"); - return -EINVAL; - } - - if (value < 1 || value > 10) { - wl1271_warning("dtim value is not in valid range"); - return -ERANGE; - } - - mutex_lock(&wl->mutex); - - wl->conf.conn.listen_interval = value; - /* for some reason there are different event types for 1 and >1 */ - if (value == 1) - wl->conf.conn.wake_up_event = CONF_WAKE_UP_EVENT_DTIM; - else - wl->conf.conn.wake_up_event = CONF_WAKE_UP_EVENT_N_DTIM; - - /* - * we don't reconfigure ACX_WAKE_UP_CONDITIONS now, so it will only - * take effect on the next time we enter psm. - */ - mutex_unlock(&wl->mutex); - return count; -} - -static const struct file_operations dtim_interval_ops = { - .read = dtim_interval_read, - .write = dtim_interval_write, - .open = simple_open, - .llseek = default_llseek, -}; - - - -static ssize_t suspend_dtim_interval_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - u8 value; - - if (wl->conf.conn.suspend_wake_up_event == CONF_WAKE_UP_EVENT_DTIM || - wl->conf.conn.suspend_wake_up_event == CONF_WAKE_UP_EVENT_N_DTIM) - value = wl->conf.conn.suspend_listen_interval; - else - value = 0; - - return wl1271_format_buffer(user_buf, count, ppos, "%d\n", value); -} - -static ssize_t suspend_dtim_interval_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - unsigned long value; - int ret; - - ret = kstrtoul_from_user(user_buf, count, 10, &value); - if (ret < 0) { - wl1271_warning("illegal value for suspend_dtim_interval"); - return -EINVAL; - } - - if (value < 1 || value > 10) { - wl1271_warning("suspend_dtim value is not in valid range"); - return -ERANGE; - } - - mutex_lock(&wl->mutex); - - wl->conf.conn.suspend_listen_interval = value; - /* for some reason there are different event types for 1 and >1 */ - if (value == 1) - wl->conf.conn.suspend_wake_up_event = CONF_WAKE_UP_EVENT_DTIM; - else - wl->conf.conn.suspend_wake_up_event = CONF_WAKE_UP_EVENT_N_DTIM; - - mutex_unlock(&wl->mutex); - return count; -} - - -static const struct file_operations suspend_dtim_interval_ops = { - .read = suspend_dtim_interval_read, - .write = suspend_dtim_interval_write, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t beacon_interval_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - u8 value; - - if (wl->conf.conn.wake_up_event == CONF_WAKE_UP_EVENT_BEACON || - wl->conf.conn.wake_up_event == CONF_WAKE_UP_EVENT_N_BEACONS) - value = wl->conf.conn.listen_interval; - else - value = 0; - - return wl1271_format_buffer(user_buf, count, ppos, "%d\n", value); -} - -static ssize_t beacon_interval_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - unsigned long value; - int ret; - - ret = kstrtoul_from_user(user_buf, count, 10, &value); - if (ret < 0) { - wl1271_warning("illegal value for beacon_interval"); - return -EINVAL; - } - - if (value < 1 || value > 255) { - wl1271_warning("beacon interval value is not in valid range"); - return -ERANGE; - } - - mutex_lock(&wl->mutex); - - wl->conf.conn.listen_interval = value; - /* for some reason there are different event types for 1 and >1 */ - if (value == 1) - wl->conf.conn.wake_up_event = CONF_WAKE_UP_EVENT_BEACON; - else - wl->conf.conn.wake_up_event = CONF_WAKE_UP_EVENT_N_BEACONS; - - /* - * we don't reconfigure ACX_WAKE_UP_CONDITIONS now, so it will only - * take effect on the next time we enter psm. - */ - mutex_unlock(&wl->mutex); - return count; -} - -static const struct file_operations beacon_interval_ops = { - .read = beacon_interval_read, - .write = beacon_interval_write, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t rx_streaming_interval_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - struct wl12xx_vif *wlvif; - unsigned long value; - int ret; - - ret = kstrtoul_from_user(user_buf, count, 10, &value); - if (ret < 0) { - wl1271_warning("illegal value in rx_streaming_interval!"); - return -EINVAL; - } - - /* valid values: 0, 10-100 */ - if (value && (value < 10 || value > 100)) { - wl1271_warning("value is not in range!"); - return -ERANGE; - } - - mutex_lock(&wl->mutex); - - wl->conf.rx_streaming.interval = value; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - wl12xx_for_each_wlvif_sta(wl, wlvif) { - wl1271_recalc_rx_streaming(wl, wlvif); - } - - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); - return count; -} - -static ssize_t rx_streaming_interval_read(struct file *file, - char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - return wl1271_format_buffer(userbuf, count, ppos, - "%d\n", wl->conf.rx_streaming.interval); -} - -static const struct file_operations rx_streaming_interval_ops = { - .read = rx_streaming_interval_read, - .write = rx_streaming_interval_write, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t rx_streaming_always_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - struct wl12xx_vif *wlvif; - unsigned long value; - int ret; - - ret = kstrtoul_from_user(user_buf, count, 10, &value); - if (ret < 0) { - wl1271_warning("illegal value in rx_streaming_write!"); - return -EINVAL; - } - - /* valid values: 0, 10-100 */ - if (!(value == 0 || value == 1)) { - wl1271_warning("value is not in valid!"); - return -EINVAL; - } - - mutex_lock(&wl->mutex); - - wl->conf.rx_streaming.always = value; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - wl12xx_for_each_wlvif_sta(wl, wlvif) { - wl1271_recalc_rx_streaming(wl, wlvif); - } - - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); - return count; -} - -static ssize_t rx_streaming_always_read(struct file *file, - char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - return wl1271_format_buffer(userbuf, count, ppos, - "%d\n", wl->conf.rx_streaming.always); -} - -static const struct file_operations rx_streaming_always_ops = { - .read = rx_streaming_always_read, - .write = rx_streaming_always_write, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t beacon_filtering_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - struct wl12xx_vif *wlvif; - char buf[10]; - size_t len; - unsigned long value; - int ret; - - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - buf[len] = '\0'; - - ret = kstrtoul(buf, 0, &value); - if (ret < 0) { - wl1271_warning("illegal value for beacon_filtering!"); - return -EINVAL; - } - - mutex_lock(&wl->mutex); - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - wl12xx_for_each_wlvif(wl, wlvif) { - ret = wl1271_acx_beacon_filter_opt(wl, wlvif, !!value); - } - - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); - return count; -} - -static const struct file_operations beacon_filtering_ops = { - .write = beacon_filtering_write, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t fw_stats_raw_read(struct file *file, - char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - - wl1271_debugfs_update_stats(wl); - - return simple_read_from_buffer(userbuf, count, ppos, - wl->stats.fw_stats, - wl->stats.fw_stats_len); -} - -static const struct file_operations fw_stats_raw_ops = { - .read = fw_stats_raw_read, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t sleep_auth_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - - return wl1271_format_buffer(user_buf, count, - ppos, "%d\n", - wl->sleep_auth); -} - -static ssize_t sleep_auth_write(struct file *file, - const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - unsigned long value; - int ret; - - ret = kstrtoul_from_user(user_buf, count, 0, &value); - if (ret < 0) { - wl1271_warning("illegal value in sleep_auth"); - return -EINVAL; - } - - if (value > WL1271_PSM_MAX) { - wl1271_warning("sleep_auth must be between 0 and %d", - WL1271_PSM_MAX); - return -ERANGE; - } - - mutex_lock(&wl->mutex); - - wl->conf.conn.sta_sleep_auth = value; - - if (unlikely(wl->state != WLCORE_STATE_ON)) { - /* this will show up on "read" in case we are off */ - wl->sleep_auth = value; - goto out; - } - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = wl1271_acx_sleep_auth(wl, value); - if (ret < 0) - goto out_sleep; - -out_sleep: - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); - return count; -} - -static const struct file_operations sleep_auth_ops = { - .read = sleep_auth_read, - .write = sleep_auth_write, - .open = simple_open, - .llseek = default_llseek, -}; - -static ssize_t dev_mem_read(struct file *file, - char __user *user_buf, size_t count, - loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - struct wlcore_partition_set part, old_part; - size_t bytes = count; - int ret; - char *buf; - - /* only requests of dword-aligned size and offset are supported */ - if (bytes % 4) - return -EINVAL; - - if (*ppos % 4) - return -EINVAL; - - /* function should return in reasonable time */ - bytes = min(bytes, WLCORE_MAX_BLOCK_SIZE); - - if (bytes == 0) - return -EINVAL; - - memset(&part, 0, sizeof(part)); - part.mem.start = file->f_pos; - part.mem.size = bytes; - - buf = kmalloc(bytes, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state == WLCORE_STATE_OFF)) { - ret = -EFAULT; - goto skip_read; - } - - /* - * Don't fail if elp_wakeup returns an error, so the device's memory - * could be read even if the FW crashed - */ - wl1271_ps_elp_wakeup(wl); - - /* store current partition and switch partition */ - memcpy(&old_part, &wl->curr_part, sizeof(old_part)); - ret = wlcore_set_partition(wl, &part); - if (ret < 0) - goto part_err; - - ret = wlcore_raw_read(wl, 0, buf, bytes, false); - if (ret < 0) - goto read_err; - -read_err: - /* recover partition */ - ret = wlcore_set_partition(wl, &old_part); - if (ret < 0) - goto part_err; - -part_err: - wl1271_ps_elp_sleep(wl); - -skip_read: - mutex_unlock(&wl->mutex); - - if (ret == 0) { - ret = copy_to_user(user_buf, buf, bytes); - if (ret < bytes) { - bytes -= ret; - *ppos += bytes; - ret = 0; - } else { - ret = -EFAULT; - } - } - - kfree(buf); - - return ((ret == 0) ? bytes : ret); -} - -static ssize_t dev_mem_write(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wl1271 *wl = file->private_data; - struct wlcore_partition_set part, old_part; - size_t bytes = count; - int ret; - char *buf; - - /* only requests of dword-aligned size and offset are supported */ - if (bytes % 4) - return -EINVAL; - - if (*ppos % 4) - return -EINVAL; - - /* function should return in reasonable time */ - bytes = min(bytes, WLCORE_MAX_BLOCK_SIZE); - - if (bytes == 0) - return -EINVAL; - - memset(&part, 0, sizeof(part)); - part.mem.start = file->f_pos; - part.mem.size = bytes; - - buf = kmalloc(bytes, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - ret = copy_from_user(buf, user_buf, bytes); - if (ret) { - ret = -EFAULT; - goto err_out; - } - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state == WLCORE_STATE_OFF)) { - ret = -EFAULT; - goto skip_write; - } - - /* - * Don't fail if elp_wakeup returns an error, so the device's memory - * could be read even if the FW crashed - */ - wl1271_ps_elp_wakeup(wl); - - /* store current partition and switch partition */ - memcpy(&old_part, &wl->curr_part, sizeof(old_part)); - ret = wlcore_set_partition(wl, &part); - if (ret < 0) - goto part_err; - - ret = wlcore_raw_write(wl, 0, buf, bytes, false); - if (ret < 0) - goto write_err; - -write_err: - /* recover partition */ - ret = wlcore_set_partition(wl, &old_part); - if (ret < 0) - goto part_err; - -part_err: - wl1271_ps_elp_sleep(wl); - -skip_write: - mutex_unlock(&wl->mutex); - - if (ret == 0) - *ppos += bytes; - -err_out: - kfree(buf); - - return ((ret == 0) ? bytes : ret); -} - -static loff_t dev_mem_seek(struct file *file, loff_t offset, int orig) -{ - loff_t ret; - - /* only requests of dword-aligned size and offset are supported */ - if (offset % 4) - return -EINVAL; - - switch (orig) { - case SEEK_SET: - file->f_pos = offset; - ret = file->f_pos; - break; - case SEEK_CUR: - file->f_pos += offset; - ret = file->f_pos; - break; - default: - ret = -EINVAL; - } - - return ret; -} - -static const struct file_operations dev_mem_ops = { - .open = simple_open, - .read = dev_mem_read, - .write = dev_mem_write, - .llseek = dev_mem_seek, -}; - -static int wl1271_debugfs_add_files(struct wl1271 *wl, - struct dentry *rootdir) -{ - int ret = 0; - struct dentry *entry, *streaming; - - DEBUGFS_ADD(tx_queue_len, rootdir); - DEBUGFS_ADD(retry_count, rootdir); - DEBUGFS_ADD(excessive_retries, rootdir); - - DEBUGFS_ADD(gpio_power, rootdir); - DEBUGFS_ADD(start_recovery, rootdir); - DEBUGFS_ADD(driver_state, rootdir); - DEBUGFS_ADD(vifs_state, rootdir); - DEBUGFS_ADD(dtim_interval, rootdir); - DEBUGFS_ADD(suspend_dtim_interval, rootdir); - DEBUGFS_ADD(beacon_interval, rootdir); - DEBUGFS_ADD(beacon_filtering, rootdir); - DEBUGFS_ADD(dynamic_ps_timeout, rootdir); - DEBUGFS_ADD(forced_ps, rootdir); - DEBUGFS_ADD(split_scan_timeout, rootdir); - DEBUGFS_ADD(irq_pkt_threshold, rootdir); - DEBUGFS_ADD(irq_blk_threshold, rootdir); - DEBUGFS_ADD(irq_timeout, rootdir); - DEBUGFS_ADD(fw_stats_raw, rootdir); - DEBUGFS_ADD(sleep_auth, rootdir); - - streaming = debugfs_create_dir("rx_streaming", rootdir); - if (!streaming || IS_ERR(streaming)) - goto err; - - DEBUGFS_ADD_PREFIX(rx_streaming, interval, streaming); - DEBUGFS_ADD_PREFIX(rx_streaming, always, streaming); - - DEBUGFS_ADD_PREFIX(dev, mem, rootdir); - - return 0; - -err: - if (IS_ERR(entry)) - ret = PTR_ERR(entry); - else - ret = -ENOMEM; - - return ret; -} - -void wl1271_debugfs_reset(struct wl1271 *wl) -{ - if (!wl->stats.fw_stats) - return; - - memset(wl->stats.fw_stats, 0, wl->stats.fw_stats_len); - wl->stats.retry_count = 0; - wl->stats.excessive_retries = 0; -} - -int wl1271_debugfs_init(struct wl1271 *wl) -{ - int ret; - struct dentry *rootdir; - - rootdir = debugfs_create_dir(KBUILD_MODNAME, - wl->hw->wiphy->debugfsdir); - - if (IS_ERR(rootdir)) { - ret = PTR_ERR(rootdir); - goto out; - } - - wl->stats.fw_stats = kzalloc(wl->stats.fw_stats_len, GFP_KERNEL); - if (!wl->stats.fw_stats) { - ret = -ENOMEM; - goto out_remove; - } - - wl->stats.fw_stats_update = jiffies; - - ret = wl1271_debugfs_add_files(wl, rootdir); - if (ret < 0) - goto out_exit; - - ret = wlcore_debugfs_init(wl, rootdir); - if (ret < 0) - goto out_exit; - - goto out; - -out_exit: - wl1271_debugfs_exit(wl); - -out_remove: - debugfs_remove_recursive(rootdir); - -out: - return ret; -} - -void wl1271_debugfs_exit(struct wl1271 *wl) -{ - kfree(wl->stats.fw_stats); - wl->stats.fw_stats = NULL; -} diff --git a/drivers/net/wireless/ti/wlcore/debugfs.h b/drivers/net/wireless/ti/wlcore/debugfs.h deleted file mode 100644 index f7381dd69009..000000000000 --- a/drivers/net/wireless/ti/wlcore/debugfs.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __DEBUGFS_H__ -#define __DEBUGFS_H__ - -#include "wlcore.h" - -int wl1271_format_buffer(char __user *userbuf, size_t count, - loff_t *ppos, char *fmt, ...); - -int wl1271_debugfs_init(struct wl1271 *wl); -void wl1271_debugfs_exit(struct wl1271 *wl); -void wl1271_debugfs_reset(struct wl1271 *wl); -void wl1271_debugfs_update_stats(struct wl1271 *wl); - -#define DEBUGFS_FORMAT_BUFFER_SIZE 256 - -#define DEBUGFS_READONLY_FILE(name, fmt, value...) \ -static ssize_t name## _read(struct file *file, char __user *userbuf, \ - size_t count, loff_t *ppos) \ -{ \ - struct wl1271 *wl = file->private_data; \ - return wl1271_format_buffer(userbuf, count, ppos, \ - fmt "\n", ##value); \ -} \ - \ -static const struct file_operations name## _ops = { \ - .read = name## _read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -#define DEBUGFS_ADD(name, parent) \ - do { \ - entry = debugfs_create_file(#name, 0400, parent, \ - wl, &name## _ops); \ - if (!entry || IS_ERR(entry)) \ - goto err; \ - } while (0); - - -#define DEBUGFS_ADD_PREFIX(prefix, name, parent) \ - do { \ - entry = debugfs_create_file(#name, 0400, parent, \ - wl, &prefix## _## name## _ops); \ - if (!entry || IS_ERR(entry)) \ - goto err; \ - } while (0); - -#define DEBUGFS_FWSTATS_FILE(sub, name, fmt, struct_type) \ -static ssize_t sub## _ ##name## _read(struct file *file, \ - char __user *userbuf, \ - size_t count, loff_t *ppos) \ -{ \ - struct wl1271 *wl = file->private_data; \ - struct struct_type *stats = wl->stats.fw_stats; \ - \ - wl1271_debugfs_update_stats(wl); \ - \ - return wl1271_format_buffer(userbuf, count, ppos, fmt "\n", \ - stats->sub.name); \ -} \ - \ -static const struct file_operations sub## _ ##name## _ops = { \ - .read = sub## _ ##name## _read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -#define DEBUGFS_FWSTATS_FILE_ARRAY(sub, name, len, struct_type) \ -static ssize_t sub## _ ##name## _read(struct file *file, \ - char __user *userbuf, \ - size_t count, loff_t *ppos) \ -{ \ - struct wl1271 *wl = file->private_data; \ - struct struct_type *stats = wl->stats.fw_stats; \ - char buf[DEBUGFS_FORMAT_BUFFER_SIZE] = ""; \ - int res, i; \ - \ - wl1271_debugfs_update_stats(wl); \ - \ - for (i = 0; i < len; i++) \ - res = snprintf(buf, sizeof(buf), "%s[%d] = %d\n", \ - buf, i, stats->sub.name[i]); \ - \ - return wl1271_format_buffer(userbuf, count, ppos, "%s", buf); \ -} \ - \ -static const struct file_operations sub## _ ##name## _ops = { \ - .read = sub## _ ##name## _read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -#define DEBUGFS_FWSTATS_ADD(sub, name) \ - DEBUGFS_ADD(sub## _ ##name, stats) - - -#endif /* WL1271_DEBUGFS_H */ diff --git a/drivers/net/wireless/ti/wlcore/event.c b/drivers/net/wireless/ti/wlcore/event.c deleted file mode 100644 index 67f61689b49e..000000000000 --- a/drivers/net/wireless/ti/wlcore/event.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2008-2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "wlcore.h" -#include "debug.h" -#include "io.h" -#include "event.h" -#include "ps.h" -#include "scan.h" -#include "wl12xx_80211.h" - -void wlcore_event_rssi_trigger(struct wl1271 *wl, s8 *metric_arr) -{ - struct wl12xx_vif *wlvif; - struct ieee80211_vif *vif; - enum nl80211_cqm_rssi_threshold_event event; - s8 metric = metric_arr[0]; - - wl1271_debug(DEBUG_EVENT, "RSSI trigger metric: %d", metric); - - /* TODO: check actual multi-role support */ - wl12xx_for_each_wlvif_sta(wl, wlvif) { - if (metric <= wlvif->rssi_thold) - event = NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW; - else - event = NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH; - - vif = wl12xx_wlvif_to_vif(wlvif); - if (event != wlvif->last_rssi_event) - ieee80211_cqm_rssi_notify(vif, event, GFP_KERNEL); - wlvif->last_rssi_event = event; - } -} -EXPORT_SYMBOL_GPL(wlcore_event_rssi_trigger); - -static void wl1271_stop_ba_event(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - - if (wlvif->bss_type != BSS_TYPE_AP_BSS) { - u8 hlid = wlvif->sta.hlid; - if (!wl->links[hlid].ba_bitmap) - return; - ieee80211_stop_rx_ba_session(vif, wl->links[hlid].ba_bitmap, - vif->bss_conf.bssid); - } else { - u8 hlid; - struct wl1271_link *lnk; - for_each_set_bit(hlid, wlvif->ap.sta_hlid_map, - WL12XX_MAX_LINKS) { - lnk = &wl->links[hlid]; - if (!lnk->ba_bitmap) - continue; - - ieee80211_stop_rx_ba_session(vif, - lnk->ba_bitmap, - lnk->addr); - } - } -} - -void wlcore_event_soft_gemini_sense(struct wl1271 *wl, u8 enable) -{ - struct wl12xx_vif *wlvif; - - if (enable) { - set_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags); - } else { - clear_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags); - wl12xx_for_each_wlvif_sta(wl, wlvif) { - wl1271_recalc_rx_streaming(wl, wlvif); - } - } -} -EXPORT_SYMBOL_GPL(wlcore_event_soft_gemini_sense); - -void wlcore_event_sched_scan_completed(struct wl1271 *wl, - u8 status) -{ - wl1271_debug(DEBUG_EVENT, "PERIODIC_SCAN_COMPLETE_EVENT (status 0x%0x)", - status); - - if (wl->sched_vif) { - ieee80211_sched_scan_stopped(wl->hw); - wl->sched_vif = NULL; - } -} -EXPORT_SYMBOL_GPL(wlcore_event_sched_scan_completed); - -void wlcore_event_ba_rx_constraint(struct wl1271 *wl, - unsigned long roles_bitmap, - unsigned long allowed_bitmap) -{ - struct wl12xx_vif *wlvif; - - wl1271_debug(DEBUG_EVENT, "%s: roles=0x%lx allowed=0x%lx", - __func__, roles_bitmap, allowed_bitmap); - - wl12xx_for_each_wlvif(wl, wlvif) { - if (wlvif->role_id == WL12XX_INVALID_ROLE_ID || - !test_bit(wlvif->role_id , &roles_bitmap)) - continue; - - wlvif->ba_allowed = !!test_bit(wlvif->role_id, - &allowed_bitmap); - if (!wlvif->ba_allowed) - wl1271_stop_ba_event(wl, wlvif); - } -} -EXPORT_SYMBOL_GPL(wlcore_event_ba_rx_constraint); - -void wlcore_event_channel_switch(struct wl1271 *wl, - unsigned long roles_bitmap, - bool success) -{ - struct wl12xx_vif *wlvif; - struct ieee80211_vif *vif; - - wl1271_debug(DEBUG_EVENT, "%s: roles=0x%lx success=%d", - __func__, roles_bitmap, success); - - wl12xx_for_each_wlvif_sta(wl, wlvif) { - if (wlvif->role_id == WL12XX_INVALID_ROLE_ID || - !test_bit(wlvif->role_id , &roles_bitmap)) - continue; - - if (!test_and_clear_bit(WLVIF_FLAG_CS_PROGRESS, - &wlvif->flags)) - continue; - - vif = wl12xx_wlvif_to_vif(wlvif); - - ieee80211_chswitch_done(vif, success); - cancel_delayed_work(&wlvif->channel_switch_work); - } -} -EXPORT_SYMBOL_GPL(wlcore_event_channel_switch); - -void wlcore_event_dummy_packet(struct wl1271 *wl) -{ - wl1271_debug(DEBUG_EVENT, "DUMMY_PACKET_ID_EVENT_ID"); - wl1271_tx_dummy_packet(wl); -} -EXPORT_SYMBOL_GPL(wlcore_event_dummy_packet); - -static void wlcore_disconnect_sta(struct wl1271 *wl, unsigned long sta_bitmap) -{ - u32 num_packets = wl->conf.tx.max_tx_retries; - struct wl12xx_vif *wlvif; - struct ieee80211_vif *vif; - struct ieee80211_sta *sta; - const u8 *addr; - int h; - - for_each_set_bit(h, &sta_bitmap, WL12XX_MAX_LINKS) { - bool found = false; - /* find the ap vif connected to this sta */ - wl12xx_for_each_wlvif_ap(wl, wlvif) { - if (!test_bit(h, wlvif->ap.sta_hlid_map)) - continue; - found = true; - break; - } - if (!found) - continue; - - vif = wl12xx_wlvif_to_vif(wlvif); - addr = wl->links[h].addr; - - rcu_read_lock(); - sta = ieee80211_find_sta(vif, addr); - if (sta) { - wl1271_debug(DEBUG_EVENT, "remove sta %d", h); - ieee80211_report_low_ack(sta, num_packets); - } - rcu_read_unlock(); - } -} - -void wlcore_event_max_tx_failure(struct wl1271 *wl, unsigned long sta_bitmap) -{ - wl1271_debug(DEBUG_EVENT, "MAX_TX_FAILURE_EVENT_ID"); - wlcore_disconnect_sta(wl, sta_bitmap); -} -EXPORT_SYMBOL_GPL(wlcore_event_max_tx_failure); - -void wlcore_event_inactive_sta(struct wl1271 *wl, unsigned long sta_bitmap) -{ - wl1271_debug(DEBUG_EVENT, "INACTIVE_STA_EVENT_ID"); - wlcore_disconnect_sta(wl, sta_bitmap); -} -EXPORT_SYMBOL_GPL(wlcore_event_inactive_sta); - -void wlcore_event_roc_complete(struct wl1271 *wl) -{ - wl1271_debug(DEBUG_EVENT, "REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID"); - if (wl->roc_vif) - ieee80211_ready_on_channel(wl->hw); -} -EXPORT_SYMBOL_GPL(wlcore_event_roc_complete); - -void wlcore_event_beacon_loss(struct wl1271 *wl, unsigned long roles_bitmap) -{ - /* - * We are HW_MONITOR device. On beacon loss - queue - * connection loss work. Cancel it on REGAINED event. - */ - struct wl12xx_vif *wlvif; - struct ieee80211_vif *vif; - int delay = wl->conf.conn.synch_fail_thold * - wl->conf.conn.bss_lose_timeout; - - wl1271_info("Beacon loss detected. roles:0x%lx", roles_bitmap); - - wl12xx_for_each_wlvif_sta(wl, wlvif) { - if (wlvif->role_id == WL12XX_INVALID_ROLE_ID || - !test_bit(wlvif->role_id , &roles_bitmap)) - continue; - - vif = wl12xx_wlvif_to_vif(wlvif); - - /* don't attempt roaming in case of p2p */ - if (wlvif->p2p) { - ieee80211_connection_loss(vif); - continue; - } - - /* - * if the work is already queued, it should take place. - * We don't want to delay the connection loss - * indication any more. - */ - ieee80211_queue_delayed_work(wl->hw, - &wlvif->connection_loss_work, - msecs_to_jiffies(delay)); - - ieee80211_cqm_rssi_notify( - vif, - NL80211_CQM_RSSI_BEACON_LOSS_EVENT, - GFP_KERNEL); - } -} -EXPORT_SYMBOL_GPL(wlcore_event_beacon_loss); - -int wl1271_event_unmask(struct wl1271 *wl) -{ - int ret; - - ret = wl1271_acx_event_mbox_mask(wl, ~(wl->event_mask)); - if (ret < 0) - return ret; - - return 0; -} - -int wl1271_event_handle(struct wl1271 *wl, u8 mbox_num) -{ - int ret; - - wl1271_debug(DEBUG_EVENT, "EVENT on mbox %d", mbox_num); - - if (mbox_num > 1) - return -EINVAL; - - /* first we read the mbox descriptor */ - ret = wlcore_read(wl, wl->mbox_ptr[mbox_num], wl->mbox, - wl->mbox_size, false); - if (ret < 0) - return ret; - - /* process the descriptor */ - ret = wl->ops->process_mailbox_events(wl); - if (ret < 0) - return ret; - - /* - * TODO: we just need this because one bit is in a different - * place. Is there any better way? - */ - ret = wl->ops->ack_event(wl); - - return ret; -} diff --git a/drivers/net/wireless/ti/wlcore/event.h b/drivers/net/wireless/ti/wlcore/event.h deleted file mode 100644 index acc7a59d3828..000000000000 --- a/drivers/net/wireless/ti/wlcore/event.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 1998-2009 Texas Instruments. All rights reserved. - * Copyright (C) 2008-2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __EVENT_H__ -#define __EVENT_H__ - -/* - * Mbox events - * - * The event mechanism is based on a pair of event buffers (buffers A and - * B) at fixed locations in the target's memory. The host processes one - * buffer while the other buffer continues to collect events. If the host - * is not processing events, an interrupt is issued to signal that a buffer - * is ready. Once the host is done with processing events from one buffer, - * it signals the target (with an ACK interrupt) that the event buffer is - * free. - */ - -enum { - RSSI_SNR_TRIGGER_0_EVENT_ID = BIT(0), - RSSI_SNR_TRIGGER_1_EVENT_ID = BIT(1), - RSSI_SNR_TRIGGER_2_EVENT_ID = BIT(2), - RSSI_SNR_TRIGGER_3_EVENT_ID = BIT(3), - RSSI_SNR_TRIGGER_4_EVENT_ID = BIT(4), - RSSI_SNR_TRIGGER_5_EVENT_ID = BIT(5), - RSSI_SNR_TRIGGER_6_EVENT_ID = BIT(6), - RSSI_SNR_TRIGGER_7_EVENT_ID = BIT(7), - - EVENT_MBOX_ALL_EVENT_ID = 0x7fffffff, -}; - -/* events the driver might want to wait for */ -enum wlcore_wait_event { - WLCORE_EVENT_ROLE_STOP_COMPLETE, - WLCORE_EVENT_PEER_REMOVE_COMPLETE, - WLCORE_EVENT_DFS_CONFIG_COMPLETE -}; - -enum { - EVENT_ENTER_POWER_SAVE_FAIL = 0, - EVENT_ENTER_POWER_SAVE_SUCCESS, -}; - -#define NUM_OF_RSSI_SNR_TRIGGERS 8 - -struct wl1271; - -int wl1271_event_unmask(struct wl1271 *wl); -int wl1271_event_handle(struct wl1271 *wl, u8 mbox); - -void wlcore_event_soft_gemini_sense(struct wl1271 *wl, u8 enable); -void wlcore_event_sched_scan_completed(struct wl1271 *wl, - u8 status); -void wlcore_event_ba_rx_constraint(struct wl1271 *wl, - unsigned long roles_bitmap, - unsigned long allowed_bitmap); -void wlcore_event_channel_switch(struct wl1271 *wl, - unsigned long roles_bitmap, - bool success); -void wlcore_event_beacon_loss(struct wl1271 *wl, unsigned long roles_bitmap); -void wlcore_event_dummy_packet(struct wl1271 *wl); -void wlcore_event_max_tx_failure(struct wl1271 *wl, unsigned long sta_bitmap); -void wlcore_event_inactive_sta(struct wl1271 *wl, unsigned long sta_bitmap); -void wlcore_event_roc_complete(struct wl1271 *wl); -void wlcore_event_rssi_trigger(struct wl1271 *wl, s8 *metric_arr); -#endif diff --git a/drivers/net/wireless/ti/wlcore/hw_ops.h b/drivers/net/wireless/ti/wlcore/hw_ops.h deleted file mode 100644 index 7fd260c02a0a..000000000000 --- a/drivers/net/wireless/ti/wlcore/hw_ops.h +++ /dev/null @@ -1,245 +0,0 @@ -/* - * This file is part of wlcore - * - * Copyright (C) 2011 Texas Instruments Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WLCORE_HW_OPS_H__ -#define __WLCORE_HW_OPS_H__ - -#include "wlcore.h" -#include "rx.h" - -static inline u32 -wlcore_hw_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks) -{ - if (!wl->ops->calc_tx_blocks) - BUG_ON(1); - - return wl->ops->calc_tx_blocks(wl, len, spare_blks); -} - -static inline void -wlcore_hw_set_tx_desc_blocks(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc, - u32 blks, u32 spare_blks) -{ - if (!wl->ops->set_tx_desc_blocks) - BUG_ON(1); - - return wl->ops->set_tx_desc_blocks(wl, desc, blks, spare_blks); -} - -static inline void -wlcore_hw_set_tx_desc_data_len(struct wl1271 *wl, - struct wl1271_tx_hw_descr *desc, - struct sk_buff *skb) -{ - if (!wl->ops->set_tx_desc_data_len) - BUG_ON(1); - - wl->ops->set_tx_desc_data_len(wl, desc, skb); -} - -static inline enum wl_rx_buf_align -wlcore_hw_get_rx_buf_align(struct wl1271 *wl, u32 rx_desc) -{ - - if (!wl->ops->get_rx_buf_align) - BUG_ON(1); - - return wl->ops->get_rx_buf_align(wl, rx_desc); -} - -static inline int -wlcore_hw_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len) -{ - if (wl->ops->prepare_read) - return wl->ops->prepare_read(wl, rx_desc, len); - - return 0; -} - -static inline u32 -wlcore_hw_get_rx_packet_len(struct wl1271 *wl, void *rx_data, u32 data_len) -{ - if (!wl->ops->get_rx_packet_len) - BUG_ON(1); - - return wl->ops->get_rx_packet_len(wl, rx_data, data_len); -} - -static inline int wlcore_hw_tx_delayed_compl(struct wl1271 *wl) -{ - if (wl->ops->tx_delayed_compl) - return wl->ops->tx_delayed_compl(wl); - - return 0; -} - -static inline void wlcore_hw_tx_immediate_compl(struct wl1271 *wl) -{ - if (wl->ops->tx_immediate_compl) - wl->ops->tx_immediate_compl(wl); -} - -static inline int -wlcore_hw_init_vif(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - if (wl->ops->init_vif) - return wl->ops->init_vif(wl, wlvif); - - return 0; -} - -static inline u32 -wlcore_hw_sta_get_ap_rate_mask(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - if (!wl->ops->sta_get_ap_rate_mask) - BUG_ON(1); - - return wl->ops->sta_get_ap_rate_mask(wl, wlvif); -} - -static inline int wlcore_identify_fw(struct wl1271 *wl) -{ - if (wl->ops->identify_fw) - return wl->ops->identify_fw(wl); - - return 0; -} - -static inline void -wlcore_hw_set_tx_desc_csum(struct wl1271 *wl, - struct wl1271_tx_hw_descr *desc, - struct sk_buff *skb) -{ - if (!wl->ops->set_tx_desc_csum) - BUG_ON(1); - - wl->ops->set_tx_desc_csum(wl, desc, skb); -} - -static inline void -wlcore_hw_set_rx_csum(struct wl1271 *wl, - struct wl1271_rx_descriptor *desc, - struct sk_buff *skb) -{ - if (wl->ops->set_rx_csum) - wl->ops->set_rx_csum(wl, desc, skb); -} - -static inline u32 -wlcore_hw_ap_get_mimo_wide_rate_mask(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - if (wl->ops->ap_get_mimo_wide_rate_mask) - return wl->ops->ap_get_mimo_wide_rate_mask(wl, wlvif); - - return 0; -} - -static inline int -wlcore_debugfs_init(struct wl1271 *wl, struct dentry *rootdir) -{ - if (wl->ops->debugfs_init) - return wl->ops->debugfs_init(wl, rootdir); - - return 0; -} - -static inline int -wlcore_handle_static_data(struct wl1271 *wl, void *static_data) -{ - if (wl->ops->handle_static_data) - return wl->ops->handle_static_data(wl, static_data); - - return 0; -} - -static inline int -wlcore_hw_get_spare_blocks(struct wl1271 *wl, bool is_gem) -{ - if (!wl->ops->get_spare_blocks) - BUG_ON(1); - - return wl->ops->get_spare_blocks(wl, is_gem); -} - -static inline int -wlcore_hw_set_key(struct wl1271 *wl, enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key_conf) -{ - if (!wl->ops->set_key) - BUG_ON(1); - - return wl->ops->set_key(wl, cmd, vif, sta, key_conf); -} - -static inline u32 -wlcore_hw_pre_pkt_send(struct wl1271 *wl, u32 buf_offset, u32 last_len) -{ - if (wl->ops->pre_pkt_send) - return wl->ops->pre_pkt_send(wl, buf_offset, last_len); - - return buf_offset; -} - -static inline void -wlcore_hw_sta_rc_update(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct ieee80211_sta *sta, u32 changed) -{ - if (wl->ops->sta_rc_update) - wl->ops->sta_rc_update(wl, wlvif, sta, changed); -} - -static inline int -wlcore_hw_set_peer_cap(struct wl1271 *wl, - struct ieee80211_sta_ht_cap *ht_cap, - bool allow_ht_operation, - u32 rate_set, u8 hlid) -{ - if (wl->ops->set_peer_cap) - return wl->ops->set_peer_cap(wl, ht_cap, allow_ht_operation, - rate_set, hlid); - - return 0; -} - -static inline bool -wlcore_hw_lnk_high_prio(struct wl1271 *wl, u8 hlid, - struct wl1271_link *lnk) -{ - if (!wl->ops->lnk_high_prio) - BUG_ON(1); - - return wl->ops->lnk_high_prio(wl, hlid, lnk); -} - -static inline bool -wlcore_hw_lnk_low_prio(struct wl1271 *wl, u8 hlid, - struct wl1271_link *lnk) -{ - if (!wl->ops->lnk_low_prio) - BUG_ON(1); - - return wl->ops->lnk_low_prio(wl, hlid, lnk); -} - -#endif diff --git a/drivers/net/wireless/ti/wlcore/ini.h b/drivers/net/wireless/ti/wlcore/ini.h deleted file mode 100644 index d24fe3bbc672..000000000000 --- a/drivers/net/wireless/ti/wlcore/ini.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2010 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __INI_H__ -#define __INI_H__ - -#define GENERAL_SETTINGS_DRPW_LPD 0xc0 -#define SCRATCH_ENABLE_LPD BIT(25) - -#define WL1271_INI_MAX_SMART_REFLEX_PARAM 16 - -struct wl1271_ini_general_params { - u8 ref_clock; - u8 settling_time; - u8 clk_valid_on_wakeup; - u8 dc2dc_mode; - u8 dual_mode_select; - u8 tx_bip_fem_auto_detect; - u8 tx_bip_fem_manufacturer; - u8 general_settings; - u8 sr_state; - u8 srf1[WL1271_INI_MAX_SMART_REFLEX_PARAM]; - u8 srf2[WL1271_INI_MAX_SMART_REFLEX_PARAM]; - u8 srf3[WL1271_INI_MAX_SMART_REFLEX_PARAM]; -} __packed; - -#define WL128X_INI_MAX_SETTINGS_PARAM 4 - -struct wl128x_ini_general_params { - u8 ref_clock; - u8 settling_time; - u8 clk_valid_on_wakeup; - u8 tcxo_ref_clock; - u8 tcxo_settling_time; - u8 tcxo_valid_on_wakeup; - u8 tcxo_ldo_voltage; - u8 xtal_itrim_val; - u8 platform_conf; - u8 dual_mode_select; - u8 tx_bip_fem_auto_detect; - u8 tx_bip_fem_manufacturer; - u8 general_settings[WL128X_INI_MAX_SETTINGS_PARAM]; - u8 sr_state; - u8 srf1[WL1271_INI_MAX_SMART_REFLEX_PARAM]; - u8 srf2[WL1271_INI_MAX_SMART_REFLEX_PARAM]; - u8 srf3[WL1271_INI_MAX_SMART_REFLEX_PARAM]; -} __packed; - -#define WL1271_INI_RSSI_PROCESS_COMPENS_SIZE 15 - -struct wl1271_ini_band_params_2 { - u8 rx_trace_insertion_loss; - u8 tx_trace_loss; - u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE]; -} __packed; - -#define WL1271_INI_CHANNEL_COUNT_2 14 - -struct wl128x_ini_band_params_2 { - u8 rx_trace_insertion_loss; - u8 tx_trace_loss[WL1271_INI_CHANNEL_COUNT_2]; - u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE]; -} __packed; - -#define WL1271_INI_RATE_GROUP_COUNT 6 - -struct wl1271_ini_fem_params_2 { - __le16 tx_bip_ref_pd_voltage; - u8 tx_bip_ref_power; - u8 tx_bip_ref_offset; - u8 tx_per_rate_pwr_limits_normal[WL1271_INI_RATE_GROUP_COUNT]; - u8 tx_per_rate_pwr_limits_degraded[WL1271_INI_RATE_GROUP_COUNT]; - u8 tx_per_rate_pwr_limits_extreme[WL1271_INI_RATE_GROUP_COUNT]; - u8 tx_per_chan_pwr_limits_11b[WL1271_INI_CHANNEL_COUNT_2]; - u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_2]; - u8 tx_pd_vs_rate_offsets[WL1271_INI_RATE_GROUP_COUNT]; - u8 tx_ibias[WL1271_INI_RATE_GROUP_COUNT]; - u8 rx_fem_insertion_loss; - u8 degraded_low_to_normal_thr; - u8 normal_to_degraded_high_thr; -} __packed; - -#define WL128X_INI_RATE_GROUP_COUNT 7 -/* low and high temperatures */ -#define WL128X_INI_PD_VS_TEMPERATURE_RANGES 2 - -struct wl128x_ini_fem_params_2 { - __le16 tx_bip_ref_pd_voltage; - u8 tx_bip_ref_power; - u8 tx_bip_ref_offset; - u8 tx_per_rate_pwr_limits_normal[WL128X_INI_RATE_GROUP_COUNT]; - u8 tx_per_rate_pwr_limits_degraded[WL128X_INI_RATE_GROUP_COUNT]; - u8 tx_per_rate_pwr_limits_extreme[WL128X_INI_RATE_GROUP_COUNT]; - u8 tx_per_chan_pwr_limits_11b[WL1271_INI_CHANNEL_COUNT_2]; - u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_2]; - u8 tx_pd_vs_rate_offsets[WL128X_INI_RATE_GROUP_COUNT]; - u8 tx_ibias[WL128X_INI_RATE_GROUP_COUNT + 1]; - u8 tx_pd_vs_chan_offsets[WL1271_INI_CHANNEL_COUNT_2]; - u8 tx_pd_vs_temperature[WL128X_INI_PD_VS_TEMPERATURE_RANGES]; - u8 rx_fem_insertion_loss; - u8 degraded_low_to_normal_thr; - u8 normal_to_degraded_high_thr; -} __packed; - -#define WL1271_INI_CHANNEL_COUNT_5 35 -#define WL1271_INI_SUB_BAND_COUNT_5 7 - -struct wl1271_ini_band_params_5 { - u8 rx_trace_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5]; - u8 tx_trace_loss[WL1271_INI_SUB_BAND_COUNT_5]; - u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE]; -} __packed; - -struct wl128x_ini_band_params_5 { - u8 rx_trace_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5]; - u8 tx_trace_loss[WL1271_INI_CHANNEL_COUNT_5]; - u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE]; -} __packed; - -struct wl1271_ini_fem_params_5 { - __le16 tx_bip_ref_pd_voltage[WL1271_INI_SUB_BAND_COUNT_5]; - u8 tx_bip_ref_power[WL1271_INI_SUB_BAND_COUNT_5]; - u8 tx_bip_ref_offset[WL1271_INI_SUB_BAND_COUNT_5]; - u8 tx_per_rate_pwr_limits_normal[WL1271_INI_RATE_GROUP_COUNT]; - u8 tx_per_rate_pwr_limits_degraded[WL1271_INI_RATE_GROUP_COUNT]; - u8 tx_per_rate_pwr_limits_extreme[WL1271_INI_RATE_GROUP_COUNT]; - u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_5]; - u8 tx_pd_vs_rate_offsets[WL1271_INI_RATE_GROUP_COUNT]; - u8 tx_ibias[WL1271_INI_RATE_GROUP_COUNT]; - u8 rx_fem_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5]; - u8 degraded_low_to_normal_thr; - u8 normal_to_degraded_high_thr; -} __packed; - -struct wl128x_ini_fem_params_5 { - __le16 tx_bip_ref_pd_voltage[WL1271_INI_SUB_BAND_COUNT_5]; - u8 tx_bip_ref_power[WL1271_INI_SUB_BAND_COUNT_5]; - u8 tx_bip_ref_offset[WL1271_INI_SUB_BAND_COUNT_5]; - u8 tx_per_rate_pwr_limits_normal[WL128X_INI_RATE_GROUP_COUNT]; - u8 tx_per_rate_pwr_limits_degraded[WL128X_INI_RATE_GROUP_COUNT]; - u8 tx_per_rate_pwr_limits_extreme[WL128X_INI_RATE_GROUP_COUNT]; - u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_5]; - u8 tx_pd_vs_rate_offsets[WL128X_INI_RATE_GROUP_COUNT]; - u8 tx_ibias[WL128X_INI_RATE_GROUP_COUNT]; - u8 tx_pd_vs_chan_offsets[WL1271_INI_CHANNEL_COUNT_5]; - u8 tx_pd_vs_temperature[WL1271_INI_SUB_BAND_COUNT_5 * - WL128X_INI_PD_VS_TEMPERATURE_RANGES]; - u8 rx_fem_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5]; - u8 degraded_low_to_normal_thr; - u8 normal_to_degraded_high_thr; -} __packed; - -/* NVS data structure */ -#define WL1271_INI_NVS_SECTION_SIZE 468 - -/* We have four FEM module types: 0-RFMD, 1-TQS, 2-SKW, 3-TQS_HP */ -#define WL1271_INI_FEM_MODULE_COUNT 4 - -/* - * In NVS we only store two FEM module entries - - * FEM modules 0,2,3 are stored in entry 0 - * FEM module 1 is stored in entry 1 - */ -#define WL12XX_NVS_FEM_MODULE_COUNT 2 - -#define WL12XX_FEM_TO_NVS_ENTRY(ini_fem_module) \ - ((ini_fem_module) == 1 ? 1 : 0) - -#define WL1271_INI_LEGACY_NVS_FILE_SIZE 800 - -struct wl1271_nvs_file { - /* NVS section - must be first! */ - u8 nvs[WL1271_INI_NVS_SECTION_SIZE]; - - /* INI section */ - struct wl1271_ini_general_params general_params; - u8 padding1; - struct wl1271_ini_band_params_2 stat_radio_params_2; - u8 padding2; - struct { - struct wl1271_ini_fem_params_2 params; - u8 padding; - } dyn_radio_params_2[WL12XX_NVS_FEM_MODULE_COUNT]; - struct wl1271_ini_band_params_5 stat_radio_params_5; - u8 padding3; - struct { - struct wl1271_ini_fem_params_5 params; - u8 padding; - } dyn_radio_params_5[WL12XX_NVS_FEM_MODULE_COUNT]; -} __packed; - -struct wl128x_nvs_file { - /* NVS section - must be first! */ - u8 nvs[WL1271_INI_NVS_SECTION_SIZE]; - - /* INI section */ - struct wl128x_ini_general_params general_params; - u8 fem_vendor_and_options; - struct wl128x_ini_band_params_2 stat_radio_params_2; - u8 padding2; - struct { - struct wl128x_ini_fem_params_2 params; - u8 padding; - } dyn_radio_params_2[WL12XX_NVS_FEM_MODULE_COUNT]; - struct wl128x_ini_band_params_5 stat_radio_params_5; - u8 padding3; - struct { - struct wl128x_ini_fem_params_5 params; - u8 padding; - } dyn_radio_params_5[WL12XX_NVS_FEM_MODULE_COUNT]; -} __packed; -#endif diff --git a/drivers/net/wireless/ti/wlcore/init.c b/drivers/net/wireless/ti/wlcore/init.c deleted file mode 100644 index 5c6f11e157d9..000000000000 --- a/drivers/net/wireless/ti/wlcore/init.c +++ /dev/null @@ -1,750 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include - -#include "debug.h" -#include "init.h" -#include "wl12xx_80211.h" -#include "acx.h" -#include "cmd.h" -#include "tx.h" -#include "io.h" -#include "hw_ops.h" - -int wl1271_init_templates_config(struct wl1271 *wl) -{ - int ret, i; - size_t max_size; - - /* send empty templates for fw memory reservation */ - ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, - wl->scan_templ_id_2_4, NULL, - WL1271_CMD_TEMPL_MAX_SIZE, - 0, WL1271_RATE_AUTOMATIC); - if (ret < 0) - return ret; - - ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, - wl->scan_templ_id_5, - NULL, WL1271_CMD_TEMPL_MAX_SIZE, 0, - WL1271_RATE_AUTOMATIC); - if (ret < 0) - return ret; - - if (wl->quirks & WLCORE_QUIRK_DUAL_PROBE_TMPL) { - ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, - wl->sched_scan_templ_id_2_4, - NULL, - WL1271_CMD_TEMPL_MAX_SIZE, - 0, WL1271_RATE_AUTOMATIC); - if (ret < 0) - return ret; - - ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, - wl->sched_scan_templ_id_5, - NULL, - WL1271_CMD_TEMPL_MAX_SIZE, - 0, WL1271_RATE_AUTOMATIC); - if (ret < 0) - return ret; - } - - ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, - CMD_TEMPL_NULL_DATA, NULL, - sizeof(struct wl12xx_null_data_template), - 0, WL1271_RATE_AUTOMATIC); - if (ret < 0) - return ret; - - ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, - CMD_TEMPL_PS_POLL, NULL, - sizeof(struct wl12xx_ps_poll_template), - 0, WL1271_RATE_AUTOMATIC); - if (ret < 0) - return ret; - - ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, - CMD_TEMPL_QOS_NULL_DATA, NULL, - sizeof - (struct ieee80211_qos_hdr), - 0, WL1271_RATE_AUTOMATIC); - if (ret < 0) - return ret; - - ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, - CMD_TEMPL_PROBE_RESPONSE, NULL, - WL1271_CMD_TEMPL_DFLT_SIZE, - 0, WL1271_RATE_AUTOMATIC); - if (ret < 0) - return ret; - - ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, - CMD_TEMPL_BEACON, NULL, - WL1271_CMD_TEMPL_DFLT_SIZE, - 0, WL1271_RATE_AUTOMATIC); - if (ret < 0) - return ret; - - max_size = sizeof(struct wl12xx_arp_rsp_template) + - WL1271_EXTRA_SPACE_MAX; - ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, - CMD_TEMPL_ARP_RSP, NULL, - max_size, - 0, WL1271_RATE_AUTOMATIC); - if (ret < 0) - return ret; - - /* - * Put very large empty placeholders for all templates. These - * reserve memory for later. - */ - ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, - CMD_TEMPL_AP_PROBE_RESPONSE, NULL, - WL1271_CMD_TEMPL_MAX_SIZE, - 0, WL1271_RATE_AUTOMATIC); - if (ret < 0) - return ret; - - ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, - CMD_TEMPL_AP_BEACON, NULL, - WL1271_CMD_TEMPL_MAX_SIZE, - 0, WL1271_RATE_AUTOMATIC); - if (ret < 0) - return ret; - - ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, - CMD_TEMPL_DEAUTH_AP, NULL, - sizeof - (struct wl12xx_disconn_template), - 0, WL1271_RATE_AUTOMATIC); - if (ret < 0) - return ret; - - for (i = 0; i < WLCORE_MAX_KLV_TEMPLATES; i++) { - ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, - CMD_TEMPL_KLV, NULL, - sizeof(struct ieee80211_qos_hdr), - i, WL1271_RATE_AUTOMATIC); - if (ret < 0) - return ret; - } - - return 0; -} - -static int wl1271_ap_init_deauth_template(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - struct wl12xx_disconn_template *tmpl; - int ret; - u32 rate; - - tmpl = kzalloc(sizeof(*tmpl), GFP_KERNEL); - if (!tmpl) { - ret = -ENOMEM; - goto out; - } - - tmpl->header.frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_DEAUTH); - - rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); - ret = wl1271_cmd_template_set(wl, wlvif->role_id, - CMD_TEMPL_DEAUTH_AP, - tmpl, sizeof(*tmpl), 0, rate); - -out: - kfree(tmpl); - return ret; -} - -static int wl1271_ap_init_null_template(struct wl1271 *wl, - struct ieee80211_vif *vif) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - struct ieee80211_hdr_3addr *nullfunc; - int ret; - u32 rate; - - nullfunc = kzalloc(sizeof(*nullfunc), GFP_KERNEL); - if (!nullfunc) { - ret = -ENOMEM; - goto out; - } - - nullfunc->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA | - IEEE80211_STYPE_NULLFUNC | - IEEE80211_FCTL_FROMDS); - - /* nullfunc->addr1 is filled by FW */ - - memcpy(nullfunc->addr2, vif->addr, ETH_ALEN); - memcpy(nullfunc->addr3, vif->addr, ETH_ALEN); - - rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); - ret = wl1271_cmd_template_set(wl, wlvif->role_id, - CMD_TEMPL_NULL_DATA, nullfunc, - sizeof(*nullfunc), 0, rate); - -out: - kfree(nullfunc); - return ret; -} - -static int wl1271_ap_init_qos_null_template(struct wl1271 *wl, - struct ieee80211_vif *vif) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - struct ieee80211_qos_hdr *qosnull; - int ret; - u32 rate; - - qosnull = kzalloc(sizeof(*qosnull), GFP_KERNEL); - if (!qosnull) { - ret = -ENOMEM; - goto out; - } - - qosnull->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA | - IEEE80211_STYPE_QOS_NULLFUNC | - IEEE80211_FCTL_FROMDS); - - /* qosnull->addr1 is filled by FW */ - - memcpy(qosnull->addr2, vif->addr, ETH_ALEN); - memcpy(qosnull->addr3, vif->addr, ETH_ALEN); - - rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); - ret = wl1271_cmd_template_set(wl, wlvif->role_id, - CMD_TEMPL_QOS_NULL_DATA, qosnull, - sizeof(*qosnull), 0, rate); - -out: - kfree(qosnull); - return ret; -} - -static int wl12xx_init_rx_config(struct wl1271 *wl) -{ - int ret; - - ret = wl1271_acx_rx_msdu_life_time(wl); - if (ret < 0) - return ret; - - return 0; -} - -static int wl12xx_init_phy_vif_config(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - int ret; - - ret = wl1271_acx_slot(wl, wlvif, DEFAULT_SLOT_TIME); - if (ret < 0) - return ret; - - ret = wl1271_acx_service_period_timeout(wl, wlvif); - if (ret < 0) - return ret; - - ret = wl1271_acx_rts_threshold(wl, wlvif, wl->hw->wiphy->rts_threshold); - if (ret < 0) - return ret; - - return 0; -} - -static int wl1271_init_sta_beacon_filter(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - int ret; - - ret = wl1271_acx_beacon_filter_table(wl, wlvif); - if (ret < 0) - return ret; - - /* enable beacon filtering */ - ret = wl1271_acx_beacon_filter_opt(wl, wlvif, true); - if (ret < 0) - return ret; - - return 0; -} - -int wl1271_init_pta(struct wl1271 *wl) -{ - int ret; - - ret = wl12xx_acx_sg_cfg(wl); - if (ret < 0) - return ret; - - ret = wl1271_acx_sg_enable(wl, wl->sg_enabled); - if (ret < 0) - return ret; - - return 0; -} - -int wl1271_init_energy_detection(struct wl1271 *wl) -{ - int ret; - - ret = wl1271_acx_cca_threshold(wl); - if (ret < 0) - return ret; - - return 0; -} - -static int wl1271_init_beacon_broadcast(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - int ret; - - ret = wl1271_acx_bcn_dtim_options(wl, wlvif); - if (ret < 0) - return ret; - - return 0; -} - -static int wl12xx_init_fwlog(struct wl1271 *wl) -{ - int ret; - - if (wl->quirks & WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED) - return 0; - - ret = wl12xx_cmd_config_fwlog(wl); - if (ret < 0) - return ret; - - return 0; -} - -/* generic sta initialization (non vif-specific) */ -static int wl1271_sta_hw_init(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int ret; - - /* PS config */ - ret = wl12xx_acx_config_ps(wl, wlvif); - if (ret < 0) - return ret; - - /* FM WLAN coexistence */ - ret = wl1271_acx_fm_coex(wl); - if (ret < 0) - return ret; - - ret = wl1271_acx_sta_rate_policies(wl, wlvif); - if (ret < 0) - return ret; - - return 0; -} - -static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl, - struct ieee80211_vif *vif) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - int ret; - - /* disable the keep-alive feature */ - ret = wl1271_acx_keep_alive_mode(wl, wlvif, false); - if (ret < 0) - return ret; - - return 0; -} - -/* generic ap initialization (non vif-specific) */ -static int wl1271_ap_hw_init(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int ret; - - ret = wl1271_init_ap_rates(wl, wlvif); - if (ret < 0) - return ret; - - return 0; -} - -int wl1271_ap_init_templates(struct wl1271 *wl, struct ieee80211_vif *vif) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - int ret; - - ret = wl1271_ap_init_deauth_template(wl, wlvif); - if (ret < 0) - return ret; - - ret = wl1271_ap_init_null_template(wl, vif); - if (ret < 0) - return ret; - - ret = wl1271_ap_init_qos_null_template(wl, vif); - if (ret < 0) - return ret; - - /* - * when operating as AP we want to receive external beacons for - * configuring ERP protection. - */ - ret = wl1271_acx_beacon_filter_opt(wl, wlvif, false); - if (ret < 0) - return ret; - - return 0; -} - -static int wl1271_ap_hw_init_post_mem(struct wl1271 *wl, - struct ieee80211_vif *vif) -{ - return wl1271_ap_init_templates(wl, vif); -} - -int wl1271_init_ap_rates(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int i, ret; - struct conf_tx_rate_class rc; - u32 supported_rates; - - wl1271_debug(DEBUG_AP, "AP basic rate set: 0x%x", - wlvif->basic_rate_set); - - if (wlvif->basic_rate_set == 0) - return -EINVAL; - - rc.enabled_rates = wlvif->basic_rate_set; - rc.long_retry_limit = 10; - rc.short_retry_limit = 10; - rc.aflags = 0; - ret = wl1271_acx_ap_rate_policy(wl, &rc, wlvif->ap.mgmt_rate_idx); - if (ret < 0) - return ret; - - /* use the min basic rate for AP broadcast/multicast */ - rc.enabled_rates = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); - rc.short_retry_limit = 10; - rc.long_retry_limit = 10; - rc.aflags = 0; - ret = wl1271_acx_ap_rate_policy(wl, &rc, wlvif->ap.bcast_rate_idx); - if (ret < 0) - return ret; - - /* - * If the basic rates contain OFDM rates, use OFDM only - * rates for unicast TX as well. Else use all supported rates. - */ - if ((wlvif->basic_rate_set & CONF_TX_OFDM_RATES)) - supported_rates = CONF_TX_OFDM_RATES; - else - supported_rates = CONF_TX_ENABLED_RATES; - - /* unconditionally enable HT rates */ - supported_rates |= CONF_TX_MCS_RATES; - - /* get extra MIMO or wide-chan rates where the HW supports it */ - supported_rates |= wlcore_hw_ap_get_mimo_wide_rate_mask(wl, wlvif); - - /* configure unicast TX rate classes */ - for (i = 0; i < wl->conf.tx.ac_conf_count; i++) { - rc.enabled_rates = supported_rates; - rc.short_retry_limit = 10; - rc.long_retry_limit = 10; - rc.aflags = 0; - ret = wl1271_acx_ap_rate_policy(wl, &rc, - wlvif->ap.ucast_rate_idx[i]); - if (ret < 0) - return ret; - } - - return 0; -} - -static int wl1271_set_ba_policies(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - /* Reset the BA RX indicators */ - wlvif->ba_allowed = true; - wl->ba_rx_session_count = 0; - - /* BA is supported in STA/AP modes */ - if (wlvif->bss_type != BSS_TYPE_AP_BSS && - wlvif->bss_type != BSS_TYPE_STA_BSS) { - wlvif->ba_support = false; - return 0; - } - - wlvif->ba_support = true; - - /* 802.11n initiator BA session setting */ - return wl12xx_acx_set_ba_initiator_policy(wl, wlvif); -} - -/* vif-specifc initialization */ -static int wl12xx_init_sta_role(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int ret; - - ret = wl1271_acx_group_address_tbl(wl, wlvif, true, NULL, 0); - if (ret < 0) - return ret; - - /* Initialize connection monitoring thresholds */ - ret = wl1271_acx_conn_monit_params(wl, wlvif, false); - if (ret < 0) - return ret; - - /* Beacon filtering */ - ret = wl1271_init_sta_beacon_filter(wl, wlvif); - if (ret < 0) - return ret; - - /* Beacons and broadcast settings */ - ret = wl1271_init_beacon_broadcast(wl, wlvif); - if (ret < 0) - return ret; - - /* Configure rssi/snr averaging weights */ - ret = wl1271_acx_rssi_snr_avg_weights(wl, wlvif); - if (ret < 0) - return ret; - - return 0; -} - -/* vif-specific intialization */ -static int wl12xx_init_ap_role(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int ret; - - ret = wl1271_acx_ap_max_tx_retry(wl, wlvif); - if (ret < 0) - return ret; - - /* initialize Tx power */ - ret = wl1271_acx_tx_power(wl, wlvif, wlvif->power_level); - if (ret < 0) - return ret; - - return 0; -} - -int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - struct conf_tx_ac_category *conf_ac; - struct conf_tx_tid *conf_tid; - bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); - int ret, i; - - /* consider all existing roles before configuring psm. */ - - if (wl->ap_count == 0 && is_ap) { /* first AP */ - /* Configure for power always on */ - ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM); - if (ret < 0) - return ret; - /* first STA, no APs */ - } else if (wl->sta_count == 0 && wl->ap_count == 0 && !is_ap) { - u8 sta_auth = wl->conf.conn.sta_sleep_auth; - /* Configure for power according to debugfs */ - if (sta_auth != WL1271_PSM_ILLEGAL) - ret = wl1271_acx_sleep_auth(wl, sta_auth); - /* Configure for ELP power saving */ - else - ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_ELP); - - if (ret < 0) - return ret; - } - - /* Mode specific init */ - if (is_ap) { - ret = wl1271_ap_hw_init(wl, wlvif); - if (ret < 0) - return ret; - - ret = wl12xx_init_ap_role(wl, wlvif); - if (ret < 0) - return ret; - } else { - ret = wl1271_sta_hw_init(wl, wlvif); - if (ret < 0) - return ret; - - ret = wl12xx_init_sta_role(wl, wlvif); - if (ret < 0) - return ret; - } - - wl12xx_init_phy_vif_config(wl, wlvif); - - /* Default TID/AC configuration */ - BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count); - for (i = 0; i < wl->conf.tx.tid_conf_count; i++) { - conf_ac = &wl->conf.tx.ac_conf[i]; - ret = wl1271_acx_ac_cfg(wl, wlvif, conf_ac->ac, - conf_ac->cw_min, conf_ac->cw_max, - conf_ac->aifsn, conf_ac->tx_op_limit); - if (ret < 0) - return ret; - - conf_tid = &wl->conf.tx.tid_conf[i]; - ret = wl1271_acx_tid_cfg(wl, wlvif, - conf_tid->queue_id, - conf_tid->channel_type, - conf_tid->tsid, - conf_tid->ps_scheme, - conf_tid->ack_policy, - conf_tid->apsd_conf[0], - conf_tid->apsd_conf[1]); - if (ret < 0) - return ret; - } - - /* Configure HW encryption */ - ret = wl1271_acx_feature_cfg(wl, wlvif); - if (ret < 0) - return ret; - - /* Mode specific init - post mem init */ - if (is_ap) - ret = wl1271_ap_hw_init_post_mem(wl, vif); - else - ret = wl1271_sta_hw_init_post_mem(wl, vif); - - if (ret < 0) - return ret; - - /* Configure initiator BA sessions policies */ - ret = wl1271_set_ba_policies(wl, wlvif); - if (ret < 0) - return ret; - - ret = wlcore_hw_init_vif(wl, wlvif); - if (ret < 0) - return ret; - - return 0; -} - -int wl1271_hw_init(struct wl1271 *wl) -{ - int ret; - - /* Chip-specific hw init */ - ret = wl->ops->hw_init(wl); - if (ret < 0) - return ret; - - /* Init templates */ - ret = wl1271_init_templates_config(wl); - if (ret < 0) - return ret; - - ret = wl12xx_acx_mem_cfg(wl); - if (ret < 0) - return ret; - - /* Configure the FW logger */ - ret = wl12xx_init_fwlog(wl); - if (ret < 0) - return ret; - - ret = wlcore_cmd_regdomain_config_locked(wl); - if (ret < 0) - return ret; - - /* Bluetooth WLAN coexistence */ - ret = wl1271_init_pta(wl); - if (ret < 0) - return ret; - - /* Default memory configuration */ - ret = wl1271_acx_init_mem_config(wl); - if (ret < 0) - return ret; - - /* RX config */ - ret = wl12xx_init_rx_config(wl); - if (ret < 0) - goto out_free_memmap; - - ret = wl1271_acx_dco_itrim_params(wl); - if (ret < 0) - goto out_free_memmap; - - /* Configure TX patch complete interrupt behavior */ - ret = wl1271_acx_tx_config_options(wl); - if (ret < 0) - goto out_free_memmap; - - /* RX complete interrupt pacing */ - ret = wl1271_acx_init_rx_interrupt(wl); - if (ret < 0) - goto out_free_memmap; - - /* Energy detection */ - ret = wl1271_init_energy_detection(wl); - if (ret < 0) - goto out_free_memmap; - - /* Default fragmentation threshold */ - ret = wl1271_acx_frag_threshold(wl, wl->hw->wiphy->frag_threshold); - if (ret < 0) - goto out_free_memmap; - - /* Enable data path */ - ret = wl1271_cmd_data_path(wl, 1); - if (ret < 0) - goto out_free_memmap; - - /* configure PM */ - ret = wl1271_acx_pm_config(wl); - if (ret < 0) - goto out_free_memmap; - - ret = wl12xx_acx_set_rate_mgmt_params(wl); - if (ret < 0) - goto out_free_memmap; - - /* configure hangover */ - ret = wl12xx_acx_config_hangover(wl); - if (ret < 0) - goto out_free_memmap; - - return 0; - - out_free_memmap: - kfree(wl->target_mem_map); - wl->target_mem_map = NULL; - - return ret; -} diff --git a/drivers/net/wireless/ti/wlcore/init.h b/drivers/net/wireless/ti/wlcore/init.h deleted file mode 100644 index a45fbfddec19..000000000000 --- a/drivers/net/wireless/ti/wlcore/init.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __INIT_H__ -#define __INIT_H__ - -#include "wlcore.h" - -int wl1271_hw_init_power_auth(struct wl1271 *wl); -int wl1271_init_templates_config(struct wl1271 *wl); -int wl1271_init_pta(struct wl1271 *wl); -int wl1271_init_energy_detection(struct wl1271 *wl); -int wl1271_chip_specific_init(struct wl1271 *wl); -int wl1271_hw_init(struct wl1271 *wl); -int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif); -int wl1271_init_ap_rates(struct wl1271 *wl, struct wl12xx_vif *wlvif); -int wl1271_ap_init_templates(struct wl1271 *wl, struct ieee80211_vif *vif); - -#endif diff --git a/drivers/net/wireless/ti/wlcore/io.c b/drivers/net/wireless/ti/wlcore/io.c deleted file mode 100644 index 68e74eefd296..000000000000 --- a/drivers/net/wireless/ti/wlcore/io.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2008-2010 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include -#include - -#include "wlcore.h" -#include "debug.h" -#include "wl12xx_80211.h" -#include "io.h" -#include "tx.h" - -bool wl1271_set_block_size(struct wl1271 *wl) -{ - if (wl->if_ops->set_block_size) { - wl->if_ops->set_block_size(wl->dev, WL12XX_BUS_BLOCK_SIZE); - return true; - } - - return false; -} - -void wlcore_disable_interrupts(struct wl1271 *wl) -{ - disable_irq(wl->irq); -} -EXPORT_SYMBOL_GPL(wlcore_disable_interrupts); - -void wlcore_disable_interrupts_nosync(struct wl1271 *wl) -{ - disable_irq_nosync(wl->irq); -} -EXPORT_SYMBOL_GPL(wlcore_disable_interrupts_nosync); - -void wlcore_enable_interrupts(struct wl1271 *wl) -{ - enable_irq(wl->irq); -} -EXPORT_SYMBOL_GPL(wlcore_enable_interrupts); - -void wlcore_synchronize_interrupts(struct wl1271 *wl) -{ - synchronize_irq(wl->irq); -} -EXPORT_SYMBOL_GPL(wlcore_synchronize_interrupts); - -int wlcore_translate_addr(struct wl1271 *wl, int addr) -{ - struct wlcore_partition_set *part = &wl->curr_part; - - /* - * To translate, first check to which window of addresses the - * particular address belongs. Then subtract the starting address - * of that window from the address. Then, add offset of the - * translated region. - * - * The translated regions occur next to each other in physical device - * memory, so just add the sizes of the preceding address regions to - * get the offset to the new region. - */ - if ((addr >= part->mem.start) && - (addr < part->mem.start + part->mem.size)) - return addr - part->mem.start; - else if ((addr >= part->reg.start) && - (addr < part->reg.start + part->reg.size)) - return addr - part->reg.start + part->mem.size; - else if ((addr >= part->mem2.start) && - (addr < part->mem2.start + part->mem2.size)) - return addr - part->mem2.start + part->mem.size + - part->reg.size; - else if ((addr >= part->mem3.start) && - (addr < part->mem3.start + part->mem3.size)) - return addr - part->mem3.start + part->mem.size + - part->reg.size + part->mem2.size; - - WARN(1, "HW address 0x%x out of range", addr); - return 0; -} -EXPORT_SYMBOL_GPL(wlcore_translate_addr); - -/* Set the partitions to access the chip addresses - * - * To simplify driver code, a fixed (virtual) memory map is defined for - * register and memory addresses. Because in the chipset, in different stages - * of operation, those addresses will move around, an address translation - * mechanism is required. - * - * There are four partitions (three memory and one register partition), - * which are mapped to two different areas of the hardware memory. - * - * Virtual address - * space - * - * | | - * ...+----+--> mem.start - * Physical address ... | | - * space ... | | [PART_0] - * ... | | - * 00000000 <--+----+... ...+----+--> mem.start + mem.size - * | | ... | | - * |MEM | ... | | - * | | ... | | - * mem.size <--+----+... | | {unused area) - * | | ... | | - * |REG | ... | | - * mem.size | | ... | | - * + <--+----+... ...+----+--> reg.start - * reg.size | | ... | | - * |MEM2| ... | | [PART_1] - * | | ... | | - * ...+----+--> reg.start + reg.size - * | | - * - */ -int wlcore_set_partition(struct wl1271 *wl, - const struct wlcore_partition_set *p) -{ - int ret; - - /* copy partition info */ - memcpy(&wl->curr_part, p, sizeof(*p)); - - wl1271_debug(DEBUG_IO, "mem_start %08X mem_size %08X", - p->mem.start, p->mem.size); - wl1271_debug(DEBUG_IO, "reg_start %08X reg_size %08X", - p->reg.start, p->reg.size); - wl1271_debug(DEBUG_IO, "mem2_start %08X mem2_size %08X", - p->mem2.start, p->mem2.size); - wl1271_debug(DEBUG_IO, "mem3_start %08X mem3_size %08X", - p->mem3.start, p->mem3.size); - - ret = wlcore_raw_write32(wl, HW_PART0_START_ADDR, p->mem.start); - if (ret < 0) - goto out; - - ret = wlcore_raw_write32(wl, HW_PART0_SIZE_ADDR, p->mem.size); - if (ret < 0) - goto out; - - ret = wlcore_raw_write32(wl, HW_PART1_START_ADDR, p->reg.start); - if (ret < 0) - goto out; - - ret = wlcore_raw_write32(wl, HW_PART1_SIZE_ADDR, p->reg.size); - if (ret < 0) - goto out; - - ret = wlcore_raw_write32(wl, HW_PART2_START_ADDR, p->mem2.start); - if (ret < 0) - goto out; - - ret = wlcore_raw_write32(wl, HW_PART2_SIZE_ADDR, p->mem2.size); - if (ret < 0) - goto out; - - /* - * We don't need the size of the last partition, as it is - * automatically calculated based on the total memory size and - * the sizes of the previous partitions. - */ - ret = wlcore_raw_write32(wl, HW_PART3_START_ADDR, p->mem3.start); - -out: - return ret; -} -EXPORT_SYMBOL_GPL(wlcore_set_partition); - -void wl1271_io_reset(struct wl1271 *wl) -{ - if (wl->if_ops->reset) - wl->if_ops->reset(wl->dev); -} - -void wl1271_io_init(struct wl1271 *wl) -{ - if (wl->if_ops->init) - wl->if_ops->init(wl->dev); -} diff --git a/drivers/net/wireless/ti/wlcore/io.h b/drivers/net/wireless/ti/wlcore/io.h deleted file mode 100644 index af7d9f9b3b4d..000000000000 --- a/drivers/net/wireless/ti/wlcore/io.h +++ /dev/null @@ -1,234 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 1998-2009 Texas Instruments. All rights reserved. - * Copyright (C) 2008-2010 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __IO_H__ -#define __IO_H__ - -#include - -#define HW_ACCESS_MEMORY_MAX_RANGE 0x1FFC0 - -#define HW_PARTITION_REGISTERS_ADDR 0x1FFC0 -#define HW_PART0_SIZE_ADDR (HW_PARTITION_REGISTERS_ADDR) -#define HW_PART0_START_ADDR (HW_PARTITION_REGISTERS_ADDR + 4) -#define HW_PART1_SIZE_ADDR (HW_PARTITION_REGISTERS_ADDR + 8) -#define HW_PART1_START_ADDR (HW_PARTITION_REGISTERS_ADDR + 12) -#define HW_PART2_SIZE_ADDR (HW_PARTITION_REGISTERS_ADDR + 16) -#define HW_PART2_START_ADDR (HW_PARTITION_REGISTERS_ADDR + 20) -#define HW_PART3_START_ADDR (HW_PARTITION_REGISTERS_ADDR + 24) - -#define HW_ACCESS_REGISTER_SIZE 4 - -#define HW_ACCESS_PRAM_MAX_RANGE 0x3c000 - -struct wl1271; - -void wlcore_disable_interrupts(struct wl1271 *wl); -void wlcore_disable_interrupts_nosync(struct wl1271 *wl); -void wlcore_enable_interrupts(struct wl1271 *wl); -void wlcore_synchronize_interrupts(struct wl1271 *wl); - -void wl1271_io_reset(struct wl1271 *wl); -void wl1271_io_init(struct wl1271 *wl); -int wlcore_translate_addr(struct wl1271 *wl, int addr); - -/* Raw target IO, address is not translated */ -static inline int __must_check wlcore_raw_write(struct wl1271 *wl, int addr, - void *buf, size_t len, - bool fixed) -{ - int ret; - - if (test_bit(WL1271_FLAG_IO_FAILED, &wl->flags)) - return -EIO; - - ret = wl->if_ops->write(wl->dev, addr, buf, len, fixed); - if (ret && wl->state != WLCORE_STATE_OFF) - set_bit(WL1271_FLAG_IO_FAILED, &wl->flags); - - return ret; -} - -static inline int __must_check wlcore_raw_read(struct wl1271 *wl, int addr, - void *buf, size_t len, - bool fixed) -{ - int ret; - - if (test_bit(WL1271_FLAG_IO_FAILED, &wl->flags)) - return -EIO; - - ret = wl->if_ops->read(wl->dev, addr, buf, len, fixed); - if (ret && wl->state != WLCORE_STATE_OFF) - set_bit(WL1271_FLAG_IO_FAILED, &wl->flags); - - return ret; -} - -static inline int __must_check wlcore_raw_read_data(struct wl1271 *wl, int reg, - void *buf, size_t len, - bool fixed) -{ - return wlcore_raw_read(wl, wl->rtable[reg], buf, len, fixed); -} - -static inline int __must_check wlcore_raw_write_data(struct wl1271 *wl, int reg, - void *buf, size_t len, - bool fixed) -{ - return wlcore_raw_write(wl, wl->rtable[reg], buf, len, fixed); -} - -static inline int __must_check wlcore_raw_read32(struct wl1271 *wl, int addr, - u32 *val) -{ - int ret; - - ret = wlcore_raw_read(wl, addr, wl->buffer_32, - sizeof(*wl->buffer_32), false); - if (ret < 0) - return ret; - - if (val) - *val = le32_to_cpu(*wl->buffer_32); - - return 0; -} - -static inline int __must_check wlcore_raw_write32(struct wl1271 *wl, int addr, - u32 val) -{ - *wl->buffer_32 = cpu_to_le32(val); - return wlcore_raw_write(wl, addr, wl->buffer_32, - sizeof(*wl->buffer_32), false); -} - -static inline int __must_check wlcore_read(struct wl1271 *wl, int addr, - void *buf, size_t len, bool fixed) -{ - int physical; - - physical = wlcore_translate_addr(wl, addr); - - return wlcore_raw_read(wl, physical, buf, len, fixed); -} - -static inline int __must_check wlcore_write(struct wl1271 *wl, int addr, - void *buf, size_t len, bool fixed) -{ - int physical; - - physical = wlcore_translate_addr(wl, addr); - - return wlcore_raw_write(wl, physical, buf, len, fixed); -} - -static inline int __must_check wlcore_write_data(struct wl1271 *wl, int reg, - void *buf, size_t len, - bool fixed) -{ - return wlcore_write(wl, wl->rtable[reg], buf, len, fixed); -} - -static inline int __must_check wlcore_read_data(struct wl1271 *wl, int reg, - void *buf, size_t len, - bool fixed) -{ - return wlcore_read(wl, wl->rtable[reg], buf, len, fixed); -} - -static inline int __must_check wlcore_read_hwaddr(struct wl1271 *wl, int hwaddr, - void *buf, size_t len, - bool fixed) -{ - int physical; - int addr; - - /* Addresses are stored internally as addresses to 32 bytes blocks */ - addr = hwaddr << 5; - - physical = wlcore_translate_addr(wl, addr); - - return wlcore_raw_read(wl, physical, buf, len, fixed); -} - -static inline int __must_check wlcore_read32(struct wl1271 *wl, int addr, - u32 *val) -{ - return wlcore_raw_read32(wl, wlcore_translate_addr(wl, addr), val); -} - -static inline int __must_check wlcore_write32(struct wl1271 *wl, int addr, - u32 val) -{ - return wlcore_raw_write32(wl, wlcore_translate_addr(wl, addr), val); -} - -static inline int __must_check wlcore_read_reg(struct wl1271 *wl, int reg, - u32 *val) -{ - return wlcore_raw_read32(wl, - wlcore_translate_addr(wl, wl->rtable[reg]), - val); -} - -static inline int __must_check wlcore_write_reg(struct wl1271 *wl, int reg, - u32 val) -{ - return wlcore_raw_write32(wl, - wlcore_translate_addr(wl, wl->rtable[reg]), - val); -} - -static inline void wl1271_power_off(struct wl1271 *wl) -{ - int ret; - - if (!test_bit(WL1271_FLAG_GPIO_POWER, &wl->flags)) - return; - - ret = wl->if_ops->power(wl->dev, false); - if (!ret) - clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); -} - -static inline int wl1271_power_on(struct wl1271 *wl) -{ - int ret = wl->if_ops->power(wl->dev, true); - if (ret == 0) - set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); - - return ret; -} - -int wlcore_set_partition(struct wl1271 *wl, - const struct wlcore_partition_set *p); - -bool wl1271_set_block_size(struct wl1271 *wl); - -/* Functions from wl1271_main.c */ - -int wl1271_tx_dummy_packet(struct wl1271 *wl); - -#endif diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c deleted file mode 100644 index 953111a502ee..000000000000 --- a/drivers/net/wireless/ti/wlcore/main.c +++ /dev/null @@ -1,6209 +0,0 @@ - -/* - * This file is part of wl1271 - * - * Copyright (C) 2008-2010 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wlcore.h" -#include "debug.h" -#include "wl12xx_80211.h" -#include "io.h" -#include "event.h" -#include "tx.h" -#include "rx.h" -#include "ps.h" -#include "init.h" -#include "debugfs.h" -#include "cmd.h" -#include "boot.h" -#include "testmode.h" -#include "scan.h" -#include "hw_ops.h" - -#define WL1271_BOOT_RETRIES 3 - -#define WL1271_BOOT_RETRIES 3 - -static char *fwlog_param; -static int bug_on_recovery = -1; -static int no_recovery = -1; - -static void __wl1271_op_remove_interface(struct wl1271 *wl, - struct ieee80211_vif *vif, - bool reset_tx_queues); -static void wlcore_op_stop_locked(struct wl1271 *wl); -static void wl1271_free_ap_keys(struct wl1271 *wl, struct wl12xx_vif *wlvif); - -static int wl12xx_set_authorized(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - int ret; - - if (WARN_ON(wlvif->bss_type != BSS_TYPE_STA_BSS)) - return -EINVAL; - - if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) - return 0; - - if (test_and_set_bit(WLVIF_FLAG_STA_STATE_SENT, &wlvif->flags)) - return 0; - - ret = wl12xx_cmd_set_peer_state(wl, wlvif, wlvif->sta.hlid); - if (ret < 0) - return ret; - - wl1271_info("Association completed."); - return 0; -} - -static void wl1271_reg_notify(struct wiphy *wiphy, - struct regulatory_request *request) -{ - struct ieee80211_supported_band *band; - struct ieee80211_channel *ch; - int i; - struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); - struct wl1271 *wl = hw->priv; - - band = wiphy->bands[IEEE80211_BAND_5GHZ]; - for (i = 0; i < band->n_channels; i++) { - ch = &band->channels[i]; - if (ch->flags & IEEE80211_CHAN_DISABLED) - continue; - - if (ch->flags & IEEE80211_CHAN_RADAR) - ch->flags |= IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_PASSIVE_SCAN; - - } - - wlcore_regdomain_config(wl); -} - -static int wl1271_set_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif, - bool enable) -{ - int ret = 0; - - /* we should hold wl->mutex */ - ret = wl1271_acx_ps_rx_streaming(wl, wlvif, enable); - if (ret < 0) - goto out; - - if (enable) - set_bit(WLVIF_FLAG_RX_STREAMING_STARTED, &wlvif->flags); - else - clear_bit(WLVIF_FLAG_RX_STREAMING_STARTED, &wlvif->flags); -out: - return ret; -} - -/* - * this function is being called when the rx_streaming interval - * has beed changed or rx_streaming should be disabled - */ -int wl1271_recalc_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int ret = 0; - int period = wl->conf.rx_streaming.interval; - - /* don't reconfigure if rx_streaming is disabled */ - if (!test_bit(WLVIF_FLAG_RX_STREAMING_STARTED, &wlvif->flags)) - goto out; - - /* reconfigure/disable according to new streaming_period */ - if (period && - test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) && - (wl->conf.rx_streaming.always || - test_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags))) - ret = wl1271_set_rx_streaming(wl, wlvif, true); - else { - ret = wl1271_set_rx_streaming(wl, wlvif, false); - /* don't cancel_work_sync since we might deadlock */ - del_timer_sync(&wlvif->rx_streaming_timer); - } -out: - return ret; -} - -static void wl1271_rx_streaming_enable_work(struct work_struct *work) -{ - int ret; - struct wl12xx_vif *wlvif = container_of(work, struct wl12xx_vif, - rx_streaming_enable_work); - struct wl1271 *wl = wlvif->wl; - - mutex_lock(&wl->mutex); - - if (test_bit(WLVIF_FLAG_RX_STREAMING_STARTED, &wlvif->flags) || - !test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) || - (!wl->conf.rx_streaming.always && - !test_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags))) - goto out; - - if (!wl->conf.rx_streaming.interval) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = wl1271_set_rx_streaming(wl, wlvif, true); - if (ret < 0) - goto out_sleep; - - /* stop it after some time of inactivity */ - mod_timer(&wlvif->rx_streaming_timer, - jiffies + msecs_to_jiffies(wl->conf.rx_streaming.duration)); - -out_sleep: - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); -} - -static void wl1271_rx_streaming_disable_work(struct work_struct *work) -{ - int ret; - struct wl12xx_vif *wlvif = container_of(work, struct wl12xx_vif, - rx_streaming_disable_work); - struct wl1271 *wl = wlvif->wl; - - mutex_lock(&wl->mutex); - - if (!test_bit(WLVIF_FLAG_RX_STREAMING_STARTED, &wlvif->flags)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = wl1271_set_rx_streaming(wl, wlvif, false); - if (ret) - goto out_sleep; - -out_sleep: - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); -} - -static void wl1271_rx_streaming_timer(unsigned long data) -{ - struct wl12xx_vif *wlvif = (struct wl12xx_vif *)data; - struct wl1271 *wl = wlvif->wl; - ieee80211_queue_work(wl->hw, &wlvif->rx_streaming_disable_work); -} - -/* wl->mutex must be taken */ -void wl12xx_rearm_tx_watchdog_locked(struct wl1271 *wl) -{ - /* if the watchdog is not armed, don't do anything */ - if (wl->tx_allocated_blocks == 0) - return; - - cancel_delayed_work(&wl->tx_watchdog_work); - ieee80211_queue_delayed_work(wl->hw, &wl->tx_watchdog_work, - msecs_to_jiffies(wl->conf.tx.tx_watchdog_timeout)); -} - -static void wl12xx_tx_watchdog_work(struct work_struct *work) -{ - struct delayed_work *dwork; - struct wl1271 *wl; - - dwork = container_of(work, struct delayed_work, work); - wl = container_of(dwork, struct wl1271, tx_watchdog_work); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - /* Tx went out in the meantime - everything is ok */ - if (unlikely(wl->tx_allocated_blocks == 0)) - goto out; - - /* - * if a ROC is in progress, we might not have any Tx for a long - * time (e.g. pending Tx on the non-ROC channels) - */ - if (find_first_bit(wl->roc_map, WL12XX_MAX_ROLES) < WL12XX_MAX_ROLES) { - wl1271_debug(DEBUG_TX, "No Tx (in FW) for %d ms due to ROC", - wl->conf.tx.tx_watchdog_timeout); - wl12xx_rearm_tx_watchdog_locked(wl); - goto out; - } - - /* - * if a scan is in progress, we might not have any Tx for a long - * time - */ - if (wl->scan.state != WL1271_SCAN_STATE_IDLE) { - wl1271_debug(DEBUG_TX, "No Tx (in FW) for %d ms due to scan", - wl->conf.tx.tx_watchdog_timeout); - wl12xx_rearm_tx_watchdog_locked(wl); - goto out; - } - - /* - * AP might cache a frame for a long time for a sleeping station, - * so rearm the timer if there's an AP interface with stations. If - * Tx is genuinely stuck we will most hopefully discover it when all - * stations are removed due to inactivity. - */ - if (wl->active_sta_count) { - wl1271_debug(DEBUG_TX, "No Tx (in FW) for %d ms. AP has " - " %d stations", - wl->conf.tx.tx_watchdog_timeout, - wl->active_sta_count); - wl12xx_rearm_tx_watchdog_locked(wl); - goto out; - } - - wl1271_error("Tx stuck (in FW) for %d ms. Starting recovery", - wl->conf.tx.tx_watchdog_timeout); - wl12xx_queue_recovery_work(wl); - -out: - mutex_unlock(&wl->mutex); -} - -static void wlcore_adjust_conf(struct wl1271 *wl) -{ - /* Adjust settings according to optional module parameters */ - - if (fwlog_param) { - if (!strcmp(fwlog_param, "continuous")) { - wl->conf.fwlog.mode = WL12XX_FWLOG_CONTINUOUS; - } else if (!strcmp(fwlog_param, "ondemand")) { - wl->conf.fwlog.mode = WL12XX_FWLOG_ON_DEMAND; - } else if (!strcmp(fwlog_param, "dbgpins")) { - wl->conf.fwlog.mode = WL12XX_FWLOG_CONTINUOUS; - wl->conf.fwlog.output = WL12XX_FWLOG_OUTPUT_DBG_PINS; - } else if (!strcmp(fwlog_param, "disable")) { - wl->conf.fwlog.mem_blocks = 0; - wl->conf.fwlog.output = WL12XX_FWLOG_OUTPUT_NONE; - } else { - wl1271_error("Unknown fwlog parameter %s", fwlog_param); - } - } - - if (bug_on_recovery != -1) - wl->conf.recovery.bug_on_recovery = (u8) bug_on_recovery; - - if (no_recovery != -1) - wl->conf.recovery.no_recovery = (u8) no_recovery; -} - -static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - u8 hlid, u8 tx_pkts) -{ - bool fw_ps; - - fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map); - - /* - * Wake up from high level PS if the STA is asleep with too little - * packets in FW or if the STA is awake. - */ - if (!fw_ps || tx_pkts < WL1271_PS_STA_MAX_PACKETS) - wl12xx_ps_link_end(wl, wlvif, hlid); - - /* - * Start high-level PS if the STA is asleep with enough blocks in FW. - * Make an exception if this is the only connected link. In this - * case FW-memory congestion is less of a problem. - * Note that a single connected STA means 3 active links, since we must - * account for the global and broadcast AP links. The "fw_ps" check - * assures us the third link is a STA connected to the AP. Otherwise - * the FW would not set the PSM bit. - */ - else if (wl->active_link_count > 3 && fw_ps && - tx_pkts >= WL1271_PS_STA_MAX_PACKETS) - wl12xx_ps_link_start(wl, wlvif, hlid, true); -} - -static void wl12xx_irq_update_links_status(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct wl_fw_status_2 *status) -{ - u32 cur_fw_ps_map; - u8 hlid; - - cur_fw_ps_map = le32_to_cpu(status->link_ps_bitmap); - if (wl->ap_fw_ps_map != cur_fw_ps_map) { - wl1271_debug(DEBUG_PSM, - "link ps prev 0x%x cur 0x%x changed 0x%x", - wl->ap_fw_ps_map, cur_fw_ps_map, - wl->ap_fw_ps_map ^ cur_fw_ps_map); - - wl->ap_fw_ps_map = cur_fw_ps_map; - } - - for_each_set_bit(hlid, wlvif->ap.sta_hlid_map, WL12XX_MAX_LINKS) - wl12xx_irq_ps_regulate_link(wl, wlvif, hlid, - wl->links[hlid].allocated_pkts); -} - -static int wlcore_fw_status(struct wl1271 *wl, - struct wl_fw_status_1 *status_1, - struct wl_fw_status_2 *status_2) -{ - struct wl12xx_vif *wlvif; - struct timespec ts; - u32 old_tx_blk_count = wl->tx_blocks_available; - int avail, freed_blocks; - int i; - size_t status_len; - int ret; - struct wl1271_link *lnk; - - status_len = WLCORE_FW_STATUS_1_LEN(wl->num_rx_desc) + - sizeof(*status_2) + wl->fw_status_priv_len; - - ret = wlcore_raw_read_data(wl, REG_RAW_FW_STATUS_ADDR, status_1, - status_len, false); - if (ret < 0) - return ret; - - wl1271_debug(DEBUG_IRQ, "intr: 0x%x (fw_rx_counter = %d, " - "drv_rx_counter = %d, tx_results_counter = %d)", - status_1->intr, - status_1->fw_rx_counter, - status_1->drv_rx_counter, - status_1->tx_results_counter); - - for (i = 0; i < NUM_TX_QUEUES; i++) { - /* prevent wrap-around in freed-packets counter */ - wl->tx_allocated_pkts[i] -= - (status_2->counters.tx_released_pkts[i] - - wl->tx_pkts_freed[i]) & 0xff; - - wl->tx_pkts_freed[i] = status_2->counters.tx_released_pkts[i]; - } - - - for_each_set_bit(i, wl->links_map, WL12XX_MAX_LINKS) { - u8 diff; - lnk = &wl->links[i]; - - /* prevent wrap-around in freed-packets counter */ - diff = (status_2->counters.tx_lnk_free_pkts[i] - - lnk->prev_freed_pkts) & 0xff; - - if (diff == 0) - continue; - - lnk->allocated_pkts -= diff; - lnk->prev_freed_pkts = status_2->counters.tx_lnk_free_pkts[i]; - - /* accumulate the prev_freed_pkts counter */ - lnk->total_freed_pkts += diff; - } - - /* prevent wrap-around in total blocks counter */ - if (likely(wl->tx_blocks_freed <= - le32_to_cpu(status_2->total_released_blks))) - freed_blocks = le32_to_cpu(status_2->total_released_blks) - - wl->tx_blocks_freed; - else - freed_blocks = 0x100000000LL - wl->tx_blocks_freed + - le32_to_cpu(status_2->total_released_blks); - - wl->tx_blocks_freed = le32_to_cpu(status_2->total_released_blks); - - wl->tx_allocated_blocks -= freed_blocks; - - /* - * If the FW freed some blocks: - * If we still have allocated blocks - re-arm the timer, Tx is - * not stuck. Otherwise, cancel the timer (no Tx currently). - */ - if (freed_blocks) { - if (wl->tx_allocated_blocks) - wl12xx_rearm_tx_watchdog_locked(wl); - else - cancel_delayed_work(&wl->tx_watchdog_work); - } - - avail = le32_to_cpu(status_2->tx_total) - wl->tx_allocated_blocks; - - /* - * The FW might change the total number of TX memblocks before - * we get a notification about blocks being released. Thus, the - * available blocks calculation might yield a temporary result - * which is lower than the actual available blocks. Keeping in - * mind that only blocks that were allocated can be moved from - * TX to RX, tx_blocks_available should never decrease here. - */ - wl->tx_blocks_available = max((int)wl->tx_blocks_available, - avail); - - /* if more blocks are available now, tx work can be scheduled */ - if (wl->tx_blocks_available > old_tx_blk_count) - clear_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags); - - /* for AP update num of allocated TX blocks per link and ps status */ - wl12xx_for_each_wlvif_ap(wl, wlvif) { - wl12xx_irq_update_links_status(wl, wlvif, status_2); - } - - /* update the host-chipset time offset */ - getnstimeofday(&ts); - wl->time_offset = (timespec_to_ns(&ts) >> 10) - - (s64)le32_to_cpu(status_2->fw_localtime); - - wl->fw_fast_lnk_map = le32_to_cpu(status_2->link_fast_bitmap); - - return 0; -} - -static void wl1271_flush_deferred_work(struct wl1271 *wl) -{ - struct sk_buff *skb; - - /* Pass all received frames to the network stack */ - while ((skb = skb_dequeue(&wl->deferred_rx_queue))) - ieee80211_rx_ni(wl->hw, skb); - - /* Return sent skbs to the network stack */ - while ((skb = skb_dequeue(&wl->deferred_tx_queue))) - ieee80211_tx_status_ni(wl->hw, skb); -} - -static void wl1271_netstack_work(struct work_struct *work) -{ - struct wl1271 *wl = - container_of(work, struct wl1271, netstack_work); - - do { - wl1271_flush_deferred_work(wl); - } while (skb_queue_len(&wl->deferred_rx_queue)); -} - -#define WL1271_IRQ_MAX_LOOPS 256 - -static int wlcore_irq_locked(struct wl1271 *wl) -{ - int ret = 0; - u32 intr; - int loopcount = WL1271_IRQ_MAX_LOOPS; - bool done = false; - unsigned int defer_count; - unsigned long flags; - - /* - * In case edge triggered interrupt must be used, we cannot iterate - * more than once without introducing race conditions with the hardirq. - */ - if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) - loopcount = 1; - - wl1271_debug(DEBUG_IRQ, "IRQ work"); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - while (!done && loopcount--) { - /* - * In order to avoid a race with the hardirq, clear the flag - * before acknowledging the chip. Since the mutex is held, - * wl1271_ps_elp_wakeup cannot be called concurrently. - */ - clear_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags); - smp_mb__after_clear_bit(); - - ret = wlcore_fw_status(wl, wl->fw_status_1, wl->fw_status_2); - if (ret < 0) - goto out; - - wlcore_hw_tx_immediate_compl(wl); - - intr = le32_to_cpu(wl->fw_status_1->intr); - intr &= WLCORE_ALL_INTR_MASK; - if (!intr) { - done = true; - continue; - } - - if (unlikely(intr & WL1271_ACX_INTR_WATCHDOG)) { - wl1271_error("HW watchdog interrupt received! starting recovery."); - wl->watchdog_recovery = true; - ret = -EIO; - - /* restarting the chip. ignore any other interrupt. */ - goto out; - } - - if (unlikely(intr & WL1271_ACX_SW_INTR_WATCHDOG)) { - wl1271_error("SW watchdog interrupt received! " - "starting recovery."); - wl->watchdog_recovery = true; - ret = -EIO; - - /* restarting the chip. ignore any other interrupt. */ - goto out; - } - - if (likely(intr & WL1271_ACX_INTR_DATA)) { - wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_DATA"); - - ret = wlcore_rx(wl, wl->fw_status_1); - if (ret < 0) - goto out; - - /* Check if any tx blocks were freed */ - spin_lock_irqsave(&wl->wl_lock, flags); - if (!test_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags) && - wl1271_tx_total_queue_count(wl) > 0) { - spin_unlock_irqrestore(&wl->wl_lock, flags); - /* - * In order to avoid starvation of the TX path, - * call the work function directly. - */ - ret = wlcore_tx_work_locked(wl); - if (ret < 0) - goto out; - } else { - spin_unlock_irqrestore(&wl->wl_lock, flags); - } - - /* check for tx results */ - ret = wlcore_hw_tx_delayed_compl(wl); - if (ret < 0) - goto out; - - /* Make sure the deferred queues don't get too long */ - defer_count = skb_queue_len(&wl->deferred_tx_queue) + - skb_queue_len(&wl->deferred_rx_queue); - if (defer_count > WL1271_DEFERRED_QUEUE_LIMIT) - wl1271_flush_deferred_work(wl); - } - - if (intr & WL1271_ACX_INTR_EVENT_A) { - wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_EVENT_A"); - ret = wl1271_event_handle(wl, 0); - if (ret < 0) - goto out; - } - - if (intr & WL1271_ACX_INTR_EVENT_B) { - wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_EVENT_B"); - ret = wl1271_event_handle(wl, 1); - if (ret < 0) - goto out; - } - - if (intr & WL1271_ACX_INTR_INIT_COMPLETE) - wl1271_debug(DEBUG_IRQ, - "WL1271_ACX_INTR_INIT_COMPLETE"); - - if (intr & WL1271_ACX_INTR_HW_AVAILABLE) - wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_HW_AVAILABLE"); - } - - wl1271_ps_elp_sleep(wl); - -out: - return ret; -} - -static irqreturn_t wlcore_irq(int irq, void *cookie) -{ - int ret; - unsigned long flags; - struct wl1271 *wl = cookie; - - /* complete the ELP completion */ - spin_lock_irqsave(&wl->wl_lock, flags); - set_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags); - if (wl->elp_compl) { - complete(wl->elp_compl); - wl->elp_compl = NULL; - } - - if (test_bit(WL1271_FLAG_SUSPENDED, &wl->flags)) { - /* don't enqueue a work right now. mark it as pending */ - set_bit(WL1271_FLAG_PENDING_WORK, &wl->flags); - wl1271_debug(DEBUG_IRQ, "should not enqueue work"); - disable_irq_nosync(wl->irq); - pm_wakeup_event(wl->dev, 0); - spin_unlock_irqrestore(&wl->wl_lock, flags); - return IRQ_HANDLED; - } - spin_unlock_irqrestore(&wl->wl_lock, flags); - - /* TX might be handled here, avoid redundant work */ - set_bit(WL1271_FLAG_TX_PENDING, &wl->flags); - cancel_work_sync(&wl->tx_work); - - mutex_lock(&wl->mutex); - - ret = wlcore_irq_locked(wl); - if (ret) - wl12xx_queue_recovery_work(wl); - - spin_lock_irqsave(&wl->wl_lock, flags); - /* In case TX was not handled here, queue TX work */ - clear_bit(WL1271_FLAG_TX_PENDING, &wl->flags); - if (!test_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags) && - wl1271_tx_total_queue_count(wl) > 0) - ieee80211_queue_work(wl->hw, &wl->tx_work); - spin_unlock_irqrestore(&wl->wl_lock, flags); - - mutex_unlock(&wl->mutex); - - return IRQ_HANDLED; -} - -struct vif_counter_data { - u8 counter; - - struct ieee80211_vif *cur_vif; - bool cur_vif_running; -}; - -static void wl12xx_vif_count_iter(void *data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct vif_counter_data *counter = data; - - counter->counter++; - if (counter->cur_vif == vif) - counter->cur_vif_running = true; -} - -/* caller must not hold wl->mutex, as it might deadlock */ -static void wl12xx_get_vif_count(struct ieee80211_hw *hw, - struct ieee80211_vif *cur_vif, - struct vif_counter_data *data) -{ - memset(data, 0, sizeof(*data)); - data->cur_vif = cur_vif; - - ieee80211_iterate_active_interfaces(hw, IEEE80211_IFACE_ITER_RESUME_ALL, - wl12xx_vif_count_iter, data); -} - -static int wl12xx_fetch_firmware(struct wl1271 *wl, bool plt) -{ - const struct firmware *fw; - const char *fw_name; - enum wl12xx_fw_type fw_type; - int ret; - - if (plt) { - fw_type = WL12XX_FW_TYPE_PLT; - fw_name = wl->plt_fw_name; - } else { - /* - * we can't call wl12xx_get_vif_count() here because - * wl->mutex is taken, so use the cached last_vif_count value - */ - if (wl->last_vif_count > 1 && wl->mr_fw_name) { - fw_type = WL12XX_FW_TYPE_MULTI; - fw_name = wl->mr_fw_name; - } else { - fw_type = WL12XX_FW_TYPE_NORMAL; - fw_name = wl->sr_fw_name; - } - } - - if (wl->fw_type == fw_type) - return 0; - - wl1271_debug(DEBUG_BOOT, "booting firmware %s", fw_name); - - ret = request_firmware(&fw, fw_name, wl->dev); - - if (ret < 0) { - wl1271_error("could not get firmware %s: %d", fw_name, ret); - return ret; - } - - if (fw->size % 4) { - wl1271_error("firmware size is not multiple of 32 bits: %zu", - fw->size); - ret = -EILSEQ; - goto out; - } - - vfree(wl->fw); - wl->fw_type = WL12XX_FW_TYPE_NONE; - wl->fw_len = fw->size; - wl->fw = vmalloc(wl->fw_len); - - if (!wl->fw) { - wl1271_error("could not allocate memory for the firmware"); - ret = -ENOMEM; - goto out; - } - - memcpy(wl->fw, fw->data, wl->fw_len); - ret = 0; - wl->fw_type = fw_type; -out: - release_firmware(fw); - - return ret; -} - -void wl12xx_queue_recovery_work(struct wl1271 *wl) -{ - WARN_ON(!test_bit(WL1271_FLAG_INTENDED_FW_RECOVERY, &wl->flags)); - - /* Avoid a recursive recovery */ - if (wl->state == WLCORE_STATE_ON) { - wl->state = WLCORE_STATE_RESTARTING; - set_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags); - wlcore_disable_interrupts_nosync(wl); - ieee80211_queue_work(wl->hw, &wl->recovery_work); - } -} - -size_t wl12xx_copy_fwlog(struct wl1271 *wl, u8 *memblock, size_t maxlen) -{ - size_t len = 0; - - /* The FW log is a length-value list, find where the log end */ - while (len < maxlen) { - if (memblock[len] == 0) - break; - if (len + memblock[len] + 1 > maxlen) - break; - len += memblock[len] + 1; - } - - /* Make sure we have enough room */ - len = min(len, (size_t)(PAGE_SIZE - wl->fwlog_size)); - - /* Fill the FW log file, consumed by the sysfs fwlog entry */ - memcpy(wl->fwlog + wl->fwlog_size, memblock, len); - wl->fwlog_size += len; - - return len; -} - -#define WLCORE_FW_LOG_END 0x2000000 - -static void wl12xx_read_fwlog_panic(struct wl1271 *wl) -{ - u32 addr; - u32 offset; - u32 end_of_log; - u8 *block; - int ret; - - if ((wl->quirks & WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED) || - (wl->conf.fwlog.mem_blocks == 0)) - return; - - wl1271_info("Reading FW panic log"); - - block = kmalloc(WL12XX_HW_BLOCK_SIZE, GFP_KERNEL); - if (!block) - return; - - /* - * Make sure the chip is awake and the logger isn't active. - * Do not send a stop fwlog command if the fw is hanged or if - * dbgpins are used (due to some fw bug). - */ - if (wl1271_ps_elp_wakeup(wl)) - goto out; - if (!wl->watchdog_recovery && - wl->conf.fwlog.output != WL12XX_FWLOG_OUTPUT_DBG_PINS) - wl12xx_cmd_stop_fwlog(wl); - - /* Read the first memory block address */ - ret = wlcore_fw_status(wl, wl->fw_status_1, wl->fw_status_2); - if (ret < 0) - goto out; - - addr = le32_to_cpu(wl->fw_status_2->log_start_addr); - if (!addr) - goto out; - - if (wl->conf.fwlog.mode == WL12XX_FWLOG_CONTINUOUS) { - offset = sizeof(addr) + sizeof(struct wl1271_rx_descriptor); - end_of_log = WLCORE_FW_LOG_END; - } else { - offset = sizeof(addr); - end_of_log = addr; - } - - /* Traverse the memory blocks linked list */ - do { - memset(block, 0, WL12XX_HW_BLOCK_SIZE); - ret = wlcore_read_hwaddr(wl, addr, block, WL12XX_HW_BLOCK_SIZE, - false); - if (ret < 0) - goto out; - - /* - * Memory blocks are linked to one another. The first 4 bytes - * of each memory block hold the hardware address of the next - * one. The last memory block points to the first one in - * on demand mode and is equal to 0x2000000 in continuous mode. - */ - addr = le32_to_cpup((__le32 *)block); - if (!wl12xx_copy_fwlog(wl, block + offset, - WL12XX_HW_BLOCK_SIZE - offset)) - break; - } while (addr && (addr != end_of_log)); - - wake_up_interruptible(&wl->fwlog_waitq); - -out: - kfree(block); -} - -static void wlcore_print_recovery(struct wl1271 *wl) -{ - u32 pc = 0; - u32 hint_sts = 0; - int ret; - - wl1271_info("Hardware recovery in progress. FW ver: %s", - wl->chip.fw_ver_str); - - /* change partitions momentarily so we can read the FW pc */ - ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); - if (ret < 0) - return; - - ret = wlcore_read_reg(wl, REG_PC_ON_RECOVERY, &pc); - if (ret < 0) - return; - - ret = wlcore_read_reg(wl, REG_INTERRUPT_NO_CLEAR, &hint_sts); - if (ret < 0) - return; - - wl1271_info("pc: 0x%x, hint_sts: 0x%08x count: %d", - pc, hint_sts, ++wl->recovery_count); - - wlcore_set_partition(wl, &wl->ptable[PART_WORK]); -} - - -static void wl1271_recovery_work(struct work_struct *work) -{ - struct wl1271 *wl = - container_of(work, struct wl1271, recovery_work); - struct wl12xx_vif *wlvif; - struct ieee80211_vif *vif; - - mutex_lock(&wl->mutex); - - if (wl->state == WLCORE_STATE_OFF || wl->plt) - goto out_unlock; - - if (!test_bit(WL1271_FLAG_INTENDED_FW_RECOVERY, &wl->flags)) { - wl12xx_read_fwlog_panic(wl); - wlcore_print_recovery(wl); - } - - BUG_ON(wl->conf.recovery.bug_on_recovery && - !test_bit(WL1271_FLAG_INTENDED_FW_RECOVERY, &wl->flags)); - - if (wl->conf.recovery.no_recovery) { - wl1271_info("No recovery (chosen on module load). Fw will remain stuck."); - goto out_unlock; - } - - /* Prevent spurious TX during FW restart */ - wlcore_stop_queues(wl, WLCORE_QUEUE_STOP_REASON_FW_RESTART); - - /* reboot the chipset */ - while (!list_empty(&wl->wlvif_list)) { - wlvif = list_first_entry(&wl->wlvif_list, - struct wl12xx_vif, list); - vif = wl12xx_wlvif_to_vif(wlvif); - __wl1271_op_remove_interface(wl, vif, false); - } - - wlcore_op_stop_locked(wl); - - ieee80211_restart_hw(wl->hw); - - /* - * Its safe to enable TX now - the queues are stopped after a request - * to restart the HW. - */ - wlcore_wake_queues(wl, WLCORE_QUEUE_STOP_REASON_FW_RESTART); - -out_unlock: - wl->watchdog_recovery = false; - clear_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags); - mutex_unlock(&wl->mutex); -} - -static int wlcore_fw_wakeup(struct wl1271 *wl) -{ - return wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_WAKE_UP); -} - -static int wl1271_setup(struct wl1271 *wl) -{ - wl->fw_status_1 = kmalloc(WLCORE_FW_STATUS_1_LEN(wl->num_rx_desc) + - sizeof(*wl->fw_status_2) + - wl->fw_status_priv_len, GFP_KERNEL); - if (!wl->fw_status_1) - return -ENOMEM; - - wl->fw_status_2 = (struct wl_fw_status_2 *) - (((u8 *) wl->fw_status_1) + - WLCORE_FW_STATUS_1_LEN(wl->num_rx_desc)); - - wl->tx_res_if = kmalloc(sizeof(*wl->tx_res_if), GFP_KERNEL); - if (!wl->tx_res_if) { - kfree(wl->fw_status_1); - return -ENOMEM; - } - - return 0; -} - -static int wl12xx_set_power_on(struct wl1271 *wl) -{ - int ret; - - msleep(WL1271_PRE_POWER_ON_SLEEP); - ret = wl1271_power_on(wl); - if (ret < 0) - goto out; - msleep(WL1271_POWER_ON_SLEEP); - wl1271_io_reset(wl); - wl1271_io_init(wl); - - ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); - if (ret < 0) - goto fail; - - /* ELP module wake up */ - ret = wlcore_fw_wakeup(wl); - if (ret < 0) - goto fail; - -out: - return ret; - -fail: - wl1271_power_off(wl); - return ret; -} - -static int wl12xx_chip_wakeup(struct wl1271 *wl, bool plt) -{ - int ret = 0; - - ret = wl12xx_set_power_on(wl); - if (ret < 0) - goto out; - - /* - * For wl127x based devices we could use the default block - * size (512 bytes), but due to a bug in the sdio driver, we - * need to set it explicitly after the chip is powered on. To - * simplify the code and since the performance impact is - * negligible, we use the same block size for all different - * chip types. - * - * Check if the bus supports blocksize alignment and, if it - * doesn't, make sure we don't have the quirk. - */ - if (!wl1271_set_block_size(wl)) - wl->quirks &= ~WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN; - - /* TODO: make sure the lower driver has set things up correctly */ - - ret = wl1271_setup(wl); - if (ret < 0) - goto out; - - ret = wl12xx_fetch_firmware(wl, plt); - if (ret < 0) - goto out; - -out: - return ret; -} - -int wl1271_plt_start(struct wl1271 *wl, const enum plt_mode plt_mode) -{ - int retries = WL1271_BOOT_RETRIES; - struct wiphy *wiphy = wl->hw->wiphy; - - static const char* const PLT_MODE[] = { - "PLT_OFF", - "PLT_ON", - "PLT_FEM_DETECT" - }; - - int ret; - - mutex_lock(&wl->mutex); - - wl1271_notice("power up"); - - if (wl->state != WLCORE_STATE_OFF) { - wl1271_error("cannot go into PLT state because not " - "in off state: %d", wl->state); - ret = -EBUSY; - goto out; - } - - /* Indicate to lower levels that we are now in PLT mode */ - wl->plt = true; - wl->plt_mode = plt_mode; - - while (retries) { - retries--; - ret = wl12xx_chip_wakeup(wl, true); - if (ret < 0) - goto power_off; - - ret = wl->ops->plt_init(wl); - if (ret < 0) - goto power_off; - - wl->state = WLCORE_STATE_ON; - wl1271_notice("firmware booted in PLT mode %s (%s)", - PLT_MODE[plt_mode], - wl->chip.fw_ver_str); - - /* update hw/fw version info in wiphy struct */ - wiphy->hw_version = wl->chip.id; - strncpy(wiphy->fw_version, wl->chip.fw_ver_str, - sizeof(wiphy->fw_version)); - - goto out; - -power_off: - wl1271_power_off(wl); - } - - wl->plt = false; - wl->plt_mode = PLT_OFF; - - wl1271_error("firmware boot in PLT mode failed despite %d retries", - WL1271_BOOT_RETRIES); -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -int wl1271_plt_stop(struct wl1271 *wl) -{ - int ret = 0; - - wl1271_notice("power down"); - - /* - * Interrupts must be disabled before setting the state to OFF. - * Otherwise, the interrupt handler might be called and exit without - * reading the interrupt status. - */ - wlcore_disable_interrupts(wl); - mutex_lock(&wl->mutex); - if (!wl->plt) { - mutex_unlock(&wl->mutex); - - /* - * This will not necessarily enable interrupts as interrupts - * may have been disabled when op_stop was called. It will, - * however, balance the above call to disable_interrupts(). - */ - wlcore_enable_interrupts(wl); - - wl1271_error("cannot power down because not in PLT " - "state: %d", wl->state); - ret = -EBUSY; - goto out; - } - - mutex_unlock(&wl->mutex); - - wl1271_flush_deferred_work(wl); - cancel_work_sync(&wl->netstack_work); - cancel_work_sync(&wl->recovery_work); - cancel_delayed_work_sync(&wl->elp_work); - cancel_delayed_work_sync(&wl->tx_watchdog_work); - - mutex_lock(&wl->mutex); - wl1271_power_off(wl); - wl->flags = 0; - wl->sleep_auth = WL1271_PSM_ILLEGAL; - wl->state = WLCORE_STATE_OFF; - wl->plt = false; - wl->plt_mode = PLT_OFF; - wl->rx_counter = 0; - mutex_unlock(&wl->mutex); - -out: - return ret; -} - -static void wl1271_op_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct wl1271 *wl = hw->priv; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_vif *vif = info->control.vif; - struct wl12xx_vif *wlvif = NULL; - unsigned long flags; - int q, mapping; - u8 hlid; - - if (!vif) { - wl1271_debug(DEBUG_TX, "DROP skb with no vif"); - ieee80211_free_txskb(hw, skb); - return; - } - - wlvif = wl12xx_vif_to_data(vif); - mapping = skb_get_queue_mapping(skb); - q = wl1271_tx_get_queue(mapping); - - hlid = wl12xx_tx_get_hlid(wl, wlvif, skb, control->sta); - - spin_lock_irqsave(&wl->wl_lock, flags); - - /* - * drop the packet if the link is invalid or the queue is stopped - * for any reason but watermark. Watermark is a "soft"-stop so we - * allow these packets through. - */ - if (hlid == WL12XX_INVALID_LINK_ID || - (!test_bit(hlid, wlvif->links_map)) || - (wlcore_is_queue_stopped_locked(wl, wlvif, q) && - !wlcore_is_queue_stopped_by_reason_locked(wl, wlvif, q, - WLCORE_QUEUE_STOP_REASON_WATERMARK))) { - wl1271_debug(DEBUG_TX, "DROP skb hlid %d q %d", hlid, q); - ieee80211_free_txskb(hw, skb); - goto out; - } - - wl1271_debug(DEBUG_TX, "queue skb hlid %d q %d len %d", - hlid, q, skb->len); - skb_queue_tail(&wl->links[hlid].tx_queue[q], skb); - - wl->tx_queue_count[q]++; - wlvif->tx_queue_count[q]++; - - /* - * The workqueue is slow to process the tx_queue and we need stop - * the queue here, otherwise the queue will get too long. - */ - if (wlvif->tx_queue_count[q] >= WL1271_TX_QUEUE_HIGH_WATERMARK && - !wlcore_is_queue_stopped_by_reason_locked(wl, wlvif, q, - WLCORE_QUEUE_STOP_REASON_WATERMARK)) { - wl1271_debug(DEBUG_TX, "op_tx: stopping queues for q %d", q); - wlcore_stop_queue_locked(wl, wlvif, q, - WLCORE_QUEUE_STOP_REASON_WATERMARK); - } - - /* - * The chip specific setup must run before the first TX packet - - * before that, the tx_work will not be initialized! - */ - - if (!test_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags) && - !test_bit(WL1271_FLAG_TX_PENDING, &wl->flags)) - ieee80211_queue_work(wl->hw, &wl->tx_work); - -out: - spin_unlock_irqrestore(&wl->wl_lock, flags); -} - -int wl1271_tx_dummy_packet(struct wl1271 *wl) -{ - unsigned long flags; - int q; - - /* no need to queue a new dummy packet if one is already pending */ - if (test_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags)) - return 0; - - q = wl1271_tx_get_queue(skb_get_queue_mapping(wl->dummy_packet)); - - spin_lock_irqsave(&wl->wl_lock, flags); - set_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags); - wl->tx_queue_count[q]++; - spin_unlock_irqrestore(&wl->wl_lock, flags); - - /* The FW is low on RX memory blocks, so send the dummy packet asap */ - if (!test_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags)) - return wlcore_tx_work_locked(wl); - - /* - * If the FW TX is busy, TX work will be scheduled by the threaded - * interrupt handler function - */ - return 0; -} - -/* - * The size of the dummy packet should be at least 1400 bytes. However, in - * order to minimize the number of bus transactions, aligning it to 512 bytes - * boundaries could be beneficial, performance wise - */ -#define TOTAL_TX_DUMMY_PACKET_SIZE (ALIGN(1400, 512)) - -static struct sk_buff *wl12xx_alloc_dummy_packet(struct wl1271 *wl) -{ - struct sk_buff *skb; - struct ieee80211_hdr_3addr *hdr; - unsigned int dummy_packet_size; - - dummy_packet_size = TOTAL_TX_DUMMY_PACKET_SIZE - - sizeof(struct wl1271_tx_hw_descr) - sizeof(*hdr); - - skb = dev_alloc_skb(TOTAL_TX_DUMMY_PACKET_SIZE); - if (!skb) { - wl1271_warning("Failed to allocate a dummy packet skb"); - return NULL; - } - - skb_reserve(skb, sizeof(struct wl1271_tx_hw_descr)); - - hdr = (struct ieee80211_hdr_3addr *) skb_put(skb, sizeof(*hdr)); - memset(hdr, 0, sizeof(*hdr)); - hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA | - IEEE80211_STYPE_NULLFUNC | - IEEE80211_FCTL_TODS); - - memset(skb_put(skb, dummy_packet_size), 0, dummy_packet_size); - - /* Dummy packets require the TID to be management */ - skb->priority = WL1271_TID_MGMT; - - /* Initialize all fields that might be used */ - skb_set_queue_mapping(skb, 0); - memset(IEEE80211_SKB_CB(skb), 0, sizeof(struct ieee80211_tx_info)); - - return skb; -} - - -#ifdef CONFIG_PM -static int -wl1271_validate_wowlan_pattern(struct cfg80211_wowlan_trig_pkt_pattern *p) -{ - int num_fields = 0, in_field = 0, fields_size = 0; - int i, pattern_len = 0; - - if (!p->mask) { - wl1271_warning("No mask in WoWLAN pattern"); - return -EINVAL; - } - - /* - * The pattern is broken up into segments of bytes at different offsets - * that need to be checked by the FW filter. Each segment is called - * a field in the FW API. We verify that the total number of fields - * required for this pattern won't exceed FW limits (8) - * as well as the total fields buffer won't exceed the FW limit. - * Note that if there's a pattern which crosses Ethernet/IP header - * boundary a new field is required. - */ - for (i = 0; i < p->pattern_len; i++) { - if (test_bit(i, (unsigned long *)p->mask)) { - if (!in_field) { - in_field = 1; - pattern_len = 1; - } else { - if (i == WL1271_RX_FILTER_ETH_HEADER_SIZE) { - num_fields++; - fields_size += pattern_len + - RX_FILTER_FIELD_OVERHEAD; - pattern_len = 1; - } else - pattern_len++; - } - } else { - if (in_field) { - in_field = 0; - fields_size += pattern_len + - RX_FILTER_FIELD_OVERHEAD; - num_fields++; - } - } - } - - if (in_field) { - fields_size += pattern_len + RX_FILTER_FIELD_OVERHEAD; - num_fields++; - } - - if (num_fields > WL1271_RX_FILTER_MAX_FIELDS) { - wl1271_warning("RX Filter too complex. Too many segments"); - return -EINVAL; - } - - if (fields_size > WL1271_RX_FILTER_MAX_FIELDS_SIZE) { - wl1271_warning("RX filter pattern is too big"); - return -E2BIG; - } - - return 0; -} - -struct wl12xx_rx_filter *wl1271_rx_filter_alloc(void) -{ - return kzalloc(sizeof(struct wl12xx_rx_filter), GFP_KERNEL); -} - -void wl1271_rx_filter_free(struct wl12xx_rx_filter *filter) -{ - int i; - - if (filter == NULL) - return; - - for (i = 0; i < filter->num_fields; i++) - kfree(filter->fields[i].pattern); - - kfree(filter); -} - -int wl1271_rx_filter_alloc_field(struct wl12xx_rx_filter *filter, - u16 offset, u8 flags, - u8 *pattern, u8 len) -{ - struct wl12xx_rx_filter_field *field; - - if (filter->num_fields == WL1271_RX_FILTER_MAX_FIELDS) { - wl1271_warning("Max fields per RX filter. can't alloc another"); - return -EINVAL; - } - - field = &filter->fields[filter->num_fields]; - - field->pattern = kzalloc(len, GFP_KERNEL); - if (!field->pattern) { - wl1271_warning("Failed to allocate RX filter pattern"); - return -ENOMEM; - } - - filter->num_fields++; - - field->offset = cpu_to_le16(offset); - field->flags = flags; - field->len = len; - memcpy(field->pattern, pattern, len); - - return 0; -} - -int wl1271_rx_filter_get_fields_size(struct wl12xx_rx_filter *filter) -{ - int i, fields_size = 0; - - for (i = 0; i < filter->num_fields; i++) - fields_size += filter->fields[i].len + - sizeof(struct wl12xx_rx_filter_field) - - sizeof(u8 *); - - return fields_size; -} - -void wl1271_rx_filter_flatten_fields(struct wl12xx_rx_filter *filter, - u8 *buf) -{ - int i; - struct wl12xx_rx_filter_field *field; - - for (i = 0; i < filter->num_fields; i++) { - field = (struct wl12xx_rx_filter_field *)buf; - - field->offset = filter->fields[i].offset; - field->flags = filter->fields[i].flags; - field->len = filter->fields[i].len; - - memcpy(&field->pattern, filter->fields[i].pattern, field->len); - buf += sizeof(struct wl12xx_rx_filter_field) - - sizeof(u8 *) + field->len; - } -} - -/* - * Allocates an RX filter returned through f - * which needs to be freed using rx_filter_free() - */ -static int wl1271_convert_wowlan_pattern_to_rx_filter( - struct cfg80211_wowlan_trig_pkt_pattern *p, - struct wl12xx_rx_filter **f) -{ - int i, j, ret = 0; - struct wl12xx_rx_filter *filter; - u16 offset; - u8 flags, len; - - filter = wl1271_rx_filter_alloc(); - if (!filter) { - wl1271_warning("Failed to alloc rx filter"); - ret = -ENOMEM; - goto err; - } - - i = 0; - while (i < p->pattern_len) { - if (!test_bit(i, (unsigned long *)p->mask)) { - i++; - continue; - } - - for (j = i; j < p->pattern_len; j++) { - if (!test_bit(j, (unsigned long *)p->mask)) - break; - - if (i < WL1271_RX_FILTER_ETH_HEADER_SIZE && - j >= WL1271_RX_FILTER_ETH_HEADER_SIZE) - break; - } - - if (i < WL1271_RX_FILTER_ETH_HEADER_SIZE) { - offset = i; - flags = WL1271_RX_FILTER_FLAG_ETHERNET_HEADER; - } else { - offset = i - WL1271_RX_FILTER_ETH_HEADER_SIZE; - flags = WL1271_RX_FILTER_FLAG_IP_HEADER; - } - - len = j - i; - - ret = wl1271_rx_filter_alloc_field(filter, - offset, - flags, - &p->pattern[i], len); - if (ret) - goto err; - - i = j; - } - - filter->action = FILTER_SIGNAL; - - *f = filter; - return 0; - -err: - wl1271_rx_filter_free(filter); - *f = NULL; - - return ret; -} - -static int wl1271_configure_wowlan(struct wl1271 *wl, - struct cfg80211_wowlan *wow) -{ - int i, ret; - - if (!wow || wow->any || !wow->n_patterns) { - ret = wl1271_acx_default_rx_filter_enable(wl, 0, - FILTER_SIGNAL); - if (ret) - goto out; - - ret = wl1271_rx_filter_clear_all(wl); - if (ret) - goto out; - - return 0; - } - - if (WARN_ON(wow->n_patterns > WL1271_MAX_RX_FILTERS)) - return -EINVAL; - - /* Validate all incoming patterns before clearing current FW state */ - for (i = 0; i < wow->n_patterns; i++) { - ret = wl1271_validate_wowlan_pattern(&wow->patterns[i]); - if (ret) { - wl1271_warning("Bad wowlan pattern %d", i); - return ret; - } - } - - ret = wl1271_acx_default_rx_filter_enable(wl, 0, FILTER_SIGNAL); - if (ret) - goto out; - - ret = wl1271_rx_filter_clear_all(wl); - if (ret) - goto out; - - /* Translate WoWLAN patterns into filters */ - for (i = 0; i < wow->n_patterns; i++) { - struct cfg80211_wowlan_trig_pkt_pattern *p; - struct wl12xx_rx_filter *filter = NULL; - - p = &wow->patterns[i]; - - ret = wl1271_convert_wowlan_pattern_to_rx_filter(p, &filter); - if (ret) { - wl1271_warning("Failed to create an RX filter from " - "wowlan pattern %d", i); - goto out; - } - - ret = wl1271_rx_filter_enable(wl, i, 1, filter); - - wl1271_rx_filter_free(filter); - if (ret) - goto out; - } - - ret = wl1271_acx_default_rx_filter_enable(wl, 1, FILTER_DROP); - -out: - return ret; -} - -static int wl1271_configure_suspend_sta(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct cfg80211_wowlan *wow) -{ - int ret = 0; - - if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = wl1271_configure_wowlan(wl, wow); - if (ret < 0) - goto out_sleep; - - if ((wl->conf.conn.suspend_wake_up_event == - wl->conf.conn.wake_up_event) && - (wl->conf.conn.suspend_listen_interval == - wl->conf.conn.listen_interval)) - goto out_sleep; - - ret = wl1271_acx_wake_up_conditions(wl, wlvif, - wl->conf.conn.suspend_wake_up_event, - wl->conf.conn.suspend_listen_interval); - - if (ret < 0) - wl1271_error("suspend: set wake up conditions failed: %d", ret); - -out_sleep: - wl1271_ps_elp_sleep(wl); -out: - return ret; - -} - -static int wl1271_configure_suspend_ap(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - int ret = 0; - - if (!test_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = wl1271_acx_beacon_filter_opt(wl, wlvif, true); - - wl1271_ps_elp_sleep(wl); -out: - return ret; - -} - -static int wl1271_configure_suspend(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct cfg80211_wowlan *wow) -{ - if (wlvif->bss_type == BSS_TYPE_STA_BSS) - return wl1271_configure_suspend_sta(wl, wlvif, wow); - if (wlvif->bss_type == BSS_TYPE_AP_BSS) - return wl1271_configure_suspend_ap(wl, wlvif); - return 0; -} - -static void wl1271_configure_resume(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - int ret = 0; - bool is_ap = wlvif->bss_type == BSS_TYPE_AP_BSS; - bool is_sta = wlvif->bss_type == BSS_TYPE_STA_BSS; - - if ((!is_ap) && (!is_sta)) - return; - - if (is_sta && !test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) - return; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - return; - - if (is_sta) { - wl1271_configure_wowlan(wl, NULL); - - if ((wl->conf.conn.suspend_wake_up_event == - wl->conf.conn.wake_up_event) && - (wl->conf.conn.suspend_listen_interval == - wl->conf.conn.listen_interval)) - goto out_sleep; - - ret = wl1271_acx_wake_up_conditions(wl, wlvif, - wl->conf.conn.wake_up_event, - wl->conf.conn.listen_interval); - - if (ret < 0) - wl1271_error("resume: wake up conditions failed: %d", - ret); - - } else if (is_ap) { - ret = wl1271_acx_beacon_filter_opt(wl, wlvif, false); - } - -out_sleep: - wl1271_ps_elp_sleep(wl); -} - -static int wl1271_op_suspend(struct ieee80211_hw *hw, - struct cfg80211_wowlan *wow) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif; - int ret; - - wl1271_debug(DEBUG_MAC80211, "mac80211 suspend wow=%d", !!wow); - WARN_ON(!wow); - - /* we want to perform the recovery before suspending */ - if (test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) { - wl1271_warning("postponing suspend to perform recovery"); - return -EBUSY; - } - - wl1271_tx_flush(wl); - - mutex_lock(&wl->mutex); - wl->wow_enabled = true; - wl12xx_for_each_wlvif(wl, wlvif) { - ret = wl1271_configure_suspend(wl, wlvif, wow); - if (ret < 0) { - mutex_unlock(&wl->mutex); - wl1271_warning("couldn't prepare device to suspend"); - return ret; - } - } - mutex_unlock(&wl->mutex); - /* flush any remaining work */ - wl1271_debug(DEBUG_MAC80211, "flushing remaining works"); - - /* - * disable and re-enable interrupts in order to flush - * the threaded_irq - */ - wlcore_disable_interrupts(wl); - - /* - * set suspended flag to avoid triggering a new threaded_irq - * work. no need for spinlock as interrupts are disabled. - */ - set_bit(WL1271_FLAG_SUSPENDED, &wl->flags); - - wlcore_enable_interrupts(wl); - flush_work(&wl->tx_work); - flush_delayed_work(&wl->elp_work); - - return 0; -} - -static int wl1271_op_resume(struct ieee80211_hw *hw) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif; - unsigned long flags; - bool run_irq_work = false, pending_recovery; - int ret; - - wl1271_debug(DEBUG_MAC80211, "mac80211 resume wow=%d", - wl->wow_enabled); - WARN_ON(!wl->wow_enabled); - - /* - * re-enable irq_work enqueuing, and call irq_work directly if - * there is a pending work. - */ - spin_lock_irqsave(&wl->wl_lock, flags); - clear_bit(WL1271_FLAG_SUSPENDED, &wl->flags); - if (test_and_clear_bit(WL1271_FLAG_PENDING_WORK, &wl->flags)) - run_irq_work = true; - spin_unlock_irqrestore(&wl->wl_lock, flags); - - mutex_lock(&wl->mutex); - - /* test the recovery flag before calling any SDIO functions */ - pending_recovery = test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, - &wl->flags); - - if (run_irq_work) { - wl1271_debug(DEBUG_MAC80211, - "run postponed irq_work directly"); - - /* don't talk to the HW if recovery is pending */ - if (!pending_recovery) { - ret = wlcore_irq_locked(wl); - if (ret) - wl12xx_queue_recovery_work(wl); - } - - wlcore_enable_interrupts(wl); - } - - if (pending_recovery) { - wl1271_warning("queuing forgotten recovery on resume"); - ieee80211_queue_work(wl->hw, &wl->recovery_work); - goto out; - } - - wl12xx_for_each_wlvif(wl, wlvif) { - wl1271_configure_resume(wl, wlvif); - } - -out: - wl->wow_enabled = false; - mutex_unlock(&wl->mutex); - - return 0; -} -#endif - -static int wl1271_op_start(struct ieee80211_hw *hw) -{ - wl1271_debug(DEBUG_MAC80211, "mac80211 start"); - - /* - * We have to delay the booting of the hardware because - * we need to know the local MAC address before downloading and - * initializing the firmware. The MAC address cannot be changed - * after boot, and without the proper MAC address, the firmware - * will not function properly. - * - * The MAC address is first known when the corresponding interface - * is added. That is where we will initialize the hardware. - */ - - return 0; -} - -static void wlcore_op_stop_locked(struct wl1271 *wl) -{ - int i; - - if (wl->state == WLCORE_STATE_OFF) { - if (test_and_clear_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, - &wl->flags)) - wlcore_enable_interrupts(wl); - - return; - } - - /* - * this must be before the cancel_work calls below, so that the work - * functions don't perform further work. - */ - wl->state = WLCORE_STATE_OFF; - - /* - * Use the nosync variant to disable interrupts, so the mutex could be - * held while doing so without deadlocking. - */ - wlcore_disable_interrupts_nosync(wl); - - mutex_unlock(&wl->mutex); - - wlcore_synchronize_interrupts(wl); - if (!test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) - cancel_work_sync(&wl->recovery_work); - wl1271_flush_deferred_work(wl); - cancel_delayed_work_sync(&wl->scan_complete_work); - cancel_work_sync(&wl->netstack_work); - cancel_work_sync(&wl->tx_work); - cancel_delayed_work_sync(&wl->elp_work); - cancel_delayed_work_sync(&wl->tx_watchdog_work); - - /* let's notify MAC80211 about the remaining pending TX frames */ - mutex_lock(&wl->mutex); - wl12xx_tx_reset(wl); - - wl1271_power_off(wl); - /* - * In case a recovery was scheduled, interrupts were disabled to avoid - * an interrupt storm. Now that the power is down, it is safe to - * re-enable interrupts to balance the disable depth - */ - if (test_and_clear_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) - wlcore_enable_interrupts(wl); - - wl->band = IEEE80211_BAND_2GHZ; - - wl->rx_counter = 0; - wl->power_level = WL1271_DEFAULT_POWER_LEVEL; - wl->channel_type = NL80211_CHAN_NO_HT; - wl->tx_blocks_available = 0; - wl->tx_allocated_blocks = 0; - wl->tx_results_count = 0; - wl->tx_packets_count = 0; - wl->time_offset = 0; - wl->ap_fw_ps_map = 0; - wl->ap_ps_map = 0; - wl->sleep_auth = WL1271_PSM_ILLEGAL; - memset(wl->roles_map, 0, sizeof(wl->roles_map)); - memset(wl->links_map, 0, sizeof(wl->links_map)); - memset(wl->roc_map, 0, sizeof(wl->roc_map)); - memset(wl->session_ids, 0, sizeof(wl->session_ids)); - wl->active_sta_count = 0; - wl->active_link_count = 0; - - /* The system link is always allocated */ - wl->links[WL12XX_SYSTEM_HLID].allocated_pkts = 0; - wl->links[WL12XX_SYSTEM_HLID].prev_freed_pkts = 0; - __set_bit(WL12XX_SYSTEM_HLID, wl->links_map); - - /* - * this is performed after the cancel_work calls and the associated - * mutex_lock, so that wl1271_op_add_interface does not accidentally - * get executed before all these vars have been reset. - */ - wl->flags = 0; - - wl->tx_blocks_freed = 0; - - for (i = 0; i < NUM_TX_QUEUES; i++) { - wl->tx_pkts_freed[i] = 0; - wl->tx_allocated_pkts[i] = 0; - } - - wl1271_debugfs_reset(wl); - - kfree(wl->fw_status_1); - wl->fw_status_1 = NULL; - wl->fw_status_2 = NULL; - kfree(wl->tx_res_if); - wl->tx_res_if = NULL; - kfree(wl->target_mem_map); - wl->target_mem_map = NULL; - - /* - * FW channels must be re-calibrated after recovery, - * clear the last Reg-Domain channel configuration. - */ - memset(wl->reg_ch_conf_last, 0, sizeof(wl->reg_ch_conf_last)); -} - -static void wlcore_op_stop(struct ieee80211_hw *hw) -{ - struct wl1271 *wl = hw->priv; - - wl1271_debug(DEBUG_MAC80211, "mac80211 stop"); - - mutex_lock(&wl->mutex); - - wlcore_op_stop_locked(wl); - - mutex_unlock(&wl->mutex); -} - -static void wlcore_channel_switch_work(struct work_struct *work) -{ - struct delayed_work *dwork; - struct wl1271 *wl; - struct ieee80211_vif *vif; - struct wl12xx_vif *wlvif; - int ret; - - dwork = container_of(work, struct delayed_work, work); - wlvif = container_of(dwork, struct wl12xx_vif, channel_switch_work); - wl = wlvif->wl; - - wl1271_info("channel switch failed (role_id: %d).", wlvif->role_id); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - /* check the channel switch is still ongoing */ - if (!test_and_clear_bit(WLVIF_FLAG_CS_PROGRESS, &wlvif->flags)) - goto out; - - vif = wl12xx_wlvif_to_vif(wlvif); - ieee80211_chswitch_done(vif, false); - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - wl12xx_cmd_stop_channel_switch(wl, wlvif); - - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); -} - -static void wlcore_connection_loss_work(struct work_struct *work) -{ - struct delayed_work *dwork; - struct wl1271 *wl; - struct ieee80211_vif *vif; - struct wl12xx_vif *wlvif; - - dwork = container_of(work, struct delayed_work, work); - wlvif = container_of(dwork, struct wl12xx_vif, connection_loss_work); - wl = wlvif->wl; - - wl1271_info("Connection loss work (role_id: %d).", wlvif->role_id); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - /* Call mac80211 connection loss */ - if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) - goto out; - - vif = wl12xx_wlvif_to_vif(wlvif); - ieee80211_connection_loss(vif); -out: - mutex_unlock(&wl->mutex); -} - -static int wl12xx_allocate_rate_policy(struct wl1271 *wl, u8 *idx) -{ - u8 policy = find_first_zero_bit(wl->rate_policies_map, - WL12XX_MAX_RATE_POLICIES); - if (policy >= WL12XX_MAX_RATE_POLICIES) - return -EBUSY; - - __set_bit(policy, wl->rate_policies_map); - *idx = policy; - return 0; -} - -static void wl12xx_free_rate_policy(struct wl1271 *wl, u8 *idx) -{ - if (WARN_ON(*idx >= WL12XX_MAX_RATE_POLICIES)) - return; - - __clear_bit(*idx, wl->rate_policies_map); - *idx = WL12XX_MAX_RATE_POLICIES; -} - -static int wlcore_allocate_klv_template(struct wl1271 *wl, u8 *idx) -{ - u8 policy = find_first_zero_bit(wl->klv_templates_map, - WLCORE_MAX_KLV_TEMPLATES); - if (policy >= WLCORE_MAX_KLV_TEMPLATES) - return -EBUSY; - - __set_bit(policy, wl->klv_templates_map); - *idx = policy; - return 0; -} - -static void wlcore_free_klv_template(struct wl1271 *wl, u8 *idx) -{ - if (WARN_ON(*idx >= WLCORE_MAX_KLV_TEMPLATES)) - return; - - __clear_bit(*idx, wl->klv_templates_map); - *idx = WLCORE_MAX_KLV_TEMPLATES; -} - -static u8 wl12xx_get_role_type(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - switch (wlvif->bss_type) { - case BSS_TYPE_AP_BSS: - if (wlvif->p2p) - return WL1271_ROLE_P2P_GO; - else - return WL1271_ROLE_AP; - - case BSS_TYPE_STA_BSS: - if (wlvif->p2p) - return WL1271_ROLE_P2P_CL; - else - return WL1271_ROLE_STA; - - case BSS_TYPE_IBSS: - return WL1271_ROLE_IBSS; - - default: - wl1271_error("invalid bss_type: %d", wlvif->bss_type); - } - return WL12XX_INVALID_ROLE_TYPE; -} - -static int wl12xx_init_vif_data(struct wl1271 *wl, struct ieee80211_vif *vif) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - int i; - - /* clear everything but the persistent data */ - memset(wlvif, 0, offsetof(struct wl12xx_vif, persistent)); - - switch (ieee80211_vif_type_p2p(vif)) { - case NL80211_IFTYPE_P2P_CLIENT: - wlvif->p2p = 1; - /* fall-through */ - case NL80211_IFTYPE_STATION: - wlvif->bss_type = BSS_TYPE_STA_BSS; - break; - case NL80211_IFTYPE_ADHOC: - wlvif->bss_type = BSS_TYPE_IBSS; - break; - case NL80211_IFTYPE_P2P_GO: - wlvif->p2p = 1; - /* fall-through */ - case NL80211_IFTYPE_AP: - wlvif->bss_type = BSS_TYPE_AP_BSS; - break; - default: - wlvif->bss_type = MAX_BSS_TYPE; - return -EOPNOTSUPP; - } - - wlvif->role_id = WL12XX_INVALID_ROLE_ID; - wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID; - wlvif->dev_hlid = WL12XX_INVALID_LINK_ID; - - if (wlvif->bss_type == BSS_TYPE_STA_BSS || - wlvif->bss_type == BSS_TYPE_IBSS) { - /* init sta/ibss data */ - wlvif->sta.hlid = WL12XX_INVALID_LINK_ID; - wl12xx_allocate_rate_policy(wl, &wlvif->sta.basic_rate_idx); - wl12xx_allocate_rate_policy(wl, &wlvif->sta.ap_rate_idx); - wl12xx_allocate_rate_policy(wl, &wlvif->sta.p2p_rate_idx); - wlcore_allocate_klv_template(wl, &wlvif->sta.klv_template_id); - wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC; - wlvif->basic_rate = CONF_TX_RATE_MASK_BASIC; - wlvif->rate_set = CONF_TX_RATE_MASK_BASIC; - } else { - /* init ap data */ - wlvif->ap.bcast_hlid = WL12XX_INVALID_LINK_ID; - wlvif->ap.global_hlid = WL12XX_INVALID_LINK_ID; - wl12xx_allocate_rate_policy(wl, &wlvif->ap.mgmt_rate_idx); - wl12xx_allocate_rate_policy(wl, &wlvif->ap.bcast_rate_idx); - for (i = 0; i < CONF_TX_MAX_AC_COUNT; i++) - wl12xx_allocate_rate_policy(wl, - &wlvif->ap.ucast_rate_idx[i]); - wlvif->basic_rate_set = CONF_TX_ENABLED_RATES; - /* - * TODO: check if basic_rate shouldn't be - * wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); - * instead (the same thing for STA above). - */ - wlvif->basic_rate = CONF_TX_ENABLED_RATES; - /* TODO: this seems to be used only for STA, check it */ - wlvif->rate_set = CONF_TX_ENABLED_RATES; - } - - wlvif->bitrate_masks[IEEE80211_BAND_2GHZ] = wl->conf.tx.basic_rate; - wlvif->bitrate_masks[IEEE80211_BAND_5GHZ] = wl->conf.tx.basic_rate_5; - wlvif->beacon_int = WL1271_DEFAULT_BEACON_INT; - - /* - * mac80211 configures some values globally, while we treat them - * per-interface. thus, on init, we have to copy them from wl - */ - wlvif->band = wl->band; - wlvif->channel = wl->channel; - wlvif->power_level = wl->power_level; - wlvif->channel_type = wl->channel_type; - - INIT_WORK(&wlvif->rx_streaming_enable_work, - wl1271_rx_streaming_enable_work); - INIT_WORK(&wlvif->rx_streaming_disable_work, - wl1271_rx_streaming_disable_work); - INIT_DELAYED_WORK(&wlvif->channel_switch_work, - wlcore_channel_switch_work); - INIT_DELAYED_WORK(&wlvif->connection_loss_work, - wlcore_connection_loss_work); - INIT_LIST_HEAD(&wlvif->list); - - setup_timer(&wlvif->rx_streaming_timer, wl1271_rx_streaming_timer, - (unsigned long) wlvif); - return 0; -} - -static int wl12xx_init_fw(struct wl1271 *wl) -{ - int retries = WL1271_BOOT_RETRIES; - bool booted = false; - struct wiphy *wiphy = wl->hw->wiphy; - int ret; - - while (retries) { - retries--; - ret = wl12xx_chip_wakeup(wl, false); - if (ret < 0) - goto power_off; - - ret = wl->ops->boot(wl); - if (ret < 0) - goto power_off; - - ret = wl1271_hw_init(wl); - if (ret < 0) - goto irq_disable; - - booted = true; - break; - -irq_disable: - mutex_unlock(&wl->mutex); - /* Unlocking the mutex in the middle of handling is - inherently unsafe. In this case we deem it safe to do, - because we need to let any possibly pending IRQ out of - the system (and while we are WLCORE_STATE_OFF the IRQ - work function will not do anything.) Also, any other - possible concurrent operations will fail due to the - current state, hence the wl1271 struct should be safe. */ - wlcore_disable_interrupts(wl); - wl1271_flush_deferred_work(wl); - cancel_work_sync(&wl->netstack_work); - mutex_lock(&wl->mutex); -power_off: - wl1271_power_off(wl); - } - - if (!booted) { - wl1271_error("firmware boot failed despite %d retries", - WL1271_BOOT_RETRIES); - goto out; - } - - wl1271_info("firmware booted (%s)", wl->chip.fw_ver_str); - - /* update hw/fw version info in wiphy struct */ - wiphy->hw_version = wl->chip.id; - strncpy(wiphy->fw_version, wl->chip.fw_ver_str, - sizeof(wiphy->fw_version)); - - /* - * Now we know if 11a is supported (info from the NVS), so disable - * 11a channels if not supported - */ - if (!wl->enable_11a) - wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels = 0; - - wl1271_debug(DEBUG_MAC80211, "11a is %ssupported", - wl->enable_11a ? "" : "not "); - - wl->state = WLCORE_STATE_ON; -out: - return ret; -} - -static bool wl12xx_dev_role_started(struct wl12xx_vif *wlvif) -{ - return wlvif->dev_hlid != WL12XX_INVALID_LINK_ID; -} - -/* - * Check whether a fw switch (i.e. moving from one loaded - * fw to another) is needed. This function is also responsible - * for updating wl->last_vif_count, so it must be called before - * loading a non-plt fw (so the correct fw (single-role/multi-role) - * will be used). - */ -static bool wl12xx_need_fw_change(struct wl1271 *wl, - struct vif_counter_data vif_counter_data, - bool add) -{ - enum wl12xx_fw_type current_fw = wl->fw_type; - u8 vif_count = vif_counter_data.counter; - - if (test_bit(WL1271_FLAG_VIF_CHANGE_IN_PROGRESS, &wl->flags)) - return false; - - /* increase the vif count if this is a new vif */ - if (add && !vif_counter_data.cur_vif_running) - vif_count++; - - wl->last_vif_count = vif_count; - - /* no need for fw change if the device is OFF */ - if (wl->state == WLCORE_STATE_OFF) - return false; - - /* no need for fw change if a single fw is used */ - if (!wl->mr_fw_name) - return false; - - if (vif_count > 1 && current_fw == WL12XX_FW_TYPE_NORMAL) - return true; - if (vif_count <= 1 && current_fw == WL12XX_FW_TYPE_MULTI) - return true; - - return false; -} - -/* - * Enter "forced psm". Make sure the sta is in psm against the ap, - * to make the fw switch a bit more disconnection-persistent. - */ -static void wl12xx_force_active_psm(struct wl1271 *wl) -{ - struct wl12xx_vif *wlvif; - - wl12xx_for_each_wlvif_sta(wl, wlvif) { - wl1271_ps_set_mode(wl, wlvif, STATION_POWER_SAVE_MODE); - } -} - -struct wlcore_hw_queue_iter_data { - unsigned long hw_queue_map[BITS_TO_LONGS(WLCORE_NUM_MAC_ADDRESSES)]; - /* current vif */ - struct ieee80211_vif *vif; - /* is the current vif among those iterated */ - bool cur_running; -}; - -static void wlcore_hw_queue_iter(void *data, u8 *mac, - struct ieee80211_vif *vif) -{ - struct wlcore_hw_queue_iter_data *iter_data = data; - - if (WARN_ON_ONCE(vif->hw_queue[0] == IEEE80211_INVAL_HW_QUEUE)) - return; - - if (iter_data->cur_running || vif == iter_data->vif) { - iter_data->cur_running = true; - return; - } - - __set_bit(vif->hw_queue[0] / NUM_TX_QUEUES, iter_data->hw_queue_map); -} - -static int wlcore_allocate_hw_queue_base(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - struct wlcore_hw_queue_iter_data iter_data = {}; - int i, q_base; - - iter_data.vif = vif; - - /* mark all bits taken by active interfaces */ - ieee80211_iterate_active_interfaces_atomic(wl->hw, - IEEE80211_IFACE_ITER_RESUME_ALL, - wlcore_hw_queue_iter, &iter_data); - - /* the current vif is already running in mac80211 (resume/recovery) */ - if (iter_data.cur_running) { - wlvif->hw_queue_base = vif->hw_queue[0]; - wl1271_debug(DEBUG_MAC80211, - "using pre-allocated hw queue base %d", - wlvif->hw_queue_base); - - /* interface type might have changed type */ - goto adjust_cab_queue; - } - - q_base = find_first_zero_bit(iter_data.hw_queue_map, - WLCORE_NUM_MAC_ADDRESSES); - if (q_base >= WLCORE_NUM_MAC_ADDRESSES) - return -EBUSY; - - wlvif->hw_queue_base = q_base * NUM_TX_QUEUES; - wl1271_debug(DEBUG_MAC80211, "allocating hw queue base: %d", - wlvif->hw_queue_base); - - for (i = 0; i < NUM_TX_QUEUES; i++) { - wl->queue_stop_reasons[wlvif->hw_queue_base + i] = 0; - /* register hw queues in mac80211 */ - vif->hw_queue[i] = wlvif->hw_queue_base + i; - } - -adjust_cab_queue: - /* the last places are reserved for cab queues per interface */ - if (wlvif->bss_type == BSS_TYPE_AP_BSS) - vif->cab_queue = NUM_TX_QUEUES * WLCORE_NUM_MAC_ADDRESSES + - wlvif->hw_queue_base / NUM_TX_QUEUES; - else - vif->cab_queue = IEEE80211_INVAL_HW_QUEUE; - - return 0; -} - -static int wl1271_op_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - struct vif_counter_data vif_count; - int ret = 0; - u8 role_type; - - vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | - IEEE80211_VIF_SUPPORTS_CQM_RSSI; - - wl1271_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM", - ieee80211_vif_type_p2p(vif), vif->addr); - - wl12xx_get_vif_count(hw, vif, &vif_count); - - mutex_lock(&wl->mutex); - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out_unlock; - - /* - * in some very corner case HW recovery scenarios its possible to - * get here before __wl1271_op_remove_interface is complete, so - * opt out if that is the case. - */ - if (test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags) || - test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)) { - ret = -EBUSY; - goto out; - } - - - ret = wl12xx_init_vif_data(wl, vif); - if (ret < 0) - goto out; - - wlvif->wl = wl; - role_type = wl12xx_get_role_type(wl, wlvif); - if (role_type == WL12XX_INVALID_ROLE_TYPE) { - ret = -EINVAL; - goto out; - } - - ret = wlcore_allocate_hw_queue_base(wl, wlvif); - if (ret < 0) - goto out; - - if (wl12xx_need_fw_change(wl, vif_count, true)) { - wl12xx_force_active_psm(wl); - set_bit(WL1271_FLAG_INTENDED_FW_RECOVERY, &wl->flags); - mutex_unlock(&wl->mutex); - wl1271_recovery_work(&wl->recovery_work); - return 0; - } - - /* - * TODO: after the nvs issue will be solved, move this block - * to start(), and make sure here the driver is ON. - */ - if (wl->state == WLCORE_STATE_OFF) { - /* - * we still need this in order to configure the fw - * while uploading the nvs - */ - memcpy(wl->addresses[0].addr, vif->addr, ETH_ALEN); - - ret = wl12xx_init_fw(wl); - if (ret < 0) - goto out; - } - - ret = wl12xx_cmd_role_enable(wl, vif->addr, - role_type, &wlvif->role_id); - if (ret < 0) - goto out; - - ret = wl1271_init_vif_specific(wl, vif); - if (ret < 0) - goto out; - - list_add(&wlvif->list, &wl->wlvif_list); - set_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags); - - if (wlvif->bss_type == BSS_TYPE_AP_BSS) - wl->ap_count++; - else - wl->sta_count++; -out: - wl1271_ps_elp_sleep(wl); -out_unlock: - mutex_unlock(&wl->mutex); - - return ret; -} - -static void __wl1271_op_remove_interface(struct wl1271 *wl, - struct ieee80211_vif *vif, - bool reset_tx_queues) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - int i, ret; - bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); - - wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface"); - - if (!test_and_clear_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)) - return; - - /* because of hardware recovery, we may get here twice */ - if (wl->state == WLCORE_STATE_OFF) - return; - - wl1271_info("down"); - - if (wl->scan.state != WL1271_SCAN_STATE_IDLE && - wl->scan_wlvif == wlvif) { - /* - * Rearm the tx watchdog just before idling scan. This - * prevents just-finished scans from triggering the watchdog - */ - wl12xx_rearm_tx_watchdog_locked(wl); - - wl->scan.state = WL1271_SCAN_STATE_IDLE; - memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch)); - wl->scan_wlvif = NULL; - wl->scan.req = NULL; - ieee80211_scan_completed(wl->hw, true); - } - - if (wl->sched_vif == wlvif) { - ieee80211_sched_scan_stopped(wl->hw); - wl->sched_vif = NULL; - } - - if (wl->roc_vif == vif) { - wl->roc_vif = NULL; - ieee80211_remain_on_channel_expired(wl->hw); - } - - if (!test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) { - /* disable active roles */ - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto deinit; - - if (wlvif->bss_type == BSS_TYPE_STA_BSS || - wlvif->bss_type == BSS_TYPE_IBSS) { - if (wl12xx_dev_role_started(wlvif)) - wl12xx_stop_dev(wl, wlvif); - } - - ret = wl12xx_cmd_role_disable(wl, &wlvif->role_id); - if (ret < 0) - goto deinit; - - wl1271_ps_elp_sleep(wl); - } -deinit: - wl12xx_tx_reset_wlvif(wl, wlvif); - - /* clear all hlids (except system_hlid) */ - wlvif->dev_hlid = WL12XX_INVALID_LINK_ID; - - if (wlvif->bss_type == BSS_TYPE_STA_BSS || - wlvif->bss_type == BSS_TYPE_IBSS) { - wlvif->sta.hlid = WL12XX_INVALID_LINK_ID; - wl12xx_free_rate_policy(wl, &wlvif->sta.basic_rate_idx); - wl12xx_free_rate_policy(wl, &wlvif->sta.ap_rate_idx); - wl12xx_free_rate_policy(wl, &wlvif->sta.p2p_rate_idx); - wlcore_free_klv_template(wl, &wlvif->sta.klv_template_id); - } else { - wlvif->ap.bcast_hlid = WL12XX_INVALID_LINK_ID; - wlvif->ap.global_hlid = WL12XX_INVALID_LINK_ID; - wl12xx_free_rate_policy(wl, &wlvif->ap.mgmt_rate_idx); - wl12xx_free_rate_policy(wl, &wlvif->ap.bcast_rate_idx); - for (i = 0; i < CONF_TX_MAX_AC_COUNT; i++) - wl12xx_free_rate_policy(wl, - &wlvif->ap.ucast_rate_idx[i]); - wl1271_free_ap_keys(wl, wlvif); - } - - dev_kfree_skb(wlvif->probereq); - wlvif->probereq = NULL; - if (wl->last_wlvif == wlvif) - wl->last_wlvif = NULL; - list_del(&wlvif->list); - memset(wlvif->ap.sta_hlid_map, 0, sizeof(wlvif->ap.sta_hlid_map)); - wlvif->role_id = WL12XX_INVALID_ROLE_ID; - wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID; - - if (is_ap) - wl->ap_count--; - else - wl->sta_count--; - - /* - * Last AP, have more stations. Configure sleep auth according to STA. - * Don't do thin on unintended recovery. - */ - if (test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags) && - !test_bit(WL1271_FLAG_INTENDED_FW_RECOVERY, &wl->flags)) - goto unlock; - - if (wl->ap_count == 0 && is_ap && wl->sta_count) { - u8 sta_auth = wl->conf.conn.sta_sleep_auth; - /* Configure for power according to debugfs */ - if (sta_auth != WL1271_PSM_ILLEGAL) - wl1271_acx_sleep_auth(wl, sta_auth); - /* Configure for ELP power saving */ - else - wl1271_acx_sleep_auth(wl, WL1271_PSM_ELP); - } - -unlock: - mutex_unlock(&wl->mutex); - - del_timer_sync(&wlvif->rx_streaming_timer); - cancel_work_sync(&wlvif->rx_streaming_enable_work); - cancel_work_sync(&wlvif->rx_streaming_disable_work); - cancel_delayed_work_sync(&wlvif->connection_loss_work); - - mutex_lock(&wl->mutex); -} - -static void wl1271_op_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - struct wl12xx_vif *iter; - struct vif_counter_data vif_count; - - wl12xx_get_vif_count(hw, vif, &vif_count); - mutex_lock(&wl->mutex); - - if (wl->state == WLCORE_STATE_OFF || - !test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)) - goto out; - - /* - * wl->vif can be null here if someone shuts down the interface - * just when hardware recovery has been started. - */ - wl12xx_for_each_wlvif(wl, iter) { - if (iter != wlvif) - continue; - - __wl1271_op_remove_interface(wl, vif, true); - break; - } - WARN_ON(iter != wlvif); - if (wl12xx_need_fw_change(wl, vif_count, false)) { - wl12xx_force_active_psm(wl); - set_bit(WL1271_FLAG_INTENDED_FW_RECOVERY, &wl->flags); - wl12xx_queue_recovery_work(wl); - } -out: - mutex_unlock(&wl->mutex); -} - -static int wl12xx_op_change_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum nl80211_iftype new_type, bool p2p) -{ - struct wl1271 *wl = hw->priv; - int ret; - - set_bit(WL1271_FLAG_VIF_CHANGE_IN_PROGRESS, &wl->flags); - wl1271_op_remove_interface(hw, vif); - - vif->type = new_type; - vif->p2p = p2p; - ret = wl1271_op_add_interface(hw, vif); - - clear_bit(WL1271_FLAG_VIF_CHANGE_IN_PROGRESS, &wl->flags); - return ret; -} - -static int wlcore_join(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int ret; - bool is_ibss = (wlvif->bss_type == BSS_TYPE_IBSS); - - /* - * One of the side effects of the JOIN command is that is clears - * WPA/WPA2 keys from the chipset. Performing a JOIN while associated - * to a WPA/WPA2 access point will therefore kill the data-path. - * Currently the only valid scenario for JOIN during association - * is on roaming, in which case we will also be given new keys. - * Keep the below message for now, unless it starts bothering - * users who really like to roam a lot :) - */ - if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) - wl1271_info("JOIN while associated."); - - /* clear encryption type */ - wlvif->encryption_type = KEY_NONE; - - if (is_ibss) - ret = wl12xx_cmd_role_start_ibss(wl, wlvif); - else { - if (wl->quirks & WLCORE_QUIRK_START_STA_FAILS) { - /* - * TODO: this is an ugly workaround for wl12xx fw - * bug - we are not able to tx/rx after the first - * start_sta, so make dummy start+stop calls, - * and then call start_sta again. - * this should be fixed in the fw. - */ - wl12xx_cmd_role_start_sta(wl, wlvif); - wl12xx_cmd_role_stop_sta(wl, wlvif); - } - - ret = wl12xx_cmd_role_start_sta(wl, wlvif); - } - - return ret; -} - -static int wl1271_ssid_set(struct wl12xx_vif *wlvif, struct sk_buff *skb, - int offset) -{ - u8 ssid_len; - const u8 *ptr = cfg80211_find_ie(WLAN_EID_SSID, skb->data + offset, - skb->len - offset); - - if (!ptr) { - wl1271_error("No SSID in IEs!"); - return -ENOENT; - } - - ssid_len = ptr[1]; - if (ssid_len > IEEE80211_MAX_SSID_LEN) { - wl1271_error("SSID is too long!"); - return -EINVAL; - } - - wlvif->ssid_len = ssid_len; - memcpy(wlvif->ssid, ptr+2, ssid_len); - return 0; -} - -static int wlcore_set_ssid(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - struct sk_buff *skb; - int ieoffset; - - /* we currently only support setting the ssid from the ap probe req */ - if (wlvif->bss_type != BSS_TYPE_STA_BSS) - return -EINVAL; - - skb = ieee80211_ap_probereq_get(wl->hw, vif); - if (!skb) - return -EINVAL; - - ieoffset = offsetof(struct ieee80211_mgmt, - u.probe_req.variable); - wl1271_ssid_set(wlvif, skb, ieoffset); - dev_kfree_skb(skb); - - return 0; -} - -static int wlcore_set_assoc(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct ieee80211_bss_conf *bss_conf, - u32 sta_rate_set) -{ - int ieoffset; - int ret; - - wlvif->aid = bss_conf->aid; - wlvif->channel_type = cfg80211_get_chandef_type(&bss_conf->chandef); - wlvif->beacon_int = bss_conf->beacon_int; - wlvif->wmm_enabled = bss_conf->qos; - - set_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags); - - /* - * with wl1271, we don't need to update the - * beacon_int and dtim_period, because the firmware - * updates it by itself when the first beacon is - * received after a join. - */ - ret = wl1271_cmd_build_ps_poll(wl, wlvif, wlvif->aid); - if (ret < 0) - return ret; - - /* - * Get a template for hardware connection maintenance - */ - dev_kfree_skb(wlvif->probereq); - wlvif->probereq = wl1271_cmd_build_ap_probe_req(wl, - wlvif, - NULL); - ieoffset = offsetof(struct ieee80211_mgmt, - u.probe_req.variable); - wl1271_ssid_set(wlvif, wlvif->probereq, ieoffset); - - /* enable the connection monitoring feature */ - ret = wl1271_acx_conn_monit_params(wl, wlvif, true); - if (ret < 0) - return ret; - - /* - * The join command disable the keep-alive mode, shut down its process, - * and also clear the template config, so we need to reset it all after - * the join. The acx_aid starts the keep-alive process, and the order - * of the commands below is relevant. - */ - ret = wl1271_acx_keep_alive_mode(wl, wlvif, true); - if (ret < 0) - return ret; - - ret = wl1271_acx_aid(wl, wlvif, wlvif->aid); - if (ret < 0) - return ret; - - ret = wl12xx_cmd_build_klv_null_data(wl, wlvif); - if (ret < 0) - return ret; - - ret = wl1271_acx_keep_alive_config(wl, wlvif, - wlvif->sta.klv_template_id, - ACX_KEEP_ALIVE_TPL_VALID); - if (ret < 0) - return ret; - - /* - * The default fw psm configuration is AUTO, while mac80211 default - * setting is off (ACTIVE), so sync the fw with the correct value. - */ - ret = wl1271_ps_set_mode(wl, wlvif, STATION_ACTIVE_MODE); - if (ret < 0) - return ret; - - if (sta_rate_set) { - wlvif->rate_set = - wl1271_tx_enabled_rates_get(wl, - sta_rate_set, - wlvif->band); - ret = wl1271_acx_sta_rate_policies(wl, wlvif); - if (ret < 0) - return ret; - } - - return ret; -} - -static int wlcore_unset_assoc(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int ret; - bool sta = wlvif->bss_type == BSS_TYPE_STA_BSS; - - /* make sure we are connected (sta) joined */ - if (sta && - !test_and_clear_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) - return false; - - /* make sure we are joined (ibss) */ - if (!sta && - test_and_clear_bit(WLVIF_FLAG_IBSS_JOINED, &wlvif->flags)) - return false; - - if (sta) { - /* use defaults when not associated */ - wlvif->aid = 0; - - /* free probe-request template */ - dev_kfree_skb(wlvif->probereq); - wlvif->probereq = NULL; - - /* disable connection monitor features */ - ret = wl1271_acx_conn_monit_params(wl, wlvif, false); - if (ret < 0) - return ret; - - /* Disable the keep-alive feature */ - ret = wl1271_acx_keep_alive_mode(wl, wlvif, false); - if (ret < 0) - return ret; - } - - if (test_and_clear_bit(WLVIF_FLAG_CS_PROGRESS, &wlvif->flags)) { - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - - wl12xx_cmd_stop_channel_switch(wl, wlvif); - ieee80211_chswitch_done(vif, false); - cancel_delayed_work(&wlvif->channel_switch_work); - } - - /* invalidate keep-alive template */ - wl1271_acx_keep_alive_config(wl, wlvif, - wlvif->sta.klv_template_id, - ACX_KEEP_ALIVE_TPL_INVALID); - - return 0; -} - -static void wl1271_set_band_rate(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - wlvif->basic_rate_set = wlvif->bitrate_masks[wlvif->band]; - wlvif->rate_set = wlvif->basic_rate_set; -} - -static int wl12xx_config_vif(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct ieee80211_conf *conf, u32 changed) -{ - int ret; - - if (conf->power_level != wlvif->power_level) { - ret = wl1271_acx_tx_power(wl, wlvif, conf->power_level); - if (ret < 0) - return ret; - - wlvif->power_level = conf->power_level; - } - - return 0; -} - -static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif; - struct ieee80211_conf *conf = &hw->conf; - int ret = 0; - - wl1271_debug(DEBUG_MAC80211, "mac80211 config psm %s power %d %s" - " changed 0x%x", - conf->flags & IEEE80211_CONF_PS ? "on" : "off", - conf->power_level, - conf->flags & IEEE80211_CONF_IDLE ? "idle" : "in use", - changed); - - mutex_lock(&wl->mutex); - - if (changed & IEEE80211_CONF_CHANGE_POWER) - wl->power_level = conf->power_level; - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - /* configure each interface */ - wl12xx_for_each_wlvif(wl, wlvif) { - ret = wl12xx_config_vif(wl, wlvif, conf, changed); - if (ret < 0) - goto out_sleep; - } - -out_sleep: - wl1271_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -struct wl1271_filter_params { - bool enabled; - int mc_list_length; - u8 mc_list[ACX_MC_ADDRESS_GROUP_MAX][ETH_ALEN]; -}; - -static u64 wl1271_op_prepare_multicast(struct ieee80211_hw *hw, - struct netdev_hw_addr_list *mc_list) -{ - struct wl1271_filter_params *fp; - struct netdev_hw_addr *ha; - - fp = kzalloc(sizeof(*fp), GFP_ATOMIC); - if (!fp) { - wl1271_error("Out of memory setting filters."); - return 0; - } - - /* update multicast filtering parameters */ - fp->mc_list_length = 0; - if (netdev_hw_addr_list_count(mc_list) > ACX_MC_ADDRESS_GROUP_MAX) { - fp->enabled = false; - } else { - fp->enabled = true; - netdev_hw_addr_list_for_each(ha, mc_list) { - memcpy(fp->mc_list[fp->mc_list_length], - ha->addr, ETH_ALEN); - fp->mc_list_length++; - } - } - - return (u64)(unsigned long)fp; -} - -#define WL1271_SUPPORTED_FILTERS (FIF_PROMISC_IN_BSS | \ - FIF_ALLMULTI | \ - FIF_FCSFAIL | \ - FIF_BCN_PRBRESP_PROMISC | \ - FIF_CONTROL | \ - FIF_OTHER_BSS) - -static void wl1271_op_configure_filter(struct ieee80211_hw *hw, - unsigned int changed, - unsigned int *total, u64 multicast) -{ - struct wl1271_filter_params *fp = (void *)(unsigned long)multicast; - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif; - - int ret; - - wl1271_debug(DEBUG_MAC80211, "mac80211 configure filter changed %x" - " total %x", changed, *total); - - mutex_lock(&wl->mutex); - - *total &= WL1271_SUPPORTED_FILTERS; - changed &= WL1271_SUPPORTED_FILTERS; - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - wl12xx_for_each_wlvif(wl, wlvif) { - if (wlvif->bss_type != BSS_TYPE_AP_BSS) { - if (*total & FIF_ALLMULTI) - ret = wl1271_acx_group_address_tbl(wl, wlvif, - false, - NULL, 0); - else if (fp) - ret = wl1271_acx_group_address_tbl(wl, wlvif, - fp->enabled, - fp->mc_list, - fp->mc_list_length); - if (ret < 0) - goto out_sleep; - } - } - - /* - * the fw doesn't provide an api to configure the filters. instead, - * the filters configuration is based on the active roles / ROC - * state. - */ - -out_sleep: - wl1271_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - kfree(fp); -} - -static int wl1271_record_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 id, u8 key_type, u8 key_size, - const u8 *key, u8 hlid, u32 tx_seq_32, - u16 tx_seq_16) -{ - struct wl1271_ap_key *ap_key; - int i; - - wl1271_debug(DEBUG_CRYPT, "record ap key id %d", (int)id); - - if (key_size > MAX_KEY_SIZE) - return -EINVAL; - - /* - * Find next free entry in ap_keys. Also check we are not replacing - * an existing key. - */ - for (i = 0; i < MAX_NUM_KEYS; i++) { - if (wlvif->ap.recorded_keys[i] == NULL) - break; - - if (wlvif->ap.recorded_keys[i]->id == id) { - wl1271_warning("trying to record key replacement"); - return -EINVAL; - } - } - - if (i == MAX_NUM_KEYS) - return -EBUSY; - - ap_key = kzalloc(sizeof(*ap_key), GFP_KERNEL); - if (!ap_key) - return -ENOMEM; - - ap_key->id = id; - ap_key->key_type = key_type; - ap_key->key_size = key_size; - memcpy(ap_key->key, key, key_size); - ap_key->hlid = hlid; - ap_key->tx_seq_32 = tx_seq_32; - ap_key->tx_seq_16 = tx_seq_16; - - wlvif->ap.recorded_keys[i] = ap_key; - return 0; -} - -static void wl1271_free_ap_keys(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int i; - - for (i = 0; i < MAX_NUM_KEYS; i++) { - kfree(wlvif->ap.recorded_keys[i]); - wlvif->ap.recorded_keys[i] = NULL; - } -} - -static int wl1271_ap_init_hwenc(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int i, ret = 0; - struct wl1271_ap_key *key; - bool wep_key_added = false; - - for (i = 0; i < MAX_NUM_KEYS; i++) { - u8 hlid; - if (wlvif->ap.recorded_keys[i] == NULL) - break; - - key = wlvif->ap.recorded_keys[i]; - hlid = key->hlid; - if (hlid == WL12XX_INVALID_LINK_ID) - hlid = wlvif->ap.bcast_hlid; - - ret = wl1271_cmd_set_ap_key(wl, wlvif, KEY_ADD_OR_REPLACE, - key->id, key->key_type, - key->key_size, key->key, - hlid, key->tx_seq_32, - key->tx_seq_16); - if (ret < 0) - goto out; - - if (key->key_type == KEY_WEP) - wep_key_added = true; - } - - if (wep_key_added) { - ret = wl12xx_cmd_set_default_wep_key(wl, wlvif->default_key, - wlvif->ap.bcast_hlid); - if (ret < 0) - goto out; - } - -out: - wl1271_free_ap_keys(wl, wlvif); - return ret; -} - -static int wl1271_set_key(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u16 action, u8 id, u8 key_type, - u8 key_size, const u8 *key, u32 tx_seq_32, - u16 tx_seq_16, struct ieee80211_sta *sta) -{ - int ret; - bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); - - if (is_ap) { - struct wl1271_station *wl_sta; - u8 hlid; - - if (sta) { - wl_sta = (struct wl1271_station *)sta->drv_priv; - hlid = wl_sta->hlid; - } else { - hlid = wlvif->ap.bcast_hlid; - } - - if (!test_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags)) { - /* - * We do not support removing keys after AP shutdown. - * Pretend we do to make mac80211 happy. - */ - if (action != KEY_ADD_OR_REPLACE) - return 0; - - ret = wl1271_record_ap_key(wl, wlvif, id, - key_type, key_size, - key, hlid, tx_seq_32, - tx_seq_16); - } else { - ret = wl1271_cmd_set_ap_key(wl, wlvif, action, - id, key_type, key_size, - key, hlid, tx_seq_32, - tx_seq_16); - } - - if (ret < 0) - return ret; - } else { - const u8 *addr; - static const u8 bcast_addr[ETH_ALEN] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - }; - - addr = sta ? sta->addr : bcast_addr; - - if (is_zero_ether_addr(addr)) { - /* We dont support TX only encryption */ - return -EOPNOTSUPP; - } - - /* The wl1271 does not allow to remove unicast keys - they - will be cleared automatically on next CMD_JOIN. Ignore the - request silently, as we dont want the mac80211 to emit - an error message. */ - if (action == KEY_REMOVE && !is_broadcast_ether_addr(addr)) - return 0; - - /* don't remove key if hlid was already deleted */ - if (action == KEY_REMOVE && - wlvif->sta.hlid == WL12XX_INVALID_LINK_ID) - return 0; - - ret = wl1271_cmd_set_sta_key(wl, wlvif, action, - id, key_type, key_size, - key, addr, tx_seq_32, - tx_seq_16); - if (ret < 0) - return ret; - - /* the default WEP key needs to be configured at least once */ - if (key_type == KEY_WEP) { - ret = wl12xx_cmd_set_default_wep_key(wl, - wlvif->default_key, - wlvif->sta.hlid); - if (ret < 0) - return ret; - } - } - - return 0; -} - -static int wlcore_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key_conf) -{ - struct wl1271 *wl = hw->priv; - int ret; - bool might_change_spare = - key_conf->cipher == WL1271_CIPHER_SUITE_GEM || - key_conf->cipher == WLAN_CIPHER_SUITE_TKIP; - - if (might_change_spare) { - /* - * stop the queues and flush to ensure the next packets are - * in sync with FW spare block accounting - */ - wlcore_stop_queues(wl, WLCORE_QUEUE_STOP_REASON_SPARE_BLK); - wl1271_tx_flush(wl); - } - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) { - ret = -EAGAIN; - goto out_wake_queues; - } - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out_wake_queues; - - ret = wlcore_hw_set_key(wl, cmd, vif, sta, key_conf); - - wl1271_ps_elp_sleep(wl); - -out_wake_queues: - if (might_change_spare) - wlcore_wake_queues(wl, WLCORE_QUEUE_STOP_REASON_SPARE_BLK); - - mutex_unlock(&wl->mutex); - - return ret; -} - -int wlcore_set_key(struct wl1271 *wl, enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key_conf) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - int ret; - u32 tx_seq_32 = 0; - u16 tx_seq_16 = 0; - u8 key_type; - u8 hlid; - - wl1271_debug(DEBUG_MAC80211, "mac80211 set key"); - - wl1271_debug(DEBUG_CRYPT, "CMD: 0x%x sta: %p", cmd, sta); - wl1271_debug(DEBUG_CRYPT, "Key: algo:0x%x, id:%d, len:%d flags 0x%x", - key_conf->cipher, key_conf->keyidx, - key_conf->keylen, key_conf->flags); - wl1271_dump(DEBUG_CRYPT, "KEY: ", key_conf->key, key_conf->keylen); - - if (wlvif->bss_type == BSS_TYPE_AP_BSS) - if (sta) { - struct wl1271_station *wl_sta = (void *)sta->drv_priv; - hlid = wl_sta->hlid; - } else { - hlid = wlvif->ap.bcast_hlid; - } - else - hlid = wlvif->sta.hlid; - - if (hlid != WL12XX_INVALID_LINK_ID) { - u64 tx_seq = wl->links[hlid].total_freed_pkts; - tx_seq_32 = WL1271_TX_SECURITY_HI32(tx_seq); - tx_seq_16 = WL1271_TX_SECURITY_LO16(tx_seq); - } - - switch (key_conf->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - key_type = KEY_WEP; - - key_conf->hw_key_idx = key_conf->keyidx; - break; - case WLAN_CIPHER_SUITE_TKIP: - key_type = KEY_TKIP; - key_conf->hw_key_idx = key_conf->keyidx; - break; - case WLAN_CIPHER_SUITE_CCMP: - key_type = KEY_AES; - key_conf->flags |= IEEE80211_KEY_FLAG_PUT_IV_SPACE; - break; - case WL1271_CIPHER_SUITE_GEM: - key_type = KEY_GEM; - break; - default: - wl1271_error("Unknown key algo 0x%x", key_conf->cipher); - - return -EOPNOTSUPP; - } - - switch (cmd) { - case SET_KEY: - ret = wl1271_set_key(wl, wlvif, KEY_ADD_OR_REPLACE, - key_conf->keyidx, key_type, - key_conf->keylen, key_conf->key, - tx_seq_32, tx_seq_16, sta); - if (ret < 0) { - wl1271_error("Could not add or replace key"); - return ret; - } - - /* - * reconfiguring arp response if the unicast (or common) - * encryption key type was changed - */ - if (wlvif->bss_type == BSS_TYPE_STA_BSS && - (sta || key_type == KEY_WEP) && - wlvif->encryption_type != key_type) { - wlvif->encryption_type = key_type; - ret = wl1271_cmd_build_arp_rsp(wl, wlvif); - if (ret < 0) { - wl1271_warning("build arp rsp failed: %d", ret); - return ret; - } - } - break; - - case DISABLE_KEY: - ret = wl1271_set_key(wl, wlvif, KEY_REMOVE, - key_conf->keyidx, key_type, - key_conf->keylen, key_conf->key, - 0, 0, sta); - if (ret < 0) { - wl1271_error("Could not remove key"); - return ret; - } - break; - - default: - wl1271_error("Unsupported key cmd 0x%x", cmd); - return -EOPNOTSUPP; - } - - return ret; -} -EXPORT_SYMBOL_GPL(wlcore_set_key); - -void wlcore_regdomain_config(struct wl1271 *wl) -{ - int ret; - - if (!(wl->quirks & WLCORE_QUIRK_REGDOMAIN_CONF)) - return; - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = wlcore_cmd_regdomain_config_locked(wl); - if (ret < 0) { - wl12xx_queue_recovery_work(wl); - goto out; - } - - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); -} - -static int wl1271_op_hw_scan(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct cfg80211_scan_request *req) -{ - struct wl1271 *wl = hw->priv; - int ret; - u8 *ssid = NULL; - size_t len = 0; - - wl1271_debug(DEBUG_MAC80211, "mac80211 hw scan"); - - if (req->n_ssids) { - ssid = req->ssids[0].ssid; - len = req->ssids[0].ssid_len; - } - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) { - /* - * We cannot return -EBUSY here because cfg80211 will expect - * a call to ieee80211_scan_completed if we do - in this case - * there won't be any call. - */ - ret = -EAGAIN; - goto out; - } - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - /* fail if there is any role in ROC */ - if (find_first_bit(wl->roc_map, WL12XX_MAX_ROLES) < WL12XX_MAX_ROLES) { - /* don't allow scanning right now */ - ret = -EBUSY; - goto out_sleep; - } - - ret = wlcore_scan(hw->priv, vif, ssid, len, req); -out_sleep: - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -static void wl1271_op_cancel_hw_scan(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - int ret; - - wl1271_debug(DEBUG_MAC80211, "mac80211 cancel hw scan"); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - if (wl->scan.state == WL1271_SCAN_STATE_IDLE) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - if (wl->scan.state != WL1271_SCAN_STATE_DONE) { - ret = wl->ops->scan_stop(wl, wlvif); - if (ret < 0) - goto out_sleep; - } - - /* - * Rearm the tx watchdog just before idling scan. This - * prevents just-finished scans from triggering the watchdog - */ - wl12xx_rearm_tx_watchdog_locked(wl); - - wl->scan.state = WL1271_SCAN_STATE_IDLE; - memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch)); - wl->scan_wlvif = NULL; - wl->scan.req = NULL; - ieee80211_scan_completed(wl->hw, true); - -out_sleep: - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); - - cancel_delayed_work_sync(&wl->scan_complete_work); -} - -static int wl1271_op_sched_scan_start(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct cfg80211_sched_scan_request *req, - struct ieee80211_sched_scan_ies *ies) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - int ret; - - wl1271_debug(DEBUG_MAC80211, "wl1271_op_sched_scan_start"); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) { - ret = -EAGAIN; - goto out; - } - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = wl->ops->sched_scan_start(wl, wlvif, req, ies); - if (ret < 0) - goto out_sleep; - - wl->sched_vif = wlvif; - -out_sleep: - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); - return ret; -} - -static void wl1271_op_sched_scan_stop(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - int ret; - - wl1271_debug(DEBUG_MAC80211, "wl1271_op_sched_scan_stop"); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - wl->ops->sched_scan_stop(wl, wlvif); - - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); -} - -static int wl1271_op_set_frag_threshold(struct ieee80211_hw *hw, u32 value) -{ - struct wl1271 *wl = hw->priv; - int ret = 0; - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) { - ret = -EAGAIN; - goto out; - } - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = wl1271_acx_frag_threshold(wl, value); - if (ret < 0) - wl1271_warning("wl1271_op_set_frag_threshold failed: %d", ret); - - wl1271_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif; - int ret = 0; - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) { - ret = -EAGAIN; - goto out; - } - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - wl12xx_for_each_wlvif(wl, wlvif) { - ret = wl1271_acx_rts_threshold(wl, wlvif, value); - if (ret < 0) - wl1271_warning("set rts threshold failed: %d", ret); - } - wl1271_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -static void wl12xx_remove_ie(struct sk_buff *skb, u8 eid, int ieoffset) -{ - int len; - const u8 *next, *end = skb->data + skb->len; - u8 *ie = (u8 *)cfg80211_find_ie(eid, skb->data + ieoffset, - skb->len - ieoffset); - if (!ie) - return; - len = ie[1] + 2; - next = ie + len; - memmove(ie, next, end - next); - skb_trim(skb, skb->len - len); -} - -static void wl12xx_remove_vendor_ie(struct sk_buff *skb, - unsigned int oui, u8 oui_type, - int ieoffset) -{ - int len; - const u8 *next, *end = skb->data + skb->len; - u8 *ie = (u8 *)cfg80211_find_vendor_ie(oui, oui_type, - skb->data + ieoffset, - skb->len - ieoffset); - if (!ie) - return; - len = ie[1] + 2; - next = ie + len; - memmove(ie, next, end - next); - skb_trim(skb, skb->len - len); -} - -static int wl1271_ap_set_probe_resp_tmpl(struct wl1271 *wl, u32 rates, - struct ieee80211_vif *vif) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - struct sk_buff *skb; - int ret; - - skb = ieee80211_proberesp_get(wl->hw, vif); - if (!skb) - return -EOPNOTSUPP; - - ret = wl1271_cmd_template_set(wl, wlvif->role_id, - CMD_TEMPL_AP_PROBE_RESPONSE, - skb->data, - skb->len, 0, - rates); - dev_kfree_skb(skb); - - if (ret < 0) - goto out; - - wl1271_debug(DEBUG_AP, "probe response updated"); - set_bit(WLVIF_FLAG_AP_PROBE_RESP_SET, &wlvif->flags); - -out: - return ret; -} - -static int wl1271_ap_set_probe_resp_tmpl_legacy(struct wl1271 *wl, - struct ieee80211_vif *vif, - u8 *probe_rsp_data, - size_t probe_rsp_len, - u32 rates) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; - u8 probe_rsp_templ[WL1271_CMD_TEMPL_MAX_SIZE]; - int ssid_ie_offset, ie_offset, templ_len; - const u8 *ptr; - - /* no need to change probe response if the SSID is set correctly */ - if (wlvif->ssid_len > 0) - return wl1271_cmd_template_set(wl, wlvif->role_id, - CMD_TEMPL_AP_PROBE_RESPONSE, - probe_rsp_data, - probe_rsp_len, 0, - rates); - - if (probe_rsp_len + bss_conf->ssid_len > WL1271_CMD_TEMPL_MAX_SIZE) { - wl1271_error("probe_rsp template too big"); - return -EINVAL; - } - - /* start searching from IE offset */ - ie_offset = offsetof(struct ieee80211_mgmt, u.probe_resp.variable); - - ptr = cfg80211_find_ie(WLAN_EID_SSID, probe_rsp_data + ie_offset, - probe_rsp_len - ie_offset); - if (!ptr) { - wl1271_error("No SSID in beacon!"); - return -EINVAL; - } - - ssid_ie_offset = ptr - probe_rsp_data; - ptr += (ptr[1] + 2); - - memcpy(probe_rsp_templ, probe_rsp_data, ssid_ie_offset); - - /* insert SSID from bss_conf */ - probe_rsp_templ[ssid_ie_offset] = WLAN_EID_SSID; - probe_rsp_templ[ssid_ie_offset + 1] = bss_conf->ssid_len; - memcpy(probe_rsp_templ + ssid_ie_offset + 2, - bss_conf->ssid, bss_conf->ssid_len); - templ_len = ssid_ie_offset + 2 + bss_conf->ssid_len; - - memcpy(probe_rsp_templ + ssid_ie_offset + 2 + bss_conf->ssid_len, - ptr, probe_rsp_len - (ptr - probe_rsp_data)); - templ_len += probe_rsp_len - (ptr - probe_rsp_data); - - return wl1271_cmd_template_set(wl, wlvif->role_id, - CMD_TEMPL_AP_PROBE_RESPONSE, - probe_rsp_templ, - templ_len, 0, - rates); -} - -static int wl1271_bss_erp_info_changed(struct wl1271 *wl, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changed) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - int ret = 0; - - if (changed & BSS_CHANGED_ERP_SLOT) { - if (bss_conf->use_short_slot) - ret = wl1271_acx_slot(wl, wlvif, SLOT_TIME_SHORT); - else - ret = wl1271_acx_slot(wl, wlvif, SLOT_TIME_LONG); - if (ret < 0) { - wl1271_warning("Set slot time failed %d", ret); - goto out; - } - } - - if (changed & BSS_CHANGED_ERP_PREAMBLE) { - if (bss_conf->use_short_preamble) - wl1271_acx_set_preamble(wl, wlvif, ACX_PREAMBLE_SHORT); - else - wl1271_acx_set_preamble(wl, wlvif, ACX_PREAMBLE_LONG); - } - - if (changed & BSS_CHANGED_ERP_CTS_PROT) { - if (bss_conf->use_cts_prot) - ret = wl1271_acx_cts_protect(wl, wlvif, - CTSPROTECT_ENABLE); - else - ret = wl1271_acx_cts_protect(wl, wlvif, - CTSPROTECT_DISABLE); - if (ret < 0) { - wl1271_warning("Set ctsprotect failed %d", ret); - goto out; - } - } - -out: - return ret; -} - -static int wlcore_set_beacon_template(struct wl1271 *wl, - struct ieee80211_vif *vif, - bool is_ap) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - struct ieee80211_hdr *hdr; - u32 min_rate; - int ret; - int ieoffset = offsetof(struct ieee80211_mgmt, - u.beacon.variable); - struct sk_buff *beacon = ieee80211_beacon_get(wl->hw, vif); - u16 tmpl_id; - - if (!beacon) { - ret = -EINVAL; - goto out; - } - - wl1271_debug(DEBUG_MASTER, "beacon updated"); - - ret = wl1271_ssid_set(wlvif, beacon, ieoffset); - if (ret < 0) { - dev_kfree_skb(beacon); - goto out; - } - min_rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); - tmpl_id = is_ap ? CMD_TEMPL_AP_BEACON : - CMD_TEMPL_BEACON; - ret = wl1271_cmd_template_set(wl, wlvif->role_id, tmpl_id, - beacon->data, - beacon->len, 0, - min_rate); - if (ret < 0) { - dev_kfree_skb(beacon); - goto out; - } - - wlvif->wmm_enabled = - cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT, - WLAN_OUI_TYPE_MICROSOFT_WMM, - beacon->data + ieoffset, - beacon->len - ieoffset); - - /* - * In case we already have a probe-resp beacon set explicitly - * by usermode, don't use the beacon data. - */ - if (test_bit(WLVIF_FLAG_AP_PROBE_RESP_SET, &wlvif->flags)) - goto end_bcn; - - /* remove TIM ie from probe response */ - wl12xx_remove_ie(beacon, WLAN_EID_TIM, ieoffset); - - /* - * remove p2p ie from probe response. - * the fw reponds to probe requests that don't include - * the p2p ie. probe requests with p2p ie will be passed, - * and will be responded by the supplicant (the spec - * forbids including the p2p ie when responding to probe - * requests that didn't include it). - */ - wl12xx_remove_vendor_ie(beacon, WLAN_OUI_WFA, - WLAN_OUI_TYPE_WFA_P2P, ieoffset); - - hdr = (struct ieee80211_hdr *) beacon->data; - hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_PROBE_RESP); - if (is_ap) - ret = wl1271_ap_set_probe_resp_tmpl_legacy(wl, vif, - beacon->data, - beacon->len, - min_rate); - else - ret = wl1271_cmd_template_set(wl, wlvif->role_id, - CMD_TEMPL_PROBE_RESPONSE, - beacon->data, - beacon->len, 0, - min_rate); -end_bcn: - dev_kfree_skb(beacon); - if (ret < 0) - goto out; - -out: - return ret; -} - -static int wl1271_bss_beacon_info_changed(struct wl1271 *wl, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changed) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); - int ret = 0; - - if (changed & BSS_CHANGED_BEACON_INT) { - wl1271_debug(DEBUG_MASTER, "beacon interval updated: %d", - bss_conf->beacon_int); - - wlvif->beacon_int = bss_conf->beacon_int; - } - - if ((changed & BSS_CHANGED_AP_PROBE_RESP) && is_ap) { - u32 rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); - - wl1271_ap_set_probe_resp_tmpl(wl, rate, vif); - } - - if (changed & BSS_CHANGED_BEACON) { - ret = wlcore_set_beacon_template(wl, vif, is_ap); - if (ret < 0) - goto out; - } - -out: - if (ret != 0) - wl1271_error("beacon info change failed: %d", ret); - return ret; -} - -/* AP mode changes */ -static void wl1271_bss_info_changed_ap(struct wl1271 *wl, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changed) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - int ret = 0; - - if (changed & BSS_CHANGED_BASIC_RATES) { - u32 rates = bss_conf->basic_rates; - - wlvif->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates, - wlvif->band); - wlvif->basic_rate = wl1271_tx_min_rate_get(wl, - wlvif->basic_rate_set); - - ret = wl1271_init_ap_rates(wl, wlvif); - if (ret < 0) { - wl1271_error("AP rate policy change failed %d", ret); - goto out; - } - - ret = wl1271_ap_init_templates(wl, vif); - if (ret < 0) - goto out; - - ret = wl1271_ap_set_probe_resp_tmpl(wl, wlvif->basic_rate, vif); - if (ret < 0) - goto out; - - ret = wlcore_set_beacon_template(wl, vif, true); - if (ret < 0) - goto out; - } - - ret = wl1271_bss_beacon_info_changed(wl, vif, bss_conf, changed); - if (ret < 0) - goto out; - - if (changed & BSS_CHANGED_BEACON_ENABLED) { - if (bss_conf->enable_beacon) { - if (!test_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags)) { - ret = wl12xx_cmd_role_start_ap(wl, wlvif); - if (ret < 0) - goto out; - - ret = wl1271_ap_init_hwenc(wl, wlvif); - if (ret < 0) - goto out; - - set_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags); - wl1271_debug(DEBUG_AP, "started AP"); - } - } else { - if (test_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags)) { - ret = wl12xx_cmd_role_stop_ap(wl, wlvif); - if (ret < 0) - goto out; - - clear_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags); - clear_bit(WLVIF_FLAG_AP_PROBE_RESP_SET, - &wlvif->flags); - wl1271_debug(DEBUG_AP, "stopped AP"); - } - } - } - - ret = wl1271_bss_erp_info_changed(wl, vif, bss_conf, changed); - if (ret < 0) - goto out; - - /* Handle HT information change */ - if ((changed & BSS_CHANGED_HT) && - (bss_conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT)) { - ret = wl1271_acx_set_ht_information(wl, wlvif, - bss_conf->ht_operation_mode); - if (ret < 0) { - wl1271_warning("Set ht information failed %d", ret); - goto out; - } - } - -out: - return; -} - -static int wlcore_set_bssid(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct ieee80211_bss_conf *bss_conf, - u32 sta_rate_set) -{ - u32 rates; - int ret; - - wl1271_debug(DEBUG_MAC80211, - "changed_bssid: %pM, aid: %d, bcn_int: %d, brates: 0x%x sta_rate_set: 0x%x", - bss_conf->bssid, bss_conf->aid, - bss_conf->beacon_int, - bss_conf->basic_rates, sta_rate_set); - - wlvif->beacon_int = bss_conf->beacon_int; - rates = bss_conf->basic_rates; - wlvif->basic_rate_set = - wl1271_tx_enabled_rates_get(wl, rates, - wlvif->band); - wlvif->basic_rate = - wl1271_tx_min_rate_get(wl, - wlvif->basic_rate_set); - - if (sta_rate_set) - wlvif->rate_set = - wl1271_tx_enabled_rates_get(wl, - sta_rate_set, - wlvif->band); - - /* we only support sched_scan while not connected */ - if (wl->sched_vif == wlvif) - wl->ops->sched_scan_stop(wl, wlvif); - - ret = wl1271_acx_sta_rate_policies(wl, wlvif); - if (ret < 0) - return ret; - - ret = wl12xx_cmd_build_null_data(wl, wlvif); - if (ret < 0) - return ret; - - ret = wl1271_build_qos_null_data(wl, wl12xx_wlvif_to_vif(wlvif)); - if (ret < 0) - return ret; - - wlcore_set_ssid(wl, wlvif); - - set_bit(WLVIF_FLAG_IN_USE, &wlvif->flags); - - return 0; -} - -static int wlcore_clear_bssid(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int ret; - - /* revert back to minimum rates for the current band */ - wl1271_set_band_rate(wl, wlvif); - wlvif->basic_rate = wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); - - ret = wl1271_acx_sta_rate_policies(wl, wlvif); - if (ret < 0) - return ret; - - if (wlvif->bss_type == BSS_TYPE_STA_BSS && - test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags)) { - ret = wl12xx_cmd_role_stop_sta(wl, wlvif); - if (ret < 0) - return ret; - } - - clear_bit(WLVIF_FLAG_IN_USE, &wlvif->flags); - return 0; -} -/* STA/IBSS mode changes */ -static void wl1271_bss_info_changed_sta(struct wl1271 *wl, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changed) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - bool do_join = false; - bool is_ibss = (wlvif->bss_type == BSS_TYPE_IBSS); - bool ibss_joined = false; - u32 sta_rate_set = 0; - int ret; - struct ieee80211_sta *sta; - bool sta_exists = false; - struct ieee80211_sta_ht_cap sta_ht_cap; - - if (is_ibss) { - ret = wl1271_bss_beacon_info_changed(wl, vif, bss_conf, - changed); - if (ret < 0) - goto out; - } - - if (changed & BSS_CHANGED_IBSS) { - if (bss_conf->ibss_joined) { - set_bit(WLVIF_FLAG_IBSS_JOINED, &wlvif->flags); - ibss_joined = true; - } else { - wlcore_unset_assoc(wl, wlvif); - wl12xx_cmd_role_stop_sta(wl, wlvif); - } - } - - if ((changed & BSS_CHANGED_BEACON_INT) && ibss_joined) - do_join = true; - - /* Need to update the SSID (for filtering etc) */ - if ((changed & BSS_CHANGED_BEACON) && ibss_joined) - do_join = true; - - if ((changed & BSS_CHANGED_BEACON_ENABLED) && ibss_joined) { - wl1271_debug(DEBUG_ADHOC, "ad-hoc beaconing: %s", - bss_conf->enable_beacon ? "enabled" : "disabled"); - - do_join = true; - } - - if (changed & BSS_CHANGED_CQM) { - bool enable = false; - if (bss_conf->cqm_rssi_thold) - enable = true; - ret = wl1271_acx_rssi_snr_trigger(wl, wlvif, enable, - bss_conf->cqm_rssi_thold, - bss_conf->cqm_rssi_hyst); - if (ret < 0) - goto out; - wlvif->rssi_thold = bss_conf->cqm_rssi_thold; - } - - if (changed & (BSS_CHANGED_BSSID | BSS_CHANGED_HT | - BSS_CHANGED_ASSOC)) { - rcu_read_lock(); - sta = ieee80211_find_sta(vif, bss_conf->bssid); - if (sta) { - u8 *rx_mask = sta->ht_cap.mcs.rx_mask; - - /* save the supp_rates of the ap */ - sta_rate_set = sta->supp_rates[wlvif->band]; - if (sta->ht_cap.ht_supported) - sta_rate_set |= - (rx_mask[0] << HW_HT_RATES_OFFSET) | - (rx_mask[1] << HW_MIMO_RATES_OFFSET); - sta_ht_cap = sta->ht_cap; - sta_exists = true; - } - - rcu_read_unlock(); - } - - if (changed & BSS_CHANGED_BSSID) { - if (!is_zero_ether_addr(bss_conf->bssid)) { - ret = wlcore_set_bssid(wl, wlvif, bss_conf, - sta_rate_set); - if (ret < 0) - goto out; - - /* Need to update the BSSID (for filtering etc) */ - do_join = true; - } else { - ret = wlcore_clear_bssid(wl, wlvif); - if (ret < 0) - goto out; - } - } - - if (changed & BSS_CHANGED_IBSS) { - wl1271_debug(DEBUG_ADHOC, "ibss_joined: %d", - bss_conf->ibss_joined); - - if (bss_conf->ibss_joined) { - u32 rates = bss_conf->basic_rates; - wlvif->basic_rate_set = - wl1271_tx_enabled_rates_get(wl, rates, - wlvif->band); - wlvif->basic_rate = - wl1271_tx_min_rate_get(wl, - wlvif->basic_rate_set); - - /* by default, use 11b + OFDM rates */ - wlvif->rate_set = CONF_TX_IBSS_DEFAULT_RATES; - ret = wl1271_acx_sta_rate_policies(wl, wlvif); - if (ret < 0) - goto out; - } - } - - ret = wl1271_bss_erp_info_changed(wl, vif, bss_conf, changed); - if (ret < 0) - goto out; - - if (do_join) { - ret = wlcore_join(wl, wlvif); - if (ret < 0) { - wl1271_warning("cmd join failed %d", ret); - goto out; - } - } - - if (changed & BSS_CHANGED_ASSOC) { - if (bss_conf->assoc) { - ret = wlcore_set_assoc(wl, wlvif, bss_conf, - sta_rate_set); - if (ret < 0) - goto out; - - if (test_bit(WLVIF_FLAG_STA_AUTHORIZED, &wlvif->flags)) - wl12xx_set_authorized(wl, wlvif); - } else { - wlcore_unset_assoc(wl, wlvif); - } - } - - if (changed & BSS_CHANGED_PS) { - if ((bss_conf->ps) && - test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) && - !test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags)) { - int ps_mode; - char *ps_mode_str; - - if (wl->conf.conn.forced_ps) { - ps_mode = STATION_POWER_SAVE_MODE; - ps_mode_str = "forced"; - } else { - ps_mode = STATION_AUTO_PS_MODE; - ps_mode_str = "auto"; - } - - wl1271_debug(DEBUG_PSM, "%s ps enabled", ps_mode_str); - - ret = wl1271_ps_set_mode(wl, wlvif, ps_mode); - if (ret < 0) - wl1271_warning("enter %s ps failed %d", - ps_mode_str, ret); - } else if (!bss_conf->ps && - test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags)) { - wl1271_debug(DEBUG_PSM, "auto ps disabled"); - - ret = wl1271_ps_set_mode(wl, wlvif, - STATION_ACTIVE_MODE); - if (ret < 0) - wl1271_warning("exit auto ps failed %d", ret); - } - } - - /* Handle new association with HT. Do this after join. */ - if (sta_exists && - (changed & BSS_CHANGED_HT)) { - bool enabled = - bss_conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT; - - ret = wlcore_hw_set_peer_cap(wl, - &sta_ht_cap, - enabled, - wlvif->rate_set, - wlvif->sta.hlid); - if (ret < 0) { - wl1271_warning("Set ht cap failed %d", ret); - goto out; - - } - - if (enabled) { - ret = wl1271_acx_set_ht_information(wl, wlvif, - bss_conf->ht_operation_mode); - if (ret < 0) { - wl1271_warning("Set ht information failed %d", - ret); - goto out; - } - } - } - - /* Handle arp filtering. Done after join. */ - if ((changed & BSS_CHANGED_ARP_FILTER) || - (!is_ibss && (changed & BSS_CHANGED_QOS))) { - __be32 addr = bss_conf->arp_addr_list[0]; - wlvif->sta.qos = bss_conf->qos; - WARN_ON(wlvif->bss_type != BSS_TYPE_STA_BSS); - - if (bss_conf->arp_addr_cnt == 1 && bss_conf->assoc) { - wlvif->ip_addr = addr; - /* - * The template should have been configured only upon - * association. however, it seems that the correct ip - * isn't being set (when sending), so we have to - * reconfigure the template upon every ip change. - */ - ret = wl1271_cmd_build_arp_rsp(wl, wlvif); - if (ret < 0) { - wl1271_warning("build arp rsp failed: %d", ret); - goto out; - } - - ret = wl1271_acx_arp_ip_filter(wl, wlvif, - (ACX_ARP_FILTER_ARP_FILTERING | - ACX_ARP_FILTER_AUTO_ARP), - addr); - } else { - wlvif->ip_addr = 0; - ret = wl1271_acx_arp_ip_filter(wl, wlvif, 0, addr); - } - - if (ret < 0) - goto out; - } - -out: - return; -} - -static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changed) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); - int ret; - - wl1271_debug(DEBUG_MAC80211, "mac80211 bss info role %d changed 0x%x", - wlvif->role_id, (int)changed); - - /* - * make sure to cancel pending disconnections if our association - * state changed - */ - if (!is_ap && (changed & BSS_CHANGED_ASSOC)) - cancel_delayed_work_sync(&wlvif->connection_loss_work); - - if (is_ap && (changed & BSS_CHANGED_BEACON_ENABLED) && - !bss_conf->enable_beacon) - wl1271_tx_flush(wl); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - if (unlikely(!test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags))) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - if (is_ap) - wl1271_bss_info_changed_ap(wl, vif, bss_conf, changed); - else - wl1271_bss_info_changed_sta(wl, vif, bss_conf, changed); - - wl1271_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); -} - -static int wlcore_op_add_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *ctx) -{ - wl1271_debug(DEBUG_MAC80211, "mac80211 add chanctx %d (type %d)", - ieee80211_frequency_to_channel(ctx->def.chan->center_freq), - cfg80211_get_chandef_type(&ctx->def)); - return 0; -} - -static void wlcore_op_remove_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *ctx) -{ - wl1271_debug(DEBUG_MAC80211, "mac80211 remove chanctx %d (type %d)", - ieee80211_frequency_to_channel(ctx->def.chan->center_freq), - cfg80211_get_chandef_type(&ctx->def)); -} - -static void wlcore_op_change_chanctx(struct ieee80211_hw *hw, - struct ieee80211_chanctx_conf *ctx, - u32 changed) -{ - wl1271_debug(DEBUG_MAC80211, - "mac80211 change chanctx %d (type %d) changed 0x%x", - ieee80211_frequency_to_channel(ctx->def.chan->center_freq), - cfg80211_get_chandef_type(&ctx->def), changed); -} - -static int wlcore_op_assign_vif_chanctx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_chanctx_conf *ctx) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - int channel = ieee80211_frequency_to_channel( - ctx->def.chan->center_freq); - - wl1271_debug(DEBUG_MAC80211, - "mac80211 assign chanctx (role %d) %d (type %d)", - wlvif->role_id, channel, cfg80211_get_chandef_type(&ctx->def)); - - mutex_lock(&wl->mutex); - - wlvif->band = ctx->def.chan->band; - wlvif->channel = channel; - wlvif->channel_type = cfg80211_get_chandef_type(&ctx->def); - - /* update default rates according to the band */ - wl1271_set_band_rate(wl, wlvif); - - mutex_unlock(&wl->mutex); - - return 0; -} - -static void wlcore_op_unassign_vif_chanctx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_chanctx_conf *ctx) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - - wl1271_debug(DEBUG_MAC80211, - "mac80211 unassign chanctx (role %d) %d (type %d)", - wlvif->role_id, - ieee80211_frequency_to_channel(ctx->def.chan->center_freq), - cfg80211_get_chandef_type(&ctx->def)); - - wl1271_tx_flush(wl); -} - -static int wl1271_op_conf_tx(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - u8 ps_scheme; - int ret = 0; - - mutex_lock(&wl->mutex); - - wl1271_debug(DEBUG_MAC80211, "mac80211 conf tx %d", queue); - - if (params->uapsd) - ps_scheme = CONF_PS_SCHEME_UPSD_TRIGGER; - else - ps_scheme = CONF_PS_SCHEME_LEGACY; - - if (!test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - /* - * the txop is confed in units of 32us by the mac80211, - * we need us - */ - ret = wl1271_acx_ac_cfg(wl, wlvif, wl1271_tx_get_queue(queue), - params->cw_min, params->cw_max, - params->aifs, params->txop << 5); - if (ret < 0) - goto out_sleep; - - ret = wl1271_acx_tid_cfg(wl, wlvif, wl1271_tx_get_queue(queue), - CONF_CHANNEL_TYPE_EDCF, - wl1271_tx_get_queue(queue), - ps_scheme, CONF_ACK_POLICY_LEGACY, - 0, 0); - -out_sleep: - wl1271_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -static u64 wl1271_op_get_tsf(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - u64 mactime = ULLONG_MAX; - int ret; - - wl1271_debug(DEBUG_MAC80211, "mac80211 get tsf"); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = wl12xx_acx_tsf_info(wl, wlvif, &mactime); - if (ret < 0) - goto out_sleep; - -out_sleep: - wl1271_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - return mactime; -} - -static int wl1271_op_get_survey(struct ieee80211_hw *hw, int idx, - struct survey_info *survey) -{ - struct ieee80211_conf *conf = &hw->conf; - - if (idx != 0) - return -ENOENT; - - survey->channel = conf->chandef.chan; - survey->filled = 0; - return 0; -} - -static int wl1271_allocate_sta(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct ieee80211_sta *sta) -{ - struct wl1271_station *wl_sta; - int ret; - - - if (wl->active_sta_count >= AP_MAX_STATIONS) { - wl1271_warning("could not allocate HLID - too much stations"); - return -EBUSY; - } - - wl_sta = (struct wl1271_station *)sta->drv_priv; - ret = wl12xx_allocate_link(wl, wlvif, &wl_sta->hlid); - if (ret < 0) { - wl1271_warning("could not allocate HLID - too many links"); - return -EBUSY; - } - - /* use the previous security seq, if this is a recovery/resume */ - wl->links[wl_sta->hlid].total_freed_pkts = wl_sta->total_freed_pkts; - - set_bit(wl_sta->hlid, wlvif->ap.sta_hlid_map); - memcpy(wl->links[wl_sta->hlid].addr, sta->addr, ETH_ALEN); - wl->active_sta_count++; - return 0; -} - -void wl1271_free_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 hlid) -{ - struct wl1271_station *wl_sta; - struct ieee80211_sta *sta; - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - - if (!test_bit(hlid, wlvif->ap.sta_hlid_map)) - return; - - clear_bit(hlid, wlvif->ap.sta_hlid_map); - __clear_bit(hlid, &wl->ap_ps_map); - __clear_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map); - - /* - * save the last used PN in the private part of iee80211_sta, - * in case of recovery/suspend - */ - rcu_read_lock(); - sta = ieee80211_find_sta(vif, wl->links[hlid].addr); - if (sta) { - wl_sta = (void *)sta->drv_priv; - wl_sta->total_freed_pkts = wl->links[hlid].total_freed_pkts; - - /* - * increment the initial seq number on recovery to account for - * transmitted packets that we haven't yet got in the FW status - */ - if (test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) - wl_sta->total_freed_pkts += - WL1271_TX_SQN_POST_RECOVERY_PADDING; - } - rcu_read_unlock(); - - wl12xx_free_link(wl, wlvif, &hlid); - wl->active_sta_count--; - - /* - * rearm the tx watchdog when the last STA is freed - give the FW a - * chance to return STA-buffered packets before complaining. - */ - if (wl->active_sta_count == 0) - wl12xx_rearm_tx_watchdog_locked(wl); -} - -static int wl12xx_sta_add(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct ieee80211_sta *sta) -{ - struct wl1271_station *wl_sta; - int ret = 0; - u8 hlid; - - wl1271_debug(DEBUG_MAC80211, "mac80211 add sta %d", (int)sta->aid); - - ret = wl1271_allocate_sta(wl, wlvif, sta); - if (ret < 0) - return ret; - - wl_sta = (struct wl1271_station *)sta->drv_priv; - hlid = wl_sta->hlid; - - ret = wl12xx_cmd_add_peer(wl, wlvif, sta, hlid); - if (ret < 0) - wl1271_free_sta(wl, wlvif, hlid); - - return ret; -} - -static int wl12xx_sta_remove(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct ieee80211_sta *sta) -{ - struct wl1271_station *wl_sta; - int ret = 0, id; - - wl1271_debug(DEBUG_MAC80211, "mac80211 remove sta %d", (int)sta->aid); - - wl_sta = (struct wl1271_station *)sta->drv_priv; - id = wl_sta->hlid; - if (WARN_ON(!test_bit(id, wlvif->ap.sta_hlid_map))) - return -EINVAL; - - ret = wl12xx_cmd_remove_peer(wl, wl_sta->hlid); - if (ret < 0) - return ret; - - wl1271_free_sta(wl, wlvif, wl_sta->hlid); - return ret; -} - -static void wlcore_roc_if_possible(struct wl1271 *wl, - struct wl12xx_vif *wlvif) -{ - if (find_first_bit(wl->roc_map, - WL12XX_MAX_ROLES) < WL12XX_MAX_ROLES) - return; - - if (WARN_ON(wlvif->role_id == WL12XX_INVALID_ROLE_ID)) - return; - - wl12xx_roc(wl, wlvif, wlvif->role_id, wlvif->band, wlvif->channel); -} - -static void wlcore_update_inconn_sta(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct wl1271_station *wl_sta, - bool in_connection) -{ - if (in_connection) { - if (WARN_ON(wl_sta->in_connection)) - return; - wl_sta->in_connection = true; - if (!wlvif->inconn_count++) - wlcore_roc_if_possible(wl, wlvif); - } else { - if (!wl_sta->in_connection) - return; - - wl_sta->in_connection = false; - wlvif->inconn_count--; - if (WARN_ON(wlvif->inconn_count < 0)) - return; - - if (!wlvif->inconn_count) - if (test_bit(wlvif->role_id, wl->roc_map)) - wl12xx_croc(wl, wlvif->role_id); - } -} - -static int wl12xx_update_sta_state(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct ieee80211_sta *sta, - enum ieee80211_sta_state old_state, - enum ieee80211_sta_state new_state) -{ - struct wl1271_station *wl_sta; - bool is_ap = wlvif->bss_type == BSS_TYPE_AP_BSS; - bool is_sta = wlvif->bss_type == BSS_TYPE_STA_BSS; - int ret; - - wl_sta = (struct wl1271_station *)sta->drv_priv; - - /* Add station (AP mode) */ - if (is_ap && - old_state == IEEE80211_STA_NOTEXIST && - new_state == IEEE80211_STA_NONE) { - ret = wl12xx_sta_add(wl, wlvif, sta); - if (ret) - return ret; - - wlcore_update_inconn_sta(wl, wlvif, wl_sta, true); - } - - /* Remove station (AP mode) */ - if (is_ap && - old_state == IEEE80211_STA_NONE && - new_state == IEEE80211_STA_NOTEXIST) { - /* must not fail */ - wl12xx_sta_remove(wl, wlvif, sta); - - wlcore_update_inconn_sta(wl, wlvif, wl_sta, false); - } - - /* Authorize station (AP mode) */ - if (is_ap && - new_state == IEEE80211_STA_AUTHORIZED) { - ret = wl12xx_cmd_set_peer_state(wl, wlvif, wl_sta->hlid); - if (ret < 0) - return ret; - - ret = wl1271_acx_set_ht_capabilities(wl, &sta->ht_cap, true, - wl_sta->hlid); - if (ret) - return ret; - - wlcore_update_inconn_sta(wl, wlvif, wl_sta, false); - } - - /* Authorize station */ - if (is_sta && - new_state == IEEE80211_STA_AUTHORIZED) { - set_bit(WLVIF_FLAG_STA_AUTHORIZED, &wlvif->flags); - ret = wl12xx_set_authorized(wl, wlvif); - if (ret) - return ret; - } - - if (is_sta && - old_state == IEEE80211_STA_AUTHORIZED && - new_state == IEEE80211_STA_ASSOC) { - clear_bit(WLVIF_FLAG_STA_AUTHORIZED, &wlvif->flags); - clear_bit(WLVIF_FLAG_STA_STATE_SENT, &wlvif->flags); - } - - /* clear ROCs on failure or authorization */ - if (is_sta && - (new_state == IEEE80211_STA_AUTHORIZED || - new_state == IEEE80211_STA_NOTEXIST)) { - if (test_bit(wlvif->role_id, wl->roc_map)) - wl12xx_croc(wl, wlvif->role_id); - } - - if (is_sta && - old_state == IEEE80211_STA_NOTEXIST && - new_state == IEEE80211_STA_NONE) { - if (find_first_bit(wl->roc_map, - WL12XX_MAX_ROLES) >= WL12XX_MAX_ROLES) { - WARN_ON(wlvif->role_id == WL12XX_INVALID_ROLE_ID); - wl12xx_roc(wl, wlvif, wlvif->role_id, - wlvif->band, wlvif->channel); - } - } - return 0; -} - -static int wl12xx_op_sta_state(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - enum ieee80211_sta_state old_state, - enum ieee80211_sta_state new_state) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - int ret; - - wl1271_debug(DEBUG_MAC80211, "mac80211 sta %d state=%d->%d", - sta->aid, old_state, new_state); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) { - ret = -EBUSY; - goto out; - } - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = wl12xx_update_sta_state(wl, wlvif, sta, old_state, new_state); - - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); - if (new_state < old_state) - return 0; - return ret; -} - -static int wl1271_op_ampdu_action(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, u16 tid, u16 *ssn, - u8 buf_size) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - int ret; - u8 hlid, *ba_bitmap; - - wl1271_debug(DEBUG_MAC80211, "mac80211 ampdu action %d tid %d", action, - tid); - - /* sanity check - the fields in FW are only 8bits wide */ - if (WARN_ON(tid > 0xFF)) - return -ENOTSUPP; - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) { - ret = -EAGAIN; - goto out; - } - - if (wlvif->bss_type == BSS_TYPE_STA_BSS) { - hlid = wlvif->sta.hlid; - } else if (wlvif->bss_type == BSS_TYPE_AP_BSS) { - struct wl1271_station *wl_sta; - - wl_sta = (struct wl1271_station *)sta->drv_priv; - hlid = wl_sta->hlid; - } else { - ret = -EINVAL; - goto out; - } - - ba_bitmap = &wl->links[hlid].ba_bitmap; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - wl1271_debug(DEBUG_MAC80211, "mac80211 ampdu: Rx tid %d action %d", - tid, action); - - switch (action) { - case IEEE80211_AMPDU_RX_START: - if (!wlvif->ba_support || !wlvif->ba_allowed) { - ret = -ENOTSUPP; - break; - } - - if (wl->ba_rx_session_count >= wl->ba_rx_session_count_max) { - ret = -EBUSY; - wl1271_error("exceeded max RX BA sessions"); - break; - } - - if (*ba_bitmap & BIT(tid)) { - ret = -EINVAL; - wl1271_error("cannot enable RX BA session on active " - "tid: %d", tid); - break; - } - - ret = wl12xx_acx_set_ba_receiver_session(wl, tid, *ssn, true, - hlid); - if (!ret) { - *ba_bitmap |= BIT(tid); - wl->ba_rx_session_count++; - } - break; - - case IEEE80211_AMPDU_RX_STOP: - if (!(*ba_bitmap & BIT(tid))) { - /* - * this happens on reconfig - so only output a debug - * message for now, and don't fail the function. - */ - wl1271_debug(DEBUG_MAC80211, - "no active RX BA session on tid: %d", - tid); - ret = 0; - break; - } - - ret = wl12xx_acx_set_ba_receiver_session(wl, tid, 0, false, - hlid); - if (!ret) { - *ba_bitmap &= ~BIT(tid); - wl->ba_rx_session_count--; - } - break; - - /* - * The BA initiator session management in FW independently. - * Falling break here on purpose for all TX APDU commands. - */ - case IEEE80211_AMPDU_TX_START: - case IEEE80211_AMPDU_TX_STOP_CONT: - case IEEE80211_AMPDU_TX_STOP_FLUSH: - case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: - case IEEE80211_AMPDU_TX_OPERATIONAL: - ret = -EINVAL; - break; - - default: - wl1271_error("Incorrect ampdu action id=%x\n", action); - ret = -EINVAL; - } - - wl1271_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -static int wl12xx_set_bitrate_mask(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - const struct cfg80211_bitrate_mask *mask) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - struct wl1271 *wl = hw->priv; - int i, ret = 0; - - wl1271_debug(DEBUG_MAC80211, "mac80211 set_bitrate_mask 0x%x 0x%x", - mask->control[NL80211_BAND_2GHZ].legacy, - mask->control[NL80211_BAND_5GHZ].legacy); - - mutex_lock(&wl->mutex); - - for (i = 0; i < WLCORE_NUM_BANDS; i++) - wlvif->bitrate_masks[i] = - wl1271_tx_enabled_rates_get(wl, - mask->control[i].legacy, - i); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - if (wlvif->bss_type == BSS_TYPE_STA_BSS && - !test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) { - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - wl1271_set_band_rate(wl, wlvif); - wlvif->basic_rate = - wl1271_tx_min_rate_get(wl, wlvif->basic_rate_set); - ret = wl1271_acx_sta_rate_policies(wl, wlvif); - - wl1271_ps_elp_sleep(wl); - } -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -static void wl12xx_op_channel_switch(struct ieee80211_hw *hw, - struct ieee80211_channel_switch *ch_switch) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif; - int ret; - - wl1271_debug(DEBUG_MAC80211, "mac80211 channel switch"); - - wl1271_tx_flush(wl); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state == WLCORE_STATE_OFF)) { - wl12xx_for_each_wlvif_sta(wl, wlvif) { - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - ieee80211_chswitch_done(vif, false); - } - goto out; - } else if (unlikely(wl->state != WLCORE_STATE_ON)) { - goto out; - } - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - /* TODO: change mac80211 to pass vif as param */ - wl12xx_for_each_wlvif_sta(wl, wlvif) { - unsigned long delay_usec; - - ret = wl->ops->channel_switch(wl, wlvif, ch_switch); - if (ret) - goto out_sleep; - - set_bit(WLVIF_FLAG_CS_PROGRESS, &wlvif->flags); - - /* indicate failure 5 seconds after channel switch time */ - delay_usec = ieee80211_tu_to_usec(wlvif->beacon_int) * - ch_switch->count; - ieee80211_queue_delayed_work(hw, &wlvif->channel_switch_work, - usecs_to_jiffies(delay_usec) + - msecs_to_jiffies(5000)); - } - -out_sleep: - wl1271_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); -} - -static void wlcore_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) -{ - struct wl1271 *wl = hw->priv; - - wl1271_tx_flush(wl); -} - -static int wlcore_op_remain_on_channel(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_channel *chan, - int duration, - enum ieee80211_roc_type type) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - struct wl1271 *wl = hw->priv; - int channel, ret = 0; - - channel = ieee80211_frequency_to_channel(chan->center_freq); - - wl1271_debug(DEBUG_MAC80211, "mac80211 roc %d (%d)", - channel, wlvif->role_id); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - /* return EBUSY if we can't ROC right now */ - if (WARN_ON(wl->roc_vif || - find_first_bit(wl->roc_map, - WL12XX_MAX_ROLES) < WL12XX_MAX_ROLES)) { - ret = -EBUSY; - goto out; - } - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = wl12xx_start_dev(wl, wlvif, chan->band, channel); - if (ret < 0) - goto out_sleep; - - wl->roc_vif = vif; - ieee80211_queue_delayed_work(hw, &wl->roc_complete_work, - msecs_to_jiffies(duration)); -out_sleep: - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); - return ret; -} - -static int __wlcore_roc_completed(struct wl1271 *wl) -{ - struct wl12xx_vif *wlvif; - int ret; - - /* already completed */ - if (unlikely(!wl->roc_vif)) - return 0; - - wlvif = wl12xx_vif_to_data(wl->roc_vif); - - if (!test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)) - return -EBUSY; - - ret = wl12xx_stop_dev(wl, wlvif); - if (ret < 0) - return ret; - - wl->roc_vif = NULL; - - return 0; -} - -static int wlcore_roc_completed(struct wl1271 *wl) -{ - int ret; - - wl1271_debug(DEBUG_MAC80211, "roc complete"); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) { - ret = -EBUSY; - goto out; - } - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = __wlcore_roc_completed(wl); - - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -static void wlcore_roc_complete_work(struct work_struct *work) -{ - struct delayed_work *dwork; - struct wl1271 *wl; - int ret; - - dwork = container_of(work, struct delayed_work, work); - wl = container_of(dwork, struct wl1271, roc_complete_work); - - ret = wlcore_roc_completed(wl); - if (!ret) - ieee80211_remain_on_channel_expired(wl->hw); -} - -static int wlcore_op_cancel_remain_on_channel(struct ieee80211_hw *hw) -{ - struct wl1271 *wl = hw->priv; - - wl1271_debug(DEBUG_MAC80211, "mac80211 croc"); - - /* TODO: per-vif */ - wl1271_tx_flush(wl); - - /* - * we can't just flush_work here, because it might deadlock - * (as we might get called from the same workqueue) - */ - cancel_delayed_work_sync(&wl->roc_complete_work); - wlcore_roc_completed(wl); - - return 0; -} - -static void wlcore_op_sta_rc_update(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - u32 changed) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - struct wl1271 *wl = hw->priv; - - wlcore_hw_sta_rc_update(wl, wlvif, sta, changed); -} - -static int wlcore_op_get_rssi(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - s8 *rssi_dbm) -{ - struct wl1271 *wl = hw->priv; - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - int ret = 0; - - wl1271_debug(DEBUG_MAC80211, "mac80211 get_rssi"); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out_sleep; - - ret = wlcore_acx_average_rssi(wl, wlvif, rssi_dbm); - if (ret < 0) - goto out_sleep; - -out_sleep: - wl1271_ps_elp_sleep(wl); - -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -static bool wl1271_tx_frames_pending(struct ieee80211_hw *hw) -{ - struct wl1271 *wl = hw->priv; - bool ret = false; - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - /* packets are considered pending if in the TX queue or the FW */ - ret = (wl1271_tx_total_queue_count(wl) > 0) || (wl->tx_frames_cnt > 0); -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -/* can't be const, mac80211 writes to this */ -static struct ieee80211_rate wl1271_rates[] = { - { .bitrate = 10, - .hw_value = CONF_HW_BIT_RATE_1MBPS, - .hw_value_short = CONF_HW_BIT_RATE_1MBPS, }, - { .bitrate = 20, - .hw_value = CONF_HW_BIT_RATE_2MBPS, - .hw_value_short = CONF_HW_BIT_RATE_2MBPS, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 55, - .hw_value = CONF_HW_BIT_RATE_5_5MBPS, - .hw_value_short = CONF_HW_BIT_RATE_5_5MBPS, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 110, - .hw_value = CONF_HW_BIT_RATE_11MBPS, - .hw_value_short = CONF_HW_BIT_RATE_11MBPS, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 60, - .hw_value = CONF_HW_BIT_RATE_6MBPS, - .hw_value_short = CONF_HW_BIT_RATE_6MBPS, }, - { .bitrate = 90, - .hw_value = CONF_HW_BIT_RATE_9MBPS, - .hw_value_short = CONF_HW_BIT_RATE_9MBPS, }, - { .bitrate = 120, - .hw_value = CONF_HW_BIT_RATE_12MBPS, - .hw_value_short = CONF_HW_BIT_RATE_12MBPS, }, - { .bitrate = 180, - .hw_value = CONF_HW_BIT_RATE_18MBPS, - .hw_value_short = CONF_HW_BIT_RATE_18MBPS, }, - { .bitrate = 240, - .hw_value = CONF_HW_BIT_RATE_24MBPS, - .hw_value_short = CONF_HW_BIT_RATE_24MBPS, }, - { .bitrate = 360, - .hw_value = CONF_HW_BIT_RATE_36MBPS, - .hw_value_short = CONF_HW_BIT_RATE_36MBPS, }, - { .bitrate = 480, - .hw_value = CONF_HW_BIT_RATE_48MBPS, - .hw_value_short = CONF_HW_BIT_RATE_48MBPS, }, - { .bitrate = 540, - .hw_value = CONF_HW_BIT_RATE_54MBPS, - .hw_value_short = CONF_HW_BIT_RATE_54MBPS, }, -}; - -/* can't be const, mac80211 writes to this */ -static struct ieee80211_channel wl1271_channels[] = { - { .hw_value = 1, .center_freq = 2412, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 2, .center_freq = 2417, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 3, .center_freq = 2422, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 4, .center_freq = 2427, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 5, .center_freq = 2432, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 6, .center_freq = 2437, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 7, .center_freq = 2442, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 8, .center_freq = 2447, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 9, .center_freq = 2452, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 10, .center_freq = 2457, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 11, .center_freq = 2462, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 12, .center_freq = 2467, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 13, .center_freq = 2472, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 14, .center_freq = 2484, .max_power = WLCORE_MAX_TXPWR }, -}; - -/* can't be const, mac80211 writes to this */ -static struct ieee80211_supported_band wl1271_band_2ghz = { - .channels = wl1271_channels, - .n_channels = ARRAY_SIZE(wl1271_channels), - .bitrates = wl1271_rates, - .n_bitrates = ARRAY_SIZE(wl1271_rates), -}; - -/* 5 GHz data rates for WL1273 */ -static struct ieee80211_rate wl1271_rates_5ghz[] = { - { .bitrate = 60, - .hw_value = CONF_HW_BIT_RATE_6MBPS, - .hw_value_short = CONF_HW_BIT_RATE_6MBPS, }, - { .bitrate = 90, - .hw_value = CONF_HW_BIT_RATE_9MBPS, - .hw_value_short = CONF_HW_BIT_RATE_9MBPS, }, - { .bitrate = 120, - .hw_value = CONF_HW_BIT_RATE_12MBPS, - .hw_value_short = CONF_HW_BIT_RATE_12MBPS, }, - { .bitrate = 180, - .hw_value = CONF_HW_BIT_RATE_18MBPS, - .hw_value_short = CONF_HW_BIT_RATE_18MBPS, }, - { .bitrate = 240, - .hw_value = CONF_HW_BIT_RATE_24MBPS, - .hw_value_short = CONF_HW_BIT_RATE_24MBPS, }, - { .bitrate = 360, - .hw_value = CONF_HW_BIT_RATE_36MBPS, - .hw_value_short = CONF_HW_BIT_RATE_36MBPS, }, - { .bitrate = 480, - .hw_value = CONF_HW_BIT_RATE_48MBPS, - .hw_value_short = CONF_HW_BIT_RATE_48MBPS, }, - { .bitrate = 540, - .hw_value = CONF_HW_BIT_RATE_54MBPS, - .hw_value_short = CONF_HW_BIT_RATE_54MBPS, }, -}; - -/* 5 GHz band channels for WL1273 */ -static struct ieee80211_channel wl1271_channels_5ghz[] = { - { .hw_value = 7, .center_freq = 5035, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 8, .center_freq = 5040, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 9, .center_freq = 5045, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 11, .center_freq = 5055, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 12, .center_freq = 5060, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 16, .center_freq = 5080, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 34, .center_freq = 5170, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 36, .center_freq = 5180, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 38, .center_freq = 5190, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 40, .center_freq = 5200, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 42, .center_freq = 5210, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 44, .center_freq = 5220, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 46, .center_freq = 5230, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 48, .center_freq = 5240, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 52, .center_freq = 5260, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 56, .center_freq = 5280, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 60, .center_freq = 5300, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 64, .center_freq = 5320, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 100, .center_freq = 5500, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 104, .center_freq = 5520, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 108, .center_freq = 5540, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 112, .center_freq = 5560, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 116, .center_freq = 5580, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 120, .center_freq = 5600, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 124, .center_freq = 5620, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 128, .center_freq = 5640, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 132, .center_freq = 5660, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 136, .center_freq = 5680, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 140, .center_freq = 5700, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 149, .center_freq = 5745, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 153, .center_freq = 5765, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 157, .center_freq = 5785, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 161, .center_freq = 5805, .max_power = WLCORE_MAX_TXPWR }, - { .hw_value = 165, .center_freq = 5825, .max_power = WLCORE_MAX_TXPWR }, -}; - -static struct ieee80211_supported_band wl1271_band_5ghz = { - .channels = wl1271_channels_5ghz, - .n_channels = ARRAY_SIZE(wl1271_channels_5ghz), - .bitrates = wl1271_rates_5ghz, - .n_bitrates = ARRAY_SIZE(wl1271_rates_5ghz), -}; - -static const struct ieee80211_ops wl1271_ops = { - .start = wl1271_op_start, - .stop = wlcore_op_stop, - .add_interface = wl1271_op_add_interface, - .remove_interface = wl1271_op_remove_interface, - .change_interface = wl12xx_op_change_interface, -#ifdef CONFIG_PM - .suspend = wl1271_op_suspend, - .resume = wl1271_op_resume, -#endif - .config = wl1271_op_config, - .prepare_multicast = wl1271_op_prepare_multicast, - .configure_filter = wl1271_op_configure_filter, - .tx = wl1271_op_tx, - .set_key = wlcore_op_set_key, - .hw_scan = wl1271_op_hw_scan, - .cancel_hw_scan = wl1271_op_cancel_hw_scan, - .sched_scan_start = wl1271_op_sched_scan_start, - .sched_scan_stop = wl1271_op_sched_scan_stop, - .bss_info_changed = wl1271_op_bss_info_changed, - .set_frag_threshold = wl1271_op_set_frag_threshold, - .set_rts_threshold = wl1271_op_set_rts_threshold, - .conf_tx = wl1271_op_conf_tx, - .get_tsf = wl1271_op_get_tsf, - .get_survey = wl1271_op_get_survey, - .sta_state = wl12xx_op_sta_state, - .ampdu_action = wl1271_op_ampdu_action, - .tx_frames_pending = wl1271_tx_frames_pending, - .set_bitrate_mask = wl12xx_set_bitrate_mask, - .channel_switch = wl12xx_op_channel_switch, - .flush = wlcore_op_flush, - .remain_on_channel = wlcore_op_remain_on_channel, - .cancel_remain_on_channel = wlcore_op_cancel_remain_on_channel, - .add_chanctx = wlcore_op_add_chanctx, - .remove_chanctx = wlcore_op_remove_chanctx, - .change_chanctx = wlcore_op_change_chanctx, - .assign_vif_chanctx = wlcore_op_assign_vif_chanctx, - .unassign_vif_chanctx = wlcore_op_unassign_vif_chanctx, - .sta_rc_update = wlcore_op_sta_rc_update, - .get_rssi = wlcore_op_get_rssi, - CFG80211_TESTMODE_CMD(wl1271_tm_cmd) -}; - - -u8 wlcore_rate_to_idx(struct wl1271 *wl, u8 rate, enum ieee80211_band band) -{ - u8 idx; - - BUG_ON(band >= 2); - - if (unlikely(rate >= wl->hw_tx_rate_tbl_size)) { - wl1271_error("Illegal RX rate from HW: %d", rate); - return 0; - } - - idx = wl->band_rate_to_idx[band][rate]; - if (unlikely(idx == CONF_HW_RXTX_RATE_UNSUPPORTED)) { - wl1271_error("Unsupported RX rate from HW: %d", rate); - return 0; - } - - return idx; -} - -static ssize_t wl1271_sysfs_show_bt_coex_state(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct wl1271 *wl = dev_get_drvdata(dev); - ssize_t len; - - len = PAGE_SIZE; - - mutex_lock(&wl->mutex); - len = snprintf(buf, len, "%d\n\n0 - off\n1 - on\n", - wl->sg_enabled); - mutex_unlock(&wl->mutex); - - return len; - -} - -static ssize_t wl1271_sysfs_store_bt_coex_state(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct wl1271 *wl = dev_get_drvdata(dev); - unsigned long res; - int ret; - - ret = kstrtoul(buf, 10, &res); - if (ret < 0) { - wl1271_warning("incorrect value written to bt_coex_mode"); - return count; - } - - mutex_lock(&wl->mutex); - - res = !!res; - - if (res == wl->sg_enabled) - goto out; - - wl->sg_enabled = res; - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - wl1271_acx_sg_enable(wl, wl->sg_enabled); - wl1271_ps_elp_sleep(wl); - - out: - mutex_unlock(&wl->mutex); - return count; -} - -static DEVICE_ATTR(bt_coex_state, S_IRUGO | S_IWUSR, - wl1271_sysfs_show_bt_coex_state, - wl1271_sysfs_store_bt_coex_state); - -static ssize_t wl1271_sysfs_show_hw_pg_ver(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct wl1271 *wl = dev_get_drvdata(dev); - ssize_t len; - - len = PAGE_SIZE; - - mutex_lock(&wl->mutex); - if (wl->hw_pg_ver >= 0) - len = snprintf(buf, len, "%d\n", wl->hw_pg_ver); - else - len = snprintf(buf, len, "n/a\n"); - mutex_unlock(&wl->mutex); - - return len; -} - -static DEVICE_ATTR(hw_pg_ver, S_IRUGO, - wl1271_sysfs_show_hw_pg_ver, NULL); - -static ssize_t wl1271_sysfs_read_fwlog(struct file *filp, struct kobject *kobj, - struct bin_attribute *bin_attr, - char *buffer, loff_t pos, size_t count) -{ - struct device *dev = container_of(kobj, struct device, kobj); - struct wl1271 *wl = dev_get_drvdata(dev); - ssize_t len; - int ret; - - ret = mutex_lock_interruptible(&wl->mutex); - if (ret < 0) - return -ERESTARTSYS; - - /* Let only one thread read the log at a time, blocking others */ - while (wl->fwlog_size == 0) { - DEFINE_WAIT(wait); - - prepare_to_wait_exclusive(&wl->fwlog_waitq, - &wait, - TASK_INTERRUPTIBLE); - - if (wl->fwlog_size != 0) { - finish_wait(&wl->fwlog_waitq, &wait); - break; - } - - mutex_unlock(&wl->mutex); - - schedule(); - finish_wait(&wl->fwlog_waitq, &wait); - - if (signal_pending(current)) - return -ERESTARTSYS; - - ret = mutex_lock_interruptible(&wl->mutex); - if (ret < 0) - return -ERESTARTSYS; - } - - /* Check if the fwlog is still valid */ - if (wl->fwlog_size < 0) { - mutex_unlock(&wl->mutex); - return 0; - } - - /* Seeking is not supported - old logs are not kept. Disregard pos. */ - len = min(count, (size_t)wl->fwlog_size); - wl->fwlog_size -= len; - memcpy(buffer, wl->fwlog, len); - - /* Make room for new messages */ - memmove(wl->fwlog, wl->fwlog + len, wl->fwlog_size); - - mutex_unlock(&wl->mutex); - - return len; -} - -static struct bin_attribute fwlog_attr = { - .attr = {.name = "fwlog", .mode = S_IRUSR}, - .read = wl1271_sysfs_read_fwlog, -}; - -static void wl12xx_derive_mac_addresses(struct wl1271 *wl, u32 oui, u32 nic) -{ - int i; - - wl1271_debug(DEBUG_PROBE, "base address: oui %06x nic %06x", - oui, nic); - - if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > 0xffffff) - wl1271_warning("NIC part of the MAC address wraps around!"); - - for (i = 0; i < wl->num_mac_addr; i++) { - wl->addresses[i].addr[0] = (u8)(oui >> 16); - wl->addresses[i].addr[1] = (u8)(oui >> 8); - wl->addresses[i].addr[2] = (u8) oui; - wl->addresses[i].addr[3] = (u8)(nic >> 16); - wl->addresses[i].addr[4] = (u8)(nic >> 8); - wl->addresses[i].addr[5] = (u8) nic; - nic++; - } - - /* we may be one address short at the most */ - WARN_ON(wl->num_mac_addr + 1 < WLCORE_NUM_MAC_ADDRESSES); - - /* - * turn on the LAA bit in the first address and use it as - * the last address. - */ - if (wl->num_mac_addr < WLCORE_NUM_MAC_ADDRESSES) { - int idx = WLCORE_NUM_MAC_ADDRESSES - 1; - memcpy(&wl->addresses[idx], &wl->addresses[0], - sizeof(wl->addresses[0])); - /* LAA bit */ - wl->addresses[idx].addr[2] |= BIT(1); - } - - wl->hw->wiphy->n_addresses = WLCORE_NUM_MAC_ADDRESSES; - wl->hw->wiphy->addresses = wl->addresses; -} - -static int wl12xx_get_hw_info(struct wl1271 *wl) -{ - int ret; - - ret = wl12xx_set_power_on(wl); - if (ret < 0) - return ret; - - ret = wlcore_read_reg(wl, REG_CHIP_ID_B, &wl->chip.id); - if (ret < 0) - goto out; - - wl->fuse_oui_addr = 0; - wl->fuse_nic_addr = 0; - - ret = wl->ops->get_pg_ver(wl, &wl->hw_pg_ver); - if (ret < 0) - goto out; - - if (wl->ops->get_mac) - ret = wl->ops->get_mac(wl); - -out: - wl1271_power_off(wl); - return ret; -} - -static int wl1271_register_hw(struct wl1271 *wl) -{ - int ret; - u32 oui_addr = 0, nic_addr = 0; - - if (wl->mac80211_registered) - return 0; - - if (wl->nvs_len >= 12) { - /* NOTE: The wl->nvs->nvs element must be first, in - * order to simplify the casting, we assume it is at - * the beginning of the wl->nvs structure. - */ - u8 *nvs_ptr = (u8 *)wl->nvs; - - oui_addr = - (nvs_ptr[11] << 16) + (nvs_ptr[10] << 8) + nvs_ptr[6]; - nic_addr = - (nvs_ptr[5] << 16) + (nvs_ptr[4] << 8) + nvs_ptr[3]; - } - - /* if the MAC address is zeroed in the NVS derive from fuse */ - if (oui_addr == 0 && nic_addr == 0) { - oui_addr = wl->fuse_oui_addr; - /* fuse has the BD_ADDR, the WLAN addresses are the next two */ - nic_addr = wl->fuse_nic_addr + 1; - } - - wl12xx_derive_mac_addresses(wl, oui_addr, nic_addr); - - ret = ieee80211_register_hw(wl->hw); - if (ret < 0) { - wl1271_error("unable to register mac80211 hw: %d", ret); - goto out; - } - - wl->mac80211_registered = true; - - wl1271_debugfs_init(wl); - - wl1271_notice("loaded"); - -out: - return ret; -} - -static void wl1271_unregister_hw(struct wl1271 *wl) -{ - if (wl->plt) - wl1271_plt_stop(wl); - - ieee80211_unregister_hw(wl->hw); - wl->mac80211_registered = false; - -} - -static const struct ieee80211_iface_limit wlcore_iface_limits[] = { - { - .max = 3, - .types = BIT(NL80211_IFTYPE_STATION), - }, - { - .max = 1, - .types = BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_P2P_GO) | - BIT(NL80211_IFTYPE_P2P_CLIENT), - }, -}; - -static struct ieee80211_iface_combination -wlcore_iface_combinations[] = { - { - .max_interfaces = 3, - .limits = wlcore_iface_limits, - .n_limits = ARRAY_SIZE(wlcore_iface_limits), - }, -}; - -static int wl1271_init_ieee80211(struct wl1271 *wl) -{ - int i; - static const u32 cipher_suites[] = { - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, - WL1271_CIPHER_SUITE_GEM, - }; - - /* The tx descriptor buffer */ - wl->hw->extra_tx_headroom = sizeof(struct wl1271_tx_hw_descr); - - if (wl->quirks & WLCORE_QUIRK_TKIP_HEADER_SPACE) - wl->hw->extra_tx_headroom += WL1271_EXTRA_SPACE_TKIP; - - /* unit us */ - /* FIXME: find a proper value */ - wl->hw->channel_change_time = 10000; - wl->hw->max_listen_interval = wl->conf.conn.max_listen_interval; - - wl->hw->flags = IEEE80211_HW_SIGNAL_DBM | - IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_SUPPORTS_DYNAMIC_PS | - IEEE80211_HW_SUPPORTS_UAPSD | - IEEE80211_HW_HAS_RATE_CONTROL | - IEEE80211_HW_CONNECTION_MONITOR | - IEEE80211_HW_REPORTS_TX_ACK_STATUS | - IEEE80211_HW_SPECTRUM_MGMT | - IEEE80211_HW_AP_LINK_PS | - IEEE80211_HW_AMPDU_AGGREGATION | - IEEE80211_HW_TX_AMPDU_SETUP_IN_HW | - IEEE80211_HW_QUEUE_CONTROL; - - wl->hw->wiphy->cipher_suites = cipher_suites; - wl->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); - - wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO); - wl->hw->wiphy->max_scan_ssids = 1; - wl->hw->wiphy->max_sched_scan_ssids = 16; - wl->hw->wiphy->max_match_sets = 16; - /* - * Maximum length of elements in scanning probe request templates - * should be the maximum length possible for a template, without - * the IEEE80211 header of the template - */ - wl->hw->wiphy->max_scan_ie_len = WL1271_CMD_TEMPL_MAX_SIZE - - sizeof(struct ieee80211_header); - - wl->hw->wiphy->max_sched_scan_ie_len = WL1271_CMD_TEMPL_MAX_SIZE - - sizeof(struct ieee80211_header); - - wl->hw->wiphy->max_remain_on_channel_duration = 5000; - - wl->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD | - WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; - - /* make sure all our channels fit in the scanned_ch bitmask */ - BUILD_BUG_ON(ARRAY_SIZE(wl1271_channels) + - ARRAY_SIZE(wl1271_channels_5ghz) > - WL1271_MAX_CHANNELS); - /* - * clear channel flags from the previous usage - * and restore max_power & max_antenna_gain values. - */ - for (i = 0; i < ARRAY_SIZE(wl1271_channels); i++) { - wl1271_band_2ghz.channels[i].flags = 0; - wl1271_band_2ghz.channels[i].max_power = WLCORE_MAX_TXPWR; - wl1271_band_2ghz.channels[i].max_antenna_gain = 0; - } - - for (i = 0; i < ARRAY_SIZE(wl1271_channels_5ghz); i++) { - wl1271_band_5ghz.channels[i].flags = 0; - wl1271_band_5ghz.channels[i].max_power = WLCORE_MAX_TXPWR; - wl1271_band_5ghz.channels[i].max_antenna_gain = 0; - } - - /* - * We keep local copies of the band structs because we need to - * modify them on a per-device basis. - */ - memcpy(&wl->bands[IEEE80211_BAND_2GHZ], &wl1271_band_2ghz, - sizeof(wl1271_band_2ghz)); - memcpy(&wl->bands[IEEE80211_BAND_2GHZ].ht_cap, - &wl->ht_cap[IEEE80211_BAND_2GHZ], - sizeof(*wl->ht_cap)); - memcpy(&wl->bands[IEEE80211_BAND_5GHZ], &wl1271_band_5ghz, - sizeof(wl1271_band_5ghz)); - memcpy(&wl->bands[IEEE80211_BAND_5GHZ].ht_cap, - &wl->ht_cap[IEEE80211_BAND_5GHZ], - sizeof(*wl->ht_cap)); - - wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = - &wl->bands[IEEE80211_BAND_2GHZ]; - wl->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = - &wl->bands[IEEE80211_BAND_5GHZ]; - - /* - * allow 4 queues per mac address we support + - * 1 cab queue per mac + one global offchannel Tx queue - */ - wl->hw->queues = (NUM_TX_QUEUES + 1) * WLCORE_NUM_MAC_ADDRESSES + 1; - - /* the last queue is the offchannel queue */ - wl->hw->offchannel_tx_hw_queue = wl->hw->queues - 1; - wl->hw->max_rates = 1; - - wl->hw->wiphy->reg_notifier = wl1271_reg_notify; - - /* the FW answers probe-requests in AP-mode */ - wl->hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD; - wl->hw->wiphy->probe_resp_offload = - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS | - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 | - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P; - - /* allowed interface combinations */ - wlcore_iface_combinations[0].num_different_channels = wl->num_channels; - wl->hw->wiphy->iface_combinations = wlcore_iface_combinations; - wl->hw->wiphy->n_iface_combinations = - ARRAY_SIZE(wlcore_iface_combinations); - - SET_IEEE80211_DEV(wl->hw, wl->dev); - - wl->hw->sta_data_size = sizeof(struct wl1271_station); - wl->hw->vif_data_size = sizeof(struct wl12xx_vif); - - wl->hw->max_rx_aggregation_subframes = wl->conf.ht.rx_ba_win_size; - - return 0; -} - -#define WL1271_DEFAULT_CHANNEL 0 - -struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size, - u32 mbox_size) -{ - struct ieee80211_hw *hw; - struct wl1271 *wl; - int i, j, ret; - unsigned int order; - - BUILD_BUG_ON(AP_MAX_STATIONS > WL12XX_MAX_LINKS); - - hw = ieee80211_alloc_hw(sizeof(*wl), &wl1271_ops); - if (!hw) { - wl1271_error("could not alloc ieee80211_hw"); - ret = -ENOMEM; - goto err_hw_alloc; - } - - wl = hw->priv; - memset(wl, 0, sizeof(*wl)); - - wl->priv = kzalloc(priv_size, GFP_KERNEL); - if (!wl->priv) { - wl1271_error("could not alloc wl priv"); - ret = -ENOMEM; - goto err_priv_alloc; - } - - INIT_LIST_HEAD(&wl->wlvif_list); - - wl->hw = hw; - - for (i = 0; i < NUM_TX_QUEUES; i++) - for (j = 0; j < WL12XX_MAX_LINKS; j++) - skb_queue_head_init(&wl->links[j].tx_queue[i]); - - skb_queue_head_init(&wl->deferred_rx_queue); - skb_queue_head_init(&wl->deferred_tx_queue); - - INIT_DELAYED_WORK(&wl->elp_work, wl1271_elp_work); - INIT_WORK(&wl->netstack_work, wl1271_netstack_work); - INIT_WORK(&wl->tx_work, wl1271_tx_work); - INIT_WORK(&wl->recovery_work, wl1271_recovery_work); - INIT_DELAYED_WORK(&wl->scan_complete_work, wl1271_scan_complete_work); - INIT_DELAYED_WORK(&wl->roc_complete_work, wlcore_roc_complete_work); - INIT_DELAYED_WORK(&wl->tx_watchdog_work, wl12xx_tx_watchdog_work); - - wl->freezable_wq = create_freezable_workqueue("wl12xx_wq"); - if (!wl->freezable_wq) { - ret = -ENOMEM; - goto err_hw; - } - - wl->channel = WL1271_DEFAULT_CHANNEL; - wl->rx_counter = 0; - wl->power_level = WL1271_DEFAULT_POWER_LEVEL; - wl->band = IEEE80211_BAND_2GHZ; - wl->channel_type = NL80211_CHAN_NO_HT; - wl->flags = 0; - wl->sg_enabled = true; - wl->sleep_auth = WL1271_PSM_ILLEGAL; - wl->recovery_count = 0; - wl->hw_pg_ver = -1; - wl->ap_ps_map = 0; - wl->ap_fw_ps_map = 0; - wl->quirks = 0; - wl->platform_quirks = 0; - wl->system_hlid = WL12XX_SYSTEM_HLID; - wl->active_sta_count = 0; - wl->active_link_count = 0; - wl->fwlog_size = 0; - init_waitqueue_head(&wl->fwlog_waitq); - - /* The system link is always allocated */ - __set_bit(WL12XX_SYSTEM_HLID, wl->links_map); - - memset(wl->tx_frames_map, 0, sizeof(wl->tx_frames_map)); - for (i = 0; i < wl->num_tx_desc; i++) - wl->tx_frames[i] = NULL; - - spin_lock_init(&wl->wl_lock); - - wl->state = WLCORE_STATE_OFF; - wl->fw_type = WL12XX_FW_TYPE_NONE; - mutex_init(&wl->mutex); - mutex_init(&wl->flush_mutex); - init_completion(&wl->nvs_loading_complete); - - order = get_order(aggr_buf_size); - wl->aggr_buf = (u8 *)__get_free_pages(GFP_KERNEL, order); - if (!wl->aggr_buf) { - ret = -ENOMEM; - goto err_wq; - } - wl->aggr_buf_size = aggr_buf_size; - - wl->dummy_packet = wl12xx_alloc_dummy_packet(wl); - if (!wl->dummy_packet) { - ret = -ENOMEM; - goto err_aggr; - } - - /* Allocate one page for the FW log */ - wl->fwlog = (u8 *)get_zeroed_page(GFP_KERNEL); - if (!wl->fwlog) { - ret = -ENOMEM; - goto err_dummy_packet; - } - - wl->mbox_size = mbox_size; - wl->mbox = kmalloc(wl->mbox_size, GFP_KERNEL | GFP_DMA); - if (!wl->mbox) { - ret = -ENOMEM; - goto err_fwlog; - } - - wl->buffer_32 = kmalloc(sizeof(*wl->buffer_32), GFP_KERNEL); - if (!wl->buffer_32) { - ret = -ENOMEM; - goto err_mbox; - } - - return hw; - -err_mbox: - kfree(wl->mbox); - -err_fwlog: - free_page((unsigned long)wl->fwlog); - -err_dummy_packet: - dev_kfree_skb(wl->dummy_packet); - -err_aggr: - free_pages((unsigned long)wl->aggr_buf, order); - -err_wq: - destroy_workqueue(wl->freezable_wq); - -err_hw: - wl1271_debugfs_exit(wl); - kfree(wl->priv); - -err_priv_alloc: - ieee80211_free_hw(hw); - -err_hw_alloc: - - return ERR_PTR(ret); -} -EXPORT_SYMBOL_GPL(wlcore_alloc_hw); - -int wlcore_free_hw(struct wl1271 *wl) -{ - /* Unblock any fwlog readers */ - mutex_lock(&wl->mutex); - wl->fwlog_size = -1; - wake_up_interruptible_all(&wl->fwlog_waitq); - mutex_unlock(&wl->mutex); - - device_remove_bin_file(wl->dev, &fwlog_attr); - - device_remove_file(wl->dev, &dev_attr_hw_pg_ver); - - device_remove_file(wl->dev, &dev_attr_bt_coex_state); - kfree(wl->buffer_32); - kfree(wl->mbox); - free_page((unsigned long)wl->fwlog); - dev_kfree_skb(wl->dummy_packet); - free_pages((unsigned long)wl->aggr_buf, get_order(wl->aggr_buf_size)); - - wl1271_debugfs_exit(wl); - - vfree(wl->fw); - wl->fw = NULL; - wl->fw_type = WL12XX_FW_TYPE_NONE; - kfree(wl->nvs); - wl->nvs = NULL; - - kfree(wl->fw_status_1); - kfree(wl->tx_res_if); - destroy_workqueue(wl->freezable_wq); - - kfree(wl->priv); - ieee80211_free_hw(wl->hw); - - return 0; -} -EXPORT_SYMBOL_GPL(wlcore_free_hw); - -static void wlcore_nvs_cb(const struct firmware *fw, void *context) -{ - struct wl1271 *wl = context; - struct platform_device *pdev = wl->pdev; - struct wlcore_platdev_data *pdev_data = pdev->dev.platform_data; - struct wl12xx_platform_data *pdata = pdev_data->pdata; - unsigned long irqflags; - int ret; - - if (fw) { - wl->nvs = kmemdup(fw->data, fw->size, GFP_KERNEL); - if (!wl->nvs) { - wl1271_error("Could not allocate nvs data"); - goto out; - } - wl->nvs_len = fw->size; - } else { - wl1271_debug(DEBUG_BOOT, "Could not get nvs file %s", - WL12XX_NVS_NAME); - wl->nvs = NULL; - wl->nvs_len = 0; - } - - ret = wl->ops->setup(wl); - if (ret < 0) - goto out_free_nvs; - - BUG_ON(wl->num_tx_desc > WLCORE_MAX_TX_DESCRIPTORS); - - /* adjust some runtime configuration parameters */ - wlcore_adjust_conf(wl); - - wl->irq = platform_get_irq(pdev, 0); - wl->platform_quirks = pdata->platform_quirks; - wl->if_ops = pdev_data->if_ops; - - if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) - irqflags = IRQF_TRIGGER_RISING; - else - irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT; - - ret = request_threaded_irq(wl->irq, NULL, wlcore_irq, - irqflags, pdev->name, wl); - if (ret < 0) { - wl1271_error("request_irq() failed: %d", ret); - goto out_free_nvs; - } - -#ifdef CONFIG_PM - ret = enable_irq_wake(wl->irq); - if (!ret) { - wl->irq_wake_enabled = true; - device_init_wakeup(wl->dev, 1); - if (pdata->pwr_in_suspend) { - wl->hw->wiphy->wowlan.flags = WIPHY_WOWLAN_ANY; - wl->hw->wiphy->wowlan.n_patterns = - WL1271_MAX_RX_FILTERS; - wl->hw->wiphy->wowlan.pattern_min_len = 1; - wl->hw->wiphy->wowlan.pattern_max_len = - WL1271_RX_FILTER_MAX_PATTERN_SIZE; - } - } -#endif - disable_irq(wl->irq); - - ret = wl12xx_get_hw_info(wl); - if (ret < 0) { - wl1271_error("couldn't get hw info"); - goto out_irq; - } - - ret = wl->ops->identify_chip(wl); - if (ret < 0) - goto out_irq; - - ret = wl1271_init_ieee80211(wl); - if (ret) - goto out_irq; - - ret = wl1271_register_hw(wl); - if (ret) - goto out_irq; - - /* Create sysfs file to control bt coex state */ - ret = device_create_file(wl->dev, &dev_attr_bt_coex_state); - if (ret < 0) { - wl1271_error("failed to create sysfs file bt_coex_state"); - goto out_unreg; - } - - /* Create sysfs file to get HW PG version */ - ret = device_create_file(wl->dev, &dev_attr_hw_pg_ver); - if (ret < 0) { - wl1271_error("failed to create sysfs file hw_pg_ver"); - goto out_bt_coex_state; - } - - /* Create sysfs file for the FW log */ - ret = device_create_bin_file(wl->dev, &fwlog_attr); - if (ret < 0) { - wl1271_error("failed to create sysfs file fwlog"); - goto out_hw_pg_ver; - } - - wl->initialized = true; - goto out; - -out_hw_pg_ver: - device_remove_file(wl->dev, &dev_attr_hw_pg_ver); - -out_bt_coex_state: - device_remove_file(wl->dev, &dev_attr_bt_coex_state); - -out_unreg: - wl1271_unregister_hw(wl); - -out_irq: - free_irq(wl->irq, wl); - -out_free_nvs: - kfree(wl->nvs); - -out: - release_firmware(fw); - complete_all(&wl->nvs_loading_complete); -} - -int wlcore_probe(struct wl1271 *wl, struct platform_device *pdev) -{ - int ret; - - if (!wl->ops || !wl->ptable) - return -EINVAL; - - wl->dev = &pdev->dev; - wl->pdev = pdev; - platform_set_drvdata(pdev, wl); - - ret = request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG, - WL12XX_NVS_NAME, &pdev->dev, GFP_KERNEL, - wl, wlcore_nvs_cb); - if (ret < 0) { - wl1271_error("request_firmware_nowait failed: %d", ret); - complete_all(&wl->nvs_loading_complete); - } - - return ret; -} -EXPORT_SYMBOL_GPL(wlcore_probe); - -int wlcore_remove(struct platform_device *pdev) -{ - struct wl1271 *wl = platform_get_drvdata(pdev); - - wait_for_completion(&wl->nvs_loading_complete); - if (!wl->initialized) - return 0; - - if (wl->irq_wake_enabled) { - device_init_wakeup(wl->dev, 0); - disable_irq_wake(wl->irq); - } - wl1271_unregister_hw(wl); - free_irq(wl->irq, wl); - wlcore_free_hw(wl); - - return 0; -} -EXPORT_SYMBOL_GPL(wlcore_remove); - -u32 wl12xx_debug_level = DEBUG_NONE; -EXPORT_SYMBOL_GPL(wl12xx_debug_level); -module_param_named(debug_level, wl12xx_debug_level, uint, S_IRUSR | S_IWUSR); -MODULE_PARM_DESC(debug_level, "wl12xx debugging level"); - -module_param_named(fwlog, fwlog_param, charp, 0); -MODULE_PARM_DESC(fwlog, - "FW logger options: continuous, ondemand, dbgpins or disable"); - -module_param(bug_on_recovery, int, S_IRUSR | S_IWUSR); -MODULE_PARM_DESC(bug_on_recovery, "BUG() on fw recovery"); - -module_param(no_recovery, int, S_IRUSR | S_IWUSR); -MODULE_PARM_DESC(no_recovery, "Prevent HW recovery. FW will remain stuck."); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Luciano Coelho "); -MODULE_AUTHOR("Juuso Oikarinen "); -MODULE_FIRMWARE(WL12XX_NVS_NAME); diff --git a/drivers/net/wireless/ti/wlcore/ps.c b/drivers/net/wireless/ti/wlcore/ps.c deleted file mode 100644 index 9654577efd01..000000000000 --- a/drivers/net/wireless/ti/wlcore/ps.c +++ /dev/null @@ -1,328 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2008-2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include "ps.h" -#include "io.h" -#include "tx.h" -#include "debug.h" - -#define WL1271_WAKEUP_TIMEOUT 500 - -#define ELP_ENTRY_DELAY 30 -#define ELP_ENTRY_DELAY_FORCE_PS 5 - -void wl1271_elp_work(struct work_struct *work) -{ - struct delayed_work *dwork; - struct wl1271 *wl; - struct wl12xx_vif *wlvif; - int ret; - - dwork = container_of(work, struct delayed_work, work); - wl = container_of(dwork, struct wl1271, elp_work); - - wl1271_debug(DEBUG_PSM, "elp work"); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - /* our work might have been already cancelled */ - if (unlikely(!test_bit(WL1271_FLAG_ELP_REQUESTED, &wl->flags))) - goto out; - - if (test_bit(WL1271_FLAG_IN_ELP, &wl->flags)) - goto out; - - wl12xx_for_each_wlvif(wl, wlvif) { - if (wlvif->bss_type == BSS_TYPE_AP_BSS) - goto out; - - if (!test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags) && - test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags)) - goto out; - } - - wl1271_debug(DEBUG_PSM, "chip to elp"); - ret = wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_SLEEP); - if (ret < 0) { - wl12xx_queue_recovery_work(wl); - goto out; - } - - set_bit(WL1271_FLAG_IN_ELP, &wl->flags); - -out: - mutex_unlock(&wl->mutex); -} - -/* Routines to toggle sleep mode while in ELP */ -void wl1271_ps_elp_sleep(struct wl1271 *wl) -{ - struct wl12xx_vif *wlvif; - u32 timeout; - - if (wl->sleep_auth != WL1271_PSM_ELP) - return; - - /* we shouldn't get consecutive sleep requests */ - if (WARN_ON(test_and_set_bit(WL1271_FLAG_ELP_REQUESTED, &wl->flags))) - return; - - wl12xx_for_each_wlvif(wl, wlvif) { - if (wlvif->bss_type == BSS_TYPE_AP_BSS) - return; - - if (!test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags) && - test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags)) - return; - } - - timeout = wl->conf.conn.forced_ps ? - ELP_ENTRY_DELAY_FORCE_PS : ELP_ENTRY_DELAY; - ieee80211_queue_delayed_work(wl->hw, &wl->elp_work, - msecs_to_jiffies(timeout)); -} - -int wl1271_ps_elp_wakeup(struct wl1271 *wl) -{ - DECLARE_COMPLETION_ONSTACK(compl); - unsigned long flags; - int ret; - u32 start_time = jiffies; - bool pending = false; - - /* - * we might try to wake up even if we didn't go to sleep - * before (e.g. on boot) - */ - if (!test_and_clear_bit(WL1271_FLAG_ELP_REQUESTED, &wl->flags)) - return 0; - - /* don't cancel_sync as it might contend for a mutex and deadlock */ - cancel_delayed_work(&wl->elp_work); - - if (!test_bit(WL1271_FLAG_IN_ELP, &wl->flags)) - return 0; - - wl1271_debug(DEBUG_PSM, "waking up chip from elp"); - - /* - * The spinlock is required here to synchronize both the work and - * the completion variable in one entity. - */ - spin_lock_irqsave(&wl->wl_lock, flags); - if (test_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags)) - pending = true; - else - wl->elp_compl = &compl; - spin_unlock_irqrestore(&wl->wl_lock, flags); - - ret = wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_WAKE_UP); - if (ret < 0) { - wl12xx_queue_recovery_work(wl); - goto err; - } - - if (!pending) { - ret = wait_for_completion_timeout( - &compl, msecs_to_jiffies(WL1271_WAKEUP_TIMEOUT)); - if (ret == 0) { - wl1271_error("ELP wakeup timeout!"); - wl12xx_queue_recovery_work(wl); - ret = -ETIMEDOUT; - goto err; - } - } - - clear_bit(WL1271_FLAG_IN_ELP, &wl->flags); - - wl1271_debug(DEBUG_PSM, "wakeup time: %u ms", - jiffies_to_msecs(jiffies - start_time)); - goto out; - -err: - spin_lock_irqsave(&wl->wl_lock, flags); - wl->elp_compl = NULL; - spin_unlock_irqrestore(&wl->wl_lock, flags); - return ret; - -out: - return 0; -} - -int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif, - enum wl1271_cmd_ps_mode mode) -{ - int ret; - u16 timeout = wl->conf.conn.dynamic_ps_timeout; - - switch (mode) { - case STATION_AUTO_PS_MODE: - case STATION_POWER_SAVE_MODE: - wl1271_debug(DEBUG_PSM, "entering psm (mode=%d,timeout=%u)", - mode, timeout); - - ret = wl1271_acx_wake_up_conditions(wl, wlvif, - wl->conf.conn.wake_up_event, - wl->conf.conn.listen_interval); - if (ret < 0) { - wl1271_error("couldn't set wake up conditions"); - return ret; - } - - ret = wl1271_cmd_ps_mode(wl, wlvif, mode, timeout); - if (ret < 0) - return ret; - - set_bit(WLVIF_FLAG_IN_PS, &wlvif->flags); - - /* - * enable beacon early termination. - * Not relevant for 5GHz and for high rates. - */ - if ((wlvif->band == IEEE80211_BAND_2GHZ) && - (wlvif->basic_rate < CONF_HW_BIT_RATE_9MBPS)) { - ret = wl1271_acx_bet_enable(wl, wlvif, true); - if (ret < 0) - return ret; - } - break; - case STATION_ACTIVE_MODE: - wl1271_debug(DEBUG_PSM, "leaving psm"); - - /* disable beacon early termination */ - if ((wlvif->band == IEEE80211_BAND_2GHZ) && - (wlvif->basic_rate < CONF_HW_BIT_RATE_9MBPS)) { - ret = wl1271_acx_bet_enable(wl, wlvif, false); - if (ret < 0) - return ret; - } - - ret = wl1271_cmd_ps_mode(wl, wlvif, mode, 0); - if (ret < 0) - return ret; - - clear_bit(WLVIF_FLAG_IN_PS, &wlvif->flags); - break; - default: - wl1271_warning("trying to set ps to unsupported mode %d", mode); - ret = -EINVAL; - } - - return ret; -} - -static void wl1271_ps_filter_frames(struct wl1271 *wl, u8 hlid) -{ - int i; - struct sk_buff *skb; - struct ieee80211_tx_info *info; - unsigned long flags; - int filtered[NUM_TX_QUEUES]; - struct wl1271_link *lnk = &wl->links[hlid]; - - /* filter all frames currently in the low level queues for this hlid */ - for (i = 0; i < NUM_TX_QUEUES; i++) { - filtered[i] = 0; - while ((skb = skb_dequeue(&lnk->tx_queue[i]))) { - filtered[i]++; - - if (WARN_ON(wl12xx_is_dummy_packet(wl, skb))) - continue; - - info = IEEE80211_SKB_CB(skb); - info->flags |= IEEE80211_TX_STAT_TX_FILTERED; - info->status.rates[0].idx = -1; - ieee80211_tx_status_ni(wl->hw, skb); - } - } - - spin_lock_irqsave(&wl->wl_lock, flags); - for (i = 0; i < NUM_TX_QUEUES; i++) { - wl->tx_queue_count[i] -= filtered[i]; - if (lnk->wlvif) - lnk->wlvif->tx_queue_count[i] -= filtered[i]; - } - spin_unlock_irqrestore(&wl->wl_lock, flags); - - wl1271_handle_tx_low_watermark(wl); -} - -void wl12xx_ps_link_start(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 hlid, bool clean_queues) -{ - struct ieee80211_sta *sta; - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - - if (test_bit(hlid, &wl->ap_ps_map)) - return; - - wl1271_debug(DEBUG_PSM, "start mac80211 PSM on hlid %d pkts %d " - "clean_queues %d", hlid, wl->links[hlid].allocated_pkts, - clean_queues); - - rcu_read_lock(); - sta = ieee80211_find_sta(vif, wl->links[hlid].addr); - if (!sta) { - wl1271_error("could not find sta %pM for starting ps", - wl->links[hlid].addr); - rcu_read_unlock(); - return; - } - - ieee80211_sta_ps_transition_ni(sta, true); - rcu_read_unlock(); - - /* do we want to filter all frames from this link's queues? */ - if (clean_queues) - wl1271_ps_filter_frames(wl, hlid); - - __set_bit(hlid, &wl->ap_ps_map); -} - -void wl12xx_ps_link_end(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 hlid) -{ - struct ieee80211_sta *sta; - struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); - - if (!test_bit(hlid, &wl->ap_ps_map)) - return; - - wl1271_debug(DEBUG_PSM, "end mac80211 PSM on hlid %d", hlid); - - __clear_bit(hlid, &wl->ap_ps_map); - - rcu_read_lock(); - sta = ieee80211_find_sta(vif, wl->links[hlid].addr); - if (!sta) { - wl1271_error("could not find sta %pM for ending ps", - wl->links[hlid].addr); - goto end; - } - - ieee80211_sta_ps_transition_ni(sta, false); -end: - rcu_read_unlock(); -} diff --git a/drivers/net/wireless/ti/wlcore/ps.h b/drivers/net/wireless/ti/wlcore/ps.h deleted file mode 100644 index de4f9da8ed26..000000000000 --- a/drivers/net/wireless/ti/wlcore/ps.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2008-2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __PS_H__ -#define __PS_H__ - -#include "wlcore.h" -#include "acx.h" - -int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif, - enum wl1271_cmd_ps_mode mode); -void wl1271_ps_elp_sleep(struct wl1271 *wl); -int wl1271_ps_elp_wakeup(struct wl1271 *wl); -void wl1271_elp_work(struct work_struct *work); -void wl12xx_ps_link_start(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 hlid, bool clean_queues); -void wl12xx_ps_link_end(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 hlid); - -#define WL1271_PS_COMPLETE_TIMEOUT 500 - -#endif /* __WL1271_PS_H__ */ diff --git a/drivers/net/wireless/ti/wlcore/rx.c b/drivers/net/wireless/ti/wlcore/rx.c deleted file mode 100644 index 6791a1a6afba..000000000000 --- a/drivers/net/wireless/ti/wlcore/rx.c +++ /dev/null @@ -1,339 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include - -#include "wlcore.h" -#include "debug.h" -#include "acx.h" -#include "rx.h" -#include "tx.h" -#include "io.h" -#include "hw_ops.h" - -/* - * TODO: this is here just for now, it must be removed when the data - * operations are in place. - */ -#include "../wl12xx/reg.h" - -static u32 wlcore_rx_get_buf_size(struct wl1271 *wl, - u32 rx_pkt_desc) -{ - if (wl->quirks & WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN) - return (rx_pkt_desc & ALIGNED_RX_BUF_SIZE_MASK) >> - ALIGNED_RX_BUF_SIZE_SHIFT; - - return (rx_pkt_desc & RX_BUF_SIZE_MASK) >> RX_BUF_SIZE_SHIFT_DIV; -} - -static u32 wlcore_rx_get_align_buf_size(struct wl1271 *wl, u32 pkt_len) -{ - if (wl->quirks & WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN) - return ALIGN(pkt_len, WL12XX_BUS_BLOCK_SIZE); - - return pkt_len; -} - -static void wl1271_rx_status(struct wl1271 *wl, - struct wl1271_rx_descriptor *desc, - struct ieee80211_rx_status *status, - u8 beacon) -{ - memset(status, 0, sizeof(struct ieee80211_rx_status)); - - if ((desc->flags & WL1271_RX_DESC_BAND_MASK) == WL1271_RX_DESC_BAND_BG) - status->band = IEEE80211_BAND_2GHZ; - else - status->band = IEEE80211_BAND_5GHZ; - - status->rate_idx = wlcore_rate_to_idx(wl, desc->rate, status->band); - - /* 11n support */ - if (desc->rate <= wl->hw_min_ht_rate) - status->flag |= RX_FLAG_HT; - - status->signal = desc->rssi; - - /* - * FIXME: In wl1251, the SNR should be divided by two. In wl1271 we - * need to divide by two for now, but TI has been discussing about - * changing it. This needs to be rechecked. - */ - wl->noise = desc->rssi - (desc->snr >> 1); - - status->freq = ieee80211_channel_to_frequency(desc->channel, - status->band); - - if (desc->flags & WL1271_RX_DESC_ENCRYPT_MASK) { - u8 desc_err_code = desc->status & WL1271_RX_DESC_STATUS_MASK; - - status->flag |= RX_FLAG_IV_STRIPPED | RX_FLAG_MMIC_STRIPPED | - RX_FLAG_DECRYPTED; - - if (unlikely(desc_err_code & WL1271_RX_DESC_MIC_FAIL)) { - status->flag |= RX_FLAG_MMIC_ERROR; - wl1271_warning("Michael MIC error. Desc: 0x%x", - desc_err_code); - } - } - - if (beacon) - wlcore_set_pending_regdomain_ch(wl, (u16)desc->channel, - status->band); -} - -static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length, - enum wl_rx_buf_align rx_align, u8 *hlid) -{ - struct wl1271_rx_descriptor *desc; - struct sk_buff *skb; - struct ieee80211_hdr *hdr; - u8 *buf; - u8 beacon = 0; - u8 is_data = 0; - u8 reserved = 0, offset_to_data = 0; - u16 seq_num; - u32 pkt_data_len; - - /* - * In PLT mode we seem to get frames and mac80211 warns about them, - * workaround this by not retrieving them at all. - */ - if (unlikely(wl->plt)) - return -EINVAL; - - pkt_data_len = wlcore_hw_get_rx_packet_len(wl, data, length); - if (!pkt_data_len) { - wl1271_error("Invalid packet arrived from HW. length %d", - length); - return -EINVAL; - } - - if (rx_align == WLCORE_RX_BUF_UNALIGNED) - reserved = RX_BUF_ALIGN; - else if (rx_align == WLCORE_RX_BUF_PADDED) - offset_to_data = RX_BUF_ALIGN; - - /* the data read starts with the descriptor */ - desc = (struct wl1271_rx_descriptor *) data; - - if (desc->packet_class == WL12XX_RX_CLASS_LOGGER) { - size_t len = length - sizeof(*desc); - wl12xx_copy_fwlog(wl, data + sizeof(*desc), len); - wake_up_interruptible(&wl->fwlog_waitq); - return 0; - } - - /* discard corrupted packets */ - if (desc->status & WL1271_RX_DESC_DECRYPT_FAIL) { - hdr = (void *)(data + sizeof(*desc) + offset_to_data); - wl1271_warning("corrupted packet in RX: status: 0x%x len: %d", - desc->status & WL1271_RX_DESC_STATUS_MASK, - pkt_data_len); - wl1271_dump((DEBUG_RX|DEBUG_CMD), "PKT: ", data + sizeof(*desc), - min(pkt_data_len, - ieee80211_hdrlen(hdr->frame_control))); - return -EINVAL; - } - - /* skb length not including rx descriptor */ - skb = __dev_alloc_skb(pkt_data_len + reserved, GFP_KERNEL); - if (!skb) { - wl1271_error("Couldn't allocate RX frame"); - return -ENOMEM; - } - - /* reserve the unaligned payload(if any) */ - skb_reserve(skb, reserved); - - buf = skb_put(skb, pkt_data_len); - - /* - * Copy packets from aggregation buffer to the skbs without rx - * descriptor and with packet payload aligned care. In case of unaligned - * packets copy the packets in offset of 2 bytes guarantee IP header - * payload aligned to 4 bytes. - */ - memcpy(buf, data + sizeof(*desc), pkt_data_len); - if (rx_align == WLCORE_RX_BUF_PADDED) - skb_pull(skb, RX_BUF_ALIGN); - - *hlid = desc->hlid; - - hdr = (struct ieee80211_hdr *)skb->data; - if (ieee80211_is_beacon(hdr->frame_control)) - beacon = 1; - if (ieee80211_is_data_present(hdr->frame_control)) - is_data = 1; - - wl1271_rx_status(wl, desc, IEEE80211_SKB_RXCB(skb), beacon); - wlcore_hw_set_rx_csum(wl, desc, skb); - - seq_num = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4; - wl1271_debug(DEBUG_RX, "rx skb 0x%p: %d B %s seq %d hlid %d", skb, - skb->len - desc->pad_len, - beacon ? "beacon" : "", - seq_num, *hlid); - - skb_queue_tail(&wl->deferred_rx_queue, skb); - queue_work(wl->freezable_wq, &wl->netstack_work); - - return is_data; -} - -int wlcore_rx(struct wl1271 *wl, struct wl_fw_status_1 *status) -{ - unsigned long active_hlids[BITS_TO_LONGS(WL12XX_MAX_LINKS)] = {0}; - u32 buf_size; - u32 fw_rx_counter = status->fw_rx_counter % wl->num_rx_desc; - u32 drv_rx_counter = wl->rx_counter % wl->num_rx_desc; - u32 rx_counter; - u32 pkt_len, align_pkt_len; - u32 pkt_offset, des; - u8 hlid; - enum wl_rx_buf_align rx_align; - int ret = 0; - - while (drv_rx_counter != fw_rx_counter) { - buf_size = 0; - rx_counter = drv_rx_counter; - while (rx_counter != fw_rx_counter) { - des = le32_to_cpu(status->rx_pkt_descs[rx_counter]); - pkt_len = wlcore_rx_get_buf_size(wl, des); - align_pkt_len = wlcore_rx_get_align_buf_size(wl, - pkt_len); - if (buf_size + align_pkt_len > wl->aggr_buf_size) - break; - buf_size += align_pkt_len; - rx_counter++; - rx_counter %= wl->num_rx_desc; - } - - if (buf_size == 0) { - wl1271_warning("received empty data"); - break; - } - - /* Read all available packets at once */ - des = le32_to_cpu(status->rx_pkt_descs[drv_rx_counter]); - ret = wlcore_hw_prepare_read(wl, des, buf_size); - if (ret < 0) - goto out; - - ret = wlcore_read_data(wl, REG_SLV_MEM_DATA, wl->aggr_buf, - buf_size, true); - if (ret < 0) - goto out; - - /* Split data into separate packets */ - pkt_offset = 0; - while (pkt_offset < buf_size) { - des = le32_to_cpu(status->rx_pkt_descs[drv_rx_counter]); - pkt_len = wlcore_rx_get_buf_size(wl, des); - rx_align = wlcore_hw_get_rx_buf_align(wl, des); - - /* - * the handle data call can only fail in memory-outage - * conditions, in that case the received frame will just - * be dropped. - */ - if (wl1271_rx_handle_data(wl, - wl->aggr_buf + pkt_offset, - pkt_len, rx_align, - &hlid) == 1) { - if (hlid < WL12XX_MAX_LINKS) - __set_bit(hlid, active_hlids); - else - WARN(1, - "hlid exceeded WL12XX_MAX_LINKS " - "(%d)\n", hlid); - } - - wl->rx_counter++; - drv_rx_counter++; - drv_rx_counter %= wl->num_rx_desc; - pkt_offset += wlcore_rx_get_align_buf_size(wl, pkt_len); - } - } - - /* - * Write the driver's packet counter to the FW. This is only required - * for older hardware revisions - */ - if (wl->quirks & WLCORE_QUIRK_END_OF_TRANSACTION) { - ret = wlcore_write32(wl, WL12XX_REG_RX_DRIVER_COUNTER, - wl->rx_counter); - if (ret < 0) - goto out; - } - - wl12xx_rearm_rx_streaming(wl, active_hlids); - -out: - return ret; -} - -#ifdef CONFIG_PM -int wl1271_rx_filter_enable(struct wl1271 *wl, - int index, bool enable, - struct wl12xx_rx_filter *filter) -{ - int ret; - - if (wl->rx_filter_enabled[index] == enable) { - wl1271_warning("Request to enable an already " - "enabled rx filter %d", index); - return 0; - } - - ret = wl1271_acx_set_rx_filter(wl, index, enable, filter); - - if (ret) { - wl1271_error("Failed to %s rx data filter %d (err=%d)", - enable ? "enable" : "disable", index, ret); - return ret; - } - - wl->rx_filter_enabled[index] = enable; - - return 0; -} - -int wl1271_rx_filter_clear_all(struct wl1271 *wl) -{ - int i, ret = 0; - - for (i = 0; i < WL1271_MAX_RX_FILTERS; i++) { - if (!wl->rx_filter_enabled[i]) - continue; - ret = wl1271_rx_filter_enable(wl, i, 0, NULL); - if (ret) - goto out; - } - -out: - return ret; -} -#endif /* CONFIG_PM */ diff --git a/drivers/net/wireless/ti/wlcore/rx.h b/drivers/net/wireless/ti/wlcore/rx.h deleted file mode 100644 index 3363f60fb7da..000000000000 --- a/drivers/net/wireless/ti/wlcore/rx.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 1998-2009 Texas Instruments. All rights reserved. - * Copyright (C) 2008-2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __RX_H__ -#define __RX_H__ - -#include - -#define WL1271_RX_MAX_RSSI -30 -#define WL1271_RX_MIN_RSSI -95 - -#define SHORT_PREAMBLE_BIT BIT(0) -#define OFDM_RATE_BIT BIT(6) -#define PBCC_RATE_BIT BIT(7) - -#define PLCP_HEADER_LENGTH 8 -#define RX_DESC_PACKETID_SHIFT 11 -#define RX_MAX_PACKET_ID 3 - -#define RX_DESC_VALID_FCS 0x0001 -#define RX_DESC_MATCH_RXADDR1 0x0002 -#define RX_DESC_MCAST 0x0004 -#define RX_DESC_STAINTIM 0x0008 -#define RX_DESC_VIRTUAL_BM 0x0010 -#define RX_DESC_BCAST 0x0020 -#define RX_DESC_MATCH_SSID 0x0040 -#define RX_DESC_MATCH_BSSID 0x0080 -#define RX_DESC_ENCRYPTION_MASK 0x0300 -#define RX_DESC_MEASURMENT 0x0400 -#define RX_DESC_SEQNUM_MASK 0x1800 -#define RX_DESC_MIC_FAIL 0x2000 -#define RX_DESC_DECRYPT_FAIL 0x4000 - -/* - * RX Descriptor flags: - * - * Bits 0-1 - band - * Bit 2 - STBC - * Bit 3 - A-MPDU - * Bit 4 - HT - * Bits 5-7 - encryption - */ -#define WL1271_RX_DESC_BAND_MASK 0x03 -#define WL1271_RX_DESC_ENCRYPT_MASK 0xE0 - -#define WL1271_RX_DESC_BAND_BG 0x00 -#define WL1271_RX_DESC_BAND_J 0x01 -#define WL1271_RX_DESC_BAND_A 0x02 - -#define WL1271_RX_DESC_STBC BIT(2) -#define WL1271_RX_DESC_A_MPDU BIT(3) -#define WL1271_RX_DESC_HT BIT(4) - -#define WL1271_RX_DESC_ENCRYPT_WEP 0x20 -#define WL1271_RX_DESC_ENCRYPT_TKIP 0x40 -#define WL1271_RX_DESC_ENCRYPT_AES 0x60 -#define WL1271_RX_DESC_ENCRYPT_GEM 0x80 - -/* - * RX Descriptor status - * - * Bits 0-2 - error code - * Bits 3-5 - process_id tag (AP mode FW) - * Bits 6-7 - reserved - */ -#define WL1271_RX_DESC_STATUS_MASK 0x07 - -#define WL1271_RX_DESC_SUCCESS 0x00 -#define WL1271_RX_DESC_DECRYPT_FAIL 0x01 -#define WL1271_RX_DESC_MIC_FAIL 0x02 - -#define RX_MEM_BLOCK_MASK 0xFF -#define RX_BUF_SIZE_MASK 0xFFF00 -#define RX_BUF_SIZE_SHIFT_DIV 6 -#define ALIGNED_RX_BUF_SIZE_MASK 0xFFFF00 -#define ALIGNED_RX_BUF_SIZE_SHIFT 8 - -/* If set, the start of IP payload is not 4 bytes aligned */ -#define RX_BUF_UNALIGNED_PAYLOAD BIT(20) - -/* If set, the buffer was padded by the FW to be 4 bytes aligned */ -#define RX_BUF_PADDED_PAYLOAD BIT(30) - -/* - * Account for the padding inserted by the FW in case of RX_ALIGNMENT - * or for fixing alignment in case the packet wasn't aligned. - */ -#define RX_BUF_ALIGN 2 - -/* Describes the alignment state of a Rx buffer */ -enum wl_rx_buf_align { - WLCORE_RX_BUF_ALIGNED, - WLCORE_RX_BUF_UNALIGNED, - WLCORE_RX_BUF_PADDED, -}; - -enum { - WL12XX_RX_CLASS_UNKNOWN, - WL12XX_RX_CLASS_MANAGEMENT, - WL12XX_RX_CLASS_DATA, - WL12XX_RX_CLASS_QOS_DATA, - WL12XX_RX_CLASS_BCN_PRBRSP, - WL12XX_RX_CLASS_EAPOL, - WL12XX_RX_CLASS_BA_EVENT, - WL12XX_RX_CLASS_AMSDU, - WL12XX_RX_CLASS_LOGGER, -}; - -struct wl1271_rx_descriptor { - __le16 length; - u8 status; - u8 flags; - u8 rate; - u8 channel; - s8 rssi; - u8 snr; - __le32 timestamp; - u8 packet_class; - u8 hlid; - u8 pad_len; - u8 reserved; -} __packed; - -int wlcore_rx(struct wl1271 *wl, struct wl_fw_status_1 *status); -u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band); -int wl1271_rx_filter_enable(struct wl1271 *wl, - int index, bool enable, - struct wl12xx_rx_filter *filter); -int wl1271_rx_filter_clear_all(struct wl1271 *wl); - -#endif diff --git a/drivers/net/wireless/ti/wlcore/scan.c b/drivers/net/wireless/ti/wlcore/scan.c deleted file mode 100644 index f407101e525b..000000000000 --- a/drivers/net/wireless/ti/wlcore/scan.c +++ /dev/null @@ -1,469 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2009-2010 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include - -#include "wlcore.h" -#include "debug.h" -#include "cmd.h" -#include "scan.h" -#include "acx.h" -#include "ps.h" -#include "tx.h" - -void wl1271_scan_complete_work(struct work_struct *work) -{ - struct delayed_work *dwork; - struct wl1271 *wl; - struct wl12xx_vif *wlvif; - int ret; - - dwork = container_of(work, struct delayed_work, work); - wl = container_of(dwork, struct wl1271, scan_complete_work); - - wl1271_debug(DEBUG_SCAN, "Scanning complete"); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) - goto out; - - if (wl->scan.state == WL1271_SCAN_STATE_IDLE) - goto out; - - wlvif = wl->scan_wlvif; - - /* - * Rearm the tx watchdog just before idling scan. This - * prevents just-finished scans from triggering the watchdog - */ - wl12xx_rearm_tx_watchdog_locked(wl); - - wl->scan.state = WL1271_SCAN_STATE_IDLE; - memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch)); - wl->scan.req = NULL; - wl->scan_wlvif = NULL; - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags)) { - /* restore hardware connection monitoring template */ - wl1271_cmd_build_ap_probe_req(wl, wlvif, wlvif->probereq); - } - - wl1271_ps_elp_sleep(wl); - - if (wl->scan.failed) { - wl1271_info("Scan completed due to error."); - wl12xx_queue_recovery_work(wl); - } - - wlcore_cmd_regdomain_config_locked(wl); - - ieee80211_scan_completed(wl->hw, false); - -out: - mutex_unlock(&wl->mutex); - -} - -static void wlcore_started_vifs_iter(void *data, u8 *mac, - struct ieee80211_vif *vif) -{ - int *count = (int *)data; - - if (!vif->bss_conf.idle) - (*count)++; -} - -static int wlcore_count_started_vifs(struct wl1271 *wl) -{ - int count = 0; - - ieee80211_iterate_active_interfaces_atomic(wl->hw, - IEEE80211_IFACE_ITER_RESUME_ALL, - wlcore_started_vifs_iter, &count); - return count; -} - -static int -wlcore_scan_get_channels(struct wl1271 *wl, - struct ieee80211_channel *req_channels[], - u32 n_channels, - u32 n_ssids, - struct conn_scan_ch_params *channels, - u32 band, bool radar, bool passive, - int start, int max_channels, - u8 *n_pactive_ch, - int scan_type) -{ - int i, j; - u32 flags; - bool force_passive = !n_ssids; - u32 min_dwell_time_active, max_dwell_time_active; - u32 dwell_time_passive, dwell_time_dfs; - - /* configure dwell times according to scan type */ - if (scan_type == SCAN_TYPE_SEARCH) { - struct conf_scan_settings *c = &wl->conf.scan; - bool active_vif_exists = !!wlcore_count_started_vifs(wl); - - min_dwell_time_active = active_vif_exists ? - c->min_dwell_time_active : - c->min_dwell_time_active_long; - max_dwell_time_active = active_vif_exists ? - c->max_dwell_time_active : - c->max_dwell_time_active_long; - dwell_time_passive = c->dwell_time_passive; - dwell_time_dfs = c->dwell_time_dfs; - } else { - struct conf_sched_scan_settings *c = &wl->conf.sched_scan; - u32 delta_per_probe; - - if (band == IEEE80211_BAND_5GHZ) - delta_per_probe = c->dwell_time_delta_per_probe_5; - else - delta_per_probe = c->dwell_time_delta_per_probe; - - min_dwell_time_active = c->base_dwell_time + - n_ssids * c->num_probe_reqs * delta_per_probe; - - max_dwell_time_active = min_dwell_time_active + - c->max_dwell_time_delta; - dwell_time_passive = c->dwell_time_passive; - dwell_time_dfs = c->dwell_time_dfs; - } - min_dwell_time_active = DIV_ROUND_UP(min_dwell_time_active, 1000); - max_dwell_time_active = DIV_ROUND_UP(max_dwell_time_active, 1000); - dwell_time_passive = DIV_ROUND_UP(dwell_time_passive, 1000); - dwell_time_dfs = DIV_ROUND_UP(dwell_time_dfs, 1000); - - for (i = 0, j = start; - i < n_channels && j < max_channels; - i++) { - flags = req_channels[i]->flags; - - if (force_passive) - flags |= IEEE80211_CHAN_PASSIVE_SCAN; - - if ((req_channels[i]->band == band) && - !(flags & IEEE80211_CHAN_DISABLED) && - (!!(flags & IEEE80211_CHAN_RADAR) == radar) && - /* if radar is set, we ignore the passive flag */ - (radar || - !!(flags & IEEE80211_CHAN_PASSIVE_SCAN) == passive)) { - wl1271_debug(DEBUG_SCAN, "band %d, center_freq %d ", - req_channels[i]->band, - req_channels[i]->center_freq); - wl1271_debug(DEBUG_SCAN, "hw_value %d, flags %X", - req_channels[i]->hw_value, - req_channels[i]->flags); - wl1271_debug(DEBUG_SCAN, "max_power %d", - req_channels[i]->max_power); - wl1271_debug(DEBUG_SCAN, "min_dwell_time %d max dwell time %d", - min_dwell_time_active, - max_dwell_time_active); - - if (flags & IEEE80211_CHAN_RADAR) { - channels[j].flags |= SCAN_CHANNEL_FLAGS_DFS; - - channels[j].passive_duration = - cpu_to_le16(dwell_time_dfs); - } else { - channels[j].passive_duration = - cpu_to_le16(dwell_time_passive); - } - - channels[j].min_duration = - cpu_to_le16(min_dwell_time_active); - channels[j].max_duration = - cpu_to_le16(max_dwell_time_active); - - channels[j].tx_power_att = req_channels[i]->max_power; - channels[j].channel = req_channels[i]->hw_value; - - if (n_pactive_ch && - (band == IEEE80211_BAND_2GHZ) && - (channels[j].channel >= 12) && - (channels[j].channel <= 14) && - (flags & IEEE80211_CHAN_PASSIVE_SCAN) && - !force_passive) { - /* pactive channels treated as DFS */ - channels[j].flags = SCAN_CHANNEL_FLAGS_DFS; - - /* - * n_pactive_ch is counted down from the end of - * the passive channel list - */ - (*n_pactive_ch)++; - wl1271_debug(DEBUG_SCAN, "n_pactive_ch = %d", - *n_pactive_ch); - } - - j++; - } - } - - return j - start; -} - -bool -wlcore_set_scan_chan_params(struct wl1271 *wl, - struct wlcore_scan_channels *cfg, - struct ieee80211_channel *channels[], - u32 n_channels, - u32 n_ssids, - int scan_type) -{ - u8 n_pactive_ch = 0; - - cfg->passive[0] = - wlcore_scan_get_channels(wl, - channels, - n_channels, - n_ssids, - cfg->channels_2, - IEEE80211_BAND_2GHZ, - false, true, 0, - MAX_CHANNELS_2GHZ, - &n_pactive_ch, - scan_type); - cfg->active[0] = - wlcore_scan_get_channels(wl, - channels, - n_channels, - n_ssids, - cfg->channels_2, - IEEE80211_BAND_2GHZ, - false, false, - cfg->passive[0], - MAX_CHANNELS_2GHZ, - &n_pactive_ch, - scan_type); - cfg->passive[1] = - wlcore_scan_get_channels(wl, - channels, - n_channels, - n_ssids, - cfg->channels_5, - IEEE80211_BAND_5GHZ, - false, true, 0, - wl->max_channels_5, - &n_pactive_ch, - scan_type); - cfg->dfs = - wlcore_scan_get_channels(wl, - channels, - n_channels, - n_ssids, - cfg->channels_5, - IEEE80211_BAND_5GHZ, - true, true, - cfg->passive[1], - wl->max_channels_5, - &n_pactive_ch, - scan_type); - cfg->active[1] = - wlcore_scan_get_channels(wl, - channels, - n_channels, - n_ssids, - cfg->channels_5, - IEEE80211_BAND_5GHZ, - false, false, - cfg->passive[1] + cfg->dfs, - wl->max_channels_5, - &n_pactive_ch, - scan_type); - - /* 802.11j channels are not supported yet */ - cfg->passive[2] = 0; - cfg->active[2] = 0; - - cfg->passive_active = n_pactive_ch; - - wl1271_debug(DEBUG_SCAN, " 2.4GHz: active %d passive %d", - cfg->active[0], cfg->passive[0]); - wl1271_debug(DEBUG_SCAN, " 5GHz: active %d passive %d", - cfg->active[1], cfg->passive[1]); - wl1271_debug(DEBUG_SCAN, " DFS: %d", cfg->dfs); - - return cfg->passive[0] || cfg->active[0] || - cfg->passive[1] || cfg->active[1] || cfg->dfs || - cfg->passive[2] || cfg->active[2]; -} -EXPORT_SYMBOL_GPL(wlcore_set_scan_chan_params); - -int wlcore_scan(struct wl1271 *wl, struct ieee80211_vif *vif, - const u8 *ssid, size_t ssid_len, - struct cfg80211_scan_request *req) -{ - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); - - /* - * cfg80211 should guarantee that we don't get more channels - * than what we have registered. - */ - BUG_ON(req->n_channels > WL1271_MAX_CHANNELS); - - if (wl->scan.state != WL1271_SCAN_STATE_IDLE) - return -EBUSY; - - wl->scan.state = WL1271_SCAN_STATE_2GHZ_ACTIVE; - - if (ssid_len && ssid) { - wl->scan.ssid_len = ssid_len; - memcpy(wl->scan.ssid, ssid, ssid_len); - } else { - wl->scan.ssid_len = 0; - } - - wl->scan_wlvif = wlvif; - wl->scan.req = req; - memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch)); - - /* we assume failure so that timeout scenarios are handled correctly */ - wl->scan.failed = true; - ieee80211_queue_delayed_work(wl->hw, &wl->scan_complete_work, - msecs_to_jiffies(WL1271_SCAN_TIMEOUT)); - - wl->ops->scan_start(wl, wlvif, req); - - return 0; -} -/* Returns the scan type to be used or a negative value on error */ -int -wlcore_scan_sched_scan_ssid_list(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct cfg80211_sched_scan_request *req) -{ - struct wl1271_cmd_sched_scan_ssid_list *cmd = NULL; - struct cfg80211_match_set *sets = req->match_sets; - struct cfg80211_ssid *ssids = req->ssids; - int ret = 0, type, i, j, n_match_ssids = 0; - - wl1271_debug(DEBUG_CMD, "cmd sched scan ssid list"); - - /* count the match sets that contain SSIDs */ - for (i = 0; i < req->n_match_sets; i++) - if (sets[i].ssid.ssid_len > 0) - n_match_ssids++; - - /* No filter, no ssids or only bcast ssid */ - if (!n_match_ssids && - (!req->n_ssids || - (req->n_ssids == 1 && req->ssids[0].ssid_len == 0))) { - type = SCAN_SSID_FILTER_ANY; - goto out; - } - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out; - } - - cmd->role_id = wlvif->role_id; - if (!n_match_ssids) { - /* No filter, with ssids */ - type = SCAN_SSID_FILTER_DISABLED; - - for (i = 0; i < req->n_ssids; i++) { - cmd->ssids[cmd->n_ssids].type = (ssids[i].ssid_len) ? - SCAN_SSID_TYPE_HIDDEN : SCAN_SSID_TYPE_PUBLIC; - cmd->ssids[cmd->n_ssids].len = ssids[i].ssid_len; - memcpy(cmd->ssids[cmd->n_ssids].ssid, ssids[i].ssid, - ssids[i].ssid_len); - cmd->n_ssids++; - } - } else { - type = SCAN_SSID_FILTER_LIST; - - /* Add all SSIDs from the filters */ - for (i = 0; i < req->n_match_sets; i++) { - /* ignore sets without SSIDs */ - if (!sets[i].ssid.ssid_len) - continue; - - cmd->ssids[cmd->n_ssids].type = SCAN_SSID_TYPE_PUBLIC; - cmd->ssids[cmd->n_ssids].len = sets[i].ssid.ssid_len; - memcpy(cmd->ssids[cmd->n_ssids].ssid, - sets[i].ssid.ssid, sets[i].ssid.ssid_len); - cmd->n_ssids++; - } - if ((req->n_ssids > 1) || - (req->n_ssids == 1 && req->ssids[0].ssid_len > 0)) { - /* - * Mark all the SSIDs passed in the SSID list as HIDDEN, - * so they're used in probe requests. - */ - for (i = 0; i < req->n_ssids; i++) { - if (!req->ssids[i].ssid_len) - continue; - - for (j = 0; j < cmd->n_ssids; j++) - if ((req->ssids[i].ssid_len == - cmd->ssids[j].len) && - !memcmp(req->ssids[i].ssid, - cmd->ssids[j].ssid, - req->ssids[i].ssid_len)) { - cmd->ssids[j].type = - SCAN_SSID_TYPE_HIDDEN; - break; - } - /* Fail if SSID isn't present in the filters */ - if (j == cmd->n_ssids) { - ret = -EINVAL; - goto out_free; - } - } - } - } - - wl1271_dump(DEBUG_SCAN, "SSID_LIST: ", cmd, sizeof(*cmd)); - - ret = wl1271_cmd_send(wl, CMD_CONNECTION_SCAN_SSID_CFG, cmd, - sizeof(*cmd), 0); - if (ret < 0) { - wl1271_error("cmd sched scan ssid list failed"); - goto out_free; - } - -out_free: - kfree(cmd); -out: - if (ret < 0) - return ret; - return type; -} -EXPORT_SYMBOL_GPL(wlcore_scan_sched_scan_ssid_list); - -void wlcore_scan_sched_scan_results(struct wl1271 *wl) -{ - wl1271_debug(DEBUG_SCAN, "got periodic scan results"); - - ieee80211_sched_scan_results(wl->hw); -} -EXPORT_SYMBOL_GPL(wlcore_scan_sched_scan_results); diff --git a/drivers/net/wireless/ti/wlcore/scan.h b/drivers/net/wireless/ti/wlcore/scan.h deleted file mode 100644 index a6ab24b5c0f9..000000000000 --- a/drivers/net/wireless/ti/wlcore/scan.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2009-2010 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __SCAN_H__ -#define __SCAN_H__ - -#include "wlcore.h" - -int wlcore_scan(struct wl1271 *wl, struct ieee80211_vif *vif, - const u8 *ssid, size_t ssid_len, - struct cfg80211_scan_request *req); -int wl1271_scan_build_probe_req(struct wl1271 *wl, - const u8 *ssid, size_t ssid_len, - const u8 *ie, size_t ie_len, u8 band); -void wl1271_scan_stm(struct wl1271 *wl, struct wl12xx_vif *wlvif); -void wl1271_scan_complete_work(struct work_struct *work); -int wl1271_scan_sched_scan_config(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct cfg80211_sched_scan_request *req, - struct ieee80211_sched_scan_ies *ies); -int wl1271_scan_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif); -void wlcore_scan_sched_scan_results(struct wl1271 *wl); - -#define WL1271_SCAN_MAX_CHANNELS 24 -#define WL1271_SCAN_DEFAULT_TAG 1 -#define WL1271_SCAN_CURRENT_TX_PWR 0 -#define WL1271_SCAN_OPT_ACTIVE 0 -#define WL1271_SCAN_OPT_PASSIVE 1 -#define WL1271_SCAN_OPT_SPLIT_SCAN 2 -#define WL1271_SCAN_OPT_PRIORITY_HIGH 4 -/* scan even if we fail to enter psm */ -#define WL1271_SCAN_OPT_FORCE 8 -#define WL1271_SCAN_BAND_2_4_GHZ 0 -#define WL1271_SCAN_BAND_5_GHZ 1 - -#define WL1271_SCAN_TIMEOUT 30000 /* msec */ - -enum { - WL1271_SCAN_STATE_IDLE, - WL1271_SCAN_STATE_2GHZ_ACTIVE, - WL1271_SCAN_STATE_2GHZ_PASSIVE, - WL1271_SCAN_STATE_5GHZ_ACTIVE, - WL1271_SCAN_STATE_5GHZ_PASSIVE, - WL1271_SCAN_STATE_DONE -}; - -struct wl1271_cmd_trigger_scan_to { - struct wl1271_cmd_header header; - - __le32 timeout; -} __packed; - -#define MAX_CHANNELS_2GHZ 14 -#define MAX_CHANNELS_4GHZ 4 - -/* - * This max value here is used only for the struct definition of - * wlcore_scan_channels. This struct is used by both 12xx - * and 18xx (which have different max 5ghz channels value). - * In order to make sure this is large enough, just use the - * max possible 5ghz channels. - */ -#define MAX_CHANNELS_5GHZ 42 - -#define SCAN_MAX_CYCLE_INTERVALS 16 -#define SCAN_MAX_BANDS 3 - -enum { - SCAN_SSID_FILTER_ANY = 0, - SCAN_SSID_FILTER_SPECIFIC = 1, - SCAN_SSID_FILTER_LIST = 2, - SCAN_SSID_FILTER_DISABLED = 3 -}; - -enum { - SCAN_BSS_TYPE_INDEPENDENT, - SCAN_BSS_TYPE_INFRASTRUCTURE, - SCAN_BSS_TYPE_ANY, -}; - -#define SCAN_CHANNEL_FLAGS_DFS BIT(0) /* channel is passive until an - activity is detected on it */ -#define SCAN_CHANNEL_FLAGS_DFS_ENABLED BIT(1) - -struct conn_scan_ch_params { - __le16 min_duration; - __le16 max_duration; - __le16 passive_duration; - - u8 channel; - u8 tx_power_att; - - /* bit 0: DFS channel; bit 1: DFS enabled */ - u8 flags; - - u8 padding[3]; -} __packed; - -#define SCHED_SCAN_MAX_SSIDS 16 - -enum { - SCAN_SSID_TYPE_PUBLIC = 0, - SCAN_SSID_TYPE_HIDDEN = 1, -}; - -struct wl1271_ssid { - u8 type; - u8 len; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - /* u8 padding[2]; */ -} __packed; - -struct wl1271_cmd_sched_scan_ssid_list { - struct wl1271_cmd_header header; - - u8 n_ssids; - struct wl1271_ssid ssids[SCHED_SCAN_MAX_SSIDS]; - u8 role_id; - u8 padding[2]; -} __packed; - -struct wlcore_scan_channels { - u8 passive[SCAN_MAX_BANDS]; /* number of passive scan channels */ - u8 active[SCAN_MAX_BANDS]; /* number of active scan channels */ - u8 dfs; /* number of dfs channels in 5ghz */ - u8 passive_active; /* number of passive before active channels 2.4ghz */ - - struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ]; - struct conn_scan_ch_params channels_5[MAX_CHANNELS_5GHZ]; - struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ]; -}; - -enum { - SCAN_TYPE_SEARCH = 0, - SCAN_TYPE_PERIODIC = 1, - SCAN_TYPE_TRACKING = 2, -}; - -bool -wlcore_set_scan_chan_params(struct wl1271 *wl, - struct wlcore_scan_channels *cfg, - struct ieee80211_channel *channels[], - u32 n_channels, - u32 n_ssids, - int scan_type); - -int -wlcore_scan_sched_scan_ssid_list(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct cfg80211_sched_scan_request *req); - -#endif /* __WL1271_SCAN_H__ */ diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c deleted file mode 100644 index 29ef2492951f..000000000000 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ /dev/null @@ -1,419 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2009-2010 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wlcore.h" -#include "wl12xx_80211.h" -#include "io.h" - -#ifndef SDIO_VENDOR_ID_TI -#define SDIO_VENDOR_ID_TI 0x0097 -#endif - -#ifndef SDIO_DEVICE_ID_TI_WL1271 -#define SDIO_DEVICE_ID_TI_WL1271 0x4076 -#endif - -static bool dump = false; - -struct wl12xx_sdio_glue { - struct device *dev; - struct platform_device *core; -}; - -static const struct sdio_device_id wl1271_devices[] = { - { SDIO_DEVICE(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271) }, - {} -}; -MODULE_DEVICE_TABLE(sdio, wl1271_devices); - -static void wl1271_sdio_set_block_size(struct device *child, - unsigned int blksz) -{ - struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); - struct sdio_func *func = dev_to_sdio_func(glue->dev); - - sdio_claim_host(func); - sdio_set_block_size(func, blksz); - sdio_release_host(func); -} - -static int __must_check wl12xx_sdio_raw_read(struct device *child, int addr, - void *buf, size_t len, bool fixed) -{ - int ret; - struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); - struct sdio_func *func = dev_to_sdio_func(glue->dev); - - sdio_claim_host(func); - - if (unlikely(dump)) { - printk(KERN_DEBUG "wlcore_sdio: READ from 0x%04x\n", addr); - print_hex_dump(KERN_DEBUG, "wlcore_sdio: READ ", - DUMP_PREFIX_OFFSET, 16, 1, - buf, len, false); - } - - if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG)) { - ((u8 *)buf)[0] = sdio_f0_readb(func, addr, &ret); - dev_dbg(child->parent, "sdio read 52 addr 0x%x, byte 0x%02x\n", - addr, ((u8 *)buf)[0]); - } else { - if (fixed) - ret = sdio_readsb(func, buf, addr, len); - else - ret = sdio_memcpy_fromio(func, buf, addr, len); - - dev_dbg(child->parent, "sdio read 53 addr 0x%x, %zu bytes\n", - addr, len); - } - - sdio_release_host(func); - - if (WARN_ON(ret)) - dev_err(child->parent, "sdio read failed (%d)\n", ret); - - return ret; -} - -static int __must_check wl12xx_sdio_raw_write(struct device *child, int addr, - void *buf, size_t len, bool fixed) -{ - int ret; - struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); - struct sdio_func *func = dev_to_sdio_func(glue->dev); - - sdio_claim_host(func); - - if (unlikely(dump)) { - printk(KERN_DEBUG "wlcore_sdio: WRITE to 0x%04x\n", addr); - print_hex_dump(KERN_DEBUG, "wlcore_sdio: WRITE ", - DUMP_PREFIX_OFFSET, 16, 1, - buf, len, false); - } - - if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG)) { - sdio_f0_writeb(func, ((u8 *)buf)[0], addr, &ret); - dev_dbg(child->parent, "sdio write 52 addr 0x%x, byte 0x%02x\n", - addr, ((u8 *)buf)[0]); - } else { - dev_dbg(child->parent, "sdio write 53 addr 0x%x, %zu bytes\n", - addr, len); - - if (fixed) - ret = sdio_writesb(func, addr, buf, len); - else - ret = sdio_memcpy_toio(func, addr, buf, len); - } - - sdio_release_host(func); - - if (WARN_ON(ret)) - dev_err(child->parent, "sdio write failed (%d)\n", ret); - - return ret; -} - -static int wl12xx_sdio_power_on(struct wl12xx_sdio_glue *glue) -{ - int ret; - struct sdio_func *func = dev_to_sdio_func(glue->dev); - struct mmc_card *card = func->card; - - ret = pm_runtime_get_sync(&card->dev); - if (ret) { - /* - * Runtime PM might be temporarily disabled, or the device - * might have a positive reference counter. Make sure it is - * really powered on. - */ - ret = mmc_power_restore_host(card->host); - if (ret < 0) { - pm_runtime_put_sync(&card->dev); - goto out; - } - } - - sdio_claim_host(func); - sdio_enable_func(func); - sdio_release_host(func); - -out: - return ret; -} - -static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue) -{ - int ret; - struct sdio_func *func = dev_to_sdio_func(glue->dev); - struct mmc_card *card = func->card; - - sdio_claim_host(func); - sdio_disable_func(func); - sdio_release_host(func); - - /* Power off the card manually in case it wasn't powered off above */ - ret = mmc_power_save_host(card->host); - if (ret < 0) - goto out; - - /* Let runtime PM know the card is powered off */ - pm_runtime_put_sync(&card->dev); - -out: - return ret; -} - -static int wl12xx_sdio_set_power(struct device *child, bool enable) -{ - struct wl12xx_sdio_glue *glue = dev_get_drvdata(child->parent); - - if (enable) - return wl12xx_sdio_power_on(glue); - else - return wl12xx_sdio_power_off(glue); -} - -static struct wl1271_if_operations sdio_ops = { - .read = wl12xx_sdio_raw_read, - .write = wl12xx_sdio_raw_write, - .power = wl12xx_sdio_set_power, - .set_block_size = wl1271_sdio_set_block_size, -}; - -static int wl1271_probe(struct sdio_func *func, - const struct sdio_device_id *id) -{ - struct wlcore_platdev_data *pdev_data; - struct wl12xx_sdio_glue *glue; - struct resource res[1]; - mmc_pm_flag_t mmcflags; - int ret = -ENOMEM; - const char *chip_family; - - /* We are only able to handle the wlan function */ - if (func->num != 0x02) - return -ENODEV; - - pdev_data = kzalloc(sizeof(*pdev_data), GFP_KERNEL); - if (!pdev_data) - goto out; - - pdev_data->if_ops = &sdio_ops; - - glue = kzalloc(sizeof(*glue), GFP_KERNEL); - if (!glue) { - dev_err(&func->dev, "can't allocate glue\n"); - goto out_free_pdev_data; - } - - glue->dev = &func->dev; - - /* Grab access to FN0 for ELP reg. */ - func->card->quirks |= MMC_QUIRK_LENIENT_FN0; - - /* Use block mode for transferring over one block size of data */ - func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; - - pdev_data->pdata = wl12xx_get_platform_data(); - if (IS_ERR(pdev_data->pdata)) { - ret = PTR_ERR(pdev_data->pdata); - dev_err(glue->dev, "missing wlan platform data: %d\n", ret); - goto out_free_glue; - } - - /* if sdio can keep power while host is suspended, enable wow */ - mmcflags = sdio_get_host_pm_caps(func); - dev_dbg(glue->dev, "sdio PM caps = 0x%x\n", mmcflags); - - if (mmcflags & MMC_PM_KEEP_POWER) - pdev_data->pdata->pwr_in_suspend = true; - - sdio_set_drvdata(func, glue); - - /* Tell PM core that we don't need the card to be powered now */ - pm_runtime_put_noidle(&func->dev); - - /* - * Due to a hardware bug, we can't differentiate wl18xx from - * wl12xx, because both report the same device ID. The only - * way to differentiate is by checking the SDIO revision, - * which is 3.00 on the wl18xx chips. - */ - if (func->card->cccr.sdio_vsn == SDIO_SDIO_REV_3_00) - chip_family = "wl18xx"; - else - chip_family = "wl12xx"; - - glue->core = platform_device_alloc(chip_family, PLATFORM_DEVID_AUTO); - if (!glue->core) { - dev_err(glue->dev, "can't allocate platform_device"); - ret = -ENOMEM; - goto out_free_glue; - } - - glue->core->dev.parent = &func->dev; - - memset(res, 0x00, sizeof(res)); - - res[0].start = pdev_data->pdata->irq; - res[0].flags = IORESOURCE_IRQ; - res[0].name = "irq"; - - ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res)); - if (ret) { - dev_err(glue->dev, "can't add resources\n"); - goto out_dev_put; - } - - ret = platform_device_add_data(glue->core, pdev_data, - sizeof(*pdev_data)); - if (ret) { - dev_err(glue->dev, "can't add platform data\n"); - goto out_dev_put; - } - - ret = platform_device_add(glue->core); - if (ret) { - dev_err(glue->dev, "can't add platform device\n"); - goto out_dev_put; - } - return 0; - -out_dev_put: - platform_device_put(glue->core); - -out_free_glue: - kfree(glue); - -out_free_pdev_data: - kfree(pdev_data); - -out: - return ret; -} - -static void wl1271_remove(struct sdio_func *func) -{ - struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func); - - /* Undo decrement done above in wl1271_probe */ - pm_runtime_get_noresume(&func->dev); - - platform_device_unregister(glue->core); - kfree(glue); -} - -#ifdef CONFIG_PM -static int wl1271_suspend(struct device *dev) -{ - /* Tell MMC/SDIO core it's OK to power down the card - * (if it isn't already), but not to remove it completely */ - struct sdio_func *func = dev_to_sdio_func(dev); - struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func); - struct wl1271 *wl = platform_get_drvdata(glue->core); - mmc_pm_flag_t sdio_flags; - int ret = 0; - - dev_dbg(dev, "wl1271 suspend. wow_enabled: %d\n", - wl->wow_enabled); - - /* check whether sdio should keep power */ - if (wl->wow_enabled) { - sdio_flags = sdio_get_host_pm_caps(func); - - if (!(sdio_flags & MMC_PM_KEEP_POWER)) { - dev_err(dev, "can't keep power while host " - "is suspended\n"); - ret = -EINVAL; - goto out; - } - - /* keep power while host suspended */ - ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); - if (ret) { - dev_err(dev, "error while trying to keep power\n"); - goto out; - } - } -out: - return ret; -} - -static int wl1271_resume(struct device *dev) -{ - dev_dbg(dev, "wl1271 resume\n"); - - return 0; -} - -static const struct dev_pm_ops wl1271_sdio_pm_ops = { - .suspend = wl1271_suspend, - .resume = wl1271_resume, -}; -#endif - -static struct sdio_driver wl1271_sdio_driver = { - .name = "wl1271_sdio", - .id_table = wl1271_devices, - .probe = wl1271_probe, - .remove = wl1271_remove, -#ifdef CONFIG_PM - .drv = { - .pm = &wl1271_sdio_pm_ops, - }, -#endif -}; - -static int __init wl1271_init(void) -{ - return sdio_register_driver(&wl1271_sdio_driver); -} - -static void __exit wl1271_exit(void) -{ - sdio_unregister_driver(&wl1271_sdio_driver); -} - -module_init(wl1271_init); -module_exit(wl1271_exit); - -module_param(dump, bool, S_IRUSR | S_IWUSR); -MODULE_PARM_DESC(dump, "Enable sdio read/write dumps."); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Luciano Coelho "); -MODULE_AUTHOR("Juuso Oikarinen "); diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c deleted file mode 100644 index e26447832683..000000000000 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ /dev/null @@ -1,453 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2008-2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wlcore.h" -#include "wl12xx_80211.h" -#include "io.h" - -#define WSPI_CMD_READ 0x40000000 -#define WSPI_CMD_WRITE 0x00000000 -#define WSPI_CMD_FIXED 0x20000000 -#define WSPI_CMD_BYTE_LENGTH 0x1FFE0000 -#define WSPI_CMD_BYTE_LENGTH_OFFSET 17 -#define WSPI_CMD_BYTE_ADDR 0x0001FFFF - -#define WSPI_INIT_CMD_CRC_LEN 5 - -#define WSPI_INIT_CMD_START 0x00 -#define WSPI_INIT_CMD_TX 0x40 -/* the extra bypass bit is sampled by the TNET as '1' */ -#define WSPI_INIT_CMD_BYPASS_BIT 0x80 -#define WSPI_INIT_CMD_FIXEDBUSY_LEN 0x07 -#define WSPI_INIT_CMD_EN_FIXEDBUSY 0x80 -#define WSPI_INIT_CMD_DIS_FIXEDBUSY 0x00 -#define WSPI_INIT_CMD_IOD 0x40 -#define WSPI_INIT_CMD_IP 0x20 -#define WSPI_INIT_CMD_CS 0x10 -#define WSPI_INIT_CMD_WS 0x08 -#define WSPI_INIT_CMD_WSPI 0x01 -#define WSPI_INIT_CMD_END 0x01 - -#define WSPI_INIT_CMD_LEN 8 - -#define HW_ACCESS_WSPI_FIXED_BUSY_LEN \ - ((WL1271_BUSY_WORD_LEN - 4) / sizeof(u32)) -#define HW_ACCESS_WSPI_INIT_CMD_MASK 0 - -/* HW limitation: maximum possible chunk size is 4095 bytes */ -#define WSPI_MAX_CHUNK_SIZE 4092 - -/* - * only support SPI for 12xx - this code should be reworked when 18xx - * support is introduced - */ -#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE) - -#define WSPI_MAX_NUM_OF_CHUNKS (SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) - -struct wl12xx_spi_glue { - struct device *dev; - struct platform_device *core; -}; - -static void wl12xx_spi_reset(struct device *child) -{ - struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); - u8 *cmd; - struct spi_transfer t; - struct spi_message m; - - cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); - if (!cmd) { - dev_err(child->parent, - "could not allocate cmd for spi reset\n"); - return; - } - - memset(&t, 0, sizeof(t)); - spi_message_init(&m); - - memset(cmd, 0xff, WSPI_INIT_CMD_LEN); - - t.tx_buf = cmd; - t.len = WSPI_INIT_CMD_LEN; - spi_message_add_tail(&t, &m); - - spi_sync(to_spi_device(glue->dev), &m); - - kfree(cmd); -} - -static void wl12xx_spi_init(struct device *child) -{ - struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); - u8 crc[WSPI_INIT_CMD_CRC_LEN], *cmd; - struct spi_transfer t; - struct spi_message m; - - cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); - if (!cmd) { - dev_err(child->parent, - "could not allocate cmd for spi init\n"); - return; - } - - memset(crc, 0, sizeof(crc)); - memset(&t, 0, sizeof(t)); - spi_message_init(&m); - - /* - * Set WSPI_INIT_COMMAND - * the data is being send from the MSB to LSB - */ - cmd[2] = 0xff; - cmd[3] = 0xff; - cmd[1] = WSPI_INIT_CMD_START | WSPI_INIT_CMD_TX; - cmd[0] = 0; - cmd[7] = 0; - cmd[6] |= HW_ACCESS_WSPI_INIT_CMD_MASK << 3; - cmd[6] |= HW_ACCESS_WSPI_FIXED_BUSY_LEN & WSPI_INIT_CMD_FIXEDBUSY_LEN; - - if (HW_ACCESS_WSPI_FIXED_BUSY_LEN == 0) - cmd[5] |= WSPI_INIT_CMD_DIS_FIXEDBUSY; - else - cmd[5] |= WSPI_INIT_CMD_EN_FIXEDBUSY; - - cmd[5] |= WSPI_INIT_CMD_IOD | WSPI_INIT_CMD_IP | WSPI_INIT_CMD_CS - | WSPI_INIT_CMD_WSPI | WSPI_INIT_CMD_WS; - - crc[0] = cmd[1]; - crc[1] = cmd[0]; - crc[2] = cmd[7]; - crc[3] = cmd[6]; - crc[4] = cmd[5]; - - cmd[4] |= crc7(0, crc, WSPI_INIT_CMD_CRC_LEN) << 1; - cmd[4] |= WSPI_INIT_CMD_END; - - t.tx_buf = cmd; - t.len = WSPI_INIT_CMD_LEN; - spi_message_add_tail(&t, &m); - - spi_sync(to_spi_device(glue->dev), &m); - kfree(cmd); -} - -#define WL1271_BUSY_WORD_TIMEOUT 1000 - -static int wl12xx_spi_read_busy(struct device *child) -{ - struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); - struct wl1271 *wl = dev_get_drvdata(child); - struct spi_transfer t[1]; - struct spi_message m; - u32 *busy_buf; - int num_busy_bytes = 0; - - /* - * Read further busy words from SPI until a non-busy word is - * encountered, then read the data itself into the buffer. - */ - - num_busy_bytes = WL1271_BUSY_WORD_TIMEOUT; - busy_buf = wl->buffer_busyword; - while (num_busy_bytes) { - num_busy_bytes--; - spi_message_init(&m); - memset(t, 0, sizeof(t)); - t[0].rx_buf = busy_buf; - t[0].len = sizeof(u32); - t[0].cs_change = true; - spi_message_add_tail(&t[0], &m); - spi_sync(to_spi_device(glue->dev), &m); - - if (*busy_buf & 0x1) - return 0; - } - - /* The SPI bus is unresponsive, the read failed. */ - dev_err(child->parent, "SPI read busy-word timeout!\n"); - return -ETIMEDOUT; -} - -static int __must_check wl12xx_spi_raw_read(struct device *child, int addr, - void *buf, size_t len, bool fixed) -{ - struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); - struct wl1271 *wl = dev_get_drvdata(child); - struct spi_transfer t[2]; - struct spi_message m; - u32 *busy_buf; - u32 *cmd; - u32 chunk_len; - - while (len > 0) { - chunk_len = min((size_t)WSPI_MAX_CHUNK_SIZE, len); - - cmd = &wl->buffer_cmd; - busy_buf = wl->buffer_busyword; - - *cmd = 0; - *cmd |= WSPI_CMD_READ; - *cmd |= (chunk_len << WSPI_CMD_BYTE_LENGTH_OFFSET) & - WSPI_CMD_BYTE_LENGTH; - *cmd |= addr & WSPI_CMD_BYTE_ADDR; - - if (fixed) - *cmd |= WSPI_CMD_FIXED; - - spi_message_init(&m); - memset(t, 0, sizeof(t)); - - t[0].tx_buf = cmd; - t[0].len = 4; - t[0].cs_change = true; - spi_message_add_tail(&t[0], &m); - - /* Busy and non busy words read */ - t[1].rx_buf = busy_buf; - t[1].len = WL1271_BUSY_WORD_LEN; - t[1].cs_change = true; - spi_message_add_tail(&t[1], &m); - - spi_sync(to_spi_device(glue->dev), &m); - - if (!(busy_buf[WL1271_BUSY_WORD_CNT - 1] & 0x1) && - wl12xx_spi_read_busy(child)) { - memset(buf, 0, chunk_len); - return 0; - } - - spi_message_init(&m); - memset(t, 0, sizeof(t)); - - t[0].rx_buf = buf; - t[0].len = chunk_len; - t[0].cs_change = true; - spi_message_add_tail(&t[0], &m); - - spi_sync(to_spi_device(glue->dev), &m); - - if (!fixed) - addr += chunk_len; - buf += chunk_len; - len -= chunk_len; - } - - return 0; -} - -static int __must_check wl12xx_spi_raw_write(struct device *child, int addr, - void *buf, size_t len, bool fixed) -{ - struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); - struct spi_transfer t[2 * (WSPI_MAX_NUM_OF_CHUNKS + 1)]; - struct spi_message m; - u32 commands[WSPI_MAX_NUM_OF_CHUNKS]; - u32 *cmd; - u32 chunk_len; - int i; - - WARN_ON(len > SPI_AGGR_BUFFER_SIZE); - - spi_message_init(&m); - memset(t, 0, sizeof(t)); - - cmd = &commands[0]; - i = 0; - while (len > 0) { - chunk_len = min((size_t)WSPI_MAX_CHUNK_SIZE, len); - - *cmd = 0; - *cmd |= WSPI_CMD_WRITE; - *cmd |= (chunk_len << WSPI_CMD_BYTE_LENGTH_OFFSET) & - WSPI_CMD_BYTE_LENGTH; - *cmd |= addr & WSPI_CMD_BYTE_ADDR; - - if (fixed) - *cmd |= WSPI_CMD_FIXED; - - t[i].tx_buf = cmd; - t[i].len = sizeof(*cmd); - spi_message_add_tail(&t[i++], &m); - - t[i].tx_buf = buf; - t[i].len = chunk_len; - spi_message_add_tail(&t[i++], &m); - - if (!fixed) - addr += chunk_len; - buf += chunk_len; - len -= chunk_len; - cmd++; - } - - spi_sync(to_spi_device(glue->dev), &m); - - return 0; -} - -static struct wl1271_if_operations spi_ops = { - .read = wl12xx_spi_raw_read, - .write = wl12xx_spi_raw_write, - .reset = wl12xx_spi_reset, - .init = wl12xx_spi_init, - .set_block_size = NULL, -}; - -static int wl1271_probe(struct spi_device *spi) -{ - struct wl12xx_spi_glue *glue; - struct wlcore_platdev_data *pdev_data; - struct resource res[1]; - int ret = -ENOMEM; - - pdev_data = kzalloc(sizeof(*pdev_data), GFP_KERNEL); - if (!pdev_data) - goto out; - - pdev_data->pdata = spi->dev.platform_data; - if (!pdev_data->pdata) { - dev_err(&spi->dev, "no platform data\n"); - ret = -ENODEV; - goto out_free_pdev_data; - } - - pdev_data->if_ops = &spi_ops; - - glue = kzalloc(sizeof(*glue), GFP_KERNEL); - if (!glue) { - dev_err(&spi->dev, "can't allocate glue\n"); - goto out_free_pdev_data; - } - - glue->dev = &spi->dev; - - spi_set_drvdata(spi, glue); - - /* This is the only SPI value that we need to set here, the rest - * comes from the board-peripherals file */ - spi->bits_per_word = 32; - - ret = spi_setup(spi); - if (ret < 0) { - dev_err(glue->dev, "spi_setup failed\n"); - goto out_free_glue; - } - - glue->core = platform_device_alloc("wl12xx", PLATFORM_DEVID_AUTO); - if (!glue->core) { - dev_err(glue->dev, "can't allocate platform_device\n"); - ret = -ENOMEM; - goto out_free_glue; - } - - glue->core->dev.parent = &spi->dev; - - memset(res, 0x00, sizeof(res)); - - res[0].start = spi->irq; - res[0].flags = IORESOURCE_IRQ; - res[0].name = "irq"; - - ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res)); - if (ret) { - dev_err(glue->dev, "can't add resources\n"); - goto out_dev_put; - } - - ret = platform_device_add_data(glue->core, pdev_data, - sizeof(*pdev_data)); - if (ret) { - dev_err(glue->dev, "can't add platform data\n"); - goto out_dev_put; - } - - ret = platform_device_add(glue->core); - if (ret) { - dev_err(glue->dev, "can't register platform device\n"); - goto out_dev_put; - } - - return 0; - -out_dev_put: - platform_device_put(glue->core); - -out_free_glue: - kfree(glue); - -out_free_pdev_data: - kfree(pdev_data); - -out: - return ret; -} - -static int wl1271_remove(struct spi_device *spi) -{ - struct wl12xx_spi_glue *glue = spi_get_drvdata(spi); - - platform_device_unregister(glue->core); - kfree(glue); - - return 0; -} - - -static struct spi_driver wl1271_spi_driver = { - .driver = { - .name = "wl1271_spi", - .owner = THIS_MODULE, - }, - - .probe = wl1271_probe, - .remove = wl1271_remove, -}; - -static int __init wl1271_init(void) -{ - return spi_register_driver(&wl1271_spi_driver); -} - -static void __exit wl1271_exit(void) -{ - spi_unregister_driver(&wl1271_spi_driver); -} - -module_init(wl1271_init); -module_exit(wl1271_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Luciano Coelho "); -MODULE_AUTHOR("Juuso Oikarinen "); -MODULE_ALIAS("spi:wl1271"); diff --git a/drivers/net/wireless/ti/wlcore/testmode.c b/drivers/net/wireless/ti/wlcore/testmode.c deleted file mode 100644 index f3442762d884..000000000000 --- a/drivers/net/wireless/ti/wlcore/testmode.c +++ /dev/null @@ -1,386 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2010 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ -#include "testmode.h" - -#include -#include - -#include "wlcore.h" -#include "debug.h" -#include "acx.h" -#include "ps.h" -#include "io.h" - -#define WL1271_TM_MAX_DATA_LENGTH 1024 - -enum wl1271_tm_commands { - WL1271_TM_CMD_UNSPEC, - WL1271_TM_CMD_TEST, - WL1271_TM_CMD_INTERROGATE, - WL1271_TM_CMD_CONFIGURE, - WL1271_TM_CMD_NVS_PUSH, /* Not in use. Keep to not break ABI */ - WL1271_TM_CMD_SET_PLT_MODE, - WL1271_TM_CMD_RECOVER, /* Not in use. Keep to not break ABI */ - WL1271_TM_CMD_GET_MAC, - - __WL1271_TM_CMD_AFTER_LAST -}; -#define WL1271_TM_CMD_MAX (__WL1271_TM_CMD_AFTER_LAST - 1) - -enum wl1271_tm_attrs { - WL1271_TM_ATTR_UNSPEC, - WL1271_TM_ATTR_CMD_ID, - WL1271_TM_ATTR_ANSWER, - WL1271_TM_ATTR_DATA, - WL1271_TM_ATTR_IE_ID, - WL1271_TM_ATTR_PLT_MODE, - - __WL1271_TM_ATTR_AFTER_LAST -}; -#define WL1271_TM_ATTR_MAX (__WL1271_TM_ATTR_AFTER_LAST - 1) - -static struct nla_policy wl1271_tm_policy[WL1271_TM_ATTR_MAX + 1] = { - [WL1271_TM_ATTR_CMD_ID] = { .type = NLA_U32 }, - [WL1271_TM_ATTR_ANSWER] = { .type = NLA_U8 }, - [WL1271_TM_ATTR_DATA] = { .type = NLA_BINARY, - .len = WL1271_TM_MAX_DATA_LENGTH }, - [WL1271_TM_ATTR_IE_ID] = { .type = NLA_U32 }, - [WL1271_TM_ATTR_PLT_MODE] = { .type = NLA_U32 }, -}; - - -static int wl1271_tm_cmd_test(struct wl1271 *wl, struct nlattr *tb[]) -{ - int buf_len, ret, len; - struct sk_buff *skb; - void *buf; - u8 answer = 0; - - wl1271_debug(DEBUG_TESTMODE, "testmode cmd test"); - - if (!tb[WL1271_TM_ATTR_DATA]) - return -EINVAL; - - buf = nla_data(tb[WL1271_TM_ATTR_DATA]); - buf_len = nla_len(tb[WL1271_TM_ATTR_DATA]); - - if (tb[WL1271_TM_ATTR_ANSWER]) - answer = nla_get_u8(tb[WL1271_TM_ATTR_ANSWER]); - - if (buf_len > sizeof(struct wl1271_command)) - return -EMSGSIZE; - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) { - ret = -EINVAL; - goto out; - } - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = wl1271_cmd_test(wl, buf, buf_len, answer); - if (ret < 0) { - wl1271_warning("testmode cmd test failed: %d", ret); - goto out_sleep; - } - - if (answer) { - /* If we got bip calibration answer print radio status */ - struct wl1271_cmd_cal_p2g *params = - (struct wl1271_cmd_cal_p2g *) buf; - - s16 radio_status = (s16) le16_to_cpu(params->radio_status); - - if (params->test.id == TEST_CMD_P2G_CAL && - radio_status < 0) - wl1271_warning("testmode cmd: radio status=%d", - radio_status); - else - wl1271_info("testmode cmd: radio status=%d", - radio_status); - - len = nla_total_size(buf_len); - skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, len); - if (!skb) { - ret = -ENOMEM; - goto out_sleep; - } - - if (nla_put(skb, WL1271_TM_ATTR_DATA, buf_len, buf)) { - kfree_skb(skb); - ret = -EMSGSIZE; - goto out_sleep; - } - - ret = cfg80211_testmode_reply(skb); - if (ret < 0) - goto out_sleep; - } - -out_sleep: - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -static int wl1271_tm_cmd_interrogate(struct wl1271 *wl, struct nlattr *tb[]) -{ - int ret; - struct wl1271_command *cmd; - struct sk_buff *skb; - u8 ie_id; - - wl1271_debug(DEBUG_TESTMODE, "testmode cmd interrogate"); - - if (!tb[WL1271_TM_ATTR_IE_ID]) - return -EINVAL; - - ie_id = nla_get_u8(tb[WL1271_TM_ATTR_IE_ID]); - - mutex_lock(&wl->mutex); - - if (unlikely(wl->state != WLCORE_STATE_ON)) { - ret = -EINVAL; - goto out; - } - - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); - if (!cmd) { - ret = -ENOMEM; - goto out_sleep; - } - - ret = wl1271_cmd_interrogate(wl, ie_id, cmd, sizeof(*cmd)); - if (ret < 0) { - wl1271_warning("testmode cmd interrogate failed: %d", ret); - goto out_free; - } - - skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, sizeof(*cmd)); - if (!skb) { - ret = -ENOMEM; - goto out_free; - } - - if (nla_put(skb, WL1271_TM_ATTR_DATA, sizeof(*cmd), cmd)) { - kfree_skb(skb); - ret = -EMSGSIZE; - goto out_free; - } - - ret = cfg80211_testmode_reply(skb); - if (ret < 0) - goto out_free; - -out_free: - kfree(cmd); -out_sleep: - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); - - return ret; -} - -static int wl1271_tm_cmd_configure(struct wl1271 *wl, struct nlattr *tb[]) -{ - int buf_len, ret; - void *buf; - u8 ie_id; - - wl1271_debug(DEBUG_TESTMODE, "testmode cmd configure"); - - if (!tb[WL1271_TM_ATTR_DATA]) - return -EINVAL; - if (!tb[WL1271_TM_ATTR_IE_ID]) - return -EINVAL; - - ie_id = nla_get_u8(tb[WL1271_TM_ATTR_IE_ID]); - buf = nla_data(tb[WL1271_TM_ATTR_DATA]); - buf_len = nla_len(tb[WL1271_TM_ATTR_DATA]); - - if (buf_len > sizeof(struct wl1271_command)) - return -EMSGSIZE; - - mutex_lock(&wl->mutex); - ret = wl1271_cmd_configure(wl, ie_id, buf, buf_len); - mutex_unlock(&wl->mutex); - - if (ret < 0) { - wl1271_warning("testmode cmd configure failed: %d", ret); - return ret; - } - - return 0; -} - -static int wl1271_tm_detect_fem(struct wl1271 *wl, struct nlattr *tb[]) -{ - /* return FEM type */ - int ret, len; - struct sk_buff *skb; - - ret = wl1271_plt_start(wl, PLT_FEM_DETECT); - if (ret < 0) - goto out; - - mutex_lock(&wl->mutex); - - len = nla_total_size(sizeof(wl->fem_manuf)); - skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, len); - if (!skb) { - ret = -ENOMEM; - goto out_mutex; - } - - if (nla_put(skb, WL1271_TM_ATTR_DATA, sizeof(wl->fem_manuf), - &wl->fem_manuf)) { - kfree_skb(skb); - ret = -EMSGSIZE; - goto out_mutex; - } - - ret = cfg80211_testmode_reply(skb); - -out_mutex: - mutex_unlock(&wl->mutex); - - /* We always stop plt after DETECT mode */ - wl1271_plt_stop(wl); -out: - return ret; -} - -static int wl1271_tm_cmd_set_plt_mode(struct wl1271 *wl, struct nlattr *tb[]) -{ - u32 val; - int ret; - - wl1271_debug(DEBUG_TESTMODE, "testmode cmd set plt mode"); - - if (!tb[WL1271_TM_ATTR_PLT_MODE]) - return -EINVAL; - - val = nla_get_u32(tb[WL1271_TM_ATTR_PLT_MODE]); - - switch (val) { - case PLT_OFF: - ret = wl1271_plt_stop(wl); - break; - case PLT_ON: - ret = wl1271_plt_start(wl, PLT_ON); - break; - case PLT_FEM_DETECT: - ret = wl1271_tm_detect_fem(wl, tb); - break; - default: - ret = -EINVAL; - break; - } - - return ret; -} - -static int wl12xx_tm_cmd_get_mac(struct wl1271 *wl, struct nlattr *tb[]) -{ - struct sk_buff *skb; - u8 mac_addr[ETH_ALEN]; - int ret = 0; - - mutex_lock(&wl->mutex); - - if (!wl->plt) { - ret = -EINVAL; - goto out; - } - - if (wl->fuse_oui_addr == 0 && wl->fuse_nic_addr == 0) { - ret = -EOPNOTSUPP; - goto out; - } - - mac_addr[0] = (u8)(wl->fuse_oui_addr >> 16); - mac_addr[1] = (u8)(wl->fuse_oui_addr >> 8); - mac_addr[2] = (u8) wl->fuse_oui_addr; - mac_addr[3] = (u8)(wl->fuse_nic_addr >> 16); - mac_addr[4] = (u8)(wl->fuse_nic_addr >> 8); - mac_addr[5] = (u8) wl->fuse_nic_addr; - - skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, ETH_ALEN); - if (!skb) { - ret = -ENOMEM; - goto out; - } - - if (nla_put(skb, WL1271_TM_ATTR_DATA, ETH_ALEN, mac_addr)) { - kfree_skb(skb); - ret = -EMSGSIZE; - goto out; - } - - ret = cfg80211_testmode_reply(skb); - if (ret < 0) - goto out; - -out: - mutex_unlock(&wl->mutex); - return ret; -} - -int wl1271_tm_cmd(struct ieee80211_hw *hw, void *data, int len) -{ - struct wl1271 *wl = hw->priv; - struct nlattr *tb[WL1271_TM_ATTR_MAX + 1]; - int err; - - err = nla_parse(tb, WL1271_TM_ATTR_MAX, data, len, wl1271_tm_policy); - if (err) - return err; - - if (!tb[WL1271_TM_ATTR_CMD_ID]) - return -EINVAL; - - switch (nla_get_u32(tb[WL1271_TM_ATTR_CMD_ID])) { - case WL1271_TM_CMD_TEST: - return wl1271_tm_cmd_test(wl, tb); - case WL1271_TM_CMD_INTERROGATE: - return wl1271_tm_cmd_interrogate(wl, tb); - case WL1271_TM_CMD_CONFIGURE: - return wl1271_tm_cmd_configure(wl, tb); - case WL1271_TM_CMD_SET_PLT_MODE: - return wl1271_tm_cmd_set_plt_mode(wl, tb); - case WL1271_TM_CMD_GET_MAC: - return wl12xx_tm_cmd_get_mac(wl, tb); - default: - return -EOPNOTSUPP; - } -} diff --git a/drivers/net/wireless/ti/wlcore/testmode.h b/drivers/net/wireless/ti/wlcore/testmode.h deleted file mode 100644 index 8071654259ea..000000000000 --- a/drivers/net/wireless/ti/wlcore/testmode.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2010 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __TESTMODE_H__ -#define __TESTMODE_H__ - -#include - -int wl1271_tm_cmd(struct ieee80211_hw *hw, void *data, int len); - -#endif /* __WL1271_TESTMODE_H__ */ diff --git a/drivers/net/wireless/ti/wlcore/tx.c b/drivers/net/wireless/ti/wlcore/tx.c deleted file mode 100644 index 004d02e71f01..000000000000 --- a/drivers/net/wireless/ti/wlcore/tx.c +++ /dev/null @@ -1,1305 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include -#include -#include -#include - -#include "wlcore.h" -#include "debug.h" -#include "io.h" -#include "ps.h" -#include "tx.h" -#include "event.h" -#include "hw_ops.h" - -/* - * TODO: this is here just for now, it must be removed when the data - * operations are in place. - */ -#include "../wl12xx/reg.h" - -static int wl1271_set_default_wep_key(struct wl1271 *wl, - struct wl12xx_vif *wlvif, u8 id) -{ - int ret; - bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); - - if (is_ap) - ret = wl12xx_cmd_set_default_wep_key(wl, id, - wlvif->ap.bcast_hlid); - else - ret = wl12xx_cmd_set_default_wep_key(wl, id, wlvif->sta.hlid); - - if (ret < 0) - return ret; - - wl1271_debug(DEBUG_CRYPT, "default wep key idx: %d", (int)id); - return 0; -} - -static int wl1271_alloc_tx_id(struct wl1271 *wl, struct sk_buff *skb) -{ - int id; - - id = find_first_zero_bit(wl->tx_frames_map, wl->num_tx_desc); - if (id >= wl->num_tx_desc) - return -EBUSY; - - __set_bit(id, wl->tx_frames_map); - wl->tx_frames[id] = skb; - wl->tx_frames_cnt++; - return id; -} - -void wl1271_free_tx_id(struct wl1271 *wl, int id) -{ - if (__test_and_clear_bit(id, wl->tx_frames_map)) { - if (unlikely(wl->tx_frames_cnt == wl->num_tx_desc)) - clear_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags); - - wl->tx_frames[id] = NULL; - wl->tx_frames_cnt--; - } -} -EXPORT_SYMBOL(wl1271_free_tx_id); - -static void wl1271_tx_ap_update_inconnection_sta(struct wl1271 *wl, - struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr; - - /* - * add the station to the known list before transmitting the - * authentication response. this way it won't get de-authed by FW - * when transmitting too soon. - */ - hdr = (struct ieee80211_hdr *)(skb->data + - sizeof(struct wl1271_tx_hw_descr)); - if (ieee80211_is_auth(hdr->frame_control)) - wl1271_acx_set_inconnection_sta(wl, hdr->addr1); -} - -static void wl1271_tx_regulate_link(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - u8 hlid) -{ - bool fw_ps; - u8 tx_pkts; - - if (WARN_ON(!test_bit(hlid, wlvif->links_map))) - return; - - fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map); - tx_pkts = wl->links[hlid].allocated_pkts; - - /* - * if in FW PS and there is enough data in FW we can put the link - * into high-level PS and clean out its TX queues. - * Make an exception if this is the only connected link. In this - * case FW-memory congestion is less of a problem. - * Note that a single connected STA means 3 active links, since we must - * account for the global and broadcast AP links. The "fw_ps" check - * assures us the third link is a STA connected to the AP. Otherwise - * the FW would not set the PSM bit. - */ - if (wl->active_link_count > 3 && fw_ps && - tx_pkts >= WL1271_PS_STA_MAX_PACKETS) - wl12xx_ps_link_start(wl, wlvif, hlid, true); -} - -bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb) -{ - return wl->dummy_packet == skb; -} -EXPORT_SYMBOL(wl12xx_is_dummy_packet); - -static u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct sk_buff *skb, struct ieee80211_sta *sta) -{ - if (sta) { - struct wl1271_station *wl_sta; - - wl_sta = (struct wl1271_station *)sta->drv_priv; - return wl_sta->hlid; - } else { - struct ieee80211_hdr *hdr; - - if (!test_bit(WLVIF_FLAG_AP_STARTED, &wlvif->flags)) - return wl->system_hlid; - - hdr = (struct ieee80211_hdr *)skb->data; - if (is_multicast_ether_addr(ieee80211_get_DA(hdr))) - return wlvif->ap.bcast_hlid; - else - return wlvif->ap.global_hlid; - } -} - -u8 wl12xx_tx_get_hlid(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct sk_buff *skb, struct ieee80211_sta *sta) -{ - struct ieee80211_tx_info *control; - - if (wlvif->bss_type == BSS_TYPE_AP_BSS) - return wl12xx_tx_get_hlid_ap(wl, wlvif, skb, sta); - - control = IEEE80211_SKB_CB(skb); - if (control->flags & IEEE80211_TX_CTL_TX_OFFCHAN) { - wl1271_debug(DEBUG_TX, "tx offchannel"); - return wlvif->dev_hlid; - } - - return wlvif->sta.hlid; -} - -unsigned int wlcore_calc_packet_alignment(struct wl1271 *wl, - unsigned int packet_length) -{ - if ((wl->quirks & WLCORE_QUIRK_TX_PAD_LAST_FRAME) || - !(wl->quirks & WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN)) - return ALIGN(packet_length, WL1271_TX_ALIGN_TO); - else - return ALIGN(packet_length, WL12XX_BUS_BLOCK_SIZE); -} -EXPORT_SYMBOL(wlcore_calc_packet_alignment); - -static int wl1271_tx_allocate(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct sk_buff *skb, u32 extra, u32 buf_offset, - u8 hlid, bool is_gem) -{ - struct wl1271_tx_hw_descr *desc; - u32 total_len = skb->len + sizeof(struct wl1271_tx_hw_descr) + extra; - u32 total_blocks; - int id, ret = -EBUSY, ac; - u32 spare_blocks; - - if (buf_offset + total_len > wl->aggr_buf_size) - return -EAGAIN; - - spare_blocks = wlcore_hw_get_spare_blocks(wl, is_gem); - - /* allocate free identifier for the packet */ - id = wl1271_alloc_tx_id(wl, skb); - if (id < 0) - return id; - - total_blocks = wlcore_hw_calc_tx_blocks(wl, total_len, spare_blocks); - - if (total_blocks <= wl->tx_blocks_available) { - desc = (struct wl1271_tx_hw_descr *)skb_push( - skb, total_len - skb->len); - - wlcore_hw_set_tx_desc_blocks(wl, desc, total_blocks, - spare_blocks); - - desc->id = id; - - wl->tx_blocks_available -= total_blocks; - wl->tx_allocated_blocks += total_blocks; - - /* If the FW was empty before, arm the Tx watchdog */ - if (wl->tx_allocated_blocks == total_blocks) - wl12xx_rearm_tx_watchdog_locked(wl); - - ac = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); - wl->tx_allocated_pkts[ac]++; - - if (test_bit(hlid, wl->links_map)) - wl->links[hlid].allocated_pkts++; - - ret = 0; - - wl1271_debug(DEBUG_TX, - "tx_allocate: size: %d, blocks: %d, id: %d", - total_len, total_blocks, id); - } else { - wl1271_free_tx_id(wl, id); - } - - return ret; -} - -static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct sk_buff *skb, u32 extra, - struct ieee80211_tx_info *control, u8 hlid) -{ - struct timespec ts; - struct wl1271_tx_hw_descr *desc; - int ac, rate_idx; - s64 hosttime; - u16 tx_attr = 0; - __le16 frame_control; - struct ieee80211_hdr *hdr; - u8 *frame_start; - bool is_dummy; - - desc = (struct wl1271_tx_hw_descr *) skb->data; - frame_start = (u8 *)(desc + 1); - hdr = (struct ieee80211_hdr *)(frame_start + extra); - frame_control = hdr->frame_control; - - /* relocate space for security header */ - if (extra) { - int hdrlen = ieee80211_hdrlen(frame_control); - memmove(frame_start, hdr, hdrlen); - skb_set_network_header(skb, skb_network_offset(skb) + extra); - } - - /* configure packet life time */ - getnstimeofday(&ts); - hosttime = (timespec_to_ns(&ts) >> 10); - desc->start_time = cpu_to_le32(hosttime - wl->time_offset); - - is_dummy = wl12xx_is_dummy_packet(wl, skb); - if (is_dummy || !wlvif || wlvif->bss_type != BSS_TYPE_AP_BSS) - desc->life_time = cpu_to_le16(TX_HW_MGMT_PKT_LIFETIME_TU); - else - desc->life_time = cpu_to_le16(TX_HW_AP_MODE_PKT_LIFETIME_TU); - - /* queue */ - ac = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); - desc->tid = skb->priority; - - if (is_dummy) { - /* - * FW expects the dummy packet to have an invalid session id - - * any session id that is different than the one set in the join - */ - tx_attr = (SESSION_COUNTER_INVALID << - TX_HW_ATTR_OFST_SESSION_COUNTER) & - TX_HW_ATTR_SESSION_COUNTER; - - tx_attr |= TX_HW_ATTR_TX_DUMMY_REQ; - } else if (wlvif) { - u8 session_id = wl->session_ids[hlid]; - - if ((wl->quirks & WLCORE_QUIRK_AP_ZERO_SESSION_ID) && - (wlvif->bss_type == BSS_TYPE_AP_BSS)) - session_id = 0; - - /* configure the tx attributes */ - tx_attr = session_id << TX_HW_ATTR_OFST_SESSION_COUNTER; - } - - desc->hlid = hlid; - if (is_dummy || !wlvif) - rate_idx = 0; - else if (wlvif->bss_type != BSS_TYPE_AP_BSS) { - /* - * if the packets are data packets - * send them with AP rate policies (EAPOLs are an exception), - * otherwise use default basic rates - */ - if (skb->protocol == cpu_to_be16(ETH_P_PAE)) - rate_idx = wlvif->sta.basic_rate_idx; - else if (control->flags & IEEE80211_TX_CTL_NO_CCK_RATE) - rate_idx = wlvif->sta.p2p_rate_idx; - else if (ieee80211_is_data(frame_control)) - rate_idx = wlvif->sta.ap_rate_idx; - else - rate_idx = wlvif->sta.basic_rate_idx; - } else { - if (hlid == wlvif->ap.global_hlid) - rate_idx = wlvif->ap.mgmt_rate_idx; - else if (hlid == wlvif->ap.bcast_hlid || - skb->protocol == cpu_to_be16(ETH_P_PAE) || - !ieee80211_is_data(frame_control)) - /* - * send non-data, bcast and EAPOLs using the - * min basic rate - */ - rate_idx = wlvif->ap.bcast_rate_idx; - else - rate_idx = wlvif->ap.ucast_rate_idx[ac]; - } - - tx_attr |= rate_idx << TX_HW_ATTR_OFST_RATE_POLICY; - - /* for WEP shared auth - no fw encryption is needed */ - if (ieee80211_is_auth(frame_control) && - ieee80211_has_protected(frame_control)) - tx_attr |= TX_HW_ATTR_HOST_ENCRYPT; - - desc->tx_attr = cpu_to_le16(tx_attr); - - wlcore_hw_set_tx_desc_csum(wl, desc, skb); - wlcore_hw_set_tx_desc_data_len(wl, desc, skb); -} - -/* caller must hold wl->mutex */ -static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct sk_buff *skb, u32 buf_offset, u8 hlid) -{ - struct ieee80211_tx_info *info; - u32 extra = 0; - int ret = 0; - u32 total_len; - bool is_dummy; - bool is_gem = false; - - if (!skb) { - wl1271_error("discarding null skb"); - return -EINVAL; - } - - if (hlid == WL12XX_INVALID_LINK_ID) { - wl1271_error("invalid hlid. dropping skb 0x%p", skb); - return -EINVAL; - } - - info = IEEE80211_SKB_CB(skb); - - is_dummy = wl12xx_is_dummy_packet(wl, skb); - - if ((wl->quirks & WLCORE_QUIRK_TKIP_HEADER_SPACE) && - info->control.hw_key && - info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) - extra = WL1271_EXTRA_SPACE_TKIP; - - if (info->control.hw_key) { - bool is_wep; - u8 idx = info->control.hw_key->hw_key_idx; - u32 cipher = info->control.hw_key->cipher; - - is_wep = (cipher == WLAN_CIPHER_SUITE_WEP40) || - (cipher == WLAN_CIPHER_SUITE_WEP104); - - if (unlikely(is_wep && wlvif->default_key != idx)) { - ret = wl1271_set_default_wep_key(wl, wlvif, idx); - if (ret < 0) - return ret; - wlvif->default_key = idx; - } - - is_gem = (cipher == WL1271_CIPHER_SUITE_GEM); - } - - ret = wl1271_tx_allocate(wl, wlvif, skb, extra, buf_offset, hlid, - is_gem); - if (ret < 0) - return ret; - - wl1271_tx_fill_hdr(wl, wlvif, skb, extra, info, hlid); - - if (!is_dummy && wlvif && wlvif->bss_type == BSS_TYPE_AP_BSS) { - wl1271_tx_ap_update_inconnection_sta(wl, skb); - wl1271_tx_regulate_link(wl, wlvif, hlid); - } - - /* - * The length of each packet is stored in terms of - * words. Thus, we must pad the skb data to make sure its - * length is aligned. The number of padding bytes is computed - * and set in wl1271_tx_fill_hdr. - * In special cases, we want to align to a specific block size - * (eg. for wl128x with SDIO we align to 256). - */ - total_len = wlcore_calc_packet_alignment(wl, skb->len); - - memcpy(wl->aggr_buf + buf_offset, skb->data, skb->len); - memset(wl->aggr_buf + buf_offset + skb->len, 0, total_len - skb->len); - - /* Revert side effects in the dummy packet skb, so it can be reused */ - if (is_dummy) - skb_pull(skb, sizeof(struct wl1271_tx_hw_descr)); - - return total_len; -} - -u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set, - enum ieee80211_band rate_band) -{ - struct ieee80211_supported_band *band; - u32 enabled_rates = 0; - int bit; - - band = wl->hw->wiphy->bands[rate_band]; - for (bit = 0; bit < band->n_bitrates; bit++) { - if (rate_set & 0x1) - enabled_rates |= band->bitrates[bit].hw_value; - rate_set >>= 1; - } - - /* MCS rates indication are on bits 16 - 31 */ - rate_set >>= HW_HT_RATES_OFFSET - band->n_bitrates; - - for (bit = 0; bit < 16; bit++) { - if (rate_set & 0x1) - enabled_rates |= (CONF_HW_BIT_RATE_MCS_0 << bit); - rate_set >>= 1; - } - - return enabled_rates; -} - -void wl1271_handle_tx_low_watermark(struct wl1271 *wl) -{ - int i; - struct wl12xx_vif *wlvif; - - wl12xx_for_each_wlvif(wl, wlvif) { - for (i = 0; i < NUM_TX_QUEUES; i++) { - if (wlcore_is_queue_stopped_by_reason(wl, wlvif, i, - WLCORE_QUEUE_STOP_REASON_WATERMARK) && - wlvif->tx_queue_count[i] <= - WL1271_TX_QUEUE_LOW_WATERMARK) - /* firmware buffer has space, restart queues */ - wlcore_wake_queue(wl, wlvif, i, - WLCORE_QUEUE_STOP_REASON_WATERMARK); - } - } -} - -static int wlcore_select_ac(struct wl1271 *wl) -{ - int i, q = -1, ac; - u32 min_pkts = 0xffffffff; - - /* - * Find a non-empty ac where: - * 1. There are packets to transmit - * 2. The FW has the least allocated blocks - * - * We prioritize the ACs according to VO>VI>BE>BK - */ - for (i = 0; i < NUM_TX_QUEUES; i++) { - ac = wl1271_tx_get_queue(i); - if (wl->tx_queue_count[ac] && - wl->tx_allocated_pkts[ac] < min_pkts) { - q = ac; - min_pkts = wl->tx_allocated_pkts[q]; - } - } - - return q; -} - -static struct sk_buff *wlcore_lnk_dequeue(struct wl1271 *wl, - struct wl1271_link *lnk, u8 q) -{ - struct sk_buff *skb; - unsigned long flags; - - skb = skb_dequeue(&lnk->tx_queue[q]); - if (skb) { - spin_lock_irqsave(&wl->wl_lock, flags); - WARN_ON_ONCE(wl->tx_queue_count[q] <= 0); - wl->tx_queue_count[q]--; - if (lnk->wlvif) { - WARN_ON_ONCE(lnk->wlvif->tx_queue_count[q] <= 0); - lnk->wlvif->tx_queue_count[q]--; - } - spin_unlock_irqrestore(&wl->wl_lock, flags); - } - - return skb; -} - -static struct sk_buff *wlcore_lnk_dequeue_high_prio(struct wl1271 *wl, - u8 hlid, u8 ac, - u8 *low_prio_hlid) -{ - struct wl1271_link *lnk = &wl->links[hlid]; - - if (!wlcore_hw_lnk_high_prio(wl, hlid, lnk)) { - if (*low_prio_hlid == WL12XX_INVALID_LINK_ID && - !skb_queue_empty(&lnk->tx_queue[ac]) && - wlcore_hw_lnk_low_prio(wl, hlid, lnk)) - /* we found the first non-empty low priority queue */ - *low_prio_hlid = hlid; - - return NULL; - } - - return wlcore_lnk_dequeue(wl, lnk, ac); -} - -static struct sk_buff *wlcore_vif_dequeue_high_prio(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - u8 ac, u8 *hlid, - u8 *low_prio_hlid) -{ - struct sk_buff *skb = NULL; - int i, h, start_hlid; - - /* start from the link after the last one */ - start_hlid = (wlvif->last_tx_hlid + 1) % WL12XX_MAX_LINKS; - - /* dequeue according to AC, round robin on each link */ - for (i = 0; i < WL12XX_MAX_LINKS; i++) { - h = (start_hlid + i) % WL12XX_MAX_LINKS; - - /* only consider connected stations */ - if (!test_bit(h, wlvif->links_map)) - continue; - - skb = wlcore_lnk_dequeue_high_prio(wl, h, ac, - low_prio_hlid); - if (!skb) - continue; - - wlvif->last_tx_hlid = h; - break; - } - - if (!skb) - wlvif->last_tx_hlid = 0; - - *hlid = wlvif->last_tx_hlid; - return skb; -} - -static struct sk_buff *wl1271_skb_dequeue(struct wl1271 *wl, u8 *hlid) -{ - unsigned long flags; - struct wl12xx_vif *wlvif = wl->last_wlvif; - struct sk_buff *skb = NULL; - int ac; - u8 low_prio_hlid = WL12XX_INVALID_LINK_ID; - - ac = wlcore_select_ac(wl); - if (ac < 0) - goto out; - - /* continue from last wlvif (round robin) */ - if (wlvif) { - wl12xx_for_each_wlvif_continue(wl, wlvif) { - if (!wlvif->tx_queue_count[ac]) - continue; - - skb = wlcore_vif_dequeue_high_prio(wl, wlvif, ac, hlid, - &low_prio_hlid); - if (!skb) - continue; - - wl->last_wlvif = wlvif; - break; - } - } - - /* dequeue from the system HLID before the restarting wlvif list */ - if (!skb) { - skb = wlcore_lnk_dequeue_high_prio(wl, wl->system_hlid, - ac, &low_prio_hlid); - if (skb) { - *hlid = wl->system_hlid; - wl->last_wlvif = NULL; - } - } - - /* Do a new pass over the wlvif list. But no need to continue - * after last_wlvif. The previous pass should have found it. */ - if (!skb) { - wl12xx_for_each_wlvif(wl, wlvif) { - if (!wlvif->tx_queue_count[ac]) - goto next; - - skb = wlcore_vif_dequeue_high_prio(wl, wlvif, ac, hlid, - &low_prio_hlid); - if (skb) { - wl->last_wlvif = wlvif; - break; - } - -next: - if (wlvif == wl->last_wlvif) - break; - } - } - - /* no high priority skbs found - but maybe a low priority one? */ - if (!skb && low_prio_hlid != WL12XX_INVALID_LINK_ID) { - struct wl1271_link *lnk = &wl->links[low_prio_hlid]; - skb = wlcore_lnk_dequeue(wl, lnk, ac); - - WARN_ON(!skb); /* we checked this before */ - *hlid = low_prio_hlid; - - /* ensure proper round robin in the vif/link levels */ - wl->last_wlvif = lnk->wlvif; - if (lnk->wlvif) - lnk->wlvif->last_tx_hlid = low_prio_hlid; - - } - -out: - if (!skb && - test_and_clear_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags)) { - int q; - - skb = wl->dummy_packet; - *hlid = wl->system_hlid; - q = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); - spin_lock_irqsave(&wl->wl_lock, flags); - WARN_ON_ONCE(wl->tx_queue_count[q] <= 0); - wl->tx_queue_count[q]--; - spin_unlock_irqrestore(&wl->wl_lock, flags); - } - - return skb; -} - -static void wl1271_skb_queue_head(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct sk_buff *skb, u8 hlid) -{ - unsigned long flags; - int q = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); - - if (wl12xx_is_dummy_packet(wl, skb)) { - set_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags); - } else { - skb_queue_head(&wl->links[hlid].tx_queue[q], skb); - - /* make sure we dequeue the same packet next time */ - wlvif->last_tx_hlid = (hlid + WL12XX_MAX_LINKS - 1) % - WL12XX_MAX_LINKS; - } - - spin_lock_irqsave(&wl->wl_lock, flags); - wl->tx_queue_count[q]++; - if (wlvif) - wlvif->tx_queue_count[q]++; - spin_unlock_irqrestore(&wl->wl_lock, flags); -} - -static bool wl1271_tx_is_data_present(struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); - - return ieee80211_is_data_present(hdr->frame_control); -} - -void wl12xx_rearm_rx_streaming(struct wl1271 *wl, unsigned long *active_hlids) -{ - struct wl12xx_vif *wlvif; - u32 timeout; - u8 hlid; - - if (!wl->conf.rx_streaming.interval) - return; - - if (!wl->conf.rx_streaming.always && - !test_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags)) - return; - - timeout = wl->conf.rx_streaming.duration; - wl12xx_for_each_wlvif_sta(wl, wlvif) { - bool found = false; - for_each_set_bit(hlid, active_hlids, WL12XX_MAX_LINKS) { - if (test_bit(hlid, wlvif->links_map)) { - found = true; - break; - } - } - - if (!found) - continue; - - /* enable rx streaming */ - if (!test_bit(WLVIF_FLAG_RX_STREAMING_STARTED, &wlvif->flags)) - ieee80211_queue_work(wl->hw, - &wlvif->rx_streaming_enable_work); - - mod_timer(&wlvif->rx_streaming_timer, - jiffies + msecs_to_jiffies(timeout)); - } -} - -/* - * Returns failure values only in case of failed bus ops within this function. - * wl1271_prepare_tx_frame retvals won't be returned in order to avoid - * triggering recovery by higher layers when not necessary. - * In case a FW command fails within wl1271_prepare_tx_frame fails a recovery - * will be queued in wl1271_cmd_send. -EAGAIN/-EBUSY from prepare_tx_frame - * can occur and are legitimate so don't propagate. -EINVAL will emit a WARNING - * within prepare_tx_frame code but there's nothing we should do about those - * as well. - */ -int wlcore_tx_work_locked(struct wl1271 *wl) -{ - struct wl12xx_vif *wlvif; - struct sk_buff *skb; - struct wl1271_tx_hw_descr *desc; - u32 buf_offset = 0, last_len = 0; - bool sent_packets = false; - unsigned long active_hlids[BITS_TO_LONGS(WL12XX_MAX_LINKS)] = {0}; - int ret = 0; - int bus_ret = 0; - u8 hlid; - - if (unlikely(wl->state != WLCORE_STATE_ON)) - return 0; - - while ((skb = wl1271_skb_dequeue(wl, &hlid))) { - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - bool has_data = false; - - wlvif = NULL; - if (!wl12xx_is_dummy_packet(wl, skb)) - wlvif = wl12xx_vif_to_data(info->control.vif); - else - hlid = wl->system_hlid; - - has_data = wlvif && wl1271_tx_is_data_present(skb); - ret = wl1271_prepare_tx_frame(wl, wlvif, skb, buf_offset, - hlid); - if (ret == -EAGAIN) { - /* - * Aggregation buffer is full. - * Flush buffer and try again. - */ - wl1271_skb_queue_head(wl, wlvif, skb, hlid); - - buf_offset = wlcore_hw_pre_pkt_send(wl, buf_offset, - last_len); - bus_ret = wlcore_write_data(wl, REG_SLV_MEM_DATA, - wl->aggr_buf, buf_offset, true); - if (bus_ret < 0) - goto out; - - sent_packets = true; - buf_offset = 0; - continue; - } else if (ret == -EBUSY) { - /* - * Firmware buffer is full. - * Queue back last skb, and stop aggregating. - */ - wl1271_skb_queue_head(wl, wlvif, skb, hlid); - /* No work left, avoid scheduling redundant tx work */ - set_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags); - goto out_ack; - } else if (ret < 0) { - if (wl12xx_is_dummy_packet(wl, skb)) - /* - * fw still expects dummy packet, - * so re-enqueue it - */ - wl1271_skb_queue_head(wl, wlvif, skb, hlid); - else - ieee80211_free_txskb(wl->hw, skb); - goto out_ack; - } - last_len = ret; - buf_offset += last_len; - wl->tx_packets_count++; - if (has_data) { - desc = (struct wl1271_tx_hw_descr *) skb->data; - __set_bit(desc->hlid, active_hlids); - } - } - -out_ack: - if (buf_offset) { - buf_offset = wlcore_hw_pre_pkt_send(wl, buf_offset, last_len); - bus_ret = wlcore_write_data(wl, REG_SLV_MEM_DATA, wl->aggr_buf, - buf_offset, true); - if (bus_ret < 0) - goto out; - - sent_packets = true; - } - if (sent_packets) { - /* - * Interrupt the firmware with the new packets. This is only - * required for older hardware revisions - */ - if (wl->quirks & WLCORE_QUIRK_END_OF_TRANSACTION) { - bus_ret = wlcore_write32(wl, WL12XX_HOST_WR_ACCESS, - wl->tx_packets_count); - if (bus_ret < 0) - goto out; - } - - wl1271_handle_tx_low_watermark(wl); - } - wl12xx_rearm_rx_streaming(wl, active_hlids); - -out: - return bus_ret; -} - -void wl1271_tx_work(struct work_struct *work) -{ - struct wl1271 *wl = container_of(work, struct wl1271, tx_work); - int ret; - - mutex_lock(&wl->mutex); - ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) - goto out; - - ret = wlcore_tx_work_locked(wl); - if (ret < 0) { - wl12xx_queue_recovery_work(wl); - goto out; - } - - wl1271_ps_elp_sleep(wl); -out: - mutex_unlock(&wl->mutex); -} - -static u8 wl1271_tx_get_rate_flags(u8 rate_class_index) -{ - u8 flags = 0; - - /* - * TODO: use wl12xx constants when this code is moved to wl12xx, as - * only it uses Tx-completion. - */ - if (rate_class_index <= 8) - flags |= IEEE80211_TX_RC_MCS; - - /* - * TODO: use wl12xx constants when this code is moved to wl12xx, as - * only it uses Tx-completion. - */ - if (rate_class_index == 0) - flags |= IEEE80211_TX_RC_SHORT_GI; - - return flags; -} - -static void wl1271_tx_complete_packet(struct wl1271 *wl, - struct wl1271_tx_hw_res_descr *result) -{ - struct ieee80211_tx_info *info; - struct ieee80211_vif *vif; - struct wl12xx_vif *wlvif; - struct sk_buff *skb; - int id = result->id; - int rate = -1; - u8 rate_flags = 0; - u8 retries = 0; - - /* check for id legality */ - if (unlikely(id >= wl->num_tx_desc || wl->tx_frames[id] == NULL)) { - wl1271_warning("TX result illegal id: %d", id); - return; - } - - skb = wl->tx_frames[id]; - info = IEEE80211_SKB_CB(skb); - - if (wl12xx_is_dummy_packet(wl, skb)) { - wl1271_free_tx_id(wl, id); - return; - } - - /* info->control is valid as long as we don't update info->status */ - vif = info->control.vif; - wlvif = wl12xx_vif_to_data(vif); - - /* update the TX status info */ - if (result->status == TX_SUCCESS) { - if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) - info->flags |= IEEE80211_TX_STAT_ACK; - rate = wlcore_rate_to_idx(wl, result->rate_class_index, - wlvif->band); - rate_flags = wl1271_tx_get_rate_flags(result->rate_class_index); - retries = result->ack_failures; - } else if (result->status == TX_RETRY_EXCEEDED) { - wl->stats.excessive_retries++; - retries = result->ack_failures; - } - - info->status.rates[0].idx = rate; - info->status.rates[0].count = retries; - info->status.rates[0].flags = rate_flags; - info->status.ack_signal = -1; - - wl->stats.retry_count += result->ack_failures; - - /* remove private header from packet */ - skb_pull(skb, sizeof(struct wl1271_tx_hw_descr)); - - /* remove TKIP header space if present */ - if ((wl->quirks & WLCORE_QUIRK_TKIP_HEADER_SPACE) && - info->control.hw_key && - info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) { - int hdrlen = ieee80211_get_hdrlen_from_skb(skb); - memmove(skb->data + WL1271_EXTRA_SPACE_TKIP, skb->data, - hdrlen); - skb_pull(skb, WL1271_EXTRA_SPACE_TKIP); - } - - wl1271_debug(DEBUG_TX, "tx status id %u skb 0x%p failures %u rate 0x%x" - " status 0x%x", - result->id, skb, result->ack_failures, - result->rate_class_index, result->status); - - /* return the packet to the stack */ - skb_queue_tail(&wl->deferred_tx_queue, skb); - queue_work(wl->freezable_wq, &wl->netstack_work); - wl1271_free_tx_id(wl, result->id); -} - -/* Called upon reception of a TX complete interrupt */ -int wlcore_tx_complete(struct wl1271 *wl) -{ - struct wl1271_acx_mem_map *memmap = wl->target_mem_map; - u32 count, fw_counter; - u32 i; - int ret; - - /* read the tx results from the chipset */ - ret = wlcore_read(wl, le32_to_cpu(memmap->tx_result), - wl->tx_res_if, sizeof(*wl->tx_res_if), false); - if (ret < 0) - goto out; - - fw_counter = le32_to_cpu(wl->tx_res_if->tx_result_fw_counter); - - /* write host counter to chipset (to ack) */ - ret = wlcore_write32(wl, le32_to_cpu(memmap->tx_result) + - offsetof(struct wl1271_tx_hw_res_if, - tx_result_host_counter), fw_counter); - if (ret < 0) - goto out; - - count = fw_counter - wl->tx_results_count; - wl1271_debug(DEBUG_TX, "tx_complete received, packets: %d", count); - - /* verify that the result buffer is not getting overrun */ - if (unlikely(count > TX_HW_RESULT_QUEUE_LEN)) - wl1271_warning("TX result overflow from chipset: %d", count); - - /* process the results */ - for (i = 0; i < count; i++) { - struct wl1271_tx_hw_res_descr *result; - u8 offset = wl->tx_results_count & TX_HW_RESULT_QUEUE_LEN_MASK; - - /* process the packet */ - result = &(wl->tx_res_if->tx_results_queue[offset]); - wl1271_tx_complete_packet(wl, result); - - wl->tx_results_count++; - } - -out: - return ret; -} -EXPORT_SYMBOL(wlcore_tx_complete); - -void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid) -{ - struct sk_buff *skb; - int i; - unsigned long flags; - struct ieee80211_tx_info *info; - int total[NUM_TX_QUEUES]; - struct wl1271_link *lnk = &wl->links[hlid]; - - for (i = 0; i < NUM_TX_QUEUES; i++) { - total[i] = 0; - while ((skb = skb_dequeue(&lnk->tx_queue[i]))) { - wl1271_debug(DEBUG_TX, "link freeing skb 0x%p", skb); - - if (!wl12xx_is_dummy_packet(wl, skb)) { - info = IEEE80211_SKB_CB(skb); - info->status.rates[0].idx = -1; - info->status.rates[0].count = 0; - ieee80211_tx_status_ni(wl->hw, skb); - } - - total[i]++; - } - } - - spin_lock_irqsave(&wl->wl_lock, flags); - for (i = 0; i < NUM_TX_QUEUES; i++) { - wl->tx_queue_count[i] -= total[i]; - if (lnk->wlvif) - lnk->wlvif->tx_queue_count[i] -= total[i]; - } - spin_unlock_irqrestore(&wl->wl_lock, flags); - - wl1271_handle_tx_low_watermark(wl); -} - -/* caller must hold wl->mutex and TX must be stopped */ -void wl12xx_tx_reset_wlvif(struct wl1271 *wl, struct wl12xx_vif *wlvif) -{ - int i; - - /* TX failure */ - for_each_set_bit(i, wlvif->links_map, WL12XX_MAX_LINKS) { - if (wlvif->bss_type == BSS_TYPE_AP_BSS && - i != wlvif->ap.bcast_hlid && i != wlvif->ap.global_hlid) { - /* this calls wl12xx_free_link */ - wl1271_free_sta(wl, wlvif, i); - } else { - u8 hlid = i; - wl12xx_free_link(wl, wlvif, &hlid); - } - } - wlvif->last_tx_hlid = 0; - - for (i = 0; i < NUM_TX_QUEUES; i++) - wlvif->tx_queue_count[i] = 0; -} -/* caller must hold wl->mutex and TX must be stopped */ -void wl12xx_tx_reset(struct wl1271 *wl) -{ - int i; - struct sk_buff *skb; - struct ieee80211_tx_info *info; - - /* only reset the queues if something bad happened */ - if (wl1271_tx_total_queue_count(wl) != 0) { - for (i = 0; i < WL12XX_MAX_LINKS; i++) - wl1271_tx_reset_link_queues(wl, i); - - for (i = 0; i < NUM_TX_QUEUES; i++) - wl->tx_queue_count[i] = 0; - } - - /* - * Make sure the driver is at a consistent state, in case this - * function is called from a context other than interface removal. - * This call will always wake the TX queues. - */ - wl1271_handle_tx_low_watermark(wl); - - for (i = 0; i < wl->num_tx_desc; i++) { - if (wl->tx_frames[i] == NULL) - continue; - - skb = wl->tx_frames[i]; - wl1271_free_tx_id(wl, i); - wl1271_debug(DEBUG_TX, "freeing skb 0x%p", skb); - - if (!wl12xx_is_dummy_packet(wl, skb)) { - /* - * Remove private headers before passing the skb to - * mac80211 - */ - info = IEEE80211_SKB_CB(skb); - skb_pull(skb, sizeof(struct wl1271_tx_hw_descr)); - if ((wl->quirks & WLCORE_QUIRK_TKIP_HEADER_SPACE) && - info->control.hw_key && - info->control.hw_key->cipher == - WLAN_CIPHER_SUITE_TKIP) { - int hdrlen = ieee80211_get_hdrlen_from_skb(skb); - memmove(skb->data + WL1271_EXTRA_SPACE_TKIP, - skb->data, hdrlen); - skb_pull(skb, WL1271_EXTRA_SPACE_TKIP); - } - - info->status.rates[0].idx = -1; - info->status.rates[0].count = 0; - - ieee80211_tx_status_ni(wl->hw, skb); - } - } -} - -#define WL1271_TX_FLUSH_TIMEOUT 500000 - -/* caller must *NOT* hold wl->mutex */ -void wl1271_tx_flush(struct wl1271 *wl) -{ - unsigned long timeout, start_time; - int i; - start_time = jiffies; - timeout = start_time + usecs_to_jiffies(WL1271_TX_FLUSH_TIMEOUT); - - /* only one flush should be in progress, for consistent queue state */ - mutex_lock(&wl->flush_mutex); - - mutex_lock(&wl->mutex); - if (wl->tx_frames_cnt == 0 && wl1271_tx_total_queue_count(wl) == 0) { - mutex_unlock(&wl->mutex); - goto out; - } - - wlcore_stop_queues(wl, WLCORE_QUEUE_STOP_REASON_FLUSH); - - while (!time_after(jiffies, timeout)) { - wl1271_debug(DEBUG_MAC80211, "flushing tx buffer: %d %d", - wl->tx_frames_cnt, - wl1271_tx_total_queue_count(wl)); - - /* force Tx and give the driver some time to flush data */ - mutex_unlock(&wl->mutex); - if (wl1271_tx_total_queue_count(wl)) - wl1271_tx_work(&wl->tx_work); - msleep(20); - mutex_lock(&wl->mutex); - - if ((wl->tx_frames_cnt == 0) && - (wl1271_tx_total_queue_count(wl) == 0)) { - wl1271_debug(DEBUG_MAC80211, "tx flush took %d ms", - jiffies_to_msecs(jiffies - start_time)); - goto out_wake; - } - } - - wl1271_warning("Unable to flush all TX buffers, " - "timed out (timeout %d ms", - WL1271_TX_FLUSH_TIMEOUT / 1000); - - /* forcibly flush all Tx buffers on our queues */ - for (i = 0; i < WL12XX_MAX_LINKS; i++) - wl1271_tx_reset_link_queues(wl, i); - -out_wake: - wlcore_wake_queues(wl, WLCORE_QUEUE_STOP_REASON_FLUSH); - mutex_unlock(&wl->mutex); -out: - mutex_unlock(&wl->flush_mutex); -} -EXPORT_SYMBOL_GPL(wl1271_tx_flush); - -u32 wl1271_tx_min_rate_get(struct wl1271 *wl, u32 rate_set) -{ - if (WARN_ON(!rate_set)) - return 0; - - return BIT(__ffs(rate_set)); -} -EXPORT_SYMBOL_GPL(wl1271_tx_min_rate_get); - -void wlcore_stop_queue_locked(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 queue, enum wlcore_queue_stop_reason reason) -{ - int hwq = wlcore_tx_get_mac80211_queue(wlvif, queue); - bool stopped = !!wl->queue_stop_reasons[hwq]; - - /* queue should not be stopped for this reason */ - WARN_ON_ONCE(test_and_set_bit(reason, &wl->queue_stop_reasons[hwq])); - - if (stopped) - return; - - ieee80211_stop_queue(wl->hw, hwq); -} - -void wlcore_stop_queue(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 queue, - enum wlcore_queue_stop_reason reason) -{ - unsigned long flags; - - spin_lock_irqsave(&wl->wl_lock, flags); - wlcore_stop_queue_locked(wl, wlvif, queue, reason); - spin_unlock_irqrestore(&wl->wl_lock, flags); -} - -void wlcore_wake_queue(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 queue, - enum wlcore_queue_stop_reason reason) -{ - unsigned long flags; - int hwq = wlcore_tx_get_mac80211_queue(wlvif, queue); - - spin_lock_irqsave(&wl->wl_lock, flags); - - /* queue should not be clear for this reason */ - WARN_ON_ONCE(!test_and_clear_bit(reason, &wl->queue_stop_reasons[hwq])); - - if (wl->queue_stop_reasons[hwq]) - goto out; - - ieee80211_wake_queue(wl->hw, hwq); - -out: - spin_unlock_irqrestore(&wl->wl_lock, flags); -} - -void wlcore_stop_queues(struct wl1271 *wl, - enum wlcore_queue_stop_reason reason) -{ - int i; - unsigned long flags; - - spin_lock_irqsave(&wl->wl_lock, flags); - - /* mark all possible queues as stopped */ - for (i = 0; i < WLCORE_NUM_MAC_ADDRESSES * NUM_TX_QUEUES; i++) - WARN_ON_ONCE(test_and_set_bit(reason, - &wl->queue_stop_reasons[i])); - - /* use the global version to make sure all vifs in mac80211 we don't - * know are stopped. - */ - ieee80211_stop_queues(wl->hw); - - spin_unlock_irqrestore(&wl->wl_lock, flags); -} - -void wlcore_wake_queues(struct wl1271 *wl, - enum wlcore_queue_stop_reason reason) -{ - int i; - unsigned long flags; - - spin_lock_irqsave(&wl->wl_lock, flags); - - /* mark all possible queues as awake */ - for (i = 0; i < WLCORE_NUM_MAC_ADDRESSES * NUM_TX_QUEUES; i++) - WARN_ON_ONCE(!test_and_clear_bit(reason, - &wl->queue_stop_reasons[i])); - - /* use the global version to make sure all vifs in mac80211 we don't - * know are woken up. - */ - ieee80211_wake_queues(wl->hw); - - spin_unlock_irqrestore(&wl->wl_lock, flags); -} - -bool wlcore_is_queue_stopped_by_reason(struct wl1271 *wl, - struct wl12xx_vif *wlvif, u8 queue, - enum wlcore_queue_stop_reason reason) -{ - unsigned long flags; - bool stopped; - - spin_lock_irqsave(&wl->wl_lock, flags); - stopped = wlcore_is_queue_stopped_by_reason_locked(wl, wlvif, queue, - reason); - spin_unlock_irqrestore(&wl->wl_lock, flags); - - return stopped; -} - -bool wlcore_is_queue_stopped_by_reason_locked(struct wl1271 *wl, - struct wl12xx_vif *wlvif, u8 queue, - enum wlcore_queue_stop_reason reason) -{ - int hwq = wlcore_tx_get_mac80211_queue(wlvif, queue); - - assert_spin_locked(&wl->wl_lock); - return test_bit(reason, &wl->queue_stop_reasons[hwq]); -} - -bool wlcore_is_queue_stopped_locked(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 queue) -{ - int hwq = wlcore_tx_get_mac80211_queue(wlvif, queue); - - assert_spin_locked(&wl->wl_lock); - return !!wl->queue_stop_reasons[hwq]; -} diff --git a/drivers/net/wireless/ti/wlcore/tx.h b/drivers/net/wireless/ti/wlcore/tx.h deleted file mode 100644 index 55aa4acf9105..000000000000 --- a/drivers/net/wireless/ti/wlcore/tx.h +++ /dev/null @@ -1,283 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 1998-2009 Texas Instruments. All rights reserved. - * Copyright (C) 2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __TX_H__ -#define __TX_H__ - -#define TX_HW_MGMT_PKT_LIFETIME_TU 2000 -#define TX_HW_AP_MODE_PKT_LIFETIME_TU 8000 - -#define TX_HW_ATTR_SAVE_RETRIES BIT(0) -#define TX_HW_ATTR_HEADER_PAD BIT(1) -#define TX_HW_ATTR_SESSION_COUNTER (BIT(2) | BIT(3) | BIT(4)) -#define TX_HW_ATTR_RATE_POLICY (BIT(5) | BIT(6) | BIT(7) | \ - BIT(8) | BIT(9)) -#define TX_HW_ATTR_LAST_WORD_PAD (BIT(10) | BIT(11)) -#define TX_HW_ATTR_TX_CMPLT_REQ BIT(12) -#define TX_HW_ATTR_TX_DUMMY_REQ BIT(13) -#define TX_HW_ATTR_HOST_ENCRYPT BIT(14) - -#define TX_HW_ATTR_OFST_SAVE_RETRIES 0 -#define TX_HW_ATTR_OFST_HEADER_PAD 1 -#define TX_HW_ATTR_OFST_SESSION_COUNTER 2 -#define TX_HW_ATTR_OFST_RATE_POLICY 5 -#define TX_HW_ATTR_OFST_LAST_WORD_PAD 10 -#define TX_HW_ATTR_OFST_TX_CMPLT_REQ 12 - -#define TX_HW_RESULT_QUEUE_LEN 16 -#define TX_HW_RESULT_QUEUE_LEN_MASK 0xf - -#define WL1271_TX_ALIGN_TO 4 -#define WL1271_EXTRA_SPACE_TKIP 4 -#define WL1271_EXTRA_SPACE_AES 8 -#define WL1271_EXTRA_SPACE_MAX 8 - -/* Used for management frames and dummy packets */ -#define WL1271_TID_MGMT 7 - -struct wl127x_tx_mem { - /* - * Number of extra memory blocks to allocate for this packet - * in addition to the number of blocks derived from the packet - * length. - */ - u8 extra_blocks; - /* - * Total number of memory blocks allocated by the host for - * this packet. Must be equal or greater than the actual - * blocks number allocated by HW. - */ - u8 total_mem_blocks; -} __packed; - -struct wl128x_tx_mem { - /* - * Total number of memory blocks allocated by the host for - * this packet. - */ - u8 total_mem_blocks; - /* - * Number of extra bytes, at the end of the frame. the host - * uses this padding to complete each frame to integer number - * of SDIO blocks. - */ - u8 extra_bytes; -} __packed; - -struct wl18xx_tx_mem { - /* - * Total number of memory blocks allocated by the host for - * this packet. - */ - u8 total_mem_blocks; - - /* - * control bits - */ - u8 ctrl; -} __packed; - -/* - * On wl128x based devices, when TX packets are aggregated, each packet - * size must be aligned to the SDIO block size. The maximum block size - * is bounded by the type of the padded bytes field that is sent to the - * FW. Currently the type is u8, so the maximum block size is 256 bytes. - */ -#define WL12XX_BUS_BLOCK_SIZE min(512u, \ - (1u << (8 * sizeof(((struct wl128x_tx_mem *) 0)->extra_bytes)))) - -struct wl1271_tx_hw_descr { - /* Length of packet in words, including descriptor+header+data */ - __le16 length; - union { - struct wl127x_tx_mem wl127x_mem; - struct wl128x_tx_mem wl128x_mem; - struct wl18xx_tx_mem wl18xx_mem; - } __packed; - /* Device time (in us) when the packet arrived to the driver */ - __le32 start_time; - /* - * Max delay in TUs until transmission. The last device time the - * packet can be transmitted is: start_time + (1024 * life_time) - */ - __le16 life_time; - /* Bitwise fields - see TX_ATTR... definitions above. */ - __le16 tx_attr; - /* Packet identifier used also in the Tx-Result. */ - u8 id; - /* The packet TID value (as User-Priority) */ - u8 tid; - /* host link ID (HLID) */ - u8 hlid; - - union { - u8 wl12xx_reserved; - - /* - * bit 0 -> 0 = udp, 1 = tcp - * bit 1:7 -> IP header offset - */ - u8 wl18xx_checksum_data; - } __packed; -} __packed; - -enum wl1271_tx_hw_res_status { - TX_SUCCESS = 0, - TX_HW_ERROR = 1, - TX_DISABLED = 2, - TX_RETRY_EXCEEDED = 3, - TX_TIMEOUT = 4, - TX_KEY_NOT_FOUND = 5, - TX_PEER_NOT_FOUND = 6, - TX_SESSION_MISMATCH = 7, - TX_LINK_NOT_VALID = 8, -}; - -struct wl1271_tx_hw_res_descr { - /* Packet Identifier - same value used in the Tx descriptor.*/ - u8 id; - /* The status of the transmission, indicating success or one of - several possible reasons for failure. */ - u8 status; - /* Total air access duration including all retrys and overheads.*/ - __le16 medium_usage; - /* The time passed from host xfer to Tx-complete.*/ - __le32 fw_handling_time; - /* Total media delay - (from 1st EDCA AIFS counter until TX Complete). */ - __le32 medium_delay; - /* LS-byte of last TKIP seq-num (saved per AC for recovery). */ - u8 tx_security_sequence_number_lsb; - /* Retry count - number of transmissions without successful ACK.*/ - u8 ack_failures; - /* The rate that succeeded getting ACK - (Valid only if status=SUCCESS). */ - u8 rate_class_index; - /* for 4-byte alignment. */ - u8 spare; -} __packed; - -struct wl1271_tx_hw_res_if { - __le32 tx_result_fw_counter; - __le32 tx_result_host_counter; - struct wl1271_tx_hw_res_descr tx_results_queue[TX_HW_RESULT_QUEUE_LEN]; -} __packed; - -enum wlcore_queue_stop_reason { - WLCORE_QUEUE_STOP_REASON_WATERMARK, - WLCORE_QUEUE_STOP_REASON_FW_RESTART, - WLCORE_QUEUE_STOP_REASON_FLUSH, - WLCORE_QUEUE_STOP_REASON_SPARE_BLK, /* 18xx specific */ -}; - -static inline int wl1271_tx_get_queue(int queue) -{ - switch (queue) { - case 0: - return CONF_TX_AC_VO; - case 1: - return CONF_TX_AC_VI; - case 2: - return CONF_TX_AC_BE; - case 3: - return CONF_TX_AC_BK; - default: - return CONF_TX_AC_BE; - } -} - -static inline -int wlcore_tx_get_mac80211_queue(struct wl12xx_vif *wlvif, int queue) -{ - int mac_queue = wlvif->hw_queue_base; - - switch (queue) { - case CONF_TX_AC_VO: - return mac_queue + 0; - case CONF_TX_AC_VI: - return mac_queue + 1; - case CONF_TX_AC_BE: - return mac_queue + 2; - case CONF_TX_AC_BK: - return mac_queue + 3; - default: - return mac_queue + 2; - } -} - -static inline int wl1271_tx_total_queue_count(struct wl1271 *wl) -{ - int i, count = 0; - - for (i = 0; i < NUM_TX_QUEUES; i++) - count += wl->tx_queue_count[i]; - - return count; -} - -void wl1271_tx_work(struct work_struct *work); -int wlcore_tx_work_locked(struct wl1271 *wl); -int wlcore_tx_complete(struct wl1271 *wl); -void wl12xx_tx_reset_wlvif(struct wl1271 *wl, struct wl12xx_vif *wlvif); -void wl12xx_tx_reset(struct wl1271 *wl); -void wl1271_tx_flush(struct wl1271 *wl); -u8 wlcore_rate_to_idx(struct wl1271 *wl, u8 rate, enum ieee80211_band band); -u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set, - enum ieee80211_band rate_band); -u32 wl1271_tx_min_rate_get(struct wl1271 *wl, u32 rate_set); -u8 wl12xx_tx_get_hlid(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct sk_buff *skb, struct ieee80211_sta *sta); -void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid); -void wl1271_handle_tx_low_watermark(struct wl1271 *wl); -bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb); -void wl12xx_rearm_rx_streaming(struct wl1271 *wl, unsigned long *active_hlids); -unsigned int wlcore_calc_packet_alignment(struct wl1271 *wl, - unsigned int packet_length); -void wl1271_free_tx_id(struct wl1271 *wl, int id); -void wlcore_stop_queue_locked(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 queue, enum wlcore_queue_stop_reason reason); -void wlcore_stop_queue(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 queue, - enum wlcore_queue_stop_reason reason); -void wlcore_wake_queue(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 queue, - enum wlcore_queue_stop_reason reason); -void wlcore_stop_queues(struct wl1271 *wl, - enum wlcore_queue_stop_reason reason); -void wlcore_wake_queues(struct wl1271 *wl, - enum wlcore_queue_stop_reason reason); -bool wlcore_is_queue_stopped_by_reason(struct wl1271 *wl, - struct wl12xx_vif *wlvif, u8 queue, - enum wlcore_queue_stop_reason reason); -bool -wlcore_is_queue_stopped_by_reason_locked(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - u8 queue, - enum wlcore_queue_stop_reason reason); -bool wlcore_is_queue_stopped_locked(struct wl1271 *wl, struct wl12xx_vif *wlvif, - u8 queue); - -/* from main.c */ -void wl1271_free_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 hlid); -void wl12xx_rearm_tx_watchdog_locked(struct wl1271 *wl); - -#endif diff --git a/drivers/net/wireless/ti/wlcore/wl12xx_80211.h b/drivers/net/wireless/ti/wlcore/wl12xx_80211.h deleted file mode 100644 index 22b0bc98d7b5..000000000000 --- a/drivers/net/wireless/ti/wlcore/wl12xx_80211.h +++ /dev/null @@ -1,137 +0,0 @@ -#ifndef __WL12XX_80211_H__ -#define __WL12XX_80211_H__ - -#include /* ETH_ALEN */ -#include - -/* RATES */ -#define IEEE80211_CCK_RATE_1MB 0x02 -#define IEEE80211_CCK_RATE_2MB 0x04 -#define IEEE80211_CCK_RATE_5MB 0x0B -#define IEEE80211_CCK_RATE_11MB 0x16 -#define IEEE80211_OFDM_RATE_6MB 0x0C -#define IEEE80211_OFDM_RATE_9MB 0x12 -#define IEEE80211_OFDM_RATE_12MB 0x18 -#define IEEE80211_OFDM_RATE_18MB 0x24 -#define IEEE80211_OFDM_RATE_24MB 0x30 -#define IEEE80211_OFDM_RATE_36MB 0x48 -#define IEEE80211_OFDM_RATE_48MB 0x60 -#define IEEE80211_OFDM_RATE_54MB 0x6C -#define IEEE80211_BASIC_RATE_MASK 0x80 - -#define IEEE80211_CCK_RATE_1MB_MASK (1<<0) -#define IEEE80211_CCK_RATE_2MB_MASK (1<<1) -#define IEEE80211_CCK_RATE_5MB_MASK (1<<2) -#define IEEE80211_CCK_RATE_11MB_MASK (1<<3) -#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4) -#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5) -#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6) -#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7) -#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8) -#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9) -#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) -#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) - -#define IEEE80211_CCK_RATES_MASK 0x0000000F -#define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ - IEEE80211_CCK_RATE_2MB_MASK) -#define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ - IEEE80211_CCK_RATE_5MB_MASK | \ - IEEE80211_CCK_RATE_11MB_MASK) - -#define IEEE80211_OFDM_RATES_MASK 0x00000FF0 -#define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ - IEEE80211_OFDM_RATE_12MB_MASK | \ - IEEE80211_OFDM_RATE_24MB_MASK) -#define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \ - IEEE80211_OFDM_RATE_9MB_MASK | \ - IEEE80211_OFDM_RATE_18MB_MASK | \ - IEEE80211_OFDM_RATE_36MB_MASK | \ - IEEE80211_OFDM_RATE_48MB_MASK | \ - IEEE80211_OFDM_RATE_54MB_MASK) -#define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ - IEEE80211_CCK_DEFAULT_RATES_MASK) - - -/* This really should be 8, but not for our firmware */ -#define MAX_SUPPORTED_RATES 32 -#define MAX_COUNTRY_TRIPLETS 32 - -/* Headers */ -struct ieee80211_header { - __le16 frame_ctl; - __le16 duration_id; - u8 da[ETH_ALEN]; - u8 sa[ETH_ALEN]; - u8 bssid[ETH_ALEN]; - __le16 seq_ctl; - u8 payload[0]; -} __packed; - -struct wl12xx_ie_header { - u8 id; - u8 len; -} __packed; - -/* IEs */ - -struct wl12xx_ie_ssid { - struct wl12xx_ie_header header; - char ssid[IEEE80211_MAX_SSID_LEN]; -} __packed; - -struct wl12xx_ie_rates { - struct wl12xx_ie_header header; - u8 rates[MAX_SUPPORTED_RATES]; -} __packed; - -struct wl12xx_ie_ds_params { - struct wl12xx_ie_header header; - u8 channel; -} __packed; - -struct country_triplet { - u8 channel; - u8 num_channels; - u8 max_tx_power; -} __packed; - -struct wl12xx_ie_country { - struct wl12xx_ie_header header; - u8 country_string[IEEE80211_COUNTRY_STRING_LEN]; - struct country_triplet triplets[MAX_COUNTRY_TRIPLETS]; -} __packed; - - -/* Templates */ - -struct wl12xx_null_data_template { - struct ieee80211_header header; -} __packed; - -struct wl12xx_ps_poll_template { - __le16 fc; - __le16 aid; - u8 bssid[ETH_ALEN]; - u8 ta[ETH_ALEN]; -} __packed; - -struct wl12xx_arp_rsp_template { - /* not including ieee80211 header */ - - u8 llc_hdr[sizeof(rfc1042_header)]; - __be16 llc_type; - - struct arphdr arp_hdr; - u8 sender_hw[ETH_ALEN]; - __be32 sender_ip; - u8 target_hw[ETH_ALEN]; - __be32 target_ip; -} __packed; - -struct wl12xx_disconn_template { - struct ieee80211_header header; - __le16 disconn_reason; -} __packed; - -#endif diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h deleted file mode 100644 index 0034979e97cb..000000000000 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++ /dev/null @@ -1,616 +0,0 @@ -/* - * This file is part of wlcore - * - * Copyright (C) 2011 Texas Instruments Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WLCORE_H__ -#define __WLCORE_H__ - -#include - -#include "wlcore_i.h" -#include "event.h" -#include "boot.h" - -/* The maximum number of Tx descriptors in all chip families */ -#define WLCORE_MAX_TX_DESCRIPTORS 32 - -/* - * We always allocate this number of mac addresses. If we don't - * have enough allocated addresses, the LAA bit is used - */ -#define WLCORE_NUM_MAC_ADDRESSES 3 - -/* wl12xx/wl18xx maximum transmission power (in dBm) */ -#define WLCORE_MAX_TXPWR 25 - -/* forward declaration */ -struct wl1271_tx_hw_descr; -enum wl_rx_buf_align; -struct wl1271_rx_descriptor; - -struct wlcore_ops { - int (*setup)(struct wl1271 *wl); - int (*identify_chip)(struct wl1271 *wl); - int (*identify_fw)(struct wl1271 *wl); - int (*boot)(struct wl1271 *wl); - int (*plt_init)(struct wl1271 *wl); - int (*trigger_cmd)(struct wl1271 *wl, int cmd_box_addr, - void *buf, size_t len); - int (*ack_event)(struct wl1271 *wl); - int (*wait_for_event)(struct wl1271 *wl, enum wlcore_wait_event event, - bool *timeout); - int (*process_mailbox_events)(struct wl1271 *wl); - u32 (*calc_tx_blocks)(struct wl1271 *wl, u32 len, u32 spare_blks); - void (*set_tx_desc_blocks)(struct wl1271 *wl, - struct wl1271_tx_hw_descr *desc, - u32 blks, u32 spare_blks); - void (*set_tx_desc_data_len)(struct wl1271 *wl, - struct wl1271_tx_hw_descr *desc, - struct sk_buff *skb); - enum wl_rx_buf_align (*get_rx_buf_align)(struct wl1271 *wl, - u32 rx_desc); - int (*prepare_read)(struct wl1271 *wl, u32 rx_desc, u32 len); - u32 (*get_rx_packet_len)(struct wl1271 *wl, void *rx_data, - u32 data_len); - int (*tx_delayed_compl)(struct wl1271 *wl); - void (*tx_immediate_compl)(struct wl1271 *wl); - int (*hw_init)(struct wl1271 *wl); - int (*init_vif)(struct wl1271 *wl, struct wl12xx_vif *wlvif); - u32 (*sta_get_ap_rate_mask)(struct wl1271 *wl, - struct wl12xx_vif *wlvif); - int (*get_pg_ver)(struct wl1271 *wl, s8 *ver); - int (*get_mac)(struct wl1271 *wl); - void (*set_tx_desc_csum)(struct wl1271 *wl, - struct wl1271_tx_hw_descr *desc, - struct sk_buff *skb); - void (*set_rx_csum)(struct wl1271 *wl, - struct wl1271_rx_descriptor *desc, - struct sk_buff *skb); - u32 (*ap_get_mimo_wide_rate_mask)(struct wl1271 *wl, - struct wl12xx_vif *wlvif); - int (*debugfs_init)(struct wl1271 *wl, struct dentry *rootdir); - int (*handle_static_data)(struct wl1271 *wl, - struct wl1271_static_data *static_data); - int (*scan_start)(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct cfg80211_scan_request *req); - int (*scan_stop)(struct wl1271 *wl, struct wl12xx_vif *wlvif); - int (*sched_scan_start)(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct cfg80211_sched_scan_request *req, - struct ieee80211_sched_scan_ies *ies); - void (*sched_scan_stop)(struct wl1271 *wl, struct wl12xx_vif *wlvif); - int (*get_spare_blocks)(struct wl1271 *wl, bool is_gem); - int (*set_key)(struct wl1271 *wl, enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key_conf); - int (*channel_switch)(struct wl1271 *wl, - struct wl12xx_vif *wlvif, - struct ieee80211_channel_switch *ch_switch); - u32 (*pre_pkt_send)(struct wl1271 *wl, u32 buf_offset, u32 last_len); - void (*sta_rc_update)(struct wl1271 *wl, struct wl12xx_vif *wlvif, - struct ieee80211_sta *sta, u32 changed); - int (*set_peer_cap)(struct wl1271 *wl, - struct ieee80211_sta_ht_cap *ht_cap, - bool allow_ht_operation, - u32 rate_set, u8 hlid); - bool (*lnk_high_prio)(struct wl1271 *wl, u8 hlid, - struct wl1271_link *lnk); - bool (*lnk_low_prio)(struct wl1271 *wl, u8 hlid, - struct wl1271_link *lnk); -}; - -enum wlcore_partitions { - PART_DOWN, - PART_WORK, - PART_BOOT, - PART_DRPW, - PART_TOP_PRCM_ELP_SOC, - PART_PHY_INIT, - - PART_TABLE_LEN, -}; - -struct wlcore_partition { - u32 size; - u32 start; -}; - -struct wlcore_partition_set { - struct wlcore_partition mem; - struct wlcore_partition reg; - struct wlcore_partition mem2; - struct wlcore_partition mem3; -}; - -enum wlcore_registers { - /* register addresses, used with partition translation */ - REG_ECPU_CONTROL, - REG_INTERRUPT_NO_CLEAR, - REG_INTERRUPT_ACK, - REG_COMMAND_MAILBOX_PTR, - REG_EVENT_MAILBOX_PTR, - REG_INTERRUPT_TRIG, - REG_INTERRUPT_MASK, - REG_PC_ON_RECOVERY, - REG_CHIP_ID_B, - REG_CMD_MBOX_ADDRESS, - - /* data access memory addresses, used with partition translation */ - REG_SLV_MEM_DATA, - REG_SLV_REG_DATA, - - /* raw data access memory addresses */ - REG_RAW_FW_STATUS_ADDR, - - REG_TABLE_LEN, -}; - -struct wl1271_stats { - void *fw_stats; - unsigned long fw_stats_update; - size_t fw_stats_len; - - unsigned int retry_count; - unsigned int excessive_retries; -}; - -struct wl1271 { - bool initialized; - struct ieee80211_hw *hw; - bool mac80211_registered; - - struct device *dev; - struct platform_device *pdev; - - void *if_priv; - - struct wl1271_if_operations *if_ops; - - int irq; - - spinlock_t wl_lock; - - enum wlcore_state state; - enum wl12xx_fw_type fw_type; - bool plt; - enum plt_mode plt_mode; - u8 fem_manuf; - u8 last_vif_count; - struct mutex mutex; - - unsigned long flags; - - struct wlcore_partition_set curr_part; - - struct wl1271_chip chip; - - int cmd_box_addr; - - u8 *fw; - size_t fw_len; - void *nvs; - size_t nvs_len; - - s8 hw_pg_ver; - - /* address read from the fuse ROM */ - u32 fuse_oui_addr; - u32 fuse_nic_addr; - - /* we have up to 2 MAC addresses */ - struct mac_address addresses[WLCORE_NUM_MAC_ADDRESSES]; - int channel; - u8 system_hlid; - - unsigned long links_map[BITS_TO_LONGS(WL12XX_MAX_LINKS)]; - unsigned long roles_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)]; - unsigned long roc_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)]; - unsigned long rate_policies_map[ - BITS_TO_LONGS(WL12XX_MAX_RATE_POLICIES)]; - unsigned long klv_templates_map[ - BITS_TO_LONGS(WLCORE_MAX_KLV_TEMPLATES)]; - - u8 session_ids[WL12XX_MAX_LINKS]; - - struct list_head wlvif_list; - - u8 sta_count; - u8 ap_count; - - struct wl1271_acx_mem_map *target_mem_map; - - /* Accounting for allocated / available TX blocks on HW */ - u32 tx_blocks_freed; - u32 tx_blocks_available; - u32 tx_allocated_blocks; - u32 tx_results_count; - - /* Accounting for allocated / available Tx packets in HW */ - u32 tx_pkts_freed[NUM_TX_QUEUES]; - u32 tx_allocated_pkts[NUM_TX_QUEUES]; - - /* Transmitted TX packets counter for chipset interface */ - u32 tx_packets_count; - - /* Time-offset between host and chipset clocks */ - s64 time_offset; - - /* Frames scheduled for transmission, not handled yet */ - int tx_queue_count[NUM_TX_QUEUES]; - unsigned long queue_stop_reasons[ - NUM_TX_QUEUES * WLCORE_NUM_MAC_ADDRESSES]; - - /* Frames received, not handled yet by mac80211 */ - struct sk_buff_head deferred_rx_queue; - - /* Frames sent, not returned yet to mac80211 */ - struct sk_buff_head deferred_tx_queue; - - struct work_struct tx_work; - struct workqueue_struct *freezable_wq; - - /* Pending TX frames */ - unsigned long tx_frames_map[BITS_TO_LONGS(WLCORE_MAX_TX_DESCRIPTORS)]; - struct sk_buff *tx_frames[WLCORE_MAX_TX_DESCRIPTORS]; - int tx_frames_cnt; - - /* FW Rx counter */ - u32 rx_counter; - - /* Intermediate buffer, used for packet aggregation */ - u8 *aggr_buf; - u32 aggr_buf_size; - - /* Reusable dummy packet template */ - struct sk_buff *dummy_packet; - - /* Network stack work */ - struct work_struct netstack_work; - - /* FW log buffer */ - u8 *fwlog; - - /* Number of valid bytes in the FW log buffer */ - ssize_t fwlog_size; - - /* Sysfs FW log entry readers wait queue */ - wait_queue_head_t fwlog_waitq; - - /* Hardware recovery work */ - struct work_struct recovery_work; - bool watchdog_recovery; - - /* Reg domain last configuration */ - u32 reg_ch_conf_last[2]; - /* Reg domain pending configuration */ - u32 reg_ch_conf_pending[2]; - - /* Pointer that holds DMA-friendly block for the mailbox */ - void *mbox; - - /* The mbox event mask */ - u32 event_mask; - - /* Mailbox pointers */ - u32 mbox_size; - u32 mbox_ptr[2]; - - /* Are we currently scanning */ - struct wl12xx_vif *scan_wlvif; - struct wl1271_scan scan; - struct delayed_work scan_complete_work; - - struct ieee80211_vif *roc_vif; - struct delayed_work roc_complete_work; - - struct wl12xx_vif *sched_vif; - - /* The current band */ - enum ieee80211_band band; - - struct completion *elp_compl; - struct delayed_work elp_work; - - /* in dBm */ - int power_level; - - struct wl1271_stats stats; - - __le32 *buffer_32; - u32 buffer_cmd; - u32 buffer_busyword[WL1271_BUSY_WORD_CNT]; - - struct wl_fw_status_1 *fw_status_1; - struct wl_fw_status_2 *fw_status_2; - struct wl1271_tx_hw_res_if *tx_res_if; - - /* Current chipset configuration */ - struct wlcore_conf conf; - - bool sg_enabled; - - bool enable_11a; - - int recovery_count; - - /* Most recently reported noise in dBm */ - s8 noise; - - /* bands supported by this instance of wl12xx */ - struct ieee80211_supported_band bands[WLCORE_NUM_BANDS]; - - /* - * wowlan trigger was configured during suspend. - * (currently, only "ANY" trigger is supported) - */ - bool wow_enabled; - bool irq_wake_enabled; - - /* - * AP-mode - links indexed by HLID. The global and broadcast links - * are always active. - */ - struct wl1271_link links[WL12XX_MAX_LINKS]; - - /* number of currently active links */ - int active_link_count; - - /* Fast/slow links bitmap according to FW */ - u32 fw_fast_lnk_map; - - /* AP-mode - a bitmap of links currently in PS mode according to FW */ - u32 ap_fw_ps_map; - - /* AP-mode - a bitmap of links currently in PS mode in mac80211 */ - unsigned long ap_ps_map; - - /* Quirks of specific hardware revisions */ - unsigned int quirks; - - /* Platform limitations */ - unsigned int platform_quirks; - - /* number of currently active RX BA sessions */ - int ba_rx_session_count; - - /* Maximum number of supported RX BA sessions */ - int ba_rx_session_count_max; - - /* AP-mode - number of currently connected stations */ - int active_sta_count; - - /* last wlvif we transmitted from */ - struct wl12xx_vif *last_wlvif; - - /* work to fire when Tx is stuck */ - struct delayed_work tx_watchdog_work; - - struct wlcore_ops *ops; - /* pointer to the lower driver partition table */ - const struct wlcore_partition_set *ptable; - /* pointer to the lower driver register table */ - const int *rtable; - /* name of the firmwares to load - for PLT, single role, multi-role */ - const char *plt_fw_name; - const char *sr_fw_name; - const char *mr_fw_name; - - u8 scan_templ_id_2_4; - u8 scan_templ_id_5; - u8 sched_scan_templ_id_2_4; - u8 sched_scan_templ_id_5; - u8 max_channels_5; - - /* per-chip-family private structure */ - void *priv; - - /* number of TX descriptors the HW supports. */ - u32 num_tx_desc; - /* number of RX descriptors the HW supports. */ - u32 num_rx_desc; - - /* translate HW Tx rates to standard rate-indices */ - const u8 **band_rate_to_idx; - - /* size of table for HW rates that can be received from chip */ - u8 hw_tx_rate_tbl_size; - - /* this HW rate and below are considered HT rates for this chip */ - u8 hw_min_ht_rate; - - /* HW HT (11n) capabilities */ - struct ieee80211_sta_ht_cap ht_cap[WLCORE_NUM_BANDS]; - - /* size of the private FW status data */ - size_t fw_status_priv_len; - - /* RX Data filter rule state - enabled/disabled */ - bool rx_filter_enabled[WL1271_MAX_RX_FILTERS]; - - /* size of the private static data */ - size_t static_data_priv_len; - - /* the current channel type */ - enum nl80211_channel_type channel_type; - - /* mutex for protecting the tx_flush function */ - struct mutex flush_mutex; - - /* sleep auth value currently configured to FW */ - int sleep_auth; - - /* the number of allocated MAC addresses in this chip */ - int num_mac_addr; - - /* minimum FW version required for the driver to work in single-role */ - unsigned int min_sr_fw_ver[NUM_FW_VER]; - - /* minimum FW version required for the driver to work in multi-role */ - unsigned int min_mr_fw_ver[NUM_FW_VER]; - - struct completion nvs_loading_complete; - - /* number of concurrent channels the HW supports */ - u32 num_channels; -}; - -int wlcore_probe(struct wl1271 *wl, struct platform_device *pdev); -int wlcore_remove(struct platform_device *pdev); -struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size, - u32 mbox_size); -int wlcore_free_hw(struct wl1271 *wl); -int wlcore_set_key(struct wl1271 *wl, enum set_key_cmd cmd, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key_conf); -void wlcore_regdomain_config(struct wl1271 *wl); - -static inline void -wlcore_set_ht_cap(struct wl1271 *wl, enum ieee80211_band band, - struct ieee80211_sta_ht_cap *ht_cap) -{ - memcpy(&wl->ht_cap[band], ht_cap, sizeof(*ht_cap)); -} - -/* Tell wlcore not to care about this element when checking the version */ -#define WLCORE_FW_VER_IGNORE -1 - -static inline void -wlcore_set_min_fw_ver(struct wl1271 *wl, unsigned int chip, - unsigned int iftype_sr, unsigned int major_sr, - unsigned int subtype_sr, unsigned int minor_sr, - unsigned int iftype_mr, unsigned int major_mr, - unsigned int subtype_mr, unsigned int minor_mr) -{ - wl->min_sr_fw_ver[FW_VER_CHIP] = chip; - wl->min_sr_fw_ver[FW_VER_IF_TYPE] = iftype_sr; - wl->min_sr_fw_ver[FW_VER_MAJOR] = major_sr; - wl->min_sr_fw_ver[FW_VER_SUBTYPE] = subtype_sr; - wl->min_sr_fw_ver[FW_VER_MINOR] = minor_sr; - - wl->min_mr_fw_ver[FW_VER_CHIP] = chip; - wl->min_mr_fw_ver[FW_VER_IF_TYPE] = iftype_mr; - wl->min_mr_fw_ver[FW_VER_MAJOR] = major_mr; - wl->min_mr_fw_ver[FW_VER_SUBTYPE] = subtype_mr; - wl->min_mr_fw_ver[FW_VER_MINOR] = minor_mr; -} - -/* Firmware image load chunk size */ -#define CHUNK_SIZE 16384 - -/* Quirks */ - -/* Each RX/TX transaction requires an end-of-transaction transfer */ -#define WLCORE_QUIRK_END_OF_TRANSACTION BIT(0) - -/* the first start_role(sta) sometimes doesn't work on wl12xx */ -#define WLCORE_QUIRK_START_STA_FAILS BIT(1) - -/* wl127x and SPI don't support SDIO block size alignment */ -#define WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN BIT(2) - -/* means aggregated Rx packets are aligned to a SDIO block */ -#define WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN BIT(3) - -/* Older firmwares did not implement the FW logger over bus feature */ -#define WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED BIT(4) - -/* Older firmwares use an old NVS format */ -#define WLCORE_QUIRK_LEGACY_NVS BIT(5) - -/* pad only the last frame in the aggregate buffer */ -#define WLCORE_QUIRK_TX_PAD_LAST_FRAME BIT(7) - -/* extra header space is required for TKIP */ -#define WLCORE_QUIRK_TKIP_HEADER_SPACE BIT(8) - -/* Some firmwares not support sched scans while connected */ -#define WLCORE_QUIRK_NO_SCHED_SCAN_WHILE_CONN BIT(9) - -/* separate probe response templates for one-shot and sched scans */ -#define WLCORE_QUIRK_DUAL_PROBE_TMPL BIT(10) - -/* Firmware requires reg domain configuration for active calibration */ -#define WLCORE_QUIRK_REGDOMAIN_CONF BIT(11) - -/* The FW only support a zero session id for AP */ -#define WLCORE_QUIRK_AP_ZERO_SESSION_ID BIT(12) - -/* TODO: move all these common registers and values elsewhere */ -#define HW_ACCESS_ELP_CTRL_REG 0x1FFFC - -/* ELP register commands */ -#define ELPCTRL_WAKE_UP 0x1 -#define ELPCTRL_WAKE_UP_WLAN_READY 0x5 -#define ELPCTRL_SLEEP 0x0 -/* ELP WLAN_READY bit */ -#define ELPCTRL_WLAN_READY 0x2 - -/************************************************************************* - - Interrupt Trigger Register (Host -> WiLink) - -**************************************************************************/ - -/* Hardware to Embedded CPU Interrupts - first 32-bit register set */ - -/* - * The host sets this bit to inform the Wlan - * FW that a TX packet is in the XFER - * Buffer #0. - */ -#define INTR_TRIG_TX_PROC0 BIT(2) - -/* - * The host sets this bit to inform the FW - * that it read a packet from RX XFER - * Buffer #0. - */ -#define INTR_TRIG_RX_PROC0 BIT(3) - -#define INTR_TRIG_DEBUG_ACK BIT(4) - -#define INTR_TRIG_STATE_CHANGED BIT(5) - -/* Hardware to Embedded CPU Interrupts - second 32-bit register set */ - -/* - * The host sets this bit to inform the FW - * that it read a packet from RX XFER - * Buffer #1. - */ -#define INTR_TRIG_RX_PROC1 BIT(17) - -/* - * The host sets this bit to inform the Wlan - * hardware that a TX packet is in the XFER - * Buffer #1. - */ -#define INTR_TRIG_TX_PROC1 BIT(18) - -#define ACX_SLV_SOFT_RESET_BIT BIT(1) -#define SOFT_RESET_MAX_TIME 1000000 -#define SOFT_RESET_STALL_TIME 1000 - -#define ECPU_CONTROL_HALT 0x00000101 - -#define WELP_ARM_COMMAND_VAL 0x4 - -#endif /* __WLCORE_H__ */ diff --git a/drivers/net/wireless/ti/wlcore/wlcore_i.h b/drivers/net/wireless/ti/wlcore/wlcore_i.h deleted file mode 100644 index e5e146435fe7..000000000000 --- a/drivers/net/wireless/ti/wlcore/wlcore_i.h +++ /dev/null @@ -1,544 +0,0 @@ -/* - * This file is part of wl1271 - * - * Copyright (C) 1998-2009 Texas Instruments. All rights reserved. - * Copyright (C) 2008-2009 Nokia Corporation - * - * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 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 St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef __WLCORE_I_H__ -#define __WLCORE_I_H__ - -#include -#include -#include -#include -#include -#include - -#include "conf.h" -#include "ini.h" - -/* - * wl127x and wl128x are using the same NVS file name. However, the - * ini parameters between them are different. The driver validates - * the correct NVS size in wl1271_boot_upload_nvs(). - */ -#define WL12XX_NVS_NAME "ti-connectivity/wl1271-nvs.bin" - -#define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff)) -#define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff)) -#define WL1271_TX_SQN_POST_RECOVERY_PADDING 0xff - -#define WL1271_CIPHER_SUITE_GEM 0x00147201 - -#define WL1271_BUSY_WORD_CNT 1 -#define WL1271_BUSY_WORD_LEN (WL1271_BUSY_WORD_CNT * sizeof(u32)) - -#define WL1271_ELP_HW_STATE_ASLEEP 0 -#define WL1271_ELP_HW_STATE_IRQ 1 - -#define WL1271_DEFAULT_BEACON_INT 100 -#define WL1271_DEFAULT_DTIM_PERIOD 1 - -#define WL12XX_MAX_ROLES 4 -#define WL12XX_MAX_LINKS 12 -#define WL12XX_INVALID_ROLE_ID 0xff -#define WL12XX_INVALID_LINK_ID 0xff - -/* the driver supports the 2.4Ghz and 5Ghz bands */ -#define WLCORE_NUM_BANDS 2 - -#define WL12XX_MAX_RATE_POLICIES 16 -#define WLCORE_MAX_KLV_TEMPLATES 4 - -/* Defined by FW as 0. Will not be freed or allocated. */ -#define WL12XX_SYSTEM_HLID 0 - -/* - * When in AP-mode, we allow (at least) this number of packets - * to be transmitted to FW for a STA in PS-mode. Only when packets are - * present in the FW buffers it will wake the sleeping STA. We want to put - * enough packets for the driver to transmit all of its buffered data before - * the STA goes to sleep again. But we don't want to take too much memory - * as it might hurt the throughput of active STAs. - */ -#define WL1271_PS_STA_MAX_PACKETS 2 - -#define WL1271_AP_BSS_INDEX 0 -#define WL1271_AP_DEF_BEACON_EXP 20 - -enum wlcore_state { - WLCORE_STATE_OFF, - WLCORE_STATE_RESTARTING, - WLCORE_STATE_ON, -}; - -enum wl12xx_fw_type { - WL12XX_FW_TYPE_NONE, - WL12XX_FW_TYPE_NORMAL, - WL12XX_FW_TYPE_MULTI, - WL12XX_FW_TYPE_PLT, -}; - -struct wl1271; - -enum { - FW_VER_CHIP, - FW_VER_IF_TYPE, - FW_VER_MAJOR, - FW_VER_SUBTYPE, - FW_VER_MINOR, - - NUM_FW_VER -}; - -struct wl1271_chip { - u32 id; - char fw_ver_str[ETHTOOL_FWVERS_LEN]; - unsigned int fw_ver[NUM_FW_VER]; - char phy_fw_ver_str[ETHTOOL_FWVERS_LEN]; -}; - -#define NUM_TX_QUEUES 4 - -#define AP_MAX_STATIONS 8 - -struct wl_fw_packet_counters { - /* Cumulative counter of released packets per AC */ - u8 tx_released_pkts[NUM_TX_QUEUES]; - - /* Cumulative counter of freed packets per HLID */ - u8 tx_lnk_free_pkts[WL12XX_MAX_LINKS]; - - /* Cumulative counter of released Voice memory blocks */ - u8 tx_voice_released_blks; - - /* Tx rate of the last transmitted packet */ - u8 tx_last_rate; - - u8 padding[2]; -} __packed; - -/* FW status registers */ -struct wl_fw_status_1 { - __le32 intr; - u8 fw_rx_counter; - u8 drv_rx_counter; - u8 reserved; - u8 tx_results_counter; - __le32 rx_pkt_descs[0]; -} __packed; - -/* - * Each HW arch has a different number of Rx descriptors. - * The length of the status depends on it, since it holds an array - * of descriptors. - */ -#define WLCORE_FW_STATUS_1_LEN(num_rx_desc) \ - (sizeof(struct wl_fw_status_1) + \ - (sizeof(((struct wl_fw_status_1 *)0)->rx_pkt_descs[0])) * \ - num_rx_desc) - -struct wl_fw_status_2 { - __le32 fw_localtime; - - /* - * A bitmap (where each bit represents a single HLID) - * to indicate if the station is in PS mode. - */ - __le32 link_ps_bitmap; - - /* - * A bitmap (where each bit represents a single HLID) to indicate - * if the station is in Fast mode - */ - __le32 link_fast_bitmap; - - /* Cumulative counter of total released mem blocks since FW-reset */ - __le32 total_released_blks; - - /* Size (in Memory Blocks) of TX pool */ - __le32 tx_total; - - struct wl_fw_packet_counters counters; - - __le32 log_start_addr; - - /* Private status to be used by the lower drivers */ - u8 priv[0]; -} __packed; - -#define WL1271_MAX_CHANNELS 64 -struct wl1271_scan { - struct cfg80211_scan_request *req; - unsigned long scanned_ch[BITS_TO_LONGS(WL1271_MAX_CHANNELS)]; - bool failed; - u8 state; - u8 ssid[IEEE80211_MAX_SSID_LEN+1]; - size_t ssid_len; -}; - -struct wl1271_if_operations { - int __must_check (*read)(struct device *child, int addr, void *buf, - size_t len, bool fixed); - int __must_check (*write)(struct device *child, int addr, void *buf, - size_t len, bool fixed); - void (*reset)(struct device *child); - void (*init)(struct device *child); - int (*power)(struct device *child, bool enable); - void (*set_block_size) (struct device *child, unsigned int blksz); -}; - -struct wlcore_platdev_data { - struct wl12xx_platform_data *pdata; - struct wl1271_if_operations *if_ops; -}; - -#define MAX_NUM_KEYS 14 -#define MAX_KEY_SIZE 32 - -struct wl1271_ap_key { - u8 id; - u8 key_type; - u8 key_size; - u8 key[MAX_KEY_SIZE]; - u8 hlid; - u32 tx_seq_32; - u16 tx_seq_16; -}; - -enum wl12xx_flags { - WL1271_FLAG_GPIO_POWER, - WL1271_FLAG_TX_QUEUE_STOPPED, - WL1271_FLAG_TX_PENDING, - WL1271_FLAG_IN_ELP, - WL1271_FLAG_ELP_REQUESTED, - WL1271_FLAG_IRQ_RUNNING, - WL1271_FLAG_FW_TX_BUSY, - WL1271_FLAG_DUMMY_PACKET_PENDING, - WL1271_FLAG_SUSPENDED, - WL1271_FLAG_PENDING_WORK, - WL1271_FLAG_SOFT_GEMINI, - WL1271_FLAG_RECOVERY_IN_PROGRESS, - WL1271_FLAG_VIF_CHANGE_IN_PROGRESS, - WL1271_FLAG_INTENDED_FW_RECOVERY, - WL1271_FLAG_IO_FAILED, -}; - -enum wl12xx_vif_flags { - WLVIF_FLAG_INITIALIZED, - WLVIF_FLAG_STA_ASSOCIATED, - WLVIF_FLAG_STA_AUTHORIZED, - WLVIF_FLAG_IBSS_JOINED, - WLVIF_FLAG_AP_STARTED, - WLVIF_FLAG_IN_PS, - WLVIF_FLAG_STA_STATE_SENT, - WLVIF_FLAG_RX_STREAMING_STARTED, - WLVIF_FLAG_PSPOLL_FAILURE, - WLVIF_FLAG_CS_PROGRESS, - WLVIF_FLAG_AP_PROBE_RESP_SET, - WLVIF_FLAG_IN_USE, -}; - -struct wl12xx_vif; - -struct wl1271_link { - /* AP-mode - TX queue per AC in link */ - struct sk_buff_head tx_queue[NUM_TX_QUEUES]; - - /* accounting for allocated / freed packets in FW */ - u8 allocated_pkts; - u8 prev_freed_pkts; - - u8 addr[ETH_ALEN]; - - /* bitmap of TIDs where RX BA sessions are active for this link */ - u8 ba_bitmap; - - /* The wlvif this link belongs to. Might be null for global links */ - struct wl12xx_vif *wlvif; - - /* - * total freed FW packets on the link - used for tracking the - * AES/TKIP PN across recoveries. Re-initialized each time - * from the wl1271_station structure. - */ - u64 total_freed_pkts; -}; - -#define WL1271_MAX_RX_FILTERS 5 -#define WL1271_RX_FILTER_MAX_FIELDS 8 - -#define WL1271_RX_FILTER_ETH_HEADER_SIZE 14 -#define WL1271_RX_FILTER_MAX_FIELDS_SIZE 95 -#define RX_FILTER_FIELD_OVERHEAD \ - (sizeof(struct wl12xx_rx_filter_field) - sizeof(u8 *)) -#define WL1271_RX_FILTER_MAX_PATTERN_SIZE \ - (WL1271_RX_FILTER_MAX_FIELDS_SIZE - RX_FILTER_FIELD_OVERHEAD) - -#define WL1271_RX_FILTER_FLAG_MASK BIT(0) -#define WL1271_RX_FILTER_FLAG_IP_HEADER 0 -#define WL1271_RX_FILTER_FLAG_ETHERNET_HEADER BIT(1) - -enum rx_filter_action { - FILTER_DROP = 0, - FILTER_SIGNAL = 1, - FILTER_FW_HANDLE = 2 -}; - -enum plt_mode { - PLT_OFF = 0, - PLT_ON = 1, - PLT_FEM_DETECT = 2, -}; - -struct wl12xx_rx_filter_field { - __le16 offset; - u8 len; - u8 flags; - u8 *pattern; -} __packed; - -struct wl12xx_rx_filter { - u8 action; - int num_fields; - struct wl12xx_rx_filter_field fields[WL1271_RX_FILTER_MAX_FIELDS]; -}; - -struct wl1271_station { - u8 hlid; - bool in_connection; - - /* - * total freed FW packets on the link to the STA - used for tracking the - * AES/TKIP PN across recoveries. Re-initialized each time from the - * wl1271_station structure. - */ - u64 total_freed_pkts; -}; - -struct wl12xx_vif { - struct wl1271 *wl; - struct list_head list; - unsigned long flags; - u8 bss_type; - u8 p2p; /* we are using p2p role */ - u8 role_id; - - /* sta/ibss specific */ - u8 dev_role_id; - u8 dev_hlid; - - union { - struct { - u8 hlid; - - u8 basic_rate_idx; - u8 ap_rate_idx; - u8 p2p_rate_idx; - - u8 klv_template_id; - - bool qos; - /* channel type we started the STA role with */ - enum nl80211_channel_type role_chan_type; - } sta; - struct { - u8 global_hlid; - u8 bcast_hlid; - - /* HLIDs bitmap of associated stations */ - unsigned long sta_hlid_map[BITS_TO_LONGS( - WL12XX_MAX_LINKS)]; - - /* recoreded keys - set here before AP startup */ - struct wl1271_ap_key *recorded_keys[MAX_NUM_KEYS]; - - u8 mgmt_rate_idx; - u8 bcast_rate_idx; - u8 ucast_rate_idx[CONF_TX_MAX_AC_COUNT]; - } ap; - }; - - /* the hlid of the last transmitted skb */ - int last_tx_hlid; - - /* counters of packets per AC, across all links in the vif */ - int tx_queue_count[NUM_TX_QUEUES]; - - unsigned long links_map[BITS_TO_LONGS(WL12XX_MAX_LINKS)]; - - u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; - u8 ssid_len; - - /* The current band */ - enum ieee80211_band band; - int channel; - enum nl80211_channel_type channel_type; - - u32 bitrate_masks[WLCORE_NUM_BANDS]; - u32 basic_rate_set; - - /* - * currently configured rate set: - * bits 0-15 - 802.11abg rates - * bits 16-23 - 802.11n MCS index mask - * support only 1 stream, thus only 8 bits for the MCS rates (0-7). - */ - u32 basic_rate; - u32 rate_set; - - /* probe-req template for the current AP */ - struct sk_buff *probereq; - - /* Beaconing interval (needed for ad-hoc) */ - u32 beacon_int; - - /* Default key (for WEP) */ - u32 default_key; - - /* Our association ID */ - u16 aid; - - /* retry counter for PSM entries */ - u8 psm_entry_retry; - - /* in dBm */ - int power_level; - - int rssi_thold; - int last_rssi_event; - - /* save the current encryption type for auto-arp config */ - u8 encryption_type; - __be32 ip_addr; - - /* RX BA constraint value */ - bool ba_support; - bool ba_allowed; - - bool wmm_enabled; - - /* Rx Streaming */ - struct work_struct rx_streaming_enable_work; - struct work_struct rx_streaming_disable_work; - struct timer_list rx_streaming_timer; - - struct delayed_work channel_switch_work; - struct delayed_work connection_loss_work; - - /* number of in connection stations */ - int inconn_count; - - /* - * This vif's queues are mapped to mac80211 HW queues as: - * VO - hw_queue_base - * VI - hw_queue_base + 1 - * BE - hw_queue_base + 2 - * BK - hw_queue_base + 3 - */ - int hw_queue_base; - - /* - * This struct must be last! - * data that has to be saved acrossed reconfigs (e.g. recovery) - * should be declared in this struct. - */ - struct { - u8 persistent[0]; - - /* - * total freed FW packets on the link - used for - * storing the AES/TKIP PN during recovery, as this - * structure is not zeroed out. - * For STA this holds the PN of the link to the AP. - * For AP this holds the PN of the broadcast link. - */ - u64 total_freed_pkts; - }; -}; - -static inline struct wl12xx_vif *wl12xx_vif_to_data(struct ieee80211_vif *vif) -{ - WARN_ON(!vif); - return (struct wl12xx_vif *)vif->drv_priv; -} - -static inline -struct ieee80211_vif *wl12xx_wlvif_to_vif(struct wl12xx_vif *wlvif) -{ - return container_of((void *)wlvif, struct ieee80211_vif, drv_priv); -} - -#define wl12xx_for_each_wlvif(wl, wlvif) \ - list_for_each_entry(wlvif, &wl->wlvif_list, list) - -#define wl12xx_for_each_wlvif_continue(wl, wlvif) \ - list_for_each_entry_continue(wlvif, &wl->wlvif_list, list) - -#define wl12xx_for_each_wlvif_bss_type(wl, wlvif, _bss_type) \ - wl12xx_for_each_wlvif(wl, wlvif) \ - if (wlvif->bss_type == _bss_type) - -#define wl12xx_for_each_wlvif_sta(wl, wlvif) \ - wl12xx_for_each_wlvif_bss_type(wl, wlvif, BSS_TYPE_STA_BSS) - -#define wl12xx_for_each_wlvif_ap(wl, wlvif) \ - wl12xx_for_each_wlvif_bss_type(wl, wlvif, BSS_TYPE_AP_BSS) - -int wl1271_plt_start(struct wl1271 *wl, const enum plt_mode plt_mode); -int wl1271_plt_stop(struct wl1271 *wl); -int wl1271_recalc_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif); -void wl12xx_queue_recovery_work(struct wl1271 *wl); -size_t wl12xx_copy_fwlog(struct wl1271 *wl, u8 *memblock, size_t maxlen); -int wl1271_rx_filter_alloc_field(struct wl12xx_rx_filter *filter, - u16 offset, u8 flags, - u8 *pattern, u8 len); -void wl1271_rx_filter_free(struct wl12xx_rx_filter *filter); -struct wl12xx_rx_filter *wl1271_rx_filter_alloc(void); -int wl1271_rx_filter_get_fields_size(struct wl12xx_rx_filter *filter); -void wl1271_rx_filter_flatten_fields(struct wl12xx_rx_filter *filter, - u8 *buf); - -#define JOIN_TIMEOUT 5000 /* 5000 milliseconds to join */ - -#define SESSION_COUNTER_MAX 6 /* maximum value for the session counter */ -#define SESSION_COUNTER_INVALID 7 /* used with dummy_packet */ - -#define WL1271_DEFAULT_POWER_LEVEL 0 - -#define WL1271_TX_QUEUE_LOW_WATERMARK 32 -#define WL1271_TX_QUEUE_HIGH_WATERMARK 256 - -#define WL1271_DEFERRED_QUEUE_LIMIT 64 - -/* WL1271 needs a 200ms sleep after power on, and a 20ms sleep before power - on in case is has been shut down shortly before */ -#define WL1271_PRE_POWER_ON_SLEEP 20 /* in milliseconds */ -#define WL1271_POWER_ON_SLEEP 200 /* in milliseconds */ - -/* Macros to handle wl1271.sta_rate_set */ -#define HW_BG_RATES_MASK 0xffff -#define HW_HT_RATES_OFFSET 16 -#define HW_MIMO_RATES_OFFSET 24 - -#define WL12XX_HW_BLOCK_SIZE 256 - -#endif /* __WLCORE_I_H__ */ diff --git a/drivers/net/wireless/wifi_launcher/Makefile b/drivers/net/wireless/wifi_launcher/Makefile deleted file mode 100644 index 6d8d07677647..000000000000 --- a/drivers/net/wireless/wifi_launcher/Makefile +++ /dev/null @@ -1,11 +0,0 @@ - -obj-m := wlan.o - -KERNEL_DIR = /smb/rk28/mid_yifang_a10_29/kernel - -all: - make -C $(KERNEL_DIR) M=`pwd` modules - -clean: - rm -f Module.symvers *.o modules.order *.ko wifi_launcher.mod.c - rm -rf .wifi* .tmp* wlan.mod.c diff --git a/drivers/net/wireless/wifi_launcher/wlan.c b/drivers/net/wireless/wifi_launcher/wlan.c deleted file mode 100644 index 77fce6d3bc42..000000000000 --- a/drivers/net/wireless/wifi_launcher/wlan.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Just a wifi driver hooker. - * - * Yongle Lai @ 2009-05-10 @ Rockchip - */ - -#include -#include -#include - -MODULE_LICENSE("Dual BSD/GPL"); - -#ifdef CONFIG_MODVERSIONS -#define MODVERSIONS -#include -#endif - -//#define OLD_WIFI_IFACE - -#ifdef OLD_WIFI_IFACE -extern int mv88w8686_if_sdio_init_module(void); -extern void mv88w8686_if_sdio_exit_module(void); -#else -extern int rockchip_wifi_init_module(void); -extern void rockchip_wifi_exit_module(void); -#endif - -static int wifi_launcher_init(void) -{ - int ret; - - printk("=======================================================\n"); - printk("==== Launching Wi-Fi driver! (Powered by Rockchip) ====\n"); - printk("=======================================================\n"); - -#ifdef OLD_WIFI_IFACE - ret = mv88w8686_if_sdio_init_module(); - if (ret) /* Try again */ - ret = mv88w8686_if_sdio_init_module(); -#else - ret = rockchip_wifi_init_module(); - //if (ret) /* Try again */ - // ret = rockchip_wifi_init_module(); -#endif - - return ret; -} - -static void wifi_launcher_exit(void) -{ - printk("=======================================================\n"); - printk("== Dis-launching Wi-Fi driver! (Powered by Rockchip) ==\n"); - printk("=======================================================\n"); - -#ifdef OLD_WIFI_IFACE - mv88w8686_if_sdio_exit_module(); -#else - rockchip_wifi_exit_module(); -#endif -} - -module_init(wifi_launcher_init); -module_exit(wifi_launcher_exit); - diff --git a/drivers/net/wireless/wifi_launcher/wlan_param.h b/drivers/net/wireless/wifi_launcher/wlan_param.h deleted file mode 100755 index 136da06c5639..000000000000 --- a/drivers/net/wireless/wifi_launcher/wlan_param.h +++ /dev/null @@ -1,13 +0,0 @@ - -#ifndef _WLAN_PARAM_H_ -#define _WLAN_PARAM_H_ - -typedef struct { - char ifname[32]; // wlan0, wl0.1 - char devmode[32]; // ap, sta - // reserve -} wlan_param; - -#endif - - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_aigo_e1000.c b/drivers/net/wireless/wifi_power/vendor/wp_aigo_e1000.c deleted file mode 100755 index 4f6bd635d9e8..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_aigo_e1000.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, GPIOB1_SMCS1_MMC0PCA_NAME, - IOMUXA_GPIO0_B1, GPIOPortB_Pin1, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_GPIO, 0, 0, 0, GPIOPortA_Pin4, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_aigo_e700.c b/drivers/net/wireless/wifi_power/vendor/wp_aigo_e700.c deleted file mode 100755 index 8d19e93e557e..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_aigo_e700.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * wifi_power.c for MID_AIGO_E700. - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, GPIOF0_UART1_CPWM0_NAME, - IOMUXA_GPIO1_B0, GPIOPortF_Pin0, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_aigo_nx7007.c b/drivers/net/wireless/wifi_power/vendor/wp_aigo_nx7007.c deleted file mode 100755 index 3e2265911647..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_aigo_nx7007.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * wifi_power.c - * - * Power control (for AIGO NX7007) for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_EXT_GPIO, 0, 0, 0, PCA955X_Pin2, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_EXT_GPIO, 0, 0, 0, PCA955X_Pin3, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_anjieda_inch10.c b/drivers/net/wireless/wifi_power/vendor/wp_anjieda_inch10.c deleted file mode 100755 index b73404ddfeff..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_anjieda_inch10.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, GPIOB1_SMCS1_MMC0PCA_NAME, - IOMUXA_GPIO0_B1, GPIOPortB_Pin1, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, GPIO0A4_I2SLRCK_SEL_NAME, - IOMUXB_GPIO0_A4, GPIOPortA_Pin4, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_foxcom_tp2.c b/drivers/net/wireless/wifi_power/vendor/wp_foxcom_tp2.c deleted file mode 100755 index 28fbc9802600..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_foxcom_tp2.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * wifi_power.c for MID_AIGO_E700. - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, WIFI_PWDN_IOMUX_PINNAME, - WIFI_PWDN_IOMUX_PINDIR, WIFI_PWDN_IOPIN, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, WIFI_RST_IOMUX_PINNAME, - WIFI_RST_IOMUX_PINDIR, WIFI_RST_IOPIN, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_jinghua_m80.c b/drivers/net/wireless/wifi_power/vendor/wp_jinghua_m80.c deleted file mode 100755 index 2eabf8b8ddd5..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_jinghua_m80.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, WIFI_PWDN_IOMUX_PINNAME, - WIFI_PWDN_IOMUX_PINDIR, WIFI_PWDN_IOPIN, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_GPIO, 0, 0, 0, WIFI_RST_IOPIN, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_malata_mp0100.c b/drivers/net/wireless/wifi_power/vendor/wp_malata_mp0100.c deleted file mode 100755 index 418954a3f711..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_malata_mp0100.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#include - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_EXT_GPIO, 0, 0, 0, Extend_GpioPort0_Pin4, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_EXT_GPIO, 0, 0, 0, Extend_GpioPort0_Pin5, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - tca6424_set_oneport_pindirection(id, Extend_Gpio_OUT); - tca6424_set_oneoutport_pinlevel(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_meitu_770.c b/drivers/net/wireless/wifi_power/vendor/wp_meitu_770.c deleted file mode 100755 index 7111dbeab22b..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_meitu_770.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, - POWER_GPIO_IOMUX, - WIFI_PWDN_IOMUX_PINNAME, - WIFI_PWDN_IOMUX_PINDIR, - WIFI_PWDN_IOPIN, - GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_GPIO, - POWER_GPIO_IOMUX, - WIFI_RST_IOMUX_PINNAME, - WIFI_RST_IOMUX_PINDIR, - WIFI_RST_IOPIN, - GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_rk2808_child.c b/drivers/net/wireless/wifi_power/vendor/wp_rk2808_child.c deleted file mode 100755 index 1bee67ada5f6..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_rk2808_child.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, GPIOE_SPI1_SEL_NAME, - IOMUXA_GPIO1_A1237, GPIOPortE_Pin1, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_rk2818sdk_usb.c b/drivers/net/wireless/wifi_power/vendor/wp_rk2818sdk_usb.c deleted file mode 100755 index 4182e6b50f60..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_rk2818sdk_usb.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * 在WIFI被上电前,会调用这个函数。 - */ -void wifi_turn_on_callback(void) -{ -} - -/* - * 在WIFI被下电后,会调用这个函数。 - */ -void wifi_turn_off_callback(void) -{ -} - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(void); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -/* - * For USB WiFi, we need to switch USB mode. - */ - -#if defined(CONFIG_RALINK_RT3070) || defined(CONFIG_REALTEK_RTL8192) - -int wifi_change_usb_mode = 0; -int usb_wifi_status = 0; - -void wifi_usb_init(void) -{ - wifi_change_usb_mode = 0; - usb_wifi_status = 0; -} - -#define DONT_SWITCH_USB 0 /* Don't switch USB automaticately. */ -#define WIFI_USE_OTG 1 /* WiFi will be connected to USB OTG. */ -#define WIFI_USE_HOST11 2 /* WiFi will be connected to USB HOST 1.1. */ - -#define WIFI_USE_IFACE 2 - -#if (WIFI_USE_IFACE == WIFI_USE_OTG) - -#define USB_NORMAL 0 -#define USB_FORCE_HOST 1 -#define USB_FORCE_DEVICE 2 - -extern int usb_force_usb_for_wifi(int mode); - -/* - * Change USB mode to HOST. - */ -int wifi_activate_usb(void) -{ - wifi_turn_on_card(WIFI_CHIP_RT3070); - - wifi_change_usb_mode = usb_force_usb_for_wifi(USB_FORCE_HOST); - msleep(1000); - - usb_wifi_status = 1; - - return 0; -} - -/* - * Change USB mode to be original. - */ -int wifi_deactivate_usb(void) -{ - if (wifi_change_usb_mode == 1) - { - usb_force_usb_for_wifi(USB_FORCE_DEVICE); - msleep(1000); - usb_force_usb_for_wifi(USB_NORMAL); - msleep(1000); - } - wifi_turn_off_card(); - - usb_wifi_status = 0; - - return 0; -} - -#elif (WIFI_USE_IFACE == WIFI_USE_HOST11) - -extern int usb_switch_usb_host11_for_wifi(int enabled); - -int wifi_deactivate_usb(void) -{ - wifi_turn_on_card(WIFI_CHIP_RT3070); - msleep(100); - - usb_switch_usb_host11_for_wifi(0); - msleep(1000); - - return 0; -} - -int wifi_activate_usb(void) -{ - usb_switch_usb_host11_for_wifi(1); - msleep(1000); - - wifi_turn_off_card(); - - return 0; -} - -#else - -int wifi_deactivate_usb(void) -{ - return 0; -} - -int wifi_activate_usb(void) -{ - return 0; -} -#endif - -#endif /* CONFIG_RALINK_RT3070 */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_rk28_meizhu_m70.c b/drivers/net/wireless/wifi_power/vendor/wp_rk28_meizhu_m70.c deleted file mode 100755 index 19d6598ca4c8..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_rk28_meizhu_m70.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * ÓÃÓÚ¿ØÖÆWIFIµÄµçÔ´£¬Í¨³£ÊÇ3.3VºÍ1.8V£¬¿ÉÄÜ1.2VÒ²ÔÚÆäÖС£ - * - * Èç¹ûÊÇÀ©Õ¹IO£¬Çë²Î¿¼ÏÂÃæµÄÀý×Ó: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, WIFI_PWDN_IOMUX_PINNAME, - WIFI_PWDN_IOMUX_PINDIR, WIFI_PWDN_IOPIN, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * ¿ØÖÆWIFIµÄPowerDown½Å¡£ÓÐЩģ×éPowerDown½ÅÊǺÍReset½Å¶Ì½ÓÔÚÒ»Æð¡£ - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_GPIO, 0, WIFI_RST_IOMUX_PINNAME, - WIFI_RST_IOMUX_PINDIR, WIFI_RST_IOPIN, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * ¿ØÖÆWIFIµÄReset½Å£¬Í¨³£WiFiÄ£×éûÓÐÓõ½Õâ¸öÒý½Å¡£ - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * Èç¹ûÓÐÓÃÀ©Õ¹GPIOÀ´¿ØÖÆWIFI£¬ÇëʵÏÖÏÂÃæµÄº¯Êý: - * º¯ÊýµÄ¹¦ÄÜÊÇ£º¿ØÖÆÖ¸¶¨µÄIO¿Úid£¬Ê¹Æä״̬Çл»ÎªÒªÇóµÄsens״̬¡£ - * id : ÊÇIOµÄ±êʶºÅ£¬ÒÔÕûÊýµÄÐÎʽ±êʶ¡£ - * sens: ÊÇÒªÇóµÄIO״̬£¬Îª¸ß»òµÍ¡£ - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * ÔÚϵͳÖÐÈç¹ûÒªµ÷ÓÃWIFIµÄIO¿ØÖÆ£¬½«WIFIϵ磬¿ÉÒÔµ÷ÓÃÈçϽӿڣº - * void rockchip_wifi_shutdown(); - * µ«×¢ÒâÐèÒªÔÚºêWIFI_GPIO_POWER_CONTROLµÄ¿ØÖÆÏ¡£ - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_rk29_yifang_a10.c b/drivers/net/wireless/wifi_power/vendor/wp_rk29_yifang_a10.c deleted file mode 100755 index 85aad2694d8c..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_rk29_yifang_a10.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, - GPIO5D6_SDMMC1PWREN_NAME, GPIO5H_GPIO5D6, RK29_PIN5_PD6, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_NOT_IOMUX, 0, 0, RK29_PIN6_PC0, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * 在WIFI被上电前,会调用这个函数。 - */ -void wifi_turn_on_callback(void) -{ -} - -/* - * 在WIFI被下电后,会调用这个函数。 - */ -void wifi_turn_off_callback(void) -{ -} - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(void); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -/* - * For USB WiFi, we need to switch USB mode. - */ - -#ifdef CONFIG_RALINK_RT3070 - -int wifi_change_usb_mode = 0; -int usb_wifi_status = 0; - -void wifi_usb_init(void) -{ - wifi_change_usb_mode = 0; - usb_wifi_status = 0; -} - -#define DONT_SWITCH_USB 0 /* Don't switch USB automaticately. */ -#define WIFI_USE_OTG 1 /* WiFi will be connected to USB OTG. */ -#define WIFI_USE_HOST11 2 /* WiFi will be connected to USB HOST 1.1. */ - -#define WIFI_USE_IFACE 2 - -#if (WIFI_USE_IFACE == WIFI_USE_OTG) - -#define USB_NORMAL 0 -#define USB_FORCE_HOST 1 -#define USB_FORCE_DEVICE 2 - -extern int usb_force_usb_for_wifi(int mode); - -/* - * Change USB mode to HOST. - */ -int wifi_activate_usb(void) -{ - wifi_turn_on_card(WIFI_CHIP_RT3070); - - wifi_change_usb_mode = usb_force_usb_for_wifi(USB_FORCE_HOST); - msleep(1000); - - usb_wifi_status = 1; - - return 0; -} - -/* - * Change USB mode to be original. - */ -int wifi_deactivate_usb(void) -{ - if (wifi_change_usb_mode == 1) - { - usb_force_usb_for_wifi(USB_FORCE_DEVICE); - msleep(1000); - usb_force_usb_for_wifi(USB_NORMAL); - msleep(1000); - } - wifi_turn_off_card(); - - usb_wifi_status = 0; - - return 0; -} - -#elif (WIFI_USE_IFACE == WIFI_USE_HOST11) - -extern int usb_switch_usb_host11_for_wifi(int enabled); - -int wifi_deactivate_usb(void) -{ - usb_switch_usb_host11_for_wifi(0); - msleep(5000); - - return 0; -} - -int wifi_activate_usb(void) -{ - usb_switch_usb_host11_for_wifi(1); - msleep(1000); - - return 0; -} - -#else - -int wifi_deactivate_usb(void) -{ - return 0; -} - -int wifi_activate_usb(void) -{ - return 0; -} -#endif - -#endif /* CONFIG_RALINK_RT3070 */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_tchip_tr802d.c b/drivers/net/wireless/wifi_power/vendor/wp_tchip_tr802d.c deleted file mode 100755 index 317b645724c3..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_tchip_tr802d.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * wifi_power.c for MID_AIGO_E700. - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, GPIOG0_UART0_MMC1DET_NAME, - IOMUXA_GPIO1_C0, GPIOPortG_Pin0, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, GPIOF01_UART2_SEL_NAME, - IOMUXB_GPIO0_B01, GPIOPortB_Pin0, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_tchip_tr806d.c b/drivers/net/wireless/wifi_power/vendor/wp_tchip_tr806d.c deleted file mode 100755 index b8887ca01106..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_tchip_tr806d.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * wifi_power.c for MID_AIGO_E700. - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, GPIOB1_SMCS1_MMC0PCA_NAME, - IOMUXA_GPIO0_B1, GPIOPortB_Pin1, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, GPIOG0_UART0_MMC1DET_NAME, - IOMUXA_GPIO1_C0, GPIOPortG_Pin0, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_yifang_a7_2818.c b/drivers/net/wireless/wifi_power/vendor/wp_yifang_a7_2818.c deleted file mode 100755 index cd700612140e..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_yifang_a7_2818.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, WIFI_PWDN_IOMUX_PINNAME, - WIFI_PWDN_IOMUX_PINDIR, WIFI_PWDN_IOPIN, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_GPIO, 0, 0, 0, WIFI_RST_IOPIN, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_yuxing_mid7001.c b/drivers/net/wireless/wifi_power/vendor/wp_yuxing_mid7001.c deleted file mode 100755 index 7e9ef24752a7..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_yuxing_mid7001.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, GPIOF0_UART1_CPWM0_NAME, - IOMUXA_GPIO1_B0, GPIOPortF_Pin0, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_yuxing_mid704.c b/drivers/net/wireless/wifi_power/vendor/wp_yuxing_mid704.c deleted file mode 100755 index 045fe5cea81b..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_yuxing_mid704.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, GPIOB1_SMCS1_MMC0PCA_NAME, - IOMUXA_GPIO0_B1, GPIOPortB_Pin1, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_GPIO, 0, 0, 0, GPIOPortA_Pin4, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/vendor/wp_yuxing_umpc1001.c b/drivers/net/wireless/wifi_power/vendor/wp_yuxing_umpc1001.c deleted file mode 100755 index 045fe5cea81b..000000000000 --- a/drivers/net/wireless/wifi_power/vendor/wp_yuxing_umpc1001.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, GPIOB1_SMCS1_MMC0PCA_NAME, - IOMUXA_GPIO0_B1, GPIOPortB_Pin1, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_GPIO, 0, 0, 0, GPIOPortA_Pin4, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/wifi_config.c b/drivers/net/wireless/wifi_power/wifi_config.c deleted file mode 100644 index 30315ee4b180..000000000000 --- a/drivers/net/wireless/wifi_power/wifi_config.c +++ /dev/null @@ -1,62 +0,0 @@ - -#include - -/* - * You may set default region here. - * 0x10 -- America - */ -int wifi_default_region = 0x10; // Country / region code - -/* - * When WiFi is IDLE with disconnected state as long as - * wifi_closed_timeout, we will ask Android to turn off WiFi. - */ -int wifi_turnoff_timeout = 6; //unit is 10 seconds, ex. 6 means 60 seconds - -/* - * Please choose the source for mac address. - * - * For the following modules, an eeprom is embedded in module, - * so don't care this variable: - * 01. Samsung SWL-2480 - * - * For the following modules, you need to set the correct value: - * 01. Atheros AR6102 / AR6122 - */ -#define MAC_ADDR_FROM_SOFTMAC_FILE 0 /* from system/etc/firmware/softmac */ -#define MAC_ADDR_FROM_RANDOM 1 /* pseudo-random mac */ -#define MAC_ADDR_FROM_EEPROM 2 /* If there is an external eeprom */ -#define MAC_ADDR_FROM_EEPROM_FILE 3 /* from system/etc/firmware/calData_ar6102_15dBm.bin */ - -int wifi_mac_addr_source = MAC_ADDR_FROM_RANDOM; - -/* - * When WiFi is IDLE in 2 minutes, we will put WiFi - * into deep sleep for power saving. - */ -unsigned long driver_ps_timeout = 2 * 60 * 1000; //2 minutes - -/* - * User customized MAC address. - * - * Return value: 0 -- not customized, 1 -- customized. - */ -#if 1 -int wifi_customized_mac_addr(u8 *mac) -{ - return 0; -} -#else -extern int kld_get_wifi_mac(u8 *mac); - -int wifi_customized_mac_addr(u8 *mac) -{ - kld_get_wifi_mac(mac); - - printk("We are using customized MAC: %02X:%02X:%02X:%02X:%02x:%02x\n", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); - - return 1; -} -#endif - diff --git a/drivers/net/wireless/wifi_power/wifi_power.c b/drivers/net/wireless/wifi_power/wifi_power.c deleted file mode 100755 index 2b2923afc490..000000000000 --- a/drivers/net/wireless/wifi_power/wifi_power.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * Yongle Lai @ Rockchip - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -/* - * GPIO to control LDO/DCDC. - * - * 用于控制WIFI的电源,通常是3.3V和1.8V,可能1.2V也在其中。 - * - * 如果是扩展IO,请参考下面的例子: - * POWER_USE_EXT_GPIO, 0, 0, 0, PCA9554_Pin1, GPIO_HIGH - */ -struct wifi_power power_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_IOMUX, - GPIO5D6_SDMMC1PWREN_NAME, GPIO5H_GPIO5D6, RK29_PIN5_PD6, GPIO_HIGH -}; - -/* - * GPIO to control WIFI PowerDOWN/RESET. - * - * 控制WIFI的PowerDown脚。有些模组PowerDown脚是和Reset脚短接在一起。 - */ -struct wifi_power power_save_gpio = -{ - POWER_USE_GPIO, POWER_GPIO_NOT_IOMUX, 0, 0, RK29_PIN6_PC0, GPIO_HIGH -}; - -/* - * GPIO to reset WIFI. Keep this as NULL normally. - * - * 控制WIFI的Reset脚,通常WiFi模组没有用到这个引脚。 - */ -struct wifi_power power_reset_gpio = -{ - 0, 0, 0, 0, 0, 0 -}; - -/* - * 在WIFI被上电前,会调用这个函数。 - */ -void wifi_turn_on_callback(void) -{ -} - -/* - * 在WIFI被下电后,会调用这个函数。 - */ -void wifi_turn_off_callback(void) -{ -} - -/* - * If external GPIO chip such as PCA9554 is being used, please - * implement the following 2 function. - * - * id: is GPIO identifier, such as GPIOPortF_Pin0, or external - * name defined in struct wifi_power. - * sens: the value should be set to GPIO, usually is GPIO_HIGH or GPIO_LOW. - * - * 如果有用扩展GPIO来控制WIFI,请实现下面的函数: - * 函数的功能是:控制指定的IO口id,使其状态切换为要求的sens状态。 - * id : 是IO的标识号,以整数的形式标识。 - * sens: 是要求的IO状态,为高或低。 - */ -void wifi_extgpio_operation(u8 id, u8 sens) -{ - //pca955x_gpio_direction_output(id, sens); -} - -/* - * 在系统中如果要调用WIFI的IO控制,将WIFI下电,可以调用如下接口: - * void rockchip_wifi_shutdown(void); - * 但注意需要在宏WIFI_GPIO_POWER_CONTROL的控制下。 - */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/wifi_power.h b/drivers/net/wireless/wifi_power/wifi_power.h deleted file mode 100755 index 97e1ad3dd202..000000000000 --- a/drivers/net/wireless/wifi_power/wifi_power.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * wifi_power.h - * - * WIFI power control. - * - * Yongle Lai - */ - -#ifndef WIFI_POWER_H -#define WIFI_POWER_H - -#include - -#define WIFI_GPIO_POWER_CONTROL 1 - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) -#include -#include -#else -#include -#include - -#endif - -#define WIFI_CHIP_MV8686 0 -#define WIFI_CHIP_AR6002 1 -#define WIFI_CHIP_BCM4319 2 -#define WIFI_CHIP_NRX700 3 -#define WIFI_CHIP_RT3070 4 - -#define POWER_NOT_USE_GPIO 0 -#define POWER_USE_GPIO 1 -#define POWER_USE_EXT_GPIO 2 /* External GPIO chip is used, such as PCA9554. */ - -#define POWER_GPIO_NOT_IOMUX 0 -#define POWER_GPIO_IOMUX 1 - -#define GPIO_SWITCH_OFF 0 -#define GPIO_SWITCH_ON 1 - -struct wifi_power -{ - u8 use_gpio; /* If uses GPIO to control wifi power supply. 0 - no, 1 - yes. */ - u8 gpio_iomux; /* If the GPIO is iomux. 0 - no, 1 - yes. */ - char *iomux_name; /* IOMUX name */ - u8 iomux_value; /* IOMUX value - which function is choosen. */ - u8 gpio_id; /* GPIO number */ - u8 sensi_level; /* GPIO sensitive level. */ -}; - -int wifi_turn_on_card(int module); -int wifi_turn_off_card(void); -int wifi_reset_card(void); -void wifi_extgpio_operation(u8 id, u8 sens); - -void rockchip_wifi_shutdown(void); - -#endif /* WIFI_GPIO_POWER_CONTROL */ - -#define WIFI_NETWORK_BUSY 0 -#define WIFI_NETWORK_IDLE 1 - -int wifi_power_save_init(void); -int wifi_power_save_exit(void); -int wifi_power_save_stop(void); -int wifi_power_save_state(void); -void wifi_power_save_suspend(void); -void wifi_power_save_resume(void); -int wifi_power_save_register_callback(int (*callback)(int status)); - -void wifi_turn_on_callback(void); -void wifi_turn_off_callback(void); - -#if defined(CONFIG_RALINK_RT3070) || defined(CONFIG_REALTEK_RTL8192) - -int wifi_activate_usb(void); -int wifi_deactivate_usb(void); -void wifi_usb_init(void); - -#endif - -#endif /* WIFI_POWER_H */ - diff --git a/drivers/net/wireless/wifi_power/wifi_power_ops.c b/drivers/net/wireless/wifi_power/wifi_power_ops.c deleted file mode 100755 index 559c7d02d2ee..000000000000 --- a/drivers/net/wireless/wifi_power/wifi_power_ops.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * wifi_power.c - * - * Yongle Lai @ Rockchip Fuzhou @ 20100303. - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -extern struct wifi_power power_gpio; -extern struct wifi_power power_save_gpio; -extern struct wifi_power power_reset_gpio; - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) -#define OS_IOMUX(name, value) rockchip_mux_api_set((name), (value)) -#else -#define OS_IOMUX(name, value) rk29_mux_api_set((name), (value)); -#endif - -int wifi_gpio_operate(struct wifi_power *gpio, int flag) -{ - int sensitive; - - if (gpio->use_gpio == POWER_NOT_USE_GPIO) - return 0; - - if (gpio->gpio_iomux == POWER_GPIO_IOMUX) - { - OS_IOMUX(gpio->iomux_name, gpio->iomux_value); - } - - if (flag == GPIO_SWITCH_ON) - sensitive = gpio->sensi_level; - else - sensitive = 1 - gpio->sensi_level; - - if (gpio->use_gpio == POWER_USE_EXT_GPIO) - { - wifi_extgpio_operation(gpio->gpio_id, sensitive); - } - else - { -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - gpio_direction_output(gpio->gpio_id, GPIO_OUT); - __gpio_set(gpio->gpio_id, sensitive); -#else - gpio_direction_output(gpio->gpio_id, sensitive); - gpio_set_value(gpio->gpio_id, sensitive); -#endif - } - - return 0; -} - -// WiFi reset sequence -int wifi_reset_card(void) -{ - if (power_reset_gpio.use_gpio == POWER_NOT_USE_GPIO) - return 0; - - wifi_gpio_operate(&power_reset_gpio, GPIO_SWITCH_ON); - mdelay(1); - - wifi_gpio_operate(&power_reset_gpio, GPIO_SWITCH_OFF); - mdelay(3); - - wifi_gpio_operate(&power_reset_gpio, GPIO_SWITCH_ON); - mdelay(3); - - return 0; -} - -/* - * WiFi power up sequence - */ -int wifi_turn_on_mv8686_card(void) -{ - /* - * Make sure we are in power off. - * MV8686 doesn't care power down sequence. - */ - wifi_gpio_operate(&power_save_gpio, GPIO_SWITCH_OFF); - wifi_gpio_operate(&power_gpio, GPIO_SWITCH_OFF); - mdelay(5); - - wifi_gpio_operate(&power_save_gpio, GPIO_SWITCH_ON); - mdelay(5); - - wifi_gpio_operate(&power_gpio, GPIO_SWITCH_ON); - msleep(20); - - /* Reset sequence if necessary. */ - wifi_reset_card(); - - return 0; -} - -int wifi_turn_on_nrx700_card(void) -{ - /* - * Make sure we are in power off. - */ - wifi_gpio_operate(&power_save_gpio, GPIO_SWITCH_OFF); - wifi_gpio_operate(&power_gpio, GPIO_SWITCH_OFF); - mdelay(5); - - wifi_gpio_operate(&power_gpio, GPIO_SWITCH_ON); - mdelay(10); - - wifi_gpio_operate(&power_save_gpio, GPIO_SWITCH_ON); - msleep(130); - - /* Reset sequence if necessary. */ - wifi_reset_card(); - - return 0; -} - -int wifi_turn_on_bcm4319_card(void) -{ - /* - * Make sure we are in power off. - */ - wifi_gpio_operate(&power_save_gpio, GPIO_SWITCH_OFF); - wifi_gpio_operate(&power_gpio, GPIO_SWITCH_OFF); - mdelay(5); - - wifi_gpio_operate(&power_gpio, GPIO_SWITCH_ON); - mdelay(10); - - wifi_gpio_operate(&power_save_gpio, GPIO_SWITCH_ON); - msleep(130); - - /* Reset sequence if necessary. */ - wifi_reset_card(); - - return 0; -} - -int wifi_turn_on_ar6002_card(void) -{ - /* - * Make sure we are in power off. - * AR6002 requires PWN first before IO supply. - */ - wifi_gpio_operate(&power_save_gpio, GPIO_SWITCH_OFF); - wifi_gpio_operate(&power_gpio, GPIO_SWITCH_OFF); - mdelay(10); - - wifi_gpio_operate(&power_save_gpio, GPIO_SWITCH_ON); - mdelay(1); - - wifi_gpio_operate(&power_gpio, GPIO_SWITCH_ON); - mdelay(3); - - /* - * Give a reset wave. - */ - wifi_gpio_operate(&power_save_gpio, GPIO_SWITCH_OFF); - mdelay(3); - wifi_gpio_operate(&power_save_gpio, GPIO_SWITCH_ON); - mdelay(20); - - return 0; -} - -int wifi_turn_on_rt3070_card(void) -{ - wifi_gpio_operate(&power_gpio, GPIO_SWITCH_ON); - if (power_gpio.use_gpio != POWER_NOT_USE_GPIO) - msleep(1000); - - return 0; -} - -int wifi_turn_on_card(int module) -{ - wifi_turn_on_callback(); - - if (module == WIFI_CHIP_MV8686) - wifi_turn_on_mv8686_card(); - else if (module == WIFI_CHIP_AR6002) - wifi_turn_on_ar6002_card(); - else if (module == WIFI_CHIP_BCM4319) - wifi_turn_on_bcm4319_card(); - else if (module == WIFI_CHIP_NRX700) - wifi_turn_on_nrx700_card(); - else if (module == WIFI_CHIP_RT3070) - wifi_turn_on_rt3070_card(); - else - printk("%s: invalid module ID.\n", __func__); - - /* Reset sequence if necessary. */ - wifi_reset_card(); - - return 0; -} - -int wifi_turn_off_card(void) -{ - wifi_gpio_operate(&power_reset_gpio, GPIO_SWITCH_OFF); - wifi_gpio_operate(&power_save_gpio, GPIO_SWITCH_OFF); - mdelay(1); - wifi_gpio_operate(&power_gpio, GPIO_SWITCH_OFF); - mdelay(3); - - wifi_turn_off_callback(); - - return 0; -} - -void rockchip_wifi_shutdown(void) -{ - printk("rockchip_wifi_shutdown....\n"); - - wifi_turn_off_card(); -} -EXPORT_SYMBOL(rockchip_wifi_shutdown); - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/wifi_power_save.c b/drivers/net/wireless/wifi_power/wifi_power_save.c deleted file mode 100755 index 3c4ba0017019..000000000000 --- a/drivers/net/wireless/wifi_power/wifi_power_save.c +++ /dev/null @@ -1,469 +0,0 @@ -/* - * Wifi power save module. - * - * Yongle Lai @ Rockchip Fuzhou - */ - -#include -#include -#include -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) -#include -#endif -#include -#include -#include -#include - -#include "wifi_power.h" - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) -extern struct inet_hashinfo __cacheline_aligned tcp_hashinfo; -#else -extern struct inet_hashinfo tcp_hashinfo; -#endif - -struct timer_list wifi_ps_timer; -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) -android_suspend_lock_t wifi_android_lock; -#endif - -#define TIMER_INTERVAL 2000 //unit is micro second. -#define IDLE_SW_COUNT 8 //16 seconds from BUSY to IDLE -/* - * When wifi driver isn't ready. We should be IDLE. - */ -volatile static int wifi_net_state = WIFI_NETWORK_IDLE; -struct net_device *wlan_netdev = NULL; -unsigned long wifi_iptx_packets = 0, wifi_iptx_packets_back = 0; -unsigned long wifi_iprx_packets = 0, wifi_iprx_packets_back = 0; -unsigned int wifi_iptx = 0, wifi_iprx = 0; - -int (*wifi_power_save_callback)(int status) = NULL; - -int wifi_ps_active = 0; //Whether we should work. - -void wifi_power_save_suspend(void) -{ - wifi_ps_active = 0; -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - //android_lock_suspend(&wifi_android_lock); -#endif -} - -void wifi_power_save_resume(void) -{ - wifi_ps_active = 1; -} - -int wifi_power_save_register_callback(int (*callback)(int status)) -{ - //printk("%s: enter....\n", __func__); - - wifi_power_save_callback = callback; - - return 0; -} - -/* - * Do statistics 20 seconds. - */ -int wifi_evaluate_rx_traffic(void) -{ - //int ret = 1; - static int count = 0; - - if (wlan_netdev == NULL) - { - printk("wlan_netdev is NULL.\n"); - return 1; - } - - if (count < 10) /* 10 * 2 = 20 seconds */ - { - count++; - return wifi_iprx; - } - - count = 0; - - wifi_iprx_packets = wlan_netdev->stats.rx_packets; - - /* - * 3 packets in 20 seconds mean connection is active. - */ - if ((wifi_iprx_packets - wifi_iprx_packets_back) >= 2) - { - wifi_iprx = 1; - } - else - { - wifi_iprx = 0; - } - - wifi_iprx_packets_back = wifi_iprx_packets; - - return wifi_iprx; -} - -int wifi_evaluate_tx_traffic(void) -{ - //int ret = 1; - static int count = 0; - - if (wlan_netdev == NULL) - { - printk("wlan_netdev is NULL.\n"); - return 1; - } - - if (count < 10) /* 10 * 2 = 20 seconds */ - { - count++; - return wifi_iptx; - } - - count = 0; - - wifi_iptx_packets = wlan_netdev->stats.tx_packets; - - /* - * 2 packets in 20 seconds mean connection is active. - */ - if ((wifi_iptx_packets - wifi_iptx_packets_back) >= 2) - { - wifi_iptx = 1; - } - else - { - wifi_iptx = 0; - } - - wifi_iptx_packets_back = wifi_iptx_packets; - - return wifi_iptx; -} - -#if 0 -int wifi_evaluate_traffic(void) -{ - int ret = 1; - - if (wlan_netdev == NULL) - { - printk("wlan_netdev is NULL.\n"); - return 1; - } - - wifi_iprx_packets = wlan_netdev->stats.rx_packets; - wifi_iptx_packets = wlan_netdev->stats.tx_packets; - - /* - * 3 packets in 10 seconds mean connection is active. - */ - if ((wifi_iptx_packets - wifi_iptx_packets_back) >= 2) - wifi_iptx = 0; - else - wifi_iptx++; - - if ((wifi_iprx_packets - wifi_iprx_packets_back) >= 2) - wifi_iprx = 0; - else - wifi_iprx++; - - //printk("wifi_packets: TX = %lu RX = %lu ", wifi_iptx_packets, wifi_iprx_packets); - //printk("NO IP: TX = %u RX = %u\n", wifi_iptx, wifi_iprx); - - /* NO tx and rx, we are idle. */ - if ((wifi_iptx >= 10) && (wifi_iprx >= 10)) - ret = 0; - - wifi_iptx_packets_back = wifi_iptx_packets; - wifi_iprx_packets_back = wifi_iprx_packets; - - return ret; -} -#endif - -int wifi_check_tcp_connection(void) -{ - int bucket, num = 0; - struct inet_sock *inet = NULL; - __be32 dest; - - for (bucket = 0; bucket < tcp_hashinfo.ehash_size; ++bucket) - { - struct sock *sk; -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - struct hlist_node *node; - rwlock_t *lock = inet_ehash_lockp(&tcp_hashinfo, bucket); - - read_lock_bh(lock); - - sk_for_each(sk, node, &tcp_hashinfo.ehash[bucket].chain) -#else - struct hlist_nulls_node *node; - spinlock_t *lock = inet_ehash_lockp(&tcp_hashinfo, bucket); - - spin_lock_bh(lock); - - sk_nulls_for_each(sk, node, &tcp_hashinfo.ehash[bucket].chain) -#endif - { - if ((sk->__sk_common.skc_state != TCP_ESTABLISHED) && - (sk->__sk_common.skc_state != TCP_SYN_SENT) && - (sk->__sk_common.skc_state != TCP_SYN_SENT)) - continue; - - /* - * tcp 0 0 127.0.0.1:34937 127.0.0.1:54869 ESTABLISHED - */ - inet = inet_sk(sk); - dest = inet->daddr; - //printk("destination address: %x\n", dest); - if ((dest == 0x100007F) || (dest == 0)) - continue; - - num++; - //printk("connection state: %x\n", sk->__sk_common.skc_state); - } -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - read_unlock_bh(lock); -#else - spin_unlock_bh(lock); -#endif - } - - return num; -} - -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25) -extern struct udp_table udp_table; -#endif - -int wifi_check_udp_connection(void) -{ - struct sock *sk; - int num = 0, bucket; - struct inet_sock *inet = NULL; - __be32 dest; - - - - for (bucket = 0; bucket < UDP_HTABLE_SIZE; ++bucket) - { -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - struct hlist_node *node; - - read_lock(&udp_hash_lock); - - sk_for_each(sk, node, udp_hash + bucket) -#else - struct hlist_nulls_node *node; - struct udp_hslot *hslot = &udp_table.hash[bucket]; - - spin_lock_bh(&hslot->lock); - - sk_nulls_for_each(sk, node, &hslot->head) -#endif - { - inet = inet_sk(sk); - dest = inet->daddr; - - if ((dest == 0x100007F) || (dest == 0)) - continue; - - num++; - } -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - read_unlock(&udp_hash_lock); -#else - spin_unlock_bh(&hslot->lock); -#endif - } - - return num; -} - -int wifi_check_mcast_connection(void) -{ - int ret = 0; - - //printk("Multicast group: %d\n", wlan_netdev->mc_count); - - if (wlan_netdev && (wlan_netdev->mc_count > 1)) - ret = wlan_netdev->mc_count - 1; - - return ret; -} - -int idle_count = 0; - -static int wifi_ps_sm(int new_state) -{ - if (new_state == WIFI_NETWORK_BUSY) - { - idle_count = 0; - return WIFI_NETWORK_BUSY; - } - - if (new_state == WIFI_NETWORK_IDLE) - { - if (idle_count >= IDLE_SW_COUNT) - return WIFI_NETWORK_IDLE; - else - { - idle_count++; - return WIFI_NETWORK_BUSY; - } - } - - return WIFI_NETWORK_IDLE; -} - -static void wifi_ps_timer_fn(unsigned long data) -{ - int tcp, udp, tx = 0, rx = 0, new_state; - int mcast = 0; - - if (wifi_ps_active == 0) - { - printk("Power save module is IDLE for now.\n"); - goto out; - } - - tcp = wifi_check_tcp_connection(); - udp = wifi_check_udp_connection(); - tx = wifi_evaluate_tx_traffic(); - rx = wifi_evaluate_rx_traffic(); - mcast = wifi_check_mcast_connection(); - //printk("Network state: m=%d t=%d u=%d tx=%d rx=%d.\n", mcast, tcp, udp, tx, rx); - - /* - * Initially, multicast group number is 1. - */ - if ((tcp == 0) && (udp == 0) && (mcast <= 0)) - { - new_state = wifi_ps_sm(WIFI_NETWORK_IDLE); - } - else if ((wifi_net_state == WIFI_NETWORK_IDLE) && - ((tcp > 0) || (udp > 0))) - { - new_state = wifi_ps_sm(WIFI_NETWORK_BUSY); - } - else if ((tx == 0) && (rx == 0)) - { - new_state = wifi_ps_sm(WIFI_NETWORK_IDLE); - } - else - { - new_state = wifi_ps_sm(WIFI_NETWORK_BUSY); - } - - if (new_state != wifi_net_state) - { - wifi_net_state = new_state; - if (new_state == WIFI_NETWORK_IDLE) - { - printk("Network is IDLE, m=%d t=%d u=%d tx=%d rx=%d.\n", mcast, tcp, udp, tx, rx); - - if (wifi_power_save_callback != NULL) - wifi_power_save_callback(WIFI_NETWORK_IDLE); -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - android_unlock_suspend(&wifi_android_lock); -#endif - } - else - { - printk("Network is BUSY, m=%d t=%d u=%d tx=%d rx=%d.\n", mcast, tcp, udp, tx, rx); -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - android_lock_suspend(&wifi_android_lock); -#endif - if (wifi_power_save_callback != NULL) - wifi_power_save_callback(WIFI_NETWORK_BUSY); - } - } -out: - mod_timer(&wifi_ps_timer, jiffies + msecs_to_jiffies(TIMER_INTERVAL)); -} - -/* - * Return the current network status, which indicates - * whether network is busy or not. - */ -int wifi_power_save_state(void) -{ - return wifi_net_state; -} - -int wifi_power_save_init(void) -{ - int ret = 0; - - //wifi_power_save_callback = NULL; - - wifi_ps_active = 1; - wifi_iptx_packets = 0; - wifi_iprx_packets = 0; - wifi_iptx_packets_back = 0; - wifi_iprx_packets_back = 0; - wifi_iptx = 1; - wifi_iprx = 1; - idle_count = 0; - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - wifi_android_lock.name = "wifidev"; - - android_init_suspend_lock(&wifi_android_lock); - android_lock_suspend(&wifi_android_lock); -#endif - wifi_net_state = WIFI_NETWORK_BUSY; - - wlan_netdev = dev_get_by_name(&init_net, "wlan0"); - if (wlan_netdev == NULL) - printk("%s: couldn't find net_device for wlan0.\n", __func__); - - /* - * Create a timer to check network status. - */ - setup_timer(&wifi_ps_timer, wifi_ps_timer_fn, (unsigned long)0); - mod_timer(&wifi_ps_timer, jiffies + msecs_to_jiffies(15000)); - - return ret; -} - -int wifi_power_save_stop(void) -{ - wifi_ps_active = 0; - msleep(3); - - del_timer_sync(&wifi_ps_timer); - - if (wlan_netdev != NULL) - dev_put(wlan_netdev); - - wlan_netdev = NULL; - - return 0; -} - -int wifi_power_save_exit(void) -{ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) - android_unlock_suspend(&wifi_android_lock); - android_uninit_suspend_lock(&wifi_android_lock); -#endif - wifi_net_state = WIFI_NETWORK_IDLE; - - wifi_power_save_callback = NULL; - - wifi_iptx_packets = 0; - wifi_iprx_packets = 0; - wifi_iptx_packets_back = 0; - wifi_iprx_packets_back = 0; - wifi_iptx = 0; - wifi_iprx = 0; - - return 0; -} - diff --git a/drivers/net/wireless/wifi_power/wifi_power_usb.c b/drivers/net/wireless/wifi_power/wifi_power_usb.c deleted file mode 100755 index c8e6fcc84e51..000000000000 --- a/drivers/net/wireless/wifi_power/wifi_power_usb.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * wifi_power.c - * - * Power control for WIFI module. - * - * There are Power supply and Power Up/Down controls for WIFI typically. - */ -#include -#include -#include -#include - -#include "wifi_power.h" - -#if (WIFI_GPIO_POWER_CONTROL == 1) - -#ifdef CONFIG_RALINK_RT3070 - -int wifi_change_usb_mode = 0; -int usb_wifi_status = 0; - -void wifi_usb_init(void) -{ - wifi_change_usb_mode = 0; - usb_wifi_status = 0; -} - -#define DONT_SWITCH_USB 0 /* Don't switch USB automaticately. */ -#define WIFI_USE_OTG 1 /* WiFi will be connected to USB OTG. */ -#define WIFI_USE_HOST11 2 /* WiFi will be connected to USB HOST 1.1. */ - -#define WIFI_USE_IFACE 2 - -#if (WIFI_USE_IFACE == WIFI_USE_OTG) - -#define USB_NORMAL 0 -#define USB_FORCE_HOST 1 -#define USB_FORCE_DEVICE 2 - -extern int usb_force_usb_for_wifi(int mode); - -/* - * Change USB mode to HOST. - */ -int wifi_activate_usb(void) -{ - wifi_turn_on_card(WIFI_CHIP_RT3070); - - wifi_change_usb_mode = usb_force_usb_for_wifi(USB_FORCE_HOST); - msleep(1000); - - usb_wifi_status = 1; - - return 0; -} - -/* - * Change USB mode to be original. - */ -int wifi_deactivate_usb(void) -{ - if (wifi_change_usb_mode == 1) - { - usb_force_usb_for_wifi(USB_FORCE_DEVICE); - msleep(1000); - usb_force_usb_for_wifi(USB_NORMAL); - msleep(1000); - } - wifi_turn_off_card(); - - usb_wifi_status = 0; - - return 0; -} - -#elif (WIFI_USE_IFACE == WIFI_USE_HOST11) - -extern int usb_switch_usb_host11_for_wifi(int enabled); - -int wifi_deactivate_usb(void) -{ - usb_switch_usb_host11_for_wifi(0); - msleep(1000); - - wifi_turn_off_card(); - msleep(100); - - return 0; -} - -int wifi_activate_usb(void) -{ - wifi_turn_on_card(WIFI_CHIP_RT3070); - msleep(100); - - usb_switch_usb_host11_for_wifi(1); - msleep(1000); - - return 0; -} - -#else - -int wifi_deactivate_usb(void) -{ - return 0; -} - -int wifi_activate_usb(void) -{ - return 0; -} -#endif - -#endif /* CONFIG_RALINK_RT3070 */ - -#endif /* WIFI_GPIO_POWER_CONTROL */ - diff --git a/drivers/net/wireless/wifi_power/wifi_version.h b/drivers/net/wireless/wifi_power/wifi_version.h deleted file mode 100644 index 5282f726f89a..000000000000 --- a/drivers/net/wireless/wifi_power/wifi_version.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Yongle Lai @ Rockchip - */ -#ifndef WIFI_VERSION_H -#define WIFI_VERSION_H - -/* - * Marvell MV8686 driver version. - */ -#define MV8686_DRV_VERSION "2.35" - -/* - * Atheros AR6002 driver version. - */ -#define AR6002_DRV_VERSION "3.11" - -/* - * Ralink RT3070 driver version. - */ -#define RT3070_DRV_VERSION "2.10" - -/* - * Broadcom BCM4319 driver version. - */ -#define BCM4319_DRV_VERSION "1.05" - -/* - * Nanoradio NRX700 driver version. - */ -#define NRX700_DRV_VERSION "2.02" - -/* - * Marvell MV8787 driver version. - */ -#define MV8787_DRV_VERSION "1.00" - -/* - * Realtek RTL8188 driver version. - */ -#define RTL8192_DRV_VERSION "0.02" - -#endif /* WIFI_VERSION_H */ - diff --git a/drivers/net/wireless/wifi_sys/rkwifi_sys_iface.c b/drivers/net/wireless/wifi_sys/rkwifi_sys_iface.c deleted file mode 100755 index dc1a8f8ca2ff..000000000000 --- a/drivers/net/wireless/wifi_sys/rkwifi_sys_iface.c +++ /dev/null @@ -1,439 +0,0 @@ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_MACH_RK_FAC -#include -extern int wifi_type; -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) -static ssize_t wifi_chip_read(struct class *cls, struct class_attribute *attr, char *_buf) -#else -static ssize_t wifi_chip_read(struct class *cls, char *_buf) -#endif -{ - int count = 0; - -#ifdef CONFIG_MACH_RK_FAC - if(wifi_type==WIFI_TYPE_RTL8188CU) { - count = sprintf(_buf, "%s", "RTL8188CU"); - printk("Current WiFi chip is RTL8188CU.\n"); - return count; - } else if(wifi_type==WIFI_TYPE_RTL8188EU) { - count = sprintf(_buf, "%s", "RTL8188EU"); - printk("Current WiFi chip is RTL8188EU.\n"); - return count; - } else if(wifi_type==WIFI_TYPE_MT7601) { - count = sprintf(_buf, "%s", "MT7601"); - printk("Current WiFi chip is MT7601.\n"); - return count; - } else if(wifi_type==WIFI_TYPE_RTL8188ETV) { - count = sprintf(_buf, "%s", "RTL8188ETV"); - printk("Current WiFi chip is RTL8188ETV.\n"); - return count; - } else if(wifi_type==WIFI_TYPE_MT5370) { - count = sprintf(_buf, "%s", "MT5370"); - printk("Current WiFi chip is MT5370.\n"); - return count; - } else { - //printk("NOT surpport type %d\n",wifi_type); - } -#endif - -#ifdef CONFIG_BCM4329 - count = sprintf(_buf, "%s", "BCM4329"); - printk("Current WiFi chip is BCM4329.\n"); -#endif - -#ifdef CONFIG_RTL8192CU - count = sprintf(_buf, "%s", "RTL8188CU"); - printk("Current WiFi chip is RTL8188CU.\n"); -#endif - -#ifdef CONFIG_RTL8188EU - count = sprintf(_buf, "%s", "RTL8188EU"); - printk("Current WiFi chip is RTL8188EU.\n"); -#endif - -#ifdef CONFIG_RTL8723AU - count = sprintf(_buf, "%s", "RTL8723AU"); - printk("Current WiFi chip is RTL8723AU.\n"); -#endif - -#ifdef CONFIG_RTL8189ES - count = sprintf(_buf, "%s", "RTL8189ES"); - printk("Current WiFi chip is RTL8189ES.\n"); -#endif - -#ifdef CONFIG_BCM4330 - count = sprintf(_buf, "%s", "BCM4330"); - printk("Current WiFi chip is BCM4330.\n"); -#endif - -#ifdef CONFIG_RK901 -#ifdef CONFIG_BCM_OOB_ENABLED - count = sprintf(_buf, "%s", "OOB_RK901"); - printk("Current WiFi chip is RK901(OOB)\n"); -#else - count = sprintf(_buf, "%s", "RK901"); - printk("Current WiFi chip is RK901.\n"); -#endif -#endif - -#ifdef CONFIG_RK903 -#ifdef CONFIG_BCM_OOB_ENABLED - count = sprintf(_buf, "%s", "OOB_RK903"); - printk("Current WiFi chip is RK903(OOB)\n"); -#else - count = sprintf(_buf, "%s", "RK903"); - printk("Current WiFi chip is RK903.\n"); -#endif -#endif - -#ifdef CONFIG_AP6181 -#ifdef CONFIG_BCM_OOB_ENABLED - count = sprintf(_buf, "%s", "OOB_RK901"); - printk("Current WiFi chip is AP6181(OOB)\n"); -#else - count = sprintf(_buf, "%s", "RK901"); - printk("Current WiFi chip is AP6181.\n"); -#endif -#endif - -#ifdef CONFIG_AP6210 -#ifdef CONFIG_BCM_OOB_ENABLED - count = sprintf(_buf, "%s", "OOB_RK901"); - printk("Current WiFi chip is AP6210(OOB)\n"); -#else - count = sprintf(_buf, "%s", "RK901"); - printk("Current WiFi chip is AP6210.\n"); -#endif -#endif - -#ifdef CONFIG_AP6330 -#ifdef CONFIG_BCM_OOB_ENABLED - count = sprintf(_buf, "%s", "OOB_RK903"); - printk("Current WiFi chip is AP6330(OOB)\n"); -#else - count = sprintf(_buf, "%s", "RK903"); - printk("Current WiFi chip is AP6330.\n"); -#endif -#endif - -#ifdef CONFIG_AP6476 -#ifdef CONFIG_BCM_OOB_ENABLED - count = sprintf(_buf, "%s", "OOB_RK901"); - printk("Current WiFi chip is AP6476(OOB)\n"); -#else - count = sprintf(_buf, "%s", "RK901"); - printk("Current WiFi chip is AP6476.\n"); -#endif -#endif - -#ifdef CONFIG_AP6493 -#ifdef CONFIG_BCM_OOB_ENABLED - count = sprintf(_buf, "%s", "OOB_RK903"); - printk("Current WiFi chip is AP6493(OOB)\n"); -#else - count = sprintf(_buf, "%s", "RK903"); - printk("Current WiFi chip is AP6493.\n"); -#endif -#endif - -#ifdef CONFIG_GB86302I -#ifdef CONFIG_BCM_OOB_ENABLED - count = sprintf(_buf, "%s", "OOB_RK903"); - printk("Current WiFi chip is GB86302I(OOB)\n"); -#else - count = sprintf(_buf, "%s", "RK903"); - printk("Current WiFi chip is GB86302I.\n"); -#endif -#endif - -#ifdef CONFIG_MTK_COMBO - count = sprintf(_buf, "%s", "MT6620"); - printk("Current WiFi chip is MT6620.\n"); -#endif - -#ifdef CONFIG_RT5370 - count = sprintf(_buf, "%s", "RT5370"); - printk("Current WiFi chip is RT5370.\n"); -#endif - -#ifdef CONFIG_MT5931 - count = sprintf(_buf, "%s", "MT5931"); - printk("Current WiFi chip is MT5931.\n"); -#endif - -#ifdef CONFIG_MT5931_MT6622 - count = sprintf(_buf, "%s", "MT5931"); - printk("Current WiFi chip is MT5931.\n"); -#endif - -#ifdef CONFIG_MT7601 - count = sprintf(_buf, "%s", "MT7601"); - printk("Current WiFi chip is MT7601.\n"); -#endif - - -#ifdef CONFIG_RTL8723AS - count = sprintf(_buf, "%s", "RTL8723AS"); - printk("Current WiFi chip is RTL8723AS.\n"); -#endif - -#ifdef CONFIG_ESP8089 - count = sprintf(_buf, "%s", "ESP8089"); - printk("Current WiFi chip is ESP8089.\n"); -#endif - - return count; -} - -/* -static ssize_t wifi_channel_write(struct class *cls, const char *_buf, size_t _count) -{ - int ret, channel; - - if (wifi_enabled == 0) - { - printk("WiFi is disabled.\n"); - return _count; - } - - channel = simple_strtol(_buf, NULL, 10); - - ret = wifi_emi_set_channel(channel); - if (ret != 0) - { - //printk("Set channel=%d fail.\n", channel); - } - else - { - //printk("Set channel=%d successfully.\n", channel); - wifi_channel = channel; - } - - return _count; -} -*/ - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) -static ssize_t wifi_p2p_read(struct class *cls, struct class_attribute *attr, char *_buf) -#else -static ssize_t wifi_p2p_read(struct class *cls, char *_buf) -#endif -{ - int count = 0; - -#ifdef CONFIG_BK3515A_COMBO - count = sprintf(_buf, "%s", "BK3515A"); - printk("Current WiFi chip is ESP8089+BK3515A Combo.\n"); -#endif - -#ifdef CONFIG_BCM4329 - count = sprintf(_buf, "%s", "false"); - printk("Current WiFi chip BCM4329 doesn't support direct.(%s)\n", _buf); -#endif - -#ifdef CONFIG_RTL8192CU - count = sprintf(_buf, "%s", "false"); - printk("Current WiFi chip RTL8188 support direct.(%s)\n", _buf); -#endif - -#ifdef CONFIG_RK903 - count = sprintf(_buf, "%s", "true"); - printk("Current WiFi chip RK903 support direct.(%s)\n", _buf); -#endif - -#ifdef CONFIG_BCM4330 - count = sprintf(_buf, "%s", "true"); - printk("Current WiFi chip BCM4330 support direct.(%s)\n", _buf); -#endif - - return count; -} - -int wifi_pcba_test = 0; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) -static ssize_t wifi_pcba_read(struct class *cls, struct class_attribute *attr, char *_buf) -#else -static ssize_t wifi_pcba_read(struct class *cls, char *_buf) -#endif -{ - int count = 0; - - count = sprintf(_buf, "%d", wifi_pcba_test); - return count; -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) -static ssize_t wifi_pcba_write(struct class *cls, struct class_attribute *attr, const char *_buf, size_t _count) -#else -static ssize_t wifi_pcba_write(struct class *cls, char *_buf, size_t _count) -#endif -{ - wifi_pcba_test = simple_strtol(_buf, NULL, 10); - if(wifi_pcba_test > 0) { - wifi_pcba_test = 1; - } - return _count; -} - -#ifdef CONFIG_AIDC -int check_wifi_type_from_id(int id, char * _buf) { - int count = 0; - - switch(id) { - case 0x8179: - count = sprintf(_buf, "%s", "RTL8188EU"); - printk("Current WiFi chip is RTL8188EU.\n"); - break; - case 0x0179: - count = sprintf(_buf, "%s", "RTL8188EU"); - printk("Current WiFi chip is RTL8188ETV.\n"); - break; - case 0x5370: - count = sprintf(_buf, "%s", "RT5370"); - printk("Current WiFi chip is RT5370.\n"); - break; - case 0x0724: - count = sprintf(_buf, "%s", "RTL8723AU"); - printk("Current WiFi chip is RTL8723AU.\n"); - break; - case 0x8176: - count = sprintf(_buf, "%s", "RTL8188CU"); - printk("Current WiFi chip is RTL8188CU.\n"); - break; - case 0x018A: - count = sprintf(_buf, "%s", "RTL8188CU"); - printk("Current WiFi chip is RTL8188CTV.\n"); - break; - default: - printk("Unsupported usb wifi.............\n"); - } - return count; -} - -extern int rk29sdk_wifi_power(int on); -extern int wifi_activate_usb(void); -extern int wifi_deactivate_usb(void); -#define USB_IDP_SYS_PATCH_1 "/sys/bus/usb/devices/1-1/idProduct" -#define USB_IDP_SYS_PATCH_2 "/sys/bus/usb/devices/2-1/idProduct" -#define USB_IDV_SYS_PATCH_1 "/sys/bus/usb/devices/1-1/idVendor" -#define USB_IDV_SYS_PATCH_2 "/sys/bus/usb/devices/2-1/idVendor" -#define USB_PRODUCT_SYS_PATCH "/sys/bus/usb/devices/1-1/product" -//5370 802.11 n WLAN -//8723 802.11n WLAN Adapter -//8188eu 802.11n NIC -//8188cu 802.11n WLAN Adapter -char aidc_type[20] = {0}; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) -static ssize_t wifi_aidc_read(struct class *cls, struct class_attribute *attr, char *_buf) -#else -static ssize_t wifi_aidc_read(struct class *cls, char *_buf) -#endif -{ - int count = 0, retry = 10, idP = 0;// idV = 0; - ssize_t nread; - loff_t pos = 0; - char usbid[20] = {0}; - struct file *file = NULL; - mm_segment_t old_fs; - - sprintf(_buf, "%s", "UNKNOW"); - wifi_activate_usb(); - msleep(2000); - old_fs = get_fs(); - set_fs(KERNEL_DS); - while(retry--) { - file = filp_open(USB_IDP_SYS_PATCH_2, O_RDONLY, 0); - if (IS_ERR(file)) { - printk("\nCannot open \"%s\", retry = %d\n", USB_IDP_SYS_PATCH_2, retry); - file = filp_open(USB_IDP_SYS_PATCH_1, O_RDONLY, 0); - if (IS_ERR(file)) { - printk("\nCannot open \"%s\", retry = %d\n", USB_IDP_SYS_PATCH_1, retry); - msleep(500); - continue; - } - } - break; - } - if(retry <= 0) { - set_fs(old_fs); - return count; - } - nread = vfs_read(file, (char __user *)usbid, sizeof(usbid), &pos); - set_fs(old_fs); - filp_close(file, NULL); - wifi_deactivate_usb(); - idP = simple_strtol(usbid, NULL, 16); - printk("Get usb wifi idProduct = 0X%04X\n", idP); - count = check_wifi_type_from_id(idP, _buf); - - return count; -} -#endif //CONFIG_AIDC - -static struct class *rkwifi_class = NULL; -static CLASS_ATTR(chip, 0664, wifi_chip_read, NULL); -static CLASS_ATTR(p2p, 0664, wifi_p2p_read, NULL); -static CLASS_ATTR(pcba, 0664, wifi_pcba_read, wifi_pcba_write); -#ifdef CONFIG_AIDC -static CLASS_ATTR(aidc, 0664, wifi_aidc_read, NULL); -#endif - -int rkwifi_sysif_init(void) -{ - int ret; - - printk("Rockchip WiFi SYS interface (V1.00) ... \n"); - - rkwifi_class = NULL; - - rkwifi_class = class_create(THIS_MODULE, "rkwifi"); - if (IS_ERR(rkwifi_class)) - { - printk("Create class rkwifi_class failed.\n"); - return -ENOMEM; - } - - ret = class_create_file(rkwifi_class, &class_attr_chip); - ret = class_create_file(rkwifi_class, &class_attr_p2p); - ret = class_create_file(rkwifi_class, &class_attr_pcba); -#ifdef CONFIG_AIDC - ret = class_create_file(rkwifi_class, &class_attr_aidc); -#endif - - return 0; -} - -void rkwifi_sysif_exit(void) -{ - // need to remove the sys files and class - class_remove_file(rkwifi_class, &class_attr_chip); - class_remove_file(rkwifi_class, &class_attr_p2p); - class_remove_file(rkwifi_class, &class_attr_pcba); -#ifdef CONFIG_AIDC - class_remove_file(rkwifi_class, &class_attr_aidc); -#endif - class_destroy(rkwifi_class); - - rkwifi_class = NULL; -} - -module_init(rkwifi_sysif_init); -module_exit(rkwifi_sysif_exit); - -MODULE_AUTHOR("Yongle Lai"); -MODULE_DESCRIPTION("WiFi SYS @ Rockchip"); -MODULE_LICENSE("GPL"); - diff --git a/drivers/net/wireless/wl3501.h b/drivers/net/wireless/wl3501.h deleted file mode 100644 index 3fbfd19818f1..000000000000 --- a/drivers/net/wireless/wl3501.h +++ /dev/null @@ -1,615 +0,0 @@ -#ifndef __WL3501_H__ -#define __WL3501_H__ - -#include -#include - -/* define for WLA 2.0 */ -#define WL3501_BLKSZ 256 -/* - * ID for input Signals of DRIVER block - * bit[7-5] is block ID: 000 - * bit[4-0] is signal ID -*/ -enum wl3501_signals { - WL3501_SIG_ALARM, - WL3501_SIG_MD_CONFIRM, - WL3501_SIG_MD_IND, - WL3501_SIG_ASSOC_CONFIRM, - WL3501_SIG_ASSOC_IND, - WL3501_SIG_AUTH_CONFIRM, - WL3501_SIG_AUTH_IND, - WL3501_SIG_DEAUTH_CONFIRM, - WL3501_SIG_DEAUTH_IND, - WL3501_SIG_DISASSOC_CONFIRM, - WL3501_SIG_DISASSOC_IND, - WL3501_SIG_GET_CONFIRM, - WL3501_SIG_JOIN_CONFIRM, - WL3501_SIG_PWR_MGMT_CONFIRM, - WL3501_SIG_REASSOC_CONFIRM, - WL3501_SIG_REASSOC_IND, - WL3501_SIG_SCAN_CONFIRM, - WL3501_SIG_SET_CONFIRM, - WL3501_SIG_START_CONFIRM, - WL3501_SIG_RESYNC_CONFIRM, - WL3501_SIG_SITE_CONFIRM, - WL3501_SIG_SAVE_CONFIRM, - WL3501_SIG_RFTEST_CONFIRM, -/* - * ID for input Signals of MLME block - * bit[7-5] is block ID: 010 - * bit[4-0] is signal ID - */ - WL3501_SIG_ASSOC_REQ = 0x20, - WL3501_SIG_AUTH_REQ, - WL3501_SIG_DEAUTH_REQ, - WL3501_SIG_DISASSOC_REQ, - WL3501_SIG_GET_REQ, - WL3501_SIG_JOIN_REQ, - WL3501_SIG_PWR_MGMT_REQ, - WL3501_SIG_REASSOC_REQ, - WL3501_SIG_SCAN_REQ, - WL3501_SIG_SET_REQ, - WL3501_SIG_START_REQ, - WL3501_SIG_MD_REQ, - WL3501_SIG_RESYNC_REQ, - WL3501_SIG_SITE_REQ, - WL3501_SIG_SAVE_REQ, - WL3501_SIG_RF_TEST_REQ, - WL3501_SIG_MM_CONFIRM = 0x60, - WL3501_SIG_MM_IND, -}; - -enum wl3501_mib_attribs { - WL3501_MIB_ATTR_STATION_ID, - WL3501_MIB_ATTR_AUTH_ALGORITHMS, - WL3501_MIB_ATTR_AUTH_TYPE, - WL3501_MIB_ATTR_MEDIUM_OCCUPANCY_LIMIT, - WL3501_MIB_ATTR_CF_POLLABLE, - WL3501_MIB_ATTR_CFP_PERIOD, - WL3501_MIB_ATTR_CFPMAX_DURATION, - WL3501_MIB_ATTR_AUTH_RESP_TMOUT, - WL3501_MIB_ATTR_RX_DTIMS, - WL3501_MIB_ATTR_PRIV_OPT_IMPLEMENTED, - WL3501_MIB_ATTR_PRIV_INVOKED, - WL3501_MIB_ATTR_WEP_DEFAULT_KEYS, - WL3501_MIB_ATTR_WEP_DEFAULT_KEY_ID, - WL3501_MIB_ATTR_WEP_KEY_MAPPINGS, - WL3501_MIB_ATTR_WEP_KEY_MAPPINGS_LEN, - WL3501_MIB_ATTR_EXCLUDE_UNENCRYPTED, - WL3501_MIB_ATTR_WEP_ICV_ERROR_COUNT, - WL3501_MIB_ATTR_WEP_UNDECRYPTABLE_COUNT, - WL3501_MIB_ATTR_WEP_EXCLUDED_COUNT, - WL3501_MIB_ATTR_MAC_ADDR, - WL3501_MIB_ATTR_GROUP_ADDRS, - WL3501_MIB_ATTR_RTS_THRESHOLD, - WL3501_MIB_ATTR_SHORT_RETRY_LIMIT, - WL3501_MIB_ATTR_LONG_RETRY_LIMIT, - WL3501_MIB_ATTR_FRAG_THRESHOLD, - WL3501_MIB_ATTR_MAX_TX_MSDU_LIFETIME, - WL3501_MIB_ATTR_MAX_RX_LIFETIME, - WL3501_MIB_ATTR_MANUFACTURER_ID, - WL3501_MIB_ATTR_PRODUCT_ID, - WL3501_MIB_ATTR_TX_FRAG_COUNT, - WL3501_MIB_ATTR_MULTICAST_TX_FRAME_COUNT, - WL3501_MIB_ATTR_FAILED_COUNT, - WL3501_MIB_ATTR_RX_FRAG_COUNT, - WL3501_MIB_ATTR_MULTICAST_RX_COUNT, - WL3501_MIB_ATTR_FCS_ERROR_COUNT, - WL3501_MIB_ATTR_RETRY_COUNT, - WL3501_MIB_ATTR_MULTIPLE_RETRY_COUNT, - WL3501_MIB_ATTR_RTS_SUCCESS_COUNT, - WL3501_MIB_ATTR_RTS_FAILURE_COUNT, - WL3501_MIB_ATTR_ACK_FAILURE_COUNT, - WL3501_MIB_ATTR_FRAME_DUPLICATE_COUNT, - WL3501_MIB_ATTR_PHY_TYPE, - WL3501_MIB_ATTR_REG_DOMAINS_SUPPORT, - WL3501_MIB_ATTR_CURRENT_REG_DOMAIN, - WL3501_MIB_ATTR_SLOT_TIME, - WL3501_MIB_ATTR_CCA_TIME, - WL3501_MIB_ATTR_RX_TX_TURNAROUND_TIME, - WL3501_MIB_ATTR_TX_PLCP_DELAY, - WL3501_MIB_ATTR_RX_TX_SWITCH_TIME, - WL3501_MIB_ATTR_TX_RAMP_ON_TIME, - WL3501_MIB_ATTR_TX_RF_DELAY, - WL3501_MIB_ATTR_SIFS_TIME, - WL3501_MIB_ATTR_RX_RF_DELAY, - WL3501_MIB_ATTR_RX_PLCP_DELAY, - WL3501_MIB_ATTR_MAC_PROCESSING_DELAY, - WL3501_MIB_ATTR_TX_RAMP_OFF_TIME, - WL3501_MIB_ATTR_PREAMBLE_LEN, - WL3501_MIB_ATTR_PLCP_HEADER_LEN, - WL3501_MIB_ATTR_MPDU_DURATION_FACTOR, - WL3501_MIB_ATTR_AIR_PROPAGATION_TIME, - WL3501_MIB_ATTR_TEMP_TYPE, - WL3501_MIB_ATTR_CW_MIN, - WL3501_MIB_ATTR_CW_MAX, - WL3501_MIB_ATTR_SUPPORT_DATA_RATES_TX, - WL3501_MIB_ATTR_SUPPORT_DATA_RATES_RX, - WL3501_MIB_ATTR_MPDU_MAX_LEN, - WL3501_MIB_ATTR_SUPPORT_TX_ANTENNAS, - WL3501_MIB_ATTR_CURRENT_TX_ANTENNA, - WL3501_MIB_ATTR_SUPPORT_RX_ANTENNAS, - WL3501_MIB_ATTR_DIVERSITY_SUPPORT, - WL3501_MIB_ATTR_DIVERSITY_SELECTION_RS, - WL3501_MIB_ATTR_NR_SUPPORTED_PWR_LEVELS, - WL3501_MIB_ATTR_TX_PWR_LEVEL1, - WL3501_MIB_ATTR_TX_PWR_LEVEL2, - WL3501_MIB_ATTR_TX_PWR_LEVEL3, - WL3501_MIB_ATTR_TX_PWR_LEVEL4, - WL3501_MIB_ATTR_TX_PWR_LEVEL5, - WL3501_MIB_ATTR_TX_PWR_LEVEL6, - WL3501_MIB_ATTR_TX_PWR_LEVEL7, - WL3501_MIB_ATTR_TX_PWR_LEVEL8, - WL3501_MIB_ATTR_CURRENT_TX_PWR_LEVEL, - WL3501_MIB_ATTR_CURRENT_CHAN, - WL3501_MIB_ATTR_CCA_MODE_SUPPORTED, - WL3501_MIB_ATTR_CURRENT_CCA_MODE, - WL3501_MIB_ATTR_ED_THRESHOLD, - WL3501_MIB_ATTR_SINTHESIZER_LOCKED, - WL3501_MIB_ATTR_CURRENT_PWR_STATE, - WL3501_MIB_ATTR_DOZE_TURNON_TIME, - WL3501_MIB_ATTR_RCR33, - WL3501_MIB_ATTR_DEFAULT_CHAN, - WL3501_MIB_ATTR_SSID, - WL3501_MIB_ATTR_PWR_MGMT_ENABLE, - WL3501_MIB_ATTR_NET_CAPABILITY, - WL3501_MIB_ATTR_ROUTING, -}; - -enum wl3501_net_type { - WL3501_NET_TYPE_INFRA, - WL3501_NET_TYPE_ADHOC, - WL3501_NET_TYPE_ANY_BSS, -}; - -enum wl3501_scan_type { - WL3501_SCAN_TYPE_ACTIVE, - WL3501_SCAN_TYPE_PASSIVE, -}; - -enum wl3501_tx_result { - WL3501_TX_RESULT_SUCCESS, - WL3501_TX_RESULT_NO_BSS, - WL3501_TX_RESULT_RETRY_LIMIT, -}; - -enum wl3501_sys_type { - WL3501_SYS_TYPE_OPEN, - WL3501_SYS_TYPE_SHARE_KEY, -}; - -enum wl3501_status { - WL3501_STATUS_SUCCESS, - WL3501_STATUS_INVALID, - WL3501_STATUS_TIMEOUT, - WL3501_STATUS_REFUSED, - WL3501_STATUS_MANY_REQ, - WL3501_STATUS_ALREADY_BSS, -}; - -#define WL3501_MGMT_CAPABILITY_ESS 0x0001 /* see 802.11 p.58 */ -#define WL3501_MGMT_CAPABILITY_IBSS 0x0002 /* - " - */ -#define WL3501_MGMT_CAPABILITY_CF_POLLABLE 0x0004 /* - " - */ -#define WL3501_MGMT_CAPABILITY_CF_POLL_REQUEST 0x0008 /* - " - */ -#define WL3501_MGMT_CAPABILITY_PRIVACY 0x0010 /* - " - */ - -#define IW_REG_DOMAIN_FCC 0x10 /* Channel 1 to 11 USA */ -#define IW_REG_DOMAIN_DOC 0x20 /* Channel 1 to 11 Canada */ -#define IW_REG_DOMAIN_ETSI 0x30 /* Channel 1 to 13 Europe */ -#define IW_REG_DOMAIN_SPAIN 0x31 /* Channel 10 to 11 Spain */ -#define IW_REG_DOMAIN_FRANCE 0x32 /* Channel 10 to 13 France */ -#define IW_REG_DOMAIN_MKK 0x40 /* Channel 14 Japan */ -#define IW_REG_DOMAIN_MKK1 0x41 /* Channel 1-14 Japan */ -#define IW_REG_DOMAIN_ISRAEL 0x50 /* Channel 3 - 9 Israel */ - -#define IW_MGMT_RATE_LABEL_MANDATORY 128 /* MSB */ - -enum iw_mgmt_rate_labels { - IW_MGMT_RATE_LABEL_1MBIT = 2, - IW_MGMT_RATE_LABEL_2MBIT = 4, - IW_MGMT_RATE_LABEL_5_5MBIT = 11, - IW_MGMT_RATE_LABEL_11MBIT = 22, -}; - -enum iw_mgmt_info_element_ids { - IW_MGMT_INFO_ELEMENT_SSID, /* Service Set Identity */ - IW_MGMT_INFO_ELEMENT_SUPPORTED_RATES, - IW_MGMT_INFO_ELEMENT_FH_PARAMETER_SET, - IW_MGMT_INFO_ELEMENT_DS_PARAMETER_SET, - IW_MGMT_INFO_ELEMENT_CS_PARAMETER_SET, - IW_MGMT_INFO_ELEMENT_CS_TIM, /* Traffic Information Map */ - IW_MGMT_INFO_ELEMENT_IBSS_PARAMETER_SET, - /* 7-15: Reserved, unused */ - IW_MGMT_INFO_ELEMENT_CHALLENGE_TEXT = 16, - /* 17-31 Reserved for challenge text extension */ - /* 32-255 Reserved, unused */ -}; - -struct iw_mgmt_info_element { - u8 id; /* one of enum iw_mgmt_info_element_ids, - but sizeof(enum) > sizeof(u8) :-( */ - u8 len; - u8 data[0]; -} __packed; - -struct iw_mgmt_essid_pset { - struct iw_mgmt_info_element el; - u8 essid[IW_ESSID_MAX_SIZE]; -} __packed; - -/* - * According to 802.11 Wireless Netowors, the definitive guide - O'Reilly - * Pg 75 - */ -#define IW_DATA_RATE_MAX_LABELS 8 - -struct iw_mgmt_data_rset { - struct iw_mgmt_info_element el; - u8 data_rate_labels[IW_DATA_RATE_MAX_LABELS]; -} __packed; - -struct iw_mgmt_ds_pset { - struct iw_mgmt_info_element el; - u8 chan; -} __packed; - -struct iw_mgmt_cf_pset { - struct iw_mgmt_info_element el; - u8 cfp_count; - u8 cfp_period; - u16 cfp_max_duration; - u16 cfp_dur_remaining; -} __packed; - -struct iw_mgmt_ibss_pset { - struct iw_mgmt_info_element el; - u16 atim_window; -} __packed; - -struct wl3501_tx_hdr { - u16 tx_cnt; - u8 sync[16]; - u16 sfd; - u8 signal; - u8 service; - u16 len; - u16 crc16; - u16 frame_ctrl; - u16 duration_id; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 addr3[ETH_ALEN]; - u16 seq_ctrl; - u8 addr4[ETH_ALEN]; -}; - -struct wl3501_rx_hdr { - u16 rx_next_blk; - u16 rc_next_frame_blk; - u8 rx_blk_ctrl; - u8 rx_next_frame; - u8 rx_next_frame1; - u8 rssi; - char time[8]; - u8 signal; - u8 service; - u16 len; - u16 crc16; - u16 frame_ctrl; - u16 duration; - u8 addr1[ETH_ALEN]; - u8 addr2[ETH_ALEN]; - u8 addr3[ETH_ALEN]; - u16 seq; - u8 addr4[ETH_ALEN]; -}; - -struct wl3501_start_req { - u16 next_blk; - u8 sig_id; - u8 bss_type; - u16 beacon_period; - u16 dtim_period; - u16 probe_delay; - u16 cap_info; - struct iw_mgmt_essid_pset ssid; - struct iw_mgmt_data_rset bss_basic_rset; - struct iw_mgmt_data_rset operational_rset; - struct iw_mgmt_cf_pset cf_pset; - struct iw_mgmt_ds_pset ds_pset; - struct iw_mgmt_ibss_pset ibss_pset; -}; - -struct wl3501_assoc_req { - u16 next_blk; - u8 sig_id; - u8 reserved; - u16 timeout; - u16 cap_info; - u16 listen_interval; - u8 mac_addr[ETH_ALEN]; -}; - -struct wl3501_assoc_confirm { - u16 next_blk; - u8 sig_id; - u8 reserved; - u16 status; -}; - -struct wl3501_assoc_ind { - u16 next_blk; - u8 sig_id; - u8 mac_addr[ETH_ALEN]; -}; - -struct wl3501_auth_req { - u16 next_blk; - u8 sig_id; - u8 reserved; - u16 type; - u16 timeout; - u8 mac_addr[ETH_ALEN]; -}; - -struct wl3501_auth_confirm { - u16 next_blk; - u8 sig_id; - u8 reserved; - u16 type; - u16 status; - u8 mac_addr[ETH_ALEN]; -}; - -struct wl3501_get_req { - u16 next_blk; - u8 sig_id; - u8 reserved; - u16 mib_attrib; -}; - -struct wl3501_get_confirm { - u16 next_blk; - u8 sig_id; - u8 reserved; - u16 mib_status; - u16 mib_attrib; - u8 mib_value[100]; -}; - -struct wl3501_join_req { - u16 next_blk; - u8 sig_id; - u8 reserved; - struct iw_mgmt_data_rset operational_rset; - u16 reserved2; - u16 timeout; - u16 probe_delay; - u8 timestamp[8]; - u8 local_time[8]; - u16 beacon_period; - u16 dtim_period; - u16 cap_info; - u8 bss_type; - u8 bssid[ETH_ALEN]; - struct iw_mgmt_essid_pset ssid; - struct iw_mgmt_ds_pset ds_pset; - struct iw_mgmt_cf_pset cf_pset; - struct iw_mgmt_ibss_pset ibss_pset; - struct iw_mgmt_data_rset bss_basic_rset; -}; - -struct wl3501_join_confirm { - u16 next_blk; - u8 sig_id; - u8 reserved; - u16 status; -}; - -struct wl3501_pwr_mgmt_req { - u16 next_blk; - u8 sig_id; - u8 pwr_save; - u8 wake_up; - u8 receive_dtims; -}; - -struct wl3501_pwr_mgmt_confirm { - u16 next_blk; - u8 sig_id; - u8 reserved; - u16 status; -}; - -struct wl3501_scan_req { - u16 next_blk; - u8 sig_id; - u8 bss_type; - u16 probe_delay; - u16 min_chan_time; - u16 max_chan_time; - u8 chan_list[14]; - u8 bssid[ETH_ALEN]; - struct iw_mgmt_essid_pset ssid; - enum wl3501_scan_type scan_type; -}; - -struct wl3501_scan_confirm { - u16 next_blk; - u8 sig_id; - u8 reserved; - u16 status; - char timestamp[8]; - char localtime[8]; - u16 beacon_period; - u16 dtim_period; - u16 cap_info; - u8 bss_type; - u8 bssid[ETH_ALEN]; - struct iw_mgmt_essid_pset ssid; - struct iw_mgmt_ds_pset ds_pset; - struct iw_mgmt_cf_pset cf_pset; - struct iw_mgmt_ibss_pset ibss_pset; - struct iw_mgmt_data_rset bss_basic_rset; - u8 rssi; -}; - -struct wl3501_start_confirm { - u16 next_blk; - u8 sig_id; - u8 reserved; - u16 status; -}; - -struct wl3501_md_req { - u16 next_blk; - u8 sig_id; - u8 routing; - u16 data; - u16 size; - u8 pri; - u8 service_class; - u8 daddr[ETH_ALEN]; - u8 saddr[ETH_ALEN]; -}; - -struct wl3501_md_ind { - u16 next_blk; - u8 sig_id; - u8 routing; - u16 data; - u16 size; - u8 reception; - u8 pri; - u8 service_class; - u8 daddr[ETH_ALEN]; - u8 saddr[ETH_ALEN]; -}; - -struct wl3501_md_confirm { - u16 next_blk; - u8 sig_id; - u8 reserved; - u16 data; - u8 status; - u8 pri; - u8 service_class; -}; - -struct wl3501_resync_req { - u16 next_blk; - u8 sig_id; -}; - -/* Definitions for supporting clone adapters. */ -/* System Interface Registers (SIR space) */ -#define WL3501_NIC_GCR ((u8)0x00) /* SIR0 - General Conf Register */ -#define WL3501_NIC_BSS ((u8)0x01) /* SIR1 - Bank Switching Select Reg */ -#define WL3501_NIC_LMAL ((u8)0x02) /* SIR2 - Local Mem addr Reg [7:0] */ -#define WL3501_NIC_LMAH ((u8)0x03) /* SIR3 - Local Mem addr Reg [14:8] */ -#define WL3501_NIC_IODPA ((u8)0x04) /* SIR4 - I/O Data Port A */ -#define WL3501_NIC_IODPB ((u8)0x05) /* SIR5 - I/O Data Port B */ -#define WL3501_NIC_IODPC ((u8)0x06) /* SIR6 - I/O Data Port C */ -#define WL3501_NIC_IODPD ((u8)0x07) /* SIR7 - I/O Data Port D */ - -/* Bits in GCR */ -#define WL3501_GCR_SWRESET ((u8)0x80) -#define WL3501_GCR_CORESET ((u8)0x40) -#define WL3501_GCR_DISPWDN ((u8)0x20) -#define WL3501_GCR_ECWAIT ((u8)0x10) -#define WL3501_GCR_ECINT ((u8)0x08) -#define WL3501_GCR_INT2EC ((u8)0x04) -#define WL3501_GCR_ENECINT ((u8)0x02) -#define WL3501_GCR_DAM ((u8)0x01) - -/* Bits in BSS (Bank Switching Select Register) */ -#define WL3501_BSS_FPAGE0 ((u8)0x20) /* Flash memory page0 */ -#define WL3501_BSS_FPAGE1 ((u8)0x28) -#define WL3501_BSS_FPAGE2 ((u8)0x30) -#define WL3501_BSS_FPAGE3 ((u8)0x38) -#define WL3501_BSS_SPAGE0 ((u8)0x00) /* SRAM page0 */ -#define WL3501_BSS_SPAGE1 ((u8)0x08) -#define WL3501_BSS_SPAGE2 ((u8)0x10) -#define WL3501_BSS_SPAGE3 ((u8)0x18) - -/* Define Driver Interface */ -/* Refer IEEE 802.11 */ -/* Tx packet header, include PLCP and MPDU */ -/* Tx PLCP Header */ -struct wl3501_80211_tx_plcp_hdr { - u8 sync[16]; - u16 sfd; - u8 signal; - u8 service; - u16 len; - u16 crc16; -} __packed; - -struct wl3501_80211_tx_hdr { - struct wl3501_80211_tx_plcp_hdr pclp_hdr; - struct ieee80211_hdr mac_hdr; -} __packed; - -/* - Reserve the beginning Tx space for descriptor use. - - TxBlockOffset --> *----*----*----*----* \ - (TxFreeDesc) | 0 | 1 | 2 | 3 | \ - | 4 | 5 | 6 | 7 | | - | 8 | 9 | 10 | 11 | TX_DESC * 20 - | 12 | 13 | 14 | 15 | | - | 16 | 17 | 18 | 19 | / - TxBufferBegin --> *----*----*----*----* / - (TxBufferHead) | | - (TxBufferTail) | | - | Send Buffer | - | | - | | - *-------------------* - TxBufferEnd -------------------------/ - -*/ - -struct wl3501_card { - int base_addr; - u8 mac_addr[ETH_ALEN]; - spinlock_t lock; - wait_queue_head_t wait; - struct wl3501_get_confirm sig_get_confirm; - struct wl3501_pwr_mgmt_confirm sig_pwr_mgmt_confirm; - u16 tx_buffer_size; - u16 tx_buffer_head; - u16 tx_buffer_tail; - u16 tx_buffer_cnt; - u16 esbq_req_start; - u16 esbq_req_end; - u16 esbq_req_head; - u16 esbq_req_tail; - u16 esbq_confirm_start; - u16 esbq_confirm_end; - u16 esbq_confirm; - struct iw_mgmt_essid_pset essid; - struct iw_mgmt_essid_pset keep_essid; - u8 bssid[ETH_ALEN]; - int net_type; - char nick[32]; - char card_name[32]; - char firmware_date[32]; - u8 chan; - u8 cap_info; - u16 start_seg; - u16 bss_cnt; - u16 join_sta_bss; - u8 rssi; - u8 adhoc_times; - u8 reg_domain; - u8 version[2]; - struct wl3501_scan_confirm bss_set[20]; - - struct iw_statistics wstats; - struct iw_spy_data spy_data; - struct iw_public_data wireless_data; - struct pcmcia_device *p_dev; -}; -#endif diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c deleted file mode 100644 index 38d2089f338a..000000000000 --- a/drivers/net/wireless/wl3501_cs.c +++ /dev/null @@ -1,2022 +0,0 @@ -/* - * WL3501 Wireless LAN PCMCIA Card Driver for Linux - * Written originally for Linux 2.0.30 by Fox Chen, mhchen@golf.ccl.itri.org.tw - * Ported to 2.2, 2.4 & 2.5 by Arnaldo Carvalho de Melo - * Wireless extensions in 2.4 by Gustavo Niemeyer - * - * References used by Fox Chen while writing the original driver for 2.0.30: - * - * 1. WL24xx packet drivers (tooasm.asm) - * 2. Access Point Firmware Interface Specification for IEEE 802.11 SUTRO - * 3. IEEE 802.11 - * 4. Linux network driver (/usr/src/linux/drivers/net) - * 5. ISA card driver - wl24.c - * 6. Linux PCMCIA skeleton driver - skeleton.c - * 7. Linux PCMCIA 3c589 network driver - 3c589_cs.c - * - * Tested with WL2400 firmware 1.2, Linux 2.0.30, and pcmcia-cs-2.9.12 - * 1. Performance: about 165 Kbytes/sec in TCP/IP with Ad-Hoc mode. - * rsh 192.168.1.3 "dd if=/dev/zero bs=1k count=1000" > /dev/null - * (Specification 2M bits/sec. is about 250 Kbytes/sec., but we must deduct - * ETHER/IP/UDP/TCP header, and acknowledgement overhead) - * - * Tested with Planet AP in 2.4.17, 184 Kbytes/s in UDP in Infrastructure mode, - * 173 Kbytes/s in TCP. - * - * Tested with Planet AP in 2.5.73-bk, 216 Kbytes/s in Infrastructure mode - * with a SMP machine (dual pentium 100), using pktgen, 432 pps (pkt_size = 60) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#include "wl3501.h" - -#ifndef __i386__ -#define slow_down_io() -#endif - -/* For rough constant delay */ -#define WL3501_NOPLOOP(n) { int x = 0; while (x++ < n) slow_down_io(); } - - - -#define wl3501_outb(a, b) { outb(a, b); slow_down_io(); } -#define wl3501_outb_p(a, b) { outb_p(a, b); slow_down_io(); } -#define wl3501_outsb(a, b, c) { outsb(a, b, c); slow_down_io(); } - -#define WL3501_RELEASE_TIMEOUT (25 * HZ) -#define WL3501_MAX_ADHOC_TRIES 16 - -#define WL3501_RESUME 0 -#define WL3501_SUSPEND 1 - -static int wl3501_config(struct pcmcia_device *link); -static void wl3501_release(struct pcmcia_device *link); - -static const struct { - int reg_domain; - int min, max, deflt; -} iw_channel_table[] = { - { - .reg_domain = IW_REG_DOMAIN_FCC, - .min = 1, - .max = 11, - .deflt = 1, - }, - { - .reg_domain = IW_REG_DOMAIN_DOC, - .min = 1, - .max = 11, - .deflt = 1, - }, - { - .reg_domain = IW_REG_DOMAIN_ETSI, - .min = 1, - .max = 13, - .deflt = 1, - }, - { - .reg_domain = IW_REG_DOMAIN_SPAIN, - .min = 10, - .max = 11, - .deflt = 10, - }, - { - .reg_domain = IW_REG_DOMAIN_FRANCE, - .min = 10, - .max = 13, - .deflt = 10, - }, - { - .reg_domain = IW_REG_DOMAIN_MKK, - .min = 14, - .max = 14, - .deflt = 14, - }, - { - .reg_domain = IW_REG_DOMAIN_MKK1, - .min = 1, - .max = 14, - .deflt = 1, - }, - { - .reg_domain = IW_REG_DOMAIN_ISRAEL, - .min = 3, - .max = 9, - .deflt = 9, - }, -}; - -/** - * iw_valid_channel - validate channel in regulatory domain - * @reg_comain - regulatory domain - * @channel - channel to validate - * - * Returns 0 if invalid in the specified regulatory domain, non-zero if valid. - */ -static int iw_valid_channel(int reg_domain, int channel) -{ - int i, rc = 0; - - for (i = 0; i < ARRAY_SIZE(iw_channel_table); i++) - if (reg_domain == iw_channel_table[i].reg_domain) { - rc = channel >= iw_channel_table[i].min && - channel <= iw_channel_table[i].max; - break; - } - return rc; -} - -/** - * iw_default_channel - get default channel for a regulatory domain - * @reg_comain - regulatory domain - * - * Returns the default channel for a regulatory domain - */ -static int iw_default_channel(int reg_domain) -{ - int i, rc = 1; - - for (i = 0; i < ARRAY_SIZE(iw_channel_table); i++) - if (reg_domain == iw_channel_table[i].reg_domain) { - rc = iw_channel_table[i].deflt; - break; - } - return rc; -} - -static void iw_set_mgmt_info_element(enum iw_mgmt_info_element_ids id, - struct iw_mgmt_info_element *el, - void *value, int len) -{ - el->id = id; - el->len = len; - memcpy(el->data, value, len); -} - -static void iw_copy_mgmt_info_element(struct iw_mgmt_info_element *to, - struct iw_mgmt_info_element *from) -{ - iw_set_mgmt_info_element(from->id, to, from->data, from->len); -} - -static inline void wl3501_switch_page(struct wl3501_card *this, u8 page) -{ - wl3501_outb(page, this->base_addr + WL3501_NIC_BSS); -} - -/* - * Get Ethernet MAC address. - * - * WARNING: We switch to FPAGE0 and switc back again. - * Making sure there is no other WL function beening called by ISR. - */ -static int wl3501_get_flash_mac_addr(struct wl3501_card *this) -{ - int base_addr = this->base_addr; - - /* get MAC addr */ - wl3501_outb(WL3501_BSS_FPAGE3, base_addr + WL3501_NIC_BSS); /* BSS */ - wl3501_outb(0x00, base_addr + WL3501_NIC_LMAL); /* LMAL */ - wl3501_outb(0x40, base_addr + WL3501_NIC_LMAH); /* LMAH */ - - /* wait for reading EEPROM */ - WL3501_NOPLOOP(100); - this->mac_addr[0] = inb(base_addr + WL3501_NIC_IODPA); - WL3501_NOPLOOP(100); - this->mac_addr[1] = inb(base_addr + WL3501_NIC_IODPA); - WL3501_NOPLOOP(100); - this->mac_addr[2] = inb(base_addr + WL3501_NIC_IODPA); - WL3501_NOPLOOP(100); - this->mac_addr[3] = inb(base_addr + WL3501_NIC_IODPA); - WL3501_NOPLOOP(100); - this->mac_addr[4] = inb(base_addr + WL3501_NIC_IODPA); - WL3501_NOPLOOP(100); - this->mac_addr[5] = inb(base_addr + WL3501_NIC_IODPA); - WL3501_NOPLOOP(100); - this->reg_domain = inb(base_addr + WL3501_NIC_IODPA); - WL3501_NOPLOOP(100); - wl3501_outb(WL3501_BSS_FPAGE0, base_addr + WL3501_NIC_BSS); - wl3501_outb(0x04, base_addr + WL3501_NIC_LMAL); - wl3501_outb(0x40, base_addr + WL3501_NIC_LMAH); - WL3501_NOPLOOP(100); - this->version[0] = inb(base_addr + WL3501_NIC_IODPA); - WL3501_NOPLOOP(100); - this->version[1] = inb(base_addr + WL3501_NIC_IODPA); - /* switch to SRAM Page 0 (for safety) */ - wl3501_switch_page(this, WL3501_BSS_SPAGE0); - - /* The MAC addr should be 00:60:... */ - return this->mac_addr[0] == 0x00 && this->mac_addr[1] == 0x60; -} - -/** - * wl3501_set_to_wla - Move 'size' bytes from PC to card - * @dest: Card addressing space - * @src: PC addressing space - * @size: Bytes to move - * - * Move 'size' bytes from PC to card. (Shouldn't be interrupted) - */ -static void wl3501_set_to_wla(struct wl3501_card *this, u16 dest, void *src, - int size) -{ - /* switch to SRAM Page 0 */ - wl3501_switch_page(this, (dest & 0x8000) ? WL3501_BSS_SPAGE1 : - WL3501_BSS_SPAGE0); - /* set LMAL and LMAH */ - wl3501_outb(dest & 0xff, this->base_addr + WL3501_NIC_LMAL); - wl3501_outb(((dest >> 8) & 0x7f), this->base_addr + WL3501_NIC_LMAH); - - /* rep out to Port A */ - wl3501_outsb(this->base_addr + WL3501_NIC_IODPA, src, size); -} - -/** - * wl3501_get_from_wla - Move 'size' bytes from card to PC - * @src: Card addressing space - * @dest: PC addressing space - * @size: Bytes to move - * - * Move 'size' bytes from card to PC. (Shouldn't be interrupted) - */ -static void wl3501_get_from_wla(struct wl3501_card *this, u16 src, void *dest, - int size) -{ - /* switch to SRAM Page 0 */ - wl3501_switch_page(this, (src & 0x8000) ? WL3501_BSS_SPAGE1 : - WL3501_BSS_SPAGE0); - /* set LMAL and LMAH */ - wl3501_outb(src & 0xff, this->base_addr + WL3501_NIC_LMAL); - wl3501_outb((src >> 8) & 0x7f, this->base_addr + WL3501_NIC_LMAH); - - /* rep get from Port A */ - insb(this->base_addr + WL3501_NIC_IODPA, dest, size); -} - -/* - * Get/Allocate a free Tx Data Buffer - * - * *--------------*-----------------*----------------------------------* - * | PLCP | MAC Header | DST SRC Data ... | - * | (24 bytes) | (30 bytes) | (6) (6) (Ethernet Row Data) | - * *--------------*-----------------*----------------------------------* - * \ \- IEEE 802.11 -/ \-------------- len --------------/ - * \-struct wl3501_80211_tx_hdr--/ \-------- Ethernet Frame -------/ - * - * Return = Position in Card - */ -static u16 wl3501_get_tx_buffer(struct wl3501_card *this, u16 len) -{ - u16 next, blk_cnt = 0, zero = 0; - u16 full_len = sizeof(struct wl3501_80211_tx_hdr) + len; - u16 ret = 0; - - if (full_len > this->tx_buffer_cnt * 254) - goto out; - ret = this->tx_buffer_head; - while (full_len) { - if (full_len < 254) - full_len = 0; - else - full_len -= 254; - wl3501_get_from_wla(this, this->tx_buffer_head, &next, - sizeof(next)); - if (!full_len) - wl3501_set_to_wla(this, this->tx_buffer_head, &zero, - sizeof(zero)); - this->tx_buffer_head = next; - blk_cnt++; - /* if buffer is not enough */ - if (!next && full_len) { - this->tx_buffer_head = ret; - ret = 0; - goto out; - } - } - this->tx_buffer_cnt -= blk_cnt; -out: - return ret; -} - -/* - * Free an allocated Tx Buffer. ptr must be correct position. - */ -static void wl3501_free_tx_buffer(struct wl3501_card *this, u16 ptr) -{ - /* check if all space is not free */ - if (!this->tx_buffer_head) - this->tx_buffer_head = ptr; - else - wl3501_set_to_wla(this, this->tx_buffer_tail, - &ptr, sizeof(ptr)); - while (ptr) { - u16 next; - - this->tx_buffer_cnt++; - wl3501_get_from_wla(this, ptr, &next, sizeof(next)); - this->tx_buffer_tail = ptr; - ptr = next; - } -} - -static int wl3501_esbq_req_test(struct wl3501_card *this) -{ - u8 tmp = 0; - - wl3501_get_from_wla(this, this->esbq_req_head + 3, &tmp, sizeof(tmp)); - return tmp & 0x80; -} - -static void wl3501_esbq_req(struct wl3501_card *this, u16 *ptr) -{ - u16 tmp = 0; - - wl3501_set_to_wla(this, this->esbq_req_head, ptr, 2); - wl3501_set_to_wla(this, this->esbq_req_head + 2, &tmp, sizeof(tmp)); - this->esbq_req_head += 4; - if (this->esbq_req_head >= this->esbq_req_end) - this->esbq_req_head = this->esbq_req_start; -} - -static int wl3501_esbq_exec(struct wl3501_card *this, void *sig, int sig_size) -{ - int rc = -EIO; - - if (wl3501_esbq_req_test(this)) { - u16 ptr = wl3501_get_tx_buffer(this, sig_size); - if (ptr) { - wl3501_set_to_wla(this, ptr, sig, sig_size); - wl3501_esbq_req(this, &ptr); - rc = 0; - } - } - return rc; -} - -static int wl3501_get_mib_value(struct wl3501_card *this, u8 index, - void *bf, int size) -{ - struct wl3501_get_req sig = { - .sig_id = WL3501_SIG_GET_REQ, - .mib_attrib = index, - }; - unsigned long flags; - int rc = -EIO; - - spin_lock_irqsave(&this->lock, flags); - if (wl3501_esbq_req_test(this)) { - u16 ptr = wl3501_get_tx_buffer(this, sizeof(sig)); - if (ptr) { - wl3501_set_to_wla(this, ptr, &sig, sizeof(sig)); - wl3501_esbq_req(this, &ptr); - this->sig_get_confirm.mib_status = 255; - spin_unlock_irqrestore(&this->lock, flags); - rc = wait_event_interruptible(this->wait, - this->sig_get_confirm.mib_status != 255); - if (!rc) - memcpy(bf, this->sig_get_confirm.mib_value, - size); - goto out; - } - } - spin_unlock_irqrestore(&this->lock, flags); -out: - return rc; -} - -static int wl3501_pwr_mgmt(struct wl3501_card *this, int suspend) -{ - struct wl3501_pwr_mgmt_req sig = { - .sig_id = WL3501_SIG_PWR_MGMT_REQ, - .pwr_save = suspend, - .wake_up = !suspend, - .receive_dtims = 10, - }; - unsigned long flags; - int rc = -EIO; - - spin_lock_irqsave(&this->lock, flags); - if (wl3501_esbq_req_test(this)) { - u16 ptr = wl3501_get_tx_buffer(this, sizeof(sig)); - if (ptr) { - wl3501_set_to_wla(this, ptr, &sig, sizeof(sig)); - wl3501_esbq_req(this, &ptr); - this->sig_pwr_mgmt_confirm.status = 255; - spin_unlock_irqrestore(&this->lock, flags); - rc = wait_event_interruptible(this->wait, - this->sig_pwr_mgmt_confirm.status != 255); - printk(KERN_INFO "%s: %s status=%d\n", __func__, - suspend ? "suspend" : "resume", - this->sig_pwr_mgmt_confirm.status); - goto out; - } - } - spin_unlock_irqrestore(&this->lock, flags); -out: - return rc; -} - -/** - * wl3501_send_pkt - Send a packet. - * @this - card - * - * Send a packet. - * - * data = Ethernet raw frame. (e.g. data[0] - data[5] is Dest MAC Addr, - * data[6] - data[11] is Src MAC Addr) - * Ref: IEEE 802.11 - */ -static int wl3501_send_pkt(struct wl3501_card *this, u8 *data, u16 len) -{ - u16 bf, sig_bf, next, tmplen, pktlen; - struct wl3501_md_req sig = { - .sig_id = WL3501_SIG_MD_REQ, - }; - u8 *pdata = (char *)data; - int rc = -EIO; - - if (wl3501_esbq_req_test(this)) { - sig_bf = wl3501_get_tx_buffer(this, sizeof(sig)); - rc = -ENOMEM; - if (!sig_bf) /* No free buffer available */ - goto out; - bf = wl3501_get_tx_buffer(this, len + 26 + 24); - if (!bf) { - /* No free buffer available */ - wl3501_free_tx_buffer(this, sig_bf); - goto out; - } - rc = 0; - memcpy(&sig.daddr[0], pdata, 12); - pktlen = len - 12; - pdata += 12; - sig.data = bf; - if (((*pdata) * 256 + (*(pdata + 1))) > 1500) { - u8 addr4[ETH_ALEN] = { - [0] = 0xAA, [1] = 0xAA, [2] = 0x03, [4] = 0x00, - }; - - wl3501_set_to_wla(this, bf + 2 + - offsetof(struct wl3501_tx_hdr, addr4), - addr4, sizeof(addr4)); - sig.size = pktlen + 24 + 4 + 6; - if (pktlen > (254 - sizeof(struct wl3501_tx_hdr))) { - tmplen = 254 - sizeof(struct wl3501_tx_hdr); - pktlen -= tmplen; - } else { - tmplen = pktlen; - pktlen = 0; - } - wl3501_set_to_wla(this, - bf + 2 + sizeof(struct wl3501_tx_hdr), - pdata, tmplen); - pdata += tmplen; - wl3501_get_from_wla(this, bf, &next, sizeof(next)); - bf = next; - } else { - sig.size = pktlen + 24 + 4 - 2; - pdata += 2; - pktlen -= 2; - if (pktlen > (254 - sizeof(struct wl3501_tx_hdr) + 6)) { - tmplen = 254 - sizeof(struct wl3501_tx_hdr) + 6; - pktlen -= tmplen; - } else { - tmplen = pktlen; - pktlen = 0; - } - wl3501_set_to_wla(this, bf + 2 + - offsetof(struct wl3501_tx_hdr, addr4), - pdata, tmplen); - pdata += tmplen; - wl3501_get_from_wla(this, bf, &next, sizeof(next)); - bf = next; - } - while (pktlen > 0) { - if (pktlen > 254) { - tmplen = 254; - pktlen -= 254; - } else { - tmplen = pktlen; - pktlen = 0; - } - wl3501_set_to_wla(this, bf + 2, pdata, tmplen); - pdata += tmplen; - wl3501_get_from_wla(this, bf, &next, sizeof(next)); - bf = next; - } - wl3501_set_to_wla(this, sig_bf, &sig, sizeof(sig)); - wl3501_esbq_req(this, &sig_bf); - } -out: - return rc; -} - -static int wl3501_mgmt_resync(struct wl3501_card *this) -{ - struct wl3501_resync_req sig = { - .sig_id = WL3501_SIG_RESYNC_REQ, - }; - - return wl3501_esbq_exec(this, &sig, sizeof(sig)); -} - -static inline int wl3501_fw_bss_type(struct wl3501_card *this) -{ - return this->net_type == IW_MODE_INFRA ? WL3501_NET_TYPE_INFRA : - WL3501_NET_TYPE_ADHOC; -} - -static inline int wl3501_fw_cap_info(struct wl3501_card *this) -{ - return this->net_type == IW_MODE_INFRA ? WL3501_MGMT_CAPABILITY_ESS : - WL3501_MGMT_CAPABILITY_IBSS; -} - -static int wl3501_mgmt_scan(struct wl3501_card *this, u16 chan_time) -{ - struct wl3501_scan_req sig = { - .sig_id = WL3501_SIG_SCAN_REQ, - .scan_type = WL3501_SCAN_TYPE_ACTIVE, - .probe_delay = 0x10, - .min_chan_time = chan_time, - .max_chan_time = chan_time, - .bss_type = wl3501_fw_bss_type(this), - }; - - this->bss_cnt = this->join_sta_bss = 0; - return wl3501_esbq_exec(this, &sig, sizeof(sig)); -} - -static int wl3501_mgmt_join(struct wl3501_card *this, u16 stas) -{ - struct wl3501_join_req sig = { - .sig_id = WL3501_SIG_JOIN_REQ, - .timeout = 10, - .ds_pset = { - .el = { - .id = IW_MGMT_INFO_ELEMENT_DS_PARAMETER_SET, - .len = 1, - }, - .chan = this->chan, - }, - }; - - memcpy(&sig.beacon_period, &this->bss_set[stas].beacon_period, 72); - return wl3501_esbq_exec(this, &sig, sizeof(sig)); -} - -static int wl3501_mgmt_start(struct wl3501_card *this) -{ - struct wl3501_start_req sig = { - .sig_id = WL3501_SIG_START_REQ, - .beacon_period = 400, - .dtim_period = 1, - .ds_pset = { - .el = { - .id = IW_MGMT_INFO_ELEMENT_DS_PARAMETER_SET, - .len = 1, - }, - .chan = this->chan, - }, - .bss_basic_rset = { - .el = { - .id = IW_MGMT_INFO_ELEMENT_SUPPORTED_RATES, - .len = 2, - }, - .data_rate_labels = { - [0] = IW_MGMT_RATE_LABEL_MANDATORY | - IW_MGMT_RATE_LABEL_1MBIT, - [1] = IW_MGMT_RATE_LABEL_MANDATORY | - IW_MGMT_RATE_LABEL_2MBIT, - }, - }, - .operational_rset = { - .el = { - .id = IW_MGMT_INFO_ELEMENT_SUPPORTED_RATES, - .len = 2, - }, - .data_rate_labels = { - [0] = IW_MGMT_RATE_LABEL_MANDATORY | - IW_MGMT_RATE_LABEL_1MBIT, - [1] = IW_MGMT_RATE_LABEL_MANDATORY | - IW_MGMT_RATE_LABEL_2MBIT, - }, - }, - .ibss_pset = { - .el = { - .id = IW_MGMT_INFO_ELEMENT_IBSS_PARAMETER_SET, - .len = 2, - }, - .atim_window = 10, - }, - .bss_type = wl3501_fw_bss_type(this), - .cap_info = wl3501_fw_cap_info(this), - }; - - iw_copy_mgmt_info_element(&sig.ssid.el, &this->essid.el); - iw_copy_mgmt_info_element(&this->keep_essid.el, &this->essid.el); - return wl3501_esbq_exec(this, &sig, sizeof(sig)); -} - -static void wl3501_mgmt_scan_confirm(struct wl3501_card *this, u16 addr) -{ - u16 i = 0; - int matchflag = 0; - struct wl3501_scan_confirm sig; - - pr_debug("entry"); - wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); - if (sig.status == WL3501_STATUS_SUCCESS) { - pr_debug("success"); - if ((this->net_type == IW_MODE_INFRA && - (sig.cap_info & WL3501_MGMT_CAPABILITY_ESS)) || - (this->net_type == IW_MODE_ADHOC && - (sig.cap_info & WL3501_MGMT_CAPABILITY_IBSS)) || - this->net_type == IW_MODE_AUTO) { - if (!this->essid.el.len) - matchflag = 1; - else if (this->essid.el.len == 3 && - !memcmp(this->essid.essid, "ANY", 3)) - matchflag = 1; - else if (this->essid.el.len != sig.ssid.el.len) - matchflag = 0; - else if (memcmp(this->essid.essid, sig.ssid.essid, - this->essid.el.len)) - matchflag = 0; - else - matchflag = 1; - if (matchflag) { - for (i = 0; i < this->bss_cnt; i++) { - if (!memcmp(this->bss_set[i].bssid, - sig.bssid, ETH_ALEN)) { - matchflag = 0; - break; - } - } - } - if (matchflag && (i < 20)) { - memcpy(&this->bss_set[i].beacon_period, - &sig.beacon_period, 73); - this->bss_cnt++; - this->rssi = sig.rssi; - } - } - } else if (sig.status == WL3501_STATUS_TIMEOUT) { - pr_debug("timeout"); - this->join_sta_bss = 0; - for (i = this->join_sta_bss; i < this->bss_cnt; i++) - if (!wl3501_mgmt_join(this, i)) - break; - this->join_sta_bss = i; - if (this->join_sta_bss == this->bss_cnt) { - if (this->net_type == IW_MODE_INFRA) - wl3501_mgmt_scan(this, 100); - else { - this->adhoc_times++; - if (this->adhoc_times > WL3501_MAX_ADHOC_TRIES) - wl3501_mgmt_start(this); - else - wl3501_mgmt_scan(this, 100); - } - } - } -} - -/** - * wl3501_block_interrupt - Mask interrupt from SUTRO - * @this - card - * - * Mask interrupt from SUTRO. (i.e. SUTRO cannot interrupt the HOST) - * Return: 1 if interrupt is originally enabled - */ -static int wl3501_block_interrupt(struct wl3501_card *this) -{ - u8 old = inb(this->base_addr + WL3501_NIC_GCR); - u8 new = old & (~(WL3501_GCR_ECINT | WL3501_GCR_INT2EC | - WL3501_GCR_ENECINT)); - - wl3501_outb(new, this->base_addr + WL3501_NIC_GCR); - return old & WL3501_GCR_ENECINT; -} - -/** - * wl3501_unblock_interrupt - Enable interrupt from SUTRO - * @this - card - * - * Enable interrupt from SUTRO. (i.e. SUTRO can interrupt the HOST) - * Return: 1 if interrupt is originally enabled - */ -static int wl3501_unblock_interrupt(struct wl3501_card *this) -{ - u8 old = inb(this->base_addr + WL3501_NIC_GCR); - u8 new = (old & ~(WL3501_GCR_ECINT | WL3501_GCR_INT2EC)) | - WL3501_GCR_ENECINT; - - wl3501_outb(new, this->base_addr + WL3501_NIC_GCR); - return old & WL3501_GCR_ENECINT; -} - -/** - * wl3501_receive - Receive data from Receive Queue. - * - * Receive data from Receive Queue. - * - * @this: card - * @bf: address of host - * @size: size of buffer. - */ -static u16 wl3501_receive(struct wl3501_card *this, u8 *bf, u16 size) -{ - u16 next_addr, next_addr1; - u8 *data = bf + 12; - - size -= 12; - wl3501_get_from_wla(this, this->start_seg + 2, - &next_addr, sizeof(next_addr)); - if (size > WL3501_BLKSZ - sizeof(struct wl3501_rx_hdr)) { - wl3501_get_from_wla(this, - this->start_seg + - sizeof(struct wl3501_rx_hdr), data, - WL3501_BLKSZ - - sizeof(struct wl3501_rx_hdr)); - size -= WL3501_BLKSZ - sizeof(struct wl3501_rx_hdr); - data += WL3501_BLKSZ - sizeof(struct wl3501_rx_hdr); - } else { - wl3501_get_from_wla(this, - this->start_seg + - sizeof(struct wl3501_rx_hdr), - data, size); - size = 0; - } - while (size > 0) { - if (size > WL3501_BLKSZ - 5) { - wl3501_get_from_wla(this, next_addr + 5, data, - WL3501_BLKSZ - 5); - size -= WL3501_BLKSZ - 5; - data += WL3501_BLKSZ - 5; - wl3501_get_from_wla(this, next_addr + 2, &next_addr1, - sizeof(next_addr1)); - next_addr = next_addr1; - } else { - wl3501_get_from_wla(this, next_addr + 5, data, size); - size = 0; - } - } - return 0; -} - -static void wl3501_esbq_req_free(struct wl3501_card *this) -{ - u8 tmp; - u16 addr; - - if (this->esbq_req_head == this->esbq_req_tail) - goto out; - wl3501_get_from_wla(this, this->esbq_req_tail + 3, &tmp, sizeof(tmp)); - if (!(tmp & 0x80)) - goto out; - wl3501_get_from_wla(this, this->esbq_req_tail, &addr, sizeof(addr)); - wl3501_free_tx_buffer(this, addr); - this->esbq_req_tail += 4; - if (this->esbq_req_tail >= this->esbq_req_end) - this->esbq_req_tail = this->esbq_req_start; -out: - return; -} - -static int wl3501_esbq_confirm(struct wl3501_card *this) -{ - u8 tmp; - - wl3501_get_from_wla(this, this->esbq_confirm + 3, &tmp, sizeof(tmp)); - return tmp & 0x80; -} - -static void wl3501_online(struct net_device *dev) -{ - struct wl3501_card *this = netdev_priv(dev); - - printk(KERN_INFO "%s: Wireless LAN online. BSSID: %pM\n", - dev->name, this->bssid); - netif_wake_queue(dev); -} - -static void wl3501_esbq_confirm_done(struct wl3501_card *this) -{ - u8 tmp = 0; - - wl3501_set_to_wla(this, this->esbq_confirm + 3, &tmp, sizeof(tmp)); - this->esbq_confirm += 4; - if (this->esbq_confirm >= this->esbq_confirm_end) - this->esbq_confirm = this->esbq_confirm_start; -} - -static int wl3501_mgmt_auth(struct wl3501_card *this) -{ - struct wl3501_auth_req sig = { - .sig_id = WL3501_SIG_AUTH_REQ, - .type = WL3501_SYS_TYPE_OPEN, - .timeout = 1000, - }; - - pr_debug("entry"); - memcpy(sig.mac_addr, this->bssid, ETH_ALEN); - return wl3501_esbq_exec(this, &sig, sizeof(sig)); -} - -static int wl3501_mgmt_association(struct wl3501_card *this) -{ - struct wl3501_assoc_req sig = { - .sig_id = WL3501_SIG_ASSOC_REQ, - .timeout = 1000, - .listen_interval = 5, - .cap_info = this->cap_info, - }; - - pr_debug("entry"); - memcpy(sig.mac_addr, this->bssid, ETH_ALEN); - return wl3501_esbq_exec(this, &sig, sizeof(sig)); -} - -static void wl3501_mgmt_join_confirm(struct net_device *dev, u16 addr) -{ - struct wl3501_card *this = netdev_priv(dev); - struct wl3501_join_confirm sig; - - pr_debug("entry"); - wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); - if (sig.status == WL3501_STATUS_SUCCESS) { - if (this->net_type == IW_MODE_INFRA) { - if (this->join_sta_bss < this->bss_cnt) { - const int i = this->join_sta_bss; - memcpy(this->bssid, - this->bss_set[i].bssid, ETH_ALEN); - this->chan = this->bss_set[i].ds_pset.chan; - iw_copy_mgmt_info_element(&this->keep_essid.el, - &this->bss_set[i].ssid.el); - wl3501_mgmt_auth(this); - } - } else { - const int i = this->join_sta_bss; - - memcpy(&this->bssid, &this->bss_set[i].bssid, ETH_ALEN); - this->chan = this->bss_set[i].ds_pset.chan; - iw_copy_mgmt_info_element(&this->keep_essid.el, - &this->bss_set[i].ssid.el); - wl3501_online(dev); - } - } else { - int i; - this->join_sta_bss++; - for (i = this->join_sta_bss; i < this->bss_cnt; i++) - if (!wl3501_mgmt_join(this, i)) - break; - this->join_sta_bss = i; - if (this->join_sta_bss == this->bss_cnt) { - if (this->net_type == IW_MODE_INFRA) - wl3501_mgmt_scan(this, 100); - else { - this->adhoc_times++; - if (this->adhoc_times > WL3501_MAX_ADHOC_TRIES) - wl3501_mgmt_start(this); - else - wl3501_mgmt_scan(this, 100); - } - } - } -} - -static inline void wl3501_alarm_interrupt(struct net_device *dev, - struct wl3501_card *this) -{ - if (this->net_type == IW_MODE_INFRA) { - printk(KERN_INFO "Wireless LAN offline\n"); - netif_stop_queue(dev); - wl3501_mgmt_resync(this); - } -} - -static inline void wl3501_md_confirm_interrupt(struct net_device *dev, - struct wl3501_card *this, - u16 addr) -{ - struct wl3501_md_confirm sig; - - pr_debug("entry"); - wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); - wl3501_free_tx_buffer(this, sig.data); - if (netif_queue_stopped(dev)) - netif_wake_queue(dev); -} - -static inline void wl3501_md_ind_interrupt(struct net_device *dev, - struct wl3501_card *this, u16 addr) -{ - struct wl3501_md_ind sig; - struct sk_buff *skb; - u8 rssi, addr4[ETH_ALEN]; - u16 pkt_len; - - wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); - this->start_seg = sig.data; - wl3501_get_from_wla(this, - sig.data + offsetof(struct wl3501_rx_hdr, rssi), - &rssi, sizeof(rssi)); - this->rssi = rssi <= 63 ? (rssi * 100) / 64 : 255; - - wl3501_get_from_wla(this, - sig.data + - offsetof(struct wl3501_rx_hdr, addr4), - &addr4, sizeof(addr4)); - if (!(addr4[0] == 0xAA && addr4[1] == 0xAA && - addr4[2] == 0x03 && addr4[4] == 0x00)) { - printk(KERN_INFO "Insupported packet type!\n"); - return; - } - pkt_len = sig.size + 12 - 24 - 4 - 6; - - skb = dev_alloc_skb(pkt_len + 5); - - if (!skb) { - printk(KERN_WARNING "%s: Can't alloc a sk_buff of size %d.\n", - dev->name, pkt_len); - dev->stats.rx_dropped++; - } else { - skb->dev = dev; - skb_reserve(skb, 2); /* IP headers on 16 bytes boundaries */ - skb_copy_to_linear_data(skb, (unsigned char *)&sig.daddr, 12); - wl3501_receive(this, skb->data, pkt_len); - skb_put(skb, pkt_len); - skb->protocol = eth_type_trans(skb, dev); - dev->stats.rx_packets++; - dev->stats.rx_bytes += skb->len; - netif_rx(skb); - } -} - -static inline void wl3501_get_confirm_interrupt(struct wl3501_card *this, - u16 addr, void *sig, int size) -{ - pr_debug("entry"); - wl3501_get_from_wla(this, addr, &this->sig_get_confirm, - sizeof(this->sig_get_confirm)); - wake_up(&this->wait); -} - -static inline void wl3501_start_confirm_interrupt(struct net_device *dev, - struct wl3501_card *this, - u16 addr) -{ - struct wl3501_start_confirm sig; - - pr_debug("entry"); - wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); - if (sig.status == WL3501_STATUS_SUCCESS) - netif_wake_queue(dev); -} - -static inline void wl3501_assoc_confirm_interrupt(struct net_device *dev, - u16 addr) -{ - struct wl3501_card *this = netdev_priv(dev); - struct wl3501_assoc_confirm sig; - - pr_debug("entry"); - wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); - - if (sig.status == WL3501_STATUS_SUCCESS) - wl3501_online(dev); -} - -static inline void wl3501_auth_confirm_interrupt(struct wl3501_card *this, - u16 addr) -{ - struct wl3501_auth_confirm sig; - - pr_debug("entry"); - wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); - - if (sig.status == WL3501_STATUS_SUCCESS) - wl3501_mgmt_association(this); - else - wl3501_mgmt_resync(this); -} - -static inline void wl3501_rx_interrupt(struct net_device *dev) -{ - int morepkts; - u16 addr; - u8 sig_id; - struct wl3501_card *this = netdev_priv(dev); - - pr_debug("entry"); -loop: - morepkts = 0; - if (!wl3501_esbq_confirm(this)) - goto free; - wl3501_get_from_wla(this, this->esbq_confirm, &addr, sizeof(addr)); - wl3501_get_from_wla(this, addr + 2, &sig_id, sizeof(sig_id)); - - switch (sig_id) { - case WL3501_SIG_DEAUTH_IND: - case WL3501_SIG_DISASSOC_IND: - case WL3501_SIG_ALARM: - wl3501_alarm_interrupt(dev, this); - break; - case WL3501_SIG_MD_CONFIRM: - wl3501_md_confirm_interrupt(dev, this, addr); - break; - case WL3501_SIG_MD_IND: - wl3501_md_ind_interrupt(dev, this, addr); - break; - case WL3501_SIG_GET_CONFIRM: - wl3501_get_confirm_interrupt(this, addr, - &this->sig_get_confirm, - sizeof(this->sig_get_confirm)); - break; - case WL3501_SIG_PWR_MGMT_CONFIRM: - wl3501_get_confirm_interrupt(this, addr, - &this->sig_pwr_mgmt_confirm, - sizeof(this->sig_pwr_mgmt_confirm)); - break; - case WL3501_SIG_START_CONFIRM: - wl3501_start_confirm_interrupt(dev, this, addr); - break; - case WL3501_SIG_SCAN_CONFIRM: - wl3501_mgmt_scan_confirm(this, addr); - break; - case WL3501_SIG_JOIN_CONFIRM: - wl3501_mgmt_join_confirm(dev, addr); - break; - case WL3501_SIG_ASSOC_CONFIRM: - wl3501_assoc_confirm_interrupt(dev, addr); - break; - case WL3501_SIG_AUTH_CONFIRM: - wl3501_auth_confirm_interrupt(this, addr); - break; - case WL3501_SIG_RESYNC_CONFIRM: - wl3501_mgmt_resync(this); /* FIXME: should be resync_confirm */ - break; - } - wl3501_esbq_confirm_done(this); - morepkts = 1; - /* free request if necessary */ -free: - wl3501_esbq_req_free(this); - if (morepkts) - goto loop; -} - -static inline void wl3501_ack_interrupt(struct wl3501_card *this) -{ - wl3501_outb(WL3501_GCR_ECINT, this->base_addr + WL3501_NIC_GCR); -} - -/** - * wl3501_interrupt - Hardware interrupt from card. - * @irq - Interrupt number - * @dev_id - net_device - * - * We must acknowledge the interrupt as soon as possible, and block the - * interrupt from the same card immediately to prevent re-entry. - * - * Before accessing the Control_Status_Block, we must lock SUTRO first. - * On the other hand, to prevent SUTRO from malfunctioning, we must - * unlock the SUTRO as soon as possible. - */ -static irqreturn_t wl3501_interrupt(int irq, void *dev_id) -{ - struct net_device *dev = dev_id; - struct wl3501_card *this; - - this = netdev_priv(dev); - spin_lock(&this->lock); - wl3501_ack_interrupt(this); - wl3501_block_interrupt(this); - wl3501_rx_interrupt(dev); - wl3501_unblock_interrupt(this); - spin_unlock(&this->lock); - - return IRQ_HANDLED; -} - -static int wl3501_reset_board(struct wl3501_card *this) -{ - u8 tmp = 0; - int i, rc = 0; - - /* Coreset */ - wl3501_outb_p(WL3501_GCR_CORESET, this->base_addr + WL3501_NIC_GCR); - wl3501_outb_p(0, this->base_addr + WL3501_NIC_GCR); - wl3501_outb_p(WL3501_GCR_CORESET, this->base_addr + WL3501_NIC_GCR); - - /* Reset SRAM 0x480 to zero */ - wl3501_set_to_wla(this, 0x480, &tmp, sizeof(tmp)); - - /* Start up */ - wl3501_outb_p(0, this->base_addr + WL3501_NIC_GCR); - - WL3501_NOPLOOP(1024 * 50); - - wl3501_unblock_interrupt(this); /* acme: was commented */ - - /* Polling Self_Test_Status */ - for (i = 0; i < 10000; i++) { - wl3501_get_from_wla(this, 0x480, &tmp, sizeof(tmp)); - - if (tmp == 'W') { - /* firmware complete all test successfully */ - tmp = 'A'; - wl3501_set_to_wla(this, 0x480, &tmp, sizeof(tmp)); - goto out; - } - WL3501_NOPLOOP(10); - } - printk(KERN_WARNING "%s: failed to reset the board!\n", __func__); - rc = -ENODEV; -out: - return rc; -} - -static int wl3501_init_firmware(struct wl3501_card *this) -{ - u16 ptr, next; - int rc = wl3501_reset_board(this); - - if (rc) - goto fail; - this->card_name[0] = '\0'; - wl3501_get_from_wla(this, 0x1a00, - this->card_name, sizeof(this->card_name)); - this->card_name[sizeof(this->card_name) - 1] = '\0'; - this->firmware_date[0] = '\0'; - wl3501_get_from_wla(this, 0x1a40, - this->firmware_date, sizeof(this->firmware_date)); - this->firmware_date[sizeof(this->firmware_date) - 1] = '\0'; - /* Switch to SRAM Page 0 */ - wl3501_switch_page(this, WL3501_BSS_SPAGE0); - /* Read parameter from card */ - wl3501_get_from_wla(this, 0x482, &this->esbq_req_start, 2); - wl3501_get_from_wla(this, 0x486, &this->esbq_req_end, 2); - wl3501_get_from_wla(this, 0x488, &this->esbq_confirm_start, 2); - wl3501_get_from_wla(this, 0x48c, &this->esbq_confirm_end, 2); - wl3501_get_from_wla(this, 0x48e, &this->tx_buffer_head, 2); - wl3501_get_from_wla(this, 0x492, &this->tx_buffer_size, 2); - this->esbq_req_tail = this->esbq_req_head = this->esbq_req_start; - this->esbq_req_end += this->esbq_req_start; - this->esbq_confirm = this->esbq_confirm_start; - this->esbq_confirm_end += this->esbq_confirm_start; - /* Initial Tx Buffer */ - this->tx_buffer_cnt = 1; - ptr = this->tx_buffer_head; - next = ptr + WL3501_BLKSZ; - while ((next - this->tx_buffer_head) < this->tx_buffer_size) { - this->tx_buffer_cnt++; - wl3501_set_to_wla(this, ptr, &next, sizeof(next)); - ptr = next; - next = ptr + WL3501_BLKSZ; - } - rc = 0; - next = 0; - wl3501_set_to_wla(this, ptr, &next, sizeof(next)); - this->tx_buffer_tail = ptr; -out: - return rc; -fail: - printk(KERN_WARNING "%s: failed!\n", __func__); - goto out; -} - -static int wl3501_close(struct net_device *dev) -{ - struct wl3501_card *this = netdev_priv(dev); - int rc = -ENODEV; - unsigned long flags; - struct pcmcia_device *link; - link = this->p_dev; - - spin_lock_irqsave(&this->lock, flags); - link->open--; - - /* Stop wl3501_hard_start_xmit() from now on */ - netif_stop_queue(dev); - wl3501_ack_interrupt(this); - - /* Mask interrupts from the SUTRO */ - wl3501_block_interrupt(this); - - rc = 0; - printk(KERN_INFO "%s: WL3501 closed\n", dev->name); - spin_unlock_irqrestore(&this->lock, flags); - return rc; -} - -/** - * wl3501_reset - Reset the SUTRO. - * @dev - network device - * - * It is almost the same as wl3501_open(). In fact, we may just wl3501_close() - * and wl3501_open() again, but I wouldn't like to free_irq() when the driver - * is running. It seems to be dangerous. - */ -static int wl3501_reset(struct net_device *dev) -{ - struct wl3501_card *this = netdev_priv(dev); - int rc = -ENODEV; - - wl3501_block_interrupt(this); - - if (wl3501_init_firmware(this)) { - printk(KERN_WARNING "%s: Can't initialize Firmware!\n", - dev->name); - /* Free IRQ, and mark IRQ as unused */ - free_irq(dev->irq, dev); - goto out; - } - - /* - * Queue has to be started only when the Card is Started - */ - netif_stop_queue(dev); - this->adhoc_times = 0; - wl3501_ack_interrupt(this); - wl3501_unblock_interrupt(this); - wl3501_mgmt_scan(this, 100); - pr_debug("%s: device reset", dev->name); - rc = 0; -out: - return rc; -} - -static void wl3501_tx_timeout(struct net_device *dev) -{ - struct wl3501_card *this = netdev_priv(dev); - struct net_device_stats *stats = &dev->stats; - unsigned long flags; - int rc; - - stats->tx_errors++; - spin_lock_irqsave(&this->lock, flags); - rc = wl3501_reset(dev); - spin_unlock_irqrestore(&this->lock, flags); - if (rc) - printk(KERN_ERR "%s: Error %d resetting card on Tx timeout!\n", - dev->name, rc); - else { - dev->trans_start = jiffies; /* prevent tx timeout */ - netif_wake_queue(dev); - } -} - -/* - * Return : 0 - OK - * 1 - Could not transmit (dev_queue_xmit will queue it) - * and try to sent it later - */ -static netdev_tx_t wl3501_hard_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - int enabled, rc; - struct wl3501_card *this = netdev_priv(dev); - unsigned long flags; - - spin_lock_irqsave(&this->lock, flags); - enabled = wl3501_block_interrupt(this); - rc = wl3501_send_pkt(this, skb->data, skb->len); - if (enabled) - wl3501_unblock_interrupt(this); - if (rc) { - ++dev->stats.tx_dropped; - netif_stop_queue(dev); - } else { - ++dev->stats.tx_packets; - dev->stats.tx_bytes += skb->len; - kfree_skb(skb); - - if (this->tx_buffer_cnt < 2) - netif_stop_queue(dev); - } - spin_unlock_irqrestore(&this->lock, flags); - return NETDEV_TX_OK; -} - -static int wl3501_open(struct net_device *dev) -{ - int rc = -ENODEV; - struct wl3501_card *this = netdev_priv(dev); - unsigned long flags; - struct pcmcia_device *link; - link = this->p_dev; - - spin_lock_irqsave(&this->lock, flags); - if (!pcmcia_dev_present(link)) - goto out; - netif_device_attach(dev); - link->open++; - - /* Initial WL3501 firmware */ - pr_debug("%s: Initialize WL3501 firmware...", dev->name); - if (wl3501_init_firmware(this)) - goto fail; - /* Initial device variables */ - this->adhoc_times = 0; - /* Acknowledge Interrupt, for cleaning last state */ - wl3501_ack_interrupt(this); - - /* Enable interrupt from card after all */ - wl3501_unblock_interrupt(this); - wl3501_mgmt_scan(this, 100); - rc = 0; - pr_debug("%s: WL3501 opened", dev->name); - printk(KERN_INFO "%s: Card Name: %s\n" - "%s: Firmware Date: %s\n", - dev->name, this->card_name, - dev->name, this->firmware_date); -out: - spin_unlock_irqrestore(&this->lock, flags); - return rc; -fail: - printk(KERN_WARNING "%s: Can't initialize firmware!\n", dev->name); - goto out; -} - -static struct iw_statistics *wl3501_get_wireless_stats(struct net_device *dev) -{ - struct wl3501_card *this = netdev_priv(dev); - struct iw_statistics *wstats = &this->wstats; - u32 value; /* size checked: it is u32 */ - - memset(wstats, 0, sizeof(*wstats)); - wstats->status = netif_running(dev); - if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_WEP_ICV_ERROR_COUNT, - &value, sizeof(value))) - wstats->discard.code += value; - if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_WEP_UNDECRYPTABLE_COUNT, - &value, sizeof(value))) - wstats->discard.code += value; - if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_WEP_EXCLUDED_COUNT, - &value, sizeof(value))) - wstats->discard.code += value; - if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_RETRY_COUNT, - &value, sizeof(value))) - wstats->discard.retries = value; - if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_FAILED_COUNT, - &value, sizeof(value))) - wstats->discard.misc += value; - if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_RTS_FAILURE_COUNT, - &value, sizeof(value))) - wstats->discard.misc += value; - if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_ACK_FAILURE_COUNT, - &value, sizeof(value))) - wstats->discard.misc += value; - if (!wl3501_get_mib_value(this, WL3501_MIB_ATTR_FRAME_DUPLICATE_COUNT, - &value, sizeof(value))) - wstats->discard.misc += value; - return wstats; -} - -/** - * wl3501_detach - deletes a driver "instance" - * @link - FILL_IN - * - * This deletes a driver "instance". The device is de-registered with Card - * Services. If it has been released, all local data structures are freed. - * Otherwise, the structures will be freed when the device is released. - */ -static void wl3501_detach(struct pcmcia_device *link) -{ - struct net_device *dev = link->priv; - - /* If the device is currently configured and active, we won't actually - * delete it yet. Instead, it is marked so that when the release() - * function is called, that will trigger a proper detach(). */ - - while (link->open > 0) - wl3501_close(dev); - - netif_device_detach(dev); - wl3501_release(link); - - unregister_netdev(dev); - - if (link->priv) - free_netdev(link->priv); -} - -static int wl3501_get_name(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - strlcpy(wrqu->name, "IEEE 802.11-DS", sizeof(wrqu->name)); - return 0; -} - -static int wl3501_set_freq(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct wl3501_card *this = netdev_priv(dev); - int channel = wrqu->freq.m; - int rc = -EINVAL; - - if (iw_valid_channel(this->reg_domain, channel)) { - this->chan = channel; - rc = wl3501_reset(dev); - } - return rc; -} - -static int wl3501_get_freq(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct wl3501_card *this = netdev_priv(dev); - - wrqu->freq.m = ieee80211_dsss_chan_to_freq(this->chan) * 100000; - wrqu->freq.e = 1; - return 0; -} - -static int wl3501_set_mode(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - int rc = -EINVAL; - - if (wrqu->mode == IW_MODE_INFRA || - wrqu->mode == IW_MODE_ADHOC || - wrqu->mode == IW_MODE_AUTO) { - struct wl3501_card *this = netdev_priv(dev); - - this->net_type = wrqu->mode; - rc = wl3501_reset(dev); - } - return rc; -} - -static int wl3501_get_mode(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct wl3501_card *this = netdev_priv(dev); - - wrqu->mode = this->net_type; - return 0; -} - -static int wl3501_get_sens(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct wl3501_card *this = netdev_priv(dev); - - wrqu->sens.value = this->rssi; - wrqu->sens.disabled = !wrqu->sens.value; - wrqu->sens.fixed = 1; - return 0; -} - -static int wl3501_get_range(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct iw_range *range = (struct iw_range *)extra; - - /* Set the length (very important for backward compatibility) */ - wrqu->data.length = sizeof(*range); - - /* Set all the info we don't care or don't know about to zero */ - memset(range, 0, sizeof(*range)); - - /* Set the Wireless Extension versions */ - range->we_version_compiled = WIRELESS_EXT; - range->we_version_source = 1; - range->throughput = 2 * 1000 * 1000; /* ~2 Mb/s */ - /* FIXME: study the code to fill in more fields... */ - return 0; -} - -static int wl3501_set_wap(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct wl3501_card *this = netdev_priv(dev); - int rc = -EINVAL; - - /* FIXME: we support other ARPHRDs...*/ - if (wrqu->ap_addr.sa_family != ARPHRD_ETHER) - goto out; - if (is_broadcast_ether_addr(wrqu->ap_addr.sa_data)) { - /* FIXME: rescan? */ - } else - memcpy(this->bssid, wrqu->ap_addr.sa_data, ETH_ALEN); - /* FIXME: rescan? deassoc & scan? */ - rc = 0; -out: - return rc; -} - -static int wl3501_get_wap(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct wl3501_card *this = netdev_priv(dev); - - wrqu->ap_addr.sa_family = ARPHRD_ETHER; - memcpy(wrqu->ap_addr.sa_data, this->bssid, ETH_ALEN); - return 0; -} - -static int wl3501_set_scan(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * FIXME: trigger scanning with a reset, yes, I'm lazy - */ - return wl3501_reset(dev); -} - -static int wl3501_get_scan(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct wl3501_card *this = netdev_priv(dev); - int i; - char *current_ev = extra; - struct iw_event iwe; - - for (i = 0; i < this->bss_cnt; ++i) { - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, this->bss_set[i].bssid, ETH_ALEN); - current_ev = iwe_stream_add_event(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, IW_EV_ADDR_LEN); - iwe.cmd = SIOCGIWESSID; - iwe.u.data.flags = 1; - iwe.u.data.length = this->bss_set[i].ssid.el.len; - current_ev = iwe_stream_add_point(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, - this->bss_set[i].ssid.essid); - iwe.cmd = SIOCGIWMODE; - iwe.u.mode = this->bss_set[i].bss_type; - current_ev = iwe_stream_add_event(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, IW_EV_UINT_LEN); - iwe.cmd = SIOCGIWFREQ; - iwe.u.freq.m = this->bss_set[i].ds_pset.chan; - iwe.u.freq.e = 0; - current_ev = iwe_stream_add_event(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, IW_EV_FREQ_LEN); - iwe.cmd = SIOCGIWENCODE; - if (this->bss_set[i].cap_info & WL3501_MGMT_CAPABILITY_PRIVACY) - iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - else - iwe.u.data.flags = IW_ENCODE_DISABLED; - iwe.u.data.length = 0; - current_ev = iwe_stream_add_point(info, current_ev, - extra + IW_SCAN_MAX_DATA, - &iwe, NULL); - } - /* Length of data */ - wrqu->data.length = (current_ev - extra); - wrqu->data.flags = 0; /* FIXME: set properly these flags */ - return 0; -} - -static int wl3501_set_essid(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct wl3501_card *this = netdev_priv(dev); - - if (wrqu->data.flags) { - iw_set_mgmt_info_element(IW_MGMT_INFO_ELEMENT_SSID, - &this->essid.el, - extra, wrqu->data.length); - } else { /* We accept any ESSID */ - iw_set_mgmt_info_element(IW_MGMT_INFO_ELEMENT_SSID, - &this->essid.el, "ANY", 3); - } - return wl3501_reset(dev); -} - -static int wl3501_get_essid(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct wl3501_card *this = netdev_priv(dev); - unsigned long flags; - - spin_lock_irqsave(&this->lock, flags); - wrqu->essid.flags = 1; - wrqu->essid.length = this->essid.el.len; - memcpy(extra, this->essid.essid, this->essid.el.len); - spin_unlock_irqrestore(&this->lock, flags); - return 0; -} - -static int wl3501_set_nick(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct wl3501_card *this = netdev_priv(dev); - - if (wrqu->data.length > sizeof(this->nick)) - return -E2BIG; - strlcpy(this->nick, extra, wrqu->data.length); - return 0; -} - -static int wl3501_get_nick(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct wl3501_card *this = netdev_priv(dev); - - strlcpy(extra, this->nick, 32); - wrqu->data.length = strlen(extra); - return 0; -} - -static int wl3501_get_rate(struct net_device *dev, struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - /* - * FIXME: have to see from where to get this info, perhaps this card - * works at 1 Mbit/s too... for now leave at 2 Mbit/s that is the most - * common with the Planet Access Points. -acme - */ - wrqu->bitrate.value = 2000000; - wrqu->bitrate.fixed = 1; - return 0; -} - -static int wl3501_get_rts_threshold(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - u16 threshold; /* size checked: it is u16 */ - struct wl3501_card *this = netdev_priv(dev); - int rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_RTS_THRESHOLD, - &threshold, sizeof(threshold)); - if (!rc) { - wrqu->rts.value = threshold; - wrqu->rts.disabled = threshold >= 2347; - wrqu->rts.fixed = 1; - } - return rc; -} - -static int wl3501_get_frag_threshold(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - u16 threshold; /* size checked: it is u16 */ - struct wl3501_card *this = netdev_priv(dev); - int rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_FRAG_THRESHOLD, - &threshold, sizeof(threshold)); - if (!rc) { - wrqu->frag.value = threshold; - wrqu->frag.disabled = threshold >= 2346; - wrqu->frag.fixed = 1; - } - return rc; -} - -static int wl3501_get_txpow(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - u16 txpow; - struct wl3501_card *this = netdev_priv(dev); - int rc = wl3501_get_mib_value(this, - WL3501_MIB_ATTR_CURRENT_TX_PWR_LEVEL, - &txpow, sizeof(txpow)); - if (!rc) { - wrqu->txpower.value = txpow; - wrqu->txpower.disabled = 0; - /* - * From the MIB values I think this can be configurable, - * as it lists several tx power levels -acme - */ - wrqu->txpower.fixed = 0; - wrqu->txpower.flags = IW_TXPOW_MWATT; - } - return rc; -} - -static int wl3501_get_retry(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - u8 retry; /* size checked: it is u8 */ - struct wl3501_card *this = netdev_priv(dev); - int rc = wl3501_get_mib_value(this, - WL3501_MIB_ATTR_LONG_RETRY_LIMIT, - &retry, sizeof(retry)); - if (rc) - goto out; - if (wrqu->retry.flags & IW_RETRY_LONG) { - wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; - goto set_value; - } - rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_SHORT_RETRY_LIMIT, - &retry, sizeof(retry)); - if (rc) - goto out; - wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; -set_value: - wrqu->retry.value = retry; - wrqu->retry.disabled = 0; -out: - return rc; -} - -static int wl3501_get_encode(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - u8 implemented, restricted, keys[100], len_keys, tocopy; - struct wl3501_card *this = netdev_priv(dev); - int rc = wl3501_get_mib_value(this, - WL3501_MIB_ATTR_PRIV_OPT_IMPLEMENTED, - &implemented, sizeof(implemented)); - if (rc) - goto out; - if (!implemented) { - wrqu->encoding.flags = IW_ENCODE_DISABLED; - goto out; - } - rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_EXCLUDE_UNENCRYPTED, - &restricted, sizeof(restricted)); - if (rc) - goto out; - wrqu->encoding.flags = restricted ? IW_ENCODE_RESTRICTED : - IW_ENCODE_OPEN; - rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_WEP_KEY_MAPPINGS_LEN, - &len_keys, sizeof(len_keys)); - if (rc) - goto out; - rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_WEP_KEY_MAPPINGS, - keys, len_keys); - if (rc) - goto out; - tocopy = min_t(u16, len_keys, wrqu->encoding.length); - tocopy = min_t(u8, tocopy, 100); - wrqu->encoding.length = tocopy; - memcpy(extra, keys, tocopy); -out: - return rc; -} - -static int wl3501_get_power(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - u8 pwr_state; - struct wl3501_card *this = netdev_priv(dev); - int rc = wl3501_get_mib_value(this, - WL3501_MIB_ATTR_CURRENT_PWR_STATE, - &pwr_state, sizeof(pwr_state)); - if (rc) - goto out; - wrqu->power.disabled = !pwr_state; - wrqu->power.flags = IW_POWER_ON; -out: - return rc; -} - -static const iw_handler wl3501_handler[] = { - IW_HANDLER(SIOCGIWNAME, wl3501_get_name), - IW_HANDLER(SIOCSIWFREQ, wl3501_set_freq), - IW_HANDLER(SIOCGIWFREQ, wl3501_get_freq), - IW_HANDLER(SIOCSIWMODE, wl3501_set_mode), - IW_HANDLER(SIOCGIWMODE, wl3501_get_mode), - IW_HANDLER(SIOCGIWSENS, wl3501_get_sens), - IW_HANDLER(SIOCGIWRANGE, wl3501_get_range), - IW_HANDLER(SIOCSIWSPY, iw_handler_set_spy), - IW_HANDLER(SIOCGIWSPY, iw_handler_get_spy), - IW_HANDLER(SIOCSIWTHRSPY, iw_handler_set_thrspy), - IW_HANDLER(SIOCGIWTHRSPY, iw_handler_get_thrspy), - IW_HANDLER(SIOCSIWAP, wl3501_set_wap), - IW_HANDLER(SIOCGIWAP, wl3501_get_wap), - IW_HANDLER(SIOCSIWSCAN, wl3501_set_scan), - IW_HANDLER(SIOCGIWSCAN, wl3501_get_scan), - IW_HANDLER(SIOCSIWESSID, wl3501_set_essid), - IW_HANDLER(SIOCGIWESSID, wl3501_get_essid), - IW_HANDLER(SIOCSIWNICKN, wl3501_set_nick), - IW_HANDLER(SIOCGIWNICKN, wl3501_get_nick), - IW_HANDLER(SIOCGIWRATE, wl3501_get_rate), - IW_HANDLER(SIOCGIWRTS, wl3501_get_rts_threshold), - IW_HANDLER(SIOCGIWFRAG, wl3501_get_frag_threshold), - IW_HANDLER(SIOCGIWTXPOW, wl3501_get_txpow), - IW_HANDLER(SIOCGIWRETRY, wl3501_get_retry), - IW_HANDLER(SIOCGIWENCODE, wl3501_get_encode), - IW_HANDLER(SIOCGIWPOWER, wl3501_get_power), -}; - -static const struct iw_handler_def wl3501_handler_def = { - .num_standard = ARRAY_SIZE(wl3501_handler), - .standard = (iw_handler *)wl3501_handler, - .get_wireless_stats = wl3501_get_wireless_stats, -}; - -static const struct net_device_ops wl3501_netdev_ops = { - .ndo_open = wl3501_open, - .ndo_stop = wl3501_close, - .ndo_start_xmit = wl3501_hard_start_xmit, - .ndo_tx_timeout = wl3501_tx_timeout, - .ndo_change_mtu = eth_change_mtu, - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, -}; - -static int wl3501_probe(struct pcmcia_device *p_dev) -{ - struct net_device *dev; - struct wl3501_card *this; - - /* The io structure describes IO port mapping */ - p_dev->resource[0]->end = 16; - p_dev->resource[0]->flags = IO_DATA_PATH_WIDTH_8; - - /* General socket configuration */ - p_dev->config_flags = CONF_ENABLE_IRQ; - p_dev->config_index = 1; - - dev = alloc_etherdev(sizeof(struct wl3501_card)); - if (!dev) - goto out_link; - - - dev->netdev_ops = &wl3501_netdev_ops; - dev->watchdog_timeo = 5 * HZ; - - this = netdev_priv(dev); - this->wireless_data.spy_data = &this->spy_data; - this->p_dev = p_dev; - dev->wireless_data = &this->wireless_data; - dev->wireless_handlers = &wl3501_handler_def; - netif_stop_queue(dev); - p_dev->priv = dev; - - return wl3501_config(p_dev); -out_link: - return -ENOMEM; -} - -static int wl3501_config(struct pcmcia_device *link) -{ - struct net_device *dev = link->priv; - int i = 0, j, ret; - struct wl3501_card *this; - - /* Try allocating IO ports. This tries a few fixed addresses. If you - * want, you can also read the card's config table to pick addresses -- - * see the serial driver for an example. */ - link->io_lines = 5; - - for (j = 0x280; j < 0x400; j += 0x20) { - /* The '^0x300' is so that we probe 0x300-0x3ff first, then - * 0x200-0x2ff, and so on, because this seems safer */ - link->resource[0]->start = j; - link->resource[1]->start = link->resource[0]->start + 0x10; - i = pcmcia_request_io(link); - if (i == 0) - break; - } - if (i != 0) - goto failed; - - /* Now allocate an interrupt line. Note that this does not actually - * assign a handler to the interrupt. */ - - ret = pcmcia_request_irq(link, wl3501_interrupt); - if (ret) - goto failed; - - ret = pcmcia_enable_device(link); - if (ret) - goto failed; - - dev->irq = link->irq; - dev->base_addr = link->resource[0]->start; - SET_NETDEV_DEV(dev, &link->dev); - if (register_netdev(dev)) { - printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); - goto failed; - } - - this = netdev_priv(dev); - - this->base_addr = dev->base_addr; - - if (!wl3501_get_flash_mac_addr(this)) { - printk(KERN_WARNING "%s: Can't read MAC addr in flash ROM?\n", - dev->name); - unregister_netdev(dev); - goto failed; - } - - for (i = 0; i < 6; i++) - dev->dev_addr[i] = ((char *)&this->mac_addr)[i]; - - /* print probe information */ - printk(KERN_INFO "%s: wl3501 @ 0x%3.3x, IRQ %d, " - "MAC addr in flash ROM:%pM\n", - dev->name, this->base_addr, (int)dev->irq, - dev->dev_addr); - /* - * Initialize card parameters - added by jss - */ - this->net_type = IW_MODE_INFRA; - this->bss_cnt = 0; - this->join_sta_bss = 0; - this->adhoc_times = 0; - iw_set_mgmt_info_element(IW_MGMT_INFO_ELEMENT_SSID, &this->essid.el, - "ANY", 3); - this->card_name[0] = '\0'; - this->firmware_date[0] = '\0'; - this->rssi = 255; - this->chan = iw_default_channel(this->reg_domain); - strlcpy(this->nick, "Planet WL3501", sizeof(this->nick)); - spin_lock_init(&this->lock); - init_waitqueue_head(&this->wait); - netif_start_queue(dev); - return 0; - -failed: - wl3501_release(link); - return -ENODEV; -} - -static void wl3501_release(struct pcmcia_device *link) -{ - pcmcia_disable_device(link); -} - -static int wl3501_suspend(struct pcmcia_device *link) -{ - struct net_device *dev = link->priv; - - wl3501_pwr_mgmt(netdev_priv(dev), WL3501_SUSPEND); - if (link->open) - netif_device_detach(dev); - - return 0; -} - -static int wl3501_resume(struct pcmcia_device *link) -{ - struct net_device *dev = link->priv; - - wl3501_pwr_mgmt(netdev_priv(dev), WL3501_RESUME); - if (link->open) { - wl3501_reset(dev); - netif_device_attach(dev); - } - - return 0; -} - - -static const struct pcmcia_device_id wl3501_ids[] = { - PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0001), - PCMCIA_DEVICE_NULL -}; -MODULE_DEVICE_TABLE(pcmcia, wl3501_ids); - -static struct pcmcia_driver wl3501_driver = { - .owner = THIS_MODULE, - .name = "wl3501_cs", - .probe = wl3501_probe, - .remove = wl3501_detach, - .id_table = wl3501_ids, - .suspend = wl3501_suspend, - .resume = wl3501_resume, -}; -module_pcmcia_driver(wl3501_driver); - -MODULE_AUTHOR("Fox Chen , " - "Arnaldo Carvalho de Melo ," - "Gustavo Niemeyer "); -MODULE_DESCRIPTION("Planet wl3501 wireless driver"); -MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c deleted file mode 100644 index b8ba1f925e75..000000000000 --- a/drivers/net/wireless/zd1201.c +++ /dev/null @@ -1,1912 +0,0 @@ -/* - * Driver for ZyDAS zd1201 based wireless USB devices. - * - * Copyright (c) 2004, 2005 Jeroen Vreeken (pe1rxq@amsat.org) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation. - * - * Parts of this driver have been derived from a wlan-ng version - * modified by ZyDAS. They also made documentation available, thanks! - * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "zd1201.h" - -static struct usb_device_id zd1201_table[] = { - {USB_DEVICE(0x0586, 0x3400)}, /* Peabird Wireless USB Adapter */ - {USB_DEVICE(0x0ace, 0x1201)}, /* ZyDAS ZD1201 Wireless USB Adapter */ - {USB_DEVICE(0x050d, 0x6051)}, /* Belkin F5D6051 usb adapter */ - {USB_DEVICE(0x0db0, 0x6823)}, /* MSI UB11B usb adapter */ - {USB_DEVICE(0x1044, 0x8004)}, /* Gigabyte GN-WLBZ101 */ - {USB_DEVICE(0x1044, 0x8005)}, /* GIGABYTE GN-WLBZ201 usb adapter */ - {} -}; - -static int ap; /* Are we an AP or a normal station? */ - -#define ZD1201_VERSION "0.15" - -MODULE_AUTHOR("Jeroen Vreeken "); -MODULE_DESCRIPTION("Driver for ZyDAS ZD1201 based USB Wireless adapters"); -MODULE_VERSION(ZD1201_VERSION); -MODULE_LICENSE("GPL"); -module_param(ap, int, 0); -MODULE_PARM_DESC(ap, "If non-zero Access Point firmware will be loaded"); -MODULE_DEVICE_TABLE(usb, zd1201_table); - - -static int zd1201_fw_upload(struct usb_device *dev, int apfw) -{ - const struct firmware *fw_entry; - const char *data; - unsigned long len; - int err; - unsigned char ret; - char *buf; - char *fwfile; - - if (apfw) - fwfile = "zd1201-ap.fw"; - else - fwfile = "zd1201.fw"; - - err = request_firmware(&fw_entry, fwfile, &dev->dev); - if (err) { - dev_err(&dev->dev, "Failed to load %s firmware file!\n", fwfile); - dev_err(&dev->dev, "Make sure the hotplug firmware loader is installed.\n"); - dev_err(&dev->dev, "Goto http://linux-lc100020.sourceforge.net for more info.\n"); - return err; - } - - data = fw_entry->data; - len = fw_entry->size; - - buf = kmalloc(1024, GFP_ATOMIC); - if (!buf) - goto exit; - - while (len > 0) { - int translen = (len > 1024) ? 1024 : len; - memcpy(buf, data, translen); - - err = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 0, - USB_DIR_OUT | 0x40, 0, 0, buf, translen, - ZD1201_FW_TIMEOUT); - if (err < 0) - goto exit; - - len -= translen; - data += translen; - } - - err = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 0x2, - USB_DIR_OUT | 0x40, 0, 0, NULL, 0, ZD1201_FW_TIMEOUT); - if (err < 0) - goto exit; - - err = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 0x4, - USB_DIR_IN | 0x40, 0, 0, buf, sizeof(ret), ZD1201_FW_TIMEOUT); - if (err < 0) - goto exit; - - memcpy(&ret, buf, sizeof(ret)); - - if (ret & 0x80) { - err = -EIO; - goto exit; - } - - err = 0; -exit: - kfree(buf); - release_firmware(fw_entry); - return err; -} - -MODULE_FIRMWARE("zd1201-ap.fw"); -MODULE_FIRMWARE("zd1201.fw"); - -static void zd1201_usbfree(struct urb *urb) -{ - struct zd1201 *zd = urb->context; - - switch(urb->status) { - case -EILSEQ: - case -ENODEV: - case -ETIME: - case -ENOENT: - case -EPIPE: - case -EOVERFLOW: - case -ESHUTDOWN: - dev_warn(&zd->usb->dev, "%s: urb failed: %d\n", - zd->dev->name, urb->status); - } - - kfree(urb->transfer_buffer); - usb_free_urb(urb); -} - -/* cmdreq message: - u32 type - u16 cmd - u16 parm0 - u16 parm1 - u16 parm2 - u8 pad[4] - - total: 4 + 2 + 2 + 2 + 2 + 4 = 16 -*/ -static int zd1201_docmd(struct zd1201 *zd, int cmd, int parm0, - int parm1, int parm2) -{ - unsigned char *command; - int ret; - struct urb *urb; - - command = kmalloc(16, GFP_ATOMIC); - if (!command) - return -ENOMEM; - - *((__le32*)command) = cpu_to_le32(ZD1201_USB_CMDREQ); - *((__le16*)&command[4]) = cpu_to_le16(cmd); - *((__le16*)&command[6]) = cpu_to_le16(parm0); - *((__le16*)&command[8]) = cpu_to_le16(parm1); - *((__le16*)&command[10])= cpu_to_le16(parm2); - - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!urb) { - kfree(command); - return -ENOMEM; - } - usb_fill_bulk_urb(urb, zd->usb, usb_sndbulkpipe(zd->usb, zd->endp_out2), - command, 16, zd1201_usbfree, zd); - ret = usb_submit_urb(urb, GFP_ATOMIC); - if (ret) { - kfree(command); - usb_free_urb(urb); - } - - return ret; -} - -/* Callback after sending out a packet */ -static void zd1201_usbtx(struct urb *urb) -{ - struct zd1201 *zd = urb->context; - netif_wake_queue(zd->dev); -} - -/* Incoming data */ -static void zd1201_usbrx(struct urb *urb) -{ - struct zd1201 *zd = urb->context; - int free = 0; - unsigned char *data = urb->transfer_buffer; - struct sk_buff *skb; - unsigned char type; - - if (!zd) - return; - - switch(urb->status) { - case -EILSEQ: - case -ENODEV: - case -ETIME: - case -ENOENT: - case -EPIPE: - case -EOVERFLOW: - case -ESHUTDOWN: - dev_warn(&zd->usb->dev, "%s: rx urb failed: %d\n", - zd->dev->name, urb->status); - free = 1; - goto exit; - } - - if (urb->status != 0 || urb->actual_length == 0) - goto resubmit; - - type = data[0]; - if (type == ZD1201_PACKET_EVENTSTAT || type == ZD1201_PACKET_RESOURCE) { - memcpy(zd->rxdata, data, urb->actual_length); - zd->rxlen = urb->actual_length; - zd->rxdatas = 1; - wake_up(&zd->rxdataq); - } - /* Info frame */ - if (type == ZD1201_PACKET_INQUIRE) { - int i = 0; - unsigned short infotype, framelen, copylen; - framelen = le16_to_cpu(*(__le16*)&data[4]); - infotype = le16_to_cpu(*(__le16*)&data[6]); - - if (infotype == ZD1201_INF_LINKSTATUS) { - short linkstatus; - - linkstatus = le16_to_cpu(*(__le16*)&data[8]); - switch(linkstatus) { - case 1: - netif_carrier_on(zd->dev); - break; - case 2: - netif_carrier_off(zd->dev); - break; - case 3: - netif_carrier_off(zd->dev); - break; - case 4: - netif_carrier_on(zd->dev); - break; - default: - netif_carrier_off(zd->dev); - } - goto resubmit; - } - if (infotype == ZD1201_INF_ASSOCSTATUS) { - short status = le16_to_cpu(*(__le16*)(data+8)); - int event; - union iwreq_data wrqu; - - switch (status) { - case ZD1201_ASSOCSTATUS_STAASSOC: - case ZD1201_ASSOCSTATUS_REASSOC: - event = IWEVREGISTERED; - break; - case ZD1201_ASSOCSTATUS_DISASSOC: - case ZD1201_ASSOCSTATUS_ASSOCFAIL: - case ZD1201_ASSOCSTATUS_AUTHFAIL: - default: - event = IWEVEXPIRED; - } - memcpy(wrqu.addr.sa_data, data+10, ETH_ALEN); - wrqu.addr.sa_family = ARPHRD_ETHER; - - /* Send event to user space */ - wireless_send_event(zd->dev, event, &wrqu, NULL); - - goto resubmit; - } - if (infotype == ZD1201_INF_AUTHREQ) { - union iwreq_data wrqu; - - memcpy(wrqu.addr.sa_data, data+8, ETH_ALEN); - wrqu.addr.sa_family = ARPHRD_ETHER; - /* There isn't a event that trully fits this request. - We assume that userspace will be smart enough to - see a new station being expired and sends back a - authstation ioctl to authorize it. */ - wireless_send_event(zd->dev, IWEVEXPIRED, &wrqu, NULL); - goto resubmit; - } - /* Other infotypes are handled outside this handler */ - zd->rxlen = 0; - while (i < urb->actual_length) { - copylen = le16_to_cpu(*(__le16*)&data[i+2]); - /* Sanity check, sometimes we get junk */ - if (copylen+zd->rxlen > sizeof(zd->rxdata)) - break; - memcpy(zd->rxdata+zd->rxlen, data+i+4, copylen); - zd->rxlen += copylen; - i += 64; - } - if (i >= urb->actual_length) { - zd->rxdatas = 1; - wake_up(&zd->rxdataq); - } - goto resubmit; - } - /* Actual data */ - if (data[urb->actual_length-1] == ZD1201_PACKET_RXDATA) { - int datalen = urb->actual_length-1; - unsigned short len, fc, seq; - - len = ntohs(*(__be16 *)&data[datalen-2]); - if (len>datalen) - len=datalen; - fc = le16_to_cpu(*(__le16 *)&data[datalen-16]); - seq = le16_to_cpu(*(__le16 *)&data[datalen-24]); - - if (zd->monitor) { - if (datalen < 24) - goto resubmit; - if (!(skb = dev_alloc_skb(datalen+24))) - goto resubmit; - - memcpy(skb_put(skb, 2), &data[datalen-16], 2); - memcpy(skb_put(skb, 2), &data[datalen-2], 2); - memcpy(skb_put(skb, 6), &data[datalen-14], 6); - memcpy(skb_put(skb, 6), &data[datalen-22], 6); - memcpy(skb_put(skb, 6), &data[datalen-8], 6); - memcpy(skb_put(skb, 2), &data[datalen-24], 2); - memcpy(skb_put(skb, len), data, len); - skb->protocol = eth_type_trans(skb, zd->dev); - zd->dev->stats.rx_packets++; - zd->dev->stats.rx_bytes += skb->len; - netif_rx(skb); - goto resubmit; - } - - if ((seq & IEEE80211_SCTL_FRAG) || - (fc & IEEE80211_FCTL_MOREFRAGS)) { - struct zd1201_frag *frag = NULL; - char *ptr; - - if (datalen<14) - goto resubmit; - if ((seq & IEEE80211_SCTL_FRAG) == 0) { - frag = kmalloc(sizeof(*frag), GFP_ATOMIC); - if (!frag) - goto resubmit; - skb = dev_alloc_skb(IEEE80211_MAX_DATA_LEN +14+2); - if (!skb) { - kfree(frag); - goto resubmit; - } - frag->skb = skb; - frag->seq = seq & IEEE80211_SCTL_SEQ; - skb_reserve(skb, 2); - memcpy(skb_put(skb, 12), &data[datalen-14], 12); - memcpy(skb_put(skb, 2), &data[6], 2); - memcpy(skb_put(skb, len), data+8, len); - hlist_add_head(&frag->fnode, &zd->fraglist); - goto resubmit; - } - hlist_for_each_entry(frag, &zd->fraglist, fnode) - if (frag->seq == (seq&IEEE80211_SCTL_SEQ)) - break; - if (!frag) - goto resubmit; - skb = frag->skb; - ptr = skb_put(skb, len); - if (ptr) - memcpy(ptr, data+8, len); - if (fc & IEEE80211_FCTL_MOREFRAGS) - goto resubmit; - hlist_del_init(&frag->fnode); - kfree(frag); - } else { - if (datalen<14) - goto resubmit; - skb = dev_alloc_skb(len + 14 + 2); - if (!skb) - goto resubmit; - skb_reserve(skb, 2); - memcpy(skb_put(skb, 12), &data[datalen-14], 12); - memcpy(skb_put(skb, 2), &data[6], 2); - memcpy(skb_put(skb, len), data+8, len); - } - skb->protocol = eth_type_trans(skb, zd->dev); - zd->dev->stats.rx_packets++; - zd->dev->stats.rx_bytes += skb->len; - netif_rx(skb); - } -resubmit: - memset(data, 0, ZD1201_RXSIZE); - - urb->status = 0; - urb->dev = zd->usb; - if(usb_submit_urb(urb, GFP_ATOMIC)) - free = 1; - -exit: - if (free) { - zd->rxlen = 0; - zd->rxdatas = 1; - wake_up(&zd->rxdataq); - kfree(urb->transfer_buffer); - } -} - -static int zd1201_getconfig(struct zd1201 *zd, int rid, void *riddata, - unsigned int riddatalen) -{ - int err; - int i = 0; - int code; - int rid_fid; - int length; - unsigned char *pdata; - - zd->rxdatas = 0; - err = zd1201_docmd(zd, ZD1201_CMDCODE_ACCESS, rid, 0, 0); - if (err) - return err; - - wait_event_interruptible(zd->rxdataq, zd->rxdatas); - if (!zd->rxlen) - return -EIO; - - code = le16_to_cpu(*(__le16*)(&zd->rxdata[4])); - rid_fid = le16_to_cpu(*(__le16*)(&zd->rxdata[6])); - length = le16_to_cpu(*(__le16*)(&zd->rxdata[8])); - if (length > zd->rxlen) - length = zd->rxlen-6; - - /* If access bit is not on, then error */ - if ((code & ZD1201_ACCESSBIT) != ZD1201_ACCESSBIT || rid_fid != rid ) - return -EINVAL; - - /* Not enough buffer for allocating data */ - if (riddatalen != (length - 4)) { - dev_dbg(&zd->usb->dev, "riddatalen mismatches, expected=%u, (packet=%u) length=%u, rid=0x%04X, rid_fid=0x%04X\n", - riddatalen, zd->rxlen, length, rid, rid_fid); - return -ENODATA; - } - - zd->rxdatas = 0; - /* Issue SetRxRid commnd */ - err = zd1201_docmd(zd, ZD1201_CMDCODE_SETRXRID, rid, 0, length); - if (err) - return err; - - /* Receive RID record from resource packets */ - wait_event_interruptible(zd->rxdataq, zd->rxdatas); - if (!zd->rxlen) - return -EIO; - - if (zd->rxdata[zd->rxlen - 1] != ZD1201_PACKET_RESOURCE) { - dev_dbg(&zd->usb->dev, "Packet type mismatch: 0x%x not 0x3\n", - zd->rxdata[zd->rxlen-1]); - return -EINVAL; - } - - /* Set the data pointer and received data length */ - pdata = zd->rxdata; - length = zd->rxlen; - - do { - int actual_length; - - actual_length = (length > 64) ? 64 : length; - - if (pdata[0] != 0x3) { - dev_dbg(&zd->usb->dev, "Rx Resource packet type error: %02X\n", - pdata[0]); - return -EINVAL; - } - - if (actual_length != 64) { - /* Trim the last packet type byte */ - actual_length--; - } - - /* Skip the 4 bytes header (RID length and RID) */ - if (i == 0) { - pdata += 8; - actual_length -= 8; - } else { - pdata += 4; - actual_length -= 4; - } - - memcpy(riddata, pdata, actual_length); - riddata += actual_length; - pdata += actual_length; - length -= 64; - i++; - } while (length > 0); - - return 0; -} - -/* - * resreq: - * byte type - * byte sequence - * u16 reserved - * byte data[12] - * total: 16 - */ -static int zd1201_setconfig(struct zd1201 *zd, int rid, void *buf, int len, int wait) -{ - int err; - unsigned char *request; - int reqlen; - char seq=0; - struct urb *urb; - gfp_t gfp_mask = wait ? GFP_NOIO : GFP_ATOMIC; - - len += 4; /* first 4 are for header */ - - zd->rxdatas = 0; - zd->rxlen = 0; - for (seq=0; len > 0; seq++) { - request = kmalloc(16, gfp_mask); - if (!request) - return -ENOMEM; - urb = usb_alloc_urb(0, gfp_mask); - if (!urb) { - kfree(request); - return -ENOMEM; - } - memset(request, 0, 16); - reqlen = len>12 ? 12 : len; - request[0] = ZD1201_USB_RESREQ; - request[1] = seq; - request[2] = 0; - request[3] = 0; - if (request[1] == 0) { - /* add header */ - *(__le16*)&request[4] = cpu_to_le16((len-2+1)/2); - *(__le16*)&request[6] = cpu_to_le16(rid); - memcpy(request+8, buf, reqlen-4); - buf += reqlen-4; - } else { - memcpy(request+4, buf, reqlen); - buf += reqlen; - } - - len -= reqlen; - - usb_fill_bulk_urb(urb, zd->usb, usb_sndbulkpipe(zd->usb, - zd->endp_out2), request, 16, zd1201_usbfree, zd); - err = usb_submit_urb(urb, gfp_mask); - if (err) - goto err; - } - - request = kmalloc(16, gfp_mask); - if (!request) - return -ENOMEM; - urb = usb_alloc_urb(0, gfp_mask); - if (!urb) { - kfree(request); - return -ENOMEM; - } - *((__le32*)request) = cpu_to_le32(ZD1201_USB_CMDREQ); - *((__le16*)&request[4]) = - cpu_to_le16(ZD1201_CMDCODE_ACCESS|ZD1201_ACCESSBIT); - *((__le16*)&request[6]) = cpu_to_le16(rid); - *((__le16*)&request[8]) = cpu_to_le16(0); - *((__le16*)&request[10]) = cpu_to_le16(0); - usb_fill_bulk_urb(urb, zd->usb, usb_sndbulkpipe(zd->usb, zd->endp_out2), - request, 16, zd1201_usbfree, zd); - err = usb_submit_urb(urb, gfp_mask); - if (err) - goto err; - - if (wait) { - wait_event_interruptible(zd->rxdataq, zd->rxdatas); - if (!zd->rxlen || le16_to_cpu(*(__le16*)&zd->rxdata[6]) != rid) { - dev_dbg(&zd->usb->dev, "wrong or no RID received\n"); - } - } - - return 0; -err: - kfree(request); - usb_free_urb(urb); - return err; -} - -static inline int zd1201_getconfig16(struct zd1201 *zd, int rid, short *val) -{ - int err; - __le16 zdval; - - err = zd1201_getconfig(zd, rid, &zdval, sizeof(__le16)); - if (err) - return err; - *val = le16_to_cpu(zdval); - return 0; -} - -static inline int zd1201_setconfig16(struct zd1201 *zd, int rid, short val) -{ - __le16 zdval = cpu_to_le16(val); - return (zd1201_setconfig(zd, rid, &zdval, sizeof(__le16), 1)); -} - -static int zd1201_drvr_start(struct zd1201 *zd) -{ - int err, i; - short max; - __le16 zdmax; - unsigned char *buffer; - - buffer = kzalloc(ZD1201_RXSIZE, GFP_KERNEL); - if (!buffer) - return -ENOMEM; - - usb_fill_bulk_urb(zd->rx_urb, zd->usb, - usb_rcvbulkpipe(zd->usb, zd->endp_in), buffer, ZD1201_RXSIZE, - zd1201_usbrx, zd); - - err = usb_submit_urb(zd->rx_urb, GFP_KERNEL); - if (err) - goto err_buffer; - - err = zd1201_docmd(zd, ZD1201_CMDCODE_INIT, 0, 0, 0); - if (err) - goto err_urb; - - err = zd1201_getconfig(zd, ZD1201_RID_CNFMAXTXBUFFERNUMBER, &zdmax, - sizeof(__le16)); - if (err) - goto err_urb; - - max = le16_to_cpu(zdmax); - for (i=0; irx_urb); - return err; -err_buffer: - kfree(buffer); - return err; -} - -/* Magic alert: The firmware doesn't seem to like the MAC state being - * toggled in promisc (aka monitor) mode. - * (It works a number of times, but will halt eventually) - * So we turn it of before disabling and on after enabling if needed. - */ -static int zd1201_enable(struct zd1201 *zd) -{ - int err; - - if (zd->mac_enabled) - return 0; - - err = zd1201_docmd(zd, ZD1201_CMDCODE_ENABLE, 0, 0, 0); - if (!err) - zd->mac_enabled = 1; - - if (zd->monitor) - err = zd1201_setconfig16(zd, ZD1201_RID_PROMISCUOUSMODE, 1); - - return err; -} - -static int zd1201_disable(struct zd1201 *zd) -{ - int err; - - if (!zd->mac_enabled) - return 0; - if (zd->monitor) { - err = zd1201_setconfig16(zd, ZD1201_RID_PROMISCUOUSMODE, 0); - if (err) - return err; - } - - err = zd1201_docmd(zd, ZD1201_CMDCODE_DISABLE, 0, 0, 0); - if (!err) - zd->mac_enabled = 0; - return err; -} - -static int zd1201_mac_reset(struct zd1201 *zd) -{ - if (!zd->mac_enabled) - return 0; - zd1201_disable(zd); - return zd1201_enable(zd); -} - -static int zd1201_join(struct zd1201 *zd, char *essid, int essidlen) -{ - int err, val; - char buf[IW_ESSID_MAX_SIZE+2]; - - err = zd1201_disable(zd); - if (err) - return err; - - val = ZD1201_CNFAUTHENTICATION_OPENSYSTEM; - val |= ZD1201_CNFAUTHENTICATION_SHAREDKEY; - err = zd1201_setconfig16(zd, ZD1201_RID_CNFAUTHENTICATION, val); - if (err) - return err; - - *(__le16 *)buf = cpu_to_le16(essidlen); - memcpy(buf+2, essid, essidlen); - if (!zd->ap) { /* Normal station */ - err = zd1201_setconfig(zd, ZD1201_RID_CNFDESIREDSSID, buf, - IW_ESSID_MAX_SIZE+2, 1); - if (err) - return err; - } else { /* AP */ - err = zd1201_setconfig(zd, ZD1201_RID_CNFOWNSSID, buf, - IW_ESSID_MAX_SIZE+2, 1); - if (err) - return err; - } - - err = zd1201_setconfig(zd, ZD1201_RID_CNFOWNMACADDR, - zd->dev->dev_addr, zd->dev->addr_len, 1); - if (err) - return err; - - err = zd1201_enable(zd); - if (err) - return err; - - msleep(100); - return 0; -} - -static int zd1201_net_open(struct net_device *dev) -{ - struct zd1201 *zd = netdev_priv(dev); - - /* Start MAC with wildcard if no essid set */ - if (!zd->mac_enabled) - zd1201_join(zd, zd->essid, zd->essidlen); - netif_start_queue(dev); - - return 0; -} - -static int zd1201_net_stop(struct net_device *dev) -{ - netif_stop_queue(dev); - return 0; -} - -/* - RFC 1042 encapsulates Ethernet frames in 802.11 frames - by prefixing them with 0xaa, 0xaa, 0x03) followed by a SNAP OID of 0 - (0x00, 0x00, 0x00). Zd requires an additional padding, copy - of ethernet addresses, length of the standard RFC 1042 packet - and a command byte (which is nul for tx). - - tx frame (from Wlan NG): - RFC 1042: - llc 0xAA 0xAA 0x03 (802.2 LLC) - snap 0x00 0x00 0x00 (Ethernet encapsulated) - type 2 bytes, Ethernet type field - payload (minus eth header) - Zydas specific: - padding 1B if (skb->len+8+1)%64==0 - Eth MAC addr 12 bytes, Ethernet MAC addresses - length 2 bytes, RFC 1042 packet length - (llc+snap+type+payload) - zd 1 null byte, zd1201 packet type - */ -static netdev_tx_t zd1201_hard_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - struct zd1201 *zd = netdev_priv(dev); - unsigned char *txbuf = zd->txdata; - int txbuflen, pad = 0, err; - struct urb *urb = zd->tx_urb; - - if (!zd->mac_enabled || zd->monitor) { - dev->stats.tx_dropped++; - kfree_skb(skb); - return NETDEV_TX_OK; - } - netif_stop_queue(dev); - - txbuflen = skb->len + 8 + 1; - if (txbuflen%64 == 0) { - pad = 1; - txbuflen++; - } - txbuf[0] = 0xAA; - txbuf[1] = 0xAA; - txbuf[2] = 0x03; - txbuf[3] = 0x00; /* rfc1042 */ - txbuf[4] = 0x00; - txbuf[5] = 0x00; - - skb_copy_from_linear_data_offset(skb, 12, txbuf + 6, skb->len - 12); - if (pad) - txbuf[skb->len-12+6]=0; - skb_copy_from_linear_data(skb, txbuf + skb->len - 12 + 6 + pad, 12); - *(__be16*)&txbuf[skb->len+6+pad] = htons(skb->len-12+6); - txbuf[txbuflen-1] = 0; - - usb_fill_bulk_urb(urb, zd->usb, usb_sndbulkpipe(zd->usb, zd->endp_out), - txbuf, txbuflen, zd1201_usbtx, zd); - - err = usb_submit_urb(zd->tx_urb, GFP_ATOMIC); - if (err) { - dev->stats.tx_errors++; - netif_start_queue(dev); - } else { - dev->stats.tx_packets++; - dev->stats.tx_bytes += skb->len; - } - kfree_skb(skb); - - return NETDEV_TX_OK; -} - -static void zd1201_tx_timeout(struct net_device *dev) -{ - struct zd1201 *zd = netdev_priv(dev); - - if (!zd) - return; - dev_warn(&zd->usb->dev, "%s: TX timeout, shooting down urb\n", - dev->name); - usb_unlink_urb(zd->tx_urb); - dev->stats.tx_errors++; - /* Restart the timeout to quiet the watchdog: */ - dev->trans_start = jiffies; /* prevent tx timeout */ -} - -static int zd1201_set_mac_address(struct net_device *dev, void *p) -{ - struct sockaddr *addr = p; - struct zd1201 *zd = netdev_priv(dev); - int err; - - if (!zd) - return -ENODEV; - - err = zd1201_setconfig(zd, ZD1201_RID_CNFOWNMACADDR, - addr->sa_data, dev->addr_len, 1); - if (err) - return err; - memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); - - return zd1201_mac_reset(zd); -} - -static struct iw_statistics *zd1201_get_wireless_stats(struct net_device *dev) -{ - struct zd1201 *zd = netdev_priv(dev); - - return &zd->iwstats; -} - -static void zd1201_set_multicast(struct net_device *dev) -{ - struct zd1201 *zd = netdev_priv(dev); - struct netdev_hw_addr *ha; - unsigned char reqbuf[ETH_ALEN*ZD1201_MAXMULTI]; - int i; - - if (netdev_mc_count(dev) > ZD1201_MAXMULTI) - return; - - i = 0; - netdev_for_each_mc_addr(ha, dev) - memcpy(reqbuf + i++ * ETH_ALEN, ha->addr, ETH_ALEN); - zd1201_setconfig(zd, ZD1201_RID_CNFGROUPADDRESS, reqbuf, - netdev_mc_count(dev) * ETH_ALEN, 0); -} - -static int zd1201_config_commit(struct net_device *dev, - struct iw_request_info *info, struct iw_point *data, char *essid) -{ - struct zd1201 *zd = netdev_priv(dev); - - return zd1201_mac_reset(zd); -} - -static int zd1201_get_name(struct net_device *dev, - struct iw_request_info *info, char *name, char *extra) -{ - strcpy(name, "IEEE 802.11b"); - return 0; -} - -static int zd1201_set_freq(struct net_device *dev, - struct iw_request_info *info, struct iw_freq *freq, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - short channel = 0; - int err; - - if (freq->e == 0) - channel = freq->m; - else { - channel = ieee80211_freq_to_dsss_chan(freq->m); - if (channel < 0) - channel = 0; - } - - err = zd1201_setconfig16(zd, ZD1201_RID_CNFOWNCHANNEL, channel); - if (err) - return err; - - zd1201_mac_reset(zd); - - return 0; -} - -static int zd1201_get_freq(struct net_device *dev, - struct iw_request_info *info, struct iw_freq *freq, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - short channel; - int err; - - err = zd1201_getconfig16(zd, ZD1201_RID_CNFOWNCHANNEL, &channel); - if (err) - return err; - freq->e = 0; - freq->m = channel; - - return 0; -} - -static int zd1201_set_mode(struct net_device *dev, - struct iw_request_info *info, __u32 *mode, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - short porttype, monitor = 0; - unsigned char buffer[IW_ESSID_MAX_SIZE+2]; - int err; - - if (zd->ap) { - if (*mode != IW_MODE_MASTER) - return -EINVAL; - return 0; - } - - err = zd1201_setconfig16(zd, ZD1201_RID_PROMISCUOUSMODE, 0); - if (err) - return err; - zd->dev->type = ARPHRD_ETHER; - switch(*mode) { - case IW_MODE_MONITOR: - monitor = 1; - zd->dev->type = ARPHRD_IEEE80211; - /* Make sure we are no longer associated with by - setting an 'impossible' essid. - (otherwise we mess up firmware) - */ - zd1201_join(zd, "\0-*#\0", 5); - /* Put port in pIBSS */ - case 8: /* No pseudo-IBSS in wireless extensions (yet) */ - porttype = ZD1201_PORTTYPE_PSEUDOIBSS; - break; - case IW_MODE_ADHOC: - porttype = ZD1201_PORTTYPE_IBSS; - break; - case IW_MODE_INFRA: - porttype = ZD1201_PORTTYPE_BSS; - break; - default: - return -EINVAL; - } - - err = zd1201_setconfig16(zd, ZD1201_RID_CNFPORTTYPE, porttype); - if (err) - return err; - if (zd->monitor && !monitor) { - zd1201_disable(zd); - *(__le16 *)buffer = cpu_to_le16(zd->essidlen); - memcpy(buffer+2, zd->essid, zd->essidlen); - err = zd1201_setconfig(zd, ZD1201_RID_CNFDESIREDSSID, - buffer, IW_ESSID_MAX_SIZE+2, 1); - if (err) - return err; - } - zd->monitor = monitor; - /* If monitor mode is set we don't actually turn it on here since it - * is done during mac reset anyway (see zd1201_mac_enable). - */ - zd1201_mac_reset(zd); - - return 0; -} - -static int zd1201_get_mode(struct net_device *dev, - struct iw_request_info *info, __u32 *mode, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - short porttype; - int err; - - err = zd1201_getconfig16(zd, ZD1201_RID_CNFPORTTYPE, &porttype); - if (err) - return err; - switch(porttype) { - case ZD1201_PORTTYPE_IBSS: - *mode = IW_MODE_ADHOC; - break; - case ZD1201_PORTTYPE_BSS: - *mode = IW_MODE_INFRA; - break; - case ZD1201_PORTTYPE_WDS: - *mode = IW_MODE_REPEAT; - break; - case ZD1201_PORTTYPE_PSEUDOIBSS: - *mode = 8;/* No Pseudo-IBSS... */ - break; - case ZD1201_PORTTYPE_AP: - *mode = IW_MODE_MASTER; - break; - default: - dev_dbg(&zd->usb->dev, "Unknown porttype: %d\n", - porttype); - *mode = IW_MODE_AUTO; - } - if (zd->monitor) - *mode = IW_MODE_MONITOR; - - return 0; -} - -static int zd1201_get_range(struct net_device *dev, - struct iw_request_info *info, struct iw_point *wrq, char *extra) -{ - struct iw_range *range = (struct iw_range *)extra; - - wrq->length = sizeof(struct iw_range); - memset(range, 0, sizeof(struct iw_range)); - range->we_version_compiled = WIRELESS_EXT; - range->we_version_source = WIRELESS_EXT; - - range->max_qual.qual = 128; - range->max_qual.level = 128; - range->max_qual.noise = 128; - range->max_qual.updated = 7; - - range->encoding_size[0] = 5; - range->encoding_size[1] = 13; - range->num_encoding_sizes = 2; - range->max_encoding_tokens = ZD1201_NUMKEYS; - - range->num_bitrates = 4; - range->bitrate[0] = 1000000; - range->bitrate[1] = 2000000; - range->bitrate[2] = 5500000; - range->bitrate[3] = 11000000; - - range->min_rts = 0; - range->min_frag = ZD1201_FRAGMIN; - range->max_rts = ZD1201_RTSMAX; - range->min_frag = ZD1201_FRAGMAX; - - return 0; -} - -/* Little bit of magic here: we only get the quality if we poll - * for it, and we never get an actual request to trigger such - * a poll. Therefore we 'assume' that the user will soon ask for - * the stats after asking the bssid. - */ -static int zd1201_get_wap(struct net_device *dev, - struct iw_request_info *info, struct sockaddr *ap_addr, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - unsigned char buffer[6]; - - if (!zd1201_getconfig(zd, ZD1201_RID_COMMSQUALITY, buffer, 6)) { - /* Unfortunately the quality and noise reported is useless. - they seem to be accumulators that increase until you - read them, unless we poll on a fixed interval we can't - use them - */ - /*zd->iwstats.qual.qual = le16_to_cpu(((__le16 *)buffer)[0]);*/ - zd->iwstats.qual.level = le16_to_cpu(((__le16 *)buffer)[1]); - /*zd->iwstats.qual.noise = le16_to_cpu(((__le16 *)buffer)[2]);*/ - zd->iwstats.qual.updated = 2; - } - - return zd1201_getconfig(zd, ZD1201_RID_CURRENTBSSID, ap_addr->sa_data, 6); -} - -static int zd1201_set_scan(struct net_device *dev, - struct iw_request_info *info, struct iw_point *srq, char *extra) -{ - /* We do everything in get_scan */ - return 0; -} - -static int zd1201_get_scan(struct net_device *dev, - struct iw_request_info *info, struct iw_point *srq, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - int err, i, j, enabled_save; - struct iw_event iwe; - char *cev = extra; - char *end_buf = extra + IW_SCAN_MAX_DATA; - - /* No scanning in AP mode */ - if (zd->ap) - return -EOPNOTSUPP; - - /* Scan doesn't seem to work if disabled */ - enabled_save = zd->mac_enabled; - zd1201_enable(zd); - - zd->rxdatas = 0; - err = zd1201_docmd(zd, ZD1201_CMDCODE_INQUIRE, - ZD1201_INQ_SCANRESULTS, 0, 0); - if (err) - return err; - - wait_event_interruptible(zd->rxdataq, zd->rxdatas); - if (!zd->rxlen) - return -EIO; - - if (le16_to_cpu(*(__le16*)&zd->rxdata[2]) != ZD1201_INQ_SCANRESULTS) - return -EIO; - - for(i=8; irxlen; i+=62) { - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, zd->rxdata+i+6, 6); - cev = iwe_stream_add_event(info, cev, end_buf, - &iwe, IW_EV_ADDR_LEN); - - iwe.cmd = SIOCGIWESSID; - iwe.u.data.length = zd->rxdata[i+16]; - iwe.u.data.flags = 1; - cev = iwe_stream_add_point(info, cev, end_buf, - &iwe, zd->rxdata+i+18); - - iwe.cmd = SIOCGIWMODE; - if (zd->rxdata[i+14]&0x01) - iwe.u.mode = IW_MODE_MASTER; - else - iwe.u.mode = IW_MODE_ADHOC; - cev = iwe_stream_add_event(info, cev, end_buf, - &iwe, IW_EV_UINT_LEN); - - iwe.cmd = SIOCGIWFREQ; - iwe.u.freq.m = zd->rxdata[i+0]; - iwe.u.freq.e = 0; - cev = iwe_stream_add_event(info, cev, end_buf, - &iwe, IW_EV_FREQ_LEN); - - iwe.cmd = SIOCGIWRATE; - iwe.u.bitrate.fixed = 0; - iwe.u.bitrate.disabled = 0; - for (j=0; j<10; j++) if (zd->rxdata[i+50+j]) { - iwe.u.bitrate.value = (zd->rxdata[i+50+j]&0x7f)*500000; - cev = iwe_stream_add_event(info, cev, end_buf, - &iwe, IW_EV_PARAM_LEN); - } - - iwe.cmd = SIOCGIWENCODE; - iwe.u.data.length = 0; - if (zd->rxdata[i+14]&0x10) - iwe.u.data.flags = IW_ENCODE_ENABLED; - else - iwe.u.data.flags = IW_ENCODE_DISABLED; - cev = iwe_stream_add_point(info, cev, end_buf, &iwe, NULL); - - iwe.cmd = IWEVQUAL; - iwe.u.qual.qual = zd->rxdata[i+4]; - iwe.u.qual.noise= zd->rxdata[i+2]/10-100; - iwe.u.qual.level = (256+zd->rxdata[i+4]*100)/255-100; - iwe.u.qual.updated = 7; - cev = iwe_stream_add_event(info, cev, end_buf, - &iwe, IW_EV_QUAL_LEN); - } - - if (!enabled_save) - zd1201_disable(zd); - - srq->length = cev - extra; - srq->flags = 0; - - return 0; -} - -static int zd1201_set_essid(struct net_device *dev, - struct iw_request_info *info, struct iw_point *data, char *essid) -{ - struct zd1201 *zd = netdev_priv(dev); - - if (data->length > IW_ESSID_MAX_SIZE) - return -EINVAL; - if (data->length < 1) - data->length = 1; - zd->essidlen = data->length; - memset(zd->essid, 0, IW_ESSID_MAX_SIZE+1); - memcpy(zd->essid, essid, data->length); - return zd1201_join(zd, zd->essid, zd->essidlen); -} - -static int zd1201_get_essid(struct net_device *dev, - struct iw_request_info *info, struct iw_point *data, char *essid) -{ - struct zd1201 *zd = netdev_priv(dev); - - memcpy(essid, zd->essid, zd->essidlen); - data->flags = 1; - data->length = zd->essidlen; - - return 0; -} - -static int zd1201_get_nick(struct net_device *dev, struct iw_request_info *info, - struct iw_point *data, char *nick) -{ - strcpy(nick, "zd1201"); - data->flags = 1; - data->length = strlen(nick); - return 0; -} - -static int zd1201_set_rate(struct net_device *dev, - struct iw_request_info *info, struct iw_param *rrq, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - short rate; - int err; - - switch (rrq->value) { - case 1000000: - rate = ZD1201_RATEB1; - break; - case 2000000: - rate = ZD1201_RATEB2; - break; - case 5500000: - rate = ZD1201_RATEB5; - break; - case 11000000: - default: - rate = ZD1201_RATEB11; - break; - } - if (!rrq->fixed) { /* Also enable all lower bitrates */ - rate |= rate-1; - } - - err = zd1201_setconfig16(zd, ZD1201_RID_TXRATECNTL, rate); - if (err) - return err; - - return zd1201_mac_reset(zd); -} - -static int zd1201_get_rate(struct net_device *dev, - struct iw_request_info *info, struct iw_param *rrq, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - short rate; - int err; - - err = zd1201_getconfig16(zd, ZD1201_RID_CURRENTTXRATE, &rate); - if (err) - return err; - - switch(rate) { - case 1: - rrq->value = 1000000; - break; - case 2: - rrq->value = 2000000; - break; - case 5: - rrq->value = 5500000; - break; - case 11: - rrq->value = 11000000; - break; - default: - rrq->value = 0; - } - rrq->fixed = 0; - rrq->disabled = 0; - - return 0; -} - -static int zd1201_set_rts(struct net_device *dev, struct iw_request_info *info, - struct iw_param *rts, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - int err; - short val = rts->value; - - if (rts->disabled || !rts->fixed) - val = ZD1201_RTSMAX; - if (val > ZD1201_RTSMAX) - return -EINVAL; - if (val < 0) - return -EINVAL; - - err = zd1201_setconfig16(zd, ZD1201_RID_CNFRTSTHRESHOLD, val); - if (err) - return err; - return zd1201_mac_reset(zd); -} - -static int zd1201_get_rts(struct net_device *dev, struct iw_request_info *info, - struct iw_param *rts, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - short rtst; - int err; - - err = zd1201_getconfig16(zd, ZD1201_RID_CNFRTSTHRESHOLD, &rtst); - if (err) - return err; - rts->value = rtst; - rts->disabled = (rts->value == ZD1201_RTSMAX); - rts->fixed = 1; - - return 0; -} - -static int zd1201_set_frag(struct net_device *dev, struct iw_request_info *info, - struct iw_param *frag, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - int err; - short val = frag->value; - - if (frag->disabled || !frag->fixed) - val = ZD1201_FRAGMAX; - if (val > ZD1201_FRAGMAX) - return -EINVAL; - if (val < ZD1201_FRAGMIN) - return -EINVAL; - if (val & 1) - return -EINVAL; - err = zd1201_setconfig16(zd, ZD1201_RID_CNFFRAGTHRESHOLD, val); - if (err) - return err; - return zd1201_mac_reset(zd); -} - -static int zd1201_get_frag(struct net_device *dev, struct iw_request_info *info, - struct iw_param *frag, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - short fragt; - int err; - - err = zd1201_getconfig16(zd, ZD1201_RID_CNFFRAGTHRESHOLD, &fragt); - if (err) - return err; - frag->value = fragt; - frag->disabled = (frag->value == ZD1201_FRAGMAX); - frag->fixed = 1; - - return 0; -} - -static int zd1201_set_retry(struct net_device *dev, - struct iw_request_info *info, struct iw_param *rrq, char *extra) -{ - return 0; -} - -static int zd1201_get_retry(struct net_device *dev, - struct iw_request_info *info, struct iw_param *rrq, char *extra) -{ - return 0; -} - -static int zd1201_set_encode(struct net_device *dev, - struct iw_request_info *info, struct iw_point *erq, char *key) -{ - struct zd1201 *zd = netdev_priv(dev); - short i; - int err, rid; - - if (erq->length > ZD1201_MAXKEYLEN) - return -EINVAL; - - i = (erq->flags & IW_ENCODE_INDEX)-1; - if (i == -1) { - err = zd1201_getconfig16(zd,ZD1201_RID_CNFDEFAULTKEYID,&i); - if (err) - return err; - } else { - err = zd1201_setconfig16(zd, ZD1201_RID_CNFDEFAULTKEYID, i); - if (err) - return err; - } - - if (i < 0 || i >= ZD1201_NUMKEYS) - return -EINVAL; - - rid = ZD1201_RID_CNFDEFAULTKEY0 + i; - err = zd1201_setconfig(zd, rid, key, erq->length, 1); - if (err) - return err; - zd->encode_keylen[i] = erq->length; - memcpy(zd->encode_keys[i], key, erq->length); - - i=0; - if (!(erq->flags & IW_ENCODE_DISABLED & IW_ENCODE_MODE)) { - i |= 0x01; - zd->encode_enabled = 1; - } else - zd->encode_enabled = 0; - if (erq->flags & IW_ENCODE_RESTRICTED & IW_ENCODE_MODE) { - i |= 0x02; - zd->encode_restricted = 1; - } else - zd->encode_restricted = 0; - err = zd1201_setconfig16(zd, ZD1201_RID_CNFWEBFLAGS, i); - if (err) - return err; - - if (zd->encode_enabled) - i = ZD1201_CNFAUTHENTICATION_SHAREDKEY; - else - i = ZD1201_CNFAUTHENTICATION_OPENSYSTEM; - err = zd1201_setconfig16(zd, ZD1201_RID_CNFAUTHENTICATION, i); - if (err) - return err; - - return zd1201_mac_reset(zd); -} - -static int zd1201_get_encode(struct net_device *dev, - struct iw_request_info *info, struct iw_point *erq, char *key) -{ - struct zd1201 *zd = netdev_priv(dev); - short i; - int err; - - if (zd->encode_enabled) - erq->flags = IW_ENCODE_ENABLED; - else - erq->flags = IW_ENCODE_DISABLED; - if (zd->encode_restricted) - erq->flags |= IW_ENCODE_RESTRICTED; - else - erq->flags |= IW_ENCODE_OPEN; - - i = (erq->flags & IW_ENCODE_INDEX) -1; - if (i == -1) { - err = zd1201_getconfig16(zd, ZD1201_RID_CNFDEFAULTKEYID, &i); - if (err) - return err; - } - if (i<0 || i>= ZD1201_NUMKEYS) - return -EINVAL; - - erq->flags |= i+1; - - erq->length = zd->encode_keylen[i]; - memcpy(key, zd->encode_keys[i], erq->length); - - return 0; -} - -static int zd1201_set_power(struct net_device *dev, - struct iw_request_info *info, struct iw_param *vwrq, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - short enabled, duration, level; - int err; - - enabled = vwrq->disabled ? 0 : 1; - if (enabled) { - if (vwrq->flags & IW_POWER_PERIOD) { - duration = vwrq->value; - err = zd1201_setconfig16(zd, - ZD1201_RID_CNFMAXSLEEPDURATION, duration); - if (err) - return err; - goto out; - } - if (vwrq->flags & IW_POWER_TIMEOUT) { - err = zd1201_getconfig16(zd, - ZD1201_RID_CNFMAXSLEEPDURATION, &duration); - if (err) - return err; - level = vwrq->value * 4 / duration; - if (level > 4) - level = 4; - if (level < 0) - level = 0; - err = zd1201_setconfig16(zd, ZD1201_RID_CNFPMEPS, - level); - if (err) - return err; - goto out; - } - return -EINVAL; - } -out: - return zd1201_setconfig16(zd, ZD1201_RID_CNFPMENABLED, enabled); -} - -static int zd1201_get_power(struct net_device *dev, - struct iw_request_info *info, struct iw_param *vwrq, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - short enabled, level, duration; - int err; - - err = zd1201_getconfig16(zd, ZD1201_RID_CNFPMENABLED, &enabled); - if (err) - return err; - err = zd1201_getconfig16(zd, ZD1201_RID_CNFPMEPS, &level); - if (err) - return err; - err = zd1201_getconfig16(zd, ZD1201_RID_CNFMAXSLEEPDURATION, &duration); - if (err) - return err; - vwrq->disabled = enabled ? 0 : 1; - if (vwrq->flags & IW_POWER_TYPE) { - if (vwrq->flags & IW_POWER_PERIOD) { - vwrq->value = duration; - vwrq->flags = IW_POWER_PERIOD; - } else { - vwrq->value = duration * level / 4; - vwrq->flags = IW_POWER_TIMEOUT; - } - } - if (vwrq->flags & IW_POWER_MODE) { - if (enabled && level) - vwrq->flags = IW_POWER_UNICAST_R; - else - vwrq->flags = IW_POWER_ALL_R; - } - - return 0; -} - - -static const iw_handler zd1201_iw_handler[] = -{ - (iw_handler) zd1201_config_commit, /* SIOCSIWCOMMIT */ - (iw_handler) zd1201_get_name, /* SIOCGIWNAME */ - (iw_handler) NULL, /* SIOCSIWNWID */ - (iw_handler) NULL, /* SIOCGIWNWID */ - (iw_handler) zd1201_set_freq, /* SIOCSIWFREQ */ - (iw_handler) zd1201_get_freq, /* SIOCGIWFREQ */ - (iw_handler) zd1201_set_mode, /* SIOCSIWMODE */ - (iw_handler) zd1201_get_mode, /* SIOCGIWMODE */ - (iw_handler) NULL, /* SIOCSIWSENS */ - (iw_handler) NULL, /* SIOCGIWSENS */ - (iw_handler) NULL, /* SIOCSIWRANGE */ - (iw_handler) zd1201_get_range, /* SIOCGIWRANGE */ - (iw_handler) NULL, /* SIOCSIWPRIV */ - (iw_handler) NULL, /* SIOCGIWPRIV */ - (iw_handler) NULL, /* SIOCSIWSTATS */ - (iw_handler) NULL, /* SIOCGIWSTATS */ - (iw_handler) NULL, /* SIOCSIWSPY */ - (iw_handler) NULL, /* SIOCGIWSPY */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL/*zd1201_set_wap*/, /* SIOCSIWAP */ - (iw_handler) zd1201_get_wap, /* SIOCGIWAP */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* SIOCGIWAPLIST */ - (iw_handler) zd1201_set_scan, /* SIOCSIWSCAN */ - (iw_handler) zd1201_get_scan, /* SIOCGIWSCAN */ - (iw_handler) zd1201_set_essid, /* SIOCSIWESSID */ - (iw_handler) zd1201_get_essid, /* SIOCGIWESSID */ - (iw_handler) NULL, /* SIOCSIWNICKN */ - (iw_handler) zd1201_get_nick, /* SIOCGIWNICKN */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) NULL, /* -- hole -- */ - (iw_handler) zd1201_set_rate, /* SIOCSIWRATE */ - (iw_handler) zd1201_get_rate, /* SIOCGIWRATE */ - (iw_handler) zd1201_set_rts, /* SIOCSIWRTS */ - (iw_handler) zd1201_get_rts, /* SIOCGIWRTS */ - (iw_handler) zd1201_set_frag, /* SIOCSIWFRAG */ - (iw_handler) zd1201_get_frag, /* SIOCGIWFRAG */ - (iw_handler) NULL, /* SIOCSIWTXPOW */ - (iw_handler) NULL, /* SIOCGIWTXPOW */ - (iw_handler) zd1201_set_retry, /* SIOCSIWRETRY */ - (iw_handler) zd1201_get_retry, /* SIOCGIWRETRY */ - (iw_handler) zd1201_set_encode, /* SIOCSIWENCODE */ - (iw_handler) zd1201_get_encode, /* SIOCGIWENCODE */ - (iw_handler) zd1201_set_power, /* SIOCSIWPOWER */ - (iw_handler) zd1201_get_power, /* SIOCGIWPOWER */ -}; - -static int zd1201_set_hostauth(struct net_device *dev, - struct iw_request_info *info, struct iw_param *rrq, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - - if (!zd->ap) - return -EOPNOTSUPP; - - return zd1201_setconfig16(zd, ZD1201_RID_CNFHOSTAUTH, rrq->value); -} - -static int zd1201_get_hostauth(struct net_device *dev, - struct iw_request_info *info, struct iw_param *rrq, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - short hostauth; - int err; - - if (!zd->ap) - return -EOPNOTSUPP; - - err = zd1201_getconfig16(zd, ZD1201_RID_CNFHOSTAUTH, &hostauth); - if (err) - return err; - rrq->value = hostauth; - rrq->fixed = 1; - - return 0; -} - -static int zd1201_auth_sta(struct net_device *dev, - struct iw_request_info *info, struct sockaddr *sta, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - unsigned char buffer[10]; - - if (!zd->ap) - return -EOPNOTSUPP; - - memcpy(buffer, sta->sa_data, ETH_ALEN); - *(short*)(buffer+6) = 0; /* 0==success, 1==failure */ - *(short*)(buffer+8) = 0; - - return zd1201_setconfig(zd, ZD1201_RID_AUTHENTICATESTA, buffer, 10, 1); -} - -static int zd1201_set_maxassoc(struct net_device *dev, - struct iw_request_info *info, struct iw_param *rrq, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - int err; - - if (!zd->ap) - return -EOPNOTSUPP; - - err = zd1201_setconfig16(zd, ZD1201_RID_CNFMAXASSOCSTATIONS, rrq->value); - if (err) - return err; - return 0; -} - -static int zd1201_get_maxassoc(struct net_device *dev, - struct iw_request_info *info, struct iw_param *rrq, char *extra) -{ - struct zd1201 *zd = netdev_priv(dev); - short maxassoc; - int err; - - if (!zd->ap) - return -EOPNOTSUPP; - - err = zd1201_getconfig16(zd, ZD1201_RID_CNFMAXASSOCSTATIONS, &maxassoc); - if (err) - return err; - rrq->value = maxassoc; - rrq->fixed = 1; - - return 0; -} - -static const iw_handler zd1201_private_handler[] = { - (iw_handler) zd1201_set_hostauth, /* ZD1201SIWHOSTAUTH */ - (iw_handler) zd1201_get_hostauth, /* ZD1201GIWHOSTAUTH */ - (iw_handler) zd1201_auth_sta, /* ZD1201SIWAUTHSTA */ - (iw_handler) NULL, /* nothing to get */ - (iw_handler) zd1201_set_maxassoc, /* ZD1201SIMAXASSOC */ - (iw_handler) zd1201_get_maxassoc, /* ZD1201GIMAXASSOC */ -}; - -static const struct iw_priv_args zd1201_private_args[] = { - { ZD1201SIWHOSTAUTH, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - IW_PRIV_TYPE_NONE, "sethostauth" }, - { ZD1201GIWHOSTAUTH, IW_PRIV_TYPE_NONE, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gethostauth" }, - { ZD1201SIWAUTHSTA, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, - IW_PRIV_TYPE_NONE, "authstation" }, - { ZD1201SIWMAXASSOC, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - IW_PRIV_TYPE_NONE, "setmaxassoc" }, - { ZD1201GIWMAXASSOC, IW_PRIV_TYPE_NONE, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getmaxassoc" }, -}; - -static const struct iw_handler_def zd1201_iw_handlers = { - .num_standard = ARRAY_SIZE(zd1201_iw_handler), - .num_private = ARRAY_SIZE(zd1201_private_handler), - .num_private_args = ARRAY_SIZE(zd1201_private_args), - .standard = (iw_handler *)zd1201_iw_handler, - .private = (iw_handler *)zd1201_private_handler, - .private_args = (struct iw_priv_args *) zd1201_private_args, - .get_wireless_stats = zd1201_get_wireless_stats, -}; - -static const struct net_device_ops zd1201_netdev_ops = { - .ndo_open = zd1201_net_open, - .ndo_stop = zd1201_net_stop, - .ndo_start_xmit = zd1201_hard_start_xmit, - .ndo_tx_timeout = zd1201_tx_timeout, - .ndo_set_rx_mode = zd1201_set_multicast, - .ndo_set_mac_address = zd1201_set_mac_address, - .ndo_change_mtu = eth_change_mtu, - .ndo_validate_addr = eth_validate_addr, -}; - -static int zd1201_probe(struct usb_interface *interface, - const struct usb_device_id *id) -{ - struct zd1201 *zd; - struct net_device *dev; - struct usb_device *usb; - int err; - short porttype; - char buf[IW_ESSID_MAX_SIZE+2]; - - usb = interface_to_usbdev(interface); - - dev = alloc_etherdev(sizeof(*zd)); - if (!dev) - return -ENOMEM; - zd = netdev_priv(dev); - zd->dev = dev; - - zd->ap = ap; - zd->usb = usb; - zd->removed = 0; - init_waitqueue_head(&zd->rxdataq); - INIT_HLIST_HEAD(&zd->fraglist); - - err = zd1201_fw_upload(usb, zd->ap); - if (err) { - dev_err(&usb->dev, "zd1201 firmware upload failed: %d\n", err); - goto err_zd; - } - - zd->endp_in = 1; - zd->endp_out = 1; - zd->endp_out2 = 2; - zd->rx_urb = usb_alloc_urb(0, GFP_KERNEL); - zd->tx_urb = usb_alloc_urb(0, GFP_KERNEL); - if (!zd->rx_urb || !zd->tx_urb) - goto err_zd; - - mdelay(100); - err = zd1201_drvr_start(zd); - if (err) - goto err_zd; - - err = zd1201_setconfig16(zd, ZD1201_RID_CNFMAXDATALEN, 2312); - if (err) - goto err_start; - - err = zd1201_setconfig16(zd, ZD1201_RID_TXRATECNTL, - ZD1201_RATEB1 | ZD1201_RATEB2 | ZD1201_RATEB5 | ZD1201_RATEB11); - if (err) - goto err_start; - - dev->netdev_ops = &zd1201_netdev_ops; - dev->wireless_handlers = &zd1201_iw_handlers; - dev->watchdog_timeo = ZD1201_TX_TIMEOUT; - strcpy(dev->name, "wlan%d"); - - err = zd1201_getconfig(zd, ZD1201_RID_CNFOWNMACADDR, - dev->dev_addr, dev->addr_len); - if (err) - goto err_start; - - /* Set wildcard essid to match zd->essid */ - *(__le16 *)buf = cpu_to_le16(0); - err = zd1201_setconfig(zd, ZD1201_RID_CNFDESIREDSSID, buf, - IW_ESSID_MAX_SIZE+2, 1); - if (err) - goto err_start; - - if (zd->ap) - porttype = ZD1201_PORTTYPE_AP; - else - porttype = ZD1201_PORTTYPE_BSS; - err = zd1201_setconfig16(zd, ZD1201_RID_CNFPORTTYPE, porttype); - if (err) - goto err_start; - - SET_NETDEV_DEV(dev, &usb->dev); - - err = register_netdev(dev); - if (err) - goto err_start; - dev_info(&usb->dev, "%s: ZD1201 USB Wireless interface\n", - dev->name); - - usb_set_intfdata(interface, zd); - zd1201_enable(zd); /* zd1201 likes to startup enabled, */ - zd1201_disable(zd); /* interfering with all the wifis in range */ - return 0; - -err_start: - /* Leave the device in reset state */ - zd1201_docmd(zd, ZD1201_CMDCODE_INIT, 0, 0, 0); -err_zd: - usb_free_urb(zd->tx_urb); - usb_free_urb(zd->rx_urb); - free_netdev(dev); - return err; -} - -static void zd1201_disconnect(struct usb_interface *interface) -{ - struct zd1201 *zd = usb_get_intfdata(interface); - struct hlist_node *node2; - struct zd1201_frag *frag; - - if (!zd) - return; - usb_set_intfdata(interface, NULL); - - hlist_for_each_entry_safe(frag, node2, &zd->fraglist, fnode) { - hlist_del_init(&frag->fnode); - kfree_skb(frag->skb); - kfree(frag); - } - - if (zd->tx_urb) { - usb_kill_urb(zd->tx_urb); - usb_free_urb(zd->tx_urb); - } - if (zd->rx_urb) { - usb_kill_urb(zd->rx_urb); - usb_free_urb(zd->rx_urb); - } - - if (zd->dev) { - unregister_netdev(zd->dev); - free_netdev(zd->dev); - } -} - -#ifdef CONFIG_PM - -static int zd1201_suspend(struct usb_interface *interface, - pm_message_t message) -{ - struct zd1201 *zd = usb_get_intfdata(interface); - - netif_device_detach(zd->dev); - - zd->was_enabled = zd->mac_enabled; - - if (zd->was_enabled) - return zd1201_disable(zd); - else - return 0; -} - -static int zd1201_resume(struct usb_interface *interface) -{ - struct zd1201 *zd = usb_get_intfdata(interface); - - if (!zd || !zd->dev) - return -ENODEV; - - netif_device_attach(zd->dev); - - if (zd->was_enabled) - return zd1201_enable(zd); - else - return 0; -} - -#else - -#define zd1201_suspend NULL -#define zd1201_resume NULL - -#endif - -static struct usb_driver zd1201_usb = { - .name = "zd1201", - .probe = zd1201_probe, - .disconnect = zd1201_disconnect, - .id_table = zd1201_table, - .suspend = zd1201_suspend, - .resume = zd1201_resume, - .disable_hub_initiated_lpm = 1, -}; - -module_usb_driver(zd1201_usb); diff --git a/drivers/net/wireless/zd1201.h b/drivers/net/wireless/zd1201.h deleted file mode 100644 index dd7ea1f35bef..000000000000 --- a/drivers/net/wireless/zd1201.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2004, 2005 Jeroen Vreeken (pe1rxq@amsat.org) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation. - * - * Parts of this driver have been derived from a wlan-ng version - * modified by ZyDAS. - * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. - */ - -#ifndef _INCLUDE_ZD1201_H_ -#define _INCLUDE_ZD1201_H_ - -#define ZD1201_NUMKEYS 4 -#define ZD1201_MAXKEYLEN 13 -#define ZD1201_MAXMULTI 16 -#define ZD1201_FRAGMAX 2500 -#define ZD1201_FRAGMIN 256 -#define ZD1201_RTSMAX 2500 - -#define ZD1201_RXSIZE 3000 - -struct zd1201 { - struct usb_device *usb; - int removed; - struct net_device *dev; - struct iw_statistics iwstats; - - int endp_in; - int endp_out; - int endp_out2; - struct urb *rx_urb; - struct urb *tx_urb; - - unsigned char rxdata[ZD1201_RXSIZE]; - int rxlen; - wait_queue_head_t rxdataq; - int rxdatas; - struct hlist_head fraglist; - unsigned char txdata[ZD1201_RXSIZE]; - - int ap; - char essid[IW_ESSID_MAX_SIZE+1]; - int essidlen; - int mac_enabled; - int was_enabled; - int monitor; - int encode_enabled; - int encode_restricted; - unsigned char encode_keys[ZD1201_NUMKEYS][ZD1201_MAXKEYLEN]; - int encode_keylen[ZD1201_NUMKEYS]; -}; - -struct zd1201_frag { - struct hlist_node fnode; - int seq; - struct sk_buff *skb; -}; - -#define ZD1201SIWHOSTAUTH SIOCIWFIRSTPRIV -#define ZD1201GIWHOSTAUTH ZD1201SIWHOSTAUTH+1 -#define ZD1201SIWAUTHSTA SIOCIWFIRSTPRIV+2 -#define ZD1201SIWMAXASSOC SIOCIWFIRSTPRIV+4 -#define ZD1201GIWMAXASSOC ZD1201SIWMAXASSOC+1 - -#define ZD1201_FW_TIMEOUT (1000) - -#define ZD1201_TX_TIMEOUT (2000) - -#define ZD1201_USB_CMDREQ 0 -#define ZD1201_USB_RESREQ 1 - -#define ZD1201_CMDCODE_INIT 0x00 -#define ZD1201_CMDCODE_ENABLE 0x01 -#define ZD1201_CMDCODE_DISABLE 0x02 -#define ZD1201_CMDCODE_ALLOC 0x0a -#define ZD1201_CMDCODE_INQUIRE 0x11 -#define ZD1201_CMDCODE_SETRXRID 0x17 -#define ZD1201_CMDCODE_ACCESS 0x21 - -#define ZD1201_PACKET_EVENTSTAT 0x0 -#define ZD1201_PACKET_RXDATA 0x1 -#define ZD1201_PACKET_INQUIRE 0x2 -#define ZD1201_PACKET_RESOURCE 0x3 - -#define ZD1201_ACCESSBIT 0x0100 - -#define ZD1201_RID_CNFPORTTYPE 0xfc00 -#define ZD1201_RID_CNFOWNMACADDR 0xfc01 -#define ZD1201_RID_CNFDESIREDSSID 0xfc02 -#define ZD1201_RID_CNFOWNCHANNEL 0xfc03 -#define ZD1201_RID_CNFOWNSSID 0xfc04 -#define ZD1201_RID_CNFMAXDATALEN 0xfc07 -#define ZD1201_RID_CNFPMENABLED 0xfc09 -#define ZD1201_RID_CNFPMEPS 0xfc0a -#define ZD1201_RID_CNFMAXSLEEPDURATION 0xfc0c -#define ZD1201_RID_CNFDEFAULTKEYID 0xfc23 -#define ZD1201_RID_CNFDEFAULTKEY0 0xfc24 -#define ZD1201_RID_CNFDEFAULTKEY1 0xfc25 -#define ZD1201_RID_CNFDEFAULTKEY2 0xfc26 -#define ZD1201_RID_CNFDEFAULTKEY3 0xfc27 -#define ZD1201_RID_CNFWEBFLAGS 0xfc28 -#define ZD1201_RID_CNFAUTHENTICATION 0xfc2a -#define ZD1201_RID_CNFMAXASSOCSTATIONS 0xfc2b -#define ZD1201_RID_CNFHOSTAUTH 0xfc2e -#define ZD1201_RID_CNFGROUPADDRESS 0xfc80 -#define ZD1201_RID_CNFFRAGTHRESHOLD 0xfc82 -#define ZD1201_RID_CNFRTSTHRESHOLD 0xfc83 -#define ZD1201_RID_TXRATECNTL 0xfc84 -#define ZD1201_RID_PROMISCUOUSMODE 0xfc85 -#define ZD1201_RID_CNFBASICRATES 0xfcb3 -#define ZD1201_RID_AUTHENTICATESTA 0xfce3 -#define ZD1201_RID_CURRENTBSSID 0xfd42 -#define ZD1201_RID_COMMSQUALITY 0xfd43 -#define ZD1201_RID_CURRENTTXRATE 0xfd44 -#define ZD1201_RID_CNFMAXTXBUFFERNUMBER 0xfda0 -#define ZD1201_RID_CURRENTCHANNEL 0xfdc1 - -#define ZD1201_INQ_SCANRESULTS 0xf101 - -#define ZD1201_INF_LINKSTATUS 0xf200 -#define ZD1201_INF_ASSOCSTATUS 0xf201 -#define ZD1201_INF_AUTHREQ 0xf202 - -#define ZD1201_ASSOCSTATUS_STAASSOC 0x1 -#define ZD1201_ASSOCSTATUS_REASSOC 0x2 -#define ZD1201_ASSOCSTATUS_DISASSOC 0x3 -#define ZD1201_ASSOCSTATUS_ASSOCFAIL 0x4 -#define ZD1201_ASSOCSTATUS_AUTHFAIL 0x5 - -#define ZD1201_PORTTYPE_IBSS 0 -#define ZD1201_PORTTYPE_BSS 1 -#define ZD1201_PORTTYPE_WDS 2 -#define ZD1201_PORTTYPE_PSEUDOIBSS 3 -#define ZD1201_PORTTYPE_AP 6 - -#define ZD1201_RATEB1 1 -#define ZD1201_RATEB2 2 -#define ZD1201_RATEB5 4 /* 5.5 really, but 5 is shorter :) */ -#define ZD1201_RATEB11 8 - -#define ZD1201_CNFAUTHENTICATION_OPENSYSTEM 0x0001 -#define ZD1201_CNFAUTHENTICATION_SHAREDKEY 0x0002 - -#endif /* _INCLUDE_ZD1201_H_ */ diff --git a/drivers/net/wireless/zd1211rw/Kconfig b/drivers/net/wireless/zd1211rw/Kconfig deleted file mode 100644 index 96c8e1de0879..000000000000 --- a/drivers/net/wireless/zd1211rw/Kconfig +++ /dev/null @@ -1,19 +0,0 @@ -config ZD1211RW - tristate "ZyDAS ZD1211/ZD1211B USB-wireless support" - depends on USB && MAC80211 - select FW_LOADER - ---help--- - This is an experimental driver for the ZyDAS ZD1211/ZD1211B wireless - chip, present in many USB-wireless adapters. - - Device firmware is required alongside this driver. You can download - the firmware distribution from http://zd1211.ath.cx/get-firmware - -config ZD1211RW_DEBUG - bool "ZyDAS ZD1211 debugging" - depends on ZD1211RW - ---help--- - ZD1211 debugging messages. Choosing Y will result in additional debug - messages being saved to your kernel logs, which may help debug any - problems. - diff --git a/drivers/net/wireless/zd1211rw/Makefile b/drivers/net/wireless/zd1211rw/Makefile deleted file mode 100644 index 5728a918e508..000000000000 --- a/drivers/net/wireless/zd1211rw/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -obj-$(CONFIG_ZD1211RW) += zd1211rw.o - -zd1211rw-objs := zd_chip.o zd_mac.o \ - zd_rf_al2230.o zd_rf_rf2959.o \ - zd_rf_al7230b.o zd_rf_uw2453.o \ - zd_rf.o zd_usb.o - -ccflags-$(CONFIG_ZD1211RW_DEBUG) := -DDEBUG - diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c deleted file mode 100644 index 71ab320fae82..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_chip.c +++ /dev/null @@ -1,1561 +0,0 @@ -/* ZD1211 USB-WLAN driver for Linux - * - * Copyright (C) 2005-2007 Ulrich Kunitz - * Copyright (C) 2006-2007 Daniel Drake - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* This file implements all the hardware specific functions for the ZD1211 - * and ZD1211B chips. Support for the ZD1211B was possible after Timothy - * Legge sent me a ZD1211B device. Thank you Tim. -- Uli - */ - -#include -#include -#include - -#include "zd_def.h" -#include "zd_chip.h" -#include "zd_mac.h" -#include "zd_rf.h" - -void zd_chip_init(struct zd_chip *chip, - struct ieee80211_hw *hw, - struct usb_interface *intf) -{ - memset(chip, 0, sizeof(*chip)); - mutex_init(&chip->mutex); - zd_usb_init(&chip->usb, hw, intf); - zd_rf_init(&chip->rf); -} - -void zd_chip_clear(struct zd_chip *chip) -{ - ZD_ASSERT(!mutex_is_locked(&chip->mutex)); - zd_usb_clear(&chip->usb); - zd_rf_clear(&chip->rf); - mutex_destroy(&chip->mutex); - ZD_MEMCLEAR(chip, sizeof(*chip)); -} - -static int scnprint_mac_oui(struct zd_chip *chip, char *buffer, size_t size) -{ - u8 *addr = zd_mac_get_perm_addr(zd_chip_to_mac(chip)); - return scnprintf(buffer, size, "%02x-%02x-%02x", - addr[0], addr[1], addr[2]); -} - -/* Prints an identifier line, which will support debugging. */ -static int scnprint_id(struct zd_chip *chip, char *buffer, size_t size) -{ - int i = 0; - - i = scnprintf(buffer, size, "zd1211%s chip ", - zd_chip_is_zd1211b(chip) ? "b" : ""); - i += zd_usb_scnprint_id(&chip->usb, buffer+i, size-i); - i += scnprintf(buffer+i, size-i, " "); - i += scnprint_mac_oui(chip, buffer+i, size-i); - i += scnprintf(buffer+i, size-i, " "); - i += zd_rf_scnprint_id(&chip->rf, buffer+i, size-i); - i += scnprintf(buffer+i, size-i, " pa%1x %c%c%c%c%c", chip->pa_type, - chip->patch_cck_gain ? 'g' : '-', - chip->patch_cr157 ? '7' : '-', - chip->patch_6m_band_edge ? '6' : '-', - chip->new_phy_layout ? 'N' : '-', - chip->al2230s_bit ? 'S' : '-'); - return i; -} - -static void print_id(struct zd_chip *chip) -{ - char buffer[80]; - - scnprint_id(chip, buffer, sizeof(buffer)); - buffer[sizeof(buffer)-1] = 0; - dev_info(zd_chip_dev(chip), "%s\n", buffer); -} - -static zd_addr_t inc_addr(zd_addr_t addr) -{ - u16 a = (u16)addr; - /* Control registers use byte addressing, but everything else uses word - * addressing. */ - if ((a & 0xf000) == CR_START) - a += 2; - else - a += 1; - return (zd_addr_t)a; -} - -/* Read a variable number of 32-bit values. Parameter count is not allowed to - * exceed USB_MAX_IOREAD32_COUNT. - */ -int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, const zd_addr_t *addr, - unsigned int count) -{ - int r; - int i; - zd_addr_t a16[USB_MAX_IOREAD32_COUNT * 2]; - u16 v16[USB_MAX_IOREAD32_COUNT * 2]; - unsigned int count16; - - if (count > USB_MAX_IOREAD32_COUNT) - return -EINVAL; - - /* Use stack for values and addresses. */ - count16 = 2 * count; - BUG_ON(count16 * sizeof(zd_addr_t) > sizeof(a16)); - BUG_ON(count16 * sizeof(u16) > sizeof(v16)); - - for (i = 0; i < count; i++) { - int j = 2*i; - /* We read the high word always first. */ - a16[j] = inc_addr(addr[i]); - a16[j+1] = addr[i]; - } - - r = zd_ioread16v_locked(chip, v16, a16, count16); - if (r) { - dev_dbg_f(zd_chip_dev(chip), - "error: zd_ioread16v_locked. Error number %d\n", r); - return r; - } - - for (i = 0; i < count; i++) { - int j = 2*i; - values[i] = (v16[j] << 16) | v16[j+1]; - } - - return 0; -} - -static int _zd_iowrite32v_async_locked(struct zd_chip *chip, - const struct zd_ioreq32 *ioreqs, - unsigned int count) -{ - int i, j, r; - struct zd_ioreq16 ioreqs16[USB_MAX_IOWRITE32_COUNT * 2]; - unsigned int count16; - - /* Use stack for values and addresses. */ - - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - - if (count == 0) - return 0; - if (count > USB_MAX_IOWRITE32_COUNT) - return -EINVAL; - - count16 = 2 * count; - BUG_ON(count16 * sizeof(struct zd_ioreq16) > sizeof(ioreqs16)); - - for (i = 0; i < count; i++) { - j = 2*i; - /* We write the high word always first. */ - ioreqs16[j].value = ioreqs[i].value >> 16; - ioreqs16[j].addr = inc_addr(ioreqs[i].addr); - ioreqs16[j+1].value = ioreqs[i].value; - ioreqs16[j+1].addr = ioreqs[i].addr; - } - - r = zd_usb_iowrite16v_async(&chip->usb, ioreqs16, count16); -#ifdef DEBUG - if (r) { - dev_dbg_f(zd_chip_dev(chip), - "error %d in zd_usb_write16v\n", r); - } -#endif /* DEBUG */ - return r; -} - -int _zd_iowrite32v_locked(struct zd_chip *chip, const struct zd_ioreq32 *ioreqs, - unsigned int count) -{ - int r; - - zd_usb_iowrite16v_async_start(&chip->usb); - r = _zd_iowrite32v_async_locked(chip, ioreqs, count); - if (r) { - zd_usb_iowrite16v_async_end(&chip->usb, 0); - return r; - } - return zd_usb_iowrite16v_async_end(&chip->usb, 50 /* ms */); -} - -int zd_iowrite16a_locked(struct zd_chip *chip, - const struct zd_ioreq16 *ioreqs, unsigned int count) -{ - int r; - unsigned int i, j, t, max; - - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - zd_usb_iowrite16v_async_start(&chip->usb); - - for (i = 0; i < count; i += j + t) { - t = 0; - max = count-i; - if (max > USB_MAX_IOWRITE16_COUNT) - max = USB_MAX_IOWRITE16_COUNT; - for (j = 0; j < max; j++) { - if (!ioreqs[i+j].addr) { - t = 1; - break; - } - } - - r = zd_usb_iowrite16v_async(&chip->usb, &ioreqs[i], j); - if (r) { - zd_usb_iowrite16v_async_end(&chip->usb, 0); - dev_dbg_f(zd_chip_dev(chip), - "error zd_usb_iowrite16v. Error number %d\n", - r); - return r; - } - } - - return zd_usb_iowrite16v_async_end(&chip->usb, 50 /* ms */); -} - -/* Writes a variable number of 32 bit registers. The functions will split - * that in several USB requests. A split can be forced by inserting an IO - * request with an zero address field. - */ -int zd_iowrite32a_locked(struct zd_chip *chip, - const struct zd_ioreq32 *ioreqs, unsigned int count) -{ - int r; - unsigned int i, j, t, max; - - zd_usb_iowrite16v_async_start(&chip->usb); - - for (i = 0; i < count; i += j + t) { - t = 0; - max = count-i; - if (max > USB_MAX_IOWRITE32_COUNT) - max = USB_MAX_IOWRITE32_COUNT; - for (j = 0; j < max; j++) { - if (!ioreqs[i+j].addr) { - t = 1; - break; - } - } - - r = _zd_iowrite32v_async_locked(chip, &ioreqs[i], j); - if (r) { - zd_usb_iowrite16v_async_end(&chip->usb, 0); - dev_dbg_f(zd_chip_dev(chip), - "error _zd_iowrite32v_locked." - " Error number %d\n", r); - return r; - } - } - - return zd_usb_iowrite16v_async_end(&chip->usb, 50 /* ms */); -} - -int zd_ioread16(struct zd_chip *chip, zd_addr_t addr, u16 *value) -{ - int r; - - mutex_lock(&chip->mutex); - r = zd_ioread16_locked(chip, value, addr); - mutex_unlock(&chip->mutex); - return r; -} - -int zd_ioread32(struct zd_chip *chip, zd_addr_t addr, u32 *value) -{ - int r; - - mutex_lock(&chip->mutex); - r = zd_ioread32_locked(chip, value, addr); - mutex_unlock(&chip->mutex); - return r; -} - -int zd_iowrite16(struct zd_chip *chip, zd_addr_t addr, u16 value) -{ - int r; - - mutex_lock(&chip->mutex); - r = zd_iowrite16_locked(chip, value, addr); - mutex_unlock(&chip->mutex); - return r; -} - -int zd_iowrite32(struct zd_chip *chip, zd_addr_t addr, u32 value) -{ - int r; - - mutex_lock(&chip->mutex); - r = zd_iowrite32_locked(chip, value, addr); - mutex_unlock(&chip->mutex); - return r; -} - -int zd_ioread32v(struct zd_chip *chip, const zd_addr_t *addresses, - u32 *values, unsigned int count) -{ - int r; - - mutex_lock(&chip->mutex); - r = zd_ioread32v_locked(chip, values, addresses, count); - mutex_unlock(&chip->mutex); - return r; -} - -int zd_iowrite32a(struct zd_chip *chip, const struct zd_ioreq32 *ioreqs, - unsigned int count) -{ - int r; - - mutex_lock(&chip->mutex); - r = zd_iowrite32a_locked(chip, ioreqs, count); - mutex_unlock(&chip->mutex); - return r; -} - -static int read_pod(struct zd_chip *chip, u8 *rf_type) -{ - int r; - u32 value; - - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - r = zd_ioread32_locked(chip, &value, E2P_POD); - if (r) - goto error; - dev_dbg_f(zd_chip_dev(chip), "E2P_POD %#010x\n", value); - - /* FIXME: AL2230 handling (Bit 7 in POD) */ - *rf_type = value & 0x0f; - chip->pa_type = (value >> 16) & 0x0f; - chip->patch_cck_gain = (value >> 8) & 0x1; - chip->patch_cr157 = (value >> 13) & 0x1; - chip->patch_6m_band_edge = (value >> 21) & 0x1; - chip->new_phy_layout = (value >> 31) & 0x1; - chip->al2230s_bit = (value >> 7) & 0x1; - chip->link_led = ((value >> 4) & 1) ? LED1 : LED2; - chip->supports_tx_led = 1; - if (value & (1 << 24)) { /* LED scenario */ - if (value & (1 << 29)) - chip->supports_tx_led = 0; - } - - dev_dbg_f(zd_chip_dev(chip), - "RF %s %#01x PA type %#01x patch CCK %d patch CR157 %d " - "patch 6M %d new PHY %d link LED%d tx led %d\n", - zd_rf_name(*rf_type), *rf_type, - chip->pa_type, chip->patch_cck_gain, - chip->patch_cr157, chip->patch_6m_band_edge, - chip->new_phy_layout, - chip->link_led == LED1 ? 1 : 2, - chip->supports_tx_led); - return 0; -error: - *rf_type = 0; - chip->pa_type = 0; - chip->patch_cck_gain = 0; - chip->patch_cr157 = 0; - chip->patch_6m_band_edge = 0; - chip->new_phy_layout = 0; - return r; -} - -static int zd_write_mac_addr_common(struct zd_chip *chip, const u8 *mac_addr, - const struct zd_ioreq32 *in_reqs, - const char *type) -{ - int r; - struct zd_ioreq32 reqs[2] = {in_reqs[0], in_reqs[1]}; - - if (mac_addr) { - reqs[0].value = (mac_addr[3] << 24) - | (mac_addr[2] << 16) - | (mac_addr[1] << 8) - | mac_addr[0]; - reqs[1].value = (mac_addr[5] << 8) - | mac_addr[4]; - dev_dbg_f(zd_chip_dev(chip), "%s addr %pM\n", type, mac_addr); - } else { - dev_dbg_f(zd_chip_dev(chip), "set NULL %s\n", type); - } - - mutex_lock(&chip->mutex); - r = zd_iowrite32a_locked(chip, reqs, ARRAY_SIZE(reqs)); - mutex_unlock(&chip->mutex); - return r; -} - -/* MAC address: if custom mac addresses are to be used CR_MAC_ADDR_P1 and - * CR_MAC_ADDR_P2 must be overwritten - */ -int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr) -{ - static const struct zd_ioreq32 reqs[2] = { - [0] = { .addr = CR_MAC_ADDR_P1 }, - [1] = { .addr = CR_MAC_ADDR_P2 }, - }; - - return zd_write_mac_addr_common(chip, mac_addr, reqs, "mac"); -} - -int zd_write_bssid(struct zd_chip *chip, const u8 *bssid) -{ - static const struct zd_ioreq32 reqs[2] = { - [0] = { .addr = CR_BSSID_P1 }, - [1] = { .addr = CR_BSSID_P2 }, - }; - - return zd_write_mac_addr_common(chip, bssid, reqs, "bssid"); -} - -int zd_read_regdomain(struct zd_chip *chip, u8 *regdomain) -{ - int r; - u32 value; - - mutex_lock(&chip->mutex); - r = zd_ioread32_locked(chip, &value, E2P_SUBID); - mutex_unlock(&chip->mutex); - if (r) - return r; - - *regdomain = value >> 16; - dev_dbg_f(zd_chip_dev(chip), "regdomain: %#04x\n", *regdomain); - - return 0; -} - -static int read_values(struct zd_chip *chip, u8 *values, size_t count, - zd_addr_t e2p_addr, u32 guard) -{ - int r; - int i; - u32 v; - - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - for (i = 0;;) { - r = zd_ioread32_locked(chip, &v, - (zd_addr_t)((u16)e2p_addr+i/2)); - if (r) - return r; - v -= guard; - if (i+4 < count) { - values[i++] = v; - values[i++] = v >> 8; - values[i++] = v >> 16; - values[i++] = v >> 24; - continue; - } - for (;i < count; i++) - values[i] = v >> (8*(i%3)); - return 0; - } -} - -static int read_pwr_cal_values(struct zd_chip *chip) -{ - return read_values(chip, chip->pwr_cal_values, - E2P_CHANNEL_COUNT, E2P_PWR_CAL_VALUE1, - 0); -} - -static int read_pwr_int_values(struct zd_chip *chip) -{ - return read_values(chip, chip->pwr_int_values, - E2P_CHANNEL_COUNT, E2P_PWR_INT_VALUE1, - E2P_PWR_INT_GUARD); -} - -static int read_ofdm_cal_values(struct zd_chip *chip) -{ - int r; - int i; - static const zd_addr_t addresses[] = { - E2P_36M_CAL_VALUE1, - E2P_48M_CAL_VALUE1, - E2P_54M_CAL_VALUE1, - }; - - for (i = 0; i < 3; i++) { - r = read_values(chip, chip->ofdm_cal_values[i], - E2P_CHANNEL_COUNT, addresses[i], 0); - if (r) - return r; - } - return 0; -} - -static int read_cal_int_tables(struct zd_chip *chip) -{ - int r; - - r = read_pwr_cal_values(chip); - if (r) - return r; - r = read_pwr_int_values(chip); - if (r) - return r; - r = read_ofdm_cal_values(chip); - if (r) - return r; - return 0; -} - -/* phy means physical registers */ -int zd_chip_lock_phy_regs(struct zd_chip *chip) -{ - int r; - u32 tmp; - - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - r = zd_ioread32_locked(chip, &tmp, CR_REG1); - if (r) { - dev_err(zd_chip_dev(chip), "error ioread32(CR_REG1): %d\n", r); - return r; - } - - tmp &= ~UNLOCK_PHY_REGS; - - r = zd_iowrite32_locked(chip, tmp, CR_REG1); - if (r) - dev_err(zd_chip_dev(chip), "error iowrite32(CR_REG1): %d\n", r); - return r; -} - -int zd_chip_unlock_phy_regs(struct zd_chip *chip) -{ - int r; - u32 tmp; - - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - r = zd_ioread32_locked(chip, &tmp, CR_REG1); - if (r) { - dev_err(zd_chip_dev(chip), - "error ioread32(CR_REG1): %d\n", r); - return r; - } - - tmp |= UNLOCK_PHY_REGS; - - r = zd_iowrite32_locked(chip, tmp, CR_REG1); - if (r) - dev_err(zd_chip_dev(chip), "error iowrite32(CR_REG1): %d\n", r); - return r; -} - -/* ZD_CR157 can be optionally patched by the EEPROM for original ZD1211 */ -static int patch_cr157(struct zd_chip *chip) -{ - int r; - u16 value; - - if (!chip->patch_cr157) - return 0; - - r = zd_ioread16_locked(chip, &value, E2P_PHY_REG); - if (r) - return r; - - dev_dbg_f(zd_chip_dev(chip), "patching value %x\n", value >> 8); - return zd_iowrite32_locked(chip, value >> 8, ZD_CR157); -} - -/* - * 6M band edge can be optionally overwritten for certain RF's - * Vendor driver says: for FCC regulation, enabled per HWFeature 6M band edge - * bit (for AL2230, AL2230S) - */ -static int patch_6m_band_edge(struct zd_chip *chip, u8 channel) -{ - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - if (!chip->patch_6m_band_edge) - return 0; - - return zd_rf_patch_6m_band_edge(&chip->rf, channel); -} - -/* Generic implementation of 6M band edge patching, used by most RFs via - * zd_rf_generic_patch_6m() */ -int zd_chip_generic_patch_6m_band(struct zd_chip *chip, int channel) -{ - struct zd_ioreq16 ioreqs[] = { - { ZD_CR128, 0x14 }, { ZD_CR129, 0x12 }, { ZD_CR130, 0x10 }, - { ZD_CR47, 0x1e }, - }; - - /* FIXME: Channel 11 is not the edge for all regulatory domains. */ - if (channel == 1 || channel == 11) - ioreqs[0].value = 0x12; - - dev_dbg_f(zd_chip_dev(chip), "patching for channel %d\n", channel); - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -static int zd1211_hw_reset_phy(struct zd_chip *chip) -{ - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR0, 0x0a }, { ZD_CR1, 0x06 }, { ZD_CR2, 0x26 }, - { ZD_CR3, 0x38 }, { ZD_CR4, 0x80 }, { ZD_CR9, 0xa0 }, - { ZD_CR10, 0x81 }, { ZD_CR11, 0x00 }, { ZD_CR12, 0x7f }, - { ZD_CR13, 0x8c }, { ZD_CR14, 0x80 }, { ZD_CR15, 0x3d }, - { ZD_CR16, 0x20 }, { ZD_CR17, 0x1e }, { ZD_CR18, 0x0a }, - { ZD_CR19, 0x48 }, { ZD_CR20, 0x0c }, { ZD_CR21, 0x0c }, - { ZD_CR22, 0x23 }, { ZD_CR23, 0x90 }, { ZD_CR24, 0x14 }, - { ZD_CR25, 0x40 }, { ZD_CR26, 0x10 }, { ZD_CR27, 0x19 }, - { ZD_CR28, 0x7f }, { ZD_CR29, 0x80 }, { ZD_CR30, 0x4b }, - { ZD_CR31, 0x60 }, { ZD_CR32, 0x43 }, { ZD_CR33, 0x08 }, - { ZD_CR34, 0x06 }, { ZD_CR35, 0x0a }, { ZD_CR36, 0x00 }, - { ZD_CR37, 0x00 }, { ZD_CR38, 0x38 }, { ZD_CR39, 0x0c }, - { ZD_CR40, 0x84 }, { ZD_CR41, 0x2a }, { ZD_CR42, 0x80 }, - { ZD_CR43, 0x10 }, { ZD_CR44, 0x12 }, { ZD_CR46, 0xff }, - { ZD_CR47, 0x1E }, { ZD_CR48, 0x26 }, { ZD_CR49, 0x5b }, - { ZD_CR64, 0xd0 }, { ZD_CR65, 0x04 }, { ZD_CR66, 0x58 }, - { ZD_CR67, 0xc9 }, { ZD_CR68, 0x88 }, { ZD_CR69, 0x41 }, - { ZD_CR70, 0x23 }, { ZD_CR71, 0x10 }, { ZD_CR72, 0xff }, - { ZD_CR73, 0x32 }, { ZD_CR74, 0x30 }, { ZD_CR75, 0x65 }, - { ZD_CR76, 0x41 }, { ZD_CR77, 0x1b }, { ZD_CR78, 0x30 }, - { ZD_CR79, 0x68 }, { ZD_CR80, 0x64 }, { ZD_CR81, 0x64 }, - { ZD_CR82, 0x00 }, { ZD_CR83, 0x00 }, { ZD_CR84, 0x00 }, - { ZD_CR85, 0x02 }, { ZD_CR86, 0x00 }, { ZD_CR87, 0x00 }, - { ZD_CR88, 0xff }, { ZD_CR89, 0xfc }, { ZD_CR90, 0x00 }, - { ZD_CR91, 0x00 }, { ZD_CR92, 0x00 }, { ZD_CR93, 0x08 }, - { ZD_CR94, 0x00 }, { ZD_CR95, 0x00 }, { ZD_CR96, 0xff }, - { ZD_CR97, 0xe7 }, { ZD_CR98, 0x00 }, { ZD_CR99, 0x00 }, - { ZD_CR100, 0x00 }, { ZD_CR101, 0xae }, { ZD_CR102, 0x02 }, - { ZD_CR103, 0x00 }, { ZD_CR104, 0x03 }, { ZD_CR105, 0x65 }, - { ZD_CR106, 0x04 }, { ZD_CR107, 0x00 }, { ZD_CR108, 0x0a }, - { ZD_CR109, 0xaa }, { ZD_CR110, 0xaa }, { ZD_CR111, 0x25 }, - { ZD_CR112, 0x25 }, { ZD_CR113, 0x00 }, { ZD_CR119, 0x1e }, - { ZD_CR125, 0x90 }, { ZD_CR126, 0x00 }, { ZD_CR127, 0x00 }, - { }, - { ZD_CR5, 0x00 }, { ZD_CR6, 0x00 }, { ZD_CR7, 0x00 }, - { ZD_CR8, 0x00 }, { ZD_CR9, 0x20 }, { ZD_CR12, 0xf0 }, - { ZD_CR20, 0x0e }, { ZD_CR21, 0x0e }, { ZD_CR27, 0x10 }, - { ZD_CR44, 0x33 }, { ZD_CR47, 0x1E }, { ZD_CR83, 0x24 }, - { ZD_CR84, 0x04 }, { ZD_CR85, 0x00 }, { ZD_CR86, 0x0C }, - { ZD_CR87, 0x12 }, { ZD_CR88, 0x0C }, { ZD_CR89, 0x00 }, - { ZD_CR90, 0x10 }, { ZD_CR91, 0x08 }, { ZD_CR93, 0x00 }, - { ZD_CR94, 0x01 }, { ZD_CR95, 0x00 }, { ZD_CR96, 0x50 }, - { ZD_CR97, 0x37 }, { ZD_CR98, 0x35 }, { ZD_CR101, 0x13 }, - { ZD_CR102, 0x27 }, { ZD_CR103, 0x27 }, { ZD_CR104, 0x18 }, - { ZD_CR105, 0x12 }, { ZD_CR109, 0x27 }, { ZD_CR110, 0x27 }, - { ZD_CR111, 0x27 }, { ZD_CR112, 0x27 }, { ZD_CR113, 0x27 }, - { ZD_CR114, 0x27 }, { ZD_CR115, 0x26 }, { ZD_CR116, 0x24 }, - { ZD_CR117, 0xfc }, { ZD_CR118, 0xfa }, { ZD_CR120, 0x4f }, - { ZD_CR125, 0xaa }, { ZD_CR127, 0x03 }, { ZD_CR128, 0x14 }, - { ZD_CR129, 0x12 }, { ZD_CR130, 0x10 }, { ZD_CR131, 0x0C }, - { ZD_CR136, 0xdf }, { ZD_CR137, 0x40 }, { ZD_CR138, 0xa0 }, - { ZD_CR139, 0xb0 }, { ZD_CR140, 0x99 }, { ZD_CR141, 0x82 }, - { ZD_CR142, 0x54 }, { ZD_CR143, 0x1c }, { ZD_CR144, 0x6c }, - { ZD_CR147, 0x07 }, { ZD_CR148, 0x4c }, { ZD_CR149, 0x50 }, - { ZD_CR150, 0x0e }, { ZD_CR151, 0x18 }, { ZD_CR160, 0xfe }, - { ZD_CR161, 0xee }, { ZD_CR162, 0xaa }, { ZD_CR163, 0xfa }, - { ZD_CR164, 0xfa }, { ZD_CR165, 0xea }, { ZD_CR166, 0xbe }, - { ZD_CR167, 0xbe }, { ZD_CR168, 0x6a }, { ZD_CR169, 0xba }, - { ZD_CR170, 0xba }, { ZD_CR171, 0xba }, - /* Note: ZD_CR204 must lead the ZD_CR203 */ - { ZD_CR204, 0x7d }, - { }, - { ZD_CR203, 0x30 }, - }; - - int r, t; - - dev_dbg_f(zd_chip_dev(chip), "\n"); - - r = zd_chip_lock_phy_regs(chip); - if (r) - goto out; - - r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); - if (r) - goto unlock; - - r = patch_cr157(chip); -unlock: - t = zd_chip_unlock_phy_regs(chip); - if (t && !r) - r = t; -out: - return r; -} - -static int zd1211b_hw_reset_phy(struct zd_chip *chip) -{ - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR0, 0x14 }, { ZD_CR1, 0x06 }, { ZD_CR2, 0x26 }, - { ZD_CR3, 0x38 }, { ZD_CR4, 0x80 }, { ZD_CR9, 0xe0 }, - { ZD_CR10, 0x81 }, - /* power control { { ZD_CR11, 1 << 6 }, */ - { ZD_CR11, 0x00 }, - { ZD_CR12, 0xf0 }, { ZD_CR13, 0x8c }, { ZD_CR14, 0x80 }, - { ZD_CR15, 0x3d }, { ZD_CR16, 0x20 }, { ZD_CR17, 0x1e }, - { ZD_CR18, 0x0a }, { ZD_CR19, 0x48 }, - { ZD_CR20, 0x10 }, /* Org:0x0E, ComTrend:RalLink AP */ - { ZD_CR21, 0x0e }, { ZD_CR22, 0x23 }, { ZD_CR23, 0x90 }, - { ZD_CR24, 0x14 }, { ZD_CR25, 0x40 }, { ZD_CR26, 0x10 }, - { ZD_CR27, 0x10 }, { ZD_CR28, 0x7f }, { ZD_CR29, 0x80 }, - { ZD_CR30, 0x4b }, /* ASIC/FWT, no jointly decoder */ - { ZD_CR31, 0x60 }, { ZD_CR32, 0x43 }, { ZD_CR33, 0x08 }, - { ZD_CR34, 0x06 }, { ZD_CR35, 0x0a }, { ZD_CR36, 0x00 }, - { ZD_CR37, 0x00 }, { ZD_CR38, 0x38 }, { ZD_CR39, 0x0c }, - { ZD_CR40, 0x84 }, { ZD_CR41, 0x2a }, { ZD_CR42, 0x80 }, - { ZD_CR43, 0x10 }, { ZD_CR44, 0x33 }, { ZD_CR46, 0xff }, - { ZD_CR47, 0x1E }, { ZD_CR48, 0x26 }, { ZD_CR49, 0x5b }, - { ZD_CR64, 0xd0 }, { ZD_CR65, 0x04 }, { ZD_CR66, 0x58 }, - { ZD_CR67, 0xc9 }, { ZD_CR68, 0x88 }, { ZD_CR69, 0x41 }, - { ZD_CR70, 0x23 }, { ZD_CR71, 0x10 }, { ZD_CR72, 0xff }, - { ZD_CR73, 0x32 }, { ZD_CR74, 0x30 }, { ZD_CR75, 0x65 }, - { ZD_CR76, 0x41 }, { ZD_CR77, 0x1b }, { ZD_CR78, 0x30 }, - { ZD_CR79, 0xf0 }, { ZD_CR80, 0x64 }, { ZD_CR81, 0x64 }, - { ZD_CR82, 0x00 }, { ZD_CR83, 0x24 }, { ZD_CR84, 0x04 }, - { ZD_CR85, 0x00 }, { ZD_CR86, 0x0c }, { ZD_CR87, 0x12 }, - { ZD_CR88, 0x0c }, { ZD_CR89, 0x00 }, { ZD_CR90, 0x58 }, - { ZD_CR91, 0x04 }, { ZD_CR92, 0x00 }, { ZD_CR93, 0x00 }, - { ZD_CR94, 0x01 }, - { ZD_CR95, 0x20 }, /* ZD1211B */ - { ZD_CR96, 0x50 }, { ZD_CR97, 0x37 }, { ZD_CR98, 0x35 }, - { ZD_CR99, 0x00 }, { ZD_CR100, 0x01 }, { ZD_CR101, 0x13 }, - { ZD_CR102, 0x27 }, { ZD_CR103, 0x27 }, { ZD_CR104, 0x18 }, - { ZD_CR105, 0x12 }, { ZD_CR106, 0x04 }, { ZD_CR107, 0x00 }, - { ZD_CR108, 0x0a }, { ZD_CR109, 0x27 }, { ZD_CR110, 0x27 }, - { ZD_CR111, 0x27 }, { ZD_CR112, 0x27 }, { ZD_CR113, 0x27 }, - { ZD_CR114, 0x27 }, { ZD_CR115, 0x26 }, { ZD_CR116, 0x24 }, - { ZD_CR117, 0xfc }, { ZD_CR118, 0xfa }, { ZD_CR119, 0x1e }, - { ZD_CR125, 0x90 }, { ZD_CR126, 0x00 }, { ZD_CR127, 0x00 }, - { ZD_CR128, 0x14 }, { ZD_CR129, 0x12 }, { ZD_CR130, 0x10 }, - { ZD_CR131, 0x0c }, { ZD_CR136, 0xdf }, { ZD_CR137, 0xa0 }, - { ZD_CR138, 0xa8 }, { ZD_CR139, 0xb4 }, { ZD_CR140, 0x98 }, - { ZD_CR141, 0x82 }, { ZD_CR142, 0x53 }, { ZD_CR143, 0x1c }, - { ZD_CR144, 0x6c }, { ZD_CR147, 0x07 }, { ZD_CR148, 0x40 }, - { ZD_CR149, 0x40 }, /* Org:0x50 ComTrend:RalLink AP */ - { ZD_CR150, 0x14 }, /* Org:0x0E ComTrend:RalLink AP */ - { ZD_CR151, 0x18 }, { ZD_CR159, 0x70 }, { ZD_CR160, 0xfe }, - { ZD_CR161, 0xee }, { ZD_CR162, 0xaa }, { ZD_CR163, 0xfa }, - { ZD_CR164, 0xfa }, { ZD_CR165, 0xea }, { ZD_CR166, 0xbe }, - { ZD_CR167, 0xbe }, { ZD_CR168, 0x6a }, { ZD_CR169, 0xba }, - { ZD_CR170, 0xba }, { ZD_CR171, 0xba }, - /* Note: ZD_CR204 must lead the ZD_CR203 */ - { ZD_CR204, 0x7d }, - {}, - { ZD_CR203, 0x30 }, - }; - - int r, t; - - dev_dbg_f(zd_chip_dev(chip), "\n"); - - r = zd_chip_lock_phy_regs(chip); - if (r) - goto out; - - r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); - t = zd_chip_unlock_phy_regs(chip); - if (t && !r) - r = t; -out: - return r; -} - -static int hw_reset_phy(struct zd_chip *chip) -{ - return zd_chip_is_zd1211b(chip) ? zd1211b_hw_reset_phy(chip) : - zd1211_hw_reset_phy(chip); -} - -static int zd1211_hw_init_hmac(struct zd_chip *chip) -{ - static const struct zd_ioreq32 ioreqs[] = { - { CR_ZD1211_RETRY_MAX, ZD1211_RETRY_COUNT }, - { CR_RX_THRESHOLD, 0x000c0640 }, - }; - - dev_dbg_f(zd_chip_dev(chip), "\n"); - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - return zd_iowrite32a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -static int zd1211b_hw_init_hmac(struct zd_chip *chip) -{ - static const struct zd_ioreq32 ioreqs[] = { - { CR_ZD1211B_RETRY_MAX, ZD1211B_RETRY_COUNT }, - { CR_ZD1211B_CWIN_MAX_MIN_AC0, 0x007f003f }, - { CR_ZD1211B_CWIN_MAX_MIN_AC1, 0x007f003f }, - { CR_ZD1211B_CWIN_MAX_MIN_AC2, 0x003f001f }, - { CR_ZD1211B_CWIN_MAX_MIN_AC3, 0x001f000f }, - { CR_ZD1211B_AIFS_CTL1, 0x00280028 }, - { CR_ZD1211B_AIFS_CTL2, 0x008C003C }, - { CR_ZD1211B_TXOP, 0x01800824 }, - { CR_RX_THRESHOLD, 0x000c0eff, }, - }; - - dev_dbg_f(zd_chip_dev(chip), "\n"); - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - return zd_iowrite32a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -static int hw_init_hmac(struct zd_chip *chip) -{ - int r; - static const struct zd_ioreq32 ioreqs[] = { - { CR_ACK_TIMEOUT_EXT, 0x20 }, - { CR_ADDA_MBIAS_WARMTIME, 0x30000808 }, - { CR_SNIFFER_ON, 0 }, - { CR_RX_FILTER, STA_RX_FILTER }, - { CR_GROUP_HASH_P1, 0x00 }, - { CR_GROUP_HASH_P2, 0x80000000 }, - { CR_REG1, 0xa4 }, - { CR_ADDA_PWR_DWN, 0x7f }, - { CR_BCN_PLCP_CFG, 0x00f00401 }, - { CR_PHY_DELAY, 0x00 }, - { CR_ACK_TIMEOUT_EXT, 0x80 }, - { CR_ADDA_PWR_DWN, 0x00 }, - { CR_ACK_TIME_80211, 0x100 }, - { CR_RX_PE_DELAY, 0x70 }, - { CR_PS_CTRL, 0x10000000 }, - { CR_RTS_CTS_RATE, 0x02030203 }, - { CR_AFTER_PNP, 0x1 }, - { CR_WEP_PROTECT, 0x114 }, - { CR_IFS_VALUE, IFS_VALUE_DEFAULT }, - { CR_CAM_MODE, MODE_AP_WDS}, - }; - - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - r = zd_iowrite32a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); - if (r) - return r; - - return zd_chip_is_zd1211b(chip) ? - zd1211b_hw_init_hmac(chip) : zd1211_hw_init_hmac(chip); -} - -struct aw_pt_bi { - u32 atim_wnd_period; - u32 pre_tbtt; - u32 beacon_interval; -}; - -static int get_aw_pt_bi(struct zd_chip *chip, struct aw_pt_bi *s) -{ - int r; - static const zd_addr_t aw_pt_bi_addr[] = - { CR_ATIM_WND_PERIOD, CR_PRE_TBTT, CR_BCN_INTERVAL }; - u32 values[3]; - - r = zd_ioread32v_locked(chip, values, (const zd_addr_t *)aw_pt_bi_addr, - ARRAY_SIZE(aw_pt_bi_addr)); - if (r) { - memset(s, 0, sizeof(*s)); - return r; - } - - s->atim_wnd_period = values[0]; - s->pre_tbtt = values[1]; - s->beacon_interval = values[2]; - return 0; -} - -static int set_aw_pt_bi(struct zd_chip *chip, struct aw_pt_bi *s) -{ - struct zd_ioreq32 reqs[3]; - u16 b_interval = s->beacon_interval & 0xffff; - - if (b_interval <= 5) - b_interval = 5; - if (s->pre_tbtt < 4 || s->pre_tbtt >= b_interval) - s->pre_tbtt = b_interval - 1; - if (s->atim_wnd_period >= s->pre_tbtt) - s->atim_wnd_period = s->pre_tbtt - 1; - - reqs[0].addr = CR_ATIM_WND_PERIOD; - reqs[0].value = s->atim_wnd_period; - reqs[1].addr = CR_PRE_TBTT; - reqs[1].value = s->pre_tbtt; - reqs[2].addr = CR_BCN_INTERVAL; - reqs[2].value = (s->beacon_interval & ~0xffff) | b_interval; - - return zd_iowrite32a_locked(chip, reqs, ARRAY_SIZE(reqs)); -} - - -static int set_beacon_interval(struct zd_chip *chip, u16 interval, - u8 dtim_period, int type) -{ - int r; - struct aw_pt_bi s; - u32 b_interval, mode_flag; - - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - - if (interval > 0) { - switch (type) { - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_MESH_POINT: - mode_flag = BCN_MODE_IBSS; - break; - case NL80211_IFTYPE_AP: - mode_flag = BCN_MODE_AP; - break; - default: - mode_flag = 0; - break; - } - } else { - dtim_period = 0; - mode_flag = 0; - } - - b_interval = mode_flag | (dtim_period << 16) | interval; - - r = zd_iowrite32_locked(chip, b_interval, CR_BCN_INTERVAL); - if (r) - return r; - r = get_aw_pt_bi(chip, &s); - if (r) - return r; - return set_aw_pt_bi(chip, &s); -} - -int zd_set_beacon_interval(struct zd_chip *chip, u16 interval, u8 dtim_period, - int type) -{ - int r; - - mutex_lock(&chip->mutex); - r = set_beacon_interval(chip, interval, dtim_period, type); - mutex_unlock(&chip->mutex); - return r; -} - -static int hw_init(struct zd_chip *chip) -{ - int r; - - dev_dbg_f(zd_chip_dev(chip), "\n"); - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - r = hw_reset_phy(chip); - if (r) - return r; - - r = hw_init_hmac(chip); - if (r) - return r; - - return set_beacon_interval(chip, 100, 0, NL80211_IFTYPE_UNSPECIFIED); -} - -static zd_addr_t fw_reg_addr(struct zd_chip *chip, u16 offset) -{ - return (zd_addr_t)((u16)chip->fw_regs_base + offset); -} - -#ifdef DEBUG -static int dump_cr(struct zd_chip *chip, const zd_addr_t addr, - const char *addr_string) -{ - int r; - u32 value; - - r = zd_ioread32_locked(chip, &value, addr); - if (r) { - dev_dbg_f(zd_chip_dev(chip), - "error reading %s. Error number %d\n", addr_string, r); - return r; - } - - dev_dbg_f(zd_chip_dev(chip), "%s %#010x\n", - addr_string, (unsigned int)value); - return 0; -} - -static int test_init(struct zd_chip *chip) -{ - int r; - - r = dump_cr(chip, CR_AFTER_PNP, "CR_AFTER_PNP"); - if (r) - return r; - r = dump_cr(chip, CR_GPI_EN, "CR_GPI_EN"); - if (r) - return r; - return dump_cr(chip, CR_INTERRUPT, "CR_INTERRUPT"); -} - -static void dump_fw_registers(struct zd_chip *chip) -{ - const zd_addr_t addr[4] = { - fw_reg_addr(chip, FW_REG_FIRMWARE_VER), - fw_reg_addr(chip, FW_REG_USB_SPEED), - fw_reg_addr(chip, FW_REG_FIX_TX_RATE), - fw_reg_addr(chip, FW_REG_LED_LINK_STATUS), - }; - - int r; - u16 values[4]; - - r = zd_ioread16v_locked(chip, values, (const zd_addr_t*)addr, - ARRAY_SIZE(addr)); - if (r) { - dev_dbg_f(zd_chip_dev(chip), "error %d zd_ioread16v_locked\n", - r); - return; - } - - dev_dbg_f(zd_chip_dev(chip), "FW_FIRMWARE_VER %#06hx\n", values[0]); - dev_dbg_f(zd_chip_dev(chip), "FW_USB_SPEED %#06hx\n", values[1]); - dev_dbg_f(zd_chip_dev(chip), "FW_FIX_TX_RATE %#06hx\n", values[2]); - dev_dbg_f(zd_chip_dev(chip), "FW_LINK_STATUS %#06hx\n", values[3]); -} -#endif /* DEBUG */ - -static int print_fw_version(struct zd_chip *chip) -{ - struct wiphy *wiphy = zd_chip_to_mac(chip)->hw->wiphy; - int r; - u16 version; - - r = zd_ioread16_locked(chip, &version, - fw_reg_addr(chip, FW_REG_FIRMWARE_VER)); - if (r) - return r; - - dev_info(zd_chip_dev(chip),"firmware version %04hx\n", version); - - snprintf(wiphy->fw_version, sizeof(wiphy->fw_version), - "%04hx", version); - - return 0; -} - -static int set_mandatory_rates(struct zd_chip *chip, int gmode) -{ - u32 rates; - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - /* This sets the mandatory rates, which only depend from the standard - * that the device is supporting. Until further notice we should try - * to support 802.11g also for full speed USB. - */ - if (!gmode) - rates = CR_RATE_1M|CR_RATE_2M|CR_RATE_5_5M|CR_RATE_11M; - else - rates = CR_RATE_1M|CR_RATE_2M|CR_RATE_5_5M|CR_RATE_11M| - CR_RATE_6M|CR_RATE_12M|CR_RATE_24M; - - return zd_iowrite32_locked(chip, rates, CR_MANDATORY_RATE_TBL); -} - -int zd_chip_set_rts_cts_rate_locked(struct zd_chip *chip, - int preamble) -{ - u32 value = 0; - - dev_dbg_f(zd_chip_dev(chip), "preamble=%x\n", preamble); - value |= preamble << RTSCTS_SH_RTS_PMB_TYPE; - value |= preamble << RTSCTS_SH_CTS_PMB_TYPE; - - /* We always send 11M RTS/self-CTS messages, like the vendor driver. */ - value |= ZD_PURE_RATE(ZD_CCK_RATE_11M) << RTSCTS_SH_RTS_RATE; - value |= ZD_RX_CCK << RTSCTS_SH_RTS_MOD_TYPE; - value |= ZD_PURE_RATE(ZD_CCK_RATE_11M) << RTSCTS_SH_CTS_RATE; - value |= ZD_RX_CCK << RTSCTS_SH_CTS_MOD_TYPE; - - return zd_iowrite32_locked(chip, value, CR_RTS_CTS_RATE); -} - -int zd_chip_enable_hwint(struct zd_chip *chip) -{ - int r; - - mutex_lock(&chip->mutex); - r = zd_iowrite32_locked(chip, HWINT_ENABLED, CR_INTERRUPT); - mutex_unlock(&chip->mutex); - return r; -} - -static int disable_hwint(struct zd_chip *chip) -{ - return zd_iowrite32_locked(chip, HWINT_DISABLED, CR_INTERRUPT); -} - -int zd_chip_disable_hwint(struct zd_chip *chip) -{ - int r; - - mutex_lock(&chip->mutex); - r = disable_hwint(chip); - mutex_unlock(&chip->mutex); - return r; -} - -static int read_fw_regs_offset(struct zd_chip *chip) -{ - int r; - - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - r = zd_ioread16_locked(chip, (u16*)&chip->fw_regs_base, - FWRAW_REGS_ADDR); - if (r) - return r; - dev_dbg_f(zd_chip_dev(chip), "fw_regs_base: %#06hx\n", - (u16)chip->fw_regs_base); - - return 0; -} - -/* Read mac address using pre-firmware interface */ -int zd_chip_read_mac_addr_fw(struct zd_chip *chip, u8 *addr) -{ - dev_dbg_f(zd_chip_dev(chip), "\n"); - return zd_usb_read_fw(&chip->usb, E2P_MAC_ADDR_P1, addr, - ETH_ALEN); -} - -int zd_chip_init_hw(struct zd_chip *chip) -{ - int r; - u8 rf_type; - - dev_dbg_f(zd_chip_dev(chip), "\n"); - - mutex_lock(&chip->mutex); - -#ifdef DEBUG - r = test_init(chip); - if (r) - goto out; -#endif - r = zd_iowrite32_locked(chip, 1, CR_AFTER_PNP); - if (r) - goto out; - - r = read_fw_regs_offset(chip); - if (r) - goto out; - - /* GPI is always disabled, also in the other driver. - */ - r = zd_iowrite32_locked(chip, 0, CR_GPI_EN); - if (r) - goto out; - r = zd_iowrite32_locked(chip, CWIN_SIZE, CR_CWMIN_CWMAX); - if (r) - goto out; - /* Currently we support IEEE 802.11g for full and high speed USB. - * It might be discussed, whether we should support pure b mode for - * full speed USB. - */ - r = set_mandatory_rates(chip, 1); - if (r) - goto out; - /* Disabling interrupts is certainly a smart thing here. - */ - r = disable_hwint(chip); - if (r) - goto out; - r = read_pod(chip, &rf_type); - if (r) - goto out; - r = hw_init(chip); - if (r) - goto out; - r = zd_rf_init_hw(&chip->rf, rf_type); - if (r) - goto out; - - r = print_fw_version(chip); - if (r) - goto out; - -#ifdef DEBUG - dump_fw_registers(chip); - r = test_init(chip); - if (r) - goto out; -#endif /* DEBUG */ - - r = read_cal_int_tables(chip); - if (r) - goto out; - - print_id(chip); -out: - mutex_unlock(&chip->mutex); - return r; -} - -static int update_pwr_int(struct zd_chip *chip, u8 channel) -{ - u8 value = chip->pwr_int_values[channel - 1]; - return zd_iowrite16_locked(chip, value, ZD_CR31); -} - -static int update_pwr_cal(struct zd_chip *chip, u8 channel) -{ - u8 value = chip->pwr_cal_values[channel-1]; - return zd_iowrite16_locked(chip, value, ZD_CR68); -} - -static int update_ofdm_cal(struct zd_chip *chip, u8 channel) -{ - struct zd_ioreq16 ioreqs[3]; - - ioreqs[0].addr = ZD_CR67; - ioreqs[0].value = chip->ofdm_cal_values[OFDM_36M_INDEX][channel-1]; - ioreqs[1].addr = ZD_CR66; - ioreqs[1].value = chip->ofdm_cal_values[OFDM_48M_INDEX][channel-1]; - ioreqs[2].addr = ZD_CR65; - ioreqs[2].value = chip->ofdm_cal_values[OFDM_54M_INDEX][channel-1]; - - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -static int update_channel_integration_and_calibration(struct zd_chip *chip, - u8 channel) -{ - int r; - - if (!zd_rf_should_update_pwr_int(&chip->rf)) - return 0; - - r = update_pwr_int(chip, channel); - if (r) - return r; - if (zd_chip_is_zd1211b(chip)) { - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR69, 0x28 }, - {}, - { ZD_CR69, 0x2a }, - }; - - r = update_ofdm_cal(chip, channel); - if (r) - return r; - r = update_pwr_cal(chip, channel); - if (r) - return r; - r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); - if (r) - return r; - } - - return 0; -} - -/* The CCK baseband gain can be optionally patched by the EEPROM */ -static int patch_cck_gain(struct zd_chip *chip) -{ - int r; - u32 value; - - if (!chip->patch_cck_gain || !zd_rf_should_patch_cck_gain(&chip->rf)) - return 0; - - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - r = zd_ioread32_locked(chip, &value, E2P_PHY_REG); - if (r) - return r; - dev_dbg_f(zd_chip_dev(chip), "patching value %x\n", value & 0xff); - return zd_iowrite16_locked(chip, value & 0xff, ZD_CR47); -} - -int zd_chip_set_channel(struct zd_chip *chip, u8 channel) -{ - int r, t; - - mutex_lock(&chip->mutex); - r = zd_chip_lock_phy_regs(chip); - if (r) - goto out; - r = zd_rf_set_channel(&chip->rf, channel); - if (r) - goto unlock; - r = update_channel_integration_and_calibration(chip, channel); - if (r) - goto unlock; - r = patch_cck_gain(chip); - if (r) - goto unlock; - r = patch_6m_band_edge(chip, channel); - if (r) - goto unlock; - r = zd_iowrite32_locked(chip, 0, CR_CONFIG_PHILIPS); -unlock: - t = zd_chip_unlock_phy_regs(chip); - if (t && !r) - r = t; -out: - mutex_unlock(&chip->mutex); - return r; -} - -u8 zd_chip_get_channel(struct zd_chip *chip) -{ - u8 channel; - - mutex_lock(&chip->mutex); - channel = chip->rf.channel; - mutex_unlock(&chip->mutex); - return channel; -} - -int zd_chip_control_leds(struct zd_chip *chip, enum led_status status) -{ - const zd_addr_t a[] = { - fw_reg_addr(chip, FW_REG_LED_LINK_STATUS), - CR_LED, - }; - - int r; - u16 v[ARRAY_SIZE(a)]; - struct zd_ioreq16 ioreqs[ARRAY_SIZE(a)] = { - [0] = { fw_reg_addr(chip, FW_REG_LED_LINK_STATUS) }, - [1] = { CR_LED }, - }; - u16 other_led; - - mutex_lock(&chip->mutex); - r = zd_ioread16v_locked(chip, v, (const zd_addr_t *)a, ARRAY_SIZE(a)); - if (r) - goto out; - - other_led = chip->link_led == LED1 ? LED2 : LED1; - - switch (status) { - case ZD_LED_OFF: - ioreqs[0].value = FW_LINK_OFF; - ioreqs[1].value = v[1] & ~(LED1|LED2); - break; - case ZD_LED_SCANNING: - ioreqs[0].value = FW_LINK_OFF; - ioreqs[1].value = v[1] & ~other_led; - if (get_seconds() % 3 == 0) { - ioreqs[1].value &= ~chip->link_led; - } else { - ioreqs[1].value |= chip->link_led; - } - break; - case ZD_LED_ASSOCIATED: - ioreqs[0].value = FW_LINK_TX; - ioreqs[1].value = v[1] & ~other_led; - ioreqs[1].value |= chip->link_led; - break; - default: - r = -EINVAL; - goto out; - } - - if (v[0] != ioreqs[0].value || v[1] != ioreqs[1].value) { - r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); - if (r) - goto out; - } - r = 0; -out: - mutex_unlock(&chip->mutex); - return r; -} - -int zd_chip_set_basic_rates(struct zd_chip *chip, u16 cr_rates) -{ - int r; - - if (cr_rates & ~(CR_RATES_80211B|CR_RATES_80211G)) - return -EINVAL; - - mutex_lock(&chip->mutex); - r = zd_iowrite32_locked(chip, cr_rates, CR_BASIC_RATE_TBL); - mutex_unlock(&chip->mutex); - return r; -} - -static inline u8 zd_rate_from_ofdm_plcp_header(const void *rx_frame) -{ - return ZD_OFDM | zd_ofdm_plcp_header_rate(rx_frame); -} - -/** - * zd_rx_rate - report zd-rate - * @rx_frame - received frame - * @rx_status - rx_status as given by the device - * - * This function converts the rate as encoded in the received packet to the - * zd-rate, we are using on other places in the driver. - */ -u8 zd_rx_rate(const void *rx_frame, const struct rx_status *status) -{ - u8 zd_rate; - if (status->frame_status & ZD_RX_OFDM) { - zd_rate = zd_rate_from_ofdm_plcp_header(rx_frame); - } else { - switch (zd_cck_plcp_header_signal(rx_frame)) { - case ZD_CCK_PLCP_SIGNAL_1M: - zd_rate = ZD_CCK_RATE_1M; - break; - case ZD_CCK_PLCP_SIGNAL_2M: - zd_rate = ZD_CCK_RATE_2M; - break; - case ZD_CCK_PLCP_SIGNAL_5M5: - zd_rate = ZD_CCK_RATE_5_5M; - break; - case ZD_CCK_PLCP_SIGNAL_11M: - zd_rate = ZD_CCK_RATE_11M; - break; - default: - zd_rate = 0; - } - } - - return zd_rate; -} - -int zd_chip_switch_radio_on(struct zd_chip *chip) -{ - int r; - - mutex_lock(&chip->mutex); - r = zd_switch_radio_on(&chip->rf); - mutex_unlock(&chip->mutex); - return r; -} - -int zd_chip_switch_radio_off(struct zd_chip *chip) -{ - int r; - - mutex_lock(&chip->mutex); - r = zd_switch_radio_off(&chip->rf); - mutex_unlock(&chip->mutex); - return r; -} - -int zd_chip_enable_int(struct zd_chip *chip) -{ - int r; - - mutex_lock(&chip->mutex); - r = zd_usb_enable_int(&chip->usb); - mutex_unlock(&chip->mutex); - return r; -} - -void zd_chip_disable_int(struct zd_chip *chip) -{ - mutex_lock(&chip->mutex); - zd_usb_disable_int(&chip->usb); - mutex_unlock(&chip->mutex); - - /* cancel pending interrupt work */ - cancel_work_sync(&zd_chip_to_mac(chip)->process_intr); -} - -int zd_chip_enable_rxtx(struct zd_chip *chip) -{ - int r; - - mutex_lock(&chip->mutex); - zd_usb_enable_tx(&chip->usb); - r = zd_usb_enable_rx(&chip->usb); - zd_tx_watchdog_enable(&chip->usb); - mutex_unlock(&chip->mutex); - return r; -} - -void zd_chip_disable_rxtx(struct zd_chip *chip) -{ - mutex_lock(&chip->mutex); - zd_tx_watchdog_disable(&chip->usb); - zd_usb_disable_rx(&chip->usb); - zd_usb_disable_tx(&chip->usb); - mutex_unlock(&chip->mutex); -} - -int zd_rfwritev_locked(struct zd_chip *chip, - const u32* values, unsigned int count, u8 bits) -{ - int r; - unsigned int i; - - for (i = 0; i < count; i++) { - r = zd_rfwrite_locked(chip, values[i], bits); - if (r) - return r; - } - - return 0; -} - -/* - * We can optionally program the RF directly through CR regs, if supported by - * the hardware. This is much faster than the older method. - */ -int zd_rfwrite_cr_locked(struct zd_chip *chip, u32 value) -{ - const struct zd_ioreq16 ioreqs[] = { - { ZD_CR244, (value >> 16) & 0xff }, - { ZD_CR243, (value >> 8) & 0xff }, - { ZD_CR242, value & 0xff }, - }; - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -int zd_rfwritev_cr_locked(struct zd_chip *chip, - const u32 *values, unsigned int count) -{ - int r; - unsigned int i; - - for (i = 0; i < count; i++) { - r = zd_rfwrite_cr_locked(chip, values[i]); - if (r) - return r; - } - - return 0; -} - -int zd_chip_set_multicast_hash(struct zd_chip *chip, - struct zd_mc_hash *hash) -{ - const struct zd_ioreq32 ioreqs[] = { - { CR_GROUP_HASH_P1, hash->low }, - { CR_GROUP_HASH_P2, hash->high }, - }; - - return zd_iowrite32a(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -u64 zd_chip_get_tsf(struct zd_chip *chip) -{ - int r; - static const zd_addr_t aw_pt_bi_addr[] = - { CR_TSF_LOW_PART, CR_TSF_HIGH_PART }; - u32 values[2]; - u64 tsf; - - mutex_lock(&chip->mutex); - r = zd_ioread32v_locked(chip, values, (const zd_addr_t *)aw_pt_bi_addr, - ARRAY_SIZE(aw_pt_bi_addr)); - mutex_unlock(&chip->mutex); - if (r) - return 0; - - tsf = values[1]; - tsf = (tsf << 32) | values[0]; - - return tsf; -} diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h deleted file mode 100644 index 7ab922209b25..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_chip.h +++ /dev/null @@ -1,984 +0,0 @@ -/* ZD1211 USB-WLAN driver for Linux - * - * Copyright (C) 2005-2007 Ulrich Kunitz - * Copyright (C) 2006-2007 Daniel Drake - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _ZD_CHIP_H -#define _ZD_CHIP_H - -#include - -#include "zd_rf.h" -#include "zd_usb.h" - -/* Header for the Media Access Controller (MAC) and the Baseband Processor - * (BBP). It appears that the ZD1211 wraps the old ZD1205 with USB glue and - * adds a processor for handling the USB protocol. - */ - -/* Address space */ -enum { - /* CONTROL REGISTERS */ - CR_START = 0x9000, - - - /* FIRMWARE */ - FW_START = 0xee00, - - - /* EEPROM */ - E2P_START = 0xf800, - E2P_LEN = 0x800, - - /* EEPROM layout */ - E2P_LOAD_CODE_LEN = 0xe, /* base 0xf800 */ - E2P_LOAD_VECT_LEN = 0x9, /* base 0xf80e */ - /* E2P_DATA indexes into this */ - E2P_DATA_LEN = 0x7e, /* base 0xf817 */ - E2P_BOOT_CODE_LEN = 0x760, /* base 0xf895 */ - E2P_INTR_VECT_LEN = 0xb, /* base 0xfff5 */ - - /* Some precomputed offsets into the EEPROM */ - E2P_DATA_OFFSET = E2P_LOAD_CODE_LEN + E2P_LOAD_VECT_LEN, - E2P_BOOT_CODE_OFFSET = E2P_DATA_OFFSET + E2P_DATA_LEN, -}; - -#define CTL_REG(offset) ((zd_addr_t)(CR_START + (offset))) -#define E2P_DATA(offset) ((zd_addr_t)(E2P_START + E2P_DATA_OFFSET + (offset))) -#define FWRAW_DATA(offset) ((zd_addr_t)(FW_START + (offset))) - -/* 8-bit hardware registers */ -#define ZD_CR0 CTL_REG(0x0000) -#define ZD_CR1 CTL_REG(0x0004) -#define ZD_CR2 CTL_REG(0x0008) -#define ZD_CR3 CTL_REG(0x000C) - -#define ZD_CR5 CTL_REG(0x0010) -/* bit 5: if set short preamble used - * bit 6: filter band - Japan channel 14 on, else off - */ -#define ZD_CR6 CTL_REG(0x0014) -#define ZD_CR7 CTL_REG(0x0018) -#define ZD_CR8 CTL_REG(0x001C) - -#define ZD_CR4 CTL_REG(0x0020) - -#define ZD_CR9 CTL_REG(0x0024) -/* bit 2: antenna switch (together with ZD_CR10) */ -#define ZD_CR10 CTL_REG(0x0028) -/* bit 1: antenna switch (together with ZD_CR9) - * RF2959 controls with ZD_CR11 radion on and off - */ -#define ZD_CR11 CTL_REG(0x002C) -/* bit 6: TX power control for OFDM - * RF2959 controls with ZD_CR10 radio on and off - */ -#define ZD_CR12 CTL_REG(0x0030) -#define ZD_CR13 CTL_REG(0x0034) -#define ZD_CR14 CTL_REG(0x0038) -#define ZD_CR15 CTL_REG(0x003C) -#define ZD_CR16 CTL_REG(0x0040) -#define ZD_CR17 CTL_REG(0x0044) -#define ZD_CR18 CTL_REG(0x0048) -#define ZD_CR19 CTL_REG(0x004C) -#define ZD_CR20 CTL_REG(0x0050) -#define ZD_CR21 CTL_REG(0x0054) -#define ZD_CR22 CTL_REG(0x0058) -#define ZD_CR23 CTL_REG(0x005C) -#define ZD_CR24 CTL_REG(0x0060) /* CCA threshold */ -#define ZD_CR25 CTL_REG(0x0064) -#define ZD_CR26 CTL_REG(0x0068) -#define ZD_CR27 CTL_REG(0x006C) -#define ZD_CR28 CTL_REG(0x0070) -#define ZD_CR29 CTL_REG(0x0074) -#define ZD_CR30 CTL_REG(0x0078) -#define ZD_CR31 CTL_REG(0x007C) /* TX power control for RF in - * CCK mode - */ -#define ZD_CR32 CTL_REG(0x0080) -#define ZD_CR33 CTL_REG(0x0084) -#define ZD_CR34 CTL_REG(0x0088) -#define ZD_CR35 CTL_REG(0x008C) -#define ZD_CR36 CTL_REG(0x0090) -#define ZD_CR37 CTL_REG(0x0094) -#define ZD_CR38 CTL_REG(0x0098) -#define ZD_CR39 CTL_REG(0x009C) -#define ZD_CR40 CTL_REG(0x00A0) -#define ZD_CR41 CTL_REG(0x00A4) -#define ZD_CR42 CTL_REG(0x00A8) -#define ZD_CR43 CTL_REG(0x00AC) -#define ZD_CR44 CTL_REG(0x00B0) -#define ZD_CR45 CTL_REG(0x00B4) -#define ZD_CR46 CTL_REG(0x00B8) -#define ZD_CR47 CTL_REG(0x00BC) /* CCK baseband gain - * (patch value might be in EEPROM) - */ -#define ZD_CR48 CTL_REG(0x00C0) -#define ZD_CR49 CTL_REG(0x00C4) -#define ZD_CR50 CTL_REG(0x00C8) -#define ZD_CR51 CTL_REG(0x00CC) /* TX power control for RF in - * 6-36M modes - */ -#define ZD_CR52 CTL_REG(0x00D0) /* TX power control for RF in - * 48M mode - */ -#define ZD_CR53 CTL_REG(0x00D4) /* TX power control for RF in - * 54M mode - */ -#define ZD_CR54 CTL_REG(0x00D8) -#define ZD_CR55 CTL_REG(0x00DC) -#define ZD_CR56 CTL_REG(0x00E0) -#define ZD_CR57 CTL_REG(0x00E4) -#define ZD_CR58 CTL_REG(0x00E8) -#define ZD_CR59 CTL_REG(0x00EC) -#define ZD_CR60 CTL_REG(0x00F0) -#define ZD_CR61 CTL_REG(0x00F4) -#define ZD_CR62 CTL_REG(0x00F8) -#define ZD_CR63 CTL_REG(0x00FC) -#define ZD_CR64 CTL_REG(0x0100) -#define ZD_CR65 CTL_REG(0x0104) /* OFDM 54M calibration */ -#define ZD_CR66 CTL_REG(0x0108) /* OFDM 48M calibration */ -#define ZD_CR67 CTL_REG(0x010C) /* OFDM 36M calibration */ -#define ZD_CR68 CTL_REG(0x0110) /* CCK calibration */ -#define ZD_CR69 CTL_REG(0x0114) -#define ZD_CR70 CTL_REG(0x0118) -#define ZD_CR71 CTL_REG(0x011C) -#define ZD_CR72 CTL_REG(0x0120) -#define ZD_CR73 CTL_REG(0x0124) -#define ZD_CR74 CTL_REG(0x0128) -#define ZD_CR75 CTL_REG(0x012C) -#define ZD_CR76 CTL_REG(0x0130) -#define ZD_CR77 CTL_REG(0x0134) -#define ZD_CR78 CTL_REG(0x0138) -#define ZD_CR79 CTL_REG(0x013C) -#define ZD_CR80 CTL_REG(0x0140) -#define ZD_CR81 CTL_REG(0x0144) -#define ZD_CR82 CTL_REG(0x0148) -#define ZD_CR83 CTL_REG(0x014C) -#define ZD_CR84 CTL_REG(0x0150) -#define ZD_CR85 CTL_REG(0x0154) -#define ZD_CR86 CTL_REG(0x0158) -#define ZD_CR87 CTL_REG(0x015C) -#define ZD_CR88 CTL_REG(0x0160) -#define ZD_CR89 CTL_REG(0x0164) -#define ZD_CR90 CTL_REG(0x0168) -#define ZD_CR91 CTL_REG(0x016C) -#define ZD_CR92 CTL_REG(0x0170) -#define ZD_CR93 CTL_REG(0x0174) -#define ZD_CR94 CTL_REG(0x0178) -#define ZD_CR95 CTL_REG(0x017C) -#define ZD_CR96 CTL_REG(0x0180) -#define ZD_CR97 CTL_REG(0x0184) -#define ZD_CR98 CTL_REG(0x0188) -#define ZD_CR99 CTL_REG(0x018C) -#define ZD_CR100 CTL_REG(0x0190) -#define ZD_CR101 CTL_REG(0x0194) -#define ZD_CR102 CTL_REG(0x0198) -#define ZD_CR103 CTL_REG(0x019C) -#define ZD_CR104 CTL_REG(0x01A0) -#define ZD_CR105 CTL_REG(0x01A4) -#define ZD_CR106 CTL_REG(0x01A8) -#define ZD_CR107 CTL_REG(0x01AC) -#define ZD_CR108 CTL_REG(0x01B0) -#define ZD_CR109 CTL_REG(0x01B4) -#define ZD_CR110 CTL_REG(0x01B8) -#define ZD_CR111 CTL_REG(0x01BC) -#define ZD_CR112 CTL_REG(0x01C0) -#define ZD_CR113 CTL_REG(0x01C4) -#define ZD_CR114 CTL_REG(0x01C8) -#define ZD_CR115 CTL_REG(0x01CC) -#define ZD_CR116 CTL_REG(0x01D0) -#define ZD_CR117 CTL_REG(0x01D4) -#define ZD_CR118 CTL_REG(0x01D8) -#define ZD_CR119 CTL_REG(0x01DC) -#define ZD_CR120 CTL_REG(0x01E0) -#define ZD_CR121 CTL_REG(0x01E4) -#define ZD_CR122 CTL_REG(0x01E8) -#define ZD_CR123 CTL_REG(0x01EC) -#define ZD_CR124 CTL_REG(0x01F0) -#define ZD_CR125 CTL_REG(0x01F4) -#define ZD_CR126 CTL_REG(0x01F8) -#define ZD_CR127 CTL_REG(0x01FC) -#define ZD_CR128 CTL_REG(0x0200) -#define ZD_CR129 CTL_REG(0x0204) -#define ZD_CR130 CTL_REG(0x0208) -#define ZD_CR131 CTL_REG(0x020C) -#define ZD_CR132 CTL_REG(0x0210) -#define ZD_CR133 CTL_REG(0x0214) -#define ZD_CR134 CTL_REG(0x0218) -#define ZD_CR135 CTL_REG(0x021C) -#define ZD_CR136 CTL_REG(0x0220) -#define ZD_CR137 CTL_REG(0x0224) -#define ZD_CR138 CTL_REG(0x0228) -#define ZD_CR139 CTL_REG(0x022C) -#define ZD_CR140 CTL_REG(0x0230) -#define ZD_CR141 CTL_REG(0x0234) -#define ZD_CR142 CTL_REG(0x0238) -#define ZD_CR143 CTL_REG(0x023C) -#define ZD_CR144 CTL_REG(0x0240) -#define ZD_CR145 CTL_REG(0x0244) -#define ZD_CR146 CTL_REG(0x0248) -#define ZD_CR147 CTL_REG(0x024C) -#define ZD_CR148 CTL_REG(0x0250) -#define ZD_CR149 CTL_REG(0x0254) -#define ZD_CR150 CTL_REG(0x0258) -#define ZD_CR151 CTL_REG(0x025C) -#define ZD_CR152 CTL_REG(0x0260) -#define ZD_CR153 CTL_REG(0x0264) -#define ZD_CR154 CTL_REG(0x0268) -#define ZD_CR155 CTL_REG(0x026C) -#define ZD_CR156 CTL_REG(0x0270) -#define ZD_CR157 CTL_REG(0x0274) -#define ZD_CR158 CTL_REG(0x0278) -#define ZD_CR159 CTL_REG(0x027C) -#define ZD_CR160 CTL_REG(0x0280) -#define ZD_CR161 CTL_REG(0x0284) -#define ZD_CR162 CTL_REG(0x0288) -#define ZD_CR163 CTL_REG(0x028C) -#define ZD_CR164 CTL_REG(0x0290) -#define ZD_CR165 CTL_REG(0x0294) -#define ZD_CR166 CTL_REG(0x0298) -#define ZD_CR167 CTL_REG(0x029C) -#define ZD_CR168 CTL_REG(0x02A0) -#define ZD_CR169 CTL_REG(0x02A4) -#define ZD_CR170 CTL_REG(0x02A8) -#define ZD_CR171 CTL_REG(0x02AC) -#define ZD_CR172 CTL_REG(0x02B0) -#define ZD_CR173 CTL_REG(0x02B4) -#define ZD_CR174 CTL_REG(0x02B8) -#define ZD_CR175 CTL_REG(0x02BC) -#define ZD_CR176 CTL_REG(0x02C0) -#define ZD_CR177 CTL_REG(0x02C4) -#define ZD_CR178 CTL_REG(0x02C8) -#define ZD_CR179 CTL_REG(0x02CC) -#define ZD_CR180 CTL_REG(0x02D0) -#define ZD_CR181 CTL_REG(0x02D4) -#define ZD_CR182 CTL_REG(0x02D8) -#define ZD_CR183 CTL_REG(0x02DC) -#define ZD_CR184 CTL_REG(0x02E0) -#define ZD_CR185 CTL_REG(0x02E4) -#define ZD_CR186 CTL_REG(0x02E8) -#define ZD_CR187 CTL_REG(0x02EC) -#define ZD_CR188 CTL_REG(0x02F0) -#define ZD_CR189 CTL_REG(0x02F4) -#define ZD_CR190 CTL_REG(0x02F8) -#define ZD_CR191 CTL_REG(0x02FC) -#define ZD_CR192 CTL_REG(0x0300) -#define ZD_CR193 CTL_REG(0x0304) -#define ZD_CR194 CTL_REG(0x0308) -#define ZD_CR195 CTL_REG(0x030C) -#define ZD_CR196 CTL_REG(0x0310) -#define ZD_CR197 CTL_REG(0x0314) -#define ZD_CR198 CTL_REG(0x0318) -#define ZD_CR199 CTL_REG(0x031C) -#define ZD_CR200 CTL_REG(0x0320) -#define ZD_CR201 CTL_REG(0x0324) -#define ZD_CR202 CTL_REG(0x0328) -#define ZD_CR203 CTL_REG(0x032C) /* I2C bus template value & flash - * control - */ -#define ZD_CR204 CTL_REG(0x0330) -#define ZD_CR205 CTL_REG(0x0334) -#define ZD_CR206 CTL_REG(0x0338) -#define ZD_CR207 CTL_REG(0x033C) -#define ZD_CR208 CTL_REG(0x0340) -#define ZD_CR209 CTL_REG(0x0344) -#define ZD_CR210 CTL_REG(0x0348) -#define ZD_CR211 CTL_REG(0x034C) -#define ZD_CR212 CTL_REG(0x0350) -#define ZD_CR213 CTL_REG(0x0354) -#define ZD_CR214 CTL_REG(0x0358) -#define ZD_CR215 CTL_REG(0x035C) -#define ZD_CR216 CTL_REG(0x0360) -#define ZD_CR217 CTL_REG(0x0364) -#define ZD_CR218 CTL_REG(0x0368) -#define ZD_CR219 CTL_REG(0x036C) -#define ZD_CR220 CTL_REG(0x0370) -#define ZD_CR221 CTL_REG(0x0374) -#define ZD_CR222 CTL_REG(0x0378) -#define ZD_CR223 CTL_REG(0x037C) -#define ZD_CR224 CTL_REG(0x0380) -#define ZD_CR225 CTL_REG(0x0384) -#define ZD_CR226 CTL_REG(0x0388) -#define ZD_CR227 CTL_REG(0x038C) -#define ZD_CR228 CTL_REG(0x0390) -#define ZD_CR229 CTL_REG(0x0394) -#define ZD_CR230 CTL_REG(0x0398) -#define ZD_CR231 CTL_REG(0x039C) -#define ZD_CR232 CTL_REG(0x03A0) -#define ZD_CR233 CTL_REG(0x03A4) -#define ZD_CR234 CTL_REG(0x03A8) -#define ZD_CR235 CTL_REG(0x03AC) -#define ZD_CR236 CTL_REG(0x03B0) - -#define ZD_CR240 CTL_REG(0x03C0) -/* bit 7: host-controlled RF register writes - * ZD_CR241-ZD_CR245: for hardware controlled writing of RF bits, not needed for - * USB - */ -#define ZD_CR241 CTL_REG(0x03C4) -#define ZD_CR242 CTL_REG(0x03C8) -#define ZD_CR243 CTL_REG(0x03CC) -#define ZD_CR244 CTL_REG(0x03D0) -#define ZD_CR245 CTL_REG(0x03D4) - -#define ZD_CR251 CTL_REG(0x03EC) /* only used for activation and - * deactivation of Airoha RFs AL2230 - * and AL7230B - */ -#define ZD_CR252 CTL_REG(0x03F0) -#define ZD_CR253 CTL_REG(0x03F4) -#define ZD_CR254 CTL_REG(0x03F8) -#define ZD_CR255 CTL_REG(0x03FC) - -#define CR_MAX_PHY_REG 255 - -/* Taken from the ZYDAS driver, not all of them are relevant for the ZD1211 - * driver. - */ - -#define CR_RF_IF_CLK CTL_REG(0x0400) -#define CR_RF_IF_DATA CTL_REG(0x0404) -#define CR_PE1_PE2 CTL_REG(0x0408) -#define CR_PE2_DLY CTL_REG(0x040C) -#define CR_LE1 CTL_REG(0x0410) -#define CR_LE2 CTL_REG(0x0414) -/* Seems to enable/disable GPI (General Purpose IO?) */ -#define CR_GPI_EN CTL_REG(0x0418) -#define CR_RADIO_PD CTL_REG(0x042C) -#define CR_RF2948_PD CTL_REG(0x042C) -#define CR_ENABLE_PS_MANUAL_AGC CTL_REG(0x043C) -#define CR_CONFIG_PHILIPS CTL_REG(0x0440) -#define CR_SA2400_SER_AP CTL_REG(0x0444) -#define CR_I2C_WRITE CTL_REG(0x0444) -#define CR_SA2400_SER_RP CTL_REG(0x0448) -#define CR_RADIO_PE CTL_REG(0x0458) -#define CR_RST_BUS_MASTER CTL_REG(0x045C) -#define CR_RFCFG CTL_REG(0x0464) -#define CR_HSTSCHG CTL_REG(0x046C) -#define CR_PHY_ON CTL_REG(0x0474) -#define CR_RX_DELAY CTL_REG(0x0478) -#define CR_RX_PE_DELAY CTL_REG(0x047C) -#define CR_GPIO_1 CTL_REG(0x0490) -#define CR_GPIO_2 CTL_REG(0x0494) -#define CR_EncryBufMux CTL_REG(0x04A8) -#define CR_PS_CTRL CTL_REG(0x0500) -#define CR_ADDA_PWR_DWN CTL_REG(0x0504) -#define CR_ADDA_MBIAS_WARMTIME CTL_REG(0x0508) -#define CR_MAC_PS_STATE CTL_REG(0x050C) - -#define CR_INTERRUPT CTL_REG(0x0510) -#define INT_TX_COMPLETE (1 << 0) -#define INT_RX_COMPLETE (1 << 1) -#define INT_RETRY_FAIL (1 << 2) -#define INT_WAKEUP (1 << 3) -#define INT_DTIM_NOTIFY (1 << 5) -#define INT_CFG_NEXT_BCN (1 << 6) -#define INT_BUS_ABORT (1 << 7) -#define INT_TX_FIFO_READY (1 << 8) -#define INT_UART (1 << 9) -#define INT_TX_COMPLETE_EN (1 << 16) -#define INT_RX_COMPLETE_EN (1 << 17) -#define INT_RETRY_FAIL_EN (1 << 18) -#define INT_WAKEUP_EN (1 << 19) -#define INT_DTIM_NOTIFY_EN (1 << 21) -#define INT_CFG_NEXT_BCN_EN (1 << 22) -#define INT_BUS_ABORT_EN (1 << 23) -#define INT_TX_FIFO_READY_EN (1 << 24) -#define INT_UART_EN (1 << 25) - -#define CR_TSF_LOW_PART CTL_REG(0x0514) -#define CR_TSF_HIGH_PART CTL_REG(0x0518) - -/* Following three values are in time units (1024us) - * Following condition must be met: - * atim < tbtt < bcn - */ -#define CR_ATIM_WND_PERIOD CTL_REG(0x051C) -#define CR_BCN_INTERVAL CTL_REG(0x0520) -#define CR_PRE_TBTT CTL_REG(0x0524) -/* in units of TU(1024us) */ - -/* for UART support */ -#define CR_UART_RBR_THR_DLL CTL_REG(0x0540) -#define CR_UART_DLM_IER CTL_REG(0x0544) -#define CR_UART_IIR_FCR CTL_REG(0x0548) -#define CR_UART_LCR CTL_REG(0x054c) -#define CR_UART_MCR CTL_REG(0x0550) -#define CR_UART_LSR CTL_REG(0x0554) -#define CR_UART_MSR CTL_REG(0x0558) -#define CR_UART_ECR CTL_REG(0x055c) -#define CR_UART_STATUS CTL_REG(0x0560) - -#define CR_PCI_TX_ADDR_P1 CTL_REG(0x0600) -#define CR_PCI_TX_AddR_P2 CTL_REG(0x0604) -#define CR_PCI_RX_AddR_P1 CTL_REG(0x0608) -#define CR_PCI_RX_AddR_P2 CTL_REG(0x060C) - -/* must be overwritten if custom MAC address will be used */ -#define CR_MAC_ADDR_P1 CTL_REG(0x0610) -#define CR_MAC_ADDR_P2 CTL_REG(0x0614) -#define CR_BSSID_P1 CTL_REG(0x0618) -#define CR_BSSID_P2 CTL_REG(0x061C) -#define CR_BCN_PLCP_CFG CTL_REG(0x0620) - -/* Group hash table for filtering incoming packets. - * - * The group hash table is 64 bit large and split over two parts. The first - * part is the lower part. The upper 6 bits of the last byte of the target - * address are used as index. Packets are received if the hash table bit is - * set. This is used for multicast handling, but for broadcasts (address - * ff:ff:ff:ff:ff:ff) the highest bit in the second table must also be set. - */ -#define CR_GROUP_HASH_P1 CTL_REG(0x0624) -#define CR_GROUP_HASH_P2 CTL_REG(0x0628) - -#define CR_RX_TIMEOUT CTL_REG(0x062C) - -/* Basic rates supported by the BSS. When producing ACK or CTS messages, the - * device will use a rate in this table that is less than or equal to the rate - * of the incoming frame which prompted the response. */ -#define CR_BASIC_RATE_TBL CTL_REG(0x0630) -#define CR_RATE_1M (1 << 0) /* 802.11b */ -#define CR_RATE_2M (1 << 1) /* 802.11b */ -#define CR_RATE_5_5M (1 << 2) /* 802.11b */ -#define CR_RATE_11M (1 << 3) /* 802.11b */ -#define CR_RATE_6M (1 << 8) /* 802.11g */ -#define CR_RATE_9M (1 << 9) /* 802.11g */ -#define CR_RATE_12M (1 << 10) /* 802.11g */ -#define CR_RATE_18M (1 << 11) /* 802.11g */ -#define CR_RATE_24M (1 << 12) /* 802.11g */ -#define CR_RATE_36M (1 << 13) /* 802.11g */ -#define CR_RATE_48M (1 << 14) /* 802.11g */ -#define CR_RATE_54M (1 << 15) /* 802.11g */ -#define CR_RATES_80211G 0xff00 -#define CR_RATES_80211B 0x000f - -/* Mandatory rates required in the BSS. When producing ACK or CTS messages, if - * the device could not find an appropriate rate in CR_BASIC_RATE_TBL, it will - * look for a rate in this table that is less than or equal to the rate of - * the incoming frame. */ -#define CR_MANDATORY_RATE_TBL CTL_REG(0x0634) -#define CR_RTS_CTS_RATE CTL_REG(0x0638) - -/* These are all bit indexes in CR_RTS_CTS_RATE, so remember to shift. */ -#define RTSCTS_SH_RTS_RATE 0 -#define RTSCTS_SH_EXP_CTS_RATE 4 -#define RTSCTS_SH_RTS_MOD_TYPE 8 -#define RTSCTS_SH_RTS_PMB_TYPE 9 -#define RTSCTS_SH_CTS_RATE 16 -#define RTSCTS_SH_CTS_MOD_TYPE 24 -#define RTSCTS_SH_CTS_PMB_TYPE 25 - -#define CR_WEP_PROTECT CTL_REG(0x063C) -#define CR_RX_THRESHOLD CTL_REG(0x0640) - -/* register for controlling the LEDS */ -#define CR_LED CTL_REG(0x0644) -/* masks for controlling LEDs */ -#define LED1 (1 << 8) -#define LED2 (1 << 9) -#define LED_SW (1 << 10) - -/* Seems to indicate that the configuration is over. - */ -#define CR_AFTER_PNP CTL_REG(0x0648) -#define CR_ACK_TIME_80211 CTL_REG(0x0658) - -#define CR_RX_OFFSET CTL_REG(0x065c) - -#define CR_BCN_LENGTH CTL_REG(0x0664) -#define CR_PHY_DELAY CTL_REG(0x066C) -#define CR_BCN_FIFO CTL_REG(0x0670) -#define CR_SNIFFER_ON CTL_REG(0x0674) - -#define CR_ENCRYPTION_TYPE CTL_REG(0x0678) -#define NO_WEP 0 -#define WEP64 1 -#define WEP128 5 -#define WEP256 6 -#define ENC_SNIFFER 8 - -#define CR_ZD1211_RETRY_MAX CTL_REG(0x067C) - -#define CR_REG1 CTL_REG(0x0680) -/* Setting the bit UNLOCK_PHY_REGS disallows the write access to physical - * registers, so one could argue it is a LOCK bit. But calling it - * LOCK_PHY_REGS makes it confusing. - */ -#define UNLOCK_PHY_REGS (1 << 7) - -#define CR_DEVICE_STATE CTL_REG(0x0684) -#define CR_UNDERRUN_CNT CTL_REG(0x0688) - -#define CR_RX_FILTER CTL_REG(0x068c) -#define RX_FILTER_ASSOC_REQUEST (1 << 0) -#define RX_FILTER_ASSOC_RESPONSE (1 << 1) -#define RX_FILTER_REASSOC_REQUEST (1 << 2) -#define RX_FILTER_REASSOC_RESPONSE (1 << 3) -#define RX_FILTER_PROBE_REQUEST (1 << 4) -#define RX_FILTER_PROBE_RESPONSE (1 << 5) -/* bits 6 and 7 reserved */ -#define RX_FILTER_BEACON (1 << 8) -#define RX_FILTER_ATIM (1 << 9) -#define RX_FILTER_DISASSOC (1 << 10) -#define RX_FILTER_AUTH (1 << 11) -#define RX_FILTER_DEAUTH (1 << 12) -#define RX_FILTER_PSPOLL (1 << 26) -#define RX_FILTER_RTS (1 << 27) -#define RX_FILTER_CTS (1 << 28) -#define RX_FILTER_ACK (1 << 29) -#define RX_FILTER_CFEND (1 << 30) -#define RX_FILTER_CFACK (1 << 31) - -/* Enable bits for all frames you are interested in. */ -#define STA_RX_FILTER (RX_FILTER_ASSOC_REQUEST | RX_FILTER_ASSOC_RESPONSE | \ - RX_FILTER_REASSOC_REQUEST | RX_FILTER_REASSOC_RESPONSE | \ - RX_FILTER_PROBE_REQUEST | RX_FILTER_PROBE_RESPONSE | \ - (0x3 << 6) /* vendor driver sets these reserved bits */ | \ - RX_FILTER_BEACON | RX_FILTER_ATIM | RX_FILTER_DISASSOC | \ - RX_FILTER_AUTH | RX_FILTER_DEAUTH | \ - (0x7 << 13) /* vendor driver sets these reserved bits */ | \ - RX_FILTER_PSPOLL | RX_FILTER_ACK) /* 0x2400ffff */ - -#define RX_FILTER_CTRL (RX_FILTER_RTS | RX_FILTER_CTS | \ - RX_FILTER_CFEND | RX_FILTER_CFACK) - -#define BCN_MODE_AP 0x1000000 -#define BCN_MODE_IBSS 0x2000000 - -/* Monitor mode sets filter to 0xfffff */ - -#define CR_ACK_TIMEOUT_EXT CTL_REG(0x0690) -#define CR_BCN_FIFO_SEMAPHORE CTL_REG(0x0694) - -#define CR_IFS_VALUE CTL_REG(0x0698) -#define IFS_VALUE_DIFS_SH 0 -#define IFS_VALUE_EIFS_SH 12 -#define IFS_VALUE_SIFS_SH 24 -#define IFS_VALUE_DEFAULT (( 50 << IFS_VALUE_DIFS_SH) | \ - (1148 << IFS_VALUE_EIFS_SH) | \ - ( 10 << IFS_VALUE_SIFS_SH)) - -#define CR_RX_TIME_OUT CTL_REG(0x069C) -#define CR_TOTAL_RX_FRM CTL_REG(0x06A0) -#define CR_CRC32_CNT CTL_REG(0x06A4) -#define CR_CRC16_CNT CTL_REG(0x06A8) -#define CR_DECRYPTION_ERR_UNI CTL_REG(0x06AC) -#define CR_RX_FIFO_OVERRUN CTL_REG(0x06B0) - -#define CR_DECRYPTION_ERR_MUL CTL_REG(0x06BC) - -#define CR_NAV_CNT CTL_REG(0x06C4) -#define CR_NAV_CCA CTL_REG(0x06C8) -#define CR_RETRY_CNT CTL_REG(0x06CC) - -#define CR_READ_TCB_ADDR CTL_REG(0x06E8) -#define CR_READ_RFD_ADDR CTL_REG(0x06EC) -#define CR_CWMIN_CWMAX CTL_REG(0x06F0) -#define CR_TOTAL_TX_FRM CTL_REG(0x06F4) - -/* CAM: Continuous Access Mode (power management) */ -#define CR_CAM_MODE CTL_REG(0x0700) -#define MODE_IBSS 0x0 -#define MODE_AP 0x1 -#define MODE_STA 0x2 -#define MODE_AP_WDS 0x3 - -#define CR_CAM_ROLL_TB_LOW CTL_REG(0x0704) -#define CR_CAM_ROLL_TB_HIGH CTL_REG(0x0708) -#define CR_CAM_ADDRESS CTL_REG(0x070C) -#define CR_CAM_DATA CTL_REG(0x0710) - -#define CR_ROMDIR CTL_REG(0x0714) - -#define CR_DECRY_ERR_FLG_LOW CTL_REG(0x0714) -#define CR_DECRY_ERR_FLG_HIGH CTL_REG(0x0718) - -#define CR_WEPKEY0 CTL_REG(0x0720) -#define CR_WEPKEY1 CTL_REG(0x0724) -#define CR_WEPKEY2 CTL_REG(0x0728) -#define CR_WEPKEY3 CTL_REG(0x072C) -#define CR_WEPKEY4 CTL_REG(0x0730) -#define CR_WEPKEY5 CTL_REG(0x0734) -#define CR_WEPKEY6 CTL_REG(0x0738) -#define CR_WEPKEY7 CTL_REG(0x073C) -#define CR_WEPKEY8 CTL_REG(0x0740) -#define CR_WEPKEY9 CTL_REG(0x0744) -#define CR_WEPKEY10 CTL_REG(0x0748) -#define CR_WEPKEY11 CTL_REG(0x074C) -#define CR_WEPKEY12 CTL_REG(0x0750) -#define CR_WEPKEY13 CTL_REG(0x0754) -#define CR_WEPKEY14 CTL_REG(0x0758) -#define CR_WEPKEY15 CTL_REG(0x075c) -#define CR_TKIP_MODE CTL_REG(0x0760) - -#define CR_EEPROM_PROTECT0 CTL_REG(0x0758) -#define CR_EEPROM_PROTECT1 CTL_REG(0x075C) - -#define CR_DBG_FIFO_RD CTL_REG(0x0800) -#define CR_DBG_SELECT CTL_REG(0x0804) -#define CR_FIFO_Length CTL_REG(0x0808) - - -#define CR_RSSI_MGC CTL_REG(0x0810) - -#define CR_PON CTL_REG(0x0818) -#define CR_RX_ON CTL_REG(0x081C) -#define CR_TX_ON CTL_REG(0x0820) -#define CR_CHIP_EN CTL_REG(0x0824) -#define CR_LO_SW CTL_REG(0x0828) -#define CR_TXRX_SW CTL_REG(0x082C) -#define CR_S_MD CTL_REG(0x0830) - -#define CR_USB_DEBUG_PORT CTL_REG(0x0888) -#define CR_ZD1211B_CWIN_MAX_MIN_AC0 CTL_REG(0x0b00) -#define CR_ZD1211B_CWIN_MAX_MIN_AC1 CTL_REG(0x0b04) -#define CR_ZD1211B_CWIN_MAX_MIN_AC2 CTL_REG(0x0b08) -#define CR_ZD1211B_CWIN_MAX_MIN_AC3 CTL_REG(0x0b0c) -#define CR_ZD1211B_AIFS_CTL1 CTL_REG(0x0b10) -#define CR_ZD1211B_AIFS_CTL2 CTL_REG(0x0b14) -#define CR_ZD1211B_TXOP CTL_REG(0x0b20) -#define CR_ZD1211B_RETRY_MAX CTL_REG(0x0b28) - -/* Value for CR_ZD1211_RETRY_MAX & CR_ZD1211B_RETRY_MAX. Vendor driver uses 2, - * we use 0. The first rate is tried (count+2), then all next rates are tried - * twice, until 1 Mbits is tried. */ -#define ZD1211_RETRY_COUNT 0 -#define ZD1211B_RETRY_COUNT \ - (ZD1211_RETRY_COUNT << 0)| \ - (ZD1211_RETRY_COUNT << 8)| \ - (ZD1211_RETRY_COUNT << 16)| \ - (ZD1211_RETRY_COUNT << 24) - -/* Used to detect PLL lock */ -#define UW2453_INTR_REG ((zd_addr_t)0x85c1) - -#define CWIN_SIZE 0x007f043f - - -#define HWINT_ENABLED \ - (INT_TX_COMPLETE_EN| \ - INT_RX_COMPLETE_EN| \ - INT_RETRY_FAIL_EN| \ - INT_WAKEUP_EN| \ - INT_CFG_NEXT_BCN_EN) - -#define HWINT_DISABLED 0 - -#define E2P_PWR_INT_GUARD 8 -#define E2P_CHANNEL_COUNT 14 - -/* If you compare this addresses with the ZYDAS orignal driver, please notify - * that we use word mapping for the EEPROM. - */ - -/* - * Upper 16 bit contains the regulatory domain. - */ -#define E2P_SUBID E2P_DATA(0x00) -#define E2P_POD E2P_DATA(0x02) -#define E2P_MAC_ADDR_P1 E2P_DATA(0x04) -#define E2P_MAC_ADDR_P2 E2P_DATA(0x06) -#define E2P_PWR_CAL_VALUE1 E2P_DATA(0x08) -#define E2P_PWR_CAL_VALUE2 E2P_DATA(0x0a) -#define E2P_PWR_CAL_VALUE3 E2P_DATA(0x0c) -#define E2P_PWR_CAL_VALUE4 E2P_DATA(0x0e) -#define E2P_PWR_INT_VALUE1 E2P_DATA(0x10) -#define E2P_PWR_INT_VALUE2 E2P_DATA(0x12) -#define E2P_PWR_INT_VALUE3 E2P_DATA(0x14) -#define E2P_PWR_INT_VALUE4 E2P_DATA(0x16) - -/* Contains a bit for each allowed channel. It gives for Europe (ETSI 0x30) - * also only 11 channels. */ -#define E2P_ALLOWED_CHANNEL E2P_DATA(0x18) - -#define E2P_DEVICE_VER E2P_DATA(0x20) -#define E2P_PHY_REG E2P_DATA(0x25) -#define E2P_36M_CAL_VALUE1 E2P_DATA(0x28) -#define E2P_36M_CAL_VALUE2 E2P_DATA(0x2a) -#define E2P_36M_CAL_VALUE3 E2P_DATA(0x2c) -#define E2P_36M_CAL_VALUE4 E2P_DATA(0x2e) -#define E2P_11A_INT_VALUE1 E2P_DATA(0x30) -#define E2P_11A_INT_VALUE2 E2P_DATA(0x32) -#define E2P_11A_INT_VALUE3 E2P_DATA(0x34) -#define E2P_11A_INT_VALUE4 E2P_DATA(0x36) -#define E2P_48M_CAL_VALUE1 E2P_DATA(0x38) -#define E2P_48M_CAL_VALUE2 E2P_DATA(0x3a) -#define E2P_48M_CAL_VALUE3 E2P_DATA(0x3c) -#define E2P_48M_CAL_VALUE4 E2P_DATA(0x3e) -#define E2P_48M_INT_VALUE1 E2P_DATA(0x40) -#define E2P_48M_INT_VALUE2 E2P_DATA(0x42) -#define E2P_48M_INT_VALUE3 E2P_DATA(0x44) -#define E2P_48M_INT_VALUE4 E2P_DATA(0x46) -#define E2P_54M_CAL_VALUE1 E2P_DATA(0x48) /* ??? */ -#define E2P_54M_CAL_VALUE2 E2P_DATA(0x4a) -#define E2P_54M_CAL_VALUE3 E2P_DATA(0x4c) -#define E2P_54M_CAL_VALUE4 E2P_DATA(0x4e) -#define E2P_54M_INT_VALUE1 E2P_DATA(0x50) -#define E2P_54M_INT_VALUE2 E2P_DATA(0x52) -#define E2P_54M_INT_VALUE3 E2P_DATA(0x54) -#define E2P_54M_INT_VALUE4 E2P_DATA(0x56) - -/* This word contains the base address of the FW_REG_ registers below */ -#define FWRAW_REGS_ADDR FWRAW_DATA(0x1d) - -/* All 16 bit values, offset from the address in FWRAW_REGS_ADDR */ -enum { - FW_REG_FIRMWARE_VER = 0, - /* non-zero if USB high speed connection */ - FW_REG_USB_SPEED = 1, - FW_REG_FIX_TX_RATE = 2, - /* Seems to be able to control LEDs over the firmware */ - FW_REG_LED_LINK_STATUS = 3, - FW_REG_SOFT_RESET = 4, - FW_REG_FLASH_CHK = 5, -}; - -/* Values for FW_LINK_STATUS */ -#define FW_LINK_OFF 0x0 -#define FW_LINK_TX 0x1 -/* 0x2 - link led on? */ - -enum { - /* indices for ofdm_cal_values */ - OFDM_36M_INDEX = 0, - OFDM_48M_INDEX = 1, - OFDM_54M_INDEX = 2, -}; - -struct zd_chip { - struct zd_usb usb; - struct zd_rf rf; - struct mutex mutex; - /* Base address of FW_REG_ registers */ - zd_addr_t fw_regs_base; - /* EepSetPoint in the vendor driver */ - u8 pwr_cal_values[E2P_CHANNEL_COUNT]; - /* integration values in the vendor driver */ - u8 pwr_int_values[E2P_CHANNEL_COUNT]; - /* SetPointOFDM in the vendor driver */ - u8 ofdm_cal_values[3][E2P_CHANNEL_COUNT]; - u16 link_led; - unsigned int pa_type:4, - patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1, - new_phy_layout:1, al2230s_bit:1, - supports_tx_led:1; -}; - -static inline struct zd_chip *zd_usb_to_chip(struct zd_usb *usb) -{ - return container_of(usb, struct zd_chip, usb); -} - -static inline struct zd_chip *zd_rf_to_chip(struct zd_rf *rf) -{ - return container_of(rf, struct zd_chip, rf); -} - -#define zd_chip_dev(chip) (&(chip)->usb.intf->dev) - -void zd_chip_init(struct zd_chip *chip, - struct ieee80211_hw *hw, - struct usb_interface *intf); -void zd_chip_clear(struct zd_chip *chip); -int zd_chip_read_mac_addr_fw(struct zd_chip *chip, u8 *addr); -int zd_chip_init_hw(struct zd_chip *chip); -int zd_chip_reset(struct zd_chip *chip); - -static inline int zd_chip_is_zd1211b(struct zd_chip *chip) -{ - return chip->usb.is_zd1211b; -} - -static inline int zd_ioread16v_locked(struct zd_chip *chip, u16 *values, - const zd_addr_t *addresses, - unsigned int count) -{ - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - return zd_usb_ioread16v(&chip->usb, values, addresses, count); -} - -static inline int zd_ioread16_locked(struct zd_chip *chip, u16 *value, - const zd_addr_t addr) -{ - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - return zd_usb_ioread16(&chip->usb, value, addr); -} - -int zd_ioread32v_locked(struct zd_chip *chip, u32 *values, - const zd_addr_t *addresses, unsigned int count); - -static inline int zd_ioread32_locked(struct zd_chip *chip, u32 *value, - const zd_addr_t addr) -{ - return zd_ioread32v_locked(chip, value, &addr, 1); -} - -static inline int zd_iowrite16_locked(struct zd_chip *chip, u16 value, - zd_addr_t addr) -{ - struct zd_ioreq16 ioreq; - - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - ioreq.addr = addr; - ioreq.value = value; - - return zd_usb_iowrite16v(&chip->usb, &ioreq, 1); -} - -int zd_iowrite16a_locked(struct zd_chip *chip, - const struct zd_ioreq16 *ioreqs, unsigned int count); - -int _zd_iowrite32v_locked(struct zd_chip *chip, const struct zd_ioreq32 *ioreqs, - unsigned int count); - -static inline int zd_iowrite32_locked(struct zd_chip *chip, u32 value, - zd_addr_t addr) -{ - struct zd_ioreq32 ioreq; - - ioreq.addr = addr; - ioreq.value = value; - - return _zd_iowrite32v_locked(chip, &ioreq, 1); -} - -int zd_iowrite32a_locked(struct zd_chip *chip, - const struct zd_ioreq32 *ioreqs, unsigned int count); - -static inline int zd_rfwrite_locked(struct zd_chip *chip, u32 value, u8 bits) -{ - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - return zd_usb_rfwrite(&chip->usb, value, bits); -} - -int zd_rfwrite_cr_locked(struct zd_chip *chip, u32 value); - -int zd_rfwritev_locked(struct zd_chip *chip, - const u32* values, unsigned int count, u8 bits); -int zd_rfwritev_cr_locked(struct zd_chip *chip, - const u32* values, unsigned int count); - -/* Locking functions for reading and writing registers. - * The different parameters are intentional. - */ -int zd_ioread16(struct zd_chip *chip, zd_addr_t addr, u16 *value); -int zd_iowrite16(struct zd_chip *chip, zd_addr_t addr, u16 value); -int zd_ioread32(struct zd_chip *chip, zd_addr_t addr, u32 *value); -int zd_iowrite32(struct zd_chip *chip, zd_addr_t addr, u32 value); -int zd_ioread32v(struct zd_chip *chip, const zd_addr_t *addresses, - u32 *values, unsigned int count); -int zd_iowrite32a(struct zd_chip *chip, const struct zd_ioreq32 *ioreqs, - unsigned int count); - -int zd_chip_set_channel(struct zd_chip *chip, u8 channel); -static inline u8 _zd_chip_get_channel(struct zd_chip *chip) -{ - return chip->rf.channel; -} -u8 zd_chip_get_channel(struct zd_chip *chip); -int zd_read_regdomain(struct zd_chip *chip, u8 *regdomain); -int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr); -int zd_write_bssid(struct zd_chip *chip, const u8 *bssid); -int zd_chip_switch_radio_on(struct zd_chip *chip); -int zd_chip_switch_radio_off(struct zd_chip *chip); -int zd_chip_enable_int(struct zd_chip *chip); -void zd_chip_disable_int(struct zd_chip *chip); -int zd_chip_enable_rxtx(struct zd_chip *chip); -void zd_chip_disable_rxtx(struct zd_chip *chip); -int zd_chip_enable_hwint(struct zd_chip *chip); -int zd_chip_disable_hwint(struct zd_chip *chip); -int zd_chip_generic_patch_6m_band(struct zd_chip *chip, int channel); -int zd_chip_set_rts_cts_rate_locked(struct zd_chip *chip, int preamble); - -static inline int zd_get_encryption_type(struct zd_chip *chip, u32 *type) -{ - return zd_ioread32(chip, CR_ENCRYPTION_TYPE, type); -} - -static inline int zd_set_encryption_type(struct zd_chip *chip, u32 type) -{ - return zd_iowrite32(chip, CR_ENCRYPTION_TYPE, type); -} - -static inline int zd_chip_get_basic_rates(struct zd_chip *chip, u16 *cr_rates) -{ - return zd_ioread16(chip, CR_BASIC_RATE_TBL, cr_rates); -} - -int zd_chip_set_basic_rates(struct zd_chip *chip, u16 cr_rates); - -int zd_chip_lock_phy_regs(struct zd_chip *chip); -int zd_chip_unlock_phy_regs(struct zd_chip *chip); - -enum led_status { - ZD_LED_OFF = 0, - ZD_LED_SCANNING = 1, - ZD_LED_ASSOCIATED = 2, -}; - -int zd_chip_control_leds(struct zd_chip *chip, enum led_status status); - -int zd_set_beacon_interval(struct zd_chip *chip, u16 interval, u8 dtim_period, - int type); - -static inline int zd_get_beacon_interval(struct zd_chip *chip, u32 *interval) -{ - return zd_ioread32(chip, CR_BCN_INTERVAL, interval); -} - -struct rx_status; - -u8 zd_rx_rate(const void *rx_frame, const struct rx_status *status); - -struct zd_mc_hash { - u32 low; - u32 high; -}; - -static inline void zd_mc_clear(struct zd_mc_hash *hash) -{ - hash->low = 0; - /* The interfaces must always received broadcasts. - * The hash of the broadcast address ff:ff:ff:ff:ff:ff is 63. - */ - hash->high = 0x80000000; -} - -static inline void zd_mc_add_all(struct zd_mc_hash *hash) -{ - hash->low = hash->high = 0xffffffff; -} - -static inline void zd_mc_add_addr(struct zd_mc_hash *hash, u8 *addr) -{ - unsigned int i = addr[5] >> 2; - if (i < 32) { - hash->low |= 1 << i; - } else { - hash->high |= 1 << (i-32); - } -} - -int zd_chip_set_multicast_hash(struct zd_chip *chip, - struct zd_mc_hash *hash); - -u64 zd_chip_get_tsf(struct zd_chip *chip); - -#endif /* _ZD_CHIP_H */ diff --git a/drivers/net/wireless/zd1211rw/zd_def.h b/drivers/net/wireless/zd1211rw/zd_def.h deleted file mode 100644 index 9a1b013f81be..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_def.h +++ /dev/null @@ -1,70 +0,0 @@ -/* ZD1211 USB-WLAN driver for Linux - * - * Copyright (C) 2005-2007 Ulrich Kunitz - * Copyright (C) 2006-2007 Daniel Drake - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _ZD_DEF_H -#define _ZD_DEF_H - -#include -#include -#include - -typedef u16 __nocast zd_addr_t; - -#define dev_printk_f(level, dev, fmt, args...) \ - dev_printk(level, dev, "%s() " fmt, __func__, ##args) - -#ifdef DEBUG -# define dev_dbg_f(dev, fmt, args...) \ - dev_printk_f(KERN_DEBUG, dev, fmt, ## args) -# define dev_dbg_f_limit(dev, fmt, args...) do { \ - if (net_ratelimit()) \ - dev_printk_f(KERN_DEBUG, dev, fmt, ## args); \ -} while (0) -# define dev_dbg_f_cond(dev, cond, fmt, args...) ({ \ - bool __cond = !!(cond); \ - if (unlikely(__cond)) \ - dev_printk_f(KERN_DEBUG, dev, fmt, ## args); \ -}) -#else -# define dev_dbg_f(dev, fmt, args...) do { (void)(dev); } while (0) -# define dev_dbg_f_limit(dev, fmt, args...) do { (void)(dev); } while (0) -# define dev_dbg_f_cond(dev, cond, fmt, args...) do { (void)(dev); } while (0) -#endif /* DEBUG */ - -#ifdef DEBUG -# define ZD_ASSERT(x) \ -do { \ - if (unlikely(!(x))) { \ - pr_debug("%s:%d ASSERT %s VIOLATED!\n", \ - __FILE__, __LINE__, __stringify(x)); \ - dump_stack(); \ - } \ -} while (0) -#else -# define ZD_ASSERT(x) do { } while (0) -#endif - -#ifdef DEBUG -# define ZD_MEMCLEAR(pointer, size) memset((pointer), 0xff, (size)) -#else -# define ZD_MEMCLEAR(pointer, size) do { } while (0) -#endif - -#endif /* _ZD_DEF_H */ diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c deleted file mode 100644 index c6208a7988e4..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ /dev/null @@ -1,1552 +0,0 @@ -/* ZD1211 USB-WLAN driver for Linux - * - * Copyright (C) 2005-2007 Ulrich Kunitz - * Copyright (C) 2006-2007 Daniel Drake - * Copyright (C) 2006-2007 Michael Wu - * Copyright (C) 2007-2008 Luis R. Rodriguez - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include -#include - -#include "zd_def.h" -#include "zd_chip.h" -#include "zd_mac.h" -#include "zd_rf.h" - -struct zd_reg_alpha2_map { - u32 reg; - char alpha2[2]; -}; - -static struct zd_reg_alpha2_map reg_alpha2_map[] = { - { ZD_REGDOMAIN_FCC, "US" }, - { ZD_REGDOMAIN_IC, "CA" }, - { ZD_REGDOMAIN_ETSI, "DE" }, /* Generic ETSI, use most restrictive */ - { ZD_REGDOMAIN_JAPAN, "JP" }, - { ZD_REGDOMAIN_JAPAN_2, "JP" }, - { ZD_REGDOMAIN_JAPAN_3, "JP" }, - { ZD_REGDOMAIN_SPAIN, "ES" }, - { ZD_REGDOMAIN_FRANCE, "FR" }, -}; - -/* This table contains the hardware specific values for the modulation rates. */ -static const struct ieee80211_rate zd_rates[] = { - { .bitrate = 10, - .hw_value = ZD_CCK_RATE_1M, }, - { .bitrate = 20, - .hw_value = ZD_CCK_RATE_2M, - .hw_value_short = ZD_CCK_RATE_2M | ZD_CCK_PREA_SHORT, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 55, - .hw_value = ZD_CCK_RATE_5_5M, - .hw_value_short = ZD_CCK_RATE_5_5M | ZD_CCK_PREA_SHORT, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 110, - .hw_value = ZD_CCK_RATE_11M, - .hw_value_short = ZD_CCK_RATE_11M | ZD_CCK_PREA_SHORT, - .flags = IEEE80211_RATE_SHORT_PREAMBLE }, - { .bitrate = 60, - .hw_value = ZD_OFDM_RATE_6M, - .flags = 0 }, - { .bitrate = 90, - .hw_value = ZD_OFDM_RATE_9M, - .flags = 0 }, - { .bitrate = 120, - .hw_value = ZD_OFDM_RATE_12M, - .flags = 0 }, - { .bitrate = 180, - .hw_value = ZD_OFDM_RATE_18M, - .flags = 0 }, - { .bitrate = 240, - .hw_value = ZD_OFDM_RATE_24M, - .flags = 0 }, - { .bitrate = 360, - .hw_value = ZD_OFDM_RATE_36M, - .flags = 0 }, - { .bitrate = 480, - .hw_value = ZD_OFDM_RATE_48M, - .flags = 0 }, - { .bitrate = 540, - .hw_value = ZD_OFDM_RATE_54M, - .flags = 0 }, -}; - -/* - * Zydas retry rates table. Each line is listed in the same order as - * in zd_rates[] and contains all the rate used when a packet is sent - * starting with a given rates. Let's consider an example : - * - * "11 Mbits : 4, 3, 2, 1, 0" means : - * - packet is sent using 4 different rates - * - 1st rate is index 3 (ie 11 Mbits) - * - 2nd rate is index 2 (ie 5.5 Mbits) - * - 3rd rate is index 1 (ie 2 Mbits) - * - 4th rate is index 0 (ie 1 Mbits) - */ - -static const struct tx_retry_rate zd_retry_rates[] = { - { /* 1 Mbits */ 1, { 0 }}, - { /* 2 Mbits */ 2, { 1, 0 }}, - { /* 5.5 Mbits */ 3, { 2, 1, 0 }}, - { /* 11 Mbits */ 4, { 3, 2, 1, 0 }}, - { /* 6 Mbits */ 5, { 4, 3, 2, 1, 0 }}, - { /* 9 Mbits */ 6, { 5, 4, 3, 2, 1, 0}}, - { /* 12 Mbits */ 5, { 6, 3, 2, 1, 0 }}, - { /* 18 Mbits */ 6, { 7, 6, 3, 2, 1, 0 }}, - { /* 24 Mbits */ 6, { 8, 6, 3, 2, 1, 0 }}, - { /* 36 Mbits */ 7, { 9, 8, 6, 3, 2, 1, 0 }}, - { /* 48 Mbits */ 8, {10, 9, 8, 6, 3, 2, 1, 0 }}, - { /* 54 Mbits */ 9, {11, 10, 9, 8, 6, 3, 2, 1, 0 }} -}; - -static const struct ieee80211_channel zd_channels[] = { - { .center_freq = 2412, .hw_value = 1 }, - { .center_freq = 2417, .hw_value = 2 }, - { .center_freq = 2422, .hw_value = 3 }, - { .center_freq = 2427, .hw_value = 4 }, - { .center_freq = 2432, .hw_value = 5 }, - { .center_freq = 2437, .hw_value = 6 }, - { .center_freq = 2442, .hw_value = 7 }, - { .center_freq = 2447, .hw_value = 8 }, - { .center_freq = 2452, .hw_value = 9 }, - { .center_freq = 2457, .hw_value = 10 }, - { .center_freq = 2462, .hw_value = 11 }, - { .center_freq = 2467, .hw_value = 12 }, - { .center_freq = 2472, .hw_value = 13 }, - { .center_freq = 2484, .hw_value = 14 }, -}; - -static void housekeeping_init(struct zd_mac *mac); -static void housekeeping_enable(struct zd_mac *mac); -static void housekeeping_disable(struct zd_mac *mac); -static void beacon_init(struct zd_mac *mac); -static void beacon_enable(struct zd_mac *mac); -static void beacon_disable(struct zd_mac *mac); -static void set_rts_cts(struct zd_mac *mac, unsigned int short_preamble); -static int zd_mac_config_beacon(struct ieee80211_hw *hw, - struct sk_buff *beacon, bool in_intr); - -static int zd_reg2alpha2(u8 regdomain, char *alpha2) -{ - unsigned int i; - struct zd_reg_alpha2_map *reg_map; - for (i = 0; i < ARRAY_SIZE(reg_alpha2_map); i++) { - reg_map = ®_alpha2_map[i]; - if (regdomain == reg_map->reg) { - alpha2[0] = reg_map->alpha2[0]; - alpha2[1] = reg_map->alpha2[1]; - return 0; - } - } - return 1; -} - -static int zd_check_signal(struct ieee80211_hw *hw, int signal) -{ - struct zd_mac *mac = zd_hw_mac(hw); - - dev_dbg_f_cond(zd_mac_dev(mac), signal < 0 || signal > 100, - "%s: signal value from device not in range 0..100, " - "but %d.\n", __func__, signal); - - if (signal < 0) - signal = 0; - else if (signal > 100) - signal = 100; - - return signal; -} - -int zd_mac_preinit_hw(struct ieee80211_hw *hw) -{ - int r; - u8 addr[ETH_ALEN]; - struct zd_mac *mac = zd_hw_mac(hw); - - r = zd_chip_read_mac_addr_fw(&mac->chip, addr); - if (r) - return r; - - SET_IEEE80211_PERM_ADDR(hw, addr); - - return 0; -} - -int zd_mac_init_hw(struct ieee80211_hw *hw) -{ - int r; - struct zd_mac *mac = zd_hw_mac(hw); - struct zd_chip *chip = &mac->chip; - char alpha2[2]; - u8 default_regdomain; - - r = zd_chip_enable_int(chip); - if (r) - goto out; - r = zd_chip_init_hw(chip); - if (r) - goto disable_int; - - ZD_ASSERT(!irqs_disabled()); - - r = zd_read_regdomain(chip, &default_regdomain); - if (r) - goto disable_int; - spin_lock_irq(&mac->lock); - mac->regdomain = mac->default_regdomain = default_regdomain; - spin_unlock_irq(&mac->lock); - - /* We must inform the device that we are doing encryption/decryption in - * software at the moment. */ - r = zd_set_encryption_type(chip, ENC_SNIFFER); - if (r) - goto disable_int; - - r = zd_reg2alpha2(mac->regdomain, alpha2); - if (r) - goto disable_int; - - r = regulatory_hint(hw->wiphy, alpha2); -disable_int: - zd_chip_disable_int(chip); -out: - return r; -} - -void zd_mac_clear(struct zd_mac *mac) -{ - flush_workqueue(zd_workqueue); - zd_chip_clear(&mac->chip); - ZD_ASSERT(!spin_is_locked(&mac->lock)); - ZD_MEMCLEAR(mac, sizeof(struct zd_mac)); -} - -static int set_rx_filter(struct zd_mac *mac) -{ - unsigned long flags; - u32 filter = STA_RX_FILTER; - - spin_lock_irqsave(&mac->lock, flags); - if (mac->pass_ctrl) - filter |= RX_FILTER_CTRL; - spin_unlock_irqrestore(&mac->lock, flags); - - return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter); -} - -static int set_mac_and_bssid(struct zd_mac *mac) -{ - int r; - - if (!mac->vif) - return -1; - - r = zd_write_mac_addr(&mac->chip, mac->vif->addr); - if (r) - return r; - - /* Vendor driver after setting MAC either sets BSSID for AP or - * filter for other modes. - */ - if (mac->type != NL80211_IFTYPE_AP) - return set_rx_filter(mac); - else - return zd_write_bssid(&mac->chip, mac->vif->addr); -} - -static int set_mc_hash(struct zd_mac *mac) -{ - struct zd_mc_hash hash; - zd_mc_clear(&hash); - return zd_chip_set_multicast_hash(&mac->chip, &hash); -} - -int zd_op_start(struct ieee80211_hw *hw) -{ - struct zd_mac *mac = zd_hw_mac(hw); - struct zd_chip *chip = &mac->chip; - struct zd_usb *usb = &chip->usb; - int r; - - if (!usb->initialized) { - r = zd_usb_init_hw(usb); - if (r) - goto out; - } - - r = zd_chip_enable_int(chip); - if (r < 0) - goto out; - - r = zd_chip_set_basic_rates(chip, CR_RATES_80211B | CR_RATES_80211G); - if (r < 0) - goto disable_int; - r = set_rx_filter(mac); - if (r) - goto disable_int; - r = set_mc_hash(mac); - if (r) - goto disable_int; - - /* Wait after setting the multicast hash table and powering on - * the radio otherwise interface bring up will fail. This matches - * what the vendor driver did. - */ - msleep(10); - - r = zd_chip_switch_radio_on(chip); - if (r < 0) { - dev_err(zd_chip_dev(chip), - "%s: failed to set radio on\n", __func__); - goto disable_int; - } - r = zd_chip_enable_rxtx(chip); - if (r < 0) - goto disable_radio; - r = zd_chip_enable_hwint(chip); - if (r < 0) - goto disable_rxtx; - - housekeeping_enable(mac); - beacon_enable(mac); - set_bit(ZD_DEVICE_RUNNING, &mac->flags); - return 0; -disable_rxtx: - zd_chip_disable_rxtx(chip); -disable_radio: - zd_chip_switch_radio_off(chip); -disable_int: - zd_chip_disable_int(chip); -out: - return r; -} - -void zd_op_stop(struct ieee80211_hw *hw) -{ - struct zd_mac *mac = zd_hw_mac(hw); - struct zd_chip *chip = &mac->chip; - struct sk_buff *skb; - struct sk_buff_head *ack_wait_queue = &mac->ack_wait_queue; - - clear_bit(ZD_DEVICE_RUNNING, &mac->flags); - - /* The order here deliberately is a little different from the open() - * method, since we need to make sure there is no opportunity for RX - * frames to be processed by mac80211 after we have stopped it. - */ - - zd_chip_disable_rxtx(chip); - beacon_disable(mac); - housekeeping_disable(mac); - flush_workqueue(zd_workqueue); - - zd_chip_disable_hwint(chip); - zd_chip_switch_radio_off(chip); - zd_chip_disable_int(chip); - - - while ((skb = skb_dequeue(ack_wait_queue))) - dev_kfree_skb_any(skb); -} - -int zd_restore_settings(struct zd_mac *mac) -{ - struct sk_buff *beacon; - struct zd_mc_hash multicast_hash; - unsigned int short_preamble; - int r, beacon_interval, beacon_period; - u8 channel; - - dev_dbg_f(zd_mac_dev(mac), "\n"); - - spin_lock_irq(&mac->lock); - multicast_hash = mac->multicast_hash; - short_preamble = mac->short_preamble; - beacon_interval = mac->beacon.interval; - beacon_period = mac->beacon.period; - channel = mac->channel; - spin_unlock_irq(&mac->lock); - - r = set_mac_and_bssid(mac); - if (r < 0) { - dev_dbg_f(zd_mac_dev(mac), "set_mac_and_bssid failed, %d\n", r); - return r; - } - - r = zd_chip_set_channel(&mac->chip, channel); - if (r < 0) { - dev_dbg_f(zd_mac_dev(mac), "zd_chip_set_channel failed, %d\n", - r); - return r; - } - - set_rts_cts(mac, short_preamble); - - r = zd_chip_set_multicast_hash(&mac->chip, &multicast_hash); - if (r < 0) { - dev_dbg_f(zd_mac_dev(mac), - "zd_chip_set_multicast_hash failed, %d\n", r); - return r; - } - - if (mac->type == NL80211_IFTYPE_MESH_POINT || - mac->type == NL80211_IFTYPE_ADHOC || - mac->type == NL80211_IFTYPE_AP) { - if (mac->vif != NULL) { - beacon = ieee80211_beacon_get(mac->hw, mac->vif); - if (beacon) - zd_mac_config_beacon(mac->hw, beacon, false); - } - - zd_set_beacon_interval(&mac->chip, beacon_interval, - beacon_period, mac->type); - - spin_lock_irq(&mac->lock); - mac->beacon.last_update = jiffies; - spin_unlock_irq(&mac->lock); - } - - return 0; -} - -/** - * zd_mac_tx_status - reports tx status of a packet if required - * @hw - a &struct ieee80211_hw pointer - * @skb - a sk-buffer - * @flags: extra flags to set in the TX status info - * @ackssi: ACK signal strength - * @success - True for successful transmission of the frame - * - * This information calls ieee80211_tx_status_irqsafe() if required by the - * control information. It copies the control information into the status - * information. - * - * If no status information has been requested, the skb is freed. - */ -static void zd_mac_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, - int ackssi, struct tx_status *tx_status) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - int i; - int success = 1, retry = 1; - int first_idx; - const struct tx_retry_rate *retries; - - ieee80211_tx_info_clear_status(info); - - if (tx_status) { - success = !tx_status->failure; - retry = tx_status->retry + success; - } - - if (success) { - /* success */ - info->flags |= IEEE80211_TX_STAT_ACK; - } else { - /* failure */ - info->flags &= ~IEEE80211_TX_STAT_ACK; - } - - first_idx = info->status.rates[0].idx; - ZD_ASSERT(0<=first_idx && first_idxcount); - - info->status.rates[0].idx = retries->rate[0]; - info->status.rates[0].count = 1; // (retry > 1 ? 2 : 1); - - for (i=1; istatus.rates[i].idx = retries->rate[i]; - info->status.rates[i].count = 1; // ((i==retry-1) && success ? 1:2); - } - for (; istatus.rates[i].idx = retries->rate[retry - 1]; - info->status.rates[i].count = 1; // (success ? 1:2); - } - if (istatus.rates[i].idx = -1; /* terminate */ - - info->status.ack_signal = zd_check_signal(hw, ackssi); - ieee80211_tx_status_irqsafe(hw, skb); -} - -/** - * zd_mac_tx_failed - callback for failed frames - * @dev: the mac80211 wireless device - * - * This function is called if a frame couldn't be successfully - * transferred. The first frame from the tx queue, will be selected and - * reported as error to the upper layers. - */ -void zd_mac_tx_failed(struct urb *urb) -{ - struct ieee80211_hw * hw = zd_usb_to_hw(urb->context); - struct zd_mac *mac = zd_hw_mac(hw); - struct sk_buff_head *q = &mac->ack_wait_queue; - struct sk_buff *skb; - struct tx_status *tx_status = (struct tx_status *)urb->transfer_buffer; - unsigned long flags; - int success = !tx_status->failure; - int retry = tx_status->retry + success; - int found = 0; - int i, position = 0; - - q = &mac->ack_wait_queue; - spin_lock_irqsave(&q->lock, flags); - - skb_queue_walk(q, skb) { - struct ieee80211_hdr *tx_hdr; - struct ieee80211_tx_info *info; - int first_idx, final_idx; - const struct tx_retry_rate *retries; - u8 final_rate; - - position ++; - - /* if the hardware reports a failure and we had a 802.11 ACK - * pending, then we skip the first skb when searching for a - * matching frame */ - if (tx_status->failure && mac->ack_pending && - skb_queue_is_first(q, skb)) { - continue; - } - - tx_hdr = (struct ieee80211_hdr *)skb->data; - - /* we skip all frames not matching the reported destination */ - if (unlikely(memcmp(tx_hdr->addr1, tx_status->mac, ETH_ALEN))) { - continue; - } - - /* we skip all frames not matching the reported final rate */ - - info = IEEE80211_SKB_CB(skb); - first_idx = info->status.rates[0].idx; - ZD_ASSERT(0<=first_idx && first_idx retries->count) - continue; - - final_idx = retries->rate[retry - 1]; - final_rate = zd_rates[final_idx].hw_value; - - if (final_rate != tx_status->rate) { - continue; - } - - found = 1; - break; - } - - if (found) { - for (i=1; i<=position; i++) { - skb = __skb_dequeue(q); - zd_mac_tx_status(hw, skb, - mac->ack_pending ? mac->ack_signal : 0, - i == position ? tx_status : NULL); - mac->ack_pending = 0; - } - } - - spin_unlock_irqrestore(&q->lock, flags); -} - -/** - * zd_mac_tx_to_dev - callback for USB layer - * @skb: a &sk_buff pointer - * @error: error value, 0 if transmission successful - * - * Informs the MAC layer that the frame has successfully transferred to the - * device. If an ACK is required and the transfer to the device has been - * successful, the packets are put on the @ack_wait_queue with - * the control set removed. - */ -void zd_mac_tx_to_dev(struct sk_buff *skb, int error) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hw *hw = info->rate_driver_data[0]; - struct zd_mac *mac = zd_hw_mac(hw); - - ieee80211_tx_info_clear_status(info); - - skb_pull(skb, sizeof(struct zd_ctrlset)); - if (unlikely(error || - (info->flags & IEEE80211_TX_CTL_NO_ACK))) { - /* - * FIXME : do we need to fill in anything ? - */ - ieee80211_tx_status_irqsafe(hw, skb); - } else { - struct sk_buff_head *q = &mac->ack_wait_queue; - - skb_queue_tail(q, skb); - while (skb_queue_len(q) > ZD_MAC_MAX_ACK_WAITERS) { - zd_mac_tx_status(hw, skb_dequeue(q), - mac->ack_pending ? mac->ack_signal : 0, - NULL); - mac->ack_pending = 0; - } - } -} - -static int zd_calc_tx_length_us(u8 *service, u8 zd_rate, u16 tx_length) -{ - /* ZD_PURE_RATE() must be used to remove the modulation type flag of - * the zd-rate values. - */ - static const u8 rate_divisor[] = { - [ZD_PURE_RATE(ZD_CCK_RATE_1M)] = 1, - [ZD_PURE_RATE(ZD_CCK_RATE_2M)] = 2, - /* Bits must be doubled. */ - [ZD_PURE_RATE(ZD_CCK_RATE_5_5M)] = 11, - [ZD_PURE_RATE(ZD_CCK_RATE_11M)] = 11, - [ZD_PURE_RATE(ZD_OFDM_RATE_6M)] = 6, - [ZD_PURE_RATE(ZD_OFDM_RATE_9M)] = 9, - [ZD_PURE_RATE(ZD_OFDM_RATE_12M)] = 12, - [ZD_PURE_RATE(ZD_OFDM_RATE_18M)] = 18, - [ZD_PURE_RATE(ZD_OFDM_RATE_24M)] = 24, - [ZD_PURE_RATE(ZD_OFDM_RATE_36M)] = 36, - [ZD_PURE_RATE(ZD_OFDM_RATE_48M)] = 48, - [ZD_PURE_RATE(ZD_OFDM_RATE_54M)] = 54, - }; - - u32 bits = (u32)tx_length * 8; - u32 divisor; - - divisor = rate_divisor[ZD_PURE_RATE(zd_rate)]; - if (divisor == 0) - return -EINVAL; - - switch (zd_rate) { - case ZD_CCK_RATE_5_5M: - bits = (2*bits) + 10; /* round up to the next integer */ - break; - case ZD_CCK_RATE_11M: - if (service) { - u32 t = bits % 11; - *service &= ~ZD_PLCP_SERVICE_LENGTH_EXTENSION; - if (0 < t && t <= 3) { - *service |= ZD_PLCP_SERVICE_LENGTH_EXTENSION; - } - } - bits += 10; /* round up to the next integer */ - break; - } - - return bits/divisor; -} - -static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs, - struct ieee80211_hdr *header, - struct ieee80211_tx_info *info) -{ - /* - * CONTROL TODO: - * - if backoff needed, enable bit 0 - * - if burst (backoff not needed) disable bit 0 - */ - - cs->control = 0; - - /* First fragment */ - if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) - cs->control |= ZD_CS_NEED_RANDOM_BACKOFF; - - /* No ACK expected (multicast, etc.) */ - if (info->flags & IEEE80211_TX_CTL_NO_ACK) - cs->control |= ZD_CS_NO_ACK; - - /* PS-POLL */ - if (ieee80211_is_pspoll(header->frame_control)) - cs->control |= ZD_CS_PS_POLL_FRAME; - - if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) - cs->control |= ZD_CS_RTS; - - if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) - cs->control |= ZD_CS_SELF_CTS; - - /* FIXME: Management frame? */ -} - -static bool zd_mac_match_cur_beacon(struct zd_mac *mac, struct sk_buff *beacon) -{ - if (!mac->beacon.cur_beacon) - return false; - - if (mac->beacon.cur_beacon->len != beacon->len) - return false; - - return !memcmp(beacon->data, mac->beacon.cur_beacon->data, beacon->len); -} - -static void zd_mac_free_cur_beacon_locked(struct zd_mac *mac) -{ - ZD_ASSERT(mutex_is_locked(&mac->chip.mutex)); - - kfree_skb(mac->beacon.cur_beacon); - mac->beacon.cur_beacon = NULL; -} - -static void zd_mac_free_cur_beacon(struct zd_mac *mac) -{ - mutex_lock(&mac->chip.mutex); - zd_mac_free_cur_beacon_locked(mac); - mutex_unlock(&mac->chip.mutex); -} - -static int zd_mac_config_beacon(struct ieee80211_hw *hw, struct sk_buff *beacon, - bool in_intr) -{ - struct zd_mac *mac = zd_hw_mac(hw); - int r, ret, num_cmds, req_pos = 0; - u32 tmp, j = 0; - /* 4 more bytes for tail CRC */ - u32 full_len = beacon->len + 4; - unsigned long end_jiffies, message_jiffies; - struct zd_ioreq32 *ioreqs; - - mutex_lock(&mac->chip.mutex); - - /* Check if hw already has this beacon. */ - if (zd_mac_match_cur_beacon(mac, beacon)) { - r = 0; - goto out_nofree; - } - - /* Alloc memory for full beacon write at once. */ - num_cmds = 1 + zd_chip_is_zd1211b(&mac->chip) + full_len; - ioreqs = kmalloc(num_cmds * sizeof(struct zd_ioreq32), GFP_KERNEL); - if (!ioreqs) { - r = -ENOMEM; - goto out_nofree; - } - - r = zd_iowrite32_locked(&mac->chip, 0, CR_BCN_FIFO_SEMAPHORE); - if (r < 0) - goto out; - r = zd_ioread32_locked(&mac->chip, &tmp, CR_BCN_FIFO_SEMAPHORE); - if (r < 0) - goto release_sema; - if (in_intr && tmp & 0x2) { - r = -EBUSY; - goto release_sema; - } - - end_jiffies = jiffies + HZ / 2; /*~500ms*/ - message_jiffies = jiffies + HZ / 10; /*~100ms*/ - while (tmp & 0x2) { - r = zd_ioread32_locked(&mac->chip, &tmp, CR_BCN_FIFO_SEMAPHORE); - if (r < 0) - goto release_sema; - if (time_is_before_eq_jiffies(message_jiffies)) { - message_jiffies = jiffies + HZ / 10; - dev_err(zd_mac_dev(mac), - "CR_BCN_FIFO_SEMAPHORE not ready\n"); - if (time_is_before_eq_jiffies(end_jiffies)) { - dev_err(zd_mac_dev(mac), - "Giving up beacon config.\n"); - r = -ETIMEDOUT; - goto reset_device; - } - } - msleep(20); - } - - ioreqs[req_pos].addr = CR_BCN_FIFO; - ioreqs[req_pos].value = full_len - 1; - req_pos++; - if (zd_chip_is_zd1211b(&mac->chip)) { - ioreqs[req_pos].addr = CR_BCN_LENGTH; - ioreqs[req_pos].value = full_len - 1; - req_pos++; - } - - for (j = 0 ; j < beacon->len; j++) { - ioreqs[req_pos].addr = CR_BCN_FIFO; - ioreqs[req_pos].value = *((u8 *)(beacon->data + j)); - req_pos++; - } - - for (j = 0; j < 4; j++) { - ioreqs[req_pos].addr = CR_BCN_FIFO; - ioreqs[req_pos].value = 0x0; - req_pos++; - } - - BUG_ON(req_pos != num_cmds); - - r = zd_iowrite32a_locked(&mac->chip, ioreqs, num_cmds); - -release_sema: - /* - * Try very hard to release device beacon semaphore, as otherwise - * device/driver can be left in unusable state. - */ - end_jiffies = jiffies + HZ / 2; /*~500ms*/ - ret = zd_iowrite32_locked(&mac->chip, 1, CR_BCN_FIFO_SEMAPHORE); - while (ret < 0) { - if (in_intr || time_is_before_eq_jiffies(end_jiffies)) { - ret = -ETIMEDOUT; - break; - } - - msleep(20); - ret = zd_iowrite32_locked(&mac->chip, 1, CR_BCN_FIFO_SEMAPHORE); - } - - if (ret < 0) - dev_err(zd_mac_dev(mac), "Could not release " - "CR_BCN_FIFO_SEMAPHORE!\n"); - if (r < 0 || ret < 0) { - if (r >= 0) - r = ret; - - /* We don't know if beacon was written successfully or not, - * so clear current. */ - zd_mac_free_cur_beacon_locked(mac); - - goto out; - } - - /* Beacon has now been written successfully, update current. */ - zd_mac_free_cur_beacon_locked(mac); - mac->beacon.cur_beacon = beacon; - beacon = NULL; - - /* 802.11b/g 2.4G CCK 1Mb - * 802.11a, not yet implemented, uses different values (see GPL vendor - * driver) - */ - r = zd_iowrite32_locked(&mac->chip, 0x00000400 | (full_len << 19), - CR_BCN_PLCP_CFG); -out: - kfree(ioreqs); -out_nofree: - kfree_skb(beacon); - mutex_unlock(&mac->chip.mutex); - - return r; - -reset_device: - zd_mac_free_cur_beacon_locked(mac); - kfree_skb(beacon); - - mutex_unlock(&mac->chip.mutex); - kfree(ioreqs); - - /* semaphore stuck, reset device to avoid fw freeze later */ - dev_warn(zd_mac_dev(mac), "CR_BCN_FIFO_SEMAPHORE stuck, " - "resetting device..."); - usb_queue_reset_device(mac->chip.usb.intf); - - return r; -} - -static int fill_ctrlset(struct zd_mac *mac, - struct sk_buff *skb) -{ - int r; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - unsigned int frag_len = skb->len + FCS_LEN; - unsigned int packet_length; - struct ieee80211_rate *txrate; - struct zd_ctrlset *cs = (struct zd_ctrlset *) - skb_push(skb, sizeof(struct zd_ctrlset)); - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - ZD_ASSERT(frag_len <= 0xffff); - - /* - * Firmware computes the duration itself (for all frames except PSPoll) - * and needs the field set to 0 at input, otherwise firmware messes up - * duration_id and sets bits 14 and 15 on. - */ - if (!ieee80211_is_pspoll(hdr->frame_control)) - hdr->duration_id = 0; - - txrate = ieee80211_get_tx_rate(mac->hw, info); - - cs->modulation = txrate->hw_value; - if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) - cs->modulation = txrate->hw_value_short; - - cs->tx_length = cpu_to_le16(frag_len); - - cs_set_control(mac, cs, hdr, info); - - packet_length = frag_len + sizeof(struct zd_ctrlset) + 10; - ZD_ASSERT(packet_length <= 0xffff); - /* ZD1211B: Computing the length difference this way, gives us - * flexibility to compute the packet length. - */ - cs->packet_length = cpu_to_le16(zd_chip_is_zd1211b(&mac->chip) ? - packet_length - frag_len : packet_length); - - /* - * CURRENT LENGTH: - * - transmit frame length in microseconds - * - seems to be derived from frame length - * - see Cal_Us_Service() in zdinlinef.h - * - if macp->bTxBurstEnable is enabled, then multiply by 4 - * - bTxBurstEnable is never set in the vendor driver - * - * SERVICE: - * - "for PLCP configuration" - * - always 0 except in some situations at 802.11b 11M - * - see line 53 of zdinlinef.h - */ - cs->service = 0; - r = zd_calc_tx_length_us(&cs->service, ZD_RATE(cs->modulation), - le16_to_cpu(cs->tx_length)); - if (r < 0) - return r; - cs->current_length = cpu_to_le16(r); - cs->next_frame_length = 0; - - return 0; -} - -/** - * zd_op_tx - transmits a network frame to the device - * - * @dev: mac80211 hardware device - * @skb: socket buffer - * @control: the control structure - * - * This function transmit an IEEE 802.11 network frame to the device. The - * control block of the skbuff will be initialized. If necessary the incoming - * mac80211 queues will be stopped. - */ -static void zd_op_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) -{ - struct zd_mac *mac = zd_hw_mac(hw); - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - int r; - - r = fill_ctrlset(mac, skb); - if (r) - goto fail; - - info->rate_driver_data[0] = hw; - - r = zd_usb_tx(&mac->chip.usb, skb); - if (r) - goto fail; - return; - -fail: - dev_kfree_skb(skb); -} - -/** - * filter_ack - filters incoming packets for acknowledgements - * @dev: the mac80211 device - * @rx_hdr: received header - * @stats: the status for the received packet - * - * This functions looks for ACK packets and tries to match them with the - * frames in the tx queue. If a match is found the frame will be dequeued and - * the upper layers is informed about the successful transmission. If - * mac80211 queues have been stopped and the number of frames still to be - * transmitted is low the queues will be opened again. - * - * Returns 1 if the frame was an ACK, 0 if it was ignored. - */ -static int filter_ack(struct ieee80211_hw *hw, struct ieee80211_hdr *rx_hdr, - struct ieee80211_rx_status *stats) -{ - struct zd_mac *mac = zd_hw_mac(hw); - struct sk_buff *skb; - struct sk_buff_head *q; - unsigned long flags; - int found = 0; - int i, position = 0; - - if (!ieee80211_is_ack(rx_hdr->frame_control)) - return 0; - - q = &mac->ack_wait_queue; - spin_lock_irqsave(&q->lock, flags); - skb_queue_walk(q, skb) { - struct ieee80211_hdr *tx_hdr; - - position ++; - - if (mac->ack_pending && skb_queue_is_first(q, skb)) - continue; - - tx_hdr = (struct ieee80211_hdr *)skb->data; - if (likely(!memcmp(tx_hdr->addr2, rx_hdr->addr1, ETH_ALEN))) - { - found = 1; - break; - } - } - - if (found) { - for (i=1; iack_pending ? mac->ack_signal : 0, - NULL); - mac->ack_pending = 0; - } - - mac->ack_pending = 1; - mac->ack_signal = stats->signal; - - /* Prevent pending tx-packet on AP-mode */ - if (mac->type == NL80211_IFTYPE_AP) { - skb = __skb_dequeue(q); - zd_mac_tx_status(hw, skb, mac->ack_signal, NULL); - mac->ack_pending = 0; - } - } - - spin_unlock_irqrestore(&q->lock, flags); - return 1; -} - -int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length) -{ - struct zd_mac *mac = zd_hw_mac(hw); - struct ieee80211_rx_status stats; - const struct rx_status *status; - struct sk_buff *skb; - int bad_frame = 0; - __le16 fc; - int need_padding; - int i; - u8 rate; - - if (length < ZD_PLCP_HEADER_SIZE + 10 /* IEEE80211_1ADDR_LEN */ + - FCS_LEN + sizeof(struct rx_status)) - return -EINVAL; - - memset(&stats, 0, sizeof(stats)); - - /* Note about pass_failed_fcs and pass_ctrl access below: - * mac locking intentionally omitted here, as this is the only unlocked - * reader and the only writer is configure_filter. Plus, if there were - * any races accessing these variables, it wouldn't really matter. - * If mac80211 ever provides a way for us to access filter flags - * from outside configure_filter, we could improve on this. Also, this - * situation may change once we implement some kind of DMA-into-skb - * RX path. */ - - /* Caller has to ensure that length >= sizeof(struct rx_status). */ - status = (struct rx_status *) - (buffer + (length - sizeof(struct rx_status))); - if (status->frame_status & ZD_RX_ERROR) { - if (mac->pass_failed_fcs && - (status->frame_status & ZD_RX_CRC32_ERROR)) { - stats.flag |= RX_FLAG_FAILED_FCS_CRC; - bad_frame = 1; - } else { - return -EINVAL; - } - } - - stats.freq = zd_channels[_zd_chip_get_channel(&mac->chip) - 1].center_freq; - stats.band = IEEE80211_BAND_2GHZ; - stats.signal = zd_check_signal(hw, status->signal_strength); - - rate = zd_rx_rate(buffer, status); - - /* todo: return index in the big switches in zd_rx_rate instead */ - for (i = 0; i < mac->band.n_bitrates; i++) - if (rate == mac->band.bitrates[i].hw_value) - stats.rate_idx = i; - - length -= ZD_PLCP_HEADER_SIZE + sizeof(struct rx_status); - buffer += ZD_PLCP_HEADER_SIZE; - - /* Except for bad frames, filter each frame to see if it is an ACK, in - * which case our internal TX tracking is updated. Normally we then - * bail here as there's no need to pass ACKs on up to the stack, but - * there is also the case where the stack has requested us to pass - * control frames on up (pass_ctrl) which we must consider. */ - if (!bad_frame && - filter_ack(hw, (struct ieee80211_hdr *)buffer, &stats) - && !mac->pass_ctrl) - return 0; - - fc = get_unaligned((__le16*)buffer); - need_padding = ieee80211_is_data_qos(fc) ^ ieee80211_has_a4(fc); - - skb = dev_alloc_skb(length + (need_padding ? 2 : 0)); - if (skb == NULL) - return -ENOMEM; - if (need_padding) { - /* Make sure the payload data is 4 byte aligned. */ - skb_reserve(skb, 2); - } - - /* FIXME : could we avoid this big memcpy ? */ - memcpy(skb_put(skb, length), buffer, length); - - memcpy(IEEE80211_SKB_RXCB(skb), &stats, sizeof(stats)); - ieee80211_rx_irqsafe(hw, skb); - return 0; -} - -static int zd_op_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct zd_mac *mac = zd_hw_mac(hw); - - /* using NL80211_IFTYPE_UNSPECIFIED to indicate no mode selected */ - if (mac->type != NL80211_IFTYPE_UNSPECIFIED) - return -EOPNOTSUPP; - - switch (vif->type) { - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_MESH_POINT: - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_AP: - mac->type = vif->type; - break; - default: - return -EOPNOTSUPP; - } - - mac->vif = vif; - - return set_mac_and_bssid(mac); -} - -static void zd_op_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct zd_mac *mac = zd_hw_mac(hw); - mac->type = NL80211_IFTYPE_UNSPECIFIED; - mac->vif = NULL; - zd_set_beacon_interval(&mac->chip, 0, 0, NL80211_IFTYPE_UNSPECIFIED); - zd_write_mac_addr(&mac->chip, NULL); - - zd_mac_free_cur_beacon(mac); -} - -static int zd_op_config(struct ieee80211_hw *hw, u32 changed) -{ - struct zd_mac *mac = zd_hw_mac(hw); - struct ieee80211_conf *conf = &hw->conf; - - spin_lock_irq(&mac->lock); - mac->channel = conf->chandef.chan->hw_value; - spin_unlock_irq(&mac->lock); - - return zd_chip_set_channel(&mac->chip, conf->chandef.chan->hw_value); -} - -static void zd_beacon_done(struct zd_mac *mac) -{ - struct sk_buff *skb, *beacon; - - if (!test_bit(ZD_DEVICE_RUNNING, &mac->flags)) - return; - if (!mac->vif || mac->vif->type != NL80211_IFTYPE_AP) - return; - - /* - * Send out buffered broad- and multicast frames. - */ - while (!ieee80211_queue_stopped(mac->hw, 0)) { - skb = ieee80211_get_buffered_bc(mac->hw, mac->vif); - if (!skb) - break; - zd_op_tx(mac->hw, NULL, skb); - } - - /* - * Fetch next beacon so that tim_count is updated. - */ - beacon = ieee80211_beacon_get(mac->hw, mac->vif); - if (beacon) - zd_mac_config_beacon(mac->hw, beacon, true); - - spin_lock_irq(&mac->lock); - mac->beacon.last_update = jiffies; - spin_unlock_irq(&mac->lock); -} - -static void zd_process_intr(struct work_struct *work) -{ - u16 int_status; - unsigned long flags; - struct zd_mac *mac = container_of(work, struct zd_mac, process_intr); - - spin_lock_irqsave(&mac->lock, flags); - int_status = le16_to_cpu(*(__le16 *)(mac->intr_buffer + 4)); - spin_unlock_irqrestore(&mac->lock, flags); - - if (int_status & INT_CFG_NEXT_BCN) { - /*dev_dbg_f_limit(zd_mac_dev(mac), "INT_CFG_NEXT_BCN\n");*/ - zd_beacon_done(mac); - } else { - dev_dbg_f(zd_mac_dev(mac), "Unsupported interrupt\n"); - } - - zd_chip_enable_hwint(&mac->chip); -} - - -static u64 zd_op_prepare_multicast(struct ieee80211_hw *hw, - struct netdev_hw_addr_list *mc_list) -{ - struct zd_mac *mac = zd_hw_mac(hw); - struct zd_mc_hash hash; - struct netdev_hw_addr *ha; - - zd_mc_clear(&hash); - - netdev_hw_addr_list_for_each(ha, mc_list) { - dev_dbg_f(zd_mac_dev(mac), "mc addr %pM\n", ha->addr); - zd_mc_add_addr(&hash, ha->addr); - } - - return hash.low | ((u64)hash.high << 32); -} - -#define SUPPORTED_FIF_FLAGS \ - (FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL | FIF_CONTROL | \ - FIF_OTHER_BSS | FIF_BCN_PRBRESP_PROMISC) -static void zd_op_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *new_flags, - u64 multicast) -{ - struct zd_mc_hash hash = { - .low = multicast, - .high = multicast >> 32, - }; - struct zd_mac *mac = zd_hw_mac(hw); - unsigned long flags; - int r; - - /* Only deal with supported flags */ - changed_flags &= SUPPORTED_FIF_FLAGS; - *new_flags &= SUPPORTED_FIF_FLAGS; - - /* - * If multicast parameter (as returned by zd_op_prepare_multicast) - * has changed, no bit in changed_flags is set. To handle this - * situation, we do not return if changed_flags is 0. If we do so, - * we will have some issue with IPv6 which uses multicast for link - * layer address resolution. - */ - if (*new_flags & (FIF_PROMISC_IN_BSS | FIF_ALLMULTI)) - zd_mc_add_all(&hash); - - spin_lock_irqsave(&mac->lock, flags); - mac->pass_failed_fcs = !!(*new_flags & FIF_FCSFAIL); - mac->pass_ctrl = !!(*new_flags & FIF_CONTROL); - mac->multicast_hash = hash; - spin_unlock_irqrestore(&mac->lock, flags); - - zd_chip_set_multicast_hash(&mac->chip, &hash); - - if (changed_flags & FIF_CONTROL) { - r = set_rx_filter(mac); - if (r) - dev_err(zd_mac_dev(mac), "set_rx_filter error %d\n", r); - } - - /* no handling required for FIF_OTHER_BSS as we don't currently - * do BSSID filtering */ - /* FIXME: in future it would be nice to enable the probe response - * filter (so that the driver doesn't see them) until - * FIF_BCN_PRBRESP_PROMISC is set. however due to atomicity here, we'd - * have to schedule work to enable prbresp reception, which might - * happen too late. For now we'll just listen and forward them all the - * time. */ -} - -static void set_rts_cts(struct zd_mac *mac, unsigned int short_preamble) -{ - mutex_lock(&mac->chip.mutex); - zd_chip_set_rts_cts_rate_locked(&mac->chip, short_preamble); - mutex_unlock(&mac->chip.mutex); -} - -static void zd_op_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *bss_conf, - u32 changes) -{ - struct zd_mac *mac = zd_hw_mac(hw); - int associated; - - dev_dbg_f(zd_mac_dev(mac), "changes: %x\n", changes); - - if (mac->type == NL80211_IFTYPE_MESH_POINT || - mac->type == NL80211_IFTYPE_ADHOC || - mac->type == NL80211_IFTYPE_AP) { - associated = true; - if (changes & BSS_CHANGED_BEACON) { - struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); - - if (beacon) { - zd_chip_disable_hwint(&mac->chip); - zd_mac_config_beacon(hw, beacon, false); - zd_chip_enable_hwint(&mac->chip); - } - } - - if (changes & BSS_CHANGED_BEACON_ENABLED) { - u16 interval = 0; - u8 period = 0; - - if (bss_conf->enable_beacon) { - period = bss_conf->dtim_period; - interval = bss_conf->beacon_int; - } - - spin_lock_irq(&mac->lock); - mac->beacon.period = period; - mac->beacon.interval = interval; - mac->beacon.last_update = jiffies; - spin_unlock_irq(&mac->lock); - - zd_set_beacon_interval(&mac->chip, interval, period, - mac->type); - } - } else - associated = is_valid_ether_addr(bss_conf->bssid); - - spin_lock_irq(&mac->lock); - mac->associated = associated; - spin_unlock_irq(&mac->lock); - - /* TODO: do hardware bssid filtering */ - - if (changes & BSS_CHANGED_ERP_PREAMBLE) { - spin_lock_irq(&mac->lock); - mac->short_preamble = bss_conf->use_short_preamble; - spin_unlock_irq(&mac->lock); - - set_rts_cts(mac, bss_conf->use_short_preamble); - } -} - -static u64 zd_op_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -{ - struct zd_mac *mac = zd_hw_mac(hw); - return zd_chip_get_tsf(&mac->chip); -} - -static const struct ieee80211_ops zd_ops = { - .tx = zd_op_tx, - .start = zd_op_start, - .stop = zd_op_stop, - .add_interface = zd_op_add_interface, - .remove_interface = zd_op_remove_interface, - .config = zd_op_config, - .prepare_multicast = zd_op_prepare_multicast, - .configure_filter = zd_op_configure_filter, - .bss_info_changed = zd_op_bss_info_changed, - .get_tsf = zd_op_get_tsf, -}; - -struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf) -{ - struct zd_mac *mac; - struct ieee80211_hw *hw; - - hw = ieee80211_alloc_hw(sizeof(struct zd_mac), &zd_ops); - if (!hw) { - dev_dbg_f(&intf->dev, "out of memory\n"); - return NULL; - } - - mac = zd_hw_mac(hw); - - memset(mac, 0, sizeof(*mac)); - spin_lock_init(&mac->lock); - mac->hw = hw; - - mac->type = NL80211_IFTYPE_UNSPECIFIED; - - memcpy(mac->channels, zd_channels, sizeof(zd_channels)); - memcpy(mac->rates, zd_rates, sizeof(zd_rates)); - mac->band.n_bitrates = ARRAY_SIZE(zd_rates); - mac->band.bitrates = mac->rates; - mac->band.n_channels = ARRAY_SIZE(zd_channels); - mac->band.channels = mac->channels; - - hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &mac->band; - - hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_SIGNAL_UNSPEC | - IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | - IEEE80211_HW_MFP_CAPABLE; - - hw->wiphy->interface_modes = - BIT(NL80211_IFTYPE_MESH_POINT) | - BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_AP); - - hw->max_signal = 100; - hw->queues = 1; - hw->extra_tx_headroom = sizeof(struct zd_ctrlset); - - /* - * Tell mac80211 that we support multi rate retries - */ - hw->max_rates = IEEE80211_TX_MAX_RATES; - hw->max_rate_tries = 18; /* 9 rates * 2 retries/rate */ - - skb_queue_head_init(&mac->ack_wait_queue); - mac->ack_pending = 0; - - zd_chip_init(&mac->chip, hw, intf); - housekeeping_init(mac); - beacon_init(mac); - INIT_WORK(&mac->process_intr, zd_process_intr); - - SET_IEEE80211_DEV(hw, &intf->dev); - return hw; -} - -#define BEACON_WATCHDOG_DELAY round_jiffies_relative(HZ) - -static void beacon_watchdog_handler(struct work_struct *work) -{ - struct zd_mac *mac = - container_of(work, struct zd_mac, beacon.watchdog_work.work); - struct sk_buff *beacon; - unsigned long timeout; - int interval, period; - - if (!test_bit(ZD_DEVICE_RUNNING, &mac->flags)) - goto rearm; - if (mac->type != NL80211_IFTYPE_AP || !mac->vif) - goto rearm; - - spin_lock_irq(&mac->lock); - interval = mac->beacon.interval; - period = mac->beacon.period; - timeout = mac->beacon.last_update + - msecs_to_jiffies(interval * 1024 / 1000) * 3; - spin_unlock_irq(&mac->lock); - - if (interval > 0 && time_is_before_jiffies(timeout)) { - dev_dbg_f(zd_mac_dev(mac), "beacon interrupt stalled, " - "restarting. " - "(interval: %d, dtim: %d)\n", - interval, period); - - zd_chip_disable_hwint(&mac->chip); - - beacon = ieee80211_beacon_get(mac->hw, mac->vif); - if (beacon) { - zd_mac_free_cur_beacon(mac); - - zd_mac_config_beacon(mac->hw, beacon, false); - } - - zd_set_beacon_interval(&mac->chip, interval, period, mac->type); - - zd_chip_enable_hwint(&mac->chip); - - spin_lock_irq(&mac->lock); - mac->beacon.last_update = jiffies; - spin_unlock_irq(&mac->lock); - } - -rearm: - queue_delayed_work(zd_workqueue, &mac->beacon.watchdog_work, - BEACON_WATCHDOG_DELAY); -} - -static void beacon_init(struct zd_mac *mac) -{ - INIT_DELAYED_WORK(&mac->beacon.watchdog_work, beacon_watchdog_handler); -} - -static void beacon_enable(struct zd_mac *mac) -{ - dev_dbg_f(zd_mac_dev(mac), "\n"); - - mac->beacon.last_update = jiffies; - queue_delayed_work(zd_workqueue, &mac->beacon.watchdog_work, - BEACON_WATCHDOG_DELAY); -} - -static void beacon_disable(struct zd_mac *mac) -{ - dev_dbg_f(zd_mac_dev(mac), "\n"); - cancel_delayed_work_sync(&mac->beacon.watchdog_work); - - zd_mac_free_cur_beacon(mac); -} - -#define LINK_LED_WORK_DELAY HZ - -static void link_led_handler(struct work_struct *work) -{ - struct zd_mac *mac = - container_of(work, struct zd_mac, housekeeping.link_led_work.work); - struct zd_chip *chip = &mac->chip; - int is_associated; - int r; - - if (!test_bit(ZD_DEVICE_RUNNING, &mac->flags)) - goto requeue; - - spin_lock_irq(&mac->lock); - is_associated = mac->associated; - spin_unlock_irq(&mac->lock); - - r = zd_chip_control_leds(chip, - is_associated ? ZD_LED_ASSOCIATED : ZD_LED_SCANNING); - if (r) - dev_dbg_f(zd_mac_dev(mac), "zd_chip_control_leds error %d\n", r); - -requeue: - queue_delayed_work(zd_workqueue, &mac->housekeeping.link_led_work, - LINK_LED_WORK_DELAY); -} - -static void housekeeping_init(struct zd_mac *mac) -{ - INIT_DELAYED_WORK(&mac->housekeeping.link_led_work, link_led_handler); -} - -static void housekeeping_enable(struct zd_mac *mac) -{ - dev_dbg_f(zd_mac_dev(mac), "\n"); - queue_delayed_work(zd_workqueue, &mac->housekeeping.link_led_work, - 0); -} - -static void housekeeping_disable(struct zd_mac *mac) -{ - dev_dbg_f(zd_mac_dev(mac), "\n"); - cancel_delayed_work_sync(&mac->housekeeping.link_led_work); - zd_chip_control_leds(&mac->chip, ZD_LED_OFF); -} diff --git a/drivers/net/wireless/zd1211rw/zd_mac.h b/drivers/net/wireless/zd1211rw/zd_mac.h deleted file mode 100644 index c01eca859f95..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_mac.h +++ /dev/null @@ -1,328 +0,0 @@ -/* ZD1211 USB-WLAN driver for Linux - * - * Copyright (C) 2005-2007 Ulrich Kunitz - * Copyright (C) 2006-2007 Daniel Drake - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _ZD_MAC_H -#define _ZD_MAC_H - -#include -#include - -#include "zd_chip.h" - -struct zd_ctrlset { - u8 modulation; - __le16 tx_length; - u8 control; - /* stores only the difference to tx_length on ZD1211B */ - __le16 packet_length; - __le16 current_length; - u8 service; - __le16 next_frame_length; -} __packed; - -#define ZD_CS_RESERVED_SIZE 25 - -/* The field modulation of struct zd_ctrlset controls the bit rate, the use - * of short or long preambles in 802.11b (CCK mode) or the use of 802.11a or - * 802.11g in OFDM mode. - * - * The term zd-rate is used for the combination of the modulation type flag - * and the "pure" rate value. - */ -#define ZD_PURE_RATE_MASK 0x0f -#define ZD_MODULATION_TYPE_MASK 0x10 -#define ZD_RATE_MASK (ZD_PURE_RATE_MASK|ZD_MODULATION_TYPE_MASK) -#define ZD_PURE_RATE(modulation) ((modulation) & ZD_PURE_RATE_MASK) -#define ZD_MODULATION_TYPE(modulation) ((modulation) & ZD_MODULATION_TYPE_MASK) -#define ZD_RATE(modulation) ((modulation) & ZD_RATE_MASK) - -/* The two possible modulation types. Notify that 802.11b doesn't use the CCK - * codeing for the 1 and 2 MBit/s rate. We stay with the term here to remain - * consistent with uses the term at other places. - */ -#define ZD_CCK 0x00 -#define ZD_OFDM 0x10 - -/* The ZD1211 firmware uses proprietary encodings of the 802.11b (CCK) rates. - * For OFDM the PLCP rate encodings are used. We combine these "pure" rates - * with the modulation type flag and call the resulting values zd-rates. - */ -#define ZD_CCK_RATE_1M (ZD_CCK|0x00) -#define ZD_CCK_RATE_2M (ZD_CCK|0x01) -#define ZD_CCK_RATE_5_5M (ZD_CCK|0x02) -#define ZD_CCK_RATE_11M (ZD_CCK|0x03) -#define ZD_OFDM_RATE_6M (ZD_OFDM|ZD_OFDM_PLCP_RATE_6M) -#define ZD_OFDM_RATE_9M (ZD_OFDM|ZD_OFDM_PLCP_RATE_9M) -#define ZD_OFDM_RATE_12M (ZD_OFDM|ZD_OFDM_PLCP_RATE_12M) -#define ZD_OFDM_RATE_18M (ZD_OFDM|ZD_OFDM_PLCP_RATE_18M) -#define ZD_OFDM_RATE_24M (ZD_OFDM|ZD_OFDM_PLCP_RATE_24M) -#define ZD_OFDM_RATE_36M (ZD_OFDM|ZD_OFDM_PLCP_RATE_36M) -#define ZD_OFDM_RATE_48M (ZD_OFDM|ZD_OFDM_PLCP_RATE_48M) -#define ZD_OFDM_RATE_54M (ZD_OFDM|ZD_OFDM_PLCP_RATE_54M) - -/* The bit 5 of the zd_ctrlset modulation field controls the preamble in CCK - * mode or the 802.11a/802.11g selection in OFDM mode. - */ -#define ZD_CCK_PREA_LONG 0x00 -#define ZD_CCK_PREA_SHORT 0x20 -#define ZD_OFDM_MODE_11G 0x00 -#define ZD_OFDM_MODE_11A 0x20 - -/* zd_ctrlset control field */ -#define ZD_CS_NEED_RANDOM_BACKOFF 0x01 -#define ZD_CS_NO_ACK 0x02 - -#define ZD_CS_FRAME_TYPE_MASK 0x0c -#define ZD_CS_DATA_FRAME 0x00 -#define ZD_CS_PS_POLL_FRAME 0x04 -#define ZD_CS_MANAGEMENT_FRAME 0x08 -#define ZD_CS_NO_SEQUENCE_CTL_FRAME 0x0c - -#define ZD_CS_WAKE_DESTINATION 0x10 -#define ZD_CS_RTS 0x20 -#define ZD_CS_ENCRYPT 0x40 -#define ZD_CS_SELF_CTS 0x80 - -/* Incoming frames are prepended by a PLCP header */ -#define ZD_PLCP_HEADER_SIZE 5 - -struct rx_length_info { - __le16 length[3]; - __le16 tag; -} __packed; - -#define RX_LENGTH_INFO_TAG 0x697e - -struct rx_status { - u8 signal_quality_cck; - /* rssi */ - u8 signal_strength; - u8 signal_quality_ofdm; - u8 decryption_type; - u8 frame_status; -} __packed; - -/* rx_status field decryption_type */ -#define ZD_RX_NO_WEP 0 -#define ZD_RX_WEP64 1 -#define ZD_RX_TKIP 2 -#define ZD_RX_AES 4 -#define ZD_RX_WEP128 5 -#define ZD_RX_WEP256 6 - -/* rx_status field frame_status */ -#define ZD_RX_FRAME_MODULATION_MASK 0x01 -#define ZD_RX_CCK 0x00 -#define ZD_RX_OFDM 0x01 - -#define ZD_RX_TIMEOUT_ERROR 0x02 -#define ZD_RX_FIFO_OVERRUN_ERROR 0x04 -#define ZD_RX_DECRYPTION_ERROR 0x08 -#define ZD_RX_CRC32_ERROR 0x10 -#define ZD_RX_NO_ADDR1_MATCH_ERROR 0x20 -#define ZD_RX_CRC16_ERROR 0x40 -#define ZD_RX_ERROR 0x80 - -struct tx_retry_rate { - int count; /* number of valid element in rate[] array */ - int rate[10]; /* retry rates, described by an index in zd_rates[] */ -}; - -struct tx_status { - u8 type; /* must always be 0x01 : USB_INT_TYPE */ - u8 id; /* must always be 0xa0 : USB_INT_ID_RETRY_FAILED */ - u8 rate; - u8 pad; - u8 mac[ETH_ALEN]; - u8 retry; - u8 failure; -} __packed; - -enum mac_flags { - MAC_FIXED_CHANNEL = 0x01, -}; - -struct housekeeping { - struct delayed_work link_led_work; -}; - -struct beacon { - struct delayed_work watchdog_work; - struct sk_buff *cur_beacon; - unsigned long last_update; - u16 interval; - u8 period; -}; - -enum zd_device_flags { - ZD_DEVICE_RUNNING, -}; - -#define ZD_MAC_STATS_BUFFER_SIZE 16 - -#define ZD_MAC_MAX_ACK_WAITERS 50 - -struct zd_mac { - struct zd_chip chip; - spinlock_t lock; - spinlock_t intr_lock; - struct ieee80211_hw *hw; - struct ieee80211_vif *vif; - struct housekeeping housekeeping; - struct beacon beacon; - struct work_struct set_rts_cts_work; - struct work_struct process_intr; - struct zd_mc_hash multicast_hash; - u8 intr_buffer[USB_MAX_EP_INT_BUFFER]; - u8 regdomain; - u8 default_regdomain; - u8 channel; - int type; - int associated; - unsigned long flags; - struct sk_buff_head ack_wait_queue; - struct ieee80211_channel channels[14]; - struct ieee80211_rate rates[12]; - struct ieee80211_supported_band band; - - /* Short preamble (used for RTS/CTS) */ - unsigned int short_preamble:1; - - /* whether to pass frames with CRC errors to stack */ - unsigned int pass_failed_fcs:1; - - /* whether to pass control frames to stack */ - unsigned int pass_ctrl:1; - - /* whether we have received a 802.11 ACK that is pending */ - unsigned int ack_pending:1; - - /* signal strength of the last 802.11 ACK received */ - int ack_signal; -}; - -#define ZD_REGDOMAIN_FCC 0x10 -#define ZD_REGDOMAIN_IC 0x20 -#define ZD_REGDOMAIN_ETSI 0x30 -#define ZD_REGDOMAIN_SPAIN 0x31 -#define ZD_REGDOMAIN_FRANCE 0x32 -#define ZD_REGDOMAIN_JAPAN_2 0x40 -#define ZD_REGDOMAIN_JAPAN 0x41 -#define ZD_REGDOMAIN_JAPAN_3 0x49 - -enum { - MIN_CHANNEL24 = 1, - MAX_CHANNEL24 = 14, -}; - -#define ZD_PLCP_SERVICE_LENGTH_EXTENSION 0x80 - -struct ofdm_plcp_header { - u8 prefix[3]; - __le16 service; -} __packed; - -static inline u8 zd_ofdm_plcp_header_rate(const struct ofdm_plcp_header *header) -{ - return header->prefix[0] & 0xf; -} - -/* The following defines give the encoding of the 4-bit rate field in the - * OFDM (802.11a/802.11g) PLCP header. Notify that these values are used to - * define the zd-rate values for OFDM. - * - * See the struct zd_ctrlset definition in zd_mac.h. - */ -#define ZD_OFDM_PLCP_RATE_6M 0xb -#define ZD_OFDM_PLCP_RATE_9M 0xf -#define ZD_OFDM_PLCP_RATE_12M 0xa -#define ZD_OFDM_PLCP_RATE_18M 0xe -#define ZD_OFDM_PLCP_RATE_24M 0x9 -#define ZD_OFDM_PLCP_RATE_36M 0xd -#define ZD_OFDM_PLCP_RATE_48M 0x8 -#define ZD_OFDM_PLCP_RATE_54M 0xc - -struct cck_plcp_header { - u8 signal; - u8 service; - __le16 length; - __le16 crc16; -} __packed; - -static inline u8 zd_cck_plcp_header_signal(const struct cck_plcp_header *header) -{ - return header->signal; -} - -/* These defines give the encodings of the signal field in the 802.11b PLCP - * header. The signal field gives the bit rate of the following packet. Even - * if technically wrong we use CCK here also for the 1 MBit/s and 2 MBit/s - * rate to stay consistent with Zydas and our use of the term. - * - * Notify that these values are *not* used in the zd-rates. - */ -#define ZD_CCK_PLCP_SIGNAL_1M 0x0a -#define ZD_CCK_PLCP_SIGNAL_2M 0x14 -#define ZD_CCK_PLCP_SIGNAL_5M5 0x37 -#define ZD_CCK_PLCP_SIGNAL_11M 0x6e - -static inline struct zd_mac *zd_hw_mac(struct ieee80211_hw *hw) -{ - return hw->priv; -} - -static inline struct zd_mac *zd_chip_to_mac(struct zd_chip *chip) -{ - return container_of(chip, struct zd_mac, chip); -} - -static inline struct zd_mac *zd_usb_to_mac(struct zd_usb *usb) -{ - return zd_chip_to_mac(zd_usb_to_chip(usb)); -} - -static inline u8 *zd_mac_get_perm_addr(struct zd_mac *mac) -{ - return mac->hw->wiphy->perm_addr; -} - -#define zd_mac_dev(mac) (zd_chip_dev(&(mac)->chip)) - -struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf); -void zd_mac_clear(struct zd_mac *mac); - -int zd_mac_preinit_hw(struct ieee80211_hw *hw); -int zd_mac_init_hw(struct ieee80211_hw *hw); - -int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length); -void zd_mac_tx_failed(struct urb *urb); -void zd_mac_tx_to_dev(struct sk_buff *skb, int error); - -int zd_op_start(struct ieee80211_hw *hw); -void zd_op_stop(struct ieee80211_hw *hw); -int zd_restore_settings(struct zd_mac *mac); - -#ifdef DEBUG -void zd_dump_rx_status(const struct rx_status *status); -#else -#define zd_dump_rx_status(status) -#endif /* DEBUG */ - -#endif /* _ZD_MAC_H */ diff --git a/drivers/net/wireless/zd1211rw/zd_rf.c b/drivers/net/wireless/zd1211rw/zd_rf.c deleted file mode 100644 index c875ee05e22e..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_rf.c +++ /dev/null @@ -1,182 +0,0 @@ -/* ZD1211 USB-WLAN driver for Linux - * - * Copyright (C) 2005-2007 Ulrich Kunitz - * Copyright (C) 2006-2007 Daniel Drake - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include - -#include "zd_def.h" -#include "zd_rf.h" -#include "zd_mac.h" -#include "zd_chip.h" - -static const char * const rfs[] = { - [0] = "unknown RF0", - [1] = "unknown RF1", - [UW2451_RF] = "UW2451_RF", - [UCHIP_RF] = "UCHIP_RF", - [AL2230_RF] = "AL2230_RF", - [AL7230B_RF] = "AL7230B_RF", - [THETA_RF] = "THETA_RF", - [AL2210_RF] = "AL2210_RF", - [MAXIM_NEW_RF] = "MAXIM_NEW_RF", - [UW2453_RF] = "UW2453_RF", - [AL2230S_RF] = "AL2230S_RF", - [RALINK_RF] = "RALINK_RF", - [INTERSIL_RF] = "INTERSIL_RF", - [RF2959_RF] = "RF2959_RF", - [MAXIM_NEW2_RF] = "MAXIM_NEW2_RF", - [PHILIPS_RF] = "PHILIPS_RF", -}; - -const char *zd_rf_name(u8 type) -{ - if (type & 0xf0) - type = 0; - return rfs[type]; -} - -void zd_rf_init(struct zd_rf *rf) -{ - memset(rf, 0, sizeof(*rf)); - - /* default to update channel integration, as almost all RF's do want - * this */ - rf->update_channel_int = 1; -} - -void zd_rf_clear(struct zd_rf *rf) -{ - if (rf->clear) - rf->clear(rf); - ZD_MEMCLEAR(rf, sizeof(*rf)); -} - -int zd_rf_init_hw(struct zd_rf *rf, u8 type) -{ - int r = 0; - int t; - struct zd_chip *chip = zd_rf_to_chip(rf); - - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - switch (type) { - case RF2959_RF: - r = zd_rf_init_rf2959(rf); - break; - case AL2230_RF: - case AL2230S_RF: - r = zd_rf_init_al2230(rf); - break; - case AL7230B_RF: - r = zd_rf_init_al7230b(rf); - break; - case MAXIM_NEW_RF: - case UW2453_RF: - r = zd_rf_init_uw2453(rf); - break; - default: - dev_err(zd_chip_dev(chip), - "RF %s %#x is not supported\n", zd_rf_name(type), type); - rf->type = 0; - return -ENODEV; - } - - if (r) - return r; - - rf->type = type; - - r = zd_chip_lock_phy_regs(chip); - if (r) - return r; - t = rf->init_hw(rf); - r = zd_chip_unlock_phy_regs(chip); - if (t) - r = t; - return r; -} - -int zd_rf_scnprint_id(struct zd_rf *rf, char *buffer, size_t size) -{ - return scnprintf(buffer, size, "%s", zd_rf_name(rf->type)); -} - -int zd_rf_set_channel(struct zd_rf *rf, u8 channel) -{ - int r; - - ZD_ASSERT(mutex_is_locked(&zd_rf_to_chip(rf)->mutex)); - if (channel < MIN_CHANNEL24) - return -EINVAL; - if (channel > MAX_CHANNEL24) - return -EINVAL; - dev_dbg_f(zd_chip_dev(zd_rf_to_chip(rf)), "channel: %d\n", channel); - - r = rf->set_channel(rf, channel); - if (r >= 0) - rf->channel = channel; - return r; -} - -int zd_switch_radio_on(struct zd_rf *rf) -{ - int r, t; - struct zd_chip *chip = zd_rf_to_chip(rf); - - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - r = zd_chip_lock_phy_regs(chip); - if (r) - return r; - t = rf->switch_radio_on(rf); - r = zd_chip_unlock_phy_regs(chip); - if (t) - r = t; - return r; -} - -int zd_switch_radio_off(struct zd_rf *rf) -{ - int r, t; - struct zd_chip *chip = zd_rf_to_chip(rf); - - /* TODO: move phy regs handling to zd_chip */ - ZD_ASSERT(mutex_is_locked(&chip->mutex)); - r = zd_chip_lock_phy_regs(chip); - if (r) - return r; - t = rf->switch_radio_off(rf); - r = zd_chip_unlock_phy_regs(chip); - if (t) - r = t; - return r; -} - -int zd_rf_patch_6m_band_edge(struct zd_rf *rf, u8 channel) -{ - if (!rf->patch_6m_band_edge) - return 0; - - return rf->patch_6m_band_edge(rf, channel); -} - -int zd_rf_generic_patch_6m(struct zd_rf *rf, u8 channel) -{ - return zd_chip_generic_patch_6m_band(zd_rf_to_chip(rf), channel); -} - diff --git a/drivers/net/wireless/zd1211rw/zd_rf.h b/drivers/net/wireless/zd1211rw/zd_rf.h deleted file mode 100644 index 725b7c99b23d..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_rf.h +++ /dev/null @@ -1,111 +0,0 @@ -/* ZD1211 USB-WLAN driver for Linux - * - * Copyright (C) 2005-2007 Ulrich Kunitz - * Copyright (C) 2006-2007 Daniel Drake - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _ZD_RF_H -#define _ZD_RF_H - -#define UW2451_RF 0x2 -#define UCHIP_RF 0x3 -#define AL2230_RF 0x4 -#define AL7230B_RF 0x5 /* a,b,g */ -#define THETA_RF 0x6 -#define AL2210_RF 0x7 -#define MAXIM_NEW_RF 0x8 -#define UW2453_RF 0x9 -#define AL2230S_RF 0xa -#define RALINK_RF 0xb -#define INTERSIL_RF 0xc -#define RF2959_RF 0xd -#define MAXIM_NEW2_RF 0xe -#define PHILIPS_RF 0xf - -#define RF_CHANNEL(ch) [(ch)-1] - -/* Provides functions of the RF transceiver. */ - -enum { - RF_REG_BITS = 6, - RF_VALUE_BITS = 18, - RF_RV_BITS = RF_REG_BITS + RF_VALUE_BITS, -}; - -struct zd_rf { - u8 type; - - u8 channel; - - /* whether channel integration and calibration should be updated - * defaults to 1 (yes) */ - u8 update_channel_int:1; - - /* whether ZD_CR47 should be patched from the EEPROM, if the appropriate - * flag is set in the POD. The vendor driver suggests that this should - * be done for all RF's, but a bug in their code prevents but their - * HW_OverWritePhyRegFromE2P() routine from ever taking effect. */ - u8 patch_cck_gain:1; - - /* private RF driver data */ - void *priv; - - /* RF-specific functions */ - int (*init_hw)(struct zd_rf *rf); - int (*set_channel)(struct zd_rf *rf, u8 channel); - int (*switch_radio_on)(struct zd_rf *rf); - int (*switch_radio_off)(struct zd_rf *rf); - int (*patch_6m_band_edge)(struct zd_rf *rf, u8 channel); - void (*clear)(struct zd_rf *rf); -}; - -const char *zd_rf_name(u8 type); -void zd_rf_init(struct zd_rf *rf); -void zd_rf_clear(struct zd_rf *rf); -int zd_rf_init_hw(struct zd_rf *rf, u8 type); - -int zd_rf_scnprint_id(struct zd_rf *rf, char *buffer, size_t size); - -int zd_rf_set_channel(struct zd_rf *rf, u8 channel); - -int zd_switch_radio_on(struct zd_rf *rf); -int zd_switch_radio_off(struct zd_rf *rf); - -int zd_rf_patch_6m_band_edge(struct zd_rf *rf, u8 channel); -int zd_rf_generic_patch_6m(struct zd_rf *rf, u8 channel); - -static inline int zd_rf_should_update_pwr_int(struct zd_rf *rf) -{ - return rf->update_channel_int; -} - -static inline int zd_rf_should_patch_cck_gain(struct zd_rf *rf) -{ - return rf->patch_cck_gain; -} - -int zd_rf_patch_6m_band_edge(struct zd_rf *rf, u8 channel); -int zd_rf_generic_patch_6m(struct zd_rf *rf, u8 channel); - -/* Functions for individual RF chips */ - -int zd_rf_init_rf2959(struct zd_rf *rf); -int zd_rf_init_al2230(struct zd_rf *rf); -int zd_rf_init_al7230b(struct zd_rf *rf); -int zd_rf_init_uw2453(struct zd_rf *rf); - -#endif /* _ZD_RF_H */ diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c deleted file mode 100644 index 12babcb633c3..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c +++ /dev/null @@ -1,444 +0,0 @@ -/* ZD1211 USB-WLAN driver for Linux - * - * Copyright (C) 2005-2007 Ulrich Kunitz - * Copyright (C) 2006-2007 Daniel Drake - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "zd_rf.h" -#include "zd_usb.h" -#include "zd_chip.h" - -#define IS_AL2230S(chip) ((chip)->al2230s_bit || (chip)->rf.type == AL2230S_RF) - -static const u32 zd1211_al2230_table[][3] = { - RF_CHANNEL( 1) = { 0x03f790, 0x033331, 0x00000d, }, - RF_CHANNEL( 2) = { 0x03f790, 0x0b3331, 0x00000d, }, - RF_CHANNEL( 3) = { 0x03e790, 0x033331, 0x00000d, }, - RF_CHANNEL( 4) = { 0x03e790, 0x0b3331, 0x00000d, }, - RF_CHANNEL( 5) = { 0x03f7a0, 0x033331, 0x00000d, }, - RF_CHANNEL( 6) = { 0x03f7a0, 0x0b3331, 0x00000d, }, - RF_CHANNEL( 7) = { 0x03e7a0, 0x033331, 0x00000d, }, - RF_CHANNEL( 8) = { 0x03e7a0, 0x0b3331, 0x00000d, }, - RF_CHANNEL( 9) = { 0x03f7b0, 0x033331, 0x00000d, }, - RF_CHANNEL(10) = { 0x03f7b0, 0x0b3331, 0x00000d, }, - RF_CHANNEL(11) = { 0x03e7b0, 0x033331, 0x00000d, }, - RF_CHANNEL(12) = { 0x03e7b0, 0x0b3331, 0x00000d, }, - RF_CHANNEL(13) = { 0x03f7c0, 0x033331, 0x00000d, }, - RF_CHANNEL(14) = { 0x03e7c0, 0x066661, 0x00000d, }, -}; - -static const u32 zd1211b_al2230_table[][3] = { - RF_CHANNEL( 1) = { 0x09efc0, 0x8cccc0, 0xb00000, }, - RF_CHANNEL( 2) = { 0x09efc0, 0x8cccd0, 0xb00000, }, - RF_CHANNEL( 3) = { 0x09e7c0, 0x8cccc0, 0xb00000, }, - RF_CHANNEL( 4) = { 0x09e7c0, 0x8cccd0, 0xb00000, }, - RF_CHANNEL( 5) = { 0x05efc0, 0x8cccc0, 0xb00000, }, - RF_CHANNEL( 6) = { 0x05efc0, 0x8cccd0, 0xb00000, }, - RF_CHANNEL( 7) = { 0x05e7c0, 0x8cccc0, 0xb00000, }, - RF_CHANNEL( 8) = { 0x05e7c0, 0x8cccd0, 0xb00000, }, - RF_CHANNEL( 9) = { 0x0defc0, 0x8cccc0, 0xb00000, }, - RF_CHANNEL(10) = { 0x0defc0, 0x8cccd0, 0xb00000, }, - RF_CHANNEL(11) = { 0x0de7c0, 0x8cccc0, 0xb00000, }, - RF_CHANNEL(12) = { 0x0de7c0, 0x8cccd0, 0xb00000, }, - RF_CHANNEL(13) = { 0x03efc0, 0x8cccc0, 0xb00000, }, - RF_CHANNEL(14) = { 0x03e7c0, 0x866660, 0xb00000, }, -}; - -static const struct zd_ioreq16 zd1211b_ioreqs_shared_1[] = { - { ZD_CR240, 0x57 }, { ZD_CR9, 0xe0 }, -}; - -static const struct zd_ioreq16 ioreqs_init_al2230s[] = { - { ZD_CR47, 0x1e }, /* MARK_002 */ - { ZD_CR106, 0x22 }, - { ZD_CR107, 0x2a }, /* MARK_002 */ - { ZD_CR109, 0x13 }, /* MARK_002 */ - { ZD_CR118, 0xf8 }, /* MARK_002 */ - { ZD_CR119, 0x12 }, { ZD_CR122, 0xe0 }, - { ZD_CR128, 0x10 }, /* MARK_001 from 0xe->0x10 */ - { ZD_CR129, 0x0e }, /* MARK_001 from 0xd->0x0e */ - { ZD_CR130, 0x10 }, /* MARK_001 from 0xb->0x0d */ -}; - -static int zd1211b_al2230_finalize_rf(struct zd_chip *chip) -{ - int r; - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR80, 0x30 }, { ZD_CR81, 0x30 }, { ZD_CR79, 0x58 }, - { ZD_CR12, 0xf0 }, { ZD_CR77, 0x1b }, { ZD_CR78, 0x58 }, - { ZD_CR203, 0x06 }, - { }, - - { ZD_CR240, 0x80 }, - }; - - r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); - if (r) - return r; - - /* related to antenna selection? */ - if (chip->new_phy_layout) { - r = zd_iowrite16_locked(chip, 0xe1, ZD_CR9); - if (r) - return r; - } - - return zd_iowrite16_locked(chip, 0x06, ZD_CR203); -} - -static int zd1211_al2230_init_hw(struct zd_rf *rf) -{ - int r; - struct zd_chip *chip = zd_rf_to_chip(rf); - - static const struct zd_ioreq16 ioreqs_init[] = { - { ZD_CR15, 0x20 }, { ZD_CR23, 0x40 }, { ZD_CR24, 0x20 }, - { ZD_CR26, 0x11 }, { ZD_CR28, 0x3e }, { ZD_CR29, 0x00 }, - { ZD_CR44, 0x33 }, { ZD_CR106, 0x2a }, { ZD_CR107, 0x1a }, - { ZD_CR109, 0x09 }, { ZD_CR110, 0x27 }, { ZD_CR111, 0x2b }, - { ZD_CR112, 0x2b }, { ZD_CR119, 0x0a }, { ZD_CR10, 0x89 }, - /* for newest (3rd cut) AL2300 */ - { ZD_CR17, 0x28 }, - { ZD_CR26, 0x93 }, { ZD_CR34, 0x30 }, - /* for newest (3rd cut) AL2300 */ - { ZD_CR35, 0x3e }, - { ZD_CR41, 0x24 }, { ZD_CR44, 0x32 }, - /* for newest (3rd cut) AL2300 */ - { ZD_CR46, 0x96 }, - { ZD_CR47, 0x1e }, { ZD_CR79, 0x58 }, { ZD_CR80, 0x30 }, - { ZD_CR81, 0x30 }, { ZD_CR87, 0x0a }, { ZD_CR89, 0x04 }, - { ZD_CR92, 0x0a }, { ZD_CR99, 0x28 }, { ZD_CR100, 0x00 }, - { ZD_CR101, 0x13 }, { ZD_CR102, 0x27 }, { ZD_CR106, 0x24 }, - { ZD_CR107, 0x2a }, { ZD_CR109, 0x09 }, { ZD_CR110, 0x13 }, - { ZD_CR111, 0x1f }, { ZD_CR112, 0x1f }, { ZD_CR113, 0x27 }, - { ZD_CR114, 0x27 }, - /* for newest (3rd cut) AL2300 */ - { ZD_CR115, 0x24 }, - { ZD_CR116, 0x24 }, { ZD_CR117, 0xf4 }, { ZD_CR118, 0xfc }, - { ZD_CR119, 0x10 }, { ZD_CR120, 0x4f }, { ZD_CR121, 0x77 }, - { ZD_CR122, 0xe0 }, { ZD_CR137, 0x88 }, { ZD_CR252, 0xff }, - { ZD_CR253, 0xff }, - }; - - static const struct zd_ioreq16 ioreqs_pll[] = { - /* shdnb(PLL_ON)=0 */ - { ZD_CR251, 0x2f }, - /* shdnb(PLL_ON)=1 */ - { ZD_CR251, 0x3f }, - { ZD_CR138, 0x28 }, { ZD_CR203, 0x06 }, - }; - - static const u32 rv1[] = { - /* Channel 1 */ - 0x03f790, - 0x033331, - 0x00000d, - - 0x0b3331, - 0x03b812, - 0x00fff3, - }; - - static const u32 rv2[] = { - 0x000da4, - 0x0f4dc5, /* fix freq shift, 0x04edc5 */ - 0x0805b6, - 0x011687, - 0x000688, - 0x0403b9, /* external control TX power (ZD_CR31) */ - 0x00dbba, - 0x00099b, - 0x0bdffc, - 0x00000d, - 0x00500f, - }; - - static const u32 rv3[] = { - 0x00d00f, - 0x004c0f, - 0x00540f, - 0x00700f, - 0x00500f, - }; - - r = zd_iowrite16a_locked(chip, ioreqs_init, ARRAY_SIZE(ioreqs_init)); - if (r) - return r; - - if (IS_AL2230S(chip)) { - r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s, - ARRAY_SIZE(ioreqs_init_al2230s)); - if (r) - return r; - } - - r = zd_rfwritev_locked(chip, rv1, ARRAY_SIZE(rv1), RF_RV_BITS); - if (r) - return r; - - /* improve band edge for AL2230S */ - if (IS_AL2230S(chip)) - r = zd_rfwrite_locked(chip, 0x000824, RF_RV_BITS); - else - r = zd_rfwrite_locked(chip, 0x0005a4, RF_RV_BITS); - if (r) - return r; - - r = zd_rfwritev_locked(chip, rv2, ARRAY_SIZE(rv2), RF_RV_BITS); - if (r) - return r; - - r = zd_iowrite16a_locked(chip, ioreqs_pll, ARRAY_SIZE(ioreqs_pll)); - if (r) - return r; - - r = zd_rfwritev_locked(chip, rv3, ARRAY_SIZE(rv3), RF_RV_BITS); - if (r) - return r; - - return 0; -} - -static int zd1211b_al2230_init_hw(struct zd_rf *rf) -{ - int r; - struct zd_chip *chip = zd_rf_to_chip(rf); - - static const struct zd_ioreq16 ioreqs1[] = { - { ZD_CR10, 0x89 }, { ZD_CR15, 0x20 }, - { ZD_CR17, 0x2B }, /* for newest(3rd cut) AL2230 */ - { ZD_CR23, 0x40 }, { ZD_CR24, 0x20 }, { ZD_CR26, 0x93 }, - { ZD_CR28, 0x3e }, { ZD_CR29, 0x00 }, - { ZD_CR33, 0x28 }, /* 5621 */ - { ZD_CR34, 0x30 }, - { ZD_CR35, 0x3e }, /* for newest(3rd cut) AL2230 */ - { ZD_CR41, 0x24 }, { ZD_CR44, 0x32 }, - { ZD_CR46, 0x99 }, /* for newest(3rd cut) AL2230 */ - { ZD_CR47, 0x1e }, - - /* ZD1211B 05.06.10 */ - { ZD_CR48, 0x06 }, { ZD_CR49, 0xf9 }, { ZD_CR51, 0x01 }, - { ZD_CR52, 0x80 }, { ZD_CR53, 0x7e }, { ZD_CR65, 0x00 }, - { ZD_CR66, 0x00 }, { ZD_CR67, 0x00 }, { ZD_CR68, 0x00 }, - { ZD_CR69, 0x28 }, - - { ZD_CR79, 0x58 }, { ZD_CR80, 0x30 }, { ZD_CR81, 0x30 }, - { ZD_CR87, 0x0a }, { ZD_CR89, 0x04 }, - { ZD_CR91, 0x00 }, /* 5621 */ - { ZD_CR92, 0x0a }, - { ZD_CR98, 0x8d }, /* 4804, for 1212 new algorithm */ - { ZD_CR99, 0x00 }, /* 5621 */ - { ZD_CR101, 0x13 }, { ZD_CR102, 0x27 }, - { ZD_CR106, 0x24 }, /* for newest(3rd cut) AL2230 */ - { ZD_CR107, 0x2a }, - { ZD_CR109, 0x13 }, /* 4804, for 1212 new algorithm */ - { ZD_CR110, 0x1f }, /* 4804, for 1212 new algorithm */ - { ZD_CR111, 0x1f }, { ZD_CR112, 0x1f }, { ZD_CR113, 0x27 }, - { ZD_CR114, 0x27 }, - { ZD_CR115, 0x26 }, /* 24->26 at 4902 for newest(3rd cut) - * AL2230 - */ - { ZD_CR116, 0x24 }, - { ZD_CR117, 0xfa }, /* for 1211b */ - { ZD_CR118, 0xfa }, /* for 1211b */ - { ZD_CR119, 0x10 }, - { ZD_CR120, 0x4f }, - { ZD_CR121, 0x6c }, /* for 1211b */ - { ZD_CR122, 0xfc }, /* E0->FC at 4902 */ - { ZD_CR123, 0x57 }, /* 5623 */ - { ZD_CR125, 0xad }, /* 4804, for 1212 new algorithm */ - { ZD_CR126, 0x6c }, /* 5614 */ - { ZD_CR127, 0x03 }, /* 4804, for 1212 new algorithm */ - { ZD_CR137, 0x50 }, /* 5614 */ - { ZD_CR138, 0xa8 }, - { ZD_CR144, 0xac }, /* 5621 */ - { ZD_CR150, 0x0d }, { ZD_CR252, 0x34 }, { ZD_CR253, 0x34 }, - }; - - static const u32 rv1[] = { - 0x8cccd0, - 0x481dc0, - 0xcfff00, - 0x25a000, - }; - - static const u32 rv2[] = { - /* To improve AL2230 yield, improve phase noise, 4713 */ - 0x25a000, - 0xa3b2f0, - - 0x6da010, /* Reg6 update for MP versio */ - 0xe36280, /* Modified by jxiao for Bor-Chin on 2004/08/02 */ - 0x116000, - 0x9dc020, /* External control TX power (ZD_CR31) */ - 0x5ddb00, /* RegA update for MP version */ - 0xd99000, /* RegB update for MP version */ - 0x3ffbd0, /* RegC update for MP version */ - 0xb00000, /* RegD update for MP version */ - - /* improve phase noise and remove phase calibration,4713 */ - 0xf01a00, - }; - - static const struct zd_ioreq16 ioreqs2[] = { - { ZD_CR251, 0x2f }, /* shdnb(PLL_ON)=0 */ - { ZD_CR251, 0x7f }, /* shdnb(PLL_ON)=1 */ - }; - - static const u32 rv3[] = { - /* To improve AL2230 yield, 4713 */ - 0xf01b00, - 0xf01e00, - 0xf01a00, - }; - - static const struct zd_ioreq16 ioreqs3[] = { - /* related to 6M band edge patching, happens unconditionally */ - { ZD_CR128, 0x14 }, { ZD_CR129, 0x12 }, { ZD_CR130, 0x10 }, - }; - - r = zd_iowrite16a_locked(chip, zd1211b_ioreqs_shared_1, - ARRAY_SIZE(zd1211b_ioreqs_shared_1)); - if (r) - return r; - r = zd_iowrite16a_locked(chip, ioreqs1, ARRAY_SIZE(ioreqs1)); - if (r) - return r; - - if (IS_AL2230S(chip)) { - r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s, - ARRAY_SIZE(ioreqs_init_al2230s)); - if (r) - return r; - } - - r = zd_rfwritev_cr_locked(chip, zd1211b_al2230_table[0], 3); - if (r) - return r; - r = zd_rfwritev_cr_locked(chip, rv1, ARRAY_SIZE(rv1)); - if (r) - return r; - - if (IS_AL2230S(chip)) - r = zd_rfwrite_locked(chip, 0x241000, RF_RV_BITS); - else - r = zd_rfwrite_locked(chip, 0x25a000, RF_RV_BITS); - if (r) - return r; - - r = zd_rfwritev_cr_locked(chip, rv2, ARRAY_SIZE(rv2)); - if (r) - return r; - r = zd_iowrite16a_locked(chip, ioreqs2, ARRAY_SIZE(ioreqs2)); - if (r) - return r; - r = zd_rfwritev_cr_locked(chip, rv3, ARRAY_SIZE(rv3)); - if (r) - return r; - r = zd_iowrite16a_locked(chip, ioreqs3, ARRAY_SIZE(ioreqs3)); - if (r) - return r; - return zd1211b_al2230_finalize_rf(chip); -} - -static int zd1211_al2230_set_channel(struct zd_rf *rf, u8 channel) -{ - int r; - const u32 *rv = zd1211_al2230_table[channel-1]; - struct zd_chip *chip = zd_rf_to_chip(rf); - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR138, 0x28 }, - { ZD_CR203, 0x06 }, - }; - - r = zd_rfwritev_locked(chip, rv, 3, RF_RV_BITS); - if (r) - return r; - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -static int zd1211b_al2230_set_channel(struct zd_rf *rf, u8 channel) -{ - int r; - const u32 *rv = zd1211b_al2230_table[channel-1]; - struct zd_chip *chip = zd_rf_to_chip(rf); - - r = zd_iowrite16a_locked(chip, zd1211b_ioreqs_shared_1, - ARRAY_SIZE(zd1211b_ioreqs_shared_1)); - if (r) - return r; - - r = zd_rfwritev_cr_locked(chip, rv, 3); - if (r) - return r; - - return zd1211b_al2230_finalize_rf(chip); -} - -static int zd1211_al2230_switch_radio_on(struct zd_rf *rf) -{ - struct zd_chip *chip = zd_rf_to_chip(rf); - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR11, 0x00 }, - { ZD_CR251, 0x3f }, - }; - - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -static int zd1211b_al2230_switch_radio_on(struct zd_rf *rf) -{ - struct zd_chip *chip = zd_rf_to_chip(rf); - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR11, 0x00 }, - { ZD_CR251, 0x7f }, - }; - - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -static int al2230_switch_radio_off(struct zd_rf *rf) -{ - struct zd_chip *chip = zd_rf_to_chip(rf); - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR11, 0x04 }, - { ZD_CR251, 0x2f }, - }; - - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -int zd_rf_init_al2230(struct zd_rf *rf) -{ - struct zd_chip *chip = zd_rf_to_chip(rf); - - rf->switch_radio_off = al2230_switch_radio_off; - if (zd_chip_is_zd1211b(chip)) { - rf->init_hw = zd1211b_al2230_init_hw; - rf->set_channel = zd1211b_al2230_set_channel; - rf->switch_radio_on = zd1211b_al2230_switch_radio_on; - } else { - rf->init_hw = zd1211_al2230_init_hw; - rf->set_channel = zd1211_al2230_set_channel; - rf->switch_radio_on = zd1211_al2230_switch_radio_on; - } - rf->patch_6m_band_edge = zd_rf_generic_patch_6m; - rf->patch_cck_gain = 1; - return 0; -} diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al7230b.c b/drivers/net/wireless/zd1211rw/zd_rf_al7230b.c deleted file mode 100644 index 385c670d1293..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_rf_al7230b.c +++ /dev/null @@ -1,495 +0,0 @@ -/* ZD1211 USB-WLAN driver for Linux - * - * Copyright (C) 2005-2007 Ulrich Kunitz - * Copyright (C) 2006-2007 Daniel Drake - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "zd_rf.h" -#include "zd_usb.h" -#include "zd_chip.h" - -static const u32 chan_rv[][2] = { - RF_CHANNEL( 1) = { 0x09ec00, 0x8cccc8 }, - RF_CHANNEL( 2) = { 0x09ec00, 0x8cccd8 }, - RF_CHANNEL( 3) = { 0x09ec00, 0x8cccc0 }, - RF_CHANNEL( 4) = { 0x09ec00, 0x8cccd0 }, - RF_CHANNEL( 5) = { 0x05ec00, 0x8cccc8 }, - RF_CHANNEL( 6) = { 0x05ec00, 0x8cccd8 }, - RF_CHANNEL( 7) = { 0x05ec00, 0x8cccc0 }, - RF_CHANNEL( 8) = { 0x05ec00, 0x8cccd0 }, - RF_CHANNEL( 9) = { 0x0dec00, 0x8cccc8 }, - RF_CHANNEL(10) = { 0x0dec00, 0x8cccd8 }, - RF_CHANNEL(11) = { 0x0dec00, 0x8cccc0 }, - RF_CHANNEL(12) = { 0x0dec00, 0x8cccd0 }, - RF_CHANNEL(13) = { 0x03ec00, 0x8cccc8 }, - RF_CHANNEL(14) = { 0x03ec00, 0x866660 }, -}; - -static const u32 std_rv[] = { - 0x4ff821, - 0xc5fbfc, - 0x21ebfe, - 0xafd401, /* freq shift 0xaad401 */ - 0x6cf56a, - 0xe04073, - 0x193d76, - 0x9dd844, - 0x500007, - 0xd8c010, -}; - -static const u32 rv_init1[] = { - 0x3c9000, - 0xbfffff, - 0x700000, - 0xf15d58, -}; - -static const u32 rv_init2[] = { - 0xf15d59, - 0xf15d5c, - 0xf15d58, -}; - -static const struct zd_ioreq16 ioreqs_sw[] = { - { ZD_CR128, 0x14 }, { ZD_CR129, 0x12 }, { ZD_CR130, 0x10 }, - { ZD_CR38, 0x38 }, { ZD_CR136, 0xdf }, -}; - -static int zd1211b_al7230b_finalize(struct zd_chip *chip) -{ - int r; - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR80, 0x30 }, { ZD_CR81, 0x30 }, { ZD_CR79, 0x58 }, - { ZD_CR12, 0xf0 }, { ZD_CR77, 0x1b }, { ZD_CR78, 0x58 }, - { ZD_CR203, 0x04 }, - { }, - { ZD_CR240, 0x80 }, - }; - - r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); - if (r) - return r; - - if (chip->new_phy_layout) { - /* antenna selection? */ - r = zd_iowrite16_locked(chip, 0xe5, ZD_CR9); - if (r) - return r; - } - - return zd_iowrite16_locked(chip, 0x04, ZD_CR203); -} - -static int zd1211_al7230b_init_hw(struct zd_rf *rf) -{ - int r; - struct zd_chip *chip = zd_rf_to_chip(rf); - - /* All of these writes are identical to AL2230 unless otherwise - * specified */ - static const struct zd_ioreq16 ioreqs_1[] = { - /* This one is 7230-specific, and happens before the rest */ - { ZD_CR240, 0x57 }, - { }, - - { ZD_CR15, 0x20 }, { ZD_CR23, 0x40 }, { ZD_CR24, 0x20 }, - { ZD_CR26, 0x11 }, { ZD_CR28, 0x3e }, { ZD_CR29, 0x00 }, - { ZD_CR44, 0x33 }, - /* This value is different for 7230 (was: 0x2a) */ - { ZD_CR106, 0x22 }, - { ZD_CR107, 0x1a }, { ZD_CR109, 0x09 }, { ZD_CR110, 0x27 }, - { ZD_CR111, 0x2b }, { ZD_CR112, 0x2b }, { ZD_CR119, 0x0a }, - /* This happened further down in AL2230, - * and the value changed (was: 0xe0) */ - { ZD_CR122, 0xfc }, - { ZD_CR10, 0x89 }, - /* for newest (3rd cut) AL2300 */ - { ZD_CR17, 0x28 }, - { ZD_CR26, 0x93 }, { ZD_CR34, 0x30 }, - /* for newest (3rd cut) AL2300 */ - { ZD_CR35, 0x3e }, - { ZD_CR41, 0x24 }, { ZD_CR44, 0x32 }, - /* for newest (3rd cut) AL2300 */ - { ZD_CR46, 0x96 }, - { ZD_CR47, 0x1e }, { ZD_CR79, 0x58 }, { ZD_CR80, 0x30 }, - { ZD_CR81, 0x30 }, { ZD_CR87, 0x0a }, { ZD_CR89, 0x04 }, - { ZD_CR92, 0x0a }, { ZD_CR99, 0x28 }, - /* This value is different for 7230 (was: 0x00) */ - { ZD_CR100, 0x02 }, - { ZD_CR101, 0x13 }, { ZD_CR102, 0x27 }, - /* This value is different for 7230 (was: 0x24) */ - { ZD_CR106, 0x22 }, - /* This value is different for 7230 (was: 0x2a) */ - { ZD_CR107, 0x3f }, - { ZD_CR109, 0x09 }, - /* This value is different for 7230 (was: 0x13) */ - { ZD_CR110, 0x1f }, - { ZD_CR111, 0x1f }, { ZD_CR112, 0x1f }, { ZD_CR113, 0x27 }, - { ZD_CR114, 0x27 }, - /* for newest (3rd cut) AL2300 */ - { ZD_CR115, 0x24 }, - /* This value is different for 7230 (was: 0x24) */ - { ZD_CR116, 0x3f }, - /* This value is different for 7230 (was: 0xf4) */ - { ZD_CR117, 0xfa }, - { ZD_CR118, 0xfc }, { ZD_CR119, 0x10 }, { ZD_CR120, 0x4f }, - { ZD_CR121, 0x77 }, { ZD_CR137, 0x88 }, - /* This one is 7230-specific */ - { ZD_CR138, 0xa8 }, - /* This value is different for 7230 (was: 0xff) */ - { ZD_CR252, 0x34 }, - /* This value is different for 7230 (was: 0xff) */ - { ZD_CR253, 0x34 }, - - /* PLL_OFF */ - { ZD_CR251, 0x2f }, - }; - - static const struct zd_ioreq16 ioreqs_2[] = { - { ZD_CR251, 0x3f }, /* PLL_ON */ - { ZD_CR128, 0x14 }, { ZD_CR129, 0x12 }, { ZD_CR130, 0x10 }, - { ZD_CR38, 0x38 }, { ZD_CR136, 0xdf }, - }; - - r = zd_iowrite16a_locked(chip, ioreqs_1, ARRAY_SIZE(ioreqs_1)); - if (r) - return r; - - r = zd_rfwritev_cr_locked(chip, chan_rv[0], ARRAY_SIZE(chan_rv[0])); - if (r) - return r; - - r = zd_rfwritev_cr_locked(chip, std_rv, ARRAY_SIZE(std_rv)); - if (r) - return r; - - r = zd_rfwritev_cr_locked(chip, rv_init1, ARRAY_SIZE(rv_init1)); - if (r) - return r; - - r = zd_iowrite16a_locked(chip, ioreqs_2, ARRAY_SIZE(ioreqs_2)); - if (r) - return r; - - r = zd_rfwritev_cr_locked(chip, rv_init2, ARRAY_SIZE(rv_init2)); - if (r) - return r; - - r = zd_iowrite16_locked(chip, 0x06, ZD_CR203); - if (r) - return r; - r = zd_iowrite16_locked(chip, 0x80, ZD_CR240); - if (r) - return r; - - return 0; -} - -static int zd1211b_al7230b_init_hw(struct zd_rf *rf) -{ - int r; - struct zd_chip *chip = zd_rf_to_chip(rf); - - static const struct zd_ioreq16 ioreqs_1[] = { - { ZD_CR240, 0x57 }, { ZD_CR9, 0x9 }, - { }, - { ZD_CR10, 0x8b }, { ZD_CR15, 0x20 }, - { ZD_CR17, 0x2B }, /* for newest (3rd cut) AL2230 */ - { ZD_CR20, 0x10 }, /* 4N25->Stone Request */ - { ZD_CR23, 0x40 }, { ZD_CR24, 0x20 }, { ZD_CR26, 0x93 }, - { ZD_CR28, 0x3e }, { ZD_CR29, 0x00 }, - { ZD_CR33, 0x28 }, /* 5613 */ - { ZD_CR34, 0x30 }, - { ZD_CR35, 0x3e }, /* for newest (3rd cut) AL2230 */ - { ZD_CR41, 0x24 }, { ZD_CR44, 0x32 }, - { ZD_CR46, 0x99 }, /* for newest (3rd cut) AL2230 */ - { ZD_CR47, 0x1e }, - - /* ZD1215 5610 */ - { ZD_CR48, 0x00 }, { ZD_CR49, 0x00 }, { ZD_CR51, 0x01 }, - { ZD_CR52, 0x80 }, { ZD_CR53, 0x7e }, { ZD_CR65, 0x00 }, - { ZD_CR66, 0x00 }, { ZD_CR67, 0x00 }, { ZD_CR68, 0x00 }, - { ZD_CR69, 0x28 }, - - { ZD_CR79, 0x58 }, { ZD_CR80, 0x30 }, { ZD_CR81, 0x30 }, - { ZD_CR87, 0x0A }, { ZD_CR89, 0x04 }, - { ZD_CR90, 0x58 }, /* 5112 */ - { ZD_CR91, 0x00 }, /* 5613 */ - { ZD_CR92, 0x0a }, - { ZD_CR98, 0x8d }, /* 4804, for 1212 new algorithm */ - { ZD_CR99, 0x00 }, { ZD_CR100, 0x02 }, { ZD_CR101, 0x13 }, - { ZD_CR102, 0x27 }, - { ZD_CR106, 0x20 }, /* change to 0x24 for AL7230B */ - { ZD_CR109, 0x13 }, /* 4804, for 1212 new algorithm */ - { ZD_CR112, 0x1f }, - }; - - static const struct zd_ioreq16 ioreqs_new_phy[] = { - { ZD_CR107, 0x28 }, - { ZD_CR110, 0x1f }, /* 5127, 0x13->0x1f */ - { ZD_CR111, 0x1f }, /* 0x13 to 0x1f for AL7230B */ - { ZD_CR116, 0x2a }, { ZD_CR118, 0xfa }, { ZD_CR119, 0x12 }, - { ZD_CR121, 0x6c }, /* 5613 */ - }; - - static const struct zd_ioreq16 ioreqs_old_phy[] = { - { ZD_CR107, 0x24 }, - { ZD_CR110, 0x13 }, /* 5127, 0x13->0x1f */ - { ZD_CR111, 0x13 }, /* 0x13 to 0x1f for AL7230B */ - { ZD_CR116, 0x24 }, { ZD_CR118, 0xfc }, { ZD_CR119, 0x11 }, - { ZD_CR121, 0x6a }, /* 5613 */ - }; - - static const struct zd_ioreq16 ioreqs_2[] = { - { ZD_CR113, 0x27 }, { ZD_CR114, 0x27 }, { ZD_CR115, 0x24 }, - { ZD_CR117, 0xfa }, { ZD_CR120, 0x4f }, - { ZD_CR122, 0xfc }, /* E0->FCh at 4901 */ - { ZD_CR123, 0x57 }, /* 5613 */ - { ZD_CR125, 0xad }, /* 4804, for 1212 new algorithm */ - { ZD_CR126, 0x6c }, /* 5613 */ - { ZD_CR127, 0x03 }, /* 4804, for 1212 new algorithm */ - { ZD_CR130, 0x10 }, - { ZD_CR131, 0x00 }, /* 5112 */ - { ZD_CR137, 0x50 }, /* 5613 */ - { ZD_CR138, 0xa8 }, /* 5112 */ - { ZD_CR144, 0xac }, /* 5613 */ - { ZD_CR148, 0x40 }, /* 5112 */ - { ZD_CR149, 0x40 }, /* 4O07, 50->40 */ - { ZD_CR150, 0x1a }, /* 5112, 0C->1A */ - { ZD_CR252, 0x34 }, { ZD_CR253, 0x34 }, - { ZD_CR251, 0x2f }, /* PLL_OFF */ - }; - - static const struct zd_ioreq16 ioreqs_3[] = { - { ZD_CR251, 0x7f }, /* PLL_ON */ - { ZD_CR128, 0x14 }, { ZD_CR129, 0x12 }, { ZD_CR130, 0x10 }, - { ZD_CR38, 0x38 }, { ZD_CR136, 0xdf }, - }; - - r = zd_iowrite16a_locked(chip, ioreqs_1, ARRAY_SIZE(ioreqs_1)); - if (r) - return r; - - if (chip->new_phy_layout) - r = zd_iowrite16a_locked(chip, ioreqs_new_phy, - ARRAY_SIZE(ioreqs_new_phy)); - else - r = zd_iowrite16a_locked(chip, ioreqs_old_phy, - ARRAY_SIZE(ioreqs_old_phy)); - if (r) - return r; - - r = zd_iowrite16a_locked(chip, ioreqs_2, ARRAY_SIZE(ioreqs_2)); - if (r) - return r; - - r = zd_rfwritev_cr_locked(chip, chan_rv[0], ARRAY_SIZE(chan_rv[0])); - if (r) - return r; - - r = zd_rfwritev_cr_locked(chip, std_rv, ARRAY_SIZE(std_rv)); - if (r) - return r; - - r = zd_rfwritev_cr_locked(chip, rv_init1, ARRAY_SIZE(rv_init1)); - if (r) - return r; - - r = zd_iowrite16a_locked(chip, ioreqs_3, ARRAY_SIZE(ioreqs_3)); - if (r) - return r; - - r = zd_rfwritev_cr_locked(chip, rv_init2, ARRAY_SIZE(rv_init2)); - if (r) - return r; - - return zd1211b_al7230b_finalize(chip); -} - -static int zd1211_al7230b_set_channel(struct zd_rf *rf, u8 channel) -{ - int r; - const u32 *rv = chan_rv[channel-1]; - struct zd_chip *chip = zd_rf_to_chip(rf); - - static const struct zd_ioreq16 ioreqs[] = { - /* PLL_ON */ - { ZD_CR251, 0x3f }, - { ZD_CR203, 0x06 }, { ZD_CR240, 0x08 }, - }; - - r = zd_iowrite16_locked(chip, 0x57, ZD_CR240); - if (r) - return r; - - /* PLL_OFF */ - r = zd_iowrite16_locked(chip, 0x2f, ZD_CR251); - if (r) - return r; - - r = zd_rfwritev_cr_locked(chip, std_rv, ARRAY_SIZE(std_rv)); - if (r) - return r; - - r = zd_rfwrite_cr_locked(chip, 0x3c9000); - if (r) - return r; - r = zd_rfwrite_cr_locked(chip, 0xf15d58); - if (r) - return r; - - r = zd_iowrite16a_locked(chip, ioreqs_sw, ARRAY_SIZE(ioreqs_sw)); - if (r) - return r; - - r = zd_rfwritev_cr_locked(chip, rv, 2); - if (r) - return r; - - r = zd_rfwrite_cr_locked(chip, 0x3c9000); - if (r) - return r; - - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -static int zd1211b_al7230b_set_channel(struct zd_rf *rf, u8 channel) -{ - int r; - const u32 *rv = chan_rv[channel-1]; - struct zd_chip *chip = zd_rf_to_chip(rf); - - r = zd_iowrite16_locked(chip, 0x57, ZD_CR240); - if (r) - return r; - r = zd_iowrite16_locked(chip, 0xe4, ZD_CR9); - if (r) - return r; - - /* PLL_OFF */ - r = zd_iowrite16_locked(chip, 0x2f, ZD_CR251); - if (r) - return r; - r = zd_rfwritev_cr_locked(chip, std_rv, ARRAY_SIZE(std_rv)); - if (r) - return r; - - r = zd_rfwrite_cr_locked(chip, 0x3c9000); - if (r) - return r; - r = zd_rfwrite_cr_locked(chip, 0xf15d58); - if (r) - return r; - - r = zd_iowrite16a_locked(chip, ioreqs_sw, ARRAY_SIZE(ioreqs_sw)); - if (r) - return r; - - r = zd_rfwritev_cr_locked(chip, rv, 2); - if (r) - return r; - - r = zd_rfwrite_cr_locked(chip, 0x3c9000); - if (r) - return r; - - r = zd_iowrite16_locked(chip, 0x7f, ZD_CR251); - if (r) - return r; - - return zd1211b_al7230b_finalize(chip); -} - -static int zd1211_al7230b_switch_radio_on(struct zd_rf *rf) -{ - struct zd_chip *chip = zd_rf_to_chip(rf); - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR11, 0x00 }, - { ZD_CR251, 0x3f }, - }; - - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -static int zd1211b_al7230b_switch_radio_on(struct zd_rf *rf) -{ - struct zd_chip *chip = zd_rf_to_chip(rf); - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR11, 0x00 }, - { ZD_CR251, 0x7f }, - }; - - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -static int al7230b_switch_radio_off(struct zd_rf *rf) -{ - struct zd_chip *chip = zd_rf_to_chip(rf); - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR11, 0x04 }, - { ZD_CR251, 0x2f }, - }; - - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -/* ZD1211B+AL7230B 6m band edge patching differs slightly from other - * configurations */ -static int zd1211b_al7230b_patch_6m(struct zd_rf *rf, u8 channel) -{ - struct zd_chip *chip = zd_rf_to_chip(rf); - struct zd_ioreq16 ioreqs[] = { - { ZD_CR128, 0x14 }, { ZD_CR129, 0x12 }, - }; - - /* FIXME: Channel 11 is not the edge for all regulatory domains. */ - if (channel == 1) { - ioreqs[0].value = 0x0e; - ioreqs[1].value = 0x10; - } else if (channel == 11) { - ioreqs[0].value = 0x10; - ioreqs[1].value = 0x10; - } - - dev_dbg_f(zd_chip_dev(chip), "patching for channel %d\n", channel); - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -int zd_rf_init_al7230b(struct zd_rf *rf) -{ - struct zd_chip *chip = zd_rf_to_chip(rf); - - if (zd_chip_is_zd1211b(chip)) { - rf->init_hw = zd1211b_al7230b_init_hw; - rf->switch_radio_on = zd1211b_al7230b_switch_radio_on; - rf->set_channel = zd1211b_al7230b_set_channel; - rf->patch_6m_band_edge = zd1211b_al7230b_patch_6m; - } else { - rf->init_hw = zd1211_al7230b_init_hw; - rf->switch_radio_on = zd1211_al7230b_switch_radio_on; - rf->set_channel = zd1211_al7230b_set_channel; - rf->patch_6m_band_edge = zd_rf_generic_patch_6m; - rf->patch_cck_gain = 1; - } - - rf->switch_radio_off = al7230b_switch_radio_off; - - return 0; -} diff --git a/drivers/net/wireless/zd1211rw/zd_rf_rf2959.c b/drivers/net/wireless/zd1211rw/zd_rf_rf2959.c deleted file mode 100644 index 784d9ccb8fef..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_rf_rf2959.c +++ /dev/null @@ -1,282 +0,0 @@ -/* ZD1211 USB-WLAN driver for Linux - * - * Copyright (C) 2005-2007 Ulrich Kunitz - * Copyright (C) 2006-2007 Daniel Drake - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "zd_rf.h" -#include "zd_usb.h" -#include "zd_chip.h" - -static const u32 rf2959_table[][2] = { - RF_CHANNEL( 1) = { 0x181979, 0x1e6666 }, - RF_CHANNEL( 2) = { 0x181989, 0x1e6666 }, - RF_CHANNEL( 3) = { 0x181999, 0x1e6666 }, - RF_CHANNEL( 4) = { 0x1819a9, 0x1e6666 }, - RF_CHANNEL( 5) = { 0x1819b9, 0x1e6666 }, - RF_CHANNEL( 6) = { 0x1819c9, 0x1e6666 }, - RF_CHANNEL( 7) = { 0x1819d9, 0x1e6666 }, - RF_CHANNEL( 8) = { 0x1819e9, 0x1e6666 }, - RF_CHANNEL( 9) = { 0x1819f9, 0x1e6666 }, - RF_CHANNEL(10) = { 0x181a09, 0x1e6666 }, - RF_CHANNEL(11) = { 0x181a19, 0x1e6666 }, - RF_CHANNEL(12) = { 0x181a29, 0x1e6666 }, - RF_CHANNEL(13) = { 0x181a39, 0x1e6666 }, - RF_CHANNEL(14) = { 0x181a60, 0x1c0000 }, -}; - -#if 0 -static int bits(u32 rw, int from, int to) -{ - rw &= ~(0xffffffffU << (to+1)); - rw >>= from; - return rw; -} - -static int bit(u32 rw, int bit) -{ - return bits(rw, bit, bit); -} - -static void dump_regwrite(u32 rw) -{ - int reg = bits(rw, 18, 22); - int rw_flag = bits(rw, 23, 23); - PDEBUG("rf2959 %#010x reg %d rw %d", rw, reg, rw_flag); - - switch (reg) { - case 0: - PDEBUG("reg0 CFG1 ref_sel %d hybernate %d rf_vco_reg_en %d" - " if_vco_reg_en %d if_vga_en %d", - bits(rw, 14, 15), bit(rw, 3), bit(rw, 2), bit(rw, 1), - bit(rw, 0)); - break; - case 1: - PDEBUG("reg1 IFPLL1 pll_en1 %d kv_en1 %d vtc_en1 %d lpf1 %d" - " cpl1 %d pdp1 %d autocal_en1 %d ld_en1 %d ifloopr %d" - " ifloopc %d dac1 %d", - bit(rw, 17), bit(rw, 16), bit(rw, 15), bit(rw, 14), - bit(rw, 13), bit(rw, 12), bit(rw, 11), bit(rw, 10), - bits(rw, 7, 9), bits(rw, 4, 6), bits(rw, 0, 3)); - break; - case 2: - PDEBUG("reg2 IFPLL2 n1 %d num1 %d", - bits(rw, 6, 17), bits(rw, 0, 5)); - break; - case 3: - PDEBUG("reg3 IFPLL3 num %d", bits(rw, 0, 17)); - break; - case 4: - PDEBUG("reg4 IFPLL4 dn1 %#04x ct_def1 %d kv_def1 %d", - bits(rw, 8, 16), bits(rw, 4, 7), bits(rw, 0, 3)); - break; - case 5: - PDEBUG("reg5 RFPLL1 pll_en %d kv_en %d vtc_en %d lpf %d cpl %d" - " pdp %d autocal_en %d ld_en %d rfloopr %d rfloopc %d" - " dac %d", - bit(rw, 17), bit(rw, 16), bit(rw, 15), bit(rw, 14), - bit(rw, 13), bit(rw, 12), bit(rw, 11), bit(rw, 10), - bits(rw, 7, 9), bits(rw, 4, 6), bits(rw, 0,3)); - break; - case 6: - PDEBUG("reg6 RFPLL2 n %d num %d", - bits(rw, 6, 17), bits(rw, 0, 5)); - break; - case 7: - PDEBUG("reg7 RFPLL3 num2 %d", bits(rw, 0, 17)); - break; - case 8: - PDEBUG("reg8 RFPLL4 dn %#06x ct_def %d kv_def %d", - bits(rw, 8, 16), bits(rw, 4, 7), bits(rw, 0, 3)); - break; - case 9: - PDEBUG("reg9 CAL1 tvco %d tlock %d m_ct_value %d ld_window %d", - bits(rw, 13, 17), bits(rw, 8, 12), bits(rw, 3, 7), - bits(rw, 0, 2)); - break; - case 10: - PDEBUG("reg10 TXRX1 rxdcfbbyps %d pcontrol %d txvgc %d" - " rxlpfbw %d txlpfbw %d txdiffmode %d txenmode %d" - " intbiasen %d tybypass %d", - bit(rw, 17), bits(rw, 15, 16), bits(rw, 10, 14), - bits(rw, 7, 9), bits(rw, 4, 6), bit(rw, 3), bit(rw, 2), - bit(rw, 1), bit(rw, 0)); - break; - case 11: - PDEBUG("reg11 PCNT1 mid_bias %d p_desired %d pc_offset %d" - " tx_delay %d", - bits(rw, 15, 17), bits(rw, 9, 14), bits(rw, 3, 8), - bits(rw, 0, 2)); - break; - case 12: - PDEBUG("reg12 PCNT2 max_power %d mid_power %d min_power %d", - bits(rw, 12, 17), bits(rw, 6, 11), bits(rw, 0, 5)); - break; - case 13: - PDEBUG("reg13 VCOT1 rfpll vco comp %d ifpll vco comp %d" - " lobias %d if_biasbuf %d if_biasvco %d rf_biasbuf %d" - " rf_biasvco %d", - bit(rw, 17), bit(rw, 16), bit(rw, 15), - bits(rw, 8, 9), bits(rw, 5, 7), bits(rw, 3, 4), - bits(rw, 0, 2)); - break; - case 14: - PDEBUG("reg14 IQCAL rx_acal %d rx_pcal %d" - " tx_acal %d tx_pcal %d", - bits(rw, 13, 17), bits(rw, 9, 12), bits(rw, 4, 8), - bits(rw, 0, 3)); - break; - } -} -#endif /* 0 */ - -static int rf2959_init_hw(struct zd_rf *rf) -{ - int r; - struct zd_chip *chip = zd_rf_to_chip(rf); - - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR2, 0x1E }, { ZD_CR9, 0x20 }, { ZD_CR10, 0x89 }, - { ZD_CR11, 0x00 }, { ZD_CR15, 0xD0 }, { ZD_CR17, 0x68 }, - { ZD_CR19, 0x4a }, { ZD_CR20, 0x0c }, { ZD_CR21, 0x0E }, - { ZD_CR23, 0x48 }, - /* normal size for cca threshold */ - { ZD_CR24, 0x14 }, - /* { ZD_CR24, 0x20 }, */ - { ZD_CR26, 0x90 }, { ZD_CR27, 0x30 }, { ZD_CR29, 0x20 }, - { ZD_CR31, 0xb2 }, { ZD_CR32, 0x43 }, { ZD_CR33, 0x28 }, - { ZD_CR38, 0x30 }, { ZD_CR34, 0x0f }, { ZD_CR35, 0xF0 }, - { ZD_CR41, 0x2a }, { ZD_CR46, 0x7F }, { ZD_CR47, 0x1E }, - { ZD_CR51, 0xc5 }, { ZD_CR52, 0xc5 }, { ZD_CR53, 0xc5 }, - { ZD_CR79, 0x58 }, { ZD_CR80, 0x30 }, { ZD_CR81, 0x30 }, - { ZD_CR82, 0x00 }, { ZD_CR83, 0x24 }, { ZD_CR84, 0x04 }, - { ZD_CR85, 0x00 }, { ZD_CR86, 0x10 }, { ZD_CR87, 0x2A }, - { ZD_CR88, 0x10 }, { ZD_CR89, 0x24 }, { ZD_CR90, 0x18 }, - /* { ZD_CR91, 0x18 }, */ - /* should solve continuous CTS frame problems */ - { ZD_CR91, 0x00 }, - { ZD_CR92, 0x0a }, { ZD_CR93, 0x00 }, { ZD_CR94, 0x01 }, - { ZD_CR95, 0x00 }, { ZD_CR96, 0x40 }, { ZD_CR97, 0x37 }, - { ZD_CR98, 0x05 }, { ZD_CR99, 0x28 }, { ZD_CR100, 0x00 }, - { ZD_CR101, 0x13 }, { ZD_CR102, 0x27 }, { ZD_CR103, 0x27 }, - { ZD_CR104, 0x18 }, { ZD_CR105, 0x12 }, - /* normal size */ - { ZD_CR106, 0x1a }, - /* { ZD_CR106, 0x22 }, */ - { ZD_CR107, 0x24 }, { ZD_CR108, 0x0a }, { ZD_CR109, 0x13 }, - { ZD_CR110, 0x2F }, { ZD_CR111, 0x27 }, { ZD_CR112, 0x27 }, - { ZD_CR113, 0x27 }, { ZD_CR114, 0x27 }, { ZD_CR115, 0x40 }, - { ZD_CR116, 0x40 }, { ZD_CR117, 0xF0 }, { ZD_CR118, 0xF0 }, - { ZD_CR119, 0x16 }, - /* no TX continuation */ - { ZD_CR122, 0x00 }, - /* { ZD_CR122, 0xff }, */ - { ZD_CR127, 0x03 }, { ZD_CR131, 0x08 }, { ZD_CR138, 0x28 }, - { ZD_CR148, 0x44 }, { ZD_CR150, 0x10 }, { ZD_CR169, 0xBB }, - { ZD_CR170, 0xBB }, - }; - - static const u32 rv[] = { - 0x000007, /* REG0(CFG1) */ - 0x07dd43, /* REG1(IFPLL1) */ - 0x080959, /* REG2(IFPLL2) */ - 0x0e6666, - 0x116a57, /* REG4 */ - 0x17dd43, /* REG5 */ - 0x1819f9, /* REG6 */ - 0x1e6666, - 0x214554, - 0x25e7fa, - 0x27fffa, - /* The Zydas driver somehow forgets to set this value. It's - * only set for Japan. We are using internal power control - * for now. - */ - 0x294128, /* internal power */ - /* 0x28252c, */ /* External control TX power */ - /* ZD_CR31_CCK, ZD_CR51_6-36M, ZD_CR52_48M, ZD_CR53_54M */ - 0x2c0000, - 0x300000, - 0x340000, /* REG13(0xD) */ - 0x381e0f, /* REG14(0xE) */ - /* Bogus, RF2959's data sheet doesn't know register 27, which is - * actually referenced here. The commented 0x11 is 17. - */ - 0x6c180f, /* REG27(0x11) */ - }; - - r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); - if (r) - return r; - - return zd_rfwritev_locked(chip, rv, ARRAY_SIZE(rv), RF_RV_BITS); -} - -static int rf2959_set_channel(struct zd_rf *rf, u8 channel) -{ - int i, r; - const u32 *rv = rf2959_table[channel-1]; - struct zd_chip *chip = zd_rf_to_chip(rf); - - for (i = 0; i < 2; i++) { - r = zd_rfwrite_locked(chip, rv[i], RF_RV_BITS); - if (r) - return r; - } - return 0; -} - -static int rf2959_switch_radio_on(struct zd_rf *rf) -{ - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR10, 0x89 }, - { ZD_CR11, 0x00 }, - }; - struct zd_chip *chip = zd_rf_to_chip(rf); - - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -static int rf2959_switch_radio_off(struct zd_rf *rf) -{ - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR10, 0x15 }, - { ZD_CR11, 0x81 }, - }; - struct zd_chip *chip = zd_rf_to_chip(rf); - - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -int zd_rf_init_rf2959(struct zd_rf *rf) -{ - struct zd_chip *chip = zd_rf_to_chip(rf); - - if (zd_chip_is_zd1211b(chip)) { - dev_err(zd_chip_dev(chip), - "RF2959 is currently not supported for ZD1211B" - " devices\n"); - return -ENODEV; - } - rf->init_hw = rf2959_init_hw; - rf->set_channel = rf2959_set_channel; - rf->switch_radio_on = rf2959_switch_radio_on; - rf->switch_radio_off = rf2959_switch_radio_off; - return 0; -} diff --git a/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c b/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c deleted file mode 100644 index c4d324e19c24..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c +++ /dev/null @@ -1,540 +0,0 @@ -/* ZD1211 USB-WLAN driver for Linux - * - * Copyright (C) 2005-2007 Ulrich Kunitz - * Copyright (C) 2006-2007 Daniel Drake - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include - -#include "zd_rf.h" -#include "zd_usb.h" -#include "zd_chip.h" - -/* This RF programming code is based upon the code found in v2.16.0.0 of the - * ZyDAS vendor driver. Unlike other RF's, Ubec publish full technical specs - * for this RF on their website, so we're able to understand more than - * usual as to what is going on. Thumbs up for Ubec for doing that. */ - -/* The 3-wire serial interface provides access to 8 write-only registers. - * The data format is a 4 bit register address followed by a 20 bit value. */ -#define UW2453_REGWRITE(reg, val) ((((reg) & 0xf) << 20) | ((val) & 0xfffff)) - -/* For channel tuning, we have to configure registers 1 (synthesizer), 2 (synth - * fractional divide ratio) and 3 (VCO config). - * - * We configure the RF to produce an interrupt when the PLL is locked onto - * the configured frequency. During initialization, we run through a variety - * of different VCO configurations on channel 1 until we detect a PLL lock. - * When this happens, we remember which VCO configuration produced the lock - * and use it later. Actually, we use the configuration *after* the one that - * produced the lock, which seems odd, but it works. - * - * If we do not see a PLL lock on any standard VCO config, we fall back on an - * autocal configuration, which has a fixed (as opposed to per-channel) VCO - * config and different synth values from the standard set (divide ratio - * is still shared with the standard set). */ - -/* The per-channel synth values for all standard VCO configurations. These get - * written to register 1. */ -static const u8 uw2453_std_synth[] = { - RF_CHANNEL( 1) = 0x47, - RF_CHANNEL( 2) = 0x47, - RF_CHANNEL( 3) = 0x67, - RF_CHANNEL( 4) = 0x67, - RF_CHANNEL( 5) = 0x67, - RF_CHANNEL( 6) = 0x67, - RF_CHANNEL( 7) = 0x57, - RF_CHANNEL( 8) = 0x57, - RF_CHANNEL( 9) = 0x57, - RF_CHANNEL(10) = 0x57, - RF_CHANNEL(11) = 0x77, - RF_CHANNEL(12) = 0x77, - RF_CHANNEL(13) = 0x77, - RF_CHANNEL(14) = 0x4f, -}; - -/* This table stores the synthesizer fractional divide ratio for *all* VCO - * configurations (both standard and autocal). These get written to register 2. - */ -static const u16 uw2453_synth_divide[] = { - RF_CHANNEL( 1) = 0x999, - RF_CHANNEL( 2) = 0x99b, - RF_CHANNEL( 3) = 0x998, - RF_CHANNEL( 4) = 0x99a, - RF_CHANNEL( 5) = 0x999, - RF_CHANNEL( 6) = 0x99b, - RF_CHANNEL( 7) = 0x998, - RF_CHANNEL( 8) = 0x99a, - RF_CHANNEL( 9) = 0x999, - RF_CHANNEL(10) = 0x99b, - RF_CHANNEL(11) = 0x998, - RF_CHANNEL(12) = 0x99a, - RF_CHANNEL(13) = 0x999, - RF_CHANNEL(14) = 0xccc, -}; - -/* Here is the data for all the standard VCO configurations. We shrink our - * table a little by observing that both channels in a consecutive pair share - * the same value. We also observe that the high 4 bits ([0:3] in the specs) - * are all 'Reserved' and are always set to 0x4 - we chop them off in the data - * below. */ -#define CHAN_TO_PAIRIDX(a) ((a - 1) / 2) -#define RF_CHANPAIR(a,b) [CHAN_TO_PAIRIDX(a)] -static const u16 uw2453_std_vco_cfg[][7] = { - { /* table 1 */ - RF_CHANPAIR( 1, 2) = 0x664d, - RF_CHANPAIR( 3, 4) = 0x604d, - RF_CHANPAIR( 5, 6) = 0x6675, - RF_CHANPAIR( 7, 8) = 0x6475, - RF_CHANPAIR( 9, 10) = 0x6655, - RF_CHANPAIR(11, 12) = 0x6455, - RF_CHANPAIR(13, 14) = 0x6665, - }, - { /* table 2 */ - RF_CHANPAIR( 1, 2) = 0x666d, - RF_CHANPAIR( 3, 4) = 0x606d, - RF_CHANPAIR( 5, 6) = 0x664d, - RF_CHANPAIR( 7, 8) = 0x644d, - RF_CHANPAIR( 9, 10) = 0x6675, - RF_CHANPAIR(11, 12) = 0x6475, - RF_CHANPAIR(13, 14) = 0x6655, - }, - { /* table 3 */ - RF_CHANPAIR( 1, 2) = 0x665d, - RF_CHANPAIR( 3, 4) = 0x605d, - RF_CHANPAIR( 5, 6) = 0x666d, - RF_CHANPAIR( 7, 8) = 0x646d, - RF_CHANPAIR( 9, 10) = 0x664d, - RF_CHANPAIR(11, 12) = 0x644d, - RF_CHANPAIR(13, 14) = 0x6675, - }, - { /* table 4 */ - RF_CHANPAIR( 1, 2) = 0x667d, - RF_CHANPAIR( 3, 4) = 0x607d, - RF_CHANPAIR( 5, 6) = 0x665d, - RF_CHANPAIR( 7, 8) = 0x645d, - RF_CHANPAIR( 9, 10) = 0x666d, - RF_CHANPAIR(11, 12) = 0x646d, - RF_CHANPAIR(13, 14) = 0x664d, - }, - { /* table 5 */ - RF_CHANPAIR( 1, 2) = 0x6643, - RF_CHANPAIR( 3, 4) = 0x6043, - RF_CHANPAIR( 5, 6) = 0x667d, - RF_CHANPAIR( 7, 8) = 0x647d, - RF_CHANPAIR( 9, 10) = 0x665d, - RF_CHANPAIR(11, 12) = 0x645d, - RF_CHANPAIR(13, 14) = 0x666d, - }, - { /* table 6 */ - RF_CHANPAIR( 1, 2) = 0x6663, - RF_CHANPAIR( 3, 4) = 0x6063, - RF_CHANPAIR( 5, 6) = 0x6643, - RF_CHANPAIR( 7, 8) = 0x6443, - RF_CHANPAIR( 9, 10) = 0x667d, - RF_CHANPAIR(11, 12) = 0x647d, - RF_CHANPAIR(13, 14) = 0x665d, - }, - { /* table 7 */ - RF_CHANPAIR( 1, 2) = 0x6653, - RF_CHANPAIR( 3, 4) = 0x6053, - RF_CHANPAIR( 5, 6) = 0x6663, - RF_CHANPAIR( 7, 8) = 0x6463, - RF_CHANPAIR( 9, 10) = 0x6643, - RF_CHANPAIR(11, 12) = 0x6443, - RF_CHANPAIR(13, 14) = 0x667d, - }, - { /* table 8 */ - RF_CHANPAIR( 1, 2) = 0x6673, - RF_CHANPAIR( 3, 4) = 0x6073, - RF_CHANPAIR( 5, 6) = 0x6653, - RF_CHANPAIR( 7, 8) = 0x6453, - RF_CHANPAIR( 9, 10) = 0x6663, - RF_CHANPAIR(11, 12) = 0x6463, - RF_CHANPAIR(13, 14) = 0x6643, - }, - { /* table 9 */ - RF_CHANPAIR( 1, 2) = 0x664b, - RF_CHANPAIR( 3, 4) = 0x604b, - RF_CHANPAIR( 5, 6) = 0x6673, - RF_CHANPAIR( 7, 8) = 0x6473, - RF_CHANPAIR( 9, 10) = 0x6653, - RF_CHANPAIR(11, 12) = 0x6453, - RF_CHANPAIR(13, 14) = 0x6663, - }, - { /* table 10 */ - RF_CHANPAIR( 1, 2) = 0x666b, - RF_CHANPAIR( 3, 4) = 0x606b, - RF_CHANPAIR( 5, 6) = 0x664b, - RF_CHANPAIR( 7, 8) = 0x644b, - RF_CHANPAIR( 9, 10) = 0x6673, - RF_CHANPAIR(11, 12) = 0x6473, - RF_CHANPAIR(13, 14) = 0x6653, - }, - { /* table 11 */ - RF_CHANPAIR( 1, 2) = 0x665b, - RF_CHANPAIR( 3, 4) = 0x605b, - RF_CHANPAIR( 5, 6) = 0x666b, - RF_CHANPAIR( 7, 8) = 0x646b, - RF_CHANPAIR( 9, 10) = 0x664b, - RF_CHANPAIR(11, 12) = 0x644b, - RF_CHANPAIR(13, 14) = 0x6673, - }, - -}; - -/* The per-channel synth values for autocal. These get written to register 1. */ -static const u16 uw2453_autocal_synth[] = { - RF_CHANNEL( 1) = 0x6847, - RF_CHANNEL( 2) = 0x6847, - RF_CHANNEL( 3) = 0x6867, - RF_CHANNEL( 4) = 0x6867, - RF_CHANNEL( 5) = 0x6867, - RF_CHANNEL( 6) = 0x6867, - RF_CHANNEL( 7) = 0x6857, - RF_CHANNEL( 8) = 0x6857, - RF_CHANNEL( 9) = 0x6857, - RF_CHANNEL(10) = 0x6857, - RF_CHANNEL(11) = 0x6877, - RF_CHANNEL(12) = 0x6877, - RF_CHANNEL(13) = 0x6877, - RF_CHANNEL(14) = 0x684f, -}; - -/* The VCO configuration for autocal (all channels) */ -static const u16 UW2453_AUTOCAL_VCO_CFG = 0x6662; - -/* TX gain settings. The array index corresponds to the TX power integration - * values found in the EEPROM. The values get written to register 7. */ -static u32 uw2453_txgain[] = { - [0x00] = 0x0e313, - [0x01] = 0x0fb13, - [0x02] = 0x0e093, - [0x03] = 0x0f893, - [0x04] = 0x0ea93, - [0x05] = 0x1f093, - [0x06] = 0x1f493, - [0x07] = 0x1f693, - [0x08] = 0x1f393, - [0x09] = 0x1f35b, - [0x0a] = 0x1e6db, - [0x0b] = 0x1ff3f, - [0x0c] = 0x1ffff, - [0x0d] = 0x361d7, - [0x0e] = 0x37fbf, - [0x0f] = 0x3ff8b, - [0x10] = 0x3ff33, - [0x11] = 0x3fb3f, - [0x12] = 0x3ffff, -}; - -/* RF-specific structure */ -struct uw2453_priv { - /* index into synth/VCO config tables where PLL lock was found - * -1 means autocal */ - int config; -}; - -#define UW2453_PRIV(rf) ((struct uw2453_priv *) (rf)->priv) - -static int uw2453_synth_set_channel(struct zd_chip *chip, int channel, - bool autocal) -{ - int r; - int idx = channel - 1; - u32 val; - - if (autocal) - val = UW2453_REGWRITE(1, uw2453_autocal_synth[idx]); - else - val = UW2453_REGWRITE(1, uw2453_std_synth[idx]); - - r = zd_rfwrite_locked(chip, val, RF_RV_BITS); - if (r) - return r; - - return zd_rfwrite_locked(chip, - UW2453_REGWRITE(2, uw2453_synth_divide[idx]), RF_RV_BITS); -} - -static int uw2453_write_vco_cfg(struct zd_chip *chip, u16 value) -{ - /* vendor driver always sets these upper bits even though the specs say - * they are reserved */ - u32 val = 0x40000 | value; - return zd_rfwrite_locked(chip, UW2453_REGWRITE(3, val), RF_RV_BITS); -} - -static int uw2453_init_mode(struct zd_chip *chip) -{ - static const u32 rv[] = { - UW2453_REGWRITE(0, 0x25f98), /* enter IDLE mode */ - UW2453_REGWRITE(0, 0x25f9a), /* enter CAL_VCO mode */ - UW2453_REGWRITE(0, 0x25f94), /* enter RX/TX mode */ - UW2453_REGWRITE(0, 0x27fd4), /* power down RSSI circuit */ - }; - - return zd_rfwritev_locked(chip, rv, ARRAY_SIZE(rv), RF_RV_BITS); -} - -static int uw2453_set_tx_gain_level(struct zd_chip *chip, int channel) -{ - u8 int_value = chip->pwr_int_values[channel - 1]; - - if (int_value >= ARRAY_SIZE(uw2453_txgain)) { - dev_dbg_f(zd_chip_dev(chip), "can't configure TX gain for " - "int value %x on channel %d\n", int_value, channel); - return 0; - } - - return zd_rfwrite_locked(chip, - UW2453_REGWRITE(7, uw2453_txgain[int_value]), RF_RV_BITS); -} - -static int uw2453_init_hw(struct zd_rf *rf) -{ - int i, r; - int found_config = -1; - u16 intr_status; - struct zd_chip *chip = zd_rf_to_chip(rf); - - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR10, 0x89 }, { ZD_CR15, 0x20 }, - { ZD_CR17, 0x28 }, /* 6112 no change */ - { ZD_CR23, 0x38 }, { ZD_CR24, 0x20 }, { ZD_CR26, 0x93 }, - { ZD_CR27, 0x15 }, { ZD_CR28, 0x3e }, { ZD_CR29, 0x00 }, - { ZD_CR33, 0x28 }, { ZD_CR34, 0x30 }, - { ZD_CR35, 0x43 }, /* 6112 3e->43 */ - { ZD_CR41, 0x24 }, { ZD_CR44, 0x32 }, - { ZD_CR46, 0x92 }, /* 6112 96->92 */ - { ZD_CR47, 0x1e }, - { ZD_CR48, 0x04 }, /* 5602 Roger */ - { ZD_CR49, 0xfa }, { ZD_CR79, 0x58 }, { ZD_CR80, 0x30 }, - { ZD_CR81, 0x30 }, { ZD_CR87, 0x0a }, { ZD_CR89, 0x04 }, - { ZD_CR91, 0x00 }, { ZD_CR92, 0x0a }, { ZD_CR98, 0x8d }, - { ZD_CR99, 0x28 }, { ZD_CR100, 0x02 }, - { ZD_CR101, 0x09 }, /* 6112 13->1f 6220 1f->13 6407 13->9 */ - { ZD_CR102, 0x27 }, - { ZD_CR106, 0x1c }, /* 5d07 5112 1f->1c 6220 1c->1f - * 6221 1f->1c - */ - { ZD_CR107, 0x1c }, /* 6220 1c->1a 5221 1a->1c */ - { ZD_CR109, 0x13 }, - { ZD_CR110, 0x1f }, /* 6112 13->1f 6221 1f->13 6407 13->0x09 */ - { ZD_CR111, 0x13 }, { ZD_CR112, 0x1f }, { ZD_CR113, 0x27 }, - { ZD_CR114, 0x23 }, /* 6221 27->23 */ - { ZD_CR115, 0x24 }, /* 6112 24->1c 6220 1c->24 */ - { ZD_CR116, 0x24 }, /* 6220 1c->24 */ - { ZD_CR117, 0xfa }, /* 6112 fa->f8 6220 f8->f4 6220 f4->fa */ - { ZD_CR118, 0xf0 }, /* 5d07 6112 f0->f2 6220 f2->f0 */ - { ZD_CR119, 0x1a }, /* 6112 1a->10 6220 10->14 6220 14->1a */ - { ZD_CR120, 0x4f }, - { ZD_CR121, 0x1f }, /* 6220 4f->1f */ - { ZD_CR122, 0xf0 }, { ZD_CR123, 0x57 }, { ZD_CR125, 0xad }, - { ZD_CR126, 0x6c }, { ZD_CR127, 0x03 }, - { ZD_CR128, 0x14 }, /* 6302 12->11 */ - { ZD_CR129, 0x12 }, /* 6301 10->0f */ - { ZD_CR130, 0x10 }, { ZD_CR137, 0x50 }, { ZD_CR138, 0xa8 }, - { ZD_CR144, 0xac }, { ZD_CR146, 0x20 }, { ZD_CR252, 0xff }, - { ZD_CR253, 0xff }, - }; - - static const u32 rv[] = { - UW2453_REGWRITE(4, 0x2b), /* configure receiver gain */ - UW2453_REGWRITE(5, 0x19e4f), /* configure transmitter gain */ - UW2453_REGWRITE(6, 0xf81ad), /* enable RX/TX filter tuning */ - UW2453_REGWRITE(7, 0x3fffe), /* disable TX gain in test mode */ - - /* enter CAL_FIL mode, TX gain set by registers, RX gain set by pins, - * RSSI circuit powered down, reduced RSSI range */ - UW2453_REGWRITE(0, 0x25f9c), /* 5d01 cal_fil */ - - /* synthesizer configuration for channel 1 */ - UW2453_REGWRITE(1, 0x47), - UW2453_REGWRITE(2, 0x999), - - /* disable manual VCO band selection */ - UW2453_REGWRITE(3, 0x7602), - - /* enable manual VCO band selection, configure current level */ - UW2453_REGWRITE(3, 0x46063), - }; - - r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); - if (r) - return r; - - r = zd_rfwritev_locked(chip, rv, ARRAY_SIZE(rv), RF_RV_BITS); - if (r) - return r; - - r = uw2453_init_mode(chip); - if (r) - return r; - - /* Try all standard VCO configuration settings on channel 1 */ - for (i = 0; i < ARRAY_SIZE(uw2453_std_vco_cfg) - 1; i++) { - /* Configure synthesizer for channel 1 */ - r = uw2453_synth_set_channel(chip, 1, false); - if (r) - return r; - - /* Write VCO config */ - r = uw2453_write_vco_cfg(chip, uw2453_std_vco_cfg[i][0]); - if (r) - return r; - - /* ack interrupt event */ - r = zd_iowrite16_locked(chip, 0x0f, UW2453_INTR_REG); - if (r) - return r; - - /* check interrupt status */ - r = zd_ioread16_locked(chip, &intr_status, UW2453_INTR_REG); - if (r) - return r; - - if (!(intr_status & 0xf)) { - dev_dbg_f(zd_chip_dev(chip), - "PLL locked on configuration %d\n", i); - found_config = i; - break; - } - } - - if (found_config == -1) { - /* autocal */ - dev_dbg_f(zd_chip_dev(chip), - "PLL did not lock, using autocal\n"); - - r = uw2453_synth_set_channel(chip, 1, true); - if (r) - return r; - - r = uw2453_write_vco_cfg(chip, UW2453_AUTOCAL_VCO_CFG); - if (r) - return r; - } - - /* To match the vendor driver behaviour, we use the configuration after - * the one that produced a lock. */ - UW2453_PRIV(rf)->config = found_config + 1; - - return zd_iowrite16_locked(chip, 0x06, ZD_CR203); -} - -static int uw2453_set_channel(struct zd_rf *rf, u8 channel) -{ - int r; - u16 vco_cfg; - int config = UW2453_PRIV(rf)->config; - bool autocal = (config == -1); - struct zd_chip *chip = zd_rf_to_chip(rf); - - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR80, 0x30 }, { ZD_CR81, 0x30 }, { ZD_CR79, 0x58 }, - { ZD_CR12, 0xf0 }, { ZD_CR77, 0x1b }, { ZD_CR78, 0x58 }, - }; - - r = uw2453_synth_set_channel(chip, channel, autocal); - if (r) - return r; - - if (autocal) - vco_cfg = UW2453_AUTOCAL_VCO_CFG; - else - vco_cfg = uw2453_std_vco_cfg[config][CHAN_TO_PAIRIDX(channel)]; - - r = uw2453_write_vco_cfg(chip, vco_cfg); - if (r) - return r; - - r = uw2453_init_mode(chip); - if (r) - return r; - - r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); - if (r) - return r; - - r = uw2453_set_tx_gain_level(chip, channel); - if (r) - return r; - - return zd_iowrite16_locked(chip, 0x06, ZD_CR203); -} - -static int uw2453_switch_radio_on(struct zd_rf *rf) -{ - int r; - struct zd_chip *chip = zd_rf_to_chip(rf); - struct zd_ioreq16 ioreqs[] = { - { ZD_CR11, 0x00 }, { ZD_CR251, 0x3f }, - }; - - /* enter RXTX mode */ - r = zd_rfwrite_locked(chip, UW2453_REGWRITE(0, 0x25f94), RF_RV_BITS); - if (r) - return r; - - if (zd_chip_is_zd1211b(chip)) - ioreqs[1].value = 0x7f; - - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -static int uw2453_switch_radio_off(struct zd_rf *rf) -{ - int r; - struct zd_chip *chip = zd_rf_to_chip(rf); - static const struct zd_ioreq16 ioreqs[] = { - { ZD_CR11, 0x04 }, { ZD_CR251, 0x2f }, - }; - - /* enter IDLE mode */ - /* FIXME: shouldn't we go to SLEEP? sent email to zydas */ - r = zd_rfwrite_locked(chip, UW2453_REGWRITE(0, 0x25f90), RF_RV_BITS); - if (r) - return r; - - return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); -} - -static void uw2453_clear(struct zd_rf *rf) -{ - kfree(rf->priv); -} - -int zd_rf_init_uw2453(struct zd_rf *rf) -{ - rf->init_hw = uw2453_init_hw; - rf->set_channel = uw2453_set_channel; - rf->switch_radio_on = uw2453_switch_radio_on; - rf->switch_radio_off = uw2453_switch_radio_off; - rf->patch_6m_band_edge = zd_rf_generic_patch_6m; - rf->clear = uw2453_clear; - /* we have our own TX integration code */ - rf->update_channel_int = 0; - - rf->priv = kmalloc(sizeof(struct uw2453_priv), GFP_KERNEL); - if (rf->priv == NULL) - return -ENOMEM; - - return 0; -} - diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c deleted file mode 100644 index 7ef0b4a181e1..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ /dev/null @@ -1,2061 +0,0 @@ -/* ZD1211 USB-WLAN driver for Linux - * - * Copyright (C) 2005-2007 Ulrich Kunitz - * Copyright (C) 2006-2007 Daniel Drake - * Copyright (C) 2006-2007 Michael Wu - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "zd_def.h" -#include "zd_mac.h" -#include "zd_usb.h" - -static struct usb_device_id usb_ids[] = { - /* ZD1211 */ - { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x0586, 0x3401), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x0586, 0x3402), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x0586, 0x3407), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x0586, 0x3409), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x079b, 0x004a), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x07b8, 0x6001), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x0ace, 0x1211), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x0ace, 0xa211), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x0b05, 0x170c), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x0b3b, 0x1630), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x0b3b, 0x5630), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x0df6, 0x9071), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x0df6, 0x9075), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x126f, 0xa006), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x129b, 0x1666), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x13b1, 0x001e), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x1435, 0x0711), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x14ea, 0xab10), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x14ea, 0xab13), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x157e, 0x300b), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x157e, 0x3204), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x157e, 0x3207), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x1740, 0x2000), .driver_info = DEVICE_ZD1211 }, - { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 }, - /* ZD1211B */ - { USB_DEVICE(0x0053, 0x5301), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0409, 0x0248), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0411, 0x00da), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0471, 0x1236), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x050d, 0x705c), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x054c, 0x0257), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0586, 0x340a), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0586, 0x340f), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0586, 0x3410), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0586, 0x3412), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0586, 0x3413), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x079b, 0x0062), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x07b8, 0x6001), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x07fa, 0x1196), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x083a, 0x4505), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x083a, 0xe501), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x083a, 0xe503), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x083a, 0xe506), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0ace, 0xb215), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0b05, 0x171b), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0baf, 0x0121), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0cde, 0x001a), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x0df6, 0x0036), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x129b, 0x1667), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x13b1, 0x0024), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x1582, 0x6003), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x2019, 0x5303), .driver_info = DEVICE_ZD1211B }, - { USB_DEVICE(0x2019, 0xed01), .driver_info = DEVICE_ZD1211B }, - /* "Driverless" devices that need ejecting */ - { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, - { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, - {} -}; - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("USB driver for devices with the ZD1211 chip."); -MODULE_AUTHOR("Ulrich Kunitz"); -MODULE_AUTHOR("Daniel Drake"); -MODULE_VERSION("1.0"); -MODULE_DEVICE_TABLE(usb, usb_ids); - -#define FW_ZD1211_PREFIX "zd1211/zd1211_" -#define FW_ZD1211B_PREFIX "zd1211/zd1211b_" - -static bool check_read_regs(struct zd_usb *usb, struct usb_req_read_regs *req, - unsigned int count); - -/* USB device initialization */ -static void int_urb_complete(struct urb *urb); - -static int request_fw_file( - const struct firmware **fw, const char *name, struct device *device) -{ - int r; - - dev_dbg_f(device, "fw name %s\n", name); - - r = request_firmware(fw, name, device); - if (r) - dev_err(device, - "Could not load firmware file %s. Error number %d\n", - name, r); - return r; -} - -static inline u16 get_bcdDevice(const struct usb_device *udev) -{ - return le16_to_cpu(udev->descriptor.bcdDevice); -} - -enum upload_code_flags { - REBOOT = 1, -}; - -/* Ensures that MAX_TRANSFER_SIZE is even. */ -#define MAX_TRANSFER_SIZE (USB_MAX_TRANSFER_SIZE & ~1) - -static int upload_code(struct usb_device *udev, - const u8 *data, size_t size, u16 code_offset, int flags) -{ - u8 *p; - int r; - - /* USB request blocks need "kmalloced" buffers. - */ - p = kmalloc(MAX_TRANSFER_SIZE, GFP_KERNEL); - if (!p) { - r = -ENOMEM; - goto error; - } - - size &= ~1; - while (size > 0) { - size_t transfer_size = size <= MAX_TRANSFER_SIZE ? - size : MAX_TRANSFER_SIZE; - - dev_dbg_f(&udev->dev, "transfer size %zu\n", transfer_size); - - memcpy(p, data, transfer_size); - r = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), - USB_REQ_FIRMWARE_DOWNLOAD, - USB_DIR_OUT | USB_TYPE_VENDOR, - code_offset, 0, p, transfer_size, 1000 /* ms */); - if (r < 0) { - dev_err(&udev->dev, - "USB control request for firmware upload" - " failed. Error number %d\n", r); - goto error; - } - transfer_size = r & ~1; - - size -= transfer_size; - data += transfer_size; - code_offset += transfer_size/sizeof(u16); - } - - if (flags & REBOOT) { - u8 ret; - - /* Use "DMA-aware" buffer. */ - r = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), - USB_REQ_FIRMWARE_CONFIRM, - USB_DIR_IN | USB_TYPE_VENDOR, - 0, 0, p, sizeof(ret), 5000 /* ms */); - if (r != sizeof(ret)) { - dev_err(&udev->dev, - "control request firmeware confirmation failed." - " Return value %d\n", r); - if (r >= 0) - r = -ENODEV; - goto error; - } - ret = p[0]; - if (ret & 0x80) { - dev_err(&udev->dev, - "Internal error while downloading." - " Firmware confirm return value %#04x\n", - (unsigned int)ret); - r = -ENODEV; - goto error; - } - dev_dbg_f(&udev->dev, "firmware confirm return value %#04x\n", - (unsigned int)ret); - } - - r = 0; -error: - kfree(p); - return r; -} - -static u16 get_word(const void *data, u16 offset) -{ - const __le16 *p = data; - return le16_to_cpu(p[offset]); -} - -static char *get_fw_name(struct zd_usb *usb, char *buffer, size_t size, - const char* postfix) -{ - scnprintf(buffer, size, "%s%s", - usb->is_zd1211b ? - FW_ZD1211B_PREFIX : FW_ZD1211_PREFIX, - postfix); - return buffer; -} - -static int handle_version_mismatch(struct zd_usb *usb, - const struct firmware *ub_fw) -{ - struct usb_device *udev = zd_usb_to_usbdev(usb); - const struct firmware *ur_fw = NULL; - int offset; - int r = 0; - char fw_name[128]; - - r = request_fw_file(&ur_fw, - get_fw_name(usb, fw_name, sizeof(fw_name), "ur"), - &udev->dev); - if (r) - goto error; - - r = upload_code(udev, ur_fw->data, ur_fw->size, FW_START, REBOOT); - if (r) - goto error; - - offset = (E2P_BOOT_CODE_OFFSET * sizeof(u16)); - r = upload_code(udev, ub_fw->data + offset, ub_fw->size - offset, - E2P_START + E2P_BOOT_CODE_OFFSET, REBOOT); - - /* At this point, the vendor driver downloads the whole firmware - * image, hacks around with version IDs, and uploads it again, - * completely overwriting the boot code. We do not do this here as - * it is not required on any tested devices, and it is suspected to - * cause problems. */ -error: - release_firmware(ur_fw); - return r; -} - -static int upload_firmware(struct zd_usb *usb) -{ - int r; - u16 fw_bcdDevice; - u16 bcdDevice; - struct usb_device *udev = zd_usb_to_usbdev(usb); - const struct firmware *ub_fw = NULL; - const struct firmware *uph_fw = NULL; - char fw_name[128]; - - bcdDevice = get_bcdDevice(udev); - - r = request_fw_file(&ub_fw, - get_fw_name(usb, fw_name, sizeof(fw_name), "ub"), - &udev->dev); - if (r) - goto error; - - fw_bcdDevice = get_word(ub_fw->data, E2P_DATA_OFFSET); - - if (fw_bcdDevice != bcdDevice) { - dev_info(&udev->dev, - "firmware version %#06x and device bootcode version " - "%#06x differ\n", fw_bcdDevice, bcdDevice); - if (bcdDevice <= 0x4313) - dev_warn(&udev->dev, "device has old bootcode, please " - "report success or failure\n"); - - r = handle_version_mismatch(usb, ub_fw); - if (r) - goto error; - } else { - dev_dbg_f(&udev->dev, - "firmware device id %#06x is equal to the " - "actual device id\n", fw_bcdDevice); - } - - - r = request_fw_file(&uph_fw, - get_fw_name(usb, fw_name, sizeof(fw_name), "uphr"), - &udev->dev); - if (r) - goto error; - - r = upload_code(udev, uph_fw->data, uph_fw->size, FW_START, REBOOT); - if (r) { - dev_err(&udev->dev, - "Could not upload firmware code uph. Error number %d\n", - r); - } - - /* FALL-THROUGH */ -error: - release_firmware(ub_fw); - release_firmware(uph_fw); - return r; -} - -MODULE_FIRMWARE(FW_ZD1211B_PREFIX "ur"); -MODULE_FIRMWARE(FW_ZD1211_PREFIX "ur"); -MODULE_FIRMWARE(FW_ZD1211B_PREFIX "ub"); -MODULE_FIRMWARE(FW_ZD1211_PREFIX "ub"); -MODULE_FIRMWARE(FW_ZD1211B_PREFIX "uphr"); -MODULE_FIRMWARE(FW_ZD1211_PREFIX "uphr"); - -/* Read data from device address space using "firmware interface" which does - * not require firmware to be loaded. */ -int zd_usb_read_fw(struct zd_usb *usb, zd_addr_t addr, u8 *data, u16 len) -{ - int r; - struct usb_device *udev = zd_usb_to_usbdev(usb); - u8 *buf; - - /* Use "DMA-aware" buffer. */ - buf = kmalloc(len, GFP_KERNEL); - if (!buf) - return -ENOMEM; - r = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), - USB_REQ_FIRMWARE_READ_DATA, USB_DIR_IN | 0x40, addr, 0, - buf, len, 5000); - if (r < 0) { - dev_err(&udev->dev, - "read over firmware interface failed: %d\n", r); - goto exit; - } else if (r != len) { - dev_err(&udev->dev, - "incomplete read over firmware interface: %d/%d\n", - r, len); - r = -EIO; - goto exit; - } - r = 0; - memcpy(data, buf, len); -exit: - kfree(buf); - return r; -} - -#define urb_dev(urb) (&(urb)->dev->dev) - -static inline void handle_regs_int_override(struct urb *urb) -{ - struct zd_usb *usb = urb->context; - struct zd_usb_interrupt *intr = &usb->intr; - - spin_lock(&intr->lock); - if (atomic_read(&intr->read_regs_enabled)) { - atomic_set(&intr->read_regs_enabled, 0); - intr->read_regs_int_overridden = 1; - complete(&intr->read_regs.completion); - } - spin_unlock(&intr->lock); -} - -static inline void handle_regs_int(struct urb *urb) -{ - struct zd_usb *usb = urb->context; - struct zd_usb_interrupt *intr = &usb->intr; - int len; - u16 int_num; - - ZD_ASSERT(in_interrupt()); - spin_lock(&intr->lock); - - int_num = le16_to_cpu(*(__le16 *)(urb->transfer_buffer+2)); - if (int_num == CR_INTERRUPT) { - struct zd_mac *mac = zd_hw_mac(zd_usb_to_hw(urb->context)); - spin_lock(&mac->lock); - memcpy(&mac->intr_buffer, urb->transfer_buffer, - USB_MAX_EP_INT_BUFFER); - spin_unlock(&mac->lock); - schedule_work(&mac->process_intr); - } else if (atomic_read(&intr->read_regs_enabled)) { - len = urb->actual_length; - intr->read_regs.length = urb->actual_length; - if (len > sizeof(intr->read_regs.buffer)) - len = sizeof(intr->read_regs.buffer); - - memcpy(intr->read_regs.buffer, urb->transfer_buffer, len); - - /* Sometimes USB_INT_ID_REGS is not overridden, but comes after - * USB_INT_ID_RETRY_FAILED. Read-reg retry then gets this - * delayed USB_INT_ID_REGS, but leaves USB_INT_ID_REGS of - * retry unhandled. Next read-reg command then might catch - * this wrong USB_INT_ID_REGS. Fix by ignoring wrong reads. - */ - if (!check_read_regs(usb, intr->read_regs.req, - intr->read_regs.req_count)) - goto out; - - atomic_set(&intr->read_regs_enabled, 0); - intr->read_regs_int_overridden = 0; - complete(&intr->read_regs.completion); - - goto out; - } - -out: - spin_unlock(&intr->lock); - - /* CR_INTERRUPT might override read_reg too. */ - if (int_num == CR_INTERRUPT && atomic_read(&intr->read_regs_enabled)) - handle_regs_int_override(urb); -} - -static void int_urb_complete(struct urb *urb) -{ - int r; - struct usb_int_header *hdr; - struct zd_usb *usb; - struct zd_usb_interrupt *intr; - - switch (urb->status) { - case 0: - break; - case -ESHUTDOWN: - case -EINVAL: - case -ENODEV: - case -ENOENT: - case -ECONNRESET: - case -EPIPE: - dev_dbg_f(urb_dev(urb), "urb %p error %d\n", urb, urb->status); - return; - default: - dev_dbg_f(urb_dev(urb), "urb %p error %d\n", urb, urb->status); - goto resubmit; - } - - if (urb->actual_length < sizeof(hdr)) { - dev_dbg_f(urb_dev(urb), "error: urb %p to small\n", urb); - goto resubmit; - } - - hdr = urb->transfer_buffer; - if (hdr->type != USB_INT_TYPE) { - dev_dbg_f(urb_dev(urb), "error: urb %p wrong type\n", urb); - goto resubmit; - } - - /* USB_INT_ID_RETRY_FAILED triggered by tx-urb submit can override - * pending USB_INT_ID_REGS causing read command timeout. - */ - usb = urb->context; - intr = &usb->intr; - if (hdr->id != USB_INT_ID_REGS && atomic_read(&intr->read_regs_enabled)) - handle_regs_int_override(urb); - - switch (hdr->id) { - case USB_INT_ID_REGS: - handle_regs_int(urb); - break; - case USB_INT_ID_RETRY_FAILED: - zd_mac_tx_failed(urb); - break; - default: - dev_dbg_f(urb_dev(urb), "error: urb %p unknown id %x\n", urb, - (unsigned int)hdr->id); - goto resubmit; - } - -resubmit: - r = usb_submit_urb(urb, GFP_ATOMIC); - if (r) { - dev_dbg_f(urb_dev(urb), "error: resubmit urb %p err code %d\n", - urb, r); - /* TODO: add worker to reset intr->urb */ - } - return; -} - -static inline int int_urb_interval(struct usb_device *udev) -{ - switch (udev->speed) { - case USB_SPEED_HIGH: - return 4; - case USB_SPEED_LOW: - return 10; - case USB_SPEED_FULL: - default: - return 1; - } -} - -static inline int usb_int_enabled(struct zd_usb *usb) -{ - unsigned long flags; - struct zd_usb_interrupt *intr = &usb->intr; - struct urb *urb; - - spin_lock_irqsave(&intr->lock, flags); - urb = intr->urb; - spin_unlock_irqrestore(&intr->lock, flags); - return urb != NULL; -} - -int zd_usb_enable_int(struct zd_usb *usb) -{ - int r; - struct usb_device *udev = zd_usb_to_usbdev(usb); - struct zd_usb_interrupt *intr = &usb->intr; - struct urb *urb; - - dev_dbg_f(zd_usb_dev(usb), "\n"); - - urb = usb_alloc_urb(0, GFP_KERNEL); - if (!urb) { - r = -ENOMEM; - goto out; - } - - ZD_ASSERT(!irqs_disabled()); - spin_lock_irq(&intr->lock); - if (intr->urb) { - spin_unlock_irq(&intr->lock); - r = 0; - goto error_free_urb; - } - intr->urb = urb; - spin_unlock_irq(&intr->lock); - - r = -ENOMEM; - intr->buffer = usb_alloc_coherent(udev, USB_MAX_EP_INT_BUFFER, - GFP_KERNEL, &intr->buffer_dma); - if (!intr->buffer) { - dev_dbg_f(zd_usb_dev(usb), - "couldn't allocate transfer_buffer\n"); - goto error_set_urb_null; - } - - usb_fill_int_urb(urb, udev, usb_rcvintpipe(udev, EP_INT_IN), - intr->buffer, USB_MAX_EP_INT_BUFFER, - int_urb_complete, usb, - intr->interval); - urb->transfer_dma = intr->buffer_dma; - urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - - dev_dbg_f(zd_usb_dev(usb), "submit urb %p\n", intr->urb); - r = usb_submit_urb(urb, GFP_KERNEL); - if (r) { - dev_dbg_f(zd_usb_dev(usb), - "Couldn't submit urb. Error number %d\n", r); - goto error; - } - - return 0; -error: - usb_free_coherent(udev, USB_MAX_EP_INT_BUFFER, - intr->buffer, intr->buffer_dma); -error_set_urb_null: - spin_lock_irq(&intr->lock); - intr->urb = NULL; - spin_unlock_irq(&intr->lock); -error_free_urb: - usb_free_urb(urb); -out: - return r; -} - -void zd_usb_disable_int(struct zd_usb *usb) -{ - unsigned long flags; - struct usb_device *udev = zd_usb_to_usbdev(usb); - struct zd_usb_interrupt *intr = &usb->intr; - struct urb *urb; - void *buffer; - dma_addr_t buffer_dma; - - spin_lock_irqsave(&intr->lock, flags); - urb = intr->urb; - if (!urb) { - spin_unlock_irqrestore(&intr->lock, flags); - return; - } - intr->urb = NULL; - buffer = intr->buffer; - buffer_dma = intr->buffer_dma; - intr->buffer = NULL; - spin_unlock_irqrestore(&intr->lock, flags); - - usb_kill_urb(urb); - dev_dbg_f(zd_usb_dev(usb), "urb %p killed\n", urb); - usb_free_urb(urb); - - if (buffer) - usb_free_coherent(udev, USB_MAX_EP_INT_BUFFER, - buffer, buffer_dma); -} - -static void handle_rx_packet(struct zd_usb *usb, const u8 *buffer, - unsigned int length) -{ - int i; - const struct rx_length_info *length_info; - - if (length < sizeof(struct rx_length_info)) { - /* It's not a complete packet anyhow. */ - dev_dbg_f(zd_usb_dev(usb), "invalid, small RX packet : %d\n", - length); - return; - } - length_info = (struct rx_length_info *) - (buffer + length - sizeof(struct rx_length_info)); - - /* It might be that three frames are merged into a single URB - * transaction. We have to check for the length info tag. - * - * While testing we discovered that length_info might be unaligned, - * because if USB transactions are merged, the last packet will not - * be padded. Unaligned access might also happen if the length_info - * structure is not present. - */ - if (get_unaligned_le16(&length_info->tag) == RX_LENGTH_INFO_TAG) - { - unsigned int l, k, n; - for (i = 0, l = 0;; i++) { - k = get_unaligned_le16(&length_info->length[i]); - if (k == 0) - return; - n = l+k; - if (n > length) - return; - zd_mac_rx(zd_usb_to_hw(usb), buffer+l, k); - if (i >= 2) - return; - l = (n+3) & ~3; - } - } else { - zd_mac_rx(zd_usb_to_hw(usb), buffer, length); - } -} - -static void rx_urb_complete(struct urb *urb) -{ - int r; - struct zd_usb *usb; - struct zd_usb_rx *rx; - const u8 *buffer; - unsigned int length; - - switch (urb->status) { - case 0: - break; - case -ESHUTDOWN: - case -EINVAL: - case -ENODEV: - case -ENOENT: - case -ECONNRESET: - case -EPIPE: - dev_dbg_f(urb_dev(urb), "urb %p error %d\n", urb, urb->status); - return; - default: - dev_dbg_f(urb_dev(urb), "urb %p error %d\n", urb, urb->status); - goto resubmit; - } - - buffer = urb->transfer_buffer; - length = urb->actual_length; - usb = urb->context; - rx = &usb->rx; - - tasklet_schedule(&rx->reset_timer_tasklet); - - if (length%rx->usb_packet_size > rx->usb_packet_size-4) { - /* If there is an old first fragment, we don't care. */ - dev_dbg_f(urb_dev(urb), "*** first fragment ***\n"); - ZD_ASSERT(length <= ARRAY_SIZE(rx->fragment)); - spin_lock(&rx->lock); - memcpy(rx->fragment, buffer, length); - rx->fragment_length = length; - spin_unlock(&rx->lock); - goto resubmit; - } - - spin_lock(&rx->lock); - if (rx->fragment_length > 0) { - /* We are on a second fragment, we believe */ - ZD_ASSERT(length + rx->fragment_length <= - ARRAY_SIZE(rx->fragment)); - dev_dbg_f(urb_dev(urb), "*** second fragment ***\n"); - memcpy(rx->fragment+rx->fragment_length, buffer, length); - handle_rx_packet(usb, rx->fragment, - rx->fragment_length + length); - rx->fragment_length = 0; - spin_unlock(&rx->lock); - } else { - spin_unlock(&rx->lock); - handle_rx_packet(usb, buffer, length); - } - -resubmit: - r = usb_submit_urb(urb, GFP_ATOMIC); - if (r) - dev_dbg_f(urb_dev(urb), "urb %p resubmit error %d\n", urb, r); -} - -static struct urb *alloc_rx_urb(struct zd_usb *usb) -{ - struct usb_device *udev = zd_usb_to_usbdev(usb); - struct urb *urb; - void *buffer; - - urb = usb_alloc_urb(0, GFP_KERNEL); - if (!urb) - return NULL; - buffer = usb_alloc_coherent(udev, USB_MAX_RX_SIZE, GFP_KERNEL, - &urb->transfer_dma); - if (!buffer) { - usb_free_urb(urb); - return NULL; - } - - usb_fill_bulk_urb(urb, udev, usb_rcvbulkpipe(udev, EP_DATA_IN), - buffer, USB_MAX_RX_SIZE, - rx_urb_complete, usb); - urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - - return urb; -} - -static void free_rx_urb(struct urb *urb) -{ - if (!urb) - return; - usb_free_coherent(urb->dev, urb->transfer_buffer_length, - urb->transfer_buffer, urb->transfer_dma); - usb_free_urb(urb); -} - -static int __zd_usb_enable_rx(struct zd_usb *usb) -{ - int i, r; - struct zd_usb_rx *rx = &usb->rx; - struct urb **urbs; - - dev_dbg_f(zd_usb_dev(usb), "\n"); - - r = -ENOMEM; - urbs = kcalloc(RX_URBS_COUNT, sizeof(struct urb *), GFP_KERNEL); - if (!urbs) - goto error; - for (i = 0; i < RX_URBS_COUNT; i++) { - urbs[i] = alloc_rx_urb(usb); - if (!urbs[i]) - goto error; - } - - ZD_ASSERT(!irqs_disabled()); - spin_lock_irq(&rx->lock); - if (rx->urbs) { - spin_unlock_irq(&rx->lock); - r = 0; - goto error; - } - rx->urbs = urbs; - rx->urbs_count = RX_URBS_COUNT; - spin_unlock_irq(&rx->lock); - - for (i = 0; i < RX_URBS_COUNT; i++) { - r = usb_submit_urb(urbs[i], GFP_KERNEL); - if (r) - goto error_submit; - } - - return 0; -error_submit: - for (i = 0; i < RX_URBS_COUNT; i++) { - usb_kill_urb(urbs[i]); - } - spin_lock_irq(&rx->lock); - rx->urbs = NULL; - rx->urbs_count = 0; - spin_unlock_irq(&rx->lock); -error: - if (urbs) { - for (i = 0; i < RX_URBS_COUNT; i++) - free_rx_urb(urbs[i]); - } - return r; -} - -int zd_usb_enable_rx(struct zd_usb *usb) -{ - int r; - struct zd_usb_rx *rx = &usb->rx; - - mutex_lock(&rx->setup_mutex); - r = __zd_usb_enable_rx(usb); - mutex_unlock(&rx->setup_mutex); - - zd_usb_reset_rx_idle_timer(usb); - - return r; -} - -static void __zd_usb_disable_rx(struct zd_usb *usb) -{ - int i; - unsigned long flags; - struct urb **urbs; - unsigned int count; - struct zd_usb_rx *rx = &usb->rx; - - spin_lock_irqsave(&rx->lock, flags); - urbs = rx->urbs; - count = rx->urbs_count; - spin_unlock_irqrestore(&rx->lock, flags); - if (!urbs) - return; - - for (i = 0; i < count; i++) { - usb_kill_urb(urbs[i]); - free_rx_urb(urbs[i]); - } - kfree(urbs); - - spin_lock_irqsave(&rx->lock, flags); - rx->urbs = NULL; - rx->urbs_count = 0; - spin_unlock_irqrestore(&rx->lock, flags); -} - -void zd_usb_disable_rx(struct zd_usb *usb) -{ - struct zd_usb_rx *rx = &usb->rx; - - mutex_lock(&rx->setup_mutex); - __zd_usb_disable_rx(usb); - mutex_unlock(&rx->setup_mutex); - - tasklet_kill(&rx->reset_timer_tasklet); - cancel_delayed_work_sync(&rx->idle_work); -} - -static void zd_usb_reset_rx(struct zd_usb *usb) -{ - bool do_reset; - struct zd_usb_rx *rx = &usb->rx; - unsigned long flags; - - mutex_lock(&rx->setup_mutex); - - spin_lock_irqsave(&rx->lock, flags); - do_reset = rx->urbs != NULL; - spin_unlock_irqrestore(&rx->lock, flags); - - if (do_reset) { - __zd_usb_disable_rx(usb); - __zd_usb_enable_rx(usb); - } - - mutex_unlock(&rx->setup_mutex); - - if (do_reset) - zd_usb_reset_rx_idle_timer(usb); -} - -/** - * zd_usb_disable_tx - disable transmission - * @usb: the zd1211rw-private USB structure - * - * Frees all URBs in the free list and marks the transmission as disabled. - */ -void zd_usb_disable_tx(struct zd_usb *usb) -{ - struct zd_usb_tx *tx = &usb->tx; - unsigned long flags; - - atomic_set(&tx->enabled, 0); - - /* kill all submitted tx-urbs */ - usb_kill_anchored_urbs(&tx->submitted); - - spin_lock_irqsave(&tx->lock, flags); - WARN_ON(!skb_queue_empty(&tx->submitted_skbs)); - WARN_ON(tx->submitted_urbs != 0); - tx->submitted_urbs = 0; - spin_unlock_irqrestore(&tx->lock, flags); - - /* The stopped state is ignored, relying on ieee80211_wake_queues() - * in a potentionally following zd_usb_enable_tx(). - */ -} - -/** - * zd_usb_enable_tx - enables transmission - * @usb: a &struct zd_usb pointer - * - * This function enables transmission and prepares the &zd_usb_tx data - * structure. - */ -void zd_usb_enable_tx(struct zd_usb *usb) -{ - unsigned long flags; - struct zd_usb_tx *tx = &usb->tx; - - spin_lock_irqsave(&tx->lock, flags); - atomic_set(&tx->enabled, 1); - tx->submitted_urbs = 0; - ieee80211_wake_queues(zd_usb_to_hw(usb)); - tx->stopped = 0; - spin_unlock_irqrestore(&tx->lock, flags); -} - -static void tx_dec_submitted_urbs(struct zd_usb *usb) -{ - struct zd_usb_tx *tx = &usb->tx; - unsigned long flags; - - spin_lock_irqsave(&tx->lock, flags); - --tx->submitted_urbs; - if (tx->stopped && tx->submitted_urbs <= ZD_USB_TX_LOW) { - ieee80211_wake_queues(zd_usb_to_hw(usb)); - tx->stopped = 0; - } - spin_unlock_irqrestore(&tx->lock, flags); -} - -static void tx_inc_submitted_urbs(struct zd_usb *usb) -{ - struct zd_usb_tx *tx = &usb->tx; - unsigned long flags; - - spin_lock_irqsave(&tx->lock, flags); - ++tx->submitted_urbs; - if (!tx->stopped && tx->submitted_urbs > ZD_USB_TX_HIGH) { - ieee80211_stop_queues(zd_usb_to_hw(usb)); - tx->stopped = 1; - } - spin_unlock_irqrestore(&tx->lock, flags); -} - -/** - * tx_urb_complete - completes the execution of an URB - * @urb: a URB - * - * This function is called if the URB has been transferred to a device or an - * error has happened. - */ -static void tx_urb_complete(struct urb *urb) -{ - int r; - struct sk_buff *skb; - struct ieee80211_tx_info *info; - struct zd_usb *usb; - struct zd_usb_tx *tx; - - skb = (struct sk_buff *)urb->context; - info = IEEE80211_SKB_CB(skb); - /* - * grab 'usb' pointer before handing off the skb (since - * it might be freed by zd_mac_tx_to_dev or mac80211) - */ - usb = &zd_hw_mac(info->rate_driver_data[0])->chip.usb; - tx = &usb->tx; - - switch (urb->status) { - case 0: - break; - case -ESHUTDOWN: - case -EINVAL: - case -ENODEV: - case -ENOENT: - case -ECONNRESET: - case -EPIPE: - dev_dbg_f(urb_dev(urb), "urb %p error %d\n", urb, urb->status); - break; - default: - dev_dbg_f(urb_dev(urb), "urb %p error %d\n", urb, urb->status); - goto resubmit; - } -free_urb: - skb_unlink(skb, &usb->tx.submitted_skbs); - zd_mac_tx_to_dev(skb, urb->status); - usb_free_urb(urb); - tx_dec_submitted_urbs(usb); - return; -resubmit: - usb_anchor_urb(urb, &tx->submitted); - r = usb_submit_urb(urb, GFP_ATOMIC); - if (r) { - usb_unanchor_urb(urb); - dev_dbg_f(urb_dev(urb), "error resubmit urb %p %d\n", urb, r); - goto free_urb; - } -} - -/** - * zd_usb_tx: initiates transfer of a frame of the device - * - * @usb: the zd1211rw-private USB structure - * @skb: a &struct sk_buff pointer - * - * This function tranmits a frame to the device. It doesn't wait for - * completion. The frame must contain the control set and have all the - * control set information available. - * - * The function returns 0 if the transfer has been successfully initiated. - */ -int zd_usb_tx(struct zd_usb *usb, struct sk_buff *skb) -{ - int r; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct usb_device *udev = zd_usb_to_usbdev(usb); - struct urb *urb; - struct zd_usb_tx *tx = &usb->tx; - - if (!atomic_read(&tx->enabled)) { - r = -ENOENT; - goto out; - } - - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!urb) { - r = -ENOMEM; - goto out; - } - - usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_DATA_OUT), - skb->data, skb->len, tx_urb_complete, skb); - - info->rate_driver_data[1] = (void *)jiffies; - skb_queue_tail(&tx->submitted_skbs, skb); - usb_anchor_urb(urb, &tx->submitted); - - r = usb_submit_urb(urb, GFP_ATOMIC); - if (r) { - dev_dbg_f(zd_usb_dev(usb), "error submit urb %p %d\n", urb, r); - usb_unanchor_urb(urb); - skb_unlink(skb, &tx->submitted_skbs); - goto error; - } - tx_inc_submitted_urbs(usb); - return 0; -error: - usb_free_urb(urb); -out: - return r; -} - -static bool zd_tx_timeout(struct zd_usb *usb) -{ - struct zd_usb_tx *tx = &usb->tx; - struct sk_buff_head *q = &tx->submitted_skbs; - struct sk_buff *skb, *skbnext; - struct ieee80211_tx_info *info; - unsigned long flags, trans_start; - bool have_timedout = false; - - spin_lock_irqsave(&q->lock, flags); - skb_queue_walk_safe(q, skb, skbnext) { - info = IEEE80211_SKB_CB(skb); - trans_start = (unsigned long)info->rate_driver_data[1]; - - if (time_is_before_jiffies(trans_start + ZD_TX_TIMEOUT)) { - have_timedout = true; - break; - } - } - spin_unlock_irqrestore(&q->lock, flags); - - return have_timedout; -} - -static void zd_tx_watchdog_handler(struct work_struct *work) -{ - struct zd_usb *usb = - container_of(work, struct zd_usb, tx.watchdog_work.work); - struct zd_usb_tx *tx = &usb->tx; - - if (!atomic_read(&tx->enabled) || !tx->watchdog_enabled) - goto out; - if (!zd_tx_timeout(usb)) - goto out; - - /* TX halted, try reset */ - dev_warn(zd_usb_dev(usb), "TX-stall detected, resetting device..."); - - usb_queue_reset_device(usb->intf); - - /* reset will stop this worker, don't rearm */ - return; -out: - queue_delayed_work(zd_workqueue, &tx->watchdog_work, - ZD_TX_WATCHDOG_INTERVAL); -} - -void zd_tx_watchdog_enable(struct zd_usb *usb) -{ - struct zd_usb_tx *tx = &usb->tx; - - if (!tx->watchdog_enabled) { - dev_dbg_f(zd_usb_dev(usb), "\n"); - queue_delayed_work(zd_workqueue, &tx->watchdog_work, - ZD_TX_WATCHDOG_INTERVAL); - tx->watchdog_enabled = 1; - } -} - -void zd_tx_watchdog_disable(struct zd_usb *usb) -{ - struct zd_usb_tx *tx = &usb->tx; - - if (tx->watchdog_enabled) { - dev_dbg_f(zd_usb_dev(usb), "\n"); - tx->watchdog_enabled = 0; - cancel_delayed_work_sync(&tx->watchdog_work); - } -} - -static void zd_rx_idle_timer_handler(struct work_struct *work) -{ - struct zd_usb *usb = - container_of(work, struct zd_usb, rx.idle_work.work); - struct zd_mac *mac = zd_usb_to_mac(usb); - - if (!test_bit(ZD_DEVICE_RUNNING, &mac->flags)) - return; - - dev_dbg_f(zd_usb_dev(usb), "\n"); - - /* 30 seconds since last rx, reset rx */ - zd_usb_reset_rx(usb); -} - -static void zd_usb_reset_rx_idle_timer_tasklet(unsigned long param) -{ - struct zd_usb *usb = (struct zd_usb *)param; - - zd_usb_reset_rx_idle_timer(usb); -} - -void zd_usb_reset_rx_idle_timer(struct zd_usb *usb) -{ - struct zd_usb_rx *rx = &usb->rx; - - mod_delayed_work(zd_workqueue, &rx->idle_work, ZD_RX_IDLE_INTERVAL); -} - -static inline void init_usb_interrupt(struct zd_usb *usb) -{ - struct zd_usb_interrupt *intr = &usb->intr; - - spin_lock_init(&intr->lock); - intr->interval = int_urb_interval(zd_usb_to_usbdev(usb)); - init_completion(&intr->read_regs.completion); - atomic_set(&intr->read_regs_enabled, 0); - intr->read_regs.cr_int_addr = cpu_to_le16((u16)CR_INTERRUPT); -} - -static inline void init_usb_rx(struct zd_usb *usb) -{ - struct zd_usb_rx *rx = &usb->rx; - - spin_lock_init(&rx->lock); - mutex_init(&rx->setup_mutex); - if (interface_to_usbdev(usb->intf)->speed == USB_SPEED_HIGH) { - rx->usb_packet_size = 512; - } else { - rx->usb_packet_size = 64; - } - ZD_ASSERT(rx->fragment_length == 0); - INIT_DELAYED_WORK(&rx->idle_work, zd_rx_idle_timer_handler); - rx->reset_timer_tasklet.func = zd_usb_reset_rx_idle_timer_tasklet; - rx->reset_timer_tasklet.data = (unsigned long)usb; -} - -static inline void init_usb_tx(struct zd_usb *usb) -{ - struct zd_usb_tx *tx = &usb->tx; - - spin_lock_init(&tx->lock); - atomic_set(&tx->enabled, 0); - tx->stopped = 0; - skb_queue_head_init(&tx->submitted_skbs); - init_usb_anchor(&tx->submitted); - tx->submitted_urbs = 0; - tx->watchdog_enabled = 0; - INIT_DELAYED_WORK(&tx->watchdog_work, zd_tx_watchdog_handler); -} - -void zd_usb_init(struct zd_usb *usb, struct ieee80211_hw *hw, - struct usb_interface *intf) -{ - memset(usb, 0, sizeof(*usb)); - usb->intf = usb_get_intf(intf); - usb_set_intfdata(usb->intf, hw); - init_usb_anchor(&usb->submitted_cmds); - init_usb_interrupt(usb); - init_usb_tx(usb); - init_usb_rx(usb); -} - -void zd_usb_clear(struct zd_usb *usb) -{ - usb_set_intfdata(usb->intf, NULL); - usb_put_intf(usb->intf); - ZD_MEMCLEAR(usb, sizeof(*usb)); - /* FIXME: usb_interrupt, usb_tx, usb_rx? */ -} - -static const char *speed(enum usb_device_speed speed) -{ - switch (speed) { - case USB_SPEED_LOW: - return "low"; - case USB_SPEED_FULL: - return "full"; - case USB_SPEED_HIGH: - return "high"; - default: - return "unknown speed"; - } -} - -static int scnprint_id(struct usb_device *udev, char *buffer, size_t size) -{ - return scnprintf(buffer, size, "%04hx:%04hx v%04hx %s", - le16_to_cpu(udev->descriptor.idVendor), - le16_to_cpu(udev->descriptor.idProduct), - get_bcdDevice(udev), - speed(udev->speed)); -} - -int zd_usb_scnprint_id(struct zd_usb *usb, char *buffer, size_t size) -{ - struct usb_device *udev = interface_to_usbdev(usb->intf); - return scnprint_id(udev, buffer, size); -} - -#ifdef DEBUG -static void print_id(struct usb_device *udev) -{ - char buffer[40]; - - scnprint_id(udev, buffer, sizeof(buffer)); - buffer[sizeof(buffer)-1] = 0; - dev_dbg_f(&udev->dev, "%s\n", buffer); -} -#else -#define print_id(udev) do { } while (0) -#endif - -static int eject_installer(struct usb_interface *intf) -{ - struct usb_device *udev = interface_to_usbdev(intf); - struct usb_host_interface *iface_desc = &intf->altsetting[0]; - struct usb_endpoint_descriptor *endpoint; - unsigned char *cmd; - u8 bulk_out_ep; - int r; - - /* Find bulk out endpoint */ - for (r = 1; r >= 0; r--) { - endpoint = &iface_desc->endpoint[r].desc; - if (usb_endpoint_dir_out(endpoint) && - usb_endpoint_xfer_bulk(endpoint)) { - bulk_out_ep = endpoint->bEndpointAddress; - break; - } - } - if (r == -1) { - dev_err(&udev->dev, - "zd1211rw: Could not find bulk out endpoint\n"); - return -ENODEV; - } - - cmd = kzalloc(31, GFP_KERNEL); - if (cmd == NULL) - return -ENODEV; - - /* USB bulk command block */ - cmd[0] = 0x55; /* bulk command signature */ - cmd[1] = 0x53; /* bulk command signature */ - cmd[2] = 0x42; /* bulk command signature */ - cmd[3] = 0x43; /* bulk command signature */ - cmd[14] = 6; /* command length */ - - cmd[15] = 0x1b; /* SCSI command: START STOP UNIT */ - cmd[19] = 0x2; /* eject disc */ - - dev_info(&udev->dev, "Ejecting virtual installer media...\n"); - r = usb_bulk_msg(udev, usb_sndbulkpipe(udev, bulk_out_ep), - cmd, 31, NULL, 2000); - kfree(cmd); - if (r) - return r; - - /* At this point, the device disconnects and reconnects with the real - * ID numbers. */ - - usb_set_intfdata(intf, NULL); - return 0; -} - -int zd_usb_init_hw(struct zd_usb *usb) -{ - int r; - struct zd_mac *mac = zd_usb_to_mac(usb); - - dev_dbg_f(zd_usb_dev(usb), "\n"); - - r = upload_firmware(usb); - if (r) { - dev_err(zd_usb_dev(usb), - "couldn't load firmware. Error number %d\n", r); - return r; - } - - r = usb_reset_configuration(zd_usb_to_usbdev(usb)); - if (r) { - dev_dbg_f(zd_usb_dev(usb), - "couldn't reset configuration. Error number %d\n", r); - return r; - } - - r = zd_mac_init_hw(mac->hw); - if (r) { - dev_dbg_f(zd_usb_dev(usb), - "couldn't initialize mac. Error number %d\n", r); - return r; - } - - usb->initialized = 1; - return 0; -} - -static int probe(struct usb_interface *intf, const struct usb_device_id *id) -{ - int r; - struct usb_device *udev = interface_to_usbdev(intf); - struct zd_usb *usb; - struct ieee80211_hw *hw = NULL; - - print_id(udev); - - if (id->driver_info & DEVICE_INSTALLER) - return eject_installer(intf); - - switch (udev->speed) { - case USB_SPEED_LOW: - case USB_SPEED_FULL: - case USB_SPEED_HIGH: - break; - default: - dev_dbg_f(&intf->dev, "Unknown USB speed\n"); - r = -ENODEV; - goto error; - } - - r = usb_reset_device(udev); - if (r) { - dev_err(&intf->dev, - "couldn't reset usb device. Error number %d\n", r); - goto error; - } - - hw = zd_mac_alloc_hw(intf); - if (hw == NULL) { - r = -ENOMEM; - goto error; - } - - usb = &zd_hw_mac(hw)->chip.usb; - usb->is_zd1211b = (id->driver_info == DEVICE_ZD1211B) != 0; - - r = zd_mac_preinit_hw(hw); - if (r) { - dev_dbg_f(&intf->dev, - "couldn't initialize mac. Error number %d\n", r); - goto error; - } - - r = ieee80211_register_hw(hw); - if (r) { - dev_dbg_f(&intf->dev, - "couldn't register device. Error number %d\n", r); - goto error; - } - - dev_dbg_f(&intf->dev, "successful\n"); - dev_info(&intf->dev, "%s\n", wiphy_name(hw->wiphy)); - return 0; -error: - usb_reset_device(interface_to_usbdev(intf)); - if (hw) { - zd_mac_clear(zd_hw_mac(hw)); - ieee80211_free_hw(hw); - } - return r; -} - -static void disconnect(struct usb_interface *intf) -{ - struct ieee80211_hw *hw = zd_intf_to_hw(intf); - struct zd_mac *mac; - struct zd_usb *usb; - - /* Either something really bad happened, or we're just dealing with - * a DEVICE_INSTALLER. */ - if (hw == NULL) - return; - - mac = zd_hw_mac(hw); - usb = &mac->chip.usb; - - dev_dbg_f(zd_usb_dev(usb), "\n"); - - ieee80211_unregister_hw(hw); - - /* Just in case something has gone wrong! */ - zd_usb_disable_tx(usb); - zd_usb_disable_rx(usb); - zd_usb_disable_int(usb); - - /* If the disconnect has been caused by a removal of the - * driver module, the reset allows reloading of the driver. If the - * reset will not be executed here, the upload of the firmware in the - * probe function caused by the reloading of the driver will fail. - */ - usb_reset_device(interface_to_usbdev(intf)); - - zd_mac_clear(mac); - ieee80211_free_hw(hw); - dev_dbg(&intf->dev, "disconnected\n"); -} - -static void zd_usb_resume(struct zd_usb *usb) -{ - struct zd_mac *mac = zd_usb_to_mac(usb); - int r; - - dev_dbg_f(zd_usb_dev(usb), "\n"); - - r = zd_op_start(zd_usb_to_hw(usb)); - if (r < 0) { - dev_warn(zd_usb_dev(usb), "Device resume failed " - "with error code %d. Retrying...\n", r); - if (usb->was_running) - set_bit(ZD_DEVICE_RUNNING, &mac->flags); - usb_queue_reset_device(usb->intf); - return; - } - - if (mac->type != NL80211_IFTYPE_UNSPECIFIED) { - r = zd_restore_settings(mac); - if (r < 0) { - dev_dbg(zd_usb_dev(usb), - "failed to restore settings, %d\n", r); - return; - } - } -} - -static void zd_usb_stop(struct zd_usb *usb) -{ - dev_dbg_f(zd_usb_dev(usb), "\n"); - - zd_op_stop(zd_usb_to_hw(usb)); - - zd_usb_disable_tx(usb); - zd_usb_disable_rx(usb); - zd_usb_disable_int(usb); - - usb->initialized = 0; -} - -static int pre_reset(struct usb_interface *intf) -{ - struct ieee80211_hw *hw = usb_get_intfdata(intf); - struct zd_mac *mac; - struct zd_usb *usb; - - if (!hw || intf->condition != USB_INTERFACE_BOUND) - return 0; - - mac = zd_hw_mac(hw); - usb = &mac->chip.usb; - - usb->was_running = test_bit(ZD_DEVICE_RUNNING, &mac->flags); - - zd_usb_stop(usb); - - mutex_lock(&mac->chip.mutex); - return 0; -} - -static int post_reset(struct usb_interface *intf) -{ - struct ieee80211_hw *hw = usb_get_intfdata(intf); - struct zd_mac *mac; - struct zd_usb *usb; - - if (!hw || intf->condition != USB_INTERFACE_BOUND) - return 0; - - mac = zd_hw_mac(hw); - usb = &mac->chip.usb; - - mutex_unlock(&mac->chip.mutex); - - if (usb->was_running) - zd_usb_resume(usb); - return 0; -} - -static struct usb_driver driver = { - .name = KBUILD_MODNAME, - .id_table = usb_ids, - .probe = probe, - .disconnect = disconnect, - .pre_reset = pre_reset, - .post_reset = post_reset, - .disable_hub_initiated_lpm = 1, -}; - -struct workqueue_struct *zd_workqueue; - -static int __init usb_init(void) -{ - int r; - - pr_debug("%s usb_init()\n", driver.name); - - zd_workqueue = create_singlethread_workqueue(driver.name); - if (zd_workqueue == NULL) { - printk(KERN_ERR "%s couldn't create workqueue\n", driver.name); - return -ENOMEM; - } - - r = usb_register(&driver); - if (r) { - destroy_workqueue(zd_workqueue); - printk(KERN_ERR "%s usb_register() failed. Error number %d\n", - driver.name, r); - return r; - } - - pr_debug("%s initialized\n", driver.name); - return 0; -} - -static void __exit usb_exit(void) -{ - pr_debug("%s usb_exit()\n", driver.name); - usb_deregister(&driver); - destroy_workqueue(zd_workqueue); -} - -module_init(usb_init); -module_exit(usb_exit); - -static int zd_ep_regs_out_msg(struct usb_device *udev, void *data, int len, - int *actual_length, int timeout) -{ - /* In USB 2.0 mode EP_REGS_OUT endpoint is interrupt type. However in - * USB 1.1 mode endpoint is bulk. Select correct type URB by endpoint - * descriptor. - */ - struct usb_host_endpoint *ep; - unsigned int pipe; - - pipe = usb_sndintpipe(udev, EP_REGS_OUT); - ep = usb_pipe_endpoint(udev, pipe); - if (!ep) - return -EINVAL; - - if (usb_endpoint_xfer_int(&ep->desc)) { - return usb_interrupt_msg(udev, pipe, data, len, - actual_length, timeout); - } else { - pipe = usb_sndbulkpipe(udev, EP_REGS_OUT); - return usb_bulk_msg(udev, pipe, data, len, actual_length, - timeout); - } -} - -static int usb_int_regs_length(unsigned int count) -{ - return sizeof(struct usb_int_regs) + count * sizeof(struct reg_data); -} - -static void prepare_read_regs_int(struct zd_usb *usb, - struct usb_req_read_regs *req, - unsigned int count) -{ - struct zd_usb_interrupt *intr = &usb->intr; - - spin_lock_irq(&intr->lock); - atomic_set(&intr->read_regs_enabled, 1); - intr->read_regs.req = req; - intr->read_regs.req_count = count; - INIT_COMPLETION(intr->read_regs.completion); - spin_unlock_irq(&intr->lock); -} - -static void disable_read_regs_int(struct zd_usb *usb) -{ - struct zd_usb_interrupt *intr = &usb->intr; - - spin_lock_irq(&intr->lock); - atomic_set(&intr->read_regs_enabled, 0); - spin_unlock_irq(&intr->lock); -} - -static bool check_read_regs(struct zd_usb *usb, struct usb_req_read_regs *req, - unsigned int count) -{ - int i; - struct zd_usb_interrupt *intr = &usb->intr; - struct read_regs_int *rr = &intr->read_regs; - struct usb_int_regs *regs = (struct usb_int_regs *)rr->buffer; - - /* The created block size seems to be larger than expected. - * However results appear to be correct. - */ - if (rr->length < usb_int_regs_length(count)) { - dev_dbg_f(zd_usb_dev(usb), - "error: actual length %d less than expected %d\n", - rr->length, usb_int_regs_length(count)); - return false; - } - - if (rr->length > sizeof(rr->buffer)) { - dev_dbg_f(zd_usb_dev(usb), - "error: actual length %d exceeds buffer size %zu\n", - rr->length, sizeof(rr->buffer)); - return false; - } - - for (i = 0; i < count; i++) { - struct reg_data *rd = ®s->regs[i]; - if (rd->addr != req->addr[i]) { - dev_dbg_f(zd_usb_dev(usb), - "rd[%d] addr %#06hx expected %#06hx\n", i, - le16_to_cpu(rd->addr), - le16_to_cpu(req->addr[i])); - return false; - } - } - - return true; -} - -static int get_results(struct zd_usb *usb, u16 *values, - struct usb_req_read_regs *req, unsigned int count, - bool *retry) -{ - int r; - int i; - struct zd_usb_interrupt *intr = &usb->intr; - struct read_regs_int *rr = &intr->read_regs; - struct usb_int_regs *regs = (struct usb_int_regs *)rr->buffer; - - spin_lock_irq(&intr->lock); - - r = -EIO; - - /* Read failed because firmware bug? */ - *retry = !!intr->read_regs_int_overridden; - if (*retry) - goto error_unlock; - - if (!check_read_regs(usb, req, count)) { - dev_dbg_f(zd_usb_dev(usb), "error: invalid read regs\n"); - goto error_unlock; - } - - for (i = 0; i < count; i++) { - struct reg_data *rd = ®s->regs[i]; - values[i] = le16_to_cpu(rd->value); - } - - r = 0; -error_unlock: - spin_unlock_irq(&intr->lock); - return r; -} - -int zd_usb_ioread16v(struct zd_usb *usb, u16 *values, - const zd_addr_t *addresses, unsigned int count) -{ - int r, i, req_len, actual_req_len, try_count = 0; - struct usb_device *udev; - struct usb_req_read_regs *req = NULL; - unsigned long timeout; - bool retry = false; - - if (count < 1) { - dev_dbg_f(zd_usb_dev(usb), "error: count is zero\n"); - return -EINVAL; - } - if (count > USB_MAX_IOREAD16_COUNT) { - dev_dbg_f(zd_usb_dev(usb), - "error: count %u exceeds possible max %u\n", - count, USB_MAX_IOREAD16_COUNT); - return -EINVAL; - } - if (in_atomic()) { - dev_dbg_f(zd_usb_dev(usb), - "error: io in atomic context not supported\n"); - return -EWOULDBLOCK; - } - if (!usb_int_enabled(usb)) { - dev_dbg_f(zd_usb_dev(usb), - "error: usb interrupt not enabled\n"); - return -EWOULDBLOCK; - } - - ZD_ASSERT(mutex_is_locked(&zd_usb_to_chip(usb)->mutex)); - BUILD_BUG_ON(sizeof(struct usb_req_read_regs) + USB_MAX_IOREAD16_COUNT * - sizeof(__le16) > sizeof(usb->req_buf)); - BUG_ON(sizeof(struct usb_req_read_regs) + count * sizeof(__le16) > - sizeof(usb->req_buf)); - - req_len = sizeof(struct usb_req_read_regs) + count * sizeof(__le16); - req = (void *)usb->req_buf; - - req->id = cpu_to_le16(USB_REQ_READ_REGS); - for (i = 0; i < count; i++) - req->addr[i] = cpu_to_le16((u16)addresses[i]); - -retry_read: - try_count++; - udev = zd_usb_to_usbdev(usb); - prepare_read_regs_int(usb, req, count); - r = zd_ep_regs_out_msg(udev, req, req_len, &actual_req_len, 50 /*ms*/); - if (r) { - dev_dbg_f(zd_usb_dev(usb), - "error in zd_ep_regs_out_msg(). Error number %d\n", r); - goto error; - } - if (req_len != actual_req_len) { - dev_dbg_f(zd_usb_dev(usb), "error in zd_ep_regs_out_msg()\n" - " req_len %d != actual_req_len %d\n", - req_len, actual_req_len); - r = -EIO; - goto error; - } - - timeout = wait_for_completion_timeout(&usb->intr.read_regs.completion, - msecs_to_jiffies(50)); - if (!timeout) { - disable_read_regs_int(usb); - dev_dbg_f(zd_usb_dev(usb), "read timed out\n"); - r = -ETIMEDOUT; - goto error; - } - - r = get_results(usb, values, req, count, &retry); - if (retry && try_count < 20) { - dev_dbg_f(zd_usb_dev(usb), "read retry, tries so far: %d\n", - try_count); - goto retry_read; - } -error: - return r; -} - -static void iowrite16v_urb_complete(struct urb *urb) -{ - struct zd_usb *usb = urb->context; - - if (urb->status && !usb->cmd_error) - usb->cmd_error = urb->status; - - if (!usb->cmd_error && - urb->actual_length != urb->transfer_buffer_length) - usb->cmd_error = -EIO; -} - -static int zd_submit_waiting_urb(struct zd_usb *usb, bool last) -{ - int r = 0; - struct urb *urb = usb->urb_async_waiting; - - if (!urb) - return 0; - - usb->urb_async_waiting = NULL; - - if (!last) - urb->transfer_flags |= URB_NO_INTERRUPT; - - usb_anchor_urb(urb, &usb->submitted_cmds); - r = usb_submit_urb(urb, GFP_KERNEL); - if (r) { - usb_unanchor_urb(urb); - dev_dbg_f(zd_usb_dev(usb), - "error in usb_submit_urb(). Error number %d\n", r); - goto error; - } - - /* fall-through with r == 0 */ -error: - usb_free_urb(urb); - return r; -} - -void zd_usb_iowrite16v_async_start(struct zd_usb *usb) -{ - ZD_ASSERT(usb_anchor_empty(&usb->submitted_cmds)); - ZD_ASSERT(usb->urb_async_waiting == NULL); - ZD_ASSERT(!usb->in_async); - - ZD_ASSERT(mutex_is_locked(&zd_usb_to_chip(usb)->mutex)); - - usb->in_async = 1; - usb->cmd_error = 0; - usb->urb_async_waiting = NULL; -} - -int zd_usb_iowrite16v_async_end(struct zd_usb *usb, unsigned int timeout) -{ - int r; - - ZD_ASSERT(mutex_is_locked(&zd_usb_to_chip(usb)->mutex)); - ZD_ASSERT(usb->in_async); - - /* Submit last iowrite16v URB */ - r = zd_submit_waiting_urb(usb, true); - if (r) { - dev_dbg_f(zd_usb_dev(usb), - "error in zd_submit_waiting_usb(). " - "Error number %d\n", r); - - usb_kill_anchored_urbs(&usb->submitted_cmds); - goto error; - } - - if (timeout) - timeout = usb_wait_anchor_empty_timeout(&usb->submitted_cmds, - timeout); - if (!timeout) { - usb_kill_anchored_urbs(&usb->submitted_cmds); - if (usb->cmd_error == -ENOENT) { - dev_dbg_f(zd_usb_dev(usb), "timed out"); - r = -ETIMEDOUT; - goto error; - } - } - - r = usb->cmd_error; -error: - usb->in_async = 0; - return r; -} - -int zd_usb_iowrite16v_async(struct zd_usb *usb, const struct zd_ioreq16 *ioreqs, - unsigned int count) -{ - int r; - struct usb_device *udev; - struct usb_req_write_regs *req = NULL; - int i, req_len; - struct urb *urb; - struct usb_host_endpoint *ep; - - ZD_ASSERT(mutex_is_locked(&zd_usb_to_chip(usb)->mutex)); - ZD_ASSERT(usb->in_async); - - if (count == 0) - return 0; - if (count > USB_MAX_IOWRITE16_COUNT) { - dev_dbg_f(zd_usb_dev(usb), - "error: count %u exceeds possible max %u\n", - count, USB_MAX_IOWRITE16_COUNT); - return -EINVAL; - } - if (in_atomic()) { - dev_dbg_f(zd_usb_dev(usb), - "error: io in atomic context not supported\n"); - return -EWOULDBLOCK; - } - - udev = zd_usb_to_usbdev(usb); - - ep = usb_pipe_endpoint(udev, usb_sndintpipe(udev, EP_REGS_OUT)); - if (!ep) - return -ENOENT; - - urb = usb_alloc_urb(0, GFP_KERNEL); - if (!urb) - return -ENOMEM; - - req_len = sizeof(struct usb_req_write_regs) + - count * sizeof(struct reg_data); - req = kmalloc(req_len, GFP_KERNEL); - if (!req) { - r = -ENOMEM; - goto error; - } - - req->id = cpu_to_le16(USB_REQ_WRITE_REGS); - for (i = 0; i < count; i++) { - struct reg_data *rw = &req->reg_writes[i]; - rw->addr = cpu_to_le16((u16)ioreqs[i].addr); - rw->value = cpu_to_le16(ioreqs[i].value); - } - - /* In USB 2.0 mode endpoint is interrupt type. However in USB 1.1 mode - * endpoint is bulk. Select correct type URB by endpoint descriptor. - */ - if (usb_endpoint_xfer_int(&ep->desc)) - usb_fill_int_urb(urb, udev, usb_sndintpipe(udev, EP_REGS_OUT), - req, req_len, iowrite16v_urb_complete, usb, - ep->desc.bInterval); - else - usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_REGS_OUT), - req, req_len, iowrite16v_urb_complete, usb); - - urb->transfer_flags |= URB_FREE_BUFFER; - - /* Submit previous URB */ - r = zd_submit_waiting_urb(usb, false); - if (r) { - dev_dbg_f(zd_usb_dev(usb), - "error in zd_submit_waiting_usb(). " - "Error number %d\n", r); - goto error; - } - - /* Delay submit so that URB_NO_INTERRUPT flag can be set for all URBs - * of currect batch except for very last. - */ - usb->urb_async_waiting = urb; - return 0; -error: - usb_free_urb(urb); - return r; -} - -int zd_usb_iowrite16v(struct zd_usb *usb, const struct zd_ioreq16 *ioreqs, - unsigned int count) -{ - int r; - - zd_usb_iowrite16v_async_start(usb); - r = zd_usb_iowrite16v_async(usb, ioreqs, count); - if (r) { - zd_usb_iowrite16v_async_end(usb, 0); - return r; - } - return zd_usb_iowrite16v_async_end(usb, 50 /* ms */); -} - -int zd_usb_rfwrite(struct zd_usb *usb, u32 value, u8 bits) -{ - int r; - struct usb_device *udev; - struct usb_req_rfwrite *req = NULL; - int i, req_len, actual_req_len; - u16 bit_value_template; - - if (in_atomic()) { - dev_dbg_f(zd_usb_dev(usb), - "error: io in atomic context not supported\n"); - return -EWOULDBLOCK; - } - if (bits < USB_MIN_RFWRITE_BIT_COUNT) { - dev_dbg_f(zd_usb_dev(usb), - "error: bits %d are smaller than" - " USB_MIN_RFWRITE_BIT_COUNT %d\n", - bits, USB_MIN_RFWRITE_BIT_COUNT); - return -EINVAL; - } - if (bits > USB_MAX_RFWRITE_BIT_COUNT) { - dev_dbg_f(zd_usb_dev(usb), - "error: bits %d exceed USB_MAX_RFWRITE_BIT_COUNT %d\n", - bits, USB_MAX_RFWRITE_BIT_COUNT); - return -EINVAL; - } -#ifdef DEBUG - if (value & (~0UL << bits)) { - dev_dbg_f(zd_usb_dev(usb), - "error: value %#09x has bits >= %d set\n", - value, bits); - return -EINVAL; - } -#endif /* DEBUG */ - - dev_dbg_f(zd_usb_dev(usb), "value %#09x bits %d\n", value, bits); - - r = zd_usb_ioread16(usb, &bit_value_template, ZD_CR203); - if (r) { - dev_dbg_f(zd_usb_dev(usb), - "error %d: Couldn't read ZD_CR203\n", r); - return r; - } - bit_value_template &= ~(RF_IF_LE|RF_CLK|RF_DATA); - - ZD_ASSERT(mutex_is_locked(&zd_usb_to_chip(usb)->mutex)); - BUILD_BUG_ON(sizeof(struct usb_req_rfwrite) + - USB_MAX_RFWRITE_BIT_COUNT * sizeof(__le16) > - sizeof(usb->req_buf)); - BUG_ON(sizeof(struct usb_req_rfwrite) + bits * sizeof(__le16) > - sizeof(usb->req_buf)); - - req_len = sizeof(struct usb_req_rfwrite) + bits * sizeof(__le16); - req = (void *)usb->req_buf; - - req->id = cpu_to_le16(USB_REQ_WRITE_RF); - /* 1: 3683a, but not used in ZYDAS driver */ - req->value = cpu_to_le16(2); - req->bits = cpu_to_le16(bits); - - for (i = 0; i < bits; i++) { - u16 bv = bit_value_template; - if (value & (1 << (bits-1-i))) - bv |= RF_DATA; - req->bit_values[i] = cpu_to_le16(bv); - } - - udev = zd_usb_to_usbdev(usb); - r = zd_ep_regs_out_msg(udev, req, req_len, &actual_req_len, 50 /*ms*/); - if (r) { - dev_dbg_f(zd_usb_dev(usb), - "error in zd_ep_regs_out_msg(). Error number %d\n", r); - goto out; - } - if (req_len != actual_req_len) { - dev_dbg_f(zd_usb_dev(usb), "error in zd_ep_regs_out_msg()" - " req_len %d != actual_req_len %d\n", - req_len, actual_req_len); - r = -EIO; - goto out; - } - - /* FALL-THROUGH with r == 0 */ -out: - return r; -} diff --git a/drivers/net/wireless/zd1211rw/zd_usb.h b/drivers/net/wireless/zd1211rw/zd_usb.h deleted file mode 100644 index 45e3bb28a01c..000000000000 --- a/drivers/net/wireless/zd1211rw/zd_usb.h +++ /dev/null @@ -1,293 +0,0 @@ -/* ZD1211 USB-WLAN driver for Linux - * - * Copyright (C) 2005-2007 Ulrich Kunitz - * Copyright (C) 2006-2007 Daniel Drake - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _ZD_USB_H -#define _ZD_USB_H - -#include -#include -#include -#include -#include - -#include "zd_def.h" - -#define ZD_USB_TX_HIGH 5 -#define ZD_USB_TX_LOW 2 - -#define ZD_TX_TIMEOUT (HZ * 5) -#define ZD_TX_WATCHDOG_INTERVAL round_jiffies_relative(HZ) -#define ZD_RX_IDLE_INTERVAL round_jiffies_relative(30 * HZ) - -enum devicetype { - DEVICE_ZD1211 = 0, - DEVICE_ZD1211B = 1, - DEVICE_INSTALLER = 2, -}; - -enum endpoints { - EP_CTRL = 0, - EP_DATA_OUT = 1, - EP_DATA_IN = 2, - EP_INT_IN = 3, - EP_REGS_OUT = 4, -}; - -enum { - USB_MAX_TRANSFER_SIZE = 4096, /* bytes */ - /* FIXME: The original driver uses this value. We have to check, - * whether the MAX_TRANSFER_SIZE is sufficient and this needs only be - * used if one combined frame is split over two USB transactions. - */ - USB_MAX_RX_SIZE = 4800, /* bytes */ - USB_MAX_IOWRITE16_COUNT = 15, - USB_MAX_IOWRITE32_COUNT = USB_MAX_IOWRITE16_COUNT/2, - USB_MAX_IOREAD16_COUNT = 15, - USB_MAX_IOREAD32_COUNT = USB_MAX_IOREAD16_COUNT/2, - USB_MIN_RFWRITE_BIT_COUNT = 16, - USB_MAX_RFWRITE_BIT_COUNT = 28, - USB_MAX_EP_INT_BUFFER = 64, - USB_ZD1211B_BCD_DEVICE = 0x4810, -}; - -enum control_requests { - USB_REQ_WRITE_REGS = 0x21, - USB_REQ_READ_REGS = 0x22, - USB_REQ_WRITE_RF = 0x23, - USB_REQ_PROG_FLASH = 0x24, - USB_REQ_EEPROM_START = 0x0128, /* ? request is a byte */ - USB_REQ_EEPROM_MID = 0x28, - USB_REQ_EEPROM_END = 0x0228, /* ? request is a byte */ - USB_REQ_FIRMWARE_DOWNLOAD = 0x30, - USB_REQ_FIRMWARE_CONFIRM = 0x31, - USB_REQ_FIRMWARE_READ_DATA = 0x32, -}; - -struct usb_req_read_regs { - __le16 id; - __le16 addr[0]; -} __packed; - -struct reg_data { - __le16 addr; - __le16 value; -} __packed; - -struct usb_req_write_regs { - __le16 id; - struct reg_data reg_writes[0]; -} __packed; - -enum { - RF_IF_LE = 0x02, - RF_CLK = 0x04, - RF_DATA = 0x08, -}; - -struct usb_req_rfwrite { - __le16 id; - __le16 value; - /* 1: 3683a */ - /* 2: other (default) */ - __le16 bits; - /* RF2595: 24 */ - __le16 bit_values[0]; - /* (ZD_CR203 & ~(RF_IF_LE | RF_CLK | RF_DATA)) | (bit ? RF_DATA : 0) */ -} __packed; - -/* USB interrupt */ - -enum usb_int_id { - USB_INT_TYPE = 0x01, - USB_INT_ID_REGS = 0x90, - USB_INT_ID_RETRY_FAILED = 0xa0, -}; - -enum usb_int_flags { - USB_INT_READ_REGS_EN = 0x01, -}; - -struct usb_int_header { - u8 type; /* must always be 1 */ - u8 id; -} __packed; - -struct usb_int_regs { - struct usb_int_header hdr; - struct reg_data regs[0]; -} __packed; - -struct usb_int_retry_fail { - struct usb_int_header hdr; - u8 new_rate; - u8 _dummy; - u8 addr[ETH_ALEN]; - u8 ibss_wakeup_dest; -} __packed; - -struct read_regs_int { - struct completion completion; - struct usb_req_read_regs *req; - unsigned int req_count; - /* Stores the USB int structure and contains the USB address of the - * first requested register before request. - */ - u8 buffer[USB_MAX_EP_INT_BUFFER]; - int length; - __le16 cr_int_addr; -}; - -struct zd_ioreq16 { - zd_addr_t addr; - u16 value; -}; - -struct zd_ioreq32 { - zd_addr_t addr; - u32 value; -}; - -struct zd_usb_interrupt { - struct read_regs_int read_regs; - spinlock_t lock; - struct urb *urb; - void *buffer; - dma_addr_t buffer_dma; - int interval; - atomic_t read_regs_enabled; - u8 read_regs_int_overridden:1; -}; - -static inline struct usb_int_regs *get_read_regs(struct zd_usb_interrupt *intr) -{ - return (struct usb_int_regs *)intr->read_regs.buffer; -} - -#define RX_URBS_COUNT 5 - -struct zd_usb_rx { - spinlock_t lock; - struct mutex setup_mutex; - struct delayed_work idle_work; - struct tasklet_struct reset_timer_tasklet; - u8 fragment[2 * USB_MAX_RX_SIZE]; - unsigned int fragment_length; - unsigned int usb_packet_size; - struct urb **urbs; - int urbs_count; -}; - -/** - * struct zd_usb_tx - structure used for transmitting frames - * @enabled: atomic enabled flag, indicates whether tx is enabled - * @lock: lock for transmission - * @submitted: anchor for URBs sent to device - * @submitted_urbs: atomic integer that counts the URBs having sent to the - * device, which haven't been completed - * @stopped: indicates whether higher level tx queues are stopped - */ -struct zd_usb_tx { - atomic_t enabled; - spinlock_t lock; - struct delayed_work watchdog_work; - struct sk_buff_head submitted_skbs; - struct usb_anchor submitted; - int submitted_urbs; - u8 stopped:1, watchdog_enabled:1; -}; - -/* Contains the usb parts. The structure doesn't require a lock because intf - * will not be changed after initialization. - */ -struct zd_usb { - struct zd_usb_interrupt intr; - struct zd_usb_rx rx; - struct zd_usb_tx tx; - struct usb_interface *intf; - struct usb_anchor submitted_cmds; - struct urb *urb_async_waiting; - int cmd_error; - u8 req_buf[64]; /* zd_usb_iowrite16v needs 62 bytes */ - u8 is_zd1211b:1, initialized:1, was_running:1, in_async:1; -}; - -#define zd_usb_dev(usb) (&usb->intf->dev) - -static inline struct usb_device *zd_usb_to_usbdev(struct zd_usb *usb) -{ - return interface_to_usbdev(usb->intf); -} - -static inline struct ieee80211_hw *zd_intf_to_hw(struct usb_interface *intf) -{ - return usb_get_intfdata(intf); -} - -static inline struct ieee80211_hw *zd_usb_to_hw(struct zd_usb *usb) -{ - return zd_intf_to_hw(usb->intf); -} - -void zd_usb_init(struct zd_usb *usb, struct ieee80211_hw *hw, - struct usb_interface *intf); -int zd_usb_init_hw(struct zd_usb *usb); -void zd_usb_clear(struct zd_usb *usb); - -int zd_usb_scnprint_id(struct zd_usb *usb, char *buffer, size_t size); - -void zd_tx_watchdog_enable(struct zd_usb *usb); -void zd_tx_watchdog_disable(struct zd_usb *usb); - -int zd_usb_enable_int(struct zd_usb *usb); -void zd_usb_disable_int(struct zd_usb *usb); - -int zd_usb_enable_rx(struct zd_usb *usb); -void zd_usb_disable_rx(struct zd_usb *usb); - -void zd_usb_reset_rx_idle_timer(struct zd_usb *usb); - -void zd_usb_enable_tx(struct zd_usb *usb); -void zd_usb_disable_tx(struct zd_usb *usb); - -int zd_usb_tx(struct zd_usb *usb, struct sk_buff *skb); - -int zd_usb_ioread16v(struct zd_usb *usb, u16 *values, - const zd_addr_t *addresses, unsigned int count); - -static inline int zd_usb_ioread16(struct zd_usb *usb, u16 *value, - const zd_addr_t addr) -{ - return zd_usb_ioread16v(usb, value, &addr, 1); -} - -void zd_usb_iowrite16v_async_start(struct zd_usb *usb); -int zd_usb_iowrite16v_async_end(struct zd_usb *usb, unsigned int timeout); -int zd_usb_iowrite16v_async(struct zd_usb *usb, const struct zd_ioreq16 *ioreqs, - unsigned int count); -int zd_usb_iowrite16v(struct zd_usb *usb, const struct zd_ioreq16 *ioreqs, - unsigned int count); - -int zd_usb_rfwrite(struct zd_usb *usb, u32 value, u8 bits); - -int zd_usb_read_fw(struct zd_usb *usb, zd_addr_t addr, u8 *data, u16 len); - -extern struct workqueue_struct *zd_workqueue; - -#endif /* _ZD_USB_H */ -- 2.34.1